summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Klocek <michal.klocek@qt.io>2017-01-18 18:30:15 +0100
committerMichal Klocek <michal.klocek@qt.io>2017-01-19 12:03:01 +0000
commit11e5c2ddbda46865261266214ed1345679fef0d2 (patch)
tree679d19753f7c85614a0c163a42b806b54bc970de
parent891fb3a82f7257b70a06527fef20be5e48ccd71a (diff)
Revert "Add mus and catapult project files"
This reverts commit f0e73b6da23ab32db1edfbc912bc3ce989bf9a06. Change-Id: I0ee65ed5f04597d7538ef59e3699867871524fe1 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--chromium/components/mus/DEPS12
-rw-r--r--chromium/components/mus/OWNERS4
-rw-r--r--chromium/components/mus/clipboard/clipboard_impl.cc108
-rw-r--r--chromium/components/mus/clipboard/clipboard_impl.h65
-rw-r--r--chromium/components/mus/clipboard/clipboard_unittest.cc145
-rw-r--r--chromium/components/mus/clipboard/test_manifest.json10
-rw-r--r--chromium/components/mus/common/DEPS12
-rw-r--r--chromium/components/mus/common/event_matcher_util.cc28
-rw-r--r--chromium/components/mus/common/event_matcher_util.h22
-rw-r--r--chromium/components/mus/common/generic_shared_memory_id_generator.cc21
-rw-r--r--chromium/components/mus/common/generic_shared_memory_id_generator.h19
-rw-r--r--chromium/components/mus/common/gpu_memory_buffer_impl.cc46
-rw-r--r--chromium/components/mus/common/gpu_memory_buffer_impl.h61
-rw-r--r--chromium/components/mus/common/gpu_service.cc256
-rw-r--r--chromium/components/mus/common/gpu_service.h86
-rw-r--r--chromium/components/mus/common/gpu_type_converters.cc164
-rw-r--r--chromium/components/mus/common/gpu_type_converters.h95
-rw-r--r--chromium/components/mus/common/gpu_type_converters_unittest.cc94
-rw-r--r--chromium/components/mus/common/mojo_buffer_backing.cc34
-rw-r--r--chromium/components/mus/common/mojo_buffer_backing.h40
-rw-r--r--chromium/components/mus/common/mojo_gpu_memory_buffer.cc107
-rw-r--r--chromium/components/mus/common/mojo_gpu_memory_buffer.h54
-rw-r--r--chromium/components/mus/common/mojo_gpu_memory_buffer_manager.cc46
-rw-r--r--chromium/components/mus/common/mojo_gpu_memory_buffer_manager.h43
-rw-r--r--chromium/components/mus/common/mus_common_export.h29
-rw-r--r--chromium/components/mus/common/mus_common_unittests_app_manifest.json10
-rw-r--r--chromium/components/mus/common/run_all_shelltests.cc34
-rw-r--r--chromium/components/mus/common/switches.cc20
-rw-r--r--chromium/components/mus/common/switches.h21
-rw-r--r--chromium/components/mus/common/transient_window_utils.h126
-rw-r--r--chromium/components/mus/common/types.h25
-rw-r--r--chromium/components/mus/common/util.h32
-rw-r--r--chromium/components/mus/demo/DEPS4
-rw-r--r--chromium/components/mus/demo/OWNERS2
-rw-r--r--chromium/components/mus/demo/main.cc13
-rw-r--r--chromium/components/mus/demo/manifest.json14
-rw-r--r--chromium/components/mus/demo/mus_demo.cc179
-rw-r--r--chromium/components/mus/demo/mus_demo.h92
-rw-r--r--chromium/components/mus/gles2/DEPS8
-rw-r--r--chromium/components/mus/gles2/OWNERS2
-rw-r--r--chromium/components/mus/gles2/command_buffer_driver.cc568
-rw-r--r--chromium/components/mus/gles2/command_buffer_driver.h173
-rw-r--r--chromium/components/mus/gles2/command_buffer_driver_manager.cc50
-rw-r--r--chromium/components/mus/gles2/command_buffer_driver_manager.h46
-rw-r--r--chromium/components/mus/gles2/command_buffer_impl.cc301
-rw-r--r--chromium/components/mus/gles2/command_buffer_impl.h126
-rw-r--r--chromium/components/mus/gles2/command_buffer_local.cc576
-rw-r--r--chromium/components/mus/gles2/command_buffer_local.h185
-rw-r--r--chromium/components/mus/gles2/command_buffer_local_client.h31
-rw-r--r--chromium/components/mus/gles2/command_buffer_task_runner.cc77
-rw-r--r--chromium/components/mus/gles2/command_buffer_task_runner.h78
-rw-r--r--chromium/components/mus/gles2/gl_surface_adapter.cc57
-rw-r--r--chromium/components/mus/gles2/gl_surface_adapter.h71
-rw-r--r--chromium/components/mus/gles2/gpu_impl.cc27
-rw-r--r--chromium/components/mus/gles2/gpu_impl.h39
-rw-r--r--chromium/components/mus/gles2/gpu_memory_tracker.cc36
-rw-r--r--chromium/components/mus/gles2/gpu_memory_tracker.h39
-rw-r--r--chromium/components/mus/gles2/gpu_state.cc82
-rw-r--r--chromium/components/mus/gles2/gpu_state.h107
-rw-r--r--chromium/components/mus/gles2/ozone_gpu_memory_buffer.cc115
-rw-r--r--chromium/components/mus/gles2/ozone_gpu_memory_buffer.h71
-rw-r--r--chromium/components/mus/gles2/raster_thread_helper.cc27
-rw-r--r--chromium/components/mus/gles2/raster_thread_helper.h34
-rw-r--r--chromium/components/mus/gpu/DEPS21
-rw-r--r--chromium/components/mus/gpu/OWNERS2
-rw-r--r--chromium/components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h27
-rw-r--r--chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.cc46
-rw-r--r--chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.h55
-rw-r--r--chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.cc112
-rw-r--r--chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.h74
-rw-r--r--chromium/components/mus/gpu/display_compositor/display_compositor_impl.cc28
-rw-r--r--chromium/components/mus/gpu/display_compositor/display_compositor_impl.h37
-rw-r--r--chromium/components/mus/gpu/display_compositor/display_impl.cc43
-rw-r--r--chromium/components/mus/gpu/display_compositor/display_impl.h44
-rw-r--r--chromium/components/mus/gpu/gpu_service_impl.cc63
-rw-r--r--chromium/components/mus/gpu/gpu_service_impl.h49
-rw-r--r--chromium/components/mus/gpu/gpu_service_mus.cc273
-rw-r--r--chromium/components/mus/gpu/gpu_service_mus.h173
-rw-r--r--chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.cc115
-rw-r--r--chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.h57
-rw-r--r--chromium/components/mus/gpu/mus_gpu_unittests_app_manifest.json10
-rw-r--r--chromium/components/mus/input_devices/input_device_server.cc110
-rw-r--r--chromium/components/mus/input_devices/input_device_server.h69
-rw-r--r--chromium/components/mus/main.cc13
-rw-r--r--chromium/components/mus/manifest.json26
-rw-r--r--chromium/components/mus/mus_app.cc388
-rw-r--r--chromium/components/mus/mus_app.h182
-rw-r--r--chromium/components/mus/public/cpp/DEPS3
-rw-r--r--chromium/components/mus/public/cpp/context_provider.h54
-rw-r--r--chromium/components/mus/public/cpp/gles2_context.h61
-rw-r--r--chromium/components/mus/public/cpp/input_devices/input_device_client.cc112
-rw-r--r--chromium/components/mus/public/cpp/input_devices/input_device_client.h84
-rw-r--r--chromium/components/mus/public/cpp/input_event_handler.h43
-rw-r--r--chromium/components/mus/public/cpp/lib/DEPS3
-rw-r--r--chromium/components/mus/public/cpp/lib/command_buffer_client_impl.cc370
-rw-r--r--chromium/components/mus/public/cpp/lib/command_buffer_client_impl.h117
-rw-r--r--chromium/components/mus/public/cpp/lib/context_provider.cc61
-rw-r--r--chromium/components/mus/public/cpp/lib/gles2_context.cc109
-rw-r--r--chromium/components/mus/public/cpp/lib/in_flight_change.cc220
-rw-r--r--chromium/components/mus/public/cpp/lib/in_flight_change.h298
-rw-r--r--chromium/components/mus/public/cpp/lib/output_surface.cc70
-rw-r--r--chromium/components/mus/public/cpp/lib/property_type_converters.cc207
-rw-r--r--chromium/components/mus/public/cpp/lib/scoped_window_ptr.cc44
-rw-r--r--chromium/components/mus/public/cpp/lib/window.cc891
-rw-r--r--chromium/components/mus/public/cpp/lib/window_observer.cc18
-rw-r--r--chromium/components/mus/public/cpp/lib/window_private.cc31
-rw-r--r--chromium/components/mus/public/cpp/lib/window_private.h100
-rw-r--r--chromium/components/mus/public/cpp/lib/window_surface.cc69
-rw-r--r--chromium/components/mus/public/cpp/lib/window_tree_client.cc1181
-rw-r--r--chromium/components/mus/public/cpp/lib/window_tree_client_delegate.cc11
-rw-r--r--chromium/components/mus/public/cpp/lib/window_tree_host_factory.cc32
-rw-r--r--chromium/components/mus/public/cpp/output_surface.h45
-rw-r--r--chromium/components/mus/public/cpp/property_type_converters.h96
-rw-r--r--chromium/components/mus/public/cpp/scoped_window_ptr.h42
-rw-r--r--chromium/components/mus/public/cpp/window.h356
-rw-r--r--chromium/components/mus/public/cpp/window_manager_delegate.h116
-rw-r--r--chromium/components/mus/public/cpp/window_observer.h110
-rw-r--r--chromium/components/mus/public/cpp/window_property.h156
-rw-r--r--chromium/components/mus/public/cpp/window_surface.h85
-rw-r--r--chromium/components/mus/public/cpp/window_surface_client.h24
-rw-r--r--chromium/components/mus/public/cpp/window_tracker.h21
-rw-r--r--chromium/components/mus/public/cpp/window_tree_client.h407
-rw-r--r--chromium/components/mus/public/cpp/window_tree_client_delegate.h53
-rw-r--r--chromium/components/mus/public/cpp/window_tree_client_observer.h27
-rw-r--r--chromium/components/mus/public/cpp/window_tree_host_factory.h37
-rw-r--r--chromium/components/mus/public/interfaces/OWNERS2
-rw-r--r--chromium/components/mus/public/interfaces/gpu/OWNERS2
-rw-r--r--chromium/components/mus/surfaces/DEPS10
-rw-r--r--chromium/components/mus/surfaces/OWNERS2
-rw-r--r--chromium/components/mus/surfaces/direct_output_surface.cc81
-rw-r--r--chromium/components/mus/surfaces/direct_output_surface.h47
-rw-r--r--chromium/components/mus/surfaces/direct_output_surface_ozone.cc166
-rw-r--r--chromium/components/mus/surfaces/direct_output_surface_ozone.h84
-rw-r--r--chromium/components/mus/surfaces/display_compositor.cc124
-rw-r--r--chromium/components/mus/surfaces/display_compositor.h80
-rw-r--r--chromium/components/mus/surfaces/ozone_gpu_memory_buffer_manager.cc49
-rw-r--r--chromium/components/mus/surfaces/ozone_gpu_memory_buffer_manager.h39
-rw-r--r--chromium/components/mus/surfaces/surfaces_context_provider.cc206
-rw-r--r--chromium/components/mus/surfaces/surfaces_context_provider.h109
-rw-r--r--chromium/components/mus/surfaces/surfaces_context_provider_delegate.h28
-rw-r--r--chromium/components/mus/surfaces/surfaces_state.cc13
-rw-r--r--chromium/components/mus/surfaces/surfaces_state.h49
-rw-r--r--chromium/components/mus/test_wm/manifest.json10
-rw-r--r--chromium/components/mus/test_wm/test_wm.cc107
-rw-r--r--chromium/components/mus/ws/accelerator.cc33
-rw-r--r--chromium/components/mus/ws/accelerator.h57
-rw-r--r--chromium/components/mus/ws/access_policy.h84
-rw-r--r--chromium/components/mus/ws/access_policy_delegate.h41
-rw-r--r--chromium/components/mus/ws/animation_runner.cc163
-rw-r--r--chromium/components/mus/ws/animation_runner.h119
-rw-r--r--chromium/components/mus/ws/animation_runner_observer.h25
-rw-r--r--chromium/components/mus/ws/animation_runner_unittest.cc639
-rw-r--r--chromium/components/mus/ws/cursor_unittest.cc198
-rw-r--r--chromium/components/mus/ws/default_access_policy.cc203
-rw-r--r--chromium/components/mus/ws/default_access_policy.h76
-rw-r--r--chromium/components/mus/ws/display.cc419
-rw-r--r--chromium/components/mus/ws/display.h224
-rw-r--r--chromium/components/mus/ws/display_binding.cc39
-rw-r--r--chromium/components/mus/ws/display_binding.h60
-rw-r--r--chromium/components/mus/ws/display_manager.cc167
-rw-r--r--chromium/components/mus/ws/display_manager.h102
-rw-r--r--chromium/components/mus/ws/display_manager_delegate.h38
-rw-r--r--chromium/components/mus/ws/display_unittest.cc308
-rw-r--r--chromium/components/mus/ws/event_dispatcher.cc559
-rw-r--r--chromium/components/mus/ws/event_dispatcher.h236
-rw-r--r--chromium/components/mus/ws/event_dispatcher_delegate.h73
-rw-r--r--chromium/components/mus/ws/event_dispatcher_unittest.cc1614
-rw-r--r--chromium/components/mus/ws/event_matcher.cc113
-rw-r--r--chromium/components/mus/ws/event_matcher.h56
-rw-r--r--chromium/components/mus/ws/event_matcher_unittest.cc71
-rw-r--r--chromium/components/mus/ws/focus_controller.cc311
-rw-r--r--chromium/components/mus/ws/focus_controller.h104
-rw-r--r--chromium/components/mus/ws/focus_controller_delegate.h26
-rw-r--r--chromium/components/mus/ws/focus_controller_observer.h29
-rw-r--r--chromium/components/mus/ws/focus_controller_unittest.cc312
-rw-r--r--chromium/components/mus/ws/ids.h113
-rw-r--r--chromium/components/mus/ws/modal_window_controller.cc121
-rw-r--r--chromium/components/mus/ws/modal_window_controller.h87
-rw-r--r--chromium/components/mus/ws/mus_ws_unittests_app_manifest.json16
-rw-r--r--chromium/components/mus/ws/operation.cc30
-rw-r--r--chromium/components/mus/ws/operation.h77
-rw-r--r--chromium/components/mus/ws/platform_display.cc414
-rw-r--r--chromium/components/mus/ws/platform_display.h195
-rw-r--r--chromium/components/mus/ws/platform_display_delegate.h53
-rw-r--r--chromium/components/mus/ws/platform_display_factory.h23
-rw-r--r--chromium/components/mus/ws/platform_display_init_params.cc21
-rw-r--r--chromium/components/mus/ws/platform_display_init_params.h39
-rw-r--r--chromium/components/mus/ws/platform_screen.h43
-rw-r--r--chromium/components/mus/ws/platform_screen_impl.cc43
-rw-r--r--chromium/components/mus/ws/platform_screen_impl.h39
-rw-r--r--chromium/components/mus/ws/platform_screen_impl_ozone.cc126
-rw-r--r--chromium/components/mus/ws/platform_screen_impl_ozone.h72
-rw-r--r--chromium/components/mus/ws/scheduled_animation_group.cc356
-rw-r--r--chromium/components/mus/ws/scheduled_animation_group.h116
-rw-r--r--chromium/components/mus/ws/scheduled_animation_group_unittest.cc92
-rw-r--r--chromium/components/mus/ws/server_window.cc470
-rw-r--r--chromium/components/mus/ws/server_window.h249
-rw-r--r--chromium/components/mus/ws/server_window_delegate.h46
-rw-r--r--chromium/components/mus/ws/server_window_drawn_tracker.cc136
-rw-r--r--chromium/components/mus/ws/server_window_drawn_tracker.h65
-rw-r--r--chromium/components/mus/ws/server_window_drawn_tracker_observer.h41
-rw-r--r--chromium/components/mus/ws/server_window_drawn_tracker_unittest.cc235
-rw-r--r--chromium/components/mus/ws/server_window_observer.h97
-rw-r--r--chromium/components/mus/ws/server_window_surface.cc110
-rw-r--r--chromium/components/mus/ws/server_window_surface.h86
-rw-r--r--chromium/components/mus/ws/server_window_surface_manager.cc102
-rw-r--r--chromium/components/mus/ws/server_window_surface_manager.h84
-rw-r--r--chromium/components/mus/ws/server_window_surface_manager_test_api.cc39
-rw-r--r--chromium/components/mus/ws/server_window_surface_manager_test_api.h39
-rw-r--r--chromium/components/mus/ws/server_window_tracker.h25
-rw-r--r--chromium/components/mus/ws/test_change_tracker.cc448
-rw-r--r--chromium/components/mus/ws/test_change_tracker.h185
-rw-r--r--chromium/components/mus/ws/test_server_window_delegate.cc34
-rw-r--r--chromium/components/mus/ws/test_server_window_delegate.h41
-rw-r--r--chromium/components/mus/ws/test_utils.cc496
-rw-r--r--chromium/components/mus/ws/test_utils.h537
-rw-r--r--chromium/components/mus/ws/touch_controller.cc105
-rw-r--r--chromium/components/mus/ws/touch_controller.h37
-rw-r--r--chromium/components/mus/ws/transient_windows_unittest.cc342
-rw-r--r--chromium/components/mus/ws/user_activity_monitor.cc134
-rw-r--r--chromium/components/mus/ws/user_activity_monitor.h82
-rw-r--r--chromium/components/mus/ws/user_activity_monitor_unittest.cc218
-rw-r--r--chromium/components/mus/ws/user_display_manager.cc151
-rw-r--r--chromium/components/mus/ws/user_display_manager.h118
-rw-r--r--chromium/components/mus/ws/user_display_manager_unittest.cc244
-rw-r--r--chromium/components/mus/ws/user_id.h22
-rw-r--r--chromium/components/mus/ws/user_id_tracker.cc68
-rw-r--r--chromium/components/mus/ws/user_id_tracker.h62
-rw-r--r--chromium/components/mus/ws/user_id_tracker_observer.h29
-rw-r--r--chromium/components/mus/ws/window_coordinate_conversions.cc74
-rw-r--r--chromium/components/mus/ws/window_coordinate_conversions.h39
-rw-r--r--chromium/components/mus/ws/window_coordinate_conversions_unittest.cc62
-rw-r--r--chromium/components/mus/ws/window_finder.cc68
-rw-r--r--chromium/components/mus/ws/window_finder.h33
-rw-r--r--chromium/components/mus/ws/window_finder_unittest.cc79
-rw-r--r--chromium/components/mus/ws/window_manager_access_policy.cc184
-rw-r--r--chromium/components/mus/ws/window_manager_access_policy.h76
-rw-r--r--chromium/components/mus/ws/window_manager_client_unittest.cc1171
-rw-r--r--chromium/components/mus/ws/window_manager_display_root.cc34
-rw-r--r--chromium/components/mus/ws/window_manager_display_root.h62
-rw-r--r--chromium/components/mus/ws/window_manager_state.cc485
-rw-r--r--chromium/components/mus/ws/window_manager_state.h183
-rw-r--r--chromium/components/mus/ws/window_manager_state_unittest.cc419
-rw-r--r--chromium/components/mus/ws/window_manager_window_tree_factory.cc64
-rw-r--r--chromium/components/mus/ws/window_manager_window_tree_factory.h68
-rw-r--r--chromium/components/mus/ws/window_manager_window_tree_factory_set.cc99
-rw-r--r--chromium/components/mus/ws/window_manager_window_tree_factory_set.h93
-rw-r--r--chromium/components/mus/ws/window_manager_window_tree_factory_set_observer.h26
-rw-r--r--chromium/components/mus/ws/window_server.cc707
-rw-r--r--chromium/components/mus/ws/window_server.h342
-rw-r--r--chromium/components/mus/ws/window_server_delegate.cc25
-rw-r--r--chromium/components/mus/ws/window_server_delegate.h67
-rw-r--r--chromium/components/mus/ws/window_server_test_impl.cc66
-rw-r--r--chromium/components/mus/ws/window_server_test_impl.h45
-rw-r--r--chromium/components/mus/ws/window_tree.cc1539
-rw-r--r--chromium/components/mus/ws/window_tree.h497
-rw-r--r--chromium/components/mus/ws/window_tree_binding.cc62
-rw-r--r--chromium/components/mus/ws/window_tree_binding.h72
-rw-r--r--chromium/components/mus/ws/window_tree_client_unittest.cc2042
-rw-r--r--chromium/components/mus/ws/window_tree_factory.cc42
-rw-r--r--chromium/components/mus/ws/window_tree_factory.h42
-rw-r--r--chromium/components/mus/ws/window_tree_host_factory.cc42
-rw-r--r--chromium/components/mus/ws/window_tree_host_factory.h46
-rw-r--r--chromium/components/mus/ws/window_tree_unittest.cc1017
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/README.chromium8
-rwxr-xr-xchromium/third_party/catapult/third_party/py_vulcanize/bin/run_py_tests29
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/__init__.py11
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/fake_fs.py146
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/fake_fs_unittest.py52
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/generate.py274
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/generate_unittest.py59
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/html_generation_controller.py28
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/html_module.py195
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/html_module_unittest.py347
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/js_utils.py7
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/js_utils_unittest.py18
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/module.py269
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/module_unittest.py130
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/parse_html_deps.py216
-rwxr-xr-xchromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/parse_html_deps_unittest.py274
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/project.py229
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/resource.py57
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/resource_loader.py227
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/resource_unittest.py17
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/strip_js_comments.py81
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/strip_js_comments_unittest.py54
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/style_sheet.py138
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/style_sheet_unittest.py67
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/LICENSE201
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/MANIFEST354
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/PKG-INFO316
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/README.chromium16
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/README.rst153
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/__init__.py39
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/include/cext.h244
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/__init__.py27
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/commands.py267
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/data.py165
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/dist.py51
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/ext.py254
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/setup.py419
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/shell.py478
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/term/__init__.py28
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/term/_term.py115
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/util.py73
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/__init__.py27
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/commands.py266
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/data.py165
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/dist.py51
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/ext.py253
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/setup.py420
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/shell.py351
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/term/__init__.py28
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/term/_term.py116
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/util.py63
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/LICENSE.cssmin64
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/__init__.py30
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/cssmin.py246
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/main.py236
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/wikipedia.css3861
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/wikipedia.min.css1
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/write.py344
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/BENCHMARKS61
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/CHANGES42
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/CLASSIFIERS19
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/DESCRIPTION85
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/PROVIDES1
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/SUMMARY1
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/api-objects.txt6
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/crarr.pngbin340 -> 0 bytes
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/epydoc.css322
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/epydoc.js293
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/help.html261
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/identifier-index.html163
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/index.html224
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/module-tree.html94
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/rcssmin-module.html224
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/rcssmin-pysrc.html477
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/redirect.html38
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/package.cfg84
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/rcssmin.c1163
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/rcssmin.py374
-rwxr-xr-xchromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/run_tests.py166
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/setup.py42
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/LICENSE201
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/MANIFEST56
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/PKG-INFO303
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/README.chromium15
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/README.rst141
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/__init__.py39
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/include/cext.h244
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/__init__.py27
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/commands.py267
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/data.py165
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/dist.py51
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/ext.py254
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/setup.py419
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/shell.py478
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/util.py73
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/__init__.py27
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/commands.py266
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/data.py165
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/dist.py51
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/ext.py253
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/setup.py420
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/shell.py351
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/util.py63
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/__init__.py30
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/apiviewer.js178
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/bootstrap.js1829
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js9266
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jsmin.c291
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jsmin.py226
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jsmin_2_0_9.py233
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/knockout-2.0.0.js97
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/main.py249
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/markermanager.js976
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/write.py347
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/BENCHMARKS388
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/CHANGES89
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/CLASSIFIERS19
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/DESCRIPTION72
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/PROVIDES1
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/SUMMARY1
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/api-objects.txt7
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/crarr.pngbin340 -> 0 bytes
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/epydoc.css322
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/epydoc.js293
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/help.html261
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/identifier-index.html163
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/index.html219
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/module-tree.html94
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/redirect.html38
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/rjsmin-module.html219
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/rjsmin-pysrc.html549
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/package.cfg78
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/rjsmin.c456
-rwxr-xr-xchromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/rjsmin.py446
-rw-r--r--chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/setup.py42
-rw-r--r--chromium/third_party/catapult/tracing/bin/PRESUBMIT.py19
-rwxr-xr-xchromium/third_party/catapult/tracing/bin/generate_about_tracing_contents14
-rwxr-xr-xchromium/third_party/catapult/tracing/bin/html2trace49
-rw-r--r--chromium/third_party/catapult/tracing/bin/index.html111
-rwxr-xr-xchromium/third_party/catapult/tracing/bin/merge_traces13
-rwxr-xr-xchromium/third_party/catapult/tracing/bin/run_dev_server_tests14
-rwxr-xr-xchromium/third_party/catapult/tracing/bin/run_metric52
-rwxr-xr-xchromium/third_party/catapult/tracing/bin/run_node_tests23
-rwxr-xr-xchromium/third_party/catapult/tracing/bin/run_py_tests40
-rwxr-xr-xchromium/third_party/catapult/tracing/bin/run_tests25
-rwxr-xr-xchromium/third_party/catapult/tracing/bin/run_vinn_tests14
-rwxr-xr-xchromium/third_party/catapult/tracing/bin/symbolize_trace389
-rwxr-xr-xchromium/third_party/catapult/tracing/bin/trace2html14
-rwxr-xr-xchromium/third_party/catapult/tracing/bin/update_gypi14
-rwxr-xr-xchromium/third_party/catapult/tracing/bin/validate_all_metrics41
-rwxr-xr-xchromium/third_party/catapult/tracing/bin/vulcanize_trace_viewer14
-rwxr-xr-xchromium/third_party/catapult/tracing/bin/why_imported48
-rw-r--r--chromium/third_party/catapult/tracing/third_party/chai/LICENSE7
-rw-r--r--chromium/third_party/catapult/tracing/third_party/chai/README.chromium15
-rw-r--r--chromium/third_party/catapult/tracing/third_party/chai/chai.js2
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/core-component-page/.bower.json19
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/core-component-page/README.md6
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/core-component-page/bowager-logo.pngbin5165 -> 0 bytes
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/core-component-page/bower.json9
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/core-component-page/core-component-page.html37
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/core-component-page/demo.html23
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/core-component-page/index.html22
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/polymer/.bower.json32
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/polymer/README.chromium16
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/polymer/README.md21
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/polymer/bower.json23
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/polymer/build.log26
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/polymer/layout.html286
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/polymer/polymer.html12
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/polymer/polymer.js11857
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/polymer/polymer.min.js14
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/.bower.json23
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/CustomElements.js634
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/CustomElements.min.js11
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/HTMLImports.js764
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/HTMLImports.min.js11
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/README.md73
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/ShadowDOM.js4277
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/ShadowDOM.min.js13
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/bower.json14
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/build.log31
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/package.json31
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents-lite.js1728
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents-lite.min.js11
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents.js6114
-rw-r--r--chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents.min.js14
-rw-r--r--chromium/third_party/catapult/tracing/third_party/css-element-queries/Gruntfile.js16
-rw-r--r--chromium/third_party/catapult/tracing/third_party/css-element-queries/LICENSE19
-rw-r--r--chromium/third_party/catapult/tracing/third_party/css-element-queries/README.chromium16
-rw-r--r--chromium/third_party/catapult/tracing/third_party/css-element-queries/README.md74
-rw-r--r--chromium/third_party/catapult/tracing/third_party/css-element-queries/bower.json19
-rw-r--r--chromium/third_party/catapult/tracing/third_party/css-element-queries/package.json26
-rwxr-xr-xchromium/third_party/catapult/tracing/third_party/css-element-queries/src/ElementQueries.js340
-rwxr-xr-xchromium/third_party/catapult/tracing/third_party/css-element-queries/src/ResizeSensor.js158
-rw-r--r--chromium/third_party/catapult/tracing/third_party/d3/LICENSE26
-rw-r--r--chromium/third_party/catapult/tracing/third_party/d3/README.chromium15
-rw-r--r--chromium/third_party/catapult/tracing/third_party/d3/d3.min.js5
-rw-r--r--chromium/third_party/catapult/tracing/third_party/devscripts/COPYING340
-rw-r--r--chromium/third_party/catapult/tracing/third_party/devscripts/README.chromium12
-rwxr-xr-xchromium/third_party/catapult/tracing/third_party/devscripts/licensecheck.pl671
-rw-r--r--chromium/third_party/catapult/tracing/third_party/devscripts/licensecheck.pl.vanilla577
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/BUILDING.md7
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/LICENSE.md19
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/README.chromium15
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/README.md22
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/TESTING.md12
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/VERSION1
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/bower.json27
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/dist/gl-matrix-min.js29
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/dist/gl-matrix.js5020
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/allclasses.tmpl14
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/allfiles.tmpl65
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/class.tmpl340
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/index.tmpl52
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/publish.js201
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/static/default.css428
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/static/header.html2
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/static/index.html19
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/symbol.tmpl35
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/package.json30
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/common-spec.js14
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat2-spec.js210
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat2d-spec.js194
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat3-spec.js347
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat4-spec.js637
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/quat-spec.js559
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/vec2-spec.js549
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/vec3-spec.js661
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/vec4-spec.js492
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/worker-spec.js44
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/helpers/spec-helper.js32
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/jasmine.yml74
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix.js37
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/common.js52
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat2.js302
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat2d.js317
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat3.js565
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat4.js1283
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/quat.js553
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/vec2.js523
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/vec3.js709
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/vec4.js537
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/build.rake2
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/build/compile.rake5
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/build/minify.rake5
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/default.rake1
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/release.rake21
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/support/gl-matrix.rb84
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/support/gl-matrix/release_helper.rb104
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/support/gl-matrix/version.rb28
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/webpack.config.js47
-rw-r--r--chromium/third_party/catapult/tracing/third_party/gl-matrix/webpack.config.min.js28
-rw-r--r--chromium/third_party/catapult/tracing/third_party/jszip/LICENSE.markdown651
-rw-r--r--chromium/third_party/catapult/tracing/third_party/jszip/README.chromium16
-rw-r--r--chromium/third_party/catapult/tracing/third_party/jszip/README.markdown32
-rw-r--r--chromium/third_party/catapult/tracing/third_party/jszip/jszip.min.js14
-rw-r--r--chromium/third_party/catapult/tracing/third_party/mannwhitneyu/README.chromium15
-rw-r--r--chromium/third_party/catapult/tracing/third_party/mannwhitneyu/mannwhitneyu.js197
-rw-r--r--chromium/third_party/catapult/tracing/third_party/mocha/LICENSE22
-rw-r--r--chromium/third_party/catapult/tracing/third_party/mocha/README.chromium9
-rw-r--r--chromium/third_party/catapult/tracing/third_party/mocha/mocha.css270
-rwxr-xr-xchromium/third_party/catapult/tracing/third_party/mocha/mocha.js6557
-rw-r--r--chromium/third_party/catapult/tracing/third_party/symbols/README.chromium21
-rw-r--r--chromium/third_party/catapult/tracing/third_party/symbols/symbols/PRESUBMIT.py21
-rw-r--r--chromium/third_party/catapult/tracing/third_party/symbols/symbols/__init__.py0
-rw-r--r--chromium/third_party/catapult/tracing/third_party/symbols/symbols/elf_symbolizer.py467
-rwxr-xr-xchromium/third_party/catapult/tracing/third_party/symbols/symbols/elf_symbolizer_unittest.py174
-rw-r--r--chromium/third_party/catapult/tracing/third_party/symbols/symbols/mock_addr2line/__init__.py0
-rwxr-xr-xchromium/third_party/catapult/tracing/third_party/symbols/symbols/mock_addr2line/mock_addr2line83
-rw-r--r--chromium/third_party/catapult/tracing/tracing/__init__.py6
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/base.html194
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/base64.html94
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/base64_test.html48
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/bbox2.html158
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/bbox2_test.html36
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/category_util.html42
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/color.html252
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/color_scheme.html240
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/color_scheme_test.html16
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/color_test.html104
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/event.html93
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/event_target.html161
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/event_target_test.html36
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/extension_registry.html66
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/extension_registry_base.html101
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/extension_registry_basic.html120
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/extension_registry_test.html132
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/extension_registry_type_based.html159
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/guid.html59
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/headless_tests.html78
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/interval_tree.html349
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/interval_tree_test.html236
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/iteration_helpers.html447
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/iteration_helpers_test.html333
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/math.html166
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/math_test.html42
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/multi_dimensional_view.html1167
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/multi_dimensional_view_test.html13117
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/piecewise_linear_function.html143
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/piecewise_linear_function_test.html34
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/quad.html232
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/quad_test.html130
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/raf.html214
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/raf_test.html247
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/range.html265
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/range_test.html446
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/range_utils.html140
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/range_utils_test.html133
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/rect.html162
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/rect_test.html31
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/running_statistics.html135
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/running_statistics_test.html155
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/settings.html204
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/settings_test.html113
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/sorted_array_utils.html334
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/sorted_array_utils_test.html239
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/statistics.html768
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/statistics_test.html541
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/task.html186
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/task_test.html171
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/timing.html97
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/timing_test.html85
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/unittest.html42
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/unittest/constants.html28
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/unittest/html_test_results.html480
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/unittest/interactive_test_runner.html696
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/unittest/suite_loader.html244
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/unittest/test_case.html140
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/unittest/test_case_test.html18
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/unittest/test_runner.html273
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/unittest/test_suite.html135
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/unittest/text_test_results.html117
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/unittest_test.html48
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/utils.html131
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/utils_test.html30
-rw-r--r--chromium/third_party/catapult/tracing/tracing/base/xhr.html144
-rw-r--r--chromium/third_party/catapult/tracing/tracing/core/auditor.html56
-rw-r--r--chromium/third_party/catapult/tracing/tracing/core/filter.html131
-rw-r--r--chromium/third_party/catapult/tracing/tracing/core/filter_test.html107
-rw-r--r--chromium/third_party/catapult/tracing/tracing/core/scripting_controller.html65
-rw-r--r--chromium/third_party/catapult/tracing/tracing/core/scripting_controller_test.html86
-rw-r--r--chromium/third_party/catapult/tracing/tracing/core/scripting_object.html26
-rw-r--r--chromium/third_party/catapult/tracing/tracing/core/test_utils.html483
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/ads/domain_category.html86
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/ads/domain_category_test.html39
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/android/android_auditor.html760
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/android/android_auditor_test.html413
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/blame_context.html74
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/blame_context_test.html64
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/frame_blame_context_test.html44
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/frame_tree_node.html69
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/render_frame.html79
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/top_level.html59
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/cc.html12
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/constants.html27
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/debug_colors.html77
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/display_item_list.html54
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/display_item_list_test.html46
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/input_latency_async_slice.html628
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/input_latency_async_slice_test.html689
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_impl.html208
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_host_impl.html192
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_host_impl_test.html30
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_host_impl_test_data.js330
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_impl.html170
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/picture.html413
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/picture_as_image_data.html71
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/picture_test.html49
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/raster_task.html70
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/region.html62
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/render_pass.html44
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/tile.html88
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/tile_coverage_rect.html28
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/tile_test.html30
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/util.html153
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/util_test.html114
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_auditor.html85
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_auditor_test.html129
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_test_utils.html161
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_user_friendly_category_driver.html208
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_user_friendly_category_driver_test.html78
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/gpu_async_slice.html44
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/gpu_async_slice_test.html72
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/state.html52
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/state_test.html31
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/state_test_data.js22
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/layout_object.html205
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/layout_object_test.html77
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/layout_tree.html54
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/slice_title_fixer.html37
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome/slice_title_fixer_test.html28
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/chrome_config.html33
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/full_config.html12
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/android/event_log_importer.html321
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/battor_importer.html181
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/battor_importer_test.html85
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/ddms_importer.html221
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/ddms_importer_test.html188
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/etw/etw_importer.html477
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/etw/etw_importer_test.html291
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/etw/eventtrace_parser.html110
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/etw/eventtrace_parser_test.html120
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/etw/parser.html73
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/etw/process_parser.html181
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/etw/process_parser_test.html150
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/etw/thread_parser.html243
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/etw/thread_parser_test.html179
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/gcloud_trace/gcloud_trace_importer.html99
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/gcloud_trace/gcloud_trace_importer_test.html99
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/gzip_importer.html188
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/gzip_importer_test.html105
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/jszip.html35
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/android_parser.html240
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/android_parser_test.html230
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/binder_parser.html694
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/binder_parser_test.html225
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/bus_parser.html90
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/bus_parser_test.html68
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/clock_parser.html70
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/clock_parser_test.html60
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/cpufreq_parser.html115
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/cpufreq_parser_test.html173
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/disk_parser.html313
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/disk_parser_test.html119
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/drm_parser.html71
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/drm_parser_test.html34
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/exynos_parser.html128
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/exynos_parser_test.html128
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer.html920
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer_test.html530
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/gesture_parser.html144
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/gesture_parser_test.html213
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/i915_parser.html371
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/i915_parser_test.html105
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/irq_parser.html184
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/irq_parser_test.html51
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/kfunc_parser.html113
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/kfunc_parser_test.html60
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/mali_parser.html568
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/mali_parser_test.html485
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/memreclaim_parser.html155
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/memreclaim_parser_test.html170
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/parser.html90
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/power_parser.html183
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/power_parser_test.html93
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/regulator_parser.html143
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/regulator_parser_test.html45
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sched_parser.html150
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sched_parser_test.html222
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sync_parser.html135
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sync_parser_test.html55
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/workqueue_parser.html103
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/workqueue_parser_test.html36
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/trace2html_importer.html95
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/trace2html_importer_test.html44
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/trace_code_entry.html129
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/trace_code_entry_test.html124
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/trace_code_map.html127
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer.html2989
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer_perf_test.html69
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer_test.html5754
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/v8/codemap.html382
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/v8/log_reader.html213
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/v8/splaytree.html306
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/v8/v8_log_importer.html375
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/v8/v8_log_importer_test.html305
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/importer/zip_importer.html69
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/lean_config.html14
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/measure/measure.html8
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/measure/measure_async_slice.html51
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/measure/measure_async_slice_test.html64
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/net/net.html8
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/net/net_async_slice.html99
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/net/net_async_slice_test.html193
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/system_stats/system_stats_snapshot.html53
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/systrace_config.html15
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/tquery/context.html39
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/tquery/filter.html50
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_all_of.html61
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_any_of.html68
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_ancestor.html53
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_duration.html49
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_title.html41
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_is_top_level.html50
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_not.html50
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/tquery/tquery.html190
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/tquery/tquery_test.html243
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/vsync/vsync_auditor.html140
-rw-r--r--chromium/third_party/catapult/tracing/tracing/extras/vsync/vsync_auditor_test.html139
-rw-r--r--chromium/third_party/catapult/tracing/tracing/importer/clock_sync_test.html123
-rw-r--r--chromium/third_party/catapult/tracing/tracing/importer/context_processor.html196
-rw-r--r--chromium/third_party/catapult/tracing/tracing/importer/context_processor_test.html273
-rw-r--r--chromium/third_party/catapult/tracing/tracing/importer/empty_importer.html48
-rw-r--r--chromium/third_party/catapult/tracing/tracing/importer/find_input_expectations.html1084
-rw-r--r--chromium/third_party/catapult/tracing/tracing/importer/find_load_expectations.html64
-rw-r--r--chromium/third_party/catapult/tracing/tracing/importer/find_startup_expectations.html89
-rw-r--r--chromium/third_party/catapult/tracing/tracing/importer/import.html395
-rw-r--r--chromium/third_party/catapult/tracing/tracing/importer/import_test.html216
-rw-r--r--chromium/third_party/catapult/tracing/tracing/importer/importer.html85
-rw-r--r--chromium/third_party/catapult/tracing/tracing/importer/proto_expectation.html165
-rw-r--r--chromium/third_party/catapult/tracing/tracing/importer/simple_line_reader.html53
-rw-r--r--chromium/third_party/catapult/tracing/tracing/importer/user_expectation_verifier.html77
-rw-r--r--chromium/third_party/catapult/tracing/tracing/importer/user_model_builder.html231
-rw-r--r--chromium/third_party/catapult/tracing/tracing/importer/user_model_builder_test.html883
-rw-r--r--chromium/third_party/catapult/tracing/tracing/index.js23
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/__init__.py15
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html21
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/discover.py34
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/discover_cmdline.html30
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/discover_unittest.py22
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function.html58
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function_test.html61
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/metric_registry.html37
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/metric_registry_test.html65
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/metric_runner.py45
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/sample_metric.html38
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric.html59
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric_test.html61
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric.html78
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric_test.html56
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric.html423
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric_test.html235
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric.html145
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric_test.html88
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/long_tasks_metric.html107
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric.html1023
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric_test.html2473
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric.html57
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric_test.html65
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/responsiveness_metric.html158
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/system_health_metrics.html33
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/utils.html43
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric.html64
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric_test.html68
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric.html189
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric_test.html172
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric.html219
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric_test.html73
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric.html299
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric_test.html252
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/v8/utils.html256
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/v8/utils_test.html145
-rw-r--r--chromium/third_party/catapult/tracing/tracing/metrics/v8/v8_metrics.html29
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/activity.html56
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/alert.html58
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/annotation.html83
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/annotation_test.html45
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/async_slice.html160
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/async_slice_group.html166
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/async_slice_group_test.html68
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/async_slice_test.html57
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/clock_sync_manager.html380
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/clock_sync_manager_test.html363
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/comment_box_annotation.html61
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/compound_event_selection_state.html40
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/constants.html25
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/container_memory_dump.html93
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/container_memory_dump_test.html177
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/counter.html195
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/counter_sample.html105
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/counter_sample_test.html47
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/counter_series.html125
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/counter_test.html109
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/cpu.html273
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/cpu_slice.html68
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/cpu_test.html202
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/device.html109
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/device_test.html71
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/event.html69
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/event_container.html141
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/event_info.html39
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/event_registry.html87
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/event_set.html309
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/event_set_test.html326
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/event_test.html46
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/flow_event.html68
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/frame.html98
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/global_memory_dump.html870
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/global_memory_dump_test.html3944
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/heap_dump.html67
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/heap_dump_test.html60
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/helpers/android_app.html310
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/helpers/android_model_helper.html104
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/helpers/android_model_helper_test.html227
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/helpers/android_surface_flinger.html105
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_browser_helper.html129
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_browser_helper_test.html83
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_gpu_helper.html41
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_model_helper.html124
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_model_helper_test.html167
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_process_helper.html86
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_renderer_helper.html69
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/instant_event.html102
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/interaction_record_test.html117
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/ir_coverage.html87
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/ir_coverage_test.html90
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/kernel.html134
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/kernel_test.html73
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/location.html162
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/memory_allocator_dump.html221
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/memory_allocator_dump_test.html218
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/memory_dump_test_utils.html151
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/model.html650
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/model_indices.html55
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/model_indices_test.html45
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/model_settings.html140
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/model_settings_test.html178
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/model_stats.html89
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/model_stats_test.html62
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/model_test.html341
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/object_collection.html233
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/object_collection_test.html231
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/object_instance.html206
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/object_instance_test.html70
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/object_snapshot.html101
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/object_snapshot_test.html40
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/power_sample.html74
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/power_sample_test.html52
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/power_series.html126
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/power_series_test.html150
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/process.html160
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/process_base.html236
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/process_memory_dump.html246
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/process_memory_dump_test.html553
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/process_test.html112
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/proxy_selectable_item.html44
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/proxy_selectable_item_test.html39
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/rect_annotation.html66
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/sample.html70
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/sample_test.html35
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/scoped_id.html35
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/selectable_item.html59
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/selectable_item_test.html80
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/selection_state.html72
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/slice.html297
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/slice_group.html662
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/slice_group_test.html881
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/slice_test.html219
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/source_info/js_source_info.html55
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/source_info/source_info.html58
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/source_info/source_info_test.html27
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/stack_frame.html103
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/stack_frame_test.html29
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/thread.html334
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/thread_slice.html71
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/thread_slice_test.html40
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/thread_test.html183
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/thread_time_slice.html161
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/time_to_object_instance_map.html193
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/time_to_object_instance_map_test.html163
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/timed_event.html61
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/timed_event_test.html45
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/user_model/animation_expectation.html49
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/user_model/idle_expectation.html34
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/user_model/load_expectation.html69
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/user_model/response_expectation.html35
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/user_model/startup_expectation.html33
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/user_model/stub_expectation.html74
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/user_model/user_expectation.html151
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/user_model/user_model.html67
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/vm_region.html389
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/vm_region_test.html1071
-rw-r--r--chromium/third_party/catapult/tracing/tracing/model/x_marker_annotation.html51
-rw-r--r--chromium/third_party/catapult/tracing/tracing/results2_template.html31
-rw-r--r--chromium/third_party/catapult/tracing/tracing/tests.html55
-rw-r--r--chromium/third_party/catapult/tracing/tracing/trace2html.html73
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/alert_sub_view.html161
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/alert_sub_view_test.html82
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_link.html124
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_link_test.html59
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_sub_view.html46
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_sub_view_test.html35
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_view.html258
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_view_test.html145
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/container_memory_dump_sub_view.html165
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/container_memory_dump_sub_view_test.html349
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/counter_sample_sub_view.html120
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/counter_sample_sub_view_test.html172
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/flow_classifier.html89
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/flow_classifier_test.html53
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/frame_power_usage_chart.html139
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/frame_power_usage_chart_perf_test.html44
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/frame_power_usage_chart_test.html267
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/generic_object_view.html339
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/generic_object_view_test.html206
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/layout_tree_sub_view.html203
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_allocator_details_pane.html854
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_allocator_details_pane_test.html1214
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_header_pane.html174
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_header_pane_test.html132
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_heap_details_pane.html488
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_heap_details_pane_test.html4091
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_overview_pane.html757
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_overview_pane_test.html812
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_sub_view_test_utils.html570
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_sub_view_util.html889
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_sub_view_util_test.html1218
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_vm_regions_details_pane.html379
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_vm_regions_details_pane_test.html489
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_async_slice_sub_view.html72
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_async_slice_sub_view_test.html48
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_cpu_slice_sub_view.html42
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_cpu_slice_sub_view_test.html49
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_details_table.html333
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_details_table_test.html171
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_sub_view.html128
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_sub_view_test.html103
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary.html205
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary_table.html316
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary_table_test.html110
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary_test.html112
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_flow_event_sub_view.html40
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_flow_event_sub_view_test.html39
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_frame_sub_view.html51
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_instant_event_sub_view.html47
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_instant_event_sub_view_test.html43
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_object_sub_view.html93
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_object_sub_view_test.html47
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_power_sample_sub_view.html67
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_power_sample_sub_view_test.html63
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_sample_sub_view.html268
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_sample_sub_view_test.html118
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_slice_sub_view.html94
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_slice_sub_view_test.html85
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_time_slice_sub_view.html42
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_time_slice_sub_view_test.html50
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_user_expectation_sub_view.html70
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/object_instance_view.html62
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/object_snapshot_view.html63
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/power_sample_summary_table.html129
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/power_sample_summary_table_test.html137
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/related_events.html263
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/related_events_test.html217
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/selection_summary_table.html94
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/selection_summary_table_test.html75
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_alert_sub_view.html65
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_async_slice_sub_view.html71
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_async_slice_sub_view_test.html41
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_cpu_slice_sub_view.html139
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_cpu_slice_sub_view_test.html81
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_event_sub_view.html286
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_event_sub_view_test.html261
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_flow_event_sub_view.html50
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_flow_event_sub_view_test.html52
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_frame_sub_view.html52
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_instant_event_sub_view.html45
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_instant_event_sub_view_test.html42
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_instance_sub_view.html116
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_instance_sub_view_test.html34
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_snapshot_sub_view.html128
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_snapshot_sub_view_test.html32
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_power_sample_sub_view.html107
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_power_sample_sub_view_test.html42
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_sample_sub_view.html89
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_sample_sub_view_test.html60
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_slice_sub_view.html51
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_slice_sub_view_test.html78
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_time_slice_sub_view.html174
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_time_slice_sub_view_test.html92
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/single_user_expectation_sub_view.html81
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/stack_frame.html78
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/stack_frame_test.html34
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane.html89
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane_test.html67
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane_view.html189
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane_view_test.html203
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/stub_analysis_table.html48
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/user_expectation_related_samples_table.html85
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/analysis/user_expectation_related_samples_table_test.html64
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/annotations/annotation_view.html31
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/annotations/annotation_view_test.html70
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/annotations/comment_box_annotation_view.html88
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/annotations/rect_annotation_view.html57
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/annotations/x_marker_annotation_view.html42
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/animation.html79
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/animation_controller.html140
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/animation_controller_test.html166
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/bar_chart.html178
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/bar_chart_test.html230
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/camera.html349
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/camera_test.html60
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/chart_base.html277
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/chart_base_2d.html384
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/chart_base_2d_brushable_x.html84
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/checkbox.html107
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_picker.html111
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_picker_test.html139
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_test.html69
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/color_legend.html79
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/color_legend_test.html122
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/constants.html20
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/container_that_decorates_its_children.html107
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/container_that_decorates_its_children_test.html97
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/d3.html7
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/deep_utils.html84
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/deep_utils_test.html51
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/dom_helpers.html337
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/dom_helpers_test.html151
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/drag_handle.html184
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/drag_handle_test.html94
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/draw_helpers.html419
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/dropdown.html158
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/dropdown_test.html38
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/elided_cache.html113
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/event_presenter.html93
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/fast_rect_renderer.html134
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/favicons.html27
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/file.html35
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/grouping_table.html227
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/grouping_table_groupby_picker.html313
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/grouping_table_groupby_picker_test.html60
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/heading.html142
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/hot_key.html64
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/hotkey_controller.html298
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/hotkey_controller_test.html138
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/info_bar.html82
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/info_bar_group.html65
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/info_bar_group_test.html51
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/info_bar_test.html47
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/line_chart.css13
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/line_chart.html63
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/line_chart_test.html163
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/list_and_associated_view.css17
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/list_and_associated_view.html138
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/list_and_associated_view_test.html98
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/list_view.css30
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/list_view.html167
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/list_view_test.html67
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_icon.html112
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_icon_test.html41
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_selector.html574
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_selector_test.html44
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/mouse_modes.html93
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/mouse_tracker.html114
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/name_bar_chart.html95
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/name_bar_chart_test.html172
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/overlay.html340
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/overlay_test.html124
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/pie_chart.css16
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/pie_chart.html277
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/pie_chart_test.html207
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/polymer_utils.html64
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/polymer_utils_test.html73
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/quad_stack_view.html689
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/radio_picker.html122
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/radio_picker_test.html89
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/resize_sensor.html50
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/resize_sensor_test.html56
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/scatter_chart.html118
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/scatter_chart_test.html71
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/tab_view.html428
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/tab_view_test.html323
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/table.html1473
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/table_header_cell.html89
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/table_test.html1461
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/timing_tool.html322
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/timing_tool_test.html78
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/tool_button.css17
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/toolbar_button.html41
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/toolbar_button_test.html39
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/ui.html169
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/ui_state.html85
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/ui_state_test.html99
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/ui_test.html245
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/utils.html68
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/base/utils_test.html76
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/brushing_state.html218
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/brushing_state_controller.html305
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/brushing_state_controller_test.html204
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/brushing_state_test.html123
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/about_tracing.html24
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/common.css25
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/inspector_connection.html125
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/inspector_tracing_controller_client.html187
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/inspector_tracing_controller_client_test.html83
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/mock_tracing_controller_client.html86
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/profiling_view.html369
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/profiling_view_test.html84
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_controller.html181
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_controller_test.html65
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_selection_dialog.html672
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_selection_dialog_test.html386
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/tracing_controller_client.html36
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/xhr_based_tracing_controller_client.html113
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/cc.html14
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_debugger.html467
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_debugger_test.html130
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_list_item.html124
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_list_view.css9
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_list_view.html53
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/images/input-event.pngbin3344 -> 0 bytes
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/images/input-event.svg114
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_picker.css43
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_picker.html322
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view.css18
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view.html127
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view_test.html37
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_quad_stack_view.html1192
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_quad_stack_view_test.html49
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_view.css31
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_view.html149
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_view_test.html55
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_debugger.html495
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_debugger_test.html32
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_summary_view.css18
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_summary_view.html472
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_view.css18
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_view.html500
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_list_view.css62
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_list_view.html238
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_list_view_test.html57
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_view.css9
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_view.html53
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_selection.html131
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_selection_test.html39
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_view.html216
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_view_test.html70
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/selection.html302
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/tile_view.html57
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/gpu.html10
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/images/checkerboard.pngbin245 -> 0 bytes
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/state_view.css15
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/state_view.html48
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/chrome_config.html24
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/deep_reports/html_results.html117
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/deep_reports/main.html65
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/deep_reports/scalar_value.html42
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/drive/comment_element.html71
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/drive/comments_side_panel.html180
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/drive/comments_side_panel_test.html71
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/drive/drive_comment_provider.html101
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/drive/index.html462
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/full_config.html12
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/highlighter/vsync_highlighter.html122
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/highlighter/vsync_highlighter_test.html151
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/lean_config.html16
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/alerts_side_panel.html161
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/alerts_side_panel_test.html61
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/frame_data_side_panel.html243
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/frame_data_side_panel_test.html165
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/input_latency_side_panel.html326
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/input_latency_side_panel_test.html143
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/time_summary_side_panel.html438
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/time_summary_side_panel_test.html206
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats.html12
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_instance_track.css15
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_instance_track.html355
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_instance_track_test.html67
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_snapshot_view.css28
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_snapshot_view.html84
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/extras/systrace_config.html12
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/find_control.html173
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/find_control_test.html66
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/find_controller.html154
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/find_controller_test.html307
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/images/chrome-left.pngbin14088 -> 0 bytes
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/images/chrome-mid.pngbin382 -> 0 bytes
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/images/chrome-right.pngbin3264 -> 0 bytes
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/images/ui-states.pngbin4097 -> 0 bytes
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/metrics_debugger_app.html131
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/scripting_control.html188
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/scripting_control_test.html22
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/side_panel/file_size_stats_side_panel.html212
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/side_panel/file_size_stats_side_panel_test.html36
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/side_panel/metrics_side_panel.html208
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/side_panel/side_panel.html53
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/side_panel/side_panel_container.html252
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/side_panel/side_panel_container_test.html58
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform.html118
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform_animations.html174
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform_animations_test.html85
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform_test.html40
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/timeline_interest_range.html248
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/timeline_track_view.html1150
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/timeline_track_view_test.html200
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/timeline_view.html530
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/timeline_view_help_overlay.html243
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/timeline_view_help_overlay_test.html17
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/timeline_view_metadata_overlay.html42
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/timeline_view_metadata_overlay_test.html31
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/timeline_view_test.html161
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/timeline_viewport.html428
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/timeline_viewport_test.html150
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/alert_track.html51
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/alert_track_test.html76
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/async_slice_group_track.html136
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/async_slice_group_track_test.html252
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_axis.html127
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_axis_test.html312
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_point.html43
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_point_test.html37
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_series.html494
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_series_test.html294
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_track.html241
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_track_test.html236
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_transform.html84
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_transform_test.html86
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/container_to_track_map.html45
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/container_track.html132
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/counter_track.html80
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/counter_track_perf_test.html129
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/counter_track_test.html201
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_track.html139
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_track_test.html99
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_usage_track.html187
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_usage_track_test.html240
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/device_track.html90
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/device_track_test.html146
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/drawing_container.css20
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/drawing_container.html176
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/drawing_container_perf_test.html136
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/event_to_track_map.html34
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/frame_track.html72
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/frame_track_test.html106
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/global_memory_dump_track.html102
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/global_memory_dump_track_test.html61
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/highlighter.html53
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/interaction_track.html68
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/interaction_track_test.html51
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/kernel_track.html83
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/letter_dot_track.html260
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/letter_dot_track_test.html121
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/memory_dump_track_test_utils.html143
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/memory_dump_track_util.html262
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/memory_dump_track_util_test.html228
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/model_track.html432
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/multi_row_track.html218
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_group_track.html87
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_track.css8
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_track.html299
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_track_test.html111
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/power_series_track.html83
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/power_series_track_test.html122
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/process_memory_dump_track.html73
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/process_memory_dump_track_test.html55
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/process_summary_track.html130
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/process_summary_track_test.html110
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/process_track.html155
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/process_track_base.css24
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/process_track_base.html273
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/rect_track.css8
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/rect_track.html251
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/rect_track_test.html407
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/ruler_track.css12
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/ruler_track.html374
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/ruler_track_test.html36
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/sample_track.html44
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/sample_track_test.html33
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_group_track.html168
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_group_track_test.html293
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_track.html44
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_track_test.html29
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/spacing_track.css7
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/spacing_track.html45
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/stacked_bars_track.html130
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/thread_track.css10
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/thread_track.html163
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/thread_track_test.html145
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/track.css33
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/tracks/track.html167
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/view_specific_brushing_state.html89
-rw-r--r--chromium/third_party/catapult/tracing/tracing/ui/view_specific_brushing_state_test.html67
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/__init__.py192
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/diagnostics/composition.html33
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/diagnostics/diagnostic.html60
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/diagnostics/diagnostic_map.html98
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/diagnostics/generic.html46
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/diagnostics/iteration_info.html102
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_event_set.html122
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_event_set_test.html52
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_value_map.html110
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_value_set.html96
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/generic_table.html29
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/numeric.html667
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/numeric_test.html420
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/time_display_mode.html54
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span.html75
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span_test.html28
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table.html90
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table_test.html30
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_span.html69
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span.html41
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span_test.html22
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view.html299
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view_test.html199
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span.html192
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span_test.html64
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/iteration_info_span.html73
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit.html40
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit_test.html22
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span.html37
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span_test.html57
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span.html38
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span_test.html35
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span.html38
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span_test.html35
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span.html263
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span_test.html236
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table.html315
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table_test.html87
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/ui/value_set_view.html87
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/unit.html333
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/unit_scale.html56
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/unit_test.html224
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/value.html232
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/value_set.html169
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/value_set_test.html180
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/value_test.html92
-rw-r--r--chromium/third_party/catapult/tracing/tracing/value/value_unittest.py52
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/__init__.py7
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/check_common.py90
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/check_common_unittest.py29
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/check_gypi.py30
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/generate_about_tracing_contents.py66
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/generate_about_tracing_contents_unittest.py20
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/html2trace.py96
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/merge_traces.py632
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/run_profile.py62
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/run_vinn_tests.py47
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/trace2html.py117
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/trace2html_unittest.py36
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/tracing_dev_server_config.py57
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/update_gypi.py123
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/update_gypi_unittest.py37
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/vulcanize_trace_viewer.py84
-rw-r--r--chromium/third_party/catapult/tracing/tracing_build/vulcanize_trace_viewer_unittest.py26
-rw-r--r--chromium/third_party/catapult/tracing/tracing_project.py180
1391 files changed, 0 insertions, 295491 deletions
diff --git a/chromium/components/mus/DEPS b/chromium/components/mus/DEPS
deleted file mode 100644
index f3a2b3a7d97..00000000000
--- a/chromium/components/mus/DEPS
+++ /dev/null
@@ -1,12 +0,0 @@
-include_rules = [
- "+cc",
- "+ipc",
- "+mojo/common",
- "+mojo/converters",
- "+mojo/public",
- "+services/catalog/public",
- "+services/shell",
- "+services/tracing/public",
- "+third_party/skia/include",
- "+ui",
-]
diff --git a/chromium/components/mus/OWNERS b/chromium/components/mus/OWNERS
deleted file mode 100644
index e6a7642f300..00000000000
--- a/chromium/components/mus/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-ben@chromium.org
-erg@chromium.org
-msw@chromium.org
-sky@chromium.org
diff --git a/chromium/components/mus/clipboard/clipboard_impl.cc b/chromium/components/mus/clipboard/clipboard_impl.cc
deleted file mode 100644
index a82d95e8f03..00000000000
--- a/chromium/components/mus/clipboard/clipboard_impl.cc
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/clipboard/clipboard_impl.h"
-
-#include <string.h>
-#include <utility>
-
-#include "base/macros.h"
-#include "mojo/common/common_type_converters.h"
-#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/public/cpp/bindings/string.h"
-
-using mojo::Array;
-using mojo::Map;
-using mojo::String;
-
-namespace mus {
-namespace clipboard {
-
-// ClipboardData contains data copied to the Clipboard for a variety of formats.
-// It mostly just provides APIs to cleanly access and manipulate this data.
-class ClipboardImpl::ClipboardData {
- public:
- ClipboardData() : sequence_number_(0) {}
- ~ClipboardData() {}
-
- uint64_t sequence_number() const {
- return sequence_number_;
- }
-
- Array<String> GetMimeTypes() const {
- Array<String> types(data_types_.size());
- int i = 0;
- for (auto it = data_types_.begin(); it != data_types_.end(); ++it, ++i)
- types[i] = it->first;
-
- return types;
- }
-
- void SetData(Map<String, Array<uint8_t>> data) {
- sequence_number_++;
- data_types_ = std::move(data);
- }
-
- void GetData(const String& mime_type, Array<uint8_t>* data) const {
- auto it = data_types_.find(mime_type);
- if (it != data_types_.end())
- *data = it->second.Clone();
- }
-
- private:
- uint64_t sequence_number_;
- Map<String, Array<uint8_t>> data_types_;
-
- DISALLOW_COPY_AND_ASSIGN(ClipboardData);
-};
-
-ClipboardImpl::ClipboardImpl() {
- for (int i = 0; i < kNumClipboards; ++i)
- clipboard_state_[i].reset(new ClipboardData);
-}
-
-ClipboardImpl::~ClipboardImpl() {
-}
-
-void ClipboardImpl::AddBinding(mojom::ClipboardRequest request) {
- bindings_.AddBinding(this, std::move(request));
-}
-
-void ClipboardImpl::GetSequenceNumber(
- Clipboard::Type clipboard_type,
- const GetSequenceNumberCallback& callback) {
- callback.Run(
- clipboard_state_[static_cast<int>(clipboard_type)]->sequence_number());
-}
-
-void ClipboardImpl::GetAvailableMimeTypes(
- Clipboard::Type clipboard_type,
- const GetAvailableMimeTypesCallback& callback) {
- int clipboard_num = static_cast<int>(clipboard_type);
- callback.Run(clipboard_state_[clipboard_num]->sequence_number(),
- clipboard_state_[clipboard_num]->GetMimeTypes());
-}
-
-void ClipboardImpl::ReadClipboardData(
- Clipboard::Type clipboard_type,
- const String& mime_type,
- const ReadClipboardDataCallback& callback) {
- int clipboard_num = static_cast<int>(clipboard_type);
- Array<uint8_t> mime_data(nullptr);
- uint64_t sequence = clipboard_state_[clipboard_num]->sequence_number();
- clipboard_state_[clipboard_num]->GetData(mime_type, &mime_data);
- callback.Run(sequence, std::move(mime_data));
-}
-
-void ClipboardImpl::WriteClipboardData(
- Clipboard::Type clipboard_type,
- Map<String, Array<uint8_t>> data,
- const WriteClipboardDataCallback& callback) {
- int clipboard_num = static_cast<int>(clipboard_type);
- clipboard_state_[clipboard_num]->SetData(std::move(data));
- callback.Run(clipboard_state_[clipboard_num]->sequence_number());
-}
-
-} // namespace clipboard
-} // namespace mus
diff --git a/chromium/components/mus/clipboard/clipboard_impl.h b/chromium/components/mus/clipboard/clipboard_impl.h
deleted file mode 100644
index 7f62f1c1df5..00000000000
--- a/chromium/components/mus/clipboard/clipboard_impl.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_CLIPBOARD_CLIPBOARD_IMPL_H_
-#define COMPONENTS_MUS_CLIPBOARD_CLIPBOARD_IMPL_H_
-
-#include <stdint.h>
-
-#include <string>
-
-#include "base/macros.h"
-#include "components/mus/public/interfaces/clipboard.mojom.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
-
-namespace mus {
-namespace clipboard {
-
-// Stub clipboard implementation.
-//
-// Eventually, we'll actually want to interact with the system clipboard, but
-// that's hard today because the system clipboard is asynchronous (on X11), the
-// ui::Clipboard interface is synchronous (which is what we'd use), mojo is
-// asynchronous across processes, and the WebClipboard interface is synchronous
-// (which is at least tractable).
-class ClipboardImpl : public mojom::Clipboard {
- public:
- // mojom::Clipboard exposes three possible clipboards.
- static const int kNumClipboards = 3;
-
- ClipboardImpl();
- ~ClipboardImpl() override;
-
- void AddBinding(mojom::ClipboardRequest request);
-
- // mojom::Clipboard implementation.
- void GetSequenceNumber(
- mojom::Clipboard::Type clipboard_type,
- const GetSequenceNumberCallback& callback) override;
- void GetAvailableMimeTypes(
- mojom::Clipboard::Type clipboard_types,
- const GetAvailableMimeTypesCallback& callback) override;
- void ReadClipboardData(mojom::Clipboard::Type clipboard_type,
- const mojo::String& mime_type,
- const ReadClipboardDataCallback& callback) override;
- void WriteClipboardData(
- mojom::Clipboard::Type clipboard_type,
- mojo::Map<mojo::String, mojo::Array<uint8_t>> data,
- const WriteClipboardDataCallback& callback) override;
-
- private:
- // Internal struct which stores the current state of the clipboard.
- class ClipboardData;
-
- // The current clipboard state. This is what is read from.
- std::unique_ptr<ClipboardData> clipboard_state_[kNumClipboards];
- mojo::BindingSet<mojom::Clipboard> bindings_;
-
- DISALLOW_COPY_AND_ASSIGN(ClipboardImpl);
-};
-
-} // namespace clipboard
-} // namespace mus
-
-#endif // COMPONENTS_MUS_CLIPBOARD_CLIPBOARD_IMPL_H_
diff --git a/chromium/components/mus/clipboard/clipboard_unittest.cc b/chromium/components/mus/clipboard/clipboard_unittest.cc
deleted file mode 100644
index 764618395c7..00000000000
--- a/chromium/components/mus/clipboard/clipboard_unittest.cc
+++ /dev/null
@@ -1,145 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <stdint.h>
-#include <utility>
-
-#include "base/bind.h"
-#include "base/macros.h"
-#include "base/run_loop.h"
-#include "components/mus/public/interfaces/clipboard.mojom.h"
-#include "mojo/common/common_type_converters.h"
-#include "services/shell/public/cpp/shell_connection.h"
-#include "services/shell/public/cpp/shell_test.h"
-
-using mojo::Array;
-using mojo::Map;
-using mojo::String;
-using mus::mojom::Clipboard;
-
-namespace mus {
-namespace clipboard {
-namespace {
-
-const char* kUninitialized = "Uninitialized data";
-const char* kPlainTextData = "Some plain data";
-const char* kHtmlData = "<html>data</html>";
-
-} // namespace
-
-class ClipboardAppTest : public shell::test::ShellTest {
- public:
- ClipboardAppTest() : ShellTest("exe:mus_clipboard_unittests") {}
- ~ClipboardAppTest() override {}
-
- // Overridden from shell::test::ShellTest:
- void SetUp() override {
- ShellTest::SetUp();
-
- connector()->ConnectToInterface("mojo:mus", &clipboard_);
- ASSERT_TRUE(clipboard_);
- }
-
- uint64_t GetSequenceNumber() {
- uint64_t sequence_num = 999999;
- EXPECT_TRUE(clipboard_->GetSequenceNumber(
- Clipboard::Type::COPY_PASTE, &sequence_num));
- return sequence_num;
- }
-
- std::vector<std::string> GetAvailableFormatMimeTypes() {
- uint64_t sequence_num = 999999;
- Array<String> types;
- types.push_back(kUninitialized);
- clipboard_->GetAvailableMimeTypes(
- Clipboard::Type::COPY_PASTE,
- &sequence_num, &types);
- return types.To<std::vector<std::string>>();
- }
-
- bool GetDataOfType(const std::string& mime_type, std::string* data) {
- bool valid = false;
- Array<uint8_t> raw_data;
- uint64_t sequence_number = 0;
- clipboard_->ReadClipboardData(Clipboard::Type::COPY_PASTE, mime_type,
- &sequence_number, &raw_data);
- valid = !raw_data.is_null();
- *data = raw_data.is_null() ? "" : raw_data.To<std::string>();
- return valid;
- }
-
- void SetStringText(const std::string& data) {
- uint64_t sequence_number;
- Map<String, Array<uint8_t>> mime_data;
- mime_data[mojom::kMimeTypeText] = Array<uint8_t>::From(data);
- clipboard_->WriteClipboardData(Clipboard::Type::COPY_PASTE,
- std::move(mime_data),
- &sequence_number);
- }
-
- protected:
- mojom::ClipboardPtr clipboard_;
-
- DISALLOW_COPY_AND_ASSIGN(ClipboardAppTest);
-};
-
-TEST_F(ClipboardAppTest, EmptyClipboardOK) {
- EXPECT_EQ(0ul, GetSequenceNumber());
- EXPECT_TRUE(GetAvailableFormatMimeTypes().empty());
- std::string data;
- EXPECT_FALSE(GetDataOfType(mojom::kMimeTypeText, &data));
-}
-
-TEST_F(ClipboardAppTest, CanReadBackText) {
- std::string data;
- EXPECT_EQ(0ul, GetSequenceNumber());
- EXPECT_FALSE(GetDataOfType(mojom::kMimeTypeText, &data));
-
- SetStringText(kPlainTextData);
- EXPECT_EQ(1ul, GetSequenceNumber());
-
- EXPECT_TRUE(GetDataOfType(mojom::kMimeTypeText, &data));
- EXPECT_EQ(kPlainTextData, data);
-}
-
-TEST_F(ClipboardAppTest, CanSetMultipleDataTypesAtOnce) {
- Map<String, Array<uint8_t>> mime_data;
- mime_data[mojom::kMimeTypeText] =
- Array<uint8_t>::From(std::string(kPlainTextData));
- mime_data[mojom::kMimeTypeHTML] =
- Array<uint8_t>::From(std::string(kHtmlData));
-
- uint64_t sequence_num = 0;
- clipboard_->WriteClipboardData(Clipboard::Type::COPY_PASTE,
- std::move(mime_data),
- &sequence_num);
- EXPECT_EQ(1ul, sequence_num);
-
- std::string data;
- EXPECT_TRUE(GetDataOfType(mojom::kMimeTypeText, &data));
- EXPECT_EQ(kPlainTextData, data);
- EXPECT_TRUE(GetDataOfType(mojom::kMimeTypeHTML, &data));
- EXPECT_EQ(kHtmlData, data);
-}
-
-TEST_F(ClipboardAppTest, CanClearClipboardWithZeroArray) {
- std::string data;
- SetStringText(kPlainTextData);
- EXPECT_EQ(1ul, GetSequenceNumber());
-
- EXPECT_TRUE(GetDataOfType(mojom::kMimeTypeText, &data));
- EXPECT_EQ(kPlainTextData, data);
-
- Map<String, Array<uint8_t>> mime_data;
- uint64_t sequence_num = 0;
- clipboard_->WriteClipboardData(Clipboard::Type::COPY_PASTE,
- std::move(mime_data),
- &sequence_num);
-
- EXPECT_EQ(2ul, sequence_num);
- EXPECT_FALSE(GetDataOfType(mojom::kMimeTypeText, &data));
-}
-
-} // namespace clipboard
-} // namespace mus
diff --git a/chromium/components/mus/clipboard/test_manifest.json b/chromium/components/mus/clipboard/test_manifest.json
deleted file mode 100644
index 26e694cea02..00000000000
--- a/chromium/components/mus/clipboard/test_manifest.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "manifest_version": 1,
- "name": "exe:mus_clipboard_unittests",
- "display_name": "Clipboard Service Unittests",
- "capabilities": {
- "required": {
- "mojo:mus": { "interfaces": [ "mus::mojom::Clipboard" ] }
- }
- }
-}
diff --git a/chromium/components/mus/common/DEPS b/chromium/components/mus/common/DEPS
deleted file mode 100644
index f77ec566793..00000000000
--- a/chromium/components/mus/common/DEPS
+++ /dev/null
@@ -1,12 +0,0 @@
-include_rules = [
- "+gpu/config",
- "+gpu/command_buffer",
- "+gpu/ipc/client",
- "+gpu/ipc/common",
-]
-
-specific_include_rules = {
- "run_all_shelltests\.cc": [
- "+mojo/edk/embedder/embedder.h",
- ],
-}
diff --git a/chromium/components/mus/common/event_matcher_util.cc b/chromium/components/mus/common/event_matcher_util.cc
deleted file mode 100644
index a82a12d3002..00000000000
--- a/chromium/components/mus/common/event_matcher_util.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/common/event_matcher_util.h"
-
-namespace mus {
-
-mojom::EventMatcherPtr CreateKeyMatcher(ui::mojom::KeyboardCode code,
- int flags) {
- mojom::EventMatcherPtr matcher(mojom::EventMatcher::New());
- matcher->type_matcher = mojom::EventTypeMatcher::New();
- matcher->flags_matcher = mojom::EventFlagsMatcher::New();
- matcher->ignore_flags_matcher = mojom::EventFlagsMatcher::New();
- // Ignoring these makes most accelerator scenarios more straight forward. Code
- // that needs to check them can override this setting.
- matcher->ignore_flags_matcher->flags = ui::mojom::kEventFlagCapsLockOn |
- ui::mojom::kEventFlagScrollLockOn |
- ui::mojom::kEventFlagNumLockOn;
- matcher->key_matcher = mojom::KeyEventMatcher::New();
-
- matcher->type_matcher->type = ui::mojom::EventType::KEY_PRESSED;
- matcher->flags_matcher->flags = flags;
- matcher->key_matcher->keyboard_code = code;
- return matcher;
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/common/event_matcher_util.h b/chromium/components/mus/common/event_matcher_util.h
deleted file mode 100644
index 2b99729ea2a..00000000000
--- a/chromium/components/mus/common/event_matcher_util.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_COMMON_EVENT_MATCHER_UTIL_H_
-#define COMPONENTS_MUS_COMMON_EVENT_MATCHER_UTIL_H_
-
-#include "components/mus/common/mus_common_export.h"
-#include "components/mus/public/interfaces/event_matcher.mojom.h"
-#include "ui/events/mojo/event_constants.mojom.h"
-#include "ui/events/mojo/keyboard_codes.mojom.h"
-
-namespace mus {
-
-// |flags| is a bitfield of kEventFlag* and kMouseEventFlag* values in
-// input_event_constants.mojom.
-mojom::EventMatcherPtr MUS_COMMON_EXPORT
-CreateKeyMatcher(ui::mojom::KeyboardCode code, int flags);
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_COMMON_EVENT_MATCHER_UTIL_H_
diff --git a/chromium/components/mus/common/generic_shared_memory_id_generator.cc b/chromium/components/mus/common/generic_shared_memory_id_generator.cc
deleted file mode 100644
index 622a53940b2..00000000000
--- a/chromium/components/mus/common/generic_shared_memory_id_generator.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/common/generic_shared_memory_id_generator.h"
-
-#include "base/atomic_sequence_num.h"
-
-namespace mus {
-namespace {
-
-// Global atomic to generate gpu memory buffer unique IDs.
-base::StaticAtomicSequenceNumber g_next_generic_shared_memory_id;
-
-} // namespace
-
-gfx::GenericSharedMemoryId GetNextGenericSharedMemoryId() {
- return gfx::GenericSharedMemoryId(g_next_generic_shared_memory_id.GetNext());
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/common/generic_shared_memory_id_generator.h b/chromium/components/mus/common/generic_shared_memory_id_generator.h
deleted file mode 100644
index c462e093d3a..00000000000
--- a/chromium/components/mus/common/generic_shared_memory_id_generator.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_COMMON_GENERIC_SHARED_MEMORY_ID_GENERATOR_H_
-#define COMPONENTS_MUS_COMMON_GENERIC_SHARED_MEMORY_ID_GENERATOR_H_
-
-#include "components/mus/common/mus_common_export.h"
-#include "ui/gfx/generic_shared_memory_id.h"
-
-namespace mus {
-
-// Returns the next GenericSharedMemoryId for the current process. This should
-// be used anywhere a new GenericSharedMemoryId is needed.
-MUS_COMMON_EXPORT gfx::GenericSharedMemoryId GetNextGenericSharedMemoryId();
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_COMMON_GENERIC_SHARED_MEMORY_ID_GENERATOR_H_
diff --git a/chromium/components/mus/common/gpu_memory_buffer_impl.cc b/chromium/components/mus/common/gpu_memory_buffer_impl.cc
deleted file mode 100644
index 415f6548f14..00000000000
--- a/chromium/components/mus/common/gpu_memory_buffer_impl.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/common/gpu_memory_buffer_impl.h"
-
-namespace mus {
-
-GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- gfx::BufferFormat format)
- : id_(id), size_(size), format_(format), mapped_(false) {}
-
-GpuMemoryBufferImpl::~GpuMemoryBufferImpl() {
- DCHECK(!mapped_);
-}
-
-// static
-GpuMemoryBufferImpl* GpuMemoryBufferImpl::FromClientBuffer(
- ClientBuffer buffer) {
- return reinterpret_cast<GpuMemoryBufferImpl*>(buffer);
-}
-
-gfx::Size GpuMemoryBufferImpl::GetSize() const {
- return size_;
-}
-
-gfx::BufferFormat GpuMemoryBufferImpl::GetFormat() const {
- return format_;
-}
-
-gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const {
- return id_;
-}
-
-ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() {
- return reinterpret_cast<ClientBuffer>(this);
-}
-
-#if defined(USE_OZONE)
-scoped_refptr<ui::NativePixmap> GpuMemoryBufferImpl::GetNativePixmap() {
- return scoped_refptr<ui::NativePixmap>();
-}
-#endif
-
-} // namespace mus
diff --git a/chromium/components/mus/common/gpu_memory_buffer_impl.h b/chromium/components/mus/common/gpu_memory_buffer_impl.h
deleted file mode 100644
index 84f1f9d90ad..00000000000
--- a/chromium/components/mus/common/gpu_memory_buffer_impl.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_COMMON_GPU_MEMORY_BUFFER_IMPL_H_
-#define COMPONENTS_MUS_COMMON_GPU_MEMORY_BUFFER_IMPL_H_
-
-#include <memory>
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "components/mus/common/mus_common_export.h"
-#include "gpu/command_buffer/common/sync_token.h"
-#include "ui/gfx/geometry/size.h"
-#include "ui/gfx/gpu_memory_buffer.h"
-
-#if defined(USE_OZONE)
-#include "ui/ozone/public/native_pixmap.h"
-#endif
-
-namespace mus {
-
-// Provides common implementation of a GPU memory buffer.
-class MUS_COMMON_EXPORT GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer {
- public:
- ~GpuMemoryBufferImpl() override;
-
- // Type-checking upcast routine. Returns an NULL on failure.
- static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer);
-
- // Overridden from gfx::GpuMemoryBuffer:
- gfx::Size GetSize() const override;
- gfx::BufferFormat GetFormat() const override;
- gfx::GpuMemoryBufferId GetId() const override;
- ClientBuffer AsClientBuffer() override;
-
- // Returns the type of this GpuMemoryBufferImpl.
- virtual gfx::GpuMemoryBufferType GetBufferType() const = 0;
-
-#if defined(USE_OZONE)
- // Returns a ui::NativePixmap when one is available.
- virtual scoped_refptr<ui::NativePixmap> GetNativePixmap();
-#endif
-
- protected:
- GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- gfx::BufferFormat format);
-
- const gfx::GpuMemoryBufferId id_;
- const gfx::Size size_;
- const gfx::BufferFormat format_;
- bool mapped_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_COMMON_GPU_MEMORY_BUFFER_IMPL_H_
diff --git a/chromium/components/mus/common/gpu_service.cc b/chromium/components/mus/common/gpu_service.cc
deleted file mode 100644
index 4eea3e45972..00000000000
--- a/chromium/components/mus/common/gpu_service.cc
+++ /dev/null
@@ -1,256 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/common/gpu_service.h"
-
-#include "base/command_line.h"
-#include "base/memory/singleton.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "build/build_config.h"
-#include "components/mus/common/gpu_type_converters.h"
-#include "components/mus/common/switches.h"
-#include "components/mus/public/interfaces/gpu_service.mojom.h"
-#include "mojo/public/cpp/bindings/sync_call_restrictions.h"
-#include "mojo/public/cpp/system/platform_handle.h"
-#include "services/shell/public/cpp/connector.h"
-
-namespace mus {
-
-namespace {
-
-void PostTask(scoped_refptr<base::SingleThreadTaskRunner> runner,
- const tracked_objects::Location& from_here,
- const base::Closure& callback) {
- runner->PostTask(from_here, callback);
-}
-
-GpuService* g_gpu_service = nullptr;
-}
-
-GpuService::GpuService(shell::Connector* connector)
- : main_task_runner_(base::ThreadTaskRunnerHandle::Get()),
- connector_(connector),
- shutdown_event_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
- base::WaitableEvent::InitialState::NOT_SIGNALED),
- io_thread_("GPUIOThread"),
- gpu_memory_buffer_manager_(new MojoGpuMemoryBufferManager),
- is_establishing_(false),
- establishing_condition_(&lock_) {
- DCHECK(main_task_runner_);
- DCHECK(connector_);
- base::Thread::Options thread_options(base::MessageLoop::TYPE_IO, 0);
- thread_options.priority = base::ThreadPriority::NORMAL;
- CHECK(io_thread_.StartWithOptions(thread_options));
-}
-
-GpuService::~GpuService() {
- DCHECK(IsMainThread());
- if (gpu_channel_)
- gpu_channel_->DestroyChannel();
-}
-
-// static
-bool GpuService::UseChromeGpuCommandBuffer() {
-// TODO(penghuang): Kludge: Running with Chrome GPU command buffer by default
-// breaks unit tests on Windows
-#if defined(OS_WIN)
- return false;
-#else
- return !base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kUseMojoGpuCommandBufferInMus);
-#endif
-}
-
-// static
-void GpuService::Initialize(shell::Connector* connector) {
- DCHECK(!g_gpu_service);
- g_gpu_service = new GpuService(connector);
-}
-
-// static
-void GpuService::Terminate() {
- DCHECK(g_gpu_service);
- delete g_gpu_service;
- g_gpu_service = nullptr;
-}
-
-// static
-GpuService* GpuService::GetInstance() {
- DCHECK(g_gpu_service);
- return g_gpu_service;
-}
-
-void GpuService::EstablishGpuChannel(const base::Closure& callback) {
- base::AutoLock auto_lock(lock_);
- auto runner = base::ThreadTaskRunnerHandle::Get();
- if (GetGpuChannelLocked()) {
- runner->PostTask(FROM_HERE, callback);
- return;
- }
-
- base::Closure wrapper_callback =
- IsMainThread() ? callback
- : base::Bind(PostTask, runner, FROM_HERE, callback);
- establish_callbacks_.push_back(wrapper_callback);
-
- if (!is_establishing_) {
- is_establishing_ = true;
- main_task_runner_->PostTask(
- FROM_HERE, base::Bind(&GpuService::EstablishGpuChannelOnMainThread,
- base::Unretained(this)));
- }
-}
-
-scoped_refptr<gpu::GpuChannelHost> GpuService::EstablishGpuChannelSync() {
- base::AutoLock auto_lock(lock_);
- if (GetGpuChannelLocked())
- return gpu_channel_;
-
- if (IsMainThread()) {
- is_establishing_ = true;
- EstablishGpuChannelOnMainThreadSyncLocked();
- } else {
- if (!is_establishing_) {
- // Create an establishing gpu channel task, if there isn't one.
- is_establishing_ = true;
- main_task_runner_->PostTask(
- FROM_HERE, base::Bind(&GpuService::EstablishGpuChannelOnMainThread,
- base::Unretained(this)));
- }
-
- // Wait until the pending establishing task is finished.
- do {
- establishing_condition_.Wait();
- } while (is_establishing_);
- }
- return gpu_channel_;
-}
-
-scoped_refptr<gpu::GpuChannelHost> GpuService::GetGpuChannel() {
- base::AutoLock auto_lock(lock_);
- return GetGpuChannelLocked();
-}
-
-scoped_refptr<gpu::GpuChannelHost> GpuService::GetGpuChannelLocked() {
- if (gpu_channel_ && gpu_channel_->IsLost()) {
- main_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&gpu::GpuChannelHost::DestroyChannel, gpu_channel_));
- gpu_channel_ = nullptr;
- }
- return gpu_channel_;
-}
-
-void GpuService::EstablishGpuChannelOnMainThread() {
- base::AutoLock auto_lock(lock_);
- DCHECK(IsMainThread());
-
- // In GpuService::EstablishGpuChannelOnMainThreadSyncLocked(), we use the sync
- // mojo EstablishGpuChannel call, after that call the gpu_service_ will be
- // reset immediatelly. So gpu_service_ should be always null here.
- DCHECK(!gpu_service_);
-
- // is_establishing_ is false, it means GpuService::EstablishGpuChannelSync()
- // has been used, and we don't need try to establish a new GPU channel
- // anymore.
- if (!is_establishing_)
- return;
-
- connector_->ConnectToInterface("mojo:mus", &gpu_service_);
- const bool locked = false;
- gpu_service_->EstablishGpuChannel(
- base::Bind(&GpuService::EstablishGpuChannelOnMainThreadDone,
- base::Unretained(this), locked));
-}
-
-void GpuService::EstablishGpuChannelOnMainThreadSyncLocked() {
- DCHECK(IsMainThread());
- DCHECK(is_establishing_);
-
- // In browser process, EstablishGpuChannelSync() is only used by testing &
- // GpuProcessTransportFactory::GetGLHelper(). For GetGLHelper(), it expects
- // the gpu channel has been established, so it should not reach here.
- // For testing, the asyc method should not be used.
- // In renderer process, we only use EstablishGpuChannelSync().
- // So the gpu_service_ should be null here.
- DCHECK(!gpu_service_);
-
- int client_id = 0;
- mojom::ChannelHandlePtr channel_handle;
- mojom::GpuInfoPtr gpu_info;
- connector_->ConnectToInterface("mojo:mus", &gpu_service_);
- {
- base::AutoUnlock auto_unlock(lock_);
- mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_call;
- if (!gpu_service_->EstablishGpuChannel(&client_id, &channel_handle,
- &gpu_info)) {
- DLOG(WARNING)
- << "Channel encountered error while establishing gpu channel.";
- return;
- }
- }
- const bool locked = true;
- EstablishGpuChannelOnMainThreadDone(
- locked, client_id, std::move(channel_handle), std::move(gpu_info));
-}
-
-void GpuService::EstablishGpuChannelOnMainThreadDone(
- bool locked,
- int client_id,
- mojom::ChannelHandlePtr channel_handle,
- mojom::GpuInfoPtr gpu_info) {
- DCHECK(IsMainThread());
- scoped_refptr<gpu::GpuChannelHost> gpu_channel;
- if (client_id) {
- // TODO(penghuang): Get the real gpu info from mus.
- gpu_channel = gpu::GpuChannelHost::Create(
- this, client_id, gpu::GPUInfo(),
- channel_handle.To<IPC::ChannelHandle>(), &shutdown_event_,
- gpu_memory_buffer_manager_.get());
- }
-
- auto auto_lock = base::WrapUnique<base::AutoLock>(
- locked ? nullptr : new base::AutoLock(lock_));
- DCHECK(is_establishing_);
- DCHECK(!gpu_channel_);
-
- is_establishing_ = false;
- gpu_channel_ = gpu_channel;
- establishing_condition_.Broadcast();
-
- for (const auto& i : establish_callbacks_)
- i.Run();
- establish_callbacks_.clear();
- gpu_service_.reset();
-}
-
-bool GpuService::IsMainThread() {
- return main_task_runner_->BelongsToCurrentThread();
-}
-
-scoped_refptr<base::SingleThreadTaskRunner>
-GpuService::GetIOThreadTaskRunner() {
- return io_thread_.task_runner();
-}
-
-std::unique_ptr<base::SharedMemory> GpuService::AllocateSharedMemory(
- size_t size) {
- mojo::ScopedSharedBufferHandle handle =
- mojo::SharedBufferHandle::Create(size);
- if (!handle.is_valid())
- return nullptr;
-
- base::SharedMemoryHandle platform_handle;
- size_t shared_memory_size;
- bool readonly;
- MojoResult result = mojo::UnwrapSharedMemoryHandle(
- std::move(handle), &platform_handle, &shared_memory_size, &readonly);
- if (result != MOJO_RESULT_OK)
- return nullptr;
- DCHECK_EQ(shared_memory_size, size);
-
- return base::MakeUnique<base::SharedMemory>(platform_handle, readonly);
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/common/gpu_service.h b/chromium/components/mus/common/gpu_service.h
deleted file mode 100644
index a3d5cd106f6..00000000000
--- a/chromium/components/mus/common/gpu_service.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_COMMON_GPU_SERVICE_H_
-#define COMPONENTS_MUS_COMMON_GPU_SERVICE_H_
-
-#include <stdint.h>
-#include <vector>
-
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/single_thread_task_runner.h"
-#include "base/synchronization/lock.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/threading/thread.h"
-#include "components/mus/common/mojo_gpu_memory_buffer_manager.h"
-#include "components/mus/common/mus_common_export.h"
-#include "components/mus/public/interfaces/gpu_service.mojom.h"
-#include "gpu/ipc/client/gpu_channel_host.h"
-
-namespace shell {
-class Connector;
-}
-
-namespace mus {
-
-class MUS_COMMON_EXPORT GpuService : public gpu::GpuChannelHostFactory {
- public:
- void EstablishGpuChannel(const base::Closure& callback);
- scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannelSync();
- scoped_refptr<gpu::GpuChannelHost> GetGpuChannel();
- gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() const {
- return gpu_memory_buffer_manager_.get();
- }
-
- static bool UseChromeGpuCommandBuffer();
-
- // The GpuService has to be initialized in the main thread before establishing
- // the gpu channel.
- static void Initialize(shell::Connector* connector);
- // The GpuService has to be terminated in the main thread.
- static void Terminate();
- static GpuService* GetInstance();
-
- private:
- friend struct base::DefaultSingletonTraits<GpuService>;
-
- explicit GpuService(shell::Connector* connector);
- ~GpuService() override;
-
- scoped_refptr<gpu::GpuChannelHost> GetGpuChannelLocked();
- void EstablishGpuChannelOnMainThread();
- void EstablishGpuChannelOnMainThreadSyncLocked();
- void EstablishGpuChannelOnMainThreadDone(
- bool locked,
- int client_id,
- mojom::ChannelHandlePtr channel_handle,
- mojom::GpuInfoPtr gpu_info);
-
- // gpu::GpuChannelHostFactory overrides:
- bool IsMainThread() override;
- scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override;
- std::unique_ptr<base::SharedMemory> AllocateSharedMemory(
- size_t size) override;
-
- scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
- shell::Connector* connector_;
- base::WaitableEvent shutdown_event_;
- base::Thread io_thread_;
- std::unique_ptr<MojoGpuMemoryBufferManager> gpu_memory_buffer_manager_;
-
- // Lock for |gpu_channel_|, |establish_callbacks_| & |is_establishing_|.
- base::Lock lock_;
- bool is_establishing_;
- mus::mojom::GpuServicePtr gpu_service_;
- scoped_refptr<gpu::GpuChannelHost> gpu_channel_;
- std::vector<base::Closure> establish_callbacks_;
- base::ConditionVariable establishing_condition_;
-
- DISALLOW_COPY_AND_ASSIGN(GpuService);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_GPU_SERVICE_CONNECTION_H_
diff --git a/chromium/components/mus/common/gpu_type_converters.cc b/chromium/components/mus/common/gpu_type_converters.cc
deleted file mode 100644
index 7733c7d3bf7..00000000000
--- a/chromium/components/mus/common/gpu_type_converters.cc
+++ /dev/null
@@ -1,164 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/common/gpu_type_converters.h"
-
-#include "build/build_config.h"
-#include "gpu/config/gpu_info.h"
-#include "ipc/ipc_channel_handle.h"
-#include "mojo/public/cpp/system/platform_handle.h"
-#include "ui/gfx/gpu_memory_buffer.h"
-
-#if defined(USE_OZONE)
-#include "ui/gfx/native_pixmap_handle_ozone.h"
-#endif
-
-namespace mojo {
-
-// static
-mus::mojom::ChannelHandlePtr
-TypeConverter<mus::mojom::ChannelHandlePtr, IPC::ChannelHandle>::Convert(
- const IPC::ChannelHandle& handle) {
- mus::mojom::ChannelHandlePtr result = mus::mojom::ChannelHandle::New();
- result->name = handle.name;
-#if defined(OS_WIN)
- // On windows, a pipe handle Will NOT be marshalled over IPC.
- DCHECK(handle.pipe.handle == NULL);
-#else
- DCHECK(handle.socket.auto_close || handle.socket.fd == -1);
- base::PlatformFile platform_file = handle.socket.fd;
- if (platform_file != -1)
- result->socket = mojo::WrapPlatformFile(platform_file);
-#endif
- return result;
-}
-
-// static
-IPC::ChannelHandle
-TypeConverter<IPC::ChannelHandle, mus::mojom::ChannelHandlePtr>::Convert(
- const mus::mojom::ChannelHandlePtr& handle) {
- if (handle.is_null())
- return IPC::ChannelHandle();
-#if defined(OS_WIN)
- // On windows, a pipe handle Will NOT be marshalled over IPC.
- DCHECK(!handle->socket.is_valid());
- return IPC::ChannelHandle(handle->name);
-#else
- base::PlatformFile platform_file = -1;
- mojo::UnwrapPlatformFile(std::move(handle->socket), &platform_file);
- return IPC::ChannelHandle(handle->name,
- base::FileDescriptor(platform_file, true));
-#endif
-}
-
-#if defined(USE_OZONE)
-// static
-mus::mojom::NativePixmapHandlePtr TypeConverter<
- mus::mojom::NativePixmapHandlePtr,
- gfx::NativePixmapHandle>::Convert(const gfx::NativePixmapHandle& handle) {
- // TODO(penghuang); support NativePixmapHandle.
- mus::mojom::NativePixmapHandlePtr result =
- mus::mojom::NativePixmapHandle::New();
- return result;
-}
-
-// static
-gfx::NativePixmapHandle
-TypeConverter<gfx::NativePixmapHandle, mus::mojom::NativePixmapHandlePtr>::
- Convert(const mus::mojom::NativePixmapHandlePtr& handle) {
- // TODO(penghuang); support NativePixmapHandle.
- gfx::NativePixmapHandle result;
- return result;
-}
-#endif
-
-// static
-mus::mojom::GpuMemoryBufferIdPtr TypeConverter<
- mus::mojom::GpuMemoryBufferIdPtr,
- gfx::GpuMemoryBufferId>::Convert(const gfx::GpuMemoryBufferId& id) {
- mus::mojom::GpuMemoryBufferIdPtr result =
- mus::mojom::GpuMemoryBufferId::New();
- result->id = id.id;
- return result;
-}
-
-// static
-gfx::GpuMemoryBufferId
-TypeConverter<gfx::GpuMemoryBufferId, mus::mojom::GpuMemoryBufferIdPtr>::
- Convert(const mus::mojom::GpuMemoryBufferIdPtr& id) {
- return gfx::GpuMemoryBufferId(id->id);
-}
-
-// static
-mus::mojom::GpuMemoryBufferHandlePtr TypeConverter<
- mus::mojom::GpuMemoryBufferHandlePtr,
- gfx::GpuMemoryBufferHandle>::Convert(const gfx::GpuMemoryBufferHandle&
- handle) {
- DCHECK(handle.type == gfx::SHARED_MEMORY_BUFFER);
- mus::mojom::GpuMemoryBufferHandlePtr result =
- mus::mojom::GpuMemoryBufferHandle::New();
- result->type = static_cast<mus::mojom::GpuMemoryBufferType>(handle.type);
- result->id = mus::mojom::GpuMemoryBufferId::From(handle.id);
- base::PlatformFile platform_file;
-#if defined(OS_WIN)
- platform_file = handle.handle.GetHandle();
-#else
- DCHECK(handle.handle.auto_close || handle.handle.fd == -1);
- platform_file = handle.handle.fd;
-#endif
- result->buffer_handle = mojo::WrapPlatformFile(platform_file);
- result->offset = handle.offset;
- result->stride = handle.stride;
-#if defined(USE_OZONE)
- result->native_pixmap_handle =
- mus::mojom::NativePixmapHandle::From(handle.native_pixmap_handle);
-#endif
- return result;
-}
-
-// static
-gfx::GpuMemoryBufferHandle TypeConverter<gfx::GpuMemoryBufferHandle,
- mus::mojom::GpuMemoryBufferHandlePtr>::
- Convert(const mus::mojom::GpuMemoryBufferHandlePtr& handle) {
- DCHECK(handle->type == mus::mojom::GpuMemoryBufferType::SHARED_MEMORY);
- gfx::GpuMemoryBufferHandle result;
- result.type = static_cast<gfx::GpuMemoryBufferType>(handle->type);
- result.id = handle->id.To<gfx::GpuMemoryBufferId>();
- base::PlatformFile platform_file;
- MojoResult unwrap_result = mojo::UnwrapPlatformFile(
- std::move(handle->buffer_handle), &platform_file);
- if (unwrap_result == MOJO_RESULT_OK) {
-#if defined(OS_WIN)
- result.handle =
- base::SharedMemoryHandle(platform_file, base::GetCurrentProcId());
-#else
- result.handle = base::SharedMemoryHandle(platform_file, true);
-#endif
- }
- result.offset = handle->offset;
- result.stride = handle->stride;
-#if defined(USE_OZONE)
- result.native_pixmap_handle =
- handle->native_pixmap_handle.To<gfx::NativePixmapHandle>();
-#else
- DCHECK(handle->native_pixmap_handle.is_null());
-#endif
- return result;
-}
-
-// static
-mus::mojom::GpuInfoPtr
-TypeConverter<mus::mojom::GpuInfoPtr, gpu::GPUInfo>::Convert(
- const gpu::GPUInfo& input) {
- mus::mojom::GpuInfoPtr result(mus::mojom::GpuInfo::New());
- result->vendor_id = input.gpu.vendor_id;
- result->device_id = input.gpu.device_id;
- result->vendor_info = mojo::String::From<std::string>(input.gl_vendor);
- result->renderer_info = mojo::String::From<std::string>(input.gl_renderer);
- result->driver_version =
- mojo::String::From<std::string>(input.driver_version);
- return result;
-}
-
-} // namespace mojo
diff --git a/chromium/components/mus/common/gpu_type_converters.h b/chromium/components/mus/common/gpu_type_converters.h
deleted file mode 100644
index 74c170c0437..00000000000
--- a/chromium/components/mus/common/gpu_type_converters.h
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_COMMON_GPU_TYPE_CONVERTERS_H_
-#define COMPONENTS_MUS_COMMON_GPU_TYPE_CONVERTERS_H_
-
-#include "build/build_config.h"
-#include "components/mus/common/mus_common_export.h"
-#include "components/mus/public/interfaces/channel_handle.mojom.h"
-#include "components/mus/public/interfaces/gpu.mojom.h"
-#include "components/mus/public/interfaces/gpu_memory_buffer.mojom.h"
-#include "mojo/public/cpp/bindings/type_converter.h"
-
-namespace gfx {
-struct GpuMemoryBufferHandle;
-class GenericSharedMemoryId;
-using GpuMemoryBufferId = GenericSharedMemoryId;
-struct NativePixmapHandle;
-}
-
-namespace gpu {
-struct GPUInfo;
-}
-
-namespace IPC {
-struct ChannelHandle;
-}
-
-namespace mojo {
-
-template <>
-struct MUS_COMMON_EXPORT
- TypeConverter<mus::mojom::ChannelHandlePtr, IPC::ChannelHandle> {
- static mus::mojom::ChannelHandlePtr Convert(const IPC::ChannelHandle& handle);
-};
-
-template <>
-struct MUS_COMMON_EXPORT
- TypeConverter<IPC::ChannelHandle, mus::mojom::ChannelHandlePtr> {
- static IPC::ChannelHandle Convert(const mus::mojom::ChannelHandlePtr& handle);
-};
-
-#if defined(USE_OZONE)
-template <>
-struct MUS_COMMON_EXPORT
- TypeConverter<mus::mojom::NativePixmapHandlePtr, gfx::NativePixmapHandle> {
- static mus::mojom::NativePixmapHandlePtr Convert(
- const gfx::NativePixmapHandle& handle);
-};
-
-template <>
-struct MUS_COMMON_EXPORT
- TypeConverter<gfx::NativePixmapHandle, mus::mojom::NativePixmapHandlePtr> {
- static gfx::NativePixmapHandle Convert(
- const mus::mojom::NativePixmapHandlePtr& handle);
-};
-#endif
-
-template <>
-struct MUS_COMMON_EXPORT
- TypeConverter<mus::mojom::GpuMemoryBufferIdPtr, gfx::GpuMemoryBufferId> {
- static mus::mojom::GpuMemoryBufferIdPtr Convert(
- const gfx::GpuMemoryBufferId& id);
-};
-
-template <>
-struct MUS_COMMON_EXPORT
- TypeConverter<gfx::GpuMemoryBufferId, mus::mojom::GpuMemoryBufferIdPtr> {
- static gfx::GpuMemoryBufferId Convert(
- const mus::mojom::GpuMemoryBufferIdPtr& id);
-};
-
-template <>
-struct MUS_COMMON_EXPORT TypeConverter<mus::mojom::GpuMemoryBufferHandlePtr,
- gfx::GpuMemoryBufferHandle> {
- static mus::mojom::GpuMemoryBufferHandlePtr Convert(
- const gfx::GpuMemoryBufferHandle& handle);
-};
-
-template <>
-struct MUS_COMMON_EXPORT TypeConverter<gfx::GpuMemoryBufferHandle,
- mus::mojom::GpuMemoryBufferHandlePtr> {
- static gfx::GpuMemoryBufferHandle Convert(
- const mus::mojom::GpuMemoryBufferHandlePtr& handle);
-};
-
-template <>
-struct MUS_COMMON_EXPORT TypeConverter<mus::mojom::GpuInfoPtr, gpu::GPUInfo> {
- static mus::mojom::GpuInfoPtr Convert(const gpu::GPUInfo& input);
-};
-
-} // namespace mojo
-
-#endif // COMPONENTS_MUS_COMMON_GPU_TYPE_CONVERTERS_H_
diff --git a/chromium/components/mus/common/gpu_type_converters_unittest.cc b/chromium/components/mus/common/gpu_type_converters_unittest.cc
deleted file mode 100644
index 012664309d9..00000000000
--- a/chromium/components/mus/common/gpu_type_converters_unittest.cc
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <string>
-
-#include "base/files/scoped_file.h"
-#include "build/build_config.h"
-#include "components/mus/common/gpu_type_converters.h"
-#include "ipc/ipc_channel.h"
-#include "ipc/ipc_channel_handle.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/gfx/buffer_types.h"
-#include "ui/gfx/geometry/size.h"
-#include "ui/gfx/gpu_memory_buffer.h"
-
-// Test for mojo TypeConverter of mus::mojom::ChannelHandle.
-TEST(MusGpuTypeConvertersTest, ChannelHandle) {
- {
- const std::string channel_name = "test_channel_name";
- IPC::ChannelHandle handle(channel_name);
-
- mus::mojom::ChannelHandlePtr mojo_handle =
- mus::mojom::ChannelHandle::From(handle);
- ASSERT_EQ(mojo_handle->name, channel_name);
- EXPECT_FALSE(mojo_handle->socket.is_valid());
-
- handle = mojo_handle.To<IPC::ChannelHandle>();
- ASSERT_EQ(handle.name, channel_name);
-#if defined(OS_POSIX)
- ASSERT_EQ(handle.socket.fd, -1);
-#endif
- }
-
-#if defined(OS_POSIX)
- {
- const std::string channel_name = "test_channel_name";
- int fd1 = -1;
- int fd2 = -1;
- bool result = IPC::SocketPair(&fd1, &fd2);
- EXPECT_TRUE(result);
-
- base::ScopedFD scoped_fd1(fd1);
- base::ScopedFD scoped_fd2(fd2);
- IPC::ChannelHandle handle(channel_name,
- base::FileDescriptor(scoped_fd1.release(), true));
-
- mus::mojom::ChannelHandlePtr mojo_handle =
- mus::mojom::ChannelHandle::From(handle);
- ASSERT_EQ(mojo_handle->name, channel_name);
- EXPECT_TRUE(mojo_handle->socket.is_valid());
-
- handle = mojo_handle.To<IPC::ChannelHandle>();
- ASSERT_EQ(handle.name, channel_name);
- ASSERT_NE(handle.socket.fd, -1);
- EXPECT_TRUE(handle.socket.auto_close);
- base::ScopedFD socped_fd3(handle.socket.fd);
- }
-#endif
-}
-
-// Test for mojo TypeConverter of mus::mojom::GpuMemoryBufferHandle
-TEST(MusGpuTypeConvertersTest, GpuMemoryBufferHandle) {
- const gfx::GpuMemoryBufferId kId(99);
- const uint32_t kOffset = 126;
- const int32_t kStride = 256;
- base::SharedMemory shared_memory;
- ASSERT_TRUE(shared_memory.CreateAnonymous(1024));
- ASSERT_TRUE(shared_memory.Map(1024));
-
- gfx::GpuMemoryBufferHandle handle;
- handle.type = gfx::SHARED_MEMORY_BUFFER;
- handle.id = kId;
- handle.handle = base::SharedMemory::DuplicateHandle(shared_memory.handle());
- handle.offset = kOffset;
- handle.stride = kStride;
-
- mus::mojom::GpuMemoryBufferHandlePtr gpu_handle =
- mus::mojom::GpuMemoryBufferHandle::From<gfx::GpuMemoryBufferHandle>(
- handle);
- ASSERT_EQ(gpu_handle->type, mus::mojom::GpuMemoryBufferType::SHARED_MEMORY);
- ASSERT_EQ(gpu_handle->id->id, 99);
- ASSERT_EQ(gpu_handle->offset, kOffset);
- ASSERT_EQ(gpu_handle->stride, kStride);
-
- handle = gpu_handle.To<gfx::GpuMemoryBufferHandle>();
- ASSERT_EQ(handle.type, gfx::SHARED_MEMORY_BUFFER);
- ASSERT_EQ(handle.id, kId);
- ASSERT_EQ(handle.offset, kOffset);
- ASSERT_EQ(handle.stride, kStride);
-
- base::SharedMemory shared_memory1(handle.handle, true);
- ASSERT_TRUE(shared_memory1.Map(1024));
-}
diff --git a/chromium/components/mus/common/mojo_buffer_backing.cc b/chromium/components/mus/common/mojo_buffer_backing.cc
deleted file mode 100644
index ba9da7fcb0d..00000000000
--- a/chromium/components/mus/common/mojo_buffer_backing.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/common/mojo_buffer_backing.h"
-
-#include "base/logging.h"
-#include "base/memory/ptr_util.h"
-
-namespace mus {
-
-MojoBufferBacking::MojoBufferBacking(mojo::ScopedSharedBufferMapping mapping,
- size_t size)
- : mapping_(std::move(mapping)), size_(size) {}
-
-MojoBufferBacking::~MojoBufferBacking() = default;
-
-// static
-std::unique_ptr<gpu::BufferBacking> MojoBufferBacking::Create(
- mojo::ScopedSharedBufferHandle handle,
- size_t size) {
- mojo::ScopedSharedBufferMapping mapping = handle->Map(size);
- if (!mapping)
- return nullptr;
- return base::MakeUnique<MojoBufferBacking>(std::move(mapping), size);
-}
-void* MojoBufferBacking::GetMemory() const {
- return mapping_.get();
-}
-size_t MojoBufferBacking::GetSize() const {
- return size_;
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/common/mojo_buffer_backing.h b/chromium/components/mus/common/mojo_buffer_backing.h
deleted file mode 100644
index 3f6e33f721e..00000000000
--- a/chromium/components/mus/common/mojo_buffer_backing.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_COMMON_MOJO_BUFFER_BACKING_H_
-#define COMPONENTS_MUS_COMMON_MOJO_BUFFER_BACKING_H_
-
-#include <stddef.h>
-
-#include <memory>
-
-#include "base/macros.h"
-#include "components/mus/common/mus_common_export.h"
-#include "gpu/command_buffer/common/buffer.h"
-#include "mojo/public/cpp/system/core.h"
-
-namespace mus {
-
-class MUS_COMMON_EXPORT MojoBufferBacking : public gpu::BufferBacking {
- public:
- MojoBufferBacking(mojo::ScopedSharedBufferMapping mapping, size_t size);
- ~MojoBufferBacking() override;
-
- static std::unique_ptr<gpu::BufferBacking> Create(
- mojo::ScopedSharedBufferHandle handle,
- size_t size);
-
- void* GetMemory() const override;
- size_t GetSize() const override;
-
- private:
- mojo::ScopedSharedBufferMapping mapping_;
- size_t size_;
-
- DISALLOW_COPY_AND_ASSIGN(MojoBufferBacking);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_COMMON_MOJO_BUFFER_BACKING_H_
diff --git a/chromium/components/mus/common/mojo_gpu_memory_buffer.cc b/chromium/components/mus/common/mojo_gpu_memory_buffer.cc
deleted file mode 100644
index 00b046b068d..00000000000
--- a/chromium/components/mus/common/mojo_gpu_memory_buffer.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/common/mojo_gpu_memory_buffer.h"
-
-#include <stdint.h>
-
-#include "base/logging.h"
-#include "base/memory/ptr_util.h"
-#include "base/memory/shared_memory.h"
-#include "base/numerics/safe_conversions.h"
-#include "build/build_config.h"
-#include "mojo/public/cpp/system/buffer.h"
-#include "mojo/public/cpp/system/platform_handle.h"
-#include "ui/gfx/buffer_format_util.h"
-
-namespace mus {
-
-MojoGpuMemoryBufferImpl::MojoGpuMemoryBufferImpl(
- const gfx::Size& size,
- gfx::BufferFormat format,
- std::unique_ptr<base::SharedMemory> shared_memory)
- : GpuMemoryBufferImpl(gfx::GenericSharedMemoryId(0), size, format),
- shared_memory_(std::move(shared_memory)) {}
-
-// TODO(rjkroege): Support running a destructor callback as necessary.
-MojoGpuMemoryBufferImpl::~MojoGpuMemoryBufferImpl() {}
-
-std::unique_ptr<gfx::GpuMemoryBuffer> MojoGpuMemoryBufferImpl::Create(
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage) {
- size_t bytes = gfx::BufferSizeForBufferFormat(size, format);
-
- mojo::ScopedSharedBufferHandle handle =
- mojo::SharedBufferHandle::Create(bytes);
- if (!handle.is_valid())
- return nullptr;
-
- base::SharedMemoryHandle platform_handle;
- size_t shared_memory_size;
- bool readonly;
- MojoResult result = mojo::UnwrapSharedMemoryHandle(
- std::move(handle), &platform_handle, &shared_memory_size, &readonly);
- if (result != MOJO_RESULT_OK)
- return nullptr;
- DCHECK_EQ(shared_memory_size, bytes);
-
- auto shared_memory =
- base::MakeUnique<base::SharedMemory>(platform_handle, readonly);
- return base::WrapUnique<gfx::GpuMemoryBuffer>(
- new MojoGpuMemoryBufferImpl(size, format, std::move(shared_memory)));
-}
-
-MojoGpuMemoryBufferImpl* MojoGpuMemoryBufferImpl::FromClientBuffer(
- ClientBuffer buffer) {
- return reinterpret_cast<MojoGpuMemoryBufferImpl*>(buffer);
-}
-
-const unsigned char* MojoGpuMemoryBufferImpl::GetMemory() const {
- return static_cast<const unsigned char*>(shared_memory_->memory());
-}
-
-bool MojoGpuMemoryBufferImpl::Map() {
- DCHECK(!mapped_);
- if (!shared_memory_->Map(gfx::BufferSizeForBufferFormat(size_, format_)))
- return false;
- mapped_ = true;
- return true;
-}
-
-void* MojoGpuMemoryBufferImpl::memory(size_t plane) {
- DCHECK(mapped_);
- DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_));
- return reinterpret_cast<uint8_t*>(shared_memory_->memory()) +
- gfx::BufferOffsetForBufferFormat(size_, format_, plane);
-}
-
-void MojoGpuMemoryBufferImpl::Unmap() {
- DCHECK(mapped_);
- shared_memory_->Unmap();
- mapped_ = false;
-}
-
-int MojoGpuMemoryBufferImpl::stride(size_t plane) const {
- DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_));
- return base::checked_cast<int>(gfx::RowSizeForBufferFormat(
- size_.width(), format_, static_cast<int>(plane)));
-}
-
-gfx::GpuMemoryBufferHandle MojoGpuMemoryBufferImpl::GetHandle() const {
- gfx::GpuMemoryBufferHandle handle;
- handle.type = gfx::SHARED_MEMORY_BUFFER;
- handle.handle = shared_memory_->handle();
- handle.offset = 0;
- handle.stride = static_cast<int32_t>(
- gfx::RowSizeForBufferFormat(size_.width(), format_, 0));
-
- return handle;
-}
-
-gfx::GpuMemoryBufferType MojoGpuMemoryBufferImpl::GetBufferType() const {
- return gfx::SHARED_MEMORY_BUFFER;
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/common/mojo_gpu_memory_buffer.h b/chromium/components/mus/common/mojo_gpu_memory_buffer.h
deleted file mode 100644
index ffcbf049185..00000000000
--- a/chromium/components/mus/common/mojo_gpu_memory_buffer.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_COMMON_MOJO_GPU_MEMORY_BUFFER_H_
-#define COMPONENTS_MUS_COMMON_MOJO_GPU_MEMORY_BUFFER_H_
-
-#include <stddef.h>
-
-#include <memory>
-
-#include "base/macros.h"
-#include "components/mus/common/gpu_memory_buffer_impl.h"
-#include "components/mus/common/mus_common_export.h"
-#include "ui/gfx/geometry/size.h"
-#include "ui/gfx/gpu_memory_buffer.h"
-
-namespace mus {
-
-class MUS_COMMON_EXPORT MojoGpuMemoryBufferImpl
- : public mus::GpuMemoryBufferImpl {
- public:
- MojoGpuMemoryBufferImpl(const gfx::Size& size,
- gfx::BufferFormat format,
- std::unique_ptr<base::SharedMemory> shared_memory);
- ~MojoGpuMemoryBufferImpl() override;
-
- static std::unique_ptr<gfx::GpuMemoryBuffer> Create(const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage);
-
- static MojoGpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer);
-
- const unsigned char* GetMemory() const;
-
- // Overridden from gfx::GpuMemoryBuffer:
- bool Map() override;
- void* memory(size_t plane) override;
- void Unmap() override;
- int stride(size_t plane) const override;
- gfx::GpuMemoryBufferHandle GetHandle() const override;
-
- // Overridden from gfx::GpuMemoryBufferImpl
- gfx::GpuMemoryBufferType GetBufferType() const override;
-
- private:
- std::unique_ptr<base::SharedMemory> shared_memory_;
-
- DISALLOW_COPY_AND_ASSIGN(MojoGpuMemoryBufferImpl);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_COMMON_MOJO_GPU_MEMORY_BUFFER_H_
diff --git a/chromium/components/mus/common/mojo_gpu_memory_buffer_manager.cc b/chromium/components/mus/common/mojo_gpu_memory_buffer_manager.cc
deleted file mode 100644
index 51decafb326..00000000000
--- a/chromium/components/mus/common/mojo_gpu_memory_buffer_manager.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/common/mojo_gpu_memory_buffer_manager.h"
-
-#include "base/logging.h"
-#include "components/mus/common/mojo_gpu_memory_buffer.h"
-
-namespace mus {
-
-MojoGpuMemoryBufferManager::MojoGpuMemoryBufferManager() {}
-
-MojoGpuMemoryBufferManager::~MojoGpuMemoryBufferManager() {}
-
-std::unique_ptr<gfx::GpuMemoryBuffer>
-MojoGpuMemoryBufferManager::AllocateGpuMemoryBuffer(
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage,
- gpu::SurfaceHandle surface_handle) {
- return MojoGpuMemoryBufferImpl::Create(size, format, usage);
-}
-
-std::unique_ptr<gfx::GpuMemoryBuffer>
-MojoGpuMemoryBufferManager::CreateGpuMemoryBufferFromHandle(
- const gfx::GpuMemoryBufferHandle& handle,
- const gfx::Size& size,
- gfx::BufferFormat format) {
- NOTIMPLEMENTED();
- return nullptr;
-}
-
-gfx::GpuMemoryBuffer*
-MojoGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer(
- ClientBuffer buffer) {
- return MojoGpuMemoryBufferImpl::FromClientBuffer(buffer);
-}
-
-void MojoGpuMemoryBufferManager::SetDestructionSyncToken(
- gfx::GpuMemoryBuffer* buffer,
- const gpu::SyncToken& sync_token) {
- NOTIMPLEMENTED();
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/common/mojo_gpu_memory_buffer_manager.h b/chromium/components/mus/common/mojo_gpu_memory_buffer_manager.h
deleted file mode 100644
index e3ce95dfc97..00000000000
--- a/chromium/components/mus/common/mojo_gpu_memory_buffer_manager.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_COMMON_MOJO_GPU_MEMORY_BUFFER_MANAGER_H_
-#define COMPONENTS_MUS_COMMON_MOJO_GPU_MEMORY_BUFFER_MANAGER_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "components/mus/common/mus_common_export.h"
-#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
-
-namespace mus {
-
-class MUS_COMMON_EXPORT MojoGpuMemoryBufferManager
- : public gpu::GpuMemoryBufferManager {
- public:
- MojoGpuMemoryBufferManager();
- ~MojoGpuMemoryBufferManager() override;
-
- // Overridden from gpu::GpuMemoryBufferManager:
- std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage,
- gpu::SurfaceHandle surface_handle) override;
- std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle(
- const gfx::GpuMemoryBufferHandle& handle,
- const gfx::Size& size,
- gfx::BufferFormat format) override;
- gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer(
- ClientBuffer buffer) override;
- void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer,
- const gpu::SyncToken& sync_token) override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MojoGpuMemoryBufferManager);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_COMMON_MOJO_GPU_MEMORY_BUFFER_MANAGER_H_
diff --git a/chromium/components/mus/common/mus_common_export.h b/chromium/components/mus/common/mus_common_export.h
deleted file mode 100644
index 7e7526b6710..00000000000
--- a/chromium/components/mus/common/mus_common_export.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_COMMON_MUS_COMMON_EXPORT_H_
-#define COMPONENTS_MUS_COMMON_MUS_COMMON_EXPORT_H_
-
-#if defined(COMPONENT_BUILD)
-#if defined(WIN32)
-
-#if defined(MUS_COMMON_IMPLEMENTATION)
-#define MUS_COMMON_EXPORT __declspec(dllexport)
-#else
-#define MUS_COMMON_EXPORT __declspec(dllimport)
-#endif // defined(MUS_COMMON_IMPLEMENTATION)
-
-#else // defined(WIN32)
-#if defined(MUS_COMMON_IMPLEMENTATION)
-#define MUS_COMMON_EXPORT __attribute__((visibility("default")))
-#else
-#define MUS_COMMON_EXPORT
-#endif
-#endif
-
-#else // defined(COMPONENT_BUILD)
-#define MUS_COMMON_EXPORT
-#endif
-
-#endif // COMPONENTS_MUS_COMMON_MUS_COMMON_EXPORT_H_
diff --git a/chromium/components/mus/common/mus_common_unittests_app_manifest.json b/chromium/components/mus/common/mus_common_unittests_app_manifest.json
deleted file mode 100644
index 5240ae9b6a9..00000000000
--- a/chromium/components/mus/common/mus_common_unittests_app_manifest.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "manifest_version": 1,
- "name": "mojo:mus_common_unittests_app",
- "display_name": "Mus Common Unittests",
- "capabilities": {
- "required": {
- "*": { "classes": [ "app" ] }
- }
- }
-}
diff --git a/chromium/components/mus/common/run_all_shelltests.cc b/chromium/components/mus/common/run_all_shelltests.cc
deleted file mode 100644
index e795983ec58..00000000000
--- a/chromium/components/mus/common/run_all_shelltests.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/test/launcher/unit_test_launcher.h"
-#include "base/test/test_suite.h"
-#include "build/build_config.h"
-#include "mojo/edk/embedder/embedder.h"
-#include "services/shell/background/background_shell_main.h"
-
-#if defined(USE_OZONE)
-#include "ui/ozone/public/ozone_platform.h"
-#endif
-
-class MusGpuTestSuite : public base::TestSuite {
- public:
- MusGpuTestSuite(int argc, char** argv) : base::TestSuite(argc, argv) {}
-
- private:
- void Initialize() override {
- base::TestSuite::Initialize();
-#if defined(USE_OZONE)
- ui::OzonePlatform::InitializeForGPU();
-#endif
- }
-};
-
-int MasterProcessMain(int argc, char** argv) {
- MusGpuTestSuite test_suite(argc, argv);
- mojo::edk::Init();
- return base::LaunchUnitTests(
- argc, argv,
- base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite)));
-}
diff --git a/chromium/components/mus/common/switches.cc b/chromium/components/mus/common/switches.cc
deleted file mode 100644
index f9bead3ed54..00000000000
--- a/chromium/components/mus/common/switches.cc
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/common/switches.h"
-
-namespace mus {
-namespace switches {
-
-// Use mojo GPU command buffer instead of Chrome GPU command buffer.
-const char kUseMojoGpuCommandBufferInMus[] =
- "use-mojo-gpu-command-buffer-in-mus";
-
-// Initializes X11 in threaded mode, and sets the |override_redirect| flag when
-// creating X11 windows. Also, exposes the WindowServerTest interface to clients
-// when launched with this flag.
-const char kUseTestConfig[] = "use-test-config";
-
-} // namespace switches
-} // namespace mus
diff --git a/chromium/components/mus/common/switches.h b/chromium/components/mus/common/switches.h
deleted file mode 100644
index 492aa4c3113..00000000000
--- a/chromium/components/mus/common/switches.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_COMMON_SWITCHES_H_
-#define COMPONENTS_MUS_COMMON_SWITCHES_H_
-
-#include "components/mus/common/mus_common_export.h"
-
-namespace mus {
-namespace switches {
-
-// All args in alphabetical order. The switches should be documented
-// alongside the definition of their values in the .cc file.
-extern const char MUS_COMMON_EXPORT kUseMojoGpuCommandBufferInMus[];
-extern const char MUS_COMMON_EXPORT kUseTestConfig[];
-
-} // namespace switches
-} // namespace mus
-
-#endif // COMPONENTS_MUS_COMMON_SWITCHES_H_
diff --git a/chromium/components/mus/common/transient_window_utils.h b/chromium/components/mus/common/transient_window_utils.h
deleted file mode 100644
index 17eedc63a25..00000000000
--- a/chromium/components/mus/common/transient_window_utils.h
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_COMMON_TRANSIENT_WINDOW_UTILS_H_
-#define COMPONENTS_MUS_COMMON_TRANSIENT_WINDOW_UTILS_H_
-
-#include <stddef.h>
-
-#include <vector>
-
-#include "components/mus/public/interfaces/mus_constants.mojom.h"
-
-namespace mus {
-
-// Returns true if |window| has |ancestor| as a transient ancestor. A transient
-// ancestor is found by following the transient parent chain of the window.
-template <class T>
-bool HasTransientAncestor(const T* window, const T* ancestor) {
- const T* transient_parent = window->transient_parent();
- if (transient_parent == ancestor)
- return true;
- return transient_parent ? HasTransientAncestor(transient_parent, ancestor)
- : false;
-}
-
-// Populates |ancestors| with all transient ancestors of |window| that are
-// siblings of |window|. Returns true if any ancestors were found, false if not.
-template <class T>
-bool GetAllTransientAncestors(T* window, std::vector<T*>* ancestors) {
- T* parent = window->parent();
- for (; window; window = window->transient_parent()) {
- if (window->parent() == parent)
- ancestors->push_back(window);
- }
- return !ancestors->empty();
-}
-
-// Replaces |window1| and |window2| with their possible transient ancestors that
-// are still siblings (have a common transient parent). |window1| and |window2|
-// are not modified if such ancestors cannot be found.
-template <class T>
-void FindCommonTransientAncestor(T** window1, T** window2) {
- DCHECK(window1);
- DCHECK(window2);
- DCHECK(*window1);
- DCHECK(*window2);
- // Assemble chains of ancestors of both windows.
- std::vector<T*> ancestors1;
- std::vector<T*> ancestors2;
- if (!GetAllTransientAncestors(*window1, &ancestors1) ||
- !GetAllTransientAncestors(*window2, &ancestors2)) {
- return;
- }
- // Walk the two chains backwards and look for the first difference.
- auto it1 = ancestors1.rbegin();
- auto it2 = ancestors2.rbegin();
- for (; it1 != ancestors1.rend() && it2 != ancestors2.rend(); ++it1, ++it2) {
- if (*it1 != *it2) {
- *window1 = *it1;
- *window2 = *it2;
- break;
- }
- }
-}
-
-template <class T>
-bool AdjustStackingForTransientWindows(T** child,
- T** target,
- mojom::OrderDirection* direction,
- T* stacking_target) {
- if (stacking_target == *target)
- return true;
-
- // For windows that have transient children stack the transient ancestors that
- // are siblings. This prevents one transient group from being inserted in the
- // middle of another.
- FindCommonTransientAncestor(child, target);
-
- // When stacking above skip to the topmost transient descendant of the target.
- if (*direction == mojom::OrderDirection::ABOVE &&
- !HasTransientAncestor(*child, *target)) {
- const std::vector<T*>& siblings((*child)->parent()->children());
- size_t target_i =
- std::find(siblings.begin(), siblings.end(), *target) - siblings.begin();
- while (target_i + 1 < siblings.size() &&
- HasTransientAncestor(siblings[target_i + 1], *target)) {
- ++target_i;
- }
- *target = siblings[target_i];
- }
-
- return *child != *target;
-}
-
-// Stacks transient descendants of |window| that are its siblings just above it.
-// |GetStackingTarget| is a function that returns a marker associated with a
-// Window that indicates the current Window being stacked.
-// |Reorder| is a function that takes in two windows and orders the first
-// relative to the second based on the provided OrderDirection.
-template <class T>
-void RestackTransientDescendants(T* window,
- T** (*GetStackingTarget)(T*),
- void (*Reorder)(T*,
- T*,
- mojom::OrderDirection)) {
- T* parent = window->parent();
- if (!parent)
- return;
-
- // stack any transient children that share the same parent to be in front of
- // |window_|. the existing stacking order is preserved by iterating backwards
- // and always stacking on top.
- std::vector<T*> children(parent->children());
- for (auto it = children.rbegin(); it != children.rend(); ++it) {
- if ((*it) != window && HasTransientAncestor(*it, window)) {
- T* old_stacking_target = *GetStackingTarget(*it);
- *GetStackingTarget(*it) = window;
- Reorder(*it, window, mojom::OrderDirection::ABOVE);
- *GetStackingTarget(*it) = old_stacking_target;
- }
- }
-}
-} // namespace mus
-
-#endif // COMPONENTS_MUS_COMMON_TRANSIENT_WINDOW_UTILS_H_
diff --git a/chromium/components/mus/common/types.h b/chromium/components/mus/common/types.h
deleted file mode 100644
index 93b96683e6b..00000000000
--- a/chromium/components/mus/common/types.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_COMMON_TYPES_H_
-#define COMPONENTS_MUS_COMMON_TYPES_H_
-
-#include <stdint.h>
-
-// Typedefs for the transport types. These typedefs match that of the mojom
-// file, see it for specifics.
-
-namespace mus {
-
-// Used to identify windows and change ids.
-typedef uint32_t Id;
-
-// Used to identify a client as well as a client-specific window id. For
-// example, the Id for a window consists of the ClientSpecificId of the client
-// and the ClientSpecificId of the window.
-typedef uint16_t ClientSpecificId;
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_COMMON_TYPES_H_
diff --git a/chromium/components/mus/common/util.h b/chromium/components/mus/common/util.h
deleted file mode 100644
index daa59efc6b1..00000000000
--- a/chromium/components/mus/common/util.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_COMMON_UTIL_H_
-#define COMPONENTS_MUS_COMMON_UTIL_H_
-
-#include <stdint.h>
-
-#include "components/mus/common/types.h"
-
-// TODO(beng): #$*&@#(@ MacOSX SDK!
-#if defined(HiWord)
-#undef HiWord
-#endif
-#if defined(LoWord)
-#undef LoWord
-#endif
-
-namespace mus {
-
-inline uint16_t HiWord(uint32_t id) {
- return static_cast<uint16_t>((id >> 16) & 0xFFFF);
-}
-
-inline uint16_t LoWord(uint32_t id) {
- return static_cast<uint16_t>(id & 0xFFFF);
-}
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_COMMON_UTIL_H_
diff --git a/chromium/components/mus/demo/DEPS b/chromium/components/mus/demo/DEPS
deleted file mode 100644
index ce521506ba2..00000000000
--- a/chromium/components/mus/demo/DEPS
+++ /dev/null
@@ -1,4 +0,0 @@
-include_rules = [
- "+components/bitmap_uploader",
-]
-
diff --git a/chromium/components/mus/demo/OWNERS b/chromium/components/mus/demo/OWNERS
deleted file mode 100644
index 47351aafac9..00000000000
--- a/chromium/components/mus/demo/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-kylechar@chromium.org
-rjkroege@chromium.org
diff --git a/chromium/components/mus/demo/main.cc b/chromium/components/mus/demo/main.cc
deleted file mode 100644
index 62be1b7d81d..00000000000
--- a/chromium/components/mus/demo/main.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/demo/mus_demo.h"
-#include "mojo/public/c/system/main.h"
-#include "services/shell/public/cpp/application_runner.h"
-
-MojoResult MojoMain(MojoHandle shell_handle) {
- shell::ApplicationRunner runner(new mus_demo::MusDemo);
- runner.set_message_loop_type(base::MessageLoop::TYPE_UI);
- return runner.Run(shell_handle);
-}
diff --git a/chromium/components/mus/demo/manifest.json b/chromium/components/mus/demo/manifest.json
deleted file mode 100644
index 7971b79d238..00000000000
--- a/chromium/components/mus/demo/manifest.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "manifest_version": 1,
- "name": "mojo:mus_demo",
- "display_name": "MUS Demo",
- "capabilities": {
- "required": {
- "mojo:mus": {
- "interfaces": [ "mus::mojom::WindowManagerWindowTreeFactory"],
- "classes": [ "app" ]
- }
- }
- }
-}
-
diff --git a/chromium/components/mus/demo/mus_demo.cc b/chromium/components/mus/demo/mus_demo.cc
deleted file mode 100644
index 0853f5ab48c..00000000000
--- a/chromium/components/mus/demo/mus_demo.cc
+++ /dev/null
@@ -1,179 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/demo/mus_demo.h"
-
-#include "base/time/time.h"
-#include "components/bitmap_uploader/bitmap_uploader.h"
-#include "components/mus/common/gpu_service.h"
-#include "components/mus/public/cpp/window.h"
-#include "components/mus/public/cpp/window_tree_client.h"
-#include "services/shell/public/cpp/connector.h"
-#include "third_party/skia/include/core/SkCanvas.h"
-#include "third_party/skia/include/core/SkColor.h"
-#include "third_party/skia/include/core/SkImageInfo.h"
-#include "third_party/skia/include/core/SkPaint.h"
-#include "third_party/skia/include/core/SkRect.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace mus_demo {
-
-namespace {
-
-// Milliseconds between frames.
-const int64_t kFrameDelay = 33;
-
-// Size of square in pixels to draw.
-const int kSquareSize = 300;
-
-const SkColor kBgColor = SK_ColorRED;
-const SkColor kFgColor = SK_ColorYELLOW;
-
-void DrawSquare(const gfx::Rect& bounds, double angle, SkCanvas* canvas) {
- // Create SkRect to draw centered inside the bounds.
- gfx::Point top_left = bounds.CenterPoint();
- top_left.Offset(-kSquareSize / 2, -kSquareSize / 2);
- SkRect rect =
- SkRect::MakeXYWH(top_left.x(), top_left.y(), kSquareSize, kSquareSize);
-
- // Set SkPaint to fill solid color.
- SkPaint paint;
- paint.setStyle(SkPaint::kFill_Style);
- paint.setColor(kFgColor);
-
- // Rotate the canvas.
- const gfx::Size canvas_size = bounds.size();
- if (angle != 0.0) {
- canvas->translate(SkFloatToScalar(canvas_size.width() * 0.5f),
- SkFloatToScalar(canvas_size.height() * 0.5f));
- canvas->rotate(angle);
- canvas->translate(-SkFloatToScalar(canvas_size.width() * 0.5f),
- -SkFloatToScalar(canvas_size.height() * 0.5f));
- }
-
- canvas->drawRect(rect, paint);
-}
-
-} // namespace
-
-MusDemo::MusDemo() {}
-
-MusDemo::~MusDemo() {
- delete window_tree_client_;
-}
-
-void MusDemo::Initialize(shell::Connector* connector,
- const shell::Identity& identity,
- uint32_t id) {
- connector_ = connector;
- mus::GpuService::Initialize(connector_);
- window_tree_client_ = new mus::WindowTreeClient(this, this, nullptr);
- window_tree_client_->ConnectAsWindowManager(connector);
-}
-
-bool MusDemo::AcceptConnection(shell::Connection* connection) {
- return true;
-}
-
-void MusDemo::OnEmbed(mus::Window* window) {
- // Not called for the WindowManager.
- NOTREACHED();
-}
-
-void MusDemo::OnWindowTreeClientDestroyed(mus::WindowTreeClient* client) {
- window_tree_client_ = nullptr;
- timer_.Stop();
-}
-
-void MusDemo::OnEventObserved(const ui::Event& event, mus::Window* target) {}
-
-void MusDemo::SetWindowManagerClient(mus::WindowManagerClient* client) {}
-
-bool MusDemo::OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) {
- return true;
-}
-
-bool MusDemo::OnWmSetProperty(mus::Window* window,
- const std::string& name,
- std::unique_ptr<std::vector<uint8_t>>* new_data) {
- return true;
-}
-
-mus::Window* MusDemo::OnWmCreateTopLevelWindow(
- std::map<std::string, std::vector<uint8_t>>* properties) {
- return nullptr;
-}
-
-void MusDemo::OnWmClientJankinessChanged(
- const std::set<mus::Window*>& client_windows,
- bool janky) {
- // Don't care
-}
-
-void MusDemo::OnWmNewDisplay(mus::Window* window,
- const display::Display& display) {
- DCHECK(!window_); // Only support one display.
- window_ = window;
-
- // Initialize bitmap uploader for sending frames to MUS.
- uploader_.reset(new bitmap_uploader::BitmapUploader(window_));
- uploader_->Init(connector_);
-
- // Draw initial frame and start the timer to regularly draw frames.
- DrawFrame();
- timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(kFrameDelay),
- base::Bind(&MusDemo::DrawFrame, base::Unretained(this)));
-}
-
-void MusDemo::OnAccelerator(uint32_t id, const ui::Event& event) {
- // Don't care
-}
-
-void MusDemo::AllocBitmap() {
- const gfx::Rect bounds = window_->GetBoundsInRoot();
-
- // Allocate bitmap the same size as the window for drawing.
- bitmap_.reset();
- SkImageInfo image_info = SkImageInfo::MakeN32(bounds.width(), bounds.height(),
- kPremul_SkAlphaType);
- bitmap_.allocPixels(image_info);
-}
-
-void MusDemo::DrawFrame() {
- angle_ += 2.0;
- if (angle_ >= 360.0)
- angle_ = 0.0;
-
- const gfx::Rect bounds = window_->GetBoundsInRoot();
-
- // Check that bitmap and window sizes match, otherwise reallocate bitmap.
- const SkImageInfo info = bitmap_.info();
- if (info.width() != bounds.width() || info.height() != bounds.height()) {
- AllocBitmap();
- }
-
- // Draw the rotated square on background in bitmap.
- SkCanvas canvas(bitmap_);
- canvas.clear(kBgColor);
- // TODO(kylechar): Add GL drawing instead of software rasterization in future.
- DrawSquare(bounds, angle_, &canvas);
- canvas.flush();
-
- // Copy pixels data into vector that will be passed to BitmapUploader.
- // TODO(rjkroege): Make a 1/0-copy bitmap uploader for the contents of a
- // SkBitmap.
- bitmap_.lockPixels();
- const unsigned char* addr =
- static_cast<const unsigned char*>(bitmap_.getPixels());
- const int bytes = bounds.width() * bounds.height() * 4;
- std::unique_ptr<std::vector<unsigned char>> data(
- new std::vector<unsigned char>(addr, addr + bytes));
- bitmap_.unlockPixels();
-
- // Send frame to MUS via BitmapUploader.
- uploader_->SetBitmap(bounds.width(), bounds.height(), std::move(data),
- bitmap_uploader::BitmapUploader::BGRA);
-}
-
-} // namespace mus_demo
diff --git a/chromium/components/mus/demo/mus_demo.h b/chromium/components/mus/demo/mus_demo.h
deleted file mode 100644
index dbb62647294..00000000000
--- a/chromium/components/mus/demo/mus_demo.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_DEMO_MUS_DEMO_H_
-#define COMPONENTS_MUS_DEMO_MUS_DEMO_H_
-
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "base/timer/timer.h"
-#include "components/mus/public/cpp/window_manager_delegate.h"
-#include "components/mus/public/cpp/window_tree_client_delegate.h"
-#include "services/shell/public/cpp/shell_client.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-
-namespace bitmap_uploader {
-class BitmapUploader;
-}
-
-namespace mus_demo {
-
-// A simple MUS Demo mojo app. This app connects to the mojo:mus, creates a new
-// window and draws a spinning square in the center of the window. Provides a
-// simple way to demonstrate that the graphic stack works as intended.
-class MusDemo : public shell::ShellClient,
- public mus::WindowTreeClientDelegate,
- public mus::WindowManagerDelegate {
- public:
- MusDemo();
- ~MusDemo() override;
-
- private:
- // shell::ShellClient:
- void Initialize(shell::Connector* connector,
- const shell::Identity& identity,
- uint32_t id) override;
- bool AcceptConnection(shell::Connection* connection) override;
-
- // WindowTreeClientDelegate:
- void OnEmbed(mus::Window* root) override;
- void OnWindowTreeClientDestroyed(mus::WindowTreeClient* client) override;
- void OnEventObserved(const ui::Event& event, mus::Window* target) override;
-
- // WindowManagerDelegate:
- void SetWindowManagerClient(mus::WindowManagerClient* client) override;
- bool OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) override;
- bool OnWmSetProperty(
- mus::Window* window,
- const std::string& name,
- std::unique_ptr<std::vector<uint8_t>>* new_data) override;
- mus::Window* OnWmCreateTopLevelWindow(
- std::map<std::string, std::vector<uint8_t>>* properties) override;
- void OnWmClientJankinessChanged(const std::set<mus::Window*>& client_windows,
- bool janky) override;
- void OnWmNewDisplay(mus::Window* window,
- const display::Display& display) override;
- void OnAccelerator(uint32_t id, const ui::Event& event) override;
-
- // Allocate a bitmap the same size as the window to draw into.
- void AllocBitmap();
-
- // Draws one frame, incrementing the rotation angle.
- void DrawFrame();
-
- shell::Connector* connector_ = nullptr;
-
- mus::Window* window_ = nullptr;
- mus::WindowTreeClient* window_tree_client_ = nullptr;
-
- // Used to send frames to mus.
- std::unique_ptr<bitmap_uploader::BitmapUploader> uploader_;
-
- // Bitmap that is the same size as our client window area.
- SkBitmap bitmap_;
-
- // Timer for calling DrawFrame().
- base::RepeatingTimer timer_;
-
- // Current rotation angle for drawing.
- double angle_ = 0.0;
-
- DISALLOW_COPY_AND_ASSIGN(MusDemo);
-};
-
-} // namespace mus_demo
-
-#endif // COMPONENTS_MUS_DEMO_MUS_DEMO_H_
diff --git a/chromium/components/mus/gles2/DEPS b/chromium/components/mus/gles2/DEPS
deleted file mode 100644
index 2ad979f2443..00000000000
--- a/chromium/components/mus/gles2/DEPS
+++ /dev/null
@@ -1,8 +0,0 @@
-include_rules = [
- "+cc",
- "+components/gpu",
- "+gpu",
- "+mojo/converters",
- "+mojo/public",
- "+ui",
-]
diff --git a/chromium/components/mus/gles2/OWNERS b/chromium/components/mus/gles2/OWNERS
deleted file mode 100644
index 1f1af6bcc54..00000000000
--- a/chromium/components/mus/gles2/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-fsamuel@chromium.org
-rjkroege@chromium.org
diff --git a/chromium/components/mus/gles2/command_buffer_driver.cc b/chromium/components/mus/gles2/command_buffer_driver.cc
deleted file mode 100644
index 1c35904e9f6..00000000000
--- a/chromium/components/mus/gles2/command_buffer_driver.cc
+++ /dev/null
@@ -1,568 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gles2/command_buffer_driver.h"
-
-#include <stddef.h>
-#include <utility>
-
-#include "base/bind.h"
-#include "base/memory/shared_memory.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "build/build_config.h"
-#include "components/mus/common/mojo_buffer_backing.h"
-#include "components/mus/gles2/gl_surface_adapter.h"
-#include "components/mus/gles2/gpu_memory_tracker.h"
-#include "components/mus/gles2/gpu_state.h"
-#include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
-#include "gpu/command_buffer/service/command_buffer_service.h"
-#include "gpu/command_buffer/service/command_executor.h"
-#include "gpu/command_buffer/service/context_group.h"
-#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
-#include "gpu/command_buffer/service/image_manager.h"
-#include "gpu/command_buffer/service/mailbox_manager.h"
-#include "gpu/command_buffer/service/query_manager.h"
-#include "gpu/command_buffer/service/sync_point_manager.h"
-#include "gpu/command_buffer/service/transfer_buffer_manager.h"
-#include "mojo/public/cpp/system/platform_handle.h"
-#include "ui/gfx/buffer_format_util.h"
-#include "ui/gfx/gpu_memory_buffer.h"
-#include "ui/gfx/vsync_provider.h"
-#include "ui/gl/gl_context.h"
-#include "ui/gl/gl_image_shared_memory.h"
-#include "ui/gl/gl_surface.h"
-#include "ui/gl/init/gl_factory.h"
-
-#if defined(USE_OZONE)
-#include "ui/gl/gl_image_ozone_native_pixmap.h"
-#endif
-
-namespace mus {
-
-namespace {
-
-// The first time polling a fence, delay some extra time to allow other
-// stubs to process some work, or else the timing of the fences could
-// allow a pattern of alternating fast and slow frames to occur.
-const int64_t kHandleMoreWorkPeriodMs = 2;
-const int64_t kHandleMoreWorkPeriodBusyMs = 1;
-
-// Prevents idle work from being starved.
-const int64_t kMaxTimeSinceIdleMs = 10;
-
-} // namespace
-
-CommandBufferDriver::Client::~Client() {}
-
-CommandBufferDriver::CommandBufferDriver(
- gpu::CommandBufferNamespace command_buffer_namespace,
- gpu::CommandBufferId command_buffer_id,
- gfx::AcceleratedWidget widget,
- scoped_refptr<GpuState> gpu_state)
- : command_buffer_namespace_(command_buffer_namespace),
- command_buffer_id_(command_buffer_id),
- widget_(widget),
- client_(nullptr),
- gpu_state_(gpu_state),
- previous_processed_num_(0),
- weak_factory_(this) {
- DCHECK_EQ(base::ThreadTaskRunnerHandle::Get(),
- gpu_state_->command_buffer_task_runner()->task_runner());
-}
-
-CommandBufferDriver::~CommandBufferDriver() {
- DCHECK(CalledOnValidThread());
- DestroyDecoder();
-}
-
-bool CommandBufferDriver::Initialize(
- mojo::ScopedSharedBufferHandle shared_state,
- mojo::Array<int32_t> attribs) {
- DCHECK(CalledOnValidThread());
- gpu::gles2::ContextCreationAttribHelper attrib_helper;
- if (!attrib_helper.Parse(attribs.storage()))
- return false;
- // TODO(piman): attribs can't currently represent gpu_preference.
-
- const bool offscreen = widget_ == gfx::kNullAcceleratedWidget;
- if (offscreen) {
- surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size(0, 0));
- } else {
-#if defined(USE_OZONE)
- scoped_refptr<gl::GLSurface> underlying_surface =
- gl::init::CreateSurfacelessViewGLSurface(widget_);
- if (!underlying_surface)
- underlying_surface = gl::init::CreateViewGLSurface(widget_);
-#else
- scoped_refptr<gl::GLSurface> underlying_surface =
- gl::init::CreateViewGLSurface(widget_);
-#endif
- scoped_refptr<GLSurfaceAdapterMus> surface_adapter =
- new GLSurfaceAdapterMus(underlying_surface);
- surface_adapter->SetGpuCompletedSwapBuffersCallback(
- base::Bind(&CommandBufferDriver::OnGpuCompletedSwapBuffers,
- weak_factory_.GetWeakPtr()));
- surface_ = surface_adapter;
-
- gfx::VSyncProvider* vsync_provider =
- surface_ ? surface_->GetVSyncProvider() : nullptr;
- if (vsync_provider) {
- vsync_provider->GetVSyncParameters(
- base::Bind(&CommandBufferDriver::OnUpdateVSyncParameters,
- weak_factory_.GetWeakPtr()));
- }
- }
-
- if (!surface_.get())
- return false;
-
- // TODO(piman): virtual contexts.
- context_ = gl::init::CreateGLContext(
- gpu_state_->share_group(), surface_.get(), attrib_helper.gpu_preference);
- if (!context_.get())
- return false;
-
- if (!context_->MakeCurrent(surface_.get()))
- return false;
-
- // TODO(piman): ShaderTranslatorCache is currently per-ContextGroup but
- // only needs to be per-thread.
- const bool bind_generates_resource = attrib_helper.bind_generates_resource;
- scoped_refptr<gpu::gles2::FeatureInfo> feature_info =
- new gpu::gles2::FeatureInfo(gpu_state_->gpu_driver_bug_workarounds());
- // TODO(erikchen): The ContextGroup needs a reference to the
- // GpuMemoryBufferManager.
- scoped_refptr<gpu::gles2::ContextGroup> context_group =
- new gpu::gles2::ContextGroup(
- gpu_state_->gpu_preferences(), gpu_state_->mailbox_manager(),
- new GpuMemoryTracker,
- new gpu::gles2::ShaderTranslatorCache(gpu_state_->gpu_preferences()),
- new gpu::gles2::FramebufferCompletenessCache, feature_info,
- bind_generates_resource, nullptr);
-
- command_buffer_.reset(
- new gpu::CommandBufferService(context_group->transfer_buffer_manager()));
-
- decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group.get()));
- executor_.reset(new gpu::CommandExecutor(command_buffer_.get(),
- decoder_.get(), decoder_.get()));
- sync_point_order_data_ = gpu::SyncPointOrderData::Create();
- sync_point_client_ = gpu_state_->sync_point_manager()->CreateSyncPointClient(
- sync_point_order_data_, GetNamespaceID(), command_buffer_id_);
- decoder_->set_engine(executor_.get());
- decoder_->SetFenceSyncReleaseCallback(base::Bind(
- &CommandBufferDriver::OnFenceSyncRelease, base::Unretained(this)));
- decoder_->SetWaitFenceSyncCallback(base::Bind(
- &CommandBufferDriver::OnWaitFenceSync, base::Unretained(this)));
- decoder_->SetDescheduleUntilFinishedCallback(base::Bind(
- &CommandBufferDriver::OnDescheduleUntilFinished, base::Unretained(this)));
- decoder_->SetRescheduleAfterFinishedCallback(base::Bind(
- &CommandBufferDriver::OnRescheduleAfterFinished, base::Unretained(this)));
-
- gpu::gles2::DisallowedFeatures disallowed_features;
-
- if (!decoder_->Initialize(surface_, context_, offscreen, disallowed_features,
- attrib_helper))
- return false;
-
- command_buffer_->SetPutOffsetChangeCallback(base::Bind(
- &gpu::CommandExecutor::PutChanged, base::Unretained(executor_.get())));
- command_buffer_->SetGetBufferChangeCallback(base::Bind(
- &gpu::CommandExecutor::SetGetBuffer, base::Unretained(executor_.get())));
- command_buffer_->SetParseErrorCallback(
- base::Bind(&CommandBufferDriver::OnParseError, base::Unretained(this)));
-
- // TODO(piman): other callbacks
-
- const size_t kSize = sizeof(gpu::CommandBufferSharedState);
- std::unique_ptr<gpu::BufferBacking> backing(
- MojoBufferBacking::Create(std::move(shared_state), kSize));
- if (!backing)
- return false;
-
- command_buffer_->SetSharedStateBuffer(std::move(backing));
- gpu_state_->driver_manager()->AddDriver(this);
- return true;
-}
-
-void CommandBufferDriver::SetGetBuffer(int32_t buffer) {
- DCHECK(CalledOnValidThread());
- command_buffer_->SetGetBuffer(buffer);
-}
-
-void CommandBufferDriver::Flush(int32_t put_offset) {
- DCHECK(CalledOnValidThread());
- if (!MakeCurrent())
- return;
-
- command_buffer_->Flush(put_offset);
- ProcessPendingAndIdleWork();
-}
-
-void CommandBufferDriver::RegisterTransferBuffer(
- int32_t id,
- mojo::ScopedSharedBufferHandle transfer_buffer,
- uint32_t size) {
- DCHECK(CalledOnValidThread());
- // Take ownership of the memory and map it into this process.
- // This validates the size.
- std::unique_ptr<gpu::BufferBacking> backing(
- MojoBufferBacking::Create(std::move(transfer_buffer), size));
- if (!backing) {
- DVLOG(0) << "Failed to map shared memory.";
- return;
- }
- command_buffer_->RegisterTransferBuffer(id, std::move(backing));
-}
-
-void CommandBufferDriver::DestroyTransferBuffer(int32_t id) {
- DCHECK(CalledOnValidThread());
- command_buffer_->DestroyTransferBuffer(id);
-}
-
-void CommandBufferDriver::CreateImage(int32_t id,
- mojo::ScopedHandle memory_handle,
- int32_t type,
- const gfx::Size& size,
- int32_t format,
- int32_t internal_format) {
- DCHECK(CalledOnValidThread());
- if (!MakeCurrent())
- return;
-
- gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
- if (image_manager->LookupImage(id)) {
- LOG(ERROR) << "Image already exists with same ID.";
- return;
- }
-
- gfx::BufferFormat gpu_format = static_cast<gfx::BufferFormat>(format);
- if (!gpu::IsGpuMemoryBufferFormatSupported(gpu_format,
- decoder_->GetCapabilities())) {
- LOG(ERROR) << "Format is not supported.";
- return;
- }
-
- if (!gpu::IsImageSizeValidForGpuMemoryBufferFormat(size, gpu_format)) {
- LOG(ERROR) << "Invalid image size for format.";
- return;
- }
-
- if (!gpu::IsImageFormatCompatibleWithGpuMemoryBufferFormat(internal_format,
- gpu_format)) {
- LOG(ERROR) << "Incompatible image format.";
- return;
- }
-
- if (type != gfx::SHARED_MEMORY_BUFFER) {
- NOTIMPLEMENTED();
- return;
- }
-
- base::PlatformFile platform_file;
- MojoResult unwrap_result = mojo::UnwrapPlatformFile(std::move(memory_handle),
- &platform_file);
- if (unwrap_result != MOJO_RESULT_OK) {
- NOTREACHED();
- return;
- }
-
-#if defined(OS_WIN)
- base::SharedMemoryHandle handle(platform_file, base::GetCurrentProcId());
-#else
- base::FileDescriptor handle(platform_file, false);
-#endif
-
- scoped_refptr<gl::GLImageSharedMemory> image =
- new gl::GLImageSharedMemory(size, internal_format);
- // TODO(jam): also need a mojo enum for this enum
- if (!image->Initialize(
- handle, gfx::GpuMemoryBufferId(id), gpu_format, 0,
- gfx::RowSizeForBufferFormat(size.width(), gpu_format, 0))) {
- NOTREACHED();
- return;
- }
-
- image_manager->AddImage(image.get(), id);
-}
-
-// TODO(rjkroege): It is conceivable that this code belongs in
-// ozone_gpu_memory_buffer.cc
-void CommandBufferDriver::CreateImageNativeOzone(int32_t id,
- int32_t type,
- gfx::Size size,
- gfx::BufferFormat format,
- uint32_t internal_format,
- ui::NativePixmap* pixmap) {
-#if defined(USE_OZONE)
- gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
- if (image_manager->LookupImage(id)) {
- LOG(ERROR) << "Image already exists with same ID.";
- return;
- }
-
- scoped_refptr<gl::GLImageOzoneNativePixmap> image =
- new gl::GLImageOzoneNativePixmap(size, internal_format);
- if (!image->Initialize(pixmap, format)) {
- NOTREACHED();
- return;
- }
-
- image_manager->AddImage(image.get(), id);
-#endif
-}
-
-void CommandBufferDriver::DestroyImage(int32_t id) {
- DCHECK(CalledOnValidThread());
- gpu::gles2::ImageManager* image_manager = decoder_->GetImageManager();
- if (!image_manager->LookupImage(id)) {
- LOG(ERROR) << "Image with ID doesn't exist.";
- return;
- }
- if (!MakeCurrent())
- return;
- image_manager->RemoveImage(id);
-}
-
-bool CommandBufferDriver::IsScheduled() const {
- DCHECK(CalledOnValidThread());
- DCHECK(executor_);
- return executor_->scheduled();
-}
-
-bool CommandBufferDriver::HasUnprocessedCommands() const {
- DCHECK(CalledOnValidThread());
- if (command_buffer_) {
- gpu::CommandBuffer::State state = GetLastState();
- return command_buffer_->GetPutOffset() != state.get_offset &&
- !gpu::error::IsError(state.error);
- }
- return false;
-}
-
-gpu::Capabilities CommandBufferDriver::GetCapabilities() const {
- DCHECK(CalledOnValidThread());
- return decoder_->GetCapabilities();
-}
-
-gpu::CommandBuffer::State CommandBufferDriver::GetLastState() const {
- DCHECK(CalledOnValidThread());
- return command_buffer_->GetLastState();
-}
-
-uint32_t CommandBufferDriver::GetUnprocessedOrderNum() const {
- DCHECK(CalledOnValidThread());
- return sync_point_order_data_->unprocessed_order_num();
-}
-
-uint32_t CommandBufferDriver::GetProcessedOrderNum() const {
- DCHECK(CalledOnValidThread());
- return sync_point_order_data_->processed_order_num();
-}
-
-bool CommandBufferDriver::MakeCurrent() {
- DCHECK(CalledOnValidThread());
- if (!decoder_)
- return false;
- if (decoder_->MakeCurrent())
- return true;
- DLOG(ERROR) << "Context lost because MakeCurrent failed.";
- gpu::error::ContextLostReason reason =
- static_cast<gpu::error::ContextLostReason>(
- decoder_->GetContextLostReason());
- command_buffer_->SetContextLostReason(reason);
- command_buffer_->SetParseError(gpu::error::kLostContext);
- OnContextLost(reason);
- return false;
-}
-
-void CommandBufferDriver::ProcessPendingAndIdleWork() {
- DCHECK(CalledOnValidThread());
- executor_->ProcessPendingQueries();
- ScheduleDelayedWork(
- base::TimeDelta::FromMilliseconds(kHandleMoreWorkPeriodMs));
-}
-
-void CommandBufferDriver::ScheduleDelayedWork(base::TimeDelta delay) {
- DCHECK(CalledOnValidThread());
- const bool has_more_work =
- executor_->HasPendingQueries() || executor_->HasMoreIdleWork();
- if (!has_more_work) {
- last_idle_time_ = base::TimeTicks();
- return;
- }
-
- const base::TimeTicks current_time = base::TimeTicks::Now();
- // |process_delayed_work_time_| is set if processing of delayed work is
- // already scheduled. Just update the time if already scheduled.
- if (!process_delayed_work_time_.is_null()) {
- process_delayed_work_time_ = current_time + delay;
- return;
- }
-
- // Idle when no messages are processed between now and when PollWork is
- // called.
- previous_processed_num_ =
- gpu_state_->driver_manager()->GetProcessedOrderNum();
-
- if (last_idle_time_.is_null())
- last_idle_time_ = current_time;
-
- // scheduled() returns true after passing all unschedule fences and this is
- // when we can start performing idle work. Idle work is done synchronously
- // so we can set delay to 0 and instead poll for more work at the rate idle
- // work is performed. This also ensures that idle work is done as
- // efficiently as possible without any unnecessary delays.
- if (executor_->scheduled() && executor_->HasMoreIdleWork())
- delay = base::TimeDelta();
-
- process_delayed_work_time_ = current_time + delay;
- gpu_state_->command_buffer_task_runner()->task_runner()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&CommandBufferDriver::PollWork, weak_factory_.GetWeakPtr()),
- delay);
-}
-
-void CommandBufferDriver::PollWork() {
- DCHECK(CalledOnValidThread());
- // Post another delayed task if we have not yet reached the time at which
- // we should process delayed work.
- base::TimeTicks current_time = base::TimeTicks::Now();
- DCHECK(!process_delayed_work_time_.is_null());
- if (process_delayed_work_time_ > current_time) {
- gpu_state_->command_buffer_task_runner()->task_runner()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&CommandBufferDriver::PollWork, weak_factory_.GetWeakPtr()),
- process_delayed_work_time_ - current_time);
- return;
- }
- process_delayed_work_time_ = base::TimeTicks();
- PerformWork();
-}
-
-void CommandBufferDriver::PerformWork() {
- DCHECK(CalledOnValidThread());
- if (!MakeCurrent())
- return;
-
- if (executor_) {
- const uint32_t current_unprocessed_num =
- gpu_state_->driver_manager()->GetUnprocessedOrderNum();
- // We're idle when no messages were processed or scheduled.
- bool is_idle = (previous_processed_num_ == current_unprocessed_num);
- if (!is_idle && !last_idle_time_.is_null()) {
- base::TimeDelta time_since_idle =
- base::TimeTicks::Now() - last_idle_time_;
- base::TimeDelta max_time_since_idle =
- base::TimeDelta::FromMilliseconds(kMaxTimeSinceIdleMs);
- // Force idle when it's been too long since last time we were idle.
- if (time_since_idle > max_time_since_idle)
- is_idle = true;
- }
-
- if (is_idle) {
- last_idle_time_ = base::TimeTicks::Now();
- executor_->PerformIdleWork();
- }
- executor_->ProcessPendingQueries();
- }
-
- ScheduleDelayedWork(
- base::TimeDelta::FromMilliseconds(kHandleMoreWorkPeriodBusyMs));
-}
-
-void CommandBufferDriver::DestroyDecoder() {
- DCHECK(CalledOnValidThread());
- if (decoder_) {
- gpu_state_->driver_manager()->RemoveDriver(this);
- bool have_context = decoder_->MakeCurrent();
- decoder_->Destroy(have_context);
- decoder_.reset();
- }
-}
-
-void CommandBufferDriver::OnUpdateVSyncParameters(
- const base::TimeTicks timebase,
- const base::TimeDelta interval) {
- DCHECK(CalledOnValidThread());
- if (client_)
- client_->UpdateVSyncParameters(timebase, interval);
-}
-
-void CommandBufferDriver::OnFenceSyncRelease(uint64_t release) {
- DCHECK(CalledOnValidThread());
- if (!sync_point_client_->client_state()->IsFenceSyncReleased(release))
- sync_point_client_->ReleaseFenceSync(release);
-}
-
-bool CommandBufferDriver::OnWaitFenceSync(
- gpu::CommandBufferNamespace namespace_id,
- gpu::CommandBufferId command_buffer_id,
- uint64_t release) {
- DCHECK(CalledOnValidThread());
- DCHECK(IsScheduled());
- gpu::SyncPointManager* sync_point_manager = gpu_state_->sync_point_manager();
- DCHECK(sync_point_manager);
-
- scoped_refptr<gpu::SyncPointClientState> release_state =
- sync_point_manager->GetSyncPointClientState(namespace_id,
- command_buffer_id);
-
- if (!release_state)
- return true;
-
- executor_->SetScheduled(false);
- sync_point_client_->Wait(release_state.get(), release,
- base::Bind(&gpu::CommandExecutor::SetScheduled,
- executor_->AsWeakPtr(), true));
- return executor_->scheduled();
-}
-
-void CommandBufferDriver::OnDescheduleUntilFinished() {
- DCHECK(CalledOnValidThread());
- DCHECK(IsScheduled());
- DCHECK(executor_->HasMoreIdleWork());
-
- executor_->SetScheduled(false);
-}
-
-void CommandBufferDriver::OnRescheduleAfterFinished() {
- DCHECK(CalledOnValidThread());
- DCHECK(!executor_->scheduled());
-
- executor_->SetScheduled(true);
-}
-
-void CommandBufferDriver::OnParseError() {
- DCHECK(CalledOnValidThread());
- gpu::CommandBuffer::State state = GetLastState();
- OnContextLost(state.context_lost_reason);
-}
-
-void CommandBufferDriver::OnContextLost(uint32_t reason) {
- DCHECK(CalledOnValidThread());
- if (client_)
- client_->DidLoseContext(reason);
-}
-
-void CommandBufferDriver::SignalQuery(uint32_t query_id,
- const base::Closure& callback) {
- DCHECK(CalledOnValidThread());
-
- gpu::gles2::QueryManager* query_manager = decoder_->GetQueryManager();
- gpu::gles2::QueryManager::Query* query = query_manager->GetQuery(query_id);
- if (query)
- query->AddCallback(callback);
- else
- callback.Run();
-}
-
-void CommandBufferDriver::OnGpuCompletedSwapBuffers(gfx::SwapResult result) {
- DCHECK(CalledOnValidThread());
- if (client_) {
- client_->OnGpuCompletedSwapBuffers(result);
- }
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/gles2/command_buffer_driver.h b/chromium/components/mus/gles2/command_buffer_driver.h
deleted file mode 100644
index bb08ee255fe..00000000000
--- a/chromium/components/mus/gles2/command_buffer_driver.h
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GLES2_COMMAND_BUFFER_DRIVER_H_
-#define COMPONENTS_MUS_GLES2_COMMAND_BUFFER_DRIVER_H_
-
-#include <stdint.h>
-
-#include <memory>
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "base/single_thread_task_runner.h"
-#include "base/threading/non_thread_safe.h"
-#include "base/time/time.h"
-#include "gpu/command_buffer/common/capabilities.h"
-#include "gpu/command_buffer/common/command_buffer.h"
-#include "gpu/command_buffer/common/command_buffer_id.h"
-#include "gpu/command_buffer/common/constants.h"
-#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/public/cpp/system/buffer.h"
-#include "ui/gfx/buffer_types.h"
-#include "ui/gfx/geometry/mojo/geometry.mojom.h"
-#include "ui/gfx/geometry/size.h"
-#include "ui/gfx/native_widget_types.h"
-#include "ui/gfx/swap_result.h"
-
-namespace gl {
-class GLContext;
-class GLSurface;
-}
-
-namespace gpu {
-class CommandBufferService;
-class CommandExecutor;
-class SyncPointClient;
-class SyncPointOrderData;
-
-namespace gles2 {
-class GLES2Decoder;
-} // namespace gles2
-
-} // namespace gpu
-
-namespace ui {
-class NativePixmap;
-}
-
-namespace mus {
-
-class GpuState;
-
-// This class receives CommandBuffer messages on the same thread as the native
-// viewport.
-class CommandBufferDriver : base::NonThreadSafe {
- public:
- class Client {
- public:
- virtual ~Client();
- virtual void DidLoseContext(uint32_t reason) = 0;
- virtual void UpdateVSyncParameters(const base::TimeTicks& timebase,
- const base::TimeDelta& interval) = 0;
- virtual void OnGpuCompletedSwapBuffers(gfx::SwapResult result) = 0;
- };
- CommandBufferDriver(gpu::CommandBufferNamespace command_buffer_namespace,
- gpu::CommandBufferId command_buffer_id,
- gfx::AcceleratedWidget widget,
- scoped_refptr<GpuState> gpu_state);
- ~CommandBufferDriver();
-
- // The class owning the CommandBufferDriver instance (e.g. CommandBufferLocal)
- // is itself the Client implementation so CommandBufferDriver does not own the
- // client.
- void set_client(Client* client) { client_ = client; }
-
- bool Initialize(mojo::ScopedSharedBufferHandle shared_state,
- mojo::Array<int32_t> attribs);
- void SetGetBuffer(int32_t buffer);
- void Flush(int32_t put_offset);
- void RegisterTransferBuffer(int32_t id,
- mojo::ScopedSharedBufferHandle transfer_buffer,
- uint32_t size);
- void DestroyTransferBuffer(int32_t id);
- void CreateImage(int32_t id,
- mojo::ScopedHandle memory_handle,
- int32_t type,
- const gfx::Size& size,
- int32_t format,
- int32_t internal_format);
- void CreateImageNativeOzone(int32_t id,
- int32_t type,
- gfx::Size size,
- gfx::BufferFormat format,
- uint32_t internal_format,
- ui::NativePixmap* pixmap);
- void DestroyImage(int32_t id);
- bool IsScheduled() const;
- bool HasUnprocessedCommands() const;
- gpu::Capabilities GetCapabilities() const;
- gpu::CommandBuffer::State GetLastState() const;
- gpu::CommandBufferNamespace GetNamespaceID() const {
- return command_buffer_namespace_;
- }
- gpu::CommandBufferId GetCommandBufferID() const { return command_buffer_id_; }
- gpu::SyncPointOrderData* sync_point_order_data() {
- return sync_point_order_data_.get();
- }
- uint32_t GetUnprocessedOrderNum() const;
- uint32_t GetProcessedOrderNum() const;
- void SignalQuery(uint32_t query_id, const base::Closure& callback);
-
- private:
- bool MakeCurrent();
-
- // Process pending queries and call |ScheduleDelayedWork| to schedule
- // processing of delayed work.
- void ProcessPendingAndIdleWork();
-
- // Schedule processing of delayed work. This updates the time at which
- // delayed work should be processed. |process_delayed_work_time_| is
- // updated to current time + delay. Call this after processing some amount
- // of delayed work.
- void ScheduleDelayedWork(base::TimeDelta delay);
-
- // Poll the command buffer to execute work.
- void PollWork();
- void PerformWork();
-
- void DestroyDecoder();
-
- // Callbacks:
- void OnUpdateVSyncParameters(const base::TimeTicks timebase,
- const base::TimeDelta interval);
- void OnFenceSyncRelease(uint64_t release);
- bool OnWaitFenceSync(gpu::CommandBufferNamespace namespace_id,
- gpu::CommandBufferId command_buffer_id,
- uint64_t release);
- void OnDescheduleUntilFinished();
- void OnRescheduleAfterFinished();
- void OnParseError();
- void OnContextLost(uint32_t reason);
- void OnGpuCompletedSwapBuffers(gfx::SwapResult result);
-
- const gpu::CommandBufferNamespace command_buffer_namespace_;
- const gpu::CommandBufferId command_buffer_id_;
- gfx::AcceleratedWidget widget_;
- Client* client_; // NOT OWNED.
- std::unique_ptr<gpu::CommandBufferService> command_buffer_;
- std::unique_ptr<gpu::gles2::GLES2Decoder> decoder_;
- std::unique_ptr<gpu::CommandExecutor> executor_;
- scoped_refptr<gpu::SyncPointOrderData> sync_point_order_data_;
- std::unique_ptr<gpu::SyncPointClient> sync_point_client_;
- scoped_refptr<gl::GLContext> context_;
- scoped_refptr<gl::GLSurface> surface_;
- scoped_refptr<GpuState> gpu_state_;
-
- scoped_refptr<base::SingleThreadTaskRunner> context_lost_task_runner_;
- base::Callback<void(int32_t)> context_lost_callback_;
-
- base::TimeTicks process_delayed_work_time_;
- uint32_t previous_processed_num_;
- base::TimeTicks last_idle_time_;
-
- base::WeakPtrFactory<CommandBufferDriver> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(CommandBufferDriver);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_H_
diff --git a/chromium/components/mus/gles2/command_buffer_driver_manager.cc b/chromium/components/mus/gles2/command_buffer_driver_manager.cc
deleted file mode 100644
index c8ff3b95a2f..00000000000
--- a/chromium/components/mus/gles2/command_buffer_driver_manager.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gles2/command_buffer_driver_manager.h"
-
-#include <algorithm>
-
-#include "components/mus/gles2/command_buffer_driver.h"
-
-namespace mus {
-
-CommandBufferDriverManager::CommandBufferDriverManager() {}
-
-CommandBufferDriverManager::~CommandBufferDriverManager() {}
-
-void CommandBufferDriverManager::AddDriver(CommandBufferDriver* driver) {
- DCHECK(CalledOnValidThread());
- DCHECK(std::find(drivers_.begin(), drivers_.end(), driver) == drivers_.end());
- drivers_.push_back(driver);
-}
-
-void CommandBufferDriverManager::RemoveDriver(CommandBufferDriver* driver) {
- DCHECK(CalledOnValidThread());
- auto it = std::find(drivers_.begin(), drivers_.end(), driver);
- DCHECK(it != drivers_.end());
- drivers_.erase(it);
-}
-
-uint32_t CommandBufferDriverManager::GetUnprocessedOrderNum() const {
- DCHECK(CalledOnValidThread());
- uint32_t unprocessed_order_num = 0;
- for (auto& d : drivers_) {
- unprocessed_order_num =
- std::max(unprocessed_order_num, d->GetUnprocessedOrderNum());
- }
- return unprocessed_order_num;
-}
-
-uint32_t CommandBufferDriverManager::GetProcessedOrderNum() const {
- DCHECK(CalledOnValidThread());
- uint32_t processed_order_num = 0;
- for (auto& d : drivers_) {
- processed_order_num =
- std::max(processed_order_num, d->GetProcessedOrderNum());
- }
- return processed_order_num;
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/gles2/command_buffer_driver_manager.h b/chromium/components/mus/gles2/command_buffer_driver_manager.h
deleted file mode 100644
index b2f8e7c0900..00000000000
--- a/chromium/components/mus/gles2/command_buffer_driver_manager.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GLES2_COMMAND_BUFFER_DRIVER_MANAGER_H_
-#define COMPONENTS_MUS_GLES2_COMMAND_BUFFER_DRIVER_MANAGER_H_
-
-#include <stdint.h>
-#include <vector>
-
-#include "base/macros.h"
-#include "base/threading/non_thread_safe.h"
-
-namespace mus {
-
-class CommandBufferDriver;
-
-// This class manages all initialized |CommandBufferDriver|s.
-class CommandBufferDriverManager : base::NonThreadSafe {
- public:
- CommandBufferDriverManager();
- ~CommandBufferDriverManager();
-
- // Add a new initialized driver to the manager.
- void AddDriver(CommandBufferDriver* driver);
-
- // Remove a driver from the manager.
- void RemoveDriver(CommandBufferDriver* driver);
-
- // Return the global order number for the last unprocessed flush
- // (|CommandBufferDriver::Flush|).
- uint32_t GetUnprocessedOrderNum() const;
-
- // Return the global order number for the last processed flush
- // (|CommandBufferDriver::Flush|).
- uint32_t GetProcessedOrderNum() const;
-
- private:
- std::vector<CommandBufferDriver*> drivers_;
-
- DISALLOW_COPY_AND_ASSIGN(CommandBufferDriverManager);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_GLES2_COMMAND_BUFFER_DRIVER_MANAGER_H_
diff --git a/chromium/components/mus/gles2/command_buffer_impl.cc b/chromium/components/mus/gles2/command_buffer_impl.cc
deleted file mode 100644
index 70de3c2aab6..00000000000
--- a/chromium/components/mus/gles2/command_buffer_impl.cc
+++ /dev/null
@@ -1,301 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gles2/command_buffer_impl.h"
-
-#include "base/bind.h"
-#include "base/macros.h"
-#include "base/message_loop/message_loop.h"
-#include "components/mus/common/gpu_type_converters.h"
-#include "components/mus/gles2/command_buffer_driver.h"
-#include "components/mus/gles2/gpu_state.h"
-#include "gpu/command_buffer/service/sync_point_manager.h"
-
-namespace mus {
-
-namespace {
-
-uint64_t g_next_command_buffer_id = 0;
-
-void RunInitializeCallback(
- const mojom::CommandBuffer::InitializeCallback& callback,
- mojom::CommandBufferInitializeResultPtr result) {
- callback.Run(std::move(result));
-}
-
-void RunMakeProgressCallback(
- const mojom::CommandBuffer::MakeProgressCallback& callback,
- const gpu::CommandBuffer::State& state) {
- callback.Run(state);
-}
-
-} // namespace
-
-CommandBufferImpl::CommandBufferImpl(
- mojo::InterfaceRequest<mus::mojom::CommandBuffer> request,
- scoped_refptr<GpuState> gpu_state)
- : gpu_state_(gpu_state) {
- // Bind |CommandBufferImpl| to the |request| in the GPU control thread.
- gpu_state_->control_task_runner()->PostTask(
- FROM_HERE,
- base::Bind(&CommandBufferImpl::BindToRequest,
- base::Unretained(this), base::Passed(&request)));
-}
-
-void CommandBufferImpl::DidLoseContext(uint32_t reason) {
- driver_->set_client(nullptr);
- client_->Destroyed(reason, gpu::error::kLostContext);
-}
-
-void CommandBufferImpl::UpdateVSyncParameters(const base::TimeTicks& timebase,
- const base::TimeDelta& interval) {
-}
-
-void CommandBufferImpl::OnGpuCompletedSwapBuffers(gfx::SwapResult result) {}
-
-CommandBufferImpl::~CommandBufferImpl() {
-}
-
-void CommandBufferImpl::Initialize(
- mus::mojom::CommandBufferClientPtr client,
- mojo::ScopedSharedBufferHandle shared_state,
- mojo::Array<int32_t> attribs,
- const mojom::CommandBuffer::InitializeCallback& callback) {
- gpu_state_->command_buffer_task_runner()->task_runner()->PostTask(
- FROM_HERE,
- base::Bind(&CommandBufferImpl::InitializeOnGpuThread,
- base::Unretained(this), base::Passed(&client),
- base::Passed(&shared_state), base::Passed(&attribs),
- base::Bind(&RunInitializeCallback, callback)));
-}
-
-void CommandBufferImpl::SetGetBuffer(int32_t buffer) {
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(), base::Bind(&CommandBufferImpl::SetGetBufferOnGpuThread,
- base::Unretained(this), buffer));
-}
-
-void CommandBufferImpl::Flush(int32_t put_offset) {
- gpu::SyncPointManager* sync_point_manager = gpu_state_->sync_point_manager();
- const uint32_t order_num = driver_->sync_point_order_data()
- ->GenerateUnprocessedOrderNumber(sync_point_manager);
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(), base::Bind(&CommandBufferImpl::FlushOnGpuThread,
- base::Unretained(this), put_offset, order_num));
-}
-
-void CommandBufferImpl::MakeProgress(
- int32_t last_get_offset,
- const mojom::CommandBuffer::MakeProgressCallback& callback) {
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(), base::Bind(&CommandBufferImpl::MakeProgressOnGpuThread,
- base::Unretained(this), last_get_offset,
- base::Bind(&RunMakeProgressCallback,
- callback)));
-}
-
-void CommandBufferImpl::RegisterTransferBuffer(
- int32_t id,
- mojo::ScopedSharedBufferHandle transfer_buffer,
- uint32_t size) {
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(),
- base::Bind(&CommandBufferImpl::RegisterTransferBufferOnGpuThread,
- base::Unretained(this), id, base::Passed(&transfer_buffer),
- size));
-}
-
-void CommandBufferImpl::DestroyTransferBuffer(int32_t id) {
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(),
- base::Bind(&CommandBufferImpl::DestroyTransferBufferOnGpuThread,
- base::Unretained(this), id));
-}
-
-void CommandBufferImpl::CreateImage(int32_t id,
- mojo::ScopedHandle memory_handle,
- int32_t type,
- const gfx::Size& size,
- int32_t format,
- int32_t internal_format) {
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(),
- base::Bind(&CommandBufferImpl::CreateImageOnGpuThread,
- base::Unretained(this), id, base::Passed(&memory_handle), type,
- size, format, internal_format));
-}
-
-void CommandBufferImpl::DestroyImage(int32_t id) {
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(), base::Bind(&CommandBufferImpl::DestroyImageOnGpuThread,
- base::Unretained(this), id));
-}
-
-void CommandBufferImpl::CreateStreamTexture(
- uint32_t client_texture_id,
- const mojom::CommandBuffer::CreateStreamTextureCallback& callback) {
- NOTIMPLEMENTED();
-}
-
-void CommandBufferImpl::TakeFrontBuffer(const gpu::Mailbox& mailbox) {
- NOTIMPLEMENTED();
-}
-
-void CommandBufferImpl::ReturnFrontBuffer(const gpu::Mailbox& mailbox,
- bool is_lost) {
- NOTIMPLEMENTED();
-}
-
-void CommandBufferImpl::SignalQuery(uint32_t query, uint32_t signal_id) {
- NOTIMPLEMENTED();
-}
-
-void CommandBufferImpl::SignalSyncToken(const gpu::SyncToken& sync_token,
- uint32_t signal_id) {
- NOTIMPLEMENTED();
-}
-
-void CommandBufferImpl::WaitForGetOffsetInRange(
- int32_t start, int32_t end,
- const mojom::CommandBuffer::WaitForGetOffsetInRangeCallback& callback) {
- NOTIMPLEMENTED();
-}
-
-void CommandBufferImpl::WaitForTokenInRange(
- int32_t start, int32_t end,
- const mojom::CommandBuffer::WaitForGetOffsetInRangeCallback& callback) {
- NOTIMPLEMENTED();
-}
-
-void CommandBufferImpl::BindToRequest(
- mojo::InterfaceRequest<mus::mojom::CommandBuffer> request) {
- binding_.reset(
- new mojo::Binding<mus::mojom::CommandBuffer>(this, std::move(request)));
- binding_->set_connection_error_handler(
- base::Bind(&CommandBufferImpl::OnConnectionError,
- base::Unretained(this)));
-}
-
-void CommandBufferImpl::InitializeOnGpuThread(
- mojom::CommandBufferClientPtr client,
- mojo::ScopedSharedBufferHandle shared_state,
- mojo::Array<int32_t> attribs,
- const base::Callback<
- void(mojom::CommandBufferInitializeResultPtr)>& callback) {
- DCHECK(!driver_);
- driver_.reset(new CommandBufferDriver(
- gpu::CommandBufferNamespace::MOJO,
- gpu::CommandBufferId::FromUnsafeValue(++g_next_command_buffer_id),
- gfx::kNullAcceleratedWidget, gpu_state_));
- driver_->set_client(this);
- client_ = mojo::MakeProxy(client.PassInterface());
- bool result =
- driver_->Initialize(std::move(shared_state), std::move(attribs));
- mojom::CommandBufferInitializeResultPtr initialize_result;
- if (result) {
- initialize_result = mojom::CommandBufferInitializeResult::New();
- initialize_result->command_buffer_namespace = driver_->GetNamespaceID();
- initialize_result->command_buffer_id =
- driver_->GetCommandBufferID().GetUnsafeValue();
- initialize_result->capabilities = driver_->GetCapabilities();
- }
- gpu_state_->control_task_runner()->PostTask(
- FROM_HERE, base::Bind(callback, base::Passed(&initialize_result)));
-}
-
-bool CommandBufferImpl::SetGetBufferOnGpuThread(int32_t buffer) {
- DCHECK(driver_->IsScheduled());
- driver_->SetGetBuffer(buffer);
- return true;
-}
-
-bool CommandBufferImpl::FlushOnGpuThread(int32_t put_offset,
- uint32_t order_num) {
- DCHECK(driver_->IsScheduled());
- driver_->sync_point_order_data()->BeginProcessingOrderNumber(order_num);
- driver_->Flush(put_offset);
-
- // Return false if the Flush is not finished, so the CommandBufferTaskRunner
- // will not remove this task from the task queue.
- const bool complete = !driver_->HasUnprocessedCommands();
- if (!complete)
- driver_->sync_point_order_data()->PauseProcessingOrderNumber(order_num);
- else
- driver_->sync_point_order_data()->FinishProcessingOrderNumber(order_num);
- return complete;
-}
-
-bool CommandBufferImpl::MakeProgressOnGpuThread(
- int32_t last_get_offset,
- const base::Callback<void(const gpu::CommandBuffer::State&)>& callback) {
- DCHECK(driver_->IsScheduled());
- gpu_state_->control_task_runner()->PostTask(
- FROM_HERE, base::Bind(callback, driver_->GetLastState()));
- return true;
-}
-
-bool CommandBufferImpl::RegisterTransferBufferOnGpuThread(
- int32_t id,
- mojo::ScopedSharedBufferHandle transfer_buffer,
- uint32_t size) {
- DCHECK(driver_->IsScheduled());
- driver_->RegisterTransferBuffer(id, std::move(transfer_buffer), size);
- return true;
-}
-
-bool CommandBufferImpl::DestroyTransferBufferOnGpuThread(int32_t id) {
- DCHECK(driver_->IsScheduled());
- driver_->DestroyTransferBuffer(id);
- return true;
-}
-
-bool CommandBufferImpl::CreateImageOnGpuThread(int32_t id,
- mojo::ScopedHandle memory_handle,
- int32_t type,
- const gfx::Size& size,
- int32_t format,
- int32_t internal_format) {
- DCHECK(driver_->IsScheduled());
- driver_->CreateImage(id, std::move(memory_handle), type, std::move(size),
- format, internal_format);
- return true;
-}
-
-bool CommandBufferImpl::DestroyImageOnGpuThread(int32_t id) {
- DCHECK(driver_->IsScheduled());
- driver_->DestroyImage(id);
- return true;
-}
-
-void CommandBufferImpl::OnConnectionError() {
- // OnConnectionError() is called on the control thread |control_task_runner|.
-
- // Before deleting, we need to delete |binding_| because it is bound to the
- // current thread (|control_task_runner|).
- binding_.reset();
-
- // Objects we own (such as CommandBufferDriver) need to be destroyed on the
- // thread we were created on. It's entirely possible we haven't or are in the
- // process of creating |driver_|.
- if (driver_) {
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(), base::Bind(&CommandBufferImpl::DeleteOnGpuThread,
- base::Unretained(this)));
- } else {
- gpu_state_->command_buffer_task_runner()->task_runner()->PostTask(
- FROM_HERE, base::Bind(&CommandBufferImpl::DeleteOnGpuThread2,
- base::Unretained(this)));
- }
-}
-
-bool CommandBufferImpl::DeleteOnGpuThread() {
- delete this;
- return true;
-}
-
-void CommandBufferImpl::DeleteOnGpuThread2() {
- delete this;
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/gles2/command_buffer_impl.h b/chromium/components/mus/gles2/command_buffer_impl.h
deleted file mode 100644
index a37f2d1ec43..00000000000
--- a/chromium/components/mus/gles2/command_buffer_impl.h
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GLES2_COMMAND_BUFFER_IMPL_H_
-#define COMPONENTS_MUS_GLES2_COMMAND_BUFFER_IMPL_H_
-
-#include <stdint.h>
-
-#include <memory>
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "base/single_thread_task_runner.h"
-#include "components/mus/gles2/command_buffer_driver.h"
-#include "components/mus/public/interfaces/command_buffer.mojom.h"
-#include "gpu/command_buffer/common/command_buffer.h"
-#include "mojo/public/cpp/bindings/binding.h"
-
-namespace mus {
-
-class CommandBufferDriver;
-class GpuState;
-
-// This class listens to the CommandBuffer message pipe on a low-latency thread
-// so that we can insert sync points without blocking on the GL driver. It
-// forwards most method calls to the CommandBufferDriver, which runs on the
-// same thread as the native viewport.
-class CommandBufferImpl : public mojom::CommandBuffer,
- public CommandBufferDriver::Client {
- public:
- CommandBufferImpl(mojo::InterfaceRequest<CommandBuffer> request,
- scoped_refptr<GpuState> gpu_state);
-
- private:
- class CommandBufferDriverClientImpl;
- ~CommandBufferImpl() override;
-
- // CommandBufferDriver::Client. All called on the GPU thread.
- void DidLoseContext(uint32_t reason) override;
- void UpdateVSyncParameters(const base::TimeTicks& timebase,
- const base::TimeDelta& interval) override;
- void OnGpuCompletedSwapBuffers(gfx::SwapResult result) override;
-
- // mojom::CommandBuffer:
- void Initialize(
- mojom::CommandBufferClientPtr client,
- mojo::ScopedSharedBufferHandle shared_state,
- mojo::Array<int32_t> attribs,
- const mojom::CommandBuffer::InitializeCallback& callback) override;
- void SetGetBuffer(int32_t buffer) override;
- void Flush(int32_t put_offset) override;
- void MakeProgress(
- int32_t last_get_offset,
- const mojom::CommandBuffer::MakeProgressCallback& callback) override;
- void RegisterTransferBuffer(int32_t id,
- mojo::ScopedSharedBufferHandle transfer_buffer,
- uint32_t size) override;
- void DestroyTransferBuffer(int32_t id) override;
- void CreateImage(int32_t id,
- mojo::ScopedHandle memory_handle,
- int32_t type,
- const gfx::Size& size,
- int32_t format,
- int32_t internal_format) override;
- void DestroyImage(int32_t id) override;
- void CreateStreamTexture(
- uint32_t client_texture_id,
- const mojom::CommandBuffer::CreateStreamTextureCallback& callback
- ) override;
- void TakeFrontBuffer(const gpu::Mailbox& mailbox) override;
- void ReturnFrontBuffer(const gpu::Mailbox& mailbox, bool is_lost) override;
- void SignalQuery(uint32_t query, uint32_t signal_id) override;
- void SignalSyncToken(const gpu::SyncToken& sync_token,
- uint32_t signal_id) override;
- void WaitForGetOffsetInRange(
- int32_t start, int32_t end,
- const mojom::CommandBuffer::WaitForGetOffsetInRangeCallback& callback
- ) override;
- void WaitForTokenInRange(
- int32_t start, int32_t end,
- const mojom::CommandBuffer::WaitForGetOffsetInRangeCallback& callback
- ) override;
-
- // All helper functions are called in the GPU therad.
- void InitializeOnGpuThread(
- mojom::CommandBufferClientPtr client,
- mojo::ScopedSharedBufferHandle shared_state,
- mojo::Array<int32_t> attribs,
- const base::Callback<
- void(mojom::CommandBufferInitializeResultPtr)>& callback);
- bool SetGetBufferOnGpuThread(int32_t buffer);
- bool FlushOnGpuThread(int32_t put_offset, uint32_t order_num);
- bool MakeProgressOnGpuThread(
- int32_t last_get_offset,
- const base::Callback<void(const gpu::CommandBuffer::State&)>& callback);
- bool RegisterTransferBufferOnGpuThread(
- int32_t id,
- mojo::ScopedSharedBufferHandle transfer_buffer,
- uint32_t size);
- bool DestroyTransferBufferOnGpuThread(int32_t id);
- bool CreateImageOnGpuThread(int32_t id,
- mojo::ScopedHandle memory_handle,
- int32_t type,
- const gfx::Size& size,
- int32_t format,
- int32_t internal_format);
- bool DestroyImageOnGpuThread(int32_t id);
-
- void BindToRequest(mojo::InterfaceRequest<CommandBuffer> request);
-
- void OnConnectionError();
- bool DeleteOnGpuThread();
- void DeleteOnGpuThread2();
-
- scoped_refptr<GpuState> gpu_state_;
- std::unique_ptr<CommandBufferDriver> driver_;
- std::unique_ptr<mojo::Binding<CommandBuffer>> binding_;
- mojom::CommandBufferClientPtr client_;
-
- DISALLOW_COPY_AND_ASSIGN(CommandBufferImpl);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GLES2_COMMAND_BUFFER_IMPL_H_
diff --git a/chromium/components/mus/gles2/command_buffer_local.cc b/chromium/components/mus/gles2/command_buffer_local.cc
deleted file mode 100644
index 434fb551525..00000000000
--- a/chromium/components/mus/gles2/command_buffer_local.cc
+++ /dev/null
@@ -1,576 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gles2/command_buffer_local.h"
-
-#include "base/atomic_sequence_num.h"
-#include "base/bind.h"
-#include "base/memory/shared_memory.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "components/mus/common/gpu_type_converters.h"
-#include "components/mus/common/mojo_buffer_backing.h"
-#include "components/mus/common/mojo_gpu_memory_buffer.h"
-#include "components/mus/gles2/command_buffer_driver.h"
-#include "components/mus/gles2/command_buffer_local_client.h"
-#include "components/mus/gles2/gpu_memory_tracker.h"
-#include "components/mus/gles2/gpu_state.h"
-#include "gpu/command_buffer/client/gpu_control_client.h"
-#include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
-#include "gpu/command_buffer/common/sync_token.h"
-#include "gpu/command_buffer/service/command_buffer_service.h"
-#include "gpu/command_buffer/service/context_group.h"
-#include "gpu/command_buffer/service/image_manager.h"
-#include "gpu/command_buffer/service/memory_tracking.h"
-#include "gpu/command_buffer/service/shader_translator_cache.h"
-#include "gpu/command_buffer/service/transfer_buffer_manager.h"
-#include "mojo/public/cpp/system/platform_handle.h"
-#include "ui/gfx/buffer_format_util.h"
-#include "ui/gfx/vsync_provider.h"
-#include "ui/gl/gl_context.h"
-#include "ui/gl/gl_image_shared_memory.h"
-#include "ui/gl/gl_surface.h"
-
-namespace mus {
-
-namespace {
-
-uint64_t g_next_command_buffer_id = 0;
-
-bool CreateAndMapSharedBuffer(size_t size,
- mojo::ScopedSharedBufferMapping* mapping,
- mojo::ScopedSharedBufferHandle* handle) {
- *handle = mojo::SharedBufferHandle::Create(size);
- if (!handle->is_valid())
- return false;
-
- *mapping = (*handle)->Map(size);
- if (!*mapping)
- return false;
-
- return true;
-}
-
-void PostTask(const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
- const base::Closure& callback) {
- task_runner->PostTask(FROM_HERE, callback);
-}
-}
-
-const unsigned int GL_READ_WRITE_CHROMIUM = 0x78F2;
-
-CommandBufferLocal::CommandBufferLocal(CommandBufferLocalClient* client,
- gfx::AcceleratedWidget widget,
- const scoped_refptr<GpuState>& gpu_state)
- : widget_(widget),
- gpu_state_(gpu_state),
- client_(client),
- client_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
- gpu_control_client_(nullptr),
- next_transfer_buffer_id_(0),
- next_image_id_(0),
- next_fence_sync_release_(1),
- flushed_fence_sync_release_(0),
- lost_context_(false),
- sync_point_client_waiter_(
- gpu_state->sync_point_manager()->CreateSyncPointClientWaiter()),
- weak_factory_(this) {
- weak_ptr_ = weak_factory_.GetWeakPtr();
-}
-
-void CommandBufferLocal::Destroy() {
- DCHECK(CalledOnValidThread());
- // After this |Destroy()| call, this object will not be used by client anymore
- // and it will be deleted on the GPU thread. So we have to detach it from the
- // client thread first.
- DetachFromThread();
-
- weak_factory_.InvalidateWeakPtrs();
- // CommandBufferLocal is initialized on the GPU thread with
- // InitializeOnGpuThread(), so we need delete memebers on the GPU thread
- // too. Additionally we need to make sure we are deleted before returning,
- // otherwise we may attempt to use the AcceleratedWidget which has since been
- // destroyed.
- base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL,
- base::WaitableEvent::InitialState::NOT_SIGNALED);
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(), base::Bind(&CommandBufferLocal::DeleteOnGpuThread,
- base::Unretained(this), &event));
- event.Wait();
-}
-
-bool CommandBufferLocal::Initialize() {
- DCHECK(CalledOnValidThread());
- base::ThreadRestrictions::ScopedAllowWait allow_wait;
- base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL,
- base::WaitableEvent::InitialState::NOT_SIGNALED);
- bool result = false;
- gpu_state_->command_buffer_task_runner()->task_runner()->PostTask(
- FROM_HERE,
- base::Bind(&CommandBufferLocal::InitializeOnGpuThread,
- base::Unretained(this), base::Unretained(&event),
- base::Unretained(&result)));
- event.Wait();
- return result;
-}
-
-gpu::CommandBuffer::State CommandBufferLocal::GetLastState() {
- DCHECK(CalledOnValidThread());
- return last_state_;
-}
-
-int32_t CommandBufferLocal::GetLastToken() {
- DCHECK(CalledOnValidThread());
- TryUpdateState();
- return last_state_.token;
-}
-
-void CommandBufferLocal::Flush(int32_t put_offset) {
- DCHECK(CalledOnValidThread());
- if (last_put_offset_ == put_offset)
- return;
-
- last_put_offset_ = put_offset;
- gpu::SyncPointManager* sync_point_manager = gpu_state_->sync_point_manager();
- const uint32_t order_num =
- driver_->sync_point_order_data()->GenerateUnprocessedOrderNumber(
- sync_point_manager);
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(), base::Bind(&CommandBufferLocal::FlushOnGpuThread,
- base::Unretained(this), put_offset, order_num));
- flushed_fence_sync_release_ = next_fence_sync_release_ - 1;
-}
-
-void CommandBufferLocal::OrderingBarrier(int32_t put_offset) {
- DCHECK(CalledOnValidThread());
- // TODO(penghuang): Implement this more efficiently.
- Flush(put_offset);
-}
-
-void CommandBufferLocal::WaitForTokenInRange(int32_t start, int32_t end) {
- DCHECK(CalledOnValidThread());
- TryUpdateState();
- while (!InRange(start, end, last_state_.token) &&
- last_state_.error == gpu::error::kNoError) {
- MakeProgressAndUpdateState();
- }
-}
-
-void CommandBufferLocal::WaitForGetOffsetInRange(int32_t start, int32_t end) {
- DCHECK(CalledOnValidThread());
- TryUpdateState();
- while (!InRange(start, end, last_state_.get_offset) &&
- last_state_.error == gpu::error::kNoError) {
- MakeProgressAndUpdateState();
- }
-}
-
-void CommandBufferLocal::SetGetBuffer(int32_t buffer) {
- DCHECK(CalledOnValidThread());
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(), base::Bind(&CommandBufferLocal::SetGetBufferOnGpuThread,
- base::Unretained(this), buffer));
- last_put_offset_ = -1;
-}
-
-scoped_refptr<gpu::Buffer> CommandBufferLocal::CreateTransferBuffer(
- size_t size,
- int32_t* id) {
- DCHECK(CalledOnValidThread());
- if (size >= std::numeric_limits<uint32_t>::max())
- return nullptr;
-
- mojo::ScopedSharedBufferMapping mapping;
- mojo::ScopedSharedBufferHandle handle;
- if (!CreateAndMapSharedBuffer(size, &mapping, &handle)) {
- if (last_state_.error == gpu::error::kNoError)
- last_state_.error = gpu::error::kLostContext;
- return nullptr;
- }
-
- *id = ++next_transfer_buffer_id_;
-
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(),
- base::Bind(&CommandBufferLocal::RegisterTransferBufferOnGpuThread,
- base::Unretained(this), *id, base::Passed(&handle),
- static_cast<uint32_t>(size)));
- std::unique_ptr<gpu::BufferBacking> backing(
- new mus::MojoBufferBacking(std::move(mapping), size));
- scoped_refptr<gpu::Buffer> buffer(new gpu::Buffer(std::move(backing)));
- return buffer;
-}
-
-void CommandBufferLocal::DestroyTransferBuffer(int32_t id) {
- DCHECK(CalledOnValidThread());
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(),
- base::Bind(&CommandBufferLocal::DestroyTransferBufferOnGpuThread,
- base::Unretained(this), id));
-}
-
-void CommandBufferLocal::SetGpuControlClient(gpu::GpuControlClient* client) {
- gpu_control_client_ = client;
-}
-
-gpu::Capabilities CommandBufferLocal::GetCapabilities() {
- DCHECK(CalledOnValidThread());
- return capabilities_;
-}
-
-int32_t CommandBufferLocal::CreateImage(ClientBuffer buffer,
- size_t width,
- size_t height,
- unsigned internal_format) {
- DCHECK(CalledOnValidThread());
- int32_t new_id = ++next_image_id_;
- gfx::Size size(static_cast<int32_t>(width), static_cast<int32_t>(height));
-
- mus::MojoGpuMemoryBufferImpl* gpu_memory_buffer =
- mus::MojoGpuMemoryBufferImpl::FromClientBuffer(buffer);
-
- bool requires_sync_point = false;
-
- if (gpu_memory_buffer->GetBufferType() == gfx::SHARED_MEMORY_BUFFER) {
- gfx::GpuMemoryBufferHandle handle = gpu_memory_buffer->GetHandle();
- // TODO(rjkroege): Verify that this is required and update appropriately.
- base::SharedMemoryHandle dupd_handle =
- base::SharedMemory::DuplicateHandle(handle.handle);
-#if defined(OS_WIN)
- HANDLE platform_file = dupd_handle.GetHandle();
-#else
- int platform_file = dupd_handle.fd;
-#endif
-
- mojo::ScopedHandle scoped_handle = mojo::WrapPlatformFile(platform_file);
- const int32_t format = static_cast<int32_t>(gpu_memory_buffer->GetFormat());
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(),
- base::Bind(&CommandBufferLocal::CreateImageOnGpuThread,
- base::Unretained(this), new_id, base::Passed(&scoped_handle),
- handle.type, base::Passed(&size), format, internal_format));
-#if defined(USE_OZONE)
- } else if (gpu_memory_buffer->GetBufferType() == gfx::OZONE_NATIVE_PIXMAP) {
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(),
- base::Bind(&CommandBufferLocal::CreateImageNativeOzoneOnGpuThread,
- base::Unretained(this), new_id,
- gpu_memory_buffer->GetBufferType(),
- gpu_memory_buffer->GetSize(), gpu_memory_buffer->GetFormat(),
- internal_format,
- base::RetainedRef(gpu_memory_buffer->GetNativePixmap())));
-#endif
- } else {
- NOTIMPLEMENTED();
- return -1;
- }
-
- if (requires_sync_point) {
- NOTIMPLEMENTED() << "Require sync points";
- // TODO(jam): need to support this if we support types other than
- // SHARED_MEMORY_BUFFER.
- // gpu_memory_buffer_manager->SetDestructionSyncPoint(gpu_memory_buffer,
- // InsertSyncPoint());
- }
-
- return new_id;
-}
-
-void CommandBufferLocal::DestroyImage(int32_t id) {
- DCHECK(CalledOnValidThread());
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(), base::Bind(&CommandBufferLocal::DestroyImageOnGpuThread,
- base::Unretained(this), id));
-}
-
-int32_t CommandBufferLocal::CreateGpuMemoryBufferImage(size_t width,
- size_t height,
- unsigned internal_format,
- unsigned usage) {
- DCHECK(CalledOnValidThread());
- DCHECK_EQ(usage, static_cast<unsigned>(GL_READ_WRITE_CHROMIUM));
- std::unique_ptr<gfx::GpuMemoryBuffer> buffer(MojoGpuMemoryBufferImpl::Create(
- gfx::Size(static_cast<int>(width), static_cast<int>(height)),
- gpu::DefaultBufferFormatForImageFormat(internal_format),
- gfx::BufferUsage::SCANOUT));
- if (!buffer)
- return -1;
- return CreateImage(buffer->AsClientBuffer(), width, height, internal_format);
-}
-
-int32_t CommandBufferLocal::GetImageGpuMemoryBufferId(unsigned image_id) {
- // TODO(erikchen): Once this class supports IOSurface GpuMemoryBuffer backed
- // images, it will also need to keep a local cache from image id to
- // GpuMemoryBuffer id.
- NOTIMPLEMENTED();
- return -1;
-}
-
-void CommandBufferLocal::SignalQuery(uint32_t query_id,
- const base::Closure& callback) {
- DCHECK(CalledOnValidThread());
-
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(), base::Bind(&CommandBufferLocal::SignalQueryOnGpuThread,
- base::Unretained(this), query_id, callback));
-}
-
-void CommandBufferLocal::SetLock(base::Lock* lock) {
- DCHECK(CalledOnValidThread());
- NOTIMPLEMENTED();
-}
-
-void CommandBufferLocal::EnsureWorkVisible() {
- // This is only relevant for out-of-process command buffers.
-}
-
-gpu::CommandBufferNamespace CommandBufferLocal::GetNamespaceID() const {
- DCHECK(CalledOnValidThread());
- return gpu::CommandBufferNamespace::MOJO_LOCAL;
-}
-
-gpu::CommandBufferId CommandBufferLocal::GetCommandBufferID() const {
- DCHECK(CalledOnValidThread());
- return driver_->GetCommandBufferID();
-}
-
-int32_t CommandBufferLocal::GetExtraCommandBufferData() const {
- DCHECK(CalledOnValidThread());
- return 0;
-}
-
-uint64_t CommandBufferLocal::GenerateFenceSyncRelease() {
- DCHECK(CalledOnValidThread());
- return next_fence_sync_release_++;
-}
-
-bool CommandBufferLocal::IsFenceSyncRelease(uint64_t release) {
- DCHECK(CalledOnValidThread());
- return release != 0 && release < next_fence_sync_release_;
-}
-
-bool CommandBufferLocal::IsFenceSyncFlushed(uint64_t release) {
- DCHECK(CalledOnValidThread());
- return release != 0 && release <= flushed_fence_sync_release_;
-}
-
-bool CommandBufferLocal::IsFenceSyncFlushReceived(uint64_t release) {
- DCHECK(CalledOnValidThread());
- return IsFenceSyncFlushed(release);
-}
-
-void CommandBufferLocal::SignalSyncToken(const gpu::SyncToken& sync_token,
- const base::Closure& callback) {
- DCHECK(CalledOnValidThread());
- scoped_refptr<gpu::SyncPointClientState> release_state =
- gpu_state_->sync_point_manager()->GetSyncPointClientState(
- sync_token.namespace_id(), sync_token.command_buffer_id());
- if (!release_state ||
- release_state->IsFenceSyncReleased(sync_token.release_count())) {
- callback.Run();
- return;
- }
-
- sync_point_client_waiter_->WaitOutOfOrderNonThreadSafe(
- release_state.get(), sync_token.release_count(),
- client_thread_task_runner_, callback);
-}
-
-bool CommandBufferLocal::CanWaitUnverifiedSyncToken(
- const gpu::SyncToken* sync_token) {
- DCHECK(CalledOnValidThread());
- // Right now, MOJO_LOCAL is only used by trusted code, so it is safe to wait
- // on a sync token in MOJO_LOCAL command buffer.
- return sync_token->namespace_id() == gpu::CommandBufferNamespace::MOJO_LOCAL;
-}
-
-void CommandBufferLocal::DidLoseContext(uint32_t reason) {
- if (client_) {
- driver_->set_client(nullptr);
- client_thread_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&CommandBufferLocal::DidLoseContextOnClientThread,
- weak_ptr_, reason));
- }
-}
-
-void CommandBufferLocal::UpdateVSyncParameters(
- const base::TimeTicks& timebase,
- const base::TimeDelta& interval) {
- if (client_) {
- client_thread_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&CommandBufferLocal::UpdateVSyncParametersOnClientThread,
- weak_ptr_, timebase, interval));
- }
-}
-
-void CommandBufferLocal::OnGpuCompletedSwapBuffers(gfx::SwapResult result) {
- if (client_) {
- client_thread_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&CommandBufferLocal::OnGpuCompletedSwapBuffersOnClientThread,
- weak_ptr_, result));
- }
-}
-
-CommandBufferLocal::~CommandBufferLocal() {}
-
-void CommandBufferLocal::TryUpdateState() {
- if (last_state_.error == gpu::error::kNoError)
- shared_state()->Read(&last_state_);
-}
-
-void CommandBufferLocal::MakeProgressAndUpdateState() {
- base::ThreadRestrictions::ScopedAllowWait allow_wait;
- base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL,
- base::WaitableEvent::InitialState::NOT_SIGNALED);
- gpu::CommandBuffer::State state;
- gpu_state_->command_buffer_task_runner()->PostTask(
- driver_.get(),
- base::Bind(&CommandBufferLocal::MakeProgressOnGpuThread,
- base::Unretained(this), base::Unretained(&event),
- base::Unretained(&state)));
- event.Wait();
- if (state.generation - last_state_.generation < 0x80000000U)
- last_state_ = state;
-}
-
-void CommandBufferLocal::InitializeOnGpuThread(base::WaitableEvent* event,
- bool* result) {
- driver_.reset(new CommandBufferDriver(
- gpu::CommandBufferNamespace::MOJO_LOCAL,
- gpu::CommandBufferId::FromUnsafeValue(++g_next_command_buffer_id),
- widget_, gpu_state_));
- driver_->set_client(this);
- const size_t kSharedStateSize = sizeof(gpu::CommandBufferSharedState);
- mojo::ScopedSharedBufferMapping mapping;
- mojo::ScopedSharedBufferHandle handle;
- *result = CreateAndMapSharedBuffer(kSharedStateSize, &shared_state_, &handle);
-
- if (!*result) {
- event->Signal();
- return;
- }
-
- shared_state()->Initialize();
-
- *result =
- driver_->Initialize(std::move(handle), mojo::Array<int32_t>::New(0));
- if (*result)
- capabilities_ = driver_->GetCapabilities();
- event->Signal();
-}
-
-bool CommandBufferLocal::FlushOnGpuThread(int32_t put_offset,
- uint32_t order_num) {
- DCHECK(driver_->IsScheduled());
- driver_->sync_point_order_data()->BeginProcessingOrderNumber(order_num);
- driver_->Flush(put_offset);
-
- // Return false if the Flush is not finished, so the CommandBufferTaskRunner
- // will not remove this task from the task queue.
- const bool complete = !driver_->HasUnprocessedCommands();
- if (complete)
- driver_->sync_point_order_data()->FinishProcessingOrderNumber(order_num);
- return complete;
-}
-
-bool CommandBufferLocal::SetGetBufferOnGpuThread(int32_t buffer) {
- DCHECK(driver_->IsScheduled());
- driver_->SetGetBuffer(buffer);
- return true;
-}
-
-bool CommandBufferLocal::RegisterTransferBufferOnGpuThread(
- int32_t id,
- mojo::ScopedSharedBufferHandle transfer_buffer,
- uint32_t size) {
- DCHECK(driver_->IsScheduled());
- driver_->RegisterTransferBuffer(id, std::move(transfer_buffer), size);
- return true;
-}
-
-bool CommandBufferLocal::DestroyTransferBufferOnGpuThread(int32_t id) {
- DCHECK(driver_->IsScheduled());
- driver_->DestroyTransferBuffer(id);
- return true;
-}
-
-bool CommandBufferLocal::CreateImageOnGpuThread(
- int32_t id,
- mojo::ScopedHandle memory_handle,
- int32_t type,
- const gfx::Size& size,
- int32_t format,
- int32_t internal_format) {
- DCHECK(driver_->IsScheduled());
- driver_->CreateImage(id, std::move(memory_handle), type, std::move(size),
- format, internal_format);
- return true;
-}
-
-bool CommandBufferLocal::CreateImageNativeOzoneOnGpuThread(
- int32_t id,
- int32_t type,
- gfx::Size size,
- gfx::BufferFormat format,
- uint32_t internal_format,
- ui::NativePixmap* pixmap) {
- DCHECK(driver_->IsScheduled());
- driver_->CreateImageNativeOzone(id, type, size, format, internal_format,
- pixmap);
- return true;
-}
-
-bool CommandBufferLocal::DestroyImageOnGpuThread(int32_t id) {
- DCHECK(driver_->IsScheduled());
- driver_->DestroyImage(id);
- return true;
-}
-
-bool CommandBufferLocal::MakeProgressOnGpuThread(
- base::WaitableEvent* event,
- gpu::CommandBuffer::State* state) {
- DCHECK(driver_->IsScheduled());
- *state = driver_->GetLastState();
- event->Signal();
- return true;
-}
-
-bool CommandBufferLocal::DeleteOnGpuThread(base::WaitableEvent* event) {
- delete this;
- event->Signal();
- return true;
-}
-
-bool CommandBufferLocal::SignalQueryOnGpuThread(uint32_t query_id,
- const base::Closure& callback) {
- // |callback| should run on the client thread.
- driver_->SignalQuery(
- query_id, base::Bind(&PostTask, client_thread_task_runner_, callback));
- return true;
-}
-
-void CommandBufferLocal::DidLoseContextOnClientThread(uint32_t reason) {
- DCHECK(gpu_control_client_);
- if (!lost_context_)
- gpu_control_client_->OnGpuControlLostContext();
- lost_context_ = true;
-}
-
-void CommandBufferLocal::UpdateVSyncParametersOnClientThread(
- const base::TimeTicks& timebase,
- const base::TimeDelta& interval) {
- if (client_)
- client_->UpdateVSyncParameters(timebase, interval);
-}
-
-void CommandBufferLocal::OnGpuCompletedSwapBuffersOnClientThread(
- gfx::SwapResult result) {
- if (client_)
- client_->GpuCompletedSwapBuffers(result);
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/gles2/command_buffer_local.h b/chromium/components/mus/gles2/command_buffer_local.h
deleted file mode 100644
index 4d893322737..00000000000
--- a/chromium/components/mus/gles2/command_buffer_local.h
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_H_
-#define COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <map>
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/weak_ptr.h"
-#include "base/threading/non_thread_safe.h"
-#include "components/mus/gles2/command_buffer_driver.h"
-#include "components/mus/public/interfaces/command_buffer.mojom.h"
-#include "gpu/command_buffer/client/gpu_control.h"
-#include "gpu/command_buffer/common/command_buffer.h"
-#include "gpu/command_buffer/common/command_buffer_id.h"
-#include "gpu/command_buffer/common/command_buffer_shared.h"
-#include "ui/gfx/geometry/size.h"
-#include "ui/gfx/gpu_memory_buffer.h"
-#include "ui/gfx/native_widget_types.h"
-
-namespace {
-class WaitableEvent;
-}
-
-namespace gl {
-class GLContext;
-class GLSurface;
-}
-
-namespace gpu {
-class GpuControlClient;
-class SyncPointClient;
-}
-
-namespace mus {
-
-class CommandBufferDriver;
-class CommandBufferLocalClient;
-class GpuState;
-
-// This class provides a wrapper around a CommandBufferDriver and a GpuControl
-// implementation to allow cc::Display to generate GL directly on the main
-// thread.
-class CommandBufferLocal : public gpu::CommandBuffer,
- public gpu::GpuControl,
- public CommandBufferDriver::Client,
- base::NonThreadSafe {
- public:
- CommandBufferLocal(CommandBufferLocalClient* client,
- gfx::AcceleratedWidget widget,
- const scoped_refptr<GpuState>& gpu_state);
-
- bool Initialize();
- // Destroy the CommandBufferLocal. The client should not use this class
- // after calling it.
- void Destroy();
-
- // gpu::CommandBuffer implementation:
- gpu::CommandBuffer::State GetLastState() override;
- int32_t GetLastToken() override;
- void Flush(int32_t put_offset) override;
- void OrderingBarrier(int32_t put_offset) override;
- void WaitForTokenInRange(int32_t start, int32_t end) override;
- void WaitForGetOffsetInRange(int32_t start, int32_t end) override;
- void SetGetBuffer(int32_t buffer) override;
- scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size,
- int32_t* id) override;
- void DestroyTransferBuffer(int32_t id) override;
-
- // gpu::GpuControl implementation:
- void SetGpuControlClient(gpu::GpuControlClient*) override;
- gpu::Capabilities GetCapabilities() override;
- int32_t CreateImage(ClientBuffer buffer,
- size_t width,
- size_t height,
- unsigned internalformat) override;
- void DestroyImage(int32_t id) override;
- int32_t CreateGpuMemoryBufferImage(size_t width,
- size_t height,
- unsigned internal_format,
- unsigned usage) override;
- int32_t GetImageGpuMemoryBufferId(unsigned image_id) override;
- void SignalQuery(uint32_t query_id, const base::Closure& callback) override;
- void SetLock(base::Lock*) override;
- void EnsureWorkVisible() override;
- gpu::CommandBufferNamespace GetNamespaceID() const override;
- gpu::CommandBufferId GetCommandBufferID() const override;
- int32_t GetExtraCommandBufferData() const override;
- uint64_t GenerateFenceSyncRelease() override;
- bool IsFenceSyncRelease(uint64_t release) override;
- bool IsFenceSyncFlushed(uint64_t release) override;
- bool IsFenceSyncFlushReceived(uint64_t release) override;
- void SignalSyncToken(const gpu::SyncToken& sync_token,
- const base::Closure& callback) override;
- bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override;
-
- private:
- // CommandBufferDriver::Client implementation. All called on GPU thread.
- void DidLoseContext(uint32_t reason) override;
- void UpdateVSyncParameters(const base::TimeTicks& timebase,
- const base::TimeDelta& interval) override;
- void OnGpuCompletedSwapBuffers(gfx::SwapResult result) override;
-
- ~CommandBufferLocal() override;
-
- gpu::CommandBufferSharedState* shared_state() const {
- return reinterpret_cast<gpu::CommandBufferSharedState*>(
- shared_state_.get());
- }
- void TryUpdateState();
- void MakeProgressAndUpdateState();
-
- // Helper functions are called in the GPU thread.
- void InitializeOnGpuThread(base::WaitableEvent* event, bool* result);
- bool FlushOnGpuThread(int32_t put_offset, uint32_t order_num);
- bool SetGetBufferOnGpuThread(int32_t buffer);
- bool RegisterTransferBufferOnGpuThread(
- int32_t id,
- mojo::ScopedSharedBufferHandle transfer_buffer,
- uint32_t size);
- bool DestroyTransferBufferOnGpuThread(int32_t id);
- bool CreateImageOnGpuThread(int32_t id,
- mojo::ScopedHandle memory_handle,
- int32_t type,
- const gfx::Size& size,
- int32_t format,
- int32_t internal_format);
- bool CreateImageNativeOzoneOnGpuThread(int32_t id,
- int32_t type,
- gfx::Size size,
- gfx::BufferFormat format,
- uint32_t internal_format,
- ui::NativePixmap* pixmap);
- bool DestroyImageOnGpuThread(int32_t id);
- bool MakeProgressOnGpuThread(base::WaitableEvent* event,
- gpu::CommandBuffer::State* state);
- bool DeleteOnGpuThread(base::WaitableEvent* event);
- bool SignalQueryOnGpuThread(uint32_t query_id, const base::Closure& callback);
-
- // Helper functions are called in the client thread.
- void DidLoseContextOnClientThread(uint32_t reason);
- void UpdateVSyncParametersOnClientThread(const base::TimeTicks& timebase,
- const base::TimeDelta& interval);
- void OnGpuCompletedSwapBuffersOnClientThread(gfx::SwapResult result);
-
- gfx::AcceleratedWidget widget_;
- scoped_refptr<GpuState> gpu_state_;
- std::unique_ptr<CommandBufferDriver> driver_;
- CommandBufferLocalClient* client_;
- scoped_refptr<base::SingleThreadTaskRunner> client_thread_task_runner_;
-
- // Members accessed on the client thread:
- gpu::GpuControlClient* gpu_control_client_;
- gpu::CommandBuffer::State last_state_;
- mojo::ScopedSharedBufferMapping shared_state_;
- int32_t last_put_offset_;
- gpu::Capabilities capabilities_;
- int32_t next_transfer_buffer_id_;
- int32_t next_image_id_;
- uint64_t next_fence_sync_release_;
- uint64_t flushed_fence_sync_release_;
- bool lost_context_;
-
- // This sync point client is only for out of order Wait on client thread.
- std::unique_ptr<gpu::SyncPointClient> sync_point_client_waiter_;
-
- base::WeakPtr<CommandBufferLocal> weak_ptr_;
-
- // This weak factory will be invalidated in the client thread, so all weak
- // pointers have to be dereferenced in the client thread too.
- base::WeakPtrFactory<CommandBufferLocal> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(CommandBufferLocal);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_H_
diff --git a/chromium/components/mus/gles2/command_buffer_local_client.h b/chromium/components/mus/gles2/command_buffer_local_client.h
deleted file mode 100644
index c26cbdf4941..00000000000
--- a/chromium/components/mus/gles2/command_buffer_local_client.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_CLIENT_H_
-#define COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_CLIENT_H_
-
-#include <stdint.h>
-
-#include "ui/gfx/swap_result.h"
-
-namespace base {
-class TimeDelta;
-class TimeTicks;
-}
-
-namespace mus {
-
-class CommandBufferLocalClient {
- public:
- virtual void UpdateVSyncParameters(const base::TimeTicks& timebase,
- const base::TimeDelta& interval) = 0;
- virtual void GpuCompletedSwapBuffers(gfx::SwapResult result) = 0;
-
- protected:
- virtual ~CommandBufferLocalClient() {}
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GLES2_COMMAND_BUFFER_LOCAL_CLIENT_H_
diff --git a/chromium/components/mus/gles2/command_buffer_task_runner.cc b/chromium/components/mus/gles2/command_buffer_task_runner.cc
deleted file mode 100644
index df1dc548b6a..00000000000
--- a/chromium/components/mus/gles2/command_buffer_task_runner.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gles2/command_buffer_task_runner.h"
-
-#include "base/bind.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "components/mus/gles2/command_buffer_driver.h"
-
-namespace mus {
-
-CommandBufferTaskRunner::CommandBufferTaskRunner()
- : task_runner_(base::ThreadTaskRunnerHandle::Get()),
- need_post_task_(true) {
-}
-
-bool CommandBufferTaskRunner::PostTask(
- const CommandBufferDriver* driver,
- const TaskCallback& task) {
- base::AutoLock locker(lock_);
- driver_map_[driver].push_back(task);
- ScheduleTaskIfNecessaryLocked();
- return true;
-}
-
-CommandBufferTaskRunner::~CommandBufferTaskRunner() {}
-
-bool CommandBufferTaskRunner::RunOneTaskInternalLocked() {
- DCHECK(thread_checker_.CalledOnValidThread());
- lock_.AssertAcquired();
-
- for (auto it = driver_map_.begin(); it != driver_map_.end(); ++it) {
- if (!it->first->IsScheduled())
- continue;
- TaskQueue& task_queue = it->second;
- DCHECK(!task_queue.empty());
- const TaskCallback& callback = task_queue.front();
- bool complete = false;
- {
- base::AutoUnlock unlocker(lock_);
- complete = callback.Run();
- }
- if (complete) {
- // Only remove the task if it is complete.
- task_queue.pop_front();
- if (task_queue.empty())
- driver_map_.erase(it);
- }
- return true;
- }
- return false;
-}
-
-void CommandBufferTaskRunner::ScheduleTaskIfNecessaryLocked() {
- lock_.AssertAcquired();
- if (!need_post_task_)
- return;
- task_runner()->PostTask(
- FROM_HERE,
- base::Bind(&CommandBufferTaskRunner::RunCommandBufferTask, this));
- need_post_task_ = false;
-}
-
-void CommandBufferTaskRunner::RunCommandBufferTask() {
- DCHECK(thread_checker_.CalledOnValidThread());
- base::AutoLock locker(lock_);
-
- // Try executing all tasks in |driver_map_| until |RunOneTaskInternalLock()|
- // returns false (Returning false means |driver_map_| is empty or all tasks
- // in it aren't executable currently).
- while (RunOneTaskInternalLocked())
- ;
- need_post_task_ = true;
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/gles2/command_buffer_task_runner.h b/chromium/components/mus/gles2/command_buffer_task_runner.h
deleted file mode 100644
index 8ee317f5800..00000000000
--- a/chromium/components/mus/gles2/command_buffer_task_runner.h
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GLES2_COMMAND_BUFFER_TASK_RUNNER_H_
-#define COMPONENTS_MUS_GLES2_COMMAND_BUFFER_TASK_RUNNER_H_
-
-#include <deque>
-#include <map>
-#include <memory>
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/single_thread_task_runner.h"
-#include "base/synchronization/condition_variable.h"
-#include "base/synchronization/lock.h"
-#include "base/threading/thread_checker.h"
-
-namespace mus {
-
-class CommandBufferDriver;
-
-// This class maintains tasks submitted by |CommandBufferImpl|. Those tasks will
-// be executed on the main thread. But if the main thread is blocked in
-// |CommandBufferLocal::OnWaitFenceSync()| by waiting a sync point, the
-// |CommandBufferTaskRunner::RunOneTask()| could be used for executing a task
-// from other command buffers which may retire the sync point.
-class CommandBufferTaskRunner
- : public base::RefCountedThreadSafe<CommandBufferTaskRunner> {
- public:
- CommandBufferTaskRunner();
-
- // TaskCallback returns true if the task is completed and should be removed
- // from the task queue, otherwise returns false.
- typedef base::Callback<bool(void)> TaskCallback;
- bool PostTask(const CommandBufferDriver* driver,
- const TaskCallback& task);
-
- scoped_refptr<base::SingleThreadTaskRunner> task_runner() const {
- return task_runner_;
- }
-
- private:
- friend class base::RefCountedThreadSafe<CommandBufferTaskRunner>;
-
- ~CommandBufferTaskRunner();
-
- // Run one command buffer task from a scheduled command buffer.
- // When there isn't any command buffer task, and if the |block| is false,
- // this function will return false immediately, otherwise, this function
- // will be blocked until a task is available for executing.
- bool RunOneTaskInternalLocked();
-
- // Post a task to the main thread to execute tasks in |driver_map_|, if it is
- // necessary.
- void ScheduleTaskIfNecessaryLocked();
-
- // The callback function for executing tasks in |driver_map_|.
- void RunCommandBufferTask();
-
- base::ThreadChecker thread_checker_;
- scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
-
- typedef std::deque<TaskCallback> TaskQueue;
- typedef std::map<const CommandBufferDriver*, TaskQueue> DriverMap;
- DriverMap driver_map_;
- bool need_post_task_;
-
- // The access lock for |driver_map_| and |need_post_task_|.
- base::Lock lock_;
-
- DISALLOW_COPY_AND_ASSIGN(CommandBufferTaskRunner);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GLES2_COMMAND_BUFFER_TASK_RUNNER_H_
diff --git a/chromium/components/mus/gles2/gl_surface_adapter.cc b/chromium/components/mus/gles2/gl_surface_adapter.cc
deleted file mode 100644
index df1761b5854..00000000000
--- a/chromium/components/mus/gles2/gl_surface_adapter.cc
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (c) 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gles2/gl_surface_adapter.h"
-
-#include "base/bind.h"
-
-namespace mus {
-
-GLSurfaceAdapterMus::GLSurfaceAdapterMus(scoped_refptr<gl::GLSurface> surface)
- : gl::GLSurfaceAdapter(surface.get()),
- surface_(surface),
- weak_ptr_factory_(this) {}
-
-GLSurfaceAdapterMus::~GLSurfaceAdapterMus() {}
-
-void GLSurfaceAdapterMus::SwapBuffersAsync(
- const GLSurface::SwapCompletionCallback& callback) {
- gl::GLSurfaceAdapter::SwapBuffersAsync(
- base::Bind(&GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync,
- weak_ptr_factory_.GetWeakPtr(), callback));
-}
-
-void GLSurfaceAdapterMus::PostSubBufferAsync(
- int x,
- int y,
- int width,
- int height,
- const GLSurface::SwapCompletionCallback& callback) {
- gl::GLSurfaceAdapter::PostSubBufferAsync(
- x, y, width, height,
- base::Bind(&GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync,
- weak_ptr_factory_.GetWeakPtr(), callback));
-}
-
-void GLSurfaceAdapterMus::CommitOverlayPlanesAsync(
- const GLSurface::SwapCompletionCallback& callback) {
- gl::GLSurfaceAdapter::CommitOverlayPlanesAsync(
- base::Bind(&GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync,
- weak_ptr_factory_.GetWeakPtr(), callback));
-}
-
-void GLSurfaceAdapterMus::WrappedCallbackForSwapBuffersAsync(
- const gl::GLSurface::SwapCompletionCallback& original_callback,
- gfx::SwapResult result) {
- if (!adapter_callback_.is_null())
- adapter_callback_.Run(result);
- original_callback.Run(result);
-}
-
-void GLSurfaceAdapterMus::SetGpuCompletedSwapBuffersCallback(
- gl::GLSurface::SwapCompletionCallback callback) {
- adapter_callback_ = std::move(callback);
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/gles2/gl_surface_adapter.h b/chromium/components/mus/gles2/gl_surface_adapter.h
deleted file mode 100644
index 98da7530915..00000000000
--- a/chromium/components/mus/gles2/gl_surface_adapter.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (c) 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GLES2_GL_SURFACE_ADAPTER_H_
-#define COMPONENTS_MUS_GLES2_GL_SURFACE_ADAPTER_H_
-
-#include <stdint.h>
-
-#include <vector>
-
-#include "base/callback.h"
-#include "base/memory/weak_ptr.h"
-#include "ui/gfx/swap_result.h"
-#include "ui/gl/gl_surface.h"
-
-namespace mus {
-
-// Wraps a GLSurface such that there is a real GLSurface instance acting as
-// delegate. Implements the GLSurface interface. The |gl::GLSurfaceAdapter|
-// superclass provides a default implementation that forwards all GLSurface
-// methods to the provided delegate. |GLSurfaceAdapterMus| overrides only the
-// necessary methods to augment the completion callback argument to
-// |SwapBuffersAsync|, |PostSubBufferAsync| and |CommitOverlayPlanesAsync| with
-// a callback provided with the |SetGpuCompletedSwapBuffersCallback| method.
-class GLSurfaceAdapterMus : public gl::GLSurfaceAdapter {
- public:
- // Creates a new |GLSurfaceAdapterMus| that delegates to |surface|.
- explicit GLSurfaceAdapterMus(scoped_refptr<gl::GLSurface> surface);
-
- // gl::GLSurfaceAdapter.
- void SwapBuffersAsync(
- const gl::GLSurface::SwapCompletionCallback& callback) override;
- void PostSubBufferAsync(
- int x,
- int y,
- int width,
- int height,
- const gl::GLSurface::SwapCompletionCallback& callback) override;
- void CommitOverlayPlanesAsync(
- const gl::GLSurface::SwapCompletionCallback& callback) override;
-
- // Set an additional callback to run on SwapBuffers completion.
- void SetGpuCompletedSwapBuffersCallback(
- gl::GLSurface::SwapCompletionCallback callback);
-
- private:
- ~GLSurfaceAdapterMus() override;
-
- // We wrap the callback given to the |gl::GLSurfaceAdapter| overrides above
- // with an invocation of this function. It invokes |adapter_callback_| and the
- // original |original_callback| provided by the original invoker of
- // |SwapBuffersAsync| etc.
- void WrappedCallbackForSwapBuffersAsync(
- const gl::GLSurface::SwapCompletionCallback& original_callback,
- gfx::SwapResult result);
-
- gl::GLSurface::SwapCompletionCallback adapter_callback_;
-
- // gl::GLSurfaceAdapter doesn't own the delegate surface so keep a reference
- // here.
- scoped_refptr<gl::GLSurface> surface_;
-
- base::WeakPtrFactory<GLSurfaceAdapterMus> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapterMus);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GLES2_GL_SURFACE_ADAPTER_H_
diff --git a/chromium/components/mus/gles2/gpu_impl.cc b/chromium/components/mus/gles2/gpu_impl.cc
deleted file mode 100644
index 7ae0b6d0c25..00000000000
--- a/chromium/components/mus/gles2/gpu_impl.cc
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gles2/gpu_impl.h"
-
-#include "components/mus/common/gpu_type_converters.h"
-#include "components/mus/gles2/command_buffer_impl.h"
-
-namespace mus {
-
-GpuImpl::GpuImpl(mojo::InterfaceRequest<Gpu> request,
- const scoped_refptr<GpuState>& state)
- : binding_(this, std::move(request)), state_(state) {}
-
-GpuImpl::~GpuImpl() {}
-
-void GpuImpl::CreateOffscreenGLES2Context(
- mojo::InterfaceRequest<mojom::CommandBuffer> request) {
- new CommandBufferImpl(std::move(request), state_);
-}
-
-void GpuImpl::GetGpuInfo(const GetGpuInfoCallback& callback) {
- callback.Run(mojom::GpuInfo::From<gpu::GPUInfo>(state_->gpu_info()));
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/gles2/gpu_impl.h b/chromium/components/mus/gles2/gpu_impl.h
deleted file mode 100644
index 73fb66ed27a..00000000000
--- a/chromium/components/mus/gles2/gpu_impl.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GLES2_GPU_IMPL_H_
-#define COMPONENTS_MUS_GLES2_GPU_IMPL_H_
-
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/threading/thread.h"
-#include "components/mus/gles2/gpu_state.h"
-#include "components/mus/public/interfaces/command_buffer.mojom.h"
-#include "components/mus/public/interfaces/gpu.mojom.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-#include "ui/gfx/geometry/mojo/geometry.mojom.h"
-
-namespace mus {
-
-class GpuImpl : public mojom::Gpu {
- public:
- GpuImpl(mojo::InterfaceRequest<mojom::Gpu> request,
- const scoped_refptr<GpuState>& state);
- ~GpuImpl() override;
-
- private:
- void CreateOffscreenGLES2Context(mojo::InterfaceRequest<mojom::CommandBuffer>
- command_buffer_request) override;
- void GetGpuInfo(const GetGpuInfoCallback& callback) override;
-
- mojo::StrongBinding<Gpu> binding_;
- scoped_refptr<GpuState> state_;
-
- DISALLOW_COPY_AND_ASSIGN(GpuImpl);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GLES2_GPU_IMPL_H_
diff --git a/chromium/components/mus/gles2/gpu_memory_tracker.cc b/chromium/components/mus/gles2/gpu_memory_tracker.cc
deleted file mode 100644
index 0d9f12b989e..00000000000
--- a/chromium/components/mus/gles2/gpu_memory_tracker.cc
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gles2/gpu_memory_tracker.h"
-
-namespace mus {
-
-GpuMemoryTracker::GpuMemoryTracker() {}
-
-void GpuMemoryTracker::TrackMemoryAllocatedChange(
- size_t old_size,
- size_t new_size) {}
-
-bool GpuMemoryTracker::EnsureGPUMemoryAvailable(size_t size_needed) {
- return true;
-}
-
-uint64_t GpuMemoryTracker::ClientTracingId() const {
- return 0u;
-}
-
-int GpuMemoryTracker::ClientId() const {
- return 0;
-}
-
-uint64_t GpuMemoryTracker::ShareGroupTracingGUID() const {
- // TODO(rjkroege): This should return a GUID which identifies the share group
- // we are tracking memory for. This GUID should correspond to the GUID of the
- // first command buffer in the share group.
- return 0;
-}
-
-GpuMemoryTracker::~GpuMemoryTracker() {}
-
-} // namespace mus
diff --git a/chromium/components/mus/gles2/gpu_memory_tracker.h b/chromium/components/mus/gles2/gpu_memory_tracker.h
deleted file mode 100644
index 925ca978d19..00000000000
--- a/chromium/components/mus/gles2/gpu_memory_tracker.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GLES2_GPU_MEMORY_TRACKER_H_
-#define COMPONENTS_MUS_GLES2_GPU_MEMORY_TRACKER_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include "base/macros.h"
-#include "gpu/command_buffer/service/memory_tracking.h"
-
-namespace mus {
-
-// TODO(fsamuel, rjkroege): This is a stub implementation that needs to be
-// completed for proper memory tracking.
-class GpuMemoryTracker : public gpu::gles2::MemoryTracker {
- public:
- GpuMemoryTracker();
-
- // gpu::MemoryTracker implementation:
- void TrackMemoryAllocatedChange(
- size_t old_size,
- size_t new_size) override;
- bool EnsureGPUMemoryAvailable(size_t size_needed) override;
- uint64_t ClientTracingId() const override;
- int ClientId() const override;
- uint64_t ShareGroupTracingGUID() const override;
-
- private:
- ~GpuMemoryTracker() override;
-
- DISALLOW_COPY_AND_ASSIGN(GpuMemoryTracker);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GLES2_GPU_MEMORY_TRACKER_H_
diff --git a/chromium/components/mus/gles2/gpu_state.cc b/chromium/components/mus/gles2/gpu_state.cc
deleted file mode 100644
index ce00ae30af9..00000000000
--- a/chromium/components/mus/gles2/gpu_state.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gles2/gpu_state.h"
-
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/threading/thread_restrictions.h"
-#include "gpu/config/gpu_info_collector.h"
-#include "ui/gl/gl_implementation.h"
-#include "ui/gl/init/gl_factory.h"
-
-#if defined(USE_OZONE)
-#include "ui/ozone/public/ozone_platform.h"
-#endif
-
-namespace mus {
-
-GpuState::GpuState()
- : gpu_thread_("gpu_thread"),
- control_thread_("gpu_command_buffer_control"),
- gpu_driver_bug_workarounds_(base::CommandLine::ForCurrentProcess()),
- hardware_rendering_available_(false) {
- base::ThreadRestrictions::ScopedAllowWait allow_wait;
- gpu_thread_.Start();
- control_thread_.Start();
- control_thread_task_runner_ = control_thread_.task_runner();
- base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL,
- base::WaitableEvent::InitialState::NOT_SIGNALED);
- gpu_thread_.task_runner()->PostTask(
- FROM_HERE, base::Bind(&GpuState::InitializeOnGpuThread,
- base::Unretained(this), &event));
- event.Wait();
-}
-
-GpuState::~GpuState() {}
-
-void GpuState::StopThreads() {
- control_thread_.Stop();
- gpu_thread_.task_runner()->PostTask(
- FROM_HERE,
- base::Bind(&GpuState::DestroyGpuSpecificStateOnGpuThread, this));
- gpu_thread_.Stop();
-}
-
-void GpuState::InitializeOnGpuThread(base::WaitableEvent* event) {
-#if defined(USE_OZONE)
- ui::OzonePlatform::InitializeForGPU();
-#endif
- hardware_rendering_available_ = gl::init::InitializeGLOneOff();
- command_buffer_task_runner_ = new CommandBufferTaskRunner;
- driver_manager_.reset(new CommandBufferDriverManager);
- sync_point_manager_.reset(new gpu::SyncPointManager(true));
- share_group_ = new gl::GLShareGroup;
- mailbox_manager_ = new gpu::gles2::MailboxManagerImpl;
-
- // TODO(penghuang): investigate why gpu::CollectBasicGraphicsInfo() failed on
- // windows remote desktop.
- const gl::GLImplementation impl = gl::GetGLImplementation();
- if (impl != gl::kGLImplementationNone &&
- impl != gl::kGLImplementationOSMesaGL &&
- impl != gl::kGLImplementationMockGL) {
- gpu::CollectInfoResult result = gpu::CollectBasicGraphicsInfo(&gpu_info_);
- LOG_IF(ERROR, result != gpu::kCollectInfoSuccess)
- << "Collect basic graphics info failed!";
- }
- if (impl != gl::kGLImplementationNone) {
- gpu::CollectInfoResult result = gpu::CollectContextGraphicsInfo(&gpu_info_);
- LOG_IF(ERROR, result != gpu::kCollectInfoSuccess)
- << "Collect context graphics info failed!";
- }
- event->Signal();
-
-}
-
-void GpuState::DestroyGpuSpecificStateOnGpuThread() {
- driver_manager_.reset();
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/gles2/gpu_state.h b/chromium/components/mus/gles2/gpu_state.h
deleted file mode 100644
index f30d485bfc7..00000000000
--- a/chromium/components/mus/gles2/gpu_state.h
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GLES2_GPU_STATE_H_
-#define COMPONENTS_MUS_GLES2_GPU_STATE_H_
-
-#include <memory>
-
-#include "base/memory/ref_counted.h"
-#include "base/single_thread_task_runner.h"
-#include "base/threading/thread.h"
-#include "components/mus/gles2/command_buffer_driver_manager.h"
-#include "components/mus/gles2/command_buffer_task_runner.h"
-#include "gpu/command_buffer/service/gpu_preferences.h"
-#include "gpu/command_buffer/service/mailbox_manager_impl.h"
-#include "gpu/command_buffer/service/sync_point_manager.h"
-#include "gpu/config/gpu_driver_bug_workarounds.h"
-#include "gpu/config/gpu_info.h"
-#include "ui/gl/gl_share_group.h"
-
-namespace {
-class WaitableEvent;
-}
-
-namespace mus {
-
-// We need to share these across all CommandBuffer instances so that contexts
-// they create can share resources with each other via mailboxes.
-class GpuState : public base::RefCountedThreadSafe<GpuState> {
- public:
- GpuState();
-
- // We run the CommandBufferImpl on the control_task_runner, which forwards
- // most method class to the CommandBufferDriver, which runs on the "driver",
- // thread (i.e., the thread on which GpuImpl instances are created).
- scoped_refptr<base::SingleThreadTaskRunner> control_task_runner() {
- return control_thread_task_runner_;
- }
-
- void StopThreads();
-
- const gpu::GpuPreferences& gpu_preferences() const {
- return gpu_preferences_;
- }
-
- const gpu::GpuDriverBugWorkarounds& gpu_driver_bug_workarounds() const {
- return gpu_driver_bug_workarounds_;
- }
-
- CommandBufferTaskRunner* command_buffer_task_runner() const {
- return command_buffer_task_runner_.get();
- }
-
- CommandBufferDriverManager* driver_manager() const {
- return driver_manager_.get();
- }
-
- // These objects are intended to be used on the "driver" thread (i.e., the
- // thread on which GpuImpl instances are created).
- gl::GLShareGroup* share_group() const { return share_group_.get(); }
- gpu::gles2::MailboxManager* mailbox_manager() const {
- return mailbox_manager_.get();
- }
- gpu::SyncPointManager* sync_point_manager() const {
- return sync_point_manager_.get();
- }
-
- const gpu::GPUInfo& gpu_info() const {
- return gpu_info_;
- }
-
- bool HardwareRenderingAvailable() const {
- return hardware_rendering_available_;
- }
-
- private:
- friend class base::RefCountedThreadSafe<GpuState>;
- ~GpuState();
-
- void InitializeOnGpuThread(base::WaitableEvent* event);
-
- void DestroyGpuSpecificStateOnGpuThread();
-
- // |gpu_thread_| is for executing OS GL calls.
- base::Thread gpu_thread_;
- // |control_thread_| is for mojo incoming calls of CommandBufferImpl.
- base::Thread control_thread_;
-
- // Same as control_thread_->task_runner(). The TaskRunner is cached as it may
- // be needed during shutdown.
- scoped_refptr<base::SingleThreadTaskRunner> control_thread_task_runner_;
-
- gpu::GpuPreferences gpu_preferences_;
- const gpu::GpuDriverBugWorkarounds gpu_driver_bug_workarounds_;
- scoped_refptr<CommandBufferTaskRunner> command_buffer_task_runner_;
- std::unique_ptr<CommandBufferDriverManager> driver_manager_;
- std::unique_ptr<gpu::SyncPointManager> sync_point_manager_;
- scoped_refptr<gl::GLShareGroup> share_group_;
- scoped_refptr<gpu::gles2::MailboxManager> mailbox_manager_;
- gpu::GPUInfo gpu_info_;
- bool hardware_rendering_available_;
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GLES2_GPU_STATE_H_
diff --git a/chromium/components/mus/gles2/ozone_gpu_memory_buffer.cc b/chromium/components/mus/gles2/ozone_gpu_memory_buffer.cc
deleted file mode 100644
index c53b51f5ade..00000000000
--- a/chromium/components/mus/gles2/ozone_gpu_memory_buffer.cc
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gles2/ozone_gpu_memory_buffer.h"
-
-#include "ui/gfx/buffer_format_util.h"
-#include "ui/ozone/public/client_native_pixmap.h"
-#include "ui/ozone/public/client_native_pixmap_factory.h"
-#include "ui/ozone/public/native_pixmap.h"
-#include "ui/ozone/public/ozone_platform.h"
-#include "ui/ozone/public/surface_factory_ozone.h"
-
-namespace mus {
-
-OzoneGpuMemoryBuffer::OzoneGpuMemoryBuffer(
- gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- gfx::BufferFormat format,
- std::unique_ptr<ui::ClientNativePixmap> client_pixmap,
- scoped_refptr<ui::NativePixmap> native_pixmap)
- : GpuMemoryBufferImpl(id, size, format),
- client_pixmap_(std::move(client_pixmap)),
- native_pixmap_(native_pixmap) {}
-
-OzoneGpuMemoryBuffer::~OzoneGpuMemoryBuffer() {
- DCHECK(!mapped_);
-}
-
-// static
-OzoneGpuMemoryBuffer* OzoneGpuMemoryBuffer::FromClientBuffer(
- ClientBuffer buffer) {
- return reinterpret_cast<OzoneGpuMemoryBuffer*>(buffer);
-}
-
-// static
-std::unique_ptr<gfx::GpuMemoryBuffer>
-OzoneGpuMemoryBuffer::CreateOzoneGpuMemoryBuffer(
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage,
- gfx::AcceleratedWidget widget) {
- scoped_refptr<ui::NativePixmap> pixmap =
- ui::OzonePlatform::GetInstance()
- ->GetSurfaceFactoryOzone()
- ->CreateNativePixmap(widget, size, format, usage);
-
- DCHECK(pixmap) << "need pixmap to exist!";
-
- if (!pixmap.get()) {
- DLOG(ERROR) << "Failed to create pixmap " << size.width() << "x"
- << size.height() << " format " << static_cast<int>(format)
- << ", usage " << static_cast<int>(usage);
- return nullptr;
- }
-
- // We construct a ui::NativePixmapHandle
- gfx::NativePixmapHandle native_pixmap_handle = pixmap->ExportHandle();
- DCHECK(ui::ClientNativePixmapFactory::GetInstance())
- << "need me a ClientNativePixmapFactory";
- std::unique_ptr<ui::ClientNativePixmap> client_native_pixmap =
- ui::ClientNativePixmapFactory::GetInstance()->ImportFromHandle(
- native_pixmap_handle, size, usage);
-
- std::unique_ptr<OzoneGpuMemoryBuffer> nb(
- new OzoneGpuMemoryBuffer(gfx::GpuMemoryBufferId(0), size, format,
- std::move(client_native_pixmap), pixmap));
- return std::move(nb);
-}
-
-bool OzoneGpuMemoryBuffer::Map() {
- DCHECK(!mapped_);
- if (!client_pixmap_->Map())
- return false;
- mapped_ = true;
- return mapped_;
-}
-
-void* OzoneGpuMemoryBuffer::memory(size_t plane) {
- DCHECK(mapped_);
- DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_));
- return client_pixmap_->Map();
-}
-
-void OzoneGpuMemoryBuffer::Unmap() {
- DCHECK(mapped_);
- client_pixmap_->Unmap();
- mapped_ = false;
-}
-
-int OzoneGpuMemoryBuffer::stride(size_t plane) const {
- DCHECK_LT(plane, gfx::NumberOfPlanesForBufferFormat(format_));
- int stride;
- client_pixmap_->GetStride(&stride);
- return stride;
-}
-
-gfx::GpuMemoryBufferHandle OzoneGpuMemoryBuffer::GetHandle() const {
- gfx::GpuMemoryBufferHandle handle;
- handle.type = gfx::OZONE_NATIVE_PIXMAP;
- handle.id = id_;
- return handle;
-}
-
-gfx::GpuMemoryBufferType OzoneGpuMemoryBuffer::GetBufferType() const {
- return gfx::OZONE_NATIVE_PIXMAP;
-}
-
-#if defined(USE_OZONE)
-scoped_refptr<ui::NativePixmap> OzoneGpuMemoryBuffer::GetNativePixmap() {
- return native_pixmap_;
-}
-#endif
-
-} // namespace mus
diff --git a/chromium/components/mus/gles2/ozone_gpu_memory_buffer.h b/chromium/components/mus/gles2/ozone_gpu_memory_buffer.h
deleted file mode 100644
index c5b2ea8a24b..00000000000
--- a/chromium/components/mus/gles2/ozone_gpu_memory_buffer.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_
-#define COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_
-
-#include <memory>
-
-#include "components/mus/common/gpu_memory_buffer_impl.h"
-#include "ui/gfx/geometry/size.h"
-#include "ui/gfx/gpu_memory_buffer.h"
-#include "ui/gfx/native_widget_types.h"
-
-namespace ui {
-class ClientNativePixmap;
-class NativePixmap;
-} // namespace ui
-
-namespace mus {
-
-// A not-mojo GpuMemoryBuffer implementation solely for use internally to mus
-// for scanout buffers. Note that OzoneGpuMemoryBuffer is for use on the client
-// (aka CC thread).
-class OzoneGpuMemoryBuffer : public mus::GpuMemoryBufferImpl {
- public:
- ~OzoneGpuMemoryBuffer() override;
-
- // gfx::GpuMemoryBuffer implementation
- bool Map() override;
- void Unmap() override;
- void* memory(size_t plane) override;
- int stride(size_t plane) const override;
- gfx::GpuMemoryBufferHandle GetHandle() const override;
-
- // Returns the type of this GpuMemoryBufferImpl.
- gfx::GpuMemoryBufferType GetBufferType() const override;
- scoped_refptr<ui::NativePixmap> GetNativePixmap() override;
-
- // Create a NativeBuffer. The implementation (mus-specific) will call directly
- // into ozone to allocate the buffer. See the version in the .cc file.
- static std::unique_ptr<gfx::GpuMemoryBuffer> CreateOzoneGpuMemoryBuffer(
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage,
- gfx::AcceleratedWidget widget);
-
- // Cribbed from content/common/gpu/client/gpu_memory_buffer_impl.h
- static OzoneGpuMemoryBuffer* FromClientBuffer(ClientBuffer buffer);
-
- private:
- // TODO(rjkroege): It is conceivable that we do not need an |id| here. It
- // would seem to be a legacy of content leaking into gfx. In a mojo context,
- // perhaps it should be a mojo handle instead.
- OzoneGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- gfx::BufferFormat format,
- std::unique_ptr<ui::ClientNativePixmap> client_pixmap,
- scoped_refptr<ui::NativePixmap> native_pixmap);
-
- // The real backing buffer.
- // From content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.h
- std::unique_ptr<ui::ClientNativePixmap> client_pixmap_;
- scoped_refptr<ui::NativePixmap> native_pixmap_;
-
- DISALLOW_COPY_AND_ASSIGN(OzoneGpuMemoryBuffer);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_
diff --git a/chromium/components/mus/gles2/raster_thread_helper.cc b/chromium/components/mus/gles2/raster_thread_helper.cc
deleted file mode 100644
index 93e37405e78..00000000000
--- a/chromium/components/mus/gles2/raster_thread_helper.cc
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gles2/raster_thread_helper.h"
-
-#include "base/logging.h"
-#include "base/threading/simple_thread.h"
-#include "cc/raster/single_thread_task_graph_runner.h"
-
-namespace gles2 {
-
-RasterThreadHelper::RasterThreadHelper()
- : task_graph_runner_(new cc::SingleThreadTaskGraphRunner) {
- task_graph_runner_->Start("CompositorTileWorker1",
- base::SimpleThread::Options());
-}
-
-RasterThreadHelper::~RasterThreadHelper() {
- task_graph_runner_->Shutdown();
-}
-
-cc::TaskGraphRunner* RasterThreadHelper::task_graph_runner() {
- return task_graph_runner_.get();
-}
-
-} // namespace gles2
diff --git a/chromium/components/mus/gles2/raster_thread_helper.h b/chromium/components/mus/gles2/raster_thread_helper.h
deleted file mode 100644
index a43dfab0810..00000000000
--- a/chromium/components/mus/gles2/raster_thread_helper.h
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GLES2_RASTER_THREAD_HELPER_H_
-#define COMPONENTS_MUS_GLES2_RASTER_THREAD_HELPER_H_
-
-#include <memory>
-
-#include "base/macros.h"
-
-namespace cc {
-class TaskGraphRunner;
-class SingleThreadTaskGraphRunner;
-}
-
-namespace gles2 {
-
-class RasterThreadHelper {
- public:
- RasterThreadHelper();
- ~RasterThreadHelper();
-
- cc::TaskGraphRunner* task_graph_runner();
-
- private:
- std::unique_ptr<cc::SingleThreadTaskGraphRunner> task_graph_runner_;
-
- DISALLOW_COPY_AND_ASSIGN(RasterThreadHelper);
-};
-
-} // namespace gles2
-
-#endif // COMPONENTS_MUS_GLES2_RASTER_THREAD_HELPER_H_
diff --git a/chromium/components/mus/gpu/DEPS b/chromium/components/mus/gpu/DEPS
deleted file mode 100644
index 004a2b9f68f..00000000000
--- a/chromium/components/mus/gpu/DEPS
+++ /dev/null
@@ -1,21 +0,0 @@
-include_rules = [
- "+gpu/command_buffer",
- "+gpu/config",
- "+gpu/ipc/common",
- "+gpu/ipc/client/gpu_channel_host.h",
- "+gpu/ipc/service",
- "+media/gpu/ipc/service",
-]
-
-specific_include_rules = {
- "gpu_service_mus\.h": [
- # A GpuChannelHost is used by mus locally.
- "+gpu/ipc/client/gpu_channel_host.h",
- ],
-
- "mus_gpu_memory_buffer_manager\.cc": [
- # The GpuMemoryBufferManager implementation used by mus locally.
- "+gpu/ipc/client/gpu_memory_buffer_impl.h",
- "+gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h",
- ]
-}
diff --git a/chromium/components/mus/gpu/OWNERS b/chromium/components/mus/gpu/OWNERS
deleted file mode 100644
index 1f1af6bcc54..00000000000
--- a/chromium/components/mus/gpu/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-fsamuel@chromium.org
-rjkroege@chromium.org
diff --git a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h b/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h
deleted file mode 100644
index ee377aadc49..00000000000
--- a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_DELEGATE_H_
-#define COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_DELEGATE_H_
-
-#include "cc/surfaces/surface_id.h"
-
-namespace mus {
-namespace gpu {
-
-class CompositorFrameSinkImpl;
-
-// A CompositorFrameSinkDelegate decouples CompositorFrameSinks from their
-// factories enabling them to be unit tested.
-class CompositorFrameSinkDelegate {
- public:
- virtual void CompositorFrameSinkConnectionLost(int sink_id) = 0;
-
- virtual cc::SurfaceId GenerateSurfaceId() = 0;
-};
-
-} // namespace gpu
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_DELEGATE_H_
diff --git a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.cc b/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.cc
deleted file mode 100644
index 5c52940a984..00000000000
--- a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.h"
-
-#include "base/memory/ptr_util.h"
-#include "cc/surfaces/surface_id.h"
-#include "components/mus/gpu/display_compositor/compositor_frame_sink_impl.h"
-
-namespace mus {
-namespace gpu {
-
-CompositorFrameSinkFactoryImpl::CompositorFrameSinkFactoryImpl(
- uint32_t client_id,
- mojo::InterfaceRequest<mojom::CompositorFrameSinkFactory> request,
- const scoped_refptr<SurfacesState>& surfaces_state)
- : client_id_(client_id),
- surfaces_state_(surfaces_state),
- allocator_(client_id),
- binding_(this, std::move(request)) {}
-
-CompositorFrameSinkFactoryImpl::~CompositorFrameSinkFactoryImpl() {}
-
-void CompositorFrameSinkFactoryImpl::CompositorFrameSinkConnectionLost(
- int local_id) {
- sinks_.erase(local_id);
-}
-
-cc::SurfaceId CompositorFrameSinkFactoryImpl::GenerateSurfaceId() {
- return allocator_.GenerateId();
-}
-
-void CompositorFrameSinkFactoryImpl::CreateCompositorFrameSink(
- uint32_t local_id,
- uint64_t nonce,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> sink,
- mojom::CompositorFrameSinkClientPtr client) {
- // TODO(fsamuel): Use nonce once patch lands:
- // https://codereview.chromium.org/1996783002/
- sinks_[local_id] = base::WrapUnique(new CompositorFrameSinkImpl(
- this, local_id, surfaces_state_, std::move(sink), std::move(client)));
-}
-
-} // namespace gpu
-} // namespace mus
diff --git a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.h b/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.h
deleted file mode 100644
index 50aa0a5a0d3..00000000000
--- a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_factory_impl.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_FACTORY_IMPL_H_
-#define COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_FACTORY_IMPL_H_
-
-#include "cc/surfaces/surface_id_allocator.h"
-#include "components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h"
-#include "components/mus/public/interfaces/gpu/display_compositor.mojom.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-
-namespace mus {
-namespace gpu {
-
-class CompositorFrameSinkImpl;
-
-class CompositorFrameSinkFactoryImpl : public mojom::CompositorFrameSinkFactory,
- public CompositorFrameSinkDelegate {
- public:
- CompositorFrameSinkFactoryImpl(
- uint32_t client_id,
- mojo::InterfaceRequest<mojom::CompositorFrameSinkFactory> request,
- const scoped_refptr<SurfacesState>& surfaces_state);
- ~CompositorFrameSinkFactoryImpl() override;
-
- uint32_t client_id() const { return client_id_; }
-
- void CompositorFrameSinkConnectionLost(int local_id) override;
- cc::SurfaceId GenerateSurfaceId() override;
-
- // mojom::CompositorFrameSinkFactory implementation.
- void CreateCompositorFrameSink(
- uint32_t local_id,
- uint64_t nonce,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> sink,
- mojom::CompositorFrameSinkClientPtr client) override;
-
- private:
- const uint32_t client_id_;
- scoped_refptr<SurfacesState> surfaces_state_;
- cc::SurfaceIdAllocator allocator_;
- using CompositorFrameSinkMap =
- std::map<uint32_t, std::unique_ptr<CompositorFrameSinkImpl>>;
- CompositorFrameSinkMap sinks_;
- mojo::StrongBinding<mojom::CompositorFrameSinkFactory> binding_;
-
- DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkFactoryImpl);
-};
-
-} // namespace gpu
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_FACTORY_IMPL_H_
diff --git a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.cc b/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.cc
deleted file mode 100644
index 80bb15197df..00000000000
--- a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gpu/display_compositor/compositor_frame_sink_impl.h"
-
-#include "cc/ipc/compositor_frame.mojom.h"
-#include "cc/surfaces/surface_factory.h"
-#include "components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h"
-
-namespace mus {
-namespace gpu {
-
-namespace {
-
-void CallCallback(
- const mojom::CompositorFrameSink::SubmitCompositorFrameCallback& callback,
- cc::SurfaceDrawStatus draw_status) {
- callback.Run(static_cast<mojom::CompositorFrameDrawStatus>(draw_status));
-}
-}
-
-CompositorFrameSinkImpl::CompositorFrameSinkImpl(
- CompositorFrameSinkDelegate* delegate,
- int sink_id,
- const scoped_refptr<SurfacesState>& surfaces_state,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> request,
- mojom::CompositorFrameSinkClientPtr client)
- : delegate_(delegate),
- surfaces_state_(surfaces_state),
- sink_id_(sink_id),
- begin_frame_source_(nullptr),
- needs_begin_frame_(false),
- factory_(surfaces_state->manager(), this),
- client_(std::move(client)),
- binding_(this, std::move(request)) {
- DCHECK(delegate_);
- binding_.set_connection_error_handler(base::Bind(
- &CompositorFrameSinkImpl::OnConnectionLost, base::Unretained(this)));
-}
-
-CompositorFrameSinkImpl::~CompositorFrameSinkImpl() {}
-
-void CompositorFrameSinkImpl::SetNeedsBeginFrame(bool needs_begin_frame) {
- if (needs_begin_frame_ == needs_begin_frame)
- return;
-
- needs_begin_frame_ = needs_begin_frame;
- if (begin_frame_source_) {
- if (needs_begin_frame_)
- begin_frame_source_->AddObserver(this);
- else
- begin_frame_source_->RemoveObserver(this);
- }
-}
-
-void CompositorFrameSinkImpl::SubmitCompositorFrame(
- cc::CompositorFrame compositor_frame,
- const SubmitCompositorFrameCallback& callback) {
- gfx::Size frame_size =
- compositor_frame.delegated_frame_data->render_pass_list.back()
- ->output_rect.size();
- if (frame_size.IsEmpty() || frame_size != last_submitted_frame_size_) {
- if (!surface_id_.is_null())
- factory_.Destroy(surface_id_);
- // TODO(fsamuel): The allocator should live on CompositorFrameSinkFactory.
- surface_id_ = delegate_->GenerateSurfaceId();
- factory_.Create(surface_id_);
- last_submitted_frame_size_ = frame_size;
- }
- factory_.SubmitCompositorFrame(surface_id_, std::move(compositor_frame),
- base::Bind(&CallCallback, callback));
-}
-
-void CompositorFrameSinkImpl::ReturnResources(
- const cc::ReturnedResourceArray& resources) {
- if (!client_)
- return;
-
- client_->ReturnResources(mojo::Array<cc::ReturnedResource>::From(resources));
-}
-
-void CompositorFrameSinkImpl::WillDrawSurface(const cc::SurfaceId& surface_id,
- const gfx::Rect& damage_rect) {
- NOTIMPLEMENTED();
-}
-
-void CompositorFrameSinkImpl::SetBeginFrameSource(
- cc::BeginFrameSource* begin_frame_source) {
- begin_frame_source_ = begin_frame_source;
-}
-
-void CompositorFrameSinkImpl::OnBeginFrame(const cc::BeginFrameArgs& args) {
- // TODO(fsamuel): Implement this.
-}
-
-const cc::BeginFrameArgs& CompositorFrameSinkImpl::LastUsedBeginFrameArgs()
- const {
- // TODO(fsamuel): Implement this.
- return last_used_begin_frame_args_;
-}
-
-void CompositorFrameSinkImpl::OnBeginFrameSourcePausedChanged(bool paused) {
- // TODO(fsamuel): Implement this.
-}
-
-void CompositorFrameSinkImpl::OnConnectionLost() {
- delegate_->CompositorFrameSinkConnectionLost(sink_id_);
-}
-
-} // namespace gpu
-} // namespace mus
diff --git a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.h b/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.h
deleted file mode 100644
index e402a7ce2ce..00000000000
--- a/chromium/components/mus/gpu/display_compositor/compositor_frame_sink_impl.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_IMPL_H_
-#define COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_IMPL_H_
-
-#include "base/memory/ref_counted.h"
-#include "cc/scheduler/begin_frame_source.h"
-#include "cc/surfaces/surface_factory.h"
-#include "cc/surfaces/surface_factory_client.h"
-#include "cc/surfaces/surface_id.h"
-#include "components/mus/public/interfaces/gpu/display_compositor.mojom.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-
-namespace mus {
-namespace gpu {
-
-class CompositorFrameSinkDelegate;
-
-// A client presents visuals to screen by submitting CompositorFrames to a
-// CompositorFrameSink.
-class CompositorFrameSinkImpl : public cc::SurfaceFactoryClient,
- public mojom::CompositorFrameSink,
- public cc::BeginFrameObserver {
- public:
- CompositorFrameSinkImpl(
- CompositorFrameSinkDelegate* delegate,
- int sink_id,
- const scoped_refptr<SurfacesState>& surfaces_state,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> request,
- mojom::CompositorFrameSinkClientPtr client);
- ~CompositorFrameSinkImpl() override;
-
- // mojom::CompositorFrameSink implementation.
- void SetNeedsBeginFrame(bool needs_begin_frame) override;
- void SubmitCompositorFrame(
- cc::CompositorFrame compositor_frame,
- const SubmitCompositorFrameCallback& callback) override;
-
- private:
- // SurfaceFactoryClient implementation.
- void ReturnResources(const cc::ReturnedResourceArray& resources) override;
- void WillDrawSurface(const cc::SurfaceId& surface_id,
- const gfx::Rect& damage_rect) override;
- void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
-
- // BeginFrameObserver implementation.
- void OnBeginFrame(const cc::BeginFrameArgs& args) override;
- const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override;
- void OnBeginFrameSourcePausedChanged(bool paused) override;
-
- void OnConnectionLost();
-
- CompositorFrameSinkDelegate* const delegate_;
- scoped_refptr<SurfacesState> surfaces_state_;
- const int sink_id_;
- cc::BeginFrameSource* begin_frame_source_;
- bool needs_begin_frame_;
- cc::BeginFrameArgs last_used_begin_frame_args_;
- cc::SurfaceFactory factory_;
- cc::SurfaceId surface_id_;
- gfx::Size last_submitted_frame_size_;
- mojom::CompositorFrameSinkClientPtr client_;
- mojo::Binding<mojom::CompositorFrameSink> binding_;
-
- DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkImpl);
-};
-
-} // namespace gpu
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_COMPOSITOR_FRAME_SINK_IMPL_H_
diff --git a/chromium/components/mus/gpu/display_compositor/display_compositor_impl.cc b/chromium/components/mus/gpu/display_compositor/display_compositor_impl.cc
deleted file mode 100644
index cf9a24df684..00000000000
--- a/chromium/components/mus/gpu/display_compositor/display_compositor_impl.cc
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gpu/display_compositor/display_compositor_impl.h"
-
-#include "components/mus/gpu/display_compositor/display_impl.h"
-
-namespace mus {
-namespace gpu {
-
-DisplayCompositorImpl::DisplayCompositorImpl(
- mojo::InterfaceRequest<mojom::DisplayCompositor> request)
- : binding_(this, std::move(request)) {}
-
-DisplayCompositorImpl::~DisplayCompositorImpl() {}
-
-void DisplayCompositorImpl::CreateDisplay(
- int accelerated_widget,
- mojo::InterfaceRequest<mojom::Display> display,
- mojom::DisplayHostPtr host,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> sink,
- mojom::CompositorFrameSinkClientPtr client) {
- NOTIMPLEMENTED();
-}
-
-} // namespace gpu
-} // namespace mus
diff --git a/chromium/components/mus/gpu/display_compositor/display_compositor_impl.h b/chromium/components/mus/gpu/display_compositor/display_compositor_impl.h
deleted file mode 100644
index 237cc108b7c..00000000000
--- a/chromium/components/mus/gpu/display_compositor/display_compositor_impl.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_DISPLAY_COMPOSITOR_IMPL_H_
-#define COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_DISPLAY_COMPOSITOR_IMPL_H_
-
-#include "components/mus/public/interfaces/gpu/display_compositor.mojom.h"
-#include "components/mus/public/interfaces/gpu/display_compositor_host.mojom.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-
-namespace mus {
-namespace gpu {
-
-class DisplayCompositorImpl : public mojom::DisplayCompositor {
- public:
- explicit DisplayCompositorImpl(
- mojo::InterfaceRequest<mojom::DisplayCompositor> request);
- ~DisplayCompositorImpl() override;
-
- // mojom::DisplayCompositor implementation.
- void CreateDisplay(int accelerated_widget,
- mojo::InterfaceRequest<mojom::Display> display,
- mojom::DisplayHostPtr host,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> sink,
- mojom::CompositorFrameSinkClientPtr client) override;
-
- private:
- mojo::StrongBinding<mojom::DisplayCompositor> binding_;
-
- DISALLOW_COPY_AND_ASSIGN(DisplayCompositorImpl);
-};
-
-} // namespace gpu
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_DISPLAY_COMPOSITOR_IMPL_H_
diff --git a/chromium/components/mus/gpu/display_compositor/display_impl.cc b/chromium/components/mus/gpu/display_compositor/display_impl.cc
deleted file mode 100644
index 274c67acbb1..00000000000
--- a/chromium/components/mus/gpu/display_compositor/display_impl.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gpu/display_compositor/display_impl.h"
-
-#include "components/mus/gpu/display_compositor/compositor_frame_sink_impl.h"
-
-namespace mus {
-namespace gpu {
-
-DisplayImpl::DisplayImpl(
- int accelerated_widget,
- mojo::InterfaceRequest<mojom::Display> display,
- mojom::DisplayHostPtr host,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> sink,
- mojom::CompositorFrameSinkClientPtr client,
- const scoped_refptr<SurfacesState>& surfaces_state)
- : binding_(this, std::move(display)) {
- const uint32_t client_id = 1;
- sink_.reset(new CompositorFrameSinkImpl(this, client_id, surfaces_state,
- std::move(sink), std::move(client)));
-}
-
-DisplayImpl::~DisplayImpl() {}
-
-void DisplayImpl::CreateClient(
- uint32_t client_id,
- mojo::InterfaceRequest<mojom::DisplayClient> client) {
- NOTIMPLEMENTED();
-}
-
-void DisplayImpl::CompositorFrameSinkConnectionLost(int sink_id) {
- NOTIMPLEMENTED();
-}
-
-cc::SurfaceId DisplayImpl::GenerateSurfaceId() {
- NOTIMPLEMENTED();
- return cc::SurfaceId();
-}
-
-} // namespace gpu
-} // namespace mus
diff --git a/chromium/components/mus/gpu/display_compositor/display_impl.h b/chromium/components/mus/gpu/display_compositor/display_impl.h
deleted file mode 100644
index c667bcbde03..00000000000
--- a/chromium/components/mus/gpu/display_compositor/display_impl.h
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_DISPLAY_IMPL_H_
-#define COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_DISPLAY_IMPL_H_
-
-#include "components/mus/gpu/display_compositor/compositor_frame_sink_delegate.h"
-#include "components/mus/public/interfaces/gpu/display_compositor_host.mojom.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "mojo/public/cpp/bindings/binding.h"
-
-namespace mus {
-namespace gpu {
-
-class DisplayImpl : public mojom::Display, public CompositorFrameSinkDelegate {
- public:
- DisplayImpl(int accelerated_widget,
- mojo::InterfaceRequest<mojom::Display> display,
- mojom::DisplayHostPtr host,
- mojo::InterfaceRequest<mojom::CompositorFrameSink> sink,
- mojom::CompositorFrameSinkClientPtr client,
- const scoped_refptr<SurfacesState>& surfaces_state);
- ~DisplayImpl() override;
-
- // mojom::Display implementation.
- void CreateClient(
- uint32_t client_id,
- mojo::InterfaceRequest<mojom::DisplayClient> client) override;
-
- private:
- // CompositorFrameSinkDelegate implementation:
- void CompositorFrameSinkConnectionLost(int sink_id) override;
- cc::SurfaceId GenerateSurfaceId() override;
-
- std::unique_ptr<CompositorFrameSinkImpl> sink_;
- mojo::Binding<mojom::Display> binding_;
- DISALLOW_COPY_AND_ASSIGN(DisplayImpl);
-};
-
-} // namespace gpu
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_DISPLAY_COMPOSITOR_DISPLAY_IMPL_H_
diff --git a/chromium/components/mus/gpu/gpu_service_impl.cc b/chromium/components/mus/gpu/gpu_service_impl.cc
deleted file mode 100644
index 9ea83820ffe..00000000000
--- a/chromium/components/mus/gpu/gpu_service_impl.cc
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gpu/gpu_service_impl.h"
-
-#include "components/mus/common/gpu_type_converters.h"
-#include "components/mus/gpu/gpu_service_mus.h"
-#include "services/shell/public/cpp/connection.h"
-
-namespace mus {
-
-namespace {
-
-void EstablishGpuChannelDone(
- const mojom::GpuService::EstablishGpuChannelCallback& callback,
- int32_t client_id,
- const IPC::ChannelHandle& channel_handle) {
- // TODO(penghuang): Send the real GPUInfo to the client.
- callback.Run(client_id, mojom::ChannelHandle::From(channel_handle),
- mojom::GpuInfo::From<gpu::GPUInfo>(gpu::GPUInfo()));
-}
-}
-
-GpuServiceImpl::GpuServiceImpl(
- mojo::InterfaceRequest<mojom::GpuService> request,
- shell::Connection* connection)
- : binding_(this, std::move(request)) {}
-
-GpuServiceImpl::~GpuServiceImpl() {}
-
-void GpuServiceImpl::EstablishGpuChannel(
- const mojom::GpuService::EstablishGpuChannelCallback& callback) {
- GpuServiceMus* service = GpuServiceMus::GetInstance();
- // TODO(penghuang): crbug.com/617415 figure out how to generate a meaningful
- // tracing id.
- const uint64_t client_tracing_id = 0;
- // TODO(penghuang): windows server may want to control those flags.
- // Add a private interface for windows server.
- const bool preempts = false;
- const bool allow_view_command_buffers = false;
- const bool allow_real_time_streams = false;
- service->EstablishGpuChannel(
- client_tracing_id, preempts, allow_view_command_buffers,
- allow_real_time_streams, base::Bind(&EstablishGpuChannelDone, callback));
-}
-
-void GpuServiceImpl::CreateGpuMemoryBuffer(
- mojom::GpuMemoryBufferIdPtr id,
- const gfx::Size& size,
- mojom::BufferFormat format,
- mojom::BufferUsage usage,
- uint64_t surface_id,
- const mojom::GpuService::CreateGpuMemoryBufferCallback& callback) {
- NOTIMPLEMENTED();
-}
-
-void GpuServiceImpl::DestroyGpuMemoryBuffer(mojom::GpuMemoryBufferIdPtr id,
- const gpu::SyncToken& sync_token) {
- NOTIMPLEMENTED();
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/gpu/gpu_service_impl.h b/chromium/components/mus/gpu/gpu_service_impl.h
deleted file mode 100644
index 9d5f66ec715..00000000000
--- a/chromium/components/mus/gpu/gpu_service_impl.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GPU_GPU_SERVICE_IMPL_H_
-#define COMPONENTS_MUS_GPU_GPU_SERVICE_IMPL_H_
-
-#include "components/mus/public/interfaces/gpu_memory_buffer.mojom.h"
-#include "components/mus/public/interfaces/gpu_service.mojom.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-
-namespace shell {
-class Connection;
-}
-
-namespace mus {
-
-class GpuServiceImpl : public mojom::GpuService {
- public:
- GpuServiceImpl(mojo::InterfaceRequest<mojom::GpuService> request,
- shell::Connection* connection);
- ~GpuServiceImpl() override;
-
- // mojom::GpuService overrides:
- void EstablishGpuChannel(
- const mojom::GpuService::EstablishGpuChannelCallback& callback) override;
-
- void CreateGpuMemoryBuffer(
- mojom::GpuMemoryBufferIdPtr id,
- const gfx::Size& size,
- mojom::BufferFormat format,
- mojom::BufferUsage usage,
- uint64_t surface_id,
- const mojom::GpuService::CreateGpuMemoryBufferCallback& callback)
- override;
-
- void DestroyGpuMemoryBuffer(mojom::GpuMemoryBufferIdPtr id,
- const gpu::SyncToken& sync_token) override;
-
- private:
- mojo::StrongBinding<GpuService> binding_;
-
- DISALLOW_COPY_AND_ASSIGN(GpuServiceImpl);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_GPU_SERVICE_IMPL_H_
diff --git a/chromium/components/mus/gpu/gpu_service_mus.cc b/chromium/components/mus/gpu/gpu_service_mus.cc
deleted file mode 100644
index 43ddb21ab00..00000000000
--- a/chromium/components/mus/gpu/gpu_service_mus.cc
+++ /dev/null
@@ -1,273 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gpu/gpu_service_mus.h"
-
-#include "base/memory/shared_memory.h"
-#include "base/memory/singleton.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "build/build_config.h"
-#include "components/mus/gpu/mus_gpu_memory_buffer_manager.h"
-#include "gpu/command_buffer/service/gpu_switches.h"
-#include "gpu/command_buffer/service/sync_point_manager.h"
-#include "gpu/config/gpu_info_collector.h"
-#include "gpu/config/gpu_switches.h"
-#include "gpu/config/gpu_util.h"
-#include "gpu/ipc/common/gpu_memory_buffer_support.h"
-#include "gpu/ipc/common/memory_stats.h"
-#include "gpu/ipc/service/gpu_memory_buffer_factory.h"
-#include "ipc/ipc_channel_handle.h"
-#include "ipc/ipc_sync_message_filter.h"
-#include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h"
-#include "media/gpu/ipc/service/gpu_video_decode_accelerator.h"
-#include "media/gpu/ipc/service/gpu_video_encode_accelerator.h"
-#include "media/gpu/ipc/service/media_service.h"
-#include "ui/gl/gl_implementation.h"
-#include "ui/gl/gl_switches.h"
-#include "ui/gl/gpu_switching_manager.h"
-#include "ui/gl/init/gl_factory.h"
-#include "url/gurl.h"
-
-#if defined(USE_OZONE)
-#include "ui/ozone/public/ozone_platform.h"
-#endif
-
-namespace mus {
-namespace {
-
-const int kLocalGpuChannelClientId = 1;
-const uint64_t kLocalGpuChannelClientTracingId = 1;
-
-void EstablishGpuChannelDone(
- int client_id,
- const IPC::ChannelHandle* channel_handle,
- const GpuServiceMus::EstablishGpuChannelCallback& callback) {
- callback.Run(channel_handle ? client_id : -1, *channel_handle);
-}
-}
-
-GpuServiceMus::GpuServiceMus()
- : next_client_id_(kLocalGpuChannelClientId),
- main_task_runner_(base::ThreadTaskRunnerHandle::Get()),
- shutdown_event_(base::WaitableEvent::ResetPolicy::MANUAL,
- base::WaitableEvent::InitialState::NOT_SIGNALED),
- gpu_thread_("GpuThread"),
- io_thread_("GpuIOThread") {
- Initialize();
-}
-
-GpuServiceMus::~GpuServiceMus() {
- // Signal this event before destroying the child process. That way all
- // background threads can cleanup.
- // For example, in the renderer the RenderThread instances will be able to
- // notice shutdown before the render process begins waiting for them to exit.
- shutdown_event_.Signal();
- io_thread_.Stop();
-}
-
-void GpuServiceMus::EstablishGpuChannel(
- uint64_t client_tracing_id,
- bool preempts,
- bool allow_view_command_buffers,
- bool allow_real_time_streams,
- const EstablishGpuChannelCallback& callback) {
- DCHECK(CalledOnValidThread());
-
- if (!gpu_channel_manager_) {
- callback.Run(-1, IPC::ChannelHandle());
- return;
- }
-
- const int client_id = ++next_client_id_;
- IPC::ChannelHandle* channel_handle = new IPC::ChannelHandle;
- gpu_thread_.task_runner()->PostTaskAndReply(
- FROM_HERE,
- base::Bind(&GpuServiceMus::EstablishGpuChannelOnGpuThread,
- base::Unretained(this), client_id, client_tracing_id, preempts,
- allow_view_command_buffers, allow_real_time_streams,
- base::Unretained(channel_handle)),
- base::Bind(&EstablishGpuChannelDone, client_id,
- base::Owned(channel_handle), callback));
-}
-
-gfx::GpuMemoryBufferHandle GpuServiceMus::CreateGpuMemoryBuffer(
- gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage,
- int client_id,
- gpu::SurfaceHandle surface_handle) {
- DCHECK(CalledOnValidThread());
- return gpu_memory_buffer_factory_->CreateGpuMemoryBuffer(
- id, size, format, usage, client_id, surface_handle);
-}
-
-void GpuServiceMus::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
- int client_id,
- const gpu::SyncToken& sync_token) {
- DCHECK(CalledOnValidThread());
-
- if (gpu_channel_manager_)
- gpu_channel_manager_->DestroyGpuMemoryBuffer(id, client_id, sync_token);
-}
-
-void GpuServiceMus::DidCreateOffscreenContext(const GURL& active_url) {
- NOTIMPLEMENTED();
-}
-
-void GpuServiceMus::DidDestroyChannel(int client_id) {
- media_service_->RemoveChannel(client_id);
- NOTIMPLEMENTED();
-}
-
-void GpuServiceMus::DidDestroyOffscreenContext(const GURL& active_url) {
- NOTIMPLEMENTED();
-}
-
-void GpuServiceMus::DidLoseContext(bool offscreen,
- gpu::error::ContextLostReason reason,
- const GURL& active_url) {
- NOTIMPLEMENTED();
-}
-
-void GpuServiceMus::GpuMemoryUmaStats(const gpu::GPUMemoryUmaStats& params) {
- NOTIMPLEMENTED();
-}
-
-void GpuServiceMus::StoreShaderToDisk(int client_id,
- const std::string& key,
- const std::string& shader) {
- NOTIMPLEMENTED();
-}
-
-#if defined(OS_WIN)
-void GpuServiceMus::SendAcceleratedSurfaceCreatedChildWindow(
- gpu::SurfaceHandle parent_window,
- gpu::SurfaceHandle child_window) {
- NOTIMPLEMENTED();
-}
-#endif
-
-void GpuServiceMus::SetActiveURL(const GURL& url) {
- NOTIMPLEMENTED();
-}
-
-void GpuServiceMus::Initialize() {
- DCHECK(CalledOnValidThread());
- base::Thread::Options thread_options(base::MessageLoop::TYPE_DEFAULT, 0);
- thread_options.priority = base::ThreadPriority::NORMAL;
- CHECK(gpu_thread_.StartWithOptions(thread_options));
-
- thread_options = base::Thread::Options(base::MessageLoop::TYPE_IO, 0);
- thread_options.priority = base::ThreadPriority::NORMAL;
-#if defined(OS_ANDROID)
- // TODO(reveman): Remove this in favor of setting it explicitly for each type
- // of process.
- thread_options.priority = base::ThreadPriority::DISPLAY;
-#endif
- CHECK(io_thread_.StartWithOptions(thread_options));
-
- IPC::ChannelHandle channel_handle;
- base::WaitableEvent event(base::WaitableEvent::ResetPolicy::MANUAL,
- base::WaitableEvent::InitialState::NOT_SIGNALED);
- gpu_thread_.task_runner()->PostTask(
- FROM_HERE, base::Bind(&GpuServiceMus::InitializeOnGpuThread,
- base::Unretained(this), &channel_handle, &event));
- event.Wait();
-
- gpu_memory_buffer_manager_local_.reset(
- new MusGpuMemoryBufferManager(this, kLocalGpuChannelClientId));
- gpu_channel_local_ = gpu::GpuChannelHost::Create(
- this, kLocalGpuChannelClientId, gpu_info_, channel_handle,
- &shutdown_event_, gpu_memory_buffer_manager_local_.get());
-}
-
-void GpuServiceMus::InitializeOnGpuThread(IPC::ChannelHandle* channel_handle,
- base::WaitableEvent* event) {
- gpu_info_.video_decode_accelerator_capabilities =
- media::GpuVideoDecodeAccelerator::GetCapabilities(gpu_preferences_);
- gpu_info_.video_encode_accelerator_supported_profiles =
- media::GpuVideoEncodeAccelerator::GetSupportedProfiles(gpu_preferences_);
- gpu_info_.jpeg_decode_accelerator_supported =
- media::GpuJpegDecodeAccelerator::IsSupported();
-
-#if defined(USE_OZONE)
- ui::OzonePlatform::InitializeForGPU();
-#endif
-
- if (gpu::GetNativeGpuMemoryBufferType() != gfx::EMPTY_BUFFER) {
- gpu_memory_buffer_factory_ =
- gpu::GpuMemoryBufferFactory::CreateNativeType();
- }
-
- if (!gl::init::InitializeGLOneOff())
- VLOG(1) << "gl::init::InitializeGLOneOff failed";
-
- DCHECK(!owned_sync_point_manager_);
- const bool allow_threaded_wait = false;
- owned_sync_point_manager_.reset(
- new gpu::SyncPointManager(allow_threaded_wait));
-
- // Defer creation of the render thread. This is to prevent it from handling
- // IPC messages before the sandbox has been enabled and all other necessary
- // initialization has succeeded.
- // TODO(penghuang): implement a watchdog.
- gpu::GpuWatchdog* watchdog = nullptr;
- gpu_channel_manager_.reset(new gpu::GpuChannelManager(
- gpu_preferences_, this, watchdog,
- base::ThreadTaskRunnerHandle::Get().get(), io_thread_.task_runner().get(),
- &shutdown_event_, owned_sync_point_manager_.get(),
- gpu_memory_buffer_factory_.get()));
-
- media_service_.reset(new media::MediaService(gpu_channel_manager_.get()));
-
- const bool preempts = true;
- const bool allow_view_command_buffers = true;
- const bool allow_real_time_streams = true;
- EstablishGpuChannelOnGpuThread(
- kLocalGpuChannelClientId, kLocalGpuChannelClientTracingId, preempts,
- allow_view_command_buffers, allow_real_time_streams, channel_handle);
- event->Signal();
-}
-
-void GpuServiceMus::EstablishGpuChannelOnGpuThread(
- int client_id,
- uint64_t client_tracing_id,
- bool preempts,
- bool allow_view_command_buffers,
- bool allow_real_time_streams,
- IPC::ChannelHandle* channel_handle) {
- if (gpu_channel_manager_) {
- *channel_handle = gpu_channel_manager_->EstablishChannel(
- client_id, client_tracing_id, preempts, allow_view_command_buffers,
- allow_real_time_streams);
- media_service_->AddChannel(client_id);
- }
-}
-
-bool GpuServiceMus::IsMainThread() {
- return main_task_runner_->BelongsToCurrentThread();
-}
-
-scoped_refptr<base::SingleThreadTaskRunner>
-GpuServiceMus::GetIOThreadTaskRunner() {
- return io_thread_.task_runner();
-}
-
-std::unique_ptr<base::SharedMemory> GpuServiceMus::AllocateSharedMemory(
- size_t size) {
- std::unique_ptr<base::SharedMemory> shm(new base::SharedMemory());
- if (!shm->CreateAnonymous(size))
- return std::unique_ptr<base::SharedMemory>();
- return shm;
-}
-
-// static
-GpuServiceMus* GpuServiceMus::GetInstance() {
- return base::Singleton<GpuServiceMus,
- base::LeakySingletonTraits<GpuServiceMus>>::get();
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/gpu/gpu_service_mus.h b/chromium/components/mus/gpu/gpu_service_mus.h
deleted file mode 100644
index b6bfd1b69f5..00000000000
--- a/chromium/components/mus/gpu/gpu_service_mus.h
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GPU_GPU_SERVICE_MUS_H_
-#define COMPONENTS_MUS_GPU_GPU_SERVICE_MUS_H_
-
-#include "base/callback.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/threading/non_thread_safe.h"
-#include "base/threading/thread.h"
-#include "build/build_config.h"
-#include "gpu/command_buffer/service/gpu_preferences.h"
-#include "gpu/config/gpu_info.h"
-#include "gpu/ipc/client/gpu_channel_host.h"
-#include "gpu/ipc/common/surface_handle.h"
-#include "gpu/ipc/service/gpu_channel.h"
-#include "gpu/ipc/service/gpu_channel_manager.h"
-#include "gpu/ipc/service/gpu_channel_manager_delegate.h"
-#include "gpu/ipc/service/gpu_config.h"
-#include "gpu/ipc/service/x_util.h"
-#include "ui/gfx/native_widget_types.h"
-
-namespace base {
-template <typename T>
-struct DefaultSingletonTraits;
-}
-
-namespace IPC {
-struct ChannelHandle;
-}
-
-namespace gpu {
-class GpuChannelHost;
-class GpuMemoryBufferFactory;
-class SyncPointManager;
-}
-
-namespace media {
-class MediaService;
-}
-
-namespace mus {
-
-class MusGpuMemoryBufferManager;
-
-// TODO(fsamuel): GpuServiceMus is intended to be the Gpu thread within Mus.
-// Similar to GpuChildThread, it is a GpuChannelManagerDelegate and will have a
-// GpuChannelManager.
-class GpuServiceMus : public gpu::GpuChannelManagerDelegate,
- public gpu::GpuChannelHostFactory,
- public base::NonThreadSafe {
- public:
- typedef base::Callback<void(int client_id, const IPC::ChannelHandle&)>
- EstablishGpuChannelCallback;
- void EstablishGpuChannel(uint64_t client_tracing_id,
- bool preempts,
- bool allow_view_command_buffers,
- bool allow_real_time_streams,
- const EstablishGpuChannelCallback& callback);
- gfx::GpuMemoryBufferHandle CreateGpuMemoryBuffer(
- gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage,
- int client_id,
- gpu::SurfaceHandle surface_handle);
- gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferFromeHandle(
- gfx::GpuMemoryBufferHandle buffer_handle,
- gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- gfx::BufferFormat format,
- int client_id);
- void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
- int client_id,
- const gpu::SyncToken& sync_token);
-
- gpu::GpuChannelManager* gpu_channel_manager() const {
- return gpu_channel_manager_.get();
- }
-
- gpu::GpuMemoryBufferFactory* gpu_memory_buffer_factory() const {
- return gpu_memory_buffer_factory_.get();
- }
-
- scoped_refptr<gpu::GpuChannelHost> gpu_channel_local() const {
- return gpu_channel_local_;
- }
-
- const gpu::GPUInfo& gpu_info() const { return gpu_info_; }
-
- // GpuChannelManagerDelegate overrides:
- void DidCreateOffscreenContext(const GURL& active_url) override;
- void DidDestroyChannel(int client_id) override;
- void DidDestroyOffscreenContext(const GURL& active_url) override;
- void DidLoseContext(bool offscreen,
- gpu::error::ContextLostReason reason,
- const GURL& active_url) override;
- void GpuMemoryUmaStats(const gpu::GPUMemoryUmaStats& params) override;
- void StoreShaderToDisk(int client_id,
- const std::string& key,
- const std::string& shader) override;
-#if defined(OS_WIN)
- void SendAcceleratedSurfaceCreatedChildWindow(
- gpu::SurfaceHandle parent_window,
- gpu::SurfaceHandle child_window) override;
-#endif
- void SetActiveURL(const GURL& url) override;
-
- // GpuChannelHostFactory overrides:
- bool IsMainThread() override;
- scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override;
- std::unique_ptr<base::SharedMemory> AllocateSharedMemory(
- size_t size) override;
-
- static GpuServiceMus* GetInstance();
-
- private:
- friend struct base::DefaultSingletonTraits<GpuServiceMus>;
-
- GpuServiceMus();
- ~GpuServiceMus() override;
-
- void Initialize();
- void InitializeOnGpuThread(IPC::ChannelHandle* channel_handle,
- base::WaitableEvent* event);
- void EstablishGpuChannelOnGpuThread(int client_id,
- uint64_t client_tracing_id,
- bool preempts,
- bool allow_view_command_buffers,
- bool allow_real_time_streams,
- IPC::ChannelHandle* channel_handle);
-
- // The next client id.
- int next_client_id_;
-
- // The main thread task runner.
- scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
-
- // An event that will be signalled when we shutdown.
- base::WaitableEvent shutdown_event_;
-
- // The main thread for GpuService.
- base::Thread gpu_thread_;
-
- // The thread that handles IO events for GpuService.
- base::Thread io_thread_;
-
- std::unique_ptr<gpu::SyncPointManager> owned_sync_point_manager_;
-
- std::unique_ptr<gpu::GpuChannelManager> gpu_channel_manager_;
-
- std::unique_ptr<media::MediaService> media_service_;
-
- std::unique_ptr<gpu::GpuMemoryBufferFactory> gpu_memory_buffer_factory_;
-
- // A GPU memory buffer manager used locally.
- std::unique_ptr<MusGpuMemoryBufferManager> gpu_memory_buffer_manager_local_;
-
- // A GPU channel used locally.
- scoped_refptr<gpu::GpuChannelHost> gpu_channel_local_;
-
- gpu::GpuPreferences gpu_preferences_;
-
- // Information about the GPU, such as device and vendor ID.
- gpu::GPUInfo gpu_info_;
-
- DISALLOW_COPY_AND_ASSIGN(GpuServiceMus);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_GPU_SERVICE_MUS_H_
diff --git a/chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.cc b/chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.cc
deleted file mode 100644
index d9ecbd3257a..00000000000
--- a/chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.cc
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/gpu/mus_gpu_memory_buffer_manager.h"
-
-#include "base/logging.h"
-#include "components/mus/common/generic_shared_memory_id_generator.h"
-#include "components/mus/gpu/gpu_service_mus.h"
-#include "gpu/ipc/client/gpu_memory_buffer_impl.h"
-#include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h"
-#include "gpu/ipc/common/gpu_memory_buffer_support.h"
-#include "gpu/ipc/service/gpu_memory_buffer_factory.h"
-
-namespace mus {
-
-namespace {
-
-MusGpuMemoryBufferManager* g_gpu_memory_buffer_manager = nullptr;
-
-bool IsNativeGpuMemoryBufferFactoryConfigurationSupported(
- gfx::BufferFormat format,
- gfx::BufferUsage usage) {
- switch (gpu::GetNativeGpuMemoryBufferType()) {
- case gfx::SHARED_MEMORY_BUFFER:
- return false;
- case gfx::IO_SURFACE_BUFFER:
- case gfx::SURFACE_TEXTURE_BUFFER:
- case gfx::OZONE_NATIVE_PIXMAP:
- return gpu::IsNativeGpuMemoryBufferConfigurationSupported(format, usage);
- default:
- NOTREACHED();
- return false;
- }
-}
-}
-
-MusGpuMemoryBufferManager* MusGpuMemoryBufferManager::current() {
- return g_gpu_memory_buffer_manager;
-}
-
-MusGpuMemoryBufferManager::MusGpuMemoryBufferManager(GpuServiceMus* gpu_service,
- int client_id)
- : gpu_service_(gpu_service), client_id_(client_id), weak_factory_(this) {
- DCHECK(!g_gpu_memory_buffer_manager);
- g_gpu_memory_buffer_manager = this;
-}
-
-MusGpuMemoryBufferManager::~MusGpuMemoryBufferManager() {
- g_gpu_memory_buffer_manager = nullptr;
-}
-
-std::unique_ptr<gfx::GpuMemoryBuffer>
-MusGpuMemoryBufferManager::AllocateGpuMemoryBuffer(
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage,
- gpu::SurfaceHandle surface_handle) {
- gfx::GpuMemoryBufferId id = GetNextGenericSharedMemoryId();
- const bool is_native =
- IsNativeGpuMemoryBufferFactoryConfigurationSupported(format, usage);
- if (is_native) {
- gfx::GpuMemoryBufferHandle handle =
- gpu_service_->gpu_memory_buffer_factory()->CreateGpuMemoryBuffer(
- id, size, format, usage, client_id_, surface_handle);
- if (handle.is_null())
- return nullptr;
- return gpu::GpuMemoryBufferImpl::CreateFromHandle(
- handle, size, format, usage,
- base::Bind(&MusGpuMemoryBufferManager::DestroyGpuMemoryBuffer,
- weak_factory_.GetWeakPtr(), id, client_id_, is_native));
- }
-
- DCHECK(gpu::GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage))
- << static_cast<int>(usage);
- return gpu::GpuMemoryBufferImplSharedMemory::Create(
- id, size, format,
- base::Bind(&MusGpuMemoryBufferManager::DestroyGpuMemoryBuffer,
- weak_factory_.GetWeakPtr(), id, client_id_, is_native));
-}
-
-std::unique_ptr<gfx::GpuMemoryBuffer>
-MusGpuMemoryBufferManager::CreateGpuMemoryBufferFromHandle(
- const gfx::GpuMemoryBufferHandle& handle,
- const gfx::Size& size,
- gfx::BufferFormat format) {
- NOTIMPLEMENTED();
- return nullptr;
-}
-
-gfx::GpuMemoryBuffer*
-MusGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer(
- ClientBuffer buffer) {
- return gpu::GpuMemoryBufferImpl::FromClientBuffer(buffer);
-}
-
-void MusGpuMemoryBufferManager::SetDestructionSyncToken(
- gfx::GpuMemoryBuffer* buffer,
- const gpu::SyncToken& sync_token) {
- static_cast<gpu::GpuMemoryBufferImpl*>(buffer)->set_destruction_sync_token(
- sync_token);
-}
-
-void MusGpuMemoryBufferManager::DestroyGpuMemoryBuffer(
- gfx::GpuMemoryBufferId id,
- int client_id,
- bool is_native,
- const gpu::SyncToken& sync_token) {
- if (is_native) {
- gpu_service_->gpu_channel_manager()->DestroyGpuMemoryBuffer(id, client_id,
- sync_token);
- }
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.h b/chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.h
deleted file mode 100644
index b705dd68bb8..00000000000
--- a/chromium/components/mus/gpu/mus_gpu_memory_buffer_manager.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_GPU_MUS_GPU_MEMORY_BUFFER_MANAGER_H_
-#define COMPONENTS_MUS_GPU_MUS_GPU_MEMORY_BUFFER_MANAGER_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
-
-namespace mus {
-
-class GpuServiceMus;
-
-// This GpuMemoryBufferManager is for establishing a GpuChannelHost used by
-// mus locally.
-class MusGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager {
- public:
- MusGpuMemoryBufferManager(GpuServiceMus* gpu_service, int client_id);
- ~MusGpuMemoryBufferManager() override;
-
- static MusGpuMemoryBufferManager* current();
-
- // Overridden from gpu::GpuMemoryBufferManager:
- std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage,
- gpu::SurfaceHandle surface_handle) override;
- std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle(
- const gfx::GpuMemoryBufferHandle& handle,
- const gfx::Size& size,
- gfx::BufferFormat format) override;
- gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer(
- ClientBuffer buffer) override;
- void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer,
- const gpu::SyncToken& sync_token) override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MusGpuMemoryBufferManager);
-
- void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
- int client_id,
- bool is_native,
- const gpu::SyncToken& sync_token);
-
- GpuServiceMus* gpu_service_;
- const int client_id_;
- base::WeakPtrFactory<MusGpuMemoryBufferManager> weak_factory_;
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_GPU_MUS_GPU_MEMORY_BUFFER_MANAGER_H_
diff --git a/chromium/components/mus/gpu/mus_gpu_unittests_app_manifest.json b/chromium/components/mus/gpu/mus_gpu_unittests_app_manifest.json
deleted file mode 100644
index 26e8caa4802..00000000000
--- a/chromium/components/mus/gpu/mus_gpu_unittests_app_manifest.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "manifest_version": 1,
- "name": "mojo:mus_gpu_unittests_app",
- "display_name": "Mus GPU Unittests",
- "capabilities": {
- "required": {
- "*": { "classes": [ "app" ] }
- }
- }
-}
diff --git a/chromium/components/mus/input_devices/input_device_server.cc b/chromium/components/mus/input_devices/input_device_server.cc
deleted file mode 100644
index 3514eb35669..00000000000
--- a/chromium/components/mus/input_devices/input_device_server.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/input_devices/input_device_server.h"
-
-#include <utility>
-#include <vector>
-
-#include "mojo/public/cpp/bindings/array.h"
-#include "ui/events/devices/input_device.h"
-#include "ui/events/devices/touchscreen_device.h"
-
-namespace mus {
-
-InputDeviceServer::InputDeviceServer() {}
-
-InputDeviceServer::~InputDeviceServer() {
- if (manager_ && ui::DeviceDataManager::HasInstance()) {
- manager_->RemoveObserver(this);
- manager_ = nullptr;
- }
-}
-
-void InputDeviceServer::RegisterAsObserver() {
- if (!manager_ && ui::DeviceDataManager::HasInstance()) {
- manager_ = ui::DeviceDataManager::GetInstance();
- manager_->AddObserver(this);
- }
-}
-
-bool InputDeviceServer::IsRegisteredAsObserver() const {
- return manager_ != nullptr;
-}
-
-void InputDeviceServer::AddInterface(shell::Connection* connection) {
- DCHECK(manager_);
- connection->AddInterface<mojom::InputDeviceServer>(this);
-}
-
-void InputDeviceServer::AddObserver(
- mojom::InputDeviceObserverMojoPtr observer) {
- // We only want to send this message once, so we need to check to make sure
- // device lists are actually complete before sending it to a new observer.
- if (manager_->AreDeviceListsComplete())
- SendDeviceListsComplete(observer.get());
- observers_.AddPtr(std::move(observer));
-}
-
-void InputDeviceServer::OnKeyboardDeviceConfigurationChanged() {
- if (!manager_->AreDeviceListsComplete())
- return;
-
- auto& devices = manager_->GetKeyboardDevices();
- observers_.ForAllPtrs([&devices](mojom::InputDeviceObserverMojo* observer) {
- observer->OnKeyboardDeviceConfigurationChanged(devices);
- });
-}
-
-void InputDeviceServer::OnTouchscreenDeviceConfigurationChanged() {
- if (!manager_->AreDeviceListsComplete())
- return;
-
- auto& devices = manager_->GetTouchscreenDevices();
- observers_.ForAllPtrs([&devices](mojom::InputDeviceObserverMojo* observer) {
- observer->OnTouchscreenDeviceConfigurationChanged(devices);
- });
-}
-
-void InputDeviceServer::OnMouseDeviceConfigurationChanged() {
- if (!manager_->AreDeviceListsComplete())
- return;
-
- auto& devices = manager_->GetMouseDevices();
- observers_.ForAllPtrs([&devices](mojom::InputDeviceObserverMojo* observer) {
- observer->OnMouseDeviceConfigurationChanged(devices);
- });
-}
-
-void InputDeviceServer::OnTouchpadDeviceConfigurationChanged() {
- if (!manager_->AreDeviceListsComplete())
- return;
-
- auto& devices = manager_->GetTouchpadDevices();
- observers_.ForAllPtrs([&devices](mojom::InputDeviceObserverMojo* observer) {
- observer->OnTouchpadDeviceConfigurationChanged(devices);
- });
-}
-
-void InputDeviceServer::OnDeviceListsComplete() {
- observers_.ForAllPtrs([this](mojom::InputDeviceObserverMojo* observer) {
- SendDeviceListsComplete(observer);
- });
-}
-
-void InputDeviceServer::SendDeviceListsComplete(
- mojom::InputDeviceObserverMojo* observer) {
- DCHECK(manager_->AreDeviceListsComplete());
-
- observer->OnDeviceListsComplete(
- manager_->GetKeyboardDevices(), manager_->GetTouchscreenDevices(),
- manager_->GetMouseDevices(), manager_->GetTouchpadDevices());
-}
-
-void InputDeviceServer::Create(shell::Connection* connection,
- mojom::InputDeviceServerRequest request) {
- bindings_.AddBinding(this, std::move(request));
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/input_devices/input_device_server.h b/chromium/components/mus/input_devices/input_device_server.h
deleted file mode 100644
index af0e0e704e6..00000000000
--- a/chromium/components/mus/input_devices/input_device_server.h
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_INPUT_DEVICES_INPUT_DEVICE_SERVER_H_
-#define COMPONENTS_MUS_INPUT_DEVICES_INPUT_DEVICE_SERVER_H_
-
-#include "base/macros.h"
-#include "components/mus/public/interfaces/input_devices/input_device_server.mojom.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
-#include "mojo/public/cpp/bindings/interface_ptr_set.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "ui/events/devices/device_data_manager.h"
-#include "ui/events/devices/input_device_event_observer.h"
-
-namespace mus {
-
-// Listens to DeviceDataManager for updates on input-devices and forwards those
-// updates to any registered InputDeviceObserverMojo in other processes via
-// Mojo IPC. This runs in the mus-ws process.
-class InputDeviceServer
- : public shell::InterfaceFactory<mojom::InputDeviceServer>,
- public mojom::InputDeviceServer,
- public ui::InputDeviceEventObserver {
- public:
- InputDeviceServer();
- ~InputDeviceServer() override;
-
- // Registers this instance as a local observer with DeviceDataManager.
- void RegisterAsObserver();
- bool IsRegisteredAsObserver() const;
-
- // Adds interface with the shell connection so remote observers can connect.
- // You should have already called RegisterAsObserver() to get local
- // input-device event updates and checked it was successful by calling
- // IsRegisteredAsObserver().
- void AddInterface(shell::Connection* connection);
-
- // mojom::InputDeviceServer:
- void AddObserver(mojom::InputDeviceObserverMojoPtr observer) override;
-
- // ui::InputDeviceEventObserver:
- void OnKeyboardDeviceConfigurationChanged() override;
- void OnTouchscreenDeviceConfigurationChanged() override;
- void OnMouseDeviceConfigurationChanged() override;
- void OnTouchpadDeviceConfigurationChanged() override;
- void OnDeviceListsComplete() override;
-
- private:
- // Sends the current state of all input-devices to an observer.
- void SendDeviceListsComplete(mojom::InputDeviceObserverMojo* observer);
-
- // mojo::InterfaceFactory<mojom::InputDeviceServer>:
- void Create(shell::Connection* connection,
- mojom::InputDeviceServerRequest request) override;
-
- mojo::BindingSet<mojom::InputDeviceServer> bindings_;
- mojo::InterfacePtrSet<mojom::InputDeviceObserverMojo> observers_;
-
- // DeviceDataManager instance we are registered as an observer with.
- ui::DeviceDataManager* manager_ = nullptr;
-
- DISALLOW_COPY_AND_ASSIGN(InputDeviceServer);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_INPUT_DEVICES_INPUT_DEVICE_SERVER_H_
diff --git a/chromium/components/mus/main.cc b/chromium/components/mus/main.cc
deleted file mode 100644
index 32c40ef407a..00000000000
--- a/chromium/components/mus/main.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/mus_app.h"
-#include "mojo/public/c/system/main.h"
-#include "services/shell/public/cpp/application_runner.h"
-
-MojoResult MojoMain(MojoHandle shell_handle) {
- shell::ApplicationRunner runner(new mus::MusApp);
- runner.set_message_loop_type(base::MessageLoop::TYPE_UI);
- return runner.Run(shell_handle);
-}
diff --git a/chromium/components/mus/manifest.json b/chromium/components/mus/manifest.json
deleted file mode 100644
index 1969bec66e7..00000000000
--- a/chromium/components/mus/manifest.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "manifest_version": 1,
- "name": "mojo:mus",
- "display_name": "UI Service",
- "capabilities": {
- "provided": {
- // A collection of interfaces needed by a generic client of mus.
- // Additional interfaces may be requested a-la-carte.
- "app": [
- "mus::mojom::Clipboard",
- "mus::mojom::DisplayManager",
- "mus::mojom::Gpu",
- "mus::mojom::GpuService",
- "mus::mojom::InputDeviceServer",
- "mus::mojom::WindowTreeFactory"
- ],
- "test": [
- "mus::mojom::WindowServerTest"
- ]
- },
- "required": {
- "*": { "classes": [ "app" ] },
- "mojo:shell": { "classes": [ "shell:all_users", "shell:explicit_class" ] }
- }
- }
-}
diff --git a/chromium/components/mus/mus_app.cc b/chromium/components/mus/mus_app.cc
deleted file mode 100644
index 8ec1901a0c6..00000000000
--- a/chromium/components/mus/mus_app.cc
+++ /dev/null
@@ -1,388 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/mus_app.h"
-
-#include <set>
-
-#include "base/bind.h"
-#include "base/command_line.h"
-#include "base/memory/ptr_util.h"
-#include "base/memory/weak_ptr.h"
-#include "base/threading/platform_thread.h"
-#include "build/build_config.h"
-#include "components/mus/clipboard/clipboard_impl.h"
-#include "components/mus/common/switches.h"
-#include "components/mus/gles2/gpu_impl.h"
-#include "components/mus/gpu/gpu_service_impl.h"
-#include "components/mus/gpu/gpu_service_mus.h"
-#include "components/mus/ws/display.h"
-#include "components/mus/ws/display_binding.h"
-#include "components/mus/ws/display_manager.h"
-#include "components/mus/ws/platform_screen.h"
-#include "components/mus/ws/user_activity_monitor.h"
-#include "components/mus/ws/user_display_manager.h"
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_server_test_impl.h"
-#include "components/mus/ws/window_tree.h"
-#include "components/mus/ws/window_tree_binding.h"
-#include "components/mus/ws/window_tree_factory.h"
-#include "components/mus/ws/window_tree_host_factory.h"
-#include "mojo/public/c/system/main.h"
-#include "services/catalog/public/cpp/resource_loader.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/tracing/public/cpp/tracing_impl.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/base/ui_base_paths.h"
-#include "ui/events/event_switches.h"
-#include "ui/events/platform/platform_event_source.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/gl/gl_surface.h"
-
-#if defined(USE_X11)
-#include <X11/Xlib.h>
-#include "ui/platform_window/x11/x11_window.h"
-#elif defined(USE_OZONE)
-#include "ui/events/ozone/layout/keyboard_layout_engine.h"
-#include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
-#include "ui/ozone/public/ozone_platform.h"
-#endif
-
-using shell::Connection;
-using mojo::InterfaceRequest;
-using mus::mojom::Gpu;
-using mus::mojom::WindowServerTest;
-using mus::mojom::WindowTreeHostFactory;
-
-namespace mus {
-
-namespace {
-
-const char kResourceFileStrings[] = "mus_app_resources_strings.pak";
-const char kResourceFile100[] = "mus_app_resources_100.pak";
-const char kResourceFile200[] = "mus_app_resources_200.pak";
-
-} // namespace
-
-// TODO(sky): this is a pretty typical pattern, make it easier to do.
-struct MusApp::PendingRequest {
- shell::Connection* connection;
- std::unique_ptr<mojom::WindowTreeFactoryRequest> wtf_request;
- std::unique_ptr<mojom::DisplayManagerRequest> dm_request;
-};
-
-struct MusApp::UserState {
- std::unique_ptr<clipboard::ClipboardImpl> clipboard;
- std::unique_ptr<ws::WindowTreeHostFactory> window_tree_host_factory;
-};
-
-MusApp::MusApp()
- : test_config_(false),
- // TODO(penghuang): Kludge: Use mojo command buffer when running on
- // Windows since chrome command buffer breaks unit tests
-#if defined(OS_WIN)
- use_chrome_gpu_command_buffer_(false),
-#else
- use_chrome_gpu_command_buffer_(true),
-#endif
- platform_screen_(ws::PlatformScreen::Create()),
- weak_ptr_factory_(this) {}
-
-MusApp::~MusApp() {
- // Destroy |window_server_| first, since it depends on |event_source_|.
- // WindowServer (or more correctly its Displays) may have state that needs to
- // be destroyed before GpuState as well.
- window_server_.reset();
-
- if (platform_display_init_params_.gpu_state)
- platform_display_init_params_.gpu_state->StopThreads();
-}
-
-void MusApp::InitializeResources(shell::Connector* connector) {
- if (ui::ResourceBundle::HasSharedInstance())
- return;
-
- std::set<std::string> resource_paths;
- resource_paths.insert(kResourceFileStrings);
- resource_paths.insert(kResourceFile100);
- resource_paths.insert(kResourceFile200);
-
- catalog::ResourceLoader loader;
- filesystem::mojom::DirectoryPtr directory;
- connector->ConnectToInterface("mojo:catalog", &directory);
- CHECK(loader.OpenFiles(std::move(directory), resource_paths));
-
- ui::RegisterPathProvider();
-
- // Initialize resource bundle with 1x and 2x cursor bitmaps.
- ui::ResourceBundle::InitSharedInstanceWithPakFileRegion(
- loader.TakeFile(kResourceFileStrings),
- base::MemoryMappedFile::Region::kWholeFile);
- ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- rb.AddDataPackFromFile(loader.TakeFile(kResourceFile100),
- ui::SCALE_FACTOR_100P);
- rb.AddDataPackFromFile(loader.TakeFile(kResourceFile200),
- ui::SCALE_FACTOR_200P);
-}
-
-MusApp::UserState* MusApp::GetUserState(shell::Connection* connection) {
- const ws::UserId& user_id = connection->GetRemoteIdentity().user_id();
- auto it = user_id_to_user_state_.find(user_id);
- if (it != user_id_to_user_state_.end())
- return it->second.get();
- user_id_to_user_state_[user_id] = base::WrapUnique(new UserState);
- return user_id_to_user_state_[user_id].get();
-}
-
-void MusApp::AddUserIfNecessary(shell::Connection* connection) {
- window_server_->user_id_tracker()->AddUserId(
- connection->GetRemoteIdentity().user_id());
-}
-
-void MusApp::Initialize(shell::Connector* connector,
- const shell::Identity& identity,
- uint32_t id) {
- platform_display_init_params_.surfaces_state = new SurfacesState;
-
- base::PlatformThread::SetName("mus");
- tracing_.Initialize(connector, identity.name());
- TRACE_EVENT0("mus", "MusApp::Initialize started");
-
- test_config_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kUseTestConfig);
-// TODO(penghuang): Kludge: use mojo command buffer when running on Windows
-// since Chrome command buffer breaks unit tests
-#if defined(OS_WIN)
- use_chrome_gpu_command_buffer_ = false;
-#else
- use_chrome_gpu_command_buffer_ =
- !base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kUseMojoGpuCommandBufferInMus);
-#endif
-#if defined(USE_X11)
- XInitThreads();
- if (test_config_)
- ui::test::SetUseOverrideRedirectWindowByDefault(true);
-#endif
-
- InitializeResources(connector);
-
-#if defined(USE_OZONE)
- // The ozone platform can provide its own event source. So initialize the
- // platform before creating the default event source.
- // Because GL libraries need to be initialized before entering the sandbox,
- // in MUS, |InitializeForUI| will load the GL libraries.
- ui::OzonePlatform::InitParams params;
- params.connector = connector;
- params.single_process = false;
-
- ui::OzonePlatform::InitializeForUI(params);
-
- // TODO(kylechar): We might not always want a US keyboard layout.
- ui::KeyboardLayoutEngineManager::GetKeyboardLayoutEngine()
- ->SetCurrentLayoutByName("us");
- client_native_pixmap_factory_ = ui::ClientNativePixmapFactory::Create();
- ui::ClientNativePixmapFactory::SetInstance(
- client_native_pixmap_factory_.get());
-
- DCHECK(ui::ClientNativePixmapFactory::GetInstance());
-#endif
-
-// TODO(rjkroege): Enter sandbox here before we start threads in GpuState
-// http://crbug.com/584532
-
-#if !defined(OS_ANDROID)
- event_source_ = ui::PlatformEventSource::CreateDefault();
-#endif
-
- // This needs to happen after DeviceDataManager has been constructed. That
- // happens either during OzonePlatform or PlatformEventSource initialization,
- // so keep this line below both of those.
- input_device_server_.RegisterAsObserver();
-
- if (use_chrome_gpu_command_buffer_) {
- GpuServiceMus::GetInstance();
- } else {
- // TODO(rjkroege): It is possible that we might want to generalize the
- // GpuState object.
- platform_display_init_params_.gpu_state = new GpuState();
- }
-
- // Gpu must be running before the PlatformScreen can be initialized.
- platform_screen_->Init();
- window_server_.reset(
- new ws::WindowServer(this, platform_display_init_params_.surfaces_state));
-
- // DeviceDataManager must be initialized before TouchController. On non-Linux
- // platforms there is no DeviceDataManager so don't create touch controller.
- if (ui::DeviceDataManager::HasInstance())
- touch_controller_.reset(
- new ws::TouchController(window_server_->display_manager()));
-}
-
-bool MusApp::AcceptConnection(Connection* connection) {
- connection->AddInterface<mojom::Clipboard>(this);
- connection->AddInterface<mojom::DisplayManager>(this);
- connection->AddInterface<mojom::UserAccessManager>(this);
- connection->AddInterface<mojom::UserActivityMonitor>(this);
- connection->AddInterface<WindowTreeHostFactory>(this);
- connection->AddInterface<mojom::WindowManagerWindowTreeFactory>(this);
- connection->AddInterface<mojom::WindowTreeFactory>(this);
- if (test_config_)
- connection->AddInterface<WindowServerTest>(this);
-
- if (use_chrome_gpu_command_buffer_) {
- connection->AddInterface<mojom::GpuService>(this);
- } else {
- connection->AddInterface<Gpu>(this);
- }
-
- // On non-Linux platforms there will be no DeviceDataManager instance and no
- // purpose in adding the Mojo interface to connect to.
- if (input_device_server_.IsRegisteredAsObserver())
- input_device_server_.AddInterface(connection);
-
-#if defined(USE_OZONE)
- ui::OzonePlatform::GetInstance()->AddInterfaces(connection);
-#endif
-
- return true;
-}
-
-void MusApp::OnFirstDisplayReady() {
- PendingRequests requests;
- requests.swap(pending_requests_);
- for (auto& request : requests) {
- if (request->wtf_request)
- Create(request->connection, std::move(*request->wtf_request));
- else
- Create(request->connection, std::move(*request->dm_request));
- }
-}
-
-void MusApp::OnNoMoreDisplays() {
- // We may get here from the destructor, in which case there is no messageloop.
- if (base::MessageLoop::current())
- base::MessageLoop::current()->QuitWhenIdle();
-}
-
-bool MusApp::IsTestConfig() const {
- return test_config_;
-}
-
-void MusApp::CreateDefaultDisplays() {
- // An asynchronous callback will create the Displays once the physical
- // displays are ready.
- platform_screen_->ConfigurePhysicalDisplay(base::Bind(
- &MusApp::OnCreatedPhysicalDisplay, weak_ptr_factory_.GetWeakPtr()));
-}
-
-void MusApp::Create(shell::Connection* connection,
- mojom::ClipboardRequest request) {
- UserState* user_state = GetUserState(connection);
- if (!user_state->clipboard)
- user_state->clipboard.reset(new clipboard::ClipboardImpl);
- user_state->clipboard->AddBinding(std::move(request));
-}
-
-void MusApp::Create(shell::Connection* connection,
- mojom::DisplayManagerRequest request) {
- // DisplayManagerObservers generally expect there to be at least one display.
- if (!window_server_->display_manager()->has_displays()) {
- std::unique_ptr<PendingRequest> pending_request(new PendingRequest);
- pending_request->connection = connection;
- pending_request->dm_request.reset(
- new mojom::DisplayManagerRequest(std::move(request)));
- pending_requests_.push_back(std::move(pending_request));
- return;
- }
- window_server_->display_manager()
- ->GetUserDisplayManager(connection->GetRemoteIdentity().user_id())
- ->AddDisplayManagerBinding(std::move(request));
-}
-
-void MusApp::Create(shell::Connection* connection, mojom::GpuRequest request) {
- if (use_chrome_gpu_command_buffer_)
- return;
- DCHECK(platform_display_init_params_.gpu_state);
- new GpuImpl(std::move(request), platform_display_init_params_.gpu_state);
-}
-
-void MusApp::Create(shell::Connection* connection,
- mojom::GpuServiceRequest request) {
- if (!use_chrome_gpu_command_buffer_)
- return;
- new GpuServiceImpl(std::move(request), connection);
-}
-
-void MusApp::Create(shell::Connection* connection,
- mojom::UserAccessManagerRequest request) {
- window_server_->user_id_tracker()->Bind(std::move(request));
-}
-
-void MusApp::Create(shell::Connection* connection,
- mojom::UserActivityMonitorRequest request) {
- AddUserIfNecessary(connection);
- const ws::UserId& user_id = connection->GetRemoteIdentity().user_id();
- window_server_->GetUserActivityMonitorForUser(user_id)->Add(
- std::move(request));
-}
-
-void MusApp::Create(shell::Connection* connection,
- mojom::WindowManagerWindowTreeFactoryRequest request) {
- AddUserIfNecessary(connection);
- window_server_->window_manager_window_tree_factory_set()->Add(
- connection->GetRemoteIdentity().user_id(), std::move(request));
-}
-
-void MusApp::Create(Connection* connection,
- mojom::WindowTreeFactoryRequest request) {
- AddUserIfNecessary(connection);
- if (!window_server_->display_manager()->has_displays()) {
- std::unique_ptr<PendingRequest> pending_request(new PendingRequest);
- pending_request->connection = connection;
- pending_request->wtf_request.reset(
- new mojom::WindowTreeFactoryRequest(std::move(request)));
- pending_requests_.push_back(std::move(pending_request));
- return;
- }
- AddUserIfNecessary(connection);
- new ws::WindowTreeFactory(
- window_server_.get(), connection->GetRemoteIdentity().user_id(),
- connection->GetRemoteIdentity().name(), std::move(request));
-}
-
-void MusApp::Create(Connection* connection,
- mojom::WindowTreeHostFactoryRequest request) {
- UserState* user_state = GetUserState(connection);
- if (!user_state->window_tree_host_factory) {
- user_state->window_tree_host_factory.reset(new ws::WindowTreeHostFactory(
- window_server_.get(), connection->GetRemoteIdentity().user_id(),
- platform_display_init_params_));
- }
- user_state->window_tree_host_factory->AddBinding(std::move(request));
-}
-
-void MusApp::Create(Connection* connection,
- mojom::WindowServerTestRequest request) {
- if (!test_config_)
- return;
- new ws::WindowServerTestImpl(window_server_.get(), std::move(request));
-}
-
-void MusApp::OnCreatedPhysicalDisplay(int64_t id, const gfx::Rect& bounds) {
- platform_display_init_params_.display_bounds = bounds;
- platform_display_init_params_.display_id = id;
-
- // Display manages its own lifetime.
- ws::Display* host_impl =
- new ws::Display(window_server_.get(), platform_display_init_params_);
- host_impl->Init(nullptr);
-
- if (touch_controller_)
- touch_controller_->UpdateTouchTransforms();
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/mus_app.h b/chromium/components/mus/mus_app.h
deleted file mode 100644
index 6bffa5c1a72..00000000000
--- a/chromium/components/mus/mus_app.h
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_MUS_APP_H_
-#define COMPONENTS_MUS_MUS_APP_H_
-
-#include <stdint.h>
-
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "components/mus/input_devices/input_device_server.h"
-#include "components/mus/public/interfaces/clipboard.mojom.h"
-#include "components/mus/public/interfaces/display.mojom.h"
-#include "components/mus/public/interfaces/gpu.mojom.h"
-#include "components/mus/public/interfaces/gpu_service.mojom.h"
-#include "components/mus/public/interfaces/user_access_manager.mojom.h"
-#include "components/mus/public/interfaces/user_activity_monitor.mojom.h"
-#include "components/mus/public/interfaces/window_manager_window_tree_factory.mojom.h"
-#include "components/mus/public/interfaces/window_server_test.mojom.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/public/interfaces/window_tree_host.mojom.h"
-#include "components/mus/ws/platform_display_init_params.h"
-#include "components/mus/ws/touch_controller.h"
-#include "components/mus/ws/user_id.h"
-#include "components/mus/ws/window_server_delegate.h"
-#include "services/shell/public/cpp/application_runner.h"
-#include "services/shell/public/cpp/interface_factory.h"
-#include "services/shell/public/cpp/shell_client.h"
-#include "services/tracing/public/cpp/tracing_impl.h"
-
-#if defined(USE_OZONE)
-#include "ui/ozone/public/client_native_pixmap_factory.h"
-#endif
-
-namespace gfx {
-class Rect;
-}
-
-namespace shell {
-class Connector;
-}
-
-namespace ui {
-class PlatformEventSource;
-}
-
-namespace mus {
-namespace ws {
-class ForwardingWindowManager;
-class PlatformScreen;
-class WindowServer;
-}
-
-class MusApp
- : public shell::ShellClient,
- public ws::WindowServerDelegate,
- public shell::InterfaceFactory<mojom::Clipboard>,
- public shell::InterfaceFactory<mojom::DisplayManager>,
- public shell::InterfaceFactory<mojom::Gpu>,
- public shell::InterfaceFactory<mojom::GpuService>,
- public shell::InterfaceFactory<mojom::UserAccessManager>,
- public shell::InterfaceFactory<mojom::UserActivityMonitor>,
- public shell::InterfaceFactory<mojom::WindowManagerWindowTreeFactory>,
- public shell::InterfaceFactory<mojom::WindowTreeFactory>,
- public shell::InterfaceFactory<mojom::WindowTreeHostFactory>,
- public shell::InterfaceFactory<mojom::WindowServerTest> {
- public:
- MusApp();
- ~MusApp() override;
-
- private:
- // Holds InterfaceRequests received before the first WindowTreeHost Display
- // has been established.
- struct PendingRequest;
- struct UserState;
-
- using UserIdToUserState = std::map<ws::UserId, std::unique_ptr<UserState>>;
-
- void InitializeResources(shell::Connector* connector);
-
- // Returns the user specific state for the user id of |connection|. MusApp
- // owns the return value.
- // TODO(sky): if we allow removal of user ids then we need to close anything
- // associated with the user (all incoming pipes...) on removal.
- UserState* GetUserState(shell::Connection* connection);
-
- void AddUserIfNecessary(shell::Connection* connection);
-
- // shell::ShellClient:
- void Initialize(shell::Connector* connector,
- const shell::Identity& identity,
- uint32_t id) override;
- bool AcceptConnection(shell::Connection* connection) override;
-
- // WindowServerDelegate:
- void OnFirstDisplayReady() override;
- void OnNoMoreDisplays() override;
- bool IsTestConfig() const override;
- void CreateDefaultDisplays() override;
-
- // shell::InterfaceFactory<mojom::Clipboard> implementation.
- void Create(shell::Connection* connection,
- mojom::ClipboardRequest request) override;
-
- // shell::InterfaceFactory<mojom::DisplayManager> implementation.
- void Create(shell::Connection* connection,
- mojom::DisplayManagerRequest request) override;
-
- // shell::InterfaceFactory<mojom::Gpu> implementation.
- void Create(shell::Connection* connection,
- mojom::GpuRequest request) override;
-
- // shell::InterfaceFactory<mojom::GpuService> implementation.
- void Create(shell::Connection* connection,
- mojom::GpuServiceRequest request) override;
-
- // shell::InterfaceFactory<mojom::UserAccessManager> implementation.
- void Create(shell::Connection* connection,
- mojom::UserAccessManagerRequest request) override;
-
- // shell::InterfaceFactory<mojom::UserActivityMonitor> implementation.
- void Create(shell::Connection* connection,
- mojom::UserActivityMonitorRequest request) override;
-
- // shell::InterfaceFactory<mojom::WindowManagerWindowTreeFactory>
- // implementation.
- void Create(shell::Connection* connection,
- mojom::WindowManagerWindowTreeFactoryRequest request) override;
-
- // shell::InterfaceFactory<mojom::WindowTreeFactory>:
- void Create(shell::Connection* connection,
- mojom::WindowTreeFactoryRequest request) override;
-
- // shell::InterfaceFactory<mojom::WindowTreeHostFactory>:
- void Create(shell::Connection* connection,
- mojom::WindowTreeHostFactoryRequest request) override;
-
- // shell::InterfaceFactory<mojom::WindowServerTest> implementation.
- void Create(shell::Connection* connection,
- mojom::WindowServerTestRequest request) override;
-
- // Callback for display configuration. |id| is the identifying token for the
- // configured display that will identify a specific physical display across
- // configuration changes. |bounds| is the bounds of the display in screen
- // coordinates.
- void OnCreatedPhysicalDisplay(int64_t id, const gfx::Rect& bounds);
-
- ws::PlatformDisplayInitParams platform_display_init_params_;
- std::unique_ptr<ws::WindowServer> window_server_;
- std::unique_ptr<ui::PlatformEventSource> event_source_;
- mojo::TracingImpl tracing_;
- using PendingRequests = std::vector<std::unique_ptr<PendingRequest>>;
- PendingRequests pending_requests_;
-
- UserIdToUserState user_id_to_user_state_;
-
- // Provides input-device information via Mojo IPC.
- InputDeviceServer input_device_server_;
-
- bool test_config_;
- bool use_chrome_gpu_command_buffer_;
-#if defined(USE_OZONE)
- std::unique_ptr<ui::ClientNativePixmapFactory> client_native_pixmap_factory_;
-#endif
-
- std::unique_ptr<ws::PlatformScreen> platform_screen_;
- std::unique_ptr<ws::TouchController> touch_controller_;
-
- base::WeakPtrFactory<MusApp> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(MusApp);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_MUS_APP_H_
diff --git a/chromium/components/mus/public/cpp/DEPS b/chromium/components/mus/public/cpp/DEPS
deleted file mode 100644
index 9be0bc0fccc..00000000000
--- a/chromium/components/mus/public/cpp/DEPS
+++ /dev/null
@@ -1,3 +0,0 @@
-include_rules = [
- "+gpu",
-]
diff --git a/chromium/components/mus/public/cpp/context_provider.h b/chromium/components/mus/public/cpp/context_provider.h
deleted file mode 100644
index f16366e05c2..00000000000
--- a/chromium/components/mus/public/cpp/context_provider.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_CONTEXT_PROVIDER_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_CONTEXT_PROVIDER_H_
-
-#include <stdint.h>
-
-#include <memory>
-
-#include "base/macros.h"
-#include "cc/output/context_provider.h"
-#include "components/mus/public/interfaces/command_buffer.mojom.h"
-#include "mojo/public/cpp/system/core.h"
-
-namespace shell {
-class Connector;
-}
-
-namespace mus {
-
-class GLES2Context;
-
-class ContextProvider : public cc::ContextProvider {
- public:
- explicit ContextProvider(shell::Connector* connector);
-
- // cc::ContextProvider implementation.
- bool BindToCurrentThread() override;
- gpu::gles2::GLES2Interface* ContextGL() override;
- gpu::ContextSupport* ContextSupport() override;
- class GrContext* GrContext() override;
- void InvalidateGrContext(uint32_t state) override;
- base::Lock* GetLock() override;
- gpu::Capabilities ContextCapabilities() override;
- void DeleteCachedResources() override {}
- void SetLostContextCallback(
- const LostContextCallback& lost_context_callback) override {}
-
- protected:
- friend class base::RefCountedThreadSafe<ContextProvider>;
- ~ContextProvider() override;
-
- private:
- std::unique_ptr<shell::Connector> connector_;
- std::unique_ptr<GLES2Context> context_;
-
- DISALLOW_COPY_AND_ASSIGN(ContextProvider);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_CONTEXT_PROVIDER_H_
diff --git a/chromium/components/mus/public/cpp/gles2_context.h b/chromium/components/mus/public/cpp/gles2_context.h
deleted file mode 100644
index 03b069f478d..00000000000
--- a/chromium/components/mus/public/cpp/gles2_context.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_GLES2_CONTEXT_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_GLES2_CONTEXT_H_
-
-#include <stdint.h>
-
-#include <memory>
-#include <vector>
-
-#include "base/macros.h"
-#include "components/mus/public/interfaces/command_buffer.mojom.h"
-#include "gpu/command_buffer/client/gles2_implementation.h"
-
-namespace gpu {
-class CommandBufferProxyImpl;
-class TransferBuffer;
-namespace gles2 {
-class GLES2CmdHelper;
-}
-}
-
-namespace shell {
-class Connector;
-}
-
-namespace mus {
-
-class CommandBufferClientImpl;
-
-class GLES2Context {
- public:
- ~GLES2Context();
- gpu::gles2::GLES2Interface* interface() const {
- return implementation_.get();
- }
- gpu::ContextSupport* context_support() const { return implementation_.get(); }
-
- static std::unique_ptr<GLES2Context> CreateOffscreenContext(
- const std::vector<int32_t>& attribs,
- shell::Connector* connector);
-
- private:
- GLES2Context();
- bool Initialize(const std::vector<int32_t>& attribs,
- shell::Connector* connector);
-
- std::unique_ptr<CommandBufferClientImpl> command_buffer_client_impl_;
- std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_proxy_impl_;
- std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_;
- std::unique_ptr<gpu::TransferBuffer> transfer_buffer_;
- std::unique_ptr<gpu::gles2::GLES2Implementation> implementation_;
-
- DISALLOW_COPY_AND_ASSIGN(GLES2Context);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_GLES2_CONTEXT_H_
diff --git a/chromium/components/mus/public/cpp/input_devices/input_device_client.cc b/chromium/components/mus/public/cpp/input_devices/input_device_client.cc
deleted file mode 100644
index 6b55d778f58..00000000000
--- a/chromium/components/mus/public/cpp/input_devices/input_device_client.cc
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/input_devices/input_device_client.h"
-
-#include "base/logging.h"
-
-namespace mus {
-
-InputDeviceClient::InputDeviceClient() : binding_(this) {
- InputDeviceManager::SetInstance(this);
-}
-
-InputDeviceClient::~InputDeviceClient() {
- InputDeviceManager::ClearInstance();
-}
-
-void InputDeviceClient::Connect(mojom::InputDeviceServerPtr server) {
- DCHECK(server.is_bound());
-
- server->AddObserver(binding_.CreateInterfacePtrAndBind());
-}
-
-void InputDeviceClient::OnKeyboardDeviceConfigurationChanged(
- mojo::Array<ui::InputDevice> devices) {
- keyboard_devices_ = devices.To<std::vector<ui::InputDevice>>();
- FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_,
- OnKeyboardDeviceConfigurationChanged());
-}
-
-void InputDeviceClient::OnTouchscreenDeviceConfigurationChanged(
- mojo::Array<ui::TouchscreenDevice> devices) {
- touchscreen_devices_ = devices.To<std::vector<ui::TouchscreenDevice>>();
- FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_,
- OnTouchscreenDeviceConfigurationChanged());
-}
-
-void InputDeviceClient::OnMouseDeviceConfigurationChanged(
- mojo::Array<ui::InputDevice> devices) {
- mouse_devices_ = devices.To<std::vector<ui::InputDevice>>();
- FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_,
- OnMouseDeviceConfigurationChanged());
-}
-
-void InputDeviceClient::OnTouchpadDeviceConfigurationChanged(
- mojo::Array<ui::InputDevice> devices) {
- touchpad_devices_ = devices.To<std::vector<ui::InputDevice>>();
- FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_,
- OnTouchpadDeviceConfigurationChanged());
-}
-
-void InputDeviceClient::OnDeviceListsComplete(
- mojo::Array<ui::InputDevice> keyboard_devices,
- mojo::Array<ui::TouchscreenDevice> touchscreen_devices,
- mojo::Array<ui::InputDevice> mouse_devices,
- mojo::Array<ui::InputDevice> touchpad_devices) {
- // Update the cached device lists if the received list isn't empty.
- if (!keyboard_devices.empty())
- OnKeyboardDeviceConfigurationChanged(std::move(keyboard_devices));
- if (!touchscreen_devices.empty())
- OnTouchscreenDeviceConfigurationChanged(std::move(touchscreen_devices));
- if (!mouse_devices.empty())
- OnMouseDeviceConfigurationChanged(std::move(mouse_devices));
- if (!touchpad_devices.empty())
- OnTouchpadDeviceConfigurationChanged(std::move(touchpad_devices));
-
- if (!device_lists_complete_) {
- device_lists_complete_ = true;
- FOR_EACH_OBSERVER(ui::InputDeviceEventObserver, observers_,
- OnDeviceListsComplete());
- }
-}
-
-void InputDeviceClient::AddObserver(ui::InputDeviceEventObserver* observer) {
- observers_.AddObserver(observer);
-}
-
-void InputDeviceClient::RemoveObserver(ui::InputDeviceEventObserver* observer) {
- observers_.RemoveObserver(observer);
-}
-
-const std::vector<ui::InputDevice>& InputDeviceClient::GetKeyboardDevices()
- const {
- return keyboard_devices_;
-}
-
-const std::vector<ui::TouchscreenDevice>&
-InputDeviceClient::GetTouchscreenDevices() const {
- return touchscreen_devices_;
-}
-
-const std::vector<ui::InputDevice>& InputDeviceClient::GetMouseDevices() const {
- return mouse_devices_;
-}
-
-const std::vector<ui::InputDevice>& InputDeviceClient::GetTouchpadDevices()
- const {
- return touchpad_devices_;
-}
-
-bool InputDeviceClient::AreDeviceListsComplete() const {
- return device_lists_complete_;
-}
-
-bool InputDeviceClient::AreTouchscreensEnabled() const {
- // TODO(kylechar): This obviously isn't right. We either need to pass this
- // state around or modify the interface.
- return true;
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/public/cpp/input_devices/input_device_client.h b/chromium/components/mus/public/cpp/input_devices/input_device_client.h
deleted file mode 100644
index 88fa41d750f..00000000000
--- a/chromium/components/mus/public/cpp/input_devices/input_device_client.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CLIENT_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CLIENT_H_
-
-#include <vector>
-
-#include "base/macros.h"
-#include "base/observer_list.h"
-#include "components/mus/public/interfaces/input_devices/input_device_server.mojom.h"
-#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "ui/events/devices/input_device.h"
-#include "ui/events/devices/input_device_event_observer.h"
-#include "ui/events/devices/input_device_manager.h"
-#include "ui/events/devices/touchscreen_device.h"
-
-namespace mus {
-
-// Allows in-process client code to register as a InputDeviceEventObserver and
-// get information about input-devices. InputDeviceClient itself acts as an
-// InputDeviceObserverMojo and registers to get updates from InputDeviceServer.
-// Essentially, InputDeviceClient forwards input-device events and caches
-// input-device state.
-class InputDeviceClient : public mojom::InputDeviceObserverMojo,
- public ui::InputDeviceManager {
- public:
- InputDeviceClient();
- ~InputDeviceClient() override;
-
- // Connects to mojo:mus as an observer on InputDeviceServer to receive input
- // device updates.
- void Connect(mojom::InputDeviceServerPtr server);
-
- // ui::InputDeviceManager:
- const std::vector<ui::InputDevice>& GetKeyboardDevices() const override;
- const std::vector<ui::TouchscreenDevice>& GetTouchscreenDevices()
- const override;
- const std::vector<ui::InputDevice>& GetMouseDevices() const override;
- const std::vector<ui::InputDevice>& GetTouchpadDevices() const override;
-
- bool AreDeviceListsComplete() const override;
- bool AreTouchscreensEnabled() const override;
-
- void AddObserver(ui::InputDeviceEventObserver* observer) override;
- void RemoveObserver(ui::InputDeviceEventObserver* observer) override;
-
- private:
- // mojom::InputDeviceObserverMojo:
- void OnKeyboardDeviceConfigurationChanged(
- mojo::Array<ui::InputDevice> devices) override;
- void OnTouchscreenDeviceConfigurationChanged(
- mojo::Array<ui::TouchscreenDevice> devices) override;
- void OnMouseDeviceConfigurationChanged(
- mojo::Array<ui::InputDevice> devices) override;
- void OnTouchpadDeviceConfigurationChanged(
- mojo::Array<ui::InputDevice> devices) override;
- void OnDeviceListsComplete(
- mojo::Array<ui::InputDevice> keyboard_devices,
- mojo::Array<ui::TouchscreenDevice> touchscreen_devices,
- mojo::Array<ui::InputDevice> mouse_devices,
- mojo::Array<ui::InputDevice> touchpad_devices) override;
-
- mojo::Binding<mojom::InputDeviceObserverMojo> binding_;
-
- // Holds the list of input devices and signal that we have received the lists
- // after initialization.
- std::vector<ui::InputDevice> keyboard_devices_;
- std::vector<ui::TouchscreenDevice> touchscreen_devices_;
- std::vector<ui::InputDevice> mouse_devices_;
- std::vector<ui::InputDevice> touchpad_devices_;
- bool device_lists_complete_ = false;
-
- // List of in-process observers.
- base::ObserverList<ui::InputDeviceEventObserver> observers_;
-
- DISALLOW_COPY_AND_ASSIGN(InputDeviceClient);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_INPUT_DEVICES_INPUT_DEVICE_CLIENT_H_
diff --git a/chromium/components/mus/public/cpp/input_event_handler.h b/chromium/components/mus/public/cpp/input_event_handler.h
deleted file mode 100644
index 3d445b23bad..00000000000
--- a/chromium/components/mus/public/cpp/input_event_handler.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_INPUT_EVENT_HANDLER_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_INPUT_EVENT_HANDLER_H_
-
-#include <memory>
-
-#include "base/callback_forward.h"
-
-namespace ui {
-class Event;
-}
-
-namespace mus {
-
-class Window;
-
-namespace mojom {
-enum class EventResult;
-}
-
-// Responsible for processing input events for mus::Window.
-class InputEventHandler {
- public:
- // The event handler can asynchronously ack the event by taking ownership of
- // the |ack_callback|. The callback takes an EventResult indicating if the
- // handler has consumed the event. If the handler does not take ownership of
- // the callback, then WindowTreeClient will ack the event as not consumed.
- virtual void OnWindowInputEvent(
- Window* target,
- const ui::Event& event,
- std::unique_ptr<base::Callback<void(mojom::EventResult)>>*
- ack_callback) = 0;
-
- protected:
- virtual ~InputEventHandler() {}
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_INPUT_EVENT_HANDLER_H_
diff --git a/chromium/components/mus/public/cpp/lib/DEPS b/chromium/components/mus/public/cpp/lib/DEPS
deleted file mode 100644
index c635ea6f5e4..00000000000
--- a/chromium/components/mus/public/cpp/lib/DEPS
+++ /dev/null
@@ -1,3 +0,0 @@
-include_rules = [
- "+mojo/gpu"
-]
diff --git a/chromium/components/mus/public/cpp/lib/command_buffer_client_impl.cc b/chromium/components/mus/public/cpp/lib/command_buffer_client_impl.cc
deleted file mode 100644
index 062c3f78477..00000000000
--- a/chromium/components/mus/public/cpp/lib/command_buffer_client_impl.cc
+++ /dev/null
@@ -1,370 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/lib/command_buffer_client_impl.h"
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <limits>
-#include <utility>
-
-#include "base/logging.h"
-#include "base/process/process_handle.h"
-#include "base/threading/thread_restrictions.h"
-#include "components/mus/common/gpu_type_converters.h"
-#include "components/mus/common/mojo_buffer_backing.h"
-#include "components/mus/common/mojo_gpu_memory_buffer.h"
-#include "gpu/command_buffer/client/gpu_control_client.h"
-#include "gpu/command_buffer/common/command_buffer_id.h"
-#include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
-#include "gpu/command_buffer/common/sync_token.h"
-#include "mojo/public/cpp/system/platform_handle.h"
-
-namespace mus {
-
-namespace {
-
-bool CreateAndMapSharedBuffer(size_t size,
- mojo::ScopedSharedBufferMapping* mapping,
- mojo::ScopedSharedBufferHandle* handle) {
- *handle = mojo::SharedBufferHandle::Create(size);
- if (!handle->is_valid())
- return false;
-
- *mapping = (*handle)->Map(size);
- if (!*mapping)
- return false;
-
- return true;
-}
-
-void MakeProgressCallback(gpu::CommandBuffer::State* output,
- const gpu::CommandBuffer::State& input) {
- *output = input;
-}
-
-void InitializeCallback(mus::mojom::CommandBufferInitializeResultPtr* output,
- mus::mojom::CommandBufferInitializeResultPtr input) {
- *output = std::move(input);
-}
-
-} // namespace
-
-CommandBufferClientImpl::CommandBufferClientImpl(
- const std::vector<int32_t>& attribs,
- mus::mojom::CommandBufferPtr command_buffer_ptr)
- : gpu_control_client_(nullptr),
- destroyed_(false),
- attribs_(attribs),
- client_binding_(this),
- command_buffer_(std::move(command_buffer_ptr)),
- command_buffer_id_(),
- last_put_offset_(-1),
- next_transfer_buffer_id_(0),
- next_image_id_(0),
- next_fence_sync_release_(1),
- flushed_fence_sync_release_(0) {
- command_buffer_.set_connection_error_handler(
- base::Bind(&CommandBufferClientImpl::Destroyed, base::Unretained(this),
- gpu::error::kUnknown, gpu::error::kLostContext));
-}
-
-CommandBufferClientImpl::~CommandBufferClientImpl() {}
-
-bool CommandBufferClientImpl::Initialize() {
- const size_t kSharedStateSize = sizeof(gpu::CommandBufferSharedState);
- mojo::ScopedSharedBufferHandle handle;
- bool result =
- CreateAndMapSharedBuffer(kSharedStateSize, &shared_state_, &handle);
- if (!result)
- return false;
-
- shared_state()->Initialize();
-
- mus::mojom::CommandBufferClientPtr client_ptr;
- client_binding_.Bind(GetProxy(&client_ptr));
-
- mus::mojom::CommandBufferInitializeResultPtr initialize_result;
- command_buffer_->Initialize(
- std::move(client_ptr), std::move(handle),
- mojo::Array<int32_t>::From(attribs_),
- base::Bind(&InitializeCallback, &initialize_result));
-
- base::ThreadRestrictions::ScopedAllowWait wait;
- if (!command_buffer_.WaitForIncomingResponse()) {
- VLOG(1) << "Channel encountered error while creating command buffer.";
- return false;
- }
-
- if (!initialize_result) {
- VLOG(1) << "Command buffer cannot be initialized successfully.";
- return false;
- }
-
- DCHECK_EQ(gpu::CommandBufferNamespace::MOJO,
- initialize_result->command_buffer_namespace);
- command_buffer_id_ = gpu::CommandBufferId::FromUnsafeValue(
- initialize_result->command_buffer_id);
- capabilities_ = initialize_result->capabilities;
- return true;
-}
-
-gpu::CommandBuffer::State CommandBufferClientImpl::GetLastState() {
- return last_state_;
-}
-
-int32_t CommandBufferClientImpl::GetLastToken() {
- TryUpdateState();
- return last_state_.token;
-}
-
-void CommandBufferClientImpl::Flush(int32_t put_offset) {
- if (last_put_offset_ == put_offset)
- return;
-
- last_put_offset_ = put_offset;
- command_buffer_->Flush(put_offset);
- flushed_fence_sync_release_ = next_fence_sync_release_ - 1;
-}
-
-void CommandBufferClientImpl::OrderingBarrier(int32_t put_offset) {
- // TODO(jamesr): Implement this more efficiently.
- Flush(put_offset);
-}
-
-void CommandBufferClientImpl::WaitForTokenInRange(int32_t start, int32_t end) {
- TryUpdateState();
- while (!InRange(start, end, last_state_.token) &&
- last_state_.error == gpu::error::kNoError) {
- MakeProgressAndUpdateState();
- }
-}
-
-void CommandBufferClientImpl::WaitForGetOffsetInRange(int32_t start,
- int32_t end) {
- TryUpdateState();
- while (!InRange(start, end, last_state_.get_offset) &&
- last_state_.error == gpu::error::kNoError) {
- MakeProgressAndUpdateState();
- }
-}
-
-void CommandBufferClientImpl::SetGetBuffer(int32_t shm_id) {
- command_buffer_->SetGetBuffer(shm_id);
- last_put_offset_ = -1;
-}
-
-scoped_refptr<gpu::Buffer> CommandBufferClientImpl::CreateTransferBuffer(
- size_t size,
- int32_t* id) {
- if (size >= std::numeric_limits<uint32_t>::max())
- return NULL;
-
- mojo::ScopedSharedBufferMapping mapping;
- mojo::ScopedSharedBufferHandle handle;
- if (!CreateAndMapSharedBuffer(size, &mapping, &handle)) {
- if (last_state_.error == gpu::error::kNoError)
- last_state_.error = gpu::error::kLostContext;
- return NULL;
- }
-
- *id = ++next_transfer_buffer_id_;
-
- command_buffer_->RegisterTransferBuffer(*id, std::move(handle),
- static_cast<uint32_t>(size));
-
- std::unique_ptr<gpu::BufferBacking> backing(
- new mus::MojoBufferBacking(std::move(mapping), size));
- scoped_refptr<gpu::Buffer> buffer(new gpu::Buffer(std::move(backing)));
- return buffer;
-}
-
-void CommandBufferClientImpl::DestroyTransferBuffer(int32_t id) {
- command_buffer_->DestroyTransferBuffer(id);
-}
-
-void CommandBufferClientImpl::SetGpuControlClient(gpu::GpuControlClient* c) {
- gpu_control_client_ = c;
-}
-
-gpu::Capabilities CommandBufferClientImpl::GetCapabilities() {
- return capabilities_;
-}
-
-int32_t CommandBufferClientImpl::CreateImage(ClientBuffer buffer,
- size_t width,
- size_t height,
- unsigned internalformat) {
- int32_t new_id = ++next_image_id_;
-
- gfx::Size size(static_cast<int32_t>(width), static_cast<int32_t>(height));
-
- mus::MojoGpuMemoryBufferImpl* gpu_memory_buffer =
- mus::MojoGpuMemoryBufferImpl::FromClientBuffer(buffer);
- gfx::GpuMemoryBufferHandle handle = gpu_memory_buffer->GetHandle();
-
- bool requires_sync_point = false;
- if (handle.type != gfx::SHARED_MEMORY_BUFFER) {
- requires_sync_point = true;
- NOTIMPLEMENTED();
- return -1;
- }
-
- base::SharedMemoryHandle dupd_handle =
- base::SharedMemory::DuplicateHandle(handle.handle);
-#if defined(OS_WIN)
- HANDLE platform_handle = dupd_handle.GetHandle();
-#else
- int platform_handle = dupd_handle.fd;
-#endif
-
- mojo::ScopedHandle scoped_handle = mojo::WrapPlatformFile(platform_handle);
- command_buffer_->CreateImage(
- new_id, std::move(scoped_handle), handle.type, std::move(size),
- static_cast<int32_t>(gpu_memory_buffer->GetFormat()), internalformat);
- if (requires_sync_point) {
- NOTIMPLEMENTED();
- // TODO(jam): need to support this if we support types other than
- // SHARED_MEMORY_BUFFER.
- // gpu_memory_buffer_manager->SetDestructionSyncPoint(gpu_memory_buffer,
- // InsertSyncPoint());
- }
-
- return new_id;
-}
-
-void CommandBufferClientImpl::DestroyImage(int32_t id) {
- command_buffer_->DestroyImage(id);
-}
-
-int32_t CommandBufferClientImpl::CreateGpuMemoryBufferImage(
- size_t width,
- size_t height,
- unsigned internalformat,
- unsigned usage) {
- std::unique_ptr<gfx::GpuMemoryBuffer> buffer(
- mus::MojoGpuMemoryBufferImpl::Create(
- gfx::Size(static_cast<int>(width), static_cast<int>(height)),
- gpu::DefaultBufferFormatForImageFormat(internalformat),
- gfx::BufferUsage::SCANOUT));
- if (!buffer)
- return -1;
-
- return CreateImage(buffer->AsClientBuffer(), width, height, internalformat);
-}
-
-int32_t CommandBufferClientImpl::GetImageGpuMemoryBufferId(unsigned image_id) {
- // TODO(erikchen): Once this class supports IOSurface GpuMemoryBuffer backed
- // images, it will also need to keep a local cache from image id to
- // GpuMemoryBuffer id.
- NOTIMPLEMENTED();
- return -1;
-}
-
-void CommandBufferClientImpl::SignalQuery(uint32_t query,
- const base::Closure& callback) {
- // TODO(piman)
- NOTIMPLEMENTED();
-}
-
-void CommandBufferClientImpl::Destroyed(int32_t lost_reason, int32_t error) {
- if (destroyed_)
- return;
- last_state_.context_lost_reason =
- static_cast<gpu::error::ContextLostReason>(lost_reason);
- last_state_.error = static_cast<gpu::error::Error>(error);
- if (gpu_control_client_)
- gpu_control_client_->OnGpuControlLostContext();
- destroyed_ = true;
-}
-
-void CommandBufferClientImpl::SignalAck(uint32_t id) {}
-
-void CommandBufferClientImpl::SwapBuffersCompleted(int32_t result) {}
-
-void CommandBufferClientImpl::UpdateState(
- const gpu::CommandBuffer::State& state) {}
-
-void CommandBufferClientImpl::UpdateVSyncParameters(int64_t timebase,
- int64_t interval) {}
-
-void CommandBufferClientImpl::TryUpdateState() {
- if (last_state_.error == gpu::error::kNoError)
- shared_state()->Read(&last_state_);
-}
-
-void CommandBufferClientImpl::MakeProgressAndUpdateState() {
- gpu::CommandBuffer::State state;
- command_buffer_->MakeProgress(last_state_.get_offset,
- base::Bind(&MakeProgressCallback, &state));
-
- base::ThreadRestrictions::ScopedAllowWait wait;
- if (!command_buffer_.WaitForIncomingResponse()) {
- VLOG(1) << "Channel encountered error while waiting for command buffer.";
- // TODO(piman): is it ok for this to re-enter?
- Destroyed(gpu::error::kUnknown, gpu::error::kLostContext);
- return;
- }
-
- if (state.generation - last_state_.generation < 0x80000000U)
- last_state_ = state;
-}
-
-void CommandBufferClientImpl::SetLock(base::Lock* lock) {}
-
-void CommandBufferClientImpl::EnsureWorkVisible() {
- // This is only relevant for out-of-process command buffers.
-}
-
-gpu::CommandBufferNamespace CommandBufferClientImpl::GetNamespaceID() const {
- return gpu::CommandBufferNamespace::MOJO;
-}
-
-gpu::CommandBufferId CommandBufferClientImpl::GetCommandBufferID() const {
- return command_buffer_id_;
-}
-
-int32_t CommandBufferClientImpl::GetExtraCommandBufferData() const {
- return 0;
-}
-
-uint64_t CommandBufferClientImpl::GenerateFenceSyncRelease() {
- return next_fence_sync_release_++;
-}
-
-bool CommandBufferClientImpl::IsFenceSyncRelease(uint64_t release) {
- return release != 0 && release < next_fence_sync_release_;
-}
-
-bool CommandBufferClientImpl::IsFenceSyncFlushed(uint64_t release) {
- return release != 0 && release <= flushed_fence_sync_release_;
-}
-
-bool CommandBufferClientImpl::IsFenceSyncFlushReceived(uint64_t release) {
- return IsFenceSyncFlushed(release);
-}
-
-void CommandBufferClientImpl::SignalSyncToken(const gpu::SyncToken& sync_token,
- const base::Closure& callback) {
- // TODO(dyen)
- NOTIMPLEMENTED();
-}
-
-bool CommandBufferClientImpl::CanWaitUnverifiedSyncToken(
- const gpu::SyncToken* sync_token) {
- // Right now, MOJO_LOCAL is only used by trusted code, so it is safe to wait
- // on a sync token in MOJO_LOCAL command buffer.
- if (sync_token->namespace_id() == gpu::CommandBufferNamespace::MOJO_LOCAL)
- return true;
-
- // It is also safe to wait on the same context.
- if (sync_token->namespace_id() == gpu::CommandBufferNamespace::MOJO &&
- sync_token->command_buffer_id() == GetCommandBufferID())
- return true;
-
- return false;
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/public/cpp/lib/command_buffer_client_impl.h b/chromium/components/mus/public/cpp/lib/command_buffer_client_impl.h
deleted file mode 100644
index 80a46e93b7f..00000000000
--- a/chromium/components/mus/public/cpp/lib/command_buffer_client_impl.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_LIB_COMMAND_BUFFER_CLIENT_IMPL_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_LIB_COMMAND_BUFFER_CLIENT_IMPL_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <map>
-#include <memory>
-#include <vector>
-
-#include "base/macros.h"
-#include "components/mus/public/interfaces/command_buffer.mojom.h"
-#include "gpu/command_buffer/client/gpu_control.h"
-#include "gpu/command_buffer/common/command_buffer.h"
-#include "gpu/command_buffer/common/command_buffer_id.h"
-#include "gpu/command_buffer/common/command_buffer_shared.h"
-#include "mojo/public/cpp/bindings/binding.h"
-
-namespace base {
-class RunLoop;
-}
-
-namespace mus {
-class CommandBufferClientImpl;
-
-class CommandBufferClientImpl : public mus::mojom::CommandBufferClient,
- public gpu::CommandBuffer,
- public gpu::GpuControl {
- public:
- explicit CommandBufferClientImpl(
- const std::vector<int32_t>& attribs,
- mus::mojom::CommandBufferPtr command_buffer_ptr);
- ~CommandBufferClientImpl() override;
- bool Initialize();
-
- // CommandBuffer implementation:
- State GetLastState() override;
- int32_t GetLastToken() override;
- void Flush(int32_t put_offset) override;
- void OrderingBarrier(int32_t put_offset) override;
- void WaitForTokenInRange(int32_t start, int32_t end) override;
- void WaitForGetOffsetInRange(int32_t start, int32_t end) override;
- void SetGetBuffer(int32_t shm_id) override;
- scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size,
- int32_t* id) override;
- void DestroyTransferBuffer(int32_t id) override;
-
- // gpu::GpuControl implementation:
- void SetGpuControlClient(gpu::GpuControlClient*) override;
- gpu::Capabilities GetCapabilities() override;
- int32_t CreateImage(ClientBuffer buffer,
- size_t width,
- size_t height,
- unsigned internalformat) override;
- void DestroyImage(int32_t id) override;
- int32_t CreateGpuMemoryBufferImage(size_t width,
- size_t height,
- unsigned internalformat,
- unsigned usage) override;
- int32_t GetImageGpuMemoryBufferId(unsigned image_id) override;
- void SignalQuery(uint32_t query, const base::Closure& callback) override;
- void SetLock(base::Lock*) override;
- void EnsureWorkVisible() override;
- gpu::CommandBufferNamespace GetNamespaceID() const override;
- gpu::CommandBufferId GetCommandBufferID() const override;
- int32_t GetExtraCommandBufferData() const override;
- uint64_t GenerateFenceSyncRelease() override;
- bool IsFenceSyncRelease(uint64_t release) override;
- bool IsFenceSyncFlushed(uint64_t release) override;
- bool IsFenceSyncFlushReceived(uint64_t release) override;
- void SignalSyncToken(const gpu::SyncToken& sync_token,
- const base::Closure& callback) override;
- bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override;
-
- private:
- // mus::mojom::CommandBufferClient implementation:
- void Destroyed(int32_t lost_reason, int32_t error) override;
- void SignalAck(uint32_t id) override;
- void SwapBuffersCompleted(int32_t result) override;
- void UpdateState(const gpu::CommandBuffer::State& state) override;
- void UpdateVSyncParameters(int64_t timebase, int64_t interval) override;
-
- void TryUpdateState();
- void MakeProgressAndUpdateState();
-
- gpu::CommandBufferSharedState* shared_state() const {
- return reinterpret_cast<gpu::CommandBufferSharedState*>(
- shared_state_.get());
- }
-
- gpu::GpuControlClient* gpu_control_client_;
- bool destroyed_;
- std::vector<int32_t> attribs_;
- mojo::Binding<mus::mojom::CommandBufferClient> client_binding_;
- mus::mojom::CommandBufferPtr command_buffer_;
-
- gpu::CommandBufferId command_buffer_id_;
- gpu::Capabilities capabilities_;
- State last_state_;
- mojo::ScopedSharedBufferMapping shared_state_;
- int32_t last_put_offset_;
- int32_t next_transfer_buffer_id_;
-
- // Image IDs are allocated in sequence.
- int next_image_id_;
-
- uint64_t next_fence_sync_release_;
- uint64_t flushed_fence_sync_release_;
-};
-
-} // mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_COMMAND_BUFFER_CLIENT_IMPL_H_
diff --git a/chromium/components/mus/public/cpp/lib/context_provider.cc b/chromium/components/mus/public/cpp/lib/context_provider.cc
deleted file mode 100644
index 02717112dd7..00000000000
--- a/chromium/components/mus/public/cpp/lib/context_provider.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/context_provider.h"
-
-#include <stdint.h>
-
-#include "base/logging.h"
-#include "components/mus/public/cpp/gles2_context.h"
-#include "services/shell/public/cpp/connector.h"
-
-namespace mus {
-
-ContextProvider::ContextProvider(shell::Connector* connector)
- : connector_(connector->Clone()) {}
-
-bool ContextProvider::BindToCurrentThread() {
- if (connector_) {
- context_ = GLES2Context::CreateOffscreenContext(std::vector<int32_t>(),
- connector_.get());
- // We don't need the connector anymore, so release it.
- connector_.reset();
- }
- return !!context_;
-}
-
-gpu::gles2::GLES2Interface* ContextProvider::ContextGL() {
- return context_->interface();
-}
-
-gpu::ContextSupport* ContextProvider::ContextSupport() {
- if (!context_)
- return NULL;
- return context_->context_support();
-}
-
-class GrContext* ContextProvider::GrContext() {
- return NULL;
-}
-
-void ContextProvider::InvalidateGrContext(uint32_t state) {}
-
-gpu::Capabilities ContextProvider::ContextCapabilities() {
- gpu::Capabilities capabilities;
- // Enabled the CHROMIUM_image extension to use GpuMemoryBuffers. The
- // implementation of which is used in CommandBufferDriver.
- capabilities.image = true;
- return capabilities;
-}
-
-base::Lock* ContextProvider::GetLock() {
- // This context provider is not used on multiple threads.
- NOTREACHED();
- return nullptr;
-}
-
-ContextProvider::~ContextProvider() {
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/public/cpp/lib/gles2_context.cc b/chromium/components/mus/public/cpp/lib/gles2_context.cc
deleted file mode 100644
index 84363b15cfe..00000000000
--- a/chromium/components/mus/public/cpp/lib/gles2_context.cc
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/gles2_context.h"
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <utility>
-
-#include "components/mus/common/gpu_service.h"
-#include "components/mus/public/cpp/lib/command_buffer_client_impl.h"
-#include "components/mus/public/interfaces/command_buffer.mojom.h"
-#include "components/mus/public/interfaces/gpu_service.mojom.h"
-#include "gpu/command_buffer/client/gles2_cmd_helper.h"
-#include "gpu/command_buffer/client/shared_memory_limits.h"
-#include "gpu/command_buffer/client/transfer_buffer.h"
-#include "gpu/ipc/client/command_buffer_proxy_impl.h"
-#include "mojo/public/cpp/system/core.h"
-#include "services/shell/public/cpp/connector.h"
-#include "url/gurl.h"
-
-namespace mus {
-
-GLES2Context::GLES2Context() {}
-
-GLES2Context::~GLES2Context() {}
-
-bool GLES2Context::Initialize(const std::vector<int32_t>& attribs,
- shell::Connector* connector) {
- gpu::CommandBuffer* command_buffer = nullptr;
- gpu::GpuControl* gpu_control = nullptr;
- // TODO(penghuang): Use type gpu::gles2::ContextCreationAttribHelper for
- // attribs.
- if (!mus::GpuService::UseChromeGpuCommandBuffer()) {
- mojom::GpuPtr gpu;
- connector->ConnectToInterface("mojo:mus", &gpu);
- mojom::CommandBufferPtr command_buffer_ptr;
- gpu->CreateOffscreenGLES2Context(GetProxy(&command_buffer_ptr));
- command_buffer_client_impl_.reset(
- new CommandBufferClientImpl(attribs, std::move(command_buffer_ptr)));
- if (!command_buffer_client_impl_->Initialize())
- return false;
- command_buffer = command_buffer_client_impl_.get();
- gpu_control = command_buffer_client_impl_.get();
- } else {
- scoped_refptr<gpu::GpuChannelHost> gpu_channel_host =
- GpuService::GetInstance()->EstablishGpuChannelSync();
- if (!gpu_channel_host)
- return false;
- gpu::SurfaceHandle surface_handle = gfx::kNullAcceleratedWidget;
- // TODO(penghuang): support shared group.
- gpu::CommandBufferProxyImpl* shared_command_buffer = nullptr;
- gpu::GpuStreamId stream_id = gpu::GpuStreamId::GPU_STREAM_DEFAULT;
- gpu::GpuStreamPriority stream_priority = gpu::GpuStreamPriority::NORMAL;
- gpu::gles2::ContextCreationAttribHelper attributes;
- // TODO(penghuang): figure a useful active_url.
- GURL active_url;
- scoped_refptr<base::SingleThreadTaskRunner> task_runner =
- base::ThreadTaskRunnerHandle::Get();
- if (!attributes.Parse(attribs))
- return false;
- command_buffer_proxy_impl_ = gpu::CommandBufferProxyImpl::Create(
- std::move(gpu_channel_host), surface_handle, shared_command_buffer,
- stream_id, stream_priority, attributes, active_url,
- std::move(task_runner));
- if (!command_buffer_proxy_impl_)
- return false;
- command_buffer = command_buffer_proxy_impl_.get();
- gpu_control = command_buffer_proxy_impl_.get();
- }
-
- constexpr gpu::SharedMemoryLimits default_limits;
- gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer));
- if (!gles2_helper_->Initialize(default_limits.command_buffer_size))
- return false;
- gles2_helper_->SetAutomaticFlushes(false);
- transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get()));
- gpu::Capabilities capabilities = gpu_control->GetCapabilities();
- bool bind_generates_resource =
- !!capabilities.bind_generates_resource_chromium;
- // TODO(piman): Some contexts (such as compositor) want this to be true, so
- // this needs to be a public parameter.
- bool lose_context_when_out_of_memory = false;
- bool support_client_side_arrays = false;
- implementation_.reset(new gpu::gles2::GLES2Implementation(
- gles2_helper_.get(), NULL, transfer_buffer_.get(),
- bind_generates_resource, lose_context_when_out_of_memory,
- support_client_side_arrays, gpu_control));
- if (!implementation_->Initialize(default_limits.start_transfer_buffer_size,
- default_limits.min_transfer_buffer_size,
- default_limits.max_transfer_buffer_size,
- default_limits.mapped_memory_reclaim_limit))
- return false;
- return true;
-}
-
-// static
-std::unique_ptr<GLES2Context> GLES2Context::CreateOffscreenContext(
- const std::vector<int32_t>& attribs,
- shell::Connector* connector) {
- std::unique_ptr<GLES2Context> gles2_context(new GLES2Context);
- if (!gles2_context->Initialize(attribs, connector))
- gles2_context.reset();
- return gles2_context;
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/public/cpp/lib/in_flight_change.cc b/chromium/components/mus/public/cpp/lib/in_flight_change.cc
deleted file mode 100644
index 04878742350..00000000000
--- a/chromium/components/mus/public/cpp/lib/in_flight_change.cc
+++ /dev/null
@@ -1,220 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/lib/in_flight_change.h"
-
-#include "components/mus/public/cpp/lib/window_private.h"
-#include "components/mus/public/cpp/window_tree_client.h"
-
-namespace mus {
-
-// InFlightChange -------------------------------------------------------------
-
-InFlightChange::InFlightChange(Window* window, ChangeType type)
- : window_(window), change_type_(type) {}
-
-InFlightChange::~InFlightChange() {}
-
-bool InFlightChange::Matches(const InFlightChange& change) const {
- DCHECK(change.window_ == window_ && change.change_type_ == change_type_);
- return true;
-}
-
-void InFlightChange::ChangeFailed() {}
-
-// InFlightBoundsChange -------------------------------------------------------
-
-InFlightBoundsChange::InFlightBoundsChange(Window* window,
- const gfx::Rect& revert_bounds)
- : InFlightChange(window, ChangeType::BOUNDS),
- revert_bounds_(revert_bounds) {}
-
-void InFlightBoundsChange::SetRevertValueFrom(const InFlightChange& change) {
- revert_bounds_ =
- static_cast<const InFlightBoundsChange&>(change).revert_bounds_;
-}
-
-void InFlightBoundsChange::Revert() {
- WindowPrivate(window()).LocalSetBounds(window()->bounds(), revert_bounds_);
-}
-
-// CrashInFlightChange --------------------------------------------------------
-
-CrashInFlightChange::CrashInFlightChange(Window* window, ChangeType type)
- : InFlightChange(window, type) {}
-
-CrashInFlightChange::~CrashInFlightChange() {}
-
-void CrashInFlightChange::SetRevertValueFrom(const InFlightChange& change) {
- CHECK(false);
-}
-
-void CrashInFlightChange::ChangeFailed() {
- DLOG(ERROR) << "changed failed, type=" << static_cast<int>(change_type());
- CHECK(false);
-}
-
-void CrashInFlightChange::Revert() {
- CHECK(false);
-}
-
-// InFlightWindowChange -------------------------------------------------------
-
-InFlightWindowTreeClientChange::InFlightWindowTreeClientChange(
- WindowTreeClient* client,
- Window* revert_value,
- ChangeType type)
- : InFlightChange(nullptr, type),
- client_(client),
- revert_window_(nullptr) {
- SetRevertWindow(revert_value);
-}
-
-InFlightWindowTreeClientChange::~InFlightWindowTreeClientChange() {
- SetRevertWindow(nullptr);
-}
-
-void InFlightWindowTreeClientChange::SetRevertValueFrom(
- const InFlightChange& change) {
- SetRevertWindow(static_cast<const InFlightWindowTreeClientChange&>(change)
- .revert_window_);
-}
-
-void InFlightWindowTreeClientChange::SetRevertWindow(Window* window) {
- if (revert_window_)
- revert_window_->RemoveObserver(this);
- revert_window_ = window;
- if (revert_window_)
- revert_window_->AddObserver(this);
-}
-
-void InFlightWindowTreeClientChange::OnWindowDestroying(Window* window) {
- SetRevertWindow(nullptr);
-}
-
-// InFlightCaptureChange ------------------------------------------------------
-
-InFlightCaptureChange::InFlightCaptureChange(
- WindowTreeClient* client, Window* revert_value)
- : InFlightWindowTreeClientChange(client,
- revert_value,
- ChangeType::CAPTURE) {}
-
-InFlightCaptureChange::~InFlightCaptureChange() {}
-
-void InFlightCaptureChange::Revert() {
- client()->LocalSetCapture(revert_window());
-}
-
-// InFlightFocusChange --------------------------------------------------------
-
-InFlightFocusChange::InFlightFocusChange(
- WindowTreeClient* client,
- Window* revert_value)
- : InFlightWindowTreeClientChange(client,
- revert_value,
- ChangeType::FOCUS) {}
-
-InFlightFocusChange::~InFlightFocusChange() {}
-
-void InFlightFocusChange::Revert() {
- client()->LocalSetFocus(revert_window());
-}
-
-// InFlightPropertyChange -----------------------------------------------------
-
-InFlightPropertyChange::InFlightPropertyChange(
- Window* window,
- const std::string& property_name,
- const mojo::Array<uint8_t>& revert_value)
- : InFlightChange(window, ChangeType::PROPERTY),
- property_name_(property_name),
- revert_value_(revert_value.Clone()) {}
-
-InFlightPropertyChange::~InFlightPropertyChange() {}
-
-bool InFlightPropertyChange::Matches(const InFlightChange& change) const {
- return static_cast<const InFlightPropertyChange&>(change).property_name_ ==
- property_name_;
-}
-
-void InFlightPropertyChange::SetRevertValueFrom(const InFlightChange& change) {
- revert_value_ =
- static_cast<const InFlightPropertyChange&>(change).revert_value_.Clone();
-}
-
-void InFlightPropertyChange::Revert() {
- WindowPrivate(window())
- .LocalSetSharedProperty(property_name_, std::move(revert_value_));
-}
-
-// InFlightPredefinedCursorChange ---------------------------------------------
-
-InFlightPredefinedCursorChange::InFlightPredefinedCursorChange(
- Window* window,
- mojom::Cursor revert_value)
- : InFlightChange(window, ChangeType::PREDEFINED_CURSOR),
- revert_cursor_(revert_value) {}
-
-InFlightPredefinedCursorChange::~InFlightPredefinedCursorChange() {}
-
-void InFlightPredefinedCursorChange::SetRevertValueFrom(
- const InFlightChange& change) {
- revert_cursor_ =
- static_cast<const InFlightPredefinedCursorChange&>(change).revert_cursor_;
-}
-
-void InFlightPredefinedCursorChange::Revert() {
- WindowPrivate(window()).LocalSetPredefinedCursor(revert_cursor_);
-}
-
-// InFlightVisibleChange -------------------------------------------------------
-
-InFlightVisibleChange::InFlightVisibleChange(Window* window,
- bool revert_value)
- : InFlightChange(window, ChangeType::VISIBLE),
- revert_visible_(revert_value) {}
-
-InFlightVisibleChange::~InFlightVisibleChange() {}
-
-void InFlightVisibleChange::SetRevertValueFrom(const InFlightChange& change) {
- revert_visible_ =
- static_cast<const InFlightVisibleChange&>(change).revert_visible_;
-}
-
-void InFlightVisibleChange::Revert() {
- WindowPrivate(window()).LocalSetVisible(revert_visible_);
-}
-
-// InFlightOpacityChange -------------------------------------------------------
-
-InFlightOpacityChange::InFlightOpacityChange(Window* window, float revert_value)
- : InFlightChange(window, ChangeType::OPACITY),
- revert_opacity_(revert_value) {}
-
-InFlightOpacityChange::~InFlightOpacityChange() {}
-
-void InFlightOpacityChange::SetRevertValueFrom(const InFlightChange& change) {
- revert_opacity_ =
- static_cast<const InFlightOpacityChange&>(change).revert_opacity_;
-}
-
-void InFlightOpacityChange::Revert() {
- WindowPrivate(window()).LocalSetOpacity(revert_opacity_);
-}
-
-// InFlightSetModalChange ------------------------------------------------------
-
-InFlightSetModalChange::InFlightSetModalChange(Window* window)
- : InFlightChange(window, ChangeType::SET_MODAL) {}
-
-InFlightSetModalChange::~InFlightSetModalChange() {}
-
-void InFlightSetModalChange::SetRevertValueFrom(const InFlightChange& change) {}
-
-void InFlightSetModalChange::Revert() {
- WindowPrivate(window()).LocalUnsetModal();
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/public/cpp/lib/in_flight_change.h b/chromium/components/mus/public/cpp/lib/in_flight_change.h
deleted file mode 100644
index bf77fc6e6b1..00000000000
--- a/chromium/components/mus/public/cpp/lib/in_flight_change.h
+++ /dev/null
@@ -1,298 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_LIB_IN_FLIGHT_CHANGE_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_LIB_IN_FLIGHT_CHANGE_H_
-
-#include <stdint.h>
-
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "base/macros.h"
-#include "base/memory/ptr_util.h"
-#include "components/mus/public/cpp/window_observer.h"
-#include "mojo/public/cpp/bindings/array.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace mus {
-
-namespace mojom {
-enum class Cursor : int32_t;
-}
-
-class Window;
-class WindowTreeClient;
-
-enum class ChangeType {
- ADD_CHILD,
- ADD_TRANSIENT_WINDOW,
- BOUNDS,
- CAPTURE,
- DELETE_WINDOW,
- FOCUS,
- NEW_WINDOW,
- NEW_TOP_LEVEL_WINDOW,
- OPACITY,
- PREDEFINED_CURSOR,
- PROPERTY,
- REMOVE_CHILD,
- REMOVE_TRANSIENT_WINDOW_FROM_PARENT,
- REORDER,
- SET_MODAL,
- VISIBLE,
-};
-
-// InFlightChange is used to track function calls to the server and take the
-// appropriate action when the call fails, or the same property changes while
-// waiting for the response. When a function is called on the server an
-// InFlightChange is created. The function call is complete when
-// OnChangeCompleted() is received from the server. The following may occur
-// while waiting for a response:
-// . A new value is encountered from the server. For example, the bounds of
-// a window is locally changed and while waiting for the ack
-// OnWindowBoundsChanged() is received.
-// When this happens SetRevertValueFrom() is invoked on the InFlightChange.
-// The expectation is SetRevertValueFrom() takes the value to revert from the
-// supplied change.
-// . While waiting for the ack the property is again modified locally. When
-// this happens a new InFlightChange is created. Once the ack for the first
-// call is received, and the server rejected the change ChangeFailed() is
-// invoked on the first change followed by SetRevertValueFrom() on the second
-// InFlightChange. This allows the new change to update the value to revert
-// should the second call fail.
-// . If the server responds that the call failed and there is not another
-// InFlightChange for the same window outstanding, then ChangeFailed() is
-// invoked followed by Revert(). The expectation is Revert() sets the
-// appropriate value back on the Window.
-//
-// In general there are two classes of changes:
-// 1. We are the only side allowed to make the change.
-// 2. The change can also be applied by another client. For example, the
-// window manager may change the bounds as well as the local client.
-//
-// For (1) use CrashInFlightChange. As the name implies this change CHECKs that
-// the change succeeded. Use the following pattern for this. This code goes
-// where the change is sent to the server (in WindowTreeClient):
-// const uint32_t change_id =
-// ScheduleInFlightChange(base::WrapUnique(new CrashInFlightChange(
-// window, ChangeType::REORDER)));
-//
-// For (2) use the same pattern as (1), but in the on change callback from the
-// server (e.g. OnWindowBoundsChanged()) add the following:
-// // value_from_server is the value supplied from the server. It corresponds
-// // to the value of the property at the time the server processed the
-// // change. If the local change fails, this is the value reverted to.
-// InFlightBoundsChange new_change(window, value_from_server);
-// if (ApplyServerChangeToExistingInFlightChange(new_change)) {
-// // There was an in flight change for the same property. The in flight
-// // change takes the value to revert from |new_change|.
-// return;
-// }
-//
-// // else case is no flight in change and the new value can be applied
-// // immediately.
-// WindowPrivate(window).LocalSetValue(new_value_from_server);
-//
-class InFlightChange {
- public:
- InFlightChange(Window* window, ChangeType type);
- virtual ~InFlightChange();
-
- // NOTE: for properties not associated with any window window is null.
- Window* window() { return window_; }
- const Window* window() const { return window_; }
- ChangeType change_type() const { return change_type_; }
-
- // Returns true if the two changes are considered the same. This is only
- // invoked if the window id and ChangeType match.
- virtual bool Matches(const InFlightChange& change) const;
-
- // Called in two cases:
- // . When the corresponding property on the server changes. In this case
- // |change| corresponds to the value from the server.
- // . When |change| unsuccesfully completes.
- virtual void SetRevertValueFrom(const InFlightChange& change) = 0;
-
- // The change failed. Normally you need not take any action here as Revert()
- // is called as appropriate.
- virtual void ChangeFailed();
-
- // The change failed and there is no pending change of the same type
- // outstanding, revert the value.
- virtual void Revert() = 0;
-
- private:
- Window* window_;
- const ChangeType change_type_;
-};
-
-class InFlightBoundsChange : public InFlightChange {
- public:
- InFlightBoundsChange(Window* window, const gfx::Rect& revert_bounds);
-
- // InFlightChange:
- void SetRevertValueFrom(const InFlightChange& change) override;
- void Revert() override;
-
- private:
- gfx::Rect revert_bounds_;
-
- DISALLOW_COPY_AND_ASSIGN(InFlightBoundsChange);
-};
-
-// Inflight change that crashes on failure. This is useful for changes that are
-// expected to always complete.
-class CrashInFlightChange : public InFlightChange {
- public:
- CrashInFlightChange(Window* window, ChangeType type);
- ~CrashInFlightChange() override;
-
- // InFlightChange:
- void SetRevertValueFrom(const InFlightChange& change) override;
- void ChangeFailed() override;
- void Revert() override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CrashInFlightChange);
-};
-
-// Use this class for properties that are specific to the client, and not a
-// particular window. For example, only a single window can have focus, so focus
-// is specific to the client.
-//
-// This does not implement InFlightChange::Revert, subclasses must implement
-// that to update the WindowTreeClient.
-class InFlightWindowTreeClientChange : public InFlightChange,
- public WindowObserver {
- public:
- InFlightWindowTreeClientChange(WindowTreeClient* client,
- Window* revert_value,
- ChangeType type);
- ~InFlightWindowTreeClientChange() override;
-
- // InFlightChange:
- void SetRevertValueFrom(const InFlightChange& change) override;
-
- protected:
- WindowTreeClient* client() { return client_; }
- Window* revert_window() { return revert_window_; }
-
- private:
- void SetRevertWindow(Window* window);
-
- // WindowObserver:
- void OnWindowDestroying(Window* window) override;
-
- WindowTreeClient* client_;
- Window* revert_window_;
-
- DISALLOW_COPY_AND_ASSIGN(InFlightWindowTreeClientChange);
-};
-
-class InFlightCaptureChange : public InFlightWindowTreeClientChange {
- public:
- InFlightCaptureChange(WindowTreeClient* client, Window* revert_value);
- ~InFlightCaptureChange() override;
-
- // InFlightChange:
- void Revert() override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(InFlightCaptureChange);
-};
-
-class InFlightFocusChange : public InFlightWindowTreeClientChange {
- public:
- InFlightFocusChange(WindowTreeClient* client, Window* revert_value);
- ~InFlightFocusChange() override;
-
- // InFlightChange:
- void Revert() override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(InFlightFocusChange);
-};
-
-class InFlightPropertyChange : public InFlightChange {
- public:
- InFlightPropertyChange(Window* window,
- const std::string& property_name,
- const mojo::Array<uint8_t>& revert_value);
- ~InFlightPropertyChange() override;
-
- // InFlightChange:
- bool Matches(const InFlightChange& change) const override;
- void SetRevertValueFrom(const InFlightChange& change) override;
- void Revert() override;
-
- private:
- const std::string property_name_;
- mojo::Array<uint8_t> revert_value_;
-
- DISALLOW_COPY_AND_ASSIGN(InFlightPropertyChange);
-};
-
-class InFlightPredefinedCursorChange : public InFlightChange {
- public:
- InFlightPredefinedCursorChange(Window* window, mojom::Cursor revert_value);
- ~InFlightPredefinedCursorChange() override;
-
- // InFlightChange:
- void SetRevertValueFrom(const InFlightChange& change) override;
- void Revert() override;
-
- private:
- mojom::Cursor revert_cursor_;
-
- DISALLOW_COPY_AND_ASSIGN(InFlightPredefinedCursorChange);
-};
-
-class InFlightVisibleChange : public InFlightChange {
- public:
- InFlightVisibleChange(Window* window, const bool revert_value);
- ~InFlightVisibleChange() override;
-
- // InFlightChange:
- void SetRevertValueFrom(const InFlightChange& change) override;
- void Revert() override;
-
- private:
- bool revert_visible_;
-
- DISALLOW_COPY_AND_ASSIGN(InFlightVisibleChange);
-};
-
-class InFlightOpacityChange : public InFlightChange {
- public:
- InFlightOpacityChange(Window* window, float revert_value);
- ~InFlightOpacityChange() override;
-
- // InFlightChange:
- void SetRevertValueFrom(const InFlightChange& change) override;
- void Revert() override;
-
- private:
- float revert_opacity_;
-
- DISALLOW_COPY_AND_ASSIGN(InFlightOpacityChange);
-};
-
-class InFlightSetModalChange : public InFlightChange {
- public:
- explicit InFlightSetModalChange(Window* window);
- ~InFlightSetModalChange() override;
-
- // InFlightChange:
- void SetRevertValueFrom(const InFlightChange& change) override;
- void Revert() override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(InFlightSetModalChange);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_IN_FLIGHT_CHANGE_H_
diff --git a/chromium/components/mus/public/cpp/lib/output_surface.cc b/chromium/components/mus/public/cpp/lib/output_surface.cc
deleted file mode 100644
index 86462ec95f4..00000000000
--- a/chromium/components/mus/public/cpp/lib/output_surface.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/output_surface.h"
-
-#include "base/bind.h"
-#include "cc/output/compositor_frame.h"
-#include "cc/output/compositor_frame_ack.h"
-#include "cc/output/output_surface_client.h"
-#include "components/mus/public/cpp/window_surface.h"
-
-namespace mus {
-
-OutputSurface::OutputSurface(
- const scoped_refptr<cc::ContextProvider>& context_provider,
- std::unique_ptr<mus::WindowSurface> surface)
- : cc::OutputSurface(context_provider, nullptr, nullptr),
- surface_(std::move(surface)) {
- capabilities_.delegated_rendering = true;
-}
-
-OutputSurface::~OutputSurface() {}
-
-bool OutputSurface::BindToClient(cc::OutputSurfaceClient* client) {
- surface_->BindToThread();
- surface_->set_client(this);
- return cc::OutputSurface::BindToClient(client);
-}
-
-void OutputSurface::DetachFromClient() {
- surface_.reset();
- cc::OutputSurface::DetachFromClient();
-}
-
-void OutputSurface::BindFramebuffer() {
- // This is a delegating output surface, no framebuffer/direct drawing support.
- NOTREACHED();
-}
-
-uint32_t OutputSurface::GetFramebufferCopyTextureFormat() {
- // This is a delegating output surface, no framebuffer/direct drawing support.
- NOTREACHED();
- return 0;
-}
-
-void OutputSurface::SwapBuffers(cc::CompositorFrame frame) {
- // TODO(fsamuel, rjkroege): We should probably throttle compositor frames.
- client_->DidSwapBuffers();
- // OutputSurface owns WindowSurface, and so if OutputSurface is
- // destroyed then SubmitCompositorFrame's callback will never get called.
- // Thus, base::Unretained is safe here.
- surface_->SubmitCompositorFrame(
- std::move(frame),
- base::Bind(&OutputSurface::SwapBuffersComplete, base::Unretained(this)));
-}
-
-void OutputSurface::OnResourcesReturned(
- mus::WindowSurface* surface,
- mojo::Array<cc::ReturnedResource> resources) {
- cc::CompositorFrameAck cfa;
- cfa.resources = resources.To<cc::ReturnedResourceArray>();
- ReclaimResources(&cfa);
-}
-
-void OutputSurface::SwapBuffersComplete() {
- client_->DidSwapBuffersComplete();
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/public/cpp/lib/property_type_converters.cc b/chromium/components/mus/public/cpp/lib/property_type_converters.cc
deleted file mode 100644
index 17cacf1f249..00000000000
--- a/chromium/components/mus/public/cpp/lib/property_type_converters.cc
+++ /dev/null
@@ -1,207 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/property_type_converters.h"
-
-#include <stdint.h>
-
-#include "base/strings/utf_string_conversions.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/gfx/geometry/size.h"
-
-namespace {
-
-// Maximum allowed height or width of a bitmap, in pixels. This limit prevents
-// malformed bitmap headers from causing arbitrarily large memory allocations
-// for pixel data.
-const int kMaxBitmapSize = 4096;
-
-} // namespace
-
-namespace mojo {
-
-// static
-std::vector<uint8_t> TypeConverter<std::vector<uint8_t>, gfx::Rect>::Convert(
- const gfx::Rect& input) {
- std::vector<uint8_t> vec(16);
- vec[0] = (input.x() >> 24) & 0xFF;
- vec[1] = (input.x() >> 16) & 0xFF;
- vec[2] = (input.x() >> 8) & 0xFF;
- vec[3] = input.x() & 0xFF;
- vec[4] = (input.y() >> 24) & 0xFF;
- vec[5] = (input.y() >> 16) & 0xFF;
- vec[6] = (input.y() >> 8) & 0xFF;
- vec[7] = input.y() & 0xFF;
- vec[8] = (input.width() >> 24) & 0xFF;
- vec[9] = (input.width() >> 16) & 0xFF;
- vec[10] = (input.width() >> 8) & 0xFF;
- vec[11] = input.width() & 0xFF;
- vec[12] = (input.height() >> 24) & 0xFF;
- vec[13] = (input.height() >> 16) & 0xFF;
- vec[14] = (input.height() >> 8) & 0xFF;
- vec[15] = input.height() & 0xFF;
- return vec;
-}
-
-// static
-gfx::Rect TypeConverter<gfx::Rect, std::vector<uint8_t>>::Convert(
- const std::vector<uint8_t>& input) {
- return gfx::Rect(
- input[0] << 24 | input[1] << 16 | input[2] << 8 | input[3],
- input[4] << 24 | input[5] << 16 | input[6] << 8 | input[7],
- input[8] << 24 | input[9] << 16 | input[10] << 8 | input[11],
- input[12] << 24 | input[13] << 16 | input[14] << 8 | input[15]);
-}
-
-// static
-std::vector<uint8_t> TypeConverter<std::vector<uint8_t>, gfx::Size>::Convert(
- const gfx::Size& input) {
- std::vector<uint8_t> vec(8);
- vec[0] = (input.width() >> 24) & 0xFF;
- vec[1] = (input.width() >> 16) & 0xFF;
- vec[2] = (input.width() >> 8) & 0xFF;
- vec[3] = input.width() & 0xFF;
- vec[4] = (input.height() >> 24) & 0xFF;
- vec[5] = (input.height() >> 16) & 0xFF;
- vec[6] = (input.height() >> 8) & 0xFF;
- vec[7] = input.height() & 0xFF;
- return vec;
-}
-
-// static
-gfx::Size TypeConverter<gfx::Size, std::vector<uint8_t>>::Convert(
- const std::vector<uint8_t>& input) {
- return gfx::Size(input[0] << 24 | input[1] << 16 | input[2] << 8 | input[3],
- input[4] << 24 | input[5] << 16 | input[6] << 8 | input[7]);
-}
-
-// static
-std::vector<uint8_t> TypeConverter<std::vector<uint8_t>, int32_t>::Convert(
- const int32_t& input) {
- std::vector<uint8_t> vec(4);
- vec[0] = (input >> 24) & 0xFF;
- vec[1] = (input >> 16) & 0xFF;
- vec[2] = (input >> 8) & 0xFF;
- vec[3] = input & 0xFF;
- return vec;
-}
-
-// static
-int32_t TypeConverter<int32_t, std::vector<uint8_t>>::Convert(
- const std::vector<uint8_t>& input) {
- return input[0] << 24 | input[1] << 16 | input[2] << 8 | input[3];
-}
-
-// static
-std::vector<uint8_t>
-TypeConverter<std::vector<uint8_t>, base::string16>::Convert(
- const base::string16& input) {
- return ConvertTo<std::vector<uint8_t>>(base::UTF16ToUTF8(input));
-}
-
-// static
-base::string16 TypeConverter<base::string16, std::vector<uint8_t>>::Convert(
- const std::vector<uint8_t>& input) {
- return base::UTF8ToUTF16(ConvertTo<std::string>(input));
-}
-
-// static
-std::vector<uint8_t> TypeConverter<std::vector<uint8_t>, std::string>::Convert(
- const std::string& input) {
- return std::vector<uint8_t>(input.begin(), input.end());
-}
-
-// static
-std::string TypeConverter<std::string, std::vector<uint8_t>>::Convert(
- const std::vector<uint8_t>& input) {
- return std::string(input.begin(), input.end());
-}
-
-// static
-std::vector<uint8_t> TypeConverter<std::vector<uint8_t>, SkBitmap>::Convert(
- const SkBitmap& input) {
- // Empty images are valid to serialize and are represented by an empty vector.
- if (input.isNull())
- return std::vector<uint8_t>();
-
- // Only RGBA 8888 bitmaps with premultiplied alpha are supported.
- if (input.colorType() != kBGRA_8888_SkColorType ||
- input.alphaType() != kPremul_SkAlphaType) {
- NOTREACHED();
- return std::vector<uint8_t>();
- }
-
- // Sanity check the bitmap size.
- int width = input.width();
- int height = input.height();
- if (width < 0 || width > kMaxBitmapSize || height < 0 ||
- height > kMaxBitmapSize) {
- NOTREACHED();
- return std::vector<uint8_t>();
- }
-
- // Serialize the bitmap. The size is restricted so only 2 bytes are required
- // per dimension.
- std::vector<uint8_t> vec(4 + input.getSize());
- vec[0] = (width >> 8) & 0xFF;
- vec[1] = width & 0xFF;
- vec[2] = (height >> 8) & 0xFF;
- vec[3] = height & 0xFF;
- if (!input.copyPixelsTo(&vec[4], input.getSize()))
- return std::vector<uint8_t>();
- return vec;
-}
-
-// static
-SkBitmap TypeConverter<SkBitmap, std::vector<uint8_t>>::Convert(
- const std::vector<uint8_t>& input) {
- // Empty images are represented by empty vectors.
- if (input.empty())
- return SkBitmap();
-
- // Read and sanity check size.
- int width = input[0] << 8 | input[1];
- int height = input[2] << 8 | input[3];
- if (width < 0 || width > kMaxBitmapSize || height < 0 ||
- height > kMaxBitmapSize) {
- NOTREACHED();
- return SkBitmap();
- }
-
- // Try to allocate a bitmap of the appropriate size.
- SkBitmap bitmap;
- if (!bitmap.tryAllocPixels(SkImageInfo::Make(
- width, height, kBGRA_8888_SkColorType, kPremul_SkAlphaType))) {
- return SkBitmap();
- }
-
- // Ensure the vector contains the right amount of data.
- if (input.size() != bitmap.getSize() + 4) {
- NOTREACHED();
- return SkBitmap();
- }
-
- // Read the pixel data.
- SkAutoLockPixels lock(bitmap);
- memcpy(bitmap.getPixels(), &input[4], bitmap.getSize());
- return bitmap;
-}
-
-// static
-std::vector<uint8_t> TypeConverter<std::vector<uint8_t>, bool>::Convert(
- bool input) {
- std::vector<uint8_t> vec(1);
- vec[0] = input ? 1 : 0;
- return vec;
-}
-
-// static
-bool TypeConverter<bool, std::vector<uint8_t>>::Convert(
- const std::vector<uint8_t>& input) {
- // Empty vectors are interpreted as false.
- return !input.empty() && (input[0] == 1);
-}
-
-} // namespace mojo
diff --git a/chromium/components/mus/public/cpp/lib/scoped_window_ptr.cc b/chromium/components/mus/public/cpp/lib/scoped_window_ptr.cc
deleted file mode 100644
index 360da1ff4b5..00000000000
--- a/chromium/components/mus/public/cpp/lib/scoped_window_ptr.cc
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/scoped_window_ptr.h"
-
-#include "components/mus/public/cpp/window.h"
-#include "components/mus/public/cpp/window_observer.h"
-#include "components/mus/public/cpp/window_tree_client.h"
-
-namespace mus {
-
-ScopedWindowPtr::ScopedWindowPtr(Window* window) : window_(window) {
- window_->AddObserver(this);
-}
-
-ScopedWindowPtr::~ScopedWindowPtr() {
- if (window_)
- DeleteWindowOrWindowManager(window_);
- DetachFromWindow();
-}
-
-// static
-void ScopedWindowPtr::DeleteWindowOrWindowManager(Window* window) {
- if (window->window_tree()->GetRoots().count(window) > 0)
- delete window->window_tree();
- else
- window->Destroy();
-}
-
-void ScopedWindowPtr::DetachFromWindow() {
- if (!window_)
- return;
-
- window_->RemoveObserver(this);
- window_ = nullptr;
-}
-
-void ScopedWindowPtr::OnWindowDestroying(Window* window) {
- DCHECK_EQ(window_, window);
- DetachFromWindow();
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/public/cpp/lib/window.cc b/chromium/components/mus/public/cpp/lib/window.cc
deleted file mode 100644
index 83785c4544e..00000000000
--- a/chromium/components/mus/public/cpp/lib/window.cc
+++ /dev/null
@@ -1,891 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/window.h"
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <set>
-#include <string>
-
-#include "base/bind.h"
-#include "base/macros.h"
-#include "components/mus/common/transient_window_utils.h"
-#include "components/mus/public/cpp/lib/window_private.h"
-#include "components/mus/public/cpp/property_type_converters.h"
-#include "components/mus/public/cpp/window_observer.h"
-#include "components/mus/public/cpp/window_property.h"
-#include "components/mus/public/cpp/window_surface.h"
-#include "components/mus/public/cpp/window_tracker.h"
-#include "components/mus/public/cpp/window_tree_client.h"
-#include "components/mus/public/interfaces/window_manager.mojom.h"
-#include "ui/display/display.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/gfx/geometry/size.h"
-
-namespace mus {
-
-namespace {
-
-void NotifyWindowTreeChangeAtReceiver(
- Window* receiver,
- const WindowObserver::TreeChangeParams& params,
- bool change_applied) {
- WindowObserver::TreeChangeParams local_params = params;
- local_params.receiver = receiver;
- if (change_applied) {
- FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(receiver).observers(),
- OnTreeChanged(local_params));
- } else {
- FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(receiver).observers(),
- OnTreeChanging(local_params));
- }
-}
-
-void NotifyWindowTreeChangeUp(Window* start_at,
- const WindowObserver::TreeChangeParams& params,
- bool change_applied) {
- for (Window* current = start_at; current; current = current->parent())
- NotifyWindowTreeChangeAtReceiver(current, params, change_applied);
-}
-
-void NotifyWindowTreeChangeDown(Window* start_at,
- const WindowObserver::TreeChangeParams& params,
- bool change_applied) {
- NotifyWindowTreeChangeAtReceiver(start_at, params, change_applied);
- Window::Children::const_iterator it = start_at->children().begin();
- for (; it != start_at->children().end(); ++it)
- NotifyWindowTreeChangeDown(*it, params, change_applied);
-}
-
-void NotifyWindowTreeChange(const WindowObserver::TreeChangeParams& params,
- bool change_applied) {
- NotifyWindowTreeChangeDown(params.target, params, change_applied);
- if (params.old_parent)
- NotifyWindowTreeChangeUp(params.old_parent, params, change_applied);
- if (params.new_parent)
- NotifyWindowTreeChangeUp(params.new_parent, params, change_applied);
-}
-
-class ScopedTreeNotifier {
- public:
- ScopedTreeNotifier(Window* target, Window* old_parent, Window* new_parent) {
- params_.target = target;
- params_.old_parent = old_parent;
- params_.new_parent = new_parent;
- NotifyWindowTreeChange(params_, false);
- }
- ~ScopedTreeNotifier() { NotifyWindowTreeChange(params_, true); }
-
- private:
- WindowObserver::TreeChangeParams params_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedTreeNotifier);
-};
-
-void RemoveChildImpl(Window* child, Window::Children* children) {
- Window::Children::iterator it =
- std::find(children->begin(), children->end(), child);
- if (it != children->end()) {
- children->erase(it);
- WindowPrivate(child).ClearParent();
- }
-}
-
-class OrderChangedNotifier {
- public:
- OrderChangedNotifier(Window* window,
- Window* relative_window,
- mojom::OrderDirection direction)
- : window_(window),
- relative_window_(relative_window),
- direction_(direction) {}
-
- ~OrderChangedNotifier() {}
-
- void NotifyWindowReordering() {
- FOR_EACH_OBSERVER(
- WindowObserver, *WindowPrivate(window_).observers(),
- OnWindowReordering(window_, relative_window_, direction_));
- }
-
- void NotifyWindowReordered() {
- FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(window_).observers(),
- OnWindowReordered(window_, relative_window_, direction_));
- }
-
- private:
- Window* window_;
- Window* relative_window_;
- mojom::OrderDirection direction_;
-
- DISALLOW_COPY_AND_ASSIGN(OrderChangedNotifier);
-};
-
-class ScopedSetBoundsNotifier {
- public:
- ScopedSetBoundsNotifier(Window* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds)
- : window_(window), old_bounds_(old_bounds), new_bounds_(new_bounds) {
- FOR_EACH_OBSERVER(
- WindowObserver, *WindowPrivate(window_).observers(),
- OnWindowBoundsChanging(window_, old_bounds_, new_bounds_));
- }
- ~ScopedSetBoundsNotifier() {
- FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(window_).observers(),
- OnWindowBoundsChanged(window_, old_bounds_, new_bounds_));
- }
-
- private:
- Window* window_;
- const gfx::Rect old_bounds_;
- const gfx::Rect new_bounds_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedSetBoundsNotifier);
-};
-
-// Some operations are only permitted in the client that created the window.
-bool OwnsWindow(WindowTreeClient* client, Window* window) {
- return !client || client->OwnsWindow(window);
-}
-
-bool IsClientRoot(Window* window) {
- return window->window_tree() &&
- window->window_tree()->GetRoots().count(window) > 0;
-}
-
-bool OwnsWindowOrIsRoot(Window* window) {
- return OwnsWindow(window->window_tree(), window) || IsClientRoot(window);
-}
-
-void EmptyEmbedCallback(bool result) {}
-
-} // namespace
-
-////////////////////////////////////////////////////////////////////////////////
-// Window, public:
-
-void Window::Destroy() {
- if (!OwnsWindowOrIsRoot(this))
- return;
-
- if (client_)
- client_->DestroyWindow(this);
- while (!children_.empty()) {
- Window* child = children_.front();
- if (!OwnsWindow(client_, child)) {
- WindowPrivate(child).ClearParent();
- children_.erase(children_.begin());
- } else {
- child->Destroy();
- DCHECK(std::find(children_.begin(), children_.end(), child) ==
- children_.end());
- }
- }
- LocalDestroy();
-}
-
-void Window::SetBounds(const gfx::Rect& bounds) {
- if (!OwnsWindowOrIsRoot(this))
- return;
- if (bounds_ == bounds)
- return;
- if (client_)
- client_->SetBounds(this, bounds_, bounds);
- LocalSetBounds(bounds_, bounds);
-}
-
-gfx::Rect Window::GetBoundsInRoot() const {
- gfx::Vector2d offset;
- for (const Window* w = parent(); w != nullptr; w = w->parent())
- offset += w->bounds().OffsetFromOrigin();
- return bounds() + offset;
-}
-
-void Window::SetClientArea(
- const gfx::Insets& client_area,
- const std::vector<gfx::Rect>& additional_client_areas) {
- if (!OwnsWindowOrIsRoot(this))
- return;
-
- if (client_)
- client_->SetClientArea(server_id_, client_area,
- additional_client_areas);
- LocalSetClientArea(client_area, additional_client_areas);
-}
-
-void Window::SetHitTestMask(const gfx::Rect& mask) {
- if (!OwnsWindowOrIsRoot(this))
- return;
-
- if (hit_test_mask_ && *hit_test_mask_ == mask)
- return;
-
- if (client_)
- client_->SetHitTestMask(server_id_, mask);
- hit_test_mask_.reset(new gfx::Rect(mask));
-}
-
-void Window::ClearHitTestMask() {
- if (!OwnsWindowOrIsRoot(this))
- return;
-
- if (!hit_test_mask_)
- return;
-
- if (client_)
- client_->ClearHitTestMask(server_id_);
- hit_test_mask_.reset();
-}
-
-void Window::SetVisible(bool value) {
- if (visible_ == value)
- return;
-
- if (client_)
- client_->SetVisible(this, value);
- LocalSetVisible(value);
-}
-
-void Window::SetOpacity(float opacity) {
- if (client_)
- client_->SetOpacity(this, opacity);
- LocalSetOpacity(opacity);
-}
-
-void Window::SetPredefinedCursor(mus::mojom::Cursor cursor_id) {
- if (cursor_id_ == cursor_id)
- return;
-
- if (client_)
- client_->SetPredefinedCursor(server_id_, cursor_id);
- LocalSetPredefinedCursor(cursor_id);
-}
-
-bool Window::IsDrawn() const {
- if (!visible_)
- return false;
- return parent_ ? parent_->IsDrawn() : parent_drawn_;
-}
-
-std::unique_ptr<WindowSurface> Window::RequestSurface(mojom::SurfaceType type) {
- std::unique_ptr<WindowSurfaceBinding> surface_binding;
- std::unique_ptr<WindowSurface> surface =
- WindowSurface::Create(&surface_binding);
- AttachSurface(type, std::move(surface_binding));
- return surface;
-}
-
-void Window::AttachSurface(
- mojom::SurfaceType type,
- std::unique_ptr<WindowSurfaceBinding> surface_binding) {
- window_tree()->AttachSurface(
- server_id_, type, std::move(surface_binding->surface_request_),
- mojo::MakeProxy(std::move(surface_binding->surface_client_)));
-}
-
-void Window::ClearSharedProperty(const std::string& name) {
- SetSharedPropertyInternal(name, nullptr);
-}
-
-bool Window::HasSharedProperty(const std::string& name) const {
- return properties_.count(name) > 0;
-}
-
-void Window::AddObserver(WindowObserver* observer) {
- observers_.AddObserver(observer);
-}
-
-void Window::RemoveObserver(WindowObserver* observer) {
- observers_.RemoveObserver(observer);
-}
-
-const Window* Window::GetRoot() const {
- const Window* root = this;
- for (const Window* parent = this; parent; parent = parent->parent())
- root = parent;
- return root;
-}
-
-void Window::AddChild(Window* child) {
- // TODO(beng): not necessarily valid to all clients, but possibly to the
- // embeddee in an embedder-embeddee relationship.
- if (client_)
- CHECK_EQ(child->client_, client_);
- // Roots can not be added as children of other windows.
- if (window_tree() && window_tree()->IsRoot(child))
- return;
- LocalAddChild(child);
- if (client_)
- client_->AddChild(this, child->server_id());
-}
-
-void Window::RemoveChild(Window* child) {
- // TODO(beng): not necessarily valid to all clients, but possibly to the
- // embeddee in an embedder-embeddee relationship.
- if (client_)
- CHECK_EQ(child->client_, client_);
- LocalRemoveChild(child);
- if (client_)
- client_->RemoveChild(this, child->server_id());
-}
-
-void Window::Reorder(Window* relative, mojom::OrderDirection direction) {
- if (!LocalReorder(relative, direction))
- return;
- if (client_)
- client_->Reorder(this, relative->server_id(), direction);
-}
-
-void Window::MoveToFront() {
- if (!parent_ || parent_->children_.back() == this)
- return;
- Reorder(parent_->children_.back(), mojom::OrderDirection::ABOVE);
-}
-
-void Window::MoveToBack() {
- if (!parent_ || parent_->children_.front() == this)
- return;
- Reorder(parent_->children_.front(), mojom::OrderDirection::BELOW);
-}
-
-bool Window::Contains(const Window* child) const {
- if (!child)
- return false;
- if (child == this)
- return true;
- if (client_)
- CHECK_EQ(child->client_, client_);
- for (const Window* p = child->parent(); p; p = p->parent()) {
- if (p == this)
- return true;
- }
- return false;
-}
-
-void Window::AddTransientWindow(Window* transient_window) {
- // A system modal window cannot become a transient child.
- DCHECK(!transient_window->is_modal() || transient_window->transient_parent());
-
- if (client_)
- CHECK_EQ(transient_window->client_, client_);
- LocalAddTransientWindow(transient_window);
- if (client_)
- client_->AddTransientWindow(this, transient_window->server_id());
-}
-
-void Window::RemoveTransientWindow(Window* transient_window) {
- if (client_)
- CHECK_EQ(transient_window->window_tree(), client_);
- LocalRemoveTransientWindow(transient_window);
- if (client_)
- client_->RemoveTransientWindowFromParent(transient_window);
-}
-
-void Window::SetModal() {
- if (is_modal_)
- return;
-
- LocalSetModal();
- if (client_)
- client_->SetModal(this);
-}
-
-Window* Window::GetChildByLocalId(int id) {
- if (id == local_id_)
- return this;
- // TODO(beng): this could be improved depending on how we decide to own
- // windows.
- for (Window* child : children_) {
- Window* matching_child = child->GetChildByLocalId(id);
- if (matching_child)
- return matching_child;
- }
- return nullptr;
-}
-
-void Window::SetTextInputState(mojo::TextInputStatePtr state) {
- if (client_)
- client_->SetWindowTextInputState(server_id_, std::move(state));
-}
-
-void Window::SetImeVisibility(bool visible, mojo::TextInputStatePtr state) {
- // SetImeVisibility() shouldn't be used if the window is not editable.
- DCHECK(state.is_null() || state->type != mojo::TextInputType::NONE);
- if (client_)
- client_->SetImeVisibility(server_id_, visible, std::move(state));
-}
-
-bool Window::HasCapture() const {
- return client_ && client_->GetCaptureWindow() == this;
-}
-
-void Window::SetCapture() {
- if (client_)
- client_->SetCapture(this);
-}
-
-void Window::ReleaseCapture() {
- if (client_)
- client_->ReleaseCapture(this);
-}
-
-void Window::SetFocus() {
- if (client_ && IsDrawn())
- client_->SetFocus(this);
-}
-
-bool Window::HasFocus() const {
- return client_ && client_->GetFocusedWindow() == this;
-}
-
-void Window::SetCanFocus(bool can_focus) {
- if (client_)
- client_->SetCanFocus(server_id_, can_focus);
-}
-
-void Window::Embed(mus::mojom::WindowTreeClientPtr client, uint32_t flags) {
- Embed(std::move(client), base::Bind(&EmptyEmbedCallback), flags);
-}
-
-void Window::Embed(mus::mojom::WindowTreeClientPtr client,
- const EmbedCallback& callback,
- uint32_t flags) {
- if (PrepareForEmbed())
- client_->Embed(server_id_, std::move(client), flags, callback);
- else
- callback.Run(false);
-}
-
-void Window::RequestClose() {
- if (client_)
- client_->RequestClose(this);
-}
-
-std::string Window::GetName() const {
- if (HasSharedProperty(mojom::WindowManager::kName_Property))
- return GetSharedProperty<std::string>(mojom::WindowManager::kName_Property);
-
- return std::string();
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Window, protected:
-
-Window::Window() : Window(nullptr, static_cast<Id>(-1)) {}
-
-Window::~Window() {
- FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroying(this));
- if (client_)
- client_->OnWindowDestroying(this);
-
- if (HasFocus()) {
- // The focused window is being removed. When this happens the server
- // advances focus. We don't want to randomly pick a Window to get focus, so
- // we update local state only, and wait for the next focus change from the
- // server.
- client_->LocalSetFocus(nullptr);
- }
-
- // Remove from transient parent.
- if (transient_parent_)
- transient_parent_->LocalRemoveTransientWindow(this);
-
- // Remove transient children.
- while (!transient_children_.empty()) {
- Window* transient_child = transient_children_.front();
- LocalRemoveTransientWindow(transient_child);
- transient_child->LocalDestroy();
- DCHECK(transient_children_.empty() ||
- transient_children_.front() != transient_child);
- }
-
- if (parent_)
- parent_->LocalRemoveChild(this);
-
- // We may still have children. This can happen if the embedder destroys the
- // root while we're still alive.
- while (!children_.empty()) {
- Window* child = children_.front();
- LocalRemoveChild(child);
- DCHECK(children_.empty() || children_.front() != child);
- }
-
- // Clear properties.
- for (auto& pair : prop_map_) {
- if (pair.second.deallocator)
- (*pair.second.deallocator)(pair.second.value);
- }
- prop_map_.clear();
-
- FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroyed(this));
-
- // Invoke after observers so that can clean up any internal state observers
- // may have changed.
- if (window_tree())
- window_tree()->OnWindowDestroyed(this);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Window, private:
-
-Window::Window(WindowTreeClient* client, Id id)
- : client_(client),
- server_id_(id),
- parent_(nullptr),
- stacking_target_(nullptr),
- transient_parent_(nullptr),
- is_modal_(false),
- // Matches aura, see aura::Window for details.
- observers_(base::ObserverList<WindowObserver>::NOTIFY_EXISTING_ONLY),
- input_event_handler_(nullptr),
- visible_(false),
- opacity_(1.0f),
- display_id_(display::Display::kInvalidDisplayID),
- cursor_id_(mojom::Cursor::CURSOR_NULL),
- parent_drawn_(false) {}
-
-void Window::SetSharedPropertyInternal(const std::string& name,
- const std::vector<uint8_t>* value) {
- if (!OwnsWindowOrIsRoot(this))
- return;
-
- if (client_) {
- mojo::Array<uint8_t> transport_value(nullptr);
- if (value) {
- transport_value.resize(value->size());
- if (value->size())
- memcpy(&transport_value.front(), &(value->front()), value->size());
- }
- // TODO: add test coverage of this (450303).
- client_->SetProperty(this, name, std::move(transport_value));
- }
- LocalSetSharedProperty(name, value);
-}
-
-int64_t Window::SetLocalPropertyInternal(const void* key,
- const char* name,
- PropertyDeallocator deallocator,
- int64_t value,
- int64_t default_value) {
- int64_t old = GetLocalPropertyInternal(key, default_value);
- if (value == default_value) {
- prop_map_.erase(key);
- } else {
- Value prop_value;
- prop_value.name = name;
- prop_value.value = value;
- prop_value.deallocator = deallocator;
- prop_map_[key] = prop_value;
- }
- FOR_EACH_OBSERVER(WindowObserver, observers_,
- OnWindowLocalPropertyChanged(this, key, old));
- return old;
-}
-
-int64_t Window::GetLocalPropertyInternal(const void* key,
- int64_t default_value) const {
- std::map<const void*, Value>::const_iterator iter = prop_map_.find(key);
- if (iter == prop_map_.end())
- return default_value;
- return iter->second.value;
-}
-
-void Window::LocalDestroy() {
- delete this;
-}
-
-void Window::LocalAddChild(Window* child) {
- ScopedTreeNotifier notifier(child, child->parent(), this);
- if (child->parent())
- RemoveChildImpl(child, &child->parent_->children_);
- children_.push_back(child);
- child->parent_ = this;
- child->display_id_ = display_id_;
-}
-
-void Window::LocalRemoveChild(Window* child) {
- DCHECK_EQ(this, child->parent());
- ScopedTreeNotifier notifier(child, this, nullptr);
- RemoveChildImpl(child, &children_);
-}
-
-void Window::LocalAddTransientWindow(Window* transient_window) {
- if (transient_window->transient_parent())
- RemoveTransientWindowImpl(transient_window);
- transient_children_.push_back(transient_window);
- transient_window->transient_parent_ = this;
-
- // Restack |transient_window| properly above its transient parent, if they
- // share the same parent.
- if (transient_window->parent() == parent())
- RestackTransientDescendants(this, &GetStackingTarget,
- &ReorderWithoutNotification);
-
- // TODO(fsamuel): We might want a notification here.
-}
-
-void Window::LocalRemoveTransientWindow(Window* transient_window) {
- DCHECK_EQ(this, transient_window->transient_parent());
- RemoveTransientWindowImpl(transient_window);
- // TODO(fsamuel): We might want a notification here.
-}
-
-void Window::LocalSetModal() {
- is_modal_ = true;
-}
-
-bool Window::LocalReorder(Window* relative, mojom::OrderDirection direction) {
- OrderChangedNotifier notifier(this, relative, direction);
- return ReorderImpl(this, relative, direction, &notifier);
-}
-
-void Window::LocalSetBounds(const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {
- // If this client owns the window, then it should be the only one to change
- // the bounds.
- DCHECK(!OwnsWindow(client_, this) || old_bounds == bounds_);
- ScopedSetBoundsNotifier notifier(this, old_bounds, new_bounds);
- bounds_ = new_bounds;
-}
-
-void Window::LocalSetClientArea(
- const gfx::Insets& new_client_area,
- const std::vector<gfx::Rect>& additional_client_areas) {
- const std::vector<gfx::Rect> old_additional_client_areas =
- additional_client_areas_;
- const gfx::Insets old_client_area = client_area_;
- client_area_ = new_client_area;
- additional_client_areas_ = additional_client_areas;
- FOR_EACH_OBSERVER(WindowObserver, observers_,
- OnWindowClientAreaChanged(this, old_client_area,
- old_additional_client_areas));
-}
-
-void Window::LocalSetDisplay(int64_t display_id) {
- display_id_ = display_id;
- // TODO(sad): Notify observers (of this window, and of the descendant windows)
- // when a window moves from one display into another. https://crbug.com/614887
-}
-
-void Window::LocalSetParentDrawn(bool value) {
- if (parent_drawn_ == value)
- return;
-
- // As IsDrawn() is derived from |visible_| and |parent_drawn_|, only send
- // drawn notification is the value of IsDrawn() is really changing.
- if (IsDrawn() == value) {
- parent_drawn_ = value;
- return;
- }
- FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDrawnChanging(this));
- parent_drawn_ = value;
- FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDrawnChanged(this));
-}
-
-void Window::LocalSetVisible(bool visible) {
- if (visible_ == visible)
- return;
-
- FOR_EACH_OBSERVER(WindowObserver, observers_,
- OnWindowVisibilityChanging(this));
- visible_ = visible;
- NotifyWindowVisibilityChanged(this);
-}
-
-void Window::LocalSetOpacity(float opacity) {
- if (opacity_ == opacity)
- return;
-
- float old_opacity = opacity_;
- opacity_ = opacity;
- FOR_EACH_OBSERVER(WindowObserver, observers_,
- OnWindowOpacityChanged(this, old_opacity, opacity_));
-}
-
-void Window::LocalSetPredefinedCursor(mojom::Cursor cursor_id) {
- if (cursor_id_ == cursor_id)
- return;
-
- cursor_id_ = cursor_id;
- FOR_EACH_OBSERVER(WindowObserver, observers_,
- OnWindowPredefinedCursorChanged(this, cursor_id));
-}
-
-void Window::LocalSetSharedProperty(const std::string& name,
- const std::vector<uint8_t>* value) {
- std::vector<uint8_t> old_value;
- std::vector<uint8_t>* old_value_ptr = nullptr;
- auto it = properties_.find(name);
- if (it != properties_.end()) {
- old_value = it->second;
- old_value_ptr = &old_value;
-
- if (value && old_value == *value)
- return;
- } else if (!value) {
- // This property isn't set in |properties_| and |value| is nullptr, so
- // there's no change.
- return;
- }
-
- if (value) {
- properties_[name] = *value;
- } else if (it != properties_.end()) {
- properties_.erase(it);
- }
-
- FOR_EACH_OBSERVER(
- WindowObserver, observers_,
- OnWindowSharedPropertyChanged(this, name, old_value_ptr, value));
-}
-
-void Window::NotifyWindowStackingChanged() {
- if (stacking_target_) {
- Children::const_iterator window_i = std::find(
- parent()->children().begin(), parent()->children().end(), this);
- DCHECK(window_i != parent()->children().end());
- if (window_i != parent()->children().begin() &&
- (*(window_i - 1) == stacking_target_))
- return;
- }
- RestackTransientDescendants(this, &GetStackingTarget,
- &ReorderWithoutNotification);
-}
-
-void Window::NotifyWindowVisibilityChanged(Window* target) {
- if (!NotifyWindowVisibilityChangedDown(target)) {
- return; // |this| has been deleted.
- }
- NotifyWindowVisibilityChangedUp(target);
-}
-
-bool Window::NotifyWindowVisibilityChangedAtReceiver(Window* target) {
- // |this| may be deleted during a call to OnWindowVisibilityChanged() on one
- // of the observers. We create an local observer for that. In that case we
- // exit without further access to any members.
- WindowTracker tracker;
- tracker.Add(this);
- FOR_EACH_OBSERVER(WindowObserver, observers_,
- OnWindowVisibilityChanged(target));
- return tracker.Contains(this);
-}
-
-bool Window::NotifyWindowVisibilityChangedDown(Window* target) {
- if (!NotifyWindowVisibilityChangedAtReceiver(target))
- return false; // |this| was deleted.
- std::set<const Window*> child_already_processed;
- bool child_destroyed = false;
- do {
- child_destroyed = false;
- for (Window::Children::const_iterator it = children_.begin();
- it != children_.end(); ++it) {
- if (!child_already_processed.insert(*it).second)
- continue;
- if (!(*it)->NotifyWindowVisibilityChangedDown(target)) {
- // |*it| was deleted, |it| is invalid and |children_| has changed. We
- // exit the current for-loop and enter a new one.
- child_destroyed = true;
- break;
- }
- }
- } while (child_destroyed);
- return true;
-}
-
-void Window::NotifyWindowVisibilityChangedUp(Window* target) {
- // Start with the parent as we already notified |this|
- // in NotifyWindowVisibilityChangedDown.
- for (Window* window = parent(); window; window = window->parent()) {
- bool ret = window->NotifyWindowVisibilityChangedAtReceiver(target);
- DCHECK(ret);
- }
-}
-
-bool Window::PrepareForEmbed() {
- if (!OwnsWindow(client_, this))
- return false;
-
- while (!children_.empty())
- RemoveChild(children_[0]);
- return true;
-}
-
-void Window::RemoveTransientWindowImpl(Window* transient_window) {
- Window::Children::iterator it = std::find(
- transient_children_.begin(), transient_children_.end(), transient_window);
- if (it != transient_children_.end()) {
- transient_children_.erase(it);
- transient_window->transient_parent_ = nullptr;
- }
- // If |transient_window| and its former transient parent share the same
- // parent, |transient_window| should be restacked properly so it is not among
- // transient children of its former parent, anymore.
- if (parent() == transient_window->parent())
- RestackTransientDescendants(this, &GetStackingTarget,
- &ReorderWithoutNotification);
-
- // TOOD(fsamuel): We might want to notify observers here.
-}
-
-// static
-void Window::ReorderWithoutNotification(Window* window,
- Window* relative,
- mojom::OrderDirection direction) {
- ReorderImpl(window, relative, direction, nullptr);
-}
-
-// static
-// Returns true if the order actually changed.
-bool Window::ReorderImpl(Window* window,
- Window* relative,
- mojom::OrderDirection direction,
- OrderChangedNotifier* notifier) {
- DCHECK(relative);
- DCHECK_NE(window, relative);
- DCHECK_EQ(window->parent(), relative->parent());
- DCHECK(window->parent());
-
- if (!AdjustStackingForTransientWindows(&window, &relative, &direction,
- window->stacking_target_))
- return false;
-
- const size_t child_i = std::find(window->parent_->children_.begin(),
- window->parent_->children_.end(), window) -
- window->parent_->children_.begin();
- const size_t target_i =
- std::find(window->parent_->children_.begin(),
- window->parent_->children_.end(), relative) -
- window->parent_->children_.begin();
- if ((direction == mojom::OrderDirection::ABOVE && child_i == target_i + 1) ||
- (direction == mojom::OrderDirection::BELOW && child_i + 1 == target_i)) {
- return false;
- }
-
- if (notifier)
- notifier->NotifyWindowReordering();
-
- const size_t dest_i = direction == mojom::OrderDirection::ABOVE
- ? (child_i < target_i ? target_i : target_i + 1)
- : (child_i < target_i ? target_i - 1 : target_i);
- window->parent_->children_.erase(window->parent_->children_.begin() +
- child_i);
- window->parent_->children_.insert(window->parent_->children_.begin() + dest_i,
- window);
-
- window->NotifyWindowStackingChanged();
-
- if (notifier)
- notifier->NotifyWindowReordered();
-
- return true;
-}
-
-// static
-Window** Window::GetStackingTarget(Window* window) {
- return &window->stacking_target_;
-}
-} // namespace mus
diff --git a/chromium/components/mus/public/cpp/lib/window_observer.cc b/chromium/components/mus/public/cpp/lib/window_observer.cc
deleted file mode 100644
index 26e65078f77..00000000000
--- a/chromium/components/mus/public/cpp/lib/window_observer.cc
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/window_observer.h"
-
-namespace mus {
-
-////////////////////////////////////////////////////////////////////////////////
-// WindowObserver, public:
-
-WindowObserver::TreeChangeParams::TreeChangeParams()
- : target(nullptr),
- old_parent(nullptr),
- new_parent(nullptr),
- receiver(nullptr) {}
-
-} // namespace mus
diff --git a/chromium/components/mus/public/cpp/lib/window_private.cc b/chromium/components/mus/public/cpp/lib/window_private.cc
deleted file mode 100644
index 11c7ebeefae..00000000000
--- a/chromium/components/mus/public/cpp/lib/window_private.cc
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/lib/window_private.h"
-
-namespace mus {
-
-WindowPrivate::WindowPrivate(Window* window) : window_(window) {
- CHECK(window);
-}
-
-WindowPrivate::~WindowPrivate() {}
-
-// static
-Window* WindowPrivate::LocalCreate() {
- return new Window;
-}
-
-void WindowPrivate::LocalSetSharedProperty(const std::string& name,
- mojo::Array<uint8_t> new_data) {
- std::vector<uint8_t> data;
- std::vector<uint8_t>* data_ptr = nullptr;
- if (!new_data.is_null()) {
- data = new_data.To<std::vector<uint8_t>>();
- data_ptr = &data;
- }
- LocalSetSharedProperty(name, data_ptr);
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/public/cpp/lib/window_private.h b/chromium/components/mus/public/cpp/lib/window_private.h
deleted file mode 100644
index 4b2640e8b37..00000000000
--- a/chromium/components/mus/public/cpp/lib/window_private.h
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_PRIVATE_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_PRIVATE_H_
-
-#include <stdint.h>
-
-#include <vector>
-
-#include "base/macros.h"
-#include "components/mus/public/cpp/window.h"
-#include "mojo/public/cpp/bindings/array.h"
-
-namespace mus {
-
-// This class is a friend of a Window and contains functions to mutate internal
-// state of Window.
-class WindowPrivate {
- public:
- explicit WindowPrivate(Window* window);
- ~WindowPrivate();
-
- // Creates and returns a new Window. Caller owns the return value.
- static Window* LocalCreate();
-
- base::ObserverList<WindowObserver>* observers() {
- return &window_->observers_;
- }
-
- void ClearParent() { window_->parent_ = nullptr; }
-
- void ClearTransientParent() { window_->transient_parent_ = nullptr; }
-
- void set_visible(bool visible) { window_->visible_ = visible; }
-
- void set_parent_drawn(bool drawn) { window_->parent_drawn_ = drawn; }
- bool parent_drawn() { return window_->parent_drawn_; }
-
- void set_server_id(Id id) { window_->server_id_ = id; }
- Id server_id() { return window_->server_id_; }
-
- void set_client(WindowTreeClient* client) {
- window_->client_ = client;
- }
-
- void set_properties(const std::map<std::string, std::vector<uint8_t>>& data) {
- window_->properties_ = data;
- }
-
- void LocalSetDisplay(int64_t new_display) {
- window_->LocalSetDisplay(new_display);
- }
-
- void LocalDestroy() { window_->LocalDestroy(); }
- void LocalAddChild(Window* child) { window_->LocalAddChild(child); }
- void LocalRemoveChild(Window* child) { window_->LocalRemoveChild(child); }
- void LocalAddTransientWindow(Window* child) {
- window_->LocalAddTransientWindow(child);
- }
- void LocalRemoveTransientWindow(Window* child) {
- window_->LocalRemoveTransientWindow(child);
- }
- void LocalUnsetModal() { window_->is_modal_ = false; }
- void LocalReorder(Window* relative, mojom::OrderDirection direction) {
- window_->LocalReorder(relative, direction);
- }
- void LocalSetBounds(const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {
- window_->LocalSetBounds(old_bounds, new_bounds);
- }
- void LocalSetClientArea(
- const gfx::Insets& client_area,
- const std::vector<gfx::Rect>& additional_client_areas) {
- window_->LocalSetClientArea(client_area, additional_client_areas);
- }
- void LocalSetParentDrawn(bool drawn) { window_->LocalSetParentDrawn(drawn); }
- void LocalSetVisible(bool visible) { window_->LocalSetVisible(visible); }
- void LocalSetOpacity(float opacity) { window_->LocalSetOpacity(opacity); }
- void LocalSetPredefinedCursor(mojom::Cursor cursor) {
- window_->LocalSetPredefinedCursor(cursor);
- }
- void LocalSetSharedProperty(const std::string& name,
- mojo::Array<uint8_t> new_data);
- void LocalSetSharedProperty(const std::string& name,
- const std::vector<uint8_t>* data) {
- window_->LocalSetSharedProperty(name, data);
- }
- void NotifyWindowStackingChanged() { window_->NotifyWindowStackingChanged(); }
-
- private:
- Window* window_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowPrivate);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_PRIVATE_H_
diff --git a/chromium/components/mus/public/cpp/lib/window_surface.cc b/chromium/components/mus/public/cpp/lib/window_surface.cc
deleted file mode 100644
index 1f0b840a102..00000000000
--- a/chromium/components/mus/public/cpp/lib/window_surface.cc
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/window_surface.h"
-
-#include "base/memory/ptr_util.h"
-#include "components/mus/public/cpp/window_surface_client.h"
-
-namespace mus {
-
-// static
-std::unique_ptr<WindowSurface> WindowSurface::Create(
- std::unique_ptr<WindowSurfaceBinding>* surface_binding) {
- mojom::SurfacePtr surface;
- mojom::SurfaceClientPtr surface_client;
- mojo::InterfaceRequest<mojom::SurfaceClient> surface_client_request =
- GetProxy(&surface_client);
-
- surface_binding->reset(new WindowSurfaceBinding(
- GetProxy(&surface), surface_client.PassInterface()));
- return base::WrapUnique(new WindowSurface(surface.PassInterface(),
- std::move(surface_client_request)));
-}
-
-WindowSurface::~WindowSurface() {}
-
-void WindowSurface::BindToThread() {
- DCHECK(!thread_checker_);
- thread_checker_.reset(new base::ThreadChecker());
- surface_.Bind(std::move(surface_info_));
- client_binding_.reset(new mojo::Binding<mojom::SurfaceClient>(
- this, std::move(client_request_)));
-}
-
-void WindowSurface::SubmitCompositorFrame(cc::CompositorFrame frame,
- const base::Closure& callback) {
- DCHECK(thread_checker_);
- DCHECK(thread_checker_->CalledOnValidThread());
- if (!surface_)
- return;
- surface_->SubmitCompositorFrame(std::move(frame), callback);
-}
-
-WindowSurface::WindowSurface(
- mojo::InterfacePtrInfo<mojom::Surface> surface_info,
- mojo::InterfaceRequest<mojom::SurfaceClient> client_request)
- : client_(nullptr),
- surface_info_(std::move(surface_info)),
- client_request_(std::move(client_request)) {}
-
-void WindowSurface::ReturnResources(
- mojo::Array<cc::ReturnedResource> resources) {
- DCHECK(thread_checker_);
- DCHECK(thread_checker_->CalledOnValidThread());
- if (!client_)
- return;
- client_->OnResourcesReturned(this, std::move(resources));
-}
-
-WindowSurfaceBinding::~WindowSurfaceBinding() {}
-
-WindowSurfaceBinding::WindowSurfaceBinding(
- mojo::InterfaceRequest<mojom::Surface> surface_request,
- mojo::InterfacePtrInfo<mojom::SurfaceClient> surface_client)
- : surface_request_(std::move(surface_request)),
- surface_client_(std::move(surface_client)) {}
-
-} // namespace mus
diff --git a/chromium/components/mus/public/cpp/lib/window_tree_client.cc b/chromium/components/mus/public/cpp/lib/window_tree_client.cc
deleted file mode 100644
index 7a43101ff6a..00000000000
--- a/chromium/components/mus/public/cpp/lib/window_tree_client.cc
+++ /dev/null
@@ -1,1181 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/window_tree_client.h"
-
-#include <stddef.h>
-
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "base/bind.h"
-#include "base/memory/ptr_util.h"
-#include "components/mus/common/util.h"
-#include "components/mus/public/cpp/input_event_handler.h"
-#include "components/mus/public/cpp/lib/in_flight_change.h"
-#include "components/mus/public/cpp/lib/window_private.h"
-#include "components/mus/public/cpp/window_manager_delegate.h"
-#include "components/mus/public/cpp/window_observer.h"
-#include "components/mus/public/cpp/window_tracker.h"
-#include "components/mus/public/cpp/window_tree_client_delegate.h"
-#include "components/mus/public/cpp/window_tree_client_observer.h"
-#include "components/mus/public/interfaces/window_manager_window_tree_factory.mojom.h"
-#include "services/shell/public/cpp/connector.h"
-#include "ui/display/mojo/display_type_converters.h"
-#include "ui/events/event.h"
-#include "ui/gfx/geometry/insets.h"
-#include "ui/gfx/geometry/size.h"
-
-namespace mus {
-
-void DeleteWindowTreeClient(WindowTreeClient* client) { delete client; }
-
-Id MakeTransportId(ClientSpecificId client_id, ClientSpecificId local_id) {
- return (client_id << 16) | local_id;
-}
-
-Id server_id(Window* window) {
- return WindowPrivate(window).server_id();
-}
-
-// Helper called to construct a local window object from transport data.
-Window* AddWindowToClient(WindowTreeClient* client,
- Window* parent,
- const mojom::WindowDataPtr& window_data) {
- // We don't use the ctor that takes a WindowTreeClient here, since it will
- // call back to the service and attempt to create a new window.
- Window* window = WindowPrivate::LocalCreate();
- WindowPrivate private_window(window);
- private_window.set_client(client);
- private_window.set_server_id(window_data->window_id);
- private_window.set_visible(window_data->visible);
- private_window.set_properties(
- window_data->properties
- .To<std::map<std::string, std::vector<uint8_t>>>());
- client->AddWindow(window);
- private_window.LocalSetBounds(gfx::Rect(), window_data->bounds);
- if (parent)
- WindowPrivate(parent).LocalAddChild(window);
- return window;
-}
-
-Window* BuildWindowTree(WindowTreeClient* client,
- const mojo::Array<mojom::WindowDataPtr>& windows,
- Window* initial_parent) {
- std::vector<Window*> parents;
- Window* root = NULL;
- Window* last_window = NULL;
- if (initial_parent)
- parents.push_back(initial_parent);
- for (size_t i = 0; i < windows.size(); ++i) {
- if (last_window && windows[i]->parent_id == server_id(last_window)) {
- parents.push_back(last_window);
- } else if (!parents.empty()) {
- while (server_id(parents.back()) != windows[i]->parent_id)
- parents.pop_back();
- }
- Window* window = AddWindowToClient(
- client, !parents.empty() ? parents.back() : NULL, windows[i]);
- if (!last_window)
- root = window;
- last_window = window;
- }
- return root;
-}
-
-WindowTreeClient::WindowTreeClient(
- WindowTreeClientDelegate* delegate,
- WindowManagerDelegate* window_manager_delegate,
- mojo::InterfaceRequest<mojom::WindowTreeClient> request)
- : client_id_(0),
- next_window_id_(1),
- next_change_id_(1),
- delegate_(delegate),
- window_manager_delegate_(window_manager_delegate),
- capture_window_(nullptr),
- focused_window_(nullptr),
- binding_(this),
- tree_(nullptr),
- delete_on_no_roots_(!window_manager_delegate),
- in_destructor_(false),
- weak_factory_(this) {
- // Allow for a null request in tests.
- if (request.is_pending())
- binding_.Bind(std::move(request));
- if (window_manager_delegate)
- window_manager_delegate->SetWindowManagerClient(this);
-}
-
-WindowTreeClient::~WindowTreeClient() {
- in_destructor_ = true;
-
- std::vector<Window*> non_owned;
- WindowTracker tracker;
- while (!windows_.empty()) {
- IdToWindowMap::iterator it = windows_.begin();
- if (OwnsWindow(it->second)) {
- it->second->Destroy();
- } else {
- tracker.Add(it->second);
- windows_.erase(it);
- }
- }
-
- // Delete the non-owned windows last. In the typical case these are roots. The
- // exception is the window manager and embed roots, which may know about
- // other random windows that it doesn't own.
- // NOTE: we manually delete as we're a friend.
- while (!tracker.windows().empty())
- delete tracker.windows().front();
-
- FOR_EACH_OBSERVER(WindowTreeClientObserver, observers_,
- OnWillDestroyClient(this));
-
- delegate_->OnWindowTreeClientDestroyed(this);
-}
-
-void WindowTreeClient::ConnectViaWindowTreeFactory(
- shell::Connector* connector) {
- // Clients created with no root shouldn't delete automatically.
- delete_on_no_roots_ = false;
-
- // The client id doesn't really matter, we use 101 purely for debugging.
- client_id_ = 101;
-
- mojom::WindowTreeFactoryPtr factory;
- connector->ConnectToInterface("mojo:mus", &factory);
- mojom::WindowTreePtr window_tree;
- factory->CreateWindowTree(GetProxy(&window_tree),
- binding_.CreateInterfacePtrAndBind());
- SetWindowTree(std::move(window_tree));
-}
-
-void WindowTreeClient::ConnectAsWindowManager(shell::Connector* connector) {
- DCHECK(window_manager_delegate_);
-
- mojom::WindowManagerWindowTreeFactoryPtr factory;
- connector->ConnectToInterface("mojo:mus", &factory);
- mojom::WindowTreePtr window_tree;
- factory->CreateWindowTree(GetProxy(&window_tree),
- binding_.CreateInterfacePtrAndBind());
- SetWindowTree(std::move(window_tree));
-}
-
-void WindowTreeClient::WaitForEmbed() {
- DCHECK(roots_.empty());
- // OnEmbed() is the first function called.
- binding_.WaitForIncomingMethodCall();
- // TODO(sky): deal with pipe being closed before we get OnEmbed().
-}
-
-void WindowTreeClient::DestroyWindow(Window* window) {
- DCHECK(tree_);
- const uint32_t change_id = ScheduleInFlightChange(base::WrapUnique(
- new CrashInFlightChange(window, ChangeType::DELETE_WINDOW)));
- tree_->DeleteWindow(change_id, server_id(window));
-}
-
-void WindowTreeClient::AddChild(Window* parent, Id child_id) {
- DCHECK(tree_);
- const uint32_t change_id = ScheduleInFlightChange(
- base::WrapUnique(new CrashInFlightChange(parent, ChangeType::ADD_CHILD)));
- tree_->AddWindow(change_id, parent->server_id(), child_id);
-}
-
-void WindowTreeClient::RemoveChild(Window* parent, Id child_id) {
- DCHECK(tree_);
- const uint32_t change_id = ScheduleInFlightChange(base::WrapUnique(
- new CrashInFlightChange(parent, ChangeType::REMOVE_CHILD)));
- tree_->RemoveWindowFromParent(change_id, child_id);
-}
-
-void WindowTreeClient::AddTransientWindow(Window* window,
- Id transient_window_id) {
- DCHECK(tree_);
- const uint32_t change_id = ScheduleInFlightChange(base::WrapUnique(
- new CrashInFlightChange(window, ChangeType::ADD_TRANSIENT_WINDOW)));
- tree_->AddTransientWindow(change_id, server_id(window), transient_window_id);
-}
-
-void WindowTreeClient::RemoveTransientWindowFromParent(Window* window) {
- DCHECK(tree_);
- const uint32_t change_id =
- ScheduleInFlightChange(base::WrapUnique(new CrashInFlightChange(
- window, ChangeType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT)));
- tree_->RemoveTransientWindowFromParent(change_id, server_id(window));
-}
-
-void WindowTreeClient::SetModal(Window* window) {
- DCHECK(tree_);
- const uint32_t change_id = ScheduleInFlightChange(
- base::WrapUnique(new InFlightSetModalChange(window)));
- tree_->SetModal(change_id, server_id(window));
-}
-
-void WindowTreeClient::Reorder(Window* window,
- Id relative_window_id,
- mojom::OrderDirection direction) {
- DCHECK(tree_);
- const uint32_t change_id = ScheduleInFlightChange(
- base::WrapUnique(new CrashInFlightChange(window, ChangeType::REORDER)));
- tree_->ReorderWindow(change_id, server_id(window), relative_window_id,
- direction);
-}
-
-bool WindowTreeClient::OwnsWindow(Window* window) const {
- // Windows created via CreateTopLevelWindow() are not owned by us, but have
- // our client id.
- return HiWord(server_id(window)) == client_id_ &&
- roots_.count(window) == 0;
-}
-
-void WindowTreeClient::SetBounds(Window* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& bounds) {
- DCHECK(tree_);
- const uint32_t change_id = ScheduleInFlightChange(
- base::WrapUnique(new InFlightBoundsChange(window, old_bounds)));
- tree_->SetWindowBounds(change_id, server_id(window), bounds);
-}
-
-void WindowTreeClient::SetCapture(Window* window) {
- // In order for us to get here we had to have exposed a window, which implies
- // we got a client.
- DCHECK(tree_);
- if (capture_window_ == window)
- return;
- const uint32_t change_id = ScheduleInFlightChange(
- base::WrapUnique(new InFlightCaptureChange(this, capture_window_)));
- tree_->SetCapture(change_id, server_id(window));
- LocalSetCapture(window);
-}
-
-void WindowTreeClient::ReleaseCapture(Window* window) {
- // In order for us to get here we had to have exposed a window, which implies
- // we got a client.
- DCHECK(tree_);
- if (capture_window_ != window)
- return;
- const uint32_t change_id = ScheduleInFlightChange(
- base::WrapUnique(new InFlightCaptureChange(this, window)));
- tree_->ReleaseCapture(change_id, server_id(window));
- LocalSetCapture(nullptr);
-}
-
-void WindowTreeClient::SetClientArea(
- Id window_id,
- const gfx::Insets& client_area,
- const std::vector<gfx::Rect>& additional_client_areas) {
- DCHECK(tree_);
- tree_->SetClientArea(window_id, client_area, additional_client_areas);
-}
-
-void WindowTreeClient::SetHitTestMask(Id window_id, const gfx::Rect& mask) {
- DCHECK(tree_);
- tree_->SetHitTestMask(window_id, mask);
-}
-
-void WindowTreeClient::ClearHitTestMask(Id window_id) {
- DCHECK(tree_);
- tree_->SetHitTestMask(window_id, {});
-}
-
-void WindowTreeClient::SetFocus(Window* window) {
- // In order for us to get here we had to have exposed a window, which implies
- // we got a client.
- DCHECK(tree_);
- const uint32_t change_id = ScheduleInFlightChange(
- base::WrapUnique(new InFlightFocusChange(this, focused_window_)));
- tree_->SetFocus(change_id, window ? server_id(window) : 0);
- LocalSetFocus(window);
-}
-
-void WindowTreeClient::SetCanFocus(Id window_id, bool can_focus) {
- DCHECK(tree_);
- tree_->SetCanFocus(window_id, can_focus);
-}
-
-void WindowTreeClient::SetPredefinedCursor(Id window_id,
- mus::mojom::Cursor cursor_id) {
- DCHECK(tree_);
-
- Window* window = GetWindowByServerId(window_id);
- if (!window)
- return;
-
- // We make an inflight change thing here.
- const uint32_t change_id = ScheduleInFlightChange(base::WrapUnique(
- new InFlightPredefinedCursorChange(window, window->predefined_cursor())));
- tree_->SetPredefinedCursor(change_id, window_id, cursor_id);
-}
-
-void WindowTreeClient::SetVisible(Window* window, bool visible) {
- DCHECK(tree_);
- const uint32_t change_id = ScheduleInFlightChange(
- base::WrapUnique(new InFlightVisibleChange(window, !visible)));
- tree_->SetWindowVisibility(change_id, server_id(window), visible);
-}
-
-void WindowTreeClient::SetOpacity(Window* window, float opacity) {
- DCHECK(tree_);
- const uint32_t change_id = ScheduleInFlightChange(
- base::WrapUnique(new InFlightOpacityChange(window, window->opacity())));
- tree_->SetWindowOpacity(change_id, server_id(window), opacity);
-}
-
-void WindowTreeClient::SetProperty(Window* window,
- const std::string& name,
- mojo::Array<uint8_t> data) {
- DCHECK(tree_);
-
- mojo::Array<uint8_t> old_value(nullptr);
- if (window->HasSharedProperty(name))
- old_value = mojo::Array<uint8_t>::From(window->properties_[name]);
-
- const uint32_t change_id = ScheduleInFlightChange(
- base::WrapUnique(new InFlightPropertyChange(window, name, old_value)));
- tree_->SetWindowProperty(change_id, server_id(window), mojo::String(name),
- std::move(data));
-}
-
-void WindowTreeClient::SetWindowTextInputState(
- Id window_id,
- mojo::TextInputStatePtr state) {
- DCHECK(tree_);
- tree_->SetWindowTextInputState(window_id, std::move(state));
-}
-
-void WindowTreeClient::SetImeVisibility(Id window_id,
- bool visible,
- mojo::TextInputStatePtr state) {
- DCHECK(tree_);
- tree_->SetImeVisibility(window_id, visible, std::move(state));
-}
-
-void WindowTreeClient::Embed(Id window_id,
- mojom::WindowTreeClientPtr client,
- uint32_t flags,
- const mojom::WindowTree::EmbedCallback& callback) {
- DCHECK(tree_);
- tree_->Embed(window_id, std::move(client), flags, callback);
-}
-
-void WindowTreeClient::RequestClose(Window* window) {
- if (window_manager_internal_client_)
- window_manager_internal_client_->WmRequestClose(server_id(window));
-}
-
-void WindowTreeClient::AttachSurface(
- Id window_id,
- mojom::SurfaceType type,
- mojo::InterfaceRequest<mojom::Surface> surface,
- mojom::SurfaceClientPtr client) {
- DCHECK(tree_);
- tree_->AttachSurface(window_id, type, std::move(surface), std::move(client));
-}
-
-void WindowTreeClient::LocalSetCapture(Window* window) {
- if (capture_window_ == window)
- return;
- Window* lost_capture = capture_window_;
- capture_window_ = window;
- if (lost_capture) {
- FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(lost_capture).observers(),
- OnWindowLostCapture(lost_capture));
- }
-}
-
-void WindowTreeClient::LocalSetFocus(Window* focused) {
- Window* blurred = focused_window_;
- // Update |focused_window_| before calling any of the observers, so that the
- // observers get the correct result from calling |Window::HasFocus()|,
- // |WindowTreeClient::GetFocusedWindow()| etc.
- focused_window_ = focused;
- if (blurred) {
- FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(blurred).observers(),
- OnWindowFocusChanged(focused, blurred));
- }
- if (focused) {
- FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(focused).observers(),
- OnWindowFocusChanged(focused, blurred));
- }
- FOR_EACH_OBSERVER(WindowTreeClientObserver, observers_,
- OnWindowTreeFocusChanged(focused, blurred));
-}
-
-void WindowTreeClient::AddWindow(Window* window) {
- DCHECK(windows_.find(server_id(window)) == windows_.end());
- windows_[server_id(window)] = window;
-}
-
-void WindowTreeClient::OnWindowDestroying(Window* window) {
- if (window == capture_window_) {
- // Normally the queue updates itself upon window destruction. However since
- // |window| is being destroyed, it will not be possible to notify its
- // observers of the lost capture. Update local state now.
- LocalSetCapture(nullptr);
- }
- // For |focused_window_| window destruction clears the entire focus state.
-}
-
-void WindowTreeClient::OnWindowDestroyed(Window* window) {
- windows_.erase(server_id(window));
-
- for (auto& entry : embedded_windows_) {
- auto it = entry.second.find(window);
- if (it != entry.second.end()) {
- entry.second.erase(it);
- break;
- }
- }
-
- // Remove any InFlightChanges associated with the window.
- std::set<uint32_t> in_flight_change_ids_to_remove;
- for (const auto& pair : in_flight_map_) {
- if (pair.second->window() == window)
- in_flight_change_ids_to_remove.insert(pair.first);
- }
- for (auto change_id : in_flight_change_ids_to_remove)
- in_flight_map_.erase(change_id);
-
- if (roots_.erase(window) > 0 && roots_.empty() && delete_on_no_roots_ &&
- !in_destructor_) {
- delete this;
- }
-}
-
-Window* WindowTreeClient::GetWindowByServerId(Id id) {
- IdToWindowMap::const_iterator it = windows_.find(id);
- return it != windows_.end() ? it->second : NULL;
-}
-
-InFlightChange* WindowTreeClient::GetOldestInFlightChangeMatching(
- const InFlightChange& change) {
- for (const auto& pair : in_flight_map_) {
- if (pair.second->window() == change.window() &&
- pair.second->change_type() == change.change_type() &&
- pair.second->Matches(change)) {
- return pair.second.get();
- }
- }
- return nullptr;
-}
-
-uint32_t WindowTreeClient::ScheduleInFlightChange(
- std::unique_ptr<InFlightChange> change) {
- DCHECK(!change->window() ||
- windows_.count(change->window()->server_id()) > 0);
- const uint32_t change_id = next_change_id_++;
- in_flight_map_[change_id] = std::move(change);
- return change_id;
-}
-
-bool WindowTreeClient::ApplyServerChangeToExistingInFlightChange(
- const InFlightChange& change) {
- InFlightChange* existing_change = GetOldestInFlightChangeMatching(change);
- if (!existing_change)
- return false;
-
- existing_change->SetRevertValueFrom(change);
- return true;
-}
-
-Window* WindowTreeClient::NewWindowImpl(
- NewWindowType type,
- const Window::SharedProperties* properties) {
- DCHECK(tree_);
- Window* window =
- new Window(this, MakeTransportId(client_id_, next_window_id_++));
- if (properties)
- window->properties_ = *properties;
- AddWindow(window);
-
- const uint32_t change_id = ScheduleInFlightChange(base::WrapUnique(
- new CrashInFlightChange(window, type == NewWindowType::CHILD
- ? ChangeType::NEW_WINDOW
- : ChangeType::NEW_TOP_LEVEL_WINDOW)));
- mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties;
- if (properties) {
- transport_properties =
- mojo::Map<mojo::String, mojo::Array<uint8_t>>::From(*properties);
- }
- if (type == NewWindowType::CHILD) {
- tree_->NewWindow(change_id, server_id(window),
- std::move(transport_properties));
- } else {
- roots_.insert(window);
- tree_->NewTopLevelWindow(change_id, server_id(window),
- std::move(transport_properties));
- }
- return window;
-}
-
-void WindowTreeClient::SetWindowTree(mojom::WindowTreePtr window_tree_ptr) {
- tree_ptr_ = std::move(window_tree_ptr);
- tree_ = tree_ptr_.get();
-
- tree_ptr_->GetCursorLocationMemory(
- base::Bind(&WindowTreeClient::OnReceivedCursorLocationMemory,
- weak_factory_.GetWeakPtr()));
-
- tree_ptr_.set_connection_error_handler(base::Bind(
- &WindowTreeClient::OnConnectionLost, weak_factory_.GetWeakPtr()));
-
- if (window_manager_delegate_) {
- tree_ptr_->GetWindowManagerClient(GetProxy(&window_manager_internal_client_,
- tree_ptr_.associated_group()));
- }
-}
-
-void WindowTreeClient::OnConnectionLost() {
- delete this;
-}
-
-void WindowTreeClient::OnEmbedImpl(mojom::WindowTree* window_tree,
- ClientSpecificId client_id,
- mojom::WindowDataPtr root_data,
- int64_t display_id,
- Id focused_window_id,
- bool drawn) {
- // WARNING: this is only called if WindowTreeClient was created as the
- // result of an embedding.
- tree_ = window_tree;
- client_id_ = client_id;
-
- DCHECK(roots_.empty());
- Window* root = AddWindowToClient(this, nullptr, root_data);
- WindowPrivate(root).LocalSetDisplay(display_id);
- roots_.insert(root);
-
- focused_window_ = GetWindowByServerId(focused_window_id);
-
- WindowPrivate(root).LocalSetParentDrawn(drawn);
-
- delegate_->OnEmbed(root);
-
- if (focused_window_) {
- FOR_EACH_OBSERVER(WindowTreeClientObserver, observers_,
- OnWindowTreeFocusChanged(focused_window_, nullptr));
- }
-}
-
-void WindowTreeClient::WmNewDisplayAddedImpl(const display::Display& display,
- mojom::WindowDataPtr root_data,
- bool parent_drawn) {
- DCHECK(window_manager_delegate_);
-
- Window* root = AddWindowToClient(this, nullptr, root_data);
- WindowPrivate(root).LocalSetDisplay(display.id());
- WindowPrivate(root).LocalSetParentDrawn(parent_drawn);
- roots_.insert(root);
-
- window_manager_delegate_->OnWmNewDisplay(root, display);
-}
-
-void WindowTreeClient::OnReceivedCursorLocationMemory(
- mojo::ScopedSharedBufferHandle handle) {
- cursor_location_mapping_ = handle->Map(sizeof(base::subtle::Atomic32));
- DCHECK(cursor_location_mapping_);
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// WindowTreeClient, WindowTreeClient implementation:
-
-void WindowTreeClient::SetDeleteOnNoRoots(bool value) {
- delete_on_no_roots_ = value;
-}
-
-const std::set<Window*>& WindowTreeClient::GetRoots() {
- return roots_;
-}
-
-Window* WindowTreeClient::GetFocusedWindow() {
- return focused_window_;
-}
-
-void WindowTreeClient::ClearFocus() {
- if (!focused_window_)
- return;
-
- SetFocus(nullptr);
-}
-
-gfx::Point WindowTreeClient::GetCursorScreenPoint() {
- // We raced initialization. Return (0, 0).
- if (!cursor_location_memory())
- return gfx::Point();
-
- base::subtle::Atomic32 location =
- base::subtle::NoBarrier_Load(cursor_location_memory());
- return gfx::Point(static_cast<int16_t>(location >> 16),
- static_cast<int16_t>(location & 0xFFFF));
-}
-
-void WindowTreeClient::SetEventObserver(mojom::EventMatcherPtr matcher) {
- if (matcher.is_null()) {
- has_event_observer_ = false;
- tree_->SetEventObserver(nullptr, 0u);
- } else {
- has_event_observer_ = true;
- event_observer_id_++;
- tree_->SetEventObserver(std::move(matcher), event_observer_id_);
- }
-}
-
-Window* WindowTreeClient::NewWindow(
- const Window::SharedProperties* properties) {
- return NewWindowImpl(NewWindowType::CHILD, properties);
-}
-
-Window* WindowTreeClient::NewTopLevelWindow(
- const Window::SharedProperties* properties) {
- Window* window = NewWindowImpl(NewWindowType::TOP_LEVEL, properties);
- // Assume newly created top level windows are drawn by default, otherwise
- // requests to focus will fail. We will get the real value in
- // OnTopLevelCreated().
- window->LocalSetParentDrawn(true);
- return window;
-}
-
-#if !defined(NDEBUG)
-std::string WindowTreeClient::GetDebugWindowHierarchy() const {
- std::string result;
- for (Window* root : roots_)
- BuildDebugInfo(std::string(), root, &result);
- return result;
-}
-
-void WindowTreeClient::BuildDebugInfo(const std::string& depth,
- Window* window,
- std::string* result) const {
- std::string name = window->GetName();
- *result += base::StringPrintf(
- "%sid=%d visible=%s bounds=%d,%d %dx%d %s\n", depth.c_str(),
- window->server_id(), window->visible() ? "true" : "false",
- window->bounds().x(), window->bounds().y(), window->bounds().width(),
- window->bounds().height(), !name.empty() ? name.c_str() : "(no name)");
- for (Window* child : window->children())
- BuildDebugInfo(depth + " ", child, result);
-}
-#endif // !defined(NDEBUG)
-
-////////////////////////////////////////////////////////////////////////////////
-// WindowTreeClient, WindowTreeClient implementation:
-
-void WindowTreeClient::AddObserver(WindowTreeClientObserver* observer) {
- observers_.AddObserver(observer);
-}
-
-void WindowTreeClient::RemoveObserver(WindowTreeClientObserver* observer) {
- observers_.RemoveObserver(observer);
-}
-
-void WindowTreeClient::OnEmbed(ClientSpecificId client_id,
- mojom::WindowDataPtr root_data,
- mojom::WindowTreePtr tree,
- int64_t display_id,
- Id focused_window_id,
- bool drawn) {
- DCHECK(!tree_ptr_);
- tree_ptr_ = std::move(tree);
- tree_ptr_.set_connection_error_handler(
- base::Bind(&DeleteWindowTreeClient, this));
-
- if (window_manager_delegate_) {
- tree_ptr_->GetWindowManagerClient(GetProxy(&window_manager_internal_client_,
- tree_ptr_.associated_group()));
- }
-
- OnEmbedImpl(tree_ptr_.get(), client_id, std::move(root_data), display_id,
- focused_window_id, drawn);
-}
-
-void WindowTreeClient::OnEmbeddedAppDisconnected(Id window_id) {
- Window* window = GetWindowByServerId(window_id);
- if (window) {
- FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(window).observers(),
- OnWindowEmbeddedAppDisconnected(window));
- }
-}
-
-void WindowTreeClient::OnUnembed(Id window_id) {
- Window* window = GetWindowByServerId(window_id);
- if (!window)
- return;
-
- delegate_->OnUnembed(window);
- WindowPrivate(window).LocalDestroy();
-}
-
-void WindowTreeClient::OnLostCapture(Id window_id) {
- Window* window = GetWindowByServerId(window_id);
- if (!window)
- return;
-
- InFlightCaptureChange reset_change(this, nullptr);
- if (ApplyServerChangeToExistingInFlightChange(reset_change))
- return;
-
- LocalSetCapture(nullptr);
-}
-
-void WindowTreeClient::OnTopLevelCreated(uint32_t change_id,
- mojom::WindowDataPtr data,
- int64_t display_id,
- bool drawn) {
- // The server ack'd the top level window we created and supplied the state
- // of the window at the time the server created it. For properties we do not
- // have changes in flight for we can update them immediately. For properties
- // with changes in flight we set the revert value from the server.
-
- if (!in_flight_map_.count(change_id)) {
- // The window may have been destroyed locally before the server could finish
- // creating the window, and before the server received the notification that
- // the window has been destroyed.
- return;
- }
- std::unique_ptr<InFlightChange> change(std::move(in_flight_map_[change_id]));
- in_flight_map_.erase(change_id);
-
- Window* window = change->window();
- WindowPrivate window_private(window);
-
- // Drawn state and display-id always come from the server (they can't be
- // modified locally).
- window_private.LocalSetParentDrawn(drawn);
- window_private.LocalSetDisplay(display_id);
-
- // The default visibilty is false, we only need update visibility if it
- // differs from that.
- if (data->visible) {
- InFlightVisibleChange visible_change(window, data->visible);
- InFlightChange* current_change =
- GetOldestInFlightChangeMatching(visible_change);
- if (current_change)
- current_change->SetRevertValueFrom(visible_change);
- else
- window_private.LocalSetVisible(true);
- }
-
- const gfx::Rect bounds(data->bounds);
- {
- InFlightBoundsChange bounds_change(window, bounds);
- InFlightChange* current_change =
- GetOldestInFlightChangeMatching(bounds_change);
- if (current_change)
- current_change->SetRevertValueFrom(bounds_change);
- else if (window->bounds() != bounds)
- window_private.LocalSetBounds(window->bounds(), bounds);
- }
-
- // There is currently no API to bulk set properties, so we iterate over each
- // property individually.
- Window::SharedProperties properties =
- data->properties.To<std::map<std::string, std::vector<uint8_t>>>();
- for (const auto& pair : properties) {
- InFlightPropertyChange property_change(
- window, pair.first, mojo::Array<uint8_t>::From(pair.second));
- InFlightChange* current_change =
- GetOldestInFlightChangeMatching(property_change);
- if (current_change)
- current_change->SetRevertValueFrom(property_change);
- else
- window_private.LocalSetSharedProperty(pair.first, &(pair.second));
- }
-
- // Top level windows should not have a parent.
- DCHECK_EQ(0u, data->parent_id);
-}
-
-void WindowTreeClient::OnWindowBoundsChanged(Id window_id,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {
- Window* window = GetWindowByServerId(window_id);
- if (!window)
- return;
-
- InFlightBoundsChange new_change(window, new_bounds);
- if (ApplyServerChangeToExistingInFlightChange(new_change))
- return;
-
- WindowPrivate(window).LocalSetBounds(old_bounds, new_bounds);
-}
-
-void WindowTreeClient::OnClientAreaChanged(
- uint32_t window_id,
- const gfx::Insets& new_client_area,
- mojo::Array<gfx::Rect> new_additional_client_areas) {
- Window* window = GetWindowByServerId(window_id);
- if (window) {
- WindowPrivate(window).LocalSetClientArea(
- new_client_area,
- new_additional_client_areas.To<std::vector<gfx::Rect>>());
- }
-}
-
-void WindowTreeClient::OnTransientWindowAdded(
- uint32_t window_id,
- uint32_t transient_window_id) {
- Window* window = GetWindowByServerId(window_id);
- Window* transient_window = GetWindowByServerId(transient_window_id);
- // window or transient_window or both may be null if a local delete occurs
- // with an in flight add from the server.
- if (window && transient_window)
- WindowPrivate(window).LocalAddTransientWindow(transient_window);
-}
-
-void WindowTreeClient::OnTransientWindowRemoved(
- uint32_t window_id,
- uint32_t transient_window_id) {
- Window* window = GetWindowByServerId(window_id);
- Window* transient_window = GetWindowByServerId(transient_window_id);
- // window or transient_window or both may be null if a local delete occurs
- // with an in flight delete from the server.
- if (window && transient_window)
- WindowPrivate(window).LocalRemoveTransientWindow(transient_window);
-}
-
-void WindowTreeClient::OnWindowHierarchyChanged(
- Id window_id,
- Id old_parent_id,
- Id new_parent_id,
- mojo::Array<mojom::WindowDataPtr> windows) {
- Window* initial_parent =
- windows.size() ? GetWindowByServerId(windows[0]->parent_id) : NULL;
-
- const bool was_window_known = GetWindowByServerId(window_id) != nullptr;
-
- BuildWindowTree(this, windows, initial_parent);
-
- // If the window was not known, then BuildWindowTree() will have created it
- // and parented the window.
- if (!was_window_known)
- return;
-
- Window* new_parent = GetWindowByServerId(new_parent_id);
- Window* old_parent = GetWindowByServerId(old_parent_id);
- Window* window = GetWindowByServerId(window_id);
- if (new_parent)
- WindowPrivate(new_parent).LocalAddChild(window);
- else
- WindowPrivate(old_parent).LocalRemoveChild(window);
-}
-
-void WindowTreeClient::OnWindowReordered(Id window_id,
- Id relative_window_id,
- mojom::OrderDirection direction) {
- Window* window = GetWindowByServerId(window_id);
- Window* relative_window = GetWindowByServerId(relative_window_id);
- if (window && relative_window)
- WindowPrivate(window).LocalReorder(relative_window, direction);
-}
-
-void WindowTreeClient::OnWindowDeleted(Id window_id) {
- Window* window = GetWindowByServerId(window_id);
- if (window)
- WindowPrivate(window).LocalDestroy();
-}
-
-Window* WindowTreeClient::GetCaptureWindow() {
- return capture_window_;
-}
-
-void WindowTreeClient::OnWindowVisibilityChanged(Id window_id,
- bool visible) {
- Window* window = GetWindowByServerId(window_id);
- if (!window)
- return;
-
- InFlightVisibleChange new_change(window, visible);
- if (ApplyServerChangeToExistingInFlightChange(new_change))
- return;
-
- WindowPrivate(window).LocalSetVisible(visible);
-}
-
-void WindowTreeClient::OnWindowOpacityChanged(Id window_id,
- float old_opacity,
- float new_opacity) {
- Window* window = GetWindowByServerId(window_id);
- if (!window)
- return;
-
- InFlightOpacityChange new_change(window, new_opacity);
- if (ApplyServerChangeToExistingInFlightChange(new_change))
- return;
-
- WindowPrivate(window).LocalSetOpacity(new_opacity);
-}
-
-void WindowTreeClient::OnWindowParentDrawnStateChanged(Id window_id,
- bool drawn) {
- Window* window = GetWindowByServerId(window_id);
- if (window)
- WindowPrivate(window).LocalSetParentDrawn(drawn);
-}
-
-void WindowTreeClient::OnWindowSharedPropertyChanged(
- Id window_id,
- const mojo::String& name,
- mojo::Array<uint8_t> new_data) {
- Window* window = GetWindowByServerId(window_id);
- if (!window)
- return;
-
- InFlightPropertyChange new_change(window, name, new_data);
- if (ApplyServerChangeToExistingInFlightChange(new_change))
- return;
-
- WindowPrivate(window).LocalSetSharedProperty(name, std::move(new_data));
-}
-
-void WindowTreeClient::OnWindowInputEvent(uint32_t event_id,
- Id window_id,
- std::unique_ptr<ui::Event> event,
- uint32_t event_observer_id) {
- DCHECK(event);
- Window* window = GetWindowByServerId(window_id); // May be null.
-
- // Non-zero event_observer_id means it matched an event observer on the
- // server.
- if (event_observer_id != 0 && has_event_observer_ &&
- event_observer_id == event_observer_id_)
- delegate_->OnEventObserved(*event.get(), window);
-
- if (!window || !window->input_event_handler_) {
- tree_->OnWindowInputEventAck(event_id, mojom::EventResult::UNHANDLED);
- return;
- }
-
- std::unique_ptr<base::Callback<void(mojom::EventResult)>> ack_callback(
- new base::Callback<void(mojom::EventResult)>(
- base::Bind(&mojom::WindowTree::OnWindowInputEventAck,
- base::Unretained(tree_), event_id)));
-
- // TODO(moshayedi): crbug.com/617222. No need to convert to ui::MouseEvent or
- // ui::TouchEvent once we have proper support for pointer events.
- if (event->IsMousePointerEvent()) {
- window->input_event_handler_->OnWindowInputEvent(
- window, ui::MouseEvent(*event->AsPointerEvent()), &ack_callback);
- } else if (event->IsTouchPointerEvent()) {
- window->input_event_handler_->OnWindowInputEvent(
- window, ui::TouchEvent(*event->AsPointerEvent()), &ack_callback);
- } else {
- window->input_event_handler_->OnWindowInputEvent(window, *event.get(),
- &ack_callback);
- }
-
- // The handler did not take ownership of the callback, so we send the ack,
- // marking the event as not consumed.
- if (ack_callback)
- ack_callback->Run(mojom::EventResult::UNHANDLED);
-}
-
-void WindowTreeClient::OnEventObserved(std::unique_ptr<ui::Event> event,
- uint32_t event_observer_id) {
- DCHECK(event);
- if (has_event_observer_ && event_observer_id == event_observer_id_)
- delegate_->OnEventObserved(*event.get(), nullptr /* target */);
-}
-
-void WindowTreeClient::OnWindowFocused(Id focused_window_id) {
- Window* focused_window = GetWindowByServerId(focused_window_id);
- InFlightFocusChange new_change(this, focused_window);
- if (ApplyServerChangeToExistingInFlightChange(new_change))
- return;
-
- LocalSetFocus(focused_window);
-}
-
-void WindowTreeClient::OnWindowPredefinedCursorChanged(
- Id window_id,
- mojom::Cursor cursor) {
- Window* window = GetWindowByServerId(window_id);
- if (!window)
- return;
-
- InFlightPredefinedCursorChange new_change(window, cursor);
- if (ApplyServerChangeToExistingInFlightChange(new_change))
- return;
-
- WindowPrivate(window).LocalSetPredefinedCursor(cursor);
-}
-
-void WindowTreeClient::OnChangeCompleted(uint32_t change_id, bool success) {
- std::unique_ptr<InFlightChange> change(std::move(in_flight_map_[change_id]));
- in_flight_map_.erase(change_id);
- if (!change)
- return;
-
- if (!success)
- change->ChangeFailed();
-
- InFlightChange* next_change = GetOldestInFlightChangeMatching(*change);
- if (next_change) {
- if (!success)
- next_change->SetRevertValueFrom(*change);
- } else if (!success) {
- change->Revert();
- }
-}
-
-void WindowTreeClient::GetWindowManager(
- mojo::AssociatedInterfaceRequest<WindowManager> internal) {
- window_manager_internal_.reset(
- new mojo::AssociatedBinding<mojom::WindowManager>(this,
- std::move(internal)));
-}
-
-void WindowTreeClient::RequestClose(uint32_t window_id) {
- Window* window = GetWindowByServerId(window_id);
- if (!window || !IsRoot(window))
- return;
-
- FOR_EACH_OBSERVER(WindowObserver, *WindowPrivate(window).observers(),
- OnRequestClose(window));
-}
-
-void WindowTreeClient::OnConnect(ClientSpecificId client_id) {
- client_id_ = client_id;
-}
-
-void WindowTreeClient::WmNewDisplayAdded(mojom::DisplayPtr display,
- mojom::WindowDataPtr root_data,
- bool parent_drawn) {
- WmNewDisplayAddedImpl(display.To<display::Display>(), std::move(root_data),
- parent_drawn);
-}
-
-void WindowTreeClient::WmSetBounds(uint32_t change_id,
- Id window_id,
- const gfx::Rect& transit_bounds) {
- Window* window = GetWindowByServerId(window_id);
- bool result = false;
- if (window) {
- DCHECK(window_manager_delegate_);
- gfx::Rect bounds = transit_bounds;
- result = window_manager_delegate_->OnWmSetBounds(window, &bounds);
- if (result) {
- // If the resulting bounds differ return false. Returning false ensures
- // the client applies the bounds we set below.
- result = bounds == transit_bounds;
- window->SetBounds(bounds);
- }
- }
- if (window_manager_internal_client_)
- window_manager_internal_client_->WmResponse(change_id, result);
-}
-
-void WindowTreeClient::WmSetProperty(uint32_t change_id,
- Id window_id,
- const mojo::String& name,
- mojo::Array<uint8_t> transit_data) {
- Window* window = GetWindowByServerId(window_id);
- bool result = false;
- if (window) {
- DCHECK(window_manager_delegate_);
- std::unique_ptr<std::vector<uint8_t>> data;
- if (!transit_data.is_null()) {
- data.reset(
- new std::vector<uint8_t>(transit_data.To<std::vector<uint8_t>>()));
- }
- result = window_manager_delegate_->OnWmSetProperty(window, name, &data);
- if (result) {
- // If the resulting bounds differ return false. Returning false ensures
- // the client applies the bounds we set below.
- window->SetSharedPropertyInternal(name, data.get());
- }
- }
- if (window_manager_internal_client_)
- window_manager_internal_client_->WmResponse(change_id, result);
-}
-
-void WindowTreeClient::WmCreateTopLevelWindow(
- uint32_t change_id,
- ClientSpecificId requesting_client_id,
- mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) {
- std::map<std::string, std::vector<uint8_t>> properties =
- transport_properties.To<std::map<std::string, std::vector<uint8_t>>>();
- Window* window =
- window_manager_delegate_->OnWmCreateTopLevelWindow(&properties);
- embedded_windows_[requesting_client_id].insert(window);
- if (window_manager_internal_client_) {
- window_manager_internal_client_->OnWmCreatedTopLevelWindow(
- change_id, server_id(window));
- }
-}
-
-void WindowTreeClient::WmClientJankinessChanged(ClientSpecificId client_id,
- bool janky) {
- if (window_manager_delegate_) {
- auto it = embedded_windows_.find(client_id);
- CHECK(it != embedded_windows_.end());
- window_manager_delegate_->OnWmClientJankinessChanged(
- embedded_windows_[client_id], janky);
- }
-}
-
-void WindowTreeClient::OnAccelerator(uint32_t id,
- std::unique_ptr<ui::Event> event) {
- DCHECK(event);
- window_manager_delegate_->OnAccelerator(id, *event.get());
-}
-
-void WindowTreeClient::SetFrameDecorationValues(
- mojom::FrameDecorationValuesPtr values) {
- if (window_manager_internal_client_) {
- window_manager_internal_client_->WmSetFrameDecorationValues(
- std::move(values));
- }
-}
-
-void WindowTreeClient::SetNonClientCursor(Window* window,
- mus::mojom::Cursor cursor_id) {
- window_manager_internal_client_->WmSetNonClientCursor(server_id(window),
- cursor_id);
-}
-
-void WindowTreeClient::AddAccelerator(
- uint32_t id,
- mojom::EventMatcherPtr event_matcher,
- const base::Callback<void(bool)>& callback) {
- if (window_manager_internal_client_) {
- window_manager_internal_client_->AddAccelerator(
- id, std::move(event_matcher), callback);
- }
-}
-
-void WindowTreeClient::RemoveAccelerator(uint32_t id) {
- if (window_manager_internal_client_) {
- window_manager_internal_client_->RemoveAccelerator(id);
- }
-}
-
-void WindowTreeClient::AddActivationParent(Window* window) {
- if (window_manager_internal_client_)
- window_manager_internal_client_->AddActivationParent(server_id(window));
-}
-
-void WindowTreeClient::RemoveActivationParent(Window* window) {
- if (window_manager_internal_client_)
- window_manager_internal_client_->RemoveActivationParent(server_id(window));
-}
-
-void WindowTreeClient::ActivateNextWindow() {
- if (window_manager_internal_client_)
- window_manager_internal_client_->ActivateNextWindow();
-}
-
-void WindowTreeClient::SetUnderlaySurfaceOffsetAndExtendedHitArea(
- Window* window,
- const gfx::Vector2d& offset,
- const gfx::Insets& hit_area) {
- if (window_manager_internal_client_) {
- window_manager_internal_client_->SetUnderlaySurfaceOffsetAndExtendedHitArea(
- server_id(window), offset.x(), offset.y(), hit_area);
- }
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/public/cpp/lib/window_tree_client_delegate.cc b/chromium/components/mus/public/cpp/lib/window_tree_client_delegate.cc
deleted file mode 100644
index ed53012b227..00000000000
--- a/chromium/components/mus/public/cpp/lib/window_tree_client_delegate.cc
+++ /dev/null
@@ -1,11 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/window_tree_client_delegate.h"
-
-namespace mus {
-
-void WindowTreeClientDelegate::OnUnembed(Window* root) {}
-
-} // namespace mus
diff --git a/chromium/components/mus/public/cpp/lib/window_tree_host_factory.cc b/chromium/components/mus/public/cpp/lib/window_tree_host_factory.cc
deleted file mode 100644
index 0d55bae13fe..00000000000
--- a/chromium/components/mus/public/cpp/lib/window_tree_host_factory.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/window_tree_host_factory.h"
-
-#include "components/mus/public/cpp/window_tree_client.h"
-#include "components/mus/public/cpp/window_tree_client_delegate.h"
-#include "services/shell/public/cpp/connector.h"
-
-namespace mus {
-
-void CreateWindowTreeHost(mojom::WindowTreeHostFactory* factory,
- WindowTreeClientDelegate* delegate,
- mojom::WindowTreeHostPtr* host,
- WindowManagerDelegate* window_manager_delegate) {
- mojom::WindowTreeClientPtr tree_client;
- new WindowTreeClient(delegate, window_manager_delegate,
- GetProxy(&tree_client));
- factory->CreateWindowTreeHost(GetProxy(host), std::move(tree_client));
-}
-
-void CreateWindowTreeHost(shell::Connector* connector,
- WindowTreeClientDelegate* delegate,
- mojom::WindowTreeHostPtr* host,
- WindowManagerDelegate* window_manager_delegate) {
- mojom::WindowTreeHostFactoryPtr factory;
- connector->ConnectToInterface("mojo:mus", &factory);
- CreateWindowTreeHost(factory.get(), delegate, host, window_manager_delegate);
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/public/cpp/output_surface.h b/chromium/components/mus/public/cpp/output_surface.h
deleted file mode 100644
index 1b1feccff37..00000000000
--- a/chromium/components/mus/public/cpp/output_surface.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_OUTPUT_SURFACE_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_OUTPUT_SURFACE_H_
-
-#include "base/macros.h"
-#include "cc/output/output_surface.h"
-#include "cc/surfaces/surface_id.h"
-#include "components/mus/public/cpp/window_surface.h"
-#include "components/mus/public/cpp/window_surface_client.h"
-#include "mojo/public/cpp/bindings/binding.h"
-
-namespace mus {
-
-class OutputSurface : public cc::OutputSurface, public WindowSurfaceClient {
- public:
- OutputSurface(const scoped_refptr<cc::ContextProvider>& context_provider,
- std::unique_ptr<WindowSurface> surface);
- ~OutputSurface() override;
-
- // cc::OutputSurface implementation.
- void SwapBuffers(cc::CompositorFrame frame) override;
- bool BindToClient(cc::OutputSurfaceClient* client) override;
- void DetachFromClient() override;
- void BindFramebuffer() override;
- uint32_t GetFramebufferCopyTextureFormat() override;
-
- private:
- // WindowSurfaceClient implementation:
- void OnResourcesReturned(
- WindowSurface* surface,
- mojo::Array<cc::ReturnedResource> resources) override;
-
- void SwapBuffersComplete();
-
- std::unique_ptr<WindowSurface> surface_;
-
- DISALLOW_COPY_AND_ASSIGN(OutputSurface);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_OUTPUT_SURFACE_H_
diff --git a/chromium/components/mus/public/cpp/property_type_converters.h b/chromium/components/mus/public/cpp/property_type_converters.h
deleted file mode 100644
index 5676253e810..00000000000
--- a/chromium/components/mus/public/cpp/property_type_converters.h
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_PROPERTY_TYPE_CONVERTERS_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_PROPERTY_TYPE_CONVERTERS_H_
-
-#include <stdint.h>
-#include <vector>
-
-#include "base/strings/string16.h"
-#include "mojo/public/cpp/bindings/type_converter.h"
-
-class SkBitmap;
-
-namespace gfx {
-class Rect;
-class Size;
-}
-
-namespace mojo {
-
-// TODO(beng): these methods serialize types used for standard properties
-// to vectors of bytes used by Window::SetSharedProperty().
-// replace this with serialization code generated @ bindings.
-// This would be especially useful for SkBitmap, which could be
-// replaced with the skia.Bitmap mojom struct serialization.
-
-template <>
-struct TypeConverter<std::vector<uint8_t>, gfx::Rect> {
- static std::vector<uint8_t> Convert(const gfx::Rect& input);
-};
-template <>
-struct TypeConverter<gfx::Rect, std::vector<uint8_t>> {
- static gfx::Rect Convert(const std::vector<uint8_t>& input);
-};
-
-template <>
-struct TypeConverter<std::vector<uint8_t>, gfx::Size> {
- static std::vector<uint8_t> Convert(const gfx::Size& input);
-};
-template <>
-struct TypeConverter<gfx::Size, std::vector<uint8_t>> {
- static gfx::Size Convert(const std::vector<uint8_t>& input);
-};
-
-template <>
-struct TypeConverter<std::vector<uint8_t>, int32_t> {
- static std::vector<uint8_t> Convert(const int32_t& input);
-};
-template <>
-struct TypeConverter<int32_t, std::vector<uint8_t>> {
- static int32_t Convert(const std::vector<uint8_t>& input);
-};
-
-template <>
-struct TypeConverter<std::vector<uint8_t>, base::string16> {
- static std::vector<uint8_t> Convert(const base::string16& input);
-};
-template <>
-struct TypeConverter<base::string16, std::vector<uint8_t>> {
- static base::string16 Convert(const std::vector<uint8_t>& input);
-};
-
-template <>
-struct TypeConverter<std::vector<uint8_t>, std::string> {
- static std::vector<uint8_t> Convert(const std::string& input);
-};
-template <>
-struct TypeConverter<std::string, std::vector<uint8_t>> {
- static std::string Convert(const std::vector<uint8_t>& input);
-};
-
-// NOTE: These methods only serialize and deserialize the common case of RGBA
-// 8888 bitmaps with premultiplied alpha.
-template <>
-struct TypeConverter<std::vector<uint8_t>, SkBitmap> {
- static std::vector<uint8_t> Convert(const SkBitmap& input);
-};
-template <>
-struct TypeConverter<SkBitmap, std::vector<uint8_t>> {
- static SkBitmap Convert(const std::vector<uint8_t>& input);
-};
-
-template <>
-struct TypeConverter<std::vector<uint8_t>, bool> {
- static std::vector<uint8_t> Convert(bool input);
-};
-template <>
-struct TypeConverter<bool, std::vector<uint8_t>> {
- static bool Convert(const std::vector<uint8_t>& input);
-};
-
-} // namespace mojo
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_PROPERTY_TYPE_CONVERTERS_H_
diff --git a/chromium/components/mus/public/cpp/scoped_window_ptr.h b/chromium/components/mus/public/cpp/scoped_window_ptr.h
deleted file mode 100644
index b94e0f945f3..00000000000
--- a/chromium/components/mus/public/cpp/scoped_window_ptr.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_SCOPED_WINDOW_PTR_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_SCOPED_WINDOW_PTR_H_
-
-#include "base/macros.h"
-#include "components/mus/public/cpp/window_observer.h"
-
-namespace mus {
-
-// Wraps a Window, taking overship of the Window. Also deals with Window being
-// destroyed while ScopedWindowPtr still exists.
-class ScopedWindowPtr : public WindowObserver {
- public:
- explicit ScopedWindowPtr(Window* window);
- ~ScopedWindowPtr() override;
-
- // Destroys |window|. If |window| is a root of the WindowManager than the
- // WindowManager is destroyed (which in turn destroys |window|).
- //
- // NOTE: this function (and class) are only useful for clients that only
- // ever have a single root.
- static void DeleteWindowOrWindowManager(Window* window);
-
- Window* window() { return window_; }
- const Window* window() const { return window_; }
-
- private:
- void DetachFromWindow();
-
- void OnWindowDestroying(Window* window) override;
-
- Window* window_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedWindowPtr);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_SCOPED_WINDOW_PTR_H_
diff --git a/chromium/components/mus/public/cpp/window.h b/chromium/components/mus/public/cpp/window.h
deleted file mode 100644
index eabc6098a5b..00000000000
--- a/chromium/components/mus/public/cpp/window.h
+++ /dev/null
@@ -1,356 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_
-
-#include <stdint.h>
-#include <vector>
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "base/observer_list.h"
-#include "components/mus/common/types.h"
-#include "components/mus/public/interfaces/mus_constants.mojom.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "mojo/public/cpp/bindings/array.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
-#include "ui/gfx/geometry/insets.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace gfx {
-class Size;
-}
-
-namespace mus {
-
-class InputEventHandler;
-class ServiceProviderImpl;
-class WindowObserver;
-class WindowSurface;
-class WindowSurfaceBinding;
-class WindowTreeClient;
-class WindowTreeClientPrivate;
-
-namespace {
-class OrderChangedNotifier;
-}
-
-// Defined in window_property.h (which we do not include)
-template <typename T>
-struct WindowProperty;
-
-// Windows are owned by the WindowTreeClient. See WindowTreeClientDelegate for
-// details on ownership.
-//
-// TODO(beng): Right now, you'll have to implement a WindowObserver to track
-// destruction and NULL any pointers you have.
-// Investigate some kind of smart pointer or weak pointer for these.
-class Window {
- public:
- using Children = std::vector<Window*>;
- using EmbedCallback = base::Callback<void(bool)>;
- using PropertyDeallocator = void (*)(int64_t value);
- using SharedProperties = std::map<std::string, std::vector<uint8_t>>;
-
- // Destroys this window and all its children. Destruction is allowed for
- // windows that were created by this connection, or the roots. For windows
- // from other connections (except the roots), Destroy() does nothing. If the
- // destruction is allowed observers are notified and the Window is
- // immediately deleted.
- void Destroy();
-
- WindowTreeClient* window_tree() { return client_; }
-
- // The local_id is provided for client code. The local_id is not set or
- // manipulated by mus. The default value is -1.
- void set_local_id(int id) { local_id_ = id; }
- int local_id() const { return local_id_; }
-
- int64_t display_id() const { return display_id_; }
-
- // Geometric disposition relative to parent window.
- const gfx::Rect& bounds() const { return bounds_; }
- void SetBounds(const gfx::Rect& bounds);
-
- // Geometric disposition relative to root window.
- gfx::Rect GetBoundsInRoot() const;
-
- const gfx::Insets& client_area() const { return client_area_; }
- const std::vector<gfx::Rect>& additional_client_areas() {
- return additional_client_areas_;
- }
- void SetClientArea(const gfx::Insets& new_client_area) {
- SetClientArea(new_client_area, std::vector<gfx::Rect>());
- }
- void SetClientArea(const gfx::Insets& new_client_area,
- const std::vector<gfx::Rect>& additional_client_areas);
-
- // Mouse events outside the hit test mask do not hit the window. Returns null
- // if there is no mask.
- const gfx::Rect* hit_test_mask() const { return hit_test_mask_.get(); }
- void SetHitTestMask(const gfx::Rect& mask_rect);
- void ClearHitTestMask();
-
- // Visibility (also see IsDrawn()). When created windows are hidden.
- bool visible() const { return visible_; }
- void SetVisible(bool value);
-
- float opacity() const { return opacity_; }
- void SetOpacity(float opacity);
-
- // Cursors
- mojom::Cursor predefined_cursor() const { return cursor_id_; }
- void SetPredefinedCursor(mus::mojom::Cursor cursor_id);
-
- // A Window is drawn if the Window and all its ancestors are visible and the
- // Window is attached to the root.
- bool IsDrawn() const;
-
- std::unique_ptr<WindowSurface> RequestSurface(mojom::SurfaceType type);
-
- void AttachSurface(mojom::SurfaceType type,
- std::unique_ptr<WindowSurfaceBinding> surface_binding);
-
- // The template-ized versions of the following methods rely on the presence
- // of a mojo::TypeConverter<const std::vector<uint8_t>, T>.
- // Sets a shared property on the window which is sent to the window server and
- // shared with other clients that can view this window.
- template <typename T>
- void SetSharedProperty(const std::string& name, const T& data);
- // Gets a shared property set on the window. The property must exist. Call
- // HasSharedProperty() before calling.
- template <typename T>
- T GetSharedProperty(const std::string& name) const;
- // Removes the shared property.
- void ClearSharedProperty(const std::string& name);
- bool HasSharedProperty(const std::string& name) const;
-
- // TODO(beng): Test only, should move to a helper.
- const SharedProperties& shared_properties() { return properties_; }
-
- // Sets the |value| of the given window |property|. Setting to the default
- // value (e.g., NULL) removes the property. The caller is responsible for the
- // lifetime of any object set as a property on the Window.
- //
- // These properties are not visible to the window server.
- template <typename T>
- void SetLocalProperty(const WindowProperty<T>* property, T value);
-
- // Returns the value of the given window |property|. Returns the
- // property-specific default value if the property was not previously set.
- //
- // These properties are only visible in the current process and are not
- // shared with other mojo services.
- template <typename T>
- T GetLocalProperty(const WindowProperty<T>* property) const;
-
- // Sets the |property| to its default value. Useful for avoiding a cast when
- // setting to NULL.
- //
- // These properties are only visible in the current process and are not
- // shared with other mojo services.
- template <typename T>
- void ClearLocalProperty(const WindowProperty<T>* property);
-
- void set_input_event_handler(InputEventHandler* input_event_handler) {
- input_event_handler_ = input_event_handler;
- }
-
- // Observation.
- void AddObserver(WindowObserver* observer);
- void RemoveObserver(WindowObserver* observer);
-
- // Tree.
- Window* parent() { return parent_; }
- const Window* parent() const { return parent_; }
-
- Window* GetRoot() {
- return const_cast<Window*>(const_cast<const Window*>(this)->GetRoot());
- }
- const Window* GetRoot() const;
-
- void AddChild(Window* child);
- void RemoveChild(Window* child);
- const Children& children() const { return children_; }
-
- void Reorder(Window* relative, mojom::OrderDirection direction);
- void MoveToFront();
- void MoveToBack();
-
- // Returns true if |child| is this or a descendant of this.
- bool Contains(const Window* child) const;
-
- void AddTransientWindow(Window* transient_window);
- void RemoveTransientWindow(Window* transient_window);
-
- // TODO(fsamuel): Figure out if we want to refactor transient window
- // management into a separate class.
- // Transient tree.
- Window* transient_parent() { return transient_parent_; }
- const Window* transient_parent() const { return transient_parent_; }
- const Children& transient_children() const { return transient_children_; }
-
- void SetModal();
- bool is_modal() const { return is_modal_; }
-
- Window* GetChildByLocalId(int id);
-
- void SetTextInputState(mojo::TextInputStatePtr state);
- void SetImeVisibility(bool visible, mojo::TextInputStatePtr state);
-
- bool HasCapture() const;
- void SetCapture();
- void ReleaseCapture();
-
- // Focus. See WindowTreeClient::ClearFocus() to reset focus.
- void SetFocus();
- bool HasFocus() const;
- void SetCanFocus(bool can_focus);
-
- // Embedding. See window_tree.mojom for details.
- void Embed(mus::mojom::WindowTreeClientPtr client, uint32_t flags = 0);
-
- // NOTE: callback is run synchronously if Embed() is not allowed on this
- // Window.
- void Embed(mus::mojom::WindowTreeClientPtr client,
- const EmbedCallback& callback,
- uint32_t flags = 0);
-
- // TODO(sky): this API is only applicable to the WindowManager. Move it
- // to a better place.
- void RequestClose();
-
- // Returns an internal name, set by a client app when it creates a window.
- std::string GetName() const;
-
- protected:
- // This class is subclassed only by test classes that provide a public ctor.
- Window();
- ~Window();
-
- private:
- friend class WindowPrivate;
- friend class WindowTreeClient;
- friend class WindowTreeClientPrivate;
-
- Window(WindowTreeClient* client, Id id);
-
- // Used to identify this Window on the server. Clients can not change this
- // value.
- Id server_id() const { return server_id_; }
-
- // Applies a shared property change locally and forwards to the server. If
- // |data| is null, this property is deleted.
- void SetSharedPropertyInternal(const std::string& name,
- const std::vector<uint8_t>* data);
- // Called by the public {Set,Get,Clear}Property functions.
- int64_t SetLocalPropertyInternal(const void* key,
- const char* name,
- PropertyDeallocator deallocator,
- int64_t value,
- int64_t default_value);
- int64_t GetLocalPropertyInternal(const void* key,
- int64_t default_value) const;
-
- void LocalDestroy();
- void LocalAddChild(Window* child);
- void LocalRemoveChild(Window* child);
- void LocalAddTransientWindow(Window* transient_window);
- void LocalRemoveTransientWindow(Window* transient_window);
- void LocalSetModal();
- // Returns true if the order actually changed.
- bool LocalReorder(Window* relative, mojom::OrderDirection direction);
- void LocalSetBounds(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds);
- void LocalSetClientArea(
- const gfx::Insets& new_client_area,
- const std::vector<gfx::Rect>& additional_client_areas);
- void LocalSetParentDrawn(bool drawn);
- void LocalSetDisplay(int64_t display_id);
- void LocalSetVisible(bool visible);
- void LocalSetOpacity(float opacity);
- void LocalSetPredefinedCursor(mojom::Cursor cursor_id);
- void LocalSetSharedProperty(const std::string& name,
- const std::vector<uint8_t>* data);
-
- // Notifies this winodw that its stacking position has changed.
- void NotifyWindowStackingChanged();
- // Methods implementing visibility change notifications. See WindowObserver
- // for more details.
- void NotifyWindowVisibilityChanged(Window* target);
- // Notifies this window's observers. Returns false if |this| was deleted
- // during the call (by an observer), otherwise true.
- bool NotifyWindowVisibilityChangedAtReceiver(Window* target);
- // Notifies this window and its child hierarchy. Returns false if |this| was
- // deleted during the call (by an observer), otherwise true.
- bool NotifyWindowVisibilityChangedDown(Window* target);
- // Notifies this window and its parent hierarchy.
- void NotifyWindowVisibilityChangedUp(Window* target);
-
- // Returns true if embed is allowed for this node. If embedding is allowed all
- // the children are removed.
- bool PrepareForEmbed();
-
- void RemoveTransientWindowImpl(Window* child);
- static void ReorderWithoutNotification(Window* window,
- Window* relative,
- mojom::OrderDirection direction);
- static bool ReorderImpl(Window* window,
- Window* relative,
- mojom::OrderDirection direction,
- OrderChangedNotifier* notifier);
-
- // Returns a pointer to the stacking target that can be used by
- // RestackTransientDescendants.
- static Window** GetStackingTarget(Window* window);
-
- WindowTreeClient* client_;
- Id server_id_;
- int local_id_ = -1;
- Window* parent_;
- Children children_;
-
- Window* stacking_target_;
- Window* transient_parent_;
- Children transient_children_;
-
- bool is_modal_;
-
- base::ObserverList<WindowObserver> observers_;
- InputEventHandler* input_event_handler_;
-
- gfx::Rect bounds_;
- gfx::Insets client_area_;
- std::vector<gfx::Rect> additional_client_areas_;
- std::unique_ptr<gfx::Rect> hit_test_mask_;
-
- bool visible_;
- float opacity_;
- int64_t display_id_;
-
- mojom::Cursor cursor_id_;
-
- SharedProperties properties_;
-
- // Drawn state of our parent. This is only meaningful for root Windows, in
- // which the parent Window isn't exposed to the client.
- bool parent_drawn_;
-
- // Value struct to keep the name and deallocator for this property.
- // Key cannot be used for this purpose because it can be char* or
- // WindowProperty<>.
- struct Value {
- const char* name;
- int64_t value;
- PropertyDeallocator deallocator;
- };
-
- std::map<const void*, Value> prop_map_;
-
- DISALLOW_COPY_AND_ASSIGN(Window);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_
diff --git a/chromium/components/mus/public/cpp/window_manager_delegate.h b/chromium/components/mus/public/cpp/window_manager_delegate.h
deleted file mode 100644
index 99ddf34cc4e..00000000000
--- a/chromium/components/mus/public/cpp/window_manager_delegate.h
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_MANAGER_DELEGATE_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_MANAGER_DELEGATE_H_
-
-#include <stdint.h>
-
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "base/callback_forward.h"
-#include "components/mus/public/interfaces/cursor.mojom.h"
-#include "components/mus/public/interfaces/event_matcher.mojom.h"
-#include "components/mus/public/interfaces/window_manager_constants.mojom.h"
-#include "ui/events/mojo/event.mojom.h"
-
-namespace display {
-class Display;
-}
-
-namespace gfx {
-class Insets;
-class Rect;
-class Vector2d;
-}
-
-namespace ui {
-class Event;
-}
-
-namespace mus {
-
-class Window;
-
-// See the mojom with the same name for details on the functions in this
-// interface.
-class WindowManagerClient {
- public:
- virtual void SetFrameDecorationValues(
- mojom::FrameDecorationValuesPtr values) = 0;
- virtual void SetNonClientCursor(Window* window,
- mojom::Cursor non_client_cursor) = 0;
-
- virtual void AddAccelerator(uint32_t id,
- mojom::EventMatcherPtr event_matcher,
- const base::Callback<void(bool)>& callback) = 0;
- virtual void RemoveAccelerator(uint32_t id) = 0;
- virtual void AddActivationParent(Window* window) = 0;
- virtual void RemoveActivationParent(Window* window) = 0;
- virtual void ActivateNextWindow() = 0;
- virtual void SetUnderlaySurfaceOffsetAndExtendedHitArea(
- Window* window,
- const gfx::Vector2d& offset,
- const gfx::Insets& hit_area) = 0;
-
- protected:
- virtual ~WindowManagerClient() {}
-};
-
-// Used by clients implementing a window manager.
-// TODO(sky): this should be called WindowManager, but that's rather confusing
-// currently.
-class WindowManagerDelegate {
- public:
- // Called once to give the delegate access to functions only exposed to
- // the WindowManager.
- virtual void SetWindowManagerClient(WindowManagerClient* client) = 0;
-
- // A client requested the bounds of |window| to change to |bounds|. Return
- // true if the bounds are allowed to change. A return value of false
- // indicates the change is not allowed.
- // NOTE: This should not change the bounds of |window|. Instead return the
- // bounds the window should be in |bounds|.
- virtual bool OnWmSetBounds(Window* window, gfx::Rect* bounds) = 0;
-
- // A client requested the shared property named |name| to change to
- // |new_data|. Return true to allow the change to |new_data|, false
- // otherwise.
- virtual bool OnWmSetProperty(
- Window* window,
- const std::string& name,
- std::unique_ptr<std::vector<uint8_t>>* new_data) = 0;
-
- // A client has requested a new top level window. The delegate should create
- // and parent the window appropriately and return it. |properties| is the
- // supplied properties from the client requesting the new window. The
- // delegate may modify |properties| before calling NewWindow(), but the
- // delegate does *not* own |properties|, they are valid only for the life
- // of OnWmCreateTopLevelWindow().
- virtual Window* OnWmCreateTopLevelWindow(
- std::map<std::string, std::vector<uint8_t>>* properties) = 0;
-
- // Called when a Mus client's jankiness changes. |windows| is the set of
- // windows owned by the window manager in which the client is embedded.
- virtual void OnWmClientJankinessChanged(
- const std::set<Window*>& client_windows,
- bool janky) = 0;
-
- // Called when a display is added. |window| is the root of the window tree for
- // the specified display.
- virtual void OnWmNewDisplay(Window* window,
- const display::Display& display) = 0;
-
- virtual void OnAccelerator(uint32_t id, const ui::Event& event) = 0;
-
- protected:
- virtual ~WindowManagerDelegate() {}
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_MANAGER_DELEGATE_H_
diff --git a/chromium/components/mus/public/cpp/window_observer.h b/chromium/components/mus/public/cpp/window_observer.h
deleted file mode 100644
index f1dc27913d7..00000000000
--- a/chromium/components/mus/public/cpp/window_observer.h
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_OBSERVER_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_OBSERVER_H_
-
-#include <stdint.h>
-
-#include <vector>
-
-#include "components/mus/public/cpp/window.h"
-
-namespace mus {
-
-class Window;
-
-// A note on -ing and -ed suffixes:
-//
-// -ing methods are called before changes are applied to the local window model.
-// -ed methods are called after changes are applied to the local window model.
-//
-// If the change originated from another connection to the window manager, it's
-// possible that the change has already been applied to the service-side model
-// prior to being called, so for example in the case of OnWindowDestroying(),
-// it's possible the window has already been destroyed on the service side.
-
-class WindowObserver {
- public:
- struct TreeChangeParams {
- TreeChangeParams();
- Window* target;
- Window* old_parent;
- Window* new_parent;
- Window* receiver;
- };
-
- virtual void OnTreeChanging(const TreeChangeParams& params) {}
- virtual void OnTreeChanged(const TreeChangeParams& params) {}
-
- virtual void OnWindowReordering(Window* window,
- Window* relative_window,
- mojom::OrderDirection direction) {}
- virtual void OnWindowReordered(Window* window,
- Window* relative_window,
- mojom::OrderDirection direction) {}
-
- virtual void OnWindowDestroying(Window* window) {}
- virtual void OnWindowDestroyed(Window* window) {}
-
- virtual void OnWindowBoundsChanging(Window* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {}
- virtual void OnWindowBoundsChanged(Window* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {}
- virtual void OnWindowLostCapture(Window* window) {}
- virtual void OnWindowClientAreaChanged(
- Window* window,
- const gfx::Insets& old_client_area,
- const std::vector<gfx::Rect>& old_additional_client_areas) {}
-
- virtual void OnWindowFocusChanged(Window* gained_focus, Window* lost_focus) {}
-
- virtual void OnWindowPredefinedCursorChanged(Window* window,
- mojom::Cursor cursor) {}
- virtual void OnWindowVisibilityChanging(Window* window) {}
- virtual void OnWindowVisibilityChanged(Window* window) {}
- virtual void OnWindowOpacityChanged(Window* window,
- float old_opacity,
- float new_opacity) {}
-
- // Invoked when this Window's shared properties have changed. This can either
- // be caused by SetSharedProperty() being called locally, or by us receiving
- // a mojo message that this property has changed. If this property has been
- // added, |old_data| is null. If this property was removed, |new_data| is
- // null.
- virtual void OnWindowSharedPropertyChanged(
- Window* window,
- const std::string& name,
- const std::vector<uint8_t>* old_data,
- const std::vector<uint8_t>* new_data) {}
-
- // Invoked when SetProperty() or ClearProperty() is called on the window.
- // |key| is either a WindowProperty<T>* (SetProperty, ClearProperty). Either
- // way, it can simply be compared for equality with the property
- // constant. |old| is the old property value, which must be cast to the
- // appropriate type before use.
- virtual void OnWindowLocalPropertyChanged(Window* window,
- const void* key,
- intptr_t old) {}
-
- virtual void OnWindowEmbeddedAppDisconnected(Window* window) {}
-
- // Sent when the drawn state changes. This is only sent for the root nodes
- // when embedded.
- virtual void OnWindowDrawnChanging(Window* window) {}
- virtual void OnWindowDrawnChanged(Window* window) {}
-
- // The WindowManager has requested the window to close. If the observer
- // allows the close it should destroy the window as appropriate.
- virtual void OnRequestClose(Window* window) {}
-
- protected:
- virtual ~WindowObserver() {}
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_OBSERVER_H_
diff --git a/chromium/components/mus/public/cpp/window_property.h b/chromium/components/mus/public/cpp/window_property.h
deleted file mode 100644
index 3299ac9db98..00000000000
--- a/chromium/components/mus/public/cpp/window_property.h
+++ /dev/null
@@ -1,156 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_PROPERTY_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_PROPERTY_H_
-
-#include <stdint.h>
-
-// To define a new WindowProperty:
-//
-// #include "components/mus/public/cpp/window_property.h"
-//
-// MUS_DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(FOO_EXPORT, MyType);
-// namespace foo {
-// // Use this to define an exported property that is primitive,
-// // or a pointer you don't want automatically deleted.
-// MUS_DEFINE_WINDOW_PROPERTY_KEY(MyType, kMyKey, MyDefault);
-//
-// // Use this to define an exported property whose value is a heap
-// // allocated object, and has to be owned and freed by the window.
-// MUS_DEFINE_OWNED_WINDOW_PROPERTY_KEY(gfx::Rect, kRestoreBoundsKey,
-// nullptr);
-//
-// // Use this to define a non exported property that is primitive,
-// // or a pointer you don't want to automatically deleted, and is used
-// // only in a specific file. This will define the property in an unnamed
-// // namespace which cannot be accessed from another file.
-// MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(MyType, kMyKey, MyDefault);
-//
-// } // foo namespace
-//
-// To define a new type used for WindowProperty.
-//
-// // outside all namespaces:
-// MUS_DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(FOO_EXPORT, MyType)
-//
-// If a property type is not exported, use
-// MUS_DECLARE_WINDOW_PROPERTY_TYPE(MyType) which is a shorthand for
-// MUS_DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(, MyType).
-
-namespace mus {
-
-template <typename T>
-void Window::SetSharedProperty(const std::string& name, const T& data) {
- const std::vector<uint8_t> bytes =
- mojo::TypeConverter<std::vector<uint8_t>, T>::Convert(data);
- SetSharedPropertyInternal(name, &bytes);
-}
-
-template <typename T>
-T Window::GetSharedProperty(const std::string& name) const {
- DCHECK(HasSharedProperty(name));
- auto it = properties_.find(name);
- return mojo::TypeConverter<T, std::vector<uint8_t>>::Convert(it->second);
-}
-
-namespace {
-
-// No single new-style cast works for every conversion to/from int64_t, so we
-// need this helper class. A third specialization is needed for bool because
-// MSVC warning C4800 (forcing value to bool) is not suppressed by an explicit
-// cast (!).
-template <typename T>
-class WindowPropertyCaster {
- public:
- static int64_t ToInt64(T x) { return static_cast<int64_t>(x); }
- static T FromInt64(int64_t x) { return static_cast<T>(x); }
-};
-template <typename T>
-class WindowPropertyCaster<T*> {
- public:
- static int64_t ToInt64(T* x) { return reinterpret_cast<int64_t>(x); }
- static T* FromInt64(int64_t x) { return reinterpret_cast<T*>(x); }
-};
-template <>
-class WindowPropertyCaster<bool> {
- public:
- static int64_t ToInt64(bool x) { return static_cast<int64_t>(x); }
- static bool FromInt64(int64_t x) { return x != 0; }
-};
-
-} // namespace
-
-template <typename T>
-struct WindowProperty {
- T default_value;
- const char* name;
- Window::PropertyDeallocator deallocator;
-};
-
-template <typename T>
-void Window::SetLocalProperty(const WindowProperty<T>* property, T value) {
- int64_t old = SetLocalPropertyInternal(
- property, property->name,
- value == property->default_value ? nullptr : property->deallocator,
- WindowPropertyCaster<T>::ToInt64(value),
- WindowPropertyCaster<T>::ToInt64(property->default_value));
- if (property->deallocator &&
- old != WindowPropertyCaster<T>::ToInt64(property->default_value)) {
- (*property->deallocator)(old);
- }
-}
-
-template <typename T>
-T Window::GetLocalProperty(const WindowProperty<T>* property) const {
- return WindowPropertyCaster<T>::FromInt64(GetLocalPropertyInternal(
- property, WindowPropertyCaster<T>::ToInt64(property->default_value)));
-}
-
-template <typename T>
-void Window::ClearLocalProperty(const WindowProperty<T>* property) {
- SetLocalProperty(property, property->default_value);
-}
-
-} // namespace mus
-
-// Macros to instantiate the property getter/setter template functions.
-#define MUS_DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(EXPORT, T) \
- template EXPORT void mus::Window::SetLocalProperty( \
- const mus::WindowProperty<T>*, T); \
- template EXPORT T mus::Window::GetLocalProperty( \
- const mus::WindowProperty<T>*) const; \
- template EXPORT void mus::Window::ClearLocalProperty( \
- const mus::WindowProperty<T>*);
-#define MUS_DECLARE_WINDOW_PROPERTY_TYPE(T) \
- MUS_DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(, T)
-
-#define MUS_DEFINE_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \
- static_assert(sizeof(TYPE) <= sizeof(int64_t), \
- "Property type must fit in 64 bits"); \
- namespace { \
- const mus::WindowProperty<TYPE> NAME##_Value = {DEFAULT, #NAME, nullptr}; \
- } \
- const mus::WindowProperty<TYPE>* const NAME = &NAME##_Value;
-
-#define MUS_DEFINE_LOCAL_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \
- static_assert(sizeof(TYPE) <= sizeof(int64_t), \
- "Property type must fit in 64 bits"); \
- namespace { \
- const mus::WindowProperty<TYPE> NAME##_Value = {DEFAULT, #NAME, nullptr}; \
- const mus::WindowProperty<TYPE>* const NAME = &NAME##_Value; \
- }
-
-#define MUS_DEFINE_OWNED_WINDOW_PROPERTY_KEY(TYPE, NAME, DEFAULT) \
- namespace { \
- void Deallocator##NAME(int64_t p) { \
- enum { type_must_be_complete = sizeof(TYPE) }; \
- delete mus::WindowPropertyCaster<TYPE*>::FromInt64(p); \
- } \
- const mus::WindowProperty<TYPE*> NAME##_Value = {DEFAULT, #NAME, \
- &Deallocator##NAME}; \
- } \
- const mus::WindowProperty<TYPE*>* const NAME = &NAME##_Value;
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_PROPERTY_H_
diff --git a/chromium/components/mus/public/cpp/window_surface.h b/chromium/components/mus/public/cpp/window_surface.h
deleted file mode 100644
index 97af8123d61..00000000000
--- a/chromium/components/mus/public/cpp/window_surface.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_
-
-#include <memory>
-
-#include "base/callback.h"
-#include "base/macros.h"
-#include "base/observer_list.h"
-#include "base/threading/thread_checker.h"
-#include "components/mus/public/interfaces/surface.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "mojo/public/cpp/bindings/interface_ptr_info.h"
-
-namespace mus {
-
-class WindowSurfaceBinding;
-class WindowSurfaceClient;
-class Window;
-
-// A WindowSurface is wrapper to simplify submitting CompositorFrames to
-// Windows, and receiving ReturnedResources.
-class WindowSurface : public mojom::SurfaceClient {
- public:
- // static
- static std::unique_ptr<WindowSurface> Create(
- std::unique_ptr<WindowSurfaceBinding>* surface_binding);
-
- ~WindowSurface() override;
-
- // Called to indicate that the current thread has assumed control of this
- // object.
- void BindToThread();
-
- void SubmitCompositorFrame(cc::CompositorFrame frame,
- const base::Closure& callback);
-
- void set_client(WindowSurfaceClient* client) { client_ = client; }
-
- private:
- friend class Window;
-
- WindowSurface(mojo::InterfacePtrInfo<mojom::Surface> surface_info,
- mojo::InterfaceRequest<mojom::SurfaceClient> client_request);
-
- // SurfaceClient implementation:
- void ReturnResources(mojo::Array<cc::ReturnedResource> resources) override;
-
- WindowSurfaceClient* client_;
- mojo::InterfacePtrInfo<mojom::Surface> surface_info_;
- mojo::InterfaceRequest<mojom::SurfaceClient> client_request_;
- mojom::SurfacePtr surface_;
- std::unique_ptr<mojo::Binding<mojom::SurfaceClient>> client_binding_;
- std::unique_ptr<base::ThreadChecker> thread_checker_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowSurface);
-};
-
-// A WindowSurfaceBinding is a bundle of mojo interfaces that are to be used by
-// or implemented by the Mus window server when passed into
-// Window::AttachSurface. WindowSurfaceBinding has no standalone functionality.
-class WindowSurfaceBinding {
- public:
- ~WindowSurfaceBinding();
-
- private:
- friend class WindowSurface;
- friend class Window;
-
- WindowSurfaceBinding(
- mojo::InterfaceRequest<mojom::Surface> surface_request,
- mojo::InterfacePtrInfo<mojom::SurfaceClient> surface_client);
-
- mojo::InterfaceRequest<mojom::Surface> surface_request_;
- mojo::InterfacePtrInfo<mojom::SurfaceClient> surface_client_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowSurfaceBinding);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_H_
diff --git a/chromium/components/mus/public/cpp/window_surface_client.h b/chromium/components/mus/public/cpp/window_surface_client.h
deleted file mode 100644
index 1208d2028f2..00000000000
--- a/chromium/components/mus/public/cpp/window_surface_client.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_CLIENT_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_CLIENT_H_
-
-namespace mus {
-
-class WindowSurface;
-
-class WindowSurfaceClient {
- public:
- virtual void OnResourcesReturned(
- WindowSurface* surface,
- mojo::Array<cc::ReturnedResource> resources) = 0;
-
- protected:
- virtual ~WindowSurfaceClient() {}
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_SURFACE_CLIENT_H_
diff --git a/chromium/components/mus/public/cpp/window_tracker.h b/chromium/components/mus/public/cpp/window_tracker.h
deleted file mode 100644
index db277531495..00000000000
--- a/chromium/components/mus/public/cpp/window_tracker.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TRACKER_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TRACKER_H_
-
-#include <stdint.h>
-#include <set>
-
-#include "base/macros.h"
-#include "components/mus/public/cpp/window_observer.h"
-#include "ui/base/window_tracker_template.h"
-
-namespace mus {
-
-using WindowTracker = ui::WindowTrackerTemplate<Window, WindowObserver>;
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TRACKER_H_
diff --git a/chromium/components/mus/public/cpp/window_tree_client.h b/chromium/components/mus/public/cpp/window_tree_client.h
deleted file mode 100644
index 24ef564f3f5..00000000000
--- a/chromium/components/mus/public/cpp/window_tree_client.h
+++ /dev/null
@@ -1,407 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_
-
-#include <stdint.h>
-
-#include <map>
-#include <set>
-#include <string>
-#include <vector>
-
-#include "base/atomicops.h"
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "base/observer_list.h"
-#include "components/mus/common/types.h"
-#include "components/mus/public/cpp/window.h"
-#include "components/mus/public/cpp/window_manager_delegate.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "mojo/public/cpp/bindings/associated_binding.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-
-namespace display {
-class Display;
-}
-
-namespace gfx {
-class Insets;
-class Size;
-}
-
-namespace shell {
-class Connector;
-}
-
-namespace mus {
-class InFlightChange;
-class WindowTreeClientDelegate;
-class WindowTreeClientPrivate;
-class WindowTreeClientObserver;
-enum class ChangeType;
-
-// Manages the connection with mus.
-//
-// WindowTreeClient is deleted by any of the following:
-// . If all the roots of the connection are destroyed and the connection is
-// configured to delete when there are no roots (true if the WindowTreeClient
-// is created with a mojom::WindowTreeClientRequest). This happens
-// if the owner of the roots Embed()s another app in all the roots, or all
-// the roots are explicitly deleted.
-// . The connection to mus is lost.
-// . Explicitly by way of calling delete.
-//
-// When WindowTreeClient is deleted all windows are deleted (and observers
-// notified). This is followed by calling
-// WindowTreeClientDelegate::OnWindowTreeClientDestroyed().
-class WindowTreeClient : public mojom::WindowTreeClient,
- public mojom::WindowManager,
- public WindowManagerClient {
- public:
- WindowTreeClient(WindowTreeClientDelegate* delegate,
- WindowManagerDelegate* window_manager_delegate,
- mojom::WindowTreeClientRequest request);
- ~WindowTreeClient() override;
-
- // Establishes the connection by way of the WindowTreeFactory.
- void ConnectViaWindowTreeFactory(shell::Connector* connector);
-
- // Establishes the connection by way of WindowManagerWindowTreeFactory.
- void ConnectAsWindowManager(shell::Connector* connector);
-
- // Wait for OnEmbed(), returning when done.
- void WaitForEmbed();
-
- bool connected() const { return tree_ != nullptr; }
- ClientSpecificId client_id() const { return client_id_; }
-
- // API exposed to the window implementations that pushes local changes to the
- // service.
- void DestroyWindow(Window* window);
-
- // These methods take TransportIds. For windows owned by the current client,
- // the client id high word can be zero. In all cases, the TransportId 0x1
- // refers to the root window.
- void AddChild(Window* parent, Id child_id);
- void RemoveChild(Window* parent, Id child_id);
-
- void AddTransientWindow(Window* window, Id transient_window_id);
- void RemoveTransientWindowFromParent(Window* window);
-
- void SetModal(Window* window);
-
- void Reorder(Window* window,
- Id relative_window_id,
- mojom::OrderDirection direction);
-
- // Returns true if the specified window was created by this client.
- bool OwnsWindow(Window* window) const;
-
- void SetBounds(Window* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& bounds);
- void SetCapture(Window* window);
- void ReleaseCapture(Window* window);
- void SetClientArea(Id window_id,
- const gfx::Insets& client_area,
- const std::vector<gfx::Rect>& additional_client_areas);
- void SetHitTestMask(Id window_id, const gfx::Rect& mask);
- void ClearHitTestMask(Id window_id);
- void SetFocus(Window* window);
- void SetCanFocus(Id window_id, bool can_focus);
- void SetPredefinedCursor(Id window_id, mus::mojom::Cursor cursor_id);
- void SetVisible(Window* window, bool visible);
- void SetOpacity(Window* window, float opacity);
- void SetProperty(Window* window,
- const std::string& name,
- mojo::Array<uint8_t> data);
- void SetWindowTextInputState(Id window_id, mojo::TextInputStatePtr state);
- void SetImeVisibility(Id window_id,
- bool visible,
- mojo::TextInputStatePtr state);
-
- void Embed(Id window_id,
- mojom::WindowTreeClientPtr client,
- uint32_t flags,
- const mojom::WindowTree::EmbedCallback& callback);
-
- void RequestClose(Window* window);
-
- void AttachSurface(Id window_id,
- mojom::SurfaceType type,
- mojo::InterfaceRequest<mojom::Surface> surface,
- mojom::SurfaceClientPtr client);
-
- // Sets the input capture to |window| without notifying the server.
- void LocalSetCapture(Window* window);
- // Sets focus to |window| without notifying the server.
- void LocalSetFocus(Window* window);
-
- // Start/stop tracking windows. While tracked, they can be retrieved via
- // WindowTreeClient::GetWindowById.
- void AddWindow(Window* window);
-
- bool IsRoot(Window* window) const { return roots_.count(window) > 0; }
-
- void OnWindowDestroying(Window* window);
-
- // Called after the window's observers have been notified of destruction (as
- // the last step of ~Window).
- void OnWindowDestroyed(Window* window);
-
- Window* GetWindowByServerId(Id id);
-
- // Sets whether this is deleted when there are no roots. The default is to
- // delete when there are no roots.
- void SetDeleteOnNoRoots(bool value);
-
- // Returns the root of this connection.
- const std::set<Window*>& GetRoots();
-
- // Returns the Window with input capture; null if no window has requested
- // input capture, or if another app has capture.
- Window* GetCaptureWindow();
-
- // Returns the focused window; null if focus is not yet known or another app
- // is focused.
- Window* GetFocusedWindow();
-
- // Sets focus to null. This does nothing if focus is currently null.
- void ClearFocus();
-
- // Returns the current location of the mouse on screen. Note: this method may
- // race the asynchronous initialization; but in that case we return (0, 0).
- gfx::Point GetCursorScreenPoint();
-
- // See description in window_tree.mojom. When an existing event observer is
- // updated or cleared then any future events from the server for that observer
- // will be ignored.
- void SetEventObserver(mojom::EventMatcherPtr matcher);
-
- // Creates and returns a new Window (which is owned by the window server).
- // Windows are initially hidden, use SetVisible(true) to show.
- Window* NewWindow() { return NewWindow(nullptr); }
- Window* NewWindow(
- const std::map<std::string, std::vector<uint8_t>>* properties);
- Window* NewTopLevelWindow(
- const std::map<std::string, std::vector<uint8_t>>* properties);
-
- void AddObserver(WindowTreeClientObserver* observer);
- void RemoveObserver(WindowTreeClientObserver* observer);
-
-#if !defined(NDEBUG)
- std::string GetDebugWindowHierarchy() const;
- void BuildDebugInfo(const std::string& depth,
- Window* window,
- std::string* result) const;
-#endif
-
- private:
- friend class WindowTreeClientPrivate;
-
- enum class NewWindowType {
- CHILD,
- TOP_LEVEL,
- };
-
- using IdToWindowMap = std::map<Id, Window*>;
-
- // TODO(sky): this assumes change_ids never wrap, which is a bad assumption.
- using InFlightMap = std::map<uint32_t, std::unique_ptr<InFlightChange>>;
-
- // Returns the oldest InFlightChange that matches |change|.
- InFlightChange* GetOldestInFlightChangeMatching(const InFlightChange& change);
-
- // See InFlightChange for details on how InFlightChanges are used.
- uint32_t ScheduleInFlightChange(std::unique_ptr<InFlightChange> change);
-
- // Returns true if there is an InFlightChange that matches |change|. If there
- // is an existing change SetRevertValueFrom() is invoked on it. Returns false
- // if there is no InFlightChange matching |change|.
- // See InFlightChange for details on how InFlightChanges are used.
- bool ApplyServerChangeToExistingInFlightChange(const InFlightChange& change);
-
- Window* NewWindowImpl(NewWindowType type,
- const Window::SharedProperties* properties);
-
- // Sets the mojom::WindowTree implementation.
- void SetWindowTree(mojom::WindowTreePtr window_tree_ptr);
-
- // Called when the mojom::WindowTree connection is lost, deletes this.
- void OnConnectionLost();
-
- // OnEmbed() calls into this. Exposed as a separate function for testing.
- void OnEmbedImpl(mojom::WindowTree* window_tree,
- ClientSpecificId client_id,
- mojom::WindowDataPtr root_data,
- int64_t display_id,
- Id focused_window_id,
- bool drawn);
-
- // Called by WmNewDisplayAdded().
- void WmNewDisplayAddedImpl(const display::Display& display,
- mojom::WindowDataPtr root_data,
- bool parent_drawn);
-
- void OnReceivedCursorLocationMemory(mojo::ScopedSharedBufferHandle handle);
-
- // Overridden from WindowTreeClient:
- void OnEmbed(ClientSpecificId client_id,
- mojom::WindowDataPtr root,
- mojom::WindowTreePtr tree,
- int64_t display_id,
- Id focused_window_id,
- bool drawn) override;
- void OnEmbeddedAppDisconnected(Id window_id) override;
- void OnUnembed(Id window_id) override;
- void OnLostCapture(Id window_id) override;
- void OnTopLevelCreated(uint32_t change_id,
- mojom::WindowDataPtr data,
- int64_t display_id,
- bool drawn) override;
- void OnWindowBoundsChanged(Id window_id,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) override;
- void OnClientAreaChanged(
- uint32_t window_id,
- const gfx::Insets& new_client_area,
- mojo::Array<gfx::Rect> new_additional_client_areas) override;
- void OnTransientWindowAdded(uint32_t window_id,
- uint32_t transient_window_id) override;
- void OnTransientWindowRemoved(uint32_t window_id,
- uint32_t transient_window_id) override;
- void OnWindowHierarchyChanged(
- Id window_id,
- Id old_parent_id,
- Id new_parent_id,
- mojo::Array<mojom::WindowDataPtr> windows) override;
- void OnWindowReordered(Id window_id,
- Id relative_window_id,
- mojom::OrderDirection direction) override;
- void OnWindowDeleted(Id window_id) override;
- void OnWindowVisibilityChanged(Id window_id, bool visible) override;
- void OnWindowOpacityChanged(Id window_id,
- float old_opacity,
- float new_opacity) override;
- void OnWindowParentDrawnStateChanged(Id window_id, bool drawn) override;
- void OnWindowSharedPropertyChanged(Id window_id,
- const mojo::String& name,
- mojo::Array<uint8_t> new_data) override;
- void OnWindowInputEvent(uint32_t event_id,
- Id window_id,
- std::unique_ptr<ui::Event> event,
- uint32_t event_observer_id) override;
- void OnEventObserved(std::unique_ptr<ui::Event> event,
- uint32_t event_observer_id) override;
- void OnWindowFocused(Id focused_window_id) override;
- void OnWindowPredefinedCursorChanged(Id window_id,
- mojom::Cursor cursor) override;
- void OnChangeCompleted(uint32_t change_id, bool success) override;
- void RequestClose(uint32_t window_id) override;
- void GetWindowManager(
- mojo::AssociatedInterfaceRequest<WindowManager> internal) override;
-
- // Overridden from WindowManager:
- void OnConnect(ClientSpecificId client_id) override;
- void WmNewDisplayAdded(mojom::DisplayPtr display,
- mojom::WindowDataPtr root_data,
- bool parent_drawn) override;
- void WmSetBounds(uint32_t change_id,
- Id window_id,
- const gfx::Rect& transit_bounds) override;
- void WmSetProperty(uint32_t change_id,
- Id window_id,
- const mojo::String& name,
- mojo::Array<uint8_t> transit_data) override;
- void WmCreateTopLevelWindow(uint32_t change_id,
- ClientSpecificId requesting_client_id,
- mojo::Map<mojo::String, mojo::Array<uint8_t>>
- transport_properties) override;
- void WmClientJankinessChanged(ClientSpecificId client_id,
- bool janky) override;
- void OnAccelerator(uint32_t id, std::unique_ptr<ui::Event> event) override;
-
- // Overridden from WindowManagerClient:
- void SetFrameDecorationValues(
- mojom::FrameDecorationValuesPtr values) override;
- void SetNonClientCursor(Window* window,
- mus::mojom::Cursor cursor_id) override;
- void AddAccelerator(uint32_t id,
- mojom::EventMatcherPtr event_matcher,
- const base::Callback<void(bool)>& callback) override;
- void RemoveAccelerator(uint32_t id) override;
- void AddActivationParent(Window* window) override;
- void RemoveActivationParent(Window* window) override;
- void ActivateNextWindow() override;
- void SetUnderlaySurfaceOffsetAndExtendedHitArea(
- Window* window,
- const gfx::Vector2d& offset,
- const gfx::Insets& hit_area) override;
-
- // The one int in |cursor_location_mapping_|. When we read from this
- // location, we must always read from it atomically.
- base::subtle::Atomic32* cursor_location_memory() {
- return reinterpret_cast<base::subtle::Atomic32*>(
- cursor_location_mapping_.get());
- }
-
- // This is set once and only once when we get OnEmbed(). It gives the unique
- // id for this client.
- ClientSpecificId client_id_;
-
- // Id assigned to the next window created.
- ClientSpecificId next_window_id_;
-
- // Id used for the next change id supplied to the server.
- uint32_t next_change_id_;
- InFlightMap in_flight_map_;
-
- WindowTreeClientDelegate* delegate_;
-
- WindowManagerDelegate* window_manager_delegate_;
-
- std::set<Window*> roots_;
-
- IdToWindowMap windows_;
- std::map<ClientSpecificId, std::set<Window*>> embedded_windows_;
-
- Window* capture_window_;
-
- Window* focused_window_;
-
- mojo::Binding<mojom::WindowTreeClient> binding_;
- mojom::WindowTreePtr tree_ptr_;
- // Typically this is the value contained in |tree_ptr_|, but tests may
- // directly set this.
- mojom::WindowTree* tree_;
-
- bool delete_on_no_roots_;
-
- bool in_destructor_;
-
- // A mapping to shared memory that is one 32 bit integer long. The window
- // server uses this to let us synchronously read the cursor location.
- mojo::ScopedSharedBufferMapping cursor_location_mapping_;
-
- base::ObserverList<WindowTreeClientObserver> observers_;
-
- std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>>
- window_manager_internal_;
- mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_;
-
- bool has_event_observer_ = false;
-
- // Monotonically increasing ID for event observers.
- uint32_t event_observer_id_ = 0u;
-
- base::WeakPtrFactory<WindowTreeClient> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowTreeClient);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_H_
diff --git a/chromium/components/mus/public/cpp/window_tree_client_delegate.h b/chromium/components/mus/public/cpp/window_tree_client_delegate.h
deleted file mode 100644
index 41f09dfdbf0..00000000000
--- a/chromium/components/mus/public/cpp/window_tree_client_delegate.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_DELEGATE_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_DELEGATE_H_
-
-#include <string>
-
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "services/shell/public/interfaces/interface_provider.mojom.h"
-
-namespace ui {
-class Event;
-}
-
-namespace mus {
-
-class Window;
-class WindowTreeClient;
-
-// Interface implemented by an application using mus.
-class WindowTreeClientDelegate {
- public:
- // Called when the application implementing this interface is embedded at
- // |root|.
- // NOTE: this is only invoked if the WindowTreeClient is created with an
- // InterfaceRequest.
- virtual void OnEmbed(Window* root) = 0;
-
- // Sent when another app is embedded in |root| (one of the roots of the
- // connection). Afer this call |root| is deleted. If |root| is the only root
- // and the connection is configured to delete when there are no roots (the
- // default), then after |root| is destroyed the connection is destroyed as
- // well.
- virtual void OnUnembed(Window* root);
-
- // Called from the destructor of WindowTreeClient after all the Windows have
- // been destroyed. |client| is no longer valid after this call.
- virtual void OnWindowTreeClientDestroyed(WindowTreeClient* client) = 0;
-
- // Called when the WindowTreeClient receives an input event observed via
- // SetEventObserver(). |target| may be null for events that were sent to
- // windows owned by other processes.
- virtual void OnEventObserved(const ui::Event& event, Window* target) = 0;
-
- protected:
- virtual ~WindowTreeClientDelegate() {}
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_DELEGATE_H_
diff --git a/chromium/components/mus/public/cpp/window_tree_client_observer.h b/chromium/components/mus/public/cpp/window_tree_client_observer.h
deleted file mode 100644
index 394a5cea1e1..00000000000
--- a/chromium/components/mus/public/cpp/window_tree_client_observer.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_OBSERVER_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_OBSERVER_H_
-
-namespace mus {
-
-class Window;
-class WindowTreeClient;
-
-class WindowTreeClientObserver {
- public:
- virtual void OnWindowTreeFocusChanged(Window* gained_focus,
- Window* lost_focus) {}
-
- // Called right before the client is destroyed.
- virtual void OnWillDestroyClient(WindowTreeClient* client) {}
-
- protected:
- virtual ~WindowTreeClientObserver() {}
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_CLIENT_OBSERVER_H_
diff --git a/chromium/components/mus/public/cpp/window_tree_host_factory.h b/chromium/components/mus/public/cpp/window_tree_host_factory.h
deleted file mode 100644
index 75661af89d6..00000000000
--- a/chromium/components/mus/public/cpp/window_tree_host_factory.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_HOST_FACTORY_H_
-#define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_HOST_FACTORY_H_
-
-#include <memory>
-
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/public/interfaces/window_tree_host.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
-
-namespace shell {
-class Connector;
-}
-
-namespace mus {
-
-class WindowManagerDelegate;
-class WindowTreeClientDelegate;
-
-// The following create a new window tree host. Supply a |factory| if you have
-// already connected to mus, otherwise supply |shell|, which contacts mus and
-// obtains a WindowTreeHostFactory.
-void CreateWindowTreeHost(mojom::WindowTreeHostFactory* factory,
- WindowTreeClientDelegate* delegate,
- mojom::WindowTreeHostPtr* host,
- WindowManagerDelegate* window_manager_delegate);
-void CreateWindowTreeHost(shell::Connector* connector,
- WindowTreeClientDelegate* delegate,
- mojom::WindowTreeHostPtr* host,
- WindowManagerDelegate* window_manager_delegate);
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_TREE_HOST_FACTORY_H_
diff --git a/chromium/components/mus/public/interfaces/OWNERS b/chromium/components/mus/public/interfaces/OWNERS
deleted file mode 100644
index 08850f42120..00000000000
--- a/chromium/components/mus/public/interfaces/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-per-file *.mojom=set noparent
-per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/chromium/components/mus/public/interfaces/gpu/OWNERS b/chromium/components/mus/public/interfaces/gpu/OWNERS
deleted file mode 100644
index 08850f42120..00000000000
--- a/chromium/components/mus/public/interfaces/gpu/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-per-file *.mojom=set noparent
-per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/chromium/components/mus/surfaces/DEPS b/chromium/components/mus/surfaces/DEPS
deleted file mode 100644
index e21114ea1d7..00000000000
--- a/chromium/components/mus/surfaces/DEPS
+++ /dev/null
@@ -1,10 +0,0 @@
-include_rules = [
- "+cc",
- "+components/display_compositor",
- "+components/gpu",
- "+gpu",
- "+services/shell",
- "+mojo/common",
- "+mojo/converters",
- "+mojo/public",
-]
diff --git a/chromium/components/mus/surfaces/OWNERS b/chromium/components/mus/surfaces/OWNERS
deleted file mode 100644
index 1f1af6bcc54..00000000000
--- a/chromium/components/mus/surfaces/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-fsamuel@chromium.org
-rjkroege@chromium.org
diff --git a/chromium/components/mus/surfaces/direct_output_surface.cc b/chromium/components/mus/surfaces/direct_output_surface.cc
deleted file mode 100644
index 7c7bc55f4c9..00000000000
--- a/chromium/components/mus/surfaces/direct_output_surface.cc
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/surfaces/direct_output_surface.h"
-
-#include <stdint.h>
-
-#include "base/bind.h"
-#include "base/memory/ptr_util.h"
-#include "cc/output/compositor_frame.h"
-#include "cc/output/context_provider.h"
-#include "cc/output/output_surface_client.h"
-#include "cc/scheduler/begin_frame_source.h"
-#include "gpu/command_buffer/client/context_support.h"
-#include "gpu/command_buffer/client/gles2_interface.h"
-
-namespace mus {
-
-DirectOutputSurface::DirectOutputSurface(
- scoped_refptr<SurfacesContextProvider> context_provider,
- cc::SyntheticBeginFrameSource* synthetic_begin_frame_source)
- : cc::OutputSurface(context_provider, nullptr, nullptr),
- synthetic_begin_frame_source_(synthetic_begin_frame_source),
- weak_ptr_factory_(this) {
- context_provider->SetDelegate(this);
-}
-
-DirectOutputSurface::~DirectOutputSurface() = default;
-
-bool DirectOutputSurface::BindToClient(cc::OutputSurfaceClient* client) {
- if (!cc::OutputSurface::BindToClient(client))
- return false;
-
- if (capabilities_.uses_default_gl_framebuffer) {
- capabilities_.flipped_output_surface =
- context_provider()->ContextCapabilities().flips_vertically;
- }
- return true;
-}
-
-void DirectOutputSurface::OnVSyncParametersUpdated(
- const base::TimeTicks& timebase,
- const base::TimeDelta& interval) {
- // TODO(brianderson): We should not be receiving 0 intervals.
- synthetic_begin_frame_source_->OnUpdateVSyncParameters(
- timebase,
- interval.is_zero() ? cc::BeginFrameArgs::DefaultInterval() : interval);
-}
-
-void DirectOutputSurface::SwapBuffers(cc::CompositorFrame frame) {
- DCHECK(context_provider_);
- DCHECK(frame.gl_frame_data);
- if (frame.gl_frame_data->sub_buffer_rect ==
- gfx::Rect(frame.gl_frame_data->size)) {
- context_provider_->ContextSupport()->Swap();
- } else {
- context_provider_->ContextSupport()->PartialSwapBuffers(
- frame.gl_frame_data->sub_buffer_rect);
- }
-
- gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
- const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM();
- gl->ShallowFlushCHROMIUM();
-
- gpu::SyncToken sync_token;
- gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
-
- context_provider_->ContextSupport()->SignalSyncToken(
- sync_token, base::Bind(&OutputSurface::OnSwapBuffersComplete,
- weak_ptr_factory_.GetWeakPtr()));
- client_->DidSwapBuffers();
-}
-
-uint32_t DirectOutputSurface::GetFramebufferCopyTextureFormat() {
- // TODO(danakj): What attributes are used for the default framebuffer here?
- // Can it have alpha? SurfacesContextProvider doesn't take any attributes.
- return GL_RGB;
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/surfaces/direct_output_surface.h b/chromium/components/mus/surfaces/direct_output_surface.h
deleted file mode 100644
index 6e08485cfbb..00000000000
--- a/chromium/components/mus/surfaces/direct_output_surface.h
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_H_
-#define COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_H_
-
-#include <memory>
-
-#include "cc/output/output_surface.h"
-#include "components/mus/surfaces/surfaces_context_provider.h"
-#include "components/mus/surfaces/surfaces_context_provider_delegate.h"
-
-namespace cc {
-class CompositorFrame;
-class SyntheticBeginFrameSource;
-}
-
-namespace mus {
-
-// An OutputSurface implementation that directly draws and
-// swaps to an actual GL surface.
-class DirectOutputSurface : public cc::OutputSurface,
- public SurfacesContextProviderDelegate {
- public:
- explicit DirectOutputSurface(
- scoped_refptr<SurfacesContextProvider> context_provider,
- cc::SyntheticBeginFrameSource* synthetic_begin_frame_source);
- ~DirectOutputSurface() override;
-
- // cc::OutputSurface implementation
- bool BindToClient(cc::OutputSurfaceClient* client) override;
- void SwapBuffers(cc::CompositorFrame frame) override;
- uint32_t GetFramebufferCopyTextureFormat() override;
-
- // SurfacesContextProviderDelegate implementation
- void OnVSyncParametersUpdated(const base::TimeTicks& timebase,
- const base::TimeDelta& interval) override;
-
- private:
- cc::SyntheticBeginFrameSource* const synthetic_begin_frame_source_;
- base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_;
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_H_
diff --git a/chromium/components/mus/surfaces/direct_output_surface_ozone.cc b/chromium/components/mus/surfaces/direct_output_surface_ozone.cc
deleted file mode 100644
index 5148336078a..00000000000
--- a/chromium/components/mus/surfaces/direct_output_surface_ozone.cc
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/surfaces/direct_output_surface_ozone.h"
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/memory/ptr_util.h"
-#include "cc/output/compositor_frame.h"
-#include "cc/output/context_provider.h"
-#include "cc/output/output_surface_client.h"
-#include "cc/scheduler/begin_frame_source.h"
-#include "components/display_compositor/buffer_queue.h"
-#include "components/mus/common/gpu_service.h"
-#include "components/mus/common/mojo_gpu_memory_buffer_manager.h"
-#include "components/mus/gpu/mus_gpu_memory_buffer_manager.h"
-#include "components/mus/surfaces/surfaces_context_provider.h"
-#include "gpu/command_buffer/client/context_support.h"
-#include "gpu/command_buffer/client/gles2_interface.h"
-
-using display_compositor::BufferQueue;
-
-namespace mus {
-
-DirectOutputSurfaceOzone::DirectOutputSurfaceOzone(
- scoped_refptr<SurfacesContextProvider> context_provider,
- gfx::AcceleratedWidget widget,
- cc::SyntheticBeginFrameSource* synthetic_begin_frame_source,
- uint32_t target,
- uint32_t internalformat)
- : cc::OutputSurface(context_provider, nullptr, nullptr),
- gl_helper_(context_provider->ContextGL(),
- context_provider->ContextSupport()),
- synthetic_begin_frame_source_(synthetic_begin_frame_source),
- weak_ptr_factory_(this) {
- if (!GpuService::UseChromeGpuCommandBuffer()) {
- ozone_gpu_memory_buffer_manager_.reset(new OzoneGpuMemoryBufferManager());
- buffer_queue_.reset(new BufferQueue(
- context_provider->ContextGL(), target, internalformat, &gl_helper_,
- ozone_gpu_memory_buffer_manager_.get(), widget));
- } else {
- buffer_queue_.reset(new BufferQueue(
- context_provider->ContextGL(), target, internalformat, &gl_helper_,
- MusGpuMemoryBufferManager::current(), widget));
- }
-
- capabilities_.uses_default_gl_framebuffer = false;
- capabilities_.flipped_output_surface = true;
- // Set |max_frames_pending| to 2 for surfaceless, which aligns scheduling
- // more closely with the previous surfaced behavior.
- // With a surface, swap buffer ack used to return early, before actually
- // presenting the back buffer, enabling the browser compositor to run ahead.
- // Surfaceless implementation acks at the time of actual buffer swap, which
- // shifts the start of the new frame forward relative to the old
- // implementation.
- capabilities_.max_frames_pending = 2;
-
- buffer_queue_->Initialize();
-
- context_provider->SetSwapBuffersCompletionCallback(
- base::Bind(&DirectOutputSurfaceOzone::OnGpuSwapBuffersCompleted,
- base::Unretained(this)));
-}
-
-DirectOutputSurfaceOzone::~DirectOutputSurfaceOzone() {
- // TODO(rjkroege): Support cleanup.
-}
-
-bool DirectOutputSurfaceOzone::IsDisplayedAsOverlayPlane() const {
- // TODO(rjkroege): implement remaining overlay functionality.
- return true;
-}
-
-unsigned DirectOutputSurfaceOzone::GetOverlayTextureId() const {
- DCHECK(buffer_queue_);
- return buffer_queue_->current_texture_id();
-}
-
-void DirectOutputSurfaceOzone::SwapBuffers(cc::CompositorFrame frame) {
- DCHECK(buffer_queue_);
- DCHECK(frame.gl_frame_data);
-
- buffer_queue_->SwapBuffers(frame.gl_frame_data->sub_buffer_rect);
-
- // Code combining GpuBrowserCompositorOutputSurface + DirectOutputSurface
- if (frame.gl_frame_data->sub_buffer_rect ==
- gfx::Rect(frame.gl_frame_data->size)) {
- context_provider_->ContextSupport()->Swap();
- } else {
- context_provider_->ContextSupport()->PartialSwapBuffers(
- frame.gl_frame_data->sub_buffer_rect);
- }
-
- gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL();
- const GLuint64 fence_sync = gl->InsertFenceSyncCHROMIUM();
- gl->ShallowFlushCHROMIUM();
-
- gpu::SyncToken sync_token;
- gl->GenUnverifiedSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
-
- client_->DidSwapBuffers();
-}
-
-bool DirectOutputSurfaceOzone::BindToClient(cc::OutputSurfaceClient* client) {
- if (!cc::OutputSurface::BindToClient(client))
- return false;
-
- if (capabilities_.uses_default_gl_framebuffer) {
- capabilities_.flipped_output_surface =
- context_provider()->ContextCapabilities().flips_vertically;
- }
- return true;
-}
-
-void DirectOutputSurfaceOzone::OnUpdateVSyncParametersFromGpu(
- base::TimeTicks timebase,
- base::TimeDelta interval) {
- DCHECK(HasClient());
- synthetic_begin_frame_source_->OnUpdateVSyncParameters(timebase, interval);
-}
-
-void DirectOutputSurfaceOzone::OnGpuSwapBuffersCompleted(
- gfx::SwapResult result) {
- DCHECK(buffer_queue_);
- bool force_swap = false;
- if (result == gfx::SwapResult::SWAP_NAK_RECREATE_BUFFERS) {
- // Even through the swap failed, this is a fixable error so we can pretend
- // it succeeded to the rest of the system.
- result = gfx::SwapResult::SWAP_ACK;
- buffer_queue_->RecreateBuffers();
- force_swap = true;
- }
-
- buffer_queue_->PageFlipComplete();
- OnSwapBuffersComplete();
-
- if (force_swap)
- client_->SetNeedsRedrawRect(gfx::Rect(SurfaceSize()));
-}
-
-void DirectOutputSurfaceOzone::BindFramebuffer() {
- DCHECK(buffer_queue_);
- buffer_queue_->BindFramebuffer();
-}
-
-uint32_t DirectOutputSurfaceOzone::GetFramebufferCopyTextureFormat() {
- return buffer_queue_->internal_format();
-}
-
-// We call this on every frame but changing the size once we've allocated
-// backing NativePixmapOzone instances will cause a DCHECK because
-// Chrome never Reshape(s) after the first one from (0,0). NB: this implies
-// that screen size changes need to be plumbed differently. In particular, we
-// must create the native window in the size that the hardware reports.
-void DirectOutputSurfaceOzone::Reshape(const gfx::Size& size,
- float scale_factor,
- const gfx::ColorSpace& color_space,
- bool alpha) {
- OutputSurface::Reshape(size, scale_factor, color_space, alpha);
- DCHECK(buffer_queue_);
- buffer_queue_->Reshape(SurfaceSize(), scale_factor);
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/surfaces/direct_output_surface_ozone.h b/chromium/components/mus/surfaces/direct_output_surface_ozone.h
deleted file mode 100644
index 8f6f4e4bb76..00000000000
--- a/chromium/components/mus/surfaces/direct_output_surface_ozone.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_
-#define COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_
-
-#include <memory>
-
-#include "base/memory/weak_ptr.h"
-#include "cc/output/context_provider.h"
-#include "cc/output/output_surface.h"
-#include "components/display_compositor/gl_helper.h"
-#include "components/mus/surfaces/ozone_gpu_memory_buffer_manager.h"
-#include "ui/gfx/geometry/size.h"
-#include "ui/gfx/native_widget_types.h"
-#include "ui/gfx/swap_result.h"
-#include "ui/gl/gl_surface.h"
-
-namespace display_compositor {
-class BufferQueue;
-}
-
-namespace ui {
-class LatencyInfo;
-} // namespace ui
-
-namespace cc {
-class CompositorFrame;
-class SyntheticBeginFrameSource;
-} // namespace cc
-
-namespace mus {
-
-class SurfacesContextProvider;
-
-// An OutputSurface implementation that directly draws and swap to a GL
-// "surfaceless" surface (aka one backed by a buffer managed explicitly in
-// mus/ozone. This class is adapted from
-// GpuSurfacelessBrowserCompositorOutputSurface.
-class DirectOutputSurfaceOzone : public cc::OutputSurface {
- public:
- DirectOutputSurfaceOzone(
- scoped_refptr<SurfacesContextProvider> context_provider,
- gfx::AcceleratedWidget widget,
- cc::SyntheticBeginFrameSource* synthetic_begin_frame_source,
- uint32_t target,
- uint32_t internalformat);
-
- ~DirectOutputSurfaceOzone() override;
-
- // TODO(rjkroege): Implement the equivalent of Reflector.
-
- private:
- // cc::OutputSurface implementation.
- void SwapBuffers(cc::CompositorFrame frame) override;
- void BindFramebuffer() override;
- uint32_t GetFramebufferCopyTextureFormat() override;
- void Reshape(const gfx::Size& size,
- float scale_factor,
- const gfx::ColorSpace& color_space,
- bool alpha) override;
- bool IsDisplayedAsOverlayPlane() const override;
- unsigned GetOverlayTextureId() const override;
- bool BindToClient(cc::OutputSurfaceClient* client) override;
-
- // Taken from BrowserCompositor specific API.
- void OnUpdateVSyncParametersFromGpu(base::TimeTicks timebase,
- base::TimeDelta interval);
-
- // Called when a swap completion is sent from the GPU process.
- void OnGpuSwapBuffersCompleted(gfx::SwapResult result);
-
- display_compositor::GLHelper gl_helper_;
- std::unique_ptr<OzoneGpuMemoryBufferManager> ozone_gpu_memory_buffer_manager_;
- std::unique_ptr<display_compositor::BufferQueue> buffer_queue_;
- cc::SyntheticBeginFrameSource* const synthetic_begin_frame_source_;
-
- base::WeakPtrFactory<DirectOutputSurfaceOzone> weak_ptr_factory_;
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_
diff --git a/chromium/components/mus/surfaces/display_compositor.cc b/chromium/components/mus/surfaces/display_compositor.cc
deleted file mode 100644
index 8ffa0b86276..00000000000
--- a/chromium/components/mus/surfaces/display_compositor.cc
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/surfaces/display_compositor.h"
-
-#include "cc/output/copy_output_request.h"
-#include "cc/output/output_surface.h"
-#include "cc/output/renderer_settings.h"
-#include "cc/output/texture_mailbox_deleter.h"
-#include "cc/scheduler/begin_frame_source.h"
-#include "cc/scheduler/delay_based_time_source.h"
-#include "cc/surfaces/display.h"
-#include "cc/surfaces/display_scheduler.h"
-#include "components/mus/surfaces/direct_output_surface.h"
-#include "components/mus/surfaces/surfaces_context_provider.h"
-
-#if defined(USE_OZONE)
-#include "components/mus/surfaces/direct_output_surface_ozone.h"
-#include "gpu/command_buffer/client/gles2_interface.h"
-#endif
-
-namespace mus {
-
-DisplayCompositor::DisplayCompositor(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner,
- gfx::AcceleratedWidget widget,
- const scoped_refptr<GpuState>& gpu_state,
- const scoped_refptr<SurfacesState>& surfaces_state)
- : task_runner_(task_runner),
- surfaces_state_(surfaces_state),
- factory_(surfaces_state->manager(), this),
- allocator_(surfaces_state->next_id_namespace()) {
- allocator_.RegisterSurfaceIdNamespace(surfaces_state_->manager());
- surfaces_state_->manager()->RegisterSurfaceFactoryClient(
- allocator_.id_namespace(), this);
-
- scoped_refptr<SurfacesContextProvider> surfaces_context_provider(
- new SurfacesContextProvider(widget, gpu_state));
- // TODO(rjkroege): If there is something better to do than CHECK, add it.
- CHECK(surfaces_context_provider->BindToCurrentThread());
-
- std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source(
- new cc::DelayBasedBeginFrameSource(
- base::MakeUnique<cc::DelayBasedTimeSource>(task_runner_.get())));
-
- std::unique_ptr<cc::OutputSurface> display_output_surface;
- if (surfaces_context_provider->ContextCapabilities().surfaceless) {
-#if defined(USE_OZONE)
- display_output_surface = base::WrapUnique(new DirectOutputSurfaceOzone(
- surfaces_context_provider, widget, synthetic_begin_frame_source.get(),
- GL_TEXTURE_2D, GL_RGB));
-#else
- NOTREACHED();
-#endif
- } else {
- display_output_surface = base::WrapUnique(new DirectOutputSurface(
- surfaces_context_provider, synthetic_begin_frame_source.get()));
- }
-
- int max_frames_pending =
- display_output_surface->capabilities().max_frames_pending;
- DCHECK_GT(max_frames_pending, 0);
-
- std::unique_ptr<cc::DisplayScheduler> scheduler(
- new cc::DisplayScheduler(synthetic_begin_frame_source.get(),
- task_runner_.get(), max_frames_pending));
-
- display_.reset(new cc::Display(
- surfaces_state_->manager(), nullptr /* bitmap_manager */,
- nullptr /* gpu_memory_buffer_manager */, cc::RendererSettings(),
- allocator_.id_namespace(), std::move(synthetic_begin_frame_source),
- std::move(display_output_surface), std::move(scheduler),
- base::MakeUnique<cc::TextureMailboxDeleter>(task_runner_.get())));
- display_->Initialize(this);
-}
-
-DisplayCompositor::~DisplayCompositor() {
- surfaces_state_->manager()->UnregisterSurfaceFactoryClient(
- allocator_.id_namespace());
-}
-
-void DisplayCompositor::SubmitCompositorFrame(
- cc::CompositorFrame frame,
- const base::Callback<void(cc::SurfaceDrawStatus)>& callback) {
- gfx::Size frame_size =
- frame.delegated_frame_data->render_pass_list.back()->output_rect.size();
- if (frame_size.IsEmpty() || frame_size != display_size_) {
- if (!surface_id_.is_null())
- factory_.Destroy(surface_id_);
- surface_id_ = allocator_.GenerateId();
- factory_.Create(surface_id_);
- display_size_ = frame_size;
- display_->Resize(display_size_);
- }
- display_->SetSurfaceId(surface_id_, frame.metadata.device_scale_factor);
- factory_.SubmitCompositorFrame(surface_id_, std::move(frame), callback);
-}
-
-void DisplayCompositor::RequestCopyOfOutput(
- std::unique_ptr<cc::CopyOutputRequest> output_request) {
- factory_.RequestCopyOfSurface(surface_id_, std::move(output_request));
-}
-
-void DisplayCompositor::ReturnResources(
- const cc::ReturnedResourceArray& resources) {
- // TODO(fsamuel): Implement this.
-}
-
-void DisplayCompositor::SetBeginFrameSource(
- cc::BeginFrameSource* begin_frame_source) {
- // TODO(fsamuel): Implement this.
-}
-
-void DisplayCompositor::DisplayOutputSurfaceLost() {
- // TODO(fsamuel): This looks like it would crash if a frame was in flight and
- // will be submitted.
- display_.reset();
-}
-
-void DisplayCompositor::DisplaySetMemoryPolicy(
- const cc::ManagedMemoryPolicy& policy) {}
-
-} // namespace mus
diff --git a/chromium/components/mus/surfaces/display_compositor.h b/chromium/components/mus/surfaces/display_compositor.h
deleted file mode 100644
index 27d1eebf3cf..00000000000
--- a/chromium/components/mus/surfaces/display_compositor.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_SURFACES_DISPLAY_COMPOSITOR_H_
-#define COMPONENTS_MUS_SURFACES_DISPLAY_COMPOSITOR_H_
-
-#include "cc/surfaces/display_client.h"
-#include "cc/surfaces/surface.h"
-#include "cc/surfaces/surface_factory.h"
-#include "cc/surfaces/surface_factory_client.h"
-#include "cc/surfaces/surface_id_allocator.h"
-#include "components/mus/gles2/gpu_state.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "ui/gfx/native_widget_types.h"
-
-namespace cc {
-class Display;
-}
-
-namespace mus {
-
-// TODO(fsamuel): This should become a mojo interface for the mus-gpu split.
-// TODO(fsamuel): This should not be a SurfaceFactoryClient.
-// The DisplayCompositor receives CompositorFrames from all sources,
-// creates a top-level CompositorFrame once per tick, and generates graphical
-// output.
-class DisplayCompositor : public cc::SurfaceFactoryClient,
- public cc::DisplayClient {
- public:
- DisplayCompositor(scoped_refptr<base::SingleThreadTaskRunner> task_runner,
- gfx::AcceleratedWidget widget,
- const scoped_refptr<GpuState>& gpu_state,
- const scoped_refptr<SurfacesState>& surfaces_state);
- ~DisplayCompositor() override;
-
- // DisplayCompositor embedders submit a CompositorFrame when content on the
- // display should be changed. A well-behaving embedder should only submit
- // a CompositorFrame once per BeginFrame tick. The callback is called the
- // first time this frame is used to draw, or if the frame is discarded.
- void SubmitCompositorFrame(
- cc::CompositorFrame frame,
- const base::Callback<void(cc::SurfaceDrawStatus)>& callback);
-
- // TODO(fsamuel): This is used for surface hittesting and should not be
- // exposed outside of DisplayCompositor.
- const cc::SurfaceId& surface_id() const { return surface_id_; }
-
- // This requests the display CompositorFrame be rendered and given to the
- // callback within CopyOutputRequest.
- void RequestCopyOfOutput(
- std::unique_ptr<cc::CopyOutputRequest> output_request);
-
- // TODO(fsamuel): Invent an async way to create a SurfaceNamespace
- // A SurfaceNamespace can create CompositorFrameSinks where the client can
- // make up the ID.
-
- private:
- // SurfaceFactoryClient implementation.
- void ReturnResources(const cc::ReturnedResourceArray& resources) override;
- void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
-
- // DisplayClient implementation.
- void DisplayOutputSurfaceLost() override;
- void DisplaySetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override;
-
- scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
- scoped_refptr<SurfacesState> surfaces_state_;
- cc::SurfaceFactory factory_;
- cc::SurfaceIdAllocator allocator_;
- cc::SurfaceId surface_id_;
-
- gfx::Size display_size_;
- std::unique_ptr<cc::Display> display_;
- DISALLOW_COPY_AND_ASSIGN(DisplayCompositor);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_SURFACES_DISPLAY_COMPOSITOR_H_
diff --git a/chromium/components/mus/surfaces/ozone_gpu_memory_buffer_manager.cc b/chromium/components/mus/surfaces/ozone_gpu_memory_buffer_manager.cc
deleted file mode 100644
index b14cd1394fe..00000000000
--- a/chromium/components/mus/surfaces/ozone_gpu_memory_buffer_manager.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/surfaces/ozone_gpu_memory_buffer_manager.h"
-
-#include "components/mus/gles2/ozone_gpu_memory_buffer.h"
-#include "gpu/command_buffer/common/gpu_memory_buffer_support.h"
-#include "ui/gfx/buffer_types.h"
-
-namespace mus {
-
-OzoneGpuMemoryBufferManager::OzoneGpuMemoryBufferManager() {}
-
-OzoneGpuMemoryBufferManager::~OzoneGpuMemoryBufferManager() {}
-
-std::unique_ptr<gfx::GpuMemoryBuffer>
-OzoneGpuMemoryBufferManager::AllocateGpuMemoryBuffer(
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage,
- gpu::SurfaceHandle surface_handle) {
- return OzoneGpuMemoryBuffer::CreateOzoneGpuMemoryBuffer(
- size, format, gfx::BufferUsage::SCANOUT, surface_handle);
-}
-
-std::unique_ptr<gfx::GpuMemoryBuffer>
-OzoneGpuMemoryBufferManager::CreateGpuMemoryBufferFromHandle(
- const gfx::GpuMemoryBufferHandle& handle,
- const gfx::Size& size,
- gfx::BufferFormat format) {
- NOTIMPLEMENTED();
- return nullptr;
-}
-
-gfx::GpuMemoryBuffer*
-OzoneGpuMemoryBufferManager::GpuMemoryBufferFromClientBuffer(
- ClientBuffer buffer) {
- NOTIMPLEMENTED();
- return nullptr;
-}
-
-void OzoneGpuMemoryBufferManager::SetDestructionSyncToken(
- gfx::GpuMemoryBuffer* buffer,
- const gpu::SyncToken& sync_token) {
- NOTIMPLEMENTED();
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/surfaces/ozone_gpu_memory_buffer_manager.h b/chromium/components/mus/surfaces/ozone_gpu_memory_buffer_manager.h
deleted file mode 100644
index d6cf15f55fe..00000000000
--- a/chromium/components/mus/surfaces/ozone_gpu_memory_buffer_manager.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACES_OZONE_H_
-#define COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACES_OZONE_H_
-
-#include "base/macros.h"
-#include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
-
-namespace mus {
-
-class OzoneGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager {
- public:
- OzoneGpuMemoryBufferManager();
- ~OzoneGpuMemoryBufferManager() override;
-
- // gpu::GpuMemoryBufferManager:
- std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage,
- gpu::SurfaceHandle surface_handle) override;
- std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle(
- const gfx::GpuMemoryBufferHandle& handle,
- const gfx::Size& size,
- gfx::BufferFormat format) override;
- gfx::GpuMemoryBuffer* GpuMemoryBufferFromClientBuffer(
- ClientBuffer buffer) override;
- void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer,
- const gpu::SyncToken& sync_token) override;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OzoneGpuMemoryBufferManager);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACES_OZONE_H_
diff --git a/chromium/components/mus/surfaces/surfaces_context_provider.cc b/chromium/components/mus/surfaces/surfaces_context_provider.cc
deleted file mode 100644
index 291a4402eb5..00000000000
--- a/chromium/components/mus/surfaces/surfaces_context_provider.cc
+++ /dev/null
@@ -1,206 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/surfaces/surfaces_context_provider.h"
-
-#include <stddef.h>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/command_line.h"
-#include "base/synchronization/waitable_event.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "build/build_config.h"
-#include "components/mus/common/switches.h"
-#include "components/mus/gles2/command_buffer_driver.h"
-#include "components/mus/gles2/command_buffer_impl.h"
-#include "components/mus/gles2/command_buffer_local.h"
-#include "components/mus/gles2/gpu_state.h"
-#include "components/mus/gpu/gpu_service_mus.h"
-#include "components/mus/surfaces/surfaces_context_provider_delegate.h"
-#include "gpu/command_buffer/client/gles2_cmd_helper.h"
-#include "gpu/command_buffer/client/gles2_implementation.h"
-#include "gpu/command_buffer/client/shared_memory_limits.h"
-#include "gpu/command_buffer/client/transfer_buffer.h"
-#include "gpu/ipc/client/command_buffer_proxy_impl.h"
-#include "ui/gl/gpu_preference.h"
-
-namespace mus {
-
-SurfacesContextProvider::SurfacesContextProvider(
- gfx::AcceleratedWidget widget,
- const scoped_refptr<GpuState>& state)
- : use_chrome_gpu_command_buffer_(false),
- delegate_(nullptr),
- widget_(widget),
- command_buffer_local_(nullptr) {
-// TODO(penghuang): Kludge: Use mojo command buffer when running on Windows
-// since Chrome command buffer breaks unit tests
-#if defined(OS_WIN)
- use_chrome_gpu_command_buffer_ = false;
-#else
- use_chrome_gpu_command_buffer_ =
- !base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kUseMojoGpuCommandBufferInMus);
-#endif
- if (!use_chrome_gpu_command_buffer_) {
- command_buffer_local_ = new CommandBufferLocal(this, widget_, state);
- } else {
- GpuServiceMus* service = GpuServiceMus::GetInstance();
- gpu::CommandBufferProxyImpl* shared_command_buffer = nullptr;
- gpu::GpuStreamId stream_id = gpu::GpuStreamId::GPU_STREAM_DEFAULT;
- gpu::GpuStreamPriority stream_priority = gpu::GpuStreamPriority::NORMAL;
- gpu::gles2::ContextCreationAttribHelper attributes;
- attributes.alpha_size = -1;
- attributes.depth_size = 0;
- attributes.stencil_size = 0;
- attributes.samples = 0;
- attributes.sample_buffers = 0;
- attributes.bind_generates_resource = false;
- attributes.lose_context_when_out_of_memory = true;
- GURL active_url;
- scoped_refptr<base::SingleThreadTaskRunner> task_runner =
- base::ThreadTaskRunnerHandle::Get();
- command_buffer_proxy_impl_ = gpu::CommandBufferProxyImpl::Create(
- service->gpu_channel_local(), widget, shared_command_buffer, stream_id,
- stream_priority, attributes, active_url, task_runner);
- command_buffer_proxy_impl_->SetSwapBuffersCompletionCallback(
- base::Bind(&SurfacesContextProvider::OnGpuSwapBuffersCompleted,
- base::Unretained(this)));
- command_buffer_proxy_impl_->SetUpdateVSyncParametersCallback(
- base::Bind(&SurfacesContextProvider::OnUpdateVSyncParameters,
- base::Unretained(this)));
- }
-}
-
-void SurfacesContextProvider::SetDelegate(
- SurfacesContextProviderDelegate* delegate) {
- DCHECK(!delegate_);
- delegate_ = delegate;
-}
-
-// This routine needs to be safe to call more than once.
-// This is called when we have an accelerated widget.
-bool SurfacesContextProvider::BindToCurrentThread() {
- if (implementation_)
- return true;
-
- // SurfacesContextProvider should always live on the same thread as the
- // Window Manager.
- DCHECK(CalledOnValidThread());
- gpu::GpuControl* gpu_control = nullptr;
- gpu::CommandBuffer* command_buffer = nullptr;
- if (!use_chrome_gpu_command_buffer_) {
- if (!command_buffer_local_->Initialize())
- return false;
- gpu_control = command_buffer_local_;
- command_buffer = command_buffer_local_;
- } else {
- if (!command_buffer_proxy_impl_)
- return false;
- gpu_control = command_buffer_proxy_impl_.get();
- command_buffer = command_buffer_proxy_impl_.get();
- }
-
- gles2_helper_.reset(new gpu::gles2::GLES2CmdHelper(command_buffer));
- constexpr gpu::SharedMemoryLimits default_limits;
- if (!gles2_helper_->Initialize(default_limits.command_buffer_size))
- return false;
- gles2_helper_->SetAutomaticFlushes(false);
- transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get()));
- capabilities_ = gpu_control->GetCapabilities();
- bool bind_generates_resource =
- !!capabilities_.bind_generates_resource_chromium;
- // TODO(piman): Some contexts (such as compositor) want this to be true, so
- // this needs to be a public parameter.
- bool lose_context_when_out_of_memory = false;
- bool support_client_side_arrays = false;
- implementation_.reset(new gpu::gles2::GLES2Implementation(
- gles2_helper_.get(), NULL, transfer_buffer_.get(),
- bind_generates_resource, lose_context_when_out_of_memory,
- support_client_side_arrays, gpu_control));
- return implementation_->Initialize(
- default_limits.start_transfer_buffer_size,
- default_limits.min_transfer_buffer_size,
- default_limits.max_transfer_buffer_size,
- default_limits.mapped_memory_reclaim_limit);
-}
-
-gpu::gles2::GLES2Interface* SurfacesContextProvider::ContextGL() {
- DCHECK(implementation_);
- return implementation_.get();
-}
-
-gpu::ContextSupport* SurfacesContextProvider::ContextSupport() {
- return implementation_.get();
-}
-
-class GrContext* SurfacesContextProvider::GrContext() {
- return NULL;
-}
-
-void SurfacesContextProvider::InvalidateGrContext(uint32_t state) {}
-
-gpu::Capabilities SurfacesContextProvider::ContextCapabilities() {
- return capabilities_;
-}
-
-base::Lock* SurfacesContextProvider::GetLock() {
- // This context provider is not used on multiple threads.
- NOTREACHED();
- return nullptr;
-}
-
-void SurfacesContextProvider::SetLostContextCallback(
- const LostContextCallback& lost_context_callback) {
- implementation_->SetLostContextCallback(lost_context_callback);
-}
-
-SurfacesContextProvider::~SurfacesContextProvider() {
- implementation_->Flush();
- implementation_.reset();
- transfer_buffer_.reset();
- gles2_helper_.reset();
- command_buffer_proxy_impl_.reset();
- if (command_buffer_local_) {
- command_buffer_local_->Destroy();
- command_buffer_local_ = nullptr;
- }
-}
-
-void SurfacesContextProvider::UpdateVSyncParameters(
- const base::TimeTicks& timebase,
- const base::TimeDelta& interval) {
- if (delegate_)
- delegate_->OnVSyncParametersUpdated(timebase, interval);
-}
-
-void SurfacesContextProvider::GpuCompletedSwapBuffers(gfx::SwapResult result) {
- if (!swap_buffers_completion_callback_.is_null()) {
- swap_buffers_completion_callback_.Run(result);
- }
-}
-
-void SurfacesContextProvider::OnGpuSwapBuffersCompleted(
- const std::vector<ui::LatencyInfo>& latency_info,
- gfx::SwapResult result,
- const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) {
- if (!swap_buffers_completion_callback_.is_null()) {
- swap_buffers_completion_callback_.Run(result);
- }
-}
-
-void SurfacesContextProvider::OnUpdateVSyncParameters(
- base::TimeTicks timebase,
- base::TimeDelta interval) {
- if (delegate_)
- delegate_->OnVSyncParametersUpdated(timebase, interval);
-}
-
-void SurfacesContextProvider::SetSwapBuffersCompletionCallback(
- gl::GLSurface::SwapCompletionCallback callback) {
- swap_buffers_completion_callback_ = callback;
-}
-
-} // namespace mus
diff --git a/chromium/components/mus/surfaces/surfaces_context_provider.h b/chromium/components/mus/surfaces/surfaces_context_provider.h
deleted file mode 100644
index 8dab0bcb9d6..00000000000
--- a/chromium/components/mus/surfaces/surfaces_context_provider.h
+++ /dev/null
@@ -1,109 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_SURFACES_SURFACES_CONTEXT_PROVIDER_H_
-#define COMPONENTS_MUS_SURFACES_SURFACES_CONTEXT_PROVIDER_H_
-
-#include <stdint.h>
-
-#include <memory>
-
-#include "base/macros.h"
-#include "base/threading/non_thread_safe.h"
-#include "cc/output/context_provider.h"
-#include "components/mus/gles2/command_buffer_local_client.h"
-#include "ui/gfx/native_widget_types.h"
-#include "ui/gl/gl_surface.h"
-
-namespace gpu {
-
-class CommandBufferProxyImpl;
-struct GpuProcessHostedCALayerTreeParamsMac;
-class TransferBuffer;
-
-namespace gles2 {
-class GLES2CmdHelper;
-class GLES2Implementation;
-}
-
-} // namespace gpu
-
-namespace ui {
-class LatencyInfo;
-}
-
-namespace mus {
-
-class CommandBufferDriver;
-class CommandBufferImpl;
-class CommandBufferLocal;
-class GpuState;
-class SurfacesContextProviderDelegate;
-
-class SurfacesContextProvider : public cc::ContextProvider,
- public CommandBufferLocalClient,
- public base::NonThreadSafe {
- public:
- SurfacesContextProvider(gfx::AcceleratedWidget widget,
- const scoped_refptr<GpuState>& state);
-
- void SetDelegate(SurfacesContextProviderDelegate* delegate);
-
- // cc::ContextProvider implementation.
- bool BindToCurrentThread() override;
- gpu::gles2::GLES2Interface* ContextGL() override;
- gpu::ContextSupport* ContextSupport() override;
- class GrContext* GrContext() override;
- void InvalidateGrContext(uint32_t state) override;
- gpu::Capabilities ContextCapabilities() override;
- void DeleteCachedResources() override {}
- void SetLostContextCallback(
- const LostContextCallback& lost_context_callback) override;
- base::Lock* GetLock() override;
-
- // SurfacesContextProvider API.
- void SetSwapBuffersCompletionCallback(
- gl::GLSurface::SwapCompletionCallback callback);
-
- protected:
- friend class base::RefCountedThreadSafe<SurfacesContextProvider>;
- ~SurfacesContextProvider() override;
-
- private:
- // CommandBufferLocalClient:
- void UpdateVSyncParameters(const base::TimeTicks& timebase,
- const base::TimeDelta& interval) override;
- void GpuCompletedSwapBuffers(gfx::SwapResult result) override;
-
- // Callbacks for CommandBufferProxyImpl:
- void OnGpuSwapBuffersCompleted(
- const std::vector<ui::LatencyInfo>& latency_info,
- gfx::SwapResult result,
- const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac);
- void OnUpdateVSyncParameters(base::TimeTicks timebase,
- base::TimeDelta interval);
-
- bool use_chrome_gpu_command_buffer_;
-
- // From GLES2Context:
- // Initialized in BindToCurrentThread.
- std::unique_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_;
- std::unique_ptr<gpu::TransferBuffer> transfer_buffer_;
- std::unique_ptr<gpu::gles2::GLES2Implementation> implementation_;
-
- gpu::Capabilities capabilities_;
- LostContextCallback lost_context_callback_;
-
- SurfacesContextProviderDelegate* delegate_;
- gfx::AcceleratedWidget widget_;
- CommandBufferLocal* command_buffer_local_;
- std::unique_ptr<gpu::CommandBufferProxyImpl> command_buffer_proxy_impl_;
- gl::GLSurface::SwapCompletionCallback swap_buffers_completion_callback_;
-
- DISALLOW_COPY_AND_ASSIGN(SurfacesContextProvider);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_SURFACES_SURFACES_CONTEXT_PROVIDER_H_
diff --git a/chromium/components/mus/surfaces/surfaces_context_provider_delegate.h b/chromium/components/mus/surfaces/surfaces_context_provider_delegate.h
deleted file mode 100644
index 170190a923f..00000000000
--- a/chromium/components/mus/surfaces/surfaces_context_provider_delegate.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_SURFACES_SURFACES_CONTEXT_PROVIDER_DELEGATE_H_
-#define COMPONENTS_MUS_SURFACES_SURFACES_CONTEXT_PROVIDER_DELEGATE_H_
-
-#include <stdint.h>
-
-namespace base {
-class TimeDelta;
-class TimeTicks;
-}
-
-namespace mus {
-
-class SurfacesContextProviderDelegate {
- public:
- virtual void OnVSyncParametersUpdated(const base::TimeTicks& timebase,
- const base::TimeDelta& interval) = 0;
-
- protected:
- virtual ~SurfacesContextProviderDelegate() {}
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_SURFACES_SURFACES_CONTEXT_PROVIDER_DELEGATE_H_
diff --git a/chromium/components/mus/surfaces/surfaces_state.cc b/chromium/components/mus/surfaces/surfaces_state.cc
deleted file mode 100644
index e3dfeb8d85d..00000000000
--- a/chromium/components/mus/surfaces/surfaces_state.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/surfaces/surfaces_state.h"
-
-namespace mus {
-
-SurfacesState::SurfacesState() : next_id_namespace_(1u) {}
-
-SurfacesState::~SurfacesState() {}
-
-} // namespace mus
diff --git a/chromium/components/mus/surfaces/surfaces_state.h b/chromium/components/mus/surfaces/surfaces_state.h
deleted file mode 100644
index daaf5587ab6..00000000000
--- a/chromium/components/mus/surfaces/surfaces_state.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_SURFACES_SURFACES_STATE_H_
-#define COMPONENTS_MUS_SURFACES_SURFACES_STATE_H_
-
-#include <stdint.h>
-
-#include "base/macros.h"
-#include "base/memory/ref_counted.h"
-#include "cc/surfaces/surface_manager.h"
-
-namespace cc {
-class SurfaceHittest;
-class SurfaceManager;
-} // namespace cc
-
-namespace mus {
-
-// The SurfacesState object is an object global to the Window Manager app that
-// holds the SurfaceManager and allocates new Surfaces namespaces.
-// This object lives on the main thread of the Window Manager.
-// TODO(rjkroege, fsamuel): This object will need to change to support multiple
-// displays.
-class SurfacesState : public base::RefCounted<SurfacesState> {
- public:
- SurfacesState();
-
- uint32_t next_id_namespace() { return next_id_namespace_++; }
-
- cc::SurfaceManager* manager() { return &manager_; }
-
- private:
- friend class base::RefCounted<SurfacesState>;
- ~SurfacesState();
-
- // A Surface ID is an unsigned 64-bit int where the high 32-bits are generated
- // by the Surfaces service, and the low 32-bits are generated by the process
- // that requested the Surface.
- uint32_t next_id_namespace_;
- cc::SurfaceManager manager_;
-
- DISALLOW_COPY_AND_ASSIGN(SurfacesState);
-};
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_SURFACES_SURFACES_STATE_H_
diff --git a/chromium/components/mus/test_wm/manifest.json b/chromium/components/mus/test_wm/manifest.json
deleted file mode 100644
index 67f2fa96671..00000000000
--- a/chromium/components/mus/test_wm/manifest.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "manifest_version": 1,
- "name": "mojo:test_wm",
- "display_name": "Test Window Manager",
- "capabilities": {
- "required": {
- "mojo:mus": { "interfaces": [ "mus::mojom::WindowManagerWindowTreeFactory" ] }
- }
- }
-}
diff --git a/chromium/components/mus/test_wm/test_wm.cc b/chromium/components/mus/test_wm/test_wm.cc
deleted file mode 100644
index 39ad3759839..00000000000
--- a/chromium/components/mus/test_wm/test_wm.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/public/cpp/window.h"
-#include "components/mus/public/cpp/window_manager_delegate.h"
-#include "components/mus/public/cpp/window_tree_client.h"
-#include "components/mus/public/cpp/window_tree_client_delegate.h"
-#include "mojo/public/c/system/main.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "services/shell/public/cpp/application_runner.h"
-#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/shell_client.h"
-#include "ui/display/display.h"
-#include "ui/display/mojo/display_type_converters.h"
-
-namespace mus {
-namespace test {
-
-class TestWM : public shell::ShellClient,
- public mus::WindowTreeClientDelegate,
- public mus::WindowManagerDelegate {
- public:
- TestWM() {}
- ~TestWM() override { delete window_tree_client_; }
-
- private:
- // shell::ShellClient:
- void Initialize(shell::Connector* connector,
- const shell::Identity& identity,
- uint32_t id) override {
- window_tree_client_ = new mus::WindowTreeClient(this, this, nullptr);
- window_tree_client_->ConnectAsWindowManager(connector);
- }
- bool AcceptConnection(shell::Connection* connection) override {
- return true;
- }
-
- // mus::WindowTreeClientDelegate:
- void OnEmbed(mus::Window* root) override {
- // WindowTreeClients configured as the window manager should never get
- // OnEmbed().
- NOTREACHED();
- }
- void OnWindowTreeClientDestroyed(mus::WindowTreeClient* client) override {
- window_tree_client_ = nullptr;
- }
- void OnEventObserved(const ui::Event& event, mus::Window* target) override {
- // Don't care.
- }
-
- // mus::WindowManagerDelegate:
- void SetWindowManagerClient(mus::WindowManagerClient* client) override {
- window_manager_client_ = client;
- }
- bool OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) override {
- return true;
- }
- bool OnWmSetProperty(
- mus::Window* window,
- const std::string& name,
- std::unique_ptr<std::vector<uint8_t>>* new_data) override {
- return true;
- }
- mus::Window* OnWmCreateTopLevelWindow(
- std::map<std::string, std::vector<uint8_t>>* properties) override {
- mus::Window* window = root_->window_tree()->NewWindow(properties);
- window->SetBounds(gfx::Rect(10, 10, 500, 500));
- root_->AddChild(window);
- return window;
- }
- void OnWmClientJankinessChanged(const std::set<Window*>& client_windows,
- bool janky) override {
- // Don't care.
- }
- void OnWmNewDisplay(Window* window,
- const display::Display& display) override {
- // Only handles a single root.
- DCHECK(!root_);
- root_ = window;
- DCHECK(window_manager_client_);
- window_manager_client_->AddActivationParent(root_);
- mus::mojom::FrameDecorationValuesPtr frame_decoration_values =
- mus::mojom::FrameDecorationValues::New();
- frame_decoration_values->max_title_bar_button_width = 0;
- window_manager_client_->SetFrameDecorationValues(
- std::move(frame_decoration_values));
- }
- void OnAccelerator(uint32_t id, const ui::Event& event) override {
- // Don't care.
- }
-
- mus::Window* root_ = nullptr;
- mus::WindowManagerClient* window_manager_client_ = nullptr;
- // See WindowTreeClient for details on ownership.
- mus::WindowTreeClient* window_tree_client_ = nullptr;
-
- DISALLOW_COPY_AND_ASSIGN(TestWM);
-};
-
-} // namespace test
-} // namespace mus
-
-MojoResult MojoMain(MojoHandle shell_handle) {
- shell::ApplicationRunner runner(new mus::test::TestWM);
- return runner.Run(shell_handle);
-}
diff --git a/chromium/components/mus/ws/accelerator.cc b/chromium/components/mus/ws/accelerator.cc
deleted file mode 100644
index fd8cde39668..00000000000
--- a/chromium/components/mus/ws/accelerator.cc
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/accelerator.h"
-
-namespace mus {
-namespace ws {
-
-Accelerator::Accelerator(uint32_t id, const mojom::EventMatcher& matcher)
- : id_(id),
- accelerator_phase_(matcher.accelerator_phase),
- event_matcher_(matcher),
- weak_factory_(this) {}
-
-Accelerator::~Accelerator() {}
-
-bool Accelerator::MatchesEvent(const ui::Event& event,
- const ui::mojom::AcceleratorPhase phase) const {
- if (accelerator_phase_ != phase)
- return false;
- if (!event_matcher_.MatchesEvent(event))
- return false;
- return true;
-}
-
-bool Accelerator::EqualEventMatcher(const Accelerator* other) const {
- return accelerator_phase_ == other->accelerator_phase_ &&
- event_matcher_.Equals(other->event_matcher_);
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/accelerator.h b/chromium/components/mus/ws/accelerator.h
deleted file mode 100644
index 2113ad1ec9b..00000000000
--- a/chromium/components/mus/ws/accelerator.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_ACCELERATOR_H_
-#define COMPONENTS_MUS_WS_ACCELERATOR_H_
-
-#include <stdint.h>
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "components/mus/public/interfaces/event_matcher.mojom.h"
-#include "components/mus/ws/event_matcher.h"
-
-namespace ui {
-class Event;
-}
-
-namespace mus {
-namespace ws {
-
-// An Accelerator encompasses an id defined by the client, along with a unique
-// mojom::EventMatcher. See WindowManagerClient.
-//
-// This provides a WeakPtr, as the client might delete the accelerator between
-// an event having been matched and the dispatch of the accelerator to the
-// client.
-class Accelerator {
- public:
- Accelerator(uint32_t id, const mojom::EventMatcher& matcher);
- ~Accelerator();
-
- // Returns true if |event| and |phase | matches the definition in the
- // mojom::EventMatcher used for initialization.
- bool MatchesEvent(const ui::Event& event,
- const ui::mojom::AcceleratorPhase phase) const;
-
- // Returns true if |other| was created with an identical mojom::EventMatcher.
- bool EqualEventMatcher(const Accelerator* other) const;
-
- base::WeakPtr<Accelerator> GetWeakPtr() { return weak_factory_.GetWeakPtr(); }
-
- uint32_t id() const { return id_; }
-
- private:
- uint32_t id_;
- ui::mojom::AcceleratorPhase accelerator_phase_;
- EventMatcher event_matcher_;
- base::WeakPtrFactory<Accelerator> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(Accelerator);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_ACCELERATOR_H_
diff --git a/chromium/components/mus/ws/access_policy.h b/chromium/components/mus/ws/access_policy.h
deleted file mode 100644
index 2f0cb366cc5..00000000000
--- a/chromium/components/mus/ws/access_policy.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_ACCESS_POLICY_H_
-#define COMPONENTS_MUS_WS_ACCESS_POLICY_H_
-
-#include <stdint.h>
-
-#include "components/mus/public/interfaces/mus_constants.mojom.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/ws/ids.h"
-
-namespace mus {
-namespace ws {
-
-class AccessPolicyDelegate;
-class ServerWindow;
-
-// AccessPolicy is used by WindowTree to determine what the WindowTree is
-// allowed to do.
-class AccessPolicy {
- public:
- virtual ~AccessPolicy() {}
-
- virtual void Init(ClientSpecificId client_id,
- AccessPolicyDelegate* delegate) = 0;
-
- // Unless otherwise mentioned all arguments have been validated. That is the
- // |window| arguments are non-null unless otherwise stated (eg CanSetWindow()
- // is allowed to take a NULL window).
- virtual bool CanRemoveWindowFromParent(const ServerWindow* window) const = 0;
- virtual bool CanAddWindow(const ServerWindow* parent,
- const ServerWindow* child) const = 0;
- virtual bool CanAddTransientWindow(const ServerWindow* parent,
- const ServerWindow* child) const = 0;
- virtual bool CanRemoveTransientWindowFromParent(
- const ServerWindow* window) const = 0;
- virtual bool CanSetModal(const ServerWindow* window) const = 0;
- virtual bool CanReorderWindow(const ServerWindow* window,
- const ServerWindow* relative_window,
- mojom::OrderDirection direction) const = 0;
- virtual bool CanDeleteWindow(const ServerWindow* window) const = 0;
- virtual bool CanGetWindowTree(const ServerWindow* window) const = 0;
- // Used when building a window tree (GetWindowTree()) to decide if we should
- // descend into |window|.
- virtual bool CanDescendIntoWindowForWindowTree(
- const ServerWindow* window) const = 0;
- virtual bool CanEmbed(const ServerWindow* window) const = 0;
- virtual bool CanChangeWindowVisibility(const ServerWindow* window) const = 0;
- virtual bool CanChangeWindowOpacity(const ServerWindow* window) const = 0;
- virtual bool CanSetWindowSurface(const ServerWindow* window,
- mojom::SurfaceType surface_type) const = 0;
- virtual bool CanSetWindowBounds(const ServerWindow* window) const = 0;
- virtual bool CanSetWindowProperties(const ServerWindow* window) const = 0;
- virtual bool CanSetWindowTextInputState(const ServerWindow* window) const = 0;
- virtual bool CanSetCapture(const ServerWindow* window) const = 0;
- virtual bool CanSetFocus(const ServerWindow* window) const = 0;
- virtual bool CanSetClientArea(const ServerWindow* window) const = 0;
- virtual bool CanSetHitTestMask(const ServerWindow* window) const = 0;
- // Used for all client controllable cursor properties; which cursor should be
- // displayed, visibility, locking, etc.
- virtual bool CanSetCursorProperties(const ServerWindow* window) const = 0;
-
- // Returns whether the client should notify on a hierarchy change.
- // |new_parent| and |old_parent| are initially set to the new and old parents
- // but may be altered so that the client only sees a certain set of windows.
- virtual bool ShouldNotifyOnHierarchyChange(
- const ServerWindow* window,
- const ServerWindow** new_parent,
- const ServerWindow** old_parent) const = 0;
- virtual bool CanSetWindowManager() const = 0;
-
- // Returns the window to supply to the client when focus changes to |focused|.
- virtual const ServerWindow* GetWindowForFocusChange(
- const ServerWindow* focused) = 0;
-
- virtual bool IsValidIdForNewWindow(const ClientWindowId& id) const = 0;
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_ACCESS_POLICY_H_
diff --git a/chromium/components/mus/ws/access_policy_delegate.h b/chromium/components/mus/ws/access_policy_delegate.h
deleted file mode 100644
index 3e33de55c46..00000000000
--- a/chromium/components/mus/ws/access_policy_delegate.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_ACCESS_POLICY_DELEGATE_H_
-#define COMPONENTS_MUS_WS_ACCESS_POLICY_DELEGATE_H_
-
-#include <vector>
-
-#include "base/containers/hash_tables.h"
-#include "components/mus/ws/ids.h"
-
-namespace mus {
-
-namespace ws {
-
-class ServerWindow;
-
-// Delegate used by the AccessPolicy implementations to get state.
-class AccessPolicyDelegate {
- public:
- // Returns true if the tree has |window| as one of its roots.
- virtual bool HasRootForAccessPolicy(const ServerWindow* window) const = 0;
-
- // Returns true if |window| has been exposed to the client.
- virtual bool IsWindowKnownForAccessPolicy(
- const ServerWindow* window) const = 0;
-
- // Returns true if Embed(window) has been invoked on |window|.
- virtual bool IsWindowRootOfAnotherTreeForAccessPolicy(
- const ServerWindow* window) const = 0;
-
- protected:
- virtual ~AccessPolicyDelegate() {}
-};
-
-} // namespace ws
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_ACCESS_POLICY_DELEGATE_H_
diff --git a/chromium/components/mus/ws/animation_runner.cc b/chromium/components/mus/ws/animation_runner.cc
deleted file mode 100644
index 080fb2c0f45..00000000000
--- a/chromium/components/mus/ws/animation_runner.cc
+++ /dev/null
@@ -1,163 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/animation_runner.h"
-
-#include "base/memory/scoped_vector.h"
-#include "components/mus/ws/animation_runner_observer.h"
-#include "components/mus/ws/scheduled_animation_group.h"
-#include "components/mus/ws/server_window.h"
-
-namespace mus {
-namespace ws {
-namespace {
-
-bool ConvertWindowAndAnimationPairsToScheduledAnimationGroups(
- const std::vector<AnimationRunner::WindowAndAnimationPair>& pairs,
- AnimationRunner::AnimationId id,
- base::TimeTicks now,
- std::vector<std::unique_ptr<ScheduledAnimationGroup>>* groups) {
- for (const auto& window_animation_pair : pairs) {
- DCHECK(window_animation_pair.first);
- DCHECK(window_animation_pair.second);
- std::unique_ptr<ScheduledAnimationGroup> group(
- ScheduledAnimationGroup::Create(window_animation_pair.first, now, id,
- *(window_animation_pair.second)));
- if (!group.get())
- return false;
- groups->push_back(std::move(group));
- }
- return true;
-}
-
-} // namespace
-
-AnimationRunner::AnimationRunner(base::TimeTicks now)
- : next_id_(1), last_tick_time_(now) {}
-
-AnimationRunner::~AnimationRunner() {}
-
-void AnimationRunner::AddObserver(AnimationRunnerObserver* observer) {
- observers_.AddObserver(observer);
-}
-
-void AnimationRunner::RemoveObserver(AnimationRunnerObserver* observer) {
- observers_.RemoveObserver(observer);
-}
-
-AnimationRunner::AnimationId AnimationRunner::Schedule(
- const std::vector<WindowAndAnimationPair>& pairs,
- base::TimeTicks now) {
- DCHECK_GE(now, last_tick_time_);
-
- const AnimationId animation_id = next_id_++;
- std::vector<std::unique_ptr<ScheduledAnimationGroup>> groups;
- if (!ConvertWindowAndAnimationPairsToScheduledAnimationGroups(
- pairs, animation_id, now, &groups)) {
- return 0;
- }
-
- // Cancel any animations for the affected windows. If the cancelled animations
- // also animated properties that are not animated by the new group - instantly
- // set those to the target value.
- for (auto& group : groups) {
- ScheduledAnimationGroup* current_group =
- window_to_animation_map_[group->window()].get();
- if (current_group)
- current_group->SetValuesToTargetValuesForPropertiesNotIn(*group.get());
-
- CancelAnimationForWindowImpl(group->window(), CANCEL_SOURCE_SCHEDULE);
- }
-
- // Update internal maps
- for (auto& group : groups) {
- group->ObtainStartValues();
- ServerWindow* window = group->window();
- window_to_animation_map_[window] = std::move(group);
- DCHECK(!id_to_windows_map_[animation_id].count(window));
- id_to_windows_map_[animation_id].insert(window);
- }
-
- FOR_EACH_OBSERVER(AnimationRunnerObserver, observers_,
- OnAnimationScheduled(animation_id));
- return animation_id;
-}
-
-void AnimationRunner::CancelAnimation(AnimationId id) {
- if (id_to_windows_map_.count(id) == 0)
- return;
-
- std::set<ServerWindow*> windows(id_to_windows_map_[id]);
- for (ServerWindow* window : windows)
- CancelAnimationForWindow(window);
-}
-
-void AnimationRunner::CancelAnimationForWindow(ServerWindow* window) {
- CancelAnimationForWindowImpl(window, CANCEL_SOURCE_CANCEL);
-}
-
-void AnimationRunner::Tick(base::TimeTicks time) {
- DCHECK(time >= last_tick_time_);
- last_tick_time_ = time;
- if (window_to_animation_map_.empty())
- return;
-
- // The animation ids of any windows whose animation completes are added here.
- // We notify after processing all windows so that if an observer mutates us in
- // some way we're aren't left in a weird state.
- std::set<AnimationId> animations_completed;
- for (WindowToAnimationMap::iterator i = window_to_animation_map_.begin();
- i != window_to_animation_map_.end();) {
- bool animation_done = i->second->Tick(time);
- if (animation_done) {
- const AnimationId animation_id = i->second->id();
- ServerWindow* window = i->first;
- ++i;
- bool animation_completed = RemoveWindowFromMaps(window);
- if (animation_completed)
- animations_completed.insert(animation_id);
- } else {
- ++i;
- }
- }
- for (const AnimationId& id : animations_completed) {
- FOR_EACH_OBSERVER(AnimationRunnerObserver, observers_, OnAnimationDone(id));
- }
-}
-
-void AnimationRunner::CancelAnimationForWindowImpl(ServerWindow* window,
- CancelSource source) {
- if (!window_to_animation_map_[window])
- return;
-
- const AnimationId animation_id = window_to_animation_map_[window]->id();
- if (RemoveWindowFromMaps(window)) {
- // This was the last window in the group.
- if (source == CANCEL_SOURCE_CANCEL) {
- FOR_EACH_OBSERVER(AnimationRunnerObserver, observers_,
- OnAnimationCanceled(animation_id));
- } else {
- FOR_EACH_OBSERVER(AnimationRunnerObserver, observers_,
- OnAnimationInterrupted(animation_id));
- }
- }
-}
-
-bool AnimationRunner::RemoveWindowFromMaps(ServerWindow* window) {
- DCHECK(window_to_animation_map_[window]);
-
- const AnimationId animation_id = window_to_animation_map_[window]->id();
- window_to_animation_map_.erase(window);
-
- DCHECK(id_to_windows_map_.count(animation_id));
- id_to_windows_map_[animation_id].erase(window);
- if (!id_to_windows_map_[animation_id].empty())
- return false;
-
- id_to_windows_map_.erase(animation_id);
- return true;
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/animation_runner.h b/chromium/components/mus/ws/animation_runner.h
deleted file mode 100644
index 5a7d80c4774..00000000000
--- a/chromium/components/mus/ws/animation_runner.h
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_ANIMATION_RUNNER_H_
-#define COMPONENTS_MUS_WS_ANIMATION_RUNNER_H_
-
-#include <algorithm>
-#include <map>
-#include <memory>
-#include <set>
-#include <unordered_map>
-#include <vector>
-
-#include "base/observer_list.h"
-#include "base/time/time.h"
-
-namespace mus {
-namespace mojom {
-class AnimationGroup;
-}
-
-namespace ws {
-
-class AnimationRunnerObserver;
-class ScheduledAnimationGroup;
-class ServerWindow;
-
-// AnimationRunner is responsible for maintaining and running a set of
-// animations. The animations are represented as a set of AnimationGroups. New
-// animations are scheduled by way of Schedule(). A |window| may only have one
-// animation running at a time. Schedule()ing a new animation for a window
-// already animating implicitly cancels the current animation for the window.
-// Animations progress by way of the Tick() function.
-class AnimationRunner {
- public:
- using AnimationId = uint32_t;
- using WindowAndAnimationPair =
- std::pair<ServerWindow*, const mojom::AnimationGroup*>;
-
- explicit AnimationRunner(base::TimeTicks now);
- ~AnimationRunner();
-
- void AddObserver(AnimationRunnerObserver* observer);
- void RemoveObserver(AnimationRunnerObserver* observer);
-
- // Schedules animations. If any of the groups are not valid no animations are
- // scheuled and 0 is returned. If there is an existing animation in progress
- // for any of the windows it is canceled and any properties that were
- // animating but are no longer animating are set to their target value.
- AnimationId Schedule(const std::vector<WindowAndAnimationPair>& groups,
- base::TimeTicks now);
-
- // Cancels an animation scheduled by an id that was previously returned from
- // Schedule().
- void CancelAnimation(AnimationId id);
-
- // Cancels the animation scheduled for |window|. Does nothing if there is no
- // animation scheduled for |window|. This does not change |window|. That is,
- // any in progress animations are stopped.
- void CancelAnimationForWindow(ServerWindow* window);
-
- // Advance the animations updating values appropriately.
- void Tick(base::TimeTicks time);
-
- // Returns true if there are animations currently scheduled.
- bool HasAnimations() const { return !window_to_animation_map_.empty(); }
-
- // Returns true if the animation identified by |id| is valid and animating.
- bool IsAnimating(AnimationId id) const {
- return id_to_windows_map_.count(id) > 0;
- }
-
- // Returns the windows that are currently animating for |id|. Returns an empty
- // set if |id| does not identify a valid animation.
- std::set<ServerWindow*> GetWindowsAnimating(AnimationId id) {
- return IsAnimating(id) ? id_to_windows_map_.find(id)->second
- : std::set<ServerWindow*>();
- }
-
- private:
- enum CancelSource {
- // Cancel is the result of scheduling another animation for the window.
- CANCEL_SOURCE_SCHEDULE,
-
- // Cancel originates from an explicit call to cancel.
- CANCEL_SOURCE_CANCEL,
- };
-
- using WindowToAnimationMap =
- std::unordered_map<ServerWindow*,
- std::unique_ptr<ScheduledAnimationGroup>>;
- using IdToWindowsMap = std::map<AnimationId, std::set<ServerWindow*>>;
-
- void CancelAnimationForWindowImpl(ServerWindow* window, CancelSource source);
-
- // Removes |window| from both |window_to_animation_map_| and
- // |id_to_windows_map_|.
- // Returns true if there are no more windows animating with the animation id
- // the window is associated with.
- bool RemoveWindowFromMaps(ServerWindow* window);
-
- AnimationId next_id_;
-
- base::TimeTicks last_tick_time_;
-
- base::ObserverList<AnimationRunnerObserver> observers_;
-
- WindowToAnimationMap window_to_animation_map_;
-
- IdToWindowsMap id_to_windows_map_;
-
- DISALLOW_COPY_AND_ASSIGN(AnimationRunner);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_ANIMATION_RUNNER_H_
diff --git a/chromium/components/mus/ws/animation_runner_observer.h b/chromium/components/mus/ws/animation_runner_observer.h
deleted file mode 100644
index 4c73e6cdbae..00000000000
--- a/chromium/components/mus/ws/animation_runner_observer.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_ANIMATION_RUNNER_OBSERVER_H_
-#define COMPONENTS_MUS_WS_ANIMATION_RUNNER_OBSERVER_H_
-
-namespace mus {
-namespace ws {
-
-class AnimationRunnerObserver {
- public:
- virtual void OnAnimationScheduled(uint32_t id) = 0;
- virtual void OnAnimationDone(uint32_t id) = 0;
- virtual void OnAnimationInterrupted(uint32_t id) = 0;
- virtual void OnAnimationCanceled(uint32_t id) = 0;
-
- protected:
- virtual ~AnimationRunnerObserver() {}
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_ANIMATION_RUNNER_OBSERVER_H_
diff --git a/chromium/components/mus/ws/animation_runner_unittest.cc b/chromium/components/mus/ws/animation_runner_unittest.cc
deleted file mode 100644
index 660a920b313..00000000000
--- a/chromium/components/mus/ws/animation_runner_unittest.cc
+++ /dev/null
@@ -1,639 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/animation_runner.h"
-
-#include "base/strings/stringprintf.h"
-#include "components/mus/public/interfaces/window_manager_constants.mojom.h"
-#include "components/mus/ws/animation_runner_observer.h"
-#include "components/mus/ws/scheduled_animation_group.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/test_server_window_delegate.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-using base::TimeDelta;
-
-namespace mus {
-using mojom::AnimationProperty;
-using mojom::AnimationTweenType;
-using mojom::AnimationElement;
-using mojom::AnimationGroup;
-using mojom::AnimationProperty;
-using mojom::AnimationSequence;
-using mojom::AnimationTweenType;
-using mojom::AnimationValue;
-using mojom::AnimationValuePtr;
-
-namespace ws {
-namespace {
-
-class TestAnimationRunnerObserver : public AnimationRunnerObserver {
- public:
- TestAnimationRunnerObserver() {}
- ~TestAnimationRunnerObserver() override {}
-
- std::vector<std::string>* changes() { return &changes_; }
- std::vector<uint32_t>* change_ids() { return &change_ids_; }
-
- void clear_changes() {
- changes_.clear();
- change_ids_.clear();
- }
-
- // AnimationRunnerDelgate:
- void OnAnimationScheduled(uint32_t id) override {
- change_ids_.push_back(id);
- changes_.push_back("scheduled");
- }
- void OnAnimationDone(uint32_t id) override {
- change_ids_.push_back(id);
- changes_.push_back("done");
- }
- void OnAnimationInterrupted(uint32_t id) override {
- change_ids_.push_back(id);
- changes_.push_back("interrupted");
- }
- void OnAnimationCanceled(uint32_t id) override {
- change_ids_.push_back(id);
- changes_.push_back("canceled");
- }
-
- private:
- std::vector<uint32_t> change_ids_;
- std::vector<std::string> changes_;
-
- DISALLOW_COPY_AND_ASSIGN(TestAnimationRunnerObserver);
-};
-
-// Creates an AnimationValuePtr from the specified float value.
-AnimationValuePtr FloatAnimationValue(float float_value) {
- AnimationValuePtr value(AnimationValue::New());
- value->float_value = float_value;
- return value;
-}
-
-// Creates an AnimationValuePtr from the specified transform.
-AnimationValuePtr TransformAnimationValue(const gfx::Transform& transform) {
- AnimationValuePtr value(AnimationValue::New());
- value->transform = transform;
- return value;
-}
-
-// Adds an AnimationElement to |group|s last sequence with the specified value.
-void AddElement(AnimationGroup* group,
- TimeDelta time,
- AnimationValuePtr start_value,
- AnimationValuePtr target_value,
- AnimationProperty property,
- AnimationTweenType tween_type) {
- AnimationSequence& sequence =
- *(group->sequences[group->sequences.size() - 1]);
- sequence.elements.push_back(AnimationElement::New());
- AnimationElement& element =
- *(sequence.elements[sequence.elements.size() - 1]);
- element.property = property;
- element.duration = time.InMicroseconds();
- element.tween_type = tween_type;
- element.start_value = std::move(start_value);
- element.target_value = std::move(target_value);
-}
-
-void AddOpacityElement(AnimationGroup* group,
- TimeDelta time,
- AnimationValuePtr start_value,
- AnimationValuePtr target_value) {
- AddElement(group, time, std::move(start_value), std::move(target_value),
- AnimationProperty::OPACITY, AnimationTweenType::LINEAR);
-}
-
-void AddTransformElement(AnimationGroup* group,
- TimeDelta time,
- AnimationValuePtr start_value,
- AnimationValuePtr target_value) {
- AddElement(group, time, std::move(start_value), std::move(target_value),
- AnimationProperty::TRANSFORM, AnimationTweenType::LINEAR);
-}
-
-void AddPauseElement(AnimationGroup* group, TimeDelta time) {
- AddElement(group, time, AnimationValuePtr(), AnimationValuePtr(),
- AnimationProperty::NONE, AnimationTweenType::LINEAR);
-}
-
-void InitGroupForWindow(AnimationGroup* group,
- const WindowId& id,
- int cycle_count) {
- group->window_id = WindowIdToTransportId(id);
- group->sequences.push_back(AnimationSequence::New());
- group->sequences[group->sequences.size() - 1]->cycle_count = cycle_count;
-}
-
-} // namespace
-
-class AnimationRunnerTest : public testing::Test {
- public:
- AnimationRunnerTest()
- : initial_time_(base::TimeTicks::Now()), runner_(initial_time_) {
- runner_.AddObserver(&runner_observer_);
- }
- ~AnimationRunnerTest() override { runner_.RemoveObserver(&runner_observer_); }
-
- protected:
- // Convenience to schedule an animation for a single window/group pair.
- AnimationRunner::AnimationId ScheduleForSingleWindow(
- ServerWindow* window,
- const AnimationGroup* group,
- base::TimeTicks now) {
- std::vector<AnimationRunner::WindowAndAnimationPair> pairs;
- pairs.push_back(std::make_pair(window, group));
- return runner_.Schedule(pairs, now);
- }
-
- // If |id| is valid and there is only one window schedule against the
- // animation it is returned; otherwise returns null.
- ServerWindow* GetSingleWindowAnimating(AnimationRunner::AnimationId id) {
- std::set<ServerWindow*> windows(runner_.GetWindowsAnimating(id));
- return windows.size() == 1 ? *windows.begin() : nullptr;
- }
-
- const base::TimeTicks initial_time_;
- TestAnimationRunnerObserver runner_observer_;
- AnimationRunner runner_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(AnimationRunnerTest);
-};
-
-// Opacity from 1 to .5 over 1000.
-TEST_F(AnimationRunnerTest, SingleProperty) {
- TestServerWindowDelegate window_delegate;
- ServerWindow window(&window_delegate, WindowId());
-
- AnimationGroup group;
- InitGroupForWindow(&group, window.id(), 1);
- AddOpacityElement(&group, TimeDelta::FromMicroseconds(1000),
- AnimationValuePtr(), FloatAnimationValue(.5));
-
- const uint32_t animation_id =
- ScheduleForSingleWindow(&window, &group, initial_time_);
-
- ASSERT_EQ(1u, runner_observer_.changes()->size());
- EXPECT_EQ("scheduled", runner_observer_.changes()->at(0));
- EXPECT_EQ(animation_id, runner_observer_.change_ids()->at(0));
- runner_observer_.clear_changes();
-
- EXPECT_TRUE(runner_.HasAnimations());
-
- // Opacity should still be 1 (the initial value).
- EXPECT_EQ(1.f, window.opacity());
-
- // Animate half way.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(500));
-
- EXPECT_EQ(.75f, window.opacity());
- EXPECT_TRUE(runner_observer_.changes()->empty());
-
- // Run well past the end. Value should progress to end and delegate should
- // be notified.
- runner_.Tick(initial_time_ + TimeDelta::FromSeconds(10));
- EXPECT_EQ(.5f, window.opacity());
-
- ASSERT_EQ(1u, runner_observer_.changes()->size());
- EXPECT_EQ("done", runner_observer_.changes()->at(0));
- EXPECT_EQ(animation_id, runner_observer_.change_ids()->at(0));
-
- EXPECT_FALSE(runner_.HasAnimations());
-}
-
-// Opacity from 1 to .5, followed by transform from identity to 2x,3x.
-TEST_F(AnimationRunnerTest, TwoPropertiesInSequence) {
- TestServerWindowDelegate window_delegate;
- ServerWindow window(&window_delegate, WindowId());
-
- AnimationGroup group;
- InitGroupForWindow(&group, window.id(), 1);
- AddOpacityElement(&group, TimeDelta::FromMicroseconds(1000),
- AnimationValuePtr(), FloatAnimationValue(.5f));
-
- gfx::Transform done_transform;
- done_transform.Scale(2, 4);
- AddTransformElement(&group, TimeDelta::FromMicroseconds(2000),
- AnimationValuePtr(),
- TransformAnimationValue(done_transform));
-
- const uint32_t animation_id =
- ScheduleForSingleWindow(&window, &group, initial_time_);
- runner_observer_.clear_changes();
-
- // Nothing in the window should have changed yet.
- EXPECT_EQ(1.f, window.opacity());
- EXPECT_TRUE(window.transform().IsIdentity());
-
- // Animate half way from through opacity animation.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(500));
-
- EXPECT_EQ(.75f, window.opacity());
- EXPECT_TRUE(window.transform().IsIdentity());
-
- // Finish first element (opacity).
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(1000));
- EXPECT_EQ(.5f, window.opacity());
- EXPECT_TRUE(window.transform().IsIdentity());
-
- // Half way through second (transform).
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(2000));
- EXPECT_EQ(.5f, window.opacity());
- gfx::Transform half_way_transform;
- half_way_transform.Scale(1.5, 2.5);
- EXPECT_EQ(half_way_transform, window.transform());
-
- EXPECT_TRUE(runner_observer_.changes()->empty());
-
- // To end.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(3500));
- EXPECT_EQ(.5f, window.opacity());
- EXPECT_EQ(done_transform, window.transform());
-
- ASSERT_EQ(1u, runner_observer_.changes()->size());
- EXPECT_EQ("done", runner_observer_.changes()->at(0));
- EXPECT_EQ(animation_id, runner_observer_.change_ids()->at(0));
-}
-
-// Opacity from .5 to 1 over 1000, transform to 2x,4x over 500.
-TEST_F(AnimationRunnerTest, TwoPropertiesInParallel) {
- TestServerWindowDelegate window_delegate;
- ServerWindow window(&window_delegate, WindowId(1, 1));
-
- AnimationGroup group;
- InitGroupForWindow(&group, window.id(), 1);
- AddOpacityElement(&group, TimeDelta::FromMicroseconds(1000),
- FloatAnimationValue(.5f), FloatAnimationValue(1));
-
- group.sequences.push_back(AnimationSequence::New());
- group.sequences[1]->cycle_count = 1;
- gfx::Transform done_transform;
- done_transform.Scale(2, 4);
- AddTransformElement(&group, TimeDelta::FromMicroseconds(500),
- AnimationValuePtr(),
- TransformAnimationValue(done_transform));
-
- const uint32_t animation_id =
- ScheduleForSingleWindow(&window, &group, initial_time_);
-
- runner_observer_.clear_changes();
-
- // Nothing in the window should have changed yet.
- EXPECT_EQ(1.f, window.opacity());
- EXPECT_TRUE(window.transform().IsIdentity());
-
- // Animate to 250, which is 1/4 way through opacity and half way through
- // transform.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(250));
-
- EXPECT_EQ(.625f, window.opacity());
- gfx::Transform half_way_transform;
- half_way_transform.Scale(1.5, 2.5);
- EXPECT_EQ(half_way_transform, window.transform());
-
- // Animate to 500, which is 1/2 way through opacity and transform done.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(500));
- EXPECT_EQ(.75f, window.opacity());
- EXPECT_EQ(done_transform, window.transform());
-
- // Animate to 750, which is 3/4 way through opacity and transform done.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(750));
- EXPECT_EQ(.875f, window.opacity());
- EXPECT_EQ(done_transform, window.transform());
-
- EXPECT_TRUE(runner_observer_.changes()->empty());
-
- // To end.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(3500));
- EXPECT_EQ(1.f, window.opacity());
- EXPECT_EQ(done_transform, window.transform());
-
- ASSERT_EQ(1u, runner_observer_.changes()->size());
- EXPECT_EQ("done", runner_observer_.changes()->at(0));
- EXPECT_EQ(animation_id, runner_observer_.change_ids()->at(0));
-}
-
-// Opacity from .5 to 1 over 1000, pause for 500, 1 to .5 over 500, with a cycle
-// count of 3.
-TEST_F(AnimationRunnerTest, Cycles) {
- TestServerWindowDelegate window_delegate;
- ServerWindow window(&window_delegate, WindowId(1, 2));
-
- window.SetOpacity(.5f);
-
- AnimationGroup group;
- InitGroupForWindow(&group, window.id(), 3);
- AddOpacityElement(&group, TimeDelta::FromMicroseconds(1000),
- AnimationValuePtr(), FloatAnimationValue(1));
- AddPauseElement(&group, TimeDelta::FromMicroseconds(500));
- AddOpacityElement(&group, TimeDelta::FromMicroseconds(500),
- AnimationValuePtr(), FloatAnimationValue(.5));
-
- ScheduleForSingleWindow(&window, &group, initial_time_);
- runner_observer_.clear_changes();
-
- // Nothing in the window should have changed yet.
- EXPECT_EQ(.5f, window.opacity());
-
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(500));
- EXPECT_EQ(.75f, window.opacity());
-
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(1250));
- EXPECT_EQ(1.f, window.opacity());
-
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(1750));
- EXPECT_EQ(.75f, window.opacity());
-
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(2500));
- EXPECT_EQ(.75f, window.opacity());
-
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(3250));
- EXPECT_EQ(1.f, window.opacity());
-
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(3750));
- EXPECT_EQ(.75f, window.opacity());
-
- // Animate to the end.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(6500));
- EXPECT_EQ(.5f, window.opacity());
-
- ASSERT_EQ(1u, runner_observer_.changes()->size());
- EXPECT_EQ("done", runner_observer_.changes()->at(0));
-}
-
-// Verifies scheduling the same window twice sends an interrupt.
-TEST_F(AnimationRunnerTest, ScheduleTwice) {
- TestServerWindowDelegate window_delegate;
- ServerWindow window(&window_delegate, WindowId(1, 2));
-
- AnimationGroup group;
- InitGroupForWindow(&group, window.id(), 1);
- AddOpacityElement(&group, TimeDelta::FromMicroseconds(1000),
- AnimationValuePtr(), FloatAnimationValue(.5));
-
- const uint32_t animation_id =
- ScheduleForSingleWindow(&window, &group, initial_time_);
- runner_observer_.clear_changes();
-
- // Animate half way.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(500));
-
- EXPECT_EQ(.75f, window.opacity());
- EXPECT_TRUE(runner_observer_.changes()->empty());
-
- // Schedule again. We should get an interrupt, but opacity shouldn't change.
- const uint32_t animation2_id = ScheduleForSingleWindow(
- &window, &group, initial_time_ + TimeDelta::FromMicroseconds(500));
-
- // Id should have changed.
- EXPECT_NE(animation_id, animation2_id);
-
- EXPECT_FALSE(runner_.IsAnimating(animation_id));
- EXPECT_EQ(&window, GetSingleWindowAnimating(animation2_id));
-
- EXPECT_EQ(.75f, window.opacity());
- EXPECT_EQ(2u, runner_observer_.changes()->size());
- EXPECT_EQ("interrupted", runner_observer_.changes()->at(0));
- EXPECT_EQ(animation_id, runner_observer_.change_ids()->at(0));
- EXPECT_EQ("scheduled", runner_observer_.changes()->at(1));
- EXPECT_EQ(animation2_id, runner_observer_.change_ids()->at(1));
- runner_observer_.clear_changes();
-
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(1000));
- EXPECT_EQ(.625f, window.opacity());
- EXPECT_TRUE(runner_observer_.changes()->empty());
-
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(2000));
- EXPECT_EQ(.5f, window.opacity());
- EXPECT_EQ(1u, runner_observer_.changes()->size());
- EXPECT_EQ("done", runner_observer_.changes()->at(0));
- EXPECT_EQ(animation2_id, runner_observer_.change_ids()->at(0));
-}
-
-// Verifies Remove() works.
-TEST_F(AnimationRunnerTest, CancelAnimationForWindow) {
- // Create an animation and advance it part way.
- TestServerWindowDelegate window_delegate;
- ServerWindow window(&window_delegate, WindowId());
- AnimationGroup group;
- InitGroupForWindow(&group, window.id(), 1);
- AddOpacityElement(&group, TimeDelta::FromMicroseconds(1000),
- AnimationValuePtr(), FloatAnimationValue(.5));
-
- const uint32_t animation_id =
- ScheduleForSingleWindow(&window, &group, initial_time_);
- runner_observer_.clear_changes();
- EXPECT_EQ(&window, GetSingleWindowAnimating(animation_id));
-
- EXPECT_TRUE(runner_.HasAnimations());
-
- // Animate half way.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(500));
- EXPECT_EQ(.75f, window.opacity());
- EXPECT_TRUE(runner_observer_.changes()->empty());
-
- // Cancel the animation.
- runner_.CancelAnimationForWindow(&window);
-
- EXPECT_FALSE(runner_.HasAnimations());
- EXPECT_EQ(nullptr, GetSingleWindowAnimating(animation_id));
-
- EXPECT_EQ(.75f, window.opacity());
-
- EXPECT_EQ(1u, runner_observer_.changes()->size());
- EXPECT_EQ("canceled", runner_observer_.changes()->at(0));
- EXPECT_EQ(animation_id, runner_observer_.change_ids()->at(0));
-}
-
-// Verifies a tick with a very large delta and a sequence that repeats forever
-// doesn't take a long time.
-TEST_F(AnimationRunnerTest, InfiniteRepeatWithHugeGap) {
- TestServerWindowDelegate window_delegate;
- ServerWindow window(&window_delegate, WindowId(1, 2));
-
- window.SetOpacity(.5f);
-
- AnimationGroup group;
- InitGroupForWindow(&group, window.id(), 0);
- AddOpacityElement(&group, TimeDelta::FromMicroseconds(500),
- AnimationValuePtr(), FloatAnimationValue(1));
- AddOpacityElement(&group, TimeDelta::FromMicroseconds(500),
- AnimationValuePtr(), FloatAnimationValue(.5));
-
- ScheduleForSingleWindow(&window, &group, initial_time_);
- runner_observer_.clear_changes();
-
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(1000000000750));
-
- EXPECT_EQ(.75f, window.opacity());
-
- ASSERT_EQ(0u, runner_observer_.changes()->size());
-}
-
-// Verifies a second schedule sets any properties that are no longer animating
-// to their final value.
-TEST_F(AnimationRunnerTest, RescheduleSetsPropertiesToFinalValue) {
- TestServerWindowDelegate window_delegate;
- ServerWindow window(&window_delegate, WindowId());
-
- AnimationGroup group;
- InitGroupForWindow(&group, window.id(), 1);
- AddOpacityElement(&group, TimeDelta::FromMicroseconds(1000),
- AnimationValuePtr(), FloatAnimationValue(.5));
-
- gfx::Transform done_transform;
- done_transform.Scale(2, 4);
- AddTransformElement(&group, TimeDelta::FromMicroseconds(500),
- AnimationValuePtr(),
- TransformAnimationValue(done_transform));
-
- ScheduleForSingleWindow(&window, &group, initial_time_);
-
- // Schedule() again, this time without animating opacity.
- group.sequences[0]->elements[0]->property = AnimationProperty::NONE;
- ScheduleForSingleWindow(&window, &group, initial_time_);
-
- // Opacity should go to final value.
- EXPECT_EQ(.5f, window.opacity());
- // Transform shouldn't have changed since newly scheduled animation also has
- // transform in it.
- EXPECT_TRUE(window.transform().IsIdentity());
-}
-
-// Opacity from 1 to .5 over 1000 of v1 and v2 transform to 2x,4x over 500.
-TEST_F(AnimationRunnerTest, TwoWindows) {
- TestServerWindowDelegate window_delegate;
- ServerWindow window1(&window_delegate, WindowId());
- ServerWindow window2(&window_delegate, WindowId(1, 2));
-
- AnimationGroup group1;
- InitGroupForWindow(&group1, window1.id(), 1);
- AddOpacityElement(&group1, TimeDelta::FromMicroseconds(1000),
- AnimationValuePtr(), FloatAnimationValue(.5));
-
- AnimationGroup group2;
- InitGroupForWindow(&group2, window2.id(), 1);
- gfx::Transform done_transform;
- done_transform.Scale(2, 4);
- AddTransformElement(&group2, TimeDelta::FromMicroseconds(500),
- AnimationValuePtr(),
- TransformAnimationValue(done_transform));
-
- std::vector<AnimationRunner::WindowAndAnimationPair> pairs;
- pairs.push_back(std::make_pair(&window1, &group1));
- pairs.push_back(std::make_pair(&window2, &group2));
-
- const uint32_t animation_id = runner_.Schedule(pairs, initial_time_);
-
- ASSERT_EQ(1u, runner_observer_.changes()->size());
- EXPECT_EQ("scheduled", runner_observer_.changes()->at(0));
- EXPECT_EQ(animation_id, runner_observer_.change_ids()->at(0));
- runner_observer_.clear_changes();
-
- EXPECT_TRUE(runner_.HasAnimations());
- EXPECT_TRUE(runner_.IsAnimating(animation_id));
-
- // Properties should be at the initial value.
- EXPECT_EQ(1.f, window1.opacity());
- EXPECT_TRUE(window2.transform().IsIdentity());
-
- // Animate 250ms in, which is quarter way for opacity and half way for
- // transform.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(250));
- EXPECT_EQ(.875f, window1.opacity());
- gfx::Transform half_way_transform;
- half_way_transform.Scale(1.5, 2.5);
- EXPECT_EQ(half_way_transform, window2.transform());
- std::set<ServerWindow*> windows_animating(
- runner_.GetWindowsAnimating(animation_id));
- EXPECT_EQ(2u, windows_animating.size());
- EXPECT_EQ(1u, windows_animating.count(&window1));
- EXPECT_EQ(1u, windows_animating.count(&window2));
-
- // Animate 750ms in, window1 should be done 3/4 done, and window2 done.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(750));
- EXPECT_EQ(.625, window1.opacity());
- EXPECT_EQ(done_transform, window2.transform());
- windows_animating = runner_.GetWindowsAnimating(animation_id);
- EXPECT_EQ(1u, windows_animating.size());
- EXPECT_EQ(1u, windows_animating.count(&window1));
- EXPECT_TRUE(runner_.HasAnimations());
- EXPECT_TRUE(runner_.IsAnimating(animation_id));
-
- // Animate to end.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(1750));
- EXPECT_EQ(.5, window1.opacity());
- EXPECT_EQ(done_transform, window2.transform());
- windows_animating = runner_.GetWindowsAnimating(animation_id);
- EXPECT_TRUE(windows_animating.empty());
- EXPECT_FALSE(runner_.HasAnimations());
- EXPECT_FALSE(runner_.IsAnimating(animation_id));
-}
-
-TEST_F(AnimationRunnerTest, Reschedule) {
- TestServerWindowDelegate window_delegate;
- ServerWindow window(&window_delegate, WindowId());
-
- // Animation from 1-0 over 1ms and in parallel transform to 2x,4x over 1ms.
- AnimationGroup group;
- InitGroupForWindow(&group, window.id(), 1);
- AddOpacityElement(&group, TimeDelta::FromMicroseconds(1000),
- AnimationValuePtr(), FloatAnimationValue(0));
- group.sequences.push_back(AnimationSequence::New());
- group.sequences[1]->cycle_count = 1;
- gfx::Transform done_transform;
- done_transform.Scale(2, 4);
- AddTransformElement(&group, TimeDelta::FromMicroseconds(1000),
- AnimationValuePtr(),
- TransformAnimationValue(done_transform));
- const uint32_t animation_id1 =
- ScheduleForSingleWindow(&window, &group, initial_time_);
-
- // Animate half way in.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(500));
- EXPECT_EQ(.5f, window.opacity());
- gfx::Transform half_way_transform;
- half_way_transform.Scale(1.5, 2.5);
- EXPECT_EQ(half_way_transform, window.transform());
-
- runner_observer_.clear_changes();
-
- // Schedule the same window animating opacity to 1.
- AnimationGroup group2;
- InitGroupForWindow(&group2, window.id(), 1);
- AddOpacityElement(&group2, TimeDelta::FromMicroseconds(1000),
- AnimationValuePtr(), FloatAnimationValue(1));
- const uint32_t animation_id2 = ScheduleForSingleWindow(
- &window, &group2, initial_time_ + TimeDelta::FromMicroseconds(500));
-
- // Opacity should remain at .5, but transform should go to end state.
- EXPECT_EQ(.5f, window.opacity());
- EXPECT_EQ(done_transform, window.transform());
-
- ASSERT_EQ(2u, runner_observer_.changes()->size());
- EXPECT_EQ("interrupted", runner_observer_.changes()->at(0));
- EXPECT_EQ(animation_id1, runner_observer_.change_ids()->at(0));
- EXPECT_EQ("scheduled", runner_observer_.changes()->at(1));
- EXPECT_EQ(animation_id2, runner_observer_.change_ids()->at(1));
- runner_observer_.clear_changes();
-
- // Animate half way through new sequence. Opacity should be the only thing
- // changing.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(1000));
- EXPECT_EQ(.75f, window.opacity());
- EXPECT_EQ(done_transform, window.transform());
- ASSERT_EQ(0u, runner_observer_.changes()->size());
-
- // Animate to end.
- runner_.Tick(initial_time_ + TimeDelta::FromMicroseconds(2000));
- ASSERT_EQ(1u, runner_observer_.changes()->size());
- EXPECT_EQ("done", runner_observer_.changes()->at(0));
- EXPECT_EQ(animation_id2, runner_observer_.change_ids()->at(0));
-}
-
-} // ws
-} // mus
diff --git a/chromium/components/mus/ws/cursor_unittest.cc b/chromium/components/mus/ws/cursor_unittest.cc
deleted file mode 100644
index 995318e85f0..00000000000
--- a/chromium/components/mus/ws/cursor_unittest.cc
+++ /dev/null
@@ -1,198 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <stdint.h>
-
-#include <string>
-
-#include "base/macros.h"
-#include "base/message_loop/message_loop.h"
-#include "components/mus/common/types.h"
-#include "components/mus/common/util.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "components/mus/ws/display_manager.h"
-#include "components/mus/ws/ids.h"
-#include "components/mus/ws/platform_display.h"
-#include "components/mus/ws/platform_display_factory.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_surface_manager_test_api.h"
-#include "components/mus/ws/test_utils.h"
-#include "components/mus/ws/window_manager_display_root.h"
-#include "components/mus/ws/window_manager_state.h"
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_server_delegate.h"
-#include "components/mus/ws/window_tree.h"
-#include "components/mus/ws/window_tree_binding.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/events/event.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace mus {
-namespace ws {
-namespace test {
-
-const UserId kTestId1 = "20";
-
-class CursorTest : public testing::Test {
- public:
- CursorTest() : cursor_id_(-1), platform_display_factory_(&cursor_id_) {}
- ~CursorTest() override {}
-
- protected:
- // testing::Test:
- void SetUp() override {
- PlatformDisplay::set_factory_for_testing(&platform_display_factory_);
- window_server_.reset(
- new WindowServer(&window_server_delegate_,
- scoped_refptr<SurfacesState>(new SurfacesState)));
- window_server_delegate_.set_window_server(window_server_.get());
-
- window_server_delegate_.set_num_displays_to_create(1);
-
- // As a side effect, this allocates Displays.
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kTestId1);
- window_server_->user_id_tracker()->AddUserId(kTestId1);
- window_server_->user_id_tracker()->SetActiveUserId(kTestId1);
- }
-
- ServerWindow* GetRoot() {
- DisplayManager* display_manager = window_server_->display_manager();
- // ASSERT_EQ(1u, display_manager->displays().size());
- Display* display = *display_manager->displays().begin();
- return display->GetWindowManagerDisplayRootForUser(kTestId1)->root();
- }
-
- // Create a 30x30 window where the outer 10 pixels is non-client.
- ServerWindow* BuildServerWindow() {
- DisplayManager* display_manager = window_server_->display_manager();
- Display* display = *display_manager->displays().begin();
- WindowManagerDisplayRoot* active_display_root =
- display->GetActiveWindowManagerDisplayRoot();
- WindowTree* tree =
- active_display_root->window_manager_state()->window_tree();
- ClientWindowId child_window_id;
- if (!NewWindowInTree(tree, &child_window_id))
- return nullptr;
-
- ServerWindow* w = tree->GetWindowByClientId(child_window_id);
- w->SetBounds(gfx::Rect(10, 10, 30, 30));
- w->SetClientArea(gfx::Insets(10, 10), std::vector<gfx::Rect>());
- w->SetVisible(true);
-
- ServerWindowSurfaceManagerTestApi test_api(w->GetOrCreateSurfaceManager());
- test_api.CreateEmptyDefaultSurface();
-
- return w;
- }
-
- void MoveCursorTo(const gfx::Point& p) {
- DisplayManager* display_manager = window_server_->display_manager();
- ASSERT_EQ(1u, display_manager->displays().size());
- Display* display = *display_manager->displays().begin();
- WindowManagerDisplayRoot* active_display_root =
- display->GetActiveWindowManagerDisplayRoot();
- ASSERT_TRUE(active_display_root);
- static_cast<PlatformDisplayDelegate*>(display)->OnEvent(ui::PointerEvent(
- ui::MouseEvent(ui::ET_MOUSE_MOVED, p, p, base::TimeTicks(), 0, 0)));
- WindowManagerState* wms = active_display_root->window_manager_state();
- wms->OnEventAck(wms->window_tree(), mojom::EventResult::HANDLED);
- }
-
- protected:
- int32_t cursor_id_;
- TestPlatformDisplayFactory platform_display_factory_;
- TestWindowServerDelegate window_server_delegate_;
- std::unique_ptr<WindowServer> window_server_;
- base::MessageLoop message_loop_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(CursorTest);
-};
-
-TEST_F(CursorTest, ChangeByMouseMove) {
- ServerWindow* win = BuildServerWindow();
- win->SetPredefinedCursor(mojom::Cursor::IBEAM);
- EXPECT_EQ(mojom::Cursor::IBEAM, mojom::Cursor(win->cursor()));
- win->SetNonClientCursor(mojom::Cursor::EAST_RESIZE);
- EXPECT_EQ(mojom::Cursor::EAST_RESIZE,
- mojom::Cursor(win->non_client_cursor()));
-
- // Non client area
- MoveCursorTo(gfx::Point(15, 15));
- EXPECT_EQ(mojom::Cursor::EAST_RESIZE, mojom::Cursor(cursor_id_));
-
- // Client area
- MoveCursorTo(gfx::Point(25, 25));
- EXPECT_EQ(mojom::Cursor::IBEAM, mojom::Cursor(cursor_id_));
-}
-
-TEST_F(CursorTest, ChangeByClientAreaChange) {
- ServerWindow* win = BuildServerWindow();
- win->SetPredefinedCursor(mojom::Cursor::IBEAM);
- EXPECT_EQ(mojom::Cursor::IBEAM, mojom::Cursor(win->cursor()));
- win->SetNonClientCursor(mojom::Cursor::EAST_RESIZE);
- EXPECT_EQ(mojom::Cursor::EAST_RESIZE,
- mojom::Cursor(win->non_client_cursor()));
-
- // Non client area before we move.
- MoveCursorTo(gfx::Point(15, 15));
- EXPECT_EQ(mojom::Cursor::EAST_RESIZE, mojom::Cursor(cursor_id_));
-
- // Changing the client area should cause a change.
- win->SetClientArea(gfx::Insets(1, 1), std::vector<gfx::Rect>());
- EXPECT_EQ(mojom::Cursor::IBEAM, mojom::Cursor(cursor_id_));
-}
-
-TEST_F(CursorTest, NonClientCursorChange) {
- ServerWindow* win = BuildServerWindow();
- win->SetPredefinedCursor(mojom::Cursor::IBEAM);
- EXPECT_EQ(mojom::Cursor::IBEAM, mojom::Cursor(win->cursor()));
- win->SetNonClientCursor(mojom::Cursor::EAST_RESIZE);
- EXPECT_EQ(mojom::Cursor::EAST_RESIZE,
- mojom::Cursor(win->non_client_cursor()));
-
- MoveCursorTo(gfx::Point(15, 15));
- EXPECT_EQ(mojom::Cursor::EAST_RESIZE, mojom::Cursor(cursor_id_));
-
- win->SetNonClientCursor(mojom::Cursor::WEST_RESIZE);
- EXPECT_EQ(mojom::Cursor::WEST_RESIZE, mojom::Cursor(cursor_id_));
-}
-
-TEST_F(CursorTest, IgnoreClientCursorChangeInNonClientArea) {
- ServerWindow* win = BuildServerWindow();
- win->SetPredefinedCursor(mojom::Cursor::IBEAM);
- EXPECT_EQ(mojom::Cursor::IBEAM, mojom::Cursor(win->cursor()));
- win->SetNonClientCursor(mojom::Cursor::EAST_RESIZE);
- EXPECT_EQ(mojom::Cursor::EAST_RESIZE,
- mojom::Cursor(win->non_client_cursor()));
-
- MoveCursorTo(gfx::Point(15, 15));
- EXPECT_EQ(mojom::Cursor::EAST_RESIZE, mojom::Cursor(cursor_id_));
-
- win->SetPredefinedCursor(mojom::Cursor::HELP);
- EXPECT_EQ(mojom::Cursor::EAST_RESIZE, mojom::Cursor(cursor_id_));
-}
-
-TEST_F(CursorTest, NonClientToClientByBoundsChange) {
- ServerWindow* win = BuildServerWindow();
- win->SetPredefinedCursor(mojom::Cursor::IBEAM);
- EXPECT_EQ(mojom::Cursor::IBEAM, mojom::Cursor(win->cursor()));
- win->SetNonClientCursor(mojom::Cursor::EAST_RESIZE);
- EXPECT_EQ(mojom::Cursor::EAST_RESIZE,
- mojom::Cursor(win->non_client_cursor()));
-
- // Non client area before we move.
- MoveCursorTo(gfx::Point(15, 15));
- EXPECT_EQ(mojom::Cursor::EAST_RESIZE, mojom::Cursor(cursor_id_));
-
- win->SetBounds(gfx::Rect(0, 0, 30, 30));
- EXPECT_EQ(mojom::Cursor::IBEAM, mojom::Cursor(cursor_id_));
-}
-
-} // namespace test
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/default_access_policy.cc b/chromium/components/mus/ws/default_access_policy.cc
deleted file mode 100644
index 1930dc05925..00000000000
--- a/chromium/components/mus/ws/default_access_policy.cc
+++ /dev/null
@@ -1,203 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/default_access_policy.h"
-
-#include "components/mus/ws/access_policy_delegate.h"
-#include "components/mus/ws/server_window.h"
-
-namespace mus {
-namespace ws {
-
-DefaultAccessPolicy::DefaultAccessPolicy() {}
-
-DefaultAccessPolicy::~DefaultAccessPolicy() {}
-
-void DefaultAccessPolicy::Init(ClientSpecificId client_id,
- AccessPolicyDelegate* delegate) {
- client_id_ = client_id;
- delegate_ = delegate;
-}
-
-bool DefaultAccessPolicy::CanRemoveWindowFromParent(
- const ServerWindow* window) const {
- if (!WasCreatedByThisClient(window))
- return false; // Can only unparent windows we created.
-
- return delegate_->HasRootForAccessPolicy(window->parent()) ||
- WasCreatedByThisClient(window->parent());
-}
-
-bool DefaultAccessPolicy::CanAddWindow(const ServerWindow* parent,
- const ServerWindow* child) const {
- return WasCreatedByThisClient(child) &&
- (delegate_->HasRootForAccessPolicy(parent) ||
- (WasCreatedByThisClient(parent) &&
- !delegate_->IsWindowRootOfAnotherTreeForAccessPolicy(parent)));
-}
-
-bool DefaultAccessPolicy::CanAddTransientWindow(
- const ServerWindow* parent,
- const ServerWindow* child) const {
- return (delegate_->HasRootForAccessPolicy(child) ||
- WasCreatedByThisClient(child)) &&
- (delegate_->HasRootForAccessPolicy(parent) ||
- WasCreatedByThisClient(parent));
-}
-
-bool DefaultAccessPolicy::CanRemoveTransientWindowFromParent(
- const ServerWindow* window) const {
- return (delegate_->HasRootForAccessPolicy(window) ||
- WasCreatedByThisClient(window)) &&
- (delegate_->HasRootForAccessPolicy(window->transient_parent()) ||
- WasCreatedByThisClient(window->transient_parent()));
-}
-
-bool DefaultAccessPolicy::CanSetModal(const ServerWindow* window) const {
- return delegate_->HasRootForAccessPolicy(window) ||
- WasCreatedByThisClient(window);
-}
-
-bool DefaultAccessPolicy::CanReorderWindow(
- const ServerWindow* window,
- const ServerWindow* relative_window,
- mojom::OrderDirection direction) const {
- return WasCreatedByThisClient(window) &&
- WasCreatedByThisClient(relative_window);
-}
-
-bool DefaultAccessPolicy::CanDeleteWindow(const ServerWindow* window) const {
- return WasCreatedByThisClient(window);
-}
-
-bool DefaultAccessPolicy::CanGetWindowTree(const ServerWindow* window) const {
- return WasCreatedByThisClient(window) ||
- delegate_->HasRootForAccessPolicy(window);
-}
-
-bool DefaultAccessPolicy::CanDescendIntoWindowForWindowTree(
- const ServerWindow* window) const {
- return (WasCreatedByThisClient(window) &&
- !delegate_->IsWindowRootOfAnotherTreeForAccessPolicy(window)) ||
- delegate_->HasRootForAccessPolicy(window);
-}
-
-bool DefaultAccessPolicy::CanEmbed(const ServerWindow* window) const {
- return WasCreatedByThisClient(window);
-}
-
-bool DefaultAccessPolicy::CanChangeWindowVisibility(
- const ServerWindow* window) const {
- return WasCreatedByThisClient(window) ||
- delegate_->HasRootForAccessPolicy(window);
-}
-
-bool DefaultAccessPolicy::CanChangeWindowOpacity(
- const ServerWindow* window) const {
- return WasCreatedByThisClient(window) ||
- delegate_->HasRootForAccessPolicy(window);
-}
-
-bool DefaultAccessPolicy::CanSetWindowSurface(
- const ServerWindow* window,
- mojom::SurfaceType surface_type) const {
- if (surface_type == mojom::SurfaceType::UNDERLAY)
- return WasCreatedByThisClient(window);
-
- // Once a window embeds another app, the embedder app is no longer able to
- // call SetWindowSurfaceId() - this ability is transferred to the embedded
- // app.
- if (delegate_->IsWindowRootOfAnotherTreeForAccessPolicy(window))
- return false;
- return WasCreatedByThisClient(window) ||
- delegate_->HasRootForAccessPolicy(window);
-}
-
-bool DefaultAccessPolicy::CanSetWindowBounds(const ServerWindow* window) const {
- return WasCreatedByThisClient(window);
-}
-
-bool DefaultAccessPolicy::CanSetWindowProperties(
- const ServerWindow* window) const {
- return WasCreatedByThisClient(window);
-}
-
-bool DefaultAccessPolicy::CanSetWindowTextInputState(
- const ServerWindow* window) const {
- return WasCreatedByThisClient(window) ||
- delegate_->HasRootForAccessPolicy(window);
-}
-
-bool DefaultAccessPolicy::CanSetCapture(const ServerWindow* window) const {
- return WasCreatedByThisClient(window) ||
- delegate_->HasRootForAccessPolicy(window);
-}
-
-bool DefaultAccessPolicy::CanSetFocus(const ServerWindow* window) const {
- return !window || WasCreatedByThisClient(window) ||
- delegate_->HasRootForAccessPolicy(window);
-}
-
-bool DefaultAccessPolicy::CanSetClientArea(const ServerWindow* window) const {
- return WasCreatedByThisClient(window) ||
- delegate_->HasRootForAccessPolicy(window);
-}
-
-bool DefaultAccessPolicy::CanSetHitTestMask(const ServerWindow* window) const {
- return WasCreatedByThisClient(window) ||
- delegate_->HasRootForAccessPolicy(window);
-}
-
-bool DefaultAccessPolicy::CanSetCursorProperties(
- const ServerWindow* window) const {
- return WasCreatedByThisClient(window) ||
- delegate_->HasRootForAccessPolicy(window);
-}
-
-bool DefaultAccessPolicy::ShouldNotifyOnHierarchyChange(
- const ServerWindow* window,
- const ServerWindow** new_parent,
- const ServerWindow** old_parent) const {
- if (!WasCreatedByThisClient(window))
- return false;
-
- if (*new_parent && !WasCreatedByThisClient(*new_parent) &&
- !delegate_->HasRootForAccessPolicy((*new_parent))) {
- *new_parent = nullptr;
- }
-
- if (*old_parent && !WasCreatedByThisClient(*old_parent) &&
- !delegate_->HasRootForAccessPolicy((*old_parent))) {
- *old_parent = nullptr;
- }
- return true;
-}
-
-const ServerWindow* DefaultAccessPolicy::GetWindowForFocusChange(
- const ServerWindow* focused) {
- if (WasCreatedByThisClient(focused) ||
- delegate_->HasRootForAccessPolicy(focused))
- return focused;
- return nullptr;
-}
-
-bool DefaultAccessPolicy::CanSetWindowManager() const {
- return false;
-}
-
-bool DefaultAccessPolicy::WasCreatedByThisClient(
- const ServerWindow* window) const {
- return window->id().client_id == client_id_;
-}
-
-bool DefaultAccessPolicy::IsValidIdForNewWindow(
- const ClientWindowId& id) const {
- // Clients using DefaultAccessPolicy only see windows they have created (for
- // the embed point they choose the id), so it's ok for clients to use whatever
- // id they want.
- return true;
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/default_access_policy.h b/chromium/components/mus/ws/default_access_policy.h
deleted file mode 100644
index 9135fb9901d..00000000000
--- a/chromium/components/mus/ws/default_access_policy.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_DEFAULT_ACCESS_POLICY_H_
-#define COMPONENTS_MUS_WS_DEFAULT_ACCESS_POLICY_H_
-
-#include <stdint.h>
-
-#include "base/macros.h"
-#include "components/mus/ws/access_policy.h"
-
-namespace mus {
-namespace ws {
-
-class AccessPolicyDelegate;
-
-// AccessPolicy for all clients, except the window manager.
-class DefaultAccessPolicy : public AccessPolicy {
- public:
- DefaultAccessPolicy();
- ~DefaultAccessPolicy() override;
-
- // AccessPolicy:
- void Init(ClientSpecificId client_id,
- AccessPolicyDelegate* delegate) override;
- bool CanRemoveWindowFromParent(const ServerWindow* window) const override;
- bool CanAddWindow(const ServerWindow* parent,
- const ServerWindow* child) const override;
- bool CanAddTransientWindow(const ServerWindow* parent,
- const ServerWindow* child) const override;
- bool CanRemoveTransientWindowFromParent(
- const ServerWindow* window) const override;
- bool CanSetModal(const ServerWindow* window) const override;
- bool CanReorderWindow(const ServerWindow* window,
- const ServerWindow* relative_window,
- mojom::OrderDirection direction) const override;
- bool CanDeleteWindow(const ServerWindow* window) const override;
- bool CanGetWindowTree(const ServerWindow* window) const override;
- bool CanDescendIntoWindowForWindowTree(
- const ServerWindow* window) const override;
- bool CanEmbed(const ServerWindow* window) const override;
- bool CanChangeWindowVisibility(const ServerWindow* window) const override;
- bool CanChangeWindowOpacity(const ServerWindow* window) const override;
- bool CanSetWindowSurface(const ServerWindow* window,
- mus::mojom::SurfaceType surface_type) const override;
- bool CanSetWindowBounds(const ServerWindow* window) const override;
- bool CanSetWindowProperties(const ServerWindow* window) const override;
- bool CanSetWindowTextInputState(const ServerWindow* window) const override;
- bool CanSetCapture(const ServerWindow* window) const override;
- bool CanSetFocus(const ServerWindow* window) const override;
- bool CanSetClientArea(const ServerWindow* window) const override;
- bool CanSetHitTestMask(const ServerWindow* window) const override;
- bool CanSetCursorProperties(const ServerWindow* window) const override;
- bool ShouldNotifyOnHierarchyChange(
- const ServerWindow* window,
- const ServerWindow** new_parent,
- const ServerWindow** old_parent) const override;
- const ServerWindow* GetWindowForFocusChange(
- const ServerWindow* focused) override;
- bool CanSetWindowManager() const override;
- bool IsValidIdForNewWindow(const ClientWindowId& id) const override;
-
- private:
- bool WasCreatedByThisClient(const ServerWindow* window) const;
-
- ClientSpecificId client_id_ = 0u;
- AccessPolicyDelegate* delegate_ = nullptr;
-
- DISALLOW_COPY_AND_ASSIGN(DefaultAccessPolicy);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_DEFAULT_ACCESS_POLICY_H_
diff --git a/chromium/components/mus/ws/display.cc b/chromium/components/mus/ws/display.cc
deleted file mode 100644
index 84a4162de05..00000000000
--- a/chromium/components/mus/ws/display.cc
+++ /dev/null
@@ -1,419 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/display.h"
-
-#include <set>
-#include <vector>
-
-#include "base/debug/debugger.h"
-#include "base/strings/utf_string_conversions.h"
-#include "components/mus/common/types.h"
-#include "components/mus/ws/display_binding.h"
-#include "components/mus/ws/display_manager.h"
-#include "components/mus/ws/focus_controller.h"
-#include "components/mus/ws/platform_display.h"
-#include "components/mus/ws/platform_display_init_params.h"
-#include "components/mus/ws/user_activity_monitor.h"
-#include "components/mus/ws/window_manager_display_root.h"
-#include "components/mus/ws/window_manager_state.h"
-#include "components/mus/ws/window_manager_window_tree_factory.h"
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_server_delegate.h"
-#include "components/mus/ws/window_tree.h"
-#include "components/mus/ws/window_tree_binding.h"
-#include "mojo/common/common_type_converters.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "ui/base/cursor/cursor.h"
-
-namespace mus {
-namespace ws {
-
-Display::Display(WindowServer* window_server,
- const PlatformDisplayInitParams& platform_display_init_params)
- : id_(window_server->display_manager()->GetAndAdvanceNextDisplayId()),
- window_server_(window_server),
- platform_display_(PlatformDisplay::Create(platform_display_init_params)),
- last_cursor_(ui::kCursorNone) {
- platform_display_->Init(this);
-
- window_server_->window_manager_window_tree_factory_set()->AddObserver(this);
- window_server_->user_id_tracker()->AddObserver(this);
-}
-
-Display::~Display() {
- window_server_->user_id_tracker()->RemoveObserver(this);
-
- window_server_->window_manager_window_tree_factory_set()->RemoveObserver(
- this);
-
- if (!focus_controller_) {
- focus_controller_->RemoveObserver(this);
- focus_controller_.reset();
- }
-
- for (ServerWindow* window : windows_needing_frame_destruction_)
- window->RemoveObserver(this);
-
- // If there is a |binding_| then the tree was created specifically for this
- // display (which corresponds to a WindowTreeHost).
- if (binding_ && !window_manager_display_root_map_.empty()) {
- window_server_->DestroyTree(window_manager_display_root_map_.begin()
- ->second->window_manager_state()
- ->window_tree());
- }
-}
-
-void Display::Init(std::unique_ptr<DisplayBinding> binding) {
- init_called_ = true;
- binding_ = std::move(binding);
- display_manager()->AddDisplay(this);
- InitWindowManagerDisplayRootsIfNecessary();
-}
-
-DisplayManager* Display::display_manager() {
- return window_server_->display_manager();
-}
-
-const DisplayManager* Display::display_manager() const {
- return window_server_->display_manager();
-}
-
-mojom::DisplayPtr Display::ToMojomDisplay() const {
- mojom::DisplayPtr display_ptr = mojom::Display::New();
- display_ptr = mojom::Display::New();
- display_ptr->id = id_;
- // TODO(sky): Display should know it's origin.
- display_ptr->bounds.SetRect(0, 0, root_->bounds().size().width(),
- root_->bounds().size().height());
- // TODO(sky): window manager needs an API to set the work area.
- display_ptr->work_area = display_ptr->bounds;
- display_ptr->device_pixel_ratio = platform_display_->GetDeviceScaleFactor();
- display_ptr->rotation = platform_display_->GetRotation();
- // TODO(sky): make this real.
- display_ptr->is_primary = true;
- // TODO(sky): make this real.
- display_ptr->touch_support = mojom::TouchSupport::UNKNOWN;
- display_ptr->frame_decoration_values = mojom::FrameDecorationValues::New();
- return display_ptr;
-}
-
-void Display::SchedulePaint(const ServerWindow* window,
- const gfx::Rect& bounds) {
- DCHECK(root_->Contains(window));
- platform_display_->SchedulePaint(window, bounds);
-}
-
-void Display::ScheduleSurfaceDestruction(ServerWindow* window) {
- if (!platform_display_->IsFramePending()) {
- window->DestroySurfacesScheduledForDestruction();
- return;
- }
- if (windows_needing_frame_destruction_.count(window))
- return;
- windows_needing_frame_destruction_.insert(window);
- window->AddObserver(this);
-}
-
-mojom::Rotation Display::GetRotation() const {
- return platform_display_->GetRotation();
-}
-
-gfx::Size Display::GetSize() const {
- return root_->bounds().size();
-}
-
-int64_t Display::GetPlatformDisplayId() const {
- return platform_display_->GetDisplayId();
-}
-
-ServerWindow* Display::GetRootWithId(const WindowId& id) {
- if (id == root_->id())
- return root_.get();
- for (auto& pair : window_manager_display_root_map_) {
- if (pair.second->root()->id() == id)
- return pair.second->root();
- }
- return nullptr;
-}
-
-WindowManagerDisplayRoot* Display::GetWindowManagerDisplayRootWithRoot(
- const ServerWindow* window) {
- for (auto& pair : window_manager_display_root_map_) {
- if (pair.second->root() == window)
- return pair.second.get();
- }
- return nullptr;
-}
-
-const WindowManagerDisplayRoot* Display::GetWindowManagerDisplayRootForUser(
- const UserId& user_id) const {
- auto iter = window_manager_display_root_map_.find(user_id);
- return iter == window_manager_display_root_map_.end() ? nullptr
- : iter->second.get();
-}
-
-const WindowManagerDisplayRoot* Display::GetActiveWindowManagerDisplayRoot()
- const {
- return GetWindowManagerDisplayRootForUser(
- window_server_->user_id_tracker()->active_id());
-}
-
-bool Display::SetFocusedWindow(ServerWindow* new_focused_window) {
- ServerWindow* old_focused_window = focus_controller_->GetFocusedWindow();
- if (old_focused_window == new_focused_window)
- return true;
- DCHECK(!new_focused_window || root_window()->Contains(new_focused_window));
- return focus_controller_->SetFocusedWindow(new_focused_window);
-}
-
-ServerWindow* Display::GetFocusedWindow() {
- return focus_controller_->GetFocusedWindow();
-}
-
-void Display::ActivateNextWindow() {
- // TODO(sky): this is wrong, needs to figure out the next window to activate
- // and then route setting through WindowServer.
- focus_controller_->ActivateNextWindow();
-}
-
-void Display::AddActivationParent(ServerWindow* window) {
- activation_parents_.Add(window);
-}
-
-void Display::RemoveActivationParent(ServerWindow* window) {
- activation_parents_.Remove(window);
-}
-
-void Display::UpdateTextInputState(ServerWindow* window,
- const ui::TextInputState& state) {
- // Do not need to update text input for unfocused windows.
- if (!platform_display_ || focus_controller_->GetFocusedWindow() != window)
- return;
- platform_display_->UpdateTextInputState(state);
-}
-
-void Display::SetImeVisibility(ServerWindow* window, bool visible) {
- // Do not need to show or hide IME for unfocused window.
- if (focus_controller_->GetFocusedWindow() != window)
- return;
- platform_display_->SetImeVisibility(visible);
-}
-
-void Display::OnWillDestroyTree(WindowTree* tree) {
- for (auto it = window_manager_display_root_map_.begin();
- it != window_manager_display_root_map_.end(); ++it) {
- if (it->second->window_manager_state()->window_tree() == tree) {
- window_manager_display_root_map_.erase(it);
- break;
- }
- }
-}
-
-void Display::UpdateNativeCursor(int32_t cursor_id) {
- if (cursor_id != last_cursor_) {
- platform_display_->SetCursorById(cursor_id);
- last_cursor_ = cursor_id;
- }
-}
-
-void Display::SetSize(const gfx::Size& size) {
- platform_display_->SetViewportSize(size);
-}
-
-void Display::SetTitle(const mojo::String& title) {
- platform_display_->SetTitle(title.To<base::string16>());
-}
-
-void Display::InitWindowManagerDisplayRootsIfNecessary() {
- if (!init_called_ || !root_)
- return;
-
- display_manager()->OnDisplayAcceleratedWidgetAvailable(this);
- if (binding_) {
- std::unique_ptr<WindowManagerDisplayRoot> display_root_ptr(
- new WindowManagerDisplayRoot(this));
- WindowManagerDisplayRoot* display_root = display_root_ptr.get();
- // For this case we never create additional displays roots, so any
- // id works.
- window_manager_display_root_map_[shell::mojom::kRootUserID] =
- std::move(display_root_ptr);
- WindowTree* window_tree = binding_->CreateWindowTree(display_root->root());
- display_root->window_manager_state_ = window_tree->window_manager_state();
- } else {
- CreateWindowManagerDisplayRootsFromFactories();
- }
-}
-
-void Display::CreateWindowManagerDisplayRootsFromFactories() {
- std::vector<WindowManagerWindowTreeFactory*> factories =
- window_server_->window_manager_window_tree_factory_set()->GetFactories();
- for (WindowManagerWindowTreeFactory* factory : factories) {
- if (factory->window_tree())
- CreateWindowManagerDisplayRootFromFactory(factory);
- }
-}
-
-void Display::CreateWindowManagerDisplayRootFromFactory(
- WindowManagerWindowTreeFactory* factory) {
- std::unique_ptr<WindowManagerDisplayRoot> display_root_ptr(
- new WindowManagerDisplayRoot(this));
- WindowManagerDisplayRoot* display_root = display_root_ptr.get();
- window_manager_display_root_map_[factory->user_id()] =
- std::move(display_root_ptr);
- display_root->window_manager_state_ =
- factory->window_tree()->window_manager_state();
- const bool is_active =
- factory->user_id() == window_server_->user_id_tracker()->active_id();
- display_root->root()->SetVisible(is_active);
- display_root->window_manager_state()->window_tree()->AddRootForWindowManager(
- display_root->root());
-}
-
-ServerWindow* Display::GetRootWindow() {
- return root_.get();
-}
-
-void Display::OnEvent(const ui::Event& event) {
- WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot();
- if (display_root)
- display_root->window_manager_state()->ProcessEvent(event);
- window_server_
- ->GetUserActivityMonitorForUser(
- window_server_->user_id_tracker()->active_id())
- ->OnUserActivity();
-}
-
-void Display::OnNativeCaptureLost() {
- WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot();
- if (display_root)
- display_root->window_manager_state()->SetCapture(nullptr, kInvalidClientId);
-}
-
-void Display::OnDisplayClosed() {
- display_manager()->DestroyDisplay(this);
-}
-
-void Display::OnViewportMetricsChanged(const ViewportMetrics& old_metrics,
- const ViewportMetrics& new_metrics) {
- if (!root_) {
- root_.reset(window_server_->CreateServerWindow(
- display_manager()->GetAndAdvanceNextRootId(),
- ServerWindow::Properties()));
- root_->SetBounds(gfx::Rect(new_metrics.size_in_pixels));
- root_->SetVisible(true);
- focus_controller_.reset(new FocusController(this, root_.get()));
- focus_controller_->AddObserver(this);
- InitWindowManagerDisplayRootsIfNecessary();
- } else {
- root_->SetBounds(gfx::Rect(new_metrics.size_in_pixels));
- const gfx::Rect wm_bounds(root_->bounds().size());
- for (auto& pair : window_manager_display_root_map_)
- pair.second->root()->SetBounds(wm_bounds);
- }
- display_manager()->OnDisplayUpdate(this);
-}
-
-void Display::OnCompositorFrameDrawn() {
- std::set<ServerWindow*> windows;
- windows.swap(windows_needing_frame_destruction_);
- for (ServerWindow* window : windows) {
- window->RemoveObserver(this);
- window->DestroySurfacesScheduledForDestruction();
- }
-}
-
-bool Display::CanHaveActiveChildren(ServerWindow* window) const {
- return window && activation_parents_.Contains(window);
-}
-
-void Display::OnActivationChanged(ServerWindow* old_active_window,
- ServerWindow* new_active_window) {
- DCHECK_NE(new_active_window, old_active_window);
- if (new_active_window && new_active_window->parent()) {
- // Raise the new active window.
- // TODO(sad): Let the WM dictate whether to raise the window or not?
- new_active_window->parent()->StackChildAtTop(new_active_window);
- }
-}
-
-void Display::OnFocusChanged(FocusControllerChangeSource change_source,
- ServerWindow* old_focused_window,
- ServerWindow* new_focused_window) {
- // TODO(sky): focus is global, not per windowtreehost. Move.
-
- // There are up to four clients that need to be notified:
- // . the client containing |old_focused_window|.
- // . the client with |old_focused_window| as its root.
- // . the client containing |new_focused_window|.
- // . the client with |new_focused_window| as its root.
- // Some of these client may be the same. The following takes care to notify
- // each only once.
- WindowTree* owning_tree_old = nullptr;
- WindowTree* embedded_tree_old = nullptr;
-
- if (old_focused_window) {
- owning_tree_old =
- window_server_->GetTreeWithId(old_focused_window->id().client_id);
- if (owning_tree_old) {
- owning_tree_old->ProcessFocusChanged(old_focused_window,
- new_focused_window);
- }
- embedded_tree_old = window_server_->GetTreeWithRoot(old_focused_window);
- if (embedded_tree_old) {
- DCHECK_NE(owning_tree_old, embedded_tree_old);
- embedded_tree_old->ProcessFocusChanged(old_focused_window,
- new_focused_window);
- }
- }
- WindowTree* owning_tree_new = nullptr;
- WindowTree* embedded_tree_new = nullptr;
- if (new_focused_window) {
- owning_tree_new =
- window_server_->GetTreeWithId(new_focused_window->id().client_id);
- if (owning_tree_new && owning_tree_new != owning_tree_old &&
- owning_tree_new != embedded_tree_old) {
- owning_tree_new->ProcessFocusChanged(old_focused_window,
- new_focused_window);
- }
- embedded_tree_new = window_server_->GetTreeWithRoot(new_focused_window);
- if (embedded_tree_new && embedded_tree_new != owning_tree_old &&
- embedded_tree_new != embedded_tree_old) {
- DCHECK_NE(owning_tree_new, embedded_tree_new);
- embedded_tree_new->ProcessFocusChanged(old_focused_window,
- new_focused_window);
- }
- }
-
- // WindowManagers are always notified of focus changes.
- WindowManagerDisplayRoot* display_root = GetActiveWindowManagerDisplayRoot();
- if (display_root) {
- WindowTree* wm_tree = display_root->window_manager_state()->window_tree();
- if (wm_tree != owning_tree_old && wm_tree != embedded_tree_old &&
- wm_tree != owning_tree_new && wm_tree != embedded_tree_new) {
- wm_tree->ProcessFocusChanged(old_focused_window, new_focused_window);
- }
- }
-
- UpdateTextInputState(new_focused_window,
- new_focused_window->text_input_state());
-}
-
-void Display::OnWindowDestroyed(ServerWindow* window) {
- windows_needing_frame_destruction_.erase(window);
- window->RemoveObserver(this);
-}
-
-void Display::OnUserIdRemoved(const UserId& id) {
- window_manager_display_root_map_.erase(id);
-}
-
-void Display::OnWindowManagerWindowTreeFactoryReady(
- WindowManagerWindowTreeFactory* factory) {
- if (!binding_)
- CreateWindowManagerDisplayRootFromFactory(factory);
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/display.h b/chromium/components/mus/ws/display.h
deleted file mode 100644
index 419b1909c03..00000000000
--- a/chromium/components/mus/ws/display.h
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_DISPLAY_H_
-#define COMPONENTS_MUS_WS_DISPLAY_H_
-
-#include <stdint.h>
-
-#include <map>
-#include <memory>
-#include <queue>
-#include <set>
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "components/mus/common/types.h"
-#include "components/mus/public/interfaces/window_manager_constants.mojom.h"
-#include "components/mus/public/interfaces/window_tree_host.mojom.h"
-#include "components/mus/ws/focus_controller_delegate.h"
-#include "components/mus/ws/focus_controller_observer.h"
-#include "components/mus/ws/platform_display.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_observer.h"
-#include "components/mus/ws/server_window_tracker.h"
-#include "components/mus/ws/user_id_tracker_observer.h"
-#include "components/mus/ws/window_manager_window_tree_factory_set_observer.h"
-
-namespace mus {
-namespace ws {
-
-class DisplayBinding;
-class DisplayManager;
-class FocusController;
-struct PlatformDisplayInitParams;
-class WindowManagerDisplayRoot;
-class WindowServer;
-class WindowTree;
-
-namespace test {
-class DisplayTestApi;
-}
-
-// Displays manages the state associated with a single display. Display has a
-// single root window whose children are the roots for a per-user
-// WindowManager. Display is configured in two distinct
-// ways:
-// . with a DisplayBinding. In this mode there is only ever one WindowManager
-// for the display, which comes from the client that created the
-// Display.
-// . without a DisplayBinding. In this mode a WindowManager is automatically
-// created per user.
-class Display : public PlatformDisplayDelegate,
- public mojom::WindowTreeHost,
- public FocusControllerObserver,
- public FocusControllerDelegate,
- public ServerWindowObserver,
- public UserIdTrackerObserver,
- public WindowManagerWindowTreeFactorySetObserver {
- public:
- Display(WindowServer* window_server,
- const PlatformDisplayInitParams& platform_display_init_params);
- ~Display() override;
-
- // Initializes state that depends on the existence of a Display.
- void Init(std::unique_ptr<DisplayBinding> binding);
-
- uint32_t id() const { return id_; }
-
- DisplayManager* display_manager();
- const DisplayManager* display_manager() const;
-
- PlatformDisplay* platform_display() { return platform_display_.get(); }
-
- // Returns a mojom::Display for the specified display. WindowManager specific
- // values are not set.
- mojom::DisplayPtr ToMojomDisplay() const;
-
- // Schedules a paint for the specified region in the coordinates of |window|.
- void SchedulePaint(const ServerWindow* window, const gfx::Rect& bounds);
-
- // Schedules destruction of surfaces in |window|. If a frame has been
- // scheduled but not drawn surface destruction is delayed until the frame is
- // drawn, otherwise destruction is immediate.
- void ScheduleSurfaceDestruction(ServerWindow* window);
-
- mojom::Rotation GetRotation() const;
- gfx::Size GetSize() const;
-
- // Returns the id for the corresponding id.
- int64_t GetPlatformDisplayId() const;
-
- WindowServer* window_server() { return window_server_; }
-
- // Returns the root of the Display. The root's children are the roots
- // of the corresponding WindowManagers.
- ServerWindow* root_window() { return root_.get(); }
- const ServerWindow* root_window() const { return root_.get(); }
-
- // Returns the ServerWindow whose id is |id|. This does not do a search over
- // all windows, rather just the display and window manager root windows.
- //
- // In general you shouldn't use this, rather use WindowServer::GetWindow(),
- // which calls this as necessary.
- ServerWindow* GetRootWithId(const WindowId& id);
-
- WindowManagerDisplayRoot* GetWindowManagerDisplayRootWithRoot(
- const ServerWindow* window);
- WindowManagerDisplayRoot* GetWindowManagerDisplayRootForUser(
- const UserId& user_id) {
- return const_cast<WindowManagerDisplayRoot*>(
- const_cast<const Display*>(this)->GetWindowManagerDisplayRootForUser(
- user_id));
- }
- const WindowManagerDisplayRoot* GetWindowManagerDisplayRootForUser(
- const UserId& user_id) const;
- WindowManagerDisplayRoot* GetActiveWindowManagerDisplayRoot() {
- return const_cast<WindowManagerDisplayRoot*>(
- const_cast<const Display*>(this)->GetActiveWindowManagerDisplayRoot());
- }
- const WindowManagerDisplayRoot* GetActiveWindowManagerDisplayRoot() const;
- size_t num_window_manger_states() const {
- return window_manager_display_root_map_.size();
- }
-
- // TODO(sky): this should only be called by WindowServer, move to interface
- // used by WindowServer.
- // See description of WindowServer::SetFocusedWindow() for details on return
- // value.
- bool SetFocusedWindow(ServerWindow* window);
- // NOTE: this returns the focused window only if the focused window is in this
- // display. If this returns null focus may be in another display.
- ServerWindow* GetFocusedWindow();
-
- void ActivateNextWindow();
-
- void AddActivationParent(ServerWindow* window);
- void RemoveActivationParent(ServerWindow* window);
-
- void UpdateTextInputState(ServerWindow* window,
- const ui::TextInputState& state);
- void SetImeVisibility(ServerWindow* window, bool visible);
-
- // Called just before |tree| is destroyed.
- void OnWillDestroyTree(WindowTree* tree);
-
- void UpdateNativeCursor(int32_t cursor_id);
-
- // mojom::WindowTreeHost:
- void SetSize(const gfx::Size& size) override;
- void SetTitle(const mojo::String& title) override;
-
- private:
- friend class test::DisplayTestApi;
-
- using WindowManagerDisplayRootMap =
- std::map<UserId, std::unique_ptr<WindowManagerDisplayRoot>>;
-
- // Inits the necessary state once the display is ready.
- void InitWindowManagerDisplayRootsIfNecessary();
-
- // Creates the set of WindowManagerDisplayRoots from the
- // WindowManagerWindowTreeFactorySet.
- void CreateWindowManagerDisplayRootsFromFactories();
-
- void CreateWindowManagerDisplayRootFromFactory(
- WindowManagerWindowTreeFactory* factory);
-
- // PlatformDisplayDelegate:
- ServerWindow* GetRootWindow() override;
- void OnEvent(const ui::Event& event) override;
- void OnNativeCaptureLost() override;
- void OnDisplayClosed() override;
- void OnViewportMetricsChanged(const ViewportMetrics& old_metrics,
- const ViewportMetrics& new_metrics) override;
- void OnCompositorFrameDrawn() override;
-
- // FocusControllerDelegate:
- bool CanHaveActiveChildren(ServerWindow* window) const override;
-
- // FocusControllerObserver:
- void OnActivationChanged(ServerWindow* old_active_window,
- ServerWindow* new_active_window) override;
- void OnFocusChanged(FocusControllerChangeSource change_source,
- ServerWindow* old_focused_window,
- ServerWindow* new_focused_window) override;
-
- // ServerWindowObserver:
- void OnWindowDestroyed(ServerWindow* window) override;
-
- // UserIdTrackerObserver:
- void OnUserIdRemoved(const UserId& id) override;
-
- // WindowManagerWindowTreeFactorySetObserver:
- void OnWindowManagerWindowTreeFactoryReady(
- WindowManagerWindowTreeFactory* factory) override;
-
- const uint32_t id_;
- std::unique_ptr<DisplayBinding> binding_;
- // Set once Init() has been called.
- bool init_called_ = false;
- WindowServer* const window_server_;
- std::unique_ptr<ServerWindow> root_;
- std::unique_ptr<PlatformDisplay> platform_display_;
- std::unique_ptr<FocusController> focus_controller_;
-
- // The last cursor set. Used to track whether we need to change the cursor.
- int32_t last_cursor_;
-
- ServerWindowTracker activation_parents_;
-
- // Set of windows with surfaces that need to be destroyed once the frame
- // draws.
- std::set<ServerWindow*> windows_needing_frame_destruction_;
-
- WindowManagerDisplayRootMap window_manager_display_root_map_;
-
- DISALLOW_COPY_AND_ASSIGN(Display);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_DISPLAY_H_
diff --git a/chromium/components/mus/ws/display_binding.cc b/chromium/components/mus/ws/display_binding.cc
deleted file mode 100644
index 519bef4a2f8..00000000000
--- a/chromium/components/mus/ws/display_binding.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/display_binding.h"
-
-#include "base/memory/ptr_util.h"
-#include "components/mus/ws/display.h"
-#include "components/mus/ws/window_manager_access_policy.h"
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_tree.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-
-namespace mus {
-namespace ws {
-
-DisplayBindingImpl::DisplayBindingImpl(mojom::WindowTreeHostRequest request,
- Display* display,
- const UserId& user_id,
- mojom::WindowTreeClientPtr client,
- WindowServer* window_server)
- : window_server_(window_server),
- user_id_(user_id),
- binding_(display, std::move(request)),
- client_(std::move(client)) {}
-
-DisplayBindingImpl::~DisplayBindingImpl() {}
-
-WindowTree* DisplayBindingImpl::CreateWindowTree(ServerWindow* root) {
- const uint32_t embed_flags = 0;
- WindowTree* tree = window_server_->EmbedAtWindow(
- root, user_id_, std::move(client_), embed_flags,
- base::WrapUnique(new WindowManagerAccessPolicy));
- tree->ConfigureWindowManager();
- return tree;
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/display_binding.h b/chromium/components/mus/ws/display_binding.h
deleted file mode 100644
index e1f46124870..00000000000
--- a/chromium/components/mus/ws/display_binding.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_DISPLAY_BINDING_H_
-#define COMPONENTS_MUS_WS_DISPLAY_BINDING_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "components/mus/public/interfaces/window_tree_host.mojom.h"
-#include "components/mus/ws/display.h"
-#include "components/mus/ws/user_id.h"
-#include "mojo/public/cpp/bindings/binding.h"
-
-namespace mus {
-namespace ws {
-
-class ServerWindow;
-class WindowServer;
-class WindowTree;
-
-// DisplayBinding manages the binding between a Display and it's mojo clients.
-// DisplayBinding is used when a Display is created via a
-// WindowTreeHostFactory.
-//
-// DisplayBinding is owned by Display.
-class DisplayBinding {
- public:
- virtual ~DisplayBinding() {}
-
- virtual WindowTree* CreateWindowTree(ServerWindow* root) = 0;
-};
-
-// Live implementation of DisplayBinding.
-class DisplayBindingImpl : public DisplayBinding {
- public:
- DisplayBindingImpl(mojom::WindowTreeHostRequest request,
- Display* display,
- const UserId& user_id,
- mojom::WindowTreeClientPtr client,
- WindowServer* window_server);
- ~DisplayBindingImpl() override;
-
- private:
- // DisplayBinding:
- WindowTree* CreateWindowTree(ServerWindow* root) override;
-
- WindowServer* window_server_;
- const UserId user_id_;
- mojo::Binding<mojom::WindowTreeHost> binding_;
- mojom::WindowTreeClientPtr client_;
-
- DISALLOW_COPY_AND_ASSIGN(DisplayBindingImpl);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_DISPLAY_BINDING_H_
diff --git a/chromium/components/mus/ws/display_manager.cc b/chromium/components/mus/ws/display_manager.cc
deleted file mode 100644
index d5554093ec1..00000000000
--- a/chromium/components/mus/ws/display_manager.cc
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/display_manager.h"
-
-#include "base/memory/ptr_util.h"
-#include "components/mus/ws/display.h"
-#include "components/mus/ws/display_manager_delegate.h"
-#include "components/mus/ws/event_dispatcher.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/user_display_manager.h"
-#include "components/mus/ws/user_id_tracker.h"
-#include "components/mus/ws/window_manager_state.h"
-
-namespace mus {
-namespace ws {
-
-DisplayManager::DisplayManager(DisplayManagerDelegate* delegate,
- UserIdTracker* user_id_tracker)
- // |next_root_id_| is used as the lower bits, so that starting at 0 is
- // fine. |next_display_id_| is used by itself, so we start at 1 to reserve
- // 0 as invalid.
- : delegate_(delegate),
- user_id_tracker_(user_id_tracker),
- next_root_id_(0),
- next_display_id_(1) {
- user_id_tracker_->AddObserver(this);
-}
-
-DisplayManager::~DisplayManager() {
- user_id_tracker_->RemoveObserver(this);
- DestroyAllDisplays();
-}
-
-UserDisplayManager* DisplayManager::GetUserDisplayManager(
- const UserId& user_id) {
- if (!user_display_managers_.count(user_id)) {
- user_display_managers_[user_id] =
- base::WrapUnique(new UserDisplayManager(this, delegate_, user_id));
- }
- return user_display_managers_[user_id].get();
-}
-
-void DisplayManager::AddDisplay(Display* display) {
- DCHECK_EQ(0u, pending_displays_.count(display));
- pending_displays_.insert(display);
-}
-
-void DisplayManager::DestroyDisplay(Display* display) {
- if (pending_displays_.count(display)) {
- pending_displays_.erase(display);
- } else {
- for (const auto& pair : user_display_managers_)
- pair.second->OnWillDestroyDisplay(display);
-
- DCHECK(displays_.count(display));
- displays_.erase(display);
- }
- delete display;
-
- // If we have no more roots left, let the app know so it can terminate.
- // TODO(sky): move to delegate/observer.
- if (!displays_.size() && !pending_displays_.size())
- delegate_->OnNoMoreDisplays();
-}
-
-void DisplayManager::DestroyAllDisplays() {
- while (!pending_displays_.empty())
- DestroyDisplay(*pending_displays_.begin());
- DCHECK(pending_displays_.empty());
-
- while (!displays_.empty())
- DestroyDisplay(*displays_.begin());
- DCHECK(displays_.empty());
-}
-
-std::set<const Display*> DisplayManager::displays() const {
- std::set<const Display*> ret_value(displays_.begin(), displays_.end());
- return ret_value;
-}
-
-void DisplayManager::OnDisplayUpdate(Display* display) {
- for (const auto& pair : user_display_managers_)
- pair.second->OnDisplayUpdate(display);
-}
-
-Display* DisplayManager::GetDisplayContaining(ServerWindow* window) {
- return const_cast<Display*>(
- static_cast<const DisplayManager*>(this)->GetDisplayContaining(window));
-}
-
-const Display* DisplayManager::GetDisplayContaining(
- const ServerWindow* window) const {
- while (window && window->parent())
- window = window->parent();
- for (Display* display : displays_) {
- if (window == display->root_window())
- return display;
- }
- return nullptr;
-}
-
-const WindowManagerDisplayRoot* DisplayManager::GetWindowManagerDisplayRoot(
- const ServerWindow* window) const {
- const ServerWindow* last = window;
- while (window && window->parent()) {
- last = window;
- window = window->parent();
- }
- for (Display* display : displays_) {
- if (window == display->root_window())
- return display->GetWindowManagerDisplayRootWithRoot(last);
- }
- return nullptr;
-}
-
-WindowManagerDisplayRoot* DisplayManager::GetWindowManagerDisplayRoot(
- const ServerWindow* window) {
- return const_cast<WindowManagerDisplayRoot*>(
- const_cast<const DisplayManager*>(this)->GetWindowManagerDisplayRoot(
- window));
-}
-
-WindowId DisplayManager::GetAndAdvanceNextRootId() {
- // TODO(sky): handle wrapping!
- const uint16_t id = next_root_id_++;
- DCHECK_LT(id, next_root_id_);
- return RootWindowId(id);
-}
-
-uint32_t DisplayManager::GetAndAdvanceNextDisplayId() {
- // TODO(sky): handle wrapping!
- const uint32_t id = next_display_id_++;
- DCHECK_LT(id, next_display_id_);
- return id;
-}
-
-void DisplayManager::OnDisplayAcceleratedWidgetAvailable(Display* display) {
- DCHECK_NE(0u, pending_displays_.count(display));
- DCHECK_EQ(0u, displays_.count(display));
- const bool is_first_display = displays_.empty();
- displays_.insert(display);
- pending_displays_.erase(display);
- if (is_first_display)
- delegate_->OnFirstDisplayReady();
-}
-
-void DisplayManager::OnActiveUserIdChanged(const UserId& previously_active_id,
- const UserId& active_id) {
- WindowManagerState* previous_window_manager_state =
- delegate_->GetWindowManagerStateForUser(previously_active_id);
- gfx::Point mouse_location_on_screen;
- if (previous_window_manager_state) {
- mouse_location_on_screen = previous_window_manager_state->event_dispatcher()
- ->mouse_pointer_last_location();
- previous_window_manager_state->Deactivate();
- }
-
- WindowManagerState* current_window_manager_state =
- delegate_->GetWindowManagerStateForUser(active_id);
- if (current_window_manager_state)
- current_window_manager_state->Activate(mouse_location_on_screen);
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/display_manager.h b/chromium/components/mus/ws/display_manager.h
deleted file mode 100644
index 0c01f217e31..00000000000
--- a/chromium/components/mus/ws/display_manager.h
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_
-#define COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_
-
-#include <map>
-#include <memory>
-#include <set>
-
-#include "base/macros.h"
-#include "components/mus/ws/ids.h"
-#include "components/mus/ws/user_id.h"
-#include "components/mus/ws/user_id_tracker_observer.h"
-
-namespace mus {
-namespace ws {
-
-class Display;
-class DisplayManagerDelegate;
-class ServerWindow;
-class UserDisplayManager;
-class UserIdTracker;
-class WindowManagerDisplayRoot;
-
-// DisplayManager manages the set of Displays. DisplayManager distinguishes
-// between displays that do yet have an accelerated widget (pending), vs
-// those that do.
-class DisplayManager : public UserIdTrackerObserver {
- public:
- DisplayManager(DisplayManagerDelegate* delegate,
- UserIdTracker* user_id_tracker);
- ~DisplayManager() override;
-
- // Returns the UserDisplayManager for |user_id|. DisplayManager owns the
- // return value.
- UserDisplayManager* GetUserDisplayManager(const UserId& user_id);
-
- // Adds/removes a Display. DisplayManager owns the Displays.
- // TODO(sky): make add take a scoped_ptr.
- void AddDisplay(Display* display);
- void DestroyDisplay(Display* display);
- void DestroyAllDisplays();
- const std::set<Display*>& displays() { return displays_; }
- std::set<const Display*> displays() const;
-
- // Notifies when something about the Display changes.
- void OnDisplayUpdate(Display* display);
-
- // Returns the Display that contains |window|, or null if |window| is not
- // attached to a display.
- Display* GetDisplayContaining(ServerWindow* window);
- const Display* GetDisplayContaining(const ServerWindow* window) const;
-
- const WindowManagerDisplayRoot* GetWindowManagerDisplayRoot(
- const ServerWindow* window) const;
- // TODO(sky): constness here is wrong! fix!
- WindowManagerDisplayRoot* GetWindowManagerDisplayRoot(
- const ServerWindow* window);
-
- bool has_displays() const { return !displays_.empty(); }
- bool has_active_or_pending_displays() const {
- return !displays_.empty() || !pending_displays_.empty();
- }
-
- // Returns the id for the next root window (both for the root of a Display
- // as well as the root of WindowManagers).
- WindowId GetAndAdvanceNextRootId();
-
- uint32_t GetAndAdvanceNextDisplayId();
-
- // Called when the AcceleratedWidget is available for |display|.
- void OnDisplayAcceleratedWidgetAvailable(Display* display);
-
- private:
- // UserIdTrackerObserver:
- void OnActiveUserIdChanged(const UserId& previously_active_id,
- const UserId& active_id) override;
-
- DisplayManagerDelegate* delegate_;
- UserIdTracker* user_id_tracker_;
-
- // Displays are initially added to |pending_displays_|. When the display is
- // initialized it is moved to |displays_|. WindowServer owns the Displays.
- std::set<Display*> pending_displays_;
- std::set<Display*> displays_;
-
- std::map<UserId, std::unique_ptr<UserDisplayManager>> user_display_managers_;
-
- // ID to use for next root node.
- ClientSpecificId next_root_id_;
-
- uint32_t next_display_id_;
-
- DISALLOW_COPY_AND_ASSIGN(DisplayManager);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_DISPLAY_MANAGER_H_
diff --git a/chromium/components/mus/ws/display_manager_delegate.h b/chromium/components/mus/ws/display_manager_delegate.h
deleted file mode 100644
index 9d59e2fba8b..00000000000
--- a/chromium/components/mus/ws/display_manager_delegate.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_DISPLAY_MANAGER_DELEGATE_H_
-#define COMPONENTS_MUS_WS_DISPLAY_MANAGER_DELEGATE_H_
-
-#include "components/mus/public/interfaces/display.mojom.h"
-#include "components/mus/ws/user_id.h"
-
-namespace mus {
-namespace ws {
-
-class Display;
-class WindowManagerState;
-
-class DisplayManagerDelegate {
- public:
- virtual void OnFirstDisplayReady() = 0;
- virtual void OnNoMoreDisplays() = 0;
-
- // Gets the frame decorations for the specified user. Returns true if the
- // decorations have been set, false otherwise. |values| may be null.
- virtual bool GetFrameDecorationsForUser(
- const UserId& user_id,
- mojom::FrameDecorationValuesPtr* values) = 0;
-
- virtual WindowManagerState* GetWindowManagerStateForUser(
- const UserId& user_id) = 0;
-
- protected:
- virtual ~DisplayManagerDelegate() {}
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_DISPLAY_MANAGER_DELEGATE_H_
diff --git a/chromium/components/mus/ws/display_unittest.cc b/chromium/components/mus/ws/display_unittest.cc
deleted file mode 100644
index dfc24ef25a8..00000000000
--- a/chromium/components/mus/ws/display_unittest.cc
+++ /dev/null
@@ -1,308 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <stdint.h>
-
-#include <string>
-
-#include "base/macros.h"
-#include "base/message_loop/message_loop.h"
-#include "components/mus/common/types.h"
-#include "components/mus/common/util.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "components/mus/ws/display_manager.h"
-#include "components/mus/ws/ids.h"
-#include "components/mus/ws/platform_display.h"
-#include "components/mus/ws/platform_display_factory.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/test_utils.h"
-#include "components/mus/ws/window_manager_display_root.h"
-#include "components/mus/ws/window_manager_state.h"
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_server_delegate.h"
-#include "components/mus/ws/window_tree.h"
-#include "components/mus/ws/window_tree_binding.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/events/event.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace mus {
-namespace ws {
-namespace test {
-namespace {
-
-const UserId kTestId1 = "2";
-const UserId kTestId2 = "21";
-
-ClientWindowId ClientWindowIdForFirstRoot(WindowTree* tree) {
- if (tree->roots().empty())
- return ClientWindowId();
- return ClientWindowIdForWindow(tree, *tree->roots().begin());
-}
-
-WindowManagerState* GetWindowManagerStateForUser(Display* display,
- const UserId& user_id) {
- WindowManagerDisplayRoot* display_root =
- display->GetWindowManagerDisplayRootForUser(user_id);
- return display_root ? display_root->window_manager_state() : nullptr;
-}
-
-} // namespace
-
-// -----------------------------------------------------------------------------
-
-class DisplayTest : public testing::Test {
- public:
- DisplayTest() : cursor_id_(0), platform_display_factory_(&cursor_id_) {}
- ~DisplayTest() override {}
-
- protected:
- // testing::Test:
- void SetUp() override {
- PlatformDisplay::set_factory_for_testing(&platform_display_factory_);
- window_server_.reset(new WindowServer(&window_server_delegate_,
- scoped_refptr<SurfacesState>()));
- window_server_delegate_.set_window_server(window_server_.get());
- window_server_->user_id_tracker()->AddUserId(kTestId1);
- window_server_->user_id_tracker()->AddUserId(kTestId2);
- }
-
- protected:
- int32_t cursor_id_;
- TestPlatformDisplayFactory platform_display_factory_;
- TestWindowServerDelegate window_server_delegate_;
- std::unique_ptr<WindowServer> window_server_;
- base::MessageLoop message_loop_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(DisplayTest);
-};
-
-TEST_F(DisplayTest, CallsCreateDefaultDisplays) {
- const int kNumHostsToCreate = 2;
- window_server_delegate_.set_num_displays_to_create(kNumHostsToCreate);
-
- DisplayManager* display_manager = window_server_->display_manager();
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kTestId1);
- // The first register should trigger creation of the default
- // Displays. There should be kNumHostsToCreate Displays.
- EXPECT_EQ(static_cast<size_t>(kNumHostsToCreate),
- display_manager->displays().size());
-
- // Each host should have a WindowManagerState for kTestId1.
- for (Display* display : display_manager->displays()) {
- EXPECT_EQ(1u, display->num_window_manger_states());
- EXPECT_TRUE(GetWindowManagerStateForUser(display, kTestId1));
- EXPECT_FALSE(GetWindowManagerStateForUser(display, kTestId2));
- }
-
- // Add another registry, should trigger creation of another wm.
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kTestId2);
- for (Display* display : display_manager->displays()) {
- ASSERT_EQ(2u, display->num_window_manger_states());
- WindowManagerDisplayRoot* root1 =
- display->GetWindowManagerDisplayRootForUser(kTestId1);
- ASSERT_TRUE(root1);
- WindowManagerDisplayRoot* root2 =
- display->GetWindowManagerDisplayRootForUser(kTestId2);
- ASSERT_TRUE(root2);
- // Verify the two states have different roots.
- EXPECT_NE(root1, root2);
- EXPECT_NE(root1->root(), root2->root());
- }
-}
-
-TEST_F(DisplayTest, Destruction) {
- window_server_delegate_.set_num_displays_to_create(1);
-
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kTestId1);
-
- // Add another registry, should trigger creation of another wm.
- DisplayManager* display_manager = window_server_->display_manager();
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kTestId2);
- ASSERT_EQ(1u, display_manager->displays().size());
- Display* display = *display_manager->displays().begin();
- ASSERT_EQ(2u, display->num_window_manger_states());
- // There should be two trees, one for each windowmanager.
- EXPECT_EQ(2u, window_server_->num_trees());
-
- {
- WindowManagerState* state = GetWindowManagerStateForUser(display, kTestId1);
- // Destroy the tree associated with |state|. Should result in deleting
- // |state|.
- window_server_->DestroyTree(state->window_tree());
- ASSERT_EQ(1u, display->num_window_manger_states());
- EXPECT_FALSE(GetWindowManagerStateForUser(display, kTestId1));
- EXPECT_EQ(1u, display_manager->displays().size());
- EXPECT_EQ(1u, window_server_->num_trees());
- }
-
- EXPECT_FALSE(window_server_delegate_.got_on_no_more_displays());
- window_server_->display_manager()->DestroyDisplay(display);
- // There is still one tree left.
- EXPECT_EQ(1u, window_server_->num_trees());
- EXPECT_TRUE(window_server_delegate_.got_on_no_more_displays());
-}
-
-TEST_F(DisplayTest, EventStateResetOnUserSwitch) {
- window_server_delegate_.set_num_displays_to_create(1);
-
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kTestId1);
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kTestId2);
-
- window_server_->user_id_tracker()->SetActiveUserId(kTestId1);
-
- DisplayManager* display_manager = window_server_->display_manager();
- ASSERT_EQ(1u, display_manager->displays().size());
- Display* display = *display_manager->displays().begin();
- WindowManagerState* active_wms =
- display->GetActiveWindowManagerDisplayRoot()->window_manager_state();
- ASSERT_TRUE(active_wms);
- EXPECT_EQ(kTestId1, active_wms->user_id());
-
- static_cast<PlatformDisplayDelegate*>(display)->OnEvent(ui::PointerEvent(
- ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(20, 25),
- gfx::Point(20, 25), base::TimeTicks(),
- ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON)));
-
- EXPECT_TRUE(EventDispatcherTestApi(active_wms->event_dispatcher())
- .AreAnyPointersDown());
- EXPECT_EQ(gfx::Point(20, 25),
- active_wms->event_dispatcher()->mouse_pointer_last_location());
-
- // Switch the user. Should trigger resetting state in old event dispatcher
- // and update state in new event dispatcher.
- window_server_->user_id_tracker()->SetActiveUserId(kTestId2);
- EXPECT_NE(
- active_wms,
- display->GetActiveWindowManagerDisplayRoot()->window_manager_state());
- EXPECT_FALSE(EventDispatcherTestApi(active_wms->event_dispatcher())
- .AreAnyPointersDown());
- active_wms =
- display->GetActiveWindowManagerDisplayRoot()->window_manager_state();
- EXPECT_EQ(kTestId2, active_wms->user_id());
- EXPECT_EQ(gfx::Point(20, 25),
- active_wms->event_dispatcher()->mouse_pointer_last_location());
- EXPECT_FALSE(EventDispatcherTestApi(active_wms->event_dispatcher())
- .AreAnyPointersDown());
-}
-
-// Verifies capture fails when wm is inactive and succeeds when wm is active.
-TEST_F(DisplayTest, SetCaptureFromWindowManager) {
- window_server_delegate_.set_num_displays_to_create(1);
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kTestId1);
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kTestId2);
- window_server_->user_id_tracker()->SetActiveUserId(kTestId1);
- DisplayManager* display_manager = window_server_->display_manager();
- ASSERT_EQ(1u, display_manager->displays().size());
- Display* display = *display_manager->displays().begin();
- WindowManagerState* wms_for_id2 =
- GetWindowManagerStateForUser(display, kTestId2);
- ASSERT_TRUE(wms_for_id2);
- EXPECT_FALSE(wms_for_id2->IsActive());
-
- // Create a child of the root that we can set capture on.
- WindowTree* tree = wms_for_id2->window_tree();
- ClientWindowId child_window_id;
- ASSERT_TRUE(NewWindowInTree(tree, &child_window_id));
-
- WindowTreeTestApi(tree).EnableCapture();
-
- // SetCapture() should fail for user id2 as it is inactive.
- EXPECT_FALSE(tree->SetCapture(child_window_id));
-
- // Make the second user active and verify capture works.
- window_server_->user_id_tracker()->SetActiveUserId(kTestId2);
- EXPECT_TRUE(wms_for_id2->IsActive());
- EXPECT_TRUE(tree->SetCapture(child_window_id));
-}
-
-TEST_F(DisplayTest, FocusFailsForInactiveUser) {
- window_server_delegate_.set_num_displays_to_create(1);
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kTestId1);
- TestWindowTreeClient* window_tree_client1 =
- window_server_delegate_.last_client();
- ASSERT_TRUE(window_tree_client1);
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kTestId2);
- window_server_->user_id_tracker()->SetActiveUserId(kTestId1);
- DisplayManager* display_manager = window_server_->display_manager();
- ASSERT_EQ(1u, display_manager->displays().size());
- Display* display = *display_manager->displays().begin();
- WindowManagerState* wms_for_id2 =
- GetWindowManagerStateForUser(display, kTestId2);
- wms_for_id2->window_tree()->AddActivationParent(
- ClientWindowIdForFirstRoot(wms_for_id2->window_tree()));
- ASSERT_TRUE(wms_for_id2);
- EXPECT_FALSE(wms_for_id2->IsActive());
- ClientWindowId child2_id;
- NewWindowInTree(wms_for_id2->window_tree(), &child2_id);
-
- // Focus should fail for windows in inactive window managers.
- EXPECT_FALSE(wms_for_id2->window_tree()->SetFocus(child2_id));
-
- // Focus should succeed for the active window manager.
- WindowManagerState* wms_for_id1 =
- GetWindowManagerStateForUser(display, kTestId1);
- ASSERT_TRUE(wms_for_id1);
- wms_for_id1->window_tree()->AddActivationParent(
- ClientWindowIdForFirstRoot(wms_for_id1->window_tree()));
- ClientWindowId child1_id;
- NewWindowInTree(wms_for_id1->window_tree(), &child1_id);
- EXPECT_TRUE(wms_for_id1->IsActive());
- EXPECT_TRUE(wms_for_id1->window_tree()->SetFocus(child1_id));
-}
-
-// Verifies a single tree is used for multiple displays.
-TEST_F(DisplayTest, MultipleDisplays) {
- window_server_delegate_.set_num_displays_to_create(2);
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kTestId1);
- window_server_->user_id_tracker()->SetActiveUserId(kTestId1);
- ASSERT_EQ(1u, window_server_delegate_.bindings()->size());
- TestWindowTreeBinding* window_tree_binding =
- (*window_server_delegate_.bindings())[0];
- WindowTree* tree = window_tree_binding->tree();
- ASSERT_EQ(2u, tree->roots().size());
- std::set<const ServerWindow*> roots = tree->roots();
- auto it = roots.begin();
- ServerWindow* root1 = tree->GetWindow((*it)->id());
- ++it;
- ServerWindow* root2 = tree->GetWindow((*it)->id());
- ASSERT_NE(root1, root2);
- Display* display1 = tree->GetDisplay(root1);
- WindowManagerState* display1_wms =
- display1->GetWindowManagerDisplayRootForUser(kTestId1)
- ->window_manager_state();
- Display* display2 = tree->GetDisplay(root2);
- WindowManagerState* display2_wms =
- display2->GetWindowManagerDisplayRootForUser(kTestId1)
- ->window_manager_state();
- EXPECT_EQ(display1_wms->window_tree(), display2_wms->window_tree());
-}
-
-} // namespace test
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/event_dispatcher.cc b/chromium/components/mus/ws/event_dispatcher.cc
deleted file mode 100644
index 23874c3abc4..00000000000
--- a/chromium/components/mus/ws/event_dispatcher.cc
+++ /dev/null
@@ -1,559 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/event_dispatcher.h"
-
-#include <algorithm>
-
-#include "base/time/time.h"
-#include "components/mus/ws/accelerator.h"
-#include "components/mus/ws/display.h"
-#include "components/mus/ws/event_dispatcher_delegate.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_delegate.h"
-#include "components/mus/ws/window_coordinate_conversions.h"
-#include "components/mus/ws/window_finder.h"
-#include "ui/events/event_utils.h"
-#include "ui/gfx/geometry/point.h"
-#include "ui/gfx/geometry/point_conversions.h"
-
-namespace mus {
-namespace ws {
-
-using Entry = std::pair<uint32_t, std::unique_ptr<Accelerator>>;
-
-namespace {
-
-bool IsOnlyOneMouseButtonDown(int flags) {
- const uint32_t button_only_flags =
- flags & (ui::EF_LEFT_MOUSE_BUTTON | ui::EF_MIDDLE_MOUSE_BUTTON |
- ui::EF_RIGHT_MOUSE_BUTTON);
- return button_only_flags == ui::EF_LEFT_MOUSE_BUTTON ||
- button_only_flags == ui::EF_MIDDLE_MOUSE_BUTTON ||
- button_only_flags == ui::EF_RIGHT_MOUSE_BUTTON;
-}
-
-bool IsLocationInNonclientArea(const ServerWindow* target,
- const gfx::Point& location) {
- if (!target->parent())
- return false;
-
- gfx::Rect client_area(target->bounds().size());
- client_area.Inset(target->client_area());
- if (client_area.Contains(location))
- return false;
-
- for (const auto& rect : target->additional_client_areas()) {
- if (rect.Contains(location))
- return false;
- }
-
- return true;
-}
-
-uint32_t PointerId(const ui::LocatedEvent& event) {
- if (event.IsPointerEvent())
- return event.AsPointerEvent()->pointer_id();
- if (event.IsMouseWheelEvent())
- return ui::PointerEvent::kMousePointerId;
-
- NOTREACHED();
- return 0;
-}
-
-} // namespace
-
-////////////////////////////////////////////////////////////////////////////////
-
-EventDispatcher::EventDispatcher(EventDispatcherDelegate* delegate)
- : delegate_(delegate),
- capture_window_(nullptr),
- capture_window_client_id_(kInvalidClientId),
- modal_window_controller_(this),
- mouse_button_down_(false),
- mouse_cursor_source_window_(nullptr),
- mouse_cursor_in_non_client_area_(false) {}
-
-EventDispatcher::~EventDispatcher() {
- if (capture_window_) {
- UnobserveWindow(capture_window_);
- capture_window_ = nullptr;
- capture_window_client_id_ = kInvalidClientId;
- }
- for (const auto& pair : pointer_targets_) {
- if (pair.second.window)
- UnobserveWindow(pair.second.window);
- }
- pointer_targets_.clear();
-}
-
-void EventDispatcher::Reset() {
- if (capture_window_) {
- CancelPointerEventsToTarget(capture_window_);
- DCHECK(capture_window_ == nullptr);
- }
-
- while (!pointer_targets_.empty())
- StopTrackingPointer(pointer_targets_.begin()->first);
-
- mouse_button_down_ = false;
-}
-
-void EventDispatcher::SetMousePointerScreenLocation(
- const gfx::Point& screen_location) {
- DCHECK(pointer_targets_.empty());
- mouse_pointer_last_location_ = screen_location;
- UpdateCursorProviderByLastKnownLocation();
- // Write our initial location back to our shared screen coordinate. This
- // shouldn't cause problems because we already read the cursor before we
- // process any events in views during window construction.
- delegate_->OnMouseCursorLocationChanged(screen_location);
-}
-
-bool EventDispatcher::GetCurrentMouseCursor(int32_t* cursor_out) {
- if (!mouse_cursor_source_window_)
- return false;
-
- *cursor_out = mouse_cursor_in_non_client_area_
- ? mouse_cursor_source_window_->non_client_cursor()
- : mouse_cursor_source_window_->cursor();
- return true;
-}
-
-bool EventDispatcher::SetCaptureWindow(ServerWindow* window,
- ClientSpecificId client_id) {
- if (!window)
- client_id = kInvalidClientId;
-
- if (window == capture_window_ && client_id == capture_window_client_id_)
- return true;
-
- // A window that is blocked by a modal window cannot gain capture.
- if (window && modal_window_controller_.IsWindowBlocked(window))
- return false;
-
- if (capture_window_) {
- // Stop observing old capture window. |pointer_targets_| are cleared on
- // initial setting of a capture window.
- delegate_->OnServerWindowCaptureLost(capture_window_);
- UnobserveWindow(capture_window_);
- } else {
- // Cancel implicit capture to all other windows.
- for (const auto& pair : pointer_targets_) {
- ServerWindow* target = pair.second.window;
- if (!target)
- continue;
- UnobserveWindow(target);
- if (target == window)
- continue;
-
- ui::EventType event_type = pair.second.is_mouse_event
- ? ui::ET_POINTER_EXITED
- : ui::ET_POINTER_CANCELLED;
- ui::EventPointerType pointer_type =
- pair.second.is_mouse_event ? ui::EventPointerType::POINTER_TYPE_MOUSE
- : ui::EventPointerType::POINTER_TYPE_TOUCH;
- // TODO(jonross): Track previous location in PointerTarget for sending
- // cancels.
- ui::PointerEvent event(
- event_type, gfx::Point(), gfx::Point(), ui::EF_NONE, pair.first,
- ui::PointerDetails(pointer_type), ui::EventTimeForNow());
- DispatchToPointerTarget(pair.second, event);
- }
- pointer_targets_.clear();
- }
-
- // Set the capture before changing native capture; otherwise, the callback
- // from native platform might try to set the capture again.
- bool had_capture_window = capture_window_ != nullptr;
- capture_window_ = window;
- capture_window_client_id_ = client_id;
-
- // Begin tracking the capture window if it is not yet being observed.
- if (window) {
- ObserveWindow(window);
- // TODO(sky): this conditional is problematic for the case of capture moving
- // to a different display.
- if (!had_capture_window)
- delegate_->SetNativeCapture(window);
- } else {
- delegate_->ReleaseNativeCapture();
- if (!mouse_button_down_)
- UpdateCursorProviderByLastKnownLocation();
- }
-
- return true;
-}
-
-void EventDispatcher::AddSystemModalWindow(ServerWindow* window) {
- modal_window_controller_.AddSystemModalWindow(window);
-}
-
-void EventDispatcher::ReleaseCaptureBlockedByModalWindow(
- const ServerWindow* modal_window) {
- if (!capture_window_)
- return;
-
- if (modal_window_controller_.IsWindowBlockedBy(capture_window_,
- modal_window)) {
- SetCaptureWindow(nullptr, kInvalidClientId);
- }
-}
-
-void EventDispatcher::ReleaseCaptureBlockedByAnyModalWindow() {
- if (!capture_window_)
- return;
-
- if (modal_window_controller_.IsWindowBlocked(capture_window_))
- SetCaptureWindow(nullptr, kInvalidClientId);
-}
-
-void EventDispatcher::UpdateNonClientAreaForCurrentWindow() {
- if (mouse_cursor_source_window_) {
- gfx::Point location = mouse_pointer_last_location_;
- ServerWindow* target = FindDeepestVisibleWindowForEvents(&location);
- if (target == mouse_cursor_source_window_) {
- mouse_cursor_in_non_client_area_ =
- mouse_cursor_source_window_
- ? IsLocationInNonclientArea(mouse_cursor_source_window_, location)
- : false;
- }
- }
-}
-
-void EventDispatcher::UpdateCursorProviderByLastKnownLocation() {
- if (!mouse_button_down_) {
- gfx::Point location = mouse_pointer_last_location_;
- mouse_cursor_source_window_ = FindDeepestVisibleWindowForEvents(&location);
-
- mouse_cursor_in_non_client_area_ =
- mouse_cursor_source_window_
- ? IsLocationInNonclientArea(mouse_cursor_source_window_, location)
- : false;
- }
-}
-
-bool EventDispatcher::AddAccelerator(uint32_t id,
- mojom::EventMatcherPtr event_matcher) {
- std::unique_ptr<Accelerator> accelerator(new Accelerator(id, *event_matcher));
- // If an accelerator with the same id or matcher already exists, then abort.
- for (const auto& pair : accelerators_) {
- if (pair.first == id || accelerator->EqualEventMatcher(pair.second.get()))
- return false;
- }
- accelerators_.insert(Entry(id, std::move(accelerator)));
- return true;
-}
-
-void EventDispatcher::RemoveAccelerator(uint32_t id) {
- auto it = accelerators_.find(id);
- // Clients may pass bogus ids.
- if (it != accelerators_.end())
- accelerators_.erase(it);
-}
-
-void EventDispatcher::ProcessEvent(const ui::Event& event) {
- if (event.IsKeyEvent()) {
- const ui::KeyEvent* key_event = event.AsKeyEvent();
- if (event.type() == ui::ET_KEY_PRESSED && !key_event->is_char()) {
- Accelerator* pre_target =
- FindAccelerator(*key_event, ui::mojom::AcceleratorPhase::PRE_TARGET);
- if (pre_target) {
- delegate_->OnAccelerator(pre_target->id(), event);
- return;
- }
- }
- ProcessKeyEvent(*key_event);
- return;
- }
-
- if (event.IsPointerEvent() || event.IsMouseWheelEvent()) {
- ProcessLocatedEvent(*event.AsLocatedEvent());
- return;
- }
-
- NOTREACHED();
-}
-
-void EventDispatcher::ProcessKeyEvent(const ui::KeyEvent& event) {
- Accelerator* post_target =
- FindAccelerator(event, ui::mojom::AcceleratorPhase::POST_TARGET);
- ServerWindow* focused_window =
- delegate_->GetFocusedWindowForEventDispatcher();
- if (focused_window) {
- // Assume key events are for the client area.
- const bool in_nonclient_area = false;
- const ClientSpecificId client_id =
- delegate_->GetEventTargetClientId(focused_window, in_nonclient_area);
- delegate_->DispatchInputEventToWindow(focused_window, client_id, event,
- post_target);
- return;
- }
- delegate_->OnEventTargetNotFound(event);
- if (post_target)
- delegate_->OnAccelerator(post_target->id(), event);
-}
-
-void EventDispatcher::ProcessLocatedEvent(const ui::LocatedEvent& event) {
- DCHECK(event.IsPointerEvent() || event.IsMouseWheelEvent());
- const bool is_mouse_event =
- event.IsMousePointerEvent() || event.IsMouseWheelEvent();
-
- if (is_mouse_event) {
- mouse_pointer_last_location_ = event.location();
- delegate_->OnMouseCursorLocationChanged(event.root_location());
- }
-
- // Release capture on pointer up. For mouse we only release if there are
- // no buttons down.
- const bool is_pointer_going_up =
- (event.type() == ui::ET_POINTER_UP ||
- event.type() == ui::ET_POINTER_CANCELLED) &&
- (!is_mouse_event || IsOnlyOneMouseButtonDown(event.flags()));
-
- // Update mouse down state upon events which change it.
- if (is_mouse_event) {
- if (event.type() == ui::ET_POINTER_DOWN)
- mouse_button_down_ = true;
- else if (is_pointer_going_up)
- mouse_button_down_ = false;
- }
-
- if (capture_window_) {
- mouse_cursor_source_window_ = capture_window_;
- DispatchToClient(capture_window_, capture_window_client_id_, event);
- return;
- }
-
- const int32_t pointer_id = PointerId(event);
- if (!IsTrackingPointer(pointer_id) ||
- !pointer_targets_[pointer_id].is_pointer_down) {
- const bool any_pointers_down = AreAnyPointersDown();
- UpdateTargetForPointer(pointer_id, event);
- if (is_mouse_event)
- mouse_cursor_source_window_ = pointer_targets_[pointer_id].window;
-
- PointerTarget& pointer_target = pointer_targets_[pointer_id];
- if (pointer_target.is_pointer_down) {
- if (is_mouse_event)
- mouse_cursor_source_window_ = pointer_target.window;
- if (!any_pointers_down) {
- delegate_->SetFocusedWindowFromEventDispatcher(pointer_target.window);
- delegate_->SetNativeCapture(pointer_target.window);
- }
- }
- }
-
- // When we release the mouse button, we want the cursor to be sourced from
- // the window under the mouse pointer, even though we're sending the button
- // up event to the window that had implicit capture. We have to set this
- // before we perform dispatch because the Delegate is going to read this
- // information from us.
- if (is_pointer_going_up && is_mouse_event)
- UpdateCursorProviderByLastKnownLocation();
-
- DispatchToPointerTarget(pointer_targets_[pointer_id], event);
-
- if (is_pointer_going_up) {
- if (is_mouse_event)
- pointer_targets_[pointer_id].is_pointer_down = false;
- else
- StopTrackingPointer(pointer_id);
- if (!AreAnyPointersDown())
- delegate_->ReleaseNativeCapture();
- }
-}
-
-void EventDispatcher::StartTrackingPointer(
- int32_t pointer_id,
- const PointerTarget& pointer_target) {
- DCHECK(!IsTrackingPointer(pointer_id));
- ObserveWindow(pointer_target.window);
- pointer_targets_[pointer_id] = pointer_target;
-}
-
-void EventDispatcher::StopTrackingPointer(int32_t pointer_id) {
- DCHECK(IsTrackingPointer(pointer_id));
- ServerWindow* window = pointer_targets_[pointer_id].window;
- pointer_targets_.erase(pointer_id);
- if (window)
- UnobserveWindow(window);
-}
-
-void EventDispatcher::UpdateTargetForPointer(int32_t pointer_id,
- const ui::LocatedEvent& event) {
- if (!IsTrackingPointer(pointer_id)) {
- StartTrackingPointer(pointer_id, PointerTargetForEvent(event));
- return;
- }
-
- const PointerTarget pointer_target = PointerTargetForEvent(event);
- if (pointer_target.window == pointer_targets_[pointer_id].window &&
- pointer_target.in_nonclient_area ==
- pointer_targets_[pointer_id].in_nonclient_area) {
- // The targets are the same, only set the down state to true if necessary.
- // Down going to up is handled by ProcessLocatedEvent().
- if (pointer_target.is_pointer_down)
- pointer_targets_[pointer_id].is_pointer_down = true;
- return;
- }
-
- // The targets are changing. Send an exit if appropriate.
- if (event.IsMousePointerEvent()) {
- ui::PointerEvent exit_event(
- ui::ET_POINTER_EXITED, event.location(), event.root_location(),
- event.flags(), ui::PointerEvent::kMousePointerId,
- ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE),
- event.time_stamp());
- DispatchToPointerTarget(pointer_targets_[pointer_id], exit_event);
- }
-
- // Technically we're updating in place, but calling start then stop makes for
- // simpler code.
- StopTrackingPointer(pointer_id);
- StartTrackingPointer(pointer_id, pointer_target);
-}
-
-EventDispatcher::PointerTarget EventDispatcher::PointerTargetForEvent(
- const ui::LocatedEvent& event) {
- PointerTarget pointer_target;
- gfx::Point location(event.location());
- ServerWindow* target_window = FindDeepestVisibleWindowForEvents(&location);
- pointer_target.window =
- modal_window_controller_.GetTargetForWindow(target_window);
- pointer_target.is_mouse_event = event.IsMousePointerEvent();
- pointer_target.in_nonclient_area =
- target_window != pointer_target.window ||
- IsLocationInNonclientArea(pointer_target.window, location);
- pointer_target.is_pointer_down = event.type() == ui::ET_POINTER_DOWN;
- return pointer_target;
-}
-
-bool EventDispatcher::AreAnyPointersDown() const {
- for (const auto& pair : pointer_targets_) {
- if (pair.second.is_pointer_down)
- return true;
- }
- return false;
-}
-
-void EventDispatcher::DispatchToPointerTarget(const PointerTarget& target,
- const ui::LocatedEvent& event) {
- if (!target.window) {
- delegate_->OnEventTargetNotFound(event);
- return;
- }
-
- if (target.is_mouse_event)
- mouse_cursor_in_non_client_area_ = target.in_nonclient_area;
-
- DispatchToClient(target.window, delegate_->GetEventTargetClientId(
- target.window, target.in_nonclient_area),
- event);
-}
-
-void EventDispatcher::DispatchToClient(ServerWindow* window,
- ClientSpecificId client_id,
- const ui::LocatedEvent& event) {
- gfx::Point location(event.location());
- gfx::Transform transform(GetTransformToWindow(window));
- transform.TransformPoint(&location);
- std::unique_ptr<ui::Event> clone = ui::Event::Clone(event);
- clone->AsLocatedEvent()->set_location(location);
- // TODO(jonross): add post-target accelerator support once accelerators
- // support pointer events.
- delegate_->DispatchInputEventToWindow(window, client_id, *clone, nullptr);
-}
-
-void EventDispatcher::CancelPointerEventsToTarget(ServerWindow* window) {
- if (capture_window_ == window) {
- UnobserveWindow(window);
- capture_window_ = nullptr;
- capture_window_client_id_ = kInvalidClientId;
- mouse_button_down_ = false;
- // A window only cares to be informed that it lost capture if it explicitly
- // requested capture. A window can lose capture if another window gains
- // explicit capture.
- delegate_->OnServerWindowCaptureLost(window);
- delegate_->ReleaseNativeCapture();
- UpdateCursorProviderByLastKnownLocation();
- return;
- }
-
- for (auto& pair : pointer_targets_) {
- if (pair.second.window == window) {
- UnobserveWindow(window);
- pair.second.window = nullptr;
- }
- }
-}
-
-void EventDispatcher::ObserveWindow(ServerWindow* window) {
- auto res = observed_windows_.insert(std::make_pair(window, 0u));
- res.first->second++;
- if (res.second)
- window->AddObserver(this);
-}
-
-void EventDispatcher::UnobserveWindow(ServerWindow* window) {
- auto it = observed_windows_.find(window);
- DCHECK(it != observed_windows_.end());
- DCHECK_LT(0u, it->second);
- it->second--;
- if (!it->second) {
- window->RemoveObserver(this);
- observed_windows_.erase(it);
- }
-}
-
-Accelerator* EventDispatcher::FindAccelerator(
- const ui::KeyEvent& event,
- const ui::mojom::AcceleratorPhase phase) {
- for (const auto& pair : accelerators_) {
- if (pair.second->MatchesEvent(event, phase)) {
- return pair.second.get();
- }
- }
- return nullptr;
-}
-
-ServerWindow* EventDispatcher::FindDeepestVisibleWindowForEvents(
- gfx::Point* location) {
- ServerWindow* root = delegate_->GetRootWindowContaining(*location);
- if (!root)
- return nullptr;
-
- return mus::ws::FindDeepestVisibleWindowForEvents(root, location);
-}
-
-void EventDispatcher::OnWillChangeWindowHierarchy(ServerWindow* window,
- ServerWindow* new_parent,
- ServerWindow* old_parent) {
- // TODO(sky): moving to a different root likely needs to transfer capture.
- // TODO(sky): this isn't quite right, I think the logic should be (assuming
- // moving in same root and still drawn):
- // . if there is capture and window is still in the same root, continue
- // sending to it.
- // . if there isn't capture, then reevaluate each of the pointer targets
- // sending exit as necessary.
- // http://crbug.com/613646 .
- if (!new_parent || !new_parent->IsDrawn() ||
- new_parent->GetRoot() != old_parent->GetRoot()) {
- CancelPointerEventsToTarget(window);
- }
-}
-
-void EventDispatcher::OnWindowVisibilityChanged(ServerWindow* window) {
- CancelPointerEventsToTarget(window);
-}
-
-void EventDispatcher::OnWindowDestroyed(ServerWindow* window) {
- CancelPointerEventsToTarget(window);
-
- if (mouse_cursor_source_window_ == window)
- mouse_cursor_source_window_ = nullptr;
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/event_dispatcher.h b/chromium/components/mus/ws/event_dispatcher.h
deleted file mode 100644
index a6178073981..00000000000
--- a/chromium/components/mus/ws/event_dispatcher.h
+++ /dev/null
@@ -1,236 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_EVENT_DISPATCHER_H_
-#define COMPONENTS_MUS_WS_EVENT_DISPATCHER_H_
-
-#include <stdint.h>
-
-#include <map>
-#include <memory>
-#include <utility>
-
-#include "base/macros.h"
-#include "components/mus/common/types.h"
-#include "components/mus/public/interfaces/event_matcher.mojom.h"
-#include "components/mus/ws/modal_window_controller.h"
-#include "components/mus/ws/server_window_observer.h"
-#include "ui/gfx/geometry/rect_f.h"
-
-namespace ui {
-class Event;
-class KeyEvent;
-class LocatedEvent;
-}
-
-namespace mus {
-namespace ws {
-
-class Accelerator;
-class EventDispatcherDelegate;
-class ServerWindow;
-
-namespace test {
-class EventDispatcherTestApi;
-}
-
-// Handles dispatching events to the right location as well as updating focus.
-class EventDispatcher : public ServerWindowObserver {
- public:
- explicit EventDispatcher(EventDispatcherDelegate* delegate);
- ~EventDispatcher() override;
-
- // Cancels capture and stops tracking any pointer events. This does not send
- // any events to the delegate.
- void Reset();
-
- void SetMousePointerScreenLocation(const gfx::Point& screen_location);
- const gfx::Point& mouse_pointer_last_location() const {
- return mouse_pointer_last_location_;
- }
-
- // If we still have the window of the last mouse move, returns true and sets
- // the current cursor to use to |cursor_out|.
- bool GetCurrentMouseCursor(int32_t* cursor_out);
-
- // |capture_window_| will receive all input. See window_tree.mojom for
- // details.
- ServerWindow* capture_window() { return capture_window_; }
- const ServerWindow* capture_window() const { return capture_window_; }
- // Setting capture can fail if the window is blocked by a modal window
- // (indicated by returning |false|).
- bool SetCaptureWindow(ServerWindow* capture_window,
- ClientSpecificId client_id);
-
- // Id of the client that capture events are sent to.
- ClientSpecificId capture_window_client_id() const {
- return capture_window_client_id_;
- }
-
- // Adds a system modal window. The window remains modal to system until it is
- // destroyed. There can exist multiple system modal windows, in which case the
- // one that is visible and added most recently or shown most recently would be
- // the active one.
- void AddSystemModalWindow(ServerWindow* window);
-
- // Checks if |modal_window| is a visible modal window that blocks current
- // capture window and if that's the case, releases the capture.
- void ReleaseCaptureBlockedByModalWindow(const ServerWindow* modal_window);
-
- // Checks if the current capture window is blocked by any visible modal window
- // and if that's the case, releases the capture.
- void ReleaseCaptureBlockedByAnyModalWindow();
-
- // Retrieves the ServerWindow of the last mouse move.
- ServerWindow* mouse_cursor_source_window() const {
- return mouse_cursor_source_window_;
- }
-
- // If the mouse cursor is still over |mouse_cursor_source_window_|, updates
- // whether we are in the non-client area. Used when
- // |mouse_cursor_source_window_| has changed its properties.
- void UpdateNonClientAreaForCurrentWindow();
-
- // Possibly updates the cursor. If we aren't in an implicit capture, we take
- // the last known location of the mouse pointer, and look for the
- // ServerWindow* under it.
- void UpdateCursorProviderByLastKnownLocation();
-
- // Adds an accelerator with the given id and event-matcher. If an accelerator
- // already exists with the same id or the same matcher, then the accelerator
- // is not added. Returns whether adding the accelerator was successful or not.
- bool AddAccelerator(uint32_t id, mojom::EventMatcherPtr event_matcher);
- void RemoveAccelerator(uint32_t id);
-
- // Processes the supplied event, informing the delegate as approriate. This
- // may result in generating any number of events.
- void ProcessEvent(const ui::Event& event);
-
- private:
- friend class test::EventDispatcherTestApi;
-
- // Keeps track of state associated with an active pointer.
- struct PointerTarget {
- PointerTarget()
- : window(nullptr),
- is_mouse_event(false),
- in_nonclient_area(false),
- is_pointer_down(false) {}
-
- // NOTE: this is set to null if the window is destroyed before a
- // corresponding release/cancel.
- ServerWindow* window;
-
- bool is_mouse_event;
-
- // Did the pointer event start in the non-client area.
- bool in_nonclient_area;
-
- bool is_pointer_down;
- };
-
- void ProcessKeyEvent(const ui::KeyEvent& event);
-
- bool IsTrackingPointer(int32_t pointer_id) const {
- return pointer_targets_.count(pointer_id) > 0;
- }
-
- // EventDispatcher provides the following logic for pointer events:
- // . wheel events go to the current target of the associated pointer. If
- // there is no target, they go to the deepest window.
- // . move (not drag) events go to the deepest window.
- // . when a pointer goes down all events until the corresponding up or
- // cancel go to the deepest target. For mouse events the up only occurs
- // when no buttons on the mouse are down.
- // This also generates exit events as appropriate. For example, if the mouse
- // moves between one window to another an exit is generated on the first.
- void ProcessLocatedEvent(const ui::LocatedEvent& event);
-
- // Adds |pointer_target| to |pointer_targets_|.
- void StartTrackingPointer(int32_t pointer_id,
- const PointerTarget& pointer_target);
-
- // Removes a PointerTarget from |pointer_targets_|.
- void StopTrackingPointer(int32_t pointer_id);
-
- // Starts tracking the pointer for |event|, or if already tracking the
- // pointer sends the appropriate event to the delegate and updates the
- // currently tracked PointerTarget appropriately.
- void UpdateTargetForPointer(int32_t pointer_id,
- const ui::LocatedEvent& event);
-
- // Returns a PointerTarget from the supplied event.
- PointerTarget PointerTargetForEvent(const ui::LocatedEvent& event);
-
- // Returns true if any pointers are in the pressed/down state.
- bool AreAnyPointersDown() const;
-
- // If |target->window| is valid, then passes the event to the delegate.
- void DispatchToPointerTarget(const PointerTarget& target,
- const ui::LocatedEvent& event);
-
- // Dispatch |event| to the delegate.
- void DispatchToClient(ServerWindow* window,
- ClientSpecificId client_id,
- const ui::LocatedEvent& event);
-
- // Stops sending pointer events to |window|. This does not remove the entry
- // for |window| from |pointer_targets_|, rather it nulls out the window. This
- // way we continue to eat events until the up/cancel is received.
- void CancelPointerEventsToTarget(ServerWindow* window);
-
- // Used to observe a window. Can be called multiple times on a window. To
- // unobserve a window, UnobserveWindow() should be called the same number of
- // times.
- void ObserveWindow(ServerWindow* winodw);
- void UnobserveWindow(ServerWindow* winodw);
-
- // Returns an Accelerator bound to the specified code/flags, and of the
- // matching |phase|. Otherwise returns null.
- Accelerator* FindAccelerator(const ui::KeyEvent& event,
- const ui::mojom::AcceleratorPhase phase);
-
- ServerWindow* FindDeepestVisibleWindowForEvents(gfx::Point* location);
-
- // ServerWindowObserver:
- void OnWillChangeWindowHierarchy(ServerWindow* window,
- ServerWindow* new_parent,
- ServerWindow* old_parent) override;
- void OnWindowVisibilityChanged(ServerWindow* window) override;
- void OnWindowDestroyed(ServerWindow* window) override;
-
- EventDispatcherDelegate* delegate_;
-
- ServerWindow* capture_window_;
- ClientSpecificId capture_window_client_id_;
-
- ModalWindowController modal_window_controller_;
-
- bool mouse_button_down_;
- ServerWindow* mouse_cursor_source_window_;
- bool mouse_cursor_in_non_client_area_;
-
- // The on screen location of the mouse pointer. This can be outside the
- // bounds of |mouse_cursor_source_window_|, which can capture the cursor.
- gfx::Point mouse_pointer_last_location_;
-
- std::map<uint32_t, std::unique_ptr<Accelerator>> accelerators_;
-
- using PointerIdToTargetMap = std::map<int32_t, PointerTarget>;
- // |pointer_targets_| contains the active pointers. For a mouse based pointer
- // a PointerTarget is always active (and present in |pointer_targets_|). For
- // touch based pointers the pointer is active while down and removed on
- // cancel or up.
- PointerIdToTargetMap pointer_targets_;
-
- // Keeps track of number of observe requests for each observed window.
- std::map<const ServerWindow*, uint8_t> observed_windows_;
-
- DISALLOW_COPY_AND_ASSIGN(EventDispatcher);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_EVENT_DISPATCHER_H_
diff --git a/chromium/components/mus/ws/event_dispatcher_delegate.h b/chromium/components/mus/ws/event_dispatcher_delegate.h
deleted file mode 100644
index 1d31fb99d50..00000000000
--- a/chromium/components/mus/ws/event_dispatcher_delegate.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_EVENT_DISPATCHER_DELEGATE_H_
-#define COMPONENTS_MUS_WS_EVENT_DISPATCHER_DELEGATE_H_
-
-#include <stdint.h>
-
-#include "components/mus/common/types.h"
-
-namespace gfx {
-class Point;
-}
-
-namespace ui {
-class Event;
-}
-
-namespace mus {
-namespace ws {
-
-class Accelerator;
-class ServerWindow;
-
-// Used by EventDispatcher for mocking in tests.
-class EventDispatcherDelegate {
- public:
- virtual void OnAccelerator(uint32_t accelerator, const ui::Event& event) = 0;
-
- virtual void SetFocusedWindowFromEventDispatcher(ServerWindow* window) = 0;
- virtual ServerWindow* GetFocusedWindowForEventDispatcher() = 0;
-
- // Called when capture should be set on the native display. |window| is the
- // window capture is being set on.
- virtual void SetNativeCapture(ServerWindow* window) = 0;
- // Called when the native display is having capture released. There is no
- // longer a ServerWindow holding capture.
- virtual void ReleaseNativeCapture() = 0;
- // Called when |window| has lost capture. The native display may still be
- // holding capture. The delegate should not change native display capture.
- // ReleaseNativeCapture() is invoked if appropriate.
- virtual void OnServerWindowCaptureLost(ServerWindow* window) = 0;
-
- virtual void OnMouseCursorLocationChanged(const gfx::Point& point) = 0;
-
- // Dispatches an event to the specific client.
- virtual void DispatchInputEventToWindow(ServerWindow* target,
- ClientSpecificId client_id,
- const ui::Event& event,
- Accelerator* accelerator) = 0;
-
- // Returns the id of the client to send events to. |in_nonclient_area| is
- // true if the event occurred in the non-client area of the window.
- virtual ClientSpecificId GetEventTargetClientId(const ServerWindow* window,
- bool in_nonclient_area) = 0;
-
- // Returns the window to start searching from at the specified location, or
- // null if there is a no window containing |location|.
- virtual ServerWindow* GetRootWindowContaining(const gfx::Point& location) = 0;
-
- // Called when event dispatch could not find a target. OnAccelerator may still
- // be called.
- virtual void OnEventTargetNotFound(const ui::Event& event) = 0;
-
- protected:
- virtual ~EventDispatcherDelegate() {}
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_EVENT_DISPATCHER_DELEGATE_H_
diff --git a/chromium/components/mus/ws/event_dispatcher_unittest.cc b/chromium/components/mus/ws/event_dispatcher_unittest.cc
deleted file mode 100644
index e47e961aff4..00000000000
--- a/chromium/components/mus/ws/event_dispatcher_unittest.cc
+++ /dev/null
@@ -1,1614 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/event_dispatcher.h"
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <queue>
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "components/mus/common/event_matcher_util.h"
-#include "components/mus/ws/accelerator.h"
-#include "components/mus/ws/event_dispatcher_delegate.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_surface_manager_test_api.h"
-#include "components/mus/ws/test_server_window_delegate.h"
-#include "components/mus/ws/test_utils.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/events/event.h"
-
-namespace mus {
-namespace ws {
-namespace test {
-namespace {
-
-// Client ids used to indicate the client area and non-client area.
-const ClientSpecificId kClientAreaId = 11;
-const ClientSpecificId kNonclientAreaId = 111;
-
-// Identifies a generated event.
-struct DispatchedEventDetails {
- DispatchedEventDetails()
- : window(nullptr), client_id(kInvalidClientId), accelerator(nullptr) {}
-
- bool IsNonclientArea() const { return client_id == kNonclientAreaId; }
- bool IsClientArea() const { return client_id == kClientAreaId; }
-
- ServerWindow* window;
- ClientSpecificId client_id;
- std::unique_ptr<ui::Event> event;
- Accelerator* accelerator;
-};
-
-class TestEventDispatcherDelegate : public EventDispatcherDelegate {
- public:
- // Delegate interface used by this class to release capture on event
- // dispatcher.
- class Delegate {
- public:
- virtual void ReleaseCapture() = 0;
- };
-
- explicit TestEventDispatcherDelegate(Delegate* delegate)
- : delegate_(delegate),
- focused_window_(nullptr),
- lost_capture_window_(nullptr),
- last_accelerator_(0) {}
- ~TestEventDispatcherDelegate() override {}
-
- ui::Event* last_event_target_not_found() {
- return last_event_target_not_found_.get();
- }
-
- uint32_t GetAndClearLastAccelerator() {
- uint32_t return_value = last_accelerator_;
- last_accelerator_ = 0;
- return return_value;
- }
-
- void set_root(ServerWindow* root) { root_ = root; }
-
- // Returns the last dispatched event, or null if there are no more.
- std::unique_ptr<DispatchedEventDetails>
- GetAndAdvanceDispatchedEventDetails() {
- if (dispatched_event_queue_.empty())
- return nullptr;
-
- std::unique_ptr<DispatchedEventDetails> details =
- std::move(dispatched_event_queue_.front());
- dispatched_event_queue_.pop();
- return details;
- }
-
- ServerWindow* GetAndClearLastFocusedWindow() {
- ServerWindow* result = focused_window_;
- focused_window_ = nullptr;
- return result;
- }
-
- bool has_queued_events() const { return !dispatched_event_queue_.empty(); }
- ServerWindow* lost_capture_window() { return lost_capture_window_; }
-
- // EventDispatcherDelegate:
- void SetFocusedWindowFromEventDispatcher(ServerWindow* window) override {
- focused_window_ = window;
- }
-
- private:
- // EventDispatcherDelegate:
- void OnAccelerator(uint32_t accelerator, const ui::Event& event) override {
- EXPECT_EQ(0u, last_accelerator_);
- last_accelerator_ = accelerator;
- }
- ServerWindow* GetFocusedWindowForEventDispatcher() override {
- return focused_window_;
- }
- void SetNativeCapture(ServerWindow* window) override {}
- void ReleaseNativeCapture() override {
- if (delegate_)
- delegate_->ReleaseCapture();
- }
- void OnServerWindowCaptureLost(ServerWindow* window) override {
- lost_capture_window_ = window;
- }
- void OnMouseCursorLocationChanged(const gfx::Point& point) override {}
- void DispatchInputEventToWindow(ServerWindow* target,
- ClientSpecificId client_id,
- const ui::Event& event,
- Accelerator* accelerator) override {
- std::unique_ptr<DispatchedEventDetails> details(new DispatchedEventDetails);
- details->window = target;
- details->client_id = client_id;
- details->event = ui::Event::Clone(event);
- details->accelerator = accelerator;
- dispatched_event_queue_.push(std::move(details));
- }
- ClientSpecificId GetEventTargetClientId(const ServerWindow* window,
- bool in_nonclient_area) override {
- return in_nonclient_area ? kNonclientAreaId : kClientAreaId;
- }
- ServerWindow* GetRootWindowContaining(const gfx::Point& location) override {
- return root_;
- }
- void OnEventTargetNotFound(const ui::Event& event) override {
- last_event_target_not_found_ = ui::Event::Clone(event);
- }
-
- Delegate* delegate_;
- ServerWindow* focused_window_;
- ServerWindow* lost_capture_window_;
- uint32_t last_accelerator_;
- std::queue<std::unique_ptr<DispatchedEventDetails>> dispatched_event_queue_;
- ServerWindow* root_ = nullptr;
- std::unique_ptr<ui::Event> last_event_target_not_found_;
-
- DISALLOW_COPY_AND_ASSIGN(TestEventDispatcherDelegate);
-};
-
-// Used by RunMouseEventTests(). Can identify up to two generated events. The
-// first ServerWindow and two points identify the first event, the second
-// ServerWindow and points identify the second event. If only one event is
-// generated set the second window to null.
-struct MouseEventTest {
- ui::MouseEvent input_event;
- ServerWindow* expected_target_window1;
- gfx::Point expected_root_location1;
- gfx::Point expected_location1;
- ServerWindow* expected_target_window2;
- gfx::Point expected_root_location2;
- gfx::Point expected_location2;
-};
-
-// Verifies |details| matches the supplied ServerWindow and points.
-void ExpectDispatchedEventDetailsMatches(const DispatchedEventDetails* details,
- ServerWindow* target,
- const gfx::Point& root_location,
- const gfx::Point& location) {
- if (!target) {
- ASSERT_FALSE(details);
- return;
- }
-
- ASSERT_EQ(target, details->window);
- ASSERT_TRUE(details->event);
- ASSERT_TRUE(details->event->IsLocatedEvent());
- ASSERT_TRUE(details->IsClientArea());
- ASSERT_EQ(root_location, details->event->AsLocatedEvent()->root_location());
- ASSERT_EQ(location, details->event->AsLocatedEvent()->location());
-}
-
-void RunMouseEventTests(EventDispatcher* dispatcher,
- TestEventDispatcherDelegate* dispatcher_delegate,
- MouseEventTest* tests,
- size_t test_count) {
- for (size_t i = 0; i < test_count; ++i) {
- const MouseEventTest& test = tests[i];
- ASSERT_FALSE(dispatcher_delegate->has_queued_events())
- << " unexpected queued events before running " << i;
- if (test.input_event.IsMouseWheelEvent())
- dispatcher->ProcessEvent(test.input_event);
- else
- dispatcher->ProcessEvent(ui::PointerEvent(test.input_event));
-
- std::unique_ptr<DispatchedEventDetails> details =
- dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- ASSERT_NO_FATAL_FAILURE(ExpectDispatchedEventDetailsMatches(
- details.get(), test.expected_target_window1,
- test.expected_root_location1, test.expected_location1))
- << " details don't match " << i;
- details = dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- ASSERT_NO_FATAL_FAILURE(ExpectDispatchedEventDetailsMatches(
- details.get(), test.expected_target_window2,
- test.expected_root_location2, test.expected_location2))
- << " details2 don't match " << i;
- ASSERT_FALSE(dispatcher_delegate->has_queued_events())
- << " unexpected queued events after running " << i;
- }
-}
-
-} // namespace
-
-// Test fixture for EventDispatcher with friend access to verify the internal
-// state. Setup creates a TestServerWindowDelegate, a visible root ServerWindow,
-// a TestEventDispatcher and the EventDispatcher for testing.
-class EventDispatcherTest : public testing::Test,
- public TestEventDispatcherDelegate::Delegate {
- public:
- EventDispatcherTest() {}
- ~EventDispatcherTest() override {}
-
- ServerWindow* root_window() { return root_window_.get(); }
- TestEventDispatcherDelegate* test_event_dispatcher_delegate() {
- return test_event_dispatcher_delegate_.get();
- }
- EventDispatcher* event_dispatcher() { return event_dispatcher_.get(); }
-
- bool AreAnyPointersDown() const;
- // Deletes everything created during SetUp()
- void ClearSetup();
- std::unique_ptr<ServerWindow> CreateChildWindowWithParent(
- const WindowId& id,
- ServerWindow* parent);
- // Creates a window which is a child of |root_window_|.
- std::unique_ptr<ServerWindow> CreateChildWindow(const WindowId& id);
- bool IsMouseButtonDown() const;
- bool IsWindowPointerTarget(const ServerWindow* window) const;
- int NumberPointerTargetsForWindow(ServerWindow* window) const;
- ServerWindow* GetActiveSystemModalWindow() const;
-
- protected:
- // testing::Test:
- void SetUp() override;
-
- private:
- // TestEventDispatcherDelegate::Delegate:
- void ReleaseCapture() override {
- event_dispatcher_->SetCaptureWindow(nullptr, kInvalidClientId);
- }
-
- std::unique_ptr<TestServerWindowDelegate> window_delegate_;
- std::unique_ptr<ServerWindow> root_window_;
- std::unique_ptr<TestEventDispatcherDelegate> test_event_dispatcher_delegate_;
- std::unique_ptr<EventDispatcher> event_dispatcher_;
-
- DISALLOW_COPY_AND_ASSIGN(EventDispatcherTest);
-};
-
-bool EventDispatcherTest::AreAnyPointersDown() const {
- return EventDispatcherTestApi(event_dispatcher_.get()).AreAnyPointersDown();
-}
-
-void EventDispatcherTest::ClearSetup() {
- window_delegate_.reset();
- root_window_.reset();
- test_event_dispatcher_delegate_.reset();
- event_dispatcher_.reset();
-}
-
-std::unique_ptr<ServerWindow> EventDispatcherTest::CreateChildWindowWithParent(
- const WindowId& id,
- ServerWindow* parent) {
- std::unique_ptr<ServerWindow> child(
- new ServerWindow(window_delegate_.get(), id));
- parent->Add(child.get());
- child->SetVisible(true);
- EnableHitTest(child.get());
- return child;
-}
-
-std::unique_ptr<ServerWindow> EventDispatcherTest::CreateChildWindow(
- const WindowId& id) {
- return CreateChildWindowWithParent(id, root_window_.get());
-}
-
-bool EventDispatcherTest::IsMouseButtonDown() const {
- return EventDispatcherTestApi(event_dispatcher_.get()).is_mouse_button_down();
-}
-
-bool EventDispatcherTest::IsWindowPointerTarget(
- const ServerWindow* window) const {
- return EventDispatcherTestApi(event_dispatcher_.get())
- .IsWindowPointerTarget(window);
-}
-
-int EventDispatcherTest::NumberPointerTargetsForWindow(
- ServerWindow* window) const {
- return EventDispatcherTestApi(event_dispatcher_.get())
- .NumberPointerTargetsForWindow(window);
-}
-
-ServerWindow* EventDispatcherTest::GetActiveSystemModalWindow() const {
- ModalWindowController* mwc =
- EventDispatcherTestApi(event_dispatcher_.get()).modal_window_controller();
- return ModalWindowControllerTestApi(mwc).GetActiveSystemModalWindow();
-}
-
-void EventDispatcherTest::SetUp() {
- testing::Test::SetUp();
-
- window_delegate_.reset(new TestServerWindowDelegate());
- root_window_.reset(new ServerWindow(window_delegate_.get(), WindowId(1, 2)));
- window_delegate_->set_root_window(root_window_.get());
- root_window_->SetVisible(true);
-
- test_event_dispatcher_delegate_.reset(new TestEventDispatcherDelegate(this));
- event_dispatcher_.reset(
- new EventDispatcher(test_event_dispatcher_delegate_.get()));
- test_event_dispatcher_delegate_->set_root(root_window_.get());
-}
-
-TEST_F(EventDispatcherTest, ProcessEvent) {
- std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- child->SetBounds(gfx::Rect(10, 10, 20, 20));
-
- // Send event that is over child.
- const ui::PointerEvent ui_event(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(20, 25), gfx::Point(20, 25),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- event_dispatcher()->ProcessEvent(ui_event);
-
- std::unique_ptr<DispatchedEventDetails> details =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
- ASSERT_EQ(child.get(), details->window);
-
- ASSERT_TRUE(details->event);
- ASSERT_TRUE(details->event->IsPointerEvent());
-
- ui::PointerEvent* dispatched_event = details->event->AsPointerEvent();
- EXPECT_EQ(gfx::Point(20, 25), dispatched_event->root_location());
- EXPECT_EQ(gfx::Point(10, 15), dispatched_event->location());
-}
-
-TEST_F(EventDispatcherTest, ProcessEventNoTarget) {
- // Send event without a target.
- ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE);
- event_dispatcher()->ProcessEvent(key);
-
- // Event wasn't dispatched to a target.
- std::unique_ptr<DispatchedEventDetails> details =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- EXPECT_FALSE(details);
-
- // Delegate was informed that there wasn't a target.
- ui::Event* event_out =
- test_event_dispatcher_delegate()->last_event_target_not_found();
- ASSERT_TRUE(event_out);
- EXPECT_TRUE(event_out->IsKeyEvent());
- EXPECT_EQ(ui::VKEY_A, event_out->AsKeyEvent()->key_code());
-}
-
-TEST_F(EventDispatcherTest, AcceleratorBasic) {
- ClearSetup();
- TestEventDispatcherDelegate event_dispatcher_delegate(nullptr);
- EventDispatcher dispatcher(&event_dispatcher_delegate);
-
- uint32_t accelerator_1 = 1;
- mojom::EventMatcherPtr matcher = mus::CreateKeyMatcher(
- ui::mojom::KeyboardCode::W, ui::mojom::kEventFlagControlDown);
- EXPECT_TRUE(dispatcher.AddAccelerator(accelerator_1, std::move(matcher)));
-
- uint32_t accelerator_2 = 2;
- matcher = mus::CreateKeyMatcher(ui::mojom::KeyboardCode::N,
- ui::mojom::kEventFlagNone);
- EXPECT_TRUE(dispatcher.AddAccelerator(accelerator_2, std::move(matcher)));
-
- // Attempting to add a new accelerator with the same id should fail.
- matcher = mus::CreateKeyMatcher(ui::mojom::KeyboardCode::T,
- ui::mojom::kEventFlagNone);
- EXPECT_FALSE(dispatcher.AddAccelerator(accelerator_2, std::move(matcher)));
-
- // Adding the accelerator with the same id should succeed once the existing
- // accelerator is removed.
- dispatcher.RemoveAccelerator(accelerator_2);
- matcher = mus::CreateKeyMatcher(ui::mojom::KeyboardCode::T,
- ui::mojom::kEventFlagNone);
- EXPECT_TRUE(dispatcher.AddAccelerator(accelerator_2, std::move(matcher)));
-
- // Attempting to add an accelerator with the same matcher should fail.
- uint32_t accelerator_3 = 3;
- matcher = mus::CreateKeyMatcher(ui::mojom::KeyboardCode::T,
- ui::mojom::kEventFlagNone);
- EXPECT_FALSE(dispatcher.AddAccelerator(accelerator_3, std::move(matcher)));
-
- matcher = mus::CreateKeyMatcher(ui::mojom::KeyboardCode::T,
- ui::mojom::kEventFlagControlDown);
- EXPECT_TRUE(dispatcher.AddAccelerator(accelerator_3, std::move(matcher)));
-}
-
-TEST_F(EventDispatcherTest, EventMatching) {
- TestEventDispatcherDelegate* event_dispatcher_delegate =
- test_event_dispatcher_delegate();
- EventDispatcher* dispatcher = event_dispatcher();
-
- mojom::EventMatcherPtr matcher = mus::CreateKeyMatcher(
- ui::mojom::KeyboardCode::W, ui::mojom::kEventFlagControlDown);
- uint32_t accelerator_1 = 1;
- dispatcher->AddAccelerator(accelerator_1, std::move(matcher));
-
- ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN);
- dispatcher->ProcessEvent(key);
- EXPECT_EQ(accelerator_1,
- event_dispatcher_delegate->GetAndClearLastAccelerator());
-
- // EF_NUM_LOCK_ON should be ignored since CreateKeyMatcher defaults to
- // ignoring.
- key = ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_W,
- ui::EF_CONTROL_DOWN | ui::EF_NUM_LOCK_ON);
- dispatcher->ProcessEvent(key);
- EXPECT_EQ(accelerator_1,
- event_dispatcher_delegate->GetAndClearLastAccelerator());
-
- key = ui::KeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_NONE);
- dispatcher->ProcessEvent(key);
- EXPECT_EQ(0u, event_dispatcher_delegate->GetAndClearLastAccelerator());
-
- uint32_t accelerator_2 = 2;
- matcher = mus::CreateKeyMatcher(ui::mojom::KeyboardCode::W,
- ui::mojom::kEventFlagNone);
- dispatcher->AddAccelerator(accelerator_2, std::move(matcher));
- dispatcher->ProcessEvent(key);
- EXPECT_EQ(accelerator_2,
- event_dispatcher_delegate->GetAndClearLastAccelerator());
-
- dispatcher->RemoveAccelerator(accelerator_2);
- dispatcher->ProcessEvent(key);
- EXPECT_EQ(0u, event_dispatcher_delegate->GetAndClearLastAccelerator());
-}
-
-// Tests that a post-target accelerator is not triggered by ProcessEvent.
-TEST_F(EventDispatcherTest, PostTargetAccelerator) {
- TestEventDispatcherDelegate* event_dispatcher_delegate =
- test_event_dispatcher_delegate();
- EventDispatcher* dispatcher = event_dispatcher();
-
- mojom::EventMatcherPtr matcher = mus::CreateKeyMatcher(
- ui::mojom::KeyboardCode::W, ui::mojom::kEventFlagControlDown);
- matcher->accelerator_phase = ui::mojom::AcceleratorPhase::POST_TARGET;
- uint32_t accelerator_1 = 1;
- dispatcher->AddAccelerator(accelerator_1, std::move(matcher));
-
- ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN);
- // The post-target accelerator should be fired if there is no focused window.
- dispatcher->ProcessEvent(key);
- EXPECT_EQ(accelerator_1,
- event_dispatcher_delegate->GetAndClearLastAccelerator());
- std::unique_ptr<DispatchedEventDetails> details =
- event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_FALSE(details);
-
- // Set focused window for EventDispatcher dispatches key events.
- std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
- event_dispatcher_delegate->SetFocusedWindowFromEventDispatcher(child.get());
-
- // With a focused window the event should be dispatched.
- dispatcher->ProcessEvent(key);
- EXPECT_EQ(0u, event_dispatcher_delegate->GetAndClearLastAccelerator());
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_TRUE(details);
- EXPECT_TRUE(details->accelerator);
-
- base::WeakPtr<Accelerator> accelerator_weak_ptr =
- details->accelerator->GetWeakPtr();
- dispatcher->RemoveAccelerator(accelerator_1);
- EXPECT_FALSE(accelerator_weak_ptr);
-
- // Post deletion there should be no accelerator
- dispatcher->ProcessEvent(key);
- EXPECT_EQ(0u, event_dispatcher_delegate->GetAndClearLastAccelerator());
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_TRUE(details);
- EXPECT_FALSE(details->accelerator);
-}
-
-TEST_F(EventDispatcherTest, Capture) {
- ServerWindow* root = root_window();
- std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
-
- root->SetBounds(gfx::Rect(0, 0, 100, 100));
- child->SetBounds(gfx::Rect(10, 10, 20, 20));
-
- MouseEventTest tests[] = {
- // Send a mouse down event over child.
- {ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(20, 25),
- gfx::Point(20, 25), base::TimeTicks(),
- ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON),
- child.get(), gfx::Point(20, 25), gfx::Point(10, 15), nullptr,
- gfx::Point(), gfx::Point()},
-
- // Capture should be activated. Let's send a mouse move outside the bounds
- // of the child.
- {ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(50, 50),
- gfx::Point(50, 50), base::TimeTicks(),
- ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON),
- child.get(), gfx::Point(50, 50), gfx::Point(40, 40), nullptr,
- gfx::Point(), gfx::Point()},
- // Release the mouse and verify that the mouse up event goes to the child.
- {ui::MouseEvent(ui::ET_MOUSE_RELEASED, gfx::Point(50, 50),
- gfx::Point(50, 50), base::TimeTicks(),
- ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON),
- child.get(), gfx::Point(50, 50), gfx::Point(40, 40), nullptr,
- gfx::Point(), gfx::Point()},
-
- // A mouse move at (50, 50) should now go to the root window. As the
- // move crosses between |child| and |root| |child| gets an exit, and
- // |root| the move.
- {ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(50, 50),
- gfx::Point(50, 50), base::TimeTicks(),
- ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON),
- child.get(), gfx::Point(50, 50), gfx::Point(40, 40), root,
- gfx::Point(50, 50), gfx::Point(50, 50)},
-
- };
- RunMouseEventTests(event_dispatcher(), test_event_dispatcher_delegate(),
- tests, arraysize(tests));
-}
-
-TEST_F(EventDispatcherTest, CaptureMultipleMouseButtons) {
- std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- child->SetBounds(gfx::Rect(10, 10, 20, 20));
-
- MouseEventTest tests[] = {
- // Send a mouse down event over child with a left mouse button
- {ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(20, 25),
- gfx::Point(20, 25), base::TimeTicks(),
- ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON),
- child.get(), gfx::Point(20, 25), gfx::Point(10, 15), nullptr,
- gfx::Point(), gfx::Point()},
-
- // Capture should be activated. Let's send a mouse move outside the bounds
- // of the child and press the right mouse button too.
- {ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(50, 50),
- gfx::Point(50, 50), base::TimeTicks(),
- ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON, 0),
- child.get(), gfx::Point(50, 50), gfx::Point(40, 40), nullptr,
- gfx::Point(), gfx::Point()},
-
- // Release the left mouse button and verify that the mouse up event goes
- // to the child.
- {ui::MouseEvent(ui::ET_MOUSE_RELEASED, gfx::Point(50, 50),
- gfx::Point(50, 50), base::TimeTicks(),
- ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON,
- ui::EF_RIGHT_MOUSE_BUTTON),
- child.get(), gfx::Point(50, 50), gfx::Point(40, 40), nullptr,
- gfx::Point(), gfx::Point()},
-
- // A mouse move at (50, 50) should still go to the child.
- {ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(50, 50),
- gfx::Point(50, 50), base::TimeTicks(),
- ui::EF_LEFT_MOUSE_BUTTON, 0),
- child.get(), gfx::Point(50, 50), gfx::Point(40, 40), nullptr,
- gfx::Point(), gfx::Point()},
-
- };
- RunMouseEventTests(event_dispatcher(), test_event_dispatcher_delegate(),
- tests, arraysize(tests));
-}
-
-TEST_F(EventDispatcherTest, ClientAreaGoesToOwner) {
- std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- child->SetBounds(gfx::Rect(10, 10, 20, 20));
-
- child->SetClientArea(gfx::Insets(5, 5, 5, 5), std::vector<gfx::Rect>());
-
- TestEventDispatcherDelegate* event_dispatcher_delegate =
- test_event_dispatcher_delegate();
- EventDispatcher* dispatcher = event_dispatcher();
-
- // Start move loop by sending mouse event over non-client area.
- const ui::PointerEvent press_event(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(12, 12), gfx::Point(12, 12),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- dispatcher->ProcessEvent(press_event);
-
- // Events should target child and be in the non-client area.
- std::unique_ptr<DispatchedEventDetails> details =
- event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
- ASSERT_TRUE(details);
- ASSERT_EQ(child.get(), details->window);
- EXPECT_TRUE(details->IsNonclientArea());
-
- // Move the mouse 5,6 pixels and target is the same.
- const ui::PointerEvent move_event(
- ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(17, 18), gfx::Point(17, 18),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, 0));
- dispatcher->ProcessEvent(move_event);
-
- // Still same target.
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
- ASSERT_EQ(child.get(), details->window);
- EXPECT_TRUE(details->IsNonclientArea());
-
- // Release the mouse.
- const ui::PointerEvent release_event(ui::MouseEvent(
- ui::ET_MOUSE_RELEASED, gfx::Point(17, 18), gfx::Point(17, 18),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- dispatcher->ProcessEvent(release_event);
-
- // The event should not have been dispatched to the delegate.
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
- ASSERT_EQ(child.get(), details->window);
- EXPECT_TRUE(details->IsNonclientArea());
-
- // Press in the client area and verify target/client area. The non-client area
- // should get an exit first.
- const ui::PointerEvent press_event2(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(21, 22), gfx::Point(21, 22),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- dispatcher->ProcessEvent(press_event2);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_TRUE(event_dispatcher_delegate->has_queued_events());
- ASSERT_EQ(child.get(), details->window);
- EXPECT_TRUE(details->IsNonclientArea());
- EXPECT_EQ(ui::ET_POINTER_EXITED, details->event->type());
-
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
- ASSERT_EQ(child.get(), details->window);
- EXPECT_TRUE(details->IsClientArea());
- EXPECT_EQ(ui::ET_POINTER_DOWN, details->event->type());
-}
-
-TEST_F(EventDispatcherTest, AdditionalClientArea) {
- std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- child->SetBounds(gfx::Rect(10, 10, 20, 20));
-
- std::vector<gfx::Rect> additional_client_areas;
- additional_client_areas.push_back(gfx::Rect(18, 0, 2, 2));
- child->SetClientArea(gfx::Insets(5, 5, 5, 5), additional_client_areas);
-
- TestEventDispatcherDelegate* event_dispatcher_delegate =
- test_event_dispatcher_delegate();
- // Press in the additional client area, it should go to the child.
- const ui::PointerEvent press_event(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(28, 11), gfx::Point(28, 11),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- event_dispatcher()->ProcessEvent(press_event);
-
- // Events should target child and be in the client area.
- std::unique_ptr<DispatchedEventDetails> details =
- event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
- ASSERT_EQ(child.get(), details->window);
- EXPECT_TRUE(details->IsClientArea());
-}
-
-TEST_F(EventDispatcherTest, HitTestMask) {
- std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- child->SetBounds(gfx::Rect(10, 10, 20, 20));
- child->SetHitTestMask(gfx::Rect(2, 2, 16, 16));
-
- // Move in the masked area.
- const ui::PointerEvent move1(ui::MouseEvent(
- ui::ET_MOUSE_MOVED, gfx::Point(11, 11), gfx::Point(11, 11),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, 0));
- event_dispatcher()->ProcessEvent(move1);
-
- // Event went through the child window and hit the root.
- std::unique_ptr<DispatchedEventDetails> details1 =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- EXPECT_EQ(root_window(), details1->window);
- EXPECT_TRUE(details1->IsClientArea());
-
- child->ClearHitTestMask();
-
- // Move right in the same part of the window.
- const ui::PointerEvent move2(ui::MouseEvent(
- ui::ET_MOUSE_MOVED, gfx::Point(11, 12), gfx::Point(11, 12),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, 0));
- event_dispatcher()->ProcessEvent(move2);
-
- // Mouse exits the root.
- std::unique_ptr<DispatchedEventDetails> details2 =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- EXPECT_EQ(ui::ET_POINTER_EXITED, details2->event->type());
-
- // Mouse hits the child.
- std::unique_ptr<DispatchedEventDetails> details3 =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- EXPECT_EQ(child.get(), details3->window);
- EXPECT_TRUE(details3->IsClientArea());
-}
-
-TEST_F(EventDispatcherTest, DontFocusOnSecondDown) {
- std::unique_ptr<ServerWindow> child1 = CreateChildWindow(WindowId(1, 3));
- std::unique_ptr<ServerWindow> child2 = CreateChildWindow(WindowId(1, 4));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- child1->SetBounds(gfx::Rect(10, 10, 20, 20));
- child2->SetBounds(gfx::Rect(50, 51, 11, 12));
-
- TestEventDispatcherDelegate* event_dispatcher_delegate =
- test_event_dispatcher_delegate();
- EventDispatcher* dispatcher = event_dispatcher();
-
- // Press on child1. First press event should change focus.
- const ui::PointerEvent press_event(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(12, 12), gfx::Point(12, 12),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- dispatcher->ProcessEvent(press_event);
- std::unique_ptr<DispatchedEventDetails> details =
- event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
- EXPECT_EQ(child1.get(), details->window);
- EXPECT_EQ(child1.get(),
- event_dispatcher_delegate->GetAndClearLastFocusedWindow());
-
- // Press (with a different pointer id) on child2. Event should go to child2,
- // but focus should not change.
- const ui::PointerEvent touch_event(ui::TouchEvent(
- ui::ET_TOUCH_PRESSED, gfx::Point(53, 54), 2, base::TimeTicks()));
- dispatcher->ProcessEvent(touch_event);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
- EXPECT_EQ(child2.get(), details->window);
- EXPECT_EQ(nullptr, event_dispatcher_delegate->GetAndClearLastFocusedWindow());
-}
-
-TEST_F(EventDispatcherTest, TwoPointersActive) {
- std::unique_ptr<ServerWindow> child1 = CreateChildWindow(WindowId(1, 3));
- std::unique_ptr<ServerWindow> child2 = CreateChildWindow(WindowId(1, 4));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- child1->SetBounds(gfx::Rect(10, 10, 20, 20));
- child2->SetBounds(gfx::Rect(50, 51, 11, 12));
-
- TestEventDispatcherDelegate* event_dispatcher_delegate =
- test_event_dispatcher_delegate();
- EventDispatcher* dispatcher = event_dispatcher();
-
- // Press on child1.
- const ui::PointerEvent touch_event1(ui::TouchEvent(
- ui::ET_TOUCH_PRESSED, gfx::Point(12, 13), 1, base::TimeTicks()));
- dispatcher->ProcessEvent(touch_event1);
- std::unique_ptr<DispatchedEventDetails> details =
- event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_EQ(child1.get(), details->window);
-
- // Drag over child2, child1 should get the drag.
- const ui::PointerEvent drag_event1(ui::TouchEvent(
- ui::ET_TOUCH_MOVED, gfx::Point(53, 54), 1, base::TimeTicks()));
- dispatcher->ProcessEvent(drag_event1);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_EQ(child1.get(), details->window);
-
- // Press on child2 with a different touch id.
- const ui::PointerEvent touch_event2(ui::TouchEvent(
- ui::ET_TOUCH_PRESSED, gfx::Point(54, 55), 2, base::TimeTicks()));
- dispatcher->ProcessEvent(touch_event2);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_EQ(child2.get(), details->window);
-
- // Drag over child1 with id 2, child2 should continue to get the drag.
- const ui::PointerEvent drag_event2(ui::TouchEvent(
- ui::ET_TOUCH_MOVED, gfx::Point(13, 14), 2, base::TimeTicks()));
- dispatcher->ProcessEvent(drag_event2);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_EQ(child2.get(), details->window);
-
- // Drag again with id 1, child1 should continue to get it.
- dispatcher->ProcessEvent(drag_event1);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_EQ(child1.get(), details->window);
-
- // Release touch id 1, and click on 2. 2 should get it.
- const ui::PointerEvent touch_release(ui::TouchEvent(
- ui::ET_TOUCH_RELEASED, gfx::Point(54, 55), 1, base::TimeTicks()));
- dispatcher->ProcessEvent(touch_release);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_EQ(child1.get(), details->window);
- const ui::PointerEvent touch_event3(ui::TouchEvent(
- ui::ET_TOUCH_PRESSED, gfx::Point(54, 55), 2, base::TimeTicks()));
- dispatcher->ProcessEvent(touch_event3);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_EQ(child2.get(), details->window);
-}
-
-TEST_F(EventDispatcherTest, DestroyWindowWhileGettingEvents) {
- std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- child->SetBounds(gfx::Rect(10, 10, 20, 20));
-
- TestEventDispatcherDelegate* event_dispatcher_delegate =
- test_event_dispatcher_delegate();
- EventDispatcher* dispatcher = event_dispatcher();
-
- // Press on child.
- const ui::PointerEvent touch_event1(ui::TouchEvent(
- ui::ET_TOUCH_PRESSED, gfx::Point(12, 13), 1, base::TimeTicks()));
- dispatcher->ProcessEvent(touch_event1);
- std::unique_ptr<DispatchedEventDetails> details =
- event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
- EXPECT_EQ(child.get(), details->window);
-
- // Delete child, and continue the drag. Event should not be dispatched.
- child.reset();
-
- const ui::PointerEvent drag_event1(ui::TouchEvent(
- ui::ET_TOUCH_MOVED, gfx::Point(53, 54), 1, base::TimeTicks()));
- dispatcher->ProcessEvent(drag_event1);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_EQ(nullptr, details.get());
-}
-
-TEST_F(EventDispatcherTest, MouseInExtendedHitTestRegion) {
- ServerWindow* root = root_window();
- std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
-
- root->SetBounds(gfx::Rect(0, 0, 100, 100));
- child->SetBounds(gfx::Rect(10, 10, 20, 20));
-
- TestEventDispatcherDelegate* event_dispatcher_delegate =
- test_event_dispatcher_delegate();
- EventDispatcher* dispatcher = event_dispatcher();
-
- // Send event that is not over child.
- const ui::PointerEvent ui_event(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(8, 9), gfx::Point(8, 9),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- dispatcher->ProcessEvent(ui_event);
- std::unique_ptr<DispatchedEventDetails> details =
- event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- ASSERT_EQ(root, details->window);
-
- // Release the mouse.
- const ui::PointerEvent release_event(ui::MouseEvent(
- ui::ET_MOUSE_RELEASED, gfx::Point(8, 9), gfx::Point(8, 9),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- dispatcher->ProcessEvent(release_event);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
- ASSERT_EQ(root, details->window);
- EXPECT_TRUE(details->IsClientArea());
-
- // Change the extended hit test region and send event in extended hit test
- // region. Should result in exit for root, followed by press for child.
- child->set_extended_hit_test_region(gfx::Insets(5, 5, 5, 5));
- dispatcher->ProcessEvent(ui_event);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_EQ(root, details->window);
- EXPECT_EQ(ui::ET_POINTER_EXITED, details->event->type());
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
-
- EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
- EXPECT_TRUE(details->IsNonclientArea());
- ASSERT_EQ(child.get(), details->window);
- EXPECT_EQ(ui::ET_POINTER_DOWN, details->event->type());
- ASSERT_TRUE(details->event.get());
- ASSERT_TRUE(details->event->IsPointerEvent());
- EXPECT_EQ(gfx::Point(-2, -1), details->event->AsPointerEvent()->location());
-}
-
-TEST_F(EventDispatcherTest, WheelWhileDown) {
- std::unique_ptr<ServerWindow> child1 = CreateChildWindow(WindowId(1, 3));
- std::unique_ptr<ServerWindow> child2 = CreateChildWindow(WindowId(1, 4));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- child1->SetBounds(gfx::Rect(10, 10, 20, 20));
- child2->SetBounds(gfx::Rect(50, 51, 11, 12));
-
- MouseEventTest tests[] = {
- // Send a mouse down event over child1.
- {ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(15, 15),
- gfx::Point(15, 15), base::TimeTicks(),
- ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON),
- child1.get(), gfx::Point(15, 15), gfx::Point(5, 5), nullptr,
- gfx::Point(), gfx::Point()},
- // Send mouse wheel over child2, should go to child1 as it has capture.
- {ui::MouseWheelEvent(gfx::Vector2d(1, 0), gfx::Point(53, 54),
- gfx::Point(53, 54), base::TimeTicks(), ui::EF_NONE,
- ui::EF_NONE),
- child1.get(), gfx::Point(53, 54), gfx::Point(43, 44), nullptr,
- gfx::Point(), gfx::Point()},
- };
- RunMouseEventTests(event_dispatcher(), test_event_dispatcher_delegate(),
- tests, arraysize(tests));
-}
-
-// Tests that when explicit capture has been set that all events go to the
-// designated window, and that when capture is cleared, events find the
-// appropriate target window.
-TEST_F(EventDispatcherTest, SetExplicitCapture) {
- ServerWindow* root = root_window();
- std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
-
- root->SetBounds(gfx::Rect(0, 0, 100, 100));
- child->SetBounds(gfx::Rect(10, 10, 20, 20));
-
- TestEventDispatcherDelegate* event_dispatcher_delegate =
- test_event_dispatcher_delegate();
- EventDispatcher* dispatcher = event_dispatcher();
-
- {
- // Send all pointer events to the child.
- dispatcher->SetCaptureWindow(child.get(), kClientAreaId);
-
- // The mouse press should go to the child even though its outside its
- // bounds.
- const ui::PointerEvent left_press_event(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), gfx::Point(5, 5),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- dispatcher->ProcessEvent(left_press_event);
-
- // Events should target child.
- std::unique_ptr<DispatchedEventDetails> details =
- event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
-
- ASSERT_TRUE(details);
- ASSERT_EQ(child.get(), details->window);
- EXPECT_TRUE(details->IsClientArea());
- EXPECT_TRUE(IsMouseButtonDown());
-
- // The mouse down state should update while capture is set.
- const ui::PointerEvent right_press_event(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), gfx::Point(5, 5),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON,
- ui::EF_RIGHT_MOUSE_BUTTON));
- dispatcher->ProcessEvent(right_press_event);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_TRUE(IsMouseButtonDown());
-
- // One button released should not clear mouse down
- const ui::PointerEvent left_release_event(ui::MouseEvent(
- ui::ET_MOUSE_RELEASED, gfx::Point(5, 5), gfx::Point(5, 5),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON));
- dispatcher->ProcessEvent(left_release_event);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_TRUE(IsMouseButtonDown());
-
- // Touch Event while mouse is down should not affect state.
- const ui::PointerEvent touch_event(ui::TouchEvent(
- ui::ET_TOUCH_PRESSED, gfx::Point(15, 15), 2, base::TimeTicks()));
- dispatcher->ProcessEvent(touch_event);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_TRUE(IsMouseButtonDown());
-
- // Move event should not affect down
- const ui::PointerEvent move_event(
- ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(15, 5), gfx::Point(15, 5),
- base::TimeTicks(), ui::EF_RIGHT_MOUSE_BUTTON,
- ui::EF_RIGHT_MOUSE_BUTTON));
- dispatcher->ProcessEvent(move_event);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_TRUE(IsMouseButtonDown());
-
- // All mouse buttons up should clear mouse down.
- const ui::PointerEvent right_release_event(
- ui::MouseEvent(ui::ET_MOUSE_RELEASED, gfx::Point(5, 5),
- gfx::Point(5, 5), base::TimeTicks(),
- ui::EF_RIGHT_MOUSE_BUTTON, ui::EF_RIGHT_MOUSE_BUTTON));
- dispatcher->ProcessEvent(right_release_event);
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_FALSE(IsMouseButtonDown());
- }
-
- {
- // Releasing capture and sending the same event will go to the root.
- dispatcher->SetCaptureWindow(nullptr, kClientAreaId);
- const ui::PointerEvent press_event(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), gfx::Point(5, 5),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- dispatcher->ProcessEvent(press_event);
-
- // Events should target the root.
- std::unique_ptr<DispatchedEventDetails> details =
- event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
-
- ASSERT_TRUE(details);
- ASSERT_EQ(root, details->window);
- }
-}
-
-// This test verifies that explicit capture overrides and resets implicit
-// capture.
-TEST_F(EventDispatcherTest, ExplicitCaptureOverridesImplicitCapture) {
- ServerWindow* root = root_window();
- std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
-
- root->SetBounds(gfx::Rect(0, 0, 100, 100));
- child->SetBounds(gfx::Rect(10, 10, 20, 20));
-
- TestEventDispatcherDelegate* event_dispatcher_delegate =
- test_event_dispatcher_delegate();
- EventDispatcher* dispatcher = event_dispatcher();
-
- // Run some implicit capture tests.
- MouseEventTest tests[] = {
- // Send a mouse down event over child with a left mouse button
- {ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(20, 25),
- gfx::Point(20, 25), base::TimeTicks(),
- ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON),
- child.get(), gfx::Point(20, 25), gfx::Point(10, 15)},
- // Capture should be activated. Let's send a mouse move outside the bounds
- // of the child and press the right mouse button too.
- {ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(50, 50),
- gfx::Point(50, 50), base::TimeTicks(),
- ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON, 0),
- child.get(), gfx::Point(50, 50), gfx::Point(40, 40)},
- // Release the left mouse button and verify that the mouse up event goes
- // to the child.
- {ui::MouseEvent(ui::ET_MOUSE_RELEASED, gfx::Point(50, 50),
- gfx::Point(50, 50), base::TimeTicks(),
- ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON,
- ui::EF_RIGHT_MOUSE_BUTTON),
- child.get(), gfx::Point(50, 50), gfx::Point(40, 40)},
- // A mouse move at (50, 50) should still go to the child.
- {ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(50, 50),
- gfx::Point(50, 50), base::TimeTicks(),
- ui::EF_LEFT_MOUSE_BUTTON, 0),
- child.get(), gfx::Point(50, 50), gfx::Point(40, 40)},
-
- };
- RunMouseEventTests(dispatcher, event_dispatcher_delegate, tests,
- arraysize(tests));
-
- // Add a second pointer target to the child.
- {
- const ui::PointerEvent touch_event(ui::TouchEvent(
- ui::ET_TOUCH_PRESSED, gfx::Point(12, 13), 1, base::TimeTicks()));
- dispatcher->ProcessEvent(touch_event);
- }
-
- std::unique_ptr<DispatchedEventDetails> details =
- event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
- EXPECT_EQ(child.get(), details->window);
-
- // Verify that no window has explicit capture and hence we did indeed do
- // implicit capture.
- ASSERT_EQ(nullptr, dispatcher->capture_window());
-
- // Give the root window explicit capture and verify input events over the
- // child go to the root instead.
- dispatcher->SetCaptureWindow(root, kNonclientAreaId);
-
- // The implicit target should receive a cancel event for each pointer target.
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
- EXPECT_TRUE(event_dispatcher_delegate->has_queued_events());
- EXPECT_EQ(child.get(), details->window);
- EXPECT_EQ(ui::ET_POINTER_CANCELLED, details->event->type());
-
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
- EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
- EXPECT_EQ(child.get(), details->window);
- EXPECT_EQ(ui::ET_POINTER_EXITED, details->event->type());
-
- const ui::PointerEvent press_event(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- dispatcher->ProcessEvent(press_event);
-
- // Events should target the root.
- details = event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
- ASSERT_EQ(root, details->window);
- ASSERT_TRUE(details->IsNonclientArea());
-}
-
-// Tests that setting capture does delete active pointer targets for the capture
-// window.
-TEST_F(EventDispatcherTest, CaptureUpdatesActivePointerTargets) {
- ServerWindow* root = root_window();
- root->SetBounds(gfx::Rect(0, 0, 100, 100));
-
- EventDispatcher* dispatcher = event_dispatcher();
- {
- const ui::PointerEvent press_event(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(5, 5), gfx::Point(5, 5),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- dispatcher->ProcessEvent(press_event);
-
- std::unique_ptr<DispatchedEventDetails> details =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
- ASSERT_EQ(root, details->window);
- }
- {
- const ui::PointerEvent touch_event(ui::TouchEvent(
- ui::ET_TOUCH_PRESSED, gfx::Point(12, 13), 1, base::TimeTicks()));
- dispatcher->ProcessEvent(touch_event);
- }
-
- ASSERT_TRUE(AreAnyPointersDown());
- ASSERT_TRUE(IsWindowPointerTarget(root));
- EXPECT_EQ(2, NumberPointerTargetsForWindow(root));
-
- // Setting the capture should clear the implicit pointers for the specified
- // window.
- dispatcher->SetCaptureWindow(root, kNonclientAreaId);
- EXPECT_FALSE(AreAnyPointersDown());
- EXPECT_FALSE(IsWindowPointerTarget(root));
-}
-
-// Tests that when explicit capture is changed, that the previous window with
-// capture is no longer being observed.
-TEST_F(EventDispatcherTest, UpdatingCaptureStopsObservingPreviousCapture) {
- std::unique_ptr<ServerWindow> child1 = CreateChildWindow(WindowId(1, 3));
- std::unique_ptr<ServerWindow> child2 = CreateChildWindow(WindowId(1, 4));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- child1->SetBounds(gfx::Rect(10, 10, 20, 20));
- child2->SetBounds(gfx::Rect(50, 51, 11, 12));
-
- EventDispatcher* dispatcher = event_dispatcher();
- ASSERT_FALSE(AreAnyPointersDown());
- ASSERT_FALSE(IsWindowPointerTarget(child1.get()));
- ASSERT_FALSE(IsWindowPointerTarget(child2.get()));
- dispatcher->SetCaptureWindow(child1.get(), kClientAreaId);
- dispatcher->SetCaptureWindow(child2.get(), kClientAreaId);
- EXPECT_EQ(child1.get(),
- test_event_dispatcher_delegate()->lost_capture_window());
-
- // If observing does not stop during the capture update this crashes.
- child1->AddObserver(dispatcher);
-}
-
-// Tests that destroying a window with explicit capture clears the capture
-// state.
-TEST_F(EventDispatcherTest, DestroyingCaptureWindowRemovesExplicitCapture) {
- std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
- child->SetBounds(gfx::Rect(10, 10, 20, 20));
-
- EventDispatcher* dispatcher = event_dispatcher();
- dispatcher->SetCaptureWindow(child.get(), kClientAreaId);
- EXPECT_EQ(child.get(), dispatcher->capture_window());
-
- ServerWindow* lost_capture_window = child.get();
- child.reset();
- EXPECT_EQ(nullptr, dispatcher->capture_window());
- EXPECT_EQ(lost_capture_window,
- test_event_dispatcher_delegate()->lost_capture_window());
-}
-
-// Tests that when |client_id| is set for a window performing capture, that this
-// preference is used regardless of whether an event targets the client region.
-TEST_F(EventDispatcherTest, CaptureInNonClientAreaOverridesActualPoint) {
- ServerWindow* root = root_window();
- root->SetBounds(gfx::Rect(0, 0, 100, 100));
-
- root->SetClientArea(gfx::Insets(5, 5, 5, 5), std::vector<gfx::Rect>());
- EventDispatcher* dispatcher = event_dispatcher();
- dispatcher->SetCaptureWindow(root, kNonclientAreaId);
-
- TestEventDispatcherDelegate* event_dispatcher_delegate =
- test_event_dispatcher_delegate();
- // Press in the client area, it should be marked as non client.
- const ui::PointerEvent press_event(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(6, 6), gfx::Point(6, 6),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- event_dispatcher()->ProcessEvent(press_event);
-
- // Events should target child and be in the client area.
- std::unique_ptr<DispatchedEventDetails> details =
- event_dispatcher_delegate->GetAndAdvanceDispatchedEventDetails();
- EXPECT_FALSE(event_dispatcher_delegate->has_queued_events());
- ASSERT_EQ(root, details->window);
- EXPECT_TRUE(details->IsNonclientArea());
-}
-
-TEST_F(EventDispatcherTest, ProcessPointerEvents) {
- std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- child->SetBounds(gfx::Rect(10, 10, 20, 20));
-
- {
- const ui::PointerEvent pointer_event(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(20, 25), gfx::Point(20, 25),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- event_dispatcher()->ProcessEvent(pointer_event);
-
- std::unique_ptr<DispatchedEventDetails> details =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
- ASSERT_EQ(child.get(), details->window);
-
- ASSERT_TRUE(details->event);
- ASSERT_TRUE(details->event->IsPointerEvent());
-
- ui::PointerEvent* dispatched_event = details->event->AsPointerEvent();
- EXPECT_EQ(gfx::Point(20, 25), dispatched_event->root_location());
- EXPECT_EQ(gfx::Point(10, 15), dispatched_event->location());
- }
-
- {
- const int touch_id = 3;
- const ui::PointerEvent pointer_event(
- ui::TouchEvent(ui::ET_TOUCH_RELEASED, gfx::Point(25, 20), touch_id,
- base::TimeTicks()));
- event_dispatcher()->ProcessEvent(pointer_event);
-
- std::unique_ptr<DispatchedEventDetails> details =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
- ASSERT_EQ(child.get(), details->window);
-
- ASSERT_TRUE(details->event);
- ASSERT_TRUE(details->event->IsPointerEvent());
-
- ui::PointerEvent* dispatched_event = details->event->AsPointerEvent();
- EXPECT_EQ(gfx::Point(25, 20), dispatched_event->root_location());
- EXPECT_EQ(gfx::Point(15, 10), dispatched_event->location());
- EXPECT_EQ(touch_id, dispatched_event->pointer_id());
- }
-}
-
-TEST_F(EventDispatcherTest, ResetClearsPointerDown) {
- std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- child->SetBounds(gfx::Rect(10, 10, 20, 20));
-
- // Send event that is over child.
- const ui::PointerEvent ui_event(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(20, 25), gfx::Point(20, 25),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- event_dispatcher()->ProcessEvent(ui_event);
-
- std::unique_ptr<DispatchedEventDetails> details =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
- ASSERT_EQ(child.get(), details->window);
-
- EXPECT_TRUE(AreAnyPointersDown());
-
- event_dispatcher()->Reset();
- EXPECT_FALSE(test_event_dispatcher_delegate()->has_queued_events());
- EXPECT_FALSE(AreAnyPointersDown());
-}
-
-TEST_F(EventDispatcherTest, ResetClearsCapture) {
- ServerWindow* root = root_window();
- root->SetBounds(gfx::Rect(0, 0, 100, 100));
-
- root->SetClientArea(gfx::Insets(5, 5, 5, 5), std::vector<gfx::Rect>());
- EventDispatcher* dispatcher = event_dispatcher();
- dispatcher->SetCaptureWindow(root, kNonclientAreaId);
-
- event_dispatcher()->Reset();
- EXPECT_FALSE(test_event_dispatcher_delegate()->has_queued_events());
- EXPECT_EQ(nullptr, event_dispatcher()->capture_window());
-}
-
-// Tests that events on a modal parent target the modal child.
-TEST_F(EventDispatcherTest, ModalWindowEventOnModalParent) {
- std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
- std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- w1->SetBounds(gfx::Rect(10, 10, 30, 30));
- w2->SetBounds(gfx::Rect(50, 10, 10, 10));
-
- w1->AddTransientWindow(w2.get());
- w2->SetModal();
-
- // Send event that is over |w1|.
- const ui::PointerEvent mouse_pressed(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- event_dispatcher()->ProcessEvent(mouse_pressed);
-
- std::unique_ptr<DispatchedEventDetails> details =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
- EXPECT_EQ(w2.get(), details->window);
- EXPECT_TRUE(details->IsNonclientArea());
-
- ASSERT_TRUE(details->event);
- ASSERT_TRUE(details->event->IsPointerEvent());
-
- ui::PointerEvent* dispatched_event = details->event->AsPointerEvent();
- EXPECT_EQ(gfx::Point(15, 15), dispatched_event->root_location());
- EXPECT_EQ(gfx::Point(-35, 5), dispatched_event->location());
-}
-
-// Tests that events on a modal child target the modal child itself.
-TEST_F(EventDispatcherTest, ModalWindowEventOnModalChild) {
- std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
- std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- w1->SetBounds(gfx::Rect(10, 10, 30, 30));
- w2->SetBounds(gfx::Rect(50, 10, 10, 10));
-
- w1->AddTransientWindow(w2.get());
- w2->SetModal();
-
- // Send event that is over |w2|.
- const ui::PointerEvent mouse_pressed(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(55, 15), gfx::Point(55, 15),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- event_dispatcher()->ProcessEvent(mouse_pressed);
-
- std::unique_ptr<DispatchedEventDetails> details =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
- EXPECT_EQ(w2.get(), details->window);
- EXPECT_TRUE(details->IsClientArea());
-
- ASSERT_TRUE(details->event);
- ASSERT_TRUE(details->event->IsPointerEvent());
-
- ui::PointerEvent* dispatched_event = details->event->AsPointerEvent();
- EXPECT_EQ(gfx::Point(55, 15), dispatched_event->root_location());
- EXPECT_EQ(gfx::Point(5, 5), dispatched_event->location());
-}
-
-// Tests that events on an unrelated window are not affected by the modal
-// window.
-TEST_F(EventDispatcherTest, ModalWindowEventOnUnrelatedWindow) {
- std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
- std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5));
- std::unique_ptr<ServerWindow> w3 = CreateChildWindow(WindowId(1, 6));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- w1->SetBounds(gfx::Rect(10, 10, 30, 30));
- w2->SetBounds(gfx::Rect(50, 10, 10, 10));
- w3->SetBounds(gfx::Rect(70, 10, 10, 10));
-
- w1->AddTransientWindow(w2.get());
- w2->SetModal();
-
- // Send event that is over |w3|.
- const ui::PointerEvent mouse_pressed(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(75, 15), gfx::Point(75, 15),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- event_dispatcher()->ProcessEvent(mouse_pressed);
-
- std::unique_ptr<DispatchedEventDetails> details =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
- EXPECT_EQ(w3.get(), details->window);
- EXPECT_TRUE(details->IsClientArea());
-
- ASSERT_TRUE(details->event);
- ASSERT_TRUE(details->event->IsPointerEvent());
-
- ui::PointerEvent* dispatched_event = details->event->AsPointerEvent();
- EXPECT_EQ(gfx::Point(75, 15), dispatched_event->root_location());
- EXPECT_EQ(gfx::Point(5, 5), dispatched_event->location());
-}
-
-// Tests that events events on a descendant of a modal parent target the modal
-// child.
-TEST_F(EventDispatcherTest, ModalWindowEventOnDescendantOfModalParent) {
- std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
- std::unique_ptr<ServerWindow> w11 =
- CreateChildWindowWithParent(WindowId(1, 4), w1.get());
- std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- w1->SetBounds(gfx::Rect(10, 10, 30, 30));
- w11->SetBounds(gfx::Rect(10, 10, 10, 10));
- w2->SetBounds(gfx::Rect(50, 10, 10, 10));
-
- w1->AddTransientWindow(w2.get());
- w2->SetModal();
-
- // Send event that is over |w11|.
- const ui::PointerEvent mouse_pressed(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(25, 25), gfx::Point(25, 25),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- event_dispatcher()->ProcessEvent(mouse_pressed);
-
- std::unique_ptr<DispatchedEventDetails> details =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
- EXPECT_EQ(w2.get(), details->window);
- EXPECT_TRUE(details->IsNonclientArea());
-
- ASSERT_TRUE(details->event);
- ASSERT_TRUE(details->event->IsPointerEvent());
-
- ui::PointerEvent* dispatched_event = details->event->AsPointerEvent();
- EXPECT_EQ(gfx::Point(25, 25), dispatched_event->root_location());
- EXPECT_EQ(gfx::Point(-25, 15), dispatched_event->location());
-}
-
-// Tests that events on a system modal window target the modal window itself.
-TEST_F(EventDispatcherTest, ModalWindowEventOnSystemModal) {
- std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- w1->SetBounds(gfx::Rect(10, 10, 30, 30));
- w1->SetModal();
-
- // Send event that is over |w1|.
- const ui::PointerEvent mouse_pressed(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- event_dispatcher()->ProcessEvent(mouse_pressed);
-
- std::unique_ptr<DispatchedEventDetails> details =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
- EXPECT_EQ(w1.get(), details->window);
- EXPECT_TRUE(details->IsClientArea());
-
- ASSERT_TRUE(details->event);
- ASSERT_TRUE(details->event->IsPointerEvent());
-
- ui::PointerEvent* dispatched_event = details->event->AsPointerEvent();
- EXPECT_EQ(gfx::Point(15, 15), dispatched_event->root_location());
- EXPECT_EQ(gfx::Point(5, 5), dispatched_event->location());
-}
-
-// Tests that events outside of system modal window target the modal window.
-TEST_F(EventDispatcherTest, ModalWindowEventOutsideSystemModal) {
- std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- w1->SetBounds(gfx::Rect(10, 10, 30, 30));
- w1->SetModal();
- event_dispatcher()->AddSystemModalWindow(w1.get());
-
- // Send event that is over |w1|.
- const ui::PointerEvent mouse_pressed(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(45, 15), gfx::Point(45, 15),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- event_dispatcher()->ProcessEvent(mouse_pressed);
-
- std::unique_ptr<DispatchedEventDetails> details =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
- EXPECT_EQ(w1.get(), details->window);
- EXPECT_TRUE(details->IsNonclientArea());
-
- ASSERT_TRUE(details->event);
- ASSERT_TRUE(details->event->IsPointerEvent());
-
- ui::PointerEvent* dispatched_event = details->event->AsPointerEvent();
- EXPECT_EQ(gfx::Point(45, 15), dispatched_event->root_location());
- EXPECT_EQ(gfx::Point(35, 5), dispatched_event->location());
-}
-
-// Tests that setting capture to a descendant of a modal parent fails.
-TEST_F(EventDispatcherTest, ModalWindowSetCaptureDescendantOfModalParent) {
- std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
- std::unique_ptr<ServerWindow> w11 =
- CreateChildWindowWithParent(WindowId(1, 4), w1.get());
- std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- w1->SetBounds(gfx::Rect(10, 10, 30, 30));
- w11->SetBounds(gfx::Rect(10, 10, 10, 10));
- w2->SetBounds(gfx::Rect(50, 10, 10, 10));
-
- w1->AddTransientWindow(w2.get());
- w2->SetModal();
-
- EXPECT_FALSE(event_dispatcher()->SetCaptureWindow(w11.get(), kClientAreaId));
- EXPECT_EQ(nullptr, event_dispatcher()->capture_window());
-}
-
-// Tests that setting capture to a window unrelated to a modal parent works.
-TEST_F(EventDispatcherTest, ModalWindowSetCaptureUnrelatedWindow) {
- std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
- std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 4));
- std::unique_ptr<ServerWindow> w3 = CreateChildWindow(WindowId(1, 5));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- w1->SetBounds(gfx::Rect(10, 10, 30, 30));
- w2->SetBounds(gfx::Rect(50, 10, 10, 10));
- w3->SetBounds(gfx::Rect(70, 10, 10, 10));
-
- w1->AddTransientWindow(w2.get());
- w2->SetModal();
-
- EXPECT_TRUE(event_dispatcher()->SetCaptureWindow(w3.get(), kClientAreaId));
- EXPECT_EQ(w3.get(), event_dispatcher()->capture_window());
-}
-
-// Tests that setting capture fails when there is a system modal window.
-TEST_F(EventDispatcherTest, ModalWindowSystemSetCapture) {
- std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
- std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 4));
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- w1->SetBounds(gfx::Rect(10, 10, 30, 30));
- w2->SetBounds(gfx::Rect(50, 10, 10, 10));
-
- event_dispatcher()->AddSystemModalWindow(w2.get());
-
- EXPECT_FALSE(event_dispatcher()->SetCaptureWindow(w1.get(), kClientAreaId));
- EXPECT_EQ(nullptr, event_dispatcher()->capture_window());
-}
-
-// Tests having multiple system modal windows.
-TEST_F(EventDispatcherTest, ModalWindowMultipleSystemModals) {
- std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
- std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 4));
- std::unique_ptr<ServerWindow> w3 = CreateChildWindow(WindowId(1, 5));
-
- w2->SetVisible(false);
-
- // In the beginning, there should be no active system modal window.
- EXPECT_EQ(nullptr, GetActiveSystemModalWindow());
-
- // Add a visible system modal window. It should become the active one.
- event_dispatcher()->AddSystemModalWindow(w1.get());
- EXPECT_EQ(w1.get(), GetActiveSystemModalWindow());
-
- // Add an invisible system modal window. It should not change the active one.
- event_dispatcher()->AddSystemModalWindow(w2.get());
- EXPECT_EQ(w1.get(), GetActiveSystemModalWindow());
-
- // Add another visible system modal window. It should become the active one.
- event_dispatcher()->AddSystemModalWindow(w3.get());
- EXPECT_EQ(w3.get(), GetActiveSystemModalWindow());
-
- // Make an existing system modal window visible. It should become the active
- // one.
- w2->SetVisible(true);
- EXPECT_EQ(w2.get(), GetActiveSystemModalWindow());
-
- // Remove the active system modal window. Next one should become active.
- w2.reset();
- EXPECT_EQ(w3.get(), GetActiveSystemModalWindow());
-
- // Remove an inactive system modal window. It should not change the active
- // one.
- w1.reset();
- EXPECT_EQ(w3.get(), GetActiveSystemModalWindow());
-
- // Remove the last remaining system modal window. There should be no active
- // one anymore.
- w3.reset();
- EXPECT_EQ(nullptr, GetActiveSystemModalWindow());
-}
-
-TEST_F(EventDispatcherTest, CaptureNotResetOnParentChange) {
- std::unique_ptr<ServerWindow> w1 = CreateChildWindow(WindowId(1, 3));
- DisableHitTest(w1.get());
- std::unique_ptr<ServerWindow> w11 =
- CreateChildWindowWithParent(WindowId(1, 4), w1.get());
- std::unique_ptr<ServerWindow> w2 = CreateChildWindow(WindowId(1, 5));
- DisableHitTest(w2.get());
-
- root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- w1->SetBounds(gfx::Rect(0, 0, 100, 100));
- w11->SetBounds(gfx::Rect(10, 10, 10, 10));
- w2->SetBounds(gfx::Rect(0, 0, 100, 100));
-
- // Send event that is over |w11|.
- const ui::PointerEvent mouse_pressed(ui::MouseEvent(
- ui::ET_MOUSE_PRESSED, gfx::Point(15, 15), gfx::Point(15, 15),
- base::TimeTicks(), ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON));
- event_dispatcher()->ProcessEvent(mouse_pressed);
- event_dispatcher()->SetCaptureWindow(w11.get(), kClientAreaId);
-
- std::unique_ptr<DispatchedEventDetails> details =
- test_event_dispatcher_delegate()->GetAndAdvanceDispatchedEventDetails();
- ASSERT_TRUE(details);
- EXPECT_EQ(w11.get(), details->window);
- EXPECT_TRUE(details->IsClientArea());
-
- // Move |w11| to |w2| and verify the mouse is still down, and |w11| has
- // capture.
- w2->Add(w11.get());
- EXPECT_TRUE(IsMouseButtonDown());
- EXPECT_EQ(w11.get(),
- EventDispatcherTestApi(event_dispatcher()).capture_window());
-}
-
-TEST_F(EventDispatcherTest, ChangeCaptureFromClientToNonclient) {
- std::unique_ptr<ServerWindow> child = CreateChildWindow(WindowId(1, 3));
- event_dispatcher()->SetCaptureWindow(child.get(), kNonclientAreaId);
- EXPECT_EQ(kNonclientAreaId,
- event_dispatcher()->capture_window_client_id());
- EXPECT_EQ(nullptr, test_event_dispatcher_delegate()->lost_capture_window());
- event_dispatcher()->SetCaptureWindow(child.get(), kClientAreaId);
- // Changing capture from client to non-client should notify the delegate.
- // The delegate can decide if it really wants to forward the event or not.
- EXPECT_EQ(child.get(),
- test_event_dispatcher_delegate()->lost_capture_window());
- EXPECT_EQ(child.get(), event_dispatcher()->capture_window());
- EXPECT_EQ(kClientAreaId, event_dispatcher()->capture_window_client_id());
-}
-
-} // namespace test
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/event_matcher.cc b/chromium/components/mus/ws/event_matcher.cc
deleted file mode 100644
index da45554d2ea..00000000000
--- a/chromium/components/mus/ws/event_matcher.cc
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/event_matcher.h"
-
-namespace mus {
-namespace ws {
-
-EventMatcher::EventMatcher(const mojom::EventMatcher& matcher)
- : fields_to_match_(NONE),
- event_type_(ui::ET_UNKNOWN),
- event_flags_(ui::EF_NONE),
- ignore_event_flags_(ui::EF_NONE),
- keyboard_code_(ui::VKEY_UNKNOWN),
- pointer_type_(ui::EventPointerType::POINTER_TYPE_UNKNOWN) {
- if (matcher.type_matcher) {
- fields_to_match_ |= TYPE;
- switch (matcher.type_matcher->type) {
- case ui::mojom::EventType::POINTER_DOWN:
- event_type_ = ui::ET_POINTER_DOWN;
- break;
- case ui::mojom::EventType::POINTER_MOVE:
- event_type_ = ui::ET_POINTER_MOVED;
- break;
- case ui::mojom::EventType::MOUSE_EXIT:
- event_type_ = ui::ET_POINTER_EXITED;
- break;
- case ui::mojom::EventType::POINTER_UP:
- event_type_ = ui::ET_POINTER_UP;
- break;
- case ui::mojom::EventType::POINTER_CANCEL:
- event_type_ = ui::ET_POINTER_CANCELLED;
- break;
- case ui::mojom::EventType::KEY_PRESSED:
- event_type_ = ui::ET_KEY_PRESSED;
- break;
- case ui::mojom::EventType::KEY_RELEASED:
- event_type_ = ui::ET_KEY_RELEASED;
- break;
- default:
- NOTREACHED();
- }
- }
- if (matcher.flags_matcher) {
- fields_to_match_ |= FLAGS;
- event_flags_ = matcher.flags_matcher->flags;
- if (matcher.ignore_flags_matcher)
- ignore_event_flags_ = matcher.ignore_flags_matcher->flags;
- }
- if (matcher.key_matcher) {
- fields_to_match_ |= KEYBOARD_CODE;
- keyboard_code_ = static_cast<uint16_t>(matcher.key_matcher->keyboard_code);
- }
- if (matcher.pointer_kind_matcher) {
- fields_to_match_ |= POINTER_KIND;
- switch (matcher.pointer_kind_matcher->pointer_kind) {
- case ui::mojom::PointerKind::MOUSE:
- pointer_type_ = ui::EventPointerType::POINTER_TYPE_MOUSE;
- break;
- case ui::mojom::PointerKind::TOUCH:
- pointer_type_ = ui::EventPointerType::POINTER_TYPE_TOUCH;
- break;
- default:
- NOTREACHED();
- }
- }
- if (matcher.pointer_location_matcher) {
- fields_to_match_ |= POINTER_LOCATION;
- pointer_region_ = matcher.pointer_location_matcher->region;
- }
-}
-
-EventMatcher::~EventMatcher() {}
-
-bool EventMatcher::MatchesEvent(const ui::Event& event) const {
- if ((fields_to_match_ & TYPE) && event.type() != event_type_)
- return false;
- int flags = event.flags() & ~ignore_event_flags_;
- if ((fields_to_match_ & FLAGS) && flags != event_flags_)
- return false;
- if (fields_to_match_ & KEYBOARD_CODE) {
- if (!event.IsKeyEvent())
- return false;
- if (keyboard_code_ != event.AsKeyEvent()->GetConflatedWindowsKeyCode())
- return false;
- }
- if (fields_to_match_ & POINTER_KIND) {
- if (!event.IsPointerEvent() ||
- pointer_type_ != event.AsPointerEvent()->pointer_details().pointer_type)
- return false;
- }
- if (fields_to_match_ & POINTER_LOCATION) {
- // TODO(sad): The tricky part here is to make sure the same coord-space is
- // used for the location-region and the event-location.
- NOTIMPLEMENTED();
- return false;
- }
- return true;
-}
-
-bool EventMatcher::Equals(const EventMatcher& other) const {
- return fields_to_match_ == other.fields_to_match_ &&
- event_type_ == other.event_type_ &&
- event_flags_ == other.event_flags_ &&
- ignore_event_flags_ == other.ignore_event_flags_ &&
- keyboard_code_ == other.keyboard_code_ &&
- pointer_type_ == other.pointer_type_ &&
- pointer_region_ == other.pointer_region_;
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/event_matcher.h b/chromium/components/mus/ws/event_matcher.h
deleted file mode 100644
index ec9231b57a4..00000000000
--- a/chromium/components/mus/ws/event_matcher.h
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_EVENT_MATCHER_H_
-#define COMPONENTS_MUS_WS_EVENT_MATCHER_H_
-
-#include <stdint.h>
-
-#include "base/macros.h"
-#include "components/mus/public/interfaces/event_matcher.mojom.h"
-#include "ui/events/event.h"
-#include "ui/events/mojo/event_constants.mojom.h"
-#include "ui/events/mojo/keyboard_codes.mojom.h"
-#include "ui/gfx/geometry/rect_f.h"
-
-namespace mus {
-namespace ws {
-
-// Wraps a mojom::EventMatcher and allows events to be tested against it.
-class EventMatcher {
- public:
- explicit EventMatcher(const mojom::EventMatcher& matcher);
- ~EventMatcher();
-
- bool MatchesEvent(const ui::Event& event) const;
-
- bool Equals(const EventMatcher& other) const;
-
- private:
- enum MatchFields {
- NONE = 0,
- TYPE = 1 << 0,
- FLAGS = 1 << 1,
- KEYBOARD_CODE = 1 << 2,
- POINTER_KIND = 1 << 3,
- POINTER_LOCATION = 1 << 4,
- };
-
- uint32_t fields_to_match_;
- ui::EventType event_type_;
- // Bitfields of kEventFlag* and kMouseEventFlag* values in
- // input_event_constants.mojom.
- int event_flags_;
- int ignore_event_flags_;
- uint16_t keyboard_code_;
- ui::EventPointerType pointer_type_;
- gfx::RectF pointer_region_;
-
- DISALLOW_COPY_AND_ASSIGN(EventMatcher);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_EVENT_MATCHER_H_
diff --git a/chromium/components/mus/ws/event_matcher_unittest.cc b/chromium/components/mus/ws/event_matcher_unittest.cc
deleted file mode 100644
index 04c011fb459..00000000000
--- a/chromium/components/mus/ws/event_matcher_unittest.cc
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/event_matcher.h"
-
-#include "base/time/time.h"
-#include "components/mus/public/interfaces/event_matcher.mojom.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/events/event.h"
-#include "ui/events/mojo/event_constants.mojom.h"
-#include "ui/gfx/geometry/point.h"
-
-namespace mus {
-namespace ws {
-
-// NOTE: Most of the matching functionality is exercised by tests of Accelerator
-// handling in the EventDispatcher and WindowTree tests. These are just basic
-// sanity checks.
-
-using EventTesterTest = testing::Test;
-
-TEST_F(EventTesterTest, MatchesEventByType) {
- mojom::EventMatcherPtr matcher = mojom::EventMatcher::New();
- matcher->type_matcher = mojom::EventTypeMatcher::New();
- matcher->type_matcher->type = ui::mojom::EventType::POINTER_DOWN;
- EventMatcher pointer_down_matcher(*matcher);
-
- ui::PointerEvent pointer_down(
- ui::TouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(), 1, base::TimeTicks()));
- EXPECT_TRUE(pointer_down_matcher.MatchesEvent(pointer_down));
-
- ui::PointerEvent pointer_up(ui::TouchEvent(
- ui::ET_TOUCH_RELEASED, gfx::Point(), 1, base::TimeTicks()));
- EXPECT_FALSE(pointer_down_matcher.MatchesEvent(pointer_up));
-}
-
-TEST_F(EventTesterTest, MatchesEventByKeyCode) {
- mojom::EventMatcherPtr matcher(mojom::EventMatcher::New());
- matcher->type_matcher = mojom::EventTypeMatcher::New();
- matcher->type_matcher->type = ui::mojom::EventType::KEY_PRESSED;
- matcher->key_matcher = mojom::KeyEventMatcher::New();
- matcher->key_matcher->keyboard_code = ui::mojom::KeyboardCode::Z;
- EventMatcher z_matcher(*matcher);
-
- ui::KeyEvent z_key(ui::ET_KEY_PRESSED, ui::VKEY_Z, ui::EF_NONE);
- EXPECT_TRUE(z_matcher.MatchesEvent(z_key));
-
- ui::KeyEvent y_key(ui::ET_KEY_PRESSED, ui::VKEY_Y, ui::EF_NONE);
- EXPECT_FALSE(z_matcher.MatchesEvent(y_key));
-}
-
-TEST_F(EventTesterTest, MatchesEventByKeyFlags) {
- mojom::EventMatcherPtr matcher(mojom::EventMatcher::New());
- matcher->type_matcher = mojom::EventTypeMatcher::New();
- matcher->type_matcher->type = ui::mojom::EventType::KEY_PRESSED;
- matcher->flags_matcher = mojom::EventFlagsMatcher::New();
- matcher->flags_matcher->flags = ui::mojom::kEventFlagControlDown;
- matcher->key_matcher = mojom::KeyEventMatcher::New();
- matcher->key_matcher->keyboard_code = ui::mojom::KeyboardCode::N;
- EventMatcher control_n_matcher(*matcher);
-
- ui::KeyEvent control_n(ui::ET_KEY_PRESSED, ui::VKEY_N, ui::EF_CONTROL_DOWN);
- EXPECT_TRUE(control_n_matcher.MatchesEvent(control_n));
-
- ui::KeyEvent shift_n(ui::ET_KEY_PRESSED, ui::VKEY_N, ui::EF_SHIFT_DOWN);
- EXPECT_FALSE(control_n_matcher.MatchesEvent(shift_n));
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/focus_controller.cc b/chromium/components/mus/ws/focus_controller.cc
deleted file mode 100644
index 5728acbe154..00000000000
--- a/chromium/components/mus/ws/focus_controller.cc
+++ /dev/null
@@ -1,311 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/focus_controller.h"
-
-#include "base/macros.h"
-#include "components/mus/public/interfaces/window_manager.mojom.h"
-#include "components/mus/ws/focus_controller_delegate.h"
-#include "components/mus/ws/focus_controller_observer.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_drawn_tracker.h"
-
-namespace mus {
-namespace ws {
-
-namespace {
-
-ServerWindow* GetDeepestLastDescendant(ServerWindow* window) {
- while (!window->children().empty())
- window = window->children().back();
- return window;
-}
-
-// This can be used to iterate over each node in a rooted tree for the purpose
-// of shifting focus/activation.
-class WindowTreeIterator {
- public:
- explicit WindowTreeIterator(ServerWindow* root) : root_(root) {}
- ~WindowTreeIterator() {}
-
- ServerWindow* GetNext(ServerWindow* window) const {
- if (window == root_ || window == nullptr)
- return GetDeepestLastDescendant(root_);
-
- // Return the next sibling.
- ServerWindow* parent = window->parent();
- if (parent) {
- const ServerWindow::Windows& siblings = parent->children();
- ServerWindow::Windows::const_reverse_iterator iter =
- std::find(siblings.rbegin(), siblings.rend(), window);
- DCHECK(iter != siblings.rend());
- ++iter;
- if (iter != siblings.rend())
- return GetDeepestLastDescendant(*iter);
- }
-
- // All children and siblings have been explored. Next is the parent.
- return parent;
- }
-
- private:
- ServerWindow* root_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowTreeIterator);
-};
-
-} // namespace
-
-FocusController::FocusController(FocusControllerDelegate* delegate,
- ServerWindow* root)
- : delegate_(delegate),
- root_(root),
- focused_window_(nullptr),
- active_window_(nullptr),
- activation_reason_(ActivationChangeReason::UNKNONW) {
- DCHECK(delegate_);
- DCHECK(root_);
-}
-
-FocusController::~FocusController() {
-}
-
-bool FocusController::SetFocusedWindow(ServerWindow* window) {
- if (GetFocusedWindow() == window)
- return true;
-
- return SetFocusedWindowImpl(FocusControllerChangeSource::EXPLICIT, window);
-}
-
-ServerWindow* FocusController::GetFocusedWindow() {
- return focused_window_;
-}
-
-void FocusController::ActivateNextWindow() {
- WindowTreeIterator iter(root_);
- ServerWindow* activate = active_window_;
- while (true) {
- activate = iter.GetNext(activate);
- if (activation_reason_ == ActivationChangeReason::CYCLE) {
- if (activate == active_window_) {
- // We have cycled over all the activatable windows. Remove the oldest
- // window that was cycled.
- if (!cycle_windows_->windows().empty()) {
- cycle_windows_->Remove(cycle_windows_->windows().front());
- continue;
- }
- } else if (cycle_windows_->Contains(activate)) {
- // We are cycling between activated windows, and this window has already
- // been through the cycle. So skip over it.
- continue;
- }
- }
- if (activate == active_window_ || CanBeActivated(activate))
- break;
- }
- SetActiveWindow(activate, ActivationChangeReason::CYCLE);
-
- if (active_window_) {
- // Do not shift focus if the focused window already lives in the active
- // window.
- if (focused_window_ && active_window_->Contains(focused_window_))
- return;
- // Focus the first focusable window in the tree.
- WindowTreeIterator iter(active_window_);
- ServerWindow* focus = nullptr;
- do {
- focus = iter.GetNext(focus);
- } while (focus != active_window_ && !CanBeFocused(focus));
- SetFocusedWindow(focus);
- } else {
- SetFocusedWindow(nullptr);
- }
-}
-
-void FocusController::AddObserver(FocusControllerObserver* observer) {
- observers_.AddObserver(observer);
-}
-
-void FocusController::RemoveObserver(FocusControllerObserver* observer) {
- observers_.RemoveObserver(observer);
-}
-
-void FocusController::SetActiveWindow(ServerWindow* window,
- ActivationChangeReason reason) {
- DCHECK(!window || CanBeActivated(window));
- if (active_window_ == window)
- return;
- if (reason != ActivationChangeReason::CYCLE) {
- cycle_windows_.reset();
- } else if (activation_reason_ != ActivationChangeReason::CYCLE) {
- DCHECK(!cycle_windows_);
- cycle_windows_.reset(new ServerWindowTracker());
- if (active_window_)
- cycle_windows_->Add(active_window_);
- }
-
- ServerWindow* old_active = active_window_;
- active_window_ = window;
- activation_reason_ = reason;
- FOR_EACH_OBSERVER(FocusControllerObserver, observers_,
- OnActivationChanged(old_active, active_window_));
- if (active_window_ && activation_reason_ == ActivationChangeReason::CYCLE)
- cycle_windows_->Add(active_window_);
-}
-
-bool FocusController::CanBeFocused(ServerWindow* window) const {
- // All ancestors of |window| must be drawn, and be focusable.
- for (ServerWindow* w = window; w; w = w->parent()) {
- if (!w->IsDrawn())
- return false;
- if (!w->can_focus())
- return false;
- }
-
- // |window| must be a descendent of an activatable window.
- return GetActivatableAncestorOf(window) != nullptr;
-}
-
-bool FocusController::CanBeActivated(ServerWindow* window) const {
- DCHECK(window);
- // A detached window cannot be activated.
- if (!root_->Contains(window))
- return false;
-
- // The parent window must be allowed to have active children.
- if (!delegate_->CanHaveActiveChildren(window->parent()))
- return false;
-
- if (!window->can_focus())
- return false;
-
- // The window must be drawn, or if it's not drawn, it must be minimized.
- if (!window->IsDrawn()) {
- bool is_minimized = false;
- const ServerWindow::Properties& props = window->properties();
- if (props.count(mojom::WindowManager::kShowState_Property)) {
- is_minimized =
- props.find(mojom::WindowManager::kShowState_Property)->second[0] ==
- static_cast<int>(mus::mojom::ShowState::MINIMIZED);
- }
- if (!is_minimized)
- return false;
- }
-
- // TODO(sad): If there's a transient modal window, then this cannot be
- // activated.
- return true;
-}
-
-ServerWindow* FocusController::GetActivatableAncestorOf(
- ServerWindow* window) const {
- for (ServerWindow* w = window; w; w = w->parent()) {
- if (CanBeActivated(w))
- return w;
- }
- return nullptr;
-}
-
-bool FocusController::SetFocusedWindowImpl(
- FocusControllerChangeSource change_source,
- ServerWindow* window) {
- if (window && !CanBeFocused(window))
- return false;
-
- ServerWindow* old_focused = GetFocusedWindow();
-
- DCHECK(!window || window->IsDrawn());
-
- // Activate the closest activatable ancestor window.
- // TODO(sad): The window to activate doesn't necessarily have to be a direct
- // ancestor (e.g. could be a transient parent).
- SetActiveWindow(GetActivatableAncestorOf(window),
- ActivationChangeReason::FOCUS);
-
- FOR_EACH_OBSERVER(FocusControllerObserver, observers_,
- OnFocusChanged(change_source, old_focused, window));
-
- focused_window_ = window;
- // We can currently use only a single ServerWindowDrawnTracker since focused
- // window is expected to be a direct descendant of the active window.
- if (focused_window_ && active_window_) {
- DCHECK(active_window_->Contains(focused_window_));
- }
- ServerWindow* track_window = focused_window_;
- if (!track_window)
- track_window = active_window_;
- if (track_window)
- drawn_tracker_.reset(new ServerWindowDrawnTracker(track_window, this));
- else
- drawn_tracker_.reset();
- return true;
-}
-
-void FocusController::OnDrawnStateWillChange(ServerWindow* ancestor,
- ServerWindow* window,
- bool is_drawn) {
- DCHECK(!is_drawn);
- DCHECK_NE(ancestor, window);
- DCHECK(root_->Contains(window));
- drawn_tracker_.reset();
-
- // Find the window that triggered this state-change notification.
- ServerWindow* trigger = window;
- while (trigger->parent() != ancestor)
- trigger = trigger->parent();
- DCHECK(trigger);
- auto will_be_hidden = [trigger](ServerWindow* w) {
- return trigger->Contains(w);
- };
-
- // If |window| is |active_window_|, then activate the next activatable window
- // that does not belong to the subtree which is getting hidden.
- if (window == active_window_) {
- WindowTreeIterator iter(root_);
- ServerWindow* activate = active_window_;
- do {
- activate = iter.GetNext(activate);
- } while (activate != active_window_ &&
- (will_be_hidden(activate) || !CanBeActivated(activate)));
- if (activate == window)
- activate = nullptr;
- SetActiveWindow(activate, ActivationChangeReason::DRAWN_STATE_CHANGED);
-
- // Now make sure focus is in the active window.
- ServerWindow* focus = nullptr;
- if (active_window_) {
- WindowTreeIterator iter(active_window_);
- focus = nullptr;
- do {
- focus = iter.GetNext(focus);
- } while (focus != active_window_ &&
- (will_be_hidden(focus) || !CanBeFocused(focus)));
- DCHECK(focus && CanBeFocused(focus));
- }
- SetFocusedWindowImpl(FocusControllerChangeSource::DRAWN_STATE_CHANGED,
- focus);
- return;
- }
-
- // Move focus to the next focusable window in |active_window_|.
- DCHECK_EQ(focused_window_, window);
- WindowTreeIterator iter(active_window_);
- ServerWindow* focus = focused_window_;
- do {
- focus = iter.GetNext(focus);
- } while (focus != focused_window_ &&
- (will_be_hidden(focus) || !CanBeFocused(focus)));
- if (focus == window)
- focus = nullptr;
- SetFocusedWindowImpl(FocusControllerChangeSource::DRAWN_STATE_CHANGED, focus);
-}
-
-void FocusController::OnDrawnStateChanged(ServerWindow* ancestor,
- ServerWindow* window,
- bool is_drawn) {
- // DCHECK(false); TODO(sadrul):
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/focus_controller.h b/chromium/components/mus/ws/focus_controller.h
deleted file mode 100644
index 96a08609ad0..00000000000
--- a/chromium/components/mus/ws/focus_controller.h
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_FOCUS_CONTROLLER_H_
-#define COMPONENTS_MUS_WS_FOCUS_CONTROLLER_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "base/observer_list.h"
-#include "components/mus/ws/server_window_drawn_tracker_observer.h"
-#include "components/mus/ws/server_window_tracker.h"
-
-namespace mus {
-
-namespace ws {
-
-class FocusControllerDelegate;
-class FocusControllerObserver;
-class ServerWindow;
-class ServerWindowDrawnTracker;
-struct WindowId;
-
-// Describes the source of the change.
-enum class FocusControllerChangeSource {
- EXPLICIT,
- DRAWN_STATE_CHANGED,
-};
-
-// Tracks the focused window. Focus is moved to another window when the drawn
-// state of the focused window changes.
-class FocusController : public ServerWindowDrawnTrackerObserver {
- public:
- FocusController(FocusControllerDelegate* delegate, ServerWindow* root);
- ~FocusController() override;
-
- // Sets the focused window. Does nothing if |window| is currently focused.
- // This does not notify the delegate. See ServerWindow::SetFocusedWindow()
- // for details on return value.
- bool SetFocusedWindow(ServerWindow* window);
- ServerWindow* GetFocusedWindow();
-
- // Moves activation to the next activatable window.
- void ActivateNextWindow();
-
- void AddObserver(FocusControllerObserver* observer);
- void RemoveObserver(FocusControllerObserver* observer);
-
- private:
- enum class ActivationChangeReason {
- UNKNONW,
- CYCLE, // Activation changed because of ActivateNextWindow().
- FOCUS, // Focus change required a different window to be activated.
- DRAWN_STATE_CHANGED, // Active window was hidden or destroyed.
- };
- void SetActiveWindow(ServerWindow* window, ActivationChangeReason reason);
-
- // Returns whether |window| can be focused or activated.
- bool CanBeFocused(ServerWindow* window) const;
- bool CanBeActivated(ServerWindow* window) const;
-
- // Returns the closest activatable ancestor of |window|. Returns nullptr if
- // there is no such ancestor.
- ServerWindow* GetActivatableAncestorOf(ServerWindow* window) const;
-
- // Implementation of SetFocusedWindow().
- bool SetFocusedWindowImpl(FocusControllerChangeSource change_source,
- ServerWindow* window);
-
- // ServerWindowDrawnTrackerObserver:
- void OnDrawnStateWillChange(ServerWindow* ancestor,
- ServerWindow* window,
- bool is_drawn) override;
- void OnDrawnStateChanged(ServerWindow* ancestor,
- ServerWindow* window,
- bool is_drawn) override;
-
- FocusControllerDelegate* delegate_;
-
- ServerWindow* root_;
- ServerWindow* focused_window_;
- ServerWindow* active_window_;
- // Tracks what caused |active_window_| to be activated.
- ActivationChangeReason activation_reason_;
-
- // Keeps track of the list of windows that have already been visited during a
- // window cycle. This is only active when |activation_reason_| is set to
- // CYCLE.
- std::unique_ptr<ServerWindowTracker> cycle_windows_;
-
- base::ObserverList<FocusControllerObserver> observers_;
-
- // Keeps track of the visibility of the focused and active window.
- std::unique_ptr<ServerWindowDrawnTracker> drawn_tracker_;
-
- DISALLOW_COPY_AND_ASSIGN(FocusController);
-};
-
-} // namespace ws
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_FOCUS_CONTROLLER_H_
diff --git a/chromium/components/mus/ws/focus_controller_delegate.h b/chromium/components/mus/ws/focus_controller_delegate.h
deleted file mode 100644
index 6eca41cabbb..00000000000
--- a/chromium/components/mus/ws/focus_controller_delegate.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_FOCUS_CONTROLLER_DELEGATE_H_
-#define COMPONENTS_MUS_WS_FOCUS_CONTROLLER_DELEGATE_H_
-
-namespace mus {
-
-namespace ws {
-
-class ServerWindow;
-
-class FocusControllerDelegate {
- public:
- virtual bool CanHaveActiveChildren(ServerWindow* window) const = 0;
-
- protected:
- ~FocusControllerDelegate() {}
-};
-
-} // namespace ws
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_FOCUS_CONTROLLER_DELEGATE_H_
diff --git a/chromium/components/mus/ws/focus_controller_observer.h b/chromium/components/mus/ws/focus_controller_observer.h
deleted file mode 100644
index 8edbae18c35..00000000000
--- a/chromium/components/mus/ws/focus_controller_observer.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_FOCUS_CONTROLLER_OBSERVER_H_
-#define COMPONENTS_MUS_WS_FOCUS_CONTROLLER_OBSERVER_H_
-
-namespace mus {
-namespace ws {
-
-enum class FocusControllerChangeSource;
-class ServerWindow;
-
-class FocusControllerObserver {
- public:
- virtual void OnActivationChanged(ServerWindow* old_active_window,
- ServerWindow* new_active_window) = 0;
- virtual void OnFocusChanged(FocusControllerChangeSource change_source,
- ServerWindow* old_focused_window,
- ServerWindow* new_focused_window) = 0;
-
- protected:
- ~FocusControllerObserver() {}
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_FOCUS_CONTROLLER_OBSERVER_H_
diff --git a/chromium/components/mus/ws/focus_controller_unittest.cc b/chromium/components/mus/ws/focus_controller_unittest.cc
deleted file mode 100644
index 563de06e875..00000000000
--- a/chromium/components/mus/ws/focus_controller_unittest.cc
+++ /dev/null
@@ -1,312 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/focus_controller.h"
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include "base/macros.h"
-#include "components/mus/ws/focus_controller_delegate.h"
-#include "components/mus/ws/focus_controller_observer.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/test_server_window_delegate.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace mus {
-
-namespace ws {
-namespace {
-
-const char kDisallowActiveChildren[] = "disallow-active-children";
-
-class TestFocusControllerObserver : public FocusControllerObserver,
- public FocusControllerDelegate {
- public:
- TestFocusControllerObserver()
- : ignore_explicit_(true),
- focus_change_count_(0u),
- old_focused_window_(nullptr),
- new_focused_window_(nullptr),
- old_active_window_(nullptr),
- new_active_window_(nullptr) {}
-
- void ClearAll() {
- focus_change_count_ = 0u;
- old_focused_window_ = nullptr;
- new_focused_window_ = nullptr;
- old_active_window_ = nullptr;
- new_active_window_ = nullptr;
- }
- size_t focus_change_count() const { return focus_change_count_; }
- ServerWindow* old_focused_window() { return old_focused_window_; }
- ServerWindow* new_focused_window() { return new_focused_window_; }
-
- ServerWindow* old_active_window() { return old_active_window_; }
- ServerWindow* new_active_window() { return new_active_window_; }
-
- void set_ignore_explicit(bool ignore) { ignore_explicit_ = ignore; }
-
- private:
- // FocusControllerDelegate:
- bool CanHaveActiveChildren(ServerWindow* window) const override {
- return !window || window->properties().count(kDisallowActiveChildren) == 0;
- }
- // FocusControllerObserver:
- void OnActivationChanged(ServerWindow* old_active_window,
- ServerWindow* new_active_window) override {
- old_active_window_ = old_active_window;
- new_active_window_ = new_active_window;
- }
- void OnFocusChanged(FocusControllerChangeSource source,
- ServerWindow* old_focused_window,
- ServerWindow* new_focused_window) override {
- if (ignore_explicit_ && source == FocusControllerChangeSource::EXPLICIT)
- return;
-
- focus_change_count_++;
- old_focused_window_ = old_focused_window;
- new_focused_window_ = new_focused_window;
- }
-
- bool ignore_explicit_;
- size_t focus_change_count_;
- ServerWindow* old_focused_window_;
- ServerWindow* new_focused_window_;
- ServerWindow* old_active_window_;
- ServerWindow* new_active_window_;
-
- DISALLOW_COPY_AND_ASSIGN(TestFocusControllerObserver);
-};
-
-} // namespace
-
-TEST(FocusControllerTest, Basic) {
- TestServerWindowDelegate server_window_delegate;
- ServerWindow root(&server_window_delegate, WindowId());
- server_window_delegate.set_root_window(&root);
- root.SetVisible(true);
- ServerWindow child(&server_window_delegate, WindowId());
- child.SetVisible(true);
- root.Add(&child);
- ServerWindow child_child(&server_window_delegate, WindowId());
- child_child.SetVisible(true);
- child.Add(&child_child);
-
- TestFocusControllerObserver focus_observer;
- FocusController focus_controller(&focus_observer, &root);
- focus_controller.AddObserver(&focus_observer);
-
- focus_controller.SetFocusedWindow(&child_child);
- EXPECT_EQ(0u, focus_observer.focus_change_count());
-
- // Remove the ancestor of the focused window, focus should go to the |root|.
- root.Remove(&child);
- EXPECT_EQ(1u, focus_observer.focus_change_count());
- EXPECT_EQ(&root, focus_observer.new_focused_window());
- EXPECT_EQ(&child_child, focus_observer.old_focused_window());
- focus_observer.ClearAll();
-
- // Make the focused window invisible. Focus is lost in this case (as no one
- // to give focus to).
- root.SetVisible(false);
- EXPECT_EQ(1u, focus_observer.focus_change_count());
- EXPECT_EQ(nullptr, focus_observer.new_focused_window());
- EXPECT_EQ(&root, focus_observer.old_focused_window());
- focus_observer.ClearAll();
-
- // Go back to initial state and focus |child_child|.
- root.SetVisible(true);
- root.Add(&child);
- focus_controller.SetFocusedWindow(&child_child);
- EXPECT_EQ(0u, focus_observer.focus_change_count());
-
- // Hide the focused window, focus should go to parent.
- child_child.SetVisible(false);
- EXPECT_EQ(1u, focus_observer.focus_change_count());
- EXPECT_EQ(&child, focus_observer.new_focused_window());
- EXPECT_EQ(&child_child, focus_observer.old_focused_window());
- focus_observer.ClearAll();
-
- child_child.SetVisible(true);
- focus_controller.SetFocusedWindow(&child_child);
- EXPECT_EQ(0u, focus_observer.focus_change_count());
-
- // Hide the parent of the focused window.
- child.SetVisible(false);
- EXPECT_EQ(1u, focus_observer.focus_change_count());
- EXPECT_EQ(&root, focus_observer.new_focused_window());
- EXPECT_EQ(&child_child, focus_observer.old_focused_window());
- focus_observer.ClearAll();
- focus_controller.RemoveObserver(&focus_observer);
-}
-
-// Tests that focus shifts correctly if the focused window is destroyed.
-TEST(FocusControllerTest, FocusShiftsOnDestroy) {
- TestServerWindowDelegate server_window_delegate;
- ServerWindow parent(&server_window_delegate, WindowId());
- server_window_delegate.set_root_window(&parent);
- parent.SetVisible(true);
- ServerWindow child_first(&server_window_delegate, WindowId());
- child_first.SetVisible(true);
- parent.Add(&child_first);
- std::unique_ptr<ServerWindow> child_second(
- new ServerWindow(&server_window_delegate, WindowId()));
- child_second->SetVisible(true);
- parent.Add(child_second.get());
- std::vector<uint8_t> dummy;
- // Allow only |parent| to be activated.
- parent.SetProperty(kDisallowActiveChildren, &dummy);
-
- TestFocusControllerObserver focus_observer;
- focus_observer.set_ignore_explicit(false);
- FocusController focus_controller(&focus_observer, &parent);
- focus_controller.AddObserver(&focus_observer);
-
- focus_controller.ActivateNextWindow();
- EXPECT_EQ(nullptr, focus_observer.old_active_window());
- EXPECT_EQ(&parent, focus_observer.new_active_window());
- EXPECT_EQ(nullptr, focus_observer.old_focused_window());
- EXPECT_EQ(child_second.get(), focus_observer.new_focused_window());
- focus_observer.ClearAll();
-
- // Destroying |child_second| should move focus to |child_first|.
- child_second.reset();
- EXPECT_NE(nullptr, focus_observer.old_focused_window());
- EXPECT_EQ(&child_first, focus_observer.new_focused_window());
-
- focus_controller.RemoveObserver(&focus_observer);
-}
-
-TEST(FocusControllerTest, ActivationSkipsOverHiddenWindow) {
- TestServerWindowDelegate server_window_delegate;
- ServerWindow parent(&server_window_delegate, WindowId());
- server_window_delegate.set_root_window(&parent);
- parent.SetVisible(true);
-
- ServerWindow child_first(&server_window_delegate, WindowId());
- ServerWindow child_second(&server_window_delegate, WindowId());
- ServerWindow child_third(&server_window_delegate, WindowId());
-
- parent.Add(&child_first);
- parent.Add(&child_second);
- parent.Add(&child_third);
-
- child_first.SetVisible(true);
- child_second.SetVisible(false);
- child_third.SetVisible(true);
-
- TestFocusControllerObserver focus_observer;
- focus_observer.set_ignore_explicit(false);
- FocusController focus_controller(&focus_observer, &parent);
- focus_controller.AddObserver(&focus_observer);
-
- // Since |child_second| is invisible, activation should cycle from
- // |child_third|, to |child_first|, to |parent|, back to |child_third|.
- focus_controller.ActivateNextWindow();
- EXPECT_EQ(nullptr, focus_observer.old_active_window());
- EXPECT_EQ(&child_third, focus_observer.new_active_window());
- focus_observer.ClearAll();
-
- focus_controller.ActivateNextWindow();
- EXPECT_EQ(&child_third, focus_observer.old_active_window());
- EXPECT_EQ(&child_first, focus_observer.new_active_window());
- focus_observer.ClearAll();
-
- focus_controller.ActivateNextWindow();
- EXPECT_EQ(&child_first, focus_observer.old_active_window());
- EXPECT_EQ(&parent, focus_observer.new_active_window());
- focus_observer.ClearAll();
-
- focus_controller.ActivateNextWindow();
- EXPECT_EQ(&parent, focus_observer.old_active_window());
- EXPECT_EQ(&child_third, focus_observer.new_active_window());
- focus_observer.ClearAll();
-
- // Once |child_second| is made visible, activation should go from
- // |child_third| to |child_second|.
- child_second.SetVisible(true);
- focus_controller.ActivateNextWindow();
- EXPECT_EQ(&child_third, focus_observer.old_active_window());
- EXPECT_EQ(&child_second, focus_observer.new_active_window());
-}
-
-TEST(FocusControllerTest, ActivationSkipsOverHiddenContainers) {
- TestServerWindowDelegate server_window_delegate;
- ServerWindow parent(&server_window_delegate, WindowId());
- server_window_delegate.set_root_window(&parent);
- parent.SetVisible(true);
-
- ServerWindow child1(&server_window_delegate, WindowId());
- ServerWindow child2(&server_window_delegate, WindowId());
-
- parent.Add(&child1);
- parent.Add(&child2);
-
- child1.SetVisible(true);
- child2.SetVisible(true);
-
- ServerWindow child11(&server_window_delegate, WindowId());
- ServerWindow child12(&server_window_delegate, WindowId());
- ServerWindow child21(&server_window_delegate, WindowId());
- ServerWindow child22(&server_window_delegate, WindowId());
-
- child1.Add(&child11);
- child1.Add(&child12);
- child2.Add(&child21);
- child2.Add(&child22);
-
- child11.SetVisible(true);
- child12.SetVisible(true);
- child21.SetVisible(true);
- child22.SetVisible(true);
-
- TestFocusControllerObserver focus_observer;
- FocusController focus_controller(&focus_observer, &parent);
- focus_controller.AddObserver(&focus_observer);
-
- focus_controller.ActivateNextWindow();
- EXPECT_EQ(nullptr, focus_observer.old_active_window());
- EXPECT_EQ(&child22, focus_observer.new_active_window());
- focus_observer.ClearAll();
-
- child2.SetVisible(false);
- EXPECT_EQ(&child22, focus_observer.old_active_window());
- EXPECT_EQ(&child12, focus_observer.new_active_window());
-}
-
-TEST(FocusControllerTest, NonFocusableWindowNotActivated) {
- TestServerWindowDelegate server_window_delegate;
- ServerWindow parent(&server_window_delegate, WindowId());
- server_window_delegate.set_root_window(&parent);
- parent.SetVisible(true);
-
- ServerWindow child_first(&server_window_delegate, WindowId());
- ServerWindow child_second(&server_window_delegate, WindowId());
- parent.Add(&child_first);
- parent.Add(&child_second);
- child_first.SetVisible(true);
- child_second.SetVisible(true);
-
- TestFocusControllerObserver focus_observer;
- focus_observer.set_ignore_explicit(false);
- FocusController focus_controller(&focus_observer, &parent);
- focus_controller.AddObserver(&focus_observer);
-
- child_first.set_can_focus(false);
-
- // |child_second| is activated first, but then activation skips over
- // |child_first| and goes to |parent| instead.
- focus_controller.ActivateNextWindow();
- EXPECT_EQ(nullptr, focus_observer.old_active_window());
- EXPECT_EQ(&child_second, focus_observer.new_active_window());
- focus_observer.ClearAll();
-
- focus_controller.ActivateNextWindow();
- EXPECT_EQ(&child_second, focus_observer.old_active_window());
- EXPECT_EQ(&parent, focus_observer.new_active_window());
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/ids.h b/chromium/components/mus/ws/ids.h
deleted file mode 100644
index 3cdf4b29b87..00000000000
--- a/chromium/components/mus/ws/ids.h
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_IDS_H_
-#define COMPONENTS_MUS_WS_IDS_H_
-
-#include <stdint.h>
-
-#include <tuple>
-
-#include "base/containers/hash_tables.h"
-#include "base/hash.h"
-#include "components/mus/common/types.h"
-#include "components/mus/common/util.h"
-
-namespace mus {
-namespace ws {
-
-// A client id used to indicate no client. That is, no WindowTree ever gets this
-// id.
-const ClientSpecificId kInvalidClientId = 0;
-
-// Every window has a unique id associated with it (WindowId). The id is a
-// combination of the id assigned to the client (the high order bits) and
-// a unique id for the window. Each client (WindowTree) refers to the window
-// by an id assigned by the client (ClientWindowId). To facilitate this
-// WindowTree maintains a mapping between WindowId and ClientWindowId.
-//
-// This model works when the client initiates creation of windows, which is
-// the typical use case. Embed roots and the WindowManager are special, they
-// get access to windows created by other clients. These clients see the
-// id assigned on the server. Such clients have to take care that they only
-// create windows using their client id. To do otherwise could result in
-// multiple windows having the same ClientWindowId. WindowTree enforces
-// that embed roots use the client id in creating the window id to avoid
-// possible conflicts.
-struct WindowId {
- WindowId(ClientSpecificId client_id, ClientSpecificId window_id)
- : client_id(client_id), window_id(window_id) {}
- WindowId() : client_id(0), window_id(0) {}
-
- bool operator==(const WindowId& other) const {
- return other.client_id == client_id && other.window_id == window_id;
- }
-
- bool operator!=(const WindowId& other) const { return !(*this == other); }
-
- bool operator<(const WindowId& other) const {
- return std::tie(client_id, window_id) <
- std::tie(other.client_id, other.window_id);
- }
-
- ClientSpecificId client_id;
- ClientSpecificId window_id;
-};
-
-// Used for ids assigned by the client.
-struct ClientWindowId {
- explicit ClientWindowId(Id id) : id(id) {}
- ClientWindowId() : id(0u) {}
-
- bool operator==(const ClientWindowId& other) const { return other.id == id; }
-
- bool operator!=(const ClientWindowId& other) const {
- return !(*this == other);
- }
-
- bool operator<(const ClientWindowId& other) const { return id < other.id; }
-
- Id id;
-};
-
-inline WindowId WindowIdFromTransportId(Id id) {
- return WindowId(HiWord(id), LoWord(id));
-}
-inline Id WindowIdToTransportId(const WindowId& id) {
- return (id.client_id << 16) | id.window_id;
-}
-
-// Returns a WindowId that is reserved to indicate no window. That is, no window
-// will ever be created with this id.
-inline WindowId InvalidWindowId() {
- return WindowId(kInvalidClientId, 0);
-}
-
-// Returns a root window id with a given index offset.
-inline WindowId RootWindowId(uint16_t index) {
- return WindowId(kInvalidClientId, 2 + index);
-}
-
-} // namespace ws
-} // namespace mus
-
-namespace BASE_HASH_NAMESPACE {
-
-template <>
-struct hash<mus::ws::ClientWindowId> {
- size_t operator()(const mus::ws::ClientWindowId& id) const {
- return hash<mus::Id>()(id.id);
- }
-};
-
-template <>
-struct hash<mus::ws::WindowId> {
- size_t operator()(const mus::ws::WindowId& id) const {
- return hash<mus::Id>()(WindowIdToTransportId(id));
- }
-};
-
-} // namespace BASE_HASH_NAMESPACE
-
-#endif // COMPONENTS_MUS_WS_IDS_H_
diff --git a/chromium/components/mus/ws/modal_window_controller.cc b/chromium/components/mus/ws/modal_window_controller.cc
deleted file mode 100644
index 89ec02e3720..00000000000
--- a/chromium/components/mus/ws/modal_window_controller.cc
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/modal_window_controller.h"
-
-#include "base/stl_util.h"
-#include "components/mus/ws/event_dispatcher.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_drawn_tracker.h"
-
-namespace mus {
-namespace ws {
-namespace {
-
-const ServerWindow* GetModalChildForWindowAncestor(const ServerWindow* window) {
- for (const ServerWindow* ancestor = window; ancestor;
- ancestor = ancestor->parent()) {
- for (const auto& transient_child : ancestor->transient_children()) {
- if (transient_child->is_modal() && transient_child->IsDrawn())
- return transient_child;
- }
- }
- return nullptr;
-}
-
-const ServerWindow* GetWindowModalTargetForWindow(const ServerWindow* window) {
- const ServerWindow* modal_window = GetModalChildForWindowAncestor(window);
- if (!modal_window)
- return window;
- return GetWindowModalTargetForWindow(modal_window);
-}
-
-} // namespace
-
-ModalWindowController::ModalWindowController(EventDispatcher* event_dispatcher)
- : event_dispatcher_(event_dispatcher) {}
-
-ModalWindowController::~ModalWindowController() {
- for (auto it = system_modal_windows_.begin();
- it != system_modal_windows_.end(); it++) {
- (*it)->RemoveObserver(this);
- }
-}
-
-void ModalWindowController::AddSystemModalWindow(ServerWindow* window) {
- DCHECK(window);
- DCHECK(!ContainsValue(system_modal_windows_, window));
-
- window->SetModal();
- system_modal_windows_.push_back(window);
- window_drawn_trackers_.insert(make_pair(
- window, base::WrapUnique(new ServerWindowDrawnTracker(window, this))));
- window->AddObserver(this);
-
- event_dispatcher_->ReleaseCaptureBlockedByModalWindow(window);
-}
-
-bool ModalWindowController::IsWindowBlockedBy(
- const ServerWindow* window,
- const ServerWindow* modal_window) const {
- DCHECK(window);
- DCHECK(modal_window);
- if (!modal_window->is_modal() || !modal_window->IsDrawn())
- return false;
-
- if (modal_window->transient_parent() &&
- !modal_window->transient_parent()->Contains(window)) {
- return false;
- }
-
- return true;
-}
-
-bool ModalWindowController::IsWindowBlocked(const ServerWindow* window) const {
- DCHECK(window);
- return GetActiveSystemModalWindow() || GetModalChildForWindowAncestor(window);
-}
-
-const ServerWindow* ModalWindowController::GetTargetForWindow(
- const ServerWindow* window) const {
- ServerWindow* system_modal_window = GetActiveSystemModalWindow();
- return system_modal_window ? system_modal_window
- : GetWindowModalTargetForWindow(window);
-}
-
-ServerWindow* ModalWindowController::GetActiveSystemModalWindow() const {
- for (auto it = system_modal_windows_.rbegin();
- it != system_modal_windows_.rend(); it++) {
- ServerWindow* modal = *it;
- if (modal->IsDrawn())
- return modal;
- }
- return nullptr;
-}
-
-void ModalWindowController::OnWindowDestroyed(ServerWindow* window) {
- window->RemoveObserver(this);
- auto it = std::find(system_modal_windows_.begin(),
- system_modal_windows_.end(), window);
- DCHECK(it != system_modal_windows_.end());
- system_modal_windows_.erase(it);
- window_drawn_trackers_.erase(window);
-}
-
-void ModalWindowController::OnDrawnStateChanged(ServerWindow* ancestor,
- ServerWindow* window,
- bool is_drawn) {
- if (!is_drawn)
- return;
-
- // Move the most recently shown window to the end of the list.
- auto it = std::find(system_modal_windows_.begin(),
- system_modal_windows_.end(), window);
- DCHECK(it != system_modal_windows_.end());
- system_modal_windows_.splice(system_modal_windows_.end(),
- system_modal_windows_, it);
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/modal_window_controller.h b/chromium/components/mus/ws/modal_window_controller.h
deleted file mode 100644
index 112fce771e6..00000000000
--- a/chromium/components/mus/ws/modal_window_controller.h
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_MODAL_WINDOW_CONTROLLER_H_
-#define COMPONENTS_MUS_WS_MODAL_WINDOW_CONTROLLER_H_
-
-#include <list>
-#include <map>
-
-#include "components/mus/ws/server_window_drawn_tracker_observer.h"
-#include "components/mus/ws/server_window_observer.h"
-
-namespace mus {
-namespace ws {
-
-class EventDispatcher;
-class ServerWindow;
-class ServerWindowDrawnTracker;
-
-namespace test {
-class ModalWindowControllerTestApi;
-}
-
-// Used to keeps track of system modal windows and check whether windows are
-// blocked by modal windows or not to do appropriate retargetting of events.
-class ModalWindowController : public ServerWindowObserver,
- public ServerWindowDrawnTrackerObserver {
- public:
- explicit ModalWindowController(EventDispatcher* event_dispatcher);
- ~ModalWindowController() override;
-
- // Adds a system modal window. The window remains modal to system until it is
- // destroyed. There can exist multiple system modal windows, in which case the
- // one that is visible and added most recently or shown most recently would be
- // the active one.
- void AddSystemModalWindow(ServerWindow* window);
-
- // Checks whether |modal_window| is a visible modal window that blocks
- // |window|.
- bool IsWindowBlockedBy(const ServerWindow* window,
- const ServerWindow* modal_window) const;
-
- // Checks whether |window| is blocked by any visible modal window.
- bool IsWindowBlocked(const ServerWindow* window) const;
-
- // Returns the window that events targeted to |window| should be retargeted
- // to; according to modal windows. If any modal window is blocking |window|
- // (either system modal or window modal), returns the topmost one; otherwise,
- // returns |window| itself.
- const ServerWindow* GetTargetForWindow(const ServerWindow* window) const;
- ServerWindow* GetTargetForWindow(ServerWindow* window) const {
- return const_cast<ServerWindow*>(
- GetTargetForWindow(static_cast<const ServerWindow*>(window)));
- }
-
- private:
- friend class test::ModalWindowControllerTestApi;
-
- // Returns the system modal window that is visible and added/shown most
- // recently, if any.
- ServerWindow* GetActiveSystemModalWindow() const;
-
- // ServerWindowObserver:
- void OnWindowDestroyed(ServerWindow* window) override;
-
- // ServerWindowDrawnTrackerObserver:
- void OnDrawnStateChanged(ServerWindow* ancestor,
- ServerWindow* window,
- bool is_drawn) override;
-
- EventDispatcher* event_dispatcher_;
-
- // List of system modal windows in order they are added/shown.
- std::list<ServerWindow*> system_modal_windows_;
-
- // Drawn trackers for system modal windows.
- std::map<ServerWindow*, std::unique_ptr<ServerWindowDrawnTracker>>
- window_drawn_trackers_;
-
- DISALLOW_COPY_AND_ASSIGN(ModalWindowController);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_MODAL_WINDOW_CONTROLLER_H_
diff --git a/chromium/components/mus/ws/mus_ws_unittests_app_manifest.json b/chromium/components/mus/ws/mus_ws_unittests_app_manifest.json
deleted file mode 100644
index 5e3872e21ac..00000000000
--- a/chromium/components/mus/ws/mus_ws_unittests_app_manifest.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "manifest_version": 1,
- "name": "mojo:mus_ws_unittests_app",
- "display_name": "Mus Window Server Unittests",
- "capabilities": {
- "required": {
- "*": { "classes": [ "app" ] },
- "mojo:mus_ws_unittests_app": {
- "interfaces": [ "mus::mojom::WindowTreeClient" ]
- },
- "mojo:mus": {
- "interfaces": [ "mus::mojom::WindowTreeHostFactory" ]
- }
- }
- }
-}
diff --git a/chromium/components/mus/ws/operation.cc b/chromium/components/mus/ws/operation.cc
deleted file mode 100644
index 6c04bc34c01..00000000000
--- a/chromium/components/mus/ws/operation.cc
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/operation.h"
-
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_tree.h"
-
-namespace mus {
-namespace ws {
-
-Operation::Operation(WindowTree* tree,
- WindowServer* window_server,
- OperationType operation_type)
- : window_server_(window_server),
- source_tree_id_(tree->id()),
- operation_type_(operation_type) {
- DCHECK(operation_type != OperationType::NONE);
- // Tell the window server about the operation currently in flight. The window
- // server uses this information to suppress certain calls out to clients.
- window_server_->PrepareForOperation(this);
-}
-
-Operation::~Operation() {
- window_server_->FinishOperation();
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/operation.h b/chromium/components/mus/ws/operation.h
deleted file mode 100644
index 15d0034fddc..00000000000
--- a/chromium/components/mus/ws/operation.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_OPERATION_H_
-#define COMPONENTS_MUS_WS_OPERATION_H_
-
-#include <set>
-
-#include "base/macros.h"
-#include "components/mus/common/types.h"
-
-namespace mus {
-namespace ws {
-
-class WindowServer;
-class WindowTree;
-
-enum class OperationType {
- NONE,
- ADD_TRANSIENT_WINDOW,
- ADD_WINDOW,
- DELETE_WINDOW,
- EMBED,
- RELEASE_CAPTURE,
- REMOVE_TRANSIENT_WINDOW_FROM_PARENT,
- REMOVE_WINDOW_FROM_PARENT,
- REORDER_WINDOW,
- SET_CAPTURE,
- SET_FOCUS,
- SET_WINDOW_BOUNDS,
- SET_WINDOW_OPACITY,
- SET_WINDOW_PREDEFINED_CURSOR,
- SET_WINDOW_PROPERTY,
- SET_WINDOW_VISIBILITY,
-};
-
-// This class tracks the currently pending client-initiated operation.
-// This is typically used to suppress superfluous notifications generated
-// by suboperations in the window server.
-class Operation {
- public:
- Operation(WindowTree* tree,
- WindowServer* window_server,
- OperationType operation_type);
- ~Operation();
-
- ClientSpecificId source_tree_id() const { return source_tree_id_; }
-
- const OperationType& type() const { return operation_type_; }
-
- // Marks the tree with the specified id as having been sent a message
- // during the course of |this| operation.
- void MarkTreeAsMessaged(ClientSpecificId tree_id) {
- message_ids_.insert(tree_id);
- }
-
- // Returns true if MarkTreeAsMessaged(tree_id) was invoked.
- bool DidMessageTree(ClientSpecificId tree_id) const {
- return message_ids_.count(tree_id) > 0;
- }
-
- private:
- WindowServer* const window_server_;
- const ClientSpecificId source_tree_id_;
- const OperationType operation_type_;
-
- // See description of MarkTreeAsMessaged/DidMessageTree.
- std::set<ClientSpecificId> message_ids_;
-
- DISALLOW_COPY_AND_ASSIGN(Operation);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_OPERATION_H_
diff --git a/chromium/components/mus/ws/platform_display.cc b/chromium/components/mus/ws/platform_display.cc
deleted file mode 100644
index 84ca1fde8ba..00000000000
--- a/chromium/components/mus/ws/platform_display.cc
+++ /dev/null
@@ -1,414 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/platform_display.h"
-
-#include "base/numerics/safe_conversions.h"
-#include "build/build_config.h"
-#include "cc/ipc/quads.mojom.h"
-#include "cc/output/compositor_frame.h"
-#include "cc/output/copy_output_request.h"
-#include "cc/output/delegated_frame_data.h"
-#include "cc/quads/render_pass.h"
-#include "cc/quads/shared_quad_state.h"
-#include "cc/quads/surface_draw_quad.h"
-#include "components/mus/gles2/gpu_state.h"
-#include "components/mus/public/interfaces/gpu.mojom.h"
-#include "components/mus/surfaces/display_compositor.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "components/mus/ws/platform_display_factory.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_surface.h"
-#include "components/mus/ws/server_window_surface_manager.h"
-#include "components/mus/ws/window_coordinate_conversions.h"
-#include "services/shell/public/cpp/connection.h"
-#include "services/shell/public/cpp/connector.h"
-#include "third_party/skia/include/core/SkXfermode.h"
-#include "ui/base/cursor/cursor_loader.h"
-#include "ui/display/display.h"
-#include "ui/events/event.h"
-#include "ui/events/event_utils.h"
-#include "ui/platform_window/platform_ime_controller.h"
-#include "ui/platform_window/platform_window.h"
-
-#if defined(OS_WIN)
-#include "ui/platform_window/win/win_window.h"
-#elif defined(USE_X11)
-#include "ui/platform_window/x11/x11_window.h"
-#elif defined(OS_ANDROID)
-#include "ui/platform_window/android/platform_window_android.h"
-#elif defined(USE_OZONE)
-#include "ui/ozone/public/ozone_platform.h"
-#endif
-
-namespace mus {
-
-namespace ws {
-namespace {
-
-// DrawWindowTree recursively visits ServerWindows, creating a SurfaceDrawQuad
-// for each that lacks one.
-void DrawWindowTree(cc::RenderPass* pass,
- ServerWindow* window,
- const gfx::Vector2d& parent_to_root_origin_offset,
- float opacity) {
- if (!window->visible())
- return;
-
- ServerWindowSurface* default_surface =
- window->surface_manager() ? window->surface_manager()->GetDefaultSurface()
- : nullptr;
-
- const gfx::Rect absolute_bounds =
- window->bounds() + parent_to_root_origin_offset;
- std::vector<ServerWindow*> children(window->GetChildren());
- // TODO(rjkroege, fsamuel): Make sure we're handling alpha correctly.
- const float combined_opacity = opacity * window->opacity();
- for (auto it = children.rbegin(); it != children.rend(); ++it) {
- DrawWindowTree(pass, *it, absolute_bounds.OffsetFromOrigin(),
- combined_opacity);
- }
-
- if (!window->surface_manager() || !window->surface_manager()->ShouldDraw())
- return;
-
- ServerWindowSurface* underlay_surface =
- window->surface_manager()->GetUnderlaySurface();
- if (!default_surface && !underlay_surface)
- return;
-
- if (default_surface) {
- gfx::Transform quad_to_target_transform;
- quad_to_target_transform.Translate(absolute_bounds.x(),
- absolute_bounds.y());
-
- cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
-
- const gfx::Rect bounds_at_origin(window->bounds().size());
- // TODO(fsamuel): These clipping and visible rects are incorrect. They need
- // to be populated from CompositorFrame structs.
- sqs->SetAll(quad_to_target_transform,
- bounds_at_origin.size() /* layer_bounds */,
- bounds_at_origin /* visible_layer_bounds */,
- bounds_at_origin /* clip_rect */, false /* is_clipped */,
- window->opacity(), SkXfermode::kSrcOver_Mode,
- 0 /* sorting-context_id */);
- auto quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>();
- quad->SetAll(sqs, bounds_at_origin /* rect */,
- gfx::Rect() /* opaque_rect */,
- bounds_at_origin /* visible_rect */, true /* needs_blending*/,
- default_surface->id());
- }
- if (underlay_surface) {
- const gfx::Rect underlay_absolute_bounds =
- absolute_bounds - window->underlay_offset();
- gfx::Transform quad_to_target_transform;
- quad_to_target_transform.Translate(underlay_absolute_bounds.x(),
- underlay_absolute_bounds.y());
- cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState();
- const gfx::Rect bounds_at_origin(
- underlay_surface->last_submitted_frame_size());
- sqs->SetAll(quad_to_target_transform,
- bounds_at_origin.size() /* layer_bounds */,
- bounds_at_origin /* visible_layer_bounds */,
- bounds_at_origin /* clip_rect */, false /* is_clipped */,
- window->opacity(), SkXfermode::kSrcOver_Mode,
- 0 /* sorting-context_id */);
-
- auto quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>();
- quad->SetAll(sqs, bounds_at_origin /* rect */,
- gfx::Rect() /* opaque_rect */,
- bounds_at_origin /* visible_rect */, true /* needs_blending*/,
- underlay_surface->id());
- }
-}
-
-} // namespace
-
-// static
-PlatformDisplayFactory* PlatformDisplay::factory_ = nullptr;
-
-// static
-PlatformDisplay* PlatformDisplay::Create(
- const PlatformDisplayInitParams& init_params) {
- if (factory_)
- return factory_->CreatePlatformDisplay();
-
- return new DefaultPlatformDisplay(init_params);
-}
-
-DefaultPlatformDisplay::DefaultPlatformDisplay(
- const PlatformDisplayInitParams& init_params)
- : display_id_(init_params.display_id),
- gpu_state_(init_params.gpu_state),
- surfaces_state_(init_params.surfaces_state),
- delegate_(nullptr),
- draw_timer_(false, false),
- frame_pending_(false),
-#if !defined(OS_ANDROID)
- cursor_loader_(ui::CursorLoader::Create()),
-#endif
- weak_factory_(this) {
- metrics_.size_in_pixels = init_params.display_bounds.size();
- // TODO(rjkroege): Preserve the display_id when Ozone platform can use it.
-}
-
-void DefaultPlatformDisplay::Init(PlatformDisplayDelegate* delegate) {
- delegate_ = delegate;
-
- gfx::Rect bounds(metrics_.size_in_pixels);
-#if defined(OS_WIN)
- platform_window_.reset(new ui::WinWindow(this, bounds));
-#elif defined(USE_X11)
- platform_window_.reset(new ui::X11Window(this));
-#elif defined(OS_ANDROID)
- platform_window_.reset(new ui::PlatformWindowAndroid(this));
-#elif defined(USE_OZONE)
- platform_window_ =
- ui::OzonePlatform::GetInstance()->CreatePlatformWindow(this, bounds);
-#else
- NOTREACHED() << "Unsupported platform";
-#endif
- platform_window_->SetBounds(bounds);
- platform_window_->Show();
-}
-
-DefaultPlatformDisplay::~DefaultPlatformDisplay() {
- // Don't notify the delegate from the destructor.
- delegate_ = nullptr;
-
- // Invalidate WeakPtrs now to avoid callbacks back into the
- // DefaultPlatformDisplay during destruction of |display_compositor_|.
- weak_factory_.InvalidateWeakPtrs();
- display_compositor_.reset();
- // Destroy the PlatformWindow early on as it may call us back during
- // destruction and we want to be in a known state. But destroy the surface
- // first because it can still be using the platform window.
- platform_window_.reset();
-}
-
-void DefaultPlatformDisplay::SchedulePaint(const ServerWindow* window,
- const gfx::Rect& bounds) {
- DCHECK(window);
- if (!window->IsDrawn())
- return;
- const gfx::Rect root_relative_rect =
- ConvertRectBetweenWindows(window, delegate_->GetRootWindow(), bounds);
- if (root_relative_rect.IsEmpty())
- return;
- dirty_rect_.Union(root_relative_rect);
- WantToDraw();
-}
-
-void DefaultPlatformDisplay::SetViewportSize(const gfx::Size& size) {
- platform_window_->SetBounds(gfx::Rect(size));
-}
-
-void DefaultPlatformDisplay::SetTitle(const base::string16& title) {
- platform_window_->SetTitle(title);
-}
-
-void DefaultPlatformDisplay::SetCapture() {
- platform_window_->SetCapture();
-}
-
-void DefaultPlatformDisplay::ReleaseCapture() {
- platform_window_->ReleaseCapture();
-}
-
-void DefaultPlatformDisplay::SetCursorById(int32_t cursor_id) {
-#if !defined(OS_ANDROID)
- // TODO(erg): This still isn't sufficient, and will only use native cursors
- // that chrome would use, not custom image cursors. For that, we should
- // delegate to the window manager to load images from resource packs.
- //
- // We probably also need to deal with different DPIs.
- ui::Cursor cursor(cursor_id);
- cursor_loader_->SetPlatformCursor(&cursor);
- platform_window_->SetCursor(cursor.platform());
-#endif
-}
-
-float DefaultPlatformDisplay::GetDeviceScaleFactor() {
- return metrics_.device_scale_factor;
-}
-
-mojom::Rotation DefaultPlatformDisplay::GetRotation() {
- // TODO(sky): implement me.
- return mojom::Rotation::VALUE_0;
-}
-
-void DefaultPlatformDisplay::UpdateTextInputState(
- const ui::TextInputState& state) {
- ui::PlatformImeController* ime = platform_window_->GetPlatformImeController();
- if (ime)
- ime->UpdateTextInputState(state);
-}
-
-void DefaultPlatformDisplay::SetImeVisibility(bool visible) {
- ui::PlatformImeController* ime = platform_window_->GetPlatformImeController();
- if (ime)
- ime->SetImeVisibility(visible);
-}
-
-void DefaultPlatformDisplay::Draw() {
- if (!delegate_->GetRootWindow()->visible())
- return;
-
- // TODO(fsamuel): We should add a trace for generating a top level frame.
- cc::CompositorFrame frame(GenerateCompositorFrame());
- frame_pending_ = true;
- if (display_compositor_) {
- display_compositor_->SubmitCompositorFrame(
- std::move(frame), base::Bind(&DefaultPlatformDisplay::DidDraw,
- weak_factory_.GetWeakPtr()));
- }
- dirty_rect_ = gfx::Rect();
-}
-
-void DefaultPlatformDisplay::DidDraw(cc::SurfaceDrawStatus status) {
- frame_pending_ = false;
- delegate_->OnCompositorFrameDrawn();
- if (!dirty_rect_.IsEmpty())
- WantToDraw();
-}
-
-bool DefaultPlatformDisplay::IsFramePending() const {
- return frame_pending_;
-}
-
-int64_t DefaultPlatformDisplay::GetDisplayId() const {
- return display_id_;
-}
-
-void DefaultPlatformDisplay::WantToDraw() {
- if (draw_timer_.IsRunning() || frame_pending_)
- return;
-
- // TODO(rjkroege): Use vblank to kick off Draw.
- draw_timer_.Start(
- FROM_HERE, base::TimeDelta(),
- base::Bind(&DefaultPlatformDisplay::Draw, weak_factory_.GetWeakPtr()));
-}
-
-void DefaultPlatformDisplay::UpdateMetrics(const gfx::Size& size,
- float device_scale_factor) {
- if (display::Display::HasForceDeviceScaleFactor())
- device_scale_factor = display::Display::GetForcedDeviceScaleFactor();
- if (metrics_.size_in_pixels == size &&
- metrics_.device_scale_factor == device_scale_factor)
- return;
-
- ViewportMetrics old_metrics = metrics_;
- metrics_.size_in_pixels = size;
- metrics_.device_scale_factor = device_scale_factor;
- delegate_->OnViewportMetricsChanged(old_metrics, metrics_);
-}
-
-cc::CompositorFrame DefaultPlatformDisplay::GenerateCompositorFrame() {
- std::unique_ptr<cc::RenderPass> render_pass = cc::RenderPass::Create();
- render_pass->damage_rect = dirty_rect_;
- render_pass->output_rect = gfx::Rect(metrics_.size_in_pixels);
-
- DrawWindowTree(render_pass.get(), delegate_->GetRootWindow(), gfx::Vector2d(),
- 1.0f);
-
- std::unique_ptr<cc::DelegatedFrameData> frame_data(
- new cc::DelegatedFrameData);
- frame_data->render_pass_list.push_back(std::move(render_pass));
-
- cc::CompositorFrame frame;
- frame.delegated_frame_data = std::move(frame_data);
- return frame;
-}
-
-void DefaultPlatformDisplay::OnBoundsChanged(const gfx::Rect& new_bounds) {
- UpdateMetrics(new_bounds.size(), metrics_.device_scale_factor);
-}
-
-void DefaultPlatformDisplay::OnDamageRect(const gfx::Rect& damaged_region) {
- dirty_rect_.Union(damaged_region);
- WantToDraw();
-}
-
-void DefaultPlatformDisplay::DispatchEvent(ui::Event* event) {
- if (event->IsScrollEvent()) {
- // TODO(moshayedi): crbug.com/602859. Dispatch scroll events as
- // they are once we have proper support for scroll events.
- delegate_->OnEvent(ui::MouseWheelEvent(*event->AsScrollEvent()));
- } else if (event->IsMouseEvent() && !event->IsMouseWheelEvent()) {
- delegate_->OnEvent(ui::PointerEvent(*event->AsMouseEvent()));
- } else if (event->IsTouchEvent()) {
- delegate_->OnEvent(ui::PointerEvent(*event->AsTouchEvent()));
- } else {
- delegate_->OnEvent(*event);
- }
-
-#if defined(USE_X11) || defined(USE_OZONE)
- // We want to emulate the WM_CHAR generation behaviour of Windows.
- //
- // On Linux, we've previously inserted characters by having
- // InputMethodAuraLinux take all key down events and send a character event
- // to the TextInputClient. This causes a mismatch in code that has to be
- // shared between Windows and Linux, including blink code. Now that we're
- // trying to have one way of doing things, we need to standardize on and
- // emulate Windows character events.
- //
- // This is equivalent to what we're doing in the current Linux port, but
- // done once instead of done multiple times in different places.
- if (event->type() == ui::ET_KEY_PRESSED) {
- ui::KeyEvent* key_press_event = event->AsKeyEvent();
- ui::KeyEvent char_event(key_press_event->GetCharacter(),
- key_press_event->key_code(),
- key_press_event->flags());
- DCHECK_EQ(key_press_event->GetCharacter(), char_event.GetCharacter());
- DCHECK_EQ(key_press_event->key_code(), char_event.key_code());
- DCHECK_EQ(key_press_event->flags(), char_event.flags());
- delegate_->OnEvent(char_event);
- }
-#endif
-}
-
-void DefaultPlatformDisplay::OnCloseRequest() {
- platform_window_->Close();
-}
-
-void DefaultPlatformDisplay::OnClosed() {
- if (delegate_)
- delegate_->OnDisplayClosed();
-}
-
-void DefaultPlatformDisplay::OnWindowStateChanged(
- ui::PlatformWindowState new_state) {}
-
-void DefaultPlatformDisplay::OnLostCapture() {
- delegate_->OnNativeCaptureLost();
-}
-
-void DefaultPlatformDisplay::OnAcceleratedWidgetAvailable(
- gfx::AcceleratedWidget widget,
- float device_scale_factor) {
- if (widget != gfx::kNullAcceleratedWidget) {
- display_compositor_.reset(
- new DisplayCompositor(base::ThreadTaskRunnerHandle::Get(), widget,
- gpu_state_, surfaces_state_));
- }
- UpdateMetrics(metrics_.size_in_pixels, device_scale_factor);
-}
-
-void DefaultPlatformDisplay::OnAcceleratedWidgetDestroyed() {
- NOTREACHED();
-}
-
-void DefaultPlatformDisplay::OnActivationChanged(bool active) {}
-
-void DefaultPlatformDisplay::RequestCopyOfOutput(
- std::unique_ptr<cc::CopyOutputRequest> output_request) {
- if (display_compositor_)
- display_compositor_->RequestCopyOfOutput(std::move(output_request));
-}
-
-} // namespace ws
-
-} // namespace mus
diff --git a/chromium/components/mus/ws/platform_display.h b/chromium/components/mus/ws/platform_display.h
deleted file mode 100644
index e16a46c1936..00000000000
--- a/chromium/components/mus/ws/platform_display.h
+++ /dev/null
@@ -1,195 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_
-#define COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_
-
-#include <stdint.h>
-
-#include <map>
-#include <memory>
-
-#include "base/macros.h"
-#include "base/memory/weak_ptr.h"
-#include "base/strings/string16.h"
-#include "base/timer/timer.h"
-#include "build/build_config.h"
-#include "cc/surfaces/surface.h"
-#include "components/mus/public/interfaces/window_manager.mojom.h"
-#include "components/mus/public/interfaces/window_manager_constants.mojom.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/ws/platform_display_delegate.h"
-#include "components/mus/ws/platform_display_init_params.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/platform_window/platform_window_delegate.h"
-
-namespace cc {
-class CompositorFrame;
-class CopyOutputRequest;
-class SurfaceIdAllocator;
-class SurfaceManager;
-} // namespace cc
-
-namespace gles2 {
-class GpuState;
-} // namespace gles2
-
-namespace shell {
-class Connector;
-} // namespace shell
-
-namespace ui {
-class CursorLoader;
-class PlatformWindow;
-struct TextInputState;
-} // namespace ui
-
-namespace mus {
-
-class GpuState;
-class SurfacesState;
-class DisplayCompositor;
-
-namespace ws {
-
-class EventDispatcher;
-class PlatformDisplayFactory;
-class ServerWindow;
-
-struct ViewportMetrics {
- gfx::Size size_in_pixels;
- float device_scale_factor = 0.f;
-};
-
-// PlatformDisplay is used to connect the root ServerWindow to a display.
-class PlatformDisplay {
- public:
- virtual ~PlatformDisplay() {}
-
- static PlatformDisplay* Create(const PlatformDisplayInitParams& init_params);
-
- virtual void Init(PlatformDisplayDelegate* delegate) = 0;
-
- // Schedules a paint for the specified region in the coordinates of |window|.
- virtual void SchedulePaint(const ServerWindow* window,
- const gfx::Rect& bounds) = 0;
-
- virtual void SetViewportSize(const gfx::Size& size) = 0;
-
- virtual void SetTitle(const base::string16& title) = 0;
-
- virtual void SetCapture() = 0;
-
- virtual void ReleaseCapture() = 0;
-
- virtual void SetCursorById(int32_t cursor) = 0;
-
- virtual mojom::Rotation GetRotation() = 0;
-
- virtual float GetDeviceScaleFactor() = 0;
-
- virtual void UpdateTextInputState(const ui::TextInputState& state) = 0;
- virtual void SetImeVisibility(bool visible) = 0;
-
- // Returns true if a compositor frame has been submitted but not drawn yet.
- virtual bool IsFramePending() const = 0;
-
- virtual void RequestCopyOfOutput(
- std::unique_ptr<cc::CopyOutputRequest> output_request) = 0;
-
- virtual int64_t GetDisplayId() const = 0;
-
- // Overrides factory for testing. Default (NULL) value indicates regular
- // (non-test) environment.
- static void set_factory_for_testing(PlatformDisplayFactory* factory) {
- PlatformDisplay::factory_ = factory;
- }
-
- private:
- // Static factory instance (always NULL for non-test).
- static PlatformDisplayFactory* factory_;
-};
-
-// PlatformDisplay implementation that connects to the services necessary to
-// actually display.
-class DefaultPlatformDisplay : public PlatformDisplay,
- public ui::PlatformWindowDelegate {
- public:
- explicit DefaultPlatformDisplay(const PlatformDisplayInitParams& init_params);
- ~DefaultPlatformDisplay() override;
-
- // PlatformDisplay:
- void Init(PlatformDisplayDelegate* delegate) override;
- void SchedulePaint(const ServerWindow* window,
- const gfx::Rect& bounds) override;
- void SetViewportSize(const gfx::Size& size) override;
- void SetTitle(const base::string16& title) override;
- void SetCapture() override;
- void ReleaseCapture() override;
- void SetCursorById(int32_t cursor) override;
- float GetDeviceScaleFactor() override;
- mojom::Rotation GetRotation() override;
- void UpdateTextInputState(const ui::TextInputState& state) override;
- void SetImeVisibility(bool visible) override;
- bool IsFramePending() const override;
- void RequestCopyOfOutput(
- std::unique_ptr<cc::CopyOutputRequest> output_request) override;
- int64_t GetDisplayId() const override;
-
- private:
- void WantToDraw();
-
- // This method initiates a top level redraw of the display.
- // TODO(fsamuel): This should use vblank as a signal rather than a timer
- // http://crbug.com/533042
- void Draw();
-
- // This is called after cc::Display has completed generating a new frame
- // for the display. TODO(fsamuel): Idle time processing should happen here
- // if there is budget for it.
- void DidDraw(cc::SurfaceDrawStatus status);
- void UpdateMetrics(const gfx::Size& size, float device_scale_factor);
- cc::CompositorFrame GenerateCompositorFrame();
-
- // ui::PlatformWindowDelegate:
- void OnBoundsChanged(const gfx::Rect& new_bounds) override;
- void OnDamageRect(const gfx::Rect& damaged_region) override;
- void DispatchEvent(ui::Event* event) override;
- void OnCloseRequest() override;
- void OnClosed() override;
- void OnWindowStateChanged(ui::PlatformWindowState new_state) override;
- void OnLostCapture() override;
- void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget,
- float device_scale_factor) override;
- void OnAcceleratedWidgetDestroyed() override;
- void OnActivationChanged(bool active) override;
-
- int64_t display_id_;
-
- scoped_refptr<GpuState> gpu_state_;
- scoped_refptr<SurfacesState> surfaces_state_;
- PlatformDisplayDelegate* delegate_;
-
- ViewportMetrics metrics_;
- gfx::Rect dirty_rect_;
- base::Timer draw_timer_;
- bool frame_pending_;
-
- std::unique_ptr<DisplayCompositor> display_compositor_;
- std::unique_ptr<ui::PlatformWindow> platform_window_;
-
-#if !defined(OS_ANDROID)
- std::unique_ptr<ui::CursorLoader> cursor_loader_;
-#endif
-
- base::WeakPtrFactory<DefaultPlatformDisplay> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(DefaultPlatformDisplay);
-};
-
-} // namespace ws
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_PLATFORM_DISPLAY_H_
diff --git a/chromium/components/mus/ws/platform_display_delegate.h b/chromium/components/mus/ws/platform_display_delegate.h
deleted file mode 100644
index 95a9c761dc4..00000000000
--- a/chromium/components/mus/ws/platform_display_delegate.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_PLATFORM_DISPLAY_DELEGATE_H_
-#define COMPONENTS_MUS_WS_PLATFORM_DISPLAY_DELEGATE_H_
-
-#include "components/mus/ws/ids.h"
-
-namespace ui {
-class Event;
-}
-
-namespace mus {
-
-namespace ws {
-
-class ServerWindow;
-struct ViewportMetrics;
-
-// PlatformDisplayDelegate is implemented by an object that manages the
-// lifetime of a PlatformDisplay, forwards events to the appropriate windows,
-/// and responses to changes in viewport size.
-class PlatformDisplayDelegate {
- public:
- // Returns the root window of this display.
- virtual ServerWindow* GetRootWindow() = 0;
-
- // Called when the window managed by the PlatformDisplay is closed.
- virtual void OnDisplayClosed() = 0;
-
- // Called when an event arrives.
- virtual void OnEvent(const ui::Event& event) = 0;
-
- // Called when the Display loses capture.
- virtual void OnNativeCaptureLost() = 0;
-
- // Signals that the metrics of this display's viewport has changed.
- virtual void OnViewportMetricsChanged(const ViewportMetrics& old_metrics,
- const ViewportMetrics& new_metrics) = 0;
-
- // Called when a compositor frame is finished drawing.
- virtual void OnCompositorFrameDrawn() = 0;
-
- protected:
- virtual ~PlatformDisplayDelegate() {}
-};
-
-} // namespace ws
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_PLATFORM_DISPLAY_DELEGATE_H_
diff --git a/chromium/components/mus/ws/platform_display_factory.h b/chromium/components/mus/ws/platform_display_factory.h
deleted file mode 100644
index 1cad7dd8331..00000000000
--- a/chromium/components/mus/ws/platform_display_factory.h
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_PLATFORM_DISPLAY_FACTORY_H_
-#define COMPONENTS_MUS_WS_PLATFORM_DISPLAY_FACTORY_H_
-
-namespace mus {
-namespace ws {
-
-class PlatformDisplay;
-
-// Abstract factory for PlatformDisplays. Used by tests to construct test
-// PlatformDisplays.
-class PlatformDisplayFactory {
- public:
- virtual PlatformDisplay* CreatePlatformDisplay() = 0;
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_PLATFORM_DISPLAY_FACTORY_H_
diff --git a/chromium/components/mus/ws/platform_display_init_params.cc b/chromium/components/mus/ws/platform_display_init_params.cc
deleted file mode 100644
index 394b5711637..00000000000
--- a/chromium/components/mus/ws/platform_display_init_params.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/platform_display_init_params.h"
-
-#include "components/mus/gles2/gpu_state.h"
-#include "components/mus/surfaces/surfaces_state.h"
-
-namespace mus {
-namespace ws {
-
-PlatformDisplayInitParams::PlatformDisplayInitParams()
- : display_bounds(gfx::Rect(0, 0, 1024, 768)), display_id(1) {}
-
-PlatformDisplayInitParams::PlatformDisplayInitParams(
- const PlatformDisplayInitParams& other) = default;
-PlatformDisplayInitParams::~PlatformDisplayInitParams() {}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/platform_display_init_params.h b/chromium/components/mus/ws/platform_display_init_params.h
deleted file mode 100644
index e596834f49b..00000000000
--- a/chromium/components/mus/ws/platform_display_init_params.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_PLATFORM_DISPLAY_INIT_PARAMS_H_
-#define COMPONENTS_MUS_WS_PLATFORM_DISPLAY_INIT_PARAMS_H_
-
-#include <stdint.h>
-
-#include "base/memory/ref_counted.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace shell {
-class Connector;
-}
-
-namespace mus {
-
-class GpuState;
-class SurfacesState;
-
-namespace ws {
-
-struct PlatformDisplayInitParams {
- PlatformDisplayInitParams();
- PlatformDisplayInitParams(const PlatformDisplayInitParams& other);
- ~PlatformDisplayInitParams();
-
- scoped_refptr<GpuState> gpu_state;
- scoped_refptr<SurfacesState> surfaces_state;
-
- gfx::Rect display_bounds;
- int64_t display_id;
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_PLATFORM_DISPLAY_INIT_PARAMS_H_
diff --git a/chromium/components/mus/ws/platform_screen.h b/chromium/components/mus/ws/platform_screen.h
deleted file mode 100644
index 3215c28c257..00000000000
--- a/chromium/components/mus/ws/platform_screen.h
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_PLATFORM_SCREEN_H_
-#define COMPONENTS_MUS_WS_PLATFORM_SCREEN_H_
-
-#include <stdint.h>
-
-#include "base/callback.h"
-
-namespace gfx {
-class Rect;
-}
-
-namespace mus {
-namespace ws {
-
-// PlatformScreen provides the necessary functionality to configure all
-// attached physical displays.
-class PlatformScreen {
- public:
- virtual ~PlatformScreen() {}
-
- // Creates a PlatformScreen instance.
- static std::unique_ptr<PlatformScreen> Create();
-
- // Initializes platform specific screen resources.
- virtual void Init() = 0;
-
- using ConfiguredDisplayCallback =
- base::Callback<void(int64_t, const gfx::Rect&)>;
-
- // ConfigurePhysicalDisplay() configures a single physical display and returns
- // its id and bounds for it via |callback|.
- virtual void ConfigurePhysicalDisplay(
- const ConfiguredDisplayCallback& callback) = 0;
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_PLATFORM_SCREEN_H_
diff --git a/chromium/components/mus/ws/platform_screen_impl.cc b/chromium/components/mus/ws/platform_screen_impl.cc
deleted file mode 100644
index e5ec99f660f..00000000000
--- a/chromium/components/mus/ws/platform_screen_impl.cc
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/platform_screen_impl.h"
-
-#include "base/bind.h"
-#include "base/location.h"
-#include "base/memory/ptr_util.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace mus {
-
-namespace ws {
-namespace {
-
-void FixedSizeScreenConfiguration(
- const PlatformScreen::ConfiguredDisplayCallback& callback) {
- callback.Run(1, gfx::Rect(1024, 768));
-}
-
-} // namespace
-
-// static
-std::unique_ptr<PlatformScreen> PlatformScreen::Create() {
- return base::WrapUnique(new PlatformScreenImpl);
-}
-
-PlatformScreenImpl::PlatformScreenImpl() {}
-
-PlatformScreenImpl::~PlatformScreenImpl() {}
-
-void PlatformScreenImpl::Init() {}
-
-void PlatformScreenImpl::ConfigurePhysicalDisplay(
- const PlatformScreen::ConfiguredDisplayCallback& callback) {
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(&FixedSizeScreenConfiguration, callback));
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/platform_screen_impl.h b/chromium/components/mus/ws/platform_screen_impl.h
deleted file mode 100644
index 166bff771b4..00000000000
--- a/chromium/components/mus/ws/platform_screen_impl.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_PLATFORM_SCREEN_IMPL_H_
-#define COMPONENTS_MUS_WS_PLATFORM_SCREEN_IMPL_H_
-
-#include <stdint.h>
-
-#include "base/callback.h"
-#include "components/mus/ws/platform_screen.h"
-
-namespace gfx {
-class Rect;
-}
-
-namespace mus {
-namespace ws {
-
-// PlatformScreenImpl provides the necessary functionality to configure all
-// attached physical displays on non-ozone platforms.
-class PlatformScreenImpl : public PlatformScreen {
- public:
- PlatformScreenImpl();
- ~PlatformScreenImpl() override;
-
- private:
- // PlatformScreen.
- void Init() override;
- void ConfigurePhysicalDisplay(
- const PlatformScreen::ConfiguredDisplayCallback& callback) override;
-
- DISALLOW_COPY_AND_ASSIGN(PlatformScreenImpl);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_PLATFORM_SCREEN_IMPL_H_
diff --git a/chromium/components/mus/ws/platform_screen_impl_ozone.cc b/chromium/components/mus/ws/platform_screen_impl_ozone.cc
deleted file mode 100644
index 91f2ba249da..00000000000
--- a/chromium/components/mus/ws/platform_screen_impl_ozone.cc
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/platform_screen_impl_ozone.h"
-
-#include "base/bind.h"
-#include "base/location.h"
-#include "base/memory/ptr_util.h"
-#include "base/sys_info.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "ui/display/types/display_snapshot.h"
-#include "ui/display/types/native_display_delegate.h"
-#include "ui/ozone/public/ozone_platform.h"
-
-namespace mus {
-
-namespace ws {
-namespace {
-
-// TODO(rjkroege): Remove this code once ozone oxygen has the same
-// display creation semantics as ozone drm.
-// Some ozone platforms do not configure physical displays and so do not
-// callback into this class via the implementation of NativeDisplayObserver.
-// FixedSizeScreenConfiguration() short-circuits the implementation of display
-// configuration in this case by calling the |callback| provided to
-// ConfigurePhysicalDisplay() with a hard-coded |id| and |bounds|.
-void FixedSizeScreenConfiguration(
- const PlatformScreen::ConfiguredDisplayCallback& callback) {
- callback.Run(1, gfx::Rect(1024, 768));
-}
-
-void GetDisplaysFinished(const std::vector<ui::DisplaySnapshot*>& displays) {
- // We don't really care about list of displays, we just want the snapshots
- // held by DrmDisplayManager to be updated. This only only happens when we
- // call NativeDisplayDelegate::GetDisplays(). Although, this would be a good
- // place to have PlatformScreen cache the snapshots if need be.
-}
-
-} // namespace
-
-// static
-std::unique_ptr<PlatformScreen> PlatformScreen::Create() {
- return base::WrapUnique(new PlatformScreenImplOzone);
-}
-
-PlatformScreenImplOzone::PlatformScreenImplOzone() : weak_ptr_factory_(this) {}
-
-PlatformScreenImplOzone::~PlatformScreenImplOzone() {}
-
-void PlatformScreenImplOzone::Init() {
- native_display_delegate_ =
- ui::OzonePlatform::GetInstance()->CreateNativeDisplayDelegate();
- native_display_delegate_->AddObserver(this);
- native_display_delegate_->Initialize();
-}
-
-void PlatformScreenImplOzone::ConfigurePhysicalDisplay(
- const PlatformScreen::ConfiguredDisplayCallback& callback) {
-#if defined(OS_CHROMEOS)
- if (base::SysInfo::IsRunningOnChromeOS()) {
- // Kick off the configuration of the physical displays comprising the
- // |PlatformScreenImplOzone|
-
- DCHECK(native_display_delegate_) << "DefaultDisplayManager::"
- "OnConfigurationChanged requires a "
- "native_display_delegate_ to work.";
-
- native_display_delegate_->GetDisplays(
- base::Bind(&PlatformScreenImplOzone::OnDisplaysAquired,
- weak_ptr_factory_.GetWeakPtr(), callback));
-
- return;
- }
-#endif // defined(OS_CHROMEOS)
- // PostTask()ed to maximize control flow similarity with the ChromeOS case.
- base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::Bind(&FixedSizeScreenConfiguration, callback));
-}
-
-void PlatformScreenImplOzone::OnConfigurationChanged() {}
-
-// The display subsystem calls |OnDisplaysAquired| to deliver |displays|
-// describing the attached displays.
-void PlatformScreenImplOzone::OnDisplaysAquired(
- const ConfiguredDisplayCallback& callback,
- const std::vector<ui::DisplaySnapshot*>& displays) {
- DCHECK(native_display_delegate_) << "DefaultDisplayManager::"
- "OnConfigurationChanged requires a "
- "native_display_delegate_ to work.";
- CHECK(displays.size() == 1) << "Mus only supports one 1 display\n";
- gfx::Point origin;
- for (auto display : displays) {
- if (!display->native_mode()) {
- LOG(ERROR) << "Display " << display->display_id()
- << " doesn't have a native mode";
- continue;
- }
- // Setup each native display. This places a task on the DRM thread's
- // runqueue that configures the window size correctly before the call to
- // Configure.
- native_display_delegate_->Configure(
- *display, display->native_mode(), origin,
- base::Bind(&PlatformScreenImplOzone::OnDisplayConfigured,
- weak_ptr_factory_.GetWeakPtr(), callback,
- display->display_id(),
- gfx::Rect(origin, display->native_mode()->size())));
- origin.Offset(display->native_mode()->size().width(), 0);
- }
-}
-
-void PlatformScreenImplOzone::OnDisplayConfigured(
- const ConfiguredDisplayCallback& callback,
- int64_t id,
- const gfx::Rect& bounds,
- bool success) {
- if (success) {
- native_display_delegate_->GetDisplays(base::Bind(&GetDisplaysFinished));
- callback.Run(id, bounds);
- } else {
- LOG(FATAL) << "Failed to configure display at " << bounds.ToString();
- }
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/platform_screen_impl_ozone.h b/chromium/components/mus/ws/platform_screen_impl_ozone.h
deleted file mode 100644
index 55949e4b45c..00000000000
--- a/chromium/components/mus/ws/platform_screen_impl_ozone.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_PLATFORM_SCREEN_IMPL_OZONE_H_
-#define COMPONENTS_MUS_WS_PLATFORM_SCREEN_IMPL_OZONE_H_
-
-#include <stdint.h>
-
-#include <vector>
-
-#include "base/callback.h"
-#include "base/memory/weak_ptr.h"
-#include "components/mus/ws/platform_screen.h"
-#include "ui/display/types/native_display_observer.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace gfx {
-class Rect;
-}
-
-namespace ui {
-class NativeDisplayDelegate;
-class DisplaySnapshot;
-}
-
-namespace mus {
-namespace ws {
-
-// PlatformScreenImplOzone provides the necessary functionality to configure all
-// attached physical displays on the ozone platform.
-class PlatformScreenImplOzone : public PlatformScreen,
- public ui::NativeDisplayObserver {
- public:
- PlatformScreenImplOzone();
- ~PlatformScreenImplOzone() override;
-
- private:
- // PlatformScreen
- void Init() override; // Must not be called until after the ozone platform is
- // initialized.
- void ConfigurePhysicalDisplay(
- const ConfiguredDisplayCallback& callback) override;
-
- // TODO(rjkroege): NativeDisplayObserver is misnamed as it tracks changes in
- // the physical "Screen". Consider renaming it to NativeScreenObserver.
- // ui::NativeDisplayObserver:
- void OnConfigurationChanged() override;
-
- // Display management callback.
- void OnDisplaysAquired(const ConfiguredDisplayCallback& callback,
- const std::vector<ui::DisplaySnapshot*>& displays);
-
- // The display subsystem calls |OnDisplayConfigured| for each display that has
- // been successfully configured. This in turn calls |callback_| with the
- // identity and bounds of each physical display.
- void OnDisplayConfigured(const ConfiguredDisplayCallback& callback,
- int64_t id,
- const gfx::Rect& bounds,
- bool success);
-
- std::unique_ptr<ui::NativeDisplayDelegate> native_display_delegate_;
-
- base::WeakPtrFactory<PlatformScreenImplOzone> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(PlatformScreenImplOzone);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_PLATFORM_SCREEN_IMPL_OZONE_H_
diff --git a/chromium/components/mus/ws/scheduled_animation_group.cc b/chromium/components/mus/ws/scheduled_animation_group.cc
deleted file mode 100644
index d76b7895597..00000000000
--- a/chromium/components/mus/ws/scheduled_animation_group.cc
+++ /dev/null
@@ -1,356 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/scheduled_animation_group.h"
-
-#include <set>
-
-#include "components/mus/ws/server_window.h"
-
-using mus::mojom::AnimationProperty;
-
-namespace mus {
-namespace ws {
-namespace {
-
-using Sequences = std::vector<ScheduledAnimationSequence>;
-
-// Gets the value of |property| from |window| into |value|.
-void GetValueFromWindow(const ServerWindow* window,
- AnimationProperty property,
- ScheduledAnimationValue* value) {
- switch (property) {
- case AnimationProperty::NONE:
- NOTREACHED();
- break;
- case AnimationProperty::OPACITY:
- value->float_value = window->opacity();
- break;
- case AnimationProperty::TRANSFORM:
- value->transform = window->transform();
- break;
- }
-}
-
-// Sets the value of |property| from |value| into |window|.
-void SetWindowPropertyFromValue(ServerWindow* window,
- AnimationProperty property,
- const ScheduledAnimationValue& value) {
- switch (property) {
- case AnimationProperty::NONE:
- break;
- case AnimationProperty::OPACITY:
- window->SetOpacity(value.float_value);
- break;
- case AnimationProperty::TRANSFORM:
- window->SetTransform(value.transform);
- break;
- }
-}
-
-// Sets the value of |property| into |window| between two points.
-void SetWindowPropertyFromValueBetween(ServerWindow* window,
- AnimationProperty property,
- double value,
- gfx::Tween::Type tween_type,
- const ScheduledAnimationValue& start,
- const ScheduledAnimationValue& target) {
- const double tween_value = gfx::Tween::CalculateValue(tween_type, value);
- switch (property) {
- case AnimationProperty::NONE:
- break;
- case AnimationProperty::OPACITY:
- window->SetOpacity(gfx::Tween::FloatValueBetween(
- tween_value, start.float_value, target.float_value));
- break;
- case AnimationProperty::TRANSFORM:
- window->SetTransform(gfx::Tween::TransformValueBetween(
- tween_value, start.transform, target.transform));
- break;
- }
-}
-
-// TODO(mfomitchev): Use struct traits for this?
-gfx::Tween::Type AnimationTypeToTweenType(mojom::AnimationTweenType type) {
- switch (type) {
- case mojom::AnimationTweenType::LINEAR:
- return gfx::Tween::LINEAR;
- case mojom::AnimationTweenType::EASE_IN:
- return gfx::Tween::EASE_IN;
- case mojom::AnimationTweenType::EASE_OUT:
- return gfx::Tween::EASE_OUT;
- case mojom::AnimationTweenType::EASE_IN_OUT:
- return gfx::Tween::EASE_IN_OUT;
- }
- return gfx::Tween::LINEAR;
-}
-
-void ConvertToScheduledValue(const mojom::AnimationValue& transport_value,
- ScheduledAnimationValue* value) {
- value->float_value = transport_value.float_value;
- value->transform = transport_value.transform;
-}
-
-void ConvertToScheduledElement(const mojom::AnimationElement& transport_element,
- ScheduledAnimationElement* element) {
- element->property = transport_element.property;
- element->duration =
- base::TimeDelta::FromMicroseconds(transport_element.duration);
- element->tween_type = AnimationTypeToTweenType(transport_element.tween_type);
- if (transport_element.property != AnimationProperty::NONE) {
- if (transport_element.start_value.get()) {
- element->is_start_valid = true;
- ConvertToScheduledValue(*transport_element.start_value,
- &(element->start_value));
- } else {
- element->is_start_valid = false;
- }
- ConvertToScheduledValue(*transport_element.target_value,
- &(element->target_value));
- }
-}
-
-bool IsAnimationValueValid(AnimationProperty property,
- const mojom::AnimationValue& value) {
- bool result;
- switch (property) {
- case AnimationProperty::NONE:
- NOTREACHED();
- return false;
- case AnimationProperty::OPACITY:
- result = value.float_value >= 0.f && value.float_value <= 1.f;
- DVLOG_IF(1, !result) << "Invalid AnimationValue for opacity: "
- << value.float_value;
- return result;
- case AnimationProperty::TRANSFORM:
- return true;
- }
- return false;
-}
-
-bool IsAnimationElementValid(const mojom::AnimationElement& element) {
- if (element.property == AnimationProperty::NONE)
- return true; // None is a pause and doesn't need any values.
- if (element.start_value.get() &&
- !IsAnimationValueValid(element.property, *element.start_value))
- return false;
- // For all other properties we require a target.
- return element.target_value.get() &&
- IsAnimationValueValid(element.property, *element.target_value);
-}
-
-bool IsAnimationSequenceValid(const mojom::AnimationSequence& sequence) {
- if (sequence.elements.size() == 0) {
- DVLOG(1) << "Empty or null AnimationSequence - invalid.";
- return false;
- }
-
- for (size_t i = 0; i < sequence.elements.size(); ++i) {
- if (!IsAnimationElementValid(*sequence.elements[i]))
- return false;
- }
- return true;
-}
-
-bool IsAnimationGroupValid(const mojom::AnimationGroup& transport_group) {
- if (transport_group.sequences.size() == 0) {
- DVLOG(1) << "Empty or null AnimationGroup - invalid; window_id="
- << transport_group.window_id;
- return false;
- }
- for (size_t i = 0; i < transport_group.sequences.size(); ++i) {
- if (!IsAnimationSequenceValid(*transport_group.sequences[i]))
- return false;
- }
- return true;
-}
-
-// If the start value for |element| isn't valid, the value for the property
-// is obtained from |window| and placed into |element|.
-void GetStartValueFromWindowIfNecessary(const ServerWindow* window,
- ScheduledAnimationElement* element) {
- if (element->property != AnimationProperty::NONE &&
- !element->is_start_valid) {
- GetValueFromWindow(window, element->property, &(element->start_value));
- }
-}
-
-void GetScheduledAnimationProperties(const Sequences& sequences,
- std::set<AnimationProperty>* properties) {
- for (const ScheduledAnimationSequence& sequence : sequences) {
- for (const ScheduledAnimationElement& element : sequence.elements)
- properties->insert(element.property);
- }
-}
-
-// Set |window|'s specified |property| to the value resulting from running all
-// the |sequences|.
-void SetPropertyToTargetProperty(ServerWindow* window,
- mojom::AnimationProperty property,
- const Sequences& sequences) {
- // NOTE: this doesn't deal with |cycle_count| quite right, but I'm honestly
- // not sure we really want to support the same property in multiple sequences
- // animating at once so I'm not dealing.
- base::TimeDelta max_end_duration;
- std::unique_ptr<ScheduledAnimationValue> value;
- for (const ScheduledAnimationSequence& sequence : sequences) {
- base::TimeDelta duration;
- for (const ScheduledAnimationElement& element : sequence.elements) {
- if (element.property != property)
- continue;
-
- duration += element.duration;
- if (duration > max_end_duration) {
- max_end_duration = duration;
- value.reset(new ScheduledAnimationValue(element.target_value));
- }
- }
- }
- if (value.get())
- SetWindowPropertyFromValue(window, property, *value);
-}
-
-void ConvertSequenceToScheduled(
- const mojom::AnimationSequence& transport_sequence,
- base::TimeTicks now,
- ScheduledAnimationSequence* sequence) {
- sequence->run_until_stopped = transport_sequence.cycle_count == 0u;
- sequence->cycle_count = transport_sequence.cycle_count;
- DCHECK_NE(0u, transport_sequence.elements.size());
- sequence->elements.resize(transport_sequence.elements.size());
-
- base::TimeTicks element_start_time = now;
- for (size_t i = 0; i < transport_sequence.elements.size(); ++i) {
- ConvertToScheduledElement(*(transport_sequence.elements[i].get()),
- &(sequence->elements[i]));
- sequence->elements[i].start_time = element_start_time;
- sequence->duration += sequence->elements[i].duration;
- element_start_time += sequence->elements[i].duration;
- }
-}
-
-bool AdvanceSequence(ServerWindow* window,
- ScheduledAnimationSequence* sequence,
- base::TimeTicks now) {
- ScheduledAnimationElement* element =
- &(sequence->elements[sequence->current_index]);
- while (element->start_time + element->duration < now) {
- SetWindowPropertyFromValue(window, element->property,
- element->target_value);
- if (++sequence->current_index == sequence->elements.size()) {
- if (!sequence->run_until_stopped && --sequence->cycle_count == 0) {
- return false;
- }
-
- sequence->current_index = 0;
- }
- sequence->elements[sequence->current_index].start_time =
- element->start_time + element->duration;
- element = &(sequence->elements[sequence->current_index]);
- GetStartValueFromWindowIfNecessary(window, element);
-
- // It's possible for the delta between now and |last_tick_time_| to be very
- // big (could happen if machine sleeps and is woken up much later). Normally
- // the repeat count is smallish, so we don't bother optimizing it. OTOH if
- // a sequence repeats forever we optimize it lest we get stuck in this loop
- // for a very long time.
- if (sequence->run_until_stopped && sequence->current_index == 0) {
- element->start_time =
- now - base::TimeDelta::FromMicroseconds(
- (now - element->start_time).InMicroseconds() %
- sequence->duration.InMicroseconds());
- }
- }
- return true;
-}
-
-} // namespace
-
-ScheduledAnimationValue::ScheduledAnimationValue() : float_value(0) {}
-ScheduledAnimationValue::~ScheduledAnimationValue() {}
-
-ScheduledAnimationElement::ScheduledAnimationElement()
- : property(AnimationProperty::OPACITY),
- tween_type(gfx::Tween::EASE_IN),
- is_start_valid(false) {}
-ScheduledAnimationElement::ScheduledAnimationElement(
- const ScheduledAnimationElement& other) = default;
-ScheduledAnimationElement::~ScheduledAnimationElement() {}
-
-ScheduledAnimationSequence::ScheduledAnimationSequence()
- : run_until_stopped(false), cycle_count(0), current_index(0u) {}
-ScheduledAnimationSequence::ScheduledAnimationSequence(
- const ScheduledAnimationSequence& other) = default;
-ScheduledAnimationSequence::~ScheduledAnimationSequence() {}
-
-ScheduledAnimationGroup::~ScheduledAnimationGroup() {}
-
-// static
-std::unique_ptr<ScheduledAnimationGroup> ScheduledAnimationGroup::Create(
- ServerWindow* window,
- base::TimeTicks now,
- uint32_t id,
- const mojom::AnimationGroup& transport_group) {
- if (!IsAnimationGroupValid(transport_group))
- return nullptr;
-
- std::unique_ptr<ScheduledAnimationGroup> group(
- new ScheduledAnimationGroup(window, id, now));
- group->sequences_.resize(transport_group.sequences.size());
- for (size_t i = 0; i < transport_group.sequences.size(); ++i) {
- const mojom::AnimationSequence& transport_sequence(
- *(transport_group.sequences[i]));
- DCHECK_NE(0u, transport_sequence.elements.size());
- ConvertSequenceToScheduled(transport_sequence, now, &group->sequences_[i]);
- }
- return group;
-}
-
-void ScheduledAnimationGroup::ObtainStartValues() {
- for (ScheduledAnimationSequence& sequence : sequences_)
- GetStartValueFromWindowIfNecessary(window_, &(sequence.elements[0]));
-}
-
-void ScheduledAnimationGroup::SetValuesToTargetValuesForPropertiesNotIn(
- const ScheduledAnimationGroup& other) {
- std::set<AnimationProperty> our_properties;
- GetScheduledAnimationProperties(sequences_, &our_properties);
-
- std::set<AnimationProperty> other_properties;
- GetScheduledAnimationProperties(other.sequences_, &other_properties);
-
- for (AnimationProperty property : our_properties) {
- if (other_properties.count(property) == 0 &&
- property != AnimationProperty::NONE) {
- SetPropertyToTargetProperty(window_, property, sequences_);
- }
- }
-}
-
-bool ScheduledAnimationGroup::Tick(base::TimeTicks time) {
- for (Sequences::iterator i = sequences_.begin(); i != sequences_.end();) {
- if (!AdvanceSequence(window_, &(*i), time)) {
- i = sequences_.erase(i);
- continue;
- }
- const ScheduledAnimationElement& active_element(
- i->elements[i->current_index]);
- const double percent =
- (time - active_element.start_time).InMillisecondsF() /
- active_element.duration.InMillisecondsF();
- SetWindowPropertyFromValueBetween(
- window_, active_element.property, percent, active_element.tween_type,
- active_element.start_value, active_element.target_value);
- ++i;
- }
- return sequences_.empty();
-}
-
-ScheduledAnimationGroup::ScheduledAnimationGroup(ServerWindow* window,
- uint32_t id,
- base::TimeTicks time_scheduled)
- : window_(window), id_(id), time_scheduled_(time_scheduled) {}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/scheduled_animation_group.h b/chromium/components/mus/ws/scheduled_animation_group.h
deleted file mode 100644
index 2c19bcd2e09..00000000000
--- a/chromium/components/mus/ws/scheduled_animation_group.h
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_SCHEDULED_ANIMATION_GROUP_H_
-#define COMPONENTS_MUS_WS_SCHEDULED_ANIMATION_GROUP_H_
-
-#include <memory>
-#include <vector>
-
-#include "base/time/time.h"
-#include "components/mus/public/interfaces/animations.mojom.h"
-#include "ui/gfx/animation/tween.h"
-#include "ui/gfx/transform.h"
-
-namespace mus {
-namespace ws {
-
-class ServerWindow;
-
-struct ScheduledAnimationValue {
- ScheduledAnimationValue();
- ~ScheduledAnimationValue();
-
- float float_value;
- gfx::Transform transform;
-};
-
-struct ScheduledAnimationElement {
- ScheduledAnimationElement();
- // Needed because we call resize() vector of elements.
- ScheduledAnimationElement(const ScheduledAnimationElement& other);
- ~ScheduledAnimationElement();
-
- mojom::AnimationProperty property;
- base::TimeDelta duration;
- gfx::Tween::Type tween_type;
- bool is_start_valid;
- ScheduledAnimationValue start_value;
- ScheduledAnimationValue target_value;
- // Start time is based on scheduled time and relative to any other elements
- // in the sequence.
- base::TimeTicks start_time;
-};
-
-struct ScheduledAnimationSequence {
- ScheduledAnimationSequence();
- // Needed because we call resize() and erase() on vector of sequences.
- ScheduledAnimationSequence(const ScheduledAnimationSequence& other);
- ~ScheduledAnimationSequence();
-
- bool run_until_stopped;
- std::vector<ScheduledAnimationElement> elements;
-
- // Sum of the duration of all elements. This does not take into account
- // |cycle_count|.
- base::TimeDelta duration;
-
- // The following values are updated as the animation progresses.
-
- // Number of cycles remaining. This is only used if |run_until_stopped| is
- // false.
- uint32_t cycle_count;
-
- // Index into |elements| of the element currently animating.
- size_t current_index;
-};
-
-// Corresponds to a mojom::AnimationGroup and is responsible for running the
-// actual animation.
-class ScheduledAnimationGroup {
- public:
- ~ScheduledAnimationGroup();
-
- // Returns a new ScheduledAnimationGroup from the supplied parameters, or
- // null if |transport_group| isn't valid.
- static std::unique_ptr<ScheduledAnimationGroup> Create(
- ServerWindow* window,
- base::TimeTicks now,
- uint32_t id,
- const mojom::AnimationGroup& transport_group);
-
- uint32_t id() const { return id_; }
-
- // Gets the start value for any elements that don't have an explicit start.
- // value.
- void ObtainStartValues();
-
- // Sets the values of any properties that are not in |other| to their final
- // value.
- void SetValuesToTargetValuesForPropertiesNotIn(
- const ScheduledAnimationGroup& other);
-
- // Advances the group. |time| is the current time. Returns true if the group
- // is done (nothing left to animate).
- bool Tick(base::TimeTicks time);
-
- ServerWindow* window() { return window_; }
-
- private:
- ScheduledAnimationGroup(ServerWindow* window,
- uint32_t id,
- base::TimeTicks time_scheduled);
-
- ServerWindow* window_;
- const uint32_t id_;
- base::TimeTicks time_scheduled_;
- std::vector<ScheduledAnimationSequence> sequences_;
-
- DISALLOW_COPY_AND_ASSIGN(ScheduledAnimationGroup);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_SCHEDULED_ANIMATION_GROUP_H_
diff --git a/chromium/components/mus/ws/scheduled_animation_group_unittest.cc b/chromium/components/mus/ws/scheduled_animation_group_unittest.cc
deleted file mode 100644
index 27c2f76c9b7..00000000000
--- a/chromium/components/mus/ws/scheduled_animation_group_unittest.cc
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/scheduled_animation_group.h"
-
-#include "components/mus/public/interfaces/animations.mojom.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/test_server_window_delegate.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-using mus::mojom::AnimationProperty;
-using mus::mojom::AnimationTweenType;
-using mus::mojom::AnimationGroup;
-using mus::mojom::AnimationSequence;
-using mus::mojom::AnimationElement;
-using mus::mojom::AnimationValue;
-
-namespace mus {
-namespace ws {
-namespace {
-
-bool IsAnimationGroupValid(const AnimationGroup& transport_group) {
- TestServerWindowDelegate window_delegate;
- ServerWindow window(&window_delegate, WindowId());
- std::unique_ptr<ScheduledAnimationGroup> group(
- ScheduledAnimationGroup::Create(&window, base::TimeTicks::Now(), 1,
- transport_group));
- return group.get() != nullptr;
-}
-
-} // namespace
-
-TEST(ScheduledAnimationGroupTest, IsAnimationGroupValid) {
- AnimationGroup group;
-
- // AnimationGroup with no sequences is not valid.
- EXPECT_FALSE(IsAnimationGroupValid(group));
-
- group.sequences.push_back(AnimationSequence::New());
-
- // Sequence with no elements is not valid.
- EXPECT_FALSE(IsAnimationGroupValid(group));
-
- AnimationSequence& sequence = *(group.sequences[0]);
- sequence.elements.push_back(AnimationElement::New());
- AnimationElement& element = *(sequence.elements[0]);
- element.property = AnimationProperty::OPACITY;
- element.tween_type = AnimationTweenType::LINEAR;
-
- // Element with no target_value is not valid.
- EXPECT_FALSE(IsAnimationGroupValid(group));
-
- // Opacity must be between 0 and 1.
- element.target_value = AnimationValue::New();
- element.target_value->float_value = 2.5f;
- EXPECT_FALSE(IsAnimationGroupValid(group));
-
- element.target_value->float_value = .5f;
- EXPECT_TRUE(IsAnimationGroupValid(group));
-
- // Bogus start value.
- element.start_value = AnimationValue::New();
- element.start_value->float_value = 2.5f;
- EXPECT_FALSE(IsAnimationGroupValid(group));
-
- element.start_value->float_value = .5f;
- EXPECT_TRUE(IsAnimationGroupValid(group));
-
- // All transforms are valid.
- element.property = AnimationProperty::TRANSFORM;
- EXPECT_TRUE(IsAnimationGroupValid(group));
-
- // Add another empty sequence, should be invalid again.
- group.sequences.push_back(AnimationSequence::New());
- EXPECT_FALSE(IsAnimationGroupValid(group));
-
- AnimationSequence& sequence2 = *(group.sequences[1]);
- sequence2.elements.push_back(AnimationElement::New());
- AnimationElement& element2 = *(sequence2.elements[0]);
- element2.property = AnimationProperty::OPACITY;
- element2.tween_type = AnimationTweenType::LINEAR;
-
- // Element with no target_value is not valid.
- EXPECT_FALSE(IsAnimationGroupValid(group));
-
- element2.property = AnimationProperty::NONE;
- EXPECT_TRUE(IsAnimationGroupValid(group));
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/server_window.cc b/chromium/components/mus/ws/server_window.cc
deleted file mode 100644
index f6a9304a03b..00000000000
--- a/chromium/components/mus/ws/server_window.cc
+++ /dev/null
@@ -1,470 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/server_window.h"
-
-#include <inttypes.h>
-#include <stddef.h>
-
-#include "base/strings/stringprintf.h"
-#include "components/mus/common/transient_window_utils.h"
-#include "components/mus/public/interfaces/window_manager.mojom.h"
-#include "components/mus/ws/server_window_delegate.h"
-#include "components/mus/ws/server_window_observer.h"
-#include "components/mus/ws/server_window_surface_manager.h"
-
-namespace mus {
-
-namespace ws {
-
-ServerWindow::ServerWindow(ServerWindowDelegate* delegate, const WindowId& id)
- : ServerWindow(delegate, id, Properties()) {}
-
-ServerWindow::ServerWindow(ServerWindowDelegate* delegate,
- const WindowId& id,
- const Properties& properties)
- : delegate_(delegate),
- id_(id),
- parent_(nullptr),
- stacking_target_(nullptr),
- transient_parent_(nullptr),
- is_modal_(false),
- visible_(false),
- cursor_id_(mojom::Cursor::CURSOR_NULL),
- non_client_cursor_id_(mojom::Cursor::CURSOR_NULL),
- opacity_(1),
- can_focus_(true),
- properties_(properties),
- // Don't notify newly added observers during notification. This causes
- // problems for code that adds an observer as part of an observer
- // notification (such as ServerWindowDrawTracker).
- observers_(
- base::ObserverList<ServerWindowObserver>::NOTIFY_EXISTING_ONLY) {
- DCHECK(delegate); // Must provide a delegate.
-}
-
-ServerWindow::~ServerWindow() {
- FOR_EACH_OBSERVER(ServerWindowObserver, observers_, OnWindowDestroying(this));
-
- if (transient_parent_)
- transient_parent_->RemoveTransientWindow(this);
-
- // Destroy transient children, only after we've removed ourselves from our
- // parent, as destroying an active transient child may otherwise attempt to
- // refocus us.
- Windows transient_children(transient_children_);
- STLDeleteElements(&transient_children);
- DCHECK(transient_children_.empty());
-
- while (!children_.empty())
- children_.front()->parent()->Remove(children_.front());
-
- if (parent_)
- parent_->Remove(this);
-
- FOR_EACH_OBSERVER(ServerWindowObserver, observers_, OnWindowDestroyed(this));
-}
-
-void ServerWindow::AddObserver(ServerWindowObserver* observer) {
- observers_.AddObserver(observer);
-}
-
-void ServerWindow::RemoveObserver(ServerWindowObserver* observer) {
- DCHECK(observers_.HasObserver(observer));
- observers_.RemoveObserver(observer);
-}
-
-void ServerWindow::CreateSurface(mojom::SurfaceType surface_type,
- mojo::InterfaceRequest<mojom::Surface> request,
- mojom::SurfaceClientPtr client) {
- GetOrCreateSurfaceManager()->CreateSurface(surface_type, std::move(request),
- std::move(client));
-}
-
-void ServerWindow::Add(ServerWindow* child) {
- // We assume validation checks happened already.
- DCHECK(child);
- DCHECK(child != this);
- DCHECK(!child->Contains(this));
- if (child->parent() == this) {
- if (children_.size() == 1)
- return; // Already in the right position.
- child->Reorder(children_.back(), mojom::OrderDirection::ABOVE);
- return;
- }
-
- ServerWindow* old_parent = child->parent();
- FOR_EACH_OBSERVER(ServerWindowObserver, child->observers_,
- OnWillChangeWindowHierarchy(child, this, old_parent));
-
- if (child->parent())
- child->parent()->RemoveImpl(child);
-
- child->parent_ = this;
- children_.push_back(child);
-
- // Stack the child properly if it is a transient child of a sibling.
- if (child->transient_parent_ && child->transient_parent_->parent() == this)
- RestackTransientDescendants(child->transient_parent_, &GetStackingTarget,
- &ReorderImpl);
-
- FOR_EACH_OBSERVER(ServerWindowObserver, child->observers_,
- OnWindowHierarchyChanged(child, this, old_parent));
-}
-
-void ServerWindow::Remove(ServerWindow* child) {
- // We assume validation checks happened else where.
- DCHECK(child);
- DCHECK(child != this);
- DCHECK(child->parent() == this);
-
- FOR_EACH_OBSERVER(ServerWindowObserver, child->observers_,
- OnWillChangeWindowHierarchy(child, nullptr, this));
- RemoveImpl(child);
-
- // Stack the child properly if it is a transient child of a sibling.
- if (child->transient_parent_ && child->transient_parent_->parent() == this)
- RestackTransientDescendants(child->transient_parent_, &GetStackingTarget,
- &ReorderImpl);
-
- FOR_EACH_OBSERVER(ServerWindowObserver, child->observers_,
- OnWindowHierarchyChanged(child, nullptr, this));
-}
-
-void ServerWindow::Reorder(ServerWindow* relative,
- mojom::OrderDirection direction) {
- ReorderImpl(this, relative, direction);
-}
-
-void ServerWindow::StackChildAtBottom(ServerWindow* child) {
- // There's nothing to do if the child is already at the bottom.
- if (children_.size() <= 1 || child == children_.front())
- return;
- child->Reorder(children_.front(), mojom::OrderDirection::BELOW);
-}
-
-void ServerWindow::StackChildAtTop(ServerWindow* child) {
- // There's nothing to do if the child is already at the top.
- if (children_.size() <= 1 || child == children_.back())
- return;
- child->Reorder(children_.back(), mojom::OrderDirection::ABOVE);
-}
-
-void ServerWindow::SetBounds(const gfx::Rect& bounds) {
- if (bounds_ == bounds)
- return;
-
- // TODO(fsamuel): figure out how will this work with CompositorFrames.
-
- const gfx::Rect old_bounds = bounds_;
- bounds_ = bounds;
- FOR_EACH_OBSERVER(ServerWindowObserver, observers_,
- OnWindowBoundsChanged(this, old_bounds, bounds));
-}
-
-void ServerWindow::SetClientArea(
- const gfx::Insets& insets,
- const std::vector<gfx::Rect>& additional_client_areas) {
- if (client_area_ == insets &&
- additional_client_areas == additional_client_areas_) {
- return;
- }
-
- additional_client_areas_ = additional_client_areas;
- client_area_ = insets;
- FOR_EACH_OBSERVER(
- ServerWindowObserver, observers_,
- OnWindowClientAreaChanged(this, insets, additional_client_areas));
-}
-
-void ServerWindow::SetHitTestMask(const gfx::Rect& mask) {
- hit_test_mask_.reset(new gfx::Rect(mask));
-}
-
-void ServerWindow::ClearHitTestMask() {
- hit_test_mask_.reset();
-}
-
-const ServerWindow* ServerWindow::GetRoot() const {
- return delegate_->GetRootWindow(this);
-}
-
-std::vector<const ServerWindow*> ServerWindow::GetChildren() const {
- std::vector<const ServerWindow*> children;
- children.reserve(children_.size());
- for (size_t i = 0; i < children_.size(); ++i)
- children.push_back(children_[i]);
- return children;
-}
-
-std::vector<ServerWindow*> ServerWindow::GetChildren() {
- // TODO(sky): rename to children() and fix return type.
- return children_;
-}
-
-ServerWindow* ServerWindow::GetChildWindow(const WindowId& window_id) {
- if (id_ == window_id)
- return this;
-
- for (ServerWindow* child : children_) {
- ServerWindow* window = child->GetChildWindow(window_id);
- if (window)
- return window;
- }
-
- return nullptr;
-}
-
-bool ServerWindow::AddTransientWindow(ServerWindow* child) {
- // A system modal window cannot become a transient child.
- if (child->is_modal() && !child->transient_parent())
- return false;
-
- if (child->transient_parent())
- child->transient_parent()->RemoveTransientWindow(child);
-
- DCHECK(std::find(transient_children_.begin(), transient_children_.end(),
- child) == transient_children_.end());
- transient_children_.push_back(child);
- child->transient_parent_ = this;
-
- // Restack |child| properly above its transient parent, if they share the same
- // parent.
- if (child->parent() == parent())
- RestackTransientDescendants(this, &GetStackingTarget, &ReorderImpl);
-
- FOR_EACH_OBSERVER(ServerWindowObserver, observers_,
- OnTransientWindowAdded(this, child));
- return true;
-}
-
-void ServerWindow::RemoveTransientWindow(ServerWindow* child) {
- Windows::iterator i =
- std::find(transient_children_.begin(), transient_children_.end(), child);
- DCHECK(i != transient_children_.end());
- transient_children_.erase(i);
- DCHECK_EQ(this, child->transient_parent());
- child->transient_parent_ = nullptr;
-
- // If |child| and its former transient parent share the same parent, |child|
- // should be restacked properly so it is not among transient children of its
- // former parent, anymore.
- if (parent() == child->parent())
- RestackTransientDescendants(this, &GetStackingTarget, &ReorderImpl);
-
- FOR_EACH_OBSERVER(ServerWindowObserver, observers_,
- OnTransientWindowRemoved(this, child));
-}
-
-void ServerWindow::SetModal() {
- is_modal_ = true;
-}
-
-bool ServerWindow::Contains(const ServerWindow* window) const {
- for (const ServerWindow* parent = window; parent; parent = parent->parent_) {
- if (parent == this)
- return true;
- }
- return false;
-}
-
-void ServerWindow::SetVisible(bool value) {
- if (visible_ == value)
- return;
-
- FOR_EACH_OBSERVER(ServerWindowObserver, observers_,
- OnWillChangeWindowVisibility(this));
- visible_ = value;
- FOR_EACH_OBSERVER(ServerWindowObserver, observers_,
- OnWindowVisibilityChanged(this));
-}
-
-void ServerWindow::SetOpacity(float value) {
- if (value == opacity_)
- return;
- float old_opacity = opacity_;
- opacity_ = value;
- delegate_->OnScheduleWindowPaint(this);
- FOR_EACH_OBSERVER(ServerWindowObserver, observers_,
- OnWindowOpacityChanged(this, old_opacity, opacity_));
-}
-
-void ServerWindow::SetPredefinedCursor(mus::mojom::Cursor value) {
- if (value == cursor_id_)
- return;
- cursor_id_ = value;
- FOR_EACH_OBSERVER(
- ServerWindowObserver, observers_,
- OnWindowPredefinedCursorChanged(this, static_cast<int32_t>(value)));
-}
-
-void ServerWindow::SetNonClientCursor(mus::mojom::Cursor value) {
- if (value == non_client_cursor_id_)
- return;
- non_client_cursor_id_ = value;
- FOR_EACH_OBSERVER(
- ServerWindowObserver, observers_,
- OnWindowNonClientCursorChanged(this, static_cast<int32_t>(value)));
-}
-
-void ServerWindow::SetTransform(const gfx::Transform& transform) {
- if (transform_ == transform)
- return;
-
- transform_ = transform;
- delegate_->OnScheduleWindowPaint(this);
-}
-
-void ServerWindow::SetProperty(const std::string& name,
- const std::vector<uint8_t>* value) {
- auto it = properties_.find(name);
- if (it != properties_.end()) {
- if (value && it->second == *value)
- return;
- } else if (!value) {
- // This property isn't set in |properties_| and |value| is nullptr, so
- // there's
- // no change.
- return;
- }
-
- if (value) {
- properties_[name] = *value;
- } else if (it != properties_.end()) {
- properties_.erase(it);
- }
-
- FOR_EACH_OBSERVER(ServerWindowObserver, observers_,
- OnWindowSharedPropertyChanged(this, name, value));
-}
-
-std::string ServerWindow::GetName() const {
- auto it = properties_.find(mojom::WindowManager::kName_Property);
- if (it == properties_.end())
- return std::string();
- return std::string(it->second.begin(), it->second.end());
-}
-
-void ServerWindow::SetTextInputState(const ui::TextInputState& state) {
- const bool changed = !(text_input_state_ == state);
- if (changed) {
- text_input_state_ = state;
- // keyboard even if the state is not changed. So we have to notify
- // |observers_|.
- FOR_EACH_OBSERVER(ServerWindowObserver, observers_,
- OnWindowTextInputStateChanged(this, state));
- }
-}
-
-bool ServerWindow::IsDrawn() const {
- const ServerWindow* root = delegate_->GetRootWindow(this);
- if (!root || !root->visible())
- return false;
- const ServerWindow* window = this;
- while (window && window != root && window->visible())
- window = window->parent();
- return root == window;
-}
-
-void ServerWindow::DestroySurfacesScheduledForDestruction() {
- if (!surface_manager_)
- return;
- ServerWindowSurface* surface = surface_manager_->GetDefaultSurface();
- if (surface)
- surface->DestroySurfacesScheduledForDestruction();
-
- surface = surface_manager_->GetUnderlaySurface();
- if (surface)
- surface->DestroySurfacesScheduledForDestruction();
-}
-
-ServerWindowSurfaceManager* ServerWindow::GetOrCreateSurfaceManager() {
- if (!surface_manager_.get())
- surface_manager_.reset(new ServerWindowSurfaceManager(this));
- return surface_manager_.get();
-}
-
-void ServerWindow::SetUnderlayOffset(const gfx::Vector2d& offset) {
- if (offset == underlay_offset_)
- return;
-
- underlay_offset_ = offset;
- delegate_->OnScheduleWindowPaint(this);
-}
-
-#if !defined(NDEBUG)
-std::string ServerWindow::GetDebugWindowHierarchy() const {
- std::string result;
- BuildDebugInfo(std::string(), &result);
- return result;
-}
-
-void ServerWindow::BuildDebugInfo(const std::string& depth,
- std::string* result) const {
- std::string name = GetName();
- *result += base::StringPrintf(
- "%sid=%d,%d visible=%s bounds=%d,%d %dx%d %s\n", depth.c_str(),
- static_cast<int>(id_.client_id), static_cast<int>(id_.window_id),
- visible_ ? "true" : "false", bounds_.x(), bounds_.y(), bounds_.width(),
- bounds_.height(), !name.empty() ? name.c_str() : "(no name)");
- for (const ServerWindow* child : children_)
- child->BuildDebugInfo(depth + " ", result);
-}
-#endif
-
-void ServerWindow::RemoveImpl(ServerWindow* window) {
- window->parent_ = nullptr;
- children_.erase(std::find(children_.begin(), children_.end(), window));
-}
-
-void ServerWindow::OnStackingChanged() {
- if (stacking_target_) {
- Windows::const_iterator window_i = std::find(
- parent()->children().begin(), parent()->children().end(), this);
- DCHECK(window_i != parent()->children().end());
- if (window_i != parent()->children().begin() &&
- (*(window_i - 1) == stacking_target_)) {
- return;
- }
- }
- RestackTransientDescendants(this, &GetStackingTarget, &ReorderImpl);
-}
-
-// static
-void ServerWindow::ReorderImpl(ServerWindow* window,
- ServerWindow* relative,
- mojom::OrderDirection direction) {
- DCHECK(relative);
- DCHECK_NE(window, relative);
- DCHECK_EQ(window->parent(), relative->parent());
-
- if (!AdjustStackingForTransientWindows(&window, &relative, &direction,
- window->stacking_target_))
- return;
-
- window->parent_->children_.erase(std::find(window->parent_->children_.begin(),
- window->parent_->children_.end(),
- window));
- Windows::iterator i = std::find(window->parent_->children_.begin(),
- window->parent_->children_.end(), relative);
- if (direction == mojom::OrderDirection::ABOVE) {
- DCHECK(i != window->parent_->children_.end());
- window->parent_->children_.insert(++i, window);
- } else if (direction == mojom::OrderDirection::BELOW) {
- DCHECK(i != window->parent_->children_.end());
- window->parent_->children_.insert(i, window);
- }
- FOR_EACH_OBSERVER(ServerWindowObserver, window->observers_,
- OnWindowReordered(window, relative, direction));
- window->OnStackingChanged();
-}
-
-// static
-ServerWindow** ServerWindow::GetStackingTarget(ServerWindow* window) {
- return &window->stacking_target_;
-}
-
-} // namespace ws
-
-} // namespace mus
diff --git a/chromium/components/mus/ws/server_window.h b/chromium/components/mus/ws/server_window.h
deleted file mode 100644
index 75f4f081406..00000000000
--- a/chromium/components/mus/ws/server_window.h
+++ /dev/null
@@ -1,249 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_SERVER_WINDOW_H_
-#define COMPONENTS_MUS_WS_SERVER_WINDOW_H_
-
-#include <stdint.h>
-
-#include <map>
-#include <string>
-#include <vector>
-
-#include "base/logging.h"
-#include "base/macros.h"
-#include "base/observer_list.h"
-#include "components/mus/public/interfaces/surface.mojom.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/ws/ids.h"
-#include "components/mus/ws/server_window_surface.h"
-#include "mojo/public/cpp/bindings/binding.h"
-#include "ui/gfx/geometry/insets.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/gfx/geometry/vector2d.h"
-#include "ui/gfx/transform.h"
-#include "ui/platform_window/text_input_state.h"
-
-namespace mus {
-namespace ws {
-
-class ServerWindowDelegate;
-class ServerWindowObserver;
-class ServerWindowSurfaceManager;
-
-// Server side representation of a window. Delegate is informed of interesting
-// events.
-//
-// It is assumed that all functions that mutate the tree have validated the
-// mutation is possible before hand. For example, Reorder() assumes the supplied
-// window is a child and not already in position.
-//
-// ServerWindows do not own their children. If you delete a window that has
-// children the children are implicitly removed. Similarly if a window has a
-// parent and the window is deleted the deleted window is implicitly removed
-// from the parent.
-class ServerWindow {
- public:
- using Properties = std::map<std::string, std::vector<uint8_t>>;
- using Windows = std::vector<ServerWindow*>;
-
- ServerWindow(ServerWindowDelegate* delegate, const WindowId& id);
- ServerWindow(ServerWindowDelegate* delegate,
- const WindowId& id,
- const Properties& properties);
- ~ServerWindow();
-
- void AddObserver(ServerWindowObserver* observer);
- void RemoveObserver(ServerWindowObserver* observer);
-
- // Creates a new surface of the specified type, replacing the existing.
- void CreateSurface(mojom::SurfaceType surface_type,
- mojo::InterfaceRequest<mojom::Surface> request,
- mojom::SurfaceClientPtr client);
-
- const WindowId& id() const { return id_; }
-
- void Add(ServerWindow* child);
- void Remove(ServerWindow* child);
- void Reorder(ServerWindow* relative, mojom::OrderDirection diretion);
- void StackChildAtBottom(ServerWindow* child);
- void StackChildAtTop(ServerWindow* child);
-
- const gfx::Rect& bounds() const { return bounds_; }
- // Sets the bounds. If the size changes this implicitly resets the client
- // area to fill the whole bounds.
- void SetBounds(const gfx::Rect& bounds);
-
- const std::vector<gfx::Rect>& additional_client_areas() const {
- return additional_client_areas_;
- }
- const gfx::Insets& client_area() const { return client_area_; }
- void SetClientArea(const gfx::Insets& insets,
- const std::vector<gfx::Rect>& additional_client_areas);
-
- const gfx::Rect* hit_test_mask() const { return hit_test_mask_.get(); }
- void SetHitTestMask(const gfx::Rect& mask);
- void ClearHitTestMask();
-
- int32_t cursor() const { return static_cast<int32_t>(cursor_id_); }
- int32_t non_client_cursor() const {
- return static_cast<int32_t>(non_client_cursor_id_);
- }
-
- const ServerWindow* parent() const { return parent_; }
- ServerWindow* parent() { return parent_; }
-
- const ServerWindow* GetRoot() const;
- ServerWindow* GetRoot() {
- return const_cast<ServerWindow*>(
- const_cast<const ServerWindow*>(this)->GetRoot());
- }
-
- std::vector<const ServerWindow*> GetChildren() const;
- std::vector<ServerWindow*> GetChildren();
- const Windows& children() const { return children_; }
-
- // Returns the ServerWindow object with the provided |id| if it lies in a
- // subtree of |this|.
- ServerWindow* GetChildWindow(const WindowId& id);
-
- // Transient window management.
- // Adding transient child fails if the child window is modal to system.
- bool AddTransientWindow(ServerWindow* child);
- void RemoveTransientWindow(ServerWindow* child);
-
- ServerWindow* transient_parent() { return transient_parent_; }
- const ServerWindow* transient_parent() const { return transient_parent_; }
-
- const Windows& transient_children() const { return transient_children_; }
-
- bool is_modal() const { return is_modal_; }
- void SetModal();
-
- // Returns true if this contains |window| or is |window|.
- bool Contains(const ServerWindow* window) const;
-
- // Returns the visibility requested by this window. IsDrawn() returns whether
- // the window is actually visible on screen.
- bool visible() const { return visible_; }
- void SetVisible(bool value);
-
- float opacity() const { return opacity_; }
- void SetOpacity(float value);
-
- void SetPredefinedCursor(mus::mojom::Cursor cursor_id);
- void SetNonClientCursor(mus::mojom::Cursor cursor_id);
-
- const gfx::Transform& transform() const { return transform_; }
- void SetTransform(const gfx::Transform& transform);
-
- const std::map<std::string, std::vector<uint8_t>>& properties() const {
- return properties_;
- }
- void SetProperty(const std::string& name, const std::vector<uint8_t>* value);
-
- std::string GetName() const;
-
- void SetTextInputState(const ui::TextInputState& state);
- const ui::TextInputState& text_input_state() const {
- return text_input_state_;
- }
-
- void set_can_focus(bool can_focus) { can_focus_ = can_focus; }
- bool can_focus() const { return can_focus_; }
-
- // Returns true if this window is attached to a root and all ancestors are
- // visible.
- bool IsDrawn() const;
-
- // Called when its appropriate to destroy surfaces scheduled for destruction.
- void DestroySurfacesScheduledForDestruction();
-
- const gfx::Insets& extended_hit_test_region() const {
- return extended_hit_test_region_;
- }
- void set_extended_hit_test_region(const gfx::Insets& insets) {
- extended_hit_test_region_ = insets;
- }
-
- ServerWindowSurfaceManager* GetOrCreateSurfaceManager();
- ServerWindowSurfaceManager* surface_manager() {
- return surface_manager_.get();
- }
- const ServerWindowSurfaceManager* surface_manager() const {
- return surface_manager_.get();
- }
-
- // Offset of the underlay from the the window bounds (used for shadows).
- const gfx::Vector2d& underlay_offset() const { return underlay_offset_; }
- void SetUnderlayOffset(const gfx::Vector2d& offset);
-
- ServerWindowDelegate* delegate() { return delegate_; }
-
-#if !defined(NDEBUG)
- std::string GetDebugWindowHierarchy() const;
- void BuildDebugInfo(const std::string& depth, std::string* result) const;
-#endif
-
- private:
- // Implementation of removing a window. Doesn't send any notification.
- void RemoveImpl(ServerWindow* window);
-
- // Called when this window's stacking order among its siblings is changed.
- void OnStackingChanged();
-
- static void ReorderImpl(ServerWindow* window,
- ServerWindow* relative,
- mojom::OrderDirection diretion);
-
- // Returns a pointer to the stacking target that can be used by
- // RestackTransientDescendants.
- static ServerWindow** GetStackingTarget(ServerWindow* window);
-
- ServerWindowDelegate* delegate_;
- const WindowId id_;
- ServerWindow* parent_;
- Windows children_;
-
- // Transient window management.
- // If non-null we're actively restacking transient as the result of a
- // transient ancestor changing.
- ServerWindow* stacking_target_;
- ServerWindow* transient_parent_;
- Windows transient_children_;
-
- bool is_modal_;
- bool visible_;
- gfx::Rect bounds_;
- gfx::Insets client_area_;
- std::vector<gfx::Rect> additional_client_areas_;
- std::unique_ptr<ServerWindowSurfaceManager> surface_manager_;
- mojom::Cursor cursor_id_;
- mojom::Cursor non_client_cursor_id_;
- float opacity_;
- bool can_focus_;
- gfx::Transform transform_;
- ui::TextInputState text_input_state_;
-
- Properties properties_;
-
- gfx::Vector2d underlay_offset_;
-
- // The hit test for windows extends outside the bounds of the window by this
- // amount.
- gfx::Insets extended_hit_test_region_;
-
- // Mouse events outside the hit test mask don't hit the window. An empty mask
- // means all events miss the window. If null there is no mask.
- std::unique_ptr<gfx::Rect> hit_test_mask_;
-
- base::ObserverList<ServerWindowObserver> observers_;
-
- DISALLOW_COPY_AND_ASSIGN(ServerWindow);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_SERVER_WINDOW_H_
diff --git a/chromium/components/mus/ws/server_window_delegate.h b/chromium/components/mus/ws/server_window_delegate.h
deleted file mode 100644
index 24d6bbd0daa..00000000000
--- a/chromium/components/mus/ws/server_window_delegate.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_SERVER_WINDOW_DELEGATE_H_
-#define COMPONENTS_MUS_WS_SERVER_WINDOW_DELEGATE_H_
-
-#include <memory>
-
-#include "components/mus/public/interfaces/mus_constants.mojom.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-
-namespace mus {
-
-class SurfacesState;
-
-namespace ws {
-
-struct ClientWindowId;
-class ServerWindow;
-struct WindowId;
-
-class ServerWindowDelegate {
- public:
- virtual SurfacesState* GetSurfacesState() = 0;
-
- virtual void OnScheduleWindowPaint(ServerWindow* window) = 0;
-
- // Returns the root of the window tree to which this |window| is attached.
- // Returns null if this window is not attached up through to a root window.
- virtual const ServerWindow* GetRootWindow(
- const ServerWindow* window) const = 0;
-
- // Schedules a callback to DestroySurfacesScheduledForDestruction() at the
- // appropriate time, which may be synchronously.
- virtual void ScheduleSurfaceDestruction(ServerWindow* window) = 0;
-
- protected:
- virtual ~ServerWindowDelegate() {}
-};
-
-} // namespace ws
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_SERVER_WINDOW_DELEGATE_H_
diff --git a/chromium/components/mus/ws/server_window_drawn_tracker.cc b/chromium/components/mus/ws/server_window_drawn_tracker.cc
deleted file mode 100644
index cdbca8ccddf..00000000000
--- a/chromium/components/mus/ws/server_window_drawn_tracker.cc
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/server_window_drawn_tracker.h"
-
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_drawn_tracker_observer.h"
-
-namespace mus {
-
-namespace ws {
-
-ServerWindowDrawnTracker::ServerWindowDrawnTracker(
- ServerWindow* window,
- ServerWindowDrawnTrackerObserver* observer)
- : window_(window), observer_(observer), drawn_(window->IsDrawn()) {
- AddObservers();
-}
-
-ServerWindowDrawnTracker::~ServerWindowDrawnTracker() {
- RemoveObservers();
-}
-
-void ServerWindowDrawnTracker::SetDrawn(ServerWindow* ancestor, bool drawn) {
- // If |windows_| is empty when this code runs, that means |window_| has been
- // destroyed. So set |window_| to nullptr, but make sure the right value is
- // sent to OnDrawnStateChanged().
- ServerWindow* window = window_;
- if (windows_.empty())
- window_ = nullptr;
-
- if (drawn == drawn_)
- return;
-
- drawn_ = drawn;
- observer_->OnDrawnStateChanged(ancestor, window, drawn);
-}
-
-void ServerWindowDrawnTracker::AddObservers() {
- if (!window_)
- return;
-
- for (ServerWindow* v = window_; v; v = v->parent()) {
- v->AddObserver(this);
- windows_.insert(v);
- }
-}
-
-void ServerWindowDrawnTracker::RemoveObservers() {
- for (ServerWindow* window : windows_)
- window->RemoveObserver(this);
-
- windows_.clear();
-}
-
-void ServerWindowDrawnTracker::OnWindowDestroying(ServerWindow* window) {
- if (!drawn_)
- return;
- observer_->OnDrawnStateWillChange(window->parent(), window_, false);
-}
-
-void ServerWindowDrawnTracker::OnWindowDestroyed(ServerWindow* window) {
- // As windows are removed before being destroyed, resulting in
- // OnWindowHierarchyChanged() and us removing ourself as an observer, the only
- // window we should ever get notified of destruction on is |window_|.
- DCHECK_EQ(window, window_);
- RemoveObservers();
- SetDrawn(nullptr, false);
-}
-
-void ServerWindowDrawnTracker::OnWillChangeWindowHierarchy(
- ServerWindow* window,
- ServerWindow* new_parent,
- ServerWindow* old_parent) {
- bool new_is_drawn = new_parent && new_parent->IsDrawn();
- if (new_is_drawn) {
- for (ServerWindow* w = window_; new_is_drawn && w != old_parent;
- w = w->parent()) {
- new_is_drawn = w->visible();
- }
- }
- if (drawn_ != new_is_drawn) {
- observer_->OnDrawnStateWillChange(new_is_drawn ? nullptr : old_parent,
- window_, new_is_drawn);
- }
-}
-
-void ServerWindowDrawnTracker::OnWindowHierarchyChanged(
- ServerWindow* window,
- ServerWindow* new_parent,
- ServerWindow* old_parent) {
- RemoveObservers();
- AddObservers();
- const bool is_drawn = window_->IsDrawn();
- SetDrawn(is_drawn ? nullptr : old_parent, is_drawn);
-}
-
-void ServerWindowDrawnTracker::OnWillChangeWindowVisibility(
- ServerWindow* window) {
- bool will_change = false;
- if (drawn_) {
- // If |window_| is currently drawn, then any change of visibility of the
- // windows will toggle the drawn status.
- will_change = true;
- } else {
- // If |window| is currently visible, then it's becoming invisible, and so
- // |window_| will remain not drawn.
- if (window->visible()) {
- will_change = false;
- } else {
- bool is_drawn = (window->GetRoot() == window) ||
- (window->parent() && window->parent()->IsDrawn());
- if (is_drawn) {
- for (ServerWindow* w = window_; is_drawn && w != window;
- w = w->parent())
- is_drawn = w->visible();
- }
- will_change = drawn_ != is_drawn;
- }
- }
- if (will_change) {
- bool new_is_drawn = !drawn_;
- observer_->OnDrawnStateWillChange(new_is_drawn ? nullptr : window->parent(),
- window_, new_is_drawn);
- }
-}
-
-void ServerWindowDrawnTracker::OnWindowVisibilityChanged(ServerWindow* window) {
- const bool is_drawn = window_->IsDrawn();
- SetDrawn(is_drawn ? nullptr : window->parent(), is_drawn);
-}
-
-} // namespace ws
-
-} // namespace mus
diff --git a/chromium/components/mus/ws/server_window_drawn_tracker.h b/chromium/components/mus/ws/server_window_drawn_tracker.h
deleted file mode 100644
index 36f2de27590..00000000000
--- a/chromium/components/mus/ws/server_window_drawn_tracker.h
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_SERVER_WINDOW_DRAWN_TRACKER_H_
-#define COMPONENTS_MUS_WS_SERVER_WINDOW_DRAWN_TRACKER_H_
-
-#include <set>
-
-#include "base/macros.h"
-#include "components/mus/ws/server_window_observer.h"
-
-namespace mus {
-
-namespace ws {
-
-class ServerWindowDrawnTrackerObserver;
-
-// ServerWindowDrawnTracker notifies its observer any time the drawn state of
-// the supplied window changes.
-//
-// NOTE: you must ensure this class is destroyed before the root.
-class ServerWindowDrawnTracker : public ServerWindowObserver {
- public:
- ServerWindowDrawnTracker(ServerWindow* window,
- ServerWindowDrawnTrackerObserver* observer);
- ~ServerWindowDrawnTracker() override;
-
- ServerWindow* window() { return window_; }
-
- private:
- void SetDrawn(ServerWindow* ancestor, bool drawn);
-
- // Adds |this| as an observer to |window_| and its ancestors.
- void AddObservers();
-
- // Stops observerving any windows we added as an observer in AddObservers().
- void RemoveObservers();
-
- // ServerWindowObserver:
- void OnWindowDestroying(ServerWindow* window) override;
- void OnWindowDestroyed(ServerWindow* window) override;
- void OnWillChangeWindowHierarchy(ServerWindow* window,
- ServerWindow* new_parent,
- ServerWindow* old_parent) override;
- void OnWindowHierarchyChanged(ServerWindow* window,
- ServerWindow* new_parent,
- ServerWindow* old_parent) override;
- void OnWillChangeWindowVisibility(ServerWindow* window) override;
- void OnWindowVisibilityChanged(ServerWindow* window) override;
-
- ServerWindow* window_;
- ServerWindowDrawnTrackerObserver* observer_;
- bool drawn_;
- // Set of windows we're observing. This is |window_| and all its ancestors.
- std::set<ServerWindow*> windows_;
-
- DISALLOW_COPY_AND_ASSIGN(ServerWindowDrawnTracker);
-};
-
-} // namespace ws
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_SERVER_WINDOW_DRAWN_TRACKER_H_
diff --git a/chromium/components/mus/ws/server_window_drawn_tracker_observer.h b/chromium/components/mus/ws/server_window_drawn_tracker_observer.h
deleted file mode 100644
index 55f44cbbbc5..00000000000
--- a/chromium/components/mus/ws/server_window_drawn_tracker_observer.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_SERVER_WINDOW_DRAWN_TRACKER_OBSERVER_H_
-#define COMPONENTS_MUS_WS_SERVER_WINDOW_DRAWN_TRACKER_OBSERVER_H_
-
-namespace mus {
-
-namespace ws {
-
-class ServerWindow;
-
-class ServerWindowDrawnTrackerObserver {
- public:
- // Invoked right before the drawn state changes. If |is_drawn| is false,
- // |ancestor| identifies where the change will occur. In the case of a remove,
- // |ancestor| is the parent of the window that will be removed (causing the
- // drawn state to change). In the case of visibility change, |ancestor| is the
- // parent of the window whose visibility will change.
- virtual void OnDrawnStateWillChange(ServerWindow* ancestor,
- ServerWindow* window,
- bool is_drawn) {}
-
- // Invoked when the drawn state changes. If |is_drawn| is false |ancestor|
- // identifies where the change occurred. In the case of a remove |ancestor| is
- // the parent of the window that was removed. In the case of a visibility
- // change |ancestor| is the parent of the window whose visibility changed.
- virtual void OnDrawnStateChanged(ServerWindow* ancestor,
- ServerWindow* window,
- bool is_drawn) {}
-
- protected:
- virtual ~ServerWindowDrawnTrackerObserver() {}
-};
-
-} // namespace ws
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_SERVER_WINDOW_DRAWN_TRACKER_OBSERVER_H_
diff --git a/chromium/components/mus/ws/server_window_drawn_tracker_unittest.cc b/chromium/components/mus/ws/server_window_drawn_tracker_unittest.cc
deleted file mode 100644
index 53ffa39f7b1..00000000000
--- a/chromium/components/mus/ws/server_window_drawn_tracker_unittest.cc
+++ /dev/null
@@ -1,235 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/server_window_drawn_tracker.h"
-
-#include <stddef.h>
-
-#include "base/macros.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_drawn_tracker_observer.h"
-#include "components/mus/ws/test_server_window_delegate.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace mus {
-
-namespace ws {
-namespace {
-
-class TestServerWindowDrawnTrackerObserver
- : public ServerWindowDrawnTrackerObserver {
- public:
- TestServerWindowDrawnTrackerObserver()
- : change_count_(0u),
- ancestor_(nullptr),
- window_(nullptr),
- is_drawn_(false) {}
-
- void clear_change_count() { change_count_ = 0u; }
- size_t change_count() const { return change_count_; }
- const ServerWindow* ancestor() const { return ancestor_; }
- const ServerWindow* window() const { return window_; }
- bool is_drawn() const { return is_drawn_; }
-
- private:
- // ServerWindowDrawnTrackerObserver:
- void OnDrawnStateWillChange(ServerWindow* ancestor,
- ServerWindow* window,
- bool is_drawn) override {
- change_count_++;
- ancestor_ = ancestor;
- window_ = window;
- is_drawn_ = is_drawn;
- }
-
- void OnDrawnStateChanged(ServerWindow* ancestor,
- ServerWindow* window,
- bool is_drawn) override {
- EXPECT_EQ(ancestor_, ancestor);
- EXPECT_EQ(window_, window);
- EXPECT_EQ(is_drawn_, is_drawn);
- }
-
- size_t change_count_;
- const ServerWindow* ancestor_;
- const ServerWindow* window_;
- bool is_drawn_;
-
- DISALLOW_COPY_AND_ASSIGN(TestServerWindowDrawnTrackerObserver);
-};
-
-} // namespace
-
-TEST(ServerWindowDrawnTrackerTest, ChangeBecauseOfDeletionAndVisibility) {
- TestServerWindowDelegate server_window_delegate;
- std::unique_ptr<ServerWindow> window(
- new ServerWindow(&server_window_delegate, WindowId()));
- server_window_delegate.set_root_window(window.get());
- TestServerWindowDrawnTrackerObserver drawn_observer;
- ServerWindowDrawnTracker tracker(window.get(), &drawn_observer);
- window->SetVisible(true);
- EXPECT_EQ(1u, drawn_observer.change_count());
- EXPECT_EQ(window.get(), drawn_observer.window());
- EXPECT_EQ(nullptr, drawn_observer.ancestor());
- EXPECT_TRUE(drawn_observer.is_drawn());
- drawn_observer.clear_change_count();
-
- window->SetVisible(false);
- EXPECT_EQ(1u, drawn_observer.change_count());
- EXPECT_EQ(window.get(), drawn_observer.window());
- EXPECT_EQ(nullptr, drawn_observer.ancestor());
- EXPECT_FALSE(drawn_observer.is_drawn());
- drawn_observer.clear_change_count();
-
- window->SetVisible(true);
- EXPECT_EQ(1u, drawn_observer.change_count());
- EXPECT_EQ(window.get(), drawn_observer.window());
- EXPECT_EQ(nullptr, drawn_observer.ancestor());
- EXPECT_TRUE(drawn_observer.is_drawn());
- drawn_observer.clear_change_count();
-
- ServerWindow* old_window = window.get();
- window.reset();
- EXPECT_EQ(1u, drawn_observer.change_count());
- EXPECT_EQ(old_window, drawn_observer.window());
- EXPECT_EQ(nullptr, drawn_observer.ancestor());
- EXPECT_FALSE(drawn_observer.is_drawn());
-}
-
-TEST(ServerWindowDrawnTrackerTest, ChangeBecauseOfRemovingFromRoot) {
- TestServerWindowDelegate server_window_delegate;
- ServerWindow root(&server_window_delegate, WindowId());
- server_window_delegate.set_root_window(&root);
- root.SetVisible(true);
- ServerWindow child(&server_window_delegate, WindowId());
- child.SetVisible(true);
- root.Add(&child);
-
- TestServerWindowDrawnTrackerObserver drawn_observer;
- ServerWindowDrawnTracker tracker(&child, &drawn_observer);
- root.Remove(&child);
- EXPECT_EQ(1u, drawn_observer.change_count());
- EXPECT_EQ(&child, drawn_observer.window());
- EXPECT_EQ(&root, drawn_observer.ancestor());
- EXPECT_FALSE(drawn_observer.is_drawn());
- drawn_observer.clear_change_count();
-
- root.Add(&child);
- EXPECT_EQ(1u, drawn_observer.change_count());
- EXPECT_EQ(&child, drawn_observer.window());
- EXPECT_EQ(nullptr, drawn_observer.ancestor());
- EXPECT_TRUE(drawn_observer.is_drawn());
-}
-
-TEST(ServerWindowDrawnTrackerTest, ChangeBecauseOfRemovingAncestorFromRoot) {
- TestServerWindowDelegate server_window_delegate;
- ServerWindow root(&server_window_delegate, WindowId());
- server_window_delegate.set_root_window(&root);
- root.SetVisible(true);
- ServerWindow child(&server_window_delegate, WindowId());
- child.SetVisible(true);
- root.Add(&child);
-
- ServerWindow child_child(&server_window_delegate, WindowId());
- child_child.SetVisible(true);
- child.Add(&child_child);
-
- TestServerWindowDrawnTrackerObserver drawn_observer;
- ServerWindowDrawnTracker tracker(&child_child, &drawn_observer);
- root.Remove(&child);
- EXPECT_EQ(1u, drawn_observer.change_count());
- EXPECT_EQ(&child_child, drawn_observer.window());
- EXPECT_EQ(&root, drawn_observer.ancestor());
- EXPECT_FALSE(drawn_observer.is_drawn());
- drawn_observer.clear_change_count();
-
- root.Add(&child_child);
- EXPECT_EQ(1u, drawn_observer.change_count());
- EXPECT_EQ(&child_child, drawn_observer.window());
- EXPECT_EQ(nullptr, drawn_observer.ancestor());
- EXPECT_TRUE(drawn_observer.is_drawn());
-}
-
-TEST(ServerWindowDrawnTrackerTest, VisibilityChangeFromNonParentAncestor) {
- TestServerWindowDelegate server_window_delegate;
- ServerWindow root(&server_window_delegate, WindowId());
- ServerWindow child1(&server_window_delegate, WindowId());
- ServerWindow child2(&server_window_delegate, WindowId());
- ServerWindow child3(&server_window_delegate, WindowId());
- server_window_delegate.set_root_window(&root);
-
- root.Add(&child1);
- child1.Add(&child2);
- child2.Add(&child3);
-
- root.SetVisible(true);
- child1.SetVisible(false);
- child2.SetVisible(false);
- child3.SetVisible(true);
-
- TestServerWindowDrawnTrackerObserver drawn_observer;
- ServerWindowDrawnTracker tracker(&child3, &drawn_observer);
-
- EXPECT_FALSE(child3.IsDrawn());
-
- // Make |child1| visible. |child3| should still be not drawn, since |child2|
- // is still invisible.
- child1.SetVisible(true);
- EXPECT_EQ(0u, drawn_observer.change_count());
- EXPECT_EQ(nullptr, drawn_observer.window());
- EXPECT_EQ(nullptr, drawn_observer.ancestor());
- EXPECT_FALSE(drawn_observer.is_drawn());
- EXPECT_FALSE(child3.IsDrawn());
-
- child2.SetVisible(true);
- EXPECT_EQ(1u, drawn_observer.change_count());
- EXPECT_EQ(&child3, drawn_observer.window());
- EXPECT_EQ(nullptr, drawn_observer.ancestor());
- EXPECT_TRUE(drawn_observer.is_drawn());
- EXPECT_TRUE(child3.IsDrawn());
-}
-
-TEST(ServerWindowDrawnTrackerTest, TreeHierarchyChangeFromNonParentAncestor) {
- TestServerWindowDelegate server_window_delegate;
- ServerWindow root(&server_window_delegate, WindowId());
- ServerWindow child1(&server_window_delegate, WindowId());
- ServerWindow child2(&server_window_delegate, WindowId());
- ServerWindow child11(&server_window_delegate, WindowId());
- ServerWindow child111(&server_window_delegate, WindowId());
- server_window_delegate.set_root_window(&root);
-
- root.Add(&child1);
- root.Add(&child2);
- child1.Add(&child11);
- child11.Add(&child111);
-
- root.SetVisible(true);
- child1.SetVisible(false);
- child2.SetVisible(true);
- child11.SetVisible(false);
- child111.SetVisible(true);
-
- TestServerWindowDrawnTrackerObserver drawn_observer;
- ServerWindowDrawnTracker tracker(&child111, &drawn_observer);
- EXPECT_FALSE(child111.IsDrawn());
-
- // Move |child11| as a child of |child2|. |child111| should remain not drawn.
- child2.Add(&child11);
- EXPECT_EQ(0u, drawn_observer.change_count());
- EXPECT_EQ(nullptr, drawn_observer.window());
- EXPECT_EQ(nullptr, drawn_observer.ancestor());
- EXPECT_FALSE(drawn_observer.is_drawn());
- EXPECT_FALSE(child111.IsDrawn());
-
- child11.SetVisible(true);
- EXPECT_EQ(1u, drawn_observer.change_count());
- EXPECT_EQ(&child111, drawn_observer.window());
- EXPECT_EQ(nullptr, drawn_observer.ancestor());
- EXPECT_TRUE(drawn_observer.is_drawn());
- EXPECT_TRUE(child111.IsDrawn());
-}
-
-} // namespace ws
-
-} // namespace mus
diff --git a/chromium/components/mus/ws/server_window_observer.h b/chromium/components/mus/ws/server_window_observer.h
deleted file mode 100644
index 2ea2f4c310a..00000000000
--- a/chromium/components/mus/ws/server_window_observer.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_SERVER_WINDOW_OBSERVER_H_
-#define COMPONENTS_MUS_WS_SERVER_WINDOW_OBSERVER_H_
-
-#include <stdint.h>
-
-#include <string>
-#include <vector>
-
-#include "components/mus/public/interfaces/mus_constants.mojom.h"
-
-namespace gfx {
-class Insets;
-class Rect;
-}
-
-namespace ui {
-struct TextInputState;
-}
-
-namespace mus {
-
-namespace ws {
-
-class ServerWindow;
-
-// TODO(sky): rename to OnDid and OnWill everywhere.
-class ServerWindowObserver {
- public:
- // Invoked when a window is about to be destroyed; before any of the children
- // have been removed and before the window has been removed from its parent.
- virtual void OnWindowDestroying(ServerWindow* window) {}
-
- // Invoked at the end of the window's destructor (after it has been removed
- // from the hierarchy.
- virtual void OnWindowDestroyed(ServerWindow* window) {}
-
- virtual void OnWillChangeWindowHierarchy(ServerWindow* window,
- ServerWindow* new_parent,
- ServerWindow* old_parent) {}
-
- virtual void OnWindowHierarchyChanged(ServerWindow* window,
- ServerWindow* new_parent,
- ServerWindow* old_parent) {}
-
- virtual void OnWindowBoundsChanged(ServerWindow* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {}
-
- virtual void OnWindowClientAreaChanged(
- ServerWindow* window,
- const gfx::Insets& new_client_area,
- const std::vector<gfx::Rect>& new_additional_client_areas) {}
-
- virtual void OnWindowReordered(ServerWindow* window,
- ServerWindow* relative,
- mojom::OrderDirection direction) {}
-
- virtual void OnWillChangeWindowVisibility(ServerWindow* window) {}
- virtual void OnWindowVisibilityChanged(ServerWindow* window) {}
- virtual void OnWindowOpacityChanged(ServerWindow* window,
- float old_opacity,
- float new_opacity) {}
-
- virtual void OnWindowPredefinedCursorChanged(ServerWindow* window,
- int32_t cursor_id) {}
- virtual void OnWindowNonClientCursorChanged(ServerWindow* window,
- int32_t cursor_id) {}
-
- virtual void OnWindowTextInputStateChanged(ServerWindow* window,
- const ui::TextInputState& state) {}
-
- virtual void OnWindowSharedPropertyChanged(
- ServerWindow* window,
- const std::string& name,
- const std::vector<uint8_t>* new_data) {}
-
- // Called when a transient child is added to |window|.
- virtual void OnTransientWindowAdded(ServerWindow* window,
- ServerWindow* transient_child) {}
-
- // Called when a transient child is removed from |window|.
- virtual void OnTransientWindowRemoved(ServerWindow* window,
- ServerWindow* transient_child) {}
-
- protected:
- virtual ~ServerWindowObserver() {}
-};
-
-} // namespace ws
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_SERVER_WINDOW_OBSERVER_H_
diff --git a/chromium/components/mus/ws/server_window_surface.cc b/chromium/components/mus/ws/server_window_surface.cc
deleted file mode 100644
index d03bc5bd789..00000000000
--- a/chromium/components/mus/ws/server_window_surface.cc
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/server_window_surface.h"
-
-#include "base/callback.h"
-#include "cc/output/compositor_frame.h"
-#include "cc/quads/shared_quad_state.h"
-#include "cc/quads/surface_draw_quad.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_delegate.h"
-#include "components/mus/ws/server_window_surface_manager.h"
-
-namespace mus {
-namespace ws {
-namespace {
-
-void CallCallback(const base::Closure& callback, cc::SurfaceDrawStatus status) {
- callback.Run();
-}
-
-} // namespace
-
-ServerWindowSurface::ServerWindowSurface(
- ServerWindowSurfaceManager* manager,
- mojo::InterfaceRequest<Surface> request,
- mojom::SurfaceClientPtr client)
- : manager_(manager),
- surface_id_(manager->GenerateId()),
- surface_factory_(manager_->GetSurfaceManager(), this),
- client_(std::move(client)),
- binding_(this, std::move(request)),
- registered_surface_factory_client_(false) {
- surface_factory_.Create(surface_id_);
-}
-
-ServerWindowSurface::~ServerWindowSurface() {
- // SurfaceFactory's destructor will attempt to return resources which will
- // call back into here and access |client_| so we should destroy
- // |surface_factory_|'s resources early on.
- surface_factory_.DestroyAll();
-
- if (registered_surface_factory_client_) {
- cc::SurfaceManager* surface_manager = manager_->GetSurfaceManager();
- surface_manager->UnregisterSurfaceFactoryClient(manager_->id_namespace());
- }
-}
-
-void ServerWindowSurface::SubmitCompositorFrame(
- cc::CompositorFrame frame,
- const SubmitCompositorFrameCallback& callback) {
- gfx::Size frame_size =
- frame.delegated_frame_data->render_pass_list[0]->output_rect.size();
- if (!surface_id_.is_null()) {
- // If the size of the CompostiorFrame has changed then destroy the existing
- // Surface and create a new one of the appropriate size.
- if (frame_size != last_submitted_frame_size_) {
- // Rendering of the topmost frame happens in two phases. First the frame
- // is generated and submitted, and a later date it is actually drawn.
- // During the time the frame is generated and drawn we can't destroy the
- // surface, otherwise when drawn you get an empty surface. To deal with
- // this we schedule destruction via the delegate. The delegate will call
- // us back when we're not waiting on a frame to be drawn (which may be
- // synchronously).
- surfaces_scheduled_for_destruction_.insert(surface_id_);
- window()->delegate()->ScheduleSurfaceDestruction(window());
- surface_id_ = manager_->GenerateId();
- surface_factory_.Create(surface_id_);
- }
- }
- surface_factory_.SubmitCompositorFrame(surface_id_, std::move(frame),
- base::Bind(&CallCallback, callback));
- last_submitted_frame_size_ = frame_size;
- window()->delegate()->OnScheduleWindowPaint(window());
-}
-
-void ServerWindowSurface::DestroySurfacesScheduledForDestruction() {
- std::set<cc::SurfaceId> surfaces;
- surfaces.swap(surfaces_scheduled_for_destruction_);
- for (auto& id : surfaces)
- surface_factory_.Destroy(id);
-}
-
-void ServerWindowSurface::RegisterForBeginFrames() {
- DCHECK(!registered_surface_factory_client_);
- registered_surface_factory_client_ = true;
- cc::SurfaceManager* surface_manager = manager_->GetSurfaceManager();
- surface_manager->RegisterSurfaceFactoryClient(manager_->id_namespace(), this);
-}
-
-ServerWindow* ServerWindowSurface::window() {
- return manager_->window();
-}
-
-void ServerWindowSurface::ReturnResources(
- const cc::ReturnedResourceArray& resources) {
- if (!client_ || !base::MessageLoop::current())
- return;
- client_->ReturnResources(mojo::Array<cc::ReturnedResource>::From(resources));
-}
-
-void ServerWindowSurface::SetBeginFrameSource(
- cc::BeginFrameSource* begin_frame_source) {
- // TODO(tansell): Implement this.
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/server_window_surface.h b/chromium/components/mus/ws/server_window_surface.h
deleted file mode 100644
index 126a99f73fc..00000000000
--- a/chromium/components/mus/ws/server_window_surface.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_H_
-#define COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_H_
-
-#include <set>
-
-#include "base/macros.h"
-#include "cc/ipc/compositor_frame.mojom.h"
-#include "cc/surfaces/surface_factory.h"
-#include "cc/surfaces/surface_factory_client.h"
-#include "cc/surfaces/surface_id.h"
-#include "cc/surfaces/surface_id_allocator.h"
-#include "components/mus/public/interfaces/surface.mojom.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/ws/ids.h"
-#include "mojo/public/cpp/bindings/binding.h"
-
-namespace mus {
-
-class SurfacesState;
-
-namespace ws {
-
-class ServerWindow;
-class ServerWindowSurfaceManager;
-
-// Server side representation of a WindowSurface.
-class ServerWindowSurface : public mojom::Surface,
- public cc::SurfaceFactoryClient {
- public:
- ServerWindowSurface(ServerWindowSurfaceManager* manager,
- mojo::InterfaceRequest<mojom::Surface> request,
- mojom::SurfaceClientPtr client);
-
- ~ServerWindowSurface() override;
-
- const gfx::Size& last_submitted_frame_size() const {
- return last_submitted_frame_size_;
- }
-
- // mojom::Surface:
- void SubmitCompositorFrame(
- cc::CompositorFrame frame,
- const SubmitCompositorFrameCallback& callback) override;
-
- const cc::SurfaceId& id() const { return surface_id_; }
-
- // Destroys old surfaces that have been outdated by a new surface.
- void DestroySurfacesScheduledForDestruction();
-
- // Registers this with the SurfaceManager
- void RegisterForBeginFrames();
-
- private:
- ServerWindow* window();
-
- // SurfaceFactoryClient implementation.
- void ReturnResources(const cc::ReturnedResourceArray& resources) override;
- void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override;
-
- ServerWindowSurfaceManager* manager_; // Owns this.
-
- gfx::Size last_submitted_frame_size_;
-
- cc::SurfaceId surface_id_;
- cc::SurfaceFactory surface_factory_;
-
- mojom::SurfaceClientPtr client_;
- mojo::Binding<Surface> binding_;
-
- // Set of surface ids that need to be destroyed.
- std::set<cc::SurfaceId> surfaces_scheduled_for_destruction_;
-
- bool registered_surface_factory_client_;
-
- DISALLOW_COPY_AND_ASSIGN(ServerWindowSurface);
-};
-
-} // namespace ws
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_H_
diff --git a/chromium/components/mus/ws/server_window_surface_manager.cc b/chromium/components/mus/ws/server_window_surface_manager.cc
deleted file mode 100644
index 1109d6ee8ac..00000000000
--- a/chromium/components/mus/ws/server_window_surface_manager.cc
+++ /dev/null
@@ -1,102 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/server_window_surface_manager.h"
-
-#include "components/mus/surfaces/surfaces_state.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_delegate.h"
-#include "components/mus/ws/server_window_surface.h"
-
-namespace mus {
-namespace ws {
-
-ServerWindowSurfaceManager::ServerWindowSurfaceManager(ServerWindow* window)
- : window_(window),
- surface_id_allocator_(
- window->delegate()->GetSurfacesState()->next_id_namespace()),
- waiting_for_initial_frames_(
- window_->properties().count(mus::mojom::kWaitForUnderlay_Property) >
- 0) {
- surface_id_allocator_.RegisterSurfaceIdNamespace(GetSurfaceManager());
-}
-
-ServerWindowSurfaceManager::~ServerWindowSurfaceManager() {
- // Explicitly clear the type to surface manager so that this manager
- // is still valid prior during ~ServerWindowSurface.
- type_to_surface_map_.clear();
-}
-
-bool ServerWindowSurfaceManager::ShouldDraw() {
- if (!waiting_for_initial_frames_)
- return true;
-
- waiting_for_initial_frames_ =
- !IsSurfaceReadyAndNonEmpty(mojom::SurfaceType::DEFAULT) ||
- !IsSurfaceReadyAndNonEmpty(mojom::SurfaceType::UNDERLAY);
- return !waiting_for_initial_frames_;
-}
-
-void ServerWindowSurfaceManager::CreateSurface(
- mojom::SurfaceType surface_type,
- mojo::InterfaceRequest<mojom::Surface> request,
- mojom::SurfaceClientPtr client) {
- std::unique_ptr<ServerWindowSurface> surface(
- new ServerWindowSurface(this, std::move(request), std::move(client)));
- if (!HasAnySurface()) {
- // Only one SurfaceFactoryClient can be registered per surface id namespace,
- // so register the first one. Since all surfaces created by this manager
- // represent the same window, the begin frame source can be shared by
- // all surfaces created here.
- surface->RegisterForBeginFrames();
- }
- type_to_surface_map_[surface_type] = std::move(surface);
-}
-
-ServerWindowSurface* ServerWindowSurfaceManager::GetDefaultSurface() const {
- return GetSurfaceByType(mojom::SurfaceType::DEFAULT);
-}
-
-ServerWindowSurface* ServerWindowSurfaceManager::GetUnderlaySurface() const {
- return GetSurfaceByType(mojom::SurfaceType::UNDERLAY);
-}
-
-ServerWindowSurface* ServerWindowSurfaceManager::GetSurfaceByType(
- mojom::SurfaceType type) const {
- auto iter = type_to_surface_map_.find(type);
- return iter == type_to_surface_map_.end() ? nullptr : iter->second.get();
-}
-
-bool ServerWindowSurfaceManager::HasSurfaceOfType(
- mojom::SurfaceType type) const {
- return type_to_surface_map_.count(type) > 0;
-}
-
-bool ServerWindowSurfaceManager::HasAnySurface() const {
- return GetDefaultSurface() || GetUnderlaySurface();
-}
-
-cc::SurfaceManager* ServerWindowSurfaceManager::GetSurfaceManager() {
- return window()->delegate()->GetSurfacesState()->manager();
-}
-
-bool ServerWindowSurfaceManager::IsSurfaceReadyAndNonEmpty(
- mojom::SurfaceType type) const {
- auto iter = type_to_surface_map_.find(type);
- if (iter == type_to_surface_map_.end())
- return false;
- if (iter->second->last_submitted_frame_size().IsEmpty())
- return false;
- const gfx::Size& last_submitted_frame_size =
- iter->second->last_submitted_frame_size();
- return last_submitted_frame_size.width() >= window_->bounds().width() &&
- last_submitted_frame_size.height() >= window_->bounds().height();
-}
-
-cc::SurfaceId ServerWindowSurfaceManager::GenerateId() {
- return surface_id_allocator_.GenerateId();
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/server_window_surface_manager.h b/chromium/components/mus/ws/server_window_surface_manager.h
deleted file mode 100644
index 1bae2008ca8..00000000000
--- a/chromium/components/mus/ws/server_window_surface_manager.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_H_
-#define COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_H_
-
-#include <map>
-
-#include "base/macros.h"
-#include "cc/ipc/compositor_frame.mojom.h"
-#include "cc/surfaces/surface_factory.h"
-#include "cc/surfaces/surface_id.h"
-#include "cc/surfaces/surface_id_allocator.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
-
-namespace mus {
-namespace ws {
-
-class ServerWindow;
-class ServerWindowSurface;
-class ServerWindowSurfaceManagerTestApi;
-
-// ServerWindowSurfaceManager tracks the surfaces associated with a
-// ServerWindow.
-class ServerWindowSurfaceManager {
- public:
- explicit ServerWindowSurfaceManager(ServerWindow* window);
- ~ServerWindowSurfaceManager();
-
- // Returns true if the surfaces from this manager should be drawn.
- bool ShouldDraw();
-
- // Creates a new surface of the specified type, replacing the existing one of
- // the specified type.
- void CreateSurface(mojom::SurfaceType surface_type,
- mojo::InterfaceRequest<mojom::Surface> request,
- mojom::SurfaceClientPtr client);
-
- ServerWindow* window() { return window_; }
-
- ServerWindowSurface* GetDefaultSurface() const;
- ServerWindowSurface* GetUnderlaySurface() const;
- ServerWindowSurface* GetSurfaceByType(mojom::SurfaceType type) const;
- bool HasSurfaceOfType(mojom::SurfaceType type) const;
- bool HasAnySurface() const;
-
- uint32_t id_namespace() const { return surface_id_allocator_.id_namespace(); }
- cc::SurfaceManager* GetSurfaceManager();
-
- private:
- friend class ServerWindowSurfaceManagerTestApi;
- friend class ServerWindowSurface;
-
- // Returns true if a surface of |type| has been set and its size is greater
- // than the size of the window.
- bool IsSurfaceReadyAndNonEmpty(mojom::SurfaceType type) const;
-
- cc::SurfaceId GenerateId();
-
- ServerWindow* window_;
-
- cc::SurfaceIdAllocator surface_id_allocator_;
-
- using TypeToSurfaceMap =
- std::map<mojom::SurfaceType, std::unique_ptr<ServerWindowSurface>>;
-
- TypeToSurfaceMap type_to_surface_map_;
-
- // While true the window is not drawn. This is initially true if the window
- // has the property |kWaitForUnderlay_Property|. This is set to false once
- // the underlay and default surface have been set *and* their size is at
- // least that of the window. Ideally we would wait for sizes to match, but
- // the underlay is not necessarily as big as the window.
- bool waiting_for_initial_frames_;
-
- DISALLOW_COPY_AND_ASSIGN(ServerWindowSurfaceManager);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_H_
diff --git a/chromium/components/mus/ws/server_window_surface_manager_test_api.cc b/chromium/components/mus/ws/server_window_surface_manager_test_api.cc
deleted file mode 100644
index d65ae0f6376..00000000000
--- a/chromium/components/mus/ws/server_window_surface_manager_test_api.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/server_window_surface_manager_test_api.h"
-
-#include "components/mus/ws/server_window.h"
-
-namespace mus {
-namespace ws {
-
-ServerWindowSurfaceManagerTestApi::ServerWindowSurfaceManagerTestApi(
- ServerWindowSurfaceManager* manager)
- : manager_(manager) {}
-
-ServerWindowSurfaceManagerTestApi::~ServerWindowSurfaceManagerTestApi() {}
-
-void ServerWindowSurfaceManagerTestApi::CreateEmptyDefaultSurface() {
- manager_->type_to_surface_map_[mojom::SurfaceType::DEFAULT] = nullptr;
-}
-
-void ServerWindowSurfaceManagerTestApi::DestroyDefaultSurface() {
- manager_->type_to_surface_map_.erase(mojom::SurfaceType::DEFAULT);
-}
-
-void EnableHitTest(ServerWindow* window) {
- ServerWindowSurfaceManagerTestApi test_api(
- window->GetOrCreateSurfaceManager());
- test_api.CreateEmptyDefaultSurface();
-}
-
-void DisableHitTest(ServerWindow* window) {
- ServerWindowSurfaceManagerTestApi test_api(
- window->GetOrCreateSurfaceManager());
- test_api.DestroyDefaultSurface();
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/server_window_surface_manager_test_api.h b/chromium/components/mus/ws/server_window_surface_manager_test_api.h
deleted file mode 100644
index bc34027110a..00000000000
--- a/chromium/components/mus/ws/server_window_surface_manager_test_api.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_TEST_API_H_
-#define COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_TEST_API_H_
-
-#include "base/macros.h"
-#include "components/mus/ws/server_window_surface_manager.h"
-
-namespace mus {
-namespace ws {
-
-class ServerWindow;
-
-// Use to poke at the internals of ServerWindowSurfaceManager.
-class ServerWindowSurfaceManagerTestApi {
- public:
- explicit ServerWindowSurfaceManagerTestApi(
- ServerWindowSurfaceManager* manager);
- ~ServerWindowSurfaceManagerTestApi();
-
- void CreateEmptyDefaultSurface();
- void DestroyDefaultSurface();
-
- private:
- ServerWindowSurfaceManager* manager_;
-
- DISALLOW_COPY_AND_ASSIGN(ServerWindowSurfaceManagerTestApi);
-};
-
-// Use to make |window| a target for events.
-void EnableHitTest(ServerWindow* window);
-void DisableHitTest(ServerWindow* window);
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_SERVER_WINDOW_SURFACE_MANAGER_TEST_API_H_
diff --git a/chromium/components/mus/ws/server_window_tracker.h b/chromium/components/mus/ws/server_window_tracker.h
deleted file mode 100644
index d3b73f06be1..00000000000
--- a/chromium/components/mus/ws/server_window_tracker.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_SERVER_WINDOW_TRACKER_H_
-#define COMPONENTS_MUS_WS_SERVER_WINDOW_TRACKER_H_
-
-#include <stdint.h>
-#include <set>
-
-#include "base/macros.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_observer.h"
-#include "ui/base/window_tracker_template.h"
-
-namespace mus {
-namespace ws {
-
-using ServerWindowTracker =
- ui::WindowTrackerTemplate<ServerWindow, ServerWindowObserver>;
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_SERVER_WINDOW_TRACKER_H_
diff --git a/chromium/components/mus/ws/test_change_tracker.cc b/chromium/components/mus/ws/test_change_tracker.cc
deleted file mode 100644
index 26cd89ed64a..00000000000
--- a/chromium/components/mus/ws/test_change_tracker.cc
+++ /dev/null
@@ -1,448 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/test_change_tracker.h"
-
-#include <stddef.h>
-
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
-#include "components/mus/common/util.h"
-#include "mojo/common/common_type_converters.h"
-
-using mojo::Array;
-using mojo::String;
-
-namespace mus {
-
-namespace ws {
-
-std::string WindowIdToString(Id id) {
- return (id == 0) ? "null"
- : base::StringPrintf("%d,%d", HiWord(id), LoWord(id));
-}
-
-namespace {
-
-std::string DirectionToString(mojom::OrderDirection direction) {
- return direction == mojom::OrderDirection::ABOVE ? "above" : "below";
-}
-
-enum class ChangeDescriptionType {
- ONE,
- TWO,
-};
-
-std::string ChangeToDescription(const Change& change,
- ChangeDescriptionType type) {
- switch (change.type) {
- case CHANGE_TYPE_EMBED:
- if (type == ChangeDescriptionType::ONE)
- return "OnEmbed";
- return base::StringPrintf("OnEmbed drawn=%s",
- change.bool_value ? "true" : "false");
-
- case CHANGE_TYPE_EMBEDDED_APP_DISCONNECTED:
- return base::StringPrintf("OnEmbeddedAppDisconnected window=%s",
- WindowIdToString(change.window_id).c_str());
-
- case CHANGE_TYPE_UNEMBED:
- return base::StringPrintf("OnUnembed window=%s",
- WindowIdToString(change.window_id).c_str());
-
- case CHANGE_TYPE_LOST_CAPTURE:
- return base::StringPrintf("OnLostCapture window=%s",
- WindowIdToString(change.window_id).c_str());
-
- case CHANGE_TYPE_NODE_ADD_TRANSIENT_WINDOW:
- return base::StringPrintf("AddTransientWindow parent = %s child = %s",
- WindowIdToString(change.window_id).c_str(),
- WindowIdToString(change.window_id2).c_str());
-
- case CHANGE_TYPE_NODE_BOUNDS_CHANGED:
- return base::StringPrintf(
- "BoundsChanged window=%s old_bounds=%s new_bounds=%s",
- WindowIdToString(change.window_id).c_str(),
- change.bounds.ToString().c_str(), change.bounds2.ToString().c_str());
-
- case CHANGE_TYPE_NODE_HIERARCHY_CHANGED:
- return base::StringPrintf(
- "HierarchyChanged window=%s old_parent=%s new_parent=%s",
- WindowIdToString(change.window_id).c_str(),
- WindowIdToString(change.window_id2).c_str(),
- WindowIdToString(change.window_id3).c_str());
-
- case CHANGE_TYPE_NODE_REMOVE_TRANSIENT_WINDOW_FROM_PARENT:
- return base::StringPrintf(
- "RemoveTransientWindowFromParent parent = %s child = %s",
- WindowIdToString(change.window_id).c_str(),
- WindowIdToString(change.window_id2).c_str());
-
- case CHANGE_TYPE_NODE_REORDERED:
- return base::StringPrintf("Reordered window=%s relative=%s direction=%s",
- WindowIdToString(change.window_id).c_str(),
- WindowIdToString(change.window_id2).c_str(),
- DirectionToString(change.direction).c_str());
-
- case CHANGE_TYPE_NODE_DELETED:
- return base::StringPrintf("WindowDeleted window=%s",
- WindowIdToString(change.window_id).c_str());
-
- case CHANGE_TYPE_NODE_VISIBILITY_CHANGED:
- return base::StringPrintf("VisibilityChanged window=%s visible=%s",
- WindowIdToString(change.window_id).c_str(),
- change.bool_value ? "true" : "false");
-
- case CHANGE_TYPE_NODE_DRAWN_STATE_CHANGED:
- return base::StringPrintf("DrawnStateChanged window=%s drawn=%s",
- WindowIdToString(change.window_id).c_str(),
- change.bool_value ? "true" : "false");
-
- case CHANGE_TYPE_INPUT_EVENT: {
- std::string result = base::StringPrintf(
- "InputEvent window=%s event_action=%d",
- WindowIdToString(change.window_id).c_str(), change.event_action);
- if (change.event_observer_id != 0)
- base::StringAppendF(&result, " event_observer_id=%u",
- change.event_observer_id);
- return result;
- }
-
- case CHANGE_TYPE_EVENT_OBSERVED:
- return base::StringPrintf(
- "EventObserved event_action=%d event_observer_id=%u",
- change.event_action, change.event_observer_id);
-
- case CHANGE_TYPE_PROPERTY_CHANGED:
- return base::StringPrintf("PropertyChanged window=%s key=%s value=%s",
- WindowIdToString(change.window_id).c_str(),
- change.property_key.c_str(),
- change.property_value.c_str());
-
- case CHANGE_TYPE_FOCUSED:
- return base::StringPrintf("Focused id=%s",
- WindowIdToString(change.window_id).c_str());
-
- case CHANGE_TYPE_CURSOR_CHANGED:
- return base::StringPrintf("CursorChanged id=%s cursor_id=%d",
- WindowIdToString(change.window_id).c_str(),
- change.cursor_id);
- case CHANGE_TYPE_ON_CHANGE_COMPLETED:
- return base::StringPrintf("ChangeCompleted id=%d sucess=%s",
- change.change_id,
- change.bool_value ? "true" : "false");
-
- case CHANGE_TYPE_ON_TOP_LEVEL_CREATED:
- return base::StringPrintf("TopLevelCreated id=%d window_id=%s drawn=%s",
- change.change_id,
- WindowIdToString(change.window_id).c_str(),
- change.bool_value ? "true" : "false");
- case CHANGE_TYPE_OPACITY:
- return base::StringPrintf("OpacityChanged window_id=%s opacity=%.2f",
- WindowIdToString(change.window_id).c_str(),
- change.float_value);
- }
- return std::string();
-}
-
-std::string SingleChangeToDescriptionImpl(const std::vector<Change>& changes,
- ChangeDescriptionType change_type) {
- std::string result;
- for (auto& change : changes) {
- if (!result.empty())
- result += "\n";
- result += ChangeToDescription(change, change_type);
- }
- return result;
-}
-
-} // namespace
-
-std::vector<std::string> ChangesToDescription1(
- const std::vector<Change>& changes) {
- std::vector<std::string> strings(changes.size());
- for (size_t i = 0; i < changes.size(); ++i)
- strings[i] = ChangeToDescription(changes[i], ChangeDescriptionType::ONE);
- return strings;
-}
-
-std::string SingleChangeToDescription(const std::vector<Change>& changes) {
- return SingleChangeToDescriptionImpl(changes, ChangeDescriptionType::ONE);
-}
-
-std::string SingleChangeToDescription2(const std::vector<Change>& changes) {
- return SingleChangeToDescriptionImpl(changes, ChangeDescriptionType::TWO);
-}
-
-std::string SingleWindowDescription(const std::vector<TestWindow>& windows) {
- if (windows.empty())
- return "no windows";
- std::string result;
- for (const TestWindow& window : windows)
- result += window.ToString();
- return result;
-}
-
-std::string ChangeWindowDescription(const std::vector<Change>& changes) {
- if (changes.size() != 1)
- return std::string();
- std::vector<std::string> window_strings(changes[0].windows.size());
- for (size_t i = 0; i < changes[0].windows.size(); ++i)
- window_strings[i] = "[" + changes[0].windows[i].ToString() + "]";
- return base::JoinString(window_strings, ",");
-}
-
-TestWindow WindowDataToTestWindow(const mojom::WindowDataPtr& data) {
- TestWindow window;
- window.parent_id = data->parent_id;
- window.window_id = data->window_id;
- window.visible = data->visible;
- window.properties =
- data->properties.To<std::map<std::string, std::vector<uint8_t>>>();
- return window;
-}
-
-void WindowDatasToTestWindows(const Array<mojom::WindowDataPtr>& data,
- std::vector<TestWindow>* test_windows) {
- for (size_t i = 0; i < data.size(); ++i)
- test_windows->push_back(WindowDataToTestWindow(data[i]));
-}
-
-Change::Change()
- : type(CHANGE_TYPE_EMBED),
- client_id(0),
- window_id(0),
- window_id2(0),
- window_id3(0),
- event_action(0),
- event_observer_id(0u),
- direction(mojom::OrderDirection::ABOVE),
- bool_value(false),
- float_value(0.f),
- cursor_id(0),
- change_id(0u) {}
-
-Change::Change(const Change& other) = default;
-
-Change::~Change() {}
-
-TestChangeTracker::TestChangeTracker() : delegate_(NULL) {}
-
-TestChangeTracker::~TestChangeTracker() {}
-
-void TestChangeTracker::OnEmbed(ClientSpecificId client_id,
- mojom::WindowDataPtr root,
- bool drawn) {
- Change change;
- change.type = CHANGE_TYPE_EMBED;
- change.client_id = client_id;
- change.bool_value = drawn;
- change.windows.push_back(WindowDataToTestWindow(root));
- AddChange(change);
-}
-
-void TestChangeTracker::OnEmbeddedAppDisconnected(Id window_id) {
- Change change;
- change.type = CHANGE_TYPE_EMBEDDED_APP_DISCONNECTED;
- change.window_id = window_id;
- AddChange(change);
-}
-
-void TestChangeTracker::OnWindowBoundsChanged(Id window_id,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {
- Change change;
- change.type = CHANGE_TYPE_NODE_BOUNDS_CHANGED;
- change.window_id = window_id;
- change.bounds = old_bounds;
- change.bounds2 = new_bounds;
- AddChange(change);
-}
-
-void TestChangeTracker::OnUnembed(Id window_id) {
- Change change;
- change.type = CHANGE_TYPE_UNEMBED;
- change.window_id = window_id;
- AddChange(change);
-}
-
-void TestChangeTracker::OnTransientWindowAdded(Id window_id,
- Id transient_window_id) {
- Change change;
- change.type = CHANGE_TYPE_NODE_ADD_TRANSIENT_WINDOW;
- change.window_id = window_id;
- change.window_id2 = transient_window_id;
- AddChange(change);
-}
-
-void TestChangeTracker::OnTransientWindowRemoved(Id window_id,
- Id transient_window_id) {
- Change change;
- change.type = CHANGE_TYPE_NODE_REMOVE_TRANSIENT_WINDOW_FROM_PARENT;
- change.window_id = window_id;
- change.window_id2 = transient_window_id;
- AddChange(change);
-}
-
-void TestChangeTracker::OnLostCapture(Id window_id) {
- Change change;
- change.type = CHANGE_TYPE_LOST_CAPTURE;
- change.window_id = window_id;
- AddChange(change);
-}
-
-void TestChangeTracker::OnWindowHierarchyChanged(
- Id window_id,
- Id old_parent_id,
- Id new_parent_id,
- Array<mojom::WindowDataPtr> windows) {
- Change change;
- change.type = CHANGE_TYPE_NODE_HIERARCHY_CHANGED;
- change.window_id = window_id;
- change.window_id2 = old_parent_id;
- change.window_id3 = new_parent_id;
- WindowDatasToTestWindows(windows, &change.windows);
- AddChange(change);
-}
-
-void TestChangeTracker::OnWindowReordered(Id window_id,
- Id relative_window_id,
- mojom::OrderDirection direction) {
- Change change;
- change.type = CHANGE_TYPE_NODE_REORDERED;
- change.window_id = window_id;
- change.window_id2 = relative_window_id;
- change.direction = direction;
- AddChange(change);
-}
-
-void TestChangeTracker::OnWindowDeleted(Id window_id) {
- Change change;
- change.type = CHANGE_TYPE_NODE_DELETED;
- change.window_id = window_id;
- AddChange(change);
-}
-
-void TestChangeTracker::OnWindowVisibilityChanged(Id window_id, bool visible) {
- Change change;
- change.type = CHANGE_TYPE_NODE_VISIBILITY_CHANGED;
- change.window_id = window_id;
- change.bool_value = visible;
- AddChange(change);
-}
-
-void TestChangeTracker::OnWindowOpacityChanged(Id window_id, float opacity) {
- Change change;
- change.type = CHANGE_TYPE_OPACITY;
- change.window_id = window_id;
- change.float_value = opacity;
- AddChange(change);
-}
-
-void TestChangeTracker::OnWindowParentDrawnStateChanged(Id window_id,
- bool drawn) {
- Change change;
- change.type = CHANGE_TYPE_NODE_DRAWN_STATE_CHANGED;
- change.window_id = window_id;
- change.bool_value = drawn;
- AddChange(change);
-}
-
-void TestChangeTracker::OnWindowInputEvent(Id window_id,
- const ui::Event& event,
- uint32_t event_observer_id) {
- Change change;
- change.type = CHANGE_TYPE_INPUT_EVENT;
- change.window_id = window_id;
- change.event_action = static_cast<int32_t>(event.type());
- change.event_observer_id = event_observer_id;
- AddChange(change);
-}
-
-void TestChangeTracker::OnEventObserved(const ui::Event& event,
- uint32_t event_observer_id) {
- Change change;
- change.type = CHANGE_TYPE_EVENT_OBSERVED;
- change.event_action = static_cast<int32_t>(event.type());
- change.event_observer_id = event_observer_id;
- AddChange(change);
-}
-
-void TestChangeTracker::OnWindowSharedPropertyChanged(Id window_id,
- String name,
- Array<uint8_t> data) {
- Change change;
- change.type = CHANGE_TYPE_PROPERTY_CHANGED;
- change.window_id = window_id;
- change.property_key = name;
- if (data.is_null())
- change.property_value = "NULL";
- else
- change.property_value = data.To<std::string>();
- AddChange(change);
-}
-
-void TestChangeTracker::OnWindowFocused(Id window_id) {
- Change change;
- change.type = CHANGE_TYPE_FOCUSED;
- change.window_id = window_id;
- AddChange(change);
-}
-
-void TestChangeTracker::OnWindowPredefinedCursorChanged(
- Id window_id,
- mojom::Cursor cursor_id) {
- Change change;
- change.type = CHANGE_TYPE_CURSOR_CHANGED;
- change.window_id = window_id;
- change.cursor_id = static_cast<int32_t>(cursor_id);
- AddChange(change);
-}
-
-void TestChangeTracker::OnChangeCompleted(uint32_t change_id, bool success) {
- Change change;
- change.type = CHANGE_TYPE_ON_CHANGE_COMPLETED;
- change.change_id = change_id;
- change.bool_value = success;
- AddChange(change);
-}
-
-void TestChangeTracker::OnTopLevelCreated(uint32_t change_id,
- mojom::WindowDataPtr window_data,
- bool drawn) {
- Change change;
- change.type = CHANGE_TYPE_ON_TOP_LEVEL_CREATED;
- change.change_id = change_id;
- change.window_id = window_data->window_id;
- change.bool_value = drawn;
- AddChange(change);
-}
-
-void TestChangeTracker::AddChange(const Change& change) {
- changes_.push_back(change);
- if (delegate_)
- delegate_->OnChangeAdded();
-}
-
-TestWindow::TestWindow() {}
-
-TestWindow::TestWindow(const TestWindow& other) = default;
-
-TestWindow::~TestWindow() {}
-
-std::string TestWindow::ToString() const {
- return base::StringPrintf("window=%s parent=%s",
- WindowIdToString(window_id).c_str(),
- WindowIdToString(parent_id).c_str());
-}
-
-std::string TestWindow::ToString2() const {
- return base::StringPrintf(
- "window=%s parent=%s visible=%s", WindowIdToString(window_id).c_str(),
- WindowIdToString(parent_id).c_str(), visible ? "true" : "false");
-}
-
-} // namespace ws
-
-} // namespace mus
diff --git a/chromium/components/mus/ws/test_change_tracker.h b/chromium/components/mus/ws/test_change_tracker.h
deleted file mode 100644
index 7d82b2f339b..00000000000
--- a/chromium/components/mus/ws/test_change_tracker.h
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_TEST_CHANGE_TRACKER_H_
-#define COMPONENTS_MUS_WS_TEST_CHANGE_TRACKER_H_
-
-#include <stdint.h>
-
-#include <string>
-#include <vector>
-
-#include "base/macros.h"
-#include "components/mus/common/types.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "mojo/public/cpp/bindings/array.h"
-#include "ui/gfx/geometry/mojo/geometry.mojom.h"
-
-namespace mus {
-
-namespace ws {
-
-enum ChangeType {
- CHANGE_TYPE_EMBED,
- CHANGE_TYPE_EMBEDDED_APP_DISCONNECTED,
- CHANGE_TYPE_UNEMBED,
- CHANGE_TYPE_LOST_CAPTURE,
- // TODO(sky): nuke NODE.
- CHANGE_TYPE_NODE_ADD_TRANSIENT_WINDOW,
- CHANGE_TYPE_NODE_BOUNDS_CHANGED,
- CHANGE_TYPE_NODE_HIERARCHY_CHANGED,
- CHANGE_TYPE_NODE_REMOVE_TRANSIENT_WINDOW_FROM_PARENT,
- CHANGE_TYPE_NODE_REORDERED,
- CHANGE_TYPE_NODE_VISIBILITY_CHANGED,
- CHANGE_TYPE_NODE_DRAWN_STATE_CHANGED,
- CHANGE_TYPE_NODE_DELETED,
- CHANGE_TYPE_INPUT_EVENT,
- CHANGE_TYPE_EVENT_OBSERVED,
- CHANGE_TYPE_PROPERTY_CHANGED,
- CHANGE_TYPE_FOCUSED,
- CHANGE_TYPE_CURSOR_CHANGED,
- CHANGE_TYPE_ON_CHANGE_COMPLETED,
- CHANGE_TYPE_ON_TOP_LEVEL_CREATED,
- CHANGE_TYPE_OPACITY,
-};
-
-// TODO(sky): consider nuking and converting directly to WindowData.
-struct TestWindow {
- TestWindow();
- TestWindow(const TestWindow& other);
- ~TestWindow();
-
- // Returns a string description of this.
- std::string ToString() const;
-
- // Returns a string description that includes visible and drawn.
- std::string ToString2() const;
-
- Id parent_id;
- Id window_id;
- bool visible;
- std::map<std::string, std::vector<uint8_t>> properties;
-};
-
-// Tracks a call to WindowTreeClient. See the individual functions for the
-// fields that are used.
-struct Change {
- Change();
- Change(const Change& other);
- ~Change();
-
- ChangeType type;
- ClientSpecificId client_id;
- std::vector<TestWindow> windows;
- Id window_id;
- Id window_id2;
- Id window_id3;
- gfx::Rect bounds;
- gfx::Rect bounds2;
- int32_t event_action;
- uint32_t event_observer_id;
- mojo::String embed_url;
- mojom::OrderDirection direction;
- bool bool_value;
- float float_value;
- std::string property_key;
- std::string property_value;
- int32_t cursor_id;
- uint32_t change_id;
-};
-
-// Converts Changes to string descriptions.
-std::vector<std::string> ChangesToDescription1(
- const std::vector<Change>& changes);
-
-// Convenience for returning the description of the first item in |changes|.
-// Returns an empty string if |changes| has something other than one entry.
-std::string SingleChangeToDescription(const std::vector<Change>& changes);
-std::string SingleChangeToDescription2(const std::vector<Change>& changes);
-
-// Convenience for returning the description of the first item in |windows|.
-// Returns an empty string if |windows| has something other than one entry.
-std::string SingleWindowDescription(const std::vector<TestWindow>& windows);
-
-// Returns a string description of |changes[0].windows|. Returns an empty string
-// if change.size() != 1.
-std::string ChangeWindowDescription(const std::vector<Change>& changes);
-
-// Converts WindowDatas to TestWindows.
-void WindowDatasToTestWindows(const mojo::Array<mojom::WindowDataPtr>& data,
- std::vector<TestWindow>* test_windows);
-
-// TestChangeTracker is used to record WindowTreeClient functions. It notifies
-// a delegate any time a change is added.
-class TestChangeTracker {
- public:
- // Used to notify the delegate when a change is added. A change corresponds to
- // a single WindowTreeClient function.
- class Delegate {
- public:
- virtual void OnChangeAdded() = 0;
-
- protected:
- virtual ~Delegate() {}
- };
-
- TestChangeTracker();
- ~TestChangeTracker();
-
- void set_delegate(Delegate* delegate) { delegate_ = delegate; }
-
- std::vector<Change>* changes() { return &changes_; }
-
- // Each of these functions generate a Change. There is one per
- // WindowTreeClient function.
- void OnEmbed(ClientSpecificId client_id,
- mojom::WindowDataPtr root,
- bool drawn);
- void OnEmbeddedAppDisconnected(Id window_id);
- void OnUnembed(Id window_id);
- void OnLostCapture(Id window_id);
- void OnTransientWindowAdded(Id window_id, Id transient_window_id);
- void OnTransientWindowRemoved(Id window_id, Id transient_window_id);
- void OnWindowBoundsChanged(Id window_id,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds);
- void OnWindowHierarchyChanged(Id window_id,
- Id old_parent_id,
- Id new_parent_id,
- mojo::Array<mojom::WindowDataPtr> windows);
- void OnWindowReordered(Id window_id,
- Id relative_window_id,
- mojom::OrderDirection direction);
- void OnWindowDeleted(Id window_id);
- void OnWindowVisibilityChanged(Id window_id, bool visible);
- void OnWindowOpacityChanged(Id window_id, float opacity);
- void OnWindowParentDrawnStateChanged(Id window_id, bool drawn);
- void OnWindowInputEvent(Id window_id,
- const ui::Event& event,
- uint32_t event_observer_id);
- void OnEventObserved(const ui::Event& event, uint32_t event_observer_id);
- void OnWindowSharedPropertyChanged(Id window_id,
- mojo::String name,
- mojo::Array<uint8_t> data);
- void OnWindowFocused(Id window_id);
- void OnWindowPredefinedCursorChanged(Id window_id, mojom::Cursor cursor_id);
- void OnChangeCompleted(uint32_t change_id, bool success);
- void OnTopLevelCreated(uint32_t change_id,
- mojom::WindowDataPtr window_data,
- bool drawn);
-
- private:
- void AddChange(const Change& change);
-
- Delegate* delegate_;
- std::vector<Change> changes_;
-
- DISALLOW_COPY_AND_ASSIGN(TestChangeTracker);
-};
-
-} // namespace ws
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_TEST_CHANGE_TRACKER_H_
diff --git a/chromium/components/mus/ws/test_server_window_delegate.cc b/chromium/components/mus/ws/test_server_window_delegate.cc
deleted file mode 100644
index 57f1aaec6ed..00000000000
--- a/chromium/components/mus/ws/test_server_window_delegate.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/surfaces/surfaces_state.h"
-#include "components/mus/ws/test_server_window_delegate.h"
-#include "components/mus/ws/server_window.h"
-
-namespace mus {
-
-namespace ws {
-
-TestServerWindowDelegate::TestServerWindowDelegate()
- : root_window_(nullptr), surfaces_state_(new SurfacesState()) {}
-
-TestServerWindowDelegate::~TestServerWindowDelegate() {}
-
-mus::SurfacesState* TestServerWindowDelegate::GetSurfacesState() {
- return surfaces_state_.get();
-}
-
-void TestServerWindowDelegate::OnScheduleWindowPaint(ServerWindow* window) {}
-
-const ServerWindow* TestServerWindowDelegate::GetRootWindow(
- const ServerWindow* window) const {
- return root_window_;
-}
-
-void TestServerWindowDelegate::ScheduleSurfaceDestruction(
- ServerWindow* window) {}
-
-} // namespace ws
-
-} // namespace mus
diff --git a/chromium/components/mus/ws/test_server_window_delegate.h b/chromium/components/mus/ws/test_server_window_delegate.h
deleted file mode 100644
index 77808771d9d..00000000000
--- a/chromium/components/mus/ws/test_server_window_delegate.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_TEST_SERVER_WINDOW_DELEGATE_H_
-#define COMPONENTS_MUS_WS_TEST_SERVER_WINDOW_DELEGATE_H_
-
-#include "base/macros.h"
-#include "components/mus/ws/server_window_delegate.h"
-
-namespace mus {
-
-namespace ws {
-
-struct WindowId;
-
-class TestServerWindowDelegate : public ServerWindowDelegate {
- public:
- TestServerWindowDelegate();
- ~TestServerWindowDelegate() override;
-
- void set_root_window(const ServerWindow* window) { root_window_ = window; }
-
- private:
- // ServerWindowDelegate:
- mus::SurfacesState* GetSurfacesState() override;
- void OnScheduleWindowPaint(ServerWindow* window) override;
- const ServerWindow* GetRootWindow(const ServerWindow* window) const override;
- void ScheduleSurfaceDestruction(ServerWindow* window) override;
-
- const ServerWindow* root_window_;
- scoped_refptr<mus::SurfacesState> surfaces_state_;
-
- DISALLOW_COPY_AND_ASSIGN(TestServerWindowDelegate);
-};
-
-} // namespace ws
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_TEST_SERVER_WINDOW_DELEGATE_H_
diff --git a/chromium/components/mus/ws/test_utils.cc b/chromium/components/mus/ws/test_utils.cc
deleted file mode 100644
index 78f7d4714d3..00000000000
--- a/chromium/components/mus/ws/test_utils.cc
+++ /dev/null
@@ -1,496 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/test_utils.h"
-
-#include "base/memory/ptr_util.h"
-#include "cc/output/copy_output_request.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "components/mus/ws/display_binding.h"
-#include "components/mus/ws/display_manager.h"
-#include "components/mus/ws/server_window_surface_manager_test_api.h"
-#include "components/mus/ws/window_manager_access_policy.h"
-#include "components/mus/ws/window_manager_window_tree_factory.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace mus {
-namespace ws {
-namespace test {
-namespace {
-
-// -----------------------------------------------------------------------------
-// Empty implementation of PlatformDisplay.
-class TestPlatformDisplay : public PlatformDisplay {
- public:
- explicit TestPlatformDisplay(int32_t* cursor_id_storage)
- : cursor_id_storage_(cursor_id_storage) {
- display_metrics_.size_in_pixels = gfx::Size(400, 300);
- display_metrics_.device_scale_factor = 1.f;
- }
- ~TestPlatformDisplay() override {}
-
- // PlatformDisplay:
- void Init(PlatformDisplayDelegate* delegate) override {
- // It is necessary to tell the delegate about the ViewportMetrics to make
- // sure that the DisplayBinding is correctly initialized (and a root-window
- // is created).
- delegate->OnViewportMetricsChanged(ViewportMetrics(), display_metrics_);
- }
- void SchedulePaint(const ServerWindow* window,
- const gfx::Rect& bounds) override {}
- void SetViewportSize(const gfx::Size& size) override {}
- void SetTitle(const base::string16& title) override {}
- void SetCapture() override {}
- void ReleaseCapture() override {}
- void SetCursorById(int32_t cursor) override { *cursor_id_storage_ = cursor; }
- mojom::Rotation GetRotation() override { return mojom::Rotation::VALUE_0; }
- float GetDeviceScaleFactor() override {
- return display_metrics_.device_scale_factor;
- }
- void UpdateTextInputState(const ui::TextInputState& state) override {}
- void SetImeVisibility(bool visible) override {}
- bool IsFramePending() const override { return false; }
- void RequestCopyOfOutput(
- std::unique_ptr<cc::CopyOutputRequest> output_request) override {}
- int64_t GetDisplayId() const override { return 1; }
-
- private:
- ViewportMetrics display_metrics_;
-
- int32_t* cursor_id_storage_;
-
- DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplay);
-};
-
-ClientWindowId NextUnusedClientWindowId(WindowTree* tree) {
- ClientWindowId client_id;
- for (ClientSpecificId id = 1;; ++id) {
- // Used the id of the client in the upper bits to simplify things.
- const ClientWindowId client_id =
- ClientWindowId(WindowIdToTransportId(WindowId(tree->id(), id)));
- if (!tree->GetWindowByClientId(client_id))
- return client_id;
- }
-}
-
-} // namespace
-
-// WindowManagerWindowTreeFactorySetTestApi ------------------------------------
-
-WindowManagerWindowTreeFactorySetTestApi::
- WindowManagerWindowTreeFactorySetTestApi(
- WindowManagerWindowTreeFactorySet*
- window_manager_window_tree_factory_set)
- : window_manager_window_tree_factory_set_(
- window_manager_window_tree_factory_set) {}
-
-WindowManagerWindowTreeFactorySetTestApi::
- ~WindowManagerWindowTreeFactorySetTestApi() {}
-
-void WindowManagerWindowTreeFactorySetTestApi::Add(const UserId& user_id) {
- WindowManagerWindowTreeFactory* factory =
- window_manager_window_tree_factory_set_->Add(user_id, nullptr);
- factory->CreateWindowTree(nullptr, nullptr);
-}
-
-// TestPlatformDisplayFactory -------------------------------------------------
-
-TestPlatformDisplayFactory::TestPlatformDisplayFactory(
- int32_t* cursor_id_storage)
- : cursor_id_storage_(cursor_id_storage) {}
-
-TestPlatformDisplayFactory::~TestPlatformDisplayFactory() {}
-
-PlatformDisplay* TestPlatformDisplayFactory::CreatePlatformDisplay() {
- return new TestPlatformDisplay(cursor_id_storage_);
-}
-
-// WindowTreeTestApi ---------------------------------------------------------
-
-WindowTreeTestApi::WindowTreeTestApi(WindowTree* tree) : tree_(tree) {}
-WindowTreeTestApi::~WindowTreeTestApi() {}
-
-void WindowTreeTestApi::SetEventObserver(mojom::EventMatcherPtr matcher,
- uint32_t event_observer_id) {
- tree_->SetEventObserver(std::move(matcher), event_observer_id);
-}
-
-// DisplayTestApi ------------------------------------------------------------
-
-DisplayTestApi::DisplayTestApi(Display* display) : display_(display) {}
-DisplayTestApi::~DisplayTestApi() {}
-
-// EventDispatcherTestApi ----------------------------------------------------
-
-bool EventDispatcherTestApi::IsWindowPointerTarget(
- const ServerWindow* window) const {
- for (const auto& pair : ed_->pointer_targets_) {
- if (pair.second.window == window)
- return true;
- }
- return false;
-}
-
-int EventDispatcherTestApi::NumberPointerTargetsForWindow(
- ServerWindow* window) {
- int count = 0;
- for (const auto& pair : ed_->pointer_targets_)
- if (pair.second.window == window)
- count++;
- return count;
-}
-
-// TestDisplayBinding ---------------------------------------------------------
-
-WindowTree* TestDisplayBinding::CreateWindowTree(ServerWindow* root) {
- const uint32_t embed_flags = 0;
- WindowTree* tree = window_server_->EmbedAtWindow(
- root, shell::mojom::kRootUserID, mus::mojom::WindowTreeClientPtr(),
- embed_flags, base::WrapUnique(new WindowManagerAccessPolicy));
- tree->ConfigureWindowManager();
- return tree;
-}
-
-// TestWindowManager ----------------------------------------------------------
-
-void TestWindowManager::WmCreateTopLevelWindow(
- uint32_t change_id,
- ClientSpecificId requesting_client_id,
- mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) {
- got_create_top_level_window_ = true;
- change_id_ = change_id;
-}
-
-void TestWindowManager::WmClientJankinessChanged(ClientSpecificId client_id,
- bool janky) {}
-
-void TestWindowManager::OnAccelerator(uint32_t id,
- std::unique_ptr<ui::Event> event) {
- on_accelerator_called_ = true;
- on_accelerator_id_ = id;
-}
-
-// TestWindowTreeClient -------------------------------------------------------
-
-TestWindowTreeClient::TestWindowTreeClient()
- : binding_(this), record_on_change_completed_(false) {}
-TestWindowTreeClient::~TestWindowTreeClient() {}
-
-void TestWindowTreeClient::Bind(
- mojo::InterfaceRequest<mojom::WindowTreeClient> request) {
- binding_.Bind(std::move(request));
-}
-
-void TestWindowTreeClient::OnEmbed(uint16_t client_id,
- mojom::WindowDataPtr root,
- mus::mojom::WindowTreePtr tree,
- int64_t display_id,
- Id focused_window_id,
- bool drawn) {
- // TODO(sky): add test coverage of |focused_window_id|.
- tracker_.OnEmbed(client_id, std::move(root), drawn);
-}
-
-void TestWindowTreeClient::OnEmbeddedAppDisconnected(uint32_t window) {
- tracker_.OnEmbeddedAppDisconnected(window);
-}
-
-void TestWindowTreeClient::OnUnembed(Id window_id) {
- tracker_.OnUnembed(window_id);
-}
-
-void TestWindowTreeClient::OnLostCapture(Id window_id) {}
-
-void TestWindowTreeClient::OnTopLevelCreated(uint32_t change_id,
- mojom::WindowDataPtr data,
- int64_t display_id,
- bool drawn) {
- tracker_.OnTopLevelCreated(change_id, std::move(data), drawn);
-}
-
-void TestWindowTreeClient::OnWindowBoundsChanged(uint32_t window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {
- tracker_.OnWindowBoundsChanged(window, std::move(old_bounds),
- std::move(new_bounds));
-}
-
-void TestWindowTreeClient::OnClientAreaChanged(
- uint32_t window_id,
- const gfx::Insets& new_client_area,
- mojo::Array<gfx::Rect> new_additional_client_areas) {}
-
-void TestWindowTreeClient::OnTransientWindowAdded(
- uint32_t window_id,
- uint32_t transient_window_id) {}
-
-void TestWindowTreeClient::OnTransientWindowRemoved(
- uint32_t window_id,
- uint32_t transient_window_id) {}
-
-void TestWindowTreeClient::OnWindowHierarchyChanged(
- uint32_t window,
- uint32_t old_parent,
- uint32_t new_parent,
- mojo::Array<mojom::WindowDataPtr> windows) {
- tracker_.OnWindowHierarchyChanged(window, old_parent, new_parent,
- std::move(windows));
-}
-
-void TestWindowTreeClient::OnWindowReordered(uint32_t window_id,
- uint32_t relative_window_id,
- mojom::OrderDirection direction) {
- tracker_.OnWindowReordered(window_id, relative_window_id, direction);
-}
-
-void TestWindowTreeClient::OnWindowDeleted(uint32_t window) {
- tracker_.OnWindowDeleted(window);
-}
-
-void TestWindowTreeClient::OnWindowVisibilityChanged(uint32_t window,
- bool visible) {
- tracker_.OnWindowVisibilityChanged(window, visible);
-}
-
-void TestWindowTreeClient::OnWindowOpacityChanged(uint32_t window,
- float old_opacity,
- float new_opacity) {
- tracker_.OnWindowOpacityChanged(window, new_opacity);
-}
-
-void TestWindowTreeClient::OnWindowParentDrawnStateChanged(uint32_t window,
- bool drawn) {
- tracker_.OnWindowParentDrawnStateChanged(window, drawn);
-}
-
-void TestWindowTreeClient::OnWindowSharedPropertyChanged(
- uint32_t window,
- const mojo::String& name,
- mojo::Array<uint8_t> new_data) {
- tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data));
-}
-
-void TestWindowTreeClient::OnWindowInputEvent(uint32_t event_id,
- uint32_t window,
- std::unique_ptr<ui::Event> event,
- uint32_t event_observer_id) {
- tracker_.OnWindowInputEvent(window, *event.get(), event_observer_id);
-}
-
-void TestWindowTreeClient::OnEventObserved(std::unique_ptr<ui::Event> event,
- uint32_t event_observer_id) {
- tracker_.OnEventObserved(*event.get(), event_observer_id);
-}
-
-void TestWindowTreeClient::OnWindowFocused(uint32_t focused_window_id) {
- tracker_.OnWindowFocused(focused_window_id);
-}
-
-void TestWindowTreeClient::OnWindowPredefinedCursorChanged(
- uint32_t window_id,
- mojom::Cursor cursor_id) {
- tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id);
-}
-
-void TestWindowTreeClient::OnChangeCompleted(uint32_t change_id, bool success) {
- if (record_on_change_completed_)
- tracker_.OnChangeCompleted(change_id, success);
-}
-
-void TestWindowTreeClient::RequestClose(uint32_t window_id) {}
-
-void TestWindowTreeClient::GetWindowManager(
- mojo::AssociatedInterfaceRequest<mojom::WindowManager> internal) {}
-
-// TestWindowTreeBinding ------------------------------------------------------
-
-TestWindowTreeBinding::TestWindowTreeBinding(WindowTree* tree)
- : WindowTreeBinding(&client_), tree_(tree) {}
-TestWindowTreeBinding::~TestWindowTreeBinding() {}
-
-mojom::WindowManager* TestWindowTreeBinding::GetWindowManager() {
- if (!window_manager_.get())
- window_manager_.reset(new TestWindowManager);
- return window_manager_.get();
-}
-void TestWindowTreeBinding::SetIncomingMethodCallProcessingPaused(bool paused) {
- is_paused_ = paused;
-}
-
-// TestWindowServerDelegate ----------------------------------------------
-
-TestWindowServerDelegate::TestWindowServerDelegate() {}
-TestWindowServerDelegate::~TestWindowServerDelegate() {}
-
-Display* TestWindowServerDelegate::AddDisplay() {
- // Display manages its own lifetime.
- Display* display = new Display(window_server_, PlatformDisplayInitParams());
- display->Init(nullptr);
- return display;
-}
-
-void TestWindowServerDelegate::OnNoMoreDisplays() {
- got_on_no_more_displays_ = true;
-}
-
-std::unique_ptr<WindowTreeBinding>
-TestWindowServerDelegate::CreateWindowTreeBinding(
- BindingType type,
- ws::WindowServer* window_server,
- ws::WindowTree* tree,
- mojom::WindowTreeRequest* tree_request,
- mojom::WindowTreeClientPtr* client) {
- std::unique_ptr<TestWindowTreeBinding> binding(
- new TestWindowTreeBinding(tree));
- bindings_.push_back(binding.get());
- return std::move(binding);
-}
-
-void TestWindowServerDelegate::CreateDefaultDisplays() {
- DCHECK(num_displays_to_create_);
- DCHECK(window_server_);
-
- for (int i = 0; i < num_displays_to_create_; ++i)
- AddDisplay();
-}
-
-bool TestWindowServerDelegate::IsTestConfig() const {
- return true;
-}
-
-// WindowEventTargetingHelper ------------------------------------------------
-
-WindowEventTargetingHelper::WindowEventTargetingHelper()
- : wm_client_(nullptr),
- cursor_id_(0),
- platform_display_factory_(&cursor_id_),
- display_binding_(nullptr),
- display_(nullptr),
- surfaces_state_(new SurfacesState()),
- window_server_(nullptr) {
- PlatformDisplay::set_factory_for_testing(&platform_display_factory_);
- window_server_.reset(
- new WindowServer(&window_server_delegate_, surfaces_state_));
- PlatformDisplayInitParams display_init_params;
- display_init_params.surfaces_state = surfaces_state_;
- display_ = new Display(window_server_.get(), display_init_params);
- display_binding_ = new TestDisplayBinding(window_server_.get());
- display_->Init(base::WrapUnique(display_binding_));
- wm_client_ = window_server_delegate_.last_client();
- wm_client_->tracker()->changes()->clear();
-}
-
-WindowEventTargetingHelper::~WindowEventTargetingHelper() {}
-
-ServerWindow* WindowEventTargetingHelper::CreatePrimaryTree(
- const gfx::Rect& root_window_bounds,
- const gfx::Rect& window_bounds) {
- WindowTree* wm_tree = window_server_->GetTreeWithId(1);
- const ClientWindowId embed_window_id(
- WindowIdToTransportId(WindowId(wm_tree->id(), 1)));
- EXPECT_TRUE(wm_tree->NewWindow(embed_window_id, ServerWindow::Properties()));
- EXPECT_TRUE(wm_tree->SetWindowVisibility(embed_window_id, true));
- EXPECT_TRUE(wm_tree->AddWindow(FirstRootId(wm_tree), embed_window_id));
- display_->root_window()->SetBounds(root_window_bounds);
- mojom::WindowTreeClientPtr client;
- mojom::WindowTreeClientRequest client_request = GetProxy(&client);
- wm_client_->Bind(std::move(client_request));
- const uint32_t embed_flags = 0;
- wm_tree->Embed(embed_window_id, std::move(client), embed_flags);
- ServerWindow* embed_window = wm_tree->GetWindowByClientId(embed_window_id);
- WindowTree* tree1 = window_server_->GetTreeWithRoot(embed_window);
- EXPECT_NE(nullptr, tree1);
- EXPECT_NE(tree1, wm_tree);
- WindowTreeTestApi(tree1).set_user_id(wm_tree->user_id());
-
- embed_window->SetBounds(window_bounds);
-
- return embed_window;
-}
-
-void WindowEventTargetingHelper::CreateSecondaryTree(
- ServerWindow* embed_window,
- const gfx::Rect& window_bounds,
- TestWindowTreeClient** out_client,
- WindowTree** window_tree,
- ServerWindow** window) {
- WindowTree* tree1 = window_server_->GetTreeWithRoot(embed_window);
- ASSERT_TRUE(tree1 != nullptr);
- const ClientWindowId child1_id(
- WindowIdToTransportId(WindowId(tree1->id(), 1)));
- EXPECT_TRUE(tree1->NewWindow(child1_id, ServerWindow::Properties()));
- ServerWindow* child1 = tree1->GetWindowByClientId(child1_id);
- ASSERT_TRUE(child1);
- EXPECT_TRUE(tree1->AddWindow(ClientWindowIdForWindow(tree1, embed_window),
- child1_id));
- tree1->GetDisplay(embed_window)->AddActivationParent(embed_window);
-
- child1->SetVisible(true);
- child1->SetBounds(window_bounds);
- EnableHitTest(child1);
-
- TestWindowTreeClient* embed_client =
- window_server_delegate_.last_client();
- embed_client->tracker()->changes()->clear();
- wm_client_->tracker()->changes()->clear();
-
- *out_client = embed_client;
- *window_tree = tree1;
- *window = child1;
-}
-
-void WindowEventTargetingHelper::SetTaskRunner(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
- message_loop_.SetTaskRunner(task_runner);
-}
-
-// ----------------------------------------------------------------------------
-
-ServerWindow* FirstRoot(WindowTree* tree) {
- return tree->roots().size() == 1u
- ? tree->GetWindow((*tree->roots().begin())->id())
- : nullptr;
-}
-
-ClientWindowId FirstRootId(WindowTree* tree) {
- ServerWindow* first_root = FirstRoot(tree);
- return first_root ? ClientWindowIdForWindow(tree, first_root)
- : ClientWindowId();
-}
-
-ClientWindowId ClientWindowIdForWindow(WindowTree* tree,
- const ServerWindow* window) {
- ClientWindowId client_window_id;
- // If window isn't known we'll return 0, which should then error out.
- tree->IsWindowKnown(window, &client_window_id);
- return client_window_id;
-}
-
-ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id) {
- return NewWindowInTreeWithParent(tree, FirstRoot(tree), client_id);
-}
-
-ServerWindow* NewWindowInTreeWithParent(WindowTree* tree,
- ServerWindow* parent,
- ClientWindowId* client_id) {
- if (!parent)
- return nullptr;
- ClientWindowId parent_client_id;
- if (!tree->IsWindowKnown(parent, &parent_client_id))
- return nullptr;
- ClientWindowId client_window_id = NextUnusedClientWindowId(tree);
- if (!tree->NewWindow(client_window_id, ServerWindow::Properties()))
- return nullptr;
- if (!tree->SetWindowVisibility(client_window_id, true))
- return nullptr;
- if (!tree->AddWindow(parent_client_id, client_window_id))
- return nullptr;
- *client_id = client_window_id;
- return tree->GetWindowByClientId(client_window_id);
-}
-
-} // namespace test
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/test_utils.h b/chromium/components/mus/ws/test_utils.h
deleted file mode 100644
index ede927722ec..00000000000
--- a/chromium/components/mus/ws/test_utils.h
+++ /dev/null
@@ -1,537 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_TEST_UTILS_H_
-#define COMPONENTS_MUS_WS_TEST_UTILS_H_
-
-#include <stdint.h>
-
-#include <vector>
-
-#include "components/mus/public/interfaces/display.mojom.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/ws/display.h"
-#include "components/mus/ws/display_binding.h"
-#include "components/mus/ws/event_dispatcher.h"
-#include "components/mus/ws/platform_display.h"
-#include "components/mus/ws/platform_display_factory.h"
-#include "components/mus/ws/test_change_tracker.h"
-#include "components/mus/ws/user_activity_monitor.h"
-#include "components/mus/ws/user_display_manager.h"
-#include "components/mus/ws/user_id.h"
-#include "components/mus/ws/window_manager_state.h"
-#include "components/mus/ws/window_manager_window_tree_factory_set.h"
-#include "components/mus/ws/window_server_delegate.h"
-#include "components/mus/ws/window_tree.h"
-#include "components/mus/ws/window_tree_binding.h"
-
-namespace mus {
-namespace ws {
-namespace test {
-
-// Collection of utilities useful in creating mus tests.
-
-class WindowManagerWindowTreeFactorySetTestApi {
- public:
- explicit WindowManagerWindowTreeFactorySetTestApi(
- WindowManagerWindowTreeFactorySet*
- window_manager_window_tree_factory_set);
- ~WindowManagerWindowTreeFactorySetTestApi();
-
- void Add(const UserId& user_id);
-
- private:
- WindowManagerWindowTreeFactorySet* window_manager_window_tree_factory_set_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowManagerWindowTreeFactorySetTestApi);
-};
-
-// -----------------------------------------------------------------------------
-
-class UserDisplayManagerTestApi {
- public:
- explicit UserDisplayManagerTestApi(UserDisplayManager* udm) : udm_(udm) {}
- ~UserDisplayManagerTestApi() {}
-
- void SetTestObserver(mojom::DisplayManagerObserver* observer) {
- udm_->test_observer_ = observer;
- if (observer)
- udm_->OnObserverAdded(observer);
- }
-
- private:
- UserDisplayManager* udm_;
-
- DISALLOW_COPY_AND_ASSIGN(UserDisplayManagerTestApi);
-};
-
-// -----------------------------------------------------------------------------
-
-class UserActivityMonitorTestApi {
- public:
- explicit UserActivityMonitorTestApi(UserActivityMonitor* monitor)
- : monitor_(monitor) {}
-
- void SetTimerTaskRunner(
- scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
- monitor_->idle_timer_.SetTaskRunner(task_runner);
- }
-
- private:
- UserActivityMonitor* monitor_;
- DISALLOW_COPY_AND_ASSIGN(UserActivityMonitorTestApi);
-};
-
-// -----------------------------------------------------------------------------
-
-class WindowTreeTestApi {
- public:
- explicit WindowTreeTestApi(WindowTree* tree);
- ~WindowTreeTestApi();
-
- void set_user_id(const UserId& user_id) { tree_->user_id_ = user_id; }
- void set_window_manager_internal(mojom::WindowManager* wm_internal) {
- tree_->window_manager_internal_ = wm_internal;
- }
- void AckOldestEvent() {
- tree_->OnWindowInputEventAck(tree_->event_ack_id_,
- mojom::EventResult::UNHANDLED);
- }
- void EnableCapture() { tree_->event_ack_id_ = 1u; }
- void AckLastEvent(mojom::EventResult result) {
- tree_->OnWindowInputEventAck(tree_->event_ack_id_, result);
- }
-
- void SetEventObserver(mojom::EventMatcherPtr matcher,
- uint32_t event_observer_id);
-
- private:
- WindowTree* tree_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowTreeTestApi);
-};
-
-// -----------------------------------------------------------------------------
-
-class DisplayTestApi {
- public:
- explicit DisplayTestApi(Display* display);
- ~DisplayTestApi();
-
- void OnEvent(const ui::Event& event) { display_->OnEvent(event); }
-
- private:
- Display* display_;
-
- DISALLOW_COPY_AND_ASSIGN(DisplayTestApi);
-};
-
-// -----------------------------------------------------------------------------
-
-class EventDispatcherTestApi {
- public:
- explicit EventDispatcherTestApi(EventDispatcher* ed) : ed_(ed) {}
- ~EventDispatcherTestApi() {}
-
- bool AreAnyPointersDown() const { return ed_->AreAnyPointersDown(); }
- bool is_mouse_button_down() const { return ed_->mouse_button_down_; }
- bool IsWindowPointerTarget(const ServerWindow* window) const;
- int NumberPointerTargetsForWindow(ServerWindow* window);
- ModalWindowController* modal_window_controller() const {
- return &ed_->modal_window_controller_;
- }
- ServerWindow* capture_window() { return ed_->capture_window_; }
-
- private:
- EventDispatcher* ed_;
-
- DISALLOW_COPY_AND_ASSIGN(EventDispatcherTestApi);
-};
-
-// -----------------------------------------------------------------------------
-
-class ModalWindowControllerTestApi {
- public:
- explicit ModalWindowControllerTestApi(ModalWindowController* mwc)
- : mwc_(mwc) {}
- ~ModalWindowControllerTestApi() {}
-
- ServerWindow* GetActiveSystemModalWindow() const {
- return mwc_->GetActiveSystemModalWindow();
- }
-
- private:
- ModalWindowController* mwc_;
-
- DISALLOW_COPY_AND_ASSIGN(ModalWindowControllerTestApi);
-};
-
-// -----------------------------------------------------------------------------
-
-class WindowManagerStateTestApi {
- public:
- explicit WindowManagerStateTestApi(WindowManagerState* wms) : wms_(wms) {}
- ~WindowManagerStateTestApi() {}
-
- void DispatchInputEventToWindow(ServerWindow* target,
- ClientSpecificId client_id,
- const ui::Event& event,
- Accelerator* accelerator) {
- wms_->DispatchInputEventToWindow(target, client_id, event, accelerator);
- }
-
- ClientSpecificId GetEventTargetClientId(ServerWindow* window,
- bool in_nonclient_area) {
- return wms_->GetEventTargetClientId(window, in_nonclient_area);
- }
-
- void ProcessEvent(const ui::Event& event) { wms_->ProcessEvent(event); }
-
- void OnEventAckTimeout(ClientSpecificId client_id) {
- wms_->OnEventAckTimeout(client_id);
- }
-
- ClientSpecificId GetEventTargetClientId(const ServerWindow* window,
- bool in_nonclient_area) {
- return wms_->GetEventTargetClientId(window, in_nonclient_area);
- }
-
- mojom::WindowTree* tree_awaiting_input_ack() {
- return wms_->tree_awaiting_input_ack_;
- }
-
- private:
- WindowManagerState* wms_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowManagerStateTestApi);
-};
-
-// -----------------------------------------------------------------------------
-
-// Factory that always embeds the new WindowTree as the root user id.
-class TestDisplayBinding : public DisplayBinding {
- public:
- explicit TestDisplayBinding(WindowServer* window_server)
- : window_server_(window_server) {}
- ~TestDisplayBinding() override {}
-
- private:
- // DisplayBinding:
- WindowTree* CreateWindowTree(ServerWindow* root) override;
-
- WindowServer* window_server_;
-
- DISALLOW_COPY_AND_ASSIGN(TestDisplayBinding);
-};
-
-// -----------------------------------------------------------------------------
-
-// Factory that dispenses TestPlatformDisplays.
-class TestPlatformDisplayFactory : public PlatformDisplayFactory {
- public:
- explicit TestPlatformDisplayFactory(int32_t* cursor_id_storage);
- ~TestPlatformDisplayFactory();
-
- // PlatformDisplayFactory:
- PlatformDisplay* CreatePlatformDisplay() override;
-
- private:
- int32_t* cursor_id_storage_;
-
- DISALLOW_COPY_AND_ASSIGN(TestPlatformDisplayFactory);
-};
-
-// -----------------------------------------------------------------------------
-
-class TestWindowManager : public mojom::WindowManager {
- public:
- TestWindowManager()
- : got_create_top_level_window_(false),
- change_id_(0u),
- on_accelerator_called_(false),
- on_accelerator_id_(0u) {}
- ~TestWindowManager() override {}
-
- bool did_call_create_top_level_window(uint32_t* change_id) {
- if (!got_create_top_level_window_)
- return false;
-
- got_create_top_level_window_ = false;
- *change_id = change_id_;
- return true;
- }
-
- bool on_accelerator_called() { return on_accelerator_called_; }
- uint32_t on_accelerator_id() { return on_accelerator_id_; }
-
- private:
- // WindowManager:
- void OnConnect(uint16_t client_id) override {}
- void WmNewDisplayAdded(mus::mojom::DisplayPtr display,
- mus::mojom::WindowDataPtr root,
- bool drawn) override {}
- void WmSetBounds(uint32_t change_id,
- uint32_t window_id,
- const gfx::Rect& bounds) override {}
- void WmSetProperty(uint32_t change_id,
- uint32_t window_id,
- const mojo::String& name,
- mojo::Array<uint8_t> value) override {}
- void WmCreateTopLevelWindow(
- uint32_t change_id,
- ClientSpecificId requesting_client_id,
- mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) override;
- void WmClientJankinessChanged(ClientSpecificId client_id,
- bool janky) override;
- void OnAccelerator(uint32_t id, std::unique_ptr<ui::Event> event) override;
-
- bool got_create_top_level_window_;
- uint32_t change_id_;
-
- bool on_accelerator_called_;
- uint32_t on_accelerator_id_;
-
- DISALLOW_COPY_AND_ASSIGN(TestWindowManager);
-};
-
-// -----------------------------------------------------------------------------
-
-// WindowTreeClient implementation that logs all calls to a TestChangeTracker.
-class TestWindowTreeClient : public mus::mojom::WindowTreeClient {
- public:
- TestWindowTreeClient();
- ~TestWindowTreeClient() override;
-
- TestChangeTracker* tracker() { return &tracker_; }
-
- void Bind(mojo::InterfaceRequest<mojom::WindowTreeClient> request);
-
- void set_record_on_change_completed(bool value) {
- record_on_change_completed_ = value;
- }
-
- private:
- // WindowTreeClient:
- void OnEmbed(uint16_t client_id,
- mojom::WindowDataPtr root,
- mus::mojom::WindowTreePtr tree,
- int64_t display_id,
- Id focused_window_id,
- bool drawn) override;
- void OnEmbeddedAppDisconnected(uint32_t window) override;
- void OnUnembed(Id window_id) override;
- void OnLostCapture(Id window_id) override;
- void OnTopLevelCreated(uint32_t change_id,
- mojom::WindowDataPtr data,
- int64_t display_id,
- bool drawn) override;
- void OnWindowBoundsChanged(uint32_t window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) override;
- void OnClientAreaChanged(
- uint32_t window_id,
- const gfx::Insets& new_client_area,
- mojo::Array<gfx::Rect> new_additional_client_areas) override;
- void OnTransientWindowAdded(uint32_t window_id,
- uint32_t transient_window_id) override;
- void OnTransientWindowRemoved(uint32_t window_id,
- uint32_t transient_window_id) override;
- void OnWindowHierarchyChanged(
- uint32_t window,
- uint32_t old_parent,
- uint32_t new_parent,
- mojo::Array<mojom::WindowDataPtr> windows) override;
- void OnWindowReordered(uint32_t window_id,
- uint32_t relative_window_id,
- mojom::OrderDirection direction) override;
- void OnWindowDeleted(uint32_t window) override;
- void OnWindowVisibilityChanged(uint32_t window, bool visible) override;
- void OnWindowOpacityChanged(uint32_t window,
- float old_opacity,
- float new_opacity) override;
- void OnWindowParentDrawnStateChanged(uint32_t window, bool drawn) override;
- void OnWindowSharedPropertyChanged(uint32_t window,
- const mojo::String& name,
- mojo::Array<uint8_t> new_data) override;
- void OnWindowInputEvent(uint32_t event_id,
- uint32_t window,
- std::unique_ptr<ui::Event> event,
- uint32_t event_observer_id) override;
- void OnEventObserved(std::unique_ptr<ui::Event> event,
- uint32_t event_observer_id) override;
- void OnWindowFocused(uint32_t focused_window_id) override;
- void OnWindowPredefinedCursorChanged(uint32_t window_id,
- mojom::Cursor cursor_id) override;
- void OnChangeCompleted(uint32_t change_id, bool success) override;
- void RequestClose(uint32_t window_id) override;
- void GetWindowManager(
- mojo::AssociatedInterfaceRequest<mojom::WindowManager> internal) override;
-
- TestChangeTracker tracker_;
- mojo::Binding<mojom::WindowTreeClient> binding_;
- bool record_on_change_completed_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClient);
-};
-
-// -----------------------------------------------------------------------------
-
-// WindowTreeBinding implementation that vends TestWindowTreeBinding.
-class TestWindowTreeBinding : public WindowTreeBinding {
- public:
- explicit TestWindowTreeBinding(WindowTree* tree);
- ~TestWindowTreeBinding() override;
-
- WindowTree* tree() { return tree_; }
- TestWindowTreeClient* client() { return &client_; }
-
- bool is_paused() const { return is_paused_; }
-
- // WindowTreeBinding:
- mojom::WindowManager* GetWindowManager() override;
- void SetIncomingMethodCallProcessingPaused(bool paused) override;
-
- private:
- WindowTree* tree_;
- TestWindowTreeClient client_;
- bool is_paused_ = false;
- std::unique_ptr<TestWindowManager> window_manager_;
-
- DISALLOW_COPY_AND_ASSIGN(TestWindowTreeBinding);
-};
-
-// -----------------------------------------------------------------------------
-
-// WindowServerDelegate that creates TestWindowTreeClients.
-class TestWindowServerDelegate : public WindowServerDelegate {
- public:
- TestWindowServerDelegate();
- ~TestWindowServerDelegate() override;
-
- void set_window_server(WindowServer* window_server) {
- window_server_ = window_server;
- }
-
- void set_num_displays_to_create(int count) {
- num_displays_to_create_ = count;
- }
-
- TestWindowTreeClient* last_client() {
- return last_binding() ? last_binding()->client() : nullptr;
- }
- TestWindowTreeBinding* last_binding() {
- return bindings_.empty() ? nullptr : bindings_.back();
- }
-
- std::vector<TestWindowTreeBinding*>* bindings() { return &bindings_; }
-
- bool got_on_no_more_displays() const { return got_on_no_more_displays_; }
-
- Display* AddDisplay();
-
- // WindowServerDelegate:
- void OnNoMoreDisplays() override;
- std::unique_ptr<WindowTreeBinding> CreateWindowTreeBinding(
- BindingType type,
- ws::WindowServer* window_server,
- ws::WindowTree* tree,
- mojom::WindowTreeRequest* tree_request,
- mojom::WindowTreeClientPtr* client) override;
- void CreateDefaultDisplays() override;
- bool IsTestConfig() const override;
-
- private:
- // If CreateDefaultDisplays() this is the number of Displays that are
- // created. The default is 0, which results in a DCHECK.
- int num_displays_to_create_ = 0;
- WindowServer* window_server_ = nullptr;
- bool got_on_no_more_displays_ = false;
- // All TestWindowTreeBinding objects created via CreateWindowTreeBinding.
- // These are owned by the corresponding WindowTree.
- std::vector<TestWindowTreeBinding*> bindings_;
-
- DISALLOW_COPY_AND_ASSIGN(TestWindowServerDelegate);
-};
-
-// -----------------------------------------------------------------------------
-
-// Helper class which owns all of the necessary objects to test event targeting
-// of ServerWindow objects.
-class WindowEventTargetingHelper {
- public:
- WindowEventTargetingHelper();
- ~WindowEventTargetingHelper();
-
- // Creates |window| as an embeded window of the primary tree. This window is a
- // root window of its own tree, with bounds |window_bounds|. The bounds of the
- // root window of |display_| are defined by |root_window_bounds|.
- ServerWindow* CreatePrimaryTree(const gfx::Rect& root_window_bounds,
- const gfx::Rect& window_bounds);
- // Creates a secondary tree, embedded as a child of |embed_window|. The
- // resulting |window| is setup for event targeting, with bounds
- // |window_bounds|.
- void CreateSecondaryTree(ServerWindow* embed_window,
- const gfx::Rect& window_bounds,
- TestWindowTreeClient** out_client,
- WindowTree** window_tree,
- ServerWindow** window);
- // Sets the task runner for |message_loop_|
- void SetTaskRunner(scoped_refptr<base::SingleThreadTaskRunner> task_runner);
-
- int32_t cursor_id() { return cursor_id_; }
- Display* display() { return display_; }
- TestWindowTreeBinding* last_binding() {
- return window_server_delegate_.last_binding();
- }
- TestWindowTreeClient* last_window_tree_client() {
- return window_server_delegate_.last_client();
- }
- TestWindowTreeClient* wm_client() { return wm_client_; }
- WindowServer* window_server() { return window_server_.get(); }
-
- private:
- // TestWindowTreeClient that is used for the WM client. Owned by
- // |window_server_delegate_|
- TestWindowTreeClient* wm_client_;
- int32_t cursor_id_;
- TestPlatformDisplayFactory platform_display_factory_;
- TestWindowServerDelegate window_server_delegate_;
- // Owned by WindowServer
- TestDisplayBinding* display_binding_;
- // Owned by WindowServer's DisplayManager.
- Display* display_;
- scoped_refptr<SurfacesState> surfaces_state_;
- std::unique_ptr<WindowServer> window_server_;
- // Needed to Bind to |wm_client_|
- base::MessageLoop message_loop_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowEventTargetingHelper);
-};
-
-// -----------------------------------------------------------------------------
-
-// Returns the first and only root of |tree|. If |tree| has zero or more than
-// one root returns null.
-ServerWindow* FirstRoot(WindowTree* tree);
-
-// Returns the ClientWindowId of the first root of |tree|, or an empty
-// ClientWindowId if |tree| has zero or more than one root.
-ClientWindowId FirstRootId(WindowTree* tree);
-
-// Returns |tree|s ClientWindowId for |window|.
-ClientWindowId ClientWindowIdForWindow(WindowTree* tree,
- const ServerWindow* window);
-
-// Creates a new visible window as a child of the single root of |tree|.
-// |client_id| set to the ClientWindowId of the new window.
-ServerWindow* NewWindowInTree(WindowTree* tree, ClientWindowId* client_id);
-ServerWindow* NewWindowInTreeWithParent(WindowTree* tree,
- ServerWindow* parent,
- ClientWindowId* client_id);
-
-} // namespace test
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_TEST_UTILS_H_
diff --git a/chromium/components/mus/ws/touch_controller.cc b/chromium/components/mus/ws/touch_controller.cc
deleted file mode 100644
index e78b3489dc9..00000000000
--- a/chromium/components/mus/ws/touch_controller.cc
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/touch_controller.h"
-
-#include <set>
-#include <vector>
-
-#include "base/logging.h"
-#include "components/mus/ws/display.h"
-#include "components/mus/ws/display_manager.h"
-#include "ui/events/devices/device_data_manager.h"
-#include "ui/events/devices/touchscreen_device.h"
-#include "ui/gfx/geometry/size.h"
-#include "ui/gfx/transform.h"
-
-namespace mus {
-namespace ws {
-
-namespace {
-
-// Computes the scale ratio for the TouchEvent's radius.
-double ComputeTouchResolutionScale(const Display* touch_display,
- const ui::TouchscreenDevice& touch_device) {
- gfx::Size touch_display_size = touch_display->GetSize();
-
- if (touch_device.size.IsEmpty() || touch_display_size.IsEmpty())
- return 1.0;
-
- double display_area = touch_display_size.GetArea();
- double touch_area = touch_device.size.GetArea();
- double ratio = std::sqrt(display_area / touch_area);
-
- return ratio;
-}
-
-// Computes a touch transform that maps from window bounds to touchscreen size.
-// Assumes scale factor of 1.0.
-gfx::Transform ComputeTouchTransform(
- const Display* touch_display,
- const ui::TouchscreenDevice& touch_device) {
- gfx::Size touch_display_size = touch_display->GetSize();
-
- gfx::SizeF current_size(touch_display_size);
- gfx::SizeF touch_area(touch_device.size);
- gfx::Transform transform;
-
- if (current_size.IsEmpty() || touch_area.IsEmpty())
- return transform;
-
- // Take care of scaling between touchscreen area and display resolution.
- transform.Scale(current_size.width() / touch_area.width(),
- current_size.height() / touch_area.height());
- return transform;
-}
-
-} // namespace
-
-TouchController::TouchController(DisplayManager* display_manager)
- : display_manager_(display_manager) {
- DCHECK(display_manager_);
- ui::DeviceDataManager::GetInstance()->AddObserver(this);
-}
-
-TouchController::~TouchController() {
- ui::DeviceDataManager::GetInstance()->RemoveObserver(this);
-}
-
-void TouchController::UpdateTouchTransforms() const {
- ui::DeviceDataManager* device_manager = ui::DeviceDataManager::GetInstance();
- device_manager->ClearTouchDeviceAssociations();
-
- const std::set<Display*>& touch_displays = display_manager_->displays();
- const std::vector<ui::TouchscreenDevice>& touch_devices =
- device_manager->GetTouchscreenDevices();
-
- // Mash can only handle a single display so this doesn't implement support for
- // matching touchscreens with multiple displays.
- // TODO(kylechar): Implement support for multiple displays when needed.
- if (touch_displays.size() == 1 && touch_devices.size() == 1) {
- const Display* touch_display = *touch_displays.begin();
- const ui::TouchscreenDevice& touch_device = touch_devices[0];
-
- int64_t touch_display_id = touch_display->GetPlatformDisplayId();
- int touch_device_id = touch_device.id;
-
- if (touch_device_id != ui::InputDevice::kInvalidId) {
- device_manager->UpdateTouchRadiusScale(
- touch_device_id,
- ComputeTouchResolutionScale(touch_display, touch_device));
-
- device_manager->UpdateTouchInfoForDisplay(
- touch_display_id, touch_device_id,
- ComputeTouchTransform(touch_display, touch_device));
- }
- }
-}
-
-void TouchController::OnTouchscreenDeviceConfigurationChanged() {
- UpdateTouchTransforms();
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/touch_controller.h b/chromium/components/mus/ws/touch_controller.h
deleted file mode 100644
index 4505ce47164..00000000000
--- a/chromium/components/mus/ws/touch_controller.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_TOUCH_CONTROLLER_H_
-#define COMPONENTS_MUS_WS_TOUCH_CONTROLLER_H_
-
-#include "base/macros.h"
-#include "ui/events/devices/input_device_event_observer.h"
-
-namespace mus {
-namespace ws {
-
-class DisplayManager;
-
-// Tracks changes to displays and touchscreen devices. Updates the mapping
-// between display devices and touchscreen devices when changes occur.
-class TouchController : public ui::InputDeviceEventObserver {
- public:
- explicit TouchController(DisplayManager* display_manager);
- ~TouchController() override;
-
- void UpdateTouchTransforms() const;
-
- // ui::InputDeviceEventObserver:
- void OnTouchscreenDeviceConfigurationChanged() override;
-
- private:
- DisplayManager* display_manager_;
-
- DISALLOW_COPY_AND_ASSIGN(TouchController);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_TOUCH_CONTROLLER_H_
diff --git a/chromium/components/mus/ws/transient_windows_unittest.cc b/chromium/components/mus/ws/transient_windows_unittest.cc
deleted file mode 100644
index b20e40e467f..00000000000
--- a/chromium/components/mus/ws/transient_windows_unittest.cc
+++ /dev/null
@@ -1,342 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/macros.h"
-#include "base/strings/string_number_conversions.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_observer.h"
-#include "components/mus/ws/test_server_window_delegate.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace mus {
-namespace ws {
-
-namespace {
-
-class TestTransientWindowObserver : public ServerWindowObserver {
- public:
- TestTransientWindowObserver() : add_count_(0), remove_count_(0) {}
-
- ~TestTransientWindowObserver() override {}
-
- int add_count() const { return add_count_; }
- int remove_count() const { return remove_count_; }
-
- // TransientWindowObserver overrides:
- void OnTransientWindowAdded(ServerWindow* window,
- ServerWindow* transient) override {
- add_count_++;
- }
- void OnTransientWindowRemoved(ServerWindow* window,
- ServerWindow* transient) override {
- remove_count_++;
- }
-
- private:
- int add_count_;
- int remove_count_;
-
- DISALLOW_COPY_AND_ASSIGN(TestTransientWindowObserver);
-};
-
-ServerWindow* CreateTestWindow(TestServerWindowDelegate* delegate,
- const WindowId& window_id,
- ServerWindow* parent) {
- ServerWindow* window = new ServerWindow(delegate, window_id);
- window->SetVisible(true);
- if (parent)
- parent->Add(window);
- else
- delegate->set_root_window(window);
- return window;
-}
-
-std::string ChildWindowIDsAsString(ServerWindow* parent) {
- std::string result;
- for (auto i = parent->children().begin(); i != parent->children().end();
- ++i) {
- if (!result.empty())
- result += " ";
- result += base::IntToString(WindowIdToTransportId((*i)->id()));
- }
- return result;
-}
-
-} // namespace
-
-class TransientWindowsTest : public testing::Test {
- public:
- TransientWindowsTest() {}
- ~TransientWindowsTest() override {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TransientWindowsTest);
-};
-
-TEST_F(TransientWindowsTest, TransientChildren) {
- TestServerWindowDelegate server_window_delegate;
-
- std::unique_ptr<ServerWindow> parent(
- CreateTestWindow(&server_window_delegate, WindowId(), nullptr));
- std::unique_ptr<ServerWindow> w1(
- CreateTestWindow(&server_window_delegate, WindowId(1, 1), parent.get()));
- std::unique_ptr<ServerWindow> w3(
- CreateTestWindow(&server_window_delegate, WindowId(1, 2), parent.get()));
-
- ServerWindow* w2 =
- CreateTestWindow(&server_window_delegate, WindowId(1, 3), parent.get());
-
- // w2 is now owned by w1.
- w1->AddTransientWindow(w2);
- // Stack w1 at the top (end), this should force w2 to be last (on top of w1).
- parent->StackChildAtTop(w1.get());
- ASSERT_EQ(3u, parent->children().size());
- EXPECT_EQ(w2, parent->children().back());
-
- // Destroy w1, which should also destroy w3 (since it's a transient child).
- w1.reset();
- w2 = nullptr;
- ASSERT_EQ(1u, parent->children().size());
- EXPECT_EQ(w3.get(), parent->children()[0]);
-}
-
-// Tests that transient children are stacked as a unit when using stack above.
-TEST_F(TransientWindowsTest, TransientChildrenGroupAbove) {
- TestServerWindowDelegate server_window_delegate;
-
- std::unique_ptr<ServerWindow> parent(
- CreateTestWindow(&server_window_delegate, WindowId(), nullptr));
- std::unique_ptr<ServerWindow> w1(
- CreateTestWindow(&server_window_delegate, WindowId(0, 1), parent.get()));
-
- ServerWindow* w11 =
- CreateTestWindow(&server_window_delegate, WindowId(0, 11), parent.get());
- std::unique_ptr<ServerWindow> w2(
- CreateTestWindow(&server_window_delegate, WindowId(0, 2), parent.get()));
-
- ServerWindow* w21 =
- CreateTestWindow(&server_window_delegate, WindowId(0, 21), parent.get());
- ServerWindow* w211 =
- CreateTestWindow(&server_window_delegate, WindowId(0, 211), parent.get());
- ServerWindow* w212 =
- CreateTestWindow(&server_window_delegate, WindowId(0, 212), parent.get());
- ServerWindow* w213 =
- CreateTestWindow(&server_window_delegate, WindowId(0, 213), parent.get());
- ServerWindow* w22 =
- CreateTestWindow(&server_window_delegate, WindowId(0, 22), parent.get());
- ASSERT_EQ(8u, parent->children().size());
-
- // w11 is now owned by w1.
- w1->AddTransientWindow(w11);
- // w21 is now owned by w2.
- w2->AddTransientWindow(w21);
- // w22 is now owned by w2.
- w2->AddTransientWindow(w22);
- // w211 is now owned by w21.
- w21->AddTransientWindow(w211);
- // w212 is now owned by w21.
- w21->AddTransientWindow(w212);
- // w213 is now owned by w21.
- w21->AddTransientWindow(w213);
- EXPECT_EQ("1 11 2 21 211 212 213 22", ChildWindowIDsAsString(parent.get()));
-
- // Stack w1 at the top (end), this should force w11 to be last (on top of w1).
- parent->StackChildAtTop(w1.get());
- EXPECT_EQ(w11, parent->children().back());
- EXPECT_EQ("2 21 211 212 213 22 1 11", ChildWindowIDsAsString(parent.get()));
-
- // This tests that the order in children_ array rather than in
- // transient_children_ array is used when reinserting transient children.
- // If transient_children_ array was used '22' would be following '21'.
- parent->StackChildAtTop(w2.get());
- EXPECT_EQ(w22, parent->children().back());
- EXPECT_EQ("1 11 2 21 211 212 213 22", ChildWindowIDsAsString(parent.get()));
-
- w11->Reorder(w2.get(), mojom::OrderDirection::ABOVE);
- EXPECT_EQ(w11, parent->children().back());
- EXPECT_EQ("2 21 211 212 213 22 1 11", ChildWindowIDsAsString(parent.get()));
-
- w21->Reorder(w1.get(), mojom::OrderDirection::ABOVE);
- EXPECT_EQ(w22, parent->children().back());
- EXPECT_EQ("1 11 2 21 211 212 213 22", ChildWindowIDsAsString(parent.get()));
-
- w21->Reorder(w22, mojom::OrderDirection::ABOVE);
- EXPECT_EQ(w213, parent->children().back());
- EXPECT_EQ("1 11 2 22 21 211 212 213", ChildWindowIDsAsString(parent.get()));
-
- w11->Reorder(w21, mojom::OrderDirection::ABOVE);
- EXPECT_EQ(w11, parent->children().back());
- EXPECT_EQ("2 22 21 211 212 213 1 11", ChildWindowIDsAsString(parent.get()));
-
- w213->Reorder(w21, mojom::OrderDirection::ABOVE);
- EXPECT_EQ(w11, parent->children().back());
- EXPECT_EQ("2 22 21 213 211 212 1 11", ChildWindowIDsAsString(parent.get()));
-
- // No change when stacking a transient parent above its transient child.
- w21->Reorder(w211, mojom::OrderDirection::ABOVE);
- EXPECT_EQ(w11, parent->children().back());
- EXPECT_EQ("2 22 21 213 211 212 1 11", ChildWindowIDsAsString(parent.get()));
-
- // This tests that the order in children_ array rather than in
- // transient_children_ array is used when reinserting transient children.
- // If transient_children_ array was used '22' would be following '21'.
- w2->Reorder(w1.get(), mojom::OrderDirection::ABOVE);
- EXPECT_EQ(w212, parent->children().back());
- EXPECT_EQ("1 11 2 22 21 213 211 212", ChildWindowIDsAsString(parent.get()));
-
- w11->Reorder(w213, mojom::OrderDirection::ABOVE);
- EXPECT_EQ(w11, parent->children().back());
- EXPECT_EQ("2 22 21 213 211 212 1 11", ChildWindowIDsAsString(parent.get()));
-}
-
-TEST_F(TransientWindowsTest, TransienChildGroupBelow) {
- TestServerWindowDelegate server_window_delegate;
-
- std::unique_ptr<ServerWindow> parent(
- CreateTestWindow(&server_window_delegate, WindowId(), nullptr));
- std::unique_ptr<ServerWindow> w1(
- CreateTestWindow(&server_window_delegate, WindowId(0, 1), parent.get()));
-
- ServerWindow* w11 =
- CreateTestWindow(&server_window_delegate, WindowId(0, 11), parent.get());
- std::unique_ptr<ServerWindow> w2(
- CreateTestWindow(&server_window_delegate, WindowId(0, 2), parent.get()));
-
- ServerWindow* w21 =
- CreateTestWindow(&server_window_delegate, WindowId(0, 21), parent.get());
- ServerWindow* w211 =
- CreateTestWindow(&server_window_delegate, WindowId(0, 211), parent.get());
- ServerWindow* w212 =
- CreateTestWindow(&server_window_delegate, WindowId(0, 212), parent.get());
- ServerWindow* w213 =
- CreateTestWindow(&server_window_delegate, WindowId(0, 213), parent.get());
- ServerWindow* w22 =
- CreateTestWindow(&server_window_delegate, WindowId(0, 22), parent.get());
- ASSERT_EQ(8u, parent->children().size());
-
- // w11 is now owned by w1.
- w1->AddTransientWindow(w11);
- // w21 is now owned by w2.
- w2->AddTransientWindow(w21);
- // w22 is now owned by w2.
- w2->AddTransientWindow(w22);
- // w211 is now owned by w21.
- w21->AddTransientWindow(w211);
- // w212 is now owned by w21.
- w21->AddTransientWindow(w212);
- // w213 is now owned by w21.
- w21->AddTransientWindow(w213);
- EXPECT_EQ("1 11 2 21 211 212 213 22", ChildWindowIDsAsString(parent.get()));
-
- // Stack w2 at the bottom, this should force w11 to be last (on top of w1).
- // This also tests that the order in children_ array rather than in
- // transient_children_ array is used when reinserting transient children.
- // If transient_children_ array was used '22' would be following '21'.
- parent->StackChildAtBottom(w2.get());
- EXPECT_EQ(w11, parent->children().back());
- EXPECT_EQ("2 21 211 212 213 22 1 11", ChildWindowIDsAsString(parent.get()));
-
- parent->StackChildAtBottom(w1.get());
- EXPECT_EQ(w22, parent->children().back());
- EXPECT_EQ("1 11 2 21 211 212 213 22", ChildWindowIDsAsString(parent.get()));
-
- w21->Reorder(w1.get(), mojom::OrderDirection::BELOW);
- EXPECT_EQ(w11, parent->children().back());
- EXPECT_EQ("2 21 211 212 213 22 1 11", ChildWindowIDsAsString(parent.get()));
-
- w11->Reorder(w2.get(), mojom::OrderDirection::BELOW);
- EXPECT_EQ(w22, parent->children().back());
- EXPECT_EQ("1 11 2 21 211 212 213 22", ChildWindowIDsAsString(parent.get()));
-
- w22->Reorder(w21, mojom::OrderDirection::BELOW);
- EXPECT_EQ(w213, parent->children().back());
- EXPECT_EQ("1 11 2 22 21 211 212 213", ChildWindowIDsAsString(parent.get()));
-
- w21->Reorder(w11, mojom::OrderDirection::BELOW);
- EXPECT_EQ(w11, parent->children().back());
- EXPECT_EQ("2 22 21 211 212 213 1 11", ChildWindowIDsAsString(parent.get()));
-
- w213->Reorder(w211, mojom::OrderDirection::BELOW);
- EXPECT_EQ(w11, parent->children().back());
- EXPECT_EQ("2 22 21 213 211 212 1 11", ChildWindowIDsAsString(parent.get()));
-
- // No change when stacking a transient parent below its transient child.
- w21->Reorder(w211, mojom::OrderDirection::BELOW);
- EXPECT_EQ(w11, parent->children().back());
- EXPECT_EQ("2 22 21 213 211 212 1 11", ChildWindowIDsAsString(parent.get()));
-
- w1->Reorder(w2.get(), mojom::OrderDirection::BELOW);
- EXPECT_EQ(w212, parent->children().back());
- EXPECT_EQ("1 11 2 22 21 213 211 212", ChildWindowIDsAsString(parent.get()));
-
- w213->Reorder(w11, mojom::OrderDirection::BELOW);
- EXPECT_EQ(w11, parent->children().back());
- EXPECT_EQ("2 22 21 213 211 212 1 11", ChildWindowIDsAsString(parent.get()));
-}
-
-// Tests that transient windows are stacked properly when created.
-TEST_F(TransientWindowsTest, StackUponCreation) {
- TestServerWindowDelegate delegate;
- std::unique_ptr<ServerWindow> parent(
- CreateTestWindow(&delegate, WindowId(), nullptr));
- std::unique_ptr<ServerWindow> window0(
- CreateTestWindow(&delegate, WindowId(0, 1), parent.get()));
- std::unique_ptr<ServerWindow> window1(
- CreateTestWindow(&delegate, WindowId(0, 2), parent.get()));
-
- ServerWindow* window2 =
- CreateTestWindow(&delegate, WindowId(0, 3), parent.get());
- window0->AddTransientWindow(window2);
- EXPECT_EQ("1 3 2", ChildWindowIDsAsString(parent.get()));
-}
-
-// Tests that windows are restacked properly after a call to
-// AddTransientWindow() or RemoveTransientWindow().
-TEST_F(TransientWindowsTest, RestackUponAddOrRemoveTransientWindow) {
- TestServerWindowDelegate delegate;
- std::unique_ptr<ServerWindow> parent(
- CreateTestWindow(&delegate, WindowId(), nullptr));
- std::unique_ptr<ServerWindow> windows[4];
- for (int i = 0; i < 4; i++)
- windows[i].reset(CreateTestWindow(&delegate, WindowId(0, i), parent.get()));
-
- EXPECT_EQ("0 1 2 3", ChildWindowIDsAsString(parent.get()));
-
- windows[0]->AddTransientWindow(windows[2].get());
- EXPECT_EQ("0 2 1 3", ChildWindowIDsAsString(parent.get()));
-
- windows[0]->AddTransientWindow(windows[3].get());
- EXPECT_EQ("0 2 3 1", ChildWindowIDsAsString(parent.get()));
-
- windows[0]->RemoveTransientWindow(windows[2].get());
- EXPECT_EQ("0 3 2 1", ChildWindowIDsAsString(parent.get()));
-
- windows[0]->RemoveTransientWindow(windows[3].get());
- EXPECT_EQ("0 3 2 1", ChildWindowIDsAsString(parent.get()));
-}
-
-// Verifies TransientWindowObserver is notified appropriately.
-TEST_F(TransientWindowsTest, TransientWindowObserverNotified) {
- TestServerWindowDelegate delegate;
- std::unique_ptr<ServerWindow> parent(
- CreateTestWindow(&delegate, WindowId(), nullptr));
- std::unique_ptr<ServerWindow> w1(
- CreateTestWindow(&delegate, WindowId(0, 1), parent.get()));
-
- TestTransientWindowObserver test_observer;
- parent->AddObserver(&test_observer);
-
- parent->AddTransientWindow(w1.get());
- EXPECT_EQ(1, test_observer.add_count());
- EXPECT_EQ(0, test_observer.remove_count());
-
- parent->RemoveTransientWindow(w1.get());
- EXPECT_EQ(1, test_observer.add_count());
- EXPECT_EQ(1, test_observer.remove_count());
-
- parent->RemoveObserver(&test_observer);
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/user_activity_monitor.cc b/chromium/components/mus/ws/user_activity_monitor.cc
deleted file mode 100644
index 3cd66419a27..00000000000
--- a/chromium/components/mus/ws/user_activity_monitor.cc
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/user_activity_monitor.h"
-
-#include "base/bind.h"
-#include "base/time/default_tick_clock.h"
-
-namespace mus {
-namespace ws {
-
-UserActivityMonitor::UserActivityMonitor(std::unique_ptr<base::TickClock> clock)
- : now_clock_(std::move(clock)) {
- if (!now_clock_)
- now_clock_ = base::WrapUnique(new base::DefaultTickClock);
- last_activity_ = now_clock_->NowTicks();
-}
-
-UserActivityMonitor::~UserActivityMonitor() {}
-
-void UserActivityMonitor::OnUserActivity() {
- base::TimeTicks now = now_clock_->NowTicks();
- for (auto& pair : activity_observers_) {
- ActivityObserverInfo* info = &(pair.first);
- if (info->last_activity_notification.is_null() ||
- (now - info->last_activity_notification) > info->delay) {
- pair.second->OnUserActivity();
- info->last_activity_notification = now;
- }
- }
-
- // Wake up all the 'idle' observers.
- for (auto& pair : idle_observers_) {
- IdleObserverInfo* info = &(pair.first);
- if (info->idle_state == mojom::UserIdleObserver::IdleState::ACTIVE)
- continue;
- info->last_idle_state_notification = now;
- info->idle_state = mojom::UserIdleObserver::IdleState::ACTIVE;
- pair.second->OnUserIdleStateChanged(info->idle_state);
- }
-
- last_activity_ = now;
-
- // Start the timer if there are some idle observers.
- if (idle_timer_.IsRunning())
- idle_timer_.Reset();
-}
-
-void UserActivityMonitor::Add(mojom::UserActivityMonitorRequest request) {
- bindings_.AddBinding(this, std::move(request));
-}
-
-void UserActivityMonitor::AddUserActivityObserver(
- uint32_t delay_between_notify_secs,
- mojom::UserActivityObserverPtr observer) {
- ActivityObserverInfo info;
- info.delay = base::TimeDelta::FromSeconds(delay_between_notify_secs);
- observer.set_connection_error_handler(
- base::Bind(&UserActivityMonitor::OnActivityObserverDisconnected,
- base::Unretained(this), observer.get()));
- activity_observers_.push_back(std::make_pair(info, std::move(observer)));
-}
-
-void UserActivityMonitor::AddUserIdleObserver(
- uint32_t idleness_in_minutes,
- mojom::UserIdleObserverPtr observer) {
- IdleObserverInfo info;
- info.idle_duration = base::TimeDelta::FromMinutes(idleness_in_minutes);
- base::TimeTicks now = now_clock_->NowTicks();
- DCHECK(!last_activity_.is_null());
- bool user_is_active = (now - last_activity_ < info.idle_duration);
- info.idle_state = user_is_active ? mojom::UserIdleObserver::IdleState::ACTIVE
- : mojom::UserIdleObserver::IdleState::IDLE;
- info.last_idle_state_notification = now;
- observer->OnUserIdleStateChanged(info.idle_state);
- observer.set_connection_error_handler(
- base::Bind(&UserActivityMonitor::OnIdleObserverDisconnected,
- base::Unretained(this), observer.get()));
- idle_observers_.push_back(std::make_pair(info, std::move(observer)));
- if (user_is_active)
- ActivateIdleTimer();
-}
-
-void UserActivityMonitor::ActivateIdleTimer() {
- if (idle_timer_.IsRunning())
- return;
- idle_timer_.Start(FROM_HERE, base::TimeDelta::FromMinutes(1), this,
- &UserActivityMonitor::OnMinuteTimer);
-}
-
-void UserActivityMonitor::OnMinuteTimer() {
- base::TimeTicks now = now_clock_->NowTicks();
- bool active_observer = false;
- for (auto& pair : idle_observers_) {
- IdleObserverInfo* info = &(pair.first);
- if (info->idle_state == mojom::UserIdleObserver::IdleState::IDLE)
- continue;
- if (now - info->last_idle_state_notification < info->idle_duration) {
- active_observer = true;
- continue;
- }
- info->last_idle_state_notification = now;
- info->idle_state = mojom::UserIdleObserver::IdleState::IDLE;
- pair.second->OnUserIdleStateChanged(info->idle_state);
- }
- // All observers are already notified of IDLE. No point running the timer
- // anymore.
- if (!active_observer)
- idle_timer_.Stop();
-}
-
-void UserActivityMonitor::OnActivityObserverDisconnected(
- mojom::UserActivityObserver* observer) {
- activity_observers_.erase(std::remove_if(
- activity_observers_.begin(), activity_observers_.end(),
- [observer](const std::pair<ActivityObserverInfo,
- mojom::UserActivityObserverPtr>& pair) {
- return pair.second.get() == observer;
- }));
-}
-
-void UserActivityMonitor::OnIdleObserverDisconnected(
- mojom::UserIdleObserver* observer) {
- idle_observers_.erase(std::remove_if(
- idle_observers_.begin(), idle_observers_.end(),
- [observer](
- const std::pair<IdleObserverInfo, mojom::UserIdleObserverPtr>& pair) {
- return pair.second.get() == observer;
- }));
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/user_activity_monitor.h b/chromium/components/mus/ws/user_activity_monitor.h
deleted file mode 100644
index f490a6dfdfb..00000000000
--- a/chromium/components/mus/ws/user_activity_monitor.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_USER_ACTIVITY_MONITOR_H_
-#define COMPONENTS_MUS_WS_USER_ACTIVITY_MONITOR_H_
-
-#include "base/time/tick_clock.h"
-#include "base/time/time.h"
-#include "base/timer/timer.h"
-#include "components/mus/public/interfaces/user_activity_monitor.mojom.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
-#include "mojo/public/cpp/bindings/interface_ptr_set.h"
-
-namespace mus {
-namespace ws {
-
-namespace test {
-class UserActivityMonitorTestApi;
-}
-
-class UserActivityMonitor : public mojom::UserActivityMonitor {
- public:
- // |now_clock| is used to get the timestamp. If |now_clock| is nullptr, then
- // DefaultTickClock is used.
- explicit UserActivityMonitor(std::unique_ptr<base::TickClock> now_clock);
- ~UserActivityMonitor() override;
-
- // Should be called whenever some input event is received from the user.
- void OnUserActivity();
-
- // Provides an implementation for the remote request.
- void Add(mojom::UserActivityMonitorRequest request);
-
- // mojom::UserActivityMonitor:
- void AddUserActivityObserver(
- uint32_t delay_between_notify_secs,
- mojom::UserActivityObserverPtr observer) override;
- void AddUserIdleObserver(uint32_t idleness_in_minutes,
- mojom::UserIdleObserverPtr observer) override;
-
- private:
- friend class test::UserActivityMonitorTestApi;
-
- // Makes sure the idle timer is running.
- void ActivateIdleTimer();
-
- // Called every minute when |idle_timer_| is active.
- void OnMinuteTimer();
-
- void OnActivityObserverDisconnected(mojom::UserActivityObserver* observer);
- void OnIdleObserverDisconnected(mojom::UserIdleObserver* observer);
-
- mojo::BindingSet<mojom::UserActivityMonitor> bindings_;
- std::unique_ptr<base::TickClock> now_clock_;
-
- struct ActivityObserverInfo {
- base::TimeTicks last_activity_notification;
- base::TimeDelta delay;
- };
- std::vector<std::pair<ActivityObserverInfo, mojom::UserActivityObserverPtr>>
- activity_observers_;
-
- struct IdleObserverInfo {
- base::TimeTicks last_idle_state_notification;
- base::TimeDelta idle_duration;
- mojom::UserIdleObserver::IdleState idle_state;
- };
- std::vector<std::pair<IdleObserverInfo, mojom::UserIdleObserverPtr>>
- idle_observers_;
- // Timer used to determine user's idleness. The timer is run only when at
- // least one of the idle-observers are notified ACTIVE.
- base::RepeatingTimer idle_timer_;
- base::TimeTicks last_activity_;
-
- DISALLOW_COPY_AND_ASSIGN(UserActivityMonitor);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_USER_ACTIVITY_MONITOR_H_
diff --git a/chromium/components/mus/ws/user_activity_monitor_unittest.cc b/chromium/components/mus/ws/user_activity_monitor_unittest.cc
deleted file mode 100644
index 6c26ead8608..00000000000
--- a/chromium/components/mus/ws/user_activity_monitor_unittest.cc
+++ /dev/null
@@ -1,218 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/user_activity_monitor.h"
-
-#include "base/message_loop/message_loop.h"
-#include "base/run_loop.h"
-#include "base/test/simple_test_tick_clock.h"
-#include "base/test/test_mock_time_task_runner.h"
-#include "components/mus/ws/test_utils.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-using mus::mojom::UserIdleObserver;
-
-namespace mus {
-namespace ws {
-namespace test {
-
-class TestUserActivityObserver : public mojom::UserActivityObserver {
- public:
- TestUserActivityObserver() : binding_(this) {}
- ~TestUserActivityObserver() override {}
-
- mojom::UserActivityObserverPtr GetPtr() {
- return binding_.CreateInterfacePtrAndBind();
- }
-
- bool GetAndResetReceivedUserActivity() {
- bool val = received_user_activity_;
- received_user_activity_ = false;
- return val;
- }
-
- private:
- // mojom::UserActivityObserver:
- void OnUserActivity() override { received_user_activity_ = true; }
-
- mojo::Binding<mojom::UserActivityObserver> binding_;
- bool received_user_activity_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(TestUserActivityObserver);
-};
-
-class TestUserIdleObserver : public mojom::UserIdleObserver {
- public:
- TestUserIdleObserver() : binding_(this) {}
- ~TestUserIdleObserver() override {}
-
- mojom::UserIdleObserverPtr GetPtr() {
- return binding_.CreateInterfacePtrAndBind();
- }
-
- bool GetAndResetIdleState(UserIdleObserver::IdleState* state) {
- if (!received_idle_state_)
- return false;
- received_idle_state_ = false;
- *state = idle_state_;
- return true;
- }
-
- private:
- // mojom::UserIdleObserver:
- void OnUserIdleStateChanged(UserIdleObserver::IdleState new_state) override {
- received_idle_state_ = true;
- idle_state_ = new_state;
- }
-
- mojo::Binding<mojom::UserIdleObserver> binding_;
- bool received_idle_state_ = false;
- UserIdleObserver::IdleState idle_state_ = UserIdleObserver::IdleState::ACTIVE;
-
- DISALLOW_COPY_AND_ASSIGN(TestUserIdleObserver);
-};
-
-class UserActivityMonitorTest : public testing::Test {
- public:
- UserActivityMonitorTest() {}
- ~UserActivityMonitorTest() override {}
-
- UserActivityMonitor* monitor() { return monitor_.get(); }
-
- void FastForwardBy(base::TimeDelta delta) {
- task_runner_->FastForwardBy(delta);
- }
- void RunUntilIdle() { task_runner_->RunUntilIdle(); }
-
- private:
- // testing::Test:
- void SetUp() override {
- task_runner_ = make_scoped_refptr(new base::TestMockTimeTaskRunner(
- base::Time::Now(), base::TimeTicks::Now()));
- message_loop_.SetTaskRunner(task_runner_);
- monitor_.reset(new UserActivityMonitor(task_runner_->GetMockTickClock()));
- }
-
- base::MessageLoop message_loop_;
- scoped_refptr<base::TestMockTimeTaskRunner> task_runner_;
- std::unique_ptr<UserActivityMonitor> monitor_;
-
- DISALLOW_COPY_AND_ASSIGN(UserActivityMonitorTest);
-};
-
-TEST_F(UserActivityMonitorTest, UserActivityObserver) {
- TestUserActivityObserver first_observer, second_observer;
- monitor()->AddUserActivityObserver(3, first_observer.GetPtr());
- monitor()->AddUserActivityObserver(4, second_observer.GetPtr());
-
- // The first activity should notify both observers.
- monitor()->OnUserActivity();
- RunUntilIdle();
- EXPECT_TRUE(first_observer.GetAndResetReceivedUserActivity());
- EXPECT_TRUE(second_observer.GetAndResetReceivedUserActivity());
-
- // The next activity after just one second should not notify either observer.
- FastForwardBy(base::TimeDelta::FromSeconds(1));
- monitor()->OnUserActivity();
- RunUntilIdle();
- EXPECT_FALSE(first_observer.GetAndResetReceivedUserActivity());
- EXPECT_FALSE(second_observer.GetAndResetReceivedUserActivity());
-
- FastForwardBy(base::TimeDelta::FromMilliseconds(2001));
- monitor()->OnUserActivity();
- RunUntilIdle();
- EXPECT_TRUE(first_observer.GetAndResetReceivedUserActivity());
- EXPECT_FALSE(second_observer.GetAndResetReceivedUserActivity());
-
- FastForwardBy(base::TimeDelta::FromSeconds(1));
- monitor()->OnUserActivity();
- RunUntilIdle();
- EXPECT_FALSE(first_observer.GetAndResetReceivedUserActivity());
- EXPECT_TRUE(second_observer.GetAndResetReceivedUserActivity());
-}
-
-// Tests that idleness observers receive the correct notification upon
-// connection.
-TEST_F(UserActivityMonitorTest, UserIdleObserverConnectNotification) {
- UserIdleObserver::IdleState idle_state;
-
- // If an observer is added without any user activity, then it still receives
- // an ACTIVE notification immediately.
- TestUserIdleObserver first_observer;
- monitor()->AddUserIdleObserver(1, first_observer.GetPtr());
- RunUntilIdle();
- EXPECT_TRUE(first_observer.GetAndResetIdleState(&idle_state));
- EXPECT_EQ(UserIdleObserver::IdleState::ACTIVE, idle_state);
-
- // If an observer is added without any user activity and the system has been
- // idle, then the observer receives an IDLE notification immediately.
- FastForwardBy(base::TimeDelta::FromMinutes(5));
- TestUserIdleObserver second_observer;
- monitor()->AddUserIdleObserver(4, second_observer.GetPtr());
- RunUntilIdle();
- EXPECT_TRUE(second_observer.GetAndResetIdleState(&idle_state));
- EXPECT_EQ(UserIdleObserver::IdleState::IDLE, idle_state);
- EXPECT_TRUE(first_observer.GetAndResetIdleState(&idle_state));
- EXPECT_EQ(UserIdleObserver::IdleState::IDLE, idle_state);
-
- // If an observer is added after some user activity, then it receives an
- // immediate ACTIVE notification.
- monitor()->OnUserActivity();
- TestUserIdleObserver third_observer;
- monitor()->AddUserIdleObserver(1, third_observer.GetPtr());
- RunUntilIdle();
- EXPECT_TRUE(third_observer.GetAndResetIdleState(&idle_state));
- EXPECT_EQ(UserIdleObserver::IdleState::ACTIVE, idle_state);
- EXPECT_TRUE(second_observer.GetAndResetIdleState(&idle_state));
- EXPECT_EQ(UserIdleObserver::IdleState::ACTIVE, idle_state);
- EXPECT_TRUE(first_observer.GetAndResetIdleState(&idle_state));
- EXPECT_EQ(UserIdleObserver::IdleState::ACTIVE, idle_state);
-
- FastForwardBy(base::TimeDelta::FromMinutes(10));
- TestUserIdleObserver fourth_observer;
- monitor()->AddUserIdleObserver(1, fourth_observer.GetPtr());
- RunUntilIdle();
- EXPECT_TRUE(fourth_observer.GetAndResetIdleState(&idle_state));
- EXPECT_EQ(UserIdleObserver::IdleState::IDLE, idle_state);
- EXPECT_TRUE(third_observer.GetAndResetIdleState(&idle_state));
- EXPECT_EQ(UserIdleObserver::IdleState::IDLE, idle_state);
- EXPECT_TRUE(second_observer.GetAndResetIdleState(&idle_state));
- EXPECT_EQ(UserIdleObserver::IdleState::IDLE, idle_state);
- EXPECT_TRUE(first_observer.GetAndResetIdleState(&idle_state));
- EXPECT_EQ(UserIdleObserver::IdleState::IDLE, idle_state);
-
- // All observers are idle. These should not receive any IDLE notifications as
- // more time passes by.
- FastForwardBy(base::TimeDelta::FromMinutes(100));
- RunUntilIdle();
- EXPECT_FALSE(first_observer.GetAndResetIdleState(&idle_state));
- EXPECT_FALSE(second_observer.GetAndResetIdleState(&idle_state));
- EXPECT_FALSE(third_observer.GetAndResetIdleState(&idle_state));
- EXPECT_FALSE(fourth_observer.GetAndResetIdleState(&idle_state));
-
- // Some activity would notify ACTIVE to all observers.
- monitor()->OnUserActivity();
- RunUntilIdle();
- EXPECT_TRUE(fourth_observer.GetAndResetIdleState(&idle_state));
- EXPECT_EQ(UserIdleObserver::IdleState::ACTIVE, idle_state);
- EXPECT_TRUE(third_observer.GetAndResetIdleState(&idle_state));
- EXPECT_EQ(UserIdleObserver::IdleState::ACTIVE, idle_state);
- EXPECT_TRUE(second_observer.GetAndResetIdleState(&idle_state));
- EXPECT_EQ(UserIdleObserver::IdleState::ACTIVE, idle_state);
- EXPECT_TRUE(first_observer.GetAndResetIdleState(&idle_state));
- EXPECT_EQ(UserIdleObserver::IdleState::ACTIVE, idle_state);
-
- // Yet more activity should not send any notifications.
- monitor()->OnUserActivity();
- RunUntilIdle();
- EXPECT_FALSE(first_observer.GetAndResetIdleState(&idle_state));
- EXPECT_FALSE(second_observer.GetAndResetIdleState(&idle_state));
- EXPECT_FALSE(third_observer.GetAndResetIdleState(&idle_state));
- EXPECT_FALSE(fourth_observer.GetAndResetIdleState(&idle_state));
-}
-
-} // namespace test
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/user_display_manager.cc b/chromium/components/mus/ws/user_display_manager.cc
deleted file mode 100644
index 92aeac675fc..00000000000
--- a/chromium/components/mus/ws/user_display_manager.cc
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/user_display_manager.h"
-
-#include "components/mus/ws/display.h"
-#include "components/mus/ws/display_manager.h"
-#include "components/mus/ws/display_manager_delegate.h"
-
-namespace mus {
-namespace ws {
-
-UserDisplayManager::UserDisplayManager(ws::DisplayManager* display_manager,
- DisplayManagerDelegate* delegate,
- const UserId& user_id)
- : display_manager_(display_manager),
- delegate_(delegate),
- user_id_(user_id),
- got_valid_frame_decorations_(
- delegate->GetFrameDecorationsForUser(user_id, nullptr)),
- current_cursor_location_(0) {}
-
-UserDisplayManager::~UserDisplayManager() {}
-
-void UserDisplayManager::OnFrameDecorationValuesChanged() {
- if (!got_valid_frame_decorations_) {
- got_valid_frame_decorations_ = true;
- display_manager_observers_.ForAllPtrs([this](
- mojom::DisplayManagerObserver* observer) { CallOnDisplays(observer); });
- if (test_observer_)
- CallOnDisplays(test_observer_);
- return;
- }
-
- mojo::Array<mojom::DisplayPtr> displays = GetAllDisplays();
- display_manager_observers_.ForAllPtrs(
- [this, &displays](mojom::DisplayManagerObserver* observer) {
- observer->OnDisplaysChanged(displays.Clone());
- });
- if (test_observer_)
- test_observer_->OnDisplaysChanged(displays.Clone());
-}
-
-void UserDisplayManager::AddDisplayManagerBinding(
- mojo::InterfaceRequest<mojom::DisplayManager> request) {
- display_manager_bindings_.AddBinding(this, std::move(request));
-}
-
-void UserDisplayManager::OnWillDestroyDisplay(Display* display) {
- if (!got_valid_frame_decorations_)
- return;
-
- display_manager_observers_.ForAllPtrs(
- [this, &display](mojom::DisplayManagerObserver* observer) {
- observer->OnDisplayRemoved(display->id());
- });
- if (test_observer_)
- test_observer_->OnDisplayRemoved(display->id());
-}
-
-void UserDisplayManager::OnMouseCursorLocationChanged(const gfx::Point& point) {
- current_cursor_location_ =
- static_cast<base::subtle::Atomic32>(
- (point.x() & 0xFFFF) << 16 | (point.y() & 0xFFFF));
- if (cursor_location_memory()) {
- base::subtle::NoBarrier_Store(cursor_location_memory(),
- current_cursor_location_);
- }
-}
-
-void UserDisplayManager::OnDisplayUpdate(Display* display) {
- if (!got_valid_frame_decorations_)
- return;
-
- mojo::Array<mojom::DisplayPtr> displays(1);
- displays[0] = display->ToMojomDisplay();
- delegate_->GetFrameDecorationsForUser(
- user_id_, &(displays[0]->frame_decoration_values));
- display_manager_observers_.ForAllPtrs(
- [this, &displays](mojom::DisplayManagerObserver* observer) {
- observer->OnDisplaysChanged(displays.Clone());
- });
- if (test_observer_)
- test_observer_->OnDisplaysChanged(displays.Clone());
-}
-
-mojo::ScopedSharedBufferHandle UserDisplayManager::GetCursorLocationMemory() {
- if (!cursor_location_handle_.is_valid()) {
- // Create our shared memory segment to share the cursor state with our
- // window clients.
- cursor_location_handle_ =
- mojo::SharedBufferHandle::Create(sizeof(base::subtle::Atomic32));
-
- if (!cursor_location_handle_.is_valid())
- return mojo::ScopedSharedBufferHandle();
-
- cursor_location_mapping_ =
- cursor_location_handle_->Map(sizeof(base::subtle::Atomic32));
- if (!cursor_location_mapping_)
- return mojo::ScopedSharedBufferHandle();
- base::subtle::NoBarrier_Store(cursor_location_memory(),
- current_cursor_location_);
- }
-
- return cursor_location_handle_->Clone(
- mojo::SharedBufferHandle::AccessMode::READ_ONLY);
-}
-
-
-void UserDisplayManager::OnObserverAdded(
- mojom::DisplayManagerObserver* observer) {
- // Many clients key off the frame decorations to size widgets. Wait for frame
- // decorations before notifying so that we don't have to worry about clients
- // resizing appropriately.
- if (!got_valid_frame_decorations_)
- return;
-
- CallOnDisplays(observer);
-}
-
-mojo::Array<mojom::DisplayPtr> UserDisplayManager::GetAllDisplays() {
- const std::set<Display*>& displays = display_manager_->displays();
- mojo::Array<mojom::DisplayPtr> display_ptrs(displays.size());
- {
- size_t i = 0;
- // TODO(sky): need ordering!
- for (Display* display : displays) {
- display_ptrs[i] = display->ToMojomDisplay();
- delegate_->GetFrameDecorationsForUser(
- user_id_, &(display_ptrs[i]->frame_decoration_values));
- ++i;
- }
- }
- return display_ptrs;
-}
-
-void UserDisplayManager::CallOnDisplays(
- mojom::DisplayManagerObserver* observer) {
- observer->OnDisplays(GetAllDisplays());
-}
-
-void UserDisplayManager::AddObserver(
- mojom::DisplayManagerObserverPtr observer) {
- mojom::DisplayManagerObserver* observer_impl = observer.get();
- display_manager_observers_.AddPtr(std::move(observer));
- OnObserverAdded(observer_impl);
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/user_display_manager.h b/chromium/components/mus/ws/user_display_manager.h
deleted file mode 100644
index 1bfcdf81d8c..00000000000
--- a/chromium/components/mus/ws/user_display_manager.h
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_USER_DISPLAY_MANAGER_H_
-#define COMPONENTS_MUS_WS_USER_DISPLAY_MANAGER_H_
-
-#include <set>
-
-#include "base/atomicops.h"
-#include "base/macros.h"
-#include "components/mus/public/interfaces/display.mojom.h"
-#include "components/mus/ws/user_id.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
-#include "mojo/public/cpp/bindings/interface_ptr_set.h"
-
-namespace gfx {
-class Point;
-}
-
-namespace mus {
-namespace ws {
-
-class Display;
-class DisplayManager;
-class DisplayManagerDelegate;
-
-namespace test {
-class UserDisplayManagerTestApi;
-}
-
-// Provides per user display state.
-class UserDisplayManager : public mojom::DisplayManager {
- public:
- UserDisplayManager(ws::DisplayManager* display_manager,
- DisplayManagerDelegate* delegate,
- const UserId& user_id);
- ~UserDisplayManager() override;
-
- // Called when the frame decorations for this user change.
- void OnFrameDecorationValuesChanged();
-
- void AddDisplayManagerBinding(
- mojo::InterfaceRequest<mojom::DisplayManager> request);
-
- // Called by Display prior to |display| being removed and destroyed.
- void OnWillDestroyDisplay(Display* display);
-
- // Called from WindowManagerState when its EventDispatcher receives a mouse
- // event.
- void OnMouseCursorLocationChanged(const gfx::Point& point);
-
- // Called when something about the display (e.g. pixel-ratio, size) changes.
- void OnDisplayUpdate(Display* display);
-
- // Returns a read-only handle to the shared memory which contains the global
- // mouse cursor position. Each call returns a new handle.
- mojo::ScopedSharedBufferHandle GetCursorLocationMemory();
-
- private:
- friend class test::UserDisplayManagerTestApi;
-
- // Called when a new observer is added. If frame decorations are available
- // notifies the observer immediately.
- void OnObserverAdded(mojom::DisplayManagerObserver* observer);
-
- mojo::Array<mojom::DisplayPtr> GetAllDisplays();
-
- // Calls OnDisplays() on |observer|.
- void CallOnDisplays(mojom::DisplayManagerObserver* observer);
-
- // Overriden from mojom::DisplayManager:
- void AddObserver(mojom::DisplayManagerObserverPtr observer) override;
-
- base::subtle::Atomic32* cursor_location_memory() {
- return reinterpret_cast<base::subtle::Atomic32*>(
- cursor_location_mapping_.get());
- }
-
- ws::DisplayManager* display_manager_;
-
- DisplayManagerDelegate* delegate_;
-
- const UserId user_id_;
-
- // Set to true the first time at least one Display has valid frame values.
- bool got_valid_frame_decorations_;
-
- mojo::BindingSet<mojom::DisplayManager> display_manager_bindings_;
-
- // WARNING: only use these once |got_valid_frame_decorations_| is true.
- mojo::InterfacePtrSet<mojom::DisplayManagerObserver>
- display_manager_observers_;
-
- // Observer used for tests.
- mojom::DisplayManagerObserver* test_observer_ = nullptr;
-
- // The current location of the cursor. This is always kept up to date so we
- // can atomically write this to |cursor_location_memory()| once it is created.
- base::subtle::Atomic32 current_cursor_location_;
-
- // A handle to a shared memory buffer that is one 64 bit integer long. We
- // share this with any client as the same user. This buffer is lazily
- // created on the first access.
- mojo::ScopedSharedBufferHandle cursor_location_handle_;
-
- // The one int32 in |cursor_location_handle_|. When we write to this
- // location, we must always write to it atomically. (On the other side of the
- // mojo connection, this data must be read atomically.)
- mojo::ScopedSharedBufferMapping cursor_location_mapping_;
-
- DISALLOW_COPY_AND_ASSIGN(UserDisplayManager);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_USER_DISPLAY_MANAGER_H_
diff --git a/chromium/components/mus/ws/user_display_manager_unittest.cc b/chromium/components/mus/ws/user_display_manager_unittest.cc
deleted file mode 100644
index 2c2506cce26..00000000000
--- a/chromium/components/mus/ws/user_display_manager_unittest.cc
+++ /dev/null
@@ -1,244 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <stdint.h>
-
-#include <string>
-
-#include "base/atomicops.h"
-#include "base/macros.h"
-#include "base/message_loop/message_loop.h"
-#include "base/strings/string_number_conversions.h"
-#include "components/mus/common/types.h"
-#include "components/mus/common/util.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "components/mus/ws/display_binding.h"
-#include "components/mus/ws/display_manager.h"
-#include "components/mus/ws/ids.h"
-#include "components/mus/ws/platform_display.h"
-#include "components/mus/ws/platform_display_factory.h"
-#include "components/mus/ws/platform_display_init_params.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/test_utils.h"
-#include "components/mus/ws/window_manager_state.h"
-#include "components/mus/ws/window_manager_window_tree_factory_set.h"
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_server_delegate.h"
-#include "components/mus/ws/window_tree.h"
-#include "components/mus/ws/window_tree_binding.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace mus {
-namespace ws {
-namespace test {
-namespace {
-
-class TestDisplayManagerObserver : public mojom::DisplayManagerObserver {
- public:
- TestDisplayManagerObserver() {}
- ~TestDisplayManagerObserver() override {}
-
- std::string GetAndClearObserverCalls() {
- std::string result;
- std::swap(observer_calls_, result);
- return result;
- }
-
- private:
- void AddCall(const std::string& call) {
- if (!observer_calls_.empty())
- observer_calls_ += "\n";
- observer_calls_ += call;
- }
-
- std::string DisplayIdsToString(
- const mojo::Array<mojom::DisplayPtr>& displays) {
- std::string display_ids;
- for (const auto& display : displays) {
- if (!display_ids.empty())
- display_ids += " ";
- display_ids += base::Int64ToString(display->id);
- }
- return display_ids;
- }
-
- // mojom::DisplayManagerObserver:
- void OnDisplays(mojo::Array<mojom::DisplayPtr> displays) override {
- AddCall("OnDisplays " + DisplayIdsToString(displays));
- }
- void OnDisplaysChanged(mojo::Array<mojom::DisplayPtr> displays) override {
- AddCall("OnDisplaysChanged " + DisplayIdsToString(displays));
- }
- void OnDisplayRemoved(int64_t id) override {
- AddCall("OnDisplayRemoved " + base::Int64ToString(id));
- }
-
- std::string observer_calls_;
-
- DISALLOW_COPY_AND_ASSIGN(TestDisplayManagerObserver);
-};
-
-mojom::FrameDecorationValuesPtr CreateDefaultFrameDecorationValues() {
- return mojom::FrameDecorationValues::New();
-}
-
-} // namespace
-
-// -----------------------------------------------------------------------------
-
-class UserDisplayManagerTest : public testing::Test {
- public:
- UserDisplayManagerTest()
- : cursor_id_(0), platform_display_factory_(&cursor_id_) {}
- ~UserDisplayManagerTest() override {}
-
- protected:
- // testing::Test:
- void SetUp() override {
- PlatformDisplay::set_factory_for_testing(&platform_display_factory_);
- window_server_.reset(new WindowServer(&window_server_delegate_,
- scoped_refptr<SurfacesState>()));
- window_server_delegate_.set_window_server(window_server_.get());
- }
-
- protected:
- int32_t cursor_id_;
- TestPlatformDisplayFactory platform_display_factory_;
- TestWindowServerDelegate window_server_delegate_;
- std::unique_ptr<WindowServer> window_server_;
- base::MessageLoop message_loop_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(UserDisplayManagerTest);
-};
-
-TEST_F(UserDisplayManagerTest, OnlyNotifyWhenFrameDecorationsSet) {
- window_server_delegate_.set_num_displays_to_create(1);
-
- const UserId kUserId1 = "2";
- TestDisplayManagerObserver display_manager_observer1;
- DisplayManager* display_manager = window_server_->display_manager();
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kUserId1);
- UserDisplayManager* user_display_manager1 =
- display_manager->GetUserDisplayManager(kUserId1);
- ASSERT_TRUE(user_display_manager1);
- UserDisplayManagerTestApi(user_display_manager1)
- .SetTestObserver(&display_manager_observer1);
- // Observer should not have been notified yet.
- EXPECT_EQ(std::string(),
- display_manager_observer1.GetAndClearObserverCalls());
-
- // Set the frame decoration values, which should trigger sending immediately.
- ASSERT_EQ(1u, display_manager->displays().size());
- window_server_->window_manager_window_tree_factory_set()
- ->GetWindowManagerStateForUser(kUserId1)
- ->SetFrameDecorationValues(CreateDefaultFrameDecorationValues());
- EXPECT_EQ("OnDisplays 1",
- display_manager_observer1.GetAndClearObserverCalls());
-
- UserDisplayManagerTestApi(user_display_manager1).SetTestObserver(nullptr);
-}
-
-TEST_F(UserDisplayManagerTest, AddObserverAfterFrameDecorationsSet) {
- window_server_delegate_.set_num_displays_to_create(1);
-
- const UserId kUserId1 = "2";
- TestDisplayManagerObserver display_manager_observer1;
- DisplayManager* display_manager = window_server_->display_manager();
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kUserId1);
- UserDisplayManager* user_display_manager1 =
- display_manager->GetUserDisplayManager(kUserId1);
- ASSERT_TRUE(user_display_manager1);
- ASSERT_EQ(1u, display_manager->displays().size());
- window_server_->window_manager_window_tree_factory_set()
- ->GetWindowManagerStateForUser(kUserId1)
- ->SetFrameDecorationValues(CreateDefaultFrameDecorationValues());
-
- UserDisplayManagerTestApi(user_display_manager1)
- .SetTestObserver(&display_manager_observer1);
- EXPECT_EQ("OnDisplays 1",
- display_manager_observer1.GetAndClearObserverCalls());
-
- UserDisplayManagerTestApi(user_display_manager1).SetTestObserver(nullptr);
-}
-
-TEST_F(UserDisplayManagerTest, AddRemoveDisplay) {
- window_server_delegate_.set_num_displays_to_create(1);
-
- const UserId kUserId1 = "2";
- TestDisplayManagerObserver display_manager_observer1;
- DisplayManager* display_manager = window_server_->display_manager();
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kUserId1);
- UserDisplayManager* user_display_manager1 =
- display_manager->GetUserDisplayManager(kUserId1);
- ASSERT_TRUE(user_display_manager1);
- ASSERT_EQ(1u, display_manager->displays().size());
- window_server_->window_manager_window_tree_factory_set()
- ->GetWindowManagerStateForUser(kUserId1)
- ->SetFrameDecorationValues(CreateDefaultFrameDecorationValues());
- UserDisplayManagerTestApi(user_display_manager1)
- .SetTestObserver(&display_manager_observer1);
- EXPECT_EQ("OnDisplays 1",
- display_manager_observer1.GetAndClearObserverCalls());
-
- // Add another display.
- Display* display2 =
- new Display(window_server_.get(), PlatformDisplayInitParams());
- display2->Init(nullptr);
-
- // Observer should be notified immediately as frame decorations were set.
- EXPECT_EQ("OnDisplaysChanged 2",
- display_manager_observer1.GetAndClearObserverCalls());
-
- // Remove the display and verify observer is notified.
- display_manager->DestroyDisplay(display2);
- display2 = nullptr;
- EXPECT_EQ("OnDisplayRemoved 2",
- display_manager_observer1.GetAndClearObserverCalls());
-
- UserDisplayManagerTestApi(user_display_manager1).SetTestObserver(nullptr);
-}
-
-TEST_F(UserDisplayManagerTest, NegativeCoordinates) {
- window_server_delegate_.set_num_displays_to_create(1);
-
- const UserId kUserId1 = "2";
- TestDisplayManagerObserver display_manager_observer1;
- DisplayManager* display_manager = window_server_->display_manager();
- WindowManagerWindowTreeFactorySetTestApi(
- window_server_->window_manager_window_tree_factory_set())
- .Add(kUserId1);
- UserDisplayManager* user_display_manager1 =
- display_manager->GetUserDisplayManager(kUserId1);
- ASSERT_TRUE(user_display_manager1);
-
- user_display_manager1->OnMouseCursorLocationChanged(gfx::Point(-10, -11));
-
- base::subtle::Atomic32* cursor_location_memory = nullptr;
- mojo::ScopedSharedBufferHandle handle =
- user_display_manager1->GetCursorLocationMemory();
- mojo::ScopedSharedBufferMapping cursor_location_mapping =
- handle->Map(sizeof(base::subtle::Atomic32));
- ASSERT_TRUE(cursor_location_mapping);
- cursor_location_memory =
- reinterpret_cast<base::subtle::Atomic32*>(cursor_location_mapping.get());
-
- base::subtle::Atomic32 location =
- base::subtle::NoBarrier_Load(cursor_location_memory);
- EXPECT_EQ(gfx::Point(static_cast<int16_t>(location >> 16),
- static_cast<int16_t>(location & 0xFFFF)),
- gfx::Point(-10, -11));
-}
-
-} // namespace test
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/user_id.h b/chromium/components/mus/ws/user_id.h
deleted file mode 100644
index dbb59965487..00000000000
--- a/chromium/components/mus/ws/user_id.h
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_USER_ID_H_
-#define COMPONENTS_MUS_WS_USER_ID_H_
-
-#include <string>
-
-namespace mus {
-namespace ws {
-
-using UserId = std::string;
-
-inline UserId InvalidUserId() {
- return std::string();
-}
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_USER_ID_H_
diff --git a/chromium/components/mus/ws/user_id_tracker.cc b/chromium/components/mus/ws/user_id_tracker.cc
deleted file mode 100644
index 40a7dde987b..00000000000
--- a/chromium/components/mus/ws/user_id_tracker.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/user_id_tracker.h"
-
-#include "components/mus/ws/user_id_tracker_observer.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-
-namespace mus {
-namespace ws {
-
-UserIdTracker::UserIdTracker() : active_id_(shell::mojom::kRootUserID) {
- ids_.insert(active_id_);
-}
-
-UserIdTracker::~UserIdTracker() {
-}
-
-bool UserIdTracker::IsValidUserId(const UserId& id) const {
- return ids_.count(id) > 0;
-}
-
-void UserIdTracker::SetActiveUserId(const UserId& id) {
- DCHECK(IsValidUserId(id));
- if (id == active_id_)
- return;
-
- const UserId previously_active_id = active_id_;
- active_id_ = id;
- FOR_EACH_OBSERVER(UserIdTrackerObserver, observers_,
- OnActiveUserIdChanged(previously_active_id, id));
-}
-
-void UserIdTracker::AddUserId(const UserId& id) {
- if (IsValidUserId(id))
- return;
-
- ids_.insert(id);
- FOR_EACH_OBSERVER(UserIdTrackerObserver, observers_, OnUserIdAdded(id));
-}
-
-void UserIdTracker::RemoveUserId(const UserId& id) {
- DCHECK(IsValidUserId(id));
- ids_.erase(id);
- FOR_EACH_OBSERVER(UserIdTrackerObserver, observers_, OnUserIdRemoved(id));
-}
-
-void UserIdTracker::AddObserver(UserIdTrackerObserver* observer) {
- observers_.AddObserver(observer);
-}
-
-void UserIdTracker::RemoveObserver(UserIdTrackerObserver* observer) {
- observers_.RemoveObserver(observer);
-}
-
-void UserIdTracker::Bind(mojom::UserAccessManagerRequest request) {
- bindings_.AddBinding(this, std::move(request));
-}
-
-void UserIdTracker::SetActiveUser(const mojo::String& user_id) {
- if (!IsValidUserId(user_id))
- AddUserId(user_id);
- SetActiveUserId(user_id);
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/user_id_tracker.h b/chromium/components/mus/ws/user_id_tracker.h
deleted file mode 100644
index c0b2ca54407..00000000000
--- a/chromium/components/mus/ws/user_id_tracker.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_USER_ID_TRACKER_H_
-#define COMPONENTS_MUS_WS_USER_ID_TRACKER_H_
-
-#include <stdint.h>
-
-#include <set>
-
-#include "base/macros.h"
-#include "base/observer_list.h"
-#include "components/mus/public/interfaces/user_access_manager.mojom.h"
-#include "components/mus/ws/user_id.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
-
-namespace mus {
-namespace ws {
-
-class UserIdTrackerObserver;
-
-// Tracks the set of known/valid user ids.
-class UserIdTracker : public mojom::UserAccessManager {
- public:
- UserIdTracker();
- ~UserIdTracker() override;
-
- bool IsValidUserId(const UserId& id) const;
-
- const UserId& active_id() const { return active_id_; }
-
- // Adds a new known user. Does nothing if |id| is not known.
- void SetActiveUserId(const UserId& id);
- void AddUserId(const UserId& id);
- void RemoveUserId(const UserId& id);
-
- void AddObserver(UserIdTrackerObserver* observer);
- void RemoveObserver(UserIdTrackerObserver* observer);
-
- void Bind(mojom::UserAccessManagerRequest request);
-
- private:
- using UserIdSet = std::set<UserId>;
-
- // mojom::UserAccessManager:
- void SetActiveUser(const mojo::String& user_id) override;
-
- base::ObserverList<UserIdTrackerObserver> observers_;
-
- UserIdSet ids_;
- UserId active_id_;
-
- mojo::BindingSet<mojom::UserAccessManager> bindings_;
-
- DISALLOW_COPY_AND_ASSIGN(UserIdTracker);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_USER_ID_TRACKER_H_
diff --git a/chromium/components/mus/ws/user_id_tracker_observer.h b/chromium/components/mus/ws/user_id_tracker_observer.h
deleted file mode 100644
index e770ac3de23..00000000000
--- a/chromium/components/mus/ws/user_id_tracker_observer.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_USER_ID_TRACKER_OBSERVER_H_
-#define COMPONENTS_MUS_WS_USER_ID_TRACKER_OBSERVER_H_
-
-#include <stdint.h>
-
-#include "components/mus/ws/user_id.h"
-
-namespace mus {
-namespace ws {
-
-class UserIdTrackerObserver {
- public:
- virtual void OnActiveUserIdChanged(const UserId& previously_active_id,
- const UserId& active_id) {}
- virtual void OnUserIdAdded(const UserId& id) {}
- virtual void OnUserIdRemoved(const UserId& id) {}
-
- protected:
- virtual ~UserIdTrackerObserver() {}
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_USER_ID_TRACKER_OBSERVER_H_
diff --git a/chromium/components/mus/ws/window_coordinate_conversions.cc b/chromium/components/mus/ws/window_coordinate_conversions.cc
deleted file mode 100644
index 81530fa820e..00000000000
--- a/chromium/components/mus/ws/window_coordinate_conversions.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_coordinate_conversions.h"
-
-#include "components/mus/ws/server_window.h"
-#include "ui/gfx/geometry/point.h"
-#include "ui/gfx/geometry/point_conversions.h"
-#include "ui/gfx/geometry/point_f.h"
-#include "ui/gfx/geometry/rect.h"
-#include "ui/gfx/geometry/vector2d.h"
-#include "ui/gfx/geometry/vector2d_f.h"
-
-namespace mus {
-
-namespace ws {
-
-namespace {
-
-gfx::Vector2dF CalculateOffsetToAncestor(const ServerWindow* window,
- const ServerWindow* ancestor) {
- DCHECK(ancestor->Contains(window));
- gfx::Vector2d result;
- for (const ServerWindow* v = window; v != ancestor; v = v->parent())
- result += v->bounds().OffsetFromOrigin();
- return gfx::Vector2dF(result.x(), result.y());
-}
-
-} // namespace
-
-gfx::Point ConvertPointBetweenWindows(const ServerWindow* from,
- const ServerWindow* to,
- const gfx::Point& point) {
- return gfx::ToFlooredPoint(
- ConvertPointFBetweenWindows(from, to, gfx::PointF(point.x(), point.y())));
-}
-
-gfx::PointF ConvertPointFBetweenWindows(const ServerWindow* from,
- const ServerWindow* to,
- const gfx::PointF& point) {
- DCHECK(from);
- DCHECK(to);
- if (from == to)
- return point;
-
- if (from->Contains(to)) {
- const gfx::Vector2dF offset(CalculateOffsetToAncestor(to, from));
- return point - offset;
- }
- DCHECK(to->Contains(from));
- const gfx::Vector2dF offset(CalculateOffsetToAncestor(from, to));
- return point + offset;
-}
-
-gfx::Rect ConvertRectBetweenWindows(const ServerWindow* from,
- const ServerWindow* to,
- const gfx::Rect& rect) {
- DCHECK(from);
- DCHECK(to);
- if (from == to)
- return rect;
-
- const gfx::Point top_left(
- ConvertPointBetweenWindows(from, to, rect.origin()));
- const gfx::Point bottom_right(gfx::ToCeiledPoint(ConvertPointFBetweenWindows(
- from, to, gfx::PointF(rect.right(), rect.bottom()))));
- return gfx::Rect(top_left.x(), top_left.y(), bottom_right.x() - top_left.x(),
- bottom_right.y() - top_left.y());
-}
-
-} // namespace ws
-
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_coordinate_conversions.h b/chromium/components/mus/ws/window_coordinate_conversions.h
deleted file mode 100644
index 39601590a80..00000000000
--- a/chromium/components/mus/ws/window_coordinate_conversions.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_WINDOW_COORDINATE_CONVERSIONS_H_
-#define COMPONENTS_MUS_WS_WINDOW_COORDINATE_CONVERSIONS_H_
-
-namespace gfx {
-class Point;
-class PointF;
-class Rect;
-}
-
-namespace mus {
-
-namespace ws {
-
-class ServerWindow;
-
-// Converts |point| from the coordinates of |from| to the coordinates of |to|.
-// |from| and |to| must be an ancestors or descendants of each other.
-gfx::Point ConvertPointBetweenWindows(const ServerWindow* from,
- const ServerWindow* to,
- const gfx::Point& point);
-gfx::PointF ConvertPointFBetweenWindows(const ServerWindow* from,
- const ServerWindow* to,
- const gfx::PointF& point);
-
-// Converts |rect| from the coordinates of |from| to the coordinates of |to|.
-// |from| and |to| must be an ancestors or descendants of each other.
-gfx::Rect ConvertRectBetweenWindows(const ServerWindow* from,
- const ServerWindow* to,
- const gfx::Rect& rect);
-
-} // namespace ws
-
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_WINDOW_COORDINATE_CONVERSIONS_H_
diff --git a/chromium/components/mus/ws/window_coordinate_conversions_unittest.cc b/chromium/components/mus/ws/window_coordinate_conversions_unittest.cc
deleted file mode 100644
index 8c42c09f6c7..00000000000
--- a/chromium/components/mus/ws/window_coordinate_conversions_unittest.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_coordinate_conversions.h"
-
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_delegate.h"
-#include "components/mus/ws/test_server_window_delegate.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/gfx/geometry/point_f.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace mus {
-
-namespace ws {
-
-using WindowCoordinateConversionsTest = testing::Test;
-
-TEST_F(WindowCoordinateConversionsTest, ConvertRectBetweenWindows) {
- TestServerWindowDelegate d1, d2, d3;
- ServerWindow v1(&d1, WindowId()), v2(&d2, WindowId()), v3(&d3, WindowId());
- v1.SetBounds(gfx::Rect(1, 2, 100, 100));
- v2.SetBounds(gfx::Rect(3, 4, 100, 100));
- v3.SetBounds(gfx::Rect(5, 6, 100, 100));
- v1.Add(&v2);
- v2.Add(&v3);
-
- EXPECT_EQ(gfx::Rect(2, 1, 8, 9),
- ConvertRectBetweenWindows(&v1, &v3, gfx::Rect(10, 11, 8, 9)));
-
- EXPECT_EQ(gfx::Rect(18, 21, 8, 9),
- ConvertRectBetweenWindows(&v3, &v1, gfx::Rect(10, 11, 8, 9)));
-}
-
-TEST_F(WindowCoordinateConversionsTest, ConvertPointFBetweenWindows) {
- TestServerWindowDelegate d1, d2, d3;
- ServerWindow v1(&d1, WindowId()), v2(&d2, WindowId()), v3(&d3, WindowId());
- v1.SetBounds(gfx::Rect(1, 2, 100, 100));
- v2.SetBounds(gfx::Rect(3, 4, 100, 100));
- v3.SetBounds(gfx::Rect(5, 6, 100, 100));
- v1.Add(&v2);
- v2.Add(&v3);
-
- {
- const gfx::PointF result(
- ConvertPointFBetweenWindows(&v1, &v3, gfx::PointF(10.5f, 11.9f)));
- EXPECT_FLOAT_EQ(2.5f, result.x());
- EXPECT_FLOAT_EQ(1.9f, result.y());
- }
-
- {
- const gfx::PointF result(
- ConvertPointFBetweenWindows(&v3, &v1, gfx::PointF(10.2f, 11.4f)));
- EXPECT_FLOAT_EQ(18.2f, result.x());
- EXPECT_FLOAT_EQ(21.4f, result.y());
- }
-}
-
-} // namespace ws
-
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_finder.cc b/chromium/components/mus/ws/window_finder.cc
deleted file mode 100644
index 466bd5a6a8e..00000000000
--- a/chromium/components/mus/ws/window_finder.cc
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_finder.h"
-
-#include "components/mus/surfaces/surfaces_state.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_delegate.h"
-#include "components/mus/ws/server_window_surface.h"
-#include "components/mus/ws/server_window_surface_manager.h"
-#include "components/mus/ws/window_coordinate_conversions.h"
-#include "ui/gfx/geometry/point.h"
-#include "ui/gfx/geometry/point_f.h"
-#include "ui/gfx/transform.h"
-
-namespace mus {
-namespace ws {
-
-bool IsValidWindowForEvents(ServerWindow* window) {
- ServerWindowSurfaceManager* surface_manager = window->surface_manager();
- return surface_manager &&
- surface_manager->HasSurfaceOfType(mojom::SurfaceType::DEFAULT);
-}
-
-ServerWindow* FindDeepestVisibleWindowForEvents(ServerWindow* window,
- gfx::Point* location) {
- const ServerWindow::Windows children(window->GetChildren());
- for (auto iter = children.rbegin(); iter != children.rend(); ++iter) {
- ServerWindow* child = *iter;
- if (!child->visible())
- continue;
-
- // TODO(sky): support transform.
- gfx::Point child_location(location->x() - child->bounds().x(),
- location->y() - child->bounds().y());
- gfx::Rect child_bounds(child->bounds().size());
- child_bounds.Inset(-child->extended_hit_test_region().left(),
- -child->extended_hit_test_region().top(),
- -child->extended_hit_test_region().right(),
- -child->extended_hit_test_region().bottom());
- if (!child_bounds.Contains(child_location))
- continue;
-
- if (child->hit_test_mask() &&
- !child->hit_test_mask()->Contains(child_location))
- continue;
-
- *location = child_location;
- ServerWindow* result = FindDeepestVisibleWindowForEvents(child, location);
- if (IsValidWindowForEvents(result))
- return result;
- }
- return window;
-}
-
-gfx::Transform GetTransformToWindow(ServerWindow* window) {
- gfx::Transform transform;
- ServerWindow* current = window;
- while (current->parent()) {
- transform.Translate(-current->bounds().x(), -current->bounds().y());
- current = current->parent();
- }
- return transform;
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_finder.h b/chromium/components/mus/ws/window_finder.h
deleted file mode 100644
index 2b535fcb35b..00000000000
--- a/chromium/components/mus/ws/window_finder.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_WINDOW_FINDER_H_
-#define COMPONENTS_MUS_WS_WINDOW_FINDER_H_
-
-namespace gfx {
-class Point;
-class Transform;
-}
-
-namespace mus {
-namespace ws {
-
-class ServerWindow;
-
-// Find the deepest visible child of |root| that should receive an event at
-// |location|. |location| is initially in the coordinate space of
-// |root_window|, on return it is converted to the coordinates of the return
-// value.
-ServerWindow* FindDeepestVisibleWindowForEvents(
- ServerWindow* root_window,
- gfx::Point* location);
-
-// Retrieve the transform to the provided |window|'s coordinate space from the
-// root.
-gfx::Transform GetTransformToWindow(ServerWindow* window);
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_WINDOW_FINDER_H_
diff --git a/chromium/components/mus/ws/window_finder_unittest.cc b/chromium/components/mus/ws/window_finder_unittest.cc
deleted file mode 100644
index f910624ce43..00000000000
--- a/chromium/components/mus/ws/window_finder_unittest.cc
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_finder.h"
-
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_surface_manager.h"
-#include "components/mus/ws/server_window_surface_manager_test_api.h"
-#include "components/mus/ws/test_server_window_delegate.h"
-#include "components/mus/ws/window_finder.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace mus {
-namespace ws {
-
-TEST(WindowFinderTest, FindDeepestVisibleWindow) {
- TestServerWindowDelegate window_delegate;
- ServerWindow root(&window_delegate, WindowId(1, 2));
- window_delegate.set_root_window(&root);
- root.SetVisible(true);
- root.SetBounds(gfx::Rect(0, 0, 100, 100));
-
- ServerWindow child1(&window_delegate, WindowId(1, 3));
- root.Add(&child1);
- EnableHitTest(&child1);
- child1.SetVisible(true);
- child1.SetBounds(gfx::Rect(10, 10, 20, 20));
-
- ServerWindow child2(&window_delegate, WindowId(1, 4));
- root.Add(&child2);
- EnableHitTest(&child2);
- child2.SetVisible(true);
- child2.SetBounds(gfx::Rect(15, 15, 20, 20));
-
- gfx::Point local_point(16, 16);
- EXPECT_EQ(&child2, FindDeepestVisibleWindowForEvents(&root, &local_point));
- EXPECT_EQ(gfx::Point(1, 1), local_point);
-
- local_point.SetPoint(13, 14);
- EXPECT_EQ(&child1, FindDeepestVisibleWindowForEvents(&root, &local_point));
- EXPECT_EQ(gfx::Point(3, 4), local_point);
-
- child2.set_extended_hit_test_region(gfx::Insets(10, 10, 10, 10));
- local_point.SetPoint(13, 14);
- EXPECT_EQ(&child2, FindDeepestVisibleWindowForEvents(&root, &local_point));
- EXPECT_EQ(gfx::Point(-2, -1), local_point);
-}
-
-TEST(WindowFinderTest, FindDeepestVisibleWindowHitTestMask) {
- TestServerWindowDelegate window_delegate;
- ServerWindow root(&window_delegate, WindowId(1, 2));
- window_delegate.set_root_window(&root);
- EnableHitTest(&root);
- root.SetVisible(true);
- root.SetBounds(gfx::Rect(0, 0, 100, 100));
-
- ServerWindow child_with_mask(&window_delegate, WindowId(1, 4));
- root.Add(&child_with_mask);
- EnableHitTest(&child_with_mask);
- child_with_mask.SetVisible(true);
- child_with_mask.SetBounds(gfx::Rect(10, 10, 20, 20));
- child_with_mask.SetHitTestMask(gfx::Rect(2, 2, 16, 16));
-
- // Test a point inside the window but outside the mask.
- gfx::Point point_outside_mask(11, 11);
- EXPECT_EQ(&root,
- FindDeepestVisibleWindowForEvents(&root, &point_outside_mask));
- EXPECT_EQ(gfx::Point(11, 11), point_outside_mask);
-
- // Test a point inside the window and inside the mask.
- gfx::Point point_inside_mask(15, 15);
- EXPECT_EQ(&child_with_mask,
- FindDeepestVisibleWindowForEvents(&root, &point_inside_mask));
- EXPECT_EQ(gfx::Point(5, 5), point_inside_mask);
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_manager_access_policy.cc b/chromium/components/mus/ws/window_manager_access_policy.cc
deleted file mode 100644
index 7682c264383..00000000000
--- a/chromium/components/mus/ws/window_manager_access_policy.cc
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_manager_access_policy.h"
-
-#include "components/mus/ws/access_policy_delegate.h"
-#include "components/mus/ws/server_window.h"
-
-namespace mus {
-namespace ws {
-
-WindowManagerAccessPolicy::WindowManagerAccessPolicy() {}
-
-WindowManagerAccessPolicy::~WindowManagerAccessPolicy() {}
-
-void WindowManagerAccessPolicy::Init(ClientSpecificId client_id,
- AccessPolicyDelegate* delegate) {
- client_id_ = client_id;
- delegate_ = delegate;
-}
-
-bool WindowManagerAccessPolicy::CanRemoveWindowFromParent(
- const ServerWindow* window) const {
- return true;
-}
-
-bool WindowManagerAccessPolicy::CanAddWindow(const ServerWindow* parent,
- const ServerWindow* child) const {
- return true;
-}
-
-bool WindowManagerAccessPolicy::CanAddTransientWindow(
- const ServerWindow* parent,
- const ServerWindow* child) const {
- return true;
-}
-
-bool WindowManagerAccessPolicy::CanRemoveTransientWindowFromParent(
- const ServerWindow* window) const {
- return true;
-}
-
-bool WindowManagerAccessPolicy::CanSetModal(
- const ServerWindow* window) const {
- return true;
-}
-
-bool WindowManagerAccessPolicy::CanReorderWindow(
- const ServerWindow* window,
- const ServerWindow* relative_window,
- mojom::OrderDirection direction) const {
- return true;
-}
-
-bool WindowManagerAccessPolicy::CanDeleteWindow(
- const ServerWindow* window) const {
- return WasCreatedByThisClient(window);
-}
-
-bool WindowManagerAccessPolicy::CanGetWindowTree(
- const ServerWindow* window) const {
- return true;
-}
-
-bool WindowManagerAccessPolicy::CanDescendIntoWindowForWindowTree(
- const ServerWindow* window) const {
- return true;
-}
-
-bool WindowManagerAccessPolicy::CanEmbed(const ServerWindow* window) const {
- return !delegate_->HasRootForAccessPolicy(window);
-}
-
-bool WindowManagerAccessPolicy::CanChangeWindowVisibility(
- const ServerWindow* window) const {
- if (WasCreatedByThisClient(window))
- return true;
- // The WindowManager can change the visibility of the WindowManager root.
- const ServerWindow* root = window->GetRoot();
- return root && window->parent() == root;
-}
-
-bool WindowManagerAccessPolicy::CanChangeWindowOpacity(
- const ServerWindow* window) const {
- return WasCreatedByThisClient(window);
-}
-
-bool WindowManagerAccessPolicy::CanSetWindowSurface(
- const ServerWindow* window,
- mus::mojom::SurfaceType surface_type) const {
- if (surface_type == mojom::SurfaceType::UNDERLAY)
- return WasCreatedByThisClient(window);
-
- if (delegate_->IsWindowRootOfAnotherTreeForAccessPolicy(window))
- return false;
- return WasCreatedByThisClient(window) ||
- (delegate_->HasRootForAccessPolicy(window));
-}
-
-bool WindowManagerAccessPolicy::CanSetWindowBounds(
- const ServerWindow* window) const {
- return WasCreatedByThisClient(window);
-}
-
-bool WindowManagerAccessPolicy::CanSetWindowProperties(
- const ServerWindow* window) const {
- return WasCreatedByThisClient(window);
-}
-
-bool WindowManagerAccessPolicy::CanSetWindowTextInputState(
- const ServerWindow* window) const {
- return WasCreatedByThisClient(window);
-}
-
-bool WindowManagerAccessPolicy::CanSetCapture(
- const ServerWindow* window) const {
- return WasCreatedByThisClient(window);
-}
-
-bool WindowManagerAccessPolicy::CanSetFocus(const ServerWindow* window) const {
- return true;
-}
-
-bool WindowManagerAccessPolicy::CanSetClientArea(
- const ServerWindow* window) const {
- return WasCreatedByThisClient(window) ||
- delegate_->HasRootForAccessPolicy(window);
-}
-
-bool WindowManagerAccessPolicy::CanSetHitTestMask(
- const ServerWindow* window) const {
- return WasCreatedByThisClient(window) ||
- delegate_->HasRootForAccessPolicy(window);
-}
-
-bool WindowManagerAccessPolicy::CanSetCursorProperties(
- const ServerWindow* window) const {
- return WasCreatedByThisClient(window) ||
- delegate_->HasRootForAccessPolicy(window);
-}
-
-bool WindowManagerAccessPolicy::ShouldNotifyOnHierarchyChange(
- const ServerWindow* window,
- const ServerWindow** new_parent,
- const ServerWindow** old_parent) const {
- // Notify if we've already told the window manager about the window, or if
- // we've
- // already told the window manager about the parent. The later handles the
- // case of a window that wasn't parented to the root getting added to the
- // root.
- return IsWindowKnown(window) || (*new_parent && IsWindowKnown(*new_parent));
-}
-
-bool WindowManagerAccessPolicy::CanSetWindowManager() const {
- return true;
-}
-
-const ServerWindow* WindowManagerAccessPolicy::GetWindowForFocusChange(
- const ServerWindow* focused) {
- return focused;
-}
-
-bool WindowManagerAccessPolicy::IsWindowKnown(
- const ServerWindow* window) const {
- return delegate_->IsWindowKnownForAccessPolicy(window);
-}
-
-bool WindowManagerAccessPolicy::IsValidIdForNewWindow(
- const ClientWindowId& id) const {
- // The WindowManager see windows created from other clients. If the WM doesn't
- // use the client id when creating windows the WM could end up with two
- // windows with the same id. Because of this the wm must use the same
- // client id for all windows it creates.
- return WindowIdFromTransportId(id.id).client_id == client_id_;
-}
-
-bool WindowManagerAccessPolicy::WasCreatedByThisClient(
- const ServerWindow* window) const {
- return window->id().client_id == client_id_;
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_manager_access_policy.h b/chromium/components/mus/ws/window_manager_access_policy.h
deleted file mode 100644
index 8b9c6edcec9..00000000000
--- a/chromium/components/mus/ws/window_manager_access_policy.h
+++ /dev/null
@@ -1,76 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_WINDOW_MANAGER_ACCESS_POLICY_H_
-#define COMPONENTS_MUS_WS_WINDOW_MANAGER_ACCESS_POLICY_H_
-
-#include <stdint.h>
-
-#include "base/macros.h"
-#include "components/mus/ws/access_policy.h"
-
-namespace mus {
-namespace ws {
-
-class AccessPolicyDelegate;
-
-class WindowManagerAccessPolicy : public AccessPolicy {
- public:
- WindowManagerAccessPolicy();
- ~WindowManagerAccessPolicy() override;
-
- // AccessPolicy:
- void Init(ClientSpecificId client_id,
- AccessPolicyDelegate* delegate) override;
- bool CanRemoveWindowFromParent(const ServerWindow* window) const override;
- bool CanAddWindow(const ServerWindow* parent,
- const ServerWindow* child) const override;
- bool CanAddTransientWindow(const ServerWindow* parent,
- const ServerWindow* child) const override;
- bool CanRemoveTransientWindowFromParent(
- const ServerWindow* window) const override;
- bool CanSetModal(const ServerWindow* window) const override;
- bool CanReorderWindow(const ServerWindow* window,
- const ServerWindow* relative_window,
- mojom::OrderDirection direction) const override;
- bool CanDeleteWindow(const ServerWindow* window) const override;
- bool CanGetWindowTree(const ServerWindow* window) const override;
- bool CanDescendIntoWindowForWindowTree(
- const ServerWindow* window) const override;
- bool CanEmbed(const ServerWindow* window) const override;
- bool CanChangeWindowVisibility(const ServerWindow* window) const override;
- bool CanChangeWindowOpacity(const ServerWindow* window) const override;
- bool CanSetWindowSurface(const ServerWindow* window,
- mus::mojom::SurfaceType surface_type) const override;
- bool CanSetWindowBounds(const ServerWindow* window) const override;
- bool CanSetWindowProperties(const ServerWindow* window) const override;
- bool CanSetWindowTextInputState(const ServerWindow* window) const override;
- bool CanSetCapture(const ServerWindow* window) const override;
- bool CanSetFocus(const ServerWindow* window) const override;
- bool CanSetClientArea(const ServerWindow* window) const override;
- bool CanSetHitTestMask(const ServerWindow* window) const override;
- bool CanSetCursorProperties(const ServerWindow* window) const override;
- bool ShouldNotifyOnHierarchyChange(
- const ServerWindow* window,
- const ServerWindow** new_parent,
- const ServerWindow** old_parent) const override;
- const ServerWindow* GetWindowForFocusChange(
- const ServerWindow* focused) override;
- bool CanSetWindowManager() const override;
- bool IsValidIdForNewWindow(const ClientWindowId& id) const override;
-
- private:
- bool IsWindowKnown(const ServerWindow* window) const;
- bool WasCreatedByThisClient(const ServerWindow* window) const;
-
- ClientSpecificId client_id_ = 0u;
- AccessPolicyDelegate* delegate_ = nullptr;
-
- DISALLOW_COPY_AND_ASSIGN(WindowManagerAccessPolicy);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_ACCESS_POLICY_H_
diff --git a/chromium/components/mus/ws/window_manager_client_unittest.cc b/chromium/components/mus/ws/window_manager_client_unittest.cc
deleted file mode 100644
index a8049c6b69b..00000000000
--- a/chromium/components/mus/ws/window_manager_client_unittest.cc
+++ /dev/null
@@ -1,1171 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include "base/bind.h"
-#include "base/logging.h"
-#include "base/macros.h"
-#include "base/run_loop.h"
-#include "components/mus/common/util.h"
-#include "components/mus/public/cpp/lib/window_private.h"
-#include "components/mus/public/cpp/tests/window_server_test_base.h"
-#include "components/mus/public/cpp/window_observer.h"
-#include "components/mus/public/cpp/window_tree_client.h"
-#include "components/mus/public/cpp/window_tree_client_delegate.h"
-#include "components/mus/public/cpp/window_tree_client_observer.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace mus {
-namespace ws {
-
-namespace {
-
-Id server_id(mus::Window* window) {
- return WindowPrivate(window).server_id();
-}
-
-mus::Window* GetChildWindowByServerId(WindowTreeClient* client,
- uint32_t id) {
- return client->GetWindowByServerId(id);
-}
-
-int ValidIndexOf(const Window::Children& windows, Window* window) {
- Window::Children::const_iterator it =
- std::find(windows.begin(), windows.end(), window);
- return (it != windows.end()) ? (it - windows.begin()) : -1;
-}
-
-class TestWindowManagerDelegate : public WindowManagerDelegate {
- public:
- TestWindowManagerDelegate() {}
- ~TestWindowManagerDelegate() override {}
-
- // WindowManagerDelegate:
- void SetWindowManagerClient(WindowManagerClient* client) override {}
- bool OnWmSetBounds(Window* window, gfx::Rect* bounds) override {
- return false;
- }
- bool OnWmSetProperty(
- Window* window,
- const std::string& name,
- std::unique_ptr<std::vector<uint8_t>>* new_data) override {
- return true;
- }
- Window* OnWmCreateTopLevelWindow(
- std::map<std::string, std::vector<uint8_t>>* properties) override {
- return nullptr;
- }
- void OnWmClientJankinessChanged(const std::set<Window*>& client_windows,
- bool janky) override {}
- void OnWmNewDisplay(Window* window,
- const display::Display& display) override {}
- void OnAccelerator(uint32_t id, const ui::Event& event) override {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TestWindowManagerDelegate);
-};
-
-class BoundsChangeObserver : public WindowObserver {
- public:
- explicit BoundsChangeObserver(Window* window) : window_(window) {
- window_->AddObserver(this);
- }
- ~BoundsChangeObserver() override { window_->RemoveObserver(this); }
-
- private:
- // Overridden from WindowObserver:
- void OnWindowBoundsChanged(Window* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) override {
- DCHECK_EQ(window, window_);
- EXPECT_TRUE(WindowServerTestBase::QuitRunLoop());
- }
-
- Window* window_;
-
- DISALLOW_COPY_AND_ASSIGN(BoundsChangeObserver);
-};
-
-// Wait until the bounds of the supplied window change; returns false on
-// timeout.
-bool WaitForBoundsToChange(Window* window) {
- BoundsChangeObserver observer(window);
- return WindowServerTestBase::DoRunLoopWithTimeout();
-}
-
-class ClientAreaChangeObserver : public WindowObserver {
- public:
- explicit ClientAreaChangeObserver(Window* window) : window_(window) {
- window_->AddObserver(this);
- }
- ~ClientAreaChangeObserver() override { window_->RemoveObserver(this); }
-
- private:
- // Overridden from WindowObserver:
- void OnWindowClientAreaChanged(
- Window* window,
- const gfx::Insets& old_client_area,
- const std::vector<gfx::Rect>& old_additional_client_areas) override {
- DCHECK_EQ(window, window_);
- EXPECT_TRUE(WindowServerTestBase::QuitRunLoop());
- }
-
- Window* window_;
-
- DISALLOW_COPY_AND_ASSIGN(ClientAreaChangeObserver);
-};
-
-// Wait until the bounds of the supplied window change; returns false on
-// timeout.
-bool WaitForClientAreaToChange(Window* window) {
- ClientAreaChangeObserver observer(window);
- return WindowServerTestBase::DoRunLoopWithTimeout();
-}
-
-// Spins a run loop until the tree beginning at |root| has |tree_size| windows
-// (including |root|).
-class TreeSizeMatchesObserver : public WindowObserver {
- public:
- TreeSizeMatchesObserver(Window* tree, size_t tree_size)
- : tree_(tree), tree_size_(tree_size) {
- tree_->AddObserver(this);
- }
- ~TreeSizeMatchesObserver() override { tree_->RemoveObserver(this); }
-
- bool IsTreeCorrectSize() { return CountWindows(tree_) == tree_size_; }
-
- private:
- // Overridden from WindowObserver:
- void OnTreeChanged(const TreeChangeParams& params) override {
- if (IsTreeCorrectSize())
- EXPECT_TRUE(WindowServerTestBase::QuitRunLoop());
- }
-
- size_t CountWindows(const Window* window) const {
- size_t count = 1;
- Window::Children::const_iterator it = window->children().begin();
- for (; it != window->children().end(); ++it)
- count += CountWindows(*it);
- return count;
- }
-
- Window* tree_;
- size_t tree_size_;
-
- DISALLOW_COPY_AND_ASSIGN(TreeSizeMatchesObserver);
-};
-
-// Wait until |window| has |tree_size| descendants; returns false on timeout.
-// The count includes |window|. For example, if you want to wait for |window| to
-// have a single child, use a |tree_size| of 2.
-bool WaitForTreeSizeToMatch(Window* window, size_t tree_size) {
- TreeSizeMatchesObserver observer(window, tree_size);
- return observer.IsTreeCorrectSize() ||
- WindowServerTestBase::DoRunLoopWithTimeout();
-}
-
-class OrderChangeObserver : public WindowObserver {
- public:
- OrderChangeObserver(Window* window) : window_(window) {
- window_->AddObserver(this);
- }
- ~OrderChangeObserver() override { window_->RemoveObserver(this); }
-
- private:
- // Overridden from WindowObserver:
- void OnWindowReordered(Window* window,
- Window* relative_window,
- mojom::OrderDirection direction) override {
- DCHECK_EQ(window, window_);
- EXPECT_TRUE(WindowServerTestBase::QuitRunLoop());
- }
-
- Window* window_;
-
- DISALLOW_COPY_AND_ASSIGN(OrderChangeObserver);
-};
-
-// Wait until |window|'s tree size matches |tree_size|; returns false on
-// timeout.
-bool WaitForOrderChange(WindowTreeClient* client, Window* window) {
- OrderChangeObserver observer(window);
- return WindowServerTestBase::DoRunLoopWithTimeout();
-}
-
-// Tracks a window's destruction. Query is_valid() for current state.
-class WindowTracker : public WindowObserver {
- public:
- explicit WindowTracker(Window* window) : window_(window) {
- window_->AddObserver(this);
- }
- ~WindowTracker() override {
- if (window_)
- window_->RemoveObserver(this);
- }
-
- bool is_valid() const { return !!window_; }
-
- private:
- // Overridden from WindowObserver:
- void OnWindowDestroyed(Window* window) override {
- DCHECK_EQ(window, window_);
- window_ = nullptr;
- }
-
- Window* window_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowTracker);
-};
-
-} // namespace
-
-// WindowServer
-// -----------------------------------------------------------------
-
-struct EmbedResult {
- EmbedResult(WindowTreeClient* client, ClientSpecificId id)
- : client(client), client_id(id) {}
- EmbedResult() : client(nullptr), client_id(0) {}
-
- WindowTreeClient* client;
-
- // The id supplied to the callback from OnEmbed(). Depending upon the
- // access policy this may or may not match the client id of
- // |client|.
- ClientSpecificId client_id;
-};
-
-Window* GetFirstRoot(WindowTreeClient* client) {
- return client->GetRoots().empty() ? nullptr : *client->GetRoots().begin();
-}
-
-// These tests model synchronization of two peer clients of the window server,
-// that are given access to some root window.
-
-class WindowServerTest : public WindowServerTestBase {
- public:
- WindowServerTest() {}
-
- Window* GetFirstWMRoot() { return GetFirstRoot(window_manager()); }
-
- Window* NewVisibleWindow(Window* parent, WindowTreeClient* client) {
- Window* window = client->NewWindow();
- window->SetVisible(true);
- parent->AddChild(window);
- return window;
- }
-
- // Embeds another version of the test app @ window. This runs a run loop until
- // a response is received, or a timeout. On success the new WindowServer is
- // returned.
- EmbedResult Embed(Window* window) {
- DCHECK(!embed_details_);
- embed_details_.reset(new EmbedDetails);
- window->Embed(ConnectAndGetWindowServerClient(),
- base::Bind(&WindowServerTest::EmbedCallbackImpl,
- base::Unretained(this)));
- embed_details_->waiting = true;
- if (!WindowServerTestBase::DoRunLoopWithTimeout())
- return EmbedResult();
- const EmbedResult result(embed_details_->client,
- embed_details_->client_id);
- embed_details_.reset();
- return result;
- }
-
- // Establishes a connection to this application and asks for a
- // WindowTreeClient.
- mus::mojom::WindowTreeClientPtr ConnectAndGetWindowServerClient() {
- mus::mojom::WindowTreeClientPtr client;
- connector()->ConnectToInterface(test_name(), &client);
- return client;
- }
-
- // WindowServerTestBase:
- void OnEmbed(Window* root) override {
- if (!embed_details_) {
- WindowServerTestBase::OnEmbed(root);
- return;
- }
-
- embed_details_->client = root->window_tree();
- if (embed_details_->callback_run)
- EXPECT_TRUE(WindowServerTestBase::QuitRunLoop());
- }
-
- private:
- // Used to track the state of a call to window->Embed().
- struct EmbedDetails {
- EmbedDetails()
- : callback_run(false),
- result(false),
- waiting(false),
- client(nullptr) {}
-
- // The callback supplied to Embed() was received.
- bool callback_run;
-
- // The boolean supplied to the Embed() callback.
- bool result;
-
- // Whether a MessageLoop is running.
- bool waiting;
-
- // Client id supplied to the Embed() callback.
- ClientSpecificId client_id;
-
- // The WindowTreeClient that resulted from the Embed(). null if |result| is
- // false.
- WindowTreeClient* client;
- };
-
- void EmbedCallbackImpl(bool result) {
- embed_details_->callback_run = true;
- embed_details_->result = result;
- if (embed_details_->waiting && (!result || embed_details_->client))
- EXPECT_TRUE(WindowServerTestBase::QuitRunLoop());
- }
-
- std::unique_ptr<EmbedDetails> embed_details_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowServerTest);
-};
-
-TEST_F(WindowServerTest, RootWindow) {
- ASSERT_NE(nullptr, window_manager());
- EXPECT_EQ(1u, window_manager()->GetRoots().size());
-}
-
-TEST_F(WindowServerTest, Embed) {
- Window* window = window_manager()->NewWindow();
- ASSERT_NE(nullptr, window);
- window->SetVisible(true);
- GetFirstWMRoot()->AddChild(window);
- WindowTreeClient* embedded = Embed(window).client;
- ASSERT_NE(nullptr, embedded);
-
- Window* window_in_embedded = GetFirstRoot(embedded);
- ASSERT_NE(nullptr, window_in_embedded);
- EXPECT_EQ(server_id(window), server_id(window_in_embedded));
- EXPECT_EQ(nullptr, window_in_embedded->parent());
- EXPECT_TRUE(window_in_embedded->children().empty());
-}
-
-// Window manager has two windows, N1 and N11. Embeds A at N1. A should not see
-// N11.
-TEST_F(WindowServerTest, EmbeddedDoesntSeeChild) {
- Window* window = window_manager()->NewWindow();
- ASSERT_NE(nullptr, window);
- window->SetVisible(true);
- GetFirstWMRoot()->AddChild(window);
- Window* nested = window_manager()->NewWindow();
- ASSERT_NE(nullptr, nested);
- nested->SetVisible(true);
- window->AddChild(nested);
-
- WindowTreeClient* embedded = Embed(window).client;
- ASSERT_NE(nullptr, embedded);
- Window* window_in_embedded = GetFirstRoot(embedded);
- EXPECT_EQ(server_id(window), server_id(window_in_embedded));
- EXPECT_EQ(nullptr, window_in_embedded->parent());
- EXPECT_TRUE(window_in_embedded->children().empty());
-}
-
-// TODO(beng): write a replacement test for the one that once existed here:
-// This test validates the following scenario:
-// - a window originating from one client
-// - a window originating from a second client
-// + the client originating the window is destroyed
-// -> the window should still exist (since the second client is live) but
-// should be disconnected from any windows.
-// http://crbug.com/396300
-//
-// TODO(beng): The new test should validate the scenario as described above
-// except that the second client still has a valid tree.
-
-// Verifies that bounds changes applied to a window hierarchy in one client
-// are reflected to another.
-TEST_F(WindowServerTest, SetBounds) {
- Window* window = window_manager()->NewWindow();
- window->SetVisible(true);
- GetFirstWMRoot()->AddChild(window);
- WindowTreeClient* embedded = Embed(window).client;
- ASSERT_NE(nullptr, embedded);
-
- Window* window_in_embedded =
- GetChildWindowByServerId(embedded, server_id(window));
- EXPECT_EQ(window->bounds(), window_in_embedded->bounds());
-
- window->SetBounds(gfx::Rect(0, 0, 100, 100));
- ASSERT_TRUE(WaitForBoundsToChange(window_in_embedded));
- EXPECT_TRUE(window->bounds() == window_in_embedded->bounds());
-}
-
-// Verifies that bounds changes applied to a window owned by a different
-// client can be refused.
-TEST_F(WindowServerTest, SetBoundsSecurity) {
- TestWindowManagerDelegate wm_delegate;
- set_window_manager_delegate(&wm_delegate);
-
- Window* window = window_manager()->NewWindow();
- window->SetVisible(true);
- GetFirstWMRoot()->AddChild(window);
- WindowTreeClient* embedded = Embed(window).client;
- ASSERT_NE(nullptr, embedded);
-
- Window* window_in_embedded =
- GetChildWindowByServerId(embedded, server_id(window));
- window->SetBounds(gfx::Rect(0, 0, 800, 600));
- ASSERT_TRUE(WaitForBoundsToChange(window_in_embedded));
-
- window_in_embedded->SetBounds(gfx::Rect(0, 0, 1024, 768));
- // Bounds change is initially accepted, but the server declines the request.
- EXPECT_FALSE(window->bounds() == window_in_embedded->bounds());
-
- // The client is notified when the requested is declined, and updates the
- // local bounds accordingly.
- ASSERT_TRUE(WaitForBoundsToChange(window_in_embedded));
- EXPECT_TRUE(window->bounds() == window_in_embedded->bounds());
- set_window_manager_delegate(nullptr);
-}
-
-// Verifies that a root window can always be destroyed.
-TEST_F(WindowServerTest, DestroySecurity) {
- Window* window = window_manager()->NewWindow();
- window->SetVisible(true);
- GetFirstWMRoot()->AddChild(window);
-
- WindowTreeClient* embedded = Embed(window).client;
- ASSERT_NE(nullptr, embedded);
-
- // The root can be destroyed, even though it was not created by the client.
- Window* embed_root = GetChildWindowByServerId(embedded, server_id(window));
- WindowTracker tracker1(window);
- WindowTracker tracker2(embed_root);
- embed_root->Destroy();
- EXPECT_FALSE(tracker2.is_valid());
- EXPECT_TRUE(tracker1.is_valid());
-
- window->Destroy();
- EXPECT_FALSE(tracker1.is_valid());
-}
-
-TEST_F(WindowServerTest, MultiRoots) {
- Window* window1 = window_manager()->NewWindow();
- window1->SetVisible(true);
- GetFirstWMRoot()->AddChild(window1);
- Window* window2 = window_manager()->NewWindow();
- window2->SetVisible(true);
- GetFirstWMRoot()->AddChild(window2);
- WindowTreeClient* embedded1 = Embed(window1).client;
- ASSERT_NE(nullptr, embedded1);
- WindowTreeClient* embedded2 = Embed(window2).client;
- ASSERT_NE(nullptr, embedded2);
- EXPECT_NE(embedded1, embedded2);
-}
-
-TEST_F(WindowServerTest, Reorder) {
- Window* window1 = window_manager()->NewWindow();
- window1->SetVisible(true);
- GetFirstWMRoot()->AddChild(window1);
-
- WindowTreeClient* embedded = Embed(window1).client;
- ASSERT_NE(nullptr, embedded);
-
- Window* window11 = embedded->NewWindow();
- window11->SetVisible(true);
- GetFirstRoot(embedded)->AddChild(window11);
- Window* window12 = embedded->NewWindow();
- window12->SetVisible(true);
- GetFirstRoot(embedded)->AddChild(window12);
- ASSERT_TRUE(WaitForTreeSizeToMatch(window1, 3u));
-
- Window* root_in_embedded = GetFirstRoot(embedded);
-
- {
- window11->MoveToFront();
- // The |embedded| tree should be updated immediately.
- EXPECT_EQ(root_in_embedded->children().front(),
- GetChildWindowByServerId(embedded, server_id(window12)));
- EXPECT_EQ(root_in_embedded->children().back(),
- GetChildWindowByServerId(embedded, server_id(window11)));
-
- // The |window_manager()| tree is still not updated.
- EXPECT_EQ(window1->children().back(),
- GetChildWindowByServerId(window_manager(), server_id(window12)));
-
- // Wait until |window_manager()| tree is updated.
- ASSERT_TRUE(WaitForOrderChange(
- window_manager(),
- GetChildWindowByServerId(window_manager(), server_id(window11))));
- EXPECT_EQ(window1->children().front(),
- GetChildWindowByServerId(window_manager(), server_id(window12)));
- EXPECT_EQ(window1->children().back(),
- GetChildWindowByServerId(window_manager(), server_id(window11)));
- }
-
- {
- window11->MoveToBack();
- // |embedded| should be updated immediately.
- EXPECT_EQ(root_in_embedded->children().front(),
- GetChildWindowByServerId(embedded, server_id(window11)));
- EXPECT_EQ(root_in_embedded->children().back(),
- GetChildWindowByServerId(embedded, server_id(window12)));
-
- // |window_manager()| is also eventually updated.
- EXPECT_EQ(window1->children().back(),
- GetChildWindowByServerId(window_manager(), server_id(window11)));
- ASSERT_TRUE(WaitForOrderChange(
- window_manager(),
- GetChildWindowByServerId(window_manager(), server_id(window11))));
- EXPECT_EQ(window1->children().front(),
- GetChildWindowByServerId(window_manager(), server_id(window11)));
- EXPECT_EQ(window1->children().back(),
- GetChildWindowByServerId(window_manager(), server_id(window12)));
- }
-}
-
-namespace {
-
-class VisibilityChangeObserver : public WindowObserver {
- public:
- explicit VisibilityChangeObserver(Window* window) : window_(window) {
- window_->AddObserver(this);
- }
- ~VisibilityChangeObserver() override { window_->RemoveObserver(this); }
-
- private:
- // Overridden from WindowObserver:
- void OnWindowVisibilityChanged(Window* window) override {
- EXPECT_EQ(window, window_);
- EXPECT_TRUE(WindowServerTestBase::QuitRunLoop());
- }
-
- Window* window_;
-
- DISALLOW_COPY_AND_ASSIGN(VisibilityChangeObserver);
-};
-
-} // namespace
-
-TEST_F(WindowServerTest, Visible) {
- Window* window1 = window_manager()->NewWindow();
- window1->SetVisible(true);
- GetFirstWMRoot()->AddChild(window1);
-
- // Embed another app and verify initial state.
- WindowTreeClient* embedded = Embed(window1).client;
- ASSERT_NE(nullptr, embedded);
- ASSERT_NE(nullptr, GetFirstRoot(embedded));
- Window* embedded_root = GetFirstRoot(embedded);
- EXPECT_TRUE(embedded_root->visible());
- EXPECT_TRUE(embedded_root->IsDrawn());
-
- // Change the visible state from the first client and verify its mirrored
- // correctly to the embedded app.
- {
- VisibilityChangeObserver observer(embedded_root);
- window1->SetVisible(false);
- ASSERT_TRUE(WindowServerTestBase::DoRunLoopWithTimeout());
- }
-
- EXPECT_FALSE(window1->visible());
- EXPECT_FALSE(window1->IsDrawn());
-
- EXPECT_FALSE(embedded_root->visible());
- EXPECT_FALSE(embedded_root->IsDrawn());
-
- // Make the node visible again.
- {
- VisibilityChangeObserver observer(embedded_root);
- window1->SetVisible(true);
- ASSERT_TRUE(WindowServerTestBase::DoRunLoopWithTimeout());
- }
-
- EXPECT_TRUE(window1->visible());
- EXPECT_TRUE(window1->IsDrawn());
-
- EXPECT_TRUE(embedded_root->visible());
- EXPECT_TRUE(embedded_root->IsDrawn());
-}
-
-namespace {
-
-class DrawnChangeObserver : public WindowObserver {
- public:
- explicit DrawnChangeObserver(Window* window) : window_(window) {
- window_->AddObserver(this);
- }
- ~DrawnChangeObserver() override { window_->RemoveObserver(this); }
-
- private:
- // Overridden from WindowObserver:
- void OnWindowDrawnChanged(Window* window) override {
- EXPECT_EQ(window, window_);
- EXPECT_TRUE(WindowServerTestBase::QuitRunLoop());
- }
-
- Window* window_;
-
- DISALLOW_COPY_AND_ASSIGN(DrawnChangeObserver);
-};
-
-} // namespace
-
-TEST_F(WindowServerTest, Drawn) {
- Window* window1 = window_manager()->NewWindow();
- window1->SetVisible(true);
- GetFirstWMRoot()->AddChild(window1);
-
- // Embed another app and verify initial state.
- WindowTreeClient* embedded = Embed(window1).client;
- ASSERT_NE(nullptr, embedded);
- ASSERT_NE(nullptr, GetFirstRoot(embedded));
- Window* embedded_root = GetFirstRoot(embedded);
- EXPECT_TRUE(embedded_root->visible());
- EXPECT_TRUE(embedded_root->IsDrawn());
-
- // Change the visibility of the root, this should propagate a drawn state
- // change to |embedded|.
- {
- DrawnChangeObserver observer(embedded_root);
- GetFirstWMRoot()->SetVisible(false);
- ASSERT_TRUE(DoRunLoopWithTimeout());
- }
-
- EXPECT_TRUE(window1->visible());
- EXPECT_FALSE(window1->IsDrawn());
-
- EXPECT_TRUE(embedded_root->visible());
- EXPECT_FALSE(embedded_root->IsDrawn());
-}
-
-// TODO(beng): tests for window event dispatcher.
-// - verify that we see events for all windows.
-
-namespace {
-
-class FocusChangeObserver : public WindowObserver {
- public:
- explicit FocusChangeObserver(Window* window)
- : window_(window),
- last_gained_focus_(nullptr),
- last_lost_focus_(nullptr),
- quit_on_change_(true) {
- window_->AddObserver(this);
- }
- ~FocusChangeObserver() override { window_->RemoveObserver(this); }
-
- void set_quit_on_change(bool value) { quit_on_change_ = value; }
-
- Window* last_gained_focus() { return last_gained_focus_; }
-
- Window* last_lost_focus() { return last_lost_focus_; }
-
- private:
- // Overridden from WindowObserver.
- void OnWindowFocusChanged(Window* gained_focus, Window* lost_focus) override {
- EXPECT_TRUE(!gained_focus || gained_focus->HasFocus());
- EXPECT_FALSE(lost_focus && lost_focus->HasFocus());
- last_gained_focus_ = gained_focus;
- last_lost_focus_ = lost_focus;
- if (quit_on_change_)
- EXPECT_TRUE(WindowServerTestBase::QuitRunLoop());
- }
-
- Window* window_;
- Window* last_gained_focus_;
- Window* last_lost_focus_;
- bool quit_on_change_;
-
- DISALLOW_COPY_AND_ASSIGN(FocusChangeObserver);
-};
-
-class NullFocusChangeObserver : public WindowTreeClientObserver {
- public:
- explicit NullFocusChangeObserver(WindowTreeClient* client)
- : client_(client) {
- client_->AddObserver(this);
- }
- ~NullFocusChangeObserver() override { client_->RemoveObserver(this); }
-
- private:
- // Overridden from WindowTreeClientObserver.
- void OnWindowTreeFocusChanged(Window* gained_focus,
- Window* lost_focus) override {
- if (!gained_focus)
- EXPECT_TRUE(WindowServerTestBase::QuitRunLoop());
- }
-
- WindowTreeClient* client_;
-
- DISALLOW_COPY_AND_ASSIGN(NullFocusChangeObserver);
-};
-
-bool WaitForWindowToHaveFocus(Window* window) {
- if (window->HasFocus())
- return true;
- FocusChangeObserver observer(window);
- return WindowServerTestBase::DoRunLoopWithTimeout();
-}
-
-bool WaitForNoWindowToHaveFocus(WindowTreeClient* client) {
- if (!client->GetFocusedWindow())
- return true;
- NullFocusChangeObserver observer(client);
- return WindowServerTestBase::DoRunLoopWithTimeout();
-}
-
-} // namespace
-
-TEST_F(WindowServerTest, Focus) {
- Window* window1 = window_manager()->NewWindow();
- window1->SetVisible(true);
- GetFirstWMRoot()->AddChild(window1);
-
- WindowTreeClient* embedded = Embed(window1).client;
- ASSERT_NE(nullptr, embedded);
- Window* window11 = embedded->NewWindow();
- window11->SetVisible(true);
- GetFirstRoot(embedded)->AddChild(window11);
-
- {
- // Focus the embed root in |embedded|.
- Window* embedded_root = GetFirstRoot(embedded);
- FocusChangeObserver observer(embedded_root);
- observer.set_quit_on_change(false);
- embedded_root->SetFocus();
- ASSERT_TRUE(embedded_root->HasFocus());
- ASSERT_NE(nullptr, observer.last_gained_focus());
- EXPECT_EQ(server_id(embedded_root),
- server_id(observer.last_gained_focus()));
-
- // |embedded_root| is the same as |window1|, make sure |window1| got
- // focus too.
- ASSERT_TRUE(WaitForWindowToHaveFocus(window1));
- }
-
- // Focus a child of GetFirstRoot(embedded).
- {
- FocusChangeObserver observer(window11);
- observer.set_quit_on_change(false);
- window11->SetFocus();
- ASSERT_TRUE(window11->HasFocus());
- ASSERT_NE(nullptr, observer.last_gained_focus());
- ASSERT_NE(nullptr, observer.last_lost_focus());
- EXPECT_EQ(server_id(window11), server_id(observer.last_gained_focus()));
- EXPECT_EQ(server_id(GetFirstRoot(embedded)),
- server_id(observer.last_lost_focus()));
- }
-
- {
- // Add an observer on the Window that loses focus, and make sure the
- // observer sees the right values.
- FocusChangeObserver observer(window11);
- observer.set_quit_on_change(false);
- GetFirstRoot(embedded)->SetFocus();
- ASSERT_NE(nullptr, observer.last_gained_focus());
- ASSERT_NE(nullptr, observer.last_lost_focus());
- EXPECT_EQ(server_id(window11), server_id(observer.last_lost_focus()));
- EXPECT_EQ(server_id(GetFirstRoot(embedded)),
- server_id(observer.last_gained_focus()));
- }
-}
-
-TEST_F(WindowServerTest, ClearFocus) {
- Window* window1 = window_manager()->NewWindow();
- window1->SetVisible(true);
- GetFirstWMRoot()->AddChild(window1);
-
- WindowTreeClient* embedded = Embed(window1).client;
- ASSERT_NE(nullptr, embedded);
- Window* window11 = embedded->NewWindow();
- window11->SetVisible(true);
- GetFirstRoot(embedded)->AddChild(window11);
-
- // Focus the embed root in |embedded|.
- Window* embedded_root = GetFirstRoot(embedded);
- {
- FocusChangeObserver observer(embedded_root);
- observer.set_quit_on_change(false);
- embedded_root->SetFocus();
- ASSERT_TRUE(embedded_root->HasFocus());
- ASSERT_NE(nullptr, observer.last_gained_focus());
- EXPECT_EQ(server_id(embedded_root),
- server_id(observer.last_gained_focus()));
-
- // |embedded_root| is the same as |window1|, make sure |window1| got
- // focus too.
- ASSERT_TRUE(WaitForWindowToHaveFocus(window1));
- }
-
- {
- FocusChangeObserver observer(window1);
- embedded->ClearFocus();
- ASSERT_FALSE(embedded_root->HasFocus());
- EXPECT_FALSE(embedded->GetFocusedWindow());
-
- ASSERT_TRUE(WindowServerTestBase::DoRunLoopWithTimeout());
- EXPECT_FALSE(window1->HasFocus());
- EXPECT_FALSE(window_manager()->GetFocusedWindow());
- }
-}
-
-TEST_F(WindowServerTest, FocusNonFocusableWindow) {
- Window* window = window_manager()->NewWindow();
- window->SetVisible(true);
- GetFirstWMRoot()->AddChild(window);
-
- WindowTreeClient* client = Embed(window).client;
- ASSERT_NE(nullptr, client);
- ASSERT_FALSE(client->GetRoots().empty());
- Window* client_window = *client->GetRoots().begin();
- client_window->SetCanFocus(false);
-
- client_window->SetFocus();
- ASSERT_TRUE(client_window->HasFocus());
-
- WaitForNoWindowToHaveFocus(client);
- ASSERT_FALSE(client_window->HasFocus());
-}
-
-TEST_F(WindowServerTest, Activation) {
- Window* parent = NewVisibleWindow(GetFirstWMRoot(), window_manager());
-
- // Allow the child windows to be activated. Do this before we wait, that way
- // we're guaranteed that when we request focus from a separate client the
- // requests are processed in order.
- window_manager_client()->AddActivationParent(parent);
-
- Window* child1 = NewVisibleWindow(parent, window_manager());
- Window* child2 = NewVisibleWindow(parent, window_manager());
- Window* child3 = NewVisibleWindow(parent, window_manager());
-
- child1->AddTransientWindow(child3);
-
- WindowTreeClient* embedded1 = Embed(child1).client;
- ASSERT_NE(nullptr, embedded1);
- WindowTreeClient* embedded2 = Embed(child2).client;
- ASSERT_NE(nullptr, embedded2);
-
- Window* child11 = NewVisibleWindow(GetFirstRoot(embedded1), embedded1);
- Window* child21 = NewVisibleWindow(GetFirstRoot(embedded2), embedded2);
-
- WaitForTreeSizeToMatch(parent, 6);
-
- // |child2| and |child3| are stacked about |child1|.
- EXPECT_GT(ValidIndexOf(parent->children(), child2),
- ValidIndexOf(parent->children(), child1));
- EXPECT_GT(ValidIndexOf(parent->children(), child3),
- ValidIndexOf(parent->children(), child1));
-
- // Set focus on |child11|. This should activate |child1|, and raise it over
- // |child2|. But |child3| should still be above |child1| because of
- // transiency.
- child11->SetFocus();
- ASSERT_TRUE(WaitForWindowToHaveFocus(child11));
- ASSERT_TRUE(WaitForWindowToHaveFocus(
- GetChildWindowByServerId(window_manager(), server_id(child11))));
- EXPECT_EQ(server_id(child11),
- server_id(window_manager()->GetFocusedWindow()));
- EXPECT_EQ(server_id(child11), server_id(embedded1->GetFocusedWindow()));
- EXPECT_EQ(nullptr, embedded2->GetFocusedWindow());
- EXPECT_GT(ValidIndexOf(parent->children(), child1),
- ValidIndexOf(parent->children(), child2));
- EXPECT_GT(ValidIndexOf(parent->children(), child3),
- ValidIndexOf(parent->children(), child1));
-
- // Set focus on |child21|. This should activate |child2|, and raise it over
- // |child1|.
- child21->SetFocus();
- ASSERT_TRUE(WaitForWindowToHaveFocus(child21));
- ASSERT_TRUE(WaitForWindowToHaveFocus(
- GetChildWindowByServerId(window_manager(), server_id(child21))));
- EXPECT_EQ(server_id(child21),
- server_id(window_manager()->GetFocusedWindow()));
- EXPECT_EQ(server_id(child21), server_id(embedded2->GetFocusedWindow()));
- EXPECT_TRUE(WaitForNoWindowToHaveFocus(embedded1));
- EXPECT_EQ(nullptr, embedded1->GetFocusedWindow());
- EXPECT_GT(ValidIndexOf(parent->children(), child2),
- ValidIndexOf(parent->children(), child1));
- EXPECT_GT(ValidIndexOf(parent->children(), child3),
- ValidIndexOf(parent->children(), child1));
-}
-
-TEST_F(WindowServerTest, ActivationNext) {
- Window* parent = GetFirstWMRoot();
- Window* child1 = NewVisibleWindow(parent, window_manager());
- Window* child2 = NewVisibleWindow(parent, window_manager());
- Window* child3 = NewVisibleWindow(parent, window_manager());
-
- WindowTreeClient* embedded1 = Embed(child1).client;
- ASSERT_NE(nullptr, embedded1);
- WindowTreeClient* embedded2 = Embed(child2).client;
- ASSERT_NE(nullptr, embedded2);
- WindowTreeClient* embedded3 = Embed(child3).client;
- ASSERT_NE(nullptr, embedded3);
-
- Window* child11 = NewVisibleWindow(GetFirstRoot(embedded1), embedded1);
- Window* child21 = NewVisibleWindow(GetFirstRoot(embedded2), embedded2);
- Window* child31 = NewVisibleWindow(GetFirstRoot(embedded3), embedded3);
- WaitForTreeSizeToMatch(parent, 7);
-
- Window* expecteds[] = { child3, child2, child1, child3, nullptr };
- Window* focused[] = { child31, child21, child11, child31, nullptr };
- for (size_t index = 0; expecteds[index]; ++index) {
- window_manager_client()->ActivateNextWindow();
- WaitForWindowToHaveFocus(focused[index]);
- EXPECT_TRUE(focused[index]->HasFocus());
- EXPECT_EQ(parent->children().back(), expecteds[index]);
- }
-}
-
-namespace {
-
-class DestroyedChangedObserver : public WindowObserver {
- public:
- DestroyedChangedObserver(WindowServerTestBase* test,
- Window* window,
- bool* got_destroy)
- : test_(test), window_(window), got_destroy_(got_destroy) {
- window_->AddObserver(this);
- }
- ~DestroyedChangedObserver() override {
- if (window_)
- window_->RemoveObserver(this);
- }
-
- private:
- // Overridden from WindowObserver:
- void OnWindowDestroyed(Window* window) override {
- EXPECT_EQ(window, window_);
- window_->RemoveObserver(this);
- *got_destroy_ = true;
- window_ = nullptr;
-
- // We should always get OnWindowDestroyed() before
- // OnWindowTreeClientDestroyed().
- EXPECT_FALSE(test_->window_tree_client_destroyed());
- }
-
- WindowServerTestBase* test_;
- Window* window_;
- bool* got_destroy_;
-
- DISALLOW_COPY_AND_ASSIGN(DestroyedChangedObserver);
-};
-
-} // namespace
-
-// Verifies deleting a WindowServer sends the right notifications.
-TEST_F(WindowServerTest, DeleteWindowServer) {
- Window* window = window_manager()->NewWindow();
- ASSERT_NE(nullptr, window);
- window->SetVisible(true);
- GetFirstWMRoot()->AddChild(window);
- WindowTreeClient* client = Embed(window).client;
- ASSERT_TRUE(client);
- bool got_destroy = false;
- DestroyedChangedObserver observer(this, GetFirstRoot(client),
- &got_destroy);
- delete client;
- EXPECT_TRUE(window_tree_client_destroyed());
- EXPECT_TRUE(got_destroy);
-}
-
-// Verifies two Embed()s in the same window trigger deletion of the first
-// WindowServer.
-TEST_F(WindowServerTest, DisconnectTriggersDelete) {
- Window* window = window_manager()->NewWindow();
- ASSERT_NE(nullptr, window);
- window->SetVisible(true);
- GetFirstWMRoot()->AddChild(window);
- WindowTreeClient* client = Embed(window).client;
- EXPECT_NE(client, window_manager());
- Window* embedded_window = client->NewWindow();
- // Embed again, this should trigger disconnect and deletion of client.
- bool got_destroy;
- DestroyedChangedObserver observer(this, embedded_window, &got_destroy);
- EXPECT_FALSE(window_tree_client_destroyed());
- Embed(window);
- EXPECT_TRUE(window_tree_client_destroyed());
-}
-
-class WindowRemovedFromParentObserver : public WindowObserver {
- public:
- explicit WindowRemovedFromParentObserver(Window* window)
- : window_(window), was_removed_(false) {
- window_->AddObserver(this);
- }
- ~WindowRemovedFromParentObserver() override { window_->RemoveObserver(this); }
-
- bool was_removed() const { return was_removed_; }
-
- private:
- // Overridden from WindowObserver:
- void OnTreeChanged(const TreeChangeParams& params) override {
- if (params.target == window_ && !params.new_parent)
- was_removed_ = true;
- }
-
- Window* window_;
- bool was_removed_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowRemovedFromParentObserver);
-};
-
-TEST_F(WindowServerTest, EmbedRemovesChildren) {
- Window* window1 = window_manager()->NewWindow();
- Window* window2 = window_manager()->NewWindow();
- GetFirstWMRoot()->AddChild(window1);
- window1->AddChild(window2);
-
- WindowRemovedFromParentObserver observer(window2);
- window1->Embed(ConnectAndGetWindowServerClient());
- EXPECT_TRUE(observer.was_removed());
- EXPECT_EQ(nullptr, window2->parent());
- EXPECT_TRUE(window1->children().empty());
-
- // Run the message loop so the Embed() call above completes. Without this
- // we may end up reconnecting to the test and rerunning the test, which is
- // problematic since the other services don't shut down.
- ASSERT_TRUE(DoRunLoopWithTimeout());
-}
-
-namespace {
-
-class DestroyObserver : public WindowObserver {
- public:
- DestroyObserver(WindowServerTestBase* test,
- WindowTreeClient* client,
- bool* got_destroy)
- : test_(test), got_destroy_(got_destroy) {
- GetFirstRoot(client)->AddObserver(this);
- }
- ~DestroyObserver() override {}
-
- private:
- // Overridden from WindowObserver:
- void OnWindowDestroyed(Window* window) override {
- *got_destroy_ = true;
- window->RemoveObserver(this);
-
- // We should always get OnWindowDestroyed() before
- // OnWindowManagerDestroyed().
- EXPECT_FALSE(test_->window_tree_client_destroyed());
-
- EXPECT_TRUE(WindowServerTestBase::QuitRunLoop());
- }
-
- WindowServerTestBase* test_;
- bool* got_destroy_;
-
- DISALLOW_COPY_AND_ASSIGN(DestroyObserver);
-};
-
-} // namespace
-
-// Verifies deleting a Window that is the root of another client notifies
-// observers in the right order (OnWindowDestroyed() before
-// OnWindowManagerDestroyed()).
-TEST_F(WindowServerTest, WindowServerDestroyedAfterRootObserver) {
- Window* embed_window = window_manager()->NewWindow();
- GetFirstWMRoot()->AddChild(embed_window);
-
- WindowTreeClient* embedded_client = Embed(embed_window).client;
-
- bool got_destroy = false;
- DestroyObserver observer(this, embedded_client, &got_destroy);
- // Delete the window |embedded_client| is embedded in. This is async,
- // but will eventually trigger deleting |embedded_client|.
- embed_window->Destroy();
- EXPECT_TRUE(DoRunLoopWithTimeout());
- EXPECT_TRUE(got_destroy);
-}
-
-TEST_F(WindowServerTest, ClientAreaChanged) {
- Window* embed_window = window_manager()->NewWindow();
- GetFirstWMRoot()->AddChild(embed_window);
-
- WindowTreeClient* embedded_client = Embed(embed_window).client;
-
- // Verify change from embedded makes it to parent.
- GetFirstRoot(embedded_client)->SetClientArea(gfx::Insets(1, 2, 3, 4));
- ASSERT_TRUE(WaitForClientAreaToChange(embed_window));
- EXPECT_TRUE(gfx::Insets(1, 2, 3, 4) == embed_window->client_area());
-
- // Changing bounds shouldn't effect client area.
- embed_window->SetBounds(gfx::Rect(21, 22, 23, 24));
- WaitForBoundsToChange(GetFirstRoot(embedded_client));
- EXPECT_TRUE(gfx::Rect(21, 22, 23, 24) ==
- GetFirstRoot(embedded_client)->bounds());
- EXPECT_TRUE(gfx::Insets(1, 2, 3, 4) ==
- GetFirstRoot(embedded_client)->client_area());
-}
-
-class EstablishConnectionViaFactoryDelegate : public TestWindowManagerDelegate {
- public:
- explicit EstablishConnectionViaFactoryDelegate(
- WindowTreeClient* client)
- : client_(client), run_loop_(nullptr), created_window_(nullptr) {}
- ~EstablishConnectionViaFactoryDelegate() override {}
-
- bool QuitOnCreate() {
- if (run_loop_)
- return false;
-
- created_window_ = nullptr;
- run_loop_.reset(new base::RunLoop);
- run_loop_->Run();
- run_loop_.reset();
- return created_window_ != nullptr;
- }
-
- Window* created_window() { return created_window_; }
-
- // WindowManagerDelegate:
- Window* OnWmCreateTopLevelWindow(
- std::map<std::string, std::vector<uint8_t>>* properties) override {
- created_window_ = client_->NewWindow(properties);
- (*client_->GetRoots().begin())->AddChild(created_window_);
- if (run_loop_)
- run_loop_->Quit();
- return created_window_;
- }
-
- private:
- WindowTreeClient* client_;
- std::unique_ptr<base::RunLoop> run_loop_;
- Window* created_window_;
-
- DISALLOW_COPY_AND_ASSIGN(EstablishConnectionViaFactoryDelegate);
-};
-
-TEST_F(WindowServerTest, EstablishConnectionViaFactory) {
- EstablishConnectionViaFactoryDelegate delegate(window_manager());
- set_window_manager_delegate(&delegate);
- std::unique_ptr<WindowTreeClient> second_client(
- new WindowTreeClient(this, nullptr, nullptr));
- second_client->ConnectViaWindowTreeFactory(connector());
- Window* window_in_second_client =
- second_client->NewTopLevelWindow(nullptr);
- ASSERT_TRUE(window_in_second_client);
- ASSERT_TRUE(second_client->GetRoots().count(window_in_second_client) >
- 0);
- // Wait for the window to appear in the wm.
- ASSERT_TRUE(delegate.QuitOnCreate());
-
- Window* window_in_wm = delegate.created_window();
- ASSERT_TRUE(window_in_wm);
-
- // Change the bounds in the wm, and make sure the child sees it.
- window_in_wm->SetBounds(gfx::Rect(1, 11, 12, 101));
- ASSERT_TRUE(WaitForBoundsToChange(window_in_second_client));
- EXPECT_EQ(gfx::Rect(1, 11, 12, 101), window_in_second_client->bounds());
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_manager_display_root.cc b/chromium/components/mus/ws/window_manager_display_root.cc
deleted file mode 100644
index 351208d4af6..00000000000
--- a/chromium/components/mus/ws/window_manager_display_root.cc
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_manager_display_root.h"
-
-#include "components/mus/ws/display_manager.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/window_server.h"
-
-namespace mus {
-namespace ws {
-
-WindowManagerDisplayRoot::WindowManagerDisplayRoot(Display* display)
- : display_(display) {
- root_.reset(window_server()->CreateServerWindow(
- window_server()->display_manager()->GetAndAdvanceNextRootId(),
- ServerWindow::Properties()));
- // Our root is always a child of the Display's root. Do this
- // before the WindowTree has been created so that the client doesn't get
- // notified of the add, bounds change and visibility change.
- root_->SetBounds(gfx::Rect(display->root_window()->bounds().size()));
- root_->SetVisible(true);
- display->root_window()->Add(root_.get());
-}
-
-WindowManagerDisplayRoot::~WindowManagerDisplayRoot() {}
-
-WindowServer* WindowManagerDisplayRoot::window_server() {
- return display_->window_server();
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_manager_display_root.h b/chromium/components/mus/ws/window_manager_display_root.h
deleted file mode 100644
index 94eda737201..00000000000
--- a/chromium/components/mus/ws/window_manager_display_root.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_WINDOW_MANAGER_DISPLAY_ROOT_H_
-#define COMPONENTS_MUS_WS_WINDOW_MANAGER_DISPLAY_ROOT_H_
-
-#include <stdint.h>
-
-#include <memory>
-
-#include "base/macros.h"
-
-namespace mus {
-namespace ws {
-
-class Display;
-class ServerWindow;
-class WindowManagerState;
-class WindowServer;
-
-namespace test {
-class WindowManagerDisplayRootTestApi;
-}
-
-// Owns the root window of a window manager for one display. Each window manager
-// has one WindowManagerDisplayRoot for each Display. The root window is
-// parented to the root of a Display.
-class WindowManagerDisplayRoot {
- public:
- explicit WindowManagerDisplayRoot(Display* display);
- ~WindowManagerDisplayRoot();
-
- ServerWindow* root() { return root_.get(); }
- const ServerWindow* root() const { return root_.get(); }
-
- Display* display() { return display_; }
- const Display* display() const { return display_; }
-
- WindowManagerState* window_manager_state() { return window_manager_state_; }
- const WindowManagerState* window_manager_state() const {
- return window_manager_state_;
- }
-
- private:
- friend class Display;
-
- WindowServer* window_server();
-
- Display* display_;
- // Root ServerWindow of this WindowManagerDisplayRoot. |root_| has a parent,
- // the root ServerWindow of the Display.
- std::unique_ptr<ServerWindow> root_;
- WindowManagerState* window_manager_state_ = nullptr;
-
- DISALLOW_COPY_AND_ASSIGN(WindowManagerDisplayRoot);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_DISPLAY_ROOT_H_
diff --git a/chromium/components/mus/ws/window_manager_state.cc b/chromium/components/mus/ws/window_manager_state.cc
deleted file mode 100644
index b394514bef2..00000000000
--- a/chromium/components/mus/ws/window_manager_state.cc
+++ /dev/null
@@ -1,485 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_manager_state.h"
-
-#include "base/memory/weak_ptr.h"
-#include "components/mus/common/event_matcher_util.h"
-#include "components/mus/ws/accelerator.h"
-#include "components/mus/ws/display_manager.h"
-#include "components/mus/ws/platform_display.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/user_display_manager.h"
-#include "components/mus/ws/user_id_tracker.h"
-#include "components/mus/ws/window_manager_display_root.h"
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_tree.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "ui/events/event.h"
-
-namespace mus {
-namespace ws {
-namespace {
-
-// Debug accelerator IDs start far above the highest valid Windows command ID
-// (0xDFFF) and Chrome's highest IDC command ID.
-const uint32_t kPrintWindowsDebugAcceleratorId = 1u << 31;
-
-base::TimeDelta GetDefaultAckTimerDelay() {
-#if defined(NDEBUG)
- return base::TimeDelta::FromMilliseconds(100);
-#else
- return base::TimeDelta::FromMilliseconds(1000);
-#endif
-}
-
-bool EventsCanBeCoalesced(const ui::Event& one, const ui::Event& two) {
- if (one.type() != two.type() || one.flags() != two.flags())
- return false;
-
- // TODO(sad): wheel events can also be merged.
- if (one.type() != ui::ET_POINTER_MOVED)
- return false;
-
- return one.AsPointerEvent()->pointer_id() ==
- two.AsPointerEvent()->pointer_id();
-}
-
-std::unique_ptr<ui::Event> CoalesceEvents(std::unique_ptr<ui::Event> first,
- std::unique_ptr<ui::Event> second) {
- DCHECK(first->type() == ui::ET_POINTER_MOVED)
- << " Non-move events cannot be merged yet.";
- // For mouse moves, the new event just replaces the old event.
- return second;
-}
-
-const ServerWindow* GetEmbedRoot(const ServerWindow* window) {
- DCHECK(window);
- const ServerWindow* embed_root = window->parent();
- while (embed_root && embed_root->id().client_id == window->id().client_id)
- embed_root = embed_root->parent();
- return embed_root;
-}
-
-} // namespace
-
-class WindowManagerState::ProcessedEventTarget {
- public:
- ProcessedEventTarget(ServerWindow* window,
- ClientSpecificId client_id,
- Accelerator* accelerator)
- : client_id_(client_id) {
- tracker_.Add(window);
- if (accelerator)
- accelerator_ = accelerator->GetWeakPtr();
- }
-
- ~ProcessedEventTarget() {}
-
- // Return true if the event is still valid. The event becomes invalid if
- // the window is destroyed while waiting to dispatch.
- bool IsValid() const { return !tracker_.windows().empty(); }
-
- ServerWindow* window() {
- DCHECK(IsValid());
- return tracker_.windows().front();
- }
-
- ClientSpecificId client_id() const { return client_id_; }
-
- base::WeakPtr<Accelerator> accelerator() { return accelerator_; }
-
- private:
- ServerWindowTracker tracker_;
- const ClientSpecificId client_id_;
- base::WeakPtr<Accelerator> accelerator_;
-
- DISALLOW_COPY_AND_ASSIGN(ProcessedEventTarget);
-};
-
-WindowManagerState::QueuedEvent::QueuedEvent() {}
-WindowManagerState::QueuedEvent::~QueuedEvent() {}
-
-WindowManagerState::WindowManagerState(WindowTree* window_tree)
- : window_tree_(window_tree), event_dispatcher_(this), weak_factory_(this) {
- frame_decoration_values_ = mojom::FrameDecorationValues::New();
- frame_decoration_values_->max_title_bar_button_width = 0u;
-
- AddDebugAccelerators();
-}
-
-WindowManagerState::~WindowManagerState() {}
-
-void WindowManagerState::SetFrameDecorationValues(
- mojom::FrameDecorationValuesPtr values) {
- got_frame_decoration_values_ = true;
- frame_decoration_values_ = values.Clone();
- display_manager()
- ->GetUserDisplayManager(user_id())
- ->OnFrameDecorationValuesChanged();
-}
-
-bool WindowManagerState::SetCapture(ServerWindow* window,
- ClientSpecificId client_id) {
- DCHECK(IsActive());
- if (capture_window() == window &&
- client_id == event_dispatcher_.capture_window_client_id()) {
- return true;
- }
-#if !defined(NDEBUG)
- if (window) {
- WindowManagerDisplayRoot* display_root =
- display_manager()->GetWindowManagerDisplayRoot(window);
- DCHECK(display_root && display_root->window_manager_state() == this);
- }
-#endif
- return event_dispatcher_.SetCaptureWindow(window, client_id);
-}
-
-void WindowManagerState::ReleaseCaptureBlockedByModalWindow(
- const ServerWindow* modal_window) {
- event_dispatcher_.ReleaseCaptureBlockedByModalWindow(modal_window);
-}
-
-void WindowManagerState::ReleaseCaptureBlockedByAnyModalWindow() {
- event_dispatcher_.ReleaseCaptureBlockedByAnyModalWindow();
-}
-
-void WindowManagerState::AddSystemModalWindow(ServerWindow* window) {
- DCHECK(!window->transient_parent());
- event_dispatcher_.AddSystemModalWindow(window);
-}
-
-const UserId& WindowManagerState::user_id() const {
- return window_tree_->user_id();
-}
-
-void WindowManagerState::OnWillDestroyTree(WindowTree* tree) {
- if (tree_awaiting_input_ack_ != tree)
- return;
-
- // The WindowTree is dying. So it's not going to ack the event.
- // If the dying tree matches the root |tree_| marked as handled so we don't
- // notify it of accelerators.
- OnEventAck(tree_awaiting_input_ack_, tree == window_tree_
- ? mojom::EventResult::HANDLED
- : mojom::EventResult::UNHANDLED);
-}
-
-bool WindowManagerState::IsActive() const {
- return window_server()->user_id_tracker()->active_id() == user_id();
-}
-
-void WindowManagerState::Activate(const gfx::Point& mouse_location_on_screen) {
- SetAllRootWindowsVisible(true);
- event_dispatcher_.Reset();
- event_dispatcher_.SetMousePointerScreenLocation(mouse_location_on_screen);
-}
-
-void WindowManagerState::Deactivate() {
- SetAllRootWindowsVisible(false);
- event_dispatcher_.Reset();
- // The tree is no longer active, so no point in dispatching any further
- // events.
- std::queue<std::unique_ptr<QueuedEvent>> event_queue;
- event_queue.swap(event_queue_);
-}
-
-void WindowManagerState::ProcessEvent(const ui::Event& event) {
- // If this is still waiting for an ack from a previously sent event, then
- // queue up the event to be dispatched once the ack is received.
- if (event_ack_timer_.IsRunning()) {
- if (!event_queue_.empty() && !event_queue_.back()->processed_target &&
- EventsCanBeCoalesced(*event_queue_.back()->event, event)) {
- event_queue_.back()->event = CoalesceEvents(
- std::move(event_queue_.back()->event), ui::Event::Clone(event));
- return;
- }
- QueueEvent(event, nullptr);
- return;
- }
- event_dispatcher_.ProcessEvent(event);
-}
-
-void WindowManagerState::OnEventAck(mojom::WindowTree* tree,
- mojom::EventResult result) {
- if (tree_awaiting_input_ack_ != tree) {
- // TODO(sad): The ack must have arrived after the timeout. We should do
- // something here, and in OnEventAckTimeout().
- return;
- }
- tree_awaiting_input_ack_ = nullptr;
- event_ack_timer_.Stop();
-
- if (result == mojom::EventResult::UNHANDLED && post_target_accelerator_)
- OnAccelerator(post_target_accelerator_->id(), *event_awaiting_input_ack_);
-
- ProcessNextEventFromQueue();
-}
-
-const WindowServer* WindowManagerState::window_server() const {
- return window_tree_->window_server();
-}
-
-WindowServer* WindowManagerState::window_server() {
- return window_tree_->window_server();
-}
-
-DisplayManager* WindowManagerState::display_manager() {
- return window_tree_->display_manager();
-}
-
-const DisplayManager* WindowManagerState::display_manager() const {
- return window_tree_->display_manager();
-}
-
-void WindowManagerState::SetAllRootWindowsVisible(bool value) {
- for (Display* display : display_manager()->displays()) {
- WindowManagerDisplayRoot* display_root =
- display->GetWindowManagerDisplayRootForUser(user_id());
- if (display_root)
- display_root->root()->SetVisible(value);
- }
-}
-
-ServerWindow* WindowManagerState::GetWindowManagerRoot(ServerWindow* window) {
- for (Display* display : display_manager()->displays()) {
- WindowManagerDisplayRoot* display_root =
- display->GetWindowManagerDisplayRootForUser(user_id());
- if (display_root && display_root->root()->parent() == window)
- return display_root->root();
- }
- NOTREACHED();
- return nullptr;
-}
-
-void WindowManagerState::OnEventAckTimeout(ClientSpecificId client_id) {
- WindowTree* hung_tree = window_server()->GetTreeWithId(client_id);
- if (hung_tree && !hung_tree->janky())
- window_tree_->ClientJankinessChanged(hung_tree);
- OnEventAck(tree_awaiting_input_ack_, mojom::EventResult::UNHANDLED);
-}
-
-void WindowManagerState::QueueEvent(
- const ui::Event& event,
- std::unique_ptr<ProcessedEventTarget> processed_event_target) {
- std::unique_ptr<QueuedEvent> queued_event(new QueuedEvent);
- queued_event->event = ui::Event::Clone(event);
- queued_event->processed_target = std::move(processed_event_target);
- event_queue_.push(std::move(queued_event));
-}
-
-void WindowManagerState::ProcessNextEventFromQueue() {
- // Loop through |event_queue_| stopping after dispatching the first valid
- // event.
- while (!event_queue_.empty()) {
- std::unique_ptr<QueuedEvent> queued_event = std::move(event_queue_.front());
- event_queue_.pop();
- if (!queued_event->processed_target) {
- event_dispatcher_.ProcessEvent(*queued_event->event);
- return;
- }
- if (queued_event->processed_target->IsValid()) {
- DispatchInputEventToWindowImpl(
- queued_event->processed_target->window(),
- queued_event->processed_target->client_id(), *queued_event->event,
- queued_event->processed_target->accelerator());
- return;
- }
- }
-}
-
-void WindowManagerState::DispatchInputEventToWindowImpl(
- ServerWindow* target,
- ClientSpecificId client_id,
- const ui::Event& event,
- base::WeakPtr<Accelerator> accelerator) {
- if (target && target->parent() == nullptr)
- target = GetWindowManagerRoot(target);
-
- if (event.IsMousePointerEvent()) {
- DCHECK(event_dispatcher_.mouse_cursor_source_window());
-
- int32_t cursor_id = 0;
- if (event_dispatcher_.GetCurrentMouseCursor(&cursor_id)) {
- WindowManagerDisplayRoot* display_root =
- display_manager()->GetWindowManagerDisplayRoot(target);
- display_root->display()->UpdateNativeCursor(cursor_id);
- }
- }
-
- WindowTree* tree = window_server()->GetTreeWithId(client_id);
-
- // TOOD(sad): Adjust this delay, possibly make this dynamic.
- const base::TimeDelta max_delay = base::debug::BeingDebugged()
- ? base::TimeDelta::FromDays(1)
- : GetDefaultAckTimerDelay();
- event_ack_timer_.Start(
- FROM_HERE, max_delay,
- base::Bind(&WindowManagerState::OnEventAckTimeout,
- weak_factory_.GetWeakPtr(), tree->id()));
-
- tree_awaiting_input_ack_ = tree;
- if (accelerator) {
- event_awaiting_input_ack_ = ui::Event::Clone(event);
- post_target_accelerator_ = accelerator;
- }
-
- // Ignore |tree| because it will receive the event via normal dispatch.
- window_server()->SendToEventObservers(event, user_id(), tree);
-
- tree->DispatchInputEvent(target, event);
-}
-
-void WindowManagerState::AddDebugAccelerators() {
- // Always register the accelerators, even if they only work in debug, so that
- // keyboard behavior is the same in release and debug builds.
- mojom::EventMatcherPtr matcher = CreateKeyMatcher(
- ui::mojom::KeyboardCode::S, ui::mojom::kEventFlagControlDown |
- ui::mojom::kEventFlagAltDown |
- ui::mojom::kEventFlagShiftDown);
- event_dispatcher_.AddAccelerator(kPrintWindowsDebugAcceleratorId,
- std::move(matcher));
-}
-
-bool WindowManagerState::HandleDebugAccelerator(uint32_t accelerator_id) {
-#if !defined(NDEBUG)
- if (accelerator_id == kPrintWindowsDebugAcceleratorId) {
- // Error so it will be collected in system logs.
- for (Display* display : display_manager()->displays()) {
- WindowManagerDisplayRoot* display_root =
- display->GetWindowManagerDisplayRootForUser(user_id());
- if (display_root) {
- LOG(ERROR) << "ServerWindow hierarchy:\n"
- << display_root->root()->GetDebugWindowHierarchy();
- }
- }
- return true;
- }
-#endif
- return false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// EventDispatcherDelegate:
-
-void WindowManagerState::OnAccelerator(uint32_t accelerator_id,
- const ui::Event& event) {
- DCHECK(IsActive());
- if (HandleDebugAccelerator(accelerator_id))
- return;
- window_tree_->OnAccelerator(accelerator_id, event);
-}
-
-void WindowManagerState::SetFocusedWindowFromEventDispatcher(
- ServerWindow* new_focused_window) {
- DCHECK(IsActive());
- window_server()->SetFocusedWindow(new_focused_window);
-}
-
-ServerWindow* WindowManagerState::GetFocusedWindowForEventDispatcher() {
- return window_server()->GetFocusedWindow();
-}
-
-void WindowManagerState::SetNativeCapture(ServerWindow* window) {
- DCHECK(IsActive());
- WindowManagerDisplayRoot* display_root =
- display_manager()->GetWindowManagerDisplayRoot(window);
- DCHECK(display_root);
- platform_display_with_capture_ = display_root->display()->platform_display();
- platform_display_with_capture_->SetCapture();
-}
-
-void WindowManagerState::ReleaseNativeCapture() {
- // Tests trigger calling this without a corresponding SetNativeCapture().
- // TODO(sky): maybe abstract this away so that DCHECK can be added?
- if (!platform_display_with_capture_)
- return;
-
- platform_display_with_capture_->ReleaseCapture();
- platform_display_with_capture_ = nullptr;
-}
-
-void WindowManagerState::OnServerWindowCaptureLost(ServerWindow* window) {
- DCHECK(window);
- window_server()->ProcessLostCapture(window);
-}
-
-void WindowManagerState::OnMouseCursorLocationChanged(const gfx::Point& point) {
- window_server()
- ->display_manager()
- ->GetUserDisplayManager(user_id())
- ->OnMouseCursorLocationChanged(point);
-}
-
-void WindowManagerState::DispatchInputEventToWindow(ServerWindow* target,
- ClientSpecificId client_id,
- const ui::Event& event,
- Accelerator* accelerator) {
- DCHECK(IsActive());
- // TODO(sky): this needs to see if another wms has capture and if so forward
- // to it.
- if (event_ack_timer_.IsRunning()) {
- std::unique_ptr<ProcessedEventTarget> processed_event_target(
- new ProcessedEventTarget(target, client_id, accelerator));
- QueueEvent(event, std::move(processed_event_target));
- return;
- }
-
- base::WeakPtr<Accelerator> weak_accelerator;
- if (accelerator)
- weak_accelerator = accelerator->GetWeakPtr();
- DispatchInputEventToWindowImpl(target, client_id, event, weak_accelerator);
-}
-
-ClientSpecificId WindowManagerState::GetEventTargetClientId(
- const ServerWindow* window,
- bool in_nonclient_area) {
- // If the event is in the non-client area the event goes to the owner of
- // the window.
- WindowTree* tree = nullptr;
- if (in_nonclient_area) {
- tree = window_server()->GetTreeWithId(window->id().client_id);
- } else {
- // If the window is an embed root, forward to the embedded window.
- tree = window_server()->GetTreeWithRoot(window);
- if (!tree)
- tree = window_server()->GetTreeWithId(window->id().client_id);
- }
-
- const ServerWindow* embed_root =
- tree->HasRoot(window) ? window : GetEmbedRoot(window);
- while (tree && tree->embedder_intercepts_events()) {
- DCHECK(tree->HasRoot(embed_root));
- tree = window_server()->GetTreeWithId(embed_root->id().client_id);
- embed_root = GetEmbedRoot(embed_root);
- }
-
- if (!tree) {
- DCHECK(in_nonclient_area);
- tree = window_tree_;
- }
- return tree->id();
-}
-
-ServerWindow* WindowManagerState::GetRootWindowContaining(
- const gfx::Point& location) {
- if (display_manager()->displays().empty())
- return nullptr;
-
- // TODO(sky): this isn't right. To correctly implement need bounds of
- // Display, which we aren't tracking yet. For now, use the first display.
- Display* display = *(display_manager()->displays().begin());
- WindowManagerDisplayRoot* display_root =
- display->GetWindowManagerDisplayRootForUser(user_id());
- return display_root ? display_root->root() : nullptr;
-}
-
-void WindowManagerState::OnEventTargetNotFound(const ui::Event& event) {
- window_server()->SendToEventObservers(event, user_id(),
- nullptr /* ignore_tree */);
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_manager_state.h b/chromium/components/mus/ws/window_manager_state.h
deleted file mode 100644
index dca6670d400..00000000000
--- a/chromium/components/mus/ws/window_manager_state.h
+++ /dev/null
@@ -1,183 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_
-#define COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_
-
-#include <stdint.h>
-
-#include <memory>
-
-#include "base/memory/weak_ptr.h"
-#include "base/timer/timer.h"
-#include "components/mus/public/interfaces/display.mojom.h"
-#include "components/mus/ws/event_dispatcher.h"
-#include "components/mus/ws/event_dispatcher_delegate.h"
-#include "components/mus/ws/user_id.h"
-#include "components/mus/ws/window_server.h"
-
-namespace mus {
-namespace ws {
-
-class DisplayManager;
-class WindowTree;
-
-namespace test {
-class WindowManagerStateTestApi;
-}
-
-// Manages state specific to a WindowManager that is shared across displays.
-// WindowManagerState is owned by the WindowTree the window manager is
-// associated with.
-class WindowManagerState : public EventDispatcherDelegate {
- public:
- explicit WindowManagerState(WindowTree* window_tree);
- ~WindowManagerState() override;
-
- const UserId& user_id() const;
-
- WindowTree* window_tree() { return window_tree_; }
- const WindowTree* window_tree() const { return window_tree_; }
-
- void OnWillDestroyTree(WindowTree* tree);
-
- void SetFrameDecorationValues(mojom::FrameDecorationValuesPtr values);
- const mojom::FrameDecorationValues& frame_decoration_values() const {
- return *frame_decoration_values_;
- }
- bool got_frame_decoration_values() const {
- return got_frame_decoration_values_;
- }
-
- bool SetCapture(ServerWindow* window, ClientSpecificId client_id);
- ServerWindow* capture_window() { return event_dispatcher_.capture_window(); }
- const ServerWindow* capture_window() const {
- return event_dispatcher_.capture_window();
- }
-
- void ReleaseCaptureBlockedByModalWindow(const ServerWindow* modal_window);
- void ReleaseCaptureBlockedByAnyModalWindow();
-
- void AddSystemModalWindow(ServerWindow* window);
-
- // TODO(sky): EventDispatcher is really an implementation detail and should
- // not be exposed.
- EventDispatcher* event_dispatcher() { return &event_dispatcher_; }
-
- // Returns true if this is the WindowManager of the active user.
- bool IsActive() const;
-
- void Activate(const gfx::Point& mouse_location_on_screen);
- void Deactivate();
-
- // Processes an event from PlatformDisplay.
- void ProcessEvent(const ui::Event& event);
-
- // Called when the ack from an event dispatched to WindowTree |tree| is
- // received.
- // TODO(sky): make this private and use a callback.
- void OnEventAck(mojom::WindowTree* tree, mojom::EventResult result);
-
- private:
- class ProcessedEventTarget;
- friend class Display;
- friend class test::WindowManagerStateTestApi;
-
- // There are two types of events that may be queued, both occur only when
- // waiting for an ack from a client.
- // . We get an event from the PlatformDisplay. This results in |event| being
- // set, but |processed_target| is null.
- // . We get an event from the EventDispatcher. In this case both |event| and
- // |processed_target| are valid.
- // The second case happens if EventDispatcher generates more than one event
- // at a time.
- struct QueuedEvent {
- QueuedEvent();
- ~QueuedEvent();
-
- std::unique_ptr<ui::Event> event;
- std::unique_ptr<ProcessedEventTarget> processed_target;
- };
-
- const WindowServer* window_server() const;
- WindowServer* window_server();
-
- DisplayManager* display_manager();
- const DisplayManager* display_manager() const;
-
- // Sets the visibility of all window manager roots windows to |value|.
- void SetAllRootWindowsVisible(bool value);
-
- // Returns the ServerWindow that is the root of the WindowManager for
- // |window|. |window| corresponds to the root of a Display.
- ServerWindow* GetWindowManagerRoot(ServerWindow* window);
-
- void OnEventAckTimeout(ClientSpecificId client_id);
-
- // Schedules an event to be processed later.
- void QueueEvent(const ui::Event& event,
- std::unique_ptr<ProcessedEventTarget> processed_event_target);
-
- // Processes the next valid event in |event_queue_|. If the event has already
- // been processed it is dispatched, otherwise the event is passed to the
- // EventDispatcher for processing.
- void ProcessNextEventFromQueue();
-
- // Dispatches the event to the appropriate client and starts the ack timer.
- void DispatchInputEventToWindowImpl(ServerWindow* target,
- ClientSpecificId client_id,
- const ui::Event& event,
- base::WeakPtr<Accelerator> accelerator);
-
- // Registers accelerators used internally for debugging.
- void AddDebugAccelerators();
-
- // Returns true if the accelerator was handled.
- bool HandleDebugAccelerator(uint32_t accelerator_id);
-
- // EventDispatcherDelegate:
- void OnAccelerator(uint32_t accelerator_id, const ui::Event& event) override;
- void SetFocusedWindowFromEventDispatcher(ServerWindow* window) override;
- ServerWindow* GetFocusedWindowForEventDispatcher() override;
- void SetNativeCapture(ServerWindow* window) override;
- void ReleaseNativeCapture() override;
- void OnServerWindowCaptureLost(ServerWindow* window) override;
- void OnMouseCursorLocationChanged(const gfx::Point& point) override;
- void DispatchInputEventToWindow(ServerWindow* target,
- ClientSpecificId client_id,
- const ui::Event& event,
- Accelerator* accelerator) override;
- ClientSpecificId GetEventTargetClientId(const ServerWindow* window,
- bool in_nonclient_area) override;
- ServerWindow* GetRootWindowContaining(const gfx::Point& location) override;
- void OnEventTargetNotFound(const ui::Event& event) override;
-
- // The single WindowTree this WindowManagerState is associated with.
- // |window_tree_| owns this.
- WindowTree* window_tree_;
-
- // Set to true the first time SetFrameDecorationValues() is called.
- bool got_frame_decoration_values_ = false;
- mojom::FrameDecorationValuesPtr frame_decoration_values_;
-
- mojom::WindowTree* tree_awaiting_input_ack_ = nullptr;
- std::unique_ptr<ui::Event> event_awaiting_input_ack_;
- base::WeakPtr<Accelerator> post_target_accelerator_;
- std::queue<std::unique_ptr<QueuedEvent>> event_queue_;
- base::OneShotTimer event_ack_timer_;
-
- EventDispatcher event_dispatcher_;
-
- // PlatformDisplay that currently has capture.
- PlatformDisplay* platform_display_with_capture_ = nullptr;
-
- base::WeakPtrFactory<WindowManagerState> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowManagerState);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_STATE_H_
diff --git a/chromium/components/mus/ws/window_manager_state_unittest.cc b/chromium/components/mus/ws/window_manager_state_unittest.cc
deleted file mode 100644
index 20980f75b4c..00000000000
--- a/chromium/components/mus/ws/window_manager_state_unittest.cc
+++ /dev/null
@@ -1,419 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_manager_state.h"
-
-#include <memory>
-
-#include "base/macros.h"
-#include "base/memory/ptr_util.h"
-#include "base/memory/ref_counted.h"
-#include "base/test/test_simple_task_runner.h"
-#include "base/threading/thread_task_runner_handle.h"
-#include "components/mus/common/event_matcher_util.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "components/mus/ws/accelerator.h"
-#include "components/mus/ws/display.h"
-#include "components/mus/ws/display_binding.h"
-#include "components/mus/ws/platform_display.h"
-#include "components/mus/ws/platform_display_init_params.h"
-#include "components/mus/ws/server_window_surface_manager_test_api.h"
-#include "components/mus/ws/test_change_tracker.h"
-#include "components/mus/ws/test_server_window_delegate.h"
-#include "components/mus/ws/test_utils.h"
-#include "components/mus/ws/window_manager_access_policy.h"
-#include "components/mus/ws/window_manager_display_root.h"
-#include "components/mus/ws/window_manager_state.h"
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_tree.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/events/event.h"
-
-namespace mus {
-namespace ws {
-namespace test {
-
-class WindowManagerStateTest : public testing::Test {
- public:
- WindowManagerStateTest();
- ~WindowManagerStateTest() override {}
-
- std::unique_ptr<Accelerator> CreateAccelerator();
-
- // Creates a child |server_window| with associataed |window_tree| and
- // |test_client|. The window is setup for processing input.
- void CreateSecondaryTree(TestWindowTreeClient** test_client,
- WindowTree** window_tree,
- ServerWindow** server_window);
-
- void DispatchInputEventToWindow(ServerWindow* target,
- const ui::Event& event,
- Accelerator* accelerator);
- void OnEventAckTimeout(ClientSpecificId client_id);
-
- WindowTree* tree() {
- return window_event_targeting_helper_.window_server()->GetTreeWithId(1);
- }
- WindowTree* window_tree() { return window_tree_; }
- TestWindowTreeClient* window_tree_client() { return window_tree_client_; }
- ServerWindow* window() { return window_; }
- TestWindowManager* window_manager() { return &window_manager_; }
- TestWindowTreeClient* wm_client() {
- return window_event_targeting_helper_.wm_client();
- }
- TestWindowTreeClient* last_tree_client() {
- return window_event_targeting_helper_.last_window_tree_client();
- }
- WindowTree* last_tree() {
- return window_event_targeting_helper_.last_binding()->tree();
- }
- WindowManagerState* window_manager_state() { return window_manager_state_; }
-
- void EmbedAt(WindowTree* tree,
- const ClientWindowId& embed_window_id,
- uint32_t embed_flags,
- WindowTree** embed_tree,
- TestWindowTreeClient** embed_client_proxy) {
- mojom::WindowTreeClientPtr embed_client;
- mojom::WindowTreeClientRequest client_request = GetProxy(&embed_client);
- ASSERT_TRUE(
- tree->Embed(embed_window_id, std::move(embed_client), embed_flags));
- TestWindowTreeClient* client =
- window_event_targeting_helper_.last_window_tree_client();
- ASSERT_EQ(1u, client->tracker()->changes()->size());
- EXPECT_EQ(CHANGE_TYPE_EMBED, (*client->tracker()->changes())[0].type);
- client->tracker()->changes()->clear();
- *embed_client_proxy = client;
- *embed_tree = window_event_targeting_helper_.last_binding()->tree();
- }
-
- // testing::Test:
- void SetUp() override;
-
- private:
- WindowEventTargetingHelper window_event_targeting_helper_;
-
- WindowManagerState* window_manager_state_;
-
- // Handles WindowStateManager ack timeouts.
- scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
- TestWindowManager window_manager_;
- ServerWindow* window_ = nullptr;
- WindowTree* window_tree_ = nullptr;
- TestWindowTreeClient* window_tree_client_ = nullptr;
-
- DISALLOW_COPY_AND_ASSIGN(WindowManagerStateTest);
-};
-
-WindowManagerStateTest::WindowManagerStateTest()
- : task_runner_(new base::TestSimpleTaskRunner) {}
-
-std::unique_ptr<Accelerator> WindowManagerStateTest::CreateAccelerator() {
- mojom::EventMatcherPtr matcher = mus::CreateKeyMatcher(
- ui::mojom::KeyboardCode::W, ui::mojom::kEventFlagControlDown);
- matcher->accelerator_phase = ui::mojom::AcceleratorPhase::POST_TARGET;
- uint32_t accelerator_id = 1;
- std::unique_ptr<Accelerator> accelerator(
- new Accelerator(accelerator_id, *matcher));
- return accelerator;
-}
-
-void WindowManagerStateTest::CreateSecondaryTree(
- TestWindowTreeClient** test_client,
- WindowTree** window_tree,
- ServerWindow** server_window) {
- window_event_targeting_helper_.CreateSecondaryTree(
- window_, gfx::Rect(20, 20, 20, 20), test_client, window_tree,
- server_window);
-}
-
-void WindowManagerStateTest::DispatchInputEventToWindow(
- ServerWindow* target,
- const ui::Event& event,
- Accelerator* accelerator) {
- WindowManagerStateTestApi test_api(window_manager_state_);
- ClientSpecificId client_id = test_api.GetEventTargetClientId(target, false);
- test_api.DispatchInputEventToWindow(target, client_id, event, accelerator);
-}
-
-void WindowManagerStateTest::OnEventAckTimeout(
- ClientSpecificId client_id) {
- WindowManagerStateTestApi test_api(window_manager_state_);
- test_api.OnEventAckTimeout(client_id);
-}
-
-void WindowManagerStateTest::SetUp() {
- window_event_targeting_helper_.SetTaskRunner(task_runner_);
- window_manager_state_ = window_event_targeting_helper_.display()
- ->GetActiveWindowManagerDisplayRoot()
- ->window_manager_state();
- window_ = window_event_targeting_helper_.CreatePrimaryTree(
- gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 50, 50));
- window_tree_ = window_event_targeting_helper_.last_binding()->tree();
- window_tree_client_ =
- window_event_targeting_helper_.last_window_tree_client();
- DCHECK(window_tree_->HasRoot(window_));
-
- WindowTreeTestApi(tree()).set_window_manager_internal(&window_manager_);
- wm_client()->tracker()->changes()->clear();
- window_tree_client_->tracker()->changes()->clear();
-}
-
-// Tests that when an event is dispatched with no accelerator, that post target
-// accelerator is not triggered.
-TEST_F(WindowManagerStateTest, NullAccelerator) {
- WindowManagerState* state = window_manager_state();
- EXPECT_TRUE(state);
-
- ServerWindow* target = window();
- ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN);
- DispatchInputEventToWindow(target, key, nullptr);
- WindowTree* target_tree = window_tree();
- TestChangeTracker* tracker = window_tree_client()->tracker();
- ASSERT_EQ(1u, tracker->changes()->size());
- EXPECT_EQ("InputEvent window=1,1 event_action=7",
- ChangesToDescription1(*tracker->changes())[0]);
-
- WindowTreeTestApi(target_tree).AckOldestEvent();
- EXPECT_FALSE(window_manager()->on_accelerator_called());
-}
-
-// Tests that when a post target accelerator is provided on an event, that it is
-// called on ack.
-TEST_F(WindowManagerStateTest, PostTargetAccelerator) {
- ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN);
- std::unique_ptr<Accelerator> accelerator = CreateAccelerator();
-
- ServerWindow* target = window();
- DispatchInputEventToWindow(target, key, accelerator.get());
- TestChangeTracker* tracker = window_tree_client()->tracker();
- ASSERT_EQ(1u, tracker->changes()->size());
- EXPECT_EQ("InputEvent window=1,1 event_action=7",
- ChangesToDescription1(*tracker->changes())[0]);
-
- WindowTreeTestApi(window_tree()).AckOldestEvent();
- EXPECT_TRUE(window_manager()->on_accelerator_called());
- EXPECT_EQ(accelerator->id(), window_manager()->on_accelerator_id());
-}
-
-// Tests that when a client handles an event that post target accelerators are
-// not called.
-TEST_F(WindowManagerStateTest, ClientHandlesEvent) {
- ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN);
- std::unique_ptr<Accelerator> accelerator = CreateAccelerator();
-
- ServerWindow* target = window();
- DispatchInputEventToWindow(target, key, accelerator.get());
- TestChangeTracker* tracker = window_tree_client()->tracker();
- ASSERT_EQ(1u, tracker->changes()->size());
- EXPECT_EQ("InputEvent window=1,1 event_action=7",
- ChangesToDescription1(*tracker->changes())[0]);
-
- window_manager_state()->OnEventAck(tree(), mojom::EventResult::HANDLED);
- EXPECT_FALSE(window_manager()->on_accelerator_called());
-}
-
-// Tests that when an accelerator is deleted before an ack, that it is not
-// called.
-TEST_F(WindowManagerStateTest, AcceleratorDeleted) {
- ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN);
- std::unique_ptr<Accelerator> accelerator(CreateAccelerator());
-
- ServerWindow* target = window();
- DispatchInputEventToWindow(target, key, accelerator.get());
- TestChangeTracker* tracker = window_tree_client()->tracker();
- ASSERT_EQ(1u, tracker->changes()->size());
- EXPECT_EQ("InputEvent window=1,1 event_action=7",
- ChangesToDescription1(*tracker->changes())[0]);
-
- accelerator.reset();
- window_manager_state()->OnEventAck(tree(), mojom::EventResult::UNHANDLED);
- EXPECT_FALSE(window_manager()->on_accelerator_called());
-}
-
-// Tests that a events arriving before an ack don't notify the tree until the
-// ack arrives, and that the correct accelerator is called.
-TEST_F(WindowManagerStateTest, EnqueuedAccelerators) {
- ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN);
- std::unique_ptr<Accelerator> accelerator(CreateAccelerator());
-
- ServerWindow* target = window();
- DispatchInputEventToWindow(target, key, accelerator.get());
- TestChangeTracker* tracker = window_tree_client()->tracker();
- ASSERT_EQ(1u, tracker->changes()->size());
- EXPECT_EQ("InputEvent window=1,1 event_action=7",
- ChangesToDescription1(*tracker->changes())[0]);
-
- tracker->changes()->clear();
- ui::KeyEvent key2(ui::ET_KEY_PRESSED, ui::VKEY_Y, ui::EF_CONTROL_DOWN);
- mojom::EventMatcherPtr matcher = mus::CreateKeyMatcher(
- ui::mojom::KeyboardCode::Y, ui::mojom::kEventFlagControlDown);
- matcher->accelerator_phase = ui::mojom::AcceleratorPhase::POST_TARGET;
- uint32_t accelerator_id = 2;
- std::unique_ptr<Accelerator> accelerator2(
- new Accelerator(accelerator_id, *matcher));
- DispatchInputEventToWindow(target, key2, accelerator2.get());
- EXPECT_TRUE(tracker->changes()->empty());
-
- WindowTreeTestApi(window_tree()).AckOldestEvent();
- ASSERT_EQ(1u, tracker->changes()->size());
- EXPECT_EQ("InputEvent window=1,1 event_action=7",
- ChangesToDescription1(*tracker->changes())[0]);
- EXPECT_TRUE(window_manager()->on_accelerator_called());
- EXPECT_EQ(accelerator->id(), window_manager()->on_accelerator_id());
-}
-
-// Tests that the accelerator is not sent when the tree is dying.
-TEST_F(WindowManagerStateTest, DeleteTree) {
- ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN);
- std::unique_ptr<Accelerator> accelerator = CreateAccelerator();
-
- ServerWindow* target = window();
- DispatchInputEventToWindow(target, key, accelerator.get());
- TestChangeTracker* tracker = window_tree_client()->tracker();
- ASSERT_EQ(1u, tracker->changes()->size());
- EXPECT_EQ("InputEvent window=1,1 event_action=7",
- ChangesToDescription1(*tracker->changes())[0]);
-
- window_manager_state()->OnWillDestroyTree(tree());
- EXPECT_FALSE(window_manager()->on_accelerator_called());
-}
-
-// Tests that if a tree is destroyed before acking, that the accelerator is
-// still sent if it is not the root tree.
-TEST_F(WindowManagerStateTest, DeleteNonRootTree) {
- TestWindowTreeClient* embed_connection = nullptr;
- WindowTree* target_tree = nullptr;
- ServerWindow* target = nullptr;
- CreateSecondaryTree(&embed_connection, &target_tree, &target);
- TestWindowManager target_window_manager;
- WindowTreeTestApi(target_tree)
- .set_window_manager_internal(&target_window_manager);
-
- ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN);
- std::unique_ptr<Accelerator> accelerator = CreateAccelerator();
- DispatchInputEventToWindow(target, key, accelerator.get());
- TestChangeTracker* tracker = embed_connection->tracker();
- ASSERT_EQ(1u, tracker->changes()->size());
- EXPECT_EQ("InputEvent window=2,1 event_action=7",
- ChangesToDescription1(*tracker->changes())[0]);
- EXPECT_TRUE(wm_client()->tracker()->changes()->empty());
-
- window_manager_state()->OnWillDestroyTree(target_tree);
- EXPECT_FALSE(target_window_manager.on_accelerator_called());
- EXPECT_TRUE(window_manager()->on_accelerator_called());
-}
-
-// Tests that when an ack times out that the accelerator is notified.
-TEST_F(WindowManagerStateTest, AckTimeout) {
- ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN);
- std::unique_ptr<Accelerator> accelerator = CreateAccelerator();
- DispatchInputEventToWindow(window(), key, accelerator.get());
- TestChangeTracker* tracker = window_tree_client()->tracker();
- ASSERT_EQ(1u, tracker->changes()->size());
- EXPECT_EQ("InputEvent window=1,1 event_action=7",
- ChangesToDescription1(*tracker->changes())[0]);
-
- OnEventAckTimeout(window()->id().client_id);
- EXPECT_TRUE(window_manager()->on_accelerator_called());
- EXPECT_EQ(accelerator->id(), window_manager()->on_accelerator_id());
-}
-
-TEST_F(WindowManagerStateTest, InterceptingEmbedderReceivesEvents) {
- WindowTree* embedder_tree = tree();
- ServerWindow* embedder_root = window();
- const ClientWindowId embed_window_id(
- WindowIdToTransportId(WindowId(embedder_tree->id(), 12)));
- embedder_tree->NewWindow(embed_window_id, ServerWindow::Properties());
- ServerWindow* embedder_window =
- embedder_tree->GetWindowByClientId(embed_window_id);
- ASSERT_TRUE(embedder_tree->AddWindow(
- ClientWindowId(WindowIdToTransportId(embedder_root->id())),
- embed_window_id));
-
- TestWindowTreeClient* embedder_client = wm_client();
-
- {
- // Do a normal embed.
- const uint32_t embed_flags = 0;
- WindowTree* embed_tree = nullptr;
- TestWindowTreeClient* embed_client_proxy = nullptr;
- EmbedAt(embedder_tree, embed_window_id, embed_flags, &embed_tree,
- &embed_client_proxy);
- ASSERT_TRUE(embed_client_proxy);
-
- // Send an event to the embed window. It should go to the embedded client.
- ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(),
- base::TimeTicks(), 0, 0);
- DispatchInputEventToWindow(embedder_window, mouse, nullptr);
- ASSERT_EQ(1u, embed_client_proxy->tracker()->changes()->size());
- EXPECT_EQ(CHANGE_TYPE_INPUT_EVENT,
- (*embed_client_proxy->tracker()->changes())[0].type);
- WindowTreeTestApi(embed_tree).AckLastEvent(mojom::EventResult::UNHANDLED);
- embed_client_proxy->tracker()->changes()->clear();
- }
-
- {
- // Do an embed where the embedder wants to intercept events to the embedded
- // tree.
- const uint32_t embed_flags = mojom::kEmbedFlagEmbedderInterceptsEvents;
- WindowTree* embed_tree = nullptr;
- TestWindowTreeClient* embed_client_proxy = nullptr;
- EmbedAt(embedder_tree, embed_window_id, embed_flags, &embed_tree,
- &embed_client_proxy);
- ASSERT_TRUE(embed_client_proxy);
- embedder_client->tracker()->changes()->clear();
-
- // Send an event to the embed window. But this time, it should reach the
- // embedder.
- ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(),
- base::TimeTicks(), 0, 0);
- DispatchInputEventToWindow(embedder_window, mouse, nullptr);
- ASSERT_EQ(0u, embed_client_proxy->tracker()->changes()->size());
- ASSERT_EQ(1u, embedder_client->tracker()->changes()->size());
- EXPECT_EQ(CHANGE_TYPE_INPUT_EVENT,
- (*embedder_client->tracker()->changes())[0].type);
- WindowTreeTestApi(embedder_tree)
- .AckLastEvent(mojom::EventResult::UNHANDLED);
- embedder_client->tracker()->changes()->clear();
-
- // Embed another tree in the embedded tree.
- const ClientWindowId nested_embed_window_id(
- WindowIdToTransportId(WindowId(embed_tree->id(), 23)));
- embed_tree->NewWindow(nested_embed_window_id, ServerWindow::Properties());
- const ClientWindowId embed_root_id(
- WindowIdToTransportId((*embed_tree->roots().begin())->id()));
- ASSERT_TRUE(embed_tree->AddWindow(embed_root_id, nested_embed_window_id));
-
- WindowTree* nested_embed_tree = nullptr;
- TestWindowTreeClient* nested_embed_client_proxy = nullptr;
- EmbedAt(embed_tree, nested_embed_window_id, embed_flags, &nested_embed_tree,
- &nested_embed_client_proxy);
- ASSERT_TRUE(nested_embed_client_proxy);
- embed_client_proxy->tracker()->changes()->clear();
- embedder_client->tracker()->changes()->clear();
-
- // Send an event to the nested embed window. The event should still reach
- // the outermost embedder.
- ServerWindow* nested_embed_window =
- embed_tree->GetWindowByClientId(nested_embed_window_id);
- DCHECK(nested_embed_window->parent());
- mouse = ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(), gfx::Point(),
- base::TimeTicks(), 0, 0);
- DispatchInputEventToWindow(nested_embed_window, mouse, nullptr);
- ASSERT_EQ(0u, nested_embed_client_proxy->tracker()->changes()->size());
- ASSERT_EQ(0u, embed_client_proxy->tracker()->changes()->size());
-
- ASSERT_EQ(1u, embedder_client->tracker()->changes()->size());
- EXPECT_EQ(CHANGE_TYPE_INPUT_EVENT,
- (*embedder_client->tracker()->changes())[0].type);
- WindowTreeTestApi(embedder_tree)
- .AckLastEvent(mojom::EventResult::UNHANDLED);
- }
-}
-
-} // namespace test
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_manager_window_tree_factory.cc b/chromium/components/mus/ws/window_manager_window_tree_factory.cc
deleted file mode 100644
index a851092bd48..00000000000
--- a/chromium/components/mus/ws/window_manager_window_tree_factory.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_manager_window_tree_factory.h"
-
-#include "base/bind.h"
-#include "components/mus/ws/window_manager_window_tree_factory_set.h"
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_tree.h"
-
-namespace mus {
-namespace ws {
-
-WindowManagerWindowTreeFactory::WindowManagerWindowTreeFactory(
- WindowManagerWindowTreeFactorySet* window_manager_window_tree_factory_set,
- const UserId& user_id,
- mojo::InterfaceRequest<mojom::WindowManagerWindowTreeFactory> request)
- : window_manager_window_tree_factory_set_(
- window_manager_window_tree_factory_set),
- user_id_(user_id),
- binding_(this),
- window_tree_(nullptr) {
- if (request.is_pending())
- binding_.Bind(std::move(request));
-}
-
-WindowManagerWindowTreeFactory::~WindowManagerWindowTreeFactory() {}
-
-void WindowManagerWindowTreeFactory::CreateWindowTree(
- mojom::WindowTreeRequest window_tree_request,
- mojom::WindowTreeClientPtr window_tree_client) {
- // CreateWindowTree() can only be called once, so there is no reason to keep
- // the binding around.
- if (binding_.is_bound())
- binding_.Close();
-
- SetWindowTree(GetWindowServer()->CreateTreeForWindowManager(
- user_id_, std::move(window_tree_request), std::move(window_tree_client)));
-}
-
-WindowManagerWindowTreeFactory::WindowManagerWindowTreeFactory(
- WindowManagerWindowTreeFactorySet* window_manager_window_tree_factory_set,
- const UserId& user_id)
- : window_manager_window_tree_factory_set_(
- window_manager_window_tree_factory_set),
- user_id_(user_id),
- binding_(this),
- window_tree_(nullptr) {}
-
-WindowServer* WindowManagerWindowTreeFactory::GetWindowServer() {
- return window_manager_window_tree_factory_set_->window_server();
-}
-
-void WindowManagerWindowTreeFactory::SetWindowTree(WindowTree* window_tree) {
- DCHECK(!window_tree_);
- window_tree_ = window_tree;
-
- window_manager_window_tree_factory_set_
- ->OnWindowManagerWindowTreeFactoryReady(this);
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_manager_window_tree_factory.h b/chromium/components/mus/ws/window_manager_window_tree_factory.h
deleted file mode 100644
index 909e3391d7f..00000000000
--- a/chromium/components/mus/ws/window_manager_window_tree_factory.h
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_WINDOW_MANAGER_WINDOW_TREE_FACTORY_H_
-#define COMPONENTS_MUS_WS_WINDOW_MANAGER_WINDOW_TREE_FACTORY_H_
-
-#include <stdint.h>
-
-#include "components/mus/public/interfaces/window_manager_window_tree_factory.mojom.h"
-#include "components/mus/ws/user_id.h"
-#include "mojo/public/cpp/bindings/binding.h"
-
-namespace mus {
-namespace ws {
-
-class ServerWindow;
-class WindowManagerWindowTreeFactorySet;
-class WindowServer;
-class WindowTree;
-
-namespace test {
-class WindowManagerWindowTreeFactorySetTestApi;
-}
-
-// Implementation of mojom::WindowManagerWindowTreeFactory.
-class WindowManagerWindowTreeFactory
- : public mojom::WindowManagerWindowTreeFactory {
- public:
- WindowManagerWindowTreeFactory(
- WindowManagerWindowTreeFactorySet* window_manager_window_tree_factory_set,
- const UserId& user_id,
- mojo::InterfaceRequest<mojom::WindowManagerWindowTreeFactory> request);
- ~WindowManagerWindowTreeFactory() override;
-
- const UserId& user_id() const { return user_id_; }
-
- WindowTree* window_tree() { return window_tree_; }
-
- // mojom::WindowManagerWindowTreeFactory:
- void CreateWindowTree(mojom::WindowTreeRequest window_tree_request,
- mojom::WindowTreeClientPtr window_tree_client) override;
-
- private:
- friend class test::WindowManagerWindowTreeFactorySetTestApi;
-
- // Used by tests.
- WindowManagerWindowTreeFactory(WindowManagerWindowTreeFactorySet* registry,
- const UserId& user_id);
-
- WindowServer* GetWindowServer();
-
- void SetWindowTree(WindowTree* window_tree);
-
- WindowManagerWindowTreeFactorySet* window_manager_window_tree_factory_set_;
- const UserId user_id_;
- mojo::Binding<mojom::WindowManagerWindowTreeFactory> binding_;
-
- // Owned by WindowServer.
- WindowTree* window_tree_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowManagerWindowTreeFactory);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_WINDOW_TREE_FACTORY_H_
diff --git a/chromium/components/mus/ws/window_manager_window_tree_factory_set.cc b/chromium/components/mus/ws/window_manager_window_tree_factory_set.cc
deleted file mode 100644
index 91d01a8ab47..00000000000
--- a/chromium/components/mus/ws/window_manager_window_tree_factory_set.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_manager_window_tree_factory_set.h"
-
-#include "components/mus/ws/user_id_tracker_observer.h"
-#include "components/mus/ws/window_manager_window_tree_factory.h"
-#include "components/mus/ws/window_manager_window_tree_factory_set_observer.h"
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_tree.h"
-
-namespace mus {
-namespace ws {
-
-WindowManagerWindowTreeFactorySet::WindowManagerWindowTreeFactorySet(
- WindowServer* window_server,
- UserIdTracker* id_tracker)
- : id_tracker_(id_tracker), window_server_(window_server) {
- id_tracker_->AddObserver(this);
-}
-
-WindowManagerWindowTreeFactorySet::~WindowManagerWindowTreeFactorySet() {
- id_tracker_->RemoveObserver(this);
-}
-
-WindowManagerWindowTreeFactory* WindowManagerWindowTreeFactorySet::Add(
- const UserId& user_id,
- mojo::InterfaceRequest<mojom::WindowManagerWindowTreeFactory> request) {
- if (factories_.count(user_id)) {
- DVLOG(1) << "can only have one factory per user";
- return nullptr;
- }
-
- std::unique_ptr<WindowManagerWindowTreeFactory> factory_ptr(
- new WindowManagerWindowTreeFactory(this, user_id, std::move(request)));
- WindowManagerWindowTreeFactory* factory = factory_ptr.get();
- factories_[user_id] = std::move(factory_ptr);
- return factory;
-}
-
-WindowManagerState*
-WindowManagerWindowTreeFactorySet::GetWindowManagerStateForUser(
- const UserId& user_id) {
- auto it = factories_.find(user_id);
- if (it == factories_.end())
- return nullptr;
- return it->second->window_tree()
- ? it->second->window_tree()->window_manager_state()
- : nullptr;
-}
-
-void WindowManagerWindowTreeFactorySet::DeleteFactoryAssociatedWithTree(
- WindowTree* window_tree) {
- for (auto it = factories_.begin(); it != factories_.end(); ++it) {
- if (it->second->window_tree() == window_tree) {
- factories_.erase(it);
- return;
- }
- }
-}
-
-std::vector<WindowManagerWindowTreeFactory*>
-WindowManagerWindowTreeFactorySet::GetFactories() {
- std::vector<WindowManagerWindowTreeFactory*> result;
- for (auto& pair : factories_)
- result.push_back(pair.second.get());
- return result;
-}
-
-void WindowManagerWindowTreeFactorySet::AddObserver(
- WindowManagerWindowTreeFactorySetObserver* observer) {
- observers_.AddObserver(observer);
-}
-
-void WindowManagerWindowTreeFactorySet::RemoveObserver(
- WindowManagerWindowTreeFactorySetObserver* observer) {
- observers_.RemoveObserver(observer);
-}
-
-void WindowManagerWindowTreeFactorySet::OnWindowManagerWindowTreeFactoryReady(
- WindowManagerWindowTreeFactory* factory) {
- const bool is_first_valid_factory = !got_valid_factory_;
- got_valid_factory_ = true;
- FOR_EACH_OBSERVER(WindowManagerWindowTreeFactorySetObserver, observers_,
- OnWindowManagerWindowTreeFactoryReady(factory));
-
- // Notify after other observers as WindowServer triggers other
- // observers being added, which will have already processed the add.
- if (is_first_valid_factory)
- window_server_->OnFirstWindowManagerWindowTreeFactoryReady();
-}
-
-void WindowManagerWindowTreeFactorySet::OnUserIdRemoved(const UserId& id) {
- factories_.erase(id);
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_manager_window_tree_factory_set.h b/chromium/components/mus/ws/window_manager_window_tree_factory_set.h
deleted file mode 100644
index a118e6978bc..00000000000
--- a/chromium/components/mus/ws/window_manager_window_tree_factory_set.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_WINDOW_MANAGER_WINDOW_TREE_FACTORY_SET_H_
-#define COMPONENTS_MUS_WS_WINDOW_MANAGER_WINDOW_TREE_FACTORY_SET_H_
-
-#include <stdint.h>
-
-#include <memory>
-#include <vector>
-
-#include "base/macros.h"
-#include "base/observer_list.h"
-#include "components/mus/public/interfaces/window_manager_window_tree_factory.mojom.h"
-#include "components/mus/ws/user_id_tracker_observer.h"
-
-namespace mus {
-namespace ws {
-
-class UserIdTracker;
-class WindowManagerState;
-class WindowManagerWindowTreeFactory;
-class WindowManagerWindowTreeFactorySetObserver;
-class WindowServer;
-class WindowTree;
-
-namespace test {
-class WindowManagerWindowTreeFactorySetTestApi;
-}
-
-// WindowManagerWindowTreeFactorySet tracks the set of registered
-// WindowManagerWindowTreeHostFactories.
-class WindowManagerWindowTreeFactorySet : public UserIdTrackerObserver {
- public:
- WindowManagerWindowTreeFactorySet(WindowServer* window_server,
- UserIdTracker* tracker);
- ~WindowManagerWindowTreeFactorySet() override;
-
- WindowServer* window_server() { return window_server_; }
-
- // Creates a new WindowManagerWindowTreeFactory for the specified user,
- // unless one has been set, in which case the call is ignored. The newly
- // created WindowManagerWindowTreeFactory does not immediately have a
- // WindowTree associated with it.
- WindowManagerWindowTreeFactory* Add(
- const UserId& user_id,
- mojo::InterfaceRequest<mojom::WindowManagerWindowTreeFactory> request);
-
- // Returns the WindowManagerState for the specified user, or null if
- // not yet set.
- WindowManagerState* GetWindowManagerStateForUser(const UserId& user_id);
-
- // Deletes the WindowManagerWindowTreeFactory associated with |tree|. Does
- // nothing if there is no WindowManagerWindowTreeFactory associated with
- // |tree|.
- void DeleteFactoryAssociatedWithTree(WindowTree* tree);
-
- // Returns all the factories, even those that may not have a WindowTree
- // associated with them.
- std::vector<WindowManagerWindowTreeFactory*> GetFactories();
-
- void AddObserver(WindowManagerWindowTreeFactorySetObserver* observer);
- void RemoveObserver(WindowManagerWindowTreeFactorySetObserver* observer);
-
- private:
- friend class WindowManagerWindowTreeFactory;
- friend class test::WindowManagerWindowTreeFactorySetTestApi;
-
- // Called by WindowManagerWindowTreeFactory when CreateWindowTree() has
- // been called.
- void OnWindowManagerWindowTreeFactoryReady(
- WindowManagerWindowTreeFactory* factory);
-
- // UserIdTrackerObserver:
- void OnUserIdRemoved(const UserId& id) override;
-
- // Set to true the first time a valid factory has been found.
- bool got_valid_factory_ = false;
- UserIdTracker* id_tracker_;
- WindowServer* window_server_;
-
- std::map<UserId, std::unique_ptr<WindowManagerWindowTreeFactory>> factories_;
-
- base::ObserverList<WindowManagerWindowTreeFactorySetObserver> observers_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowManagerWindowTreeFactorySet);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_WINDOW_TREE_FACTORY_SET_H_
diff --git a/chromium/components/mus/ws/window_manager_window_tree_factory_set_observer.h b/chromium/components/mus/ws/window_manager_window_tree_factory_set_observer.h
deleted file mode 100644
index dd5f876d839..00000000000
--- a/chromium/components/mus/ws/window_manager_window_tree_factory_set_observer.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_WINDOW_MANAGER_WINDOW_TREE_FACTORY_SET_OBSERVER_H_
-#define COMPONENTS_MUS_WS_WINDOW_MANAGER_WINDOW_TREE_FACTORY_SET_OBSERVER_H_
-
-namespace mus {
-namespace ws {
-
-class WindowManagerWindowTreeFactory;
-
-class WindowManagerWindowTreeFactorySetObserver {
- public:
- // Called when the WindowTree associated with |factory| has been set
- virtual void OnWindowManagerWindowTreeFactoryReady(
- WindowManagerWindowTreeFactory* factory) = 0;
-
- protected:
- virtual ~WindowManagerWindowTreeFactorySetObserver() {}
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_WINDOW_MANAGER_WINDOW_TREE_FACTORY_SET_OBSERVER_H_
diff --git a/chromium/components/mus/ws/window_server.cc b/chromium/components/mus/ws/window_server.cc
deleted file mode 100644
index 77ef0e2595c..00000000000
--- a/chromium/components/mus/ws/window_server.cc
+++ /dev/null
@@ -1,707 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_server.h"
-
-#include <set>
-#include <string>
-
-#include "base/logging.h"
-#include "base/memory/ptr_util.h"
-#include "base/stl_util.h"
-#include "components/mus/ws/display.h"
-#include "components/mus/ws/display_binding.h"
-#include "components/mus/ws/display_manager.h"
-#include "components/mus/ws/operation.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/user_activity_monitor.h"
-#include "components/mus/ws/window_coordinate_conversions.h"
-#include "components/mus/ws/window_manager_access_policy.h"
-#include "components/mus/ws/window_manager_display_root.h"
-#include "components/mus/ws/window_manager_state.h"
-#include "components/mus/ws/window_manager_window_tree_factory.h"
-#include "components/mus/ws/window_server_delegate.h"
-#include "components/mus/ws/window_tree.h"
-#include "components/mus/ws/window_tree_binding.h"
-#include "services/shell/public/cpp/connection.h"
-#include "ui/gfx/geometry/size_conversions.h"
-
-namespace mus {
-namespace ws {
-
-WindowServer::WindowServer(
- WindowServerDelegate* delegate,
- const scoped_refptr<mus::SurfacesState>& surfaces_state)
- : delegate_(delegate),
- surfaces_state_(surfaces_state),
- next_client_id_(1),
- display_manager_(new DisplayManager(this, &user_id_tracker_)),
- current_operation_(nullptr),
- in_destructor_(false),
- next_wm_change_id_(0),
- window_manager_window_tree_factory_set_(this, &user_id_tracker_) {
- user_id_tracker_.AddObserver(this);
- OnUserIdAdded(user_id_tracker_.active_id());
-}
-
-WindowServer::~WindowServer() {
- in_destructor_ = true;
-
- // Destroys the window trees results in querying for the display. Tear down
- // the displays first so that the trees are notified of the display going
- // away while the display is still valid.
- display_manager_->DestroyAllDisplays();
-
- while (!tree_map_.empty())
- DestroyTree(tree_map_.begin()->second.get());
-
- display_manager_.reset();
-}
-
-ServerWindow* WindowServer::CreateServerWindow(
- const WindowId& id,
- const std::map<std::string, std::vector<uint8_t>>& properties) {
- ServerWindow* window = new ServerWindow(this, id, properties);
- window->AddObserver(this);
- return window;
-}
-
-ClientSpecificId WindowServer::GetAndAdvanceNextClientId() {
- const ClientSpecificId id = next_client_id_++;
- DCHECK_LT(id, next_client_id_);
- return id;
-}
-
-WindowTree* WindowServer::EmbedAtWindow(
- ServerWindow* root,
- const UserId& user_id,
- mojom::WindowTreeClientPtr client,
- uint32_t flags,
- std::unique_ptr<AccessPolicy> access_policy) {
- std::unique_ptr<WindowTree> tree_ptr(
- new WindowTree(this, user_id, root, std::move(access_policy)));
- WindowTree* tree = tree_ptr.get();
- if (flags & mojom::kEmbedFlagEmbedderInterceptsEvents)
- tree->set_embedder_intercepts_events();
-
- mojom::WindowTreePtr window_tree_ptr;
- mojom::WindowTreeRequest window_tree_request = GetProxy(&window_tree_ptr);
- std::unique_ptr<WindowTreeBinding> binding =
- delegate_->CreateWindowTreeBinding(
- WindowServerDelegate::BindingType::EMBED, this, tree,
- &window_tree_request, &client);
- if (!binding) {
- binding.reset(new ws::DefaultWindowTreeBinding(
- tree, this, std::move(window_tree_request), std::move(client)));
- }
-
- AddTree(std::move(tree_ptr), std::move(binding), std::move(window_tree_ptr));
- OnTreeMessagedClient(tree->id());
- return tree;
-}
-
-void WindowServer::AddTree(std::unique_ptr<WindowTree> tree_impl_ptr,
- std::unique_ptr<WindowTreeBinding> binding,
- mojom::WindowTreePtr tree_ptr) {
- CHECK_EQ(0u, tree_map_.count(tree_impl_ptr->id()));
- WindowTree* tree = tree_impl_ptr.get();
- tree_map_[tree->id()] = std::move(tree_impl_ptr);
- tree->Init(std::move(binding), std::move(tree_ptr));
-}
-
-WindowTree* WindowServer::CreateTreeForWindowManager(
- const UserId& user_id,
- mojom::WindowTreeRequest window_tree_request,
- mojom::WindowTreeClientPtr window_tree_client) {
- std::unique_ptr<WindowTree> window_tree(new WindowTree(
- this, user_id, nullptr, base::WrapUnique(new WindowManagerAccessPolicy)));
- std::unique_ptr<WindowTreeBinding> window_tree_binding =
- delegate_->CreateWindowTreeBinding(
- WindowServerDelegate::BindingType::WINDOW_MANAGER, this,
- window_tree.get(), &window_tree_request, &window_tree_client);
- if (!window_tree_binding) {
- window_tree_binding.reset(new DefaultWindowTreeBinding(
- window_tree.get(), this, std::move(window_tree_request),
- std::move(window_tree_client)));
- }
- WindowTree* window_tree_ptr = window_tree.get();
- AddTree(std::move(window_tree), std::move(window_tree_binding), nullptr);
- window_tree_ptr->ConfigureWindowManager();
- return window_tree_ptr;
-}
-
-void WindowServer::DestroyTree(WindowTree* tree) {
- std::unique_ptr<WindowTree> tree_ptr;
- {
- auto iter = tree_map_.find(tree->id());
- DCHECK(iter != tree_map_.end());
- tree_ptr = std::move(iter->second);
- tree_map_.erase(iter);
- }
-
- // Notify remaining connections so that they can cleanup.
- for (auto& pair : tree_map_)
- pair.second->OnWindowDestroyingTreeImpl(tree);
-
- // Notify the hosts, taking care to only notify each host once.
- std::set<Display*> displays_notified;
- for (auto* root : tree->roots()) {
- // WindowTree holds its roots as a const, which is right as WindowTree
- // doesn't need to modify the window. OTOH we do. We could look up the
- // window using the id to get non-const version, but instead we cast.
- Display* display =
- display_manager_->GetDisplayContaining(const_cast<ServerWindow*>(root));
- if (display && displays_notified.count(display) == 0) {
- display->OnWillDestroyTree(tree);
- displays_notified.insert(display);
- }
- }
-
- window_manager_window_tree_factory_set_.DeleteFactoryAssociatedWithTree(tree);
-
- // Remove any requests from the client that resulted in a call to the window
- // manager and we haven't gotten a response back yet.
- std::set<uint32_t> to_remove;
- for (auto& pair : in_flight_wm_change_map_) {
- if (pair.second.client_id == tree->id())
- to_remove.insert(pair.first);
- }
- for (uint32_t id : to_remove)
- in_flight_wm_change_map_.erase(id);
-}
-
-WindowTree* WindowServer::GetTreeWithId(ClientSpecificId client_id) {
- auto iter = tree_map_.find(client_id);
- return iter == tree_map_.end() ? nullptr : iter->second.get();
-}
-
-WindowTree* WindowServer::GetTreeWithClientName(
- const std::string& client_name) {
- for (const auto& entry : tree_map_) {
- if (entry.second->name() == client_name)
- return entry.second.get();
- }
- return nullptr;
-}
-
-ServerWindow* WindowServer::GetWindow(const WindowId& id) {
- // kInvalidClientId is used for Display and WindowManager nodes.
- if (id.client_id == kInvalidClientId) {
- for (Display* display : display_manager_->displays()) {
- ServerWindow* window = display->GetRootWithId(id);
- if (window)
- return window;
- }
- }
- WindowTree* tree = GetTreeWithId(id.client_id);
- return tree ? tree->GetWindow(id) : nullptr;
-}
-
-void WindowServer::SchedulePaint(ServerWindow* window,
- const gfx::Rect& bounds) {
- Display* display = display_manager_->GetDisplayContaining(window);
- if (display)
- display->SchedulePaint(window, bounds);
-}
-
-void WindowServer::OnTreeMessagedClient(ClientSpecificId id) {
- if (current_operation_)
- current_operation_->MarkTreeAsMessaged(id);
-}
-
-bool WindowServer::DidTreeMessageClient(ClientSpecificId id) const {
- return current_operation_ && current_operation_->DidMessageTree(id);
-}
-
-const WindowTree* WindowServer::GetTreeWithRoot(
- const ServerWindow* window) const {
- if (!window)
- return nullptr;
- for (auto& pair : tree_map_) {
- if (pair.second->HasRoot(window))
- return pair.second.get();
- }
- return nullptr;
-}
-
-void WindowServer::OnFirstWindowManagerWindowTreeFactoryReady() {
- if (display_manager_->has_active_or_pending_displays())
- return;
-
- // We've been supplied a WindowManagerFactory and no displays have been
- // created yet. Treat this as a signal to create a Display.
- // TODO(sky): we need a better way to determine this, most likely a switch.
- delegate_->CreateDefaultDisplays();
-}
-
-UserActivityMonitor* WindowServer::GetUserActivityMonitorForUser(
- const UserId& user_id) {
- DCHECK_GT(activity_monitor_map_.count(user_id), 0u);
- return activity_monitor_map_[user_id].get();
-}
-
-bool WindowServer::SetFocusedWindow(ServerWindow* window) {
- // TODO(sky): this should fail if there is modal dialog active and |window|
- // is outside that.
- ServerWindow* currently_focused = GetFocusedWindow();
- Display* focused_display =
- currently_focused
- ? display_manager_->GetDisplayContaining(currently_focused)
- : nullptr;
- if (!window)
- return focused_display ? focused_display->SetFocusedWindow(nullptr) : true;
-
- Display* display = display_manager_->GetDisplayContaining(window);
- DCHECK(display); // It's assumed callers do validation before calling this.
- const bool result = display->SetFocusedWindow(window);
- // If the focus actually changed, and focus was in another display, then we
- // need to notify the previously focused display so that it cleans up state
- // and notifies appropriately.
- if (result && display->GetFocusedWindow() && display != focused_display &&
- focused_display) {
- const bool cleared_focus = focused_display->SetFocusedWindow(nullptr);
- DCHECK(cleared_focus);
- }
- return result;
-}
-
-ServerWindow* WindowServer::GetFocusedWindow() {
- for (Display* display : display_manager_->displays()) {
- ServerWindow* focused_window = display->GetFocusedWindow();
- if (focused_window)
- return focused_window;
- }
- return nullptr;
-}
-
-uint32_t WindowServer::GenerateWindowManagerChangeId(
- WindowTree* source,
- uint32_t client_change_id) {
- const uint32_t wm_change_id = next_wm_change_id_++;
- in_flight_wm_change_map_[wm_change_id] = {source->id(), client_change_id};
- return wm_change_id;
-}
-
-void WindowServer::WindowManagerChangeCompleted(
- uint32_t window_manager_change_id,
- bool success) {
- InFlightWindowManagerChange change;
- if (!GetAndClearInFlightWindowManagerChange(window_manager_change_id,
- &change)) {
- return;
- }
-
- WindowTree* tree = GetTreeWithId(change.client_id);
- tree->OnChangeCompleted(change.client_change_id, success);
-}
-
-void WindowServer::WindowManagerCreatedTopLevelWindow(
- WindowTree* wm_tree,
- uint32_t window_manager_change_id,
- const ServerWindow* window) {
- InFlightWindowManagerChange change;
- if (!GetAndClearInFlightWindowManagerChange(window_manager_change_id,
- &change)) {
- return;
- }
- if (!window) {
- WindowManagerSentBogusMessage();
- return;
- }
-
- WindowTree* tree = GetTreeWithId(change.client_id);
- // The window manager should have created the window already, and it should
- // be ready for embedding.
- if (!tree->IsWaitingForNewTopLevelWindow(window_manager_change_id) ||
- !window || window->id().client_id != wm_tree->id() ||
- !window->children().empty() || GetTreeWithRoot(window)) {
- WindowManagerSentBogusMessage();
- return;
- }
-
- tree->OnWindowManagerCreatedTopLevelWindow(window_manager_change_id,
- change.client_change_id, window);
-}
-
-void WindowServer::ProcessWindowBoundsChanged(const ServerWindow* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {
- for (auto& pair : tree_map_) {
- pair.second->ProcessWindowBoundsChanged(window, old_bounds, new_bounds,
- IsOperationSource(pair.first));
- }
-}
-
-void WindowServer::ProcessClientAreaChanged(
- const ServerWindow* window,
- const gfx::Insets& new_client_area,
- const std::vector<gfx::Rect>& new_additional_client_areas) {
- for (auto& pair : tree_map_) {
- pair.second->ProcessClientAreaChanged(window, new_client_area,
- new_additional_client_areas,
- IsOperationSource(pair.first));
- }
-}
-
-void WindowServer::ProcessLostCapture(const ServerWindow* window) {
- for (auto& pair : tree_map_)
- pair.second->ProcessLostCapture(window, IsOperationSource(pair.first));
-}
-
-void WindowServer::ProcessWillChangeWindowHierarchy(
- const ServerWindow* window,
- const ServerWindow* new_parent,
- const ServerWindow* old_parent) {
- for (auto& pair : tree_map_) {
- pair.second->ProcessWillChangeWindowHierarchy(
- window, new_parent, old_parent, IsOperationSource(pair.first));
- }
-}
-
-void WindowServer::ProcessWindowHierarchyChanged(
- const ServerWindow* window,
- const ServerWindow* new_parent,
- const ServerWindow* old_parent) {
- for (auto& pair : tree_map_) {
- pair.second->ProcessWindowHierarchyChanged(window, new_parent, old_parent,
- IsOperationSource(pair.first));
- }
-}
-
-void WindowServer::ProcessWindowReorder(const ServerWindow* window,
- const ServerWindow* relative_window,
- const mojom::OrderDirection direction) {
- // We'll probably do a bit of reshuffling when we add a transient window.
- if ((current_operation_type() == OperationType::ADD_TRANSIENT_WINDOW) ||
- (current_operation_type() ==
- OperationType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT)) {
- return;
- }
- for (auto& pair : tree_map_) {
- pair.second->ProcessWindowReorder(window, relative_window, direction,
- IsOperationSource(pair.first));
- }
-}
-
-void WindowServer::ProcessWindowDeleted(const ServerWindow* window) {
- for (auto& pair : tree_map_)
- pair.second->ProcessWindowDeleted(window, IsOperationSource(pair.first));
-}
-
-void WindowServer::ProcessWillChangeWindowPredefinedCursor(ServerWindow* window,
- int32_t cursor_id) {
- for (auto& pair : tree_map_) {
- pair.second->ProcessCursorChanged(window, cursor_id,
- IsOperationSource(pair.first));
- }
-}
-
-void WindowServer::SendToEventObservers(const ui::Event& event,
- const UserId& user_id,
- WindowTree* ignore_tree) {
- for (auto& pair : tree_map_) {
- WindowTree* tree = pair.second.get();
- if (tree->user_id() == user_id && tree != ignore_tree)
- tree->SendToEventObserver(event);
- }
-}
-
-void WindowServer::SetPaintCallback(
- const base::Callback<void(ServerWindow*)>& callback) {
- DCHECK(delegate_->IsTestConfig()) << "Paint callbacks are expensive, and "
- << "allowed only in tests.";
- DCHECK(window_paint_callback_.is_null() || callback.is_null());
- window_paint_callback_ = callback;
-}
-
-bool WindowServer::GetAndClearInFlightWindowManagerChange(
- uint32_t window_manager_change_id,
- InFlightWindowManagerChange* change) {
- // There are valid reasons as to why we wouldn't know about the id. The
- // most likely is the client disconnected before the response from the window
- // manager came back.
- auto iter = in_flight_wm_change_map_.find(window_manager_change_id);
- if (iter == in_flight_wm_change_map_.end())
- return false;
-
- *change = iter->second;
- in_flight_wm_change_map_.erase(iter);
- return true;
-}
-
-void WindowServer::PrepareForOperation(Operation* op) {
- // Should only ever have one change in flight.
- CHECK(!current_operation_);
- current_operation_ = op;
-}
-
-void WindowServer::FinishOperation() {
- // PrepareForOperation/FinishOperation should be balanced.
- CHECK(current_operation_);
- current_operation_ = nullptr;
-}
-
-void WindowServer::UpdateNativeCursorFromMouseLocation(ServerWindow* window) {
- WindowManagerDisplayRoot* display_root =
- display_manager_->GetWindowManagerDisplayRoot(window);
- if (display_root) {
- EventDispatcher* event_dispatcher =
- display_root->window_manager_state()->event_dispatcher();
- event_dispatcher->UpdateCursorProviderByLastKnownLocation();
- int32_t cursor_id = 0;
- if (event_dispatcher->GetCurrentMouseCursor(&cursor_id))
- display_root->display()->UpdateNativeCursor(cursor_id);
- }
-}
-
-void WindowServer::UpdateNativeCursorIfOver(ServerWindow* window) {
- WindowManagerDisplayRoot* display_root =
- display_manager_->GetWindowManagerDisplayRoot(window);
- if (!display_root)
- return;
-
- EventDispatcher* event_dispatcher =
- display_root->window_manager_state()->event_dispatcher();
- if (window != event_dispatcher->mouse_cursor_source_window())
- return;
-
- event_dispatcher->UpdateNonClientAreaForCurrentWindow();
- int32_t cursor_id = 0;
- if (event_dispatcher->GetCurrentMouseCursor(&cursor_id))
- display_root->display()->UpdateNativeCursor(cursor_id);
-}
-
-mus::SurfacesState* WindowServer::GetSurfacesState() {
- return surfaces_state_.get();
-}
-
-void WindowServer::OnScheduleWindowPaint(ServerWindow* window) {
- if (in_destructor_)
- return;
-
- SchedulePaint(window, gfx::Rect(window->bounds().size()));
- if (!window_paint_callback_.is_null())
- window_paint_callback_.Run(window);
-}
-
-const ServerWindow* WindowServer::GetRootWindow(
- const ServerWindow* window) const {
- const Display* display = display_manager_->GetDisplayContaining(window);
- return display ? display->root_window() : nullptr;
-}
-
-void WindowServer::ScheduleSurfaceDestruction(ServerWindow* window) {
- Display* display = display_manager_->GetDisplayContaining(window);
- if (display)
- display->ScheduleSurfaceDestruction(window);
-}
-
-void WindowServer::OnWindowDestroyed(ServerWindow* window) {
- ProcessWindowDeleted(window);
-}
-
-void WindowServer::OnWillChangeWindowHierarchy(ServerWindow* window,
- ServerWindow* new_parent,
- ServerWindow* old_parent) {
- if (in_destructor_)
- return;
-
- ProcessWillChangeWindowHierarchy(window, new_parent, old_parent);
-}
-
-void WindowServer::OnWindowHierarchyChanged(ServerWindow* window,
- ServerWindow* new_parent,
- ServerWindow* old_parent) {
- if (in_destructor_)
- return;
-
- WindowManagerDisplayRoot* display_root =
- display_manager_->GetWindowManagerDisplayRoot(window);
- if (display_root)
- display_root->window_manager_state()
- ->ReleaseCaptureBlockedByAnyModalWindow();
-
- ProcessWindowHierarchyChanged(window, new_parent, old_parent);
-
- // TODO(beng): optimize.
- if (old_parent)
- SchedulePaint(old_parent, gfx::Rect(old_parent->bounds().size()));
- if (new_parent)
- SchedulePaint(new_parent, gfx::Rect(new_parent->bounds().size()));
-
- UpdateNativeCursorFromMouseLocation(window);
-}
-
-void WindowServer::OnWindowBoundsChanged(ServerWindow* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) {
- if (in_destructor_)
- return;
-
- ProcessWindowBoundsChanged(window, old_bounds, new_bounds);
- if (!window->parent())
- return;
-
- SchedulePaint(window->parent(), old_bounds);
- SchedulePaint(window->parent(), new_bounds);
-
- UpdateNativeCursorFromMouseLocation(window);
-}
-
-void WindowServer::OnWindowClientAreaChanged(
- ServerWindow* window,
- const gfx::Insets& new_client_area,
- const std::vector<gfx::Rect>& new_additional_client_areas) {
- if (in_destructor_)
- return;
-
- ProcessClientAreaChanged(window, new_client_area,
- new_additional_client_areas);
-
- UpdateNativeCursorIfOver(window);
-}
-
-void WindowServer::OnWindowReordered(ServerWindow* window,
- ServerWindow* relative,
- mojom::OrderDirection direction) {
- ProcessWindowReorder(window, relative, direction);
- if (!in_destructor_)
- SchedulePaint(window, gfx::Rect(window->bounds().size()));
- UpdateNativeCursorFromMouseLocation(window);
-}
-
-void WindowServer::OnWillChangeWindowVisibility(ServerWindow* window) {
- if (in_destructor_)
- return;
-
- // Need to repaint if the window was drawn (which means it's in the process of
- // hiding) or the window is transitioning to drawn.
- if (window->parent() &&
- (window->IsDrawn() ||
- (!window->visible() && window->parent()->IsDrawn()))) {
- SchedulePaint(window->parent(), window->bounds());
- }
-
- for (auto& pair : tree_map_) {
- pair.second->ProcessWillChangeWindowVisibility(
- window, IsOperationSource(pair.first));
- }
-}
-
-void WindowServer::OnWindowOpacityChanged(ServerWindow* window,
- float old_opacity,
- float new_opacity) {
- DCHECK(!in_destructor_);
-
- for (auto& pair : tree_map_) {
- pair.second->ProcessWindowOpacityChanged(window, old_opacity, new_opacity,
- IsOperationSource(pair.first));
- }
-}
-
-void WindowServer::OnWindowVisibilityChanged(ServerWindow* window) {
- if (in_destructor_)
- return;
-
- WindowManagerDisplayRoot* display_root =
- display_manager_->GetWindowManagerDisplayRoot(window);
- if (display_root)
- display_root->window_manager_state()->ReleaseCaptureBlockedByModalWindow(
- window);
-}
-
-void WindowServer::OnWindowPredefinedCursorChanged(ServerWindow* window,
- int32_t cursor_id) {
- if (in_destructor_)
- return;
-
- ProcessWillChangeWindowPredefinedCursor(window, cursor_id);
-
- UpdateNativeCursorIfOver(window);
-}
-
-void WindowServer::OnWindowNonClientCursorChanged(ServerWindow* window,
- int32_t cursor_id) {
- if (in_destructor_)
- return;
-
- UpdateNativeCursorIfOver(window);
-}
-
-void WindowServer::OnWindowSharedPropertyChanged(
- ServerWindow* window,
- const std::string& name,
- const std::vector<uint8_t>* new_data) {
- for (auto& pair : tree_map_) {
- pair.second->ProcessWindowPropertyChanged(window, name, new_data,
- IsOperationSource(pair.first));
- }
-}
-
-void WindowServer::OnWindowTextInputStateChanged(
- ServerWindow* window,
- const ui::TextInputState& state) {
- Display* display = display_manager_->GetDisplayContaining(window);
- display->UpdateTextInputState(window, state);
-}
-
-void WindowServer::OnTransientWindowAdded(ServerWindow* window,
- ServerWindow* transient_child) {
- for (auto& pair : tree_map_) {
- pair.second->ProcessTransientWindowAdded(window, transient_child,
- IsOperationSource(pair.first));
- }
-}
-
-void WindowServer::OnTransientWindowRemoved(ServerWindow* window,
- ServerWindow* transient_child) {
- // If we're deleting a window, then this is a superfluous message.
- if (current_operation_type() == OperationType::DELETE_WINDOW)
- return;
- for (auto& pair : tree_map_) {
- pair.second->ProcessTransientWindowRemoved(window, transient_child,
- IsOperationSource(pair.first));
- }
-}
-
-void WindowServer::OnFirstDisplayReady() {
- delegate_->OnFirstDisplayReady();
-}
-
-void WindowServer::OnNoMoreDisplays() {
- delegate_->OnNoMoreDisplays();
-}
-
-bool WindowServer::GetFrameDecorationsForUser(
- const UserId& user_id,
- mojom::FrameDecorationValuesPtr* values) {
- WindowManagerState* window_manager_state =
- window_manager_window_tree_factory_set_.GetWindowManagerStateForUser(
- user_id);
- if (!window_manager_state)
- return false;
- if (values && window_manager_state->got_frame_decoration_values())
- *values = window_manager_state->frame_decoration_values().Clone();
- return window_manager_state->got_frame_decoration_values();
-}
-
-WindowManagerState* WindowServer::GetWindowManagerStateForUser(
- const UserId& user_id) {
- return window_manager_window_tree_factory_set_.GetWindowManagerStateForUser(
- user_id);
-}
-
-void WindowServer::OnActiveUserIdChanged(const UserId& previously_active_id,
- const UserId& active_id) {}
-
-void WindowServer::OnUserIdAdded(const UserId& id) {
- activity_monitor_map_[id] = base::MakeUnique<UserActivityMonitor>(nullptr);
-}
-
-void WindowServer::OnUserIdRemoved(const UserId& id) {
- activity_monitor_map_.erase(id);
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_server.h b/chromium/components/mus/ws/window_server.h
deleted file mode 100644
index 0ecbc76ee4c..00000000000
--- a/chromium/components/mus/ws/window_server.h
+++ /dev/null
@@ -1,342 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_WINDOW_SERVER_H_
-#define COMPONENTS_MUS_WS_WINDOW_SERVER_H_
-
-#include <stdint.h>
-
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include "base/macros.h"
-#include "components/mus/public/interfaces/window_manager_window_tree_factory.mojom.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/public/interfaces/window_tree_host.mojom.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "components/mus/ws/display.h"
-#include "components/mus/ws/display_manager_delegate.h"
-#include "components/mus/ws/ids.h"
-#include "components/mus/ws/operation.h"
-#include "components/mus/ws/server_window_delegate.h"
-#include "components/mus/ws/server_window_observer.h"
-#include "components/mus/ws/user_id_tracker.h"
-#include "components/mus/ws/user_id_tracker_observer.h"
-#include "components/mus/ws/window_manager_window_tree_factory_set.h"
-#include "mojo/public/cpp/bindings/array.h"
-#include "mojo/public/cpp/bindings/binding.h"
-
-namespace mus {
-namespace ws {
-
-class AccessPolicy;
-class DisplayManager;
-class ServerWindow;
-class UserActivityMonitor;
-class WindowManagerState;
-class WindowServerDelegate;
-class WindowTree;
-class WindowTreeBinding;
-
-// WindowServer manages the set of clients of the window server (all the
-// WindowTrees) as well as providing the root of the hierarchy.
-class WindowServer : public ServerWindowDelegate,
- public ServerWindowObserver,
- public DisplayManagerDelegate,
- public UserIdTrackerObserver {
- public:
- WindowServer(WindowServerDelegate* delegate,
- const scoped_refptr<mus::SurfacesState>& surfaces_state);
- ~WindowServer() override;
-
- WindowServerDelegate* delegate() { return delegate_; }
-
- UserIdTracker* user_id_tracker() { return &user_id_tracker_; }
- const UserIdTracker* user_id_tracker() const { return &user_id_tracker_; }
-
- DisplayManager* display_manager() { return display_manager_.get(); }
- const DisplayManager* display_manager() const {
- return display_manager_.get();
- }
-
- // Creates a new ServerWindow. The return value is owned by the caller, but
- // must be destroyed before WindowServer.
- ServerWindow* CreateServerWindow(
- const WindowId& id,
- const std::map<std::string, std::vector<uint8_t>>& properties);
-
- // Returns the id for the next WindowTree.
- ClientSpecificId GetAndAdvanceNextClientId();
-
- // See description of WindowTree::Embed() for details. This assumes
- // |transport_window_id| is valid.
- WindowTree* EmbedAtWindow(ServerWindow* root,
- const UserId& user_id,
- mojom::WindowTreeClientPtr client,
- uint32_t flags,
- std::unique_ptr<AccessPolicy> access_policy);
-
- // Adds |tree_impl_ptr| to the set of known trees. Use DestroyTree() to
- // destroy the tree.
- void AddTree(std::unique_ptr<WindowTree> tree_impl_ptr,
- std::unique_ptr<WindowTreeBinding> binding,
- mojom::WindowTreePtr tree_ptr);
- WindowTree* CreateTreeForWindowManager(
- const UserId& user_id,
- mojom::WindowTreeRequest window_tree_request,
- mojom::WindowTreeClientPtr window_tree_client);
- // Invoked when a WindowTree's connection encounters an error.
- void DestroyTree(WindowTree* tree);
-
- // Returns the tree by client id.
- WindowTree* GetTreeWithId(ClientSpecificId client_id);
-
- WindowTree* GetTreeWithClientName(const std::string& client_name);
-
- size_t num_trees() const { return tree_map_.size(); }
-
- // Returns the Window identified by |id|.
- ServerWindow* GetWindow(const WindowId& id);
-
- // Schedules a paint for the specified region in the coordinates of |window|.
- void SchedulePaint(ServerWindow* window, const gfx::Rect& bounds);
-
- OperationType current_operation_type() const {
- return current_operation_ ? current_operation_->type()
- : OperationType::NONE;
- }
-
- // Returns true if the specified client issued the current operation.
- bool IsOperationSource(ClientSpecificId client_id) const {
- return current_operation_ &&
- current_operation_->source_tree_id() == client_id;
- }
-
- // Invoked when a client messages a client about the change. This is used
- // to avoid sending ServerChangeIdAdvanced() unnecessarily.
- void OnTreeMessagedClient(ClientSpecificId id);
-
- // Returns true if OnTreeMessagedClient() was invoked for id.
- bool DidTreeMessageClient(ClientSpecificId id) const;
-
- // Returns the WindowTree that has |id| as a root.
- WindowTree* GetTreeWithRoot(const ServerWindow* window) {
- return const_cast<WindowTree*>(
- const_cast<const WindowServer*>(this)->GetTreeWithRoot(window));
- }
- const WindowTree* GetTreeWithRoot(const ServerWindow* window) const;
-
- void OnFirstWindowManagerWindowTreeFactoryReady();
-
- UserActivityMonitor* GetUserActivityMonitorForUser(const UserId& user_id);
-
- WindowManagerWindowTreeFactorySet* window_manager_window_tree_factory_set() {
- return &window_manager_window_tree_factory_set_;
- }
-
- // Sets focus to |window|. Returns true if |window| already has focus, or
- // focus was successfully changed. Returns |false| if |window| is not a valid
- // window to receive focus.
- bool SetFocusedWindow(ServerWindow* window);
- ServerWindow* GetFocusedWindow();
-
- // Returns a change id for the window manager that is associated with
- // |source| and |client_change_id|. When the window manager replies
- // WindowManagerChangeCompleted() is called to obtain the original source
- // and client supplied change_id that initiated the called.
- uint32_t GenerateWindowManagerChangeId(WindowTree* source,
- uint32_t client_change_id);
-
- // Called when a response from the window manager is obtained. Calls to
- // the client that initiated the change with the change id originally
- // supplied by the client.
- void WindowManagerChangeCompleted(uint32_t window_manager_change_id,
- bool success);
- void WindowManagerCreatedTopLevelWindow(WindowTree* wm_tree,
- uint32_t window_manager_change_id,
- const ServerWindow* window);
-
- // Called when we get an unexpected message from the WindowManager.
- // TODO(sky): decide what we want to do here.
- void WindowManagerSentBogusMessage() {}
-
- // These functions trivially delegate to all WindowTrees, which in
- // term notify their clients.
- void ProcessWindowBoundsChanged(const ServerWindow* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds);
- void ProcessClientAreaChanged(
- const ServerWindow* window,
- const gfx::Insets& new_client_area,
- const std::vector<gfx::Rect>& new_additional_client_areas);
- void ProcessLostCapture(const ServerWindow* window);
- void ProcessWillChangeWindowHierarchy(const ServerWindow* window,
- const ServerWindow* new_parent,
- const ServerWindow* old_parent);
- void ProcessWindowHierarchyChanged(const ServerWindow* window,
- const ServerWindow* new_parent,
- const ServerWindow* old_parent);
- void ProcessWindowReorder(const ServerWindow* window,
- const ServerWindow* relative_window,
- const mojom::OrderDirection direction);
- void ProcessWindowDeleted(const ServerWindow* window);
- void ProcessWillChangeWindowPredefinedCursor(ServerWindow* window,
- int32_t cursor_id);
-
- // Sends an |event| to all WindowTrees belonging to |user_id| that might be
- // observing events. Skips |ignore_tree| if it is non-null.
- void SendToEventObservers(const ui::Event& event,
- const UserId& user_id,
- WindowTree* ignore_tree);
-
- // Sets a callback to be called whenever a ServerWindow is scheduled for
- // a [re]paint. This should only be called in a test configuration.
- void SetPaintCallback(const base::Callback<void(ServerWindow*)>& callback);
-
- private:
- friend class Operation;
-
- using WindowTreeMap =
- std::map<ClientSpecificId, std::unique_ptr<WindowTree>>;
- using UserActivityMonitorMap =
- std::map<UserId, std::unique_ptr<UserActivityMonitor>>;
-
- struct InFlightWindowManagerChange {
- // Identifies the client that initiated the change.
- ClientSpecificId client_id;
-
- // Change id supplied by the client.
- uint32_t client_change_id;
- };
-
- using InFlightWindowManagerChangeMap =
- std::map<uint32_t, InFlightWindowManagerChange>;
-
- bool GetAndClearInFlightWindowManagerChange(
- uint32_t window_manager_change_id,
- InFlightWindowManagerChange* change);
-
- // Invoked when a client is about to execute a window server operation.
- // Subsequently followed by FinishOperation() once the change is done.
- //
- // Changes should never nest, meaning each PrepareForOperation() must be
- // balanced with a call to FinishOperation() with no PrepareForOperation()
- // in between.
- void PrepareForOperation(Operation* op);
-
- // Balances a call to PrepareForOperation().
- void FinishOperation();
-
- // Updates the native cursor by figuring out what window is under the mouse
- // cursor. This is run in response to events that change the bounds or window
- // hierarchy.
- void UpdateNativeCursorFromMouseLocation(ServerWindow* window);
-
- // Updates the native cursor if the cursor is currently inside |window|. This
- // is run in response to events that change the mouse cursor properties of
- // |window|.
- void UpdateNativeCursorIfOver(ServerWindow* window);
-
- // Overridden from ServerWindowDelegate:
- mus::SurfacesState* GetSurfacesState() override;
- void OnScheduleWindowPaint(ServerWindow* window) override;
- const ServerWindow* GetRootWindow(const ServerWindow* window) const override;
- void ScheduleSurfaceDestruction(ServerWindow* window) override;
-
- // Overridden from ServerWindowObserver:
- void OnWindowDestroyed(ServerWindow* window) override;
- void OnWillChangeWindowHierarchy(ServerWindow* window,
- ServerWindow* new_parent,
- ServerWindow* old_parent) override;
- void OnWindowHierarchyChanged(ServerWindow* window,
- ServerWindow* new_parent,
- ServerWindow* old_parent) override;
- void OnWindowBoundsChanged(ServerWindow* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) override;
- void OnWindowClientAreaChanged(
- ServerWindow* window,
- const gfx::Insets& new_client_area,
- const std::vector<gfx::Rect>& new_additional_client_areas) override;
- void OnWindowReordered(ServerWindow* window,
- ServerWindow* relative,
- mojom::OrderDirection direction) override;
- void OnWillChangeWindowVisibility(ServerWindow* window) override;
- void OnWindowVisibilityChanged(ServerWindow* window) override;
- void OnWindowOpacityChanged(ServerWindow* window,
- float old_opacity,
- float new_opacity) override;
- void OnWindowSharedPropertyChanged(
- ServerWindow* window,
- const std::string& name,
- const std::vector<uint8_t>* new_data) override;
- void OnWindowPredefinedCursorChanged(ServerWindow* window,
- int32_t cursor_id) override;
- void OnWindowNonClientCursorChanged(ServerWindow* window,
- int32_t cursor_id) override;
- void OnWindowTextInputStateChanged(ServerWindow* window,
- const ui::TextInputState& state) override;
- void OnTransientWindowAdded(ServerWindow* window,
- ServerWindow* transient_child) override;
- void OnTransientWindowRemoved(ServerWindow* window,
- ServerWindow* transient_child) override;
-
- // DisplayManagerDelegate:
- void OnFirstDisplayReady() override;
- void OnNoMoreDisplays() override;
- bool GetFrameDecorationsForUser(
- const UserId& user_id,
- mojom::FrameDecorationValuesPtr* values) override;
- WindowManagerState* GetWindowManagerStateForUser(
- const UserId& user_id) override;
-
- // UserIdTrackerObserver:
- void OnActiveUserIdChanged(const UserId& previously_active_id,
- const UserId& active_id) override;
- void OnUserIdAdded(const UserId& id) override;
- void OnUserIdRemoved(const UserId& id) override;
-
- UserIdTracker user_id_tracker_;
-
- WindowServerDelegate* delegate_;
-
- // State for rendering into a Surface.
- scoped_refptr<mus::SurfacesState> surfaces_state_;
-
- // ID to use for next WindowTree.
- ClientSpecificId next_client_id_;
-
- std::unique_ptr<DisplayManager> display_manager_;
-
- // Set of WindowTrees.
- WindowTreeMap tree_map_;
-
- // If non-null then we're processing a client operation. The Operation is
- // not owned by us (it's created on the stack by WindowTree).
- Operation* current_operation_;
-
- bool in_destructor_;
-
- // Maps from window manager change id to the client that initiated the
- // request.
- InFlightWindowManagerChangeMap in_flight_wm_change_map_;
-
- // Next id supplied to the window manager.
- uint32_t next_wm_change_id_;
-
- base::Callback<void(ServerWindow*)> window_paint_callback_;
-
- UserActivityMonitorMap activity_monitor_map_;
-
- WindowManagerWindowTreeFactorySet window_manager_window_tree_factory_set_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowServer);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_WINDOW_SERVER_H_
diff --git a/chromium/components/mus/ws/window_server_delegate.cc b/chromium/components/mus/ws/window_server_delegate.cc
deleted file mode 100644
index 1d9a1045f3c..00000000000
--- a/chromium/components/mus/ws/window_server_delegate.cc
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_server_delegate.h"
-
-#include "components/mus/ws/window_tree_binding.h"
-
-namespace mus {
-namespace ws {
-
-void WindowServerDelegate::OnFirstDisplayReady() {}
-
-std::unique_ptr<WindowTreeBinding>
-WindowServerDelegate::CreateWindowTreeBinding(
- BindingType type,
- ws::WindowServer* window_server,
- ws::WindowTree* tree,
- mojom::WindowTreeRequest* tree_request,
- mojom::WindowTreeClientPtr* client) {
- return nullptr;
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_server_delegate.h b/chromium/components/mus/ws/window_server_delegate.h
deleted file mode 100644
index 62a8db4b07a..00000000000
--- a/chromium/components/mus/ws/window_server_delegate.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_WINDOW_SERVER_DELEGATE_H_
-#define COMPONENTS_MUS_WS_WINDOW_SERVER_DELEGATE_H_
-
-#include <stdint.h>
-
-#include <memory>
-#include <string>
-
-#include "components/mus/common/types.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "mojo/public/cpp/bindings/interface_request.h"
-
-namespace mus {
-
-namespace mojom {
-class Display;
-class WindowManagerFactory;
-class WindowTree;
-}
-
-namespace ws {
-
-class Display;
-class ServerWindow;
-class WindowServer;
-class WindowTree;
-class WindowTreeBinding;
-
-class WindowServerDelegate {
- public:
- enum BindingType {
- EMBED,
- WINDOW_MANAGER,
- };
-
- // Called if no Displays have been created, but a WindowManagerFactory has
- // been set.
- virtual void CreateDefaultDisplays() = 0;
-
- // Called once when the AcceleratedWidget of a Display is available.
- virtual void OnFirstDisplayReady();
-
- virtual void OnNoMoreDisplays() = 0;
-
- virtual bool IsTestConfig() const = 0;
-
- // Creates a WindowTreeBinding. Default implementation returns null, which
- // creates DefaultBinding.
- virtual std::unique_ptr<WindowTreeBinding> CreateWindowTreeBinding(
- BindingType type,
- ws::WindowServer* window_server,
- ws::WindowTree* tree,
- mojom::WindowTreeRequest* tree_request,
- mojom::WindowTreeClientPtr* client);
-
- protected:
- virtual ~WindowServerDelegate() {}
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_WINDOW_SERVER_DELEGATE_H_
diff --git a/chromium/components/mus/ws/window_server_test_impl.cc b/chromium/components/mus/ws/window_server_test_impl.cc
deleted file mode 100644
index a61eb2d2bc9..00000000000
--- a/chromium/components/mus/ws/window_server_test_impl.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_server_test_impl.h"
-
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_surface_manager.h"
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_tree.h"
-
-namespace mus {
-namespace ws {
-
-namespace {
-
-bool WindowHasValidFrame(const ServerWindow* window) {
- const ServerWindowSurfaceManager* manager = window->surface_manager();
- return manager &&
- !manager->GetDefaultSurface()->last_submitted_frame_size().IsEmpty();
-}
-
-} // namespace
-
-WindowServerTestImpl::WindowServerTestImpl(
- WindowServer* window_server,
- mojo::InterfaceRequest<WindowServerTest> request)
- : window_server_(window_server), binding_(this, std::move(request)) {}
-
-WindowServerTestImpl::~WindowServerTestImpl() {}
-
-void WindowServerTestImpl::OnWindowPaint(
- const std::string& name,
- const EnsureClientHasDrawnWindowCallback& cb,
- ServerWindow* window) {
- WindowTree* tree = window_server_->GetTreeWithClientName(name);
- if (!tree)
- return;
- if (tree->HasRoot(window) && WindowHasValidFrame(window)) {
- cb.Run(true);
- window_server_->SetPaintCallback(base::Callback<void(ServerWindow*)>());
- }
-}
-
-void WindowServerTestImpl::EnsureClientHasDrawnWindow(
- const mojo::String& client_name,
- const EnsureClientHasDrawnWindowCallback& callback) {
- std::string name = client_name.To<std::string>();
- WindowTree* tree = window_server_->GetTreeWithClientName(name);
- if (tree) {
- for (const ServerWindow* window : tree->roots()) {
- if (WindowHasValidFrame(window)) {
- callback.Run(true);
- return;
- }
- }
- }
-
- window_server_->SetPaintCallback(
- base::Bind(&WindowServerTestImpl::OnWindowPaint, base::Unretained(this),
- name, std::move(callback)));
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_server_test_impl.h b/chromium/components/mus/ws/window_server_test_impl.h
deleted file mode 100644
index deacb773c61..00000000000
--- a/chromium/components/mus/ws/window_server_test_impl.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_WINDOW_SERVER_TEST_IMPL_H_
-#define COMPONENTS_MUS_WS_WINDOW_SERVER_TEST_IMPL_H_
-
-#include "components/mus/public/interfaces/window_server_test.mojom.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-
-namespace mus {
-namespace ws {
-
-class ServerWindow;
-class WindowServer;
-class WindowTree;
-struct WindowId;
-
-class WindowServerTestImpl : public mojom::WindowServerTest {
- public:
- WindowServerTestImpl(WindowServer* server,
- mojo::InterfaceRequest<WindowServerTest> request);
-
- private:
- ~WindowServerTestImpl() override;
-
- void OnWindowPaint(const std::string& name,
- const EnsureClientHasDrawnWindowCallback& cb,
- ServerWindow* window);
-
- // mojom::WindowServerTest:
- void EnsureClientHasDrawnWindow(
- const mojo::String& client_name,
- const EnsureClientHasDrawnWindowCallback& callback) override;
-
- WindowServer* window_server_;
- mojo::StrongBinding<WindowServerTest> binding_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowServerTestImpl);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_WINDOW_SERVER_TEST_IMPL_H_
diff --git a/chromium/components/mus/ws/window_tree.cc b/chromium/components/mus/ws/window_tree.cc
deleted file mode 100644
index aafdfce96ec..00000000000
--- a/chromium/components/mus/ws/window_tree.cc
+++ /dev/null
@@ -1,1539 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_tree.h"
-
-#include <stddef.h>
-
-#include <utility>
-
-#include "base/bind.h"
-#include "base/macros.h"
-#include "base/memory/ptr_util.h"
-#include "base/stl_util.h"
-#include "components/mus/ws/default_access_policy.h"
-#include "components/mus/ws/display.h"
-#include "components/mus/ws/display_manager.h"
-#include "components/mus/ws/event_matcher.h"
-#include "components/mus/ws/focus_controller.h"
-#include "components/mus/ws/operation.h"
-#include "components/mus/ws/platform_display.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_observer.h"
-#include "components/mus/ws/user_display_manager.h"
-#include "components/mus/ws/window_manager_display_root.h"
-#include "components/mus/ws/window_manager_state.h"
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_tree_binding.h"
-#include "ui/display/display.h"
-#include "ui/platform_window/mojo/ime_type_converters.h"
-#include "ui/platform_window/text_input_state.h"
-
-using mojo::Array;
-using mojo::InterfaceRequest;
-using mojo::String;
-
-namespace mus {
-namespace ws {
-
-class TargetedEvent : public ServerWindowObserver {
- public:
- TargetedEvent(ServerWindow* target, const ui::Event& event)
- : target_(target), event_(ui::Event::Clone(event)) {
- target_->AddObserver(this);
- }
- ~TargetedEvent() override {
- if (target_)
- target_->RemoveObserver(this);
- }
-
- ServerWindow* target() { return target_; }
- std::unique_ptr<ui::Event> TakeEvent() { return std::move(event_); }
-
- private:
- // ServerWindowObserver:
- void OnWindowDestroyed(ServerWindow* window) override {
- DCHECK_EQ(target_, window);
- target_->RemoveObserver(this);
- target_ = nullptr;
- }
-
- ServerWindow* target_;
- std::unique_ptr<ui::Event> event_;
-
- DISALLOW_COPY_AND_ASSIGN(TargetedEvent);
-};
-
-WindowTree::WindowTree(WindowServer* window_server,
- const UserId& user_id,
- ServerWindow* root,
- std::unique_ptr<AccessPolicy> access_policy)
- : window_server_(window_server),
- user_id_(user_id),
- id_(window_server_->GetAndAdvanceNextClientId()),
- next_window_id_(1),
- access_policy_(std::move(access_policy)),
- event_ack_id_(0),
- window_manager_internal_(nullptr) {
- if (root)
- roots_.insert(root);
- access_policy_->Init(id_, this);
-}
-
-WindowTree::~WindowTree() {
- DestroyWindows();
-}
-
-void WindowTree::Init(std::unique_ptr<WindowTreeBinding> binding,
- mojom::WindowTreePtr tree) {
- DCHECK(!binding_);
- binding_ = std::move(binding);
-
- if (roots_.empty())
- return;
-
- std::vector<const ServerWindow*> to_send;
- CHECK_EQ(1u, roots_.size());
- const ServerWindow* root = *roots_.begin();
- GetUnknownWindowsFrom(root, &to_send);
-
- Display* display = GetDisplay(root);
- int64_t display_id =
- display ? display->id() : display::Display::kInvalidDisplayID;
- const ServerWindow* focused_window =
- display ? display->GetFocusedWindow() : nullptr;
- if (focused_window)
- focused_window = access_policy_->GetWindowForFocusChange(focused_window);
- ClientWindowId focused_window_id;
- if (focused_window)
- IsWindowKnown(focused_window, &focused_window_id);
-
- const bool drawn = root->parent() && root->parent()->IsDrawn();
- client()->OnEmbed(id_, WindowToWindowData(to_send.front()), std::move(tree),
- display_id, focused_window_id.id, drawn);
-}
-
-void WindowTree::ConfigureWindowManager() {
- DCHECK(!window_manager_internal_);
- window_manager_internal_ = binding_->GetWindowManager();
- window_manager_internal_->OnConnect(id_);
- window_manager_state_.reset(new WindowManagerState(this));
-}
-
-const ServerWindow* WindowTree::GetWindow(const WindowId& id) const {
- if (id_ == id.client_id) {
- auto iter = created_window_map_.find(id);
- return iter == created_window_map_.end() ? nullptr : iter->second;
- }
- return window_server_->GetWindow(id);
-}
-
-bool WindowTree::IsWindowKnown(const ServerWindow* window,
- ClientWindowId* id) const {
- if (!window)
- return false;
- auto iter = window_id_to_client_id_map_.find(window->id());
- if (iter == window_id_to_client_id_map_.end())
- return false;
- if (id)
- *id = iter->second;
- return true;
-}
-
-bool WindowTree::HasRoot(const ServerWindow* window) const {
- return roots_.count(window) > 0;
-}
-
-const ServerWindow* WindowTree::GetWindowByClientId(
- const ClientWindowId& id) const {
- auto iter = client_id_to_window_id_map_.find(id);
- return iter == client_id_to_window_id_map_.end() ? nullptr
- : GetWindow(iter->second);
-}
-
-const Display* WindowTree::GetDisplay(const ServerWindow* window) const {
- return window ? display_manager()->GetDisplayContaining(window) : nullptr;
-}
-
-const WindowManagerDisplayRoot* WindowTree::GetWindowManagerDisplayRoot(
- const ServerWindow* window) const {
- return window ? display_manager()->GetWindowManagerDisplayRoot(window)
- : nullptr;
-}
-
-DisplayManager* WindowTree::display_manager() {
- return window_server_->display_manager();
-}
-
-const DisplayManager* WindowTree::display_manager() const {
- return window_server_->display_manager();
-}
-
-void WindowTree::AddRootForWindowManager(const ServerWindow* root) {
- DCHECK(window_manager_internal_);
- const ClientWindowId client_window_id(WindowIdToTransportId(root->id()));
- DCHECK_EQ(0u, client_id_to_window_id_map_.count(client_window_id));
- client_id_to_window_id_map_[client_window_id] = root->id();
- window_id_to_client_id_map_[root->id()] = client_window_id;
- roots_.insert(root);
-
- Display* display = GetDisplay(root);
- DCHECK(display);
-
- window_manager_internal_->WmNewDisplayAdded(display->ToMojomDisplay(),
- WindowToWindowData(root),
- root->parent()->IsDrawn());
-}
-
-void WindowTree::OnWindowDestroyingTreeImpl(WindowTree* tree) {
- if (window_manager_state_)
- window_manager_state_->OnWillDestroyTree(tree);
-
- if (event_source_wms_ && event_source_wms_->window_tree() == tree)
- event_source_wms_ = nullptr;
-
- // Notify our client if |tree| was embedded in any of our views.
- for (const auto* tree_root : tree->roots_) {
- const bool owns_tree_root = tree_root->id().client_id == id_;
- if (owns_tree_root) {
- client()->OnEmbeddedAppDisconnected(
- ClientWindowIdForWindow(tree_root).id);
- }
- }
-}
-
-void WindowTree::NotifyChangeCompleted(
- uint32_t change_id,
- mojom::WindowManagerErrorCode error_code) {
- client()->OnChangeCompleted(
- change_id, error_code == mojom::WindowManagerErrorCode::SUCCESS);
-}
-
-bool WindowTree::SetCapture(const ClientWindowId& client_window_id) {
- ServerWindow* window = GetWindowByClientId(client_window_id);
- WindowManagerDisplayRoot* display_root = GetWindowManagerDisplayRoot(window);
- ServerWindow* current_capture_window =
- display_root ? display_root->window_manager_state()->capture_window()
- : nullptr;
- if (window && window->IsDrawn() && display_root &&
- display_root->window_manager_state()->IsActive() &&
- access_policy_->CanSetCapture(window) &&
- (!current_capture_window ||
- access_policy_->CanSetCapture(current_capture_window))) {
- return display_root->window_manager_state()->SetCapture(window, id_);
- }
- return false;
-}
-
-bool WindowTree::NewWindow(
- const ClientWindowId& client_window_id,
- const std::map<std::string, std::vector<uint8_t>>& properties) {
- if (!IsValidIdForNewWindow(client_window_id))
- return false;
- const WindowId window_id = GenerateNewWindowId();
- DCHECK(!GetWindow(window_id));
- ServerWindow* window =
- window_server_->CreateServerWindow(window_id, properties);
- created_window_map_[window_id] = window;
- client_id_to_window_id_map_[client_window_id] = window_id;
- window_id_to_client_id_map_[window_id] = client_window_id;
- return true;
-}
-
-bool WindowTree::AddWindow(const ClientWindowId& parent_id,
- const ClientWindowId& child_id) {
- ServerWindow* parent = GetWindowByClientId(parent_id);
- ServerWindow* child = GetWindowByClientId(child_id);
- if (parent && child && child->parent() != parent &&
- !child->Contains(parent) && access_policy_->CanAddWindow(parent, child)) {
- Operation op(this, window_server_, OperationType::ADD_WINDOW);
- parent->Add(child);
- return true;
- }
- return false;
-}
-
-bool WindowTree::AddTransientWindow(const ClientWindowId& window_id,
- const ClientWindowId& transient_window_id) {
- ServerWindow* window = GetWindowByClientId(window_id);
- ServerWindow* transient_window = GetWindowByClientId(transient_window_id);
- if (window && transient_window && !transient_window->Contains(window) &&
- access_policy_->CanAddTransientWindow(window, transient_window)) {
- Operation op(this, window_server_, OperationType::ADD_TRANSIENT_WINDOW);
- return window->AddTransientWindow(transient_window);
- }
- return false;
-}
-
-bool WindowTree::SetModal(const ClientWindowId& window_id) {
- ServerWindow* window = GetWindowByClientId(window_id);
- if (window && access_policy_->CanSetModal(window)) {
- WindowManagerDisplayRoot* display_root =
- GetWindowManagerDisplayRoot(window);
- if (window->transient_parent()) {
- window->SetModal();
- } else if (user_id_ != InvalidUserId()) {
- if (display_root)
- display_root->window_manager_state()->AddSystemModalWindow(window);
- } else {
- return false;
- }
- if (display_root)
- display_root->window_manager_state()->ReleaseCaptureBlockedByModalWindow(
- window);
- return true;
- }
- return false;
-}
-
-std::vector<const ServerWindow*> WindowTree::GetWindowTree(
- const ClientWindowId& window_id) const {
- const ServerWindow* window = GetWindowByClientId(window_id);
- std::vector<const ServerWindow*> windows;
- if (window)
- GetWindowTreeImpl(window, &windows);
- return windows;
-}
-
-bool WindowTree::SetWindowVisibility(const ClientWindowId& window_id,
- bool visible) {
- ServerWindow* window = GetWindowByClientId(window_id);
- if (!window || !access_policy_->CanChangeWindowVisibility(window))
- return false;
- if (window->visible() == visible)
- return true;
- Operation op(this, window_server_, OperationType::SET_WINDOW_VISIBILITY);
- window->SetVisible(visible);
- return true;
-}
-
-bool WindowTree::SetWindowOpacity(const ClientWindowId& window_id,
- float opacity) {
- ServerWindow* window = GetWindowByClientId(window_id);
- if (!window || !access_policy_->CanChangeWindowOpacity(window))
- return false;
- if (window->opacity() == opacity)
- return true;
- Operation op(this, window_server_, OperationType::SET_WINDOW_OPACITY);
- window->SetOpacity(opacity);
- return true;
-}
-
-bool WindowTree::SetFocus(const ClientWindowId& window_id) {
- ServerWindow* window = GetWindowByClientId(window_id);
- ServerWindow* currently_focused = window_server_->GetFocusedWindow();
- if (!currently_focused && !window) {
- DVLOG(1) << "SetFocus failure, no focused window to clear.";
- return false;
- }
-
- Display* display = GetDisplay(window);
- if (window && (!display || !window->can_focus() || !window->IsDrawn())) {
- DVLOG(1) << "SetFocus failure, window cannot be focused.";
- return false;
- }
-
- if (!access_policy_->CanSetFocus(window)) {
- DVLOG(1) << "SetFocus failure, blocked by access policy.";
- return false;
- }
-
- Operation op(this, window_server_, OperationType::SET_FOCUS);
- bool success = window_server_->SetFocusedWindow(window);
- if (!success) {
- DVLOG(1) << "SetFocus failure, could not SetFocusedWindow.";
- }
- return success;
-}
-
-bool WindowTree::Embed(const ClientWindowId& window_id,
- mojom::WindowTreeClientPtr client,
- uint32_t flags) {
- if (!client || !CanEmbed(window_id))
- return false;
- ServerWindow* window = GetWindowByClientId(window_id);
- PrepareForEmbed(window);
- // When embedding we don't know the user id of where the TreeClient came
- // from. Use an invalid id, which limits what the client is able to do.
- window_server_->EmbedAtWindow(window, InvalidUserId(), std::move(client),
- flags,
- base::WrapUnique(new DefaultAccessPolicy));
- return true;
-}
-
-void WindowTree::DispatchInputEvent(ServerWindow* target,
- const ui::Event& event) {
- if (event_ack_id_) {
- // This is currently waiting for an event ack. Add it to the queue.
- event_queue_.push(base::WrapUnique(new TargetedEvent(target, event)));
- // TODO(sad): If the |event_queue_| grows too large, then this should notify
- // Display, so that it can stop sending events.
- return;
- }
-
- // If there are events in the queue, then store this new event in the queue,
- // and dispatch the latest event from the queue instead that still has a live
- // target.
- if (!event_queue_.empty()) {
- event_queue_.push(base::WrapUnique(new TargetedEvent(target, event)));
- return;
- }
-
- DispatchInputEventImpl(target, event);
-}
-
-bool WindowTree::IsWaitingForNewTopLevelWindow(uint32_t wm_change_id) {
- return waiting_for_top_level_window_info_ &&
- waiting_for_top_level_window_info_->wm_change_id == wm_change_id;
-}
-
-void WindowTree::OnWindowManagerCreatedTopLevelWindow(
- uint32_t wm_change_id,
- uint32_t client_change_id,
- const ServerWindow* window) {
- DCHECK(IsWaitingForNewTopLevelWindow(wm_change_id));
- std::unique_ptr<WaitingForTopLevelWindowInfo>
- waiting_for_top_level_window_info(
- std::move(waiting_for_top_level_window_info_));
- binding_->SetIncomingMethodCallProcessingPaused(false);
- // We were paused, so the id should still be valid.
- DCHECK(IsValidIdForNewWindow(
- waiting_for_top_level_window_info->client_window_id));
- client_id_to_window_id_map_[waiting_for_top_level_window_info
- ->client_window_id] = window->id();
- window_id_to_client_id_map_[window->id()] =
- waiting_for_top_level_window_info->client_window_id;
- roots_.insert(window);
- Display* display = GetDisplay(window);
- int64_t display_id =
- display ? display->id() : display::Display::kInvalidDisplayID;
- const bool drawn = window->parent() && window->parent()->IsDrawn();
- client()->OnTopLevelCreated(client_change_id, WindowToWindowData(window),
- display_id, drawn);
-}
-
-void WindowTree::AddActivationParent(const ClientWindowId& window_id) {
- ServerWindow* window = GetWindowByClientId(window_id);
- if (window) {
- Display* display = GetDisplay(window);
- if (display)
- display->AddActivationParent(window);
- else
- DVLOG(1) << "AddActivationParent window not associated with display";
- } else {
- DVLOG(1) << "AddActivationParent supplied invalid window id";
- }
-}
-
-void WindowTree::OnChangeCompleted(uint32_t change_id, bool success) {
- client()->OnChangeCompleted(change_id, success);
-}
-
-void WindowTree::OnAccelerator(uint32_t accelerator_id,
- const ui::Event& event) {
- DCHECK(window_manager_internal_);
- // TODO(moshayedi): crbug.com/617167. Don't clone even once we map
- // mojom::Event directly to ui::Event.
- window_manager_internal_->OnAccelerator(accelerator_id,
- ui::Event::Clone(event));
-}
-
-void WindowTree::ClientJankinessChanged(WindowTree* tree) {
- tree->janky_ = !tree->janky_;
- if (window_manager_internal_) {
- window_manager_internal_->WmClientJankinessChanged(
- tree->id(), tree->janky());
- }
-}
-
-void WindowTree::ProcessWindowBoundsChanged(const ServerWindow* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds,
- bool originated_change) {
- ClientWindowId client_window_id;
- if (originated_change || !IsWindowKnown(window, &client_window_id))
- return;
- client()->OnWindowBoundsChanged(client_window_id.id, old_bounds, new_bounds);
-}
-
-void WindowTree::ProcessClientAreaChanged(
- const ServerWindow* window,
- const gfx::Insets& new_client_area,
- const std::vector<gfx::Rect>& new_additional_client_areas,
- bool originated_change) {
- ClientWindowId client_window_id;
- if (originated_change || !IsWindowKnown(window, &client_window_id))
- return;
- client()->OnClientAreaChanged(
- client_window_id.id, new_client_area,
- std::vector<gfx::Rect>(new_additional_client_areas));
-}
-
-void WindowTree::ProcessWillChangeWindowHierarchy(
- const ServerWindow* window,
- const ServerWindow* new_parent,
- const ServerWindow* old_parent,
- bool originated_change) {
- if (originated_change)
- return;
-
- const bool old_drawn = window->IsDrawn();
- const bool new_drawn =
- window->visible() && new_parent && new_parent->IsDrawn();
- if (old_drawn == new_drawn)
- return;
-
- NotifyDrawnStateChanged(window, new_drawn);
-}
-
-void WindowTree::ProcessWindowPropertyChanged(
- const ServerWindow* window,
- const std::string& name,
- const std::vector<uint8_t>* new_data,
- bool originated_change) {
- if (originated_change)
- return;
-
- ClientWindowId client_window_id;
- if (!IsWindowKnown(window, &client_window_id))
- return;
-
- Array<uint8_t> data(nullptr);
- if (new_data)
- data = Array<uint8_t>::From(*new_data);
-
- client()->OnWindowSharedPropertyChanged(client_window_id.id, String(name),
- std::move(data));
-}
-
-void WindowTree::ProcessWindowHierarchyChanged(const ServerWindow* window,
- const ServerWindow* new_parent,
- const ServerWindow* old_parent,
- bool originated_change) {
- const bool knows_new = new_parent && IsWindowKnown(new_parent);
- if (originated_change && !IsWindowKnown(window) && knows_new) {
- std::vector<const ServerWindow*> unused;
- GetUnknownWindowsFrom(window, &unused);
- }
- if (originated_change || (window_server_->current_operation_type() ==
- OperationType::DELETE_WINDOW) ||
- (window_server_->current_operation_type() == OperationType::EMBED) ||
- window_server_->DidTreeMessageClient(id_)) {
- return;
- }
-
- if (!access_policy_->ShouldNotifyOnHierarchyChange(window, &new_parent,
- &old_parent)) {
- return;
- }
- // Inform the client of any new windows and update the set of windows we know
- // about.
- std::vector<const ServerWindow*> to_send;
- if (!IsWindowKnown(window))
- GetUnknownWindowsFrom(window, &to_send);
- const bool knows_old = old_parent && IsWindowKnown(old_parent);
- if (!knows_old && !knows_new)
- return;
-
- const ClientWindowId new_parent_client_window_id =
- knows_new ? ClientWindowIdForWindow(new_parent) : ClientWindowId();
- const ClientWindowId old_parent_client_window_id =
- knows_old ? ClientWindowIdForWindow(old_parent) : ClientWindowId();
- const ClientWindowId client_window_id =
- window ? ClientWindowIdForWindow(window) : ClientWindowId();
- client()->OnWindowHierarchyChanged(
- client_window_id.id, old_parent_client_window_id.id,
- new_parent_client_window_id.id, WindowsToWindowDatas(to_send));
- window_server_->OnTreeMessagedClient(id_);
-}
-
-void WindowTree::ProcessWindowReorder(const ServerWindow* window,
- const ServerWindow* relative_window,
- mojom::OrderDirection direction,
- bool originated_change) {
- DCHECK_EQ(window->parent(), relative_window->parent());
- ClientWindowId client_window_id, relative_client_window_id;
- if (originated_change || !IsWindowKnown(window, &client_window_id) ||
- !IsWindowKnown(relative_window, &relative_client_window_id) ||
- window_server_->DidTreeMessageClient(id_))
- return;
-
- // Do not notify ordering changes of the root windows, since the client
- // doesn't know about the ancestors of the roots, and so can't do anything
- // about this ordering change of the root.
- if (HasRoot(window) || HasRoot(relative_window))
- return;
-
- client()->OnWindowReordered(client_window_id.id, relative_client_window_id.id,
- direction);
- window_server_->OnTreeMessagedClient(id_);
-}
-
-void WindowTree::ProcessWindowDeleted(const ServerWindow* window,
- bool originated_change) {
- if (window->id().client_id == id_)
- created_window_map_.erase(window->id());
-
- ClientWindowId client_window_id;
- if (!IsWindowKnown(window, &client_window_id))
- return;
-
- if (HasRoot(window))
- RemoveRoot(window, RemoveRootReason::DELETED);
- else
- RemoveFromMaps(window);
-
- if (originated_change)
- return;
-
- client()->OnWindowDeleted(client_window_id.id);
- window_server_->OnTreeMessagedClient(id_);
-}
-
-void WindowTree::ProcessWillChangeWindowVisibility(const ServerWindow* window,
- bool originated_change) {
- if (originated_change)
- return;
-
- ClientWindowId client_window_id;
- if (IsWindowKnown(window, &client_window_id)) {
- client()->OnWindowVisibilityChanged(client_window_id.id,
- !window->visible());
- return;
- }
-
- bool window_target_drawn_state;
- if (window->visible()) {
- // Window is being hidden, won't be drawn.
- window_target_drawn_state = false;
- } else {
- // Window is being shown. Window will be drawn if its parent is drawn.
- window_target_drawn_state = window->parent() && window->parent()->IsDrawn();
- }
-
- NotifyDrawnStateChanged(window, window_target_drawn_state);
-}
-
-void WindowTree::ProcessWindowOpacityChanged(const ServerWindow* window,
- float old_opacity,
- float new_opacity,
- bool originated_change) {
- if (originated_change)
- return;
-
- ClientWindowId client_window_id;
- if (IsWindowKnown(window, &client_window_id)) {
- client()->OnWindowOpacityChanged(client_window_id.id, old_opacity,
- new_opacity);
- }
-}
-
-void WindowTree::ProcessCursorChanged(const ServerWindow* window,
- int32_t cursor_id,
- bool originated_change) {
- if (originated_change)
- return;
- ClientWindowId client_window_id;
- if (!IsWindowKnown(window, &client_window_id))
- return;
-
- client()->OnWindowPredefinedCursorChanged(client_window_id.id,
- mojom::Cursor(cursor_id));
-}
-
-void WindowTree::ProcessFocusChanged(const ServerWindow* old_focused_window,
- const ServerWindow* new_focused_window) {
- if (window_server_->current_operation_type() == OperationType::SET_FOCUS &&
- window_server_->IsOperationSource(id_)) {
- return;
- }
- const ServerWindow* window =
- new_focused_window
- ? access_policy_->GetWindowForFocusChange(new_focused_window)
- : nullptr;
- ClientWindowId client_window_id;
- // If the window isn't known we'll supply null, which is ok.
- IsWindowKnown(window, &client_window_id);
- client()->OnWindowFocused(client_window_id.id);
-}
-
-void WindowTree::ProcessTransientWindowAdded(
- const ServerWindow* window,
- const ServerWindow* transient_window,
- bool originated_change) {
- if (originated_change)
- return;
-
- ClientWindowId client_window_id, transient_client_window_id;
- if (!IsWindowKnown(window, &client_window_id) ||
- !IsWindowKnown(transient_window, &transient_client_window_id)) {
- return;
- }
- client()->OnTransientWindowAdded(client_window_id.id,
- transient_client_window_id.id);
-}
-
-void WindowTree::ProcessTransientWindowRemoved(
- const ServerWindow* window,
- const ServerWindow* transient_window,
- bool originated_change) {
- if (originated_change)
- return;
- ClientWindowId client_window_id, transient_client_window_id;
- if (!IsWindowKnown(window, &client_window_id) ||
- !IsWindowKnown(transient_window, &transient_client_window_id)) {
- return;
- }
- client()->OnTransientWindowRemoved(client_window_id.id,
- transient_client_window_id.id);
-}
-
-bool WindowTree::ShouldRouteToWindowManager(const ServerWindow* window) const {
- if (window_manager_state_)
- return false; // We are the window manager, don't route to ourself.
-
- // If the client created this window, then do not route it through the WM.
- if (window->id().client_id == id_)
- return false;
-
- // If the client did not create the window, then it must be the root of the
- // client. If not, that means the client should not know about this window,
- // and so do not route the request to the WM.
- if (roots_.count(window) == 0)
- return false;
-
- // The WindowManager is attached to the root of the Display, if there isn't a
- // WindowManager attached no need to route to it.
- const WindowManagerDisplayRoot* display_root =
- GetWindowManagerDisplayRoot(window);
- if (!display_root)
- return false;
-
- // Route to the windowmanager if the windowmanager created the window.
- return display_root->window_manager_state()->window_tree()->id() ==
- window->id().client_id;
-}
-
-void WindowTree::ProcessLostCapture(const ServerWindow* old_capture_window,
- bool originated_change) {
- if ((originated_change &&
- window_server_->current_operation_type() ==
- OperationType::RELEASE_CAPTURE) ||
- !IsWindowKnown(old_capture_window)) {
- return;
- }
- client()->OnLostCapture(WindowIdToTransportId(old_capture_window->id()));
-}
-
-ClientWindowId WindowTree::ClientWindowIdForWindow(
- const ServerWindow* window) const {
- auto iter = window_id_to_client_id_map_.find(window->id());
- DCHECK(iter != window_id_to_client_id_map_.end());
- return iter->second;
-}
-
-bool WindowTree::IsValidIdForNewWindow(const ClientWindowId& id) const {
- // Reserve 0 to indicate a null window.
- return client_id_to_window_id_map_.count(id) == 0u &&
- access_policy_->IsValidIdForNewWindow(id) && id != ClientWindowId();
-}
-
-WindowId WindowTree::GenerateNewWindowId() {
- // TODO(sky): deal with wrapping and uniqueness.
- return WindowId(id_, next_window_id_++);
-}
-
-bool WindowTree::CanReorderWindow(const ServerWindow* window,
- const ServerWindow* relative_window,
- mojom::OrderDirection direction) const {
- if (!window || !relative_window)
- return false;
-
- if (!window->parent() || window->parent() != relative_window->parent())
- return false;
-
- if (!access_policy_->CanReorderWindow(window, relative_window, direction))
- return false;
-
- std::vector<const ServerWindow*> children = window->parent()->GetChildren();
- const size_t child_i =
- std::find(children.begin(), children.end(), window) - children.begin();
- const size_t target_i =
- std::find(children.begin(), children.end(), relative_window) -
- children.begin();
- if ((direction == mojom::OrderDirection::ABOVE && child_i == target_i + 1) ||
- (direction == mojom::OrderDirection::BELOW && child_i + 1 == target_i)) {
- return false;
- }
-
- return true;
-}
-
-bool WindowTree::DeleteWindowImpl(WindowTree* source, ServerWindow* window) {
- DCHECK(window);
- DCHECK_EQ(window->id().client_id, id_);
- Operation op(source, window_server_, OperationType::DELETE_WINDOW);
- delete window;
- return true;
-}
-
-void WindowTree::GetUnknownWindowsFrom(
- const ServerWindow* window,
- std::vector<const ServerWindow*>* windows) {
- if (IsWindowKnown(window) || !access_policy_->CanGetWindowTree(window))
- return;
- windows->push_back(window);
- // There are two cases where this gets hit:
- // . During init, in which case using the window id as the client id is
- // fine.
- // . When a window is moved to a parent of a window we know about. This is
- // only encountered for the WM or embed roots. We assume such clients want
- // to see the real id of the window and are only created ClientWindowIds
- // with the client_id.
- const ClientWindowId client_window_id(WindowIdToTransportId(window->id()));
- DCHECK_EQ(0u, client_id_to_window_id_map_.count(client_window_id));
- client_id_to_window_id_map_[client_window_id] = window->id();
- window_id_to_client_id_map_[window->id()] = client_window_id;
- if (!access_policy_->CanDescendIntoWindowForWindowTree(window))
- return;
- std::vector<const ServerWindow*> children(window->GetChildren());
- for (size_t i = 0; i < children.size(); ++i)
- GetUnknownWindowsFrom(children[i], windows);
-}
-
-bool WindowTree::RemoveFromMaps(const ServerWindow* window) {
- auto iter = window_id_to_client_id_map_.find(window->id());
- if (iter == window_id_to_client_id_map_.end())
- return false;
-
- client_id_to_window_id_map_.erase(iter->second);
- window_id_to_client_id_map_.erase(iter);
- return true;
-}
-
-void WindowTree::RemoveFromKnown(const ServerWindow* window,
- std::vector<ServerWindow*>* local_windows) {
- if (window->id().client_id == id_) {
- if (local_windows)
- local_windows->push_back(GetWindow(window->id()));
- return;
- }
-
- RemoveFromMaps(window);
-
- std::vector<const ServerWindow*> children = window->GetChildren();
- for (size_t i = 0; i < children.size(); ++i)
- RemoveFromKnown(children[i], local_windows);
-}
-
-void WindowTree::RemoveRoot(const ServerWindow* window,
- RemoveRootReason reason) {
- DCHECK(roots_.count(window) > 0);
- roots_.erase(window);
-
- const ClientWindowId client_window_id(ClientWindowIdForWindow(window));
-
- // No need to do anything if we created the window.
- if (window->id().client_id == id_)
- return;
-
- if (reason == RemoveRootReason::EMBED) {
- client()->OnUnembed(client_window_id.id);
- client()->OnWindowDeleted(client_window_id.id);
- window_server_->OnTreeMessagedClient(id_);
- }
-
- // This client no longer knows about the window. Unparent any windows that
- // were parented to windows in the root.
- std::vector<ServerWindow*> local_windows;
- RemoveFromKnown(window, &local_windows);
- for (size_t i = 0; i < local_windows.size(); ++i)
- local_windows[i]->parent()->Remove(local_windows[i]);
-}
-
-Array<mojom::WindowDataPtr> WindowTree::WindowsToWindowDatas(
- const std::vector<const ServerWindow*>& windows) {
- Array<mojom::WindowDataPtr> array(windows.size());
- for (size_t i = 0; i < windows.size(); ++i)
- array[i] = WindowToWindowData(windows[i]);
- return array;
-}
-
-mojom::WindowDataPtr WindowTree::WindowToWindowData(
- const ServerWindow* window) {
- DCHECK(IsWindowKnown(window));
- const ServerWindow* parent = window->parent();
- // If the parent isn't known, it means the parent is not visible to us (not
- // in roots), and should not be sent over.
- if (parent && !IsWindowKnown(parent))
- parent = nullptr;
- mojom::WindowDataPtr window_data(mojom::WindowData::New());
- window_data->parent_id =
- parent ? ClientWindowIdForWindow(parent).id : ClientWindowId().id;
- window_data->window_id =
- window ? ClientWindowIdForWindow(window).id : ClientWindowId().id;
- window_data->bounds = window->bounds();
- window_data->properties =
- mojo::Map<String, Array<uint8_t>>::From(window->properties());
- window_data->visible = window->visible();
- return window_data;
-}
-
-void WindowTree::GetWindowTreeImpl(
- const ServerWindow* window,
- std::vector<const ServerWindow*>* windows) const {
- DCHECK(window);
-
- if (!access_policy_->CanGetWindowTree(window))
- return;
-
- windows->push_back(window);
-
- if (!access_policy_->CanDescendIntoWindowForWindowTree(window))
- return;
-
- std::vector<const ServerWindow*> children(window->GetChildren());
- for (size_t i = 0; i < children.size(); ++i)
- GetWindowTreeImpl(children[i], windows);
-}
-
-void WindowTree::NotifyDrawnStateChanged(const ServerWindow* window,
- bool new_drawn_value) {
- // Even though we don't know about window, it may be an ancestor of our root,
- // in which case the change may effect our roots drawn state.
- if (roots_.empty())
- return;
-
- for (auto* root : roots_) {
- if (window->Contains(root) && (new_drawn_value != root->IsDrawn())) {
- client()->OnWindowParentDrawnStateChanged(
- ClientWindowIdForWindow(root).id, new_drawn_value);
- }
- }
-}
-
-void WindowTree::DestroyWindows() {
- if (created_window_map_.empty())
- return;
-
- Operation op(this, window_server_, OperationType::DELETE_WINDOW);
- // If we get here from the destructor we're not going to get
- // ProcessWindowDeleted(). Copy the map and delete from the copy so that we
- // don't have to worry about whether |created_window_map_| changes or not.
- base::hash_map<WindowId, ServerWindow*> created_window_map_copy;
- created_window_map_.swap(created_window_map_copy);
- // A sibling can be a transient parent of another window so we detach windows
- // from their transient parents to avoid double deletes.
- for (auto& pair : created_window_map_copy) {
- ServerWindow* transient_parent = pair.second->transient_parent();
- if (transient_parent)
- transient_parent->RemoveTransientWindow(pair.second);
- }
- STLDeleteValues(&created_window_map_copy);
-}
-
-bool WindowTree::CanEmbed(const ClientWindowId& window_id) const {
- const ServerWindow* window = GetWindowByClientId(window_id);
- return window && access_policy_->CanEmbed(window);
-}
-
-void WindowTree::PrepareForEmbed(ServerWindow* window) {
- DCHECK(window);
-
- // Only allow a node to be the root for one client.
- WindowTree* existing_owner = window_server_->GetTreeWithRoot(window);
-
- Operation op(this, window_server_, OperationType::EMBED);
- RemoveChildrenAsPartOfEmbed(window);
- if (existing_owner) {
- // Never message the originating client.
- window_server_->OnTreeMessagedClient(id_);
- existing_owner->RemoveRoot(window, RemoveRootReason::EMBED);
- }
-}
-
-void WindowTree::RemoveChildrenAsPartOfEmbed(ServerWindow* window) {
- CHECK(window);
- std::vector<ServerWindow*> children = window->GetChildren();
- for (size_t i = 0; i < children.size(); ++i)
- window->Remove(children[i]);
-}
-
-void WindowTree::DispatchInputEventImpl(ServerWindow* target,
- const ui::Event& event) {
- DCHECK(!event_ack_id_);
- // We do not want to create a sequential id for each event, because that can
- // leak some information to the client. So instead, manufacture the id
- // randomly.
- // TODO(moshayedi): Find a faster way to generate ids.
- event_ack_id_ = 0x1000000 | (rand() & 0xffffff);
- WindowManagerDisplayRoot* display_root = GetWindowManagerDisplayRoot(target);
- DCHECK(display_root);
- event_source_wms_ = display_root->window_manager_state();
- // Should only get events from windows attached to a host.
- DCHECK(event_source_wms_);
- bool matched_observer =
- event_observer_matcher_ && event_observer_matcher_->MatchesEvent(event);
- client()->OnWindowInputEvent(
- event_ack_id_, ClientWindowIdForWindow(target).id,
- ui::Event::Clone(event), matched_observer ? event_observer_id_ : 0);
-}
-
-void WindowTree::SendToEventObserver(const ui::Event& event) {
- if (event_observer_matcher_ && event_observer_matcher_->MatchesEvent(event))
- client()->OnEventObserved(ui::Event::Clone(event), event_observer_id_);
-}
-
-void WindowTree::NewWindow(
- uint32_t change_id,
- Id transport_window_id,
- mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) {
- std::map<std::string, std::vector<uint8_t>> properties;
- if (!transport_properties.is_null()) {
- properties =
- transport_properties.To<std::map<std::string, std::vector<uint8_t>>>();
- }
- client()->OnChangeCompleted(
- change_id, NewWindow(ClientWindowId(transport_window_id), properties));
-}
-
-void WindowTree::NewTopLevelWindow(
- uint32_t change_id,
- Id transport_window_id,
- mojo::Map<mojo::String, mojo::Array<uint8_t>> transport_properties) {
- DCHECK(!waiting_for_top_level_window_info_);
- const ClientWindowId client_window_id(transport_window_id);
- // TODO(sky): need a way for client to provide context to figure out display.
- Display* display = display_manager()->displays().empty()
- ? nullptr
- : *(display_manager()->displays().begin());
- // TODO(sky): move checks to accesspolicy.
- WindowManagerDisplayRoot* display_root =
- display && user_id_ != InvalidUserId()
- ? display->GetWindowManagerDisplayRootForUser(user_id_)
- : nullptr;
- if (!display_root ||
- display_root->window_manager_state()->window_tree() == this ||
- !IsValidIdForNewWindow(client_window_id)) {
- client()->OnChangeCompleted(change_id, false);
- return;
- }
-
- // The server creates the real window. Any further messages from the client
- // may try to alter the window. Pause incoming messages so that we know we
- // can't get a message for a window before the window is created. Once the
- // window is created we'll resume processing.
- binding_->SetIncomingMethodCallProcessingPaused(true);
-
- const uint32_t wm_change_id =
- window_server_->GenerateWindowManagerChangeId(this, change_id);
-
- waiting_for_top_level_window_info_.reset(
- new WaitingForTopLevelWindowInfo(client_window_id, wm_change_id));
-
- display_root->window_manager_state()
- ->window_tree()
- ->window_manager_internal_->WmCreateTopLevelWindow(
- wm_change_id, id_, std::move(transport_properties));
-}
-
-void WindowTree::DeleteWindow(uint32_t change_id, Id transport_window_id) {
- ServerWindow* window =
- GetWindowByClientId(ClientWindowId(transport_window_id));
- bool success = false;
- bool should_close = window && (access_policy_->CanDeleteWindow(window) ||
- ShouldRouteToWindowManager(window));
- if (should_close) {
- WindowTree* tree =
- window_server_->GetTreeWithId(window->id().client_id);
- success = tree && tree->DeleteWindowImpl(this, window);
- }
- client()->OnChangeCompleted(change_id, success);
-}
-
-void WindowTree::AddWindow(uint32_t change_id, Id parent_id, Id child_id) {
- client()->OnChangeCompleted(change_id, AddWindow(ClientWindowId(parent_id),
- ClientWindowId(child_id)));
-}
-
-void WindowTree::RemoveWindowFromParent(uint32_t change_id, Id window_id) {
- bool success = false;
- ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
- if (window && window->parent() &&
- access_policy_->CanRemoveWindowFromParent(window)) {
- success = true;
- Operation op(this, window_server_,
- OperationType::REMOVE_WINDOW_FROM_PARENT);
- window->parent()->Remove(window);
- }
- client()->OnChangeCompleted(change_id, success);
-}
-
-void WindowTree::AddTransientWindow(uint32_t change_id,
- Id window,
- Id transient_window) {
- client()->OnChangeCompleted(
- change_id, AddTransientWindow(ClientWindowId(window),
- ClientWindowId(transient_window)));
-}
-
-void WindowTree::RemoveTransientWindowFromParent(uint32_t change_id,
- Id transient_window_id) {
- bool success = false;
- ServerWindow* transient_window =
- GetWindowByClientId(ClientWindowId(transient_window_id));
- if (transient_window && transient_window->transient_parent() &&
- access_policy_->CanRemoveTransientWindowFromParent(transient_window)) {
- success = true;
- Operation op(this, window_server_,
- OperationType::REMOVE_TRANSIENT_WINDOW_FROM_PARENT);
- transient_window->transient_parent()->RemoveTransientWindow(
- transient_window);
- }
- client()->OnChangeCompleted(change_id, success);
-}
-
-void WindowTree::SetModal(uint32_t change_id, Id window_id) {
- client()->OnChangeCompleted(change_id, SetModal(ClientWindowId(window_id)));
-}
-
-void WindowTree::ReorderWindow(uint32_t change_id,
- Id window_id,
- Id relative_window_id,
- mojom::OrderDirection direction) {
- bool success = false;
- ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
- ServerWindow* relative_window =
- GetWindowByClientId(ClientWindowId(relative_window_id));
- if (CanReorderWindow(window, relative_window, direction)) {
- success = true;
- Operation op(this, window_server_, OperationType::REORDER_WINDOW);
- window->Reorder(relative_window, direction);
- window_server_->ProcessWindowReorder(window, relative_window, direction);
- }
- client()->OnChangeCompleted(change_id, success);
-}
-
-void WindowTree::GetWindowTree(
- Id window_id,
- const base::Callback<void(Array<mojom::WindowDataPtr>)>& callback) {
- std::vector<const ServerWindow*> windows(
- GetWindowTree(ClientWindowId(window_id)));
- callback.Run(WindowsToWindowDatas(windows));
-}
-
-void WindowTree::SetCapture(uint32_t change_id, Id window_id) {
- client()->OnChangeCompleted(change_id, SetCapture(ClientWindowId(window_id)));
-}
-
-void WindowTree::ReleaseCapture(uint32_t change_id, Id window_id) {
- ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
- WindowManagerDisplayRoot* display_root = GetWindowManagerDisplayRoot(window);
- ServerWindow* current_capture_window =
- display_root ? display_root->window_manager_state()->capture_window()
- : nullptr;
- bool success = window && display_root &&
- display_root->window_manager_state()->IsActive() &&
- (!current_capture_window ||
- access_policy_->CanSetCapture(current_capture_window)) &&
- window == current_capture_window;
- if (success) {
- Operation op(this, window_server_, OperationType::RELEASE_CAPTURE);
- success = display_root->window_manager_state()->SetCapture(
- nullptr, kInvalidClientId);
- }
- client()->OnChangeCompleted(change_id, success);
-}
-
-void WindowTree::SetEventObserver(mojom::EventMatcherPtr matcher,
- uint32_t observer_id) {
- if (matcher.is_null() || observer_id == 0) {
- // Clear any existing event observer.
- event_observer_matcher_.reset();
- event_observer_id_ = 0;
- return;
- }
-
- // Do not allow key events to be observed, as a compromised app could register
- // itself as an event observer and spy on keystrokes to another app.
- if (!matcher->type_matcher) {
- DVLOG(1) << "SetEventObserver must specify an event type.";
- return;
- }
- const ui::mojom::EventType event_type_whitelist[] = {
- ui::mojom::EventType::POINTER_CANCEL, ui::mojom::EventType::POINTER_DOWN,
- ui::mojom::EventType::POINTER_MOVE, ui::mojom::EventType::POINTER_UP,
- ui::mojom::EventType::MOUSE_EXIT, ui::mojom::EventType::WHEEL,
- };
- bool allowed = false;
- for (ui::mojom::EventType event_type : event_type_whitelist) {
- if (matcher->type_matcher->type == event_type) {
- allowed = true;
- break;
- }
- }
- if (!allowed) {
- DVLOG(1) << "SetEventObserver event type not allowed";
- return;
- }
-
- event_observer_matcher_.reset(new EventMatcher(*matcher));
- event_observer_id_ = observer_id;
-}
-
-void WindowTree::SetWindowBounds(uint32_t change_id,
- Id window_id,
- const gfx::Rect& bounds) {
- ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
- if (window && ShouldRouteToWindowManager(window)) {
- const uint32_t wm_change_id =
- window_server_->GenerateWindowManagerChangeId(this, change_id);
- // |window_id| may be a client id, use the id from the window to ensure
- // the windowmanager doesn't get an id it doesn't know about.
- WindowManagerDisplayRoot* display_root =
- GetWindowManagerDisplayRoot(window);
- WindowTree* wm_tree = display_root->window_manager_state()->window_tree();
- wm_tree->window_manager_internal_->WmSetBounds(
- wm_change_id, wm_tree->ClientWindowIdForWindow(window).id,
- std::move(bounds));
- return;
- }
-
- // Only the owner of the window can change the bounds.
- bool success = window && access_policy_->CanSetWindowBounds(window);
- if (success) {
- Operation op(this, window_server_, OperationType::SET_WINDOW_BOUNDS);
- window->SetBounds(bounds);
- }
- client()->OnChangeCompleted(change_id, success);
-}
-
-void WindowTree::SetWindowVisibility(uint32_t change_id,
- Id transport_window_id,
- bool visible) {
- client()->OnChangeCompleted(
- change_id,
- SetWindowVisibility(ClientWindowId(transport_window_id), visible));
-}
-
-void WindowTree::SetWindowProperty(uint32_t change_id,
- Id transport_window_id,
- const mojo::String& name,
- mojo::Array<uint8_t> value) {
- ServerWindow* window =
- GetWindowByClientId(ClientWindowId(transport_window_id));
- if (window && ShouldRouteToWindowManager(window)) {
- const uint32_t wm_change_id =
- window_server_->GenerateWindowManagerChangeId(this, change_id);
- WindowManagerDisplayRoot* display_root =
- GetWindowManagerDisplayRoot(window);
- WindowTree* wm_tree = display_root->window_manager_state()->window_tree();
- wm_tree->window_manager_internal_->WmSetProperty(
- wm_change_id, wm_tree->ClientWindowIdForWindow(window).id, name,
- std::move(value));
- return;
- }
- const bool success = window && access_policy_->CanSetWindowProperties(window);
- if (success) {
- Operation op(this, window_server_, OperationType::SET_WINDOW_PROPERTY);
- if (value.is_null()) {
- window->SetProperty(name, nullptr);
- } else {
- std::vector<uint8_t> data = value.To<std::vector<uint8_t>>();
- window->SetProperty(name, &data);
- }
- }
- client()->OnChangeCompleted(change_id, success);
-}
-
-void WindowTree::SetWindowOpacity(uint32_t change_id,
- Id window_id,
- float opacity) {
- client()->OnChangeCompleted(
- change_id, SetWindowOpacity(ClientWindowId(window_id), opacity));
-}
-
-void WindowTree::AttachSurface(Id transport_window_id,
- mojom::SurfaceType type,
- mojo::InterfaceRequest<mojom::Surface> surface,
- mojom::SurfaceClientPtr client) {
- ServerWindow* window =
- GetWindowByClientId(ClientWindowId(transport_window_id));
- const bool success =
- window && access_policy_->CanSetWindowSurface(window, type);
- if (!success)
- return;
- window->CreateSurface(type, std::move(surface), std::move(client));
-}
-
-void WindowTree::SetWindowTextInputState(Id transport_window_id,
- mojo::TextInputStatePtr state) {
- ServerWindow* window =
- GetWindowByClientId(ClientWindowId(transport_window_id));
- bool success = window && access_policy_->CanSetWindowTextInputState(window);
- if (success)
- window->SetTextInputState(state.To<ui::TextInputState>());
-}
-
-void WindowTree::SetImeVisibility(Id transport_window_id,
- bool visible,
- mojo::TextInputStatePtr state) {
- ServerWindow* window =
- GetWindowByClientId(ClientWindowId(transport_window_id));
- bool success = window && access_policy_->CanSetWindowTextInputState(window);
- if (success) {
- if (!state.is_null())
- window->SetTextInputState(state.To<ui::TextInputState>());
-
- Display* display = GetDisplay(window);
- if (display)
- display->SetImeVisibility(window, visible);
- }
-}
-
-void WindowTree::OnWindowInputEventAck(uint32_t event_id,
- mojom::EventResult result) {
- if (event_ack_id_ == 0 || event_id != event_ack_id_) {
- // TODO(sad): Something bad happened. Kill the client?
- NOTIMPLEMENTED() << "Wrong event acked.";
- }
- event_ack_id_ = 0;
-
- if (janky_)
- event_source_wms_->window_tree()->ClientJankinessChanged(this);
-
- WindowManagerState* event_source_wms = event_source_wms_;
- event_source_wms_ = nullptr;
- if (event_source_wms)
- event_source_wms->OnEventAck(this, result);
-
- if (!event_queue_.empty()) {
- DCHECK(!event_ack_id_);
- ServerWindow* target = nullptr;
- std::unique_ptr<ui::Event> event;
- do {
- std::unique_ptr<TargetedEvent> targeted_event =
- std::move(event_queue_.front());
- event_queue_.pop();
- target = targeted_event->target();
- event = targeted_event->TakeEvent();
- } while (!event_queue_.empty() && !GetDisplay(target));
- if (target)
- DispatchInputEventImpl(target, *event);
- }
-}
-
-void WindowTree::SetClientArea(
- Id transport_window_id,
- const gfx::Insets& insets,
- mojo::Array<gfx::Rect> transport_additional_client_areas) {
- ServerWindow* window =
- GetWindowByClientId(ClientWindowId(transport_window_id));
- if (!window || !access_policy_->CanSetClientArea(window))
- return;
-
- std::vector<gfx::Rect> additional_client_areas =
- transport_additional_client_areas.To<std::vector<gfx::Rect>>();
- window->SetClientArea(insets, additional_client_areas);
-}
-
-void WindowTree::SetHitTestMask(Id transport_window_id, const gfx::Rect& mask) {
- ServerWindow* window =
- GetWindowByClientId(ClientWindowId(transport_window_id));
- if (!window || !access_policy_->CanSetHitTestMask(window)) {
- DVLOG(1) << "SetHitTestMask failed";
- return;
- }
-
- if (!mask.IsEmpty())
- window->SetHitTestMask(mask);
- else
- window->ClearHitTestMask();
-}
-
-void WindowTree::Embed(Id transport_window_id,
- mojom::WindowTreeClientPtr client,
- uint32_t flags,
- const EmbedCallback& callback) {
- callback.Run(
- Embed(ClientWindowId(transport_window_id), std::move(client), flags));
-}
-
-void WindowTree::SetFocus(uint32_t change_id, Id transport_window_id) {
- client()->OnChangeCompleted(change_id,
- SetFocus(ClientWindowId(transport_window_id)));
-}
-
-void WindowTree::SetCanFocus(Id transport_window_id, bool can_focus) {
- ServerWindow* window =
- GetWindowByClientId(ClientWindowId(transport_window_id));
- // TODO(sky): there should be an else case (it shouldn't route to wm and
- // policy allows, then set_can_focus).
- if (window && ShouldRouteToWindowManager(window))
- window->set_can_focus(can_focus);
-}
-
-void WindowTree::SetPredefinedCursor(uint32_t change_id,
- Id transport_window_id,
- mus::mojom::Cursor cursor_id) {
- ServerWindow* window =
- GetWindowByClientId(ClientWindowId(transport_window_id));
-
- // Only the owner of the window can change the bounds.
- bool success = window && access_policy_->CanSetCursorProperties(window);
- if (success) {
- Operation op(this, window_server_,
- OperationType::SET_WINDOW_PREDEFINED_CURSOR);
- window->SetPredefinedCursor(cursor_id);
- }
- client()->OnChangeCompleted(change_id, success);
-}
-
-void WindowTree::GetWindowManagerClient(
- mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal) {
- if (!access_policy_->CanSetWindowManager() || !window_manager_internal_ ||
- window_manager_internal_client_binding_) {
- return;
- }
- window_manager_internal_client_binding_.reset(
- new mojo::AssociatedBinding<mojom::WindowManagerClient>(
- this, std::move(internal)));
-}
-
-void WindowTree::GetCursorLocationMemory(
- const GetCursorLocationMemoryCallback& callback) {
- callback.Run(
- window_server_->display_manager()->GetUserDisplayManager(user_id_)->
- GetCursorLocationMemory());
-}
-
-void WindowTree::AddAccelerator(uint32_t id,
- mojom::EventMatcherPtr event_matcher,
- const AddAcceleratorCallback& callback) {
- DCHECK(window_manager_state_);
- const bool success =
- window_manager_state_->event_dispatcher()->AddAccelerator(
- id, std::move(event_matcher));
- callback.Run(success);
-}
-
-void WindowTree::RemoveAccelerator(uint32_t id) {
- window_manager_state_->event_dispatcher()->RemoveAccelerator(id);
-}
-
-void WindowTree::AddActivationParent(Id transport_window_id) {
- AddActivationParent(ClientWindowId(transport_window_id));
-}
-
-void WindowTree::RemoveActivationParent(Id transport_window_id) {
- ServerWindow* window =
- GetWindowByClientId(ClientWindowId(transport_window_id));
- if (window) {
- Display* display = GetDisplay(window);
- if (display)
- display->RemoveActivationParent(window);
- else
- DVLOG(1) << "RemoveActivationParent window not associated with display";
- } else {
- DVLOG(1) << "RemoveActivationParent supplied invalid window id";
- }
-}
-
-void WindowTree::ActivateNextWindow() {
- DCHECK(window_manager_state_);
- if (window_server_->user_id_tracker()->active_id() != user_id_)
- return;
-
- ServerWindow* focused_window = window_server_->GetFocusedWindow();
- if (focused_window) {
- WindowManagerDisplayRoot* display_root =
- GetWindowManagerDisplayRoot(focused_window);
- if (display_root->window_manager_state() != window_manager_state_.get()) {
- // We aren't active.
- return;
- }
- display_root->display()->ActivateNextWindow();
- return;
- }
- // Use the first display.
- std::set<Display*> displays = window_server_->display_manager()->displays();
- if (displays.empty())
- return;
-
- (*displays.begin())->ActivateNextWindow();
-}
-
-void WindowTree::SetUnderlaySurfaceOffsetAndExtendedHitArea(
- Id window_id,
- int32_t x_offset,
- int32_t y_offset,
- const gfx::Insets& hit_area) {
- ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
- if (!window)
- return;
-
- window->SetUnderlayOffset(gfx::Vector2d(x_offset, y_offset));
- window->set_extended_hit_test_region(hit_area);
-}
-
-void WindowTree::WmResponse(uint32_t change_id, bool response) {
- window_server_->WindowManagerChangeCompleted(change_id, response);
-}
-
-void WindowTree::WmRequestClose(Id transport_window_id) {
- ServerWindow* window =
- GetWindowByClientId(ClientWindowId(transport_window_id));
- WindowTree* tree = window_server_->GetTreeWithRoot(window);
- if (tree && tree != this) {
- tree->client()->RequestClose(tree->ClientWindowIdForWindow(window).id);
- }
- // TODO(sky): think about what else case means.
-}
-
-void WindowTree::WmSetFrameDecorationValues(
- mojom::FrameDecorationValuesPtr values) {
- DCHECK(window_manager_state_);
- window_manager_state_->SetFrameDecorationValues(std::move(values));
-}
-
-void WindowTree::WmSetNonClientCursor(uint32_t window_id,
- mojom::Cursor cursor_id) {
- DCHECK(window_manager_state_);
- ServerWindow* window = GetWindowByClientId(ClientWindowId(window_id));
- if (window) {
- window->SetNonClientCursor(cursor_id);
- } else {
- DVLOG(1) << "trying to update non-client cursor of invalid window";
- }
-}
-
-void WindowTree::OnWmCreatedTopLevelWindow(uint32_t change_id,
- Id transport_window_id) {
- ServerWindow* window =
- GetWindowByClientId(ClientWindowId(transport_window_id));
- if (window && window->id().client_id != id_) {
- DVLOG(1) << "OnWmCreatedTopLevelWindow supplied invalid window id";
- window_server_->WindowManagerSentBogusMessage();
- window = nullptr;
- }
- window_server_->WindowManagerCreatedTopLevelWindow(this, change_id, window);
-}
-
-bool WindowTree::HasRootForAccessPolicy(const ServerWindow* window) const {
- return HasRoot(window);
-}
-
-bool WindowTree::IsWindowKnownForAccessPolicy(
- const ServerWindow* window) const {
- return IsWindowKnown(window);
-}
-
-bool WindowTree::IsWindowRootOfAnotherTreeForAccessPolicy(
- const ServerWindow* window) const {
- WindowTree* tree = window_server_->GetTreeWithRoot(window);
- return tree && tree != this;
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_tree.h b/chromium/components/mus/ws/window_tree.h
deleted file mode 100644
index 0e804f355a1..00000000000
--- a/chromium/components/mus/ws/window_tree.h
+++ /dev/null
@@ -1,497 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_WINDOW_TREE_H_
-#define COMPONENTS_MUS_WS_WINDOW_TREE_H_
-
-#include <stdint.h>
-
-#include <map>
-#include <memory>
-#include <queue>
-#include <set>
-#include <string>
-#include <vector>
-
-#include "base/callback.h"
-#include "base/containers/hash_tables.h"
-#include "base/macros.h"
-#include "cc/ipc/surface_id.mojom.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/ws/access_policy_delegate.h"
-#include "components/mus/ws/ids.h"
-#include "components/mus/ws/user_id.h"
-#include "components/mus/ws/window_tree_binding.h"
-#include "mojo/public/cpp/bindings/associated_binding.h"
-
-namespace gfx {
-class Insets;
-class Rect;
-}
-
-namespace ui {
-class Event;
-}
-
-namespace mus {
-namespace ws {
-
-class AccessPolicy;
-class DisplayManager;
-class Display;
-class EventMatcher;
-class ServerWindow;
-class TargetedEvent;
-class WindowManagerDisplayRoot;
-class WindowManagerState;
-class WindowServer;
-class WindowTreeTest;
-
-namespace test {
-class WindowTreeTestApi;
-}
-
-// WindowTree represents a view onto portions of the window tree. The parts of
-// the tree exposed to the client start at the root windows. A WindowTree may
-// have any number of roots (including none). A WindowTree may not have
-// visibility of all the descendants of its roots.
-//
-// WindowTree notifies its client as changes happen to windows exposed to the
-// the client.
-//
-// See ids.h for details on how WindowTree handles identity of windows.
-class WindowTree : public mojom::WindowTree,
- public AccessPolicyDelegate,
- public mojom::WindowManagerClient {
- public:
- WindowTree(WindowServer* window_server,
- const UserId& user_id,
- ServerWindow* root,
- std::unique_ptr<AccessPolicy> access_policy);
- ~WindowTree() override;
-
- void Init(std::unique_ptr<WindowTreeBinding> binding,
- mojom::WindowTreePtr tree);
-
- // Called if this WindowTree hosts a WindowManager.
- void ConfigureWindowManager();
-
- ClientSpecificId id() const { return id_; }
-
- void set_embedder_intercepts_events() { embedder_intercepts_events_ = true; }
- bool embedder_intercepts_events() const {
- return embedder_intercepts_events_;
- }
-
- const UserId& user_id() const { return user_id_; }
-
- mojom::WindowTreeClient* client() { return binding_->client(); }
-
- // Returns the Window with the specified id.
- ServerWindow* GetWindow(const WindowId& id) {
- return const_cast<ServerWindow*>(
- const_cast<const WindowTree*>(this)->GetWindow(id));
- }
- const ServerWindow* GetWindow(const WindowId& id) const;
-
- // Returns the Window with the specified client id *only* if known to this
- // client, returns null if not known.
- ServerWindow* GetWindowByClientId(const ClientWindowId& id) {
- return const_cast<ServerWindow*>(
- const_cast<const WindowTree*>(this)->GetWindowByClientId(id));
- }
- const ServerWindow* GetWindowByClientId(const ClientWindowId& id) const;
-
- bool IsWindowKnown(const ServerWindow* window) const {
- return IsWindowKnown(window, nullptr);
- }
- // Returns whether |window| is known to this tree. If |window| is known and
- // |client_window_id| is non-null |client_window_id| is set to the
- // ClientWindowId of the window.
- bool IsWindowKnown(const ServerWindow* window,
- ClientWindowId* client_window_id) const;
-
- // Returns true if |window| is one of this trees roots.
- bool HasRoot(const ServerWindow* window) const;
-
- std::set<const ServerWindow*> roots() { return roots_; }
-
- void set_name(const std::string& name) { name_ = name; }
- const std::string& name() const { return name_; }
-
- bool janky() const { return janky_; }
-
- const Display* GetDisplay(const ServerWindow* window) const;
- Display* GetDisplay(const ServerWindow* window) {
- return const_cast<Display*>(
- const_cast<const WindowTree*>(this)->GetDisplay(window));
- }
-
- const WindowManagerDisplayRoot* GetWindowManagerDisplayRoot(
- const ServerWindow* window) const;
- WindowManagerDisplayRoot* GetWindowManagerDisplayRoot(
- const ServerWindow* window) {
- return const_cast<WindowManagerDisplayRoot*>(
- const_cast<const WindowTree*>(this)->GetWindowManagerDisplayRoot(
- window));
- }
- WindowManagerState* window_manager_state() {
- return window_manager_state_.get();
- }
-
- DisplayManager* display_manager();
- const DisplayManager* display_manager() const;
-
- WindowServer* window_server() { return window_server_; }
- const WindowServer* window_server() const { return window_server_; }
-
- // Adds a new root to this tree. This is only valid for window managers.
- void AddRootForWindowManager(const ServerWindow* root);
-
- // Invoked when a tree is about to be destroyed.
- void OnWindowDestroyingTreeImpl(WindowTree* tree);
-
- // These functions are synchronous variants of those defined in the mojom. The
- // WindowTree implementations all call into these. See the mojom for details.
- bool SetCapture(const ClientWindowId& client_window_id);
- bool NewWindow(const ClientWindowId& client_window_id,
- const std::map<std::string, std::vector<uint8_t>>& properties);
- bool AddWindow(const ClientWindowId& parent_id,
- const ClientWindowId& child_id);
- bool AddTransientWindow(const ClientWindowId& window_id,
- const ClientWindowId& transient_window_id);
- bool SetModal(const ClientWindowId& window_id);
- std::vector<const ServerWindow*> GetWindowTree(
- const ClientWindowId& window_id) const;
- bool SetWindowVisibility(const ClientWindowId& window_id, bool visible);
- bool SetWindowOpacity(const ClientWindowId& window_id, float opacity);
- bool SetFocus(const ClientWindowId& window_id);
- bool Embed(const ClientWindowId& window_id,
- mojom::WindowTreeClientPtr client,
- uint32_t flags);
- void DispatchInputEvent(ServerWindow* target, const ui::Event& event);
-
- bool IsWaitingForNewTopLevelWindow(uint32_t wm_change_id);
- void OnWindowManagerCreatedTopLevelWindow(uint32_t wm_change_id,
- uint32_t client_change_id,
- const ServerWindow* window);
- void AddActivationParent(const ClientWindowId& window_id);
-
- // Calls through to the client.
- void OnChangeCompleted(uint32_t change_id, bool success);
- void OnAccelerator(uint32_t accelerator_id, const ui::Event& event);
-
- // Called when |tree|'s jankiness changes (see janky_ for definition).
- // Notifies the window manager client so it can update UI for the affected
- // window(s).
- void ClientJankinessChanged(WindowTree* tree);
-
- // The following methods are invoked after the corresponding change has been
- // processed. They do the appropriate bookkeeping and update the client as
- // necessary.
- void ProcessWindowBoundsChanged(const ServerWindow* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds,
- bool originated_change);
- void ProcessClientAreaChanged(
- const ServerWindow* window,
- const gfx::Insets& new_client_area,
- const std::vector<gfx::Rect>& new_additional_client_areas,
- bool originated_change);
- void ProcessWillChangeWindowHierarchy(const ServerWindow* window,
- const ServerWindow* new_parent,
- const ServerWindow* old_parent,
- bool originated_change);
- void ProcessWindowPropertyChanged(const ServerWindow* window,
- const std::string& name,
- const std::vector<uint8_t>* new_data,
- bool originated_change);
- void ProcessWindowHierarchyChanged(const ServerWindow* window,
- const ServerWindow* new_parent,
- const ServerWindow* old_parent,
- bool originated_change);
- void ProcessWindowReorder(const ServerWindow* window,
- const ServerWindow* relative_window,
- mojom::OrderDirection direction,
- bool originated_change);
- void ProcessWindowDeleted(const ServerWindow* window, bool originated_change);
- void ProcessWillChangeWindowVisibility(const ServerWindow* window,
- bool originated_change);
- void ProcessWindowOpacityChanged(const ServerWindow* window,
- float old_opacity,
- float new_opacity,
- bool originated_change);
- void ProcessCursorChanged(const ServerWindow* window,
- int32_t cursor_id,
- bool originated_change);
- void ProcessFocusChanged(const ServerWindow* old_focused_window,
- const ServerWindow* new_focused_window);
- void ProcessLostCapture(const ServerWindow* old_lost_capture,
- bool originated_change);
- void ProcessTransientWindowAdded(const ServerWindow* window,
- const ServerWindow* transient_window,
- bool originated_change);
- void ProcessTransientWindowRemoved(const ServerWindow* window,
- const ServerWindow* transient_window,
- bool originated_change);
-
- // Sends this event to the client if it matches an active event observer.
- void SendToEventObserver(const ui::Event& event);
-
- private:
- friend class test::WindowTreeTestApi;
-
- struct WaitingForTopLevelWindowInfo {
- WaitingForTopLevelWindowInfo(const ClientWindowId& client_window_id,
- uint32_t wm_change_id)
- : client_window_id(client_window_id), wm_change_id(wm_change_id) {}
- ~WaitingForTopLevelWindowInfo() {}
-
- // Id supplied from the client.
- ClientWindowId client_window_id;
-
- // Change id we created for the window manager.
- uint32_t wm_change_id;
- };
-
- enum class RemoveRootReason {
- // The window is being removed.
- DELETED,
-
- // Another client is being embedded in the window.
- EMBED,
- };
-
- bool ShouldRouteToWindowManager(const ServerWindow* window) const;
-
- ClientWindowId ClientWindowIdForWindow(const ServerWindow* window) const;
-
- // Returns true if |id| is a valid WindowId for a new window.
- bool IsValidIdForNewWindow(const ClientWindowId& id) const;
-
- WindowId GenerateNewWindowId();
-
- // These functions return true if the corresponding mojom function is allowed
- // for this tree.
- bool CanReorderWindow(const ServerWindow* window,
- const ServerWindow* relative_window,
- mojom::OrderDirection direction) const;
-
- // Deletes a window owned by this tree. Returns true on success. |source| is
- // the tree that originated the change.
- bool DeleteWindowImpl(WindowTree* source, ServerWindow* window);
-
- // If |window| is known does nothing. Otherwise adds |window| to |windows|,
- // marks |window| as known and recurses.
- void GetUnknownWindowsFrom(const ServerWindow* window,
- std::vector<const ServerWindow*>* windows);
-
- // Removes |window| from the appropriate maps. If |window| is known to this
- // client true is returned.
- bool RemoveFromMaps(const ServerWindow* window);
-
- // Removes |window| and all its descendants from the necessary maps. This
- // does not recurse through windows that were created by this tree. All
- // windows owned by this tree are added to |local_windows|.
- void RemoveFromKnown(const ServerWindow* window,
- std::vector<ServerWindow*>* local_windows);
-
- // Removes a root from set of roots of this tree. This does not remove
- // the window from the window tree, only from the set of roots.
- void RemoveRoot(const ServerWindow* window, RemoveRootReason reason);
-
- // Converts Window(s) to WindowData(s) for transport. This assumes all the
- // windows are valid for the client. The parent of windows the client is not
- // allowed to see are set to NULL (in the returned WindowData(s)).
- mojo::Array<mojom::WindowDataPtr> WindowsToWindowDatas(
- const std::vector<const ServerWindow*>& windows);
- mojom::WindowDataPtr WindowToWindowData(const ServerWindow* window);
-
- // Implementation of GetWindowTree(). Adds |window| to |windows| and recurses
- // if CanDescendIntoWindowForWindowTree() returns true.
- void GetWindowTreeImpl(const ServerWindow* window,
- std::vector<const ServerWindow*>* windows) const;
-
- // Notify the client if the drawn state of any of the roots changes.
- // |window| is the window that is changing to the drawn state
- // |new_drawn_value|.
- void NotifyDrawnStateChanged(const ServerWindow* window,
- bool new_drawn_value);
-
- // Deletes all Windows we own.
- void DestroyWindows();
-
- bool CanEmbed(const ClientWindowId& window_id) const;
- void PrepareForEmbed(ServerWindow* window);
- void RemoveChildrenAsPartOfEmbed(ServerWindow* window);
-
- void DispatchInputEventImpl(ServerWindow* target, const ui::Event& event);
-
- // Calls OnChangeCompleted() on the client.
- void NotifyChangeCompleted(uint32_t change_id,
- mojom::WindowManagerErrorCode error_code);
-
- // WindowTree:
- void NewWindow(uint32_t change_id,
- Id transport_window_id,
- mojo::Map<mojo::String, mojo::Array<uint8_t>>
- transport_properties) override;
- void NewTopLevelWindow(uint32_t change_id,
- Id transport_window_id,
- mojo::Map<mojo::String, mojo::Array<uint8_t>>
- transport_properties) override;
- void DeleteWindow(uint32_t change_id, Id transport_window_id) override;
- void AddWindow(uint32_t change_id, Id parent_id, Id child_id) override;
- void RemoveWindowFromParent(uint32_t change_id, Id window_id) override;
- void AddTransientWindow(uint32_t change_id,
- Id window,
- Id transient_window) override;
- void RemoveTransientWindowFromParent(uint32_t change_id,
- Id transient_window_id) override;
- void SetModal(uint32_t change_id, Id window_id) override;
- void ReorderWindow(uint32_t change_Id,
- Id window_id,
- Id relative_window_id,
- mojom::OrderDirection direction) override;
- void GetWindowTree(
- Id window_id,
- const base::Callback<void(mojo::Array<mojom::WindowDataPtr>)>& callback)
- override;
- void SetCapture(uint32_t change_id, Id window_id) override;
- void ReleaseCapture(uint32_t change_id, Id window_id) override;
- void SetEventObserver(mojom::EventMatcherPtr matcher,
- uint32_t observer_id) override;
- void SetWindowBounds(uint32_t change_id,
- Id window_id,
- const gfx::Rect& bounds) override;
- void SetWindowVisibility(uint32_t change_id,
- Id window_id,
- bool visible) override;
- void SetWindowProperty(uint32_t change_id,
- Id transport_window_id,
- const mojo::String& name,
- mojo::Array<uint8_t> value) override;
- void SetWindowOpacity(uint32_t change_id,
- Id window_id,
- float opacity) override;
- void AttachSurface(Id transport_window_id,
- mojom::SurfaceType type,
- mojo::InterfaceRequest<mojom::Surface> surface,
- mojom::SurfaceClientPtr client) override;
- void Embed(Id transport_window_id,
- mojom::WindowTreeClientPtr client,
- uint32_t flags,
- const EmbedCallback& callback) override;
- void SetFocus(uint32_t change_id, Id transport_window_id) override;
- void SetCanFocus(Id transport_window_id, bool can_focus) override;
- void SetPredefinedCursor(uint32_t change_id,
- Id transport_window_id,
- mus::mojom::Cursor cursor_id) override;
- void SetWindowTextInputState(Id transport_window_id,
- mojo::TextInputStatePtr state) override;
- void SetImeVisibility(Id transport_window_id,
- bool visible,
- mojo::TextInputStatePtr state) override;
- void OnWindowInputEventAck(uint32_t event_id,
- mojom::EventResult result) override;
- void SetClientArea(
- Id transport_window_id,
- const gfx::Insets& insets,
- mojo::Array<gfx::Rect> transport_additional_client_areas) override;
- void SetHitTestMask(Id transport_window_id, const gfx::Rect& mask) override;
- void GetWindowManagerClient(
- mojo::AssociatedInterfaceRequest<mojom::WindowManagerClient> internal)
- override;
- void GetCursorLocationMemory(const GetCursorLocationMemoryCallback& callback)
- override;
-
- // mojom::WindowManagerClient:
- void AddAccelerator(uint32_t id,
- mojom::EventMatcherPtr event_matcher,
- const AddAcceleratorCallback& callback) override;
- void RemoveAccelerator(uint32_t id) override;
- void AddActivationParent(Id transport_window_id) override;
- void RemoveActivationParent(Id transport_window_id) override;
- void ActivateNextWindow() override;
- void SetUnderlaySurfaceOffsetAndExtendedHitArea(
- Id window_id,
- int32_t x_offset,
- int32_t y_offset,
- const gfx::Insets& hit_area) override;
- void WmResponse(uint32_t change_id, bool response) override;
- void WmRequestClose(Id transport_window_id) override;
- void WmSetFrameDecorationValues(
- mojom::FrameDecorationValuesPtr values) override;
- void WmSetNonClientCursor(uint32_t window_id,
- mojom::Cursor cursor_id) override;
- void OnWmCreatedTopLevelWindow(uint32_t change_id,
- Id transport_window_id) override;
-
- // AccessPolicyDelegate:
- bool HasRootForAccessPolicy(const ServerWindow* window) const override;
- bool IsWindowKnownForAccessPolicy(const ServerWindow* window) const override;
- bool IsWindowRootOfAnotherTreeForAccessPolicy(
- const ServerWindow* window) const override;
-
- WindowServer* window_server_;
-
- UserId user_id_;
-
- // Id of this tree as assigned by WindowServer.
- const ClientSpecificId id_;
- std::string name_;
-
- ClientSpecificId next_window_id_;
-
- std::unique_ptr<WindowTreeBinding> binding_;
-
- std::unique_ptr<mus::ws::AccessPolicy> access_policy_;
-
- // The roots, or embed points, of this tree. A WindowTree may have any
- // number of roots, including 0.
- std::set<const ServerWindow*> roots_;
-
- // The windows created by this tree. This tree owns these objects.
- base::hash_map<WindowId, ServerWindow*> created_window_map_;
-
- // The client is allowed to assign ids. These two maps providing the mapping
- // from the ids native to the server (WindowId) to those understood by the
- // client (ClientWindowId).
- base::hash_map<ClientWindowId, WindowId> client_id_to_window_id_map_;
- base::hash_map<WindowId, ClientWindowId> window_id_to_client_id_map_;
-
- uint32_t event_ack_id_;
-
- // A client is considered janky if it hasn't ACK'ed input events within a
- // reasonable timeframe.
- bool janky_ = false;
-
- // Set when the client is using SetEventObserver() to observe events,
- // otherwise null.
- std::unique_ptr<EventMatcher> event_observer_matcher_;
-
- // The ID supplied by the client for the current event observer.
- uint32_t event_observer_id_ = 0;
-
- // WindowManager the current event came from.
- WindowManagerState* event_source_wms_ = nullptr;
-
- std::queue<std::unique_ptr<TargetedEvent>> event_queue_;
-
- std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManagerClient>>
- window_manager_internal_client_binding_;
- mojom::WindowManager* window_manager_internal_;
- std::unique_ptr<WindowManagerState> window_manager_state_;
-
- std::unique_ptr<WaitingForTopLevelWindowInfo>
- waiting_for_top_level_window_info_;
- bool embedder_intercepts_events_ = false;
-
- DISALLOW_COPY_AND_ASSIGN(WindowTree);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_WINDOW_TREE_H_
diff --git a/chromium/components/mus/ws/window_tree_binding.cc b/chromium/components/mus/ws/window_tree_binding.cc
deleted file mode 100644
index 6f64a9f895f..00000000000
--- a/chromium/components/mus/ws/window_tree_binding.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_tree_binding.h"
-
-#include "base/bind.h"
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_tree.h"
-
-namespace mus {
-namespace ws {
-
-WindowTreeBinding::WindowTreeBinding(mojom::WindowTreeClient* client)
- : client_(client) {}
-
-WindowTreeBinding::~WindowTreeBinding() {}
-
-DefaultWindowTreeBinding::DefaultWindowTreeBinding(
- WindowTree* tree,
- WindowServer* window_server,
- mojom::WindowTreeRequest service_request,
- mojom::WindowTreeClientPtr client)
- : WindowTreeBinding(client.get()),
- binding_(tree, std::move(service_request)),
- client_(std::move(client)) {
- // Both |window_server| and |tree| outlive us.
- binding_.set_connection_error_handler(
- base::Bind(&WindowServer::DestroyTree, base::Unretained(window_server),
- base::Unretained(tree)));
-}
-
-DefaultWindowTreeBinding::DefaultWindowTreeBinding(
- WindowTree* tree,
- mojom::WindowTreeClientPtr client)
- : WindowTreeBinding(client.get()),
- binding_(tree),
- client_(std::move(client)) {}
-
-DefaultWindowTreeBinding::~DefaultWindowTreeBinding() {}
-
-void DefaultWindowTreeBinding::SetIncomingMethodCallProcessingPaused(
- bool paused) {
- if (paused)
- binding_.PauseIncomingMethodCallProcessing();
- else
- binding_.ResumeIncomingMethodCallProcessing();
-}
-
-mojom::WindowTreePtr DefaultWindowTreeBinding::CreateInterfacePtrAndBind() {
- DCHECK(!binding_.is_bound());
- return binding_.CreateInterfacePtrAndBind();
-}
-
-mojom::WindowManager* DefaultWindowTreeBinding::GetWindowManager() {
- client_->GetWindowManager(
- GetProxy(&window_manager_internal_, client_.associated_group()));
- return window_manager_internal_.get();
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_tree_binding.h b/chromium/components/mus/ws/window_tree_binding.h
deleted file mode 100644
index a9472b3566c..00000000000
--- a/chromium/components/mus/ws/window_tree_binding.h
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_WINDOW_TREE_BINDING_H_
-#define COMPONENTS_MUS_WS_WINDOW_TREE_BINDING_H_
-
-#include <memory>
-
-#include "base/macros.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "mojo/public/cpp/bindings/binding.h"
-
-namespace mus {
-namespace ws {
-
-class WindowServer;
-class WindowTree;
-
-// WindowTreeBinding manages the binding between a WindowTree and its
-// WindowTreeClient. WindowTreeBinding exists so that a mock implementation
-// of WindowTreeClient can be injected for tests. WindowTree owns its
-// associated WindowTreeBinding.
-class WindowTreeBinding {
- public:
- explicit WindowTreeBinding(mojom::WindowTreeClient* client);
- virtual ~WindowTreeBinding();
-
- mojom::WindowTreeClient* client() { return client_; }
-
- // Obtains a new WindowManager. This should only be called once.
- virtual mojom::WindowManager* GetWindowManager() = 0;
-
- virtual void SetIncomingMethodCallProcessingPaused(bool paused) = 0;
-
- private:
- mojom::WindowTreeClient* client_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowTreeBinding);
-};
-
-// Bindings implementation of WindowTreeBinding.
-class DefaultWindowTreeBinding : public WindowTreeBinding {
- public:
- DefaultWindowTreeBinding(WindowTree* tree,
- WindowServer* window_server,
- mojom::WindowTreeRequest service_request,
- mojom::WindowTreeClientPtr client);
- DefaultWindowTreeBinding(WindowTree* tree,
- mojom::WindowTreeClientPtr client);
- ~DefaultWindowTreeBinding() override;
-
- // Use when created with the constructor that does not take a
- // WindowTreeRequest.
- mojom::WindowTreePtr CreateInterfacePtrAndBind();
-
- // WindowTreeBinding:
- mojom::WindowManager* GetWindowManager() override;
- void SetIncomingMethodCallProcessingPaused(bool paused) override;
-
- private:
- mojo::Binding<mojom::WindowTree> binding_;
- mojom::WindowTreeClientPtr client_;
- mojom::WindowManagerAssociatedPtr window_manager_internal_;
-
- DISALLOW_COPY_AND_ASSIGN(DefaultWindowTreeBinding);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_WINDOW_TREE_BINDING_H_
diff --git a/chromium/components/mus/ws/window_tree_client_unittest.cc b/chromium/components/mus/ws/window_tree_client_unittest.cc
deleted file mode 100644
index 34169dd2152..00000000000
--- a/chromium/components/mus/ws/window_tree_client_unittest.cc
+++ /dev/null
@@ -1,2042 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include "base/bind.h"
-#include "base/macros.h"
-#include "base/message_loop/message_loop.h"
-#include "base/run_loop.h"
-#include "base/strings/stringprintf.h"
-#include "components/mus/public/cpp/tests/window_server_shelltest_base.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/public/interfaces/window_tree_host.mojom.h"
-#include "components/mus/ws/ids.h"
-#include "components/mus/ws/test_change_tracker.h"
-#include "mojo/public/cpp/bindings/associated_binding.h"
-#include "services/shell/public/cpp/shell_test.h"
-
-using mojo::Array;
-using shell::Connection;
-using mojo::InterfaceRequest;
-using shell::ShellClient;
-using mojo::String;
-using mus::mojom::WindowDataPtr;
-using mus::mojom::WindowTree;
-using mus::mojom::WindowTreeClient;
-
-namespace mus {
-namespace ws {
-namespace test {
-
-namespace {
-
-// Creates an id used for transport from the specified parameters.
-Id BuildWindowId(ClientSpecificId client_id,
- ClientSpecificId window_id) {
- return (client_id << 16) | window_id;
-}
-
-// Callback function from WindowTree functions.
-// ----------------------------------
-
-void WindowTreeResultCallback(base::RunLoop* run_loop,
- std::vector<TestWindow>* windows,
- Array<WindowDataPtr> results) {
- WindowDatasToTestWindows(results, windows);
- run_loop->Quit();
-}
-
-void EmbedCallbackImpl(base::RunLoop* run_loop,
- bool* result_cache,
- bool result) {
- *result_cache = result;
- run_loop->Quit();
-}
-
-// -----------------------------------------------------------------------------
-
-bool EmbedUrl(shell::Connector* connector,
- WindowTree* tree,
- const String& url,
- Id root_id) {
- bool result = false;
- base::RunLoop run_loop;
- {
- mojom::WindowTreeClientPtr client;
- connector->ConnectToInterface(url.get(), &client);
- const uint32_t embed_flags = 0;
- tree->Embed(root_id, std::move(client), embed_flags,
- base::Bind(&EmbedCallbackImpl, &run_loop, &result));
- }
- run_loop.Run();
- return result;
-}
-
-bool Embed(WindowTree* tree, Id root_id, mojom::WindowTreeClientPtr client) {
- bool result = false;
- base::RunLoop run_loop;
- {
- const uint32_t embed_flags = 0;
- tree->Embed(root_id, std::move(client), embed_flags,
- base::Bind(&EmbedCallbackImpl, &run_loop, &result));
- }
- run_loop.Run();
- return result;
-}
-
-void GetWindowTree(WindowTree* tree,
- Id window_id,
- std::vector<TestWindow>* windows) {
- base::RunLoop run_loop;
- tree->GetWindowTree(
- window_id, base::Bind(&WindowTreeResultCallback, &run_loop, windows));
- run_loop.Run();
-}
-
-// Utility functions -----------------------------------------------------------
-
-const Id kNullParentId = 0;
-std::string IdToString(Id id) {
- return (id == kNullParentId) ? "null" : base::StringPrintf(
- "%d,%d", HiWord(id), LoWord(id));
-}
-
-std::string WindowParentToString(Id window, Id parent) {
- return base::StringPrintf("window=%s parent=%s", IdToString(window).c_str(),
- IdToString(parent).c_str());
-}
-
-// -----------------------------------------------------------------------------
-
-// A WindowTreeClient implementation that logs all changes to a tracker.
-class TestWindowTreeClient : public mojom::WindowTreeClient,
- public TestChangeTracker::Delegate,
- public mojom::WindowManager {
- public:
- TestWindowTreeClient()
- : binding_(this),
- client_id_(0),
- root_window_id_(0),
- // Start with a random large number so tests can use lower ids if they
- // want.
- next_change_id_(10000),
- waiting_change_id_(0),
- on_change_completed_result_(false),
- track_root_bounds_changes_(false) {
- tracker_.set_delegate(this);
- }
-
- void Bind(mojo::InterfaceRequest<mojom::WindowTreeClient> request) {
- binding_.Bind(std::move(request));
- }
-
- mojom::WindowTree* tree() { return tree_.get(); }
- TestChangeTracker* tracker() { return &tracker_; }
- Id root_window_id() const { return root_window_id_; }
-
- // Sets whether changes to the bounds of the root should be tracked. Normally
- // they are ignored (as during startup we often times get random size
- // changes).
- void set_track_root_bounds_changes(bool value) {
- track_root_bounds_changes_ = value;
- }
-
- // Runs a nested MessageLoop until |count| changes (calls to
- // WindowTreeClient functions) have been received.
- void WaitForChangeCount(size_t count) {
- if (tracker_.changes()->size() >= count)
- return;
-
- ASSERT_TRUE(wait_state_.get() == nullptr);
- wait_state_.reset(new WaitState);
- wait_state_->change_count = count;
- wait_state_->run_loop.Run();
- wait_state_.reset();
- }
-
- uint32_t GetAndAdvanceChangeId() { return next_change_id_++; }
-
- // Runs a nested MessageLoop until OnEmbed() has been encountered.
- void WaitForOnEmbed() {
- if (tree_)
- return;
- embed_run_loop_.reset(new base::RunLoop);
- embed_run_loop_->Run();
- embed_run_loop_.reset();
- }
-
- bool WaitForChangeCompleted(uint32_t id) {
- waiting_change_id_ = id;
- change_completed_run_loop_.reset(new base::RunLoop);
- change_completed_run_loop_->Run();
- return on_change_completed_result_;
- }
-
- bool DeleteWindow(Id id) {
- const uint32_t change_id = GetAndAdvanceChangeId();
- tree()->DeleteWindow(change_id, id);
- return WaitForChangeCompleted(change_id);
- }
-
- bool AddWindow(Id parent, Id child) {
- const uint32_t change_id = GetAndAdvanceChangeId();
- tree()->AddWindow(change_id, parent, child);
- return WaitForChangeCompleted(change_id);
- }
-
- bool RemoveWindowFromParent(Id window_id) {
- const uint32_t change_id = GetAndAdvanceChangeId();
- tree()->RemoveWindowFromParent(change_id, window_id);
- return WaitForChangeCompleted(change_id);
- }
-
- bool ReorderWindow(Id window_id,
- Id relative_window_id,
- mojom::OrderDirection direction) {
- const uint32_t change_id = GetAndAdvanceChangeId();
- tree()->ReorderWindow(change_id, window_id, relative_window_id, direction);
- return WaitForChangeCompleted(change_id);
- }
-
- // Waits for all messages to be received by |ws|. This is done by attempting
- // to create a bogus window. When we get the response we know all messages
- // have been processed.
- bool WaitForAllMessages() {
- return NewWindowWithCompleteId(WindowIdToTransportId(InvalidWindowId())) ==
- 0;
- }
-
- Id NewWindow(ClientSpecificId window_id) {
- return NewWindowWithCompleteId(BuildWindowId(client_id_, window_id));
- }
-
- // Generally you want NewWindow(), but use this if you need to test given
- // a complete window id (NewWindow() ors with the client id).
- Id NewWindowWithCompleteId(Id id) {
- mojo::Map<mojo::String, mojo::Array<uint8_t>> properties;
- const uint32_t change_id = GetAndAdvanceChangeId();
- tree()->NewWindow(change_id, id, std::move(properties));
- return WaitForChangeCompleted(change_id) ? id : 0;
- }
-
- bool SetWindowProperty(Id window_id,
- const std::string& name,
- const std::vector<uint8_t>* data) {
- Array<uint8_t> mojo_data(nullptr);
- if (data)
- mojo_data = Array<uint8_t>::From(*data);
- const uint32_t change_id = GetAndAdvanceChangeId();
- tree()->SetWindowProperty(change_id, window_id, name, std::move(mojo_data));
- return WaitForChangeCompleted(change_id);
- }
-
- bool SetPredefinedCursor(Id window_id, mojom::Cursor cursor) {
- const uint32_t change_id = GetAndAdvanceChangeId();
- tree()->SetPredefinedCursor(change_id, window_id, cursor);
- return WaitForChangeCompleted(change_id);
- }
-
- bool SetWindowVisibility(Id window_id, bool visible) {
- const uint32_t change_id = GetAndAdvanceChangeId();
- tree()->SetWindowVisibility(change_id, window_id, visible);
- return WaitForChangeCompleted(change_id);
- }
-
- bool SetWindowOpacity(Id window_id, float opacity) {
- const uint32_t change_id = GetAndAdvanceChangeId();
- tree()->SetWindowOpacity(change_id, window_id, opacity);
- return WaitForChangeCompleted(change_id);
- }
-
- private:
- // Used when running a nested MessageLoop.
- struct WaitState {
- WaitState() : change_count(0) {}
-
- // Number of changes waiting for.
- size_t change_count;
- base::RunLoop run_loop;
- };
-
- // TestChangeTracker::Delegate:
- void OnChangeAdded() override {
- if (wait_state_.get() &&
- tracker_.changes()->size() >= wait_state_->change_count) {
- wait_state_->run_loop.Quit();
- }
- }
-
- // WindowTreeClient:
- void OnEmbed(ClientSpecificId client_id,
- WindowDataPtr root,
- mojom::WindowTreePtr tree,
- int64_t display_id,
- Id focused_window_id,
- bool drawn) override {
- // TODO(sky): add coverage of |focused_window_id|.
- ASSERT_TRUE(root);
- root_window_id_ = root->window_id;
- tree_ = std::move(tree);
- client_id_ = client_id;
- tracker()->OnEmbed(client_id, std::move(root), drawn);
- if (embed_run_loop_)
- embed_run_loop_->Quit();
- }
- void OnEmbeddedAppDisconnected(Id window_id) override {
- tracker()->OnEmbeddedAppDisconnected(window_id);
- }
- void OnUnembed(Id window_id) override { tracker()->OnUnembed(window_id); }
- void OnLostCapture(Id window_id) override {
- tracker()->OnLostCapture(window_id);
- }
- void OnTopLevelCreated(uint32_t change_id,
- mojom::WindowDataPtr data,
- int64_t display_id,
- bool drawn) override {
- tracker()->OnTopLevelCreated(change_id, std::move(data), drawn);
- }
- void OnWindowBoundsChanged(Id window_id,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds) override {
- // The bounds of the root may change during startup on Android at random
- // times. As this doesn't matter, and shouldn't impact test exepctations,
- // it is ignored.
- if (window_id == root_window_id_ && !track_root_bounds_changes_)
- return;
- tracker()->OnWindowBoundsChanged(window_id, old_bounds, new_bounds);
- }
- void OnClientAreaChanged(
- uint32_t window_id,
- const gfx::Insets& new_client_area,
- mojo::Array<gfx::Rect> new_additional_client_areas) override {}
- void OnTransientWindowAdded(uint32_t window_id,
- uint32_t transient_window_id) override {
- tracker()->OnTransientWindowAdded(window_id, transient_window_id);
- }
- void OnTransientWindowRemoved(uint32_t window_id,
- uint32_t transient_window_id) override {
- tracker()->OnTransientWindowRemoved(window_id, transient_window_id);
- }
- void OnWindowHierarchyChanged(Id window,
- Id old_parent,
- Id new_parent,
- Array<WindowDataPtr> windows) override {
- tracker()->OnWindowHierarchyChanged(window, old_parent, new_parent,
- std::move(windows));
- }
- void OnWindowReordered(Id window_id,
- Id relative_window_id,
- mojom::OrderDirection direction) override {
- tracker()->OnWindowReordered(window_id, relative_window_id, direction);
- }
- void OnWindowDeleted(Id window) override {
- tracker()->OnWindowDeleted(window);
- }
- void OnWindowVisibilityChanged(uint32_t window, bool visible) override {
- tracker()->OnWindowVisibilityChanged(window, visible);
- }
- void OnWindowOpacityChanged(uint32_t window,
- float old_opacity,
- float new_opacity) override {
- tracker()->OnWindowOpacityChanged(window, new_opacity);
- }
- void OnWindowParentDrawnStateChanged(uint32_t window, bool drawn) override {
- tracker()->OnWindowParentDrawnStateChanged(window, drawn);
- }
- void OnWindowInputEvent(uint32_t event_id,
- Id window_id,
- std::unique_ptr<ui::Event> event,
- uint32_t event_observer_id) override {
- // Ack input events to clear the state on the server. These can be received
- // during test startup. X11Window::DispatchEvent sends a synthetic move
- // event to notify of entry.
- tree()->OnWindowInputEventAck(event_id, mojom::EventResult::HANDLED);
- // Don't log input events as none of the tests care about them and they
- // may come in at random points.
- }
- void OnEventObserved(std::unique_ptr<ui::Event>,
- uint32_t event_observer_id) override {}
- void OnWindowSharedPropertyChanged(uint32_t window,
- const String& name,
- Array<uint8_t> new_data) override {
- tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data));
- }
- // TODO(sky): add testing coverage.
- void OnWindowFocused(uint32_t focused_window_id) override {}
- void OnWindowPredefinedCursorChanged(uint32_t window_id,
- mojom::Cursor cursor_id) override {
- tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id);
- }
- void OnChangeCompleted(uint32_t change_id, bool success) override {
- if (waiting_change_id_ == change_id && change_completed_run_loop_) {
- on_change_completed_result_ = success;
- change_completed_run_loop_->Quit();
- }
- }
- void RequestClose(uint32_t window_id) override {}
- void GetWindowManager(mojo::AssociatedInterfaceRequest<mojom::WindowManager>
- internal) override {
- window_manager_binding_.reset(
- new mojo::AssociatedBinding<mojom::WindowManager>(this,
- std::move(internal)));
- tree_->GetWindowManagerClient(
- GetProxy(&window_manager_client_, tree_.associated_group()));
- }
-
- // mojom::WindowManager:
- void OnConnect(uint16_t client_id) override {}
- void WmNewDisplayAdded(mojom::DisplayPtr display,
- mojom::WindowDataPtr root_data,
- bool drawn) override {
- NOTIMPLEMENTED();
- }
- void WmSetBounds(uint32_t change_id,
- uint32_t window_id,
- const gfx::Rect& bounds) override {
- window_manager_client_->WmResponse(change_id, false);
- }
- void WmSetProperty(uint32_t change_id,
- uint32_t window_id,
- const mojo::String& name,
- mojo::Array<uint8_t> value) override {
- window_manager_client_->WmResponse(change_id, false);
- }
- void WmCreateTopLevelWindow(
- uint32_t change_id,
- ClientSpecificId requesting_client_id,
- mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) override {
- NOTIMPLEMENTED();
- }
- void WmClientJankinessChanged(ClientSpecificId client_id,
- bool janky) override {
- NOTIMPLEMENTED();
- }
- void OnAccelerator(uint32_t id, std::unique_ptr<ui::Event> event) override {
- NOTIMPLEMENTED();
- }
-
- TestChangeTracker tracker_;
-
- mojom::WindowTreePtr tree_;
-
- // If non-null we're waiting for OnEmbed() using this RunLoop.
- std::unique_ptr<base::RunLoop> embed_run_loop_;
-
- // If non-null we're waiting for a certain number of change notifications to
- // be encountered.
- std::unique_ptr<WaitState> wait_state_;
-
- mojo::Binding<WindowTreeClient> binding_;
- Id client_id_;
- Id root_window_id_;
- uint32_t next_change_id_;
- uint32_t waiting_change_id_;
- bool on_change_completed_result_;
- bool track_root_bounds_changes_;
- std::unique_ptr<base::RunLoop> change_completed_run_loop_;
-
- std::unique_ptr<mojo::AssociatedBinding<mojom::WindowManager>>
- window_manager_binding_;
- mojom::WindowManagerClientAssociatedPtr window_manager_client_;
-
- DISALLOW_COPY_AND_ASSIGN(TestWindowTreeClient);
-};
-
-// -----------------------------------------------------------------------------
-
-// InterfaceFactory for vending TestWindowTreeClients.
-class WindowTreeClientFactory
- : public shell::InterfaceFactory<WindowTreeClient> {
- public:
- WindowTreeClientFactory() {}
- ~WindowTreeClientFactory() override {}
-
- // Runs a nested MessageLoop until a new instance has been created.
- std::unique_ptr<TestWindowTreeClient> WaitForInstance() {
- if (!client_impl_.get()) {
- DCHECK(!run_loop_);
- run_loop_.reset(new base::RunLoop);
- run_loop_->Run();
- run_loop_.reset();
- }
- return std::move(client_impl_);
- }
-
- private:
- // InterfaceFactory<WindowTreeClient>:
- void Create(Connection* connection,
- InterfaceRequest<WindowTreeClient> request) override {
- client_impl_.reset(new TestWindowTreeClient());
- client_impl_->Bind(std::move(request));
- if (run_loop_.get())
- run_loop_->Quit();
- }
-
- std::unique_ptr<TestWindowTreeClient> client_impl_;
- std::unique_ptr<base::RunLoop> run_loop_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowTreeClientFactory);
-};
-
-} // namespace
-
-class WindowTreeClientTest : public WindowServerShellTestBase {
- public:
- WindowTreeClientTest()
- : client_id_1_(0), client_id_2_(0), root_window_id_(0) {}
-
- ~WindowTreeClientTest() override {}
-
- protected:
- // Returns the changes from the various clients.
- std::vector<Change>* changes1() { return wt_client1_->tracker()->changes(); }
- std::vector<Change>* changes2() { return wt_client2_->tracker()->changes(); }
- std::vector<Change>* changes3() { return wt_client3_->tracker()->changes(); }
-
- // Various clients. |wt1()|, being the first client, has special permissions
- // (it's treated as the window manager).
- WindowTree* wt1() { return wt_client1_->tree(); }
- WindowTree* wt2() { return wt_client2_->tree(); }
- WindowTree* wt3() { return wt_client3_->tree(); }
-
- TestWindowTreeClient* wt_client1() { return wt_client1_.get(); }
- TestWindowTreeClient* wt_client2() { return wt_client2_.get(); }
- TestWindowTreeClient* wt_client3() { return wt_client3_.get(); }
-
- Id root_window_id() const { return root_window_id_; }
-
- int client_id_1() const { return client_id_1_; }
- int client_id_2() const { return client_id_2_; }
-
- void EstablishSecondClientWithRoot(Id root_id) {
- ASSERT_TRUE(wt_client2_.get() == nullptr);
- wt_client2_ =
- EstablishClientViaEmbed(wt1(), root_id, &client_id_2_);
- ASSERT_GT(client_id_2_, 0);
- ASSERT_TRUE(wt_client2_.get() != nullptr);
- }
-
- void EstablishSecondClient(bool create_initial_window) {
- Id window_1_1 = 0;
- if (create_initial_window) {
- window_1_1 = wt_client1()->NewWindow(1);
- ASSERT_TRUE(window_1_1);
- }
- ASSERT_NO_FATAL_FAILURE(
- EstablishSecondClientWithRoot(BuildWindowId(client_id_1(), 1)));
-
- if (create_initial_window) {
- EXPECT_EQ("[" + WindowParentToString(window_1_1, kNullParentId) + "]",
- ChangeWindowDescription(*changes2()));
- }
- }
-
- void EstablishThirdClient(WindowTree* owner, Id root_id) {
- ASSERT_TRUE(wt_client3_.get() == nullptr);
- wt_client3_ = EstablishClientViaEmbed(owner, root_id, nullptr);
- ASSERT_TRUE(wt_client3_.get() != nullptr);
- }
-
- std::unique_ptr<TestWindowTreeClient> WaitForWindowTreeClient() {
- return client_factory_->WaitForInstance();
- }
-
- // Establishes a new client by way of Embed() on the specified WindowTree.
- std::unique_ptr<TestWindowTreeClient> EstablishClientViaEmbed(
- WindowTree* owner,
- Id root_id,
- int* client_id) {
- return EstablishClientViaEmbedWithPolicyBitmask(owner, root_id, client_id);
- }
-
- std::unique_ptr<TestWindowTreeClient>
- EstablishClientViaEmbedWithPolicyBitmask(WindowTree* owner,
- Id root_id,
- int* client_id) {
- if (!EmbedUrl(connector(), owner, test_name(), root_id)) {
- ADD_FAILURE() << "Embed() failed";
- return nullptr;
- }
- std::unique_ptr<TestWindowTreeClient> client =
- client_factory_->WaitForInstance();
- if (!client.get()) {
- ADD_FAILURE() << "WaitForInstance failed";
- return nullptr;
- }
- client->WaitForOnEmbed();
-
- EXPECT_EQ("OnEmbed",
- SingleChangeToDescription(*client->tracker()->changes()));
- if (client_id)
- *client_id = (*client->tracker()->changes())[0].client_id;
- return client;
- }
-
- // WindowServerShellTestBase:
- bool AcceptConnection(shell::Connection* connection) override {
- connection->AddInterface(client_factory_.get());
- return true;
- }
-
- void SetUp() override {
- client_factory_.reset(new WindowTreeClientFactory());
-
- WindowServerShellTestBase::SetUp();
-
- mojom::WindowTreeHostFactoryPtr factory;
- connector()->ConnectToInterface("mojo:mus", &factory);
-
- mojom::WindowTreeClientPtr tree_client_ptr;
- wt_client1_.reset(new TestWindowTreeClient());
- wt_client1_->Bind(GetProxy(&tree_client_ptr));
-
- factory->CreateWindowTreeHost(GetProxy(&host_),
- std::move(tree_client_ptr));
-
- // Next we should get an embed call on the "window manager" client.
- wt_client1_->WaitForOnEmbed();
-
- ASSERT_EQ(1u, changes1()->size());
- EXPECT_EQ(CHANGE_TYPE_EMBED, (*changes1())[0].type);
- // All these tests assume 1 for the client id. The only real assertion here
- // is the client id is not zero, but adding this as rest of code here
- // assumes 1.
- ASSERT_GT((*changes1())[0].client_id, 0);
- client_id_1_ = (*changes1())[0].client_id;
- ASSERT_FALSE((*changes1())[0].windows.empty());
- root_window_id_ = (*changes1())[0].windows[0].window_id;
- ASSERT_EQ(root_window_id_, wt_client1_->root_window_id());
- changes1()->clear();
- }
-
- void TearDown() override {
- // Destroy these before the message loop is destroyed (happens in
- // WindowServerShellTestBase::TearDown).
- wt_client1_.reset();
- wt_client2_.reset();
- wt_client3_.reset();
- client_factory_.reset();
- WindowServerShellTestBase::TearDown();
- }
-
- std::unique_ptr<TestWindowTreeClient> wt_client1_;
- std::unique_ptr<TestWindowTreeClient> wt_client2_;
- std::unique_ptr<TestWindowTreeClient> wt_client3_;
-
- mojom::WindowTreeHostPtr host_;
-
- private:
- std::unique_ptr<WindowTreeClientFactory> client_factory_;
- int client_id_1_;
- int client_id_2_;
- Id root_window_id_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowTreeClientTest);
-};
-
-// Verifies two clients get different ids.
-TEST_F(WindowTreeClientTest, TwoClientsGetDifferentClientIds) {
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
-
- ASSERT_EQ(1u, changes2()->size());
- ASSERT_NE(client_id_1(), client_id_2());
-}
-
-// Verifies when Embed() is invoked any child windows are removed.
-TEST_F(WindowTreeClientTest, WindowsRemovedWhenEmbedding) {
- // Two windows 1 and 2. 2 is parented to 1.
- Id window_1_1 = wt_client1()->NewWindow(1);
- ASSERT_TRUE(window_1_1);
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
-
- Id window_1_2 = wt_client1()->NewWindow(2);
- ASSERT_TRUE(window_1_2);
- ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_2));
-
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(false));
- ASSERT_EQ(1u, changes2()->size());
- ASSERT_EQ(1u, (*changes2())[0].windows.size());
- EXPECT_EQ("[" + WindowParentToString(window_1_1, kNullParentId) + "]",
- ChangeWindowDescription(*changes2()));
-
- // Embed() removed window 2.
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt1(), window_1_2, &windows);
- EXPECT_EQ(WindowParentToString(window_1_2, kNullParentId),
- SingleWindowDescription(windows));
- }
-
- // ws2 should not see window 2.
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt2(), window_1_1, &windows);
- EXPECT_EQ(WindowParentToString(window_1_1, kNullParentId),
- SingleWindowDescription(windows));
- }
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt2(), window_1_2, &windows);
- EXPECT_TRUE(windows.empty());
- }
-
- // Windows 3 and 4 in client 2.
- Id window_2_3 = wt_client2()->NewWindow(3);
- Id window_2_4 = wt_client2()->NewWindow(4);
- ASSERT_TRUE(window_2_3);
- ASSERT_TRUE(window_2_4);
- ASSERT_TRUE(wt_client2()->AddWindow(window_2_3, window_2_4));
-
- // Client 3 rooted at 2.
- ASSERT_NO_FATAL_FAILURE(EstablishThirdClient(wt2(), window_2_3));
-
- // Window 4 should no longer have a parent.
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt2(), window_2_3, &windows);
- EXPECT_EQ(WindowParentToString(window_2_3, kNullParentId),
- SingleWindowDescription(windows));
-
- windows.clear();
- GetWindowTree(wt2(), window_2_4, &windows);
- EXPECT_EQ(WindowParentToString(window_2_4, kNullParentId),
- SingleWindowDescription(windows));
- }
-
- // And window 4 should not be visible to client 3.
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt3(), window_2_3, &windows);
- EXPECT_EQ("no windows", SingleWindowDescription(windows));
- }
-}
-
-// Verifies once Embed() has been invoked the parent client can't see any
-// children.
-TEST_F(WindowTreeClientTest, CantAccessChildrenOfEmbeddedWindow) {
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
-
- Id window_1_1 = BuildWindowId(client_id_1(), 1);
- Id window_2_2 = wt_client2()->NewWindow(2);
- ASSERT_TRUE(window_2_2);
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_2));
-
- ASSERT_NO_FATAL_FAILURE(EstablishThirdClient(wt2(), window_2_2));
-
- Id window_3_3 = wt_client3()->NewWindow(3);
- ASSERT_TRUE(window_3_3);
- ASSERT_TRUE(
- wt_client3()->AddWindow(wt_client3()->root_window_id(), window_3_3));
-
- // Even though 3 is a child of 2 client 2 can't see 3 as it's from a
- // different client.
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt2(), window_2_2, &windows);
- EXPECT_EQ(WindowParentToString(window_2_2, window_1_1),
- SingleWindowDescription(windows));
- }
-
- // Client 2 shouldn't be able to get window 3 at all.
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt2(), window_3_3, &windows);
- EXPECT_TRUE(windows.empty());
- }
-
- // Client 1 should be able to see it all (its the root).
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt1(), window_1_1, &windows);
- ASSERT_EQ(3u, windows.size());
- EXPECT_EQ(WindowParentToString(window_1_1, kNullParentId),
- windows[0].ToString());
- // NOTE: we expect a match of WindowParentToString(window_2_2, window_1_1),
- // but the ids are in the id space of client2, which is not the same as
- // the id space of wt1().
- EXPECT_EQ("window=2,1 parent=1,1", windows[1].ToString());
- // Same thing here, we really want to test for
- // WindowParentToString(window_3_3, window_2_2).
- EXPECT_EQ("window=3,1 parent=2,1", windows[2].ToString());
- }
-}
-
-// Verifies once Embed() has been invoked the parent can't mutate the children.
-TEST_F(WindowTreeClientTest, CantModifyChildrenOfEmbeddedWindow) {
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
-
- Id window_1_1 = BuildWindowId(client_id_1(), 1);
- Id window_2_1 = wt_client2()->NewWindow(1);
- ASSERT_TRUE(window_2_1);
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
-
- ASSERT_NO_FATAL_FAILURE(EstablishThirdClient(wt2(), window_2_1));
-
- Id window_2_2 = wt_client2()->NewWindow(2);
- ASSERT_TRUE(window_2_2);
- // Client 2 shouldn't be able to add anything to the window anymore.
- ASSERT_FALSE(wt_client2()->AddWindow(window_2_1, window_2_2));
-
- // Create window 3 in client 3 and add it to window 3.
- Id window_3_1 = wt_client3()->NewWindow(1);
- ASSERT_TRUE(window_3_1);
- ASSERT_TRUE(wt_client3()->AddWindow(window_2_1, window_3_1));
-
- // Client 2 shouldn't be able to remove window 3.
- ASSERT_FALSE(wt_client2()->RemoveWindowFromParent(window_3_1));
-}
-
-// Verifies client gets a valid id.
-TEST_F(WindowTreeClientTest, NewWindow) {
- Id window_1_1 = wt_client1()->NewWindow(1);
- ASSERT_TRUE(window_1_1);
- EXPECT_TRUE(changes1()->empty());
-
- // Can't create a window with the same id.
- ASSERT_EQ(0u, wt_client1()->NewWindowWithCompleteId(window_1_1));
- EXPECT_TRUE(changes1()->empty());
-
- // Can't create a window with a bogus client id.
- ASSERT_EQ(0u, wt_client1()->NewWindowWithCompleteId(
- BuildWindowId(client_id_1() + 1, 1)));
- EXPECT_TRUE(changes1()->empty());
-}
-
-// Verifies AddWindow fails when window is already in position.
-TEST_F(WindowTreeClientTest, AddWindowWithNoChange) {
- // Create the embed point now so that the ids line up.
- ASSERT_TRUE(wt_client1()->NewWindow(1));
- Id window_1_2 = wt_client1()->NewWindow(2);
- Id window_1_3 = wt_client1()->NewWindow(3);
- ASSERT_TRUE(window_1_2);
- ASSERT_TRUE(window_1_3);
-
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(false));
-
- // Make 3 a child of 2.
- ASSERT_TRUE(wt_client1()->AddWindow(window_1_2, window_1_3));
-
- // Try again, this should fail.
- EXPECT_FALSE(wt_client1()->AddWindow(window_1_2, window_1_3));
-}
-
-// Verifies AddWindow fails when window is already in position.
-TEST_F(WindowTreeClientTest, AddAncestorFails) {
- // Create the embed point now so that the ids line up.
- ASSERT_TRUE(wt_client1()->NewWindow(1));
- Id window_1_2 = wt_client1()->NewWindow(2);
- Id window_1_3 = wt_client1()->NewWindow(3);
- ASSERT_TRUE(window_1_2);
- ASSERT_TRUE(window_1_3);
-
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(false));
-
- // Make 3 a child of 2.
- ASSERT_TRUE(wt_client1()->AddWindow(window_1_2, window_1_3));
-
- // Try to make 2 a child of 3, this should fail since 2 is an ancestor of 3.
- EXPECT_FALSE(wt_client1()->AddWindow(window_1_3, window_1_2));
-}
-
-// Verifies adding to root sends right notifications.
-TEST_F(WindowTreeClientTest, AddToRoot) {
- // Create the embed point now so that the ids line up.
- Id window_1_1 = wt_client1()->NewWindow(1);
- ASSERT_TRUE(window_1_1);
- Id window_1_21 = wt_client1()->NewWindow(21);
- Id window_1_3 = wt_client1()->NewWindow(3);
- ASSERT_TRUE(window_1_21);
- ASSERT_TRUE(window_1_3);
-
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(false));
- changes2()->clear();
-
- // Make 3 a child of 21.
- ASSERT_TRUE(wt_client1()->AddWindow(window_1_21, window_1_3));
-
- // Make 21 a child of 1.
- ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_21));
-
- // Client 2 should not be told anything (because the window is from a
- // different client). Create a window to ensure we got a response from
- // the server.
- ASSERT_TRUE(wt_client2()->NewWindow(100));
- EXPECT_TRUE(changes2()->empty());
-}
-
-// Verifies HierarchyChanged is correctly sent for various adds/removes.
-TEST_F(WindowTreeClientTest, WindowHierarchyChangedWindows) {
- // Create the embed point now so that the ids line up.
- Id window_1_1 = wt_client1()->NewWindow(1);
- // 1,2->1,11.
- Id window_1_2 = wt_client1()->NewWindow(2);
- ASSERT_TRUE(window_1_2);
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_2, true));
- Id window_1_11 = wt_client1()->NewWindow(11);
- ASSERT_TRUE(window_1_11);
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_11, true));
- ASSERT_TRUE(wt_client1()->AddWindow(window_1_2, window_1_11));
-
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(false));
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, true));
-
- ASSERT_TRUE(wt_client2()->WaitForAllMessages());
- changes2()->clear();
-
- // 1,1->1,2->1,11
- {
- // Client 2 should not get anything (1,2 is from another client).
- ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_2));
- ASSERT_TRUE(wt_client2()->WaitForAllMessages());
- EXPECT_TRUE(changes2()->empty());
- }
-
- // 0,1->1,1->1,2->1,11.
- {
- // Client 2 is now connected to the root, so it should have gotten a drawn
- // notification.
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- wt_client2_->WaitForChangeCount(1u);
- EXPECT_EQ(
- "DrawnStateChanged window=" + IdToString(window_1_1) + " drawn=true",
- SingleChangeToDescription(*changes2()));
- }
-
- // 1,1->1,2->1,11.
- {
- // Client 2 is no longer connected to the root, should get drawn state
- // changed.
- changes2()->clear();
- ASSERT_TRUE(wt_client1()->RemoveWindowFromParent(window_1_1));
- wt_client2_->WaitForChangeCount(1);
- EXPECT_EQ(
- "DrawnStateChanged window=" + IdToString(window_1_1) + " drawn=false",
- SingleChangeToDescription(*changes2()));
- }
-
- // 1,1->1,2->1,11->1,111.
- Id window_1_111 = wt_client1()->NewWindow(111);
- ASSERT_TRUE(window_1_111);
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_111, true));
- {
- changes2()->clear();
- ASSERT_TRUE(wt_client1()->AddWindow(window_1_11, window_1_111));
- ASSERT_TRUE(wt_client2()->WaitForAllMessages());
- EXPECT_TRUE(changes2()->empty());
- }
-
- // 0,1->1,1->1,2->1,11->1,111
- {
- changes2()->clear();
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- wt_client2_->WaitForChangeCount(1);
- EXPECT_EQ(
- "DrawnStateChanged window=" + IdToString(window_1_1) + " drawn=true",
- SingleChangeToDescription(*changes2()));
- }
-}
-
-TEST_F(WindowTreeClientTest, WindowHierarchyChangedAddingKnownToUnknown) {
- // Create the following structure: root -> 1 -> 11 and 2->21 (2 has no
- // parent).
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
- Id window_1_1 = BuildWindowId(client_id_1(), 1);
-
- Id window_2_11 = wt_client2()->NewWindow(11);
- Id window_2_2 = wt_client2()->NewWindow(2);
- Id window_2_21 = wt_client2()->NewWindow(21);
- ASSERT_TRUE(window_2_11);
- ASSERT_TRUE(window_2_2);
- ASSERT_TRUE(window_2_21);
-
- // Set up the hierarchy.
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_11));
- ASSERT_TRUE(wt_client2()->AddWindow(window_2_2, window_2_21));
-
- // Remove 11, should result in a hierarchy change for the root.
- {
- changes1()->clear();
- ASSERT_TRUE(wt_client2()->RemoveWindowFromParent(window_2_11));
-
- wt_client1_->WaitForChangeCount(1);
- // 2,1 should be IdToString(window_2_11), but window_2_11 is in the id
- // space of client2, not client1.
- EXPECT_EQ("HierarchyChanged window=2,1 old_parent=" +
- IdToString(window_1_1) + " new_parent=null",
- SingleChangeToDescription(*changes1()));
- }
-
- // Add 2 to 1.
- {
- changes1()->clear();
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_2));
- wt_client1_->WaitForChangeCount(1);
- EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_2) +
- " old_parent=null new_parent=" + IdToString(window_1_1),
- SingleChangeToDescription(*changes1()));
- // "window=2,3 parent=2,2]" should be,
- // WindowParentToString(window_2_21, window_2_2), but isn't because of
- // differing id spaces.
- EXPECT_EQ("[" + WindowParentToString(window_2_2, window_1_1) +
- "],[window=2,3 parent=2,2]",
- ChangeWindowDescription(*changes1()));
- }
-}
-
-TEST_F(WindowTreeClientTest, ReorderWindow) {
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
-
- Id window_2_1 = wt_client2()->NewWindow(1);
- Id window_2_2 = wt_client2()->NewWindow(2);
- Id window_2_3 = wt_client2()->NewWindow(3);
- Id window_1_4 = wt_client1()->NewWindow(4); // Peer to 1,1
- Id window_1_5 = wt_client1()->NewWindow(5); // Peer to 1,1
- Id window_2_6 = wt_client2()->NewWindow(6); // Child of 1,2.
- Id window_2_7 = wt_client2()->NewWindow(7); // Unparented.
- Id window_2_8 = wt_client2()->NewWindow(8); // Unparented.
- ASSERT_TRUE(window_2_1);
- ASSERT_TRUE(window_2_2);
- ASSERT_TRUE(window_2_3);
- ASSERT_TRUE(window_1_4);
- ASSERT_TRUE(window_1_5);
- ASSERT_TRUE(window_2_6);
- ASSERT_TRUE(window_2_7);
- ASSERT_TRUE(window_2_8);
-
- ASSERT_TRUE(wt_client2()->AddWindow(window_2_1, window_2_2));
- ASSERT_TRUE(wt_client2()->AddWindow(window_2_2, window_2_6));
- ASSERT_TRUE(wt_client2()->AddWindow(window_2_1, window_2_3));
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_4));
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_5));
- ASSERT_TRUE(
- wt_client2()->AddWindow(BuildWindowId(client_id_1(), 1), window_2_1));
-
- {
- changes1()->clear();
- ASSERT_TRUE(wt_client2()->ReorderWindow(window_2_2, window_2_3,
- mojom::OrderDirection::ABOVE));
-
- wt_client1_->WaitForChangeCount(1);
- EXPECT_EQ("Reordered window=" + IdToString(window_2_2) + " relative=" +
- IdToString(window_2_3) + " direction=above",
- SingleChangeToDescription(*changes1()));
- }
-
- {
- changes1()->clear();
- ASSERT_TRUE(wt_client2()->ReorderWindow(window_2_2, window_2_3,
- mojom::OrderDirection::BELOW));
-
- wt_client1_->WaitForChangeCount(1);
- EXPECT_EQ("Reordered window=" + IdToString(window_2_2) + " relative=" +
- IdToString(window_2_3) + " direction=below",
- SingleChangeToDescription(*changes1()));
- }
-
- // view2 is already below view3.
- EXPECT_FALSE(wt_client2()->ReorderWindow(window_2_2, window_2_3,
- mojom::OrderDirection::BELOW));
-
- // view4 & 5 are unknown to client 2.
- EXPECT_FALSE(wt_client2()->ReorderWindow(window_1_4, window_1_5,
- mojom::OrderDirection::ABOVE));
-
- // view6 & view3 have different parents.
- EXPECT_FALSE(wt_client1()->ReorderWindow(window_2_3, window_2_6,
- mojom::OrderDirection::ABOVE));
-
- // Non-existent window-ids
- EXPECT_FALSE(wt_client1()->ReorderWindow(BuildWindowId(client_id_1(), 27),
- BuildWindowId(client_id_1(), 28),
- mojom::OrderDirection::ABOVE));
-
- // view7 & view8 are un-parented.
- EXPECT_FALSE(wt_client1()->ReorderWindow(window_2_7, window_2_8,
- mojom::OrderDirection::ABOVE));
-}
-
-// Verifies DeleteWindow works.
-TEST_F(WindowTreeClientTest, DeleteWindow) {
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
- Id window_1_1 = BuildWindowId(client_id_1(), 1);
- Id window_2_1 = wt_client2()->NewWindow(1);
- ASSERT_TRUE(window_2_1);
-
- // Make 2 a child of 1.
- {
- changes1()->clear();
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
- wt_client1_->WaitForChangeCount(1);
- EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_1) +
- " old_parent=null new_parent=" + IdToString(window_1_1),
- SingleChangeToDescription(*changes1()));
- }
-
- // Delete 2.
- {
- changes1()->clear();
- changes2()->clear();
- ASSERT_TRUE(wt_client2()->DeleteWindow(window_2_1));
- EXPECT_TRUE(changes2()->empty());
-
- wt_client1_->WaitForChangeCount(1);
- EXPECT_EQ("WindowDeleted window=" + IdToString(window_2_1),
- SingleChangeToDescription(*changes1()));
- }
-}
-
-// Verifies DeleteWindow isn't allowed from a separate client.
-TEST_F(WindowTreeClientTest, DeleteWindowFromAnotherClientDisallowed) {
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
- EXPECT_FALSE(wt_client2()->DeleteWindow(BuildWindowId(client_id_1(), 1)));
-}
-
-// Verifies if a window was deleted and then reused that other clients are
-// properly notified.
-TEST_F(WindowTreeClientTest, ReuseDeletedWindowId) {
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
- Id window_1_1 = BuildWindowId(client_id_1(), 1);
- Id window_2_1 = wt_client2()->NewWindow(1);
- ASSERT_TRUE(window_2_1);
-
- // Add 2 to 1.
- {
- changes1()->clear();
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
- wt_client1_->WaitForChangeCount(1);
- EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_1) +
- " old_parent=null new_parent=" + IdToString(window_1_1),
- SingleChangeToDescription(*changes1()));
- EXPECT_EQ("[" + WindowParentToString(window_2_1, window_1_1) + "]",
- ChangeWindowDescription(*changes1()));
- }
-
- // Delete 2.
- {
- changes1()->clear();
- ASSERT_TRUE(wt_client2()->DeleteWindow(window_2_1));
-
- wt_client1_->WaitForChangeCount(1);
- EXPECT_EQ("WindowDeleted window=" + IdToString(window_2_1),
- SingleChangeToDescription(*changes1()));
- }
-
- // Create 2 again, and add it back to 1. Should get the same notification.
- window_2_1 = wt_client2()->NewWindow(2);
- ASSERT_TRUE(window_2_1);
- {
- changes1()->clear();
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
-
- wt_client1_->WaitForChangeCount(1);
- EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_1) +
- " old_parent=null new_parent=" + IdToString(window_1_1),
- SingleChangeToDescription(*changes1()));
- EXPECT_EQ("[" + WindowParentToString(window_2_1, window_1_1) + "]",
- ChangeWindowDescription(*changes1()));
- }
-}
-
-// Assertions for GetWindowTree.
-TEST_F(WindowTreeClientTest, GetWindowTree) {
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
- Id window_1_1 = BuildWindowId(client_id_1(), 1);
-
- // Create 11 in first client and make it a child of 1.
- Id window_1_11 = wt_client1()->NewWindow(11);
- ASSERT_TRUE(window_1_11);
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_11));
-
- // Create two windows in second client, 2 and 3, both children of 1.
- Id window_2_1 = wt_client2()->NewWindow(1);
- Id window_2_2 = wt_client2()->NewWindow(2);
- ASSERT_TRUE(window_2_1);
- ASSERT_TRUE(window_2_2);
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_2));
-
- // Verifies GetWindowTree() on the root. The root client sees all.
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt1(), root_window_id(), &windows);
- ASSERT_EQ(5u, windows.size());
- EXPECT_EQ(WindowParentToString(root_window_id(), kNullParentId),
- windows[0].ToString());
- EXPECT_EQ(WindowParentToString(window_1_1, root_window_id()),
- windows[1].ToString());
- EXPECT_EQ(WindowParentToString(window_1_11, window_1_1),
- windows[2].ToString());
- EXPECT_EQ(WindowParentToString(window_2_1, window_1_1),
- windows[3].ToString());
- EXPECT_EQ(WindowParentToString(window_2_2, window_1_1),
- windows[4].ToString());
- }
-
- // Verifies GetWindowTree() on the window 1,1 from wt2(). wt2() sees 1,1 as
- // 1,1
- // is wt2()'s root and wt2() sees all the windows it created.
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt2(), window_1_1, &windows);
- ASSERT_EQ(3u, windows.size());
- EXPECT_EQ(WindowParentToString(window_1_1, kNullParentId),
- windows[0].ToString());
- EXPECT_EQ(WindowParentToString(window_2_1, window_1_1),
- windows[1].ToString());
- EXPECT_EQ(WindowParentToString(window_2_2, window_1_1),
- windows[2].ToString());
- }
-
- // Client 2 shouldn't be able to get the root tree.
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt2(), root_window_id(), &windows);
- ASSERT_EQ(0u, windows.size());
- }
-}
-
-TEST_F(WindowTreeClientTest, SetWindowBounds) {
- Id window_1_1 = wt_client1()->NewWindow(1);
- ASSERT_TRUE(window_1_1);
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
-
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(false));
-
- changes2()->clear();
-
- wt_client2_->set_track_root_bounds_changes(true);
-
- wt1()->SetWindowBounds(10, window_1_1, gfx::Rect(0, 0, 100, 100));
- ASSERT_TRUE(wt_client1()->WaitForChangeCompleted(10));
-
- wt_client2_->WaitForChangeCount(1);
- EXPECT_EQ("BoundsChanged window=" + IdToString(window_1_1) +
- " old_bounds=0,0 0x0 new_bounds=0,0 100x100",
- SingleChangeToDescription(*changes2()));
-
- // Should not be possible to change the bounds of a window created by another
- // client.
- wt2()->SetWindowBounds(11, window_1_1, gfx::Rect(0, 0, 0, 0));
- ASSERT_FALSE(wt_client2()->WaitForChangeCompleted(11));
-}
-
-// Verify AddWindow fails when trying to manipulate windows in other roots.
-TEST_F(WindowTreeClientTest, CantMoveWindowsFromOtherRoot) {
- // Create 1 and 2 in the first client.
- Id window_1_1 = wt_client1()->NewWindow(1);
- Id window_1_2 = wt_client1()->NewWindow(2);
- ASSERT_TRUE(window_1_1);
- ASSERT_TRUE(window_1_2);
-
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(false));
-
- // Try to move 2 to be a child of 1 from client 2. This should fail as 2
- // should not be able to access 1.
- ASSERT_FALSE(wt_client2()->AddWindow(window_1_1, window_1_2));
-
- // Try to reparent 1 to the root. A client is not allowed to reparent its
- // roots.
- ASSERT_FALSE(wt_client2()->AddWindow(root_window_id(), window_1_1));
-}
-
-// Verify RemoveWindowFromParent fails for windows that are descendants of the
-// roots.
-TEST_F(WindowTreeClientTest, CantRemoveWindowsInOtherRoots) {
- // Create 1 and 2 in the first client and parent both to the root.
- Id window_1_1 = wt_client1()->NewWindow(1);
- Id window_1_2 = wt_client1()->NewWindow(2);
- ASSERT_TRUE(window_1_1);
- ASSERT_TRUE(window_1_2);
-
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_2));
-
- // Establish the second client and give it the root 1.
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(false));
-
- // Client 2 should not be able to remove window 2 or 1 from its parent.
- ASSERT_FALSE(wt_client2()->RemoveWindowFromParent(window_1_2));
- ASSERT_FALSE(wt_client2()->RemoveWindowFromParent(window_1_1));
-
- // Create windows 10 and 11 in 2.
- Id window_2_10 = wt_client2()->NewWindow(10);
- Id window_2_11 = wt_client2()->NewWindow(11);
- ASSERT_TRUE(window_2_10);
- ASSERT_TRUE(window_2_11);
-
- // Parent 11 to 10.
- ASSERT_TRUE(wt_client2()->AddWindow(window_2_10, window_2_11));
- // Remove 11 from 10.
- ASSERT_TRUE(wt_client2()->RemoveWindowFromParent(window_2_11));
-
- // Verify nothing was actually removed.
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt1(), root_window_id(), &windows);
- ASSERT_EQ(3u, windows.size());
- EXPECT_EQ(WindowParentToString(root_window_id(), kNullParentId),
- windows[0].ToString());
- EXPECT_EQ(WindowParentToString(window_1_1, root_window_id()),
- windows[1].ToString());
- EXPECT_EQ(WindowParentToString(window_1_2, root_window_id()),
- windows[2].ToString());
- }
-}
-
-// Verify GetWindowTree fails for windows that are not descendants of the roots.
-TEST_F(WindowTreeClientTest, CantGetWindowTreeOfOtherRoots) {
- // Create 1 and 2 in the first client and parent both to the root.
- Id window_1_1 = wt_client1()->NewWindow(1);
- Id window_1_2 = wt_client1()->NewWindow(2);
- ASSERT_TRUE(window_1_1);
- ASSERT_TRUE(window_1_2);
-
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_2));
-
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(false));
-
- std::vector<TestWindow> windows;
-
- // Should get nothing for the root.
- GetWindowTree(wt2(), root_window_id(), &windows);
- ASSERT_TRUE(windows.empty());
-
- // Should get nothing for window 2.
- GetWindowTree(wt2(), window_1_2, &windows);
- ASSERT_TRUE(windows.empty());
-
- // Should get window 1 if asked for.
- GetWindowTree(wt2(), window_1_1, &windows);
- ASSERT_EQ(1u, windows.size());
- EXPECT_EQ(WindowParentToString(window_1_1, kNullParentId),
- windows[0].ToString());
-}
-
-TEST_F(WindowTreeClientTest, EmbedWithSameWindowId) {
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
- changes2()->clear();
-
- Id window_1_1 = BuildWindowId(client_id_1(), 1);
- ASSERT_NO_FATAL_FAILURE(EstablishThirdClient(wt1(), window_1_1));
-
- // Client 2 should have been told of the unembed and delete.
- {
- wt_client2_->WaitForChangeCount(2);
- EXPECT_EQ("OnUnembed window=" + IdToString(window_1_1),
- ChangesToDescription1(*changes2())[0]);
- EXPECT_EQ("WindowDeleted window=" + IdToString(window_1_1),
- ChangesToDescription1(*changes2())[1]);
- }
-
- // Client 2 has no root. Verify it can't see window 1,1 anymore.
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt2(), window_1_1, &windows);
- EXPECT_TRUE(windows.empty());
- }
-}
-
-TEST_F(WindowTreeClientTest, EmbedWithSameWindowId2) {
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
- Id window_1_1 = BuildWindowId(client_id_1(), 1);
- changes2()->clear();
-
- ASSERT_NO_FATAL_FAILURE(EstablishThirdClient(wt1(), window_1_1));
-
- // Client 2 should have been told about the unembed and delete.
- wt_client2_->WaitForChangeCount(2);
- changes2()->clear();
-
- // Create a window in the third client and parent it to the root.
- Id window_3_1 = wt_client3()->NewWindow(1);
- ASSERT_TRUE(window_3_1);
- ASSERT_TRUE(wt_client3()->AddWindow(window_1_1, window_3_1));
-
- // Client 1 should have been told about the add (it owns the window).
- {
- wt_client1_->WaitForChangeCount(1);
- EXPECT_EQ("HierarchyChanged window=" + IdToString(window_3_1) +
- " old_parent=null new_parent=" + IdToString(window_1_1),
- SingleChangeToDescription(*changes1()));
- }
-
- // Embed 1,1 again.
- {
- changes3()->clear();
-
- // We should get a new client for the new embedding.
- std::unique_ptr<TestWindowTreeClient> client4(
- EstablishClientViaEmbed(wt1(), window_1_1, nullptr));
- ASSERT_TRUE(client4.get());
- EXPECT_EQ("[" + WindowParentToString(window_1_1, kNullParentId) + "]",
- ChangeWindowDescription(*client4->tracker()->changes()));
-
- // And 3 should get an unembed and delete.
- wt_client3_->WaitForChangeCount(2);
- EXPECT_EQ("OnUnembed window=" + IdToString(window_1_1),
- ChangesToDescription1(*changes3())[0]);
- EXPECT_EQ("WindowDeleted window=" + IdToString(window_1_1),
- ChangesToDescription1(*changes3())[1]);
- }
-
- // wt3() has no root. Verify it can't see window 1,1 anymore.
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt3(), window_1_1, &windows);
- EXPECT_TRUE(windows.empty());
- }
-
- // Verify 3,1 is no longer parented to 1,1. We have to do this from 1,1 as
- // wt3() can no longer see 1,1.
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt1(), window_1_1, &windows);
- ASSERT_EQ(1u, windows.size());
- EXPECT_EQ(WindowParentToString(window_1_1, kNullParentId),
- windows[0].ToString());
- }
-
- // Verify wt3() can still see the window it created 3,1.
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt3(), window_3_1, &windows);
- ASSERT_EQ(1u, windows.size());
- EXPECT_EQ(WindowParentToString(window_3_1, kNullParentId),
- windows[0].ToString());
- }
-}
-
-// Assertions for SetWindowVisibility.
-TEST_F(WindowTreeClientTest, SetWindowVisibility) {
- // Create 1 and 2 in the first client and parent both to the root.
- Id window_1_1 = wt_client1()->NewWindow(1);
- Id window_1_2 = wt_client1()->NewWindow(2);
- ASSERT_TRUE(window_1_1);
- ASSERT_TRUE(window_1_2);
-
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt1(), root_window_id(), &windows);
- ASSERT_EQ(2u, windows.size());
- EXPECT_EQ(
- WindowParentToString(root_window_id(), kNullParentId) + " visible=true",
- windows[0].ToString2());
- EXPECT_EQ(
- WindowParentToString(window_1_1, root_window_id()) + " visible=false",
- windows[1].ToString2());
- }
-
- // Show all the windows.
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, true));
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_2, true));
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt1(), root_window_id(), &windows);
- ASSERT_EQ(2u, windows.size());
- EXPECT_EQ(
- WindowParentToString(root_window_id(), kNullParentId) + " visible=true",
- windows[0].ToString2());
- EXPECT_EQ(
- WindowParentToString(window_1_1, root_window_id()) + " visible=true",
- windows[1].ToString2());
- }
-
- // Hide 1.
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, false));
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt1(), window_1_1, &windows);
- ASSERT_EQ(1u, windows.size());
- EXPECT_EQ(
- WindowParentToString(window_1_1, root_window_id()) + " visible=false",
- windows[0].ToString2());
- }
-
- // Attach 2 to 1.
- ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_2));
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt1(), window_1_1, &windows);
- ASSERT_EQ(2u, windows.size());
- EXPECT_EQ(
- WindowParentToString(window_1_1, root_window_id()) + " visible=false",
- windows[0].ToString2());
- EXPECT_EQ(WindowParentToString(window_1_2, window_1_1) + " visible=true",
- windows[1].ToString2());
- }
-
- // Show 1.
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, true));
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt1(), window_1_1, &windows);
- ASSERT_EQ(2u, windows.size());
- EXPECT_EQ(
- WindowParentToString(window_1_1, root_window_id()) + " visible=true",
- windows[0].ToString2());
- EXPECT_EQ(WindowParentToString(window_1_2, window_1_1) + " visible=true",
- windows[1].ToString2());
- }
-}
-
-// Test that we hear the cursor change in other clients.
-TEST_F(WindowTreeClientTest, SetCursor) {
- // Get a second client to listen in.
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
- Id window_1_1 = BuildWindowId(client_id_1(), 1);
- changes2()->clear();
-
- ASSERT_TRUE(
- wt_client1()->SetPredefinedCursor(window_1_1, mojom::Cursor::IBEAM));
- wt_client2_->WaitForChangeCount(1u);
-
- EXPECT_EQ("CursorChanged id=" + IdToString(window_1_1) + " cursor_id=4",
- SingleChangeToDescription(*changes2()));
-}
-
-// Assertions for SetWindowVisibility sending notifications.
-TEST_F(WindowTreeClientTest, SetWindowVisibilityNotifications) {
- // Create 1,1 and 1,2. 1,2 is made a child of 1,1 and 1,1 a child of the root.
- Id window_1_1 = wt_client1()->NewWindow(1);
- ASSERT_TRUE(window_1_1);
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, true));
- // Setting to the same value should return true.
- EXPECT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, true));
-
- Id window_1_2 = wt_client1()->NewWindow(2);
- ASSERT_TRUE(window_1_2);
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_2, true));
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_2));
-
- // Establish the second client at 1,2.
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClientWithRoot(window_1_2));
-
- // Add 2,3 as a child of 1,2.
- Id window_2_1 = wt_client2()->NewWindow(1);
- ASSERT_TRUE(window_2_1);
- ASSERT_TRUE(wt_client2()->SetWindowVisibility(window_2_1, true));
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_2, window_2_1));
- ASSERT_TRUE(wt_client1()->WaitForAllMessages());
-
- changes2()->clear();
- // Hide 1,2 from client 1. Client 2 should see this.
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_2, false));
- {
- wt_client2_->WaitForChangeCount(1);
- EXPECT_EQ(
- "VisibilityChanged window=" + IdToString(window_1_2) + " visible=false",
- SingleChangeToDescription(*changes2()));
- }
-
- changes1()->clear();
- // Show 1,2 from client 2, client 1 should be notified.
- ASSERT_TRUE(wt_client2()->SetWindowVisibility(window_1_2, true));
- {
- wt_client1_->WaitForChangeCount(1);
- EXPECT_EQ(
- "VisibilityChanged window=" + IdToString(window_1_2) + " visible=true",
- SingleChangeToDescription(*changes1()));
- }
-
- changes2()->clear();
- // Hide 1,1, client 2 should be told the draw state changed.
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, false));
- {
- wt_client2_->WaitForChangeCount(1);
- EXPECT_EQ(
- "DrawnStateChanged window=" + IdToString(window_1_2) + " drawn=false",
- SingleChangeToDescription(*changes2()));
- }
-
- changes2()->clear();
- // Show 1,1 from client 1. Client 2 should see this.
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, true));
- {
- wt_client2_->WaitForChangeCount(1);
- EXPECT_EQ(
- "DrawnStateChanged window=" + IdToString(window_1_2) + " drawn=true",
- SingleChangeToDescription(*changes2()));
- }
-
- // Change visibility of 2,3, client 1 should see this.
- changes1()->clear();
- ASSERT_TRUE(wt_client2()->SetWindowVisibility(window_2_1, false));
- {
- wt_client1_->WaitForChangeCount(1);
- EXPECT_EQ(
- "VisibilityChanged window=" + IdToString(window_2_1) + " visible=false",
- SingleChangeToDescription(*changes1()));
- }
-
- changes2()->clear();
- // Remove 1,1 from the root, client 2 should see drawn state changed.
- ASSERT_TRUE(wt_client1()->RemoveWindowFromParent(window_1_1));
- {
- wt_client2_->WaitForChangeCount(1);
- EXPECT_EQ(
- "DrawnStateChanged window=" + IdToString(window_1_2) + " drawn=false",
- SingleChangeToDescription(*changes2()));
- }
-
- changes2()->clear();
- // Add 1,1 back to the root, client 2 should see drawn state changed.
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- {
- wt_client2_->WaitForChangeCount(1);
- EXPECT_EQ(
- "DrawnStateChanged window=" + IdToString(window_1_2) + " drawn=true",
- SingleChangeToDescription(*changes2()));
- }
-}
-
-// Assertions for SetWindowVisibility sending notifications.
-TEST_F(WindowTreeClientTest, SetWindowVisibilityNotifications2) {
- // Create 1,1 and 1,2. 1,2 is made a child of 1,1 and 1,1 a child of the root.
- Id window_1_1 = wt_client1()->NewWindow(1);
- ASSERT_TRUE(window_1_1);
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, true));
- Id window_1_2 = wt_client1()->NewWindow(2);
- ASSERT_TRUE(window_1_2);
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_2));
-
- // Establish the second client at 1,2.
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClientWithRoot(window_1_2));
- EXPECT_EQ("OnEmbed drawn=true", SingleChangeToDescription2(*changes2()));
- changes2()->clear();
-
- // Show 1,2 from client 1. Client 2 should see this.
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_2, true));
- {
- wt_client2_->WaitForChangeCount(1);
- EXPECT_EQ(
- "VisibilityChanged window=" + IdToString(window_1_2) + " visible=true",
- SingleChangeToDescription(*changes2()));
- }
-}
-
-// Assertions for SetWindowVisibility sending notifications.
-TEST_F(WindowTreeClientTest, SetWindowVisibilityNotifications3) {
- // Create 1,1 and 1,2. 1,2 is made a child of 1,1 and 1,1 a child of the root.
- Id window_1_1 = wt_client1()->NewWindow(1);
- ASSERT_TRUE(window_1_1);
- Id window_1_2 = wt_client1()->NewWindow(2);
- ASSERT_TRUE(window_1_2);
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(wt_client1()->AddWindow(window_1_1, window_1_2));
-
- // Establish the second client at 1,2.
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClientWithRoot(window_1_2));
- EXPECT_EQ("OnEmbed drawn=false", SingleChangeToDescription2(*changes2()));
- changes2()->clear();
-
- // Show 1,1, drawn should be true for 1,2 (as that is all the child sees).
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_1, true));
- {
- wt_client2_->WaitForChangeCount(1);
- EXPECT_EQ(
- "DrawnStateChanged window=" + IdToString(window_1_2) + " drawn=true",
- SingleChangeToDescription(*changes2()));
- }
- changes2()->clear();
-
- // Show 1,2, visible should be true.
- ASSERT_TRUE(wt_client1()->SetWindowVisibility(window_1_2, true));
- {
- wt_client2_->WaitForChangeCount(1);
- EXPECT_EQ(
- "VisibilityChanged window=" + IdToString(window_1_2) + " visible=true",
- SingleChangeToDescription(*changes2()));
- }
-}
-
-// Tests that when opacity is set on a window, that the calling client is not
-// notified, however children are. Also that setting the same opacity is
-// rejected and no on eis notifiyed.
-TEST_F(WindowTreeClientTest, SetOpacityNotifications) {
- Id window_1_1 = wt_client1()->NewWindow(1);
- ASSERT_TRUE(window_1_1);
-
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClientWithRoot(window_1_1));
- Id window_2_1 = wt_client2()->NewWindow(1);
- ASSERT_TRUE(window_2_1);
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
- ASSERT_TRUE(wt_client1()->WaitForAllMessages());
-
- changes1()->clear();
- changes2()->clear();
- // Change opacity, no notification for calling client.
- ASSERT_TRUE(wt_client1()->SetWindowOpacity(window_1_1, 0.5f));
- EXPECT_TRUE(changes1()->empty());
- wt_client2()->WaitForChangeCount(1);
- EXPECT_EQ(
- "OpacityChanged window_id=" + IdToString(window_1_1) + " opacity=0.50",
- SingleChangeToDescription(*changes2()));
-
- changes2()->clear();
- // Attempting to set the same opacity should succeed, but no notification as
- // there was no actual change.
- ASSERT_TRUE(wt_client1()->SetWindowOpacity(window_1_1, 0.5f));
- EXPECT_TRUE(changes1()->empty());
- wt_client2()->WaitForAllMessages();
- EXPECT_TRUE(changes2()->empty());
-}
-
-TEST_F(WindowTreeClientTest, SetWindowProperty) {
- Id window_1_1 = wt_client1()->NewWindow(1);
- ASSERT_TRUE(window_1_1);
-
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(false));
- changes2()->clear();
-
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt1(), root_window_id(), &windows);
- ASSERT_EQ(2u, windows.size());
- EXPECT_EQ(root_window_id(), windows[0].window_id);
- EXPECT_EQ(window_1_1, windows[1].window_id);
- ASSERT_EQ(0u, windows[1].properties.size());
- }
-
- // Set properties on 1.
- changes2()->clear();
- std::vector<uint8_t> one(1, '1');
- ASSERT_TRUE(wt_client1()->SetWindowProperty(window_1_1, "one", &one));
- {
- wt_client2_->WaitForChangeCount(1);
- EXPECT_EQ(
- "PropertyChanged window=" + IdToString(window_1_1) + " key=one value=1",
- SingleChangeToDescription(*changes2()));
- }
-
- // Test that our properties exist in the window tree
- {
- std::vector<TestWindow> windows;
- GetWindowTree(wt1(), window_1_1, &windows);
- ASSERT_EQ(1u, windows.size());
- ASSERT_EQ(1u, windows[0].properties.size());
- EXPECT_EQ(one, windows[0].properties["one"]);
- }
-
- changes2()->clear();
- // Set back to null.
- ASSERT_TRUE(wt_client1()->SetWindowProperty(window_1_1, "one", NULL));
- {
- wt_client2_->WaitForChangeCount(1);
- EXPECT_EQ("PropertyChanged window=" + IdToString(window_1_1) +
- " key=one value=NULL",
- SingleChangeToDescription(*changes2()));
- }
-}
-
-TEST_F(WindowTreeClientTest, OnEmbeddedAppDisconnected) {
- // Create client 2 and 3.
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
- Id window_1_1 = BuildWindowId(client_id_1(), 1);
- Id window_2_1 = wt_client2()->NewWindow(1);
- ASSERT_TRUE(window_2_1);
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
- changes2()->clear();
- ASSERT_NO_FATAL_FAILURE(EstablishThirdClient(wt2(), window_2_1));
-
- // Client 1 should get a hierarchy change for window_2_1.
- wt_client1_->WaitForChangeCount(1);
- changes1()->clear();
-
- // Close client 3. Client 2 (which had previously embedded 3) should
- // be notified of this.
- wt_client3_.reset();
- wt_client2_->WaitForChangeCount(1);
- EXPECT_EQ("OnEmbeddedAppDisconnected window=" + IdToString(window_2_1),
- SingleChangeToDescription(*changes2()));
-
- // The closing is only interesting to the root that did the embedding. Other
- // clients should not be notified of this.
- wt_client1_->WaitForAllMessages();
- EXPECT_TRUE(changes1()->empty());
-}
-
-// Verifies when the parent of an Embed() is destroyed the embedded app gets
-// a WindowDeleted (and doesn't trigger a DCHECK).
-TEST_F(WindowTreeClientTest, OnParentOfEmbedDisconnects) {
- // Create client 2 and 3.
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
- Id window_1_1 = BuildWindowId(client_id_1(), 1);
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- Id window_2_1 = wt_client2()->NewWindow(1);
- Id window_2_2 = wt_client2()->NewWindow(2);
- ASSERT_TRUE(window_2_1);
- ASSERT_TRUE(window_2_2);
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
- ASSERT_TRUE(wt_client2()->AddWindow(window_2_1, window_2_2));
- changes2()->clear();
- ASSERT_NO_FATAL_FAILURE(EstablishThirdClient(wt2(), window_2_2));
- changes3()->clear();
-
- // Close client 2. Client 3 should get a delete (for its root).
- wt_client2_.reset();
- wt_client3_->WaitForChangeCount(1);
- EXPECT_EQ("WindowDeleted window=" + IdToString(window_2_2),
- SingleChangeToDescription(*changes3()));
-}
-
-// Verifies WindowTreeImpl doesn't incorrectly erase from its internal
-// map when a window from another client with the same window_id is removed.
-TEST_F(WindowTreeClientTest, DontCleanMapOnDestroy) {
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
- Id window_1_1 = BuildWindowId(client_id_1(), 1);
- ASSERT_TRUE(wt_client2()->NewWindow(1));
- changes1()->clear();
- wt_client2_.reset();
- wt_client1_->WaitForChangeCount(1);
- EXPECT_EQ("OnEmbeddedAppDisconnected window=" + IdToString(window_1_1),
- SingleChangeToDescription(*changes1()));
- std::vector<TestWindow> windows;
- GetWindowTree(wt1(), window_1_1, &windows);
- EXPECT_FALSE(windows.empty());
-}
-
-// Verifies Embed() works when supplying a WindowTreeClient.
-TEST_F(WindowTreeClientTest, EmbedSupplyingWindowTreeClient) {
- ASSERT_TRUE(wt_client1()->NewWindow(1));
-
- TestWindowTreeClient client2;
- mojom::WindowTreeClientPtr client2_ptr;
- mojo::Binding<WindowTreeClient> client2_binding(&client2, &client2_ptr);
- ASSERT_TRUE(Embed(wt1(), BuildWindowId(client_id_1(), 1),
- std::move(client2_ptr)));
- client2.WaitForOnEmbed();
- EXPECT_EQ("OnEmbed",
- SingleChangeToDescription(*client2.tracker()->changes()));
-}
-
-TEST_F(WindowTreeClientTest, EmbedFailsFromOtherClient) {
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
-
- Id window_1_1 = BuildWindowId(client_id_1(), 1);
- Id window_2_1 = wt_client2()->NewWindow(1);
- ASSERT_TRUE(window_2_1);
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
- ASSERT_NO_FATAL_FAILURE(EstablishThirdClient(wt2(), window_2_1));
-
- Id window_3_3 = wt_client3()->NewWindow(3);
- ASSERT_TRUE(window_3_3);
- ASSERT_TRUE(wt_client3()->AddWindow(window_2_1, window_3_3));
-
- // 2 should not be able to embed in window_3_3 as window_3_3 was not created
- // by
- // 2.
- EXPECT_FALSE(EmbedUrl(connector(), wt2(), test_name(), window_3_3));
-}
-
-// Verifies Embed() from window manager on another clients window works.
-TEST_F(WindowTreeClientTest, EmbedFromOtherClient) {
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
-
- Id window_1_1 = BuildWindowId(client_id_1(), 1);
- Id window_2_1 = wt_client2()->NewWindow(1);
- ASSERT_TRUE(window_2_1);
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
-
- changes2()->clear();
-
- // Establish a third client in window_2_1.
- ASSERT_NO_FATAL_FAILURE(EstablishThirdClient(wt1(), window_2_1));
-
- ASSERT_TRUE(wt_client2()->WaitForAllMessages());
- EXPECT_EQ(std::string(), SingleChangeToDescription(*changes2()));
-}
-
-TEST_F(WindowTreeClientTest, CantEmbedFromClientRoot) {
- // Shouldn't be able to embed into the root.
- ASSERT_FALSE(EmbedUrl(connector(), wt1(), test_name(), root_window_id()));
-
- // Even though the call above failed a WindowTreeClient was obtained. We need
- // to
- // wait for it else we throw off the next connect.
- WaitForWindowTreeClient();
-
- // Don't allow a client to embed into its own root.
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
- EXPECT_FALSE(EmbedUrl(connector(), wt2(), test_name(),
- BuildWindowId(client_id_1(), 1)));
-
- // Need to wait for a WindowTreeClient for same reason as above.
- WaitForWindowTreeClient();
-
- Id window_1_2 = wt_client1()->NewWindow(2);
- ASSERT_TRUE(window_1_2);
- ASSERT_TRUE(
- wt_client1()->AddWindow(BuildWindowId(client_id_1(), 1), window_1_2));
- ASSERT_TRUE(wt_client3_.get() == nullptr);
- wt_client3_ =
- EstablishClientViaEmbedWithPolicyBitmask(wt1(), window_1_2, nullptr);
- ASSERT_TRUE(wt_client3_.get() != nullptr);
-
- // window_1_2 is ws3's root, so even though v3 is an embed root it should not
- // be able to Embed into itself.
- ASSERT_FALSE(EmbedUrl(connector(), wt3(), test_name(), window_1_2));
-}
-
-// Verifies that a transient window tracks its parent's lifetime.
-TEST_F(WindowTreeClientTest, TransientWindowTracksTransientParentLifetime) {
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClient(true));
- Id window_1_1 = BuildWindowId(client_id_1(), 1);
-
- Id window_2_1 = wt_client2()->NewWindow(1);
- Id window_2_2 = wt_client2()->NewWindow(2);
- Id window_2_3 = wt_client2()->NewWindow(3);
- ASSERT_TRUE(window_2_1);
-
- // root -> window_1_1 -> window_2_1
- // root -> window_1_1 -> window_2_2
- // root -> window_1_1 -> window_2_3
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_1));
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_2));
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_1, window_2_3));
-
- // window_2_2 and window_2_3 now track the lifetime of window_2_1.
- changes1()->clear();
- wt2()->AddTransientWindow(10, window_2_1, window_2_2);
- wt2()->AddTransientWindow(11, window_2_1, window_2_3);
- wt_client1()->WaitForChangeCount(2);
- EXPECT_EQ("AddTransientWindow parent = " + IdToString(window_2_1) +
- " child = " + IdToString(window_2_2),
- ChangesToDescription1(*changes1())[0]);
- EXPECT_EQ("AddTransientWindow parent = " + IdToString(window_2_1) +
- " child = " + IdToString(window_2_3),
- ChangesToDescription1(*changes1())[1]);
-
- changes1()->clear();
- wt2()->RemoveTransientWindowFromParent(12, window_2_3);
- wt_client1()->WaitForChangeCount(1);
- EXPECT_EQ("RemoveTransientWindowFromParent parent = " +
- IdToString(window_2_1) + " child = " + IdToString(window_2_3),
- SingleChangeToDescription(*changes1()));
-
- changes1()->clear();
- ASSERT_TRUE(wt_client2()->DeleteWindow(window_2_1));
- wt_client1()->WaitForChangeCount(2);
- EXPECT_EQ("WindowDeleted window=" + IdToString(window_2_2),
- ChangesToDescription1(*changes1())[0]);
- EXPECT_EQ("WindowDeleted window=" + IdToString(window_2_1),
- ChangesToDescription1(*changes1())[1]);
-}
-
-TEST_F(WindowTreeClientTest, Ids) {
- const Id window_1_100 = wt_client1()->NewWindow(100);
- ASSERT_TRUE(window_1_100);
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_100));
-
- // Establish the second client at 1,100.
- ASSERT_NO_FATAL_FAILURE(EstablishSecondClientWithRoot(window_1_100));
-
- // 1,100 is the id in the wt_client1's id space. The new client should see
- // 2,1 (the server id).
- const Id window_1_100_in_ws2 = BuildWindowId(client_id_1(), 1);
- EXPECT_EQ(window_1_100_in_ws2, wt_client2()->root_window_id());
-
- // The first window created in the second client gets a server id of 2,1
- // regardless of the id the client uses.
- const Id window_2_101 = wt_client2()->NewWindow(101);
- ASSERT_TRUE(wt_client2()->AddWindow(window_1_100_in_ws2, window_2_101));
- const Id window_2_101_in_ws1 = BuildWindowId(client_id_2(), 1);
- wt_client1()->WaitForChangeCount(1);
- EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_101_in_ws1) +
- " old_parent=null new_parent=" + IdToString(window_1_100),
- SingleChangeToDescription(*changes1()));
- changes1()->clear();
-
- // Change the bounds of window_2_101 and make sure server gets it.
- wt2()->SetWindowBounds(11, window_2_101, gfx::Rect(1, 2, 3, 4));
- ASSERT_TRUE(wt_client2()->WaitForChangeCompleted(11));
- wt_client1()->WaitForChangeCount(1);
- EXPECT_EQ("BoundsChanged window=" + IdToString(window_2_101_in_ws1) +
- " old_bounds=0,0 0x0 new_bounds=1,2 3x4",
- SingleChangeToDescription(*changes1()));
- changes2()->clear();
-
- // Remove 2_101 from wm, client1 should see the change.
- wt1()->RemoveWindowFromParent(12, window_2_101_in_ws1);
- ASSERT_TRUE(wt_client1()->WaitForChangeCompleted(12));
- wt_client2()->WaitForChangeCount(1);
- EXPECT_EQ("HierarchyChanged window=" + IdToString(window_2_101) +
- " old_parent=" + IdToString(window_1_100_in_ws2) +
- " new_parent=null",
- SingleChangeToDescription(*changes2()));
-}
-
-// Tests that setting capture fails when no input event has occurred, and there
-// is no notification of lost capture.
-TEST_F(WindowTreeClientTest, ExplicitCaptureWithoutInput) {
- Id window_1_1 = wt_client1()->NewWindow(1);
-
- // Add the window to the root, so that they have a Display to handle input
- // capture.
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- changes1()->clear();
-
- // Since there has been no input, capture should not succeed. No lost capture
- // message is expected.
- wt1()->SetCapture(1, window_1_1);
- wt_client1_->WaitForAllMessages();
- EXPECT_TRUE(changes1()->empty());
-
- // Since there is no window with capture, lost capture should not be notified.
- wt1()->ReleaseCapture(3, window_1_1);
- wt_client1_->WaitForAllMessages();
- EXPECT_TRUE(changes1()->empty());
-}
-
-// TODO(jonross): Enable this once apptests can send input events to the server.
-// Enabling capture requires that the client be processing events.
-TEST_F(WindowTreeClientTest, DISABLED_ExplicitCapturePropagation) {
- Id window_1_1 = wt_client1()->NewWindow(1);
- Id window_1_2 = wt_client1()->NewWindow(2);
-
- // Add the windows to the root, so that they have a Display to handle input
- // capture.
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_1));
- ASSERT_TRUE(wt_client1()->AddWindow(root_window_id(), window_1_2));
-
- changes1()->clear();
- // Window 1 takes capture then Window 2 takes capture.
- // Verify that window 1 has lost capture.
- wt1()->SetCapture(1, window_1_1);
- wt1()->SetCapture(2, window_1_2);
- wt_client1_->WaitForChangeCount(1);
-
- EXPECT_EQ("OnLostCapture window=" + IdToString(window_1_1),
- SingleChangeToDescription(*changes1()));
-
- changes1()->clear();
- // Explicitly releasing capture should not notify of lost capture.
- wt1()->ReleaseCapture(3, window_1_2);
- wt_client1_->WaitForAllMessages();
-
- EXPECT_TRUE(changes1()->empty());
-}
-
-// TODO(sky): need to better track changes to initial client. For example,
-// that SetBounsdWindows/AddWindow and the like don't result in messages to the
-// originating client.
-
-// TODO(sky): make sure coverage of what was
-// WindowManagerTest.SecondEmbedRoot_InitService and
-// WindowManagerTest.MultipleEmbedRootsBeforeWTHReady gets added to window
-// manager
-// tests.
-
-} // namespace test
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_tree_factory.cc b/chromium/components/mus/ws/window_tree_factory.cc
deleted file mode 100644
index c8befb724ab..00000000000
--- a/chromium/components/mus/ws/window_tree_factory.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_tree_factory.h"
-
-#include "base/memory/ptr_util.h"
-#include "components/mus/ws/default_access_policy.h"
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_tree.h"
-#include "components/mus/ws/window_tree_binding.h"
-
-namespace mus {
-namespace ws {
-
-WindowTreeFactory::WindowTreeFactory(WindowServer* window_server,
- const UserId& user_id,
- const std::string& client_name,
- mojom::WindowTreeFactoryRequest request)
- : window_server_(window_server),
- user_id_(user_id),
- client_name_(client_name),
- binding_(this, std::move(request)) {}
-
-WindowTreeFactory::~WindowTreeFactory() {}
-
-void WindowTreeFactory::CreateWindowTree(
- mojo::InterfaceRequest<mojom::WindowTree> tree_request,
- mojom::WindowTreeClientPtr client) {
- std::unique_ptr<ws::WindowTree> service(
- new ws::WindowTree(window_server_, user_id_, nullptr,
- base::WrapUnique(new DefaultAccessPolicy)));
- std::unique_ptr<ws::DefaultWindowTreeBinding> binding(
- new ws::DefaultWindowTreeBinding(service.get(), window_server_,
- std::move(tree_request),
- std::move(client)));
- service->set_name(client_name_);
- window_server_->AddTree(std::move(service), std::move(binding), nullptr);
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_tree_factory.h b/chromium/components/mus/ws/window_tree_factory.h
deleted file mode 100644
index 7a21ea94a23..00000000000
--- a/chromium/components/mus/ws/window_tree_factory.h
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_WINDOW_TREE_FACTORY_H_
-#define COMPONENTS_MUS_WS_WINDOW_TREE_FACTORY_H_
-
-#include "base/macros.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/ws/user_id.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-
-namespace mus {
-namespace ws {
-
-class WindowServer;
-
-class WindowTreeFactory : public mus::mojom::WindowTreeFactory {
- public:
- WindowTreeFactory(WindowServer* window_server,
- const UserId& user_id,
- const std::string& client_name,
- mojom::WindowTreeFactoryRequest request);
- private:
- ~WindowTreeFactory() override;
-
- // mus::mojom::WindowTreeFactory:
- void CreateWindowTree(mojo::InterfaceRequest<mojom::WindowTree> tree_request,
- mojom::WindowTreeClientPtr client) override;
-
- WindowServer* window_server_;
- const UserId user_id_;
- const std::string client_name_;
- mojo::StrongBinding<mus::mojom::WindowTreeFactory> binding_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowTreeFactory);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_WINDOW_TREE_FACTORY_H_
diff --git a/chromium/components/mus/ws/window_tree_host_factory.cc b/chromium/components/mus/ws/window_tree_host_factory.cc
deleted file mode 100644
index c5c6cbc208b..00000000000
--- a/chromium/components/mus/ws/window_tree_host_factory.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_tree_host_factory.h"
-
-#include "components/mus/gles2/gpu_state.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "components/mus/ws/display.h"
-#include "components/mus/ws/display_binding.h"
-#include "components/mus/ws/window_server.h"
-
-namespace mus {
-namespace ws {
-
-WindowTreeHostFactory::WindowTreeHostFactory(
- WindowServer* window_server,
- const UserId& user_id,
- const PlatformDisplayInitParams& platform_display_init_params)
- : window_server_(window_server),
- user_id_(user_id),
- platform_display_init_params_(platform_display_init_params) {}
-
-WindowTreeHostFactory::~WindowTreeHostFactory() {}
-
-void WindowTreeHostFactory::AddBinding(
- mojom::WindowTreeHostFactoryRequest request) {
- bindings_.AddBinding(this, std::move(request));
-}
-
-void WindowTreeHostFactory::CreateWindowTreeHost(
- mojom::WindowTreeHostRequest host,
- mojom::WindowTreeClientPtr tree_client) {
- Display* display = new Display(window_server_, platform_display_init_params_);
- std::unique_ptr<DisplayBindingImpl> display_binding(
- new DisplayBindingImpl(std::move(host), display, user_id_,
- std::move(tree_client), window_server_));
- display->Init(std::move(display_binding));
-}
-
-} // namespace ws
-} // namespace mus
diff --git a/chromium/components/mus/ws/window_tree_host_factory.h b/chromium/components/mus/ws/window_tree_host_factory.h
deleted file mode 100644
index 3df36ee7f85..00000000000
--- a/chromium/components/mus/ws/window_tree_host_factory.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef COMPONENTS_MUS_WS_WINDOW_TREE_HOST_FACTORY_H_
-#define COMPONENTS_MUS_WS_WINDOW_TREE_HOST_FACTORY_H_
-
-#include <stdint.h>
-
-#include "components/mus/public/interfaces/window_tree_host.mojom.h"
-#include "components/mus/ws/platform_display_init_params.h"
-#include "components/mus/ws/user_id.h"
-#include "mojo/public/cpp/bindings/binding_set.h"
-
-namespace mus {
-namespace ws {
-
-class WindowServer;
-
-class WindowTreeHostFactory : public mojom::WindowTreeHostFactory {
- public:
- WindowTreeHostFactory(
- WindowServer* window_server,
- const UserId& user_id,
- const PlatformDisplayInitParams& platform_display_init_params);
- ~WindowTreeHostFactory() override;
-
- void AddBinding(mojom::WindowTreeHostFactoryRequest request);
-
- private:
- // mojom::WindowTreeHostFactory implementation.
- void CreateWindowTreeHost(mojom::WindowTreeHostRequest host,
- mojom::WindowTreeClientPtr tree_client) override;
-
- WindowServer* window_server_;
- const UserId user_id_;
- const PlatformDisplayInitParams platform_display_init_params_;
- mojo::BindingSet<mojom::WindowTreeHostFactory> bindings_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowTreeHostFactory);
-};
-
-} // namespace ws
-} // namespace mus
-
-#endif // COMPONENTS_MUS_WS_WINDOW_TREE_HOST_FACTORY_H_
diff --git a/chromium/components/mus/ws/window_tree_unittest.cc b/chromium/components/mus/ws/window_tree_unittest.cc
deleted file mode 100644
index 15356763085..00000000000
--- a/chromium/components/mus/ws/window_tree_unittest.cc
+++ /dev/null
@@ -1,1017 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/mus/ws/window_tree.h"
-
-#include <stdint.h>
-
-#include <string>
-#include <vector>
-
-#include "base/macros.h"
-#include "base/memory/ptr_util.h"
-#include "base/strings/stringprintf.h"
-#include "components/mus/common/types.h"
-#include "components/mus/common/util.h"
-#include "components/mus/public/interfaces/window_tree.mojom.h"
-#include "components/mus/surfaces/surfaces_state.h"
-#include "components/mus/ws/default_access_policy.h"
-#include "components/mus/ws/display_binding.h"
-#include "components/mus/ws/ids.h"
-#include "components/mus/ws/platform_display.h"
-#include "components/mus/ws/platform_display_factory.h"
-#include "components/mus/ws/platform_display_init_params.h"
-#include "components/mus/ws/server_window.h"
-#include "components/mus/ws/server_window_surface_manager_test_api.h"
-#include "components/mus/ws/test_change_tracker.h"
-#include "components/mus/ws/test_server_window_delegate.h"
-#include "components/mus/ws/test_utils.h"
-#include "components/mus/ws/window_manager_access_policy.h"
-#include "components/mus/ws/window_manager_display_root.h"
-#include "components/mus/ws/window_server.h"
-#include "components/mus/ws/window_server_delegate.h"
-#include "components/mus/ws/window_tree_binding.h"
-#include "services/shell/public/interfaces/connector.mojom.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/events/event.h"
-#include "ui/events/event_utils.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace mus {
-namespace ws {
-namespace test {
-namespace {
-
-std::string WindowIdToString(const WindowId& id) {
- return base::StringPrintf("%d,%d", id.client_id, id.window_id);
-}
-
-ClientWindowId BuildClientWindowId(WindowTree* tree,
- ClientSpecificId window_id) {
- return ClientWindowId(WindowIdToTransportId(WindowId(tree->id(), window_id)));
-}
-
-// -----------------------------------------------------------------------------
-
-ui::PointerEvent CreatePointerDownEvent(int x, int y) {
- return ui::PointerEvent(ui::TouchEvent(ui::ET_TOUCH_PRESSED, gfx::Point(x, y),
- 1, ui::EventTimeForNow()));
-}
-
-ui::PointerEvent CreatePointerUpEvent(int x, int y) {
- return ui::PointerEvent(ui::TouchEvent(
- ui::ET_TOUCH_RELEASED, gfx::Point(x, y), 1, ui::EventTimeForNow()));
-}
-
-ui::PointerEvent CreateMouseMoveEvent(int x, int y) {
- return ui::PointerEvent(
- ui::MouseEvent(ui::ET_MOUSE_MOVED, gfx::Point(x, y), gfx::Point(x, y),
- ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE));
-}
-
-ui::PointerEvent CreateMouseDownEvent(int x, int y) {
- return ui::PointerEvent(
- ui::MouseEvent(ui::ET_MOUSE_PRESSED, gfx::Point(x, y), gfx::Point(x, y),
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON));
-}
-
-ui::PointerEvent CreateMouseUpEvent(int x, int y) {
- return ui::PointerEvent(
- ui::MouseEvent(ui::ET_MOUSE_RELEASED, gfx::Point(x, y), gfx::Point(x, y),
- ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON,
- ui::EF_LEFT_MOUSE_BUTTON));
-}
-
-ServerWindow* GetCaptureWindow(Display* display) {
- return display->GetActiveWindowManagerDisplayRoot()
- ->window_manager_state()
- ->capture_window();
-}
-
-mojom::EventMatcherPtr CreateEventMatcher(ui::mojom::EventType type) {
- mojom::EventMatcherPtr matcher = mojom::EventMatcher::New();
- matcher->type_matcher = mojom::EventTypeMatcher::New();
- matcher->type_matcher->type = type;
- return matcher;
-}
-
-} // namespace
-
-// -----------------------------------------------------------------------------
-
-class WindowTreeTest : public testing::Test {
- public:
- WindowTreeTest() {}
- ~WindowTreeTest() override {}
-
- mus::mojom::Cursor cursor_id() {
- return static_cast<mus::mojom::Cursor>(
- window_event_targeting_helper_.cursor_id());
- }
- Display* display() { return window_event_targeting_helper_.display(); }
- TestWindowTreeBinding* last_binding() {
- return window_event_targeting_helper_.last_binding();
- }
- TestWindowTreeClient* last_window_tree_client() {
- return window_event_targeting_helper_.last_window_tree_client();
- }
- TestWindowTreeClient* wm_client() {
- return window_event_targeting_helper_.wm_client();
- }
- WindowServer* window_server() {
- return window_event_targeting_helper_.window_server();
- }
- WindowTree* wm_tree() {
- return window_event_targeting_helper_.window_server()->GetTreeWithId(1);
- }
-
- void DispatchEventWithoutAck(const ui::Event& event) {
- DisplayTestApi(display()).OnEvent(event);
- }
-
- void set_window_manager_internal(WindowTree* tree,
- mojom::WindowManager* wm_internal) {
- WindowTreeTestApi(tree).set_window_manager_internal(wm_internal);
- }
-
- void AckPreviousEvent() {
- WindowManagerStateTestApi test_api(
- display()->GetActiveWindowManagerDisplayRoot()->window_manager_state());
- while (test_api.tree_awaiting_input_ack()) {
- test_api.tree_awaiting_input_ack()->OnWindowInputEventAck(
- 0, mojom::EventResult::HANDLED);
- }
- }
-
- void DispatchEventAndAckImmediately(const ui::Event& event) {
- DispatchEventWithoutAck(event);
- AckPreviousEvent();
- }
-
- // Creates a new window from wm_tree() and embeds a new client in it.
- void SetupEventTargeting(TestWindowTreeClient** out_client,
- WindowTree** window_tree,
- ServerWindow** window);
-
- // Creates a new tree as the specified user. This does what creation via
- // a WindowTreeFactory does.
- WindowTree* CreateNewTree(const UserId& user_id,
- TestWindowTreeBinding** binding) {
- WindowTree* tree =
- new WindowTree(window_server(), user_id, nullptr,
- base::WrapUnique(new DefaultAccessPolicy));
- *binding = new TestWindowTreeBinding(tree);
- window_server()->AddTree(base::WrapUnique(tree), base::WrapUnique(*binding),
- nullptr);
- return tree;
- }
-
- protected:
- WindowEventTargetingHelper window_event_targeting_helper_;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(WindowTreeTest);
-};
-
-// Creates a new window in wm_tree(), adds it to the root, embeds a
-// new client in the window and creates a child of said window. |window| is
-// set to the child of |window_tree| that is created.
-void WindowTreeTest::SetupEventTargeting(TestWindowTreeClient** out_client,
- WindowTree** window_tree,
- ServerWindow** window) {
- ServerWindow* embed_window = window_event_targeting_helper_.CreatePrimaryTree(
- gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 50, 50));
- window_event_targeting_helper_.CreateSecondaryTree(
- embed_window, gfx::Rect(20, 20, 20, 20), out_client, window_tree, window);
-}
-
-// Verifies focus correctly changes on pointer events.
-TEST_F(WindowTreeTest, FocusOnPointer) {
- const ClientWindowId embed_window_id = BuildClientWindowId(wm_tree(), 1);
- EXPECT_TRUE(
- wm_tree()->NewWindow(embed_window_id, ServerWindow::Properties()));
- ServerWindow* embed_window = wm_tree()->GetWindowByClientId(embed_window_id);
- ASSERT_TRUE(embed_window);
- EXPECT_TRUE(wm_tree()->SetWindowVisibility(embed_window_id, true));
- ASSERT_TRUE(FirstRoot(wm_tree()));
- const ClientWindowId wm_root_id = FirstRootId(wm_tree());
- EXPECT_TRUE(wm_tree()->AddWindow(wm_root_id, embed_window_id));
- display()->root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
- mojom::WindowTreeClientPtr client;
- mojom::WindowTreeClientRequest client_request = GetProxy(&client);
- wm_client()->Bind(std::move(client_request));
- const uint32_t embed_flags = 0;
- wm_tree()->Embed(embed_window_id, std::move(client), embed_flags);
- WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window);
- ASSERT_TRUE(tree1 != nullptr);
- ASSERT_NE(tree1, wm_tree());
-
- embed_window->SetBounds(gfx::Rect(0, 0, 50, 50));
-
- const ClientWindowId child1_id(BuildClientWindowId(tree1, 1));
- EXPECT_TRUE(tree1->NewWindow(child1_id, ServerWindow::Properties()));
- EXPECT_TRUE(tree1->AddWindow(ClientWindowIdForWindow(tree1, embed_window),
- child1_id));
- ServerWindow* child1 = tree1->GetWindowByClientId(child1_id);
- ASSERT_TRUE(child1);
- child1->SetVisible(true);
- child1->SetBounds(gfx::Rect(20, 20, 20, 20));
- EnableHitTest(child1);
-
- TestWindowTreeClient* tree1_client = last_window_tree_client();
- tree1_client->tracker()->changes()->clear();
- wm_client()->tracker()->changes()->clear();
-
- // Focus should not go to |child1| yet, since the parent still doesn't allow
- // active children.
- DispatchEventAndAckImmediately(CreatePointerDownEvent(21, 22));
- Display* display1 = tree1->GetDisplay(embed_window);
- EXPECT_EQ(nullptr, display1->GetFocusedWindow());
- DispatchEventAndAckImmediately(CreatePointerUpEvent(21, 22));
- tree1_client->tracker()->changes()->clear();
- wm_client()->tracker()->changes()->clear();
-
- display1->AddActivationParent(embed_window);
-
- // Focus should go to child1. This result in notifying both the window
- // manager and client client being notified.
- DispatchEventAndAckImmediately(CreatePointerDownEvent(21, 22));
- EXPECT_EQ(child1, display1->GetFocusedWindow());
- ASSERT_GE(wm_client()->tracker()->changes()->size(), 1u);
- EXPECT_EQ("Focused id=2,1",
- ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
- ASSERT_GE(tree1_client->tracker()->changes()->size(), 1u);
- EXPECT_EQ("Focused id=2,1",
- ChangesToDescription1(*tree1_client->tracker()->changes())[0]);
-
- DispatchEventAndAckImmediately(CreatePointerUpEvent(21, 22));
- wm_client()->tracker()->changes()->clear();
- tree1_client->tracker()->changes()->clear();
-
- // Press outside of the embedded window. Note that root cannot be focused
- // (because it cannot be activated). So the focus would not move in this case.
- DispatchEventAndAckImmediately(CreatePointerDownEvent(61, 22));
- EXPECT_EQ(child1, display()->GetFocusedWindow());
-
- DispatchEventAndAckImmediately(CreatePointerUpEvent(21, 22));
- wm_client()->tracker()->changes()->clear();
- tree1_client->tracker()->changes()->clear();
-
- // Press in the same location. Should not get a focus change event (only input
- // event).
- DispatchEventAndAckImmediately(CreatePointerDownEvent(61, 22));
- EXPECT_EQ(child1, display()->GetFocusedWindow());
- ASSERT_EQ(wm_client()->tracker()->changes()->size(), 1u)
- << SingleChangeToDescription(*wm_client()->tracker()->changes());
- EXPECT_EQ("InputEvent window=0,3 event_action=16",
- ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
- EXPECT_TRUE(tree1_client->tracker()->changes()->empty());
-}
-
-TEST_F(WindowTreeTest, BasicInputEventTarget) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* window = nullptr;
- EXPECT_NO_FATAL_FAILURE(
- SetupEventTargeting(&embed_client, &tree, &window));
-
- // Send an event to |v1|. |embed_client| should get the event, not
- // |wm_client|, since |v1| lives inside an embedded window.
- DispatchEventAndAckImmediately(CreatePointerDownEvent(21, 22));
- ASSERT_EQ(1u, wm_client()->tracker()->changes()->size());
- EXPECT_EQ("Focused id=2,1",
- ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
- ASSERT_EQ(2u, embed_client->tracker()->changes()->size());
- EXPECT_EQ("Focused id=2,1",
- ChangesToDescription1(*embed_client->tracker()->changes())[0]);
- EXPECT_EQ("InputEvent window=2,1 event_action=16",
- ChangesToDescription1(*embed_client->tracker()->changes())[1]);
-}
-
-// Tests that a client can observe events outside its bounds.
-TEST_F(WindowTreeTest, SetEventObserver) {
- // Create an embedded client.
- TestWindowTreeClient* client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* window = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&client, &tree, &window));
-
- // Create an event outside the bounds of the client.
- ui::PointerEvent pointer_down = CreatePointerDownEvent(5, 5);
-
- // Events are not observed before setting an observer.
- DispatchEventAndAckImmediately(pointer_down);
- ASSERT_EQ(0u, client->tracker()->changes()->size());
-
- // Create an observer for pointer-down events.
- WindowTreeTestApi(tree).SetEventObserver(
- CreateEventMatcher(ui::mojom::EventType::POINTER_DOWN), 111u);
-
- // Pointer-down events are sent to the client.
- DispatchEventAndAckImmediately(pointer_down);
- ASSERT_EQ(1u, client->tracker()->changes()->size());
- EXPECT_EQ("EventObserved event_action=16 event_observer_id=111",
- ChangesToDescription1(*client->tracker()->changes())[0]);
- client->tracker()->changes()->clear();
-
- // Clearing the observer stops sending events to the client.
- WindowTreeTestApi(tree).SetEventObserver(nullptr, 0u);
- DispatchEventAndAckImmediately(pointer_down);
- ASSERT_EQ(0u, client->tracker()->changes()->size());
-}
-
-// Tests that a client using an event observer does not receive events that
-// don't match the EventMatcher spec.
-TEST_F(WindowTreeTest, SetEventObserverNonMatching) {
- // Create an embedded client.
- TestWindowTreeClient* client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* window = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&client, &tree, &window));
-
- // Create an observer for pointer-down events.
- WindowTreeTestApi(tree).SetEventObserver(
- CreateEventMatcher(ui::mojom::EventType::POINTER_DOWN), 111u);
-
- // Pointer-up events are not sent to the client, since they don't match.
- DispatchEventAndAckImmediately(CreatePointerUpEvent(5, 5));
- ASSERT_EQ(0u, client->tracker()->changes()->size());
-}
-
-// Tests that an event that both hits a client window and matches an event
-// observer is sent only once to the client.
-TEST_F(WindowTreeTest, SetEventObserverSendsOnce) {
- // Create an embedded client.
- TestWindowTreeClient* client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* window = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&client, &tree, &window));
-
- // Create an observer for pointer-up events (which do not cause focus
- // changes).
- WindowTreeTestApi(tree).SetEventObserver(
- CreateEventMatcher(ui::mojom::EventType::POINTER_UP), 111u);
-
- // Create an event inside the bounds of the client.
- ui::PointerEvent pointer_up = CreatePointerUpEvent(25, 25);
-
- // The event is dispatched once, with a flag set that it matched the event
- // observer.
- DispatchEventAndAckImmediately(pointer_up);
- ASSERT_EQ(1u, client->tracker()->changes()->size());
- EXPECT_EQ("InputEvent window=2,1 event_action=18 event_observer_id=111",
- SingleChangeToDescription(*client->tracker()->changes()));
-}
-
-// Tests that events generated by user A are not observed by event observers for
-// user B.
-TEST_F(WindowTreeTest, SetEventObserverWrongUser) {
- // Embed a window tree belonging to a different user.
- TestWindowTreeBinding* other_binding;
- WindowTree* other_tree = CreateNewTree("other_user", &other_binding);
- other_binding->client()->tracker()->changes()->clear();
-
- // Set event observers on both the wm tree and the other user's tree.
- WindowTreeTestApi(wm_tree()).SetEventObserver(
- CreateEventMatcher(ui::mojom::EventType::POINTER_UP), 111u);
- WindowTreeTestApi(other_tree)
- .SetEventObserver(CreateEventMatcher(ui::mojom::EventType::POINTER_UP),
- 222u);
-
- // An event is observed by the wm tree, but not by the other user's tree.
- DispatchEventAndAckImmediately(CreatePointerUpEvent(5, 5));
- ASSERT_EQ(1u, wm_client()->tracker()->changes()->size());
- EXPECT_EQ("InputEvent window=0,3 event_action=18 event_observer_id=111",
- SingleChangeToDescription(*wm_client()->tracker()->changes()));
- ASSERT_EQ(0u, other_binding->client()->tracker()->changes()->size());
-}
-
-// Tests that an event observer cannot observe keystrokes.
-TEST_F(WindowTreeTest, SetEventObserverKeyEventsDisallowed) {
- WindowTreeTestApi(wm_tree()).SetEventObserver(
- CreateEventMatcher(ui::mojom::EventType::KEY_PRESSED), 111u);
- ui::KeyEvent key_pressed(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE);
- DispatchEventAndAckImmediately(key_pressed);
- EXPECT_EQ(0u, wm_client()->tracker()->changes()->size());
-
- WindowTreeTestApi(wm_tree()).SetEventObserver(
- CreateEventMatcher(ui::mojom::EventType::KEY_RELEASED), 222u);
- ui::KeyEvent key_released(ui::ET_KEY_RELEASED, ui::VKEY_A, ui::EF_NONE);
- DispatchEventAndAckImmediately(key_released);
- EXPECT_EQ(0u, wm_client()->tracker()->changes()->size());
-}
-
-TEST_F(WindowTreeTest, CursorChangesWhenMouseOverWindowAndWindowSetsCursor) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* window = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &window));
-
- // Like in BasicInputEventTarget, we send a pointer down event to be
- // dispatched. This is only to place the mouse cursor over that window though.
- DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22));
-
- window->SetPredefinedCursor(mojom::Cursor::IBEAM);
-
- // Because the cursor is over the window when SetCursor was called, we should
- // have immediately changed the cursor.
- EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id());
-}
-
-TEST_F(WindowTreeTest, CursorChangesWhenEnteringWindowWithDifferentCursor) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* window = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &window));
-
- // Let's create a pointer event outside the window and then move the pointer
- // inside.
- DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
- window->SetPredefinedCursor(mojom::Cursor::IBEAM);
- EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
-
- DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22));
- EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id());
-}
-
-TEST_F(WindowTreeTest, TouchesDontChangeCursor) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* window = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &window));
-
- // Let's create a pointer event outside the window and then move the pointer
- // inside.
- DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
- window->SetPredefinedCursor(mojom::Cursor::IBEAM);
- EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
-
- // With a touch event, we shouldn't update the cursor.
- DispatchEventAndAckImmediately(CreatePointerDownEvent(21, 22));
- EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
-}
-
-TEST_F(WindowTreeTest, DragOutsideWindow) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* window = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &window));
-
- // Start with the cursor outside the window. Setting the cursor shouldn't
- // change the cursor.
- DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
- window->SetPredefinedCursor(mojom::Cursor::IBEAM);
- EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
-
- // Move the pointer to the inside of the window
- DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22));
- EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id());
-
- // Start the drag.
- DispatchEventAndAckImmediately(CreateMouseDownEvent(21, 22));
- EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id());
-
- // Move the cursor (mouse is still down) outside the window.
- DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
- EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id());
-
- // Release the cursor. We should now adapt the cursor of the window
- // underneath the pointer.
- DispatchEventAndAckImmediately(CreateMouseUpEvent(5, 5));
- EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
-}
-
-TEST_F(WindowTreeTest, ChangingWindowBoundsChangesCursor) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* window = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &window));
-
- // Put the cursor just outside the bounds of the window.
- DispatchEventAndAckImmediately(CreateMouseMoveEvent(41, 41));
- window->SetPredefinedCursor(mojom::Cursor::IBEAM);
- EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
-
- // Expand the bounds of the window so they now include where the cursor now
- // is.
- window->SetBounds(gfx::Rect(20, 20, 25, 25));
- EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id());
-
- // Contract the bounds again.
- window->SetBounds(gfx::Rect(20, 20, 20, 20));
- EXPECT_EQ(mojom::Cursor::CURSOR_NULL, cursor_id());
-}
-
-TEST_F(WindowTreeTest, WindowReorderingChangesCursor) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* window1 = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &window1));
-
- // Create a second window right over the first.
- const ClientWindowId embed_window_id(FirstRootId(tree));
- const ClientWindowId child2_id(BuildClientWindowId(tree, 2));
- EXPECT_TRUE(tree->NewWindow(child2_id, ServerWindow::Properties()));
- ServerWindow* child2 = tree->GetWindowByClientId(child2_id);
- ASSERT_TRUE(child2);
- EXPECT_TRUE(tree->AddWindow(embed_window_id, child2_id));
- child2->SetVisible(true);
- child2->SetBounds(gfx::Rect(20, 20, 20, 20));
- EnableHitTest(child2);
-
- // Give each window a different cursor.
- window1->SetPredefinedCursor(mojom::Cursor::IBEAM);
- child2->SetPredefinedCursor(mojom::Cursor::HAND);
-
- // We expect window2 to be over window1 now.
- DispatchEventAndAckImmediately(CreateMouseMoveEvent(22, 22));
- EXPECT_EQ(mojom::Cursor::HAND, cursor_id());
-
- // But when we put window2 at the bottom, we should adapt window1's cursor.
- child2->parent()->StackChildAtBottom(child2);
- EXPECT_EQ(mojom::Cursor::IBEAM, cursor_id());
-}
-
-TEST_F(WindowTreeTest, EventAck) {
- const ClientWindowId embed_window_id = BuildClientWindowId(wm_tree(), 1);
- EXPECT_TRUE(
- wm_tree()->NewWindow(embed_window_id, ServerWindow::Properties()));
- EXPECT_TRUE(wm_tree()->SetWindowVisibility(embed_window_id, true));
- ASSERT_TRUE(FirstRoot(wm_tree()));
- EXPECT_TRUE(wm_tree()->AddWindow(FirstRootId(wm_tree()), embed_window_id));
- display()->root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
-
- wm_client()->tracker()->changes()->clear();
- DispatchEventWithoutAck(CreateMouseMoveEvent(21, 22));
- ASSERT_EQ(1u, wm_client()->tracker()->changes()->size());
- EXPECT_EQ("InputEvent window=0,3 event_action=17",
- ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
- wm_client()->tracker()->changes()->clear();
-
- // Send another event. This event shouldn't reach the client.
- DispatchEventWithoutAck(CreateMouseMoveEvent(21, 22));
- ASSERT_EQ(0u, wm_client()->tracker()->changes()->size());
-
- // Ack the first event. That should trigger the dispatch of the second event.
- AckPreviousEvent();
- ASSERT_EQ(1u, wm_client()->tracker()->changes()->size());
- EXPECT_EQ("InputEvent window=0,3 event_action=17",
- ChangesToDescription1(*wm_client()->tracker()->changes())[0]);
-}
-
-// Establish client, call NewTopLevelWindow(), make sure get id, and make
-// sure client paused.
-TEST_F(WindowTreeTest, NewTopLevelWindow) {
- TestWindowManager wm_internal;
- set_window_manager_internal(wm_tree(), &wm_internal);
-
- TestWindowTreeBinding* child_binding;
- WindowTree* child_tree = CreateNewTree(wm_tree()->user_id(), &child_binding);
- child_binding->client()->tracker()->changes()->clear();
- child_binding->client()->set_record_on_change_completed(true);
-
- // Create a new top level window.
- mojo::Map<mojo::String, mojo::Array<uint8_t>> properties;
- const uint32_t initial_change_id = 17;
- // Explicitly use an id that does not contain the client id.
- const ClientWindowId embed_window_id2_in_child(45 << 16 | 27);
- static_cast<mojom::WindowTree*>(child_tree)
- ->NewTopLevelWindow(initial_change_id, embed_window_id2_in_child.id,
- std::move(properties));
-
- // The binding should be paused until the wm acks the change.
- uint32_t wm_change_id = 0u;
- ASSERT_TRUE(wm_internal.did_call_create_top_level_window(&wm_change_id));
- EXPECT_TRUE(child_binding->is_paused());
-
- // Create the window for |embed_window_id2_in_child|.
- const ClientWindowId embed_window_id2 = BuildClientWindowId(wm_tree(), 2);
- EXPECT_TRUE(
- wm_tree()->NewWindow(embed_window_id2, ServerWindow::Properties()));
- EXPECT_TRUE(wm_tree()->SetWindowVisibility(embed_window_id2, true));
- EXPECT_TRUE(wm_tree()->AddWindow(FirstRootId(wm_tree()), embed_window_id2));
-
- // Ack the change, which should resume the binding.
- child_binding->client()->tracker()->changes()->clear();
- static_cast<mojom::WindowManagerClient*>(wm_tree())
- ->OnWmCreatedTopLevelWindow(wm_change_id, embed_window_id2.id);
- EXPECT_FALSE(child_binding->is_paused());
- EXPECT_EQ("TopLevelCreated id=17 window_id=" +
- WindowIdToString(
- WindowIdFromTransportId(embed_window_id2_in_child.id)) +
- " drawn=true",
- SingleChangeToDescription(
- *child_binding->client()->tracker()->changes()));
- child_binding->client()->tracker()->changes()->clear();
-
- // Change the visibility of the window from the owner and make sure the
- // client sees the right id.
- ServerWindow* embed_window = wm_tree()->GetWindowByClientId(embed_window_id2);
- ASSERT_TRUE(embed_window);
- EXPECT_TRUE(embed_window->visible());
- ASSERT_TRUE(wm_tree()->SetWindowVisibility(
- ClientWindowIdForWindow(wm_tree(), embed_window), false));
- EXPECT_FALSE(embed_window->visible());
- EXPECT_EQ("VisibilityChanged window=" +
- WindowIdToString(
- WindowIdFromTransportId(embed_window_id2_in_child.id)) +
- " visible=false",
- SingleChangeToDescription(
- *child_binding->client()->tracker()->changes()));
-
- // Set the visibility from the child using the client assigned id.
- ASSERT_TRUE(child_tree->SetWindowVisibility(embed_window_id2_in_child, true));
- EXPECT_TRUE(embed_window->visible());
-}
-
-// Tests that only the capture window can release capture.
-TEST_F(WindowTreeTest, ExplicitSetCapture) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* window = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &window));
- const ServerWindow* root_window = *tree->roots().begin();
- tree->AddWindow(FirstRootId(tree), ClientWindowIdForWindow(tree, window));
- window->SetBounds(gfx::Rect(0, 0, 100, 100));
- ASSERT_TRUE(tree->GetDisplay(window));
-
- // Set capture.
- mojom::WindowTree* mojom_window_tree = static_cast<mojom::WindowTree*>(tree);
- uint32_t change_id = 42;
- mojom_window_tree->SetCapture(change_id, WindowIdToTransportId(window->id()));
- Display* display = tree->GetDisplay(window);
- EXPECT_EQ(window, GetCaptureWindow(display));
-
- // Only the capture window should be able to release capture
- mojom_window_tree->ReleaseCapture(++change_id,
- WindowIdToTransportId(root_window->id()));
- EXPECT_EQ(window, GetCaptureWindow(display));
- mojom_window_tree->ReleaseCapture(++change_id,
- WindowIdToTransportId(window->id()));
- EXPECT_EQ(nullptr, GetCaptureWindow(display));
-}
-
-// Tests that while a client is interacting with input, that capture is not
-// allowed for invisible windows.
-TEST_F(WindowTreeTest, CaptureWindowMustBeVisible) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* window = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &window));
- tree->AddWindow(FirstRootId(tree), ClientWindowIdForWindow(tree, window));
- window->SetBounds(gfx::Rect(0, 0, 100, 100));
- ASSERT_TRUE(tree->GetDisplay(window));
-
- DispatchEventWithoutAck(CreatePointerDownEvent(10, 10));
- window->SetVisible(false);
- EXPECT_FALSE(tree->SetCapture(ClientWindowIdForWindow(tree, window)));
- EXPECT_NE(window, GetCaptureWindow(tree->GetDisplay(window)));
-}
-
-// Tests that showing a modal window releases the capture if the capture is on a
-// descendant of the modal parent.
-TEST_F(WindowTreeTest, ShowModalWindowWithDescendantCapture) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* w1 = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &w1));
-
- w1->SetBounds(gfx::Rect(10, 10, 30, 30));
- const ServerWindow* root_window = *tree->roots().begin();
- ClientWindowId root_window_id = ClientWindowIdForWindow(tree, root_window);
- ClientWindowId w1_id = ClientWindowIdForWindow(tree, w1);
- Display* display = tree->GetDisplay(w1);
-
- // Create |w11| as a child of |w1| and make it visible.
- ClientWindowId w11_id = BuildClientWindowId(tree, 11);
- ASSERT_TRUE(tree->NewWindow(w11_id, ServerWindow::Properties()));
- ServerWindow* w11 = tree->GetWindowByClientId(w11_id);
- w11->SetBounds(gfx::Rect(10, 10, 10, 10));
- ASSERT_TRUE(tree->AddWindow(w1_id, w11_id));
- ASSERT_TRUE(tree->SetWindowVisibility(w11_id, true));
-
- // Create |w2| as a child of |root_window| and modal to |w1| and leave it
- // hidden.
- ClientWindowId w2_id = BuildClientWindowId(tree, 2);
- ASSERT_TRUE(tree->NewWindow(w2_id, ServerWindow::Properties()));
- ServerWindow* w2 = tree->GetWindowByClientId(w2_id);
- w2->SetBounds(gfx::Rect(50, 10, 10, 10));
- ASSERT_TRUE(tree->AddWindow(root_window_id, w2_id));
- ASSERT_TRUE(tree->AddTransientWindow(w1_id, w2_id));
- ASSERT_TRUE(tree->SetModal(w2_id));
-
- // Set capture to |w11|.
- DispatchEventWithoutAck(CreatePointerDownEvent(25, 25));
- ASSERT_TRUE(tree->SetCapture(w11_id));
- EXPECT_EQ(w11, GetCaptureWindow(display));
- AckPreviousEvent();
-
- // Make |w2| visible. This should release capture as capture is set to a
- // descendant of the modal parent.
- ASSERT_TRUE(tree->SetWindowVisibility(w2_id, true));
- EXPECT_EQ(nullptr, GetCaptureWindow(display));
-}
-
-// Tests that setting a visible window as modal releases the capture if the
-// capture is on a descendant of the modal parent.
-TEST_F(WindowTreeTest, VisibleWindowToModalWithDescendantCapture) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* w1 = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &w1));
-
- w1->SetBounds(gfx::Rect(10, 10, 30, 30));
- const ServerWindow* root_window = *tree->roots().begin();
- ClientWindowId root_window_id = ClientWindowIdForWindow(tree, root_window);
- ClientWindowId w1_id = ClientWindowIdForWindow(tree, w1);
- Display* display = tree->GetDisplay(w1);
-
- // Create |w11| as a child of |w1| and make it visible.
- ClientWindowId w11_id = BuildClientWindowId(tree, 11);
- ASSERT_TRUE(tree->NewWindow(w11_id, ServerWindow::Properties()));
- ServerWindow* w11 = tree->GetWindowByClientId(w11_id);
- w11->SetBounds(gfx::Rect(10, 10, 10, 10));
- ASSERT_TRUE(tree->AddWindow(w1_id, w11_id));
- ASSERT_TRUE(tree->SetWindowVisibility(w11_id, true));
-
- // Create |w2| as a child of |root_window| and make it visible.
- ClientWindowId w2_id = BuildClientWindowId(tree, 2);
- ASSERT_TRUE(tree->NewWindow(w2_id, ServerWindow::Properties()));
- ServerWindow* w2 = tree->GetWindowByClientId(w2_id);
- w2->SetBounds(gfx::Rect(50, 10, 10, 10));
- ASSERT_TRUE(tree->AddWindow(root_window_id, w2_id));
- ASSERT_TRUE(tree->SetWindowVisibility(w2_id, true));
-
- // Set capture to |w11|.
- DispatchEventWithoutAck(CreatePointerDownEvent(25, 25));
- ASSERT_TRUE(tree->SetCapture(w11_id));
- EXPECT_EQ(w11, GetCaptureWindow(display));
- AckPreviousEvent();
-
- // Set |w2| modal to |w1|. This should release the capture as the capture is
- // set to a descendant of the modal parent.
- ASSERT_TRUE(tree->AddTransientWindow(w1_id, w2_id));
- ASSERT_TRUE(tree->SetModal(w2_id));
- EXPECT_EQ(nullptr, GetCaptureWindow(display));
-}
-
-// Tests that showing a modal window does not change capture if the capture is
-// not on a descendant of the modal parent.
-TEST_F(WindowTreeTest, ShowModalWindowWithNonDescendantCapture) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* w1 = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &w1));
-
- w1->SetBounds(gfx::Rect(10, 10, 30, 30));
- const ServerWindow* root_window = *tree->roots().begin();
- ClientWindowId root_window_id = ClientWindowIdForWindow(tree, root_window);
- ClientWindowId w1_id = ClientWindowIdForWindow(tree, w1);
- Display* display = tree->GetDisplay(w1);
-
- // Create |w2| as a child of |root_window| and modal to |w1| and leave it
- // hidden..
- ClientWindowId w2_id = BuildClientWindowId(tree, 2);
- ASSERT_TRUE(tree->NewWindow(w2_id, ServerWindow::Properties()));
- ServerWindow* w2 = tree->GetWindowByClientId(w2_id);
- w2->SetBounds(gfx::Rect(50, 10, 10, 10));
- ASSERT_TRUE(tree->AddWindow(root_window_id, w2_id));
- ASSERT_TRUE(tree->AddTransientWindow(w1_id, w2_id));
- ASSERT_TRUE(tree->SetModal(w2_id));
-
- // Create |w3| as a child of |root_window| and make it visible.
- ClientWindowId w3_id = BuildClientWindowId(tree, 3);
- ASSERT_TRUE(tree->NewWindow(w3_id, ServerWindow::Properties()));
- ServerWindow* w3 = tree->GetWindowByClientId(w3_id);
- w3->SetBounds(gfx::Rect(70, 10, 10, 10));
- ASSERT_TRUE(tree->AddWindow(root_window_id, w3_id));
- ASSERT_TRUE(tree->SetWindowVisibility(w3_id, true));
-
- // Set capture to |w3|.
- DispatchEventWithoutAck(CreatePointerDownEvent(25, 25));
- ASSERT_TRUE(tree->SetCapture(w3_id));
- EXPECT_EQ(w3, GetCaptureWindow(display));
- AckPreviousEvent();
-
- // Make |w2| visible. This should not change the capture as the capture is not
- // set to a descendant of the modal parent.
- ASSERT_TRUE(tree->SetWindowVisibility(w2_id, true));
- EXPECT_EQ(w3, GetCaptureWindow(display));
-}
-
-// Tests that setting a visible window as modal does not change the capture if
-// the capture is not set to a descendant of the modal parent.
-TEST_F(WindowTreeTest, VisibleWindowToModalWithNonDescendantCapture) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* w1 = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &w1));
-
- w1->SetBounds(gfx::Rect(10, 10, 30, 30));
- const ServerWindow* root_window = *tree->roots().begin();
- ClientWindowId root_window_id = ClientWindowIdForWindow(tree, root_window);
- ClientWindowId w1_id = ClientWindowIdForWindow(tree, w1);
- Display* display = tree->GetDisplay(w1);
-
- // Create |w2| and |w3| as children of |root_window| and make them visible.
- ClientWindowId w2_id = BuildClientWindowId(tree, 2);
- ASSERT_TRUE(tree->NewWindow(w2_id, ServerWindow::Properties()));
- ServerWindow* w2 = tree->GetWindowByClientId(w2_id);
- w2->SetBounds(gfx::Rect(50, 10, 10, 10));
- ASSERT_TRUE(tree->AddWindow(root_window_id, w2_id));
- ASSERT_TRUE(tree->SetWindowVisibility(w2_id, true));
-
- ClientWindowId w3_id = BuildClientWindowId(tree, 3);
- ASSERT_TRUE(tree->NewWindow(w3_id, ServerWindow::Properties()));
- ServerWindow* w3 = tree->GetWindowByClientId(w3_id);
- w3->SetBounds(gfx::Rect(70, 10, 10, 10));
- ASSERT_TRUE(tree->AddWindow(root_window_id, w3_id));
- ASSERT_TRUE(tree->SetWindowVisibility(w3_id, true));
-
- // Set capture to |w3|.
- DispatchEventWithoutAck(CreatePointerDownEvent(25, 25));
- ASSERT_TRUE(tree->SetCapture(w3_id));
- EXPECT_EQ(w3, GetCaptureWindow(display));
- AckPreviousEvent();
-
- // Set |w2| modal to |w1|. This should not release the capture as the capture
- // is not set to a descendant of the modal parent.
- ASSERT_TRUE(tree->AddTransientWindow(w1_id, w2_id));
- ASSERT_TRUE(tree->SetModal(w2_id));
- EXPECT_EQ(w3, GetCaptureWindow(display));
-}
-
-// Tests that showing a system modal window releases the capture.
-TEST_F(WindowTreeTest, ShowSystemModalWindowWithCapture) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* w1 = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &w1));
-
- w1->SetBounds(gfx::Rect(10, 10, 10, 10));
- const ServerWindow* root_window = *tree->roots().begin();
- ClientWindowId root_window_id = ClientWindowIdForWindow(tree, root_window);
- ClientWindowId w1_id = ClientWindowIdForWindow(tree, w1);
- Display* display = tree->GetDisplay(w1);
-
- // Create a system modal window |w2| as a child of |root_window| and leave it
- // hidden.
- ClientWindowId w2_id = BuildClientWindowId(tree, 2);
- ASSERT_TRUE(tree->NewWindow(w2_id, ServerWindow::Properties()));
- ServerWindow* w2 = tree->GetWindowByClientId(w2_id);
- w2->SetBounds(gfx::Rect(30, 10, 10, 10));
- ASSERT_TRUE(tree->AddWindow(root_window_id, w2_id));
- ASSERT_TRUE(tree->SetModal(w2_id));
-
- // Set capture to |w1|.
- DispatchEventWithoutAck(CreatePointerDownEvent(15, 15));
- ASSERT_TRUE(tree->SetCapture(w1_id));
- EXPECT_EQ(w1, GetCaptureWindow(display));
- AckPreviousEvent();
-
- // Make |w2| visible. This should release capture as it is system modal
- // window.
- ASSERT_TRUE(tree->SetWindowVisibility(w2_id, true));
- EXPECT_EQ(nullptr, GetCaptureWindow(display));
-}
-
-// Tests that setting a visible window as modal to system releases the capture.
-TEST_F(WindowTreeTest, VisibleWindowToSystemModalWithCapture) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* w1 = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &w1));
-
- w1->SetBounds(gfx::Rect(10, 10, 10, 10));
- const ServerWindow* root_window = *tree->roots().begin();
- ClientWindowId root_window_id = ClientWindowIdForWindow(tree, root_window);
- ClientWindowId w1_id = ClientWindowIdForWindow(tree, w1);
- Display* display = tree->GetDisplay(w1);
-
- // Create |w2| as a child of |root_window| and make it visible.
- ClientWindowId w2_id = BuildClientWindowId(tree, 2);
- ASSERT_TRUE(tree->NewWindow(w2_id, ServerWindow::Properties()));
- ServerWindow* w2 = tree->GetWindowByClientId(w2_id);
- w2->SetBounds(gfx::Rect(30, 10, 10, 10));
- ASSERT_TRUE(tree->AddWindow(root_window_id, w2_id));
- ASSERT_TRUE(tree->SetWindowVisibility(w2_id, true));
-
- // Set capture to |w1|.
- DispatchEventWithoutAck(CreatePointerDownEvent(15, 15));
- ASSERT_TRUE(tree->SetCapture(w1_id));
- EXPECT_EQ(w1, GetCaptureWindow(display));
- AckPreviousEvent();
-
- // Make |w2| modal to system. This should release capture.
- ASSERT_TRUE(tree->SetModal(w2_id));
- EXPECT_EQ(nullptr, GetCaptureWindow(display));
-}
-
-// Tests that moving the capture window to a modal parent releases the capture
-// as capture cannot be blocked by a modal window.
-TEST_F(WindowTreeTest, MoveCaptureWindowToModalParent) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* w1 = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &w1));
-
- w1->SetBounds(gfx::Rect(10, 10, 30, 30));
- const ServerWindow* root_window = *tree->roots().begin();
- ClientWindowId root_window_id = ClientWindowIdForWindow(tree, root_window);
- ClientWindowId w1_id = ClientWindowIdForWindow(tree, w1);
- Display* display = tree->GetDisplay(w1);
-
- // Create |w2| and |w3| as children of |root_window| and make them visible.
- ClientWindowId w2_id = BuildClientWindowId(tree, 2);
- ASSERT_TRUE(tree->NewWindow(w2_id, ServerWindow::Properties()));
- ServerWindow* w2 = tree->GetWindowByClientId(w2_id);
- w2->SetBounds(gfx::Rect(50, 10, 10, 10));
- ASSERT_TRUE(tree->AddWindow(root_window_id, w2_id));
- ASSERT_TRUE(tree->SetWindowVisibility(w2_id, true));
-
- ClientWindowId w3_id = BuildClientWindowId(tree, 3);
- ASSERT_TRUE(tree->NewWindow(w3_id, ServerWindow::Properties()));
- ServerWindow* w3 = tree->GetWindowByClientId(w3_id);
- w3->SetBounds(gfx::Rect(70, 10, 10, 10));
- ASSERT_TRUE(tree->AddWindow(root_window_id, w3_id));
- ASSERT_TRUE(tree->SetWindowVisibility(w3_id, true));
-
- // Set |w2| modal to |w1|.
- ASSERT_TRUE(tree->AddTransientWindow(w1_id, w2_id));
- ASSERT_TRUE(tree->SetModal(w2_id));
-
- // Set capture to |w3|.
- DispatchEventWithoutAck(CreatePointerDownEvent(25, 25));
- ASSERT_TRUE(tree->SetCapture(w3_id));
- EXPECT_EQ(w3, GetCaptureWindow(display));
- AckPreviousEvent();
-
- // Make |w3| child of |w1|. This should release capture as |w3| is now blocked
- // by a modal window.
- ASSERT_TRUE(tree->AddWindow(w1_id, w3_id));
- EXPECT_EQ(nullptr, GetCaptureWindow(display));
-}
-
-// Tests that opacity can be set on a known window.
-TEST_F(WindowTreeTest, SetOpacity) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* window = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &window));
-
- const float new_opacity = 0.5f;
- EXPECT_NE(new_opacity, window->opacity());
- ASSERT_TRUE(tree->SetWindowOpacity(ClientWindowIdForWindow(tree, window),
- new_opacity));
- EXPECT_EQ(new_opacity, window->opacity());
-
- // Re-applying the same opacity will succeed.
- EXPECT_TRUE(tree->SetWindowOpacity(ClientWindowIdForWindow(tree, window),
- new_opacity));
-}
-
-// Tests that opacity requests for unknown windows are rejected.
-TEST_F(WindowTreeTest, SetOpacityFailsOnUnknownWindow) {
- TestWindowTreeClient* embed_client = nullptr;
- WindowTree* tree = nullptr;
- ServerWindow* window = nullptr;
- EXPECT_NO_FATAL_FAILURE(SetupEventTargeting(&embed_client, &tree, &window));
-
- TestServerWindowDelegate delegate;
- WindowId window_id(42, 1337);
- ServerWindow unknown_window(&delegate, window_id);
- const float new_opacity = 0.5f;
- ASSERT_NE(new_opacity, unknown_window.opacity());
-
- EXPECT_FALSE(tree->SetWindowOpacity(
- ClientWindowId(WindowIdToTransportId(window_id)), new_opacity));
- EXPECT_NE(new_opacity, unknown_window.opacity());
-}
-
-TEST_F(WindowTreeTest, SetCaptureTargetsRightConnection) {
- ServerWindow* window = window_event_targeting_helper_.CreatePrimaryTree(
- gfx::Rect(0, 0, 100, 100), gfx::Rect(0, 0, 50, 50));
- WindowTree* owning_tree =
- window_server()->GetTreeWithId(window->id().client_id);
- WindowTree* embed_tree = window_server()->GetTreeWithRoot(window);
- ASSERT_NE(owning_tree, embed_tree);
- ASSERT_TRUE(
- owning_tree->SetCapture(ClientWindowIdForWindow(owning_tree, window)));
- DispatchEventWithoutAck(CreateMouseMoveEvent(21, 22));
- WindowManagerStateTestApi wm_state_test_api(
- display()->GetActiveWindowManagerDisplayRoot()->window_manager_state());
- EXPECT_EQ(owning_tree, wm_state_test_api.tree_awaiting_input_ack());
- AckPreviousEvent();
-
- // Set capture from the embedded client and make sure it gets the event.
- ASSERT_TRUE(
- embed_tree->SetCapture(ClientWindowIdForWindow(embed_tree, window)));
- DispatchEventWithoutAck(CreateMouseMoveEvent(22, 23));
- EXPECT_EQ(embed_tree, wm_state_test_api.tree_awaiting_input_ack());
-}
-
-} // namespace test
-} // namespace ws
-} // namespace mus
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/README.chromium b/chromium/third_party/catapult/third_party/py_vulcanize/README.chromium
deleted file mode 100644
index 0b32761b781..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/README.chromium
+++ /dev/null
@@ -1,8 +0,0 @@
-Name: py_vulcanize
-URL: N/A
-Version: N/A
-
-Description:
-Py-vulcanize, formerly known as TVCM (trace-viewer component model).
-This code doesn't actually live anywhere else currently, but it may
-be split out into a separate repository in the future.
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/bin/run_py_tests b/chromium/third_party/catapult/third_party/py_vulcanize/bin/run_py_tests
deleted file mode 100755
index 2584fcda0da..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/bin/run_py_tests
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import sys
-
-_CATAPULT = os.path.abspath(os.path.join(
- os.path.dirname(__file__), os.path.pardir, os.path.pardir, os.path.pardir))
-
-
-def _AddToPathIfNeeded(path):
- if path not in sys.path:
- sys.path.insert(0, path)
-
-
-if __name__ == '__main__':
- _AddToPathIfNeeded(_CATAPULT)
-
- from hooks import install
- if '--no-install-hooks' in sys.argv:
- sys.argv.remove('--no-install-hooks')
- else:
- install.InstallHooks()
-
- from catapult_build import run_with_typ
- sys.exit(run_with_typ.Run(
- os.path.join(_CATAPULT, 'third_party', 'py_vulcanize')))
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/__init__.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/__init__.py
deleted file mode 100644
index f3a4bd1bb15..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/__init__.py
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Trace-viewer component model.
-
-This module implements trace-viewer's component model.
-"""
-
-from py_vulcanize.generate import * # pylint: disable=wildcard-import
-from py_vulcanize.project import Project
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/fake_fs.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/fake_fs.py
deleted file mode 100644
index dfcb5e60bf4..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/fake_fs.py
+++ /dev/null
@@ -1,146 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import codecs
-import os
-import sys
-import collections
-import StringIO
-
-
-class WithableStringIO(StringIO.StringIO):
-
- def __enter__(self, *args):
- return self
-
- def __exit__(self, *args):
- pass
-
-
-class FakeFS(object):
-
- def __init__(self, initial_filenames_and_contents=None):
- self._file_contents = {}
- if initial_filenames_and_contents:
- for k, v in initial_filenames_and_contents.iteritems():
- self._file_contents[k] = v
-
- self._bound = False
- self._real_codecs_open = codecs.open
- self._real_open = sys.modules['__builtin__'].open
- self._real_abspath = os.path.abspath
- self._real_exists = os.path.exists
- self._real_walk = os.walk
- self._real_listdir = os.listdir
-
- def __enter__(self):
- self.Bind()
- return self
-
- def __exit__(self, *args):
- self.Unbind()
-
- def Bind(self):
- assert not self._bound
- codecs.open = self._FakeCodecsOpen
- sys.modules['__builtin__'].open = self._FakeOpen
- os.path.abspath = self._FakeAbspath
- os.path.exists = self._FakeExists
- os.walk = self._FakeWalk
- os.listdir = self._FakeListDir
- self._bound = True
-
- def Unbind(self):
- assert self._bound
- codecs.open = self._real_codecs_open
- sys.modules['__builtin__'].open = self._real_open
- os.path.abspath = self._real_abspath
- os.path.exists = self._real_exists
- os.walk = self._real_walk
- os.listdir = self._real_listdir
- self._bound = False
-
- def AddFile(self, path, contents):
- assert path not in self._file_contents
- path = os.path.normpath(path)
- self._file_contents[path] = contents
-
- def _FakeOpen(self, path, mode=None):
- if mode is None:
- mode = 'r'
- if mode == 'r' or mode == 'rU' or mode == 'rb':
- if path not in self._file_contents:
- return self._real_open(path, mode)
- return WithableStringIO(self._file_contents[path])
-
- raise NotImplementedError()
-
- def _FakeCodecsOpen(self, path, mode=None,
- encoding=None): # pylint: disable=unused-argument
- if mode is None:
- mode = 'r'
- if mode == 'r' or mode == 'rU' or mode == 'rb':
- if path not in self._file_contents:
- return self._real_open(path, mode)
- return WithableStringIO(self._file_contents[path])
-
- raise NotImplementedError()
-
- def _FakeAbspath(self, path):
- """Normalize the path and ensure it starts with os.path.sep.
-
- The tests all assume paths start with things like '/my/project',
- and this abspath implementaion makes that assumption work correctly
- on Windows.
- """
- normpath = os.path.normpath(path)
- if not normpath.startswith(os.path.sep):
- normpath = os.path.sep + normpath
- return normpath
-
- def _FakeExists(self, path):
- if path in self._file_contents:
- return True
- return self._real_exists(path)
-
- def _FakeWalk(self, top):
- assert os.path.isabs(top)
- all_filenames = self._file_contents.keys()
- pending_prefixes = collections.deque()
- pending_prefixes.append(top)
- visited_prefixes = set()
- while len(pending_prefixes):
- prefix = pending_prefixes.popleft()
- if prefix in visited_prefixes:
- continue
- visited_prefixes.add(prefix)
- if prefix.endswith(os.path.sep):
- prefix_with_trailing_sep = prefix
- else:
- prefix_with_trailing_sep = prefix + os.path.sep
-
- dirs = set()
- files = []
- for filename in all_filenames:
- if not filename.startswith(prefix_with_trailing_sep):
- continue
- relative_to_prefix = os.path.relpath(filename, prefix)
-
- dirpart = os.path.dirname(relative_to_prefix)
- if len(dirpart) == 0:
- files.append(relative_to_prefix)
- continue
- parts = dirpart.split(os.sep)
- if len(parts) == 0:
- dirs.add(dirpart)
- else:
- pending = os.path.join(prefix, parts[0])
- dirs.add(parts[0])
- pending_prefixes.appendleft(pending)
-
- dirs = sorted(dirs)
- yield prefix, dirs, files
-
- def _FakeListDir(self, dirname):
- raise NotImplementedError()
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/fake_fs_unittest.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/fake_fs_unittest.py
deleted file mode 100644
index 08250138a5e..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/fake_fs_unittest.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import unittest
-
-from py_vulcanize import fake_fs
-
-
-class FakeFSUnittest(unittest.TestCase):
-
- def testBasic(self):
- fs = fake_fs.FakeFS()
- fs.AddFile('/blah/x', 'foobar')
- with fs:
- assert os.path.exists(os.path.normpath('/blah/x'))
- self.assertEquals(
- 'foobar',
- open(os.path.normpath('/blah/x'), 'r').read())
-
- def testWithableOpen(self):
- fs = fake_fs.FakeFS()
- fs.AddFile('/blah/x', 'foobar')
- with fs:
- with open(os.path.normpath('/blah/x'), 'r') as f:
- self.assertEquals('foobar', f.read())
-
- def testWalk(self):
- fs = fake_fs.FakeFS()
- fs.AddFile('/x/w2/w3/z3.txt', '')
- fs.AddFile('/x/w/z.txt', '')
- fs.AddFile('/x/y.txt', '')
- fs.AddFile('/a.txt', 'foobar')
- with fs:
- gen = os.walk(os.path.normpath('/'))
- r = gen.next()
- self.assertEquals((os.path.normpath('/'), ['x'], ['a.txt']), r)
-
- r = gen.next()
- self.assertEquals((os.path.normpath('/x'), ['w', 'w2'], ['y.txt']), r)
-
- r = gen.next()
- self.assertEquals((os.path.normpath('/x/w'), [], ['z.txt']), r)
-
- r = gen.next()
- self.assertEquals((os.path.normpath('/x/w2'), ['w3'], []), r)
-
- r = gen.next()
- self.assertEquals((os.path.normpath('/x/w2/w3'), [], ['z3.txt']), r)
-
- self.assertRaises(StopIteration, gen.next)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/generate.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/generate.py
deleted file mode 100644
index c3e08cbc2b0..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/generate.py
+++ /dev/null
@@ -1,274 +0,0 @@
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import sys
-import subprocess
-import tempfile
-import StringIO
-
-from py_vulcanize import html_generation_controller
-
-
-html_warning_message = """
-
-
-<!--
-WARNING: This file is auto generated.
-
- Do not edit directly.
--->
-"""
-
-js_warning_message = """
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-/* WARNING: This file is auto generated.
- *
- * Do not edit directly.
- */
-"""
-
-css_warning_message = """
-/* Copyright 2015 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file. */
-
-/* WARNING: This file is auto-generated.
- *
- * Do not edit directly.
- */
-"""
-
-
-def _AssertIsUTF8(f):
- if isinstance(f, StringIO.StringIO):
- return
- assert f.encoding == 'utf-8'
-
-
-def _MinifyJS(input_js):
- py_vulcanize_path = os.path.abspath(os.path.join(
- os.path.dirname(__file__), '..'))
- rjsmin_path = os.path.abspath(
- os.path.join(py_vulcanize_path, 'third_party', 'rjsmin', 'rjsmin.py'))
-
- with tempfile.NamedTemporaryFile() as _:
- args = [
- 'python',
- rjsmin_path
- ]
- p = subprocess.Popen(args,
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- res = p.communicate(input=input_js)
- errorcode = p.wait()
- if errorcode != 0:
- sys.stderr.write('rJSmin exited with error code %d' % errorcode)
- sys.stderr.write(res[1])
- raise Exception('Failed to minify, omgah')
- return res[0]
-
-
-def GenerateJS(load_sequence,
- use_include_tags_for_scripts=False,
- dir_for_include_tag_root=None,
- minify=False,
- report_sizes=False):
- f = StringIO.StringIO()
- GenerateJSToFile(f,
- load_sequence,
- use_include_tags_for_scripts,
- dir_for_include_tag_root,
- minify=minify,
- report_sizes=report_sizes)
-
- return f.getvalue()
-
-
-def GenerateJSToFile(f,
- load_sequence,
- use_include_tags_for_scripts=False,
- dir_for_include_tag_root=None,
- minify=False,
- report_sizes=False):
- _AssertIsUTF8(f)
- if use_include_tags_for_scripts and dir_for_include_tag_root is None:
- raise Exception('Must provide dir_for_include_tag_root')
-
- f.write(js_warning_message)
- f.write('\n')
-
- loader = load_sequence[0].loader
-
- polymer_script = loader.LoadRawScript('components/polymer/polymer.min.js')
- f.write(polymer_script.contents)
-
- if not minify:
- flatten_to_file = f
- else:
- flatten_to_file = StringIO.StringIO()
-
- for module in load_sequence:
- module.AppendJSContentsToFile(flatten_to_file,
- use_include_tags_for_scripts,
- dir_for_include_tag_root)
- if minify:
- js = flatten_to_file.getvalue()
- minified_js = _MinifyJS(js)
- f.write(minified_js)
- f.write('\n')
-
- if report_sizes:
- for module in load_sequence:
- s = StringIO.StringIO()
- module.AppendJSContentsToFile(s,
- use_include_tags_for_scripts,
- dir_for_include_tag_root)
-
- # Add minified size info.
- js = s.getvalue()
- min_js_size = str(len(_MinifyJS(js)))
-
- # Print names for this module. Some domain-specific simplifications
- # are included to make pivoting more obvious.
- parts = module.name.split('.')
- if parts[:2] == ['base', 'ui']:
- parts = ['base_ui'] + parts[2:]
- if parts[:2] == ['tracing', 'importer']:
- parts = ['importer'] + parts[2:]
- tln = parts[0]
- sln = '.'.join(parts[:2])
-
- # Output
- print '%i\t%s\t%s\t%s\t%s' % (len(js), min_js_size, module.name, tln, sln)
- sys.stdout.flush()
-
-
-class ExtraScript(object):
-
- def __init__(self, script_id=None, text_content=None, content_type=None):
- if script_id is not None:
- assert script_id[0] != '#'
- self.script_id = script_id
- self.text_content = text_content
- self.content_type = content_type
-
- def WriteToFile(self, output_file):
- _AssertIsUTF8(output_file)
- attrs = []
- if self.script_id:
- attrs.append('id="%s"' % self.script_id)
- if self.content_type:
- attrs.append('content-type="%s"' % self.content_type)
-
- if len(attrs) > 0:
- output_file.write('<script %s>\n' % ' '.join(attrs))
- else:
- output_file.write('<script>\n')
- if self.text_content:
- output_file.write(self.text_content)
- output_file.write('</script>\n')
-
-
-def _MinifyCSS(css_text):
- py_vulcanize_path = os.path.abspath(os.path.join(
- os.path.dirname(__file__), '..'))
- rcssmin_path = os.path.abspath(
- os.path.join(py_vulcanize_path, 'third_party', 'rcssmin', 'rcssmin.py'))
-
- with tempfile.NamedTemporaryFile() as _:
- rcssmin_args = ['python', rcssmin_path]
- p = subprocess.Popen(rcssmin_args,
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE)
- res = p.communicate(input=css_text)
- errorcode = p.wait()
- if errorcode != 0:
- sys.stderr.write('rCSSmin exited with error code %d' % errorcode)
- sys.stderr.write(res[1])
- raise Exception('Failed to generate css for %s.' % css_text)
- return res[0]
-
-
-def GenerateStandaloneHTMLAsString(*args, **kwargs):
- f = StringIO.StringIO()
- GenerateStandaloneHTMLToFile(f, *args, **kwargs)
- return f.getvalue()
-
-
-def GenerateStandaloneHTMLToFile(output_file,
- load_sequence,
- title=None,
- flattened_js_url=None,
- extra_scripts=None,
- minify=False,
- report_sizes=False,
- output_html_head_and_body=True):
- """Writes a HTML file with the content of all modules in a load sequence.
-
- The load_sequence is a list of (HTML or JS) Module objects; the order that
- they're inserted into the file depends on their type and position in the load
- sequence.
- """
- _AssertIsUTF8(output_file)
- extra_scripts = extra_scripts or []
-
- if output_html_head_and_body:
- output_file.write(
- '<!DOCTYPE html>\n'
- '<html>\n'
- ' <head i18n-values="dir:textdirection;">\n'
- ' <meta http-equiv="Content-Type" content="text/html;'
- 'charset=utf-8">\n')
- if title:
- output_file.write(' <title>%s</title>\n ' % title)
- else:
- assert title is None
-
- loader = load_sequence[0].loader
-
- written_style_sheets = set()
-
- class HTMLGenerationController(
- html_generation_controller.HTMLGenerationController):
-
- def __init__(self, module):
- self.module = module
-
- def GetHTMLForStylesheetHRef(self, href):
- resource = self.module.HRefToResource(
- href, '<link rel="stylesheet" href="%s">' % href)
- style_sheet = loader.LoadStyleSheet(resource.name)
-
- if style_sheet in written_style_sheets:
- return None
- written_style_sheets.add(style_sheet)
-
- text = style_sheet.contents_with_inlined_images
- if minify:
- text = _MinifyCSS(text)
- return '<style>\n%s\n</style>' % text
-
- for module in load_sequence:
- controller = HTMLGenerationController(module)
- module.AppendHTMLContentsToFile(output_file, controller, minify=minify)
-
- if flattened_js_url:
- output_file.write('<script src="%s"></script>\n' % flattened_js_url)
- else:
- output_file.write('<script>\n')
- js = GenerateJS(load_sequence, minify=minify, report_sizes=report_sizes)
- output_file.write(js)
- output_file.write('</script>\n')
-
- for extra_script in extra_scripts:
- extra_script.WriteToFile(output_file)
-
- if output_html_head_and_body:
- output_file.write('</head>\n <body>\n </body>\n</html>\n')
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/generate_unittest.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/generate_unittest.py
deleted file mode 100644
index c79441a1e34..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/generate_unittest.py
+++ /dev/null
@@ -1,59 +0,0 @@
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import unittest
-
-from py_vulcanize import generate
-from py_vulcanize import fake_fs
-from py_vulcanize import project as project_module
-
-
-class GenerateTests(unittest.TestCase):
-
- def setUp(self):
- self.fs = fake_fs.FakeFS()
- self.fs.AddFile(
- '/x/foo/my_module.html',
- ('<!DOCTYPE html>\n'
- '<link rel="import" href="/foo/other_module.html">\n'))
- self.fs.AddFile(
- '/x/foo/other_module.html',
- ('<!DOCTYPE html>\n'
- '<script src="/foo/raw/raw_script.js"></script>\n'
- '<script>\n'
- ' \'use strict\';\n'
- ' HelloWorld();\n'
- '</script>\n'))
- self.fs.AddFile('/x/foo/raw/raw_script.js', '\n/* raw script */\n')
- self.fs.AddFile('/x/components/polymer/polymer.min.js', '\n')
-
- self.project = project_module.Project([os.path.normpath('/x')])
-
- def testJSGeneration(self):
- with self.fs:
- load_sequence = self.project.CalcLoadSequenceForModuleNames(
- [os.path.normpath('foo.my_module')])
- generate.GenerateJS(load_sequence)
-
- def testHTMLGeneration(self):
- with self.fs:
- load_sequence = self.project.CalcLoadSequenceForModuleNames(
- [os.path.normpath('foo.my_module')])
- result = generate.GenerateStandaloneHTMLAsString(load_sequence)
- self.assertIn('HelloWorld();', result)
-
- def testExtraScriptWithWriteContentsFunc(self):
- with self.fs:
- load_sequence = self.project.CalcLoadSequenceForModuleNames(
- [os.path.normpath('foo.my_module')])
-
- class ExtraScript(generate.ExtraScript):
-
- def WriteToFile(self, f):
- f.write('<script>ExtraScript!</script>')
-
- result = generate.GenerateStandaloneHTMLAsString(
- load_sequence, title='Title', extra_scripts=[ExtraScript()])
- self.assertIn('ExtraScript', result)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/html_generation_controller.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/html_generation_controller.py
deleted file mode 100644
index c804fe8ca3e..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/html_generation_controller.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import re
-from py_vulcanize import style_sheet
-
-
-class HTMLGenerationController(object):
-
- def __init__(self):
- self.current_module = None
-
- def GetHTMLForStylesheetHRef(self, href): # pylint: disable=unused-argument
- return None
-
- def GetHTMLForInlineStylesheet(self, contents):
- if self.current_module is None:
- if re.search('url\(.+\)', contents):
- raise Exception(
- 'Default HTMLGenerationController cannot handle inline style urls')
- return contents
-
- module_dirname = os.path.dirname(self.current_module.resource.absolute_path)
- ss = style_sheet.ParsedStyleSheet(
- self.current_module.loader, module_dirname, contents)
- return ss.contents_with_inlined_images
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/html_module.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/html_module.py
deleted file mode 100644
index d6b594e1f4e..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/html_module.py
+++ /dev/null
@@ -1,195 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import re
-
-from py_vulcanize import js_utils
-from py_vulcanize import module
-from py_vulcanize import parse_html_deps
-from py_vulcanize import style_sheet
-
-
-def IsHTMLResourceTheModuleGivenConflictingResourceNames(
- js_resource, html_resource): # pylint: disable=unused-argument
- return 'polymer-element' in html_resource.contents
-
-
-class HTMLModule(module.Module):
-
- @property
- def _module_dir_name(self):
- return os.path.dirname(self.resource.absolute_path)
-
- def Parse(self):
- try:
- parser_results = parse_html_deps.HTMLModuleParser().Parse(self.contents)
- except Exception as ex:
- raise Exception('While parsing %s: %s' % (self.name, str(ex)))
-
- self.dependency_metadata = Parse(self.loader,
- self.name,
- self._module_dir_name,
- self.IsThirdPartyComponent(),
- parser_results)
- self._parser_results = parser_results
-
- def Load(self):
- super(HTMLModule, self).Load()
-
- reachable_names = set([m.name
- for m in self.all_dependent_modules_recursive])
- if 'tr.exportTo' in self.contents:
- if 'tracing.base.base' not in reachable_names:
- raise Exception('%s: Does not have a dependency on base' %
- os.path.relpath(self.resource.absolute_path))
-
- def GetTVCMDepsModuleType(self):
- return 'py_vulcanize.HTML_MODULE_TYPE'
-
- def AppendJSContentsToFile(self,
- f,
- use_include_tags_for_scripts,
- dir_for_include_tag_root):
- super(HTMLModule, self).AppendJSContentsToFile(f,
- use_include_tags_for_scripts,
- dir_for_include_tag_root)
- for inline_script in self._parser_results.inline_scripts:
- if not HasPolymerCall(inline_script.stripped_contents):
- js = inline_script.contents
- else:
- js = GetInlineScriptContentWithPolymerizingApplied(inline_script)
-
- js = js_utils.EscapeJSIfNeeded(js)
-
- f.write(js)
- f.write('\n')
-
- def AppendHTMLContentsToFile(self, f, ctl, minify=False):
- super(HTMLModule, self).AppendHTMLContentsToFile(f, ctl)
-
- ctl.current_module = self
- try:
- for piece in self._parser_results.YieldHTMLInPieces(ctl, minify=minify):
- f.write(piece)
- finally:
- ctl.current_module = None
-
- def HRefToResource(self, href, tag_for_err_msg):
- return _HRefToResource(self.loader, self.name, self._module_dir_name,
- href, tag_for_err_msg)
-
- def AppendDirectlyDependentFilenamesTo(
- self, dependent_filenames, include_raw_scripts=True):
- super(HTMLModule, self).AppendDirectlyDependentFilenamesTo(
- dependent_filenames, include_raw_scripts)
- for contents in self._parser_results.inline_stylesheets:
- module_dirname = os.path.dirname(self.resource.absolute_path)
- ss = style_sheet.ParsedStyleSheet(
- self.loader, module_dirname, contents)
- ss.AppendDirectlyDependentFilenamesTo(dependent_filenames)
-
-
-def GetInlineScriptContentWithPolymerizingApplied(inline_script):
- polymer_element_name = GetPolymerElementNameFromOpenTags(
- inline_script.open_tags)
- if polymer_element_name is None:
- raise module.DepsException(
- 'Tagless Polymer() call must be made inside a <polymer-element> tag')
-
- return UpdatePolymerCallsGivenElementName(
- inline_script.stripped_contents, polymer_element_name)
-
-
-def GetPolymerElementNameFromOpenTags(open_tags):
- found_tag = None
- for tag in reversed(open_tags):
- if tag.tag == 'polymer-element':
- found_tag = tag
- break
-
- if not found_tag:
- return None
-
- return found_tag.attrs.get('name', None)
-
-_POLYMER_RE_1 = 'Polymer(\s*?)\((\s*?)\{'
-_POLYMER_RE_2 = 'Polymer(\s*?)\((\s*?)\)'
-
-
-def HasPolymerCall(js):
- if re.search(_POLYMER_RE_1, js) is not None:
- return True
- if re.search(_POLYMER_RE_2, js) is not None:
- return True
- return False
-
-
-def UpdatePolymerCallsGivenElementName(js, polymer_element_name):
- if re.search(_POLYMER_RE_1, js) is not None:
- return re.sub(_POLYMER_RE_1,
- 'Polymer\g<1>(\g<2>\'%s\', {' % polymer_element_name,
- js, 0, re.DOTALL)
- if re.search(_POLYMER_RE_2, js) is not None:
- return re.sub(_POLYMER_RE_2,
- 'Polymer\g<1>(\g<2>\'%s\')' % polymer_element_name,
- js, 0, re.DOTALL)
- assert False, 'This should never be reached'
-
-
-def _HRefToResource(
- loader, module_name, module_dir_name, href, tag_for_err_msg):
- if href[0] == '/':
- resource = loader.FindResourceGivenRelativePath(
- os.path.normpath(href[1:]))
- else:
- abspath = os.path.normpath(os.path.join(module_dir_name,
- os.path.normpath(href)))
- resource = loader.FindResourceGivenAbsolutePath(abspath)
-
- if not resource:
- raise module.DepsException(
- 'In %s, the %s cannot be loaded because '
- 'it is not in the search path' % (module_name, tag_for_err_msg))
- try:
- resource.contents
- except:
- raise module.DepsException('In %s, %s points at a nonexistent file ' % (
- module_name, tag_for_err_msg))
- return resource
-
-
-def Parse(loader, module_name, module_dir_name, is_component, parser_results):
- res = module.ModuleDependencyMetadata()
- if is_component:
- return res
-
- # External script references.
- for href in parser_results.scripts_external:
- resource = _HRefToResource(loader, module_name, module_dir_name,
- href,
- tag_for_err_msg='<script src="%s">' % href)
- res.dependent_raw_script_relative_paths.append(
- resource.unix_style_relative_path)
-
- # External imports. Mostly the same as <script>, but we know its a module.
- for href in parser_results.imports:
- if not href.endswith('.html'):
- raise Exception(
- 'In %s, the <link rel="import" href="%s"> must point at a '
- 'file with an html suffix' % (module_name, href))
-
- resource = _HRefToResource(
- loader, module_name, module_dir_name, href,
- tag_for_err_msg='<link rel="import" href="%s">' % href)
- res.dependent_module_names.append(resource.name)
-
- # Style sheets.
- for href in parser_results.stylesheets:
- resource = _HRefToResource(
- loader, module_name, module_dir_name, href,
- tag_for_err_msg='<link rel="stylesheet" href="%s">' % href)
- res.style_sheet_names.append(resource.name)
-
- return res
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/html_module_unittest.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/html_module_unittest.py
deleted file mode 100644
index 1931bb58267..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/html_module_unittest.py
+++ /dev/null
@@ -1,347 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import unittest
-import StringIO
-
-from py_vulcanize import fake_fs
-from py_vulcanize import generate
-from py_vulcanize import html_generation_controller
-from py_vulcanize import html_module
-from py_vulcanize import parse_html_deps
-from py_vulcanize import project as project_module
-from py_vulcanize import resource
-from py_vulcanize import resource_loader as resource_loader
-
-
-class ResourceWithFakeContents(resource.Resource):
-
- def __init__(self, toplevel_dir, absolute_path, fake_contents):
- """A resource with explicitly provided contents.
-
- If the resource does not exist, then pass fake_contents=None. This will
- cause accessing the resource contents to raise an exception mimicking the
- behavior of regular resources."""
- super(ResourceWithFakeContents, self).__init__(toplevel_dir, absolute_path)
- self._fake_contents = fake_contents
-
- @property
- def contents(self):
- if self._fake_contents is None:
- raise Exception('File not found')
- return self._fake_contents
-
-
-class FakeLoader(object):
-
- def __init__(self, source_paths, initial_filenames_and_contents=None):
- self._source_paths = source_paths
- self._file_contents = {}
- if initial_filenames_and_contents:
- for k, v in initial_filenames_and_contents.iteritems():
- self._file_contents[k] = v
-
- def FindResourceGivenAbsolutePath(self, absolute_path):
- candidate_paths = []
- for source_path in self._source_paths:
- if absolute_path.startswith(source_path):
- candidate_paths.append(source_path)
- if len(candidate_paths) == 0:
- return None
-
- # Sort by length. Longest match wins.
- candidate_paths.sort(lambda x, y: len(x) - len(y))
- longest_candidate = candidate_paths[-1]
-
- return ResourceWithFakeContents(
- longest_candidate, absolute_path,
- self._file_contents.get(absolute_path, None))
-
- def FindResourceGivenRelativePath(self, relative_path):
- absolute_path = None
- for script_path in self._source_paths:
- absolute_path = os.path.join(script_path, relative_path)
- if absolute_path in self._file_contents:
- return ResourceWithFakeContents(script_path, absolute_path,
- self._file_contents[absolute_path])
- return None
-
-
-class ParseTests(unittest.TestCase):
-
- def testValidExternalScriptReferenceToRawScript(self):
- parse_results = parse_html_deps.HTMLModuleParserResults("""<!DOCTYPE html>
- <script src="../foo.js">
- """)
-
- file_contents = {}
- file_contents[os.path.normpath('/tmp/a/foo.js')] = """
-'i am just some raw script';
-"""
-
- metadata = html_module.Parse(
- FakeLoader([os.path.normpath('/tmp')], file_contents),
- 'a.b.start',
- '/tmp/a/b/',
- is_component=False,
- parser_results=parse_results)
- self.assertEquals([], metadata.dependent_module_names)
- self.assertEquals(
- ['a/foo.js'], metadata.dependent_raw_script_relative_paths)
-
- def testExternalScriptReferenceToModuleOutsideScriptPath(self):
- parse_results = parse_html_deps.HTMLModuleParserResults("""<!DOCTYPE html>
- <script src="/foo.js">
- """)
-
- file_contents = {}
- file_contents[os.path.normpath('/foo.js')] = ''
-
- def DoIt():
- html_module.Parse(FakeLoader([os.path.normpath('/tmp')], file_contents),
- 'a.b.start',
- '/tmp/a/b/',
- is_component=False,
- parser_results=parse_results)
- self.assertRaises(Exception, DoIt)
-
- def testExternalScriptReferenceToFileThatDoesntExist(self):
- parse_results = parse_html_deps.HTMLModuleParserResults("""<!DOCTYPE html>
- <script src="/foo.js">
- """)
-
- file_contents = {}
-
- def DoIt():
- html_module.Parse(FakeLoader([os.path.normpath('/tmp')], file_contents),
- 'a.b.start',
- '/tmp/a/b/',
- is_component=False,
- parser_results=parse_results)
- self.assertRaises(Exception, DoIt)
-
- def testValidImportOfModule(self):
- parse_results = parse_html_deps.HTMLModuleParserResults("""<!DOCTYPE html>
- <link rel="import" href="../foo.html">
- """)
-
- file_contents = {}
- file_contents[os.path.normpath('/tmp/a/foo.html')] = """
-"""
-
- metadata = html_module.Parse(
- FakeLoader([os.path.normpath('/tmp')], file_contents),
- 'a.b.start',
- '/tmp/a/b/',
- is_component=False,
- parser_results=parse_results)
- self.assertEquals(['a.foo'], metadata.dependent_module_names)
-
- def testStyleSheetImport(self):
- parse_results = parse_html_deps.HTMLModuleParserResults("""<!DOCTYPE html>
- <link rel="stylesheet" href="../foo.css">
- """)
-
- file_contents = {}
- file_contents[os.path.normpath('/tmp/a/foo.css')] = """
-"""
- metadata = html_module.Parse(
- FakeLoader([os.path.normpath('/tmp')], file_contents),
- 'a.b.start',
- '/tmp/a/b/',
- is_component=False,
- parser_results=parse_results)
- self.assertEquals([], metadata.dependent_module_names)
- self.assertEquals(['a.foo'], metadata.style_sheet_names)
-
- def testUsingAbsoluteHref(self):
- parse_results = parse_html_deps.HTMLModuleParserResults("""<!DOCTYPE html>
- <script src="/foo.js">
- """)
-
- file_contents = {}
- file_contents[os.path.normpath('/src/foo.js')] = ''
-
- metadata = html_module.Parse(
- FakeLoader([os.path.normpath("/tmp"), os.path.normpath("/src")],
- file_contents),
- "a.b.start",
- "/tmp/a/b/",
- is_component=False,
- parser_results=parse_results)
- self.assertEquals(['foo.js'], metadata.dependent_raw_script_relative_paths)
-
-
-class HTMLModuleTests(unittest.TestCase):
-
- def testBasicModuleGeneration(self):
- file_contents = {}
- file_contents[os.path.normpath('/tmp/a/b/start.html')] = """
-<!DOCTYPE html>
-<link rel="import" href="/widget.html">
-<link rel="stylesheet" href="../common.css">
-<script src="/raw_script.js"></script>
-<polymer-element name="start">
- <template>
- </template>
- <script>
- 'use strict';
- console.log('inline script for start.html got written');
- </script>
-</polymer-element>
-"""
- file_contents[os.path.normpath('/py_vulcanize/py_vulcanize.html')] = """<!DOCTYPE html>
-"""
- file_contents[os.path.normpath('/components/widget.html')] = """
-<!DOCTYPE html>
-<link rel="import" href="/py_vulcanize.html">
-<widget name="widget.html"></widget>
-<script>
-'use strict';
-console.log('inline script for widget.html');
-</script>
-"""
- file_contents[os.path.normpath('/tmp/a/common.css')] = """
-/* /tmp/a/common.css was written */
-"""
- file_contents[os.path.normpath('/raw/raw_script.js')] = """
-console.log('/raw/raw_script.js was written');
-"""
- file_contents[os.path.normpath(
- '/raw/components/polymer/polymer.min.js')] = """
-"""
-
- with fake_fs.FakeFS(file_contents):
- project = project_module.Project(
- [os.path.normpath('/py_vulcanize/'),
- os.path.normpath('/tmp/'),
- os.path.normpath('/components/'),
- os.path.normpath('/raw/')])
- loader = resource_loader.ResourceLoader(project)
- a_b_start_module = loader.LoadModule(module_name='a.b.start')
- load_sequence = project.CalcLoadSequenceForModules([a_b_start_module])
-
- # Check load sequence names.
- load_sequence_names = [x.name for x in load_sequence]
- self.assertEquals(['py_vulcanize',
- 'widget',
- 'a.b.start'], load_sequence_names)
-
- # Check module_deps on a_b_start_module
- def HasDependentModule(module, name):
- return [x for x in module.dependent_modules
- if x.name == name]
- assert HasDependentModule(a_b_start_module, 'widget')
-
- # Check JS generation.
- js = generate.GenerateJS(load_sequence)
- assert 'inline script for start.html' in js
- assert 'inline script for widget.html' in js
- assert '/raw/raw_script.js' in js
-
- # Check HTML generation.
- html = generate.GenerateStandaloneHTMLAsString(
- load_sequence, title='', flattened_js_url='/blah.js')
- assert '<polymer-element name="start">' in html
- assert 'inline script for widget.html' not in html
- assert 'common.css' in html
-
- def testPolymerConversion(self):
- file_contents = {}
- file_contents[os.path.normpath('/tmp/a/b/my_component.html')] = """
-<!DOCTYPE html>
-<polymer-element name="my-component">
- <template>
- </template>
- <script>
- 'use strict';
- Polymer ( {
- });
- </script>
-</polymer-element>
-"""
- with fake_fs.FakeFS(file_contents):
- project = project_module.Project([
- os.path.normpath('/py_vulcanize/'), os.path.normpath('/tmp/')])
- loader = resource_loader.ResourceLoader(project)
- my_component = loader.LoadModule(module_name='a.b.my_component')
-
- f = StringIO.StringIO()
- my_component.AppendJSContentsToFile(
- f,
- use_include_tags_for_scripts=False,
- dir_for_include_tag_root=None)
- js = f.getvalue().rstrip()
- expected_js = """
- 'use strict';
- Polymer ( 'my-component', {
- });
-""".rstrip()
- self.assertEquals(expected_js, js)
-
- def testPolymerConversion2(self):
- file_contents = {}
- file_contents[os.path.normpath('/tmp/a/b/my_component.html')] = """
-<!DOCTYPE html>
-<polymer-element name="my-component">
- <template>
- </template>
- <script>
- 'use strict';
- Polymer ( );
- </script>
-</polymer-element>
-"""
- with fake_fs.FakeFS(file_contents):
- project = project_module.Project([
- os.path.normpath('/py_vulcanize/'), os.path.normpath('/tmp/')])
- loader = resource_loader.ResourceLoader(project)
- my_component = loader.LoadModule(module_name='a.b.my_component')
-
- f = StringIO.StringIO()
- my_component.AppendJSContentsToFile(
- f,
- use_include_tags_for_scripts=False,
- dir_for_include_tag_root=None)
- js = f.getvalue().rstrip()
- expected_js = """
- 'use strict';
- Polymer ( 'my-component');
-""".rstrip()
- self.assertEquals(expected_js, js)
-
- def testInlineStylesheetURLs(self):
- file_contents = {}
- file_contents[os.path.normpath('/tmp/a/b/my_component.html')] = """
-<!DOCTYPE html>
-<style>
-.some-rule {
- background-image: url('../something.jpg');
-}
-</style>
-"""
- file_contents[os.path.normpath('/tmp/a/something.jpg')] = 'jpgdata'
- with fake_fs.FakeFS(file_contents):
- project = project_module.Project([
- os.path.normpath('/py_vulcanize/'), os.path.normpath('/tmp/')])
- loader = resource_loader.ResourceLoader(project)
- my_component = loader.LoadModule(module_name='a.b.my_component')
-
- computed_deps = []
- my_component.AppendDirectlyDependentFilenamesTo(computed_deps)
- self.assertEquals(set(computed_deps),
- set([os.path.normpath('/tmp/a/b/my_component.html'),
- os.path.normpath('/tmp/a/something.jpg')]))
-
- f = StringIO.StringIO()
- ctl = html_generation_controller.HTMLGenerationController()
- my_component.AppendHTMLContentsToFile(f, ctl)
- html = f.getvalue().rstrip()
- # FIXME: This is apparently not used.
- expected_html = """
-.some-rule {
- background-image: url(data:image/jpg;base64,anBnZGF0YQ==);
-}
-""".rstrip()
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/js_utils.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/js_utils.py
deleted file mode 100644
index 6e6ca9db674..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/js_utils.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-
-def EscapeJSIfNeeded(js):
- return js.replace('</script>', '<\/script>')
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/js_utils_unittest.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/js_utils_unittest.py
deleted file mode 100644
index cb8025c97db..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/js_utils_unittest.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import unittest
-
-from py_vulcanize import js_utils
-
-
-class ValidateStrictModeTests(unittest.TestCase):
-
- def testEscapeJSIfNeeded(self):
- self.assertEqual(
- '<script>var foo;<\/script>',
- js_utils.EscapeJSIfNeeded('<script>var foo;</script>'))
- self.assertEqual(
- '<script>var foo;<\/script>',
- js_utils.EscapeJSIfNeeded('<script>var foo;<\/script>'))
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/module.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/module.py
deleted file mode 100644
index 295d224a33a..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/module.py
+++ /dev/null
@@ -1,269 +0,0 @@
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""This module contains the Module class and other classes for resources.
-
-The Module class represents a module in the trace viewer system. A module has
-a name, and may require a variety of other resources, such as stylesheets,
-template objects, raw JavaScript, or other modules.
-
-Other resources include HTML templates, raw JavaScript files, and stylesheets.
-"""
-
-import os
-import inspect
-import codecs
-
-from py_vulcanize import js_utils
-
-
-class DepsException(Exception):
- """Exceptions related to module dependency resolution."""
-
- def __init__(self, fmt, *args):
- from py_vulcanize import style_sheet as style_sheet_module
- context = []
- frame = inspect.currentframe()
- while frame:
- frame_locals = frame.f_locals
-
- module_name = None
- if 'self' in frame_locals:
- s = frame_locals['self']
- if isinstance(s, Module):
- module_name = s.name
- if isinstance(s, style_sheet_module.StyleSheet):
- module_name = s.name + '.css'
- if not module_name:
- if 'module' in frame_locals:
- module = frame_locals['module']
- if isinstance(s, Module):
- module_name = module.name
- elif 'm' in frame_locals:
- module = frame_locals['m']
- if isinstance(s, Module):
- module_name = module.name
-
- if module_name:
- if len(context):
- if context[-1] != module_name:
- context.append(module_name)
- else:
- context.append(module_name)
-
- frame = frame.f_back
-
- context.reverse()
- self.context = context
- context_str = '\n'.join(' %s' % x for x in context)
- Exception.__init__(
- self, 'While loading:\n%s\nGot: %s' % (context_str, (fmt % args)))
-
-
-class ModuleDependencyMetadata(object):
-
- def __init__(self):
- self.dependent_module_names = []
- self.dependent_raw_script_relative_paths = []
- self.style_sheet_names = []
-
- def AppendMetdata(self, other):
- self.dependent_module_names += other.dependent_module_names
- self.dependent_raw_script_relative_paths += \
- other.dependent_raw_script_relative_paths
- self.style_sheet_names += other.style_sheet_names
-
-
-_next_module_id = 1
-
-
-class Module(object):
- """Represents a JavaScript module.
-
- Interesting properties include:
- name: Module name, may include a namespace, e.g. 'py_vulcanize.foo'.
- filename: The filename of the actual module.
- contents: The text contents of the module.
- dependent_modules: Other modules that this module depends on.
-
- In addition to these properties, a Module also contains lists of other
- resources that it depends on.
- """
-
- def __init__(self, loader, name, resource, load_resource=True):
- assert isinstance(name, basestring), 'Got %s instead' % repr(name)
-
- global _next_module_id
- self._id = _next_module_id
- _next_module_id += 1
-
- self.loader = loader
- self.name = name
- self.resource = resource
-
- if load_resource:
- f = codecs.open(self.filename, mode='r', encoding='utf-8')
- self.contents = f.read()
- f.close()
- else:
- self.contents = None
-
- # Dependency metadata, set up during Parse().
- self.dependency_metadata = None
-
- # Actual dependencies, set up during load().
- self.dependent_modules = []
- self.dependent_raw_scripts = []
- self.style_sheets = []
-
- # Caches.
- self._all_dependent_modules_recursive = None
-
- def __repr__(self):
- return '%s(%s)' % (self.__class__.__name__, self.name)
-
- @property
- def id(self):
- return self._id
-
- @property
- def filename(self):
- return self.resource.absolute_path
-
- def IsThirdPartyComponent(self):
- """Checks whether this module is a third-party Polymer component."""
- if os.path.join('third_party', 'components') in self.filename:
- return True
- if os.path.join('third_party', 'polymer', 'components') in self.filename:
- return True
- return False
-
- def Parse(self):
- """Parses self.contents and fills in the module's dependency metadata."""
- raise NotImplementedError()
-
- def GetTVCMDepsModuleType(self):
- """Returns the py_vulcanize.setModuleInfo type for this module"""
- raise NotImplementedError()
-
- def AppendJSContentsToFile(self,
- f,
- use_include_tags_for_scripts,
- dir_for_include_tag_root):
- """Appends the js for this module to the provided file."""
- for dependent_raw_script in self.dependent_raw_scripts:
- if use_include_tags_for_scripts:
- rel_filename = os.path.relpath(dependent_raw_script.filename,
- dir_for_include_tag_root)
- f.write("""<include src="%s">\n""" % rel_filename)
- else:
- f.write(js_utils.EscapeJSIfNeeded(dependent_raw_script.contents))
- f.write('\n')
-
- def AppendHTMLContentsToFile(self, f, ctl, minify=False):
- """Appends the HTML for this module [without links] to the provided file."""
- pass
-
- def Load(self):
- """Loads the sub-resources that this module depends on from its dependency
- metadata.
-
- Raises:
- DepsException: There was a problem finding one of the dependencies.
- Exception: There was a problem parsing a module that this one depends on.
- """
- assert self.name, 'Module name must be set before dep resolution.'
- assert self.filename, 'Module filename must be set before dep resolution.'
- assert self.name in self.loader.loaded_modules, (
- 'Module must be registered in resource loader before loading.')
-
- metadata = self.dependency_metadata
- for name in metadata.dependent_module_names:
- module = self.loader.LoadModule(module_name=name)
- self.dependent_modules.append(module)
-
- for path in metadata.dependent_raw_script_relative_paths:
- raw_script = self.loader.LoadRawScript(path)
- self.dependent_raw_scripts.append(raw_script)
-
- for name in metadata.style_sheet_names:
- style_sheet = self.loader.LoadStyleSheet(name)
- self.style_sheets.append(style_sheet)
-
- @property
- def all_dependent_modules_recursive(self):
- if self._all_dependent_modules_recursive:
- return self._all_dependent_modules_recursive
-
- self._all_dependent_modules_recursive = set(self.dependent_modules)
- for dependent_module in self.dependent_modules:
- self._all_dependent_modules_recursive.update(
- dependent_module.all_dependent_modules_recursive)
- return self._all_dependent_modules_recursive
-
- def ComputeLoadSequenceRecursive(self, load_sequence, already_loaded_set,
- depth=0):
- """Recursively builds up a load sequence list.
-
- Args:
- load_sequence: A list which will be incrementally built up.
- already_loaded_set: A set of modules that has already been added to the
- load sequence list.
- depth: The depth of recursion. If it too deep, that indicates a loop.
- """
- if depth > 32:
- raise Exception('Include loop detected on %s', self.name)
- for dependent_module in self.dependent_modules:
- if dependent_module.name in already_loaded_set:
- continue
- dependent_module.ComputeLoadSequenceRecursive(
- load_sequence, already_loaded_set, depth + 1)
- if self.name not in already_loaded_set:
- already_loaded_set.add(self.name)
- load_sequence.append(self)
-
- def GetAllDependentFilenamesRecursive(self, include_raw_scripts=True):
- dependent_filenames = []
-
- visited_modules = set()
-
- def Get(module):
- module.AppendDirectlyDependentFilenamesTo(
- dependent_filenames, include_raw_scripts)
- visited_modules.add(module)
- for m in module.dependent_modules:
- if m in visited_modules:
- continue
- Get(m)
-
- Get(self)
- return dependent_filenames
-
- def AppendDirectlyDependentFilenamesTo(
- self, dependent_filenames, include_raw_scripts=True):
- dependent_filenames.append(self.resource.absolute_path)
- if include_raw_scripts:
- for raw_script in self.dependent_raw_scripts:
- dependent_filenames.append(raw_script.resource.absolute_path)
- for style_sheet in self.style_sheets:
- style_sheet.AppendDirectlyDependentFilenamesTo(dependent_filenames)
-
-
-class RawScript(object):
- """Represents a raw script resource referenced by a module via the
- py_vulcanize.requireRawScript(xxx) directive."""
-
- def __init__(self, resource):
- self.resource = resource
-
- @property
- def filename(self):
- return self.resource.absolute_path
-
- @property
- def contents(self):
- return self.resource.contents
-
- def __repr__(self):
- return 'RawScript(%s)' % self.filename
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/module_unittest.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/module_unittest.py
deleted file mode 100644
index ed92db35362..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/module_unittest.py
+++ /dev/null
@@ -1,130 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Tests for the module module, which contains Module and related classes."""
-
-import os
-import unittest
-
-from py_vulcanize import fake_fs
-from py_vulcanize import module
-from py_vulcanize import resource_loader
-from py_vulcanize import project as project_module
-
-
-class ModuleIntegrationTests(unittest.TestCase):
-
- def test_module(self):
- fs = fake_fs.FakeFS()
- fs.AddFile('/src/x.html', """
-<!DOCTYPE html>
-<link rel="import" href="/y.html">
-<link rel="import" href="/z.html">
-<script>
-'use strict';
-</script>
-""")
- fs.AddFile('/src/y.html', """
-<!DOCTYPE html>
-<link rel="import" href="/z.html">
-""")
- fs.AddFile('/src/z.html', """
-<!DOCTYPE html>
-""")
- fs.AddFile('/src/py_vulcanize.html', '<!DOCTYPE html>')
- with fs:
- project = project_module.Project([os.path.normpath('/src/')])
- loader = resource_loader.ResourceLoader(project)
- x_module = loader.LoadModule('x')
-
- self.assertEquals([loader.loaded_modules['y'],
- loader.loaded_modules['z']],
- x_module.dependent_modules)
-
- already_loaded_set = set()
- load_sequence = []
- x_module.ComputeLoadSequenceRecursive(load_sequence, already_loaded_set)
-
- self.assertEquals([loader.loaded_modules['z'],
- loader.loaded_modules['y'],
- x_module],
- load_sequence)
-
- def testBasic(self):
- fs = fake_fs.FakeFS()
- fs.AddFile('/x/src/my_module.html', """
-<!DOCTYPE html>
-<link rel="import" href="/py_vulcanize/foo.html">
-});
-""")
- fs.AddFile('/x/py_vulcanize/foo.html', """
-<!DOCTYPE html>
-});
-""")
- project = project_module.Project([os.path.normpath('/x')])
- loader = resource_loader.ResourceLoader(project)
- with fs:
- my_module = loader.LoadModule(module_name='src.my_module')
- dep_names = [x.name for x in my_module.dependent_modules]
- self.assertEquals(['py_vulcanize.foo'], dep_names)
-
- def testDepsExceptionContext(self):
- fs = fake_fs.FakeFS()
- fs.AddFile('/x/src/my_module.html', """
-<!DOCTYPE html>
-<link rel="import" href="/py_vulcanize/foo.html">
-""")
- fs.AddFile('/x/py_vulcanize/foo.html', """
-<!DOCTYPE html>
-<link rel="import" href="missing.html">
-""")
- project = project_module.Project([os.path.normpath('/x')])
- loader = resource_loader.ResourceLoader(project)
- with fs:
- exc = None
- try:
- loader.LoadModule(module_name='src.my_module')
- assert False, 'Expected an exception'
- except module.DepsException as e:
- exc = e
- self.assertEquals(
- ['src.my_module', 'py_vulcanize.foo'],
- exc.context)
-
- def testGetAllDependentFilenamesRecursive(self):
- fs = fake_fs.FakeFS()
- fs.AddFile('/x/y/z/foo.html', """
-<!DOCTYPE html>
-<link rel="import" href="/z/foo2.html">
-<link rel="stylesheet" href="/z/foo.css">
-<script src="/bar.js"></script>
-""")
- fs.AddFile('/x/y/z/foo.css', """
-.x .y {
- background-image: url(foo.jpeg);
-}
-""")
- fs.AddFile('/x/y/z/foo.jpeg', '')
- fs.AddFile('/x/y/z/foo2.html', """
-<!DOCTYPE html>
-""")
- fs.AddFile('/x/raw/bar.js', 'hello')
- project = project_module.Project([
- os.path.normpath('/x/y'), os.path.normpath('/x/raw/')])
- loader = resource_loader.ResourceLoader(project)
- with fs:
- my_module = loader.LoadModule(module_name='z.foo')
- self.assertEquals(1, len(my_module.dependent_raw_scripts))
-
- dependent_filenames = my_module.GetAllDependentFilenamesRecursive()
- self.assertEquals(
- [
- os.path.normpath('/x/y/z/foo.html'),
- os.path.normpath('/x/raw/bar.js'),
- os.path.normpath('/x/y/z/foo.css'),
- os.path.normpath('/x/y/z/foo.jpeg'),
- os.path.normpath('/x/y/z/foo2.html'),
- ],
- dependent_filenames)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/parse_html_deps.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/parse_html_deps.py
deleted file mode 100644
index 6fbe31daac4..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/parse_html_deps.py
+++ /dev/null
@@ -1,216 +0,0 @@
-# Copyright (c) 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import sys
-
-from py_vulcanize import module
-from py_vulcanize import strip_js_comments
-from py_vulcanize import html_generation_controller
-
-
-def _AddToPathIfNeeded(path):
- if path not in sys.path:
- sys.path.insert(0, path)
-
-
-def _InitBeautifulSoup():
- catapult_path = os.path.abspath(
- os.path.join(os.path.dirname(__file__),
- os.path.pardir, os.path.pardir, os.path.pardir))
- bs_path = os.path.join(catapult_path, 'third_party', 'beautifulsoup4')
- _AddToPathIfNeeded(bs_path)
-
- html5lib_path = os.path.join(catapult_path, 'third_party', 'html5lib-python')
- _AddToPathIfNeeded(html5lib_path)
-
- six_path = os.path.join(catapult_path, 'third_party', 'six')
- _AddToPathIfNeeded(six_path)
-
-
-_InitBeautifulSoup()
-import bs4
-
-
-class InlineScript(object):
-
- def __init__(self, soup):
- if not soup:
- raise module.DepsException('InlineScript created without soup')
- self._soup = soup
- self._stripped_contents = None
- self._open_tags = None
-
- @property
- def contents(self):
- return unicode(self._soup.string)
-
- @property
- def stripped_contents(self):
- if not self._stripped_contents:
- self._stripped_contents = strip_js_comments.StripJSComments(
- self.contents)
- return self._stripped_contents
-
- @property
- def open_tags(self):
- if self._open_tags:
- return self._open_tags
- open_tags = []
- cur = self._soup.parent
- while cur:
- if isinstance(cur, bs4.BeautifulSoup):
- break
-
- open_tags.append(_Tag(cur.name, cur.attrs))
- cur = cur.parent
-
- open_tags.reverse()
- assert open_tags[-1].tag == 'script'
- del open_tags[-1]
-
- self._open_tags = open_tags
- return self._open_tags
-
-
-def _CreateSoupWithoutHeadOrBody(html):
- soupCopy = bs4.BeautifulSoup(html, 'html5lib')
- soup = bs4.BeautifulSoup()
- soup.reset()
- if soupCopy.head:
- for n in soupCopy.head.contents:
- n.extract()
- soup.append(n)
- if soupCopy.body:
- for n in soupCopy.body.contents:
- n.extract()
- soup.append(n)
- return soup
-
-
-class HTMLModuleParserResults(object):
-
- def __init__(self, html):
- self._soup = bs4.BeautifulSoup(html, 'html5lib')
- self._inline_scripts = None
-
- @property
- def scripts_external(self):
- tags = self._soup.findAll('script', src=True)
- return [t['src'] for t in tags]
-
- @property
- def inline_scripts(self):
- if not self._inline_scripts:
- tags = self._soup.findAll('script', src=None)
- self._inline_scripts = [InlineScript(t.string) for t in tags]
- return self._inline_scripts
-
- @property
- def imports(self):
- tags = self._soup.findAll('link', rel='import')
- return [t['href'] for t in tags]
-
- @property
- def stylesheets(self):
- tags = self._soup.findAll('link', rel='stylesheet')
- return [t['href'] for t in tags]
-
- @property
- def inline_stylesheets(self):
- tags = self._soup.findAll('style')
- return [unicode(t.string) for t in tags]
-
- def YieldHTMLInPieces(self, controller, minify=False):
- yield self.GenerateHTML(controller, minify)
-
- def GenerateHTML(self, controller, minify=False, prettify=False):
- soup = _CreateSoupWithoutHeadOrBody(unicode(self._soup))
-
- # Remove declaration.
- for x in soup.contents:
- if isinstance(x, bs4.Doctype):
- x.extract()
-
- # Remove declaration.
- for x in soup.contents:
- if isinstance(x, bs4.Declaration):
- x.extract()
-
- # Remove all imports.
- imports = soup.findAll('link', rel='import')
- for imp in imports:
- imp.extract()
-
- # Remove all script links.
- scripts_external = soup.findAll('script', src=True)
- for script in scripts_external:
- script.extract()
-
- # Remove all in-line scripts.
- scripts_external = soup.findAll('script', src=None)
- for script in scripts_external:
- script.extract()
-
- # Process all in-line styles.
- inline_styles = soup.findAll('style')
- for style in inline_styles:
- html = controller.GetHTMLForInlineStylesheet(unicode(style.string))
- if html:
- ns = soup.new_tag('style')
- ns.append(bs4.NavigableString(html))
- style.replaceWith(ns)
- else:
- style.extract()
-
- # Rewrite all external stylesheet hrefs or remove, as needed.
- stylesheet_links = soup.findAll('link', rel='stylesheet')
- for stylesheet_link in stylesheet_links:
- html = controller.GetHTMLForStylesheetHRef(stylesheet_link['href'])
- if html:
- tmp = bs4.BeautifulSoup(html, 'html5lib').findAll('style')
- assert len(tmp) == 1
- stylesheet_link.replaceWith(tmp[0])
- else:
- stylesheet_link.extract()
-
- # Remove comments if minifying.
- if minify:
- comments = soup.findAll(
- text=lambda text: isinstance(text, bs4.Comment))
- for comment in comments:
- comment.extract()
- if prettify:
- return soup.prettify('utf-8').strip()
-
- # We are done.
- return unicode(soup).strip()
-
- @property
- def html_contents_without_links_and_script(self):
- return self.GenerateHTML(
- html_generation_controller.HTMLGenerationController())
-
-
-class _Tag(object):
-
- def __init__(self, tag, attrs):
- self.tag = tag
- self.attrs = attrs
-
- def __repr__(self):
- attr_string = ' '.join('%s="%s"' % (x[0], x[1]) for x in self.attrs)
- return '<%s %s>' % (self.tag, attr_string)
-
-
-class HTMLModuleParser():
-
- def Parse(self, html):
- if html is None:
- html = ''
- else:
- if html.find('< /script>') != -1:
- raise Exception('Escape script tags with <\/script>')
-
- return HTMLModuleParserResults(html)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/parse_html_deps_unittest.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/parse_html_deps_unittest.py
deleted file mode 100755
index 2e479aeb498..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/parse_html_deps_unittest.py
+++ /dev/null
@@ -1,274 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import re
-import unittest
-
-from py_vulcanize import parse_html_deps
-from py_vulcanize import html_generation_controller
-
-
-class ParseTests(unittest.TestCase):
-
- def test_parse_empty(self):
- parser = parse_html_deps.HTMLModuleParser()
- module = parser.Parse('')
- self.assertEquals([], module.scripts_external)
- self.assertEquals([], module.inline_scripts)
- self.assertEquals([], module.stylesheets)
- self.assertEquals([], module.imports)
-
- def test_parse_none(self):
- parser = parse_html_deps.HTMLModuleParser()
- module = parser.Parse(None)
- self.assertEquals([], module.scripts_external)
- self.assertEquals([], module.inline_scripts)
- self.assertEquals([], module.stylesheets)
- self.assertEquals([], module.imports)
-
- def test_parse_script_src_basic(self):
- html = """<!DOCTYPE html>
- <html>
- <head>
- <script src="polymer.min.js"></script>
- <script src="foo.js"></script>
- </head>
- <body>
- </body>
- </html>"""
- parser = parse_html_deps.HTMLModuleParser()
- module = parser.Parse(html)
- self.assertEquals(['polymer.min.js', 'foo.js'], module.scripts_external)
- self.assertEquals([], module.inline_scripts)
- self.assertEquals([], module.stylesheets)
- self.assertEquals([], module.imports)
- self.assertNotIn(
- 'DOCTYPE html',
- module.html_contents_without_links_and_script)
-
- def test_parse_link_rel_import(self):
- html = """<!DOCTYPE html>
- <html>
- <head>
- <link rel="import" href="x-foo.html">
- </head>
- <body>
- </body>
- </html>"""
- parser = parse_html_deps.HTMLModuleParser()
- module = parser.Parse(html)
- self.assertEquals([], module.scripts_external)
- self.assertEquals([], module.inline_scripts)
- self.assertEquals([], module.stylesheets)
- self.assertEquals(['x-foo.html'], module.imports)
-
- def test_parse_script_inline(self):
- html = """<polymer-element name="tk-element-proto">
- <template>
- </template>
- <script>
- py_vulcanize.require("foo");
- py_vulcanize.require('bar');
- </script>
- </polymer-element>"""
-
- parser = parse_html_deps.HTMLModuleParser()
- module = parser.Parse(html)
- self.assertEquals([], module.scripts_external)
- self.assertEquals(1, len(module.inline_scripts))
- self.assertEquals([], module.stylesheets)
- self.assertEquals([], module.imports)
-
- script0 = module.inline_scripts[0]
- val = re.sub(r'\s+', '', script0.contents)
- inner_script = """py_vulcanize.require("foo");py_vulcanize.require('bar');"""
- self.assertEquals(inner_script, val)
-
- self.assertEquals(3, len(script0.open_tags))
- self.assertEquals('polymer-element', script0.open_tags[2].tag)
-
- self.assertNotIn(
- 'py_vulcanize.require("foo");',
- module.html_contents_without_links_and_script)
-
- def test_parse_script_src_sripping(self):
- html = """
-<script src="blah.js"></script>
-"""
- module = parse_html_deps.HTMLModuleParser().Parse(html)
- self.assertEquals('',
- module.html_contents_without_links_and_script)
-
- def test_parse_link_rel_stylesheet(self):
- html = """<polymer-element name="hi">
- <template>
- <link rel="stylesheet" href="frameworkstyles.css">
- </template>
- </polymer-element>"""
- parser = parse_html_deps.HTMLModuleParser()
- module = parser.Parse(html)
- self.assertEquals([], module.scripts_external)
- self.assertEquals([], module.inline_scripts)
- self.assertEquals(['frameworkstyles.css'], module.stylesheets)
- self.assertEquals([], module.imports)
-
- class Ctl(html_generation_controller.HTMLGenerationController):
-
- def GetHTMLForStylesheetHRef(self, href):
- if href == 'frameworkstyles.css':
- return '<style>FRAMEWORK</style>'
- return None
-
- gen_html = module.GenerateHTML(Ctl())
- ghtm = """<polymer-element name="hi">
- <template>
- <style>FRAMEWORK</style>
- </template>
- </polymer-element>"""
- self.assertEquals(ghtm, gen_html)
-
- def test_parse_inline_style(self):
- html = """<style>
- hello
-</style>"""
- module = parse_html_deps.HTMLModuleParser().Parse(html)
- self.assertEquals(html, module.html_contents_without_links_and_script)
-
- class Ctl(html_generation_controller.HTMLGenerationController):
-
- def GetHTMLForInlineStylesheet(self, contents):
- if contents == '\n hello\n':
- return '\n HELLO\n'
- return None
-
- gen_html = module.GenerateHTML(Ctl())
- ghtm = """<style>
- HELLO
-</style>"""
- self.assertEquals(ghtm, gen_html)
-
- def test_parse_style_import(self):
- html = """<polymer-element name="x-blink">
- <template>
- <style>
- @import url(awesome.css);
- </style>
- </template>
- </polymer-element>"""
- parser = parse_html_deps.HTMLModuleParser()
- self.assertRaises(lambda: parser.Parse(html))
-
- def test_nested_templates(self):
- orig_html = """<template>
- <template>
- <div id="foo"></div>
- </template>
- </template>"""
- parser = parse_html_deps.HTMLModuleParser()
- res = parser.Parse(orig_html)
- html = res.html_contents_without_links_and_script
- self.assertEquals(html, orig_html)
-
- def test_html_contents_basic(self):
- html = """<a b="c">d</a>"""
- parser = parse_html_deps.HTMLModuleParser()
- module = parser.Parse(html)
- self.assertEquals(html, module.html_contents_without_links_and_script)
-
- def test_html_contents_with_entity(self):
- html = """<a>&rarr;</a>"""
- parser = parse_html_deps.HTMLModuleParser()
- module = parser.Parse(html)
- self.assertEquals(u'<a>\u2192</a>',
- module.html_contents_without_links_and_script)
-
- def test_html_content_with_charref(self):
- html = """<a>&#62;</a>"""
- parser = parse_html_deps.HTMLModuleParser()
- module = parser.Parse(html)
- self.assertEquals('<a>&gt;</a>',
- module.html_contents_without_links_and_script)
-
- def test_html_content_start_end_br(self):
- html = """<a><br /></a>"""
- parser = parse_html_deps.HTMLModuleParser()
- module = parser.Parse(html)
- self.assertEquals('<a><br/></a>',
- module.html_contents_without_links_and_script)
-
- def test_html_content_start_end_img(self):
- html = """<a><img src="foo.png" id="bar" /></a>"""
- parser = parse_html_deps.HTMLModuleParser()
- module = parser.Parse(html)
- self.assertEquals('<a><img id="bar" src="foo.png"/></a>',
- module.html_contents_without_links_and_script)
-
- def test_html_contents_with_link_stripping(self):
- html = """<a b="c">d</a>
- <link rel="import" href="x-foo.html">"""
- parser = parse_html_deps.HTMLModuleParser()
- module = parser.Parse(html)
- self.assertEquals("""<a b="c">d</a>""",
- module.html_contents_without_links_and_script.strip())
-
- def test_html_contents_with_style_link_stripping(self):
- html = """<a b="c">d</a>
- <link rel="stylesheet" href="frameworkstyles.css">"""
- parser = parse_html_deps.HTMLModuleParser()
- module = parser.Parse(html)
- self.assertEquals("""<a b="c">d</a>""",
- module.html_contents_without_links_and_script.strip())
-
- def test_br_does_not_raise(self):
- html = """<div><br/></div>"""
- parser = parse_html_deps.HTMLModuleParser()
- parser.Parse(html)
-
- def test_p_does_not_raises(self):
- html = """<div></p></div>"""
- parser = parse_html_deps.HTMLModuleParser()
- parser.Parse(html)
-
- def test_link_endlink_does_not_raise(self):
- html = """<link rel="stylesheet" href="foo.css"></link>"""
- parser = parse_html_deps.HTMLModuleParser()
- parser.Parse(html)
-
- def test_link_script_does_not_raise(self):
- html = """<link rel="stylesheet" href="foo.css">
- <script>
- </script>"""
- parser = parse_html_deps.HTMLModuleParser()
- parser.Parse(html)
-
- def test_script_with_script_inside_as_js(self):
- html = """<script>
- var html_lines = [
- '<script>',
- '<\/script>',
- ];
- </script>"""
- parser = parse_html_deps.HTMLModuleParser()
- parser.Parse(html)
-
- def test_invalid_script_escaping_raises(self):
- html = """<script>
- var html_lines = [
- '<script>',
- '< /script>',
- ];
- </script>"""
- parser = parse_html_deps.HTMLModuleParser()
-
- def DoIt():
- parser.Parse(html)
- self.assertRaises(Exception, DoIt)
-
- def test_script_with_cdata(self):
- html = """<script></h2></script>"""
- parser = parse_html_deps.HTMLModuleParser()
- module = parser.Parse(html)
- self.assertEquals(1, len(module.inline_scripts))
- self.assertEquals('</h2>', module.inline_scripts[0].contents)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/project.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/project.py
deleted file mode 100644
index 034796462c8..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/project.py
+++ /dev/null
@@ -1,229 +0,0 @@
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import collections
-import os
-import cStringIO
-
-from py_vulcanize import resource_loader
-
-
-def _FindAllFilesRecursive(source_paths):
- all_filenames = set()
- for source_path in source_paths:
- for dirpath, _, filenames in os.walk(source_path):
- for f in filenames:
- if f.startswith('.'):
- continue
- x = os.path.abspath(os.path.join(dirpath, f))
- all_filenames.add(x)
- return all_filenames
-
-
-class AbsFilenameList(object):
-
- def __init__(self, willDirtyCallback):
- self._willDirtyCallback = willDirtyCallback
- self._filenames = []
- self._filenames_set = set()
-
- def _WillBecomeDirty(self):
- if self._willDirtyCallback:
- self._willDirtyCallback()
-
- def append(self, filename):
- assert os.path.isabs(filename)
- self._WillBecomeDirty()
- self._filenames.append(filename)
- self._filenames_set.add(filename)
-
- def extend(self, iterable):
- self._WillBecomeDirty()
- for filename in iterable:
- assert os.path.isabs(filename)
- self._filenames.append(filename)
- self._filenames_set.add(filename)
-
- def appendRel(self, basedir, filename):
- assert os.path.isabs(basedir)
- self._WillBecomeDirty()
- n = os.path.abspath(os.path.join(basedir, filename))
- self._filenames.append(n)
- self._filenames_set.add(n)
-
- def extendRel(self, basedir, iterable):
- self._WillBecomeDirty()
- assert os.path.isabs(basedir)
- for filename in iterable:
- n = os.path.abspath(os.path.join(basedir, filename))
- self._filenames.append(n)
- self._filenames_set.add(n)
-
- def __contains__(self, x):
- return x in self._filenames_set
-
- def __len__(self):
- return self._filenames.__len__()
-
- def __iter__(self):
- return iter(self._filenames)
-
- def __repr__(self):
- return repr(self._filenames)
-
- def __str__(self):
- return str(self._filenames)
-
-
-class Project(object):
-
- py_vulcanize_path = os.path.abspath(os.path.join(
- os.path.dirname(__file__), '..'))
-
- def __init__(self, source_paths=None):
- """
- source_paths: A list of top-level directories in which modules and raw
- scripts can be found. Module paths are relative to these directories.
- """
- self._loader = None
- self._frozen = False
- self.source_paths = AbsFilenameList(self._WillPartOfPathChange)
-
- if source_paths is not None:
- self.source_paths.extend(source_paths)
-
- def Freeze(self):
- self._frozen = True
-
- def _WillPartOfPathChange(self):
- if self._frozen:
- raise Exception('The project is frozen. You cannot edit it now')
- self._loader = None
-
- @staticmethod
- def FromDict(d):
- return Project(d['source_paths'])
-
- def AsDict(self):
- return {
- 'source_paths': list(self.source_paths)
- }
-
- def __repr__(self):
- return "Project(%s)" % repr(self.source_paths)
-
- def AddSourcePath(self, path):
- self.source_paths.append(path)
-
- @property
- def loader(self):
- if self._loader is None:
- self._loader = resource_loader.ResourceLoader(self)
- return self._loader
-
- def ResetLoader(self):
- self._loader = None
-
- def _Load(self, filenames):
- return [self.loader.LoadModule(module_filename=filename) for
- filename in filenames]
-
- def LoadModule(self, module_name=None, module_filename=None):
- return self.loader.LoadModule(module_name=module_name,
- module_filename=module_filename)
-
- def CalcLoadSequenceForModuleNames(self, module_names):
- modules = [self.loader.LoadModule(module_name=name) for
- name in module_names]
- return self.CalcLoadSequenceForModules(modules)
-
- def CalcLoadSequenceForModules(self, modules):
- already_loaded_set = set()
- load_sequence = []
- for m in modules:
- m.ComputeLoadSequenceRecursive(load_sequence, already_loaded_set)
- return load_sequence
-
- def GetDepsGraphFromModuleNames(self, module_names):
- modules = [self.loader.LoadModule(module_name=name) for
- name in module_names]
- return self.GetDepsGraphFromModules(modules)
-
- def GetDepsGraphFromModules(self, modules):
- load_sequence = self.CalcLoadSequenceForModules(modules)
- g = _Graph()
- for m in load_sequence:
- g.AddModule(m)
-
- for dep in m.dependent_modules:
- g.AddEdge(m, dep.id)
-
- # FIXME: _GetGraph is not defined. Maybe `return g` is intended?
- return _GetGraph(load_sequence)
-
- def GetDominatorGraphForModulesNamed(self, module_names, load_sequence):
- modules = [self.loader.LoadModule(module_name=name)
- for name in module_names]
- return self.GetDominatorGraphForModules(modules, load_sequence)
-
- def GetDominatorGraphForModules(self, start_modules, load_sequence):
- modules_by_id = {}
- for m in load_sequence:
- modules_by_id[m.id] = m
-
- module_referrers = collections.defaultdict(list)
- for m in load_sequence:
- for dep in m.dependent_modules:
- module_referrers[dep].append(m)
-
- # Now start at the top module and reverse.
- visited = set()
- g = _Graph()
-
- pending = collections.deque()
- pending.extend(start_modules)
- while len(pending):
- cur = pending.pop()
-
- g.AddModule(cur)
- visited.add(cur)
-
- for out_dep in module_referrers[cur]:
- if out_dep in visited:
- continue
- g.AddEdge(out_dep, cur)
- visited.add(out_dep)
- pending.append(out_dep)
-
- # Visited -> Dot
- return g.GetDot()
-
-
-class _Graph(object):
-
- def __init__(self):
- self.nodes = []
- self.edges = []
-
- def AddModule(self, m):
- f = cStringIO.StringIO()
- m.AppendJSContentsToFile(f, False, None)
-
- attrs = {
- 'label': '%s (%i)' % (m.name, f.tell())
- }
-
- f.close()
-
- attr_items = ['%s="%s"' % (x, y) for x, y in attrs.iteritems()]
- node = 'M%i [%s];' % (m.id, ','.join(attr_items))
- self.nodes.append(node)
-
- def AddEdge(self, mFrom, mTo):
- edge = 'M%i -> M%i;' % (mFrom.id, mTo.id)
- self.edges.append(edge)
-
- def GetDot(self):
- return 'digraph deps {\n\n%s\n\n%s\n}\n' % (
- '\n'.join(self.nodes), '\n'.join(self.edges))
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/resource.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/resource.py
deleted file mode 100644
index 853dff94437..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/resource.py
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""A Resource is a file and its various associated canonical names."""
-
-import codecs
-import os
-
-
-class Resource(object):
- """Represents a file found via a path search."""
-
- def __init__(self, toplevel_dir, absolute_path, binary=False):
- self.toplevel_dir = toplevel_dir
- self.absolute_path = absolute_path
- self._contents = None
- self._binary = binary
-
- @property
- def relative_path(self):
- """The path to the file from the top-level directory"""
- return os.path.relpath(self.absolute_path, self.toplevel_dir)
-
- @property
- def unix_style_relative_path(self):
- return self.relative_path.replace(os.sep, '/')
-
- @property
- def name(self):
- """The dotted name for this resource based on its relative path."""
- return self.name_from_relative_path(self.relative_path)
-
- @staticmethod
- def name_from_relative_path(relative_path):
- dirname = os.path.dirname(relative_path)
- basename = os.path.basename(relative_path)
- modname = os.path.splitext(basename)[0]
- if len(dirname):
- name = dirname.replace(os.path.sep, '.') + '.' + modname
- else:
- name = modname
- return name
-
- @property
- def contents(self):
- if self._contents:
- return self._contents
- if not os.path.exists(self.absolute_path):
- raise Exception('%s not found.' % self.absolute_path)
- if self._binary:
- f = open(self.absolute_path, mode='rb')
- else:
- f = codecs.open(self.absolute_path, mode='r', encoding='utf-8')
- self._contents = f.read()
- f.close()
- return self._contents
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/resource_loader.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/resource_loader.py
deleted file mode 100644
index 7b5edac8f9f..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/resource_loader.py
+++ /dev/null
@@ -1,227 +0,0 @@
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""ResourceFinder is a helper class for finding resources given their name."""
-
-import codecs
-import os
-
-from py_vulcanize import module
-from py_vulcanize import style_sheet as style_sheet_module
-from py_vulcanize import resource as resource_module
-from py_vulcanize import html_module
-from py_vulcanize import strip_js_comments
-
-
-class ResourceLoader(object):
- """Manges loading modules and their dependencies from files.
-
- Modules handle parsing and the construction of their individual dependency
- pointers. The loader deals with bookkeeping of what has been loaded, and
- mapping names to file resources.
- """
-
- def __init__(self, project):
- self.project = project
- self.stripped_js_by_filename = {}
- self.loaded_modules = {}
- self.loaded_raw_scripts = {}
- self.loaded_style_sheets = {}
- self.loaded_images = {}
-
- @property
- def source_paths(self):
- """A list of base directories to search for modules under."""
- return self.project.source_paths
-
- def FindResource(self, some_path, binary=False):
- """Finds a Resource for the given path.
-
- Args:
- some_path: A relative or absolute path to a file.
-
- Returns:
- A Resource or None.
- """
- if os.path.isabs(some_path):
- return self.FindResourceGivenAbsolutePath(some_path, binary)
- else:
- return self.FindResourceGivenRelativePath(some_path, binary)
-
- def FindResourceGivenAbsolutePath(self, absolute_path, binary=False):
- """Returns a Resource for the given absolute path."""
- candidate_paths = []
- for source_path in self.source_paths:
- if absolute_path.startswith(source_path):
- candidate_paths.append(source_path)
- if len(candidate_paths) == 0:
- return None
-
- # Sort by length. Longest match wins.
- candidate_paths.sort(lambda x, y: len(x) - len(y))
- longest_candidate = candidate_paths[-1]
- return resource_module.Resource(longest_candidate, absolute_path, binary)
-
- def FindResourceGivenRelativePath(self, relative_path, binary=False):
- """Returns a Resource for the given relative path."""
- absolute_path = None
- for script_path in self.source_paths:
- absolute_path = os.path.join(script_path, relative_path)
- if os.path.exists(absolute_path):
- return resource_module.Resource(script_path, absolute_path, binary)
- return None
-
- def _FindResourceGivenNameAndSuffix(
- self, requested_name, extension, return_resource=False):
- """Searches for a file and reads its contents.
-
- Args:
- requested_name: The name of the resource that was requested.
- extension: The extension for this requested resource.
-
- Returns:
- A (path, contents) pair.
- """
- pathy_name = requested_name.replace('.', os.sep)
- filename = pathy_name + extension
-
- resource = self.FindResourceGivenRelativePath(filename)
- if return_resource:
- return resource
- if not resource:
- return None, None
- return _read_file(resource.absolute_path)
-
- def FindModuleResource(self, requested_module_name):
- """Finds a module javascript file and returns a Resource, or none."""
- js_resource = self._FindResourceGivenNameAndSuffix(
- requested_module_name, '.js', return_resource=True)
- html_resource = self._FindResourceGivenNameAndSuffix(
- requested_module_name, '.html', return_resource=True)
- if js_resource and html_resource:
- if html_module.IsHTMLResourceTheModuleGivenConflictingResourceNames(
- js_resource, html_resource):
- return html_resource
- return js_resource
- elif js_resource:
- return js_resource
- return html_resource
-
- def LoadModule(self, module_name=None, module_filename=None):
- assert bool(module_name) ^ bool(module_filename), (
- 'Must provide either module_name or module_filename.')
- if module_filename:
- resource = self.FindResource(module_filename)
- if not resource:
- raise Exception('Could not find %s in %s' % (
- module_filename, repr(self.source_paths)))
- module_name = resource.name
- else:
- resource = None # Will be set if we end up needing to load.
-
- if module_name in self.loaded_modules:
- assert self.loaded_modules[module_name].contents
- return self.loaded_modules[module_name]
-
- if not resource: # happens when module_name was given
- resource = self.FindModuleResource(module_name)
- if not resource:
- raise module.DepsException('No resource for module "%s"' % module_name)
-
- m = html_module.HTMLModule(self, module_name, resource)
- self.loaded_modules[module_name] = m
-
- # Fake it, this is probably either polymer.min.js or platform.js which are
- # actually .js files....
- if resource.absolute_path.endswith('.js'):
- return m
-
- m.Parse()
- m.Load()
- return m
-
- def LoadRawScript(self, relative_raw_script_path):
- resource = None
- for source_path in self.source_paths:
- possible_absolute_path = os.path.join(
- source_path, os.path.normpath(relative_raw_script_path))
- if os.path.exists(possible_absolute_path):
- resource = resource_module.Resource(
- source_path, possible_absolute_path)
- break
- if not resource:
- raise module.DepsException(
- 'Could not find a file for raw script %s in %s' %
- (relative_raw_script_path, self.source_paths))
- assert relative_raw_script_path == resource.unix_style_relative_path, (
- 'Expected %s == %s' % (relative_raw_script_path,
- resource.unix_style_relative_path))
-
- if resource.absolute_path in self.loaded_raw_scripts:
- return self.loaded_raw_scripts[resource.absolute_path]
-
- raw_script = module.RawScript(resource)
- self.loaded_raw_scripts[resource.absolute_path] = raw_script
- return raw_script
-
- def LoadStyleSheet(self, name):
- if name in self.loaded_style_sheets:
- return self.loaded_style_sheets[name]
-
- resource = self._FindResourceGivenNameAndSuffix(
- name, '.css', return_resource=True)
- if not resource:
- raise module.DepsException(
- 'Could not find a file for stylesheet %s' % name)
-
- style_sheet = style_sheet_module.StyleSheet(self, name, resource)
- style_sheet.load()
- self.loaded_style_sheets[name] = style_sheet
- return style_sheet
-
- def LoadImage(self, abs_path):
- if abs_path in self.loaded_images:
- return self.loaded_images[abs_path]
-
- if not os.path.exists(abs_path):
- raise module.DepsException("url('%s') did not exist" % abs_path)
-
- res = self.FindResourceGivenAbsolutePath(abs_path, binary=True)
- if res is None:
- raise module.DepsException("url('%s') was not in search path" % abs_path)
-
- image = style_sheet_module.Image(res)
- self.loaded_images[abs_path] = image
- return image
-
- def GetStrippedJSForFilename(self, filename, early_out_if_no_py_vulcanize):
- if filename in self.stripped_js_by_filename:
- return self.stripped_js_by_filename[filename]
-
- with open(filename, 'r') as f:
- contents = f.read(4096)
- if early_out_if_no_py_vulcanize and ('py_vulcanize' not in contents):
- return None
-
- s = strip_js_comments.StripJSComments(contents)
- self.stripped_js_by_filename[filename] = s
- return s
-
-
-def _read_file(absolute_path):
- """Reads a file and returns a (path, contents) pair.
-
- Args:
- absolute_path: Absolute path to a file.
-
- Raises:
- Exception: The given file doesn't exist.
- IOError: There was a problem opening or reading the file.
- """
- if not os.path.exists(absolute_path):
- raise Exception('%s not found.' % absolute_path)
- f = codecs.open(absolute_path, mode='r', encoding='utf-8')
- contents = f.read()
- f.close()
- return absolute_path, contents
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/resource_unittest.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/resource_unittest.py
deleted file mode 100644
index 4da23556f24..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/resource_unittest.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import unittest
-
-from py_vulcanize import resource
-
-
-class ResourceUnittest(unittest.TestCase):
-
- def testBasic(self):
- r = resource.Resource('/a', '/a/b/c.js')
- self.assertEquals('b.c', r.name)
- self.assertEquals(os.path.join('b', 'c.js'), r.relative_path)
- self.assertEquals('b/c.js', r.unix_style_relative_path)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/strip_js_comments.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/strip_js_comments.py
deleted file mode 100644
index d63c667531a..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/strip_js_comments.py
+++ /dev/null
@@ -1,81 +0,0 @@
-# Copyright 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Utility function for stripping comments out of JavaScript source code."""
-
-import re
-
-
-def _TokenizeJS(text):
- """Splits source code text into segments in preparation for comment stripping.
-
- Note that this doesn't tokenize for parsing. There is no notion of statements,
- variables, etc. The only tokens of interest are comment-related tokens.
-
- Args:
- text: The contents of a JavaScript file.
-
- Yields:
- A succession of strings in the file, including all comment-related symbols.
- """
- rest = text
- tokens = ['//', '/*', '*/', '\n']
- next_tok = re.compile('|'.join(re.escape(x) for x in tokens))
- while len(rest):
- m = next_tok.search(rest)
- if not m:
- # end of string
- yield rest
- return
- min_index = m.start()
- end_index = m.end()
-
- if min_index > 0:
- yield rest[:min_index]
-
- yield rest[min_index:end_index]
- rest = rest[end_index:]
-
-
-def StripJSComments(text):
- """Strips comments out of JavaScript source code.
-
- Args:
- text: JavaScript source text.
-
- Returns:
- JavaScript source text with comments stripped out.
- """
- result_tokens = []
- token_stream = _TokenizeJS(text).__iter__()
- while True:
- try:
- t = token_stream.next()
- except StopIteration:
- break
-
- if t == '//':
- while True:
- try:
- t2 = token_stream.next()
- if t2 == '\n':
- break
- except StopIteration:
- break
- elif t == '/*':
- nesting = 1
- while True:
- try:
- t2 = token_stream.next()
- if t2 == '/*':
- nesting += 1
- elif t2 == '*/':
- nesting -= 1
- if nesting == 0:
- break
- except StopIteration:
- break
- else:
- result_tokens.append(t)
- return ''.join(result_tokens)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/strip_js_comments_unittest.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/strip_js_comments_unittest.py
deleted file mode 100644
index 685cb824a24..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/strip_js_comments_unittest.py
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Tests for strip_js_comments module."""
-
-import unittest
-
-from py_vulcanize import strip_js_comments
-
-
-# This test case tests a protected method.
-# pylint: disable=W0212
-class JavaScriptStripCommentTests(unittest.TestCase):
- """Test case for _strip_js_comments and _TokenizeJS."""
-
- def test_strip_comments(self):
- self.assertEquals(
- 'A ', strip_js_comments.StripJSComments('A // foo'))
- self.assertEquals(
- 'A bar', strip_js_comments.StripJSComments('A // foo\nbar'))
- self.assertEquals(
- 'A b', strip_js_comments.StripJSComments('A /* foo */ b'))
- self.assertEquals(
- 'A b', strip_js_comments.StripJSComments('A /* foo\n */ b'))
-
- def test_tokenize_empty(self):
- tokens = list(strip_js_comments._TokenizeJS(''))
- self.assertEquals([], tokens)
-
- def test_tokenize_nl(self):
- tokens = list(strip_js_comments._TokenizeJS('\n'))
- self.assertEquals(['\n'], tokens)
-
- def test_tokenize_slashslash_comment(self):
- tokens = list(strip_js_comments._TokenizeJS('A // foo'))
- self.assertEquals(['A ', '//', ' foo'], tokens)
-
- def test_tokenize_slashslash_comment_then_newline(self):
- tokens = list(strip_js_comments._TokenizeJS('A // foo\nbar'))
- self.assertEquals(['A ', '//', ' foo', '\n', 'bar'], tokens)
-
- def test_tokenize_cstyle_comment_one_line(self):
- tokens = list(strip_js_comments._TokenizeJS('A /* foo */'))
- self.assertEquals(['A ', '/*', ' foo ', '*/'], tokens)
-
- def test_tokenize_cstyle_comment_multi_line(self):
- tokens = list(strip_js_comments._TokenizeJS('A /* foo\n*bar\n*/'))
- self.assertEquals(['A ', '/*', ' foo', '\n', '*bar', '\n', '*/'], tokens)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/style_sheet.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/style_sheet.py
deleted file mode 100644
index 5338762588e..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/style_sheet.py
+++ /dev/null
@@ -1,138 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import base64
-import os
-import re
-
-
-class Image(object):
-
- def __init__(self, resource):
- self.resource = resource
- self.aliases = []
-
- @property
- def relative_path(self):
- return self.resource.relative_path
-
- @property
- def absolute_path(self):
- return self.resource.absolute_path
-
- @property
- def contents(self):
- return self.resource.contents
-
-
-class ParsedStyleSheet(object):
-
- def __init__(self, loader, containing_dirname, contents):
- self.loader = loader
- self.contents = contents
- self._images = None
- self._Load(containing_dirname)
-
- @property
- def images(self):
- return self._images
-
- def AppendDirectlyDependentFilenamesTo(self, dependent_filenames):
- for i in self.images:
- dependent_filenames.append(i.resource.absolute_path)
-
- @property
- def contents_with_inlined_images(self):
- images_by_url = {}
- for i in self.images:
- for a in i.aliases:
- images_by_url[a] = i
-
- def InlineUrl(m):
- url = m.group('url')
- image = images_by_url[url]
-
- ext = os.path.splitext(image.absolute_path)[1]
- data = base64.standard_b64encode(image.contents)
-
- return 'url(data:image/%s;base64,%s)' % (ext[1:], data)
-
- # I'm assuming we only have url()'s associated with images
- return re.sub('url\((?P<quote>"|\'|)(?P<url>[^"\'()]*)(?P=quote)\)',
- InlineUrl, self.contents)
-
- def AppendDirectlyDependentFilenamesTo(self, dependent_filenames):
- for i in self.images:
- dependent_filenames.append(i.resource.absolute_path)
-
- def _Load(self, containing_dirname):
- if self.contents.find('@import') != -1:
- raise Exception('@imports are not supported')
-
- matches = re.findall(
- 'url\((?:["|\']?)([^"\'()]*)(?:["|\']?)\)',
- self.contents)
-
- def resolve_url(url):
- if os.path.isabs(url):
- # FIXME: module is used here, but py_vulcanize.module is never imported.
- # However, py_vulcanize.module cannot be imported since py_vulcanize.module may import
- # style_sheet, leading to an import loop.
- raise module.DepsException('URL references must be relative')
- # URLS are relative to this module's directory
- abs_path = os.path.abspath(os.path.join(containing_dirname, url))
- image = self.loader.LoadImage(abs_path)
- image.aliases.append(url)
- return image
-
- self._images = [resolve_url(x) for x in matches]
-
-
-class StyleSheet(object):
- """Represents a stylesheet resource referenced by a module via the
- base.requireStylesheet(xxx) directive."""
-
- def __init__(self, loader, name, resource):
- self.loader = loader
- self.name = name
- self.resource = resource
- self._parsed_style_sheet = None
-
- @property
- def filename(self):
- return self.resource.absolute_path
-
- @property
- def contents(self):
- return self.resource.contents
-
- def __repr__(self):
- return 'StyleSheet(%s)' % self.name
-
- @property
- def images(self):
- self._InitParsedStyleSheetIfNeeded()
- return self._parsed_style_sheet.images
-
- def AppendDirectlyDependentFilenamesTo(self, dependent_filenames):
- self._InitParsedStyleSheetIfNeeded()
-
- dependent_filenames.append(self.resource.absolute_path)
- self._parsed_style_sheet.AppendDirectlyDependentFilenamesTo(
- dependent_filenames)
-
- @property
- def contents_with_inlined_images(self):
- self._InitParsedStyleSheetIfNeeded()
- return self._parsed_style_sheet.contents_with_inlined_images
-
- def load(self):
- self._InitParsedStyleSheetIfNeeded()
-
- def _InitParsedStyleSheetIfNeeded(self):
- if self._parsed_style_sheet:
- return
- module_dirname = os.path.dirname(self.resource.absolute_path)
- self._parsed_style_sheet = ParsedStyleSheet(
- self.loader, module_dirname, self.contents)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/style_sheet_unittest.py b/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/style_sheet_unittest.py
deleted file mode 100644
index 4ebc71d5651..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/py_vulcanize/style_sheet_unittest.py
+++ /dev/null
@@ -1,67 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import base64
-import os
-import unittest
-
-from py_vulcanize import project as project_module
-from py_vulcanize import resource_loader
-from py_vulcanize import fake_fs
-from py_vulcanize import module
-
-
-class StyleSheetUnittest(unittest.TestCase):
-
- def testImages(self):
- fs = fake_fs.FakeFS()
- fs.AddFile('/src/foo/x.css', """
-.x .y {
- background-image: url(../images/bar.jpeg);
-}
-""")
- fs.AddFile('/src/images/bar.jpeg', 'hello world')
- with fs:
- project = project_module.Project([os.path.normpath('/src/')])
- loader = resource_loader.ResourceLoader(project)
-
- foo_x = loader.LoadStyleSheet('foo.x')
- self.assertEquals(1, len(foo_x.images))
-
- r0 = foo_x.images[0]
- self.assertEquals(os.path.normpath('/src/images/bar.jpeg'),
- r0.absolute_path)
-
- inlined = foo_x.contents_with_inlined_images
- self.assertEquals("""
-.x .y {
- background-image: url(data:image/jpeg;base64,%s);
-}
-""" % base64.standard_b64encode('hello world'), inlined)
-
- def testURLResolveFails(self):
- fs = fake_fs.FakeFS()
- fs.AddFile('/src/foo/x.css', """
-.x .y {
- background-image: url(../images/missing.jpeg);
-}
-""")
- with fs:
- project = project_module.Project([os.path.normpath('/src')])
- loader = resource_loader.ResourceLoader(project)
-
- self.assertRaises(module.DepsException,
- lambda: loader.LoadStyleSheet('foo.x'))
-
- def testImportsCauseFailure(self):
- fs = fake_fs.FakeFS()
- fs.AddFile('/src/foo/x.css', """
-@import url(awesome.css);
-""")
- with fs:
- project = project_module.Project([os.path.normpath('/src')])
- loader = resource_loader.ResourceLoader(project)
-
- self.assertRaises(Exception,
- lambda: loader.LoadStyleSheet('foo.x'))
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/LICENSE b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/LICENSE
deleted file mode 100644
index 261eeb9e9f8..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/MANIFEST b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/MANIFEST
deleted file mode 100644
index a0384d9c1b4..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/MANIFEST
+++ /dev/null
@@ -1,354 +0,0 @@
-LICENSE
-MANIFEST
-PKG-INFO
-README.rst
-_setup/__init__.py
-_setup/include/cext.h
-_setup/py2/__init__.py
-_setup/py2/commands.py
-_setup/py2/data.py
-_setup/py2/dist.py
-_setup/py2/ext.py
-_setup/py2/setup.py
-_setup/py2/shell.py
-_setup/py2/term/__init__.py
-_setup/py2/term/_term.py
-_setup/py2/util.py
-_setup/py3/__init__.py
-_setup/py3/commands.py
-_setup/py3/data.py
-_setup/py3/dist.py
-_setup/py3/ext.py
-_setup/py3/setup.py
-_setup/py3/shell.py
-_setup/py3/term/__init__.py
-_setup/py3/term/_term.py
-_setup/py3/util.py
-bench
-bench.sh
-bench/LICENSE.cssmin
-bench/__init__.py
-bench/cssmin.py
-bench/main.py
-bench/wikipedia.css
-bench/wikipedia.min.css
-bench/write.py
-docs/BENCHMARKS
-docs/CHANGES
-docs/CLASSIFIERS
-docs/DESCRIPTION
-docs/PROVIDES
-docs/SUMMARY
-docs/apidoc/api-objects.txt
-docs/apidoc/crarr.png
-docs/apidoc/epydoc.css
-docs/apidoc/epydoc.js
-docs/apidoc/help.html
-docs/apidoc/identifier-index.html
-docs/apidoc/index.html
-docs/apidoc/module-tree.html
-docs/apidoc/rcssmin-module.html
-docs/apidoc/rcssmin-pysrc.html
-docs/apidoc/redirect.html
-package.cfg
-rcssmin.c
-rcssmin.py
-run_tests.py
-setup.py
-tests
-tests/main/atgroup_00.css
-tests/main/atgroup_01.css
-tests/main/atgroup_02.css
-tests/main/atgroup_03.css
-tests/main/atgroup_04.css
-tests/main/atgroup_05.css
-tests/main/atgroup_06.css
-tests/main/atgroup_07.css
-tests/main/atgroup_08.css
-tests/main/atgroup_09.css
-tests/main/atgroup_10.css
-tests/main/atgroup_11.css
-tests/main/comment_00.css
-tests/main/comment_01.css
-tests/main/comment_02.css
-tests/main/comment_03.css
-tests/main/comment_04.css
-tests/main/escape_00.css
-tests/main/escape_01.css
-tests/main/escape_02.css
-tests/main/escape_03.css
-tests/main/escape_04.css
-tests/main/escape_05.css
-tests/main/escape_06.css
-tests/main/first_00.css
-tests/main/first_01.css
-tests/main/first_02.css
-tests/main/out/atgroup_00.out
-tests/main/out/atgroup_00.out.b
-tests/main/out/atgroup_01.out
-tests/main/out/atgroup_01.out.b
-tests/main/out/atgroup_02.out
-tests/main/out/atgroup_02.out.b
-tests/main/out/atgroup_03.out
-tests/main/out/atgroup_03.out.b
-tests/main/out/atgroup_04.out
-tests/main/out/atgroup_04.out.b
-tests/main/out/atgroup_05.out
-tests/main/out/atgroup_05.out.b
-tests/main/out/atgroup_06.out
-tests/main/out/atgroup_06.out.b
-tests/main/out/atgroup_07.out
-tests/main/out/atgroup_07.out.b
-tests/main/out/atgroup_08.out
-tests/main/out/atgroup_08.out.b
-tests/main/out/atgroup_09.out
-tests/main/out/atgroup_09.out.b
-tests/main/out/atgroup_10.out
-tests/main/out/atgroup_10.out.b
-tests/main/out/atgroup_11.out
-tests/main/out/atgroup_11.out.b
-tests/main/out/comment_00.out
-tests/main/out/comment_00.out.b
-tests/main/out/comment_01.out
-tests/main/out/comment_01.out.b
-tests/main/out/comment_02.out
-tests/main/out/comment_02.out.b
-tests/main/out/comment_03.out
-tests/main/out/comment_03.out.b
-tests/main/out/comment_04.out
-tests/main/out/comment_04.out.b
-tests/main/out/escape_00.out
-tests/main/out/escape_00.out.b
-tests/main/out/escape_01.out
-tests/main/out/escape_01.out.b
-tests/main/out/escape_02.out
-tests/main/out/escape_02.out.b
-tests/main/out/escape_03.out
-tests/main/out/escape_03.out.b
-tests/main/out/escape_04.out
-tests/main/out/escape_04.out.b
-tests/main/out/escape_05.out
-tests/main/out/escape_05.out.b
-tests/main/out/escape_06.out
-tests/main/out/escape_06.out.b
-tests/main/out/first_00.out
-tests/main/out/first_00.out.b
-tests/main/out/first_01.out
-tests/main/out/first_01.out.b
-tests/main/out/first_02.out
-tests/main/out/first_02.out.b
-tests/main/out/url_00.out
-tests/main/out/url_00.out.b
-tests/main/out/url_01.out
-tests/main/out/url_01.out.b
-tests/main/out/url_02.out
-tests/main/out/url_02.out.b
-tests/main/out/url_03.out
-tests/main/out/url_03.out.b
-tests/main/out/url_04.out
-tests/main/out/url_04.out.b
-tests/main/out/url_05.out
-tests/main/out/url_05.out.b
-tests/main/out/url_06.out
-tests/main/out/url_06.out.b
-tests/main/out/url_07.out
-tests/main/out/url_07.out.b
-tests/main/out/url_08.out
-tests/main/out/url_08.out.b
-tests/main/out/url_09.out
-tests/main/out/url_09.out.b
-tests/main/url_00.css
-tests/main/url_01.css
-tests/main/url_02.css
-tests/main/url_03.css
-tests/main/url_04.css
-tests/main/url_05.css
-tests/main/url_06.css
-tests/main/url_07.css
-tests/main/url_08.css
-tests/main/url_09.css
-tests/yui/README
-tests/yui/background-position.css
-tests/yui/background-position.css.min
-tests/yui/border-none.css
-tests/yui/border-none.css.min
-tests/yui/box-model-hack.css
-tests/yui/box-model-hack.css.min
-tests/yui/bug2527974.css
-tests/yui/bug2527974.css.min
-tests/yui/bug2527991.css
-tests/yui/bug2527991.css.min
-tests/yui/bug2527998.css
-tests/yui/bug2527998.css.min
-tests/yui/bug2528034.css
-tests/yui/bug2528034.css.min
-tests/yui/charset-media.css
-tests/yui/charset-media.css.min
-tests/yui/color-simple.css
-tests/yui/color-simple.css.min
-tests/yui/color.css
-tests/yui/color.css.min
-tests/yui/comment.css
-tests/yui/comment.css.min
-tests/yui/concat-charset.css
-tests/yui/concat-charset.css.min
-tests/yui/dataurl-base64-doublequotes.css
-tests/yui/dataurl-base64-doublequotes.css.min
-tests/yui/dataurl-base64-eof.css
-tests/yui/dataurl-base64-eof.css.min
-tests/yui/dataurl-base64-linebreakindata.css
-tests/yui/dataurl-base64-linebreakindata.css.min
-tests/yui/dataurl-base64-noquotes.css
-tests/yui/dataurl-base64-noquotes.css.min
-tests/yui/dataurl-base64-singlequotes.css
-tests/yui/dataurl-base64-singlequotes.css.min
-tests/yui/dataurl-base64-twourls.css
-tests/yui/dataurl-base64-twourls.css.min
-tests/yui/dataurl-dbquote-font.css
-tests/yui/dataurl-dbquote-font.css.min
-tests/yui/dataurl-nonbase64-doublequotes.css
-tests/yui/dataurl-nonbase64-doublequotes.css.min
-tests/yui/dataurl-nonbase64-noquotes.css
-tests/yui/dataurl-nonbase64-noquotes.css.min
-tests/yui/dataurl-nonbase64-singlequotes.css
-tests/yui/dataurl-nonbase64-singlequotes.css.min
-tests/yui/dataurl-noquote-multiline-font.css
-tests/yui/dataurl-noquote-multiline-font.css.min
-tests/yui/dataurl-realdata-doublequotes.css
-tests/yui/dataurl-realdata-doublequotes.css.min
-tests/yui/dataurl-realdata-noquotes.css
-tests/yui/dataurl-realdata-noquotes.css.min
-tests/yui/dataurl-realdata-singlequotes.css
-tests/yui/dataurl-realdata-singlequotes.css.min
-tests/yui/dataurl-realdata-yuiapp.css
-tests/yui/dataurl-realdata-yuiapp.css.min
-tests/yui/dataurl-singlequote-font.css
-tests/yui/dataurl-singlequote-font.css.min
-tests/yui/decimals.css
-tests/yui/decimals.css.min
-tests/yui/dollar-header.css
-tests/yui/dollar-header.css.min
-tests/yui/font-face.css
-tests/yui/font-face.css.min
-tests/yui/ie5mac.css
-tests/yui/ie5mac.css.min
-tests/yui/media-empty-class.css
-tests/yui/media-empty-class.css.min
-tests/yui/media-multi.css
-tests/yui/media-multi.css.min
-tests/yui/media-test.css
-tests/yui/media-test.css.min
-tests/yui/opacity-filter.css
-tests/yui/opacity-filter.css.min
-tests/yui/out/background-position.out
-tests/yui/out/background-position.out.b
-tests/yui/out/border-none.out
-tests/yui/out/border-none.out.b
-tests/yui/out/box-model-hack.out
-tests/yui/out/box-model-hack.out.b
-tests/yui/out/bug2527974.out
-tests/yui/out/bug2527974.out.b
-tests/yui/out/bug2527991.out
-tests/yui/out/bug2527991.out.b
-tests/yui/out/bug2527998.out
-tests/yui/out/bug2527998.out.b
-tests/yui/out/bug2528034.out
-tests/yui/out/bug2528034.out.b
-tests/yui/out/charset-media.out
-tests/yui/out/charset-media.out.b
-tests/yui/out/color-simple.out
-tests/yui/out/color-simple.out.b
-tests/yui/out/color.out
-tests/yui/out/color.out.b
-tests/yui/out/comment.out
-tests/yui/out/comment.out.b
-tests/yui/out/concat-charset.out
-tests/yui/out/concat-charset.out.b
-tests/yui/out/dataurl-base64-doublequotes.out
-tests/yui/out/dataurl-base64-doublequotes.out.b
-tests/yui/out/dataurl-base64-eof.out
-tests/yui/out/dataurl-base64-eof.out.b
-tests/yui/out/dataurl-base64-linebreakindata.out
-tests/yui/out/dataurl-base64-linebreakindata.out.b
-tests/yui/out/dataurl-base64-noquotes.out
-tests/yui/out/dataurl-base64-noquotes.out.b
-tests/yui/out/dataurl-base64-singlequotes.out
-tests/yui/out/dataurl-base64-singlequotes.out.b
-tests/yui/out/dataurl-base64-twourls.out
-tests/yui/out/dataurl-base64-twourls.out.b
-tests/yui/out/dataurl-dbquote-font.out
-tests/yui/out/dataurl-dbquote-font.out.b
-tests/yui/out/dataurl-nonbase64-doublequotes.out
-tests/yui/out/dataurl-nonbase64-doublequotes.out.b
-tests/yui/out/dataurl-nonbase64-noquotes.out
-tests/yui/out/dataurl-nonbase64-noquotes.out.b
-tests/yui/out/dataurl-nonbase64-singlequotes.out
-tests/yui/out/dataurl-nonbase64-singlequotes.out.b
-tests/yui/out/dataurl-noquote-multiline-font.out
-tests/yui/out/dataurl-noquote-multiline-font.out.b
-tests/yui/out/dataurl-realdata-doublequotes.out
-tests/yui/out/dataurl-realdata-doublequotes.out.b
-tests/yui/out/dataurl-realdata-noquotes.out
-tests/yui/out/dataurl-realdata-noquotes.out.b
-tests/yui/out/dataurl-realdata-singlequotes.out
-tests/yui/out/dataurl-realdata-singlequotes.out.b
-tests/yui/out/dataurl-realdata-yuiapp.out
-tests/yui/out/dataurl-realdata-yuiapp.out.b
-tests/yui/out/dataurl-singlequote-font.out
-tests/yui/out/dataurl-singlequote-font.out.b
-tests/yui/out/decimals.out
-tests/yui/out/decimals.out.b
-tests/yui/out/dollar-header.out
-tests/yui/out/dollar-header.out.b
-tests/yui/out/font-face.out
-tests/yui/out/font-face.out.b
-tests/yui/out/ie5mac.out
-tests/yui/out/ie5mac.out.b
-tests/yui/out/media-empty-class.out
-tests/yui/out/media-empty-class.out.b
-tests/yui/out/media-multi.out
-tests/yui/out/media-multi.out.b
-tests/yui/out/media-test.out
-tests/yui/out/media-test.out.b
-tests/yui/out/opacity-filter.out
-tests/yui/out/opacity-filter.out.b
-tests/yui/out/preserve-case.out
-tests/yui/out/preserve-case.out.b
-tests/yui/out/preserve-new-line.out
-tests/yui/out/preserve-new-line.out.b
-tests/yui/out/preserve-strings.out
-tests/yui/out/preserve-strings.out.b
-tests/yui/out/pseudo-first.out
-tests/yui/out/pseudo-first.out.b
-tests/yui/out/pseudo.out
-tests/yui/out/pseudo.out.b
-tests/yui/out/special-comments.out
-tests/yui/out/special-comments.out.b
-tests/yui/out/star-underscore-hacks.out
-tests/yui/out/star-underscore-hacks.out.b
-tests/yui/out/string-in-comment.out
-tests/yui/out/string-in-comment.out.b
-tests/yui/out/webkit-transform.out
-tests/yui/out/webkit-transform.out.b
-tests/yui/out/zeros.out
-tests/yui/out/zeros.out.b
-tests/yui/preserve-case.css
-tests/yui/preserve-case.css.min
-tests/yui/preserve-new-line.css
-tests/yui/preserve-new-line.css.min
-tests/yui/preserve-strings.css
-tests/yui/preserve-strings.css.min
-tests/yui/pseudo-first.css
-tests/yui/pseudo-first.css.min
-tests/yui/pseudo.css
-tests/yui/pseudo.css.min
-tests/yui/special-comments.css
-tests/yui/special-comments.css.min
-tests/yui/star-underscore-hacks.css
-tests/yui/star-underscore-hacks.css.min
-tests/yui/string-in-comment.css
-tests/yui/string-in-comment.css.min
-tests/yui/webkit-transform.css
-tests/yui/webkit-transform.css.min
-tests/yui/zeros.css
-tests/yui/zeros.css.min
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/PKG-INFO b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/PKG-INFO
deleted file mode 100644
index d4ee866c986..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/PKG-INFO
+++ /dev/null
@@ -1,316 +0,0 @@
-Metadata-Version: 1.1
-Name: rcssmin
-Version: 1.0.5
-Summary: CSS Minifier
-Home-page: http://opensource.perlig.de/rcssmin/
-Author: André Malo
-Author-email: nd@perlig.de
-License: Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-Download-URL: http://storage.perlig.de/rcssmin/
-Description: ==============
- CSS Minifier
- ==============
-
- RCSSmin is a CSS minifier.
-
- The minifier is based on the semantics of the `YUI compressor`_\, which itself
- is based on `the rule list by Isaac Schlueter`_\.
-
- This module is a re-implementation aiming for speed instead of maximum
- compression, so it can be used at runtime (rather than during a preprocessing
- step). RCSSmin does syntactical compression only (removing spaces, comments
- and possibly semicolons). It does not provide semantic compression (like
- removing empty blocks, collapsing redundant properties etc). It does, however,
- support various CSS hacks (by keeping them working as intended).
-
- Here's a feature list:
-
- - Strings are kept, except that escaped newlines are stripped
- - Space/Comments before the very end or before various characters are
- stripped: ``:{});=>+],!`` (The colon (``:``) is a special case, a single
- space is kept if it's outside a ruleset.)
- - Space/Comments at the very beginning or after various characters are
- stripped: ``{}(=:>+[,!``
- - Optional space after unicode escapes is kept, resp. replaced by a simple
- space
- - whitespaces inside ``url()`` definitions are stripped
- - Comments starting with an exclamation mark (``!``) can be kept optionally.
- - All other comments and/or whitespace characters are replaced by a single
- space.
- - Multiple consecutive semicolons are reduced to one
- - The last semicolon within a ruleset is stripped
- - CSS Hacks supported:
-
- - IE7 hack (``>/**/``)
- - Mac-IE5 hack (``/*\*/.../**/``)
- - The boxmodelhack is supported naturally because it relies on valid CSS2
- strings
- - Between ``:first-line`` and the following comma or curly brace a space is
- inserted. (apparently it's needed for IE6)
- - Same for ``:first-letter``
-
- rcssmin.c is a reimplementation of rcssmin.py in C and improves runtime up to
- factor 100 or so (depending on the input). docs/BENCHMARKS in the source
- distribution contains the details.
-
- Both python 2 (>= 2.4) and python 3 are supported.
-
- .. _YUI compressor: https://github.com/yui/yuicompressor/
-
- .. _the rule list by Isaac Schlueter: https://github.com/isaacs/cssmin/
-
-
- Copyright and License
- ~~~~~~~~~~~~~~~~~~~~~
-
- Copyright 2011 - 2014
- André Malo or his licensors, as applicable.
-
- The whole package (except for the files in the bench/ directory) is
- distributed under the Apache License Version 2.0. You'll find a copy in the
- root directory of the distribution or online at:
- <http://www.apache.org/licenses/LICENSE-2.0>.
-
-
- Bugs
- ~~~~
-
- No bugs, of course. ;-)
- But if you've found one or have an idea how to improve rcssmin, feel free
- to send a pull request on `github <https://github.com/ndparker/rcssmin>`_
- or send a mail to <rcssmin-bugs@perlig.de>.
-
-
- Author Information
- ~~~~~~~~~~~~~~~~~~
-
- André "nd" Malo <nd perlig.de>
- GPG: 0x8103A37E
-
-
- If God intended people to be naked, they would be born that way.
- -- Oscar Wilde
-
- .. vim:tw=72 syntax=rest
-Keywords: CSS,Minimization
-Platform: UNKNOWN
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Environment :: Web Environment
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved
-Classifier: License :: OSI Approved :: Apache License, Version 2.0
-Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: C
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: Implementation :: CPython
-Classifier: Programming Language :: Python :: Implementation :: Jython
-Classifier: Programming Language :: Python :: Implementation :: PyPy
-Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
-Classifier: Topic :: Software Development :: Libraries
-Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Classifier: Topic :: Text Processing
-Classifier: Topic :: Text Processing :: Filters
-Classifier: Topic :: Utilities
-Provides: rcssmin (1.0)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/README.chromium b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/README.chromium
deleted file mode 100644
index b1350fc9fa4..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/README.chromium
+++ /dev/null
@@ -1,16 +0,0 @@
-Name: rCSSmin
-Short Name: rcssmin
-URL: http://opensource.perlig.de/rcssmin/
-Version: 1.0.5
-License: Apache 2.0
-License File: NOT_SHIPPED
-Security Critical: no
-
-Description:
-rCSSmin is a CSS minifier written in python.
-The minifier is based on the semantics of the YUI compressor, which itself is
-based on the rule list by Isaac Schlueter.
-
-Modifications made:
- - Removed the bench.sh since the file doesn't have the licensing info and
- caused license checker to fail.
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/README.rst b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/README.rst
deleted file mode 100644
index 95fb3083a89..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/README.rst
+++ /dev/null
@@ -1,153 +0,0 @@
-.. -*- coding: utf-8 -*-
-
-=====================================
- rCSSmin - A CSS Minifier For Python
-=====================================
-
-TABLE OF CONTENTS
------------------
-
-1. Introduction
-2. Copyright and License
-3. System Requirements
-4. Installation
-5. Documentation
-6. Bugs
-7. Author Information
-
-
-INTRODUCTION
-------------
-
-RCSSmin is a CSS minifier written in python.
-
-The minifier is based on the semantics of the `YUI compressor`_\, which itself
-is based on `the rule list by Isaac Schlueter`_\.
-
-This module is a re-implementation aiming for speed instead of maximum
-compression, so it can be used at runtime (rather than during a preprocessing
-step). RCSSmin does syntactical compression only (removing spaces, comments
-and possibly semicolons). It does not provide semantic compression (like
-removing empty blocks, collapsing redundant properties etc). It does, however,
-support various CSS hacks (by keeping them working as intended).
-
-Here's a feature list:
-
-- Strings are kept, except that escaped newlines are stripped
-- Space/Comments before the very end or before various characters are
- stripped: ``:{});=>+],!`` (The colon (``:``) is a special case, a single
- space is kept if it's outside a ruleset.)
-- Space/Comments at the very beginning or after various characters are
- stripped: ``{}(=:>+[,!``
-- Optional space after unicode escapes is kept, resp. replaced by a simple
- space
-- whitespaces inside ``url()`` definitions are stripped
-- Comments starting with an exclamation mark (``!``) can be kept optionally.
-- All other comments and/or whitespace characters are replaced by a single
- space.
-- Multiple consecutive semicolons are reduced to one
-- The last semicolon within a ruleset is stripped
-- CSS Hacks supported:
-
- - IE7 hack (``>/**/``)
- - Mac-IE5 hack (``/*\*/.../**/``)
- - The boxmodelhack is supported naturally because it relies on valid CSS2
- strings
- - Between ``:first-line`` and the following comma or curly brace a space is
- inserted. (apparently it's needed for IE6)
- - Same for ``:first-letter``
-
-rcssmin.c is a reimplementation of rcssmin.py in C and improves runtime up to
-factor 100 or so (depending on the input). docs/BENCHMARKS in the source
-distribution contains the details.
-
-.. _YUI compressor: https://github.com/yui/yuicompressor/
-
-.. _the rule list by Isaac Schlueter: https://github.com/isaacs/cssmin/
-
-
-COPYRIGHT AND LICENSE
----------------------
-
-Copyright 2011 - 2014
-André Malo or his licensors, as applicable.
-
-The whole package (except for the files in the bench/ directory)
-is distributed under the Apache License Version 2.0. You'll find a copy in the
-root directory of the distribution or online at:
-<http://www.apache.org/licenses/LICENSE-2.0>.
-
-
-SYSTEM REQUIREMENTS
--------------------
-
-Both python 2 (>=2.4) and python 3 are supported.
-
-
-INSTALLATION
-------------
-
-Using pip
-~~~~~~~~~
-
-$ pip install rcssmin
-
-
-Using distutils
-~~~~~~~~~~~~~~~
-
-$ python setup.py install
-
-The following extra options to the install command may be of interest:
-
- --without-c-extensions Don't install C extensions
- --without-docs Do not install documentation files
-
-
-Drop-in
-~~~~~~~
-
-rCSSmin effectively consists of two files: rcssmin.py and rcssmin.c, the
-latter being entirely optional. So, for simple integration you can just
-copy rcssmin.py into your project and use it.
-
-
-DOCUMENTATION
--------------
-
-A generated API documentation is available in the docs/apidoc/ directory.
-But you can just look into the module. It provides a simple function,
-called cssmin which takes the CSS as a string and returns the minified
-CSS as a string.
-
-The module additionally provides a "streamy" interface:
-
-$ python -mrcssmin <css >minified
-
-It takes two options:
-
- -b Keep bang-comments (Comments starting with an exclamation mark)
- -p Force using the python implementation (not the C implementation)
-
-The latest documentation is also available online at
-<http://opensource.perlig.de/rcssmin/>.
-
-
-BUGS
-----
-
-No bugs, of course. ;-)
-But if you've found one or have an idea how to improve rcssmin, feel free to
-send a pull request on `github <https://github.com/ndparker/rcssmin>`_ or
-send a mail to <rcssmin-bugs@perlig.de>.
-
-
-AUTHOR INFORMATION
-------------------
-
-André "nd" Malo <nd@perlig.de>
-GPG: 0x8103A37E
-
-
- If God intended people to be naked, they would be born that way.
- -- Oscar Wilde
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/__init__.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/__init__.py
deleted file mode 100644
index 77dc23c8412..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/__init__.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-================
- Package _setup
-================
-
-This package provides tools for main package setup.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import os as _os
-import sys as _sys
-
-if _sys.version_info[0] == 2:
- __path__ = [_os.path.join(__path__[0], 'py2')]
- __author__ = __author__.decode('latin-1')
-elif _sys.version_info[0] == 3:
- __path__ = [_os.path.join(__path__[0], 'py3')]
-else:
- raise RuntimeError("Unsupported python version")
-del _os, _sys
-
-from _setup.setup import run # pylint: disable = W0611
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/include/cext.h b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/include/cext.h
deleted file mode 100644
index 47b6f5b9c11..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/include/cext.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright 2006 - 2014
- * Andr\xe9 Malo or his licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * central naming stuff
- */
-
-#ifndef SETUP_CEXT_H
-#define SETUP_CEXT_H
-
-#ifndef EXT_MODULE
-#error EXT_MODULE must be defined outside of this file (-DEXT_MODULE=...)
-#endif
-
-/*
- * include core header files
- */
-#define PY_SSIZE_T_CLEAN
-
-#include "Python.h"
-#include "structmember.h"
-
-/*
- * define our helper macros depending on the stuff above
- */
-#define STRINGIFY(n) STRINGIFY_HELPER(n)
-#define STRINGIFY_HELPER(n) #n
-#define CONCATENATE(first, second) CONCATENATE_HELPER(first, second)
-#define CONCATENATE_HELPER(first, second) first##second
-
-#define EXT_MODULE_NAME STRINGIFY(EXT_MODULE)
-#ifdef EXT_PACKAGE
-#define EXT_PACKAGE_NAME STRINGIFY(EXT_PACKAGE)
-#define EXT_MODULE_PATH EXT_PACKAGE_NAME "." EXT_MODULE_NAME
-#else
-#define EXT_PACKAGE_NAME ""
-#define EXT_MODULE_PATH EXT_MODULE_NAME
-#endif
-
-#define EXT_DOCS_VAR CONCATENATE(var, CONCATENATE(EXT_MODULE, __doc__))
-#define EXT_METHODS_VAR CONCATENATE(var, CONCATENATE(EXT_MODULE, _methods))
-#define EXT_METHODS static PyMethodDef EXT_METHODS_VAR[]
-
-#define EXT_DEFINE_VAR CONCATENATE(var, CONCATENATE(EXT_MODULE, _module))
-
-/* Py3K Support */
-#if PY_MAJOR_VERSION >= 3
-
-#define EXT3
-
-#ifndef PyMODINIT_FUNC
-#define EXT_INIT_FUNC PyObject *CONCATENATE(PyInit_, EXT_MODULE)(void)
-#else
-#define EXT_INIT_FUNC PyMODINIT_FUNC CONCATENATE(PyInit_, EXT_MODULE)(void)
-#endif
-
-#define EXT_DEFINE(name, methods, doc) \
-static struct PyModuleDef EXT_DEFINE_VAR = { \
- PyModuleDef_HEAD_INIT, \
- name, \
- doc, \
- -1, \
- methods, \
- NULL, \
- NULL, \
- NULL, \
- NULL \
-}
-
-#define EXT_CREATE(def) (PyModule_Create(def))
-#define EXT_INIT_ERROR(module) do {Py_XDECREF(module); return NULL;} while(0)
-#define EXT_INIT_RETURN(module) return module
-
-#else /* end py3k */
-
-#define EXT2
-
-#ifndef PyMODINIT_FUNC
-#define EXT_INIT_FUNC void CONCATENATE(init, EXT_MODULE)(void)
-#else
-#define EXT_INIT_FUNC PyMODINIT_FUNC CONCATENATE(init, EXT_MODULE)(void)
-#endif
-
-#define EXT_DEFINE__STRUCT \
- CONCATENATE(struct, CONCATENATE(EXT_MODULE, _module))
-
-struct EXT_DEFINE__STRUCT {
- char *m_name;
- char *m_doc;
- PyMethodDef *m_methods;
-};
-#define EXT_DEFINE(name, methods, doc) \
-static struct EXT_DEFINE__STRUCT EXT_DEFINE_VAR = { \
- name, \
- doc, \
- methods \
-}
-
-#define EXT_CREATE(def) ((def)->m_doc \
- ? Py_InitModule3((def)->m_name, (def)->m_methods, (def)->m_doc) \
- : Py_InitModule((def)->m_name, (def)->m_methods) \
-)
-#define EXT_INIT_ERROR(module) return
-#define EXT_INIT_RETURN(module) return
-
-#endif /* end py2K */
-
-#define EXT_INIT_TYPE(module, type) do { \
- if (PyType_Ready(type) < 0) \
- EXT_INIT_ERROR(module); \
-} while (0)
-
-#define EXT_ADD_TYPE(module, name, type) do { \
- Py_INCREF(type); \
- if (PyModule_AddObject(module, name, (PyObject *)(type)) < 0) \
- EXT_INIT_ERROR(module); \
-} while (0)
-
-#define EXT_ADD_UNICODE(module, name, string, encoding) do { \
- if (PyModule_AddObject( \
- module, \
- name, \
- PyUnicode_Decode( \
- string, \
- sizeof(string) - 1, \
- encoding, \
- "strict" \
- )) < 0) \
- EXT_INIT_ERROR(module); \
-} while (0)
-
-#define EXT_ADD_STRING(module, name, string) do { \
- if (PyModule_AddStringConstant(module, name, string) < 0) \
- EXT_INIT_ERROR(module); \
-} while (0)
-
-#define EXT_ADD_INT(module, name, number) do { \
- if (PyModule_AddIntConstant(module, name, number) < 0) \
- EXT_INIT_ERROR(module); \
-} while (0)
-
-
-/* PEP 353 support, implemented as of python 2.5 */
-#if PY_VERSION_HEX < 0x02050000
-typedef int Py_ssize_t;
-#define PyInt_FromSsize_t(arg) PyInt_FromLong((long)arg)
-#define PyInt_AsSsize_t(arg) (int)PyInt_AsLong(arg)
-#define PY_SSIZE_T_MAX ((Py_ssize_t)INT_MAX)
-#endif
-
-/*
- * some helper macros (Python 2.4)
- */
-#ifndef Py_VISIT
-#define Py_VISIT(op) do { \
- if (op) { \
- int vret = visit((op), arg); \
- if (vret) return vret; \
- } \
-} while (0)
-#endif
-
-#ifdef Py_CLEAR
-#undef Py_CLEAR
-#endif
-#define Py_CLEAR(op) do { \
- if (op) { \
- PyObject *tmp__ = (PyObject *)(op); \
- (op) = NULL; \
- Py_DECREF(tmp__); \
- } \
-} while (0)
-
-#ifndef Py_RETURN_NONE
-#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
-#endif
-
-#ifndef Py_RETURN_FALSE
-#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
-#endif
-
-#ifndef Py_RETURN_TRUE
-#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
-#endif
-
-/* Macros for inline documentation. (Python 2.3) */
-#ifndef PyDoc_VAR
-#define PyDoc_VAR(name) static char name[]
-#endif
-
-#ifndef PyDoc_STRVAR
-#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
-#endif
-
-#ifndef PyDoc_STR
-#ifdef WITH_DOC_STRINGS
-#define PyDoc_STR(str) str
-#else
-#define PyDoc_STR(str) ""
-#endif
-#endif
-
-/* Basestring check (basestring introduced in Python 2.3) */
-#if PY_VERSION_HEX < 0x02030000
-#define BaseString_Check(type) ( \
- PyObject_TypeCheck((type), &PyString_Type) \
- || PyObject_TypeCheck((type), &PyUnicode_Type) \
-)
-#else
-#define BaseString_Check(type) PyObject_TypeCheck((type), &PyBaseString_Type)
-#endif
-
-#define GENERIC_ALLOC(type) \
- ((void *)((PyTypeObject *)type)->tp_alloc(type, (Py_ssize_t)0))
-
-/* PyPy doesn't define it */
-#ifndef PyType_IS_GC
-#define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
-#endif
-
-#define DEFINE_GENERIC_DEALLOC(prefix) \
-static void prefix##_dealloc(void *self) \
-{ \
- if (PyType_IS_GC(((PyObject *)self)->ob_type)) \
- PyObject_GC_UnTrack(self); \
- (void)prefix##_clear(self); \
- ((PyObject *)self)->ob_type->tp_free((PyObject *)self); \
-}
-
-#endif /* SETUP_CEXT_H */
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/__init__.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/__init__.py
deleted file mode 100644
index 9582ecc1087..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/__init__.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-================
- Package _setup
-================
-
-This package provides tools for main package setup.
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-from _setup.setup import run # pylint: disable = W0611
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/commands.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/commands.py
deleted file mode 100644
index a41b166e0a5..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/commands.py
+++ /dev/null
@@ -1,267 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- Command extenders
-===================
-
-Command extenders.
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-__test__ = False
-
-from distutils import fancy_getopt as _fancy_getopt
-from distutils.command import build as _build
-from distutils.command import build_ext as _build_ext
-from distutils.command import install as _install
-from distutils.command import install_data as _install_data
-from distutils.command import install_lib as _install_lib
-import os as _os
-
-from _setup.util import log
-
-_option_defaults = {}
-_option_inherits = {}
-_option_finalizers = {}
-_command_mapping = {
- 'install': 'Install',
- 'install_data': 'InstallData',
- 'install_lib': 'InstallLib',
- 'build': 'Build',
- 'build_ext': 'BuildExt',
-}
-
-
-def add_option(command, long_name, help_text, short_name=None, default=None,
- inherit=None):
- """ Add an option """
- try:
- command_class = globals()[_command_mapping[command]]
- except KeyError:
- raise ValueError("Unknown command %r" % (command,))
- for opt in command_class.user_options:
- if opt[0] == long_name:
- break
- else:
- opt = (long_name, short_name, help_text)
- command_class.user_options.append(opt)
- if not long_name.endswith('='):
- command_class.boolean_options.append(long_name)
- attr_name = _fancy_getopt.translate_longopt(long_name)
- else:
- attr_name = _fancy_getopt.translate_longopt(long_name[:-1])
- if not _option_defaults.has_key(command):
- _option_defaults[command] = []
- if inherit is not None:
- if isinstance(inherit, (str, unicode)):
- inherit = [inherit]
- for i_inherit in inherit:
- add_option(
- i_inherit, long_name, help_text, short_name, default
- )
- default = None
- if not _option_inherits.has_key(command):
- _option_inherits[command] = []
- for i_inherit in inherit:
- for i_command, opt_name in _option_inherits[command]:
- if i_command == i_inherit and opt_name == attr_name:
- break
- else:
- _option_inherits[command].append((i_inherit, attr_name))
- _option_defaults[command].append((attr_name, default))
-
-
-def add_finalizer(command, key, func):
- """ Add finalizer """
- if not _option_finalizers.has_key(command):
- _option_finalizers[command] = {}
- if not _option_finalizers[command].has_key(key):
- _option_finalizers[command][key] = func
-
-
-class Install(_install.install):
- """ Extended installer to reflect the additional data options """
- user_options = _install.install.user_options + [
- ('single-version-externally-managed', None,
- "Compat option. Does not a thing."),
- ]
- boolean_options = _install.install.boolean_options + [
- 'single-version-externally-managed'
- ]
-
- def initialize_options(self):
- """ Prepare for new options """
- _install.install.initialize_options(self)
- self.single_version_externally_managed = None
- if _option_defaults.has_key('install'):
- for opt_name, default in _option_defaults['install']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _install.install.finalize_options(self)
- if _option_inherits.has_key('install'):
- for parent, opt_name in _option_inherits['install']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if _option_finalizers.has_key('install'):
- for func in _option_finalizers['install'].values():
- func(self)
-
-
-class InstallData(_install_data.install_data):
- """ Extended data installer """
- user_options = _install_data.install_data.user_options + []
- boolean_options = _install_data.install_data.boolean_options + []
-
- def initialize_options(self):
- """ Prepare for new options """
- _install_data.install_data.initialize_options(self)
- if _option_defaults.has_key('install_data'):
- for opt_name, default in _option_defaults['install_data']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _install_data.install_data.finalize_options(self)
- if _option_inherits.has_key('install_data'):
- for parent, opt_name in _option_inherits['install_data']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if _option_finalizers.has_key('install_data'):
- for func in _option_finalizers['install_data'].values():
- func(self)
-
-
-class InstallLib(_install_lib.install_lib):
- """ Extended lib installer """
- user_options = _install_lib.install_lib.user_options + []
- boolean_options = _install_lib.install_lib.boolean_options + []
-
- def initialize_options(self):
- """ Prepare for new options """
- _install_lib.install_lib.initialize_options(self)
- if _option_defaults.has_key('install_lib'):
- for opt_name, default in _option_defaults['install_lib']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _install_lib.install_lib.finalize_options(self)
- if _option_inherits.has_key('install_lib'):
- for parent, opt_name in _option_inherits['install_lib']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if _option_finalizers.has_key('install_lib'):
- for func in _option_finalizers['install_lib'].values():
- func(self)
-
-
-class BuildExt(_build_ext.build_ext):
- """
- Extended extension builder class
-
- This class allows extensions to provide a ``check_prerequisites`` method
- which is called before actually building it. The method takes the
- `BuildExt` instance and returns whether the extension should be skipped or
- not.
- """
-
- def initialize_options(self):
- """ Prepare for new options """
- _build_ext.build_ext.initialize_options(self)
- if _option_defaults.has_key('build_ext'):
- for opt_name, default in _option_defaults['build_ext']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _build_ext.build_ext.finalize_options(self)
- if _option_inherits.has_key('build_ext'):
- for parent, opt_name in _option_inherits['build_ext']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if _option_finalizers.has_key('build_ext'):
- for func in _option_finalizers['build_ext'].values():
- func(self)
-
- def build_extension(self, ext):
- """
- Build C extension - with extended functionality
-
- The following features are added here:
-
- - ``ext.check_prerequisites`` is called before the extension is being
- built. See `Extension` for details. If the method does not exist,
- simply no check will be run.
- - The macros ``EXT_PACKAGE`` and ``EXT_MODULE`` will be filled (or
- unset) depending on the extensions name, but only if they are not
- already defined.
-
- :Parameters:
- `ext` : `Extension`
- The extension to build. If it's a pure
- ``distutils.core.Extension``, simply no prequisites check is
- applied.
-
- :Return: whatever ``distutils.command.build_ext.build_ext`` returns
- :Rtype: any
- """
- # handle name macros
- macros = dict(ext.define_macros or ())
- tup = ext.name.split('.')
- if len(tup) == 1:
- pkg, mod = None, tup[0]
- else:
- pkg, mod = '.'.join(tup[:-1]), tup[-1]
- if pkg is not None and 'EXT_PACKAGE' not in macros:
- ext.define_macros.append(('EXT_PACKAGE', pkg))
- if 'EXT_MODULE' not in macros:
- ext.define_macros.append(('EXT_MODULE', mod))
- if pkg is None:
- macros = dict(ext.undef_macros or ())
- if 'EXT_PACKAGE' not in macros:
- ext.undef_macros.append('EXT_PACKAGE')
-
- # handle prereq checks
- try:
- checker = ext.check_prerequisites
- except AttributeError:
- pass
- else:
- if checker(self):
- log.info("Skipping %s extension" % ext.name)
- return
-
- return _build_ext.build_ext.build_extension(self, ext)
-
-
-class Build(_build.build):
-
- def initialize_options(self):
- """ Prepare for new options """
- _build.build.initialize_options(self)
- if _option_defaults.has_key('build'):
- for opt_name, default in _option_defaults['build']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _build.build.finalize_options(self)
- if _option_inherits.has_key('build'):
- for parent, opt_name in _option_inherits['build']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if _option_finalizers.has_key('build'):
- for func in _option_finalizers['build'].values():
- func(self)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/data.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/data.py
deleted file mode 100644
index 9cf04e104c2..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/data.py
+++ /dev/null
@@ -1,165 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- Data distribution
-===================
-
-This module provides tools to simplify data distribution.
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-from distutils import filelist as _filelist
-import os as _os
-import posixpath as _posixpath
-import sys as _sys
-
-from _setup import commands as _commands
-
-
-def splitpath(path):
- """ Split a path """
- drive, path = '', _os.path.normpath(path)
- try:
- splitunc = _os.path.splitunc
- except AttributeError:
- pass
- else:
- drive, path = splitunc(path)
- if not drive:
- drive, path = _os.path.splitdrive(path)
- elems = []
- try:
- sep = _os.path.sep
- except AttributeError:
- sep = _os.path.join('1', '2')[1:-1]
- while 1:
- prefix, path = _os.path.split(path)
- elems.append(path)
- if prefix in ('', sep):
- drive = _os.path.join(drive, prefix)
- break
- path = prefix
- elems.reverse()
- return drive, elems
-
-
-def finalizer(installer):
- """ Finalize install_data """
- data_files = []
- for item in installer.data_files:
- if not isinstance(item, Data):
- data_files.append(item)
- continue
- data_files.extend(item.flatten(installer))
- installer.data_files = data_files
-
-
-class Data(object):
- """ File list container """
-
- def __init__(self, files, target=None, preserve=0, strip=0,
- prefix=None):
- """ Initialization """
- self._files = files
- self._target = target
- self._preserve = preserve
- self._strip = strip
- self._prefix = prefix
- self.fixup_commands()
-
- def fixup_commands(self):
- pass
-
- def from_templates(cls, *templates, **kwargs):
- """ Initialize from template """
- files = _filelist.FileList()
- for tpl in templates:
- for line in tpl.split(';'):
- files.process_template_line(line.strip())
- files.sort()
- files.remove_duplicates()
- result = []
- for filename in files.files:
- _, elems = splitpath(filename)
- if '.svn' in elems or '.git' in elems:
- continue
- result.append(filename)
- return cls(result, **kwargs)
- from_templates = classmethod(from_templates)
-
- def flatten(self, installer):
- """ Flatten the file list to (target, file) tuples """
- # pylint: disable = W0613
- if self._prefix:
- _, prefix = splitpath(self._prefix)
- telems = prefix
- else:
- telems = []
-
- tmap = {}
- for fname in self._files:
- (_, name), target = splitpath(fname), telems
- if self._preserve:
- if self._strip:
- name = name[max(0, min(self._strip, len(name) - 1)):]
- if len(name) > 1:
- target = telems + name[:-1]
- tmap.setdefault(_posixpath.join(*target), []).append(fname)
- return tmap.items()
-
-
-class Documentation(Data):
- """ Documentation container """
-
- def fixup_commands(self):
- _commands.add_option('install_data', 'without-docs',
- help_text='Do not install documentation files',
- inherit='install',
- )
- _commands.add_finalizer('install_data', 'documentation', finalizer)
-
- def flatten(self, installer):
- """ Check if docs should be installed at all """
- if installer.without_docs:
- return []
- return Data.flatten(self, installer)
-
-
-class Manpages(Documentation):
- """ Manpages container """
-
- def dispatch(cls, files):
- """ Automatically dispatch manpages to their target directories """
- mpmap = {}
- for manpage in files:
- normalized = _os.path.normpath(manpage)
- _, ext = _os.path.splitext(normalized)
- if ext.startswith(_os.path.extsep):
- ext = ext[len(_os.path.extsep):]
- mpmap.setdefault(ext, []).append(manpage)
- return [cls(manpages, prefix=_posixpath.join(
- 'share', 'man', 'man%s' % section,
- )) for section, manpages in mpmap.items()]
- dispatch = classmethod(dispatch)
-
- def flatten(self, installer):
- """ Check if manpages are suitable """
- if _sys.platform == 'win32':
- return []
- return Documentation.flatten(self, installer)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/dist.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/dist.py
deleted file mode 100644
index 21a65415185..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/dist.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-================
- dist utilities
-================
-
-dist utilities.
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import sys as _sys
-
-from _setup import shell as _shell
-
-
-def run_setup(*args, **kwargs):
- """ Run setup """
- if 'setup' in kwargs:
- script = kwargs.get('setup') or 'setup.py'
- del kwargs['setup']
- else:
- script = 'setup.py'
- if 'fakeroot' in kwargs:
- fakeroot = kwargs['fakeroot']
- del kwargs['fakeroot']
- else:
- fakeroot = None
- if kwargs:
- raise TypeError("Unrecognized keyword parameters")
-
- script = _shell.native(script)
- argv = [_sys.executable, script] + list(args)
- if fakeroot:
- argv.insert(0, fakeroot)
- return not _shell.spawn(*argv)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/ext.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/ext.py
deleted file mode 100644
index bcc0209a53a..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/ext.py
+++ /dev/null
@@ -1,254 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- C extension tools
-===================
-
-C extension tools.
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-__test__ = False
-
-from distutils import core as _core
-from distutils import errors as _distutils_errors
-import os as _os
-import posixpath as _posixpath
-import shutil as _shutil
-import tempfile as _tempfile
-
-from _setup import commands as _commands
-from _setup.util import log
-
-
-def _install_finalizer(installer):
- if installer.without_c_extensions:
- installer.distribution.ext_modules = []
-
-def _build_finalizer(builder):
- if builder.without_c_extensions:
- builder.extensions = []
-
-
-class Extension(_core.Extension):
- """
- Extension with prerequisite check interface
-
- If your check is cacheable (during the setup run), override
- `cached_check_prerequisites`, `check_prerequisites` otherwise.
-
- :IVariables:
- `cached_check` : ``bool``
- The cached check result
- """
- cached_check = None
-
- def __init__(self, *args, **kwargs):
- """ Initialization """
- if kwargs.has_key('depends'):
- self.depends = kwargs['depends'] or []
- else:
- self.depends = []
- _core.Extension.__init__(self, *args, **kwargs)
-
- # add include path
- included = _posixpath.join('_setup', 'include')
- if included not in self.include_dirs:
- self.include_dirs.append(included)
-
- # add cext.h to the dependencies
- cext_h = _posixpath.join(included, 'cext.h')
- if cext_h not in self.depends:
- self.depends.append(cext_h)
-
- _commands.add_option('install_lib', 'without-c-extensions',
- help_text='Don\'t install C extensions',
- inherit='install',
- )
- _commands.add_finalizer('install_lib', 'c-extensions',
- _install_finalizer
- )
- _commands.add_option('build_ext', 'without-c-extensions',
- help_text='Don\'t build C extensions',
- inherit=('build', 'install_lib'),
- )
- _commands.add_finalizer('build_ext', 'c-extensions', _build_finalizer)
-
- def check_prerequisites(self, build):
- """
- Check prerequisites
-
- The check should cover all dependencies needed for the extension to
- be built and run. The method can do the following:
-
- - return a false value: the extension will be built
- - return a true value: the extension will be skipped. This is useful
- for optional extensions
- - raise an exception. This is useful for mandatory extensions
-
- If the check result is cacheable (during the setup run), override
- `cached_check_prerequisites` instead.
-
- :Parameters:
- `build` : `BuildExt`
- The extension builder
-
- :Return: Skip the extension?
- :Rtype: ``bool``
- """
- if self.cached_check is None:
- log.debug("PREREQ check for %s" % self.name)
- self.cached_check = self.cached_check_prerequisites(build)
- else:
- log.debug("PREREQ check for %s (cached)" % self.name)
- return self.cached_check
-
- def cached_check_prerequisites(self, build):
- """
- Check prerequisites
-
- The check should cover all dependencies needed for the extension to
- be built and run. The method can do the following:
-
- - return a false value: the extension will be built
- - return a true value: the extension will be skipped. This is useful
- for optional extensions
- - raise an exception. This is useful for mandatory extensions
-
- If the check result is *not* cacheable (during the setup run),
- override `check_prerequisites` instead.
-
- :Parameters:
- `build` : `BuildExt`
- The extension builder
-
- :Return: Skip the extension?
- :Rtype: ``bool``
- """
- # pylint: disable = W0613
- log.debug("Nothing to check for %s!" % self.name)
- return False
-
-
-class ConfTest(object):
- """
- Single conftest abstraction
-
- :IVariables:
- `_tempdir` : ``str``
- The tempdir created for this test
-
- `src` : ``str``
- Name of the source file
-
- `target` : ``str``
- Target filename
-
- `compiler` : ``CCompiler``
- compiler instance
-
- `obj` : ``list``
- List of object filenames (``[str, ...]``)
- """
- _tempdir = None
-
- def __init__(self, build, source):
- """
- Initialization
-
- :Parameters:
- `build` : ``distuils.command.build_ext.build_ext``
- builder instance
-
- `source` : ``str``
- Source of the file to compile
- """
- self._tempdir = tempdir = _tempfile.mkdtemp()
- src = _os.path.join(tempdir, 'conftest.c')
- fp = open(src, 'w')
- try:
- fp.write(source)
- finally:
- fp.close()
- self.src = src
- self.compiler = compiler = build.compiler
- self.target = _os.path.join(tempdir, 'conftest')
- self.obj = compiler.object_filenames([src], output_dir=tempdir)
-
- def __del__(self):
- """ Destruction """
- self.destroy()
-
- def destroy(self):
- """ Destroy the conftest leftovers on disk """
- tempdir, self._tempdir = self._tempdir, None
- if tempdir is not None:
- _shutil.rmtree(tempdir)
-
- def compile(self, **kwargs):
- """
- Compile the conftest
-
- :Parameters:
- `kwargs` : ``dict``
- Optional keyword parameters for the compiler call
-
- :Return: Was the compilation successful?
- :Rtype: ``bool``
- """
- kwargs['output_dir'] = self._tempdir
- try:
- self.compiler.compile([self.src], **kwargs)
- except _distutils_errors.CompileError:
- return False
- return True
-
- def link(self, **kwargs):
- r"""
- Link the conftest
-
- Before you can link the conftest objects they need to be `compile`\d.
-
- :Parameters:
- `kwargs` : ``dict``
- Optional keyword parameters for the linker call
-
- :Return: Was the linking successful?
- :Rtype: ``bool``
- """
- try:
- self.compiler.link_executable(self.obj, self.target, **kwargs)
- except _distutils_errors.LinkError:
- return False
- return True
-
- def pipe(self, mode="r"):
- r"""
- Execute the conftest binary and connect to it using a pipe
-
- Before you can pipe to or from the conftest binary it needs to
- be `link`\ed.
-
- :Parameters:
- `mode` : ``str``
- Pipe mode - r/w
-
- :Return: The open pipe
- :Rtype: ``file``
- """
- return _os.popen(self.compiler.executable_filename(self.target), mode)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/setup.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/setup.py
deleted file mode 100644
index fd86f62f9bc..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/setup.py
+++ /dev/null
@@ -1,419 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007 - 2013
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- Main setup runner
-===================
-
-This module provides a wrapper around the distutils core setup.
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import ConfigParser as _config_parser
-from distutils import core as _core
-import os as _os
-import posixpath as _posixpath
-import sys as _sys
-
-from _setup import commands as _commands
-from _setup import data as _data
-from _setup import ext as _ext
-from _setup import util as _util
-from _setup import shell as _shell
-
-
-def check_python_version(impl, version_min, version_max):
- """ Check python version """
- if impl == 'python':
- version_info = _sys.version_info
- elif impl == 'pypy':
- version_info = getattr(_sys, 'pypy_version_info', None)
- if not version_info:
- return
- elif impl == 'jython':
- if not 'java' in _sys.platform.lower():
- return
- version_info = _sys.version_info
- else:
- raise AssertionError("impl not in ('python', 'pypy', 'jython')")
-
- pyversion = map(int, version_info[:3])
- if version_min:
- min_required = \
- map(int, '.'.join((version_min, '0.0.0')).split('.')[:3])
- if pyversion < min_required:
- raise EnvironmentError("Need at least %s %s (vs. %s)" % (
- impl, version_min, '.'.join(map(str, pyversion))
- ))
- if version_max:
- max_required = map(int, version_max.split('.'))
- max_required[-1] += 1
- if pyversion >= max_required:
- raise EnvironmentError("Need at max %s %s (vs. %s)" % (
- impl,
- version_max,
- '.'.join(map(str, pyversion))
- ))
-
-
-def find_description(docs):
- """
- Determine the package description from DESCRIPTION
-
- :Parameters:
- `docs` : ``dict``
- Docs config section
-
- :Return: Tuple of summary, description and license
- (``('summary', 'description', 'license')``)
- (all may be ``None``)
- :Rtype: ``tuple``
- """
- summary = None
- filename = docs.get('meta.summary', 'SUMMARY').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename)
- try:
- try:
- summary = fp.read().strip().splitlines()[0].rstrip()
- except IndexError:
- summary = ''
- finally:
- fp.close()
-
- description = None
- filename = docs.get('meta.description', 'DESCRIPTION').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename)
- try:
- description = fp.read().rstrip()
- finally:
- fp.close()
-
- if summary is None and description:
- from docutils import core
- summary = core.publish_parts(
- source=description,
- source_path=filename,
- writer_name='html',
- )['title'].encode('utf-8')
-
- return summary, description
-
-
-def find_classifiers(docs):
- """
- Determine classifiers from CLASSIFIERS
-
- :return: List of classifiers (``['classifier', ...]``)
- :rtype: ``list``
- """
- filename = docs.get('meta.classifiers', 'CLASSIFIERS').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename)
- try:
- content = fp.read()
- finally:
- fp.close()
- content = [item.strip() for item in content.splitlines()]
- return [item for item in content if item and not item.startswith('#')]
- return []
-
-
-def find_provides(docs):
- """
- Determine provides from PROVIDES
-
- :return: List of provides (``['provides', ...]``)
- :rtype: ``list``
- """
- filename = docs.get('meta.provides', 'PROVIDES').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename)
- try:
- content = fp.read()
- finally:
- fp.close()
- content = [item.strip() for item in content.splitlines()]
- return [item for item in content if item and not item.startswith('#')]
- return []
-
-
-def find_license(docs):
- """
- Determine license from LICENSE
-
- :return: License text
- :rtype: ``str``
- """
- filename = docs.get('meta.license', 'LICENSE').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename)
- try:
- return fp.read().rstrip()
- finally:
- fp.close()
- return None
-
-
-def find_packages(manifest):
- """ Determine packages and subpackages """
- packages = {}
- collect = manifest.get('packages.collect', '').split()
- lib = manifest.get('packages.lib', '.')
- try:
- sep = _os.path.sep
- except AttributeError:
- sep = _os.path.join('1', '2')[1:-1]
- for root in collect:
- for dirpath, _, filenames in _shell.walk(_os.path.join(lib, root)):
- if dirpath.find('.svn') >= 0 or dirpath.find('.git') >= 0:
- continue
- if '__init__.py' in filenames:
- packages[
- _os.path.normpath(dirpath).replace(sep, '.')
- ] = None
- packages = packages.keys()
- packages.sort()
- return packages
-
-
-def find_data(name, docs):
- """ Determine data files """
- result = []
- if docs.get('extra', '').strip():
- result.append(_data.Documentation(docs['extra'].split(),
- prefix='share/doc/%s' % name,
- ))
- if docs.get('examples.dir', '').strip():
- tpl = ['recursive-include %s *' % docs['examples.dir']]
- if docs.get('examples.ignore', '').strip():
- tpl.extend(["global-exclude %s" % item
- for item in docs['examples.ignore'].split()
- ])
- strip = int(docs.get('examples.strip', '') or 0)
- result.append(_data.Documentation.from_templates(*tpl, **{
- 'strip': strip,
- 'prefix': 'share/doc/%s' % name,
- 'preserve': 1,
- }))
- if docs.get('userdoc.dir', '').strip():
- tpl = ['recursive-include %s *' % docs['userdoc.dir']]
- if docs.get('userdoc.ignore', '').strip():
- tpl.extend(["global-exclude %s" % item
- for item in docs['userdoc.ignore'].split()
- ])
- strip = int(docs.get('userdoc.strip', '') or 0)
- result.append(_data.Documentation.from_templates(*tpl, **{
- 'strip': strip,
- 'prefix': 'share/doc/%s' % name,
- 'preserve': 1,
- }))
- if docs.get('apidoc.dir', '').strip():
- tpl = ['recursive-include %s *' % docs['apidoc.dir']]
- if docs.get('apidoc.ignore', '').strip():
- tpl.extend(["global-exclude %s" % item
- for item in docs['apidoc.ignore'].split()
- ])
- strip = int(docs.get('apidoc.strip', '') or 0)
- result.append(_data.Documentation.from_templates(*tpl, **{
- 'strip': strip,
- 'prefix': 'share/doc/%s' % name,
- 'preserve': 1,
- }))
- if docs.get('man', '').strip():
- result.extend(_data.Manpages.dispatch(docs['man'].split()))
- return result
-
-
-def make_manifest(manifest, config, docs, kwargs):
- """ Create file list to pack up """
- # pylint: disable = R0912
- kwargs = kwargs.copy()
- kwargs['script_args'] = ['install']
- kwargs['packages'] = list(kwargs.get('packages') or ()) + [
- '_setup', '_setup.py2', '_setup.py3',
- ] + list(manifest.get('packages.extra', '').split() or ())
- _core._setup_stop_after = "commandline"
- try:
- dist = _core.setup(**kwargs)
- finally:
- _core._setup_stop_after = None
-
- result = ['MANIFEST', 'PKG-INFO', 'setup.py'] + list(config)
- # TODO: work with default values:
- for key in ('classifiers', 'description', 'summary', 'provides',
- 'license'):
- filename = docs.get('meta.' + key, '').strip()
- if filename and _os.path.isfile(filename):
- result.append(filename)
-
- cmd = dist.get_command_obj("build_py")
- cmd.ensure_finalized()
- #from pprint import pprint; pprint(("build_py", cmd.get_source_files()))
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
-
- cmd = dist.get_command_obj("build_ext")
- cmd.ensure_finalized()
- #from pprint import pprint; pprint(("build_ext", cmd.get_source_files()))
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
- for ext in cmd.extensions:
- if ext.depends:
- result.extend([_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ) for item in ext.depends])
-
- cmd = dist.get_command_obj("build_clib")
- cmd.ensure_finalized()
- if cmd.libraries:
- #import pprint; pprint.pprint(("build_clib", cmd.get_source_files()))
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
- for lib in cmd.libraries:
- if lib[1].get('depends'):
- result.extend([_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ) for item in lib[1]['depends']])
-
- cmd = dist.get_command_obj("build_scripts")
- cmd.ensure_finalized()
- #import pprint; pprint.pprint(("build_scripts", cmd.get_source_files()))
- if cmd.get_source_files():
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
-
- cmd = dist.get_command_obj("install_data")
- cmd.ensure_finalized()
- #from pprint import pprint; pprint(("install_data", cmd.get_inputs()))
- try:
- strings = basestring
- except NameError:
- strings = (str, unicode)
-
- for item in cmd.get_inputs():
- if isinstance(item, strings):
- result.append(item)
- else:
- result.extend(item[1])
-
- for item in manifest.get('dist', '').split():
- result.append(item)
- if _os.path.isdir(item):
- for filename in _shell.files(item):
- result.append(filename)
-
- result = dict([(item, None) for item in result]).keys()
- result.sort()
- return result
-
-
-def run(config=('package.cfg',), ext=None, script_args=None, manifest_only=0):
- """ Main runner """
- if ext is None:
- ext = []
-
- cfg = _util.SafeConfigParser()
- cfg.read(config)
- pkg = dict(cfg.items('package'))
- python_min = pkg.get('python.min') or None
- python_max = pkg.get('python.max') or None
- check_python_version('python', python_min, python_max)
- pypy_min = pkg.get('pypy.min') or None
- pypy_max = pkg.get('pypy.max') or None
- check_python_version('pypy', pypy_min, pypy_max)
- jython_min = pkg.get('jython.min') or None
- jython_max = pkg.get('jython.max') or None
- check_python_version('jython', jython_min, jython_max)
-
- manifest = dict(cfg.items('manifest'))
- try:
- docs = dict(cfg.items('docs'))
- except _config_parser.NoSectionError:
- docs = {}
-
- summary, description = find_description(docs)
- scripts = manifest.get('scripts', '').strip() or None
- if scripts:
- scripts = scripts.split()
- modules = manifest.get('modules', '').strip() or None
- if modules:
- modules = modules.split()
- keywords = docs.get('meta.keywords', '').strip() or None
- if keywords:
- keywords = keywords.split()
- revision = pkg.get('version.revision', '').strip()
- if revision:
- revision = "-r%s" % (revision,)
-
- kwargs = {
- 'name': pkg['name'],
- 'version': "%s%s" % (
- pkg['version.number'],
- ["", "-dev%s" % (revision,)][_util.humanbool(
- 'version.dev', pkg.get('version.dev', 'false')
- )],
- ),
- 'provides': find_provides(docs),
- 'description': summary,
- 'long_description': description,
- 'classifiers': find_classifiers(docs),
- 'keywords': keywords,
- 'author': pkg['author.name'],
- 'author_email': pkg['author.email'],
- 'maintainer': pkg.get('maintainer.name'),
- 'maintainer_email': pkg.get('maintainer.email'),
- 'url': pkg.get('url.homepage'),
- 'download_url': pkg.get('url.download'),
- 'license': find_license(docs),
- 'package_dir': {'': manifest.get('packages.lib', '.')},
- 'packages': find_packages(manifest),
- 'py_modules': modules,
- 'ext_modules': ext,
- 'scripts': scripts,
- 'script_args': script_args,
- 'data_files': find_data(pkg['name'], docs),
- 'cmdclass': {
- 'build' : _commands.Build,
- 'build_ext' : _commands.BuildExt,
- 'install' : _commands.Install,
- 'install_data': _commands.InstallData,
- 'install_lib' : _commands.InstallLib,
- }
- }
- for key in ('provides',):
- if key not in _core.setup_keywords:
- del kwargs[key]
-
- if manifest_only:
- return make_manifest(manifest, config, docs, kwargs)
-
- # monkey-patch crappy manifest writer away.
- from distutils.command import sdist
- sdist.sdist.get_file_list = sdist.sdist.read_manifest
-
- return _core.setup(**kwargs)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/shell.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/shell.py
deleted file mode 100644
index 4eafb9c8647..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/shell.py
+++ /dev/null
@@ -1,478 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007 - 2013
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-=================
- Shell utilities
-=================
-
-Shell utilities.
-"""
-from __future__ import generators
-
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import errno as _errno
-import fnmatch as _fnmatch
-import os as _os
-import shutil as _shutil
-import sys as _sys
-import tempfile as _tempfile
-
-cwd = _os.path.dirname(_os.path.abspath(_sys.argv[0]))
-
-class ExitError(RuntimeError):
- """ Exit error """
- def __init__(self, code):
- RuntimeError.__init__(self, code)
- self.code = code
- self.signal = None
-
-
-class SignalError(ExitError):
- """ Signal error """
- def __init__(self, code, signal):
- ExitError.__init__(self, code)
- import signal as _signal
- self.signal = signal
- for key, val in vars(_signal).iteritems():
- if key.startswith('SIG') and not key.startswith('SIG_'):
- if val == signal:
- self.signalstr = key[3:]
- break
- else:
- self.signalstr = '%04d' % signal
-
-
-def native(path):
- """ Convert slash path to native """
- path = _os.path.sep.join(path.split('/'))
- return _os.path.normpath(_os.path.join(cwd, path))
-
-
-def cp(src, dest):
- """ Copy src to dest """
- _shutil.copy2(native(src), native(dest))
-
-
-def cp_r(src, dest):
- """ Copy -r src to dest """
- _shutil.copytree(native(src), native(dest))
-
-
-def rm(dest):
- """ Remove a file """
- try:
- _os.unlink(native(dest))
- except OSError, e:
- if _errno.ENOENT != e.errno:
- raise
-
-def rm_rf(dest):
- """ Remove a tree """
- dest = native(dest)
- if _os.path.exists(dest):
- for path in files(dest, '*'):
- _os.chmod(native(path), 0644)
- _shutil.rmtree(dest)
-
-
-try:
- mkstemp = _tempfile.mkstemp
-except AttributeError:
- # helpers stolen from 2.4 tempfile module
- try:
- import fcntl as _fcntl
- except ImportError:
- def _set_cloexec(fd):
- """ Set close-on-exec (not implemented, but not an error) """
- # pylint: disable = W0613
- pass
- else:
- def _set_cloexec(fd):
- """ Set close-on-exec """
- try:
- flags = _fcntl.fcntl(fd, _fcntl.F_GETFD, 0)
- except IOError:
- pass
- else:
- # flags read successfully, modify
- flags |= _fcntl.FD_CLOEXEC
- _fcntl.fcntl(fd, _fcntl.F_SETFD, flags)
-
- _text_openflags = _os.O_RDWR | _os.O_CREAT | _os.O_EXCL
- _text_openflags |= getattr(_os, 'O_NOINHERIT', 0)
- _text_openflags |= getattr(_os, 'O_NOFOLLOW', 0)
-
- _bin_openflags = _text_openflags
- _bin_openflags |= getattr(_os, 'O_BINARY', 0)
-
- def mkstemp(suffix="", prefix=_tempfile.gettempprefix(), dir=None,
- text=False):
- """ Create secure temp file """
- # pylint: disable = W0622
- if dir is None:
- dir = _tempfile.gettempdir()
- if text:
- flags = _text_openflags
- else:
- flags = _bin_openflags
- count = 100
- while count > 0:
- j = _tempfile._counter.get_next() # pylint: disable = E1101, W0212
- fname = _os.path.join(dir, prefix + str(j) + suffix)
- try:
- fd = _os.open(fname, flags, 0600)
- except OSError, e:
- if e.errno == _errno.EEXIST:
- count -= 1
- continue
- raise
- _set_cloexec(fd)
- return fd, _os.path.abspath(fname)
- raise IOError, (_errno.EEXIST, "No usable temporary file name found")
-
-
-def _pipespawn(argv, env):
- """ Pipe spawn """
- # pylint: disable = R0912
- import pickle as _pickle
- fd, name = mkstemp('.py')
- try:
- _os.write(fd, (r"""
-import os
-import pickle
-try:
- import subprocess
-except ImportError:
- subprocess = None
-import sys
-
-argv = pickle.loads(%(argv)s)
-env = pickle.loads(%(env)s)
-if 'X_JYTHON_WA_PATH' in env:
- env['PATH'] = env['X_JYTHON_WA_PATH']
-
-if subprocess is None:
- pid = os.spawnve(os.P_NOWAIT, argv[0], argv, env)
- result = os.waitpid(pid, 0)[1]
-else:
- p = subprocess.Popen(argv, env=env)
- result = p.wait()
- if result < 0:
- print "\n%%d 1" %% (-result)
- sys.exit(2)
-
-if result == 0:
- sys.exit(0)
-signalled = getattr(os, 'WIFSIGNALED', None)
-if signalled is not None:
- if signalled(result):
- print "\n%%d %%d" %% (os.WTERMSIG(result), result & 7)
- sys.exit(2)
-print "\n%%d" %% (result & 7,)
-sys.exit(3)
- """.strip() + "\n") % {
- 'argv': repr(_pickle.dumps(argv)),
- 'env': repr(_pickle.dumps(env)),
- })
- fd, _ = None, _os.close(fd)
- if _sys.platform == 'win32':
- argv = []
- for arg in [_sys.executable, name]:
- if ' ' in arg or arg.startswith('"'):
- arg = '"%s"' % arg.replace('"', '\\"')
- argv.append(arg)
- argv = ' '.join(argv)
- shell = True
- close_fds = False
- else:
- argv = [_sys.executable, name]
- shell = False
- close_fds = True
-
- res = 0
- try:
- import subprocess
- except ImportError:
- import popen2 as _popen2
- proc = _popen2.Popen3(argv, False)
- try:
- proc.tochild.close()
- result = proc.fromchild.read()
- finally:
- res = proc.wait()
- else:
- if 'X_JYTHON_WA_PATH' in env:
- env['PATH'] = env['X_JYTHON_WA_PATH']
-
- proc = subprocess.Popen(argv,
- shell=shell,
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- close_fds=close_fds,
- env=env,
- )
- try:
- proc.stdin.close()
- result = proc.stdout.read()
- finally:
- res = proc.wait()
- if res != 0:
- if res == 2:
- signal, code = map(int, result.splitlines()[-1].split())
- raise SignalError(code, signal)
- elif res == 3:
- code = int(result.splitlines()[-1].strip())
- raise ExitError(code)
- raise ExitError(res)
-
- return result
- finally:
- try:
- if fd is not None:
- _os.close(fd)
- finally:
- _os.unlink(name)
-
-
-def _filepipespawn(infile, outfile, argv, env):
- """ File Pipe spawn """
- try:
- import subprocess
- except ImportError:
- subprocess = None
- import pickle as _pickle
- fd, name = mkstemp('.py')
- try:
- _os.write(fd, ("""
-import os
-import pickle
-import sys
-
-infile = pickle.loads(%(infile)s)
-outfile = pickle.loads(%(outfile)s)
-argv = pickle.loads(%(argv)s)
-env = pickle.loads(%(env)s)
-
-if infile is not None:
- infile = open(infile, 'rb')
- os.dup2(infile.fileno(), 0)
- infile.close()
-if outfile is not None:
- outfile = open(outfile, 'wb')
- os.dup2(outfile.fileno(), 1)
- outfile.close()
-
-pid = os.spawnve(os.P_NOWAIT, argv[0], argv, env)
-result = os.waitpid(pid, 0)[1]
-sys.exit(result & 7)
- """.strip() + "\n") % {
- 'infile': repr(_pickle.dumps(_os.path.abspath(infile))),
- 'outfile': repr(_pickle.dumps(_os.path.abspath(outfile))),
- 'argv': repr(_pickle.dumps(argv)),
- 'env': repr(_pickle.dumps(env)),
- })
- fd, _ = None, _os.close(fd)
- if _sys.platform == 'win32':
- argv = []
- for arg in [_sys.executable, name]:
- if ' ' in arg or arg.startswith('"'):
- arg = '"%s"' % arg.replace('"', '\\"')
- argv.append(arg)
- argv = ' '.join(argv)
- close_fds = False
- shell = True
- else:
- argv = [_sys.executable, name]
- close_fds = True
- shell = False
-
- if subprocess is None:
- pid = _os.spawnve(_os.P_NOWAIT, argv[0], argv, env)
- return _os.waitpid(pid, 0)[1]
- else:
- p = subprocess.Popen(
- argv, env=env, shell=shell, close_fds=close_fds
- )
- return p.wait()
- finally:
- try:
- if fd is not None:
- _os.close(fd)
- finally:
- _os.unlink(name)
-
-
-def spawn(*argv, **kwargs):
- """ Spawn a process """
- try:
- import subprocess
- except ImportError:
- subprocess = None
-
- if _sys.platform == 'win32':
- newargv = []
- for arg in argv:
- if not arg or ' ' in arg or arg.startswith('"'):
- arg = '"%s"' % arg.replace('"', '\\"')
- newargv.append(arg)
- argv = newargv
- close_fds = False
- shell = True
- else:
- close_fds = True
- shell = False
-
- env = kwargs.get('env')
- if env is None:
- env = dict(_os.environ)
- if 'X_JYTHON_WA_PATH' in env:
- env['PATH'] = env['X_JYTHON_WA_PATH']
-
- echo = kwargs.get('echo')
- if echo:
- print ' '.join(argv)
- filepipe = kwargs.get('filepipe')
- if filepipe:
- return _filepipespawn(
- kwargs.get('stdin'), kwargs.get('stdout'), argv, env
- )
- pipe = kwargs.get('stdout')
- if pipe:
- return _pipespawn(argv, env)
-
- if subprocess is None:
- pid = _os.spawnve(_os.P_NOWAIT, argv[0], argv, env)
- return _os.waitpid(pid, 0)[1]
- else:
- p = subprocess.Popen(argv, env=env, shell=shell, close_fds=close_fds)
- return p.wait()
-
-
-try:
- walk = _os.walk
-except AttributeError:
- # copy from python 2.4 sources (modulo docs and comments)
- def walk(top, topdown=True, onerror=None):
- """ directory tree walker """
- # pylint: disable = C0103
- join, isdir, islink = _os.path.join, _os.path.isdir, _os.path.islink
- listdir, error = _os.listdir, _os.error
-
- try:
- names = listdir(top)
- except error, err:
- if onerror is not None:
- onerror(err)
- return
-
- dirs, nondirs = [], []
- for name in names:
- if isdir(join(top, name)):
- dirs.append(name)
- else:
- nondirs.append(name)
-
- if topdown:
- yield top, dirs, nondirs
- for name in dirs:
- path = join(top, name)
- if not islink(path):
- for x in walk(path, topdown, onerror):
- yield x
- if not topdown:
- yield top, dirs, nondirs
-
-
-def files(base, wildcard='[!.]*', recursive=1, prune=('.git', '.svn', 'CVS')):
- """ Determine a filelist """
- for dirpath, dirnames, filenames in walk(native(base)):
- for item in prune:
- if item in dirnames:
- dirnames.remove(item)
-
- filenames.sort()
- for name in _fnmatch.filter(filenames, wildcard):
- dest = _os.path.join(dirpath, name)
- if dest.startswith(cwd):
- dest = dest.replace(cwd, '', 1)
- aslist = []
- head, tail = _os.path.split(dest)
- while tail:
- aslist.append(tail)
- head, tail = _os.path.split(head)
- aslist.reverse()
- dest = '/'.join(aslist)
- yield dest
-
- if not recursive:
- break
- dirnames.sort()
-
-
-def dirs(base, wildcard='[!.]*', recursive=1, prune=('.git', '.svn', 'CVS')):
- """ Determine a filelist """
- for dirpath, dirnames, filenames in walk(native(base)):
- for item in prune:
- if item in dirnames:
- dirnames.remove(item)
-
- dirnames.sort()
- for name in _fnmatch.filter(dirnames, wildcard):
- dest = _os.path.join(dirpath, name)
- if dest.startswith(cwd):
- dest = dest.replace(cwd, '', 1)
- aslist = []
- head, tail = _os.path.split(dest)
- while tail:
- aslist.append(tail)
- head, tail = _os.path.split(head)
- aslist.reverse()
- dest = '/'.join(aslist)
- yield dest
-
- if not recursive:
- break
-
-
-def frompath(executable):
- """ Find executable in PATH """
- # Based on distutils.spawn.find_executable.
- path = _os.environ.get('PATH', '')
- paths = [
- _os.path.expanduser(item)
- for item in path.split(_os.pathsep)
- ]
- ext = _os.path.splitext(executable)[1]
- exts = ['']
- if _sys.platform == 'win32' or _os.name == 'os2':
- eext = ['.exe', '.bat', '.py']
- if ext not in eext:
- exts.extend(eext)
-
- for ext in exts:
- if not _os.path.isfile(executable + ext):
- for path in paths:
- fname = _os.path.join(path, executable + ext)
- if _os.path.isfile(fname):
- # the file exists, we have a shot at spawn working
- return fname
- else:
- return executable + ext
-
- return None
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/term/__init__.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/term/__init__.py
deleted file mode 100644
index 4e50ec37493..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/term/__init__.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-=====================
- Package _setup.term
-=====================
-
-Terminal tools, not distributed.
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-# pylint: disable = W0611
-from _setup.term._term import terminfo, write, green, red, yellow, announce
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/term/_term.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/term/_term.py
deleted file mode 100644
index 72b727c1a95..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/term/_term.py
+++ /dev/null
@@ -1,115 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-=================
- Terminal writer
-=================
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import sys as _sys
-
-
-class _INFO(dict):
- """ Terminal info dict """
-
- def __init__(self):
- """ Initialization """
- dict.__init__(self, {
- 'NORMAL': '',
- 'BOLD': '',
- 'ERASE': '\n',
- 'RED': '',
- 'YELLOW': '',
- 'GREEN': '',
- })
- try:
- import curses as _curses
- except ImportError:
- # fixup if a submodule of curses failed.
- if 'curses' in _sys.modules:
- del _sys.modules['curses']
- else:
- try:
- _curses.setupterm()
- except (TypeError, _curses.error):
- pass
- else:
- def make_color(color):
- """ Make color control string """
- seq = _curses.tigetstr('setaf')
- if seq is not None:
- # XXX may fail - need better logic
- seq = seq.replace("%p1", "") % color
- return seq
-
- self['NORMAL'] = _curses.tigetstr('sgr0')
- self['BOLD'] = _curses.tigetstr('bold')
-
- erase = _curses.tigetstr('el1')
- if erase is not None:
- self['ERASE'] = erase + _curses.tigetstr('cr')
-
- self['RED'] = make_color(_curses.COLOR_RED)
- self['YELLOW'] = make_color(_curses.COLOR_YELLOW)
- self['GREEN'] = make_color(_curses.COLOR_GREEN)
-
- def __getitem__(self, key):
- """ Deliver always """
- dict.get(self, key) or ""
-
-
-def terminfo():
- """ Get info singleton """
- # pylint: disable = E1101, W0612
- if terminfo.info is None:
- terminfo.info = _INFO()
- return terminfo.info
-terminfo.info = None
-
-
-def write(fmt, **kwargs):
- """ Write stuff on the terminal """
- parm = dict(terminfo())
- parm.update(kwargs)
- _sys.stdout.write(fmt % parm)
- _sys.stdout.flush()
-
-
-def green(bmt, **kwargs):
- """ Write something in green on screen """
- announce("%%(GREEN)s%s%%(NORMAL)s" % bmt, **kwargs)
-
-
-def red(bmt, **kwargs):
- """ Write something in red on the screen """
- announce("%%(BOLD)s%%(RED)s%s%%(NORMAL)s" % bmt, **kwargs)
-
-
-def yellow(fmt, **kwargs):
- """ Write something in yellow on the screen """
- announce("%%(BOLD)s%%(YELLOW)s%s%%(NORMAL)s" % fmt, **kwargs)
-
-
-def announce(fmt, **kwargs):
- """ Announce something """
- write(fmt, **kwargs)
- _sys.stdout.write("\n")
- _sys.stdout.flush()
-
-
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/util.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/util.py
deleted file mode 100644
index 5c05fac6e4c..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py2/util.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-=================
- Setup utilities
-=================
-
-Setup utilities.
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-try:
- from distutils import log
-except ImportError:
- class log(object):
- def info(self, value):
- print value
- def debug(self, value):
- pass
- log = log()
-
-from distutils import util as _util
-try:
- from ConfigParser import SafeConfigParser
-except ImportError:
- import ConfigParser as _config_parser
- class SafeConfigParser(_config_parser.ConfigParser):
- """ Safe config parser """
- def _interpolate(self, section, option, rawval, vars):
- return rawval
-
- def items(self, section):
- return [(key, self.get(section, key))
- for key in self.options(section)
- ]
-
-
-def humanbool(name, value):
- """
- Determine human boolean value
-
- :Parameters:
- `name` : ``str``
- The config key (used for error message)
-
- `value` : ``str``
- The config value
-
- :Return: The boolean value
- :Rtype: ``bool``
-
- :Exceptions:
- - `ValueError` : The value could not be recognized
- """
- try:
- return _util.strtobool(str(value).strip().lower() or 'no')
- except ValueError:
- raise ValueError("Unrecognized config value: %s = %s" % (name, value))
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/__init__.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/__init__.py
deleted file mode 100644
index 6139d510a10..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/__init__.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-================
- Package _setup
-================
-
-This package provides tools for main package setup.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-from _setup.setup import run # pylint: disable = W0611
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/commands.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/commands.py
deleted file mode 100644
index 7bfacbc86ef..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/commands.py
+++ /dev/null
@@ -1,266 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- Command extenders
-===================
-
-Command extenders.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-__test__ = False
-
-from distutils import fancy_getopt as _fancy_getopt
-from distutils import log
-from distutils.command import build as _build
-from distutils.command import build_ext as _build_ext
-from distutils.command import install as _install
-from distutils.command import install_data as _install_data
-from distutils.command import install_lib as _install_lib
-import os as _os
-
-_option_defaults = {}
-_option_inherits = {}
-_option_finalizers = {}
-_command_mapping = {
- 'install': 'Install',
- 'install_data': 'InstallData',
- 'install_lib': 'InstallLib',
- 'build': 'Build',
- 'build_ext': 'BuildExt',
-}
-
-
-def add_option(command, long_name, help_text, short_name=None, default=None,
- inherit=None):
- """ Add an option """
- try:
- command_class = globals()[_command_mapping[command]]
- except KeyError:
- raise ValueError("Unknown command %r" % (command,))
- for opt in command_class.user_options:
- if opt[0] == long_name:
- break
- else:
- opt = (long_name, short_name, help_text)
- command_class.user_options.append(opt)
- if not long_name.endswith('='):
- command_class.boolean_options.append(long_name)
- attr_name = _fancy_getopt.translate_longopt(long_name)
- else:
- attr_name = _fancy_getopt.translate_longopt(long_name[:-1])
- if command not in _option_defaults:
- _option_defaults[command] = []
- if inherit is not None:
- if isinstance(inherit, str):
- inherit = [inherit]
- for i_inherit in inherit:
- add_option(
- i_inherit, long_name, help_text, short_name, default
- )
- default = None
- if command not in _option_inherits:
- _option_inherits[command] = []
- for i_inherit in inherit:
- for i_command, opt_name in _option_inherits[command]:
- if i_command == i_inherit and opt_name == attr_name:
- break
- else:
- _option_inherits[command].append((i_inherit, attr_name))
- _option_defaults[command].append((attr_name, default))
-
-
-def add_finalizer(command, key, func):
- """ Add finalizer """
- if command not in _option_finalizers:
- _option_finalizers[command] = {}
- if key not in _option_finalizers[command]:
- _option_finalizers[command][key] = func
-
-
-class Install(_install.install):
- """ Extended installer to reflect the additional data options """
- user_options = _install.install.user_options + [
- ('single-version-externally-managed', None,
- "Compat option. Does not a thing."),
- ]
- boolean_options = _install.install.boolean_options + [
- 'single-version-externally-managed'
- ]
-
- def initialize_options(self):
- """ Prepare for new options """
- _install.install.initialize_options(self)
- self.single_version_externally_managed = None
- if 'install' in _option_defaults:
- for opt_name, default in _option_defaults['install']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _install.install.finalize_options(self)
- if 'install' in _option_inherits:
- for parent, opt_name in _option_inherits['install']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if 'install' in _option_finalizers:
- for func in list(_option_finalizers['install'].values()):
- func(self)
-
-
-class InstallData(_install_data.install_data):
- """ Extended data installer """
- user_options = _install_data.install_data.user_options + []
- boolean_options = _install_data.install_data.boolean_options + []
-
- def initialize_options(self):
- """ Prepare for new options """
- _install_data.install_data.initialize_options(self)
- if 'install_data' in _option_defaults:
- for opt_name, default in _option_defaults['install_data']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _install_data.install_data.finalize_options(self)
- if 'install_data' in _option_inherits:
- for parent, opt_name in _option_inherits['install_data']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if 'install_data' in _option_finalizers:
- for func in list(_option_finalizers['install_data'].values()):
- func(self)
-
-
-class InstallLib(_install_lib.install_lib):
- """ Extended lib installer """
- user_options = _install_lib.install_lib.user_options + []
- boolean_options = _install_lib.install_lib.boolean_options + []
-
- def initialize_options(self):
- """ Prepare for new options """
- _install_lib.install_lib.initialize_options(self)
- if 'install_lib' in _option_defaults:
- for opt_name, default in _option_defaults['install_lib']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _install_lib.install_lib.finalize_options(self)
- if 'install_lib' in _option_inherits:
- for parent, opt_name in _option_inherits['install_lib']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if 'install_lib' in _option_finalizers:
- for func in list(_option_finalizers['install_lib'].values()):
- func(self)
-
-
-class BuildExt(_build_ext.build_ext):
- """
- Extended extension builder class
-
- This class allows extensions to provide a ``check_prerequisites`` method
- which is called before actually building it. The method takes the
- `BuildExt` instance and returns whether the extension should be skipped or
- not.
- """
-
- def initialize_options(self):
- """ Prepare for new options """
- _build_ext.build_ext.initialize_options(self)
- if 'build_ext' in _option_defaults:
- for opt_name, default in _option_defaults['build_ext']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _build_ext.build_ext.finalize_options(self)
- if 'build_ext' in _option_inherits:
- for parent, opt_name in _option_inherits['build_ext']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if 'build_ext' in _option_finalizers:
- for func in list(_option_finalizers['build_ext'].values()):
- func(self)
-
- def build_extension(self, ext):
- """
- Build C extension - with extended functionality
-
- The following features are added here:
-
- - ``ext.check_prerequisites`` is called before the extension is being
- built. See `Extension` for details. If the method does not exist,
- simply no check will be run.
- - The macros ``EXT_PACKAGE`` and ``EXT_MODULE`` will be filled (or
- unset) depending on the extensions name, but only if they are not
- already defined.
-
- :Parameters:
- `ext` : `Extension`
- The extension to build. If it's a pure
- ``distutils.core.Extension``, simply no prequisites check is
- applied.
-
- :Return: whatever ``distutils.command.build_ext.build_ext`` returns
- :Rtype: any
- """
- # handle name macros
- macros = dict(ext.define_macros or ())
- tup = ext.name.split('.')
- if len(tup) == 1:
- pkg, mod = None, tup[0]
- else:
- pkg, mod = '.'.join(tup[:-1]), tup[-1]
- if pkg is not None and 'EXT_PACKAGE' not in macros:
- ext.define_macros.append(('EXT_PACKAGE', pkg))
- if 'EXT_MODULE' not in macros:
- ext.define_macros.append(('EXT_MODULE', mod))
- if pkg is None:
- macros = dict(ext.undef_macros or ())
- if 'EXT_PACKAGE' not in macros:
- ext.undef_macros.append('EXT_PACKAGE')
-
- # handle prereq checks
- try:
- checker = ext.check_prerequisites
- except AttributeError:
- pass
- else:
- if checker(self):
- log.info("Skipping %s extension" % ext.name)
- return
-
- return _build_ext.build_ext.build_extension(self, ext)
-
-
-class Build(_build.build):
-
- def initialize_options(self):
- """ Prepare for new options """
- _build.build.initialize_options(self)
- if 'build' in _option_defaults:
- for opt_name, default in _option_defaults['build']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _build.build.finalize_options(self)
- if 'build' in _option_inherits:
- for parent, opt_name in _option_inherits['build']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if 'build' in _option_finalizers:
- for func in list(_option_finalizers['build'].values()):
- func(self)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/data.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/data.py
deleted file mode 100644
index d4221735768..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/data.py
+++ /dev/null
@@ -1,165 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- Data distribution
-===================
-
-This module provides tools to simplify data distribution.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-from distutils import filelist as _filelist
-import os as _os
-import posixpath as _posixpath
-import sys as _sys
-
-from _setup import commands as _commands
-
-
-def splitpath(path):
- """ Split a path """
- drive, path = '', _os.path.normpath(path)
- try:
- splitunc = _os.path.splitunc
- except AttributeError:
- pass
- else:
- drive, path = splitunc(path)
- if not drive:
- drive, path = _os.path.splitdrive(path)
- elems = []
- try:
- sep = _os.path.sep
- except AttributeError:
- sep = _os.path.join('1', '2')[1:-1]
- while 1:
- prefix, path = _os.path.split(path)
- elems.append(path)
- if prefix in ('', sep):
- drive = _os.path.join(drive, prefix)
- break
- path = prefix
- elems.reverse()
- return drive, elems
-
-
-def finalizer(installer):
- """ Finalize install_data """
- data_files = []
- for item in installer.data_files:
- if not isinstance(item, Data):
- data_files.append(item)
- continue
- data_files.extend(item.flatten(installer))
- installer.data_files = data_files
-
-
-class Data(object):
- """ File list container """
-
- def __init__(self, files, target=None, preserve=0, strip=0,
- prefix=None):
- """ Initialization """
- self._files = files
- self._target = target
- self._preserve = preserve
- self._strip = strip
- self._prefix = prefix
- self.fixup_commands()
-
- def fixup_commands(self):
- pass
-
- def from_templates(cls, *templates, **kwargs):
- """ Initialize from template """
- files = _filelist.FileList()
- for tpl in templates:
- for line in tpl.split(';'):
- files.process_template_line(line.strip())
- files.sort()
- files.remove_duplicates()
- result = []
- for filename in files.files:
- _, elems = splitpath(filename)
- if '.svn' in elems or '.git' in elems:
- continue
- result.append(filename)
- return cls(result, **kwargs)
- from_templates = classmethod(from_templates)
-
- def flatten(self, installer):
- """ Flatten the file list to (target, file) tuples """
- # pylint: disable = W0613
- if self._prefix:
- _, prefix = splitpath(self._prefix)
- telems = prefix
- else:
- telems = []
-
- tmap = {}
- for fname in self._files:
- (_, name), target = splitpath(fname), telems
- if self._preserve:
- if self._strip:
- name = name[max(0, min(self._strip, len(name) - 1)):]
- if len(name) > 1:
- target = telems + name[:-1]
- tmap.setdefault(_posixpath.join(*target), []).append(fname)
- return list(tmap.items())
-
-
-class Documentation(Data):
- """ Documentation container """
-
- def fixup_commands(self):
- _commands.add_option('install_data', 'without-docs',
- help_text='Do not install documentation files',
- inherit='install',
- )
- _commands.add_finalizer('install_data', 'documentation', finalizer)
-
- def flatten(self, installer):
- """ Check if docs should be installed at all """
- if installer.without_docs:
- return []
- return Data.flatten(self, installer)
-
-
-class Manpages(Documentation):
- """ Manpages container """
-
- def dispatch(cls, files):
- """ Automatically dispatch manpages to their target directories """
- mpmap = {}
- for manpage in files:
- normalized = _os.path.normpath(manpage)
- _, ext = _os.path.splitext(normalized)
- if ext.startswith(_os.path.extsep):
- ext = ext[len(_os.path.extsep):]
- mpmap.setdefault(ext, []).append(manpage)
- return [cls(manpages, prefix=_posixpath.join(
- 'share', 'man', 'man%s' % section,
- )) for section, manpages in list(mpmap.items())]
- dispatch = classmethod(dispatch)
-
- def flatten(self, installer):
- """ Check if manpages are suitable """
- if _sys.platform == 'win32':
- return []
- return Documentation.flatten(self, installer)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/dist.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/dist.py
deleted file mode 100644
index cce21e57a63..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/dist.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-================
- dist utilities
-================
-
-dist utilities.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import sys as _sys
-
-from _setup import shell as _shell
-
-
-def run_setup(*args, **kwargs):
- """ Run setup """
- if 'setup' in kwargs:
- script = kwargs.get('setup') or 'setup.py'
- del kwargs['setup']
- else:
- script = 'setup.py'
- if 'fakeroot' in kwargs:
- fakeroot = kwargs['fakeroot']
- del kwargs['fakeroot']
- else:
- fakeroot = None
- if kwargs:
- raise TypeError("Unrecognized keyword parameters")
-
- script = _shell.native(script)
- argv = [_sys.executable, script] + list(args)
- if fakeroot:
- argv.insert(0, fakeroot)
- return not _shell.spawn(*argv)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/ext.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/ext.py
deleted file mode 100644
index 852c466547e..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/ext.py
+++ /dev/null
@@ -1,253 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- C extension tools
-===================
-
-C extension tools.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-__test__ = False
-
-from distutils import core as _core
-from distutils import errors as _distutils_errors
-from distutils import log
-import os as _os
-import posixpath as _posixpath
-import shutil as _shutil
-import tempfile as _tempfile
-
-from _setup import commands as _commands
-
-def _install_finalizer(installer):
- if installer.without_c_extensions:
- installer.distribution.ext_modules = []
-
-def _build_finalizer(builder):
- if builder.without_c_extensions:
- builder.extensions = []
-
-
-class Extension(_core.Extension):
- """
- Extension with prerequisite check interface
-
- If your check is cacheable (during the setup run), override
- `cached_check_prerequisites`, `check_prerequisites` otherwise.
-
- :IVariables:
- `cached_check` : ``bool``
- The cached check result
- """
- cached_check = None
-
- def __init__(self, *args, **kwargs):
- """ Initialization """
- if 'depends' in kwargs:
- self.depends = kwargs['depends'] or []
- else:
- self.depends = []
- _core.Extension.__init__(self, *args, **kwargs)
-
- # add include path
- included = _posixpath.join('_setup', 'include')
- if included not in self.include_dirs:
- self.include_dirs.append(included)
-
- # add cext.h to the dependencies
- cext_h = _posixpath.join(included, 'cext.h')
- if cext_h not in self.depends:
- self.depends.append(cext_h)
-
- _commands.add_option('install_lib', 'without-c-extensions',
- help_text='Don\'t install C extensions',
- inherit='install',
- )
- _commands.add_finalizer('install_lib', 'c-extensions',
- _install_finalizer
- )
- _commands.add_option('build_ext', 'without-c-extensions',
- help_text='Don\'t build C extensions',
- inherit=('build', 'install_lib'),
- )
- _commands.add_finalizer('build_ext', 'c-extensions', _build_finalizer)
-
- def check_prerequisites(self, build):
- """
- Check prerequisites
-
- The check should cover all dependencies needed for the extension to
- be built and run. The method can do the following:
-
- - return a false value: the extension will be built
- - return a true value: the extension will be skipped. This is useful
- for optional extensions
- - raise an exception. This is useful for mandatory extensions
-
- If the check result is cacheable (during the setup run), override
- `cached_check_prerequisites` instead.
-
- :Parameters:
- `build` : `BuildExt`
- The extension builder
-
- :Return: Skip the extension?
- :Rtype: ``bool``
- """
- if self.cached_check is None:
- log.debug("PREREQ check for %s" % self.name)
- self.cached_check = self.cached_check_prerequisites(build)
- else:
- log.debug("PREREQ check for %s (cached)" % self.name)
- return self.cached_check
-
- def cached_check_prerequisites(self, build):
- """
- Check prerequisites
-
- The check should cover all dependencies needed for the extension to
- be built and run. The method can do the following:
-
- - return a false value: the extension will be built
- - return a true value: the extension will be skipped. This is useful
- for optional extensions
- - raise an exception. This is useful for mandatory extensions
-
- If the check result is *not* cacheable (during the setup run),
- override `check_prerequisites` instead.
-
- :Parameters:
- `build` : `BuildExt`
- The extension builder
-
- :Return: Skip the extension?
- :Rtype: ``bool``
- """
- # pylint: disable = W0613
- log.debug("Nothing to check for %s!" % self.name)
- return False
-
-
-class ConfTest(object):
- """
- Single conftest abstraction
-
- :IVariables:
- `_tempdir` : ``str``
- The tempdir created for this test
-
- `src` : ``str``
- Name of the source file
-
- `target` : ``str``
- Target filename
-
- `compiler` : ``CCompiler``
- compiler instance
-
- `obj` : ``list``
- List of object filenames (``[str, ...]``)
- """
- _tempdir = None
-
- def __init__(self, build, source):
- """
- Initialization
-
- :Parameters:
- `build` : ``distuils.command.build_ext.build_ext``
- builder instance
-
- `source` : ``str``
- Source of the file to compile
- """
- self._tempdir = tempdir = _tempfile.mkdtemp()
- src = _os.path.join(tempdir, 'conftest.c')
- fp = open(src, 'w', encoding='utf-8')
- try:
- fp.write(source)
- finally:
- fp.close()
- self.src = src
- self.compiler = compiler = build.compiler
- self.target = _os.path.join(tempdir, 'conftest')
- self.obj = compiler.object_filenames([src], output_dir=tempdir)
-
- def __del__(self):
- """ Destruction """
- self.destroy()
-
- def destroy(self):
- """ Destroy the conftest leftovers on disk """
- tempdir, self._tempdir = self._tempdir, None
- if tempdir is not None:
- _shutil.rmtree(tempdir)
-
- def compile(self, **kwargs):
- """
- Compile the conftest
-
- :Parameters:
- `kwargs` : ``dict``
- Optional keyword parameters for the compiler call
-
- :Return: Was the compilation successful?
- :Rtype: ``bool``
- """
- kwargs['output_dir'] = self._tempdir
- try:
- self.compiler.compile([self.src], **kwargs)
- except _distutils_errors.CompileError:
- return False
- return True
-
- def link(self, **kwargs):
- r"""
- Link the conftest
-
- Before you can link the conftest objects they need to be `compile`\d.
-
- :Parameters:
- `kwargs` : ``dict``
- Optional keyword parameters for the linker call
-
- :Return: Was the linking successful?
- :Rtype: ``bool``
- """
- try:
- self.compiler.link_executable(self.obj, self.target, **kwargs)
- except _distutils_errors.LinkError:
- return False
- return True
-
- def pipe(self, mode="r"):
- r"""
- Execute the conftest binary and connect to it using a pipe
-
- Before you can pipe to or from the conftest binary it needs to
- be `link`\ed.
-
- :Parameters:
- `mode` : ``str``
- Pipe mode - r/w
-
- :Return: The open pipe
- :Rtype: ``file``
- """
- return _os.popen(self.compiler.executable_filename(self.target), mode)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/setup.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/setup.py
deleted file mode 100644
index 83f1c21d544..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/setup.py
+++ /dev/null
@@ -1,420 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007 - 2013
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- Main setup runner
-===================
-
-This module provides a wrapper around the distutils core setup.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import configparser as _config_parser
-from distutils import core as _core
-import os as _os
-import posixpath as _posixpath
-import sys as _sys
-
-from _setup import commands as _commands
-from _setup import data as _data
-from _setup import ext as _ext
-from _setup import util as _util
-from _setup import shell as _shell
-
-
-def check_python_version(impl, version_min, version_max):
- """ Check python version """
- if impl == 'python':
- version_info = _sys.version_info
- elif impl == 'pypy':
- version_info = getattr(_sys, 'pypy_version_info', None)
- if not version_info:
- return
- elif impl == 'jython':
- if not 'java' in _sys.platform.lower():
- return
- version_info = _sys.version_info
- else:
- raise AssertionError("impl not in ('python', 'pypy', 'jython')")
-
- pyversion = list(map(int, version_info[:3]))
- if version_min:
- min_required = list(
- map(int, '.'.join((version_min, '0.0.0')).split('.')[:3])
- )
- if pyversion < min_required:
- raise EnvironmentError("Need at least %s %s (vs. %s)" % (
- impl, version_min, '.'.join(map(str, pyversion))
- ))
- if version_max:
- max_required = list(map(int, version_max.split('.')))
- max_required[-1] += 1
- if pyversion >= max_required:
- raise EnvironmentError("Need at max %s %s (vs. %s)" % (
- impl,
- version_max,
- '.'.join(map(str, pyversion))
- ))
-
-
-def find_description(docs):
- """
- Determine the package description from DESCRIPTION
-
- :Parameters:
- `docs` : ``dict``
- Docs config section
-
- :Return: Tuple of summary, description and license
- (``('summary', 'description', 'license')``)
- (all may be ``None``)
- :Rtype: ``tuple``
- """
- summary = None
- filename = docs.get('meta.summary', 'SUMMARY').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename, encoding='utf-8')
- try:
- try:
- summary = fp.read().strip().splitlines()[0].rstrip()
- except IndexError:
- summary = ''
- finally:
- fp.close()
-
- description = None
- filename = docs.get('meta.description', 'DESCRIPTION').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename, encoding='utf-8')
- try:
- description = fp.read().rstrip()
- finally:
- fp.close()
-
- if summary is None and description:
- from docutils import core
- summary = core.publish_parts(
- source=description,
- source_path=filename,
- writer_name='html',
- )['title'].encode('utf-8')
-
- return summary, description
-
-
-def find_classifiers(docs):
- """
- Determine classifiers from CLASSIFIERS
-
- :return: List of classifiers (``['classifier', ...]``)
- :rtype: ``list``
- """
- filename = docs.get('meta.classifiers', 'CLASSIFIERS').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename, encoding='utf-8')
- try:
- content = fp.read()
- finally:
- fp.close()
- content = [item.strip() for item in content.splitlines()]
- return [item for item in content if item and not item.startswith('#')]
- return []
-
-
-def find_provides(docs):
- """
- Determine provides from PROVIDES
-
- :return: List of provides (``['provides', ...]``)
- :rtype: ``list``
- """
- filename = docs.get('meta.provides', 'PROVIDES').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename, encoding='utf-8')
- try:
- content = fp.read()
- finally:
- fp.close()
- content = [item.strip() for item in content.splitlines()]
- return [item for item in content if item and not item.startswith('#')]
- return []
-
-
-def find_license(docs):
- """
- Determine license from LICENSE
-
- :return: License text
- :rtype: ``str``
- """
- filename = docs.get('meta.license', 'LICENSE').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename, encoding='utf-8')
- try:
- return fp.read().rstrip()
- finally:
- fp.close()
- return None
-
-
-def find_packages(manifest):
- """ Determine packages and subpackages """
- packages = {}
- collect = manifest.get('packages.collect', '').split()
- lib = manifest.get('packages.lib', '.')
- try:
- sep = _os.path.sep
- except AttributeError:
- sep = _os.path.join('1', '2')[1:-1]
- for root in collect:
- for dirpath, _, filenames in _shell.walk(_os.path.join(lib, root)):
- if dirpath.find('.svn') >= 0 or dirpath.find('.git') >= 0:
- continue
- if '__init__.py' in filenames:
- packages[
- _os.path.normpath(dirpath).replace(sep, '.')
- ] = None
- packages = list(packages.keys())
- packages.sort()
- return packages
-
-
-def find_data(name, docs):
- """ Determine data files """
- result = []
- if docs.get('extra', '').strip():
- result.append(_data.Documentation(docs['extra'].split(),
- prefix='share/doc/%s' % name,
- ))
- if docs.get('examples.dir', '').strip():
- tpl = ['recursive-include %s *' % docs['examples.dir']]
- if docs.get('examples.ignore', '').strip():
- tpl.extend(["global-exclude %s" % item
- for item in docs['examples.ignore'].split()
- ])
- strip = int(docs.get('examples.strip', '') or 0)
- result.append(_data.Documentation.from_templates(*tpl, **{
- 'strip': strip,
- 'prefix': 'share/doc/%s' % name,
- 'preserve': 1,
- }))
- if docs.get('userdoc.dir', '').strip():
- tpl = ['recursive-include %s *' % docs['userdoc.dir']]
- if docs.get('userdoc.ignore', '').strip():
- tpl.extend(["global-exclude %s" % item
- for item in docs['userdoc.ignore'].split()
- ])
- strip = int(docs.get('userdoc.strip', '') or 0)
- result.append(_data.Documentation.from_templates(*tpl, **{
- 'strip': strip,
- 'prefix': 'share/doc/%s' % name,
- 'preserve': 1,
- }))
- if docs.get('apidoc.dir', '').strip():
- tpl = ['recursive-include %s *' % docs['apidoc.dir']]
- if docs.get('apidoc.ignore', '').strip():
- tpl.extend(["global-exclude %s" % item
- for item in docs['apidoc.ignore'].split()
- ])
- strip = int(docs.get('apidoc.strip', '') or 0)
- result.append(_data.Documentation.from_templates(*tpl, **{
- 'strip': strip,
- 'prefix': 'share/doc/%s' % name,
- 'preserve': 1,
- }))
- if docs.get('man', '').strip():
- result.extend(_data.Manpages.dispatch(docs['man'].split()))
- return result
-
-
-def make_manifest(manifest, config, docs, kwargs):
- """ Create file list to pack up """
- # pylint: disable = R0912
- kwargs = kwargs.copy()
- kwargs['script_args'] = ['install']
- kwargs['packages'] = list(kwargs.get('packages') or ()) + [
- '_setup', '_setup.py2', '_setup.py3',
- ] + list(manifest.get('packages.extra', '').split() or ())
- _core._setup_stop_after = "commandline"
- try:
- dist = _core.setup(**kwargs)
- finally:
- _core._setup_stop_after = None
-
- result = ['MANIFEST', 'PKG-INFO', 'setup.py'] + list(config)
- # TODO: work with default values:
- for key in ('classifiers', 'description', 'summary', 'provides',
- 'license'):
- filename = docs.get('meta.' + key, '').strip()
- if filename and _os.path.isfile(filename):
- result.append(filename)
-
- cmd = dist.get_command_obj("build_py")
- cmd.ensure_finalized()
- #from pprint import pprint; pprint(("build_py", cmd.get_source_files()))
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
-
- cmd = dist.get_command_obj("build_ext")
- cmd.ensure_finalized()
- #from pprint import pprint; pprint(("build_ext", cmd.get_source_files()))
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
- for ext in cmd.extensions:
- if ext.depends:
- result.extend([_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ) for item in ext.depends])
-
- cmd = dist.get_command_obj("build_clib")
- cmd.ensure_finalized()
- if cmd.libraries:
- #import pprint; pprint.pprint(("build_clib", cmd.get_source_files()))
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
- for lib in cmd.libraries:
- if lib[1].get('depends'):
- result.extend([_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ) for item in lib[1]['depends']])
-
- cmd = dist.get_command_obj("build_scripts")
- cmd.ensure_finalized()
- #import pprint; pprint.pprint(("build_scripts", cmd.get_source_files()))
- if cmd.get_source_files():
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
-
- cmd = dist.get_command_obj("install_data")
- cmd.ensure_finalized()
- #from pprint import pprint; pprint(("install_data", cmd.get_inputs()))
- try:
- strings = str
- except NameError:
- strings = (str, str)
-
- for item in cmd.get_inputs():
- if isinstance(item, strings):
- result.append(item)
- else:
- result.extend(item[1])
-
- for item in manifest.get('dist', '').split():
- result.append(item)
- if _os.path.isdir(item):
- for filename in _shell.files(item):
- result.append(filename)
-
- result = list(dict([(item, None) for item in result]).keys())
- result.sort()
- return result
-
-
-def run(config=('package.cfg',), ext=None, script_args=None, manifest_only=0):
- """ Main runner """
- if ext is None:
- ext = []
-
- cfg = _util.SafeConfigParser()
- cfg.read(config, encoding='utf-8')
- pkg = dict(cfg.items('package'))
- python_min = pkg.get('python.min') or None
- python_max = pkg.get('python.max') or None
- check_python_version('python', python_min, python_max)
- pypy_min = pkg.get('pypy.min') or None
- pypy_max = pkg.get('pypy.max') or None
- check_python_version('pypy', pypy_min, pypy_max)
- jython_min = pkg.get('jython.min') or None
- jython_max = pkg.get('jython.max') or None
- check_python_version('jython', jython_min, jython_max)
-
- manifest = dict(cfg.items('manifest'))
- try:
- docs = dict(cfg.items('docs'))
- except _config_parser.NoSectionError:
- docs = {}
-
- summary, description = find_description(docs)
- scripts = manifest.get('scripts', '').strip() or None
- if scripts:
- scripts = scripts.split()
- modules = manifest.get('modules', '').strip() or None
- if modules:
- modules = modules.split()
- keywords = docs.get('meta.keywords', '').strip() or None
- if keywords:
- keywords = keywords.split()
- revision = pkg.get('version.revision', '').strip()
- if revision:
- revision = "-r%s" % (revision,)
-
- kwargs = {
- 'name': pkg['name'],
- 'version': "%s%s" % (
- pkg['version.number'],
- ["", "-dev%s" % (revision,)][_util.humanbool(
- 'version.dev', pkg.get('version.dev', 'false')
- )],
- ),
- 'provides': find_provides(docs),
- 'description': summary,
- 'long_description': description,
- 'classifiers': find_classifiers(docs),
- 'keywords': keywords,
- 'author': pkg['author.name'],
- 'author_email': pkg['author.email'],
- 'maintainer': pkg.get('maintainer.name'),
- 'maintainer_email': pkg.get('maintainer.email'),
- 'url': pkg.get('url.homepage'),
- 'download_url': pkg.get('url.download'),
- 'license': find_license(docs),
- 'package_dir': {'': manifest.get('packages.lib', '.')},
- 'packages': find_packages(manifest),
- 'py_modules': modules,
- 'ext_modules': ext,
- 'scripts': scripts,
- 'script_args': script_args,
- 'data_files': find_data(pkg['name'], docs),
- 'cmdclass': {
- 'build' : _commands.Build,
- 'build_ext' : _commands.BuildExt,
- 'install' : _commands.Install,
- 'install_data': _commands.InstallData,
- 'install_lib' : _commands.InstallLib,
- }
- }
- for key in ('provides',):
- if key not in _core.setup_keywords:
- del kwargs[key]
-
- if manifest_only:
- return make_manifest(manifest, config, docs, kwargs)
-
- # monkey-patch crappy manifest writer away.
- from distutils.command import sdist
- sdist.sdist.get_file_list = sdist.sdist.read_manifest
-
- return _core.setup(**kwargs)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/shell.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/shell.py
deleted file mode 100644
index 91f2ebc5b40..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/shell.py
+++ /dev/null
@@ -1,351 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007 - 2013
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-=================
- Shell utilities
-=================
-
-Shell utilities.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import errno as _errno
-import fnmatch as _fnmatch
-import os as _os
-import shutil as _shutil
-import subprocess as _subprocess
-import sys as _sys
-import tempfile as _tempfile
-
-cwd = _os.path.dirname(_os.path.abspath(_sys.argv[0]))
-
-class ExitError(RuntimeError):
- """ Exit error """
- def __init__(self, code):
- RuntimeError.__init__(self, code)
- self.code = code
- self.signal = None
-
-
-class SignalError(ExitError):
- """ Signal error """
- def __init__(self, code, signal):
- ExitError.__init__(self, code)
- import signal as _signal
- self.signal = signal
- for key, val in vars(_signal).items():
- if key.startswith('SIG') and not key.startswith('SIG_'):
- if val == signal:
- self.signalstr = key[3:]
- break
- else:
- self.signalstr = '%04d' % signal
-
-
-def native(path):
- """ Convert slash path to native """
- path = _os.path.sep.join(path.split('/'))
- return _os.path.normpath(_os.path.join(cwd, path))
-
-
-def cp(src, dest):
- """ Copy src to dest """
- _shutil.copy2(native(src), native(dest))
-
-
-def cp_r(src, dest):
- """ Copy -r src to dest """
- _shutil.copytree(native(src), native(dest))
-
-
-def rm(dest):
- """ Remove a file """
- try:
- _os.unlink(native(dest))
- except OSError as e:
- if _errno.ENOENT != e.errno:
- raise
-
-def rm_rf(dest):
- """ Remove a tree """
- dest = native(dest)
- if _os.path.exists(dest):
- for path in files(dest, '*'):
- _os.chmod(native(path), 0o644)
- _shutil.rmtree(dest)
-
-
-mkstemp = _tempfile.mkstemp
-
-
-def _pipespawn(argv, env):
- """ Pipe spawn """
- # pylint: disable = R0912
- import pickle as _pickle
- fd, name = mkstemp('.py')
- try:
- _os.write(fd, ((r"""
-import os
-import pickle
-import subprocess
-import sys
-
-argv = pickle.loads(%(argv)s)
-env = pickle.loads(%(env)s)
-if 'X_JYTHON_WA_PATH' in env:
- env['PATH'] = env['X_JYTHON_WA_PATH']
-
-p = subprocess.Popen(argv, env=env)
-result = p.wait()
-if result < 0:
- print("\n%%d 1" %% (-result))
- sys.exit(2)
-if result == 0:
- sys.exit(0)
-print("\n%%d" %% (result & 7,))
-sys.exit(3)
- """.strip() + "\n") % {
- 'argv': repr(_pickle.dumps(argv)),
- 'env': repr(_pickle.dumps(dict(env))),
- }).encode('utf-8'))
- fd, _ = None, _os.close(fd)
- if _sys.platform == 'win32':
- argv = []
- for arg in [_sys.executable, name]:
- if ' ' in arg or arg.startswith('"'):
- arg = '"%s"' % arg.replace('"', '\\"')
- argv.append(arg)
- argv = ' '.join(argv)
- shell = True
- close_fds = False
- else:
- argv = [_sys.executable, name]
- shell = False
- close_fds = True
-
- res = 0
- if 'X_JYTHON_WA_PATH' in env:
- env['PATH'] = env['X_JYTHON_WA_PATH']
-
- proc = _subprocess.Popen(argv,
- shell=shell,
- stdin=_subprocess.PIPE,
- stdout=_subprocess.PIPE,
- close_fds=close_fds,
- env=env,
- )
- try:
- proc.stdin.close()
- result = proc.stdout.read()
- finally:
- res = proc.wait()
- if res != 0:
- if res == 2:
- signal, code = list(map(int, result.splitlines()[-1].split()))
- raise SignalError(code, signal)
- elif res == 3:
- code = int(result.splitlines()[-1].strip())
- raise ExitError(code)
- raise ExitError(res)
-
- return result.decode('latin-1')
- finally:
- try:
- if fd is not None:
- _os.close(fd)
- finally:
- _os.unlink(name)
-
-
-def _filepipespawn(infile, outfile, argv, env):
- """ File Pipe spawn """
- import pickle as _pickle
- fd, name = mkstemp('.py')
- try:
- _os.write(fd, (("""
-import os
-import pickle
-import sys
-
-infile = pickle.loads(%(infile)s)
-outfile = pickle.loads(%(outfile)s)
-argv = pickle.loads(%(argv)s)
-env = pickle.loads(%(env)s)
-
-if infile is not None:
- infile = open(infile, 'rb')
- os.dup2(infile.fileno(), 0)
- infile.close()
-if outfile is not None:
- outfile = open(outfile, 'wb')
- os.dup2(outfile.fileno(), 1)
- outfile.close()
-
-pid = os.spawnve(os.P_NOWAIT, argv[0], argv, env)
-result = os.waitpid(pid, 0)[1]
-sys.exit(result & 7)
- """.strip() + "\n") % {
- 'infile': repr(_pickle.dumps(_os.path.abspath(infile))),
- 'outfile': repr(_pickle.dumps(_os.path.abspath(outfile))),
- 'argv': repr(_pickle.dumps(argv)),
- 'env': repr(_pickle.dumps(env)),
- }).encode('utf-8'))
- fd, _ = None, _os.close(fd)
- if _sys.platform == 'win32':
- argv = []
- for arg in [_sys.executable, name]:
- if ' ' in arg or arg.startswith('"'):
- arg = '"%s"' % arg.replace('"', '\\"')
- argv.append(arg)
- argv = ' '.join(argv)
- close_fds = False
- shell = True
- else:
- argv = [_sys.executable, name]
- close_fds = True
- shell = False
-
- p = _subprocess.Popen(
- argv, env=env, shell=shell, close_fds=close_fds
- )
- return p.wait()
- finally:
- try:
- if fd is not None:
- _os.close(fd)
- finally:
- _os.unlink(name)
-
-
-def spawn(*argv, **kwargs):
- """ Spawn a process """
- if _sys.platform == 'win32':
- newargv = []
- for arg in argv:
- if not arg or ' ' in arg or arg.startswith('"'):
- arg = '"%s"' % arg.replace('"', '\\"')
- newargv.append(arg)
- argv = newargv
- close_fds = False
- shell = True
- else:
- close_fds = True
- shell = False
-
- env = kwargs.get('env')
- if env is None:
- env = dict(_os.environ)
- if 'X_JYTHON_WA_PATH' in env:
- env['PATH'] = env['X_JYTHON_WA_PATH']
-
- echo = kwargs.get('echo')
- if echo:
- print(' '.join(argv))
- filepipe = kwargs.get('filepipe')
- if filepipe:
- return _filepipespawn(
- kwargs.get('stdin'), kwargs.get('stdout'), argv, env
- )
- pipe = kwargs.get('stdout')
- if pipe:
- return _pipespawn(argv, env)
-
- p = _subprocess.Popen(argv, env=env, shell=shell, close_fds=close_fds)
- return p.wait()
-
-
-walk = _os.walk
-
-
-def files(base, wildcard='[!.]*', recursive=1, prune=('.git', '.svn', 'CVS')):
- """ Determine a filelist """
- for dirpath, dirnames, filenames in walk(native(base)):
- for item in prune:
- if item in dirnames:
- dirnames.remove(item)
-
- filenames.sort()
- for name in _fnmatch.filter(filenames, wildcard):
- dest = _os.path.join(dirpath, name)
- if dest.startswith(cwd):
- dest = dest.replace(cwd, '', 1)
- aslist = []
- head, tail = _os.path.split(dest)
- while tail:
- aslist.append(tail)
- head, tail = _os.path.split(head)
- aslist.reverse()
- dest = '/'.join(aslist)
- yield dest
-
- if not recursive:
- break
- dirnames.sort()
-
-
-def dirs(base, wildcard='[!.]*', recursive=1, prune=('.git', '.svn', 'CVS')):
- """ Determine a filelist """
- for dirpath, dirnames, filenames in walk(native(base)):
- for item in prune:
- if item in dirnames:
- dirnames.remove(item)
-
- dirnames.sort()
- for name in _fnmatch.filter(dirnames, wildcard):
- dest = _os.path.join(dirpath, name)
- if dest.startswith(cwd):
- dest = dest.replace(cwd, '', 1)
- aslist = []
- head, tail = _os.path.split(dest)
- while tail:
- aslist.append(tail)
- head, tail = _os.path.split(head)
- aslist.reverse()
- dest = '/'.join(aslist)
- yield dest
-
- if not recursive:
- break
-
-
-def frompath(executable):
- """ Find executable in PATH """
- # Based on distutils.spawn.find_executable.
- path = _os.environ.get('PATH', '')
- paths = [
- _os.path.expanduser(item)
- for item in path.split(_os.pathsep)
- ]
- ext = _os.path.splitext(executable)[1]
- exts = ['']
- if _sys.platform == 'win32' or _os.name == 'os2':
- eext = ['.exe', '.bat', '.py']
- if ext not in eext:
- exts.extend(eext)
-
- for ext in exts:
- if not _os.path.isfile(executable + ext):
- for path in paths:
- fname = _os.path.join(path, executable + ext)
- if _os.path.isfile(fname):
- # the file exists, we have a shot at spawn working
- return fname
- else:
- return executable + ext
-
- return None
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/term/__init__.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/term/__init__.py
deleted file mode 100644
index 5459454514b..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/term/__init__.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-=====================
- Package _setup.term
-=====================
-
-Terminal tools, not distributed.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-# pylint: disable = W0611
-from _setup.term._term import terminfo, write, green, red, yellow, announce
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/term/_term.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/term/_term.py
deleted file mode 100644
index b94f58e27f1..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/term/_term.py
+++ /dev/null
@@ -1,116 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-=================
- Terminal writer
-=================
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import sys as _sys
-
-
-class _INFO(dict):
- """ Terminal info dict """
-
- def __init__(self):
- """ Initialization """
- dict.__init__(self, {
- 'NORMAL': '',
- 'BOLD': '',
- 'ERASE': '\n',
- 'RED': '',
- 'YELLOW': '',
- 'GREEN': '',
- })
- try:
- import curses as _curses
- except ImportError:
- # fixup if a submodule of curses failed.
- if 'curses' in _sys.modules:
- del _sys.modules['curses']
- else:
- try:
- _curses.setupterm()
- except (TypeError, _curses.error):
- pass
- else:
- def make_color(color):
- """ Make color control string """
- seq = _curses.tigetstr('setaf').decode('ascii')
- if seq is not None:
- # XXX may fail - need better logic
- seq = seq.replace("%p1", "") % color
- return seq
-
- self['NORMAL'] = _curses.tigetstr('sgr0').decode('ascii')
- self['BOLD'] = _curses.tigetstr('bold').decode('ascii')
-
- erase = _curses.tigetstr('el1').decode('ascii')
- if erase is not None:
- self['ERASE'] = erase + \
- _curses.tigetstr('cr').decode('ascii')
-
- self['RED'] = make_color(_curses.COLOR_RED)
- self['YELLOW'] = make_color(_curses.COLOR_YELLOW)
- self['GREEN'] = make_color(_curses.COLOR_GREEN)
-
- def __getitem__(self, key):
- """ Deliver always """
- dict.get(self, key) or ""
-
-
-def terminfo():
- """ Get info singleton """
- # pylint: disable = E1101, W0612
- if terminfo.info is None:
- terminfo.info = _INFO()
- return terminfo.info
-terminfo.info = None
-
-
-def write(fmt, **kwargs):
- """ Write stuff on the terminal """
- parm = dict(terminfo())
- parm.update(kwargs)
- _sys.stdout.write(fmt % parm)
- _sys.stdout.flush()
-
-
-def green(bmt, **kwargs):
- """ Write something in green on screen """
- announce("%%(GREEN)s%s%%(NORMAL)s" % bmt, **kwargs)
-
-
-def red(bmt, **kwargs):
- """ Write something in red on the screen """
- announce("%%(BOLD)s%%(RED)s%s%%(NORMAL)s" % bmt, **kwargs)
-
-
-def yellow(fmt, **kwargs):
- """ Write something in yellow on the screen """
- announce("%%(BOLD)s%%(YELLOW)s%s%%(NORMAL)s" % fmt, **kwargs)
-
-
-def announce(fmt, **kwargs):
- """ Announce something """
- write(fmt, **kwargs)
- _sys.stdout.write("\n")
- _sys.stdout.flush()
-
-
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/util.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/util.py
deleted file mode 100644
index a07daa812fe..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/_setup/py3/util.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-=================
- Setup utilities
-=================
-
-Setup utilities.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-from distutils import util as _util
-try:
- from configparser import SafeConfigParser
-except ImportError:
- import configparser as _config_parser
- class SafeConfigParser(_config_parser.ConfigParser):
- """ Safe config parser """
- def _interpolate(self, section, option, rawval, vars):
- return rawval
-
- def items(self, section):
- return [(key, self.get(section, key))
- for key in self.options(section)
- ]
-
-
-def humanbool(name, value):
- """
- Determine human boolean value
-
- :Parameters:
- `name` : ``str``
- The config key (used for error message)
-
- `value` : ``str``
- The config value
-
- :Return: The boolean value
- :Rtype: ``bool``
-
- :Exceptions:
- - `ValueError` : The value could not be recognized
- """
- try:
- return _util.strtobool(str(value).strip().lower() or 'no')
- except ValueError:
- raise ValueError("Unrecognized config value: %s = %s" % (name, value))
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/LICENSE.cssmin b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/LICENSE.cssmin
deleted file mode 100644
index c10ccb05c7a..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/LICENSE.cssmin
+++ /dev/null
@@ -1,64 +0,0 @@
-`cssmin.py` - A Python port of the YUI CSS compressor.
-
-Copyright (c) 2010 Zachary Voase
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
--------------------------------------------------------------------------------
-
-This software contains portions of the YUI CSS Compressor, notably some regular
-expressions for reducing the size of CSS. The YUI Compressor source code can be
-found at <http://github.com/yui/yuicompressor>, and is licensed as follows:
-
-> YUI Compressor Copyright License Agreement (BSD License)
->
-> Copyright (c) 2009, Yahoo! Inc.
-> All rights reserved.
->
-> Redistribution and use of this software in source and binary forms,
-> with or without modification, are permitted provided that the following
-> conditions are met:
->
-> * Redistributions of source code must retain the above
-> copyright notice, this list of conditions and the
-> following disclaimer.
->
-> * Redistributions in binary form must reproduce the above
-> copyright notice, this list of conditions and the
-> following disclaimer in the documentation and/or other
-> materials provided with the distribution.
->
-> * Neither the name of Yahoo! Inc. nor the names of its
-> contributors may be used to endorse or promote products
-> derived from this software without specific prior
-> written permission of Yahoo! Inc.
->
-> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-> AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-> IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-> DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
-> FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-> DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-> SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-> CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-> OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-> OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/__init__.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/__init__.py
deleted file mode 100644
index 705dd0ccd1b..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: ascii -*-
-r"""
-=================================
- Benchmark cssmin implementations
-=================================
-
-Benchmark cssmin implementations.
-
-:Copyright:
-
- Copyright 2011 - 2014
- Andr\xe9 Malo or his licensors, as applicable
-
-:License:
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-"""
-if __doc__:
- __doc__ = __doc__.encode('ascii').decode('unicode_escape')
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/cssmin.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/cssmin.py
deleted file mode 100644
index cbfbf8d4966..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/cssmin.py
+++ /dev/null
@@ -1,246 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-"""`cssmin` - A Python port of the YUI CSS compressor.
-
-:Copyright:
-
- Copyright 2011 - 2014
- Andr\xe9 Malo or his licensors, as applicable
-
-:License:
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-"""
-
-try:
- from StringIO import StringIO # The pure-Python StringIO supports unicode.
-except ImportError:
- from io import StringIO
-import re
-
-
-__version__ = '0.2.0'
-
-
-def remove_comments(css):
- """Remove all CSS comment blocks."""
-
- iemac = False
- preserve = False
- comment_start = css.find("/*")
- while comment_start >= 0:
- # Preserve comments that look like `/*!...*/`.
- # Slicing is used to make sure we don"t get an IndexError.
- preserve = css[comment_start + 2:comment_start + 3] == "!"
-
- comment_end = css.find("*/", comment_start + 2)
- if comment_end < 0:
- if not preserve:
- css = css[:comment_start]
- break
- elif comment_end >= (comment_start + 2):
- if css[comment_end - 1] == "\\":
- # This is an IE Mac-specific comment; leave this one and the
- # following one alone.
- comment_start = comment_end + 2
- iemac = True
- elif iemac:
- comment_start = comment_end + 2
- iemac = False
- elif not preserve:
- css = css[:comment_start] + css[comment_end + 2:]
- else:
- comment_start = comment_end + 2
- comment_start = css.find("/*", comment_start)
-
- return css
-
-
-def remove_unnecessary_whitespace(css):
- """Remove unnecessary whitespace characters."""
-
- def pseudoclasscolon(css):
-
- """
- Prevents 'p :link' from becoming 'p:link'.
-
- Translates 'p :link' into 'p ___PSEUDOCLASSCOLON___link'; this is
- translated back again later.
- """
-
- regex = re.compile(r"(^|\})(([^\{\:])+\:)+([^\{]*\{)")
- match = regex.search(css)
- while match:
- css = ''.join([
- css[:match.start()],
- match.group().replace(":", "___PSEUDOCLASSCOLON___"),
- css[match.end():]])
- match = regex.search(css)
- return css
-
- css = pseudoclasscolon(css)
- # Remove spaces from before things.
- css = re.sub(r"\s+([!{};:>+\(\)\],])", r"\1", css)
-
- # If there is a `@charset`, then only allow one, and move to the beginning.
- css = re.sub(r"^(.*)(@charset \"[^\"]*\";)", r"\2\1", css)
- css = re.sub(r"^(\s*@charset [^;]+;\s*)+", r"\1", css)
-
- # Put the space back in for a few cases, such as `@media screen` and
- # `(-webkit-min-device-pixel-ratio:0)`.
- css = re.sub(r"\band\(", "and (", css)
-
- # Put the colons back.
- css = css.replace('___PSEUDOCLASSCOLON___', ':')
-
- # Remove spaces from after things.
- css = re.sub(r"([!{}:;>+\(\[,])\s+", r"\1", css)
-
- return css
-
-
-def remove_unnecessary_semicolons(css):
- """Remove unnecessary semicolons."""
-
- return re.sub(r";+\}", "}", css)
-
-
-def remove_empty_rules(css):
- """Remove empty rules."""
-
- return re.sub(r"[^\}\{]+\{\}", "", css)
-
-
-def normalize_rgb_colors_to_hex(css):
- """Convert `rgb(51,102,153)` to `#336699`."""
-
- regex = re.compile(r"rgb\s*\(\s*([0-9,\s]+)\s*\)")
- match = regex.search(css)
- while match:
- colors = map(lambda s: s.strip(), match.group(1).split(","))
- hexcolor = '#%.2x%.2x%.2x' % tuple(map(int, colors))
- css = css.replace(match.group(), hexcolor)
- match = regex.search(css)
- return css
-
-
-def condense_zero_units(css):
- """Replace `0(px, em, %, etc)` with `0`."""
-
- return re.sub(r"([\s:])(0)(px|em|%|in|cm|mm|pc|pt|ex)", r"\1\2", css)
-
-
-def condense_multidimensional_zeros(css):
- """Replace `:0 0 0 0;`, `:0 0 0;` etc. with `:0;`."""
-
- css = css.replace(":0 0 0 0;", ":0;")
- css = css.replace(":0 0 0;", ":0;")
- css = css.replace(":0 0;", ":0;")
-
- # Revert `background-position:0;` to the valid `background-position:0 0;`.
- css = css.replace("background-position:0;", "background-position:0 0;")
-
- return css
-
-
-def condense_floating_points(css):
- """Replace `0.6` with `.6` where possible."""
-
- return re.sub(r"(:|\s)0+\.(\d+)", r"\1.\2", css)
-
-
-def condense_hex_colors(css):
- """Shorten colors from #AABBCC to #ABC where possible."""
-
- regex = re.compile(r"([^\"'=\s])(\s*)#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])")
- match = regex.search(css)
- while match:
- first = match.group(3) + match.group(5) + match.group(7)
- second = match.group(4) + match.group(6) + match.group(8)
- if first.lower() == second.lower():
- css = css.replace(match.group(), match.group(1) + match.group(2) + '#' + first)
- match = regex.search(css, match.end() - 3)
- else:
- match = regex.search(css, match.end())
- return css
-
-
-def condense_whitespace(css):
- """Condense multiple adjacent whitespace characters into one."""
-
- return re.sub(r"\s+", " ", css)
-
-
-def condense_semicolons(css):
- """Condense multiple adjacent semicolon characters into one."""
-
- return re.sub(r";;+", ";", css)
-
-
-def wrap_css_lines(css, line_length):
- """Wrap the lines of the given CSS to an approximate length."""
-
- lines = []
- line_start = 0
- for i, char in enumerate(css):
- # It's safe to break after `}` characters.
- if char == '}' and (i - line_start >= line_length):
- lines.append(css[line_start:i + 1])
- line_start = i + 1
-
- if line_start < len(css):
- lines.append(css[line_start:])
- return '\n'.join(lines)
-
-
-def cssmin(css, wrap=None):
- css = remove_comments(css)
- css = condense_whitespace(css)
- # A pseudo class for the Box Model Hack
- # (see http://tantek.com/CSS/Examples/boxmodelhack.html)
- css = css.replace('"\\"}\\""', "___PSEUDOCLASSBMH___")
- css = remove_unnecessary_whitespace(css)
- css = remove_unnecessary_semicolons(css)
- css = condense_zero_units(css)
- css = condense_multidimensional_zeros(css)
- css = condense_floating_points(css)
- css = normalize_rgb_colors_to_hex(css)
- css = condense_hex_colors(css)
- if wrap is not None:
- css = wrap_css_lines(css, wrap)
- css = css.replace("___PSEUDOCLASSBMH___", '"\\"}\\""')
- css = condense_semicolons(css)
- return css.strip()
-
-
-def main():
- import optparse
- import sys
-
- p = optparse.OptionParser(
- prog="cssmin", version=__version__,
- usage="%prog [--wrap N]",
- description="""Reads raw CSS from stdin, and writes compressed CSS to stdout.""")
-
- p.add_option(
- '-w', '--wrap', type='int', default=None, metavar='N',
- help="Wrap output to approximately N chars per line.")
-
- options, args = p.parse_args()
- sys.stdout.write(cssmin(sys.stdin.read(), wrap=options.wrap))
-
-
-if __name__ == '__main__':
- main()
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/main.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/main.py
deleted file mode 100644
index 078150629f2..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/main.py
+++ /dev/null
@@ -1,236 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: ascii -*-
-r"""
-==================================
- Benchmark cssmin implementations
-==================================
-
-Benchmark cssmin implementations.
-
-:Copyright:
-
- Copyright 2011 - 2014
- Andr\xe9 Malo or his licensors, as applicable
-
-:License:
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-Usage::
-
- python -mbench.main [-c COUNT] [-p file] cssfile ...
-
- -c COUNT number of runs per cssfile and minifier. Defaults to 10.
- -p file File to write the benchmark results in (pickled)
-
-"""
-if __doc__:
- __doc__ = __doc__.encode('ascii').decode('unicode_escape')
-__author__ = r"Andr\xe9 Malo".encode('ascii').decode('unicode_escape')
-__docformat__ = "restructuredtext en"
-__license__ = "Apache License, Version 2.0"
-__version__ = "1.0.0"
-
-import sys as _sys
-import time as _time
-
-import_notes = []
-class _p_02__rcssmin(object):
- def __init__(self):
- import rcssmin
- cssmin = rcssmin._make_cssmin(python_only=True)
- self.cssmin = lambda x: cssmin(x, keep_bang_comments=True)
-
-class _p_03__rcssmin(object):
- def __init__(self):
- import _rcssmin
- cssmin = _rcssmin.cssmin
- self.cssmin = lambda x: cssmin(x, keep_bang_comments=True)
-
-class cssmins(object):
- from bench import cssmin as p_01_cssmin
- p_02_rcssmin = _p_02__rcssmin()
- try:
- p_03__rcssmin = _p_03__rcssmin()
- except ImportError:
- import_notes.append("_rcssmin (C-Port) not available")
- print(import_notes[-1])
-
-print("Python Release: %s" % ".".join(map(str, _sys.version_info[:3])))
-print("")
-
-
-def slurp(filename):
- """ Load a file """
- fp = open(filename)
- try:
- return fp.read()
- finally:
- fp.close()
-
-
-def print_(*value, **kwargs):
- """ Print stuff """
- (kwargs.get('file') or _sys.stdout).write(
- ''.join(value) + kwargs.get('end', '\n')
- )
-
-
-def bench(filenames, count):
- """
- Benchmark the minifiers with given css samples
-
- :Parameters:
- `filenames` : sequence
- List of filenames
-
- `count` : ``int``
- Number of runs per css file and minifier
-
- :Exceptions:
- - `RuntimeError` : empty filenames sequence
- """
- if not filenames:
- raise RuntimeError("Missing files to benchmark")
- try:
- xrange
- except NameError:
- xrange = range
- try:
- cmp
- except NameError:
- cmp = lambda a, b: (a > b) - (a < b)
-
- ports = [item for item in dir(cssmins) if item.startswith('p_')]
- ports.sort()
- space = max(map(len, ports)) - 4
- ports = [(item[5:], getattr(cssmins, item).cssmin) for item in ports]
- flush = _sys.stdout.flush
-
- struct = []
- inputs = [(filename, slurp(filename)) for filename in filenames]
- for filename, style in inputs:
- print_("Benchmarking %r..." % filename, end=" ")
- flush()
- outputs = []
- for _, cssmin in ports:
- try:
- outputs.append(cssmin(style))
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
- outputs.append(None)
- struct.append(dict(
- filename=filename,
- sizes=[
- (item is not None and len(item) or None) for item in outputs
- ],
- size=len(style),
- messages=[],
- times=[],
- ))
- print_("(%.1f KiB)" % (struct[-1]['size'] / 1024.0,))
- flush()
- times = []
- for idx, (name, cssmin) in enumerate(ports):
- if outputs[idx] is None:
- print_(" FAILED %s" % (name,))
- struct[-1]['times'].append((name, None))
- else:
- print_(" Timing %s%s... (%5.1f KiB %s)" % (
- name,
- " " * (space - len(name)),
- len(outputs[idx]) / 1024.0,
- idx == 0 and '*' or ['=', '>', '<'][
- cmp(len(outputs[idx]), len(outputs[0]))
- ],
- ), end=" ")
- flush()
-
- xcount = count
- while True:
- counted = [None for _ in xrange(xcount)]
- start = _time.time()
- for _ in counted:
- cssmin(style)
- end = _time.time()
- result = (end - start) * 1000
- if result < 10: # avoid measuring within the error range
- xcount *= 10
- continue
- times.append(result / xcount)
- break
-
- print_("%8.2f ms" % times[-1], end=" ")
- flush()
- if len(times) <= 1:
- print_()
- else:
- print_("(factor: %s)" % (', '.join([
- '%.2f' % (timed / times[-1]) for timed in times[:-1]
- ])))
- struct[-1]['times'].append((name, times[-1]))
-
- flush()
- print_()
-
- return struct
-
-
-def main(argv=None):
- """ Main """
- import getopt as _getopt
- import os as _os
- import pickle as _pickle
-
- if argv is None:
- argv = _sys.argv[1:]
- try:
- opts, args = _getopt.getopt(argv, "hc:p:", ["help"])
- except getopt.GetoptError:
- e = _sys.exc_info()[0](_sys.exc_info()[1])
- print >> _sys.stderr, "%s\nTry %s -mbench.main --help" % (
- e,
- _os.path.basename(_sys.executable),
- )
- _sys.exit(2)
-
- count, pickle = 10, None
- for key, value in opts:
- if key in ("-h", "--help"):
- print >> _sys.stderr, (
- "%s -mbench.main [-c count] [-p file] cssfile ..." % (
- _os.path.basename(_sys.executable),
- )
- )
- _sys.exit(0)
- elif key == '-c':
- count = int(value)
- elif key == '-p':
- pickle = str(value)
-
- struct = bench(args, count)
- if pickle:
- fp = open(pickle, 'wb')
- try:
- fp.write(_pickle.dumps((
- ".".join(map(str, _sys.version_info[:3])),
- import_notes,
- struct,
- ), 0))
- finally:
- fp.close()
-
-
-if __name__ == '__main__':
- main()
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/wikipedia.css b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/wikipedia.css
deleted file mode 100644
index 03079e35a6f..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/wikipedia.css
+++ /dev/null
@@ -1,3861 +0,0 @@
-/*
- * This CSS is taken from wikipedia / mediawiki, it's the combined files of
- * the vector skin described at:
- *
- * http://en.wikipedia.org/wiki/Wikipedia:Catalogue_of_CSS_classes
- */
-
-/*
- * Any rules which should not be flipped automatically in right-to-left situations should be
- * prepended with @noflip in a comment block. Images that should be embedded as base64 data-URLs
- * should be prepended with @embed in a comment block.
- *
- * This style-sheet employs a few CSS trick to accomplish compatibility with a wide range of web
- * browsers. The most common trick is to use some styles in IE6 only. This is accomplished by using
- * a rule that makes things work in IE6, and then following it with a rule that begins with
- * "html > body" or use a child selector ">", which is ignored by IE6 because it does not support
- * the child selector. You can spot this by looking for the "OVERRIDDEN BY COMPLIANT BROWSERS" and
- * "IGNORED BY IE6" comments.
- */
-
-/* Framework */
-html,
-body {
- height: 100%;
- margin: 0;
- padding: 0;
- font-family: sans-serif;
- font-size: 1em;
-}
-body {
- background-color: #f3f3f3;
- /* @embed */
- background-image: url(images/page-base.png);
-}
-/* Content */
-div#content {
- margin-left: 10em;
- padding: 1em;
- /* @embed */
- background-image: url(images/border.png);
- background-position: top left;
- background-repeat: repeat-y;
- background-color: white;
- color: black;
- direction: ltr;
-}
-/* Head */
-#mw-page-base {
- height: 5em;
- background-color: white;
- /* @embed */
- background-image: url(images/page-fade.png);
- background-position: bottom left;
- background-repeat: repeat-x;
-}
-#mw-head-base {
- margin-top: -5em;
- margin-left: 10em;
- height: 5em;
- /* @embed */
- background-image: url(images/border.png);
- background-position: bottom left;
- background-repeat: repeat-x;
-}
-div#mw-head {
- position: absolute;
- top: 0;
- right: 0;
- width: 100%;
-}
-div#mw-head h5 {
- margin: 0;
- padding: 0;
-}
-/* Hide empty portlets */
-div.emptyPortlet {
- display: none;
-}
-/* Personal */
-#p-personal {
- position: absolute;
- top: 0;
- right: 0.75em;
-}
-#p-personal h5 {
- display: none;
-}
-#p-personal ul {
- list-style: none;
- margin: 0;
- padding-left: 10em; /* Keep from overlapping logo */
-}
-/* @noflip */
-#p-personal li {
- line-height: 1.125em;
- float: left;
-}
-/* This one flips! */
-#p-personal li {
- margin-left: 0.75em;
- margin-top: 0.5em;
- font-size: 0.75em;
- white-space: nowrap;
-}
-/* Navigation Containers */
-#left-navigation {
- position: absolute;
- left: 10em;
- top: 2.5em;
-}
-#right-navigation {
- float: right;
- margin-top: 2.5em;
-}
-/* Navigation Labels */
-div.vectorTabs h5,
-div.vectorMenu h5 span {
- display: none;
-}
-/* Namespaces and Views */
-/* @noflip */
-div.vectorTabs {
- float: left;
- height: 2.5em;
-}
-div.vectorTabs {
- /* @embed */
- background-image: url(images/tab-break.png);
- background-position: bottom left;
- background-repeat: no-repeat;
- padding-left: 1px;
-}
-/* @noflip */
-div.vectorTabs ul {
- float: left;
-}
-div.vectorTabs ul {
- height: 100%;
- list-style: none;
- margin: 0;
- padding: 0;
-}
-/* @noflip */
-div.vectorTabs ul li {
- float: left;
-}
-/* OVERRIDDEN BY COMPLIANT BROWSERS */
-div.vectorTabs ul li {
- line-height: 1.125em;
- display: inline-block;
- height: 100%;
- margin: 0;
- padding: 0;
- background-color: #f3f3f3;
- /* @embed */
- background-image: url(images/tab-normal-fade.png);
- background-position: bottom left;
- background-repeat: repeat-x;
- white-space:nowrap;
-}
-/* IGNORED BY IE6 */
-div.vectorTabs ul > li {
- display: block;
-}
-div.vectorTabs li.selected {
- /* @embed */
- background-image: url(images/tab-current-fade.png);
-}
-/* OVERRIDDEN BY COMPLIANT BROWSERS */
-div.vectorTabs li a {
- display: inline-block;
- height: 1.9em;
- padding-left: 0.5em;
- padding-right: 0.5em;
- color: #0645ad;
- cursor: pointer;
- font-size: 0.8em;
-}
-/* IGNORED BY IE6 */
-div.vectorTabs li > a {
- display: block;
-}
-div.vectorTabs li.icon a {
- background-position: bottom right;
- background-repeat: no-repeat;
-}
-/* OVERRIDDEN BY COMPLIANT BROWSERS */
-div.vectorTabs span a {
- display: inline-block;
- padding-top: 1.25em;
-}
-/* IGNORED BY IE6 */
-/* @noflip */
-div.vectorTabs span > a {
- float: left;
- display: block;
-}
-div.vectorTabs span {
- display: inline-block;
- /* @embed */
- background-image: url(images/tab-break.png);
- background-position: bottom right;
- background-repeat: no-repeat;
-}
-div.vectorTabs li.selected a,
-div.vectorTabs li.selected a:visited{
- color: #333333;
- text-decoration: none;
-}
-div.vectorTabs li.new a,
-div.vectorTabs li.new a:visited{
- color: #a55858;
-}
-/* Variants and Actions */
-/* @noflip */
-div.vectorMenu {
- direction: ltr;
- float: left;
- /* @embed */
- background-image: url(images/arrow-down-icon.png);
- background-position: 100% 60%;
- background-repeat: no-repeat;
- cursor: pointer;
-}
-div.vectorMenuFocus {
- /* @embed */
- background-image: url(images/arrow-down-focus-icon.png);
- background-position: 100% 60%;
-}
-/* @noflip */
-body.rtl div.vectorMenu {
- direction: rtl;
-}
-/* OVERRIDDEN BY COMPLIANT BROWSERS */
-/* @noflip */
-div#mw-head div.vectorMenu h5 {
- float: left;
- /* @embed */
- background-image: url(images/tab-break.png);
- background-repeat: no-repeat;
-}
-/* This will be flipped - unlike the one above it */
-div#mw-head div.vectorMenu h5 {
- background-position: bottom left;
- margin-left: -1px;
-}
-/* IGNORED BY IE6 */
-div#mw-head div.vectorMenu > h5 {
- background-image: none;
-}
-div#mw-head div.vectorMenu h4 {
- display: inline-block;
- float: left;
- font-size: 0.8em;
- padding-left: 0.5em;
- padding-top: 1.375em;
- font-weight: normal;
- border: none;
-}
-/* OVERRIDDEN BY COMPLIANT BROWSERS */
-/* @noflip */
-div.vectorMenu h5 a {
- display: inline-block;
- width: 24px;
- height: 2.5em;
- text-decoration: none;
- /* @embed */
- background-image: url(images/tab-break.png);
- background-repeat: no-repeat;
-}
-/* This will be flipped - unlike the one above it */
-div.vectorMenu h5 a {
- background-position: bottom right;
-}
-/* IGNORED BY IE6 */
-div.vectorMenu h5 > a {
- display: block;
-}
-div.vectorMenu div.menu {
- position: relative;
- display: none;
- clear: both;
- text-align: left;
-}
-/* OVERRIDDEN BY COMPLIANT BROWSERS */
-/* @noflip */
-body.rtl div.vectorMenu div.menu {
- margin-left: 24px;
-}
-/* IGNORED BY IE6 */
-/* @noflip */
-body.rtl div.vectorMenu > div.menu {
- margin-left: auto;
-}
-/* IGNORED BY IE6 */
-/* Also fixes old versions of FireFox */
-/* @noflip */
-body.rtl div.vectorMenu > div.menu,
-x:-moz-any-link {
- margin-left: 23px;
-}
-/* Enable forcing showing of the menu for accessibility */
-div.vectorMenu:hover div.menu,
-div.vectorMenu div.menuForceShow {
- display: block;
-}
-div.vectorMenu ul {
- position: absolute;
- background-color: white;
- border: solid 1px silver;
- border-top-width: 0;
- list-style: none;
- list-style-image: none;
- list-style-type: none;
- padding: 0;
- margin: 0;
- margin-left: -1px;
- text-align: left;
-}
-/* Fixes old versions of FireFox */
-div.vectorMenu ul,
-x:-moz-any-link {
- min-width: 5em;
-}
-/* Returns things back to normal in modern versions of FireFox */
-div.vectorMenu ul,
-x:-moz-any-link,
-x:default {
- min-width: 0;
-}
-div.vectorMenu li {
- padding: 0;
- margin: 0;
- text-align: left;
- line-height: 1em;
-}
-/* OVERRIDDEN BY COMPLIANT BROWSERS */
-div.vectorMenu li a {
- display: inline-block;
- padding: 0.5em;
- white-space: nowrap;
- color: #0645ad;
- cursor: pointer;
- font-size: 0.8em;
-}
-/* IGNORED BY IE6 */
-div.vectorMenu li > a {
- display: block;
-}
-div.vectorMenu li.selected a,
-div.vectorMenu li.selected a:visited {
- color: #333333;
- text-decoration: none;
-}
-/* Search */
-#p-search h5 {
- display: none;
-}
-/* @noflip */
-#p-search {
- float: left;
-}
-#p-search {
- margin-right: 0.5em;
- margin-left: 0.5em;
-}
-#p-search form,
-#p-search input {
- margin: 0;
- margin-top: 0.4em;
-}
-div#simpleSearch {
- display: block;
- width: 14em;
- height: 1.4em;
- margin-top: 0.65em;
- position: relative;
- min-height: 1px; /* Gotta trigger hasLayout for IE7 */
- border: solid 1px #AAAAAA;
- color: black;
- background-color: white;
- /* @embed */
- background-image: url(images/search-fade.png);
- background-position: top left;
- background-repeat: repeat-x;
-}
-div#simpleSearch label {
- /*
- * DON'T PANIC! Browsers that won't scale this properly are the same browsers that have JS issues that prevent
- * this from ever being shown anyways.
- */
- font-size: 13px;
- top: 0.25em;
- direction: ltr;
-}
-div#simpleSearch input {
- color: black;
- direction: ltr;
-}
-div#simpleSearch input:focus {
- outline: none;
-}
-div#simpleSearch input.placeholder {
- color: #999999;
-}
-div#simpleSearch input::-webkit-input-placeholder {
- color: #999999;
-}
-div#simpleSearch input#searchInput {
- position: absolute;
- top: 0;
- left: 0;
- width: 90%;
- margin: 0;
- padding: 0;
- padding-left: 0.2em;
- padding-top: 0.2em;
- padding-bottom: 0.2em;
- outline: none;
- border: none;
- /*
- * DON'T PANIC! Browsers that won't scale this properly are the same browsers that have JS issues that prevent
- * this from ever being shown anyways.
- */
- font-size: 13px;
- background-color: transparent;
- direction: ltr;
-}
-div#simpleSearch button#searchButton {
- position: absolute;
- width: 10%;
- right: 0;
- top: 0;
- padding: 0;
- padding-top: 0.3em;
- padding-bottom: 0.2em;
- padding-right: 0.4em;
- margin: 0;
- border: none;
- cursor: pointer;
- background-color: transparent;
- background-image: none;
-}
-/* OVERRIDDEN BY COMPLIANT BROWSERS */
-div#simpleSearch button#searchButton img {
- border: none;
- margin: 0;
- margin-top: -3px;
- padding: 0;
-}
-/* IGNORED BY IE6 */
-div#simpleSearch button#searchButton > img {
- margin: 0;
-}
-/* Panel */
-div#mw-panel {
- position: absolute;
- top: 160px;
- padding-top: 1em;
- width: 10em;
- left: 0;
-}
-div#mw-panel div.portal {
- padding-bottom: 1.5em;
- direction: ltr;
-}
-div#mw-panel div.portal h5 {
- font-weight: normal;
- color: #444444;
- padding: 0.25em;
- padding-top: 0;
- padding-left: 1.75em;
- cursor: default;
- border: none;
- font-size: 0.75em;
-}
-div#mw-panel div.portal div.body {
- margin: 0;
- padding-top: 0.5em;
- margin-left: 1.25em;
- /* @embed */
- background-image: url(images/portal-break.png);
- background-repeat: no-repeat;
- background-position: top left;
-}
-div#mw-panel div.portal div.body ul {
- list-style: none;
- list-style-image: none;
- list-style-type: none;
- padding: 0;
- margin: 0;
-}
-div#mw-panel div.portal div.body ul li {
- line-height: 1.125em;
- padding: 0;
- padding-bottom: 0.5em;
- margin: 0;
- overflow: hidden;
- font-size: 0.75em;
-}
-div#mw-panel div.portal div.body ul li a {
- color: #0645ad;
-}
-div#mw-panel div.portal div.body ul li a:visited {
- color: #0b0080;
-}
-/* Footer */
-div#footer {
- margin-left: 10em;
- margin-top: 0;
- padding: 0.75em;
- /* @embed */
- background-image: url(images/border.png);
- background-position: top left;
- background-repeat: repeat-x;
- direction: ltr;
-}
-div#footer ul {
- list-style: none;
- list-style-image: none;
- list-style-type: none;
- margin: 0;
- padding: 0;
-}
-div#footer ul li {
- margin: 0;
- padding: 0;
- padding-top: 0.5em;
- padding-bottom: 0.5em;
- color: #333333;
- font-size: 0.7em;
-}
-div#footer #footer-icons {
- float: right;
-}
-/* @noflip */
-body.ltr div#footer #footer-places {
- float: left;
-}
-div#footer #footer-info li {
- line-height: 1.4em;
-}
-div#footer #footer-icons li {
- float: left;
- margin-left: 0.5em;
- line-height: 2em;
- text-align: right;
-}
-div#footer #footer-places li {
- float: left;
- margin-right: 1em;
- line-height: 2em;
-}
-/* Logo */
-#p-logo {
- position: absolute;
- top: -160px;
- left: 0;
- width: 10em;
- height: 160px;
-}
-#p-logo a {
- display: block;
- width: 10em;
- height: 160px;
- background-repeat: no-repeat;
- background-position: center center;
- text-decoration: none;
-}
-
-/*
- *
- * The following code is highly modified from monobook. It would be nice if the
- * preftoc id was more human readable like preferences-toc for instance,
- * howerver this would require backporting the other skins.
- */
-
-/* Preferences */
-#preftoc {
- /* Tabs */
- width: 100%;
- float: left;
- clear: both;
- margin: 0 !important;
- padding: 0 !important;
- /* @embed */
- background-image: url(images/preferences-break.png);
- background-position: bottom left;
- background-repeat: no-repeat;
-}
- #preftoc li {
- /* Tab */
- float: left;
- margin: 0;
- padding: 0;
- padding-right: 1px;
- height: 2.25em;
- white-space: nowrap;
- list-style-type: none;
- list-style-image: none;
- /* @embed */
- background-image: url(images/preferences-break.png);
- background-position: bottom right;
- background-repeat: no-repeat;
- }
- /* Sadly, IE6 won't understand this */
- #preftoc li:first-child {
- margin-left: 1px;
- }
- #preftoc a,
- #preftoc a:active {
- display: inline-block;
- position: relative;
- color: #0645ad;
- padding: 0.5em;
- text-decoration: none;
- background-image: none;
- font-size: 0.9em;
- }
- #preftoc a:hover,
- #preftoc a:focus {
- text-decoration: underline;
- }
- #preftoc li.selected a {
- /* @embed */
- background-image: url(images/preferences-fade.png);
- background-position: bottom;
- background-repeat: repeat-x;
- color: #333333;
- text-decoration: none;
- }
-#preferences {
- float: left;
- width: 100%;
- margin: 0;
- margin-top: -2px;
- clear: both;
- border: solid 1px #cccccc;
- background-color: #f9f9f9;
- /* @embed */
- background-image: url(images/preferences-base.png);
-}
-#preferences fieldset {
- border: none;
- border-top: solid 1px #cccccc;
-}
-#preferences fieldset.prefsection {
- border: none;
- padding: 0;
- margin: 1em;
-}
-#preferences legend {
- color: #666666;
-}
-#preferences fieldset.prefsection legend.mainLegend {
- display: none;
-}
-#preferences td {
- padding-left: 0.5em;
- padding-right: 0.5em;
-}
-#preferences td.htmlform-tip {
- font-size: x-small;
- padding: .2em 2em;
- color: #666666;
-}
-#preferences div.mw-prefs-buttons {
- padding: 1em;
-}
-#preferences div.mw-prefs-buttons input {
- margin-right: 0.25em;
-}
-
-/**
- * The following code is slightly modified from monobook
- */
-div#content {
- line-height: 1.5em;
-}
-#bodyContent {
- font-size: 0.8em;
-}
-
-.editsection {
- float: right;
-}
-
-ul {
- /* @embed */
- list-style-image: url(images/bullet-icon.png);
-}
-
-pre {
- line-height: 1.3em;
-}
-
-/* Site Notice (includes notices from CentralNotice extension) */
-#siteNotice {
- font-size: 0.8em;
-}
-#firstHeading {
- padding-top: 0;
- margin-top: 0;
- padding-top: 0;
- font-size: 1.6em;
-}
-div#content a.external,
-div#content a.external[href ^="gopher://"] {
- /* @embed */
- background: url(images/external-link-ltr-icon.png) center right no-repeat;
- padding-right: 13px;
-}
-div#content a.external[href ^="https://"],
-.link-https {
- /* @embed */
- background: url(images/lock-icon.png) center right no-repeat;
- padding-right: 13px;
-}
-div#content a.external[href ^="mailto:"],
-.link-mailto {
- /* @embed */
- background: url(images/mail-icon.png) center right no-repeat;
- padding-right: 13px;
-}
-div#content a.external[href ^="news:"] {
- /* @embed */
- background: url(images/news-icon.png) center right no-repeat;
- padding-right: 13px;
-}
-div#content a.external[href ^="ftp://"],
-.link-ftp {
- /* @embed */
- background: url(images/file-icon.png) center right no-repeat;
- padding-right: 13px;
-}
-div#content a.external[href ^="irc://"],
-div#content a.external[href ^="ircs://"],
-.link-irc {
- /* @embed */
- background: url(images/talk-icon.png) center right no-repeat;
- padding-right: 13px;
-}
-div#content a.external[href $=".ogg"], div#content a.external[href $=".OGG"],
-div#content a.external[href $=".mid"], div#content a.external[href $=".MID"],
-div#content a.external[href $=".midi"], div#content a.external[href $=".MIDI"],
-div#content a.external[href $=".mp3"], div#content a.external[href $=".MP3"],
-div#content a.external[href $=".wav"], div#content a.external[href $=".WAV"],
-div#content a.external[href $=".wma"], div#content a.external[href $=".WMA"],
-.link-audio {
- /* @embed */
- background: url(images/audio-icon.png) center right no-repeat;
- padding-right: 13px;
-}
-div#content a.external[href $=".ogm"], div#content a.external[href $=".OGM"],
-div#content a.external[href $=".avi"], div#content a.external[href $=".AVI"],
-div#content a.external[href $=".mpeg"], div#content a.external[href $=".MPEG"],
-div#content a.external[href $=".mpg"], div#content a.external[href $=".MPG"],
-.link-video {
- /* @embed */
- background: url(images/video-icon.png) center right no-repeat;
- padding-right: 13px;
-}
-div#content a.external[href $=".pdf"], div#content a.external[href $=".PDF"],
-div#content a.external[href *=".pdf#"], div#content a.external[href *=".PDF#"],
-div#content a.external[href *=".pdf?"], div#content a.external[href *=".PDF?"],
-.link-document {
- /* @embed */
- background: url(images/document-icon.png) center right no-repeat;
- padding-right: 13px;
-}
-
-/* Icon for Usernames */
-#pt-userpage,
-#pt-anonuserpage,
-#pt-login {
- /* @embed */
- background: url(images/user-icon.png) left top no-repeat;
- padding-left: 15px !important;
- text-transform: none;
-}
-
-.redirectText {
- font-size: 140%;
-}
-
-.redirectMsg img {
- vertical-align: text-bottom;
-}
-
-#bodyContent {
- position: relative;
- width: 100%;
-}
-#mw-js-message {
- font-size: 0.8em;
-}
-div#bodyContent {
- line-height: 1.5em;
-}
-
-/* Watch/Unwatch Icon Styling */
-#ca-unwatch.icon a,
-#ca-watch.icon a {
- margin: 0;
- padding: 0;
- outline: none;
- display: block;
- width: 26px;
- /* This hides the text but shows the background image */
- padding-top: 3.1em;
- margin-top: 0;
- /* Only applied in IE6 */
- margin-top: -0.8em !ie;
- height: 0;
- overflow: hidden;
- /* @embed */
- background-image: url(images/watch-icons.png);
-}
-#ca-unwatch.icon a {
- background-position: -43px 60%;
-}
-#ca-watch.icon a {
- background-position: 5px 60%;
-}
-#ca-unwatch.icon a:hover,
-#ca-unwatch.icon a:focus {
- background-position: -67px 60%;
-}
-#ca-watch.icon a:hover,
-#ca-watch.icon a:focus {
- background-position: -19px 60%;
-}
-#ca-unwatch.icon a.loading,
-#ca-watch.icon a.loading {
- /* @embed */
- background-image: url(images/watch-icon-loading.gif);
- background-position: 5px 60%;
-}
-#ca-unwatch.icon a span,
-#ca-watch.icon a span {
- display: none;
-}
-div.vectorTabs ul {
- /* @embed */
- background-image:url(images/tab-break.png);
- background-position:right bottom;
- background-repeat:no-repeat;
-}
-
-/* Tooltips are outside of the normal body code, so this helps make the size of the text sensible */
-.tipsy {
- font-size: 0.8em;
-}
-/**
- * CSS in this file is used by *all* skins (that have any CSS at all). Be
- * careful what you put in here, since what looks good in one skin may not in
- * another, but don't ignore the poor pre-Monobook users either.
- */
-
-/* GENERAL CLASSES FOR DIRECTIONALITY SUPPORT */
-
-/**
- * These classes should be used for text depending on the content direction.
- * Content stuff like editsection, ul/ol and TOC depend on this.
- */
-.mw-content-ltr {
- /* @noflip */
- direction: ltr;
-}
-.mw-content-rtl {
- /* @noflip */
- direction: rtl;
-}
-
-/* Most input fields should be in site direction */
-.sitedir-ltr textarea,
-.sitedir-ltr input {
- /* @noflip */
- direction: ltr;
-}
-.sitedir-rtl textarea,
-.sitedir-rtl input {
- /* @noflip */
- direction: rtl;
-}
-
-/* Input types that should follow user direction, like buttons */
-/* TODO: What about buttons in wikipage content ? */
-input[type="submit"],
-input[type="button"],
-input[type="reset"],
-input[type="file"] {
- direction: ltr;
-}
-
-/* Override default values */
-textarea[dir="ltr"],
-input[dir="ltr"] {
- /* @noflip */
- direction: ltr;
-}
-textarea[dir="rtl"],
-input[dir="rtl"] {
- /* @noflip */
- direction: rtl;
-}
-
-/* Default style for semantic tags */
-abbr,
-acronym,
-.explain {
- border-bottom: 1px dotted;
- cursor: help;
-}
-
-/* Colored watchlist and recent changes numbers */
-.mw-plusminus-pos {
- color: #006400; /* dark green */
-}
-.mw-plusminus-neg {
- color: #8b0000; /* dark red */
-}
-.mw-plusminus-null {
- color: #aaa; /* gray */
-}
-
-/**
- * Links to redirects appear italicized on [[Special:AllPages]], [[Special:PrefixIndex]],
- * [[Special:Watchlist/edit]] and in category listings.
- */
-.allpagesredirect,
-.redirect-in-category,
-.watchlistredir {
- font-style: italic;
-}
-
-/* Comment and username portions of RC entries */
-span.comment {
- font-style: italic;
-}
-
-span.changedby {
- font-size: 95%;
-}
-
-/* Math */
-.texvc {
- direction: ltr;
- unicode-bidi: embed;
-}
-img.tex {
- vertical-align: middle;
-}
-span.texhtml {
- font-family: serif;
-}
-
-/**
- * Add a bit of margin space between the preview and the toolbar.
- * This replaces the ugly <p><br /></p> we used to insert into the page source
- */
-#wikiPreview.ontop {
- margin-bottom: 1em;
-}
-
-/* Stop floats from intruding into edit area in previews */
-#editform,
-#toolbar,
-#wpTextbox1 {
- clear: both;
-}
-#toolbar img {
- cursor: pointer;
-}
-div#mw-js-message {
- margin: 1em 5%;
- padding: 0.5em 2.5%;
- border: solid 1px #ddd;
- background-color: #fcfcfc;
-}
-
-/* Edit section links */
-.editsection {
- float: right;
- margin-left: 5px;
-}
-/* Correct directionality when page dir is different from site/user dir */
-.mw-content-ltr .editsection,
-.mw-content-rtl .mw-content-ltr .editsection {
- /* @noflip */
- float: right;
-}
-.mw-content-rtl .editsection,
-.mw-content-ltr .mw-content-rtl .editsection {
- /* @noflip */
- float: left;
-}
-
-/**
- * File description page
- */
-
-div.mw-filepage-resolutioninfo {
- font-size: smaller;
-}
-
-/**
- * File histories
- */
-h2#filehistory {
- clear: both;
-}
-
-table.filehistory th,
-table.filehistory td {
- vertical-align: top;
-}
-table.filehistory th {
- text-align: left;
-}
-table.filehistory td.mw-imagepage-filesize,
-table.filehistory th.mw-imagepage-filesize {
- white-space: nowrap;
-}
-
-table.filehistory td.filehistory-selected {
- font-weight: bold;
-}
-
-/**
- * Add a checkered background image on hover for file
- * description pages. (bug 26470)
- */
-.filehistory a img,
-#file img:hover {
- /* @embed */
- background: white url(images/Checker-16x16.png) repeat;
-}
-
-/**
- * rev_deleted stuff
- */
-li span.deleted,
-span.history-deleted {
- text-decoration: line-through;
- color: #888;
- font-style: italic;
-}
-
-/**
- * Patrol stuff
- */
-.not-patrolled {
- background-color: #ffa;
-}
-
-.unpatrolled {
- font-weight: bold;
- color: red;
-}
-
-div.patrollink {
- font-size: 75%;
- text-align: right;
-}
-
-/**
- * Forms
- */
-td.mw-label {
- text-align: right;
-}
-td.mw-input {
- text-align: left;
-}
-td.mw-submit {
- text-align: left;
-}
-
-td.mw-label {
- vertical-align: top;
-}
-.prefsection td.mw-label {
- width: 20%;
-}
-.prefsection table {
- width: 100%;
-}
-td.mw-submit {
- white-space: nowrap;
-}
-
-table.mw-htmlform-nolabel td.mw-label {
- width: 1px;
-}
-
-tr.mw-htmlform-vertical-label td.mw-label {
- text-align: left !important;
-}
-
-.mw-htmlform-invalid-input td.mw-input input {
- border-color: red;
-}
-
-.mw-htmlform-flatlist div.mw-htmlform-flatlist-item {
- display: inline;
- margin-right: 1em;
- white-space: nowrap;
-}
-
-input#wpSummary {
- width: 80%;
-}
-
-/**
- * Image captions
- */
-.thumbcaption {
- text-align: left;
-}
-.magnify {
- float: right;
-}
-
-/**
- * Categories
- */
-#catlinks {
- /**
- * Overrides text justification (user preference)
- * See bug 31990
- */
- text-align: left;
-}
-.catlinks ul {
- display: inline;
- margin: 0;
- padding: 0;
- list-style: none;
- list-style-type: none;
- list-style-image: none;
- vertical-align: middle !ie;
-}
-
-.catlinks li {
- display: inline-block;
- line-height: 1.25em;
- border-left: 1px solid #AAA;
- margin: 0.125em 0;
- padding: 0 0.5em;
- zoom: 1;
- display: inline !ie;
-}
-
-.catlinks li:first-child {
- padding-left: 0.25em;
- border-left: none;
-}
-/**
- * Hidden categories
- */
-.mw-hidden-cats-hidden {
- display: none;
-}
-.catlinks-allhidden {
- display: none;
-}
-
-/* Convenience links to edit block, delete and protect reasons */
-p.mw-ipb-conveniencelinks,
-p.mw-protect-editreasons,
-p.mw-filedelete-editreasons,
-p.mw-delete-editreasons,
-p.mw-revdel-editreasons {
- font-size: 90%;
- text-align: right;
-}
-
-/**
- * OpenSearch ajax suggestions
- */
-.os-suggest {
- overflow: auto;
- overflow-x: hidden;
- position: absolute;
- top: 0;
- left: 0;
- width: 0;
- background-color: white;
- border-style: solid;
- border-color: #AAAAAA;
- border-width: 1px;
- z-index:99;
- font-size:95%;
-}
-
-table.os-suggest-results {
- font-size: 95%;
- cursor: pointer;
- border: 0;
- border-collapse: collapse;
- width: 100%;
-}
-
-.os-suggest-result,
-.os-suggest-result-hl {
- white-space: nowrap;
- background-color: white;
- color: black;
- padding: 2px;
-}
-.os-suggest-result-hl,
-.os-suggest-result-hl-webkit {
- background-color: #4C59A6;
- color: white;
-}
-
-.os-suggest-toggle {
- position: relative;
- left: 1ex;
- font-size: 65%;
-}
-.os-suggest-toggle-def {
- position: absolute;
- top: 0;
- left: 0;
- font-size: 65%;
- visibility: hidden;
-}
-
-/* Page history styling */
-
-/* The auto-generated edit comments */
-.autocomment {
- color: gray;
-}
-#pagehistory .history-user {
- margin-left: 0.4em;
- margin-right: 0.2em;
-}
-#pagehistory span.minor {
- font-weight: bold;
-}
-#pagehistory li {
- border: 1px solid white;
-}
-#pagehistory li.selected {
- background-color: #f9f9f9;
- border: 1px dashed #aaa;
-}
-
-.mw-history-revisiondelete-button, #mw-fileduplicatesearch-icon {
- float: right;
-}
-
-/** Generic minor/bot/newpage styling (recent changes) */
-.newpage,
-.minoredit,
-.botedit {
- font-weight: bold;
-}
-
-#shared-image-dup,
-#shared-image-conflict {
- font-style: italic;
-}
-
-/**
- * Recreating deleted page warning
- * Reupload file warning
- * Page protection warning
- * incl. log entries for these warnings
- */
-div.mw-warning-with-logexcerpt {
- padding: 3px;
- margin-bottom: 3px;
- border: 2px solid #2F6FAB;
- clear: both;
-}
-div.mw-warning-with-logexcerpt ul li {
- font-size: 90%;
-}
-
-/* (show/hide) revision deletion links */
-span.mw-revdelundel-link,
-strong.mw-revdelundel-link {
- font-size: 90%;
-}
-span.mw-revdelundel-hidden,
-input.mw-revdelundel-hidden {
- visibility: hidden;
-}
-
-td.mw-revdel-checkbox,
-th.mw-revdel-checkbox {
- padding-right: 10px;
- text-align: center;
-}
-
-/* feed links */
-a.feedlink {
- /* @embed */
- background: url(images/feed-icon.png) center left no-repeat;
- padding-left: 16px;
-}
-
-/* Plainlinks - this can be used to switch
- * off special external link styling */
-.plainlinks a {
- background: none !important;
- padding: 0 !important;
-}
-/* External URLs should always be treated as LTR (bug 4330) */
-/* @noflip */ .rtl a.external.free,
-.rtl a.external.autonumber {
- direction: ltr;
- unicode-bidi: embed;
-}
-
-/**
- * wikitable class for skinning normal tables
- * keep in sync with commonPrint.css
- */
-table.wikitable {
- margin: 1em 1em 1em 0;
- background-color: #f9f9f9;
- border: 1px #aaa solid;
- border-collapse: collapse;
- color: black;
-}
-table.wikitable > tr > th,
-table.wikitable > tr > td,
-table.wikitable > * > tr > th,
-table.wikitable > * > tr > td {
- border: 1px #aaa solid;
- padding: 0.2em;
-}
-table.wikitable > tr > th,
-table.wikitable > * > tr > th {
- background-color: #f2f2f2;
- text-align: center;
-}
-table.wikitable > caption {
- font-weight: bold;
-}
-
-/* hide initially collapsed collapsable tables */
-table.collapsed tr.collapsable {
- display: none;
-}
-
-/* success and error messages */
-.success {
- color: green;
- font-size: larger;
-}
-.warning {
- color: #FFA500; /* orange */
- font-size: larger;
-}
-.error {
- color: red;
- font-size: larger;
-}
-.errorbox,
-.warningbox,
-.successbox {
- font-size: larger;
- border: 2px solid;
- padding: .5em 1em;
- float: left;
- margin-bottom: 2em;
- color: #000;
-}
-.errorbox {
- border-color: red;
- background-color: #fff2f2;
-}
-.warningbox {
- border-color: #FF8C00; /* darkorange */
- background-color: #FFFFC0;
-}
-.successbox {
- border-color: green;
- background-color: #dfd;
-}
-.errorbox h2,
-.warningbox h2,
-.successbox h2 {
- font-size: 1em;
- font-weight: bold;
- display: inline;
- margin: 0 .5em 0 0;
- border: none;
-}
-
-/* general info/warning box for SP */
-.mw-infobox {
- border: 2px solid #ff7f00;
- margin: 0.5em;
- clear: left;
- overflow: hidden;
-}
-
-.mw-infobox-left {
- margin: 7px;
- float: left;
- width: 35px;
-}
-
-.mw-infobox-right {
- margin: 0.5em 0.5em 0.5em 49px;
-}
-
-/* Note on preview page */
-.previewnote {
- color: #c00;
- margin-bottom: 1em;
-}
-
-.previewnote p {
- text-indent: 3em;
- margin: 0.8em 0;
-}
-
-.visualClear {
- clear: both;
-}
-
-#mw_trackbacks {
- border: solid 1px #bbbbff;
- background-color: #eeeeff;
- padding: 0.2em;
-}
-
-/**
- * Data table style
- *
- * Transparent table with suddle borders
- * and blue row-highlighting.
- */
-.mw-datatable {
- border-collapse: collapse;
-}
-.mw-datatable,
-.mw-datatable td,
-.mw-datatable th {
- border: 1px solid #aaaaaa;
- padding: 0 0.15em 0 0.15em;
-}
-.mw-datatable th {
- background-color: #ddddff;
-}
-.mw-datatable td {
- background-color: #ffffff;
-}
-.mw-datatable tr:hover td {
- background-color: #eeeeff;
-}
-
-
-/**
- * TablePager tables generated by the TablePager PHP class
- * in MediaWiki (e.g. Special:ListFiles).
- */
-.TablePager {
- min-width: 80%;
-}
-.TablePager_nav {
- margin: 0 auto;
-}
-.TablePager_nav td {
- padding: 3px;
- text-align: center;
-}
-.TablePager_nav a {
- text-decoration: none;
-}
-
-.imagelist td,
-.imagelist th {
- white-space: nowrap;
-}
-.imagelist .TablePager_col_links {
- background-color: #eeeeff;
-}
-.imagelist .TablePager_col_img_description {
- white-space: normal;
-}
-.imagelist th.TablePager_sort {
- background-color: #ccccff;
-}
-
-/* filetoc */
-ul#filetoc {
- text-align: center;
- border: 1px solid #aaaaaa;
- background-color: #f9f9f9;
- padding: 5px;
- font-size: 95%;
- margin-bottom: 0.5em;
- margin-left: 0;
- margin-right: 0;
-}
-
-#filetoc li {
- display: inline;
- list-style-type: none;
- padding-right: 2em;
-}
-
-/* Classes for EXIF data display */
-table.mw_metadata {
- font-size: 0.8em;
- margin-left: 0.5em;
- margin-bottom: 0.5em;
- width: 400px;
-}
-
-table.mw_metadata caption {
- font-weight: bold;
-}
-
-table.mw_metadata th {
- font-weight: normal;
-}
-
-table.mw_metadata td {
- padding: 0.1em;
-}
-
-table.mw_metadata {
- border: none;
- border-collapse: collapse;
-}
-
-table.mw_metadata td,
-table.mw_metadata th {
- text-align: center;
- border: 1px solid #aaaaaa;
- padding-left: 5px;
- padding-right: 5px;
-}
-
-table.mw_metadata th {
- background-color: #f9f9f9;
-}
-
-table.mw_metadata td {
- background-color: #fcfcfc;
-}
-
-table.mw_metadata ul.metadata-langlist {
- list-style-type: none;
- list-style-image: none;
- padding-right: 5px;
- padding-left: 5px;
- margin: 0;
-}
-
-/* Correct directionality when page dir is different from site/user dir */
-.mw-content-ltr ul,
-.mw-content-rtl .mw-content-ltr ul {
- /* @noflip */
- margin: 0.3em 0 0 1.6em;
- padding: 0;
-}
-.mw-content-rtl ul,
-.mw-content-ltr .mw-content-rtl ul {
- /* @noflip */
- margin: 0.3em 1.6em 0 0;
- padding: 0;
-}
-.mw-content-ltr ol,
-.mw-content-rtl .mw-content-ltr ol {
- /* @noflip */
- margin: 0.3em 0 0 3.2em;
- padding: 0;
-}
-.mw-content-rtl ol,
-.mw-content-ltr .mw-content-rtl ol {
- /* @noflip */
- margin: 0.3em 3.2em 0 0;
- padding: 0;
-}
-/* @noflip */
-.mw-content-ltr dd,
-.mw-content-rtl .mw-content-ltr dd {
- margin-left: 1.6em;
- margin-right: 0;
-}
-/* @noflip */
-.mw-content-rtl dd,
-.mw-content-ltr .mw-content-rtl dd {
- margin-right: 1.6em;
- margin-left: 0;
-}
-
-/* Galleries */
-/* These display attributes look nonsensical, but are needed to support IE and FF2 */
-/* Don't forget to update commonPrint.css */
-li.gallerybox {
- vertical-align: top;
- border: solid 2px white;
- display: -moz-inline-box;
- display: inline-block;
-}
-
-ul.gallery,
-li.gallerybox {
- zoom: 1;
- *display: inline;
-}
-
-ul.gallery {
- margin: 2px;
- padding: 2px;
- display: block;
-}
-
-li.gallerycaption {
- font-weight: bold;
- text-align: center;
- display: block;
- word-wrap: break-word;
-}
-
-li.gallerybox div.thumb {
- text-align: center;
- border: 1px solid #ccc;
- background-color: #f9f9f9;
- margin: 2px;
-}
-
-li.gallerybox div.thumb img {
- display: block;
- margin: 0 auto;
-}
-
-div.gallerytext {
- overflow: hidden;
- font-size: 94%;
- padding: 2px 4px;
- word-wrap: break-word;
-}
-
-.mw-ajax-loader {
- /* @embed */
- background-image: url(images/ajax-loader.gif);
- background-position: center center;
- background-repeat: no-repeat;
- padding: 16px;
- position: relative;
- top: -16px;
-}
-
-.mw-small-spinner {
- padding: 10px !important;
- margin-right: 0.6em;
- /* @embed */
- background-image: url(images/spinner.gif);
- background-position: center center;
- background-repeat: no-repeat;
-}
-
-/* Language specific height correction for titles. Ref Bug 29405 and Bug 30809 */
-/* Languages like hi or ml require slightly more vertical space to show diacritics properly */
-h1:lang(as),
-h1:lang(bh), /* Macrolanguage, used on bh.wikipedia.org, should be removed one day */
-h1:lang(bho),
-h1:lang(bn),
-h1:lang(gu),
-h1:lang(hi),
-h1:lang(kn),
-h1:lang(ml),
-h1:lang(mr),
-h1:lang(or),
-h1:lang(pa),
-h1:lang(sa),
-h1:lang(ta),
-h1:lang(te) {
- line-height: 1.5em !important;
-}
-h2:lang(as), h3:lang(as), h4:lang(as), h5:lang(as), h6:lang(as),
-h2:lang(bho), h3:lang(bho), h4:lang(bho), h5:lang(bho), h6:lang(bho),
-h2:lang(bh), h3:lang(bh), h4:lang(bh), h5:lang(bh), h6:lang(bh),
-h2:lang(bn), h3:lang(bn), h4:lang(bn), h5:lang(bn), h6:lang(bn),
-h2:lang(gu), h3:lang(gu), h4:lang(gu), h5:lang(gu), h6:lang(gu),
-h2:lang(hi), h3:lang(hi), h4:lang(hi), h5:lang(hi), h6:lang(hi),
-h2:lang(kn), h3:lang(kn), h4:lang(kn), h5:lang(kn), h6:lang(kn),
-h2:lang(ml), h3:lang(ml), h4:lang(ml), h5:lang(ml), h6:lang(ml),
-h2:lang(mr), h3:lang(mr), h4:lang(mr), h5:lang(mr), h6:lang(mr),
-h2:lang(or), h3:lang(or), h4:lang(or), h5:lang(or), h6:lang(or),
-h2:lang(pa), h3:lang(pa), h4:lang(pa), h5:lang(pa), h6:lang(pa),
-h2:lang(sa), h3:lang(sa), h4:lang(sa), h5:lang(sa), h6:lang(sa),
-h2:lang(ta), h3:lang(ta), h4:lang(ta), h5:lang(ta), h6:lang(ta),
-h2:lang(te), h3:lang(te), h4:lang(te), h5:lang(te), h6:lang(te) {
- line-height: 1.2em;
-}
-
-/* Localised ordered list numbering for some languages */
-ol:lang(bcc) li,
-ol:lang(bqi) li,
-ol:lang(fa) li,
-ol:lang(glk) li,
-ol:lang(kk-arab) li,
-ol:lang(mzn) li {
- list-style-type: -moz-persian;
- list-style-type: persian;
-}
-
-ol:lang(ckb) li {
- list-style-type: -moz-arabic-indic;
- list-style-type: arabic-indic;
-}
-
-ol:lang(hi) li,
-ol:lang(mr) li {
- list-style-type: -moz-devanagari;
- list-style-type: devanagari;
-}
-
-ol:lang(as) li,
-ol:lang(bn) li {
- list-style-type: -moz-bengali;
- list-style-type: bengali;
-}
-
-ol:lang(or) li {
- list-style-type: -moz-oriya;
- list-style-type: oriya;
-}
-
-#toc ul, .toc ul {
- margin: .3em 0;
-}
-
-/* Correct directionality when page dir is different from site/user dir */
-/* @noflip */ .mw-content-ltr .toc ul,
-.mw-content-ltr #toc ul,
-.mw-content-rtl .mw-content-ltr .toc ul,
-.mw-content-rtl .mw-content-ltr #toc ul {
- text-align: left;
-}
-/* @noflip */ .mw-content-rtl .toc ul,
-.mw-content-rtl #toc ul,
-.mw-content-ltr .mw-content-rtl .toc ul,
-.mw-content-ltr .mw-content-rtl #toc ul {
- text-align: right;
-}
-/* @noflip */ .mw-content-ltr .toc ul ul,
-.mw-content-ltr #toc ul ul,
-.mw-content-rtl .mw-content-ltr .toc ul ul,
-.mw-content-rtl .mw-content-ltr #toc ul ul {
- margin: 0 0 0 2em;
-}
-/* @noflip */ .mw-content-rtl .toc ul ul,
-.mw-content-rtl #toc ul ul,
-.mw-content-ltr .mw-content-rtl .toc ul ul,
-.mw-content-ltr .mw-content-rtl #toc ul ul {
- margin: 0 2em 0 0;
-}
-
-#toc #toctitle,
-.toc #toctitle,
-#toc .toctitle,
-.toc .toctitle {
- direction: ltr;
-}
-
-/* tooltip styles */
-.mw-help-field-hint {
- display: none;
- margin-left: 2px;
- margin-bottom: -8px;
- padding: 0 0 0 15px;
- /* @embed */
- background-image: url('images/help-question.gif');
- background-position: left center;
- background-repeat: no-repeat;
- cursor: pointer;
- font-size: .8em;
- text-decoration: underline;
- color: #0645ad;
-}
-.mw-help-field-hint:hover {
- /* @embed */
- background-image: url('images/help-question-hover.gif');
-}
-.mw-help-field-data {
- display: block;
- background-color: #d6f3ff;
- padding:5px 8px 4px 8px;
- border: 1px solid #5dc9f4;
- margin-left: 20px;
-}
-.tipsy {
- padding: 5px 5px 10px;
- font-size: 12px;
- position: absolute;
- z-index: 100000;
- overflow: visible;
-}
-.tipsy-inner {
- padding: 5px 8px 4px 8px;
- background-color: #d6f3ff;
- color: black;
- border: 1px solid #5dc9f4;
- max-width: 300px;
- text-align: left;
-}
-.tipsy-arrow {
- position: absolute;
- /* @embed */
- background: url(images/tipsy-arrow.gif) no-repeat top left;
- width: 13px;
- height: 13px;
-}
-.tipsy-se .tipsy-arrow {
- bottom: -2px;
- right: 10px;
- background-position: 0% 100%;
-}
-
-#mw-clearyourcache,
-#mw-sitecsspreview,
-#mw-sitejspreview,
-#mw-usercsspreview,
-#mw-userjspreview {
- direction: ltr;
- unicode-bidi: embed;
-}
-
-/* Correct user & content directionality when viewing a diff */
-.diff-currentversion-title,
-.diff {
- direction: ltr;
- unicode-bidi: embed;
-}
-/* @noflip */ .diff-contentalign-right td {
- direction: rtl;
- unicode-bidi: embed;
-}
-/* @noflip */ .diff-contentalign-left td {
- direction: ltr;
- unicode-bidi: embed;
-}
-.diff-otitle,
-.diff-ntitle,
-.diff-lineno {
- direction: ltr !important;
- unicode-bidi: embed;
-}
-
-#mw-revision-info,
-#mw-revision-info-current,
-#mw-revision-nav {
- direction: ltr;
- display: inline;
-}
-
-/* Images */
-
-/* @noflip */ div.tright,
-div.floatright,
-table.floatright {
- clear: right;
- float: right;
-}
-/* @noflip */ div.tleft,
-div.floatleft,
-table.floatleft {
- float: left;
- clear: left;
-}
-div.floatright,
-table.floatright,
-div.floatleft,
-table.floatleft {
- position: relative;
-}
-
-/* bug 12205 */
-#mw-credits a {
- unicode-bidi: embed;
-}
-
-/* Accessibility */
-.mw-jump,
-#jump-to-nav {
- overflow: hidden;
- height: 0;
- zoom: 1; /* http://webaim.org/techniques/skipnav/#iequirk */
-}
-
-/* Print footer should be hidden by default in screen. */
-.printfooter {
- display: none;
-}
-
-/* For developpers */
-.xdebug-error {
- position: absolute;
- z-index: 99;
-}
-
-.editsection, .toctoggle {
- -moz-user-select: none;
- -webkit-user-select: none;
- -ms-user-select: none;
- user-select: none;
-}
-/**
- * MediaWiki Print style sheet for CSS2-capable browsers.
- * Copyright Gabriel Wicke, http://www.aulinx.de/
- *
- * Derived from the plone (http://plone.org/) styles
- * Copyright Alexander Limi
- */
-
-/* Thanks to A List Apart (http://alistapart.com/) for useful extras */
-a.stub,
-a.new {
- color: #ba0000;
- text-decoration: none;
-}
-
-#toc {
- border: 1px solid #aaaaaa;
- background-color: #f9f9f9;
- padding: 5px;
-}
-
-/* images */
-div.floatright {
- float: right;
- clear: right;
- position: relative;
- margin: 0.5em 0 0.8em 1.4em;
-}
-div.floatright p {
- font-style: italic;
-}
-div.floatleft {
- float: left;
- clear: left;
- position: relative;
- margin: 0.5em 1.4em 0.8em 0;
-}
-div.floatleft p {
- font-style: italic;
-}
-div.center {
- text-align: center;
-}
-
-/* thumbnails */
-div.thumb {
- border: none;
- width: auto;
- margin-top: 0.5em;
- margin-bottom: 0.8em;
- background-color: transparent;
-}
-div.thumbinner {
- border:1px solid #cccccc;
- padding: 3px !important;
- background-color: White;
- font-size: 94%;
- text-align: center;
- overflow: hidden;
-}
-html .thumbimage {
- border: 1px solid #cccccc;
-}
-html .thumbcaption {
- border: none;
- text-align: left;
- line-height: 1.4em;
- padding: 3px !important;
- font-size: 94%;
-}
-
-div.magnify {
- display: none;
-}
-/* @noflip */
-div.tright {
- float: right;
- clear: right;
- margin: 0.5em 0 0.8em 1.4em;
-}
-/* @noflip */
-div.tleft {
- float: left;
- clear: left;
- margin: 0.5em 1.4em 0.8em 0;
-}
-img.thumbborder {
- border: 1px solid #dddddd;
-}
-
-/* table standards */
-table.rimage {
- float: right;
- width: 1pt;
- position: relative;
- margin-left: 1em;
- margin-bottom: 1em;
- text-align: center;
-}
-
-body {
- background: white;
- color: black;
- margin: 0;
- padding: 0;
-}
-
-.noprint,
-div#jump-to-nav,
-.mw-jump,
-div.top,
-div#column-one,
-#colophon,
-.editsection,
-.toctoggle,
-.tochidden,
-div#f-poweredbyico,
-div#f-copyrightico,
-li#viewcount,
-li#about,
-li#disclaimer,
-li#mobileview,
-li#privacy,
-#footer-places,
-.mw-hidden-catlinks,
-tr.mw-metadata-show-hide-extended,
-span.mw-filepage-other-resolutions,
-#filetoc {
- /* Hides all the elements irrelevant for printing */
- display: none;
-}
-
-ul {
- list-style-type: square;
-}
-
-#content {
- background: none;
- border: none !important;
- padding: 0 !important;
- margin: 0 !important;
- direction: ltr;
-}
-#footer {
- background : white;
- color : black;
- margin-top: 1em;
- border-top: 1px solid #AAA;
- direction: ltr;
-}
-
-h1, h2, h3, h4, h5, h6 {
- font-weight: bold;
-}
-
-p {
- margin: 1em 0;
- line-height: 1.2em;
-}
-
-pre {
- border: 1pt dashed black;
- white-space: pre;
- font-size: 8pt;
- overflow: auto;
- padding: 1em 0;
- background: white;
- color: black;
-}
-
-table.listing,
-table.listing td {
- border: 1pt solid black;
- border-collapse: collapse;
-}
-
-a {
- color: black !important;
- background: none !important;
- padding: 0 !important;
-}
-
-a:link, a:visited {
- color: #520;
- background: transparent;
- text-decoration: underline;
-}
-
-#content a.external.text:after,
-#content a.external.autonumber:after {
- /* Expand URLs for printing */
- content: " (" attr(href) ") ";
-}
-
-#globalWrapper {
- width: 100% !important;
- min-width: 0 !important;
-}
-
-#content {
- background: white;
- color: black;
-}
-
-#column-content {
- margin: 0 !important;
-}
-
-#column-content #content {
- padding: 1em;
- margin: 0 !important;
-}
-
-/* MSIE/Win doesn't understand 'inherit' */
-a,
-a.external,
-a.new,
-a.stub {
- color: black !important;
- text-decoration: none !important;
-}
-
-/* Continue ... */
-a,
-a.external,
-a.new,
-a.stub {
- color: inherit !important;
- text-decoration: inherit !important;
-}
-
-img {
- border: none;
- vertical-align: middle;
-}
-
-/* math */
-span.texhtml {
- font-family: serif;
-}
-
-#siteNotice {
- display: none;
-}
-
-/* Galleries (see shared.css for more info) */
-li.gallerybox {
- vertical-align: top;
- border: solid 2px white;
- display: -moz-inline-box;
- display: inline-block;
-}
-
-ul.gallery, li.gallerybox {
- zoom: 1;
- *display: inline;
-}
-
-ul.gallery {
- margin: 2px;
- padding: 2px;
- display: block;
-}
-
-li.gallerycaption {
- font-weight: bold;
- text-align: center;
- display: block;
- word-wrap: break-word;
-}
-
-li.gallerybox div.thumb {
- text-align: center;
- border: 1px solid #ccc;
- margin: 2px;
-}
-
-div.gallerytext {
- overflow: hidden;
- font-size: 94%;
- padding: 2px 4px;
- word-wrap: break-word;
-}
-
-/**
- * Diff rendering
- */
-table.diff {
- background: white;
-}
-td.diff-otitle {
- background: #ffffff;
-}
-td.diff-ntitle {
- background: #ffffff;
-}
-td.diff-addedline {
- background: #ccffcc;
- font-size: smaller;
- border: solid 2px black;
-}
-td.diff-deletedline {
- background: #ffffaa;
- font-size: smaller;
- border: dotted 2px black;
-}
-td.diff-context {
- background: #eeeeee;
- font-size: smaller;
-}
-.diffchange {
- color: silver;
- font-weight: bold;
- text-decoration: underline;
-}
-
-/**
- * Table rendering
- * As on shared.css but with white background.
- */
-table.wikitable,
-table.mw_metadata {
- margin: 1em 1em 1em 0;
- border: 1px #aaa solid;
- background: white;
- border-collapse: collapse;
-}
-table.wikitable > tr > th, table.wikitable > tr > td,
-table.wikitable > * > tr > th, table.wikitable > * > tr > td,
-.mw_metadata th, .mw_metadata td {
- border: 1px #aaa solid;
- padding: 0.2em;
-}
-table.wikitable > tr > th,
-table.wikitable > * > tr > th,
-.mw_metadata th {
- text-align: center;
- background: white;
- font-weight: bold;
-}
-table.wikitable > caption,
-.mw_metadata caption {
- font-weight: bold;
-}
-
-a.sortheader {
- margin: 0 0.3em;
-}
-
-/* Some pagination options */
-.wikitable, .thumb, img {
- page-break-inside: avoid;
-}
-h2, h3, h4, h5, h6, h7 {
- page-break-after: avoid;
-}
-p {
- widows: 3;
- orphans: 3;
-}
-
-/**
- * Categories
- */
-.catlinks ul {
- display: inline;
- margin: 0;
- padding: 0;
- list-style: none;
- list-style-type: none;
- list-style-image: none;
- vertical-align: middle !ie;
-}
-
-.catlinks li {
- display: inline-block;
- line-height: 1.15em;
- padding: 0 .4em;
- border-left: 1px solid #AAA;
- margin: 0.1em 0;
- zoom: 1;
- display: inline !ie;
-}
-
-.catlinks li:first-child {
- padding-left: .2em;
- border-left: none;
-}
-/* Default styling for HTML elements */
-dfn {
- font-style: inherit; /* Reset default styling for <dfn> */
-}
-sup, sub {
- line-height: 1em; /* Reduce line-height for <sup> and <sub> */
-}
-
-/* Main page fixes */
-#interwiki-completelist {
- font-weight: bold;
-}
-body.page-Main_Page #ca-delete {
- display: none !important;
-}
-body.page-Main_Page #mp-topbanner {
- clear: both;
-}
-
-/* Edit window toolbar */
-#toolbar {
- height: 22px;
- margin-bottom: 6px;
-}
-
-/* Highlight data points in the info action if specified in the URL */
-body.action-info :target {
- background: #DEF;
-}
-
-/* Make the list of references smaller */
-ol.references,
-div.reflist,
-div.refbegin {
- font-size: 90%; /* Default font-size */
- margin-bottom: 0.5em;
-}
-div.refbegin-100 {
- font-size: 100%; /* Option for normal fontsize in {{refbegin}} */
-}
-div.reflist ol.references {
- font-size: 100%; /* Reset font-size when nested in div.reflist */
- list-style-type: inherit; /* Enable custom list style types */
-}
-
-/* Reset top margin for lists embedded in columns */
-div.columns {
- margin-top: 0.3em;
-}
-div.columns dl,
-div.columns ol,
-div.columns ul {
- margin-top: 0;
-}
-
-/* Avoid list items from breaking between columns */
-div.columns li,
-div.columns dd dd {
- -webkit-column-break-inside: avoid;
- page-break-inside: avoid;
- break-inside: avoid-column;
-}
-
-/* Highlight clicked reference in blue to help navigation */
-ol.references li:target,
-sup.reference:target,
-span.citation:target {
- background-color: #DEF;
-}
-
-/* Ensure refs in table headers and the like aren't bold or italic */
-sup.reference {
- font-weight: normal;
- font-style: normal;
-}
-
-/* Allow hidden ref errors to be shown by user CSS */
-span.brokenref {
- display: none;
-}
-
-/* Styling for citations (CSS3). Breaks long urls, etc., rather than overflowing box */
-.citation {
- word-wrap: break-word;
-}
-
-/* For linked citation numbers and document IDs, where
- the number need not be shown on a screen or a handheld,
- but should be included in the printed version */
-@media screen, handheld {
- .citation *.printonly {
- display: none;
- }
-}
-
-/* Style for [[Template:Flowlist]] that Lets lists flow around floating objecs */
-.flowlist ul {
- overflow-x: hidden;
- margin-left: 0em;
- padding-left: 1.6em;
-}
-.flowlist ol {
- overflow-x: hidden;
- margin-left: 0em;
- padding-left: 3.2em;
-}
-.flowlist dl {
- overflow-x: hidden;
-}
-
-/* Style for horizontal lists (separator following item).
- IE8-specific classes are assigned in [[MediaWiki:Common.js/IEFixes.js]].
- @source mediawiki.org/wiki/Snippets/Horizontal_lists
- @revision 4.3 (2014-01-06)
- @author [[User:Edokter]]
- */
-.hlist dl,
-.hlist ol,
-.hlist ul {
- margin: 0;
- padding: 0;
-}
-/* Display list items inline */
-.hlist dd,
-.hlist dt,
-.hlist li {
- margin: 0;
- display: inline;
-}
-/* Display nested lists inline */
-.hlist dl dl, .hlist dl ol, .hlist dl ul,
-.hlist ol dl, .hlist ol ol, .hlist ol ul,
-.hlist ul dl, .hlist ul ol, .hlist ul ul {
- display: inline;
-}
-/* Generate interpuncts */
-.hlist dt:after {
- content: ": ";
-}
-.hlist dd:after,
-.hlist li:after {
- content: " · ";
- font-weight: bold;
-}
-.hlist dd:last-child:after,
-.hlist dt:last-child:after,
-.hlist li:last-child:after {
- content: none;
-}
-/* For IE8 */
-.hlist dd.hlist-last-child:after,
-.hlist dt.hlist-last-child:after,
-.hlist li.hlist-last-child:after {
- content: none;
-}
-/* Add parentheses around nested lists */
-.hlist dd dd:first-child:before, .hlist dd dt:first-child:before, .hlist dd li:first-child:before,
-.hlist dt dd:first-child:before, .hlist dt dt:first-child:before, .hlist dt li:first-child:before,
-.hlist li dd:first-child:before, .hlist li dt:first-child:before, .hlist li li:first-child:before {
- content: " (";
- font-weight: normal;
-}
-.hlist dd dd:last-child:after, .hlist dd dt:last-child:after, .hlist dd li:last-child:after,
-.hlist dt dd:last-child:after, .hlist dt dt:last-child:after, .hlist dt li:last-child:after,
-.hlist li dd:last-child:after, .hlist li dt:last-child:after, .hlist li li:last-child:after {
- content: ") ";
- font-weight: normal;
-}
-/* For IE8 */
-.hlist dd dd.hlist-last-child:after, .hlist dd dt.hlist-last-child:after, .hlist dd li.hlist-last-child:after,
-.hlist dt dd.hlist-last-child:after, .hlist dt dt.hlist-last-child:after, .hlist dt li.hlist-last-child:after,
-.hlist li dd.hlist-last-child:after, .hlist li dt.hlist-last-child:after, .hlist li li.hlist-last-child:after {
- content: ") ";
- font-weight: normal;
-}
-/* Put ordinals in front of ordered list items */
-.hlist ol {
- counter-reset: listitem;
-}
-.hlist ol > li {
- counter-increment: listitem;
-}
-.hlist ol > li:before {
- content: " " counter(listitem) " ";
-}
-.hlist dd ol > li:first-child:before,
-.hlist dt ol > li:first-child:before,
-.hlist li ol > li:first-child:before {
- content: " (" counter(listitem) " ";
-}
-
-/* Unbulleted lists */
-.plainlist ul {
- line-height: inherit;
- list-style: none none;
- margin: 0;
-}
-.plainlist ul li {
- margin-bottom: 0;
-}
-
-/* Default style for navigation boxes */
-.navbox { /* Navbox container style */
- border: 1px solid #aaa;
- width: 100%;
- margin: auto;
- clear: both;
- font-size: 88%;
- text-align: center;
- padding: 1px;
-}
-.navbox-inner,
-.navbox-subgroup {
- width: 100%;
-}
-.navbox-group,
-.navbox-title,
-.navbox-abovebelow {
- padding: 0.25em 1em; /* Title, group and above/below styles */
- line-height: 1.5em;
- text-align: center;
-}
-th.navbox-group { /* Group style */
- white-space: nowrap;
- /* @noflip */
- text-align: right;
-}
-.navbox,
-.navbox-subgroup {
- background: #fdfdfd; /* Background color */
-}
-.navbox-list {
- line-height: 1.8em;
- border-color: #fdfdfd; /* Must match background color */
-}
-.navbox th,
-.navbox-title {
- background: #ccccff; /* Level 1 color */
-}
-.navbox-abovebelow,
-th.navbox-group,
-.navbox-subgroup .navbox-title {
- background: #ddddff; /* Level 2 color */
-}
-.navbox-subgroup .navbox-group,
-.navbox-subgroup .navbox-abovebelow {
- background: #e6e6ff; /* Level 3 color */
-}
-.navbox-even {
- background: #f7f7f7; /* Even row striping */
-}
-.navbox-odd {
- background: transparent; /* Odd row striping */
-}
-table.navbox + table.navbox { /* Single pixel border between adjacent navboxes */
- margin-top: -1px; /* (doesn't work for IE6, but that's okay) */
-}
-.navbox .hlist td dl,
-.navbox .hlist td ol,
-.navbox .hlist td ul,
-.navbox td.hlist dl,
-.navbox td.hlist ol,
-.navbox td.hlist ul {
- padding: 0.125em 0; /* Adjust hlist padding in navboxes */
-}
-ol + table.navbox,
-ul + table.navbox {
- margin-top: 0.5em; /* Prevent lists from clinging to navboxes */
-}
-
-/* Default styling for Navbar template */
-.navbar {
- display: inline;
- font-size: 88%;
- font-weight: normal;
-}
-.navbar ul {
- display: inline;
- white-space: nowrap;
-}
-.navbar li {
- word-spacing: -0.125em;
-}
-.navbar.mini li span {
- font-variant: small-caps;
-}
-/* Navbar styling when nested in infobox and navbox */
-.infobox .navbar {
- font-size: 100%;
-}
-.navbox .navbar {
- display: block;
- font-size: 100%;
-}
-.navbox-title .navbar {
- /* @noflip */
- float: left;
- /* @noflip */
- text-align: left;
- /* @noflip */
- margin-right: 0.5em;
- width: 6em;
-}
-
-/* 'show'/'hide' buttons created dynamically by the CollapsibleTables javascript
- in [[MediaWiki:Common.js]] are styled here so they can be customised. */
-.collapseButton {
- /* @noflip */
- float: right;
- font-weight: normal;
- /* @noflip */
- margin-left: 0.5em;
- /* @noflip */
- text-align: right;
- width: auto;
-}
-/* In navboxes, the show/hide button balances the v·d·e links
- from [[Template:Navbar]], so they need to be the same width. */
-.navbox .collapseButton {
- width: 6em;
-}
-
-/* Styling for JQuery makeCollapsible, matching that of collapseButton */
-.mw-collapsible-toggle {
- font-weight: normal;
- /* @noflip */
- text-align: right;
-}
-.navbox .mw-collapsible-toggle {
- width: 6em;
-}
-
-/* Infobox template style */
-.infobox {
- border: 1px solid #aaa;
- background-color: #f9f9f9;
- color: black;
- /* @noflip */
- margin: 0.5em 0 0.5em 1em;
- padding: 0.2em;
- /* @noflip */
- float: right;
- /* @noflip */
- clear: right;
- /* @noflip */
- text-align: left;
- font-size: 88%;
- line-height: 1.5em;
-}
-.infobox caption {
- font-size: 125%;
- font-weight: bold;
-}
-.infobox td,
-.infobox th {
- vertical-align: top;
-}
-.infobox.bordered {
- border-collapse: collapse;
-}
-.infobox.bordered td,
-.infobox.bordered th {
- border: 1px solid #aaa;
-}
-.infobox.bordered .borderless td,
-.infobox.bordered .borderless th {
- border: 0;
-}
-
-.infobox.sisterproject {
- width: 20em;
- font-size: 90%;
-}
-
-.infobox.standard-talk {
- border: 1px solid #c0c090;
- background-color: #f8eaba;
-}
-.infobox.standard-talk.bordered td,
-.infobox.standard-talk.bordered th {
- border: 1px solid #c0c090;
-}
-
-/* styles for bordered infobox with merged rows */
-.infobox.bordered .mergedtoprow td,
-.infobox.bordered .mergedtoprow th {
- border: 0;
- border-top: 1px solid #aaa;
- /* @noflip */
- border-right: 1px solid #aaa;
-}
-
-.infobox.bordered .mergedrow td,
-.infobox.bordered .mergedrow th {
- border: 0;
- /* @noflip */
- border-right: 1px solid #aaa;
-}
-
-/* Styles for geography infoboxes, eg countries,
- country subdivisions, cities, etc. */
-.infobox.geography {
- border-collapse: collapse;
- line-height: 1.2em;
- font-size: 90%;
-}
-
-.infobox.geography td,
-.infobox.geography th {
- border-top: 1px solid #aaa;
- padding: 0.4em 0.6em 0.4em 0.6em;
-}
-.infobox.geography .mergedtoprow td,
-.infobox.geography .mergedtoprow th {
- border-top: 1px solid #aaa;
- padding: 0.4em 0.6em 0.2em 0.6em;
-}
-
-.infobox.geography .mergedrow td,
-.infobox.geography .mergedrow th {
- border: 0;
- padding: 0 0.6em 0.2em 0.6em;
-}
-
-.infobox.geography .mergedbottomrow td,
-.infobox.geography .mergedbottomrow th {
- border-top: 0;
- border-bottom: 1px solid #aaa;
- padding: 0 0.6em 0.4em 0.6em;
-}
-
-.infobox.geography .maptable td,
-.infobox.geography .maptable th {
- border: 0;
- padding: 0;
-}
-
-/* Normal font styling for table row headers with scope="row" tag */
-.wikitable.plainrowheaders th[scope=row] {
- font-weight: normal;
- /* @noflip */
- text-align: left;
-}
-
-/* Lists in data cells are always left-aligned */
-.wikitable td ul,
-.wikitable td ol,
-.wikitable td dl {
- /* @noflip */
- text-align: left;
-}
-/* ...unless they also use the hlist class */
-.wikitable.hlist td ul,
-.wikitable.hlist td ol,
-.wikitable.hlist td dl {
- text-align: inherit;
-}
-
-/* Icons for medialist templates [[Template:Listen]],
- [[Template:Multi-listen_start]], [[Template:Video]],
- [[Template:Multi-video_start]] */
-div.listenlist {
- background: url("//upload.wikimedia.org/wikipedia/commons/4/47/Sound-icon.svg") no-repeat scroll 0% 0% transparent;
- background-size: 30px;
- padding-left: 40px;
-}
-
-/* Fix for hieroglyphs specificality issue in infoboxes ([[Bugzilla:41869]]) */
-table.mw-hiero-table td {
- vertical-align: middle;
-}
-
-/* Style rules for media list templates */
-div.medialist {
- min-height: 50px;
- margin: 1em;
- /* @noflip */
- background-position: top left;
- background-repeat: no-repeat;
-}
-div.medialist ul {
- list-style-type: none;
- list-style-image: none;
- margin: 0;
-}
-div.medialist ul li {
- padding-bottom: 0.5em;
-}
-div.medialist ul li li {
- font-size: 91%;
- padding-bottom: 0;
-}
-
-/* Change the external link icon to an Adobe icon for all PDF files
- in browsers that support these CSS selectors, like Mozilla and Opera */
-div#content a[href$=".pdf"].external,
-div#content a[href*=".pdf?"].external,
-div#content a[href*=".pdf#"].external,
-div#content a[href$=".PDF"].external,
-div#content a[href*=".PDF?"].external,
-div#content a[href*=".PDF#"].external,
-div#mw_content a[href$=".pdf"].external,
-div#mw_content a[href*=".pdf?"].external,
-div#mw_content a[href*=".pdf#"].external,
-div#mw_content a[href$=".PDF"].external,
-div#mw_content a[href*=".PDF?"].external,
-div#mw_content a[href*=".PDF#"].external {
- background: url("//upload.wikimedia.org/wikipedia/commons/2/23/Icons-mini-file_acrobat.gif") no-repeat right;
- /* @noflip */
- padding-right: 18px;
-}
-
-/* Change the external link icon to an Adobe icon anywhere the PDFlink class
- is used (notably Template:PDFlink). This works in IE, unlike the above. */
-div#content span.PDFlink a,
-div#mw_content span.PDFlink a {
- background: url("//upload.wikimedia.org/wikipedia/commons/2/23/Icons-mini-file_acrobat.gif") no-repeat right;
- /* @noflip */
- padding-right: 18px;
-}
-
-/* Content in columns with CSS instead of tables ([[Template:Columns]]) */
-div.columns-2 div.column {
- /* @noflip */
- float: left;
- width: 50%;
- min-width: 300px;
-}
-div.columns-3 div.column {
- /* @noflip */
- float: left;
- width: 33.3%;
- min-width: 200px;
-}
-div.columns-4 div.column {
- /* @noflip */
- float: left;
- width: 25%;
- min-width: 150px;
-}
-div.columns-5 div.column {
- /* @noflip */
- float: left;
- width: 20%;
- min-width: 120px;
-}
-
-/* Messagebox templates */
-.messagebox {
- border: 1px solid #aaa;
- background-color: #f9f9f9;
- width: 80%;
- margin: 0 auto 1em auto;
- padding: .2em;
-}
-.messagebox.merge {
- border: 1px solid #c0b8cc;
- background-color: #f0e5ff;
- text-align: center;
-}
-.messagebox.cleanup {
- border: 1px solid #9f9fff;
- background-color: #efefff;
- text-align: center;
-}
-.messagebox.standard-talk {
- border: 1px solid #c0c090;
- background-color: #f8eaba;
- margin: 4px auto;
-}
-/* For old WikiProject banners inside banner shells. */
-.mbox-inside .standard-talk,
-.messagebox.nested-talk {
- border: 1px solid #c0c090;
- background-color: #f8eaba;
- width: 100%;
- margin: 2px 0;
- padding: 2px;
-}
-.messagebox.small {
- width: 238px;
- font-size: 85%;
- /* @noflip */
- float: right;
- clear: both;
- /* @noflip */
- margin: 0 0 1em 1em;
- line-height: 1.25em;
-}
-.messagebox.small-talk {
- width: 238px;
- font-size: 85%;
- /* @noflip */
- float: right;
- clear: both;
- /* @noflip */
- margin: 0 0 1em 1em;
- line-height: 1.25em;
- background: #F8EABA;
-}
-
-/* Cell sizes for ambox/tmbox/imbox/cmbox/ombox/fmbox/dmbox message boxes */
-th.mbox-text, td.mbox-text { /* The message body cell(s) */
- border: none;
- /* @noflip */
- padding: 0.25em 0.9em; /* 0.9em left/right */
- width: 100%; /* Make all mboxes the same width regardless of text length */
-}
-td.mbox-image { /* The left image cell */
- border: none;
- /* @noflip */
- padding: 2px 0 2px 0.9em; /* 0.9em left, 0px right */
- text-align: center;
-}
-td.mbox-imageright { /* The right image cell */
- border: none;
- /* @noflip */
- padding: 2px 0.9em 2px 0; /* 0px left, 0.9em right */
- text-align: center;
-}
-td.mbox-empty-cell { /* An empty narrow cell */
- border: none;
- padding: 0px;
- width: 1px;
-}
-
-/* Article message box styles */
-table.ambox {
- margin: 0px 10%; /* 10% = Will not overlap with other elements */
- border: 1px solid #aaa;
- /* @noflip */
- border-left: 10px solid #1e90ff; /* Default "notice" blue */
- background: #fbfbfb;
-}
-table.ambox + table.ambox { /* Single border between stacked boxes. */
- margin-top: -1px;
-}
-.ambox th.mbox-text,
-.ambox td.mbox-text { /* The message body cell(s) */
- padding: 0.25em 0.5em; /* 0.5em left/right */
-}
-.ambox td.mbox-image { /* The left image cell */
- /* @noflip */
- padding: 2px 0 2px 0.5em; /* 0.5em left, 0px right */
-}
-.ambox td.mbox-imageright { /* The right image cell */
- /* @noflip */
- padding: 2px 0.5em 2px 0; /* 0px left, 0.5em right */
-}
-
-table.ambox-notice {
- /* @noflip */
- border-left: 10px solid #1e90ff; /* Blue */
-}
-table.ambox-speedy {
- /* @noflip */
- border-left: 10px solid #b22222; /* Red */
- background: #fee; /* Pink */
-}
-table.ambox-delete {
- /* @noflip */
- border-left: 10px solid #b22222; /* Red */
-}
-table.ambox-content {
- /* @noflip */
- border-left: 10px solid #f28500; /* Orange */
-}
-table.ambox-style {
- /* @noflip */
- border-left: 10px solid #f4c430; /* Yellow */
-}
-table.ambox-move {
- /* @noflip */
- border-left: 10px solid #9932cc; /* Purple */
-}
-table.ambox-protection {
- /* @noflip */
- border-left: 10px solid #bba; /* Gray-gold */
-}
-
-/* Image message box styles */
-table.imbox {
- margin: 4px 10%;
- border-collapse: collapse;
- border: 3px solid #1e90ff; /* Default "notice" blue */
- background: #fbfbfb;
-}
-.imbox .mbox-text .imbox { /* For imboxes inside imbox-text cells. */
- margin: 0 -0.5em; /* 0.9 - 0.5 = 0.4em left/right. */
- display: block; /* Fix for webkit to force 100% width. */
-}
-.mbox-inside .imbox { /* For imboxes inside other templates. */
- margin: 4px;
-}
-
-table.imbox-notice {
- border: 3px solid #1e90ff; /* Blue */
-}
-table.imbox-speedy {
- border: 3px solid #b22222; /* Red */
- background: #fee; /* Pink */
-}
-table.imbox-delete {
- border: 3px solid #b22222; /* Red */
-}
-table.imbox-content {
- border: 3px solid #f28500; /* Orange */
-}
-table.imbox-style {
- border: 3px solid #f4c430; /* Yellow */
-}
-table.imbox-move {
- border: 3px solid #9932cc; /* Purple */
-}
-table.imbox-protection {
- border: 3px solid #bba; /* Gray-gold */
-}
-table.imbox-license {
- border: 3px solid #88a; /* Dark gray */
- background: #f7f8ff; /* Light gray */
-}
-table.imbox-featured {
- border: 3px solid #cba135; /* Brown-gold */
-}
-
-/* Category message box styles */
-table.cmbox {
- margin: 3px 10%;
- border-collapse: collapse;
- border: 1px solid #aaa;
- background: #DFE8FF; /* Default "notice" blue */
-}
-
-table.cmbox-notice {
- background: #D8E8FF; /* Blue */
-}
-table.cmbox-speedy {
- margin-top: 4px;
- margin-bottom: 4px;
- border: 4px solid #b22222; /* Red */
- background: #FFDBDB; /* Pink */
-}
-table.cmbox-delete {
- background: #FFDBDB; /* Red */
-}
-table.cmbox-content {
- background: #FFE7CE; /* Orange */
-}
-table.cmbox-style {
- background: #FFF9DB; /* Yellow */
-}
-table.cmbox-move {
- background: #E4D8FF; /* Purple */
-}
-table.cmbox-protection {
- background: #EFEFE1; /* Gray-gold */
-}
-
-/* Other pages message box styles */
-table.ombox {
- margin: 4px 10%;
- border-collapse: collapse;
- border: 1px solid #aaa; /* Default "notice" gray */
- background: #f9f9f9;
-}
-
-table.ombox-notice {
- border: 1px solid #aaa; /* Gray */
-}
-table.ombox-speedy {
- border: 2px solid #b22222; /* Red */
- background: #fee; /* Pink */
-}
-table.ombox-delete {
- border: 2px solid #b22222; /* Red */
-}
-table.ombox-content {
- border: 1px solid #f28500; /* Orange */
-}
-table.ombox-style {
- border: 1px solid #f4c430; /* Yellow */
-}
-table.ombox-move {
- border: 1px solid #9932cc; /* Purple */
-}
-table.ombox-protection {
- border: 2px solid #bba; /* Gray-gold */
-}
-
-/* Talk page message box styles */
-table.tmbox {
- margin: 4px 10%;
- border-collapse: collapse;
- border: 1px solid #c0c090; /* Default "notice" gray-brown */
- background: #f8eaba;
-}
-.mediawiki .mbox-inside .tmbox { /* For tmboxes inside other templates. The "mediawiki" class ensures that */
- margin: 2px 0; /* this declaration overrides other styles (including mbox-small above) */
- width: 100%; /* For Safari and Opera */
-}
-.mbox-inside .tmbox.mbox-small { /* "small" tmboxes should not be small when */
- line-height: 1.5em; /* also "nested", so reset styles that are */
- font-size: 100%; /* set in "mbox-small" above. */
-}
-
-table.tmbox-speedy {
- border: 2px solid #b22222; /* Red */
- background: #fee; /* Pink */
-}
-table.tmbox-delete {
- border: 2px solid #b22222; /* Red */
-}
-table.tmbox-content {
- border: 2px solid #f28500; /* Orange */
-}
-table.tmbox-style {
- border: 2px solid #f4c430; /* Yellow */
-}
-table.tmbox-move {
- border: 2px solid #9932cc; /* Purple */
-}
-table.tmbox-protection,
-table.tmbox-notice {
- border: 1px solid #c0c090; /* Gray-brown */
-}
-
-/* Disambig and set index box styles */
-table.dmbox {
- clear: both;
- margin: 0.9em 1em;
- border-top: 1px solid #ccc;
- border-bottom: 1px solid #ccc;
- background: transparent;
-}
-
-/* Footer and header message box styles */
-table.fmbox {
- clear: both;
- margin: 0.2em 0;
- width: 100%;
- border: 1px solid #aaa;
- background: #f9f9f9; /* Default "system" gray */
-}
-table.fmbox-system {
- background: #f9f9f9;
-}
-table.fmbox-warning {
- border: 1px solid #bb7070; /* Dark pink */
- background: #ffdbdb; /* Pink */
-}
-table.fmbox-editnotice {
- background: transparent;
-}
-/* Div based "warning" style fmbox messages. */
-div.mw-warning-with-logexcerpt,
-div.mw-lag-warn-high,
-div.mw-cascadeprotectedwarning,
-div#mw-protect-cascadeon {
- clear: both;
- margin: 0.2em 0;
- border: 1px solid #bb7070;
- background: #ffdbdb;
- padding: 0.25em 0.9em;
-}
-/* Div based "system" style fmbox messages.
- Used in [[MediaWiki:Readonly lag]]. */
-div.mw-lag-warn-normal,
-div.fmbox-system {
- clear: both;
- margin: 0.2em 0;
- border: 1px solid #aaa;
- background: #f9f9f9;
- padding: 0.25em 0.9em;
-}
-
-/* These mbox-small classes must be placed after all other
- ambox/tmbox/ombox etc classes. "body.mediawiki" is so
- they override "table.ambox + table.ambox" above. */
-body.mediawiki table.mbox-small { /* For the "small=yes" option. */
- /* @noflip */
- clear: right;
- /* @noflip */
- float: right;
- /* @noflip */
- margin: 4px 0 4px 1em;
- width: 238px;
- font-size: 88%;
- line-height: 1.25em;
-}
-body.mediawiki table.mbox-small-left { /* For the "small=left" option. */
- /* @noflip */
- margin: 4px 1em 4px 0;
- width: 238px;
- border-collapse: collapse;
- font-size: 88%;
- line-height: 1.25em;
-}
-
-/* Style for compact ambox */
-/* Hide the images */
-.compact-ambox table .mbox-image,
-.compact-ambox table .mbox-imageright,
-.compact-ambox table .mbox-empty-cell {
- display: none;
-}
-/* Remove borders, backgrounds, padding, etc. */
-.compact-ambox table.ambox {
- border: none;
- border-collapse: collapse;
- background: transparent;
- margin: 0 0 0 1.6em !important;
- padding: 0 !important;
- width: auto;
- display: block;
-}
-body.mediawiki .compact-ambox table.mbox-small-left {
- font-size: 100%;
- width: auto;
- margin: 0;
-}
-/* Style the text cell as a list item and remove its padding */
-.compact-ambox table .mbox-text {
- padding: 0 !important;
- margin: 0 !important;
-}
-.compact-ambox table .mbox-text-span {
- display: list-item;
- line-height: 1.5em;
- list-style-type: square;
- list-style-image: url(//bits.wikimedia.org/skins/common/images/bullet.gif);
-}
-.skin-vector .compact-ambox table .mbox-text-span {
- list-style-type: circle;
- list-style-image: url(//bits.wikimedia.org/skins/vector/images/bullet-icon.png)
-}
-/* Allow for hiding text in compact form */
-.compact-ambox .hide-when-compact {
- display: none;
-}
-
-/* Remove default styles for [[MediaWiki:Noarticletext]]. */
-div.noarticletext {
- border: none;
- background: transparent;
- padding: 0;
-}
-
-/* Hide (formatting) elements from screen, but not from screenreaders */
-.visualhide {
- position: absolute;
- left: -10000px;
- top: auto;
- width: 1px;
- height: 1px;
- overflow: hidden;
-}
-
-/* Bold save button */
-#wpSave {
- font-weight: bold;
-}
-
-/* class hiddenStructure is defunct. See [[Wikipedia:hiddenStructure]] */
-.hiddenStructure {
- display: inline !important;
- color: #f00;
- background-color: #0f0;
-}
-
-/* suppress missing interwiki image links where #ifexist cannot
- be used due to high number of requests see .hidden-redlink on
- [[m:MediaWiki:Common.css]] */
-.check-icon a.new {
- display: none;
- speak: none;
-}
-
-/* Removes underlines from certain links */
-.nounderlines a,
-.IPA a:link, .IPA a:visited {
- text-decoration: none !important;
-}
-
-/* Standard Navigationsleisten, aka box hiding thingy
- from .de. Documentation at [[Wikipedia:NavFrame]]. */
-div.NavFrame {
- margin: 0;
- padding: 4px;
- border: 1px solid #aaa;
- text-align: center;
- border-collapse: collapse;
- font-size: 95%;
-}
-div.NavFrame + div.NavFrame {
- border-top-style: none;
- border-top-style: hidden;
-}
-div.NavPic {
- background-color: #fff;
- margin: 0;
- padding: 2px;
- /* @noflip */
- float: left;
-}
-div.NavFrame div.NavHead {
- height: 1.6em;
- font-weight: bold;
- background-color: #ccf;
- position: relative;
-}
-div.NavFrame p,
-div.NavFrame div.NavContent,
-div.NavFrame div.NavContent p {
- font-size: 100%;
-}
-div.NavEnd {
- margin: 0;
- padding: 0;
- line-height: 1px;
- clear: both;
-}
-a.NavToggle {
- position: absolute;
- top: 0;
- /* @noflip */
- right: 3px;
- font-weight: normal;
- font-size: 90%;
-}
-
-/* Hatnotes and disambiguation notices */
-.rellink,
-.dablink {
- font-style: italic;
- /* @noflip */
- padding-left: 1.6em;
- margin-bottom: 0.5em;
-}
-.rellink i,
-.dablink i {
- font-style: normal;
-}
-
-/* Allow transcluded pages to display in lists rather than a table.
- Compatible in Firefox; incompatible in IE6. */
-.listify td { display: list-item; }
-.listify tr { display: block; }
-.listify table { display: block; }
-
-/* Geographical coordinates defaults. See [[Template:Coord/link]]
- for how these are used. The classes "geo", "longitude", and
- "latitude" are used by the [[Geo microformat]]. */
-.geo-default, .geo-dms, .geo-dec { display: inline; }
-.geo-nondefault, .geo-multi-punct { display: none; }
-.longitude, .latitude { white-space: nowrap; }
-
-/* When <div class="nonumtoc"> is used on the table of contents,
- the ToC will display without numbers */
-.nonumtoc .tocnumber { display: none; }
-.nonumtoc #toc ul,
-.nonumtoc .toc ul {
- line-height: 1.5em;
- list-style: none none;
- margin: .3em 0 0;
- padding: 0;
-}
-.nonumtoc #toc ul ul,
-.nonumtoc .toc ul ul {
- /* @noflip */
- margin: 0 0 0 2em;
-}
-
-/* Allow limiting of which header levels are shown in a TOC;
- <div class="toclimit-3">, for instance, will limit to
- showing ==headings== and ===headings=== but no further
- (as long as there are no =headings= on the page, which
- there shouldn't be according to the MoS). */
-.toclimit-2 .toclevel-1 ul,
-.toclimit-3 .toclevel-2 ul,
-.toclimit-4 .toclevel-3 ul,
-.toclimit-5 .toclevel-4 ul,
-.toclimit-6 .toclevel-5 ul,
-.toclimit-7 .toclevel-6 ul {
- display: none;
-}
-
-/* Styling for Template:Quote */
-blockquote.templatequote {
- margin-top: 0;
-}
-blockquote.templatequote div.templatequotecite {
- line-height: 1em;
- /* @noflip */
- text-align: left;
- /* @noflip */
- padding-left: 2em;
- margin-top: 0;
-}
-blockquote.templatequote div.templatequotecite cite {
- font-size: 85%;
-}
-
-/* User block messages */
-div.user-block {
- padding: 5px;
- margin-bottom: 0.5em;
- border: 1px solid #A9A9A9;
- background-color: #FFEFD5;
-}
-
-/* Prevent line breaks in silly places:
- 1) Where desired
- 2) Links when we don't want them to
- 3) Bold "links" to the page itself
- 4) Ref tags with group names <ref group="Note"> --> "[Note 1]" */
-.nowrap,
-.nowraplinks a,
-.nowraplinks .selflink,
-sup.reference a {
- white-space: nowrap;
-}
-/* But allow wrapping where desired: */
-.wrap,
-.wraplinks a {
- white-space: normal;
-}
-
-/* For template documentation */
-.template-documentation {
- clear: both;
- margin: 1em 0 0 0;
- border: 1px solid #aaa;
- background-color: #ecfcf4;
- padding: 1em;
-}
-
-/* Inline divs in ImageMaps (code borrowed from de.wiki) */
-.imagemap-inline div {
- display: inline;
-}
-
-/* Increase the height of the image upload box */
-#wpUploadDescription {
- height: 13em;
-}
-
-/* Minimum thumb width */
-.thumbinner {
- min-width: 100px;
-}
-
-/* Makes the background of a framed image white instead of gray.
- Only visible with transparent images. */
-div.thumb .thumbimage {
- background-color: #fff;
-}
-
-/* The backgrounds for galleries. */
-div#content .gallerybox div.thumb {
- /* Light gray padding */
- background-color: #F9F9F9;
-}
-/* Put a chequered background behind images, only visible if they have transparency.
- '.filehistory a img' and '#file img:hover' are handled by MediaWiki core (as of 1.19) */
-.gallerybox .thumb img {
- background: #fff url(//bits.wikimedia.org/skins/common/images/Checker-16x16.png) repeat;
-}
-/* But not on articles, user pages, portals or with opt-out. */
-.ns-0 .gallerybox .thumb img,
-.ns-2 .gallerybox .thumb img,
-.ns-100 .gallerybox .thumb img,
-.nochecker .gallerybox .thumb img {
- background: #fff;
-}
-
-/* Prevent floating boxes from overlapping any category listings,
- file histories, edit previews, and edit [Show changes] views. */
-#mw-subcategories, #mw-pages, #mw-category-media,
-#filehistory, #wikiPreview, #wikiDiff {
- clear: both;
-}
-
-body.rtl #mw-articlefeedbackv5, body.rtl #mw-articlefeedback {
- display: block; /* Override inline block mode */
- margin-bottom: 1em;
- /* @noflip */
- clear: right; /* Clear any info boxes that stick out */
- /* @noflip */
- float: right; /* Prevents margin collapsing */
-}
-
-/* Selectively hide headers in WikiProject banners */
-.wpb .wpb-header { display: none; }
-.wpbs-inner .wpb .wpb-header { display: block; } /* for IE */
-.wpbs-inner .wpb .wpb-header { display: table-row; } /* for real browsers */
-.wpbs-inner .wpb-outside { display: none; } /* hide things that should only display outside shells */
-
-/* Styling for Abuse Filter tags */
-.mw-tag-markers {
- font-family:sans-serif;
- font-style:italic;
- font-size:90%;
-}
-
-/* Hide stuff meant for accounts with special permissions. Made visible again in
- [[MediaWiki:Group-sysop.css]], [[MediaWiki:Group-accountcreator.css]],
- [[MediaWiki:Group-templateeditor.css]] and [[Mediawiki:Group-autoconfirmed.css]]. */
-.sysop-show,
-.accountcreator-show,
-.templateeditor-show,
-.autoconfirmed-show {
- display: none;
-}
-
-/**
- * Hide the redlink generated by {{Editnotice}},
- * this overrides the ".sysop-show { display: none; }" above that applies
- * to the same link as well.
- */
-.ve-init-mw-viewPageTarget-toolbar-editNotices-notice .editnotice-redlink {
- display: none !important;
-}
-
-/* Remove bullets when there are multiple edit page warnings */
-ul.permissions-errors > li {
- list-style: none none;
-}
-ul.permissions-errors {
- margin: 0;
-}
-
-/* No linewrap on the labels of the login/signup page */
-body.page-Special_UserLogin .mw-label label,
-body.page-Special_UserLogin_signup .mw-label label {
- white-space: nowrap;
-}
-
-/* Pie chart test: Transparent borders */
-.transborder {
- border: solid transparent;
-}
-* html .transborder { /* IE6 */
- border: solid #000001;
- filter: chroma(color=#000001);
-}
-
-/* Styling for updated markers on watchlist, history and recent/related changes.
- Bullets are handled in skin-specific stylesheets. */
-.updatedmarker {
- background-color: transparent;
- color: #006400;
-}
-li.mw-changeslist-line-watched .mw-title,
-table.mw-changeslist-line-watched .mw-title,
-table.mw-enhanced-watch .mw-enhanced-rctime {
- font-weight: normal;
-}
-
-/* Adjust font for inline HTML generated formulae */
-span.texhtml {
- font-family: "Times New Roman", "Nimbus Roman No9 L", Times, serif;
- font-size: 118%;
- white-space: nowrap;
-}
-span.texhtml span.texhtml {
- font-size: 100%;
-}
-
-/* Fix so <syntaxhighlight> tags and .css and .js pages get normal text size.
- [[Bugzilla:26204]]. See also [[Wikipedia:Typography#The monospace 'bug']] */
-div.mw-geshi div,
-div.mw-geshi div pre,
-span.mw-geshi,
-pre.source-css,
-pre.source-javascript,
-pre.source-lua {
- font-family: monospace, Courier !important;
-}
-
-/* Fix styling of transcluded prefindex tables */
-table#mw-prefixindex-list-table,
-table#mw-prefixindex-nav-table {
- width: 98%;
-}
-
-/* For portals, added 2011-12-07 -bv
- On wide screens, show these as two columns
- On narrow and mobile screens, let them collapse into a single column */
-.portal-column-left {
- float: left;
- width: 50%;
-}
-.portal-column-right {
- float: right;
- width: 49%;
-}
-.portal-column-left-wide {
- float: left;
- width: 60%;
-}
-.portal-column-right-narrow {
- float: right;
- width: 39%;
-}
-.portal-column-left-extra-wide {
- float: left;
- width: 70%;
-}
-.portal-column-right-extra-narrow {
- float: right;
- width: 29%;
-}
-@media only screen and (max-width: 800px) {
- /* Decouple the columns on narrow screens */
- .portal-column-left,
- .portal-column-right,
- .portal-column-left-wide,
- .portal-column-right-narrow,
- .portal-column-left-extra-wide,
- .portal-column-right-extra-narrow {
- float: inherit;
- width: inherit;
- }
-}
-
-/* For announcements */
-#bodyContent .letterhead {
- background-image:url('//upload.wikimedia.org/wikipedia/commons/e/e0/Tan-page-corner.png');
- background-repeat:no-repeat;
- padding: 2em;
- background-color: #faf9f2;
-}
-
-/* Tree style lists */
-.treeview ul {
- padding: 0;
- margin: 0;
-}
-.treeview li {
- padding: 0;
- margin: 0;
- list-style-type: none;
- list-style-image: none;
- zoom: 1; /* BE KIND TO IE6 */;
-}
-.treeview li li {
- background: url("//upload.wikimedia.org/wikipedia/commons/f/f2/Treeview-grey-line.png") no-repeat 0 -2981px;
- /* @noflip */
- padding-left: 20px;
- text-indent: 0.3em;
-}
-.treeview li li.lastline {
- background-position: 0 -5971px
-}
-.treeview li.emptyline > ul {
- /* @noflip */
- margin-left: -1px;
-}
-.treeview li.emptyline > ul > li:first-child {
- background-position: 0 9px
-}
-
-/* hidden sortkey for tablesorter */
-td .sortkey,
-th .sortkey {
- display: none;
- speak: none;
-}
-
-/* Make it possible to hide checkboxes in <inputbox> */
-.inputbox-hidecheckboxes form .inputbox-element {
- display: none !important;
-}
-
-/* Hide charinsert base for those not using the gadget */
-#editpage-specialchars {
- display: none;
-}
-
-/* work-around for [[bugzilla:23965]] (Kaltura advertisement) */
-.k-player .k-attribution {
- visibility: hidden;
-}
-
-/* [[MediaZilla:35337]] */
-@media (-webkit-min-device-pixel-ratio: 1.5), (min--moz-device-pixel-ratio: 1.5), (min-resolution: 1.5dppx), (min-resolution: 144dpi) {
- #p-logo a {
- background-image: url("//upload.wikimedia.org/wikipedia/commons/thumb/b/b3/Wikipedia-logo-v2-en.svg/204px-Wikipedia-logo-v2-en.svg.png") !important;
- background-size: 136px auto;
- }
-}
-@media (-webkit-min-device-pixel-ratio: 2), (min--moz-device-pixel-ratio: 2), (min-resolution: 2dppx), (min-resolution: 192dpi) {
- #p-logo a {
- background-image: url("//upload.wikimedia.org/wikipedia/commons/thumb/b/b3/Wikipedia-logo-v2-en.svg/270px-Wikipedia-logo-v2-en.svg.png") !important;
- background-size: 135px auto;
- }
-}
-/* Do not print:
- 1: When in mainspace: Article message boxes,
- navboxes, sister project boxes, disambig links,
- and items marked as metadata.
- 2: section edit links.
- 3: navbar links.
- 4: Show/hide toggles for collapsible items.
-*/
-.ns-0 .ambox,
-.ns-0 .navbox,
-.ns-0 .vertical-navbox,
-.ns-0 .infobox.sisterproject,
-.ns-0 .dablink,
-.ns-0 .metadata,
-.editlink,
-.navbar,
-a.NavToggle, span.collapseButton, span.mw-collapsible-toggle,
-th .sortkey, td .sortkey {
- display: none !important;
-}
-
-/* Add formatting to make sure that "external references" from templates
- like [[Template:Ref]] do not get URL expansion, not even when printed.
- The anchor itself has class "external autonumber" and the url expansion
- is inserted when printing (see the common printing style sheet at
- http://en.wikipedia.org/skins-1.5/common/commonPrint.css) using the
- ":after" pseudo-element of CSS. Also hide in <cite> elements.
-*/
-#content cite a.external.text:after,
-.nourlexpansion a.external.text:after,
-.nourlexpansion a.external.autonumber:after {
- display: none !important;
-}
-
-/* Uncollapse collapsible tables/divs.
- The proper way to do this for tables is to use display:table-row,
- but this is not supported by all browsers, so use display:block as fallback.
-*/
-table.collapsible tr, div.NavPic, div.NavContent {
- display: block !important;
-}
-table.collapsible tr {
- display: table-row !important;
-}
-
-/* On websites with siteSub visible, the margin on the firstHeading is not needed. */
-#firstHeading {
- margin: 0px;
-}
-
-/* We don't want very long URLs (that are added to the content in print) to widen the canvas */
-#content a.external.text:after,
-#content a.external.autonumber:after {
- word-wrap: break-word;
-}
-/* Don't display some stuff on the main page */
-body.page-Main_Page #deleteconfirm,
-body.page-Main_Page #t-cite,
-body.page-Main_Page #footer-info-lastmod,
-body.action-view.page-Main_Page #siteSub,
-body.action-view.page-Main_Page #contentSub,
-body.action-view.page-Main_Page h1.firstHeading {
- display: none !important;
-}
-
-/* Position Main Page top banner */
-body.page-Main_Page #mp-topbanner {
- margin-top: 0 !important;
-}
-
-/* Position coordinates */
-#coordinates {
- position: absolute;
- top: 0em;
- right: 0em;
- float: right;
- margin: 0em;
- padding: 0em;
- line-height: 1.5em;
- text-align: right;
- text-indent: 0;
- font-size: 85%;
- text-transform: none;
- white-space: nowrap;
-}
-
-/* For positioning icons at top-right, used in Templates
- "Spoken Article" and "Featured Article" */
-div.topicon {
- position: absolute;
- top: -2em;
- margin-right: -10px;
- display: block !important;
-}
-
-/* FR topicon position */
-div.flaggedrevs_short {
- position: absolute;
- top: -3em;
- right: 80px;
- z-index: 1;
- margin-left: 0;
- /* Because this is not yet a topicon, we emulate it's behavior,
- this ensure compatibility with edit lead section gadget. */
- margin-right: -10px;
-}
-
-/* On rtl interfaces, we need to override the defaults.
- It is content included (so ltr), but positioned in part of the rtl interface. */
-body.rtl #protected-icon {
- /* @noflip */
- left: 55px;
-}
-body.rtl #spoken-icon,
-body.rtl #commons-icon {
- /* @noflip */
- left: 30px;
-}
-body.rtl #featured-star {
- /* @noflip */
- left: 10px;
-}
-
-/* Menu over FR box */
-div.vectorMenu div {
- z-index: 2;
-}
-
-/* Display "From Wikipedia, the free encyclopedia" */
-#siteSub {
- display: inline;
- font-size: 92%;
-}
-
-/* Bullets for Good and Featured interwiki links */
-li.GA {
- list-style-image: url(//upload.wikimedia.org/wikipedia/commons/4/42/Monobook-bullet-ga.png);
-}
-li.FA {
- list-style-image: url(//upload.wikimedia.org/wikipedia/commons/d/d4/Monobook-bullet-star.png);
-}
-
-/* Styling for updated markers on watchlist, history and recent/related changes */
-li.mw-changeslist-line-watched,
-li.mw-history-line-updated {
- list-style-image: url(//upload.wikimedia.org/wikipedia/commons/c/c2/ChangedBulletVector.png);
-}
-
-/* Blue instead of yellow padlock for secure links. */
-#bodyContent a.external[href ^="https://"],
-.link-https {
- background: url(//upload.wikimedia.org/wikipedia/en/0/00/Lock_icon_blue.gif) center right no-repeat;
- /* @noflip */
- padding-right: 16px;
-}
-
-/* (Soft) redirect styling (bug:26544) */
-div.redirectMsg img {
- vertical-align: text-bottom;
-}
-.redirectText {
- font-size: 150%;
- margin: 5px;
-}
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/wikipedia.min.css b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/wikipedia.min.css
deleted file mode 100644
index eecfc919430..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/wikipedia.min.css
+++ /dev/null
@@ -1 +0,0 @@
-html,body{height:100%;margin:0;padding:0;font-family:sans-serif;font-size:1em}body{background-color:#f3f3f3;background-image:url(images/page-base.png)}div#content{margin-left:10em;padding:1em;background-image:url(images/border.png);background-position:top left;background-repeat:repeat-y;background-color:white;color:black;direction:ltr}#mw-page-base{height:5em;background-color:white;background-image:url(images/page-fade.png);background-position:bottom left;background-repeat:repeat-x}#mw-head-base{margin-top:-5em;margin-left:10em;height:5em;background-image:url(images/border.png);background-position:bottom left;background-repeat:repeat-x}div#mw-head{position:absolute;top:0;right:0;width:100%}div#mw-head h5{margin:0;padding:0}div.emptyPortlet{display:none}#p-personal{position:absolute;top:0;right:.75em}#p-personal h5{display:none}#p-personal ul{list-style:none;margin:0;padding-left:10em}#p-personal li{line-height:1.125em;float:left}#p-personal li{margin-left:.75em;margin-top:.5em;font-size:.75em;white-space:nowrap}#left-navigation{position:absolute;left:10em;top:2.5em}#right-navigation{float:right;margin-top:2.5em}div.vectorTabs h5,div.vectorMenu h5 span{display:none}div.vectorTabs{float:left;height:2.5em}div.vectorTabs{background-image:url(images/tab-break.png);background-position:bottom left;background-repeat:no-repeat;padding-left:1px}div.vectorTabs ul{float:left}div.vectorTabs ul{height:100%;list-style:none;margin:0;padding:0}div.vectorTabs ul li{float:left}div.vectorTabs ul li{line-height:1.125em;display:inline-block;height:100%;margin:0;padding:0;background-color:#f3f3f3;background-image:url(images/tab-normal-fade.png);background-position:bottom left;background-repeat:repeat-x;white-space:nowrap}div.vectorTabs ul>li{display:block}div.vectorTabs li.selected{background-image:url(images/tab-current-fade.png)}div.vectorTabs li a{display:inline-block;height:1.9em;padding-left:.5em;padding-right:.5em;color:#0645ad;cursor:pointer;font-size:.8em}div.vectorTabs li>a{display:block}div.vectorTabs li.icon a{background-position:bottom right;background-repeat:no-repeat}div.vectorTabs span a{display:inline-block;padding-top:1.25em}div.vectorTabs span>a{float:left;display:block}div.vectorTabs span{display:inline-block;background-image:url(images/tab-break.png);background-position:bottom right;background-repeat:no-repeat}div.vectorTabs li.selected a,div.vectorTabs li.selected a:visited{color:#333;text-decoration:none}div.vectorTabs li.new a,div.vectorTabs li.new a:visited{color:#a55858}div.vectorMenu{direction:ltr;float:left;background-image:url(images/arrow-down-icon.png);background-position:100% 60%;background-repeat:no-repeat;cursor:pointer}div.vectorMenuFocus{background-image:url(images/arrow-down-focus-icon.png);background-position:100% 60%}body.rtl div.vectorMenu{direction:rtl}div#mw-head div.vectorMenu h5{float:left;background-image:url(images/tab-break.png);background-repeat:no-repeat}div#mw-head div.vectorMenu h5{background-position:bottom left;margin-left:-1px}div#mw-head div.vectorMenu>h5{background-image:none}div#mw-head div.vectorMenu h4{display:inline-block;float:left;font-size:.8em;padding-left:.5em;padding-top:1.375em;font-weight:normal;border:none}div.vectorMenu h5 a{display:inline-block;width:24px;height:2.5em;text-decoration:none;background-image:url(images/tab-break.png);background-repeat:no-repeat}div.vectorMenu h5 a{background-position:bottom right}div.vectorMenu h5>a{display:block}div.vectorMenu div.menu{position:relative;display:none;clear:both;text-align:left}body.rtl div.vectorMenu div.menu{margin-left:24px}body.rtl div.vectorMenu>div.menu{margin-left:auto}body.rtl div.vectorMenu>div.menu,x:-moz-any-link{margin-left:23px}div.vectorMenu:hover div.menu,div.vectorMenu div.menuForceShow{display:block}div.vectorMenu ul{position:absolute;background-color:white;border:solid 1px silver;border-top-width:0;list-style:none;list-style-image:none;list-style-type:none;padding:0;margin:0;margin-left:-1px;text-align:left}div.vectorMenu ul,x:-moz-any-link{min-width:5em}div.vectorMenu ul,x:-moz-any-link,x:default{min-width:0}div.vectorMenu li{padding:0;margin:0;text-align:left;line-height:1em}div.vectorMenu li a{display:inline-block;padding:.5em;white-space:nowrap;color:#0645ad;cursor:pointer;font-size:.8em}div.vectorMenu li>a{display:block}div.vectorMenu li.selected a,div.vectorMenu li.selected a:visited{color:#333;text-decoration:none}#p-search h5{display:none}#p-search{float:left}#p-search{margin-right:.5em;margin-left:.5em}#p-search form,#p-search input{margin:0;margin-top:.4em}div#simpleSearch{display:block;width:14em;height:1.4em;margin-top:.65em;position:relative;min-height:1px;border:solid 1px #AAA;color:black;background-color:white;background-image:url(images/search-fade.png);background-position:top left;background-repeat:repeat-x}div#simpleSearch label{font-size:13px;top:.25em;direction:ltr}div#simpleSearch input{color:black;direction:ltr}div#simpleSearch input:focus{outline:none}div#simpleSearch input.placeholder{color:#999}div#simpleSearch input::-webkit-input-placeholder{color:#999}div#simpleSearch input#searchInput{position:absolute;top:0;left:0;width:90%;margin:0;padding:0;padding-left:.2em;padding-top:.2em;padding-bottom:.2em;outline:none;border:none;font-size:13px;background-color:transparent;direction:ltr}div#simpleSearch button#searchButton{position:absolute;width:10%;right:0;top:0;padding:0;padding-top:.3em;padding-bottom:.2em;padding-right:.4em;margin:0;border:none;cursor:pointer;background-color:transparent;background-image:none}div#simpleSearch button#searchButton img{border:none;margin:0;margin-top:-3px;padding:0}div#simpleSearch button#searchButton>img{margin:0}div#mw-panel{position:absolute;top:160px;padding-top:1em;width:10em;left:0}div#mw-panel div.portal{padding-bottom:1.5em;direction:ltr}div#mw-panel div.portal h5{font-weight:normal;color:#444;padding:.25em;padding-top:0;padding-left:1.75em;cursor:default;border:none;font-size:.75em}div#mw-panel div.portal div.body{margin:0;padding-top:.5em;margin-left:1.25em;background-image:url(images/portal-break.png);background-repeat:no-repeat;background-position:top left}div#mw-panel div.portal div.body ul{list-style:none;list-style-image:none;list-style-type:none;padding:0;margin:0}div#mw-panel div.portal div.body ul li{line-height:1.125em;padding:0;padding-bottom:.5em;margin:0;overflow:hidden;font-size:.75em}div#mw-panel div.portal div.body ul li a{color:#0645ad}div#mw-panel div.portal div.body ul li a:visited{color:#0b0080}div#footer{margin-left:10em;margin-top:0;padding:.75em;background-image:url(images/border.png);background-position:top left;background-repeat:repeat-x;direction:ltr}div#footer ul{list-style:none;list-style-image:none;list-style-type:none;margin:0;padding:0}div#footer ul li{margin:0;padding:0;padding-top:.5em;padding-bottom:.5em;color:#333;font-size:.7em}div#footer #footer-icons{float:right}body.ltr div#footer #footer-places{float:left}div#footer #footer-info li{line-height:1.4em}div#footer #footer-icons li{float:left;margin-left:.5em;line-height:2em;text-align:right}div#footer #footer-places li{float:left;margin-right:1em;line-height:2em}#p-logo{position:absolute;top:-160px;left:0;width:10em;height:160px}#p-logo a{display:block;width:10em;height:160px;background-repeat:no-repeat;background-position:center center;text-decoration:none}#preftoc{width:100%;float:left;clear:both;margin:0!important;padding:0!important;background-image:url(images/preferences-break.png);background-position:bottom left;background-repeat:no-repeat}#preftoc li{float:left;margin:0;padding:0;padding-right:1px;height:2.25em;white-space:nowrap;list-style-type:none;list-style-image:none;background-image:url(images/preferences-break.png);background-position:bottom right;background-repeat:no-repeat}#preftoc li:first-child{margin-left:1px}#preftoc a,#preftoc a:active{display:inline-block;position:relative;color:#0645ad;padding:.5em;text-decoration:none;background-image:none;font-size:.9em}#preftoc a:hover,#preftoc a:focus{text-decoration:underline}#preftoc li.selected a{background-image:url(images/preferences-fade.png);background-position:bottom;background-repeat:repeat-x;color:#333;text-decoration:none}#preferences{float:left;width:100%;margin:0;margin-top:-2px;clear:both;border:solid 1px #ccc;background-color:#f9f9f9;background-image:url(images/preferences-base.png)}#preferences fieldset{border:none;border-top:solid 1px #ccc}#preferences fieldset.prefsection{border:none;padding:0;margin:1em}#preferences legend{color:#666}#preferences fieldset.prefsection legend.mainLegend{display:none}#preferences td{padding-left:.5em;padding-right:.5em}#preferences td.htmlform-tip{font-size:x-small;padding:.2em 2em;color:#666}#preferences div.mw-prefs-buttons{padding:1em}#preferences div.mw-prefs-buttons input{margin-right:.25em}div#content{line-height:1.5em}#bodyContent{font-size:.8em}.editsection{float:right}ul{list-style-image:url(images/bullet-icon.png)}pre{line-height:1.3em}#siteNotice{font-size:.8em}#firstHeading{padding-top:0;margin-top:0;padding-top:0;font-size:1.6em}div#content a.external,div#content a.external[href ^="gopher://"]{background:url(images/external-link-ltr-icon.png) center right no-repeat;padding-right:13px}div#content a.external[href ^="https://"],.link-https{background:url(images/lock-icon.png) center right no-repeat;padding-right:13px}div#content a.external[href ^="mailto:"],.link-mailto{background:url(images/mail-icon.png) center right no-repeat;padding-right:13px}div#content a.external[href ^="news:"]{background:url(images/news-icon.png) center right no-repeat;padding-right:13px}div#content a.external[href ^="ftp://"],.link-ftp{background:url(images/file-icon.png) center right no-repeat;padding-right:13px}div#content a.external[href ^="irc://"],div#content a.external[href ^="ircs://"],.link-irc{background:url(images/talk-icon.png) center right no-repeat;padding-right:13px}div#content a.external[href $=".ogg"],div#content a.external[href $=".OGG"],div#content a.external[href $=".mid"],div#content a.external[href $=".MID"],div#content a.external[href $=".midi"],div#content a.external[href $=".MIDI"],div#content a.external[href $=".mp3"],div#content a.external[href $=".MP3"],div#content a.external[href $=".wav"],div#content a.external[href $=".WAV"],div#content a.external[href $=".wma"],div#content a.external[href $=".WMA"],.link-audio{background:url(images/audio-icon.png) center right no-repeat;padding-right:13px}div#content a.external[href $=".ogm"],div#content a.external[href $=".OGM"],div#content a.external[href $=".avi"],div#content a.external[href $=".AVI"],div#content a.external[href $=".mpeg"],div#content a.external[href $=".MPEG"],div#content a.external[href $=".mpg"],div#content a.external[href $=".MPG"],.link-video{background:url(images/video-icon.png) center right no-repeat;padding-right:13px}div#content a.external[href $=".pdf"],div#content a.external[href $=".PDF"],div#content a.external[href *=".pdf#"],div#content a.external[href *=".PDF#"],div#content a.external[href *=".pdf?"],div#content a.external[href *=".PDF?"],.link-document{background:url(images/document-icon.png) center right no-repeat;padding-right:13px}#pt-userpage,#pt-anonuserpage,#pt-login{background:url(images/user-icon.png) left top no-repeat;padding-left:15px!important;text-transform:none}.redirectText{font-size:140%}.redirectMsg img{vertical-align:text-bottom}#bodyContent{position:relative;width:100%}#mw-js-message{font-size:.8em}div#bodyContent{line-height:1.5em}#ca-unwatch.icon a,#ca-watch.icon a{margin:0;padding:0;outline:none;display:block;width:26px;padding-top:3.1em;margin-top:0;margin-top:-0.8em!ie;height:0;overflow:hidden;background-image:url(images/watch-icons.png)}#ca-unwatch.icon a{background-position:-43px 60%}#ca-watch.icon a{background-position:5px 60%}#ca-unwatch.icon a:hover,#ca-unwatch.icon a:focus{background-position:-67px 60%}#ca-watch.icon a:hover,#ca-watch.icon a:focus{background-position:-19px 60%}#ca-unwatch.icon a.loading,#ca-watch.icon a.loading{background-image:url(images/watch-icon-loading.gif);background-position:5px 60%}#ca-unwatch.icon a span,#ca-watch.icon a span{display:none}div.vectorTabs ul{background-image:url(images/tab-break.png);background-position:right bottom;background-repeat:no-repeat}.tipsy{font-size:.8em}.mw-content-ltr{direction:ltr}.mw-content-rtl{direction:rtl}.sitedir-ltr textarea,.sitedir-ltr input{direction:ltr}.sitedir-rtl textarea,.sitedir-rtl input{direction:rtl}input[type="submit"],input[type="button"],input[type="reset"],input[type="file"]{direction:ltr}textarea[dir="ltr"],input[dir="ltr"]{direction:ltr}textarea[dir="rtl"],input[dir="rtl"]{direction:rtl}abbr,acronym,.explain{border-bottom:1px dotted;cursor:help}.mw-plusminus-pos{color:#006400}.mw-plusminus-neg{color:#8b0000}.mw-plusminus-null{color:#aaa}.allpagesredirect,.redirect-in-category,.watchlistredir{font-style:italic}span.comment{font-style:italic}span.changedby{font-size:95%}.texvc{direction:ltr;unicode-bidi:embed}img.tex{vertical-align:middle}span.texhtml{font-family:serif}#wikiPreview.ontop{margin-bottom:1em}#editform,#toolbar,#wpTextbox1{clear:both}#toolbar img{cursor:pointer}div#mw-js-message{margin:1em 5%;padding:.5em 2.5%;border:solid 1px #ddd;background-color:#fcfcfc}.editsection{float:right;margin-left:5px}.mw-content-ltr .editsection,.mw-content-rtl .mw-content-ltr .editsection{float:right}.mw-content-rtl .editsection,.mw-content-ltr .mw-content-rtl .editsection{float:left}div.mw-filepage-resolutioninfo{font-size:smaller}h2#filehistory{clear:both}table.filehistory th,table.filehistory td{vertical-align:top}table.filehistory th{text-align:left}table.filehistory td.mw-imagepage-filesize,table.filehistory th.mw-imagepage-filesize{white-space:nowrap}table.filehistory td.filehistory-selected{font-weight:bold}.filehistory a img,#file img:hover{background:white url(images/Checker-16x16.png) repeat}li span.deleted,span.history-deleted{text-decoration:line-through;color:#888;font-style:italic}.not-patrolled{background-color:#ffa}.unpatrolled{font-weight:bold;color:red}div.patrollink{font-size:75%;text-align:right}td.mw-label{text-align:right}td.mw-input{text-align:left}td.mw-submit{text-align:left}td.mw-label{vertical-align:top}.prefsection td.mw-label{width:20%}.prefsection table{width:100%}td.mw-submit{white-space:nowrap}table.mw-htmlform-nolabel td.mw-label{width:1px}tr.mw-htmlform-vertical-label td.mw-label{text-align:left!important}.mw-htmlform-invalid-input td.mw-input input{border-color:red}.mw-htmlform-flatlist div.mw-htmlform-flatlist-item{display:inline;margin-right:1em;white-space:nowrap}input#wpSummary{width:80%}.thumbcaption{text-align:left}.magnify{float:right}#catlinks{text-align:left}.catlinks ul{display:inline;margin:0;padding:0;list-style:none;list-style-type:none;list-style-image:none;vertical-align:middle!ie}.catlinks li{display:inline-block;line-height:1.25em;border-left:1px solid #AAA;margin:.125em 0;padding:0 .5em;zoom:1;display:inline!ie}.catlinks li:first-child{padding-left:.25em;border-left:none}.mw-hidden-cats-hidden{display:none}.catlinks-allhidden{display:none}p.mw-ipb-conveniencelinks,p.mw-protect-editreasons,p.mw-filedelete-editreasons,p.mw-delete-editreasons,p.mw-revdel-editreasons{font-size:90%;text-align:right}.os-suggest{overflow:auto;overflow-x:hidden;position:absolute;top:0;left:0;width:0;background-color:white;border-style:solid;border-color:#AAA;border-width:1px;z-index:99;font-size:95%}table.os-suggest-results{font-size:95%;cursor:pointer;border:0;border-collapse:collapse;width:100%}.os-suggest-result,.os-suggest-result-hl{white-space:nowrap;background-color:white;color:black;padding:2px}.os-suggest-result-hl,.os-suggest-result-hl-webkit{background-color:#4C59A6;color:white}.os-suggest-toggle{position:relative;left:1ex;font-size:65%}.os-suggest-toggle-def{position:absolute;top:0;left:0;font-size:65%;visibility:hidden}.autocomment{color:gray}#pagehistory .history-user{margin-left:.4em;margin-right:.2em}#pagehistory span.minor{font-weight:bold}#pagehistory li{border:1px solid white}#pagehistory li.selected{background-color:#f9f9f9;border:1px dashed #aaa}.mw-history-revisiondelete-button,#mw-fileduplicatesearch-icon{float:right}.newpage,.minoredit,.botedit{font-weight:bold}#shared-image-dup,#shared-image-conflict{font-style:italic}div.mw-warning-with-logexcerpt{padding:3px;margin-bottom:3px;border:2px solid #2F6FAB;clear:both}div.mw-warning-with-logexcerpt ul li{font-size:90%}span.mw-revdelundel-link,strong.mw-revdelundel-link{font-size:90%}span.mw-revdelundel-hidden,input.mw-revdelundel-hidden{visibility:hidden}td.mw-revdel-checkbox,th.mw-revdel-checkbox{padding-right:10px;text-align:center}a.feedlink{background:url(images/feed-icon.png) center left no-repeat;padding-left:16px}.plainlinks a{background:none!important;padding:0!important}.rtl a.external.free,.rtl a.external.autonumber{direction:ltr;unicode-bidi:embed}table.wikitable{margin:1em 1em 1em 0;background-color:#f9f9f9;border:1px #aaa solid;border-collapse:collapse;color:black}table.wikitable>tr>th,table.wikitable>tr>td,table.wikitable>*>tr>th,table.wikitable>*>tr>td{border:1px #aaa solid;padding:.2em}table.wikitable>tr>th,table.wikitable>*>tr>th{background-color:#f2f2f2;text-align:center}table.wikitable>caption{font-weight:bold}table.collapsed tr.collapsable{display:none}.success{color:green;font-size:larger}.warning{color:#FFA500;font-size:larger}.error{color:red;font-size:larger}.errorbox,.warningbox,.successbox{font-size:larger;border:2px solid;padding:.5em 1em;float:left;margin-bottom:2em;color:#000}.errorbox{border-color:red;background-color:#fff2f2}.warningbox{border-color:#FF8C00;background-color:#FFFFC0}.successbox{border-color:green;background-color:#dfd}.errorbox h2,.warningbox h2,.successbox h2{font-size:1em;font-weight:bold;display:inline;margin:0 .5em 0 0;border:none}.mw-infobox{border:2px solid #ff7f00;margin:.5em;clear:left;overflow:hidden}.mw-infobox-left{margin:7px;float:left;width:35px}.mw-infobox-right{margin:.5em .5em .5em 49px}.previewnote{color:#c00;margin-bottom:1em}.previewnote p{text-indent:3em;margin:.8em 0}.visualClear{clear:both}#mw_trackbacks{border:solid 1px #bbf;background-color:#eef;padding:.2em}.mw-datatable{border-collapse:collapse}.mw-datatable,.mw-datatable td,.mw-datatable th{border:1px solid #aaa;padding:0 .15em 0 .15em}.mw-datatable th{background-color:#ddf}.mw-datatable td{background-color:#fff}.mw-datatable tr:hover td{background-color:#eef}.TablePager{min-width:80%}.TablePager_nav{margin:0 auto}.TablePager_nav td{padding:3px;text-align:center}.TablePager_nav a{text-decoration:none}.imagelist td,.imagelist th{white-space:nowrap}.imagelist .TablePager_col_links{background-color:#eef}.imagelist .TablePager_col_img_description{white-space:normal}.imagelist th.TablePager_sort{background-color:#ccf}ul#filetoc{text-align:center;border:1px solid #aaa;background-color:#f9f9f9;padding:5px;font-size:95%;margin-bottom:.5em;margin-left:0;margin-right:0}#filetoc li{display:inline;list-style-type:none;padding-right:2em}table.mw_metadata{font-size:.8em;margin-left:.5em;margin-bottom:.5em;width:400px}table.mw_metadata caption{font-weight:bold}table.mw_metadata th{font-weight:normal}table.mw_metadata td{padding:.1em}table.mw_metadata{border:none;border-collapse:collapse}table.mw_metadata td,table.mw_metadata th{text-align:center;border:1px solid #aaa;padding-left:5px;padding-right:5px}table.mw_metadata th{background-color:#f9f9f9}table.mw_metadata td{background-color:#fcfcfc}table.mw_metadata ul.metadata-langlist{list-style-type:none;list-style-image:none;padding-right:5px;padding-left:5px;margin:0}.mw-content-ltr ul,.mw-content-rtl .mw-content-ltr ul{margin:.3em 0 0 1.6em;padding:0}.mw-content-rtl ul,.mw-content-ltr .mw-content-rtl ul{margin:.3em 1.6em 0 0;padding:0}.mw-content-ltr ol,.mw-content-rtl .mw-content-ltr ol{margin:.3em 0 0 3.2em;padding:0}.mw-content-rtl ol,.mw-content-ltr .mw-content-rtl ol{margin:.3em 3.2em 0 0;padding:0}.mw-content-ltr dd,.mw-content-rtl .mw-content-ltr dd{margin-left:1.6em;margin-right:0}.mw-content-rtl dd,.mw-content-ltr .mw-content-rtl dd{margin-right:1.6em;margin-left:0}li.gallerybox{vertical-align:top;border:solid 2px white;display:-moz-inline-box;display:inline-block}ul.gallery,li.gallerybox{zoom:1;*display:inline}ul.gallery{margin:2px;padding:2px;display:block}li.gallerycaption{font-weight:bold;text-align:center;display:block;word-wrap:break-word}li.gallerybox div.thumb{text-align:center;border:1px solid #ccc;background-color:#f9f9f9;margin:2px}li.gallerybox div.thumb img{display:block;margin:0 auto}div.gallerytext{overflow:hidden;font-size:94%;padding:2px 4px;word-wrap:break-word}.mw-ajax-loader{background-image:url(images/ajax-loader.gif);background-position:center center;background-repeat:no-repeat;padding:16px;position:relative;top:-16px}.mw-small-spinner{padding:10px!important;margin-right:.6em;background-image:url(images/spinner.gif);background-position:center center;background-repeat:no-repeat}h1:lang(as),h1:lang(bh),h1:lang(bho),h1:lang(bn),h1:lang(gu),h1:lang(hi),h1:lang(kn),h1:lang(ml),h1:lang(mr),h1:lang(or),h1:lang(pa),h1:lang(sa),h1:lang(ta),h1:lang(te){line-height:1.5em!important}h2:lang(as),h3:lang(as),h4:lang(as),h5:lang(as),h6:lang(as),h2:lang(bho),h3:lang(bho),h4:lang(bho),h5:lang(bho),h6:lang(bho),h2:lang(bh),h3:lang(bh),h4:lang(bh),h5:lang(bh),h6:lang(bh),h2:lang(bn),h3:lang(bn),h4:lang(bn),h5:lang(bn),h6:lang(bn),h2:lang(gu),h3:lang(gu),h4:lang(gu),h5:lang(gu),h6:lang(gu),h2:lang(hi),h3:lang(hi),h4:lang(hi),h5:lang(hi),h6:lang(hi),h2:lang(kn),h3:lang(kn),h4:lang(kn),h5:lang(kn),h6:lang(kn),h2:lang(ml),h3:lang(ml),h4:lang(ml),h5:lang(ml),h6:lang(ml),h2:lang(mr),h3:lang(mr),h4:lang(mr),h5:lang(mr),h6:lang(mr),h2:lang(or),h3:lang(or),h4:lang(or),h5:lang(or),h6:lang(or),h2:lang(pa),h3:lang(pa),h4:lang(pa),h5:lang(pa),h6:lang(pa),h2:lang(sa),h3:lang(sa),h4:lang(sa),h5:lang(sa),h6:lang(sa),h2:lang(ta),h3:lang(ta),h4:lang(ta),h5:lang(ta),h6:lang(ta),h2:lang(te),h3:lang(te),h4:lang(te),h5:lang(te),h6:lang(te){line-height:1.2em}ol:lang(bcc) li,ol:lang(bqi) li,ol:lang(fa) li,ol:lang(glk) li,ol:lang(kk-arab) li,ol:lang(mzn) li{list-style-type:-moz-persian;list-style-type:persian}ol:lang(ckb) li{list-style-type:-moz-arabic-indic;list-style-type:arabic-indic}ol:lang(hi) li,ol:lang(mr) li{list-style-type:-moz-devanagari;list-style-type:devanagari}ol:lang(as) li,ol:lang(bn) li{list-style-type:-moz-bengali;list-style-type:bengali}ol:lang(or) li{list-style-type:-moz-oriya;list-style-type:oriya}#toc ul,.toc ul{margin:.3em 0}.mw-content-ltr .toc ul,.mw-content-ltr #toc ul,.mw-content-rtl .mw-content-ltr .toc ul,.mw-content-rtl .mw-content-ltr #toc ul{text-align:left}.mw-content-rtl .toc ul,.mw-content-rtl #toc ul,.mw-content-ltr .mw-content-rtl .toc ul,.mw-content-ltr .mw-content-rtl #toc ul{text-align:right}.mw-content-ltr .toc ul ul,.mw-content-ltr #toc ul ul,.mw-content-rtl .mw-content-ltr .toc ul ul,.mw-content-rtl .mw-content-ltr #toc ul ul{margin:0 0 0 2em}.mw-content-rtl .toc ul ul,.mw-content-rtl #toc ul ul,.mw-content-ltr .mw-content-rtl .toc ul ul,.mw-content-ltr .mw-content-rtl #toc ul ul{margin:0 2em 0 0}#toc #toctitle,.toc #toctitle,#toc .toctitle,.toc .toctitle{direction:ltr}.mw-help-field-hint{display:none;margin-left:2px;margin-bottom:-8px;padding:0 0 0 15px;background-image:url('images/help-question.gif');background-position:left center;background-repeat:no-repeat;cursor:pointer;font-size:.8em;text-decoration:underline;color:#0645ad}.mw-help-field-hint:hover{background-image:url('images/help-question-hover.gif')}.mw-help-field-data{display:block;background-color:#d6f3ff;padding:5px 8px 4px 8px;border:1px solid #5dc9f4;margin-left:20px}.tipsy{padding:5px 5px 10px;font-size:12px;position:absolute;z-index:100000;overflow:visible}.tipsy-inner{padding:5px 8px 4px 8px;background-color:#d6f3ff;color:black;border:1px solid #5dc9f4;max-width:300px;text-align:left}.tipsy-arrow{position:absolute;background:url(images/tipsy-arrow.gif) no-repeat top left;width:13px;height:13px}.tipsy-se .tipsy-arrow{bottom:-2px;right:10px;background-position:0 100%}#mw-clearyourcache,#mw-sitecsspreview,#mw-sitejspreview,#mw-usercsspreview,#mw-userjspreview{direction:ltr;unicode-bidi:embed}.diff-currentversion-title,.diff{direction:ltr;unicode-bidi:embed}.diff-contentalign-right td{direction:rtl;unicode-bidi:embed}.diff-contentalign-left td{direction:ltr;unicode-bidi:embed}.diff-otitle,.diff-ntitle,.diff-lineno{direction:ltr!important;unicode-bidi:embed}#mw-revision-info,#mw-revision-info-current,#mw-revision-nav{direction:ltr;display:inline}div.tright,div.floatright,table.floatright{clear:right;float:right}div.tleft,div.floatleft,table.floatleft{float:left;clear:left}div.floatright,table.floatright,div.floatleft,table.floatleft{position:relative}#mw-credits a{unicode-bidi:embed}.mw-jump,#jump-to-nav{overflow:hidden;height:0;zoom:1}.printfooter{display:none}.xdebug-error{position:absolute;z-index:99}.editsection,.toctoggle{-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none}a.stub,a.new{color:#ba0000;text-decoration:none}#toc{border:1px solid #aaa;background-color:#f9f9f9;padding:5px}div.floatright{float:right;clear:right;position:relative;margin:.5em 0 .8em 1.4em}div.floatright p{font-style:italic}div.floatleft{float:left;clear:left;position:relative;margin:.5em 1.4em .8em 0}div.floatleft p{font-style:italic}div.center{text-align:center}div.thumb{border:none;width:auto;margin-top:.5em;margin-bottom:.8em;background-color:transparent}div.thumbinner{border:1px solid #ccc;padding:3px!important;background-color:White;font-size:94%;text-align:center;overflow:hidden}html .thumbimage{border:1px solid #ccc}html .thumbcaption{border:none;text-align:left;line-height:1.4em;padding:3px!important;font-size:94%}div.magnify{display:none}div.tright{float:right;clear:right;margin:.5em 0 .8em 1.4em}div.tleft{float:left;clear:left;margin:.5em 1.4em .8em 0}img.thumbborder{border:1px solid #ddd}table.rimage{float:right;width:1pt;position:relative;margin-left:1em;margin-bottom:1em;text-align:center}body{background:white;color:black;margin:0;padding:0}.noprint,div#jump-to-nav,.mw-jump,div.top,div#column-one,#colophon,.editsection,.toctoggle,.tochidden,div#f-poweredbyico,div#f-copyrightico,li#viewcount,li#about,li#disclaimer,li#mobileview,li#privacy,#footer-places,.mw-hidden-catlinks,tr.mw-metadata-show-hide-extended,span.mw-filepage-other-resolutions,#filetoc{display:none}ul{list-style-type:square}#content{background:none;border:none!important;padding:0!important;margin:0!important;direction:ltr}#footer{background:white;color:black;margin-top:1em;border-top:1px solid #AAA;direction:ltr}h1,h2,h3,h4,h5,h6{font-weight:bold}p{margin:1em 0;line-height:1.2em}pre{border:1pt dashed black;white-space:pre;font-size:8pt;overflow:auto;padding:1em 0;background:white;color:black}table.listing,table.listing td{border:1pt solid black;border-collapse:collapse}a{color:black!important;background:none!important;padding:0!important}a:link,a:visited{color:#520;background:transparent;text-decoration:underline}#content a.external.text:after,#content a.external.autonumber:after{content:"(" attr(href) ") "}#globalWrapper{width:100%!important;min-width:0!important}#content{background:white;color:black}#column-content{margin:0!important}#column-content #content{padding:1em;margin:0!important}a,a.external,a.new,a.stub{color:black!important;text-decoration:none!important}a,a.external,a.new,a.stub{color:inherit!important;text-decoration:inherit!important}img{border:none;vertical-align:middle}span.texhtml{font-family:serif}#siteNotice{display:none}li.gallerybox{vertical-align:top;border:solid 2px white;display:-moz-inline-box;display:inline-block}ul.gallery,li.gallerybox{zoom:1;*display:inline}ul.gallery{margin:2px;padding:2px;display:block}li.gallerycaption{font-weight:bold;text-align:center;display:block;word-wrap:break-word}li.gallerybox div.thumb{text-align:center;border:1px solid #ccc;margin:2px}div.gallerytext{overflow:hidden;font-size:94%;padding:2px 4px;word-wrap:break-word}table.diff{background:white}td.diff-otitle{background:#fff}td.diff-ntitle{background:#fff}td.diff-addedline{background:#cfc;font-size:smaller;border:solid 2px black}td.diff-deletedline{background:#ffa;font-size:smaller;border:dotted 2px black}td.diff-context{background:#eee;font-size:smaller}.diffchange{color:silver;font-weight:bold;text-decoration:underline}table.wikitable,table.mw_metadata{margin:1em 1em 1em 0;border:1px #aaa solid;background:white;border-collapse:collapse}table.wikitable>tr>th,table.wikitable>tr>td,table.wikitable>*>tr>th,table.wikitable>*>tr>td,.mw_metadata th,.mw_metadata td{border:1px #aaa solid;padding:.2em}table.wikitable>tr>th,table.wikitable>*>tr>th,.mw_metadata th{text-align:center;background:white;font-weight:bold}table.wikitable>caption,.mw_metadata caption{font-weight:bold}a.sortheader{margin:0 .3em}.wikitable,.thumb,img{page-break-inside:avoid}h2,h3,h4,h5,h6,h7{page-break-after:avoid}p{widows:3;orphans:3}.catlinks ul{display:inline;margin:0;padding:0;list-style:none;list-style-type:none;list-style-image:none;vertical-align:middle!ie}.catlinks li{display:inline-block;line-height:1.15em;padding:0 .4em;border-left:1px solid #AAA;margin:.1em 0;zoom:1;display:inline!ie}.catlinks li:first-child{padding-left:.2em;border-left:none}dfn{font-style:inherit}sup,sub{line-height:1em}#interwiki-completelist{font-weight:bold}body.page-Main_Page #ca-delete{display:none!important}body.page-Main_Page #mp-topbanner{clear:both}#toolbar{height:22px;margin-bottom:6px}body.action-info :target{background:#DEF}ol.references,div.reflist,div.refbegin{font-size:90%;margin-bottom:.5em}div.refbegin-100{font-size:100%}div.reflist ol.references{font-size:100%;list-style-type:inherit}div.columns{margin-top:.3em}div.columns dl,div.columns ol,div.columns ul{margin-top:0}div.columns li,div.columns dd dd{-webkit-column-break-inside:avoid;page-break-inside:avoid;break-inside:avoid-column}ol.references li:target,sup.reference:target,span.citation:target{background-color:#DEF}sup.reference{font-weight:normal;font-style:normal}span.brokenref{display:none}.citation{word-wrap:break-word}@media screen,handheld{.citation *.printonly{display:none}}.flowlist ul{overflow-x:hidden;margin-left:0;padding-left:1.6em}.flowlist ol{overflow-x:hidden;margin-left:0;padding-left:3.2em}.flowlist dl{overflow-x:hidden}.hlist dl,.hlist ol,.hlist ul{margin:0;padding:0}.hlist dd,.hlist dt,.hlist li{margin:0;display:inline}.hlist dl dl,.hlist dl ol,.hlist dl ul,.hlist ol dl,.hlist ol ol,.hlist ol ul,.hlist ul dl,.hlist ul ol,.hlist ul ul{display:inline}.hlist dt:after{content:":"}.hlist dd:after,.hlist li:after{content:" · ";font-weight:bold}.hlist dd:last-child:after,.hlist dt:last-child:after,.hlist li:last-child:after{content:none}.hlist dd.hlist-last-child:after,.hlist dt.hlist-last-child:after,.hlist li.hlist-last-child:after{content:none}.hlist dd dd:first-child:before,.hlist dd dt:first-child:before,.hlist dd li:first-child:before,.hlist dt dd:first-child:before,.hlist dt dt:first-child:before,.hlist dt li:first-child:before,.hlist li dd:first-child:before,.hlist li dt:first-child:before,.hlist li li:first-child:before{content:"(";font-weight:normal}.hlist dd dd:last-child:after,.hlist dd dt:last-child:after,.hlist dd li:last-child:after,.hlist dt dd:last-child:after,.hlist dt dt:last-child:after,.hlist dt li:last-child:after,.hlist li dd:last-child:after,.hlist li dt:last-child:after,.hlist li li:last-child:after{content:") ";font-weight:normal}.hlist dd dd.hlist-last-child:after,.hlist dd dt.hlist-last-child:after,.hlist dd li.hlist-last-child:after,.hlist dt dd.hlist-last-child:after,.hlist dt dt.hlist-last-child:after,.hlist dt li.hlist-last-child:after,.hlist li dd.hlist-last-child:after,.hlist li dt.hlist-last-child:after,.hlist li li.hlist-last-child:after{content:") ";font-weight:normal}.hlist ol{counter-reset:listitem}.hlist ol>li{counter-increment:listitem}.hlist ol>li:before{content:" " counter(listitem) " "}.hlist dd ol>li:first-child:before,.hlist dt ol>li:first-child:before,.hlist li ol>li:first-child:before{content:"(" counter(listitem) " "}.plainlist ul{line-height:inherit;list-style:none none;margin:0}.plainlist ul li{margin-bottom:0}.navbox{border:1px solid #aaa;width:100%;margin:auto;clear:both;font-size:88%;text-align:center;padding:1px}.navbox-inner,.navbox-subgroup{width:100%}.navbox-group,.navbox-title,.navbox-abovebelow{padding:.25em 1em;line-height:1.5em;text-align:center}th.navbox-group{white-space:nowrap;text-align:right}.navbox,.navbox-subgroup{background:#fdfdfd}.navbox-list{line-height:1.8em;border-color:#fdfdfd}.navbox th,.navbox-title{background:#ccf}.navbox-abovebelow,th.navbox-group,.navbox-subgroup .navbox-title{background:#ddf}.navbox-subgroup .navbox-group,.navbox-subgroup .navbox-abovebelow{background:#e6e6ff}.navbox-even{background:#f7f7f7}.navbox-odd{background:transparent}table.navbox+table.navbox{margin-top:-1px}.navbox .hlist td dl,.navbox .hlist td ol,.navbox .hlist td ul,.navbox td.hlist dl,.navbox td.hlist ol,.navbox td.hlist ul{padding:.125em 0}ol+table.navbox,ul+table.navbox{margin-top:.5em}.navbar{display:inline;font-size:88%;font-weight:normal}.navbar ul{display:inline;white-space:nowrap}.navbar li{word-spacing:-0.125em}.navbar.mini li span{font-variant:small-caps}.infobox .navbar{font-size:100%}.navbox .navbar{display:block;font-size:100%}.navbox-title .navbar{float:left;text-align:left;margin-right:.5em;width:6em}.collapseButton{float:right;font-weight:normal;margin-left:.5em;text-align:right;width:auto}.navbox .collapseButton{width:6em}.mw-collapsible-toggle{font-weight:normal;text-align:right}.navbox .mw-collapsible-toggle{width:6em}.infobox{border:1px solid #aaa;background-color:#f9f9f9;color:black;margin:.5em 0 .5em 1em;padding:.2em;float:right;clear:right;text-align:left;font-size:88%;line-height:1.5em}.infobox caption{font-size:125%;font-weight:bold}.infobox td,.infobox th{vertical-align:top}.infobox.bordered{border-collapse:collapse}.infobox.bordered td,.infobox.bordered th{border:1px solid #aaa}.infobox.bordered .borderless td,.infobox.bordered .borderless th{border:0}.infobox.sisterproject{width:20em;font-size:90%}.infobox.standard-talk{border:1px solid #c0c090;background-color:#f8eaba}.infobox.standard-talk.bordered td,.infobox.standard-talk.bordered th{border:1px solid #c0c090}.infobox.bordered .mergedtoprow td,.infobox.bordered .mergedtoprow th{border:0;border-top:1px solid #aaa;border-right:1px solid #aaa}.infobox.bordered .mergedrow td,.infobox.bordered .mergedrow th{border:0;border-right:1px solid #aaa}.infobox.geography{border-collapse:collapse;line-height:1.2em;font-size:90%}.infobox.geography td,.infobox.geography th{border-top:1px solid #aaa;padding:.4em .6em .4em .6em}.infobox.geography .mergedtoprow td,.infobox.geography .mergedtoprow th{border-top:1px solid #aaa;padding:.4em .6em .2em .6em}.infobox.geography .mergedrow td,.infobox.geography .mergedrow th{border:0;padding:0 .6em .2em .6em}.infobox.geography .mergedbottomrow td,.infobox.geography .mergedbottomrow th{border-top:0;border-bottom:1px solid #aaa;padding:0 .6em .4em .6em}.infobox.geography .maptable td,.infobox.geography .maptable th{border:0;padding:0}.wikitable.plainrowheaders th[scope=row]{font-weight:normal;text-align:left}.wikitable td ul,.wikitable td ol,.wikitable td dl{text-align:left}.wikitable.hlist td ul,.wikitable.hlist td ol,.wikitable.hlist td dl{text-align:inherit}div.listenlist{background:url("//upload.wikimedia.org/wikipedia/commons/4/47/Sound-icon.svg") no-repeat scroll 0 0 transparent;background-size:30px;padding-left:40px}table.mw-hiero-table td{vertical-align:middle}div.medialist{min-height:50px;margin:1em;background-position:top left;background-repeat:no-repeat}div.medialist ul{list-style-type:none;list-style-image:none;margin:0}div.medialist ul li{padding-bottom:.5em}div.medialist ul li li{font-size:91%;padding-bottom:0}div#content a[href$=".pdf"].external,div#content a[href*=".pdf?"].external,div#content a[href*=".pdf#"].external,div#content a[href$=".PDF"].external,div#content a[href*=".PDF?"].external,div#content a[href*=".PDF#"].external,div#mw_content a[href$=".pdf"].external,div#mw_content a[href*=".pdf?"].external,div#mw_content a[href*=".pdf#"].external,div#mw_content a[href$=".PDF"].external,div#mw_content a[href*=".PDF?"].external,div#mw_content a[href*=".PDF#"].external{background:url("//upload.wikimedia.org/wikipedia/commons/2/23/Icons-mini-file_acrobat.gif") no-repeat right;padding-right:18px}div#content span.PDFlink a,div#mw_content span.PDFlink a{background:url("//upload.wikimedia.org/wikipedia/commons/2/23/Icons-mini-file_acrobat.gif") no-repeat right;padding-right:18px}div.columns-2 div.column{float:left;width:50%;min-width:300px}div.columns-3 div.column{float:left;width:33.3%;min-width:200px}div.columns-4 div.column{float:left;width:25%;min-width:150px}div.columns-5 div.column{float:left;width:20%;min-width:120px}.messagebox{border:1px solid #aaa;background-color:#f9f9f9;width:80%;margin:0 auto 1em auto;padding:.2em}.messagebox.merge{border:1px solid #c0b8cc;background-color:#f0e5ff;text-align:center}.messagebox.cleanup{border:1px solid #9f9fff;background-color:#efefff;text-align:center}.messagebox.standard-talk{border:1px solid #c0c090;background-color:#f8eaba;margin:4px auto}.mbox-inside .standard-talk,.messagebox.nested-talk{border:1px solid #c0c090;background-color:#f8eaba;width:100%;margin:2px 0;padding:2px}.messagebox.small{width:238px;font-size:85%;float:right;clear:both;margin:0 0 1em 1em;line-height:1.25em}.messagebox.small-talk{width:238px;font-size:85%;float:right;clear:both;margin:0 0 1em 1em;line-height:1.25em;background:#F8EABA}th.mbox-text,td.mbox-text{border:none;padding:.25em .9em;width:100%}td.mbox-image{border:none;padding:2px 0 2px .9em;text-align:center}td.mbox-imageright{border:none;padding:2px .9em 2px 0;text-align:center}td.mbox-empty-cell{border:none;padding:0;width:1px}table.ambox{margin:0 10%;border:1px solid #aaa;border-left:10px solid #1e90ff;background:#fbfbfb}table.ambox+table.ambox{margin-top:-1px}.ambox th.mbox-text,.ambox td.mbox-text{padding:.25em .5em}.ambox td.mbox-image{padding:2px 0 2px .5em}.ambox td.mbox-imageright{padding:2px .5em 2px 0}table.ambox-notice{border-left:10px solid #1e90ff}table.ambox-speedy{border-left:10px solid #b22222;background:#fee}table.ambox-delete{border-left:10px solid #b22222}table.ambox-content{border-left:10px solid #f28500}table.ambox-style{border-left:10px solid #f4c430}table.ambox-move{border-left:10px solid #9932cc}table.ambox-protection{border-left:10px solid #bba}table.imbox{margin:4px 10%;border-collapse:collapse;border:3px solid #1e90ff;background:#fbfbfb}.imbox .mbox-text .imbox{margin:0 -0.5em;display:block}.mbox-inside .imbox{margin:4px}table.imbox-notice{border:3px solid #1e90ff}table.imbox-speedy{border:3px solid #b22222;background:#fee}table.imbox-delete{border:3px solid #b22222}table.imbox-content{border:3px solid #f28500}table.imbox-style{border:3px solid #f4c430}table.imbox-move{border:3px solid #9932cc}table.imbox-protection{border:3px solid #bba}table.imbox-license{border:3px solid #88a;background:#f7f8ff}table.imbox-featured{border:3px solid #cba135}table.cmbox{margin:3px 10%;border-collapse:collapse;border:1px solid #aaa;background:#DFE8FF}table.cmbox-notice{background:#D8E8FF}table.cmbox-speedy{margin-top:4px;margin-bottom:4px;border:4px solid #b22222;background:#FFDBDB}table.cmbox-delete{background:#FFDBDB}table.cmbox-content{background:#FFE7CE}table.cmbox-style{background:#FFF9DB}table.cmbox-move{background:#E4D8FF}table.cmbox-protection{background:#EFEFE1}table.ombox{margin:4px 10%;border-collapse:collapse;border:1px solid #aaa;background:#f9f9f9}table.ombox-notice{border:1px solid #aaa}table.ombox-speedy{border:2px solid #b22222;background:#fee}table.ombox-delete{border:2px solid #b22222}table.ombox-content{border:1px solid #f28500}table.ombox-style{border:1px solid #f4c430}table.ombox-move{border:1px solid #9932cc}table.ombox-protection{border:2px solid #bba}table.tmbox{margin:4px 10%;border-collapse:collapse;border:1px solid #c0c090;background:#f8eaba}.mediawiki .mbox-inside .tmbox{margin:2px 0;width:100%}.mbox-inside .tmbox.mbox-small{line-height:1.5em;font-size:100%}table.tmbox-speedy{border:2px solid #b22222;background:#fee}table.tmbox-delete{border:2px solid #b22222}table.tmbox-content{border:2px solid #f28500}table.tmbox-style{border:2px solid #f4c430}table.tmbox-move{border:2px solid #9932cc}table.tmbox-protection,table.tmbox-notice{border:1px solid #c0c090}table.dmbox{clear:both;margin:.9em 1em;border-top:1px solid #ccc;border-bottom:1px solid #ccc;background:transparent}table.fmbox{clear:both;margin:.2em 0;width:100%;border:1px solid #aaa;background:#f9f9f9}table.fmbox-system{background:#f9f9f9}table.fmbox-warning{border:1px solid #bb7070;background:#ffdbdb}table.fmbox-editnotice{background:transparent}div.mw-warning-with-logexcerpt,div.mw-lag-warn-high,div.mw-cascadeprotectedwarning,div#mw-protect-cascadeon{clear:both;margin:.2em 0;border:1px solid #bb7070;background:#ffdbdb;padding:.25em .9em}div.mw-lag-warn-normal,div.fmbox-system{clear:both;margin:.2em 0;border:1px solid #aaa;background:#f9f9f9;padding:.25em .9em}body.mediawiki table.mbox-small{clear:right;float:right;margin:4px 0 4px 1em;width:238px;font-size:88%;line-height:1.25em}body.mediawiki table.mbox-small-left{margin:4px 1em 4px 0;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.compact-ambox table .mbox-image,.compact-ambox table .mbox-imageright,.compact-ambox table .mbox-empty-cell{display:none}.compact-ambox table.ambox{border:none;border-collapse:collapse;background:transparent;margin:0 0 0 1.6em!important;padding:0!important;width:auto;display:block}body.mediawiki .compact-ambox table.mbox-small-left{font-size:100%;width:auto;margin:0}.compact-ambox table .mbox-text{padding:0!important;margin:0!important}.compact-ambox table .mbox-text-span{display:list-item;line-height:1.5em;list-style-type:square;list-style-image:url(//bits.wikimedia.org/skins/common/images/bullet.gif)}.skin-vector .compact-ambox table .mbox-text-span{list-style-type:circle;list-style-image:url(//bits.wikimedia.org/skins/vector/images/bullet-icon.png)}.compact-ambox .hide-when-compact{display:none}div.noarticletext{border:none;background:transparent;padding:0}.visualhide{position:absolute;left:-10000px;top:auto;width:1px;height:1px;overflow:hidden}#wpSave{font-weight:bold}.hiddenStructure{display:inline!important;color:#f00;background-color:#0f0}.check-icon a.new{display:none;speak:none}.nounderlines a,.IPA a:link,.IPA a:visited{text-decoration:none!important}div.NavFrame{margin:0;padding:4px;border:1px solid #aaa;text-align:center;border-collapse:collapse;font-size:95%}div.NavFrame+div.NavFrame{border-top-style:none;border-top-style:hidden}div.NavPic{background-color:#fff;margin:0;padding:2px;float:left}div.NavFrame div.NavHead{height:1.6em;font-weight:bold;background-color:#ccf;position:relative}div.NavFrame p,div.NavFrame div.NavContent,div.NavFrame div.NavContent p{font-size:100%}div.NavEnd{margin:0;padding:0;line-height:1px;clear:both}a.NavToggle{position:absolute;top:0;right:3px;font-weight:normal;font-size:90%}.rellink,.dablink{font-style:italic;padding-left:1.6em;margin-bottom:.5em}.rellink i,.dablink i{font-style:normal}.listify td{display:list-item}.listify tr{display:block}.listify table{display:block}.geo-default,.geo-dms,.geo-dec{display:inline}.geo-nondefault,.geo-multi-punct{display:none}.longitude,.latitude{white-space:nowrap}.nonumtoc .tocnumber{display:none}.nonumtoc #toc ul,.nonumtoc .toc ul{line-height:1.5em;list-style:none none;margin:.3em 0 0;padding:0}.nonumtoc #toc ul ul,.nonumtoc .toc ul ul{margin:0 0 0 2em}.toclimit-2 .toclevel-1 ul,.toclimit-3 .toclevel-2 ul,.toclimit-4 .toclevel-3 ul,.toclimit-5 .toclevel-4 ul,.toclimit-6 .toclevel-5 ul,.toclimit-7 .toclevel-6 ul{display:none}blockquote.templatequote{margin-top:0}blockquote.templatequote div.templatequotecite{line-height:1em;text-align:left;padding-left:2em;margin-top:0}blockquote.templatequote div.templatequotecite cite{font-size:85%}div.user-block{padding:5px;margin-bottom:.5em;border:1px solid #A9A9A9;background-color:#FFEFD5}.nowrap,.nowraplinks a,.nowraplinks .selflink,sup.reference a{white-space:nowrap}.wrap,.wraplinks a{white-space:normal}.template-documentation{clear:both;margin:1em 0 0 0;border:1px solid #aaa;background-color:#ecfcf4;padding:1em}.imagemap-inline div{display:inline}#wpUploadDescription{height:13em}.thumbinner{min-width:100px}div.thumb .thumbimage{background-color:#fff}div#content .gallerybox div.thumb{background-color:#F9F9F9}.gallerybox .thumb img{background:#fff url(//bits.wikimedia.org/skins/common/images/Checker-16x16.png) repeat}.ns-0 .gallerybox .thumb img,.ns-2 .gallerybox .thumb img,.ns-100 .gallerybox .thumb img,.nochecker .gallerybox .thumb img{background:#fff}#mw-subcategories,#mw-pages,#mw-category-media,#filehistory,#wikiPreview,#wikiDiff{clear:both}body.rtl #mw-articlefeedbackv5,body.rtl #mw-articlefeedback{display:block;margin-bottom:1em;clear:right;float:right}.wpb .wpb-header{display:none}.wpbs-inner .wpb .wpb-header{display:block}.wpbs-inner .wpb .wpb-header{display:table-row}.wpbs-inner .wpb-outside{display:none}.mw-tag-markers{font-family:sans-serif;font-style:italic;font-size:90%}.sysop-show,.accountcreator-show,.templateeditor-show,.autoconfirmed-show{display:none}.ve-init-mw-viewPageTarget-toolbar-editNotices-notice .editnotice-redlink{display:none!important}ul.permissions-errors>li{list-style:none none}ul.permissions-errors{margin:0}body.page-Special_UserLogin .mw-label label,body.page-Special_UserLogin_signup .mw-label label{white-space:nowrap}.transborder{border:solid transparent}* html .transborder{border:solid #000001;filter:chroma(color=#000001)}.updatedmarker{background-color:transparent;color:#006400}li.mw-changeslist-line-watched .mw-title,table.mw-changeslist-line-watched .mw-title,table.mw-enhanced-watch .mw-enhanced-rctime{font-weight:normal}span.texhtml{font-family:"Times New Roman","Nimbus Roman No9 L",Times,serif;font-size:118%;white-space:nowrap}span.texhtml span.texhtml{font-size:100%}div.mw-geshi div,div.mw-geshi div pre,span.mw-geshi,pre.source-css,pre.source-javascript,pre.source-lua{font-family:monospace,Courier!important}table#mw-prefixindex-list-table,table#mw-prefixindex-nav-table{width:98%}.portal-column-left{float:left;width:50%}.portal-column-right{float:right;width:49%}.portal-column-left-wide{float:left;width:60%}.portal-column-right-narrow{float:right;width:39%}.portal-column-left-extra-wide{float:left;width:70%}.portal-column-right-extra-narrow{float:right;width:29%}@media only screen and (max-width:800px){.portal-column-left,.portal-column-right,.portal-column-left-wide,.portal-column-right-narrow,.portal-column-left-extra-wide,.portal-column-right-extra-narrow{float:inherit;width:inherit}}#bodyContent .letterhead{background-image:url('//upload.wikimedia.org/wikipedia/commons/e/e0/Tan-page-corner.png');background-repeat:no-repeat;padding:2em;background-color:#faf9f2}.treeview ul{padding:0;margin:0}.treeview li{padding:0;margin:0;list-style-type:none;list-style-image:none;zoom:1}.treeview li li{background:url("//upload.wikimedia.org/wikipedia/commons/f/f2/Treeview-grey-line.png") no-repeat 0 -2981px;padding-left:20px;text-indent:.3em}.treeview li li.lastline{background-position:0 -5971px}.treeview li.emptyline>ul{margin-left:-1px}.treeview li.emptyline>ul>li:first-child{background-position:0 9px}td .sortkey,th .sortkey{display:none;speak:none}.inputbox-hidecheckboxes form .inputbox-element{display:none!important}#editpage-specialchars{display:none}.k-player .k-attribution{visibility:hidden}@media(-webkit-min-device-pixel-ratio:1.5),(min--moz-device-pixel-ratio:1.5),(min-resolution:1.5dppx),(min-resolution:144dpi){#p-logo a{background-image:url("//upload.wikimedia.org/wikipedia/commons/thumb/b/b3/Wikipedia-logo-v2-en.svg/204px-Wikipedia-logo-v2-en.svg.png")!important;background-size:136px auto}}@media(-webkit-min-device-pixel-ratio:2),(min--moz-device-pixel-ratio:2),(min-resolution:2dppx),(min-resolution:192dpi){#p-logo a{background-image:url("//upload.wikimedia.org/wikipedia/commons/thumb/b/b3/Wikipedia-logo-v2-en.svg/270px-Wikipedia-logo-v2-en.svg.png")!important;background-size:135px auto}}.ns-0 .ambox,.ns-0 .navbox,.ns-0 .vertical-navbox,.ns-0 .infobox.sisterproject,.ns-0 .dablink,.ns-0 .metadata,.editlink,.navbar,a.NavToggle,span.collapseButton,span.mw-collapsible-toggle,th .sortkey,td .sortkey{display:none!important}#content cite a.external.text:after,.nourlexpansion a.external.text:after,.nourlexpansion a.external.autonumber:after{display:none!important}table.collapsible tr,div.NavPic,div.NavContent{display:block!important}table.collapsible tr{display:table-row!important}#firstHeading{margin:0}#content a.external.text:after,#content a.external.autonumber:after{word-wrap:break-word}body.page-Main_Page #deleteconfirm,body.page-Main_Page #t-cite,body.page-Main_Page #footer-info-lastmod,body.action-view.page-Main_Page #siteSub,body.action-view.page-Main_Page #contentSub,body.action-view.page-Main_Page h1.firstHeading{display:none!important}body.page-Main_Page #mp-topbanner{margin-top:0!important}#coordinates{position:absolute;top:0;right:0;float:right;margin:0;padding:0;line-height:1.5em;text-align:right;text-indent:0;font-size:85%;text-transform:none;white-space:nowrap}div.topicon{position:absolute;top:-2em;margin-right:-10px;display:block!important}div.flaggedrevs_short{position:absolute;top:-3em;right:80px;z-index:1;margin-left:0;margin-right:-10px}body.rtl #protected-icon{left:55px}body.rtl #spoken-icon,body.rtl #commons-icon{left:30px}body.rtl #featured-star{left:10px}div.vectorMenu div{z-index:2}#siteSub{display:inline;font-size:92%}li.GA{list-style-image:url(//upload.wikimedia.org/wikipedia/commons/4/42/Monobook-bullet-ga.png)}li.FA{list-style-image:url(//upload.wikimedia.org/wikipedia/commons/d/d4/Monobook-bullet-star.png)}li.mw-changeslist-line-watched,li.mw-history-line-updated{list-style-image:url(//upload.wikimedia.org/wikipedia/commons/c/c2/ChangedBulletVector.png)}#bodyContent a.external[href ^="https://"],.link-https{background:url(//upload.wikimedia.org/wikipedia/en/0/00/Lock_icon_blue.gif) center right no-repeat;padding-right:16px}div.redirectMsg img{vertical-align:text-bottom}.redirectText{font-size:150%;margin:5px} \ No newline at end of file
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/write.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/write.py
deleted file mode 100644
index 939e11d5910..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/bench/write.py
+++ /dev/null
@@ -1,344 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: ascii -*-
-r"""
-=========================
- Write benchmark results
-=========================
-
-Write benchmark results.
-
-:Copyright:
-
- Copyright 2014
- Andr\xe9 Malo or his licensors, as applicable
-
-:License:
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-Usage::
-
- python -mbench.write [-p plain] [-t table] <pickled
-
- -p plain Plain file to write to (like docs/BENCHMARKS).
- -t table Table file to write to (like docs/_userdoc/benchmark.txt).
-
-"""
-if __doc__:
- __doc__ = __doc__.encode('ascii').decode('unicode_escape')
-__author__ = r"Andr\xe9 Malo".encode('ascii').decode('unicode_escape')
-__docformat__ = "restructuredtext en"
-__license__ = "Apache License, Version 2.0"
-__version__ = "1.0.0"
-
-import os as _os
-import re as _re
-import sys as _sys
-
-
-try:
- unicode
-except NameError:
- def uni(v):
- if hasattr(v, 'decode'):
- return v.decode('latin-1')
- return str(v)
-else:
- def uni(v):
- if isinstance(v, unicode):
- return v.encode('utf-8')
- return str(v)
-
-
-def write_table(filename, results):
- """
- Output tabled benchmark results
-
- :Parameters:
- `filename` : ``str``
- Filename to write to
-
- `results` : ``list``
- Results
- """
- try:
- next
- except NameError:
- next = lambda i: (getattr(i, 'next', None) or i.__next__)()
- try:
- cmp
- except NameError:
- cmp = lambda a, b: (a > b) - (a < b)
-
- names = [
- ('cssmin', 'YUI Port'),
- ('rcssmin', '|rcssmin|'),
- ('_rcssmin', r'_\ |rcssmin|'),
- ]
- benched_per_table = 2
-
- results = sorted(results, reverse=True)
-
- # First we transform our data into a table (list of lists)
- pythons, widths = [], [0] * (benched_per_table + 1)
- last_version = None
- for version, _, result in results:
- version = uni(version)
- if not(last_version is None or version.startswith('2.')):
- continue
- last_version = version
-
- namesub = _re.compile(r'(?:-\d+(?:\.\d+)*)?\.css$').sub
- result = iter(result)
- tables = []
-
- # given our data it's easier to create the table transposed...
- for benched in result:
- rows = [['Name'] + [desc for _, desc in names]]
- for _ in range(benched_per_table):
- if _:
- try:
- benched = next(result)
- except StopIteration:
- rows.append([''] + ['' for _ in names])
- continue
-
- times = dict((
- uni(port), (time, benched['sizes'][idx])
- ) for idx, (port, time) in enumerate(benched['times']))
- columns = ['%s (%.1f)' % (
- namesub('', _os.path.basename(uni(benched['filename']))),
- benched['size'] / 1024.0,
- )]
- for idx, (port, _) in enumerate(names):
- if port not in times:
- columns.append('n/a')
- continue
- time, size = times[port]
- if time is None:
- columns.append('(failed)')
- continue
- columns.append('%s%.2f ms (%.1f %s)' % (
- idx == 0 and ' ' or '',
- time,
- size / 1024.0,
- idx == 0 and '\\*' or ['=', '>', '<'][
- cmp(size, benched['sizes'][0])
- ],
- ))
- rows.append(columns)
-
- # calculate column widths (global for all tables)
- for idx, row in enumerate(rows):
- widths[idx] = max(widths[idx], max(map(len, row)))
-
- # ... and transpose it back.
- tables.append(zip(*rows))
- pythons.append((version, tables))
-
- if last_version.startswith('2.'):
- break
-
- # Second we create a rest table from it
- lines = []
- separator = lambda c='-': '+'.join([''] + [
- c * (width + 2) for width in widths
- ] + [''])
-
- for idx, (version, tables) in enumerate(pythons):
- if idx:
- lines.append('')
- lines.append('')
-
- line = 'Python %s' % (version,)
- lines.append(line)
- lines.append('~' * len(line))
-
- for table in tables:
- lines.append('')
- lines.append('.. rst-class:: benchmark')
- lines.append('')
-
- for idx, row in enumerate(table):
- if idx == 0:
- # header
- lines.append(separator())
- lines.append('|'.join([''] + [
- ' %s%*s ' % (col, len(col) - width, '')
- for width, col in zip(widths, row)
- ] + ['']))
- lines.append(separator('='))
- else: # data
- lines.append('|'.join([''] + [
- j == 0 and (
- ' %s%*s ' % (col, len(col) - widths[j], '')
- ) or (
- ['%*s ', ' %*s '][idx == 1] % (widths[j], col)
- )
- for j, col in enumerate(row)
- ] + ['']))
- lines.append(separator())
-
- fplines = []
- fp = open(filename)
- try:
- fpiter = iter(fp)
- for line in fpiter:
- line = line.rstrip()
- if line == '.. begin tables':
- buf = []
- for line in fpiter:
- line = line.rstrip()
- if line == '.. end tables':
- fplines.append('.. begin tables')
- fplines.append('')
- fplines.extend(lines)
- fplines.append('')
- fplines.append('.. end tables')
- buf = []
- break
- else:
- buf.append(line)
- else:
- fplines.extend(buf)
- _sys.stderr.write("Placeholder container not found!\n")
- else:
- fplines.append(line)
- finally:
- fp.close()
-
- fp = open(filename, 'w')
- try:
- fp.write('\n'.join(fplines) + '\n')
- finally:
- fp.close()
-
-
-def write_plain(filename, results):
- """
- Output plain benchmark results
-
- :Parameters:
- `filename` : ``str``
- Filename to write to
-
- `results` : ``list``
- Results
- """
- lines = []
- results = sorted(results, reverse=True)
- for idx, (version, import_notes, result) in enumerate(results):
- if idx:
- lines.append('')
- lines.append('')
-
- lines.append('$ python%s -OO bench/main.py bench/*.css' % (
- '.'.join(version.split('.')[:2])
- ))
- lines.append('~' * 72)
- for note in import_notes:
- lines.append(uni(note))
- lines.append('Python Release: %s' % (version,))
-
- for single in result:
- lines.append('')
- lines.append('Benchmarking %r... (%.1f KiB)' % (
- uni(single['filename']), single['size'] / 1024.0
- ))
- for msg in single['messages']:
- lines.append(msg)
- times = []
- space = max([len(uni(port)) for port, _ in single['times']])
- for idx, (port, time) in enumerate(single['times']):
- port = uni(port)
- if time is None:
- lines.append(" FAILED %s" % (port,))
- else:
- times.append(time)
- lines.append(
- " Timing %s%s ... (%5.1f KiB %s) %8.2f ms" % (
- port,
- " " * (space - len(port)),
- single['sizes'][idx] / 1024.0,
- idx == 0 and '*' or ['=', '>', '<'][
- cmp(single['sizes'][idx], single['sizes'][0])
- ],
- time
- )
- )
- if len(times) > 1:
- lines[-1] += " (factor: %s)" % (', '.join([
- '%.2f' % (timed / time) for timed in times[:-1]
- ]))
-
- lines.append('')
- lines.append('')
- lines.append('# vim: nowrap')
- fp = open(filename, 'w')
- try:
- fp.write('\n'.join(lines) + '\n')
- finally:
- fp.close()
-
-
-def main(argv=None):
- """ Main """
- import getopt as _getopt
- import pickle as _pickle
-
- if argv is None:
- argv = _sys.argv[1:]
- try:
- opts, args = _getopt.getopt(argv, "hp:t:", ["help"])
- except getopt.GetoptError:
- e = _sys.exc_info()[0](_sys.exc_info()[1])
- print >> _sys.stderr, "%s\nTry %s -mbench.write --help" % (
- e,
- _os.path.basename(_sys.executable),
- )
- _sys.exit(2)
-
- plain, table = None, None
- for key, value in opts:
- if key in ("-h", "--help"):
- print >> _sys.stderr, (
- "%s -mbench.write [-p plain] [-t table] <pickled" % (
- _os.path.basename(_sys.executable),
- )
- )
- _sys.exit(0)
- elif key == '-p':
- plain = str(value)
- elif key == '-t':
- table = str(value)
-
- struct = []
- _sys.stdin = getattr(_sys.stdin, 'detach', lambda: _sys.stdin)()
- try:
- while True:
- version, import_notes, result = _pickle.load(_sys.stdin)
- if hasattr(version, 'decode'):
- version = version.decode('latin-1')
- struct.append((version, import_notes, result))
- except EOFError:
- pass
-
- if plain:
- write_plain(plain, struct)
-
- if table:
- write_table(table, struct)
-
-
-if __name__ == '__main__':
- main()
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/BENCHMARKS b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/BENCHMARKS
deleted file mode 100644
index 9a49e9b51bf..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/BENCHMARKS
+++ /dev/null
@@ -1,61 +0,0 @@
-$ python3.4 -OO bench/main.py bench/*.css
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Python Release: 3.4.2
-
-Benchmarking 'bench/wikipedia.css'... (81.0 KiB)
- Timing cssmin ... ( 49.4 KiB *) 163.11 ms
- Timing rcssmin ... ( 49.6 KiB >) 45.48 ms (factor: 3.59)
- Timing _rcssmin ... ( 49.6 KiB >) 0.43 ms (factor: 378.93, 105.66)
-
-Benchmarking 'bench/wikipedia.min.css'... (49.4 KiB)
- Timing cssmin ... ( 49.4 KiB *) 119.00 ms
- Timing rcssmin ... ( 49.4 KiB =) 20.94 ms (factor: 5.68)
- Timing _rcssmin ... ( 49.4 KiB =) 0.26 ms (factor: 454.45, 79.98)
-
-
-$ python3.3 -OO bench/main.py bench/*.css
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Python Release: 3.3.5
-
-Benchmarking 'bench/wikipedia.css'... (81.0 KiB)
- Timing cssmin ... ( 49.4 KiB *) 185.01 ms
- Timing rcssmin ... ( 49.6 KiB >) 59.30 ms (factor: 3.12)
- Timing _rcssmin ... ( 49.6 KiB >) 0.52 ms (factor: 356.38, 114.23)
-
-Benchmarking 'bench/wikipedia.min.css'... (49.4 KiB)
- Timing cssmin ... ( 49.4 KiB *) 136.26 ms
- Timing rcssmin ... ( 49.4 KiB =) 25.51 ms (factor: 5.34)
- Timing _rcssmin ... ( 49.4 KiB =) 0.26 ms (factor: 515.24, 96.47)
-
-
-$ python3.2 -OO bench/main.py bench/*.css
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Python Release: 3.2.5
-
-Benchmarking 'bench/wikipedia.css'... (81.0 KiB)
- Timing cssmin ... ( 49.4 KiB *) 225.32 ms
- Timing rcssmin ... ( 49.6 KiB >) 57.51 ms (factor: 3.92)
- Timing _rcssmin ... ( 49.6 KiB >) 0.43 ms (factor: 527.98, 134.77)
-
-Benchmarking 'bench/wikipedia.min.css'... (49.4 KiB)
- Timing cssmin ... ( 49.4 KiB *) 129.43 ms
- Timing rcssmin ... ( 49.4 KiB =) 24.45 ms (factor: 5.29)
- Timing _rcssmin ... ( 49.4 KiB =) 0.25 ms (factor: 526.94, 99.55)
-
-
-$ python2.7 -OO bench/main.py bench/*.css
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Python Release: 2.7.7
-
-Benchmarking 'bench/wikipedia.css'... (81.0 KiB)
- Timing cssmin ... ( 49.4 KiB *) 175.98 ms
- Timing rcssmin ... ( 49.6 KiB >) 46.22 ms (factor: 3.81)
- Timing _rcssmin ... ( 49.6 KiB >) 0.45 ms (factor: 390.95, 102.68)
-
-Benchmarking 'bench/wikipedia.min.css'... (49.4 KiB)
- Timing cssmin ... ( 49.4 KiB *) 126.19 ms
- Timing rcssmin ... ( 49.4 KiB =) 19.92 ms (factor: 6.33)
- Timing _rcssmin ... ( 49.4 KiB =) 0.27 ms (factor: 469.78, 74.17)
-
-
-# vim: nowrap
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/CHANGES b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/CHANGES
deleted file mode 100644
index e179dce99dd..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/CHANGES
+++ /dev/null
@@ -1,42 +0,0 @@
-Changes with version 1.0.5
-
- *) Added support for pypy 2.2
-
- *) Updated benchmarks
-
- *) Relint with newer pylint
-
- *) Fix locale problem with the setup script on python3.
- Submitted by https://github.com/svenstaro
-
-
-Changes with version 1.0.4
-
- *) Documentation and benchmark updates
-
-
-Changes with version 1.0.3
-
- *) Added support for the following grouping @-rules:
- @supports, @document, @keyframes
-
- *) Added support for Python 3.4 and Jython 2.7
-
-
-Changes with version 1.0.2
-
- *) Added compat option to setup.py supporting the pip installer
-
- *) Added support for pypy (1.9, 2.0)
-
- *) Added support for jython (2.5)
-
-
-Changes with version 1.0.1
-
- *) Added support for Python 3.3
-
-
-Changes with version 1.0.0
-
- *) First stable release.
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/CLASSIFIERS b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/CLASSIFIERS
deleted file mode 100644
index 10d59650380..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/CLASSIFIERS
+++ /dev/null
@@ -1,19 +0,0 @@
-Development Status :: 5 - Production/Stable
-Environment :: Web Environment
-Intended Audience :: Developers
-License :: OSI Approved
-License :: OSI Approved :: Apache License, Version 2.0
-Operating System :: OS Independent
-Programming Language :: C
-Programming Language :: Python
-Programming Language :: Python :: 2
-Programming Language :: Python :: 3
-Programming Language :: Python :: Implementation :: CPython
-Programming Language :: Python :: Implementation :: Jython
-Programming Language :: Python :: Implementation :: PyPy
-Topic :: Internet :: WWW/HTTP :: Dynamic Content
-Topic :: Software Development :: Libraries
-Topic :: Software Development :: Libraries :: Python Modules
-Topic :: Text Processing
-Topic :: Text Processing :: Filters
-Topic :: Utilities
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/DESCRIPTION b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/DESCRIPTION
deleted file mode 100644
index b51a7fdb837..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/DESCRIPTION
+++ /dev/null
@@ -1,85 +0,0 @@
-==============
- CSS Minifier
-==============
-
-RCSSmin is a CSS minifier.
-
-The minifier is based on the semantics of the `YUI compressor`_\, which itself
-is based on `the rule list by Isaac Schlueter`_\.
-
-This module is a re-implementation aiming for speed instead of maximum
-compression, so it can be used at runtime (rather than during a preprocessing
-step). RCSSmin does syntactical compression only (removing spaces, comments
-and possibly semicolons). It does not provide semantic compression (like
-removing empty blocks, collapsing redundant properties etc). It does, however,
-support various CSS hacks (by keeping them working as intended).
-
-Here's a feature list:
-
-- Strings are kept, except that escaped newlines are stripped
-- Space/Comments before the very end or before various characters are
- stripped: ``:{});=>+],!`` (The colon (``:``) is a special case, a single
- space is kept if it's outside a ruleset.)
-- Space/Comments at the very beginning or after various characters are
- stripped: ``{}(=:>+[,!``
-- Optional space after unicode escapes is kept, resp. replaced by a simple
- space
-- whitespaces inside ``url()`` definitions are stripped
-- Comments starting with an exclamation mark (``!``) can be kept optionally.
-- All other comments and/or whitespace characters are replaced by a single
- space.
-- Multiple consecutive semicolons are reduced to one
-- The last semicolon within a ruleset is stripped
-- CSS Hacks supported:
-
- - IE7 hack (``>/**/``)
- - Mac-IE5 hack (``/*\*/.../**/``)
- - The boxmodelhack is supported naturally because it relies on valid CSS2
- strings
- - Between ``:first-line`` and the following comma or curly brace a space is
- inserted. (apparently it's needed for IE6)
- - Same for ``:first-letter``
-
-rcssmin.c is a reimplementation of rcssmin.py in C and improves runtime up to
-factor 100 or so (depending on the input). docs/BENCHMARKS in the source
-distribution contains the details.
-
-Both python 2 (>= 2.4) and python 3 are supported.
-
-.. _YUI compressor: https://github.com/yui/yuicompressor/
-
-.. _the rule list by Isaac Schlueter: https://github.com/isaacs/cssmin/
-
-
-Copyright and License
-~~~~~~~~~~~~~~~~~~~~~
-
-Copyright 2011 - 2014
-André Malo or his licensors, as applicable.
-
-The whole package (except for the files in the bench/ directory) is
-distributed under the Apache License Version 2.0. You'll find a copy in the
-root directory of the distribution or online at:
-<http://www.apache.org/licenses/LICENSE-2.0>.
-
-
-Bugs
-~~~~
-
-No bugs, of course. ;-)
-But if you've found one or have an idea how to improve rcssmin, feel free
-to send a pull request on `github <https://github.com/ndparker/rcssmin>`_
-or send a mail to <rcssmin-bugs@perlig.de>.
-
-
-Author Information
-~~~~~~~~~~~~~~~~~~
-
-André "nd" Malo <nd perlig.de>
-GPG: 0x8103A37E
-
-
- If God intended people to be naked, they would be born that way.
- -- Oscar Wilde
-
-.. vim:tw=72 syntax=rest
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/PROVIDES b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/PROVIDES
deleted file mode 100644
index d6d4e9ebe93..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/PROVIDES
+++ /dev/null
@@ -1 +0,0 @@
-rcssmin (1.0)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/SUMMARY b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/SUMMARY
deleted file mode 100644
index 490e5373442..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/SUMMARY
+++ /dev/null
@@ -1 +0,0 @@
-CSS Minifier
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/api-objects.txt b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/api-objects.txt
deleted file mode 100644
index f4ed223ee65..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/api-objects.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-rcssmin rcssmin-module.html
-rcssmin.__license__ rcssmin-module.html#__license__
-rcssmin._make_cssmin rcssmin-module.html#_make_cssmin
-rcssmin.__doc__ rcssmin-module.html#__doc__
-rcssmin.__package__ rcssmin-module.html#__package__
-rcssmin.cssmin rcssmin-module.html#cssmin
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/crarr.png b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/crarr.png
deleted file mode 100644
index 26b43c52433..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/crarr.png
+++ /dev/null
Binary files differ
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/epydoc.css b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/epydoc.css
deleted file mode 100644
index 86d41706824..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/epydoc.css
+++ /dev/null
@@ -1,322 +0,0 @@
-
-
-/* Epydoc CSS Stylesheet
- *
- * This stylesheet can be used to customize the appearance of epydoc's
- * HTML output.
- *
- */
-
-/* Default Colors & Styles
- * - Set the default foreground & background color with 'body'; and
- * link colors with 'a:link' and 'a:visited'.
- * - Use bold for decision list terms.
- * - The heading styles defined here are used for headings *within*
- * docstring descriptions. All headings used by epydoc itself use
- * either class='epydoc' or class='toc' (CSS styles for both
- * defined below).
- */
-body { background: #ffffff; color: #000000; }
-p { margin-top: 0.5em; margin-bottom: 0.5em; }
-a:link { color: #0000ff; }
-a:visited { color: #204080; }
-dt { font-weight: bold; }
-h1 { font-size: +140%; font-style: italic;
- font-weight: bold; }
-h2 { font-size: +125%; font-style: italic;
- font-weight: bold; }
-h3 { font-size: +110%; font-style: italic;
- font-weight: normal; }
-code { font-size: 100%; }
-/* N.B.: class, not pseudoclass */
-a.link { font-family: monospace; }
-
-/* Page Header & Footer
- * - The standard page header consists of a navigation bar (with
- * pointers to standard pages such as 'home' and 'trees'); a
- * breadcrumbs list, which can be used to navigate to containing
- * classes or modules; options links, to show/hide private
- * variables and to show/hide frames; and a page title (using
- * <h1>). The page title may be followed by a link to the
- * corresponding source code (using 'span.codelink').
- * - The footer consists of a navigation bar, a timestamp, and a
- * pointer to epydoc's homepage.
- */
-h1.epydoc { margin: 0; font-size: +140%; font-weight: bold; }
-h2.epydoc { font-size: +130%; font-weight: bold; }
-h3.epydoc { font-size: +115%; font-weight: bold;
- margin-top: 0.2em; }
-td h3.epydoc { font-size: +115%; font-weight: bold;
- margin-bottom: 0; }
-table.navbar { background: #a0c0ff; color: #000000;
- border: 2px groove #c0d0d0; }
-table.navbar table { color: #000000; }
-th.navbar-select { background: #70b0ff;
- color: #000000; }
-table.navbar a { text-decoration: none; }
-table.navbar a:link { color: #0000ff; }
-table.navbar a:visited { color: #204080; }
-span.breadcrumbs { font-size: 85%; font-weight: bold; }
-span.options { font-size: 70%; }
-span.codelink { font-size: 85%; }
-td.footer { font-size: 85%; }
-
-/* Table Headers
- * - Each summary table and details section begins with a 'header'
- * row. This row contains a section title (marked by
- * 'span.table-header') as well as a show/hide private link
- * (marked by 'span.options', defined above).
- * - Summary tables that contain user-defined groups mark those
- * groups using 'group header' rows.
- */
-td.table-header { background: #70b0ff; color: #000000;
- border: 1px solid #608090; }
-td.table-header table { color: #000000; }
-td.table-header table a:link { color: #0000ff; }
-td.table-header table a:visited { color: #204080; }
-span.table-header { font-size: 120%; font-weight: bold; }
-th.group-header { background: #c0e0f8; color: #000000;
- text-align: left; font-style: italic;
- font-size: 115%;
- border: 1px solid #608090; }
-
-/* Summary Tables (functions, variables, etc)
- * - Each object is described by a single row of the table with
- * two cells. The left cell gives the object's type, and is
- * marked with 'code.summary-type'. The right cell gives the
- * object's name and a summary description.
- * - CSS styles for the table's header and group headers are
- * defined above, under 'Table Headers'
- */
-table.summary { border-collapse: collapse;
- background: #e8f0f8; color: #000000;
- border: 1px solid #608090;
- margin-bottom: 0.5em; }
-td.summary { border: 1px solid #608090; }
-code.summary-type { font-size: 85%; }
-table.summary a:link { color: #0000ff; }
-table.summary a:visited { color: #204080; }
-
-
-/* Details Tables (functions, variables, etc)
- * - Each object is described in its own div.
- * - A single-row summary table w/ table-header is used as
- * a header for each details section (CSS style for table-header
- * is defined above, under 'Table Headers').
- */
-table.details { border-collapse: collapse;
- background: #e8f0f8; color: #000000;
- border: 1px solid #608090;
- margin: .2em 0 0 0; }
-table.details table { color: #000000; }
-table.details a:link { color: #0000ff; }
-table.details a:visited { color: #204080; }
-
-/* Fields */
-dl.fields { margin-left: 2em; margin-top: 1em;
- margin-bottom: 1em; }
-dl.fields dd ul { margin-left: 0em; padding-left: 0em; }
-dl.fields dd ul li ul { margin-left: 2em; padding-left: 0em; }
-div.fields { margin-left: 2em; }
-div.fields p { margin-bottom: 0.5em; }
-
-/* Index tables (identifier index, term index, etc)
- * - link-index is used for indices containing lists of links
- * (namely, the identifier index & term index).
- * - index-where is used in link indices for the text indicating
- * the container/source for each link.
- * - metadata-index is used for indices containing metadata
- * extracted from fields (namely, the bug index & todo index).
- */
-table.link-index { border-collapse: collapse;
- background: #e8f0f8; color: #000000;
- border: 1px solid #608090; }
-td.link-index { border-width: 0px; }
-table.link-index a:link { color: #0000ff; }
-table.link-index a:visited { color: #204080; }
-span.index-where { font-size: 70%; }
-table.metadata-index { border-collapse: collapse;
- background: #e8f0f8; color: #000000;
- border: 1px solid #608090;
- margin: .2em 0 0 0; }
-td.metadata-index { border-width: 1px; border-style: solid; }
-table.metadata-index a:link { color: #0000ff; }
-table.metadata-index a:visited { color: #204080; }
-
-/* Function signatures
- * - sig* is used for the signature in the details section.
- * - .summary-sig* is used for the signature in the summary
- * table, and when listing property accessor functions.
- * */
-.sig-name { color: #006080; }
-.sig-arg { color: #008060; }
-.sig-default { color: #602000; }
-.summary-sig { font-family: monospace; }
-.summary-sig-name { color: #006080; font-weight: bold; }
-table.summary a.summary-sig-name:link
- { color: #006080; font-weight: bold; }
-table.summary a.summary-sig-name:visited
- { color: #006080; font-weight: bold; }
-.summary-sig-arg { color: #006040; }
-.summary-sig-default { color: #501800; }
-
-/* Subclass list
- */
-ul.subclass-list { display: inline; }
-ul.subclass-list li { display: inline; }
-
-/* To render variables, classes etc. like functions */
-table.summary .summary-name { color: #006080; font-weight: bold;
- font-family: monospace; }
-table.summary
- a.summary-name:link { color: #006080; font-weight: bold;
- font-family: monospace; }
-table.summary
- a.summary-name:visited { color: #006080; font-weight: bold;
- font-family: monospace; }
-
-/* Variable values
- * - In the 'variable details' sections, each varaible's value is
- * listed in a 'pre.variable' box. The width of this box is
- * restricted to 80 chars; if the value's repr is longer than
- * this it will be wrapped, using a backslash marked with
- * class 'variable-linewrap'. If the value's repr is longer
- * than 3 lines, the rest will be ellided; and an ellipsis
- * marker ('...' marked with 'variable-ellipsis') will be used.
- * - If the value is a string, its quote marks will be marked
- * with 'variable-quote'.
- * - If the variable is a regexp, it is syntax-highlighted using
- * the re* CSS classes.
- */
-pre.variable { padding: .5em; margin: 0;
- background: #dce4ec; color: #000000;
- border: 1px solid #708890; }
-.variable-linewrap { color: #604000; font-weight: bold; }
-.variable-ellipsis { color: #604000; font-weight: bold; }
-.variable-quote { color: #604000; font-weight: bold; }
-.variable-group { color: #008000; font-weight: bold; }
-.variable-op { color: #604000; font-weight: bold; }
-.variable-string { color: #006030; }
-.variable-unknown { color: #a00000; font-weight: bold; }
-.re { color: #000000; }
-.re-char { color: #006030; }
-.re-op { color: #600000; }
-.re-group { color: #003060; }
-.re-ref { color: #404040; }
-
-/* Base tree
- * - Used by class pages to display the base class hierarchy.
- */
-pre.base-tree { font-size: 80%; margin: 0; }
-
-/* Frames-based table of contents headers
- * - Consists of two frames: one for selecting modules; and
- * the other listing the contents of the selected module.
- * - h1.toc is used for each frame's heading
- * - h2.toc is used for subheadings within each frame.
- */
-h1.toc { text-align: center; font-size: 105%;
- margin: 0; font-weight: bold;
- padding: 0; }
-h2.toc { font-size: 100%; font-weight: bold;
- margin: 0.5em 0 0 -0.3em; }
-
-/* Syntax Highlighting for Source Code
- * - doctest examples are displayed in a 'pre.py-doctest' block.
- * If the example is in a details table entry, then it will use
- * the colors specified by the 'table pre.py-doctest' line.
- * - Source code listings are displayed in a 'pre.py-src' block.
- * Each line is marked with 'span.py-line' (used to draw a line
- * down the left margin, separating the code from the line
- * numbers). Line numbers are displayed with 'span.py-lineno'.
- * The expand/collapse block toggle button is displayed with
- * 'a.py-toggle' (Note: the CSS style for 'a.py-toggle' should not
- * modify the font size of the text.)
- * - If a source code page is opened with an anchor, then the
- * corresponding code block will be highlighted. The code
- * block's header is highlighted with 'py-highlight-hdr'; and
- * the code block's body is highlighted with 'py-highlight'.
- * - The remaining py-* classes are used to perform syntax
- * highlighting (py-string for string literals, py-name for names,
- * etc.)
- */
-pre.py-doctest { padding: .5em; margin: 1em;
- background: #e8f0f8; color: #000000;
- border: 1px solid #708890; }
-table pre.py-doctest { background: #dce4ec;
- color: #000000; }
-pre.py-src { border: 2px solid #000000;
- background: #f0f0f0; color: #000000; }
-.py-line { border-left: 2px solid #000000;
- margin-left: .2em; padding-left: .4em; }
-.py-lineno { font-style: italic; font-size: 90%;
- padding-left: .5em; }
-a.py-toggle { text-decoration: none; }
-div.py-highlight-hdr { border-top: 2px solid #000000;
- border-bottom: 2px solid #000000;
- background: #d8e8e8; }
-div.py-highlight { border-bottom: 2px solid #000000;
- background: #d0e0e0; }
-.py-prompt { color: #005050; font-weight: bold;}
-.py-more { color: #005050; font-weight: bold;}
-.py-string { color: #006030; }
-.py-comment { color: #003060; }
-.py-keyword { color: #600000; }
-.py-output { color: #404040; }
-.py-name { color: #000050; }
-.py-name:link { color: #000050 !important; }
-.py-name:visited { color: #000050 !important; }
-.py-number { color: #005000; }
-.py-defname { color: #000060; font-weight: bold; }
-.py-def-name { color: #000060; font-weight: bold; }
-.py-base-class { color: #000060; }
-.py-param { color: #000060; }
-.py-docstring { color: #006030; }
-.py-decorator { color: #804020; }
-/* Use this if you don't want links to names underlined: */
-/*a.py-name { text-decoration: none; }*/
-
-/* Graphs & Diagrams
- * - These CSS styles are used for graphs & diagrams generated using
- * Graphviz dot. 'img.graph-without-title' is used for bare
- * diagrams (to remove the border created by making the image
- * clickable).
- */
-img.graph-without-title { border: none; }
-img.graph-with-title { border: 1px solid #000000; }
-span.graph-title { font-weight: bold; }
-span.graph-caption { }
-
-/* General-purpose classes
- * - 'p.indent-wrapped-lines' defines a paragraph whose first line
- * is not indented, but whose subsequent lines are.
- * - The 'nomargin-top' class is used to remove the top margin (e.g.
- * from lists). The 'nomargin' class is used to remove both the
- * top and bottom margin (but not the left or right margin --
- * for lists, that would cause the bullets to disappear.)
- */
-p.indent-wrapped-lines { padding: 0 0 0 7em; text-indent: -7em;
- margin: 0; }
-.nomargin-top { margin-top: 0; }
-.nomargin { margin-top: 0; margin-bottom: 0; }
-
-/* HTML Log */
-div.log-block { padding: 0; margin: .5em 0 .5em 0;
- background: #e8f0f8; color: #000000;
- border: 1px solid #000000; }
-div.log-error { padding: .1em .3em .1em .3em; margin: 4px;
- background: #ffb0b0; color: #000000;
- border: 1px solid #000000; }
-div.log-warning { padding: .1em .3em .1em .3em; margin: 4px;
- background: #ffffb0; color: #000000;
- border: 1px solid #000000; }
-div.log-info { padding: .1em .3em .1em .3em; margin: 4px;
- background: #b0ffb0; color: #000000;
- border: 1px solid #000000; }
-h2.log-hdr { background: #70b0ff; color: #000000;
- margin: 0; padding: 0em 0.5em 0em 0.5em;
- border-bottom: 1px solid #000000; font-size: 110%; }
-p.log { font-weight: bold; margin: .5em 0 .5em 0; }
-tr.opt-changed { color: #000000; font-weight: bold; }
-tr.opt-default { color: #606060; }
-pre.log { margin: 0; padding: 0; padding-left: 1em; }
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/epydoc.js b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/epydoc.js
deleted file mode 100644
index e787dbcf471..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/epydoc.js
+++ /dev/null
@@ -1,293 +0,0 @@
-function toggle_private() {
- // Search for any private/public links on this page. Store
- // their old text in "cmd," so we will know what action to
- // take; and change their text to the opposite action.
- var cmd = "?";
- var elts = document.getElementsByTagName("a");
- for(var i=0; i<elts.length; i++) {
- if (elts[i].className == "privatelink") {
- cmd = elts[i].innerHTML;
- elts[i].innerHTML = ((cmd && cmd.substr(0,4)=="show")?
- "hide&nbsp;private":"show&nbsp;private");
- }
- }
- // Update all DIVs containing private objects.
- var elts = document.getElementsByTagName("div");
- for(var i=0; i<elts.length; i++) {
- if (elts[i].className == "private") {
- elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"none":"block");
- }
- else if (elts[i].className == "public") {
- elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"block":"none");
- }
- }
- // Update all table rows containing private objects. Note, we
- // use "" instead of "block" becaue IE & firefox disagree on what
- // this should be (block vs table-row), and "" just gives the
- // default for both browsers.
- var elts = document.getElementsByTagName("tr");
- for(var i=0; i<elts.length; i++) {
- if (elts[i].className == "private") {
- elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"none":"");
- }
- }
- // Update all list items containing private objects.
- var elts = document.getElementsByTagName("li");
- for(var i=0; i<elts.length; i++) {
- if (elts[i].className == "private") {
- elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?
- "none":"");
- }
- }
- // Update all list items containing private objects.
- var elts = document.getElementsByTagName("ul");
- for(var i=0; i<elts.length; i++) {
- if (elts[i].className == "private") {
- elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"none":"block");
- }
- }
- // Set a cookie to remember the current option.
- document.cookie = "EpydocPrivate="+cmd;
- }
-function show_private() {
- var elts = document.getElementsByTagName("a");
- for(var i=0; i<elts.length; i++) {
- if (elts[i].className == "privatelink") {
- cmd = elts[i].innerHTML;
- if (cmd && cmd.substr(0,4)=="show")
- toggle_private();
- }
- }
- }
-function getCookie(name) {
- var dc = document.cookie;
- var prefix = name + "=";
- var begin = dc.indexOf("; " + prefix);
- if (begin == -1) {
- begin = dc.indexOf(prefix);
- if (begin != 0) return null;
- } else
- { begin += 2; }
- var end = document.cookie.indexOf(";", begin);
- if (end == -1)
- { end = dc.length; }
- return unescape(dc.substring(begin + prefix.length, end));
- }
-function setFrame(url1, url2) {
- parent.frames[1].location.href = url1;
- parent.frames[2].location.href = url2;
- }
-function checkCookie() {
- var cmd=getCookie("EpydocPrivate");
- if (cmd && cmd.substr(0,4)!="show" && location.href.indexOf("#_") < 0)
- toggle_private();
- }
-function toggleCallGraph(id) {
- var elt = document.getElementById(id);
- if (elt.style.display == "none")
- elt.style.display = "block";
- else
- elt.style.display = "none";
- }
-function expand(id) {
- var elt = document.getElementById(id+"-expanded");
- if (elt) elt.style.display = "block";
- var elt = document.getElementById(id+"-expanded-linenums");
- if (elt) elt.style.display = "block";
- var elt = document.getElementById(id+"-collapsed");
- if (elt) { elt.innerHTML = ""; elt.style.display = "none"; }
- var elt = document.getElementById(id+"-collapsed-linenums");
- if (elt) { elt.innerHTML = ""; elt.style.display = "none"; }
- var elt = document.getElementById(id+"-toggle");
- if (elt) { elt.innerHTML = "-"; }
-}
-
-function collapse(id) {
- var elt = document.getElementById(id+"-expanded");
- if (elt) elt.style.display = "none";
- var elt = document.getElementById(id+"-expanded-linenums");
- if (elt) elt.style.display = "none";
- var elt = document.getElementById(id+"-collapsed-linenums");
- if (elt) { elt.innerHTML = "<br />"; elt.style.display="block"; }
- var elt = document.getElementById(id+"-toggle");
- if (elt) { elt.innerHTML = "+"; }
- var elt = document.getElementById(id+"-collapsed");
- if (elt) {
- elt.style.display = "block";
-
- var indent = elt.getAttribute("indent");
- var pad = elt.getAttribute("pad");
- var s = "<tt class='py-lineno'>";
- for (var i=0; i<pad.length; i++) { s += "&nbsp;" }
- s += "</tt>";
- s += "&nbsp;&nbsp;<tt class='py-line'>";
- for (var i=0; i<indent.length; i++) { s += "&nbsp;" }
- s += "<a href='#' onclick='expand(\"" + id;
- s += "\");return false'>...</a></tt><br />";
- elt.innerHTML = s;
- }
-}
-
-function toggle(id) {
- elt = document.getElementById(id+"-toggle");
- if (elt.innerHTML == "-")
- collapse(id);
- else
- expand(id);
- return false;
-}
-
-function highlight(id) {
- var elt = document.getElementById(id+"-def");
- if (elt) elt.className = "py-highlight-hdr";
- var elt = document.getElementById(id+"-expanded");
- if (elt) elt.className = "py-highlight";
- var elt = document.getElementById(id+"-collapsed");
- if (elt) elt.className = "py-highlight";
-}
-
-function num_lines(s) {
- var n = 1;
- var pos = s.indexOf("\n");
- while ( pos > 0) {
- n += 1;
- pos = s.indexOf("\n", pos+1);
- }
- return n;
-}
-
-// Collapse all blocks that mave more than `min_lines` lines.
-function collapse_all(min_lines) {
- var elts = document.getElementsByTagName("div");
- for (var i=0; i<elts.length; i++) {
- var elt = elts[i];
- var split = elt.id.indexOf("-");
- if (split > 0)
- if (elt.id.substring(split, elt.id.length) == "-expanded")
- if (num_lines(elt.innerHTML) > min_lines)
- collapse(elt.id.substring(0, split));
- }
-}
-
-function expandto(href) {
- var start = href.indexOf("#")+1;
- if (start != 0 && start != href.length) {
- if (href.substring(start, href.length) != "-") {
- collapse_all(4);
- pos = href.indexOf(".", start);
- while (pos != -1) {
- var id = href.substring(start, pos);
- expand(id);
- pos = href.indexOf(".", pos+1);
- }
- var id = href.substring(start, href.length);
- expand(id);
- highlight(id);
- }
- }
-}
-
-function kill_doclink(id) {
- var parent = document.getElementById(id);
- parent.removeChild(parent.childNodes.item(0));
-}
-function auto_kill_doclink(ev) {
- if (!ev) var ev = window.event;
- if (!this.contains(ev.toElement)) {
- var parent = document.getElementById(this.parentID);
- parent.removeChild(parent.childNodes.item(0));
- }
-}
-
-function doclink(id, name, targets_id) {
- var elt = document.getElementById(id);
-
- // If we already opened the box, then destroy it.
- // (This case should never occur, but leave it in just in case.)
- if (elt.childNodes.length > 1) {
- elt.removeChild(elt.childNodes.item(0));
- }
- else {
- // The outer box: relative + inline positioning.
- var box1 = document.createElement("div");
- box1.style.position = "relative";
- box1.style.display = "inline";
- box1.style.top = 0;
- box1.style.left = 0;
-
- // A shadow for fun
- var shadow = document.createElement("div");
- shadow.style.position = "absolute";
- shadow.style.left = "-1.3em";
- shadow.style.top = "-1.3em";
- shadow.style.background = "#404040";
-
- // The inner box: absolute positioning.
- var box2 = document.createElement("div");
- box2.style.position = "relative";
- box2.style.border = "1px solid #a0a0a0";
- box2.style.left = "-.2em";
- box2.style.top = "-.2em";
- box2.style.background = "white";
- box2.style.padding = ".3em .4em .3em .4em";
- box2.style.fontStyle = "normal";
- box2.onmouseout=auto_kill_doclink;
- box2.parentID = id;
-
- // Get the targets
- var targets_elt = document.getElementById(targets_id);
- var targets = targets_elt.getAttribute("targets");
- var links = "";
- target_list = targets.split(",");
- for (var i=0; i<target_list.length; i++) {
- var target = target_list[i].split("=");
- links += "<li><a href='" + target[1] +
- "' style='text-decoration:none'>" +
- target[0] + "</a></li>";
- }
-
- // Put it all together.
- elt.insertBefore(box1, elt.childNodes.item(0));
- //box1.appendChild(box2);
- box1.appendChild(shadow);
- shadow.appendChild(box2);
- box2.innerHTML =
- "Which <b>"+name+"</b> do you want to see documentation for?" +
- "<ul style='margin-bottom: 0;'>" +
- links +
- "<li><a href='#' style='text-decoration:none' " +
- "onclick='kill_doclink(\""+id+"\");return false;'>"+
- "<i>None of the above</i></a></li></ul>";
- }
- return false;
-}
-
-function get_anchor() {
- var href = location.href;
- var start = href.indexOf("#")+1;
- if ((start != 0) && (start != href.length))
- return href.substring(start, href.length);
- }
-function redirect_url(dottedName) {
- // Scan through each element of the "pages" list, and check
- // if "name" matches with any of them.
- for (var i=0; i<pages.length; i++) {
-
- // Each page has the form "<pagename>-m" or "<pagename>-c";
- // extract the <pagename> portion & compare it to dottedName.
- var pagename = pages[i].substring(0, pages[i].length-2);
- if (pagename == dottedName.substring(0,pagename.length)) {
-
- // We've found a page that matches `dottedName`;
- // construct its URL, using leftover `dottedName`
- // content to form an anchor.
- var pagetype = pages[i].charAt(pages[i].length-1);
- var url = pagename + ((pagetype=="m")?"-module.html":
- "-class.html");
- if (dottedName.length > pagename.length)
- url += "#" + dottedName.substring(pagename.length+1,
- dottedName.length);
- return url;
- }
- }
- }
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/help.html b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/help.html
deleted file mode 100644
index d1bf1c8766d..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/help.html
+++ /dev/null
@@ -1,261 +0,0 @@
-<?xml version="1.0" encoding="ascii"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Help</title>
- <link rel="stylesheet" href="epydoc.css" type="text/css" />
- <script type="text/javascript" src="epydoc.js"></script>
-</head>
-
-<body bgcolor="white" text="black" link="blue" vlink="#204080"
- alink="#204080">
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="rcssmin-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Help&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rcssmin/" target="_top">Visit rcssmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-<table width="100%" cellpadding="0" cellspacing="0">
- <tr valign="top">
- <td width="100%">&nbsp;</td>
- <td>
- <table cellpadding="0" cellspacing="0">
- <!-- hide/show private -->
- </table>
- </td>
- </tr>
-</table>
-
-<h1 class="epydoc"> API Documentation </h1>
-
-<p> This document contains the API (Application Programming Interface)
-documentation for this project. Documentation for the Python
-objects defined by the project is divided into separate pages for each
-package, module, and class. The API documentation also includes two
-pages containing information about the project as a whole: a trees
-page, and an index page. </p>
-
-<h2> Object Documentation </h2>
-
- <p>Each <strong>Package Documentation</strong> page contains: </p>
- <ul>
- <li> A description of the package. </li>
- <li> A list of the modules and sub-packages contained by the
- package. </li>
- <li> A summary of the classes defined by the package. </li>
- <li> A summary of the functions defined by the package. </li>
- <li> A summary of the variables defined by the package. </li>
- <li> A detailed description of each function defined by the
- package. </li>
- <li> A detailed description of each variable defined by the
- package. </li>
- </ul>
-
- <p>Each <strong>Module Documentation</strong> page contains:</p>
- <ul>
- <li> A description of the module. </li>
- <li> A summary of the classes defined by the module. </li>
- <li> A summary of the functions defined by the module. </li>
- <li> A summary of the variables defined by the module. </li>
- <li> A detailed description of each function defined by the
- module. </li>
- <li> A detailed description of each variable defined by the
- module. </li>
- </ul>
-
- <p>Each <strong>Class Documentation</strong> page contains: </p>
- <ul>
- <li> A class inheritance diagram. </li>
- <li> A list of known subclasses. </li>
- <li> A description of the class. </li>
- <li> A summary of the methods defined by the class. </li>
- <li> A summary of the instance variables defined by the class. </li>
- <li> A summary of the class (static) variables defined by the
- class. </li>
- <li> A detailed description of each method defined by the
- class. </li>
- <li> A detailed description of each instance variable defined by the
- class. </li>
- <li> A detailed description of each class (static) variable defined
- by the class. </li>
- </ul>
-
-<h2> Project Documentation </h2>
-
- <p> The <strong>Trees</strong> page contains the module and class hierarchies: </p>
- <ul>
- <li> The <em>module hierarchy</em> lists every package and module, with
- modules grouped into packages. At the top level, and within each
- package, modules and sub-packages are listed alphabetically. </li>
- <li> The <em>class hierarchy</em> lists every class, grouped by base
- class. If a class has more than one base class, then it will be
- listed under each base class. At the top level, and under each base
- class, classes are listed alphabetically. </li>
- </ul>
-
- <p> The <strong>Index</strong> page contains indices of terms and
- identifiers: </p>
- <ul>
- <li> The <em>term index</em> lists every term indexed by any object's
- documentation. For each term, the index provides links to each
- place where the term is indexed. </li>
- <li> The <em>identifier index</em> lists the (short) name of every package,
- module, class, method, function, variable, and parameter. For each
- identifier, the index provides a short description, and a link to
- its documentation. </li>
- </ul>
-
-<h2> The Table of Contents </h2>
-
-<p> The table of contents occupies the two frames on the left side of
-the window. The upper-left frame displays the <em>project
-contents</em>, and the lower-left frame displays the <em>module
-contents</em>: </p>
-
-<table class="help summary" border="1" cellspacing="0" cellpadding="3">
- <tr style="height: 30%">
- <td align="center" style="font-size: small">
- Project<br />Contents<hr />...</td>
- <td align="center" style="font-size: small" rowspan="2" width="70%">
- API<br />Documentation<br />Frame<br /><br /><br />
- </td>
- </tr>
- <tr>
- <td align="center" style="font-size: small">
- Module<br />Contents<hr />&nbsp;<br />...<br />&nbsp;
- </td>
- </tr>
-</table><br />
-
-<p> The <strong>project contents frame</strong> contains a list of all packages
-and modules that are defined by the project. Clicking on an entry
-will display its contents in the module contents frame. Clicking on a
-special entry, labeled "Everything," will display the contents of
-the entire project. </p>
-
-<p> The <strong>module contents frame</strong> contains a list of every
-submodule, class, type, exception, function, and variable defined by a
-module or package. Clicking on an entry will display its
-documentation in the API documentation frame. Clicking on the name of
-the module, at the top of the frame, will display the documentation
-for the module itself. </p>
-
-<p> The "<strong>frames</strong>" and "<strong>no frames</strong>" buttons below the top
-navigation bar can be used to control whether the table of contents is
-displayed or not. </p>
-
-<h2> The Navigation Bar </h2>
-
-<p> A navigation bar is located at the top and bottom of every page.
-It indicates what type of page you are currently viewing, and allows
-you to go to related pages. The following table describes the labels
-on the navigation bar. Note that not some labels (such as
-[Parent]) are not displayed on all pages. </p>
-
-<table class="summary" border="1" cellspacing="0" cellpadding="3" width="100%">
-<tr class="summary">
- <th>Label</th>
- <th>Highlighted when...</th>
- <th>Links to...</th>
-</tr>
- <tr><td valign="top"><strong>[Parent]</strong></td>
- <td valign="top"><em>(never highlighted)</em></td>
- <td valign="top"> the parent of the current package </td></tr>
- <tr><td valign="top"><strong>[Package]</strong></td>
- <td valign="top">viewing a package</td>
- <td valign="top">the package containing the current object
- </td></tr>
- <tr><td valign="top"><strong>[Module]</strong></td>
- <td valign="top">viewing a module</td>
- <td valign="top">the module containing the current object
- </td></tr>
- <tr><td valign="top"><strong>[Class]</strong></td>
- <td valign="top">viewing a class </td>
- <td valign="top">the class containing the current object</td></tr>
- <tr><td valign="top"><strong>[Trees]</strong></td>
- <td valign="top">viewing the trees page</td>
- <td valign="top"> the trees page </td></tr>
- <tr><td valign="top"><strong>[Index]</strong></td>
- <td valign="top">viewing the index page</td>
- <td valign="top"> the index page </td></tr>
- <tr><td valign="top"><strong>[Help]</strong></td>
- <td valign="top">viewing the help page</td>
- <td valign="top"> the help page </td></tr>
-</table>
-
-<p> The "<strong>show private</strong>" and "<strong>hide private</strong>" buttons below
-the top navigation bar can be used to control whether documentation
-for private objects is displayed. Private objects are usually defined
-as objects whose (short) names begin with a single underscore, but do
-not end with an underscore. For example, "<code>_x</code>",
-"<code>__pprint</code>", and "<code>epydoc.epytext._tokenize</code>"
-are private objects; but "<code>re.sub</code>",
-"<code>__init__</code>", and "<code>type_</code>" are not. However,
-if a module defines the "<code>__all__</code>" variable, then its
-contents are used to decide which objects are private. </p>
-
-<p> A timestamp below the bottom navigation bar indicates when each
-page was last updated. </p>
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="rcssmin-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Help&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rcssmin/" target="_top">Visit rcssmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-
-<script type="text/javascript">
- <!--
- // Private objects are initially displayed (because if
- // javascript is turned off then we want them to be
- // visible); but by default, we want to hide them. So hide
- // them unless we have a cookie that says to show them.
- checkCookie();
- // -->
-</script>
-</body>
-</html>
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/identifier-index.html b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/identifier-index.html
deleted file mode 100644
index 82acafdbb7c..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/identifier-index.html
+++ /dev/null
@@ -1,163 +0,0 @@
-<?xml version="1.0" encoding="ascii"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Identifier Index</title>
- <link rel="stylesheet" href="epydoc.css" type="text/css" />
- <script type="text/javascript" src="epydoc.js"></script>
-</head>
-
-<body bgcolor="white" text="black" link="blue" vlink="#204080"
- alink="#204080">
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="rcssmin-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Indices&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rcssmin/" target="_top">Visit rcssmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-<table width="100%" cellpadding="0" cellspacing="0">
- <tr valign="top">
- <td width="100%">&nbsp;</td>
- <td>
- <table cellpadding="0" cellspacing="0">
- <!-- hide/show private -->
- </table>
- </td>
- </tr>
-</table>
-<table border="0" width="100%">
-<tr valign="bottom"><td>
-<h1 class="epydoc">Identifier Index</h1>
-</td><td>
-[
- A
- B
- <a href="#C">C</a>
- D
- E
- F
- G
- H
- I
- J
- K
- L
- M
- N
- O
- P
- Q
- <a href="#R">R</a>
- S
- T
- U
- V
- W
- X
- Y
- Z
- <a href="#_">_</a>
-]
-</td></table>
-<table border="0" width="100%">
-<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="C">C</a></h2></td>
-<td valign="top">
-<table class="link-index" width="100%" border="1">
-<tr>
-<td width="33%" class="link-index"><a href="rcssmin-module.html#cssmin">cssmin()</a><br />
-<span class="index-where">(in&nbsp;<a href="rcssmin-module.html">rcssmin</a>)</span></td>
-<td width="33%" class="link-index">&nbsp;</td>
-<td width="33%" class="link-index">&nbsp;</td>
-</tr>
-<tr><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td></tr>
-</table>
-</td></tr>
-<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="R">R</a></h2></td>
-<td valign="top">
-<table class="link-index" width="100%" border="1">
-<tr>
-<td width="33%" class="link-index"><a href="rcssmin-module.html">rcssmin</a></td>
-<td width="33%" class="link-index">&nbsp;</td>
-<td width="33%" class="link-index">&nbsp;</td>
-</tr>
-<tr><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td></tr>
-</table>
-</td></tr>
-<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="_">_</a></h2></td>
-<td valign="top">
-<table class="link-index" width="100%" border="1">
-<tr>
-<td width="33%" class="link-index"><a href="rcssmin-module.html#__doc__">__doc__</a><br />
-<span class="index-where">(in&nbsp;<a href="rcssmin-module.html">rcssmin</a>)</span></td>
-<td width="33%" class="link-index"><a href="rcssmin-module.html#__license__">__license__</a><br />
-<span class="index-where">(in&nbsp;<a href="rcssmin-module.html">rcssmin</a>)</span></td>
-<td width="33%" class="link-index"><a href="rcssmin-module.html#__package__">__package__</a><br />
-<span class="index-where">(in&nbsp;<a href="rcssmin-module.html">rcssmin</a>)</span></td>
-</tr>
-<tr><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td></tr>
-</table>
-</td></tr>
-</table>
-<br /><br /><!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="rcssmin-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Indices&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rcssmin/" target="_top">Visit rcssmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-
-<script type="text/javascript">
- <!--
- // Private objects are initially displayed (because if
- // javascript is turned off then we want them to be
- // visible); but by default, we want to hide them. So hide
- // them unless we have a cookie that says to show them.
- checkCookie();
- // -->
-</script>
-</body>
-</html>
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/index.html b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/index.html
deleted file mode 100644
index 84ffddda734..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/index.html
+++ /dev/null
@@ -1,224 +0,0 @@
-<?xml version="1.0" encoding="ascii"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>rcssmin</title>
- <link rel="stylesheet" href="epydoc.css" type="text/css" />
- <script type="text/javascript" src="epydoc.js"></script>
-</head>
-
-<body bgcolor="white" text="black" link="blue" vlink="#204080"
- alink="#204080">
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rcssmin/" target="_top">Visit rcssmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-<table width="100%" cellpadding="0" cellspacing="0">
- <tr valign="top">
- <td width="100%">
- <span class="breadcrumbs">
- Module&nbsp;rcssmin
- </span>
- </td>
- <td>
- <table cellpadding="0" cellspacing="0">
- <!-- hide/show private -->
- </table>
- </td>
- </tr>
-</table>
-<!-- ==================== MODULE DESCRIPTION ==================== -->
-<h1 class="epydoc">Module rcssmin</h1><p class="nomargin-top"><span class="codelink"><a href="rcssmin-pysrc.html">source&nbsp;code</a></span></p>
-<p>CSS Minifier.</p>
-<p>The minifier is based on the semantics of the <a class="rst-reference external" href="https://github.com/yui/yuicompressor/" target="_top">YUI compressor</a>, which
-itself is based on <a class="rst-reference external" href="https://github.com/isaacs/cssmin/" target="_top">the rule list by Isaac Schlueter</a>.</p>
-<p>This module is a re-implementation aiming for speed instead of maximum
-compression, so it can be used at runtime (rather than during a preprocessing
-step). RCSSmin does syntactical compression only (removing spaces, comments
-and possibly semicolons). It does not provide semantic compression (like
-removing empty blocks, collapsing redundant properties etc). It does, however,
-support various CSS hacks (by keeping them working as intended).</p>
-<p>Here's a feature list:</p>
-<ul class="rst-simple">
-<li>Strings are kept, except that escaped newlines are stripped</li>
-<li>Space/Comments before the very end or before various characters are
-stripped: <tt class="rst-docutils literal"><span class="pre">:{});=&gt;+],!</span></tt> (The colon (<tt class="rst-docutils literal">:</tt>) is a special case, a single
-space is kept if it's outside a ruleset.)</li>
-<li>Space/Comments at the very beginning or after various characters are
-stripped: <tt class="rst-docutils literal"><span class="pre">{}(=:&gt;+[,!</span></tt></li>
-<li>Optional space after unicode escapes is kept, resp. replaced by a simple
-space</li>
-<li>whitespaces inside <tt class="rst-docutils literal">url()</tt> definitions are stripped</li>
-<li>Comments starting with an exclamation mark (<tt class="rst-docutils literal">!</tt>) can be kept optionally.</li>
-<li>All other comments and/or whitespace characters are replaced by a single
-space.</li>
-<li>Multiple consecutive semicolons are reduced to one</li>
-<li>The last semicolon within a ruleset is stripped</li>
-<li>CSS Hacks supported:<ul>
-<li>IE7 hack (<tt class="rst-docutils literal"><span class="pre">&gt;/**/</span></tt>)</li>
-<li>Mac-IE5 hack (<tt class="rst-docutils literal"><span class="pre">/*\*/.../**/</span></tt>)</li>
-<li>The boxmodelhack is supported naturally because it relies on valid CSS2
-strings</li>
-<li>Between <tt class="rst-docutils literal"><span class="pre">:first-line</span></tt> and the following comma or curly brace a space is
-inserted. (apparently it's needed for IE6)</li>
-<li>Same for <tt class="rst-docutils literal"><span class="pre">:first-letter</span></tt></li>
-</ul>
-</li>
-</ul>
-<p>rcssmin.c is a reimplementation of rcssmin.py in C and improves runtime up to
-factor 100 or so (depending on the input). docs/BENCHMARKS in the source
-distribution contains the details.</p>
-<p>Both python 2 (&gt;= 2.4) and python 3 are supported.</p>
-
-<hr />
-<div class="fields"> <p><strong>Copyright:</strong>
- Copyright 2011 - 2014
-Andr&#233; Malo or his licensors, as applicable
- </p>
- <p><strong>License:</strong>
- <p>Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at</p>
-<blockquote>
-<a class="rst-reference external" href="http://www.apache.org/licenses/LICENSE-2.0" target="_top">http://www.apache.org/licenses/LICENSE-2.0</a></blockquote>
-<p>Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.</p>
- </p>
- <p><strong>Version:</strong>
- 1.0.5
- </p>
- <p><strong>Author:</strong>
- Andr&#233; Malo
- </p>
-</div><!-- ==================== FUNCTIONS ==================== -->
-<a name="section-Functions"></a>
-<table class="summary" border="1" cellpadding="3"
- cellspacing="0" width="100%" bgcolor="white">
-<tr bgcolor="#70b0f0" class="table-header">
- <td align="left" colspan="2" class="table-header">
- <span class="table-header">Functions</span></td>
-</tr>
-<tr>
- <td width="15%" align="right" valign="top" class="summary">
- <span class="summary-type"><tt class="rst-docutils literal">str</tt></span>
- </td><td class="summary">
- <table width="100%" cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td><span class="summary-sig"><a href="rcssmin-module.html#cssmin" class="summary-sig-name">cssmin</a>(<span class="summary-sig-arg">style</span>,
- <span class="summary-sig-arg">keep_bang_comments</span>=<span class="summary-sig-default">False</span>)</span><br />
- Minify CSS.</td>
- <td align="right" valign="top">
- <span class="codelink"><a href="rcssmin-pysrc.html#cssmin">source&nbsp;code</a></span>
-
- </td>
- </tr>
- </table>
-
- </td>
- </tr>
-</table>
-<!-- ==================== FUNCTION DETAILS ==================== -->
-<a name="section-FunctionDetails"></a>
-<table class="details" border="1" cellpadding="3"
- cellspacing="0" width="100%" bgcolor="white">
-<tr bgcolor="#70b0f0" class="table-header">
- <td align="left" colspan="2" class="table-header">
- <span class="table-header">Function Details</span></td>
-</tr>
-</table>
-<a name="cssmin"></a>
-<div>
-<table class="details" border="1" cellpadding="3"
- cellspacing="0" width="100%" bgcolor="white">
-<tr><td>
- <table width="100%" cellpadding="0" cellspacing="0" border="0">
- <tr valign="top"><td>
- <h3 class="epydoc"><span class="sig"><span class="sig-name">cssmin</span>(<span class="sig-arg">style</span>,
- <span class="sig-arg">keep_bang_comments</span>=<span class="sig-default">False</span>)</span>
- </h3>
- </td><td align="right" valign="top"
- ><span class="codelink"><a href="rcssmin-pysrc.html#cssmin">source&nbsp;code</a></span>&nbsp;
- </td>
- </tr></table>
-
- Minify CSS.
- <dl class="fields">
- <dt>Parameters:</dt>
- <dd><ul class="nomargin-top">
- <li><strong class="pname"><code>style</code></strong> (<tt class="rst-docutils literal">str</tt>) - CSS to minify</li>
- <li><strong class="pname"><code>keep_bang_comments</code></strong> (<tt class="rst-docutils literal">bool</tt>) - Keep comments starting with an exclamation mark? (<tt class="rst-docutils literal"><span class="pre">/*!...*/</span></tt>)</li>
- </ul></dd>
- <dt>Returns: <tt class="rst-docutils literal">str</tt></dt>
- <dd>Minified style</dd>
- </dl>
-</td></tr></table>
-</div>
-<br />
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rcssmin/" target="_top">Visit rcssmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-
-<script type="text/javascript">
- <!--
- // Private objects are initially displayed (because if
- // javascript is turned off then we want them to be
- // visible); but by default, we want to hide them. So hide
- // them unless we have a cookie that says to show them.
- checkCookie();
- // -->
-</script>
-</body>
-</html>
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/module-tree.html b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/module-tree.html
deleted file mode 100644
index e522dd1721b..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/module-tree.html
+++ /dev/null
@@ -1,94 +0,0 @@
-<?xml version="1.0" encoding="ascii"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Module Hierarchy</title>
- <link rel="stylesheet" href="epydoc.css" type="text/css" />
- <script type="text/javascript" src="epydoc.js"></script>
-</head>
-
-<body bgcolor="white" text="black" link="blue" vlink="#204080"
- alink="#204080">
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="rcssmin-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Trees&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rcssmin/" target="_top">Visit rcssmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-<table width="100%" cellpadding="0" cellspacing="0">
- <tr valign="top">
- <td width="100%">&nbsp;</td>
- <td>
- <table cellpadding="0" cellspacing="0">
- <!-- hide/show private -->
- </table>
- </td>
- </tr>
-</table>
-<h1 class="epydoc">Module Hierarchy</h1>
-<ul class="nomargin-top">
- <li> <strong class="uidlink"><a href="rcssmin-module.html">rcssmin</a></strong>: <em class="summary">CSS Minifier.</em> </li>
-</ul>
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="rcssmin-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Trees&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rcssmin/" target="_top">Visit rcssmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-
-<script type="text/javascript">
- <!--
- // Private objects are initially displayed (because if
- // javascript is turned off then we want them to be
- // visible); but by default, we want to hide them. So hide
- // them unless we have a cookie that says to show them.
- checkCookie();
- // -->
-</script>
-</body>
-</html>
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/rcssmin-module.html b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/rcssmin-module.html
deleted file mode 100644
index 84ffddda734..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/rcssmin-module.html
+++ /dev/null
@@ -1,224 +0,0 @@
-<?xml version="1.0" encoding="ascii"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>rcssmin</title>
- <link rel="stylesheet" href="epydoc.css" type="text/css" />
- <script type="text/javascript" src="epydoc.js"></script>
-</head>
-
-<body bgcolor="white" text="black" link="blue" vlink="#204080"
- alink="#204080">
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rcssmin/" target="_top">Visit rcssmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-<table width="100%" cellpadding="0" cellspacing="0">
- <tr valign="top">
- <td width="100%">
- <span class="breadcrumbs">
- Module&nbsp;rcssmin
- </span>
- </td>
- <td>
- <table cellpadding="0" cellspacing="0">
- <!-- hide/show private -->
- </table>
- </td>
- </tr>
-</table>
-<!-- ==================== MODULE DESCRIPTION ==================== -->
-<h1 class="epydoc">Module rcssmin</h1><p class="nomargin-top"><span class="codelink"><a href="rcssmin-pysrc.html">source&nbsp;code</a></span></p>
-<p>CSS Minifier.</p>
-<p>The minifier is based on the semantics of the <a class="rst-reference external" href="https://github.com/yui/yuicompressor/" target="_top">YUI compressor</a>, which
-itself is based on <a class="rst-reference external" href="https://github.com/isaacs/cssmin/" target="_top">the rule list by Isaac Schlueter</a>.</p>
-<p>This module is a re-implementation aiming for speed instead of maximum
-compression, so it can be used at runtime (rather than during a preprocessing
-step). RCSSmin does syntactical compression only (removing spaces, comments
-and possibly semicolons). It does not provide semantic compression (like
-removing empty blocks, collapsing redundant properties etc). It does, however,
-support various CSS hacks (by keeping them working as intended).</p>
-<p>Here's a feature list:</p>
-<ul class="rst-simple">
-<li>Strings are kept, except that escaped newlines are stripped</li>
-<li>Space/Comments before the very end or before various characters are
-stripped: <tt class="rst-docutils literal"><span class="pre">:{});=&gt;+],!</span></tt> (The colon (<tt class="rst-docutils literal">:</tt>) is a special case, a single
-space is kept if it's outside a ruleset.)</li>
-<li>Space/Comments at the very beginning or after various characters are
-stripped: <tt class="rst-docutils literal"><span class="pre">{}(=:&gt;+[,!</span></tt></li>
-<li>Optional space after unicode escapes is kept, resp. replaced by a simple
-space</li>
-<li>whitespaces inside <tt class="rst-docutils literal">url()</tt> definitions are stripped</li>
-<li>Comments starting with an exclamation mark (<tt class="rst-docutils literal">!</tt>) can be kept optionally.</li>
-<li>All other comments and/or whitespace characters are replaced by a single
-space.</li>
-<li>Multiple consecutive semicolons are reduced to one</li>
-<li>The last semicolon within a ruleset is stripped</li>
-<li>CSS Hacks supported:<ul>
-<li>IE7 hack (<tt class="rst-docutils literal"><span class="pre">&gt;/**/</span></tt>)</li>
-<li>Mac-IE5 hack (<tt class="rst-docutils literal"><span class="pre">/*\*/.../**/</span></tt>)</li>
-<li>The boxmodelhack is supported naturally because it relies on valid CSS2
-strings</li>
-<li>Between <tt class="rst-docutils literal"><span class="pre">:first-line</span></tt> and the following comma or curly brace a space is
-inserted. (apparently it's needed for IE6)</li>
-<li>Same for <tt class="rst-docutils literal"><span class="pre">:first-letter</span></tt></li>
-</ul>
-</li>
-</ul>
-<p>rcssmin.c is a reimplementation of rcssmin.py in C and improves runtime up to
-factor 100 or so (depending on the input). docs/BENCHMARKS in the source
-distribution contains the details.</p>
-<p>Both python 2 (&gt;= 2.4) and python 3 are supported.</p>
-
-<hr />
-<div class="fields"> <p><strong>Copyright:</strong>
- Copyright 2011 - 2014
-Andr&#233; Malo or his licensors, as applicable
- </p>
- <p><strong>License:</strong>
- <p>Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at</p>
-<blockquote>
-<a class="rst-reference external" href="http://www.apache.org/licenses/LICENSE-2.0" target="_top">http://www.apache.org/licenses/LICENSE-2.0</a></blockquote>
-<p>Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.</p>
- </p>
- <p><strong>Version:</strong>
- 1.0.5
- </p>
- <p><strong>Author:</strong>
- Andr&#233; Malo
- </p>
-</div><!-- ==================== FUNCTIONS ==================== -->
-<a name="section-Functions"></a>
-<table class="summary" border="1" cellpadding="3"
- cellspacing="0" width="100%" bgcolor="white">
-<tr bgcolor="#70b0f0" class="table-header">
- <td align="left" colspan="2" class="table-header">
- <span class="table-header">Functions</span></td>
-</tr>
-<tr>
- <td width="15%" align="right" valign="top" class="summary">
- <span class="summary-type"><tt class="rst-docutils literal">str</tt></span>
- </td><td class="summary">
- <table width="100%" cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td><span class="summary-sig"><a href="rcssmin-module.html#cssmin" class="summary-sig-name">cssmin</a>(<span class="summary-sig-arg">style</span>,
- <span class="summary-sig-arg">keep_bang_comments</span>=<span class="summary-sig-default">False</span>)</span><br />
- Minify CSS.</td>
- <td align="right" valign="top">
- <span class="codelink"><a href="rcssmin-pysrc.html#cssmin">source&nbsp;code</a></span>
-
- </td>
- </tr>
- </table>
-
- </td>
- </tr>
-</table>
-<!-- ==================== FUNCTION DETAILS ==================== -->
-<a name="section-FunctionDetails"></a>
-<table class="details" border="1" cellpadding="3"
- cellspacing="0" width="100%" bgcolor="white">
-<tr bgcolor="#70b0f0" class="table-header">
- <td align="left" colspan="2" class="table-header">
- <span class="table-header">Function Details</span></td>
-</tr>
-</table>
-<a name="cssmin"></a>
-<div>
-<table class="details" border="1" cellpadding="3"
- cellspacing="0" width="100%" bgcolor="white">
-<tr><td>
- <table width="100%" cellpadding="0" cellspacing="0" border="0">
- <tr valign="top"><td>
- <h3 class="epydoc"><span class="sig"><span class="sig-name">cssmin</span>(<span class="sig-arg">style</span>,
- <span class="sig-arg">keep_bang_comments</span>=<span class="sig-default">False</span>)</span>
- </h3>
- </td><td align="right" valign="top"
- ><span class="codelink"><a href="rcssmin-pysrc.html#cssmin">source&nbsp;code</a></span>&nbsp;
- </td>
- </tr></table>
-
- Minify CSS.
- <dl class="fields">
- <dt>Parameters:</dt>
- <dd><ul class="nomargin-top">
- <li><strong class="pname"><code>style</code></strong> (<tt class="rst-docutils literal">str</tt>) - CSS to minify</li>
- <li><strong class="pname"><code>keep_bang_comments</code></strong> (<tt class="rst-docutils literal">bool</tt>) - Keep comments starting with an exclamation mark? (<tt class="rst-docutils literal"><span class="pre">/*!...*/</span></tt>)</li>
- </ul></dd>
- <dt>Returns: <tt class="rst-docutils literal">str</tt></dt>
- <dd>Minified style</dd>
- </dl>
-</td></tr></table>
-</div>
-<br />
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rcssmin/" target="_top">Visit rcssmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-
-<script type="text/javascript">
- <!--
- // Private objects are initially displayed (because if
- // javascript is turned off then we want them to be
- // visible); but by default, we want to hide them. So hide
- // them unless we have a cookie that says to show them.
- checkCookie();
- // -->
-</script>
-</body>
-</html>
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/rcssmin-pysrc.html b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/rcssmin-pysrc.html
deleted file mode 100644
index 6856baca0e6..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/rcssmin-pysrc.html
+++ /dev/null
@@ -1,477 +0,0 @@
-<?xml version="1.0" encoding="ascii"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>rcssmin</title>
- <link rel="stylesheet" href="epydoc.css" type="text/css" />
- <script type="text/javascript" src="epydoc.js"></script>
-</head>
-
-<body bgcolor="white" text="black" link="blue" vlink="#204080"
- alink="#204080">
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rcssmin/" target="_top">Visit rcssmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-<table width="100%" cellpadding="0" cellspacing="0">
- <tr valign="top">
- <td width="100%">
- <span class="breadcrumbs">
- Module&nbsp;rcssmin
- </span>
- </td>
- <td>
- <table cellpadding="0" cellspacing="0">
- <!-- hide/show private -->
- </table>
- </td>
- </tr>
-</table>
-<h1 class="epydoc">Source Code for <a href="rcssmin-module.html">Module rcssmin</a></h1>
-<pre class="py-src">
-<a name="L1"></a><tt class="py-lineno"> 1</tt> <tt class="py-line"><tt class="py-comment">#!/usr/bin/env python</tt> </tt>
-<a name="L2"></a><tt class="py-lineno"> 2</tt> <tt class="py-line"><tt class="py-comment"># -*- coding: ascii -*-</tt> </tt>
-<a name="L3"></a><tt class="py-lineno"> 3</tt> <tt class="py-line"><tt class="py-docstring">r"""</tt> </tt>
-<a name="L4"></a><tt class="py-lineno"> 4</tt> <tt class="py-line"><tt class="py-docstring">==============</tt> </tt>
-<a name="L5"></a><tt class="py-lineno"> 5</tt> <tt class="py-line"><tt class="py-docstring"> CSS Minifier</tt> </tt>
-<a name="L6"></a><tt class="py-lineno"> 6</tt> <tt class="py-line"><tt class="py-docstring">==============</tt> </tt>
-<a name="L7"></a><tt class="py-lineno"> 7</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L8"></a><tt class="py-lineno"> 8</tt> <tt class="py-line"><tt class="py-docstring">CSS Minifier.</tt> </tt>
-<a name="L9"></a><tt class="py-lineno"> 9</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L10"></a><tt class="py-lineno"> 10</tt> <tt class="py-line"><tt class="py-docstring">The minifier is based on the semantics of the `YUI compressor`_\\, which</tt> </tt>
-<a name="L11"></a><tt class="py-lineno"> 11</tt> <tt class="py-line"><tt class="py-docstring">itself is based on `the rule list by Isaac Schlueter`_\\.</tt> </tt>
-<a name="L12"></a><tt class="py-lineno"> 12</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L13"></a><tt class="py-lineno"> 13</tt> <tt class="py-line"><tt class="py-docstring">:Copyright:</tt> </tt>
-<a name="L14"></a><tt class="py-lineno"> 14</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L15"></a><tt class="py-lineno"> 15</tt> <tt class="py-line"><tt class="py-docstring"> Copyright 2011 - 2014</tt> </tt>
-<a name="L16"></a><tt class="py-lineno"> 16</tt> <tt class="py-line"><tt class="py-docstring"> Andr\xe9 Malo or his licensors, as applicable</tt> </tt>
-<a name="L17"></a><tt class="py-lineno"> 17</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L18"></a><tt class="py-lineno"> 18</tt> <tt class="py-line"><tt class="py-docstring">:License:</tt> </tt>
-<a name="L19"></a><tt class="py-lineno"> 19</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L20"></a><tt class="py-lineno"> 20</tt> <tt class="py-line"><tt class="py-docstring"> Licensed under the Apache License, Version 2.0 (the "License");</tt> </tt>
-<a name="L21"></a><tt class="py-lineno"> 21</tt> <tt class="py-line"><tt class="py-docstring"> you may not use this file except in compliance with the License.</tt> </tt>
-<a name="L22"></a><tt class="py-lineno"> 22</tt> <tt class="py-line"><tt class="py-docstring"> You may obtain a copy of the License at</tt> </tt>
-<a name="L23"></a><tt class="py-lineno"> 23</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L24"></a><tt class="py-lineno"> 24</tt> <tt class="py-line"><tt class="py-docstring"> http://www.apache.org/licenses/LICENSE-2.0</tt> </tt>
-<a name="L25"></a><tt class="py-lineno"> 25</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L26"></a><tt class="py-lineno"> 26</tt> <tt class="py-line"><tt class="py-docstring"> Unless required by applicable law or agreed to in writing, software</tt> </tt>
-<a name="L27"></a><tt class="py-lineno"> 27</tt> <tt class="py-line"><tt class="py-docstring"> distributed under the License is distributed on an "AS IS" BASIS,</tt> </tt>
-<a name="L28"></a><tt class="py-lineno"> 28</tt> <tt class="py-line"><tt class="py-docstring"> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</tt> </tt>
-<a name="L29"></a><tt class="py-lineno"> 29</tt> <tt class="py-line"><tt class="py-docstring"> See the License for the specific language governing permissions and</tt> </tt>
-<a name="L30"></a><tt class="py-lineno"> 30</tt> <tt class="py-line"><tt class="py-docstring"> limitations under the License.</tt> </tt>
-<a name="L31"></a><tt class="py-lineno"> 31</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L32"></a><tt class="py-lineno"> 32</tt> <tt class="py-line"><tt class="py-docstring">This module is a re-implementation aiming for speed instead of maximum</tt> </tt>
-<a name="L33"></a><tt class="py-lineno"> 33</tt> <tt class="py-line"><tt class="py-docstring">compression, so it can be used at runtime (rather than during a preprocessing</tt> </tt>
-<a name="L34"></a><tt class="py-lineno"> 34</tt> <tt class="py-line"><tt class="py-docstring">step). RCSSmin does syntactical compression only (removing spaces, comments</tt> </tt>
-<a name="L35"></a><tt class="py-lineno"> 35</tt> <tt class="py-line"><tt class="py-docstring">and possibly semicolons). It does not provide semantic compression (like</tt> </tt>
-<a name="L36"></a><tt class="py-lineno"> 36</tt> <tt class="py-line"><tt class="py-docstring">removing empty blocks, collapsing redundant properties etc). It does, however,</tt> </tt>
-<a name="L37"></a><tt class="py-lineno"> 37</tt> <tt class="py-line"><tt class="py-docstring">support various CSS hacks (by keeping them working as intended).</tt> </tt>
-<a name="L38"></a><tt class="py-lineno"> 38</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L39"></a><tt class="py-lineno"> 39</tt> <tt class="py-line"><tt class="py-docstring">Here's a feature list:</tt> </tt>
-<a name="L40"></a><tt class="py-lineno"> 40</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L41"></a><tt class="py-lineno"> 41</tt> <tt class="py-line"><tt class="py-docstring">- Strings are kept, except that escaped newlines are stripped</tt> </tt>
-<a name="L42"></a><tt class="py-lineno"> 42</tt> <tt class="py-line"><tt class="py-docstring">- Space/Comments before the very end or before various characters are</tt> </tt>
-<a name="L43"></a><tt class="py-lineno"> 43</tt> <tt class="py-line"><tt class="py-docstring"> stripped: ``:{});=&gt;+],!`` (The colon (``:``) is a special case, a single</tt> </tt>
-<a name="L44"></a><tt class="py-lineno"> 44</tt> <tt class="py-line"><tt class="py-docstring"> space is kept if it's outside a ruleset.)</tt> </tt>
-<a name="L45"></a><tt class="py-lineno"> 45</tt> <tt class="py-line"><tt class="py-docstring">- Space/Comments at the very beginning or after various characters are</tt> </tt>
-<a name="L46"></a><tt class="py-lineno"> 46</tt> <tt class="py-line"><tt class="py-docstring"> stripped: ``{}(=:&gt;+[,!``</tt> </tt>
-<a name="L47"></a><tt class="py-lineno"> 47</tt> <tt class="py-line"><tt class="py-docstring">- Optional space after unicode escapes is kept, resp. replaced by a simple</tt> </tt>
-<a name="L48"></a><tt class="py-lineno"> 48</tt> <tt class="py-line"><tt class="py-docstring"> space</tt> </tt>
-<a name="L49"></a><tt class="py-lineno"> 49</tt> <tt class="py-line"><tt class="py-docstring">- whitespaces inside ``url()`` definitions are stripped</tt> </tt>
-<a name="L50"></a><tt class="py-lineno"> 50</tt> <tt class="py-line"><tt class="py-docstring">- Comments starting with an exclamation mark (``!``) can be kept optionally.</tt> </tt>
-<a name="L51"></a><tt class="py-lineno"> 51</tt> <tt class="py-line"><tt class="py-docstring">- All other comments and/or whitespace characters are replaced by a single</tt> </tt>
-<a name="L52"></a><tt class="py-lineno"> 52</tt> <tt class="py-line"><tt class="py-docstring"> space.</tt> </tt>
-<a name="L53"></a><tt class="py-lineno"> 53</tt> <tt class="py-line"><tt class="py-docstring">- Multiple consecutive semicolons are reduced to one</tt> </tt>
-<a name="L54"></a><tt class="py-lineno"> 54</tt> <tt class="py-line"><tt class="py-docstring">- The last semicolon within a ruleset is stripped</tt> </tt>
-<a name="L55"></a><tt class="py-lineno"> 55</tt> <tt class="py-line"><tt class="py-docstring">- CSS Hacks supported:</tt> </tt>
-<a name="L56"></a><tt class="py-lineno"> 56</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L57"></a><tt class="py-lineno"> 57</tt> <tt class="py-line"><tt class="py-docstring"> - IE7 hack (``&gt;/**/``)</tt> </tt>
-<a name="L58"></a><tt class="py-lineno"> 58</tt> <tt class="py-line"><tt class="py-docstring"> - Mac-IE5 hack (``/*\\*/.../**/``)</tt> </tt>
-<a name="L59"></a><tt class="py-lineno"> 59</tt> <tt class="py-line"><tt class="py-docstring"> - The boxmodelhack is supported naturally because it relies on valid CSS2</tt> </tt>
-<a name="L60"></a><tt class="py-lineno"> 60</tt> <tt class="py-line"><tt class="py-docstring"> strings</tt> </tt>
-<a name="L61"></a><tt class="py-lineno"> 61</tt> <tt class="py-line"><tt class="py-docstring"> - Between ``:first-line`` and the following comma or curly brace a space is</tt> </tt>
-<a name="L62"></a><tt class="py-lineno"> 62</tt> <tt class="py-line"><tt class="py-docstring"> inserted. (apparently it's needed for IE6)</tt> </tt>
-<a name="L63"></a><tt class="py-lineno"> 63</tt> <tt class="py-line"><tt class="py-docstring"> - Same for ``:first-letter``</tt> </tt>
-<a name="L64"></a><tt class="py-lineno"> 64</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L65"></a><tt class="py-lineno"> 65</tt> <tt class="py-line"><tt class="py-docstring">rcssmin.c is a reimplementation of rcssmin.py in C and improves runtime up to</tt> </tt>
-<a name="L66"></a><tt class="py-lineno"> 66</tt> <tt class="py-line"><tt class="py-docstring">factor 100 or so (depending on the input). docs/BENCHMARKS in the source</tt> </tt>
-<a name="L67"></a><tt class="py-lineno"> 67</tt> <tt class="py-line"><tt class="py-docstring">distribution contains the details.</tt> </tt>
-<a name="L68"></a><tt class="py-lineno"> 68</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L69"></a><tt class="py-lineno"> 69</tt> <tt class="py-line"><tt class="py-docstring">Both python 2 (&gt;= 2.4) and python 3 are supported.</tt> </tt>
-<a name="L70"></a><tt class="py-lineno"> 70</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L71"></a><tt class="py-lineno"> 71</tt> <tt class="py-line"><tt class="py-docstring">.. _YUI compressor: https://github.com/yui/yuicompressor/</tt> </tt>
-<a name="L72"></a><tt class="py-lineno"> 72</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L73"></a><tt class="py-lineno"> 73</tt> <tt class="py-line"><tt class="py-docstring">.. _the rule list by Isaac Schlueter: https://github.com/isaacs/cssmin/</tt> </tt>
-<a name="L74"></a><tt class="py-lineno"> 74</tt> <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
-<a name="L75"></a><tt class="py-lineno"> 75</tt> <tt class="py-line"><tt class="py-keyword">if</tt> <tt id="link-0" class="py-name" targets="Variable rcssmin.__doc__=rcssmin-module.html#__doc__"><a title="rcssmin.__doc__" class="py-name" href="#" onclick="return doclink('link-0', '__doc__', 'link-0');">__doc__</a></tt><tt class="py-op">:</tt> </tt>
-<a name="L76"></a><tt class="py-lineno"> 76</tt> <tt class="py-line"> <tt class="py-comment"># pylint: disable = W0622</tt> </tt>
-<a name="L77"></a><tt class="py-lineno"> 77</tt> <tt class="py-line"> <tt id="link-1" class="py-name"><a title="rcssmin.__doc__" class="py-name" href="#" onclick="return doclink('link-1', '__doc__', 'link-0');">__doc__</a></tt> <tt class="py-op">=</tt> <tt id="link-2" class="py-name"><a title="rcssmin.__doc__" class="py-name" href="#" onclick="return doclink('link-2', '__doc__', 'link-0');">__doc__</a></tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'ascii'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">decode</tt><tt class="py-op">(</tt><tt class="py-string">'unicode_escape'</tt><tt class="py-op">)</tt> </tt>
-<a name="L78"></a><tt class="py-lineno"> 78</tt> <tt class="py-line"><tt class="py-name">__author__</tt> <tt class="py-op">=</tt> <tt class="py-string">r"Andr\xe9 Malo"</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'ascii'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">decode</tt><tt class="py-op">(</tt><tt class="py-string">'unicode_escape'</tt><tt class="py-op">)</tt> </tt>
-<a name="L79"></a><tt class="py-lineno"> 79</tt> <tt class="py-line"><tt class="py-name">__docformat__</tt> <tt class="py-op">=</tt> <tt class="py-string">"restructuredtext en"</tt> </tt>
-<a name="L80"></a><tt class="py-lineno"> 80</tt> <tt class="py-line"><tt id="link-3" class="py-name" targets="Variable rcssmin.__license__=rcssmin-module.html#__license__"><a title="rcssmin.__license__" class="py-name" href="#" onclick="return doclink('link-3', '__license__', 'link-3');">__license__</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"Apache License, Version 2.0"</tt> </tt>
-<a name="L81"></a><tt class="py-lineno"> 81</tt> <tt class="py-line"><tt class="py-name">__version__</tt> <tt class="py-op">=</tt> <tt class="py-string">'1.0.5'</tt> </tt>
-<a name="L82"></a><tt class="py-lineno"> 82</tt> <tt class="py-line"><tt class="py-name">__all__</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-string">'cssmin'</tt><tt class="py-op">]</tt> </tt>
-<a name="L83"></a><tt class="py-lineno"> 83</tt> <tt class="py-line"> </tt>
-<a name="L84"></a><tt class="py-lineno"> 84</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">re</tt> <tt class="py-keyword">as</tt> <tt class="py-name">_re</tt> </tt>
-<a name="L85"></a><tt class="py-lineno"> 85</tt> <tt class="py-line"> </tt>
-<a name="L86"></a><tt class="py-lineno"> 86</tt> <tt class="py-line"> </tt>
-<a name="_make_cssmin"></a><div id="_make_cssmin-def"><a name="L87"></a><tt class="py-lineno"> 87</tt> <a class="py-toggle" href="#" id="_make_cssmin-toggle" onclick="return toggle('_make_cssmin');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="rcssmin-module.html#_make_cssmin">_make_cssmin</a><tt class="py-op">(</tt><tt class="py-param">python_only</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-</div><div id="_make_cssmin-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_make_cssmin-expanded"><a name="L88"></a><tt class="py-lineno"> 88</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt>
-<a name="L89"></a><tt class="py-lineno"> 89</tt> <tt class="py-line"><tt class="py-docstring"> Generate CSS minifier.</tt> </tt>
-<a name="L90"></a><tt class="py-lineno"> 90</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L91"></a><tt class="py-lineno"> 91</tt> <tt class="py-line"><tt class="py-docstring"> :Parameters:</tt> </tt>
-<a name="L92"></a><tt class="py-lineno"> 92</tt> <tt class="py-line"><tt class="py-docstring"> `python_only` : ``bool``</tt> </tt>
-<a name="L93"></a><tt class="py-lineno"> 93</tt> <tt class="py-line"><tt class="py-docstring"> Use only the python variant. If true, the c extension is not even</tt> </tt>
-<a name="L94"></a><tt class="py-lineno"> 94</tt> <tt class="py-line"><tt class="py-docstring"> tried to be loaded.</tt> </tt>
-<a name="L95"></a><tt class="py-lineno"> 95</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L96"></a><tt class="py-lineno"> 96</tt> <tt class="py-line"><tt class="py-docstring"> :Return: Minifier</tt> </tt>
-<a name="L97"></a><tt class="py-lineno"> 97</tt> <tt class="py-line"><tt class="py-docstring"> :Rtype: ``callable``</tt> </tt>
-<a name="L98"></a><tt class="py-lineno"> 98</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
-<a name="L99"></a><tt class="py-lineno"> 99</tt> <tt class="py-line"> <tt class="py-comment"># pylint: disable = R0912, R0914, W0612</tt> </tt>
-<a name="L100"></a><tt class="py-lineno">100</tt> <tt class="py-line"> </tt>
-<a name="L101"></a><tt class="py-lineno">101</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">python_only</tt><tt class="py-op">:</tt> </tt>
-<a name="L102"></a><tt class="py-lineno">102</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
-<a name="L103"></a><tt class="py-lineno">103</tt> <tt class="py-line"> <tt class="py-keyword">import</tt> <tt class="py-name">_rcssmin</tt> </tt>
-<a name="L104"></a><tt class="py-lineno">104</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt>
-<a name="L105"></a><tt class="py-lineno">105</tt> <tt class="py-line"> <tt class="py-keyword">pass</tt> </tt>
-<a name="L106"></a><tt class="py-lineno">106</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
-<a name="L107"></a><tt class="py-lineno">107</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">_rcssmin</tt><tt class="py-op">.</tt><tt id="link-4" class="py-name" targets="Function rcssmin.cssmin()=rcssmin-module.html#cssmin"><a title="rcssmin.cssmin" class="py-name" href="#" onclick="return doclink('link-4', 'cssmin', 'link-4');">cssmin</a></tt> </tt>
-<a name="L108"></a><tt class="py-lineno">108</tt> <tt class="py-line"> </tt>
-<a name="L109"></a><tt class="py-lineno">109</tt> <tt class="py-line"> <tt class="py-name">nl</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:[\n\f]|\r\n?)'</tt> <tt class="py-comment"># pylint: disable = C0103</tt> </tt>
-<a name="L110"></a><tt class="py-lineno">110</tt> <tt class="py-line"> <tt class="py-name">spacechar</tt> <tt class="py-op">=</tt> <tt class="py-string">r'[\r\n\f\040\t]'</tt> </tt>
-<a name="L111"></a><tt class="py-lineno">111</tt> <tt class="py-line"> </tt>
-<a name="L112"></a><tt class="py-lineno">112</tt> <tt class="py-line"> <tt class="py-name">unicoded</tt> <tt class="py-op">=</tt> <tt class="py-string">r'[0-9a-fA-F]{1,6}(?:[\040\n\t\f]|\r\n?)?'</tt> </tt>
-<a name="L113"></a><tt class="py-lineno">113</tt> <tt class="py-line"> <tt class="py-name">escaped</tt> <tt class="py-op">=</tt> <tt class="py-string">r'[^\n\r\f0-9a-fA-F]'</tt> </tt>
-<a name="L114"></a><tt class="py-lineno">114</tt> <tt class="py-line"> <tt class="py-name">escape</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:\\(?:%(unicoded)s|%(escaped)s))'</tt> <tt class="py-op">%</tt> <tt class="py-name">locals</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-<a name="L115"></a><tt class="py-lineno">115</tt> <tt class="py-line"> </tt>
-<a name="L116"></a><tt class="py-lineno">116</tt> <tt class="py-line"> <tt class="py-name">nmchar</tt> <tt class="py-op">=</tt> <tt class="py-string">r'[^\000-\054\056\057\072-\100\133-\136\140\173-\177]'</tt> </tt>
-<a name="L117"></a><tt class="py-lineno">117</tt> <tt class="py-line"> <tt class="py-comment">#nmstart = r'[^\000-\100\133-\136\140\173-\177]'</tt> </tt>
-<a name="L118"></a><tt class="py-lineno">118</tt> <tt class="py-line"> <tt class="py-comment">#ident = (r'(?:'</tt> </tt>
-<a name="L119"></a><tt class="py-lineno">119</tt> <tt class="py-line"> <tt class="py-comment"># r'-?(?:%(nmstart)s|%(escape)s)%(nmchar)s*(?:%(escape)s%(nmchar)s*)*'</tt> </tt>
-<a name="L120"></a><tt class="py-lineno">120</tt> <tt class="py-line"> <tt class="py-comment">#r')') % locals()</tt> </tt>
-<a name="L121"></a><tt class="py-lineno">121</tt> <tt class="py-line"> </tt>
-<a name="L122"></a><tt class="py-lineno">122</tt> <tt class="py-line"> <tt class="py-name">comment</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)'</tt> </tt>
-<a name="L123"></a><tt class="py-lineno">123</tt> <tt class="py-line"> </tt>
-<a name="L124"></a><tt class="py-lineno">124</tt> <tt class="py-line"> <tt class="py-comment"># only for specific purposes. The bang is grouped:</tt> </tt>
-<a name="L125"></a><tt class="py-lineno">125</tt> <tt class="py-line"> <tt class="py-name">_bang_comment</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:/\*(!?)[^*]*\*+(?:[^/*][^*]*\*+)*/)'</tt> </tt>
-<a name="L126"></a><tt class="py-lineno">126</tt> <tt class="py-line"> </tt>
-<a name="L127"></a><tt class="py-lineno">127</tt> <tt class="py-line"> <tt class="py-name">string1</tt> <tt class="py-op">=</tt> \ </tt>
-<a name="L128"></a><tt class="py-lineno">128</tt> <tt class="py-line"> <tt class="py-string">r'(?:\047[^\047\\\r\n\f]*(?:\\[^\r\n\f][^\047\\\r\n\f]*)*\047)'</tt> </tt>
-<a name="L129"></a><tt class="py-lineno">129</tt> <tt class="py-line"> <tt class="py-name">string2</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:"[^"\\\r\n\f]*(?:\\[^\r\n\f][^"\\\r\n\f]*)*")'</tt> </tt>
-<a name="L130"></a><tt class="py-lineno">130</tt> <tt class="py-line"> <tt class="py-name">strings</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:%s|%s)'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">string1</tt><tt class="py-op">,</tt> <tt class="py-name">string2</tt><tt class="py-op">)</tt> </tt>
-<a name="L131"></a><tt class="py-lineno">131</tt> <tt class="py-line"> </tt>
-<a name="L132"></a><tt class="py-lineno">132</tt> <tt class="py-line"> <tt class="py-name">nl_string1</tt> <tt class="py-op">=</tt> \ </tt>
-<a name="L133"></a><tt class="py-lineno">133</tt> <tt class="py-line"> <tt class="py-string">r'(?:\047[^\047\\\r\n\f]*(?:\\(?:[^\r]|\r\n?)[^\047\\\r\n\f]*)*\047)'</tt> </tt>
-<a name="L134"></a><tt class="py-lineno">134</tt> <tt class="py-line"> <tt class="py-name">nl_string2</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:"[^"\\\r\n\f]*(?:\\(?:[^\r]|\r\n?)[^"\\\r\n\f]*)*")'</tt> </tt>
-<a name="L135"></a><tt class="py-lineno">135</tt> <tt class="py-line"> <tt class="py-name">nl_strings</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:%s|%s)'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">nl_string1</tt><tt class="py-op">,</tt> <tt class="py-name">nl_string2</tt><tt class="py-op">)</tt> </tt>
-<a name="L136"></a><tt class="py-lineno">136</tt> <tt class="py-line"> </tt>
-<a name="L137"></a><tt class="py-lineno">137</tt> <tt class="py-line"> <tt class="py-name">uri_nl_string1</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:\047[^\047\\]*(?:\\(?:[^\r]|\r\n?)[^\047\\]*)*\047)'</tt> </tt>
-<a name="L138"></a><tt class="py-lineno">138</tt> <tt class="py-line"> <tt class="py-name">uri_nl_string2</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:"[^"\\]*(?:\\(?:[^\r]|\r\n?)[^"\\]*)*")'</tt> </tt>
-<a name="L139"></a><tt class="py-lineno">139</tt> <tt class="py-line"> <tt class="py-name">uri_nl_strings</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:%s|%s)'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">uri_nl_string1</tt><tt class="py-op">,</tt> <tt class="py-name">uri_nl_string2</tt><tt class="py-op">)</tt> </tt>
-<a name="L140"></a><tt class="py-lineno">140</tt> <tt class="py-line"> </tt>
-<a name="L141"></a><tt class="py-lineno">141</tt> <tt class="py-line"> <tt class="py-name">nl_escaped</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:\\%(nl)s)'</tt> <tt class="py-op">%</tt> <tt class="py-name">locals</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-<a name="L142"></a><tt class="py-lineno">142</tt> <tt class="py-line"> </tt>
-<a name="L143"></a><tt class="py-lineno">143</tt> <tt class="py-line"> <tt class="py-name">space</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:%(spacechar)s|%(comment)s)'</tt> <tt class="py-op">%</tt> <tt class="py-name">locals</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-<a name="L144"></a><tt class="py-lineno">144</tt> <tt class="py-line"> </tt>
-<a name="L145"></a><tt class="py-lineno">145</tt> <tt class="py-line"> <tt class="py-name">ie7hack</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:&gt;/\*\*/)'</tt> </tt>
-<a name="L146"></a><tt class="py-lineno">146</tt> <tt class="py-line"> </tt>
-<a name="L147"></a><tt class="py-lineno">147</tt> <tt class="py-line"> <tt class="py-name">uri</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt><tt class="py-string">r'(?:'</tt> </tt>
-<a name="L148"></a><tt class="py-lineno">148</tt> <tt class="py-line"> <tt class="py-comment"># noqa pylint: disable = C0330</tt> </tt>
-<a name="L149"></a><tt class="py-lineno">149</tt> <tt class="py-line"> <tt class="py-string">r'(?:[^\000-\040"\047()\\\177]*'</tt> </tt>
-<a name="L150"></a><tt class="py-lineno">150</tt> <tt class="py-line"> <tt class="py-string">r'(?:%(escape)s[^\000-\040"\047()\\\177]*)*)'</tt> </tt>
-<a name="L151"></a><tt class="py-lineno">151</tt> <tt class="py-line"> <tt class="py-string">r'(?:'</tt> </tt>
-<a name="L152"></a><tt class="py-lineno">152</tt> <tt class="py-line"> <tt class="py-string">r'(?:%(spacechar)s+|%(nl_escaped)s+)'</tt> </tt>
-<a name="L153"></a><tt class="py-lineno">153</tt> <tt class="py-line"> <tt class="py-string">r'(?:'</tt> </tt>
-<a name="L154"></a><tt class="py-lineno">154</tt> <tt class="py-line"> <tt class="py-string">r'(?:[^\000-\040"\047()\\\177]|%(escape)s|%(nl_escaped)s)'</tt> </tt>
-<a name="L155"></a><tt class="py-lineno">155</tt> <tt class="py-line"> <tt class="py-string">r'[^\000-\040"\047()\\\177]*'</tt> </tt>
-<a name="L156"></a><tt class="py-lineno">156</tt> <tt class="py-line"> <tt class="py-string">r'(?:%(escape)s[^\000-\040"\047()\\\177]*)*'</tt> </tt>
-<a name="L157"></a><tt class="py-lineno">157</tt> <tt class="py-line"> <tt class="py-string">r')+'</tt> </tt>
-<a name="L158"></a><tt class="py-lineno">158</tt> <tt class="py-line"> <tt class="py-string">r')*'</tt> </tt>
-<a name="L159"></a><tt class="py-lineno">159</tt> <tt class="py-line"> <tt class="py-string">r')'</tt><tt class="py-op">)</tt> <tt class="py-op">%</tt> <tt class="py-name">locals</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-<a name="L160"></a><tt class="py-lineno">160</tt> <tt class="py-line"> </tt>
-<a name="L161"></a><tt class="py-lineno">161</tt> <tt class="py-line"> <tt class="py-name">nl_unesc_sub</tt> <tt class="py-op">=</tt> <tt class="py-name">_re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-name">nl_escaped</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt> </tt>
-<a name="L162"></a><tt class="py-lineno">162</tt> <tt class="py-line"> </tt>
-<a name="L163"></a><tt class="py-lineno">163</tt> <tt class="py-line"> <tt class="py-name">uri_space_sub</tt> <tt class="py-op">=</tt> <tt class="py-name">_re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-op">(</tt> </tt>
-<a name="L164"></a><tt class="py-lineno">164</tt> <tt class="py-line"> <tt class="py-string">r'(%(escape)s+)|%(spacechar)s+|%(nl_escaped)s+'</tt> </tt>
-<a name="L165"></a><tt class="py-lineno">165</tt> <tt class="py-line"> <tt class="py-op">)</tt> <tt class="py-op">%</tt> <tt class="py-name">locals</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt> </tt>
-<a name="L166"></a><tt class="py-lineno">166</tt> <tt class="py-line"> <tt class="py-name">uri_space_subber</tt> <tt class="py-op">=</tt> <tt class="py-keyword">lambda</tt> <tt class="py-name">m</tt><tt class="py-op">:</tt> <tt class="py-name">m</tt><tt class="py-op">.</tt><tt class="py-name">groups</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> <tt class="py-string">''</tt> </tt>
-<a name="L167"></a><tt class="py-lineno">167</tt> <tt class="py-line"> </tt>
-<a name="L168"></a><tt class="py-lineno">168</tt> <tt class="py-line"> <tt class="py-name">space_sub_simple</tt> <tt class="py-op">=</tt> <tt class="py-name">_re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-op">(</tt> </tt>
-<a name="L169"></a><tt class="py-lineno">169</tt> <tt class="py-line"> <tt class="py-string">r'[\r\n\f\040\t;]+|(%(comment)s+)'</tt> </tt>
-<a name="L170"></a><tt class="py-lineno">170</tt> <tt class="py-line"> <tt class="py-op">)</tt> <tt class="py-op">%</tt> <tt class="py-name">locals</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt> </tt>
-<a name="L171"></a><tt class="py-lineno">171</tt> <tt class="py-line"> <tt class="py-name">space_sub_banged</tt> <tt class="py-op">=</tt> <tt class="py-name">_re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-op">(</tt> </tt>
-<a name="L172"></a><tt class="py-lineno">172</tt> <tt class="py-line"> <tt class="py-string">r'[\r\n\f\040\t;]+|(%(_bang_comment)s+)'</tt> </tt>
-<a name="L173"></a><tt class="py-lineno">173</tt> <tt class="py-line"> <tt class="py-op">)</tt> <tt class="py-op">%</tt> <tt class="py-name">locals</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt> </tt>
-<a name="L174"></a><tt class="py-lineno">174</tt> <tt class="py-line"> </tt>
-<a name="L175"></a><tt class="py-lineno">175</tt> <tt class="py-line"> <tt class="py-name">post_esc_sub</tt> <tt class="py-op">=</tt> <tt class="py-name">_re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-string">r'[\r\n\f\t]+'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt> </tt>
-<a name="L176"></a><tt class="py-lineno">176</tt> <tt class="py-line"> </tt>
-<a name="L177"></a><tt class="py-lineno">177</tt> <tt class="py-line"> <tt class="py-name">main_sub</tt> <tt class="py-op">=</tt> <tt class="py-name">_re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-op">(</tt> </tt>
-<a name="L178"></a><tt class="py-lineno">178</tt> <tt class="py-line"> <tt class="py-comment"># noqa pylint: disable = C0330</tt> </tt>
-<a name="L179"></a><tt class="py-lineno">179</tt> <tt class="py-line"> <tt class="py-string">r'([^\\"\047u&gt;@\r\n\f\040\t/;:{}]+)'</tt> </tt>
-<a name="L180"></a><tt class="py-lineno">180</tt> <tt class="py-line"> <tt class="py-string">r'|(?&lt;=[{}(=:&gt;+[,!])(%(space)s+)'</tt> </tt>
-<a name="L181"></a><tt class="py-lineno">181</tt> <tt class="py-line"> <tt class="py-string">r'|^(%(space)s+)'</tt> </tt>
-<a name="L182"></a><tt class="py-lineno">182</tt> <tt class="py-line"> <tt class="py-string">r'|(%(space)s+)(?=(([:{});=&gt;+\],!])|$)?)'</tt> </tt>
-<a name="L183"></a><tt class="py-lineno">183</tt> <tt class="py-line"> <tt class="py-string">r'|;(%(space)s*(?:;%(space)s*)*)(?=(\})?)'</tt> </tt>
-<a name="L184"></a><tt class="py-lineno">184</tt> <tt class="py-line"> <tt class="py-string">r'|(\{)'</tt> </tt>
-<a name="L185"></a><tt class="py-lineno">185</tt> <tt class="py-line"> <tt class="py-string">r'|(\})'</tt> </tt>
-<a name="L186"></a><tt class="py-lineno">186</tt> <tt class="py-line"> <tt class="py-string">r'|(%(strings)s)'</tt> </tt>
-<a name="L187"></a><tt class="py-lineno">187</tt> <tt class="py-line"> <tt class="py-string">r'|(?&lt;!%(nmchar)s)url\(%(spacechar)s*('</tt> </tt>
-<a name="L188"></a><tt class="py-lineno">188</tt> <tt class="py-line"> <tt class="py-string">r'%(uri_nl_strings)s'</tt> </tt>
-<a name="L189"></a><tt class="py-lineno">189</tt> <tt class="py-line"> <tt class="py-string">r'|%(uri)s'</tt> </tt>
-<a name="L190"></a><tt class="py-lineno">190</tt> <tt class="py-line"> <tt class="py-string">r')%(spacechar)s*\)'</tt> </tt>
-<a name="L191"></a><tt class="py-lineno">191</tt> <tt class="py-line"> <tt class="py-string">r'|(@(?:'</tt> </tt>
-<a name="L192"></a><tt class="py-lineno">192</tt> <tt class="py-line"> <tt class="py-string">r'[mM][eE][dD][iI][aA]'</tt> </tt>
-<a name="L193"></a><tt class="py-lineno">193</tt> <tt class="py-line"> <tt class="py-string">r'|[sS][uU][pP][pP][oO][rR][tT][sS]'</tt> </tt>
-<a name="L194"></a><tt class="py-lineno">194</tt> <tt class="py-line"> <tt class="py-string">r'|[dD][oO][cC][uU][mM][eE][nN][tT]'</tt> </tt>
-<a name="L195"></a><tt class="py-lineno">195</tt> <tt class="py-line"> <tt class="py-string">r'|(?:-(?:'</tt> </tt>
-<a name="L196"></a><tt class="py-lineno">196</tt> <tt class="py-line"> <tt class="py-string">r'[wW][eE][bB][kK][iI][tT]|[mM][oO][zZ]|[oO]|[mM][sS]'</tt> </tt>
-<a name="L197"></a><tt class="py-lineno">197</tt> <tt class="py-line"> <tt class="py-string">r')-)?'</tt> </tt>
-<a name="L198"></a><tt class="py-lineno">198</tt> <tt class="py-line"> <tt class="py-string">r'[kK][eE][yY][fF][rR][aA][mM][eE][sS]'</tt> </tt>
-<a name="L199"></a><tt class="py-lineno">199</tt> <tt class="py-line"> <tt class="py-string">r'))(?!%(nmchar)s)'</tt> </tt>
-<a name="L200"></a><tt class="py-lineno">200</tt> <tt class="py-line"> <tt class="py-string">r'|(%(ie7hack)s)(%(space)s*)'</tt> </tt>
-<a name="L201"></a><tt class="py-lineno">201</tt> <tt class="py-line"> <tt class="py-string">r'|(:[fF][iI][rR][sS][tT]-[lL]'</tt> </tt>
-<a name="L202"></a><tt class="py-lineno">202</tt> <tt class="py-line"> <tt class="py-string">r'(?:[iI][nN][eE]|[eE][tT][tT][eE][rR]))'</tt> </tt>
-<a name="L203"></a><tt class="py-lineno">203</tt> <tt class="py-line"> <tt class="py-string">r'(%(space)s*)(?=[{,])'</tt> </tt>
-<a name="L204"></a><tt class="py-lineno">204</tt> <tt class="py-line"> <tt class="py-string">r'|(%(nl_strings)s)'</tt> </tt>
-<a name="L205"></a><tt class="py-lineno">205</tt> <tt class="py-line"> <tt class="py-string">r'|(%(escape)s[^\\"\047u&gt;@\r\n\f\040\t/;:{}]*)'</tt> </tt>
-<a name="L206"></a><tt class="py-lineno">206</tt> <tt class="py-line"> <tt class="py-op">)</tt> <tt class="py-op">%</tt> <tt class="py-name">locals</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt> </tt>
-<a name="L207"></a><tt class="py-lineno">207</tt> <tt class="py-line"> </tt>
-<a name="L208"></a><tt class="py-lineno">208</tt> <tt class="py-line"> <tt class="py-comment">#print main_sub.__self__.pattern</tt> </tt>
-<a name="L209"></a><tt class="py-lineno">209</tt> <tt class="py-line"> </tt>
-<a name="L210"></a><tt class="py-lineno">210</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">main_subber</tt><tt class="py-op">(</tt><tt class="py-param">keep_bang_comments</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L211"></a><tt class="py-lineno">211</tt> <tt class="py-line"> <tt class="py-docstring">""" Make main subber """</tt> </tt>
-<a name="L212"></a><tt class="py-lineno">212</tt> <tt class="py-line"> <tt class="py-name">in_macie5</tt><tt class="py-op">,</tt> <tt class="py-name">in_rule</tt><tt class="py-op">,</tt> <tt class="py-name">at_group</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
-<a name="L213"></a><tt class="py-lineno">213</tt> <tt class="py-line"> </tt>
-<a name="L214"></a><tt class="py-lineno">214</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">keep_bang_comments</tt><tt class="py-op">:</tt> </tt>
-<a name="L215"></a><tt class="py-lineno">215</tt> <tt class="py-line"> <tt class="py-name">space_sub</tt> <tt class="py-op">=</tt> <tt class="py-name">space_sub_banged</tt> </tt>
-<a name="L216"></a><tt class="py-lineno">216</tt> <tt class="py-line"> </tt>
-<a name="L217"></a><tt class="py-lineno">217</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">space_subber</tt><tt class="py-op">(</tt><tt class="py-param">match</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L218"></a><tt class="py-lineno">218</tt> <tt class="py-line"> <tt class="py-docstring">""" Space|Comment subber """</tt> </tt>
-<a name="L219"></a><tt class="py-lineno">219</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">match</tt><tt class="py-op">.</tt><tt class="py-name">lastindex</tt><tt class="py-op">:</tt> </tt>
-<a name="L220"></a><tt class="py-lineno">220</tt> <tt class="py-line"> <tt class="py-name">group1</tt><tt class="py-op">,</tt> <tt class="py-name">group2</tt> <tt class="py-op">=</tt> <tt class="py-name">match</tt><tt class="py-op">.</tt><tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">,</tt> <tt class="py-number">2</tt><tt class="py-op">)</tt> </tt>
-<a name="L221"></a><tt class="py-lineno">221</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">group2</tt><tt class="py-op">:</tt> </tt>
-<a name="L222"></a><tt class="py-lineno">222</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">group1</tt><tt class="py-op">.</tt><tt class="py-name">endswith</tt><tt class="py-op">(</tt><tt class="py-string">r'\*/'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L223"></a><tt class="py-lineno">223</tt> <tt class="py-line"> <tt class="py-name">in_macie5</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-number">1</tt> </tt>
-<a name="L224"></a><tt class="py-lineno">224</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
-<a name="L225"></a><tt class="py-lineno">225</tt> <tt class="py-line"> <tt class="py-name">in_macie5</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
-<a name="L226"></a><tt class="py-lineno">226</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">group1</tt> </tt>
-<a name="L227"></a><tt class="py-lineno">227</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">group1</tt><tt class="py-op">:</tt> </tt>
-<a name="L228"></a><tt class="py-lineno">228</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">group1</tt><tt class="py-op">.</tt><tt class="py-name">endswith</tt><tt class="py-op">(</tt><tt class="py-string">r'\*/'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L229"></a><tt class="py-lineno">229</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">in_macie5</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L230"></a><tt class="py-lineno">230</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">''</tt> </tt>
-<a name="L231"></a><tt class="py-lineno">231</tt> <tt class="py-line"> <tt class="py-name">in_macie5</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-number">1</tt> </tt>
-<a name="L232"></a><tt class="py-lineno">232</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">r'/*\*/'</tt> </tt>
-<a name="L233"></a><tt class="py-lineno">233</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">in_macie5</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L234"></a><tt class="py-lineno">234</tt> <tt class="py-line"> <tt class="py-name">in_macie5</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
-<a name="L235"></a><tt class="py-lineno">235</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">'/**/'</tt> </tt>
-<a name="L236"></a><tt class="py-lineno">236</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">''</tt> </tt>
-</div><a name="L237"></a><tt class="py-lineno">237</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
-<a name="L238"></a><tt class="py-lineno">238</tt> <tt class="py-line"> <tt class="py-name">space_sub</tt> <tt class="py-op">=</tt> <tt class="py-name">space_sub_simple</tt> </tt>
-<a name="L239"></a><tt class="py-lineno">239</tt> <tt class="py-line"> </tt>
-<a name="L240"></a><tt class="py-lineno">240</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">space_subber</tt><tt class="py-op">(</tt><tt class="py-param">match</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L241"></a><tt class="py-lineno">241</tt> <tt class="py-line"> <tt class="py-docstring">""" Space|Comment subber """</tt> </tt>
-<a name="L242"></a><tt class="py-lineno">242</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">match</tt><tt class="py-op">.</tt><tt class="py-name">lastindex</tt><tt class="py-op">:</tt> </tt>
-<a name="L243"></a><tt class="py-lineno">243</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">match</tt><tt class="py-op">.</tt><tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">endswith</tt><tt class="py-op">(</tt><tt class="py-string">r'\*/'</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L244"></a><tt class="py-lineno">244</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">in_macie5</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L245"></a><tt class="py-lineno">245</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">''</tt> </tt>
-<a name="L246"></a><tt class="py-lineno">246</tt> <tt class="py-line"> <tt class="py-name">in_macie5</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-number">1</tt> </tt>
-<a name="L247"></a><tt class="py-lineno">247</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">r'/*\*/'</tt> </tt>
-<a name="L248"></a><tt class="py-lineno">248</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">in_macie5</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L249"></a><tt class="py-lineno">249</tt> <tt class="py-line"> <tt class="py-name">in_macie5</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
-<a name="L250"></a><tt class="py-lineno">250</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">'/**/'</tt> </tt>
-<a name="L251"></a><tt class="py-lineno">251</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">''</tt> </tt>
-</div><a name="L252"></a><tt class="py-lineno">252</tt> <tt class="py-line"> </tt>
-<a name="L253"></a><tt class="py-lineno">253</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">fn_space_post</tt><tt class="py-op">(</tt><tt class="py-param">group</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L254"></a><tt class="py-lineno">254</tt> <tt class="py-line"> <tt class="py-docstring">""" space with token after """</tt> </tt>
-<a name="L255"></a><tt class="py-lineno">255</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">5</tt><tt class="py-op">)</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt> <tt class="py-keyword">or</tt> <tt class="py-op">(</tt> </tt>
-<a name="L256"></a><tt class="py-lineno">256</tt> <tt class="py-line"> <tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">6</tt><tt class="py-op">)</tt> <tt class="py-op">==</tt> <tt class="py-string">':'</tt> <tt class="py-keyword">and</tt> <tt class="py-keyword">not</tt> <tt class="py-name">in_rule</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-keyword">and</tt> <tt class="py-keyword">not</tt> <tt class="py-name">at_group</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L257"></a><tt class="py-lineno">257</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">' '</tt> <tt class="py-op">+</tt> <tt class="py-name">space_sub</tt><tt class="py-op">(</tt><tt class="py-name">space_subber</tt><tt class="py-op">,</tt> <tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">4</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
-<a name="L258"></a><tt class="py-lineno">258</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">space_sub</tt><tt class="py-op">(</tt><tt class="py-name">space_subber</tt><tt class="py-op">,</tt> <tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">4</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
-</div><a name="L259"></a><tt class="py-lineno">259</tt> <tt class="py-line"> </tt>
-<a name="L260"></a><tt class="py-lineno">260</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">fn_semicolon</tt><tt class="py-op">(</tt><tt class="py-param">group</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L261"></a><tt class="py-lineno">261</tt> <tt class="py-line"> <tt class="py-docstring">""" ; handler """</tt> </tt>
-<a name="L262"></a><tt class="py-lineno">262</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">';'</tt> <tt class="py-op">+</tt> <tt class="py-name">space_sub</tt><tt class="py-op">(</tt><tt class="py-name">space_subber</tt><tt class="py-op">,</tt> <tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">7</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
-</div><a name="L263"></a><tt class="py-lineno">263</tt> <tt class="py-line"> </tt>
-<a name="L264"></a><tt class="py-lineno">264</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">fn_semicolon2</tt><tt class="py-op">(</tt><tt class="py-param">group</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L265"></a><tt class="py-lineno">265</tt> <tt class="py-line"> <tt class="py-docstring">""" ; handler """</tt> </tt>
-<a name="L266"></a><tt class="py-lineno">266</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">in_rule</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L267"></a><tt class="py-lineno">267</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">space_sub</tt><tt class="py-op">(</tt><tt class="py-name">space_subber</tt><tt class="py-op">,</tt> <tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">7</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
-<a name="L268"></a><tt class="py-lineno">268</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">';'</tt> <tt class="py-op">+</tt> <tt class="py-name">space_sub</tt><tt class="py-op">(</tt><tt class="py-name">space_subber</tt><tt class="py-op">,</tt> <tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">7</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
-</div><a name="L269"></a><tt class="py-lineno">269</tt> <tt class="py-line"> </tt>
-<a name="L270"></a><tt class="py-lineno">270</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">fn_open</tt><tt class="py-op">(</tt><tt class="py-param">_</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L271"></a><tt class="py-lineno">271</tt> <tt class="py-line"> <tt class="py-docstring">""" { handler """</tt> </tt>
-<a name="L272"></a><tt class="py-lineno">272</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">at_group</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L273"></a><tt class="py-lineno">273</tt> <tt class="py-line"> <tt class="py-name">at_group</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">-=</tt> <tt class="py-number">1</tt> </tt>
-<a name="L274"></a><tt class="py-lineno">274</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
-<a name="L275"></a><tt class="py-lineno">275</tt> <tt class="py-line"> <tt class="py-name">in_rule</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-number">1</tt> </tt>
-<a name="L276"></a><tt class="py-lineno">276</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">'{'</tt> </tt>
-</div><a name="L277"></a><tt class="py-lineno">277</tt> <tt class="py-line"> </tt>
-<a name="L278"></a><tt class="py-lineno">278</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">fn_close</tt><tt class="py-op">(</tt><tt class="py-param">_</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L279"></a><tt class="py-lineno">279</tt> <tt class="py-line"> <tt class="py-docstring">""" } handler """</tt> </tt>
-<a name="L280"></a><tt class="py-lineno">280</tt> <tt class="py-line"> <tt class="py-name">in_rule</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
-<a name="L281"></a><tt class="py-lineno">281</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">'}'</tt> </tt>
-</div><a name="L282"></a><tt class="py-lineno">282</tt> <tt class="py-line"> </tt>
-<a name="L283"></a><tt class="py-lineno">283</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">fn_at_group</tt><tt class="py-op">(</tt><tt class="py-param">group</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L284"></a><tt class="py-lineno">284</tt> <tt class="py-line"> <tt class="py-docstring">""" @xxx group handler """</tt> </tt>
-<a name="L285"></a><tt class="py-lineno">285</tt> <tt class="py-line"> <tt class="py-name">at_group</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">+=</tt> <tt class="py-number">1</tt> </tt>
-<a name="L286"></a><tt class="py-lineno">286</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">13</tt><tt class="py-op">)</tt> </tt>
-</div><a name="L287"></a><tt class="py-lineno">287</tt> <tt class="py-line"> </tt>
-<a name="L288"></a><tt class="py-lineno">288</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">fn_ie7hack</tt><tt class="py-op">(</tt><tt class="py-param">group</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L289"></a><tt class="py-lineno">289</tt> <tt class="py-line"> <tt class="py-docstring">""" IE7 Hack handler """</tt> </tt>
-<a name="L290"></a><tt class="py-lineno">290</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">in_rule</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-keyword">and</tt> <tt class="py-keyword">not</tt> <tt class="py-name">at_group</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L291"></a><tt class="py-lineno">291</tt> <tt class="py-line"> <tt class="py-name">in_macie5</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-op">=</tt> <tt class="py-number">0</tt> </tt>
-<a name="L292"></a><tt class="py-lineno">292</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">14</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-name">space_sub</tt><tt class="py-op">(</tt><tt class="py-name">space_subber</tt><tt class="py-op">,</tt> <tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">15</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
-<a name="L293"></a><tt class="py-lineno">293</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">'&gt;'</tt> <tt class="py-op">+</tt> <tt class="py-name">space_sub</tt><tt class="py-op">(</tt><tt class="py-name">space_subber</tt><tt class="py-op">,</tt> <tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">15</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
-</div><a name="L294"></a><tt class="py-lineno">294</tt> <tt class="py-line"> </tt>
-<a name="L295"></a><tt class="py-lineno">295</tt> <tt class="py-line"> <tt class="py-name">table</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt> </tt>
-<a name="L296"></a><tt class="py-lineno">296</tt> <tt class="py-line"> <tt class="py-comment"># noqa pylint: disable = C0330</tt> </tt>
-<a name="L297"></a><tt class="py-lineno">297</tt> <tt class="py-line"> <tt class="py-name">None</tt><tt class="py-op">,</tt> </tt>
-<a name="L298"></a><tt class="py-lineno">298</tt> <tt class="py-line"> <tt class="py-name">None</tt><tt class="py-op">,</tt> </tt>
-<a name="L299"></a><tt class="py-lineno">299</tt> <tt class="py-line"> <tt class="py-name">None</tt><tt class="py-op">,</tt> </tt>
-<a name="L300"></a><tt class="py-lineno">300</tt> <tt class="py-line"> <tt class="py-name">None</tt><tt class="py-op">,</tt> </tt>
-<a name="L301"></a><tt class="py-lineno">301</tt> <tt class="py-line"> <tt class="py-name">fn_space_post</tt><tt class="py-op">,</tt> <tt class="py-comment"># space with token after</tt> </tt>
-<a name="L302"></a><tt class="py-lineno">302</tt> <tt class="py-line"> <tt class="py-name">fn_space_post</tt><tt class="py-op">,</tt> <tt class="py-comment"># space with token after</tt> </tt>
-<a name="L303"></a><tt class="py-lineno">303</tt> <tt class="py-line"> <tt class="py-name">fn_space_post</tt><tt class="py-op">,</tt> <tt class="py-comment"># space with token after</tt> </tt>
-<a name="L304"></a><tt class="py-lineno">304</tt> <tt class="py-line"> <tt class="py-name">fn_semicolon</tt><tt class="py-op">,</tt> <tt class="py-comment"># semicolon</tt> </tt>
-<a name="L305"></a><tt class="py-lineno">305</tt> <tt class="py-line"> <tt class="py-name">fn_semicolon2</tt><tt class="py-op">,</tt> <tt class="py-comment"># semicolon</tt> </tt>
-<a name="L306"></a><tt class="py-lineno">306</tt> <tt class="py-line"> <tt class="py-name">fn_open</tt><tt class="py-op">,</tt> <tt class="py-comment"># {</tt> </tt>
-<a name="L307"></a><tt class="py-lineno">307</tt> <tt class="py-line"> <tt class="py-name">fn_close</tt><tt class="py-op">,</tt> <tt class="py-comment"># }</tt> </tt>
-<a name="L308"></a><tt class="py-lineno">308</tt> <tt class="py-line"> <tt class="py-keyword">lambda</tt> <tt class="py-name">g</tt><tt class="py-op">:</tt> <tt class="py-name">g</tt><tt class="py-op">(</tt><tt class="py-number">11</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-comment"># string</tt> </tt>
-<a name="L309"></a><tt class="py-lineno">309</tt> <tt class="py-line"> <tt class="py-keyword">lambda</tt> <tt class="py-name">g</tt><tt class="py-op">:</tt> <tt class="py-string">'url(%s)'</tt> <tt class="py-op">%</tt> <tt class="py-name">uri_space_sub</tt><tt class="py-op">(</tt><tt class="py-name">uri_space_subber</tt><tt class="py-op">,</tt> <tt class="py-name">g</tt><tt class="py-op">(</tt><tt class="py-number">12</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
-<a name="L310"></a><tt class="py-lineno">310</tt> <tt class="py-line"> <tt class="py-comment"># url(...)</tt> </tt>
-<a name="L311"></a><tt class="py-lineno">311</tt> <tt class="py-line"> <tt class="py-name">fn_at_group</tt><tt class="py-op">,</tt> <tt class="py-comment"># @xxx expecting {...}</tt> </tt>
-<a name="L312"></a><tt class="py-lineno">312</tt> <tt class="py-line"> <tt class="py-name">None</tt><tt class="py-op">,</tt> </tt>
-<a name="L313"></a><tt class="py-lineno">313</tt> <tt class="py-line"> <tt class="py-name">fn_ie7hack</tt><tt class="py-op">,</tt> <tt class="py-comment"># ie7hack</tt> </tt>
-<a name="L314"></a><tt class="py-lineno">314</tt> <tt class="py-line"> <tt class="py-name">None</tt><tt class="py-op">,</tt> </tt>
-<a name="L315"></a><tt class="py-lineno">315</tt> <tt class="py-line"> <tt class="py-keyword">lambda</tt> <tt class="py-name">g</tt><tt class="py-op">:</tt> <tt class="py-name">g</tt><tt class="py-op">(</tt><tt class="py-number">16</tt><tt class="py-op">)</tt> <tt class="py-op">+</tt> <tt class="py-string">' '</tt> <tt class="py-op">+</tt> <tt class="py-name">space_sub</tt><tt class="py-op">(</tt><tt class="py-name">space_subber</tt><tt class="py-op">,</tt> <tt class="py-name">g</tt><tt class="py-op">(</tt><tt class="py-number">17</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
-<a name="L316"></a><tt class="py-lineno">316</tt> <tt class="py-line"> <tt class="py-comment"># :first-line|letter followed</tt> </tt>
-<a name="L317"></a><tt class="py-lineno">317</tt> <tt class="py-line"> <tt class="py-comment"># by [{,] (apparently space</tt> </tt>
-<a name="L318"></a><tt class="py-lineno">318</tt> <tt class="py-line"> <tt class="py-comment"># needed for IE6)</tt> </tt>
-<a name="L319"></a><tt class="py-lineno">319</tt> <tt class="py-line"> <tt class="py-keyword">lambda</tt> <tt class="py-name">g</tt><tt class="py-op">:</tt> <tt class="py-name">nl_unesc_sub</tt><tt class="py-op">(</tt><tt class="py-string">''</tt><tt class="py-op">,</tt> <tt class="py-name">g</tt><tt class="py-op">(</tt><tt class="py-number">18</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-comment"># nl_string</tt> </tt>
-<a name="L320"></a><tt class="py-lineno">320</tt> <tt class="py-line"> <tt class="py-keyword">lambda</tt> <tt class="py-name">g</tt><tt class="py-op">:</tt> <tt class="py-name">post_esc_sub</tt><tt class="py-op">(</tt><tt class="py-string">' '</tt><tt class="py-op">,</tt> <tt class="py-name">g</tt><tt class="py-op">(</tt><tt class="py-number">19</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-comment"># escape</tt> </tt>
-<a name="L321"></a><tt class="py-lineno">321</tt> <tt class="py-line"> <tt class="py-op">)</tt> </tt>
-<a name="L322"></a><tt class="py-lineno">322</tt> <tt class="py-line"> </tt>
-<a name="L323"></a><tt class="py-lineno">323</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">func</tt><tt class="py-op">(</tt><tt class="py-param">match</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L324"></a><tt class="py-lineno">324</tt> <tt class="py-line"> <tt class="py-docstring">""" Main subber """</tt> </tt>
-<a name="L325"></a><tt class="py-lineno">325</tt> <tt class="py-line"> <tt class="py-name">idx</tt><tt class="py-op">,</tt> <tt class="py-name">group</tt> <tt class="py-op">=</tt> <tt class="py-name">match</tt><tt class="py-op">.</tt><tt class="py-name">lastindex</tt><tt class="py-op">,</tt> <tt class="py-name">match</tt><tt class="py-op">.</tt><tt class="py-name">group</tt> </tt>
-<a name="L326"></a><tt class="py-lineno">326</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">idx</tt> <tt class="py-op">&gt;</tt> <tt class="py-number">3</tt><tt class="py-op">:</tt> </tt>
-<a name="L327"></a><tt class="py-lineno">327</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">table</tt><tt class="py-op">[</tt><tt class="py-name">idx</tt><tt class="py-op">]</tt><tt class="py-op">(</tt><tt class="py-name">group</tt><tt class="py-op">)</tt> </tt>
-<a name="L328"></a><tt class="py-lineno">328</tt> <tt class="py-line"> </tt>
-<a name="L329"></a><tt class="py-lineno">329</tt> <tt class="py-line"> <tt class="py-comment"># shortcuts for frequent operations below:</tt> </tt>
-<a name="L330"></a><tt class="py-lineno">330</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">idx</tt> <tt class="py-op">==</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt> <tt class="py-comment"># not interesting</tt> </tt>
-<a name="L331"></a><tt class="py-lineno">331</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">)</tt> </tt>
-<a name="L332"></a><tt class="py-lineno">332</tt> <tt class="py-line"> <tt class="py-comment">#else: # space with token before or at the beginning</tt> </tt>
-<a name="L333"></a><tt class="py-lineno">333</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">space_sub</tt><tt class="py-op">(</tt><tt class="py-name">space_subber</tt><tt class="py-op">,</tt> <tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-name">idx</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
-</div><a name="L334"></a><tt class="py-lineno">334</tt> <tt class="py-line"> </tt>
-<a name="L335"></a><tt class="py-lineno">335</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">func</tt> </tt>
-</div><a name="L336"></a><tt class="py-lineno">336</tt> <tt class="py-line"> </tt>
-<a name="L337"></a><tt class="py-lineno">337</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">cssmin</tt><tt class="py-op">(</tt><tt class="py-param">style</tt><tt class="py-op">,</tt> <tt class="py-param">keep_bang_comments</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> <tt class="py-comment"># pylint: disable = W0621</tt> </tt>
-<a name="L338"></a><tt class="py-lineno">338</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt>
-<a name="L339"></a><tt class="py-lineno">339</tt> <tt class="py-line"><tt class="py-docstring"> Minify CSS.</tt> </tt>
-<a name="L340"></a><tt class="py-lineno">340</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L341"></a><tt class="py-lineno">341</tt> <tt class="py-line"><tt class="py-docstring"> :Parameters:</tt> </tt>
-<a name="L342"></a><tt class="py-lineno">342</tt> <tt class="py-line"><tt class="py-docstring"> `style` : ``str``</tt> </tt>
-<a name="L343"></a><tt class="py-lineno">343</tt> <tt class="py-line"><tt class="py-docstring"> CSS to minify</tt> </tt>
-<a name="L344"></a><tt class="py-lineno">344</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L345"></a><tt class="py-lineno">345</tt> <tt class="py-line"><tt class="py-docstring"> `keep_bang_comments` : ``bool``</tt> </tt>
-<a name="L346"></a><tt class="py-lineno">346</tt> <tt class="py-line"><tt class="py-docstring"> Keep comments starting with an exclamation mark? (``/*!...*/``)</tt> </tt>
-<a name="L347"></a><tt class="py-lineno">347</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L348"></a><tt class="py-lineno">348</tt> <tt class="py-line"><tt class="py-docstring"> :Return: Minified style</tt> </tt>
-<a name="L349"></a><tt class="py-lineno">349</tt> <tt class="py-line"><tt class="py-docstring"> :Rtype: ``str``</tt> </tt>
-<a name="L350"></a><tt class="py-lineno">350</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
-<a name="L351"></a><tt class="py-lineno">351</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">main_sub</tt><tt class="py-op">(</tt><tt class="py-name">main_subber</tt><tt class="py-op">(</tt><tt class="py-name">keep_bang_comments</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">style</tt><tt class="py-op">)</tt> </tt>
-</div><a name="L352"></a><tt class="py-lineno">352</tt> <tt class="py-line"> </tt>
-<a name="L353"></a><tt class="py-lineno">353</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt id="link-5" class="py-name"><a title="rcssmin.cssmin" class="py-name" href="#" onclick="return doclink('link-5', 'cssmin', 'link-4');">cssmin</a></tt> </tt>
-</div><a name="L354"></a><tt class="py-lineno">354</tt> <tt class="py-line"> </tt>
-<a name="L355"></a><tt class="py-lineno">355</tt> <tt class="py-line"><tt id="link-6" class="py-name"><a title="rcssmin.cssmin" class="py-name" href="#" onclick="return doclink('link-6', 'cssmin', 'link-4');">cssmin</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_make_cssmin</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-<a name="L356"></a><tt class="py-lineno">356</tt> <tt class="py-line"> </tt>
-<a name="L357"></a><tt class="py-lineno">357</tt> <tt class="py-line"> </tt>
-<a name="L358"></a><tt class="py-lineno">358</tt> <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">__name__</tt> <tt class="py-op">==</tt> <tt class="py-string">'__main__'</tt><tt class="py-op">:</tt> </tt>
-<a name="main"></a><div id="main-def"><a name="L359"></a><tt class="py-lineno">359</tt> <a class="py-toggle" href="#" id="main-toggle" onclick="return toggle('main');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="rcssmin-module.html#main">main</a><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-</div><div id="main-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="main-expanded"><a name="L360"></a><tt class="py-lineno">360</tt> <tt class="py-line"> <tt class="py-docstring">""" Main """</tt> </tt>
-<a name="L361"></a><tt class="py-lineno">361</tt> <tt class="py-line"> <tt class="py-keyword">import</tt> <tt class="py-name">sys</tt> <tt class="py-keyword">as</tt> <tt class="py-name">_sys</tt> </tt>
-<a name="L362"></a><tt class="py-lineno">362</tt> <tt class="py-line"> <tt class="py-name">keep_bang_comments</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt> </tt>
-<a name="L363"></a><tt class="py-lineno">363</tt> <tt class="py-line"> <tt class="py-string">'-b'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
-<a name="L364"></a><tt class="py-lineno">364</tt> <tt class="py-line"> <tt class="py-keyword">or</tt> <tt class="py-string">'-bp'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
-<a name="L365"></a><tt class="py-lineno">365</tt> <tt class="py-line"> <tt class="py-keyword">or</tt> <tt class="py-string">'-pb'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
-<a name="L366"></a><tt class="py-lineno">366</tt> <tt class="py-line"> <tt class="py-op">)</tt> </tt>
-<a name="L367"></a><tt class="py-lineno">367</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-string">'-p'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> <tt class="py-string">'-bp'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> \ </tt>
-<a name="L368"></a><tt class="py-lineno">368</tt> <tt class="py-line"> <tt class="py-keyword">or</tt> <tt class="py-string">'-pb'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L369"></a><tt class="py-lineno">369</tt> <tt class="py-line"> <tt class="py-keyword">global</tt> <tt id="link-7" class="py-name"><a title="rcssmin.cssmin" class="py-name" href="#" onclick="return doclink('link-7', 'cssmin', 'link-4');">cssmin</a></tt> <tt class="py-comment"># pylint: disable = W0603</tt> </tt>
-<a name="L370"></a><tt class="py-lineno">370</tt> <tt class="py-line"> <tt id="link-8" class="py-name"><a title="rcssmin.cssmin" class="py-name" href="#" onclick="return doclink('link-8', 'cssmin', 'link-4');">cssmin</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_make_cssmin</tt><tt class="py-op">(</tt><tt class="py-name">python_only</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt> </tt>
-<a name="L371"></a><tt class="py-lineno">371</tt> <tt class="py-line"> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">stdout</tt><tt class="py-op">.</tt><tt class="py-name">write</tt><tt class="py-op">(</tt><tt id="link-9" class="py-name"><a title="rcssmin.cssmin" class="py-name" href="#" onclick="return doclink('link-9', 'cssmin', 'link-4');">cssmin</a></tt><tt class="py-op">(</tt> </tt>
-<a name="L372"></a><tt class="py-lineno">372</tt> <tt class="py-line"> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">stdin</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">keep_bang_comments</tt><tt class="py-op">=</tt><tt class="py-name">keep_bang_comments</tt> </tt>
-<a name="L373"></a><tt class="py-lineno">373</tt> <tt class="py-line"> <tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
-</div><a name="L374"></a><tt class="py-lineno">374</tt> <tt class="py-line"> <tt class="py-name">main</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-<a name="L375"></a><tt class="py-lineno">375</tt> <tt class="py-line"> </tt><script type="text/javascript">
-<!--
-expandto(location.href);
-// -->
-</script>
-</pre>
-<br />
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rcssmin/" target="_top">Visit rcssmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-
-<script type="text/javascript">
- <!--
- // Private objects are initially displayed (because if
- // javascript is turned off then we want them to be
- // visible); but by default, we want to hide them. So hide
- // them unless we have a cookie that says to show them.
- checkCookie();
- // -->
-</script>
-</body>
-</html>
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/redirect.html b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/redirect.html
deleted file mode 100644
index 95728fdf177..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/docs/apidoc/redirect.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<html><head><title>Epydoc Redirect Page</title>
-<meta http-equiv="cache-control" content="no-cache" />
-<meta http-equiv="expires" content="0" />
-<meta http-equiv="pragma" content="no-cache" />
- <script type="text/javascript" src="epydoc.js"></script>
-</head>
-<body>
-<script type="text/javascript">
-<!--
-var pages = ["rcssmin-m"];
-var dottedName = get_anchor();
-if (dottedName) {
- var target = redirect_url(dottedName);
- if (target) window.location.replace(target);
-}
-// -->
-</script>
-
-<h3>Epydoc Auto-redirect page</h3>
-
-<p>When javascript is enabled, this page will redirect URLs of
-the form <tt>redirect.html#<i>dotted.name</i></tt> to the
-documentation for the object with the given fully-qualified
-dotted name.</p>
-<p><a id="message"> &nbsp; </a></p>
-
-<script type="text/javascript">
-<!--
-if (dottedName) {
- var msg = document.getElementById("message");
- msg.innerHTML = "No documentation found for <tt>"+
- dottedName+"</tt>";
-}
-// -->
-</script>
-
-</body>
-</html>
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/package.cfg b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/package.cfg
deleted file mode 100644
index c09bbd0365b..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/package.cfg
+++ /dev/null
@@ -1,84 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2009 - 2014
-# André Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-[package]
-name = rcssmin
-
-python.min = 2.3
-python.max = 3.4
-pypy.min = 1.9
-pypy.max = 2.2
-jython.min = 2.5
-jython.max = 2.7
-
-version.number = 1.0.5
-
-author.name = André Malo
-author.email = nd@perlig.de
-#maintainer.name =
-#maintainer.email =
-url.homepage = http://opensource.perlig.de/rcssmin/
-url.download = http://storage.perlig.de/rcssmin/
-
-
-[docs]
-meta.classifiers = docs/CLASSIFIERS
-meta.description = docs/DESCRIPTION
-meta.summary = docs/SUMMARY
-meta.provides = docs/PROVIDES
-meta.license = LICENSE
-meta.keywords =
- CSS
- Minimization
-
-apidoc.dir = docs/apidoc
-apidoc.strip = 1
-#apidoc.ignore =
-
-#userdoc.dir = docs/userdoc
-#userdoc.strip = 1
-#userdoc.ignore =
-# .buildinfo
-
-#examples.dir = docs/examples
-#examples.strip = 1
-#examples.ignore =
-
-#man =
-
-extra =
- README.rst
- docs/CHANGES
- docs/BENCHMARKS
-
-
-[manifest]
-#packages.lib = .
-#packages.collect =
-modules = rcssmin
-
-packages.extra =
- _setup.py2.term
- _setup.py3.term
-
-#scripts =
-
-dist =
- tests
- run_tests.py
- bench
- bench.sh
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/rcssmin.c b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/rcssmin.c
deleted file mode 100644
index a722fc276a9..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/rcssmin.c
+++ /dev/null
@@ -1,1163 +0,0 @@
-/*
- * Copyright 2011 - 2014
- * Andr\xe9 Malo or his licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "cext.h"
-EXT_INIT_FUNC;
-
-#ifdef EXT3
-typedef Py_UNICODE rchar;
-#else
-typedef unsigned char rchar;
-#endif
-#define U(c) ((rchar)(c))
-
-typedef struct {
- const rchar *start;
- const rchar *sentinel;
- const rchar *tsentinel;
- Py_ssize_t at_group;
- int in_macie5;
- int in_rule;
- int keep_bang_comments;
-} rcssmin_ctx_t;
-
-typedef enum {
- NEED_SPACE_MAYBE = 0,
- NEED_SPACE_NEVER
-} need_space_flag;
-
-
-#define RCSSMIN_DULL_BIT (1 << 0)
-#define RCSSMIN_HEX_BIT (1 << 1)
-#define RCSSMIN_ESC_BIT (1 << 2)
-#define RCSSMIN_SPACE_BIT (1 << 3)
-#define RCSSMIN_STRING_DULL_BIT (1 << 4)
-#define RCSSMIN_NMCHAR_BIT (1 << 5)
-#define RCSSMIN_URI_DULL_BIT (1 << 6)
-#define RCSSMIN_PRE_CHAR_BIT (1 << 7)
-#define RCSSMIN_POST_CHAR_BIT (1 << 8)
-
-static const unsigned short rcssmin_charmask[128] = {
- 21, 21, 21, 21, 21, 21, 21, 21,
- 21, 28, 8, 21, 8, 8, 21, 21,
- 21, 21, 21, 21, 21, 21, 21, 21,
- 21, 21, 21, 21, 21, 21, 21, 21,
- 28, 469, 4, 85, 85, 85, 85, 4,
- 149, 277, 85, 469, 469, 117, 85, 84,
- 115, 115, 115, 115, 115, 115, 115, 115,
- 115, 115, 468, 340, 85, 469, 468, 85,
- 84, 115, 115, 115, 115, 115, 115, 117,
- 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 213, 4, 341, 85, 117,
- 85, 115, 115, 115, 115, 115, 115, 117,
- 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 116, 117, 117,
- 117, 117, 117, 468, 85, 468, 85, 21
-};
-
-#define RCSSMIN_IS_DULL(c) ((U(c) > 127) || \
- (rcssmin_charmask[U(c) & 0x7F] & RCSSMIN_DULL_BIT))
-
-#define RCSSMIN_IS_HEX(c) ((U(c) <= 127) && \
- (rcssmin_charmask[U(c) & 0x7F] & RCSSMIN_HEX_BIT))
-
-#define RCSSMIN_IS_ESC(c) ((U(c) > 127) || \
- (rcssmin_charmask[U(c) & 0x7F] & RCSSMIN_ESC_BIT))
-
-#define RCSSMIN_IS_SPACE(c) ((U(c) <= 127) && \
- (rcssmin_charmask[U(c) & 0x7F] & RCSSMIN_SPACE_BIT))
-
-#define RCSSMIN_IS_STRING_DULL(c) ((U(c) > 127) || \
- (rcssmin_charmask[U(c) & 0x7F] & RCSSMIN_STRING_DULL_BIT))
-
-#define RCSSMIN_IS_NMCHAR(c) ((U(c) > 127) || \
- (rcssmin_charmask[U(c) & 0x7F] & RCSSMIN_NMCHAR_BIT))
-
-#define RCSSMIN_IS_URI_DULL(c) ((U(c) > 127) || \
- (rcssmin_charmask[U(c) & 0x7F] & RCSSMIN_URI_DULL_BIT))
-
-#define RCSSMIN_IS_PRE_CHAR(c) ((U(c) <= 127) && \
- (rcssmin_charmask[U(c) & 0x7F] & RCSSMIN_PRE_CHAR_BIT))
-
-#define RCSSMIN_IS_POST_CHAR(c) ((U(c) <= 127) && \
- (rcssmin_charmask[U(c) & 0x7F] & RCSSMIN_POST_CHAR_BIT))
-
-
-static const rchar pattern_url[] = {
- /*U('u'),*/ U('r'), U('l'), U('(')
-};
-
-static const rchar pattern_ie7[] = {
- /*U('>'),*/ U('/'), U('*'), U('*'), U('/')
-};
-
-static const rchar pattern_media[] = {
- U('m'), U('e'), U('d'), U('i'), U('a'),
- U('M'), U('E'), U('D'), U('I'), U('A')
-};
-
-static const rchar pattern_document[] = {
- U('d'), U('o'), U('c'), U('u'), U('m'), U('e'), U('n'), U('t'),
- U('D'), U('O'), U('C'), U('U'), U('M'), U('E'), U('N'), U('T')
-};
-
-static const rchar pattern_supports[] = {
- U('s'), U('u'), U('p'), U('p'), U('o'), U('r'), U('t'), U('s'),
- U('S'), U('U'), U('P'), U('P'), U('O'), U('R'), U('T'), U('S')
-};
-
-static const rchar pattern_keyframes[] = {
- U('k'), U('e'), U('y'), U('f'), U('r'), U('a'), U('m'), U('e'), U('s'),
- U('K'), U('E'), U('Y'), U('F'), U('R'), U('A'), U('M'), U('E'), U('S')
-};
-
-static const rchar pattern_vendor_o[] = {
- U('-'), U('o'), U('-'),
- U('-'), U('O'), U('-')
-};
-
-static const rchar pattern_vendor_moz[] = {
- U('-'), U('m'), U('o'), U('z'), U('-'),
- U('-'), U('M'), U('O'), U('Z'), U('-')
-};
-
-static const rchar pattern_vendor_webkit[] = {
- U('-'), U('w'), U('e'), U('b'), U('k'), U('i'), U('t'), U('-'),
- U('-'), U('W'), U('E'), U('B'), U('K'), U('I'), U('T'), U('-')
-};
-
-static const rchar pattern_vendor_ms[] = {
- U('-'), U('m'), U('s'), U('-'),
- U('-'), U('M'), U('S'), U('-')
-};
-
-static const rchar pattern_first[] = {
- U('f'), U('i'), U('r'), U('s'), U('t'), U('-'), U('l'),
- U('F'), U('I'), U('R'), U('S'), U('T'), U('-'), U('L')
-};
-
-static const rchar pattern_line[] = {
- U('i'), U('n'), U('e'),
- U('I'), U('N'), U('E'),
-};
-
-static const rchar pattern_letter[] = {
- U('e'), U('t'), U('t'), U('e'), U('r'),
- U('E'), U('T'), U('T'), U('E'), U('R')
-};
-
-static const rchar pattern_macie5_init[] = {
- U('/'), U('*'), U('\\'), U('*'), U('/')
-};
-
-static const rchar pattern_macie5_exit[] = {
- U('/'), U('*'), U('*'), U('/')
-};
-
-/*
- * Match a pattern (and copy immediately to target)
- */
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wstrict-overflow"
-#endif
-static int
-copy_match(const rchar *pattern, const rchar *psentinel,
- const rchar **source_, rchar **target_, rcssmin_ctx_t *ctx)
-{
- const rchar *source = *source_;
- rchar *target = *target_;
- rchar c;
-
- while (pattern < psentinel
- && source < ctx->sentinel && target < ctx->tsentinel
- && ((c = *source++) == *pattern++))
- *target++ = c;
-
- *source_ = source;
- *target_ = target;
-
- return (pattern == psentinel);
-}
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
-#pragma GCC diagnostic pop
-#endif
-
-#define MATCH(PAT, source, target, ctx) ( \
- copy_match(pattern_##PAT, \
- pattern_##PAT + sizeof(pattern_##PAT) / sizeof(rchar), \
- source, target, ctx) \
-)
-
-
-/*
- * Match a pattern (and copy immediately to target) - CI version
- */
-static int
-copy_imatch(const rchar *pattern, const rchar *psentinel,
- const rchar **source_, rchar **target_, rcssmin_ctx_t *ctx)
-{
- const rchar *source = *source_, *pstart = pattern;
- rchar *target = *target_;
- rchar c;
-
- while (pattern < psentinel
- && source < ctx->sentinel && target < ctx->tsentinel
- && ((c = *source++) == *pattern
- || c == pstart[(pattern - pstart) + (psentinel - pstart)])) {
- ++pattern;
- *target++ = c;
- }
-
- *source_ = source;
- *target_ = target;
-
- return (pattern == psentinel);
-}
-
-#define IMATCH(PAT, source, target, ctx) ( \
- copy_imatch(pattern_##PAT, \
- pattern_##PAT + sizeof(pattern_##PAT) / sizeof(rchar) / 2, \
- source, target, ctx) \
-)
-
-
-/*
- * Copy characters
- */
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wstrict-overflow"
-#endif
-static int
-copy(const rchar *source, const rchar *sentinel, rchar **target_,
- rcssmin_ctx_t *ctx)
-{
- rchar *target = *target_;
-
- while (source < sentinel && target < ctx->tsentinel)
- *target++ = *source++;
-
- *target_ = target;
-
- return (source == sentinel);
-}
-#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))
-#pragma GCC diagnostic pop
-#endif
-
-#define COPY_PAT(PAT, target, ctx) ( \
- copy(pattern_##PAT, \
- pattern_##PAT + sizeof(pattern_##PAT) / sizeof(rchar), \
- target, ctx) \
-)
-
-
-/*
- * The ABORT macros work with known local variables!
- */
-#define ABORT_(RET) do { \
- if (source < ctx->sentinel && !(target < ctx->tsentinel)) { \
- *source_ = source; \
- *target_ = target; \
- } \
- return RET; \
-} while(0)
-
-
-#define CRAPPY_C90_COMPATIBLE_EMPTY
-#define ABORT ABORT_(CRAPPY_C90_COMPATIBLE_EMPTY)
-#define RABORT(RET) ABORT_((RET))
-
-
-/*
- * Copy escape
- */
-static void
-copy_escape(const rchar **source_, rchar **target_, rcssmin_ctx_t *ctx)
-{
- const rchar *source = *source_, *hsentinel;
- rchar *target = *target_;
- rchar c;
-
- *target++ = U('\\');
- *target_ = target;
-
- if (source < ctx->sentinel && target < ctx->tsentinel) {
- c = *source++;
- if (RCSSMIN_IS_ESC(c)) {
- *target++ = c;
- }
- else if (RCSSMIN_IS_HEX(c)) {
- *target++ = c;
-
- /* 6 hex chars max, one we got already */
- if (ctx->sentinel - source > 5)
- hsentinel = source + 5;
- else
- hsentinel = ctx->sentinel;
-
- while (source < hsentinel && target < ctx->tsentinel
- && (c = *source, RCSSMIN_IS_HEX(c))) {
- ++source;
- *target++ = c;
- }
-
- /* One optional space after */
- if (source < ctx->sentinel && target < ctx->tsentinel) {
- if (source == hsentinel)
- c = *source;
- if (RCSSMIN_IS_SPACE(c)) {
- ++source;
- *target++ = U(' ');
- if (c == U('\r') && source < ctx->sentinel
- && *source == U('\n'))
- ++source;
- }
- }
- }
- }
-
- *target_ = target;
- *source_ = source;
-}
-
-
-/*
- * Copy string
- */
-static void
-copy_string(const rchar **source_, rchar **target_, rcssmin_ctx_t *ctx)
-{
- const rchar *source = *source_;
- rchar *target = *target_;
- rchar c, quote = source[-1];
-
- *target++ = quote;
- *target_ = target;
-
- while (source < ctx->sentinel && target < ctx->tsentinel) {
- c = *target++ = *source++;
- if (RCSSMIN_IS_STRING_DULL(c))
- continue;
-
- switch (c) {
- case U('\''): case U('"'):
- if (c == quote) {
- *target_ = target;
- *source_ = source;
- return;
- }
- continue;
-
- case U('\\'):
- if (source < ctx->sentinel && target < ctx->tsentinel) {
- c = *source++;
- switch (c) {
- case U('\r'):
- if (source < ctx->sentinel && *source == U('\n'))
- ++source;
- /* fall through */
-
- case U('\n'): case U('\f'):
- --target;
- break;
-
- default:
- *target++ = c;
- }
- }
- continue;
- }
- break; /* forbidden characters */
- }
-
- ABORT;
-}
-
-
-/*
- * Copy URI string
- */
-static int
-copy_uri_string(const rchar **source_, rchar **target_, rcssmin_ctx_t *ctx)
-{
- const rchar *source = *source_;
- rchar *target = *target_;
- rchar c, quote = source[-1];
-
- *target++ = quote;
- *target_ = target;
-
- while (source < ctx->sentinel && target < ctx->tsentinel) {
- c = *source++;
- if (RCSSMIN_IS_SPACE(c))
- continue;
- *target++ = c;
- if (RCSSMIN_IS_STRING_DULL(c))
- continue;
-
- switch (c) {
- case U('\''): case U('"'):
- if (c == quote) {
- *target_ = target;
- *source_ = source;
- return 0;
- }
- continue;
-
- case U('\\'):
- if (source < ctx->sentinel && target < ctx->tsentinel) {
- c = *source;
- switch (c) {
- case U('\r'):
- if ((source + 1) < ctx->sentinel && source[1] == U('\n'))
- ++source;
- /* fall through */
-
- case U('\n'): case U('\f'):
- --target;
- ++source;
- break;
-
- default:
- --target;
- copy_escape(&source, &target, ctx);
- }
- }
- continue;
- }
-
- break; /* forbidden characters */
- }
-
- RABORT(-1);
-}
-
-
-/*
- * Copy URI (unquoted)
- */
-static int
-copy_uri_unquoted(const rchar **source_, rchar **target_, rcssmin_ctx_t *ctx)
-{
- const rchar *source = *source_;
- rchar *target = *target_;
- rchar c;
-
- *target++ = source[-1];
- *target_ = target;
-
- while (source < ctx->sentinel && target < ctx->tsentinel) {
- c = *source++;
- if (RCSSMIN_IS_SPACE(c))
- continue;
- *target++ = c;
- if (RCSSMIN_IS_URI_DULL(c))
- continue;
-
- switch (c) {
-
- case U(')'):
- *target_ = target - 1;
- *source_ = source - 1;
- return 0;
-
- case U('\\'):
- if (source < ctx->sentinel && target < ctx->tsentinel) {
- c = *source;
- switch (c) {
- case U('\r'):
- if ((source + 1) < ctx->sentinel && source[1] == U('\n'))
- ++source;
- /* fall through */
-
- case U('\n'): case U('\f'):
- --target;
- ++source;
- break;
-
- default:
- --target;
- copy_escape(&source, &target, ctx);
- }
- }
- continue;
- }
-
- break; /* forbidden characters */
- }
-
- RABORT(-1);
-}
-
-
-/*
- * Copy url
- */
-static void
-copy_url(const rchar **source_, rchar **target_, rcssmin_ctx_t *ctx)
-{
- const rchar *source = *source_;
- rchar *target = *target_;
- rchar c;
-
- *target++ = U('u');
- *target_ = target;
-
- /* Must not be inside an identifier */
- if ((source != ctx->start + 1) && RCSSMIN_IS_NMCHAR(source[-2]))
- return;
-
- if (!MATCH(url, &source, &target, ctx)
- || !(source < ctx->sentinel && target < ctx->tsentinel))
- ABORT;
-
- while (source < ctx->sentinel && RCSSMIN_IS_SPACE(*source))
- ++source;
-
- if (!(source < ctx->sentinel))
- ABORT;
-
- c = *source++;
- switch (c) {
- case U('"'): case U('\''):
- if (copy_uri_string(&source, &target, ctx) == -1)
- ABORT;
-
- while (source < ctx->sentinel && RCSSMIN_IS_SPACE(*source))
- ++source;
- break;
-
- default:
- if (copy_uri_unquoted(&source, &target, ctx) == -1)
- ABORT;
- }
-
- if (!(source < ctx->sentinel && target < ctx->tsentinel))
- ABORT;
-
- if ((*target++ = *source++) != U(')'))
- ABORT;
-
- *target_ = target;
- *source_ = source;
-}
-
-
-/*
- * Copy @-group
- */
-static void
-copy_at_group(const rchar **source_, rchar **target_, rcssmin_ctx_t *ctx)
-{
- const rchar *source = *source_;
- rchar *target = *target_;
-
- *target++ = U('@');
- *target_ = target;
-
-#define REMATCH(what) ( \
- source = *source_, \
- target = *target_, \
- IMATCH(what, &source, &target, ctx) \
-)
-#define CMATCH(what) IMATCH(what, &source, &target, ctx)
-
- if (( !CMATCH(media)
- && !REMATCH(supports)
- && !REMATCH(document)
- && !REMATCH(keyframes)
- && !(REMATCH(vendor_webkit) && CMATCH(keyframes))
- && !(REMATCH(vendor_moz) && CMATCH(keyframes))
- && !(REMATCH(vendor_o) && CMATCH(keyframes))
- && !(REMATCH(vendor_ms) && CMATCH(keyframes)))
- || !(source < ctx->sentinel && target < ctx->tsentinel)
- || RCSSMIN_IS_NMCHAR(*source))
- ABORT;
-
-#undef CMATCH
-#undef REMATCH
-
- ++ctx->at_group;
-
- *target_ = target;
- *source_ = source;
-}
-
-
-/*
- * Skip space
- */
-static const rchar *
-skip_space(const rchar *source, rcssmin_ctx_t *ctx)
-{
- const rchar *begin = source;
- int res;
- rchar c;
-
- while (source < ctx->sentinel) {
- c = *source;
- if (RCSSMIN_IS_SPACE(c)) {
- ++source;
- continue;
- }
- else if (c == U('/')) {
- ++source;
- if (!(source < ctx->sentinel && *source == U('*'))) {
- --source;
- break;
- }
- ++source;
- res = 0;
- while (source < ctx->sentinel) {
- c = *source++;
- if (c != U('*'))
- continue;
- if (!(source < ctx->sentinel))
- return begin;
- if (*source != U('/'))
- continue;
-
- /* Comment complete */
- ++source;
- res = 1;
- break;
- }
- if (!res)
- return begin;
-
- continue;
- }
-
- break;
- }
-
- return source;
-}
-
-
-/*
- * Copy space
- */
-static void
-copy_space(const rchar **source_, rchar **target_, rcssmin_ctx_t *ctx,
- need_space_flag need_space)
-{
- const rchar *source = *source_, *end, *comment;
- rchar *target = *target_;
- int res;
- rchar c;
-
- --source;
- if (need_space == NEED_SPACE_MAYBE
- && source > ctx->start
- && !RCSSMIN_IS_PRE_CHAR(source[-1])
- && (end = skip_space(source, ctx)) < ctx->sentinel
- && (!RCSSMIN_IS_POST_CHAR(*end)
- || (*end == U(':') && !ctx->in_rule && !ctx->at_group))) {
-
- if (!(target < ctx->tsentinel))
- ABORT;
- *target++ = U(' ');
- }
-
- while (source < ctx->sentinel) {
- switch (c = *source) {
-
- /* comment */
- case U('/'):
- comment = source++;
- if (!((source < ctx->sentinel && *source == U('*')))) {
- --source;
- break;
- }
- ++source;
- res = 0;
- while (source < ctx->sentinel) {
- c = *source++;
- if (c != U('*'))
- continue;
- if (!(source < ctx->sentinel))
- ABORT;
- if (*source != U('/'))
- continue;
-
- /* Comment complete */
- ++source;
- res = 1;
-
- if (ctx->keep_bang_comments && comment[2] == U('!')) {
- ctx->in_macie5 = (source[-3] == U('\\'));
- if (!copy(comment, source, &target, ctx))
- ABORT;
- }
- else if (source[-3] == U('\\')) {
- if (!ctx->in_macie5) {
- if (!COPY_PAT(macie5_init, &target, ctx))
- ABORT;
- }
- ctx->in_macie5 = 1;
- }
- else if (ctx->in_macie5) {
- if (!COPY_PAT(macie5_exit, &target, ctx))
- ABORT;
- ctx->in_macie5 = 0;
- }
- /* else don't copy anything */
- break;
- }
- if (!res)
- ABORT;
- continue;
-
- /* space */
- case U(' '): case U('\t'): case U('\r'): case U('\n'): case U('\f'):
- ++source;
- continue;
- }
-
- break;
- }
-
- *source_ = source;
- *target_ = target;
-}
-
-
-/*
- * Copy space if comment
- */
-static int
-copy_space_comment(const rchar **source_, rchar **target_,
- rcssmin_ctx_t *ctx, need_space_flag need_space)
-{
- const rchar *source = *source_;
- rchar *target = *target_;
-
- if (source < ctx->sentinel && *source == U('*')) {
- copy_space(source_, target_, ctx, need_space);
- if (*source_ > source)
- return 0;
- }
- if (!(target < ctx->tsentinel))
- RABORT(-1);
-
- *target++ = source[-1];
-
- /* *source_ = source; <-- unchanged */
- *target_ = target;
-
- return -1;
-}
-
-
-/*
- * Copy space if exists
- */
-static int
-copy_space_optional(const rchar **source_, rchar **target_,
- rcssmin_ctx_t *ctx)
-{
- const rchar *source = *source_;
-
- if (!(source < ctx->sentinel))
- return -1;
-
- if (*source == U('/')) {
- *source_ = source + 1;
- return copy_space_comment(source_, target_, ctx, NEED_SPACE_NEVER);
- }
- else if (RCSSMIN_IS_SPACE(*source)) {
- *source_ = source + 1;
- copy_space(source_, target_, ctx, NEED_SPACE_NEVER);
- return 0;
- }
-
- return -1;
-}
-
-
-/*
- * Copy :first-line|letter
- */
-static void
-copy_first(const rchar **source_, rchar **target_, rcssmin_ctx_t *ctx)
-{
- const rchar *source = *source_, *next, *source_fork;
- rchar *target = *target_, *target_fork;
-
- *target++ = U(':');
- *target_ = target;
-
- if (!IMATCH(first, &source, &target, ctx)
- || !(source < ctx->sentinel && target < ctx->tsentinel))
- ABORT;
-
- source_fork = source;
- target_fork = target;
-
- if (!IMATCH(line, &source, &target, ctx)) {
- source = source_fork;
- target = target_fork;
-
- if (!IMATCH(letter, &source, &target, ctx)
- || !(source < ctx->sentinel && target < ctx->tsentinel))
- ABORT;
- }
-
- next = skip_space(source, ctx);
- if (!(next < ctx->sentinel && target < ctx->tsentinel
- && (*next == U('{') || *next == U(','))))
- ABORT;
-
- *target++ = U(' ');
- *target_ = target;
- *source_ = source;
- (void)copy_space_optional(source_, target_, ctx);
-}
-
-
-/*
- * Copy IE7 hack
- */
-static void
-copy_ie7hack(const rchar **source_, rchar **target_, rcssmin_ctx_t *ctx)
-{
- const rchar *source = *source_;
- rchar *target = *target_;
-
- *target++ = U('>');
- *target_ = target;
-
- if (ctx->in_rule || ctx->at_group)
- return; /* abort */
-
- if (!MATCH(ie7, &source, &target, ctx))
- ABORT;
-
- ctx->in_macie5 = 0;
-
- *target_ = target;
- *source_ = source;
-
- (void)copy_space_optional(source_, target_, ctx);
-}
-
-
-/*
- * Copy semicolon; miss out duplicates or even this one (before '}')
- */
-static void
-copy_semicolon(const rchar **source_, rchar **target_, rcssmin_ctx_t *ctx)
-{
- const rchar *source = *source_, *begin, *end;
- rchar *target = *target_;
-
- begin = source;
- while (source < ctx->sentinel) {
- end = skip_space(source, ctx);
- if (!(end < ctx->sentinel)) {
- if (!(target < ctx->tsentinel))
- ABORT;
- *target++ = U(';');
- break;
- }
- switch (*end) {
- case U(';'):
- source = end + 1;
- continue;
-
- case U('}'):
- if (ctx->in_rule)
- break;
-
- /* fall through */
- default:
- if (!(target < ctx->tsentinel))
- ABORT;
- *target++ = U(';');
- break;
- }
-
- break;
- }
-
- source = begin;
- *target_ = target;
- while (source < ctx->sentinel) {
- if (*source == U(';')) {
- ++source;
- continue;
- }
-
- if (copy_space_optional(&source, target_, ctx) == 0)
- continue;
-
- break;
- }
-
- *source_ = source;
-}
-
-
-/*
- * Main function
- *
- * The return value determines the result length (kept in the target buffer).
- * However, if the target buffer is too small, the return value is greater
- * than tlength. The difference to tlength is the number of unconsumed source
- * characters at the time the buffer was full. In this case you should resize
- * the target buffer to the return value and call rcssmin again. Repeat as
- * often as needed.
- */
-static Py_ssize_t
-rcssmin(const rchar *source, rchar *target, Py_ssize_t slength,
- Py_ssize_t tlength, int keep_bang_comments)
-{
- rcssmin_ctx_t ctx_, *ctx = &ctx_;
- const rchar *tstart = target;
- rchar c;
-
- ctx->start = source;
- ctx->sentinel = source + slength;
- ctx->tsentinel = target + tlength;
- ctx->at_group = 0;
- ctx->in_macie5 = 0;
- ctx->in_rule = 0;
- ctx->keep_bang_comments = keep_bang_comments;
-
- while (source < ctx->sentinel && target < ctx->tsentinel) {
- c = *source++;
- if (RCSSMIN_IS_DULL(c)) {
- *target++ = c;
- continue;
- }
- else if (RCSSMIN_IS_SPACE(c)) {
- copy_space(&source, &target, ctx, NEED_SPACE_MAYBE);
- continue;
- }
-
- switch (c) {
-
- /* Escape */
- case U('\\'):
- copy_escape(&source, &target, ctx);
- continue;
-
- /* String */
- case U('"'): case U('\''):
- copy_string(&source, &target, ctx);
- continue;
-
- /* URL */
- case U('u'):
- copy_url(&source, &target, ctx);
- continue;
-
- /* IE7hack */
- case U('>'):
- copy_ie7hack(&source, &target, ctx);
- continue;
-
- /* @-group */
- case U('@'):
- copy_at_group(&source, &target, ctx);
- continue;
-
- /* ; */
- case U(';'):
- copy_semicolon(&source, &target, ctx);
- continue;
-
- /* :first-line|letter followed by [{,] */
- /* (apparently needed for IE6) */
- case U(':'):
- copy_first(&source, &target, ctx);
- continue;
-
- /* { */
- case U('{'):
- if (ctx->at_group)
- --ctx->at_group;
- else
- ++ctx->in_rule;
- *target++ = c;
- continue;
-
- /* } */
- case U('}'):
- if (ctx->in_rule)
- --ctx->in_rule;
- *target++ = c;
- continue;
-
- /* space starting with comment */
- case U('/'):
- (void)copy_space_comment(&source, &target, ctx, NEED_SPACE_MAYBE);
- continue;
-
- /* Fallback: copy character. Better safe than sorry. Should not be
- * reached, though */
- default:
- *target++ = c;
- continue;
- }
- }
-
- return
- (Py_ssize_t)(target - tstart) + (Py_ssize_t)(ctx->sentinel - source);
-}
-
-
-PyDoc_STRVAR(rcssmin_cssmin__doc__,
-"cssmin(style, keep_bang_comments=False)\n\
-\n\
-Minify CSS.\n\
-\n\
-:Note: This is a hand crafted C implementation built on the regex\n\
- semantics.\n\
-\n\
-:Parameters:\n\
- `style` : ``str``\n\
- CSS to minify\n\
-\n\
-:Return: Minified style\n\
-:Rtype: ``str``");
-
-static PyObject *
-rcssmin_cssmin(PyObject *self, PyObject *args, PyObject *kwds)
-{
- PyObject *style, *keep_bang_comments_ = NULL, *result;
- static char *kwlist[] = {"style", "keep_bang_comments", NULL};
- Py_ssize_t rlength, slength, length;
- int keep_bang_comments;
-#ifdef EXT2
- int uni;
-#define UOBJ "O"
-#endif
-#ifdef EXT3
-#define UOBJ "U"
-#endif
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, UOBJ "|O", kwlist,
- &style, &keep_bang_comments_))
- return NULL;
-
- if (!keep_bang_comments_)
- keep_bang_comments = 0;
- else {
- keep_bang_comments = PyObject_IsTrue(keep_bang_comments_);
- if (keep_bang_comments == -1)
- return NULL;
- }
-
-#ifdef EXT2
- if (PyUnicode_Check(style)) {
- if (!(style = PyUnicode_AsUTF8String(style)))
- return NULL;
- uni = 1;
- }
- else {
- if (!(style = PyObject_Str(style)))
- return NULL;
- uni = 0;
- }
-#endif
-
-#ifdef EXT3
- Py_INCREF(style);
-#define PyString_GET_SIZE PyUnicode_GET_SIZE
-#define PyString_AS_STRING PyUnicode_AS_UNICODE
-#define _PyString_Resize PyUnicode_Resize
-#define PyString_FromStringAndSize PyUnicode_FromUnicode
-#endif
-
- rlength = slength = PyString_GET_SIZE(style);
-
-again:
- if (!(result = PyString_FromStringAndSize(NULL, rlength))) {
- Py_DECREF(style);
- return NULL;
- }
- Py_BEGIN_ALLOW_THREADS
- length = rcssmin((rchar *)PyString_AS_STRING(style),
- (rchar *)PyString_AS_STRING(result),
- slength, rlength, keep_bang_comments);
- Py_END_ALLOW_THREADS
-
- if (length > rlength) {
- Py_DECREF(result);
- rlength = length;
- goto again;
- }
-
- Py_DECREF(style);
- if (length < 0) {
- Py_DECREF(result);
- return NULL;
- }
- if (length != rlength && _PyString_Resize(&result, length) == -1)
- return NULL;
-
-#ifdef EXT2
- if (uni) {
- style = PyUnicode_DecodeUTF8(PyString_AS_STRING(result),
- PyString_GET_SIZE(result), "strict");
- Py_DECREF(result);
- if (!style)
- return NULL;
- result = style;
- }
-#endif
- return result;
-}
-
-/* ------------------------ BEGIN MODULE DEFINITION ------------------------ */
-
-EXT_METHODS = {
- {"cssmin",
- (PyCFunction)rcssmin_cssmin, METH_VARARGS | METH_KEYWORDS,
- rcssmin_cssmin__doc__},
-
- {NULL} /* Sentinel */
-};
-
-PyDoc_STRVAR(EXT_DOCS_VAR,
-"C implementation of rcssmin\n\
-===========================\n\
-\n\
-C implementation of rcssmin.");
-
-
-EXT_DEFINE(EXT_MODULE_NAME, EXT_METHODS_VAR, EXT_DOCS_VAR);
-
-EXT_INIT_FUNC {
- PyObject *m;
-
- /* Create the module and populate stuff */
- if (!(m = EXT_CREATE(&EXT_DEFINE_VAR)))
- EXT_INIT_ERROR(NULL);
-
- EXT_ADD_UNICODE(m, "__author__", "Andr\xe9 Malo", "latin-1");
- EXT_ADD_STRING(m, "__docformat__", "restructuredtext en");
-
- EXT_INIT_RETURN(m);
-}
-
-/* ------------------------- END MODULE DEFINITION ------------------------- */
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/rcssmin.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/rcssmin.py
deleted file mode 100644
index ae1cefc3396..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/rcssmin.py
+++ /dev/null
@@ -1,374 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: ascii -*-
-r"""
-==============
- CSS Minifier
-==============
-
-CSS Minifier.
-
-The minifier is based on the semantics of the `YUI compressor`_\\, which
-itself is based on `the rule list by Isaac Schlueter`_\\.
-
-:Copyright:
-
- Copyright 2011 - 2014
- Andr\xe9 Malo or his licensors, as applicable
-
-:License:
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-This module is a re-implementation aiming for speed instead of maximum
-compression, so it can be used at runtime (rather than during a preprocessing
-step). RCSSmin does syntactical compression only (removing spaces, comments
-and possibly semicolons). It does not provide semantic compression (like
-removing empty blocks, collapsing redundant properties etc). It does, however,
-support various CSS hacks (by keeping them working as intended).
-
-Here's a feature list:
-
-- Strings are kept, except that escaped newlines are stripped
-- Space/Comments before the very end or before various characters are
- stripped: ``:{});=>+],!`` (The colon (``:``) is a special case, a single
- space is kept if it's outside a ruleset.)
-- Space/Comments at the very beginning or after various characters are
- stripped: ``{}(=:>+[,!``
-- Optional space after unicode escapes is kept, resp. replaced by a simple
- space
-- whitespaces inside ``url()`` definitions are stripped
-- Comments starting with an exclamation mark (``!``) can be kept optionally.
-- All other comments and/or whitespace characters are replaced by a single
- space.
-- Multiple consecutive semicolons are reduced to one
-- The last semicolon within a ruleset is stripped
-- CSS Hacks supported:
-
- - IE7 hack (``>/**/``)
- - Mac-IE5 hack (``/*\\*/.../**/``)
- - The boxmodelhack is supported naturally because it relies on valid CSS2
- strings
- - Between ``:first-line`` and the following comma or curly brace a space is
- inserted. (apparently it's needed for IE6)
- - Same for ``:first-letter``
-
-rcssmin.c is a reimplementation of rcssmin.py in C and improves runtime up to
-factor 100 or so (depending on the input). docs/BENCHMARKS in the source
-distribution contains the details.
-
-Both python 2 (>= 2.4) and python 3 are supported.
-
-.. _YUI compressor: https://github.com/yui/yuicompressor/
-
-.. _the rule list by Isaac Schlueter: https://github.com/isaacs/cssmin/
-"""
-if __doc__:
- # pylint: disable = W0622
- __doc__ = __doc__.encode('ascii').decode('unicode_escape')
-__author__ = r"Andr\xe9 Malo".encode('ascii').decode('unicode_escape')
-__docformat__ = "restructuredtext en"
-__license__ = "Apache License, Version 2.0"
-__version__ = '1.0.5'
-__all__ = ['cssmin']
-
-import re as _re
-
-
-def _make_cssmin(python_only=False):
- """
- Generate CSS minifier.
-
- :Parameters:
- `python_only` : ``bool``
- Use only the python variant. If true, the c extension is not even
- tried to be loaded.
-
- :Return: Minifier
- :Rtype: ``callable``
- """
- # pylint: disable = R0912, R0914, W0612
-
- if not python_only:
- try:
- import _rcssmin
- except ImportError:
- pass
- else:
- return _rcssmin.cssmin
-
- nl = r'(?:[\n\f]|\r\n?)' # pylint: disable = C0103
- spacechar = r'[\r\n\f\040\t]'
-
- unicoded = r'[0-9a-fA-F]{1,6}(?:[\040\n\t\f]|\r\n?)?'
- escaped = r'[^\n\r\f0-9a-fA-F]'
- escape = r'(?:\\(?:%(unicoded)s|%(escaped)s))' % locals()
-
- nmchar = r'[^\000-\054\056\057\072-\100\133-\136\140\173-\177]'
- #nmstart = r'[^\000-\100\133-\136\140\173-\177]'
- #ident = (r'(?:'
- # r'-?(?:%(nmstart)s|%(escape)s)%(nmchar)s*(?:%(escape)s%(nmchar)s*)*'
- #r')') % locals()
-
- comment = r'(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)'
-
- # only for specific purposes. The bang is grouped:
- _bang_comment = r'(?:/\*(!?)[^*]*\*+(?:[^/*][^*]*\*+)*/)'
-
- string1 = \
- r'(?:\047[^\047\\\r\n\f]*(?:\\[^\r\n\f][^\047\\\r\n\f]*)*\047)'
- string2 = r'(?:"[^"\\\r\n\f]*(?:\\[^\r\n\f][^"\\\r\n\f]*)*")'
- strings = r'(?:%s|%s)' % (string1, string2)
-
- nl_string1 = \
- r'(?:\047[^\047\\\r\n\f]*(?:\\(?:[^\r]|\r\n?)[^\047\\\r\n\f]*)*\047)'
- nl_string2 = r'(?:"[^"\\\r\n\f]*(?:\\(?:[^\r]|\r\n?)[^"\\\r\n\f]*)*")'
- nl_strings = r'(?:%s|%s)' % (nl_string1, nl_string2)
-
- uri_nl_string1 = r'(?:\047[^\047\\]*(?:\\(?:[^\r]|\r\n?)[^\047\\]*)*\047)'
- uri_nl_string2 = r'(?:"[^"\\]*(?:\\(?:[^\r]|\r\n?)[^"\\]*)*")'
- uri_nl_strings = r'(?:%s|%s)' % (uri_nl_string1, uri_nl_string2)
-
- nl_escaped = r'(?:\\%(nl)s)' % locals()
-
- space = r'(?:%(spacechar)s|%(comment)s)' % locals()
-
- ie7hack = r'(?:>/\*\*/)'
-
- uri = (r'(?:'
- # noqa pylint: disable = C0330
- r'(?:[^\000-\040"\047()\\\177]*'
- r'(?:%(escape)s[^\000-\040"\047()\\\177]*)*)'
- r'(?:'
- r'(?:%(spacechar)s+|%(nl_escaped)s+)'
- r'(?:'
- r'(?:[^\000-\040"\047()\\\177]|%(escape)s|%(nl_escaped)s)'
- r'[^\000-\040"\047()\\\177]*'
- r'(?:%(escape)s[^\000-\040"\047()\\\177]*)*'
- r')+'
- r')*'
- r')') % locals()
-
- nl_unesc_sub = _re.compile(nl_escaped).sub
-
- uri_space_sub = _re.compile((
- r'(%(escape)s+)|%(spacechar)s+|%(nl_escaped)s+'
- ) % locals()).sub
- uri_space_subber = lambda m: m.groups()[0] or ''
-
- space_sub_simple = _re.compile((
- r'[\r\n\f\040\t;]+|(%(comment)s+)'
- ) % locals()).sub
- space_sub_banged = _re.compile((
- r'[\r\n\f\040\t;]+|(%(_bang_comment)s+)'
- ) % locals()).sub
-
- post_esc_sub = _re.compile(r'[\r\n\f\t]+').sub
-
- main_sub = _re.compile((
- # noqa pylint: disable = C0330
- r'([^\\"\047u>@\r\n\f\040\t/;:{}]+)'
- r'|(?<=[{}(=:>+[,!])(%(space)s+)'
- r'|^(%(space)s+)'
- r'|(%(space)s+)(?=(([:{});=>+\],!])|$)?)'
- r'|;(%(space)s*(?:;%(space)s*)*)(?=(\})?)'
- r'|(\{)'
- r'|(\})'
- r'|(%(strings)s)'
- r'|(?<!%(nmchar)s)url\(%(spacechar)s*('
- r'%(uri_nl_strings)s'
- r'|%(uri)s'
- r')%(spacechar)s*\)'
- r'|(@(?:'
- r'[mM][eE][dD][iI][aA]'
- r'|[sS][uU][pP][pP][oO][rR][tT][sS]'
- r'|[dD][oO][cC][uU][mM][eE][nN][tT]'
- r'|(?:-(?:'
- r'[wW][eE][bB][kK][iI][tT]|[mM][oO][zZ]|[oO]|[mM][sS]'
- r')-)?'
- r'[kK][eE][yY][fF][rR][aA][mM][eE][sS]'
- r'))(?!%(nmchar)s)'
- r'|(%(ie7hack)s)(%(space)s*)'
- r'|(:[fF][iI][rR][sS][tT]-[lL]'
- r'(?:[iI][nN][eE]|[eE][tT][tT][eE][rR]))'
- r'(%(space)s*)(?=[{,])'
- r'|(%(nl_strings)s)'
- r'|(%(escape)s[^\\"\047u>@\r\n\f\040\t/;:{}]*)'
- ) % locals()).sub
-
- #print main_sub.__self__.pattern
-
- def main_subber(keep_bang_comments):
- """ Make main subber """
- in_macie5, in_rule, at_group = [0], [0], [0]
-
- if keep_bang_comments:
- space_sub = space_sub_banged
-
- def space_subber(match):
- """ Space|Comment subber """
- if match.lastindex:
- group1, group2 = match.group(1, 2)
- if group2:
- if group1.endswith(r'\*/'):
- in_macie5[0] = 1
- else:
- in_macie5[0] = 0
- return group1
- elif group1:
- if group1.endswith(r'\*/'):
- if in_macie5[0]:
- return ''
- in_macie5[0] = 1
- return r'/*\*/'
- elif in_macie5[0]:
- in_macie5[0] = 0
- return '/**/'
- return ''
- else:
- space_sub = space_sub_simple
-
- def space_subber(match):
- """ Space|Comment subber """
- if match.lastindex:
- if match.group(1).endswith(r'\*/'):
- if in_macie5[0]:
- return ''
- in_macie5[0] = 1
- return r'/*\*/'
- elif in_macie5[0]:
- in_macie5[0] = 0
- return '/**/'
- return ''
-
- def fn_space_post(group):
- """ space with token after """
- if group(5) is None or (
- group(6) == ':' and not in_rule[0] and not at_group[0]):
- return ' ' + space_sub(space_subber, group(4))
- return space_sub(space_subber, group(4))
-
- def fn_semicolon(group):
- """ ; handler """
- return ';' + space_sub(space_subber, group(7))
-
- def fn_semicolon2(group):
- """ ; handler """
- if in_rule[0]:
- return space_sub(space_subber, group(7))
- return ';' + space_sub(space_subber, group(7))
-
- def fn_open(_):
- """ { handler """
- if at_group[0]:
- at_group[0] -= 1
- else:
- in_rule[0] = 1
- return '{'
-
- def fn_close(_):
- """ } handler """
- in_rule[0] = 0
- return '}'
-
- def fn_at_group(group):
- """ @xxx group handler """
- at_group[0] += 1
- return group(13)
-
- def fn_ie7hack(group):
- """ IE7 Hack handler """
- if not in_rule[0] and not at_group[0]:
- in_macie5[0] = 0
- return group(14) + space_sub(space_subber, group(15))
- return '>' + space_sub(space_subber, group(15))
-
- table = (
- # noqa pylint: disable = C0330
- None,
- None,
- None,
- None,
- fn_space_post, # space with token after
- fn_space_post, # space with token after
- fn_space_post, # space with token after
- fn_semicolon, # semicolon
- fn_semicolon2, # semicolon
- fn_open, # {
- fn_close, # }
- lambda g: g(11), # string
- lambda g: 'url(%s)' % uri_space_sub(uri_space_subber, g(12)),
- # url(...)
- fn_at_group, # @xxx expecting {...}
- None,
- fn_ie7hack, # ie7hack
- None,
- lambda g: g(16) + ' ' + space_sub(space_subber, g(17)),
- # :first-line|letter followed
- # by [{,] (apparently space
- # needed for IE6)
- lambda g: nl_unesc_sub('', g(18)), # nl_string
- lambda g: post_esc_sub(' ', g(19)), # escape
- )
-
- def func(match):
- """ Main subber """
- idx, group = match.lastindex, match.group
- if idx > 3:
- return table[idx](group)
-
- # shortcuts for frequent operations below:
- elif idx == 1: # not interesting
- return group(1)
- #else: # space with token before or at the beginning
- return space_sub(space_subber, group(idx))
-
- return func
-
- def cssmin(style, keep_bang_comments=False): # pylint: disable = W0621
- """
- Minify CSS.
-
- :Parameters:
- `style` : ``str``
- CSS to minify
-
- `keep_bang_comments` : ``bool``
- Keep comments starting with an exclamation mark? (``/*!...*/``)
-
- :Return: Minified style
- :Rtype: ``str``
- """
- return main_sub(main_subber(keep_bang_comments), style)
-
- return cssmin
-
-cssmin = _make_cssmin()
-
-
-if __name__ == '__main__':
- def main():
- """ Main """
- import sys as _sys
- keep_bang_comments = (
- '-b' in _sys.argv[1:]
- or '-bp' in _sys.argv[1:]
- or '-pb' in _sys.argv[1:]
- )
- if '-p' in _sys.argv[1:] or '-bp' in _sys.argv[1:] \
- or '-pb' in _sys.argv[1:]:
- global cssmin # pylint: disable = W0603
- cssmin = _make_cssmin(python_only=True)
- _sys.stdout.write(cssmin(
- _sys.stdin.read(), keep_bang_comments=keep_bang_comments
- ))
- main()
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/run_tests.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/run_tests.py
deleted file mode 100755
index 9128d743586..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/run_tests.py
+++ /dev/null
@@ -1,166 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: ascii -*-
-#
-# Copyright 2014
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===========
- Run tests
-===========
-
-Run tests.
-"""
-__author__ = "Andr\xe9 Malo"
-__author__ = getattr(__author__, 'decode', lambda x: __author__)('latin-1')
-__docformat__ = "restructuredtext en"
-
-import os as _os
-import re as _re
-import sys as _sys
-
-from _setup import shell
-from _setup import term
-
-
-def run_tests(basedir, libdir):
- """ Run output based tests """
- import rcssmin as _rcssmin
- py_cssmin = _rcssmin._make_cssmin(python_only=True)
- c_cssmin = _rcssmin._make_cssmin(python_only=False)
-
- def run_test(example, output_file):
- """ Run it """
- try:
- fp = open(example, 'r')
- except IOError:
- return
- else:
- try:
- input = fp.read()
- finally:
- fp.close()
-
- def load_output(filename):
- try:
- fp = open(filename, 'r')
- except IOError:
- return None
- else:
- try:
- output = fp.read()
- finally:
- fp.close()
- output = output.strip()
- if _re.search(r'(?<!\\)(?:\\\\)*\\[0-9a-zA-Z]{1,6}$', output):
- output += ' '
- return output
-
- output = load_output(output_file)
- output_b = load_output(output_file + '.b')
-
- def do_test(cssmin, output, **options):
- try:
- genout = cssmin(input, **options)
- except (KeyboardInterrupt, SystemExit):
- raise
- except:
- return 1, "%(RED)s exc%(NORMAL)s "
- else:
- if output is None:
- return 1, "%(RED)smiss%(NORMAL)s "
- elif genout == output or genout == output.rstrip():
- return 0, "%(GREEN)sOK%(NORMAL)s "
- else:
- return 1, "%(RED)sfail%(NORMAL)s "
-
- erred, out = do_test(py_cssmin, output)
- erred, c_out = do_test(c_cssmin, output)
- erred, out_b = do_test(py_cssmin, output_b, keep_bang_comments=True)
- erred, c_out_b = do_test(c_cssmin, output_b, keep_bang_comments=True)
-
- term.write(
- "%(out)s %(out_b)s | %(c_out)s %(c_out_b)s - %%(example)s\n"
- % locals(),
- example=_os.path.basename(example),
- )
- return erred
-
- # end
- # begin main test code
-
- erred = 0
- basedir = shell.native(basedir)
- strip = len(basedir) - len(_os.path.basename(basedir))
- for dirname, dirs, files in shell.walk(basedir):
- dirs[:] = [
- item for item in dirs if item not in ('.svn', '.git', 'out')
- ]
- dirs.sort()
- files = [item for item in files if item.endswith('.css')]
- if not files:
- continue
- if not _os.path.isdir(_os.path.join(basedir, dirname, 'out')):
- continue
- term.yellow("---> %s" % (dirname[strip:],))
- files.sort()
- for filename in files:
- if run_test(
- _os.path.join(dirname, filename),
- _os.path.join(dirname, 'out', filename[:-4] + '.out'),
- ): erred = 1
- term.yellow("<--- %s" % (dirname[strip:],))
- return erred
-
-
-def main():
- """ Main """
- basedir, libdir = None, None
- accept_opts = True
- args = []
- for arg in _sys.argv[1:]:
- if accept_opts:
- if arg == '--':
- accept_opts = False
- continue
- elif arg == '-q':
- term.write = term.green = term.red = term.yellow = \
- term.announce = \
- lambda fmt, **kwargs: None
- continue
- elif arg == '-p':
- info = {}
- for key in term.terminfo():
- info[key] = ''
- info['ERASE'] = '\n'
- term.terminfo.info = info
- continue
- elif arg.startswith('-'):
- _sys.stderr.write("Unrecognized option %r\n" % (arg,))
- return 2
- args.append(arg)
- if len(args) > 2:
- _sys.stderr.write("Too many arguments\n")
- return 2
- elif len(args) < 1:
- _sys.stderr.write("Missing arguments\n")
- return 2
- basedir = args[0]
- if len(args) > 1:
- libdir = args[1]
- return run_tests(basedir, libdir)
-
-
-if __name__ == '__main__':
- _sys.exit(main())
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/setup.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/setup.py
deleted file mode 100644
index d4ca570bf29..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rcssmin/setup.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: ascii -*-
-#
-# Copyright 2006 - 2013
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys as _sys
-from _setup import run
-
-
-def setup(args=None, _manifest=0):
- """ Main setup function """
- from _setup.ext import Extension
-
- if 'java' in _sys.platform.lower():
- # no c extension for jython
- ext = None
- else:
- ext=[Extension('_rcssmin', sources=['rcssmin.c'])]
-
- return run(script_args=args, ext=ext, manifest_only=_manifest)
-
-
-def manifest():
- """ Create List of packaged files """
- return setup((), _manifest=1)
-
-
-if __name__ == '__main__':
- setup()
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/LICENSE b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/LICENSE
deleted file mode 100644
index 261eeb9e9f8..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/LICENSE
+++ /dev/null
@@ -1,201 +0,0 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/MANIFEST b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/MANIFEST
deleted file mode 100644
index 82ae367f7dd..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/MANIFEST
+++ /dev/null
@@ -1,56 +0,0 @@
-LICENSE
-MANIFEST
-PKG-INFO
-README.rst
-_setup/__init__.py
-_setup/include/cext.h
-_setup/py2/__init__.py
-_setup/py2/commands.py
-_setup/py2/data.py
-_setup/py2/dist.py
-_setup/py2/ext.py
-_setup/py2/setup.py
-_setup/py2/shell.py
-_setup/py2/util.py
-_setup/py3/__init__.py
-_setup/py3/commands.py
-_setup/py3/data.py
-_setup/py3/dist.py
-_setup/py3/ext.py
-_setup/py3/setup.py
-_setup/py3/shell.py
-_setup/py3/util.py
-bench
-bench.sh
-bench/__init__.py
-bench/apiviewer.js
-bench/bootstrap.js
-bench/jquery-1.7.1.js
-bench/jsmin.c
-bench/jsmin.py
-bench/jsmin_2_0_9.py
-bench/knockout-2.0.0.js
-bench/main.py
-bench/markermanager.js
-bench/write.py
-docs/BENCHMARKS
-docs/CHANGES
-docs/CLASSIFIERS
-docs/DESCRIPTION
-docs/PROVIDES
-docs/SUMMARY
-docs/apidoc/api-objects.txt
-docs/apidoc/crarr.png
-docs/apidoc/epydoc.css
-docs/apidoc/epydoc.js
-docs/apidoc/help.html
-docs/apidoc/identifier-index.html
-docs/apidoc/index.html
-docs/apidoc/module-tree.html
-docs/apidoc/redirect.html
-docs/apidoc/rjsmin-module.html
-docs/apidoc/rjsmin-pysrc.html
-package.cfg
-rjsmin.c
-rjsmin.py
-setup.py
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/PKG-INFO b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/PKG-INFO
deleted file mode 100644
index 1814f484649..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/PKG-INFO
+++ /dev/null
@@ -1,303 +0,0 @@
-Metadata-Version: 1.1
-Name: rjsmin
-Version: 1.0.10
-Summary: Javascript Minifier
-Home-page: http://opensource.perlig.de/rjsmin/
-Author: André Malo
-Author-email: nd@perlig.de
-License: Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-Download-URL: http://storage.perlig.de/rjsmin/
-Description: =====================
- Javascript Minifier
- =====================
-
- rJSmin is a javascript minifier written in python.
-
- The minifier is based on the semantics of `jsmin.c by Douglas Crockford`_\.
-
- The module is a re-implementation aiming for speed, so it can be used at
- runtime (rather than during a preprocessing step). Usually it produces the
- same results as the original ``jsmin.c``. It differs in the following ways:
-
- - there is no error detection: unterminated string, regex and comment
- literals are treated as regular javascript code and minified as such.
- - Control characters inside string and regex literals are left untouched; they
- are not converted to spaces (nor to \n)
- - Newline characters are not allowed inside string and regex literals, except
- for line continuations in string literals (ECMA-5).
- - "return /regex/" is recognized correctly.
- - "+ +" and "- -" sequences are not collapsed to '++' or '--'
- - Newlines before ! operators are removed more sensibly
- - Comments starting with an exclamation mark (``!``) can be kept optionally
- - rJSmin does not handle streams, but only complete strings. (However, the
- module provides a "streamy" interface).
-
- Since most parts of the logic are handled by the regex engine it's way faster
- than the original python port of ``jsmin.c`` by Baruch Even. The speed factor
- varies between about 6 and 55 depending on input and python version (it gets
- faster the more compressed the input already is). Compared to the
- speed-refactored python port by Dave St.Germain the performance gain is less
- dramatic but still between 3 and 50 (for huge inputs)). See the
- docs/BENCHMARKS file for details.
-
- rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more.
-
- Both python 2 (>=2.4) and python 3 are supported.
-
- .. _jsmin.c by Douglas Crockford: http://www.crockford.com/javascript/jsmin.c
-
-
- Copyright and License
- ~~~~~~~~~~~~~~~~~~~~~
-
- Copyright 2011 - 2014
- André Malo or his licensors, as applicable.
-
- The whole package (except for the files in the bench/ directory) is
- distributed under the Apache License Version 2.0. You'll find a copy in the
- root directory of the distribution or online at:
- <http://www.apache.org/licenses/LICENSE-2.0>.
-
-
- Bugs
- ~~~~
-
- No bugs, of course. ;-)
- But if you've found one or have an idea how to improve rjsmin, feel free
- to send a pull request on `github <https://github.com/ndparker/rjsmin>`_
- or send a mail to <rjsmin-bugs@perlig.de>.
-
-
- Author Information
- ~~~~~~~~~~~~~~~~~~
-
- André "nd" Malo <nd perlig.de>
- GPG: 0x8103A37E
-
-
- If God intended people to be naked, they would be born that way.
- -- Oscar Wilde
-
- .. vim:tw=72 syntax=rest
-Keywords: Javascript,Minimization
-Platform: UNKNOWN
-Classifier: Development Status :: 5 - Production/Stable
-Classifier: Environment :: Web Environment
-Classifier: Intended Audience :: Developers
-Classifier: License :: OSI Approved
-Classifier: License :: OSI Approved :: Apache License, Version 2.0
-Classifier: Operating System :: OS Independent
-Classifier: Programming Language :: C
-Classifier: Programming Language :: Python
-Classifier: Programming Language :: Python :: 2
-Classifier: Programming Language :: Python :: 3
-Classifier: Programming Language :: Python :: Implementation :: CPython
-Classifier: Programming Language :: Python :: Implementation :: Jython
-Classifier: Programming Language :: Python :: Implementation :: PyPy
-Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
-Classifier: Topic :: Software Development :: Libraries
-Classifier: Topic :: Software Development :: Libraries :: Python Modules
-Classifier: Topic :: Text Processing
-Classifier: Topic :: Text Processing :: Filters
-Classifier: Topic :: Utilities
-Provides: rjsmin (1.0)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/README.chromium b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/README.chromium
deleted file mode 100644
index 022e86b94f2..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/README.chromium
+++ /dev/null
@@ -1,15 +0,0 @@
-Short Name: rJSmin
-URL: http://opensource.perlig.de/rjsmin/
-Version: 1.0.10
-License: Apache 2.0
-License File: NOT_SHIPPED
-Security Critical: no
-
-Description:
-rJSmin is a javascript minifier written in python.
-The minifier is based on the semantics of jsmin.c by Douglas Crockford.
-The module is a re-implementation aiming for speed, so it can be used at runtime (rather than during a preprocessing step). Usually it produces the same results as the original jsmin.c.
-
-Modifications made:
- - Removed the bench.sh since the file doesn't have the licensing info and
- caused license checker to fail.
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/README.rst b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/README.rst
deleted file mode 100644
index efcc28e9ea8..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/README.rst
+++ /dev/null
@@ -1,141 +0,0 @@
-.. -*- coding: utf-8 -*-
-
-===========================================
- rJSmin - A Javascript Minifier For Python
-===========================================
-
-TABLE OF CONTENTS
------------------
-
-1. Introduction
-2. Copyright and License
-3. System Requirements
-4. Installation
-5. Documentation
-6. Bugs
-7. Author Information
-
-
-INTRODUCTION
-------------
-
-rJSmin is a javascript minifier written in python.
-
-The minifier is based on the semantics of `jsmin.c by Douglas Crockford`_\.
-
-The module is a re-implementation aiming for speed, so it can be used at
-runtime (rather than during a preprocessing step). Usually it produces the
-same results as the original ``jsmin.c``. It differs in the following ways:
-
-- there is no error detection: unterminated string, regex and comment
- literals are treated as regular javascript code and minified as such.
-- Control characters inside string and regex literals are left untouched; they
- are not converted to spaces (nor to \\n)
-- Newline characters are not allowed inside string and regex literals, except
- for line continuations in string literals (ECMA-5).
-- "return /regex/" is recognized correctly.
-- "+ +" and "- -" sequences are not collapsed to '++' or '--'
-- Newlines before ! operators are removed more sensibly
-- Comments starting with an exclamation mark (``!``) can be kept optionally
-- rJSmin does not handle streams, but only complete strings. (However, the
- module provides a "streamy" interface).
-
-Since most parts of the logic are handled by the regex engine it's way faster
-than the original python port of ``jsmin.c`` by Baruch Even. The speed factor
-varies between about 6 and 55 depending on input and python version (it gets
-faster the more compressed the input already is). Compared to the
-speed-refactored python port by Dave St.Germain the performance gain is less
-dramatic but still between 3 and 50 (for huge inputs). See the docs/BENCHMARKS
-file for details.
-
-rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more.
-
-.. _jsmin.c by Douglas Crockford: http://www.crockford.com/javascript/jsmin.c
-
-
-COPYRIGHT AND LICENSE
----------------------
-
-Copyright 2011 - 2014
-André Malo or his licensors, as applicable.
-
-The whole package (except for the files in the bench/ directory)
-is distributed under the Apache License Version 2.0. You'll find a copy in the
-root directory of the distribution or online at:
-<http://www.apache.org/licenses/LICENSE-2.0>.
-
-
-SYSTEM REQUIREMENTS
--------------------
-
-Both python 2 (>=2.4) and python 3 are supported.
-
-
-INSTALLATION
-------------
-
-Using pip
-~~~~~~~~~
-
-$ pip install rjsmin
-
-
-Using distutils
-~~~~~~~~~~~~~~~
-
-$ python setup.py install
-
-The following extra options to the install command may be of interest:
-
- --without-c-extensions Don't install C extensions
- --without-docs Do not install documentation files
-
-
-Drop-in
-~~~~~~~
-
-rJSmin effectively consists of two files: rjsmin.py and rjsmin.c, the
-latter being entirely optional. So, for simple integration you can just
-copy rjsmin.py into your project and use it.
-
-
-DOCUMENTATION
--------------
-
-A generated API documentation is available in the docs/apidoc/ directory.
-But you can just look into the module. It provides a simple function,
-called jsmin which takes the script as a string and returns the minified
-script as a string.
-
-The module additionally provides a "streamy" interface similar to the one
-jsmin.c provides:
-
-$ python -mrjsmin <script >minified
-
-It takes two options:
-
- -b Keep bang-comments (Comments starting with an exclamation mark)
- -p Force using the python implementation (not the C implementation)
-
-The latest documentation is also available online at
-<http://opensource.perlig.de/rjsmin/>.
-
-
-BUGS
-----
-
-No bugs, of course. ;-)
-But if you've found one or have an idea how to improve rjsmin, feel free
-to send a pull request on `github <https://github.com/ndparker/rjsmin>`_
-or send a mail to <rjsmin-bugs@perlig.de>.
-
-
-AUTHOR INFORMATION
-------------------
-
-André "nd" Malo <nd@perlig.de>
-GPG: 0x8103A37E
-
-
- If God intended people to be naked, they would be born that way.
- -- Oscar Wilde
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/__init__.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/__init__.py
deleted file mode 100644
index 77dc23c8412..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/__init__.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-================
- Package _setup
-================
-
-This package provides tools for main package setup.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import os as _os
-import sys as _sys
-
-if _sys.version_info[0] == 2:
- __path__ = [_os.path.join(__path__[0], 'py2')]
- __author__ = __author__.decode('latin-1')
-elif _sys.version_info[0] == 3:
- __path__ = [_os.path.join(__path__[0], 'py3')]
-else:
- raise RuntimeError("Unsupported python version")
-del _os, _sys
-
-from _setup.setup import run # pylint: disable = W0611
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/include/cext.h b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/include/cext.h
deleted file mode 100644
index 47b6f5b9c11..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/include/cext.h
+++ /dev/null
@@ -1,244 +0,0 @@
-/*
- * Copyright 2006 - 2014
- * Andr\xe9 Malo or his licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * central naming stuff
- */
-
-#ifndef SETUP_CEXT_H
-#define SETUP_CEXT_H
-
-#ifndef EXT_MODULE
-#error EXT_MODULE must be defined outside of this file (-DEXT_MODULE=...)
-#endif
-
-/*
- * include core header files
- */
-#define PY_SSIZE_T_CLEAN
-
-#include "Python.h"
-#include "structmember.h"
-
-/*
- * define our helper macros depending on the stuff above
- */
-#define STRINGIFY(n) STRINGIFY_HELPER(n)
-#define STRINGIFY_HELPER(n) #n
-#define CONCATENATE(first, second) CONCATENATE_HELPER(first, second)
-#define CONCATENATE_HELPER(first, second) first##second
-
-#define EXT_MODULE_NAME STRINGIFY(EXT_MODULE)
-#ifdef EXT_PACKAGE
-#define EXT_PACKAGE_NAME STRINGIFY(EXT_PACKAGE)
-#define EXT_MODULE_PATH EXT_PACKAGE_NAME "." EXT_MODULE_NAME
-#else
-#define EXT_PACKAGE_NAME ""
-#define EXT_MODULE_PATH EXT_MODULE_NAME
-#endif
-
-#define EXT_DOCS_VAR CONCATENATE(var, CONCATENATE(EXT_MODULE, __doc__))
-#define EXT_METHODS_VAR CONCATENATE(var, CONCATENATE(EXT_MODULE, _methods))
-#define EXT_METHODS static PyMethodDef EXT_METHODS_VAR[]
-
-#define EXT_DEFINE_VAR CONCATENATE(var, CONCATENATE(EXT_MODULE, _module))
-
-/* Py3K Support */
-#if PY_MAJOR_VERSION >= 3
-
-#define EXT3
-
-#ifndef PyMODINIT_FUNC
-#define EXT_INIT_FUNC PyObject *CONCATENATE(PyInit_, EXT_MODULE)(void)
-#else
-#define EXT_INIT_FUNC PyMODINIT_FUNC CONCATENATE(PyInit_, EXT_MODULE)(void)
-#endif
-
-#define EXT_DEFINE(name, methods, doc) \
-static struct PyModuleDef EXT_DEFINE_VAR = { \
- PyModuleDef_HEAD_INIT, \
- name, \
- doc, \
- -1, \
- methods, \
- NULL, \
- NULL, \
- NULL, \
- NULL \
-}
-
-#define EXT_CREATE(def) (PyModule_Create(def))
-#define EXT_INIT_ERROR(module) do {Py_XDECREF(module); return NULL;} while(0)
-#define EXT_INIT_RETURN(module) return module
-
-#else /* end py3k */
-
-#define EXT2
-
-#ifndef PyMODINIT_FUNC
-#define EXT_INIT_FUNC void CONCATENATE(init, EXT_MODULE)(void)
-#else
-#define EXT_INIT_FUNC PyMODINIT_FUNC CONCATENATE(init, EXT_MODULE)(void)
-#endif
-
-#define EXT_DEFINE__STRUCT \
- CONCATENATE(struct, CONCATENATE(EXT_MODULE, _module))
-
-struct EXT_DEFINE__STRUCT {
- char *m_name;
- char *m_doc;
- PyMethodDef *m_methods;
-};
-#define EXT_DEFINE(name, methods, doc) \
-static struct EXT_DEFINE__STRUCT EXT_DEFINE_VAR = { \
- name, \
- doc, \
- methods \
-}
-
-#define EXT_CREATE(def) ((def)->m_doc \
- ? Py_InitModule3((def)->m_name, (def)->m_methods, (def)->m_doc) \
- : Py_InitModule((def)->m_name, (def)->m_methods) \
-)
-#define EXT_INIT_ERROR(module) return
-#define EXT_INIT_RETURN(module) return
-
-#endif /* end py2K */
-
-#define EXT_INIT_TYPE(module, type) do { \
- if (PyType_Ready(type) < 0) \
- EXT_INIT_ERROR(module); \
-} while (0)
-
-#define EXT_ADD_TYPE(module, name, type) do { \
- Py_INCREF(type); \
- if (PyModule_AddObject(module, name, (PyObject *)(type)) < 0) \
- EXT_INIT_ERROR(module); \
-} while (0)
-
-#define EXT_ADD_UNICODE(module, name, string, encoding) do { \
- if (PyModule_AddObject( \
- module, \
- name, \
- PyUnicode_Decode( \
- string, \
- sizeof(string) - 1, \
- encoding, \
- "strict" \
- )) < 0) \
- EXT_INIT_ERROR(module); \
-} while (0)
-
-#define EXT_ADD_STRING(module, name, string) do { \
- if (PyModule_AddStringConstant(module, name, string) < 0) \
- EXT_INIT_ERROR(module); \
-} while (0)
-
-#define EXT_ADD_INT(module, name, number) do { \
- if (PyModule_AddIntConstant(module, name, number) < 0) \
- EXT_INIT_ERROR(module); \
-} while (0)
-
-
-/* PEP 353 support, implemented as of python 2.5 */
-#if PY_VERSION_HEX < 0x02050000
-typedef int Py_ssize_t;
-#define PyInt_FromSsize_t(arg) PyInt_FromLong((long)arg)
-#define PyInt_AsSsize_t(arg) (int)PyInt_AsLong(arg)
-#define PY_SSIZE_T_MAX ((Py_ssize_t)INT_MAX)
-#endif
-
-/*
- * some helper macros (Python 2.4)
- */
-#ifndef Py_VISIT
-#define Py_VISIT(op) do { \
- if (op) { \
- int vret = visit((op), arg); \
- if (vret) return vret; \
- } \
-} while (0)
-#endif
-
-#ifdef Py_CLEAR
-#undef Py_CLEAR
-#endif
-#define Py_CLEAR(op) do { \
- if (op) { \
- PyObject *tmp__ = (PyObject *)(op); \
- (op) = NULL; \
- Py_DECREF(tmp__); \
- } \
-} while (0)
-
-#ifndef Py_RETURN_NONE
-#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None
-#endif
-
-#ifndef Py_RETURN_FALSE
-#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False
-#endif
-
-#ifndef Py_RETURN_TRUE
-#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True
-#endif
-
-/* Macros for inline documentation. (Python 2.3) */
-#ifndef PyDoc_VAR
-#define PyDoc_VAR(name) static char name[]
-#endif
-
-#ifndef PyDoc_STRVAR
-#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
-#endif
-
-#ifndef PyDoc_STR
-#ifdef WITH_DOC_STRINGS
-#define PyDoc_STR(str) str
-#else
-#define PyDoc_STR(str) ""
-#endif
-#endif
-
-/* Basestring check (basestring introduced in Python 2.3) */
-#if PY_VERSION_HEX < 0x02030000
-#define BaseString_Check(type) ( \
- PyObject_TypeCheck((type), &PyString_Type) \
- || PyObject_TypeCheck((type), &PyUnicode_Type) \
-)
-#else
-#define BaseString_Check(type) PyObject_TypeCheck((type), &PyBaseString_Type)
-#endif
-
-#define GENERIC_ALLOC(type) \
- ((void *)((PyTypeObject *)type)->tp_alloc(type, (Py_ssize_t)0))
-
-/* PyPy doesn't define it */
-#ifndef PyType_IS_GC
-#define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC)
-#endif
-
-#define DEFINE_GENERIC_DEALLOC(prefix) \
-static void prefix##_dealloc(void *self) \
-{ \
- if (PyType_IS_GC(((PyObject *)self)->ob_type)) \
- PyObject_GC_UnTrack(self); \
- (void)prefix##_clear(self); \
- ((PyObject *)self)->ob_type->tp_free((PyObject *)self); \
-}
-
-#endif /* SETUP_CEXT_H */
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/__init__.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/__init__.py
deleted file mode 100644
index 9582ecc1087..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/__init__.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-================
- Package _setup
-================
-
-This package provides tools for main package setup.
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-from _setup.setup import run # pylint: disable = W0611
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/commands.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/commands.py
deleted file mode 100644
index a41b166e0a5..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/commands.py
+++ /dev/null
@@ -1,267 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- Command extenders
-===================
-
-Command extenders.
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-__test__ = False
-
-from distutils import fancy_getopt as _fancy_getopt
-from distutils.command import build as _build
-from distutils.command import build_ext as _build_ext
-from distutils.command import install as _install
-from distutils.command import install_data as _install_data
-from distutils.command import install_lib as _install_lib
-import os as _os
-
-from _setup.util import log
-
-_option_defaults = {}
-_option_inherits = {}
-_option_finalizers = {}
-_command_mapping = {
- 'install': 'Install',
- 'install_data': 'InstallData',
- 'install_lib': 'InstallLib',
- 'build': 'Build',
- 'build_ext': 'BuildExt',
-}
-
-
-def add_option(command, long_name, help_text, short_name=None, default=None,
- inherit=None):
- """ Add an option """
- try:
- command_class = globals()[_command_mapping[command]]
- except KeyError:
- raise ValueError("Unknown command %r" % (command,))
- for opt in command_class.user_options:
- if opt[0] == long_name:
- break
- else:
- opt = (long_name, short_name, help_text)
- command_class.user_options.append(opt)
- if not long_name.endswith('='):
- command_class.boolean_options.append(long_name)
- attr_name = _fancy_getopt.translate_longopt(long_name)
- else:
- attr_name = _fancy_getopt.translate_longopt(long_name[:-1])
- if not _option_defaults.has_key(command):
- _option_defaults[command] = []
- if inherit is not None:
- if isinstance(inherit, (str, unicode)):
- inherit = [inherit]
- for i_inherit in inherit:
- add_option(
- i_inherit, long_name, help_text, short_name, default
- )
- default = None
- if not _option_inherits.has_key(command):
- _option_inherits[command] = []
- for i_inherit in inherit:
- for i_command, opt_name in _option_inherits[command]:
- if i_command == i_inherit and opt_name == attr_name:
- break
- else:
- _option_inherits[command].append((i_inherit, attr_name))
- _option_defaults[command].append((attr_name, default))
-
-
-def add_finalizer(command, key, func):
- """ Add finalizer """
- if not _option_finalizers.has_key(command):
- _option_finalizers[command] = {}
- if not _option_finalizers[command].has_key(key):
- _option_finalizers[command][key] = func
-
-
-class Install(_install.install):
- """ Extended installer to reflect the additional data options """
- user_options = _install.install.user_options + [
- ('single-version-externally-managed', None,
- "Compat option. Does not a thing."),
- ]
- boolean_options = _install.install.boolean_options + [
- 'single-version-externally-managed'
- ]
-
- def initialize_options(self):
- """ Prepare for new options """
- _install.install.initialize_options(self)
- self.single_version_externally_managed = None
- if _option_defaults.has_key('install'):
- for opt_name, default in _option_defaults['install']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _install.install.finalize_options(self)
- if _option_inherits.has_key('install'):
- for parent, opt_name in _option_inherits['install']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if _option_finalizers.has_key('install'):
- for func in _option_finalizers['install'].values():
- func(self)
-
-
-class InstallData(_install_data.install_data):
- """ Extended data installer """
- user_options = _install_data.install_data.user_options + []
- boolean_options = _install_data.install_data.boolean_options + []
-
- def initialize_options(self):
- """ Prepare for new options """
- _install_data.install_data.initialize_options(self)
- if _option_defaults.has_key('install_data'):
- for opt_name, default in _option_defaults['install_data']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _install_data.install_data.finalize_options(self)
- if _option_inherits.has_key('install_data'):
- for parent, opt_name in _option_inherits['install_data']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if _option_finalizers.has_key('install_data'):
- for func in _option_finalizers['install_data'].values():
- func(self)
-
-
-class InstallLib(_install_lib.install_lib):
- """ Extended lib installer """
- user_options = _install_lib.install_lib.user_options + []
- boolean_options = _install_lib.install_lib.boolean_options + []
-
- def initialize_options(self):
- """ Prepare for new options """
- _install_lib.install_lib.initialize_options(self)
- if _option_defaults.has_key('install_lib'):
- for opt_name, default in _option_defaults['install_lib']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _install_lib.install_lib.finalize_options(self)
- if _option_inherits.has_key('install_lib'):
- for parent, opt_name in _option_inherits['install_lib']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if _option_finalizers.has_key('install_lib'):
- for func in _option_finalizers['install_lib'].values():
- func(self)
-
-
-class BuildExt(_build_ext.build_ext):
- """
- Extended extension builder class
-
- This class allows extensions to provide a ``check_prerequisites`` method
- which is called before actually building it. The method takes the
- `BuildExt` instance and returns whether the extension should be skipped or
- not.
- """
-
- def initialize_options(self):
- """ Prepare for new options """
- _build_ext.build_ext.initialize_options(self)
- if _option_defaults.has_key('build_ext'):
- for opt_name, default in _option_defaults['build_ext']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _build_ext.build_ext.finalize_options(self)
- if _option_inherits.has_key('build_ext'):
- for parent, opt_name in _option_inherits['build_ext']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if _option_finalizers.has_key('build_ext'):
- for func in _option_finalizers['build_ext'].values():
- func(self)
-
- def build_extension(self, ext):
- """
- Build C extension - with extended functionality
-
- The following features are added here:
-
- - ``ext.check_prerequisites`` is called before the extension is being
- built. See `Extension` for details. If the method does not exist,
- simply no check will be run.
- - The macros ``EXT_PACKAGE`` and ``EXT_MODULE`` will be filled (or
- unset) depending on the extensions name, but only if they are not
- already defined.
-
- :Parameters:
- `ext` : `Extension`
- The extension to build. If it's a pure
- ``distutils.core.Extension``, simply no prequisites check is
- applied.
-
- :Return: whatever ``distutils.command.build_ext.build_ext`` returns
- :Rtype: any
- """
- # handle name macros
- macros = dict(ext.define_macros or ())
- tup = ext.name.split('.')
- if len(tup) == 1:
- pkg, mod = None, tup[0]
- else:
- pkg, mod = '.'.join(tup[:-1]), tup[-1]
- if pkg is not None and 'EXT_PACKAGE' not in macros:
- ext.define_macros.append(('EXT_PACKAGE', pkg))
- if 'EXT_MODULE' not in macros:
- ext.define_macros.append(('EXT_MODULE', mod))
- if pkg is None:
- macros = dict(ext.undef_macros or ())
- if 'EXT_PACKAGE' not in macros:
- ext.undef_macros.append('EXT_PACKAGE')
-
- # handle prereq checks
- try:
- checker = ext.check_prerequisites
- except AttributeError:
- pass
- else:
- if checker(self):
- log.info("Skipping %s extension" % ext.name)
- return
-
- return _build_ext.build_ext.build_extension(self, ext)
-
-
-class Build(_build.build):
-
- def initialize_options(self):
- """ Prepare for new options """
- _build.build.initialize_options(self)
- if _option_defaults.has_key('build'):
- for opt_name, default in _option_defaults['build']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _build.build.finalize_options(self)
- if _option_inherits.has_key('build'):
- for parent, opt_name in _option_inherits['build']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if _option_finalizers.has_key('build'):
- for func in _option_finalizers['build'].values():
- func(self)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/data.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/data.py
deleted file mode 100644
index 9cf04e104c2..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/data.py
+++ /dev/null
@@ -1,165 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- Data distribution
-===================
-
-This module provides tools to simplify data distribution.
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-from distutils import filelist as _filelist
-import os as _os
-import posixpath as _posixpath
-import sys as _sys
-
-from _setup import commands as _commands
-
-
-def splitpath(path):
- """ Split a path """
- drive, path = '', _os.path.normpath(path)
- try:
- splitunc = _os.path.splitunc
- except AttributeError:
- pass
- else:
- drive, path = splitunc(path)
- if not drive:
- drive, path = _os.path.splitdrive(path)
- elems = []
- try:
- sep = _os.path.sep
- except AttributeError:
- sep = _os.path.join('1', '2')[1:-1]
- while 1:
- prefix, path = _os.path.split(path)
- elems.append(path)
- if prefix in ('', sep):
- drive = _os.path.join(drive, prefix)
- break
- path = prefix
- elems.reverse()
- return drive, elems
-
-
-def finalizer(installer):
- """ Finalize install_data """
- data_files = []
- for item in installer.data_files:
- if not isinstance(item, Data):
- data_files.append(item)
- continue
- data_files.extend(item.flatten(installer))
- installer.data_files = data_files
-
-
-class Data(object):
- """ File list container """
-
- def __init__(self, files, target=None, preserve=0, strip=0,
- prefix=None):
- """ Initialization """
- self._files = files
- self._target = target
- self._preserve = preserve
- self._strip = strip
- self._prefix = prefix
- self.fixup_commands()
-
- def fixup_commands(self):
- pass
-
- def from_templates(cls, *templates, **kwargs):
- """ Initialize from template """
- files = _filelist.FileList()
- for tpl in templates:
- for line in tpl.split(';'):
- files.process_template_line(line.strip())
- files.sort()
- files.remove_duplicates()
- result = []
- for filename in files.files:
- _, elems = splitpath(filename)
- if '.svn' in elems or '.git' in elems:
- continue
- result.append(filename)
- return cls(result, **kwargs)
- from_templates = classmethod(from_templates)
-
- def flatten(self, installer):
- """ Flatten the file list to (target, file) tuples """
- # pylint: disable = W0613
- if self._prefix:
- _, prefix = splitpath(self._prefix)
- telems = prefix
- else:
- telems = []
-
- tmap = {}
- for fname in self._files:
- (_, name), target = splitpath(fname), telems
- if self._preserve:
- if self._strip:
- name = name[max(0, min(self._strip, len(name) - 1)):]
- if len(name) > 1:
- target = telems + name[:-1]
- tmap.setdefault(_posixpath.join(*target), []).append(fname)
- return tmap.items()
-
-
-class Documentation(Data):
- """ Documentation container """
-
- def fixup_commands(self):
- _commands.add_option('install_data', 'without-docs',
- help_text='Do not install documentation files',
- inherit='install',
- )
- _commands.add_finalizer('install_data', 'documentation', finalizer)
-
- def flatten(self, installer):
- """ Check if docs should be installed at all """
- if installer.without_docs:
- return []
- return Data.flatten(self, installer)
-
-
-class Manpages(Documentation):
- """ Manpages container """
-
- def dispatch(cls, files):
- """ Automatically dispatch manpages to their target directories """
- mpmap = {}
- for manpage in files:
- normalized = _os.path.normpath(manpage)
- _, ext = _os.path.splitext(normalized)
- if ext.startswith(_os.path.extsep):
- ext = ext[len(_os.path.extsep):]
- mpmap.setdefault(ext, []).append(manpage)
- return [cls(manpages, prefix=_posixpath.join(
- 'share', 'man', 'man%s' % section,
- )) for section, manpages in mpmap.items()]
- dispatch = classmethod(dispatch)
-
- def flatten(self, installer):
- """ Check if manpages are suitable """
- if _sys.platform == 'win32':
- return []
- return Documentation.flatten(self, installer)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/dist.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/dist.py
deleted file mode 100644
index 21a65415185..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/dist.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-================
- dist utilities
-================
-
-dist utilities.
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import sys as _sys
-
-from _setup import shell as _shell
-
-
-def run_setup(*args, **kwargs):
- """ Run setup """
- if 'setup' in kwargs:
- script = kwargs.get('setup') or 'setup.py'
- del kwargs['setup']
- else:
- script = 'setup.py'
- if 'fakeroot' in kwargs:
- fakeroot = kwargs['fakeroot']
- del kwargs['fakeroot']
- else:
- fakeroot = None
- if kwargs:
- raise TypeError("Unrecognized keyword parameters")
-
- script = _shell.native(script)
- argv = [_sys.executable, script] + list(args)
- if fakeroot:
- argv.insert(0, fakeroot)
- return not _shell.spawn(*argv)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/ext.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/ext.py
deleted file mode 100644
index bcc0209a53a..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/ext.py
+++ /dev/null
@@ -1,254 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- C extension tools
-===================
-
-C extension tools.
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-__test__ = False
-
-from distutils import core as _core
-from distutils import errors as _distutils_errors
-import os as _os
-import posixpath as _posixpath
-import shutil as _shutil
-import tempfile as _tempfile
-
-from _setup import commands as _commands
-from _setup.util import log
-
-
-def _install_finalizer(installer):
- if installer.without_c_extensions:
- installer.distribution.ext_modules = []
-
-def _build_finalizer(builder):
- if builder.without_c_extensions:
- builder.extensions = []
-
-
-class Extension(_core.Extension):
- """
- Extension with prerequisite check interface
-
- If your check is cacheable (during the setup run), override
- `cached_check_prerequisites`, `check_prerequisites` otherwise.
-
- :IVariables:
- `cached_check` : ``bool``
- The cached check result
- """
- cached_check = None
-
- def __init__(self, *args, **kwargs):
- """ Initialization """
- if kwargs.has_key('depends'):
- self.depends = kwargs['depends'] or []
- else:
- self.depends = []
- _core.Extension.__init__(self, *args, **kwargs)
-
- # add include path
- included = _posixpath.join('_setup', 'include')
- if included not in self.include_dirs:
- self.include_dirs.append(included)
-
- # add cext.h to the dependencies
- cext_h = _posixpath.join(included, 'cext.h')
- if cext_h not in self.depends:
- self.depends.append(cext_h)
-
- _commands.add_option('install_lib', 'without-c-extensions',
- help_text='Don\'t install C extensions',
- inherit='install',
- )
- _commands.add_finalizer('install_lib', 'c-extensions',
- _install_finalizer
- )
- _commands.add_option('build_ext', 'without-c-extensions',
- help_text='Don\'t build C extensions',
- inherit=('build', 'install_lib'),
- )
- _commands.add_finalizer('build_ext', 'c-extensions', _build_finalizer)
-
- def check_prerequisites(self, build):
- """
- Check prerequisites
-
- The check should cover all dependencies needed for the extension to
- be built and run. The method can do the following:
-
- - return a false value: the extension will be built
- - return a true value: the extension will be skipped. This is useful
- for optional extensions
- - raise an exception. This is useful for mandatory extensions
-
- If the check result is cacheable (during the setup run), override
- `cached_check_prerequisites` instead.
-
- :Parameters:
- `build` : `BuildExt`
- The extension builder
-
- :Return: Skip the extension?
- :Rtype: ``bool``
- """
- if self.cached_check is None:
- log.debug("PREREQ check for %s" % self.name)
- self.cached_check = self.cached_check_prerequisites(build)
- else:
- log.debug("PREREQ check for %s (cached)" % self.name)
- return self.cached_check
-
- def cached_check_prerequisites(self, build):
- """
- Check prerequisites
-
- The check should cover all dependencies needed for the extension to
- be built and run. The method can do the following:
-
- - return a false value: the extension will be built
- - return a true value: the extension will be skipped. This is useful
- for optional extensions
- - raise an exception. This is useful for mandatory extensions
-
- If the check result is *not* cacheable (during the setup run),
- override `check_prerequisites` instead.
-
- :Parameters:
- `build` : `BuildExt`
- The extension builder
-
- :Return: Skip the extension?
- :Rtype: ``bool``
- """
- # pylint: disable = W0613
- log.debug("Nothing to check for %s!" % self.name)
- return False
-
-
-class ConfTest(object):
- """
- Single conftest abstraction
-
- :IVariables:
- `_tempdir` : ``str``
- The tempdir created for this test
-
- `src` : ``str``
- Name of the source file
-
- `target` : ``str``
- Target filename
-
- `compiler` : ``CCompiler``
- compiler instance
-
- `obj` : ``list``
- List of object filenames (``[str, ...]``)
- """
- _tempdir = None
-
- def __init__(self, build, source):
- """
- Initialization
-
- :Parameters:
- `build` : ``distuils.command.build_ext.build_ext``
- builder instance
-
- `source` : ``str``
- Source of the file to compile
- """
- self._tempdir = tempdir = _tempfile.mkdtemp()
- src = _os.path.join(tempdir, 'conftest.c')
- fp = open(src, 'w')
- try:
- fp.write(source)
- finally:
- fp.close()
- self.src = src
- self.compiler = compiler = build.compiler
- self.target = _os.path.join(tempdir, 'conftest')
- self.obj = compiler.object_filenames([src], output_dir=tempdir)
-
- def __del__(self):
- """ Destruction """
- self.destroy()
-
- def destroy(self):
- """ Destroy the conftest leftovers on disk """
- tempdir, self._tempdir = self._tempdir, None
- if tempdir is not None:
- _shutil.rmtree(tempdir)
-
- def compile(self, **kwargs):
- """
- Compile the conftest
-
- :Parameters:
- `kwargs` : ``dict``
- Optional keyword parameters for the compiler call
-
- :Return: Was the compilation successful?
- :Rtype: ``bool``
- """
- kwargs['output_dir'] = self._tempdir
- try:
- self.compiler.compile([self.src], **kwargs)
- except _distutils_errors.CompileError:
- return False
- return True
-
- def link(self, **kwargs):
- r"""
- Link the conftest
-
- Before you can link the conftest objects they need to be `compile`\d.
-
- :Parameters:
- `kwargs` : ``dict``
- Optional keyword parameters for the linker call
-
- :Return: Was the linking successful?
- :Rtype: ``bool``
- """
- try:
- self.compiler.link_executable(self.obj, self.target, **kwargs)
- except _distutils_errors.LinkError:
- return False
- return True
-
- def pipe(self, mode="r"):
- r"""
- Execute the conftest binary and connect to it using a pipe
-
- Before you can pipe to or from the conftest binary it needs to
- be `link`\ed.
-
- :Parameters:
- `mode` : ``str``
- Pipe mode - r/w
-
- :Return: The open pipe
- :Rtype: ``file``
- """
- return _os.popen(self.compiler.executable_filename(self.target), mode)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/setup.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/setup.py
deleted file mode 100644
index fd86f62f9bc..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/setup.py
+++ /dev/null
@@ -1,419 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007 - 2013
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- Main setup runner
-===================
-
-This module provides a wrapper around the distutils core setup.
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import ConfigParser as _config_parser
-from distutils import core as _core
-import os as _os
-import posixpath as _posixpath
-import sys as _sys
-
-from _setup import commands as _commands
-from _setup import data as _data
-from _setup import ext as _ext
-from _setup import util as _util
-from _setup import shell as _shell
-
-
-def check_python_version(impl, version_min, version_max):
- """ Check python version """
- if impl == 'python':
- version_info = _sys.version_info
- elif impl == 'pypy':
- version_info = getattr(_sys, 'pypy_version_info', None)
- if not version_info:
- return
- elif impl == 'jython':
- if not 'java' in _sys.platform.lower():
- return
- version_info = _sys.version_info
- else:
- raise AssertionError("impl not in ('python', 'pypy', 'jython')")
-
- pyversion = map(int, version_info[:3])
- if version_min:
- min_required = \
- map(int, '.'.join((version_min, '0.0.0')).split('.')[:3])
- if pyversion < min_required:
- raise EnvironmentError("Need at least %s %s (vs. %s)" % (
- impl, version_min, '.'.join(map(str, pyversion))
- ))
- if version_max:
- max_required = map(int, version_max.split('.'))
- max_required[-1] += 1
- if pyversion >= max_required:
- raise EnvironmentError("Need at max %s %s (vs. %s)" % (
- impl,
- version_max,
- '.'.join(map(str, pyversion))
- ))
-
-
-def find_description(docs):
- """
- Determine the package description from DESCRIPTION
-
- :Parameters:
- `docs` : ``dict``
- Docs config section
-
- :Return: Tuple of summary, description and license
- (``('summary', 'description', 'license')``)
- (all may be ``None``)
- :Rtype: ``tuple``
- """
- summary = None
- filename = docs.get('meta.summary', 'SUMMARY').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename)
- try:
- try:
- summary = fp.read().strip().splitlines()[0].rstrip()
- except IndexError:
- summary = ''
- finally:
- fp.close()
-
- description = None
- filename = docs.get('meta.description', 'DESCRIPTION').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename)
- try:
- description = fp.read().rstrip()
- finally:
- fp.close()
-
- if summary is None and description:
- from docutils import core
- summary = core.publish_parts(
- source=description,
- source_path=filename,
- writer_name='html',
- )['title'].encode('utf-8')
-
- return summary, description
-
-
-def find_classifiers(docs):
- """
- Determine classifiers from CLASSIFIERS
-
- :return: List of classifiers (``['classifier', ...]``)
- :rtype: ``list``
- """
- filename = docs.get('meta.classifiers', 'CLASSIFIERS').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename)
- try:
- content = fp.read()
- finally:
- fp.close()
- content = [item.strip() for item in content.splitlines()]
- return [item for item in content if item and not item.startswith('#')]
- return []
-
-
-def find_provides(docs):
- """
- Determine provides from PROVIDES
-
- :return: List of provides (``['provides', ...]``)
- :rtype: ``list``
- """
- filename = docs.get('meta.provides', 'PROVIDES').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename)
- try:
- content = fp.read()
- finally:
- fp.close()
- content = [item.strip() for item in content.splitlines()]
- return [item for item in content if item and not item.startswith('#')]
- return []
-
-
-def find_license(docs):
- """
- Determine license from LICENSE
-
- :return: License text
- :rtype: ``str``
- """
- filename = docs.get('meta.license', 'LICENSE').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename)
- try:
- return fp.read().rstrip()
- finally:
- fp.close()
- return None
-
-
-def find_packages(manifest):
- """ Determine packages and subpackages """
- packages = {}
- collect = manifest.get('packages.collect', '').split()
- lib = manifest.get('packages.lib', '.')
- try:
- sep = _os.path.sep
- except AttributeError:
- sep = _os.path.join('1', '2')[1:-1]
- for root in collect:
- for dirpath, _, filenames in _shell.walk(_os.path.join(lib, root)):
- if dirpath.find('.svn') >= 0 or dirpath.find('.git') >= 0:
- continue
- if '__init__.py' in filenames:
- packages[
- _os.path.normpath(dirpath).replace(sep, '.')
- ] = None
- packages = packages.keys()
- packages.sort()
- return packages
-
-
-def find_data(name, docs):
- """ Determine data files """
- result = []
- if docs.get('extra', '').strip():
- result.append(_data.Documentation(docs['extra'].split(),
- prefix='share/doc/%s' % name,
- ))
- if docs.get('examples.dir', '').strip():
- tpl = ['recursive-include %s *' % docs['examples.dir']]
- if docs.get('examples.ignore', '').strip():
- tpl.extend(["global-exclude %s" % item
- for item in docs['examples.ignore'].split()
- ])
- strip = int(docs.get('examples.strip', '') or 0)
- result.append(_data.Documentation.from_templates(*tpl, **{
- 'strip': strip,
- 'prefix': 'share/doc/%s' % name,
- 'preserve': 1,
- }))
- if docs.get('userdoc.dir', '').strip():
- tpl = ['recursive-include %s *' % docs['userdoc.dir']]
- if docs.get('userdoc.ignore', '').strip():
- tpl.extend(["global-exclude %s" % item
- for item in docs['userdoc.ignore'].split()
- ])
- strip = int(docs.get('userdoc.strip', '') or 0)
- result.append(_data.Documentation.from_templates(*tpl, **{
- 'strip': strip,
- 'prefix': 'share/doc/%s' % name,
- 'preserve': 1,
- }))
- if docs.get('apidoc.dir', '').strip():
- tpl = ['recursive-include %s *' % docs['apidoc.dir']]
- if docs.get('apidoc.ignore', '').strip():
- tpl.extend(["global-exclude %s" % item
- for item in docs['apidoc.ignore'].split()
- ])
- strip = int(docs.get('apidoc.strip', '') or 0)
- result.append(_data.Documentation.from_templates(*tpl, **{
- 'strip': strip,
- 'prefix': 'share/doc/%s' % name,
- 'preserve': 1,
- }))
- if docs.get('man', '').strip():
- result.extend(_data.Manpages.dispatch(docs['man'].split()))
- return result
-
-
-def make_manifest(manifest, config, docs, kwargs):
- """ Create file list to pack up """
- # pylint: disable = R0912
- kwargs = kwargs.copy()
- kwargs['script_args'] = ['install']
- kwargs['packages'] = list(kwargs.get('packages') or ()) + [
- '_setup', '_setup.py2', '_setup.py3',
- ] + list(manifest.get('packages.extra', '').split() or ())
- _core._setup_stop_after = "commandline"
- try:
- dist = _core.setup(**kwargs)
- finally:
- _core._setup_stop_after = None
-
- result = ['MANIFEST', 'PKG-INFO', 'setup.py'] + list(config)
- # TODO: work with default values:
- for key in ('classifiers', 'description', 'summary', 'provides',
- 'license'):
- filename = docs.get('meta.' + key, '').strip()
- if filename and _os.path.isfile(filename):
- result.append(filename)
-
- cmd = dist.get_command_obj("build_py")
- cmd.ensure_finalized()
- #from pprint import pprint; pprint(("build_py", cmd.get_source_files()))
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
-
- cmd = dist.get_command_obj("build_ext")
- cmd.ensure_finalized()
- #from pprint import pprint; pprint(("build_ext", cmd.get_source_files()))
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
- for ext in cmd.extensions:
- if ext.depends:
- result.extend([_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ) for item in ext.depends])
-
- cmd = dist.get_command_obj("build_clib")
- cmd.ensure_finalized()
- if cmd.libraries:
- #import pprint; pprint.pprint(("build_clib", cmd.get_source_files()))
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
- for lib in cmd.libraries:
- if lib[1].get('depends'):
- result.extend([_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ) for item in lib[1]['depends']])
-
- cmd = dist.get_command_obj("build_scripts")
- cmd.ensure_finalized()
- #import pprint; pprint.pprint(("build_scripts", cmd.get_source_files()))
- if cmd.get_source_files():
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
-
- cmd = dist.get_command_obj("install_data")
- cmd.ensure_finalized()
- #from pprint import pprint; pprint(("install_data", cmd.get_inputs()))
- try:
- strings = basestring
- except NameError:
- strings = (str, unicode)
-
- for item in cmd.get_inputs():
- if isinstance(item, strings):
- result.append(item)
- else:
- result.extend(item[1])
-
- for item in manifest.get('dist', '').split():
- result.append(item)
- if _os.path.isdir(item):
- for filename in _shell.files(item):
- result.append(filename)
-
- result = dict([(item, None) for item in result]).keys()
- result.sort()
- return result
-
-
-def run(config=('package.cfg',), ext=None, script_args=None, manifest_only=0):
- """ Main runner """
- if ext is None:
- ext = []
-
- cfg = _util.SafeConfigParser()
- cfg.read(config)
- pkg = dict(cfg.items('package'))
- python_min = pkg.get('python.min') or None
- python_max = pkg.get('python.max') or None
- check_python_version('python', python_min, python_max)
- pypy_min = pkg.get('pypy.min') or None
- pypy_max = pkg.get('pypy.max') or None
- check_python_version('pypy', pypy_min, pypy_max)
- jython_min = pkg.get('jython.min') or None
- jython_max = pkg.get('jython.max') or None
- check_python_version('jython', jython_min, jython_max)
-
- manifest = dict(cfg.items('manifest'))
- try:
- docs = dict(cfg.items('docs'))
- except _config_parser.NoSectionError:
- docs = {}
-
- summary, description = find_description(docs)
- scripts = manifest.get('scripts', '').strip() or None
- if scripts:
- scripts = scripts.split()
- modules = manifest.get('modules', '').strip() or None
- if modules:
- modules = modules.split()
- keywords = docs.get('meta.keywords', '').strip() or None
- if keywords:
- keywords = keywords.split()
- revision = pkg.get('version.revision', '').strip()
- if revision:
- revision = "-r%s" % (revision,)
-
- kwargs = {
- 'name': pkg['name'],
- 'version': "%s%s" % (
- pkg['version.number'],
- ["", "-dev%s" % (revision,)][_util.humanbool(
- 'version.dev', pkg.get('version.dev', 'false')
- )],
- ),
- 'provides': find_provides(docs),
- 'description': summary,
- 'long_description': description,
- 'classifiers': find_classifiers(docs),
- 'keywords': keywords,
- 'author': pkg['author.name'],
- 'author_email': pkg['author.email'],
- 'maintainer': pkg.get('maintainer.name'),
- 'maintainer_email': pkg.get('maintainer.email'),
- 'url': pkg.get('url.homepage'),
- 'download_url': pkg.get('url.download'),
- 'license': find_license(docs),
- 'package_dir': {'': manifest.get('packages.lib', '.')},
- 'packages': find_packages(manifest),
- 'py_modules': modules,
- 'ext_modules': ext,
- 'scripts': scripts,
- 'script_args': script_args,
- 'data_files': find_data(pkg['name'], docs),
- 'cmdclass': {
- 'build' : _commands.Build,
- 'build_ext' : _commands.BuildExt,
- 'install' : _commands.Install,
- 'install_data': _commands.InstallData,
- 'install_lib' : _commands.InstallLib,
- }
- }
- for key in ('provides',):
- if key not in _core.setup_keywords:
- del kwargs[key]
-
- if manifest_only:
- return make_manifest(manifest, config, docs, kwargs)
-
- # monkey-patch crappy manifest writer away.
- from distutils.command import sdist
- sdist.sdist.get_file_list = sdist.sdist.read_manifest
-
- return _core.setup(**kwargs)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/shell.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/shell.py
deleted file mode 100644
index 4eafb9c8647..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/shell.py
+++ /dev/null
@@ -1,478 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007 - 2013
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-=================
- Shell utilities
-=================
-
-Shell utilities.
-"""
-from __future__ import generators
-
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import errno as _errno
-import fnmatch as _fnmatch
-import os as _os
-import shutil as _shutil
-import sys as _sys
-import tempfile as _tempfile
-
-cwd = _os.path.dirname(_os.path.abspath(_sys.argv[0]))
-
-class ExitError(RuntimeError):
- """ Exit error """
- def __init__(self, code):
- RuntimeError.__init__(self, code)
- self.code = code
- self.signal = None
-
-
-class SignalError(ExitError):
- """ Signal error """
- def __init__(self, code, signal):
- ExitError.__init__(self, code)
- import signal as _signal
- self.signal = signal
- for key, val in vars(_signal).iteritems():
- if key.startswith('SIG') and not key.startswith('SIG_'):
- if val == signal:
- self.signalstr = key[3:]
- break
- else:
- self.signalstr = '%04d' % signal
-
-
-def native(path):
- """ Convert slash path to native """
- path = _os.path.sep.join(path.split('/'))
- return _os.path.normpath(_os.path.join(cwd, path))
-
-
-def cp(src, dest):
- """ Copy src to dest """
- _shutil.copy2(native(src), native(dest))
-
-
-def cp_r(src, dest):
- """ Copy -r src to dest """
- _shutil.copytree(native(src), native(dest))
-
-
-def rm(dest):
- """ Remove a file """
- try:
- _os.unlink(native(dest))
- except OSError, e:
- if _errno.ENOENT != e.errno:
- raise
-
-def rm_rf(dest):
- """ Remove a tree """
- dest = native(dest)
- if _os.path.exists(dest):
- for path in files(dest, '*'):
- _os.chmod(native(path), 0644)
- _shutil.rmtree(dest)
-
-
-try:
- mkstemp = _tempfile.mkstemp
-except AttributeError:
- # helpers stolen from 2.4 tempfile module
- try:
- import fcntl as _fcntl
- except ImportError:
- def _set_cloexec(fd):
- """ Set close-on-exec (not implemented, but not an error) """
- # pylint: disable = W0613
- pass
- else:
- def _set_cloexec(fd):
- """ Set close-on-exec """
- try:
- flags = _fcntl.fcntl(fd, _fcntl.F_GETFD, 0)
- except IOError:
- pass
- else:
- # flags read successfully, modify
- flags |= _fcntl.FD_CLOEXEC
- _fcntl.fcntl(fd, _fcntl.F_SETFD, flags)
-
- _text_openflags = _os.O_RDWR | _os.O_CREAT | _os.O_EXCL
- _text_openflags |= getattr(_os, 'O_NOINHERIT', 0)
- _text_openflags |= getattr(_os, 'O_NOFOLLOW', 0)
-
- _bin_openflags = _text_openflags
- _bin_openflags |= getattr(_os, 'O_BINARY', 0)
-
- def mkstemp(suffix="", prefix=_tempfile.gettempprefix(), dir=None,
- text=False):
- """ Create secure temp file """
- # pylint: disable = W0622
- if dir is None:
- dir = _tempfile.gettempdir()
- if text:
- flags = _text_openflags
- else:
- flags = _bin_openflags
- count = 100
- while count > 0:
- j = _tempfile._counter.get_next() # pylint: disable = E1101, W0212
- fname = _os.path.join(dir, prefix + str(j) + suffix)
- try:
- fd = _os.open(fname, flags, 0600)
- except OSError, e:
- if e.errno == _errno.EEXIST:
- count -= 1
- continue
- raise
- _set_cloexec(fd)
- return fd, _os.path.abspath(fname)
- raise IOError, (_errno.EEXIST, "No usable temporary file name found")
-
-
-def _pipespawn(argv, env):
- """ Pipe spawn """
- # pylint: disable = R0912
- import pickle as _pickle
- fd, name = mkstemp('.py')
- try:
- _os.write(fd, (r"""
-import os
-import pickle
-try:
- import subprocess
-except ImportError:
- subprocess = None
-import sys
-
-argv = pickle.loads(%(argv)s)
-env = pickle.loads(%(env)s)
-if 'X_JYTHON_WA_PATH' in env:
- env['PATH'] = env['X_JYTHON_WA_PATH']
-
-if subprocess is None:
- pid = os.spawnve(os.P_NOWAIT, argv[0], argv, env)
- result = os.waitpid(pid, 0)[1]
-else:
- p = subprocess.Popen(argv, env=env)
- result = p.wait()
- if result < 0:
- print "\n%%d 1" %% (-result)
- sys.exit(2)
-
-if result == 0:
- sys.exit(0)
-signalled = getattr(os, 'WIFSIGNALED', None)
-if signalled is not None:
- if signalled(result):
- print "\n%%d %%d" %% (os.WTERMSIG(result), result & 7)
- sys.exit(2)
-print "\n%%d" %% (result & 7,)
-sys.exit(3)
- """.strip() + "\n") % {
- 'argv': repr(_pickle.dumps(argv)),
- 'env': repr(_pickle.dumps(env)),
- })
- fd, _ = None, _os.close(fd)
- if _sys.platform == 'win32':
- argv = []
- for arg in [_sys.executable, name]:
- if ' ' in arg or arg.startswith('"'):
- arg = '"%s"' % arg.replace('"', '\\"')
- argv.append(arg)
- argv = ' '.join(argv)
- shell = True
- close_fds = False
- else:
- argv = [_sys.executable, name]
- shell = False
- close_fds = True
-
- res = 0
- try:
- import subprocess
- except ImportError:
- import popen2 as _popen2
- proc = _popen2.Popen3(argv, False)
- try:
- proc.tochild.close()
- result = proc.fromchild.read()
- finally:
- res = proc.wait()
- else:
- if 'X_JYTHON_WA_PATH' in env:
- env['PATH'] = env['X_JYTHON_WA_PATH']
-
- proc = subprocess.Popen(argv,
- shell=shell,
- stdin=subprocess.PIPE,
- stdout=subprocess.PIPE,
- close_fds=close_fds,
- env=env,
- )
- try:
- proc.stdin.close()
- result = proc.stdout.read()
- finally:
- res = proc.wait()
- if res != 0:
- if res == 2:
- signal, code = map(int, result.splitlines()[-1].split())
- raise SignalError(code, signal)
- elif res == 3:
- code = int(result.splitlines()[-1].strip())
- raise ExitError(code)
- raise ExitError(res)
-
- return result
- finally:
- try:
- if fd is not None:
- _os.close(fd)
- finally:
- _os.unlink(name)
-
-
-def _filepipespawn(infile, outfile, argv, env):
- """ File Pipe spawn """
- try:
- import subprocess
- except ImportError:
- subprocess = None
- import pickle as _pickle
- fd, name = mkstemp('.py')
- try:
- _os.write(fd, ("""
-import os
-import pickle
-import sys
-
-infile = pickle.loads(%(infile)s)
-outfile = pickle.loads(%(outfile)s)
-argv = pickle.loads(%(argv)s)
-env = pickle.loads(%(env)s)
-
-if infile is not None:
- infile = open(infile, 'rb')
- os.dup2(infile.fileno(), 0)
- infile.close()
-if outfile is not None:
- outfile = open(outfile, 'wb')
- os.dup2(outfile.fileno(), 1)
- outfile.close()
-
-pid = os.spawnve(os.P_NOWAIT, argv[0], argv, env)
-result = os.waitpid(pid, 0)[1]
-sys.exit(result & 7)
- """.strip() + "\n") % {
- 'infile': repr(_pickle.dumps(_os.path.abspath(infile))),
- 'outfile': repr(_pickle.dumps(_os.path.abspath(outfile))),
- 'argv': repr(_pickle.dumps(argv)),
- 'env': repr(_pickle.dumps(env)),
- })
- fd, _ = None, _os.close(fd)
- if _sys.platform == 'win32':
- argv = []
- for arg in [_sys.executable, name]:
- if ' ' in arg or arg.startswith('"'):
- arg = '"%s"' % arg.replace('"', '\\"')
- argv.append(arg)
- argv = ' '.join(argv)
- close_fds = False
- shell = True
- else:
- argv = [_sys.executable, name]
- close_fds = True
- shell = False
-
- if subprocess is None:
- pid = _os.spawnve(_os.P_NOWAIT, argv[0], argv, env)
- return _os.waitpid(pid, 0)[1]
- else:
- p = subprocess.Popen(
- argv, env=env, shell=shell, close_fds=close_fds
- )
- return p.wait()
- finally:
- try:
- if fd is not None:
- _os.close(fd)
- finally:
- _os.unlink(name)
-
-
-def spawn(*argv, **kwargs):
- """ Spawn a process """
- try:
- import subprocess
- except ImportError:
- subprocess = None
-
- if _sys.platform == 'win32':
- newargv = []
- for arg in argv:
- if not arg or ' ' in arg or arg.startswith('"'):
- arg = '"%s"' % arg.replace('"', '\\"')
- newargv.append(arg)
- argv = newargv
- close_fds = False
- shell = True
- else:
- close_fds = True
- shell = False
-
- env = kwargs.get('env')
- if env is None:
- env = dict(_os.environ)
- if 'X_JYTHON_WA_PATH' in env:
- env['PATH'] = env['X_JYTHON_WA_PATH']
-
- echo = kwargs.get('echo')
- if echo:
- print ' '.join(argv)
- filepipe = kwargs.get('filepipe')
- if filepipe:
- return _filepipespawn(
- kwargs.get('stdin'), kwargs.get('stdout'), argv, env
- )
- pipe = kwargs.get('stdout')
- if pipe:
- return _pipespawn(argv, env)
-
- if subprocess is None:
- pid = _os.spawnve(_os.P_NOWAIT, argv[0], argv, env)
- return _os.waitpid(pid, 0)[1]
- else:
- p = subprocess.Popen(argv, env=env, shell=shell, close_fds=close_fds)
- return p.wait()
-
-
-try:
- walk = _os.walk
-except AttributeError:
- # copy from python 2.4 sources (modulo docs and comments)
- def walk(top, topdown=True, onerror=None):
- """ directory tree walker """
- # pylint: disable = C0103
- join, isdir, islink = _os.path.join, _os.path.isdir, _os.path.islink
- listdir, error = _os.listdir, _os.error
-
- try:
- names = listdir(top)
- except error, err:
- if onerror is not None:
- onerror(err)
- return
-
- dirs, nondirs = [], []
- for name in names:
- if isdir(join(top, name)):
- dirs.append(name)
- else:
- nondirs.append(name)
-
- if topdown:
- yield top, dirs, nondirs
- for name in dirs:
- path = join(top, name)
- if not islink(path):
- for x in walk(path, topdown, onerror):
- yield x
- if not topdown:
- yield top, dirs, nondirs
-
-
-def files(base, wildcard='[!.]*', recursive=1, prune=('.git', '.svn', 'CVS')):
- """ Determine a filelist """
- for dirpath, dirnames, filenames in walk(native(base)):
- for item in prune:
- if item in dirnames:
- dirnames.remove(item)
-
- filenames.sort()
- for name in _fnmatch.filter(filenames, wildcard):
- dest = _os.path.join(dirpath, name)
- if dest.startswith(cwd):
- dest = dest.replace(cwd, '', 1)
- aslist = []
- head, tail = _os.path.split(dest)
- while tail:
- aslist.append(tail)
- head, tail = _os.path.split(head)
- aslist.reverse()
- dest = '/'.join(aslist)
- yield dest
-
- if not recursive:
- break
- dirnames.sort()
-
-
-def dirs(base, wildcard='[!.]*', recursive=1, prune=('.git', '.svn', 'CVS')):
- """ Determine a filelist """
- for dirpath, dirnames, filenames in walk(native(base)):
- for item in prune:
- if item in dirnames:
- dirnames.remove(item)
-
- dirnames.sort()
- for name in _fnmatch.filter(dirnames, wildcard):
- dest = _os.path.join(dirpath, name)
- if dest.startswith(cwd):
- dest = dest.replace(cwd, '', 1)
- aslist = []
- head, tail = _os.path.split(dest)
- while tail:
- aslist.append(tail)
- head, tail = _os.path.split(head)
- aslist.reverse()
- dest = '/'.join(aslist)
- yield dest
-
- if not recursive:
- break
-
-
-def frompath(executable):
- """ Find executable in PATH """
- # Based on distutils.spawn.find_executable.
- path = _os.environ.get('PATH', '')
- paths = [
- _os.path.expanduser(item)
- for item in path.split(_os.pathsep)
- ]
- ext = _os.path.splitext(executable)[1]
- exts = ['']
- if _sys.platform == 'win32' or _os.name == 'os2':
- eext = ['.exe', '.bat', '.py']
- if ext not in eext:
- exts.extend(eext)
-
- for ext in exts:
- if not _os.path.isfile(executable + ext):
- for path in paths:
- fname = _os.path.join(path, executable + ext)
- if _os.path.isfile(fname):
- # the file exists, we have a shot at spawn working
- return fname
- else:
- return executable + ext
-
- return None
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/util.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/util.py
deleted file mode 100644
index 5c05fac6e4c..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py2/util.py
+++ /dev/null
@@ -1,73 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-=================
- Setup utilities
-=================
-
-Setup utilities.
-"""
-__author__ = u"Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-try:
- from distutils import log
-except ImportError:
- class log(object):
- def info(self, value):
- print value
- def debug(self, value):
- pass
- log = log()
-
-from distutils import util as _util
-try:
- from ConfigParser import SafeConfigParser
-except ImportError:
- import ConfigParser as _config_parser
- class SafeConfigParser(_config_parser.ConfigParser):
- """ Safe config parser """
- def _interpolate(self, section, option, rawval, vars):
- return rawval
-
- def items(self, section):
- return [(key, self.get(section, key))
- for key in self.options(section)
- ]
-
-
-def humanbool(name, value):
- """
- Determine human boolean value
-
- :Parameters:
- `name` : ``str``
- The config key (used for error message)
-
- `value` : ``str``
- The config value
-
- :Return: The boolean value
- :Rtype: ``bool``
-
- :Exceptions:
- - `ValueError` : The value could not be recognized
- """
- try:
- return _util.strtobool(str(value).strip().lower() or 'no')
- except ValueError:
- raise ValueError("Unrecognized config value: %s = %s" % (name, value))
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/__init__.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/__init__.py
deleted file mode 100644
index 6139d510a10..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/__init__.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-================
- Package _setup
-================
-
-This package provides tools for main package setup.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-from _setup.setup import run # pylint: disable = W0611
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/commands.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/commands.py
deleted file mode 100644
index 7bfacbc86ef..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/commands.py
+++ /dev/null
@@ -1,266 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- Command extenders
-===================
-
-Command extenders.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-__test__ = False
-
-from distutils import fancy_getopt as _fancy_getopt
-from distutils import log
-from distutils.command import build as _build
-from distutils.command import build_ext as _build_ext
-from distutils.command import install as _install
-from distutils.command import install_data as _install_data
-from distutils.command import install_lib as _install_lib
-import os as _os
-
-_option_defaults = {}
-_option_inherits = {}
-_option_finalizers = {}
-_command_mapping = {
- 'install': 'Install',
- 'install_data': 'InstallData',
- 'install_lib': 'InstallLib',
- 'build': 'Build',
- 'build_ext': 'BuildExt',
-}
-
-
-def add_option(command, long_name, help_text, short_name=None, default=None,
- inherit=None):
- """ Add an option """
- try:
- command_class = globals()[_command_mapping[command]]
- except KeyError:
- raise ValueError("Unknown command %r" % (command,))
- for opt in command_class.user_options:
- if opt[0] == long_name:
- break
- else:
- opt = (long_name, short_name, help_text)
- command_class.user_options.append(opt)
- if not long_name.endswith('='):
- command_class.boolean_options.append(long_name)
- attr_name = _fancy_getopt.translate_longopt(long_name)
- else:
- attr_name = _fancy_getopt.translate_longopt(long_name[:-1])
- if command not in _option_defaults:
- _option_defaults[command] = []
- if inherit is not None:
- if isinstance(inherit, str):
- inherit = [inherit]
- for i_inherit in inherit:
- add_option(
- i_inherit, long_name, help_text, short_name, default
- )
- default = None
- if command not in _option_inherits:
- _option_inherits[command] = []
- for i_inherit in inherit:
- for i_command, opt_name in _option_inherits[command]:
- if i_command == i_inherit and opt_name == attr_name:
- break
- else:
- _option_inherits[command].append((i_inherit, attr_name))
- _option_defaults[command].append((attr_name, default))
-
-
-def add_finalizer(command, key, func):
- """ Add finalizer """
- if command not in _option_finalizers:
- _option_finalizers[command] = {}
- if key not in _option_finalizers[command]:
- _option_finalizers[command][key] = func
-
-
-class Install(_install.install):
- """ Extended installer to reflect the additional data options """
- user_options = _install.install.user_options + [
- ('single-version-externally-managed', None,
- "Compat option. Does not a thing."),
- ]
- boolean_options = _install.install.boolean_options + [
- 'single-version-externally-managed'
- ]
-
- def initialize_options(self):
- """ Prepare for new options """
- _install.install.initialize_options(self)
- self.single_version_externally_managed = None
- if 'install' in _option_defaults:
- for opt_name, default in _option_defaults['install']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _install.install.finalize_options(self)
- if 'install' in _option_inherits:
- for parent, opt_name in _option_inherits['install']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if 'install' in _option_finalizers:
- for func in list(_option_finalizers['install'].values()):
- func(self)
-
-
-class InstallData(_install_data.install_data):
- """ Extended data installer """
- user_options = _install_data.install_data.user_options + []
- boolean_options = _install_data.install_data.boolean_options + []
-
- def initialize_options(self):
- """ Prepare for new options """
- _install_data.install_data.initialize_options(self)
- if 'install_data' in _option_defaults:
- for opt_name, default in _option_defaults['install_data']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _install_data.install_data.finalize_options(self)
- if 'install_data' in _option_inherits:
- for parent, opt_name in _option_inherits['install_data']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if 'install_data' in _option_finalizers:
- for func in list(_option_finalizers['install_data'].values()):
- func(self)
-
-
-class InstallLib(_install_lib.install_lib):
- """ Extended lib installer """
- user_options = _install_lib.install_lib.user_options + []
- boolean_options = _install_lib.install_lib.boolean_options + []
-
- def initialize_options(self):
- """ Prepare for new options """
- _install_lib.install_lib.initialize_options(self)
- if 'install_lib' in _option_defaults:
- for opt_name, default in _option_defaults['install_lib']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _install_lib.install_lib.finalize_options(self)
- if 'install_lib' in _option_inherits:
- for parent, opt_name in _option_inherits['install_lib']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if 'install_lib' in _option_finalizers:
- for func in list(_option_finalizers['install_lib'].values()):
- func(self)
-
-
-class BuildExt(_build_ext.build_ext):
- """
- Extended extension builder class
-
- This class allows extensions to provide a ``check_prerequisites`` method
- which is called before actually building it. The method takes the
- `BuildExt` instance and returns whether the extension should be skipped or
- not.
- """
-
- def initialize_options(self):
- """ Prepare for new options """
- _build_ext.build_ext.initialize_options(self)
- if 'build_ext' in _option_defaults:
- for opt_name, default in _option_defaults['build_ext']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _build_ext.build_ext.finalize_options(self)
- if 'build_ext' in _option_inherits:
- for parent, opt_name in _option_inherits['build_ext']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if 'build_ext' in _option_finalizers:
- for func in list(_option_finalizers['build_ext'].values()):
- func(self)
-
- def build_extension(self, ext):
- """
- Build C extension - with extended functionality
-
- The following features are added here:
-
- - ``ext.check_prerequisites`` is called before the extension is being
- built. See `Extension` for details. If the method does not exist,
- simply no check will be run.
- - The macros ``EXT_PACKAGE`` and ``EXT_MODULE`` will be filled (or
- unset) depending on the extensions name, but only if they are not
- already defined.
-
- :Parameters:
- `ext` : `Extension`
- The extension to build. If it's a pure
- ``distutils.core.Extension``, simply no prequisites check is
- applied.
-
- :Return: whatever ``distutils.command.build_ext.build_ext`` returns
- :Rtype: any
- """
- # handle name macros
- macros = dict(ext.define_macros or ())
- tup = ext.name.split('.')
- if len(tup) == 1:
- pkg, mod = None, tup[0]
- else:
- pkg, mod = '.'.join(tup[:-1]), tup[-1]
- if pkg is not None and 'EXT_PACKAGE' not in macros:
- ext.define_macros.append(('EXT_PACKAGE', pkg))
- if 'EXT_MODULE' not in macros:
- ext.define_macros.append(('EXT_MODULE', mod))
- if pkg is None:
- macros = dict(ext.undef_macros or ())
- if 'EXT_PACKAGE' not in macros:
- ext.undef_macros.append('EXT_PACKAGE')
-
- # handle prereq checks
- try:
- checker = ext.check_prerequisites
- except AttributeError:
- pass
- else:
- if checker(self):
- log.info("Skipping %s extension" % ext.name)
- return
-
- return _build_ext.build_ext.build_extension(self, ext)
-
-
-class Build(_build.build):
-
- def initialize_options(self):
- """ Prepare for new options """
- _build.build.initialize_options(self)
- if 'build' in _option_defaults:
- for opt_name, default in _option_defaults['build']:
- setattr(self, opt_name, default)
-
- def finalize_options(self):
- """ Finalize options """
- _build.build.finalize_options(self)
- if 'build' in _option_inherits:
- for parent, opt_name in _option_inherits['build']:
- self.set_undefined_options(parent, (opt_name, opt_name))
- if 'build' in _option_finalizers:
- for func in list(_option_finalizers['build'].values()):
- func(self)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/data.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/data.py
deleted file mode 100644
index d4221735768..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/data.py
+++ /dev/null
@@ -1,165 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- Data distribution
-===================
-
-This module provides tools to simplify data distribution.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-from distutils import filelist as _filelist
-import os as _os
-import posixpath as _posixpath
-import sys as _sys
-
-from _setup import commands as _commands
-
-
-def splitpath(path):
- """ Split a path """
- drive, path = '', _os.path.normpath(path)
- try:
- splitunc = _os.path.splitunc
- except AttributeError:
- pass
- else:
- drive, path = splitunc(path)
- if not drive:
- drive, path = _os.path.splitdrive(path)
- elems = []
- try:
- sep = _os.path.sep
- except AttributeError:
- sep = _os.path.join('1', '2')[1:-1]
- while 1:
- prefix, path = _os.path.split(path)
- elems.append(path)
- if prefix in ('', sep):
- drive = _os.path.join(drive, prefix)
- break
- path = prefix
- elems.reverse()
- return drive, elems
-
-
-def finalizer(installer):
- """ Finalize install_data """
- data_files = []
- for item in installer.data_files:
- if not isinstance(item, Data):
- data_files.append(item)
- continue
- data_files.extend(item.flatten(installer))
- installer.data_files = data_files
-
-
-class Data(object):
- """ File list container """
-
- def __init__(self, files, target=None, preserve=0, strip=0,
- prefix=None):
- """ Initialization """
- self._files = files
- self._target = target
- self._preserve = preserve
- self._strip = strip
- self._prefix = prefix
- self.fixup_commands()
-
- def fixup_commands(self):
- pass
-
- def from_templates(cls, *templates, **kwargs):
- """ Initialize from template """
- files = _filelist.FileList()
- for tpl in templates:
- for line in tpl.split(';'):
- files.process_template_line(line.strip())
- files.sort()
- files.remove_duplicates()
- result = []
- for filename in files.files:
- _, elems = splitpath(filename)
- if '.svn' in elems or '.git' in elems:
- continue
- result.append(filename)
- return cls(result, **kwargs)
- from_templates = classmethod(from_templates)
-
- def flatten(self, installer):
- """ Flatten the file list to (target, file) tuples """
- # pylint: disable = W0613
- if self._prefix:
- _, prefix = splitpath(self._prefix)
- telems = prefix
- else:
- telems = []
-
- tmap = {}
- for fname in self._files:
- (_, name), target = splitpath(fname), telems
- if self._preserve:
- if self._strip:
- name = name[max(0, min(self._strip, len(name) - 1)):]
- if len(name) > 1:
- target = telems + name[:-1]
- tmap.setdefault(_posixpath.join(*target), []).append(fname)
- return list(tmap.items())
-
-
-class Documentation(Data):
- """ Documentation container """
-
- def fixup_commands(self):
- _commands.add_option('install_data', 'without-docs',
- help_text='Do not install documentation files',
- inherit='install',
- )
- _commands.add_finalizer('install_data', 'documentation', finalizer)
-
- def flatten(self, installer):
- """ Check if docs should be installed at all """
- if installer.without_docs:
- return []
- return Data.flatten(self, installer)
-
-
-class Manpages(Documentation):
- """ Manpages container """
-
- def dispatch(cls, files):
- """ Automatically dispatch manpages to their target directories """
- mpmap = {}
- for manpage in files:
- normalized = _os.path.normpath(manpage)
- _, ext = _os.path.splitext(normalized)
- if ext.startswith(_os.path.extsep):
- ext = ext[len(_os.path.extsep):]
- mpmap.setdefault(ext, []).append(manpage)
- return [cls(manpages, prefix=_posixpath.join(
- 'share', 'man', 'man%s' % section,
- )) for section, manpages in list(mpmap.items())]
- dispatch = classmethod(dispatch)
-
- def flatten(self, installer):
- """ Check if manpages are suitable """
- if _sys.platform == 'win32':
- return []
- return Documentation.flatten(self, installer)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/dist.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/dist.py
deleted file mode 100644
index cce21e57a63..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/dist.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-================
- dist utilities
-================
-
-dist utilities.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import sys as _sys
-
-from _setup import shell as _shell
-
-
-def run_setup(*args, **kwargs):
- """ Run setup """
- if 'setup' in kwargs:
- script = kwargs.get('setup') or 'setup.py'
- del kwargs['setup']
- else:
- script = 'setup.py'
- if 'fakeroot' in kwargs:
- fakeroot = kwargs['fakeroot']
- del kwargs['fakeroot']
- else:
- fakeroot = None
- if kwargs:
- raise TypeError("Unrecognized keyword parameters")
-
- script = _shell.native(script)
- argv = [_sys.executable, script] + list(args)
- if fakeroot:
- argv.insert(0, fakeroot)
- return not _shell.spawn(*argv)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/ext.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/ext.py
deleted file mode 100644
index 852c466547e..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/ext.py
+++ /dev/null
@@ -1,253 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- C extension tools
-===================
-
-C extension tools.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-__test__ = False
-
-from distutils import core as _core
-from distutils import errors as _distutils_errors
-from distutils import log
-import os as _os
-import posixpath as _posixpath
-import shutil as _shutil
-import tempfile as _tempfile
-
-from _setup import commands as _commands
-
-def _install_finalizer(installer):
- if installer.without_c_extensions:
- installer.distribution.ext_modules = []
-
-def _build_finalizer(builder):
- if builder.without_c_extensions:
- builder.extensions = []
-
-
-class Extension(_core.Extension):
- """
- Extension with prerequisite check interface
-
- If your check is cacheable (during the setup run), override
- `cached_check_prerequisites`, `check_prerequisites` otherwise.
-
- :IVariables:
- `cached_check` : ``bool``
- The cached check result
- """
- cached_check = None
-
- def __init__(self, *args, **kwargs):
- """ Initialization """
- if 'depends' in kwargs:
- self.depends = kwargs['depends'] or []
- else:
- self.depends = []
- _core.Extension.__init__(self, *args, **kwargs)
-
- # add include path
- included = _posixpath.join('_setup', 'include')
- if included not in self.include_dirs:
- self.include_dirs.append(included)
-
- # add cext.h to the dependencies
- cext_h = _posixpath.join(included, 'cext.h')
- if cext_h not in self.depends:
- self.depends.append(cext_h)
-
- _commands.add_option('install_lib', 'without-c-extensions',
- help_text='Don\'t install C extensions',
- inherit='install',
- )
- _commands.add_finalizer('install_lib', 'c-extensions',
- _install_finalizer
- )
- _commands.add_option('build_ext', 'without-c-extensions',
- help_text='Don\'t build C extensions',
- inherit=('build', 'install_lib'),
- )
- _commands.add_finalizer('build_ext', 'c-extensions', _build_finalizer)
-
- def check_prerequisites(self, build):
- """
- Check prerequisites
-
- The check should cover all dependencies needed for the extension to
- be built and run. The method can do the following:
-
- - return a false value: the extension will be built
- - return a true value: the extension will be skipped. This is useful
- for optional extensions
- - raise an exception. This is useful for mandatory extensions
-
- If the check result is cacheable (during the setup run), override
- `cached_check_prerequisites` instead.
-
- :Parameters:
- `build` : `BuildExt`
- The extension builder
-
- :Return: Skip the extension?
- :Rtype: ``bool``
- """
- if self.cached_check is None:
- log.debug("PREREQ check for %s" % self.name)
- self.cached_check = self.cached_check_prerequisites(build)
- else:
- log.debug("PREREQ check for %s (cached)" % self.name)
- return self.cached_check
-
- def cached_check_prerequisites(self, build):
- """
- Check prerequisites
-
- The check should cover all dependencies needed for the extension to
- be built and run. The method can do the following:
-
- - return a false value: the extension will be built
- - return a true value: the extension will be skipped. This is useful
- for optional extensions
- - raise an exception. This is useful for mandatory extensions
-
- If the check result is *not* cacheable (during the setup run),
- override `check_prerequisites` instead.
-
- :Parameters:
- `build` : `BuildExt`
- The extension builder
-
- :Return: Skip the extension?
- :Rtype: ``bool``
- """
- # pylint: disable = W0613
- log.debug("Nothing to check for %s!" % self.name)
- return False
-
-
-class ConfTest(object):
- """
- Single conftest abstraction
-
- :IVariables:
- `_tempdir` : ``str``
- The tempdir created for this test
-
- `src` : ``str``
- Name of the source file
-
- `target` : ``str``
- Target filename
-
- `compiler` : ``CCompiler``
- compiler instance
-
- `obj` : ``list``
- List of object filenames (``[str, ...]``)
- """
- _tempdir = None
-
- def __init__(self, build, source):
- """
- Initialization
-
- :Parameters:
- `build` : ``distuils.command.build_ext.build_ext``
- builder instance
-
- `source` : ``str``
- Source of the file to compile
- """
- self._tempdir = tempdir = _tempfile.mkdtemp()
- src = _os.path.join(tempdir, 'conftest.c')
- fp = open(src, 'w', encoding='utf-8')
- try:
- fp.write(source)
- finally:
- fp.close()
- self.src = src
- self.compiler = compiler = build.compiler
- self.target = _os.path.join(tempdir, 'conftest')
- self.obj = compiler.object_filenames([src], output_dir=tempdir)
-
- def __del__(self):
- """ Destruction """
- self.destroy()
-
- def destroy(self):
- """ Destroy the conftest leftovers on disk """
- tempdir, self._tempdir = self._tempdir, None
- if tempdir is not None:
- _shutil.rmtree(tempdir)
-
- def compile(self, **kwargs):
- """
- Compile the conftest
-
- :Parameters:
- `kwargs` : ``dict``
- Optional keyword parameters for the compiler call
-
- :Return: Was the compilation successful?
- :Rtype: ``bool``
- """
- kwargs['output_dir'] = self._tempdir
- try:
- self.compiler.compile([self.src], **kwargs)
- except _distutils_errors.CompileError:
- return False
- return True
-
- def link(self, **kwargs):
- r"""
- Link the conftest
-
- Before you can link the conftest objects they need to be `compile`\d.
-
- :Parameters:
- `kwargs` : ``dict``
- Optional keyword parameters for the linker call
-
- :Return: Was the linking successful?
- :Rtype: ``bool``
- """
- try:
- self.compiler.link_executable(self.obj, self.target, **kwargs)
- except _distutils_errors.LinkError:
- return False
- return True
-
- def pipe(self, mode="r"):
- r"""
- Execute the conftest binary and connect to it using a pipe
-
- Before you can pipe to or from the conftest binary it needs to
- be `link`\ed.
-
- :Parameters:
- `mode` : ``str``
- Pipe mode - r/w
-
- :Return: The open pipe
- :Rtype: ``file``
- """
- return _os.popen(self.compiler.executable_filename(self.target), mode)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/setup.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/setup.py
deleted file mode 100644
index 83f1c21d544..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/setup.py
+++ /dev/null
@@ -1,420 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007 - 2013
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-===================
- Main setup runner
-===================
-
-This module provides a wrapper around the distutils core setup.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import configparser as _config_parser
-from distutils import core as _core
-import os as _os
-import posixpath as _posixpath
-import sys as _sys
-
-from _setup import commands as _commands
-from _setup import data as _data
-from _setup import ext as _ext
-from _setup import util as _util
-from _setup import shell as _shell
-
-
-def check_python_version(impl, version_min, version_max):
- """ Check python version """
- if impl == 'python':
- version_info = _sys.version_info
- elif impl == 'pypy':
- version_info = getattr(_sys, 'pypy_version_info', None)
- if not version_info:
- return
- elif impl == 'jython':
- if not 'java' in _sys.platform.lower():
- return
- version_info = _sys.version_info
- else:
- raise AssertionError("impl not in ('python', 'pypy', 'jython')")
-
- pyversion = list(map(int, version_info[:3]))
- if version_min:
- min_required = list(
- map(int, '.'.join((version_min, '0.0.0')).split('.')[:3])
- )
- if pyversion < min_required:
- raise EnvironmentError("Need at least %s %s (vs. %s)" % (
- impl, version_min, '.'.join(map(str, pyversion))
- ))
- if version_max:
- max_required = list(map(int, version_max.split('.')))
- max_required[-1] += 1
- if pyversion >= max_required:
- raise EnvironmentError("Need at max %s %s (vs. %s)" % (
- impl,
- version_max,
- '.'.join(map(str, pyversion))
- ))
-
-
-def find_description(docs):
- """
- Determine the package description from DESCRIPTION
-
- :Parameters:
- `docs` : ``dict``
- Docs config section
-
- :Return: Tuple of summary, description and license
- (``('summary', 'description', 'license')``)
- (all may be ``None``)
- :Rtype: ``tuple``
- """
- summary = None
- filename = docs.get('meta.summary', 'SUMMARY').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename, encoding='utf-8')
- try:
- try:
- summary = fp.read().strip().splitlines()[0].rstrip()
- except IndexError:
- summary = ''
- finally:
- fp.close()
-
- description = None
- filename = docs.get('meta.description', 'DESCRIPTION').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename, encoding='utf-8')
- try:
- description = fp.read().rstrip()
- finally:
- fp.close()
-
- if summary is None and description:
- from docutils import core
- summary = core.publish_parts(
- source=description,
- source_path=filename,
- writer_name='html',
- )['title'].encode('utf-8')
-
- return summary, description
-
-
-def find_classifiers(docs):
- """
- Determine classifiers from CLASSIFIERS
-
- :return: List of classifiers (``['classifier', ...]``)
- :rtype: ``list``
- """
- filename = docs.get('meta.classifiers', 'CLASSIFIERS').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename, encoding='utf-8')
- try:
- content = fp.read()
- finally:
- fp.close()
- content = [item.strip() for item in content.splitlines()]
- return [item for item in content if item and not item.startswith('#')]
- return []
-
-
-def find_provides(docs):
- """
- Determine provides from PROVIDES
-
- :return: List of provides (``['provides', ...]``)
- :rtype: ``list``
- """
- filename = docs.get('meta.provides', 'PROVIDES').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename, encoding='utf-8')
- try:
- content = fp.read()
- finally:
- fp.close()
- content = [item.strip() for item in content.splitlines()]
- return [item for item in content if item and not item.startswith('#')]
- return []
-
-
-def find_license(docs):
- """
- Determine license from LICENSE
-
- :return: License text
- :rtype: ``str``
- """
- filename = docs.get('meta.license', 'LICENSE').strip()
- if filename and _os.path.isfile(filename):
- fp = open(filename, encoding='utf-8')
- try:
- return fp.read().rstrip()
- finally:
- fp.close()
- return None
-
-
-def find_packages(manifest):
- """ Determine packages and subpackages """
- packages = {}
- collect = manifest.get('packages.collect', '').split()
- lib = manifest.get('packages.lib', '.')
- try:
- sep = _os.path.sep
- except AttributeError:
- sep = _os.path.join('1', '2')[1:-1]
- for root in collect:
- for dirpath, _, filenames in _shell.walk(_os.path.join(lib, root)):
- if dirpath.find('.svn') >= 0 or dirpath.find('.git') >= 0:
- continue
- if '__init__.py' in filenames:
- packages[
- _os.path.normpath(dirpath).replace(sep, '.')
- ] = None
- packages = list(packages.keys())
- packages.sort()
- return packages
-
-
-def find_data(name, docs):
- """ Determine data files """
- result = []
- if docs.get('extra', '').strip():
- result.append(_data.Documentation(docs['extra'].split(),
- prefix='share/doc/%s' % name,
- ))
- if docs.get('examples.dir', '').strip():
- tpl = ['recursive-include %s *' % docs['examples.dir']]
- if docs.get('examples.ignore', '').strip():
- tpl.extend(["global-exclude %s" % item
- for item in docs['examples.ignore'].split()
- ])
- strip = int(docs.get('examples.strip', '') or 0)
- result.append(_data.Documentation.from_templates(*tpl, **{
- 'strip': strip,
- 'prefix': 'share/doc/%s' % name,
- 'preserve': 1,
- }))
- if docs.get('userdoc.dir', '').strip():
- tpl = ['recursive-include %s *' % docs['userdoc.dir']]
- if docs.get('userdoc.ignore', '').strip():
- tpl.extend(["global-exclude %s" % item
- for item in docs['userdoc.ignore'].split()
- ])
- strip = int(docs.get('userdoc.strip', '') or 0)
- result.append(_data.Documentation.from_templates(*tpl, **{
- 'strip': strip,
- 'prefix': 'share/doc/%s' % name,
- 'preserve': 1,
- }))
- if docs.get('apidoc.dir', '').strip():
- tpl = ['recursive-include %s *' % docs['apidoc.dir']]
- if docs.get('apidoc.ignore', '').strip():
- tpl.extend(["global-exclude %s" % item
- for item in docs['apidoc.ignore'].split()
- ])
- strip = int(docs.get('apidoc.strip', '') or 0)
- result.append(_data.Documentation.from_templates(*tpl, **{
- 'strip': strip,
- 'prefix': 'share/doc/%s' % name,
- 'preserve': 1,
- }))
- if docs.get('man', '').strip():
- result.extend(_data.Manpages.dispatch(docs['man'].split()))
- return result
-
-
-def make_manifest(manifest, config, docs, kwargs):
- """ Create file list to pack up """
- # pylint: disable = R0912
- kwargs = kwargs.copy()
- kwargs['script_args'] = ['install']
- kwargs['packages'] = list(kwargs.get('packages') or ()) + [
- '_setup', '_setup.py2', '_setup.py3',
- ] + list(manifest.get('packages.extra', '').split() or ())
- _core._setup_stop_after = "commandline"
- try:
- dist = _core.setup(**kwargs)
- finally:
- _core._setup_stop_after = None
-
- result = ['MANIFEST', 'PKG-INFO', 'setup.py'] + list(config)
- # TODO: work with default values:
- for key in ('classifiers', 'description', 'summary', 'provides',
- 'license'):
- filename = docs.get('meta.' + key, '').strip()
- if filename and _os.path.isfile(filename):
- result.append(filename)
-
- cmd = dist.get_command_obj("build_py")
- cmd.ensure_finalized()
- #from pprint import pprint; pprint(("build_py", cmd.get_source_files()))
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
-
- cmd = dist.get_command_obj("build_ext")
- cmd.ensure_finalized()
- #from pprint import pprint; pprint(("build_ext", cmd.get_source_files()))
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
- for ext in cmd.extensions:
- if ext.depends:
- result.extend([_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ) for item in ext.depends])
-
- cmd = dist.get_command_obj("build_clib")
- cmd.ensure_finalized()
- if cmd.libraries:
- #import pprint; pprint.pprint(("build_clib", cmd.get_source_files()))
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
- for lib in cmd.libraries:
- if lib[1].get('depends'):
- result.extend([_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ) for item in lib[1]['depends']])
-
- cmd = dist.get_command_obj("build_scripts")
- cmd.ensure_finalized()
- #import pprint; pprint.pprint(("build_scripts", cmd.get_source_files()))
- if cmd.get_source_files():
- for item in cmd.get_source_files():
- result.append(_posixpath.sep.join(
- _os.path.normpath(item).split(_os.path.sep)
- ))
-
- cmd = dist.get_command_obj("install_data")
- cmd.ensure_finalized()
- #from pprint import pprint; pprint(("install_data", cmd.get_inputs()))
- try:
- strings = str
- except NameError:
- strings = (str, str)
-
- for item in cmd.get_inputs():
- if isinstance(item, strings):
- result.append(item)
- else:
- result.extend(item[1])
-
- for item in manifest.get('dist', '').split():
- result.append(item)
- if _os.path.isdir(item):
- for filename in _shell.files(item):
- result.append(filename)
-
- result = list(dict([(item, None) for item in result]).keys())
- result.sort()
- return result
-
-
-def run(config=('package.cfg',), ext=None, script_args=None, manifest_only=0):
- """ Main runner """
- if ext is None:
- ext = []
-
- cfg = _util.SafeConfigParser()
- cfg.read(config, encoding='utf-8')
- pkg = dict(cfg.items('package'))
- python_min = pkg.get('python.min') or None
- python_max = pkg.get('python.max') or None
- check_python_version('python', python_min, python_max)
- pypy_min = pkg.get('pypy.min') or None
- pypy_max = pkg.get('pypy.max') or None
- check_python_version('pypy', pypy_min, pypy_max)
- jython_min = pkg.get('jython.min') or None
- jython_max = pkg.get('jython.max') or None
- check_python_version('jython', jython_min, jython_max)
-
- manifest = dict(cfg.items('manifest'))
- try:
- docs = dict(cfg.items('docs'))
- except _config_parser.NoSectionError:
- docs = {}
-
- summary, description = find_description(docs)
- scripts = manifest.get('scripts', '').strip() or None
- if scripts:
- scripts = scripts.split()
- modules = manifest.get('modules', '').strip() or None
- if modules:
- modules = modules.split()
- keywords = docs.get('meta.keywords', '').strip() or None
- if keywords:
- keywords = keywords.split()
- revision = pkg.get('version.revision', '').strip()
- if revision:
- revision = "-r%s" % (revision,)
-
- kwargs = {
- 'name': pkg['name'],
- 'version': "%s%s" % (
- pkg['version.number'],
- ["", "-dev%s" % (revision,)][_util.humanbool(
- 'version.dev', pkg.get('version.dev', 'false')
- )],
- ),
- 'provides': find_provides(docs),
- 'description': summary,
- 'long_description': description,
- 'classifiers': find_classifiers(docs),
- 'keywords': keywords,
- 'author': pkg['author.name'],
- 'author_email': pkg['author.email'],
- 'maintainer': pkg.get('maintainer.name'),
- 'maintainer_email': pkg.get('maintainer.email'),
- 'url': pkg.get('url.homepage'),
- 'download_url': pkg.get('url.download'),
- 'license': find_license(docs),
- 'package_dir': {'': manifest.get('packages.lib', '.')},
- 'packages': find_packages(manifest),
- 'py_modules': modules,
- 'ext_modules': ext,
- 'scripts': scripts,
- 'script_args': script_args,
- 'data_files': find_data(pkg['name'], docs),
- 'cmdclass': {
- 'build' : _commands.Build,
- 'build_ext' : _commands.BuildExt,
- 'install' : _commands.Install,
- 'install_data': _commands.InstallData,
- 'install_lib' : _commands.InstallLib,
- }
- }
- for key in ('provides',):
- if key not in _core.setup_keywords:
- del kwargs[key]
-
- if manifest_only:
- return make_manifest(manifest, config, docs, kwargs)
-
- # monkey-patch crappy manifest writer away.
- from distutils.command import sdist
- sdist.sdist.get_file_list = sdist.sdist.read_manifest
-
- return _core.setup(**kwargs)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/shell.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/shell.py
deleted file mode 100644
index 91f2ebc5b40..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/shell.py
+++ /dev/null
@@ -1,351 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007 - 2013
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-=================
- Shell utilities
-=================
-
-Shell utilities.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-import errno as _errno
-import fnmatch as _fnmatch
-import os as _os
-import shutil as _shutil
-import subprocess as _subprocess
-import sys as _sys
-import tempfile as _tempfile
-
-cwd = _os.path.dirname(_os.path.abspath(_sys.argv[0]))
-
-class ExitError(RuntimeError):
- """ Exit error """
- def __init__(self, code):
- RuntimeError.__init__(self, code)
- self.code = code
- self.signal = None
-
-
-class SignalError(ExitError):
- """ Signal error """
- def __init__(self, code, signal):
- ExitError.__init__(self, code)
- import signal as _signal
- self.signal = signal
- for key, val in vars(_signal).items():
- if key.startswith('SIG') and not key.startswith('SIG_'):
- if val == signal:
- self.signalstr = key[3:]
- break
- else:
- self.signalstr = '%04d' % signal
-
-
-def native(path):
- """ Convert slash path to native """
- path = _os.path.sep.join(path.split('/'))
- return _os.path.normpath(_os.path.join(cwd, path))
-
-
-def cp(src, dest):
- """ Copy src to dest """
- _shutil.copy2(native(src), native(dest))
-
-
-def cp_r(src, dest):
- """ Copy -r src to dest """
- _shutil.copytree(native(src), native(dest))
-
-
-def rm(dest):
- """ Remove a file """
- try:
- _os.unlink(native(dest))
- except OSError as e:
- if _errno.ENOENT != e.errno:
- raise
-
-def rm_rf(dest):
- """ Remove a tree """
- dest = native(dest)
- if _os.path.exists(dest):
- for path in files(dest, '*'):
- _os.chmod(native(path), 0o644)
- _shutil.rmtree(dest)
-
-
-mkstemp = _tempfile.mkstemp
-
-
-def _pipespawn(argv, env):
- """ Pipe spawn """
- # pylint: disable = R0912
- import pickle as _pickle
- fd, name = mkstemp('.py')
- try:
- _os.write(fd, ((r"""
-import os
-import pickle
-import subprocess
-import sys
-
-argv = pickle.loads(%(argv)s)
-env = pickle.loads(%(env)s)
-if 'X_JYTHON_WA_PATH' in env:
- env['PATH'] = env['X_JYTHON_WA_PATH']
-
-p = subprocess.Popen(argv, env=env)
-result = p.wait()
-if result < 0:
- print("\n%%d 1" %% (-result))
- sys.exit(2)
-if result == 0:
- sys.exit(0)
-print("\n%%d" %% (result & 7,))
-sys.exit(3)
- """.strip() + "\n") % {
- 'argv': repr(_pickle.dumps(argv)),
- 'env': repr(_pickle.dumps(dict(env))),
- }).encode('utf-8'))
- fd, _ = None, _os.close(fd)
- if _sys.platform == 'win32':
- argv = []
- for arg in [_sys.executable, name]:
- if ' ' in arg or arg.startswith('"'):
- arg = '"%s"' % arg.replace('"', '\\"')
- argv.append(arg)
- argv = ' '.join(argv)
- shell = True
- close_fds = False
- else:
- argv = [_sys.executable, name]
- shell = False
- close_fds = True
-
- res = 0
- if 'X_JYTHON_WA_PATH' in env:
- env['PATH'] = env['X_JYTHON_WA_PATH']
-
- proc = _subprocess.Popen(argv,
- shell=shell,
- stdin=_subprocess.PIPE,
- stdout=_subprocess.PIPE,
- close_fds=close_fds,
- env=env,
- )
- try:
- proc.stdin.close()
- result = proc.stdout.read()
- finally:
- res = proc.wait()
- if res != 0:
- if res == 2:
- signal, code = list(map(int, result.splitlines()[-1].split()))
- raise SignalError(code, signal)
- elif res == 3:
- code = int(result.splitlines()[-1].strip())
- raise ExitError(code)
- raise ExitError(res)
-
- return result.decode('latin-1')
- finally:
- try:
- if fd is not None:
- _os.close(fd)
- finally:
- _os.unlink(name)
-
-
-def _filepipespawn(infile, outfile, argv, env):
- """ File Pipe spawn """
- import pickle as _pickle
- fd, name = mkstemp('.py')
- try:
- _os.write(fd, (("""
-import os
-import pickle
-import sys
-
-infile = pickle.loads(%(infile)s)
-outfile = pickle.loads(%(outfile)s)
-argv = pickle.loads(%(argv)s)
-env = pickle.loads(%(env)s)
-
-if infile is not None:
- infile = open(infile, 'rb')
- os.dup2(infile.fileno(), 0)
- infile.close()
-if outfile is not None:
- outfile = open(outfile, 'wb')
- os.dup2(outfile.fileno(), 1)
- outfile.close()
-
-pid = os.spawnve(os.P_NOWAIT, argv[0], argv, env)
-result = os.waitpid(pid, 0)[1]
-sys.exit(result & 7)
- """.strip() + "\n") % {
- 'infile': repr(_pickle.dumps(_os.path.abspath(infile))),
- 'outfile': repr(_pickle.dumps(_os.path.abspath(outfile))),
- 'argv': repr(_pickle.dumps(argv)),
- 'env': repr(_pickle.dumps(env)),
- }).encode('utf-8'))
- fd, _ = None, _os.close(fd)
- if _sys.platform == 'win32':
- argv = []
- for arg in [_sys.executable, name]:
- if ' ' in arg or arg.startswith('"'):
- arg = '"%s"' % arg.replace('"', '\\"')
- argv.append(arg)
- argv = ' '.join(argv)
- close_fds = False
- shell = True
- else:
- argv = [_sys.executable, name]
- close_fds = True
- shell = False
-
- p = _subprocess.Popen(
- argv, env=env, shell=shell, close_fds=close_fds
- )
- return p.wait()
- finally:
- try:
- if fd is not None:
- _os.close(fd)
- finally:
- _os.unlink(name)
-
-
-def spawn(*argv, **kwargs):
- """ Spawn a process """
- if _sys.platform == 'win32':
- newargv = []
- for arg in argv:
- if not arg or ' ' in arg or arg.startswith('"'):
- arg = '"%s"' % arg.replace('"', '\\"')
- newargv.append(arg)
- argv = newargv
- close_fds = False
- shell = True
- else:
- close_fds = True
- shell = False
-
- env = kwargs.get('env')
- if env is None:
- env = dict(_os.environ)
- if 'X_JYTHON_WA_PATH' in env:
- env['PATH'] = env['X_JYTHON_WA_PATH']
-
- echo = kwargs.get('echo')
- if echo:
- print(' '.join(argv))
- filepipe = kwargs.get('filepipe')
- if filepipe:
- return _filepipespawn(
- kwargs.get('stdin'), kwargs.get('stdout'), argv, env
- )
- pipe = kwargs.get('stdout')
- if pipe:
- return _pipespawn(argv, env)
-
- p = _subprocess.Popen(argv, env=env, shell=shell, close_fds=close_fds)
- return p.wait()
-
-
-walk = _os.walk
-
-
-def files(base, wildcard='[!.]*', recursive=1, prune=('.git', '.svn', 'CVS')):
- """ Determine a filelist """
- for dirpath, dirnames, filenames in walk(native(base)):
- for item in prune:
- if item in dirnames:
- dirnames.remove(item)
-
- filenames.sort()
- for name in _fnmatch.filter(filenames, wildcard):
- dest = _os.path.join(dirpath, name)
- if dest.startswith(cwd):
- dest = dest.replace(cwd, '', 1)
- aslist = []
- head, tail = _os.path.split(dest)
- while tail:
- aslist.append(tail)
- head, tail = _os.path.split(head)
- aslist.reverse()
- dest = '/'.join(aslist)
- yield dest
-
- if not recursive:
- break
- dirnames.sort()
-
-
-def dirs(base, wildcard='[!.]*', recursive=1, prune=('.git', '.svn', 'CVS')):
- """ Determine a filelist """
- for dirpath, dirnames, filenames in walk(native(base)):
- for item in prune:
- if item in dirnames:
- dirnames.remove(item)
-
- dirnames.sort()
- for name in _fnmatch.filter(dirnames, wildcard):
- dest = _os.path.join(dirpath, name)
- if dest.startswith(cwd):
- dest = dest.replace(cwd, '', 1)
- aslist = []
- head, tail = _os.path.split(dest)
- while tail:
- aslist.append(tail)
- head, tail = _os.path.split(head)
- aslist.reverse()
- dest = '/'.join(aslist)
- yield dest
-
- if not recursive:
- break
-
-
-def frompath(executable):
- """ Find executable in PATH """
- # Based on distutils.spawn.find_executable.
- path = _os.environ.get('PATH', '')
- paths = [
- _os.path.expanduser(item)
- for item in path.split(_os.pathsep)
- ]
- ext = _os.path.splitext(executable)[1]
- exts = ['']
- if _sys.platform == 'win32' or _os.name == 'os2':
- eext = ['.exe', '.bat', '.py']
- if ext not in eext:
- exts.extend(eext)
-
- for ext in exts:
- if not _os.path.isfile(executable + ext):
- for path in paths:
- fname = _os.path.join(path, executable + ext)
- if _os.path.isfile(fname):
- # the file exists, we have a shot at spawn working
- return fname
- else:
- return executable + ext
-
- return None
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/util.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/util.py
deleted file mode 100644
index a07daa812fe..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/_setup/py3/util.py
+++ /dev/null
@@ -1,63 +0,0 @@
-# -*- coding: ascii -*-
-#
-# Copyright 2007, 2008, 2009, 2010, 2011
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-=================
- Setup utilities
-=================
-
-Setup utilities.
-"""
-__author__ = "Andr\xe9 Malo"
-__docformat__ = "restructuredtext en"
-
-from distutils import util as _util
-try:
- from configparser import SafeConfigParser
-except ImportError:
- import configparser as _config_parser
- class SafeConfigParser(_config_parser.ConfigParser):
- """ Safe config parser """
- def _interpolate(self, section, option, rawval, vars):
- return rawval
-
- def items(self, section):
- return [(key, self.get(section, key))
- for key in self.options(section)
- ]
-
-
-def humanbool(name, value):
- """
- Determine human boolean value
-
- :Parameters:
- `name` : ``str``
- The config key (used for error message)
-
- `value` : ``str``
- The config value
-
- :Return: The boolean value
- :Rtype: ``bool``
-
- :Exceptions:
- - `ValueError` : The value could not be recognized
- """
- try:
- return _util.strtobool(str(value).strip().lower() or 'no')
- except ValueError:
- raise ValueError("Unrecognized config value: %s = %s" % (name, value))
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/__init__.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/__init__.py
deleted file mode 100644
index 4465690a015..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/__init__.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- coding: ascii -*-
-r"""
-=================================
- Benchmark jsmin implementations
-=================================
-
-Benchmark jsmin implementations.
-
-:Copyright:
-
- Copyright 2011 - 2014
- Andr\xe9 Malo or his licensors, as applicable
-
-:License:
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-"""
-if __doc__:
- __doc__ = __doc__.encode('ascii').decode('unicode_escape')
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/apiviewer.js b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/apiviewer.js
deleted file mode 100644
index e70ebf87e9d..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/apiviewer.js
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
-This file is part of the qooxdoo framework.
-
-qooxdoo is dual-licensed under the GNU Lesser General Public License (LGPL) and the Eclipse Public License (EPL). As a recipient of qooxdoo, you may choose which license to receive the code under.
-*/
-
-(function(){
-
-if (!window.qx) window.qx = {};
-
-qx.$$start = new Date();
-
-if (!window.qxsettings) qxsettings = {};
-var settings = {"qx.application":"apiviewer.Application","qx.nativeScrollBars":true,"qx.theme":"apiviewer.Theme","qx.version":"1.3"};
-for (var k in settings) qxsettings[k] = settings[k];
-
-if (!window.qxvariants) qxvariants = {};
-var variants = {"qx.aspects":"off","qx.debug":"off"};
-for (var k in variants) qxvariants[k] = variants[k];
-
-if (!qx.$$libraries) qx.$$libraries = {};
-var libinfo = {"__out__":{"sourceUri":"script"},"apiviewer":{"resourceUri":"resource","sourceUri":"script","version":"trunk"},"qx":{"resourceUri":"resource","sourceUri":"script","version":"1.3"}};
-for (var k in libinfo) qx.$$libraries[k] = libinfo[k];
-
-qx.$$resources = {};
-qx.$$translations = {};
-qx.$$locales = {};
-qx.$$packageData = {};
-
-qx.$$loader = {
- parts : {"boot":[0]},
- uris : [["__out__:apiviewer.js"]],
- urisBefore : [],
- packageHashes : {"0":"9b3309ed13dc"},
- boot : "boot",
- closureParts : {},
- bootIsInline : true,
- addNoCacheParam : true,
-
- decodeUris : function(compressedUris)
- {
- var libs = qx.$$libraries;
- var uris = [];
- for (var i=0; i<compressedUris.length; i++)
- {
- var uri = compressedUris[i].split(":");
- var euri;
- if (uri.length==2 && uri[0] in libs) {
- var prefix = libs[uri[0]].sourceUri;
- euri = prefix + "/" + uri[1];
- } else {
- euri = compressedUris[i];
- }
- if (qx.$$loader.addNoCacheParam) {
- euri += "?nocache=" + Math.random();
- }
-
- uris.push(euri);
- }
- return uris;
- }
-};
-
-function loadScript(uri, callback) {
- var elem = document.createElement("script");
- elem.charset = "utf-8";
- elem.src = uri;
- elem.onreadystatechange = elem.onload = function()
- {
- if (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")
- {
- elem.onreadystatechange = elem.onload = null;
- callback();
- }
- };
- var head = document.getElementsByTagName("head")[0];
- head.appendChild(elem);
-}
-
-var isWebkit = /AppleWebKit\/([^ ]+)/.test(navigator.userAgent);
-
-function loadScriptList(list, callback) {
- if (list.length == 0) {
- callback();
- return;
- }
- loadScript(list.shift(), function() {
- if (isWebkit) {
- // force asynchronous load
- // Safari fails with an "maximum recursion depth exceeded" error if it is
- // called sync.
- window.setTimeout(function() {
- loadScriptList(list, callback);
- }, 0);
- } else {
- loadScriptList(list, callback);
- }
- });
-}
-
-var fireContentLoadedEvent = function() {
- qx.$$domReady = true;
- document.removeEventListener('DOMContentLoaded', fireContentLoadedEvent, false);
-};
-if (document.addEventListener) {
- document.addEventListener('DOMContentLoaded', fireContentLoadedEvent, false);
-}
-
-qx.$$loader.importPackageData = function (dataMap) {
- if (dataMap["resources"]){
- var resMap = dataMap["resources"];
- for (var k in resMap) qx.$$resources[k] = resMap[k];
- }
- if (dataMap["locales"]){
- var locMap = dataMap["locales"];
- var qxlocs = qx.$$locales;
- for (var lang in locMap){
- if (!qxlocs[lang]) qxlocs[lang] = locMap[lang];
- else
- for (var k in locMap[lang]) qxlocs[lang][k] = locMap[lang][k];
- }
- }
- if (dataMap["translations"]){
- var trMap = dataMap["translations"];
- var qxtrans = qx.$$translations;
- for (var lang in trMap){
- if (!qxtrans[lang]) qxtrans[lang] = trMap[lang];
- else
- for (var k in trMap[lang]) qxtrans[lang][k] = trMap[lang][k];
- }
- }
-}
-
-qx.$$loader.signalStartup = function ()
-{
- qx.$$loader.scriptLoaded = true;
- if (window.qx && qx.event && qx.event.handler && qx.event.handler.Application) {
- qx.event.handler.Application.onScriptLoaded();
- qx.$$loader.applicationHandlerReady = true;
- } else {
- qx.$$loader.applicationHandlerReady = false;
- }
-}
-
-qx.$$loader.init = function(){
- var l=qx.$$loader;
- if (l.urisBefore.length>0){
- loadScriptList(l.urisBefore, function(){
- l.initUris();
- });
- } else {
- l.initUris();
- }
-}
-
-qx.$$loader.initUris = function(){
- var l=qx.$$loader;
- var bootPackageHash=l.packageHashes[l.parts[l.boot][0]];
- if (l.bootIsInline){
- l.importPackageData(qx.$$packageData[bootPackageHash]);
- l.signalStartup();
- } else {
- loadScriptList(l.decodeUris(l.uris[l.parts[l.boot]]), function(){
- // Opera needs this extra time to parse the scripts
- window.setTimeout(function(){
- l.importPackageData(qx.$$packageData[bootPackageHash] || {});
- l.signalStartup();
- }, 0);
- });
- }
-}
-})();
-
-qx.$$packageData['9b3309ed13dc']={"locales":{"C":{"alternateQuotationEnd":"’","alternateQuotationStart":"‘","cldr_am":"AM","cldr_date_format_full":"EEEE, MMMM d, y","cldr_date_format_long":"MMMM d, y","cldr_date_format_medium":"MMM d, y","cldr_date_format_short":"M/d/yy","cldr_date_time_format_EEEd":"d EEE","cldr_date_time_format_Hm":"H:mm","cldr_date_time_format_Hms":"H:mm:ss","cldr_date_time_format_M":"L","cldr_date_time_format_MEd":"E, M/d","cldr_date_time_format_MMM":"LLL","cldr_date_time_format_MMMEd":"E, MMM d","cldr_date_time_format_MMMMEd":"E, MMMM d","cldr_date_time_format_MMMMd":"MMMM d","cldr_date_time_format_MMMd":"MMM d","cldr_date_time_format_Md":"M/d","cldr_date_time_format_d":"d","cldr_date_time_format_hm":"h:mm a","cldr_date_time_format_ms":"mm:ss","cldr_date_time_format_y":"y","cldr_date_time_format_yM":"M/yyyy","cldr_date_time_format_yMEd":"EEE, M/d/yyyy","cldr_date_time_format_yMMM":"MMM y","cldr_date_time_format_yMMMEd":"EEE, MMM d, y","cldr_date_time_format_yMMMM":"MMMM y","cldr_date_time_format_yQ":"Q yyyy","cldr_date_time_format_yQQQ":"QQQ y","cldr_day_format_abbreviated_fri":"Fri","cldr_day_format_abbreviated_mon":"Mon","cldr_day_format_abbreviated_sat":"Sat","cldr_day_format_abbreviated_sun":"Sun","cldr_day_format_abbreviated_thu":"Thu","cldr_day_format_abbreviated_tue":"Tue","cldr_day_format_abbreviated_wed":"Wed","cldr_day_format_narrow_fri":"F","cldr_day_format_narrow_mon":"M","cldr_day_format_narrow_sat":"S","cldr_day_format_narrow_sun":"S","cldr_day_format_narrow_thu":"T","cldr_day_format_narrow_tue":"T","cldr_day_format_narrow_wed":"W","cldr_day_format_wide_fri":"Friday","cldr_day_format_wide_mon":"Monday","cldr_day_format_wide_sat":"Saturday","cldr_day_format_wide_sun":"Sunday","cldr_day_format_wide_thu":"Thursday","cldr_day_format_wide_tue":"Tuesday","cldr_day_format_wide_wed":"Wednesday","cldr_day_stand-alone_abbreviated_fri":"Fri","cldr_day_stand-alone_abbreviated_mon":"Mon","cldr_day_stand-alone_abbreviated_sat":"Sat","cldr_day_stand-alone_abbreviated_sun":"Sun","cldr_day_stand-alone_abbreviated_thu":"Thu","cldr_day_stand-alone_abbreviated_tue":"Tue","cldr_day_stand-alone_abbreviated_wed":"Wed","cldr_day_stand-alone_narrow_fri":"F","cldr_day_stand-alone_narrow_mon":"M","cldr_day_stand-alone_narrow_sat":"S","cldr_day_stand-alone_narrow_sun":"S","cldr_day_stand-alone_narrow_thu":"T","cldr_day_stand-alone_narrow_tue":"T","cldr_day_stand-alone_narrow_wed":"W","cldr_day_stand-alone_wide_fri":"Friday","cldr_day_stand-alone_wide_mon":"Monday","cldr_day_stand-alone_wide_sat":"Saturday","cldr_day_stand-alone_wide_sun":"Sunday","cldr_day_stand-alone_wide_thu":"Thursday","cldr_day_stand-alone_wide_tue":"Tuesday","cldr_day_stand-alone_wide_wed":"Wednesday","cldr_month_format_abbreviated_1":"Jan","cldr_month_format_abbreviated_10":"Oct","cldr_month_format_abbreviated_11":"Nov","cldr_month_format_abbreviated_12":"Dec","cldr_month_format_abbreviated_2":"Feb","cldr_month_format_abbreviated_3":"Mar","cldr_month_format_abbreviated_4":"Apr","cldr_month_format_abbreviated_5":"May","cldr_month_format_abbreviated_6":"Jun","cldr_month_format_abbreviated_7":"Jul","cldr_month_format_abbreviated_8":"Aug","cldr_month_format_abbreviated_9":"Sep","cldr_month_format_wide_1":"January","cldr_month_format_wide_10":"October","cldr_month_format_wide_11":"November","cldr_month_format_wide_12":"December","cldr_month_format_wide_2":"February","cldr_month_format_wide_3":"March","cldr_month_format_wide_4":"April","cldr_month_format_wide_5":"May","cldr_month_format_wide_6":"June","cldr_month_format_wide_7":"July","cldr_month_format_wide_8":"August","cldr_month_format_wide_9":"September","cldr_month_stand-alone_narrow_1":"J","cldr_month_stand-alone_narrow_10":"O","cldr_month_stand-alone_narrow_11":"N","cldr_month_stand-alone_narrow_12":"D","cldr_month_stand-alone_narrow_2":"F","cldr_month_stand-alone_narrow_3":"M","cldr_month_stand-alone_narrow_4":"A","cldr_month_stand-alone_narrow_5":"M","cldr_month_stand-alone_narrow_6":"J","cldr_month_stand-alone_narrow_7":"J","cldr_month_stand-alone_narrow_8":"A","cldr_month_stand-alone_narrow_9":"S","cldr_number_decimal_separator":".","cldr_number_group_separator":",","cldr_number_percent_format":"#,##0%","cldr_pm":"PM","cldr_time_format_full":"h:mm:ss a zzzz","cldr_time_format_long":"h:mm:ss a z","cldr_time_format_medium":"h:mm:ss a","cldr_time_format_short":"h:mm a","quotationEnd":"”","quotationStart":"“"}},"resources":{"apiviewer/css/apiviewer.css":"apiviewer","apiviewer/image/blank.gif":[1,1,"gif","apiviewer"],"apiviewer/image/childcontrol18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-540],"apiviewer/image/class18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-324],"apiviewer/image/class_abstract18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-486],"apiviewer/image/class_abstract_warning18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-306],"apiviewer/image/class_singleton18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-612],"apiviewer/image/class_singleton_warning18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-252],"apiviewer/image/class_static18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-234],"apiviewer/image/class_static_warning18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-144],"apiviewer/image/class_warning18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-342],"apiviewer/image/close.gif":[17,13,"gif","apiviewer"],"apiviewer/image/colorstrip.gif":[192,10,"gif","apiviewer"],"apiviewer/image/constant18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-504],"apiviewer/image/constructor18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-558],"apiviewer/image/cross.gif":[18,18,"gif","apiviewer"],"apiviewer/image/event18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-198],"apiviewer/image/information18.png":[18,18,"png","apiviewer"],"apiviewer/image/interface18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-432],"apiviewer/image/interface_warning18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-450],"apiviewer/image/method_private18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-270],"apiviewer/image/method_protected18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-216],"apiviewer/image/method_public18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-126],"apiviewer/image/method_public_inherited18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-18],"apiviewer/image/mixin18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-162],"apiviewer/image/mixin_warning18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-108],"apiviewer/image/nextlevel.gif":[18,18,"gif","apiviewer"],"apiviewer/image/open.gif":[17,13,"gif","apiviewer"],"apiviewer/image/overlay_abstract18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,0],"apiviewer/image/overlay_constructor18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-36],"apiviewer/image/overlay_error18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-414],"apiviewer/image/overlay_inherited18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-576],"apiviewer/image/overlay_mixin18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-180],"apiviewer/image/overlay_overridden18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-288],"apiviewer/image/overlay_static18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-378],"apiviewer/image/overlay_themeable18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-360],"apiviewer/image/overlay_warning18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-594],"apiviewer/image/package18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-54],"apiviewer/image/package_warning18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-90],"apiviewer/image/property18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-522],"apiviewer/image/property_private18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-72],"apiviewer/image/property_protected18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-468],"apiviewer/image/property_themeable18.gif":[18,18,"gif","apiviewer","apiviewer/imagesCombined/symbols.gif",0,-396],"apiviewer/image/search18.png":[18,18,"png","apiviewer"],"apiviewer/image/vline.gif":[18,18,"gif","apiviewer"],"apiviewer/imagesCombined/symbols.gif":[18,630,"gif","apiviewer"],"qx/decoration/Modern/app-header.png":[110,20,"png","qx"],"qx/decoration/Modern/arrows-combined.png":[87,8,"png","qx"],"qx/decoration/Modern/arrows/down-invert.png":[8,5,"png","qx","qx/decoration/Modern/arrows-combined.png",-74,0],"qx/decoration/Modern/arrows/down-small-invert.png":[5,3,"png","qx","qx/decoration/Modern/arrows-combined.png",-69,0],"qx/decoration/Modern/arrows/down-small.png":[5,3,"png","qx","qx/decoration/Modern/arrows-combined.png",-49,0],"qx/decoration/Modern/arrows/down.png":[8,5,"png","qx","qx/decoration/Modern/arrows-combined.png",-20,0],"qx/decoration/Modern/arrows/forward.png":[10,8,"png","qx","qx/decoration/Modern/arrows-combined.png",-59,0],"qx/decoration/Modern/arrows/left-invert.png":[5,8,"png","qx","qx/decoration/Modern/arrows-combined.png",0,0],"qx/decoration/Modern/arrows/left.png":[5,8,"png","qx","qx/decoration/Modern/arrows-combined.png",-44,0],"qx/decoration/Modern/arrows/rewind.png":[10,8,"png","qx","qx/decoration/Modern/arrows-combined.png",-10,0],"qx/decoration/Modern/arrows/right-invert.png":[5,8,"png","qx","qx/decoration/Modern/arrows-combined.png",-5,0],"qx/decoration/Modern/arrows/right.png":[5,8,"png","qx","qx/decoration/Modern/arrows-combined.png",-54,0],"qx/decoration/Modern/arrows/up-invert.png":[8,5,"png","qx","qx/decoration/Modern/arrows-combined.png",-28,0],"qx/decoration/Modern/arrows/up-small.png":[5,3,"png","qx","qx/decoration/Modern/arrows-combined.png",-82,0],"qx/decoration/Modern/arrows/up.png":[8,5,"png","qx","qx/decoration/Modern/arrows-combined.png",-36,0],"qx/decoration/Modern/button-lr-combined.png":[72,52,"png","qx"],"qx/decoration/Modern/button-tb-combined.png":[4,216,"png","qx"],"qx/decoration/Modern/checkradio-combined.png":[504,14,"png","qx"],"qx/decoration/Modern/colorselector-combined.gif":[46,11,"gif","qx"],"qx/decoration/Modern/colorselector/brightness-field.png":[19,256,"png","qx"],"qx/decoration/Modern/colorselector/brightness-handle.gif":[35,11,"gif","qx","qx/decoration/Modern/colorselector-combined.gif",0,0],"qx/decoration/Modern/colorselector/huesaturation-field.jpg":[256,256,"jpeg","qx"],"qx/decoration/Modern/colorselector/huesaturation-handle.gif":[11,11,"gif","qx","qx/decoration/Modern/colorselector-combined.gif",-35,0],"qx/decoration/Modern/cursors-combined.gif":[71,20,"gif","qx"],"qx/decoration/Modern/cursors/alias.gif":[19,15,"gif","qx","qx/decoration/Modern/cursors-combined.gif",-52,0],"qx/decoration/Modern/cursors/copy.gif":[19,15,"gif","qx","qx/decoration/Modern/cursors-combined.gif",-33,0],"qx/decoration/Modern/cursors/move.gif":[13,9,"gif","qx","qx/decoration/Modern/cursors-combined.gif",-20,0],"qx/decoration/Modern/cursors/nodrop.gif":[20,20,"gif","qx","qx/decoration/Modern/cursors-combined.gif",0,0],"qx/decoration/Modern/form/button-b.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-72],"qx/decoration/Modern/form/button-bl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-204],"qx/decoration/Modern/form/button-br.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-188],"qx/decoration/Modern/form/button-c.png":[40,52,"png","qx"],"qx/decoration/Modern/form/button-checked-b.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-36],"qx/decoration/Modern/form/button-checked-bl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-84],"qx/decoration/Modern/form/button-checked-br.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-184],"qx/decoration/Modern/form/button-checked-c.png":[40,52,"png","qx"],"qx/decoration/Modern/form/button-checked-focused-b.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-156],"qx/decoration/Modern/form/button-checked-focused-bl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-208],"qx/decoration/Modern/form/button-checked-focused-br.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-160],"qx/decoration/Modern/form/button-checked-focused-c.png":[40,52,"png","qx"],"qx/decoration/Modern/form/button-checked-focused-l.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-40,0],"qx/decoration/Modern/form/button-checked-focused-r.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-32,0],"qx/decoration/Modern/form/button-checked-focused-t.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-28],"qx/decoration/Modern/form/button-checked-focused-tl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-24],"qx/decoration/Modern/form/button-checked-focused-tr.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-48],"qx/decoration/Modern/form/button-checked-focused.png":[80,60,"png","qx"],"qx/decoration/Modern/form/button-checked-l.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-16,0],"qx/decoration/Modern/form/button-checked-r.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-60,0],"qx/decoration/Modern/form/button-checked-t.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-140],"qx/decoration/Modern/form/button-checked-tl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-56],"qx/decoration/Modern/form/button-checked-tr.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-112],"qx/decoration/Modern/form/button-checked.png":[80,60,"png","qx"],"qx/decoration/Modern/form/button-disabled-b.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-40],"qx/decoration/Modern/form/button-disabled-bl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-136],"qx/decoration/Modern/form/button-disabled-br.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-16],"qx/decoration/Modern/form/button-disabled-c.png":[40,52,"png","qx"],"qx/decoration/Modern/form/button-disabled-l.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-68,0],"qx/decoration/Modern/form/button-disabled-r.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-4,0],"qx/decoration/Modern/form/button-disabled-t.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-116],"qx/decoration/Modern/form/button-disabled-tl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-168],"qx/decoration/Modern/form/button-disabled-tr.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-60],"qx/decoration/Modern/form/button-disabled.png":[80,60,"png","qx"],"qx/decoration/Modern/form/button-focused-b.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-68],"qx/decoration/Modern/form/button-focused-bl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-144],"qx/decoration/Modern/form/button-focused-br.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-8],"qx/decoration/Modern/form/button-focused-c.png":[40,52,"png","qx"],"qx/decoration/Modern/form/button-focused-l.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-24,0],"qx/decoration/Modern/form/button-focused-r.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-44,0],"qx/decoration/Modern/form/button-focused-t.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-192],"qx/decoration/Modern/form/button-focused-tl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-148],"qx/decoration/Modern/form/button-focused-tr.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-104],"qx/decoration/Modern/form/button-focused.png":[80,60,"png","qx"],"qx/decoration/Modern/form/button-hovered-b.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-108],"qx/decoration/Modern/form/button-hovered-bl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-32],"qx/decoration/Modern/form/button-hovered-br.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-128],"qx/decoration/Modern/form/button-hovered-c.png":[40,52,"png","qx"],"qx/decoration/Modern/form/button-hovered-l.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-20,0],"qx/decoration/Modern/form/button-hovered-r.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-48,0],"qx/decoration/Modern/form/button-hovered-t.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-44],"qx/decoration/Modern/form/button-hovered-tl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-76],"qx/decoration/Modern/form/button-hovered-tr.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-88],"qx/decoration/Modern/form/button-hovered.png":[80,60,"png","qx"],"qx/decoration/Modern/form/button-l.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-56,0],"qx/decoration/Modern/form/button-preselected-b.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-124],"qx/decoration/Modern/form/button-preselected-bl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-176],"qx/decoration/Modern/form/button-preselected-br.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-200],"qx/decoration/Modern/form/button-preselected-c.png":[40,52,"png","qx"],"qx/decoration/Modern/form/button-preselected-focused-b.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,0],"qx/decoration/Modern/form/button-preselected-focused-bl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-4],"qx/decoration/Modern/form/button-preselected-focused-br.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-152],"qx/decoration/Modern/form/button-preselected-focused-c.png":[40,52,"png","qx"],"qx/decoration/Modern/form/button-preselected-focused-l.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-28,0],"qx/decoration/Modern/form/button-preselected-focused-r.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-36,0],"qx/decoration/Modern/form/button-preselected-focused-t.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-196],"qx/decoration/Modern/form/button-preselected-focused-tl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-164],"qx/decoration/Modern/form/button-preselected-focused-tr.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-212],"qx/decoration/Modern/form/button-preselected-focused.png":[80,60,"png","qx"],"qx/decoration/Modern/form/button-preselected-l.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-8,0],"qx/decoration/Modern/form/button-preselected-r.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-64,0],"qx/decoration/Modern/form/button-preselected-t.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-96],"qx/decoration/Modern/form/button-preselected-tl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-80],"qx/decoration/Modern/form/button-preselected-tr.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-132],"qx/decoration/Modern/form/button-preselected.png":[80,60,"png","qx"],"qx/decoration/Modern/form/button-pressed-b.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-12],"qx/decoration/Modern/form/button-pressed-bl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-52],"qx/decoration/Modern/form/button-pressed-br.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-20],"qx/decoration/Modern/form/button-pressed-c.png":[40,52,"png","qx"],"qx/decoration/Modern/form/button-pressed-l.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-52,0],"qx/decoration/Modern/form/button-pressed-r.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",-12,0],"qx/decoration/Modern/form/button-pressed-t.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-100],"qx/decoration/Modern/form/button-pressed-tl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-172],"qx/decoration/Modern/form/button-pressed-tr.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-64],"qx/decoration/Modern/form/button-pressed.png":[80,60,"png","qx"],"qx/decoration/Modern/form/button-r.png":[4,52,"png","qx","qx/decoration/Modern/button-lr-combined.png",0,0],"qx/decoration/Modern/form/button-t.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-92],"qx/decoration/Modern/form/button-tl.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-120],"qx/decoration/Modern/form/button-tr.png":[4,4,"png","qx","qx/decoration/Modern/button-tb-combined.png",0,-180],"qx/decoration/Modern/form/button.png":[80,60,"png","qx"],"qx/decoration/Modern/form/checkbox-checked-disabled.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-126,0],"qx/decoration/Modern/form/checkbox-checked-focused-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-322,0],"qx/decoration/Modern/form/checkbox-checked-focused.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-294,0],"qx/decoration/Modern/form/checkbox-checked-hovered-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-364,0],"qx/decoration/Modern/form/checkbox-checked-hovered.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-490,0],"qx/decoration/Modern/form/checkbox-checked-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-224,0],"qx/decoration/Modern/form/checkbox-checked-pressed-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-378,0],"qx/decoration/Modern/form/checkbox-checked-pressed.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-84,0],"qx/decoration/Modern/form/checkbox-checked.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-182,0],"qx/decoration/Modern/form/checkbox-disabled.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-42,0],"qx/decoration/Modern/form/checkbox-focused-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-392,0],"qx/decoration/Modern/form/checkbox-focused.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-210,0],"qx/decoration/Modern/form/checkbox-hovered-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-14,0],"qx/decoration/Modern/form/checkbox-hovered.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-238,0],"qx/decoration/Modern/form/checkbox-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-462,0],"qx/decoration/Modern/form/checkbox-pressed-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-112,0],"qx/decoration/Modern/form/checkbox-pressed.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-448,0],"qx/decoration/Modern/form/checkbox-undetermined-disabled.png":[14,14,"png","qx"],"qx/decoration/Modern/form/checkbox-undetermined-focused-invalid.png":[14,14,"png","qx"],"qx/decoration/Modern/form/checkbox-undetermined-focused.png":[14,14,"png","qx"],"qx/decoration/Modern/form/checkbox-undetermined-hovered-invalid.png":[14,14,"png","qx"],"qx/decoration/Modern/form/checkbox-undetermined-hovered.png":[14,14,"png","qx"],"qx/decoration/Modern/form/checkbox-undetermined-invalid.png":[14,14,"png","qx"],"qx/decoration/Modern/form/checkbox-undetermined.png":[14,14,"png","qx"],"qx/decoration/Modern/form/checkbox.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-140,0],"qx/decoration/Modern/form/input-focused.png":[40,12,"png","qx"],"qx/decoration/Modern/form/input.png":[84,12,"png","qx"],"qx/decoration/Modern/form/radiobutton-checked-disabled.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-196,0],"qx/decoration/Modern/form/radiobutton-checked-focused-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-168,0],"qx/decoration/Modern/form/radiobutton-checked-focused.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-98,0],"qx/decoration/Modern/form/radiobutton-checked-hovered-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-308,0],"qx/decoration/Modern/form/radiobutton-checked-hovered.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-406,0],"qx/decoration/Modern/form/radiobutton-checked-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-28,0],"qx/decoration/Modern/form/radiobutton-checked-pressed-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-350,0],"qx/decoration/Modern/form/radiobutton-checked-pressed.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-266,0],"qx/decoration/Modern/form/radiobutton-checked.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-252,0],"qx/decoration/Modern/form/radiobutton-disabled.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-336,0],"qx/decoration/Modern/form/radiobutton-focused-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-476,0],"qx/decoration/Modern/form/radiobutton-focused.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-420,0],"qx/decoration/Modern/form/radiobutton-hovered-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-56,0],"qx/decoration/Modern/form/radiobutton-hovered.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",0,0],"qx/decoration/Modern/form/radiobutton-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-154,0],"qx/decoration/Modern/form/radiobutton-pressed-invalid.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-434,0],"qx/decoration/Modern/form/radiobutton-pressed.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-280,0],"qx/decoration/Modern/form/radiobutton.png":[14,14,"png","qx","qx/decoration/Modern/checkradio-combined.png",-70,0],"qx/decoration/Modern/form/tooltip-error-arrow.png":[11,14,"png","qx"],"qx/decoration/Modern/form/tooltip-error-b.png":[6,6,"png","qx","qx/decoration/Modern/tooltip-error-tb-combined.png",0,-30],"qx/decoration/Modern/form/tooltip-error-bl.png":[6,6,"png","qx","qx/decoration/Modern/tooltip-error-tb-combined.png",0,-24],"qx/decoration/Modern/form/tooltip-error-br.png":[6,6,"png","qx","qx/decoration/Modern/tooltip-error-tb-combined.png",0,0],"qx/decoration/Modern/form/tooltip-error-c.png":[40,18,"png","qx"],"qx/decoration/Modern/form/tooltip-error-l.png":[6,18,"png","qx","qx/decoration/Modern/tooltip-error-lr-combined.png",-6,0],"qx/decoration/Modern/form/tooltip-error-r.png":[6,18,"png","qx","qx/decoration/Modern/tooltip-error-lr-combined.png",0,0],"qx/decoration/Modern/form/tooltip-error-t.png":[6,6,"png","qx","qx/decoration/Modern/tooltip-error-tb-combined.png",0,-6],"qx/decoration/Modern/form/tooltip-error-tl.png":[6,6,"png","qx","qx/decoration/Modern/tooltip-error-tb-combined.png",0,-18],"qx/decoration/Modern/form/tooltip-error-tr.png":[6,6,"png","qx","qx/decoration/Modern/tooltip-error-tb-combined.png",0,-12],"qx/decoration/Modern/form/tooltip-error.png":[127,30,"png","qx"],"qx/decoration/Modern/group-item.png":[110,20,"png","qx"],"qx/decoration/Modern/groupbox-lr-combined.png":[8,51,"png","qx"],"qx/decoration/Modern/groupbox-tb-combined.png":[4,24,"png","qx"],"qx/decoration/Modern/groupbox/groupbox-b.png":[4,4,"png","qx","qx/decoration/Modern/groupbox-tb-combined.png",0,-12],"qx/decoration/Modern/groupbox/groupbox-bl.png":[4,4,"png","qx","qx/decoration/Modern/groupbox-tb-combined.png",0,-16],"qx/decoration/Modern/groupbox/groupbox-br.png":[4,4,"png","qx","qx/decoration/Modern/groupbox-tb-combined.png",0,-8],"qx/decoration/Modern/groupbox/groupbox-c.png":[40,51,"png","qx"],"qx/decoration/Modern/groupbox/groupbox-l.png":[4,51,"png","qx","qx/decoration/Modern/groupbox-lr-combined.png",-4,0],"qx/decoration/Modern/groupbox/groupbox-r.png":[4,51,"png","qx","qx/decoration/Modern/groupbox-lr-combined.png",0,0],"qx/decoration/Modern/groupbox/groupbox-t.png":[4,4,"png","qx","qx/decoration/Modern/groupbox-tb-combined.png",0,-4],"qx/decoration/Modern/groupbox/groupbox-tl.png":[4,4,"png","qx","qx/decoration/Modern/groupbox-tb-combined.png",0,0],"qx/decoration/Modern/groupbox/groupbox-tr.png":[4,4,"png","qx","qx/decoration/Modern/groupbox-tb-combined.png",0,-20],"qx/decoration/Modern/groupbox/groupbox.png":[255,59,"png","qx"],"qx/decoration/Modern/menu-background-combined.png":[80,49,"png","qx"],"qx/decoration/Modern/menu-checkradio-combined.gif":[64,7,"gif","qx"],"qx/decoration/Modern/menu/background.png":[40,49,"png","qx","qx/decoration/Modern/menu-background-combined.png",-40,0],"qx/decoration/Modern/menu/bar-background.png":[40,20,"png","qx","qx/decoration/Modern/menu-background-combined.png",0,0],"qx/decoration/Modern/menu/checkbox-invert.gif":[16,7,"gif","qx","qx/decoration/Modern/menu-checkradio-combined.gif",-16,0],"qx/decoration/Modern/menu/checkbox.gif":[16,7,"gif","qx","qx/decoration/Modern/menu-checkradio-combined.gif",-48,0],"qx/decoration/Modern/menu/radiobutton-invert.gif":[16,5,"gif","qx","qx/decoration/Modern/menu-checkradio-combined.gif",-32,0],"qx/decoration/Modern/menu/radiobutton.gif":[16,5,"gif","qx","qx/decoration/Modern/menu-checkradio-combined.gif",0,0],"qx/decoration/Modern/pane-lr-combined.png":[12,238,"png","qx"],"qx/decoration/Modern/pane-tb-combined.png":[6,36,"png","qx"],"qx/decoration/Modern/pane/pane-b.png":[6,6,"png","qx","qx/decoration/Modern/pane-tb-combined.png",0,-30],"qx/decoration/Modern/pane/pane-bl.png":[6,6,"png","qx","qx/decoration/Modern/pane-tb-combined.png",0,-18],"qx/decoration/Modern/pane/pane-br.png":[6,6,"png","qx","qx/decoration/Modern/pane-tb-combined.png",0,-12],"qx/decoration/Modern/pane/pane-c.png":[40,238,"png","qx"],"qx/decoration/Modern/pane/pane-l.png":[6,238,"png","qx","qx/decoration/Modern/pane-lr-combined.png",0,0],"qx/decoration/Modern/pane/pane-r.png":[6,238,"png","qx","qx/decoration/Modern/pane-lr-combined.png",-6,0],"qx/decoration/Modern/pane/pane-t.png":[6,6,"png","qx","qx/decoration/Modern/pane-tb-combined.png",0,0],"qx/decoration/Modern/pane/pane-tl.png":[6,6,"png","qx","qx/decoration/Modern/pane-tb-combined.png",0,-24],"qx/decoration/Modern/pane/pane-tr.png":[6,6,"png","qx","qx/decoration/Modern/pane-tb-combined.png",0,-6],"qx/decoration/Modern/pane/pane.png":[185,250,"png","qx"],"qx/decoration/Modern/scrollbar-combined.png":[54,12,"png","qx"],"qx/decoration/Modern/scrollbar/scrollbar-bg-horizontal.png":[76,15,"png","qx"],"qx/decoration/Modern/scrollbar/scrollbar-bg-pressed-horizontal.png":[19,10,"png","qx"],"qx/decoration/Modern/scrollbar/scrollbar-bg-pressed-vertical.png":[10,19,"png","qx"],"qx/decoration/Modern/scrollbar/scrollbar-bg-vertical.png":[15,76,"png","qx"],"qx/decoration/Modern/scrollbar/scrollbar-button-bg-horizontal.png":[12,10,"png","qx","qx/decoration/Modern/scrollbar-combined.png",-34,0],"qx/decoration/Modern/scrollbar/scrollbar-button-bg-vertical.png":[10,12,"png","qx","qx/decoration/Modern/scrollbar-combined.png",-6,0],"qx/decoration/Modern/scrollbar/scrollbar-down.png":[6,4,"png","qx","qx/decoration/Modern/scrollbar-combined.png",-28,0],"qx/decoration/Modern/scrollbar/scrollbar-left.png":[4,6,"png","qx","qx/decoration/Modern/scrollbar-combined.png",-50,0],"qx/decoration/Modern/scrollbar/scrollbar-right.png":[4,6,"png","qx","qx/decoration/Modern/scrollbar-combined.png",-46,0],"qx/decoration/Modern/scrollbar/scrollbar-up.png":[6,4,"png","qx","qx/decoration/Modern/scrollbar-combined.png",0,0],"qx/decoration/Modern/scrollbar/slider-knob-background.png":[12,10,"png","qx","qx/decoration/Modern/scrollbar-combined.png",-16,0],"qx/decoration/Modern/selection.png":[110,20,"png","qx"],"qx/decoration/Modern/shadow-lr-combined.png":[30,382,"png","qx"],"qx/decoration/Modern/shadow-small-lr-combined.png":[10,136,"png","qx"],"qx/decoration/Modern/shadow-small-tb-combined.png":[5,30,"png","qx"],"qx/decoration/Modern/shadow-tb-combined.png":[15,90,"png","qx"],"qx/decoration/Modern/shadow/shadow-b.png":[15,15,"png","qx","qx/decoration/Modern/shadow-tb-combined.png",0,-30],"qx/decoration/Modern/shadow/shadow-bl.png":[15,15,"png","qx","qx/decoration/Modern/shadow-tb-combined.png",0,-15],"qx/decoration/Modern/shadow/shadow-br.png":[15,15,"png","qx","qx/decoration/Modern/shadow-tb-combined.png",0,-45],"qx/decoration/Modern/shadow/shadow-c.png":[40,382,"png","qx"],"qx/decoration/Modern/shadow/shadow-l.png":[15,382,"png","qx","qx/decoration/Modern/shadow-lr-combined.png",0,0],"qx/decoration/Modern/shadow/shadow-r.png":[15,382,"png","qx","qx/decoration/Modern/shadow-lr-combined.png",-15,0],"qx/decoration/Modern/shadow/shadow-small-b.png":[5,5,"png","qx","qx/decoration/Modern/shadow-small-tb-combined.png",0,-20],"qx/decoration/Modern/shadow/shadow-small-bl.png":[5,5,"png","qx","qx/decoration/Modern/shadow-small-tb-combined.png",0,-15],"qx/decoration/Modern/shadow/shadow-small-br.png":[5,5,"png","qx","qx/decoration/Modern/shadow-small-tb-combined.png",0,-10],"qx/decoration/Modern/shadow/shadow-small-c.png":[40,136,"png","qx"],"qx/decoration/Modern/shadow/shadow-small-l.png":[5,136,"png","qx","qx/decoration/Modern/shadow-small-lr-combined.png",0,0],"qx/decoration/Modern/shadow/shadow-small-r.png":[5,136,"png","qx","qx/decoration/Modern/shadow-small-lr-combined.png",-5,0],"qx/decoration/Modern/shadow/shadow-small-t.png":[5,5,"png","qx","qx/decoration/Modern/shadow-small-tb-combined.png",0,-5],"qx/decoration/Modern/shadow/shadow-small-tl.png":[5,5,"png","qx","qx/decoration/Modern/shadow-small-tb-combined.png",0,0],"qx/decoration/Modern/shadow/shadow-small-tr.png":[5,5,"png","qx","qx/decoration/Modern/shadow-small-tb-combined.png",0,-25],"qx/decoration/Modern/shadow/shadow-small.png":[114,146,"png","qx"],"qx/decoration/Modern/shadow/shadow-t.png":[15,15,"png","qx","qx/decoration/Modern/shadow-tb-combined.png",0,-60],"qx/decoration/Modern/shadow/shadow-tl.png":[15,15,"png","qx","qx/decoration/Modern/shadow-tb-combined.png",0,-75],"qx/decoration/Modern/shadow/shadow-tr.png":[15,15,"png","qx","qx/decoration/Modern/shadow-tb-combined.png",0,0],"qx/decoration/Modern/shadow/shadow.png":[381,412,"png","qx"],"qx/decoration/Modern/splitpane-knobs-combined.png":[8,9,"png","qx"],"qx/decoration/Modern/splitpane/knob-horizontal.png":[1,8,"png","qx","qx/decoration/Modern/splitpane-knobs-combined.png",0,-1],"qx/decoration/Modern/splitpane/knob-vertical.png":[8,1,"png","qx","qx/decoration/Modern/splitpane-knobs-combined.png",0,0],"qx/decoration/Modern/table-combined.png":[94,18,"png","qx"],"qx/decoration/Modern/table/ascending.png":[8,5,"png","qx","qx/decoration/Modern/table-combined.png",0,0],"qx/decoration/Modern/table/boolean-false.png":[14,14,"png","qx","qx/decoration/Modern/table-combined.png",-80,0],"qx/decoration/Modern/table/boolean-true.png":[14,14,"png","qx","qx/decoration/Modern/table-combined.png",-26,0],"qx/decoration/Modern/table/descending.png":[8,5,"png","qx","qx/decoration/Modern/table-combined.png",-18,0],"qx/decoration/Modern/table/header-cell.png":[40,18,"png","qx","qx/decoration/Modern/table-combined.png",-40,0],"qx/decoration/Modern/table/select-column-order.png":[10,9,"png","qx","qx/decoration/Modern/table-combined.png",-8,0],"qx/decoration/Modern/tabview-button-bottom-active-lr-combined.png":[10,14,"png","qx"],"qx/decoration/Modern/tabview-button-bottom-active-tb-combined.png":[5,30,"png","qx"],"qx/decoration/Modern/tabview-button-bottom-inactive-b-combined.png":[3,9,"png","qx"],"qx/decoration/Modern/tabview-button-bottom-inactive-lr-combined.png":[6,15,"png","qx"],"qx/decoration/Modern/tabview-button-bottom-inactive-t-combined.png":[3,9,"png","qx"],"qx/decoration/Modern/tabview-button-left-active-lr-combined.png":[10,37,"png","qx"],"qx/decoration/Modern/tabview-button-left-active-tb-combined.png":[5,30,"png","qx"],"qx/decoration/Modern/tabview-button-left-inactive-b-combined.png":[3,9,"png","qx"],"qx/decoration/Modern/tabview-button-left-inactive-lr-combined.png":[6,39,"png","qx"],"qx/decoration/Modern/tabview-button-left-inactive-t-combined.png":[3,9,"png","qx"],"qx/decoration/Modern/tabview-button-right-active-lr-combined.png":[10,37,"png","qx"],"qx/decoration/Modern/tabview-button-right-active-tb-combined.png":[5,30,"png","qx"],"qx/decoration/Modern/tabview-button-right-inactive-b-combined.png":[3,9,"png","qx"],"qx/decoration/Modern/tabview-button-right-inactive-lr-combined.png":[6,39,"png","qx"],"qx/decoration/Modern/tabview-button-right-inactive-t-combined.png":[3,9,"png","qx"],"qx/decoration/Modern/tabview-button-top-active-lr-combined.png":[10,12,"png","qx"],"qx/decoration/Modern/tabview-button-top-active-tb-combined.png":[5,30,"png","qx"],"qx/decoration/Modern/tabview-button-top-inactive-b-combined.png":[3,9,"png","qx"],"qx/decoration/Modern/tabview-button-top-inactive-lr-combined.png":[6,15,"png","qx"],"qx/decoration/Modern/tabview-button-top-inactive-t-combined.png":[3,9,"png","qx"],"qx/decoration/Modern/tabview-pane-lr-combined.png":[60,2,"png","qx"],"qx/decoration/Modern/tabview-pane-tb-combined.png":[30,180,"png","qx"],"qx/decoration/Modern/tabview/tab-button-bottom-active-b.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-bottom-active-tb-combined.png",0,-10],"qx/decoration/Modern/tabview/tab-button-bottom-active-bl.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-bottom-active-tb-combined.png",0,-15],"qx/decoration/Modern/tabview/tab-button-bottom-active-br.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-bottom-active-tb-combined.png",0,-5],"qx/decoration/Modern/tabview/tab-button-bottom-active-c.png":[40,14,"png","qx"],"qx/decoration/Modern/tabview/tab-button-bottom-active-l.png":[5,14,"png","qx","qx/decoration/Modern/tabview-button-bottom-active-lr-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-bottom-active-r.png":[5,14,"png","qx","qx/decoration/Modern/tabview-button-bottom-active-lr-combined.png",-5,0],"qx/decoration/Modern/tabview/tab-button-bottom-active-t.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-bottom-active-tb-combined.png",0,-20],"qx/decoration/Modern/tabview/tab-button-bottom-active-tl.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-bottom-active-tb-combined.png",0,-25],"qx/decoration/Modern/tabview/tab-button-bottom-active-tr.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-bottom-active-tb-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-bottom-active.png":[49,24,"png","qx"],"qx/decoration/Modern/tabview/tab-button-bottom-inactive-b.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-bottom-inactive-b-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-bottom-inactive-bl.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-bottom-inactive-b-combined.png",0,-6],"qx/decoration/Modern/tabview/tab-button-bottom-inactive-br.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-bottom-inactive-b-combined.png",0,-3],"qx/decoration/Modern/tabview/tab-button-bottom-inactive-c.png":[40,15,"png","qx"],"qx/decoration/Modern/tabview/tab-button-bottom-inactive-l.png":[3,15,"png","qx","qx/decoration/Modern/tabview-button-bottom-inactive-lr-combined.png",-3,0],"qx/decoration/Modern/tabview/tab-button-bottom-inactive-r.png":[3,15,"png","qx","qx/decoration/Modern/tabview-button-bottom-inactive-lr-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-bottom-inactive-t.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-bottom-inactive-t-combined.png",0,-3],"qx/decoration/Modern/tabview/tab-button-bottom-inactive-tl.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-bottom-inactive-t-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-bottom-inactive-tr.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-bottom-inactive-t-combined.png",0,-6],"qx/decoration/Modern/tabview/tab-button-bottom-inactive.png":[45,21,"png","qx"],"qx/decoration/Modern/tabview/tab-button-left-active-b.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-left-active-tb-combined.png",0,-5],"qx/decoration/Modern/tabview/tab-button-left-active-bl.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-left-active-tb-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-left-active-br.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-left-active-tb-combined.png",0,-25],"qx/decoration/Modern/tabview/tab-button-left-active-c.png":[40,37,"png","qx"],"qx/decoration/Modern/tabview/tab-button-left-active-l.png":[5,37,"png","qx","qx/decoration/Modern/tabview-button-left-active-lr-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-left-active-r.png":[5,37,"png","qx","qx/decoration/Modern/tabview-button-left-active-lr-combined.png",-5,0],"qx/decoration/Modern/tabview/tab-button-left-active-t.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-left-active-tb-combined.png",0,-15],"qx/decoration/Modern/tabview/tab-button-left-active-tl.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-left-active-tb-combined.png",0,-10],"qx/decoration/Modern/tabview/tab-button-left-active-tr.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-left-active-tb-combined.png",0,-20],"qx/decoration/Modern/tabview/tab-button-left-active.png":[22,47,"png","qx"],"qx/decoration/Modern/tabview/tab-button-left-inactive-b.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-left-inactive-b-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-left-inactive-bl.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-left-inactive-b-combined.png",0,-6],"qx/decoration/Modern/tabview/tab-button-left-inactive-br.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-left-inactive-b-combined.png",0,-3],"qx/decoration/Modern/tabview/tab-button-left-inactive-c.png":[40,39,"png","qx"],"qx/decoration/Modern/tabview/tab-button-left-inactive-l.png":[3,39,"png","qx","qx/decoration/Modern/tabview-button-left-inactive-lr-combined.png",-3,0],"qx/decoration/Modern/tabview/tab-button-left-inactive-r.png":[3,39,"png","qx","qx/decoration/Modern/tabview-button-left-inactive-lr-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-left-inactive-t.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-left-inactive-t-combined.png",0,-3],"qx/decoration/Modern/tabview/tab-button-left-inactive-tl.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-left-inactive-t-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-left-inactive-tr.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-left-inactive-t-combined.png",0,-6],"qx/decoration/Modern/tabview/tab-button-left-inactive.png":[20,45,"png","qx"],"qx/decoration/Modern/tabview/tab-button-right-active-b.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-right-active-tb-combined.png",0,-25],"qx/decoration/Modern/tabview/tab-button-right-active-bl.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-right-active-tb-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-right-active-br.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-right-active-tb-combined.png",0,-20],"qx/decoration/Modern/tabview/tab-button-right-active-c.png":[40,37,"png","qx"],"qx/decoration/Modern/tabview/tab-button-right-active-l.png":[5,37,"png","qx","qx/decoration/Modern/tabview-button-right-active-lr-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-right-active-r.png":[5,37,"png","qx","qx/decoration/Modern/tabview-button-right-active-lr-combined.png",-5,0],"qx/decoration/Modern/tabview/tab-button-right-active-t.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-right-active-tb-combined.png",0,-5],"qx/decoration/Modern/tabview/tab-button-right-active-tl.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-right-active-tb-combined.png",0,-15],"qx/decoration/Modern/tabview/tab-button-right-active-tr.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-right-active-tb-combined.png",0,-10],"qx/decoration/Modern/tabview/tab-button-right-active.png":[22,47,"png","qx"],"qx/decoration/Modern/tabview/tab-button-right-inactive-b.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-right-inactive-b-combined.png",0,-3],"qx/decoration/Modern/tabview/tab-button-right-inactive-bl.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-right-inactive-b-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-right-inactive-br.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-right-inactive-b-combined.png",0,-6],"qx/decoration/Modern/tabview/tab-button-right-inactive-c.png":[40,39,"png","qx"],"qx/decoration/Modern/tabview/tab-button-right-inactive-l.png":[3,39,"png","qx","qx/decoration/Modern/tabview-button-right-inactive-lr-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-right-inactive-r.png":[3,39,"png","qx","qx/decoration/Modern/tabview-button-right-inactive-lr-combined.png",-3,0],"qx/decoration/Modern/tabview/tab-button-right-inactive-t.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-right-inactive-t-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-right-inactive-tl.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-right-inactive-t-combined.png",0,-3],"qx/decoration/Modern/tabview/tab-button-right-inactive-tr.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-right-inactive-t-combined.png",0,-6],"qx/decoration/Modern/tabview/tab-button-right-inactive.png":[20,45,"png","qx"],"qx/decoration/Modern/tabview/tab-button-top-active-b.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-top-active-tb-combined.png",0,-20],"qx/decoration/Modern/tabview/tab-button-top-active-bl.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-top-active-tb-combined.png",0,-15],"qx/decoration/Modern/tabview/tab-button-top-active-br.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-top-active-tb-combined.png",0,-10],"qx/decoration/Modern/tabview/tab-button-top-active-c.png":[40,14,"png","qx"],"qx/decoration/Modern/tabview/tab-button-top-active-l.png":[5,12,"png","qx","qx/decoration/Modern/tabview-button-top-active-lr-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-top-active-r.png":[5,12,"png","qx","qx/decoration/Modern/tabview-button-top-active-lr-combined.png",-5,0],"qx/decoration/Modern/tabview/tab-button-top-active-t.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-top-active-tb-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-top-active-tl.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-top-active-tb-combined.png",0,-25],"qx/decoration/Modern/tabview/tab-button-top-active-tr.png":[5,5,"png","qx","qx/decoration/Modern/tabview-button-top-active-tb-combined.png",0,-5],"qx/decoration/Modern/tabview/tab-button-top-active.png":[48,22,"png","qx"],"qx/decoration/Modern/tabview/tab-button-top-inactive-b.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-top-inactive-b-combined.png",0,-6],"qx/decoration/Modern/tabview/tab-button-top-inactive-bl.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-top-inactive-b-combined.png",0,-3],"qx/decoration/Modern/tabview/tab-button-top-inactive-br.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-top-inactive-b-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-top-inactive-c.png":[40,15,"png","qx"],"qx/decoration/Modern/tabview/tab-button-top-inactive-l.png":[3,15,"png","qx","qx/decoration/Modern/tabview-button-top-inactive-lr-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-top-inactive-r.png":[3,15,"png","qx","qx/decoration/Modern/tabview-button-top-inactive-lr-combined.png",-3,0],"qx/decoration/Modern/tabview/tab-button-top-inactive-t.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-top-inactive-t-combined.png",0,-3],"qx/decoration/Modern/tabview/tab-button-top-inactive-tl.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-top-inactive-t-combined.png",0,0],"qx/decoration/Modern/tabview/tab-button-top-inactive-tr.png":[3,3,"png","qx","qx/decoration/Modern/tabview-button-top-inactive-t-combined.png",0,-6],"qx/decoration/Modern/tabview/tab-button-top-inactive.png":[45,21,"png","qx"],"qx/decoration/Modern/tabview/tabview-pane-b.png":[30,30,"png","qx","qx/decoration/Modern/tabview-pane-tb-combined.png",0,-60],"qx/decoration/Modern/tabview/tabview-pane-bl.png":[30,30,"png","qx","qx/decoration/Modern/tabview-pane-tb-combined.png",0,0],"qx/decoration/Modern/tabview/tabview-pane-br.png":[30,30,"png","qx","qx/decoration/Modern/tabview-pane-tb-combined.png",0,-120],"qx/decoration/Modern/tabview/tabview-pane-c.png":[40,120,"png","qx"],"qx/decoration/Modern/tabview/tabview-pane-l.png":[30,2,"png","qx","qx/decoration/Modern/tabview-pane-lr-combined.png",0,0],"qx/decoration/Modern/tabview/tabview-pane-r.png":[30,2,"png","qx","qx/decoration/Modern/tabview-pane-lr-combined.png",-30,0],"qx/decoration/Modern/tabview/tabview-pane-t.png":[30,30,"png","qx","qx/decoration/Modern/tabview-pane-tb-combined.png",0,-150],"qx/decoration/Modern/tabview/tabview-pane-tl.png":[30,30,"png","qx","qx/decoration/Modern/tabview-pane-tb-combined.png",0,-30],"qx/decoration/Modern/tabview/tabview-pane-tr.png":[30,30,"png","qx","qx/decoration/Modern/tabview-pane-tb-combined.png",0,-90],"qx/decoration/Modern/tabview/tabview-pane.png":[185,250,"png","qx"],"qx/decoration/Modern/toolbar-combined.png":[80,130,"png","qx"],"qx/decoration/Modern/toolbar/toolbar-gradient-blue.png":[40,130,"png","qx","qx/decoration/Modern/toolbar-combined.png",-40,0],"qx/decoration/Modern/toolbar/toolbar-gradient.png":[40,130,"png","qx","qx/decoration/Modern/toolbar-combined.png",0,0],"qx/decoration/Modern/toolbar/toolbar-handle-knob.gif":[1,8,"gif","qx"],"qx/decoration/Modern/toolbar/toolbar-part.gif":[7,1,"gif","qx"],"qx/decoration/Modern/tooltip-error-lr-combined.png":[12,18,"png","qx"],"qx/decoration/Modern/tooltip-error-tb-combined.png":[6,36,"png","qx"],"qx/decoration/Modern/tree-combined.png":[32,8,"png","qx"],"qx/decoration/Modern/tree/closed-selected.png":[8,8,"png","qx","qx/decoration/Modern/tree-combined.png",-24,0],"qx/decoration/Modern/tree/closed.png":[8,8,"png","qx","qx/decoration/Modern/tree-combined.png",-16,0],"qx/decoration/Modern/tree/open-selected.png":[8,8,"png","qx","qx/decoration/Modern/tree-combined.png",-8,0],"qx/decoration/Modern/tree/open.png":[8,8,"png","qx","qx/decoration/Modern/tree-combined.png",0,0],"qx/decoration/Modern/window-captionbar-buttons-combined.png":[108,9,"png","qx"],"qx/decoration/Modern/window-captionbar-lr-active-combined.png":[12,9,"png","qx"],"qx/decoration/Modern/window-captionbar-lr-inactive-combined.png":[12,9,"png","qx"],"qx/decoration/Modern/window-captionbar-tb-active-combined.png":[6,36,"png","qx"],"qx/decoration/Modern/window-captionbar-tb-inactive-combined.png":[6,36,"png","qx"],"qx/decoration/Modern/window-statusbar-lr-combined.png":[8,7,"png","qx"],"qx/decoration/Modern/window-statusbar-tb-combined.png":[4,24,"png","qx"],"qx/decoration/Modern/window/captionbar-active-b.png":[6,6,"png","qx","qx/decoration/Modern/window-captionbar-tb-active-combined.png",0,-18],"qx/decoration/Modern/window/captionbar-active-bl.png":[6,6,"png","qx","qx/decoration/Modern/window-captionbar-tb-active-combined.png",0,-24],"qx/decoration/Modern/window/captionbar-active-br.png":[6,6,"png","qx","qx/decoration/Modern/window-captionbar-tb-active-combined.png",0,-12],"qx/decoration/Modern/window/captionbar-active-c.png":[40,9,"png","qx"],"qx/decoration/Modern/window/captionbar-active-l.png":[6,9,"png","qx","qx/decoration/Modern/window-captionbar-lr-active-combined.png",-6,0],"qx/decoration/Modern/window/captionbar-active-r.png":[6,9,"png","qx","qx/decoration/Modern/window-captionbar-lr-active-combined.png",0,0],"qx/decoration/Modern/window/captionbar-active-t.png":[6,6,"png","qx","qx/decoration/Modern/window-captionbar-tb-active-combined.png",0,-6],"qx/decoration/Modern/window/captionbar-active-tl.png":[6,6,"png","qx","qx/decoration/Modern/window-captionbar-tb-active-combined.png",0,0],"qx/decoration/Modern/window/captionbar-active-tr.png":[6,6,"png","qx","qx/decoration/Modern/window-captionbar-tb-active-combined.png",0,-30],"qx/decoration/Modern/window/captionbar-active.png":[69,21,"png","qx"],"qx/decoration/Modern/window/captionbar-inactive-b.png":[6,6,"png","qx","qx/decoration/Modern/window-captionbar-tb-inactive-combined.png",0,-24],"qx/decoration/Modern/window/captionbar-inactive-bl.png":[6,6,"png","qx","qx/decoration/Modern/window-captionbar-tb-inactive-combined.png",0,-6],"qx/decoration/Modern/window/captionbar-inactive-br.png":[6,6,"png","qx","qx/decoration/Modern/window-captionbar-tb-inactive-combined.png",0,-30],"qx/decoration/Modern/window/captionbar-inactive-c.png":[40,9,"png","qx"],"qx/decoration/Modern/window/captionbar-inactive-l.png":[6,9,"png","qx","qx/decoration/Modern/window-captionbar-lr-inactive-combined.png",0,0],"qx/decoration/Modern/window/captionbar-inactive-r.png":[6,9,"png","qx","qx/decoration/Modern/window-captionbar-lr-inactive-combined.png",-6,0],"qx/decoration/Modern/window/captionbar-inactive-t.png":[6,6,"png","qx","qx/decoration/Modern/window-captionbar-tb-inactive-combined.png",0,0],"qx/decoration/Modern/window/captionbar-inactive-tl.png":[6,6,"png","qx","qx/decoration/Modern/window-captionbar-tb-inactive-combined.png",0,-12],"qx/decoration/Modern/window/captionbar-inactive-tr.png":[6,6,"png","qx","qx/decoration/Modern/window-captionbar-tb-inactive-combined.png",0,-18],"qx/decoration/Modern/window/captionbar-inactive.png":[69,21,"png","qx"],"qx/decoration/Modern/window/close-active-hovered.png":[9,9,"png","qx","qx/decoration/Modern/window-captionbar-buttons-combined.png",-27,0],"qx/decoration/Modern/window/close-active.png":[9,9,"png","qx","qx/decoration/Modern/window-captionbar-buttons-combined.png",-9,0],"qx/decoration/Modern/window/close-inactive.png":[9,9,"png","qx","qx/decoration/Modern/window-captionbar-buttons-combined.png",-90,0],"qx/decoration/Modern/window/maximize-active-hovered.png":[9,9,"png","qx","qx/decoration/Modern/window-captionbar-buttons-combined.png",-18,0],"qx/decoration/Modern/window/maximize-active.png":[9,9,"png","qx","qx/decoration/Modern/window-captionbar-buttons-combined.png",-81,0],"qx/decoration/Modern/window/maximize-inactive.png":[9,9,"png","qx","qx/decoration/Modern/window-captionbar-buttons-combined.png",-54,0],"qx/decoration/Modern/window/minimize-active-hovered.png":[9,9,"png","qx","qx/decoration/Modern/window-captionbar-buttons-combined.png",-63,0],"qx/decoration/Modern/window/minimize-active.png":[9,9,"png","qx","qx/decoration/Modern/window-captionbar-buttons-combined.png",-72,0],"qx/decoration/Modern/window/minimize-inactive.png":[9,9,"png","qx","qx/decoration/Modern/window-captionbar-buttons-combined.png",-36,0],"qx/decoration/Modern/window/restore-active-hovered.png":[9,8,"png","qx","qx/decoration/Modern/window-captionbar-buttons-combined.png",0,0],"qx/decoration/Modern/window/restore-active.png":[9,8,"png","qx","qx/decoration/Modern/window-captionbar-buttons-combined.png",-99,0],"qx/decoration/Modern/window/restore-inactive.png":[9,8,"png","qx","qx/decoration/Modern/window-captionbar-buttons-combined.png",-45,0],"qx/decoration/Modern/window/statusbar-b.png":[4,4,"png","qx","qx/decoration/Modern/window-statusbar-tb-combined.png",0,-16],"qx/decoration/Modern/window/statusbar-bl.png":[4,4,"png","qx","qx/decoration/Modern/window-statusbar-tb-combined.png",0,-20],"qx/decoration/Modern/window/statusbar-br.png":[4,4,"png","qx","qx/decoration/Modern/window-statusbar-tb-combined.png",0,-4],"qx/decoration/Modern/window/statusbar-c.png":[40,7,"png","qx"],"qx/decoration/Modern/window/statusbar-l.png":[4,7,"png","qx","qx/decoration/Modern/window-statusbar-lr-combined.png",-4,0],"qx/decoration/Modern/window/statusbar-r.png":[4,7,"png","qx","qx/decoration/Modern/window-statusbar-lr-combined.png",0,0],"qx/decoration/Modern/window/statusbar-t.png":[4,4,"png","qx","qx/decoration/Modern/window-statusbar-tb-combined.png",0,0],"qx/decoration/Modern/window/statusbar-tl.png":[4,4,"png","qx","qx/decoration/Modern/window-statusbar-tb-combined.png",0,-8],"qx/decoration/Modern/window/statusbar-tr.png":[4,4,"png","qx","qx/decoration/Modern/window-statusbar-tb-combined.png",0,-12],"qx/decoration/Modern/window/statusbar.png":[369,15,"png","qx"],"qx/icon/Tango/16/actions/dialog-cancel.png":[16,16,"png","qx"],"qx/icon/Tango/16/actions/dialog-ok.png":[16,16,"png","qx"],"qx/icon/Tango/16/actions/view-refresh.png":[16,16,"png","qx"],"qx/icon/Tango/16/actions/window-close.png":[16,16,"png","qx"],"qx/icon/Tango/16/apps/office-calendar.png":[16,16,"png","qx"],"qx/icon/Tango/16/apps/utilities-color-chooser.png":[16,16,"png","qx"],"qx/icon/Tango/16/mimetypes/office-document.png":[16,16,"png","qx"],"qx/icon/Tango/16/places/folder-open.png":[16,16,"png","qx"],"qx/icon/Tango/16/places/folder.png":[16,16,"png","qx"],"qx/icon/Tango/22/actions/edit-find.png":[22,22,"png","qx"],"qx/icon/Tango/22/actions/media-seek-forward.png":[22,22,"png","qx"],"qx/icon/Tango/22/apps/utilities-dictionary.png":[22,22,"png","qx"],"qx/icon/Tango/22/apps/utilities-graphics-viewer.png":[22,22,"png","qx"],"qx/icon/Tango/22/apps/utilities-help.png":[22,22,"png","qx"],"qx/icon/Tango/22/mimetypes/office-document.png":[22,22,"png","qx"],"qx/icon/Tango/22/places/folder-open.png":[22,22,"png","qx"],"qx/icon/Tango/22/places/folder.png":[22,22,"png","qx"],"qx/icon/Tango/32/mimetypes/office-document.png":[32,32,"png","qx"],"qx/icon/Tango/32/places/folder-open.png":[32,32,"png","qx"],"qx/icon/Tango/32/places/folder.png":[32,32,"png","qx"],"qx/static/blank.gif":[1,1,"gif","qx"],"qx/static/blank.html":"qx"},"translations":{"C":{}}};
-(function(){var m="toString",k=".",j="default",h="Object",g='"',f="Array",e="()",d="String",c="Function",b=".prototype",L="function",K="Boolean",J="Error",I="constructor",H="warn",G="hasOwnProperty",F="string",E="toLocaleString",D="RegExp",C='\", "',t="info",u="BROKEN_IE",r="isPrototypeOf",s="Date",p="",q="qx.Bootstrap",n="]",o="Class",v="error",w="[Class ",y="valueOf",x="Number",A="count",z="debug",B="ES5";if(!window.qx){window.qx={};}qx.Bootstrap={genericToString:function(){return w+this.classname+n;},createNamespace:function(name,M){var O=name.split(k);var parent=window;var N=O[0];for(var i=0,P=O.length-1;i<P;i++,N=O[i]){if(!parent[N]){parent=parent[N]={};}else{parent=parent[N];}}parent[N]=M;return N;},setDisplayName:function(Q,R,name){Q.displayName=R+k+name+e;},setDisplayNames:function(S,T){for(var name in S){var U=S[name];if(U instanceof Function){U.displayName=T+k+name+e;}}},define:function(name,V){if(!V){var V={statics:{}};}var bb;var Y=null;qx.Bootstrap.setDisplayNames(V.statics,name);if(V.members||V.extend){qx.Bootstrap.setDisplayNames(V.members,name+b);bb=V.construct||new Function;if(V.extend){this.extendClass(bb,bb,V.extend,name,ba);}var W=V.statics||{};for(var i=0,bc=qx.Bootstrap.getKeys(W),l=bc.length;i<l;i++){var bd=bc[i];bb[bd]=W[bd];}Y=bb.prototype;var X=V.members||{};for(var i=0,bc=qx.Bootstrap.getKeys(X),l=bc.length;i<l;i++){var bd=bc[i];Y[bd]=X[bd];}}else{bb=V.statics||{};}var ba=this.createNamespace(name,bb);bb.name=bb.classname=name;bb.basename=ba;bb.$$type=o;if(!bb.hasOwnProperty(m)){bb.toString=this.genericToString;}if(V.defer){V.defer(bb,Y);}qx.Bootstrap.$$registry[name]=V.statics;return bb;}};qx.Bootstrap.define(q,{statics:{LOADSTART:qx.$$start||new Date(),createNamespace:qx.Bootstrap.createNamespace,define:qx.Bootstrap.define,setDisplayName:qx.Bootstrap.setDisplayName,setDisplayNames:qx.Bootstrap.setDisplayNames,genericToString:qx.Bootstrap.genericToString,extendClass:function(be,bf,bg,name,bh){var bk=bg.prototype;var bj=new Function;bj.prototype=bk;var bi=new bj;be.prototype=bi;bi.name=bi.classname=name;bi.basename=bh;bf.base=be.superclass=bg;bf.self=be.constructor=bi.constructor=be;},getByName:function(name){return qx.Bootstrap.$$registry[name];},$$registry:{},objectGetLength:({"count":function(bl){return bl.__count__;},"default":function(bm){var length=0;for(var bn in bm){length++;}return length;}})[(({}).__count__==0)?A:j],objectMergeWith:function(bo,bp,bq){if(bq===undefined){bq=true;}for(var br in bp){if(bq||bo[br]===undefined){bo[br]=bp[br];}}return bo;},__id:[r,G,E,m,y,I],getKeys:({"ES5":Object.keys,"BROKEN_IE":function(bs){var bt=[];var bv=Object.prototype.hasOwnProperty;for(var bw in bs){if(bv.call(bs,bw)){bt.push(bw);}}var bu=qx.Bootstrap.__id;for(var i=0,a=bu,l=a.length;i<l;i++){if(bv.call(bs,a[i])){bt.push(a[i]);}}return bt;},"default":function(bx){var by=[];var bz=Object.prototype.hasOwnProperty;for(var bA in bx){if(bz.call(bx,bA)){by.push(bA);}}return by;}})[typeof (Object.keys)==L?B:(function(){for(var bB in {toString:1}){return bB;}})()!==m?u:j],getKeysAsString:function(bC){var bD=qx.Bootstrap.getKeys(bC);if(bD.length==0){return p;}return g+bD.join(C)+g;},__ie:{"[object String]":d,"[object Array]":f,"[object Object]":h,"[object RegExp]":D,"[object Number]":x,"[object Boolean]":K,"[object Date]":s,"[object Function]":c,"[object Error]":J},bind:function(bE,self,bF){var bG=Array.prototype.slice.call(arguments,2,arguments.length);return function(){var bH=Array.prototype.slice.call(arguments,0,arguments.length);return bE.apply(self,bG.concat(bH));};},firstUp:function(bI){return bI.charAt(0).toUpperCase()+bI.substr(1);},firstLow:function(bJ){return bJ.charAt(0).toLowerCase()+bJ.substr(1);},getClass:function(bK){var bL=Object.prototype.toString.call(bK);return (qx.Bootstrap.__ie[bL]||bL.slice(8,-1));},isString:function(bM){return (bM!==null&&(typeof bM===F||qx.Bootstrap.getClass(bM)==d||bM instanceof String||(!!bM&&!!bM.$$isString)));},isArray:function(bN){return (bN!==null&&(bN instanceof Array||(bN&&qx.data&&qx.data.IListData&&qx.Bootstrap.hasInterface(bN.constructor,qx.data.IListData))||qx.Bootstrap.getClass(bN)==f||(!!bN&&!!bN.$$isArray)));},isObject:function(bO){return (bO!==undefined&&bO!==null&&qx.Bootstrap.getClass(bO)==h);},isFunction:function(bP){return qx.Bootstrap.getClass(bP)==c;},classIsDefined:function(name){return qx.Bootstrap.getByName(name)!==undefined;},getPropertyDefinition:function(bQ,name){while(bQ){if(bQ.$$properties&&bQ.$$properties[name]){return bQ.$$properties[name];}bQ=bQ.superclass;}return null;},hasProperty:function(bR,name){return !!qx.Bootstrap.getPropertyDefinition(bR,name);},getEventType:function(bS,name){var bS=bS.constructor;while(bS.superclass){if(bS.$$events&&bS.$$events[name]!==undefined){return bS.$$events[name];}bS=bS.superclass;}return null;},supportsEvent:function(bT,name){return !!qx.Bootstrap.getEventType(bT,name);},getByInterface:function(bU,bV){var bW,i,l;while(bU){if(bU.$$implements){bW=bU.$$flatImplements;for(i=0,l=bW.length;i<l;i++){if(bW[i]===bV){return bU;}}}bU=bU.superclass;}return null;},hasInterface:function(bX,bY){return !!qx.Bootstrap.getByInterface(bX,bY);},getMixins:function(ca){var cb=[];while(ca){if(ca.$$includes){cb.push.apply(cb,ca.$$flatIncludes);}ca=ca.superclass;}return cb;},$$logs:[],debug:function(cc,cd){qx.Bootstrap.$$logs.push([z,arguments]);},info:function(ce,cf){qx.Bootstrap.$$logs.push([t,arguments]);},warn:function(cg,ch){qx.Bootstrap.$$logs.push([H,arguments]);},error:function(ci,cj){qx.Bootstrap.$$logs.push([v,arguments]);},trace:function(ck){}}});})();(function(){var g="qx.Mixin",f=".prototype",e="constructor",d="[Mixin ",c="]",b="destruct",a="Mixin";qx.Bootstrap.define(g,{statics:{define:function(name,h){if(h){if(h.include&&!(h.include instanceof Array)){h.include=[h.include];}{};var k=h.statics?h.statics:{};qx.Bootstrap.setDisplayNames(k,name);for(var j in k){if(k[j] instanceof Function){k[j].$$mixin=k;}}if(h.construct){k.$$constructor=h.construct;qx.Bootstrap.setDisplayName(h.construct,name,e);}if(h.include){k.$$includes=h.include;}if(h.properties){k.$$properties=h.properties;}if(h.members){k.$$members=h.members;qx.Bootstrap.setDisplayNames(h.members,name+f);}for(var j in k.$$members){if(k.$$members[j] instanceof Function){k.$$members[j].$$mixin=k;}}if(h.events){k.$$events=h.events;}if(h.destruct){k.$$destructor=h.destruct;qx.Bootstrap.setDisplayName(h.destruct,name,b);}}else{var k={};}k.$$type=a;k.name=name;k.toString=this.genericToString;k.basename=qx.Bootstrap.createNamespace(name,k);this.$$registry[name]=k;return k;},checkCompatibility:function(m){var p=this.flatten(m);var q=p.length;if(q<2){return true;}var t={};var s={};var r={};var o;for(var i=0;i<q;i++){o=p[i];for(var n in o.events){if(r[n]){throw new Error('Conflict between mixin "'+o.name+'" and "'+r[n]+'" in member "'+n+'"!');}r[n]=o.name;}for(var n in o.properties){if(t[n]){throw new Error('Conflict between mixin "'+o.name+'" and "'+t[n]+'" in property "'+n+'"!');}t[n]=o.name;}for(var n in o.members){if(s[n]){throw new Error('Conflict between mixin "'+o.name+'" and "'+s[n]+'" in member "'+n+'"!');}s[n]=o.name;}}return true;},isCompatible:function(u,v){var w=qx.Bootstrap.getMixins(v);w.push(u);return qx.Mixin.checkCompatibility(w);},getByName:function(name){return this.$$registry[name];},isDefined:function(name){return this.getByName(name)!==undefined;},getTotalNumber:function(){return qx.Bootstrap.objectGetLength(this.$$registry);},flatten:function(x){if(!x){return [];}var y=x.concat();for(var i=0,l=x.length;i<l;i++){if(x[i].$$includes){y.push.apply(y,this.flatten(x[i].$$includes));}}return y;},genericToString:function(){return d+this.name+c;},$$registry:{},__er:null,__es:function(){}}});})();(function(){var h="qx.allowUrlSettings",g="&",f="qx.core.Setting",e="qx.allowUrlVariants",d="qx.propertyDebugLevel",c="qxsetting",b=":",a=".";qx.Bootstrap.define(f,{statics:{__eu:{},define:function(j,k){if(k===undefined){throw new Error('Default value of setting "'+j+'" must be defined!');}if(!this.__eu[j]){this.__eu[j]={};}else if(this.__eu[j].defaultValue!==undefined){throw new Error('Setting "'+j+'" is already defined!');}this.__eu[j].defaultValue=k;},get:function(l){var m=this.__eu[l];if(m===undefined){throw new Error('Setting "'+l+'" is not defined.');}if(m.value!==undefined){return m.value;}return m.defaultValue;},set:function(n,o){if((n.split(a)).length<2){throw new Error('Malformed settings key "'+n+'". Must be following the schema "namespace.key".');}if(!this.__eu[n]){this.__eu[n]={};}this.__eu[n].value=o;},__ev:function(){if(window.qxsettings){for(var p in window.qxsettings){this.set(p,window.qxsettings[p]);}window.qxsettings=undefined;try{delete window.qxsettings;}catch(q){}this.__ew();}},__ew:function(){if(this.get(h)!=true){return;}var s=document.location.search.slice(1).split(g);for(var i=0;i<s.length;i++){var r=s[i].split(b);if(r.length!=3||r[0]!=c){continue;}this.set(r[1],decodeURIComponent(r[2]));}}},defer:function(t){t.define(h,false);t.define(e,false);t.define(d,0);t.__ev();}});})();(function(){var h="function",g="Boolean",f="qx.Interface",e="]",d="toggle",c="Interface",b="is",a="[Interface ";qx.Bootstrap.define(f,{statics:{define:function(name,j){if(j){if(j.extend&&!(j.extend instanceof Array)){j.extend=[j.extend];}{};var k=j.statics?j.statics:{};if(j.extend){k.$$extends=j.extend;}if(j.properties){k.$$properties=j.properties;}if(j.members){k.$$members=j.members;}if(j.events){k.$$events=j.events;}}else{var k={};}k.$$type=c;k.name=name;k.toString=this.genericToString;k.basename=qx.Bootstrap.createNamespace(name,k);qx.Interface.$$registry[name]=k;return k;},getByName:function(name){return this.$$registry[name];},isDefined:function(name){return this.getByName(name)!==undefined;},getTotalNumber:function(){return qx.Bootstrap.objectGetLength(this.$$registry);},flatten:function(m){if(!m){return [];}var n=m.concat();for(var i=0,l=m.length;i<l;i++){if(m[i].$$extends){n.push.apply(n,this.flatten(m[i].$$extends));}}return n;},__fI:function(o,p,q,r){var v=q.$$members;if(v){for(var u in v){if(qx.Bootstrap.isFunction(v[u])){var t=this.__fJ(p,u);var s=t||qx.Bootstrap.isFunction(o[u]);if(!s){throw new Error('Implementation of method "'+u+'" is missing in class "'+p.classname+'" required by interface "'+q.name+'"');}var w=r===true&&!t&&!qx.Bootstrap.hasInterface(p,q);if(w){o[u]=this.__fM(q,o[u],u,v[u]);}}else{if(typeof o[u]===undefined){if(typeof o[u]!==h){throw new Error('Implementation of member "'+u+'" is missing in class "'+p.classname+'" required by interface "'+q.name+'"');}}}}}},__fJ:function(x,y){var C=y.match(/^(is|toggle|get|set|reset)(.*)$/);if(!C){return false;}var z=qx.Bootstrap.firstLow(C[2]);var A=qx.Bootstrap.getPropertyDefinition(x,z);if(!A){return false;}var B=C[0]==b||C[0]==d;if(B){return qx.Bootstrap.getPropertyDefinition(x,z).check==g;}return true;},__fK:function(D,E){if(E.$$properties){for(var F in E.$$properties){if(!qx.Bootstrap.getPropertyDefinition(D,F)){throw new Error('The property "'+F+'" is not supported by Class "'+D.classname+'"!');}}}},__fL:function(G,H){if(H.$$events){for(var I in H.$$events){if(!qx.Bootstrap.supportsEvent(G,I)){throw new Error('The event "'+I+'" is not supported by Class "'+G.classname+'"!');}}}},assertObject:function(J,K){var M=J.constructor;this.__fI(J,M,K,false);this.__fK(M,K);this.__fL(M,K);var L=K.$$extends;if(L){for(var i=0,l=L.length;i<l;i++){this.assertObject(J,L[i]);}}},assert:function(N,O,P){this.__fI(N.prototype,N,O,P);this.__fK(N,O);this.__fL(N,O);var Q=O.$$extends;if(Q){for(var i=0,l=Q.length;i<l;i++){this.assert(N,Q[i],P);}}},genericToString:function(){return a+this.name+e;},$$registry:{},__fM:function(){},__fN:null,__fO:function(){}}});})();(function(){var g="emulated",f="native",e='"',d="qx.lang.Core",c="\\\\",b="\\\"",a="[object Error]";qx.Bootstrap.define(d,{statics:{errorToString:{"native":Error.prototype.toString,"emulated":function(){return this.message;}}[(!Error.prototype.toString||Error.prototype.toString()==a)?g:f],arrayIndexOf:{"native":Array.prototype.indexOf,"emulated":function(h,j){if(j==null){j=0;}else if(j<0){j=Math.max(0,this.length+j);}for(var i=j;i<this.length;i++){if(this[i]===h){return i;}}return -1;}}[Array.prototype.indexOf?f:g],arrayLastIndexOf:{"native":Array.prototype.lastIndexOf,"emulated":function(k,m){if(m==null){m=this.length-1;}else if(m<0){m=Math.max(0,this.length+m);}for(var i=m;i>=0;i--){if(this[i]===k){return i;}}return -1;}}[Array.prototype.lastIndexOf?f:g],arrayForEach:{"native":Array.prototype.forEach,"emulated":function(n,o){var l=this.length;for(var i=0;i<l;i++){var p=this[i];if(p!==undefined){n.call(o||window,p,i,this);}}}}[Array.prototype.forEach?f:g],arrayFilter:{"native":Array.prototype.filter,"emulated":function(q,r){var s=[];var l=this.length;for(var i=0;i<l;i++){var t=this[i];if(t!==undefined){if(q.call(r||window,t,i,this)){s.push(this[i]);}}}return s;}}[Array.prototype.filter?f:g],arrayMap:{"native":Array.prototype.map,"emulated":function(u,v){var w=[];var l=this.length;for(var i=0;i<l;i++){var x=this[i];if(x!==undefined){w[i]=u.call(v||window,x,i,this);}}return w;}}[Array.prototype.map?f:g],arraySome:{"native":Array.prototype.some,"emulated":function(y,z){var l=this.length;for(var i=0;i<l;i++){var A=this[i];if(A!==undefined){if(y.call(z||window,A,i,this)){return true;}}}return false;}}[Array.prototype.some?f:g],arrayEvery:{"native":Array.prototype.every,"emulated":function(B,C){var l=this.length;for(var i=0;i<l;i++){var D=this[i];if(D!==undefined){if(!B.call(C||window,D,i,this)){return false;}}}return true;}}[Array.prototype.every?f:g],stringQuote:{"native":String.prototype.quote,"emulated":function(){return e+this.replace(/\\/g,c).replace(/\"/g,b)+e;}}[String.prototype.quote?f:g]}});Error.prototype.toString=qx.lang.Core.errorToString;Array.prototype.indexOf=qx.lang.Core.arrayIndexOf;Array.prototype.lastIndexOf=qx.lang.Core.arrayLastIndexOf;Array.prototype.forEach=qx.lang.Core.arrayForEach;Array.prototype.filter=qx.lang.Core.arrayFilter;Array.prototype.map=qx.lang.Core.arrayMap;Array.prototype.some=qx.lang.Core.arraySome;Array.prototype.every=qx.lang.Core.arrayEvery;String.prototype.quote=qx.lang.Core.stringQuote;})();(function(){var cv=';',cu='computed=this.',ct='=value;',cs='this.',cr="set",cq="setThemed",cp="setRuntime",co="init",cn='if(this.',cm='delete this.',bw='!==undefined)',bv='}',bu="resetThemed",bt='else if(this.',bs="string",br='return this.',bq="reset",bp="boolean",bo="resetRuntime",bn='!==undefined){',cC="",cD="refresh",cA='=true;',cB="this.",cy=";",cz='old=this.',cw="();",cx='else ',cE='if(old===undefined)old=this.',cF='old=computed=this.',bU="return this.",bT="get",bW='(value);',bV="(a[",bY='if(old===computed)return value;',bX='if(old===undefined)old=null;',cb=' of an instance of ',ca=' is not (yet) ready!");',bS="]);",bR='!==inherit){',c='qx.lang.Type.isString(value) && qx.util.ColorUtil.isValidPropertyValue(value)',d='value !== null && qx.theme.manager.Font.getInstance().isDynamic(value)',e='value !== null && value.nodeType === 9 && value.documentElement',f='===value)return value;',g='value !== null && value.$$type === "Mixin"',h='return init;',j='var init=this.',k='value !== null && value.nodeType === 1 && value.attributes',m="var parent = this.getLayoutParent();",n="Error in property ",cT='var a=this._getChildren();if(a)for(var i=0,l=a.length;i<l;i++){',cS='.validate.call(this, value);',cR='qx.core.Assert.assertInstance(value, Date, msg) || true',cQ='else{',cX="if (!parent) return;",cW=" in method ",cV='qx.core.Assert.assertInstance(value, Error, msg) || true',cU='=computed;',da='Undefined value is not allowed!',cY='(backup);',M="MSIE 6.0",N='if(computed===inherit){',K="inherit",L='Is invalid!',Q='if(value===undefined)prop.error(this,2,"',R='var computed, old=this.',O='else if(computed===undefined)',P="': ",I=" of class ",J='value !== null && value.nodeType !== undefined',v='===undefined)return;',u='value !== null && qx.theme.manager.Decoration.getInstance().isValidPropertyValue(value)',x="')){",w='qx.core.Assert.assertPositiveInteger(value, msg) || true',r='else this.',q='value=this.',t='","',s='if(init==qx.core.Property.$$inherit)init=null;',p='value !== null && value.$$type === "Interface"',o='var inherit=prop.$$inherit;',W="', qx.event.type.Data, [computed, old]",X="var value = parent.",Y="$$useinit_",ba='computed=undefined;delete this.',S="(value);",T='Requires exactly one argument!',U='",value);',V='computed=value;',bb="$$runtime_",bc=';}',F="$$user_",E='){',D='qx.core.Assert.assertArray(value, msg) || true',C='if(computed===undefined||computed===inherit){',B='qx.core.Assert.assertPositiveNumber(value, msg) || true',A=".prototype",z="Boolean",y=")}",H='(computed, old, "',G='return value;',bd='if(init==qx.core.Property.$$inherit)throw new Error("Inheritable property ',be="if(reg.hasListener(this, '",bf='Does not allow any arguments!',bg=')a[i].',bh="()",bi="var a=arguments[0] instanceof Array?arguments[0]:arguments;",bj='.$$properties.',bk='value !== null && value.$$type === "Theme"',bl="var reg=qx.event.Registration;",bm="())",bA='return null;',bz='qx.core.Assert.assertObject(value, msg) || true',by='");',bx='qx.core.Assert.assertString(value, msg) || true',bE='var pa=this.getLayoutParent();if(pa)computed=pa.',bD="if (value===undefined) value = parent.",bC='value !== null && value.$$type === "Class"',bB='qx.core.Assert.assertFunction(value, msg) || true',bG='!==undefined&&',bF='var computed, old;',bN='var backup=computed;',bO='}else{',bL="object",bM="$$init_",bJ="$$theme_",bK='if(computed===undefined)computed=null;',bH='qx.core.Assert.assertMap(value, msg) || true',bI='qx.core.Assert.assertNumber(value, msg) || true',bP='if((computed===undefined||computed===inherit)&&',bQ="reg.fireEvent(this, '",cf='Null value is not allowed!',ce='qx.core.Assert.assertInteger(value, msg) || true',ch="value",cg="rv:1.8.1",cj="shorthand",ci='qx.core.Assert.assertInstance(value, RegExp, msg) || true',cl='value !== null && value.type !== undefined',ck='value !== null && value.document',cd='throw new Error("Property ',cc="(!this.",cM='qx.core.Assert.assertBoolean(value, msg) || true',cN='if(a[i].',cO="toggle",cP="$$inherit_",cI='var prop=qx.core.Property;',cJ=" with incoming value '",cK="a=qx.lang.Array.fromShortHand(qx.lang.Array.fromArguments(a));",cL='if(computed===undefined||computed==inherit)computed=null;',cG="qx.core.Property",cH="is",b='Could not change or apply init value after constructing phase!';qx.Bootstrap.define(cG,{statics:{__lF:{"Boolean":cM,"String":bx,"Number":bI,"Integer":ce,"PositiveNumber":B,"PositiveInteger":w,"Error":cV,"RegExp":ci,"Object":bz,"Array":D,"Map":bH,"Function":bB,"Date":cR,"Node":J,"Element":k,"Document":e,"Window":ck,"Event":cl,"Class":bC,"Mixin":g,"Interface":p,"Theme":bk,"Color":c,"Decorator":u,"Font":d},__lG:{"Node":true,"Element":true,"Document":true,"Window":true,"Event":true},$$inherit:K,$$store:{runtime:{},user:{},theme:{},inherit:{},init:{},useinit:{}},$$method:{get:{},set:{},reset:{},init:{},refresh:{},setRuntime:{},resetRuntime:{},setThemed:{},resetThemed:{}},$$allowedKeys:{name:bs,dereference:bp,inheritable:bp,nullable:bp,themeable:bp,refine:bp,init:null,apply:bs,event:bs,check:null,transform:bs,deferredInit:bp,validate:null},$$allowedGroupKeys:{name:bs,group:bL,mode:bs,themeable:bp},$$inheritable:{},__lH:function(db){var dc=this.__lI(db);if(!dc.length){var dd=qx.lang.Function.empty;}else{dd=this.__lJ(dc);}db.prototype.$$refreshInheritables=dd;},__lI:function(de){var dg=[];while(de){var df=de.$$properties;if(df){for(var name in this.$$inheritable){if(df[name]&&df[name].inheritable){dg.push(name);}}}de=de.superclass;}return dg;},__lJ:function(dh){var dl=this.$$store.inherit;var dk=this.$$store.init;var dj=this.$$method.refresh;var di=[m,cX];for(var i=0,l=dh.length;i<l;i++){var name=dh[i];di.push(X,dl[name],cy,bD,dk[name],cy,cB,dj[name],S);}return new Function(di.join(cC));},attachRefreshInheritables:function(dm){dm.prototype.$$refreshInheritables=function(){qx.core.Property.__lH(dm);return this.$$refreshInheritables();};},attachMethods:function(dn,name,dp){dp.group?this.__lK(dn,dp,name):this.__lL(dn,dp,name);},__lK:function(dq,dr,name){var dy=qx.Bootstrap.firstUp(name);var dx=dq.prototype;var dz=dr.themeable===true;{};var dA=[];var du=[];if(dz){var ds=[];var dw=[];}var dv=bi;dA.push(dv);if(dz){ds.push(dv);}if(dr.mode==cj){var dt=cK;dA.push(dt);if(dz){ds.push(dt);}}for(var i=0,a=dr.group,l=a.length;i<l;i++){{};dA.push(cB,this.$$method.set[a[i]],bV,i,bS);du.push(cB,this.$$method.reset[a[i]],cw);if(dz){{};ds.push(cB,this.$$method.setThemed[a[i]],bV,i,bS);dw.push(cB,this.$$method.resetThemed[a[i]],cw);}}this.$$method.set[name]=cr+dy;dx[this.$$method.set[name]]=new Function(dA.join(cC));this.$$method.reset[name]=bq+dy;dx[this.$$method.reset[name]]=new Function(du.join(cC));if(dz){this.$$method.setThemed[name]=cq+dy;dx[this.$$method.setThemed[name]]=new Function(ds.join(cC));this.$$method.resetThemed[name]=bu+dy;dx[this.$$method.resetThemed[name]]=new Function(dw.join(cC));}},__lL:function(dB,dC,name){var dE=qx.Bootstrap.firstUp(name);var dG=dB.prototype;{};if(dC.dereference===undefined&&typeof dC.check===bs){dC.dereference=this.__lM(dC.check);}var dF=this.$$method;var dD=this.$$store;dD.runtime[name]=bb+name;dD.user[name]=F+name;dD.theme[name]=bJ+name;dD.init[name]=bM+name;dD.inherit[name]=cP+name;dD.useinit[name]=Y+name;dF.get[name]=bT+dE;dG[dF.get[name]]=function(){return qx.core.Property.executeOptimizedGetter(this,dB,name,bT);};dF.set[name]=cr+dE;dG[dF.set[name]]=function(dH){return qx.core.Property.executeOptimizedSetter(this,dB,name,cr,arguments);};dF.reset[name]=bq+dE;dG[dF.reset[name]]=function(){return qx.core.Property.executeOptimizedSetter(this,dB,name,bq);};if(dC.inheritable||dC.apply||dC.event||dC.deferredInit){dF.init[name]=co+dE;dG[dF.init[name]]=function(dI){return qx.core.Property.executeOptimizedSetter(this,dB,name,co,arguments);};}if(dC.inheritable){dF.refresh[name]=cD+dE;dG[dF.refresh[name]]=function(dJ){return qx.core.Property.executeOptimizedSetter(this,dB,name,cD,arguments);};}dF.setRuntime[name]=cp+dE;dG[dF.setRuntime[name]]=function(dK){return qx.core.Property.executeOptimizedSetter(this,dB,name,cp,arguments);};dF.resetRuntime[name]=bo+dE;dG[dF.resetRuntime[name]]=function(){return qx.core.Property.executeOptimizedSetter(this,dB,name,bo);};if(dC.themeable){dF.setThemed[name]=cq+dE;dG[dF.setThemed[name]]=function(dL){return qx.core.Property.executeOptimizedSetter(this,dB,name,cq,arguments);};dF.resetThemed[name]=bu+dE;dG[dF.resetThemed[name]]=function(){return qx.core.Property.executeOptimizedSetter(this,dB,name,bu);};}if(dC.check===z){dG[cO+dE]=new Function(bU+dF.set[name]+cc+dF.get[name]+bm);dG[cH+dE]=new Function(bU+dF.get[name]+bh);}},__lM:function(dM){return !!this.__lG[dM];},__lN:function(dN){return this.__lG[dN]||qx.Bootstrap.classIsDefined(dN)||(qx.Interface&&qx.Interface.isDefined(dN));},__lO:{0:b,1:T,2:da,3:bf,4:cf,5:L},error:function(dO,dP,dQ,dR,dS){var dT=dO.constructor.classname;var dU=n+dQ+I+dT+cW+this.$$method[dR][dQ]+cJ+dS+P;throw new Error(dU+(this.__lO[dP]||"Unknown reason: "+dP));},__lP:function(dV,dW,name,dX,dY,ea){var eb=this.$$method[dX][name];{dW[eb]=new Function(ch,dY.join(cC));};{};qx.Bootstrap.setDisplayName(dW[eb],dV.classname+A,eb);if(ea===undefined){return dV[eb]();}else{return dV[eb](ea[0]);}},executeOptimizedGetter:function(ec,ed,name,ee){var eg=ed.$$properties[name];var ei=ed.prototype;var ef=[];var eh=this.$$store;ef.push(cn,eh.runtime[name],bw);ef.push(br,eh.runtime[name],cv);if(eg.inheritable){ef.push(bt,eh.inherit[name],bw);ef.push(br,eh.inherit[name],cv);ef.push(cx);}ef.push(cn,eh.user[name],bw);ef.push(br,eh.user[name],cv);if(eg.themeable){ef.push(bt,eh.theme[name],bw);ef.push(br,eh.theme[name],cv);}if(eg.deferredInit&&eg.init===undefined){ef.push(bt,eh.init[name],bw);ef.push(br,eh.init[name],cv);}ef.push(cx);if(eg.init!==undefined){if(eg.inheritable){ef.push(j,eh.init[name],cv);if(eg.nullable){ef.push(s);}else if(eg.init!==undefined){ef.push(br,eh.init[name],cv);}else{ef.push(bd,name,cb,ed.classname,ca);}ef.push(h);}else{ef.push(br,eh.init[name],cv);}}else if(eg.inheritable||eg.nullable){ef.push(bA);}else{ef.push(cd,name,cb,ed.classname,ca);}return this.__lP(ec,ei,name,ee,ef);},executeOptimizedSetter:function(ej,ek,name,el,em){var er=ek.$$properties[name];var eq=ek.prototype;var eo=[];var en=el===cr||el===cq||el===cp||(el===co&&er.init===undefined);var ep=er.apply||er.event||er.inheritable;var es=this.__lQ(el,name);this.__lR(eo,er,name,el,en);if(en){this.__lS(eo,ek,er,name);}if(ep){this.__lT(eo,en,es,el);}if(er.inheritable){eo.push(o);}{};if(!ep){this.__lV(eo,name,el,en);}else{this.__lW(eo,er,name,el,en);}if(er.inheritable){this.__lX(eo,er,name,el);}else if(ep){this.__lY(eo,er,name,el);}if(ep){this.__ma(eo,er,name);if(er.inheritable&&eq._getChildren){this.__mb(eo,name);}}if(en){eo.push(G);}return this.__lP(ej,eq,name,el,eo,em);},__lQ:function(et,name){if(et===cp||et===bo){var eu=this.$$store.runtime[name];}else if(et===cq||et===bu){eu=this.$$store.theme[name];}else if(et===co){eu=this.$$store.init[name];}else{eu=this.$$store.user[name];}return eu;},__lR:function(ev,ew,name,ex,ey){{if(!ew.nullable||ew.check||ew.inheritable){ev.push(cI);}if(ex===cr){ev.push(Q,name,t,ex,U);}};},__lS:function(ez,eA,eB,name){if(eB.transform){ez.push(q,eB.transform,bW);}if(eB.validate){if(typeof eB.validate===bs){ez.push(cs,eB.validate,bW);}else if(eB.validate instanceof Function){ez.push(eA.classname,bj,name);ez.push(cS);}}},__lT:function(eC,eD,eE,eF){var eG=(eF===bq||eF===bu||eF===bo);if(eD){eC.push(cn,eE,f);}else if(eG){eC.push(cn,eE,v);}},__lU:undefined,__lV:function(eH,name,eI,eJ){if(eI===cp){eH.push(cs,this.$$store.runtime[name],ct);}else if(eI===bo){eH.push(cn,this.$$store.runtime[name],bw);eH.push(cm,this.$$store.runtime[name],cv);}else if(eI===cr){eH.push(cs,this.$$store.user[name],ct);}else if(eI===bq){eH.push(cn,this.$$store.user[name],bw);eH.push(cm,this.$$store.user[name],cv);}else if(eI===cq){eH.push(cs,this.$$store.theme[name],ct);}else if(eI===bu){eH.push(cn,this.$$store.theme[name],bw);eH.push(cm,this.$$store.theme[name],cv);}else if(eI===co&&eJ){eH.push(cs,this.$$store.init[name],ct);}},__lW:function(eK,eL,name,eM,eN){if(eL.inheritable){eK.push(R,this.$$store.inherit[name],cv);}else{eK.push(bF);}eK.push(cn,this.$$store.runtime[name],bn);if(eM===cp){eK.push(cu,this.$$store.runtime[name],ct);}else if(eM===bo){eK.push(cm,this.$$store.runtime[name],cv);eK.push(cn,this.$$store.user[name],bw);eK.push(cu,this.$$store.user[name],cv);eK.push(bt,this.$$store.theme[name],bw);eK.push(cu,this.$$store.theme[name],cv);eK.push(bt,this.$$store.init[name],bn);eK.push(cu,this.$$store.init[name],cv);eK.push(cs,this.$$store.useinit[name],cA);eK.push(bv);}else{eK.push(cF,this.$$store.runtime[name],cv);if(eM===cr){eK.push(cs,this.$$store.user[name],ct);}else if(eM===bq){eK.push(cm,this.$$store.user[name],cv);}else if(eM===cq){eK.push(cs,this.$$store.theme[name],ct);}else if(eM===bu){eK.push(cm,this.$$store.theme[name],cv);}else if(eM===co&&eN){eK.push(cs,this.$$store.init[name],ct);}}eK.push(bv);eK.push(bt,this.$$store.user[name],bn);if(eM===cr){if(!eL.inheritable){eK.push(cz,this.$$store.user[name],cv);}eK.push(cu,this.$$store.user[name],ct);}else if(eM===bq){if(!eL.inheritable){eK.push(cz,this.$$store.user[name],cv);}eK.push(cm,this.$$store.user[name],cv);eK.push(cn,this.$$store.runtime[name],bw);eK.push(cu,this.$$store.runtime[name],cv);eK.push(cn,this.$$store.theme[name],bw);eK.push(cu,this.$$store.theme[name],cv);eK.push(bt,this.$$store.init[name],bn);eK.push(cu,this.$$store.init[name],cv);eK.push(cs,this.$$store.useinit[name],cA);eK.push(bv);}else{if(eM===cp){eK.push(cu,this.$$store.runtime[name],ct);}else if(eL.inheritable){eK.push(cu,this.$$store.user[name],cv);}else{eK.push(cF,this.$$store.user[name],cv);}if(eM===cq){eK.push(cs,this.$$store.theme[name],ct);}else if(eM===bu){eK.push(cm,this.$$store.theme[name],cv);}else if(eM===co&&eN){eK.push(cs,this.$$store.init[name],ct);}}eK.push(bv);if(eL.themeable){eK.push(bt,this.$$store.theme[name],bn);if(!eL.inheritable){eK.push(cz,this.$$store.theme[name],cv);}if(eM===cp){eK.push(cu,this.$$store.runtime[name],ct);}else if(eM===cr){eK.push(cu,this.$$store.user[name],ct);}else if(eM===cq){eK.push(cu,this.$$store.theme[name],ct);}else if(eM===bu){eK.push(cm,this.$$store.theme[name],cv);eK.push(cn,this.$$store.init[name],bn);eK.push(cu,this.$$store.init[name],cv);eK.push(cs,this.$$store.useinit[name],cA);eK.push(bv);}else if(eM===co){if(eN){eK.push(cs,this.$$store.init[name],ct);}eK.push(cu,this.$$store.theme[name],cv);}else if(eM===cD){eK.push(cu,this.$$store.theme[name],cv);}eK.push(bv);}eK.push(bt,this.$$store.useinit[name],E);if(!eL.inheritable){eK.push(cz,this.$$store.init[name],cv);}if(eM===co){if(eN){eK.push(cu,this.$$store.init[name],ct);}else{eK.push(cu,this.$$store.init[name],cv);}}else if(eM===cr||eM===cp||eM===cq||eM===cD){eK.push(cm,this.$$store.useinit[name],cv);if(eM===cp){eK.push(cu,this.$$store.runtime[name],ct);}else if(eM===cr){eK.push(cu,this.$$store.user[name],ct);}else if(eM===cq){eK.push(cu,this.$$store.theme[name],ct);}else if(eM===cD){eK.push(cu,this.$$store.init[name],cv);}}eK.push(bv);if(eM===cr||eM===cp||eM===cq||eM===co){eK.push(cQ);if(eM===cp){eK.push(cu,this.$$store.runtime[name],ct);}else if(eM===cr){eK.push(cu,this.$$store.user[name],ct);}else if(eM===cq){eK.push(cu,this.$$store.theme[name],ct);}else if(eM===co){if(eN){eK.push(cu,this.$$store.init[name],ct);}else{eK.push(cu,this.$$store.init[name],cv);}eK.push(cs,this.$$store.useinit[name],cA);}eK.push(bv);}},__lX:function(eO,eP,name,eQ){eO.push(C);if(eQ===cD){eO.push(V);}else{eO.push(bE,this.$$store.inherit[name],cv);}eO.push(bP);eO.push(cs,this.$$store.init[name],bG);eO.push(cs,this.$$store.init[name],bR);eO.push(cu,this.$$store.init[name],cv);eO.push(cs,this.$$store.useinit[name],cA);eO.push(bO);eO.push(cm,this.$$store.useinit[name],bc);eO.push(bv);eO.push(bY);eO.push(N);eO.push(ba,this.$$store.inherit[name],cv);eO.push(bv);eO.push(O);eO.push(cm,this.$$store.inherit[name],cv);eO.push(r,this.$$store.inherit[name],cU);eO.push(bN);if(eP.init!==undefined&&eQ!==co){eO.push(cE,this.$$store.init[name],cy);}else{eO.push(bX);}eO.push(cL);},__lY:function(eR,eS,name,eT){if(eT!==cr&&eT!==cp&&eT!==cq){eR.push(bK);}eR.push(bY);if(eS.init!==undefined&&eT!==co){eR.push(cE,this.$$store.init[name],cy);}else{eR.push(bX);}},__ma:function(eU,eV,name){if(eV.apply){eU.push(cs,eV.apply,H,name,by);}if(eV.event){eU.push(bl,be,eV.event,x,bQ,eV.event,W,y);}},__mb:function(eW,name){eW.push(cT);eW.push(cN,this.$$method.refresh[name],bg,this.$$method.refresh[name],cY);eW.push(bv);}},defer:function(eX){var fa=navigator.userAgent.indexOf(M)!=-1;var eY=navigator.userAgent.indexOf(cg)!=-1;if(fa||eY){eX.__lM=eX.__lN;}}});})();(function(){var q="[Class ",p="]",o="$$init_",n="toString",m="constructor",k="singleton",j=".prototype",h="extend",g="Class",f="destruct",c="qx.Class",e=".",d="static",b="qx.event.type.Data";qx.Bootstrap.define(c,{statics:{define:function(name,r){if(!r){var r={};}if(r.include&&!(r.include instanceof Array)){r.include=[r.include];}if(r.implement&&!(r.implement instanceof Array)){r.implement=[r.implement];}var s=false;if(!r.hasOwnProperty(h)&&!r.type){r.type=d;s=true;}{};var t=this.__bX(name,r.type,r.extend,r.statics,r.construct,r.destruct,r.include);if(r.extend){if(r.properties){this.__ca(t,r.properties,true);}if(r.members){this.__cc(t,r.members,true,true,false);}if(r.events){this.__bY(t,r.events,true);}if(r.include){for(var i=0,l=r.include.length;i<l;i++){this.__cg(t,r.include[i],false);}}}if(r.settings){for(var u in r.settings){qx.core.Setting.define(u,r.settings[u]);}}if(r.variants){for(var u in r.variants){qx.core.Variant.define(u,r.variants[u].allowedValues,r.variants[u].defaultValue);}}if(r.implement){for(var i=0,l=r.implement.length;i<l;i++){this.__ce(t,r.implement[i]);}}{};if(r.defer){r.defer.self=t;r.defer(t,t.prototype,{add:function(name,v){var w={};w[name]=v;qx.Class.__ca(t,w,true);}});}return t;},undefine:function(name){delete this.$$registry[name];var x=name.split(e);var z=[window];for(var i=0;i<x.length;i++){z.push(z[i][x[i]]);}for(var i=z.length-1;i>=1;i--){var y=z[i];var parent=z[i-1];if(qx.Bootstrap.isFunction(y)||qx.Bootstrap.objectGetLength(y)===0){delete parent[x[i-1]];}else{break;}}},isDefined:qx.Bootstrap.classIsDefined,getTotalNumber:function(){return qx.Bootstrap.objectGetLength(this.$$registry);},getByName:qx.Bootstrap.getByName,include:function(A,B){{};qx.Class.__cg(A,B,false);},patch:function(C,D){{};qx.Class.__cg(C,D,true);},isSubClassOf:function(E,F){if(!E){return false;}if(E==F){return true;}if(E.prototype instanceof F){return true;}return false;},getPropertyDefinition:qx.Bootstrap.getPropertyDefinition,getProperties:function(G){var H=[];while(G){if(G.$$properties){H.push.apply(H,qx.Bootstrap.getKeys(G.$$properties));}G=G.superclass;}return H;},getByProperty:function(I,name){while(I){if(I.$$properties&&I.$$properties[name]){return I;}I=I.superclass;}return null;},hasProperty:qx.Bootstrap.hasProperty,getEventType:qx.Bootstrap.getEventType,supportsEvent:qx.Bootstrap.supportsEvent,hasOwnMixin:function(J,K){return J.$$includes&&J.$$includes.indexOf(K)!==-1;},getByMixin:function(L,M){var N,i,l;while(L){if(L.$$includes){N=L.$$flatIncludes;for(i=0,l=N.length;i<l;i++){if(N[i]===M){return L;}}}L=L.superclass;}return null;},getMixins:qx.Bootstrap.getMixins,hasMixin:function(O,P){return !!this.getByMixin(O,P);},hasOwnInterface:function(Q,R){return Q.$$implements&&Q.$$implements.indexOf(R)!==-1;},getByInterface:qx.Bootstrap.getByInterface,getInterfaces:function(S){var T=[];while(S){if(S.$$implements){T.push.apply(T,S.$$flatImplements);}S=S.superclass;}return T;},hasInterface:qx.Bootstrap.hasInterface,implementsInterface:function(U,V){var W=U.constructor;if(this.hasInterface(W,V)){return true;}try{qx.Interface.assertObject(U,V);return true;}catch(X){}try{qx.Interface.assert(W,V,false);return true;}catch(Y){}return false;},getInstance:function(){if(!this.$$instance){this.$$allowconstruct=true;this.$$instance=new this;delete this.$$allowconstruct;}return this.$$instance;},genericToString:function(){return q+this.classname+p;},$$registry:qx.Bootstrap.$$registry,__bT:null,__bU:null,__bV:function(){},__bW:function(){},__bX:function(name,ba,bb,bc,bd,be,bf){var bi;if(!bb&&true){bi=bc||{};qx.Bootstrap.setDisplayNames(bi,name);}else{var bi={};if(bb){if(!bd){bd=this.__ch();}if(this.__cj(bb,bf)){bi=this.__ck(bd,name,ba);}else{bi=bd;}if(ba===k){bi.getInstance=this.getInstance;}qx.Bootstrap.setDisplayName(bd,name,m);}if(bc){qx.Bootstrap.setDisplayNames(bc,name);var bj;for(var i=0,a=qx.Bootstrap.getKeys(bc),l=a.length;i<l;i++){bj=a[i];var bg=bc[bj];{bi[bj]=bg;};}}}var bh=qx.Bootstrap.createNamespace(name,bi);bi.name=bi.classname=name;bi.basename=bh;bi.$$type=g;if(ba){bi.$$classtype=ba;}if(!bi.hasOwnProperty(n)){bi.toString=this.genericToString;}if(bb){qx.Bootstrap.extendClass(bi,bd,bb,name,bh);if(be){{};bi.$$destructor=be;qx.Bootstrap.setDisplayName(be,name,f);}}this.$$registry[name]=bi;return bi;},__bY:function(bk,bl,bm){var bn,bn;{};if(bk.$$events){for(var bn in bl){bk.$$events[bn]=bl[bn];}}else{bk.$$events=bl;}},__ca:function(bo,bp,bq){var br;if(bq===undefined){bq=false;}var bs=bo.prototype;for(var name in bp){br=bp[name];{};br.name=name;if(!br.refine){if(bo.$$properties===undefined){bo.$$properties={};}bo.$$properties[name]=br;}if(br.init!==undefined){bo.prototype[o+name]=br.init;}if(br.event!==undefined){var event={};event[br.event]=b;this.__bY(bo,event,bq);}if(br.inheritable){qx.core.Property.$$inheritable[name]=true;if(!bs.$$refreshInheritables){qx.core.Property.attachRefreshInheritables(bo);}}if(!br.refine){qx.core.Property.attachMethods(bo,name,br);}}},__cb:null,__cc:function(bt,bu,bv,bw,bx){var by=bt.prototype;var bA,bz;qx.Bootstrap.setDisplayNames(bu,bt.classname+j);for(var i=0,a=qx.Bootstrap.getKeys(bu),l=a.length;i<l;i++){bA=a[i];bz=bu[bA];{};if(bw!==false&&bz instanceof Function&&bz.$$type==null){if(bx==true){bz=this.__cd(bz,by[bA]);}else{if(by[bA]){bz.base=by[bA];}bz.self=bt;}{};}by[bA]=bz;}},__cd:function(bB,bC){if(bC){return function(){var bE=bB.base;bB.base=bC;var bD=bB.apply(this,arguments);bB.base=bE;return bD;};}else{return bB;}},__ce:function(bF,bG){{};var bH=qx.Interface.flatten([bG]);if(bF.$$implements){bF.$$implements.push(bG);bF.$$flatImplements.push.apply(bF.$$flatImplements,bH);}else{bF.$$implements=[bG];bF.$$flatImplements=bH;}},__cf:function(bI){var name=bI.classname;var bJ=this.__ck(bI,name,bI.$$classtype);for(var i=0,a=qx.Bootstrap.getKeys(bI),l=a.length;i<l;i++){bK=a[i];bJ[bK]=bI[bK];}bJ.prototype=bI.prototype;var bM=bI.prototype;for(var i=0,a=qx.Bootstrap.getKeys(bM),l=a.length;i<l;i++){bK=a[i];var bN=bM[bK];if(bN&&bN.self==bI){bN.self=bJ;}}for(var bK in this.$$registry){var bL=this.$$registry[bK];if(!bL){continue;}if(bL.base==bI){bL.base=bJ;}if(bL.superclass==bI){bL.superclass=bJ;}if(bL.$$original){if(bL.$$original.base==bI){bL.$$original.base=bJ;}if(bL.$$original.superclass==bI){bL.$$original.superclass=bJ;}}}qx.Bootstrap.createNamespace(name,bJ);this.$$registry[name]=bJ;return bJ;},__cg:function(bO,bP,bQ){{};if(this.hasMixin(bO,bP)){return;}var bT=bO.$$original;if(bP.$$constructor&&!bT){bO=this.__cf(bO);}var bS=qx.Mixin.flatten([bP]);var bR;for(var i=0,l=bS.length;i<l;i++){bR=bS[i];if(bR.$$events){this.__bY(bO,bR.$$events,bQ);}if(bR.$$properties){this.__ca(bO,bR.$$properties,bQ);}if(bR.$$members){this.__cc(bO,bR.$$members,bQ,bQ,bQ);}}if(bO.$$includes){bO.$$includes.push(bP);bO.$$flatIncludes.push.apply(bO.$$flatIncludes,bS);}else{bO.$$includes=[bP];bO.$$flatIncludes=bS;}},__ch:function(){function bU(){bU.base.apply(this,arguments);}return bU;},__ci:function(){return function(){};},__cj:function(bV,bW){{};if(bV&&bV.$$includes){var bX=bV.$$flatIncludes;for(var i=0,l=bX.length;i<l;i++){if(bX[i].$$constructor){return true;}}}if(bW){var bY=qx.Mixin.flatten(bW);for(var i=0,l=bY.length;i<l;i++){if(bY[i].$$constructor){return true;}}}return false;},__ck:function(ca,name,cb){var cc;var cd=function(){var cg=cd;{};var cf=cg.$$original.apply(this,arguments);if(cg.$$includes){var ce=cg.$$flatIncludes;for(var i=0,l=ce.length;i<l;i++){if(ce[i].$$constructor){ce[i].$$constructor.apply(this,arguments);}}}{};return cf;};{};cd.$$original=ca;ca.wrapper=cd;return cd;}},defer:function(){var ch,ci,cj;{};}});})();(function(){var s="gecko",r="1.9.0.0",q=".",p="[object Opera]",o="function",n="[^\\.0-9]",m="525.26",l="",k="mshtml",j="AppleWebKit/",d="unknown",i="9.6.0",g="4.0",c="Gecko",b="opera",f="webkit",e="0.0.0",h="8.0",a="qx.bom.client.Engine";qx.Bootstrap.define(a,{statics:{NAME:"",FULLVERSION:"0.0.0",VERSION:0.0,OPERA:false,WEBKIT:false,GECKO:false,MSHTML:false,UNKNOWN_ENGINE:false,UNKNOWN_VERSION:false,DOCUMENT_MODE:null,__et:function(){var t=d;var x=e;var w=window.navigator.userAgent;var z=false;var v=false;if(window.opera&&Object.prototype.toString.call(window.opera)==p){t=b;this.OPERA=true;if(/Opera[\s\/]([0-9]+)\.([0-9])([0-9]*)/.test(w)){x=RegExp.$1+q+RegExp.$2;if(RegExp.$3!=l){x+=q+RegExp.$3;}}else{v=true;x=i;}}else if(window.navigator.userAgent.indexOf(j)!=-1){t=f;this.WEBKIT=true;if(/AppleWebKit\/([^ ]+)/.test(w)){x=RegExp.$1;var y=RegExp(n).exec(x);if(y){x=x.slice(0,y.index);}}else{v=true;x=m;}}else if(window.controllers&&window.navigator.product===c){t=s;this.GECKO=true;if(/rv\:([^\);]+)(\)|;)/.test(w)){x=RegExp.$1;}else{v=true;x=r;}}else if(window.navigator.cpuClass&&/MSIE\s+([^\);]+)(\)|;)/.test(w)){t=k;x=RegExp.$1;if(document.documentMode){this.DOCUMENT_MODE=document.documentMode;}if(x<8&&/Trident\/([^\);]+)(\)|;)/.test(w)){if(RegExp.$1===g){x=h;}}this.MSHTML=true;}else{var u=window.qxFail;if(u&&typeof u===o){var t=u();if(t.NAME&&t.FULLVERSION){t=t.NAME;this[t.toUpperCase()]=true;x=t.FULLVERSION;}}else{z=true;v=true;x=r;t=s;this.GECKO=true;qx.Bootstrap.warn("Unsupported client: "+w+"! Assumed gecko version 1.9.0.0 (Firefox 3.0).");}}this.UNKNOWN_ENGINE=z;this.UNKNOWN_VERSION=v;this.NAME=t;this.FULLVERSION=x;this.VERSION=parseFloat(x);}},defer:function(A){A.__et();}});})();(function(){var x="off",w="on",u="|",t="default",s="object",r="&",q="qx.aspects",p="qx.mobile.nativescroll",o="qx.mobile.emulatetouch",n="$",e="qx.allowUrlVariants",m="qx.debug",h="qx.client",c="qx.dynlocale",b="webkit",g="qxvariant",f="opera",j=":",a="qx.core.Variant",k="mshtml",d="gecko";qx.Bootstrap.define(a,{statics:{__kX:{},__kY:{},compilerIsSet:function(){return true;},define:function(y,z,A){{};if(!this.__kX[y]){this.__kX[y]={};}else{}this.__kX[y].allowedValues=z;this.__kX[y].defaultValue=A;},get:function(B){var C=this.__kX[B];{};if(C.value!==undefined){return C.value;}return C.defaultValue;},__la:function(){if(window.qxvariants){for(var D in qxvariants){{};if(!this.__kX[D]){this.__kX[D]={};}this.__kX[D].value=qxvariants[D];}window.qxvariants=undefined;try{delete window.qxvariants;}catch(E){}this.__lb(this.__kX);}},__lb:function(){if(qx.core.Setting.get(e)!=true){return;}var F=document.location.search.slice(1).split(r);for(var i=0;i<F.length;i++){var G=F[i].split(j);if(G.length!=3||G[0]!=g){continue;}var H=G[1];if(!this.__kX[H]){this.__kX[H]={};}this.__kX[H].value=decodeURIComponent(G[2]);}},select:function(I,J){{};for(var K in J){if(this.isSet(I,K)){return J[K];}}if(J[t]!==undefined){return J[t];}{};},isSet:function(L,M){var N=L+n+M;if(this.__kY[N]!==undefined){return this.__kY[N];}var P=false;if(M.indexOf(u)<0){P=this.get(L)===M;}else{var O=M.split(u);for(var i=0,l=O.length;i<l;i++){if(this.get(L)===O[i]){P=true;break;}}}this.__kY[N]=P;return P;},__lc:function(v){return typeof v===s&&v!==null&&v instanceof Array;},__ld:function(v){return typeof v===s&&v!==null&&!(v instanceof Array);},__le:function(Q,R){for(var i=0,l=Q.length;i<l;i++){if(Q[i]==R){return true;}}return false;}},defer:function(S){S.define(h,[d,k,f,b],qx.bom.client.Engine.NAME);S.define(m,[w,x],w);S.define(q,[w,x],x);S.define(c,[w,x],w);S.define(o,[w,x],x);S.define(p,[w,x],x);S.__la();}});})();(function(){var d="qx.dom.Node",c="qx.client",b="";qx.Class.define(d,{statics:{ELEMENT:1,ATTRIBUTE:2,TEXT:3,CDATA_SECTION:4,ENTITY_REFERENCE:5,ENTITY:6,PROCESSING_INSTRUCTION:7,COMMENT:8,DOCUMENT:9,DOCUMENT_TYPE:10,DOCUMENT_FRAGMENT:11,NOTATION:12,getDocument:function(e){return e.nodeType===this.DOCUMENT?e:e.ownerDocument||e.document;},getWindow:qx.core.Variant.select(c,{"mshtml":function(f){if(f.nodeType==null){return f;}if(f.nodeType!==this.DOCUMENT){f=f.ownerDocument;}return f.parentWindow;},"default":function(g){if(g.nodeType==null){return g;}if(g.nodeType!==this.DOCUMENT){g=g.ownerDocument;}return g.defaultView;}}),getDocumentElement:function(h){return this.getDocument(h).documentElement;},getBodyElement:function(j){return this.getDocument(j).body;},isNode:function(k){return !!(k&&k.nodeType!=null);},isElement:function(l){return !!(l&&l.nodeType===this.ELEMENT);},isDocument:function(m){return !!(m&&m.nodeType===this.DOCUMENT);},isText:function(n){return !!(n&&n.nodeType===this.TEXT);},isWindow:function(o){return !!(o&&o.history&&o.location&&o.document);},isNodeName:function(p,q){if(!q||!p||!p.nodeName){return false;}return q.toLowerCase()==qx.dom.Node.getName(p);},getName:function(r){if(!r||!r.nodeName){return null;}return r.nodeName.toLowerCase();},getText:function(s){if(!s||!s.nodeType){return null;}switch(s.nodeType){case 1:var i,a=[],t=s.childNodes,length=t.length;for(i=0;i<length;i++){a[i]=this.getText(t[i]);}return a.join(b);case 2:return s.nodeValue;break;case 3:return s.nodeValue;break;}return null;},isBlockNode:function(u){if(!qx.dom.Node.isElement(u)){return false;}u=qx.dom.Node.getName(u);return /^(body|form|textarea|fieldset|ul|ol|dl|dt|dd|li|div|hr|p|h[1-6]|quote|pre|table|thead|tbody|tfoot|tr|td|th|iframe|address|blockquote)$/.test(u);}}});})();(function(){var j="on",i="qx.client",h="gecko",g="function",f="HTMLEvents",d="mousedown",c="qx.bom.Event",b="return;",a="mouseover";qx.Class.define(c,{statics:{addNativeListener:function(k,l,m,n){if(k.addEventListener){k.addEventListener(l,m,!!n);}else if(k.attachEvent){k.attachEvent(j+l,m);}},removeNativeListener:function(o,p,q,r){if(o.removeEventListener){o.removeEventListener(p,q,!!r);}else if(o.detachEvent){try{o.detachEvent(j+p,q);}catch(e){if(e.number!==-2146828218){throw e;}}}},getTarget:function(e){return e.target||e.srcElement;},getRelatedTarget:function(e){if(e.relatedTarget!==undefined){if(qx.core.Variant.isSet(i,h)){try{e.relatedTarget&&e.relatedTarget.nodeType;}catch(e){return null;}}return e.relatedTarget;}else if(e.fromElement!==undefined&&e.type===a){return e.fromElement;}else if(e.toElement!==undefined){return e.toElement;}else{return null;}},preventDefault:function(e){if(e.preventDefault){if(qx.core.Variant.isSet(i,h)&&qx.bom.client.Engine.VERSION>=1.9&&e.type==d&&e.button==2){return;}e.preventDefault();if(qx.core.Variant.isSet(i,h)&&qx.bom.client.Engine.VERSION<1.9){try{e.keyCode=0;}catch(s){}}}else{try{e.keyCode=0;}catch(t){}e.returnValue=false;}},stopPropagation:function(e){if(e.stopPropagation){e.stopPropagation();}else{e.cancelBubble=true;}},fire:function(u,v){if(document.createEvent){var w=document.createEvent(f);w.initEvent(v,true,true);return !u.dispatchEvent(w);}else{var w=document.createEventObject();return u.fireEvent(j+v,w);}},supportsEvent:qx.core.Variant.select(i,{"webkit":function(x,y){return x.hasOwnProperty(j+y);},"default":function(z,A){var B=j+A;var C=(B in z);if(!C){C=typeof z[B]==g;if(!C&&z.setAttribute){z.setAttribute(B,b);C=typeof z[B]==g;z.removeAttribute(B);}}return C;}})}});})();(function(){var r="|bubble",q="|capture",p="|",o="",n="_",m="unload",k="UNKNOWN_",j="__fs",h="c",g="DOM_",c="__ft",f="WIN_",e="QX_",b="qx.event.Manager",a="capture",d="DOCUMENT_";qx.Class.define(b,{extend:Object,construct:function(s,t){this.__fo=s;this.__fp=qx.core.ObjectRegistry.toHashCode(s);this.__fq=t;if(s.qx!==qx){var self=this;qx.bom.Event.addNativeListener(s,m,qx.event.GlobalError.observeMethod(function(){qx.bom.Event.removeNativeListener(s,m,arguments.callee);self.dispose();}));}this.__fr={};this.__fs={};this.__ft={};this.__fu={};},statics:{__fv:0,getNextUniqueId:function(){return (this.__fv++)+o;}},members:{__fq:null,__fr:null,__ft:null,__fw:null,__fs:null,__fu:null,__fo:null,__fp:null,getWindow:function(){return this.__fo;},getWindowId:function(){return this.__fp;},getHandler:function(u){var v=this.__fs[u.classname];if(v){return v;}return this.__fs[u.classname]=new u(this);},getDispatcher:function(w){var x=this.__ft[w.classname];if(x){return x;}return this.__ft[w.classname]=new w(this,this.__fq);},getListeners:function(y,z,A){var B=y.$$hash||qx.core.ObjectRegistry.toHashCode(y);var D=this.__fr[B];if(!D){return null;}var E=z+(A?q:r);var C=D[E];return C?C.concat():null;},serializeListeners:function(F){var M=F.$$hash||qx.core.ObjectRegistry.toHashCode(F);var O=this.__fr[M];var K=[];if(O){var I,N,G,J,L;for(var H in O){I=H.indexOf(p);N=H.substring(0,I);G=H.charAt(I+1)==h;J=O[H];for(var i=0,l=J.length;i<l;i++){L=J[i];K.push({self:L.context,handler:L.handler,type:N,capture:G});}}}return K;},toggleAttachedEvents:function(P,Q){var V=P.$$hash||qx.core.ObjectRegistry.toHashCode(P);var X=this.__fr[V];if(X){var S,W,R,T;for(var U in X){S=U.indexOf(p);W=U.substring(0,S);R=U.charCodeAt(S+1)===99;T=X[U];if(Q){this.__fx(P,W,R);}else{this.__fy(P,W,R);}}}},hasListener:function(Y,ba,bb){{};var bc=Y.$$hash||qx.core.ObjectRegistry.toHashCode(Y);var be=this.__fr[bc];if(!be){return false;}var bf=ba+(bb?q:r);var bd=be[bf];return bd&&bd.length>0;},importListeners:function(bg,bh){{};var bn=bg.$$hash||qx.core.ObjectRegistry.toHashCode(bg);var bo=this.__fr[bn]={};var bk=qx.event.Manager;for(var bi in bh){var bl=bh[bi];var bm=bl.type+(bl.capture?q:r);var bj=bo[bm];if(!bj){bj=bo[bm]=[];this.__fx(bg,bl.type,bl.capture);}bj.push({handler:bl.listener,context:bl.self,unique:bl.unique||(bk.__fv++)+o});}},addListener:function(bp,bq,br,self,bs){var bw;{};var bx=bp.$$hash||qx.core.ObjectRegistry.toHashCode(bp);var bz=this.__fr[bx];if(!bz){bz=this.__fr[bx]={};}var bv=bq+(bs?q:r);var bu=bz[bv];if(!bu){bu=bz[bv]=[];}if(bu.length===0){this.__fx(bp,bq,bs);}var by=(qx.event.Manager.__fv++)+o;var bt={handler:br,context:self,unique:by};bu.push(bt);return bv+p+by;},findHandler:function(bA,bB){var bN=false,bF=false,bO=false,bC=false;var bL;if(bA.nodeType===1){bN=true;bL=g+bA.tagName.toLowerCase()+n+bB;}else if(bA.nodeType===9){bC=true;bL=d+bB;}else if(bA==this.__fo){bF=true;bL=f+bB;}else if(bA.classname){bO=true;bL=e+bA.classname+n+bB;}else{bL=k+bA+n+bB;}var bH=this.__fu;if(bH[bL]){return bH[bL];}var bK=this.__fq.getHandlers();var bG=qx.event.IEventHandler;var bI,bJ,bE,bD;for(var i=0,l=bK.length;i<l;i++){bI=bK[i];bE=bI.SUPPORTED_TYPES;if(bE&&!bE[bB]){continue;}bD=bI.TARGET_CHECK;if(bD){var bM=false;if(bN&&((bD&bG.TARGET_DOMNODE)!=0)){bM=true;}else if(bF&&((bD&bG.TARGET_WINDOW)!=0)){bM=true;}else if(bO&&((bD&bG.TARGET_OBJECT)!=0)){bM=true;}else if(bC&&((bD&bG.TARGET_DOCUMENT)!=0)){bM=true;}if(!bM){continue;}}bJ=this.getHandler(bK[i]);if(bI.IGNORE_CAN_HANDLE||bJ.canHandleEvent(bA,bB)){bH[bL]=bJ;return bJ;}}return null;},__fx:function(bP,bQ,bR){var bS=this.findHandler(bP,bQ);if(bS){bS.registerEvent(bP,bQ,bR);return;}{};},removeListener:function(bT,bU,bV,self,bW){var cb;{};var cc=bT.$$hash||qx.core.ObjectRegistry.toHashCode(bT);var cd=this.__fr[cc];if(!cd){return false;}var bX=bU+(bW?q:r);var bY=cd[bX];if(!bY){return false;}var ca;for(var i=0,l=bY.length;i<l;i++){ca=bY[i];if(ca.handler===bV&&ca.context===self){qx.lang.Array.removeAt(bY,i);if(bY.length==0){this.__fy(bT,bU,bW);}return true;}}return false;},removeListenerById:function(ce,cf){var cl;{};var cj=cf.split(p);var co=cj[0];var cg=cj[1].charCodeAt(0)==99;var cn=cj[2];var cm=ce.$$hash||qx.core.ObjectRegistry.toHashCode(ce);var cp=this.__fr[cm];if(!cp){return false;}var ck=co+(cg?q:r);var ci=cp[ck];if(!ci){return false;}var ch;for(var i=0,l=ci.length;i<l;i++){ch=ci[i];if(ch.unique===cn){qx.lang.Array.removeAt(ci,i);if(ci.length==0){this.__fy(ce,co,cg);}return true;}}return false;},removeAllListeners:function(cq){var cu=cq.$$hash||qx.core.ObjectRegistry.toHashCode(cq);var cw=this.__fr[cu];if(!cw){return false;}var cs,cv,cr;for(var ct in cw){if(cw[ct].length>0){cs=ct.split(p);cv=cs[0];cr=cs[1]===a;this.__fy(cq,cv,cr);}}delete this.__fr[cu];return true;},deleteAllListeners:function(cx){delete this.__fr[cx];},__fy:function(cy,cz,cA){var cB=this.findHandler(cy,cz);if(cB){cB.unregisterEvent(cy,cz,cA);return;}{};},dispatchEvent:function(cC,event){var cH;{};var cI=event.getType();if(!event.getBubbles()&&!this.hasListener(cC,cI)){qx.event.Pool.getInstance().poolObject(event);return true;}if(!event.getTarget()){event.setTarget(cC);}var cG=this.__fq.getDispatchers();var cF;var cE=false;for(var i=0,l=cG.length;i<l;i++){cF=this.getDispatcher(cG[i]);if(cF.canDispatchEvent(cC,event,cI)){cF.dispatchEvent(cC,event,cI);cE=true;break;}}if(!cE){{};return true;}var cD=event.getDefaultPrevented();qx.event.Pool.getInstance().poolObject(event);return !cD;},dispose:function(){this.__fq.removeManager(this);qx.util.DisposeUtil.disposeMap(this,j);qx.util.DisposeUtil.disposeMap(this,c);this.__fr=this.__fo=this.__fw=null;this.__fq=this.__fu=null;}}});})();(function(){var g="mshtml",f="qx.client",e="[object Array]",d="qx.lang.Array",c="qx",b="number",a="string";qx.Class.define(d,{statics:{toArray:function(h,j){return this.cast(h,Array,j);},cast:function(k,m,n){if(k.constructor===m){return k;}if(qx.Class.hasInterface(k,qx.data.IListData)){var k=k.toArray();}var o=new m;if(qx.core.Variant.isSet(f,g)){if(k.item){for(var i=n||0,l=k.length;i<l;i++){o.push(k[i]);}return o;}}if(Object.prototype.toString.call(k)===e&&n==null){o.push.apply(o,k);}else{o.push.apply(o,Array.prototype.slice.call(k,n||0));}return o;},fromArguments:function(p,q){return Array.prototype.slice.call(p,q||0);},fromCollection:function(r){if(qx.core.Variant.isSet(f,g)){if(r.item){var s=[];for(var i=0,l=r.length;i<l;i++){s[i]=r[i];}return s;}}return Array.prototype.slice.call(r,0);},fromShortHand:function(t){var v=t.length;var u=qx.lang.Array.clone(t);switch(v){case 1:u[1]=u[2]=u[3]=u[0];break;case 2:u[2]=u[0];case 3:u[3]=u[1];}return u;},clone:function(w){return w.concat();},insertAt:function(x,y,i){x.splice(i,0,y);return x;},insertBefore:function(z,A,B){var i=z.indexOf(B);if(i==-1){z.push(A);}else{z.splice(i,0,A);}return z;},insertAfter:function(C,D,E){var i=C.indexOf(E);if(i==-1||i==(C.length-1)){C.push(D);}else{C.splice(i+1,0,D);}return C;},removeAt:function(F,i){return F.splice(i,1)[0];},removeAll:function(G){G.length=0;return this;},append:function(H,I){{};Array.prototype.push.apply(H,I);return H;},exclude:function(J,K){{};for(var i=0,M=K.length,L;i<M;i++){L=J.indexOf(K[i]);if(L!=-1){J.splice(L,1);}}return J;},remove:function(N,O){var i=N.indexOf(O);if(i!=-1){N.splice(i,1);return O;}},contains:function(P,Q){return P.indexOf(Q)!==-1;},equals:function(R,S){var length=R.length;if(length!==S.length){return false;}for(var i=0;i<length;i++){if(R[i]!==S[i]){return false;}}return true;},sum:function(T){var U=0;for(var i=0,l=T.length;i<l;i++){U+=T[i];}return U;},max:function(V){{};var i,X=V.length,W=V[0];for(i=1;i<X;i++){if(V[i]>W){W=V[i];}}return W===undefined?null:W;},min:function(Y){{};var i,bb=Y.length,ba=Y[0];for(i=1;i<bb;i++){if(Y[i]<ba){ba=Y[i];}}return ba===undefined?null:ba;},unique:function(bc){var bm=[],be={},bh={},bj={};var bi,bd=0;var bn=c+qx.lang.Date.now();var bf=false,bl=false,bo=false;for(var i=0,bk=bc.length;i<bk;i++){bi=bc[i];if(bi===null){if(!bf){bf=true;bm.push(bi);}}else if(bi===undefined){}else if(bi===false){if(!bl){bl=true;bm.push(bi);}}else if(bi===true){if(!bo){bo=true;bm.push(bi);}}else if(typeof bi===a){if(!be[bi]){be[bi]=1;bm.push(bi);}}else if(typeof bi===b){if(!bh[bi]){bh[bi]=1;bm.push(bi);}}else{bg=bi[bn];if(bg==null){bg=bi[bn]=bd++;}if(!bj[bg]){bj[bg]=bi;bm.push(bi);}}}for(var bg in bj){try{delete bj[bg][bn];}catch(bp){try{bj[bg][bn]=null;}catch(bq){throw new Error("Cannot clean-up map entry doneObjects["+bg+"]["+bn+"]");}}}return bm;}}});})();(function(){var f="()",e=".",d=".prototype.",c='anonymous()',b="qx.lang.Function",a=".constructor()";qx.Class.define(b,{statics:{getCaller:function(g){return g.caller?g.caller.callee:g.callee.caller;},getName:function(h){if(h.displayName){return h.displayName;}if(h.$$original||h.wrapper||h.classname){return h.classname+a;}if(h.$$mixin){for(var j in h.$$mixin.$$members){if(h.$$mixin.$$members[j]==h){return h.$$mixin.name+d+j+f;}}for(var j in h.$$mixin){if(h.$$mixin[j]==h){return h.$$mixin.name+e+j+f;}}}if(h.self){var k=h.self.constructor;if(k){for(var j in k.prototype){if(k.prototype[j]==h){return k.classname+d+j+f;}}for(var j in k){if(k[j]==h){return k.classname+e+j+f;}}}}var i=h.toString().match(/function\s*(\w*)\s*\(.*/);if(i&&i.length>=1&&i[1]){return i[1]+f;}return c;},globalEval:function(l){if(window.execScript){return window.execScript(l);}else{return eval.call(window,l);}},empty:function(){},returnTrue:function(){return true;},returnFalse:function(){return false;},returnNull:function(){return null;},returnThis:function(){return this;},returnZero:function(){return 0;},create:function(m,n){{};if(!n){return m;}if(!(n.self||n.args||n.delay!=null||n.periodical!=null||n.attempt)){return m;}return function(event){{};var p=qx.lang.Array.fromArguments(arguments);if(n.args){p=n.args.concat(p);}if(n.delay||n.periodical){var o=qx.event.GlobalError.observeMethod(function(){return m.apply(n.self||this,p);});if(n.delay){return window.setTimeout(o,n.delay);}if(n.periodical){return window.setInterval(o,n.periodical);}}else if(n.attempt){var q=false;try{q=m.apply(n.self||this,p);}catch(r){}return q;}else{return m.apply(n.self||this,p);}};},bind:function(s,self,t){return this.create(s,{self:self,args:arguments.length>2?qx.lang.Array.fromArguments(arguments,2):null});},curry:function(u,v){return this.create(u,{args:arguments.length>1?qx.lang.Array.fromArguments(arguments,1):null});},listener:function(w,self,x){if(arguments.length<3){return function(event){return w.call(self||this,event||window.event);};}else{var y=qx.lang.Array.fromArguments(arguments,2);return function(event){var z=[event||window.event];z.push.apply(z,y);w.apply(self||this,z);};}},attempt:function(A,self,B){return this.create(A,{self:self,attempt:true,args:arguments.length>2?qx.lang.Array.fromArguments(arguments,2):null})();},delay:function(C,D,self,E){return this.create(C,{delay:D,self:self,args:arguments.length>3?qx.lang.Array.fromArguments(arguments,3):null})();},periodical:function(F,G,self,H){return this.create(F,{periodical:G,self:self,args:arguments.length>3?qx.lang.Array.fromArguments(arguments,3):null})();}}});})();(function(){var c="qx.event.Registration";qx.Class.define(c,{statics:{__fc:{},getManager:function(d){if(d==null){{};d=window;}else if(d.nodeType){d=qx.dom.Node.getWindow(d);}else if(!qx.dom.Node.isWindow(d)){d=window;}var f=d.$$hash||qx.core.ObjectRegistry.toHashCode(d);var e=this.__fc[f];if(!e){e=new qx.event.Manager(d,this);this.__fc[f]=e;}return e;},removeManager:function(g){var h=g.getWindowId();delete this.__fc[h];},addListener:function(i,j,k,self,l){return this.getManager(i).addListener(i,j,k,self,l);},removeListener:function(m,n,o,self,p){return this.getManager(m).removeListener(m,n,o,self,p);},removeListenerById:function(q,r){return this.getManager(q).removeListenerById(q,r);},removeAllListeners:function(s){return this.getManager(s).removeAllListeners(s);},deleteAllListeners:function(t){var u=t.$$hash;if(u){this.getManager(t).deleteAllListeners(u);}},hasListener:function(v,w,x){return this.getManager(v).hasListener(v,w,x);},serializeListeners:function(y){return this.getManager(y).serializeListeners(y);},createEvent:function(z,A,B){{};if(A==null){A=qx.event.type.Event;}var C=qx.event.Pool.getInstance().getObject(A);B?C.init.apply(C,B):C.init();if(z){C.setType(z);}return C;},dispatchEvent:function(D,event){return this.getManager(D).dispatchEvent(D,event);},fireEvent:function(E,F,G,H){var I;{};var J=this.createEvent(F,G||null,H);return this.getManager(E).dispatchEvent(E,J);},fireNonBubblingEvent:function(K,L,M,N){{};var O=this.getManager(K);if(!O.hasListener(K,L,false)){return true;}var P=this.createEvent(L,M||null,N);return O.dispatchEvent(K,P);},PRIORITY_FIRST:-32000,PRIORITY_NORMAL:0,PRIORITY_LAST:32000,__fd:[],addHandler:function(Q){{};this.__fd.push(Q);this.__fd.sort(function(a,b){return a.PRIORITY-b.PRIORITY;});},getHandlers:function(){return this.__fd;},__fe:[],addDispatcher:function(R,S){{};this.__fe.push(R);this.__fe.sort(function(a,b){return a.PRIORITY-b.PRIORITY;});},getDispatchers:function(){return this.__fe;}}});})();(function(){var e="$$hash",d="",c="qx.core.ObjectRegistry";qx.Class.define(c,{statics:{inShutDown:false,__cM:{},__cN:0,__cO:[],register:function(f){var j=this.__cM;if(!j){return;}var h=f.$$hash;if(h==null){var g=this.__cO;if(g.length>0){h=g.pop();}else{h=(this.__cN++)+d;}f.$$hash=h;}{};j[h]=f;},unregister:function(k){var m=k.$$hash;if(m==null){return;}var n=this.__cM;if(n&&n[m]){delete n[m];this.__cO.push(m);}try{delete k.$$hash;}catch(o){if(k.removeAttribute){k.removeAttribute(e);}}},toHashCode:function(p){{};var r=p.$$hash;if(r!=null){return r;}var q=this.__cO;if(q.length>0){r=q.pop();}else{r=(this.__cN++)+d;}return p.$$hash=r;},clearHashCode:function(s){{};var t=s.$$hash;if(t!=null){this.__cO.push(t);try{delete s.$$hash;}catch(u){if(s.removeAttribute){s.removeAttribute(e);}}}},fromHashCode:function(v){return this.__cM[v]||null;},shutdown:function(){this.inShutDown=true;var x=this.__cM;var z=[];for(var y in x){z.push(y);}z.sort(function(a,b){return parseInt(b,10)-parseInt(a,10);});var w,i=0,l=z.length;while(true){try{for(;i<l;i++){y=z[i];w=x[y];if(w&&w.dispose){w.dispose();}}}catch(A){qx.Bootstrap.error(this,"Could not dispose object "+w.toString()+": "+A);if(i!==l){i++;continue;}}break;}qx.Bootstrap.debug(this,"Disposed "+l+" objects");delete this.__cM;},getRegistry:function(){return this.__cM;}}});})();(function(){var a="qx.data.MBinding";qx.Mixin.define(a,{members:{bind:function(b,c,d,e){return qx.data.SingleValueBinding.bind(this,b,c,d,e);},removeBinding:function(f){qx.data.SingleValueBinding.removeBindingFromObject(this,f);},removeAllBindings:function(){qx.data.SingleValueBinding.removeAllBindingsForObject(this);},getBindings:function(){return qx.data.SingleValueBinding.getAllBindingsForObject(this);}}});})();(function(){var a="qx.lang.RingBuffer";qx.Class.define(a,{extend:Object,construct:function(b){this.setMaxEntries(b||50);},members:{__iq:0,__ir:0,__is:false,__it:0,__iu:null,__iv:null,setMaxEntries:function(c){this.__iv=c;this.clear();},getMaxEntries:function(){return this.__iv;},addEntry:function(d){this.__iu[this.__iq]=d;this.__iq=this.__iw(this.__iq,1);var e=this.getMaxEntries();if(this.__ir<e){this.__ir++;}if(this.__is&&(this.__it<e)){this.__it++;}},mark:function(){this.__is=true;this.__it=0;},clearMark:function(){this.__is=false;},getAllEntries:function(){return this.getEntries(this.getMaxEntries(),false);},getEntries:function(f,g){if(f>this.__ir){f=this.__ir;}if(g&&this.__is&&(f>this.__it)){f=this.__it;}if(f>0){var i=this.__iw(this.__iq,-1);var h=this.__iw(i,-f+1);var j;if(h<=i){j=this.__iu.slice(h,i+1);}else{j=this.__iu.slice(h,this.__ir).concat(this.__iu.slice(0,i+1));}}else{j=[];}return j;},clear:function(){this.__iu=new Array(this.getMaxEntries());this.__ir=0;this.__it=0;this.__iq=0;},__iw:function(k,l){var m=this.getMaxEntries();var n=(k+l)%m;if(n<0){n+=m;}return n;}}});})();(function(){var a="qx.log.appender.RingBuffer";qx.Class.define(a,{extend:qx.lang.RingBuffer,construct:function(b){this.setMaxMessages(b||50);},members:{setMaxMessages:function(c){this.setMaxEntries(c);},getMaxMessages:function(){return this.getMaxEntries();},process:function(d){this.addEntry(d);},getAllLogEvents:function(){return this.getAllEntries();},retrieveLogEvents:function(e,f){return this.getEntries(e,f);},clearHistory:function(){this.clear();}}});})();(function(){var j=":",h="qx.client",g="anonymous",f="...",e="qx.dev.StackTrace",d="",c="\n",b="/source/class/",a=".";qx.Class.define(e,{statics:{getStackTrace:qx.core.Variant.select(h,{"gecko":function(){try{throw new Error();}catch(x){var r=this.getStackTraceFromError(x);qx.lang.Array.removeAt(r,0);var p=this.getStackTraceFromCaller(arguments);var n=p.length>r.length?p:r;for(var i=0;i<Math.min(p.length,r.length);i++){var o=p[i];if(o.indexOf(g)>=0){continue;}var v=o.split(j);if(v.length!=2){continue;}var t=v[0];var m=v[1];var l=r[i];var w=l.split(j);var s=w[0];var k=w[1];if(qx.Class.getByName(s)){var q=s;}else{q=t;}var u=q+j;if(m){u+=m+j;}u+=k;n[i]=u;}return n;}},"mshtml|webkit":function(){return this.getStackTraceFromCaller(arguments);},"opera":function(){var y;try{y.bar();}catch(A){var z=this.getStackTraceFromError(A);qx.lang.Array.removeAt(z,0);return z;}return [];}}),getStackTraceFromCaller:qx.core.Variant.select(h,{"opera":function(B){return [];},"default":function(C){var H=[];var G=qx.lang.Function.getCaller(C);var D={};while(G){var E=qx.lang.Function.getName(G);H.push(E);try{G=G.caller;}catch(I){break;}if(!G){break;}var F=qx.core.ObjectRegistry.toHashCode(G);if(D[F]){H.push(f);break;}D[F]=G;}return H;}}),getStackTraceFromError:qx.core.Variant.select(h,{"gecko":function(J){if(!J.stack){return [];}var P=/@(.+):(\d+)$/gm;var K;var L=[];while((K=P.exec(J.stack))!=null){var M=K[1];var O=K[2];var N=this.__kR(M);L.push(N+j+O);}return L;},"webkit":function(Q){if(Q.sourceURL&&Q.line){return [this.__kR(Q.sourceURL)+j+Q.line];}else{return [];}},"opera":function(R){if(R.message.indexOf("Backtrace:")<0){return [];}var T=[];var U=qx.lang.String.trim(R.message.split("Backtrace:")[1]);var V=U.split(c);for(var i=0;i<V.length;i++){var S=V[i].match(/\s*Line ([0-9]+) of.* (\S.*)/);if(S&&S.length>=2){var X=S[1];var W=this.__kR(S[2]);T.push(W+j+X);}}return T;},"default":function(){return [];}}),__kR:function(Y){var bc=b;var ba=Y.indexOf(bc);var bb=(ba==-1)?Y:Y.substring(ba+bc.length).replace(/\//g,a).replace(/\.js$/,d);return bb;}}});})();(function(){var k="",j="g",h="0",g='\\$1',f="%",e='-',d="qx.lang.String",c=' ',b='\n',a="undefined";qx.Class.define(d,{statics:{camelCase:function(l){return l.replace(/\-([a-z])/g,function(m,n){return n.toUpperCase();});},hyphenate:function(o){return o.replace(/[A-Z]/g,function(p){return (e+p.charAt(0).toLowerCase());});},capitalize:function(q){return q.replace(/\b[a-z]/g,function(r){return r.toUpperCase();});},clean:function(s){return this.trim(s.replace(/\s+/g,c));},trimLeft:function(t){return t.replace(/^\s+/,k);},trimRight:function(u){return u.replace(/\s+$/,k);},trim:function(v){return v.replace(/^\s+|\s+$/g,k);},startsWith:function(w,x){return w.indexOf(x)===0;},endsWith:function(y,z){return y.substring(y.length-z.length,y.length)===z;},repeat:function(A,B){return A.length>0?new Array(B+1).join(A):k;},pad:function(C,length,D){var E=length-C.length;if(E>0){if(typeof D===a){D=h;}return this.repeat(D,E)+C;}else{return C;}},firstUp:qx.Bootstrap.firstUp,firstLow:qx.Bootstrap.firstLow,contains:function(F,G){return F.indexOf(G)!=-1;},format:function(H,I){var J=H;for(var i=0;i<I.length;i++){J=J.replace(new RegExp(f+(i+1),j),I[i]+k);}return J;},escapeRegexpChars:function(K){return K.replace(/([.*+?^${}()|[\]\/\\])/g,g);},toArray:function(L){return L.split(/\B|\b/g);},stripTags:function(M){return M.replace(/<\/?[^>]+>/gi,k);},stripScripts:function(N,O){var Q=k;var P=N.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){Q+=arguments[1]+b;return k;});if(O===true){qx.lang.Function.globalEval(Q);}return P;}}});})();(function(){var k="node",j="error",h="...(+",g="array",f=")",e="info",d="instance",c="string",b="null",a="class",H="number",G="stringify",F="]",E="date",D="unknown",C="function",B="boolean",A="debug",z="map",y="undefined",s="qx.log.Logger",t="[",q="#",r="warn",o="document",p="{...(",m="text[",n="[...(",u="\n",v=")}",x=")]",w="object";qx.Class.define(s,{statics:{__ff:A,setLevel:function(I){this.__ff=I;},getLevel:function(){return this.__ff;},setTreshold:function(J){this.__fi.setMaxMessages(J);},getTreshold:function(){return this.__fi.getMaxMessages();},__fg:{},__fh:0,register:function(K){if(K.$$id){return;}var M=this.__fh++;this.__fg[M]=K;K.$$id=M;var L=this.__fj;var N=this.__fi.getAllLogEvents();for(var i=0,l=N.length;i<l;i++){if(L[N[i].level]>=L[this.__ff]){K.process(N[i]);}}},unregister:function(O){var P=O.$$id;if(P==null){return;}delete this.__fg[P];delete O.$$id;},debug:function(Q,R){qx.log.Logger.__fk(A,arguments);},info:function(S,T){qx.log.Logger.__fk(e,arguments);},warn:function(U,V){qx.log.Logger.__fk(r,arguments);},error:function(W,X){qx.log.Logger.__fk(j,arguments);},trace:function(Y){qx.log.Logger.__fk(e,[Y,qx.dev.StackTrace.getStackTrace().join(u)]);},deprecatedMethodWarning:function(ba,bb){var bc;{};},deprecatedClassWarning:function(bd,be){var bf;{};},deprecatedEventWarning:function(bg,event,bh){var bi;{};},deprecatedMixinWarning:function(bj,bk){var bl;{};},deprecatedConstantWarning:function(bm,bn,bo){var self,bp;{};},deprecateMethodOverriding:function(bq,br,bs,bt){var bu;{};},clear:function(){this.__fi.clearHistory();},__fi:new qx.log.appender.RingBuffer(50),__fj:{debug:0,info:1,warn:2,error:3},__fk:function(bv,bw){var bB=this.__fj;if(bB[bv]<bB[this.__ff]){return;}var by=bw.length<2?null:bw[0];var bA=by?1:0;var bx=[];for(var i=bA,l=bw.length;i<l;i++){bx.push(this.__fm(bw[i],true));}var bC=new Date;var bD={time:bC,offset:bC-qx.Bootstrap.LOADSTART,level:bv,items:bx,win:window};if(by){if(by.$$hash!==undefined){bD.object=by.$$hash;}else if(by.$$type){bD.clazz=by;}}this.__fi.process(bD);var bE=this.__fg;for(var bz in bE){bE[bz].process(bD);}},__fl:function(bF){if(bF===undefined){return y;}else if(bF===null){return b;}if(bF.$$type){return a;}var bG=typeof bF;if(bG===C||bG==c||bG===H||bG===B){return bG;}else if(bG===w){if(bF.nodeType){return k;}else if(bF.classname){return d;}else if(bF instanceof Array){return g;}else if(bF instanceof Error){return j;}else if(bF instanceof Date){return E;}else{return z;}}if(bF.toString){return G;}return D;},__fm:function(bH,bI){var bP=this.__fl(bH);var bL=D;var bK=[];switch(bP){case b:case y:bL=bP;break;case c:case H:case B:case E:bL=bH;break;case k:if(bH.nodeType===9){bL=o;}else if(bH.nodeType===3){bL=m+bH.nodeValue+F;}else if(bH.nodeType===1){bL=bH.nodeName.toLowerCase();if(bH.id){bL+=q+bH.id;}}else{bL=k;}break;case C:bL=qx.lang.Function.getName(bH)||bP;break;case d:bL=bH.basename+t+bH.$$hash+F;break;case a:case G:bL=bH.toString();break;case j:bK=qx.dev.StackTrace.getStackTraceFromError(bH);bL=bH.toString();break;case g:if(bI){bL=[];for(var i=0,l=bH.length;i<l;i++){if(bL.length>20){bL.push(h+(l-i)+f);break;}bL.push(this.__fm(bH[i],false));}}else{bL=n+bH.length+x;}break;case z:if(bI){var bJ;var bO=[];for(var bN in bH){bO.push(bN);}bO.sort();bL=[];for(var i=0,l=bO.length;i<l;i++){if(bL.length>20){bL.push(h+(l-i)+f);break;}bN=bO[i];bJ=this.__fm(bH[bN],false);bJ.key=bN;bL.push(bJ);}}else{var bM=0;for(var bN in bH){bM++;}bL=p+bM+v;}break;}return {type:bP,text:bL,trace:bK};}},defer:function(bQ){var bR=qx.Bootstrap.$$logs;for(var i=0;i<bR.length;i++){bQ.__fk(bR[i][0],bR[i][1]);}qx.Bootstrap.debug=bQ.debug;qx.Bootstrap.info=bQ.info;qx.Bootstrap.warn=bQ.warn;qx.Bootstrap.error=bQ.error;qx.Bootstrap.trace=bQ.trace;}});})();(function(){var q="set",p="get",o="reset",n="MSIE 6.0",m="info",k="qx.core.Object",j="error",h="warn",g="]",f="debug",b="[",d="$$user_",c="rv:1.8.1",a="Object";qx.Class.define(k,{extend:Object,include:[qx.data.MBinding],construct:function(){qx.core.ObjectRegistry.register(this);},statics:{$$type:a},members:{toHashCode:function(){return this.$$hash;},toString:function(){return this.classname+b+this.$$hash+g;},base:function(r,s){{};if(arguments.length===1){return r.callee.base.call(this);}else{return r.callee.base.apply(this,Array.prototype.slice.call(arguments,1));}},self:function(t){return t.callee.self;},clone:function(){var v=this.constructor;var u=new v;var x=qx.Class.getProperties(v);var w=qx.core.Property.$$store.user;var y=qx.core.Property.$$method.set;var name;for(var i=0,l=x.length;i<l;i++){name=x[i];if(this.hasOwnProperty(w[name])){u[y[name]](this[w[name]]);}}return u;},set:function(z,A){var C=qx.core.Property.$$method.set;if(qx.Bootstrap.isString(z)){if(!this[C[z]]){if(this[q+qx.Bootstrap.firstUp(z)]!=undefined){this[q+qx.Bootstrap.firstUp(z)](A);return this;}{};}return this[C[z]](A);}else{for(var B in z){if(!this[C[B]]){if(this[q+qx.Bootstrap.firstUp(B)]!=undefined){this[q+qx.Bootstrap.firstUp(B)](z[B]);continue;}{};}this[C[B]](z[B]);}return this;}},get:function(D){var E=qx.core.Property.$$method.get;if(!this[E[D]]){if(this[p+qx.Bootstrap.firstUp(D)]!=undefined){return this[p+qx.Bootstrap.firstUp(D)]();}{};}return this[E[D]]();},reset:function(F){var G=qx.core.Property.$$method.reset;if(!this[G[F]]){if(this[o+qx.Bootstrap.firstUp(F)]!=undefined){this[o+qx.Bootstrap.firstUp(F)]();return;}{};}this[G[F]]();},__lw:qx.event.Registration,addListener:function(H,I,self,J){if(!this.$$disposed){return this.__lw.addListener(this,H,I,self,J);}return null;},addListenerOnce:function(K,L,self,M){var N=function(e){this.removeListener(K,N,this,M);L.call(self||this,e);};return this.addListener(K,N,this,M);},removeListener:function(O,P,self,Q){if(!this.$$disposed){return this.__lw.removeListener(this,O,P,self,Q);}return false;},removeListenerById:function(R){if(!this.$$disposed){return this.__lw.removeListenerById(this,R);}return false;},hasListener:function(S,T){return this.__lw.hasListener(this,S,T);},dispatchEvent:function(U){if(!this.$$disposed){return this.__lw.dispatchEvent(this,U);}return true;},fireEvent:function(V,W,X){if(!this.$$disposed){return this.__lw.fireEvent(this,V,W,X);}return true;},fireNonBubblingEvent:function(Y,ba,bb){if(!this.$$disposed){return this.__lw.fireNonBubblingEvent(this,Y,ba,bb);}return true;},fireDataEvent:function(bc,bd,be,bf){if(!this.$$disposed){if(be===undefined){be=null;}return this.__lw.fireNonBubblingEvent(this,bc,qx.event.type.Data,[bd,be,!!bf]);}return true;},__lx:null,setUserData:function(bg,bh){if(!this.__lx){this.__lx={};}this.__lx[bg]=bh;},getUserData:function(bi){if(!this.__lx){return null;}var bj=this.__lx[bi];return bj===undefined?null:bj;},__ly:qx.log.Logger,debug:function(bk){this.__lz(f,arguments);},info:function(bl){this.__lz(m,arguments);},warn:function(bm){this.__lz(h,arguments);},error:function(bn){this.__lz(j,arguments);},trace:function(){this.__ly.trace(this);},__lz:function(bo,bp){var bq=qx.lang.Array.fromArguments(bp);bq.unshift(this);this.__ly[bo].apply(this.__ly,bq);},isDisposed:function(){return this.$$disposed||false;},dispose:function(){var bv,bt,bs,bw;if(this.$$disposed){return;}this.$$disposed=true;this.$$instance=null;this.$$allowconstruct=null;{};var bu=this.constructor;var br;while(bu.superclass){if(bu.$$destructor){bu.$$destructor.call(this);}if(bu.$$includes){br=bu.$$flatIncludes;for(var i=0,l=br.length;i<l;i++){if(br[i].$$destructor){br[i].$$destructor.call(this);}}}bu=bu.superclass;}if(this.__lA){this.__lA();}{};},__lA:null,__lB:function(){var bx=qx.Class.getProperties(this.constructor);for(var i=0,l=bx.length;i<l;i++){delete this[d+bx[i]];}},_disposeObjects:function(by){qx.util.DisposeUtil.disposeObjects(this,arguments);},_disposeSingletonObjects:function(bz){qx.util.DisposeUtil.disposeObjects(this,arguments,true);},_disposeArray:function(bA){qx.util.DisposeUtil.disposeArray(this,bA);},_disposeMap:function(bB){qx.util.DisposeUtil.disposeMap(this,bB);}},settings:{"qx.disposerDebugLevel":0},defer:function(bC,bD){{};var bF=navigator.userAgent.indexOf(n)!=-1;var bE=navigator.userAgent.indexOf(c)!=-1;if(bF||bE){bD.__lA=bD.__lB;}},destruct:function(){if(!qx.core.ObjectRegistry.inShutDown){qx.event.Registration.removeAllListeners(this);}else{qx.event.Registration.deleteAllListeners(this);}qx.core.ObjectRegistry.unregister(this);this.__lx=null;var bI=this.constructor;var bM;var bN=qx.core.Property.$$store;var bK=bN.user;var bL=bN.theme;var bG=bN.inherit;var bJ=bN.useinit;var bH=bN.init;while(bI){bM=bI.$$properties;if(bM){for(var name in bM){if(bM[name].dereference){this[bK[name]]=this[bL[name]]=this[bG[name]]=this[bJ[name]]=this[bH[name]]=undefined;}}}bI=bI.superclass;}}});})();(function(){var f="changeSelection",e="qx.event.type.Data",d="tabView",c="apiviewer.TabViewController",b="classLinkClicked",a="itemName";qx.Class.define(c,{extend:qx.core.Object,construct:function(g){qx.core.Object.call(this);apiviewer.TabViewController.instance=this;this._tabView=g.getWidgetById(d);this._tabView.addListener(f,this.__Sm,this);},events:{"classLinkClicked":e,"changeSelection":e},members:{showTabView:function(){this._tabView.show();},onSelectItem:function(h){this.fireDataEvent(b,h);},showItem:function(i){qx.ui.core.queue.Manager.flush();var j=this._tabView.getSelection()[0];j.setUserData(a,i);return j.getChildren()[0].showItem(i);},openPackage:function(k,l){this.__Sj(k,apiviewer.ui.tabview.PackagePage,l);},openClass:function(m,n){this.__Sj(m,apiviewer.ui.tabview.ClassPage,n);},__Sj:function(o,p,q){var r=this._tabView.getSelection()[0];if(q==true||r==null){this.__Sk(p,o);}else{if(r instanceof p){r.setClassNode(o);}else{this.__Sk(p,o);this.__Sl(r);}}},__Sk:function(s,t){var u=new s(t);this._tabView.add(u);this._tabView.setSelection([u]);},__Sl:function(v){this._tabView.remove(v);v.destroy();},__Sm:function(event){var w=event.getOldData();var x=event.getData();this.fireDataEvent(f,x,w);},__Sn:function(y,z){var A=new qx.event.type.Mouse();A.init(y,z,null,true,true);A.stop();return A;}},destruct:function(){this._tabView.destroy();this._tabView=null;}});})();(function(){var a="qx.event.type.Event";qx.Class.define(a,{extend:qx.core.Object,statics:{CAPTURING_PHASE:1,AT_TARGET:2,BUBBLING_PHASE:3},members:{init:function(b,c){{};this._type=null;this._target=null;this._currentTarget=null;this._relatedTarget=null;this._originalTarget=null;this._stopPropagation=false;this._preventDefault=false;this._bubbles=!!b;this._cancelable=!!c;this._timeStamp=(new Date()).getTime();this._eventPhase=null;return this;},clone:function(d){if(d){var e=d;}else{var e=qx.event.Pool.getInstance().getObject(this.constructor);}e._type=this._type;e._target=this._target;e._currentTarget=this._currentTarget;e._relatedTarget=this._relatedTarget;e._originalTarget=this._originalTarget;e._stopPropagation=this._stopPropagation;e._bubbles=this._bubbles;e._preventDefault=this._preventDefault;e._cancelable=this._cancelable;return e;},stop:function(){if(this._bubbles){this.stopPropagation();}if(this._cancelable){this.preventDefault();}},stopPropagation:function(){{};this._stopPropagation=true;},getPropagationStopped:function(){return !!this._stopPropagation;},preventDefault:function(){{};this._preventDefault=true;},getDefaultPrevented:function(){return !!this._preventDefault;},getType:function(){return this._type;},setType:function(f){this._type=f;},getEventPhase:function(){return this._eventPhase;},setEventPhase:function(g){this._eventPhase=g;},getTimeStamp:function(){return this._timeStamp;},getTarget:function(){return this._target;},setTarget:function(h){this._target=h;},getCurrentTarget:function(){return this._currentTarget||this._target;},setCurrentTarget:function(i){this._currentTarget=i;},getRelatedTarget:function(){return this._relatedTarget;},setRelatedTarget:function(j){this._relatedTarget=j;},getOriginalTarget:function(){return this._originalTarget;},setOriginalTarget:function(k){this._originalTarget=k;},getBubbles:function(){return this._bubbles;},setBubbles:function(l){this._bubbles=l;},isCancelable:function(){return this._cancelable;},setCancelable:function(m){this._cancelable=m;}},destruct:function(){this._target=this._currentTarget=this._relatedTarget=this._originalTarget=null;}});})();(function(){var a="qx.event.type.Data";qx.Class.define(a,{extend:qx.event.type.Event,members:{__jO:null,__jP:null,init:function(b,c,d){qx.event.type.Event.prototype.init.call(this,false,d);this.__jO=b;this.__jP=c;return this;},clone:function(e){var f=qx.event.type.Event.prototype.clone.call(this,e);f.__jO=this.__jO;f.__jP=this.__jP;return f;},getData:function(){return this.__jO;},getOldData:function(){return this.__jP;}},destruct:function(){this.__jO=this.__jP=null;}});})();(function(){var c="qx.globalErrorHandling",b="on",a="qx.event.GlobalError";qx.Bootstrap.define(a,{statics:{setErrorHandler:function(d,f){this.__kx=d||null;this.__ky=f||window;if(qx.core.Setting.get(c)===b){if(d&&window.onerror){var g=qx.Bootstrap.bind(this.__kA,this);if(this.__kz==null){this.__kz=window.onerror;}var self=this;window.onerror=function(e){self.__kz(e);g(e);};}if(d&&!window.onerror){window.onerror=qx.Bootstrap.bind(this.__kA,this);}if(this.__kx==null){if(this.__kz!=null){window.onerror=this.__kz;this.__kz=null;}else{window.onerror=null;}}}},__kA:function(h,i,j){if(this.__kx){this.handleError(new qx.core.WindowError(h,i,j));return true;}},observeMethod:function(k){if(qx.core.Setting.get(c)===b){var self=this;return function(){if(!self.__kx){return k.apply(this,arguments);}try{return k.apply(this,arguments);}catch(l){self.handleError(new qx.core.GlobalError(l,arguments));}};}else{return k;}},handleError:function(m){if(this.__kx){this.__kx.call(this.__ky,m);}}},defer:function(n){qx.core.Setting.define(c,b);n.setErrorHandler(null,null);}});})();(function(){var b="",a="qx.core.WindowError";qx.Bootstrap.define(a,{extend:Error,construct:function(c,d,e){Error.call(this,c);this.__cW=c;this.__cX=d||b;this.__cY=e===undefined?-1:e;},members:{__cW:null,__cX:null,__cY:null,toString:function(){return this.__cW;},getUri:function(){return this.__cX;},getLineNumber:function(){return this.__cY;}}});})();(function(){var b="GlobalError: ",a="qx.core.GlobalError";qx.Bootstrap.define(a,{extend:Error,construct:function(c,d){{};this.__kS=b+(c&&c.message?c.message:c);Error.call(this,this.__kS);this.__kT=d;this.__kU=c;},members:{__kU:null,__kT:null,__kS:null,toString:function(){return this.__kS;},getArguments:function(){return this.__kT;},getSourceException:function(){return this.__kU;}},destruct:function(){this.__kU=null;this.__kT=null;this.__kS=null;}});})();(function(){var a="qx.event.IEventHandler";qx.Interface.define(a,{statics:{TARGET_DOMNODE:1,TARGET_WINDOW:2,TARGET_OBJECT:4,TARGET_DOCUMENT:8},members:{canHandleEvent:function(b,c){},registerEvent:function(d,e,f){},unregisterEvent:function(g,h,i){}}});})();(function(){var c="qx.event.type.Data",b="qx.event.type.Event",a="qx.data.IListData";qx.Interface.define(a,{events:{"change":c,"changeLength":b},members:{getItem:function(d){},setItem:function(e,f){},splice:function(g,h,i){},contains:function(j){},getLength:function(){},toArray:function(){}}});})();(function(){var a="qx.lang.Date";qx.Class.define(a,{statics:{now:function(){return +new Date;}}});})();(function(){var b="qx.util.ObjectPool",a="Integer";qx.Class.define(b,{extend:qx.core.Object,construct:function(c){qx.core.Object.call(this);this.__fH={};if(c!=null){this.setSize(c);}},properties:{size:{check:a,init:Infinity}},members:{__fH:null,getObject:function(d){if(this.$$disposed){return new d;}if(!d){throw new Error("Class needs to be defined!");}var e=null;var f=this.__fH[d.classname];if(f){e=f.pop();}if(e){e.$$pooled=false;}else{e=new d;}return e;},poolObject:function(g){if(!this.__fH){return;}var h=g.classname;var j=this.__fH[h];if(g.$$pooled){throw new Error("Object is already pooled: "+g);}if(!j){this.__fH[h]=j=[];}if(j.length>this.getSize()){if(g.destroy){g.destroy();}else{g.dispose();}return;}g.$$pooled=true;j.push(g);}},destruct:function(){var n=this.__fH;var k,m,i,l;for(k in n){m=n[k];for(i=0,l=m.length;i<l;i++){m[i].dispose();}}delete this.__fH;}});})();(function(){var b="singleton",a="qx.event.Pool";qx.Class.define(a,{extend:qx.util.ObjectPool,type:b,construct:function(){qx.util.ObjectPool.call(this,30);}});})();(function(){var a="qx.util.DisposeUtil";qx.Class.define(a,{statics:{disposeObjects:function(b,c,d){var name;for(var i=0,l=c.length;i<l;i++){name=c[i];if(b[name]==null||!b.hasOwnProperty(name)){continue;}if(!qx.core.ObjectRegistry.inShutDown){if(b[name].dispose){if(!d&&b[name].constructor.$$instance){throw new Error("The object stored in key "+name+" is a singleton! Please use disposeSingleton instead.");}else{b[name].dispose();}}else{throw new Error("Has no disposable object under key: "+name+"!");}}b[name]=null;}},disposeArray:function(e,f){var h=e[f];if(!h){return;}if(qx.core.ObjectRegistry.inShutDown){e[f]=null;return;}try{var g;for(var i=h.length-1;i>=0;i--){g=h[i];if(g){g.dispose();}}}catch(j){throw new Error("The array field: "+f+" of object: "+e+" has non disposable entries: "+j);}h.length=0;e[f]=null;},disposeMap:function(k,m){var o=k[m];if(!o){return;}if(qx.core.ObjectRegistry.inShutDown){k[m]=null;return;}try{var n;for(var p in o){n=o[p];if(o.hasOwnProperty(p)&&n){n.dispose();}}}catch(q){throw new Error("The map field: "+m+" of object: "+k+" has non disposable entries: "+q);}k[m]=null;},disposeTriggeredBy:function(r,s){var t=s.dispose;s.dispose=function(){t.call(s);r.dispose();};}}});})();(function(){var m="get",l="",k="[",h="last",g="change",f="]",d=".",c="Number",b="String",a="set",D="deepBinding",C="item",B="reset",A="' (",z="Boolean",y=") to the object '",x="Integer",w=" of object ",v="qx.data.SingleValueBinding",u="Binding property ",s="Binding from '",t="PositiveNumber",q="PositiveInteger",r="Binding does not exist!",o=").",p="Date",n=" not possible: No event available. ";qx.Class.define(v,{statics:{DEBUG_ON:false,__gl:{},bind:function(E,F,G,H,I){var S=this.__gn(E,F,G,H,I);var N=F.split(d);var K=this.__gt(N);var R=[];var O=[];var P=[];var L=[];var M=E;for(var i=0;i<N.length;i++){if(K[i]!==l){L.push(g);}else{L.push(this.__go(M,N[i]));}R[i]=M;if(i==N.length-1){if(K[i]!==l){var V=K[i]===h?M.length-1:K[i];var J=M.getItem(V);this.__gs(J,G,H,I,E);P[i]=this.__gu(M,L[i],G,H,I,K[i]);}else{if(N[i]!=null&&M[m+qx.lang.String.firstUp(N[i])]!=null){var J=M[m+qx.lang.String.firstUp(N[i])]();this.__gs(J,G,H,I,E);}P[i]=this.__gu(M,L[i],G,H,I);}}else{var T={index:i,propertyNames:N,sources:R,listenerIds:P,arrayIndexValues:K,targetObject:G,targetPropertyChain:H,options:I,listeners:O};var Q=qx.lang.Function.bind(this.__gm,this,T);O.push(Q);P[i]=M.addListener(L[i],Q);}if(M[m+qx.lang.String.firstUp(N[i])]==null){M=null;}else if(K[i]!==l){M=M[m+qx.lang.String.firstUp(N[i])](K[i]);}else{M=M[m+qx.lang.String.firstUp(N[i])]();}if(!M){break;}}var U={type:D,listenerIds:P,sources:R,targetListenerIds:S.listenerIds,targets:S.targets};this.__gv(U,E,F,G,H);return U;},__gm:function(W){if(W.options&&W.options.onUpdate){W.options.onUpdate(W.sources[W.index],W.targetObject);}for(var j=W.index+1;j<W.propertyNames.length;j++){var bb=W.sources[j];W.sources[j]=null;if(!bb){continue;}bb.removeListenerById(W.listenerIds[j]);}var bb=W.sources[W.index];for(var j=W.index+1;j<W.propertyNames.length;j++){if(W.arrayIndexValues[j-1]!==l){bb=bb[m+qx.lang.String.firstUp(W.propertyNames[j-1])](W.arrayIndexValues[j-1]);}else{bb=bb[m+qx.lang.String.firstUp(W.propertyNames[j-1])]();}W.sources[j]=bb;if(!bb){this.__gp(W.targetObject,W.targetPropertyChain);break;}if(j==W.propertyNames.length-1){if(qx.Class.implementsInterface(bb,qx.data.IListData)){var bc=W.arrayIndexValues[j]===h?bb.length-1:W.arrayIndexValues[j];var Y=bb.getItem(bc);this.__gs(Y,W.targetObject,W.targetPropertyChain,W.options,W.sources[W.index]);W.listenerIds[j]=this.__gu(bb,g,W.targetObject,W.targetPropertyChain,W.options,W.arrayIndexValues[j]);}else{if(W.propertyNames[j]!=null&&bb[m+qx.lang.String.firstUp(W.propertyNames[j])]!=null){var Y=bb[m+qx.lang.String.firstUp(W.propertyNames[j])]();this.__gs(Y,W.targetObject,W.targetPropertyChain,W.options,W.sources[W.index]);}var ba=this.__go(bb,W.propertyNames[j]);W.listenerIds[j]=this.__gu(bb,ba,W.targetObject,W.targetPropertyChain,W.options);}}else{if(W.listeners[j]==null){var X=qx.lang.Function.bind(this.__gm,this,W);W.listeners.push(X);}if(qx.Class.implementsInterface(bb,qx.data.IListData)){var ba=g;}else{var ba=this.__go(bb,W.propertyNames[j]);}W.listenerIds[j]=bb.addListener(ba,W.listeners[j]);}}},__gn:function(bd,be,bf,bg,bh){var bl=bg.split(d);var bj=this.__gt(bl);var bq=[];var bp=[];var bn=[];var bm=[];var bk=bf;for(var i=0;i<bl.length-1;i++){if(bj[i]!==l){bm.push(g);}else{try{bm.push(this.__go(bk,bl[i]));}catch(e){break;}}bq[i]=bk;var bo=function(){for(var j=i+1;j<bl.length-1;j++){var bt=bq[j];bq[j]=null;if(!bt){continue;}bt.removeListenerById(bn[j]);}var bt=bq[i];for(var j=i+1;j<bl.length-1;j++){var br=qx.lang.String.firstUp(bl[j-1]);if(bj[j-1]!==l){var bu=bj[j-1]===h?bt.getLength()-1:bj[j-1];bt=bt[m+br](bu);}else{bt=bt[m+br]();}bq[j]=bt;if(bp[j]==null){bp.push(bo);}if(qx.Class.implementsInterface(bt,qx.data.IListData)){var bs=g;}else{try{var bs=qx.data.SingleValueBinding.__go(bt,bl[j]);}catch(e){break;}}bn[j]=bt.addListener(bs,bp[j]);}qx.data.SingleValueBinding.updateTarget(bd,be,bf,bg,bh);};bp.push(bo);bn[i]=bk.addListener(bm[i],bo);var bi=qx.lang.String.firstUp(bl[i]);if(bk[m+bi]==null){bk=null;}else if(bj[i]!==l){bk=bk[m+bi](bj[i]);}else{bk=bk[m+bi]();}if(!bk){break;}}return {listenerIds:bn,targets:bq};},updateTarget:function(bv,bw,bx,by,bz){var bD=this.__gr(bv,bw);if(bD!=null){var bF=bw.substring(bw.lastIndexOf(d)+1,bw.length);if(bF.charAt(bF.length-1)==f){var bA=bF.substring(bF.lastIndexOf(k)+1,bF.length-1);var bC=bF.substring(0,bF.lastIndexOf(k));var bE=bD[m+qx.lang.String.firstUp(bC)]();if(bA==h){bA=bE.length-1;}if(bE!=null){var bB=bE.getItem(bA);}}else{var bB=bD[m+qx.lang.String.firstUp(bF)]();}}bB=qx.data.SingleValueBinding.__gw(bB,bx,by,bz);this.__gq(bx,by,bB);},__go:function(bG,bH){var bI=this.__gx(bG,bH);if(bI==null){if(qx.Class.supportsEvent(bG.constructor,bH)){bI=bH;}else if(qx.Class.supportsEvent(bG.constructor,g+qx.lang.String.firstUp(bH))){bI=g+qx.lang.String.firstUp(bH);}else{throw new qx.core.AssertionError(u+bH+w+bG+n);}}return bI;},__gp:function(bJ,bK){var bL=this.__gr(bJ,bK);if(bL!=null){var bM=bK.substring(bK.lastIndexOf(d)+1,bK.length);if(bM.charAt(bM.length-1)==f){this.__gq(bJ,bK,null);return;}if(bL[B+qx.lang.String.firstUp(bM)]!=undefined){bL[B+qx.lang.String.firstUp(bM)]();}else{bL[a+qx.lang.String.firstUp(bM)](null);}}},__gq:function(bN,bO,bP){var bT=this.__gr(bN,bO);if(bT!=null){var bU=bO.substring(bO.lastIndexOf(d)+1,bO.length);if(bU.charAt(bU.length-1)==f){var bQ=bU.substring(bU.lastIndexOf(k)+1,bU.length-1);var bS=bU.substring(0,bU.lastIndexOf(k));var bR=bT[m+qx.lang.String.firstUp(bS)]();if(bQ==h){bQ=bR.length-1;}if(bR!=null){bR.setItem(bQ,bP);}}else{bT[a+qx.lang.String.firstUp(bU)](bP);}}},__gr:function(bV,bW){var ca=bW.split(d);var cb=bV;for(var i=0;i<ca.length-1;i++){try{var bY=ca[i];if(bY.indexOf(f)==bY.length-1){var bX=bY.substring(bY.indexOf(k)+1,bY.length-1);bY=bY.substring(0,bY.indexOf(k));}cb=cb[m+qx.lang.String.firstUp(bY)]();if(bX!=null){if(bX==h){bX=cb.length-1;}cb=cb.getItem(bX);bX=null;}}catch(cc){return null;}}return cb;},__gs:function(cd,ce,cf,cg,ch){cd=this.__gw(cd,ce,cf,cg);if(cd===undefined){this.__gp(ce,cf);}if(cd!==undefined){try{this.__gq(ce,cf,cd);if(cg&&cg.onUpdate){cg.onUpdate(ch,ce,cd);}}catch(e){if(!(e instanceof qx.core.ValidationError)){throw e;}if(cg&&cg.onSetFail){cg.onSetFail(e);}else{qx.log.Logger.warn("Failed so set value "+cd+" on "+ce+". Error message: "+e);}}}},__gt:function(ci){var cj=[];for(var i=0;i<ci.length;i++){var name=ci[i];if(qx.lang.String.endsWith(name,f)){var ck=name.substring(name.indexOf(k)+1,name.indexOf(f));if(name.indexOf(f)!=name.length-1){throw new Error("Please use only one array at a time: "+name+" does not work.");}if(ck!==h){if(ck==l||isNaN(parseInt(ck,10))){throw new Error("No number or 'last' value hast been given"+" in a array binding: "+name+" does not work.");}}if(name.indexOf(k)!=0){ci[i]=name.substring(0,name.indexOf(k));cj[i]=l;cj[i+1]=ck;ci.splice(i+1,0,C);i++;}else{cj[i]=ck;ci.splice(i,1,C);}}else{cj[i]=l;}}return cj;},__gu:function(cl,cm,cn,co,cp,cq){var cr;{};var ct=function(cu,e){if(cu!==l){if(cu===h){cu=cl.length-1;}var cx=cl.getItem(cu);if(cx===undefined){qx.data.SingleValueBinding.__gp(cn,co);}var cv=e.getData().start;var cw=e.getData().end;if(cu<cv||cu>cw){return;}}else{var cx=e.getData();}if(qx.data.SingleValueBinding.DEBUG_ON){qx.log.Logger.debug("Binding executed from "+cl+" by "+cm+" to "+cn+" ("+co+")");qx.log.Logger.debug("Data before conversion: "+cx);}cx=qx.data.SingleValueBinding.__gw(cx,cn,co,cp);if(qx.data.SingleValueBinding.DEBUG_ON){qx.log.Logger.debug("Data after conversion: "+cx);}try{if(cx!==undefined){qx.data.SingleValueBinding.__gq(cn,co,cx);}else{qx.data.SingleValueBinding.__gp(cn,co);}if(cp&&cp.onUpdate){cp.onUpdate(cl,cn,cx);}}catch(e){if(!(e instanceof qx.core.ValidationError)){throw e;}if(cp&&cp.onSetFail){cp.onSetFail(e);}else{qx.log.Logger.warn("Failed so set value "+cx+" on "+cn+". Error message: "+e);}}};if(!cq){cq=l;}ct=qx.lang.Function.bind(ct,cl,cq);var cs=cl.addListener(cm,ct);return cs;},__gv:function(cy,cz,cA,cB,cC){if(this.__gl[cz.toHashCode()]===undefined){this.__gl[cz.toHashCode()]=[];}this.__gl[cz.toHashCode()].push([cy,cz,cA,cB,cC]);},__gw:function(cD,cE,cF,cG){if(cG&&cG.converter){var cI;if(cE.getModel){cI=cE.getModel();}return cG.converter(cD,cI);}else{var cK=this.__gr(cE,cF);var cL=cF.substring(cF.lastIndexOf(d)+1,cF.length);if(cK==null){return cD;}var cJ=qx.Class.getPropertyDefinition(cK.constructor,cL);var cH=cJ==null?l:cJ.check;return this.__gy(cD,cH);}},__gx:function(cM,cN){var cO=qx.Class.getPropertyDefinition(cM.constructor,cN);if(cO==null){return null;}return cO.event;},__gy:function(cP,cQ){var cR=qx.lang.Type.getClass(cP);if((cR==c||cR==b)&&(cQ==x||cQ==q)){cP=parseInt(cP,10);}if((cR==z||cR==c||cR==p)&&cQ==b){cP=cP+l;}if((cR==c||cR==b)&&(cQ==c||cQ==t)){cP=parseFloat(cP);}return cP;},removeBindingFromObject:function(cS,cT){if(cT.type==D){for(var i=0;i<cT.sources.length;i++){if(cT.sources[i]){cT.sources[i].removeListenerById(cT.listenerIds[i]);}}for(var i=0;i<cT.targets.length;i++){if(cT.targets[i]){cT.targets[i].removeListenerById(cT.targetListenerIds[i]);}}}else{cS.removeListenerById(cT);}var cU=this.__gl[cS.toHashCode()];if(cU!=undefined){for(var i=0;i<cU.length;i++){if(cU[i][0]==cT){qx.lang.Array.remove(cU,cU[i]);return;}}}throw new Error("Binding could not be found!");},removeAllBindingsForObject:function(cV){{};var cW=this.__gl[cV.toHashCode()];if(cW!=undefined){for(var i=cW.length-1;i>=0;i--){this.removeBindingFromObject(cV,cW[i][0]);}}},getAllBindingsForObject:function(cX){if(this.__gl[cX.toHashCode()]===undefined){this.__gl[cX.toHashCode()]=[];}return this.__gl[cX.toHashCode()];},removeAllBindings:function(){for(var da in this.__gl){var cY=qx.core.ObjectRegistry.fromHashCode(da);if(cY==null){delete this.__gl[da];continue;}this.removeAllBindingsForObject(cY);}this.__gl={};},getAllBindings:function(){return this.__gl;},showBindingInLog:function(db,dc){var de;for(var i=0;i<this.__gl[db.toHashCode()].length;i++){if(this.__gl[db.toHashCode()][i][0]==dc){de=this.__gl[db.toHashCode()][i];break;}}if(de===undefined){var dd=r;}else{var dd=s+de[1]+A+de[2]+y+de[3]+A+de[4]+o;}qx.log.Logger.debug(dd);},showAllBindingsInLog:function(){for(var dg in this.__gl){var df=qx.core.ObjectRegistry.fromHashCode(dg);for(var i=0;i<this.__gl[dg].length;i++){this.showBindingInLog(df,this.__gl[dg][i][0]);}}}}});})();(function(){var c=": ",b="qx.type.BaseError",a="";qx.Class.define(b,{extend:Error,construct:function(d,e){Error.call(this,e);this.__cL=d||a;this.message=e||qx.type.BaseError.DEFAULTMESSAGE;},statics:{DEFAULTMESSAGE:"error"},members:{__cL:null,message:null,getComment:function(){return this.__cL;},toString:function(){return this.__cL+c+this.message;}}});})();(function(){var a="qx.core.AssertionError";qx.Class.define(a,{extend:qx.type.BaseError,construct:function(b,c){qx.type.BaseError.call(this,b,c);this.__lC=qx.dev.StackTrace.getStackTrace();},members:{__lC:null,getStackTrace:function(){return this.__lC;}}});})();(function(){var a="qx.core.ValidationError";qx.Class.define(a,{extend:qx.type.BaseError});})();(function(){var f="qx.lang.Type",e="Error",d="RegExp",c="Date",b="Number",a="Boolean";qx.Class.define(f,{statics:{getClass:qx.Bootstrap.getClass,isString:qx.Bootstrap.isString,isArray:qx.Bootstrap.isArray,isObject:qx.Bootstrap.isObject,isFunction:qx.Bootstrap.isFunction,isRegExp:function(g){return this.getClass(g)==d;},isNumber:function(h){return (h!==null&&(this.getClass(h)==b||h instanceof Number));},isBoolean:function(i){return (i!==null&&(this.getClass(i)==a||i instanceof Boolean));},isDate:function(j){return (j!==null&&(this.getClass(j)==c||j instanceof Date));},isError:function(k){return (k!==null&&(this.getClass(k)==e||k instanceof Error));}}});})();(function(){var a="qx.event.IEventDispatcher";qx.Interface.define(a,{members:{canDispatchEvent:function(b,event,c){this.assertInstance(event,qx.event.type.Event);this.assertString(c);},dispatchEvent:function(d,event,e){this.assertInstance(event,qx.event.type.Event);this.assertString(e);}}});})();(function(){var a="qx.event.dispatch.Direct";qx.Class.define(a,{extend:qx.core.Object,implement:qx.event.IEventDispatcher,construct:function(b){this._manager=b;},statics:{PRIORITY:qx.event.Registration.PRIORITY_LAST},members:{canDispatchEvent:function(c,event,d){return !event.getBubbles();},dispatchEvent:function(e,event,f){var j,g;{};event.setEventPhase(qx.event.type.Event.AT_TARGET);var k=this._manager.getListeners(e,f,false);if(k){for(var i=0,l=k.length;i<l;i++){var h=k[i].context||e;k[i].handler.call(h,event);}}}},defer:function(m){qx.event.Registration.addDispatcher(m);}});})();(function(){var a="qx.event.handler.Object";qx.Class.define(a,{extend:qx.core.Object,implement:qx.event.IEventHandler,statics:{PRIORITY:qx.event.Registration.PRIORITY_LAST,SUPPORTED_TYPES:null,TARGET_CHECK:qx.event.IEventHandler.TARGET_OBJECT,IGNORE_CAN_HANDLE:false},members:{canHandleEvent:function(b,c){return qx.Class.supportsEvent(b.constructor,c);},registerEvent:function(d,e,f){},unregisterEvent:function(g,h,i){}},defer:function(j){qx.event.Registration.addHandler(j);}});})();(function(){var k="indexOf",j="lastIndexOf",h="slice",g="concat",f="join",e="toLocaleUpperCase",d="shift",c="substr",b="filter",a="unshift",I="match",H="quote",G="qx.lang.Generics",F="localeCompare",E="sort",D="some",C="charAt",B="split",A="substring",z="pop",t="toUpperCase",u="replace",q="push",r="charCodeAt",o="every",p="reverse",m="search",n="forEach",v="map",w="toLowerCase",y="splice",x="toLocaleLowerCase";qx.Class.define(G,{statics:{__eY:{"Array":[f,p,E,q,z,d,a,y,g,h,k,j,n,v,b,D,o],"String":[H,A,w,t,C,r,k,j,x,e,F,I,m,u,B,c,g,h]},__fa:function(J,K){return function(s){return J.prototype[K].apply(s,Array.prototype.slice.call(arguments,1));};},__fb:function(){var L=qx.lang.Generics.__eY;for(var P in L){var N=window[P];var M=L[P];for(var i=0,l=M.length;i<l;i++){var O=M[i];if(!N[O]){N[O]=qx.lang.Generics.__fa(N,O);}}}}},defer:function(Q){Q.__fb();}});})();(function(){var b="qx.util.DeferredCallManager",a="singleton";qx.Class.define(b,{extend:qx.core.Object,type:a,construct:function(){this.__gf={};this.__gg=qx.lang.Function.bind(this.__gk,this);this.__gh=false;},members:{__gi:null,__gj:null,__gf:null,__gh:null,__gg:null,schedule:function(c){if(this.__gi==null){this.__gi=window.setTimeout(this.__gg,0);}var d=c.toHashCode();if(this.__gj&&this.__gj[d]){return;}this.__gf[d]=c;this.__gh=true;},cancel:function(e){var f=e.toHashCode();if(this.__gj&&this.__gj[f]){this.__gj[f]=null;return;}delete this.__gf[f];if(qx.lang.Object.isEmpty(this.__gf)&&this.__gi!=null){window.clearTimeout(this.__gi);this.__gi=null;}},__gk:qx.event.GlobalError.observeMethod(function(){this.__gi=null;while(this.__gh){this.__gj=qx.lang.Object.clone(this.__gf);this.__gf={};this.__gh=false;for(var h in this.__gj){var g=this.__gj[h];if(g){this.__gj[h]=null;g.call();}}}this.__gj=null;})},destruct:function(){if(this.__gi!=null){window.clearTimeout(this.__gi);}this.__gg=this.__gf=null;}});})();(function(){var a="qx.util.DeferredCall";qx.Class.define(a,{extend:qx.core.Object,construct:function(b,c){qx.core.Object.call(this);this.__ia=b;this.__ib=c||null;this.__ic=qx.util.DeferredCallManager.getInstance();},members:{__ia:null,__ib:null,__ic:null,cancel:function(){this.__ic.cancel(this);},schedule:function(){this.__ic.schedule(this);},call:function(){this.__ib?this.__ia.apply(this.__ib):this.__ia();}},destruct:function(d,e){this.cancel();this.__ib=this.__ia=this.__ic=null;}});})();(function(){var m="element",k="qx.client",j="qxSelectable",h="off",g="on",f="text",d="div",c="",b="mshtml",a="none",F="scroll",E="qx.html.Element",D="|capture|",C="activate",B="__dz",A="blur",z="deactivate",w="capture",v="userSelect",u="-moz-none",s="visible",t="releaseCapture",q="|bubble|",r="tabIndex",o="focus",p="MozUserSelect",n="hidden";qx.Class.define(E,{extend:qx.core.Object,construct:function(G,H,I){qx.core.Object.call(this);this.__dd=G||d;this.__de=H||null;this.__df=I||null;},statics:{DEBUG:false,_modified:{},_visibility:{},_scroll:{},_actions:[],__dg:{},_scheduleFlush:function(J){qx.html.Element.__dK.schedule();},flush:function(){var U;{};var M=this.__dh();var L=M.getFocus();if(L&&this.__dl(L)){M.blur(L);}var bc=M.getActive();if(bc&&this.__dl(bc)){qx.bom.Element.deactivate(bc);}var P=this.__dj();if(P&&this.__dl(P)){qx.bom.Element.releaseCapture(P);}var V=[];var W=this._modified;for(var T in W){U=W[T];if(U.__dD()){if(U.__dm&&qx.dom.Hierarchy.isRendered(U.__dm)){V.push(U);}else{{};U.__dC();}delete W[T];}}for(var i=0,l=V.length;i<l;i++){U=V[i];{};U.__dC();}var R=this._visibility;for(var T in R){U=R[T];var X=U.__dm;if(!X){delete R[T];continue;}{};if(!U.$$disposed){X.style.display=U.__dp?c:a;if(qx.core.Variant.isSet(k,b)){if(!(document.documentMode>=8)){X.style.visibility=U.__dp?s:n;}}}delete R[T];}var scroll=this._scroll;for(var T in scroll){U=scroll[T];var bd=U.__dm;if(bd&&bd.offsetWidth){var O=true;if(U.__ds!=null){U.__dm.scrollLeft=U.__ds;delete U.__ds;}if(U.__dt!=null){U.__dm.scrollTop=U.__dt;delete U.__dt;}var Y=U.__dq;if(Y!=null){var S=Y.element.getDomElement();if(S&&S.offsetWidth){qx.bom.element.Scroll.intoViewX(S,bd,Y.align);delete U.__dq;}else{O=false;}}var ba=U.__dr;if(ba!=null){var S=ba.element.getDomElement();if(S&&S.offsetWidth){qx.bom.element.Scroll.intoViewY(S,bd,ba.align);delete U.__dr;}else{O=false;}}if(O){delete scroll[T];}}}var N={"releaseCapture":1,"blur":1,"deactivate":1};for(var i=0;i<this._actions.length;i++){var bb=this._actions[i];var X=bb.element.__dm;if(!X||!N[bb.type]&&!bb.element.__dD()){continue;}var Q=bb.args;Q.unshift(X);qx.bom.Element[bb.type].apply(qx.bom.Element,Q);}this._actions=[];for(var T in this.__dg){var K=this.__dg[T];var bd=K.element.__dm;if(bd){qx.bom.Selection.set(bd,K.start,K.end);delete this.__dg[T];}}qx.event.handler.Appear.refresh();},__dh:function(){if(!this.__di){var be=qx.event.Registration.getManager(window);this.__di=be.getHandler(qx.event.handler.Focus);}return this.__di;},__dj:function(){if(!this.__dk){var bf=qx.event.Registration.getManager(window);this.__dk=bf.getDispatcher(qx.event.dispatch.MouseCapture);}return this.__dk.getCaptureElement();},__dl:function(bg){var bh=qx.core.ObjectRegistry.fromHashCode(bg.$$element);return bh&&!bh.__dD();}},members:{__dd:null,__dm:null,__dn:false,__do:true,__dp:true,__dq:null,__dr:null,__ds:null,__dt:null,__du:null,__dv:null,__dw:null,__de:null,__df:null,__dx:null,__dy:null,__dz:null,__dA:null,__dB:null,_scheduleChildrenUpdate:function(){if(this.__dA){return;}this.__dA=true;qx.html.Element._modified[this.$$hash]=this;qx.html.Element._scheduleFlush(m);},_createDomElement:function(){return qx.bom.Element.create(this.__dd);},__dC:function(){{};var length;var bi=this.__dz;if(bi){length=bi.length;var bj;for(var i=0;i<length;i++){bj=bi[i];if(bj.__dp&&bj.__do&&!bj.__dm){bj.__dC();}}}if(!this.__dm){this.__dm=this._createDomElement();this.__dm.$$element=this.$$hash;this._copyData(false);if(bi&&length>0){this._insertChildren();}}else{this._syncData();if(this.__dA){this._syncChildren();}}delete this.__dA;},_insertChildren:function(){var bk=this.__dz;var length=bk.length;var bm;if(length>2){var bl=document.createDocumentFragment();for(var i=0;i<length;i++){bm=bk[i];if(bm.__dm&&bm.__do){bl.appendChild(bm.__dm);}}this.__dm.appendChild(bl);}else{var bl=this.__dm;for(var i=0;i<length;i++){bm=bk[i];if(bm.__dm&&bm.__do){bl.appendChild(bm.__dm);}}}},_syncChildren:function(){var br;var bw=qx.core.ObjectRegistry;var bn=this.__dz;var bu=bn.length;var bo;var bs;var bq=this.__dm;var bt=bq.childNodes;var bp=0;var bv;{};for(var i=bt.length-1;i>=0;i--){bv=bt[i];bs=bw.fromHashCode(bv.$$element);if(!bs||!bs.__do||bs.__dB!==this){bq.removeChild(bv);{};}}for(var i=0;i<bu;i++){bo=bn[i];if(bo.__do){bs=bo.__dm;bv=bt[bp];if(!bs){continue;}if(bs!=bv){if(bv){bq.insertBefore(bs,bv);}else{bq.appendChild(bs);}{};}bp++;}}{};},_copyData:function(bx){var bB=this.__dm;var bA=this.__df;if(bA){var by=qx.bom.element.Attribute;for(var bC in bA){by.set(bB,bC,bA[bC]);}}var bA=this.__de;if(bA){var bz=qx.bom.element.Style;if(bx){bz.setStyles(bB,bA);}else{bz.setCss(bB,bz.compile(bA));}}var bA=this.__dx;if(bA){for(var bC in bA){this._applyProperty(bC,bA[bC]);}}var bA=this.__dy;if(bA){qx.event.Registration.getManager(bB).importListeners(bB,bA);delete this.__dy;}},_syncData:function(){var bH=this.__dm;var bG=qx.bom.element.Attribute;var bE=qx.bom.element.Style;var bF=this.__dv;if(bF){var bK=this.__df;if(bK){var bI;for(var bJ in bF){bI=bK[bJ];if(bI!==undefined){bG.set(bH,bJ,bI);}else{bG.reset(bH,bJ);}}}this.__dv=null;}var bF=this.__du;if(bF){var bK=this.__de;if(bK){var bD={};for(var bJ in bF){bD[bJ]=bK[bJ];}bE.setStyles(bH,bD);}this.__du=null;}var bF=this.__dw;if(bF){var bK=this.__dx;if(bK){var bI;for(var bJ in bF){this._applyProperty(bJ,bK[bJ]);}}this.__dw=null;}},__dD:function(){var bL=this;while(bL){if(bL.__dn){return true;}if(!bL.__do||!bL.__dp){return false;}bL=bL.__dB;}return false;},__dE:function(bM){if(bM.__dB===this){throw new Error("Child is already in: "+bM);}if(bM.__dn){throw new Error("Root elements could not be inserted into other ones.");}if(bM.__dB){bM.__dB.remove(bM);}bM.__dB=this;if(!this.__dz){this.__dz=[];}if(this.__dm){this._scheduleChildrenUpdate();}},__dF:function(bN){if(bN.__dB!==this){throw new Error("Has no child: "+bN);}if(this.__dm){this._scheduleChildrenUpdate();}delete bN.__dB;},__dG:function(bO){if(bO.__dB!==this){throw new Error("Has no child: "+bO);}if(this.__dm){this._scheduleChildrenUpdate();}},getChildren:function(){return this.__dz||null;},getChild:function(bP){var bQ=this.__dz;return bQ&&bQ[bP]||null;},hasChildren:function(){var bR=this.__dz;return bR&&bR[0]!==undefined;},indexOf:function(bS){var bT=this.__dz;return bT?bT.indexOf(bS):-1;},hasChild:function(bU){var bV=this.__dz;return bV&&bV.indexOf(bU)!==-1;},add:function(bW){if(arguments[1]){for(var i=0,l=arguments.length;i<l;i++){this.__dE(arguments[i]);}this.__dz.push.apply(this.__dz,arguments);}else{this.__dE(bW);this.__dz.push(bW);}return this;},addAt:function(bX,bY){this.__dE(bX);qx.lang.Array.insertAt(this.__dz,bX,bY);return this;},remove:function(ca){var cb=this.__dz;if(!cb){return;}if(arguments[1]){var cc;for(var i=0,l=arguments.length;i<l;i++){cc=arguments[i];this.__dF(cc);qx.lang.Array.remove(cb,cc);}}else{this.__dF(ca);qx.lang.Array.remove(cb,ca);}return this;},removeAt:function(cd){var ce=this.__dz;if(!ce){throw new Error("Has no children!");}var cf=ce[cd];if(!cf){throw new Error("Has no child at this position!");}this.__dF(cf);qx.lang.Array.removeAt(this.__dz,cd);return this;},removeAll:function(){var cg=this.__dz;if(cg){for(var i=0,l=cg.length;i<l;i++){this.__dF(cg[i]);}cg.length=0;}return this;},getParent:function(){return this.__dB||null;},insertInto:function(parent,ch){parent.__dE(this);if(ch==null){parent.__dz.push(this);}else{qx.lang.Array.insertAt(this.__dz,this,ch);}return this;},insertBefore:function(ci){var parent=ci.__dB;parent.__dE(this);qx.lang.Array.insertBefore(parent.__dz,this,ci);return this;},insertAfter:function(cj){var parent=cj.__dB;parent.__dE(this);qx.lang.Array.insertAfter(parent.__dz,this,cj);return this;},moveTo:function(ck){var parent=this.__dB;parent.__dG(this);var cl=parent.__dz.indexOf(this);if(cl===ck){throw new Error("Could not move to same index!");}else if(cl<ck){ck--;}qx.lang.Array.removeAt(parent.__dz,cl);qx.lang.Array.insertAt(parent.__dz,this,ck);return this;},moveBefore:function(cm){var parent=this.__dB;return this.moveTo(parent.__dz.indexOf(cm));},moveAfter:function(cn){var parent=this.__dB;return this.moveTo(parent.__dz.indexOf(cn)+1);},free:function(){var parent=this.__dB;if(!parent){throw new Error("Has no parent to remove from.");}if(!parent.__dz){return;}parent.__dF(this);qx.lang.Array.remove(parent.__dz,this);return this;},getDomElement:function(){return this.__dm||null;},getNodeName:function(){return this.__dd;},setNodeName:function(name){this.__dd=name;},setRoot:function(co){this.__dn=co;},useMarkup:function(cp){if(this.__dm){throw new Error("Could not overwrite existing element!");}if(qx.core.Variant.isSet(k,b)){var cq=document.createElement(d);}else{var cq=qx.bom.Element.getHelperElement();}cq.innerHTML=cp;this.useElement(cq.firstChild);return this.__dm;},useElement:function(cr){if(this.__dm){throw new Error("Could not overwrite existing element!");}this.__dm=cr;this.__dm.$$element=this.$$hash;this._copyData(true);},isFocusable:function(){var ct=this.getAttribute(r);if(ct>=1){return true;}var cs=qx.event.handler.Focus.FOCUSABLE_ELEMENTS;if(ct>=0&&cs[this.__dd]){return true;}return false;},setSelectable:qx.core.Variant.select(k,{"webkit":function(cu){this.setAttribute(j,cu?g:h);this.setStyle(v,cu?f:a);},"gecko":function(cv){this.setAttribute(j,cv?g:h);this.setStyle(p,cv?f:u);},"default":function(cw){this.setAttribute(j,cw?g:h);}}),isNativelyFocusable:function(){return !!qx.event.handler.Focus.FOCUSABLE_ELEMENTS[this.__dd];},include:function(){if(this.__do){return;}delete this.__do;if(this.__dB){this.__dB._scheduleChildrenUpdate();}return this;},exclude:function(){if(!this.__do){return;}this.__do=false;if(this.__dB){this.__dB._scheduleChildrenUpdate();}return this;},isIncluded:function(){return this.__do===true;},show:function(){if(this.__dp){return;}if(this.__dm){qx.html.Element._visibility[this.$$hash]=this;qx.html.Element._scheduleFlush(m);}if(this.__dB){this.__dB._scheduleChildrenUpdate();}delete this.__dp;},hide:function(){if(!this.__dp){return;}if(this.__dm){qx.html.Element._visibility[this.$$hash]=this;qx.html.Element._scheduleFlush(m);}this.__dp=false;},isVisible:function(){return this.__dp===true;},scrollChildIntoViewX:function(cx,cy,cz){var cA=this.__dm;var cB=cx.getDomElement();if(cz!==false&&cA&&cA.offsetWidth&&cB&&cB.offsetWidth){qx.bom.element.Scroll.intoViewX(cB,cA,cy);}else{this.__dq={element:cx,align:cy};qx.html.Element._scroll[this.$$hash]=this;qx.html.Element._scheduleFlush(m);}delete this.__ds;},scrollChildIntoViewY:function(cC,cD,cE){var cF=this.__dm;var cG=cC.getDomElement();if(cE!==false&&cF&&cF.offsetWidth&&cG&&cG.offsetWidth){qx.bom.element.Scroll.intoViewY(cG,cF,cD);}else{this.__dr={element:cC,align:cD};qx.html.Element._scroll[this.$$hash]=this;qx.html.Element._scheduleFlush(m);}delete this.__dt;},scrollToX:function(x,cH){var cI=this.__dm;if(cH!==true&&cI&&cI.offsetWidth){cI.scrollLeft=x;}else{this.__ds=x;qx.html.Element._scroll[this.$$hash]=this;qx.html.Element._scheduleFlush(m);}delete this.__dq;},getScrollX:function(){var cJ=this.__dm;if(cJ){return cJ.scrollLeft;}return this.__ds||0;},scrollToY:function(y,cK){var cL=this.__dm;if(cK!==true&&cL&&cL.offsetWidth){cL.scrollTop=y;}else{this.__dt=y;qx.html.Element._scroll[this.$$hash]=this;qx.html.Element._scheduleFlush(m);}delete this.__dr;},getScrollY:function(){var cM=this.__dm;if(cM){return cM.scrollTop;}return this.__dt||0;},disableScrolling:function(){this.enableScrolling();this.scrollToX(0);this.scrollToY(0);this.addListener(F,this.__dI,this);},enableScrolling:function(){this.removeListener(F,this.__dI,this);},__dH:null,__dI:function(e){if(!this.__dH){this.__dH=true;this.__dm.scrollTop=0;this.__dm.scrollLeft=0;delete this.__dH;}},getTextSelection:function(){var cN=this.__dm;if(cN){return qx.bom.Selection.get(cN);}return null;},getTextSelectionLength:function(){var cO=this.__dm;if(cO){return qx.bom.Selection.getLength(cO);}return null;},getTextSelectionStart:function(){var cP=this.__dm;if(cP){return qx.bom.Selection.getStart(cP);}return null;},getTextSelectionEnd:function(){var cQ=this.__dm;if(cQ){return qx.bom.Selection.getEnd(cQ);}return null;},setTextSelection:function(cR,cS){var cT=this.__dm;if(cT){qx.bom.Selection.set(cT,cR,cS);return;}qx.html.Element.__dg[this.toHashCode()]={element:this,start:cR,end:cS};qx.html.Element._scheduleFlush(m);},clearTextSelection:function(){var cU=this.__dm;if(cU){qx.bom.Selection.clear(cU);}delete qx.html.Element.__dg[this.toHashCode()];},__dJ:function(cV,cW){var cX=qx.html.Element._actions;cX.push({type:cV,element:this,args:cW||[]});qx.html.Element._scheduleFlush(m);},focus:function(){this.__dJ(o);},blur:function(){this.__dJ(A);},activate:function(){this.__dJ(C);},deactivate:function(){this.__dJ(z);},capture:function(cY){this.__dJ(w,[cY!==false]);},releaseCapture:function(){this.__dJ(t);},setStyle:function(da,dc,dd){if(!this.__de){this.__de={};}if(this.__de[da]==dc){return;}if(dc==null){delete this.__de[da];}else{this.__de[da]=dc;}if(this.__dm){if(dd){qx.bom.element.Style.set(this.__dm,da,dc);return this;}if(!this.__du){this.__du={};}this.__du[da]=true;qx.html.Element._modified[this.$$hash]=this;qx.html.Element._scheduleFlush(m);}return this;},setStyles:function(de,df){var dg=qx.bom.element.Style;if(!this.__de){this.__de={};}if(this.__dm){if(!this.__du){this.__du={};}for(var di in de){var dh=de[di];if(this.__de[di]==dh){continue;}if(dh==null){delete this.__de[di];}else{this.__de[di]=dh;}if(df){dg.set(this.__dm,di,dh);continue;}this.__du[di]=true;}qx.html.Element._modified[this.$$hash]=this;qx.html.Element._scheduleFlush(m);}else{for(var di in de){var dh=de[di];if(this.__de[di]==dh){continue;}if(dh==null){delete this.__de[di];}else{this.__de[di]=dh;}}}return this;},removeStyle:function(dj,dk){this.setStyle(dj,null,dk);},getStyle:function(dl){return this.__de?this.__de[dl]:null;},getAllStyles:function(){return this.__de||null;},setAttribute:function(dm,dn,dp){if(!this.__df){this.__df={};}if(this.__df[dm]==dn){return;}if(dn==null){delete this.__df[dm];}else{this.__df[dm]=dn;}if(this.__dm){if(dp){qx.bom.element.Attribute.set(this.__dm,dm,dn);return this;}if(!this.__dv){this.__dv={};}this.__dv[dm]=true;qx.html.Element._modified[this.$$hash]=this;qx.html.Element._scheduleFlush(m);}return this;},setAttributes:function(dq,dr){for(var ds in dq){this.setAttribute(ds,dq[ds],dr);}return this;},removeAttribute:function(dt,du){this.setAttribute(dt,null,du);},getAttribute:function(dv){return this.__df?this.__df[dv]:null;},_applyProperty:function(name,dw){},_setProperty:function(dx,dy,dz){if(!this.__dx){this.__dx={};}if(this.__dx[dx]==dy){return;}if(dy==null){delete this.__dx[dx];}else{this.__dx[dx]=dy;}if(this.__dm){if(dz){this._applyProperty(dx,dy);return this;}if(!this.__dw){this.__dw={};}this.__dw[dx]=true;qx.html.Element._modified[this.$$hash]=this;qx.html.Element._scheduleFlush(m);}return this;},_removeProperty:function(dA,dB){this._setProperty(dA,null,dB);},_getProperty:function(dC){var dD=this.__dx;if(!dD){return null;}var dE=dD[dC];return dE==null?null:dE;},addListener:function(dF,dG,self,dH){var dI;if(this.$$disposed){return null;}{};if(this.__dm){return qx.event.Registration.addListener(this.__dm,dF,dG,self,dH);}if(!this.__dy){this.__dy={};}if(dH==null){dH=false;}var dJ=qx.event.Manager.getNextUniqueId();var dK=dF+(dH?D:q)+dJ;this.__dy[dK]={type:dF,listener:dG,self:self,capture:dH,unique:dJ};return dK;},removeListener:function(dL,dM,self,dN){var dO;if(this.$$disposed){return null;}{};if(this.__dm){qx.event.Registration.removeListener(this.__dm,dL,dM,self,dN);}else{var dQ=this.__dy;var dP;if(dN==null){dN=false;}for(var dR in dQ){dP=dQ[dR];if(dP.listener===dM&&dP.self===self&&dP.capture===dN&&dP.type===dL){delete dQ[dR];break;}}}return this;},removeListenerById:function(dS){if(this.$$disposed){return null;}if(this.__dm){qx.event.Registration.removeListenerById(this.__dm,dS);}else{delete this.__dy[dS];}return this;},hasListener:function(dT,dU){if(this.$$disposed){return false;}if(this.__dm){return qx.event.Registration.hasListener(this.__dm,dT,dU);}var dW=this.__dy;var dV;if(dU==null){dU=false;}for(var dX in dW){dV=dW[dX];if(dV.capture===dU&&dV.type===dT){return true;}}return false;}},defer:function(dY){dY.__dK=new qx.util.DeferredCall(dY.flush,dY);},destruct:function(){var ea=this.__dm;if(ea){qx.event.Registration.getManager(ea).removeAllListeners(ea);ea.$$element=c;}if(!qx.core.ObjectRegistry.inShutDown){var parent=this.__dB;if(parent&&!parent.$$disposed){parent.remove(this);}}this._disposeArray(B);this.__df=this.__de=this.__dy=this.__dx=this.__dv=this.__du=this.__dw=this.__dm=this.__dB=this.__dq=this.__dr=null;}});})();(function(){var g="qx.bom.client.Feature",f="CSS1Compat",d="label",c="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",b="input",a="pointerEvents";qx.Bootstrap.define(g,{statics:{STANDARD_MODE:false,QUIRKS_MODE:false,CONTENT_BOX:false,BORDER_BOX:false,SVG:false,CANVAS:!!window.CanvasRenderingContext2D,VML:false,XPATH:!!document.evaluate,AIR:navigator.userAgent.indexOf("adobeair")!==-1,GEARS:!!(window.google&&window.google.gears),SSL:window.location.protocol==="https:",ECMA_OBJECT_COUNT:(({}).__count__==0),CSS_POINTER_EVENTS:false,XUL:false,CSS_TEXT_OVERFLOW:("textOverflow" in document.documentElement.style||"OTextOverflow" in document.documentElement.style),HTML5_CLASSLIST:!!(document.documentElement.classList&&qx.Bootstrap.getClass(document.documentElement.classList)==="DOMTokenList"),TOUCH:("ontouchstart" in window),PLACEHOLDER:false,__gG:function(){this.QUIRKS_MODE=this.__gH();this.STANDARD_MODE=!this.QUIRKS_MODE;this.CONTENT_BOX=!qx.bom.client.Engine.MSHTML||this.STANDARD_MODE;this.BORDER_BOX=!this.CONTENT_BOX;this.SVG=document.implementation&&document.implementation.hasFeature&&(document.implementation.hasFeature("org.w3c.dom.svg","1.0")||document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1"));this.VML=qx.bom.client.Engine.MSHTML;try{document.createElementNS(c,d);this.XUL=true;}catch(e){this.XUL=false;}var i=document.createElement(b);this.PLACEHOLDER="placeholder" in i;if(a in document.documentElement.style){if(qx.bom.client.Engine.OPERA){this.CSS_POINTER_EVENTS=false;}else{this.CSS_POINTER_EVENTS=true;}}},__gH:function(){if(qx.bom.client.Engine.MSHTML&&qx.bom.client.Engine.VERSION>=8){return qx.bom.client.Engine.DOCUMENT_MODE===5;}else{return document.compatMode!==f;}}},defer:function(h){h.__gG();}});})();(function(){var a="qx.event.handler.UserAction";qx.Class.define(a,{extend:qx.core.Object,implement:qx.event.IEventHandler,construct:function(b){qx.core.Object.call(this);this.__kB=b;this.__kC=b.getWindow();},statics:{PRIORITY:qx.event.Registration.PRIORITY_NORMAL,SUPPORTED_TYPES:{useraction:1},TARGET_CHECK:qx.event.IEventHandler.TARGET_WINDOW,IGNORE_CAN_HANDLE:true},members:{__kB:null,__kC:null,canHandleEvent:function(c,d){},registerEvent:function(e,f,g){},unregisterEvent:function(h,i,j){}},destruct:function(){this.__kB=this.__kC=null;},defer:function(k){qx.event.Registration.addHandler(k);}});})();(function(){var d='ie',c="qx.ui.core.queue.Manager",b="useraction",a="touchend";qx.Class.define(c,{statics:{__lg:false,__lh:{},__li:0,MAX_RETRIES:10,scheduleFlush:function(f){var self=qx.ui.core.queue.Manager;self.__lh[f]=true;if(!self.__lg){self.__ln.schedule();self.__lg=true;}},flush:function(){if(qx.ui.core.queue.Manager.PAUSE){return;}var self=qx.ui.core.queue.Manager;if(self.__lj){return;}self.__lj=true;self.__ln.cancel();var g=self.__lh;self.__lk(function(){while(g.visibility||g.widget||g.appearance||g.layout||g.element){if(g.widget){delete g.widget;qx.ui.core.queue.Widget.flush();}if(g.visibility){delete g.visibility;qx.ui.core.queue.Visibility.flush();}if(g.appearance){delete g.appearance;qx.ui.core.queue.Appearance.flush();}if(g.widget||g.visibility||g.appearance){continue;}if(g.layout){delete g.layout;qx.ui.core.queue.Layout.flush();}if(g.widget||g.visibility||g.appearance||g.layout){continue;}if(g.element){delete g.element;qx.html.Element.flush();}}},function(){self.__lg=false;});self.__lk(function(){if(g.dispose){delete g.dispose;qx.ui.core.queue.Dispose.flush();}},function(){self.__lj=false;});self.__li=0;},__lk:function(h,i){var self=qx.ui.core.queue.Manager;try{h();}catch(e){{};self.__lg=false;self.__lj=false;self.__li+=1;if(qx.bom.client.Browser.NAME==d&&qx.bom.client.Browser.VERSION<=7){i();}if(self.__li<=self.MAX_RETRIES){self.scheduleFlush();}else{throw new Error("Fatal Error: Flush terminated "+(self.__li-1)+" times in a row"+" due to exceptions in user code. The application has to be reloaded!");}throw e;}finally{i();}},__ll:function(e){var j=qx.ui.core.queue.Manager;if(e.getData()==a){j.PAUSE=true;if(j.__lm){window.clearTimeout(j.__lm);}j.__lm=window.setTimeout(function(){j.PAUSE=false;j.__lm=null;j.flush();},500);}else{j.flush();}}},defer:function(k){k.__ln=new qx.util.DeferredCall(k.flush);qx.html.Element._scheduleFlush=k.scheduleFlush;qx.event.Registration.addListener(window,b,qx.bom.client.Feature.TOUCH?k.__ll:k.flush);}});})();(function(){var a="qx.lang.Object";qx.Class.define(a,{statics:{empty:function(b){{};for(var c in b){if(b.hasOwnProperty(c)){delete b[c];}}},isEmpty:(qx.bom.client.Feature.ECMA_OBJECT_COUNT)?function(d){{};return d.__count__===0;}:function(e){{};for(var f in e){return false;}return true;},hasMinLength:(qx.bom.client.Feature.ECMA_OBJECT_COUNT)?function(g,h){{};return g.__count__>=h;}:function(j,k){{};if(k<=0){return true;}var length=0;for(var m in j){if((++length)>=k){return true;}}return false;},getLength:qx.Bootstrap.objectGetLength,getKeys:qx.Bootstrap.getKeys,getKeysAsString:qx.Bootstrap.getKeysAsString,getValues:function(n){{};var p=[];var o=this.getKeys(n);for(var i=0,l=o.length;i<l;i++){p.push(n[o[i]]);}return p;},mergeWith:qx.Bootstrap.objectMergeWith,carefullyMergeWith:function(q,r){{};return qx.lang.Object.mergeWith(q,r,false);},merge:function(s,t){{};var u=arguments.length;for(var i=1;i<u;i++){qx.lang.Object.mergeWith(s,arguments[i]);}return s;},clone:function(v){{};var w={};for(var x in v){w[x]=v[x];}return w;},invert:function(y){{};var z={};for(var A in y){z[y[A].toString()]=A;}return z;},getKeyFromValue:function(B,C){{};for(var D in B){if(B.hasOwnProperty(D)&&B[D]===C){return D;}}return null;},contains:function(E,F){{};return this.getKeyFromValue(E,F)!==null;},select:function(G,H){{};return H[G];},fromArray:function(I){{};var J={};for(var i=0,l=I.length;i<l;i++){{};J[I[i].toString()]=true;}return J;}}});})();(function(){var b="-",a="qx.event.handler.Element";qx.Class.define(a,{extend:qx.core.Object,implement:qx.event.IEventHandler,construct:function(c){qx.core.Object.call(this);this._manager=c;this._registeredEvents={};},statics:{PRIORITY:qx.event.Registration.PRIORITY_NORMAL,SUPPORTED_TYPES:{abort:true,scroll:true,select:true,reset:true,submit:true},TARGET_CHECK:qx.event.IEventHandler.TARGET_DOMNODE,IGNORE_CAN_HANDLE:true},members:{canHandleEvent:function(d,e){},registerEvent:function(f,g,h){var k=qx.core.ObjectRegistry.toHashCode(f);var i=k+b+g;var j=qx.lang.Function.listener(this._onNative,this,i);qx.bom.Event.addNativeListener(f,g,j);this._registeredEvents[i]={element:f,type:g,listener:j};},unregisterEvent:function(l,m,n){var q=this._registeredEvents;if(!q){return;}var r=qx.core.ObjectRegistry.toHashCode(l);var o=r+b+m;var p=this._registeredEvents[o];if(p){qx.bom.Event.removeNativeListener(l,m,p.listener);}delete this._registeredEvents[o];},_onNative:qx.event.GlobalError.observeMethod(function(s,t){var v=this._registeredEvents;if(!v){return;}var u=v[t];qx.event.Registration.fireNonBubblingEvent(u.element,u.type,qx.event.type.Native,[s]);})},destruct:function(){var w;var x=this._registeredEvents;for(var y in x){w=x[y];qx.bom.Event.removeNativeListener(w.element,w.type,w.listener);}this._manager=this._registeredEvents=null;},defer:function(z){qx.event.Registration.addHandler(z);}});})();(function(){var e="orientationchange",d="resize",c="landscape",b="portrait",a="qx.event.handler.Orientation";qx.Class.define(a,{extend:qx.core.Object,implement:qx.event.IEventHandler,construct:function(f){qx.core.Object.call(this);this.__hU=f;this.__hV=f.getWindow();this._initObserver();},statics:{PRIORITY:qx.event.Registration.PRIORITY_NORMAL,SUPPORTED_TYPES:{orientationchange:1},TARGET_CHECK:qx.event.IEventHandler.TARGET_WINDOW,IGNORE_CAN_HANDLE:true},members:{__hU:null,__hV:null,__hW:null,__hX:null,__hY:null,canHandleEvent:function(g,h){},registerEvent:function(i,j,k){},unregisterEvent:function(l,m,n){},_initObserver:function(){this.__hY=qx.lang.Function.listener(this._onNative,this);this.__hW=qx.bom.Event.supportsEvent(this.__hV,e)?e:d;var Event=qx.bom.Event;Event.addNativeListener(this.__hV,this.__hW,this.__hY);},_stopObserver:function(){var Event=qx.bom.Event;Event.removeNativeListener(this.__hV,this.__hW,this.__hY);},_onNative:qx.event.GlobalError.observeMethod(function(o){var q=qx.bom.Viewport;var p=q.getOrientation();if(this.__hX!=p){this.__hX=p;var r=q.isLandscape()?c:b;qx.event.Registration.fireEvent(this.__hV,e,qx.event.type.Orientation,[p,r]);}})},destruct:function(){this._stopObserver();this.__hU=this.__hV=null;},defer:function(s){qx.event.Registration.addHandler(s);}});})();(function(){var t="qx.mobile.emulatetouch",s="touchend",r="touchstart",q="touchmove",p="mousemove",o="touchcancel",n="mouseup",m="mousedown",l="qx.client",k="mshtml",d="qx.event.handler.Touch",j="useraction",h="swipe",c="qx.mobile.nativescroll",b="webkit",g="off",f="tap",i="x",a="y";qx.Class.define(d,{extend:qx.core.Object,implement:qx.event.IEventHandler,construct:function(u){qx.core.Object.call(this);this.__hc=u;this.__hd=u.getWindow();this.__he=this.__hd.document;this._initTouchObserver();this._initMouseObserver();},statics:{PRIORITY:qx.event.Registration.PRIORITY_NORMAL,SUPPORTED_TYPES:{touchstart:1,touchmove:1,touchend:1,touchcancel:1,tap:1,swipe:1},TARGET_CHECK:qx.event.IEventHandler.TARGET_DOMNODE+qx.event.IEventHandler.TARGET_DOCUMENT,IGNORE_CAN_HANDLE:true,MOUSE_TO_TOUCH_MAPPING:{"mousedown":"touchstart","mousemove":"touchmove","mouseup":"touchend"},SWIPE_DIRECTION:{x:["left","right"],y:["up","down"]},TAP_MAX_DISTANCE:10,SWIPE_MIN_DISTANCE:11,SWIPE_MIN_VELOCITY:0},members:{__hf:null,__hg:null,__hc:null,__hd:null,__he:null,__hh:null,__hi:null,__hj:null,__hk:null,__hl:false,__hm:null,canHandleEvent:function(v,w){},registerEvent:function(x,y,z){},unregisterEvent:function(A,B,C){},__hn:function(D){var E=qx.bom.Event.getTarget(D);if(qx.core.Variant.isSet(l,b)){if(E&&E.nodeType==3){E=E.parentNode;}}return E;},__ho:function(F,G,H,I){if(!H){H=this.__hn(F);}var G=G||F.type;if(H&&H.nodeType){qx.event.Registration.fireEvent(H,G,I||qx.event.type.Touch,[F,H,null,true,true]);}qx.event.Registration.fireEvent(this.__hd,j,qx.event.type.Data,[G]);},__hp:function(J,K,L){if(!L){L=this.__hn(J);}var K=K||J.type;if(K==r){this.__hq(J,L);}else if(K==q){this.__hr(J,L);}else if(K==s){this.__hs(J,L);}},__hq:function(M,N){var O=M.changedTouches[0];this.__hh=O.screenX;this.__hi=O.screenY;this.__hj=new Date().getTime();this.__hk=M.changedTouches.length===1;},__hr:function(P,Q){if(this.__hk&&P.changedTouches.length>1){this.__hk=false;}},__hs:function(R,S){if(this.__hk){var T=R.changedTouches[0];var V={x:T.screenX-this.__hh,y:T.screenY-this.__hi};var W=qx.event.handler.Touch;if(this.__hm==S&&Math.abs(V.x)<=W.TAP_MAX_DISTANCE&&Math.abs(V.y)<=W.TAP_MAX_DISTANCE){this.__ho(R,f,S,qx.event.type.Tap);}else{var U=this.__ht(R,S,V);if(U){R.swipe=U;this.__ho(R,h,S,qx.event.type.Swipe);}}}},__ht:function(X,Y,ba){var be=qx.event.handler.Touch;var bf=new Date().getTime()-this.__hj;var bh=(Math.abs(ba.x)>=Math.abs(ba.y))?i:a;var bb=ba[bh];var bc=be.SWIPE_DIRECTION[bh][bb<0?0:1];var bg=(bf!==0)?bb/bf:0;var bd=null;if(Math.abs(bg)>=be.SWIPE_MIN_VELOCITY&&Math.abs(bb)>=be.SWIPE_MIN_DISTANCE){bd={startTime:this.__hj,duration:bf,axis:bh,direction:bc,distance:bb,velocity:bg};}return bd;},__hu:qx.core.Variant.select(t,{"on":function(bi){var bj=bi.type;var bl=qx.event.handler.Touch.MOUSE_TO_TOUCH_MAPPING;if(bl[bj]){bj=bl[bj];if(bj==r&&this.__hv(bi)){this.__hl=true;}else if(bj==s){this.__hl=false;}var bm=this.__hw(bi);var bk=(bj==s?[]:[bm]);bi.touches=bk;bi.targetTouches=bk;bi.changedTouches=[bm];}return bj;},"default":qx.lang.Function.empty}),__hv:qx.core.Variant.select(t,{"on":function(bn){if(qx.core.Variant.isSet(l,k)){var bo=1;}else{var bo=0;}return bn.button==bo;},"default":qx.lang.Function.empty}),__hw:qx.core.Variant.select(t,{"on":function(bp){var bq=this.__hn(bp);return {clientX:bp.clientX,clientY:bp.clientY,screenX:bp.screenX,screenY:bp.screenY,pageX:bp.pageX,pageY:bp.pageY,identifier:1,target:bq};},"default":qx.lang.Function.empty}),_initTouchObserver:function(){this.__hf=qx.lang.Function.listener(this._onTouchEvent,this);var Event=qx.bom.Event;Event.addNativeListener(this.__he,r,this.__hf);Event.addNativeListener(this.__he,q,this.__hf);Event.addNativeListener(this.__he,s,this.__hf);Event.addNativeListener(this.__he,o,this.__hf);},_initMouseObserver:qx.core.Variant.select(t,{"on":function(){if(!qx.bom.client.Feature.TOUCH){this.__hg=qx.lang.Function.listener(this._onMouseEvent,this);var Event=qx.bom.Event;Event.addNativeListener(this.__he,m,this.__hg);Event.addNativeListener(this.__he,p,this.__hg);Event.addNativeListener(this.__he,n,this.__hg);}},"default":qx.lang.Function.empty}),_stopTouchObserver:function(){var Event=qx.bom.Event;Event.removeNativeListener(this.__he,r,this.__hf);Event.removeNativeListener(this.__he,q,this.__hf);Event.removeNativeListener(this.__he,s,this.__hf);Event.removeNativeListener(this.__he,o,this.__hf);},_stopMouseObserver:qx.core.Variant.select(t,{"on":function(){if(!qx.bom.client.Feature.TOUCH){var Event=qx.bom.Event;Event.removeNativeListener(this.__he,m,this.__hg);Event.removeNativeListener(this.__he,p,this.__hg);Event.removeNativeListener(this.__he,n,this.__hg);}},"default":qx.lang.Function.empty}),_onTouchEvent:qx.event.GlobalError.observeMethod(function(br){this._commonTouchEventHandler(br);}),_onMouseEvent:qx.core.Variant.select(t,{"on":qx.event.GlobalError.observeMethod(function(bs){if(!qx.bom.client.Feature.TOUCH){if(bs.type==p&&!this.__hl){return;}var bt=this.__hu(bs);this._commonTouchEventHandler(bs,bt);}}),"default":qx.lang.Function.empty}),_commonTouchEventHandler:function(bu,bv){var bv=bv||bu.type;if(bv==r){this.__hm=this.__hn(bu);}this.__ho(bu,bv);this.__hp(bu,bv);}},destruct:function(){this._stopTouchObserver();this._stopMouseObserver();this.__hc=this.__hd=this.__he=this.__hm=null;},defer:function(bw){qx.event.Registration.addHandler(bw);if(qx.bom.client.Feature.TOUCH){if(qx.core.Variant.isSet(c,g)){document.addEventListener(q,function(e){e.preventDefault();});}qx.event.Registration.getManager(document).getHandler(bw);}}});})();(function(){var n="iPod",m="Win32",l="",k="Win64",j="Linux",i="BSD",h="Macintosh",g="iPhone",f="Windows",e="qx.bom.client.Platform",b="iPad",d="X11",c="MacIntel",a="MacPPC";qx.Class.define(e,{statics:{NAME:"",WIN:false,MAC:false,UNIX:false,UNKNOWN_PLATFORM:false,__kH:function(){var o=navigator.platform;if(o==null||o===l){o=navigator.userAgent;}if(o.indexOf(f)!=-1||o.indexOf(m)!=-1||o.indexOf(k)!=-1){this.WIN=true;this.NAME="win";}else if(o.indexOf(h)!=-1||o.indexOf(a)!=-1||o.indexOf(c)!=-1||o.indexOf(n)!=-1||o.indexOf(g)!=-1||o.indexOf(b)!=-1){this.MAC=true;this.NAME="mac";}else if(o.indexOf(d)!=-1||o.indexOf(j)!=-1||o.indexOf(i)!=-1){this.UNIX=true;this.NAME="unix";}else{this.UNKNOWN_PLATFORM=true;this.WIN=true;this.NAME="win";}}},defer:function(p){p.__kH();}});})();(function(){var j="win98",i="osx2",h="osx0",g="osx4",f="win95",e="win2000",d="osx1",c="osx5",b="osx3",a="Windows NT 5.01",I=")",H="winxp",G="freebsd",F="sunos",E="SV1",D="|",C="nintendods",B="winnt4",A="wince",z="winme",q="os9",r="\.",o="osx",p="linux",m="netbsd",n="winvista",k="openbsd",l="(",s="win2003",t="iPad",v="symbian",u="win7",x="g",w="qx.bom.client.System",y=" Mobile/";qx.Bootstrap.define(w,{statics:{NAME:"",SP1:false,SP2:false,WIN95:false,WIN98:false,WINME:false,WINNT4:false,WIN2000:false,WINXP:false,WIN2003:false,WINVISTA:false,WIN7:false,WINCE:false,LINUX:false,SUNOS:false,FREEBSD:false,NETBSD:false,OPENBSD:false,OSX:false,OS9:false,SYMBIAN:false,NINTENDODS:false,PSP:false,IPHONE:false,IPAD:false,UNKNOWN_SYSTEM:false,__lu:{"Windows NT 6.1":u,"Windows NT 6.0":n,"Windows NT 5.2":s,"Windows NT 5.1":H,"Windows NT 5.0":e,"Windows 2000":e,"Windows NT 4.0":B,"Win 9x 4.90":z,"Windows CE":A,"Windows 98":j,"Win98":j,"Windows 95":f,"Win95":f,"Linux":p,"FreeBSD":G,"NetBSD":m,"OpenBSD":k,"SunOS":F,"Symbian System":v,"Nitro":C,"PSP":"sonypsp","Mac OS X 10_5":c,"Mac OS X 10.5":c,"Mac OS X 10_4":g,"Mac OS X 10.4":g,"Mac OS X 10_3":b,"Mac OS X 10.3":b,"Mac OS X 10_2":i,"Mac OS X 10.2":i,"Mac OS X 10_1":d,"Mac OS X 10.1":d,"Mac OS X 10_0":h,"Mac OS X 10.0":h,"Mac OS X":o,"Mac OS 9":q},__lv:function(){var L=navigator.userAgent;var K=[];for(var J in this.__lu){K.push(J);}var M=new RegExp(l+K.join(D).replace(/\./g,r)+I,x);if(!M.test(L)){this.UNKNOWN_SYSTEM=true;if(!qx.bom.client.Platform.UNKNOWN_PLATFORM){if(qx.bom.client.Platform.UNIX){this.NAME="linux";this.LINUX=true;}else if(qx.bom.client.Platform.MAC){this.NAME="osx5";this.OSX=true;}else{this.NAME="winxp";this.WINXP=true;}}else{this.NAME="winxp";this.WINXP=true;}return;}if(qx.bom.client.Engine.WEBKIT&&RegExp(y).test(navigator.userAgent)){if(RegExp(t).test(navigator.userAgent)){this.IPAD=true;this.NAME="ipad";}else{this.IPHONE=true;this.NAME="iphone";}}else{this.NAME=this.__lu[RegExp.$1];this[this.NAME.toUpperCase()]=true;if(qx.bom.client.Platform.WIN){if(L.indexOf(a)!==-1){this.SP1=true;}else if(qx.bom.client.Engine.MSHTML&&L.indexOf(E)!==-1){this.SP2=true;}}}}},defer:function(N){N.__lv();}});})();(function(){var p="mouseup",o="click",n="qx.client",m="mousedown",l="contextmenu",k="mousewheel",j="dblclick",h="mouseover",g="mouseout",f="mousemove",c="on",e="useraction",d="DOMMouseScroll",b="gecko|webkit",a="qx.event.handler.Mouse";qx.Class.define(a,{extend:qx.core.Object,implement:qx.event.IEventHandler,construct:function(q){qx.core.Object.call(this);this.__eD=q;this.__eE=q.getWindow();this.__eF=this.__eE.document;this._initButtonObserver();this._initMoveObserver();this._initWheelObserver();},statics:{PRIORITY:qx.event.Registration.PRIORITY_NORMAL,SUPPORTED_TYPES:{mousemove:1,mouseover:1,mouseout:1,mousedown:1,mouseup:1,click:1,dblclick:1,contextmenu:1,mousewheel:1},TARGET_CHECK:qx.event.IEventHandler.TARGET_DOMNODE,IGNORE_CAN_HANDLE:true},members:{__eG:null,__eH:null,__eI:null,__eJ:null,__eK:null,__eD:null,__eE:null,__eF:null,canHandleEvent:function(r,s){},registerEvent:qx.bom.client.System.IPHONE?function(t,u,v){t[c+u]=qx.lang.Function.returnNull;}:qx.lang.Function.returnNull,unregisterEvent:qx.bom.client.System.IPHONE?function(w,x,y){w[c+x]=undefined;}:qx.lang.Function.returnNull,__eL:function(z,A,B){if(!B){B=qx.bom.Event.getTarget(z);}if(B&&B.nodeType){qx.event.Registration.fireEvent(B,A||z.type,A==k?qx.event.type.MouseWheel:qx.event.type.Mouse,[z,B,null,true,true]);}qx.event.Registration.fireEvent(this.__eE,e,qx.event.type.Data,[A||z.type]);},__eM:function(){var D=[this.__eE,this.__eF,this.__eF.body];var E=this.__eE;var C=d;for(var i=0;i<D.length;i++){if(qx.bom.Event.supportsEvent(D[i],k)){C=k;E=D[i];break;}}return {type:C,target:E};},_initButtonObserver:function(){this.__eG=qx.lang.Function.listener(this._onButtonEvent,this);var Event=qx.bom.Event;Event.addNativeListener(this.__eF,m,this.__eG);Event.addNativeListener(this.__eF,p,this.__eG);Event.addNativeListener(this.__eF,o,this.__eG);Event.addNativeListener(this.__eF,j,this.__eG);Event.addNativeListener(this.__eF,l,this.__eG);},_initMoveObserver:function(){this.__eH=qx.lang.Function.listener(this._onMoveEvent,this);var Event=qx.bom.Event;Event.addNativeListener(this.__eF,f,this.__eH);Event.addNativeListener(this.__eF,h,this.__eH);Event.addNativeListener(this.__eF,g,this.__eH);},_initWheelObserver:function(){this.__eI=qx.lang.Function.listener(this._onWheelEvent,this);var F=this.__eM();qx.bom.Event.addNativeListener(F.target,F.type,this.__eI);},_stopButtonObserver:function(){var Event=qx.bom.Event;Event.removeNativeListener(this.__eF,m,this.__eG);Event.removeNativeListener(this.__eF,p,this.__eG);Event.removeNativeListener(this.__eF,o,this.__eG);Event.removeNativeListener(this.__eF,j,this.__eG);Event.removeNativeListener(this.__eF,l,this.__eG);},_stopMoveObserver:function(){var Event=qx.bom.Event;Event.removeNativeListener(this.__eF,f,this.__eH);Event.removeNativeListener(this.__eF,h,this.__eH);Event.removeNativeListener(this.__eF,g,this.__eH);},_stopWheelObserver:function(){var G=this.__eM();qx.bom.Event.removeNativeListener(G.target,G.type,this.__eI);},_onMoveEvent:qx.event.GlobalError.observeMethod(function(H){this.__eL(H);}),_onButtonEvent:qx.event.GlobalError.observeMethod(function(I){var J=I.type;var K=qx.bom.Event.getTarget(I);if(qx.core.Variant.isSet(n,b)){if(K&&K.nodeType==3){K=K.parentNode;}}if(this.__eN){this.__eN(I,J,K);}if(this.__eP){this.__eP(I,J,K);}this.__eL(I,J,K);if(this.__eO){this.__eO(I,J,K);}if(this.__eQ){this.__eQ(I,J,K);}this.__eJ=J;}),_onWheelEvent:qx.event.GlobalError.observeMethod(function(L){this.__eL(L,k);}),__eN:qx.core.Variant.select(n,{"webkit":function(M,N,O){if(qx.bom.client.Engine.VERSION<530){if(N==l){this.__eL(M,p,O);}}},"default":null}),__eO:qx.core.Variant.select(n,{"opera":function(P,Q,R){if(Q==p&&P.button==2){this.__eL(P,l,R);}},"default":null}),__eP:qx.core.Variant.select(n,{"mshtml":function(S,T,U){if(S.target!==undefined){return;}if(T==p&&this.__eJ==o){this.__eL(S,m,U);}else if(T==j){this.__eL(S,o,U);}},"default":null}),__eQ:qx.core.Variant.select(n,{"mshtml":null,"default":function(V,W,X){switch(W){case m:this.__eK=X;break;case p:if(X!==this.__eK){var Y=qx.dom.Hierarchy.getCommonParent(X,this.__eK);this.__eL(V,o,Y);}}}})},destruct:function(){this._stopButtonObserver();this._stopMoveObserver();this._stopWheelObserver();this.__eD=this.__eE=this.__eF=this.__eK=null;},defer:function(ba){qx.event.Registration.addHandler(ba);}});})();(function(){var m="keydown",l="qx.client",k="keypress",j="NumLock",i="keyup",h="Enter",g="0",f="9",e="-",d="PageUp",bu="+",bt="PrintScreen",bs="gecko",br="A",bq="Z",bp="Left",bo="F5",bn="Down",bm="Up",bl="F11",t="F6",u="useraction",r="F3",s="keyinput",p="Insert",q="F8",n="End",o="/",B="Delete",C="*",O="cmd",K="F1",W="F4",R="Home",bh="F2",bc="F12",G="PageDown",bk="F7",bj="Win",bi="F9",F="F10",I="Right",J="text",M="Escape",P="webkit",S="5",Y="3",be="Meta",v="7",w="CapsLock",H="input",V="Control",U="Space",T="Tab",bb="Shift",ba="Pause",Q="Unidentified",X="qx.event.handler.Keyboard",a="mshtml|webkit",bd="6",x="off",y="Apps",L="4",b="Alt",c="mshtml",E="2",z="Scroll",A="1",D="8",N="autoComplete",bg=",",bf="Backspace";qx.Class.define(X,{extend:qx.core.Object,implement:qx.event.IEventHandler,construct:function(bv){qx.core.Object.call(this);this.__gO=bv;this.__gP=bv.getWindow();if(qx.core.Variant.isSet(l,bs)){this.__gQ=this.__gP;}else{this.__gQ=this.__gP.document.documentElement;}this.__gR={};this._initKeyObserver();},statics:{PRIORITY:qx.event.Registration.PRIORITY_NORMAL,SUPPORTED_TYPES:{keyup:1,keydown:1,keypress:1,keyinput:1},TARGET_CHECK:qx.event.IEventHandler.TARGET_DOMNODE,IGNORE_CAN_HANDLE:true,isValidKeyIdentifier:function(bw){if(this._identifierToKeyCodeMap[bw]){return true;}if(bw.length!=1){return false;}if(bw>=g&&bw<=f){return true;}if(bw>=br&&bw<=bq){return true;}switch(bw){case bu:case e:case C:case o:return true;default:return false;}}},members:{__gS:null,__gO:null,__gP:null,__gQ:null,__gR:null,__gT:null,__gU:null,__gV:null,canHandleEvent:function(bx,by){},registerEvent:function(bz,bA,bB){},unregisterEvent:function(bC,bD,bE){},_fireInputEvent:function(bF,bG){var bH=this.__gW();if(bH&&bH.offsetWidth!=0){var event=qx.event.Registration.createEvent(s,qx.event.type.KeyInput,[bF,bH,bG]);this.__gO.dispatchEvent(bH,event);}if(this.__gP){qx.event.Registration.fireEvent(this.__gP,u,qx.event.type.Data,[s]);}},_fireSequenceEvent:function(bI,bJ,bK){var bL=this.__gW();var bM=bI.keyCode;var event=qx.event.Registration.createEvent(bJ,qx.event.type.KeySequence,[bI,bL,bK]);this.__gO.dispatchEvent(bL,event);if(qx.core.Variant.isSet(l,a)){if(bJ==m&&event.getDefaultPrevented()){if(!this._isNonPrintableKeyCode(bM)&&!this._emulateKeyPress[bM]){this._fireSequenceEvent(bI,k,bK);}}}if(this.__gP){qx.event.Registration.fireEvent(this.__gP,u,qx.event.type.Data,[bJ]);}},__gW:function(){var bN=this.__gO.getHandler(qx.event.handler.Focus);var bO=bN.getActive();if(!bO||bO.offsetWidth==0){bO=bN.getFocus();}if(!bO||bO.offsetWidth==0){bO=this.__gO.getWindow().document.body;}return bO;},_initKeyObserver:function(){this.__gS=qx.lang.Function.listener(this.__gX,this);this.__gV=qx.lang.Function.listener(this.__ha,this);var Event=qx.bom.Event;Event.addNativeListener(this.__gQ,i,this.__gS);Event.addNativeListener(this.__gQ,m,this.__gS);Event.addNativeListener(this.__gQ,k,this.__gV);},_stopKeyObserver:function(){var Event=qx.bom.Event;Event.removeNativeListener(this.__gQ,i,this.__gS);Event.removeNativeListener(this.__gQ,m,this.__gS);Event.removeNativeListener(this.__gQ,k,this.__gV);for(var bQ in (this.__gU||{})){var bP=this.__gU[bQ];Event.removeNativeListener(bP.target,k,bP.callback);}delete (this.__gU);},__gX:qx.event.GlobalError.observeMethod(qx.core.Variant.select(l,{"mshtml":function(bR){bR=window.event||bR;var bU=bR.keyCode;var bS=0;var bT=bR.type;if(!(this.__gR[bU]==m&&bT==m)){this._idealKeyHandler(bU,bS,bT,bR);}if(bT==m){if(this._isNonPrintableKeyCode(bU)||this._emulateKeyPress[bU]){this._idealKeyHandler(bU,bS,k,bR);}}this.__gR[bU]=bT;},"gecko":function(bV){var ca=this._keyCodeFix[bV.keyCode]||bV.keyCode;var bX=0;var bY=bV.type;if(qx.bom.client.Platform.WIN){var bW=ca?this._keyCodeToIdentifier(ca):this._charCodeToIdentifier(bX);if(!(this.__gR[bW]==m&&bY==m)){this._idealKeyHandler(ca,bX,bY,bV);}this.__gR[bW]=bY;}else{this._idealKeyHandler(ca,bX,bY,bV);}this.__gY(bV.target,bY,ca);},"webkit":function(cb){var ce=0;var cc=0;var cd=cb.type;if(qx.bom.client.Engine.VERSION<525.13){if(cd==i||cd==m){ce=this._charCode2KeyCode[cb.charCode]||cb.keyCode;}else{if(this._charCode2KeyCode[cb.charCode]){ce=this._charCode2KeyCode[cb.charCode];}else{cc=cb.charCode;}}this._idealKeyHandler(ce,cc,cd,cb);}else{ce=cb.keyCode;this._idealKeyHandler(ce,cc,cd,cb);if(cd==m){if(this._isNonPrintableKeyCode(ce)||this._emulateKeyPress[ce]){this._idealKeyHandler(ce,cc,k,cb);}}this.__gR[ce]=cd;}},"opera":function(cf){this.__gT=cf.keyCode;this._idealKeyHandler(cf.keyCode,0,cf.type,cf);}})),__gY:qx.core.Variant.select(l,{"gecko":function(cg,ch,ci){if(ch===m&&(ci==33||ci==34||ci==38||ci==40)&&cg.type==J&&cg.tagName.toLowerCase()===H&&cg.getAttribute(N)!==x){if(!this.__gU){this.__gU={};}var ck=qx.core.ObjectRegistry.toHashCode(cg);if(this.__gU[ck]){return;}var self=this;this.__gU[ck]={target:cg,callback:function(cl){qx.bom.Event.stopPropagation(cl);self.__ha(cl);}};var cj=qx.event.GlobalError.observeMethod(this.__gU[ck].callback);qx.bom.Event.addNativeListener(cg,k,cj);}},"default":null}),__ha:qx.event.GlobalError.observeMethod(qx.core.Variant.select(l,{"mshtml":function(cm){cm=window.event||cm;if(this._charCode2KeyCode[cm.keyCode]){this._idealKeyHandler(this._charCode2KeyCode[cm.keyCode],0,cm.type,cm);}else{this._idealKeyHandler(0,cm.keyCode,cm.type,cm);}},"gecko":function(cn){var cq=this._keyCodeFix[cn.keyCode]||cn.keyCode;var co=cn.charCode;var cp=cn.type;this._idealKeyHandler(cq,co,cp,cn);},"webkit":function(cr){if(qx.bom.client.Engine.VERSION<525.13){var cu=0;var cs=0;var ct=cr.type;if(ct==i||ct==m){cu=this._charCode2KeyCode[cr.charCode]||cr.keyCode;}else{if(this._charCode2KeyCode[cr.charCode]){cu=this._charCode2KeyCode[cr.charCode];}else{cs=cr.charCode;}}this._idealKeyHandler(cu,cs,ct,cr);}else{if(this._charCode2KeyCode[cr.keyCode]){this._idealKeyHandler(this._charCode2KeyCode[cr.keyCode],0,cr.type,cr);}else{this._idealKeyHandler(0,cr.keyCode,cr.type,cr);}}},"opera":function(cv){var cx=cv.keyCode;var cw=cv.type;if(cx!=this.__gT){this._idealKeyHandler(0,this.__gT,cw,cv);}else{if(this._keyCodeToIdentifierMap[cv.keyCode]){this._idealKeyHandler(cv.keyCode,0,cv.type,cv);}else{this._idealKeyHandler(0,cv.keyCode,cv.type,cv);}}}})),_idealKeyHandler:function(cy,cz,cA,cB){var cC;if(cy||(!cy&&!cz)){cC=this._keyCodeToIdentifier(cy);this._fireSequenceEvent(cB,cA,cC);}else{cC=this._charCodeToIdentifier(cz);this._fireSequenceEvent(cB,k,cC);this._fireInputEvent(cB,cz);}},_specialCharCodeMap:{8:bf,9:T,13:h,27:M,32:U},_emulateKeyPress:qx.core.Variant.select(l,{"mshtml":{8:true,9:true},"webkit":{8:true,9:true,27:true},"default":{}}),_keyCodeToIdentifierMap:{16:bb,17:V,18:b,20:w,224:be,37:bp,38:bm,39:I,40:bn,33:d,34:G,35:n,36:R,45:p,46:B,112:K,113:bh,114:r,115:W,116:bo,117:t,118:bk,119:q,120:bi,121:F,122:bl,123:bc,144:j,44:bt,145:z,19:ba,91:qx.bom.client.Platform.MAC?O:bj,92:bj,93:qx.bom.client.Platform.MAC?O:y},_numpadToCharCode:{96:g.charCodeAt(0),97:A.charCodeAt(0),98:E.charCodeAt(0),99:Y.charCodeAt(0),100:L.charCodeAt(0),101:S.charCodeAt(0),102:bd.charCodeAt(0),103:v.charCodeAt(0),104:D.charCodeAt(0),105:f.charCodeAt(0),106:C.charCodeAt(0),107:bu.charCodeAt(0),109:e.charCodeAt(0),110:bg.charCodeAt(0),111:o.charCodeAt(0)},_charCodeA:br.charCodeAt(0),_charCodeZ:bq.charCodeAt(0),_charCode0:g.charCodeAt(0),_charCode9:f.charCodeAt(0),_isNonPrintableKeyCode:function(cD){return this._keyCodeToIdentifierMap[cD]?true:false;},_isIdentifiableKeyCode:function(cE){if(cE>=this._charCodeA&&cE<=this._charCodeZ){return true;}if(cE>=this._charCode0&&cE<=this._charCode9){return true;}if(this._specialCharCodeMap[cE]){return true;}if(this._numpadToCharCode[cE]){return true;}if(this._isNonPrintableKeyCode(cE)){return true;}return false;},_keyCodeToIdentifier:function(cF){if(this._isIdentifiableKeyCode(cF)){var cG=this._numpadToCharCode[cF];if(cG){return String.fromCharCode(cG);}return (this._keyCodeToIdentifierMap[cF]||this._specialCharCodeMap[cF]||String.fromCharCode(cF));}else{return Q;}},_charCodeToIdentifier:function(cH){return this._specialCharCodeMap[cH]||String.fromCharCode(cH).toUpperCase();},_identifierToKeyCode:function(cI){return qx.event.handler.Keyboard._identifierToKeyCodeMap[cI]||cI.charCodeAt(0);}},destruct:function(){this._stopKeyObserver();this.__gT=this.__gO=this.__gP=this.__gQ=this.__gR=null;},defer:function(cJ,cK){qx.event.Registration.addHandler(cJ);if(!cJ._identifierToKeyCodeMap){cJ._identifierToKeyCodeMap={};for(var cL in cK._keyCodeToIdentifierMap){cJ._identifierToKeyCodeMap[cK._keyCodeToIdentifierMap[cL]]=parseInt(cL,10);}for(var cL in cK._specialCharCodeMap){cJ._identifierToKeyCodeMap[cK._specialCharCodeMap[cL]]=parseInt(cL,10);}}if(qx.core.Variant.isSet(l,c)){cK._charCode2KeyCode={13:13,27:27};}else if(qx.core.Variant.isSet(l,bs)){cK._keyCodeFix={12:cK._identifierToKeyCode(j)};}else if(qx.core.Variant.isSet(l,P)){if(qx.bom.client.Engine.VERSION<525.13){cK._charCode2KeyCode={63289:cK._identifierToKeyCode(j),63276:cK._identifierToKeyCode(d),63277:cK._identifierToKeyCode(G),63275:cK._identifierToKeyCode(n),63273:cK._identifierToKeyCode(R),63234:cK._identifierToKeyCode(bp),63232:cK._identifierToKeyCode(bm),63235:cK._identifierToKeyCode(I),63233:cK._identifierToKeyCode(bn),63272:cK._identifierToKeyCode(B),63302:cK._identifierToKeyCode(p),63236:cK._identifierToKeyCode(K),63237:cK._identifierToKeyCode(bh),63238:cK._identifierToKeyCode(r),63239:cK._identifierToKeyCode(W),63240:cK._identifierToKeyCode(bo),63241:cK._identifierToKeyCode(t),63242:cK._identifierToKeyCode(bk),63243:cK._identifierToKeyCode(q),63244:cK._identifierToKeyCode(bi),63245:cK._identifierToKeyCode(F),63246:cK._identifierToKeyCode(bl),63247:cK._identifierToKeyCode(bc),63248:cK._identifierToKeyCode(bt),3:cK._identifierToKeyCode(h),12:cK._identifierToKeyCode(j),13:cK._identifierToKeyCode(h)};}else{cK._charCode2KeyCode={13:13,27:27};}}}});})();(function(){var a="qx.event.handler.Capture";qx.Class.define(a,{extend:qx.core.Object,implement:qx.event.IEventHandler,statics:{PRIORITY:qx.event.Registration.PRIORITY_NORMAL,SUPPORTED_TYPES:{capture:true,losecapture:true},TARGET_CHECK:qx.event.IEventHandler.TARGET_DOMNODE,IGNORE_CAN_HANDLE:true},members:{canHandleEvent:function(b,c){},registerEvent:function(d,e,f){},unregisterEvent:function(g,h,i){}},defer:function(j){qx.event.Registration.addHandler(j);}});})();(function(){var k="alias",j="copy",i="blur",h="mouseout",g="keydown",f="Ctrl",d="Shift",c="mousemove",b="move",a="mouseover",A="Alt",z="keyup",y="mouseup",x="dragend",w="on",v="mousedown",u="qxDraggable",t="drag",s="drop",r="qxDroppable",p="qx.event.handler.DragDrop",q="droprequest",n="dragstart",o="dragchange",l="dragleave",m="dragover";qx.Class.define(p,{extend:qx.core.Object,implement:qx.event.IEventHandler,construct:function(B){qx.core.Object.call(this);this.__jt=B;this.__ju=B.getWindow().document.documentElement;this.__jt.addListener(this.__ju,v,this._onMouseDown,this);this.__jG();},statics:{PRIORITY:qx.event.Registration.PRIORITY_NORMAL,SUPPORTED_TYPES:{dragstart:1,dragend:1,dragover:1,dragleave:1,drop:1,drag:1,dragchange:1,droprequest:1},IGNORE_CAN_HANDLE:true},members:{__jt:null,__ju:null,__jv:null,__jw:null,__jx:null,__jy:null,__jz:null,__jA:null,__jB:null,__jC:null,__jD:false,__jE:0,__jF:0,canHandleEvent:function(C,D){},registerEvent:function(E,F,G){},unregisterEvent:function(H,I,J){},addType:function(K){this.__jx[K]=true;},addAction:function(L){this.__jy[L]=true;},supportsType:function(M){return !!this.__jx[M];},supportsAction:function(N){return !!this.__jy[N];},getData:function(O){if(!this.__jN||!this.__jv){throw new Error("This method must not be used outside the drop event listener!");}if(!this.__jx[O]){throw new Error("Unsupported data type: "+O+"!");}if(!this.__jA[O]){this.__jB=O;this.__jI(q,this.__jw,this.__jv,false);}if(!this.__jA[O]){throw new Error("Please use a droprequest listener to the drag source to fill the manager with data!");}return this.__jA[O]||null;},getCurrentAction:function(){return this.__jC;},addData:function(P,Q){this.__jA[P]=Q;},getCurrentType:function(){return this.__jB;},isSessionActive:function(){return this.__jD;},__jG:function(){this.__jx={};this.__jy={};this.__jz={};this.__jA={};},__jH:function(){if(this.__jw==null){return;}var T=this.__jy;var R=this.__jz;var S=null;if(this.__jN){if(R.Shift&&R.Ctrl&&T.alias){S=k;}else if(R.Shift&&R.Alt&&T.copy){S=j;}else if(R.Shift&&T.move){S=b;}else if(R.Alt&&T.alias){S=k;}else if(R.Ctrl&&T.copy){S=j;}else if(T.move){S=b;}else if(T.copy){S=j;}else if(T.alias){S=k;}}if(S!=this.__jC){this.__jC=S;this.__jI(o,this.__jw,this.__jv,false);}},__jI:function(U,V,W,X,Y){var bb=qx.event.Registration;var ba=bb.createEvent(U,qx.event.type.Drag,[X,Y]);if(V!==W){ba.setRelatedTarget(W);}return bb.dispatchEvent(V,ba);},__jJ:function(bc){while(bc&&bc.nodeType==1){if(bc.getAttribute(u)==w){return bc;}bc=bc.parentNode;}return null;},__jK:function(bd){while(bd&&bd.nodeType==1){if(bd.getAttribute(r)==w){return bd;}bd=bd.parentNode;}return null;},__jL:function(){this.__jw=null;this.__jt.removeListener(this.__ju,c,this._onMouseMove,this,true);this.__jt.removeListener(this.__ju,y,this._onMouseUp,this,true);qx.event.Registration.removeListener(window,i,this._onWindowBlur,this);this.__jG();},__jM:function(){if(this.__jD){this.__jt.removeListener(this.__ju,a,this._onMouseOver,this,true);this.__jt.removeListener(this.__ju,h,this._onMouseOut,this,true);this.__jt.removeListener(this.__ju,g,this._onKeyDown,this,true);this.__jt.removeListener(this.__ju,z,this._onKeyUp,this,true);this.__jI(x,this.__jw,this.__jv,false);this.__jD=false;}this.__jN=false;this.__jv=null;this.__jL();},__jN:false,_onWindowBlur:function(e){this.__jM();},_onKeyDown:function(e){var be=e.getKeyIdentifier();switch(be){case A:case f:case d:if(!this.__jz[be]){this.__jz[be]=true;this.__jH();}}},_onKeyUp:function(e){var bf=e.getKeyIdentifier();switch(bf){case A:case f:case d:if(this.__jz[bf]){this.__jz[bf]=false;this.__jH();}}},_onMouseDown:function(e){if(this.__jD){return;}var bg=this.__jJ(e.getTarget());if(bg){this.__jE=e.getDocumentLeft();this.__jF=e.getDocumentTop();this.__jw=bg;this.__jt.addListener(this.__ju,c,this._onMouseMove,this,true);this.__jt.addListener(this.__ju,y,this._onMouseUp,this,true);qx.event.Registration.addListener(window,i,this._onWindowBlur,this);}},_onMouseUp:function(e){if(this.__jN){this.__jI(s,this.__jv,this.__jw,false,e);}if(this.__jD){e.stopPropagation();}this.__jM();},_onMouseMove:function(e){if(this.__jD){if(!this.__jI(t,this.__jw,this.__jv,true,e)){this.__jM();}}else{if(Math.abs(e.getDocumentLeft()-this.__jE)>3||Math.abs(e.getDocumentTop()-this.__jF)>3){if(this.__jI(n,this.__jw,this.__jv,true,e)){this.__jD=true;this.__jt.addListener(this.__ju,a,this._onMouseOver,this,true);this.__jt.addListener(this.__ju,h,this._onMouseOut,this,true);this.__jt.addListener(this.__ju,g,this._onKeyDown,this,true);this.__jt.addListener(this.__ju,z,this._onKeyUp,this,true);var bh=this.__jz;bh.Ctrl=e.isCtrlPressed();bh.Shift=e.isShiftPressed();bh.Alt=e.isAltPressed();this.__jH();}else{this.__jI(x,this.__jw,this.__jv,false);this.__jL();}}}},_onMouseOver:function(e){var bi=e.getTarget();var bj=this.__jK(bi);if(bj&&bj!=this.__jv){this.__jN=this.__jI(m,bj,this.__jw,true,e);this.__jv=bj;this.__jH();}},_onMouseOut:function(e){var bl=this.__jK(e.getTarget());var bk=this.__jK(e.getRelatedTarget());if(bl&&bl!==bk&&bl==this.__jv){this.__jI(l,this.__jv,bk,false,e);this.__jv=null;this.__jN=false;qx.event.Timer.once(this.__jH,this,0);}}},destruct:function(){this.__jw=this.__jv=this.__jt=this.__ju=this.__jx=this.__jy=this.__jz=this.__jA=null;},defer:function(bm){qx.event.Registration.addHandler(bm);}});})();(function(){var c="qx.event.handler.Appear",b="disappear",a="appear";qx.Class.define(c,{extend:qx.core.Object,implement:qx.event.IEventHandler,construct:function(d){qx.core.Object.call(this);this.__cl=d;this.__cm={};qx.event.handler.Appear.__cn[this.$$hash]=this;},statics:{PRIORITY:qx.event.Registration.PRIORITY_NORMAL,SUPPORTED_TYPES:{appear:true,disappear:true},TARGET_CHECK:qx.event.IEventHandler.TARGET_DOMNODE,IGNORE_CAN_HANDLE:true,__cn:{},refresh:function(){var e=this.__cn;for(var f in e){e[f].refresh();}}},members:{__cl:null,__cm:null,canHandleEvent:function(g,h){},registerEvent:function(i,j,k){var l=qx.core.ObjectRegistry.toHashCode(i)+j;var m=this.__cm;if(m&&!m[l]){m[l]=i;i.$$displayed=i.offsetWidth>0;}},unregisterEvent:function(n,o,p){var q=qx.core.ObjectRegistry.toHashCode(n)+o;var r=this.__cm;if(!r){return;}if(r[q]){delete r[q];}},refresh:function(){var v=this.__cm;var w;for(var u in v){w=v[u];var s=w.offsetWidth>0;if((!!w.$$displayed)!==s){w.$$displayed=s;var t=qx.event.Registration.createEvent(s?a:b);this.__cl.dispatchEvent(w,t);}}}},destruct:function(){this.__cl=this.__cm=null;delete qx.event.handler.Appear.__cn[this.$$hash];},defer:function(x){qx.event.Registration.addHandler(x);}});})();(function(){var b="abstract",a="qx.event.dispatch.AbstractBubbling";qx.Class.define(a,{extend:qx.core.Object,implement:qx.event.IEventDispatcher,type:b,construct:function(c){this._manager=c;},members:{_getParent:function(d){throw new Error("Missing implementation");},canDispatchEvent:function(e,event,f){return event.getBubbles();},dispatchEvent:function(g,event,h){var parent=g;var s=this._manager;var p,w;var n;var r,u;var t;var v=[];p=s.getListeners(g,h,true);w=s.getListeners(g,h,false);if(p){v.push(p);}if(w){v.push(w);}var parent=this._getParent(g);var l=[];var k=[];var m=[];var q=[];while(parent!=null){p=s.getListeners(parent,h,true);if(p){m.push(p);q.push(parent);}w=s.getListeners(parent,h,false);if(w){l.push(w);k.push(parent);}parent=this._getParent(parent);}event.setEventPhase(qx.event.type.Event.CAPTURING_PHASE);for(var i=m.length-1;i>=0;i--){t=q[i];event.setCurrentTarget(t);n=m[i];for(var j=0,o=n.length;j<o;j++){r=n[j];u=r.context||t;r.handler.call(u,event);}if(event.getPropagationStopped()){return;}}event.setEventPhase(qx.event.type.Event.AT_TARGET);event.setCurrentTarget(g);for(var i=0,x=v.length;i<x;i++){n=v[i];for(var j=0,o=n.length;j<o;j++){r=n[j];u=r.context||g;r.handler.call(u,event);}if(event.getPropagationStopped()){return;}}event.setEventPhase(qx.event.type.Event.BUBBLING_PHASE);for(var i=0,x=l.length;i<x;i++){t=k[i];event.setCurrentTarget(t);n=l[i];for(var j=0,o=n.length;j<o;j++){r=n[j];u=r.context||t;r.handler.call(u,event);}if(event.getPropagationStopped()){return;}}}}});})();(function(){var a="qx.event.dispatch.DomBubbling";qx.Class.define(a,{extend:qx.event.dispatch.AbstractBubbling,statics:{PRIORITY:qx.event.Registration.PRIORITY_NORMAL},members:{_getParent:function(b){return b.parentNode;},canDispatchEvent:function(c,event,d){return c.nodeType!==undefined&&event.getBubbles();}},defer:function(e){qx.event.Registration.addDispatcher(e);}});})();(function(){var q="mshtml",p="",o="qx.client",n=" ",m=">",k="<",h="='",g="none",f="<INPUT TYPE='RADIO' NAME='RADIOTEST' VALUE='Second Choice'>",d="qx.bom.Element",a="' ",c="div",b="></";qx.Class.define(d,{statics:{__kI:{"onload":true,"onpropertychange":true,"oninput":true,"onchange":true,"name":true,"type":true,"checked":true,"disabled":true},__kJ:{},__kK:{},allowCreationWithMarkup:function(r){if(!r){r=window;}var s=r.location.href;if(qx.bom.Element.__kK[s]==undefined){try{r.document.createElement(f);qx.bom.Element.__kK[s]=true;}catch(e){qx.bom.Element.__kK[s]=false;}}return qx.bom.Element.__kK[s];},getHelperElement:function(t){if(!t){t=window;}var v=t.location.href;if(!qx.bom.Element.__kJ[v]){var u=qx.bom.Element.__kJ[v]=t.document.createElement(c);if(qx.bom.client.Engine.WEBKIT){u.style.display=g;t.document.body.appendChild(u);}}return qx.bom.Element.__kJ[v];},create:function(name,w,x){if(!x){x=window;}if(!name){throw new Error("The tag name is missing!");}var z=this.__kI;var y=p;for(var B in w){if(z[B]){y+=B+h+w[B]+a;}}var C;if(y!=p){if(qx.bom.Element.allowCreationWithMarkup(x)){C=x.document.createElement(k+name+n+y+m);}else{var A=qx.bom.Element.getHelperElement(x);A.innerHTML=k+name+n+y+b+name+m;C=A.firstChild;}}else{C=x.document.createElement(name);}for(var B in w){if(!z[B]){qx.bom.element.Attribute.set(C,B,w[B]);}}return C;},empty:function(D){return D.innerHTML=p;},addListener:function(E,F,G,self,H){return qx.event.Registration.addListener(E,F,G,self,H);},removeListener:function(I,J,K,self,L){return qx.event.Registration.removeListener(I,J,K,self,L);},removeListenerById:function(M,N){return qx.event.Registration.removeListenerById(M,N);},hasListener:function(O,P,Q){return qx.event.Registration.hasListener(O,P,Q);},focus:function(R){qx.event.Registration.getManager(R).getHandler(qx.event.handler.Focus).focus(R);},blur:function(S){qx.event.Registration.getManager(S).getHandler(qx.event.handler.Focus).blur(S);},activate:function(T){qx.event.Registration.getManager(T).getHandler(qx.event.handler.Focus).activate(T);},deactivate:function(U){qx.event.Registration.getManager(U).getHandler(qx.event.handler.Focus).deactivate(U);},capture:function(V,W){qx.event.Registration.getManager(V).getDispatcher(qx.event.dispatch.MouseCapture).activateCapture(V,W);},releaseCapture:function(X){qx.event.Registration.getManager(X).getDispatcher(qx.event.dispatch.MouseCapture).releaseCapture(X);},matchesSelector:function(Y,ba){if(ba){return qx.bom.Selector.query(ba,Y.parentNode).length>0;}else{return false;}},clone:function(bb,bc){var bf;if(bc||(qx.core.Variant.isSet(o,q)&&!qx.xml.Document.isXmlDocument(bb))){var bj=qx.event.Registration.getManager(bb);var bd=qx.dom.Hierarchy.getDescendants(bb);bd.push(bb);}if(qx.core.Variant.isSet(o,q)){for(var i=0,l=bd.length;i<l;i++){bj.toggleAttachedEvents(bd[i],false);}}var bf=bb.cloneNode(true);if(qx.core.Variant.isSet(o,q)){for(var i=0,l=bd.length;i<l;i++){bj.toggleAttachedEvents(bd[i],true);}}if(bc===true){var bm=qx.dom.Hierarchy.getDescendants(bf);bm.push(bf);var be,bh,bl,bg;for(var i=0,bk=bd.length;i<bk;i++){bl=bd[i];be=bj.serializeListeners(bl);if(be.length>0){bh=bm[i];for(var j=0,bi=be.length;j<bi;j++){bg=be[j];bj.addListener(bh,bg.type,bg.handler,bg.self,bg.capture);}}}}return bf;}}});})();(function(){var a="qx.event.type.Native";qx.Class.define(a,{extend:qx.event.type.Event,members:{init:function(b,c,d,e,f){qx.event.type.Event.prototype.init.call(this,e,f);this._target=c||qx.bom.Event.getTarget(b);this._relatedTarget=d||qx.bom.Event.getRelatedTarget(b);if(b.timeStamp){this._timeStamp=b.timeStamp;}this._native=b;this._returnValue=null;return this;},clone:function(g){var h=qx.event.type.Event.prototype.clone.call(this,g);var i={};h._native=this._cloneNativeEvent(this._native,i);h._returnValue=this._returnValue;return h;},_cloneNativeEvent:function(j,k){k.preventDefault=qx.lang.Function.empty;return k;},preventDefault:function(){qx.event.type.Event.prototype.preventDefault.call(this);qx.bom.Event.preventDefault(this._native);},getNativeEvent:function(){return this._native;},setReturnValue:function(l){this._returnValue=l;},getReturnValue:function(){return this._returnValue;}},destruct:function(){this._native=this._returnValue=null;}});})();(function(){var b="qx.client",a="qx.bom.Viewport";qx.Class.define(a,{statics:{getWidth:qx.core.Variant.select(b,{"opera":function(c){if(qx.bom.client.Engine.VERSION<9.5){return (c||window).document.body.clientWidth;}else{var d=(c||window).document;return qx.bom.Document.isStandardMode(c)?d.documentElement.clientWidth:d.body.clientWidth;}},"webkit":function(e){if(qx.bom.client.Engine.VERSION<523.15){return (e||window).innerWidth;}else{var f=(e||window).document;return qx.bom.Document.isStandardMode(e)?f.documentElement.clientWidth:f.body.clientWidth;}},"default":function(g){var h=(g||window).document;return qx.bom.Document.isStandardMode(g)?h.documentElement.clientWidth:h.body.clientWidth;}}),getHeight:qx.core.Variant.select(b,{"opera":function(i){if(qx.bom.client.Engine.VERSION<9.5){return (i||window).document.body.clientHeight;}else{var j=(i||window).document;return qx.bom.Document.isStandardMode(i)?j.documentElement.clientHeight:j.body.clientHeight;}},"webkit":function(k){if(qx.bom.client.Engine.VERSION<523.15){return (k||window).innerHeight;}else{var l=(k||window).document;return qx.bom.Document.isStandardMode(k)?l.documentElement.clientHeight:l.body.clientHeight;}},"default":function(m){var n=(m||window).document;return qx.bom.Document.isStandardMode(m)?n.documentElement.clientHeight:n.body.clientHeight;}}),getScrollLeft:qx.core.Variant.select(b,{"mshtml":function(o){var p=(o||window).document;return p.documentElement.scrollLeft||p.body.scrollLeft;},"default":function(q){return (q||window).pageXOffset;}}),getScrollTop:qx.core.Variant.select(b,{"mshtml":function(r){var s=(r||window).document;return s.documentElement.scrollTop||s.body.scrollTop;},"default":function(t){return (t||window).pageYOffset;}}),getOrientation:function(u){var v=(u||window).orientation;if(v==null){v=this.getWidth(u)>this.getHeight(u)?90:0;}return v;},isLandscape:function(w){return Math.abs(this.getOrientation(w))==90;},isPortrait:function(x){var y=this.getOrientation(x);return (y==0||y==180);}}});})();(function(){var f="CSS1Compat",e="position:absolute;width:0;height:0;width:1",d="qx.bom.Document",c="1px",b="qx.client",a="div";qx.Class.define(d,{statics:{isQuirksMode:qx.core.Variant.select(b,{"mshtml":function(g){if(qx.bom.client.Engine.VERSION>=8){return (g||window).document.documentMode===5;}else{return (g||window).document.compatMode!==f;}},"webkit":function(h){if(document.compatMode===undefined){var i=(h||window).document.createElement(a);i.style.cssText=e;return i.style.width===c?true:false;}else{return (h||window).document.compatMode!==f;}},"default":function(j){return (j||window).document.compatMode!==f;}}),isStandardMode:function(k){return !this.isQuirksMode(k);},getWidth:function(l){var m=(l||window).document;var n=qx.bom.Viewport.getWidth(l);var scroll=this.isStandardMode(l)?m.documentElement.scrollWidth:m.body.scrollWidth;return Math.max(scroll,n);},getHeight:function(o){var p=(o||window).document;var q=qx.bom.Viewport.getHeight(o);var scroll=this.isStandardMode(o)?p.documentElement.scrollHeight:p.body.scrollHeight;return Math.max(scroll,q);}}});})();(function(){var c="landscape",b="qx.event.type.Orientation",a="portrait";qx.Class.define(b,{extend:qx.event.type.Event,members:{__eB:null,__eC:null,init:function(d,e){qx.event.type.Event.prototype.init.call(this,false,false);this.__eB=d;this.__eC=e;return this;},clone:function(f){var g=qx.event.type.Event.prototype.clone.call(this,f);g.__eB=this.__eB;g.__eC=this.__eC;return g;},getOrientation:function(){return this.__eB;},isLandscape:function(){return this.__eC==c;},isPortrait:function(){return this.__eC==a;}}});})();(function(){var a="qx.event.type.Dom";qx.Class.define(a,{extend:qx.event.type.Native,statics:{SHIFT_MASK:1,CTRL_MASK:2,ALT_MASK:4,META_MASK:8},members:{_cloneNativeEvent:function(b,c){var c=qx.event.type.Native.prototype._cloneNativeEvent.call(this,b,c);c.shiftKey=b.shiftKey;c.ctrlKey=b.ctrlKey;c.altKey=b.altKey;c.metaKey=b.metaKey;return c;},getModifiers:function(){var e=0;var d=this._native;if(d.shiftKey){e|=qx.event.type.Dom.SHIFT_MASK;}if(d.ctrlKey){e|=qx.event.type.Dom.CTRL_MASK;}if(d.altKey){e|=qx.event.type.Dom.ALT_MASK;}if(d.metaKey){e|=qx.event.type.Dom.META_MASK;}return e;},isCtrlPressed:function(){return this._native.ctrlKey;},isShiftPressed:function(){return this._native.shiftKey;},isAltPressed:function(){return this._native.altKey;},isMetaPressed:function(){return this._native.metaKey;},isCtrlOrCommandPressed:function(){if(qx.bom.client.Platform.MAC){return this._native.metaKey;}else{return this._native.ctrlKey;}}}});})();(function(){var c="touchcancel",b="qx.event.type.Touch",a="touchend";qx.Class.define(b,{extend:qx.event.type.Dom,members:{_cloneNativeEvent:function(d,e){var e=qx.event.type.Dom.prototype._cloneNativeEvent.call(this,d,e);e.pageX=d.pageX;e.pageY=d.pageY;e.layerX=d.layerX;e.layerY=d.layerY;e.scale=d.scale;e.rotation=d.rotation;e.srcElement=d.srcElement;e.targetTouches=[];for(var i=0;i<d.targetTouches.length;i++){e.targetTouches[i]=d.targetTouches[i];}e.changedTouches=[];for(var i=0;i<d.changedTouches.length;i++){e.changedTouches[i]=d.changedTouches[i];}e.touches=[];for(var i=0;i<d.touches.length;i++){e.touches[i]=d.touches[i];}return e;},stop:function(){this.stopPropagation();},getAllTouches:function(){return this._native.touches;},getTargetTouches:function(){return this._native.targetTouches;},getChangedTargetTouches:function(){return this._native.changedTouches;},isMultiTouch:function(){return this.__cG().length>1;},getScale:function(){return this._native.scale;},getRotation:function(){return this._native.rotation;},getDocumentLeft:function(f){return this.__cF(f).pageX;},getDocumentTop:function(g){return this.__cF(g).pageY;},getScreenLeft:function(h){return this.__cF(h).screenX;},getScreenTop:function(j){return this.__cF(j).screenY;},getViewportLeft:function(k){return this.__cF(k).clientX;},getViewportTop:function(l){return this.__cF(l).clientY;},getIdentifier:function(m){return this.__cF(m).identifier;},__cF:function(n){n=n==null?0:n;return this.__cG()[n];},__cG:function(){var o=(this._isTouchEnd()?this.getChangedTargetTouches():this.getTargetTouches());return o;},_isTouchEnd:function(){return (this.getType()==a||this.getType()==c);}}});})();(function(){var a="qx.event.type.Tap";qx.Class.define(a,{extend:qx.event.type.Touch,members:{_isTouchEnd:function(){return true;}}});})();(function(){var a="qx.event.type.Swipe";qx.Class.define(a,{extend:qx.event.type.Touch,members:{_cloneNativeEvent:function(b,c){var c=qx.event.type.Touch.prototype._cloneNativeEvent.call(this,b,c);c.swipe=b.swipe;return c;},_isTouchEnd:function(){return true;},getStartTime:function(){return this._native.swipe.startTime;},getDuration:function(){return this._native.swipe.duration;},getAxis:function(){return this._native.swipe.axis;},getDirection:function(){return this._native.swipe.direction;},getVelocity:function(){return this._native.swipe.velocity;},getDistance:function(){return this._native.swipe.distance;}}});})();(function(){var h="left",g="right",f="middle",e="none",d="click",c="contextmenu",b="qx.event.type.Mouse",a="qx.client";qx.Class.define(b,{extend:qx.event.type.Dom,members:{_cloneNativeEvent:function(i,j){var j=qx.event.type.Dom.prototype._cloneNativeEvent.call(this,i,j);j.button=i.button;j.clientX=i.clientX;j.clientY=i.clientY;j.pageX=i.pageX;j.pageY=i.pageY;j.screenX=i.screenX;j.screenY=i.screenY;j.wheelDelta=i.wheelDelta;j.detail=i.detail;j.srcElement=i.srcElement;j.target=i.target;return j;},__kD:{0:h,2:g,1:f},__kE:{1:h,2:g,4:f},stop:function(){this.stopPropagation();},getButton:function(){switch(this._type){case c:return g;case d:if(this.__kF){return this.__kF();}default:if(this._native.target!==undefined){return this.__kD[this._native.button]||e;}else{return this.__kE[this._native.button]||e;}}},__kF:qx.core.Variant.select(a,{"mshtml":function(){return h;},"default":null}),isLeftPressed:function(){return this.getButton()===h;},isMiddlePressed:function(){return this.getButton()===f;},isRightPressed:function(){return this.getButton()===g;},getRelatedTarget:function(){return this._relatedTarget;},getViewportLeft:function(){return this._native.clientX;},getViewportTop:function(){return this._native.clientY;},getDocumentLeft:function(){if(this._native.pageX!==undefined){return this._native.pageX;}else{var k=qx.dom.Node.getWindow(this._native.srcElement);return this._native.clientX+qx.bom.Viewport.getScrollLeft(k);}},getDocumentTop:function(){if(this._native.pageY!==undefined){return this._native.pageY;}else{var l=qx.dom.Node.getWindow(this._native.srcElement);return this._native.clientY+qx.bom.Viewport.getScrollTop(l);}},getScreenLeft:function(){return this._native.screenX;},getScreenTop:function(){return this._native.screenY;}}});})();(function(){var c="qx.client",b="chrome",a="qx.event.type.MouseWheel";qx.Class.define(a,{extend:qx.event.type.Mouse,members:{stop:function(){this.stopPropagation();this.preventDefault();},getWheelDelta:qx.core.Variant.select(c,{"default":function(){return -(this._native.wheelDelta/40);},"gecko":function(){return this._native.detail;},"webkit":function(){if(qx.bom.client.Browser.NAME==b){if(qx.bom.client.Platform.MAC){return -(this._native.wheelDelta/1200);}else{return -(this._native.wheelDelta/120);}}else{if(qx.bom.client.Platform.WIN){var d=120;if(qx.bom.client.Engine.VERSION==533.16){d=1200;}}else{d=40;if(qx.bom.client.Engine.VERSION==533.16||qx.bom.client.Engine.VERSION==533.17||qx.bom.client.Engine.VERSION==533.18){d=1200;}}return -(this._native.wheelDelta/d);}}})}});})();(function(){var j="qx.client",i="ie",h="msie",g="android",f="operamini",e="mobile chrome",d=")(/| )([0-9]+\.[0-9])",c="iemobile",b="opera mobi",a="Mobile Safari",x="operamobile",w="mobile safari",v="IEMobile|Maxthon|MSIE",u="qx.bom.client.Browser",t="opera mini",s="(",r="opera",q="mshtml",p="Opera Mini|Opera Mobi|Opera",o="AdobeAIR|Titanium|Fluid|Chrome|Android|Epiphany|Konqueror|iCab|OmniWeb|Maxthon|Pre|Mobile Safari|Safari",m="webkit",n="5.0",k="prism|Fennec|Camino|Kmeleon|Galeon|Netscape|SeaMonkey|Firefox",l="Mobile/";qx.Bootstrap.define(u,{statics:{UNKNOWN:true,NAME:"unknown",TITLE:"unknown 0.0",VERSION:0.0,FULLVERSION:"0.0.0",__lE:function(y){var z=navigator.userAgent;var B=new RegExp(s+y+d);var C=z.match(B);if(!C){return;}var name=C[1].toLowerCase();var A=C[3];if(z.match(/Version(\/| )([0-9]+\.[0-9])/)){A=RegExp.$2;}if(qx.core.Variant.isSet(j,m)){if(name===g){name=e;}else if(z.indexOf(a)!==-1||z.indexOf(l)!==-1){name=w;}}else if(qx.core.Variant.isSet(j,q)){if(name===h){name=i;if(qx.bom.client.System.WINCE&&name===i){name=c;A=n;}}}else if(qx.core.Variant.isSet(j,r)){if(name===b){name=x;}else if(name===t){name=f;}}this.NAME=name;this.FULLVERSION=A;this.VERSION=parseFloat(A,10);this.TITLE=name+" "+this.VERSION;this.UNKNOWN=false;}},defer:qx.core.Variant.select(j,{"webkit":function(D){D.__lE(o);},"gecko":function(E){E.__lE(k);},"mshtml":function(F){F.__lE(v);},"opera":function(G){G.__lE(p);}})});})();(function(){var f="qx.client",e="qx.dom.Hierarchy",d="previousSibling",c="*",b="nextSibling",a="parentNode";qx.Class.define(e,{statics:{getNodeIndex:function(g){var h=0;while(g&&(g=g.previousSibling)){h++;}return h;},getElementIndex:function(i){var j=0;var k=qx.dom.Node.ELEMENT;while(i&&(i=i.previousSibling)){if(i.nodeType==k){j++;}}return j;},getNextElementSibling:function(l){while(l&&(l=l.nextSibling)&&!qx.dom.Node.isElement(l)){continue;}return l||null;},getPreviousElementSibling:function(m){while(m&&(m=m.previousSibling)&&!qx.dom.Node.isElement(m)){continue;}return m||null;},contains:qx.core.Variant.select(f,{"webkit|mshtml|opera":function(n,o){if(qx.dom.Node.isDocument(n)){var p=qx.dom.Node.getDocument(o);return n&&p==n;}else if(qx.dom.Node.isDocument(o)){return false;}else{return n.contains(o);}},"gecko":function(q,r){return !!(q.compareDocumentPosition(r)&16);},"default":function(s,t){while(t){if(s==t){return true;}t=t.parentNode;}return false;}}),isRendered:qx.core.Variant.select(f,{"mshtml":function(u){if(!u.parentNode||!u.offsetParent){return false;}var v=u.ownerDocument||u.document;return v.body.contains(u);},"gecko":function(w){var x=w.ownerDocument||w.document;return !!(x.compareDocumentPosition(w)&16);},"default":function(y){if(!y.parentNode||!y.offsetParent){return false;}var z=y.ownerDocument||y.document;return z.body.contains(y);}}),isDescendantOf:function(A,B){return this.contains(B,A);},getCommonParent:qx.core.Variant.select(f,{"mshtml|opera":function(C,D){if(C===D){return C;}while(C&&qx.dom.Node.isElement(C)){if(C.contains(D)){return C;}C=C.parentNode;}return null;},"default":function(E,F){if(E===F){return E;}var G={};var J=qx.core.ObjectRegistry;var I,H;while(E||F){if(E){I=J.toHashCode(E);if(G[I]){return G[I];}G[I]=E;E=E.parentNode;}if(F){H=J.toHashCode(F);if(G[H]){return G[H];}G[H]=F;F=F.parentNode;}}return null;}}),getAncestors:function(K){return this._recursivelyCollect(K,a);},getChildElements:function(L){L=L.firstChild;if(!L){return [];}var M=this.getNextSiblings(L);if(L.nodeType===1){M.unshift(L);}return M;},getDescendants:function(N){return qx.lang.Array.fromCollection(N.getElementsByTagName(c));},getFirstDescendant:function(O){O=O.firstChild;while(O&&O.nodeType!=1){O=O.nextSibling;}return O;},getLastDescendant:function(P){P=P.lastChild;while(P&&P.nodeType!=1){P=P.previousSibling;}return P;},getPreviousSiblings:function(Q){return this._recursivelyCollect(Q,d);},getNextSiblings:function(R){return this._recursivelyCollect(R,b);},_recursivelyCollect:function(S,T){var U=[];while(S=S[T]){if(S.nodeType==1){U.push(S);}}return U;},getSiblings:function(V){return this.getPreviousSiblings(V).reverse().concat(this.getNextSiblings(V));},isEmpty:function(W){W=W.firstChild;while(W){if(W.nodeType===qx.dom.Node.ELEMENT||W.nodeType===qx.dom.Node.TEXT){return false;}W=W.nextSibling;}return true;},cleanWhitespace:function(X){var Y=X.firstChild;while(Y){var ba=Y.nextSibling;if(Y.nodeType==3&&!/\S/.test(Y.nodeValue)){X.removeChild(Y);}Y=ba;}}}});})();(function(){var a="qx.event.type.KeyInput";qx.Class.define(a,{extend:qx.event.type.Dom,members:{init:function(b,c,d){qx.event.type.Dom.prototype.init.call(this,b,c,null,true,true);this._charCode=d;return this;},clone:function(e){var f=qx.event.type.Dom.prototype.clone.call(this,e);f._charCode=this._charCode;return f;},getCharCode:function(){return this._charCode;},getChar:function(){return String.fromCharCode(this._charCode);}}});})();(function(){var a="qx.event.type.KeySequence";qx.Class.define(a,{extend:qx.event.type.Dom,members:{init:function(b,c,d){qx.event.type.Dom.prototype.init.call(this,b,c,null,true,true);this._keyCode=b.keyCode;this._identifier=d;return this;},clone:function(e){var f=qx.event.type.Dom.prototype.clone.call(this,e);f._keyCode=this._keyCode;f._identifier=this._identifier;return f;},getKeyIdentifier:function(){return this._identifier;},getKeyCode:function(){return this._keyCode;}}});})();(function(){var j="qx.client",i="mousedown",h="mouseup",g="blur",f="focus",e="on",d="selectstart",c="DOMFocusOut",b="focusin",a="focusout",z="DOMFocusIn",y="draggesture",x="qx.event.handler.Focus",w="_applyFocus",v="deactivate",u="textarea",t="_applyActive",s='character',r="input",q="qxSelectable",o="tabIndex",p="off",m="activate",n="mshtml",k="qxKeepFocus",l="qxKeepActive";qx.Class.define(x,{extend:qx.core.Object,implement:qx.event.IEventHandler,construct:function(A){qx.core.Object.call(this);this._manager=A;this._window=A.getWindow();this._document=this._window.document;this._root=this._document.documentElement;this._body=this._document.body;this._initObserver();},properties:{active:{apply:t,nullable:true},focus:{apply:w,nullable:true}},statics:{PRIORITY:qx.event.Registration.PRIORITY_NORMAL,SUPPORTED_TYPES:{focus:1,blur:1,focusin:1,focusout:1,activate:1,deactivate:1},IGNORE_CAN_HANDLE:true,FOCUSABLE_ELEMENTS:qx.core.Variant.select("qx.client",{"mshtml|gecko":{a:1,body:1,button:1,frame:1,iframe:1,img:1,input:1,object:1,select:1,textarea:1},"opera|webkit":{button:1,input:1,select:1,textarea:1}})},members:{__jQ:null,__jR:null,__jS:null,__jT:null,__jU:null,__jV:null,__jW:null,__jX:null,__jY:null,__ka:null,canHandleEvent:function(B,C){},registerEvent:function(D,E,F){},unregisterEvent:function(G,H,I){},focus:function(J){if(qx.core.Variant.isSet(j,n)){window.setTimeout(function(){try{J.focus();var K=qx.bom.Selection.get(J);if(K.length==0){var L=J.createTextRange();L.moveStart(s,J.value.length);L.collapse();L.select();}}catch(M){}},0);}else{try{J.focus();}catch(N){}}this.setFocus(J);this.setActive(J);},activate:function(O){this.setActive(O);},blur:function(P){try{P.blur();}catch(Q){}if(this.getActive()===P){this.resetActive();}if(this.getFocus()===P){this.resetFocus();}},deactivate:function(R){if(this.getActive()===R){this.resetActive();}},tryActivate:function(S){var T=this.__kp(S);if(T){this.setActive(T);}},__kb:function(U,V,W,X){var ba=qx.event.Registration;var Y=ba.createEvent(W,qx.event.type.Focus,[U,V,X]);ba.dispatchEvent(U,Y);},_windowFocused:true,__kc:function(){if(this._windowFocused){this._windowFocused=false;this.__kb(this._window,null,g,false);}},__kd:function(){if(!this._windowFocused){this._windowFocused=true;this.__kb(this._window,null,f,false);}},_initObserver:qx.core.Variant.select(j,{"gecko":function(){this.__jQ=qx.lang.Function.listener(this.__kj,this);this.__jR=qx.lang.Function.listener(this.__kk,this);this.__jS=qx.lang.Function.listener(this.__ki,this);this.__jT=qx.lang.Function.listener(this.__kh,this);this.__jU=qx.lang.Function.listener(this.__ke,this);qx.bom.Event.addNativeListener(this._document,i,this.__jQ,true);qx.bom.Event.addNativeListener(this._document,h,this.__jR,true);qx.bom.Event.addNativeListener(this._window,f,this.__jS,true);qx.bom.Event.addNativeListener(this._window,g,this.__jT,true);qx.bom.Event.addNativeListener(this._window,y,this.__jU,true);},"mshtml":function(){this.__jQ=qx.lang.Function.listener(this.__kj,this);this.__jR=qx.lang.Function.listener(this.__kk,this);this.__jW=qx.lang.Function.listener(this.__kf,this);this.__jX=qx.lang.Function.listener(this.__kg,this);this.__jV=qx.lang.Function.listener(this.__km,this);qx.bom.Event.addNativeListener(this._document,i,this.__jQ);qx.bom.Event.addNativeListener(this._document,h,this.__jR);qx.bom.Event.addNativeListener(this._document,b,this.__jW);qx.bom.Event.addNativeListener(this._document,a,this.__jX);qx.bom.Event.addNativeListener(this._document,d,this.__jV);},"webkit":function(){this.__jQ=qx.lang.Function.listener(this.__kj,this);this.__jR=qx.lang.Function.listener(this.__kk,this);this.__jX=qx.lang.Function.listener(this.__kg,this);this.__jS=qx.lang.Function.listener(this.__ki,this);this.__jT=qx.lang.Function.listener(this.__kh,this);this.__jV=qx.lang.Function.listener(this.__km,this);qx.bom.Event.addNativeListener(this._document,i,this.__jQ,true);qx.bom.Event.addNativeListener(this._document,h,this.__jR,true);qx.bom.Event.addNativeListener(this._document,d,this.__jV,false);qx.bom.Event.addNativeListener(this._window,c,this.__jX,true);qx.bom.Event.addNativeListener(this._window,f,this.__jS,true);qx.bom.Event.addNativeListener(this._window,g,this.__jT,true);},"opera":function(){this.__jQ=qx.lang.Function.listener(this.__kj,this);this.__jR=qx.lang.Function.listener(this.__kk,this);this.__jW=qx.lang.Function.listener(this.__kf,this);this.__jX=qx.lang.Function.listener(this.__kg,this);qx.bom.Event.addNativeListener(this._document,i,this.__jQ,true);qx.bom.Event.addNativeListener(this._document,h,this.__jR,true);qx.bom.Event.addNativeListener(this._window,z,this.__jW,true);qx.bom.Event.addNativeListener(this._window,c,this.__jX,true);}}),_stopObserver:qx.core.Variant.select(j,{"gecko":function(){qx.bom.Event.removeNativeListener(this._document,i,this.__jQ,true);qx.bom.Event.removeNativeListener(this._document,h,this.__jR,true);qx.bom.Event.removeNativeListener(this._window,f,this.__jS,true);qx.bom.Event.removeNativeListener(this._window,g,this.__jT,true);qx.bom.Event.removeNativeListener(this._window,y,this.__jU,true);},"mshtml":function(){qx.bom.Event.removeNativeListener(this._document,i,this.__jQ);qx.bom.Event.removeNativeListener(this._document,h,this.__jR);qx.bom.Event.removeNativeListener(this._document,b,this.__jW);qx.bom.Event.removeNativeListener(this._document,a,this.__jX);qx.bom.Event.removeNativeListener(this._document,d,this.__jV);},"webkit":function(){qx.bom.Event.removeNativeListener(this._document,i,this.__jQ,true);qx.bom.Event.removeNativeListener(this._document,h,this.__jR,true);qx.bom.Event.removeNativeListener(this._document,d,this.__jV,false);qx.bom.Event.removeNativeListener(this._window,c,this.__jX,true);qx.bom.Event.removeNativeListener(this._window,f,this.__jS,true);qx.bom.Event.removeNativeListener(this._window,g,this.__jT,true);},"opera":function(){qx.bom.Event.removeNativeListener(this._document,i,this.__jQ,true);qx.bom.Event.removeNativeListener(this._document,h,this.__jR,true);qx.bom.Event.removeNativeListener(this._window,z,this.__jW,true);qx.bom.Event.removeNativeListener(this._window,c,this.__jX,true);}}),__ke:qx.event.GlobalError.observeMethod(qx.core.Variant.select(j,{"gecko":function(bb){var bc=qx.bom.Event.getTarget(bb);if(!this.__kq(bc)){qx.bom.Event.preventDefault(bb);}},"default":null})),__kf:qx.event.GlobalError.observeMethod(qx.core.Variant.select(j,{"mshtml":function(bd){this.__kd();var bf=qx.bom.Event.getTarget(bd);var be=this.__ko(bf);if(be){this.setFocus(be);}this.tryActivate(bf);},"opera":function(bg){var bh=qx.bom.Event.getTarget(bg);if(bh==this._document||bh==this._window){this.__kd();if(this.__jY){this.setFocus(this.__jY);delete this.__jY;}if(this.__ka){this.setActive(this.__ka);delete this.__ka;}}else{this.setFocus(bh);this.tryActivate(bh);if(!this.__kq(bh)){bh.selectionStart=0;bh.selectionEnd=0;}}},"default":null})),__kg:qx.event.GlobalError.observeMethod(qx.core.Variant.select(j,{"mshtml":function(bi){if(!bi.toElement){this.__kc();this.resetFocus();this.resetActive();}},"webkit":function(bj){var bk=qx.bom.Event.getTarget(bj);if(bk===this.getFocus()){this.resetFocus();}if(bk===this.getActive()){this.resetActive();}},"opera":function(bl){var bm=qx.bom.Event.getTarget(bl);if(bm==this._document){this.__kc();this.__jY=this.getFocus();this.__ka=this.getActive();this.resetFocus();this.resetActive();}else{if(bm===this.getFocus()){this.resetFocus();}if(bm===this.getActive()){this.resetActive();}}},"default":null})),__kh:qx.event.GlobalError.observeMethod(qx.core.Variant.select(j,{"gecko":function(bn){var bo=qx.bom.Event.getTarget(bn);if(bo===this._window||bo===this._document){this.__kc();this.resetActive();this.resetFocus();}},"webkit":function(bp){var bq=qx.bom.Event.getTarget(bp);if(bq===this._window||bq===this._document){this.__kc();this.__jY=this.getFocus();this.__ka=this.getActive();this.resetActive();this.resetFocus();}},"default":null})),__ki:qx.event.GlobalError.observeMethod(qx.core.Variant.select(j,{"gecko":function(br){var bs=qx.bom.Event.getTarget(br);if(bs===this._window||bs===this._document){this.__kd();bs=this._body;}this.setFocus(bs);this.tryActivate(bs);},"webkit":function(bt){var bu=qx.bom.Event.getTarget(bt);if(bu===this._window||bu===this._document){this.__kd();if(this.__jY){this.setFocus(this.__jY);delete this.__jY;}if(this.__ka){this.setActive(this.__ka);delete this.__ka;}}else{this.setFocus(bu);this.tryActivate(bu);}},"default":null})),__kj:qx.event.GlobalError.observeMethod(qx.core.Variant.select(j,{"gecko":function(bv){var bx=qx.bom.Event.getTarget(bv);var bw=this.__ko(bx);if(!bw){qx.bom.Event.preventDefault(bv);}else if(bw===this._body){this.setFocus(bw);}},"mshtml":function(by){var bA=qx.bom.Event.getTarget(by);var bz=this.__ko(bA);if(bz){if(!this.__kq(bA)){bA.unselectable=e;try{document.selection.empty();}catch(bB){}try{bz.focus();}catch(bC){}}}else{qx.bom.Event.preventDefault(by);if(!this.__kq(bA)){bA.unselectable=e;}}},"webkit":function(bD){var bF=qx.bom.Event.getTarget(bD);var bE=this.__ko(bF);if(bE){this.setFocus(bE);}else{qx.bom.Event.preventDefault(bD);}},"opera":function(bG){var bJ=qx.bom.Event.getTarget(bG);var bH=this.__ko(bJ);if(!this.__kq(bJ)){qx.bom.Event.preventDefault(bG);if(bH){var bI=this.getFocus();if(bI&&bI.selectionEnd){bI.selectionStart=0;bI.selectionEnd=0;bI.blur();}if(bH){this.setFocus(bH);}}}else if(bH){this.setFocus(bH);}},"default":null})),__kk:qx.event.GlobalError.observeMethod(qx.core.Variant.select(j,{"mshtml":function(bK){var bL=qx.bom.Event.getTarget(bK);if(bL.unselectable){bL.unselectable=p;}this.tryActivate(this.__kl(bL));},"gecko":function(bM){var bN=qx.bom.Event.getTarget(bM);while(bN&&bN.offsetWidth===undefined){bN=bN.parentNode;}if(bN){this.tryActivate(bN);}},"webkit|opera":function(bO){var bP=qx.bom.Event.getTarget(bO);this.tryActivate(this.__kl(bP));},"default":null})),__kl:qx.event.GlobalError.observeMethod(qx.core.Variant.select(j,{"mshtml|webkit":function(bQ){var bR=this.getFocus();if(bR&&bQ!=bR&&(bR.nodeName.toLowerCase()===r||bR.nodeName.toLowerCase()===u)){bQ=bR;}return bQ;},"default":function(bS){return bS;}})),__km:qx.event.GlobalError.observeMethod(qx.core.Variant.select(j,{"mshtml|webkit":function(bT){var bU=qx.bom.Event.getTarget(bT);if(!this.__kq(bU)){qx.bom.Event.preventDefault(bT);}},"default":null})),__kn:function(bV){var bW=qx.bom.element.Attribute.get(bV,o);if(bW>=1){return true;}var bX=qx.event.handler.Focus.FOCUSABLE_ELEMENTS;if(bW>=0&&bX[bV.tagName]){return true;}return false;},__ko:function(bY){while(bY&&bY.nodeType===1){if(bY.getAttribute(k)==e){return null;}if(this.__kn(bY)){return bY;}bY=bY.parentNode;}return this._body;},__kp:function(ca){var cb=ca;while(ca&&ca.nodeType===1){if(ca.getAttribute(l)==e){return null;}ca=ca.parentNode;}return cb;},__kq:function(cc){while(cc&&cc.nodeType===1){var cd=cc.getAttribute(q);if(cd!=null){return cd===e;}cc=cc.parentNode;}return true;},_applyActive:function(ce,cf){if(cf){this.__kb(cf,ce,v,true);}if(ce){this.__kb(ce,cf,m,true);}},_applyFocus:function(cg,ch){if(ch){this.__kb(ch,cg,a,true);}if(cg){this.__kb(cg,ch,b,true);}if(ch){this.__kb(ch,cg,g,false);}if(cg){this.__kb(cg,ch,f,false);}}},destruct:function(){this._stopObserver();this._manager=this._window=this._document=this._root=this._body=this.__kr=null;},defer:function(ci){qx.event.Registration.addHandler(ci);var cj=ci.FOCUSABLE_ELEMENTS;for(var ck in cj){cj[ck.toUpperCase()]=1;}}});})();(function(){var k="qx.client",j="character",i="EndToEnd",h="input",g="textarea",f="StartToStart",e='character',d="qx.bom.Selection",c="button",b="#text",a="body";qx.Class.define(d,{statics:{getSelectionObject:qx.core.Variant.select(k,{"mshtml":function(l){return l.selection;},"default":function(m){return qx.dom.Node.getWindow(m).getSelection();}}),get:qx.core.Variant.select(k,{"mshtml":function(n){var o=qx.bom.Range.get(qx.dom.Node.getDocument(n));return o.text;},"default":function(p){if(this.__lf(p)){return p.value.substring(p.selectionStart,p.selectionEnd);}else{return this.getSelectionObject(qx.dom.Node.getDocument(p)).toString();}}}),getLength:qx.core.Variant.select(k,{"mshtml":function(q){var s=this.get(q);var r=qx.util.StringSplit.split(s,/\r\n/);return s.length-(r.length-1);},"opera":function(t){var y,w,u;if(this.__lf(t)){var x=t.selectionStart;var v=t.selectionEnd;y=t.value.substring(x,v);w=v-x;}else{y=qx.bom.Selection.get(t);w=y.length;}u=qx.util.StringSplit.split(y,/\r\n/);return w-(u.length-1);},"default":function(z){if(this.__lf(z)){return z.selectionEnd-z.selectionStart;}else{return this.get(z).length;}}}),getStart:qx.core.Variant.select(k,{"mshtml":function(A){if(this.__lf(A)){var F=qx.bom.Range.get();if(!A.contains(F.parentElement())){return -1;}var G=qx.bom.Range.get(A);var E=A.value.length;G.moveToBookmark(F.getBookmark());G.moveEnd(e,E);return E-G.text.length;}else{var G=qx.bom.Range.get(A);var C=G.parentElement();var H=qx.bom.Range.get();H.moveToElementText(C);var B=qx.bom.Range.get(qx.dom.Node.getBodyElement(A));B.setEndPoint(f,G);B.setEndPoint(i,H);if(H.compareEndPoints(f,B)==0){return 0;}var D;var I=0;while(true){D=B.moveStart(j,-1);if(H.compareEndPoints(f,B)==0){break;}if(D==0){break;}else{I++;}}return ++I;}},"gecko|webkit":function(J){if(this.__lf(J)){return J.selectionStart;}else{var L=qx.dom.Node.getDocument(J);var K=this.getSelectionObject(L);if(K.anchorOffset<K.focusOffset){return K.anchorOffset;}else{return K.focusOffset;}}},"default":function(M){if(this.__lf(M)){return M.selectionStart;}else{return qx.bom.Selection.getSelectionObject(qx.dom.Node.getDocument(M)).anchorOffset;}}}),getEnd:qx.core.Variant.select(k,{"mshtml":function(N){if(this.__lf(N)){var S=qx.bom.Range.get();if(!N.contains(S.parentElement())){return -1;}var T=qx.bom.Range.get(N);var R=N.value.length;T.moveToBookmark(S.getBookmark());T.moveStart(e,-R);return T.text.length;}else{var T=qx.bom.Range.get(N);var P=T.parentElement();var U=qx.bom.Range.get();U.moveToElementText(P);var R=U.text.length;var O=qx.bom.Range.get(qx.dom.Node.getBodyElement(N));O.setEndPoint(i,T);O.setEndPoint(f,U);if(U.compareEndPoints(i,O)==0){return R-1;}var Q;var V=0;while(true){Q=O.moveEnd(j,1);if(U.compareEndPoints(i,O)==0){break;}if(Q==0){break;}else{V++;}}return R-(++V);}},"gecko|webkit":function(W){if(this.__lf(W)){return W.selectionEnd;}else{var Y=qx.dom.Node.getDocument(W);var X=this.getSelectionObject(Y);if(X.focusOffset>X.anchorOffset){return X.focusOffset;}else{return X.anchorOffset;}}},"default":function(ba){if(this.__lf(ba)){return ba.selectionEnd;}else{return qx.bom.Selection.getSelectionObject(qx.dom.Node.getDocument(ba)).focusOffset;}}}),__lf:function(bb){return qx.dom.Node.isElement(bb)&&(bb.nodeName.toLowerCase()==h||bb.nodeName.toLowerCase()==g);},set:qx.core.Variant.select(k,{"mshtml":function(bc,bd,be){var bf;if(qx.dom.Node.isDocument(bc)){bc=bc.body;}if(qx.dom.Node.isElement(bc)||qx.dom.Node.isText(bc)){switch(bc.nodeName.toLowerCase()){case h:case g:case c:if(be===undefined){be=bc.value.length;}if(bd>=0&&bd<=bc.value.length&&be>=0&&be<=bc.value.length){bf=qx.bom.Range.get(bc);bf.collapse(true);bf.moveStart(j,bd);bf.moveEnd(j,be-bd);bf.select();return true;}break;case b:if(be===undefined){be=bc.nodeValue.length;}if(bd>=0&&bd<=bc.nodeValue.length&&be>=0&&be<=bc.nodeValue.length){bf=qx.bom.Range.get(qx.dom.Node.getBodyElement(bc));bf.moveToElementText(bc.parentNode);bf.collapse(true);bf.moveStart(j,bd);bf.moveEnd(j,be-bd);bf.select();return true;}break;default:if(be===undefined){be=bc.childNodes.length-1;}if(bc.childNodes[bd]&&bc.childNodes[be]){bf=qx.bom.Range.get(qx.dom.Node.getBodyElement(bc));bf.moveToElementText(bc.childNodes[bd]);bf.collapse(true);var bg=qx.bom.Range.get(qx.dom.Node.getBodyElement(bc));bg.moveToElementText(bc.childNodes[be]);bf.setEndPoint(i,bg);bf.select();return true;}}}return false;},"default":function(bh,bi,bj){var bn=bh.nodeName.toLowerCase();if(qx.dom.Node.isElement(bh)&&(bn==h||bn==g)){if(bj===undefined){bj=bh.value.length;}if(bi>=0&&bi<=bh.value.length&&bj>=0&&bj<=bh.value.length){bh.focus();bh.select();bh.setSelectionRange(bi,bj);return true;}}else{var bl=false;var bm=qx.dom.Node.getWindow(bh).getSelection();var bk=qx.bom.Range.get(bh);if(qx.dom.Node.isText(bh)){if(bj===undefined){bj=bh.length;}if(bi>=0&&bi<bh.length&&bj>=0&&bj<=bh.length){bl=true;}}else if(qx.dom.Node.isElement(bh)){if(bj===undefined){bj=bh.childNodes.length-1;}if(bi>=0&&bh.childNodes[bi]&&bj>=0&&bh.childNodes[bj]){bl=true;}}else if(qx.dom.Node.isDocument(bh)){bh=bh.body;if(bj===undefined){bj=bh.childNodes.length-1;}if(bi>=0&&bh.childNodes[bi]&&bj>=0&&bh.childNodes[bj]){bl=true;}}if(bl){if(!bm.isCollapsed){bm.collapseToStart();}bk.setStart(bh,bi);if(qx.dom.Node.isText(bh)){bk.setEnd(bh,bj);}else{bk.setEndAfter(bh.childNodes[bj]);}if(bm.rangeCount>0){bm.removeAllRanges();}bm.addRange(bk);return true;}}return false;}}),setAll:function(bo){return qx.bom.Selection.set(bo,0);},clear:qx.core.Variant.select(k,{"mshtml":function(bp){var bq=qx.bom.Selection.getSelectionObject(qx.dom.Node.getDocument(bp));var br=qx.bom.Range.get(bp);var parent=br.parentElement();var bs=qx.bom.Range.get(qx.dom.Node.getDocument(bp));if(parent==bs.parentElement()&&parent==bp){bq.empty();}},"default":function(bt){var bv=qx.bom.Selection.getSelectionObject(qx.dom.Node.getDocument(bt));var bx=bt.nodeName.toLowerCase();if(qx.dom.Node.isElement(bt)&&(bx==h||bx==g)){bt.setSelectionRange(0,0);qx.bom.Element.blur(bt);}else if(qx.dom.Node.isDocument(bt)||bx==a){bv.collapse(bt.body?bt.body:bt,0);}else{var bw=qx.bom.Range.get(bt);if(!bw.collapsed){var by;var bu=bw.commonAncestorContainer;if(qx.dom.Node.isElement(bt)&&qx.dom.Node.isText(bu)){by=bu.parentNode;}else{by=bu;}if(by==bt){bv.collapse(bt,0);}}}}})}});})();(function(){var l="button",k="qx.bom.Range",j="text",i="password",h="file",g="submit",f="reset",e="textarea",d="input",c="hidden",a="qx.client",b="body";qx.Class.define(k,{statics:{get:qx.core.Variant.select(a,{"mshtml":function(m){if(qx.dom.Node.isElement(m)){switch(m.nodeName.toLowerCase()){case d:switch(m.type){case j:case i:case c:case l:case f:case h:case g:return m.createTextRange();break;default:return qx.bom.Selection.getSelectionObject(qx.dom.Node.getDocument(m)).createRange();}break;case e:case b:case l:return m.createTextRange();break;default:return qx.bom.Selection.getSelectionObject(qx.dom.Node.getDocument(m)).createRange();}}else{if(m==null){m=window;}return qx.bom.Selection.getSelectionObject(qx.dom.Node.getDocument(m)).createRange();}},"default":function(n){var o=qx.dom.Node.getDocument(n);var p=qx.bom.Selection.getSelectionObject(o);if(p.rangeCount>0){return p.getRangeAt(0);}else{return o.createRange();}}})}});})();(function(){var j="",h="m",g="g",f="^",e="qx.util.StringSplit",d="i",c="$(?!\\s)",b="[object RegExp]",a="y";qx.Class.define(e,{statics:{split:function(k,l,m){if(Object.prototype.toString.call(l)!==b){return String.prototype.split.call(k,l,m);}var t=[],n=0,r=(l.ignoreCase?d:j)+(l.multiline?h:j)+(l.sticky?a:j),l=RegExp(l.source,r+g),q,u,o,p,s=/()??/.exec(j)[1]===undefined;k=k+j;if(!s){q=RegExp(f+l.source+c,r);}if(m===undefined||+m<0){m=Infinity;}else{m=Math.floor(+m);if(!m){return [];}}while(u=l.exec(k)){o=u.index+u[0].length;if(o>n){t.push(k.slice(n,u.index));if(!s&&u.length>1){u[0].replace(q,function(){for(var i=1;i<arguments.length-2;i++){if(arguments[i]===undefined){u[i]=undefined;}}});}if(u.length>1&&u.index<k.length){Array.prototype.push.apply(t,u.slice(1));}p=u[0].length;n=o;if(t.length>=m){break;}}if(l.lastIndex===u.index){l.lastIndex++;}}if(n===k.length){if(p||!l.test(j)){t.push(j);}}else{t.push(k.slice(n));}return t.length>m?t.slice(0,m):t;}}});})();(function(){var a="qx.event.type.Focus";qx.Class.define(a,{extend:qx.event.type.Event,members:{init:function(b,c,d){qx.event.type.Event.prototype.init.call(this,d,false);this._target=b;this._relatedTarget=c;return this;}}});})();(function(){var j="",i="undefined",h="qx.client",g="readOnly",f="accessKey",e="qx.bom.element.Attribute",d="rowSpan",c="vAlign",b="className",a="textContent",y="'",x="htmlFor",w="longDesc",v="cellSpacing",u="frameBorder",t="='",s="useMap",r="innerText",q="innerHTML",p="tabIndex",n="dateTime",o="maxLength",l="mshtml",m="cellPadding",k="colSpan";qx.Class.define(e,{statics:{__hb:{names:{"class":b,"for":x,html:q,text:qx.core.Variant.isSet(h,l)?r:a,colspan:k,rowspan:d,valign:c,datetime:n,accesskey:f,tabindex:p,maxlength:o,readonly:g,longdesc:w,cellpadding:m,cellspacing:v,frameborder:u,usemap:s},runtime:{"html":1,"text":1},bools:{compact:1,nowrap:1,ismap:1,declare:1,noshade:1,checked:1,disabled:1,readOnly:1,multiple:1,selected:1,noresize:1,defer:1,allowTransparency:1},property:{$$html:1,$$widget:1,disabled:1,checked:1,readOnly:1,multiple:1,selected:1,value:1,maxLength:1,className:1,innerHTML:1,innerText:1,textContent:1,htmlFor:1,tabIndex:1},qxProperties:{$$widget:1,$$html:1},propertyDefault:{disabled:false,checked:false,readOnly:false,multiple:false,selected:false,value:j,className:j,innerHTML:j,innerText:j,textContent:j,htmlFor:j,tabIndex:0,maxLength:qx.core.Variant.select(h,{"mshtml":2147483647,"webkit":524288,"default":-1})},removeableProperties:{disabled:1,multiple:1,maxLength:1},original:{href:1,src:1,type:1}},compile:function(z){var A=[];var C=this.__hb.runtime;for(var B in z){if(!C[B]){A.push(B,t,z[B],y);}}return A.join(j);},get:qx.core.Variant.select(h,{"mshtml":function(D,name){var F=this.__hb;var E;name=F.names[name]||name;if(F.original[name]){E=D.getAttribute(name,2);}else if(F.property[name]){E=D[name];if(typeof F.propertyDefault[name]!==i&&E==F.propertyDefault[name]){if(typeof F.bools[name]===i){return null;}else{return E;}}}else{E=D.getAttribute(name);}if(F.bools[name]){return !!E;}return E;},"default":function(G,name){var I=this.__hb;var H;name=I.names[name]||name;if(I.property[name]){H=G[name];if(typeof I.propertyDefault[name]!==i&&H==I.propertyDefault[name]){if(typeof I.bools[name]===i){return null;}else{return H;}}}else{H=G.getAttribute(name);}if(I.bools[name]){return !!H;}return H;}}),set:function(J,name,K){if(typeof K===i){return;}var L=this.__hb;name=L.names[name]||name;if(L.bools[name]){K=!!K;}if(L.property[name]&&(!(J[name]===undefined)||L.qxProperties[name])){if(K==null){if(L.removeableProperties[name]){J.removeAttribute(name);return;}else if(typeof L.propertyDefault[name]!==i){K=L.propertyDefault[name];}}J[name]=K;}else{if(K===true){J.setAttribute(name,name);}else if(K===false||K===null){J.removeAttribute(name);}else{J.setAttribute(name,K);}}},reset:function(M,name){this.set(M,name,null);}}});})();(function(){var a="qx.event.type.Drag";qx.Class.define(a,{extend:qx.event.type.Event,members:{init:function(b,c){qx.event.type.Event.prototype.init.call(this,true,b);if(c){this._native=c.getNativeEvent()||null;this._originalTarget=c.getTarget()||null;}else{this._native=null;this._originalTarget=null;}return this;},clone:function(d){var e=qx.event.type.Event.prototype.clone.call(this,d);e._native=this._native;return e;},getDocumentLeft:function(){if(this._native==null){return 0;}if(this._native.pageX!==undefined){return this._native.pageX;}else{var f=qx.dom.Node.getWindow(this._native.srcElement);return this._native.clientX+qx.bom.Viewport.getScrollLeft(f);}},getDocumentTop:function(){if(this._native==null){return 0;}if(this._native.pageY!==undefined){return this._native.pageY;}else{var g=qx.dom.Node.getWindow(this._native.srcElement);return this._native.clientY+qx.bom.Viewport.getScrollTop(g);}},getManager:function(){return qx.event.Registration.getManager(this.getTarget()).getHandler(qx.event.handler.DragDrop);},addType:function(h){this.getManager().addType(h);},addAction:function(i){this.getManager().addAction(i);},supportsType:function(j){return this.getManager().supportsType(j);},supportsAction:function(k){return this.getManager().supportsAction(k);},addData:function(l,m){this.getManager().addData(l,m);},getData:function(n){return this.getManager().getData(n);},getCurrentType:function(){return this.getManager().getCurrentType();},getCurrentAction:function(){return this.getManager().getCurrentAction();}}});})();(function(){var h="interval",g="qx.event.Timer",f="_applyInterval",d="_applyEnabled",c="Boolean",b="qx.event.type.Event",a="Integer";qx.Class.define(g,{extend:qx.core.Object,construct:function(i){qx.core.Object.call(this);this.setEnabled(false);if(i!=null){this.setInterval(i);}var self=this;this.__ey=function(){self._oninterval.call(self);};},events:{"interval":b},statics:{once:function(j,k,l){var m=new qx.event.Timer(l);m.__ez=j;m.addListener(h,function(e){m.stop();j.call(k,e);m.dispose();k=null;},k);m.start();return m;}},properties:{enabled:{init:true,check:c,apply:d},interval:{check:a,init:1000,apply:f}},members:{__eA:null,__ey:null,_applyInterval:function(n,o){if(this.getEnabled()){this.restart();}},_applyEnabled:function(p,q){if(q){window.clearInterval(this.__eA);this.__eA=null;}else if(p){this.__eA=window.setInterval(this.__ey,this.getInterval());}},start:function(){this.setEnabled(true);},startWith:function(r){this.setInterval(r);this.start();},stop:function(){this.setEnabled(false);},restart:function(){this.stop();this.start();},restartWith:function(s){this.stop();this.startWith(s);},_oninterval:qx.event.GlobalError.observeMethod(function(){if(this.$$disposed){return;}if(this.getEnabled()){this.fireEvent(h);}})},destruct:function(){if(this.__eA){window.clearInterval(this.__eA);}this.__eA=this.__ey=null;}});})();(function(){var h="losecapture",g="qx.client",f="blur",e="focus",d="click",c="qx.event.dispatch.MouseCapture",b="capture",a="scroll";qx.Class.define(c,{extend:qx.event.dispatch.AbstractBubbling,construct:function(i,j){qx.event.dispatch.AbstractBubbling.call(this,i);this.__ix=i.getWindow();this.__iy=j;i.addListener(this.__ix,f,this.releaseCapture,this);i.addListener(this.__ix,e,this.releaseCapture,this);i.addListener(this.__ix,a,this.releaseCapture,this);},statics:{PRIORITY:qx.event.Registration.PRIORITY_FIRST},members:{__iy:null,__iz:null,__iA:true,__ix:null,_getParent:function(k){return k.parentNode;},canDispatchEvent:function(l,event,m){return (this.__iz&&this.__iB[m]);},dispatchEvent:function(n,event,o){if(o==d){event.stopPropagation();this.releaseCapture();return;}if(this.__iA||!qx.dom.Hierarchy.contains(this.__iz,n)){n=this.__iz;}qx.event.dispatch.AbstractBubbling.prototype.dispatchEvent.call(this,n,event,o);},__iB:{"mouseup":1,"mousedown":1,"click":1,"dblclick":1,"mousemove":1,"mouseout":1,"mouseover":1},activateCapture:function(p,q){var q=q!==false;if(this.__iz===p&&this.__iA==q){return;}if(this.__iz){this.releaseCapture();}this.nativeSetCapture(p,q);if(this.hasNativeCapture){var self=this;qx.bom.Event.addNativeListener(p,h,function(){qx.bom.Event.removeNativeListener(p,h,arguments.callee);self.releaseCapture();});}this.__iA=q;this.__iz=p;this.__iy.fireEvent(p,b,qx.event.type.Event,[true,false]);},getCaptureElement:function(){return this.__iz;},releaseCapture:function(){var r=this.__iz;if(!r){return;}this.__iz=null;this.__iy.fireEvent(r,h,qx.event.type.Event,[true,false]);this.nativeReleaseCapture(r);},hasNativeCapture:qx.bom.client.Engine.MSHTML,nativeSetCapture:qx.core.Variant.select(g,{"mshtml":function(s,t){qx.event.Timer.once(function(){s.setCapture(t!==false);},this,0);},"default":qx.lang.Function.empty}),nativeReleaseCapture:qx.core.Variant.select(g,{"mshtml":function(u){qx.event.Timer.once(function(){u.releaseCapture();},this,0);},"default":qx.lang.Function.empty})},destruct:function(){this.__iz=this.__ix=this.__iy=null;},defer:function(v){qx.event.Registration.addDispatcher(v);}});})();(function(){var a="qx.event.handler.Window";qx.Class.define(a,{extend:qx.core.Object,implement:qx.event.IEventHandler,construct:function(b){qx.core.Object.call(this);this._manager=b;this._window=b.getWindow();this._initWindowObserver();},statics:{PRIORITY:qx.event.Registration.PRIORITY_NORMAL,SUPPORTED_TYPES:{error:1,load:1,beforeunload:1,unload:1,resize:1,scroll:1,beforeshutdown:1},TARGET_CHECK:qx.event.IEventHandler.TARGET_WINDOW,IGNORE_CAN_HANDLE:true},members:{canHandleEvent:function(c,d){},registerEvent:function(f,g,h){},unregisterEvent:function(i,j,k){},_initWindowObserver:function(){this._onNativeWrapper=qx.lang.Function.listener(this._onNative,this);var m=qx.event.handler.Window.SUPPORTED_TYPES;for(var l in m){qx.bom.Event.addNativeListener(this._window,l,this._onNativeWrapper);}},_stopWindowObserver:function(){var o=qx.event.handler.Window.SUPPORTED_TYPES;for(var n in o){qx.bom.Event.removeNativeListener(this._window,n,this._onNativeWrapper);}},_onNative:qx.event.GlobalError.observeMethod(function(e){if(this.isDisposed()){return;}var q=this._window;try{var t=q.document;}catch(e){return ;}var r=t.documentElement;var p=qx.bom.Event.getTarget(e);if(p==null||p===q||p===t||p===r){var event=qx.event.Registration.createEvent(e.type,qx.event.type.Native,[e,q]);qx.event.Registration.dispatchEvent(q,event);var s=event.getReturnValue();if(s!=null){e.returnValue=s;return s;}}})},destruct:function(){this._stopWindowObserver();this._manager=this._window=null;},defer:function(u){qx.event.Registration.addHandler(u);}});})();(function(){var c="qx.bom.Selector";qx.Class.define(c,{statics:{query:null,matches:null}});(function(){var o=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,v=0,r=Object.prototype.toString,p=false,x=true;[0,0].sort(function(){x=false;return 0;});var g=function(z,A,B,C){B=B||[];A=A||document;var L=A;if(A.nodeType!==1&&A.nodeType!==9){return [];}if(!z||typeof z!=="string"){return B;}var m,F,D,H,J,G,M,i,N=true,E=g.isXML(A),I=[],K=z;do{o.exec("");m=o.exec(K);if(m){K=m[3];I.push(m[1]);if(m[2]){H=m[3];break;}}}while(m);if(I.length>1&&q.exec(z)){if(I.length===2&&k.relative[I[0]]){F=h(I[0]+I[1],A);}else{F=k.relative[I[0]]?[A]:g(I.shift(),A);while(I.length){z=I.shift();if(k.relative[z]){z+=I.shift();}F=h(z,F);}}}else{if(!C&&I.length>1&&A.nodeType===9&&!E&&k.match.ID.test(I[0])&&!k.match.ID.test(I[I.length-1])){J=g.find(I.shift(),A,E);A=J.expr?g.filter(J.expr,J.set)[0]:J.set[0];}if(A){J=C?{expr:I.pop(),set:f(C)}:g.find(I.pop(),I.length===1&&(I[0]==="~"||I[0]==="+")&&A.parentNode?A.parentNode:A,E);F=J.expr?g.filter(J.expr,J.set):J.set;if(I.length>0){D=f(F);}else{N=false;}while(I.length){G=I.pop();M=G;if(!k.relative[G]){G="";}else{M=I.pop();}if(M==null){M=A;}k.relative[G](D,M,E);}}else{D=I=[];}}if(!D){D=F;}if(!D){g.error(G||z);}if(r.call(D)==="[object Array]"){if(!N){B.push.apply(B,D);}else if(A&&A.nodeType===1){for(i=0;D[i]!=null;i++){if(D[i]&&(D[i]===true||D[i].nodeType===1&&g.contains(A,D[i]))){B.push(F[i]);}}}else{for(i=0;D[i]!=null;i++){if(D[i]&&D[i].nodeType===1){B.push(F[i]);}}}}else{f(D,B);}if(H){g(H,L,B,C);g.uniqueSort(B);}return B;};g.uniqueSort=function(O){if(s){p=x;O.sort(s);if(p){for(var i=1;i<O.length;i++){if(O[i]===O[i-1]){O.splice(i--,1);}}}}return O;};g.matches=function(P,Q){return g(P,null,null,Q);};g.matchesSelector=function(R,S){return g(S,null,null,[R]).length>0;};g.find=function(T,U,V){var W;if(!T){return [];}for(var i=0,l=k.order.length;i<l;i++){var Y,X=k.order[i];if((Y=k.leftMatch[X].exec(T))){var ba=Y[1];Y.splice(1,1);if(ba.substr(ba.length-1)!=="\\"){Y[1]=(Y[1]||"").replace(/\\/g,"");W=k.find[X](Y,U,V);if(W!=null){T=T.replace(k.match[X],"");break;}}}}if(!W){W=U.getElementsByTagName("*");}return {set:W,expr:T};};g.filter=function(bb,bc,bd,be){var br,bq,bf=bb,bk=[],bg=bc,bh=bc&&bc[0]&&g.isXML(bc[0]);while(bb&&bc.length){for(var bo in k.filter){if((br=k.leftMatch[bo].exec(bb))!=null&&br[2]){var bn,bj,bi=k.filter[bo],bs=br[1];bq=false;br.splice(1,1);if(bs.substr(bs.length-1)==="\\"){continue;}if(bg===bk){bk=[];}if(k.preFilter[bo]){br=k.preFilter[bo](br,bg,bd,bk,be,bh);if(!br){bq=bn=true;}else if(br===true){continue;}}if(br){for(var i=0;(bj=bg[i])!=null;i++){if(bj){bn=bi(bj,br,i,bg);var bm=be^!!bn;if(bd&&bn!=null){if(bm){bq=true;}else{bg[i]=false;}}else if(bm){bk.push(bj);bq=true;}}}}if(bn!==undefined){if(!bd){bg=bk;}bb=bb.replace(k.match[bo],"");if(!bq){return [];}break;}}}if(bb===bf){if(bq==null){g.error(bb);}else{break;}}bf=bb;}return bg;};g.error=function(bt){throw "Syntax error, unrecognized expression: "+bt;};var k=g.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(bu){return bu.getAttribute("href");}},relative:{"+":function(bv,bw){var bx=typeof bw==="string",bz=bx&&!/\W/.test(bw),bA=bx&&!bz;if(bz){bw=bw.toLowerCase();}for(var i=0,l=bv.length,by;i<l;i++){if((by=bv[i])){while((by=by.previousSibling)&&by.nodeType!==1){}bv[i]=bA||by&&by.nodeName.toLowerCase()===bw?by||false:by===bw;}}if(bA){g.filter(bw,bv,true);}},">":function(bB,bC){var bE,bD=typeof bC==="string",i=0,l=bB.length;if(bD&&!/\W/.test(bC)){bC=bC.toLowerCase();for(;i<l;i++){bE=bB[i];if(bE){var parent=bE.parentNode;bB[i]=parent.nodeName.toLowerCase()===bC?parent:false;}}}else{for(;i<l;i++){bE=bB[i];if(bE){bB[i]=bD?bE.parentNode:bE.parentNode===bC;}}if(bD){g.filter(bC,bB,true);}}},"":function(bF,bG,bH){var bK,bI=v++,bJ=w;if(typeof bG==="string"&&!/\W/.test(bG)){bG=bG.toLowerCase();bK=bG;bJ=y;}bJ("parentNode",bG,bI,bF,bK,bH);},"~":function(bL,bM,bN){var bQ,bO=v++,bP=w;if(typeof bM==="string"&&!/\W/.test(bM)){bM=bM.toLowerCase();bQ=bM;bP=y;}bP("previousSibling",bM,bO,bL,bQ,bN);}},find:{ID:function(bR,bS,bT){if(typeof bS.getElementById!=="undefined"&&!bT){var m=bS.getElementById(bR[1]);return m&&m.parentNode?[m]:[];}},NAME:function(bU,bV){if(typeof bV.getElementsByName!=="undefined"){var bX=[],bW=bV.getElementsByName(bU[1]);for(var i=0,l=bW.length;i<l;i++){if(bW[i].getAttribute("name")===bU[1]){bX.push(bW[i]);}}return bX.length===0?null:bX;}},TAG:function(bY,ca){return ca.getElementsByTagName(bY[1]);}},preFilter:{CLASS:function(cb,cc,cd,ce,cf,cg){cb=" "+cb[1].replace(/\\/g,"")+" ";if(cg){return cb;}for(var i=0,ch;(ch=cc[i])!=null;i++){if(ch){if(cf^(ch.className&&(" "+ch.className+" ").replace(/[\t\n]/g," ").indexOf(cb)>=0)){if(!cd){ce.push(ch);}}else if(cd){cc[i]=false;}}}return false;},ID:function(ci){return ci[1].replace(/\\/g,"");},TAG:function(cj,ck){return cj[1].toLowerCase();},CHILD:function(cl){if(cl[1]==="nth"){var cm=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(cl[2]==="even"&&"2n"||cl[2]==="odd"&&"2n+1"||!/\D/.test(cl[2])&&"0n+"+cl[2]||cl[2]);cl[2]=(cm[1]+(cm[2]||1))-0;cl[3]=cm[3]-0;}cl[0]=v++;return cl;},ATTR:function(cn,co,cp,cq,cr,cs){var name=cn[1].replace(/\\/g,"");if(!cs&&k.attrMap[name]){cn[1]=k.attrMap[name];}if(cn[2]==="~="){cn[4]=" "+cn[4]+" ";}return cn;},PSEUDO:function(ct,cu,cv,cw,cx){if(ct[1]==="not"){if((o.exec(ct[3])||"").length>1||/^\w/.test(ct[3])){ct[3]=g(ct[3],null,null,cu);}else{var cy=g.filter(ct[3],cu,cv,true^cx);if(!cv){cw.push.apply(cw,cy);}return false;}}else if(k.match.POS.test(ct[0])||k.match.CHILD.test(ct[0])){return true;}return ct;},POS:function(cz){cz.unshift(true);return cz;}},filters:{enabled:function(cA){return cA.disabled===false&&cA.type!=="hidden";},disabled:function(cB){return cB.disabled===true;},checked:function(cC){return cC.checked===true;},selected:function(cD){cD.parentNode.selectedIndex;return cD.selected===true;},parent:function(cE){return !!cE.firstChild;},empty:function(cF){return !cF.firstChild;},has:function(cG,i,cH){return !!g(cH[3],cG).length;},header:function(cI){return (/h\d/i).test(cI.nodeName);},text:function(cJ){return "text"===cJ.type;},radio:function(cK){return "radio"===cK.type;},checkbox:function(cL){return "checkbox"===cL.type;},file:function(cM){return "file"===cM.type;},password:function(cN){return "password"===cN.type;},submit:function(cO){return "submit"===cO.type;},image:function(cP){return "image"===cP.type;},reset:function(cQ){return "reset"===cQ.type;},button:function(cR){return "button"===cR.type||cR.nodeName.toLowerCase()==="button";},input:function(cS){return (/input|select|textarea|button/i).test(cS.nodeName);}},setFilters:{first:function(cT,i){return i===0;},last:function(cU,i,cV,cW){return i===cW.length-1;},even:function(cX,i){return i%2===0;},odd:function(cY,i){return i%2===1;},lt:function(da,i,db){return i<db[3]-0;},gt:function(dc,i,dd){return i>dd[3]-0;},nth:function(de,i,df){return df[3]-0===i;},eq:function(dg,i,dh){return dh[3]-0===i;}},filter:{PSEUDO:function(di,dj,i,dk){var name=dj[1],dl=k.filters[name];if(dl){return dl(di,i,dj,dk);}else if(name==="contains"){return (di.textContent||di.innerText||g.getText([di])||"").indexOf(dj[3])>=0;}else if(name==="not"){var dm=dj[3];for(var j=0,l=dm.length;j<l;j++){if(dm[j]===di){return false;}}return true;}else{g.error("Syntax error, unrecognized expression: "+name);}},CHILD:function(dn,dp){var dv=dp[1],dq=dn;switch(dv){case "only":case "first":while((dq=dq.previousSibling)){if(dq.nodeType===1){return false;}}if(dv==="first"){return true;}dq=dn;case "last":while((dq=dq.nextSibling)){if(dq.nodeType===1){return false;}}return true;case "nth":var dw=dp[2],ds=dp[3];if(dw===1&&ds===0){return true;}var du=dp[0],parent=dn.parentNode;if(parent&&(parent.sizcache!==du||!dn.nodeIndex)){var dr=0;for(dq=parent.firstChild;dq;dq=dq.nextSibling){if(dq.nodeType===1){dq.nodeIndex=++dr;}}parent.sizcache=du;}var dt=dn.nodeIndex-ds;if(dw===0){return dt===0;}else{return (dt%dw===0&&dt/dw>=0);}}},ID:function(dx,dy){return dx.nodeType===1&&dx.getAttribute("id")===dy;},TAG:function(dz,dA){return (dA==="*"&&dz.nodeType===1)||dz.nodeName.toLowerCase()===dA;},CLASS:function(dB,dC){return (" "+(dB.className||dB.getAttribute("class"))+" ").indexOf(dC)>-1;},ATTR:function(dD,dE){var name=dE[1],dI=k.attrHandle[name]?k.attrHandle[name](dD):dD[name]!=null?dD[name]:dD.getAttribute(name),dH=dI+"",dG=dE[2],dF=dE[4];return dI==null?dG==="!=":dG==="="?dH===dF:dG==="*="?dH.indexOf(dF)>=0:dG==="~="?(" "+dH+" ").indexOf(dF)>=0:!dF?dH&&dI!==false:dG==="!="?dH!==dF:dG==="^="?dH.indexOf(dF)===0:dG==="$="?dH.substr(dH.length-dF.length)===dF:dG==="|="?dH===dF||dH.substr(0,dF.length+1)===dF+"-":false;},POS:function(dJ,dK,i,dL){var name=dK[2],dM=k.setFilters[name];if(dM){return dM(dJ,i,dK,dL);}}}};var q=k.match.POS,d=function(dN,dO){return "\\"+(dO-0+1);};for(var u in k.match){k.match[u]=new RegExp(k.match[u].source+(/(?![^\[]*\])(?![^\(]*\))/.source));k.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+k.match[u].source.replace(/\\(\d+)/g,d));}var f=function(dP,dQ){dP=Array.prototype.slice.call(dP,0);if(dQ){dQ.push.apply(dQ,dP);return dQ;}return dP;};try{Array.prototype.slice.call(document.documentElement.childNodes,0)[0].nodeType;}catch(e){f=function(dR,dS){var i=0,dT=dS||[];if(r.call(dR)==="[object Array]"){Array.prototype.push.apply(dT,dR);}else{if(typeof dR.length==="number"){for(var l=dR.length;i<l;i++){dT.push(dR[i]);}}else{for(;dR[i];i++){dT.push(dR[i]);}}}return dT;};}var s,n;if(document.documentElement.compareDocumentPosition){s=function(a,b){if(a===b){p=true;return 0;}if(!a.compareDocumentPosition||!b.compareDocumentPosition){return a.compareDocumentPosition?-1:1;}return a.compareDocumentPosition(b)&4?-1:1;};}else{s=function(a,b){var dY,dW,ea=[],eb=[],dV=a.parentNode,dX=b.parentNode,dU=dV;if(a===b){p=true;return 0;}else if(dV===dX){return n(a,b);}else if(!dV){return -1;}else if(!dX){return 1;}while(dU){ea.unshift(dU);dU=dU.parentNode;}dU=dX;while(dU){eb.unshift(dU);dU=dU.parentNode;}dY=ea.length;dW=eb.length;for(var i=0;i<dY&&i<dW;i++){if(ea[i]!==eb[i]){return n(ea[i],eb[i]);}}return i===dY?n(a,eb[i],-1):n(ea[i],b,1);};n=function(a,b,ec){if(a===b){return ec;}var ed=a.nextSibling;while(ed){if(ed===b){return -1;}ed=ed.nextSibling;}return 1;};}g.getText=function(ee){var eg="",ef;for(var i=0;ee[i];i++){ef=ee[i];if(ef.nodeType===3||ef.nodeType===4){eg+=ef.nodeValue;}else if(ef.nodeType!==8){eg+=g.getText(ef.childNodes);}}return eg;};(function(){var ej=document.createElement("div"),ei="script"+(new Date()).getTime(),eh=document.documentElement;ej.innerHTML="<a name='"+ei+"'/>";eh.insertBefore(ej,eh.firstChild);if(document.getElementById(ei)){k.find.ID=function(ek,el,em){if(typeof el.getElementById!=="undefined"&&!em){var m=el.getElementById(ek[1]);return m?m.id===ek[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===ek[1]?[m]:undefined:[];}};k.filter.ID=function(en,eo){var ep=typeof en.getAttributeNode!=="undefined"&&en.getAttributeNode("id");return en.nodeType===1&&ep&&ep.nodeValue===eo;};}eh.removeChild(ej);eh=ej=null;})();(function(){var eq=document.createElement("div");eq.appendChild(document.createComment(""));if(eq.getElementsByTagName("*").length>0){k.find.TAG=function(er,es){var eu=es.getElementsByTagName(er[1]);if(er[1]==="*"){var et=[];for(var i=0;eu[i];i++){if(eu[i].nodeType===1){et.push(eu[i]);}}eu=et;}return eu;};}eq.innerHTML="<a href='#'></a>";if(eq.firstChild&&typeof eq.firstChild.getAttribute!=="undefined"&&eq.firstChild.getAttribute("href")!=="#"){k.attrHandle.href=function(ev){return ev.getAttribute("href",2);};}eq=null;})();if(document.querySelectorAll){(function(){var ex=g,ew=document.createElement("div"),ey="__sizzle__";ew.innerHTML="<p class='TEST'></p>";if(ew.querySelectorAll&&ew.querySelectorAll(".TEST").length===0){return;}g=function(eA,eB,eC,eD){eB=eB||document;eA=eA.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!eD&&!g.isXML(eB)){if(eB.nodeType===9){try{return f(eB.querySelectorAll(eA),eC);}catch(eG){}}else if(eB.nodeType===1&&eB.nodeName.toLowerCase()!=="object"){var eE=eB.getAttribute("id"),eF=eE||ey;if(!eE){eB.setAttribute("id",eF);}try{return f(eB.querySelectorAll("#"+eF+" "+eA),eC);}catch(eH){}finally{if(!eE){eB.removeAttribute("id");}}}}return ex(eA,eB,eC,eD);};for(var ez in ex){g[ez]=ex[ez];}ew=null;})();}(function(){var eK=document.documentElement,eI=eK.matchesSelector||eK.mozMatchesSelector||eK.webkitMatchesSelector||eK.msMatchesSelector,eJ=false;try{eI.call(document.documentElement,"[test!='']:sizzle");}catch(eL){eJ=true;}if(eI){g.matchesSelector=function(eM,eN){eN=eN.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!g.isXML(eM)){try{if(eJ||!k.match.PSEUDO.test(eN)&&!/!=/.test(eN)){return eI.call(eM,eN);}}catch(e){}}return g(eN,null,null,[eM]).length>0;};}})();(function(){var eO=document.createElement("div");eO.innerHTML="<div class='test e'></div><div class='test'></div>";if(!eO.getElementsByClassName||eO.getElementsByClassName("e").length===0){return;}eO.lastChild.className="e";if(eO.getElementsByClassName("e").length===1){return;}k.order.splice(1,0,"CLASS");k.find.CLASS=function(eP,eQ,eR){if(typeof eQ.getElementsByClassName!=="undefined"&&!eR){return eQ.getElementsByClassName(eP[1]);}};eO=null;})();function y(eS,eT,eU,eV,eW,eX){for(var i=0,l=eV.length;i<l;i++){var fa=eV[i];if(fa){var eY=false;fa=fa[eS];while(fa){if(fa.sizcache===eU){eY=eV[fa.sizset];break;}if(fa.nodeType===1&&!eX){fa.sizcache=eU;fa.sizset=i;}if(fa.nodeName.toLowerCase()===eT){eY=fa;break;}fa=fa[eS];}eV[i]=eY;}}}function w(fb,fc,fd,fe,ff,fg){for(var i=0,l=fe.length;i<l;i++){var fi=fe[i];if(fi){var fh=false;fi=fi[fb];while(fi){if(fi.sizcache===fd){fh=fe[fi.sizset];break;}if(fi.nodeType===1){if(!fg){fi.sizcache=fd;fi.sizset=i;}if(typeof fc!=="string"){if(fi===fc){fh=true;break;}}else if(g.filter(fc,[fi]).length>0){fh=fi;break;}}fi=fi[fb];}fe[i]=fh;}}}if(document.documentElement.contains){g.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):true);};}else if(document.documentElement.compareDocumentPosition){g.contains=function(a,b){return !!(a.compareDocumentPosition(b)&16);};}else{g.contains=function(){return false;};}g.isXML=function(fj){var fk=(fj?fj.ownerDocument||fj:0).documentElement;return fk?fk.nodeName!=="HTML":false;};var h=function(fl,fm){var fq,fo=[],fn="",fp=fm.nodeType?[fm]:fm;while((fq=k.match.PSEUDO.exec(fl))){fn+=fq[0];fl=fl.replace(k.match.PSEUDO,"");}fl=k.relative[fl]?fl+"*":fl;for(var i=0,l=fp.length;i<l;i++){g(fl,fp[i],fo);}return g.filter(fn,fo);};var t=qx.bom.Selector;t.query=function(fr,fs){return g(fr,fs);};t.matches=function(ft,fu){return g(ft,null,null,fu);};})();})();(function(){var r="qx.client",q="",p="mshtml",o="'",n="SelectionLanguage",m="qx.xml.Document",k=" />",j="MSXML2.DOMDocument.3.0",h='<\?xml version="1.0" encoding="utf-8"?>\n<',g="MSXML2.XMLHTTP.3.0",c="MSXML2.XMLHTTP.6.0",f=" xmlns='",e="text/xml",b="XPath",a="MSXML2.DOMDocument.6.0",d="HTML";qx.Class.define(m,{statics:{DOMDOC:null,XMLHTTP:null,isXmlDocument:function(s){if(s.nodeType===9){return s.documentElement.nodeName!==d;}else if(s.ownerDocument){return this.isXmlDocument(s.ownerDocument);}else{return false;}},create:qx.core.Variant.select(r,{"mshtml":function(t,u){var v=new ActiveXObject(this.DOMDOC);v.setProperty(n,b);if(u){var w=h;w+=u;if(t){w+=f+t+o;}w+=k;v.loadXML(w);}return v;},"default":function(x,y){return document.implementation.createDocument(x||q,y||q,null);}}),fromString:qx.core.Variant.select(r,{"mshtml":function(z){var A=qx.xml.Document.create();A.loadXML(z);return A;},"default":function(B){var C=new DOMParser();return C.parseFromString(B,e);}})},defer:function(D){if(qx.core.Variant.isSet(r,p)){var E=[a,j];var F=[c,g];for(var i=0,l=E.length;i<l;i++){try{new ActiveXObject(E[i]);new ActiveXObject(F[i]);}catch(G){continue;}D.DOMDOC=E[i];D.XMLHTTP=F[i];break;}}}});})();(function(){var k="visible",j="scroll",i="borderBottomWidth",h="borderTopWidth",g="left",f="borderLeftWidth",e="bottom",d="top",c="right",b="qx.bom.element.Scroll",a="borderRightWidth";qx.Class.define(b,{statics:{intoViewX:function(l,stop,m){var parent=l.parentNode;var r=qx.dom.Node.getDocument(l);var n=r.body;var z,x,u;var B,s,C;var v,D,G;var E,p,y,o;var t,F,w;var q=m===g;var A=m===c;stop=stop?stop.parentNode:r;while(parent&&parent!=stop){if(parent.scrollWidth>parent.clientWidth&&(parent===n||qx.bom.element.Overflow.getY(parent)!=k)){if(parent===n){x=parent.scrollLeft;u=x+qx.bom.Viewport.getWidth();B=qx.bom.Viewport.getWidth();s=parent.clientWidth;C=parent.scrollWidth;v=0;D=0;G=0;}else{z=qx.bom.element.Location.get(parent);x=z.left;u=z.right;B=parent.offsetWidth;s=parent.clientWidth;C=parent.scrollWidth;v=parseInt(qx.bom.element.Style.get(parent,f),10)||0;D=parseInt(qx.bom.element.Style.get(parent,a),10)||0;G=B-s-v-D;}E=qx.bom.element.Location.get(l);p=E.left;y=E.right;o=l.offsetWidth;t=p-x-v;F=y-u+D;w=0;if(q){w=t;}else if(A){w=F+G;}else if(t<0||o>s){w=t;}else if(F>0){w=F+G;}parent.scrollLeft+=w;if(qx.bom.client.Engine.GECKO||qx.bom.client.Engine.OPERA){qx.event.Registration.fireNonBubblingEvent(parent,j);}}if(parent===n){break;}parent=parent.parentNode;}},intoViewY:function(H,stop,I){var parent=H.parentNode;var O=qx.dom.Node.getDocument(H);var J=O.body;var W,K,S;var Y,V,Q;var M,N,L;var bb,bc,X,R;var U,P,bd;var ba=I===d;var T=I===e;stop=stop?stop.parentNode:O;while(parent&&parent!=stop){if(parent.scrollHeight>parent.clientHeight&&(parent===J||qx.bom.element.Overflow.getY(parent)!=k)){if(parent===J){K=parent.scrollTop;S=K+qx.bom.Viewport.getHeight();Y=qx.bom.Viewport.getHeight();V=parent.clientHeight;Q=parent.scrollHeight;M=0;N=0;L=0;}else{W=qx.bom.element.Location.get(parent);K=W.top;S=W.bottom;Y=parent.offsetHeight;V=parent.clientHeight;Q=parent.scrollHeight;M=parseInt(qx.bom.element.Style.get(parent,h),10)||0;N=parseInt(qx.bom.element.Style.get(parent,i),10)||0;L=Y-V-M-N;}bb=qx.bom.element.Location.get(H);bc=bb.top;X=bb.bottom;R=H.offsetHeight;U=bc-K-M;P=X-S+N;bd=0;if(ba){bd=U;}else if(T){bd=P+L;}else if(U<0||R>V){bd=U;}else if(P>0){bd=P+L;}parent.scrollTop+=bd;if(qx.bom.client.Engine.GECKO||qx.bom.client.Engine.OPERA){qx.event.Registration.fireNonBubblingEvent(parent,j);}}if(parent===J){break;}parent=parent.parentNode;}},intoView:function(be,stop,bf,bg){this.intoViewX(be,stop,bf);this.intoViewY(be,stop,bg);}}});})();(function(){var k="",j="qx.client",i="hidden",h="-moz-scrollbars-none",g="overflow",f=";",e="overflowY",d=":",b="overflowX",a="overflow:",y="none",x="scroll",w="borderLeftStyle",v="borderRightStyle",u="div",r="borderRightWidth",q="overflow-y",p="borderLeftWidth",o="-moz-scrollbars-vertical",n="100px",l="qx.bom.element.Overflow",m="overflow-x";qx.Class.define(l,{statics:{__kL:null,getScrollbarWidth:function(){if(this.__kL!==null){return this.__kL;}var z=qx.bom.element.Style;var B=function(F,G){return parseInt(z.get(F,G),10)||0;};var C=function(H){return (z.get(H,v)==y?0:B(H,r));};var A=function(I){return (z.get(I,w)==y?0:B(I,p));};var E=qx.core.Variant.select(j,{"mshtml":function(J){if(z.get(J,e)==i||J.clientWidth==0){return C(J);}return Math.max(0,J.offsetWidth-J.clientLeft-J.clientWidth);},"default":function(K){if(K.clientWidth==0){var L=z.get(K,g);var M=(L==x||L==o?16:0);return Math.max(0,C(K)+M);}return Math.max(0,(K.offsetWidth-K.clientWidth-A(K)));}});var D=function(N){return E(N)-C(N);};var t=document.createElement(u);var s=t.style;s.height=s.width=n;s.overflow=x;document.body.appendChild(t);var c=D(t);this.__kL=c?c:16;document.body.removeChild(t);return this.__kL;},_compile:qx.core.Variant.select(j,{"gecko":qx.bom.client.Engine.VERSION<1.8?function(O,P){if(P==i){P=h;}return a+P+f;}:function(Q,R){return Q+d+R+f;},"opera":qx.bom.client.Engine.VERSION<9.5?function(S,T){return a+T+f;}:function(U,V){return U+d+V+f;},"default":function(W,X){return W+d+X+f;}}),compileX:function(Y){return this._compile(m,Y);},compileY:function(ba){return this._compile(q,ba);},getX:qx.core.Variant.select(j,{"gecko":qx.bom.client.Engine.VERSION<1.8?function(bb,bc){var bd=qx.bom.element.Style.get(bb,g,bc,false);if(bd===h){bd=i;}return bd;}:function(be,bf){return qx.bom.element.Style.get(be,b,bf,false);},"opera":qx.bom.client.Engine.VERSION<9.5?function(bg,bh){return qx.bom.element.Style.get(bg,g,bh,false);}:function(bi,bj){return qx.bom.element.Style.get(bi,b,bj,false);},"default":function(bk,bl){return qx.bom.element.Style.get(bk,b,bl,false);}}),setX:qx.core.Variant.select(j,{"gecko":qx.bom.client.Engine.VERSION<1.8?function(bm,bn){if(bn==i){bn=h;}bm.style.overflow=bn;}:function(bo,bp){bo.style.overflowX=bp;},"opera":qx.bom.client.Engine.VERSION<9.5?function(bq,br){bq.style.overflow=br;}:function(bs,bt){bs.style.overflowX=bt;},"default":function(bu,bv){bu.style.overflowX=bv;}}),resetX:qx.core.Variant.select(j,{"gecko":qx.bom.client.Engine.VERSION<1.8?function(bw){bw.style.overflow=k;}:function(bx){bx.style.overflowX=k;},"opera":qx.bom.client.Engine.VERSION<9.5?function(by,bz){by.style.overflow=k;}:function(bA,bB){bA.style.overflowX=k;},"default":function(bC){bC.style.overflowX=k;}}),getY:qx.core.Variant.select(j,{"gecko":qx.bom.client.Engine.VERSION<1.8?function(bD,bE){var bF=qx.bom.element.Style.get(bD,g,bE,false);if(bF===h){bF=i;}return bF;}:function(bG,bH){return qx.bom.element.Style.get(bG,e,bH,false);},"opera":qx.bom.client.Engine.VERSION<9.5?function(bI,bJ){return qx.bom.element.Style.get(bI,g,bJ,false);}:function(bK,bL){return qx.bom.element.Style.get(bK,e,bL,false);},"default":function(bM,bN){return qx.bom.element.Style.get(bM,e,bN,false);}}),setY:qx.core.Variant.select(j,{"gecko":qx.bom.client.Engine.VERSION<1.8?function(bO,bP){if(bP===i){bP=h;}bO.style.overflow=bP;}:function(bQ,bR){bQ.style.overflowY=bR;},"opera":qx.bom.client.Engine.VERSION<9.5?function(bS,bT){bS.style.overflow=bT;}:function(bU,bV){bU.style.overflowY=bV;},"default":function(bW,bX){bW.style.overflowY=bX;}}),resetY:qx.core.Variant.select(j,{"gecko":qx.bom.client.Engine.VERSION<1.8?function(bY){bY.style.overflow=k;}:function(ca){ca.style.overflowY=k;},"opera":qx.bom.client.Engine.VERSION<9.5?function(cb,cc){cb.style.overflow=k;}:function(cd,ce){cd.style.overflowY=k;},"default":function(cf){cf.style.overflowY=k;}})}});})();(function(){var q="qx.client",p="",o="boxSizing",n="box-sizing",m=":",k="border-box",j="qx.bom.element.BoxSizing",h="KhtmlBoxSizing",g="-moz-box-sizing",f="WebkitBoxSizing",c=";",e="-khtml-box-sizing",d="content-box",b="-webkit-box-sizing",a="MozBoxSizing";qx.Class.define(j,{statics:{__cH:qx.core.Variant.select(q,{"mshtml":null,"webkit":[o,h,f],"gecko":[a],"opera":[o]}),__cI:qx.core.Variant.select(q,{"mshtml":null,"webkit":[n,e,b],"gecko":[g],"opera":[n]}),__cJ:{tags:{button:true,select:true},types:{search:true,button:true,submit:true,reset:true,checkbox:true,radio:true}},__cK:function(r){var s=this.__cJ;return s.tags[r.tagName.toLowerCase()]||s.types[r.type];},compile:qx.core.Variant.select(q,{"mshtml":function(t){{};},"default":function(u){var w=this.__cI;var v=p;if(w){for(var i=0,l=w.length;i<l;i++){v+=w[i]+m+u+c;}}return v;}}),get:qx.core.Variant.select(q,{"mshtml":function(x){if(qx.bom.Document.isStandardMode(qx.dom.Node.getDocument(x))){if(!this.__cK(x)){return d;}}return k;},"default":function(y){var A=this.__cH;var z;if(A){for(var i=0,l=A.length;i<l;i++){z=qx.bom.element.Style.get(y,A[i],null,false);if(z!=null&&z!==p){return z;}}}return p;}}),set:qx.core.Variant.select(q,{"mshtml":function(B,C){{};},"default":function(D,E){var F=this.__cH;if(F){for(var i=0,l=F.length;i<l;i++){D.style[F[i]]=E;}}}}),reset:function(G){this.set(G,p);}}});})();(function(){var k="n-resize",j="e-resize",i="nw-resize",h="ne-resize",g="",f="cursor:",e="qx.client",d=";",c="qx.bom.element.Cursor",b="cursor",a="hand";qx.Class.define(c,{statics:{__eR:qx.core.Variant.select(e,{"mshtml":{"cursor":a,"ew-resize":j,"ns-resize":k,"nesw-resize":h,"nwse-resize":i},"opera":{"col-resize":j,"row-resize":k,"ew-resize":j,"ns-resize":k,"nesw-resize":h,"nwse-resize":i},"default":{}}),compile:function(l){return f+(this.__eR[l]||l)+d;},get:function(m,n){return qx.bom.element.Style.get(m,b,n,false);},set:function(o,p){o.style.cursor=this.__eR[p]||p;},reset:function(q){q.style.cursor=g;}}});})();(function(){var o="auto",n="px",m=",",l="clip:auto;",k="rect(",j=");",i="",h=")",g="qx.bom.element.Clip",f="string",c="clip:rect(",e=" ",d="clip",b="rect(auto,auto,auto,auto)",a="rect(auto, auto, auto, auto)";qx.Class.define(g,{statics:{compile:function(p){if(!p){return l;}var u=p.left;var top=p.top;var t=p.width;var s=p.height;var q,r;if(u==null){q=(t==null?o:t+n);u=o;}else{q=(t==null?o:u+t+n);u=u+n;}if(top==null){r=(s==null?o:s+n);top=o;}else{r=(s==null?o:top+s+n);top=top+n;}return c+top+m+q+m+r+m+u+j;},get:function(v,w){var y=qx.bom.element.Style.get(v,d,w,false);var E,top,C,B;var x,z;if(typeof y===f&&y!==o&&y!==i){y=qx.lang.String.trim(y);if(/\((.*)\)/.test(y)){var D=RegExp.$1;if(/,/.test(D)){var A=D.split(m);}else{var A=D.split(e);}top=qx.lang.String.trim(A[0]);x=qx.lang.String.trim(A[1]);z=qx.lang.String.trim(A[2]);E=qx.lang.String.trim(A[3]);if(E===o){E=null;}if(top===o){top=null;}if(x===o){x=null;}if(z===o){z=null;}if(top!=null){top=parseInt(top,10);}if(x!=null){x=parseInt(x,10);}if(z!=null){z=parseInt(z,10);}if(E!=null){E=parseInt(E,10);}if(x!=null&&E!=null){C=x-E;}else if(x!=null){C=x;}if(z!=null&&top!=null){B=z-top;}else if(z!=null){B=z;}}else{throw new Error("Could not parse clip string: "+y);}}return {left:E||null,top:top||null,width:C||null,height:B||null};},set:function(F,G){if(!G){F.style.clip=b;return;}var L=G.left;var top=G.top;var K=G.width;var J=G.height;var H,I;if(L==null){H=(K==null?o:K+n);L=o;}else{H=(K==null?o:L+K+n);L=L+n;}if(top==null){I=(J==null?o:J+n);top=o;}else{I=(J==null?o:top+J+n);top=top+n;}F.style.clip=k+top+m+H+m+I+m+L+h;},reset:function(M){M.style.clip=a;}}});})();(function(){var m="",l="qx.client",k=";",j="opacity:",i="opacity",h="filter",g="MozOpacity",f=");",e=")",d="zoom:1;filter:alpha(opacity=",a="qx.bom.element.Opacity",c="alpha(opacity=",b="-moz-opacity:";qx.Class.define(a,{statics:{SUPPORT_CSS3_OPACITY:false,compile:qx.core.Variant.select(l,{"mshtml":function(n){if(n>=1){n=1;}if(n<0.00001){n=0;}if(qx.bom.element.Opacity.SUPPORT_CSS3_OPACITY){return j+n+k;}else{return d+(n*100)+f;}},"gecko":function(o){if(o>=1){o=0.999999;}if(!qx.bom.element.Opacity.SUPPORT_CSS3_OPACITY){return b+o+k;}else{return j+o+k;}},"default":function(p){if(p>=1){return m;}return j+p+k;}}),set:qx.core.Variant.select(l,{"mshtml":function(q,r){if(qx.bom.element.Opacity.SUPPORT_CSS3_OPACITY){if(r>=1){r=m;}q.style.opacity=r;}else{var s=qx.bom.element.Style.get(q,h,qx.bom.element.Style.COMPUTED_MODE,false);if(r>=1){r=1;}if(r<0.00001){r=0;}if(!q.currentStyle||!q.currentStyle.hasLayout){q.style.zoom=1;}q.style.filter=s.replace(/alpha\([^\)]*\)/gi,m)+c+r*100+e;}},"gecko":function(t,u){if(u>=1){u=0.999999;}if(!qx.bom.element.Opacity.SUPPORT_CSS3_OPACITY){t.style.MozOpacity=u;}else{t.style.opacity=u;}},"default":function(v,w){if(w>=1){w=m;}v.style.opacity=w;}}),reset:qx.core.Variant.select(l,{"mshtml":function(x){if(qx.bom.element.Opacity.SUPPORT_CSS3_OPACITY){x.style.opacity=m;}else{var y=qx.bom.element.Style.get(x,h,qx.bom.element.Style.COMPUTED_MODE,false);x.style.filter=y.replace(/alpha\([^\)]*\)/gi,m);}},"gecko":function(z){if(!qx.bom.element.Opacity.SUPPORT_CSS3_OPACITY){z.style.MozOpacity=m;}else{z.style.opacity=m;}},"default":function(A){A.style.opacity=m;}}),get:qx.core.Variant.select(l,{"mshtml":function(B,C){if(qx.bom.element.Opacity.SUPPORT_CSS3_OPACITY){var D=qx.bom.element.Style.get(B,i,C,false);if(D!=null){return parseFloat(D);}return 1.0;}else{var E=qx.bom.element.Style.get(B,h,C,false);if(E){var D=E.match(/alpha\(opacity=(.*)\)/);if(D&&D[1]){return parseFloat(D[1])/100;}}return 1.0;}},"gecko":function(F,G){var H=qx.bom.element.Style.get(F,!qx.bom.element.Opacity.SUPPORT_CSS3_OPACITY?g:i,G,false);if(H==0.999999){H=1.0;}if(H!=null){return parseFloat(H);}return 1.0;},"default":function(I,J){var K=qx.bom.element.Style.get(I,i,J,false);if(K!=null){return parseFloat(K);}return 1.0;}})},defer:function(L){L.SUPPORT_CSS3_OPACITY=(typeof document.documentElement.style.opacity=="string");}});})();(function(){var m="",k="qx.client",h="userSelect",g="style",f="MozUserModify",e="px",d="float",c="borderImage",b="styleFloat",a="appearance",F="pixelHeight",E='Ms',D=":",C="cssFloat",B="pixelTop",A="pixelLeft",z='O',y="qx.bom.element.Style",x='Khtml',w='string',t="pixelRight",u='Moz',r="pixelWidth",s="pixelBottom",p=";",q="textOverflow",n="userModify",o='Webkit',v="WebkitUserModify";qx.Class.define(y,{statics:{__cr:function(){var G=[a,h,q,c];var K={};var H=document.documentElement.style;var L=[u,o,x,z,E];for(var i=0,l=G.length;i<l;i++){var M=G[i];var I=M;if(H[M]){K[I]=M;continue;}M=qx.lang.String.firstUp(M);for(var j=0,N=L.length;j<N;j++){var J=L[j]+M;if(typeof H[J]==w){K[I]=J;break;}}}this.__cs=K;this.__cs[n]=qx.core.Variant.select(k,{"gecko":f,"webkit":v,"default":h});this.__ct={};for(var I in K){this.__ct[I]=this.__cx(K[I]);}this.__cs[d]=qx.core.Variant.select(k,{"mshtml":b,"default":C});},__cu:{width:r,height:F,left:A,right:t,top:B,bottom:s},__cv:{clip:qx.bom.element.Clip,cursor:qx.bom.element.Cursor,opacity:qx.bom.element.Opacity,boxSizing:qx.bom.element.BoxSizing,overflowX:{set:qx.lang.Function.bind(qx.bom.element.Overflow.setX,qx.bom.element.Overflow),get:qx.lang.Function.bind(qx.bom.element.Overflow.getX,qx.bom.element.Overflow),reset:qx.lang.Function.bind(qx.bom.element.Overflow.resetX,qx.bom.element.Overflow),compile:qx.lang.Function.bind(qx.bom.element.Overflow.compileX,qx.bom.element.Overflow)},overflowY:{set:qx.lang.Function.bind(qx.bom.element.Overflow.setY,qx.bom.element.Overflow),get:qx.lang.Function.bind(qx.bom.element.Overflow.getY,qx.bom.element.Overflow),reset:qx.lang.Function.bind(qx.bom.element.Overflow.resetY,qx.bom.element.Overflow),compile:qx.lang.Function.bind(qx.bom.element.Overflow.compileY,qx.bom.element.Overflow)}},compile:function(O){var Q=[];var S=this.__cv;var R=this.__ct;var name,P;for(name in O){P=O[name];if(P==null){continue;}name=R[name]||name;if(S[name]){Q.push(S[name].compile(P));}else{Q.push(this.__cx(name),D,P,p);}}return Q.join(m);},__cw:{},__cx:function(T){var U=this.__cw;var V=U[T];if(!V){V=U[T]=qx.lang.String.hyphenate(T);}return V;},setCss:qx.core.Variant.select(k,{"mshtml":function(W,X){W.style.cssText=X;},"default":function(Y,ba){Y.setAttribute(g,ba);}}),getCss:qx.core.Variant.select(k,{"mshtml":function(bb){return bb.style.cssText.toLowerCase();},"default":function(bc){return bc.getAttribute(g);}}),isPropertySupported:function(bd){return (this.__cv[bd]||this.__cs[bd]||bd in document.documentElement.style);},COMPUTED_MODE:1,CASCADED_MODE:2,LOCAL_MODE:3,set:function(be,name,bf,bg){{};name=this.__cs[name]||name;if(bg!==false&&this.__cv[name]){return this.__cv[name].set(be,bf);}else{be.style[name]=bf!==null?bf:m;}},setStyles:function(bh,bi,bj){{};var bm=this.__cs;var bo=this.__cv;var bk=bh.style;for(var bn in bi){var bl=bi[bn];var name=bm[bn]||bn;if(bl===undefined){if(bj!==false&&bo[name]){bo[name].reset(bh);}else{bk[name]=m;}}else{if(bj!==false&&bo[name]){bo[name].set(bh,bl);}else{bk[name]=bl!==null?bl:m;}}}},reset:function(bp,name,bq){name=this.__cs[name]||name;if(bq!==false&&this.__cv[name]){return this.__cv[name].reset(bp);}else{bp.style[name]=m;}},get:qx.core.Variant.select(k,{"mshtml":function(br,name,bs,bt){name=this.__cs[name]||name;if(bt!==false&&this.__cv[name]){return this.__cv[name].get(br,bs);}if(!br.currentStyle){return br.style[name]||m;}switch(bs){case this.LOCAL_MODE:return br.style[name]||m;case this.CASCADED_MODE:return br.currentStyle[name]||m;default:var bx=br.currentStyle[name]||m;if(/^-?[\.\d]+(px)?$/i.test(bx)){return bx;}var bw=this.__cu[name];if(bw){var bu=br.style[name];br.style[name]=bx||0;var bv=br.style[bw]+e;br.style[name]=bu;return bv;}if(/^-?[\.\d]+(em|pt|%)?$/i.test(bx)){throw new Error("Untranslated computed property value: "+name+". Only pixel values work well across different clients.");}return bx;}},"default":function(by,name,bz,bA){name=this.__cs[name]||name;if(bA!==false&&this.__cv[name]){return this.__cv[name].get(by,bz);}switch(bz){case this.LOCAL_MODE:return by.style[name]||m;case this.CASCADED_MODE:if(by.currentStyle){return by.currentStyle[name]||m;}throw new Error("Cascaded styles are not supported in this browser!");default:var bB=qx.dom.Node.getDocument(by);var bC=bB.defaultView.getComputedStyle(by,null);return bC?bC[name]:m;}}})},defer:function(bD){bD.__cr();}});})();(function(){var j="borderTopWidth",i="borderLeftWidth",h="marginTop",g="marginLeft",f="scroll",e="qx.client",d="border-box",c="borderBottomWidth",b="borderRightWidth",a="auto",y="padding",x="qx.bom.element.Location",w="paddingLeft",v="static",u="marginBottom",t="visible",s="BODY",r="paddingBottom",q="paddingTop",p="marginRight",n="position",o="margin",l="overflow",m="paddingRight",k="border";qx.Class.define(x,{statics:{__iY:function(z,A){return qx.bom.element.Style.get(z,A,qx.bom.element.Style.COMPUTED_MODE,false);},__ja:function(B,C){return parseInt(qx.bom.element.Style.get(B,C,qx.bom.element.Style.COMPUTED_MODE,false),10)||0;},__jb:function(D){var G=0,top=0;if(D.getBoundingClientRect&&!qx.bom.client.Engine.OPERA){var F=qx.dom.Node.getWindow(D);G-=qx.bom.Viewport.getScrollLeft(F);top-=qx.bom.Viewport.getScrollTop(F);}else{var E=qx.dom.Node.getDocument(D).body;D=D.parentNode;while(D&&D!=E){G+=D.scrollLeft;top+=D.scrollTop;D=D.parentNode;}}return {left:G,top:top};},__jc:qx.core.Variant.select(e,{"mshtml":function(H){var J=qx.dom.Node.getDocument(H);var I=J.body;var K=0;var top=0;K-=I.clientLeft+J.documentElement.clientLeft;top-=I.clientTop+J.documentElement.clientTop;if(qx.bom.client.Feature.STANDARD_MODE){K+=this.__ja(I,i);top+=this.__ja(I,j);}return {left:K,top:top};},"webkit":function(L){var N=qx.dom.Node.getDocument(L);var M=N.body;var O=M.offsetLeft;var top=M.offsetTop;if(qx.bom.client.Engine.VERSION<530.17){O+=this.__ja(M,i);top+=this.__ja(M,j);}return {left:O,top:top};},"gecko":function(P){var Q=qx.dom.Node.getDocument(P).body;var R=Q.offsetLeft;var top=Q.offsetTop;if(qx.bom.client.Engine.VERSION<1.9){R+=this.__ja(Q,g);top+=this.__ja(Q,h);}if(qx.bom.element.BoxSizing.get(Q)!==d){R+=this.__ja(Q,i);top+=this.__ja(Q,j);}return {left:R,top:top};},"default":function(S){var T=qx.dom.Node.getDocument(S).body;var U=T.offsetLeft;var top=T.offsetTop;return {left:U,top:top};}}),__jd:qx.core.Variant.select(e,{"mshtml|webkit":function(V){var X=qx.dom.Node.getDocument(V);if(V.getBoundingClientRect){var Y=V.getBoundingClientRect();var ba=Y.left;var top=Y.top;}else{var ba=V.offsetLeft;var top=V.offsetTop;V=V.offsetParent;var W=X.body;while(V&&V!=W){ba+=V.offsetLeft;top+=V.offsetTop;ba+=this.__ja(V,i);top+=this.__ja(V,j);V=V.offsetParent;}}return {left:ba,top:top};},"gecko":function(bb){if(bb.getBoundingClientRect){var be=bb.getBoundingClientRect();var bf=Math.round(be.left);var top=Math.round(be.top);}else{var bf=0;var top=0;var bc=qx.dom.Node.getDocument(bb).body;var bd=qx.bom.element.BoxSizing;if(bd.get(bb)!==d){bf-=this.__ja(bb,i);top-=this.__ja(bb,j);}while(bb&&bb!==bc){bf+=bb.offsetLeft;top+=bb.offsetTop;if(bd.get(bb)!==d){bf+=this.__ja(bb,i);top+=this.__ja(bb,j);}if(bb.parentNode&&this.__iY(bb.parentNode,l)!=t){bf+=this.__ja(bb.parentNode,i);top+=this.__ja(bb.parentNode,j);}bb=bb.offsetParent;}}return {left:bf,top:top};},"default":function(bg){var bi=0;var top=0;var bh=qx.dom.Node.getDocument(bg).body;while(bg&&bg!==bh){bi+=bg.offsetLeft;top+=bg.offsetTop;bg=bg.offsetParent;}return {left:bi,top:top};}}),get:function(bj,bk){if(bj.tagName==s){var location=this.__je(bj);var br=location.left;var top=location.top;}else{var bl=this.__jc(bj);var bq=this.__jd(bj);var scroll=this.__jb(bj);var br=bq.left+bl.left-scroll.left;var top=bq.top+bl.top-scroll.top;}var bm=br+bj.offsetWidth;var bn=top+bj.offsetHeight;if(bk){if(bk==y||bk==f){var bo=qx.bom.element.Overflow.getX(bj);if(bo==f||bo==a){bm+=bj.scrollWidth-bj.offsetWidth+this.__ja(bj,i)+this.__ja(bj,b);}var bp=qx.bom.element.Overflow.getY(bj);if(bp==f||bp==a){bn+=bj.scrollHeight-bj.offsetHeight+this.__ja(bj,j)+this.__ja(bj,c);}}switch(bk){case y:br+=this.__ja(bj,w);top+=this.__ja(bj,q);bm-=this.__ja(bj,m);bn-=this.__ja(bj,r);case f:br-=bj.scrollLeft;top-=bj.scrollTop;bm-=bj.scrollLeft;bn-=bj.scrollTop;case k:br+=this.__ja(bj,i);top+=this.__ja(bj,j);bm-=this.__ja(bj,b);bn-=this.__ja(bj,c);break;case o:br-=this.__ja(bj,g);top-=this.__ja(bj,h);bm+=this.__ja(bj,p);bn+=this.__ja(bj,u);break;}}return {left:br,top:top,right:bm,bottom:bn};},__je:qx.core.Variant.select(e,{"default":function(bs){var top=bs.offsetTop+this.__ja(bs,h);var bt=bs.offsetLeft+this.__ja(bs,g);return {left:bt,top:top};},"mshtml":function(bu){var top=bu.offsetTop;var bv=bu.offsetLeft;if(!((qx.bom.client.Engine.VERSION<8||qx.bom.client.Engine.DOCUMENT_MODE<8)&&!qx.bom.client.Feature.QUIRKS_MODE)){top+=this.__ja(bu,h);bv+=this.__ja(bu,g);}return {left:bv,top:top};},"gecko":function(bw){var top=bw.offsetTop+this.__ja(bw,h)+this.__ja(bw,i);var bx=bw.offsetLeft+this.__ja(bw,g)+this.__ja(bw,j);return {left:bx,top:top};}}),getLeft:function(by,bz){return this.get(by,bz).left;},getTop:function(bA,bB){return this.get(bA,bB).top;},getRight:function(bC,bD){return this.get(bC,bD).right;},getBottom:function(bE,bF){return this.get(bE,bF).bottom;},getRelative:function(bG,bH,bI,bJ){var bL=this.get(bG,bI);var bK=this.get(bH,bJ);return {left:bL.left-bK.left,top:bL.top-bK.top,right:bL.right-bK.right,bottom:bL.bottom-bK.bottom};},getPosition:function(bM){return this.getRelative(bM,this.getOffsetParent(bM));},getOffsetParent:function(bN){var bP=bN.offsetParent||document.body;var bO=qx.bom.element.Style;while(bP&&(!/^body|html$/i.test(bP.tagName)&&bO.get(bP,n)===v)){bP=bP.offsetParent;}return bP;}}});})();(function(){var b="qx.ui.core.queue.Widget",a="widget";qx.Class.define(b,{statics:{__iQ:{},remove:function(c){delete this.__iQ[c.$$hash];},add:function(d){var e=this.__iQ;if(e[d.$$hash]){return;}e[d.$$hash]=d;qx.ui.core.queue.Manager.scheduleFlush(a);},flush:function(){var f=this.__iQ;var h;for(var g in f){h=f[g];delete f[g];h.syncWidget();}for(var g in f){return;}this.__iQ={};}}});})();(function(){var b="qx.ui.core.queue.Visibility",a="visibility";qx.Class.define(b,{statics:{__iC:{},__iD:{},remove:function(c){var d=c.$$hash;delete this.__iD[d];delete this.__iC[d];},isVisible:function(e){return this.__iD[e.$$hash]||false;},__iE:function(f){var h=this.__iD;var g=f.$$hash;var i;if(f.isExcluded()){i=false;}else{var parent=f.$$parent;if(parent){i=this.__iE(parent);}else{i=f.isRootWidget();}}return h[g]=i;},add:function(j){var k=this.__iC;if(k[j.$$hash]){return;}k[j.$$hash]=j;qx.ui.core.queue.Manager.scheduleFlush(a);},flush:function(){var l=this.__iC;var p=this.__iD;for(var m in l){if(p[m]!=null){l[m].addChildrenToQueue(l);}}var o={};for(var m in l){o[m]=p[m];p[m]=null;}for(var m in l){var n=l[m];delete l[m];if(p[m]==null){this.__iE(n);}if(p[m]&&p[m]!=o[m]){n.checkAppearanceNeeds();}}this.__iC={};}}});})();(function(){var b="appearance",a="qx.ui.core.queue.Appearance";qx.Class.define(a,{statics:{__hL:{},remove:function(c){delete this.__hL[c.$$hash];},add:function(d){var e=this.__hL;if(e[d.$$hash]){return;}e[d.$$hash]=d;qx.ui.core.queue.Manager.scheduleFlush(b);},has:function(f){return !!this.__hL[f.$$hash];},flush:function(){var j=qx.ui.core.queue.Visibility;var g=this.__hL;var i;for(var h in g){i=g[h];delete g[h];if(j.isVisible(i)){i.syncAppearance();}else{i.$$stateChanges=true;}}}}});})();(function(){var b="qx.ui.core.queue.Layout",a="layout";qx.Class.define(b,{statics:{__if:{},remove:function(c){delete this.__if[c.$$hash];},add:function(d){this.__if[d.$$hash]=d;qx.ui.core.queue.Manager.scheduleFlush(a);},flush:function(){var e=this.__ii();for(var i=e.length-1;i>=0;i--){var f=e[i];if(f.hasValidLayout()){continue;}if(f.isRootWidget()&&!f.hasUserBounds()){var h=f.getSizeHint();f.renderLayout(0,0,h.width,h.height);}else{var g=f.getBounds();f.renderLayout(g.left,g.top,g.width,g.height);}}},getNestingLevel:function(j){var k=this.__ih;var m=0;var parent=j;while(true){if(k[parent.$$hash]!=null){m+=k[parent.$$hash];break;}if(!parent.$$parent){break;}parent=parent.$$parent;m+=1;}var l=m;while(j&&j!==parent){k[j.$$hash]=l--;j=j.$$parent;}return m;},__ig:function(){var s=qx.ui.core.queue.Visibility;this.__ih={};var r=[];var q=this.__if;var n,p;for(var o in q){n=q[o];if(s.isVisible(n)){p=this.getNestingLevel(n);if(!r[p]){r[p]={};}r[p][o]=n;delete q[o];}}return r;},__ii:function(){var w=[];var y=this.__ig();for(var v=y.length-1;v>=0;v--){if(!y[v]){continue;}for(var u in y[v]){var t=y[v][u];if(v==0||t.isRootWidget()||t.hasUserBounds()){w.push(t);t.invalidateLayoutCache();continue;}var A=t.getSizeHint(false);if(A){t.invalidateLayoutCache();var x=t.getSizeHint();var z=(!t.getBounds()||A.minWidth!==x.minWidth||A.width!==x.width||A.maxWidth!==x.maxWidth||A.minHeight!==x.minHeight||A.height!==x.height||A.maxHeight!==x.maxHeight);}else{z=true;}if(z){var parent=t.getLayoutParent();if(!y[v-1]){y[v-1]={};}y[v-1][parent.$$hash]=parent;}else{w.push(t);}}}return w;}}});})();(function(){var b="dispose",a="qx.ui.core.queue.Dispose";qx.Class.define(a,{statics:{__eX:{},add:function(c){var d=this.__eX;if(d[c.$$hash]){return;}d[c.$$hash]=c;qx.ui.core.queue.Manager.scheduleFlush(b);},flush:function(){var e=this.__eX;for(var g in e){var f=e[g];delete e[g];f.dispose();}for(var g in e){return;}this.__eX={};}}});})();(function(){var a="qx.ui.core.MChildrenHandling";qx.Mixin.define(a,{members:{getChildren:function(){return this._getChildren();},hasChildren:function(){return this._hasChildren();},indexOf:function(b){return this._indexOf(b);},add:function(c,d){this._add(c,d);},addAt:function(e,f,g){this._addAt(e,f,g);},addBefore:function(h,i,j){this._addBefore(h,i,j);},addAfter:function(k,l,m){this._addAfter(k,l,m);},remove:function(n){this._remove(n);},removeAt:function(o){return this._removeAt(o);},removeAll:function(){this._removeAll();}},statics:{remap:function(p){p.getChildren=p._getChildren;p.hasChildren=p._hasChildren;p.indexOf=p._indexOf;p.add=p._add;p.addAt=p._addAt;p.addBefore=p._addBefore;p.addAfter=p._addAfter;p.remove=p._remove;p.removeAt=p._removeAt;p.removeAll=p._removeAll;}}});})();(function(){var a="qx.ui.core.MLayoutHandling";qx.Mixin.define(a,{members:{setLayout:function(b){return this._setLayout(b);},getLayout:function(){return this._getLayout();}},statics:{remap:function(c){c.getLayout=c._getLayout;c.setLayout=c._setLayout;}}});})();(function(){var j="Integer",i="_applyDimension",h="Boolean",g="_applyStretching",f="_applyMargin",e="shorthand",d="_applyAlign",c="allowShrinkY",b="bottom",a="baseline",x="marginBottom",w="qx.ui.core.LayoutItem",v="center",u="marginTop",t="allowGrowX",s="middle",r="marginLeft",q="allowShrinkX",p="top",o="right",m="marginRight",n="abstract",k="allowGrowY",l="left";qx.Class.define(w,{type:n,extend:qx.core.Object,properties:{minWidth:{check:j,nullable:true,apply:i,init:null,themeable:true},width:{check:j,nullable:true,apply:i,init:null,themeable:true},maxWidth:{check:j,nullable:true,apply:i,init:null,themeable:true},minHeight:{check:j,nullable:true,apply:i,init:null,themeable:true},height:{check:j,nullable:true,apply:i,init:null,themeable:true},maxHeight:{check:j,nullable:true,apply:i,init:null,themeable:true},allowGrowX:{check:h,apply:g,init:true,themeable:true},allowShrinkX:{check:h,apply:g,init:true,themeable:true},allowGrowY:{check:h,apply:g,init:true,themeable:true},allowShrinkY:{check:h,apply:g,init:true,themeable:true},allowStretchX:{group:[t,q],mode:e,themeable:true},allowStretchY:{group:[k,c],mode:e,themeable:true},marginTop:{check:j,init:0,apply:f,themeable:true},marginRight:{check:j,init:0,apply:f,themeable:true},marginBottom:{check:j,init:0,apply:f,themeable:true},marginLeft:{check:j,init:0,apply:f,themeable:true},margin:{group:[u,m,x,r],mode:e,themeable:true},alignX:{check:[l,v,o],nullable:true,apply:d,themeable:true},alignY:{check:[p,s,b,a],nullable:true,apply:d,themeable:true}},members:{__fz:null,__fA:null,__fB:null,__fC:null,__fD:null,__fE:null,__fF:null,getBounds:function(){return this.__fE||this.__fA||null;},clearSeparators:function(){},renderSeparator:function(y,z){},renderLayout:function(A,top,B,C){var D;{};var E=null;if(this.getHeight()==null&&this._hasHeightForWidth()){var E=this._getHeightForWidth(B);}if(E!=null&&E!==this.__fz){this.__fz=E;qx.ui.core.queue.Layout.add(this);return null;}var G=this.__fA;if(!G){G=this.__fA={};}var F={};if(A!==G.left||top!==G.top){F.position=true;G.left=A;G.top=top;}if(B!==G.width||C!==G.height){F.size=true;G.width=B;G.height=C;}if(this.__fB){F.local=true;delete this.__fB;}if(this.__fD){F.margin=true;delete this.__fD;}return F;},isExcluded:function(){return false;},hasValidLayout:function(){return !this.__fB;},scheduleLayoutUpdate:function(){qx.ui.core.queue.Layout.add(this);},invalidateLayoutCache:function(){this.__fB=true;this.__fC=null;},getSizeHint:function(H){var I=this.__fC;if(I){return I;}if(H===false){return null;}I=this.__fC=this._computeSizeHint();if(this._hasHeightForWidth()&&this.__fz&&this.getHeight()==null){I.height=this.__fz;}if(I.minWidth>I.width){I.width=I.minWidth;}if(I.maxWidth<I.width){I.width=I.maxWidth;}if(!this.getAllowGrowX()){I.maxWidth=I.width;}if(!this.getAllowShrinkX()){I.minWidth=I.width;}if(I.minHeight>I.height){I.height=I.minHeight;}if(I.maxHeight<I.height){I.height=I.maxHeight;}if(!this.getAllowGrowY()){I.maxHeight=I.height;}if(!this.getAllowShrinkY()){I.minHeight=I.height;}return I;},_computeSizeHint:function(){var N=this.getMinWidth()||0;var K=this.getMinHeight()||0;var O=this.getWidth()||N;var M=this.getHeight()||K;var J=this.getMaxWidth()||Infinity;var L=this.getMaxHeight()||Infinity;return {minWidth:N,width:O,maxWidth:J,minHeight:K,height:M,maxHeight:L};},_hasHeightForWidth:function(){var P=this._getLayout();if(P){return P.hasHeightForWidth();}return false;},_getHeightForWidth:function(Q){var R=this._getLayout();if(R&&R.hasHeightForWidth()){return R.getHeightForWidth(Q);}return null;},_getLayout:function(){return null;},_applyMargin:function(){this.__fD=true;var parent=this.$$parent;if(parent){parent.updateLayoutProperties();}},_applyAlign:function(){var parent=this.$$parent;if(parent){parent.updateLayoutProperties();}},_applyDimension:function(){qx.ui.core.queue.Layout.add(this);},_applyStretching:function(){qx.ui.core.queue.Layout.add(this);},hasUserBounds:function(){return !!this.__fE;},setUserBounds:function(S,top,T,U){this.__fE={left:S,top:top,width:T,height:U};qx.ui.core.queue.Layout.add(this);},resetUserBounds:function(){delete this.__fE;qx.ui.core.queue.Layout.add(this);},__fG:{},setLayoutProperties:function(V){if(V==null){return;}var W=this.__fF;if(!W){W=this.__fF={};}var parent=this.getLayoutParent();if(parent){parent.updateLayoutProperties(V);}for(var X in V){if(V[X]==null){delete W[X];}else{W[X]=V[X];}}},getLayoutProperties:function(){return this.__fF||this.__fG;},clearLayoutProperties:function(){delete this.__fF;},updateLayoutProperties:function(Y){var ba=this._getLayout();if(ba){var bb;{};ba.invalidateChildrenCache();}qx.ui.core.queue.Layout.add(this);},getApplicationRoot:function(){return qx.core.Init.getApplication().getRoot();},getLayoutParent:function(){return this.$$parent||null;},setLayoutParent:function(parent){if(this.$$parent===parent){return;}this.$$parent=parent||null;qx.ui.core.queue.Visibility.add(this);},isRootWidget:function(){return false;},_getRoot:function(){var parent=this;while(parent){if(parent.isRootWidget()){return parent;}parent=parent.$$parent;}return null;},clone:function(){var bc=qx.core.Object.prototype.clone.call(this);var bd=this.__fF;if(bd){bc.__fF=qx.lang.Object.clone(bd);}return bc;}},destruct:function(){this.$$parent=this.$$subparent=this.__fF=this.__fA=this.__fE=this.__fC=null;}});})();(function(){var a="qx.locale.MTranslation";qx.Mixin.define(a,{members:{tr:function(b,c){var d=qx.locale.Manager;if(d){return d.tr.apply(d,arguments);}throw new Error("To enable localization please include qx.locale.Manager into your build!");},trn:function(e,f,g,h){var i=qx.locale.Manager;if(i){return i.trn.apply(i,arguments);}throw new Error("To enable localization please include qx.locale.Manager into your build!");},trc:function(j,k,l){var m=qx.locale.Manager;if(m){return m.trc.apply(m,arguments);}throw new Error("To enable localization please include qx.locale.Manager into your build!");},marktr:function(n){var o=qx.locale.Manager;if(o){return o.marktr.apply(o,arguments);}throw new Error("To enable localization please include qx.locale.Manager into your build!");}}});})();(function(){var b="qx.ui.core.DecoratorFactory",a="$$nopool$$";qx.Class.define(b,{extend:qx.core.Object,construct:function(){qx.core.Object.call(this);this.__cU={};},statics:{MAX_SIZE:15,__cV:a},members:{__cU:null,getDecoratorElement:function(c){var h=qx.ui.core.DecoratorFactory;if(qx.lang.Type.isString(c)){var f=c;var e=qx.theme.manager.Decoration.getInstance().resolve(c);}else{var f=h.__cV;e=c;}var g=this.__cU;if(g[f]&&g[f].length>0){var d=g[f].pop();}else{var d=this._createDecoratorElement(e,f);}d.$$pooled=false;return d;},poolDecorator:function(i){if(!i||i.$$pooled||i.isDisposed()){return;}var l=qx.ui.core.DecoratorFactory;var j=i.getId();if(j==l.__cV){i.dispose();return;}var k=this.__cU;if(!k[j]){k[j]=[];}if(k[j].length>l.MAX_SIZE){i.dispose();}else{i.$$pooled=true;k[j].push(i);}},_createDecoratorElement:function(m,n){var o=new qx.html.Decorator(m,n);{};return o;},toString:function(){return qx.core.Object.prototype.toString.call(this);}},destruct:function(){if(!qx.core.ObjectRegistry.inShutDown){var q=this.__cU;for(var p in q){qx.util.DisposeUtil.disposeArray(q,p);}}this.__cU=null;}});})();(function(){var bV="px",bU="Boolean",bT="qx.event.type.Drag",bS="qx.event.type.Mouse",bR="visible",bQ="qx.event.type.Focus",bP="on",bO="Integer",bN="qx.event.type.Touch",bM="excluded",bx="qx.event.type.Data",bw="_applyPadding",bv="qx.event.type.Event",bu="hidden",bt="contextmenu",bs="String",br="tabIndex",bq="focused",bp="changeVisibility",bo="mshtml",cd="hovered",ce="qx.event.type.KeySequence",cb="qx.client",cc="absolute",bY="backgroundColor",ca="drag",bW="div",bX="disabled",cf="move",cg="dragstart",bF="qx.dynlocale",bE="dragchange",bH="dragend",bG="resize",bJ="Decorator",bI="zIndex",bL="opacity",bK="default",bD="Color",bC="changeToolTipText",c="beforeContextmenuOpen",d="_applyNativeContextMenu",f="_applyBackgroundColor",g="_applyFocusable",h="changeShadow",j="qx.event.type.KeyInput",k="createChildControl",m="__dQ",n="Font",o="_applyShadow",ck="_applyEnabled",cj="_applySelectable",ci="Number",ch="_applyKeepActive",co="__ea",cn="_applyVisibility",cm="repeat",cl="qxDraggable",cq="__dR",cp="syncAppearance",N="paddingLeft",O="_applyDroppable",L="__ec",M="#",R="qx.event.type.MouseWheel",S="_applyCursor",P="_applyDraggable",Q="changeTextColor",J="$$widget",K="changeContextMenu",w="paddingTop",v="changeSelectable",y="hideFocus",x="none",s="outline",r="_applyAppearance",u="_applyOpacity",t="url(",q=")",p="qx.ui.core.Widget",X="_applyFont",Y="cursor",ba="qxDroppable",bb="changeZIndex",T="changeEnabled",U="changeFont",V="__ee",W="__dU",bc="_applyDecorator",bd="_applyZIndex",G="_applyTextColor",F="qx.ui.menu.Menu",E="_applyToolTipText",D="true",C="widget",B="changeDecorator",A="__dV",z="_applyTabIndex",I="changeAppearance",H="shorthand",be="/",bf="",bg="_applyContextMenu",bh="paddingBottom",bi="__dW",bj="changeNativeContextMenu",bk="qx.ui.tooltip.ToolTip",bl="qxKeepActive",bm="_applyKeepFocus",bn="paddingRight",bB="changeBackgroundColor",bA="changeLocale",bz="qxKeepFocus",by="qx/static/blank.gif";qx.Class.define(p,{extend:qx.ui.core.LayoutItem,include:[qx.locale.MTranslation],construct:function(){qx.ui.core.LayoutItem.call(this);this.__dQ=this._createContainerElement();this.__dR=this.__ed();this.__dQ.add(this.__dR);this.initFocusable();this.initSelectable();this.initNativeContextMenu();},events:{appear:bv,disappear:bv,createChildControl:bx,resize:bx,move:bx,syncAppearance:bx,mousemove:bS,mouseover:bS,mouseout:bS,mousedown:bS,mouseup:bS,click:bS,dblclick:bS,contextmenu:bS,beforeContextmenuOpen:bx,mousewheel:R,touchstart:bN,touchend:bN,touchmove:bN,touchcancel:bN,tap:bN,swipe:bN,keyup:ce,keydown:ce,keypress:ce,keyinput:j,focus:bQ,blur:bQ,focusin:bQ,focusout:bQ,activate:bQ,deactivate:bQ,capture:bv,losecapture:bv,drop:bT,dragleave:bT,dragover:bT,drag:bT,dragstart:bT,dragend:bT,dragchange:bT,droprequest:bT},properties:{paddingTop:{check:bO,init:0,apply:bw,themeable:true},paddingRight:{check:bO,init:0,apply:bw,themeable:true},paddingBottom:{check:bO,init:0,apply:bw,themeable:true},paddingLeft:{check:bO,init:0,apply:bw,themeable:true},padding:{group:[w,bn,bh,N],mode:H,themeable:true},zIndex:{nullable:true,init:null,apply:bd,event:bb,check:bO,themeable:true},decorator:{nullable:true,init:null,apply:bc,event:B,check:bJ,themeable:true},shadow:{nullable:true,init:null,apply:o,event:h,check:bJ,themeable:true},backgroundColor:{nullable:true,check:bD,apply:f,event:bB,themeable:true},textColor:{nullable:true,check:bD,apply:G,event:Q,themeable:true,inheritable:true},font:{nullable:true,apply:X,check:n,event:U,themeable:true,inheritable:true,dereference:true},opacity:{check:ci,apply:u,themeable:true,nullable:true,init:null},cursor:{check:bs,apply:S,themeable:true,inheritable:true,nullable:true,init:null},toolTip:{check:bk,nullable:true},toolTipText:{check:bs,nullable:true,event:bC,apply:E},toolTipIcon:{check:bs,nullable:true,event:bC},blockToolTip:{check:bU,init:false},visibility:{check:[bR,bu,bM],init:bR,apply:cn,event:bp},enabled:{init:true,check:bU,inheritable:true,apply:ck,event:T},anonymous:{init:false,check:bU},tabIndex:{check:bO,nullable:true,apply:z},focusable:{check:bU,init:false,apply:g},keepFocus:{check:bU,init:false,apply:bm},keepActive:{check:bU,init:false,apply:ch},draggable:{check:bU,init:false,apply:P},droppable:{check:bU,init:false,apply:O},selectable:{check:bU,init:false,event:v,apply:cj},contextMenu:{check:F,apply:bg,nullable:true,event:K},nativeContextMenu:{check:bU,init:false,themeable:true,event:bj,apply:d},appearance:{check:bs,init:C,apply:r,event:I}},statics:{DEBUG:false,getWidgetByElement:function(cr,cs){while(cr){var ct=cr.$$widget;if(ct!=null){var cu=qx.core.ObjectRegistry.fromHashCode(ct);if(!cs||!cu.getAnonymous()){return cu;}}try{cr=cr.parentNode;}catch(e){return null;}}return null;},contains:function(parent,cv){while(cv){if(parent==cv){return true;}cv=cv.getLayoutParent();}return false;},__dS:new qx.ui.core.DecoratorFactory(),__dT:new qx.ui.core.DecoratorFactory()},members:{__dQ:null,__dR:null,__dU:null,__dV:null,__dW:null,__dX:null,__dY:null,__ea:null,_getLayout:function(){return this.__ea;},_setLayout:function(cw){{};if(this.__ea){this.__ea.connectToWidget(null);}if(cw){cw.connectToWidget(this);}this.__ea=cw;qx.ui.core.queue.Layout.add(this);},setLayoutParent:function(parent){if(this.$$parent===parent){return;}var cx=this.getContainerElement();if(this.$$parent&&!this.$$parent.$$disposed){this.$$parent.getContentElement().remove(cx);}this.$$parent=parent||null;if(parent&&!parent.$$disposed){this.$$parent.getContentElement().add(cx);}this.$$refreshInheritables();qx.ui.core.queue.Visibility.add(this);},_updateInsets:null,__eb:function(a,b){if(a==b){return false;}if(a==null||b==null){return true;}var cy=qx.theme.manager.Decoration.getInstance();var cA=cy.resolve(a).getInsets();var cz=cy.resolve(b).getInsets();if(cA.top!=cz.top||cA.right!=cz.right||cA.bottom!=cz.bottom||cA.left!=cz.left){return true;}return false;},renderLayout:function(cB,top,cC,cD){var cM=qx.ui.core.LayoutItem.prototype.renderLayout.call(this,cB,top,cC,cD);if(!cM){return null;}var cF=this.getContainerElement();var content=this.getContentElement();var cJ=cM.size||this._updateInsets;var cN=bV;var cK={};if(cM.position){cK.left=cB+cN;cK.top=top+cN;}if(cM.size){cK.width=cC+cN;cK.height=cD+cN;}if(cM.position||cM.size){cF.setStyles(cK);}if(cJ||cM.local||cM.margin){var cE=this.getInsets();var innerWidth=cC-cE.left-cE.right;var innerHeight=cD-cE.top-cE.bottom;innerWidth=innerWidth<0?0:innerWidth;innerHeight=innerHeight<0?0:innerHeight;}var cH={};if(this._updateInsets){cH.left=cE.left+cN;cH.top=cE.top+cN;}if(cJ){cH.width=innerWidth+cN;cH.height=innerHeight+cN;}if(cJ||this._updateInsets){content.setStyles(cH);}if(cM.size){var cL=this.__dW;if(cL){cL.setStyles({width:cC+bV,height:cD+bV});}}if(cM.size||this._updateInsets){if(this.__dU){this.__dU.resize(cC,cD);}}if(cM.size){if(this.__dV){var cE=this.__dV.getInsets();var cI=cC+cE.left+cE.right;var cG=cD+cE.top+cE.bottom;this.__dV.resize(cI,cG);}}if(cJ||cM.local||cM.margin){if(this.__ea&&this.hasLayoutChildren()){this.__ea.renderLayout(innerWidth,innerHeight);}else if(this.hasLayoutChildren()){throw new Error("At least one child in control "+this._findTopControl()+" requires a layout, but no one was defined!");}}if(cM.position&&this.hasListener(cf)){this.fireDataEvent(cf,this.getBounds());}if(cM.size&&this.hasListener(bG)){this.fireDataEvent(bG,this.getBounds());}delete this._updateInsets;return cM;},__ec:null,clearSeparators:function(){var cP=this.__ec;if(!cP){return;}var cQ=qx.ui.core.Widget.__dS;var content=this.getContentElement();var cO;for(var i=0,l=cP.length;i<l;i++){cO=cP[i];cQ.poolDecorator(cO);content.remove(cO);}cP.length=0;},renderSeparator:function(cR,cS){var cT=qx.ui.core.Widget.__dS.getDecoratorElement(cR);this.getContentElement().add(cT);cT.resize(cS.width,cS.height);cT.setStyles({left:cS.left+bV,top:cS.top+bV});if(!this.__ec){this.__ec=[cT];}else{this.__ec.push(cT);}},_computeSizeHint:function(){var db=this.getWidth();var da=this.getMinWidth();var cV=this.getMaxWidth();var cY=this.getHeight();var cW=this.getMinHeight();var cX=this.getMaxHeight();{};var dc=this._getContentHint();var cU=this.getInsets();var de=cU.left+cU.right;var dd=cU.top+cU.bottom;if(db==null){db=dc.width+de;}if(cY==null){cY=dc.height+dd;}if(da==null){da=de;if(dc.minWidth!=null){da+=dc.minWidth;}}if(cW==null){cW=dd;if(dc.minHeight!=null){cW+=dc.minHeight;}}if(cV==null){if(dc.maxWidth==null){cV=Infinity;}else{cV=dc.maxWidth+de;}}if(cX==null){if(dc.maxHeight==null){cX=Infinity;}else{cX=dc.maxHeight+dd;}}return {width:db,minWidth:da,maxWidth:cV,height:cY,minHeight:cW,maxHeight:cX};},invalidateLayoutCache:function(){qx.ui.core.LayoutItem.prototype.invalidateLayoutCache.call(this);if(this.__ea){this.__ea.invalidateLayoutCache();}},_getContentHint:function(){var dg=this.__ea;if(dg){if(this.hasLayoutChildren()){var df;var dh=dg.getSizeHint();{};return dh;}else{return {width:0,height:0};}}else{return {width:100,height:50};}},_getHeightForWidth:function(di){var dm=this.getInsets();var dq=dm.left+dm.right;var dp=dm.top+dm.bottom;var dn=di-dq;var dk=this._getLayout();if(dk&&dk.hasHeightForWidth()){var dj=dk.getHeightForWidth(di);}else{dj=this._getContentHeightForWidth(dn);}var dl=dj+dp;return dl;},_getContentHeightForWidth:function(dr){throw new Error("Abstract method call: _getContentHeightForWidth()!");},getInsets:function(){var top=this.getPaddingTop();var dt=this.getPaddingRight();var dv=this.getPaddingBottom();var du=this.getPaddingLeft();if(this.__dU){var ds=this.__dU.getInsets();{};top+=ds.top;dt+=ds.right;dv+=ds.bottom;du+=ds.left;}return {"top":top,"right":dt,"bottom":dv,"left":du};},getInnerSize:function(){var dx=this.getBounds();if(!dx){return null;}var dw=this.getInsets();return {width:dx.width-dw.left-dw.right,height:dx.height-dw.top-dw.bottom};},show:function(){this.setVisibility(bR);},hide:function(){this.setVisibility(bu);},exclude:function(){this.setVisibility(bM);},isVisible:function(){return this.getVisibility()===bR;},isHidden:function(){return this.getVisibility()!==bR;},isExcluded:function(){return this.getVisibility()===bM;},isSeeable:function(){var dz=this.getContainerElement().getDomElement();if(dz){return dz.offsetWidth>0;}var dy=this;do{if(!dy.isVisible()){return false;}if(dy.isRootWidget()){return true;}dy=dy.getLayoutParent();}while(dy);return false;},_createContainerElement:function(){var dB={"$$widget":this.toHashCode()};{};var dA={zIndex:0,position:cc};return new qx.html.Element(bW,dA,dB);},__ed:function(){var dC=this._createContentElement();{};dC.setStyles({"position":cc,"zIndex":10});return dC;},_createContentElement:function(){return new qx.html.Element(bW,{overflowX:bu,overflowY:bu});},getContainerElement:function(){return this.__dQ;},getContentElement:function(){return this.__dR;},getDecoratorElement:function(){return this.__dU||null;},getShadowElement:function(){return this.__dV||null;},__ee:null,getLayoutChildren:function(){var dE=this.__ee;if(!dE){return this.__ef;}var dF;for(var i=0,l=dE.length;i<l;i++){var dD=dE[i];if(dD.hasUserBounds()||dD.isExcluded()){if(dF==null){dF=dE.concat();}qx.lang.Array.remove(dF,dD);}}return dF||dE;},scheduleLayoutUpdate:function(){qx.ui.core.queue.Layout.add(this);},invalidateLayoutChildren:function(){var dG=this.__ea;if(dG){dG.invalidateChildrenCache();}qx.ui.core.queue.Layout.add(this);},hasLayoutChildren:function(){var dH=this.__ee;if(!dH){return false;}var dI;for(var i=0,l=dH.length;i<l;i++){dI=dH[i];if(!dI.hasUserBounds()&&!dI.isExcluded()){return true;}}return false;},getChildrenContainer:function(){return this;},__ef:[],_getChildren:function(){return this.__ee||this.__ef;},_indexOf:function(dJ){var dK=this.__ee;if(!dK){return -1;}return dK.indexOf(dJ);},_hasChildren:function(){var dL=this.__ee;return dL!=null&&(!!dL[0]);},addChildrenToQueue:function(dM){var dN=this.__ee;if(!dN){return;}var dO;for(var i=0,l=dN.length;i<l;i++){dO=dN[i];dM[dO.$$hash]=dO;dO.addChildrenToQueue(dM);}},_add:function(dP,dQ){if(dP.getLayoutParent()==this){qx.lang.Array.remove(this.__ee,dP);}if(this.__ee){this.__ee.push(dP);}else{this.__ee=[dP];}this.__eg(dP,dQ);},_addAt:function(dR,dS,dT){if(!this.__ee){this.__ee=[];}if(dR.getLayoutParent()==this){qx.lang.Array.remove(this.__ee,dR);}var dU=this.__ee[dS];if(dU===dR){dR.setLayoutProperties(dT);}if(dU){qx.lang.Array.insertBefore(this.__ee,dR,dU);}else{this.__ee.push(dR);}this.__eg(dR,dT);},_addBefore:function(dV,dW,dX){{};if(dV==dW){return;}if(!this.__ee){this.__ee=[];}if(dV.getLayoutParent()==this){qx.lang.Array.remove(this.__ee,dV);}qx.lang.Array.insertBefore(this.__ee,dV,dW);this.__eg(dV,dX);},_addAfter:function(dY,ea,eb){{};if(dY==ea){return;}if(!this.__ee){this.__ee=[];}if(dY.getLayoutParent()==this){qx.lang.Array.remove(this.__ee,dY);}qx.lang.Array.insertAfter(this.__ee,dY,ea);this.__eg(dY,eb);},_remove:function(ec){if(!this.__ee){throw new Error("This widget has no children!");}qx.lang.Array.remove(this.__ee,ec);this.__eh(ec);},_removeAt:function(ed){if(!this.__ee){throw new Error("This widget has no children!");}var ee=this.__ee[ed];qx.lang.Array.removeAt(this.__ee,ed);this.__eh(ee);return ee;},_removeAll:function(){if(!this.__ee){return;}var ef=this.__ee.concat();this.__ee.length=0;for(var i=ef.length-1;i>=0;i--){this.__eh(ef[i]);}qx.ui.core.queue.Layout.add(this);},_afterAddChild:null,_afterRemoveChild:null,__eg:function(eg,eh){{};var parent=eg.getLayoutParent();if(parent&&parent!=this){parent._remove(eg);}eg.setLayoutParent(this);if(eh){eg.setLayoutProperties(eh);}else{this.updateLayoutProperties();}if(this._afterAddChild){this._afterAddChild(eg);}},__eh:function(ei){{};if(ei.getLayoutParent()!==this){throw new Error("Remove Error: "+ei+" is not a child of this widget!");}ei.setLayoutParent(null);if(this.__ea){this.__ea.invalidateChildrenCache();}qx.ui.core.queue.Layout.add(this);if(this._afterRemoveChild){this._afterRemoveChild(ei);}},capture:function(ej){this.getContainerElement().capture(ej);},releaseCapture:function(){this.getContainerElement().releaseCapture();},_applyPadding:function(ek,em,name){this._updateInsets=true;qx.ui.core.queue.Layout.add(this);},_createProtectorElement:function(){if(this.__dW){return;}var en=this.__dW=new qx.html.Element;{};en.setStyles({position:cc,top:0,left:0,zIndex:7});var eo=this.getBounds();if(eo){this.__dW.setStyles({width:eo.width+bV,height:eo.height+bV});}if(qx.core.Variant.isSet(cb,bo)){en.setStyles({backgroundImage:t+qx.util.ResourceManager.getInstance().toUri(by)+q,backgroundRepeat:cm});}this.getContainerElement().add(en);},_applyDecorator:function(ep,eq){{};var et=qx.ui.core.Widget.__dS;var er=this.getContainerElement();if(!this.__dW&&!qx.bom.client.Feature.CSS_POINTER_EVENTS){this._createProtectorElement();}if(eq){er.remove(this.__dU);et.poolDecorator(this.__dU);}if(ep){var es=this.__dU=et.getDecoratorElement(ep);es.setStyle(bI,5);er.add(es);}else{delete this.__dU;}this._applyBackgroundColor(this.getBackgroundColor());if(this.__eb(eq,ep)){this._updateInsets=true;qx.ui.core.queue.Layout.add(this);}else if(ep){var eu=this.getBounds();if(eu){es.resize(eu.width,eu.height);this.__dW&&this.__dW.setStyles({width:eu.width+bV,height:eu.height+bV});}}},_applyShadow:function(ev,ew){var eD=qx.ui.core.Widget.__dT;var ey=this.getContainerElement();if(ew){ey.remove(this.__dV);eD.poolDecorator(this.__dV);}if(ev){var eA=this.__dV=eD.getDecoratorElement(ev);ey.add(eA);var eC=eA.getInsets();eA.setStyles({left:(-eC.left)+bV,top:(-eC.top)+bV});var eB=this.getBounds();if(eB){var ez=eB.width+eC.left+eC.right;var ex=eB.height+eC.top+eC.bottom;eA.resize(ez,ex);}eA.tint(null);}else{delete this.__dV;}},_applyToolTipText:function(eE,eF){if(qx.core.Variant.isSet(bF,bP)){if(this.__dY){return;}var eG=qx.locale.Manager.getInstance();this.__dY=eG.addListener(bA,function(){var eH=this.getToolTipText();if(eH&&eH.translate){this.setToolTipText(eH.translate());}},this);}},_applyTextColor:function(eI,eJ){},_applyZIndex:function(eK,eL){this.getContainerElement().setStyle(bI,eK==null?0:eK);},_applyVisibility:function(eM,eN){var eO=this.getContainerElement();if(eM===bR){eO.show();}else{eO.hide();}var parent=this.$$parent;if(parent&&(eN==null||eM==null||eN===bM||eM===bM)){parent.invalidateLayoutChildren();}qx.ui.core.queue.Visibility.add(this);},_applyOpacity:function(eP,eQ){this.getContainerElement().setStyle(bL,eP==1?null:eP);if(qx.core.Variant.isSet(cb,bo)&&qx.bom.element.Decoration.isAlphaImageLoaderEnabled()){if(!qx.Class.isSubClassOf(this.getContentElement().constructor,qx.html.Image)){var eR=(eP==1||eP==null)?null:0.99;this.getContentElement().setStyle(bL,eR);}}},_applyCursor:function(eS,eT){if(eS==null&&!this.isSelectable()){eS=bK;}this.getContainerElement().setStyle(Y,eS,qx.bom.client.Engine.OPERA);},_applyBackgroundColor:function(eU,eV){var eW=this.getBackgroundColor();var eY=this.getContainerElement();if(this.__dU){this.__dU.tint(eW);eY.setStyle(bY,null);}else{var eX=qx.theme.manager.Color.getInstance().resolve(eW);eY.setStyle(bY,eX);}},_applyFont:function(fa,fb){},__ei:null,$$stateChanges:null,_forwardStates:null,hasState:function(fc){var fd=this.__ei;return !!fd&&!!fd[fc];},addState:function(fe){var ff=this.__ei;if(!ff){ff=this.__ei={};}if(ff[fe]){return;}this.__ei[fe]=true;if(fe===cd){this.syncAppearance();}else if(!qx.ui.core.queue.Visibility.isVisible(this)){this.$$stateChanges=true;}else{qx.ui.core.queue.Appearance.add(this);}var forward=this._forwardStates;var fi=this.__el;if(forward&&forward[fe]&&fi){var fg;for(var fh in fi){fg=fi[fh];if(fg instanceof qx.ui.core.Widget){fi[fh].addState(fe);}}}},removeState:function(fj){var fk=this.__ei;if(!fk||!fk[fj]){return;}delete this.__ei[fj];if(fj===cd){this.syncAppearance();}else if(!qx.ui.core.queue.Visibility.isVisible(this)){this.$$stateChanges=true;}else{qx.ui.core.queue.Appearance.add(this);}var forward=this._forwardStates;var fn=this.__el;if(forward&&forward[fj]&&fn){for(var fm in fn){var fl=fn[fm];if(fl instanceof qx.ui.core.Widget){fl.removeState(fj);}}}},replaceState:function(fo,fp){var fq=this.__ei;if(!fq){fq=this.__ei={};}if(!fq[fp]){fq[fp]=true;}if(fq[fo]){delete fq[fo];}if(!qx.ui.core.queue.Visibility.isVisible(this)){this.$$stateChanges=true;}else{qx.ui.core.queue.Appearance.add(this);}var forward=this._forwardStates;var ft=this.__el;if(forward&&forward[fp]&&ft){for(var fs in ft){var fr=ft[fs];if(fr instanceof qx.ui.core.Widget){fr.replaceState(fo,fp);}}}},__ej:null,__ek:null,syncAppearance:function(){var fy=this.__ei;var fx=this.__ej;var fz=qx.theme.manager.Appearance.getInstance();var fv=qx.core.Property.$$method.setThemed;var fD=qx.core.Property.$$method.resetThemed;if(this.__ek){delete this.__ek;if(fx){var fu=fz.styleFrom(fx,fy,null,this.getAppearance());if(fu){fx=null;}}}if(!fx){var fw=this;var fC=[];do{fC.push(fw.$$subcontrol||fw.getAppearance());}while(fw=fw.$$subparent);fx=fC.reverse().join(be).replace(/#[0-9]+/g,bf);this.__ej=fx;}var fA=fz.styleFrom(fx,fy,null,this.getAppearance());if(fA){var fB;if(fu){for(var fB in fu){if(fA[fB]===undefined){this[fD[fB]]();}}}{};for(var fB in fA){fA[fB]===undefined?this[fD[fB]]():this[fv[fB]](fA[fB]);}}else if(fu){for(var fB in fu){this[fD[fB]]();}}this.fireDataEvent(cp,this.__ei);},_applyAppearance:function(fE,fF){this.updateAppearance();},checkAppearanceNeeds:function(){if(!this.__dX){qx.ui.core.queue.Appearance.add(this);this.__dX=true;}else if(this.$$stateChanges){qx.ui.core.queue.Appearance.add(this);delete this.$$stateChanges;}},updateAppearance:function(){this.__ek=true;qx.ui.core.queue.Appearance.add(this);var fI=this.__el;if(fI){var fG;for(var fH in fI){fG=fI[fH];if(fG instanceof qx.ui.core.Widget){fG.updateAppearance();}}}},syncWidget:function(){},getEventTarget:function(){var fJ=this;while(fJ.getAnonymous()){fJ=fJ.getLayoutParent();if(!fJ){return null;}}return fJ;},getFocusTarget:function(){var fK=this;if(!fK.getEnabled()){return null;}while(fK.getAnonymous()||!fK.getFocusable()){fK=fK.getLayoutParent();if(!fK||!fK.getEnabled()){return null;}}return fK;},getFocusElement:function(){return this.getContainerElement();},isTabable:function(){return (!!this.getContainerElement().getDomElement())&&this.isFocusable();},_applyFocusable:function(fL,fM){var fN=this.getFocusElement();if(fL){var fO=this.getTabIndex();if(fO==null){fO=1;}fN.setAttribute(br,fO);if(qx.core.Variant.isSet(cb,bo)){fN.setAttribute(y,D);}else{fN.setStyle(s,x);}}else{if(fN.isNativelyFocusable()){fN.setAttribute(br,-1);}else if(fM){fN.setAttribute(br,null);}}},_applyKeepFocus:function(fP){var fQ=this.getFocusElement();fQ.setAttribute(bz,fP?bP:null);},_applyKeepActive:function(fR){var fS=this.getContainerElement();fS.setAttribute(bl,fR?bP:null);},_applyTabIndex:function(fT){if(fT==null){fT=1;}else if(fT<1||fT>32000){throw new Error("TabIndex property must be between 1 and 32000");}if(this.getFocusable()&&fT!=null){this.getFocusElement().setAttribute(br,fT);}},_applySelectable:function(fU,fV){if(fV!==null){this._applyCursor(this.getCursor());}this.getContentElement().setSelectable(fU);},_applyEnabled:function(fW,fX){if(fW===false){this.addState(bX);this.removeState(cd);if(this.isFocusable()){this.removeState(bq);this._applyFocusable(false,true);}if(this.isDraggable()){this._applyDraggable(false,true);}if(this.isDroppable()){this._applyDroppable(false,true);}}else{this.removeState(bX);if(this.isFocusable()){this._applyFocusable(true,false);}if(this.isDraggable()){this._applyDraggable(true,false);}if(this.isDroppable()){this._applyDroppable(true,false);}}},_applyNativeContextMenu:function(fY,ga,name){},_applyContextMenu:function(gb,gc){if(gc){gc.removeState(bt);if(gc.getOpener()==this){gc.resetOpener();}if(!gb){this.removeListener(bt,this._onContextMenuOpen);gc.removeListener(bp,this._onBeforeContextMenuOpen,this);}}if(gb){gb.setOpener(this);gb.addState(bt);if(!gc){this.addListener(bt,this._onContextMenuOpen);gb.addListener(bp,this._onBeforeContextMenuOpen,this);}}},_onContextMenuOpen:function(e){this.getContextMenu().openAtMouse(e);e.stop();},_onBeforeContextMenuOpen:function(e){if(e.getData()==bR&&this.hasListener(c)){this.fireDataEvent(c,e);}},_onStopEvent:function(e){e.stopPropagation();},_applyDraggable:function(gd,ge){if(!this.isEnabled()&&gd===true){gd=false;}qx.ui.core.DragDropCursor.getInstance();if(gd){this.addListener(cg,this._onDragStart);this.addListener(ca,this._onDrag);this.addListener(bH,this._onDragEnd);this.addListener(bE,this._onDragChange);}else{this.removeListener(cg,this._onDragStart);this.removeListener(ca,this._onDrag);this.removeListener(bH,this._onDragEnd);this.removeListener(bE,this._onDragChange);}this.getContainerElement().setAttribute(cl,gd?bP:null);},_applyDroppable:function(gf,gg){if(!this.isEnabled()&&gf===true){gf=false;}this.getContainerElement().setAttribute(ba,gf?bP:null);},_onDragStart:function(e){qx.ui.core.DragDropCursor.getInstance().placeToMouse(e);this.getApplicationRoot().setGlobalCursor(bK);},_onDrag:function(e){qx.ui.core.DragDropCursor.getInstance().placeToMouse(e);},_onDragEnd:function(e){qx.ui.core.DragDropCursor.getInstance().moveTo(-1000,-1000);this.getApplicationRoot().resetGlobalCursor();},_onDragChange:function(e){var gh=qx.ui.core.DragDropCursor.getInstance();var gi=e.getCurrentAction();gi?gh.setAction(gi):gh.resetAction();},visualizeFocus:function(){this.addState(bq);},visualizeBlur:function(){this.removeState(bq);},scrollChildIntoView:function(gj,gk,gl,gm){this.scrollChildIntoViewX(gj,gk,gm);this.scrollChildIntoViewY(gj,gl,gm);},scrollChildIntoViewX:function(gn,go,gp){this.getContentElement().scrollChildIntoViewX(gn.getContainerElement(),go,gp);},scrollChildIntoViewY:function(gq,gr,gs){this.getContentElement().scrollChildIntoViewY(gq.getContainerElement(),gr,gs);},focus:function(){if(this.isFocusable()){this.getFocusElement().focus();}else{throw new Error("Widget is not focusable!");}},blur:function(){if(this.isFocusable()){this.getFocusElement().blur();}else{throw new Error("Widget is not focusable!");}},activate:function(){this.getContainerElement().activate();},deactivate:function(){this.getContainerElement().deactivate();},tabFocus:function(){this.getFocusElement().focus();},hasChildControl:function(gt){if(!this.__el){return false;}return !!this.__el[gt];},__el:null,_getCreatedChildControls:function(){return this.__el;},getChildControl:function(gu,gv){if(!this.__el){if(gv){return null;}this.__el={};}var gw=this.__el[gu];if(gw){return gw;}if(gv===true){return null;}return this._createChildControl(gu);},_showChildControl:function(gx){var gy=this.getChildControl(gx);gy.show();return gy;},_excludeChildControl:function(gz){var gA=this.getChildControl(gz,true);if(gA){gA.exclude();}},_isChildControlVisible:function(gB){var gC=this.getChildControl(gB,true);if(gC){return gC.isVisible();}return false;},_createChildControl:function(gD){if(!this.__el){this.__el={};}else if(this.__el[gD]){throw new Error("Child control '"+gD+"' already created!");}var gH=gD.indexOf(M);if(gH==-1){var gE=this._createChildControlImpl(gD);}else{var gE=this._createChildControlImpl(gD.substring(0,gH),gD.substring(gH+1,gD.length));}if(!gE){throw new Error("Unsupported control: "+gD);}gE.$$subcontrol=gD;gE.$$subparent=this;var gF=this.__ei;var forward=this._forwardStates;if(gF&&forward&&gE instanceof qx.ui.core.Widget){for(var gG in gF){if(forward[gG]){gE.addState(gG);}}}this.fireDataEvent(k,gE);return this.__el[gD]=gE;},_createChildControlImpl:function(gI,gJ){return null;},_disposeChildControls:function(){var gN=this.__el;if(!gN){return;}var gL=qx.ui.core.Widget;for(var gM in gN){var gK=gN[gM];if(!gL.contains(this,gK)){gK.destroy();}else{gK.dispose();}}delete this.__el;},_findTopControl:function(){var gO=this;while(gO){if(!gO.$$subparent){return gO;}gO=gO.$$subparent;}return null;},getContainerLocation:function(gP){var gQ=this.getContainerElement().getDomElement();return gQ?qx.bom.element.Location.get(gQ,gP):null;},getContentLocation:function(gR){var gS=this.getContentElement().getDomElement();return gS?qx.bom.element.Location.get(gS,gR):null;},setDomLeft:function(gT){var gU=this.getContainerElement().getDomElement();if(gU){gU.style.left=gT+bV;}else{throw new Error("DOM element is not yet created!");}},setDomTop:function(gV){var gW=this.getContainerElement().getDomElement();if(gW){gW.style.top=gV+bV;}else{throw new Error("DOM element is not yet created!");}},setDomPosition:function(gX,top){var gY=this.getContainerElement().getDomElement();if(gY){gY.style.left=gX+bV;gY.style.top=top+bV;}else{throw new Error("DOM element is not yet created!");}},destroy:function(){if(this.$$disposed){return;}var parent=this.$$parent;if(parent){parent._remove(this);}qx.ui.core.queue.Dispose.add(this);},clone:function(){var ha=qx.ui.core.LayoutItem.prototype.clone.call(this);if(this.getChildren){var hb=this.getChildren();for(var i=0,l=hb.length;i<l;i++){ha.add(hb[i].clone());}}return ha;}},destruct:function(){if(!qx.core.ObjectRegistry.inShutDown){if(qx.core.Variant.isSet(bF,bP)){if(this.__dY){qx.locale.Manager.getInstance().removeListenerById(this.__dY);}}this.getContainerElement().setAttribute(J,null,true);this._disposeChildControls();qx.ui.core.queue.Appearance.remove(this);qx.ui.core.queue.Layout.remove(this);qx.ui.core.queue.Visibility.remove(this);qx.ui.core.queue.Widget.remove(this);}if(!qx.core.ObjectRegistry.inShutDown){var hd=qx.ui.core.Widget;var hc=this.getContainerElement();if(this.__dU){hc.remove(this.__dU);hd.__dS.poolDecorator(this.__dU);}if(this.__dV){hc.remove(this.__dV);hd.__dT.poolDecorator(this.__dV);}this.clearSeparators();this.__dU=this.__dV=this.__ec=null;}else{this._disposeArray(L);this._disposeObjects(W,A);}this._disposeArray(V);this.__ei=this.__el=null;this._disposeObjects(co,m,cq,bi);}});})();(function(){var d="qx.event.type.Data",c="qx.ui.container.Composite",b="addChildWidget",a="removeChildWidget";qx.Class.define(c,{extend:qx.ui.core.Widget,include:[qx.ui.core.MChildrenHandling,qx.ui.core.MLayoutHandling],construct:function(e){qx.ui.core.Widget.call(this);if(e!=null){this._setLayout(e);}},events:{addChildWidget:d,removeChildWidget:d},members:{_afterAddChild:function(f){this.fireNonBubblingEvent(b,qx.event.type.Data,[f]);},_afterRemoveChild:function(g){this.fireNonBubblingEvent(a,qx.event.type.Data,[g]);}},defer:function(h,i){qx.ui.core.MChildrenHandling.remap(i);qx.ui.core.MLayoutHandling.remap(i);}});})();(function(){var l="button",k="",j="close",i="String",h="_applyIcon",g="page",f="qx.event.type.Event",e="_applyShowCloseButton",d="tabview-page",c="qx.ui.tabview.Page",a="_applyLabel",b="Boolean";qx.Class.define(c,{extend:qx.ui.container.Composite,construct:function(m,n){qx.ui.container.Composite.call(this);this._createChildControl(l);if(m!=null){this.setLabel(m);}if(n!=null){this.setIcon(n);}},events:{"close":f},properties:{appearance:{refine:true,init:d},label:{check:i,init:k,apply:a},icon:{check:i,init:k,apply:h},showCloseButton:{check:b,init:false,apply:e}},members:{_forwardStates:{barTop:1,barRight:1,barBottom:1,barLeft:1,firstTab:1,lastTab:1},_applyIcon:function(o,p){this.getChildControl(l).setIcon(o);},_applyLabel:function(q,r){this.getChildControl(l).setLabel(q);},_applyEnabled:function(s,t){qx.ui.container.Composite.prototype._applyEnabled.call(this,s,t);var u=this.getChildControl(l);s==null?u.resetEnabled():u.setEnabled(s);},_createChildControlImpl:function(v,w){var x;switch(v){case l:x=new qx.ui.tabview.TabButton;x.setAllowGrowX(true);x.setAllowGrowY(true);x.setUserData(g,this);x.addListener(j,this._onButtonClose,this);break;}return x||qx.ui.container.Composite.prototype._createChildControlImpl.call(this,v);},_applyShowCloseButton:function(y,z){this.getChildControl(l).setShowCloseButton(y);},_onButtonClose:function(){this.fireEvent(j);},getButton:function(){return this.getChildControl(l);}}});})();(function(){var i="showPrivate",h="expandProperties",g="showInherited",f="showProtected",d="_applyClassNode",c="apiviewer.ui.tabview.AbstractPage",b="nodeName",a="abstract";qx.Class.define(c,{extend:qx.ui.tabview.Page,type:a,construct:function(j){qx.ui.tabview.Page.call(this);this.setLayout(new qx.ui.layout.Canvas());this.setShowCloseButton(true);this._bindings=[];this._viewer=this._createViewer();this.add(this._viewer,{edge:0});this.__So(this._viewer);this.setClassNode(j);},properties:{classNode:{apply:d}},members:{_viewer:null,_bindings:null,_createViewer:function(){throw new Error("Abstract method call!");},_applyClassNode:function(k,l){this._viewer.setDocNode(k);this.setLabel(k.getFullName());this.setIcon(apiviewer.TreeUtil.getIconUrl(k));this.setUserData(b,k.getFullName());qx.event.Timer.once(function(e){this._viewer.getContentElement().scrollToY(0);},this,0);},__So:function(m){var n=apiviewer.UiModel.getInstance();var o=this._bindings;o.push(n.bind(g,m,g));o.push(n.bind(h,m,h));o.push(n.bind(f,m,f));o.push(n.bind(i,m,i));},__Sp:function(){var p=apiviewer.UiModel.getInstance();var q=this._bindings;while(q.length>0){var r=q.pop();p.removeBinding(r);}}},destruct:function(){this.__Sp();this._viewer.destroy();this._viewer=null;}});})();(function(){var a="apiviewer.ui.tabview.PackagePage";qx.Class.define(a,{extend:apiviewer.ui.tabview.AbstractPage,members:{_createViewer:function(){return new apiviewer.ui.PackageViewer();}}});})();(function(){var m="ready",l="qx.client",k="mshtml",j="load",i="unload",h="qx.event.handler.Application",g="complete",f="qx.application",d="gecko|opera|webkit",c="left",a="DOMContentLoaded",b="shutdown";qx.Class.define(h,{extend:qx.core.Object,implement:qx.event.IEventHandler,construct:function(n){qx.core.Object.call(this);this._window=n.getWindow();this.__ij=false;this.__ik=false;this._initObserver();qx.event.handler.Application.$$instance=this;},statics:{PRIORITY:qx.event.Registration.PRIORITY_NORMAL,SUPPORTED_TYPES:{ready:1,shutdown:1},TARGET_CHECK:qx.event.IEventHandler.TARGET_WINDOW,IGNORE_CAN_HANDLE:true,onScriptLoaded:function(){var o=qx.event.handler.Application.$$instance;if(o){o.__in();}}},members:{canHandleEvent:function(p,q){},registerEvent:function(r,s,t){},unregisterEvent:function(u,v,w){},__il:null,__ij:null,__ik:null,__im:null,__in:function(){if(!this.__il&&this.__ij&&qx.$$loader.scriptLoaded){try{var x=qx.core.Setting.get(f);if(!qx.Class.getByName(x)){return;}}catch(e){}if(qx.core.Variant.isSet(l,k)){if(qx.event.Registration.hasListener(this._window,m)){this.__il=true;qx.event.Registration.fireEvent(this._window,m);}}else{this.__il=true;qx.event.Registration.fireEvent(this._window,m);}}},isApplicationReady:function(){return this.__il;},_initObserver:function(){if(qx.$$domReady||document.readyState==g||document.readyState==m){this.__ij=true;this.__in();}else{this._onNativeLoadWrapped=qx.lang.Function.bind(this._onNativeLoad,this);if(qx.core.Variant.isSet(l,d)){qx.bom.Event.addNativeListener(this._window,a,this._onNativeLoadWrapped);}else if(qx.core.Variant.isSet(l,k)){var self=this;var y=function(){try{document.documentElement.doScroll(c);if(document.body){self._onNativeLoadWrapped();}}catch(z){window.setTimeout(y,100);}};y();}qx.bom.Event.addNativeListener(this._window,j,this._onNativeLoadWrapped);}this._onNativeUnloadWrapped=qx.lang.Function.bind(this._onNativeUnload,this);qx.bom.Event.addNativeListener(this._window,i,this._onNativeUnloadWrapped);},_stopObserver:function(){if(this._onNativeLoadWrapped){qx.bom.Event.removeNativeListener(this._window,j,this._onNativeLoadWrapped);}qx.bom.Event.removeNativeListener(this._window,i,this._onNativeUnloadWrapped);this._onNativeLoadWrapped=null;this._onNativeUnloadWrapped=null;},_onNativeLoad:qx.event.GlobalError.observeMethod(function(){this.__ij=true;this.__in();}),_onNativeUnload:qx.event.GlobalError.observeMethod(function(){if(!this.__im){this.__im=true;try{qx.event.Registration.fireEvent(this._window,b);}catch(e){throw e;}finally{qx.core.ObjectRegistry.shutdown();}}})},destruct:function(){this._stopObserver();this._window=null;},defer:function(A){qx.event.Registration.addHandler(A);}});})();(function(){var f="ready",d="qx.application",c="beforeunload",b="qx.core.Init",a="shutdown";qx.Class.define(b,{statics:{getApplication:function(){return this.__ku||null;},ready:function(){if(this.__ku){return;}if(qx.bom.client.Engine.UNKNOWN_ENGINE){qx.log.Logger.warn("Could not detect engine!");}if(qx.bom.client.Engine.UNKNOWN_VERSION){qx.log.Logger.warn("Could not detect the version of the engine!");}if(qx.bom.client.Platform.UNKNOWN_PLATFORM){qx.log.Logger.warn("Could not detect platform!");}if(qx.bom.client.System.UNKNOWN_SYSTEM){qx.log.Logger.warn("Could not detect system!");}qx.log.Logger.debug(this,"Load runtime: "+(new Date-qx.Bootstrap.LOADSTART)+"ms");var h=qx.core.Setting.get(d);var i=qx.Class.getByName(h);if(i){this.__ku=new i;var g=new Date;this.__ku.main();qx.log.Logger.debug(this,"Main runtime: "+(new Date-g)+"ms");var g=new Date;this.__ku.finalize();qx.log.Logger.debug(this,"Finalize runtime: "+(new Date-g)+"ms");}else{qx.log.Logger.warn("Missing application class: "+h);}},__kv:function(e){var j=this.__ku;if(j){e.setReturnValue(j.close());}},__kw:function(){var k=this.__ku;if(k){k.terminate();}}},defer:function(l){qx.event.Registration.addListener(window,f,l.ready,l);qx.event.Registration.addListener(window,a,l.__kw,l);qx.event.Registration.addListener(window,c,l.__kv,l);}});})();(function(){var h="object",g="__cq",f="_applyTheme",e="qx.theme.manager.Decoration",d="Theme",c="changeTheme",b="string",a="singleton";qx.Class.define(e,{type:a,extend:qx.core.Object,properties:{theme:{check:d,nullable:true,apply:f,event:c}},members:{__cq:null,resolve:function(i){if(!i){return null;}if(typeof i===h){return i;}var l=this.getTheme();if(!l){return null;}var l=this.getTheme();if(!l){return null;}var m=this.__cq;if(!m){m=this.__cq={};}var j=m[i];if(j){return j;}var k=l.decorations[i];if(!k){return null;}var n=k.decorator;if(n==null){throw new Error("Missing definition of which decorator to use in entry: "+i+"!");}return m[i]=(new n).set(k.style);},isValidPropertyValue:function(o){if(typeof o===b){return this.isDynamic(o);}else if(typeof o===h){var p=o.constructor;return qx.Class.hasInterface(p,qx.ui.decoration.IDecorator);}return false;},isDynamic:function(q){if(!q){return false;}var r=this.getTheme();if(!r){return false;}return !!r.decorations[q];},_applyTheme:function(s,t){var v=qx.util.AliasManager.getInstance();if(t){for(var u in t.aliases){v.remove(u);}}if(s){for(var u in s.aliases){v.add(u,s.aliases[u]);}}if(!s){this.__cq={};}}},destruct:function(){this._disposeMap(g);}});})();(function(){var a="qx.ui.decoration.IDecorator";qx.Interface.define(a,{members:{getMarkup:function(){},resize:function(b,c,d){},tint:function(e,f){},getInsets:function(){}}});})();(function(){var b="qx.util.ValueManager",a="abstract";qx.Class.define(b,{type:a,extend:qx.core.Object,construct:function(){qx.core.Object.call(this);this._dynamic={};},members:{_dynamic:null,resolveDynamic:function(c){return this._dynamic[c];},isDynamic:function(d){return !!this._dynamic[d];},resolve:function(e){if(e&&this._dynamic[e]){return this._dynamic[e];}return e;},_setDynamic:function(f){this._dynamic=f;},_getDynamic:function(){return this._dynamic;}},destruct:function(){this._dynamic=null;}});})();(function(){var j="/",i="0",h="qx/static",g="http://",f="https://",e="file://",d="qx.util.AliasManager",c="singleton",b=".",a="static";qx.Class.define(d,{type:c,extend:qx.util.ValueManager,construct:function(){qx.util.ValueManager.call(this);this.__gF={};this.add(a,h);},members:{__gF:null,_preprocess:function(k){var n=this._getDynamic();if(n[k]===false){return k;}else if(n[k]===undefined){if(k.charAt(0)===j||k.charAt(0)===b||k.indexOf(g)===0||k.indexOf(f)===i||k.indexOf(e)===0){n[k]=false;return k;}if(this.__gF[k]){return this.__gF[k];}var m=k.substring(0,k.indexOf(j));var l=this.__gF[m];if(l!==undefined){n[k]=l+k.substring(m.length);}}return k;},add:function(o,p){this.__gF[o]=p;var r=this._getDynamic();for(var q in r){if(q.substring(0,q.indexOf(j))===o){r[q]=p+q.substring(o.length);}}},remove:function(s){delete this.__gF[s];},resolve:function(t){var u=this._getDynamic();if(t!=null){t=this._preprocess(t);}return u[t]||t;}},destruct:function(){this.__gF=null;}});})();(function(){var c="none",b="qx.html.Decorator",a="absolute";qx.Class.define(b,{extend:qx.html.Element,construct:function(d,e){var f={position:a,top:0,left:0};if(qx.bom.client.Feature.CSS_POINTER_EVENTS){f.pointerEvents=c;}qx.html.Element.call(this,null,f);this.__ks=d;this.__kt=e||d.toHashCode();this.useMarkup(d.getMarkup());},members:{__kt:null,__ks:null,getId:function(){return this.__kt;},getDecorator:function(){return this.__ks;},resize:function(g,h){this.__ks.resize(this.getDomElement(),g,h);},tint:function(i){this.__ks.tint(this.getDomElement(),i);},getInsets:function(){return this.__ks.getInsets();}},destruct:function(){this.__ks=null;}});})();(function(){var f="blur",e="focus",d="input",c="load",b="qx.ui.core.EventHandler",a="activate";qx.Class.define(b,{extend:qx.core.Object,implement:qx.event.IEventHandler,construct:function(){qx.core.Object.call(this);this.__em=qx.event.Registration.getManager(window);},statics:{PRIORITY:qx.event.Registration.PRIORITY_FIRST,SUPPORTED_TYPES:{mousemove:1,mouseover:1,mouseout:1,mousedown:1,mouseup:1,click:1,dblclick:1,contextmenu:1,mousewheel:1,keyup:1,keydown:1,keypress:1,keyinput:1,capture:1,losecapture:1,focusin:1,focusout:1,focus:1,blur:1,activate:1,deactivate:1,appear:1,disappear:1,dragstart:1,dragend:1,dragover:1,dragleave:1,drop:1,drag:1,dragchange:1,droprequest:1,touchstart:1,touchend:1,touchmove:1,touchcancel:1,tap:1,swipe:1},IGNORE_CAN_HANDLE:false},members:{__em:null,__en:{focusin:1,focusout:1,focus:1,blur:1},__eo:{mouseover:1,mouseout:1,appear:1,disappear:1},canHandleEvent:function(g,h){return g instanceof qx.ui.core.Widget;},_dispatchEvent:function(j){var p=j.getTarget();var o=qx.ui.core.Widget.getWidgetByElement(p);var q=false;while(o&&o.isAnonymous()){var q=true;o=o.getLayoutParent();}if(o&&q&&j.getType()==a){o.getContainerElement().activate();}if(this.__en[j.getType()]){o=o&&o.getFocusTarget();if(!o){return;}}if(j.getRelatedTarget){var x=j.getRelatedTarget();var w=qx.ui.core.Widget.getWidgetByElement(x);while(w&&w.isAnonymous()){w=w.getLayoutParent();}if(w){if(this.__en[j.getType()]){w=w.getFocusTarget();}if(w===o){return;}}}var s=j.getCurrentTarget();var u=qx.ui.core.Widget.getWidgetByElement(s);if(!u||u.isAnonymous()){return;}if(this.__en[j.getType()]){u=u.getFocusTarget();}var v=j.getType();if(!u||!(u.isEnabled()||this.__eo[v])){return;}var k=j.getEventPhase()==qx.event.type.Event.CAPTURING_PHASE;var r=this.__em.getListeners(u,v,k);if(!r||r.length===0){return;}var m=qx.event.Pool.getInstance().getObject(j.constructor);j.clone(m);m.setTarget(o);m.setRelatedTarget(w||null);m.setCurrentTarget(u);var y=j.getOriginalTarget();if(y){var n=qx.ui.core.Widget.getWidgetByElement(y);while(n&&n.isAnonymous()){n=n.getLayoutParent();}m.setOriginalTarget(n);}else{m.setOriginalTarget(p);}for(var i=0,l=r.length;i<l;i++){var t=r[i].context||u;r[i].handler.call(t,m);}if(m.getPropagationStopped()){j.stopPropagation();}if(m.getDefaultPrevented()){j.preventDefault();}qx.event.Pool.getInstance().poolObject(m);},registerEvent:function(z,A,B){var C;if(A===e||A===f){C=z.getFocusElement();}else if(A===c||A===d){C=z.getContentElement();}else{C=z.getContainerElement();}if(C){C.addListener(A,this._dispatchEvent,this,B);}},unregisterEvent:function(D,E,F){var G;if(E===e||E===f){G=D.getFocusElement();}else if(E===c||E===d){G=D.getContentElement();}else{G=D.getContainerElement();}if(G){G.removeListener(E,this._dispatchEvent,this,F);}}},destruct:function(){this.__em=null;},defer:function(H){qx.event.Registration.addHandler(H);}});})();(function(){var i="",h="/",g="mshtml",f="qx.client",e="//",d="?",c="string",b="qx.util.ResourceManager",a="singleton";qx.Class.define(b,{extend:qx.core.Object,type:a,statics:{__co:qx.$$resources||{},__cp:{}},members:{has:function(j){return !!this.self(arguments).__co[j];},getData:function(k){return this.self(arguments).__co[k]||null;},getImageWidth:function(l){var m=this.self(arguments).__co[l];return m?m[0]:null;},getImageHeight:function(n){var o=this.self(arguments).__co[n];return o?o[1]:null;},getImageFormat:function(p){var q=this.self(arguments).__co[p];return q?q[2]:null;},isClippedImage:function(r){var s=this.self(arguments).__co[r];return s&&s.length>4;},toUri:function(t){if(t==null){return t;}var u=this.self(arguments).__co[t];if(!u){return t;}if(typeof u===c){var w=u;}else{var w=u[3];if(!w){return t;}}var v=i;if(qx.core.Variant.isSet(f,g)&&qx.bom.client.Feature.SSL){v=this.self(arguments).__cp[w];}return v+qx.$$libraries[w].resourceUri+h+t;}},defer:function(x){if(qx.core.Variant.isSet(f,g)){if(qx.bom.client.Feature.SSL){for(var B in qx.$$libraries){var z;if(qx.$$libraries[B].resourceUri){z=qx.$$libraries[B].resourceUri;}else{x.__cp[B]=i;continue;}if(z.match(/^\/\//)!=null){x.__cp[B]=window.location.protocol;}else if(z.match(/^\//)!=null){x.__cp[B]=window.location.protocol+e+window.location.host;}else if(z.match(/^\.\//)!=null){var y=document.URL;x.__cp[B]=y.substring(0,y.lastIndexOf(h)+1);}else if(z.match(/^http/)!=null){x.__cp[B]=i;}else{var C=window.location.href.indexOf(d);var A;if(C==-1){A=window.location.href;}else{A=window.location.href.substring(0,C);}x.__cp[B]=A.substring(0,A.lastIndexOf(h)+1);}}}}}});})();(function(){var c="qx.bom.client.Locale",b="-",a="";qx.Class.define(c,{statics:{LOCALE:"",VARIANT:"",__lD:function(){var d=(navigator.userLanguage||navigator.language).toLowerCase();var f=a;var e=d.indexOf(b);if(e!=-1){f=d.substr(e+1);d=d.substr(0,e);}this.LOCALE=d;this.VARIANT=f;}},defer:function(g){g.__lD();}});})();(function(){var t="",s='indexOf',r='slice',q='concat',p='toLocaleLowerCase',o="qx.type.BaseString",n='match',m='toLocaleUpperCase',k='search',j='replace',c='toLowerCase',h='charCodeAt',f='split',b='substring',a='lastIndexOf',e='substr',d='toUpperCase',g='charAt';qx.Class.define(o,{extend:Object,construct:function(u){var u=u||t;this.__mc=u;this.length=u.length;},members:{$$isString:true,length:0,__mc:null,toString:function(){return this.__mc;},charAt:null,valueOf:null,charCodeAt:null,concat:null,indexOf:null,lastIndexOf:null,match:null,replace:null,search:null,slice:null,split:null,substr:null,substring:null,toLowerCase:null,toUpperCase:null,toHashCode:function(){return qx.core.ObjectRegistry.toHashCode(this);},toLocaleLowerCase:null,toLocaleUpperCase:null,base:function(v,w){return qx.core.Object.prototype.base.apply(this,arguments);}},defer:function(x,y){{};var z=[g,h,q,s,a,n,j,k,r,f,e,b,c,d,p,m];y.valueOf=y.toString;if(new x(t).valueOf()==null){delete y.valueOf;}for(var i=0,l=z.length;i<l;i++){y[z[i]]=String.prototype[z[i]];}}});})();(function(){var a="qx.locale.LocalizedString";qx.Class.define(a,{extend:qx.type.BaseString,construct:function(b,c,d){qx.type.BaseString.call(this,b);this.__ep=c;this.__eq=d;},members:{__ep:null,__eq:null,translate:function(){return qx.locale.Manager.getInstance().translate(this.__ep,this.__eq);}}});})();(function(){var k="_",j="",h="_applyLocale",g="changeLocale",f="C",e="qx.dynlocale",d="on",c="qx.locale.Manager",b="String",a="singleton";qx.Class.define(c,{type:a,extend:qx.core.Object,construct:function(){qx.core.Object.call(this);this.__jf=qx.$$translations||{};this.__jg=qx.$$locales||{};var n=qx.bom.client.Locale;var l=n.LOCALE;var m=n.VARIANT;if(m!==j){l+=k+m;}this.__jh=l;this.setLocale(l||this.__ji);},statics:{tr:function(o,p){var q=qx.lang.Array.fromArguments(arguments);q.splice(0,1);return qx.locale.Manager.getInstance().translate(o,q);},trn:function(r,s,t,u){var v=qx.lang.Array.fromArguments(arguments);v.splice(0,3);if(t!=1){return qx.locale.Manager.getInstance().translate(s,v);}else{return qx.locale.Manager.getInstance().translate(r,v);}},trc:function(w,x,y){var z=qx.lang.Array.fromArguments(arguments);z.splice(0,2);return qx.locale.Manager.getInstance().translate(x,z);},marktr:function(A){return A;}},properties:{locale:{check:b,nullable:true,apply:h,event:g}},members:{__ji:f,__jj:null,__jk:null,__jf:null,__jg:null,__jh:null,getLanguage:function(){return this.__jk;},getTerritory:function(){return this.getLocale().split(k)[1]||j;},getAvailableLocales:function(){var C=[];for(var B in this.__jg){if(B!=this.__ji){C.push(B);}}return C;},__jl:function(D){var F;var E=D.indexOf(k);if(E==-1){F=D;}else{F=D.substring(0,E);}return F;},_applyLocale:function(G,H){{};this.__jj=G;this.__jk=this.__jl(G);},addTranslation:function(I,J){var K=this.__jf;if(K[I]){for(var L in J){K[I][L]=J[L];}}else{K[I]=J;}},addLocale:function(M,N){var O=this.__jg;if(O[M]){for(var P in N){O[M][P]=N[P];}}else{O[M]=N;}},translate:function(Q,R,S){var T=this.__jf;return this.__jm(T,Q,R,S);},localize:function(U,V,W){var X=this.__jg;return this.__jm(X,U,V,W);},__jm:function(Y,ba,bb,bc){var bd;if(!Y){return ba;}if(bc){var bf=this.__jl(bc);}else{bc=this.__jj;bf=this.__jk;}if(!bd&&Y[bc]){bd=Y[bc][ba];}if(!bd&&Y[bf]){bd=Y[bf][ba];}if(!bd&&Y[this.__ji]){bd=Y[this.__ji][ba];}if(!bd){bd=ba;}if(bb.length>0){var be=[];for(var i=0;i<bb.length;i++){var bg=bb[i];if(bg&&bg.translate){be[i]=bg.translate();}else{be[i]=bg;}}bd=qx.lang.String.format(bd,be);}if(qx.core.Variant.isSet(e,d)){bd=new qx.locale.LocalizedString(bd,ba,bb);}return bd;}},destruct:function(){this.__jf=this.__jg=null;}});})();(function(){var k="px",j="qx.client",i="div",h="img",g="",f="no-repeat",d="scale-x",c="mshtml",b="scale",a="scale-y",G="qx/icon",F="repeat",E=".png",D="crop",C="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='",B='<div style="',A="repeat-y",z='<img src="',y="qx.bom.element.Decoration",x="', sizingMethod='",r="png",s="')",p='"></div>',q='"/>',n='" style="',o="none",l="webkit",m=" ",t="repeat-x",u="DXImageTransform.Microsoft.AlphaImageLoader",w="qx/static/blank.gif",v="absolute";qx.Class.define(y,{statics:{DEBUG:false,__hx:{},__hy:qx.core.Variant.isSet(j,c)&&qx.bom.client.Engine.VERSION<9,__hz:qx.core.Variant.select(j,{"mshtml":{"scale-x":true,"scale-y":true,"scale":true,"no-repeat":true},"default":null}),__hA:{"scale-x":h,"scale-y":h,"scale":h,"repeat":i,"no-repeat":i,"repeat-x":i,"repeat-y":i},update:function(H,I,J,K){var M=this.getTagName(J,I);if(M!=H.tagName.toLowerCase()){throw new Error("Image modification not possible because elements could not be replaced at runtime anymore!");}var N=this.getAttributes(I,J,K);if(M===h){H.src=N.src||qx.util.ResourceManager.getInstance().toUri(w);}if(H.style.backgroundPosition!=g&&N.style.backgroundPosition===undefined){N.style.backgroundPosition=null;}if(H.style.clip!=g&&N.style.clip===undefined){N.style.clip=null;}var L=qx.bom.element.Style;L.setStyles(H,N.style);if(this.__hy){try{H.filters[u].apply();}catch(e){}}},create:function(O,P,Q){var R=this.getTagName(P,O);var T=this.getAttributes(O,P,Q);var S=qx.bom.element.Style.compile(T.style);if(R===h){return z+T.src+n+S+q;}else{return B+S+p;}},getTagName:function(U,V){if(qx.core.Variant.isSet(j,c)){if(V&&this.__hy&&this.__hz[U]&&qx.lang.String.endsWith(V,E)){return i;}}return this.__hA[U];},getAttributes:function(W,X,Y){if(!Y){Y={};}if(!Y.position){Y.position=v;}if(qx.core.Variant.isSet(j,c)){Y.fontSize=0;Y.lineHeight=0;}else if(qx.core.Variant.isSet(j,l)){Y.WebkitUserDrag=o;}var bb=qx.util.ResourceManager.getInstance().getImageFormat(W)||qx.io.ImageLoader.getFormat(W);{};var ba;if(this.__hy&&this.__hz[X]&&bb===r){ba=this.__hD(Y,X,W);}else{if(X===b){ba=this.__hE(Y,X,W);}else if(X===d||X===a){ba=this.__hF(Y,X,W);}else{ba=this.__hI(Y,X,W);}}return ba;},__hB:function(bc,bd,be){if(bc.width==null&&bd!=null){bc.width=bd+k;}if(bc.height==null&&be!=null){bc.height=be+k;}return bc;},__hC:function(bf){var bh=qx.util.ResourceManager.getInstance().getImageWidth(bf)||qx.io.ImageLoader.getWidth(bf);var bi=qx.util.ResourceManager.getInstance().getImageHeight(bf)||qx.io.ImageLoader.getHeight(bf);return {width:bh,height:bi};},__hD:function(bj,bk,bl){var bo=this.__hC(bl);bj=this.__hB(bj,bo.width,bo.height);var bn=bk==f?D:b;var bm=C+qx.util.ResourceManager.getInstance().toUri(bl)+x+bn+s;bj.filter=bm;bj.backgroundImage=bj.backgroundRepeat=g;return {style:bj};},__hE:function(bp,bq,br){var bs=qx.util.ResourceManager.getInstance().toUri(br);var bt=this.__hC(br);bp=this.__hB(bp,bt.width,bt.height);return {src:bs,style:bp};},__hF:function(bu,bv,bw){var bA=qx.util.ResourceManager.getInstance();var bz=bA.isClippedImage(bw);var bB=this.__hC(bw);if(bz){var by=bA.getData(bw);var bx=bA.toUri(by[4]);if(bv===d){bu=this.__hG(bu,by,bB.height);}else{bu=this.__hH(bu,by,bB.width);}return {src:bx,style:bu};}else{{};if(bv==d){bu.height=bB.height==null?null:bB.height+k;}else if(bv==a){bu.width=bB.width==null?null:bB.width+k;}var bx=bA.toUri(bw);return {src:bx,style:bu};}},__hG:function(bC,bD,bE){var bF=qx.util.ResourceManager.getInstance().getImageHeight(bD[4]);bC.clip={top:-bD[6],height:bE};bC.height=bF+k;if(bC.top!=null){bC.top=(parseInt(bC.top,10)+bD[6])+k;}else if(bC.bottom!=null){bC.bottom=(parseInt(bC.bottom,10)+bE-bF-bD[6])+k;}return bC;},__hH:function(bG,bH,bI){var bJ=qx.util.ResourceManager.getInstance().getImageWidth(bH[4]);bG.clip={left:-bH[5],width:bI};bG.width=bJ+k;if(bG.left!=null){bG.left=(parseInt(bG.left,10)+bH[5])+k;}else if(bG.right!=null){bG.right=(parseInt(bG.right,10)+bI-bJ-bH[5])+k;}return bG;},__hI:function(bK,bL,bM){var bR=qx.util.ResourceManager.getInstance().isClippedImage(bM);var bQ=this.__hC(bM);if(bR&&bL!==F){var bP=qx.util.ResourceManager.getInstance().getData(bM);var bO=qx.bom.element.Background.getStyles(bP[4],bL,bP[5],bP[6]);for(var bN in bO){bK[bN]=bO[bN];}if(bQ.width!=null&&bK.width==null&&(bL==A||bL===f)){bK.width=bQ.width+k;}if(bQ.height!=null&&bK.height==null&&(bL==t||bL===f)){bK.height=bQ.height+k;}return {style:bK};}else{{};bK=this.__hB(bK,bQ.width,bQ.height);bK=this.__hJ(bK,bM,bL);return {style:bK};}},__hJ:function(bS,bT,bU){var top=null;var bY=null;if(bS.backgroundPosition){var bV=bS.backgroundPosition.split(m);bY=parseInt(bV[0],10);if(isNaN(bY)){bY=bV[0];}top=parseInt(bV[1],10);if(isNaN(top)){top=bV[1];}}var bX=qx.bom.element.Background.getStyles(bT,bU,bY,top);for(var bW in bX){bS[bW]=bX[bW];}if(bS.filter){bS.filter=g;}return bS;},__hK:function(ca){if(this.DEBUG&&qx.util.ResourceManager.getInstance().has(ca)&&ca.indexOf(G)==-1){if(!this.__hx[ca]){qx.log.Logger.debug("Potential clipped image candidate: "+ca);this.__hx[ca]=true;}}},isAlphaImageLoaderEnabled:qx.core.Variant.select(j,{"mshtml":function(){return qx.bom.element.Decoration.__hy;},"default":function(){return false;}})}});})();(function(){var c="qx.client",b="load",a="qx.io.ImageLoader";qx.Bootstrap.define(a,{statics:{__lo:{},__lp:{width:null,height:null},__lq:/\.(png|gif|jpg|jpeg|bmp)\b/i,isLoaded:function(d){var e=this.__lo[d];return !!(e&&e.loaded);},isFailed:function(f){var g=this.__lo[f];return !!(g&&g.failed);},isLoading:function(h){var j=this.__lo[h];return !!(j&&j.loading);},getFormat:function(k){var m=this.__lo[k];return m?m.format:null;},getSize:function(n){var o=this.__lo[n];return o?{width:o.width,height:o.height}:this.__lp;},getWidth:function(p){var q=this.__lo[p];return q?q.width:null;},getHeight:function(r){var s=this.__lo[r];return s?s.height:null;},load:function(t,u,v){var w=this.__lo[t];if(!w){w=this.__lo[t]={};}if(u&&!v){v=window;}if(w.loaded||w.loading||w.failed){if(u){if(w.loading){w.callbacks.push(u,v);}else{u.call(v,t,w);}}}else{w.loading=true;w.callbacks=[];if(u){w.callbacks.push(u,v);}var y=new Image();var x=qx.lang.Function.listener(this.__lr,this,y,t);y.onload=x;y.onerror=x;y.src=t;w.element=y;}},abort:function(z){var A=this.__lo[z];if(A&&!A.loaded){A.aborted=true;var C=A.callbacks;var B=A.element;B.onload=B.onerror=null;delete A.callbacks;delete A.element;delete A.loading;for(var i=0,l=C.length;i<l;i+=2){C[i].call(C[i+1],z,A);}}this.__lo[z]=null;},__lr:qx.event.GlobalError.observeMethod(function(event,D,E){var F=this.__lo[E];if(event.type===b){F.loaded=true;F.width=this.__ls(D);F.height=this.__lt(D);var G=this.__lq.exec(E);if(G!=null){F.format=G[1];}}else{F.failed=true;}D.onload=D.onerror=null;var H=F.callbacks;delete F.loading;delete F.callbacks;delete F.element;for(var i=0,l=H.length;i<l;i+=2){H[i].call(H[i+1],E,F);}}),__ls:qx.core.Variant.select(c,{"gecko":function(I){return I.naturalWidth;},"default":function(J){return J.width;}}),__lt:qx.core.Variant.select(c,{"gecko":function(K){return K.naturalHeight;},"default":function(L){return L.height;}})}});})();(function(){var m="number",l="0",k="px",j=";",i="background-image:url(",h=");",g="",f=")",e="background-repeat:",d=" ",a="qx.bom.element.Background",c="url(",b="background-position:";qx.Class.define(a,{statics:{__da:[i,null,h,b,null,j,e,null,j],__db:{backgroundImage:null,backgroundPosition:null,backgroundRepeat:null},__dc:function(n,top){var o=qx.bom.client.Engine;if(o.GECKO&&o.VERSION<1.9&&n==top&&typeof n==m){top+=0.01;}if(n){var p=(typeof n==m)?n+k:n;}else{p=l;}if(top){var q=(typeof top==m)?top+k:top;}else{q=l;}return p+d+q;},compile:function(r,s,t,top){var u=this.__dc(t,top);var v=qx.util.ResourceManager.getInstance().toUri(r);var w=this.__da;w[1]=v;w[4]=u;w[7]=s;return w.join(g);},getStyles:function(x,y,z,top){if(!x){return this.__db;}var A=this.__dc(z,top);var B=qx.util.ResourceManager.getInstance().toUri(x);var C={backgroundPosition:A,backgroundImage:c+B+f};if(y!=null){C.backgroundRepeat=y;}return C;},set:function(D,E,F,G,top){var H=this.getStyles(E,F,G,top);for(var I in H){D.style[I]=H[I];}}}});})();(function(){var j="source",i="scale",h="no-repeat",g="qx.client",f="mshtml",e="webkit",d="backgroundImage",c="div",b="qx.html.Image",a="qx/static/blank.gif";qx.Class.define(b,{extend:qx.html.Element,members:{tagNameHint:null,_applyProperty:function(name,k){qx.html.Element.prototype._applyProperty.call(this,name,k);if(name===j){var o=this.getDomElement();var l=this.getAllStyles();if(this.getNodeName()==c&&this.getStyle(d)){l.backgroundPosition=null;l.backgroundRepeat=null;}var m=this._getProperty(j);var n=this._getProperty(i);var p=n?i:h;if(m!=null){qx.bom.element.Decoration.update(o,m,p,l);}}},_createDomElement:function(){var r=this._getProperty(i);var s=r?i:h;if(qx.core.Variant.isSet(g,f)){var q=this._getProperty(j);if(this.tagNameHint!=null){this.setNodeName(this.tagNameHint);}else{this.setNodeName(qx.bom.element.Decoration.getTagName(s,q));}}else{this.setNodeName(qx.bom.element.Decoration.getTagName(s));}return qx.html.Element.prototype._createDomElement.call(this);},_copyData:function(t){return qx.html.Element.prototype._copyData.call(this,true);},setSource:function(u){this._setProperty(j,u);return this;},getSource:function(){return this._getProperty(j);},resetSource:function(){if(qx.core.Variant.isSet(g,e)){this._setProperty(j,qx.util.ResourceManager.getInstance().toUri(a));}else{this._removeProperty(j,true);}return this;},setScale:function(v){this._setProperty(i,v);return this;},getScale:function(){return this._getProperty(i);}}});})();(function(){var f="_applyTheme",e="qx.theme.manager.Color",d="Theme",c="changeTheme",b="string",a="singleton";qx.Class.define(e,{type:a,extend:qx.util.ValueManager,properties:{theme:{check:d,nullable:true,apply:f,event:c}},members:{_applyTheme:function(g){var h={};if(g){var i=g.colors;var j=qx.util.ColorUtil;var k;for(var l in i){k=i[l];if(typeof k===b){if(!j.isCssString(k)){throw new Error("Could not parse color: "+k);}}else if(k instanceof Array){k=j.rgbToRgbString(k);}else{throw new Error("Could not parse color: "+k);}h[l]=k;}}this._setDynamic(h);},resolve:function(m){var p=this._dynamic;var n=p[m];if(n){return n;}var o=this.getTheme();if(o!==null&&o.colors[m]){return p[m]=o.colors[m];}return m;},isDynamic:function(q){var s=this._dynamic;if(q&&(s[q]!==undefined)){return true;}var r=this.getTheme();if(r!==null&&q&&(r.colors[q]!==undefined)){s[q]=r.colors[q];return true;}return false;}}});})();(function(){var h=",",e="rgb(",d=")",c="qx.theme.manager.Color",a="qx.util.ColorUtil";qx.Class.define(a,{statics:{REGEXP:{hex3:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,rgb:/^rgb\(\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*,\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*,\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*\)$/,rgba:/^rgba\(\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*,\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*,\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*,\s*([0-9]{1,3}\.{0,1}[0-9]*)\s*\)$/},SYSTEM:{activeborder:true,activecaption:true,appworkspace:true,background:true,buttonface:true,buttonhighlight:true,buttonshadow:true,buttontext:true,captiontext:true,graytext:true,highlight:true,highlighttext:true,inactiveborder:true,inactivecaption:true,inactivecaptiontext:true,infobackground:true,infotext:true,menu:true,menutext:true,scrollbar:true,threeddarkshadow:true,threedface:true,threedhighlight:true,threedlightshadow:true,threedshadow:true,window:true,windowframe:true,windowtext:true},NAMED:{black:[0,0,0],silver:[192,192,192],gray:[128,128,128],white:[255,255,255],maroon:[128,0,0],red:[255,0,0],purple:[128,0,128],fuchsia:[255,0,255],green:[0,128,0],lime:[0,255,0],olive:[128,128,0],yellow:[255,255,0],navy:[0,0,128],blue:[0,0,255],teal:[0,128,128],aqua:[0,255,255],transparent:[-1,-1,-1],magenta:[255,0,255],orange:[255,165,0],brown:[165,42,42]},isNamedColor:function(j){return this.NAMED[j]!==undefined;},isSystemColor:function(k){return this.SYSTEM[k]!==undefined;},supportsThemes:function(){return qx.Class.isDefined(c);},isThemedColor:function(l){if(!this.supportsThemes()){return false;}return qx.theme.manager.Color.getInstance().isDynamic(l);},stringToRgb:function(m){if(this.supportsThemes()&&this.isThemedColor(m)){var m=qx.theme.manager.Color.getInstance().resolveDynamic(m);}if(this.isNamedColor(m)){return this.NAMED[m];}else if(this.isSystemColor(m)){throw new Error("Could not convert system colors to RGB: "+m);}else if(this.isRgbString(m)){return this.__gB();}else if(this.isHex3String(m)){return this.__gD();}else if(this.isHex6String(m)){return this.__gE();}throw new Error("Could not parse color: "+m);},cssStringToRgb:function(n){if(this.isNamedColor(n)){return this.NAMED[n];}else if(this.isSystemColor(n)){throw new Error("Could not convert system colors to RGB: "+n);}else if(this.isRgbString(n)){return this.__gB();}else if(this.isRgbaString(n)){return this.__gC();}else if(this.isHex3String(n)){return this.__gD();}else if(this.isHex6String(n)){return this.__gE();}throw new Error("Could not parse color: "+n);},stringToRgbString:function(o){return this.rgbToRgbString(this.stringToRgb(o));},rgbToRgbString:function(s){return e+s[0]+h+s[1]+h+s[2]+d;},rgbToHexString:function(u){return (qx.lang.String.pad(u[0].toString(16).toUpperCase(),2)+qx.lang.String.pad(u[1].toString(16).toUpperCase(),2)+qx.lang.String.pad(u[2].toString(16).toUpperCase(),2));},isValidPropertyValue:function(v){return this.isThemedColor(v)||this.isNamedColor(v)||this.isHex3String(v)||this.isHex6String(v)||this.isRgbString(v);},isCssString:function(w){return this.isSystemColor(w)||this.isNamedColor(w)||this.isHex3String(w)||this.isHex6String(w)||this.isRgbString(w);},isHex3String:function(x){return this.REGEXP.hex3.test(x);},isHex6String:function(y){return this.REGEXP.hex6.test(y);},isRgbString:function(z){return this.REGEXP.rgb.test(z);},isRgbaString:function(A){return this.REGEXP.rgba.test(A);},__gB:function(){var D=parseInt(RegExp.$1,10);var C=parseInt(RegExp.$2,10);var B=parseInt(RegExp.$3,10);return [D,C,B];},__gC:function(){var G=parseInt(RegExp.$1,10);var F=parseInt(RegExp.$2,10);var E=parseInt(RegExp.$3,10);return [G,F,E];},__gD:function(){var J=parseInt(RegExp.$1,16)*17;var I=parseInt(RegExp.$2,16)*17;var H=parseInt(RegExp.$3,16)*17;return [J,I,H];},__gE:function(){var M=(parseInt(RegExp.$1,16)*16)+parseInt(RegExp.$2,16);var L=(parseInt(RegExp.$3,16)*16)+parseInt(RegExp.$4,16);var K=(parseInt(RegExp.$5,16)*16)+parseInt(RegExp.$6,16);return [M,L,K];},hex3StringToRgb:function(N){if(this.isHex3String(N)){return this.__gD(N);}throw new Error("Invalid hex3 value: "+N);},hex6StringToRgb:function(O){if(this.isHex6String(O)){return this.__gE(O);}throw new Error("Invalid hex6 value: "+O);},hexStringToRgb:function(P){if(this.isHex3String(P)){return this.__gD(P);}if(this.isHex6String(P)){return this.__gE(P);}throw new Error("Invalid hex value: "+P);},rgbToHsb:function(Q){var S,T,V;var bc=Q[0];var Y=Q[1];var R=Q[2];var bb=(bc>Y)?bc:Y;if(R>bb){bb=R;}var U=(bc<Y)?bc:Y;if(R<U){U=R;}V=bb/255.0;if(bb!=0){T=(bb-U)/bb;}else{T=0;}if(T==0){S=0;}else{var X=(bb-bc)/(bb-U);var ba=(bb-Y)/(bb-U);var W=(bb-R)/(bb-U);if(bc==bb){S=W-ba;}else if(Y==bb){S=2.0+X-W;}else{S=4.0+ba-X;}S=S/6.0;if(S<0){S=S+1.0;}}return [Math.round(S*360),Math.round(T*100),Math.round(V*100)];},hsbToRgb:function(bd){var i,f,p,q,t;var be=bd[0]/360;var bf=bd[1]/100;var bg=bd[2]/100;if(be>=1.0){be%=1.0;}if(bf>1.0){bf=1.0;}if(bg>1.0){bg=1.0;}var bh=Math.floor(255*bg);var bi={};if(bf==0.0){bi.red=bi.green=bi.blue=bh;}else{be*=6.0;i=Math.floor(be);f=be-i;p=Math.floor(bh*(1.0-bf));q=Math.floor(bh*(1.0-(bf*f)));t=Math.floor(bh*(1.0-(bf*(1.0-f))));switch(i){case 0:bi.red=bh;bi.green=t;bi.blue=p;break;case 1:bi.red=q;bi.green=bh;bi.blue=p;break;case 2:bi.red=p;bi.green=bh;bi.blue=t;break;case 3:bi.red=p;bi.green=q;bi.blue=bh;break;case 4:bi.red=t;bi.green=p;bi.blue=bh;break;case 5:bi.red=bh;bi.green=p;bi.blue=q;break;}}return [bi.red,bi.green,bi.blue];},randomColor:function(){var r=Math.round(Math.random()*255);var g=Math.round(Math.random()*255);var b=Math.round(Math.random()*255);return this.rgbToRgbString([r,g,b]);}}});})();(function(){var h="string",g="_applyTheme",f="qx.theme.manager.Appearance",e=":",d="Theme",c="changeTheme",b="/",a="singleton";qx.Class.define(f,{type:a,extend:qx.core.Object,construct:function(){qx.core.Object.call(this);this.__dL={};this.__dM={};},properties:{theme:{check:d,nullable:true,event:c,apply:g}},members:{__dN:{},__dL:null,__dM:null,_applyTheme:function(j,k){this.__dM={};this.__dL={};},__dO:function(l,m,n){var s=m.appearances;var v=s[l];if(!v){var w=b;var p=[];var u=l.split(w);var t;while(!v&&u.length>0){p.unshift(u.pop());var q=u.join(w);v=s[q];if(v){t=v.alias||v;if(typeof t===h){var r=t+w+p.join(w);return this.__dO(r,m,n);}}}for(var i=0;i<p.length-1;i++){p.shift();var q=p.join(w);var o=this.__dO(q,m);if(o){return o;}}if(n!=null){return this.__dO(n,m);}return null;}else if(typeof v===h){return this.__dO(v,m,n);}else if(v.include&&!v.style){return this.__dO(v.include,m,n);}return l;},styleFrom:function(x,y,z,A){if(!z){z=this.getTheme();}var G=this.__dM;var B=G[x];if(!B){B=G[x]=this.__dO(x,z,A);}var L=z.appearances[B];if(!L){this.warn("Missing appearance: "+x);return null;}if(!L.style){return null;}var M=B;if(y){var N=L.$$bits;if(!N){N=L.$$bits={};L.$$length=0;}var E=0;for(var H in y){if(!y[H]){continue;}if(N[H]==null){N[H]=1<<L.$$length++;}E+=N[H];}if(E>0){M+=e+E;}}var F=this.__dL;if(F[M]!==undefined){return F[M];}if(!y){y=this.__dN;}var J;if(L.include||L.base){var D=L.style(y);var C;if(L.include){C=this.styleFrom(L.include,y,z,A);}J={};if(L.base){var I=this.styleFrom(B,y,L.base,A);if(L.include){for(var K in I){if(!C.hasOwnProperty(K)&&!D.hasOwnProperty(K)){J[K]=I[K];}}}else{for(var K in I){if(!D.hasOwnProperty(K)){J[K]=I[K];}}}}if(L.include){for(var K in C){if(!D.hasOwnProperty(K)){J[K]=C[K];}}}for(var K in D){J[K]=D[K];}}else{J=L.style(y);}return F[M]=J||null;}},destruct:function(){this.__dL=this.__dM=null;}});})();(function(){var j="nonScaled",i="scaled",h="alphaScaled",g=".png",f="qx.client",e="div",d="replacement",c="qx.event.type.Event",b="hidden",a="Boolean",y="px",x="scale",w="changeSource",v="__fP",u="qx.ui.basic.Image",t="loaded",s="-disabled.$1",r="loadingFailed",q="String",p="_applySource",n="img",o="image",l="mshtml",m="_applyScale",k="no-repeat";qx.Class.define(u,{extend:qx.ui.core.Widget,construct:function(z){this.__fP={};qx.ui.core.Widget.call(this);if(z){this.setSource(z);}},properties:{source:{check:q,init:null,nullable:true,event:w,apply:p,themeable:true},scale:{check:a,init:false,themeable:true,apply:m},appearance:{refine:true,init:o},allowShrinkX:{refine:true,init:false},allowShrinkY:{refine:true,init:false},allowGrowX:{refine:true,init:false},allowGrowY:{refine:true,init:false}},events:{loadingFailed:c,loaded:c},members:{__fQ:null,__fR:null,__fS:null,__fP:null,getContentElement:function(){return this.__fW();},_createContentElement:function(){return this.__fW();},_getContentHint:function(){return {width:this.__fQ||0,height:this.__fR||0};},_applyEnabled:function(A,B){qx.ui.core.Widget.prototype._applyEnabled.call(this,A,B);if(this.getSource()){this._styleSource();}},_applySource:function(C){this._styleSource();},_applyScale:function(D){this._styleSource();},__fT:function(E){this.__fS=E;},__fU:function(){if(this.__fS==null){var G=this.getSource();var F=false;if(G!=null){F=qx.lang.String.endsWith(G,g);}if(this.getScale()&&F&&qx.bom.element.Decoration.isAlphaImageLoaderEnabled()){this.__fS=h;}else if(this.getScale()){this.__fS=i;}else{this.__fS=j;}}return this.__fS;},__fV:function(H){var I;var J;if(H==h){I=true;J=e;}else if(H==j){I=false;J=e;}else{I=true;J=n;}var K=new qx.html.Image(J);K.setScale(I);K.setStyles({"overflowX":b,"overflowY":b});return K;},__fW:function(){var L=this.__fU();if(this.__fP[L]==null){this.__fP[L]=this.__fV(L);}return this.__fP[L];},_styleSource:function(){var M=qx.util.AliasManager.getInstance().resolve(this.getSource());if(!M){this.getContentElement().resetSource();return;}this.__fX(M);if(qx.core.Variant.isSet(f,l)){var N=this.getScale()?x:k;this.getContentElement().tagNameHint=qx.bom.element.Decoration.getTagName(N,M);}if(qx.util.ResourceManager.getInstance().has(M)){this.__ga(this.getContentElement(),M);}else if(qx.io.ImageLoader.isLoaded(M)){this.__gb(this.getContentElement(),M);}else{this.__gc(this.getContentElement(),M);}},__fX:qx.core.Variant.select(f,{"mshtml":function(O){var Q=qx.bom.element.Decoration.isAlphaImageLoaderEnabled();var P=qx.lang.String.endsWith(O,g);if(Q&&P){if(this.getScale()&&this.__fU()!=h){this.__fT(h);}else if(!this.getScale()&&this.__fU()!=j){this.__fT(j);}}else{if(this.getScale()&&this.__fU()!=i){this.__fT(i);}else if(!this.getScale()&&this.__fU()!=j){this.__fT(j);}}this.__fY(this.__fW());},"default":function(R){if(this.getScale()&&this.__fU()!=i){this.__fT(i);}else if(!this.getScale()&&this.__fU(j)){this.__fT(j);}this.__fY(this.__fW());}}),__fY:function(S){var V=this.getContainerElement();var W=V.getChild(0);if(W!=S){if(W!=null){var Y=y;var T={};var U=this.getInnerSize();if(U!=null){T.width=U.width+Y;T.height=U.height+Y;}var X=this.getInsets();T.left=X.left+Y;T.top=X.top+Y;T.zIndex=10;S.setStyles(T,true);S.setSelectable(this.getSelectable());}V.removeAt(0);V.addAt(S,0);}},__ga:function(ba,bb){var bd=qx.util.ResourceManager.getInstance();if(!this.getEnabled()){var bc=bb.replace(/\.([a-z]+)$/,s);if(bd.has(bc)){bb=bc;this.addState(d);}else{this.removeState(d);}}if(ba.getSource()===bb){return;}ba.setSource(bb);this.__ge(bd.getImageWidth(bb),bd.getImageHeight(bb));},__gb:function(be,bf){var bh=qx.io.ImageLoader;be.setSource(bf);var bg=bh.getWidth(bf);var bi=bh.getHeight(bf);this.__ge(bg,bi);},__gc:function(bj,bk){var self;var bl=qx.io.ImageLoader;{};if(!bl.isFailed(bk)){bl.load(bk,this.__gd,this);}else{if(bj!=null){bj.resetSource();}}},__gd:function(bm,bn){if(this.$$disposed===true){return;}if(bm!==qx.util.AliasManager.getInstance().resolve(this.getSource())){return;}if(bn.failed){this.warn("Image could not be loaded: "+bm);this.fireEvent(r);}else{this.fireEvent(t);}this._styleSource();},__ge:function(bo,bp){if(bo!==this.__fQ||bp!==this.__fR){this.__fQ=bo;this.__fR=bp;qx.ui.core.queue.Layout.add(this);}}},destruct:function(){this._disposeMap(v);}});})();(function(){var j="Integer",i="interval",h="keep-align",g="disappear",f="best-fit",e="mouse",d="bottom-left",c="direct",b="Boolean",a="bottom-right",x="widget",w="qx.ui.core.MPlacement",v="left-top",u="offsetRight",t="shorthand",s="offsetLeft",r="top-left",q="appear",p="offsetBottom",o="top-right",m="offsetTop",n="right-bottom",k="right-top",l="left-bottom";qx.Mixin.define(w,{statics:{__iR:null,setVisibleElement:function(y){this.__iR=y;},getVisibleElement:function(){return this.__iR;}},properties:{position:{check:[r,o,d,a,v,l,k,n],init:d,themeable:true},placeMethod:{check:[x,e],init:e,themeable:true},domMove:{check:b,init:false},placementModeX:{check:[c,h,f],init:h,themeable:true},placementModeY:{check:[c,h,f],init:h,themeable:true},offsetLeft:{check:j,init:0,themeable:true},offsetTop:{check:j,init:0,themeable:true},offsetRight:{check:j,init:0,themeable:true},offsetBottom:{check:j,init:0,themeable:true},offset:{group:[m,u,p,s],mode:t,themeable:true}},members:{__iS:null,__iT:null,__iU:null,getLayoutLocation:function(z){var C,B,D,top;B=z.getBounds();D=B.left;top=B.top;var E=B;z=z.getLayoutParent();while(z&&!z.isRootWidget()){B=z.getBounds();D+=B.left;top+=B.top;C=z.getInsets();D+=C.left;top+=C.top;z=z.getLayoutParent();}if(z.isRootWidget()){var A=z.getContainerLocation();if(A){D+=A.left;top+=A.top;}}return {left:D,top:top,right:D+E.width,bottom:top+E.height};},moveTo:function(F,top){var H=qx.ui.core.MPlacement.getVisibleElement();if(H){var J=this.getBounds();var G=H.getContentLocation();if(J&&G){var K=top+J.height;var I=F+J.width;if((I>G.left&&F<G.right)&&(K>G.top&&top<G.bottom)){F=Math.max(G.left-J.width,0);}}}if(this.getDomMove()){this.setDomPosition(F,top);}else{this.setLayoutProperties({left:F,top:top});}},placeToWidget:function(L,M){if(M){this.__iV();this.__iS=qx.lang.Function.bind(this.placeToWidget,this,L,false);qx.event.Idle.getInstance().addListener(i,this.__iS);this.__iU=function(){this.__iV();};this.addListener(g,this.__iU,this);}var N=L.getContainerLocation()||this.getLayoutLocation(L);this.__iX(N);},__iV:function(){if(this.__iS){qx.event.Idle.getInstance().removeListener(i,this.__iS);this.__iS=null;}if(this.__iU){this.removeListener(g,this.__iU,this);this.__iU=null;}},placeToMouse:function(event){var P=event.getDocumentLeft();var top=event.getDocumentTop();var O={left:P,top:top,right:P,bottom:top};this.__iX(O);},placeToElement:function(Q,R){var location=qx.bom.element.Location.get(Q);var S={left:location.left,top:location.top,right:location.left+Q.offsetWidth,bottom:location.top+Q.offsetHeight};if(R){this.__iS=qx.lang.Function.bind(this.placeToElement,this,Q,false);qx.event.Idle.getInstance().addListener(i,this.__iS);this.addListener(g,function(){if(this.__iS){qx.event.Idle.getInstance().removeListener(i,this.__iS);this.__iS=null;}},this);}this.__iX(S);},placeToPoint:function(T){var U={left:T.left,top:T.top,right:T.left,bottom:T.top};this.__iX(U);},_getPlacementOffsets:function(){return {left:this.getOffsetLeft(),top:this.getOffsetTop(),right:this.getOffsetRight(),bottom:this.getOffsetBottom()};},__iW:function(V){var W=null;if(this._computePlacementSize){var W=this._computePlacementSize();}else if(this.isVisible()){var W=this.getBounds();}if(W==null){this.addListenerOnce(q,function(){this.__iW(V);},this);}else{V.call(this,W);}},__iX:function(X){this.__iW(function(Y){var ba=qx.util.placement.Placement.compute(Y,this.getLayoutParent().getBounds(),X,this._getPlacementOffsets(),this.getPosition(),this.getPlacementModeX(),this.getPlacementModeY());this.moveTo(ba.left,ba.top);});}},destruct:function(){this.__iV();}});})();(function(){var g="dragdrop-cursor",f="_applyAction",e="alias",d="qx.ui.core.DragDropCursor",c="move",b="singleton",a="copy";qx.Class.define(d,{extend:qx.ui.basic.Image,include:qx.ui.core.MPlacement,type:b,construct:function(){qx.ui.basic.Image.call(this);this.setZIndex(1e8);this.setDomMove(true);var h=this.getApplicationRoot();h.add(this,{left:-1000,top:-1000});},properties:{appearance:{refine:true,init:g},action:{check:[e,a,c],apply:f,nullable:true}},members:{_applyAction:function(i,j){if(j){this.removeState(j);}if(i){this.addState(i);}}}});})();(function(){var f="interval",e="Number",d="_applyTimeoutInterval",c="qx.event.type.Event",b="qx.event.Idle",a="singleton";qx.Class.define(b,{extend:qx.core.Object,type:a,construct:function(){qx.core.Object.call(this);var g=new qx.event.Timer(this.getTimeoutInterval());g.addListener(f,this._onInterval,this);g.start();this.__kM=g;},events:{"interval":c},properties:{timeoutInterval:{check:e,init:100,apply:d}},members:{__kM:null,_applyTimeoutInterval:function(h){this.__kM.setInterval(h);},_onInterval:function(){this.fireEvent(f);}},destruct:function(){if(this.__kM){this.__kM.stop();}this.__kM=null;}});})();(function(){var o="top",n="right",m="bottom",l="left",k="align-start",j="qx.util.placement.AbstractAxis",i="edge-start",h="align-end",g="edge-end",f="-",c="best-fit",e="qx.util.placement.Placement",d="keep-align",b="direct",a='__hM';qx.Class.define(e,{extend:qx.core.Object,construct:function(){qx.core.Object.call(this);this.__hM=new qx.util.placement.DirectAxis();},properties:{axisX:{check:j},axisY:{check:j},edge:{check:[o,n,m,l],init:o},align:{check:[o,n,m,l],init:n}},statics:{__hN:null,compute:function(p,q,r,s,t,u,v){this.__hN=this.__hN||new qx.util.placement.Placement();var y=t.split(f);var x=y[0];var w=y[1];this.__hN.set({axisX:this.__hR(u),axisY:this.__hR(v),edge:x,align:w});return this.__hN.compute(p,q,r,s);},__hO:null,__hP:null,__hQ:null,__hR:function(z){switch(z){case b:this.__hO=this.__hO||new qx.util.placement.DirectAxis();return this.__hO;case d:this.__hP=this.__hP||new qx.util.placement.KeepAlignAxis();return this.__hP;case c:this.__hQ=this.__hQ||new qx.util.placement.BestFitAxis();return this.__hQ;default:throw new Error("Invalid 'mode' argument!'");}}},members:{__hM:null,compute:function(A,B,C,D){{};var E=this.getAxisX()||this.__hM;var G=E.computeStart(A.width,{start:C.left,end:C.right},{start:D.left,end:D.right},B.width,this.__hS());var F=this.getAxisY()||this.__hM;var top=F.computeStart(A.height,{start:C.top,end:C.bottom},{start:D.top,end:D.bottom},B.height,this.__hT());return {left:G,top:top};},__hS:function(){var I=this.getEdge();var H=this.getAlign();if(I==l){return i;}else if(I==n){return g;}else if(H==l){return k;}else if(H==n){return h;}},__hT:function(){var K=this.getEdge();var J=this.getAlign();if(K==o){return i;}else if(K==m){return g;}else if(J==o){return k;}else if(J==m){return h;}}},destruct:function(){this._disposeObjects(a);}});})();(function(){var e="edge-start",d="align-start",c="align-end",b="edge-end",a="qx.util.placement.AbstractAxis";qx.Class.define(a,{extend:qx.core.Object,members:{computeStart:function(f,g,h,i,j){throw new Error("abstract method call!");},_moveToEdgeAndAlign:function(k,l,m,n){switch(n){case e:return l.start-m.end-k;case b:return l.end+m.start;case d:return l.start+m.start;case c:return l.end-m.end-k;}},_isInRange:function(o,p,q){return o>=0&&o+p<=q;}}});})();(function(){var a="qx.util.placement.DirectAxis";qx.Class.define(a,{extend:qx.util.placement.AbstractAxis,members:{computeStart:function(b,c,d,e,f){return this._moveToEdgeAndAlign(b,c,d,f);}}});})();(function(){var c="qx.util.placement.KeepAlignAxis",b="edge-start",a="edge-end";qx.Class.define(c,{extend:qx.util.placement.AbstractAxis,members:{computeStart:function(d,e,f,g,h){var i=this._moveToEdgeAndAlign(d,e,f,h);var j,k;if(this._isInRange(i,d,g)){return i;}if(h==b||h==a){j=e.start-f.end;k=e.end+f.start;}else{j=e.end-f.end;k=e.start+f.start;}if(j>g-k){i=j-d;}else{i=k;}return i;}}});})();(function(){var a="qx.util.placement.BestFitAxis";qx.Class.define(a,{extend:qx.util.placement.AbstractAxis,members:{computeStart:function(b,c,d,e,f){var g=this._moveToEdgeAndAlign(b,c,d,f);if(this._isInRange(g,b,e)){return g;}if(g<0){g=Math.min(0,e-b);}if(g+b>e){g=Math.max(0,e-b);}return g;}}});})();(function(){var b="qx.ui.form.IRadioItem",a="qx.event.type.Data";qx.Interface.define(b,{events:{"changeValue":a},members:{setValue:function(c){},getValue:function(){},setGroup:function(d){this.assertInstance(d,qx.ui.form.RadioGroup);},getGroup:function(){}}});})();(function(){var b="changeModel",a="qx.ui.form.MModelProperty";qx.Mixin.define(a,{properties:{model:{nullable:true,event:b,dereference:true}}});})();(function(){var b="qx.ui.form.IBooleanForm",a="qx.event.type.Data";qx.Interface.define(b,{events:{"changeValue":a},members:{setValue:function(c){return arguments.length==1;},resetValue:function(){},getValue:function(){}}});})();(function(){var b="qx.ui.form.IModel",a="qx.event.type.Data";qx.Interface.define(b,{events:{"changeModel":a},members:{setModel:function(c){},getModel:function(){},resetModel:function(){}}});})();(function(){var b="qx.event.type.Data",a="qx.ui.form.IForm";qx.Interface.define(a,{events:{"changeEnabled":b,"changeValid":b,"changeInvalidMessage":b,"changeRequired":b},members:{setEnabled:function(c){return arguments.length==1;},getEnabled:function(){},setRequired:function(d){return arguments.length==1;},getRequired:function(){},setValid:function(e){return arguments.length==1;},getValid:function(){},setInvalidMessage:function(f){return arguments.length==1;},getInvalidMessage:function(){},setRequiredInvalidMessage:function(g){return arguments.length==1;},getRequiredInvalidMessage:function(){}}});})();(function(){var b="qx.ui.form.IExecutable",a="qx.event.type.Data";qx.Interface.define(b,{events:{"execute":a},members:{setCommand:function(c){return arguments.length==1;},getCommand:function(){},execute:function(){}}});})();(function(){var n="execute",m="toolTipText",l="icon",k="label",j="qx.ui.core.MExecutable",h="value",g="qx.event.type.Event",f="_applyCommand",d="enabled",c="menu",a="changeCommand",b="qx.ui.core.Command";qx.Mixin.define(j,{events:{"execute":g},properties:{command:{check:b,apply:f,event:a,nullable:true}},members:{__kN:null,__kO:false,__kP:null,_bindableProperties:[d,k,l,m,h,c],execute:function(){var o=this.getCommand();if(o){if(this.__kO){this.__kO=false;}else{this.__kO=true;o.execute(this);}}this.fireEvent(n);},__kQ:function(e){if(this.__kO){this.__kO=false;return;}this.__kO=true;this.execute();},_applyCommand:function(p,q){if(q!=null){q.removeListenerById(this.__kP);}if(p!=null){this.__kP=p.addListener(n,this.__kQ,this);}var t=this.__kN;if(t==null){this.__kN=t={};}for(var i=0;i<this._bindableProperties.length;i++){var s=this._bindableProperties[i];if(q!=null&&t[s]!=null){q.removeBinding(t[s]);t[s]=null;}if(p!=null&&qx.Class.hasProperty(this.constructor,s)){var r=p.get(s);if(r==null){var u=this.get(s);}t[s]=p.bind(s,this,s);if(u){this.set(s,u);}}}}},destruct:function(){this.__kN=null;}});})();(function(){var j="label",i="icon",h="Boolean",g="both",f="String",e="left",d="changeGap",c="changeShow",b="bottom",a="_applyCenter",y="changeIcon",x="qx.ui.basic.Atom",w="changeLabel",v="Integer",u="_applyIconPosition",t="bottom-left",s="top-left",r="top",q="right",p="_applyRich",n="_applyIcon",o="_applyShow",l="_applyLabel",m="_applyGap",k="atom";qx.Class.define(x,{extend:qx.ui.core.Widget,construct:function(z,A){{};qx.ui.core.Widget.call(this);this._setLayout(new qx.ui.layout.Atom());if(z!=null){this.setLabel(z);}if(A!=null){this.setIcon(A);}},properties:{appearance:{refine:true,init:k},label:{apply:l,nullable:true,check:f,event:w},rich:{check:h,init:false,apply:p},icon:{check:f,apply:n,nullable:true,themeable:true,event:y},gap:{check:v,nullable:false,event:d,apply:m,themeable:true,init:4},show:{init:g,check:[g,j,i],themeable:true,inheritable:true,apply:o,event:c},iconPosition:{init:e,check:[r,q,b,e,s,t],themeable:true,apply:u},center:{init:false,check:h,themeable:true,apply:a}},members:{_createChildControlImpl:function(B,C){var D;switch(B){case j:D=new qx.ui.basic.Label(this.getLabel());D.setAnonymous(true);D.setRich(this.getRich());this._add(D);if(this.getLabel()==null||this.getShow()===i){D.exclude();}break;case i:D=new qx.ui.basic.Image(this.getIcon());D.setAnonymous(true);this._addAt(D,0);if(this.getIcon()==null||this.getShow()===j){D.exclude();}break;}return D||qx.ui.core.Widget.prototype._createChildControlImpl.call(this,B);},_forwardStates:{focused:true,hovered:true},_handleLabel:function(){if(this.getLabel()==null||this.getShow()===i){this._excludeChildControl(j);}else{this._showChildControl(j);}},_handleIcon:function(){if(this.getIcon()==null||this.getShow()===j){this._excludeChildControl(i);}else{this._showChildControl(i);}},_applyLabel:function(E,F){var G=this.getChildControl(j,true);if(G){G.setValue(E);}this._handleLabel();},_applyRich:function(H,I){var J=this.getChildControl(j,true);if(J){J.setRich(H);}},_applyIcon:function(K,L){var M=this.getChildControl(i,true);if(M){M.setSource(K);}this._handleIcon();},_applyGap:function(N,O){this._getLayout().setGap(N);},_applyShow:function(P,Q){this._handleLabel();this._handleIcon();},_applyIconPosition:function(R,S){this._getLayout().setIconPosition(R);},_applyCenter:function(T,U){this._getLayout().setCenter(T);}}});})();(function(){var o="pressed",n="abandoned",m="hovered",l="Enter",k="Space",j="dblclick",i="qx.ui.form.Button",h="mouseup",g="mousedown",f="mouseover",b="mouseout",d="keydown",c="button",a="keyup";qx.Class.define(i,{extend:qx.ui.basic.Atom,include:[qx.ui.core.MExecutable],implement:[qx.ui.form.IExecutable],construct:function(p,q,r){qx.ui.basic.Atom.call(this,p,q);if(r!=null){this.setCommand(r);}this.addListener(f,this._onMouseOver);this.addListener(b,this._onMouseOut);this.addListener(g,this._onMouseDown);this.addListener(h,this._onMouseUp);this.addListener(d,this._onKeyDown);this.addListener(a,this._onKeyUp);this.addListener(j,this._onStopEvent);},properties:{appearance:{refine:true,init:c},focusable:{refine:true,init:true}},members:{_forwardStates:{focused:true,hovered:true,pressed:true,disabled:true},press:function(){if(this.hasState(n)){return;}this.addState(o);},release:function(){if(this.hasState(o)){this.removeState(o);}},reset:function(){this.removeState(o);this.removeState(n);this.removeState(m);},_onMouseOver:function(e){if(!this.isEnabled()||e.getTarget()!==this){return;}if(this.hasState(n)){this.removeState(n);this.addState(o);}this.addState(m);},_onMouseOut:function(e){if(!this.isEnabled()||e.getTarget()!==this){return;}this.removeState(m);if(this.hasState(o)){this.removeState(o);this.addState(n);}},_onMouseDown:function(e){if(!e.isLeftPressed()){return;}e.stopPropagation();this.capture();this.removeState(n);this.addState(o);},_onMouseUp:function(e){this.releaseCapture();var s=this.hasState(o);var t=this.hasState(n);if(s){this.removeState(o);}if(t){this.removeState(n);}else{this.addState(m);if(s){this.execute();}}e.stopPropagation();},_onKeyDown:function(e){switch(e.getKeyIdentifier()){case l:case k:this.removeState(n);this.addState(o);e.stopPropagation();}},_onKeyUp:function(e){switch(e.getKeyIdentifier()){case l:case k:if(this.hasState(o)){this.removeState(n);this.removeState(o);this.execute();e.stopPropagation();}}}}});})();(function(){var m="qx.dynlocale",l="Boolean",k="changeLocale",j="changeInvalidMessage",i="on",h="String",g="invalid",f="",d="qx.ui.form.MForm",c="_applyValid",a="changeRequired",b="changeValid";qx.Mixin.define(d,{construct:function(){if(qx.core.Variant.isSet(m,i)){qx.locale.Manager.getInstance().addListener(k,this.__fn,this);}},properties:{valid:{check:l,init:true,apply:c,event:b},required:{check:l,init:false,event:a},invalidMessage:{check:h,init:f,event:j},requiredInvalidMessage:{check:h,nullable:true,event:j}},members:{_applyValid:function(n,o){n?this.removeState(g):this.addState(g);},__fn:qx.core.Variant.select(m,{"on":function(e){var p=this.getInvalidMessage();if(p&&p.translate){this.setInvalidMessage(p.translate());}var q=this.getRequiredInvalidMessage();if(q&&q.translate){this.setRequiredInvalidMessage(q.translate());}},"off":null})},destruct:function(){if(qx.core.Variant.isSet(m,i)){qx.locale.Manager.getInstance().removeListener(k,this.__fn,this);}}});})();(function(){var o="checked",n="keypress",m="Boolean",l="Right",k="_applyValue",j="changeValue",i="qx.ui.form.RadioButton",h="radiobutton",g="Left",f="qx.ui.form.RadioGroup",b="Down",d="_applyGroup",c="Up",a="execute";qx.Class.define(i,{extend:qx.ui.form.Button,include:[qx.ui.form.MForm,qx.ui.form.MModelProperty],implement:[qx.ui.form.IRadioItem,qx.ui.form.IForm,qx.ui.form.IBooleanForm,qx.ui.form.IModel],construct:function(p){{};qx.ui.form.Button.call(this,p);this.addListener(a,this._onExecute);this.addListener(n,this._onKeyPress);},properties:{group:{check:f,nullable:true,apply:d},value:{check:m,nullable:true,event:j,apply:k,init:false},appearance:{refine:true,init:h},allowGrowX:{refine:true,init:false}},members:{_applyValue:function(q,r){q?this.addState(o):this.removeState(o);if(q&&this.getFocusable()){this.focus();}},_applyGroup:function(s,t){if(t){t.remove(this);}if(s){s.add(this);}},_onExecute:function(e){this.setValue(true);},_onKeyPress:function(e){var u=this.getGroup();if(!u){return;}switch(e.getKeyIdentifier()){case g:case c:u.selectPrevious();break;case l:case b:u.selectNext();break;}}}});})();(function(){var o="close-button",n="middle",m="left",l="icon",k="label",j="right",i="click",h="Boolean",g="bottom",f="qx.ui.tabview.TabButton",c="center",e="_applyShowCloseButton",d="top",b="close",a="qx.event.type.Data";qx.Class.define(f,{extend:qx.ui.form.RadioButton,implement:qx.ui.form.IRadioItem,construct:function(){qx.ui.form.RadioButton.call(this);var p=new qx.ui.layout.Grid(2,0);p.setRowAlign(0,m,n);p.setColumnAlign(0,j,n);this._getLayout().dispose();this._setLayout(p);this.initShowCloseButton();},events:{"close":a},properties:{showCloseButton:{check:h,init:false,apply:e}},members:{_forwardStates:{focused:true,checked:true},_applyIconPosition:function(q,r){var s={icon:this.getChildControl(l),label:this.getChildControl(k),closeButton:this.getShowCloseButton()?this.getChildControl(o):null};for(var t in s){if(s[t]){this._remove(s[t]);}}switch(q){case d:this._add(s.label,{row:3,column:2});this._add(s.icon,{row:1,column:2});if(s.closeButton){this._add(s.closeButton,{row:0,column:4});}break;case g:this._add(s.label,{row:1,column:2});this._add(s.icon,{row:3,column:2});if(s.closeButton){this._add(s.closeButton,{row:0,column:4});}break;case m:this._add(s.label,{row:0,column:2});this._add(s.icon,{row:0,column:0});if(s.closeButton){this._add(s.closeButton,{row:0,column:4});}break;case j:this._add(s.label,{row:0,column:0});this._add(s.icon,{row:0,column:2});if(s.closeButton){this._add(s.closeButton,{row:0,column:4});}break;}},_createChildControlImpl:function(u,v){var w;switch(u){case k:var w=new qx.ui.basic.Label(this.getLabel());w.setAnonymous(true);this._add(w,{row:0,column:2});this._getLayout().setColumnFlex(2,1);break;case l:w=new qx.ui.basic.Image(this.getIcon());w.setAnonymous(true);this._add(w,{row:0,column:0});break;case o:w=new qx.ui.form.Button();w.addListener(i,this._onCloseButtonClick,this);this._add(w,{row:0,column:4});if(!this.getShowCloseButton()){w.exclude();}break;}return w||qx.ui.form.RadioButton.prototype._createChildControlImpl.call(this,u);},_onCloseButtonClick:function(){this.fireDataEvent(b,this);},_applyShowCloseButton:function(x,y){if(x){this._showChildControl(o);}else{this._excludeChildControl(o);}},_applyCenter:function(z){var A=this._getLayout();if(z){A.setColumnAlign(2,c,n);}else{A.setColumnAlign(2,m,n);}}}});})();(function(){var e="change",d="__mp",c="qx.event.type.Data",b="qx.ui.form.MModelSelection",a="changeSelection";qx.Mixin.define(b,{construct:function(){this.__mp=new qx.data.Array();this.__mp.addListener(e,this.__ms,this);this.addListener(a,this.__mr,this);},events:{changeModelSelection:c},members:{__mp:null,__mq:false,__mr:function(){if(this.__mq){return;}var h=this.getSelection();var f=[];for(var i=0;i<h.length;i++){var k=h[i];var g=k.getModel?k.getModel():null;if(g!==null){f.push(g);}}if(f.length===h.length){this.setModelSelection(f);}},__ms:function(){this.__mq=true;var m=this.getSelectables(true);var o=[];var n=this.__mp.toArray();for(var i=0;i<n.length;i++){var q=n[i];for(var j=0;j<m.length;j++){var r=m[j];var l=r.getModel?r.getModel():null;if(q===l){o.push(r);break;}}}this.setSelection(o);this.__mq=false;var p=this.getSelection();if(!qx.lang.Array.equals(p,o)){this.__mr();}},getModelSelection:function(){return this.__mp;},setModelSelection:function(s){if(!s){this.__mp.removeAll();return;}{};s.unshift(this.__mp.getLength());s.unshift(0);var t=this.__mp.splice.apply(this.__mp,s);t.dispose();}},destruct:function(){this._disposeObjects(d);}});})();(function(){var a="qx.ui.form.IModelSelection";qx.Interface.define(a,{members:{setModelSelection:function(b){},getModelSelection:function(){}}});})();(function(){var b="qx.ui.core.ISingleSelection",a="qx.event.type.Data";qx.Interface.define(b,{events:{"changeSelection":a},members:{getSelection:function(){return true;},setSelection:function(c){return arguments.length==1;},resetSelection:function(){return true;},isSelected:function(d){return arguments.length==1;},isSelectionEmpty:function(){return true;},getSelectables:function(e){return arguments.length==1;}}});})();(function(){var f="qx.ui.core.MSingleSelectionHandling",d="__my",c="changeSelection",b="changeSelected",a="qx.event.type.Data";qx.Mixin.define(f,{events:{"changeSelection":a},members:{__my:null,getSelection:function(){var g=this.__mz().getSelected();if(g){return [g];}else{return [];}},setSelection:function(h){switch(h.length){case 0:this.resetSelection();break;case 1:this.__mz().setSelected(h[0]);break;default:throw new Error("Could only select one item, but the selection "+" array contains "+h.length+" items!");}},resetSelection:function(){this.__mz().resetSelected();},isSelected:function(i){return this.__mz().isSelected(i);},isSelectionEmpty:function(){return this.__mz().isSelectionEmpty();},getSelectables:function(j){return this.__mz().getSelectables(j);},_onChangeSelected:function(e){var l=e.getData();var k=e.getOldData();l==null?l=[]:l=[l];k==null?k=[]:k=[k];this.fireDataEvent(c,l,k);},__mz:function(){if(this.__my==null){var m=this;this.__my=new qx.ui.core.SingleSelectionManager({getItems:function(){return m._getItems();},isItemSelectable:function(n){if(m._isItemSelectable){return m._isItemSelectable(n);}else{return n.isVisible();}}});this.__my.addListener(b,this._onChangeSelected,this);}this.__my.setAllowEmptySelection(this._isAllowEmptySelection());return this.__my;}},destruct:function(){this._disposeObjects(d);}});})();(function(){var r="Boolean",q="changeInvalidMessage",p="changeValue",o="String",n="_applyAllowEmptySelection",m="_applyInvalidMessage",k="qx.ui.form.RadioGroup",j="_applyValid",h="",g="changeRequired",c="changeValid",f="changeEnabled",d="__a",b="changeSelection",a="_applyEnabled";qx.Class.define(k,{extend:qx.core.Object,implement:[qx.ui.core.ISingleSelection,qx.ui.form.IForm,qx.ui.form.IModelSelection],include:[qx.ui.core.MSingleSelectionHandling,qx.ui.form.MModelSelection],construct:function(s){qx.core.Object.call(this);this.__a=[];this.addListener(b,this.__b,this);if(s!=null){this.add.apply(this,arguments);}},properties:{enabled:{check:r,apply:a,event:f,init:true},wrap:{check:r,init:true},allowEmptySelection:{check:r,init:false,apply:n},valid:{check:r,init:true,apply:j,event:c},required:{check:r,init:false,event:g},invalidMessage:{check:o,init:h,event:q,apply:m},requiredInvalidMessage:{check:o,nullable:true,event:q}},members:{__a:null,getItems:function(){return this.__a;},add:function(t){var u=this.__a;var v;for(var i=0,l=arguments.length;i<l;i++){v=arguments[i];if(qx.lang.Array.contains(u,v)){continue;}v.addListener(p,this._onItemChangeChecked,this);u.push(v);v.setGroup(this);if(v.getValue()){this.setSelection([v]);}}if(!this.isAllowEmptySelection()&&u.length>0&&!this.getSelection()[0]){this.setSelection([u[0]]);}},remove:function(w){var x=this.__a;if(qx.lang.Array.contains(x,w)){qx.lang.Array.remove(x,w);if(w.getGroup()===this){w.resetGroup();}w.removeListener(p,this._onItemChangeChecked,this);if(w.getValue()){this.resetSelection();}}},getChildren:function(){return this.__a;},_onItemChangeChecked:function(e){var y=e.getTarget();if(y.getValue()){this.setSelection([y]);}else if(this.getSelection()[0]==y){this.resetSelection();}},_applyInvalidMessage:function(z,A){for(var i=0;i<this.__a.length;i++){this.__a[i].setInvalidMessage(z);}},_applyValid:function(B,C){for(var i=0;i<this.__a.length;i++){this.__a[i].setValid(B);}},_applyEnabled:function(D,E){var F=this.__a;if(D==null){for(var i=0,l=F.length;i<l;i++){F[i].resetEnabled();}}else{for(var i=0,l=F.length;i<l;i++){F[i].setEnabled(D);}}},_applyAllowEmptySelection:function(G,H){if(!G&&this.isSelectionEmpty()){this.resetSelection();}},selectNext:function(){var I=this.getSelection()[0];var K=this.__a;var J=K.indexOf(I);if(J==-1){return;}var i=0;var length=K.length;if(this.getWrap()){J=(J+1)%length;}else{J=Math.min(J+1,length-1);}while(i<length&&!K[J].getEnabled()){J=(J+1)%length;i++;}this.setSelection([K[J]]);},selectPrevious:function(){var L=this.getSelection()[0];var N=this.__a;var M=N.indexOf(L);if(M==-1){return;}var i=0;var length=N.length;if(this.getWrap()){M=(M-1+length)%length;}else{M=Math.max(M-1,0);}while(i<length&&!N[M].getEnabled()){M=(M-1+length)%length;i++;}this.setSelection([N[M]]);},_getItems:function(){return this.getItems();},_isAllowEmptySelection:function(){return this.isAllowEmptySelection();},__b:function(e){var P=e.getData()[0];var O=e.getOldData()[0];if(O){O.setValue(false);}if(P){P.setValue(true);}}},destruct:function(){this._disposeArray(d);}});})();(function(){var h="[",g="]",f=".",d="idBubble",c="changeBubble",b="qx.data.marshal.MEventBubbling",a="qx.event.type.Data";qx.Mixin.define(b,{events:{"changeBubble":a},members:{_applyEventPropagation:function(i,j,name){this.fireDataEvent(c,{value:i,name:name,old:j});this._registerEventChaining(i,j,name);},_registerEventChaining:function(k,l,name){if((k instanceof qx.core.Object)&&qx.Class.hasMixin(k.constructor,qx.data.marshal.MEventBubbling)){var m=qx.lang.Function.bind(this.__mA,this,name);var n=k.addListener(c,m,this);k.setUserData(d,n);}if(l!=null&&l.getUserData&&l.getUserData(d)!=null){l.removeListenerById(l.getUserData(d));}},__mA:function(name,e){var v=e.getData();var r=v.value;var p=v.old;if(qx.Class.hasInterface(e.getTarget().constructor,qx.data.IListData)){if(v.name.indexOf){var u=v.name.indexOf(f)!=-1?v.name.indexOf(f):v.name.length;var s=v.name.indexOf(h)!=-1?v.name.indexOf(h):v.name.length;if(u<s){var o=v.name.substring(0,u);var t=v.name.substring(u+1,v.name.length);if(t[0]!=h){t=f+t;}var q=name+h+o+g+t;}else if(s<u){var o=v.name.substring(0,s);var t=v.name.substring(s,v.name.length);var q=name+h+o+g+t;}else{var q=name+h+v.name+g;}}else{var q=name+h+v.name+g;}}else{var q=name+f+v.name;}this.fireDataEvent(c,{value:r,name:q,old:p});}}});})();(function(){var l="change",k="add",j="remove",h="order",g="qx.event.type.Data",f="",e="qx.data.Array",d="?",c="changeBubble",b="number",a="changeLength";qx.Class.define(e,{extend:qx.core.Object,include:qx.data.marshal.MEventBubbling,implement:[qx.data.IListData],construct:function(m){qx.core.Object.call(this);if(m==undefined){this.__mm=[];}else if(arguments.length>1){this.__mm=[];for(var i=0;i<arguments.length;i++){this.__mm.push(arguments[i]);}}else if(typeof m==b){this.__mm=new Array(m);}else if(m instanceof Array){this.__mm=qx.lang.Array.clone(m);}else{this.__mm=[];throw new Error("Type of the parameter not supported!");}for(var i=0;i<this.__mm.length;i++){this._applyEventPropagation(this.__mm[i],null,i);}this.__mn();},events:{"change":g,"changeLength":g},members:{__mm:null,concat:function(n){if(n){var o=this.__mm.concat(n);}else{var o=this.__mm.concat();}return new qx.data.Array(o);},join:function(p){return this.__mm.join(p);},pop:function(){var q=this.__mm.pop();this.__mn();this._applyEventPropagation(null,q,this.length-1);this.fireDataEvent(l,{start:this.length-1,end:this.length-1,type:j,items:[q]},null);return q;},push:function(r){for(var i=0;i<arguments.length;i++){this.__mm.push(arguments[i]);this.__mn();this._applyEventPropagation(arguments[i],null,this.length-1);this.fireDataEvent(l,{start:this.length-1,end:this.length-1,type:k,items:[arguments[i]]},null);}return this.length;},reverse:function(){this.__mm.reverse();this.fireDataEvent(l,{start:0,end:this.length-1,type:h,items:null},null);},shift:function(){var s=this.__mm.shift();this.__mn();this._applyEventPropagation(null,s,this.length-1);this.fireDataEvent(l,{start:0,end:this.length-1,type:j,items:[s]},null);return s;},slice:function(t,u){return new qx.data.Array(this.__mm.slice(t,u));},splice:function(v,w,x){var D=this.__mm.length;var A=this.__mm.splice.apply(this.__mm,arguments);if(this.__mm.length!=D){this.__mn();}var B=w>0;var y=arguments.length>2;var z=null;if(B||y){if(this.__mm.length>D){var C=k;}else if(this.__mm.length<D){var C=j;z=A;}else{var C=h;}this.fireDataEvent(l,{start:v,end:this.length-1,type:C,items:z},null);}for(var i=2;i<arguments.length;i++){this._registerEventChaining(arguments[i],null,v+i);}this.fireDataEvent(c,{value:this,name:d,old:A});for(var i=0;i<A.length;i++){this._applyEventPropagation(null,A[i],i);}return (new qx.data.Array(A));},sort:function(E){this.__mm.sort.apply(this.__mm,arguments);this.fireDataEvent(l,{start:0,end:this.length-1,type:h,items:null},null);},unshift:function(F){for(var i=arguments.length-1;i>=0;i--){this.__mm.unshift(arguments[i]);this.__mn();this._applyEventPropagation(arguments[i],null,0);this.fireDataEvent(l,{start:0,end:this.length-1,type:k,items:[arguments[i]]},null);}return this.length;},toArray:function(){return this.__mm;},getItem:function(G){return this.__mm[G];},setItem:function(H,I){var J=this.__mm[H];if(J===I){return;}this.__mm[H]=I;this._applyEventPropagation(I,J,H);if(this.length!=this.__mm.length){this.__mn();}this.fireDataEvent(l,{start:H,end:H,type:k,items:[I]},null);},getLength:function(){return this.length;},indexOf:function(K){return this.__mm.indexOf(K);},toString:function(){if(this.__mm!=null){return this.__mm.toString();}return f;},contains:function(L){return this.__mm.indexOf(L)!==-1;},copy:function(){return this.concat();},insertAt:function(M,N){this.splice(M,0,N);},insertBefore:function(O,P){var Q=this.indexOf(O);if(Q==-1){this.push(P);}else{this.splice(Q,0,P);}},insertAfter:function(R,S){var T=this.indexOf(R);if(T==-1||T==(this.length-1)){this.push(S);}else{this.splice(T+1,0,S);}},removeAt:function(U){return this.splice(U,1).getItem(0);},removeAll:function(){for(var i=0;i<this.__mm.length;i++){this._applyEventPropagation(null,this.__mm[i],i);}var W=this.getLength();var V=this.__mm.concat();this.__mm.length=0;this.__mn();this.fireDataEvent(l,{start:0,end:W-1,type:j,items:V},null);},append:function(X){if(X instanceof qx.data.Array){X=X.toArray();}{};for(var i=0;i<X.length;i++){this._applyEventPropagation(X[i],null,this.__mm.length+i);}Array.prototype.push.apply(this.__mm,X);var Y=this.length;this.__mn();this.fireDataEvent(l,{start:Y,end:this.length-1,type:k,items:X},null);},remove:function(ba){var bb=this.indexOf(ba);if(bb!=-1){this.splice(bb,1);return ba;}},equals:function(bc){if(this.length!==bc.length){return false;}for(var i=0;i<this.length;i++){if(this.getItem(i)!==bc.getItem(i)){return false;}}return true;},sum:function(){var bd=0;for(var i=0;i<this.length;i++){bd+=this.getItem(i);}return bd;},max:function(){var be=this.getItem(0);for(var i=1;i<this.length;i++){if(this.getItem(i)>be){be=this.getItem(i);}}return be===undefined?null:be;},min:function(){var bf=this.getItem(0);for(var i=1;i<this.length;i++){if(this.getItem(i)<bf){bf=this.getItem(i);}}return bf===undefined?null:bf;},forEach:function(bg,bh){for(var i=0;i<this.__mm.length;i++){bg.call(bh,this.__mm[i]);}},__mn:function(){var bi=this.length;this.length=this.__mm.length;this.fireDataEvent(a,this.length,bi);}},destruct:function(){for(var i=0;i<this.__mm.length;i++){this._applyEventPropagation(null,this.__mm[i],i);}this.__mm=null;}});})();(function(){var g="Boolean",f="qx.ui.core.SingleSelectionManager",e="__mv",d="__mt",c="__mu",b="changeSelected",a="qx.event.type.Data";qx.Class.define(f,{extend:qx.core.Object,construct:function(h){qx.core.Object.call(this);{};this.__mt=h;},events:{"changeSelected":a},properties:{allowEmptySelection:{check:g,init:true,apply:e}},members:{__mu:null,__mt:null,getSelected:function(){return this.__mu;},setSelected:function(j){if(!this.__mx(j)){throw new Error("Could not select "+j+", because it is not a child element!");}this.__mw(j);},resetSelected:function(){this.__mw(null);},isSelected:function(k){if(!this.__mx(k)){throw new Error("Could not check if "+k+" is selected,"+" because it is not a child element!");}return this.__mu===k;},isSelectionEmpty:function(){return this.__mu==null;},getSelectables:function(l){var m=this.__mt.getItems();var n=[];for(var i=0;i<m.length;i++){if(this.__mt.isItemSelectable(m[i])){n.push(m[i]);}}if(!l){for(var i=n.length-1;i>=0;i--){if(!n[i].getEnabled()){n.splice(i,1);}}}return n;},__mv:function(o,p){if(!o){this.__mw(this.__mu);}},__mw:function(q){var t=this.__mu;var s=q;if(s!=null&&t===s){return;}if(!this.isAllowEmptySelection()&&s==null){var r=this.getSelectables(true)[0];if(r){s=r;}}this.__mu=s;this.fireDataEvent(b,s,t);},__mx:function(u){var v=this.__mt.getItems();for(var i=0;i<v.length;i++){if(v[i]===u){return true;}}return false;}},destruct:function(){if(this.__mt.toHashCode){this._disposeObjects(d);}else{this.__mt=null;}this._disposeObjects(c);}});})();(function(){var b="abstract",a="qx.ui.layout.Abstract";qx.Class.define(a,{type:b,extend:qx.core.Object,members:{__gz:null,_invalidChildrenCache:null,__gA:null,invalidateLayoutCache:function(){this.__gz=null;},renderLayout:function(c,d){this.warn("Missing renderLayout() implementation!");},getSizeHint:function(){if(this.__gz){return this.__gz;}return this.__gz=this._computeSizeHint();},hasHeightForWidth:function(){return false;},getHeightForWidth:function(e){this.warn("Missing getHeightForWidth() implementation!");return null;},_computeSizeHint:function(){return null;},invalidateChildrenCache:function(){this._invalidChildrenCache=true;},verifyLayoutProperty:null,_clearSeparators:function(){var f=this.__gA;if(f instanceof qx.ui.core.LayoutItem){f.clearSeparators();}},_renderSeparator:function(g,h){this.__gA.renderSeparator(g,h);},connectToWidget:function(i){if(i&&this.__gA){throw new Error("It is not possible to manually set the connected widget.");}this.__gA=i;this.invalidateChildrenCache();},_getWidget:function(){return this.__gA;},_applyLayoutChange:function(){if(this.__gA){this.__gA.scheduleLayoutUpdate();}},_getLayoutChildren:function(){return this.__gA.getLayoutChildren();}},destruct:function(){this.__gA=this.__gz=null;}});})();(function(){var m="bottom",l="top",k="_applyLayoutChange",j="top-left",h="bottom-left",g="left",f="right",e="middle",d="center",c="qx.ui.layout.Atom",a="Integer",b="Boolean";qx.Class.define(c,{extend:qx.ui.layout.Abstract,properties:{gap:{check:a,init:4,apply:k},iconPosition:{check:[g,l,f,m,j,h],init:g,apply:k},center:{check:b,init:false,apply:k}},members:{verifyLayoutProperty:null,renderLayout:function(n,o){var x=qx.ui.layout.Util;var q=this.getIconPosition();var t=this._getLayoutChildren();var length=t.length;var I,top,y,r;var D,w;var B=this.getGap();var G=this.getCenter();if(q===m||q===f){var z=length-1;var u=-1;var s=-1;}else{var z=0;var u=length;var s=1;}if(q==l||q==m){if(G){var C=0;for(var i=z;i!=u;i+=s){r=t[i].getSizeHint().height;if(r>0){C+=r;if(i!=z){C+=B;}}}top=Math.round((o-C)/2);}else{top=0;}for(var i=z;i!=u;i+=s){D=t[i];w=D.getSizeHint();y=Math.min(w.maxWidth,Math.max(n,w.minWidth));r=w.height;I=x.computeHorizontalAlignOffset(d,y,n);D.renderLayout(I,top,y,r);if(r>0){top+=r+B;}}}else{var v=n;var p=null;var F=0;for(var i=z;i!=u;i+=s){D=t[i];y=D.getSizeHint().width;if(y>0){if(!p&&D instanceof qx.ui.basic.Label){p=D;}else{v-=y;}F++;}}if(F>1){var E=(F-1)*B;v-=E;}if(p){var w=p.getSizeHint();var A=Math.max(w.minWidth,Math.min(v,w.maxWidth));v-=A;}if(G&&v>0){I=Math.round(v/2);}else{I=0;}for(var i=z;i!=u;i+=s){D=t[i];w=D.getSizeHint();r=Math.min(w.maxHeight,Math.max(o,w.minHeight));if(D===p){y=A;}else{y=w.width;}var H=e;if(q==j){H=l;}else if(q==h){H=m;}top=x.computeVerticalAlignOffset(H,w.height,o);D.renderLayout(I,top,y,r);if(y>0){I+=y+B;}}}},_computeSizeHint:function(){var T=this._getLayoutChildren();var length=T.length;var L,R;if(length===1){var L=T[0].getSizeHint();R={width:L.width,height:L.height,minWidth:L.minWidth,minHeight:L.minHeight};}else{var P=0,Q=0;var M=0,O=0;var N=this.getIconPosition();var S=this.getGap();if(N===l||N===m){var J=0;for(var i=0;i<length;i++){L=T[i].getSizeHint();Q=Math.max(Q,L.width);P=Math.max(P,L.minWidth);if(L.height>0){O+=L.height;M+=L.minHeight;J++;}}if(J>1){var K=(J-1)*S;O+=K;M+=K;}}else{var J=0;for(var i=0;i<length;i++){L=T[i].getSizeHint();O=Math.max(O,L.height);M=Math.max(M,L.minHeight);if(L.width>0){Q+=L.width;P+=L.minWidth;J++;}}if(J>1){var K=(J-1)*S;Q+=K;P+=K;}}R={minWidth:P,width:Q,minHeight:M,height:O};}return R;}}});})();(function(){var g="middle",f="qx.ui.layout.Util",e="left",d="center",c="top",b="bottom",a="right";qx.Class.define(f,{statics:{PERCENT_VALUE:/[0-9]+(?:\.[0-9]+)?%/,computeFlexOffsets:function(h,j,k){var n,r,m,s;var o=j>k;var t=Math.abs(j-k);var u,p;var q={};for(r in h){n=h[r];q[r]={potential:o?n.max-n.value:n.value-n.min,flex:o?n.flex:1/n.flex,offset:0};}while(t!=0){s=Infinity;m=0;for(r in q){n=q[r];if(n.potential>0){m+=n.flex;s=Math.min(s,n.potential/n.flex);}}if(m==0){break;}s=Math.min(t,s*m)/m;u=0;for(r in q){n=q[r];if(n.potential>0){p=Math.min(t,n.potential,Math.ceil(s*n.flex));u+=p-s*n.flex;if(u>=1){u-=1;p-=1;}n.potential-=p;if(o){n.offset+=p;}else{n.offset-=p;}t-=p;}}}return q;},computeHorizontalAlignOffset:function(v,w,x,y,z){if(y==null){y=0;}if(z==null){z=0;}var A=0;switch(v){case e:A=y;break;case a:A=x-w-z;break;case d:A=Math.round((x-w)/2);if(A<y){A=y;}else if(A<z){A=Math.max(y,x-w-z);}break;}return A;},computeVerticalAlignOffset:function(B,C,D,E,F){if(E==null){E=0;}if(F==null){F=0;}var G=0;switch(B){case c:G=E;break;case b:G=D-C-F;break;case g:G=Math.round((D-C)/2);if(G<E){G=E;}else if(G<F){G=Math.max(E,D-C-F);}break;}return G;},collapseMargins:function(H){var I=0,K=0;for(var i=0,l=arguments.length;i<l;i++){var J=arguments[i];if(J<0){K=Math.min(K,J);}else if(J>0){I=Math.max(I,J);}}return I+K;},computeHorizontalGaps:function(L,M,N){if(M==null){M=0;}var O=0;if(N){O+=L[0].getMarginLeft();for(var i=1,l=L.length;i<l;i+=1){O+=this.collapseMargins(M,L[i-1].getMarginRight(),L[i].getMarginLeft());}O+=L[l-1].getMarginRight();}else{for(var i=1,l=L.length;i<l;i+=1){O+=L[i].getMarginLeft()+L[i].getMarginRight();}O+=(M*(l-1));}return O;},computeVerticalGaps:function(P,Q,R){if(Q==null){Q=0;}var S=0;if(R){S+=P[0].getMarginTop();for(var i=1,l=P.length;i<l;i+=1){S+=this.collapseMargins(Q,P[i-1].getMarginBottom(),P[i].getMarginTop());}S+=P[l-1].getMarginBottom();}else{for(var i=1,l=P.length;i<l;i+=1){S+=P[i].getMarginTop()+P[i].getMarginBottom();}S+=(Q*(l-1));}return S;},computeHorizontalSeparatorGaps:function(T,U,V){var Y=qx.theme.manager.Decoration.getInstance().resolve(V);var X=Y.getInsets();var W=X.left+X.right;var ba=0;for(var i=0,l=T.length;i<l;i++){var bb=T[i];ba+=bb.getMarginLeft()+bb.getMarginRight();}ba+=(U+W+U)*(l-1);return ba;},computeVerticalSeparatorGaps:function(bc,bd,be){var bh=qx.theme.manager.Decoration.getInstance().resolve(be);var bg=bh.getInsets();var bf=bg.top+bg.bottom;var bi=0;for(var i=0,l=bc.length;i<l;i++){var bj=bc[i];bi+=bj.getMarginTop()+bj.getMarginBottom();}bi+=(bd+bf+bd)*(l-1);return bi;},arrangeIdeals:function(bk,bl,bm,bn,bo,bp){if(bl<bk||bo<bn){if(bl<bk&&bo<bn){bl=bk;bo=bn;}else if(bl<bk){bo-=(bk-bl);bl=bk;if(bo<bn){bo=bn;}}else if(bo<bn){bl-=(bn-bo);bo=bn;if(bl<bk){bl=bk;}}}if(bl>bm||bo>bp){if(bl>bm&&bo>bp){bl=bm;bo=bp;}else if(bl>bm){bo+=(bl-bm);bl=bm;if(bo>bp){bo=bp;}}else if(bo>bp){bl+=(bo-bp);bo=bp;if(bl>bm){bl=bm;}}}return {begin:bl,end:bo};}}});})();(function(){var b="qx.event.type.Data",a="qx.ui.form.IStringForm";qx.Interface.define(a,{events:{"changeValue":b},members:{setValue:function(c){return arguments.length==1;},resetValue:function(){},getValue:function(){}}});})();(function(){var k="qx.dynlocale",j="Boolean",i="color",h="changeLocale",g="enabled",f="on",d="_applyTextAlign",c="qx.ui.core.Widget",b="nowrap",a="changeTextAlign",C="_applyWrap",B="A",A="changeContent",z="qx.ui.basic.Label",y="whiteSpace",x="_applyValue",w="center",v="_applyBuddy",u="String",t="textAlign",r="right",s="changeRich",p="normal",q="_applyRich",n="click",o="label",l="left",m="changeValue";qx.Class.define(z,{extend:qx.ui.core.Widget,implement:[qx.ui.form.IStringForm],construct:function(D){qx.ui.core.Widget.call(this);if(D!=null){this.setValue(D);}if(qx.core.Variant.isSet(k,f)){qx.locale.Manager.getInstance().addListener(h,this._onChangeLocale,this);}},properties:{rich:{check:j,init:false,event:s,apply:q},wrap:{check:j,init:true,apply:C},value:{check:u,apply:x,event:m,nullable:true},buddy:{check:c,apply:v,nullable:true,init:null,dereference:true},textAlign:{check:[l,w,r],nullable:true,themeable:true,apply:d,event:a},appearance:{refine:true,init:o},selectable:{refine:true,init:false},allowGrowX:{refine:true,init:false},allowGrowY:{refine:true,init:false},allowShrinkY:{refine:true,init:false}},members:{__gI:null,__gJ:null,__gK:null,__gL:null,_getContentHint:function(){if(this.__gJ){this.__gM=this.__gN();delete this.__gJ;}return {width:this.__gM.width,height:this.__gM.height};},_hasHeightForWidth:function(){return this.getRich()&&this.getWrap();},_applySelectable:function(E){if(!qx.bom.client.Feature.CSS_TEXT_OVERFLOW&&qx.bom.client.Feature.XUL){if(E&&!this.isRich()){{};return;}}qx.ui.core.Widget.prototype._applySelectable.call(this,E);},_getContentHeightForWidth:function(F){if(!this.getRich()&&!this.getWrap()){return null;}return this.__gN(F).height;},_createContentElement:function(){return new qx.html.Label;},_applyTextAlign:function(G,H){this.getContentElement().setStyle(t,G);},_applyTextColor:function(I,J){if(I){this.getContentElement().setStyle(i,qx.theme.manager.Color.getInstance().resolve(I));}else{this.getContentElement().removeStyle(i);}},__gM:{width:0,height:0},_applyFont:function(K,L){var M;if(K){this.__gI=qx.theme.manager.Font.getInstance().resolve(K);M=this.__gI.getStyles();}else{this.__gI=null;M=qx.bom.Font.getDefaultStyles();}this.getContentElement().setStyles(M);this.__gJ=true;qx.ui.core.queue.Layout.add(this);},__gN:function(N){var R=qx.bom.Label;var P=this.getFont();var O=P?this.__gI.getStyles():qx.bom.Font.getDefaultStyles();var content=this.getValue()||B;var Q=this.getRich();return Q?R.getHtmlSize(content,O,N):R.getTextSize(content,O);},_applyBuddy:function(S,T){if(T!=null){T.removeBinding(this.__gK);this.__gK=null;this.removeListenerById(this.__gL);this.__gL=null;}if(S!=null){this.__gK=S.bind(g,this,g);this.__gL=this.addListener(n,function(){if(S.isFocusable()){S.focus.apply(S);}},this);}},_applyRich:function(U){this.getContentElement().setRich(U);this.__gJ=true;qx.ui.core.queue.Layout.add(this);},_applyWrap:function(V,W){if(V&&!this.isRich()){{};}if(this.isRich()){var X=V?p:b;this.getContentElement().setStyle(y,X);}},_onChangeLocale:qx.core.Variant.select(k,{"on":function(e){var content=this.getValue();if(content&&content.translate){this.setValue(content.translate());}},"off":null}),_applyValue:function(Y,ba){this.getContentElement().setValue(Y);this.__gJ=true;qx.ui.core.queue.Layout.add(this);this.fireDataEvent(A,Y,ba);}},destruct:function(){if(qx.core.Variant.isSet(k,f)){qx.locale.Manager.getInstance().removeListener(h,this._onChangeLocale,this);}if(this.__gK!=null){var bb=this.getBuddy();if(bb!=null&&!bb.isDisposed()){bb.removeBinding(this.__gK);}}this.__gI=this.__gK=null;}});})();(function(){var b="value",a="qx.html.Label";qx.Class.define(a,{extend:qx.html.Element,members:{__dP:null,_applyProperty:function(name,c){qx.html.Element.prototype._applyProperty.call(this,name,c);if(name==b){var d=this.getDomElement();qx.bom.Label.setValue(d,c);}},_createDomElement:function(){var f=this.__dP;var e=qx.bom.Label.create(this._content,f);return e;},_copyData:function(g){return qx.html.Element.prototype._copyData.call(this,true);},setRich:function(h){var i=this.getDomElement();if(i){throw new Error("The label mode cannot be modified after initial creation");}h=!!h;if(this.__dP==h){return;}this.__dP=h;return this;},setValue:function(j){this._setProperty(b,j);return this;},getValue:function(){return this._getProperty(b);}}});})();(function(){var j="div",i="inherit",h="text",g="qx.client",f="value",e="",d="hidden",c="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",b="nowrap",a="auto",z="0",y="ellipsis",x="normal",w="label",v="px",u="crop",t="gecko",s="end",r="100%",q="visible",o="qx.bom.Label",p="opera",m="mshtml",n="block",k="-1000px",l="absolute";qx.Class.define(o,{statics:{__jn:{fontFamily:1,fontSize:1,fontWeight:1,fontStyle:1,lineHeight:1},__jo:function(){var A=this.__jq(false);document.body.insertBefore(A,document.body.firstChild);return this._textElement=A;},__jp:function(){var B=this.__jq(true);document.body.insertBefore(B,document.body.firstChild);return this._htmlElement=B;},__jq:function(C){var D=qx.bom.Element.create(j);var E=D.style;E.width=E.height=a;E.left=E.top=k;E.visibility=d;E.position=l;E.overflow=q;if(C){E.whiteSpace=x;}else{E.whiteSpace=b;if(!qx.bom.client.Feature.CSS_TEXT_OVERFLOW&&qx.bom.client.Feature.XUL){var F=document.createElementNS(c,w);var E=F.style;E.padding=z;for(var G in this.__jn){E[G]=i;}D.appendChild(F);}}return D;},__jr:function(H){var I={};if(H){I.whiteSpace=x;}else if(!qx.bom.client.Feature.CSS_TEXT_OVERFLOW&&qx.bom.client.Feature.XUL){I.display=n;}else{I.overflow=d;I.whiteSpace=b;I.textOverflow=y;if(qx.core.Variant.isSet(g,p)){I.OTextOverflow=y;}}return I;},create:function(content,J,K){if(!K){K=window;}if(J){var L=K.document.createElement(j);L.useHtml=true;}else if(!qx.bom.client.Feature.CSS_TEXT_OVERFLOW&&qx.bom.client.Feature.XUL){var L=K.document.createElement(j);var N=K.document.createElementNS(c,w);var M=N.style;M.cursor=i;M.color=i;M.overflow=d;M.maxWidth=r;M.padding=z;for(var O in this.__jn){N.style[O]=i;}N.setAttribute(u,s);L.appendChild(N);}else{var L=K.document.createElement(j);qx.bom.element.Style.setStyles(L,this.__jr(J));}if(content){this.setValue(L,content);}return L;},setValue:function(P,Q){Q=Q||e;if(P.useHtml){P.innerHTML=Q;}else if(!qx.bom.client.Feature.CSS_TEXT_OVERFLOW&&qx.bom.client.Feature.XUL){P.firstChild.setAttribute(f,Q);}else{qx.bom.element.Attribute.set(P,h,Q);}},getValue:function(R){if(R.useHtml){return R.innerHTML;}else if(!qx.bom.client.Feature.CSS_TEXT_OVERFLOW&&qx.bom.client.Feature.XUL){return R.firstChild.getAttribute(f)||e;}else{return qx.bom.element.Attribute.get(R,h);}},getHtmlSize:function(content,S,T){var U=this._htmlElement||this.__jp();U.style.width=T!==undefined?T+v:a;U.innerHTML=content;return this.__js(U,S);},getTextSize:function(V,W){var X=this._textElement||this.__jo();if(!qx.bom.client.Feature.CSS_TEXT_OVERFLOW&&qx.bom.client.Feature.XUL){X.firstChild.setAttribute(f,V);}else{qx.bom.element.Attribute.set(X,h,V);}return this.__js(X,W);},__js:function(Y,ba){var bb=this.__jn;if(!ba){ba={};}for(var bc in bb){Y.style[bc]=ba[bc]||e;}var bd=qx.bom.element.Dimension.getSize(Y);if(qx.core.Variant.isSet(g,t)){if(!qx.bom.client.Platform.WIN){bd.width++;}}if(qx.core.Variant.isSet(g,m)&&qx.bom.client.Engine.VERSION>=9){bd.width++;}return bd;}}});})();(function(){var i="0px",h="qx.client",g="mshtml",f="qx.bom.element.Dimension",e="paddingRight",d="paddingLeft",c="opera",b="paddingTop",a="paddingBottom";qx.Class.define(f,{statics:{getWidth:qx.core.Variant.select(h,{"gecko":function(j){if(j.getBoundingClientRect){var k=j.getBoundingClientRect();return Math.round(k.right)-Math.round(k.left);}else{return j.offsetWidth;}},"default":function(l){return l.offsetWidth;}}),getHeight:qx.core.Variant.select(h,{"gecko":function(m){if(m.getBoundingClientRect){var n=m.getBoundingClientRect();return Math.round(n.bottom)-Math.round(n.top);}else{return m.offsetHeight;}},"default":function(o){return o.offsetHeight;}}),getSize:function(p){return {width:this.getWidth(p),height:this.getHeight(p)};},__ip:{visible:true,hidden:true},getContentWidth:function(q){var s=qx.bom.element.Style;var t=qx.bom.element.Overflow.getX(q);var u=parseInt(s.get(q,d)||i,10);var x=parseInt(s.get(q,e)||i,10);if(this.__ip[t]){var w=q.clientWidth;if(qx.core.Variant.isSet(h,c)){w=w-u-x;}else{if(qx.dom.Node.isBlockNode(q)){w=w-u-x;}}return w;}else{if(q.clientWidth>=q.scrollWidth){return Math.max(q.clientWidth,q.scrollWidth)-u-x;}else{var v=q.scrollWidth-u;var r=qx.bom.client.Engine;if(r.NAME===g&&r.VERSION==6){v-=x;}return v;}}},getContentHeight:function(y){var A=qx.bom.element.Style;var C=qx.bom.element.Overflow.getY(y);var D=parseInt(A.get(y,b)||i,10);var B=parseInt(A.get(y,a)||i,10);if(this.__ip[C]){return y.clientHeight-D-B;}else{if(y.clientHeight>=y.scrollHeight){return Math.max(y.clientHeight,y.scrollHeight)-D-B;}else{var E=y.scrollHeight-D;var z=qx.bom.client.Engine;if(z.NAME===g&&z.VERSION==6){E-=B;}return E;}}},getContentSize:function(F){return {width:this.getContentWidth(F),height:this.getContentHeight(F)};}}});})();(function(){var e="qx.theme.manager.Font",d="Theme",c="changeTheme",b="_applyTheme",a="singleton";qx.Class.define(e,{type:a,extend:qx.util.ValueManager,properties:{theme:{check:d,nullable:true,apply:b,event:c}},members:{resolveDynamic:function(f){var g=this._dynamic;return f instanceof qx.bom.Font?f:g[f];},resolve:function(h){var k=this._dynamic;var i=k[h];if(i){return i;}var j=this.getTheme();if(j!==null&&j.fonts[h]){return k[h]=(new qx.bom.Font).set(j.fonts[h]);}return h;},isDynamic:function(l){var n=this._dynamic;if(l&&(l instanceof qx.bom.Font||n[l]!==undefined)){return true;}var m=this.getTheme();if(m!==null&&l&&m.fonts[l]){n[l]=(new qx.bom.Font).set(m.fonts[l]);return true;}return false;},__io:function(o,p){if(o[p].include){var q=o[o[p].include];o[p].include=null;delete o[p].include;o[p]=qx.lang.Object.mergeWith(o[p],q,false);this.__io(o,p);}},_applyTheme:function(r){var s=this._getDynamic();for(var v in s){if(s[v].themed){s[v].dispose();delete s[v];}}if(r){var t=r.fonts;var u=qx.bom.Font;for(var v in t){if(t[v].include&&t[t[v].include]){this.__io(t,v);}s[v]=(new u).set(t[v]);s[v].themed=true;}}this._setDynamic(s);}}});})();(function(){var k="",j="underline",h="Boolean",g="px",f='"',e="italic",d="normal",c="bold",b="_applyItalic",a="_applyBold",x="Integer",w="_applyFamily",v="_applyLineHeight",u="Array",t="overline",s="line-through",r="qx.bom.Font",q="Number",p="_applyDecoration",o=" ",m="_applySize",n=",";qx.Class.define(r,{extend:qx.core.Object,construct:function(y,z){qx.core.Object.call(this);if(y!==undefined){this.setSize(y);}if(z!==undefined){this.setFamily(z);}},statics:{fromString:function(A){var E=new qx.bom.Font();var C=A.split(/\s+/);var name=[];var D;for(var i=0;i<C.length;i++){switch(D=C[i]){case c:E.setBold(true);break;case e:E.setItalic(true);break;case j:E.setDecoration(j);break;default:var B=parseInt(D,10);if(B==D||qx.lang.String.contains(D,g)){E.setSize(B);}else{name.push(D);}break;}}if(name.length>0){E.setFamily(name);}return E;},fromConfig:function(F){var G=new qx.bom.Font;G.set(F);return G;},__cy:{fontFamily:k,fontSize:k,fontWeight:k,fontStyle:k,textDecoration:k,lineHeight:1.2},getDefaultStyles:function(){return this.__cy;}},properties:{size:{check:x,nullable:true,apply:m},lineHeight:{check:q,nullable:true,apply:v},family:{check:u,nullable:true,apply:w},bold:{check:h,nullable:true,apply:a},italic:{check:h,nullable:true,apply:b},decoration:{check:[j,s,t],nullable:true,apply:p}},members:{__cz:null,__cA:null,__cB:null,__cC:null,__cD:null,__cE:null,_applySize:function(H,I){this.__cz=H===null?null:H+g;},_applyLineHeight:function(J,K){this.__cE=J===null?null:J;},_applyFamily:function(L,M){var N=k;for(var i=0,l=L.length;i<l;i++){if(L[i].indexOf(o)>0){N+=f+L[i]+f;}else{N+=L[i];}if(i!==l-1){N+=n;}}this.__cA=N;},_applyBold:function(O,P){this.__cB=O===null?null:O?c:d;},_applyItalic:function(Q,R){this.__cC=Q===null?null:Q?e:d;},_applyDecoration:function(S,T){this.__cD=S===null?null:S;},getStyles:function(){return {fontFamily:this.__cA,fontSize:this.__cz,fontWeight:this.__cB,fontStyle:this.__cC,textDecoration:this.__cD,lineHeight:this.__cE};}}});})();(function(){var r="left",q="top",p="_applyLayoutChange",o="hAlign",n="flex",m="vAlign",h="Integer",g="minWidth",f="width",e="minHeight",b="qx.ui.layout.Grid",d="height",c="maxHeight",a="maxWidth";qx.Class.define(b,{extend:qx.ui.layout.Abstract,construct:function(s,t){qx.ui.layout.Abstract.call(this);this.__iF=[];this.__iG=[];if(s){this.setSpacingX(s);}if(t){this.setSpacingY(t);}},properties:{spacingX:{check:h,init:0,apply:p},spacingY:{check:h,init:0,apply:p}},members:{__iH:null,__iF:null,__iG:null,__iI:null,__iJ:null,__iK:null,__iL:null,__iM:null,__iN:null,verifyLayoutProperty:null,__iO:function(){var B=[];var A=[];var C=[];var w=-1;var v=-1;var E=this._getLayoutChildren();for(var i=0,l=E.length;i<l;i++){var z=E[i];var D=z.getLayoutProperties();var F=D.row;var u=D.column;D.colSpan=D.colSpan||1;D.rowSpan=D.rowSpan||1;if(F==null||u==null){throw new Error("The layout properties 'row' and 'column' of the child widget '"+z+"' must be defined!");}if(B[F]&&B[F][u]){throw new Error("Cannot add widget '"+z+"'!. "+"There is already a widget '"+B[F][u]+"' in this cell ("+F+", "+u+")");}for(var x=u;x<u+D.colSpan;x++){for(var y=F;y<F+D.rowSpan;y++){if(B[y]==undefined){B[y]=[];}B[y][x]=z;v=Math.max(v,x);w=Math.max(w,y);}}if(D.rowSpan>1){C.push(z);}if(D.colSpan>1){A.push(z);}}for(var y=0;y<=w;y++){if(B[y]==undefined){B[y]=[];}}this.__iH=B;this.__iI=A;this.__iJ=C;this.__iK=w;this.__iL=v;this.__iM=null;this.__iN=null;delete this._invalidChildrenCache;},_setRowData:function(G,H,I){var J=this.__iF[G];if(!J){this.__iF[G]={};this.__iF[G][H]=I;}else{J[H]=I;}},_setColumnData:function(K,L,M){var N=this.__iG[K];if(!N){this.__iG[K]={};this.__iG[K][L]=M;}else{N[L]=M;}},setSpacing:function(O){this.setSpacingY(O);this.setSpacingX(O);return this;},setColumnAlign:function(P,Q,R){{};this._setColumnData(P,o,Q);this._setColumnData(P,m,R);this._applyLayoutChange();return this;},getColumnAlign:function(S){var T=this.__iG[S]||{};return {vAlign:T.vAlign||q,hAlign:T.hAlign||r};},setRowAlign:function(U,V,W){{};this._setRowData(U,o,V);this._setRowData(U,m,W);this._applyLayoutChange();return this;},getRowAlign:function(X){var Y=this.__iF[X]||{};return {vAlign:Y.vAlign||q,hAlign:Y.hAlign||r};},getCellWidget:function(ba,bb){if(this._invalidChildrenCache){this.__iO();}var ba=this.__iH[ba]||{};return ba[bb]||null;},getRowCount:function(){if(this._invalidChildrenCache){this.__iO();}return this.__iK+1;},getColumnCount:function(){if(this._invalidChildrenCache){this.__iO();}return this.__iL+1;},getCellAlign:function(bc,bd){var bj=q;var bh=r;var bi=this.__iF[bc];var bf=this.__iG[bd];var be=this.__iH[bc][bd];if(be){var bg={vAlign:be.getAlignY(),hAlign:be.getAlignX()};}else{bg={};}if(bg.vAlign){bj=bg.vAlign;}else if(bi&&bi.vAlign){bj=bi.vAlign;}else if(bf&&bf.vAlign){bj=bf.vAlign;}if(bg.hAlign){bh=bg.hAlign;}else if(bf&&bf.hAlign){bh=bf.hAlign;}else if(bi&&bi.hAlign){bh=bi.hAlign;}return {vAlign:bj,hAlign:bh};},setColumnFlex:function(bk,bl){this._setColumnData(bk,n,bl);this._applyLayoutChange();return this;},getColumnFlex:function(bm){var bn=this.__iG[bm]||{};return bn.flex!==undefined?bn.flex:0;},setRowFlex:function(bo,bp){this._setRowData(bo,n,bp);this._applyLayoutChange();return this;},getRowFlex:function(bq){var br=this.__iF[bq]||{};var bs=br.flex!==undefined?br.flex:0;return bs;},setColumnMaxWidth:function(bt,bu){this._setColumnData(bt,a,bu);this._applyLayoutChange();return this;},getColumnMaxWidth:function(bv){var bw=this.__iG[bv]||{};return bw.maxWidth!==undefined?bw.maxWidth:Infinity;},setColumnWidth:function(bx,by){this._setColumnData(bx,f,by);this._applyLayoutChange();return this;},getColumnWidth:function(bz){var bA=this.__iG[bz]||{};return bA.width!==undefined?bA.width:null;},setColumnMinWidth:function(bB,bC){this._setColumnData(bB,g,bC);this._applyLayoutChange();return this;},getColumnMinWidth:function(bD){var bE=this.__iG[bD]||{};return bE.minWidth||0;},setRowMaxHeight:function(bF,bG){this._setRowData(bF,c,bG);this._applyLayoutChange();return this;},getRowMaxHeight:function(bH){var bI=this.__iF[bH]||{};return bI.maxHeight||Infinity;},setRowHeight:function(bJ,bK){this._setRowData(bJ,d,bK);this._applyLayoutChange();return this;},getRowHeight:function(bL){var bM=this.__iF[bL]||{};return bM.height!==undefined?bM.height:null;},setRowMinHeight:function(bN,bO){this._setRowData(bN,e,bO);this._applyLayoutChange();return this;},getRowMinHeight:function(bP){var bQ=this.__iF[bP]||{};return bQ.minHeight||0;},__iP:function(bR){var bV=bR.getSizeHint();var bU=bR.getMarginLeft()+bR.getMarginRight();var bT=bR.getMarginTop()+bR.getMarginBottom();var bS={height:bV.height+bT,width:bV.width+bU,minHeight:bV.minHeight+bT,minWidth:bV.minWidth+bU,maxHeight:bV.maxHeight+bT,maxWidth:bV.maxWidth+bU};return bS;},_fixHeightsRowSpan:function(bW){var ck=this.getSpacingY();for(var i=0,l=this.__iJ.length;i<l;i++){var ca=this.__iJ[i];var cc=this.__iP(ca);var cd=ca.getLayoutProperties();var bY=cd.row;var ci=ck*(cd.rowSpan-1);var bX=ci;var cf={};for(var j=0;j<cd.rowSpan;j++){var cm=cd.row+j;var cb=bW[cm];var cl=this.getRowFlex(cm);if(cl>0){cf[cm]={min:cb.minHeight,value:cb.height,max:cb.maxHeight,flex:cl};}ci+=cb.height;bX+=cb.minHeight;}if(ci<cc.height){if(!qx.lang.Object.isEmpty(cf)){var cj=qx.ui.layout.Util.computeFlexOffsets(cf,cc.height,ci);for(var k=0;k<cd.rowSpan;k++){var ce=cj[bY+k]?cj[bY+k].offset:0;bW[bY+k].height+=ce;}}else{var cg=ck*(cd.rowSpan-1);var ch=cc.height-cg;var cb=Math.floor(ch/cd.rowSpan);for(var k=0;k<cd.rowSpan;k++){bW[bY+k].height=cb;}}}if(bX<cc.minHeight){var cj=qx.ui.layout.Util.computeFlexOffsets(cf,cc.minHeight,bX);for(var j=0;j<cd.rowSpan;j++){var ce=cj[bY+j]?cj[bY+j].offset:0;bW[bY+j].minHeight+=ce;}}}},_fixWidthsColSpan:function(cn){var cr=this.getSpacingX();for(var i=0,l=this.__iI.length;i<l;i++){var co=this.__iI[i];var cq=this.__iP(co);var ct=co.getLayoutProperties();var cp=ct.column;var cz=cr*(ct.colSpan-1);var cs=cz;var cu={};var cw;for(var j=0;j<ct.colSpan;j++){var cA=ct.column+j;var cy=cn[cA];var cx=this.getColumnFlex(cA);if(cx>0){cu[cA]={min:cy.minWidth,value:cy.width,max:cy.maxWidth,flex:cx};}cz+=cy.width;cs+=cy.minWidth;}if(cz<cq.width){var cv=qx.ui.layout.Util.computeFlexOffsets(cu,cq.width,cz);for(var j=0;j<ct.colSpan;j++){cw=cv[cp+j]?cv[cp+j].offset:0;cn[cp+j].width+=cw;}}if(cs<cq.minWidth){var cv=qx.ui.layout.Util.computeFlexOffsets(cu,cq.minWidth,cs);for(var j=0;j<ct.colSpan;j++){cw=cv[cp+j]?cv[cp+j].offset:0;cn[cp+j].minWidth+=cw;}}}},_getRowHeights:function(){if(this.__iM!=null){return this.__iM;}var cK=[];var cD=this.__iK;var cC=this.__iL;for(var cL=0;cL<=cD;cL++){var cE=0;var cG=0;var cF=0;for(var cJ=0;cJ<=cC;cJ++){var cB=this.__iH[cL][cJ];if(!cB){continue;}var cH=cB.getLayoutProperties().rowSpan||0;if(cH>1){continue;}var cI=this.__iP(cB);if(this.getRowFlex(cL)>0){cE=Math.max(cE,cI.minHeight);}else{cE=Math.max(cE,cI.height);}cG=Math.max(cG,cI.height);}var cE=Math.max(cE,this.getRowMinHeight(cL));var cF=this.getRowMaxHeight(cL);if(this.getRowHeight(cL)!==null){var cG=this.getRowHeight(cL);}else{var cG=Math.max(cE,Math.min(cG,cF));}cK[cL]={minHeight:cE,height:cG,maxHeight:cF};}if(this.__iJ.length>0){this._fixHeightsRowSpan(cK);}this.__iM=cK;return cK;},_getColWidths:function(){if(this.__iN!=null){return this.__iN;}var cQ=[];var cN=this.__iL;var cP=this.__iK;for(var cV=0;cV<=cN;cV++){var cT=0;var cS=0;var cO=Infinity;for(var cW=0;cW<=cP;cW++){var cM=this.__iH[cW][cV];if(!cM){continue;}var cR=cM.getLayoutProperties().colSpan||0;if(cR>1){continue;}var cU=this.__iP(cM);if(this.getColumnFlex(cV)>0){cS=Math.max(cS,cU.minWidth);}else{cS=Math.max(cS,cU.width);}cT=Math.max(cT,cU.width);}var cS=Math.max(cS,this.getColumnMinWidth(cV));var cO=this.getColumnMaxWidth(cV);if(this.getColumnWidth(cV)!==null){var cT=this.getColumnWidth(cV);}else{var cT=Math.max(cS,Math.min(cT,cO));}cQ[cV]={minWidth:cS,width:cT,maxWidth:cO};}if(this.__iI.length>0){this._fixWidthsColSpan(cQ);}this.__iN=cQ;return cQ;},_getColumnFlexOffsets:function(cX){var cY=this.getSizeHint();var dd=cX-cY.width;if(dd==0){return {};}var db=this._getColWidths();var da={};for(var i=0,l=db.length;i<l;i++){var de=db[i];var dc=this.getColumnFlex(i);if((dc<=0)||(de.width==de.maxWidth&&dd>0)||(de.width==de.minWidth&&dd<0)){continue;}da[i]={min:de.minWidth,value:de.width,max:de.maxWidth,flex:dc};}return qx.ui.layout.Util.computeFlexOffsets(da,cX,cY.width);},_getRowFlexOffsets:function(df){var dg=this.getSizeHint();var dj=df-dg.height;if(dj==0){return {};}var dk=this._getRowHeights();var dh={};for(var i=0,l=dk.length;i<l;i++){var dl=dk[i];var di=this.getRowFlex(i);if((di<=0)||(dl.height==dl.maxHeight&&dj>0)||(dl.height==dl.minHeight&&dj<0)){continue;}dh[i]={min:dl.minHeight,value:dl.height,max:dl.maxHeight,flex:di};}return qx.ui.layout.Util.computeFlexOffsets(dh,df,dg.height);},renderLayout:function(dm,dn){if(this._invalidChildrenCache){this.__iO();}var dC=qx.ui.layout.Util;var dq=this.getSpacingX();var dw=this.getSpacingY();var dH=this._getColWidths();var dG=this._getColumnFlexOffsets(dm);var dr=[];var dJ=this.__iL;var dp=this.__iK;var dI;for(var dK=0;dK<=dJ;dK++){dI=dG[dK]?dG[dK].offset:0;dr[dK]=dH[dK].width+dI;}var dz=this._getRowHeights();var dB=this._getRowFlexOffsets(dn);var dQ=[];for(var dx=0;dx<=dp;dx++){dI=dB[dx]?dB[dx].offset:0;dQ[dx]=dz[dx].height+dI;}var dR=0;for(var dK=0;dK<=dJ;dK++){var top=0;for(var dx=0;dx<=dp;dx++){var dE=this.__iH[dx][dK];if(!dE){top+=dQ[dx]+dw;continue;}var ds=dE.getLayoutProperties();if(ds.row!==dx||ds.column!==dK){top+=dQ[dx]+dw;continue;}var dP=dq*(ds.colSpan-1);for(var i=0;i<ds.colSpan;i++){dP+=dr[dK+i];}var dF=dw*(ds.rowSpan-1);for(var i=0;i<ds.rowSpan;i++){dF+=dQ[dx+i];}var dt=dE.getSizeHint();var dN=dE.getMarginTop();var dD=dE.getMarginLeft();var dA=dE.getMarginBottom();var dv=dE.getMarginRight();var dy=Math.max(dt.minWidth,Math.min(dP-dD-dv,dt.maxWidth));var dO=Math.max(dt.minHeight,Math.min(dF-dN-dA,dt.maxHeight));var dL=this.getCellAlign(dx,dK);var dM=dR+dC.computeHorizontalAlignOffset(dL.hAlign,dy,dP,dD,dv);var du=top+dC.computeVerticalAlignOffset(dL.vAlign,dO,dF,dN,dA);dE.renderLayout(dM,du,dy,dO);top+=dQ[dx]+dw;}dR+=dr[dK]+dq;}},invalidateLayoutCache:function(){qx.ui.layout.Abstract.prototype.invalidateLayoutCache.call(this);this.__iN=null;this.__iM=null;},_computeSizeHint:function(){if(this._invalidChildrenCache){this.__iO();}var dW=this._getColWidths();var dY=0,ea=0;for(var i=0,l=dW.length;i<l;i++){var eb=dW[i];if(this.getColumnFlex(i)>0){dY+=eb.minWidth;}else{dY+=eb.width;}ea+=eb.width;}var ec=this._getRowHeights();var dU=0,dX=0;for(var i=0,l=ec.length;i<l;i++){var ed=ec[i];if(this.getRowFlex(i)>0){dU+=ed.minHeight;}else{dU+=ed.height;}dX+=ed.height;}var dT=this.getSpacingX()*(dW.length-1);var dS=this.getSpacingY()*(ec.length-1);var dV={minWidth:dY+dT,width:ea+dT,minHeight:dU+dS,height:dX+dS};return dV;}},destruct:function(){this.__iH=this.__iF=this.__iG=this.__iI=this.__iJ=this.__iN=this.__iM=null;}});})();(function(){var b="number",a="qx.ui.layout.Canvas";qx.Class.define(a,{extend:qx.ui.layout.Abstract,members:{verifyLayoutProperty:null,renderLayout:function(c,d){var q=this._getLayoutChildren();var g,p,n;var s,top,e,f,j,h;var o,m,r,k;for(var i=0,l=q.length;i<l;i++){g=q[i];p=g.getSizeHint();n=g.getLayoutProperties();o=g.getMarginTop();m=g.getMarginRight();r=g.getMarginBottom();k=g.getMarginLeft();s=n.left!=null?n.left:n.edge;if(qx.lang.Type.isString(s)){s=Math.round(parseFloat(s)*c/100);}e=n.right!=null?n.right:n.edge;if(qx.lang.Type.isString(e)){e=Math.round(parseFloat(e)*c/100);}top=n.top!=null?n.top:n.edge;if(qx.lang.Type.isString(top)){top=Math.round(parseFloat(top)*d/100);}f=n.bottom!=null?n.bottom:n.edge;if(qx.lang.Type.isString(f)){f=Math.round(parseFloat(f)*d/100);}if(s!=null&&e!=null){j=c-s-e-k-m;if(j<p.minWidth){j=p.minWidth;}else if(j>p.maxWidth){j=p.maxWidth;}s+=k;}else{j=n.width;if(j==null){j=p.width;}else{j=Math.round(parseFloat(j)*c/100);if(j<p.minWidth){j=p.minWidth;}else if(j>p.maxWidth){j=p.maxWidth;}}if(e!=null){s=c-j-e-m-k;}else if(s==null){s=k;}else{s+=k;}}if(top!=null&&f!=null){h=d-top-f-o-r;if(h<p.minHeight){h=p.minHeight;}else if(h>p.maxHeight){h=p.maxHeight;}top+=o;}else{h=n.height;if(h==null){h=p.height;}else{h=Math.round(parseFloat(h)*d/100);if(h<p.minHeight){h=p.minHeight;}else if(h>p.maxHeight){h=p.maxHeight;}}if(f!=null){top=d-h-f-r-o;}else if(top==null){top=o;}else{top+=o;}}g.renderLayout(s,top,j,h);}},_computeSizeHint:function(){var I=0,H=0;var F=0,D=0;var B,A;var z,x;var t=this._getLayoutChildren();var w,G,v;var J,top,u,y;for(var i=0,l=t.length;i<l;i++){w=t[i];G=w.getLayoutProperties();v=w.getSizeHint();var E=w.getMarginLeft()+w.getMarginRight();var C=w.getMarginTop()+w.getMarginBottom();B=v.width+E;A=v.minWidth+E;J=G.left!=null?G.left:G.edge;if(J&&typeof J===b){B+=J;A+=J;}u=G.right!=null?G.right:G.edge;if(u&&typeof u===b){B+=u;A+=u;}I=Math.max(I,B);H=Math.max(H,A);z=v.height+C;x=v.minHeight+C;top=G.top!=null?G.top:G.edge;if(top&&typeof top===b){z+=top;x+=top;}y=G.bottom!=null?G.bottom:G.edge;if(y&&typeof y===b){z+=y;x+=y;}F=Math.max(F,z);D=Math.max(D,x);}return {width:I,minWidth:H,height:F,minHeight:D};}}});})();(function(){var k="_",j="_PROT",h="_PUB",g="mixin",f="_PRIV",e="_ABSTRACT",d="_STATIC",c="_INHERITED",b="OVERLAY_",a="_THEMEABLE",F="ICON_CHILDCONTROL",E="_ERROR",D="_OVERRIDDEN",C="ICON_PACKAGE",B="interface",A="ICON_CTOR",z="PROT",y="ICON_CLASS",x="ICON_INTERFACE",w="apiviewer.TreeUtil",r="_MIXIN",s="PUB",p="ICON_EVENT",q="ICON_PROPERTY",n="_WARN",o="ICON_METHOD",l="ICON_MIXIN",m="ICON_APPEARANCE",t="PRIV",u="ICON_CONSTANT",v="_SINGLETON";qx.Class.define(w,{extend:qx.core.Object,construct:function(){qx.core.Object.call(this);},statics:{getChild:function(G,H){if(G!=null&&G.children!=null){for(var i=0;i<G.children.length;i++){if(G.children[i].type==H){return G.children[i];}}}return null;},getChildByAttribute:function(I,J,K){if(I.children!=null){for(var i=0;i<I.children.length;i++){var L=I.children[i];if(L.attributes&&L.attributes[J]==K){return L;}}}return null;},getIconUrl:function(M,N){var O;var P=apiviewer.dao;if(M instanceof P.Package){O=C;}else if(M instanceof P.Class){switch(M.getType()){case g:O=l;break;case B:O=x;break;default:O=y;if(M.isStatic()){O+=d;}else if(M.isAbstract()){O+=e;}else if(M.isSingleton()){O+=v;}}}else if(M instanceof P.Property){O=q;if(M.isPublic()){O+=h;}else if(M.isProtected()){O+=j;}else if(M.isPrivate()||M.isInternal()){O+=f;}if(M.isThemeable()){O+=a;}}else if(M instanceof P.Event){O=p;}else if(M instanceof P.Method){if(M.isConstructor()){var O=A;}else{O=o;if(M.isPublic()){O+=h;}else if(M.isProtected()){O+=j;}else if(M.isPrivate()||M.isInternal()){O+=f;}}if(M.isStatic()){O+=d;}else if(M.isAbstract()){O+=e;}if(M.getClass().getType()==g){O+=r;}}else if(M instanceof P.Constant){O=u;}else if(M instanceof P.Appearance){O=m;}else if(M instanceof P.ChildControl){O=F;}else{throw new Error("Unknown node type: "+M.type);}if(M instanceof P.ClassItem){if(N){O+=c;}else if(M.getOverriddenFrom&&M.getOverriddenFrom()){O+=D;}if(M.getErrors().length>0){O+=E;}}if(M.hasWarning()){O+=n;}return apiviewer.TreeUtil.iconNameToIconPath(O);},iconNameToIconPath:function(Q){var T=apiviewer.TreeUtil[Q];if(!T){var S=Q.split(k);var V=S[0]+k+S[1];if(S[2]==s||S[2]==z||S[2]==t){V+=k+S[2];var U=3;}else{U=2;}T=[apiviewer.TreeUtil[V]];if(T[0]==null){throw new Error("Unknown img constant: "+V);}for(var i=U;i<S.length;i++){var R=apiviewer.TreeUtil[b+S[i]];if(R==null){throw new Error("Unknown img constant: OVERLAY_"+S[i]);}T.push(R);}}return T;},ICON_BLANK:"apiviewer/image/blank.gif",OVERLAY_ABSTRACT:"apiviewer/image/overlay_abstract18.gif",OVERLAY_ERROR:"apiviewer/image/overlay_error18.gif",OVERLAY_INHERITED:"apiviewer/image/overlay_inherited18.gif",OVERLAY_OVERRIDDEN:"apiviewer/image/overlay_overridden18.gif",OVERLAY_THEMEABLE:"apiviewer/image/overlay_themeable18.gif",OVERLAY_STATIC:"apiviewer/image/overlay_static18.gif",OVERLAY_WARN:"apiviewer/image/overlay_warning18.gif",OVERLAY_MIXIN:"apiviewer/image/overlay_mixin18.gif",ICON_PACKAGE:"apiviewer/image/package18.gif",ICON_PACKAGE_WARN:"apiviewer/image/package_warning18.gif",ICON_CLASS:"apiviewer/image/class18.gif",ICON_CLASS_WARN:"apiviewer/image/class_warning18.gif",ICON_CLASS_ERROR:"apiviewer/image/class_warning18.gif",ICON_CLASS_STATIC:"apiviewer/image/class_static18.gif",ICON_CLASS_STATIC_WARN:"apiviewer/image/class_static_warning18.gif",ICON_CLASS_STATIC_ERROR:"apiviewer/image/class_static_warning18.gif",ICON_CLASS_ABSTRACT:"apiviewer/image/class_abstract18.gif",ICON_CLASS_ABSTRACT_WARN:"apiviewer/image/class_abstract_warning18.gif",ICON_CLASS_ABSTRACT_ERROR:"apiviewer/image/class_abstract_warning18.gif",ICON_CLASS_SINGLETON:"apiviewer/image/class_singleton18.gif",ICON_CLASS_SINGLETON_WARN:"apiviewer/image/class_singleton_warning18.gif",ICON_CLASS_SINGLETON_ERROR:"apiviewer/image/class_singleton_warning18.gif",ICON_PROPERTY_PUB:"apiviewer/image/property18.gif",ICON_PROPERTY_PROT:"apiviewer/image/property_protected18.gif",ICON_PROPERTY_PRIV:"apiviewer/image/property_private18.gif",ICON_PROPERTY_PUB_THEMEABLE:"apiviewer/image/property_themeable18.gif",ICON_EVENT:"apiviewer/image/event18.gif",ICON_INTERFACE:"apiviewer/image/interface18.gif",ICON_INTERFACE_WARN:"apiviewer/image/interface_warning18.gif",ICON_MIXIN:"apiviewer/image/mixin18.gif",ICON_MIXIN_WARN:"apiviewer/image/mixin_warning18.gif",ICON_METHOD_PUB:"apiviewer/image/method_public18.gif",ICON_METHOD_PUB_INHERITED:"apiviewer/image/method_public_inherited18.gif",ICON_CTOR:"apiviewer/image/constructor18.gif",ICON_METHOD_PROT:"apiviewer/image/method_protected18.gif",ICON_METHOD_PRIV:"apiviewer/image/method_private18.gif",ICON_CONSTANT:"apiviewer/image/constant18.gif",ICON_APPEARANCE:"apiviewer/image/constant18.gif",ICON_CHILDCONTROL:"apiviewer/image/childcontrol18.gif"},defer:function(W,X,Y){W.PRELOAD_IMAGES=[W.ICON_INFO,W.ICON_SEARCH,W.OVERLAY_ABSTRACT,W.OVERLAY_ERROR,W.OVERLAY_INHERITED,W.OVERLAY_OVERRIDDEN,W.OVERLAY_STATIC,W.OVERLAY_WARN,W.OVERLAY_MIXIN,W.OVERLAY_THEMEABLE,W.ICON_PACKAGE,W.ICON_PACKAGE_WARN,W.ICON_CLASS,W.ICON_CLASS_WARN,W.ICON_CLASS_ERROR,W.ICON_CLASS_STATIC,W.ICON_CLASS_STATIC_WARN,W.ICON_CLASS_STATIC_ERROR,W.ICON_CLASS_ABSTRACT,W.ICON_CLASS_ABSTRACT_WARN,W.ICON_CLASS_ABSTRACT_ERROR,W.ICON_CLASS_SINGLETON,W.ICON_CLASS_SINGLETON_WARN,W.ICON_CLASS_SINGLETON_ERROR,W.ICON_PROPERTY_PUB,W.ICON_PROPERTY_PROT,W.ICON_PROPERTY_PRIV,W.ICON_PROPERTY_PUB_THEMEABLE,W.ICON_EVENT,W.ICON_INTERFACE,W.ICON_INTERFACE_WARN,W.ICON_MIXIN,W.ICON_MIXIN_WARN,W.ICON_METHOD_PUB,W.ICON_METHOD_PUB_INHERITED,W.ICON_CTOR,W.ICON_METHOD_PROT,W.ICON_METHOD_PRIV,W.ICON_CONSTANT,W.ICON_CHILDCONTROL];}});})();(function(){var g="Boolean",f="changeShowInherited",e="changeShowProtected",d="changeExpandProperties",c="apiviewer.UiModel",b="changeShowPrivate",a="singleton";qx.Class.define(c,{extend:qx.core.Object,type:a,properties:{showInherited:{check:g,init:false,event:f},expandProperties:{check:g,init:false,event:d},showProtected:{check:g,init:false,event:e},showPrivate:{check:g,init:false,event:b}}});})();(function(){var i="auto",h="overflowX",g="visible",f="hidden",e="scroll",d="overflowY",c="_applyOverflowX",b="_applyOverflowY",a="qx.ui.core.MNativeOverflow";qx.Mixin.define(a,{properties:{overflowX:{check:[f,g,e,i],nullable:true,apply:c},overflowY:{check:[f,g,e,i],nullable:true,apply:b},overflow:{group:[h,d]}},members:{_applyOverflowX:function(j){this.getContentElement().setStyle(h,j);},_applyOverflowY:function(k){this.getContentElement().setStyle(d,k);}}});})();(function(){var o="none",n="text",m="",l="userSelect",k="color",j="String",i="0px",h="webkit",g="changeHtml",f="_applyCssClass",c="class",e="qx.ui.embed.Html",d="_applyHtml",b="qx.client",a="html";qx.Class.define(e,{extend:qx.ui.core.Widget,include:[qx.ui.core.MNativeOverflow],construct:function(p){qx.ui.core.Widget.call(this);if(p!=null){this.setHtml(p);}},properties:{html:{check:j,apply:d,event:g,nullable:true},cssClass:{check:j,init:m,apply:f},selectable:{refine:true,init:true},focusable:{refine:true,init:true}},members:{getFocusElement:function(){return this.getContentElement();},_applyHtml:function(q,r){var s=this.getContentElement();s.setAttribute(a,q||m);s.setStyles({"padding":i,"border":o});},_applyCssClass:function(t,u){this.getContentElement().setAttribute(c,t);},_applySelectable:function(v){qx.ui.core.Widget.prototype._applySelectable.call(this,v);if(qx.core.Variant.isSet(b,h)){this.getContainerElement().setStyle(l,v?n:o);this.getContentElement().setStyle(l,v?n:o);}},_applyFont:function(w,x){var y=w?qx.theme.manager.Font.getInstance().resolve(w).getStyles():qx.bom.Font.getDefaultStyles();this.getContentElement().setStyles(y);},_applyTextColor:function(z,A){if(z){this.getContentElement().setStyle(k,qx.theme.manager.Color.getInstance().resolve(z));}else{this.getContentElement().removeStyle(k);}}}});})();(function(){var l="Boolean",k="_updatePanels",j="auto",h='</div>',g='<div>',f='apiviewer/image/close.gif',e="javascript",d='<div style="padding:24px;">',c="_blank",b="apiviewer.dao.Node",y="string",x="http://",w="pre",v="_infoPanels",u='apiviewer/image/open.gif',t="appear",s="img",r="_applyDocNode",q="detailviewer",p='<h1></h1>',n="abstract",o="apiviewer.ui.AbstractViewer",m="a";qx.Class.define(o,{type:n,extend:qx.ui.embed.Html,construct:function(){qx.ui.embed.Html.call(this);this._infoPanelHash={};this._infoPanels=[];this.setOverflowX(j);this.setOverflowY(j);this.setAppearance(q);this._infoPanelHash={};this._infoPanels=[];apiviewer.ObjectRegistry.register(this);},properties:{docNode:{check:b,init:null,nullable:true,apply:r},showInherited:{check:l,init:false,apply:k},expandProperties:{check:l,init:false,apply:k},showProtected:{check:l,init:false,apply:k},showPrivate:{check:l,init:false,apply:k}},statics:{fixLinks:function(z){var a=z.getElementsByTagName(m);for(var i=0;i<a.length;i++){if(typeof a[i].href==y&&a[i].href.indexOf(x)==0){a[i].target=c;}}},highlightCode:function(A){var B=A.getElementsByTagName(w);for(var i=0;i<B.length;i++){var C=B[i];if(C.className!==e){continue;}C.innerHTML=qx.dev.Tokenizer.javaScriptToHtml(C.innerHTML);}}},members:{_infoPanelHash:null,_infoPanels:null,__Sq:null,_init:function(D){this.__Sr();this.setDocNode(D);this.addListenerOnce(t,function(){this._syncHtml();this._applyDocNode(this.__Sq);},this);},__Sr:function(){var F=new qx.util.StringBuilder();F.add(d);F.add(p);F.add(g,h);var E=this.getPanels();for(var i=0;i<E.length;i++){var G=E[i];F.add(G.getPanelHtml(this));}F.add(h);this.setHtml(F.get());},_getTitleHtml:function(H){throw new Error("Abstract method called!");},_getDescriptionHtml:function(I){throw new Error("Abstract method called!");},_syncHtml:function(){var M=this.getContentElement().getDomElement().firstChild;var J=M.childNodes;var K=this.getPanels();apiviewer.ui.AbstractViewer.fixLinks(M);this._titleElem=J[0];this._classDescElem=J[1];for(var i=0;i<K.length;i++){var L=K[i];L.setElement(J[i+2]);}},addInfoPanel:function(N){this._infoPanelHash[N.toHashCode()]=N;this._infoPanels.push(N);},getPanels:function(){return this._infoPanels;},getPanelFromHashCode:function(O){return this._infoPanelHash[O];},_updatePanels:function(){var P=this.getPanels();for(var i=0;i<P.length;i++){var Q=P[i];Q.update(this,this.__Sq);}},_applyDocNode:function(R){this.__Sq=R;if(!this._titleElem){return ;}this._titleElem.innerHTML=this._getTitleHtml(R);this._classDescElem.innerHTML=this._getDescriptionHtml(R);apiviewer.ui.AbstractViewer.fixLinks(this._classDescElem);apiviewer.ui.AbstractViewer.highlightCode(this._classDescElem);this._updatePanels();},togglePanelVisibility:function(S){try{S.setIsOpen(!S.getIsOpen());var T=S.getTitleElement().getElementsByTagName(s)[0];T.src=qx.util.ResourceManager.getInstance().toUri(S.getIsOpen()?f:u);S.update(this,this.getDocNode());}catch(U){this.error("Toggling info body failed",U);}}},destruct:function(){this._classDescElem=this._titleElem=this._infoPanelHash=this.__Sq=null;this._disposeArray(v,1);}});})();(function(){var n="classes",m="functions",l="",k="packages",j="class",i="interfaces",h='<div class="class-description">',g='<small>package</small>',f='</div>',e="ClassViewer",b="mixins",d="interface",c="apiviewer.ui.PackageViewer",a="mixin";qx.Class.define(c,{extend:apiviewer.ui.AbstractViewer,construct:function(){apiviewer.ui.AbstractViewer.call(this);this.addInfoPanel(new apiviewer.ui.panels.MethodPanel(m,m));this.addInfoPanel(new apiviewer.ui.panels.ClassPanel(n,n,j));this.addInfoPanel(new apiviewer.ui.panels.ClassPanel(n,i,d));this.addInfoPanel(new apiviewer.ui.panels.ClassPanel(n,b,a));this.addInfoPanel(new apiviewer.ui.panels.PackagePanel(k,k));this.getContentElement().setAttribute(j,e);this._init(new apiviewer.dao.Package({}));},members:{_getTitleHtml:function(o){var p=l;p+=g;p+=o.getFullName();return p;},_getDescriptionHtml:function(q){var r=new qx.util.StringBuilder();var s=q.getDescription();if(s!=l){r.add(h,apiviewer.ui.panels.InfoPanel.resolveLinkAttributes(s,q),f);}return r.get();}}});})();(function(){var a="apiviewer.ObjectRegistry";qx.Class.define(a,{statics:{__Ss:{},register:function(b){var c=qx.core.ObjectRegistry.toHashCode(b);this.__Ss[c]=b;},getObjectFromHashCode:function(d){return this.__Ss[d];}}});})();(function(){var l="</span>",k="sym",j="nl",h="qxkey",g="ws",f=">",e="qqstr",d="<",c="qstr",b="linecomment",bg="ident",bf="keyword",be="regexp",bd="&",bc="|",bb="fullcomment",ba="atom",Y="\\r\\n|\\r|\\n",X="\\s*\\)*",W="\\s",s="^",t='["][^"]*["]',q="real",r="\\s*[,\\)]",o="<span class='string'>",p="[a-zA-Z_][a-zA-Z0-9_]*\\b",m="<span class='comment'>",n="[+-]?\\d+",w="\\s*\\(*\\s*",x="&nbsp;",F="qx.dev.Tokenizer",D="\\t",M="\\s*\\)*\\s*\\)",H="\\.(?:replace)\\s*\\(\\s*\\(*\\s*",S="\\)*\\.(?:test|exec)\\s*\\(\\s*",Q="<span class='regexp'>",z="int",V="'>",U="<span class='",T="(?:\\/(?!\\*)[^\\t\\n\\r\\f\\v\\/]+?\\/[mgi]*)",y=".",B="\\s*\\)*\\s*?,?",C="[\\(,]\\s*",E="<span class='ident'>",G="g",I="[+-]?\\d+(([.]\\d+)*([eE][+-]?\\d+))?",N="\\/\\*(?:.|[\\n\\r])*?\\*\\/",R="\n",u="$",v="['][^']*[']",A="tab",L="\\/\\/.*?[\\n\\r$]",K="<br>",J=" ",P="(?::|=|\\?)\\s*\\(*\\s*",O="\\.(?:match|search|split)\\s*\\(\\s*\\(*\\s*";qx.Class.define(F,{extend:qx.core.Object,statics:{tokenizeJavaScript:function(bh){var bL={"break":1,"case":1,"catch":1,"continue":1,"default":1,"delete":1,"do":1,"else":1,"finally":1,"for":1,"function":1,"if":1,"in":1,"instanceof":1,"new":1,"return":1,"switch":1,"throw":1,"try":1,"typeof":1,"var":1,"while":1,"with":1};var bB={"void":1,"null":1,"true":1,"false":1,"NaN":1,"Infinity":1,"this":1};var bx={"statics":1,"members":1,"construct":1,"destruct":1,"events":1,"properties":1,"extend":1,"implement":1};var bt=function(bM){return new RegExp(s+bM+u);};var bE=L;var bu=N;var bo=p;var bw=n;var br=I;var bz=t;var by=v;var bm=D;var bH=Y;var bJ=W;var bs=T;var bv=[O+bs+M,H+bs+B,w+bs+S,P+bs+X,C+bs+r].join(bc);var bF=bt(bE);var bp=bt(bu);var bC=bt(bo);var bl=bt(bw);var bI=bt(br);var bk=bt(bz);var bj=bt(by);var bD=bt(bm);var bq=bt(bH);var bi=bt(bJ);var bn=bt(bv);var bA=new RegExp([bE,bu,bo,bw,br,bz,by,by,bm,bH,bJ,bv,y].join(bc),G);var bG=[];var a=bh.match(bA);for(var i=0;i<a.length;i++){var bK=a[i];if(bK.match(bF)){bG.push({type:b,value:bK});}else if(bK.match(bp)){bG.push({type:bb,value:bK});}else if(bK.match(bn)){bG.push({type:be,value:bK});}else if(bK.match(bj)){bG.push({type:c,value:bK});}else if(bK.match(bk)){bG.push({type:e,value:bK});}else if(bL[bK]){bG.push({type:bf,value:bK});}else if(bB[bK]){bG.push({type:ba,value:bK});}else if(bx[bK]){bG.push({type:h,value:bK});}else if(bK.match(bC)){bG.push({type:bg,value:bK});}else if(bK.match(bI)){bG.push({type:q,value:bK});}else if(bK.match(bl)){bG.push({type:z,value:bK});}else if(bK.match(bq)){bG.push({type:j,value:bK});}else if(bK.match(bt(bi))){bG.push({type:g,value:bK});}else if(bK.match(bD)){bG.push({type:A,value:bK});}else if(bK==f){bG.push({type:k,value:f});}else if(bK==d){bG.push({type:k,value:d});}else if(bK==bd){bG.push({type:k,value:bd});}else{bG.push({type:k,value:bK});}}return bG;},javaScriptToHtml:function(bN){var bR=qx.dev.Tokenizer.tokenizeJavaScript(bN);var bQ=new qx.util.StringBuilder();for(var i=0;i<bR.length;i++){var bS=bR[i];var bP=qx.bom.String.escape(bS.value);switch(bS.type){case be:bQ.add(Q,bP,l);break;case bg:bQ.add(E,bP,l);break;case b:case bb:bQ.add(m,bP,l);break;case c:case e:bQ.add(o,bP,l);break;case bf:case ba:case h:bQ.add(U,bS.type,V,bP,l);break;case j:var bO=qx.bom.client.Engine.MSHTML?K:R;bQ.add(bO);break;case g:var bT=qx.bom.client.Engine.MSHTML?x:J;bQ.add(bT);break;default:bQ.add(bP);}}return bQ.get();}}});})();(function(){var f="mshtml",e="pop.push.reverse.shift.sort.splice.unshift.join.slice",d="number",c="qx.type.BaseArray",b="qx.client",a=".";qx.Class.define(c,{extend:Array,construct:function(g){},members:{toArray:null,valueOf:null,pop:null,push:null,reverse:null,shift:null,sort:null,splice:null,unshift:null,concat:null,join:null,slice:null,toString:null,indexOf:null,lastIndexOf:null,forEach:null,filter:null,map:null,some:null,every:null}});(function(){function k(l){if(qx.core.Variant.isSet(b,f)){j.prototype={length:0,$$isArray:true};var o=e.split(a);for(var length=o.length;length;){j.prototype[o[--length]]=Array.prototype[o[length]];}}var p=Array.prototype.slice;j.prototype.concat=function(){var r=this.slice(0);for(var i=0,length=arguments.length;i<length;i++){var q;if(arguments[i] instanceof j){q=p.call(arguments[i],0);}else if(arguments[i] instanceof Array){q=arguments[i];}else{q=[arguments[i]];}r.push.apply(r,q);}return r;};j.prototype.toString=function(){return p.call(this,0).toString();};j.prototype.toLocaleString=function(){return p.call(this,0).toLocaleString();};j.prototype.constructor=j;j.prototype.indexOf=qx.lang.Core.arrayIndexOf;j.prototype.lastIndexOf=qx.lang.Core.arrayLastIndexOf;j.prototype.forEach=qx.lang.Core.arrayForEach;j.prototype.some=qx.lang.Core.arraySome;j.prototype.every=qx.lang.Core.arrayEvery;var m=qx.lang.Core.arrayFilter;var n=qx.lang.Core.arrayMap;j.prototype.filter=function(){var s=new this.constructor;s.push.apply(s,m.apply(this,arguments));return s;};j.prototype.map=function(){var t=new this.constructor;t.push.apply(t,n.apply(this,arguments));return t;};j.prototype.slice=function(){var u=new this.constructor;u.push.apply(u,Array.prototype.slice.apply(this,arguments));return u;};j.prototype.splice=function(){var v=new this.constructor;v.push.apply(v,Array.prototype.splice.apply(this,arguments));return v;};j.prototype.toArray=function(){return Array.prototype.slice.call(this,0);};j.prototype.valueOf=function(){return this.length;};return j;}function j(length){if(arguments.length===1&&typeof length===d){this.length=-1<length&&length===length>>.5?length:this.push(length);}else if(arguments.length){this.push.apply(this,arguments);}}function h(){}h.prototype=[];j.prototype=new h;j.prototype.length=0;qx.type.BaseArray=k(j);})();})();(function(){var b="",a="qx.util.StringBuilder";qx.Class.define(a,{extend:qx.type.BaseArray,members:{clear:function(){this.length=0;},get:function(){return this.join(b);},add:null,isEmpty:function(){return this.length===0;},size:function(){return this.join(b).length;}},defer:function(c,d){d.add=d.push;d.toString=d.get;d.valueOf=d.get;}});})();(function(){var p="",o="!",n="'!",m="'",k="Expected '",j="' (rgb(",h=",",g=")), but found value '",f="Event (",d="Expected value to be the CSS color '",bw="' but found ",bv="The value '",bu=" != ",bt="qx.core.Object",bs="Expected value to be an array but found ",br=") was fired.",bq="Expected value to be an integer >= 0 but found ",bp="' to be not equal with '",bo="' to '",bn="qx.ui.core.Widget",w="Called assertTrue with '",x="Expected value to be a map but found ",u="The function did not raise an exception!",v="Expected value to be undefined but found ",s="Expected value to be a DOM element but found '",t="Expected value to be a regular expression but found ",q="' to implement the interface '",r="Expected value to be null but found ",E="Invalid argument 'type'",F="Called assert with 'false'",R="Assertion error! ",N="Expected value to be a string but found ",ba="null",U="' but found '",bj="' must must be a key of the map '",bf="The String '",J="Expected value not to be undefined but found ",bm="qx.util.ColorUtil",bl=": ",bk="The raised exception does not have the expected type! ",I=") not fired.",L="qx.core.Assert",M="Expected value to be typeof object but found ",P="' (identical) but found '",S="' must have any of the values defined in the array '",V="Expected value to be a number but found ",bc="Called assertFalse with '",bh="]",y="Expected value to be a qooxdoo object but found ",z="' arguments.",K="Expected value not to be null but found ",Y="Array[",X="' does not match the regular expression '",W="' to be not identical with '",be="' arguments but found '",bd="', which cannot be converted to a CSS color!",T="Expected object '",bb="qx.core.AssertionError",a="Expected value to be a boolean but found ",bg="))!",A="Expected value to be a qooxdoo widget but found ",B="Expected value '%1' to be in the range '%2'..'%3'!",O="Expected value to be typeof '",b="Expected value to be typeof function but found ",c="Expected value to be an integer but found ",H="Called fail().",C="The parameter 're' must be a string or a regular expression.",D="Expected value to be a number >= 0 but found ",G="Expected value to be instanceof '",Q="Wrong number of arguments given. Expected '",bi="object";qx.Class.define(L,{statics:{__tN:true,__tO:function(bx,by){var bz=p;for(var i=1,l=arguments.length;i<l;i++){bz=bz+this.__tP(arguments[i]);}var bB=R+bx+bl+bz;if(this.__tN){qx.Bootstrap.error(bB);}if(qx.Class.isDefined(bb)){var bA=new qx.core.AssertionError(bx,bz);if(this.__tN){qx.Bootstrap.error("Stack trace: \n"+bA.getStackTrace());}throw bA;}else{throw new Error(bB);}},__tP:function(bC){var bD;if(bC===null){bD=ba;}else if(qx.lang.Type.isArray(bC)&&bC.length>10){bD=Y+bC.length+bh;}else if((bC instanceof Object)&&(bC.toString==null)){bD=qx.lang.Json.stringify(bC,null,2);}else{try{bD=bC.toString();}catch(e){bD=p;}}return bD;},assert:function(bE,bF){bE==true||this.__tO(bF||p,F);},fail:function(bG){this.__tO(bG||p,H);},assertTrue:function(bH,bI){(bH===true)||this.__tO(bI||p,w,bH,m);},assertFalse:function(bJ,bK){(bJ===false)||this.__tO(bK||p,bc,bJ,m);},assertEquals:function(bL,bM,bN){bL==bM||this.__tO(bN||p,k,bL,U,bM,n);},assertNotEquals:function(bO,bP,bQ){bO!=bP||this.__tO(bQ||p,k,bO,bp,bP,n);},assertIdentical:function(bR,bS,bT){bR===bS||this.__tO(bT||p,k,bR,P,bS,n);},assertNotIdentical:function(bU,bV,bW){bU!==bV||this.__tO(bW||p,k,bU,W,bV,n);},assertNotUndefined:function(bX,bY){bX!==undefined||this.__tO(bY||p,J,bX,o);},assertUndefined:function(ca,cb){ca===undefined||this.__tO(cb||p,v,ca,o);},assertNotNull:function(cc,cd){cc!==null||this.__tO(cd||p,K,cc,o);},assertNull:function(ce,cf){ce===null||this.__tO(cf||p,r,ce,o);},assertJsonEquals:function(cg,ch,ci){this.assertEquals(qx.lang.Json.stringify(cg),qx.lang.Json.stringify(ch),ci);},assertMatch:function(cj,ck,cl){this.assertString(cj);this.assert(qx.lang.Type.isRegExp(ck)||qx.lang.Type.isString(ck),C);cj.search(ck)>=0||this.__tO(cl||p,bf,cj,X,ck.toString(),n);},assertArgumentsCount:function(cm,cn,co,cp){var cq=cm.length;(cq>=cn&&cq<=co)||this.__tO(cp||p,Q,cn,bo,co,be,arguments.length,z);},assertEventFired:function(cr,event,cs,ct,cu){var cw=false;var cv=function(e){if(ct){ct.call(cr,e);}cw=true;};var cx;try{cx=cr.addListener(event,cv,cr);cs.call();}catch(cy){throw cy;}finally{try{cr.removeListenerById(cx);}catch(cz){}}cw===true||this.__tO(cu||p,f,event,I);},assertEventNotFired:function(cA,event,cB,cC){var cE=false;var cD=function(e){cE=true;};var cF=cA.addListener(event,cD,cA);cB.call();cE===false||this.__tO(cC||p,f,event,br);cA.removeListenerById(cF);},assertException:function(cG,cH,cI,cJ){var cH=cH||Error;var cK;try{this.__tN=false;cG();}catch(cL){cK=cL;}finally{this.__tN=true;}if(cK==null){this.__tO(cJ||p,u);}cK instanceof cH||this.__tO(cJ||p,bk,cH,bu,cK);if(cI){this.assertMatch(cK.toString(),cI,cJ);}},assertInArray:function(cM,cN,cO){cN.indexOf(cM)!==-1||this.__tO(cO||p,bv,cM,S,cN,m);},assertArrayEquals:function(cP,cQ,cR){this.assertArray(cP,cR);this.assertArray(cQ,cR);this.assertEquals(cP.length,cQ.length,cR);for(var i=0;i<cP.length;i++){this.assertIdentical(cP[i],cQ[i],cR);}},assertKeyInMap:function(cS,cT,cU){cT[cS]!==undefined||this.__tO(cU||p,bv,cS,bj,cT,m);},assertFunction:function(cV,cW){qx.lang.Type.isFunction(cV)||this.__tO(cW||p,b,cV,o);},assertString:function(cX,cY){qx.lang.Type.isString(cX)||this.__tO(cY||p,N,cX,o);},assertBoolean:function(da,db){qx.lang.Type.isBoolean(da)||this.__tO(db||p,a,da,o);},assertNumber:function(dc,dd){(qx.lang.Type.isNumber(dc)&&isFinite(dc))||this.__tO(dd||p,V,dc,o);},assertPositiveNumber:function(de,df){(qx.lang.Type.isNumber(de)&&isFinite(de)&&de>=0)||this.__tO(df||p,D,de,o);},assertInteger:function(dg,dh){(qx.lang.Type.isNumber(dg)&&isFinite(dg)&&dg%1===0)||this.__tO(dh||p,c,dg,o);},assertPositiveInteger:function(di,dj){var dk=(qx.lang.Type.isNumber(di)&&isFinite(di)&&di%1===0&&di>=0);dk||this.__tO(dj||p,bq,di,o);},assertInRange:function(dl,dm,dn,dp){(dl>=dm&&dl<=dn)||this.__tO(dp||p,qx.lang.String.format(B,[dl,dm,dn]));},assertObject:function(dq,dr){var ds=dq!==null&&(qx.lang.Type.isObject(dq)||typeof dq===bi);ds||this.__tO(dr||p,M,(dq),o);},assertArray:function(dt,du){qx.lang.Type.isArray(dt)||this.__tO(du||p,bs,dt,o);},assertMap:function(dv,dw){qx.lang.Type.isObject(dv)||this.__tO(dw||p,x,dv,o);},assertRegExp:function(dx,dy){qx.lang.Type.isRegExp(dx)||this.__tO(dy||p,t,dx,o);},assertType:function(dz,dA,dB){this.assertString(dA,E);typeof (dz)===dA||this.__tO(dB||p,O,dA,bw,dz,o);},assertInstance:function(dC,dD,dE){var dF=dD.classname||dD+p;dC instanceof dD||this.__tO(dE||p,G,dF,bw,dC,o);},assertInterface:function(dG,dH,dI){qx.Class.implementsInterface(dG,dH)||this.__tO(dI||p,T,dG,q,dH,n);},assertCssColor:function(dJ,dK,dL){var dM=qx.Class.getByName(bm);if(!dM){throw new Error("qx.util.ColorUtil not available! Your code must have a dependency on 'qx.util.ColorUtil'");}var dO=dM.stringToRgb(dJ);try{var dN=dM.stringToRgb(dK);}catch(dQ){this.__tO(dL||p,d,dJ,j,dO.join(h),g,dK,bd);}var dP=dO[0]==dN[0]&&dO[1]==dN[1]&&dO[2]==dN[2];dP||this.__tO(dL||p,d,dO,j,dO.join(h),g,dK,j,dN.join(h),bg);},assertElement:function(dR,dS){!!(dR&&dR.nodeType===1)||this.__tO(dS||p,s,dR,n);},assertQxObject:function(dT,dU){this.__tQ(dT,bt)||this.__tO(dU||p,y,dT,o);},assertQxWidget:function(dV,dW){this.__tQ(dV,bn)||this.__tO(dW||p,A,dV,o);},__tQ:function(dX,dY){if(!dX){return false;}var ea=dX.constructor;while(ea){if(ea.classname===dY){return true;}ea=ea.superclass;}return false;}}});})();(function(){var p='',o='"',m=':',l=']',h='null',g=': ',f='object',e='function',d=',',b='\n',ba='\\u',Y=',\n',X='0000',W='string',V="Cannot stringify a recursive object.",U='0',T='-',S='}',R='String',Q='Boolean',x='\\\\',y='\\f',u='\\t',w='{\n',s='[]',t="qx.lang.JsonImpl",q='Z',r='\\n',z='Object',A='{}',H='@',F='.',K='(',J='Array',M='T',L='\\r',C='{',P='JSON.parse',O=' ',N='[',B='Number',D=')',E='[\n',G='\\"',I='\\b';qx.Class.define(t,{extend:Object,construct:function(){this.stringify=qx.lang.Function.bind(this.stringify,this);this.parse=qx.lang.Function.bind(this.parse,this);},members:{__tT:null,__tU:null,__tV:null,__tW:null,stringify:function(bb,bc,bd){this.__tT=p;this.__tU=p;this.__tW=[];if(qx.lang.Type.isNumber(bd)){var bd=Math.min(10,Math.floor(bd));for(var i=0;i<bd;i+=1){this.__tU+=O;}}else if(qx.lang.Type.isString(bd)){if(bd.length>10){bd=bd.slice(0,10);}this.__tU=bd;}if(bc&&(qx.lang.Type.isFunction(bc)||qx.lang.Type.isArray(bc))){this.__tV=bc;}else{this.__tV=null;}return this.__tX(p,{'':bb});},__tX:function(be,bf){var bi=this.__tT,bg,bj=bf[be];if(bj&&qx.lang.Type.isFunction(bj.toJSON)){bj=bj.toJSON(be);}else if(qx.lang.Type.isDate(bj)){bj=this.dateToJSON(bj);}if(typeof this.__tV===e){bj=this.__tV.call(bf,be,bj);}if(bj===null){return h;}if(bj===undefined){return undefined;}switch(qx.lang.Type.getClass(bj)){case R:return this.__tY(bj);case B:return isFinite(bj)?String(bj):h;case Q:return String(bj);case J:this.__tT+=this.__tU;bg=[];if(this.__tW.indexOf(bj)!==-1){throw new TypeError(V);}this.__tW.push(bj);var length=bj.length;for(var i=0;i<length;i+=1){bg[i]=this.__tX(i,bj)||h;}this.__tW.pop();if(bg.length===0){var bh=s;}else if(this.__tT){bh=E+this.__tT+bg.join(Y+this.__tT)+b+bi+l;}else{bh=N+bg.join(d)+l;}this.__tT=bi;return bh;case z:this.__tT+=this.__tU;bg=[];if(this.__tW.indexOf(bj)!==-1){throw new TypeError(V);}this.__tW.push(bj);if(this.__tV&&typeof this.__tV===f){var length=this.__tV.length;for(var i=0;i<length;i+=1){var k=this.__tV[i];if(typeof k===W){var v=this.__tX(k,bj);if(v){bg.push(this.__tY(k)+(this.__tT?g:m)+v);}}}}else{for(var k in bj){if(Object.hasOwnProperty.call(bj,k)){var v=this.__tX(k,bj);if(v){bg.push(this.__tY(k)+(this.__tT?g:m)+v);}}}}this.__tW.pop();if(bg.length===0){var bh=A;}else if(this.__tT){bh=w+this.__tT+bg.join(Y+this.__tT)+b+bi+S;}else{bh=C+bg.join(d)+S;}this.__tT=bi;return bh;}},dateToJSON:function(bk){var bl=function(n){return n<10?U+n:n;};var bm=function(n){var bn=bl(n);return n<100?U+bn:bn;};return isFinite(bk.valueOf())?bk.getUTCFullYear()+T+bl(bk.getUTCMonth()+1)+T+bl(bk.getUTCDate())+M+bl(bk.getUTCHours())+m+bl(bk.getUTCMinutes())+m+bl(bk.getUTCSeconds())+F+bm(bk.getUTCMilliseconds())+q:null;},__tY:function(bo){var bp={'\b':I,'\t':u,'\n':r,'\f':y,'\r':L,'"':G,'\\':x};var bq=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;bq.lastIndex=0;if(bq.test(bo)){return o+bo.replace(bq,function(a){var c=bp[a];return typeof c===W?c:ba+(X+a.charCodeAt(0).toString(16)).slice(-4);})+o;}else{return o+bo+o;}},parse:function(br,bs){var bt=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;bt.lastIndex=0;if(bt.test(br)){br=br.replace(bt,function(a){return ba+(X+a.charCodeAt(0).toString(16)).slice(-4);});}if(/^[\],:{}\s]*$/.test(br.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,H).replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,l).replace(/(?:^|:|,)(?:\s*\[)+/g,p))){var j=eval(K+br+D);return typeof bs===e?this.__ua({'':j},p,bs):j;}throw new SyntaxError(P);},__ua:function(bu,bv,bw){var bx=bu[bv];if(bx&&typeof bx===f){for(var k in bx){if(Object.hasOwnProperty.call(bx,k)){var v=this.__ua(bx,k,bw);if(v!==undefined){bx[k]=v;}else{delete bx[k];}}}}return bw.call(bu,bv,bx);}}});})();(function(){var a="qx.lang.Json";qx.Class.define(a,{statics:{JSON:(qx.lang.Type.getClass(window.JSON)=="JSON"&&JSON.parse('{"x":1}').x===1)?window.JSON:new qx.lang.JsonImpl(),stringify:null,parse:null},defer:function(b){b.stringify=b.JSON.stringify;b.parse=b.JSON.parse;}});})();(function(){var g="",f="<br",e=" &nbsp;",d="<br>",c=" ",b="\n",a="qx.bom.String";qx.Class.define(a,{statics:{TO_CHARCODE:{"quot":34,"amp":38,"lt":60,"gt":62,"nbsp":160,"iexcl":161,"cent":162,"pound":163,"curren":164,"yen":165,"brvbar":166,"sect":167,"uml":168,"copy":169,"ordf":170,"laquo":171,"not":172,"shy":173,"reg":174,"macr":175,"deg":176,"plusmn":177,"sup2":178,"sup3":179,"acute":180,"micro":181,"para":182,"middot":183,"cedil":184,"sup1":185,"ordm":186,"raquo":187,"frac14":188,"frac12":189,"frac34":190,"iquest":191,"Agrave":192,"Aacute":193,"Acirc":194,"Atilde":195,"Auml":196,"Aring":197,"AElig":198,"Ccedil":199,"Egrave":200,"Eacute":201,"Ecirc":202,"Euml":203,"Igrave":204,"Iacute":205,"Icirc":206,"Iuml":207,"ETH":208,"Ntilde":209,"Ograve":210,"Oacute":211,"Ocirc":212,"Otilde":213,"Ouml":214,"times":215,"Oslash":216,"Ugrave":217,"Uacute":218,"Ucirc":219,"Uuml":220,"Yacute":221,"THORN":222,"szlig":223,"agrave":224,"aacute":225,"acirc":226,"atilde":227,"auml":228,"aring":229,"aelig":230,"ccedil":231,"egrave":232,"eacute":233,"ecirc":234,"euml":235,"igrave":236,"iacute":237,"icirc":238,"iuml":239,"eth":240,"ntilde":241,"ograve":242,"oacute":243,"ocirc":244,"otilde":245,"ouml":246,"divide":247,"oslash":248,"ugrave":249,"uacute":250,"ucirc":251,"uuml":252,"yacute":253,"thorn":254,"yuml":255,"fnof":402,"Alpha":913,"Beta":914,"Gamma":915,"Delta":916,"Epsilon":917,"Zeta":918,"Eta":919,"Theta":920,"Iota":921,"Kappa":922,"Lambda":923,"Mu":924,"Nu":925,"Xi":926,"Omicron":927,"Pi":928,"Rho":929,"Sigma":931,"Tau":932,"Upsilon":933,"Phi":934,"Chi":935,"Psi":936,"Omega":937,"alpha":945,"beta":946,"gamma":947,"delta":948,"epsilon":949,"zeta":950,"eta":951,"theta":952,"iota":953,"kappa":954,"lambda":955,"mu":956,"nu":957,"xi":958,"omicron":959,"pi":960,"rho":961,"sigmaf":962,"sigma":963,"tau":964,"upsilon":965,"phi":966,"chi":967,"psi":968,"omega":969,"thetasym":977,"upsih":978,"piv":982,"bull":8226,"hellip":8230,"prime":8242,"Prime":8243,"oline":8254,"frasl":8260,"weierp":8472,"image":8465,"real":8476,"trade":8482,"alefsym":8501,"larr":8592,"uarr":8593,"rarr":8594,"darr":8595,"harr":8596,"crarr":8629,"lArr":8656,"uArr":8657,"rArr":8658,"dArr":8659,"hArr":8660,"forall":8704,"part":8706,"exist":8707,"empty":8709,"nabla":8711,"isin":8712,"notin":8713,"ni":8715,"prod":8719,"sum":8721,"minus":8722,"lowast":8727,"radic":8730,"prop":8733,"infin":8734,"ang":8736,"and":8743,"or":8744,"cap":8745,"cup":8746,"int":8747,"there4":8756,"sim":8764,"cong":8773,"asymp":8776,"ne":8800,"equiv":8801,"le":8804,"ge":8805,"sub":8834,"sup":8835,"sube":8838,"supe":8839,"oplus":8853,"otimes":8855,"perp":8869,"sdot":8901,"lceil":8968,"rceil":8969,"lfloor":8970,"rfloor":8971,"lang":9001,"rang":9002,"loz":9674,"spades":9824,"clubs":9827,"hearts":9829,"diams":9830,"OElig":338,"oelig":339,"Scaron":352,"scaron":353,"Yuml":376,"circ":710,"tilde":732,"ensp":8194,"emsp":8195,"thinsp":8201,"zwnj":8204,"zwj":8205,"lrm":8206,"rlm":8207,"ndash":8211,"mdash":8212,"lsquo":8216,"rsquo":8217,"sbquo":8218,"ldquo":8220,"rdquo":8221,"bdquo":8222,"dagger":8224,"Dagger":8225,"permil":8240,"lsaquo":8249,"rsaquo":8250,"euro":8364},escape:function(h){return qx.util.StringEscape.escape(h,qx.bom.String.FROM_CHARCODE);},unescape:function(i){return qx.util.StringEscape.unescape(i,qx.bom.String.TO_CHARCODE);},fromText:function(j){return qx.bom.String.escape(j).replace(/( |\n)/g,function(k){var l={" ":e,"\n":d};return l[k]||k;});},toText:function(m){return qx.bom.String.unescape(m.replace(/\s+|<([^>])+>/gi,function(n){if(n.indexOf(f)===0){return b;}else if(n.length>0&&n.replace(/^\s*/,g).replace(/\s*$/,g)==g){return c;}else{return g;}}));}},defer:function(o){o.FROM_CHARCODE=qx.lang.Object.invert(o.TO_CHARCODE);}});})();(function(){var g=";",f="&",e='X',d="",c='#',b="&#",a="qx.util.StringEscape";qx.Class.define(a,{statics:{escape:function(h,j){var m,o=d;for(var i=0,l=h.length;i<l;i++){var n=h.charAt(i);var k=n.charCodeAt(0);if(j[k]){m=f+j[k]+g;}else{if(k>0x7F){m=b+k+g;}else{m=n;}}o+=m;}return o;},unescape:function(p,q){return p.replace(/&[#\w]+;/gi,function(r){var s=r;var r=r.substring(1,r.length-1);var t=q[r];if(t){s=String.fromCharCode(t);}else{if(r.charAt(0)==c){if(r.charAt(1).toUpperCase()==e){t=r.substring(2);if(t.match(/^[0-9A-Fa-f]+$/gi)){s=String.fromCharCode(parseInt(t,16));}}else{t=r.substring(1);if(t.match(/^\d+$/gi)){s=String.fromCharCode(parseInt(t,10));}}}}return s;});}}});})();(function(){var bU="",bT='</div>',bS='<div class="item-detail-text">',bR='<div class="item-detail-headline">',bQ="#",bP='</td>',bO="'",bN="(",bM='">',bL=" ",bv=".",bu=",'",bt=")",bs=".toggleShowItemDetails('",br='"',bq="&nbsp;",bp='<div class="item-detail-error">',bo="none",bn="</p>",bm='" onclick="',cc=')">',cd="properties",ca='>',cb="events",bX="methods",bY="mixin",bV='.togglePanelVisibility(',bW='</span>',ce="apiviewer.ObjectRegistry.getObjectFromHashCode('",cf='<td class="type">',bE='<td class="toggle">',bD="apiviewer/image/open.gif",bG='<div class="info-panel"><h2>',bF="apiviewer.dao.Node",bI="Inherited from:",bH='open.gif',bK='\'); return false;"',bJ=' title="',bC='//',bB="</span>",a="'>",b="Documentation errors:",c="<span class='",d='package',e='#',f='" onmouseup="apiviewer.TabViewController.instance.onSelectItem(\'',g='" href="',h="Included from mixin:",k=' onclick="',m=", Column:",cj="; ",ci="&#160;",ch="margin-left:18px;",cg='<td class="text">',cn=" <br/>",cm="See also:",cl="Deprecated:",ck='<a style="',cp='<img src="',co=" is deprecated!",L='apiviewer/image/',M='apiviewer/image/open.gif',J="[]",K="apiviewer.ui.panels.InfoPanel",P='close.gif',Q="_itemName",N='<',O='" alt="',H="Boolean",I="Line: ",u='<h3',t="This ",w='</h2><div></div></div>',v='<span onclick="',q="item-private",p="class",s="item-internal",r="Access:",o="interface",n='title="',V='<td class="icon" ',W='" onclick="return false;"',X='</h3>',Y="')",R=" | ",S=", ",T="private",U="Element",ba='<tr class="',bb='apiviewer/image/close.gif',E='</tr>',D="item-deprecated",C="item-protected",B='<div _itemName="',A='',z='</a></span>',y="qx.client",x="Required by:",G=')"/>',F="overlay_",bc='<img class="openclose" src="',bd="String",be="Overrides:",bf="_applyElement",bg="internal",bh='<span style="white-space: nowrap;">',bi="TBODY",bj='<div class="item-desc">',bk='<table cellspacing="0" cellpadding="0" class="info" width="100%">',bl=')"/> ',bz="abstract",by="protected",bx="webkit",bw='</table>',bA="undefined";qx.Class.define(K,{type:bz,extend:qx.core.Object,construct:function(cq,cr){qx.core.Object.call(this);this.setListName(cq);this._labelText=cr;apiviewer.ObjectRegistry.register(this);},properties:{element:{check:U,init:null,nullable:true,apply:bf},listName:{check:bd},isOpen:{check:H,init:true},docNode:{check:bF,nullable:true}},statics:{ITEM_SPEC_REGEX:/^(([\w\.]+)?(#\w+(\([^\)]*\))?)?)(\s+(.*))?$/,SENTENCE_END_REGEX:/[^\.].\.(\s|<)/,resolveLinkAttributes:function(cs,ct){var cw=/\{@link([^\}]*)\}/mg;var cv=new qx.util.StringBuilder();var cu;var cx=0;while((cu=cw.exec(cs))!=null){cv.add(cs.substring(cx,cu.index)+this.createItemLinkHtml(cu[1],ct));cx=cu.index+cu[0].length;}cv.add(cs.substring(cx,cs.length));return cv.get();},createItemLinkHtml:function(cy,cz,cA,cB){if(cA==null){cA=true;}cy=qx.lang.String.trim(cy);if(cy.charAt(0)==br||cy.charAt(0)==N){return cy;}else{var cE=this.ITEM_SPEC_REGEX.exec(cy);if(cE==null){return cy;}else{var cK=cE[2];var cS=cE[3];var cJ=cE[6];var cD=bU;if(cK==null||cK.length==0){cK=cz.getFullName();}else if(cz&&cK.indexOf(bv)==-1){var name=cz.getName();if(cz instanceof apiviewer.dao.Package){var cG=cz.getFullName();}else{var cQ=cz.getFullName();var cG=cQ.substring(0,cQ.length-name.length-1);}cK=cG+bv+cK;}if(cJ==null||cJ.length==0){cJ=cE[1];}if(cA){var cO=apiviewer.dao.Class.getClassByName(cK);if(cO){var cT;if(cS){var cI=cS.substring(1);var cM=cI.indexOf(bN);if(cM!=-1){cI=qx.lang.String.trim(cI.substring(0,cM));}cT=this.__St(cI,cO);}else{cT=cO;}if(cT){if(cT.getNodeType()!==d){cK=cT.getClass().getFullName();}var cL=apiviewer.TreeUtil.getIconUrl(cT);var cC=apiviewer.ui.ClassViewer.createImageHtml(cL);if(qx.core.Variant.isSet(y,bx)){if(cC.indexOf(F)!==-1){cD=ch;}}}}}var cR=cK+(cS?cS:bU);var cP,cH,cN;if(qx.bom.client.Engine.OPERA&&qx.bom.client.Engine.VERSION>9){cP=location.protocol;cH=location.host;cN=location.pathname;}else{cP=window.location.protocol;cH=window.location.host;cN=window.location.pathname;}var cF=[bh,(typeof cC!=bA?cC:bU),ck+cD+g+cP,bC,cH,cN,e,cR,W,f,cR,bK,bJ,cR,bM,cJ,z];return cF.join(bU);}}},createSeeAlsoHtml:function(cU){var cV=cU.getSee();if(cV.length>0){var cX=new qx.util.StringBuilder();for(var i=0;i<cV.length;i++){if(cX.length!=0){cX.add(S);}cX.add(this.createItemLinkHtml(cV[i],cU.getClass()));}if(!cX.isEmpty()){var cW=new qx.util.StringBuilder();cW.add(bR,cm,bT,bS,cX,bT);return cW.get();}}return bU;},createInheritedFromHtml:function(cY,da){if(cY.getClass().getType()!=bY&&cY.getClass()!=da){var db=new qx.util.StringBuilder(bR,bI,bT,bS,apiviewer.ui.panels.InfoPanel.createItemLinkHtml(cY.getClass().getFullName()+bQ+cY.getName()),bT);return db.get();}else{return bU;}},createOverwriddenFromHtml:function(dc){if(dc.getOverriddenFrom()){var dd=new qx.util.StringBuilder(bR,be,bT,bS,apiviewer.ui.panels.InfoPanel.createItemLinkHtml(dc.getOverriddenFrom().getFullName()+bQ+dc.getName()),bT);return dd.get();}else{return bU;}},createIncludedFromHtml:function(de,df){if(de.getClass()!=df){if(de.getClass().getType()==bY){var dg=new qx.util.StringBuilder(bR,h,bT,bS,apiviewer.ui.panels.InfoPanel.createItemLinkHtml(de.getClass().getFullName()+bQ+de.getName()),bT);return dg.get();}}else{return bU;}},__St:function(dh,di){var dk=di.getItem(dh);if(dk){return dk;}else{var dl=di.getClassHierarchy();for(var i=0,l=dl.length;i<l;i++){var dj=dl[i];dk=dj.getItem(dh);if(dk){break;}}return dk;}},createDescriptionHtml:function(dm,dn,dp){var dq=dm.getDescription();if(dq){if(!dp){dq=this.__Su(dq);}return bj+this.resolveLinkAttributes(dq,dn)+bT;}else{return bU;}},__Su:function(dr){var du=dr;var dt=du.indexOf(bn);if(dt!=-1){du=du.substr(0,dt+4);var ds=this.SENTENCE_END_REGEX.exec(du);if(ds!=null){du=dr.substring(0,ds.index+ds[0].length-1)+bn;}}return du;},descriptionHasDetails:function(dv){var dw=dv.getDescription();if(dw){return this.__Su(dw)!=dw;}else{return false;}},createTypeHtml:function(dx,dy,dz){if(dz==null){dz=true;}var dF=[];var dA,dB,dC;if(dx){dF=dx.getTypes();}var dD=new qx.util.StringBuilder();if(dF.length==0){dD.add(dy);}else{if(dF.length>1){dD.add(bN);}for(var j=0;j<dF.length;j++){if(j>0){dD.add(R);}dB=dF[j].type;dA=dF[j].dimensions;if(apiviewer.ui.ClassViewer.PRIMITIVES[dB]){dD.add(dB);}else{dC=dB;if(dz){var dE=dB.lastIndexOf(bv);if(dE!=-1){dC+=bL+dB.substring(dE+1);}}dD.add(apiviewer.ui.panels.InfoPanel.createItemLinkHtml(dC,dx.getClass(),false,true));}if(dA){for(var i=0;i<parseInt(dA);i++){dD.add(J);}}}if(dF.length>1){dD.add(bt);}}return dD.get();},createErrorHtml:function(dG,dH){var dI=dG.getDocNode();var dJ=dI.getErrors();if(dJ.length>0){var dK=new qx.util.StringBuilder(bp,b,bT);for(var i=0;i<dJ.length;i++){dK.add(bS,dJ[i].attributes.msg,cn);dK.add(bN);if(dG.getClass()!=dH){dK.add(dG.getClass().getFullName(),cj);}dK.add(I,dJ[i].attributes.line,m,dJ[i].attributes.column+bt,bT);}return dK.get();}else{return bU;}},createDeprecationHtml:function(dL,dM){if(!dL.isDeprecated()){return bU;}var dN=new qx.util.StringBuilder();dN.add(bp,cl,bT);dN.add(bS);var dO=dL.getDeprecationText();if(dO){dN.add(dO);}else{dN.add(t,dM,co);}dN.add(bT);return dN.get();},createAccessHtml:function(dP){if(dP.isPublic()){return bU;}var dR=new qx.util.StringBuilder();dR.add(bR,r,bT);dR.add(bS);var dQ=[];if(dP.isPrivate()){dQ.push(T);}if(dP.isInternal()){dQ.push(bg);}if(dP.isProtected()){dQ.push(by);}dR.add(dQ.join(bL));dR.add(bT);return dR.get();},createInfoRequiredByHtml:function(dS){var dU=new qx.util.StringBuilder();var dT=dS.getRequiredBy();if(dT.length>0){dU.add(bR,x,bT);for(var i=0;i<dT.length;i++){dU.add(bS,apiviewer.ui.panels.InfoPanel.createItemLinkHtml(dT[i].getFullName()+bQ+dS.getName()),bT);}}return dU.get();},setTitleClass:function(dV,dW){var dX=[c,bU,a,dW,bB];dX[1]=this.getItemCssClasses(dV);return dX.join(bU);},getItemCssClasses:function(dY){var ea=[];if(dY.isDeprecated()){ea.push(D);}if(dY.isPrivate()){ea.push(q);}if(dY.isInternal()){ea.push(s);}if(dY.isProtected()){ea.push(C);}return ea.join(bL);}},members:{canDisplayItem:function(eb){return (eb.getListName()==this.getListName());},getItemTypeHtml:function(ec,ed){throw new Error("Abstract method called!");},getItemTitleHtml:function(ee,ef){throw new Error("Abstract method called!");},getItemTextHtml:function(eg,eh,ei){throw new Error("Abstract method called!");},getItemTooltip:function(ej,ek){return bU;},getItemHtml:function(el,em,en){if((el instanceof apiviewer.dao.Class)||el instanceof apiviewer.dao.Package){var es=el.getPackage();}else{var es=el.getClass();}var er=new qx.util.StringBuilder();var et=(es!=em)&&es.getType()==p;var eq=apiviewer.TreeUtil.getIconUrl(el,et);er.add(ba,apiviewer.ui.panels.InfoPanel.getItemCssClasses(el),bM);var eu=this.getItemTooltip(el,em);var ep=eu?n+eu+O+eu+br:A;er.add(V,ep,ca,apiviewer.ui.ClassViewer.createImageHtml(eq),bP);var eo=this.getItemTypeHtml(el,em);er.add(cf,((eo)?(eo+bq):bq),bP);er.add(bE);if(this.itemHasDetails(el,em)){er.add(cp,qx.util.ResourceManager.getInstance().toUri(bD),bm,this.__Sv(this),bs,el.getName(),bO,((es!=em)?bu+es.getFullName()+bO:bU),G);}else{er.add(ci);}er.add(bP);er.add(cg);er.add(u);if(this.itemHasDetails(el,em)){er.add(k,this.__Sv(this),bs,el.getName(),bO,((es!=em)?bu+es.getFullName()+bO:bU),cc);}else{er.add(ca);}er.add(this.getItemTitleHtml(el,em));er.add(X);er.add(B,el.getName(),bM);er.add(this.getItemTextHtml(el,em,en));er.add(bT);er.add(bP);er.add(E);return er.get();},itemHasDetails:qx.lang.Function.returnTrue,__Sv:function(ev){return ce+ev.toHashCode()+Y;},getPanelHtml:function(ew){var ey=this._labelText.charAt(0).toUpperCase()+this._labelText.substring(1);var ex=new qx.util.StringBuilder(bG);ex.add(bc,qx.util.ResourceManager.getInstance().toUri(L+(this.getIsOpen()?P:bH)),bm,this.__Sv(ew),bV+this.__Sv(this),bl,v,this.__Sv(ew),bV,this.__Sv(this),cc,ey,bW);ex.add(w);return ex.get();},_getPanelItems:function(ez,eA){if(!eA){return [];}var eB=this.getListName();var eD=[];var eG={};if(ez&&(eB==cb||eB==cd||eB==bX)){if(eA.getType()==o){var eE=eA.getInterfaceHierarchy();}else{var eE=eA.getClassHierarchy();}}else{eE=[eA];}for(var eH=0;eH<eE.length;eH++){var eF=eE[eH];var eC=eF.getItemList(eB);if(eB==cb||eB==cd||eB==bX){qx.lang.Array.append(eC,eF.getNodesOfTypeFromMixins(this.getListName()));}for(var i=0;i<eC.length;i++){var name=eC[i].getName();if(!(Object.prototype.hasOwnProperty.call(eG,name))){eG[name]=eF;eD.push(eC[i]);}}}return eD;},__Sw:function(eI,eJ,eK,eL,eM){var eO=eI.concat();for(var i=eI.length-1;i>=0;i--){var eN=eI[i];if(eN.isPropertyGenerated()&&!eJ){qx.lang.Array.removeAt(eO,i);}else if(eN.isPrivate()&&!eL){qx.lang.Array.removeAt(eO,i);}else if(eN.isProtected()&&!eK){qx.lang.Array.removeAt(eO,i);}else if(eN.isInternal()&&!eM){qx.lang.Array.removeAt(eO,i);}}return eO;},_sortItems:function(eP){eP.sort(function(eQ,eR){var eU=0;if(eQ.isInternal()){eU+=4;}if(eQ.isPrivate()){eU+=2;}if(eQ.isProtected()){eU+=1;}var eT=0;if(eR.isInternal()){eT+=4;}if(eR.isPrivate()){eT+=2;}if(eR.isProtected()){eT+=1;}if(eU==eT){var eV=eQ.getName();var eS=eR.getName();return eV.toLowerCase()<eS.toLowerCase()?-1:1;}else{return eU-eT;}});},_displayNodes:function(eW,eX){if(eW&&eW.length>0){var eY=new qx.util.StringBuilder(bk);for(var i=0;i<eW.length;i++){eY.add(this.getItemHtml(eW[i],eX,false));}eY.add(bw);this.getBodyElement().innerHTML=eY.get();apiviewer.ui.AbstractViewer.fixLinks(this.getBodyElement());apiviewer.ui.AbstractViewer.highlightCode(this.getBodyElement());this.getBodyElement().style.display=!this.getIsOpen()?bo:bU;this.getElement().style.display=bU;}else{this.getElement().style.display=bo;}},update:function(fa,fb){if(!this.getElement()){return;}this.setDocNode(fb);var ff=fa.getShowInherited();var fc=this._getPanelItems(ff,fb);if(fc&&fc.length>0){var fh=fa.getExpandProperties();var fd=fa.getShowProtected();var fg=fa.getShowPrivate();var fe=fg;fc=this.__Sw(fc,fh,fd,fg,fe);this._sortItems(fc);}this._displayNodes(fc,fb);},_applyElement:function(fi){this._titleElement=fi.firstChild;this._bodyElement=fi.lastChild;},getTitleElement:function(){return this._titleElement;},getBodyElement:function(){return this._bodyElement;},getItemElement:function(name){var fj=this.getBodyElement().getElementsByTagName(bi)[0].childNodes;for(var i=0;i<fj.length;i++){if(fj[i].childNodes[3].childNodes[1].getAttribute(Q)==name){return fj[i].childNodes[3].childNodes[1];}}},toggleShowItemDetails:function(fk,fl){try{var fn=this.getItemElement(fk);if(!fn){throw Error("Element for name '"+fk+"' not found!");}var fm=fn._showDetails?!fn._showDetails:true;fn._showDetails=fm;if(fl){var fq=apiviewer.dao.Class.getClassByName(fl);}else{fq=this.getDocNode();}var fo=fq.getItemByListAndName(this.getListName(),fk);var fp=fn.parentNode.previousSibling.firstChild;fp.src=qx.util.ResourceManager.getInstance().toUri(fm?bb:M);fn.innerHTML=this.getItemTextHtml(fo,this.getDocNode(),fm);apiviewer.ui.AbstractViewer.fixLinks(fn);apiviewer.ui.AbstractViewer.highlightCode(fn);}catch(fr){this.error("Toggling item details failed");this.error(fr);}}},destruct:function(){this._titleElement=this._bodyElement=null;}});})();(function(){var k='</div>',j='<div class="item-detail-text">',h='<div class="item-detail-headline">',g='</span>',f="var",e='<span class="parameter-type">',d=" ",c="function",b='</span> <code>',a="<code>",D="Parameters:",C="Throws:",B="Apply method of property:",A='</code>',z=") ",y="</code>",x="apiviewer.ui.panels.MethodPanel",w="void",v='<span class="method-signature"><span class="parenthesis">(</span>',u="Returns:",r=" (default: ",s="[]",p='<span class="separator">,</span> ',q='<span class="parenthesis">)</span></span>',n="Creates a new instance of ",o='<span class="item-detail-optional">',l="?",m="abstract ",t=".";qx.Class.define(x,{extend:apiviewer.ui.panels.InfoPanel,members:{getItemTitleHtml:function(E){if(E.isConstructor()){var I=E.getClass().getName();}else{I=E.getName();}var F=new qx.util.StringBuilder(apiviewer.ui.panels.InfoPanel.setTitleClass(E,I));F.add(v);var G=E.getParams();for(var i=0;i<G.length;i++){var H=G[i];if(i!=0){F.add(p);}F.add(e,apiviewer.ui.panels.InfoPanel.createTypeHtml(H,f),b,H.getName(),A);if(H.getDefaultValue()){F.add(l);}}F.add(q);return F.get();},getItemTypeHtml:function(J){var K=new qx.util.StringBuilder();if(J.isAbstract()){K.add(m);}if(!J.isConstructor()){K.add(apiviewer.ui.panels.InfoPanel.createTypeHtml(J.getDocNode().getReturn(),w));}return K.get();},getItemTextHtml:function(L,M,N){var U=L.getClass();var X=new qx.util.StringBuilder();if(L.isConstructor()&&!L.getDescription()){X.add(n,U.getName(),t);}else{X.add(apiviewer.ui.panels.InfoPanel.createDescriptionHtml(L,U,N));}if(N){var V=L.getDocNode().getParams();if(V.length>0){X.add(h,D,k);for(var i=0;i<V.length;i++){var R=V[i];var O=R.getType()?R.getType():f;var T=R.getArrayDimensions();if(T){for(var i=0;i<T;i++){O+=s;}}var Y=R.getDefaultValue();X.add(j);if(Y){X.add(o);}X.add(a,R.getName(),y);if(Y){X.add(r,Y,z,g);}var ba=R.getDescription();if(ba){X.add(d,apiviewer.ui.panels.InfoPanel.resolveLinkAttributes(ba,U));}X.add(k);}}var P=L.getDocNode().getReturn();if(P){var ba=P.getDescription();if(ba){X.add(h,u,k,j,apiviewer.ui.panels.InfoPanel.resolveLinkAttributes(ba,U),k);}}if(L.getApply()){X.add(h,B,k,j,apiviewer.ui.panels.InfoPanel.createItemLinkHtml(L.getApply(),L.getClass(),true,true),k);}var S=L.getDocNode().getThrows();if(S.length>0){X.add(h,C,k);for(var i=0;i<S.length;i++){var W=S[i];var Q=W.getType()?W.getType():W.getDefaultType();X.add(j);X.add(e,apiviewer.ui.panels.InfoPanel.createItemLinkHtml(Q),g);var ba=W.getDescription();if(ba){X.add(d,apiviewer.ui.panels.InfoPanel.resolveLinkAttributes(ba,U));}X.add(k);}}X.add(apiviewer.ui.panels.InfoPanel.createAccessHtml(L));X.add(apiviewer.ui.panels.InfoPanel.createIncludedFromHtml(L,M));X.add(apiviewer.ui.panels.InfoPanel.createOverwriddenFromHtml(L));X.add(apiviewer.ui.panels.InfoPanel.createInheritedFromHtml(L,M));X.add(apiviewer.ui.panels.InfoPanel.createInfoRequiredByHtml(L));X.add(apiviewer.ui.panels.InfoPanel.createSeeAlsoHtml(L));X.add(apiviewer.ui.panels.InfoPanel.createErrorHtml(L,M));X.add(apiviewer.ui.panels.InfoPanel.createDeprecationHtml(L,c));}return X.get();},itemHasDetails:function(bb,bc){var bd=bb.getDocNode();var be=bd.getReturn()&&bd.getReturn().getDescription();return (bb.getClass()!=bc||bb.getOverriddenFrom()!=null||bb.getRequiredBy().length>0||bd.getParams().length>0||bd.getThrows().length>0||be||bb.getSee().length>0||bb.getErrors().length>0||bb.isDeprecated()||bb.getApply()||apiviewer.ui.panels.InfoPanel.descriptionHasDetails(bb));}}});})();(function(){var h="",g="deprecated",f="internal",e="protected",d="errors",c="apiviewer.dao.Node",b="string",a="private";qx.Class.define(c,{extend:qx.core.Object,construct:function(j){qx.core.Object.call(this);this._docNode=j;j.children=j.children||[];j.attributes=j.attributes||{};j.cls=this;this._initializeFields();for(var i=0;i<j.children.length;i++){var k=j.children[i];if(!this._addChildNode(k)){throw new Error("Unknown child type: "+k.type+" node: "+qx.util.Json.stringify(k));}}},members:{getNode:function(){return this._docNode;},getNodeType:function(){return this._docNode.type;},getErrors:function(){return this._errors;},getDeprecationText:function(){return this._deprecated||h;},isDeprecated:function(){return typeof (this._deprecated)==b?true:false;},isInternal:function(){return this._docNode.attributes.access==f;},isPrivate:function(){return this._docNode.attributes.access==a;},isProtected:function(){return this._docNode.attributes.access==e;},isPropertyGenerated:function(){return this._docNode.attributes.fromProperty!=null;},isPublic:function(){return (!this.isPrivate()&&!this.isProtected()&&!this.isInternal());},hasWarning:function(){return this._docNode.attributes.hasWarning||false;},_createNodeList:function(l,m,n,o){if(m){var p=[];for(var i=0;i<l.children.length;i++){p.push(new m(l.children[i],n,o));}return p;}else{return l.children;}},_initializeFields:function(){this._errors=[];},_addChildNode:function(q){switch(q.type){case g:this._deprecated=q.children?q.children[0].attributes.text||h:h;break;case d:this._errors=this._createNodeList(q);break;default:return false;}return true;}},destruct:function(){this._docNode=this._errors=null;}});})();(function(){var k="",h="getClasses",g="getPackages",f="functions",e="getFunctions",d="packages",c="desc",b="classes",a="apiviewer.dao.Package";qx.Class.define(a,{extend:apiviewer.dao.Node,construct:function(l,m){apiviewer.dao.Node.call(this,l);this._package=m;apiviewer.dao.Class.registerClass(this);},members:{getName:function(){return this._docNode.attributes.name;},getFullName:function(){return this._docNode.attributes.fullName||k;},getDescription:function(){return this._desc||k;},getClasses:function(){return this._classes;},getFunctions:function(){return this._functions;},getPackages:function(){return this._packages;},getPackage:function(){return this._package;},addClass:function(n){var o=n.getFullName();var p=this.getClasses();for(var i=0;i<p.length;i++){if(p[i].getFullName()==o){p[i]=n;return;}}p.push(n);},getItem:function(q){var r=[h,g];for(var i=0;i<r.length;i++){var s=this[r[i]]();for(var j=0;j<s.length;j++){if(q==s[j].getName()){return s[j];}}}},getItemList:function(t){var u={"classes":h,"packages":g,"functions":e};return this[u[t]]();},getItemByListAndName:function(v,w){var x=this.getItemList(v);for(var j=0;j<x.length;j++){if(w==x[j].getName()){return x[j];}}},_initializeFields:function(){apiviewer.dao.Node.prototype._initializeFields.call(this);this._classes=[];this._packages=[];this._functions=[];},_addChildNode:function(y){switch(y.type){case b:this._classes=this._createNodeList(y,apiviewer.dao.Class,this);break;case f:this._functions=this._createNodeList(y,apiviewer.dao.Method,this);break;case d:this._packages=this._createNodeList(y,apiviewer.dao.Package,this);break;case c:this._desc=y.attributes.text||k;break;default:return apiviewer.dao.Node.prototype._addChildNode.call(this,y);}return true;}},destruct:function(){this._package=this._classes=this._functions=this._packages=null;}});})();(function(){var n=",",m="",k="string",j="null",h='"',g=':',f="qx.jsonDebugging",e='-',d='\\u00',c="__qL",N="new Date(Date.UTC(",M='\\\\',L='\\f',K='\\"',J='Z',I="))",H="__qB",G="__qD",F="}",E='(',u='.',v="{",s='\\r',t=":",q='\\t',r="]",o="[",p="__qE",w="qx.jsonEncodeUndefined",x='T',z='\\b',y="__qC",B="qx.util.Json",A=')',D='\\n',C="__qM";qx.Class.define(B,{statics:{__qz:null,BEAUTIFYING_INDENT:" ",BEAUTIFYING_LINE_END:"\n",CONVERT_DATES:null,__qA:{"function":H,"boolean":y,"number":G,"string":p,"object":c,"undefined":C},__qB:function(O,P){return String(O);},__qC:function(Q,R){return String(Q);},__qD:function(S,T){return isFinite(S)?String(S):j;},__qE:function(U,V){var W;if(/["\\\x00-\x1f]/.test(U)){W=U.replace(/([\x00-\x1f\\"])/g,qx.util.Json.__qG);}else{W=U;}return h+W+h;},__qF:{'\b':z,'\t':q,'\n':D,'\f':L,'\r':s,'"':K,'\\':M},__qG:function(a,b){var X=qx.util.Json.__qF[b];if(X){return X;}X=b.charCodeAt();return d+Math.floor(X/16).toString(16)+(X%16).toString(16);},__qH:function(Y,ba){var bc=[],bf=true,be,bb;var bd=qx.util.Json.__qO;bc.push(o);if(bd){qx.util.Json.__qI+=qx.util.Json.BEAUTIFYING_INDENT;bc.push(qx.util.Json.__qI);}for(var i=0,l=Y.length;i<l;i++){bb=Y[i];be=this.__qA[typeof bb];if(be){bb=this[be](bb,i+m);if(typeof bb==k){if(!bf){bc.push(n);if(bd){bc.push(qx.util.Json.__qI);}}bc.push(bb);bf=false;}}}if(bd){qx.util.Json.__qI=qx.util.Json.__qI.substring(0,qx.util.Json.__qI.length-qx.util.Json.BEAUTIFYING_INDENT.length);bc.push(qx.util.Json.__qI);}bc.push(r);return bc.join(m);},__qJ:function(bg,bh){if(!qx.util.Json.CONVERT_DATES){if(bg.toJSON&&!qx.bom.client.Engine.OPERA){return bg.toJSON();}var bi=qx.util.format.NumberFormat.getInstance();bi.setMinimumIntegerDigits(2);var bk=bg.getUTCFullYear()+e+bi.format(bg.getUTCMonth()+1)+e+bi.format(bg.getUTCDate())+x+bi.format(bg.getUTCHours())+g+bi.format(bg.getUTCMinutes())+g+bi.format(bg.getUTCSeconds())+u;bi.setMinimumIntegerDigits(3);return bk+bi.format(bg.getUTCMilliseconds())+J;}else{var bj=bg.getUTCFullYear()+n+bg.getUTCMonth()+n+bg.getUTCDate()+n+bg.getUTCHours()+n+bg.getUTCMinutes()+n+bg.getUTCSeconds()+n+bg.getUTCMilliseconds();return N+bj+I;}},__qK:function(bl,bm){var bp=[],br=true,bo,bn;var bq=qx.util.Json.__qO;bp.push(v);if(bq){qx.util.Json.__qI+=qx.util.Json.BEAUTIFYING_INDENT;bp.push(qx.util.Json.__qI);}for(var bm in bl){bn=bl[bm];bo=this.__qA[typeof bn];if(bo){bn=this[bo](bn,bm);if(typeof bn==k){if(!br){bp.push(n);if(bq){bp.push(qx.util.Json.__qI);}}bp.push(this.__qE(bm),t,bn);br=false;}}}if(bq){qx.util.Json.__qI=qx.util.Json.__qI.substring(0,qx.util.Json.__qI.length-qx.util.Json.BEAUTIFYING_INDENT.length);bp.push(qx.util.Json.__qI);}bp.push(F);return bp.join(m);},__qL:function(bs,bt){if(bs){if(qx.lang.Type.isFunction(bs.toJSON)&&bs.toJSON!==this.__qz){return this.__qN(bs.toJSON(bt),bt);}else if(qx.lang.Type.isDate(bs)){return this.__qJ(bs,bt);}else if(qx.lang.Type.isArray(bs)){return this.__qH(bs,bt);}else if(qx.lang.Type.isObject(bs)){return this.__qK(bs,bt);}return m;}return j;},__qM:function(bu,bv){if(qx.core.Setting.get(w)){return j;}},__qN:function(bw,bx){return this[this.__qA[typeof bw]](bw,bx);},stringify:function(by,bz){this.__qO=bz;this.__qI=this.BEAUTIFYING_LINE_END;var bA=this.__qN(by,m);if(typeof bA!=k){bA=null;}if(qx.core.Setting.get(f)){qx.log.Logger.debug(this,"JSON request: "+bA);}return bA;},parse:function(bB,bC){if(bC===undefined){bC=true;}if(qx.core.Setting.get(f)){qx.log.Logger.debug(this,"JSON response: "+bB);}if(bC){if(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(bB.replace(/"(\\.|[^"\\])*"/g,m))){throw new Error("Could not parse JSON string!");}}try{var bD=(bB&&bB.length>0)?eval(E+bB+A):null;return bD;}catch(bE){throw new Error("Could not evaluate JSON string: "+bE.message);}}},settings:{"qx.jsonEncodeUndefined":true,"qx.jsonDebugging":false},defer:function(bF){bF.__qz=Date.prototype.toJSON;}});})();(function(){var a="qx.util.format.IFormat";qx.Interface.define(a,{members:{format:function(b){},parse:function(c){}}});})();(function(){var t="",s="Number",r="-",q="0",p="String",o="changeNumberFormat",n='(',m="g",l="Boolean",k="$",d="NaN",j='([0-9]{1,3}(?:',g='{0,1}[0-9]{3}){0,})',c='\\d+){0,1}',b="qx.util.format.NumberFormat",f="Infinity",e="^",h=".",a="-Infinity",i='([-+]){0,1}';qx.Class.define(b,{extend:qx.core.Object,implement:qx.util.format.IFormat,construct:function(u){qx.core.Object.call(this);this.__ro=u;},statics:{getIntegerInstance:function(){var v=qx.util.format.NumberFormat;if(v._integerInstance==null){v._integerInstance=new v();v._integerInstance.setMaximumFractionDigits(0);}return v._integerInstance;},getInstance:function(){if(!this._instance){this._instance=new this;}return this._instance;}},properties:{minimumIntegerDigits:{check:s,init:0},maximumIntegerDigits:{check:s,nullable:true},minimumFractionDigits:{check:s,init:0},maximumFractionDigits:{check:s,nullable:true},groupingUsed:{check:l,init:true},prefix:{check:p,init:t,event:o},postfix:{check:p,init:t,event:o}},members:{__ro:null,format:function(w){switch(w){case Infinity:return f;case -Infinity:return a;case NaN:return d;}var A=(w<0);if(A){w=-w;}if(this.getMaximumFractionDigits()!=null){var H=Math.pow(10,this.getMaximumFractionDigits());w=Math.round(w*H)/H;}var G=String(Math.floor(w)).length;var x=t+w;var D=x.substring(0,G);while(D.length<this.getMinimumIntegerDigits()){D=q+D;}if(this.getMaximumIntegerDigits()!=null&&D.length>this.getMaximumIntegerDigits()){D=D.substring(D.length-this.getMaximumIntegerDigits());}var C=x.substring(G+1);while(C.length<this.getMinimumFractionDigits()){C+=q;}if(this.getMaximumFractionDigits()!=null&&C.length>this.getMaximumFractionDigits()){C=C.substring(0,this.getMaximumFractionDigits());}if(this.getGroupingUsed()){var z=D;D=t;var F;for(F=z.length;F>3;F-=3){D=t+qx.locale.Number.getGroupSeparator(this.__ro)+z.substring(F-3,F)+D;}D=z.substring(0,F)+D;}var B=this.getPrefix()?this.getPrefix():t;var y=this.getPostfix()?this.getPostfix():t;var E=B+(A?r:t)+D;if(C.length>0){E+=t+qx.locale.Number.getDecimalSeparator(this.__ro)+C;}E+=y;return E;},parse:function(I){var N=qx.lang.String.escapeRegexpChars(qx.locale.Number.getGroupSeparator(this.__ro)+t);var L=qx.lang.String.escapeRegexpChars(qx.locale.Number.getDecimalSeparator(this.__ro)+t);var J=new RegExp(e+qx.lang.String.escapeRegexpChars(this.getPrefix())+i+j+N+g+n+L+c+qx.lang.String.escapeRegexpChars(this.getPostfix())+k);var M=J.exec(I);if(M==null){throw new Error("Number string '"+I+"' does not match the number format");}var O=(M[1]==r);var Q=M[2];var P=M[3];Q=Q.replace(new RegExp(N,m),t);var K=(O?r:t)+Q;if(P!=null&&P.length!=0){P=P.replace(new RegExp(L),t);K+=h+P;}return parseFloat(K);}}});})();(function(){var d="cldr_number_decimal_separator",c="cldr_number_percent_format",b="qx.locale.Number",a="cldr_number_group_separator";qx.Class.define(b,{statics:{getDecimalSeparator:function(e){return qx.locale.Manager.getInstance().localize(d,[],e);},getGroupSeparator:function(f){return qx.locale.Manager.getInstance().localize(a,[],f);},getPercentFormat:function(g){return qx.locale.Manager.getInstance().localize(c,[],g);}}});})();(function(){var m="",k=",",h="constructor",g="appearances",f="getAppearances",e="getStatics",d="getChildControls",c="constants",b="getProperties",a="methods",D="properties",C="getEvents",B="getMembers",A="events",z="methods-static",y="getConstants",x="apiviewer.dao.Class",w="superMixins",v="childControls",u="class",s="_constructor",t="desc",q="see",r="getConstructor",o="getSuperInterfaces",p="superInterfaces",n="getSuperMixins";qx.Class.define(x,{extend:apiviewer.dao.Node,construct:function(E,F){apiviewer.dao.Node.call(this,E);this.self(arguments).registerClass(this);this._package=F;},statics:{_class_registry:{},_top_level_classes:[],registerClass:function(G){if(!G.getFullName()){return;}this._class_registry[G.getFullName()]=G;if(!G._docNode.attributes.superClass){this._top_level_classes.push(G);}},getClassByName:function(H){return this._class_registry[H];},getAllTopLevelClasses:function(){return this._top_level_classes;}},members:{getName:function(){return this._docNode.attributes.name;},getClass:function(){return this;},getPackage:function(){return this._package;},isLoaded:function(){return this._docNode.attributes.externalRef!=true;},getFullName:function(){return this._docNode.attributes.fullName||m;},getPackageName:function(){return this._docNode.attributes.packageName||m;},getDescription:function(){return this._desc||m;},getType:function(){return this._docNode.attributes.type||u;},isAbstract:function(){return this._docNode.attributes.isAbstract||false;},isStatic:function(){return this._docNode.attributes.isStatic||false;},isSingleton:function(){return this._docNode.attributes.isSingleton||false;},getSee:function(){return this._see;},getSuperClass:function(){return this.self(arguments).getClassByName(this._docNode.attributes.superClass);},getChildClasses:function(){return this._docNode.attributes.childClasses?this._docNode.attributes.childClasses.split(k):[];},getInterfaces:function(){return this._docNode.attributes.interfaces?this._docNode.attributes.interfaces.split(k):[];},getMixins:function(){return this._docNode.attributes.mixins?this._docNode.attributes.mixins.split(k):[];},getImplementations:function(){return this._docNode.attributes.implementations?this._docNode.attributes.implementations.split(k):[];},getIncluder:function(){return this._docNode.attributes.includer?this._docNode.attributes.includer.split(k):[];},getConstructor:function(){if(this._constructor!=null){return this._constructor;}var I=apiviewer.TreeUtil.getChild(this.getNode(),h);if(I){this._constructor=new apiviewer.dao.Method(I.children[0],this,I.type);}else{this._constructor=m;var K=this.getSuperClass();while(K){var J=K.getConstructor();if(J){var I=J.getNode();this._constructor=new apiviewer.dao.Method(I,this,h);break;}K=K.getSuperClass();}}return this._constructor;},getMembers:function(){if(this._members!=null){return this._members;}else{var L=apiviewer.TreeUtil.getChild(this.getNode(),a);this._members=L?this._createNodeList(L,apiviewer.dao.Method,this,L.type):[];return this._members;}},getStatics:function(){if(this._statics!=null){return this._statics;}else{var M=apiviewer.TreeUtil.getChild(this.getNode(),z);this._statics=M?this._createNodeList(M,apiviewer.dao.Method,this,M.type):[];return this._statics;}},getEvents:function(){if(this._events!=null){return this._events;}else{var N=apiviewer.TreeUtil.getChild(this.getNode(),A);this._events=N?this._createNodeList(N,apiviewer.dao.Event,this,N.type):[];return this._events;}},getProperties:function(){if(this._properties!=null){return this._properties;}else{var O=apiviewer.TreeUtil.getChild(this.getNode(),D);this._properties=O?this._createNodeList(O,apiviewer.dao.Property,this,O.type):[];return this._properties;}},getConstants:function(){if(this._constants!=null){return this._constants;}else{var P=apiviewer.TreeUtil.getChild(this.getNode(),c);this._constants=P?this._createNodeList(P,apiviewer.dao.Constant,this,P.type):[];return this._constants;}},getAppearances:function(){if(this._appearances!=null){return this._appearances;}else{var Q=apiviewer.TreeUtil.getChild(this.getNode(),g);this._appearances=Q?this._createNodeList(Q,apiviewer.dao.Appearance,this,Q.type):[];return this._appearances;}},getSuperInterfaces:function(){return this._superInterfaces;},getSuperMixins:function(){return this._superMixins;},getChildControls:function(){return this._childControls;},getClassHierarchy:function(){var S=[];var R=this;while(R){S.push(R);R=R.getSuperClass();}return S;},getInterfaceHierarchy:function(){var W=this;var U=[W];var V=W.getSuperInterfaces();while(V&&V.length>0){for(var i=0,l=V.length;i<l;i++){var T=apiviewer.dao.Class.getClassByName(V[i].getName());U.push(T);V=T.getSuperInterfaces();}}return U;},getItem:function(X){var Y=[B,e,C,b,y,f,d];for(var i=0;i<Y.length;i++){var ba=this[Y[i]]();for(var j=0;j<ba.length;j++){if(X==ba[j].getName()){return ba[j];}}}},getItemList:function(bb){var bc={"events":C,"constructor":r,"properties":b,"methods":B,"methods-static":e,"constants":y,"appearances":f,"superInterfaces":o,"superMixins":n,"childControls":d};if(bb==h){return this.getConstructor()?[this.getConstructor()]:[];}else{return this[bc[bb]]();}},getItemByListAndName:function(bd,be){var bf=this.getItemList(bd);for(var j=0;j<bf.length;j++){if(be==bf[j].getName()){return bf[j];}}},getClassAppearance:function(){var bg=this.getAppearances();for(var i=0;i<bg.length;i++){if(bg[i].getType()==this){return bg[i];}}return null;},getAllInterfaces:function(bh){if(bh){var bk=this.getClassHierarchy();}else{bk=[this];}var bn=[];for(var bm=0;bm<bk.length;bm++){var bl=bk[bm];var bi=function(bo){var bp=apiviewer.dao.Class.getClassByName(bo);bn.push(bp);var bq=bp.getSuperInterfaces();for(var i=0;i<bq.length;i++){bi(bq[i].getName());}};var bj=bl.getInterfaces();for(var i=0;i<bj.length;i++){bi(bj[i]);}}return bn;},getNodesOfTypeFromMixins:function(br){var bu=this.getMixins();var bv=[];for(var bw=0;bw<bu.length;bw++){var bs=function(bx){var by=bx.getItemList(br);for(var i=0;i<by.length;i++){bv.push(by[i]);}var bz=bx.getSuperMixins();for(var i=0;i<bz.length;i++){bs(apiviewer.dao.Class.getClassByName(bz[i].getName()));}};var bt=apiviewer.dao.Class.getClassByName(bu[bw]);bs(bt);}return bv;},getDependendClasses:function(){return this._findClasses(this,[]);},getDocNode:function(){return this;},_findClasses:function(bA,bB){bB.push(bA);var bJ=bA.getSuperClass();if(bJ){this._findClasses(bJ,bB);}var bG=bA.getMixins();for(var i=0;i<bG.length;i++){var bK=apiviewer.dao.Class.getClassByName(bG[i]);if(bK){this._findClasses(bK,bB);}else{this.warn("Missing mixin: "+bG[i]);}}var bH=bA.getSuperMixins();for(var i=0;i<bH.length;i++){var bI=apiviewer.dao.Class.getClassByName(bH[i]);if(bI){this._findClasses(bI,bB);}else{this.warn("Missing super mixin: "+bH[i]);}}var bF=bA.getInterfaces();for(var i=0;i<bF.length;i++){var bD=apiviewer.dao.Class.getClassByName(bF[i]);if(bD){this._findClasses(bD,bB);}else{this.warn("Missing interface: "+bF[i]);}}var bE=bA.getSuperInterfaces();for(var i=0;i<bE.length;i++){var bC=apiviewer.dao.Class.getClassByName(bE[i]);if(bC){this._findClasses(bC,bB);}else{this.warn("Missing super interface: "+bE[i]);}}return bB;},_initializeFields:function(){apiviewer.dao.Node.prototype._initializeFields.call(this);this._desc=m;this._see=[];this._superInterfaces=[];this._superMixins=[];this._childControls=[];},_addChildNode:function(bL){switch(bL.type){case h:case a:case z:case A:case D:case c:case g:break;case p:this._superInterfaces=this._createNodeList(bL,apiviewer.dao.ClassItem,this,bL.type);break;case w:this._superMixins=this._createNodeList(bL,apiviewer.dao.ClassItem,this,bL.type);break;case v:this._childControls=this._createNodeList(bL,apiviewer.dao.ChildControl,this,bL.type);break;case t:this._desc=bL.attributes.text||m;break;case q:this._see.push(bL.attributes.name);break;default:return apiviewer.dao.Node.prototype._addChildNode.call(this,bL);}return true;}},destruct:function(){this._see=this._superInterfaces=this._superMixins=this._events=this._statics=this._properties=this._constants=this._appearances=this._members=this._package=null;this._disposeObjects(s);}});})();(function(){var f="",e="name",d="desc",c="see",b="types",a="apiviewer.dao.ClassItem";qx.Class.define(a,{extend:apiviewer.dao.Node,construct:function(g,h,k){this._class=h;this._listName=k;apiviewer.dao.Node.call(this,g);},members:{getClass:function(){return this._class;},getName:function(){return this._docNode.attributes.name;},getListName:function(){return this._listName;},getDescription:function(){return this.getDocNode()._desc||f;},getTypes:function(){var m=[];for(var i=0;i<this._types.length;i++){var l={};if(this._types[i].attributes.dimensions){l.dimensions=this._types[i].attributes.dimensions;}l.type=this._types[i].attributes.type;m.push(l);}return m;},getSee:function(){return this._see;},getOverriddenFrom:function(){return apiviewer.dao.Class.getClassByName(this._docNode.attributes.overriddenFrom);},getDocNode:function(){if(this._itemDocNode){return this._itemDocNode;}this._itemDocNode=this;var n=apiviewer.dao.Class.getClassByName(this._docNode.attributes.docFrom);if(n){var o=n.getItemList(this._listName);for(var i=0;i<o.length;i++){if(o[i].getName()==this.getName()){this._itemDocNode=o[i];break;}}}return this._itemDocNode;},isRequiredByInterface:function(p){var r=apiviewer.TreeUtil.getChild(p.getNode(),this._listName);if(r){var q=apiviewer.TreeUtil.getChildByAttribute(r,e,this.getName());return q?true:false;}return false;},getRequiredBy:function(){if(this._requiredBy){return this._requiredBy;}var s=[];var t=this.getClass().getAllInterfaces(true);for(var j=0;j<t.length;j++){if(this.isRequiredByInterface(t[j])){s.push(t[j]);}}this._requiredBy=s;return s;},_initializeFields:function(){apiviewer.dao.Node.prototype._initializeFields.call(this);this._see=[];this._types=[];},_addChildNode:function(u){switch(u.type){case d:this._desc=u.attributes.text||f;break;case c:this._see.push(u.attributes.name);break;case b:this._types=this._createNodeList(u);break;default:return apiviewer.dao.Node.prototype._addChildNode.call(this,u);}return true;}},destruct:function(){this._class=this._itemDocNode=this._requiredBy=this._see=this._types=null;}});})();(function(){var h="params",g="return",f="throws",e="",d="apiviewer.dao.Method",c="_return",b="construct",a="properties";qx.Class.define(d,{extend:apiviewer.dao.ClassItem,construct:function(i,j,k){apiviewer.dao.ClassItem.call(this,i,j,k);},members:{getName:function(){if(this.isConstructor()){return b;}else{return this._docNode.attributes.name;}},isStatic:function(){return this._docNode.attributes.isStatic||false;},isAbstract:function(){return this._docNode.attributes.isAbstract||false;},isConstructor:function(){return this._docNode.attributes.isCtor||false;},isFromProperty:function(){return !!this._docNode.attributes.fromProperty;},getParams:function(){if(this._params!=null){return this._params;}else{var l=apiviewer.TreeUtil.getChild(this.getDocNode().getNode(),h);this._params=l?this._createNodeList(l,apiviewer.dao.Param,this.getClass(),this):[];return this._params;}},getReturn:function(){if(this._return!=null){return this._return;}else{var m=apiviewer.TreeUtil.getChild(this.getDocNode().getNode(),g);this._return=m?new apiviewer.dao.Param(m,this.getClass(),this):e;return this._return;}},getThrows:function(){if(this._throws!=null){return this._throws;}else{var n=apiviewer.TreeUtil.getChild(this.getDocNode().getNode(),f);this._throws=n?this._createNodeList(n,apiviewer.dao.ThrowsEntry,this.getClass(),this):[];return this._throws;}},getApply:function(){return this._docNode.attributes.apply;},getFromProperty:function(){return this.getClass().getItemByListAndName(a,this._docNode.attributes.fromProperty);},_addChildNode:function(o){switch(o.type){case h:case g:case f:break;default:return apiviewer.dao.ClassItem.prototype._addChildNode.call(this,o);}return true;}},destruct:function(){this._params=this._throws=null;this._disposeObjects(c);}});})();(function(){var b="apiviewer.dao.Param",a="properties";qx.Class.define(b,{extend:apiviewer.dao.ClassItem,construct:function(c,d,e){apiviewer.dao.ClassItem.call(this,c,d);this._method=e;},members:{getTypes:function(){var i=this.getMethod().getFromProperty();if(i){if(i.isPropertyGroup()){var g=this.getClass().getItemByListAndName(a,this.getName());if(g){return g.getTypes();}}else{return i.getTypes();}}var h=apiviewer.dao.ClassItem.prototype.getTypes.call(this);var f=this._docNode.attributes;if(f.type){h.push({type:f.type,dimensions:f.dimensions});}return h;},getMethod:function(){return this._method;},getArrayDimensions:function(){return this._docNode.attributes.arrayDimensions;},getType:function(){return this._docNode.attributes.type;},getDefaultValue:function(){return this._docNode.attributes.defaultValue;}},destruct:function(){this._method=null;}});})();(function(){var b="apiviewer.dao.ThrowsEntry",a="Error";qx.Class.define(b,{extend:apiviewer.dao.ClassItem,construct:function(c,d,e){apiviewer.dao.ClassItem.call(this,c,d);},members:{getType:function(){return this._docNode.attributes.type||null;},getDefaultType:function(){return a;},getDescription:function(){return this._docNode.attributes.text;}}});})();(function(){var b="types",a="apiviewer.dao.Event";qx.Class.define(a,{extend:apiviewer.dao.ClassItem,construct:function(c,d,e){apiviewer.dao.ClassItem.call(this,c,d,e);},members:{getType:function(){return apiviewer.dao.Class.getClassByName(this._type);},getTypes:function(){if(this._type){return [{type:this._type}];}else{return null;}},_addChildNode:function(f){switch(f.type){case b:this._type=f.children[0].attributes.type;break;default:return apiviewer.dao.ClassItem.prototype._addChildNode.call(this,f);}return true;}}});})();(function(){var d=",",c="new",b="true",a="apiviewer.dao.Property";qx.Class.define(a,{extend:apiviewer.dao.ClassItem,members:{getTypes:function(){var g=apiviewer.dao.ClassItem.prototype.getTypes.call(this);var e=this.getDocNode();var f=e.getType();if(f){g.push({type:f,dimensions:e.getNode().attributes.dimensions});}return g;},getCheck:function(){var h=this.getDocNode()._docNode.attributes;if(h.check){if(!apiviewer.dao.Class.getClassByName(h.check)&&!apiviewer.ui.ClassViewer.PRIMITIVES[h.check]){return h.check;}}return null;},getClassname:function(){return this._docNode.attributes.classname;},getInstance:function(){return this._docNode.attributes.instance;},getPossibleValues:function(){var i=this._docNode.attributes.possibleValues;if(i){i=i.split(d);return i;}else{return [];}},getGroup:function(){var j=this.getDocNode()._docNode.attributes.group;if(j){return j.split(d);}return [];},isPropertyGroup:function(){return !!this.getDocNode()._docNode.attributes.group;},getType:function(){var k=this._docNode.attributes;if(k.type){return k.type;}if(k.check){if(apiviewer.dao.Class.getClassByName(k.check)||apiviewer.ui.ClassViewer.PRIMITIVES[k.check]){return k.check;}}return null;},getPropertyType:function(){return this.getDocNode()._docNode.attributes.propertyType||c;},getEvent:function(){return this.getDocNode()._docNode.attributes.event;},getApplyMethod:function(){return this.getDocNode()._docNode.attributes.apply;},isNullable:function(){return this.getDocNode()._docNode.attributes.allowNull===b;},getDefaultValue:function(){return this._docNode.attributes.defaultValue;},isInheritable:function(){return this.getDocNode()._docNode.attributes.inheritable||false;},isThemeable:function(){return this.getDocNode()._docNode.attributes.themeable||false;},isRefined:function(){return this._docNode.attributes.refine||false;}}});})();(function(){var bv="mixin",bu="",bt='</div>',bs="<h2>",br="</h2>",bq="interface",bp='',bo="constructor",bn=';',bm="events",bb='</h2>',ba="apiviewer/image/nextlevel.gif",Y='px',X='<p>',W='"',V='">',U="appearances",T='</p>',S="constants",R="This ",bC='px;height:',bD='<h2 class="warning">',bA="properties",bB=' style="',by='<div class="class-description">',bz="methods",bw="Inheritance hierarchy:",bx='</span>',bE="Implementations of this interface:",bF="childControls",bf="sub interfaces",be=";vertical-align:top",bh='" src="',bg=' title="',bj="Internal:",bi="width:18px",bl="Included mixins:",bk="margin-right:-18px;",bd="Interface",bc="apiviewer/image/cross.gif",a='/>',b=' </span>',c='<span style="display:inline-block;display:inline;padding-right:18px;position:relative;top:-2px;left:0;width:',d="superMixins",f="methods-static",g="string",h="<br />\n",k="Deprecated:",l="sub mixins",m=":",bJ='<img src="',bI='</small>',bH=" is deprecated!",bG="position:absolute;top:0px;left:0px",bN="Singleton ",bM='" class="img"',bL='"/>',bK="Direct ",bP="position:absolute;top:0px;left:0px;padding-right:18px;",bO="apiviewer/image/blank.gif",B="apiviewer/image/class18.gif",C='<span style="display:inline;position:relative;top:-2px;width:',z=" is internal!",A="px",F='<span class="type">',G="Classes including this mixin:",D='<img',E="class",x="Implemented interfaces:",y="Class",u="top",t="Object<br/>",w=", ",v="margin-left:",q="construct",p="left",s='<div>',r="child controls",o="Abstract ",n="sub classes",L="vertical-align:top",M="static methods",N="ClassViewer",O="Static ",H="apiviewer.ui.ClassViewer",I='<small>',J="Mixin",K="marked",P="apiviewer/image/vline.gif",Q="superInterfaces";qx.Class.define(H,{extend:apiviewer.ui.AbstractViewer,construct:function(){apiviewer.ui.AbstractViewer.call(this);this.addInfoPanel(new apiviewer.ui.panels.MethodPanel(bo,bo));this.addInfoPanel(new apiviewer.ui.panels.EventPanel(bm,bm,true,true));this.addInfoPanel(new apiviewer.ui.panels.PropertyPanel(bA,bA,true,true));this.addInfoPanel(new apiviewer.ui.panels.MethodPanel(bz,bz));this.addInfoPanel(new apiviewer.ui.panels.MethodPanel(f,M));this.addInfoPanel(new apiviewer.ui.panels.ConstantPanel(S,S,false,true));this.addInfoPanel(new apiviewer.ui.panels.AppearancePanel(U,U,false,true));this.addInfoPanel(new apiviewer.ui.panels.ChildControlsPanel(bF,r));this.getContentElement().setAttribute(E,N);this._init(new apiviewer.dao.Class({}));},statics:{PRIMITIVES:{"var":true,"void":true,"undefined":true,"arguments":true,"null":true,"varargs":true,"Boolean":true,"String":true,"Number":true,"Integer":true,"PositiveNumber":true,"PositiveInteger":true,"Float":true,"Double":true,"Error":true,"RegExp":true,"Object":true,"Array":true,"Map":true,"Function":true,"Date":true,"Node":true,"Element":true,"Document":true,"Window":true,"Event":true,"Class":true,"Bootstrap":true,"List":true,"Mixin":true,"Interface":true,"Theme":true,"Color":true,"Decorator":true,"Font":true},createImageHtml:function(bQ,bR,bS){if(typeof bQ==g){return bJ+qx.util.ResourceManager.getInstance().toUri(bQ)+bM+(bS?bB+bS+W:bu)+a;}else{if(bS){bS+=be;}else{bS=L;}return apiviewer.ui.ClassViewer.createOverlayImageHtml(18,18,bQ,bR,bS);}},createOverlayImageHtml:function(bT,bU,bV,bW,bX){var ca=bp;var bY;if(qx.bom.client.Engine.WEBKIT){ca=C+bT+bC+bU+Y+((bX==null)?bp:(bn+bX))+V;}else{ca=c+bT+bC+bU+Y+((bX==null)?bp:(bn+bX))+V;}if(qx.bom.client.Engine.WEBKIT){bY=bP;}else if(qx.bom.client.Engine.OPERA){bY=bk;}else{bY=bG;}for(var i=0;i<bV.length;i++){ca+=D;if(bW!=null){ca+=bg+bW+W;}ca+=bB+bY+bh+qx.util.ResourceManager.getInstance().toUri(bV[i])+bL;}ca+=bx;return ca;}},members:{_getTitleHtml:function(cb){switch(cb.getType()){case bv:var cd=J;break;case bq:var cd=bd;break;default:var cd=y;break;}var cc=new qx.util.StringBuilder();cc.add(I,cb.getPackageName(),bI);cc.add(F);if(cb.isAbstract()){cc.add(o);}else if(cb.isStatic()){cc.add(O);}else if(cb.isSingleton()){cc.add(bN);}cc.add(cd,b);cc.add(apiviewer.ui.panels.InfoPanel.setTitleClass(cb,cb.getName()));return cc.get();},_getDescriptionHtml:function(ce){switch(ce.getType()){case bv:var cf=l;break;case bq:var cf=bf;break;default:var cf=n;break;}var ch=new qx.util.StringBuilder();var ci=ce.getDescription();if(ci!=bu){ch.add(by,apiviewer.ui.panels.InfoPanel.resolveLinkAttributes(ci,ce),bt);}if(ce.getErrors().length>0){ch.add(by,apiviewer.ui.panels.InfoPanel.createErrorHtml(ce,ce),bt);}switch(ce.getType()){case bv:case bq:ch.add(this.__Sz(ce));break;default:ch.add(this.__Sy(ce));break;}ch.add(this.__Sx(ce.getChildClasses(),bK+cf+m));ch.add(this.__Sx(ce.getInterfaces(),x));ch.add(this.__Sx(ce.getMixins(),bl));ch.add(this.__Sx(ce.getImplementations(),bE));ch.add(this.__Sx(ce.getIncluder(),G));var cg=ce.getConstructor();if(cg){ch.add(apiviewer.ui.panels.InfoPanel.createSeeAlsoHtml(cg));}if(ce.isDeprecated()){ch.add(bD,k,bb);ch.add(X);var ci=ce.getDeprecationText();if(ci){ch.add(ci);}else{ch.add(R,ce.getType(),bH);}ch.add(T);}if(ce.isInternal()){ch.add(bD,bj,bb);ch.add(X);ch.add(R,ce.getType(),z);ch.add(T);}return ch.get();},__Sx:function(cj,ck){if(cj.length>0){var cl=new qx.util.StringBuilder(bs,ck,br);for(var i=0;i<cj.length;i++){if(i!=0){cl.add(w);}cl.add(apiviewer.ui.panels.InfoPanel.createItemLinkHtml(cj[i],null,true,false));}cl=cl.get();}else{cl=bu;}return cl;},__Sy:function(cm){var co=apiviewer.ui.ClassViewer;var cp=new qx.util.StringBuilder(bs,bw,br);var cq=cm.getClassHierarchy();cp.add(co.createImageHtml(B),t);var cn=0;for(var i=cq.length-1;i>=0;i--){cp.add(s);cp.add(co.createImageHtml(ba,null,v+cn+A),co.createImageHtml(apiviewer.TreeUtil.getIconUrl(cq[i])));if(i!=0){cp.add(apiviewer.ui.panels.InfoPanel.createItemLinkHtml(cq[i].getFullName(),null,false));}else{cp.add(cq[i].getFullName());}cn+=18;cp.add(bt);}return cp.get();},__Sz:function(cr){if(cr.getType()==bv){var cs=d;}else{cs=Q;}var cu=apiviewer.ui.ClassViewer;var ct=cu.createImageHtml(bO,null,bi);var cw=function(cx,cy){var cA=[];for(var cz=0;cz<cx.length;cz++){var cD=new qx.util.StringBuilder();var cB=cx[cz];if(!cy){if(cz==cx.length-1){cD.add(cu.createImageHtml(ba));}else{cD.add(cu.createImageHtml(bc));}}else{if(!cy){cD.add(ct);}}cD.add(cu.createImageHtml(apiviewer.TreeUtil.getIconUrl(cB)));if(!cy){cD.add(apiviewer.ui.panels.InfoPanel.createItemLinkHtml(cB.getFullName(),null,false));}else{cD.add(cB.getFullName());}cA.push(cD.get());var cC=qx.lang.Array.clone(cB.getItemList(cs));for(var j=0;j<cC.length;j++){cC[j]=apiviewer.dao.Class.getClassByName(cC[j].getName());}if(cC.length>0){var cE=cw(cC);for(var i=0;i<cE.length;i++){if(cz==cx.length-1){if(cy){cA.push(cE[i]);}else{cA.push(ct+cE[i]);}}else{cA.push(cu.createImageHtml(P)+cE[i]);}}}}return cA;};var cv=new qx.util.StringBuilder();if(cr.getItemList(cs).length>0){cv.add(bs,bw,br);cv.add(cw([cr],true).join(h));}return cv.get();},showItem:function(cF){var cI;if(cF==q){cI=this.getDocNode().getConstructor();}else{cI=this.getDocNode().getItem(cF);}if(!cI){return false;}this.__SA(cI,cF);var cJ=this._getPanelForItemNode(cI);var cG=cJ.getItemElement(cI.getName());if(!cG){return false;}var cH=cG.parentNode.parentNode;if(this._markedElement){this._markedElement.className=bu;}cH.className=K;this._markedElement=cH;qx.event.Timer.once(function(e){qx.bom.element.Scroll.intoView(cH,null,p,u);},this,0);return true;},__SA:function(cK,cL){var cM=apiviewer.UiModel.getInstance();if(cK.isFromProperty&&cK.isFromProperty()){cM.setExpandProperties(true);if(cK.isProtected()){cM.setShowProtected(true);}if(cK.isPrivate()){cM.setShowPrivate(true);}}else if(cK.getListName()=="methods"){if(cL.indexOf("__")===0){cM.setShowPrivate(true);}else if(cL.indexOf("_")===0){cM.setShowProtected(true);}}},_getPanelForItemNode:function(cN){var cO=this.getPanels();for(var i=0;i<cO.length;i++){var cP=cO[i];if(cP.canDisplayItem(cN)){return cP;}}}},destruct:function(){this._titleElem=this._classDescElem=this._markedElement=null;}});})();(function(){var c="apiviewer.ui.panels.EventPanel",b="var",a="event";qx.Class.define(c,{extend:apiviewer.ui.panels.InfoPanel,members:{itemHasDetails:function(d,e){return (d.getClass()!=e||d.getSee().length>0||d.getErrors().length>0||apiviewer.ui.panels.InfoPanel.descriptionHasDetails(d));},getItemTypeHtml:function(f){return apiviewer.ui.panels.InfoPanel.createTypeHtml(f,b);},getItemTitleHtml:function(g){return apiviewer.ui.panels.InfoPanel.setTitleClass(g,g.getName());},getItemTextHtml:function(h,i,j){var k=new qx.util.StringBuilder(apiviewer.ui.panels.InfoPanel.createDescriptionHtml(h,h.getClass(),j));if(j){k.add(apiviewer.ui.panels.InfoPanel.createInheritedFromHtml(h,i));k.add(apiviewer.ui.panels.InfoPanel.createSeeAlsoHtml(h));k.add(apiviewer.ui.panels.InfoPanel.createErrorHtml(h,i));k.add(apiviewer.ui.panels.InfoPanel.createDeprecationHtml(h,a));}return k.get();}}});})();(function(){var j='</div>',i='<div class="item-detail-headline">',h='<div class="item-detail-text">',g="#",f="null",e="instances of ",d="apiviewer.ui.panels.PropertyPanel",c='<div class="javascript">',b="var",a="Apply method:",v="property",u="Check:",t="Allowed values:",s='</code>',r="</code>",q="any ",p="Init value:",o='<code>',n="<code>",m="</code>, <code>",k="Change event:",l=" or sub classes";qx.Class.define(d,{extend:apiviewer.ui.panels.InfoPanel,members:{__SB:function(w,x){if(w.isRefined()){return "";}if(w.isPrivate()){var y="__";var name=w.getName().substring(2);}else if(w.isProtected()){y="_";name=w.getName().substring(1);}else{y="";name=w.getName();}name=qx.lang.String.firstUp(name);var A=[];if(w.getPropertyType()=="fast"){A.push("{@link #"+y+"get"+name+"}</td><td> Get the property value.");}else{A.push("{@link #"+y+"set"+name+"}</td><td> Set the property value.");if(!w.isPropertyGroup()){A.push("{@link #"+y+"get"+name+"}</td><td> Get the property value.");A.push("{@link #"+y+"init"+name+"}</td><td> Call apply method with the init value.");}A.push("{@link #"+y+"reset"+name+"}</td><td> Reset the property value.");if(w.getType()=="Boolean"){A.push("{@link #"+y+"toggle"+name+"}</td><td> Toggle the property value.");A.push("{@link #"+y+"is"+name+"}</td><td> Check whether the property equals <code>true</code>.");}}var z=new qx.util.StringBuilder();z.add('<div class="item-detail-headline">',"Generated methods:",'</div>','<div class="item-detail-text">');z.add("<table><tr><td>");z.add(A.join("</td></tr><tr><td>"));z.add("</td></tr></table>");z.add('</div>');return apiviewer.ui.panels.InfoPanel.resolveLinkAttributes(z.get(),x);},__SC:function(B){var C=[];if(B.isNullable()){C.push("This property allows 'null' values");}if(B.isInheritable()){C.push("The property value can be inherited from a parent object.");}if(B.isThemeable()){C.push("The property value can be set using appearance themes.");}if(B.isPropertyGroup()){C.push("The property is a property group.");}if(B.isRefined()){C.push("The property refines the init value of an existing property.");}if(C.length>0){var D=new qx.util.StringBuilder();D.add('<div class="item-detail-headline">',"Property attributes:",'</div>','<div class="item-detail-text">');D.add("<ul><li>");D.add(C.join("</li><li>"));D.add("</li></ul>");D.add('</div>');return D.get();}else{return "";}},__SD:function(E){if(E.isRefined()){var F=new qx.util.StringBuilder('<div class="item-detail-headline">',"Refined property:",'</div>','<div class="item-detail-text">',apiviewer.ui.panels.InfoPanel.createItemLinkHtml(E.getOverriddenFrom().getFullName()+"#"+E.getName()),'</div>');return F.get();}else{return "";}},getItemTypeHtml:function(G){return apiviewer.ui.panels.InfoPanel.createTypeHtml(G,b);},getItemTitleHtml:function(H){return apiviewer.ui.panels.InfoPanel.setTitleClass(H,H.getName());},getItemTextHtml:function(I,J,K){var L=I.getDocNode();var N=new qx.util.StringBuilder(apiviewer.ui.panels.InfoPanel.createDescriptionHtml(I,I.getClass(),K));if(K){var O=null;var M=qx.lang.Array.clone(I.getPossibleValues());if(M.length>0){if(I.isNullable()){M.push(f);}O=n+M.join(m)+r;}else if(I.getClassname()){O=e+I.getClassname();}else if(I.getInstance()){O=e+I.getInstance()+l;}else if(I.getType()){O=q+I.getType();}if(O){N.add(i,t,j,h);N.add(O,j);}if(I.getCheck()){N.add(i,u,j,c,qx.dev.Tokenizer.javaScriptToHtml(I.getCheck()),j);}if(!I.isPropertyGroup()){N.add(i,p,j,h,o,(I.getDefaultValue()?I.getDefaultValue():f),s,j);}if(I.getEvent()&&!I.isRefined()){N.add(i,k,j,h,apiviewer.ui.panels.InfoPanel.createItemLinkHtml(g+I.getEvent(),I.getClass(),true,true),j);}if(I.getApplyMethod()&&!I.isRefined()){N.add(i,a,j,h,apiviewer.ui.panels.InfoPanel.createItemLinkHtml(g+I.getApplyMethod(),I.getClass(),true,true),j);}N.add(this.__SC(I));N.add(this.__SB(I,J));N.add(apiviewer.ui.panels.InfoPanel.createIncludedFromHtml(I,J));N.add(this.__SD(I));N.add(apiviewer.ui.panels.InfoPanel.createInheritedFromHtml(I,J));N.add(apiviewer.ui.panels.InfoPanel.createInfoRequiredByHtml(I));N.add(apiviewer.ui.panels.InfoPanel.createSeeAlsoHtml(L));N.add(apiviewer.ui.panels.InfoPanel.createErrorHtml(I,J));N.add(apiviewer.ui.panels.InfoPanel.createDeprecationHtml(L,v));}return N.get();}}});})();(function(){var c="apiviewer.ui.panels.ConstantPanel",b="var",a="constant";qx.Class.define(c,{extend:apiviewer.ui.panels.InfoPanel,members:{itemHasDetails:function(d,e){return (d.getSee().length>0||d.getErrors().length>0||apiviewer.ui.panels.InfoPanel.descriptionHasDetails(d)||this.__SE(d));},getItemTypeHtml:function(f){return apiviewer.ui.panels.InfoPanel.createTypeHtml(f,b);},getItemTitleHtml:function(g){return apiviewer.ui.panels.InfoPanel.setTitleClass(g,g.getName());},getItemTextHtml:function(h,i,j){var k=apiviewer.ui.panels.InfoPanel.createDescriptionHtml(h,h.getClass(),j);if(j){k+=this.__SF(h);k+=apiviewer.ui.panels.InfoPanel.createSeeAlsoHtml(h);k+=apiviewer.ui.panels.InfoPanel.createErrorHtml(h,i);k+=apiviewer.ui.panels.InfoPanel.createDeprecationHtml(h,a);}return k;},__SE:function(l){return l.getValue()?true:false;},__SF:function(m){if(this.__SE(m)){var n=new qx.util.StringBuilder('<div class="item-detail-headline">',"Value: ",'</div>','<div class="item-detail-text">',qx.bom.String.escape(qx.util.Json.stringify(m.getValue())),'</div>');return n.get();}else{return "";}}}});})();(function(){var m='</div>',l=" <span class='item-detail-define'>defined by ",k=" (default appearance of the class)",j="</p></div>",h="</span>: ",g='<div class="item-desc">',f=" ",e="apiviewer.ui.panels.AppearancePanel",d='<div class="item-detail-headline">',c="</code><p>",a="<div class='item-detail-text'><code>",b="States:";qx.Class.define(e,{extend:apiviewer.ui.panels.InfoPanel,members:{__SG:function(n){var r=n.getStates();if(r.length>0){var t=qx.lang.Array.clone(r);}else{t=[];}var u=n.getType();var v=n.getClass();var s=1;if(u!=v){v=u;s=0;}var q=v.getClassHierarchy();for(var i=s;i<q.length;i++){v=q[i];var o=v.getClassAppearance();if(o){var p=o.getStates();if(p){qx.lang.Array.append(t,p);}}}return t;},_getPanelItems:function(w,x){var z=apiviewer.ui.panels.InfoPanel.prototype._getPanelItems.call(this,w,x);if(!w){return z;}var A=x.getClassHierarchy();for(var i=0;i<A.length;i++){var B=A[i];var y=B.getClassAppearance();if(y){if(y.getType()!=x){z.push(y);}return z;}}},getItemTypeHtml:function(C){var E=C.getName();if(C.getType()==C.getClass()){var D=E+k;}else{var D=E;}return D;},getItemTitleHtml:function(F){return apiviewer.ui.panels.InfoPanel.setTitleClass(F,F.getName());},getItemTextHtml:function(G,H,I){var M=new qx.util.StringBuilder();M.add(g,apiviewer.ui.panels.InfoPanel.createDescriptionHtml(G,G.getClass(),true),m);if(I){var K=this.__SG(G);if(K.length>0){M.add(d,b,m);for(var i=0;i<K.length;i++){var L=K[i];M.add(a,L.getName(),c);var J=L.getAppearance();if(J.getType()!=G.getClass()){M.add(l,apiviewer.ui.panels.InfoPanel.createItemLinkHtml(J.getType().getFullName()),h);}var N=L.getDescription();if(N){M.add(f,apiviewer.ui.panels.InfoPanel.resolveLinkAttributes(N,L.getClass()));}M.add(j);}M.add(m);}}return M.get();},itemHasDetails:function(O,P){return this.__SG(O).length>0;}}});})();(function(){var i='</div>',h="apiviewer.ui.panels.ChildControlsPanel",g="null",f="var",e='<div class="item-detail-headline">',d='</code>',c='<code>',b="Default value:",a='<div class="item-detail-text">';qx.Class.define(h,{extend:apiviewer.ui.panels.InfoPanel,members:{getItemTypeHtml:function(j,k){return apiviewer.ui.panels.InfoPanel.createTypeHtml(j,f,true);},getItemTitleHtml:function(l,m){return apiviewer.ui.panels.InfoPanel.setTitleClass(l,l.getName());},getItemTextHtml:function(n,o,p){var q=new qx.util.StringBuilder(n.getDescription());if(p){q.add(e,b,i,a,c,(n.getDefaultValue()?n.getDefaultValue():g),d,i);}return q.get();}}});})();(function(){var a="apiviewer.dao.Constant";qx.Class.define(a,{extend:apiviewer.dao.ClassItem,construct:function(b,c,d){apiviewer.dao.ClassItem.call(this,b,c,d);},members:{getValue:function(){return this._docNode.attributes.value;}}});})();(function(){var b="states",a="apiviewer.dao.Appearance";qx.Class.define(a,{extend:apiviewer.dao.ClassItem,construct:function(c,d,e){apiviewer.dao.ClassItem.call(this,c,d,e);},members:{getType:function(){return apiviewer.dao.Class.getClassByName(this._docNode.attributes.type);},getTypes:function(){return [{type:this._docNode.attributes.type}];},getAppearance:function(){return this.getClass();},getStates:function(){return this._states||[];},_addChildNode:function(f){switch(f.type){case b:this._states=this._createNodeList(f,apiviewer.dao.State,this);break;default:return apiviewer.dao.ClassItem.prototype._addChildNode.call(this,f);}return true;}}});})();(function(){var a="apiviewer.dao.State";qx.Class.define(a,{extend:apiviewer.dao.ClassItem,construct:function(b,parent){apiviewer.dao.ClassItem.call(this,b,parent);},members:{getClass:function(){return this._class.getClass();},getAppearance:function(){return this._class;}}});})();(function(){var a="apiviewer.dao.ChildControl";qx.Class.define(a,{extend:apiviewer.dao.ClassItem,construct:function(b,c,d){apiviewer.dao.ClassItem.call(this,b,c);this._listName=d;},members:{getTypes:function(){var f=apiviewer.dao.ClassItem.prototype.getTypes.call(this);var e=this._docNode.attributes;if(e.type){f.push({type:e.type});}return f;},getType:function(){return this._docNode.attributes.type;},getDefaultValue:function(){return this._docNode.attributes.defaultValue;}}});})();(function(){var n="class",m="interface",l="mixin",k="list",j="",h="apiviewer.ui.panels.ClassPanel",g="Singleton ",f="Abstract ",e="bootstrap",d="Static ",a="Class",c="Interface",b="Mixin";qx.Class.define(h,{extend:apiviewer.ui.panels.InfoPanel,construct:function(o,p,q){apiviewer.ui.panels.InfoPanel.call(this,o,p);this.setType(q);},properties:{type:{check:[n,l,m]}},members:{getItemTypeHtml:function(r){return apiviewer.ui.panels.InfoPanel.createItemLinkHtml(r.getName(),r,false,true);},getItemTitleHtml:function(s){return s.getFullName();},getItemTextHtml:function(t,u,v){if(v){return apiviewer.ui.panels.InfoPanel.resolveLinkAttributes(t.getDescription(),t);}else{return apiviewer.ui.panels.InfoPanel.createDescriptionHtml(t,t.getClass(),v);}},getItemTooltip:function(w,x){if(w.isAbstract()){var y=f;}else if(w.isStatic()){var y=d;}else if(w.isSingleton()){var y=g;}else{var y=j;}switch(w.getType()){case l:y+=b;break;case m:y+=c;break;default:y+=a;break;}return y;},itemHasDetails:function(z,A){return apiviewer.ui.panels.InfoPanel.descriptionHasDetails(z);},update:function(B,C){if(!this.getElement()){return;}this.setDocNode(C);var E=C.getClasses();var D=[];var F;for(var i=0;i<E.length;i++){F=E[i].getType();if(F===e||F===k){F=n;}if(F===this.getType()){D.push(E[i]);}}if(D&&D.length>0){this._sortItems(D);}this._displayNodes(D,C);}}});})();(function(){var b="Package",a="apiviewer.ui.panels.PackagePanel";qx.Class.define(a,{extend:apiviewer.ui.panels.InfoPanel,members:{getItemTypeHtml:function(c){return apiviewer.ui.panels.InfoPanel.createItemLinkHtml(c.getFullName(),null,false,true);},getItemTitleHtml:function(d){return d.getFullName();},getItemTextHtml:function(e,f,g){if(g){return apiviewer.ui.panels.InfoPanel.resolveLinkAttributes(e.getDescription(),e);}else{return apiviewer.ui.panels.InfoPanel.createDescriptionHtml(e,e.getPackage(),g);}},getItemTooltip:function(h,i){return b;},itemHasDetails:function(j,k){return apiviewer.ui.panels.InfoPanel.descriptionHasDetails(j);},update:function(l,m){if(!this.getElement()){return;}this.setDocNode(m);var n=m.getPackages();if(n&&n.length>0){this._sortItems(n);}this._displayNodes(n,m);}}});})();(function(){var a="apiviewer.ui.tabview.ClassPage";qx.Class.define(a,{extend:apiviewer.ui.tabview.AbstractPage,members:{_createViewer:function(){return new apiviewer.ui.ClassViewer();}}});})();(function(){var m="value",l="separator-vertical",k="_tabView",j="qooxdoo",h="_packageViewer",g="_searchView",f="_tree",d="_detailLoader",c="apiviewer.Viewer",b="_classViewer",a="tree";qx.Class.define(c,{extend:qx.ui.container.Composite,construct:function(){qx.ui.container.Composite.call(this);this.__SH={};var p=new qx.ui.layout.VBox;p.setSeparator(l);this.setLayout(p);this.add(this.__SQ());this.add(this.__SM());var n=new apiviewer.ui.PackageTree();n.setId(a);this._searchView=new apiviewer.ui.SearchView();var q=new apiviewer.ui.LegendView();var r=this.__SL(n,this._searchView,q);var o=this.__SN();this.add(this.__SP(r,o),{flex:1});},members:{__SI:null,__SJ:null,__SH:null,__SK:null,__SL:function(s,t,u){var v=new qx.ui.container.Stack;v.setAppearance("toggleview");v.add(s);v.add(t);v.add(u);this.__SK.addListener("changeSelection",function(e){var w=e.getData()[0];var x=w!=null?w.getUserData("value"):null;switch(x){case "packages":v.setSelection([s]);v.show();break;case "search":v.setSelection([t]);v.show();qx.lang.Function.delay(this._onShowSearch,100,this);break;case "legend":v.setSelection([u]);v.show();break;default:v.exclude();}},this);return v;},__SM:function(){var toolbar=new qx.ui.toolbar.ToolBar;var B=new qx.ui.toolbar.Part;toolbar.add(B);this.__SI=B.toHashCode();var E=new qx.ui.toolbar.RadioButton(this.tr("Content"),"icon/22/apps/utilities-dictionary.png");E.setUserData("value","packages");E.setValue(true);E.setToolTipText(this.tr("Show/hide the packages."));B.add(E);var H=new qx.ui.toolbar.RadioButton(this.tr("Search"),"icon/22/actions/edit-find.png");H.setUserData("value","search");H.setToolTipText(this.tr("Search for packages, classes and members."));B.add(H);var y=new qx.ui.toolbar.RadioButton(this.tr("Legend"),"icon/22/apps/utilities-help.png");y.setUserData("value","legend");y.setToolTipText(this.tr("Show/hide the legend."));B.add(y);var z=new qx.ui.form.RadioGroup(E,H,y);z.setAllowEmptySelection(true);this.__SK=z;toolbar.addSpacer();var B=new qx.ui.toolbar.Part;toolbar.add(B);var F=new qx.ui.toolbar.CheckBox(this.tr("Properties"),"apiviewer/image/property18.gif");F.setId("btn_expand");F.setValue(true);F.setToolTipText(this.tr("Show/hide all generated property methods."));B.add(F);var D=new qx.ui.toolbar.CheckBox(this.tr("Inherited"),"apiviewer/image/method_public_inherited18.gif");D.setId("btn_inherited");D.setToolTipText(this.tr("Show/hide inherited members of the current class."));B.add(D);var A=new qx.ui.toolbar.CheckBox(this.tr("Protected"),"apiviewer/image/method_protected18.gif");A.setId("btn_protected");A.setToolTipText(this.tr("Show/hide protected members of the current class."));B.add(A);var G=new qx.ui.toolbar.CheckBox(this.tr("Private"),"apiviewer/image/method_private18.gif");G.setId("btn_private");G.setToolTipText(this.tr("Show/hide private members of the current class."));B.add(G);toolbar.setOverflowHandling(true);var C=new qx.ui.toolbar.MenuButton(null,"icon/22/actions/media-seek-forward.png");C.setAppearance("toolbar-button");toolbar.add(C);toolbar.setOverflowIndicator(C);this.__SJ=new qx.ui.menu.Menu();C.setMenu(this.__SJ);toolbar.addListener("hideItem",function(e){var I=e.getData();var J=this._getMenuItems(I);for(var i=0;i<J.length;i++){J[i].setVisibility("visible");}},this);toolbar.addListener("showItem",function(e){var K=e.getData();var L=this._getMenuItems(K);for(var i=0;i<L.length;i++){L[i].setVisibility("excluded");}},this);return toolbar;},_getMenuItems:function(M){var O=M.getChildren();var P=[];if(M.toHashCode()===this.__SI){var N=this.__SH[M.toHashCode()];if(!N){N=new qx.ui.menu.Separator();this.__SJ.addAt(N,0);this.__SH[M.toHashCode()]=N;}P.push(N);}for(var i=O.length-1;i>=0;i--){var Q=O[i];N=this.__SH[Q.toHashCode()];if(!N){if(Q instanceof qx.ui.toolbar.RadioButton){var N=new qx.ui.menu.RadioButton(Q.getLabel());}else{N=new qx.ui.menu.CheckBox(Q.getLabel());}Q.bind(m,N,m);N.bind(m,Q,m);this.__SJ.addAt(N,0);this.__SH[Q.toHashCode()]=N;}P.push(N);}return P;},__SN:function(){var R=new qx.ui.container.Composite(new qx.ui.layout.Canvas);R.getContentElement().setAttribute("class","content");this._detailLoader=new qx.ui.embed.Html('<div style="padding:10px;"><h1><small>please wait</small>Loading data...</h1></div>');this._detailLoader.getContentElement().setAttribute("id","SplashScreen");this._detailLoader.setAppearance("detailviewer");this._detailLoader.setId("detail_loader");R.add(this._detailLoader,{edge:0});this._tabView=new qx.ui.tabview.TabView();this._tabView.setId("tabView");this._tabView.exclude();R.add(this._tabView,{edge:0});return R;},__SO:function(toolbar,S){var T=new qx.ui.container.Composite;T.setLayout(new qx.ui.layout.VBox);T.add(toolbar);T.add(S,{flex:1});return T;},__SP:function(U,V){var W=new qx.ui.splitpane.Pane("horizontal");W.add(U,0);W.add(V,1);return W;},__SQ:function(){var ba=new qx.ui.layout.HBox();var X=new qx.ui.container.Composite(ba);X.setAppearance("app-header");var bb=new qx.ui.basic.Label("API Documentation");var Y=new qx.ui.basic.Label("qooxdoo "+qx.core.Setting.get("qx.version"));X.add(bb);X.add(new qx.ui.core.Spacer,{flex:1});X.add(Y);return X;},_onShowSearch:function(){this._searchView.sinput.focus();}},settings:{"apiviewer.title":j,"apiviewer.initialTreeDepth":1},destruct:function(){this._classTreeNodeHash=this.__SK=null;this._disposeObjects(f,d,b,h,g,k);}});})();(function(){var n="_applyLayoutChange",m="top",k="left",j="middle",h="Decorator",g="center",f="_applyReversed",e="bottom",d="qx.ui.layout.VBox",c="Integer",a="right",b="Boolean";qx.Class.define(d,{extend:qx.ui.layout.Abstract,construct:function(o,p,q){qx.ui.layout.Abstract.call(this);if(o){this.setSpacing(o);}if(p){this.setAlignY(p);}if(q){this.setSeparator(q);}},properties:{alignY:{check:[m,j,e],init:m,apply:n},alignX:{check:[k,g,a],init:k,apply:n},spacing:{check:c,init:0,apply:n},separator:{check:h,nullable:true,apply:n},reversed:{check:b,init:false,apply:f}},members:{__eS:null,__eT:null,__eU:null,__eV:null,_applyReversed:function(){this._invalidChildrenCache=true;this._applyLayoutChange();},__eW:function(){var w=this._getLayoutChildren();var length=w.length;var s=false;var r=this.__eS&&this.__eS.length!=length&&this.__eT&&this.__eS;var u;var t=r?this.__eS:new Array(length);var v=r?this.__eT:new Array(length);if(this.getReversed()){w=w.concat().reverse();}for(var i=0;i<length;i++){u=w[i].getLayoutProperties();if(u.height!=null){t[i]=parseFloat(u.height)/100;}if(u.flex!=null){v[i]=u.flex;s=true;}else{v[i]=0;}}if(!r){this.__eS=t;this.__eT=v;}this.__eU=s;this.__eV=w;delete this._invalidChildrenCache;},verifyLayoutProperty:null,renderLayout:function(x,y){if(this._invalidChildrenCache){this.__eW();}var F=this.__eV;var length=F.length;var P=qx.ui.layout.Util;var O=this.getSpacing();var S=this.getSeparator();if(S){var C=P.computeVerticalSeparatorGaps(F,O,S);}else{var C=P.computeVerticalGaps(F,O,true);}var i,A,B,J;var K=[];var Q=C;for(i=0;i<length;i+=1){J=this.__eS[i];B=J!=null?Math.floor((y-C)*J):F[i].getSizeHint().height;K.push(B);Q+=B;}if(this.__eU&&Q!=y){var H={};var N,R;for(i=0;i<length;i+=1){N=this.__eT[i];if(N>0){G=F[i].getSizeHint();H[i]={min:G.minHeight,value:K[i],max:G.maxHeight,flex:N};}}var D=P.computeFlexOffsets(H,y,Q);for(i in D){R=D[i].offset;K[i]+=R;Q+=R;}}var top=F[0].getMarginTop();if(Q<y&&this.getAlignY()!=m){top=y-Q;if(this.getAlignY()===j){top=Math.round(top/2);}}var G,U,L,B,I,M,E;this._clearSeparators();if(S){var T=qx.theme.manager.Decoration.getInstance().resolve(S).getInsets();var z=T.top+T.bottom;}for(i=0;i<length;i+=1){A=F[i];B=K[i];G=A.getSizeHint();M=A.getMarginLeft();E=A.getMarginRight();L=Math.max(G.minWidth,Math.min(x-M-E,G.maxWidth));U=P.computeHorizontalAlignOffset(A.getAlignX()||this.getAlignX(),L,x,M,E);if(i>0){if(S){top+=I+O;this._renderSeparator(S,{top:top,left:0,height:z,width:x});top+=z+O+A.getMarginTop();}else{top+=P.collapseMargins(O,I,A.getMarginTop());}}A.renderLayout(U,top,L,B);top+=B;I=A.getMarginBottom();}},_computeSizeHint:function(){if(this._invalidChildrenCache){this.__eW();}var bc=qx.ui.layout.Util;var bk=this.__eV;var X=0,bb=0,ba=0;var V=0,bd=0;var bh,W,bj;for(var i=0,l=bk.length;i<l;i+=1){bh=bk[i];W=bh.getSizeHint();bb+=W.height;var bg=this.__eT[i];var Y=this.__eS[i];if(bg){X+=W.minHeight;}else if(Y){ba=Math.max(ba,Math.round(W.minHeight/Y));}else{X+=W.height;}bj=bh.getMarginLeft()+bh.getMarginRight();if((W.width+bj)>bd){bd=W.width+bj;}if((W.minWidth+bj)>V){V=W.minWidth+bj;}}X+=ba;var bf=this.getSpacing();var bi=this.getSeparator();if(bi){var be=bc.computeVerticalSeparatorGaps(bk,bf,bi);}else{var be=bc.computeVerticalGaps(bk,bf,true);}return {minHeight:X+be,height:bb+be,minWidth:V,width:bd};}},destruct:function(){this.__eS=this.__eT=this.__eV=null;}});})();(function(){var b="qx.nativeScrollBars",a="qx.ui.core.scroll.MScrollBarFactory";qx.core.Setting.define(b,false);qx.Mixin.define(a,{members:{_createScrollBar:function(c){if(qx.core.Setting.get(b)){return new qx.ui.core.scroll.NativeScrollBar(c);}else{return new qx.ui.core.scroll.ScrollBar(c);}}}});})();(function(){var k="scrollbar-y",j="scrollbar-x",i="pane",h="auto",g="corner",f="scrollbar-",d="on",c="_computeScrollbars",b="getDocument",a="changeVisibility",D="off",C="x",B="scroll",A="touchmove",z="scrollY",y="Left",x="mousewheel",w="scrollbarX",v="scrollarea",u="y",r="vertical",s="scrollX",p="touchstart",q="horizontal",n="qx.ui.core.scroll.AbstractScrollArea",o="abstract",l="update",m="scrollbarY",t="Top";qx.Class.define(n,{extend:qx.ui.core.Widget,include:qx.ui.core.scroll.MScrollBarFactory,type:o,construct:function(){qx.ui.core.Widget.call(this);var E=new qx.ui.layout.Grid();E.setColumnFlex(0,1);E.setRowFlex(0,1);this._setLayout(E);this.addListener(x,this._onMouseWheel,this);if(qx.bom.client.Feature.TOUCH){this.addListener(A,this._onTouchMove,this);this.addListener(p,function(){this.__qP={"x":0,"y":0};},this);this.__qP={};this.__qQ={};}},properties:{appearance:{refine:true,init:v},width:{refine:true,init:100},height:{refine:true,init:200},scrollbarX:{check:[h,d,D],init:h,themeable:true,apply:c},scrollbarY:{check:[h,d,D],init:h,themeable:true,apply:c},scrollbar:{group:[w,m]}},members:{__qP:null,__qQ:null,_createChildControlImpl:function(F,G){var H;switch(F){case i:H=new qx.ui.core.scroll.ScrollPane();H.addListener(l,this._computeScrollbars,this);H.addListener(s,this._onScrollPaneX,this);H.addListener(z,this._onScrollPaneY,this);this._add(H,{row:0,column:0});break;case j:H=this._createScrollBar(q);H.setMinWidth(0);H.exclude();H.addListener(B,this._onScrollBarX,this);H.addListener(a,this._onChangeScrollbarXVisibility,this);this._add(H,{row:1,column:0});break;case k:H=this._createScrollBar(r);H.setMinHeight(0);H.exclude();H.addListener(B,this._onScrollBarY,this);H.addListener(a,this._onChangeScrollbarYVisibility,this);this._add(H,{row:0,column:1});break;case g:H=new qx.ui.core.Widget();H.setWidth(0);H.setHeight(0);H.exclude();this._add(H,{row:1,column:1});break;}return H||qx.ui.core.Widget.prototype._createChildControlImpl.call(this,F);},getPaneSize:function(){return this.getChildControl(i).getInnerSize();},getItemTop:function(I){return this.getChildControl(i).getItemTop(I);},getItemBottom:function(J){return this.getChildControl(i).getItemBottom(J);},getItemLeft:function(K){return this.getChildControl(i).getItemLeft(K);},getItemRight:function(L){return this.getChildControl(i).getItemRight(L);},scrollToX:function(M){qx.ui.core.queue.Manager.flush();this.getChildControl(j).scrollTo(M);},scrollByX:function(N){qx.ui.core.queue.Manager.flush();this.getChildControl(j).scrollBy(N);},getScrollX:function(){var O=this.getChildControl(j,true);return O?O.getPosition():0;},scrollToY:function(P){qx.ui.core.queue.Manager.flush();this.getChildControl(k).scrollTo(P);},scrollByY:function(Q){qx.ui.core.queue.Manager.flush();this.getChildControl(k).scrollBy(Q);},getScrollY:function(){var R=this.getChildControl(k,true);return R?R.getPosition():0;},_onScrollBarX:function(e){this.getChildControl(i).scrollToX(e.getData());},_onScrollBarY:function(e){this.getChildControl(i).scrollToY(e.getData());},_onScrollPaneX:function(e){this.scrollToX(e.getData());},_onScrollPaneY:function(e){this.scrollToY(e.getData());},_onMouseWheel:function(e){var T=this._isChildControlVisible(j);var U=this._isChildControlVisible(k);var S=(U)?this.getChildControl(k,true):(T?this.getChildControl(j,true):null);if(S){S.scrollBySteps(e.getWheelDelta());e.stop();}},_onTouchMove:function(e){this._onTouchMoveDirectional(C,e);this._onTouchMoveDirectional(u,e);e.stop();},_onTouchMoveDirectional:function(V,e){var W=(V==C?y:t);var Y=this.getChildControl(f+V,true);var ba=this._isChildControlVisible(f+V);if(ba&&Y){if(this.__qP[V]==0){var X=0;}else{var X=-(e[b+W]()-this.__qP[V]);}this.__qP[V]=e[b+W]();Y.scrollBy(X);if(this.__qQ[V]){clearTimeout(this.__qQ[V]);this.__qQ[V]=null;}this.__qQ[V]=setTimeout(qx.lang.Function.bind(function(bb){this.__qR(bb,V);},this,X),100);}},__qR:function(bc,bd){this.__qQ[bd]=null;var bf=this._isChildControlVisible(f+bd);if(bc==0||!bf){return;}if(bc>0){bc=Math.max(0,bc-3);}else{bc=Math.min(0,bc+3);}this.__qQ[bd]=setTimeout(qx.lang.Function.bind(function(bg,bh){this.__qR(bg,bh);},this,bc,bd),20);var be=this.getChildControl(f+bd,true);be.scrollBy(bc);},_onChangeScrollbarXVisibility:function(e){var bi=this._isChildControlVisible(j);var bj=this._isChildControlVisible(k);if(!bi){this.scrollToX(0);}bi&&bj?this._showChildControl(g):this._excludeChildControl(g);},_onChangeScrollbarYVisibility:function(e){var bk=this._isChildControlVisible(j);var bl=this._isChildControlVisible(k);if(!bl){this.scrollToY(0);}bk&&bl?this._showChildControl(g):this._excludeChildControl(g);},_computeScrollbars:function(){var bs=this.getChildControl(i);var content=bs.getChildren()[0];if(!content){this._excludeChildControl(j);this._excludeChildControl(k);return;}var bm=this.getInnerSize();var br=bs.getInnerSize();var bp=bs.getScrollSize();if(!br||!bp){return;}var bt=this.getScrollbarX();var bu=this.getScrollbarY();if(bt===h&&bu===h){var bq=bp.width>bm.width;var bv=bp.height>bm.height;if((bq||bv)&&!(bq&&bv)){if(bq){bv=bp.height>br.height;}else if(bv){bq=bp.width>br.width;}}}else{var bq=bt===d;var bv=bu===d;if(bp.width>(bq?br.width:bm.width)&&bt===h){bq=true;}if(bp.height>(bq?br.height:bm.height)&&bu===h){bv=true;}}if(bq){var bo=this.getChildControl(j);bo.show();bo.setMaximum(Math.max(0,bp.width-br.width));bo.setKnobFactor((bp.width===0)?0:br.width/bp.width);}else{this._excludeChildControl(j);}if(bv){var bn=this.getChildControl(k);bn.show();bn.setMaximum(Math.max(0,bp.height-br.height));bn.setKnobFactor((bp.height===0)?0:br.height/bp.height);}else{this._excludeChildControl(k);}}}});})();(function(){var p="Integer",o="_applyContentPadding",n="resetPaddingRight",m="setPaddingBottom",l="resetPaddingTop",k="qx.ui.core.MContentPadding",j="resetPaddingLeft",i="setPaddingTop",h="setPaddingRight",g="resetPaddingBottom",c="contentPaddingLeft",f="setPaddingLeft",e="contentPaddingTop",b="shorthand",a="contentPaddingRight",d="contentPaddingBottom";qx.Mixin.define(k,{properties:{contentPaddingTop:{check:p,init:0,apply:o,themeable:true},contentPaddingRight:{check:p,init:0,apply:o,themeable:true},contentPaddingBottom:{check:p,init:0,apply:o,themeable:true},contentPaddingLeft:{check:p,init:0,apply:o,themeable:true},contentPadding:{group:[e,a,d,c],mode:b,themeable:true}},members:{__kV:{contentPaddingTop:i,contentPaddingRight:h,contentPaddingBottom:m,contentPaddingLeft:f},__kW:{contentPaddingTop:l,contentPaddingRight:n,contentPaddingBottom:g,contentPaddingLeft:j},_applyContentPadding:function(q,r,name){var s=this._getContentPaddingTarget();if(q==null){var t=this.__kW[name];s[t]();}else{var u=this.__kV[name];s[u](q);}}}});})();(function(){var v="single",u="Boolean",t="one",s="changeSelection",r="__nt",q="mouseup",p="mousedown",o="losecapture",n="multi",m="_applyQuickSelection",d="mouseover",l="_applySelectionMode",h="_applyDragSelection",c="qx.ui.core.MMultiSelectionHandling",b="removeItem",g="keypress",f="qx.event.type.Data",j="addItem",a="additive",k="mousemove";qx.Mixin.define(c,{construct:function(){var x=this.SELECTION_MANAGER;var w=this.__nt=new x(this);this.addListener(p,w.handleMouseDown,w);this.addListener(q,w.handleMouseUp,w);this.addListener(d,w.handleMouseOver,w);this.addListener(k,w.handleMouseMove,w);this.addListener(o,w.handleLoseCapture,w);this.addListener(g,w.handleKeyPress,w);this.addListener(j,w.handleAddItem,w);this.addListener(b,w.handleRemoveItem,w);w.addListener(s,this._onSelectionChange,this);},events:{"changeSelection":f},properties:{selectionMode:{check:[v,n,a,t],init:v,apply:l},dragSelection:{check:u,init:false,apply:h},quickSelection:{check:u,init:false,apply:m}},members:{__nt:null,selectAll:function(){this.__nt.selectAll();},isSelected:function(y){if(!qx.ui.core.Widget.contains(this,y)){throw new Error("Could not test if "+y+" is selected, because it is not a child element!");}return this.__nt.isItemSelected(y);},addToSelection:function(z){if(!qx.ui.core.Widget.contains(this,z)){throw new Error("Could not add + "+z+" to selection, because it is not a child element!");}this.__nt.addItem(z);},removeFromSelection:function(A){if(!qx.ui.core.Widget.contains(this,A)){throw new Error("Could not remove "+A+" from selection, because it is not a child element!");}this.__nt.removeItem(A);},selectRange:function(B,C){this.__nt.selectItemRange(B,C);},resetSelection:function(){this.__nt.clearSelection();},setSelection:function(D){for(var i=0;i<D.length;i++){if(!qx.ui.core.Widget.contains(this,D[i])){throw new Error("Could not select "+D[i]+", because it is not a child element!");}}if(D.length===0){this.resetSelection();}else{var E=this.getSelection();if(!qx.lang.Array.equals(E,D)){this.__nt.replaceSelection(D);}}},getSelection:function(){return this.__nt.getSelection();},getSortedSelection:function(){return this.__nt.getSortedSelection();},isSelectionEmpty:function(){return this.__nt.isSelectionEmpty();},getSelectionContext:function(){return this.__nt.getSelectionContext();},_getManager:function(){return this.__nt;},getSelectables:function(F){return this.__nt.getSelectables(F);},invertSelection:function(){this.__nt.invertSelection();},_getLeadItem:function(){var G=this.__nt.getMode();if(G===v||G===t){return this.__nt.getSelectedItem();}else{return this.__nt.getLeadItem();}},_applySelectionMode:function(H,I){this.__nt.setMode(H);},_applyDragSelection:function(J,K){this.__nt.setDrag(J);},_applyQuickSelection:function(L,M){this.__nt.setQuick(L);},_onSelectionChange:function(e){this.fireDataEvent(s,e.getData());}},destruct:function(){this._disposeObjects(r);}});})();(function(){var a="qx.ui.core.IMultiSelection";qx.Interface.define(a,{extend:qx.ui.core.ISingleSelection,members:{selectAll:function(){return true;},addToSelection:function(b){return arguments.length==1;},removeFromSelection:function(c){return arguments.length==1;}}});})();(function(){var o="one",n="single",m="selected",k="additive",j="multi",h="PageUp",g="under",f="Left",d="lead",c="Down",M="Up",L="Boolean",K="PageDown",J="anchor",I="End",H="Home",G="Right",F="right",E="click",D="above",v="left",w="Escape",t="A",u="Space",r="_applyMode",s="interval",p="changeSelection",q="qx.event.type.Data",x="quick",y="__oG",A="key",z="abstract",C="drag",B="qx.ui.core.selection.Abstract";qx.Class.define(B,{type:z,extend:qx.core.Object,construct:function(){qx.core.Object.call(this);this.__oD={};},events:{"changeSelection":q},properties:{mode:{check:[n,j,k,o],init:n,apply:r},drag:{check:L,init:false},quick:{check:L,init:false}},members:{__oE:0,__oF:0,__oG:null,__oH:null,__oI:null,__oJ:null,__oK:null,__oL:null,__oM:null,__oN:null,__oO:null,__oP:null,__oQ:null,__oR:null,__oS:null,__oT:null,__oU:null,__oD:null,__oV:null,__oW:null,_userInteraction:false,__oX:null,getSelectionContext:function(){return this.__oT;},selectAll:function(){var N=this.getMode();if(N==n||N==o){throw new Error("Can not select all items in selection mode: "+N);}this._selectAllItems();this._fireChange();},selectItem:function(O){this._setSelectedItem(O);var P=this.getMode();if(P!==n&&P!==o){this._setLeadItem(O);this._setAnchorItem(O);}this._scrollItemIntoView(O);this._fireChange();},addItem:function(Q){var R=this.getMode();if(R===n||R===o){this._setSelectedItem(Q);}else{if(!this._getAnchorItem()){this._setAnchorItem(Q);}this._setLeadItem(Q);this._addToSelection(Q);}this._scrollItemIntoView(Q);this._fireChange();},removeItem:function(S){this._removeFromSelection(S);if(this.getMode()===o&&this.isSelectionEmpty()){var T=this._getFirstSelectable();if(T){this.addItem(T);}if(T==S){return;}}if(this.getLeadItem()==S){this._setLeadItem(null);}if(this._getAnchorItem()==S){this._setAnchorItem(null);}this._fireChange();},selectItemRange:function(U,V){var W=this.getMode();if(W==n||W==o){throw new Error("Can not select multiple items in selection mode: "+W);}this._selectItemRange(U,V);this._setAnchorItem(U);this._setLeadItem(V);this._scrollItemIntoView(V);this._fireChange();},clearSelection:function(){if(this.getMode()==o){return;}this._clearSelection();this._setLeadItem(null);this._setAnchorItem(null);this._fireChange();},replaceSelection:function(X){var Y=this.getMode();if(Y==o||Y===n){if(X.length>1){throw new Error("Could not select more than one items in mode: "+Y+"!");}if(X.length==1){this.selectItem(X[0]);}else{this.clearSelection();}return;}else{this._replaceMultiSelection(X);}},getSelectedItem:function(){var ba=this.getMode();if(ba===n||ba===o){return this._getSelectedItem()||null;}throw new Error("The method getSelectedItem() is only supported in 'single' and 'one' selection mode!");},getSelection:function(){return qx.lang.Object.getValues(this.__oD);},getSortedSelection:function(){var bc=this.getSelectables();var bb=qx.lang.Object.getValues(this.__oD);bb.sort(function(a,b){return bc.indexOf(a)-bc.indexOf(b);});return bb;},isItemSelected:function(bd){var be=this._selectableToHashCode(bd);return this.__oD[be]!==undefined;},isSelectionEmpty:function(){return qx.lang.Object.isEmpty(this.__oD);},invertSelection:function(){var bg=this.getMode();if(bg===n||bg===o){throw new Error("The method invertSelection() is only supported in 'multi' and 'additive' selection mode!");}var bf=this.getSelectables();for(var i=0;i<bf.length;i++){this._toggleInSelection(bf[i]);}this._fireChange();},_setLeadItem:function(bh){var bi=this.__oU;if(bi!==null){this._styleSelectable(bi,d,false);}if(bh!==null){this._styleSelectable(bh,d,true);}this.__oU=bh;},getLeadItem:function(){return this.__oU!==null?this.__oU:null;},_setAnchorItem:function(bj){var bk=this.__oV;if(bk){this._styleSelectable(bk,J,false);}if(bj){this._styleSelectable(bj,J,true);}this.__oV=bj;},_getAnchorItem:function(){return this.__oV!==null?this.__oV:null;},_isSelectable:function(bl){throw new Error("Abstract method call: _isSelectable()");},_getSelectableFromMouseEvent:function(event){var bm=event.getTarget();if(bm&&this._isSelectable(bm)){return bm;}return null;},_selectableToHashCode:function(bn){throw new Error("Abstract method call: _selectableToHashCode()");},_styleSelectable:function(bo,bp,bq){throw new Error("Abstract method call: _styleSelectable()");},_capture:function(){throw new Error("Abstract method call: _capture()");},_releaseCapture:function(){throw new Error("Abstract method call: _releaseCapture()");},_getLocation:function(){throw new Error("Abstract method call: _getLocation()");},_getDimension:function(){throw new Error("Abstract method call: _getDimension()");},_getSelectableLocationX:function(br){throw new Error("Abstract method call: _getSelectableLocationX()");},_getSelectableLocationY:function(bs){throw new Error("Abstract method call: _getSelectableLocationY()");},_getScroll:function(){throw new Error("Abstract method call: _getScroll()");},_scrollBy:function(bt,bu){throw new Error("Abstract method call: _scrollBy()");},_scrollItemIntoView:function(bv){throw new Error("Abstract method call: _scrollItemIntoView()");},getSelectables:function(bw){throw new Error("Abstract method call: getSelectables()");},_getSelectableRange:function(bx,by){throw new Error("Abstract method call: _getSelectableRange()");},_getFirstSelectable:function(){throw new Error("Abstract method call: _getFirstSelectable()");},_getLastSelectable:function(){throw new Error("Abstract method call: _getLastSelectable()");},_getRelatedSelectable:function(bz,bA){throw new Error("Abstract method call: _getRelatedSelectable()");},_getPage:function(bB,bC){throw new Error("Abstract method call: _getPage()");},_applyMode:function(bD,bE){this._setLeadItem(null);this._setAnchorItem(null);this._clearSelection();if(bD===o){var bF=this._getFirstSelectable();if(bF){this._setSelectedItem(bF);this._scrollItemIntoView(bF);}}this._fireChange();},handleMouseOver:function(event){if(this.__oX!=null&&this.__oX!=this._getScroll().top){this.__oX=null;return;}this._userInteraction=true;if(!this.getQuick()){this._userInteraction=false;return;}var bH=this.getMode();if(bH!==o&&bH!==n){this._userInteraction=false;return;}var bG=this._getSelectableFromMouseEvent(event);if(bG===null){this._userInteraction=false;return;}this._setSelectedItem(bG);this._fireChange(x);this._userInteraction=false;},handleMouseDown:function(event){this._userInteraction=true;var bJ=this._getSelectableFromMouseEvent(event);if(bJ===null){this._userInteraction=false;return;}var bL=event.isCtrlPressed()||(qx.bom.client.Platform.MAC&&event.isMetaPressed());var bI=event.isShiftPressed();if(this.isItemSelected(bJ)&&!bI&&!bL&&!this.getDrag()){this.__oW=bJ;this._userInteraction=false;return;}else{this.__oW=null;}this._scrollItemIntoView(bJ);switch(this.getMode()){case n:case o:this._setSelectedItem(bJ);break;case k:this._setLeadItem(bJ);this._setAnchorItem(bJ);this._toggleInSelection(bJ);break;case j:this._setLeadItem(bJ);if(bI){var bK=this._getAnchorItem();if(bK===null){bK=this._getFirstSelectable();this._setAnchorItem(bK);}this._selectItemRange(bK,bJ,bL);}else if(bL){this._setAnchorItem(bJ);this._toggleInSelection(bJ);}else{this._setAnchorItem(bJ);this._setSelectedItem(bJ);}break;}var bM=this.getMode();if(this.getDrag()&&bM!==n&&bM!==o&&!bI&&!bL){this.__oK=this._getLocation();this.__oH=this._getScroll();this.__oL=event.getDocumentLeft()+this.__oH.left;this.__oM=event.getDocumentTop()+this.__oH.top;this.__oN=true;this._capture();}this._fireChange(E);this._userInteraction=false;},handleMouseUp:function(event){this._userInteraction=true;var bQ=event.isCtrlPressed()||(qx.bom.client.Platform.MAC&&event.isMetaPressed());var bN=event.isShiftPressed();if(!bQ&&!bN&&this.__oW){var bO=this._getSelectableFromMouseEvent(event);if(bO===null||!this.isItemSelected(bO)){this._userInteraction=false;return;}var bP=this.getMode();if(bP===k){this._removeFromSelection(bO);}else{this._setSelectedItem(bO);if(this.getMode()===j){this._setLeadItem(bO);this._setAnchorItem(bO);}}this._userInteraction=false;}this._cleanup();},handleLoseCapture:function(event){this._cleanup();},handleMouseMove:function(event){if(!this.__oN){return;}this.__oO=event.getDocumentLeft();this.__oP=event.getDocumentTop();this._userInteraction=true;var bS=this.__oO+this.__oH.left;if(bS>this.__oL){this.__oQ=1;}else if(bS<this.__oL){this.__oQ=-1;}else{this.__oQ=0;}var bR=this.__oP+this.__oH.top;if(bR>this.__oM){this.__oR=1;}else if(bR<this.__oM){this.__oR=-1;}else{this.__oR=0;}var location=this.__oK;if(this.__oO<location.left){this.__oE=this.__oO-location.left;}else if(this.__oO>location.right){this.__oE=this.__oO-location.right;}else{this.__oE=0;}if(this.__oP<location.top){this.__oF=this.__oP-location.top;}else if(this.__oP>location.bottom){this.__oF=this.__oP-location.bottom;}else{this.__oF=0;}if(!this.__oG){this.__oG=new qx.event.Timer(100);this.__oG.addListener(s,this._onInterval,this);}this.__oG.start();this._autoSelect();event.stopPropagation();this._userInteraction=false;},handleAddItem:function(e){var bT=e.getData();if(this.getMode()===o&&this.isSelectionEmpty()){this.addItem(bT);}},handleRemoveItem:function(e){this.removeItem(e.getData());},_cleanup:function(){if(!this.getDrag()&&this.__oN){return;}if(this.__oS){this._fireChange(E);}delete this.__oN;delete this.__oI;delete this.__oJ;this._releaseCapture();if(this.__oG){this.__oG.stop();}},_onInterval:function(e){this._scrollBy(this.__oE,this.__oF);this.__oH=this._getScroll();this._autoSelect();},_autoSelect:function(){var cd=this._getDimension();var bV=Math.max(0,Math.min(this.__oO-this.__oK.left,cd.width))+this.__oH.left;var bU=Math.max(0,Math.min(this.__oP-this.__oK.top,cd.height))+this.__oH.top;if(this.__oI===bV&&this.__oJ===bU){return;}this.__oI=bV;this.__oJ=bU;var cf=this._getAnchorItem();var bX=cf;var cb=this.__oQ;var ce,bW;while(cb!==0){ce=cb>0?this._getRelatedSelectable(bX,F):this._getRelatedSelectable(bX,v);if(ce!==null){bW=this._getSelectableLocationX(ce);if((cb>0&&bW.left<=bV)||(cb<0&&bW.right>=bV)){bX=ce;continue;}}break;}var cc=this.__oR;var ca,bY;while(cc!==0){ca=cc>0?this._getRelatedSelectable(bX,g):this._getRelatedSelectable(bX,D);if(ca!==null){bY=this._getSelectableLocationY(ca);if((cc>0&&bY.top<=bU)||(cc<0&&bY.bottom>=bU)){bX=ca;continue;}}break;}var cg=this.getMode();if(cg===j){this._selectItemRange(cf,bX);}else if(cg===k){if(this.isItemSelected(cf)){this._selectItemRange(cf,bX,true);}else{this._deselectItemRange(cf,bX);}this._setAnchorItem(bX);}this._fireChange(C);},__oY:{Home:1,Down:1,Right:1,PageDown:1,End:1,Up:1,Left:1,PageUp:1},handleKeyPress:function(event){this._userInteraction=true;var cm,cl;var co=event.getKeyIdentifier();var cn=this.getMode();var ci=event.isCtrlPressed()||(qx.bom.client.Platform.MAC&&event.isMetaPressed());var cj=event.isShiftPressed();var ck=false;if(co===t&&ci){if(cn!==n&&cn!==o){this._selectAllItems();ck=true;}}else if(co===w){if(cn!==n&&cn!==o){this._clearSelection();ck=true;}}else if(co===u){var ch=this.getLeadItem();if(ch&&!cj){if(ci||cn===k){this._toggleInSelection(ch);}else{this._setSelectedItem(ch);}ck=true;}}else if(this.__oY[co]){ck=true;if(cn===n||cn==o){cm=this._getSelectedItem();}else{cm=this.getLeadItem();}if(cm!==null){switch(co){case H:cl=this._getFirstSelectable();break;case I:cl=this._getLastSelectable();break;case M:cl=this._getRelatedSelectable(cm,D);break;case c:cl=this._getRelatedSelectable(cm,g);break;case f:cl=this._getRelatedSelectable(cm,v);break;case G:cl=this._getRelatedSelectable(cm,F);break;case h:cl=this._getPage(cm,true);break;case K:cl=this._getPage(cm,false);break;}}else{switch(co){case H:case c:case G:case K:cl=this._getFirstSelectable();break;case I:case M:case f:case h:cl=this._getLastSelectable();break;}}if(cl!==null){switch(cn){case n:case o:this._setSelectedItem(cl);break;case k:this._setLeadItem(cl);break;case j:if(cj){var cp=this._getAnchorItem();if(cp===null){this._setAnchorItem(cp=this._getFirstSelectable());}this._setLeadItem(cl);this._selectItemRange(cp,cl,ci);}else{this._setAnchorItem(cl);this._setLeadItem(cl);if(!ci){this._setSelectedItem(cl);}}break;}this.__oX=this._getScroll().top;this._scrollItemIntoView(cl);}}if(ck){event.stop();this._fireChange(A);}this._userInteraction=false;},_selectAllItems:function(){var cq=this.getSelectables();for(var i=0,l=cq.length;i<l;i++){this._addToSelection(cq[i]);}},_clearSelection:function(){var cr=this.__oD;for(var cs in cr){this._removeFromSelection(cr[cs]);}this.__oD={};},_selectItemRange:function(ct,cu,cv){var cy=this._getSelectableRange(ct,cu);if(!cv){var cx=this.__oD;var cz=this.__pa(cy);for(var cw in cx){if(!cz[cw]){this._removeFromSelection(cx[cw]);}}}for(var i=0,l=cy.length;i<l;i++){this._addToSelection(cy[i]);}},_deselectItemRange:function(cA,cB){var cC=this._getSelectableRange(cA,cB);for(var i=0,l=cC.length;i<l;i++){this._removeFromSelection(cC[i]);}},__pa:function(cD){var cF={};var cE;for(var i=0,l=cD.length;i<l;i++){cE=cD[i];cF[this._selectableToHashCode(cE)]=cE;}return cF;},_getSelectedItem:function(){for(var cG in this.__oD){return this.__oD[cG];}return null;},_setSelectedItem:function(cH){if(this._isSelectable(cH)){var cI=this.__oD;var cJ=this._selectableToHashCode(cH);if(!cI[cJ]||qx.lang.Object.hasMinLength(cI,2)){this._clearSelection();this._addToSelection(cH);}}},_addToSelection:function(cK){var cL=this._selectableToHashCode(cK);if(!this.__oD[cL]&&this._isSelectable(cK)){this.__oD[cL]=cK;this._styleSelectable(cK,m,true);this.__oS=true;}},_toggleInSelection:function(cM){var cN=this._selectableToHashCode(cM);if(!this.__oD[cN]){this.__oD[cN]=cM;this._styleSelectable(cM,m,true);}else{delete this.__oD[cN];this._styleSelectable(cM,m,false);}this.__oS=true;},_removeFromSelection:function(cO){var cP=this._selectableToHashCode(cO);if(this.__oD[cP]!=null){delete this.__oD[cP];this._styleSelectable(cO,m,false);this.__oS=true;}},_replaceMultiSelection:function(cQ){var cT=false;var cW,cV;var cR={};for(var i=0,l=cQ.length;i<l;i++){cW=cQ[i];if(this._isSelectable(cW)){cV=this._selectableToHashCode(cW);cR[cV]=cW;}}var cX=cQ[0];var cS=cW;var cU=this.__oD;for(var cV in cU){if(cR[cV]){delete cR[cV];}else{cW=cU[cV];delete cU[cV];this._styleSelectable(cW,m,false);cT=true;}}for(var cV in cR){cW=cU[cV]=cR[cV];this._styleSelectable(cW,m,true);cT=true;}if(!cT){return false;}this._scrollItemIntoView(cS);this._setLeadItem(cX);this._setAnchorItem(cX);this.__oS=true;this._fireChange();},_fireChange:function(cY){if(this.__oS){this.__oT=cY||null;this.fireDataEvent(p,this.getSelection());delete this.__oS;}}},destruct:function(){this._disposeObjects(y);this.__oD=this.__oW=this.__oV=null;this.__oU=null;}});})();(function(){var f="vertical",e="under",d="above",c="qx.ui.core.selection.Widget",b="left",a="right";qx.Class.define(c,{extend:qx.ui.core.selection.Abstract,construct:function(g){qx.ui.core.selection.Abstract.call(this);this.__nW=g;},members:{__nW:null,_isSelectable:function(h){return this._isItemSelectable(h)&&h.getLayoutParent()===this.__nW;},_selectableToHashCode:function(j){return j.$$hash;},_styleSelectable:function(k,m,n){n?k.addState(m):k.removeState(m);},_capture:function(){this.__nW.capture();},_releaseCapture:function(){this.__nW.releaseCapture();},_isItemSelectable:function(o){if(this._userInteraction){return o.isVisible()&&o.isEnabled();}else{return o.isVisible();}},_getWidget:function(){return this.__nW;},_getLocation:function(){var p=this.__nW.getContentElement().getDomElement();return p?qx.bom.element.Location.get(p):null;},_getDimension:function(){return this.__nW.getInnerSize();},_getSelectableLocationX:function(q){var r=q.getBounds();if(r){return {left:r.left,right:r.left+r.width};}},_getSelectableLocationY:function(s){var t=s.getBounds();if(t){return {top:t.top,bottom:t.top+t.height};}},_getScroll:function(){return {left:0,top:0};},_scrollBy:function(u,v){},_scrollItemIntoView:function(w){this.__nW.scrollChildIntoView(w);},getSelectables:function(x){var y=false;if(!x){y=this._userInteraction;this._userInteraction=true;}var B=this.__nW.getChildren();var z=[];var A;for(var i=0,l=B.length;i<l;i++){A=B[i];if(this._isItemSelectable(A)){z.push(A);}}this._userInteraction=y;return z;},_getSelectableRange:function(C,D){if(C===D){return [C];}var H=this.__nW.getChildren();var E=[];var G=false;var F;for(var i=0,l=H.length;i<l;i++){F=H[i];if(F===C||F===D){if(G){E.push(F);break;}else{G=true;}}if(G&&this._isItemSelectable(F)){E.push(F);}}return E;},_getFirstSelectable:function(){var I=this.__nW.getChildren();for(var i=0,l=I.length;i<l;i++){if(this._isItemSelectable(I[i])){return I[i];}}return null;},_getLastSelectable:function(){var J=this.__nW.getChildren();for(var i=J.length-1;i>0;i--){if(this._isItemSelectable(J[i])){return J[i];}}return null;},_getRelatedSelectable:function(K,L){var O=this.__nW.getOrientation()===f;var N=this.__nW.getChildren();var M=N.indexOf(K);var P;if((O&&L===d)||(!O&&L===b)){for(var i=M-1;i>=0;i--){P=N[i];if(this._isItemSelectable(P)){return P;}}}else if((O&&L===e)||(!O&&L===a)){for(var i=M+1;i<N.length;i++){P=N[i];if(this._isItemSelectable(P)){return P;}}}return null;},_getPage:function(Q,R){if(R){return this._getFirstSelectable();}else{return this._getLastSelectable();}}},destruct:function(){this.__nW=null;}});})();(function(){var a="qx.ui.core.selection.ScrollArea";qx.Class.define(a,{extend:qx.ui.core.selection.Widget,members:{_isSelectable:function(b){return this._isItemSelectable(b)&&b.getLayoutParent()===this._getWidget().getChildrenContainer();},_getDimension:function(){return this._getWidget().getPaneSize();},_getScroll:function(){var c=this._getWidget();return {left:c.getScrollX(),top:c.getScrollY()};},_scrollBy:function(d,e){var f=this._getWidget();f.scrollByX(d);f.scrollByY(e);},_getPage:function(g,h){var m=this.getSelectables();var length=m.length;var p=m.indexOf(g);if(p===-1){throw new Error("Invalid lead item: "+g);}var j=this._getWidget();var r=j.getScrollY();var innerHeight=j.getInnerSize().height;var top,l,q;if(h){var o=r;var i=p;while(1){for(;i>=0;i--){top=j.getItemTop(m[i]);if(top<o){q=i+1;break;}}if(q==null){var s=this._getFirstSelectable();return s==g?null:s;}if(q>=p){o-=innerHeight+r-j.getItemBottom(g);q=null;continue;}return m[q];}}else{var n=innerHeight+r;var i=p;while(1){for(;i<length;i++){l=j.getItemBottom(m[i]);if(l>n){q=i-1;break;}}if(q==null){var k=this._getLastSelectable();return k==g?null:k;}if(q<=p){n+=j.getItemTop(g)-r;q=null;continue;}return m[q];}}}}});})();(function(){var e="right",d="above",c="left",b="under",a="qx.ui.tree.SelectionManager";qx.Class.define(a,{extend:qx.ui.core.selection.ScrollArea,members:{_getSelectableLocationY:function(f){var g=f.getBounds();if(g){var top=this._getWidget().getItemTop(f);return {top:top,bottom:top+g.height};}},_isSelectable:function(h){return this._isItemSelectable(h)&&h instanceof qx.ui.tree.AbstractTreeItem;},_getSelectableFromMouseEvent:function(event){return this._getWidget().getTreeItem(event.getTarget());},getSelectables:function(j){var m=false;if(!j){m=this._userInteraction;this._userInteraction=true;}var l=this._getWidget();var n=[];if(l.getRoot()!=null){var k=l.getRoot().getItems(true,!!j,l.getHideRoot());for(var i=0;i<k.length;i++){if(this._isSelectable(k[i])){n.push(k[i]);}}}this._userInteraction=m;return n;},_getSelectableRange:function(o,p){if(o===p){return [o];}var q=this.getSelectables();var r=q.indexOf(o);var s=q.indexOf(p);if(r<0||s<0){return [];}if(r<s){return q.slice(r,s+1);}else{return q.slice(s,r+1);}},_getFirstSelectable:function(){return this.getSelectables()[0]||null;},_getLastSelectable:function(){var t=this.getSelectables();if(t.length>0){return t[t.length-1];}else{return null;}},_getRelatedSelectable:function(u,v){var w=this._getWidget();var x=null;switch(v){case d:x=w.getPreviousNodeOf(u,false);break;case b:x=w.getNextNodeOf(u,false);break;case c:case e:break;}if(!x){return null;}if(this._isSelectable(x)){return x;}else{return this._getRelatedSelectable(x,v);}}}});})();(function(){var l="dblclick",k="click",j="Boolean",h="excluded",g="visible",f="qx.event.type.Data",d="_applyOpenMode",c="Space",b="Left",a="Enter",z="changeOpenMode",y="_applyRootOpenClose",x="changeSelection",w="qx.ui.tree.Tree",v="tree",u="_applyHideRoot",t="changeRoot",s="_applyRoot",r="keypress",q="none",o="pane",p="Right",m="qx.ui.tree.AbstractTreeItem",n="__sv";qx.Class.define(w,{extend:qx.ui.core.scroll.AbstractScrollArea,implement:[qx.ui.core.IMultiSelection,qx.ui.form.IModelSelection,qx.ui.form.IForm],include:[qx.ui.core.MMultiSelectionHandling,qx.ui.core.MContentPadding,qx.ui.form.MModelSelection,qx.ui.form.MForm],construct:function(){qx.ui.core.scroll.AbstractScrollArea.call(this);this.__sv=new qx.ui.container.Composite(new qx.ui.layout.VBox()).set({allowShrinkY:false,allowGrowX:true});this.getChildControl(o).add(this.__sv);this.initOpenMode();this.initRootOpenClose();this.addListener(x,this._onChangeSelection,this);this.addListener(r,this._onKeyPress,this);},events:{addItem:f,removeItem:f},properties:{openMode:{check:[k,l,q],init:l,apply:d,event:z,themeable:true},root:{check:m,init:null,nullable:true,event:t,apply:s},hideRoot:{check:j,init:false,apply:u},rootOpenClose:{check:j,init:false,apply:y},appearance:{refine:true,init:v},focusable:{refine:true,init:true}},members:{__sv:null,SELECTION_MANAGER:qx.ui.tree.SelectionManager,getChildrenContainer:function(){return this.__sv;},_applyRoot:function(A,B){var C=this.getChildrenContainer();if(B){C.remove(B);if(B.hasChildren()){C.remove(B.getChildrenContainer());}}if(A){C.add(A);if(A.hasChildren()){C.add(A.getChildrenContainer());}A.setVisibility(this.getHideRoot()?h:g);A.recursiveAddToWidgetQueue();}},_applyHideRoot:function(D,E){var F=this.getRoot();if(!F){return;}F.setVisibility(D?h:g);F.recursiveAddToWidgetQueue();},_applyRootOpenClose:function(G,H){var I=this.getRoot();if(!I){return;}I.recursiveAddToWidgetQueue();},_getContentPaddingTarget:function(){return this.__sv;},getNextNodeOf:function(J,K){if((K!==false||J.isOpen())&&J.hasChildren()){return J.getChildren()[0];}while(J){var parent=J.getParent();if(!parent){return null;}var M=parent.getChildren();var L=M.indexOf(J);if(L>-1&&L<M.length-1){return M[L+1];}J=parent;}return null;},getPreviousNodeOf:function(N,O){var parent=N.getParent();if(!parent){return null;}if(this.getHideRoot()){if(parent==this.getRoot()){if(parent.getChildren()[0]==N){return null;}}}else{if(N==this.getRoot()){return null;}}var R=parent.getChildren();var P=R.indexOf(N);if(P>0){var Q=R[P-1];while((O!==false||Q.isOpen())&&Q.hasChildren()){var S=Q.getChildren();Q=S[S.length-1];}return Q;}else{return parent;}},getNextSiblingOf:function(T){if(T==this.getRoot()){return null;}var parent=T.getParent();var U=parent.getChildren();var V=U.indexOf(T);if(V<U.length-1){return U[V+1];}return null;},getPreviousSiblingOf:function(W){if(W==this.getRoot()){return null;}var parent=W.getParent();var X=parent.getChildren();var Y=X.indexOf(W);if(Y>0){return X[Y-1];}return null;},getItems:function(ba,bb){if(this.getRoot()!=null){return this.getRoot().getItems(ba,bb,this.getHideRoot());}else{return [];}},getChildren:function(){if(this.getRoot()!=null){return [this.getRoot()];}else{return [];}},getTreeItem:function(bc){while(bc){if(bc==this){return null;}if(bc instanceof qx.ui.tree.AbstractTreeItem){return bc;}bc=bc.getLayoutParent();}return null;},_applyOpenMode:function(bd,be){if(be==k){this.removeListener(k,this._onOpen,this);}else if(be==l){this.removeListener(l,this._onOpen,this);}if(bd==k){this.addListener(k,this._onOpen,this);}else if(bd==l){this.addListener(l,this._onOpen,this);}},_onOpen:function(e){var bf=this.getTreeItem(e.getTarget());if(!bf||!bf.isOpenable()){return;}bf.setOpen(!bf.isOpen());e.stopPropagation();},_onChangeSelection:function(e){var bh=e.getData();for(var i=0;i<bh.length;i++){var bg=bh[i];while(bg.getParent()!=null){bg=bg.getParent();bg.setOpen(true);}}},_onKeyPress:function(e){var bi=this._getLeadItem();if(bi!==null){switch(e.getKeyIdentifier()){case b:if(bi.isOpenable()&&bi.isOpen()){bi.setOpen(false);}break;case p:if(bi.isOpenable()&&!bi.isOpen()){bi.setOpen(true);}break;case a:case c:if(bi.isOpenable()){bi.toggleOpen();}break;}}}},destruct:function(){this._disposeObjects(n);}});})();(function(){var d=".",c="apiviewer.ui.PackageTree",b="Documentation",a="__SR";qx.Class.define(c,{extend:qx.ui.tree.Tree,construct:function(){qx.ui.tree.Tree.call(this,b);this.setDecorator(null);this.__SR=new qx.ui.tree.TreeFolder("Packages");this.__SR.setOpen(true);this.setRoot(this.__SR);this.setSelection([this.__SR]);this._classTreeNodeHash={};},members:{__SR:null,setTreeData:function(e){this._docTree=e;this.__ST(this.__SR,e,0);if(this._wantedClassName){this.selectTreeNodeByClassName(this._wantedClassName);this._wantedClassName=null;}},selectTreeNodeByClassName:function(f){if(this._docTree==null){this._wantedClassName=f;return true;}var j=f.split(d);var h=j[0];var i=0;do{var g=this._classTreeNodeHash[h];if(!g){return false;}if(!g.loaded){g.setOpen(true);}i++;h+=d+j[i];}while(i<j.length);this.setSelection([g]);this.scrollChildIntoView(g);return true;},__SS:function(k,l,m){var self=this;return function(){if(!k.loaded){self.__ST(k,l,m+1);k.setOpenSymbolMode("always");}};},__ST:function(n,o,p){n.loaded=true;var s=apiviewer.ui.PackageTree;var q=o.getPackages();for(var i=0;i<q.length;i++){var r=q[i];var v=apiviewer.TreeUtil.getIconUrl(r);var w=new qx.ui.tree.TreeFolder(r.getName());w.setIcon(v);w.setOpenSymbolMode("always");w.setUserData("nodeName",r.getFullName());n.add(w);w.addListener("changeOpen",this.__SS(w,r,p+1),this);if(p<qx.core.Setting.get("apiviewer.initialTreeDepth")&&r.getPackages().length>0){w.setOpen(true);}this._classTreeNodeHash[r.getFullName()]=w;}var x=o.getClasses();for(var i=0;i<x.length;i++){var u=x[i];var v=apiviewer.TreeUtil.getIconUrl(u);var t=new qx.ui.tree.TreeFolder(u.getName());t.setIcon(v);t.setUserData("nodeName",u.getFullName());t.treeType=s.PACKAGE_TREE;n.add(t);this._classTreeNodeHash[u.getFullName()]=t;}}},destruct:function(){this._docTree=this._classTreeNodeHash=null;this._disposeObjects(a);}});})();(function(){var b="qx.ui.core.scroll.IScrollBar",a="qx.event.type.Data";qx.Interface.define(b,{events:{"scroll":a},properties:{orientation:{},maximum:{},position:{},knobFactor:{}},members:{scrollTo:function(c){this.assertNumber(c);},scrollBy:function(d){this.assertNumber(d);},scrollBySteps:function(e){this.assertNumber(e);}}});})();(function(){var k="horizontal",j="px",i="scroll",h="vertical",g="-1px",f="qx.client",d="0",c="hidden",b="mousedown",a="qx.ui.core.scroll.NativeScrollBar",z="PositiveNumber",y="__pT",x="Integer",w="mousemove",v="_applyMaximum",u="_applyOrientation",t="appear",s="opera",r="PositiveInteger",q="mshtml",o="mouseup",p="Number",m="_applyPosition",n="scrollbar",l="native";qx.Class.define(a,{extend:qx.ui.core.Widget,implement:qx.ui.core.scroll.IScrollBar,construct:function(A){qx.ui.core.Widget.call(this);this.addState(l);this.getContentElement().addListener(i,this._onScroll,this);this.addListener(b,this._stopPropagation,this);this.addListener(o,this._stopPropagation,this);this.addListener(w,this._stopPropagation,this);if(qx.core.Variant.isSet(f,s)){this.addListener(t,this._onAppear,this);}this.getContentElement().add(this._getScrollPaneElement());if(A!=null){this.setOrientation(A);}else{this.initOrientation();}},properties:{appearance:{refine:true,init:n},orientation:{check:[k,h],init:k,apply:u},maximum:{check:r,apply:v,init:100},position:{check:p,init:0,apply:m,event:i},singleStep:{check:x,init:20},knobFactor:{check:z,nullable:true}},members:{__pS:null,__pT:null,_getScrollPaneElement:function(){if(!this.__pT){this.__pT=new qx.html.Element();}return this.__pT;},renderLayout:function(B,top,C,D){var E=qx.ui.core.Widget.prototype.renderLayout.call(this,B,top,C,D);this._updateScrollBar();return E;},_getContentHint:function(){var F=qx.bom.element.Overflow.getScrollbarWidth();return {width:this.__pS?100:F,maxWidth:this.__pS?null:F,minWidth:this.__pS?null:F,height:this.__pS?F:100,maxHeight:this.__pS?F:null,minHeight:this.__pS?F:null};},_applyEnabled:function(G,H){qx.ui.core.Widget.prototype._applyEnabled.call(this,G,H);this._updateScrollBar();},_applyMaximum:function(I){this._updateScrollBar();},_applyPosition:function(J){var content=this.getContentElement();if(this.__pS){content.scrollToX(J);}else{content.scrollToY(J);}},_applyOrientation:function(K,L){var M=this.__pS=K===k;this.set({allowGrowX:M,allowShrinkX:M,allowGrowY:!M,allowShrinkY:!M});if(M){this.replaceState(h,k);}else{this.replaceState(k,h);}this.getContentElement().setStyles({overflowX:M?i:c,overflowY:M?c:i});qx.ui.core.queue.Layout.add(this);},_updateScrollBar:function(){var O=this.__pS;var P=this.getBounds();if(!P){return;}if(this.isEnabled()){var Q=O?P.width:P.height;var N=this.getMaximum()+Q;}else{N=0;}if(qx.core.Variant.isSet(f,q)){var P=this.getBounds();this.getContentElement().setStyles({left:O?d:g,top:O?g:d,width:(O?P.width:P.width+1)+j,height:(O?P.height+1:P.height)+j});}this._getScrollPaneElement().setStyles({left:0,top:0,width:(O?N:1)+j,height:(O?1:N)+j});this.scrollTo(this.getPosition());},scrollTo:function(R){this.setPosition(Math.max(0,Math.min(this.getMaximum(),R)));},scrollBy:function(S){this.scrollTo(this.getPosition()+S);},scrollBySteps:function(T){var U=this.getSingleStep();this.scrollBy(T*U);},_onScroll:function(e){var W=this.getContentElement();var V=this.__pS?W.getScrollX():W.getScrollY();this.setPosition(V);},_onAppear:function(e){this.scrollTo(this.getPosition());},_stopPropagation:function(e){e.stopPropagation();}},destruct:function(){this._disposeObjects(y);}});})();(function(){var k="slider",j="horizontal",i="button-begin",h="vertical",g="button-end",f="Integer",d="execute",c="right",b="left",a="down",z="up",y="PositiveNumber",x="changeValue",w="qx.lang.Type.isNumber(value)&&value>=0&&value<=this.getMaximum()",v="_applyKnobFactor",u="knob",t="qx.ui.core.scroll.ScrollBar",s="resize",r="_applyOrientation",q="_applyPageStep",o="PositiveInteger",p="scroll",m="_applyPosition",n="scrollbar",l="_applyMaximum";qx.Class.define(t,{extend:qx.ui.core.Widget,implement:qx.ui.core.scroll.IScrollBar,construct:function(A){qx.ui.core.Widget.call(this);this._createChildControl(i);this._createChildControl(k).addListener(s,this._onResizeSlider,this);this._createChildControl(g);if(A!=null){this.setOrientation(A);}else{this.initOrientation();}},properties:{appearance:{refine:true,init:n},orientation:{check:[j,h],init:j,apply:r},maximum:{check:o,apply:l,init:100},position:{check:w,init:0,apply:m,event:p},singleStep:{check:f,init:20},pageStep:{check:f,init:10,apply:q},knobFactor:{check:y,apply:v,nullable:true}},members:{__oC:2,_createChildControlImpl:function(B,C){var D;switch(B){case k:D=new qx.ui.core.scroll.ScrollSlider();D.setPageStep(100);D.setFocusable(false);D.addListener(x,this._onChangeSliderValue,this);this._add(D,{flex:1});break;case i:D=new qx.ui.form.RepeatButton();D.setFocusable(false);D.addListener(d,this._onExecuteBegin,this);this._add(D);break;case g:D=new qx.ui.form.RepeatButton();D.setFocusable(false);D.addListener(d,this._onExecuteEnd,this);this._add(D);break;}return D||qx.ui.core.Widget.prototype._createChildControlImpl.call(this,B);},_applyMaximum:function(E){this.getChildControl(k).setMaximum(E);},_applyPosition:function(F){this.getChildControl(k).setValue(F);},_applyKnobFactor:function(G){this.getChildControl(k).setKnobFactor(G);},_applyPageStep:function(H){this.getChildControl(k).setPageStep(H);},_applyOrientation:function(I,J){var K=this._getLayout();if(K){K.dispose();}if(I===j){this._setLayout(new qx.ui.layout.HBox());this.setAllowStretchX(true);this.setAllowStretchY(false);this.replaceState(h,j);this.getChildControl(i).replaceState(z,b);this.getChildControl(g).replaceState(a,c);}else{this._setLayout(new qx.ui.layout.VBox());this.setAllowStretchX(false);this.setAllowStretchY(true);this.replaceState(j,h);this.getChildControl(i).replaceState(b,z);this.getChildControl(g).replaceState(c,a);}this.getChildControl(k).setOrientation(I);},scrollTo:function(L){this.getChildControl(k).slideTo(L);},scrollBy:function(M){this.getChildControl(k).slideBy(M);},scrollBySteps:function(N){var O=this.getSingleStep();this.getChildControl(k).slideBy(N*O);},_onExecuteBegin:function(e){this.scrollBy(-this.getSingleStep());},_onExecuteEnd:function(e){this.scrollBy(this.getSingleStep());},_onChangeSliderValue:function(e){this.setPosition(e.getData());},_onResizeSlider:function(e){var P=this.getChildControl(k).getChildControl(u);var S=P.getSizeHint();var Q=false;var R=this.getChildControl(k).getInnerSize();if(this.getOrientation()==h){if(R.height<S.minHeight+this.__oC){Q=true;}}else{if(R.width<S.minWidth+this.__oC){Q=true;}}if(Q){P.exclude();}else{P.show();}}}});})();(function(){var a="qx.ui.form.IRange";qx.Interface.define(a,{members:{setMinimum:function(b){return arguments.length==1;},getMinimum:function(){},setMaximum:function(c){return arguments.length==1;},getMaximum:function(){},setSingleStep:function(d){return arguments.length==1;},getSingleStep:function(){},setPageStep:function(e){return arguments.length==1;},getPageStep:function(){}}});})();(function(){var b="qx.ui.form.INumberForm",a="qx.event.type.Data";qx.Interface.define(b,{events:{"changeValue":a},members:{setValue:function(c){return arguments.length==1;},resetValue:function(){},getValue:function(){}}});})();(function(){var k="knob",j="horizontal",i="vertical",h="Integer",g="hovered",f="left",d="top",c="mouseup",b="pressed",a="px",V="changeValue",U="interval",T="mousemove",S="resize",R="slider",Q="mousedown",P="PageUp",O="mouseout",N='qx.event.type.Data',M="Left",r="Down",s="Up",p="dblclick",q="qx.ui.form.Slider",n="PageDown",o="mousewheel",l="_applyValue",m="_applyKnobFactor",t="End",u="height",B="Right",z="width",F="_applyOrientation",D="Home",I="mouseover",H="floor",w="_applyMinimum",L="click",K="typeof value==='number'&&value>=this.getMinimum()&&value<=this.getMaximum()",J="keypress",v="ceil",x="losecapture",y="contextmenu",A="_applyMaximum",C="Number",E="changeMaximum",G="changeMinimum";qx.Class.define(q,{extend:qx.ui.core.Widget,implement:[qx.ui.form.IForm,qx.ui.form.INumberForm,qx.ui.form.IRange],include:[qx.ui.form.MForm],construct:function(W){qx.ui.core.Widget.call(this);this._setLayout(new qx.ui.layout.Canvas());this.addListener(J,this._onKeyPress);this.addListener(o,this._onMouseWheel);this.addListener(Q,this._onMouseDown);this.addListener(c,this._onMouseUp);this.addListener(x,this._onMouseUp);this.addListener(S,this._onUpdate);this.addListener(y,this._onStopEvent);this.addListener(L,this._onStopEvent);this.addListener(p,this._onStopEvent);if(W!=null){this.setOrientation(W);}else{this.initOrientation();}},events:{changeValue:N},properties:{appearance:{refine:true,init:R},focusable:{refine:true,init:true},orientation:{check:[j,i],init:j,apply:F},value:{check:K,init:0,apply:l,nullable:true},minimum:{check:h,init:0,apply:w,event:G},maximum:{check:h,init:100,apply:A,event:E},singleStep:{check:h,init:1},pageStep:{check:h,init:10},knobFactor:{check:C,apply:m,nullable:true}},members:{__nA:null,__nB:null,__nC:null,__nD:null,__nE:null,__nF:null,__nG:null,__nH:null,__nI:null,__nJ:null,__nK:null,__nL:null,_forwardStates:{invalid:true},_createChildControlImpl:function(X,Y){var ba;switch(X){case k:ba=new qx.ui.core.Widget();ba.addListener(S,this._onUpdate,this);ba.addListener(I,this._onMouseOver);ba.addListener(O,this._onMouseOut);this._add(ba);break;}return ba||qx.ui.core.Widget.prototype._createChildControlImpl.call(this,X);},_onMouseOver:function(e){this.addState(g);},_onMouseOut:function(e){this.removeState(g);},_onMouseWheel:function(e){var bb=e.getWheelDelta()>0?1:-1;this.slideBy(bb*this.getSingleStep());e.stop();},_onKeyPress:function(e){var bd=this.getOrientation()===j;var bc=bd?M:s;var forward=bd?B:r;switch(e.getKeyIdentifier()){case forward:this.slideForward();break;case bc:this.slideBack();break;case n:this.slidePageForward();break;case P:this.slidePageBack();break;case D:this.slideToBegin();break;case t:this.slideToEnd();break;default:return;}e.stop();},_onMouseDown:function(e){if(this.__nD){return;}var bg=this.__nN;var be=this.getChildControl(k);var bf=bg?f:d;var bi=bg?e.getDocumentLeft():e.getDocumentTop();var bj=this.__nA=qx.bom.element.Location.get(this.getContentElement().getDomElement())[bf];var bh=this.__nB=qx.bom.element.Location.get(be.getContainerElement().getDomElement())[bf];if(e.getTarget()===be){this.__nD=true;if(!this.__nJ){this.__nJ=new qx.event.Timer(100);this.__nJ.addListener(U,this._fireValue,this);}this.__nJ.start();this.__nE=bi+bj-bh;be.addState(b);}else{this.__nF=true;this.__nG=bi<=bh?-1:1;this.__nO(e);this._onInterval();if(!this.__nI){this.__nI=new qx.event.Timer(100);this.__nI.addListener(U,this._onInterval,this);}this.__nI.start();}this.addListener(T,this._onMouseMove);this.capture();e.stopPropagation();},_onMouseUp:function(e){if(this.__nD){this.releaseCapture();delete this.__nD;this.__nJ.stop();this._fireValue();delete this.__nE;this.getChildControl(k).removeState(b);if(e.getType()===c){var bl;var bm;var bk;if(this.__nN){bl=e.getDocumentLeft()-(this._valueToPosition(this.getValue())+this.__nA);bk=qx.bom.element.Location.get(this.getContentElement().getDomElement())[d];bm=e.getDocumentTop()-(bk+this.getChildControl(k).getBounds().top);}else{bl=e.getDocumentTop()-(this._valueToPosition(this.getValue())+this.__nA);bk=qx.bom.element.Location.get(this.getContentElement().getDomElement())[f];bm=e.getDocumentLeft()-(bk+this.getChildControl(k).getBounds().left);}if(bm<0||bm>this.__nC||bl<0||bl>this.__nC){this.getChildControl(k).removeState(g);}}}else if(this.__nF){this.__nI.stop();this.releaseCapture();delete this.__nF;delete this.__nG;delete this.__nH;}this.removeListener(T,this._onMouseMove);if(e.getType()===c){e.stopPropagation();}},_onMouseMove:function(e){if(this.__nD){var bo=this.__nN?e.getDocumentLeft():e.getDocumentTop();var bn=bo-this.__nE;this.slideTo(this._positionToValue(bn));}else if(this.__nF){this.__nO(e);}e.stopPropagation();},_onInterval:function(e){var bp=this.getValue()+(this.__nG*this.getPageStep());if(bp<this.getMinimum()){bp=this.getMinimum();}else if(bp>this.getMaximum()){bp=this.getMaximum();}var bq=this.__nG==-1;if((bq&&bp<=this.__nH)||(!bq&&bp>=this.__nH)){bp=this.__nH;}this.slideTo(bp);},_onUpdate:function(e){var bs=this.getInnerSize();var bt=this.getChildControl(k).getBounds();var br=this.__nN?z:u;this._updateKnobSize();this.__nM=bs[br]-bt[br];this.__nC=bt[br];this._updateKnobPosition();},__nN:false,__nM:0,__nO:function(e){var bu=this.__nN;var bB=bu?e.getDocumentLeft():e.getDocumentTop();var bD=this.__nA;var bv=this.__nB;var bF=this.__nC;var bC=bB-bD;if(bB>=bv){bC-=bF;}var bz=this._positionToValue(bC);var bw=this.getMinimum();var bx=this.getMaximum();if(bz<bw){bz=bw;}else if(bz>bx){bz=bx;}else{var bA=this.getValue();var by=this.getPageStep();var bE=this.__nG<0?H:v;bz=bA+(Math[bE]((bz-bA)/by)*by);}if(this.__nH==null||(this.__nG==-1&&bz<=this.__nH)||(this.__nG==1&&bz>=this.__nH)){this.__nH=bz;}},_positionToValue:function(bG){var bH=this.__nM;if(bH==null||bH==0){return 0;}var bJ=bG/bH;if(bJ<0){bJ=0;}else if(bJ>1){bJ=1;}var bI=this.getMaximum()-this.getMinimum();return this.getMinimum()+Math.round(bI*bJ);},_valueToPosition:function(bK){var bL=this.__nM;if(bL==null){return 0;}var bM=this.getMaximum()-this.getMinimum();if(bM==0){return 0;}var bK=bK-this.getMinimum();var bN=bK/bM;if(bN<0){bN=0;}else if(bN>1){bN=1;}return Math.round(bL*bN);},_updateKnobPosition:function(){this._setKnobPosition(this._valueToPosition(this.getValue()));},_setKnobPosition:function(bO){var bP=this.getChildControl(k).getContainerElement();if(this.__nN){bP.setStyle(f,bO+a,true);}else{bP.setStyle(d,bO+a,true);}},_updateKnobSize:function(){var bR=this.getKnobFactor();if(bR==null){return;}var bQ=this.getInnerSize();if(bQ==null){return;}if(this.__nN){this.getChildControl(k).setWidth(Math.round(bR*bQ.width));}else{this.getChildControl(k).setHeight(Math.round(bR*bQ.height));}},slideToBegin:function(){this.slideTo(this.getMinimum());},slideToEnd:function(){this.slideTo(this.getMaximum());},slideForward:function(){this.slideBy(this.getSingleStep());},slideBack:function(){this.slideBy(-this.getSingleStep());},slidePageForward:function(){this.slideBy(this.getPageStep());},slidePageBack:function(){this.slideBy(-this.getPageStep());},slideBy:function(bS){this.slideTo(this.getValue()+bS);},slideTo:function(bT){if(bT<this.getMinimum()){bT=this.getMinimum();}else if(bT>this.getMaximum()){bT=this.getMaximum();}else{bT=this.getMinimum()+Math.round((bT-this.getMinimum())/this.getSingleStep())*this.getSingleStep();}this.setValue(bT);},_applyOrientation:function(bU,bV){var bW=this.getChildControl(k);this.__nN=bU===j;if(this.__nN){this.removeState(i);bW.removeState(i);this.addState(j);bW.addState(j);bW.setLayoutProperties({top:0,right:null,bottom:0});}else{this.removeState(j);bW.removeState(j);this.addState(i);bW.addState(i);bW.setLayoutProperties({right:0,bottom:null,left:0});}this._updateKnobPosition();},_applyKnobFactor:function(bX,bY){if(bX!=null){this._updateKnobSize();}else{if(this.__nN){this.getChildControl(k).resetWidth();}else{this.getChildControl(k).resetHeight();}}},_applyValue:function(ca,cb){if(ca!=null){this._updateKnobPosition();if(this.__nD){this.__nL=[ca,cb];}else{this.fireEvent(V,qx.event.type.Data,[ca,cb]);}}else{this.resetValue();}},_fireValue:function(){if(!this.__nL){return;}var cc=this.__nL;this.__nL=null;this.fireEvent(V,qx.event.type.Data,cc);},_applyMinimum:function(cd,ce){if(this.getValue()<cd){this.setValue(cd);}this._updateKnobPosition();},_applyMaximum:function(cf,cg){if(this.getValue()>cf){this.setValue(cf);}this._updateKnobPosition();}}});})();(function(){var d="horizontal",c="mousewheel",b="qx.ui.core.scroll.ScrollSlider",a="keypress";qx.Class.define(b,{extend:qx.ui.form.Slider,construct:function(e){qx.ui.form.Slider.call(this,e);this.removeListener(a,this._onKeyPress);this.removeListener(c,this._onMouseWheel);},members:{getSizeHint:function(f){var g=qx.ui.form.Slider.prototype.getSizeHint.call(this);if(this.getOrientation()===d){g.width=0;}else{g.height=0;}return g;}}});})();(function(){var n="pressed",m="abandoned",l="Integer",k="hovered",j="qx.event.type.Event",i="Enter",h="Space",g="press",f="qx.ui.form.RepeatButton",d="release",a="interval",c="__nS",b="execute";qx.Class.define(f,{extend:qx.ui.form.Button,construct:function(o,p){qx.ui.form.Button.call(this,o,p);this.__nS=new qx.event.AcceleratingTimer();this.__nS.addListener(a,this._onInterval,this);},events:{"execute":j,"press":j,"release":j},properties:{interval:{check:l,init:100},firstInterval:{check:l,init:500},minTimer:{check:l,init:20},timerDecrease:{check:l,init:2}},members:{__nT:null,__nS:null,press:function(){if(this.isEnabled()){if(!this.hasState(n)){this.__nU();}this.removeState(m);this.addState(n);}},release:function(q){if(!this.isEnabled()){return;}if(this.hasState(n)){if(!this.__nT){this.execute();}}this.removeState(n);this.removeState(m);this.__nV();},_applyEnabled:function(r,s){qx.ui.form.Button.prototype._applyEnabled.call(this,r,s);if(!r){this.removeState(n);this.removeState(m);this.__nV();}},_onMouseOver:function(e){if(!this.isEnabled()||e.getTarget()!==this){return;}if(this.hasState(m)){this.removeState(m);this.addState(n);this.__nS.start();}this.addState(k);},_onMouseOut:function(e){if(!this.isEnabled()||e.getTarget()!==this){return;}this.removeState(k);if(this.hasState(n)){this.removeState(n);this.addState(m);this.__nS.stop();}},_onMouseDown:function(e){if(!e.isLeftPressed()){return;}this.capture();this.__nU();e.stopPropagation();},_onMouseUp:function(e){this.releaseCapture();if(!this.hasState(m)){this.addState(k);if(this.hasState(n)&&!this.__nT){this.execute();}}this.__nV();e.stopPropagation();},_onKeyUp:function(e){switch(e.getKeyIdentifier()){case i:case h:if(this.hasState(n)){if(!this.__nT){this.execute();}this.removeState(n);this.removeState(m);e.stopPropagation();this.__nV();}}},_onKeyDown:function(e){switch(e.getKeyIdentifier()){case i:case h:this.removeState(m);this.addState(n);e.stopPropagation();this.__nU();}},_onInterval:function(e){this.__nT=true;this.fireEvent(b);},__nU:function(){this.fireEvent(g);this.__nT=false;this.__nS.set({interval:this.getInterval(),firstInterval:this.getFirstInterval(),minimum:this.getMinTimer(),decrease:this.getTimerDecrease()}).start();this.removeState(m);this.addState(n);},__nV:function(){this.fireEvent(d);this.__nS.stop();this.removeState(m);this.removeState(n);}},destruct:function(){this._disposeObjects(c);}});})();(function(){var e="Integer",d="interval",c="qx.event.type.Event",b="qx.event.AcceleratingTimer",a="__qn";qx.Class.define(b,{extend:qx.core.Object,construct:function(){qx.core.Object.call(this);this.__qn=new qx.event.Timer(this.getInterval());this.__qn.addListener(d,this._onInterval,this);},events:{"interval":c},properties:{interval:{check:e,init:100},firstInterval:{check:e,init:500},minimum:{check:e,init:20},decrease:{check:e,init:2}},members:{__qn:null,__qo:null,start:function(){this.__qn.setInterval(this.getFirstInterval());this.__qn.start();},stop:function(){this.__qn.stop();this.__qo=null;},_onInterval:function(){this.__qn.stop();if(this.__qo==null){this.__qo=this.getInterval();}this.__qo=Math.max(this.getMinimum(),this.__qo-this.getDecrease());this.__qn.setInterval(this.__qo);this.__qn.start();this.fireEvent(d);}},destruct:function(){this._disposeObjects(a);}});})();(function(){var n="_applyLayoutChange",m="left",k="center",j="top",h="Decorator",g="middle",f="_applyReversed",e="bottom",d="Boolean",c="right",a="Integer",b="qx.ui.layout.HBox";qx.Class.define(b,{extend:qx.ui.layout.Abstract,construct:function(o,p,q){qx.ui.layout.Abstract.call(this);if(o){this.setSpacing(o);}if(p){this.setAlignX(p);}if(q){this.setSeparator(q);}},properties:{alignX:{check:[m,k,c],init:m,apply:n},alignY:{check:[j,g,e],init:j,apply:n},spacing:{check:a,init:0,apply:n},separator:{check:h,nullable:true,apply:n},reversed:{check:d,init:false,apply:f}},members:{__cP:null,__cQ:null,__cR:null,__cS:null,_applyReversed:function(){this._invalidChildrenCache=true;this._applyLayoutChange();},__cT:function(){var w=this._getLayoutChildren();var length=w.length;var t=false;var r=this.__cP&&this.__cP.length!=length&&this.__cQ&&this.__cP;var u;var s=r?this.__cP:new Array(length);var v=r?this.__cQ:new Array(length);if(this.getReversed()){w=w.concat().reverse();}for(var i=0;i<length;i++){u=w[i].getLayoutProperties();if(u.width!=null){s[i]=parseFloat(u.width)/100;}if(u.flex!=null){v[i]=u.flex;t=true;}else{v[i]=0;}}if(!r){this.__cP=s;this.__cQ=v;}this.__cR=t;this.__cS=w;delete this._invalidChildrenCache;},verifyLayoutProperty:null,renderLayout:function(x,y){if(this._invalidChildrenCache){this.__cT();}var E=this.__cS;var length=E.length;var N=qx.ui.layout.Util;var M=this.getSpacing();var Q=this.getSeparator();if(Q){var B=N.computeHorizontalSeparatorGaps(E,M,Q);}else{var B=N.computeHorizontalGaps(E,M,true);}var i,z,K,J;var P=[];var F=B;for(i=0;i<length;i+=1){J=this.__cP[i];K=J!=null?Math.floor((x-B)*J):E[i].getSizeHint().width;P.push(K);F+=K;}if(this.__cR&&F!=x){var H={};var L,O;for(i=0;i<length;i+=1){L=this.__cQ[i];if(L>0){G=E[i].getSizeHint();H[i]={min:G.minWidth,value:P[i],max:G.maxWidth,flex:L};}}var C=N.computeFlexOffsets(H,x,F);for(i in C){O=C[i].offset;P[i]+=O;F+=O;}}var U=E[0].getMarginLeft();if(F<x&&this.getAlignX()!=m){U=x-F;if(this.getAlignX()===k){U=Math.round(U/2);}}var G,top,A,K,D,S,I;var M=this.getSpacing();this._clearSeparators();if(Q){var R=qx.theme.manager.Decoration.getInstance().resolve(Q).getInsets();var T=R.left+R.right;}for(i=0;i<length;i+=1){z=E[i];K=P[i];G=z.getSizeHint();S=z.getMarginTop();I=z.getMarginBottom();A=Math.max(G.minHeight,Math.min(y-S-I,G.maxHeight));top=N.computeVerticalAlignOffset(z.getAlignY()||this.getAlignY(),A,y,S,I);if(i>0){if(Q){U+=D+M;this._renderSeparator(Q,{left:U,top:0,width:T,height:y});U+=T+M+z.getMarginLeft();}else{U+=N.collapseMargins(M,D,z.getMarginLeft());}}z.renderLayout(U,top,K,A);U+=K;D=z.getMarginRight();}},_computeSizeHint:function(){if(this._invalidChildrenCache){this.__cT();}var bc=qx.ui.layout.Util;var bk=this.__cS;var V=0,bd=0,ba=0;var Y=0,bb=0;var bh,W,bj;for(var i=0,l=bk.length;i<l;i+=1){bh=bk[i];W=bh.getSizeHint();bd+=W.width;var bg=this.__cQ[i];var X=this.__cP[i];if(bg){V+=W.minWidth;}else if(X){ba=Math.max(ba,Math.round(W.minWidth/X));}else{V+=W.width;}bj=bh.getMarginTop()+bh.getMarginBottom();if((W.height+bj)>bb){bb=W.height+bj;}if((W.minHeight+bj)>Y){Y=W.minHeight+bj;}}V+=ba;var bf=this.getSpacing();var bi=this.getSeparator();if(bi){var be=bc.computeHorizontalSeparatorGaps(bk,bf,bi);}else{var be=bc.computeHorizontalGaps(bk,bf,true);}return {minWidth:V+be,width:bd+be,minHeight:Y,height:bb};}},destruct:function(){this.__cP=this.__cQ=this.__cS=null;}});})();(function(){var m="resize",l="scrollY",k="update",j="scrollX",i="_applyScrollX",h="_applyScrollY",g="qx.lang.Type.isNumber(value)&&value>=0&&value<=this.getScrollMaxX()",f="appear",d="qx.lang.Type.isNumber(value)&&value>=0&&value<=this.getScrollMaxY()",c="qx.event.type.Event",a="qx.ui.core.scroll.ScrollPane",b="scroll";qx.Class.define(a,{extend:qx.ui.core.Widget,construct:function(){qx.ui.core.Widget.call(this);this.set({minWidth:0,minHeight:0});this._setLayout(new qx.ui.layout.Grow());this.addListener(m,this._onUpdate);var n=this.getContentElement();n.addListener(b,this._onScroll,this);n.addListener(f,this._onAppear,this);},events:{update:c},properties:{scrollX:{check:g,apply:i,event:j,init:0},scrollY:{check:d,apply:h,event:l,init:0}},members:{add:function(o){var p=this._getChildren()[0];if(p){this._remove(p);p.removeListener(m,this._onUpdate,this);}if(o){this._add(o);o.addListener(m,this._onUpdate,this);}},remove:function(q){if(q){this._remove(q);q.removeListener(m,this._onUpdate,this);}},getChildren:function(){return this._getChildren();},_onUpdate:function(e){this.fireEvent(k);},_onScroll:function(e){var r=this.getContentElement();this.setScrollX(r.getScrollX());this.setScrollY(r.getScrollY());},_onAppear:function(e){var v=this.getContentElement();var s=this.getScrollX();var t=v.getScrollX();if(s!=t){v.scrollToX(s);}var w=this.getScrollY();var u=v.getScrollY();if(w!=u){v.scrollToY(w);}},getItemTop:function(z){var top=0;do{top+=z.getBounds().top;z=z.getLayoutParent();}while(z&&z!==this);return top;},getItemBottom:function(A){return this.getItemTop(A)+A.getBounds().height;},getItemLeft:function(B){var C=0;var parent;do{C+=B.getBounds().left;parent=B.getLayoutParent();if(parent){C+=parent.getInsets().left;}B=parent;}while(B&&B!==this);return C;},getItemRight:function(D){return this.getItemLeft(D)+D.getBounds().width;},getScrollSize:function(){return this.getChildren()[0].getBounds();},getScrollMaxX:function(){var F=this.getInnerSize();var E=this.getScrollSize();if(F&&E){return Math.max(0,E.width-F.width);}return 0;},getScrollMaxY:function(){var H=this.getInnerSize();var G=this.getScrollSize();if(H&&G){return Math.max(0,G.height-H.height);}return 0;},scrollToX:function(I){var J=this.getScrollMaxX();if(I<0){I=0;}else if(I>J){I=J;}this.setScrollX(I);},scrollToY:function(K){var L=this.getScrollMaxY();if(K<0){K=0;}else if(K>L){K=L;}this.setScrollY(K);},scrollByX:function(x){this.scrollToX(this.getScrollX()+x);},scrollByY:function(y){this.scrollToY(this.getScrollY()+y);},_applyScrollX:function(M){this.getContentElement().scrollToX(M);},_applyScrollY:function(N){this.getContentElement().scrollToY(N);}}});})();(function(){var a="qx.ui.layout.Grow";qx.Class.define(a,{extend:qx.ui.layout.Abstract,members:{verifyLayoutProperty:null,renderLayout:function(b,c){var g=this._getLayoutChildren();var f,h,e,d;for(var i=0,l=g.length;i<l;i++){f=g[i];h=f.getSizeHint();e=b;if(e<h.minWidth){e=h.minWidth;}else if(e>h.maxWidth){e=h.maxWidth;}d=c;if(d<h.minHeight){d=h.minHeight;}else if(d>h.maxHeight){d=h.maxHeight;}f.renderLayout(0,0,e,d);}},_computeSizeHint:function(){var q=this._getLayoutChildren();var o,s;var r=0,p=0;var n=0,k=0;var j=Infinity,m=Infinity;for(var i=0,l=q.length;i<l;i++){o=q[i];s=o.getSizeHint();r=Math.max(r,s.width);p=Math.max(p,s.height);n=Math.max(n,s.minWidth);k=Math.max(k,s.minHeight);j=Math.min(j,s.maxWidth);m=Math.min(m,s.maxHeight);}return {width:r,height:p,minWidth:n,minHeight:k,maxWidth:j,maxHeight:m};}}});})();(function(){var m="open",k="icon",j="auto",h="middle",g="String",f="label",d="changeOpen",c="excluded",b="visible",a="opened",H="always",G="qx.ui.tree.AbstractTreeItem",F="_applyIconOpened",E="Boolean",D="__px",C="Integer",B="_applyIndent",A="changeOpenSymbolMode",z="_applyOpenSymbolMode",y="__pu",t="__pt",u="resize",r="",s="removeItem",p="addItem",q="iconOpened",n="abstract",o="never",v="_applyIcon",w="_applyOpen",x="_applyLabel";qx.Class.define(G,{extend:qx.ui.core.Widget,type:n,include:[qx.ui.form.MModelProperty],implement:[qx.ui.form.IModel],construct:function(){qx.ui.core.Widget.call(this);this.__pt=[];this._setLayout(new qx.ui.layout.HBox());this._addWidgets();this.initOpen();},properties:{open:{check:E,init:false,event:d,apply:w},openSymbolMode:{check:[H,o,j],init:j,event:A,apply:z},indent:{check:C,init:19,apply:B,themeable:true},parent:{check:G,nullable:true},icon:{check:g,apply:v,nullable:true,themeable:true},iconOpened:{check:g,apply:F,nullable:true,themeable:true},label:{check:g,apply:x,init:r}},members:{__pt:null,__pu:null,__pv:null,__pw:null,__px:null,__py:null,_addWidgets:function(){throw new Error("Abstract method call.");},_createChildControlImpl:function(I,J){var K;switch(I){case f:K=new qx.ui.basic.Label().set({alignY:h,value:this.getLabel()});break;case k:K=new qx.ui.basic.Image().set({alignY:h,source:this.getIcon()});break;case m:K=new qx.ui.tree.FolderOpenButton().set({alignY:h});K.addListener(d,this._onChangeOpen,this);K.addListener(u,this._updateIndent,this);break;}return K||qx.ui.core.Widget.prototype._createChildControlImpl.call(this,I);},getTree:function(){var M=this;while(M.getParent()){M=M.getParent();}var L=M.getLayoutParent()?M.getLayoutParent().getLayoutParent():0;if(L&&L instanceof qx.ui.core.scroll.ScrollPane){return L.getLayoutParent();}return null;},addWidget:function(N,O){this._add(N,O);},addSpacer:function(){if(!this.__px){this.__px=new qx.ui.core.Spacer();}else{this._remove(this.__px);}this._add(this.__px);},addOpenButton:function(){this._add(this.getChildControl(m));},_onChangeOpen:function(e){if(this.isOpenable()){this.setOpen(e.getData());}},addIcon:function(){var P=this.getChildControl(k);if(this.__pw){this._remove(P);}this._add(P);this.__pw=true;},addLabel:function(Q){var R=this.getChildControl(f);if(this.__pv){this._remove(R);}if(Q){this.setLabel(Q);}else{R.setValue(this.getLabel());}this._add(R);this.__pv=true;},addState:function(S){qx.ui.core.Widget.prototype.addState.call(this,S);var U=this._getChildren();for(var i=0,l=U.length;i<l;i++){var T=U[i];if(T.addState){U[i].addState(S);}}},removeState:function(V){qx.ui.core.Widget.prototype.removeState.call(this,V);var X=this._getChildren();for(var i=0,l=X.length;i<l;i++){var W=X[i];if(W.addState){X[i].removeState(V);}}},_applyIcon:function(Y,ba){if(!this.__pA()){this.__pB(Y);}else if(!this.isOpen()){this.__pB(Y);}},_applyIconOpened:function(bb,bc){if(this.isOpen()){if(this.__pz()&&this.__pA()){this.__pB(bb);}else if(!this.__pz()&&this.__pA()){this.__pB(bb);}}},_applyLabel:function(bd,be){var bf=this.getChildControl(f,true);if(bf){bf.setValue(bd);}},_applyOpen:function(bg,bh){if(this.hasChildren()){this.getChildrenContainer().setVisibility(bg?b:c);}var open=this.getChildControl(m,true);if(open){open.setOpen(bg);}var bi;if(bg){bi=this.__pA()?this.getIconOpened():null;}else{bi=this.getIcon();}if(bi){this.__pB(bi);}bg?this.addState(a):this.removeState(a);},__pz:function(){return qx.util.PropertyUtil.getUserValue(this,k);},__pA:function(){return qx.util.PropertyUtil.getUserValue(this,q);},__pB:function(bj){var bk=this.getChildControl(k,true);if(bk){bk.setSource(bj);}},isOpenable:function(){var bl=this.getOpenSymbolMode();return (bl===H||bl===j&&this.hasChildren());},_shouldShowOpenSymbol:function(){var open=this.getChildControl(m,true);if(!open){return false;}var bm=this.getTree();if(!bm.getRootOpenClose()){if(bm.getHideRoot()){if(bm.getRoot()==this.getParent()){return false;}}else{if(bm.getRoot()==this){return false;}}}return this.isOpenable();},_applyOpenSymbolMode:function(bn,bo){this._updateIndent();},_updateIndent:function(){if(!this.getTree()){return;}var bq=0;var open=this.getChildControl(m,true);if(open){if(this._shouldShowOpenSymbol()){open.show();var bp=open.getBounds();if(bp){bq=bp.width;}else{return;}}else{open.exclude();}}if(this.__px){this.__px.setWidth((this.getLevel()+1)*this.getIndent()-bq);}},_applyIndent:function(br,bs){this._updateIndent();},getLevel:function(){var bt=this.getTree();if(!bt){return;}var bu=this;var bv=-1;while(bu){bu=bu.getParent();bv+=1;}if(bt.getHideRoot()){bv-=1;}if(!bt.getRootOpenClose()){bv-=1;}return bv;},syncWidget:function(){this._updateIndent();},getChildrenContainer:function(){if(!this.__pu){this.__pu=new qx.ui.container.Composite(new qx.ui.layout.VBox()).set({visibility:this.isOpen()?b:c});}return this.__pu;},hasChildrenContainer:function(){return this.__pu;},getParentChildrenContainer:function(){if(this.getParent()){return this.getParent().getChildrenContainer();}else if(this.getLayoutParent()){return this.getLayoutParent();}else{return null;}},getChildren:function(){return this.__pt;},hasChildren:function(){return this.__pt?this.__pt.length>0:false;},getItems:function(bw,bx,by){if(by!==false){var bz=[];}else{var bz=[this];}var bC=this.hasChildren()&&(bx!==false||this.isOpen());if(bC){var bB=this.getChildren();if(bw===false){bz=bz.concat(bB);}else{for(var i=0,bA=bB.length;i<bA;i++){bz=bz.concat(bB[i].getItems(bw,bx,false));}}}return bz;},recursiveAddToWidgetQueue:function(){var bD=this.getItems(true,true,false);for(var i=0,l=bD.length;i<l;i++){qx.ui.core.queue.Widget.add(bD[i]);}},__pC:function(){if(this.getParentChildrenContainer()){this.getParentChildrenContainer()._addAfter(this.getChildrenContainer(),this);}},add:function(bE){var bF=this.getChildrenContainer();var bI=this.getTree();for(var i=0,l=arguments.length;i<l;i++){var bJ=arguments[i];var bH=bJ.getParent();if(bH){bH.remove(bJ);}bJ.setParent(this);var bG=this.hasChildren();bF.add(bJ);if(bJ.hasChildren()){bF.add(bJ.getChildrenContainer());}this.__pt.push(bJ);if(!bG){this.__pC();}if(bI){bJ.recursiveAddToWidgetQueue();bI.fireNonBubblingEvent(p,qx.event.type.Data,[bJ]);}}if(bI){qx.ui.core.queue.Widget.add(this);}},addAt:function(bK,bL){{};if(bL==this.__pt.length){this.add(bK);return;}var bP=bK.getParent();if(bP){bP.remove(bK);}var bN=this.getChildrenContainer();bK.setParent(this);var bO=this.hasChildren();var bM=this.__pt[bL];bN.addBefore(bK,bM);if(bK.hasChildren()){bN.addAfter(bK.getChildrenContainer(),bK);}qx.lang.Array.insertAt(this.__pt,bK,bL);if(!bO){this.__pC();}if(this.getTree()){bK.recursiveAddToWidgetQueue();qx.ui.core.queue.Widget.add(this);}},addBefore:function(bQ,bR){{};var bS=bQ.getParent();if(bS){bS.remove(bQ);}this.addAt(bQ,this.__pt.indexOf(bR));},addAfter:function(bT,bU){{};var bV=bT.getParent();if(bV){bV.remove(bT);}this.addAt(bT,this.__pt.indexOf(bU)+1);},addAtBegin:function(bW){this.addAt(bW,0);},remove:function(bX){for(var i=0,l=arguments.length;i<l;i++){var cc=arguments[i];if(this.__pt.indexOf(cc)==-1){this.warn("Cannot remove treeitem '"+cc+"'. It is not a child of this tree item.");return;}var bY=this.getChildrenContainer();if(cc.hasChildrenContainer()){var cb=cc.getChildrenContainer();if(bY.getChildren().indexOf(cb)>=0){bY.remove(cb);}}qx.lang.Array.remove(this.__pt,cc);cc.setParent(null);bY.remove(cc);}var ca=this.getTree();if(ca){ca.fireNonBubblingEvent(s,qx.event.type.Data,[cc]);}qx.ui.core.queue.Widget.add(this);},removeAt:function(cd){var ce=this.__pt[cd];if(ce){this.remove(ce);}},removeAll:function(){for(var i=this.__pt.length-1;i>=0;i--){this.remove(this.__pt[i]);}}},destruct:function(){this._disposeArray(t);this._disposeObjects(D,y);}});})();(function(){var i="opened",h="click",g="changeOpen",f="Boolean",d="qx.ui.tree.FolderOpenButton",c="_applyOpen",b="mouseup",a="mousedown";qx.Class.define(d,{extend:qx.ui.basic.Image,include:qx.ui.core.MExecutable,construct:function(){qx.ui.basic.Image.call(this);this.initOpen();this.addListener(h,this._onClick);this.addListener(a,this._stopPropagation,this);this.addListener(b,this._stopPropagation,this);},properties:{open:{check:f,init:false,event:g,apply:c}},members:{_applyOpen:function(j,k){j?this.addState(i):this.removeState(i);this.execute();},_stopPropagation:function(e){e.stopPropagation();},_onClick:function(e){this.toggleOpen();e.stopPropagation();}}});})();(function(){var a="qx.ui.core.Spacer";qx.Class.define(a,{extend:qx.ui.core.LayoutItem,construct:function(b,c){qx.ui.core.LayoutItem.call(this);this.setWidth(b!=null?b:0);this.setHeight(c!=null?c:0);},members:{checkAppearanceNeeds:function(){},addChildrenToQueue:function(d){},destroy:function(){if(this.$$disposed){return;}var parent=this.$$parent;if(parent){parent._remove(this);}qx.ui.core.queue.Dispose.add(this);}}});})();(function(){var d="$$theme_",c="$$user_",b="$$init_",a="qx.util.PropertyUtil";qx.Class.define(a,{statics:{getProperties:function(e){return e.$$properties;},getAllProperties:function(f){var i={};var j=f;while(j!=qx.core.Object){var h=this.getProperties(j);for(var g in h){i[g]=h[g];}j=j.superclass;}return i;},getUserValue:function(k,l){return k[c+l];},setUserValue:function(m,n,o){m[c+n]=o;},deleteUserValue:function(p,q){delete (p[c+q]);},getInitValue:function(r,s){return r[b+s];},setInitValue:function(t,u,v){t[b+u]=v;},deleteInitValue:function(w,x){delete (w[b+x]);},getThemeValue:function(y,z){return y[d+z];},setThemeValue:function(A,B,C){A[d+B]=C;},deleteThemeValue:function(D,E){delete (D[d+E]);},setThemed:function(F,G,H){var I=qx.core.Property.$$method.setThemed;F[I[G]](H);},resetThemed:function(J,K){var L=qx.core.Property.$$method.resetThemed;J[L[K]]();}}});})();(function(){var b="tree-folder",a="qx.ui.tree.TreeFolder";qx.Class.define(a,{extend:qx.ui.tree.AbstractTreeItem,construct:function(c){qx.ui.tree.AbstractTreeItem.call(this);if(c){this.setLabel(c);}},properties:{appearance:{refine:true,init:b}},members:{_addWidgets:function(){this.addSpacer();this.addOpenButton();this.addIcon();this.addLabel();}}});})();(function(){var o="",n="/",m="i",k="ICON_",j="separator-vertical",h="sinput",g=")",f="failed",d="CLASS",c="INTERFACE",H="__SV",G="listdata",F="1*",E="#",D="PACKAGE",C="0*",B="changeSelection",A="Search...",z="Results",y="__SW",v="(",w="completed",t="./script/apiindex.json",u="keyup",r="s",s=" Result",p="apiviewer.ui.SearchView",q="appear",x="disappear";qx.Class.define(p,{extend:qx.ui.container.Composite,construct:function(){qx.ui.container.Composite.call(this);var I=new qx.ui.layout.VBox();I.setSeparator(j);this.setLayout(I);this.__SU=false;this.listdata=[];this.apiindex={};this._showSearchForm();},members:{__SV:null,__SW:null,__SU:null,__SX:null,_showSearchForm:function(){var Q=new qx.ui.layout.HBox(4);var K=new qx.ui.container.Composite(Q);K.setPadding(10);this.sinput=new qx.ui.form.TextField().set({allowGrowY:true,placeholder:A});this.__SW=new qx.ui.form.Button("Find");this.__SW.setEnabled(false);K.add(this.sinput,{flex:1});K.add(this.__SW);this.add(K);var O=[];var N=this._tableModel=new qx.ui.table.model.Simple();N.setColumns([o,z]);N.setData(O);var J={tableColumnModel:function(R){return new qx.ui.table.columnmodel.Resize(R);}};var P=new qx.ui.table.Table(N,J);P.setDecorator(null);P.setShowCellFocusIndicator(false);P.setStatusBarVisible(false);P.setColumnVisibilityButtonVisible(false);this._selectionModel=P.getSelectionManager().getSelectionModel();this._selectionModel.addListener(B,this._callDetailFrame,this);this._table=P;var M=P.getTableColumnModel();var L=M.getBehavior();L.set(0,{width:C,minWidth:42,maxWidth:100});L.set(1,{width:F});var M=P.getTableColumnModel();M.setDataCellRenderer(0,new qx.ui.table.cellrenderer.Image());this.__SU=true;this.__SX=P;P.addListener(q,this.__Ta,this);P.addListener(x,function(e){this.__SV.hide();},this);this.add(P,{flex:1});qx.event.Timer.once(this._load,this,0);this.sinput.focus();this.sinput.addListener(u,function(e){this._searchResult(this.sinput.getValue()||o);},this);},_searchResult:function(S){var S=qx.lang.String.trim(S);if(S.length>0){this.__SV.hide();}else{this.__SV.show();}if(S.length<3){if(this.__SU){this.listdata.splice(0,this.listdata.length);}this._resetElements();return;}else{var U=[];try{var T=this._validateInput(S);new RegExp(T[0]);this.__SW.setEnabled(true);}catch(V){if(this.__SU){this.listdata.splice(0,this.listdata.length);}this._resetElements();return;}U=this._searchIndex(T[0],T[1]);this._tableModel.setColumns([o,(U.length+s+((U.length!=1)?r:o))]);this._tableModel.setData(U);this._table.resetSelection();}},_validateInput:function(W){var X=[];if(/^([\w\.]*\w+)(#\w+|\.\w+\(\)|#\.[\*|\+|\?]?)?$/.test(W)){if(RegExp.$2&&RegExp.$2.length>1){X=[RegExp.$2,RegExp.$1];}else if(RegExp.$1.length>1){X=[RegExp.$1,null];}else{return null;}}else{X=[W,null];}return X;},_searchIndex:function(Y,ba){var bf=[];var bd=new RegExp(Y,(/^.*[A-Z].*$/).test(Y)?o:m);var bb=this.apiindex.__index__;var be=this.apiindex.__fullNames__;var bi=this.apiindex.__types__;for(var bg in bb){if(bd.test(bg)){if(ba){for(var i=0,l=bb[bg].length;i<l;i++){var bh=be[bb[bg][i][1]];if(new RegExp(ba,m).test(bh)){var bc=bi[bb[bg][i][0]].toUpperCase();var bj=apiviewer.TreeUtil[k+bc];bf.push([bj,bh+bg]);}}}else{for(var i=0,l=bb[bg].length;i<l;i++){bc=bi[bb[bg][i][0]].toUpperCase();bh=be[bb[bg][i][1]];if(bc==d){bj=apiviewer.TreeUtil.getIconUrl(apiviewer.dao.Class.getClassByName(bh));}else{if(bc!=D&&bc!=c){bh+=bg;}bj=apiviewer.TreeUtil[k+bc];}bf.push([bj,bh]);}}}}return bf;},_setListdata:function(bk){bk.sort(function(a,b){if(a[1]<b[1]){return -1;}if(a[1]>b[1]){return 1;}return 0;});for(var i=0,l=bk.length;i<l;i++){var bl=bk[i][0];var bm={icon:bl,html:o,iconWidth:18,iconHeight:18};this.listdata.push({icon:bm,result:{text:bk[i][1]}});}},_sortByIcons:function(a,b){var bp={"package":0,"class":1,"interface":2,"mixin":3,"method_public":4,"method_protected":5,"method_private":6,"property":7,"property_protected":8,"property_private":9,"event":10,"constructor":11,"constant":12,"childControl":13};var bn=a.substr(a.lastIndexOf(n)+1);var bo=b.substr(b.lastIndexOf(n)+1);a=bp[bn.substr(0,bn.length-6)];b=bp[bo.substr(0,bo.length-6)];return a-b;},_load:function(){var bq=t;var br=new qx.io.remote.Request(bq);br.setAsynchronous(true);br.setTimeout(30000);br.setProhibitCaching(false);br.addListener(w,function(bs){this.apiindex=eval(v+bs.getContent()+g);},this);br.addListener(f,function(bt){this.warn("Couldn't load file: "+bq);},this);br.send();},_callDetailFrame:function(){var bv=this._selectionModel.getAnchorSelectionIndex();var by=this._tableModel.getData()[bv];var bA=qx.core.Init.getApplication().controller;var bu=apiviewer.UiModel.getInstance();if(by!=undefined){var bB=by[1];var bw=by[0];var bz=bB;var bC=null;var bx=bB.indexOf(E);if(bx!=-1){bz=bB.substring(0,bx);bC=bB.substring(bx+1);}if(/protected/.test(bw)){bu.setShowProtected(true);}else if(/private/.test(bw)){bu.setShowPrivate(true);}bA._updateHistory(bB);}},_resetElements:function(){this._tableModel.setData([]);this._tableModel.setColumns([o,o]);this.__SW.setEnabled(false);},__SY:function(bD){this.__SV=new qx.ui.popup.Popup(new qx.ui.layout.Canvas).set({autoHide:false,width:170});var bE=this.tr("Hint: You can use regular expressions in the search field.");var bF=new qx.ui.basic.Label(bE);bF.setRich(true);this.__SV.add(bF,{edge:3});this.__SV.setPosition("bottom-left");this.__SV.placeToWidget(this.sinput,false);this.__SV.show();},__Ta:function(e){if(this.__SV){if(qx.lang.String.trim(this.sinput.getValue()||o).length==0){this.__SV.show();}}else{this.__SY();}}},destruct:function(){this.apiindex=this._table=this.__SX=this._tableModel=this._selectionModel=null;this._disposeObjects(h,y,H);this._disposeArray(G);}});})();(function(){var k="showingPlaceholder",j="",i="none",h="qx.dynlocale",g="Boolean",f="qx.client",d="color",c="qx.event.type.Data",b="readonly",a="placeholder",Y="input",X="focusin",W="visibility",V="focusout",U="changeLocale",T="on",S="readOnly",R="text",Q="_applyTextAlign",P="px",r="RegExp",s=")",p="syncAppearance",q="change",n="textAlign",o="focused",l="center",m="visible",v="disabled",w="url(",D="off",B="String",H="resize",F="qx.ui.form.AbstractField",L="transparent",J="spellcheck",y="false",O="right",N="PositiveInteger",M="mshtml",x="abstract",z="block",A="webkit",C="_applyReadOnly",E="_applyPlaceholder",G="hidden",I="left",K="qx/static/blank.gif",t="changeReadOnly",u="absolute";qx.Class.define(F,{extend:qx.ui.core.Widget,implement:[qx.ui.form.IStringForm,qx.ui.form.IForm],include:[qx.ui.form.MForm],type:x,construct:function(ba){qx.ui.core.Widget.call(this);this.__H=!qx.bom.client.Feature.PLACEHOLDER;if(ba!=null){this.setValue(ba);}this.getContentElement().addListener(q,this._onChangeContent,this);if(this.__H){this.addListener(p,this._syncPlaceholder,this);}if(qx.core.Variant.isSet(h,T)){qx.locale.Manager.getInstance().addListener(U,this._onChangeLocale,this);}},events:{"input":c,"changeValue":c},properties:{textAlign:{check:[I,l,O],nullable:true,themeable:true,apply:Q},readOnly:{check:g,apply:C,event:t,init:false},selectable:{refine:true,init:true},focusable:{refine:true,init:true},maxLength:{check:N,init:Infinity},liveUpdate:{check:g,init:false},placeholder:{check:B,nullable:true,apply:E},filter:{check:r,nullable:true,init:null}},members:{__I:true,__J:null,__K:null,__L:null,__H:true,getFocusElement:function(){var bb=this.getContentElement();if(bb){return bb;}},_createInputElement:function(){return new qx.html.Input(R);},renderLayout:function(bc,top,bd,be){var bf=this._updateInsets;var bj=qx.ui.core.Widget.prototype.renderLayout.call(this,bc,top,bd,be);if(!bj){return;}var bh=bj.size||bf;var bk=P;if(bh||bj.local||bj.margin){var bg=this.getInsets();var innerWidth=bd-bg.left-bg.right;var innerHeight=be-bg.top-bg.bottom;innerWidth=innerWidth<0?0:innerWidth;innerHeight=innerHeight<0?0:innerHeight;}var bi=this.getContentElement();if(bf&&this.__H){this.__O().setStyles({"left":bg.left+bk,"top":bg.top+bk});}if(bh){if(this.__H){this.__O().setStyles({"width":innerWidth+bk,"height":innerHeight+bk});}bi.setStyles({"width":innerWidth+bk,"height":innerHeight+bk});this._renderContentElement(innerHeight,bi);}},_renderContentElement:function(innerHeight,bl){},_createContentElement:function(){var bm=this._createInputElement();bm.setStyles({"border":i,"padding":0,"margin":0,"display":z,"background":L,"outline":i,"appearance":i,"position":u,"autoComplete":D});bm.setSelectable(this.getSelectable());bm.setEnabled(this.getEnabled());bm.addListener(Y,this._onHtmlInput,this);bm.setAttribute(J,y);if(qx.core.Variant.isSet(f,A)){bm.setStyle(H,i);}if(qx.core.Variant.isSet(f,M)){bm.setStyles({backgroundImage:w+qx.util.ResourceManager.getInstance().toUri(K)+s});}return bm;},_applyEnabled:function(bn,bo){qx.ui.core.Widget.prototype._applyEnabled.call(this,bn,bo);this.getContentElement().setEnabled(bn);if(this.__H){if(bn){this._showPlaceholder();}else{this._removePlaceholder();}}else{var bp=this.getContentElement();bp.setAttribute(a,bn?this.getPlaceholder():j);}},__M:{width:16,height:16},_getContentHint:function(){return {width:this.__M.width*10,height:this.__M.height||16};},_applyFont:function(bq,br){var bs;if(bq){var bt=qx.theme.manager.Font.getInstance().resolve(bq);bs=bt.getStyles();}else{bs=qx.bom.Font.getDefaultStyles();}this.getContentElement().setStyles(bs);if(this.__H){this.__O().setStyles(bs);}if(bq){this.__M=qx.bom.Label.getTextSize("A",bs);}else{delete this.__M;}qx.ui.core.queue.Layout.add(this);},_applyTextColor:function(bu,bv){if(bu){this.getContentElement().setStyle(d,qx.theme.manager.Color.getInstance().resolve(bu));}else{this.getContentElement().removeStyle(d);}},tabFocus:function(){qx.ui.core.Widget.prototype.tabFocus.call(this);this.selectAllText();},_getTextSize:function(){return this.__M;},_onHtmlInput:function(e){var bz=e.getData();var by=true;this.__I=false;if(this.getFilter()!=null){var bA=j;var bw=bz.search(this.getFilter());var bx=bz;while(bw>=0){bA=bA+(bx.charAt(bw));bx=bx.substring(bw+1,bx.length);bw=bx.search(this.getFilter());}if(bA!=bz){by=false;bz=bA;this.getContentElement().setValue(bz);}}if(bz.length>this.getMaxLength()){var by=false;this.getContentElement().setValue(bz.substr(0,this.getMaxLength()));}if(by){this.fireDataEvent(Y,bz,this.__L);this.__L=bz;if(this.getLiveUpdate()){this.__N(bz);}}},__N:function(bB){var bC=this.__K;this.__K=bB;if(bC!=bB){this.fireNonBubblingEvent("changeValue",qx.event.type.Data,[bB,bC]);}},setValue:function(bD){if(bD===null){if(this.__I){return bD;}bD=j;this.__I=true;}else{this.__I=false;if(this.__H){this._removePlaceholder();}}if(qx.lang.Type.isString(bD)){var bF=this.getContentElement();if(bD.length>this.getMaxLength()){bD=bD.substr(0,this.getMaxLength());}if(bF.getValue()!=bD){var bG=bF.getValue();bF.setValue(bD);var bE=this.__I?null:bD;this.__K=bG;this.__N(bE);}if(this.__H){this._showPlaceholder();}return bD;}throw new Error("Invalid value type: "+bD);},getValue:function(){var bH=this.getContentElement().getValue();return this.__I?null:bH;},resetValue:function(){this.setValue(null);},_onChangeContent:function(e){this.__I=e.getData()===null;this.__N(e.getData());},getTextSelection:function(){return this.getContentElement().getTextSelection();},getTextSelectionLength:function(){return this.getContentElement().getTextSelectionLength();},getTextSelectionStart:function(){return this.getContentElement().getTextSelectionStart();},getTextSelectionEnd:function(){return this.getContentElement().getTextSelectionEnd();},setTextSelection:function(bI,bJ){this.getContentElement().setTextSelection(bI,bJ);},clearTextSelection:function(){this.getContentElement().clearTextSelection();},selectAllText:function(){this.setTextSelection(0);},_showPlaceholder:function(){var bL=this.getValue()||j;var bK=this.getPlaceholder();if(bK!=null&&bL==j&&!this.hasState(o)&&!this.hasState(v)){if(this.hasState(k)){this._syncPlaceholder();}else{this.addState(k);}}},_removePlaceholder:function(){if(this.hasState(k)){this.__O().setStyle(W,G);this.removeState(k);}},_syncPlaceholder:function(){if(this.hasState(k)){this.__O().setStyle(W,m);}},__O:function(){if(this.__J==null){this.__J=new qx.html.Label();var bM=qx.theme.manager.Color.getInstance();this.__J.setStyles({"visibility":"hidden","zIndex":6,"position":"absolute","color":bM.resolve("text-placeholder")});this.getContainerElement().add(this.__J);}return this.__J;},_onChangeLocale:qx.core.Variant.select(h,{"on":function(e){var content=this.getPlaceholder();if(content&&content.translate){this.setPlaceholder(content.translate());}},"off":null}),_applyPlaceholder:function(bN,bO){if(this.__H){this.__O().setValue(bN);if(bN!=null){this.addListener(X,this._removePlaceholder,this);this.addListener(V,this._showPlaceholder,this);this._showPlaceholder();}else{this.removeListener(X,this._removePlaceholder,this);this.removeListener(V,this._showPlaceholder,this);this._removePlaceholder();}}else{if(this.getEnabled()){this.getContentElement().setAttribute(a,bN);}}},_applyTextAlign:function(bP,bQ){this.getContentElement().setStyle(n,bP);},_applyReadOnly:function(bR,bS){var bT=this.getContentElement();bT.setAttribute(S,bR);if(bR){this.addState(b);this.setFocusable(false);}else{this.removeState(b);this.setFocusable(true);}}},destruct:function(){this.__J=null;if(qx.core.Variant.isSet(h,T)){qx.locale.Manager.getInstance().removeListener(U,this._onChangeLocale,this);}}});})();(function(){var b="qx.ui.form.TextField",a="textfield";qx.Class.define(b,{extend:qx.ui.form.AbstractField,properties:{appearance:{refine:true,init:a},allowGrowY:{refine:true,init:false},allowShrinkY:{refine:true,init:false}},members:{_renderContentElement:function(innerHeight,c){}}});})();(function(){var k="wrap",j="value",i="textarea",h="none",g="qx.client",f="",e="input",d="qx.html.Input",c="select",b="disabled",a="read-only";qx.Class.define(d,{extend:qx.html.Element,construct:function(l,m,n){if(l===c||l===i){var o=l;}else{o=e;}qx.html.Element.call(this,o,m,n);this.__c=l;},members:{__c:null,__d:null,__e:null,_createDomElement:function(){return qx.bom.Input.create(this.__c);},_applyProperty:function(name,p){qx.html.Element.prototype._applyProperty.call(this,name,p);var q=this.getDomElement();if(name===j){qx.bom.Input.setValue(q,p);}else if(name===k){qx.bom.Input.setWrap(q,p);}},setEnabled:qx.core.Variant.select(g,{"webkit":function(r){this.__e=r;if(!r){this.setStyles({"userModify":a,"userSelect":h});}else{this.setStyles({"userModify":null,"userSelect":this.__d?null:h});}},"default":function(s){this.setAttribute(b,s===false);}}),setSelectable:qx.core.Variant.select(g,{"webkit":function(t){this.__d=t;qx.html.Element.prototype.setSelectable.call(this,this.__e&&t);},"default":function(u){qx.html.Element.prototype.setSelectable.call(this,u);}}),setValue:function(v){var w=this.getDomElement();if(w){if(w.value!=v){qx.bom.Input.setValue(w,v);}}else{this._setProperty(j,v);}return this;},getValue:function(){var x=this.getDomElement();if(x){return qx.bom.Input.getValue(x);}return this._getProperty(j)||f;},setWrap:function(y){if(this.__c===i){this._setProperty(k,y);}else{throw new Error("Text wrapping is only support by textareas!");}return this;},getWrap:function(){if(this.__c===i){return this._getProperty(k);}else{throw new Error("Text wrapping is only support by textareas!");}}}});})();(function(){var w="change",v="input",u="qx.client",t="text",s="password",r="checkbox",q="radio",p="textarea",n="keypress",m="opera",d="propertychange",k="blur",h="keydown",c="keyup",b="select-multiple",g="checked",f="value",j="select",a="qx.event.handler.Input";qx.Class.define(a,{extend:qx.core.Object,implement:qx.event.IEventHandler,construct:function(){qx.core.Object.call(this);this._onChangeCheckedWrapper=qx.lang.Function.listener(this._onChangeChecked,this);this._onChangeValueWrapper=qx.lang.Function.listener(this._onChangeValue,this);this._onInputWrapper=qx.lang.Function.listener(this._onInput,this);this._onPropertyWrapper=qx.lang.Function.listener(this._onProperty,this);if(qx.core.Variant.isSet(u,m)){this._onKeyDownWrapper=qx.lang.Function.listener(this._onKeyDown,this);this._onKeyUpWrapper=qx.lang.Function.listener(this._onKeyUp,this);this._onBlurWrapper=qx.lang.Function.listener(this._onBlur,this);}},statics:{PRIORITY:qx.event.Registration.PRIORITY_NORMAL,SUPPORTED_TYPES:{input:1,change:1},TARGET_CHECK:qx.event.IEventHandler.TARGET_DOMNODE,IGNORE_CAN_HANDLE:false},members:{__g:false,__h:null,__i:null,canHandleEvent:function(x,y){var z=x.tagName.toLowerCase();if(y===v&&(z===v||z===p)){return true;}if(y===w&&(z===v||z===p||z===j)){return true;}return false;},registerEvent:qx.core.Variant.select(u,{"mshtml":function(A,B,C){if(!A.__j){var D=A.tagName.toLowerCase();var E=A.type;if(E===t||E===s||D===p||E===r||E===q){qx.bom.Event.addNativeListener(A,d,this._onPropertyWrapper);}if(E!==r&&E!==q){qx.bom.Event.addNativeListener(A,w,this._onChangeValueWrapper);}if(E===t||E===s){this._onKeyPressWrapped=qx.lang.Function.listener(this._onKeyPress,this,A);qx.bom.Event.addNativeListener(A,n,this._onKeyPressWrapped);}A.__j=true;}},"default":function(F,G,H){if(G===v){this.__k(F);}else if(G===w){if(F.type===q||F.type===r){qx.bom.Event.addNativeListener(F,w,this._onChangeCheckedWrapper);}else{qx.bom.Event.addNativeListener(F,w,this._onChangeValueWrapper);}if(qx.core.Variant.isSet(u,m)){if(F.type===t||F.type===s){this._onKeyPressWrapped=qx.lang.Function.listener(this._onKeyPress,this,F);qx.bom.Event.addNativeListener(F,n,this._onKeyPressWrapped);}}}}}),__k:qx.core.Variant.select(u,{"mshtml":null,"webkit":function(I){var J=I.tagName.toLowerCase();if(qx.bom.client.Engine.VERSION<532&&J==p){qx.bom.Event.addNativeListener(I,n,this._onInputWrapper);}qx.bom.Event.addNativeListener(I,v,this._onInputWrapper);},"opera":function(K){qx.bom.Event.addNativeListener(K,c,this._onKeyUpWrapper);qx.bom.Event.addNativeListener(K,h,this._onKeyDownWrapper);qx.bom.Event.addNativeListener(K,k,this._onBlurWrapper);qx.bom.Event.addNativeListener(K,v,this._onInputWrapper);},"default":function(L){qx.bom.Event.addNativeListener(L,v,this._onInputWrapper);}}),unregisterEvent:qx.core.Variant.select(u,{"mshtml":function(M,N){if(M.__j){var O=M.tagName.toLowerCase();var P=M.type;if(P===t||P===s||O===p||P===r||P===q){qx.bom.Event.removeNativeListener(M,d,this._onPropertyWrapper);}if(P!==r&&P!==q){qx.bom.Event.removeNativeListener(M,w,this._onChangeValueWrapper);}if(P===t||P===s){qx.bom.Event.removeNativeListener(M,n,this._onKeyPressWrapped);}try{delete M.__j;}catch(Q){M.__j=null;}}},"default":function(R,S){if(S===v){this.__k(R);}else if(S===w){if(R.type===q||R.type===r){qx.bom.Event.removeNativeListener(R,w,this._onChangeCheckedWrapper);}else{qx.bom.Event.removeNativeListener(R,w,this._onChangeValueWrapper);}}if(qx.core.Variant.isSet(u,m)){if(R.type===t||R.type===s){qx.bom.Event.removeNativeListener(R,n,this._onKeyPressWrapped);}}}}),__l:qx.core.Variant.select(u,{"mshtml":null,"webkit":function(T){var U=T.tagName.toLowerCase();if(qx.bom.client.Engine.VERSION<532&&U==p){qx.bom.Event.removeNativeListener(T,n,this._onInputWrapper);}qx.bom.Event.removeNativeListener(T,v,this._onInputWrapper);},"opera":function(V){qx.bom.Event.removeNativeListener(V,c,this._onKeyUpWrapper);qx.bom.Event.removeNativeListener(V,h,this._onKeyDownWrapper);qx.bom.Event.removeNativeListener(V,k,this._onBlurWrapper);qx.bom.Event.removeNativeListener(V,v,this._onInputWrapper);},"default":function(W){qx.bom.Event.removeNativeListener(W,v,this._onInputWrapper);}}),_onKeyPress:qx.core.Variant.select(u,{"mshtml|opera":function(e,X){if(e.keyCode===13){if(X.value!==this.__i){this.__i=X.value;qx.event.Registration.fireEvent(X,w,qx.event.type.Data,[X.value]);}}},"default":null}),_onKeyDown:qx.core.Variant.select(u,{"opera":function(e){if(e.keyCode===13){this.__g=true;}},"default":null}),_onKeyUp:qx.core.Variant.select(u,{"opera":function(e){if(e.keyCode===13){this.__g=false;}},"default":null}),_onBlur:qx.core.Variant.select(u,{"opera":function(e){if(this.__h){window.clearTimeout(this.__h);}},"default":null}),_onInput:qx.event.GlobalError.observeMethod(function(e){var Y=qx.bom.Event.getTarget(e);if(!this.__g){if(qx.core.Variant.isSet(u,m)){this.__h=window.setTimeout(function(){qx.event.Registration.fireEvent(Y,v,qx.event.type.Data,[Y.value]);},0);}else{qx.event.Registration.fireEvent(Y,v,qx.event.type.Data,[Y.value]);}}}),_onChangeValue:qx.event.GlobalError.observeMethod(function(e){var bb=qx.bom.Event.getTarget(e);var ba=bb.value;if(bb.type===b){var ba=[];for(var i=0,o=bb.options,l=o.length;i<l;i++){if(o[i].selected){ba.push(o[i].value);}}}qx.event.Registration.fireEvent(bb,w,qx.event.type.Data,[ba]);}),_onChangeChecked:qx.event.GlobalError.observeMethod(function(e){var bc=qx.bom.Event.getTarget(e);if(bc.type===q){if(bc.checked){qx.event.Registration.fireEvent(bc,w,qx.event.type.Data,[bc.value]);}}else{qx.event.Registration.fireEvent(bc,w,qx.event.type.Data,[bc.checked]);}}),_onProperty:qx.core.Variant.select(u,{"mshtml":qx.event.GlobalError.observeMethod(function(e){var bd=qx.bom.Event.getTarget(e);var be=e.propertyName;if(be===f&&(bd.type===t||bd.type===s||bd.tagName.toLowerCase()===p)){if(!bd.$$inValueSet){qx.event.Registration.fireEvent(bd,v,qx.event.type.Data,[bd.value]);}}else if(be===g){if(bd.type===r){qx.event.Registration.fireEvent(bd,w,qx.event.type.Data,[bd.checked]);}else if(bd.checked){qx.event.Registration.fireEvent(bd,w,qx.event.type.Data,[bd.value]);}}}),"default":function(){}})},defer:function(bf){qx.event.Registration.addHandler(bf);}});})();(function(){var v="",u="select",t="soft",s="off",r="qx.client",q="textarea",p="wrap",o="text",n="mshtml",m="number",d="checkbox",k="select-one",g="input",c="option",b="value",f="radio",e="qx.bom.Input",h="nowrap",a="auto",j="normal";qx.Class.define(e,{statics:{__f:{text:1,textarea:1,select:1,checkbox:1,radio:1,password:1,hidden:1,submit:1,image:1,file:1,search:1,reset:1,button:1},create:function(w,x,y){{};var x=x?qx.lang.Object.clone(x):{};var z;if(w===q||w===u){z=w;}else{z=g;x.type=w;}return qx.bom.Element.create(z,x,y);},setValue:function(A,B){var G=A.nodeName.toLowerCase();var D=A.type;var Array=qx.lang.Array;var H=qx.lang.Type;if(typeof B===m){B+=v;}if((D===d||D===f)){if(H.isArray(B)){A.checked=Array.contains(B,A.value);}else{A.checked=A.value==B;}}else if(G===u){var C=H.isArray(B);var I=A.options;var E,F;for(var i=0,l=I.length;i<l;i++){E=I[i];F=E.getAttribute(b);if(F==null){F=E.text;}E.selected=C?Array.contains(B,F):B==F;}if(C&&B.length==0){A.selectedIndex=-1;}}else if((D===o||D===q)&&qx.core.Variant.isSet(r,n)){A.$$inValueSet=true;A.value=B;A.$$inValueSet=null;}else{A.value=B;}},getValue:function(J){var P=J.nodeName.toLowerCase();if(P===c){return (J.attributes.value||{}).specified?J.value:J.text;}if(P===u){var K=J.selectedIndex;if(K<0){return null;}var Q=[];var S=J.options;var R=J.type==k;var O=qx.bom.Input;var N;for(var i=R?K:0,M=R?K+1:S.length;i<M;i++){var L=S[i];if(L.selected){N=O.getValue(L);if(R){return N;}Q.push(N);}}return Q;}else{return (J.value||v).replace(/\r/g,v);}},setWrap:qx.core.Variant.select(r,{"mshtml":function(T,U){T.wrap=U?t:s;},"gecko|webkit":function(V,W){var Y=W?t:s;var X=W?v:a;V.setAttribute(p,Y);V.style.overflow=X;},"default":function(ba,bb){ba.style.whiteSpace=bb?j:h;}})}});})();(function(){var c="qx.event.type.Data",b="qx.event.type.Event",a="qx.ui.table.ITableModel";qx.Interface.define(a,{events:{"dataChanged":c,"metaDataChanged":b,"sorted":c},members:{getRowCount:function(){},getRowData:function(d){},getColumnCount:function(){},getColumnId:function(e){},getColumnIndexById:function(f){},getColumnName:function(g){},isColumnEditable:function(h){},isColumnSortable:function(i){},sortByColumn:function(j,k){},getSortColumnIndex:function(){},isSortAscending:function(){},prefetchRows:function(l,m){},getValue:function(n,o){},getValueById:function(p,q){},setValue:function(r,s,t){},setValueById:function(u,v,w){}}});})();(function(){var e="metaDataChanged",d="qx.event.type.Data",c="qx.event.type.Event",b="abstract",a="qx.ui.table.model.Abstract";qx.Class.define(a,{type:b,extend:qx.core.Object,implement:qx.ui.table.ITableModel,events:{"dataChanged":d,"metaDataChanged":c,"sorted":d},construct:function(){qx.core.Object.call(this);this.__vM=[];this.__vN=[];this.__vO={};},members:{__vM:null,__vN:null,__vO:null,__vP:null,init:function(f){},getRowCount:function(){throw new Error("getRowCount is abstract");},getRowData:function(g){return null;},isColumnEditable:function(h){return false;},isColumnSortable:function(j){return false;},sortByColumn:function(k,l){},getSortColumnIndex:function(){return -1;},isSortAscending:function(){return true;},prefetchRows:function(m,n){},getValue:function(o,p){throw new Error("getValue is abstract");},getValueById:function(q,r){return this.getValue(this.getColumnIndexById(q),r);},setValue:function(s,t,u){throw new Error("setValue is abstract");},setValueById:function(v,w,x){this.setValue(this.getColumnIndexById(v),w,x);},getColumnCount:function(){return this.__vM.length;},getColumnIndexById:function(y){return this.__vO[y];},getColumnId:function(z){return this.__vM[z];},getColumnName:function(A){return this.__vN[A];},setColumnIds:function(B){this.__vM=B;this.__vO={};for(var i=0;i<B.length;i++){this.__vO[B[i]]=i;}this.__vN=new Array(B.length);if(!this.__vP){this.fireEvent(e);}},setColumnNamesByIndex:function(C){if(this.__vM.length!=C.length){throw new Error("this.__columnIdArr and columnNameArr have different length: "+this.__vM.length+" != "+C.length);}this.__vN=C;this.fireEvent(e);},setColumnNamesById:function(D){this.__vN=new Array(this.__vM.length);for(var i=0;i<this.__vM.length;++i){this.__vN[i]=D[this.__vM[i]];}},setColumns:function(E,F){var G=this.__vM.length==0||F;if(F==null){if(this.__vM.length==0){F=E;}else{F=this.__vM;}}if(F.length!=E.length){throw new Error("columnIdArr and columnNameArr have different length: "+F.length+" != "+E.length);}if(G){this.__vP=true;this.setColumnIds(F);this.__vP=false;}this.setColumnNamesByIndex(E);}},destruct:function(){this.__vM=this.__vN=this.__vO=null;}});})();(function(){var e="dataChanged",d="metaDataChanged",c="qx.ui.table.model.Simple",b="Boolean",a="sorted";qx.Class.define(c,{extend:qx.ui.table.model.Abstract,construct:function(){qx.ui.table.model.Abstract.call(this);this.__xM=[];this.__xN=-1;this.__xO=[];this.__xP=null;},properties:{caseSensitiveSorting:{check:b,init:true}},statics:{_defaultSortComparatorAscending:function(f,g){var h=f[arguments.callee.columnIndex];var k=g[arguments.callee.columnIndex];if(qx.lang.Type.isNumber(h)&&qx.lang.Type.isNumber(k)){var l=isNaN(h)?isNaN(k)?0:1:isNaN(k)?-1:null;if(l!=null){return l;}}return (h>k)?1:((h==k)?0:-1);},_defaultSortComparatorInsensitiveAscending:function(m,n){var o=(m[arguments.callee.columnIndex].toLowerCase?m[arguments.callee.columnIndex].toLowerCase():m[arguments.callee.columnIndex]);var p=(n[arguments.callee.columnIndex].toLowerCase?n[arguments.callee.columnIndex].toLowerCase():n[arguments.callee.columnIndex]);if(qx.lang.Type.isNumber(o)&&qx.lang.Type.isNumber(p)){var q=isNaN(o)?isNaN(p)?0:1:isNaN(p)?-1:null;if(q!=null){return q;}}return (o>p)?1:((o==p)?0:-1);},_defaultSortComparatorDescending:function(r,s){var t=r[arguments.callee.columnIndex];var u=s[arguments.callee.columnIndex];if(qx.lang.Type.isNumber(t)&&qx.lang.Type.isNumber(u)){var v=isNaN(t)?isNaN(u)?0:1:isNaN(u)?-1:null;if(v!=null){return v;}}return (t<u)?1:((t==u)?0:-1);},_defaultSortComparatorInsensitiveDescending:function(w,x){var y=(w[arguments.callee.columnIndex].toLowerCase?w[arguments.callee.columnIndex].toLowerCase():w[arguments.callee.columnIndex]);var z=(x[arguments.callee.columnIndex].toLowerCase?x[arguments.callee.columnIndex].toLowerCase():x[arguments.callee.columnIndex]);if(qx.lang.Type.isNumber(y)&&qx.lang.Type.isNumber(z)){var A=isNaN(y)?isNaN(z)?0:1:isNaN(z)?-1:null;if(A!=null){return A;}}return (y<z)?1:((y==z)?0:-1);}},members:{__xM:null,__xP:null,__xQ:null,__xO:null,__xN:null,__xR:null,getRowData:function(B){var C=this.__xM[B];if(C==null||C.originalData==null){return C;}else{return C.originalData;}},getRowDataAsMap:function(D){var F=this.__xM[D];if(F!=null){var E={};for(var G=0;G<this.getColumnCount();G++){E[this.getColumnId(G)]=F[G];}if(F.originalData!=null){for(var H in F.originalData){if(E[H]==undefined){E[H]=F.originalData[H];}}}return E;}return (F&&F.originalData)?F.originalData:null;},getDataAsMapArray:function(){var J=this.getRowCount();var I=[];for(var i=0;i<J;i++){I.push(this.getRowDataAsMap(i));}return I;},setEditable:function(K){this.__xP=[];for(var L=0;L<this.getColumnCount();L++){this.__xP[L]=K;}this.fireEvent(d);},setColumnEditable:function(M,N){if(N!=this.isColumnEditable(M)){if(this.__xP==null){this.__xP=[];}this.__xP[M]=N;this.fireEvent(d);}},isColumnEditable:function(O){return this.__xP?(this.__xP[O]==true):false;},setColumnSortable:function(P,Q){if(Q!=this.isColumnSortable(P)){if(this.__xQ==null){this.__xQ=[];}this.__xQ[P]=Q;this.fireEvent(d);}},isColumnSortable:function(R){return (this.__xQ?(this.__xQ[R]!==false):true);},sortByColumn:function(S,T){var W;var V=this.__xO[S];if(V){W=(T?V.ascending:V.descending);}else{if(this.getCaseSensitiveSorting()){W=(T?qx.ui.table.model.Simple._defaultSortComparatorAscending:qx.ui.table.model.Simple._defaultSortComparatorDescending);}else{W=(T?qx.ui.table.model.Simple._defaultSortComparatorInsensitiveAscending:qx.ui.table.model.Simple._defaultSortComparatorInsensitiveDescending);}}W.columnIndex=S;this.__xM.sort(W);this.__xN=S;this.__xR=T;var U={columnIndex:S,ascending:T};this.fireDataEvent(a,U);this.fireEvent(d);},setSortMethods:function(X,Y){var ba;if(qx.lang.Type.isFunction(Y)){ba={ascending:Y,descending:function(bb,bc){return Y(bc,bb);}};}else{ba=Y;}this.__xO[X]=ba;},getSortMethods:function(bd){return this.__xO[bd];},clearSorting:function(){if(this.__xN!=-1){this.__xN=-1;this.__xR=true;this.fireEvent(d);}},getSortColumnIndex:function(){return this.__xN;},_setSortColumnIndex:function(be){this.__xN=be;},isSortAscending:function(){return this.__xR;},_setSortAscending:function(bf){this.__xR=bf;},getRowCount:function(){return this.__xM.length;},getValue:function(bg,bh){if(bh<0||bh>=this.__xM.length){throw new Error("this.__rowArr out of bounds: "+bh+" (0.."+this.__xM.length+")");}return this.__xM[bh][bg];},setValue:function(bi,bj,bk){if(this.__xM[bj][bi]!=bk){this.__xM[bj][bi]=bk;if(this.hasListener(e)){var bl={firstRow:bj,lastRow:bj,firstColumn:bi,lastColumn:bi};this.fireDataEvent(e,bl);}if(bi==this.__xN){this.clearSorting();}}},setData:function(bm,bn){this.__xM=bm;if(this.hasListener(e)){var bo={firstRow:0,lastRow:bm.length-1,firstColumn:0,lastColumn:this.getColumnCount()-1};this.fireDataEvent(e,bo);}if(bn!==false){this.clearSorting();}},getData:function(){return this.__xM;},setDataAsMapArray:function(bp,bq,br){this.setData(this._mapArray2RowArr(bp,bq),br);},addRows:function(bs,bt,bu){if(bt==null){bt=this.__xM.length;}bs.splice(0,0,bt,0);Array.prototype.splice.apply(this.__xM,bs);var bv={firstRow:bt,lastRow:this.__xM.length-1,firstColumn:0,lastColumn:this.getColumnCount()-1};this.fireDataEvent(e,bv);if(bu!==false){this.clearSorting();}},addRowsAsMapArray:function(bw,bx,by,bz){this.addRows(this._mapArray2RowArr(bw,by),bx,bz);},setRows:function(bA,bB,bC){if(bB==null){bB=0;}bA.splice(0,0,bB,bA.length);Array.prototype.splice.apply(this.__xM,bA);var bD={firstRow:bB,lastRow:this.__xM.length-1,firstColumn:0,lastColumn:this.getColumnCount()-1};this.fireDataEvent(e,bD);if(bC!==false){this.clearSorting();}},setRowsAsMapArray:function(bE,bF,bG,bH){this.setRows(this._mapArray2RowArr(bE,bG),bF,bH);},removeRows:function(bI,bJ,bK){this.__xM.splice(bI,bJ);var bL={firstRow:bI,lastRow:this.__xM.length-1,firstColumn:0,lastColumn:this.getColumnCount()-1,removeStart:bI,removeCount:bJ};this.fireDataEvent(e,bL);if(bK!==false){this.clearSorting();}},_mapArray2RowArr:function(bM,bN){var bR=bM.length;var bO=this.getColumnCount();var bQ=new Array(bR);var bP;for(var i=0;i<bR;++i){bP=[];if(bN){bP.originalData=bM[i];}for(var j=0;j<bO;++j){bP[j]=bM[i][this.getColumnId(j)];}bQ[i]=bP;}return bQ;}},destruct:function(){this.__xM=this.__xP=this.__xO=this.__xQ=null;}});})();(function(){var a="qx.ui.table.ICellEditorFactory";qx.Interface.define(a,{members:{createCellEditor:function(b){return true;},getCellEditorValue:function(c){return true;}}});})();(function(){var f="",e="Function",d="abstract",c="number",b="appear",a="qx.ui.table.celleditor.AbstractField";qx.Class.define(a,{extend:qx.core.Object,implement:qx.ui.table.ICellEditorFactory,type:d,properties:{validationFunction:{check:e,nullable:true,init:null}},members:{_createEditor:function(){throw new Error("Abstract method call!");},createCellEditor:function(g){var h=this._createEditor();h.originalValue=g.value;if(g.value===null||g.value===undefined){g.value=f;}h.setValue(f+g.value);h.addListener(b,function(){h.selectAllText();});return h;},getCellEditorValue:function(i){var k=i.getValue();var j=this.getValidationFunction();if(j){k=j(k,i.originalValue);}if(typeof i.originalValue==c){k=parseFloat(k);}return k;}}});})();(function(){var c="number",b="qx.ui.table.celleditor.TextField",a="table-editor-textfield";qx.Class.define(b,{extend:qx.ui.table.celleditor.AbstractField,members:{getCellEditorValue:function(d){var f=d.getValue();var e=this.getValidationFunction();if(e){f=e(f,d.originalValue);}if(typeof d.originalValue==c){if(f!=null){f=parseFloat(f);}}return f;},_createEditor:function(){var g=new qx.ui.form.TextField();g.setAppearance(a);return g;}}});})();(function(){var a="qx.ui.table.IHeaderRenderer";qx.Interface.define(a,{members:{createHeaderCell:function(b){return true;},updateHeaderCell:function(c,d){return true;}}});})();(function(){var b="qx.ui.table.headerrenderer.Default",a="String";qx.Class.define(b,{extend:qx.core.Object,implement:qx.ui.table.IHeaderRenderer,statics:{STATE_SORTED:"sorted",STATE_SORTED_ASCENDING:"sortedAscending"},properties:{toolTip:{check:a,init:null,nullable:true}},members:{createHeaderCell:function(c){var d=new qx.ui.table.headerrenderer.HeaderCell();this.updateHeaderCell(c,d);return d;},updateHeaderCell:function(e,f){var g=qx.ui.table.headerrenderer.Default;if(e.name&&e.name.translate){f.setLabel(e.name.translate());}else{f.setLabel(e.name);}var h=f.getToolTip();if(this.getToolTip()!=null){if(h==null){h=new qx.ui.tooltip.ToolTip(this.getToolTip());f.setToolTip(h);qx.util.DisposeUtil.disposeTriggeredBy(h,f);}else{h.setLabel(this.getToolTip());}}e.sorted?f.addState(g.STATE_SORTED):f.removeState(g.STATE_SORTED);e.sortedAscending?f.addState(g.STATE_SORTED_ASCENDING):f.removeState(g.STATE_SORTED_ASCENDING);}}});})();(function(){var l="qx.client",k="head",j="text/css",h="stylesheet",g="}",f='@import "',e="{",d='";',c="qx.bom.Stylesheet",b="link",a="style";qx.Class.define(c,{statics:{includeFile:function(m,n){if(!n){n=document;}var o=n.createElement(b);o.type=j;o.rel=h;o.href=qx.util.ResourceManager.getInstance().toUri(m);var p=n.getElementsByTagName(k)[0];p.appendChild(o);},createElement:qx.core.Variant.select(l,{"mshtml":function(q){var r=document.createStyleSheet();if(q){r.cssText=q;}return r;},"default":function(s){var t=document.createElement(a);t.type=j;if(s){t.appendChild(document.createTextNode(s));}document.getElementsByTagName(k)[0].appendChild(t);return t.sheet;}}),addRule:qx.core.Variant.select(l,{"mshtml":function(u,v,w){u.addRule(v,w);},"default":function(x,y,z){x.insertRule(y+e+z+g,x.cssRules.length);}}),removeRule:qx.core.Variant.select(l,{"mshtml":function(A,B){var C=A.rules;var D=C.length;for(var i=D-1;i>=0;--i){if(C[i].selectorText==B){A.removeRule(i);}}},"default":function(E,F){var G=E.cssRules;var H=G.length;for(var i=H-1;i>=0;--i){if(G[i].selectorText==F){E.deleteRule(i);}}}}),removeAllRules:qx.core.Variant.select(l,{"mshtml":function(I){var J=I.rules;var K=J.length;for(var i=K-1;i>=0;i--){I.removeRule(i);}},"default":function(L){var M=L.cssRules;var N=M.length;for(var i=N-1;i>=0;i--){L.deleteRule(i);}}}),addImport:qx.core.Variant.select(l,{"mshtml":function(O,P){O.addImport(P);},"default":function(Q,R){Q.insertRule(f+R+d,Q.cssRules.length);}}),removeImport:qx.core.Variant.select(l,{"mshtml":function(S,T){var U=S.imports;var V=U.length;for(var i=V-1;i>=0;i--){if(U[i].href==T){S.removeImport(i);}}},"default":function(W,X){var Y=W.cssRules;var ba=Y.length;for(var i=ba-1;i>=0;i--){if(Y[i].href==X){W.deleteRule(i);}}}}),removeAllImports:qx.core.Variant.select(l,{"mshtml":function(bb){var bc=bb.imports;var bd=bc.length;for(var i=bd-1;i>=0;i--){bb.removeImport(i);}},"default":function(be){var bf=be.cssRules;var bg=bf.length;for(var i=bg-1;i>=0;i--){if(bf[i].type==bf[i].IMPORT_RULE){be.deleteRule(i);}}}})}});})();(function(){var a="qx.ui.table.ICellRenderer";qx.Interface.define(a,{members:{createDataCellHtml:function(b,c){return true;}}});})();(function(){var j="",i="px;",h=".qooxdoo-table-cell {",g="qooxdoo-table-cell",f='" ',e="nowrap",d="default",c="qx.client",b="}",a="width:",H=".qooxdoo-table-cell-right { text-align:right } ",G="0px 6px",F='<div class="',E="0px",D="height:",C="1px solid ",B=".qooxdoo-table-cell-bold { font-weight:bold } ",A="table-row-line",z="String",y='>',q="mshtml",r='</div>',o="ellipsis",p="content-box",m='left:',n="qx.ui.table.cellrenderer.Abstract",k='" style="',l="abstract",s="none",t="hidden",v="} ",u='px;',x=".qooxdoo-table-cell-italic { font-style:italic} ",w="absolute";qx.Class.define(n,{type:l,implement:qx.ui.table.ICellRenderer,extend:qx.core.Object,construct:function(){qx.core.Object.call(this);var I=qx.ui.table.cellrenderer.Abstract;if(!I.__wp){var K=qx.theme.manager.Color.getInstance();I.__wp=this.self(arguments);var J=h+qx.bom.element.Style.compile({position:w,top:E,overflow:t,whiteSpace:e,borderRight:C+K.resolve(A),padding:G,cursor:d,textOverflow:o,userSelect:s})+v+H+x+B;if(!qx.core.Variant.isSet(c,q)){J+=h+qx.bom.element.BoxSizing.compile(p)+b;}I.__wp.stylesheet=qx.bom.Stylesheet.createElement(J);}},properties:{defaultCellStyle:{init:null,check:z,nullable:true}},members:{_insetX:6+6+1,_insetY:0,_getCellClass:function(L){return g;},_getCellStyle:function(M){return M.style||j;},_getCellAttributes:function(N){return j;},_getContentHtml:function(O){return O.value||j;},_getCellSizeStyle:function(P,Q,R,S){var T=j;if(qx.bom.client.Feature.CONTENT_BOX){P-=R;Q-=S;}T+=a+Math.max(P,0)+i;T+=D+Math.max(Q,0)+i;return T;},createDataCellHtml:function(U,V){V.push(F,this._getCellClass(U),k,m,U.styleLeft,u,this._getCellSizeStyle(U.styleWidth,U.styleHeight,this._insetX,this._insetY),this._getCellStyle(U),f,this._getCellAttributes(U),y+this._getContentHtml(U),r);}}});})();(function(){var h="",g="number",f="Boolean",e="qx.ui.table.cellrenderer.Default",d=" qooxdoo-table-cell-bold",c=" qooxdoo-table-cell-right",b=" qooxdoo-table-cell-italic",a="string";qx.Class.define(e,{extend:qx.ui.table.cellrenderer.Abstract,statics:{STYLEFLAG_ALIGN_RIGHT:1,STYLEFLAG_BOLD:2,STYLEFLAG_ITALIC:4,_numberFormat:null},properties:{useAutoAlign:{check:f,init:true}},members:{_getStyleFlags:function(i){if(this.getUseAutoAlign()){if(typeof i.value==g){return qx.ui.table.cellrenderer.Default.STYLEFLAG_ALIGN_RIGHT;}}return 0;},_getCellClass:function(j){var k=qx.ui.table.cellrenderer.Abstract.prototype._getCellClass.call(this,j);if(!k){return h;}var l=this._getStyleFlags(j);if(l&qx.ui.table.cellrenderer.Default.STYLEFLAG_ALIGN_RIGHT){k+=c;}if(l&qx.ui.table.cellrenderer.Default.STYLEFLAG_BOLD){k+=d;}if(l&qx.ui.table.cellrenderer.Default.STYLEFLAG_ITALIC){k+=b;}return k;},_getContentHtml:function(m){return qx.bom.String.escape(this._formatValue(m));},_formatValue:function(n){var p=n.value;var o;if(p==null){return h;}if(typeof p==a){return p;}else if(typeof p==g){if(!qx.ui.table.cellrenderer.Default._numberFormat){qx.ui.table.cellrenderer.Default._numberFormat=new qx.util.format.NumberFormat();qx.ui.table.cellrenderer.Default._numberFormat.setMaximumFractionDigits(2);}var o=qx.ui.table.cellrenderer.Default._numberFormat.format(p);}else if(p instanceof Date){o=qx.util.format.DateFormat.getDateInstance().format(p);}else{o=p;}return o;}}});})();(function(){var k="qx.event.type.Data",j="visibilityChanged",h="orderChanged",g="visibilityChangedPre",f="__wv",e="__ww",d="widthChanged",c="qx.ui.table.columnmodel.Basic",b="__wx",a="headerCellRendererChanged";qx.Class.define(c,{extend:qx.core.Object,construct:function(){qx.core.Object.call(this);this.__wq=[];this.__wr=[];},events:{"widthChanged":k,"visibilityChangedPre":k,"visibilityChanged":k,"orderChanged":k,"headerCellRendererChanged":k},statics:{DEFAULT_WIDTH:100,DEFAULT_HEADER_RENDERER:qx.ui.table.headerrenderer.Default,DEFAULT_DATA_RENDERER:qx.ui.table.cellrenderer.Default,DEFAULT_EDITOR_FACTORY:qx.ui.table.celleditor.TextField},members:{__ws:null,__wt:null,__wr:null,__wq:null,__wu:null,__wv:null,__ww:null,__wx:null,init:function(l,m){{};this.__wu=[];var q=qx.ui.table.columnmodel.Basic.DEFAULT_WIDTH;var r=this.__wv||(this.__wv=new qx.ui.table.columnmodel.Basic.DEFAULT_HEADER_RENDERER());var o=this.__ww||(this.__ww=new qx.ui.table.columnmodel.Basic.DEFAULT_DATA_RENDERER());var n=this.__wx||(this.__wx=new qx.ui.table.columnmodel.Basic.DEFAULT_EDITOR_FACTORY());this.__wq=[];this.__wr=[];var t;if(m){t=m.getInitiallyHiddenColumns();}t=t||[];for(var u=0;u<l;u++){this.__wu[u]={width:q,headerRenderer:r,dataRenderer:o,editorFactory:n};this.__wq[u]=u;this.__wr[u]=u;}this.__wt=null;this.__ws=true;for(var s=0;s<t.length;s++){this.setColumnVisible(t[s],false);}this.__ws=false;for(u=0;u<l;u++){var p={col:u,visible:this.isColumnVisible(u)};this.fireDataEvent(g,p);this.fireDataEvent(j,p);}},getVisibleColumns:function(){return this.__wr!=null?this.__wr:[];},setColumnWidth:function(v,w,y){{};var A=this.__wu[v].width;if(A!=w){this.__wu[v].width=w;var z={col:v,newWidth:w,oldWidth:A,isMouseAction:y||false};this.fireDataEvent(d,z);}},getColumnWidth:function(B){{};return this.__wu[B].width;},setHeaderCellRenderer:function(C,D){{};var E=this.__wu[C].headerRenderer;if(E!==this.__wv){E.dispose();}this.__wu[C].headerRenderer=D;this.fireDataEvent(a,{col:C});},getHeaderCellRenderer:function(F){{};return this.__wu[F].headerRenderer;},setDataCellRenderer:function(G,H){{};this.__wu[G].dataRenderer=H;var I=this.__wu[G].dataRenderer;if(I!==this.__ww){return I;}return null;},getDataCellRenderer:function(J){{};return this.__wu[J].dataRenderer;},setCellEditorFactory:function(K,L){{};var M=this.__wu[K].headerRenderer;if(M!==this.__wx){M.dispose();}this.__wu[K].editorFactory=L;},getCellEditorFactory:function(N){{};return this.__wu[N].editorFactory;},_getColToXPosMap:function(){if(this.__wt==null){this.__wt={};for(var Q=0;Q<this.__wq.length;Q++){var P=this.__wq[Q];this.__wt[P]={overX:Q};}for(var O=0;O<this.__wr.length;O++){var P=this.__wr[O];this.__wt[P].visX=O;}}return this.__wt;},getVisibleColumnCount:function(){return this.__wr!=null?this.__wr.length:0;},getVisibleColumnAtX:function(R){{};return this.__wr[R];},getVisibleX:function(S){{};return this._getColToXPosMap()[S].visX;},getOverallColumnCount:function(){return this.__wq.length;},getOverallColumnAtX:function(T){{};return this.__wq[T];},getOverallX:function(U){{};return this._getColToXPosMap()[U].overX;},isColumnVisible:function(V){{};return (this._getColToXPosMap()[V].visX!=null);},setColumnVisible:function(W,X){{};if(X!=this.isColumnVisible(W)){if(X){var be=this._getColToXPosMap();var bb=be[W].overX;if(bb==null){throw new Error("Showing column failed: "+W+". The column is not added to this TablePaneModel.");}var bc;for(var x=bb+1;x<this.__wq.length;x++){var bd=this.__wq[x];var Y=be[bd].visX;if(Y!=null){bc=Y;break;}}if(bc==null){bc=this.__wr.length;}this.__wr.splice(bc,0,W);}else{var ba=this.getVisibleX(W);this.__wr.splice(ba,1);}this.__wt=null;if(!this.__ws){var bf={col:W,visible:X};this.fireDataEvent(g,bf);this.fireDataEvent(j,bf);}}},moveColumn:function(bg,bh){{};this.__ws=true;var bk=this.__wq[bg];var bi=this.isColumnVisible(bk);if(bi){this.setColumnVisible(bk,false);}this.__wq.splice(bg,1);this.__wq.splice(bh,0,bk);this.__wt=null;if(bi){this.setColumnVisible(bk,true);}this.__ws=false;var bj={col:bk,fromOverXPos:bg,toOverXPos:bh};this.fireDataEvent(h,bj);},setColumnsOrder:function(bl){{};if(bl.length==this.__wq.length){this.__ws=true;var bo=new Array(bl.length);for(var bm=0;bm<this.__wq.length;bm++){var bn=this.isColumnVisible(bm);bo[bm]=bn;if(bn){this.setColumnVisible(bm,false);}}this.__wq=qx.lang.Array.clone(bl);this.__wt=null;for(var bm=0;bm<this.__wq.length;bm++){if(bo[bm]){this.setColumnVisible(bm,true);}}this.__ws=false;this.fireDataEvent(h);}else{throw new Error("setColumnsOrder: Invalid number of column positions given, expected "+this.__wq.length+", got "+bl.length);}}},destruct:function(){for(var i=0;i<this.__wu.length;i++){this.__wu[i].headerRenderer.dispose();this.__wu[i].dataRenderer.dispose();this.__wu[i].editorFactory.dispose();}this.__wq=this.__wr=this.__wu=this.__wt=null;this._disposeObjects(f,e,b);}});})();(function(){var n="appear",m="columnVisibilityMenuCreateEnd",l="tableWidthChanged",k="verticalScrollBarChanged",j="qx.ui.table.columnmodel.resizebehavior.Abstract",i="qx.ui.table.columnmodel.Resize",h="_applyBehavior",g="separator",f="visibilityChanged",e="Reset column widths",b="changeBehavior",d="user-button",c="widthChanged",a="execute";qx.Class.define(i,{extend:qx.ui.table.columnmodel.Basic,include:qx.locale.MTranslation,construct:function(){qx.ui.table.columnmodel.Basic.call(this);this.__yb=false;this.__yc=false;},properties:{behavior:{check:j,init:null,nullable:true,apply:h,event:b}},members:{__yc:null,__yb:null,__yd:null,_applyBehavior:function(p,q){if(q!=null){q.dispose();q=null;}p._setNumColumns(this.getOverallColumnCount());p.setTableColumnModel(this);},init:function(r,s){qx.ui.table.columnmodel.Basic.prototype.init.call(this,r,s);if(this.__yd==null){this.__yd=s;s.addListener(n,this._onappear,this);s.addListener(l,this._onTableWidthChanged,this);s.addListener(k,this._onverticalscrollbarchanged,this);s.addListener(m,this._addResetColumnWidthButton,this);this.addListener(c,this._oncolumnwidthchanged,this);this.addListener(f,this._onvisibilitychanged,this);}if(this.getBehavior()==null){this.setBehavior(new qx.ui.table.columnmodel.resizebehavior.Default());}this.getBehavior()._setNumColumns(r);},getTable:function(){return this.__yd;},_addResetColumnWidthButton:function(event){var v=event.getData();var u=v.columnButton;var t=v.menu;var o;o=u.factory(g);t.add(o);o=u.factory(d,{text:this.tr(e)});t.add(o);o.addListener(a,this._onappear,this);},_onappear:function(event){if(this.__yb){return ;}this.__yb=true;{};this.getBehavior().onAppear(event,event.getType()!==n);this.__yd._updateScrollerWidths();this.__yd._updateScrollBarVisibility();this.__yb=false;this.__yc=true;},_onTableWidthChanged:function(event){if(this.__yb||!this.__yc){return ;}this.__yb=true;{};this.getBehavior().onTableWidthChanged(event);this.__yb=false;},_onverticalscrollbarchanged:function(event){if(this.__yb||!this.__yc){return ;}this.__yb=true;{};this.getBehavior().onVerticalScrollBarChanged(event);qx.event.Timer.once(function(){if(this.__yd&&!this.__yd.isDisposed()){this.__yd._updateScrollerWidths();this.__yd._updateScrollBarVisibility();}},this,0);this.__yb=false;},_oncolumnwidthchanged:function(event){if(this.__yb||!this.__yc){return ;}this.__yb=true;{};this.getBehavior().onColumnWidthChanged(event);this.__yb=false;},_onvisibilitychanged:function(event){if(this.__yb||!this.__yc){return ;}this.__yb=true;{};this.getBehavior().onVisibilityChanged(event);this.__yb=false;}},destruct:function(){this.__yd=null;}});})();(function(){var i="icon",h="label",g="String",f="sort-icon",e="_applySortIcon",d="_applyIcon",c="table-header-cell",b="qx.ui.table.headerrenderer.HeaderCell",a="_applyLabel";qx.Class.define(b,{extend:qx.ui.container.Composite,construct:function(){qx.ui.container.Composite.call(this);var j=new qx.ui.layout.Grid();j.setRowFlex(0,1);j.setColumnFlex(1,1);j.setColumnFlex(2,1);this.setLayout(j);},properties:{appearance:{refine:true,init:c},label:{check:g,init:null,nullable:true,apply:a},sortIcon:{check:g,init:null,nullable:true,apply:e,themeable:true},icon:{check:g,init:null,nullable:true,apply:d}},members:{_applyLabel:function(k,l){if(k){this._showChildControl(h).setValue(k);}else{this._excludeChildControl(h);}},_applySortIcon:function(m,n){if(m){this._showChildControl(f).setSource(m);}else{this._excludeChildControl(f);}},_applyIcon:function(o,p){if(o){this._showChildControl(i).setSource(o);}else{this._excludeChildControl(i);}},_createChildControlImpl:function(q,r){var s;switch(q){case h:s=new qx.ui.basic.Label(this.getLabel()).set({anonymous:true,allowShrinkX:true});this._add(s,{row:0,column:1});break;case f:s=new qx.ui.basic.Image(this.getSortIcon());s.setAnonymous(true);this._add(s,{row:0,column:2});break;case i:s=new qx.ui.basic.Image(this.getIcon()).set({anonymous:true,allowShrinkX:true});this._add(s,{row:0,column:0});break;}return s||qx.ui.container.Composite.prototype._createChildControlImpl.call(this,q);}}});})();(function(){var e="qx.ui.popup.Popup",d="visible",c="excluded",b="popup",a="Boolean";qx.Class.define(e,{extend:qx.ui.container.Composite,include:qx.ui.core.MPlacement,construct:function(f){qx.ui.container.Composite.call(this,f);qx.core.Init.getApplication().getRoot().add(this);this.initVisibility();},properties:{appearance:{refine:true,init:b},visibility:{refine:true,init:c},autoHide:{check:a,init:true}},members:{_applyVisibility:function(g,h){qx.ui.container.Composite.prototype._applyVisibility.call(this,g,h);var i=qx.ui.popup.Manager.getInstance();g===d?i.add(this):i.remove(this);}},destruct:function(){qx.ui.popup.Manager.getInstance().remove(this);}});})();(function(){var l="atom",k="Integer",j="String",i="_applyRich",h="qx.ui.tooltip.ToolTip",g="_applyIcon",f="tooltip",d="qx.ui.core.Widget",c="mouseover",b="Boolean",a="_applyLabel";qx.Class.define(h,{extend:qx.ui.popup.Popup,construct:function(m,n){qx.ui.popup.Popup.call(this);this.setLayout(new qx.ui.layout.Grow);this._createChildControl(l);if(m!=null){this.setLabel(m);}if(n!=null){this.setIcon(n);}this.addListener(c,this._onMouseOver,this);},properties:{appearance:{refine:true,init:f},showTimeout:{check:k,init:700,themeable:true},hideTimeout:{check:k,init:4000,themeable:true},label:{check:j,nullable:true,apply:a},icon:{check:j,nullable:true,apply:g,themeable:true},rich:{check:b,init:false,apply:i},opener:{check:d,nullable:true}},members:{_createChildControlImpl:function(o,p){var q;switch(o){case l:q=new qx.ui.basic.Atom;this._add(q);break;}return q||qx.ui.popup.Popup.prototype._createChildControlImpl.call(this,o);},_onMouseOver:function(e){this.hide();},_applyIcon:function(r,s){var t=this.getChildControl(l);r==null?t.resetIcon():t.setIcon(r);},_applyLabel:function(u,v){var w=this.getChildControl(l);u==null?w.resetLabel():w.setLabel(u);},_applyRich:function(x,y){var z=this.getChildControl(l);z.setRich(x);}}});})();(function(){var f="mousedown",d="__rz",c="blur",b="singleton",a="qx.ui.popup.Manager";qx.Class.define(a,{type:b,extend:qx.core.Object,construct:function(){qx.core.Object.call(this);this.__rz=[];qx.event.Registration.addListener(document.documentElement,f,this.__rB,this,true);qx.bom.Element.addListener(window,c,this.hideAll,this);},members:{__rz:null,add:function(g){{};this.__rz.push(g);this.__rA();},remove:function(h){{};if(this.__rz){qx.lang.Array.remove(this.__rz,h);this.__rA();}},hideAll:function(){if(this.__rz){for(var i=0;i<this.__rz.length;i++){this.__rz[i].exclude();}}},__rA:function(){var j=1e7;for(var i=0;i<this.__rz.length;i++){this.__rz[i].setZIndex(j++);}},__rB:function(e){var l=qx.ui.core.Widget.getWidgetByElement(e.getTarget());var m=this.__rz;for(var i=0;i<m.length;i++){var k=m[i];if(!k.getAutoHide()||l==k||qx.ui.core.Widget.contains(k,l)){continue;}k.exclude();}}},destruct:function(){qx.event.Registration.removeListener(document.documentElement,f,this.__rB,this,true);this._disposeArray(d);}});})();(function(){var bD="(\\d\\d?)",bC="format",bB="",bA="abbreviated",bz="wide",by="(",bx=")",bw="|",bv="stand-alone",bu="wildcard",bj="default",bi="literal",bh="'",bg="hour",bf="(\\d\\d?\\d?)",be="ms",bd="narrow",bc="-",bb="quoted_literal",ba='a',bK="HH:mm:ss",bL="+",bI="HHmmss",bJ="long",bG='z',bH="0",bE="sec",bF="day",bM='Z',bN=" ",bn="min",bm="mm",bp="(\\d+)",bo="h",br="KK",bq='L',bt="Z",bs="(\\d\\d+)",bl="EEEE",bk="^",a=":",b='y',c="K",d="a",e="([\\+\\-]\\d\\d:?\\d\\d)",f="GMT",g="dd",h="qx.util.format.DateFormat",j="yyy",k="H",bR="YYYY",bQ="y",bP="HH",bO="EE",bV='h',bU="S",bT='s',bS='A',bX="yyyyyy",bW="kk",J="ss",K='H',H='S',I="MMMM",N='c',O="d",L="([a-zA-Z]+)",M='k',F="m",G='Y',s='D',r="yyyyy",u='K',t="hh",o="SSS",n="MM",q="yy",p="(\\d\\d\\d\\d\\d\\d+)",m="yyyy-MM-dd HH:mm:ss",l="(\\d\\d\\d\\d\\d+)",T="short",U='d',V="unkown",W='m',P="(\\d\\d\\d\\d)",Q="(\\d\\d\\d+)",R="k",S='M',X="(\\d\\d\\d\\d+)",Y="SS",C="MMM",B="s",A="M",z='w',y="EEE",x="$",w="?",v='E',E="z",D="yyyy";qx.Class.define(h,{extend:qx.core.Object,implement:qx.util.format.IFormat,construct:function(bY,ca){qx.core.Object.call(this);if(!ca){this.__wy=qx.locale.Manager.getInstance().getLocale();}else{this.__wy=ca;}if(bY!=null){this.__wz=bY.toString();}else{this.__wz=qx.locale.Date.getDateFormat(bJ,this.__wy)+bN+qx.locale.Date.getDateTimeFormat(bI,bK,this.__wy);}},statics:{getDateTimeInstance:function(){var cc=qx.util.format.DateFormat;var cb=qx.locale.Date.getDateFormat(bJ)+bN+qx.locale.Date.getDateTimeFormat(bI,bK);if(cc._dateInstance==null||cc._dateInstance.__wz!=cb){cc._dateTimeInstance=new cc();}return cc._dateTimeInstance;},getDateInstance:function(){var ce=qx.util.format.DateFormat;var cd=qx.locale.Date.getDateFormat(T)+bB;if(ce._dateInstance==null||ce._dateInstance.__wz!=cd){ce._dateInstance=new ce(cd);}return ce._dateInstance;},ASSUME_YEAR_2000_THRESHOLD:30,LOGGING_DATE_TIME__format:m,AM_MARKER:"am",PM_MARKER:"pm",MEDIUM_TIMEZONE_NAMES:["GMT"],FULL_TIMEZONE_NAMES:["Greenwich Mean Time"]},members:{__wy:null,__wz:null,__wA:null,__wB:null,__wC:null,__wD:function(cf,cg){var ch=bB+cf;while(ch.length<cg){ch=bH+ch;}return ch;},__wE:function(ci){var cj=new Date(ci.getTime());var ck=cj.getDate();while(cj.getMonth()!=0){cj.setDate(-1);ck+=cj.getDate()+1;}return ck;},__wF:function(cl){return new Date(cl.getTime()+(3-((cl.getDay()+6)%7))*86400000);},__wG:function(cm){var co=this.__wF(cm);var cp=co.getFullYear();var cn=this.__wF(new Date(cp,0,4));return Math.floor(1.5+(co.getTime()-cn.getTime())/86400000/7);},format:function(cq){if(cq==null){return null;}var cw=qx.util.format.DateFormat;var cx=this.__wy;var cH=cq.getFullYear();var cB=cq.getMonth();var cJ=cq.getDate();var cr=cq.getDay();var cC=cq.getHours();var cy=cq.getMinutes();var cD=cq.getSeconds();var cF=cq.getMilliseconds();var cI=cq.getTimezoneOffset();var cu=cI>0?1:-1;var cs=Math.floor(Math.abs(cI)/60);var cz=Math.abs(cI)%60;this.__wH();var cG=bB;for(var i=0;i<this.__wC.length;i++){var cE=this.__wC[i];if(cE.type==bi){cG+=cE.text;}else{var cv=cE.character;var cA=cE.size;var ct=w;switch(cv){case b:case G:if(cA==2){ct=this.__wD(cH%100,2);}else{ct=cH+bB;if(cA>ct.length){for(var i=ct.length;i<cA;i++){ct=bH+ct;}}}break;case s:ct=this.__wD(this.__wE(cq),cA);break;case U:ct=this.__wD(cJ,cA);break;case z:ct=this.__wD(this.__wG(cq),cA);break;case v:if(cA==2){ct=qx.locale.Date.getDayName(bd,cr,cx,bC);}else if(cA==3){ct=qx.locale.Date.getDayName(bA,cr,cx,bC);}else if(cA==4){ct=qx.locale.Date.getDayName(bz,cr,cx,bC);}break;case N:if(cA==2){ct=qx.locale.Date.getDayName(bd,cr,cx,bv);}else if(cA==3){ct=qx.locale.Date.getDayName(bA,cr,cx,bv);}else if(cA==4){ct=qx.locale.Date.getDayName(bz,cr,cx,bv);}break;case S:if(cA==1||cA==2){ct=this.__wD(cB+1,cA);}else if(cA==3){ct=qx.locale.Date.getMonthName(bA,cB,cx,bC);}else if(cA==4){ct=qx.locale.Date.getMonthName(bz,cB,cx,bC);}break;case bq:if(cA==1||cA==2){ct=this.__wD(cB+1,cA);}else if(cA==3){ct=qx.locale.Date.getMonthName(bA,cB,cx,bv);}else if(cA==4){ct=qx.locale.Date.getMonthName(bz,cB,cx,bv);}break;case ba:ct=(cC<12)?qx.locale.Date.getAmMarker(cx):qx.locale.Date.getPmMarker(cx);break;case K:ct=this.__wD(cC,cA);break;case M:ct=this.__wD((cC==0)?24:cC,cA);break;case u:ct=this.__wD(cC%12,cA);break;case bV:ct=this.__wD(((cC%12)==0)?12:(cC%12),cA);break;case W:ct=this.__wD(cy,cA);break;case bT:ct=this.__wD(cD,cA);break;case H:ct=this.__wD(cF,cA);break;case bG:if(cA==1){ct=f+((cu>0)?bc:bL)+this.__wD(Math.abs(cs))+a+this.__wD(cz,2);}else if(cA==2){ct=cw.MEDIUM_TIMEZONE_NAMES[cs];}else if(cA==3){ct=cw.FULL_TIMEZONE_NAMES[cs];}break;case bM:ct=((cu>0)?bc:bL)+this.__wD(Math.abs(cs),2)+this.__wD(cz,2);break;}cG+=ct;}}return cG;},parse:function(cK){this.__wI();var cQ=this.__wA.regex.exec(cK);if(cQ==null){throw new Error("Date string '"+cK+"' does not match the date format: "+this.__wz);}var cL={year:1970,month:0,day:1,hour:0,ispm:false,min:0,sec:0,ms:0};var cM=1;for(var i=0;i<this.__wA.usedRules.length;i++){var cO=this.__wA.usedRules[i];var cN=cQ[cM];if(cO.field!=null){cL[cO.field]=parseInt(cN,10);}else{cO.manipulator(cL,cN);}cM+=(cO.groups==null)?1:cO.groups;}var cP=new Date(cL.year,cL.month,cL.day,(cL.ispm)?(cL.hour+12):cL.hour,cL.min,cL.sec,cL.ms);if(cL.month!=cP.getMonth()||cL.year!=cP.getFullYear()){throw new Error("Error parsing date '"+cK+"': the value for day or month is too large");}return cP;},__wH:function(){if(this.__wC!=null){return;}this.__wC=[];var cV;var cT=0;var cX=bB;var cR=this.__wz;var cU=bj;var i=0;while(i<cR.length){var cW=cR.charAt(i);switch(cU){case bb:if(cW==bh){if(i+1>=cR.length){i++;break;}var cS=cR.charAt(i+1);if(cS==bh){cX+=cW;i++;}else{i++;cU=V;}}else{cX+=cW;i++;}break;case bu:if(cW==cV){cT++;i++;}else{this.__wC.push({type:bu,character:cV,size:cT});cV=null;cT=0;cU=bj;}break;default:if((cW>=ba&&cW<=bG)||(cW>=bS&&cW<=bM)){cV=cW;cU=bu;}else if(cW==bh){if(i+1>=cR.length){cX+=cW;i++;break;}var cS=cR.charAt(i+1);if(cS==bh){cX+=cW;i++;}i++;cU=bb;}else{cU=bj;}if(cU!=bj){if(cX.length>0){this.__wC.push({type:bi,text:cX});cX=bB;}}else{cX+=cW;i++;}break;}}if(cV!=null){this.__wC.push({type:bu,character:cV,size:cT});}else if(cX.length>0){this.__wC.push({type:bi,text:cX});}},__wI:function(){if(this.__wA!=null){return ;}var dc=this.__wz;this.__wJ();this.__wH();var di=[];var de=bk;for(var da=0;da<this.__wC.length;da++){var dj=this.__wC[da];if(dj.type==bi){de+=qx.lang.String.escapeRegexpChars(dj.text);}else{var db=dj.character;var df=dj.size;var dd;for(var dk=0;dk<this.__wB.length;dk++){var dg=this.__wB[dk];if(db==dg.pattern.charAt(0)&&df==dg.pattern.length){dd=dg;break;}}if(dd==null){var dh=bB;for(var i=0;i<df;i++){dh+=db;}throw new Error("Malformed date format: "+dc+". Wildcard "+dh+" is not supported");}else{di.push(dd);de+=dd.regex;}}}de+=x;var cY;try{cY=new RegExp(de);}catch(dl){throw new Error("Malformed date format: "+dc);}this.__wA={regex:cY,"usedRules":di,pattern:de};},__wJ:function(){var dw=qx.util.format.DateFormat;var dz=qx.lang.String;if(this.__wB!=null){return ;}var dx=this.__wB=[];var dn=qx.locale.Date.getAmMarker(this.__wy).toString()||dw.AM_MARKER;var dE=qx.locale.Date.getPmMarker(this.__wy).toString()||dw.PM_MARKER;var ds=function(dI,dJ){dJ=parseInt(dJ,10);if(dJ<dw.ASSUME_YEAR_2000_THRESHOLD){dJ+=2000;}else if(dJ<100){dJ+=1900;}dI.year=dJ;};var du=function(dK,dL){dK.month=parseInt(dL,10)-1;};var dq=function(dM,dN){var dO=qx.locale.Date.getPmMarker(this.__wy).toString()||dw.PM_MARKER;dM.ispm=(dN==dO);};var dG=function(dP,dQ){dP.hour=parseInt(dQ,10)%24;};var dp=function(dR,dS){dR.hour=parseInt(dS,10)%12;};var dB=function(dT,dU){return;};var dH=qx.locale.Date.getMonthNames(bA,this.__wy,bC);for(var i=0;i<dH.length;i++){dH[i]=dz.escapeRegexpChars(dH[i].toString());}var dr=function(dV,dW){dW=dz.escapeRegexpChars(dW);dV.month=dH.indexOf(dW);};var dy=qx.locale.Date.getMonthNames(bz,this.__wy,bC);for(var i=0;i<dy.length;i++){dy[i]=dz.escapeRegexpChars(dy[i].toString());}var dC=function(dX,dY){dY=dz.escapeRegexpChars(dY);dX.month=dy.indexOf(dY);};var dm=qx.locale.Date.getDayNames(bd,this.__wy,bC);for(var i=0;i<dm.length;i++){dm[i]=dz.escapeRegexpChars(dm[i].toString());}var dF=function(ea,eb){eb=dz.escapeRegexpChars(eb);ea.month=dm.indexOf(eb);};var dD=qx.locale.Date.getDayNames(bA,this.__wy,bC);for(var i=0;i<dD.length;i++){dD[i]=dz.escapeRegexpChars(dD[i].toString());}var dt=function(ec,ed){ed=dz.escapeRegexpChars(ed);ec.month=dD.indexOf(ed);};var dA=qx.locale.Date.getDayNames(bz,this.__wy,bC);for(var i=0;i<dA.length;i++){dA[i]=dz.escapeRegexpChars(dA[i].toString());}var dv=function(ee,ef){ef=dz.escapeRegexpChars(ef);ee.month=dA.indexOf(ef);};dx.push({pattern:bR,regex:P,manipulator:ds});dx.push({pattern:bQ,regex:bp,manipulator:ds});dx.push({pattern:q,regex:bs,manipulator:ds});dx.push({pattern:j,regex:Q,manipulator:ds});dx.push({pattern:D,regex:X,manipulator:ds});dx.push({pattern:r,regex:l,manipulator:ds});dx.push({pattern:bX,regex:p,manipulator:ds});dx.push({pattern:A,regex:bD,manipulator:du});dx.push({pattern:n,regex:bD,manipulator:du});dx.push({pattern:C,regex:by+dH.join(bw)+bx,manipulator:dr});dx.push({pattern:I,regex:by+dy.join(bw)+bx,manipulator:dC});dx.push({pattern:g,regex:bD,field:bF});dx.push({pattern:O,regex:bD,field:bF});dx.push({pattern:bO,regex:by+dm.join(bw)+bx,manipulator:dF});dx.push({pattern:y,regex:by+dD.join(bw)+bx,manipulator:dt});dx.push({pattern:bl,regex:by+dA.join(bw)+bx,manipulator:dv});dx.push({pattern:d,regex:by+dn+bw+dE+bx,manipulator:dq});dx.push({pattern:bP,regex:bD,field:bg});dx.push({pattern:k,regex:bD,field:bg});dx.push({pattern:bW,regex:bD,manipulator:dG});dx.push({pattern:R,regex:bD,manipulator:dG});dx.push({pattern:br,regex:bD,field:bg});dx.push({pattern:c,regex:bD,field:bg});dx.push({pattern:t,regex:bD,manipulator:dp});dx.push({pattern:bo,regex:bD,manipulator:dp});dx.push({pattern:bm,regex:bD,field:bn});dx.push({pattern:F,regex:bD,field:bn});dx.push({pattern:J,regex:bD,field:bE});dx.push({pattern:B,regex:bD,field:bE});dx.push({pattern:o,regex:bf,field:be});dx.push({pattern:Y,regex:bf,field:be});dx.push({pattern:bU,regex:bf,field:be});dx.push({pattern:bt,regex:e,manipulator:dB});dx.push({pattern:E,regex:L,manipulator:dB});}},destruct:function(){this.__wC=this.__wA=this.__wB=null;}});})();(function(){var k="_",j="format",h="thu",g="sat",f="cldr_day_",e="cldr_month_",d="wed",c="fri",b="tue",a="mon",B="sun",A="short",z="HH:mm",y="HHmmsszz",x="HHmm",w="HHmmss",v="cldr_date_format_",u="HH:mm:ss zz",t="full",s="cldr_pm",q="long",r="medium",o="cldr_am",p="qx.locale.Date",m="cldr_date_time_format_",n="cldr_time_format_",l="HH:mm:ss";qx.Class.define(p,{statics:{__wK:qx.locale.Manager.getInstance(),getAmMarker:function(C){return this.__wK.localize(o,[],C);},getPmMarker:function(D){return this.__wK.localize(s,[],D);},getDayNames:function(length,E,F){var F=F?F:j;{};var H=[B,a,b,d,h,c,g];var I=[];for(var i=0;i<H.length;i++){var G=f+F+k+length+k+H[i];I.push(this.__wK.localize(G,[],E));}return I;},getDayName:function(length,J,K,L){var L=L?L:j;{};var N=[B,a,b,d,h,c,g];var M=f+L+k+length+k+N[J];return this.__wK.localize(M,[],K);},getMonthNames:function(length,O,P){var P=P?P:j;{};var R=[];for(var i=0;i<12;i++){var Q=e+P+k+length+k+(i+1);R.push(this.__wK.localize(Q,[],O));}return R;},getMonthName:function(length,S,T,U){var U=U?U:j;{};var V=e+U+k+length+k+(S+1);return this.__wK.localize(V,[],T);},getDateFormat:function(W,X){{};var Y=v+W;return this.__wK.localize(Y,[],X);},getDateTimeFormat:function(ba,bb,bc){var be=m+ba;var bd=this.__wK.localize(be,[],bc);if(bd==be){bd=bb;}return bd;},getTimeFormat:function(bf,bg){{};var bi=n+bf;var bh=this.__wK.localize(bi,[],bg);if(bh!=bi){return bh;}switch(bf){case A:case r:return qx.locale.Date.getDateTimeFormat(x,z);case q:return qx.locale.Date.getDateTimeFormat(w,l);case t:return qx.locale.Date.getDateTimeFormat(y,u);default:throw new Error("This case should never happen.");}},getWeekStart:function(bj){var bk={"MV":5,"AE":6,"AF":6,"BH":6,"DJ":6,"DZ":6,"EG":6,"ER":6,"ET":6,"IQ":6,"IR":6,"JO":6,"KE":6,"KW":6,"LB":6,"LY":6,"MA":6,"OM":6,"QA":6,"SA":6,"SD":6,"SO":6,"TN":6,"YE":6,"AS":0,"AU":0,"AZ":0,"BW":0,"CA":0,"CN":0,"FO":0,"GE":0,"GL":0,"GU":0,"HK":0,"IE":0,"IL":0,"IS":0,"JM":0,"JP":0,"KG":0,"KR":0,"LA":0,"MH":0,"MN":0,"MO":0,"MP":0,"MT":0,"NZ":0,"PH":0,"PK":0,"SG":0,"TH":0,"TT":0,"TW":0,"UM":0,"US":0,"UZ":0,"VI":0,"ZA":0,"ZW":0,"MW":0,"NG":0,"TJ":0};var bl=qx.locale.Date._getTerritory(bj);return bk[bl]!=null?bk[bl]:1;},getWeekendStart:function(bm){var bo={"EG":5,"IL":5,"SY":5,"IN":0,"AE":4,"BH":4,"DZ":4,"IQ":4,"JO":4,"KW":4,"LB":4,"LY":4,"MA":4,"OM":4,"QA":4,"SA":4,"SD":4,"TN":4,"YE":4};var bn=qx.locale.Date._getTerritory(bm);return bo[bn]!=null?bo[bn]:6;},getWeekendEnd:function(bp){var bq={"AE":5,"BH":5,"DZ":5,"IQ":5,"JO":5,"KW":5,"LB":5,"LY":5,"MA":5,"OM":5,"QA":5,"SA":5,"SD":5,"TN":5,"YE":5,"AF":5,"IR":5,"EG":6,"IL":6,"SY":6};var br=qx.locale.Date._getTerritory(bp);return bq[br]!=null?bq[br]:0;},isWeekend:function(bs,bt){var bv=qx.locale.Date.getWeekendStart(bt);var bu=qx.locale.Date.getWeekendEnd(bt);if(bu>bv){return ((bs>=bv)&&(bs<=bu));}else{return ((bs>=bv)||(bs<=bu));}},_getTerritory:function(bw){if(bw){var bx=bw.split(k)[1]||bw;}else{bx=this.__wK.getTerritory()||this.__wK.getLanguage();}return bx.toUpperCase();}}});})();(function(){var e="auto",d="string",c="number",b="*",a="qx.ui.core.ColumnData";qx.Class.define(a,{extend:qx.ui.core.LayoutItem,construct:function(){qx.ui.core.LayoutItem.call(this);this.setColumnWidth(e);},members:{__ye:null,renderLayout:function(f,top,g,h){this.__ye=g;},getComputedWidth:function(){return this.__ye;},getFlex:function(){return this.getLayoutProperties().flex||0;},setColumnWidth:function(i,j){var j=j||0;var k=null;if(typeof i==c){this.setWidth(i);}else if(typeof i==d){if(i==e){j=1;}else{var l=i.match(/^[0-9]+(?:\.[0-9]+)?([%\*])$/);if(l){if(l[1]==b){j=parseFloat(i);}else{k=i;}}}}this.setLayoutProperties({flex:j,width:k});}},settings:{"qx.tableResizeDebug":false}});})();(function(){var b="qx.ui.table.columnmodel.resizebehavior.Abstract",a="abstract";qx.Class.define(b,{type:a,extend:qx.core.Object,members:{_setNumColumns:function(c){throw new Error("_setNumColumns is abstract");},onAppear:function(event,d){throw new Error("onAppear is abstract");},onTableWidthChanged:function(event){throw new Error("onTableWidthChanged is abstract");},onVerticalScrollBarChanged:function(event){throw new Error("onVerticalScrollBarChanged is abstract");},onColumnWidthChanged:function(event){throw new Error("onColumnWidthChanged is abstract");},onVisibilityChanged:function(event){throw new Error("onVisibilityChanged is abstract");},_getAvailableWidth:function(){var f=this.getTableColumnModel();var i=f.getTable();var e=i._getPaneScrollerArr();if(!e[0]||!e[0].getLayoutParent().getBounds()){return null;}var h=e[0].getLayoutParent().getBounds().width;var g=e[e.length-1];h-=g.getPaneInsetRight();return h;}}});})();(function(){var j="Function",h="Boolean",g="minWidth",f="width",e="__yg",d="qx.ui.table.columnmodel.Resize",c="qx.ui.table.columnmodel.resizebehavior.Default",b="__yh",a="maxWidth";qx.Class.define(c,{extend:qx.ui.table.columnmodel.resizebehavior.Abstract,construct:function(){qx.ui.table.columnmodel.resizebehavior.Abstract.call(this);this.__yf=[];this.__yg=new qx.ui.layout.HBox();this.__yg.connectToWidget(this);this.__yh=new qx.util.DeferredCall(this._computeColumnsFlexWidth,this);},properties:{newResizeBehaviorColumnData:{check:j,init:function(k){return new qx.ui.core.ColumnData();}},initializeWidthsOnEveryAppear:{check:h,init:false},tableColumnModel:{check:d}},members:{__yg:null,__yi:null,__yf:null,__yh:null,__yj:false,setWidth:function(m,n,o){if(m>=this.__yf.length){throw new Error("Column number out of range");}this.__yf[m].setColumnWidth(n,o);this.__yh.schedule();},setMinWidth:function(p,q){if(p>=this.__yf.length){throw new Error("Column number out of range");}this.__yf[p].setMinWidth(q);this.__yh.schedule();},setMaxWidth:function(r,s){if(r>=this.__yf.length){throw new Error("Column number out of range");}this.__yf[r].setMaxWidth(s);this.__yh.schedule();},set:function(t,u){for(var v in u){switch(v){case f:this.setWidth(t,u[v]);break;case g:this.setMinWidth(t,u[v]);break;case a:this.setMaxWidth(t,u[v]);break;default:throw new Error("Unknown property: "+v);}}},onAppear:function(event,w){if(w===true||!this.__yj||this.getInitializeWidthsOnEveryAppear()){this._computeColumnsFlexWidth();this.__yj=true;}},onTableWidthChanged:function(event){this._computeColumnsFlexWidth();},onVerticalScrollBarChanged:function(event){this._computeColumnsFlexWidth();},onColumnWidthChanged:function(event){this._extendNextColumn(event);},onVisibilityChanged:function(event){var x=event.getData();if(x.visible){this._computeColumnsFlexWidth();return;}this._extendLastColumn(event);},_setNumColumns:function(y){var z=this.__yf;if(y<=z.length){z.splice(y,z.length);return;}for(var i=z.length;i<y;i++){z[i]=this.getNewResizeBehaviorColumnData()();z[i].columnNumber=i;}},getLayoutChildren:function(){return this.__yi;},_computeColumnsFlexWidth:function(){this.__yh.cancel();var E=this._getAvailableWidth();if(E===null){return;}var A=this.getTableColumnModel();var C=A.getVisibleColumns();var D=C.length;var B=this.__yf;var i,l;if(D===0){return;}var G=[];for(i=0;i<D;i++){G.push(B[C[i]]);}this.__yi=G;this.__yk();this.__yg.renderLayout(E,100);for(i=0,l=G.length;i<l;i++){var F=G[i].getComputedWidth();A.setColumnWidth(C[i],F);}},__yk:function(){this.__yg.invalidateChildrenCache();var H=this.__yi;for(var i=0,l=H.length;i<l;i++){H[i].invalidateLayoutCache();}},_extendNextColumn:function(event){var M=this.getTableColumnModel();var P=event.getData();var K=M.getVisibleColumns();var J=this._getAvailableWidth();var I=K.length;if(P.newWidth>P.oldWidth){return ;}var i;var L;var O=0;for(i=0;i<I;i++){O+=M.getColumnWidth(K[i]);}if(O<J){for(i=0;i<K.length;i++){if(K[i]==P.col){L=K[i+1];break;}}if(L){var N=(J-(O-M.getColumnWidth(L)));M.setColumnWidth(L,N);}}},_extendLastColumn:function(event){var T=this.getTableColumnModel();var X=event.getData();if(X.visible){return;}var S=T.getVisibleColumns();if(S.length==0){return;}var R=this._getAvailableWidth(T);var Q=S.length;var i;var V;var W=0;for(i=0;i<Q;i++){W+=T.getColumnWidth(S[i]);}if(W<R){V=S[S.length-1];var U=(R-(W-T.getColumnWidth(V)));T.setColumnWidth(V,U);}},_getResizeColumnData:function(){return this.__yf;}},destruct:function(){this.__yf=this.__yi=null;this._disposeObjects(e,b);}});})();(function(){var p="Boolean",o="column-button",n="Function",m="qx.event.type.Data",k="statusbar",j="qx.ui.table.pane.CellEvent",h="function",g="PageUp",f="dataChanged",e='"',bF="changeLocale",bE="changeSelection",bD="qx.dynlocale",bC="__wd",bB="Enter",bA="metaDataChanged",bz="on",by="_applyStatusBarVisible",bx="columnVisibilityMenuCreateStart",bw="blur",w="qx.ui.table.Table",y="columnVisibilityMenuCreateEnd",u="changeVisible",v="_applyResetSelectionOnHeaderClick",s="_applyMetaColumnCounts",t="focus",q="changeDataRowRenderer",r="changeHeaderCellHeight",F="Escape",G="A",X="changeSelectionModel",T="Left",bg="__vS",bb="Down",bs="Integer",bm="_applyHeaderCellHeight",N="__wb",bv="visibilityChanged",bu="qx.ui.table.ITableModel",bt="orderChanged",L="_applySelectionModel",P="menu-button",R="menu",V="_applyAdditionalStatusBarText",Y="_applyFocusCellOnMouseMove",bc="table",bi="_applyColumnVisibilityButtonVisible",bo="changeTableModel",z="qx.event.type.Event",A="tableWidthChanged",O="_applyHeaderCellsVisible",bf="Object",be="_applyShowCellFocusIndicator",bd="resize",bk="verticalScrollBarChanged",bj="__wc",ba="changeScrollY",bh="_applyTableModel",a="End",bn="_applyKeepFirstVisibleRowComplete",B="widthChanged",C="one of one row",U="Home",b="_applyRowHeight",d="F2",K="appear",D="Up",E="%1 rows",I="qx.ui.table.selection.Model",W="one row",bq="PageDown",bp="%1 of %2 rows",Q="keypress",br="changeRowHeight",M="__vT",bl="Number",H="header",J="qx.ui.table.IRowRenderer",c="Right",S="Space";qx.Class.define(w,{extend:qx.ui.core.Widget,construct:function(bG,bH){qx.ui.core.Widget.call(this);if(!bH){bH={};}if(bH.initiallyHiddenColumns){this.setInitiallyHiddenColumns(bH.initiallyHiddenColumns);}if(bH.selectionManager){this.setNewSelectionManager(bH.selectionManager);}if(bH.selectionModel){this.setNewSelectionModel(bH.selectionModel);}if(bH.tableColumnModel){this.setNewTableColumnModel(bH.tableColumnModel);}if(bH.tablePane){this.setNewTablePane(bH.tablePane);}if(bH.tablePaneHeader){this.setNewTablePaneHeader(bH.tablePaneHeader);}if(bH.tablePaneScroller){this.setNewTablePaneScroller(bH.tablePaneScroller);}if(bH.tablePaneModel){this.setNewTablePaneModel(bH.tablePaneModel);}if(bH.columnMenu){this.setNewColumnMenu(bH.columnMenu);}this._setLayout(new qx.ui.layout.VBox());this.__vS=new qx.ui.container.Composite(new qx.ui.layout.HBox());this._add(this.__vS,{flex:1});this.setDataRowRenderer(new qx.ui.table.rowrenderer.Default(this));this.__vT=this.getNewSelectionManager()(this);this.setSelectionModel(this.getNewSelectionModel()(this));this.setTableModel(bG||this.getEmptyTableModel());this.setMetaColumnCounts([-1]);this.setTabIndex(1);this.addListener(Q,this._onKeyPress);this.addListener(t,this._onFocusChanged);this.addListener(bw,this._onFocusChanged);var bI=new qx.ui.core.Widget().set({height:0});this._add(bI);bI.addListener(bd,this._onResize,this);this.__vU=null;this.__vV=null;if(qx.core.Variant.isSet(bD,bz)){qx.locale.Manager.getInstance().addListener(bF,this._onChangeLocale,this);}this.initStatusBarVisible();bG=this.getTableModel();if(bG.init&&typeof (bG.init)==h){bG.init(this);}},events:{"columnVisibilityMenuCreateStart":m,"columnVisibilityMenuCreateEnd":m,"tableWidthChanged":z,"verticalScrollBarChanged":m,"cellClick":j,"cellDblclick":j,"cellContextmenu":j,"dataEdited":m},statics:{__vW:{cellClick:1,cellDblclick:1,cellContextmenu:1}},properties:{appearance:{refine:true,init:bc},focusable:{refine:true,init:true},minWidth:{refine:true,init:50},initiallyHiddenColumns:{init:null},selectable:{refine:true,init:false},selectionModel:{check:I,apply:L,event:X},tableModel:{check:bu,apply:bh,event:bo},rowHeight:{check:bl,init:20,apply:b,event:br},forceLineHeight:{check:p,init:true},headerCellsVisible:{check:p,init:true,apply:O},headerCellHeight:{check:bs,init:16,apply:bm,event:r,nullable:true},statusBarVisible:{check:p,init:true,apply:by},additionalStatusBarText:{nullable:true,init:null,apply:V},columnVisibilityButtonVisible:{check:p,init:true,apply:bi},metaColumnCounts:{check:bf,apply:s},focusCellOnMouseMove:{check:p,init:false,apply:Y},rowFocusChangeModifiesSelection:{check:p,init:true},showCellFocusIndicator:{check:p,init:true,apply:be},keepFirstVisibleRowComplete:{check:p,init:true,apply:bn},alwaysUpdateCells:{check:p,init:false},resetSelectionOnHeaderClick:{check:p,init:true,apply:v},dataRowRenderer:{check:J,init:null,nullable:true,event:q},modalCellEditorPreOpenFunction:{check:n,init:null,nullable:true},newColumnMenu:{check:n,init:function(){return new qx.ui.table.columnmenu.Button();}},newSelectionManager:{check:n,init:function(bJ){return new qx.ui.table.selection.Manager(bJ);}},newSelectionModel:{check:n,init:function(bK){return new qx.ui.table.selection.Model(bK);}},newTableColumnModel:{check:n,init:function(bL){return new qx.ui.table.columnmodel.Basic(bL);}},newTablePane:{check:n,init:function(bM){return new qx.ui.table.pane.Pane(bM);}},newTablePaneHeader:{check:n,init:function(bN){return new qx.ui.table.pane.Header(bN);}},newTablePaneScroller:{check:n,init:function(bO){return new qx.ui.table.pane.Scroller(bO);}},newTablePaneModel:{check:n,init:function(bP){return new qx.ui.table.pane.Model(bP);}}},members:{__vU:null,__vV:null,__vS:null,__vT:null,__vX:null,__vY:null,__wa:null,__wb:null,__wc:null,__wd:null,_createChildControlImpl:function(bQ,bR){var bS;switch(bQ){case k:bS=new qx.ui.basic.Label();bS.set({allowGrowX:true});this._add(bS);break;case o:bS=this.getNewColumnMenu()();bS.set({focusable:false});var bT=bS.factory(R,{table:this});bT.addListener(K,this._initColumnMenu,this);break;}return bS||qx.ui.core.Widget.prototype._createChildControlImpl.call(this,bQ);},_applySelectionModel:function(bU,bV){this.__vT.setSelectionModel(bU);if(bV!=null){bV.removeListener(bE,this._onSelectionChanged,this);}bU.addListener(bE,this._onSelectionChanged,this);},_applyRowHeight:function(bW,bX){var bY=this._getPaneScrollerArr();for(var i=0;i<bY.length;i++){bY[i].updateVerScrollBarMaximum();}},_applyHeaderCellsVisible:function(ca,cb){var cc=this._getPaneScrollerArr();for(var i=0;i<cc.length;i++){cc[i]._excludeChildControl(H);}},_applyHeaderCellHeight:function(cd,ce){var cf=this._getPaneScrollerArr();for(var i=0;i<cf.length;i++){cf[i].getHeader().setHeight(cd);}},getEmptyTableModel:function(){if(!this.__wd){this.__wd=new qx.ui.table.model.Simple();this.__wd.setColumns([]);this.__wd.setData([]);}return this.__wd;},_applyTableModel:function(cg,ch){this.getTableColumnModel().init(cg.getColumnCount(),this);if(ch!=null){ch.removeListener(bA,this._onTableModelMetaDataChanged,this);ch.removeListener(f,this._onTableModelDataChanged,this);}cg.addListener(bA,this._onTableModelMetaDataChanged,this);cg.addListener(f,this._onTableModelDataChanged,this);this._updateStatusBar();this._updateTableData(0,cg.getRowCount(),0,cg.getColumnCount());this._onTableModelMetaDataChanged();if(ch&&cg.init&&typeof (cg.init)==h){cg.init(this);}},getTableColumnModel:function(){if(!this.__wc){var ck=this.__wc=this.getNewTableColumnModel()(this);ck.addListener(bv,this._onColVisibilityChanged,this);ck.addListener(B,this._onColWidthChanged,this);ck.addListener(bt,this._onColOrderChanged,this);var cj=this.getTableModel();ck.init(cj.getColumnCount(),this);var ci=this._getPaneScrollerArr();for(var i=0;i<ci.length;i++){var cl=ci[i];var cm=cl.getTablePaneModel();cm.setTableColumnModel(ck);}}return this.__wc;},_applyStatusBarVisible:function(cn,co){if(cn){this._showChildControl(k);}else{this._excludeChildControl(k);}if(cn){this._updateStatusBar();}},_applyAdditionalStatusBarText:function(cp,cq){this.__vX=cp;this._updateStatusBar();},_applyColumnVisibilityButtonVisible:function(cr,cs){if(cr){this._showChildControl(o);}else{this._excludeChildControl(o);}},_applyMetaColumnCounts:function(ct,cu){var cB=ct;var cv=this._getPaneScrollerArr();var cz={};if(ct>cu){var cD=qx.event.Registration.getManager(cv[0]);for(var cE in qx.ui.table.Table.__vW){cz[cE]={};cz[cE].capture=cD.getListeners(cv[0],cE,true);cz[cE].bubble=cD.getListeners(cv[0],cE,false);}}this._cleanUpMetaColumns(cB.length);var cA=0;for(var i=0;i<cv.length;i++){var cF=cv[i];var cC=cF.getTablePaneModel();cC.setFirstColumnX(cA);cC.setMaxColumnCount(cB[i]);cA+=cB[i];}if(cB.length>cv.length){var cy=this.getTableColumnModel();for(var i=cv.length;i<cB.length;i++){var cC=this.getNewTablePaneModel()(cy);cC.setFirstColumnX(cA);cC.setMaxColumnCount(cB[i]);cA+=cB[i];var cF=this.getNewTablePaneScroller()(this);cF.setTablePaneModel(cC);cF.addListener(ba,this._onScrollY,this);for(cE in qx.ui.table.Table.__vW){if(!cz[cE]){break;}if(cz[cE].capture&&cz[cE].capture.length>0){var cw=cz[cE].capture;for(var i=0;i<cw.length;i++){var cx=cw[i].context;if(!cx){cx=this;}else if(cx==cv[0]){cx=cF;}cF.addListener(cE,cw[i].handler,cx,true);}}if(cz[cE].bubble&&cz[cE].bubble.length>0){var cH=cz[cE].bubble;for(var i=0;i<cH.length;i++){var cx=cH[i].context;if(!cx){cx=this;}else if(cx==cv[0]){cx=cF;}cF.addListener(cE,cH[i].handler,cx,false);}}}var cG=(i==cB.length-1)?1:0;this.__vS.add(cF,{flex:cG});cv=this._getPaneScrollerArr();}}for(var i=0;i<cv.length;i++){var cF=cv[i];var cI=(i==(cv.length-1));cF.getHeader().setHeight(this.getHeaderCellHeight());cF.setTopRightWidget(cI?this.getChildControl(o):null);}if(!this.isColumnVisibilityButtonVisible()){this._excludeChildControl(o);}this._updateScrollerWidths();this._updateScrollBarVisibility();},_applyFocusCellOnMouseMove:function(cJ,cK){var cL=this._getPaneScrollerArr();for(var i=0;i<cL.length;i++){cL[i].setFocusCellOnMouseMove(cJ);}},_applyShowCellFocusIndicator:function(cM,cN){var cO=this._getPaneScrollerArr();for(var i=0;i<cO.length;i++){cO[i].setShowCellFocusIndicator(cM);}},_applyKeepFirstVisibleRowComplete:function(cP,cQ){var cR=this._getPaneScrollerArr();for(var i=0;i<cR.length;i++){cR[i].onKeepFirstVisibleRowCompleteChanged();}},_applyResetSelectionOnHeaderClick:function(cS,cT){var cU=this._getPaneScrollerArr();for(var i=0;i<cU.length;i++){cU[i].setResetSelectionOnHeaderClick(cS);}},getSelectionManager:function(){return this.__vT;},_getPaneScrollerArr:function(){return this.__vS.getChildren();},getPaneScroller:function(cV){return this._getPaneScrollerArr()[cV];},_cleanUpMetaColumns:function(cW){var cX=this._getPaneScrollerArr();if(cX!=null){for(var i=cX.length-1;i>=cW;i--){cX[i].destroy();}}},_onChangeLocale:function(cY){this.updateContent();this._updateStatusBar();},_onSelectionChanged:function(da){var db=this._getPaneScrollerArr();for(var i=0;i<db.length;i++){db[i].onSelectionChanged();}this._updateStatusBar();},_onTableModelMetaDataChanged:function(dc){var dd=this._getPaneScrollerArr();for(var i=0;i<dd.length;i++){dd[i].onTableModelMetaDataChanged();}this._updateStatusBar();},_onTableModelDataChanged:function(de){var df=de.getData();this._updateTableData(df.firstRow,df.lastRow,df.firstColumn,df.lastColumn,df.removeStart,df.removeCount);},_updateTableData:function(dg,dh,di,dj,dk,dl){var dm=this._getPaneScrollerArr();if(dl){this.getSelectionModel().removeSelectionInterval(dk,dk+dl);if(this.__vV>=dk&&this.__vV<(dk+dl)){this.setFocusedCell();}}for(var i=0;i<dm.length;i++){dm[i].onTableModelDataChanged(dg,dh,di,dj);}var dn=this.getTableModel().getRowCount();if(dn!=this.__vY){this.__vY=dn;this._updateScrollBarVisibility();this._updateStatusBar();}},_onScrollY:function(dp){if(!this.__wa){this.__wa=true;var dq=this._getPaneScrollerArr();for(var i=0;i<dq.length;i++){dq[i].setScrollY(dp.getData());}this.__wa=false;}},_onKeyPress:function(dr){if(!this.getEnabled()){return;}var dy=this.__vV;var dv=true;var dz=dr.getKeyIdentifier();if(this.isEditing()){if(dr.getModifiers()==0){switch(dz){case bB:this.stopEditing();var dy=this.__vV;this.moveFocusedCell(0,1);if(this.__vV!=dy){dv=this.startEditing();}break;case F:this.cancelEditing();this.focus();break;default:dv=false;break;}}}else{if(dr.isCtrlPressed()){dv=true;switch(dz){case G:var dw=this.getTableModel().getRowCount();if(dw>0){this.getSelectionModel().setSelectionInterval(0,dw-1);}break;default:dv=false;break;}}else{switch(dz){case S:this.__vT.handleSelectKeyDown(this.__vV,dr);break;case d:case bB:this.startEditing();dv=true;break;case U:this.setFocusedCell(this.__vU,0,true);break;case a:var dw=this.getTableModel().getRowCount();this.setFocusedCell(this.__vU,dw-1,true);break;case T:this.moveFocusedCell(-1,0);break;case c:this.moveFocusedCell(1,0);break;case D:this.moveFocusedCell(0,-1);break;case bb:this.moveFocusedCell(0,1);break;case g:case bq:var du=this.getPaneScroller(0);var dx=du.getTablePane();var dt=this.getRowHeight();var ds=(dz==g)?-1:1;dw=dx.getVisibleRowCount()-1;du.setScrollY(du.getScrollY()+ds*dw*dt);this.moveFocusedCell(0,ds*dw);break;default:dv=false;}}}if(dy!=this.__vV&&this.getRowFocusChangeModifiesSelection()){this.__vT.handleMoveKeyDown(this.__vV,dr);}if(dv){dr.preventDefault();dr.stopPropagation();}},_onFocusChanged:function(dA){var dB=this._getPaneScrollerArr();for(var i=0;i<dB.length;i++){dB[i].onFocusChanged();}},_onColVisibilityChanged:function(dC){var dD=this._getPaneScrollerArr();for(var i=0;i<dD.length;i++){dD[i].onColVisibilityChanged();}var dE=dC.getData();if(this.__wb!=null&&dE.col!=null&&dE.visible!=null){this.__wb[dE.col].setVisible(dE.visible);}this._updateScrollerWidths();this._updateScrollBarVisibility();},_onColWidthChanged:function(dF){var dG=this._getPaneScrollerArr();for(var i=0;i<dG.length;i++){var dH=dF.getData();dG[i].setColumnWidth(dH.col,dH.newWidth);}this._updateScrollerWidths();this._updateScrollBarVisibility();},_onColOrderChanged:function(dI){var dJ=this._getPaneScrollerArr();for(var i=0;i<dJ.length;i++){dJ[i].onColOrderChanged();}this._updateScrollerWidths();this._updateScrollBarVisibility();},getTablePaneScrollerAtPageX:function(dK){var dL=this._getMetaColumnAtPageX(dK);return (dL!=-1)?this.getPaneScroller(dL):null;},setFocusedCell:function(dM,dN,dO){if(!this.isEditing()&&(dM!=this.__vU||dN!=this.__vV)){if(dM===null){dM=0;}this.__vU=dM;this.__vV=dN;var dP=this._getPaneScrollerArr();for(var i=0;i<dP.length;i++){dP[i].setFocusedCell(dM,dN);}if(dM!==null&&dO){this.scrollCellVisible(dM,dN);}}},resetSelection:function(){this.getSelectionModel().resetSelection();},resetCellFocus:function(){this.setFocusedCell(null,null,false);},getFocusedColumn:function(){return this.__vU;},getFocusedRow:function(){return this.__vV;},highlightFocusedRow:function(dQ){this.getDataRowRenderer().setHighlightFocusRow(dQ);},clearFocusedRowHighlight:function(dR){if(dR){var dT=dR.getRelatedTarget();if(dT instanceof qx.ui.table.pane.Pane||dT instanceof qx.ui.table.pane.FocusIndicator){return;}}this.resetCellFocus();var dS=this._getPaneScrollerArr();for(var i=0;i<dS.length;i++){dS[i].onFocusChanged();}},moveFocusedCell:function(dU,dV){var ea=this.__vU;var eb=this.__vV;if(ea===null||eb===null){return;}if(dU!=0){var dY=this.getTableColumnModel();var x=dY.getVisibleX(ea);var dX=dY.getVisibleColumnCount();x=qx.lang.Number.limit(x+dU,0,dX-1);ea=dY.getVisibleColumnAtX(x);}if(dV!=0){var dW=this.getTableModel();eb=qx.lang.Number.limit(eb+dV,0,dW.getRowCount()-1);}this.setFocusedCell(ea,eb,true);},scrollCellVisible:function(ec,ed){var ee=this.getTableColumnModel();var x=ee.getVisibleX(ec);var ef=this._getMetaColumnAtColumnX(x);if(ef!=-1){this.getPaneScroller(ef).scrollCellVisible(ec,ed);}},isEditing:function(){if(this.__vU!=null){var x=this.getTableColumnModel().getVisibleX(this.__vU);var eg=this._getMetaColumnAtColumnX(x);return this.getPaneScroller(eg).isEditing();}return false;},startEditing:function(){if(this.__vU!=null){var x=this.getTableColumnModel().getVisibleX(this.__vU);var ei=this._getMetaColumnAtColumnX(x);var eh=this.getPaneScroller(ei).startEditing();return eh;}return false;},stopEditing:function(){if(this.__vU!=null){var x=this.getTableColumnModel().getVisibleX(this.__vU);var ej=this._getMetaColumnAtColumnX(x);this.getPaneScroller(ej).stopEditing();}},cancelEditing:function(){if(this.__vU!=null){var x=this.getTableColumnModel().getVisibleX(this.__vU);var ek=this._getMetaColumnAtColumnX(x);this.getPaneScroller(ek).cancelEditing();}},updateContent:function(){var el=this._getPaneScrollerArr();for(var i=0;i<el.length;i++){el[i].getTablePane().updateContent(true);}},blockHeaderElements:function(){var em=this._getPaneScrollerArr();for(var i=0;i<em.length;i++){em[i].getHeader().getBlocker().blockContent(20);}this.getChildControl(o).getBlocker().blockContent(20);},unblockHeaderElements:function(){var en=this._getPaneScrollerArr();for(var i=0;i<en.length;i++){en[i].getHeader().getBlocker().unblockContent();}this.getChildControl(o).getBlocker().unblockContent();},_getMetaColumnAtPageX:function(eo){var ep=this._getPaneScrollerArr();for(var i=0;i<ep.length;i++){var eq=ep[i].getContainerLocation();if(eo>=eq.left&&eo<=eq.right){return i;}}return -1;},_getMetaColumnAtColumnX:function(er){var et=this.getMetaColumnCounts();var eu=0;for(var i=0;i<et.length;i++){var es=et[i];eu+=es;if(es==-1||er<eu){return i;}}return -1;},_updateStatusBar:function(){var ev=this.getTableModel();if(this.getStatusBarVisible()){var ew=this.getSelectionModel().getSelectedCount();var ey=ev.getRowCount();var ex;if(ey>=0){if(ew==0){ex=this.trn(W,E,ey,ey);}else{ex=this.trn(C,bp,ey,ew,ey);}}if(this.__vX){if(ex){ex+=this.__vX;}else{ex=this.__vX;}}if(ex){this.getChildControl(k).setValue(ex);}}},_updateScrollerWidths:function(){var ez=this._getPaneScrollerArr();for(var i=0;i<ez.length;i++){var eB=(i==(ez.length-1));var eC=ez[i].getTablePaneModel().getTotalWidth();ez[i].setPaneWidth(eC);var eA=eB?1:0;ez[i].setLayoutProperties({flex:eA});}},_updateScrollBarVisibility:function(){if(!this.getBounds()){return;}var eG=qx.ui.table.pane.Scroller.HORIZONTAL_SCROLLBAR;var eJ=qx.ui.table.pane.Scroller.VERTICAL_SCROLLBAR;var eD=this._getPaneScrollerArr();var eF=false;var eI=false;for(var i=0;i<eD.length;i++){var eK=(i==(eD.length-1));var eE=eD[i].getNeededScrollBars(eF,!eK);if(eE&eG){eF=true;}if(eK&&(eE&eJ)){eI=true;}}for(var i=0;i<eD.length;i++){var eK=(i==(eD.length-1));var eH;eD[i].setHorizontalScrollBarVisible(eF);if(eK){eH=eD[i].getVerticalScrollBarVisible();}eD[i].setVerticalScrollBarVisible(eK&&eI);if(eK&&eI!=eH){this.fireDataEvent(bk,eI);}}},_initColumnMenu:function(){var eN=this.getTableModel();var eO=this.getTableColumnModel();var eP=this.getChildControl(o);eP.empty();var eM=eP.getMenu();var eQ={table:this,menu:eM,columnButton:eP};this.fireDataEvent(bx,eQ);this.__wb={};for(var eR=0,l=eN.getColumnCount();eR<l;eR++){var eL=eP.factory(P,{text:eN.getColumnName(eR),column:eR,bVisible:eO.isColumnVisible(eR)});qx.core.Assert.assertInterface(eL,qx.ui.table.IColumnMenuItem);eL.addListener(u,this._createColumnVisibilityCheckBoxHandler(eR),this);this.__wb[eR]=eL;}eQ={table:this,menu:eM,columnButton:eP};this.fireDataEvent(y,eQ);},_createColumnVisibilityCheckBoxHandler:function(eS){return function(eT){var eU=this.getTableColumnModel();eU.setColumnVisible(eS,eT.getData());};},setColumnWidth:function(eV,eW){this.getTableColumnModel().setColumnWidth(eV,eW);},_onResize:function(){this.fireEvent(A);this._updateScrollerWidths();this._updateScrollBarVisibility();},addListener:function(eX,eY,self,fa){if(this.self(arguments).__vW[eX]){var fc=[eX];for(var i=0,fb=this._getPaneScrollerArr();i<fb.length;i++){fc.push(fb[i].addListener.apply(fb[i],arguments));}return fc.join(e);}else{return qx.ui.core.Widget.prototype.addListener.call(this,eX,eY,self,fa);}},removeListener:function(fd,fe,self,ff){if(this.self(arguments).__vW[fd]){for(var i=0,fg=this._getPaneScrollerArr();i<fg.length;i++){fg[i].removeListener.apply(fg[i],arguments);}}else{qx.ui.core.Widget.prototype.removeListener.call(this,fd,fe,self,ff);}},removeListenerById:function(fh){var fl=fh.split(e);var fk=fl.shift();if(this.self(arguments).__vW[fk]){var fj=true;for(var i=0,fi=this._getPaneScrollerArr();i<fi.length;i++){fj=fi[i].removeListenerById.call(fi[i],fl[i])&&fj;}return fj;}else{return qx.ui.core.Widget.prototype.removeListenerById.call(this,fh);}},destroy:function(){this.getChildControl(o).getMenu().destroy();qx.ui.core.Widget.prototype.destroy.call(this);}},destruct:function(){if(qx.core.Variant.isSet(bD,bz)){qx.locale.Manager.getInstance().removeListener(bF,this._onChangeLocale,this);}var fn=this.getSelectionModel();if(fn){fn.dispose();}var fm=this.getDataRowRenderer();if(fm){fm.dispose();}this._cleanUpMetaColumns(0);this.getTableColumnModel().dispose();this._disposeObjects(M,bg,bC,bC,bj);this._disposeMap(N);}});})();(function(){var a="qx.ui.table.IRowRenderer";qx.Interface.define(a,{members:{updateDataRowElement:function(b,c){},getRowHeightStyle:function(d){},createRowStyle:function(e){},getRowClass:function(f){}}});})();(function(){var t="",s="table-row-background-even",r="table-row-background-selected",q="table-row",p="background-color:",o="table-row-background-focused",n=';border-bottom: 1px solid ',m=';color:',l="table-row-selected",k="table-row-background-odd",d="default",j="table-row-background-focused-selected",g="qx.ui.table.rowrenderer.Default",c="table-row-line",b="'",f="height:",e=";",h="px;",a="1px solid ",i="Boolean";qx.Class.define(g,{extend:qx.core.Object,implement:qx.ui.table.IRowRenderer,construct:function(){qx.core.Object.call(this);this.__wi=t;this.__wi={};this.__wj={};this._renderFont(qx.theme.manager.Font.getInstance().resolve(d));var u=qx.theme.manager.Color.getInstance();this.__wj.bgcolFocusedSelected=u.resolve(j);this.__wj.bgcolFocused=u.resolve(o);this.__wj.bgcolSelected=u.resolve(r);this.__wj.bgcolEven=u.resolve(s);this.__wj.bgcolOdd=u.resolve(k);this.__wj.colSelected=u.resolve(l);this.__wj.colNormal=u.resolve(q);this.__wj.horLine=u.resolve(c);},properties:{highlightFocusRow:{check:i,init:true}},members:{__wj:null,__wk:null,__wi:null,_insetY:1,_renderFont:function(v){if(v){this.__wk=v.getStyles();this.__wi=qx.bom.element.Style.compile(this.__wk);this.__wi=this.__wi.replace(/"/g,b);}else{this.__wi=t;this.__wk=qx.bom.Font.getDefaultStyles();}},updateDataRowElement:function(w,x){var z=this.__wk;var y=x.style;qx.bom.element.Style.setStyles(x,z);if(w.focusedRow&&this.getHighlightFocusRow()){y.backgroundColor=w.selected?this.__wj.bgcolFocusedSelected:this.__wj.bgcolFocused;}else{if(w.selected){y.backgroundColor=this.__wj.bgcolSelected;}else{y.backgroundColor=(w.row%2==0)?this.__wj.bgcolEven:this.__wj.bgcolOdd;}}y.color=w.selected?this.__wj.colSelected:this.__wj.colNormal;y.borderBottom=a+this.__wj.horLine;},getRowHeightStyle:function(A){if(qx.bom.client.Feature.CONTENT_BOX){A-=this._insetY;}return f+A+h;},createRowStyle:function(B){var C=[];C.push(e);C.push(this.__wi);C.push(p);if(B.focusedRow&&this.getHighlightFocusRow()){C.push(B.selected?this.__wj.bgcolFocusedSelected:this.__wj.bgcolFocused);}else{if(B.selected){C.push(this.__wj.bgcolSelected);}else{C.push((B.row%2==0)?this.__wj.bgcolEven:this.__wj.bgcolOdd);}}C.push(m);C.push(B.selected?this.__wj.colSelected:this.__wj.colNormal);C.push(n,this.__wj.horLine);return C.join(t);},getRowClass:function(D){return t;},getRowAttributes:function(E){return t;}},destruct:function(){this.__wj=this.__wk=this.__wi=null;}});})();(function(){var a="qx.ui.table.IColumnMenuButton";qx.Interface.define(a,{properties:{menu:{}},members:{factory:function(b,c){return true;},empty:function(){return true;}}});})();(function(){var l="pressed",k="hovered",j="changeVisibility",i="qx.ui.menu.Menu",h="submenu",g="Enter",f="contextmenu",d="changeMenu",c="qx.ui.form.MenuButton",b="abandoned",a="_applyMenu";qx.Class.define(c,{extend:qx.ui.form.Button,construct:function(m,n,o){qx.ui.form.Button.call(this,m,n);if(o!=null){this.setMenu(o);}},properties:{menu:{check:i,nullable:true,apply:a,event:d}},members:{_applyMenu:function(p,q){if(q){q.removeListener(j,this._onMenuChange,this);q.resetOpener();}if(p){p.addListener(j,this._onMenuChange,this);p.setOpener(this);p.removeState(h);p.removeState(f);}},open:function(r){var s=this.getMenu();if(s){qx.ui.menu.Manager.getInstance().hideAll();s.setOpener(this);s.open();if(r){var t=s.getSelectables()[0];if(t){s.setSelectedButton(t);}}}},_onMenuChange:function(e){var u=this.getMenu();if(u.isVisible()){this.addState(l);}else{this.removeState(l);}},_onMouseDown:function(e){qx.ui.form.Button.prototype._onMouseDown.call(this,e);var v=this.getMenu();if(v){if(!v.isVisible()){this.open();}else{v.exclude();}e.stopPropagation();}},_onMouseUp:function(e){qx.ui.form.Button.prototype._onMouseUp.call(this,e);e.stopPropagation();},_onMouseOver:function(e){this.addState(k);},_onMouseOut:function(e){this.removeState(k);},_onKeyDown:function(e){switch(e.getKeyIdentifier()){case g:this.removeState(b);this.addState(l);var w=this.getMenu();if(w){if(!w.isVisible()){this.open();}else{w.exclude();}}e.stopPropagation();}},_onKeyUp:function(e){}},destruct:function(){if(this.getMenu()){if(!qx.core.ObjectRegistry.inShutDown){this.getMenu().destroy();}}}});})();(function(){var f="menu-button",e="table-column-reset-button",d="separator",c="user-button",b="qx.ui.table.columnmenu.Button",a="menu";qx.Class.define(b,{extend:qx.ui.form.MenuButton,implement:qx.ui.table.IColumnMenuButton,construct:function(){qx.ui.form.MenuButton.call(this);this.__wl=new qx.ui.core.Blocker(this);},members:{__wm:null,__wl:null,factory:function(g,h){switch(g){case a:var j=new qx.ui.menu.Menu();this.setMenu(j);return j;case f:var m=new qx.ui.table.columnmenu.MenuItem(h.text);m.setVisible(h.bVisible);this.getMenu().add(m);return m;case c:var k=new qx.ui.menu.Button(h.text);k.set({appearance:e});return k;case d:return new qx.ui.menu.Separator();default:throw new Error("Unrecognized factory request: "+g);}},getBlocker:function(){return this.__wl;},empty:function(){var n=this.getMenu();var o=n.getChildren();for(var i=0,l=o.length;i<l;i++){o[0].destroy();}}},destruct:function(){this.__wl.dispose();}});})();(function(){var t="keypress",s="interval",r="keydown",q="mousedown",p="keyup",o="__on",n="blur",m="Enter",l="__oo",k="Up",c="Escape",j="qx.ui.menu.Manager",g="Left",b="__om",a="Down",f="Right",d="singleton",h="Space";qx.Class.define(j,{type:d,extend:qx.core.Object,construct:function(){qx.core.Object.call(this);this.__om=[];var u=document.body;var v=qx.event.Registration;v.addListener(window.document.documentElement,q,this._onMouseDown,this,true);v.addListener(u,r,this._onKeyUpDown,this,true);v.addListener(u,p,this._onKeyUpDown,this,true);v.addListener(u,t,this._onKeyPress,this,true);if(!qx.bom.client.Feature.TOUCH){qx.bom.Element.addListener(window,n,this.hideAll,this);}this.__on=new qx.event.Timer;this.__on.addListener(s,this._onOpenInterval,this);this.__oo=new qx.event.Timer;this.__oo.addListener(s,this._onCloseInterval,this);},members:{__op:null,__oq:null,__on:null,__oo:null,__om:null,_getChild:function(w,x,y,z){var A=w.getChildren();var length=A.length;var B;for(var i=x;i<length&&i>=0;i+=y){B=A[i];if(B.isEnabled()&&!B.isAnonymous()){return B;}}if(z){i=i==length?0:length-1;for(;i!=x;i+=y){B=A[i];if(B.isEnabled()&&!B.isAnonymous()){return B;}}}return null;},_isInMenu:function(C){while(C){if(C instanceof qx.ui.menu.Menu){return true;}C=C.getLayoutParent();}return false;},_getMenuButton:function(D){while(D){if(D instanceof qx.ui.menu.AbstractButton){return D;}D=D.getLayoutParent();}return null;},add:function(E){{};var F=this.__om;F.push(E);E.setZIndex(1e6+F.length);},remove:function(G){{};var H=this.__om;if(H){qx.lang.Array.remove(H,G);}},hideAll:function(){var I=this.__om;if(I){for(var i=I.length-1;i>=0;i--){I[i].exclude();}}},getActiveMenu:function(){var J=this.__om;return J.length>0?J[J.length-1]:null;},scheduleOpen:function(K){this.cancelClose(K);if(K.isVisible()){if(this.__op){this.cancelOpen(this.__op);}}else if(this.__op!=K){this.__op=K;this.__on.restartWith(K.getOpenInterval());}},scheduleClose:function(L){this.cancelOpen(L);if(!L.isVisible()){if(this.__oq){this.cancelClose(this.__oq);}}else if(this.__oq!=L){this.__oq=L;this.__oo.restartWith(L.getCloseInterval());}},cancelOpen:function(M){if(this.__op==M){this.__on.stop();this.__op=null;}},cancelClose:function(N){if(this.__oq==N){this.__oo.stop();this.__oq=null;}},_onOpenInterval:function(e){this.__on.stop();this.__op.open();this.__op=null;},_onCloseInterval:function(e){this.__oo.stop();this.__oq.exclude();this.__oq=null;},_onMouseDown:function(e){var O=e.getTarget();O=qx.ui.core.Widget.getWidgetByElement(O,true);if(O==null){this.hideAll();return;}if(O.getMenu&&O.getMenu()&&O.getMenu().isVisible()){return;}if(this.__om.length>0&&!this._isInMenu(O)){this.hideAll();}},__or:{"Enter":1,"Space":1},__os:{"Escape":1,"Up":1,"Down":1,"Left":1,"Right":1},_onKeyUpDown:function(e){var P=this.getActiveMenu();if(!P){return;}var Q=e.getKeyIdentifier();if(this.__os[Q]||(this.__or[Q]&&P.getSelectedButton())){e.stopPropagation();}},_onKeyPress:function(e){var R=this.getActiveMenu();if(!R){return;}var S=e.getKeyIdentifier();var U=this.__os[S];var T=this.__or[S];if(U){switch(S){case k:this._onKeyPressUp(R);break;case a:this._onKeyPressDown(R);break;case g:this._onKeyPressLeft(R);break;case f:this._onKeyPressRight(R);break;case c:this.hideAll();break;}e.stopPropagation();e.preventDefault();}else if(T){var V=R.getSelectedButton();if(V){switch(S){case m:this._onKeyPressEnter(R,V,e);break;case h:this._onKeyPressSpace(R,V,e);break;}e.stopPropagation();e.preventDefault();}}},_onKeyPressUp:function(W){var X=W.getSelectedButton();var Y=W.getChildren();var bb=X?W.indexOf(X)-1:Y.length-1;var ba=this._getChild(W,bb,-1,true);if(ba){W.setSelectedButton(ba);}else{W.resetSelectedButton();}},_onKeyPressDown:function(bc){var bd=bc.getSelectedButton();var bf=bd?bc.indexOf(bd)+1:0;var be=this._getChild(bc,bf,1,true);if(be){bc.setSelectedButton(be);}else{bc.resetSelectedButton();}},_onKeyPressLeft:function(bg){var bl=bg.getOpener();if(!bl){return;}if(bl instanceof qx.ui.menu.AbstractButton){var bi=bl.getLayoutParent();bi.resetOpenedButton();bi.setSelectedButton(bl);}else if(bl instanceof qx.ui.menubar.Button){var bk=bl.getMenuBar().getMenuButtons();var bh=bk.indexOf(bl);if(bh===-1){return;}var bm=null;var length=bk.length;for(var i=1;i<=length;i++){var bj=bk[(bh-i+length)%length];if(bj.isEnabled()){bm=bj;break;}}if(bm&&bm!=bl){bm.open(true);}}},_onKeyPressRight:function(bn){var bp=bn.getSelectedButton();if(bp){var bo=bp.getMenu();if(bo){bn.setOpenedButton(bp);var bv=this._getChild(bo,0,1);if(bv){bo.setSelectedButton(bv);}return;}}else if(!bn.getOpenedButton()){var bv=this._getChild(bn,0,1);if(bv){bn.setSelectedButton(bv);if(bv.getMenu()){bn.setOpenedButton(bv);}return;}}var bt=bn.getOpener();if(bt instanceof qx.ui.menu.Button&&bp){while(bt){bt=bt.getLayoutParent();if(bt instanceof qx.ui.menu.Menu){bt=bt.getOpener();if(bt instanceof qx.ui.menubar.Button){break;}}else{break;}}if(!bt){return;}}if(bt instanceof qx.ui.menubar.Button){var bs=bt.getMenuBar().getMenuButtons();var bq=bs.indexOf(bt);if(bq===-1){return;}var bu=null;var length=bs.length;for(var i=1;i<=length;i++){var br=bs[(bq+i)%length];if(br.isEnabled()){bu=br;break;}}if(bu&&bu!=bt){bu.open(true);}}},_onKeyPressEnter:function(bw,bx,e){if(bx.hasListener(t)){var by=e.clone();by.setBubbles(false);by.setTarget(bx);bx.dispatchEvent(by);}this.hideAll();},_onKeyPressSpace:function(bz,bA,e){if(bA.hasListener(t)){var bB=e.clone();bB.setBubbles(false);bB.setTarget(bA);bA.dispatchEvent(bB);}}},destruct:function(){var bD=qx.event.Registration;var bC=document.body;bD.removeListener(window.document.documentElement,q,this._onMouseDown,this,true);bD.removeListener(bC,r,this._onKeyUpDown,this,true);bD.removeListener(bC,p,this._onKeyUpDown,this,true);bD.removeListener(bC,t,this._onKeyPress,this,true);this._disposeObjects(o,l);this._disposeArray(b);}});})();(function(){var l="indexOf",k="addAfter",j="add",i="addBefore",h="_",g="addAt",f="hasChildren",e="removeAt",d="removeAll",c="getChildren",a="remove",b="qx.ui.core.MRemoteChildrenHandling";qx.Mixin.define(b,{members:{__ex:function(m,n,o,p){var q=this.getChildrenContainer();if(q===this){m=h+m;}return (q[m])(n,o,p);},getChildren:function(){return this.__ex(c);},hasChildren:function(){return this.__ex(f);},add:function(r,s){return this.__ex(j,r,s);},remove:function(t){return this.__ex(a,t);},removeAll:function(){return this.__ex(d);},indexOf:function(u){return this.__ex(l,u);},addAt:function(v,w,x){this.__ex(g,v,w,x);},addBefore:function(y,z,A){this.__ex(i,y,z,A);},addAfter:function(B,C,D){this.__ex(k,B,C,D);},removeAt:function(E){this.__ex(e,E);}}});})();(function(){var l="slidebar",k="Integer",j="resize",h="qx.ui.core.Widget",g="selected",f="visible",d="Boolean",c="mouseout",b="excluded",a="menu",A="_applySelectedButton",z="_applyOpenInterval",y="_applySpacingY",x="_blocker",w="_applyCloseInterval",v="_applyBlockerColor",u="_applyIconColumnWidth",t="mouseover",s="qx.ui.menu.Menu",r="Color",p="Number",q="_applyOpenedButton",n="_applySpacingX",o="_applyBlockerOpacity",m="_applyArrowColumnWidth";qx.Class.define(s,{extend:qx.ui.core.Widget,include:[qx.ui.core.MPlacement,qx.ui.core.MRemoteChildrenHandling],construct:function(){qx.ui.core.Widget.call(this);this._setLayout(new qx.ui.menu.Layout);var B=this.getApplicationRoot();B.add(this);this.addListener(t,this._onMouseOver);this.addListener(c,this._onMouseOut);this.addListener(j,this._onResize,this);B.addListener(j,this._onResize,this);this._blocker=new qx.ui.core.Blocker(B);this.initVisibility();this.initKeepFocus();this.initKeepActive();},properties:{appearance:{refine:true,init:a},allowGrowX:{refine:true,init:false},allowGrowY:{refine:true,init:false},visibility:{refine:true,init:b},keepFocus:{refine:true,init:true},keepActive:{refine:true,init:true},spacingX:{check:k,apply:n,init:0,themeable:true},spacingY:{check:k,apply:y,init:0,themeable:true},iconColumnWidth:{check:k,init:0,themeable:true,apply:u},arrowColumnWidth:{check:k,init:0,themeable:true,apply:m},blockerColor:{check:r,init:null,nullable:true,apply:v,themeable:true},blockerOpacity:{check:p,init:1,apply:o,themeable:true},selectedButton:{check:h,nullable:true,apply:A},openedButton:{check:h,nullable:true,apply:q},opener:{check:h,nullable:true},openInterval:{check:k,themeable:true,init:250,apply:z},closeInterval:{check:k,themeable:true,init:250,apply:w},blockBackground:{check:d,themeable:true,init:false}},members:{__qv:null,__qw:null,_blocker:null,open:function(){if(this.getOpener()!=null){this.placeToWidget(this.getOpener());this.__qy();this.show();this._placementTarget=this.getOpener();}else{this.warn("The menu instance needs a configured 'opener' widget!");}},openAtMouse:function(e){this.placeToMouse(e);this.__qy();this.show();this._placementTarget={left:e.getDocumentLeft(),top:e.getDocumentTop()};},openAtPoint:function(C){this.placeToPoint(C);this.__qy();this.show();this._placementTarget=C;},addSeparator:function(){this.add(new qx.ui.menu.Separator);},getColumnSizes:function(){return this._getMenuLayout().getColumnSizes();},getSelectables:function(){var D=[];var E=this.getChildren();for(var i=0;i<E.length;i++){if(E[i].isEnabled()){D.push(E[i]);}}return D;},_applyIconColumnWidth:function(F,G){this._getMenuLayout().setIconColumnWidth(F);},_applyArrowColumnWidth:function(H,I){this._getMenuLayout().setArrowColumnWidth(H);},_applySpacingX:function(J,K){this._getMenuLayout().setColumnSpacing(J);},_applySpacingY:function(L,M){this._getMenuLayout().setSpacing(L);},_applyVisibility:function(N,O){qx.ui.core.Widget.prototype._applyVisibility.call(this,N,O);var P=qx.ui.menu.Manager.getInstance();if(N===f){P.add(this);var Q=this.getParentMenu();if(Q){Q.setOpenedButton(this.getOpener());}}else if(O===f){P.remove(this);var Q=this.getParentMenu();if(Q&&Q.getOpenedButton()==this.getOpener()){Q.resetOpenedButton();}this.resetOpenedButton();this.resetSelectedButton();}this.__qx();},__qx:function(){if(this.isVisible()){if(this.getBlockBackground()){var R=this.getZIndex();this._blocker.blockContent(R-1);}}else{if(this._blocker.isContentBlocked()){this._blocker.unblockContent();}}},getParentMenu:function(){var S=this.getOpener();if(!S||!(S instanceof qx.ui.menu.AbstractButton)){return null;}while(S&&!(S instanceof qx.ui.menu.Menu)){S=S.getLayoutParent();}return S;},_applySelectedButton:function(T,U){if(U){U.removeState(g);}if(T){T.addState(g);}},_applyOpenedButton:function(V,W){if(W){W.getMenu().exclude();}if(V){V.getMenu().open();}},_applyBlockerColor:function(X,Y){this._blocker.setColor(X);},_applyBlockerOpacity:function(ba,bb){this._blocker.setOpacity(ba);},getChildrenContainer:function(){return this.getChildControl(l,true)||this;},_createChildControlImpl:function(bc,bd){var be;switch(bc){case l:var be=new qx.ui.menu.MenuSlideBar();var bg=this._getLayout();this._setLayout(new qx.ui.layout.Grow());var bf=be.getLayout();be.setLayout(bg);bf.dispose();var bh=qx.lang.Array.clone(this.getChildren());for(var i=0;i<bh.length;i++){be.add(bh[i]);}this.removeListener(j,this._onResize,this);be.getChildrenContainer().addListener(j,this._onResize,this);this._add(be);break;}return be||qx.ui.core.Widget.prototype._createChildControlImpl.call(this,bc);},_getMenuLayout:function(){if(this.hasChildControl(l)){return this.getChildControl(l).getChildrenContainer().getLayout();}else{return this._getLayout();}},_getMenuBounds:function(){if(this.hasChildControl(l)){return this.getChildControl(l).getChildrenContainer().getBounds();}else{return this.getBounds();}},_computePlacementSize:function(){return this._getMenuBounds();},__qy:function(){var bj=this._getMenuBounds();if(!bj){this.addListenerOnce(j,this.__qy,this);return;}var bi=this.getLayoutParent().getBounds().height;var top=this.getLayoutProperties().top;var bk=this.getLayoutProperties().left;if(top<0){this._assertSlideBar(function(){this.setHeight(bj.height+top);this.moveTo(bk,0);});}else if(top+bj.height>bi){this._assertSlideBar(function(){this.setHeight(bi-top);});}else{this.setHeight(null);}},_assertSlideBar:function(bl){if(this.hasChildControl(l)){return bl.call(this);}this.__qw=bl;qx.ui.core.queue.Widget.add(this);},syncWidget:function(){this.getChildControl(l);if(this.__qw){this.__qw.call(this);delete this.__qw;}},_onResize:function(){if(this.isVisible()){var bm=this._placementTarget;if(!bm){return;}else if(bm instanceof qx.ui.core.Widget){this.placeToWidget(bm);}else if(bm.top!==undefined){this.placeToPoint(bm);}else{throw new Error("Unknown target: "+bm);}this.__qy();}},_onMouseOver:function(e){var bo=qx.ui.menu.Manager.getInstance();bo.cancelClose(this);var bp=e.getTarget();if(bp.isEnabled()&&bp instanceof qx.ui.menu.AbstractButton){this.setSelectedButton(bp);var bn=bp.getMenu&&bp.getMenu();if(bn){bn.setOpener(bp);bo.scheduleOpen(bn);this.__qv=bn;}else{var bq=this.getOpenedButton();if(bq){bo.scheduleClose(bq.getMenu());}if(this.__qv){bo.cancelOpen(this.__qv);this.__qv=null;}}}else if(!this.getOpenedButton()){this.resetSelectedButton();}},_onMouseOut:function(e){var br=qx.ui.menu.Manager.getInstance();if(!qx.ui.core.Widget.contains(this,e.getRelatedTarget())){var bs=this.getOpenedButton();bs?this.setSelectedButton(bs):this.resetSelectedButton();if(bs){br.cancelClose(bs.getMenu());}if(this.__qv){br.cancelOpen(this.__qv);}}}},destruct:function(){if(!qx.core.ObjectRegistry.inShutDown){qx.ui.menu.Manager.getInstance().remove(this);}this.getApplicationRoot().removeListener(j,this._onResize,this);this._placementTarget=null;this._disposeObjects(x);}});})();(function(){var c="Integer",b="_applyLayoutChange",a="qx.ui.menu.Layout";qx.Class.define(a,{extend:qx.ui.layout.VBox,properties:{columnSpacing:{check:c,init:0,apply:b},spanColumn:{check:c,init:1,nullable:true,apply:b},iconColumnWidth:{check:c,init:0,themeable:true,apply:b},arrowColumnWidth:{check:c,init:0,themeable:true,apply:b}},members:{__qm:null,_computeSizeHint:function(){var q=this._getLayoutChildren();var o,g,j;var e=this.getSpanColumn();var h=this.__qm=[0,0,0,0];var m=this.getColumnSpacing();var k=0;var f=0;for(var i=0,l=q.length;i<l;i++){o=q[i];if(o.isAnonymous()){continue;}g=o.getChildrenSizes();for(var n=0;n<g.length;n++){if(e!=null&&n==e&&g[e+1]==0){k=Math.max(k,g[n]);}else{h[n]=Math.max(h[n],g[n]);}}var d=q[i].getInsets();f=Math.max(f,d.left+d.right);}if(e!=null&&h[e]+m+h[e+1]<k){h[e]=k-h[e+1]-m;}if(k==0){j=m*2;}else{j=m*3;}if(h[0]==0){h[0]=this.getIconColumnWidth();}if(h[3]==0){h[3]=this.getArrowColumnWidth();}var p=qx.ui.layout.VBox.prototype._computeSizeHint.call(this).height;return {minHeight:p,height:p,width:qx.lang.Array.sum(h)+f+j};},getColumnSizes:function(){return this.__qm||null;}},destruct:function(){this.__qm=null;}});})();(function(){var l="zIndex",k="px",j="keydown",h="deactivate",g="resize",f="keyup",d="keypress",c="backgroundColor",b="_applyOpacity",a="Boolean",x="__sg",w="__se",v="opacity",u="interval",t="Tab",s="Color",r="qx.ui.root.Page",q="Number",p="qx.ui.core.Blocker",o="__sc",m="qx.ui.root.Application",n="_applyColor";qx.Class.define(p,{extend:qx.core.Object,construct:function(y){qx.core.Object.call(this);this._widget=y;this._isPageRoot=(qx.Class.isDefined(r)&&y instanceof qx.ui.root.Page);if(this._isPageRoot){y.addListener(g,this.__sh,this);}if(qx.Class.isDefined(m)&&y instanceof qx.ui.root.Application){this.setKeepBlockerActive(true);}this.__rY=[];this.__sa=[];this.__sb=[];},properties:{color:{check:s,init:null,nullable:true,apply:n,themeable:true},opacity:{check:q,init:1,apply:b,themeable:true},keepBlockerActive:{check:a,init:false}},members:{__sc:null,__sd:0,__se:null,__sb:null,__rY:null,__sa:null,__sf:null,__sg:null,_isPageRoot:false,_widget:null,__sh:function(e){var z=e.getData();if(this.isContentBlocked()){this.getContentBlockerElement().setStyles({width:z.width,height:z.height});}if(this.isBlocked()){this.getBlockerElement().setStyles({width:z.width,height:z.height});}},_applyColor:function(A,B){var C=qx.theme.manager.Color.getInstance().resolve(A);this.__si(c,C);},_applyOpacity:function(D,E){this.__si(v,D);},__si:function(F,G){var H=[];this.__sc&&H.push(this.__sc);this.__se&&H.push(this.__se);for(var i=0;i<H.length;i++){H[i].setStyle(F,G);}},_backupActiveWidget:function(){var I=qx.event.Registration.getManager(window).getHandler(qx.event.handler.Focus);this.__rY.push(I.getActive());this.__sa.push(I.getFocus());if(this._widget.isFocusable()){this._widget.focus();}},_restoreActiveWidget:function(){var L=this.__rY.length;if(L>0){var K=this.__rY[L-1];if(K){qx.bom.Element.activate(K);}this.__rY.pop();}var J=this.__sa.length;if(J>0){var K=this.__sa[J-1];if(K){qx.bom.Element.focus(this.__sa[J-1]);}this.__sa.pop();}},__sj:function(){return new qx.html.Blocker(this.getColor(),this.getOpacity());},getBlockerElement:function(){if(!this.__sc){this.__sc=this.__sj();this.__sc.setStyle(l,15);this._widget.getContainerElement().add(this.__sc);this.__sc.exclude();}return this.__sc;},block:function(){this.__sd++;if(this.__sd<2){this._backupActiveWidget();var M=this.getBlockerElement();M.include();M.activate();M.addListener(h,this.__so,this);M.addListener(d,this.__sn,this);M.addListener(j,this.__sn,this);M.addListener(f,this.__sn,this);}},isBlocked:function(){return this.__sd>0;},unblock:function(){if(!this.isBlocked()){return;}this.__sd--;if(this.__sd<1){this.__sk();this.__sd=0;}},forceUnblock:function(){if(!this.isBlocked()){return;}this.__sd=0;this.__sk();},__sk:function(){this._restoreActiveWidget();var N=this.getBlockerElement();N.removeListener(h,this.__so,this);N.removeListener(d,this.__sn,this);N.removeListener(j,this.__sn,this);N.removeListener(f,this.__sn,this);N.exclude();},getContentBlockerElement:function(){if(!this.__se){this.__se=this.__sj();this._widget.getContentElement().add(this.__se);this.__se.exclude();}return this.__se;},blockContent:function(O){var P=this.getContentBlockerElement();P.setStyle(l,O);this.__sb.push(O);if(this.__sb.length<2){P.include();if(this._isPageRoot){if(!this.__sg){this.__sg=new qx.event.Timer(300);this.__sg.addListener(u,this.__sm,this);}this.__sg.start();this.__sm();}}},isContentBlocked:function(){return this.__sb.length>0;},unblockContent:function(){if(!this.isContentBlocked()){return;}this.__sb.pop();var Q=this.__sb[this.__sb.length-1];var R=this.getContentBlockerElement();R.setStyle(l,Q);if(this.__sb.length<1){this.__sl();this.__sb=[];}},forceUnblockContent:function(){if(!this.isContentBlocked()){return;}this.__sb=[];var S=this.getContentBlockerElement();S.setStyle(l,null);this.__sl();},__sl:function(){this.getContentBlockerElement().exclude();if(this._isPageRoot){this.__sg.stop();}},__sm:function(){var T=this._widget.getContainerElement().getDomElement();var U=qx.dom.Node.getDocument(T);this.getContentBlockerElement().setStyles({height:U.documentElement.scrollHeight+k,width:U.documentElement.scrollWidth+k});},__sn:function(e){if(e.getKeyIdentifier()==t){e.stop();}},__so:function(){if(this.getKeepBlockerActive()){this.getBlockerElement().activate();}}},destruct:function(){if(this._isPageRoot){this._widget.removeListener(g,this.__sh,this);}this._disposeObjects(w,o,x);this.__sf=this.__rY=this.__sa=this._widget=this.__sb=null;}});})();(function(){var i="qx.ui.window.Window",h="changeModal",g="changeVisibility",f="changeActive",d="_applyActiveWindow",c="__og",b="__of",a="qx.ui.window.MDesktop";qx.Mixin.define(a,{properties:{activeWindow:{check:i,apply:d,init:null,nullable:true}},members:{__of:null,__og:null,getWindowManager:function(){if(!this.__og){this.setWindowManager(new qx.ui.window.Window.DEFAULT_MANAGER_CLASS());}return this.__og;},supportsMaximize:function(){return true;},setWindowManager:function(j){if(this.__og){this.__og.setDesktop(null);}j.setDesktop(this);this.__og=j;},_onChangeActive:function(e){if(e.getData()){this.setActiveWindow(e.getTarget());}else if(this.getActiveWindow()==e.getTarget()){this.setActiveWindow(null);}},_applyActiveWindow:function(k,l){this.getWindowManager().changeActiveWindow(k,l);this.getWindowManager().updateStack();},_onChangeModal:function(e){this.getWindowManager().updateStack();},_onChangeVisibility:function(){this.getWindowManager().updateStack();},_afterAddChild:function(m){if(qx.Class.isDefined(i)&&m instanceof qx.ui.window.Window){this._addWindow(m);}},_addWindow:function(n){if(!qx.lang.Array.contains(this.getWindows(),n)){this.getWindows().push(n);n.addListener(f,this._onChangeActive,this);n.addListener(h,this._onChangeModal,this);n.addListener(g,this._onChangeVisibility,this);}if(n.getActive()){this.setActiveWindow(n);}this.getWindowManager().updateStack();},_afterRemoveChild:function(o){if(qx.Class.isDefined(i)&&o instanceof qx.ui.window.Window){this._removeWindow(o);}},_removeWindow:function(p){qx.lang.Array.remove(this.getWindows(),p);p.removeListener(f,this._onChangeActive,this);p.removeListener(h,this._onChangeModal,this);p.removeListener(g,this._onChangeVisibility,this);this.getWindowManager().updateStack();},getWindows:function(){if(!this.__of){this.__of=[];}return this.__of;}},destruct:function(){this._disposeArray(b);this._disposeObjects(c);}});})();(function(){var f="_applyBlockerColor",e="Number",d="__rQ",c="qx.ui.core.MBlocker",b="_applyBlockerOpacity",a="Color";qx.Mixin.define(c,{construct:function(){this.__rQ=new qx.ui.core.Blocker(this);},properties:{blockerColor:{check:a,init:null,nullable:true,apply:f,themeable:true},blockerOpacity:{check:e,init:1,apply:b,themeable:true}},members:{__rQ:null,_applyBlockerColor:function(g,h){this.__rQ.setColor(g);},_applyBlockerOpacity:function(i,j){this.__rQ.setOpacity(i);},block:function(){this.__rQ.block();},isBlocked:function(){return this.__rQ.isBlocked();},unblock:function(){this.__rQ.unblock();},forceUnblock:function(){this.__rQ.forceUnblock();},blockContent:function(k){this.__rQ.blockContent(k);},isContentBlocked:function(){return this.__rQ.isContentBlocked();},unblockContent:function(){this.__rQ.unblockContent();},forceUnblockContent:function(){this.__rQ.forceUnblockContent();},getBlocker:function(){return this.__rQ;}},destruct:function(){this._disposeObjects(d);}});})();(function(){var p="contextmenu",o="help",n="qx.client",m="changeGlobalCursor",l="abstract",k="Boolean",j="root",i="",h=" !important",g="_applyGlobalCursor",c="_applyNativeHelp",f=";",d="qx.ui.root.Abstract",b="String",a="*";qx.Class.define(d,{type:l,extend:qx.ui.core.Widget,include:[qx.ui.core.MChildrenHandling,qx.ui.core.MBlocker,qx.ui.window.MDesktop],construct:function(){qx.ui.core.Widget.call(this);qx.ui.core.FocusHandler.getInstance().addRoot(this);qx.ui.core.queue.Visibility.add(this);this.initNativeHelp();},properties:{appearance:{refine:true,init:j},enabled:{refine:true,init:true},focusable:{refine:true,init:true},globalCursor:{check:b,nullable:true,themeable:true,apply:g,event:m},nativeContextMenu:{refine:true,init:false},nativeHelp:{check:k,init:false,apply:c}},members:{__mS:null,isRootWidget:function(){return true;},getLayout:function(){return this._getLayout();},_applyGlobalCursor:qx.core.Variant.select(n,{"mshtml":function(q,r){},"default":function(s,t){var u=qx.bom.Stylesheet;var v=this.__mS;if(!v){this.__mS=v=u.createElement();}u.removeAllRules(v);if(s){u.addRule(v,a,qx.bom.element.Cursor.compile(s).replace(f,i)+h);}}}),_applyNativeContextMenu:function(w,x){if(w){this.removeListener(p,this._onNativeContextMenu,this,true);}else{this.addListener(p,this._onNativeContextMenu,this,true);}},_onNativeContextMenu:function(e){if(e.getTarget().getNativeContextMenu()){return;}e.preventDefault();},_applyNativeHelp:qx.core.Variant.select(n,{"mshtml":function(y,z){if(z===false){qx.bom.Event.removeNativeListener(document,o,qx.lang.Function.returnFalse);}if(y===false){qx.bom.Event.addNativeListener(document,o,qx.lang.Function.returnFalse);}},"default":function(){}})},destruct:function(){this.__mS=null;},defer:function(A,B){qx.ui.core.MChildrenHandling.remap(B);}});})();(function(){var n="resize",m="position",l="0px",k="webkit",j="paddingLeft",i="$$widget",h="qx.ui.root.Application",g="hidden",f="qx.client",d="div",a="paddingTop",c="100%",b="absolute";qx.Class.define(h,{extend:qx.ui.root.Abstract,construct:function(o){this.__pj=qx.dom.Node.getWindow(o);this.__pk=o;qx.ui.root.Abstract.call(this);qx.event.Registration.addListener(this.__pj,n,this._onResize,this);this._setLayout(new qx.ui.layout.Canvas());qx.ui.core.queue.Layout.add(this);qx.ui.core.FocusHandler.getInstance().connectTo(this);this.getContentElement().disableScrolling();},members:{__pj:null,__pk:null,_createContainerElement:function(){var p=this.__pk;if(qx.core.Variant.isSet(f,k)){if(!p.body){alert("The application could not be started due to a missing body tag in the HTML file!");}}var t=p.documentElement.style;var q=p.body.style;t.overflow=q.overflow=g;t.padding=t.margin=q.padding=q.margin=l;t.width=t.height=q.width=q.height=c;var s=p.createElement(d);p.body.appendChild(s);var r=new qx.html.Root(s);r.setStyle(m,b);r.setAttribute(i,this.toHashCode());return r;},_onResize:function(e){qx.ui.core.queue.Layout.add(this);},_computeSizeHint:function(){var u=qx.bom.Viewport.getWidth(this.__pj);var v=qx.bom.Viewport.getHeight(this.__pj);return {minWidth:u,width:u,maxWidth:u,minHeight:v,height:v,maxHeight:v};},_applyPadding:function(w,x,name){if(w&&(name==a||name==j)){throw new Error("The root widget does not support 'left', or 'top' paddings!");}qx.ui.root.Abstract.prototype._applyPadding.call(this,w,x,name);},_applyDecorator:function(y,z){qx.ui.root.Abstract.prototype._applyDecorator.call(this,y,z);if(!y){return;}var A=this.getDecoratorElement().getInsets();if(A.left||A.top){throw new Error("The root widget does not support decorators with 'left', or 'top' insets!");}}},destruct:function(){this.__pj=this.__pk=null;}});})();(function(){var k="keypress",j="focusout",h="activate",g="Tab",f="singleton",d="__bE",c="deactivate",b="focusin",a="qx.ui.core.FocusHandler";qx.Class.define(a,{extend:qx.core.Object,type:f,construct:function(){qx.core.Object.call(this);this.__bE={};},members:{__bE:null,__bF:null,__bG:null,__bH:null,connectTo:function(m){m.addListener(k,this.__bI,this);m.addListener(b,this._onFocusIn,this,true);m.addListener(j,this._onFocusOut,this,true);m.addListener(h,this._onActivate,this,true);m.addListener(c,this._onDeactivate,this,true);},addRoot:function(n){this.__bE[n.$$hash]=n;},removeRoot:function(o){delete this.__bE[o.$$hash];},getActiveWidget:function(){return this.__bF;},isActive:function(p){return this.__bF==p;},getFocusedWidget:function(){return this.__bG;},isFocused:function(q){return this.__bG==q;},isFocusRoot:function(r){return !!this.__bE[r.$$hash];},_onActivate:function(e){var t=e.getTarget();this.__bF=t;var s=this.__bJ(t);if(s!=this.__bH){this.__bH=s;}},_onDeactivate:function(e){var u=e.getTarget();if(this.__bF==u){this.__bF=null;}},_onFocusIn:function(e){var v=e.getTarget();if(v!=this.__bG){this.__bG=v;v.visualizeFocus();}},_onFocusOut:function(e){var w=e.getTarget();if(w==this.__bG){this.__bG=null;w.visualizeBlur();}},__bI:function(e){if(e.getKeyIdentifier()!=g){return;}if(!this.__bH){return;}e.stopPropagation();e.preventDefault();var x=this.__bG;if(!e.isShiftPressed()){var y=x?this.__bN(x):this.__bL();}else{var y=x?this.__bO(x):this.__bM();}if(y){y.tabFocus();}},__bJ:function(z){var A=this.__bE;while(z){if(A[z.$$hash]){return z;}z=z.getLayoutParent();}return null;},__bK:function(B,C){if(B===C){return 0;}var E=B.getTabIndex()||0;var D=C.getTabIndex()||0;if(E!=D){return E-D;}var J=B.getContainerElement().getDomElement();var I=C.getContainerElement().getDomElement();var H=qx.bom.element.Location;var G=H.get(J);var F=H.get(I);if(G.top!=F.top){return G.top-F.top;}if(G.left!=F.left){return G.left-F.left;}var K=B.getZIndex();var L=C.getZIndex();if(K!=L){return K-L;}return 0;},__bL:function(){return this.__bR(this.__bH,null);},__bM:function(){return this.__bS(this.__bH,null);},__bN:function(M){var N=this.__bH;if(N==M){return this.__bL();}while(M&&M.getAnonymous()){M=M.getLayoutParent();}if(M==null){return [];}var O=[];this.__bP(N,M,O);O.sort(this.__bK);var P=O.length;return P>0?O[0]:this.__bL();},__bO:function(Q){var R=this.__bH;if(R==Q){return this.__bM();}while(Q&&Q.getAnonymous()){Q=Q.getLayoutParent();}if(Q==null){return [];}var S=[];this.__bQ(R,Q,S);S.sort(this.__bK);var T=S.length;return T>0?S[T-1]:this.__bM();},__bP:function(parent,U,V){var W=parent.getLayoutChildren();var X;for(var i=0,l=W.length;i<l;i++){X=W[i];if(!(X instanceof qx.ui.core.Widget)){continue;}if(!this.isFocusRoot(X)&&X.isEnabled()&&X.isVisible()){if(X.isTabable()&&this.__bK(U,X)<0){V.push(X);}this.__bP(X,U,V);}}},__bQ:function(parent,Y,ba){var bb=parent.getLayoutChildren();var bc;for(var i=0,l=bb.length;i<l;i++){bc=bb[i];if(!(bc instanceof qx.ui.core.Widget)){continue;}if(!this.isFocusRoot(bc)&&bc.isEnabled()&&bc.isVisible()){if(bc.isTabable()&&this.__bK(Y,bc)>0){ba.push(bc);}this.__bQ(bc,Y,ba);}}},__bR:function(parent,bd){var be=parent.getLayoutChildren();var bf;for(var i=0,l=be.length;i<l;i++){bf=be[i];if(!(bf instanceof qx.ui.core.Widget)){continue;}if(!this.isFocusRoot(bf)&&bf.isEnabled()&&bf.isVisible()){if(bf.isTabable()){if(bd==null||this.__bK(bf,bd)<0){bd=bf;}}bd=this.__bR(bf,bd);}}return bd;},__bS:function(parent,bg){var bh=parent.getLayoutChildren();var bi;for(var i=0,l=bh.length;i<l;i++){bi=bh[i];if(!(bi instanceof qx.ui.core.Widget)){continue;}if(!this.isFocusRoot(bi)&&bi.isEnabled()&&bi.isVisible()){if(bi.isTabable()){if(bg==null||this.__bK(bi,bg)>0){bg=bi;}}bg=this.__bS(bi,bg);}}return bg;}},destruct:function(){this._disposeMap(d);this.__bG=this.__bF=this.__bH=null;}});})();(function(){var a="qx.html.Root";qx.Class.define(a,{extend:qx.html.Element,construct:function(b){qx.html.Element.call(this);if(b!=null){this.useElement(b);}},members:{useElement:function(c){qx.html.Element.prototype.useElement.call(this,c);this.setRoot(true);qx.html.Element._modified[this.$$hash]=this;}}});})();(function(){var k="cursor",j="100%",i="repeat",h="mousedown",g="url(",f=")",d="mouseout",c="qx.client",b="div",a="dblclick",w="mousewheel",v="qx.html.Blocker",u="mousemove",t="mouseover",s="appear",r="click",q="mshtml",p="mouseup",o="contextmenu",n="disappear",l="qx/static/blank.gif",m="absolute";qx.Class.define(v,{extend:qx.html.Element,construct:function(x,y){var x=x?qx.theme.manager.Color.getInstance().resolve(x):null;var z={position:m,width:j,height:j,opacity:y||0,backgroundColor:x};if(qx.core.Variant.isSet(c,q)){z.backgroundImage=g+qx.util.ResourceManager.getInstance().toUri(l)+f;z.backgroundRepeat=i;}qx.html.Element.call(this,b,z);this.addListener(h,this._stopPropagation,this);this.addListener(p,this._stopPropagation,this);this.addListener(r,this._stopPropagation,this);this.addListener(a,this._stopPropagation,this);this.addListener(u,this._stopPropagation,this);this.addListener(t,this._stopPropagation,this);this.addListener(d,this._stopPropagation,this);this.addListener(w,this._stopPropagation,this);this.addListener(o,this._stopPropagation,this);this.addListener(s,this.__qp,this);this.addListener(n,this.__qp,this);},members:{_stopPropagation:function(e){e.stopPropagation();},__qp:function(){var A=this.getStyle(k);this.setStyle(k,null,true);this.setStyle(k,A,true);}}});})();(function(){var b="menu-separator",a="qx.ui.menu.Separator";qx.Class.define(a,{extend:qx.ui.core.Widget,properties:{appearance:{refine:true,init:b},anonymous:{refine:true,init:true}}});})();(function(){var t="icon",s="label",r="arrow",q="shortcut",p="changeLocale",o="qx.dynlocale",n="submenu",m="on",l="String",k="qx.ui.menu.Menu",d="qx.ui.menu.AbstractButton",j="keypress",h="",c="_applyIcon",b="mouseup",g="abstract",f="_applyLabel",i="_applyMenu",a="changeCommand";qx.Class.define(d,{extend:qx.ui.core.Widget,include:[qx.ui.core.MExecutable],implement:[qx.ui.form.IExecutable],type:g,construct:function(){qx.ui.core.Widget.call(this);this._setLayout(new qx.ui.menu.ButtonLayout);this.addListener(b,this._onMouseUp);this.addListener(j,this._onKeyPress);this.addListener(a,this._onChangeCommand,this);},properties:{blockToolTip:{refine:true,init:true},label:{check:l,apply:f,nullable:true},menu:{check:k,apply:i,nullable:true,dereference:true},icon:{check:l,apply:c,themeable:true,nullable:true}},members:{_createChildControlImpl:function(u,v){var w;switch(u){case t:w=new qx.ui.basic.Image;w.setAnonymous(true);this._add(w,{column:0});break;case s:w=new qx.ui.basic.Label;w.setAnonymous(true);this._add(w,{column:1});break;case q:w=new qx.ui.basic.Label;w.setAnonymous(true);this._add(w,{column:2});break;case r:w=new qx.ui.basic.Image;w.setAnonymous(true);this._add(w,{column:3});break;}return w||qx.ui.core.Widget.prototype._createChildControlImpl.call(this,u);},_forwardStates:{selected:1},getChildrenSizes:function(){var x=0,y=0,z=0,D=0;if(this._isChildControlVisible(t)){var E=this.getChildControl(t);x=E.getMarginLeft()+E.getSizeHint().width+E.getMarginRight();}if(this._isChildControlVisible(s)){var B=this.getChildControl(s);y=B.getMarginLeft()+B.getSizeHint().width+B.getMarginRight();}if(this._isChildControlVisible(q)){var A=this.getChildControl(q);z=A.getMarginLeft()+A.getSizeHint().width+A.getMarginRight();}if(this._isChildControlVisible(r)){var C=this.getChildControl(r);D=C.getMarginLeft()+C.getSizeHint().width+C.getMarginRight();}return [x,y,z,D];},_onMouseUp:function(e){},_onKeyPress:function(e){},_onChangeCommand:function(e){var H=e.getData();if(qx.core.Variant.isSet(o,m)){var F=e.getOldData();if(!F){qx.locale.Manager.getInstance().addListener(p,this._onChangeLocale,this);}if(!H){qx.locale.Manager.getInstance().removeListener(p,this._onChangeLocale,this);}}var G=H!=null?H.toString():h;this.getChildControl(q).setValue(G);},_onChangeLocale:qx.core.Variant.select(o,{"on":function(e){var I=this.getCommand();if(I!=null){this.getChildControl(q).setValue(I.toString());}},"off":null}),_applyIcon:function(J,K){if(J){this._showChildControl(t).setSource(J);}else{this._excludeChildControl(t);}},_applyLabel:function(L,M){if(L){this._showChildControl(s).setValue(L);}else{this._excludeChildControl(s);}},_applyMenu:function(N,O){if(O){O.resetOpener();O.removeState(n);}if(N){this._showChildControl(r);N.setOpener(this);N.addState(n);}else{this._excludeChildControl(r);}}},destruct:function(){if(this.getMenu()){if(!qx.core.ObjectRegistry.inShutDown){this.getMenu().destroy();}}if(qx.core.Variant.isSet(o,m)){qx.locale.Manager.getInstance().removeListener(p,this._onChangeLocale,this);}}});})();(function(){var c="middle",b="qx.ui.menu.ButtonLayout",a="left";qx.Class.define(b,{extend:qx.ui.layout.Abstract,members:{verifyLayoutProperty:null,renderLayout:function(d,e){var q=this._getLayoutChildren();var p;var g;var h=[];for(var i=0,l=q.length;i<l;i++){p=q[i];g=p.getLayoutProperties().column;h[g]=p;}var o=this.__ob(q[0]);var r=o.getColumnSizes();var k=o.getSpacingX();var j=qx.lang.Array.sum(r)+k*(r.length-1);if(j<d){r[1]+=d-j;}var s=0,top=0;var m=qx.ui.layout.Util;for(var i=0,l=r.length;i<l;i++){p=h[i];if(p){var f=p.getSizeHint();var top=m.computeVerticalAlignOffset(p.getAlignY()||c,f.height,e,0,0);var n=m.computeHorizontalAlignOffset(p.getAlignX()||a,f.width,r[i],p.getMarginLeft(),p.getMarginRight());p.renderLayout(s+n,top,f.width,f.height);}s+=r[i]+k;}},__ob:function(t){while(!(t instanceof qx.ui.menu.Menu)){t=t.getLayoutParent();}return t;},_computeSizeHint:function(){var w=this._getLayoutChildren();var v=0;var x=0;for(var i=0,l=w.length;i<l;i++){var u=w[i].getSizeHint();x+=u.width;v=Math.max(v,u.height);}return {width:x,height:v};}}});})();(function(){var a="qx.ui.core.MRemoteLayoutHandling";qx.Mixin.define(a,{members:{setLayout:function(b){return this.getChildrenContainer().setLayout(b);},getLayout:function(){return this.getChildrenContainer().getLayout();}}});})();(function(){var q="horizontal",p="scrollpane",o="vertical",n="button-backward",m="button-forward",l="content",k="execute",j="qx.ui.container.SlideBar",i="scrollY",h="removeChildWidget",c="scrollX",g="_applyOrientation",f="mousewheel",b="Integer",a="slidebar",d="update";qx.Class.define(j,{extend:qx.ui.core.Widget,include:[qx.ui.core.MRemoteChildrenHandling,qx.ui.core.MRemoteLayoutHandling],construct:function(r){qx.ui.core.Widget.call(this);var s=this.getChildControl(p);this._add(s,{flex:1});if(r!=null){this.setOrientation(r);}else{this.initOrientation();}this.addListener(f,this._onMouseWheel,this);},properties:{appearance:{refine:true,init:a},orientation:{check:[q,o],init:q,apply:g},scrollStep:{check:b,init:15,themeable:true}},members:{getChildrenContainer:function(){return this.getChildControl(l);},_createChildControlImpl:function(t,u){var v;switch(t){case m:v=new qx.ui.form.RepeatButton;v.addListener(k,this._onExecuteForward,this);v.setFocusable(false);this._addAt(v,2);break;case n:v=new qx.ui.form.RepeatButton;v.addListener(k,this._onExecuteBackward,this);v.setFocusable(false);this._addAt(v,0);break;case l:v=new qx.ui.container.Composite();if(qx.bom.client.Engine.GECKO){v.addListener(h,this._onRemoveChild,this);}this.getChildControl(p).add(v);break;case p:v=new qx.ui.core.scroll.ScrollPane();v.addListener(d,this._onResize,this);v.addListener(c,this._onScroll,this);v.addListener(i,this._onScroll,this);break;}return v||qx.ui.core.Widget.prototype._createChildControlImpl.call(this,t);},_forwardStates:{barLeft:true,barTop:true,barRight:true,barBottom:true},scrollBy:function(w){var x=this.getChildControl(p);if(this.getOrientation()===q){x.scrollByX(w);}else{x.scrollByY(w);}},scrollTo:function(y){var z=this.getChildControl(p);if(this.getOrientation()===q){z.scrollToX(y);}else{z.scrollToY(y);}},_applyOrientation:function(A,B){var E=[this.getLayout(),this._getLayout()];var D=this.getChildControl(m);var C=this.getChildControl(n);if(B==o){D.removeState(o);C.removeState(o);D.addState(q);C.addState(q);}else if(B==q){D.removeState(q);C.removeState(q);D.addState(o);C.addState(o);}if(A==q){this._setLayout(new qx.ui.layout.HBox());this.setLayout(new qx.ui.layout.HBox());}else{this._setLayout(new qx.ui.layout.VBox());this.setLayout(new qx.ui.layout.VBox());}if(E[0]){E[0].dispose();}if(E[1]){E[1].dispose();}},_onMouseWheel:function(e){this.scrollBy(e.getWheelDelta()*this.getScrollStep());e.stop();},_onScroll:function(){this._updateArrowsEnabled();},_onResize:function(e){var content=this.getChildControl(p).getChildren()[0];if(!content){return;}var F=this.getInnerSize();var H=content.getBounds();var G=(this.getOrientation()===q)?H.width>F.width:H.height>F.height;if(G){this._showArrows();this._updateArrowsEnabled();}else{this._hideArrows();}},_onExecuteBackward:function(){this.scrollBy(-this.getScrollStep());},_onExecuteForward:function(){this.scrollBy(this.getScrollStep());},_onRemoveChild:function(){qx.event.Timer.once(function(){this.scrollBy(this.getChildControl(p).getScrollX());},this,50);},_updateArrowsEnabled:function(){var J=this.getChildControl(p);if(this.getOrientation()===q){var I=J.getScrollX();var K=J.getScrollMaxX();}else{var I=J.getScrollY();var K=J.getScrollMaxY();}this.getChildControl(n).setEnabled(I>0);this.getChildControl(m).setEnabled(I<K);},_showArrows:function(){this._showChildControl(m);this._showChildControl(n);},_hideArrows:function(){this._excludeChildControl(m);this._excludeChildControl(n);this.scrollTo(0);}}});})();(function(){var f="execute",e="button-backward",d="vertical",c="button-forward",b="menu-slidebar",a="qx.ui.menu.MenuSlideBar";qx.Class.define(a,{extend:qx.ui.container.SlideBar,construct:function(){qx.ui.container.SlideBar.call(this,d);},properties:{appearance:{refine:true,init:b}},members:{_createChildControlImpl:function(g,h){var i;switch(g){case c:i=new qx.ui.form.HoverButton();i.addListener(f,this._onExecuteForward,this);this._addAt(i,2);break;case e:i=new qx.ui.form.HoverButton();i.addListener(f,this._onExecuteBackward,this);this._addAt(i,0);break;}return i||qx.ui.container.SlideBar.prototype._createChildControlImpl.call(this,g);}}});})();(function(){var i="Integer",h="hovered",g="hover-button",f="interval",d="mouseover",c="mouseout",b="__nk",a="qx.ui.form.HoverButton";qx.Class.define(a,{extend:qx.ui.basic.Atom,include:[qx.ui.core.MExecutable],implement:[qx.ui.form.IExecutable],construct:function(j,k){qx.ui.basic.Atom.call(this,j,k);this.addListener(d,this._onMouseOver,this);this.addListener(c,this._onMouseOut,this);this.__nk=new qx.event.AcceleratingTimer();this.__nk.addListener(f,this._onInterval,this);},properties:{appearance:{refine:true,init:g},interval:{check:i,init:80},firstInterval:{check:i,init:200},minTimer:{check:i,init:20},timerDecrease:{check:i,init:2}},members:{__nk:null,_onMouseOver:function(e){if(!this.isEnabled()||e.getTarget()!==this){return;}this.__nk.set({interval:this.getInterval(),firstInterval:this.getFirstInterval(),minimum:this.getMinTimer(),decrease:this.getTimerDecrease()}).start();this.addState(h);},_onMouseOut:function(e){this.__nk.stop();this.removeState(h);if(!this.isEnabled()||e.getTarget()!==this){return;}},_onInterval:function(){if(this.isEnabled()){this.execute();}else{this.__nk.stop();}}},destruct:function(){this._disposeObjects(b);}});})();(function(){var h="pressed",g="hovered",f="inherit",d="qx.ui.menubar.Button",c="keydown",b="menubar-button",a="keyup";qx.Class.define(d,{extend:qx.ui.form.MenuButton,construct:function(i,j,k){qx.ui.form.MenuButton.call(this,i,j,k);this.removeListener(c,this._onKeyDown);this.removeListener(a,this._onKeyUp);},properties:{appearance:{refine:true,init:b},show:{refine:true,init:f},focusable:{refine:true,init:false}},members:{getMenuBar:function(){var parent=this;while(parent){if(parent instanceof qx.ui.toolbar.ToolBar){return parent;}parent=parent.getLayoutParent();}return null;},open:function(l){qx.ui.form.MenuButton.prototype.open.call(this,l);var menubar=this.getMenuBar();menubar._setAllowMenuOpenHover(true);},_onMenuChange:function(e){var m=this.getMenu();var menubar=this.getMenuBar();if(m.isVisible()){this.addState(h);if(menubar){menubar.setOpenMenu(m);}}else{this.removeState(h);if(menubar&&menubar.getOpenMenu()==m){menubar.resetOpenMenu();menubar._setAllowMenuOpenHover(false);}}},_onMouseUp:function(e){qx.ui.form.MenuButton.prototype._onMouseUp.call(this,e);var n=this.getMenu();if(n&&n.isVisible()&&!this.hasState(h)){this.addState(h);}},_onMouseOver:function(e){this.addState(g);if(this.getMenu()){var menubar=this.getMenuBar();if(menubar._isAllowMenuOpenHover()){qx.ui.menu.Manager.getInstance().hideAll();menubar._setAllowMenuOpenHover(true);if(this.isEnabled()){this.open();}}}}}});})();(function(){var w="visible",v="excluded",u="resize",t="qx.event.type.Data",s="both",r="qx.ui.menu.Menu",q="_applySpacing",p="showItem",o="Boolean",n="icon",d="label",m="qx.ui.core.Widget",h="_applyOverflowIndicator",c="_applyOverflowHandling",b="changeShow",g="Integer",f="qx.ui.toolbar.ToolBar",j="hideItem",a="toolbar",k="changeOpenMenu";qx.Class.define(f,{extend:qx.ui.core.Widget,include:qx.ui.core.MChildrenHandling,construct:function(){qx.ui.core.Widget.call(this);this._setLayout(new qx.ui.layout.HBox());this.__rp=[];this.__rq=[];},properties:{appearance:{refine:true,init:a},openMenu:{check:r,event:k,nullable:true},show:{init:s,check:[s,d,n],inheritable:true,event:b},spacing:{nullable:true,check:g,themeable:true,apply:q},overflowIndicator:{check:m,nullable:true,apply:h},overflowHandling:{init:false,check:o,apply:c}},events:{"hideItem":t,"showItem":t},members:{__rp:null,__rq:null,_computeSizeHint:function(){var z=qx.ui.core.Widget.prototype._computeSizeHint.call(this);if(true&&this.getOverflowHandling()){var x=0;var y=this.getOverflowIndicator();if(y){x=y.getSizeHint().width+this.getSpacing();}z.minWidth=x;}return z;},_onResize:function(e){this._recalculateOverflow(e.getData().width);},_recalculateOverflow:function(A){if(!this.getOverflowHandling()){return;}var C=this.getSizeHint().width;var B=this.getOverflowIndicator();var F=0;if(B){F=B.getSizeHint().width;}if(A<C){do{var G=this._getNextToHide();if(!G){return;}var H=G.getMarginLeft()+G.getMarginRight();var E=G.getSizeHint().width+H;this.__rs(G);C-=E;if(B&&B.getVisibility()!=w){B.setVisibility(w);C+=F;}}while(C>A);}else{do{var I=this.__rp[0];if(I){var H=I.getMarginLeft()+I.getMarginRight();var D=I.getSizeHint().width+H;if(A>C+D+this.getSpacing()||(this.__rp.length==1&&A>C+D-F+this.getSpacing())){this.__rr(I);A+=D;if(B&&this.__rp.length==0){B.setVisibility(v);}}else{return;}}}while(A>=C&&this.__rp.length>0);}},__rr:function(J){J.setVisibility(w);this.__rp.shift();this.fireDataEvent(p,J);},__rs:function(K){if(!K){return;}this.__rp.unshift(K);K.setVisibility(v);this.fireDataEvent(j,K);},_getNextToHide:function(){for(var i=this.__rq.length-1;i>=0;i--){var L=this.__rq[i];if(L&&L.getVisibility&&L.getVisibility()==w){return L;}}var M=this._getChildren();for(var i=M.length-1;i>=0;i--){var N=M[i];if(N==this.getOverflowIndicator()){continue;}if(N.getVisibility&&N.getVisibility()==w){return N;}}},setRemovePriority:function(O,P,Q){if(!Q&&this.__rq[P]!=undefined){throw new Error("Priority already in use!");}this.__rq[P]=O;},_applyOverflowHandling:function(R,S){this.invalidateLayoutCache();var parent=this.getLayoutParent();if(parent){parent.invalidateLayoutCache();}var U=this.getBounds();if(U&&U.width){this._recalculateOverflow(U.width);}if(R){this.addListener(u,this._onResize,this);}else{this.removeListener(u,this._onResize,this);var T=this.getOverflowIndicator();if(T){T.setVisibility(v);}for(var i=0;i<this.__rp.length;i++){this.__rp[i].setVisibility(w);}this.__rp=[];}},_applyOverflowIndicator:function(V,W){if(W){this._remove(W);}if(V){if(this._indexOf(V)==-1){throw new Error("Widget must be child of the toolbar.");}V.setVisibility(v);}},__rt:false,_setAllowMenuOpenHover:function(X){this.__rt=X;},_isAllowMenuOpenHover:function(){return this.__rt;},_applySpacing:function(Y,ba){var bb=this._getLayout();Y==null?bb.resetSpacing():bb.setSpacing(Y);},addSpacer:function(){var bc=new qx.ui.core.Spacer;this._add(bc,{flex:1});return bc;},addSeparator:function(){this.add(new qx.ui.toolbar.Separator);},getMenuButtons:function(){var be=this.getChildren();var bd=[];var bf;for(var i=0,l=be.length;i<l;i++){bf=be[i];if(bf instanceof qx.ui.menubar.Button){bd.push(bf);}else if(bf instanceof qx.ui.toolbar.Part){bd.push.apply(bd,bf.getMenuButtons());}}return bd;}},destruct:function(){if(this.hasListener(u)){this.removeListener(u,this._onResize,this);}}});})();(function(){var b="toolbar-separator",a="qx.ui.toolbar.Separator";qx.Class.define(a,{extend:qx.ui.core.Widget,properties:{appearance:{refine:true,init:b},anonymous:{refine:true,init:true},width:{refine:true,init:0},height:{refine:true,init:0}}});})();(function(){var m="container",k="handle",j="both",h="Integer",g="middle",f="qx.ui.toolbar.Part",e="icon",d="label",c="changeShow",b="_applySpacing",a="toolbar/part";qx.Class.define(f,{extend:qx.ui.core.Widget,include:[qx.ui.core.MRemoteChildrenHandling],construct:function(){qx.ui.core.Widget.call(this);this._setLayout(new qx.ui.layout.HBox);this._createChildControl(k);},properties:{appearance:{refine:true,init:a},show:{init:j,check:[j,d,e],inheritable:true,event:c},spacing:{nullable:true,check:h,themeable:true,apply:b}},members:{_createChildControlImpl:function(n,o){var p;switch(n){case k:p=new qx.ui.basic.Image();p.setAlignY(g);this._add(p);break;case m:p=new qx.ui.toolbar.PartContainer;this._add(p);break;}return p||qx.ui.core.Widget.prototype._createChildControlImpl.call(this,n);},getChildrenContainer:function(){return this.getChildControl(m);},_applySpacing:function(q,r){var s=this.getChildControl(m).getLayout();q==null?s.resetSpacing():s.setSpacing(q);},addSeparator:function(){this.add(new qx.ui.toolbar.Separator);},getMenuButtons:function(){var u=this.getChildren();var t=[];var v;for(var i=0,l=u.length;i<l;i++){v=u[i];if(v instanceof qx.ui.menubar.Button){t.push(v);}}return t;}}});})();(function(){var f="both",e="toolbar/part/container",d="icon",c="changeShow",b="qx.ui.toolbar.PartContainer",a="label";qx.Class.define(b,{extend:qx.ui.container.Composite,construct:function(){qx.ui.container.Composite.call(this);this._setLayout(new qx.ui.layout.HBox);},properties:{appearance:{refine:true,init:e},show:{init:f,check:[f,a,d],inheritable:true,event:c}}});})();(function(){var b="qx.ui.menu.Button",a="menu-button";qx.Class.define(b,{extend:qx.ui.menu.AbstractButton,construct:function(c,d,f,g){qx.ui.menu.AbstractButton.call(this);if(c!=null){this.setLabel(c);}if(d!=null){this.setIcon(d);}if(f!=null){this.setCommand(f);}if(g!=null){this.setMenu(g);}},properties:{appearance:{refine:true,init:a}},members:{_onMouseUp:function(e){if(e.isLeftPressed()){this.execute();if(this.getMenu()){return;}}qx.ui.menu.Manager.getInstance().hideAll();},_onKeyPress:function(e){this.execute();}}});})();(function(){var b="qx.ui.table.IColumnMenuItem",a="qx.event.type.Data";qx.Interface.define(b,{properties:{visible:{}},events:{changeVisible:a}});})();(function(){var h="checked",g="menu-checkbox",f="Boolean",d="_applyValue",c="changeValue",b="qx.ui.menu.CheckBox",a="execute";qx.Class.define(b,{extend:qx.ui.menu.AbstractButton,implement:[qx.ui.form.IBooleanForm],construct:function(i,j){qx.ui.menu.AbstractButton.call(this);if(i!=null){if(i.translate){this.setLabel(i.translate());}else{this.setLabel(i);}}if(j!=null){this.setMenu(j);}this.addListener(a,this._onExecute,this);},properties:{appearance:{refine:true,init:g},value:{check:f,init:false,apply:d,event:c,nullable:true}},members:{_applyValue:function(k,l){k?this.addState(h):this.removeState(h);},_onExecute:function(e){this.toggleValue();},_onMouseUp:function(e){if(e.isLeftPressed()){this.execute();}qx.ui.menu.Manager.getInstance().hideAll();},_onKeyPress:function(e){this.execute();}}});})();(function(){var f="changeVisible",d="qx.ui.table.columnmenu.MenuItem",c="_applyVisible",b="Boolean",a="changeValue";qx.Class.define(d,{extend:qx.ui.menu.CheckBox,implement:qx.ui.table.IColumnMenuItem,properties:{visible:{check:b,init:true,apply:c,event:f}},construct:function(g){qx.ui.menu.CheckBox.call(this,g);this.addListener(a,function(e){this.bInListener=true;this.setVisible(e.getData());this.bInListener=false;});},members:{__wn:false,_applyVisible:function(h,i){if(!this.bInListener){this.setValue(h);}}}});})();(function(){var b="qx.ui.table.selection.Model",a="qx.ui.table.selection.Manager";qx.Class.define(a,{extend:qx.core.Object,construct:function(){qx.core.Object.call(this);},properties:{selectionModel:{check:b}},members:{__wo:null,handleMouseDown:function(c,d){if(d.isLeftPressed()){var e=this.getSelectionModel();if(!e.isSelectedIndex(c)){this._handleSelectEvent(c,d);this.__wo=true;}else{this.__wo=false;}}else if(d.isRightPressed()&&d.getModifiers()==0){var e=this.getSelectionModel();if(!e.isSelectedIndex(c)){e.setSelectionInterval(c,c);}}},handleMouseUp:function(f,g){if(g.isLeftPressed()&&!this.__wo){this._handleSelectEvent(f,g);}},handleClick:function(h,i){},handleSelectKeyDown:function(j,k){this._handleSelectEvent(j,k);},handleMoveKeyDown:function(l,m){var o=this.getSelectionModel();switch(m.getModifiers()){case 0:o.setSelectionInterval(l,l);break;case qx.event.type.Dom.SHIFT_MASK:var n=o.getAnchorSelectionIndex();if(n==-1){o.setSelectionInterval(l,l);}else{o.setSelectionInterval(n,l);}break;}},_handleSelectEvent:function(p,q){var t=this.getSelectionModel();var r=t.getLeadSelectionIndex();var s=t.getAnchorSelectionIndex();if(q.isShiftPressed()){if(p!=r||t.isSelectionEmpty()){if(s==-1){s=p;}if(q.isCtrlOrCommandPressed()){t.addSelectionInterval(s,p);}else{t.setSelectionInterval(s,p);}}}else if(q.isCtrlOrCommandPressed()){if(t.isSelectedIndex(p)){t.removeSelectionInterval(p,p);}else{t.addSelectionInterval(p,p);}}else{t.setSelectionInterval(p,p);}}}});})();(function(){var l="]",k="..",h="changeSelection",g="_applySelectionMode",f='ie',d="qx.event.type.Event",c="Ranges:",b="qx.ui.table.selection.Model",a=" [";qx.Class.define(b,{extend:qx.core.Object,construct:function(){qx.core.Object.call(this);this.__we=[];this.__wf=-1;this.__wg=-1;this.hasBatchModeRefCount=0;this.__wh=false;},events:{"changeSelection":d},statics:{NO_SELECTION:1,SINGLE_SELECTION:2,SINGLE_INTERVAL_SELECTION:3,MULTIPLE_INTERVAL_SELECTION:4,MULTIPLE_INTERVAL_SELECTION_TOGGLE:5},properties:{selectionMode:{init:2,check:[1,2,3,4,5],apply:g}},members:{__wh:null,__wf:null,__wg:null,__we:null,_applySelectionMode:function(m){this.resetSelection();},setBatchMode:function(n){if(n){this.hasBatchModeRefCount+=1;}else{if(this.hasBatchModeRefCount==0){throw new Error("Try to turn off batch mode althoug it was not turned on.");}this.hasBatchModeRefCount-=1;if(this.__wh){this.__wh=false;this._fireChangeSelection();}}return this.hasBatchMode();},hasBatchMode:function(){return this.hasBatchModeRefCount>0;},getAnchorSelectionIndex:function(){return this.__wf;},_setAnchorSelectionIndex:function(o){this.__wf=o;},getLeadSelectionIndex:function(){return this.__wg;},_setLeadSelectionIndex:function(p){this.__wg=p;},_getSelectedRangeArr:function(){return this.__we;},resetSelection:function(){if(!this.isSelectionEmpty()){this._resetSelection();this._fireChangeSelection();}},isSelectionEmpty:function(){return this.__we.length==0;},getSelectedCount:function(){var r=0;for(var i=0;i<this.__we.length;i++){var q=this.__we[i];r+=q.maxIndex-q.minIndex+1;}return r;},isSelectedIndex:function(s){for(var i=0;i<this.__we.length;i++){var t=this.__we[i];if(s>=t.minIndex&&s<=t.maxIndex){return true;}}return false;},getSelectedRanges:function(){var u=[];for(var i=0;i<this.__we.length;i++){u.push({minIndex:this.__we[i].minIndex,maxIndex:this.__we[i].maxIndex});}return u;},iterateSelection:function(v,w){for(var i=0;i<this.__we.length;i++){for(var j=this.__we[i].minIndex;j<=this.__we[i].maxIndex;j++){v.call(w,j);}}},setSelectionInterval:function(x,y){var z=this.self(arguments);switch(this.getSelectionMode()){case z.NO_SELECTION:return;case z.SINGLE_SELECTION:if(this.isSelectedIndex(y)){return;}x=y;break;case z.MULTIPLE_INTERVAL_SELECTION_TOGGLE:this.setBatchMode(true);try{for(var i=x;i<=y;i++){if(!this.isSelectedIndex(i)){this._addSelectionInterval(i,i);}else{this.removeSelectionInterval(i,i);}}}catch(e){if(qx.bom.client.Browser.NAME==f&&qx.bom.client.Browser.VERSION<=7){this.setBatchMode(false);}throw e;}finally{this.setBatchMode(false);}this._fireChangeSelection();return;}this._resetSelection();this._addSelectionInterval(x,y);this._fireChangeSelection();},addSelectionInterval:function(A,B){var C=qx.ui.table.selection.Model;switch(this.getSelectionMode()){case C.NO_SELECTION:return;case C.MULTIPLE_INTERVAL_SELECTION:case C.MULTIPLE_INTERVAL_SELECTION_TOGGLE:this._addSelectionInterval(A,B);this._fireChangeSelection();break;default:this.setSelectionInterval(A,B);break;}},removeSelectionInterval:function(D,E){this.__wf=D;this.__wg=E;var F=Math.min(D,E);var H=Math.max(D,E);for(var i=0;i<this.__we.length;i++){var J=this.__we[i];if(J.minIndex>H){break;}else if(J.maxIndex>=F){var K=(J.minIndex>=F)&&(J.minIndex<=H);var I=(J.maxIndex>=F)&&(J.maxIndex<=H);if(K&&I){this.__we.splice(i,1);i--;}else if(K){J.minIndex=H+1;}else if(I){J.maxIndex=F-1;}else{var G={minIndex:H+1,maxIndex:J.maxIndex};this.__we.splice(i+1,0,G);J.maxIndex=F-1;break;}}}this._fireChangeSelection();},_resetSelection:function(){this.__we=[];this.__wf=-1;this.__wg=-1;},_addSelectionInterval:function(L,M){this.__wf=L;this.__wg=M;var N=Math.min(L,M);var P=Math.max(L,M);var O=0;for(;O<this.__we.length;O++){var Q=this.__we[O];if(Q.minIndex>N){break;}}this.__we.splice(O,0,{minIndex:N,maxIndex:P});var R=this.__we[0];for(var i=1;i<this.__we.length;i++){var Q=this.__we[i];if(R.maxIndex+1>=Q.minIndex){R.maxIndex=Math.max(R.maxIndex,Q.maxIndex);this.__we.splice(i,1);i--;}else{R=Q;}}},_dumpRanges:function(){var S=c;for(var i=0;i<this.__we.length;i++){var T=this.__we[i];S+=a+T.minIndex+k+T.maxIndex+l;}this.debug(S);},_fireChangeSelection:function(){if(this.hasBatchMode()){this.__wh=true;}else{this.fireEvent(h);}}},destruct:function(){this.__we=null;}});})();(function(){var k="",j="Number",h='</div>',g='" ',f="paneUpdated",e='<div>',d="</div>",c="overflow: hidden;",b="qx.event.type.Data",a="paneReloadsData",E="div",D='style="',C="_applyMaxCacheLines",B="qx.ui.table.pane.Pane",A="width: 100%;",z="qx.event.type.Event",w="_applyVisibleRowCount",v='>',u="line-height: ",t="appear",r='class="',s="width:100%;",p="px;",q='<div ',n="'>",o="_applyFirstVisibleRow",l="<div style='",m=";position:relative;";qx.Class.define(B,{extend:qx.ui.core.Widget,construct:function(F){qx.ui.core.Widget.call(this);this.__wL=F;this.__wM=0;this.__wN=0;this.__wO=[];},events:{"paneReloadsData":b,"paneUpdated":z},properties:{firstVisibleRow:{check:j,init:0,apply:o},visibleRowCount:{check:j,init:0,apply:w},maxCacheLines:{check:j,init:1000,apply:C},allowShrinkX:{refine:true,init:false}},members:{__wN:null,__wM:null,__wL:null,__wP:null,__wQ:null,__wR:null,__wO:null,__wS:0,_applyFirstVisibleRow:function(G,H){this.updateContent(false,G-H);},_applyVisibleRowCount:function(I,J){this.updateContent(true);},_getContentHint:function(){return {width:this.getPaneScroller().getTablePaneModel().getTotalWidth(),height:400};},getPaneScroller:function(){return this.__wL;},getTable:function(){return this.__wL.getTable();},setFocusedCell:function(K,L,M){if(K!=this.__wR||L!=this.__wQ){var N=this.__wQ;this.__wR=K;this.__wQ=L;if(L!=N&&!M){if(N!==null){this.updateContent(false,null,N,true);}if(L!==null){this.updateContent(false,null,L,true);}}}},onSelectionChanged:function(){this.updateContent(false,null,null,true);},onFocusChanged:function(){this.updateContent(false,null,null,true);},setColumnWidth:function(O,P){this.updateContent(true);},onColOrderChanged:function(){this.updateContent(true);},onPaneModelChanged:function(){this.updateContent(true);},onTableModelDataChanged:function(Q,R,S,T){this.__wT();var V=this.getFirstVisibleRow();var U=this.getVisibleRowCount();if(R==-1||R>=V&&Q<V+U){this.updateContent();}},onTableModelMetaDataChanged:function(){this.updateContent(true);},_applyMaxCacheLines:function(W,X){if(this.__wS>=W&&W!==-1){this.__wT();}},__wT:function(){this.__wO=[];this.__wS=0;},__wU:function(Y,ba,bb){if(!ba&&!bb&&this.__wO[Y]){return this.__wO[Y];}else{return null;}},__wV:function(bc,bd,be,bf){var bg=this.getMaxCacheLines();if(!be&&!bf&&!this.__wO[bc]&&bg>0){this._applyMaxCacheLines(bg);this.__wO[bc]=bd;this.__wS+=1;}},updateContent:function(bh,bi,bj,bk){if(bh){this.__wT();}if(bi&&Math.abs(bi)<=Math.min(10,this.getVisibleRowCount())){this._scrollContent(bi);}else if(bk&&!this.getTable().getAlwaysUpdateCells()){this._updateRowStyles(bj);}else{this._updateAllRows();}},_updateRowStyles:function(bl){var bp=this.getContentElement().getDomElement();if(!bp||!bp.firstChild){this._updateAllRows();return;}var bt=this.getTable();var bn=bt.getSelectionModel();var bq=bt.getTableModel();var bu=bt.getDataRowRenderer();var bo=bp.firstChild.childNodes;var bs={table:bt};var bv=this.getFirstVisibleRow();var y=0;var bm=bo.length;if(bl!=null){var br=bl-bv;if(br>=0&&br<bm){bv=bl;y=br;bm=br+1;}else{return;}}for(;y<bm;y++,bv++){bs.row=bv;bs.selected=bn.isSelectedIndex(bv);bs.focusedRow=(this.__wQ==bv);bs.rowData=bq.getRowData(bv);bu.updateDataRowElement(bs,bo[y]);}},_getRowsHtml:function(bw,bx){var bD=this.getTable();var bG=bD.getSelectionModel();var bA=bD.getTableModel();var bB=bD.getTableColumnModel();var bV=this.getPaneScroller().getTablePaneModel();var bL=bD.getDataRowRenderer();bA.prefetchRows(bw,bw+bx-1);var bS=bD.getRowHeight();var bU=bV.getColumnCount();var bC=0;var bz=[];for(var x=0;x<bU;x++){var bY=bV.getColumnAtX(x);var bF=bB.getColumnWidth(bY);bz.push({col:bY,xPos:x,editable:bA.isColumnEditable(bY),focusedCol:this.__wR==bY,styleLeft:bC,styleWidth:bF});bC+=bF;}var bX=[];var ca=false;for(var bE=bw;bE<bw+bx;bE++){var bH=bG.isSelectedIndex(bE);var bK=(this.__wQ==bE);var bP=this.__wU(bE,bH,bK);if(bP){bX.push(bP);continue;}var by=[];var bR={table:bD};bR.styleHeight=bS;bR.row=bE;bR.selected=bH;bR.focusedRow=bK;bR.rowData=bA.getRowData(bE);if(!bR.rowData){ca=true;}by.push(q);var bO=bL.getRowAttributes(bR);if(bO){by.push(bO);}var bN=bL.getRowClass(bR);if(bN){by.push(r,bN,g);}var bM=bL.createRowStyle(bR);bM+=m+bL.getRowHeightStyle(bS)+s;if(bM){by.push(D,bM,g);}by.push(v);var bW=false;for(x=0;x<bU&&!bW;x++){var bI=bz[x];for(var bT in bI){bR[bT]=bI[bT];}var bY=bR.col;bR.value=bA.getValue(bY,bE);var bJ=bB.getDataCellRenderer(bY);bR.style=bJ.getDefaultCellStyle();bW=bJ.createDataCellHtml(bR,by)||false;}by.push(h);var bQ=by.join(k);this.__wV(bE,bQ,bH,bK);bX.push(bQ);}this.fireDataEvent(a,ca);return bX.join(k);},_scrollContent:function(cb){var cc=this.getContentElement().getDomElement();if(!(cc&&cc.firstChild)){this._updateAllRows();return;}var cl=cc.firstChild;var cd=cl.childNodes;var cj=this.getVisibleRowCount();var ci=this.getFirstVisibleRow();var cg=this.getTable().getTableModel();var cm=0;cm=cg.getRowCount();if(ci+cj>cm){this._updateAllRows();return;}var cn=cb<0?cj+cb:0;var ce=cb<0?0:cj-cb;for(i=Math.abs(cb)-1;i>=0;i--){var ch=cd[cn];try{cl.removeChild(ch);}catch(co){break;}}if(!this.__wP){this.__wP=document.createElement(E);}var ck=e;ck+=this._getRowsHtml(ci+ce,Math.abs(cb));ck+=h;this.__wP.innerHTML=ck;var cf=this.__wP.firstChild.childNodes;if(cb>0){for(var i=cf.length-1;i>=0;i--){var ch=cf[0];cl.appendChild(ch);}}else{for(var i=cf.length-1;i>=0;i--){var ch=cf[cf.length-1];cl.insertBefore(ch,cl.firstChild);}}if(this.__wQ!==null){this._updateRowStyles(this.__wQ-cb);this._updateRowStyles(this.__wQ);}this.fireEvent(f);},_updateAllRows:function(){var cs=this.getContentElement().getDomElement();if(!cs){this.addListenerOnce(t,arguments.callee,this);return;}var cy=this.getTable();var cv=cy.getTableModel();var cx=this.getPaneScroller().getTablePaneModel();var cw=cx.getColumnCount();var cp=cy.getRowHeight();var ct=this.getFirstVisibleRow();var cq=this.getVisibleRowCount();var cz=cv.getRowCount();if(ct+cq>cz){cq=Math.max(0,cz-ct);}var cr=cx.getTotalWidth();var cu;if(cq>0){cu=[l,A,(cy.getForceLineHeight()?u+cp+p:k),c,n,this._getRowsHtml(ct,cq),d];}else{cu=[];}var cA=cu.join(k);cs.innerHTML=cA;this.setWidth(cr);this.__wM=cw;this.__wN=cq;this.fireEvent(f);}},destruct:function(){this.__wP=this.__wL=this.__wO=null;}});})();(function(){var c="hovered",b="__wX",a="qx.ui.table.pane.Header";qx.Class.define(a,{extend:qx.ui.core.Widget,construct:function(d){qx.ui.core.Widget.call(this);this._setLayout(new qx.ui.layout.HBox());this.__wW=new qx.ui.core.Blocker(this);this.__wX=d;},members:{__wX:null,__wY:null,__xa:null,__wW:null,getPaneScroller:function(){return this.__wX;},getTable:function(){return this.__wX.getTable();},getBlocker:function(){return this.__wW;},onColOrderChanged:function(){this._updateContent(true);},onPaneModelChanged:function(){this._updateContent(true);},onTableModelMetaDataChanged:function(){this._updateContent();},setColumnWidth:function(e,f,g){var h=this.getHeaderWidgetAtColumn(e);if(h!=null){h.setWidth(f);}},setMouseOverColumn:function(i){if(i!=this.__xa){if(this.__xa!=null){var j=this.getHeaderWidgetAtColumn(this.__xa);if(j!=null){j.removeState(c);}}if(i!=null){this.getHeaderWidgetAtColumn(i).addState(c);}this.__xa=i;}},getHeaderWidgetAtColumn:function(k){var l=this.getPaneScroller().getTablePaneModel().getX(k);return this._getChildren()[l];},showColumnMoveFeedback:function(m,x){var q=this.getContainerLocation();if(this.__wY==null){var v=this.getTable();var n=this.getPaneScroller().getTablePaneModel().getX(m);var p=this._getChildren()[n];var r=v.getTableModel();var t=v.getTableColumnModel();var u={xPos:n,col:m,name:r.getColumnName(m),table:v};var s=t.getHeaderCellRenderer(m);var o=s.createHeaderCell(u);var w=p.getBounds();o.setWidth(w.width);o.setHeight(w.height);o.setZIndex(1000000);o.setOpacity(0.8);o.setLayoutProperties({top:q.top});this.getApplicationRoot().add(o);this.__wY=o;}this.__wY.setLayoutProperties({left:q.left+x});this.__wY.show();},hideColumnMoveFeedback:function(){if(this.__wY!=null){this.__wY.destroy();this.__wY=null;}},isShowingColumnMoveFeedback:function(){return this.__wY!=null;},_updateContent:function(y){var I=this.getTable();var C=I.getTableModel();var F=I.getTableColumnModel();var H=this.getPaneScroller().getTablePaneModel();var K=this._getChildren();var D=H.getColumnCount();var G=C.getSortColumnIndex();if(y){this._cleanUpCells();}var z={};z.sortedAscending=C.isSortAscending();for(var x=0;x<D;x++){var B=H.getColumnAtX(x);if(B===undefined){continue;}var J=F.getColumnWidth(B);var E=F.getHeaderCellRenderer(B);z.xPos=x;z.col=B;z.name=C.getColumnName(B);z.editable=C.isColumnEditable(B);z.sorted=(B==G);z.table=I;var A=K[x];if(A==null){A=E.createHeaderCell(z);A.set({width:J});this._add(A);}else{E.updateHeaderCell(z,A);}}},_cleanUpCells:function(){var M=this._getChildren();for(var x=M.length-1;x>=0;x--){var L=M[x];L.destroy();}}},destruct:function(){this.__wW.dispose();this._disposeObjects(b);}});})();(function(){var m="Boolean",l="resize-line",k="mousedown",j="qx.event.type.Data",i="mouseup",h="qx.ui.table.pane.CellEvent",g="scroll",d="focus-indicator",c="excluded",b="scrollbar-y",bm="table-scroller-focus-indicator",bl="visible",bk="mousemove",bj="header",bi="editing",bh="click",bg="modelChanged",bf="scrollbar-x",be="cellClick",bd="pane",t="__xi",u="__xc",r="mouseout",s="__xh",p="changeHorizontalScrollBarVisible",q="bottom",n="_applyScrollTimeout",o="changeScrollX",z="_applyTablePaneModel",A="Integer",I="__xg",G="dblclick",Q="dataEdited",L="mousewheel",Y="interval",V="qx.ui.table.pane.Scroller",C="__xk",bc="_applyShowCellFocusIndicator",bb="__xe",ba="resize",B="vertical",E="changeScrollY",F="appear",H="table-scroller",J="beforeSort",M="__xd",S="cellDblclick",X="horizontal",v="losecapture",w="contextmenu",D="col-resize",P="disappear",O="_applyVerticalScrollBarVisible",N="_applyHorizontalScrollBarVisible",U="cellContextmenu",T="__xj",K="close",R="changeTablePaneModel",a="__xf",W="qx.ui.table.pane.Model",y="changeVerticalScrollBarVisible";qx.Class.define(V,{extend:qx.ui.core.Widget,include:qx.ui.core.scroll.MScrollBarFactory,construct:function(bn){qx.ui.core.Widget.call(this);this.__xb=bn;var bo=new qx.ui.layout.Grid();bo.setColumnFlex(0,1);bo.setRowFlex(1,1);this._setLayout(bo);this.__xc=this._showChildControl(bf);this.__xd=this._showChildControl(b);this.__xe=this._showChildControl(bj);this.__xf=this._showChildControl(bd);this.__xg=new qx.ui.container.Composite(new qx.ui.layout.HBox()).set({minWidth:0});this._add(this.__xg,{row:0,column:0,colSpan:2});this.__xh=new qx.ui.table.pane.Clipper();this.__xh.add(this.__xe);this.__xh.addListener(v,this._onChangeCaptureHeader,this);this.__xh.addListener(bk,this._onMousemoveHeader,this);this.__xh.addListener(k,this._onMousedownHeader,this);this.__xh.addListener(i,this._onMouseupHeader,this);this.__xh.addListener(bh,this._onClickHeader,this);this.__xg.add(this.__xh,{flex:1});this.__xi=new qx.ui.table.pane.Clipper();this.__xi.add(this.__xf);this.__xi.addListener(L,this._onMousewheel,this);this.__xi.addListener(bk,this._onMousemovePane,this);this.__xi.addListener(k,this._onMousedownPane,this);this.__xi.addListener(i,this._onMouseupPane,this);this.__xi.addListener(bh,this._onClickPane,this);this.__xi.addListener(w,this._onContextMenu,this);this.__xi.addListener(G,this._onDblclickPane,this);this.__xi.addListener(ba,this._onResizePane,this);this._add(this.__xi,{row:1,column:0});this.__xj=this.getChildControl(d);this.initShowCellFocusIndicator();this.getChildControl(l).hide();this.addListener(r,this._onMouseout,this);this.addListener(F,this._onAppear,this);this.addListener(P,this._onDisappear,this);this.__xk=new qx.event.Timer();this.__xk.addListener(Y,this._oninterval,this);this.initScrollTimeout();},statics:{MIN_COLUMN_WIDTH:10,RESIZE_REGION_RADIUS:5,CLICK_TOLERANCE:5,HORIZONTAL_SCROLLBAR:1,VERTICAL_SCROLLBAR:2},events:{"changeScrollY":j,"changeScrollX":j,"cellClick":h,"cellDblclick":h,"cellContextmenu":h,"beforeSort":j},properties:{horizontalScrollBarVisible:{check:m,init:true,apply:N,event:p},verticalScrollBarVisible:{check:m,init:true,apply:O,event:y},tablePaneModel:{check:W,apply:z,event:R},liveResize:{check:m,init:false},focusCellOnMouseMove:{check:m,init:false},selectBeforeFocus:{check:m,init:false},showCellFocusIndicator:{check:m,init:true,apply:bc},resetSelectionOnHeaderClick:{check:m,init:true},scrollTimeout:{check:A,init:100,apply:n},appearance:{refine:true,init:H}},members:{__xl:null,__xb:null,__xm:null,__xn:null,__xo:null,__xp:null,__xq:null,__xr:null,__xs:null,__xt:null,__xu:null,__xv:null,__xw:null,__xx:null,__xy:false,__xz:null,__xA:null,__xB:null,__xC:null,__xD:null,__xE:null,__xF:null,__xG:null,__xc:null,__xd:null,__xe:null,__xh:null,__xf:null,__xi:null,__xj:null,__xg:null,__xk:null,getPaneInsetRight:function(){var bq=this.getTopRightWidget();var br=bq&&bq.isVisible()&&bq.getBounds()?bq.getBounds().width:0;var bp=this.getVerticalScrollBarVisible()?this.getVerticalScrollBarWidth():0;return Math.max(br,bp);},setPaneWidth:function(bs){if(this.isVerticalScrollBarVisible()){bs+=this.getPaneInsetRight();}this.setWidth(bs);},_createChildControlImpl:function(bt,bu){var bv;switch(bt){case bj:bv=(this.getTable().getNewTablePaneHeader())(this);break;case bd:bv=(this.getTable().getNewTablePane())(this);break;case d:bv=new qx.ui.table.pane.FocusIndicator(this);bv.setUserBounds(0,0,0,0);bv.setZIndex(1000);bv.addListener(i,this._onMouseupFocusIndicator,this);this.__xi.add(bv);bv.show();bv.setDecorator(null);break;case l:bv=new qx.ui.core.Widget();bv.setUserBounds(0,0,0,0);bv.setZIndex(1000);this.__xi.add(bv);break;case bf:bv=this._createScrollBar(X).set({minWidth:0,alignY:q});bv.addListener(g,this._onScrollX,this);this._add(bv,{row:2,column:0});break;case b:bv=this._createScrollBar(B);bv.addListener(g,this._onScrollY,this);this._add(bv,{row:1,column:1});break;}return bv||qx.ui.core.Widget.prototype._createChildControlImpl.call(this,bt);},_applyHorizontalScrollBarVisible:function(bw,bx){this.__xc.setVisibility(bw?bl:c);},_applyVerticalScrollBarVisible:function(by,bz){this.__xd.setVisibility(by?bl:c);},_applyTablePaneModel:function(bA,bB){if(bB!=null){bB.removeListener(bg,this._onPaneModelChanged,this);}bA.addListener(bg,this._onPaneModelChanged,this);},_applyShowCellFocusIndicator:function(bC,bD){if(bC){this.__xj.setDecorator(bm);this._updateFocusIndicator();}else{if(this.__xj){this.__xj.setDecorator(null);}}},getScrollY:function(){return this.__xd.getPosition();},setScrollY:function(scrollY,bE){this.__xd.scrollTo(scrollY);if(bE){this._updateContent();}},getScrollX:function(){return this.__xc.getPosition();},setScrollX:function(scrollX){this.__xc.scrollTo(scrollX);},getTable:function(){return this.__xb;},onColVisibilityChanged:function(){this.updateHorScrollBarMaximum();this._updateFocusIndicator();},setColumnWidth:function(bF,bG){this.__xe.setColumnWidth(bF,bG);this.__xf.setColumnWidth(bF,bG);var bH=this.getTablePaneModel();var x=bH.getX(bF);if(x!=-1){this.updateHorScrollBarMaximum();this._updateFocusIndicator();}},onColOrderChanged:function(){this.__xe.onColOrderChanged();this.__xf.onColOrderChanged();this.updateHorScrollBarMaximum();},onTableModelDataChanged:function(bI,bJ,bK,bL){this.__xf.onTableModelDataChanged(bI,bJ,bK,bL);var bM=this.getTable().getTableModel().getRowCount();if(bM!=this.__xl){this.updateVerScrollBarMaximum();if(this.getFocusedRow()>=bM){if(bM==0){this.setFocusedCell(null,null);}else{this.setFocusedCell(this.getFocusedColumn(),bM-1);}}this.__xl=bM;}},onSelectionChanged:function(){this.__xf.onSelectionChanged();},onFocusChanged:function(){this.__xf.onFocusChanged();},onTableModelMetaDataChanged:function(){this.__xe.onTableModelMetaDataChanged();this.__xf.onTableModelMetaDataChanged();},_onPaneModelChanged:function(){this.__xe.onPaneModelChanged();this.__xf.onPaneModelChanged();},_onResizePane:function(){this.updateHorScrollBarMaximum();this.updateVerScrollBarMaximum();this._updateContent();this.__xe._updateContent();this.__xb._updateScrollBarVisibility();},updateHorScrollBarMaximum:function(){var bQ=this.__xi.getInnerSize();if(!bQ){return ;}var bO=this.getTablePaneModel().getTotalWidth();var bP=this.__xc;if(bQ.width<bO){var bN=Math.max(0,bO-bQ.width);bP.setMaximum(bN);bP.setKnobFactor(bQ.width/bO);var bR=bP.getPosition();bP.setPosition(Math.min(bR,bN));}else{bP.setMaximum(0);bP.setKnobFactor(1);bP.setPosition(0);}},updateVerScrollBarMaximum:function(){var ca=this.__xi.getInnerSize();if(!ca){return ;}var bX=this.getTable().getTableModel();var bT=bX.getRowCount();if(this.getTable().getKeepFirstVisibleRowComplete()){bT+=1;}var bS=this.getTable().getRowHeight();var bV=bT*bS;var bY=this.__xd;if(ca.height<bV){var bU=Math.max(0,bV-ca.height);bY.setMaximum(bU);bY.setKnobFactor(ca.height/bV);var bW=bY.getPosition();bY.setPosition(Math.min(bW,bU));}else{bY.setMaximum(0);bY.setKnobFactor(1);bY.setPosition(0);}},onKeepFirstVisibleRowCompleteChanged:function(){this.updateVerScrollBarMaximum();this._updateContent();},_onAppear:function(){this._startInterval(this.getScrollTimeout());},_onDisappear:function(){this._stopInterval();},_onScrollX:function(e){var cb=e.getData();this.fireDataEvent(o,cb,e.getOldData());this.__xh.scrollToX(cb);this.__xi.scrollToX(cb);},_onScrollY:function(e){this.fireDataEvent(E,e.getData(),e.getOldData());this._postponedUpdateContent();},_onMousewheel:function(e){var cc=this.getTable();if(!cc.getEnabled()){return;}var ce=qx.bom.client.Engine.GECKO?1:3;var cd=this.__xd.getPosition()+((e.getWheelDelta()*ce)*cc.getRowHeight());this.__xd.scrollTo(cd);if(this.__xA&&this.getFocusCellOnMouseMove()){this._focusCellAtPagePos(this.__xA,this.__xB);}e.stop();},__xH:function(cf){var ck=this.getTable();var cl=this.__xe.getHeaderWidgetAtColumn(this.__xu);var cg=cl.getSizeHint().minWidth;var ci=Math.max(cg,this.__xw+cf-this.__xv);if(this.getLiveResize()){var ch=ck.getTableColumnModel();ch.setColumnWidth(this.__xu,ci,true);}else{this.__xe.setColumnWidth(this.__xu,ci,true);var cj=this.getTablePaneModel();this._showResizeLine(cj.getColumnLeft(this.__xu)+ci);}this.__xv+=ci-this.__xw;this.__xw=ci;},__xI:function(cm){var cn=qx.ui.table.pane.Scroller.CLICK_TOLERANCE;if(this.__xe.isShowingColumnMoveFeedback()||cm>this.__xt+cn||cm<this.__xt-cn){this.__xq+=cm-this.__xt;this.__xe.showColumnMoveFeedback(this.__xp,this.__xq);var co=this.__xb.getTablePaneScrollerAtPageX(cm);if(this.__xs&&this.__xs!=co){this.__xs.hideColumnMoveFeedback();}if(co!=null){this.__xr=co.showColumnMoveFeedback(cm);}else{this.__xr=null;}this.__xs=co;this.__xt=cm;}},_onMousemoveHeader:function(e){var cv=this.getTable();if(!cv.getEnabled()){return;}var cw=false;var cp=null;var ct=e.getDocumentLeft();var cu=e.getDocumentTop();this.__xA=ct;this.__xB=cu;if(this.__xu!=null){this.__xH(ct);cw=true;e.stopPropagation();}else if(this.__xp!=null){this.__xI(ct);e.stopPropagation();}else{var cq=this._getResizeColumnForPageX(ct);if(cq!=-1){cw=true;}else{var cs=cv.getTableModel();var cx=this._getColumnForPageX(ct);if(cx!=null&&cs.isColumnSortable(cx)){cp=cx;}}}var cr=cw?D:null;this.getApplicationRoot().setGlobalCursor(cr);this.setCursor(cr);this.__xe.setMouseOverColumn(cp);},_onMousemovePane:function(e){var cy=this.getTable();if(!cy.getEnabled()){return;}var cA=e.getDocumentLeft();var cB=e.getDocumentTop();this.__xA=cA;this.__xB=cB;var cz=this._getRowForPagePos(cA,cB);if(cz!=null&&this._getColumnForPageX(cA)!=null){if(this.getFocusCellOnMouseMove()){this._focusCellAtPagePos(cA,cB);}}this.__xe.setMouseOverColumn(null);},_onMousedownHeader:function(e){if(!this.getTable().getEnabled()){return;}var cD=e.getDocumentLeft();var cE=this._getResizeColumnForPageX(cD);if(cE!=-1){this._startResizeHeader(cE,cD);e.stop();}else{var cC=this._getColumnForPageX(cD);if(cC!=null){this._startMoveHeader(cC,cD);e.stop();}}},_startResizeHeader:function(cF,cG){var cH=this.getTable().getTableColumnModel();this.__xu=cF;this.__xv=cG;this.__xw=cH.getColumnWidth(this.__xu);this.__xh.capture();},_startMoveHeader:function(cI,cJ){this.__xp=cI;this.__xt=cJ;this.__xq=this.getTablePaneModel().getColumnLeft(cI);this.__xh.capture();},_onMousedownPane:function(e){var cN=this.getTable();if(!cN.getEnabled()){return;}if(cN.isEditing()){cN.stopEditing();}var cK=e.getDocumentLeft();var cM=e.getDocumentTop();var cP=this._getRowForPagePos(cK,cM);var cO=this._getColumnForPageX(cK);if(cP!==null){this.__xx={row:cP,col:cO};this.__xy=false;var cL=this.getSelectBeforeFocus();if(cL){cN.getSelectionManager().handleMouseDown(cP,e);}if(!this.getFocusCellOnMouseMove()){this._focusCellAtPagePos(cK,cM);}if(!cL){cN.getSelectionManager().handleMouseDown(cP,e);}}},_onMouseupFocusIndicator:function(e){if(this.__xx&&!this.__xy&&!this.isEditing()&&this.__xj.getRow()==this.__xx.row&&this.__xj.getColumn()==this.__xx.col){this.fireEvent(be,qx.ui.table.pane.CellEvent,[this,e,this.__xx.row,this.__xx.col],true);this.__xy=true;}else if(!this.isEditing()){this._onMousedownPane(e);}},_onChangeCaptureHeader:function(e){if(this.__xu!=null){this._stopResizeHeader();}if(this.__xp!=null){this._stopMoveHeader();}},_stopResizeHeader:function(){var cQ=this.getTable().getTableColumnModel();if(!this.getLiveResize()){this._hideResizeLine();cQ.setColumnWidth(this.__xu,this.__xw,true);}this.__xu=null;this.__xh.releaseCapture();this.getApplicationRoot().setGlobalCursor(null);this.setCursor(null);if(this.isEditing()){var cR=this.__xE.getBounds().height;this.__xE.setUserBounds(0,0,this.__xw,cR);}},_stopMoveHeader:function(){var cW=this.getTable().getTableColumnModel();var cX=this.getTablePaneModel();this.__xe.hideColumnMoveFeedback();if(this.__xs){this.__xs.hideColumnMoveFeedback();}if(this.__xr!=null){var da=cX.getFirstColumnX()+cX.getX(this.__xp);var cV=this.__xr;if(cV!=da&&cV!=da+1){var cY=cW.getVisibleColumnAtX(da);var cU=cW.getVisibleColumnAtX(cV);var cT=cW.getOverallX(cY);var cS=(cU!=null)?cW.getOverallX(cU):cW.getOverallColumnCount();if(cS>cT){cS--;}cW.moveColumn(cT,cS);this._updateFocusIndicator();}}this.__xp=null;this.__xr=null;this.__xh.releaseCapture();},_onMouseupPane:function(e){var db=this.getTable();if(!db.getEnabled()){return;}var dc=this._getRowForPagePos(e.getDocumentLeft(),e.getDocumentTop());if(dc!=-1&&dc!=null&&this._getColumnForPageX(e.getDocumentLeft())!=null){db.getSelectionManager().handleMouseUp(dc,e);}},_onMouseupHeader:function(e){var dd=this.getTable();if(!dd.getEnabled()){return;}if(this.__xu!=null){this._stopResizeHeader();this.__xz=true;e.stop();}else if(this.__xp!=null){this._stopMoveHeader();e.stop();}},_onClickHeader:function(e){if(this.__xz){this.__xz=false;return;}var di=this.getTable();if(!di.getEnabled()){return;}var dg=di.getTableModel();var dh=e.getDocumentLeft();var df=this._getResizeColumnForPageX(dh);if(df==-1){var dl=this._getColumnForPageX(dh);if(dl!=null&&dg.isColumnSortable(dl)){var de=dg.getSortColumnIndex();var dj=(dl!=de)?true:!dg.isSortAscending();var dk={column:dl,ascending:dj,clickEvent:e};if(this.fireDataEvent(J,dk,null,true)){dg.sortByColumn(dl,dj);if(this.getResetSelectionOnHeaderClick()){di.getSelectionModel().resetSelection();}}}}e.stop();},_onClickPane:function(e){var dm=this.getTable();if(!dm.getEnabled()){return;}var dq=e.getDocumentLeft();var dr=e.getDocumentTop();var dn=this._getRowForPagePos(dq,dr);var dp=this._getColumnForPageX(dq);if(dn!=null&&dp!=null){dm.getSelectionManager().handleClick(dn,e);if(this.__xj.isHidden()||(this.__xx&&!this.__xy&&!this.isEditing()&&dn==this.__xx.row&&dp==this.__xx.col)){this.fireEvent(be,qx.ui.table.pane.CellEvent,[this,e,dn,dp],true);this.__xy=true;}}},_onContextMenu:function(e){var dv=e.getDocumentLeft();var dw=e.getDocumentTop();var dt=this._getRowForPagePos(dv,dw);var du=this._getColumnForPageX(dv);if(this.__xj.isHidden()||(this.__xx&&dt==this.__xx.row&&du==this.__xx.col)){this.fireEvent(U,qx.ui.table.pane.CellEvent,[this,e,dt,du],true);var ds=this.getTable().getContextMenu();if(ds){if(ds.getChildren().length>0){ds.openAtMouse(e);}else{ds.exclude();}e.preventDefault();}}},_onContextMenuOpen:function(e){},_onDblclickPane:function(e){var dy=e.getDocumentLeft();var dz=e.getDocumentTop();this._focusCellAtPagePos(dy,dz);this.startEditing();var dx=this._getRowForPagePos(dy,dz);if(dx!=-1&&dx!=null){this.fireEvent(S,qx.ui.table.pane.CellEvent,[this,e,dx],true);}},_onMouseout:function(e){var dA=this.getTable();if(!dA.getEnabled()){return;}if(this.__xu==null){this.setCursor(null);this.getApplicationRoot().setGlobalCursor(null);}this.__xe.setMouseOverColumn(null);},_showResizeLine:function(x){var dC=this._showChildControl(l);var dB=dC.getWidth();var dD=this.__xi.getBounds();dC.setUserBounds(x-Math.round(dB/2),0,dB,dD.height);},_hideResizeLine:function(){this._excludeChildControl(l);},showColumnMoveFeedback:function(dE){var dN=this.getTablePaneModel();var dM=this.getTable().getTableColumnModel();var dH=this.__xf.getContainerLocation().left;var dL=dN.getColumnCount();var dI=0;var dG=0;var dQ=dH;for(var dF=0;dF<dL;dF++){var dJ=dN.getColumnAtX(dF);var dO=dM.getColumnWidth(dJ);if(dE<dQ+dO/2){break;}dQ+=dO;dI=dF+1;dG=dQ-dH;}var dK=this.__xi.getContainerLocation().left;var dP=this.__xi.getBounds().width;var scrollX=dK-dH;dG=qx.lang.Number.limit(dG,scrollX+2,scrollX+dP-1);this._showResizeLine(dG);return dN.getFirstColumnX()+dI;},hideColumnMoveFeedback:function(){this._hideResizeLine();},_focusCellAtPagePos:function(dR,dS){var dU=this._getRowForPagePos(dR,dS);if(dU!=-1&&dU!=null){var dT=this._getColumnForPageX(dR);this.__xb.setFocusedCell(dT,dU);}},setFocusedCell:function(dV,dW){if(!this.isEditing()){this.__xf.setFocusedCell(dV,dW,this.__xn);this.__xC=dV;this.__xD=dW;this._updateFocusIndicator();}},getFocusedColumn:function(){return this.__xC;},getFocusedRow:function(){return this.__xD;},scrollCellVisible:function(dX,dY){var ej=this.getTablePaneModel();var ea=ej.getX(dX);if(ea!=-1){var eg=this.__xi.getInnerSize();if(!eg){return;}var eh=this.getTable().getTableColumnModel();var ed=ej.getColumnLeft(dX);var ek=eh.getColumnWidth(dX);var eb=this.getTable().getRowHeight();var el=dY*eb;var scrollX=this.getScrollX();var scrollY=this.getScrollY();var ei=Math.min(ed,ed+ek-eg.width);var ef=ed;this.setScrollX(Math.max(ei,Math.min(ef,scrollX)));var ec=el+eb-eg.height;if(this.getTable().getKeepFirstVisibleRowComplete()){ec+=eb;}var ee=el;this.setScrollY(Math.max(ec,Math.min(ee,scrollY)),true);}},isEditing:function(){return this.__xE!=null;},startEditing:function(){var eq=this.getTable();var eo=eq.getTableModel();var es=this.__xC;if(!this.isEditing()&&(es!=null)&&eo.isColumnEditable(es)){var et=this.__xD;var em=this.getTablePaneModel().getX(es);var en=eo.getValue(es,et);this.__xF=eq.getTableColumnModel().getCellEditorFactory(es);var ep={col:es,row:et,xPos:em,value:en,table:eq};this.__xE=this.__xF.createCellEditor(ep);if(this.__xE===null){return false;}else if(this.__xE instanceof qx.ui.window.Window){this.__xE.setModal(true);this.__xE.setShowClose(false);this.__xE.addListener(K,this._onCellEditorModalWindowClose,this);var f=eq.getModalCellEditorPreOpenFunction();if(f!=null){f(this.__xE,ep);}this.__xE.open();}else{var er=this.__xj.getInnerSize();this.__xE.setUserBounds(0,0,er.width,er.height);this.__xj.addListener(k,function(e){this.__xx={row:this.__xD,col:this.__xC};e.stopPropagation();},this);this.__xj.add(this.__xE);this.__xj.addState(bi);this.__xj.setKeepActive(false);this.__xj.setDecorator(bm);this.__xE.focus();this.__xE.activate();}return true;}return false;},stopEditing:function(){if(!this.getShowCellFocusIndicator()){this.__xj.setDecorator(null);}this.flushEditor();this.cancelEditing();},flushEditor:function(){if(this.isEditing()){var ev=this.__xF.getCellEditorValue(this.__xE);var eu=this.getTable().getTableModel().getValue(this.__xC,this.__xD);this.getTable().getTableModel().setValue(this.__xC,this.__xD,ev);this.__xb.focus();this.__xb.fireDataEvent(Q,{row:this.__xD,col:this.__xC,oldValue:eu,value:ev});}},cancelEditing:function(){if(this.isEditing()&&!this.__xE.pendingDispose){if(this._cellEditorIsModalWindow){this.__xE.destroy();this.__xE=null;this.__xF=null;this.__xE.pendingDispose=true;}else{this.__xj.removeState(bi);this.__xj.setKeepActive(true);this.__xE.destroy();this.__xE=null;this.__xF=null;}}},_onCellEditorModalWindowClose:function(e){this.stopEditing();},_getColumnForPageX:function(ew){var ez=this.getTable().getTableColumnModel();var eA=this.getTablePaneModel();var ey=eA.getColumnCount();var eC=this.__xe.getContainerLocation().left;for(var x=0;x<ey;x++){var ex=eA.getColumnAtX(x);var eB=ez.getColumnWidth(ex);eC+=eB;if(ew<eC){return ex;}}return null;},_getResizeColumnForPageX:function(eD){var eH=this.getTable().getTableColumnModel();var eI=this.getTablePaneModel();var eG=eI.getColumnCount();var eK=this.__xe.getContainerLocation().left;var eE=qx.ui.table.pane.Scroller.RESIZE_REGION_RADIUS;for(var x=0;x<eG;x++){var eF=eI.getColumnAtX(x);var eJ=eH.getColumnWidth(eF);eK+=eJ;if(eD>=(eK-eE)&&eD<=(eK+eE)){return eF;}}return -1;},_getRowForPagePos:function(eL,eM){var eN=this.__xf.getContentLocation();if(eL<eN.left||eL>eN.right){return null;}if(eM>=eN.top&&eM<=eN.bottom){var eO=this.getTable().getRowHeight();var scrollY=this.__xd.getPosition();if(this.getTable().getKeepFirstVisibleRowComplete()){scrollY=Math.floor(scrollY/eO)*eO;}var eR=scrollY+eM-eN.top;var eT=Math.floor(eR/eO);var eS=this.getTable().getTableModel();var eP=eS.getRowCount();return (eT<eP)?eT:null;}var eQ=this.__xe.getContainerLocation();if(eM>=eQ.top&&eM<=eQ.bottom&&eL<=eQ.right){return -1;}return null;},setTopRightWidget:function(eU){var eV=this.__xG;if(eV!=null){this.__xg.remove(eV);}if(eU!=null){this.__xg.add(eU);}this.__xG=eU;},getTopRightWidget:function(){return this.__xG;},getHeader:function(){return this.__xe;},getTablePane:function(){return this.__xf;},getVerticalScrollBarWidth:function(){var eW=this.__xd;return eW.isVisible()?(eW.getSizeHint().width||0):0;},getNeededScrollBars:function(eX,eY){var ff=this.__xd.getSizeHint().width;var fg=this.__xi.getInnerSize();var fa=fg?fg.width:0;if(this.getVerticalScrollBarVisible()){fa+=ff;}var fj=fg?fg.height:0;if(this.getHorizontalScrollBarVisible()){fj+=ff;}var fd=this.getTable().getTableModel();var fh=fd.getRowCount();var fk=this.getTablePaneModel().getTotalWidth();var fi=this.getTable().getRowHeight()*fh;var fc=false;var fl=false;if(fk>fa){fc=true;if(fi>fj-ff){fl=true;}}else if(fi>fj){fl=true;if(!eY&&(fk>fa-ff)){fc=true;}}var fe=qx.ui.table.pane.Scroller.HORIZONTAL_SCROLLBAR;var fb=qx.ui.table.pane.Scroller.VERTICAL_SCROLLBAR;return ((eX||fc)?fe:0)|((eY||!fl)?0:fb);},getPaneClipper:function(){return this.__xi;},_applyScrollTimeout:function(fm,fn){this._startInterval(fm);},_startInterval:function(fo){this.__xk.setInterval(fo);this.__xk.start();},_stopInterval:function(){this.__xk.stop();},_postponedUpdateContent:function(){this._updateContent();},_oninterval:qx.event.GlobalError.observeMethod(function(){if(this.__xn&&!this.__xf._layoutPending){this.__xn=false;this._updateContent();}}),_updateContent:function(){var ft=this.__xi.getInnerSize();if(!ft){return;}var fw=ft.height;var scrollX=this.__xc.getPosition();var scrollY=this.__xd.getPosition();var fq=this.getTable().getRowHeight();var fr=Math.floor(scrollY/fq);var fv=this.__xf.getFirstVisibleRow();this.__xf.setFirstVisibleRow(fr);var fs=Math.ceil(fw/fq);var fp=0;var fu=this.getTable().getKeepFirstVisibleRowComplete();if(!fu){fs++;fp=scrollY%fq;}this.__xf.setVisibleRowCount(fs);if(fr!=fv){this._updateFocusIndicator();}this.__xi.scrollToX(scrollX);if(!fu){this.__xi.scrollToY(fp);}},_updateFocusIndicator:function(){var fx=this.getTable();if(!fx.getEnabled()){return;}this.__xj.moveToCell(this.__xC,this.__xD);}},destruct:function(){this._stopInterval();var fy=this.getTablePaneModel();if(fy){fy.dispose();}this.__xx=this.__xG=this.__xb=null;this._disposeObjects(u,M,s,t,T,bb,a,I,C);}});})();(function(){var a="qx.ui.table.pane.Clipper";qx.Class.define(a,{extend:qx.ui.container.Composite,construct:function(){qx.ui.container.Composite.call(this,new qx.ui.layout.Grow());this.setMinWidth(0);},members:{scrollToX:function(b){this.getContentElement().scrollToX(b,false);},scrollToY:function(c){this.getContentElement().scrollToY(c,true);}}});})();(function(){var g="Integer",f="Escape",d="keypress",c="Enter",b="excluded",a="qx.ui.table.pane.FocusIndicator";qx.Class.define(a,{extend:qx.ui.container.Composite,construct:function(h){qx.ui.container.Composite.call(this);this.__xJ=h;this.setKeepActive(true);this.addListener(d,this._onKeyPress,this);},properties:{visibility:{refine:true,init:b},row:{check:g,nullable:true},column:{check:g,nullable:true}},members:{__xJ:null,_onKeyPress:function(e){var i=e.getKeyIdentifier();if(i!==f&&i!==c){e.stopPropagation();}},moveToCell:function(j,k){if(!this.__xJ.getShowCellFocusIndicator()&&!this.__xJ.getTable().getTableModel().isColumnEditable(j)){this.exclude();return;}else{this.show();}if(j==null){this.hide();this.setRow(null);this.setColumn(null);}else{var l=this.__xJ.getTablePaneModel().getX(j);if(l==-1){this.hide();this.setRow(null);this.setColumn(null);}else{var q=this.__xJ.getTable();var o=q.getTableColumnModel();var p=this.__xJ.getTablePaneModel();var n=this.__xJ.getTablePane().getFirstVisibleRow();var m=q.getRowHeight();this.setUserBounds(p.getColumnLeft(j)-2,(k-n)*m-2,o.getColumnWidth(j)+3,m+3);this.show();this.setRow(k);this.setColumn(j);}}}},destruct:function(){this.__xJ=null;}});})();(function(){var b="Integer",a="qx.ui.table.pane.CellEvent";qx.Class.define(a,{extend:qx.event.type.Mouse,properties:{row:{check:b,nullable:true},column:{check:b,nullable:true}},members:{init:function(c,d,e,f){d.clone(this);this.setBubbles(false);if(e!=null){this.setRow(e);}else{this.setRow(c._getRowForPagePos(this.getDocumentLeft(),this.getDocumentTop()));}if(f!=null){this.setColumn(f);}else{this.setColumn(c._getColumnForPageX(this.getDocumentLeft()));}},clone:function(g){var h=qx.event.type.Mouse.prototype.clone.call(this,g);h.set({row:this.getRow(),column:this.getColumn()});return h;}}});})();(function(){var a="qx.lang.Number";qx.Class.define(a,{statics:{isInRange:function(b,c,d){return b>=c&&b<=d;},isBetweenRange:function(e,f,g){return e>f&&e<g;},limit:function(h,i,j){if(j!=null&&h>j){return j;}else if(i!=null&&h<i){return i;}else{return h;}}}});})();(function(){var l="move",k="Boolean",j="mouseup",i="mousedown",h="losecapture",g="qx.ui.core.MMovable",f="__Y",d="__ba",c="mousemove",b="maximized",a="move-frame";qx.Mixin.define(g,{properties:{movable:{check:k,init:true},useMoveFrame:{check:k,init:false}},members:{__Y:null,__ba:null,__bb:null,__bc:null,__bd:null,__be:null,__bf:null,__bg:false,__bh:null,__bi:0,_activateMoveHandle:function(m){if(this.__Y){throw new Error("The move handle could not be redefined!");}this.__Y=m;m.addListener(i,this._onMoveMouseDown,this);m.addListener(j,this._onMoveMouseUp,this);m.addListener(c,this._onMoveMouseMove,this);m.addListener(h,this.__bm,this);},__bj:function(){var n=this.__ba;if(!n){n=this.__ba=new qx.ui.core.Widget();n.setAppearance(a);n.exclude();qx.core.Init.getApplication().getRoot().add(n);}return n;},__bk:function(){var location=this.getContainerLocation();var p=this.getBounds();var o=this.__bj();o.setUserBounds(location.left,location.top,p.width,p.height);o.show();o.setZIndex(this.getZIndex()+1);},__bl:function(e){var r=this.__bb;var u=Math.max(r.left,Math.min(r.right,e.getDocumentLeft()));var t=Math.max(r.top,Math.min(r.bottom,e.getDocumentTop()));var q=this.__bc+u;var s=this.__bd+t;return {viewportLeft:q,viewportTop:s,parentLeft:q-this.__be,parentTop:s-this.__bf};},_onMoveMouseDown:function(e){if(!this.getMovable()||this.hasState(b)){return;}var parent=this.getLayoutParent();var w=parent.getContentLocation();var x=parent.getBounds();if(qx.Class.implementsInterface(parent,qx.ui.window.IDesktop)){if(!parent.isContentBlocked()){this.__bh=parent.getBlockerColor();this.__bi=parent.getBlockerOpacity();parent.setBlockerColor(null);parent.setBlockerOpacity(1);parent.blockContent(this.getZIndex()-1);this.__bg=true;}}this.__bb={left:w.left,top:w.top,right:w.left+x.width,bottom:w.top+x.height};var v=this.getContainerLocation();this.__be=w.left;this.__bf=w.top;this.__bc=v.left-e.getDocumentLeft();this.__bd=v.top-e.getDocumentTop();this.addState(l);this.__Y.capture();if(this.getUseMoveFrame()){this.__bk();}e.stop();},_onMoveMouseMove:function(e){if(!this.hasState(l)){return;}var y=this.__bl(e);if(this.getUseMoveFrame()){this.__bj().setDomPosition(y.viewportLeft,y.viewportTop);}else{this.setDomPosition(y.parentLeft,y.parentTop);}e.stopPropagation();},_onMoveMouseUp:function(e){if(!this.hasState(l)){return;}this.removeState(l);var parent=this.getLayoutParent();if(qx.Class.implementsInterface(parent,qx.ui.window.IDesktop)){if(this.__bg){parent.unblockContent();parent.setBlockerColor(this.__bh);parent.setBlockerOpacity(this.__bi);this.__bh=null;this.__bi=0;this.__bg=false;}}this.__Y.releaseCapture();var z=this.__bl(e);this.setLayoutProperties({left:z.parentLeft,top:z.parentTop});if(this.getUseMoveFrame()){this.__bj().exclude();}e.stopPropagation();},__bm:function(e){if(!this.hasState(l)){return;}this.removeState(l);if(this.getUseMoveFrame()){this.__bj().exclude();}}},destruct:function(){this._disposeObjects(d,f);this.__bb=null;}});})();(function(){var k="Boolean",j="resize",i="mousedown",h="w-resize",g="sw-resize",f="n-resize",d="resizableRight",c="ne-resize",b="se-resize",a="Integer",z="e-resize",y="resizableLeft",x="mousemove",w="move",v="shorthand",u="maximized",t="nw-resize",s="mouseout",r="qx.ui.core.MResizable",q="mouseup",o="losecapture",p="resize-frame",m="resizableBottom",n="s-resize",l="resizableTop";qx.Mixin.define(r,{construct:function(){this.addListener(i,this.__bz,this,true);this.addListener(q,this.__bA,this);this.addListener(x,this.__bC,this);this.addListener(s,this.__bD,this);this.addListener(o,this.__bB,this);var A=this.getContainerElement().getDomElement();if(A==null){A=window;}this.__bn=qx.event.Registration.getManager(A).getHandler(qx.event.handler.DragDrop);},properties:{resizableTop:{check:k,init:true},resizableRight:{check:k,init:true},resizableBottom:{check:k,init:true},resizableLeft:{check:k,init:true},resizable:{group:[l,d,m,y],mode:v},resizeSensitivity:{check:a,init:5},useResizeFrame:{check:k,init:true}},members:{__bn:null,__bo:null,__bp:null,__bq:null,__br:null,__bs:null,__bt:null,RESIZE_TOP:1,RESIZE_BOTTOM:2,RESIZE_LEFT:4,RESIZE_RIGHT:8,__bu:function(){var B=this.__bo;if(!B){B=this.__bo=new qx.ui.core.Widget();B.setAppearance(p);B.exclude();qx.core.Init.getApplication().getRoot().add(B);}return B;},__bv:function(){var D=this.__bs;var C=this.__bu();C.setUserBounds(D.left,D.top,D.width,D.height);C.show();C.setZIndex(this.getZIndex()+1);},__bw:function(e){var F=this.__bp;var G=this.getSizeHint();var J=this.__bt;var I=this.__bs;var E=I.width;var H=I.height;var L=I.left;var top=I.top;var K;if((F&this.RESIZE_TOP)||(F&this.RESIZE_BOTTOM)){K=Math.max(J.top,Math.min(J.bottom,e.getDocumentTop()))-this.__br;if(F&this.RESIZE_TOP){H-=K;}else{H+=K;}if(H<G.minHeight){H=G.minHeight;}else if(H>G.maxHeight){H=G.maxHeight;}if(F&this.RESIZE_TOP){top+=I.height-H;}}if((F&this.RESIZE_LEFT)||(F&this.RESIZE_RIGHT)){K=Math.max(J.left,Math.min(J.right,e.getDocumentLeft()))-this.__bq;if(F&this.RESIZE_LEFT){E-=K;}else{E+=K;}if(E<G.minWidth){E=G.minWidth;}else if(E>G.maxWidth){E=G.maxWidth;}if(F&this.RESIZE_LEFT){L+=I.width-E;}}return {viewportLeft:L,viewportTop:top,parentLeft:I.bounds.left+L-I.left,parentTop:I.bounds.top+top-I.top,width:E,height:H};},__bx:{1:f,2:n,4:h,8:z,5:t,6:g,9:c,10:b},__by:function(e){var O=this.getContentLocation();var M=this.getResizeSensitivity();var Q=e.getDocumentLeft();var P=e.getDocumentTop();var N=0;if(this.getResizableTop()&&Math.abs(O.top-P)<M){N+=this.RESIZE_TOP;}else if(this.getResizableBottom()&&Math.abs(O.bottom-P)<M){N+=this.RESIZE_BOTTOM;}if(this.getResizableLeft()&&Math.abs(O.left-Q)<M){N+=this.RESIZE_LEFT;}else if(this.getResizableRight()&&Math.abs(O.right-Q)<M){N+=this.RESIZE_RIGHT;}this.__bp=N;},__bz:function(e){if(!this.__bp){return;}this.addState(j);this.__bq=e.getDocumentLeft();this.__br=e.getDocumentTop();var location=this.getContainerLocation();var T=this.getBounds();this.__bs={top:location.top,left:location.left,width:T.width,height:T.height,bounds:qx.lang.Object.clone(T)};var parent=this.getLayoutParent();var R=parent.getContentLocation();var S=parent.getBounds();this.__bt={left:R.left,top:R.top,right:R.left+S.width,bottom:R.top+S.height};if(this.getUseResizeFrame()){this.__bv();}this.capture();e.stop();},__bA:function(e){if(!this.hasState(j)){return;}if(this.getUseResizeFrame()){this.__bu().exclude();}var U=this.__bw(e);this.setWidth(U.width);this.setHeight(U.height);if(this.getResizableLeft()||this.getResizableTop()){this.setLayoutProperties({left:U.parentLeft,top:U.parentTop});}this.__bp=0;this.removeState(j);this.resetCursor();this.getApplicationRoot().resetGlobalCursor();this.releaseCapture();e.stopPropagation();},__bB:function(e){if(!this.__bp){return;}this.resetCursor();this.getApplicationRoot().resetGlobalCursor();this.removeState(w);if(this.getUseResizeFrame()){this.__bu().exclude();}},__bC:function(e){if(this.hasState(j)){var Y=this.__bw(e);if(this.getUseResizeFrame()){var W=this.__bu();W.setUserBounds(Y.viewportLeft,Y.viewportTop,Y.width,Y.height);}else{this.setWidth(Y.width);this.setHeight(Y.height);if(this.getResizableLeft()||this.getResizableTop()){this.setLayoutProperties({left:Y.parentLeft,top:Y.parentTop});}}e.stopPropagation();}else if(!this.hasState(u)&&!this.__bn.isSessionActive()){this.__by(e);var ba=this.__bp;var X=this.getApplicationRoot();if(ba){var V=this.__bx[ba];this.setCursor(V);X.setGlobalCursor(V);}else if(this.getCursor()){this.resetCursor();X.resetGlobalCursor();}}},__bD:function(e){if(this.getCursor()&&!this.hasState(j)){this.resetCursor();this.getApplicationRoot().resetGlobalCursor();}}},destruct:function(){if(this.__bo!=null&&!qx.core.ObjectRegistry.inShutDown){this.__bo.destroy();this.__bo=null;}this.__bn=null;}});})();(function(){var a="qx.ui.window.IWindowManager";qx.Interface.define(a,{members:{setDesktop:function(b){this.assertInterface(b,qx.ui.window.IDesktop);},changeActiveWindow:function(c,d){},updateStack:function(){},bringToFront:function(e){this.assertInstance(e,qx.ui.window.Window);},sendToBack:function(f){this.assertInstance(f,qx.ui.window.Window);}}});})();(function(){var b="__X",a="qx.ui.window.Manager";qx.Class.define(a,{extend:qx.core.Object,implement:qx.ui.window.IWindowManager,members:{__X:null,setDesktop:function(c){this.__X=c;this.updateStack();},getDesktop:function(){return this.__X;},changeActiveWindow:function(d,e){if(d){this.bringToFront(d);d.setActive(true);}if(e){e.resetActive();}},_minZIndex:1e5,updateStack:function(){qx.ui.core.queue.Widget.add(this);},syncWidget:function(){this.__X.forceUnblockContent();var f=this.__X.getWindows();var h=this._minZIndex;var m=h+f.length*2;var j=h+f.length*4;var k=null;for(var i=0,l=f.length;i<l;i++){var g=f[i];if(!g.isVisible()){continue;}k=k||g;if(g.isModal()){g.setZIndex(j);this.__X.blockContent(j-1);j+=2;k=g;}else if(g.isAlwaysOnTop()){g.setZIndex(m);m+=2;}else{g.setZIndex(h);h+=2;}if(!k.isModal()&&g.isActive()||g.getZIndex()>k.getZIndex()){k=g;}}this.__X.setActiveWindow(k);},bringToFront:function(n){var o=this.__X.getWindows();var p=qx.lang.Array.remove(o,n);if(p){o.push(n);this.updateStack();}},sendToBack:function(q){var r=this.__X.getWindows();var s=qx.lang.Array.remove(r,q);if(s){r.unshift(q);this.updateStack();}}},destruct:function(){this._disposeObjects(b);}});})();(function(){var k="Boolean",j="qx.event.type.Event",i="captionbar",h="_applyCaptionBarChange",g="maximize-button",f="restore-button",d="minimize-button",c="close-button",b="maximized",a="execute",Q="pane",P="title",O="icon",N="statusbar-text",M="statusbar",L="String",K="normal",J="active",I="beforeClose",H="beforeMinimize",r="mousedown",s="changeStatus",p="changeIcon",q="excluded",n="dblclick",o="_applyActive",l="beforeRestore",m="minimize",t="changeModal",u="changeAlwaysOnTop",z="_applyShowStatusbar",y="_applyStatus",B="qx.ui.window.Window",A="changeCaption",D="focusout",C="beforeMaximize",w="maximize",G="restore",F="window",E="close",v="changeActive",x="minimized";qx.Class.define(B,{extend:qx.ui.core.Widget,include:[qx.ui.core.MRemoteChildrenHandling,qx.ui.core.MRemoteLayoutHandling,qx.ui.core.MResizable,qx.ui.core.MMovable,qx.ui.core.MContentPadding],construct:function(R,S){qx.ui.core.Widget.call(this);this._setLayout(new qx.ui.layout.VBox());this._createChildControl(i);this._createChildControl(Q);if(S!=null){this.setIcon(S);}if(R!=null){this.setCaption(R);}this._updateCaptionBar();this.addListener(r,this._onWindowMouseDown,this,true);this.addListener(D,this._onWindowFocusOut,this);qx.core.Init.getApplication().getRoot().add(this);this.initVisibility();qx.ui.core.FocusHandler.getInstance().addRoot(this);},statics:{DEFAULT_MANAGER_CLASS:qx.ui.window.Manager},events:{"beforeClose":j,"close":j,"beforeMinimize":j,"minimize":j,"beforeMaximize":j,"maximize":j,"beforeRestore":j,"restore":j},properties:{appearance:{refine:true,init:F},visibility:{refine:true,init:q},focusable:{refine:true,init:true},active:{check:k,init:false,apply:o,event:v},alwaysOnTop:{check:k,init:false,event:u},modal:{check:k,init:false,event:t},caption:{apply:h,event:A,nullable:true},icon:{check:L,nullable:true,apply:h,event:p,themeable:true},status:{check:L,nullable:true,apply:y,event:s},showClose:{check:k,init:true,apply:h,themeable:true},showMaximize:{check:k,init:true,apply:h,themeable:true},showMinimize:{check:k,init:true,apply:h,themeable:true},allowClose:{check:k,init:true,apply:h},allowMaximize:{check:k,init:true,apply:h},allowMinimize:{check:k,init:true,apply:h},showStatusbar:{check:k,init:false,apply:z}},members:{__V:null,__W:null,getChildrenContainer:function(){return this.getChildControl(Q);},_forwardStates:{active:true,maximized:true},setLayoutParent:function(parent){{};qx.ui.core.Widget.prototype.setLayoutParent.call(this,parent);},_createChildControlImpl:function(T,U){var V;switch(T){case M:V=new qx.ui.container.Composite(new qx.ui.layout.HBox());this._add(V);V.add(this.getChildControl(N));break;case N:V=new qx.ui.basic.Label();V.setValue(this.getStatus());break;case Q:V=new qx.ui.container.Composite();this._add(V,{flex:1});break;case i:var X=new qx.ui.layout.Grid();X.setRowFlex(0,1);X.setColumnFlex(1,1);V=new qx.ui.container.Composite(X);this._add(V);V.addListener(n,this._onCaptionMouseDblClick,this);this._activateMoveHandle(V);break;case O:V=new qx.ui.basic.Image(this.getIcon());this.getChildControl(i).add(V,{row:0,column:0});break;case P:V=new qx.ui.basic.Label(this.getCaption());V.setWidth(0);V.setAllowGrowX(true);var W=this.getChildControl(i);W.add(V,{row:0,column:1});break;case d:V=new qx.ui.form.Button();V.setFocusable(false);V.addListener(a,this._onMinimizeButtonClick,this);this.getChildControl(i).add(V,{row:0,column:2});break;case f:V=new qx.ui.form.Button();V.setFocusable(false);V.addListener(a,this._onRestoreButtonClick,this);this.getChildControl(i).add(V,{row:0,column:3});break;case g:V=new qx.ui.form.Button();V.setFocusable(false);V.addListener(a,this._onMaximizeButtonClick,this);this.getChildControl(i).add(V,{row:0,column:4});break;case c:V=new qx.ui.form.Button();V.setFocusable(false);V.addListener(a,this._onCloseButtonClick,this);this.getChildControl(i).add(V,{row:0,column:6});break;}return V||qx.ui.core.Widget.prototype._createChildControlImpl.call(this,T);},_updateCaptionBar:function(){var ba;var bb=this.getIcon();if(bb){this.getChildControl(O).setSource(bb);this._showChildControl(O);}else{this._excludeChildControl(O);}var Y=this.getCaption();if(Y){this.getChildControl(P).setValue(Y);this._showChildControl(P);}else{this._excludeChildControl(P);}if(this.getShowMinimize()){this._showChildControl(d);ba=this.getChildControl(d);this.getAllowMinimize()?ba.resetEnabled():ba.setEnabled(false);}else{this._excludeChildControl(d);}if(this.getShowMaximize()){if(this.isMaximized()){this._showChildControl(f);this._excludeChildControl(g);}else{this._showChildControl(g);this._excludeChildControl(f);}ba=this.getChildControl(g);this.getAllowMaximize()?ba.resetEnabled():ba.setEnabled(false);}else{this._excludeChildControl(g);this._excludeChildControl(f);}if(this.getShowClose()){this._showChildControl(c);ba=this.getChildControl(c);this.getAllowClose()?ba.resetEnabled():ba.setEnabled(false);}else{this._excludeChildControl(c);}},close:function(){if(!this.isVisible()){return;}if(this.fireNonBubblingEvent(I,qx.event.type.Event,[false,true])){this.hide();this.fireEvent(E);}},open:function(){this.show();this.setActive(true);this.focus();},center:function(){var parent=this.getLayoutParent();if(parent){var bd=parent.getBounds();if(bd){var be=this.getSizeHint();var bc=Math.round((bd.width-be.width)/2);var top=Math.round((bd.height-be.height)/2);if(top<0){top=0;}this.moveTo(bc,top);return;}}{};},maximize:function(){if(this.isMaximized()){return;}var parent=this.getLayoutParent();if(parent!=null&&parent.supportsMaximize()){if(this.fireNonBubblingEvent(C,qx.event.type.Event,[false,true])){if(!this.isVisible()){this.open();}var bf=this.getLayoutProperties();this.__W=bf.left===undefined?0:bf.left;this.__V=bf.top===undefined?0:bf.top;this.setLayoutProperties({left:null,top:null,edge:0});this.addState(b);this._updateCaptionBar();this.fireEvent(w);}}},minimize:function(){if(!this.isVisible()){return;}if(this.fireNonBubblingEvent(H,qx.event.type.Event,[false,true])){var bg=this.getLayoutProperties();this.__W=bg.left===undefined?0:bg.left;this.__V=bg.top===undefined?0:bg.top;this.removeState(b);this.hide();this.fireEvent(m);}},restore:function(){if(this.getMode()===K){return;}if(this.fireNonBubblingEvent(l,qx.event.type.Event,[false,true])){if(!this.isVisible()){this.open();}var bh=this.__W;var top=this.__V;this.setLayoutProperties({edge:null,left:bh,top:top});this.removeState(b);this._updateCaptionBar();this.fireEvent(G);}},moveTo:function(bi,top){if(this.isMaximized()){return;}this.setLayoutProperties({left:bi,top:top});},isMaximized:function(){return this.hasState(b);},getMode:function(){if(!this.isVisible()){return x;}else{if(this.isMaximized()){return b;}else{return K;}}},_applyActive:function(bj,bk){if(bk){this.removeState(J);}else{this.addState(J);}},_getContentPaddingTarget:function(){return this.getChildControl(Q);},_applyShowStatusbar:function(bl,bm){if(bl){this._showChildControl(M);}else{this._excludeChildControl(M);}},_applyCaptionBarChange:function(bn,bo){this._updateCaptionBar();},_applyStatus:function(bp,bq){var br=this.getChildControl(N,true);if(br){br.setValue(bp);}},_onWindowEventStop:function(e){e.stopPropagation();},_onWindowMouseDown:function(e){this.setActive(true);},_onWindowFocusOut:function(e){if(this.getModal()){return;}var bs=e.getRelatedTarget();if(bs!=null&&!qx.ui.core.Widget.contains(this,bs)){this.setActive(false);}},_onCaptionMouseDblClick:function(e){if(this.getAllowMaximize()){this.isMaximized()?this.restore():this.maximize();}},_onMinimizeButtonClick:function(e){this.minimize();this.getChildControl(d).reset();},_onRestoreButtonClick:function(e){this.restore();this.getChildControl(f).reset();},_onMaximizeButtonClick:function(e){this.maximize();this.getChildControl(g).reset();},_onCloseButtonClick:function(e){this.close();this.getChildControl(c).reset();}}});})();(function(){var a="qx.ui.window.IDesktop";qx.Interface.define(a,{members:{setWindowManager:function(b){this.assertInterface(b,qx.ui.window.IWindowManager);},getWindows:function(){},supportsMaximize:function(){},blockContent:function(c){this.assertInteger(c);},unblockContent:function(){},isContentBlocked:function(){}}});})();(function(){var h="headerCellRendererChanged",g="visibilityChangedPre",f="Number",e="qx.event.type.Event",d="_applyFirstColumnX",c="Integer",b="qx.ui.table.pane.Model",a="_applyMaxColumnCount";qx.Class.define(b,{extend:qx.core.Object,construct:function(i){qx.core.Object.call(this);this.setTableColumnModel(i);},events:{"modelChanged":e},statics:{EVENT_TYPE_MODEL_CHANGED:"modelChanged"},properties:{firstColumnX:{check:c,init:0,apply:d},maxColumnCount:{check:f,init:-1,apply:a}},members:{__xK:null,__xL:null,_applyFirstColumnX:function(j,k){this.__xK=null;this.fireEvent(qx.ui.table.pane.Model.EVENT_TYPE_MODEL_CHANGED);},_applyMaxColumnCount:function(l,m){this.__xK=null;this.fireEvent(qx.ui.table.pane.Model.EVENT_TYPE_MODEL_CHANGED);},setTableColumnModel:function(n){if(this.__xL){this.__xL.removeListener(g,this._onColVisibilityChanged,this);this.__xL.removeListener(h,this._onColVisibilityChanged,this);}this.__xL=n;this.__xL.addListener(g,this._onColVisibilityChanged,this);this.__xL.addListener(h,this._onHeaderCellRendererChanged,this);this.__xK=null;},_onColVisibilityChanged:function(o){this.__xK=null;this.fireEvent(qx.ui.table.pane.Model.EVENT_TYPE_MODEL_CHANGED);},_onHeaderCellRendererChanged:function(p){this.fireEvent(qx.ui.table.pane.Model.EVENT_TYPE_MODEL_CHANGED);},getColumnCount:function(){if(this.__xK==null){var q=this.getFirstColumnX();var s=this.getMaxColumnCount();var r=this.__xL.getVisibleColumnCount();if(s==-1||(q+s)>r){this.__xK=r-q;}else{this.__xK=s;}}return this.__xK;},getColumnAtX:function(t){var u=this.getFirstColumnX();return this.__xL.getVisibleColumnAtX(u+t);},getX:function(v){var w=this.getFirstColumnX();var y=this.getMaxColumnCount();var x=this.__xL.getVisibleX(v)-w;if(x>=0&&(y==-1||x<y)){return x;}else{return -1;}},getColumnLeft:function(z){var C=0;var B=this.getColumnCount();for(var x=0;x<B;x++){var A=this.getColumnAtX(x);if(A==z){return C;}C+=this.__xL.getColumnWidth(A);}return -1;},getTotalWidth:function(){var D=0;var E=this.getColumnCount();for(var x=0;x<E;x++){var F=this.getColumnAtX(x);D+=this.__xL.getColumnWidth(F);}return D;}},destruct:function(){if(this.__xL){this.__xL.removeListener(g,this._onColVisibilityChanged,this);this.__xL.removeListener(h,this._onColVisibilityChanged,this);}this.__xL=null;}});})();(function(){var r="px",q=".qooxdoo-table-cell-icon {",p="abstract",o="",n="qx.ui.table.cellrenderer.AbstractImage",m=" qooxdoo-table-cell-icon",l="<div></div>",k="'",j="no-repeat",i="}",c=" text-align:center;",h="inline-block",f="static",b="top",a=" padding-top:1px;",e="title='",d="string",g="-moz-inline-box";qx.Class.define(n,{extend:qx.ui.table.cellrenderer.Abstract,type:p,construct:function(){qx.ui.table.cellrenderer.Abstract.call(this);var s=this.self(arguments);if(!s.stylesheet){s.stylesheet=qx.bom.Stylesheet.createElement(q+c+a+i);}},members:{__Hw:16,__Hx:16,__Hy:null,_insetY:2,_identifyImage:function(t){throw new Error("_identifyImage is abstract");},_getImageInfos:function(u){var v=this._identifyImage(u);if(v==null||typeof v==d){v={url:v,tooltip:null};}if(!v.imageWidth||!v.imageHeight){var w=this.__Hz(v.url);v.imageWidth=w.width;v.imageHeight=w.height;}v.width=v.imageWidth;v.height=v.imageHeight;return v;},__Hz:function(x){var A=qx.util.ResourceManager.getInstance();var z=qx.io.ImageLoader;var y,B;if(A.has(x)){y=A.getImageWidth(x);B=A.getImageHeight(x);}else if(z.isLoaded(x)){y=z.getWidth(x);B=z.getHeight(x);}else{y=this.__Hw;B=this.__Hx;}return {width:y,height:B};},createDataCellHtml:function(C,D){this.__Hy=this._getImageInfos(C);return qx.ui.table.cellrenderer.Abstract.prototype.createDataCellHtml.call(this,C,D);},_getCellClass:function(E){return qx.ui.table.cellrenderer.Abstract.prototype._getCellClass.call(this)+m;},_getContentHtml:function(F){var content=l;if(this.__Hy.url){content=qx.bom.element.Decoration.create(this.__Hy.url,j,{width:this.__Hy.width+r,height:this.__Hy.height+r,display:qx.bom.client.Engine.GECKO&&qx.bom.client.Engine.VERSION<1.9?g:h,verticalAlign:b,position:f});}return content;},_getCellAttributes:function(G){var H=this.__Hy.tooltip;if(H){return e+H+k;}else{return o;}}},destruct:function(){this.__Hy=null;}});})();(function(){var b="qx.ui.table.cellrenderer.Image",a="";qx.Class.define(b,{extend:qx.ui.table.cellrenderer.AbstractImage,construct:function(c,d){qx.ui.table.cellrenderer.AbstractImage.call(this);if(c){this.__HA=c;}if(d){this.__HB=d;}this.__HC=qx.util.AliasManager.getInstance();},members:{__HC:null,__HB:16,__HA:16,_identifyImage:function(e){var f={imageWidth:this.__HA,imageHeight:this.__HB};if(e.value==a){f.url=null;}else{f.url=this.__HC.resolve(e.value);}f.tooltip=e.tooltip;return f;}},destruct:function(){this.__HC=null;}});})();(function(){var k="Boolean",j="qx.event.type.Event",i="queued",h="String",g="sending",f="receiving",d="aborted",c="failed",b="nocache",a="completed",P="qx.io.remote.Response",O="POST",N="configured",M="timeout",L="GET",K="Pragma",J="no-url-params-on-post",I="PUT",H="no-cache",G="Cache-Control",r="Content-Type",s="text/plain",p="application/xml",q="application/json",n="text/html",o="application/x-www-form-urlencoded",l="qx.io.remote.Exchange",m="Integer",t="X-Qooxdoo-Response-Type",u="HEAD",y="qx.io.remote.Request",x="_applyResponseType",A="_applyState",z="text/javascript",C="changeState",B="_applyProhibitCaching",w="",F="_applyMethod",E="DELETE",D="boolean";qx.Class.define(y,{extend:qx.core.Object,construct:function(Q,R,S){qx.core.Object.call(this);this.__sp={};this.__sq={};this.__sr={};this.__ss={};if(Q!==undefined){this.setUrl(Q);}if(R!==undefined){this.setMethod(R);}if(S!==undefined){this.setResponseType(S);}this.setProhibitCaching(true);this.__st=++qx.io.remote.Request.__st;},events:{"created":j,"configured":j,"sending":j,"receiving":j,"completed":P,"aborted":j,"failed":P,"timeout":P},statics:{__st:0,methodAllowsRequestBody:function(T){return (T==O)||(T==I);}},properties:{url:{check:h,init:w},method:{check:[L,O,I,u,E],apply:F,init:L},asynchronous:{check:k,init:true},data:{check:h,nullable:true},username:{check:h,nullable:true},password:{check:h,nullable:true},state:{check:[N,i,g,f,a,d,M,c],init:N,apply:A,event:C},responseType:{check:[s,z,q,p,n],init:s,apply:x},timeout:{check:m,nullable:true},prohibitCaching:{check:function(v){return typeof v==D||v===J;},init:true,apply:B},crossDomain:{check:k,init:false},fileUpload:{check:k,init:false},transport:{check:l,nullable:true},useBasicHttpAuth:{check:k,init:false},parseJson:{check:k,init:true}},members:{__sp:null,__sq:null,__sr:null,__ss:null,__st:null,send:function(){qx.io.remote.RequestQueue.getInstance().add(this);},abort:function(){qx.io.remote.RequestQueue.getInstance().abort(this);},reset:function(){switch(this.getState()){case g:case f:this.error("Aborting already sent request!");case i:this.abort();break;}},isConfigured:function(){return this.getState()===N;},isQueued:function(){return this.getState()===i;},isSending:function(){return this.getState()===g;},isReceiving:function(){return this.getState()===f;},isCompleted:function(){return this.getState()===a;},isAborted:function(){return this.getState()===d;},isTimeout:function(){return this.getState()===M;},isFailed:function(){return this.getState()===c;},__su:qx.event.GlobalError.observeMethod(function(e){var U=e.clone();U.setTarget(this);this.dispatchEvent(U);}),_onqueued:function(e){this.setState(i);this.__su(e);},_onsending:function(e){this.setState(g);this.__su(e);},_onreceiving:function(e){this.setState(f);this.__su(e);},_oncompleted:function(e){this.setState(a);this.__su(e);this.dispose();},_onaborted:function(e){this.setState(d);this.__su(e);this.dispose();},_ontimeout:function(e){this.setState(M);this.__su(e);this.dispose();},_onfailed:function(e){this.setState(c);this.__su(e);this.dispose();},_applyState:function(V,W){{};},_applyProhibitCaching:function(X,Y){if(!X){this.removeParameter(b);this.removeRequestHeader(K);this.removeRequestHeader(G);return;}if(X!==J||this.getMethod()!=O){this.setParameter(b,new Date().valueOf());}else{this.removeParameter(b);}this.setRequestHeader(K,H);this.setRequestHeader(G,H);},_applyMethod:function(ba,bb){if(qx.io.remote.Request.methodAllowsRequestBody(ba)){this.setRequestHeader(r,o);}else{this.removeRequestHeader(r);}var bc=this.getProhibitCaching();this._applyProhibitCaching(bc,bc);},_applyResponseType:function(bd,be){this.setRequestHeader(t,bd);},setRequestHeader:function(bf,bg){this.__sp[bf]=bg;},removeRequestHeader:function(bh){delete this.__sp[bh];},getRequestHeader:function(bi){return this.__sp[bi]||null;},getRequestHeaders:function(){return this.__sp;},setParameter:function(bj,bk,bl){if(bl){this.__sr[bj]=bk;}else{this.__sq[bj]=bk;}},removeParameter:function(bm,bn){if(bn){delete this.__sr[bm];}else{delete this.__sq[bm];}},getParameter:function(bo,bp){if(bp){return this.__sr[bo]||null;}else{return this.__sq[bo]||null;}},getParameters:function(bq){return (bq?this.__sr:this.__sq);},setFormField:function(br,bs){this.__ss[br]=bs;},removeFormField:function(bt){delete this.__ss[bt];},getFormField:function(bu){return this.__ss[bu]||null;},getFormFields:function(){return this.__ss;},getSequenceNumber:function(){return this.__st;}},destruct:function(){this.setTransport(null);this.__sp=this.__sq=this.__sr=this.__ss=null;}});})();(function(){var b=".",a="qx.bom.client.Transport";qx.Class.define(a,{statics:{getMaxConcurrentRequestCount:function(){var h;var c=qx.bom.client.Engine;var g=c.FULLVERSION.split(b);var e=0;var d=0;var f=0;if(g[0]){e=g[0];}if(g[1]){d=g[1];}if(g[2]){f=g[2];}if(window.maxConnectionsPerServer){h=window.maxConnectionsPerServer;}else if(c.OPERA){h=8;}else if(c.WEBKIT){h=4;}else if(c.GECKO&&((e>1)||((e==1)&&(d>9))||((e==1)&&(d==9)&&(f>=1)))){h=6;}else{h=2;}return h;}}});})();(function(){var s="Integer",r="aborted",q="_onaborted",p="_on",o="_applyEnabled",n="Boolean",m="sending",l="__pc",k="interval",j="__pe",c="failed",h="qx.io.remote.RequestQueue",g="timeout",b="completed",a="queued",f="receiving",d="singleton";qx.Class.define(h,{type:d,extend:qx.core.Object,construct:function(){qx.core.Object.call(this);this.__pb=[];this.__pc=[];this.__pd=0;this.__pe=new qx.event.Timer(500);this.__pe.addListener(k,this._oninterval,this);},properties:{enabled:{init:true,check:n,apply:o},maxTotalRequests:{check:s,nullable:true},maxConcurrentRequests:{check:s,init:qx.bom.client.Transport.getMaxConcurrentRequestCount()},defaultTimeout:{check:s,init:5000}},members:{__pb:null,__pc:null,__pd:null,__pe:null,getRequestQueue:function(){return this.__pb;},getActiveQueue:function(){return this.__pc;},_debug:function(){var t;{};},_check:function(){this._debug();if(this.__pc.length==0&&this.__pb.length==0){this.__pe.stop();}if(!this.getEnabled()){return;}if(this.__pb.length==0||(this.__pb[0].isAsynchronous()&&this.__pc.length>=this.getMaxConcurrentRequests())){return;}if(this.getMaxTotalRequests()!=null&&this.__pd>=this.getMaxTotalRequests()){return;}var u=this.__pb.shift();var v=new qx.io.remote.Exchange(u);this.__pd++;this.__pc.push(v);this._debug();v.addListener(m,this._onsending,this);v.addListener(f,this._onreceiving,this);v.addListener(b,this._oncompleted,this);v.addListener(r,this._oncompleted,this);v.addListener(g,this._oncompleted,this);v.addListener(c,this._oncompleted,this);v._start=(new Date).valueOf();v.send();if(this.__pb.length>0){this._check();}},_remove:function(w){qx.lang.Array.remove(this.__pc,w);w.dispose();this._check();},__pf:0,_onsending:function(e){{};e.getTarget().getRequest()._onsending(e);},_onreceiving:function(e){e.getTarget().getRequest()._onreceiving(e);},_oncompleted:function(e){{};var y=e.getTarget().getRequest();var x=p+e.getType();try{if(y[x]){y[x](e);}}catch(z){this.error("Request "+y+" handler "+x+" threw an error: ",z);try{if(y[q]){var event=qx.event.Registration.createEvent(r,qx.event.type.Event);y[q](event);}}catch(A){}}finally{this._remove(e.getTarget());}},_oninterval:function(e){var H=this.__pc;if(H.length==0){this.__pe.stop();return;}var C=(new Date).valueOf();var F;var D;var G=this.getDefaultTimeout();var E;var B;for(var i=H.length-1;i>=0;i--){F=H[i];D=F.getRequest();if(D.isAsynchronous()){E=D.getTimeout();if(E==0){continue;}if(E==null){E=G;}B=C-F._start;if(B>E){this.warn("Timeout: transport "+F.toHashCode());this.warn(B+"ms > "+E+"ms");F.timeout();}}}},_applyEnabled:function(I,J){if(I){this._check();}this.__pe.setEnabled(I);},add:function(K){K.setState(a);if(K.isAsynchronous()){this.__pb.push(K);}else{this.__pb.unshift(K);}this._check();if(this.getEnabled()){this.__pe.start();}},abort:function(L){var M=L.getTransport();if(M){M.abort();}else if(qx.lang.Array.contains(this.__pb,L)){qx.lang.Array.remove(this.__pb,L);}}},destruct:function(){this._disposeArray(l);this._disposeObjects(j);this.__pb=null;}});})();(function(){var o="failed",n="sending",m="completed",k="receiving",j="aborted",h="timeout",g="qx.event.type.Event",f="Connection dropped",d="qx.io.remote.Response",c="=",bp="configured",bo="&",bn="Unknown status code. ",bm="qx.io.remote.transport.XmlHttp",bl="qx.io.remote.transport.Abstract",bk="Request-URL too large",bj="MSHTML-specific HTTP status code",bi="Not available",bh="Precondition failed",bg="Server error",v="Moved temporarily",w="qx.io.remote.Exchange",t="Possibly due to a cross-domain request?",u="Bad gateway",r="Gone",s="See other",p="Partial content",q="Server timeout",B="qx.io.remote.transport.Script",C="HTTP version not supported",L="Unauthorized",I="Possibly due to application URL using 'file:' protocol?",T="Multiple choices",O="Payment required",bc="Not implemented",Y="Proxy authentication required",E="Length required",bf="_applyState",be="changeState",bd="Not modified",D="qx.io.remote.Request",G="Connection closed by server",H="Moved permanently",K="_applyImplementation",M="",P="Method not allowed",V="Forbidden",bb="Use proxy",x="Ok",y="Conflict",F="Not found",S="Not acceptable",R="Request time-out",Q="Bad request",X="No content",W="file:",N="qx.io.remote.transport.Iframe",U="Request entity too large",a="Unknown status code",ba="Unsupported media type",z="Gateway time-out",A="created",J="Out of resources",b="undefined";qx.Class.define(w,{extend:qx.core.Object,construct:function(bq){qx.core.Object.call(this);this.setRequest(bq);bq.setTransport(this);},events:{"sending":g,"receiving":g,"completed":d,"aborted":g,"failed":d,"timeout":d},statics:{typesOrder:[bm,N,B],typesReady:false,typesAvailable:{},typesSupported:{},registerType:function(br,bs){qx.io.remote.Exchange.typesAvailable[bs]=br;},initTypes:function(){if(qx.io.remote.Exchange.typesReady){return;}for(var bu in qx.io.remote.Exchange.typesAvailable){var bt=qx.io.remote.Exchange.typesAvailable[bu];if(bt.isSupported()){qx.io.remote.Exchange.typesSupported[bu]=bt;}}qx.io.remote.Exchange.typesReady=true;if(qx.lang.Object.isEmpty(qx.io.remote.Exchange.typesSupported)){throw new Error("No supported transport types were found!");}},canHandle:function(bv,bw,bx){if(!qx.lang.Array.contains(bv.handles.responseTypes,bx)){return false;}for(var by in bw){if(!bv.handles[by]){return false;}}return true;},_nativeMap:{0:A,1:bp,2:n,3:k,4:m},wasSuccessful:function(bz,bA,bB){if(bB){switch(bz){case null:case 0:return true;case -1:return bA<4;default:return typeof bz===b;}}else{switch(bz){case -1:{};return bA<4;case 200:case 304:return true;case 201:case 202:case 203:case 204:case 205:return true;case 206:{};return bA!==4;case 300:case 301:case 302:case 303:case 305:case 400:case 401:case 402:case 403:case 404:case 405:case 406:case 407:case 408:case 409:case 410:case 411:case 412:case 413:case 414:case 415:case 500:case 501:case 502:case 503:case 504:case 505:{};return false;case 12002:case 12007:case 12029:case 12030:case 12031:case 12152:case 13030:{};return false;default:if(bz>206&&bz<300){return true;}qx.log.Logger.debug(this,"Unknown status code: "+bz+" ("+bA+")");return false;}}},statusCodeToString:function(bC){switch(bC){case -1:return bi;case 0:var bD=window.location.href;if(qx.lang.String.startsWith(bD.toLowerCase(),W)){return (bn+I);}else{return (bn+t);}break;case 200:return x;case 304:return bd;case 206:return p;case 204:return X;case 300:return T;case 301:return H;case 302:return v;case 303:return s;case 305:return bb;case 400:return Q;case 401:return L;case 402:return O;case 403:return V;case 404:return F;case 405:return P;case 406:return S;case 407:return Y;case 408:return R;case 409:return y;case 410:return r;case 411:return E;case 412:return bh;case 413:return U;case 414:return bk;case 415:return ba;case 500:return bg;case 501:return bc;case 502:return u;case 503:return J;case 504:return z;case 505:return C;case 12002:return q;case 12029:return f;case 12030:return f;case 12031:return f;case 12152:return G;case 13030:return bj;default:return a;}}},properties:{request:{check:D,nullable:true},implementation:{check:bl,nullable:true,apply:K},state:{check:[bp,n,k,m,j,h,o],init:bp,event:be,apply:bf}},members:{send:function(){var bH=this.getRequest();if(!bH){return this.error("Please attach a request object first");}qx.io.remote.Exchange.initTypes();var bF=qx.io.remote.Exchange.typesOrder;var bE=qx.io.remote.Exchange.typesSupported;var bJ=bH.getResponseType();var bK={};if(bH.getAsynchronous()){bK.asynchronous=true;}else{bK.synchronous=true;}if(bH.getCrossDomain()){bK.crossDomain=true;}if(bH.getFileUpload()){bK.fileUpload=true;}for(var bI in bH.getFormFields()){bK.programaticFormFields=true;break;}var bL,bG;for(var i=0,l=bF.length;i<l;i++){bL=bE[bF[i]];if(bL){if(!qx.io.remote.Exchange.canHandle(bL,bK,bJ)){continue;}try{{};bG=new bL;this.setImplementation(bG);bG.setUseBasicHttpAuth(bH.getUseBasicHttpAuth());bG.send();return true;}catch(bM){this.error("Request handler throws error");this.error(bM);return;}}}this.error("There is no transport implementation available to handle this request: "+bH);},abort:function(){var bN=this.getImplementation();if(bN){{};bN.abort();}else{{};this.setState(j);}},timeout:function(){var bQ=this.getImplementation();if(bQ){var bP=M;for(var bO in bQ.getParameters()){bP+=bo+bO+c+bQ.getParameters()[bO];}this.warn("Timeout: implementation "+bQ.toHashCode()+", "+bQ.getUrl()+" ["+bQ.getMethod()+"], "+bP);bQ.timeout();}else{this.warn("Timeout: forcing state to timeout");this.setState(h);}this.__rx();},__rx:function(){var bR=this.getRequest();if(bR){bR.setTimeout(0);}},_onsending:function(e){this.setState(n);},_onreceiving:function(e){this.setState(k);},_oncompleted:function(e){this.setState(m);},_onabort:function(e){this.setState(j);},_onfailed:function(e){this.setState(o);},_ontimeout:function(e){this.setState(h);},_applyImplementation:function(bS,bT){if(bT){bT.removeListener(n,this._onsending,this);bT.removeListener(k,this._onreceiving,this);bT.removeListener(m,this._oncompleted,this);bT.removeListener(j,this._onabort,this);bT.removeListener(h,this._ontimeout,this);bT.removeListener(o,this._onfailed,this);}if(bS){var bV=this.getRequest();bS.setUrl(bV.getUrl());bS.setMethod(bV.getMethod());bS.setAsynchronous(bV.getAsynchronous());bS.setUsername(bV.getUsername());bS.setPassword(bV.getPassword());bS.setParameters(bV.getParameters(false));bS.setFormFields(bV.getFormFields());bS.setRequestHeaders(bV.getRequestHeaders());if(bS instanceof qx.io.remote.transport.XmlHttp){bS.setParseJson(bV.getParseJson());}var bY=bV.getData();if(bY===null){var ca=bV.getParameters(true);var bX=[];for(var bU in ca){var bW=ca[bU];if(bW instanceof Array){for(var i=0;i<bW.length;i++){bX.push(encodeURIComponent(bU)+c+encodeURIComponent(bW[i]));}}else{bX.push(encodeURIComponent(bU)+c+encodeURIComponent(bW));}}if(bX.length>0){bS.setData(bX.join(bo));}}else{bS.setData(bY);}bS.setResponseType(bV.getResponseType());bS.addListener(n,this._onsending,this);bS.addListener(k,this._onreceiving,this);bS.addListener(m,this._oncompleted,this);bS.addListener(j,this._onabort,this);bS.addListener(h,this._ontimeout,this);bS.addListener(o,this._onfailed,this);}},_applyState:function(cb,cc){{};switch(cb){case n:this.fireEvent(n);break;case k:this.fireEvent(k);break;case m:case j:case h:case o:var ce=this.getImplementation();if(!ce){break;}this.__rx();if(this.hasListener(cb)){var cf=qx.event.Registration.createEvent(cb,qx.io.remote.Response);if(cb==m){var cd=ce.getResponseContent();cf.setContent(cd);if(cd===null){{};cb=o;}}else if(cb==o){cf.setContent(ce.getResponseContent());}cf.setStatusCode(ce.getStatusCode());cf.setResponseHeaders(ce.getResponseHeaders());this.dispatchEvent(cf);}this.setImplementation(null);ce.dispose();break;}}},settings:{"qx.ioRemoteDebug":false,"qx.ioRemoteDebugData":false},destruct:function(){var cg=this.getImplementation();if(cg){this.setImplementation(null);cg.dispose();}this.setRequest(null);}});})();(function(){var q="qx.event.type.Event",p="String",o="failed",n="timeout",m="created",l="aborted",k="sending",j="configured",i="receiving",h="completed",c="Object",g="Boolean",f="abstract",b="_applyState",a="GET",e="changeState",d="qx.io.remote.transport.Abstract";qx.Class.define(d,{type:f,extend:qx.core.Object,construct:function(){qx.core.Object.call(this);this.setRequestHeaders({});this.setParameters({});this.setFormFields({});},events:{"created":q,"configured":q,"sending":q,"receiving":q,"completed":q,"aborted":q,"failed":q,"timeout":q},properties:{url:{check:p,nullable:true},method:{check:p,nullable:true,init:a},asynchronous:{check:g,nullable:true,init:true},data:{check:p,nullable:true},username:{check:p,nullable:true},password:{check:p,nullable:true},state:{check:[m,j,k,i,h,l,n,o],init:m,event:e,apply:b},requestHeaders:{check:c,nullable:true},parameters:{check:c,nullable:true},formFields:{check:c,nullable:true},responseType:{check:p,nullable:true},useBasicHttpAuth:{check:g,nullable:true}},members:{send:function(){throw new Error("send is abstract");},abort:function(){{};this.setState(l);},timeout:function(){{};this.setState(n);},failed:function(){{};this.setState(o);},setRequestHeader:function(r,s){throw new Error("setRequestHeader is abstract");},getResponseHeader:function(t){throw new Error("getResponseHeader is abstract");},getResponseHeaders:function(){throw new Error("getResponseHeaders is abstract");},getStatusCode:function(){throw new Error("getStatusCode is abstract");},getStatusText:function(){throw new Error("getStatusText is abstract");},getResponseText:function(){throw new Error("getResponseText is abstract");},getResponseXml:function(){throw new Error("getResponseXml is abstract");},getFetchedLength:function(){throw new Error("getFetchedLength is abstract");},_applyState:function(u,v){{};switch(u){case m:this.fireEvent(m);break;case j:this.fireEvent(j);break;case k:this.fireEvent(k);break;case i:this.fireEvent(i);break;case h:this.fireEvent(h);break;case l:this.fireEvent(l);break;case o:this.fireEvent(o);break;case n:this.fireEvent(n);break;}return true;}},destruct:function(){this.setRequestHeaders(null);this.setParameters(null);this.setFormFields(null);}});})();(function(){var l="=",k="",j="&",h="application/xml",g="application/json",f="text/html",d="qx.client",c="textarea",b="_data_",a="load",G="text/plain",F="text/javascript",E="completed",D="readystatechange",C="?",B="qx.io.remote.transport.Iframe",A="none",z="display",y="gecko",x="frame_",s="aborted",t="pre",q="javascript:void(0)",r="sending",o="form",p="failed",m="mshtml",n="form_",u="opera",v="timeout",w="qx/static/blank.gif";qx.Class.define(B,{extend:qx.io.remote.transport.Abstract,construct:function(){qx.io.remote.transport.Abstract.call(this);var H=(new Date).valueOf();var I=x+H;var J=n+H;var K;if(qx.core.Variant.isSet(d,m)){K=q;}this.__oh=qx.bom.Iframe.create({id:I,name:I,src:K});qx.bom.element.Style.set(this.__oh,z,A);this.__oi=qx.bom.Element.create(o,{id:J,name:J,target:I});qx.bom.element.Style.set(this.__oi,z,A);qx.dom.Element.insertEnd(this.__oi,qx.dom.Node.getBodyElement(document));this.__oj=qx.bom.Element.create(c,{id:b,name:b});qx.dom.Element.insertEnd(this.__oj,this.__oi);qx.dom.Element.insertEnd(this.__oh,qx.dom.Node.getBodyElement(document));qx.event.Registration.addListener(this.__oh,a,this._onload,this);this.__ok=qx.lang.Function.listener(this._onreadystatechange,this);qx.bom.Event.addNativeListener(this.__oh,D,this.__ok);},statics:{handles:{synchronous:false,asynchronous:true,crossDomain:false,fileUpload:true,programaticFormFields:true,responseTypes:[G,F,g,h,f]},isSupported:function(){return true;},_numericMap:{"uninitialized":1,"loading":2,"loaded":2,"interactive":3,"complete":4}},members:{__oj:null,__ol:0,__oi:null,__oh:null,__ok:null,send:function(){var M=this.getMethod();var O=this.getUrl();var S=this.getParameters(false);var R=[];for(var N in S){var P=S[N];if(P instanceof Array){for(var i=0;i<P.length;i++){R.push(encodeURIComponent(N)+l+encodeURIComponent(P[i]));}}else{R.push(encodeURIComponent(N)+l+encodeURIComponent(P));}}if(R.length>0){O+=(O.indexOf(C)>=0?j:C)+R.join(j);}if(this.getData()===null){var S=this.getParameters(true);var R=[];for(var N in S){var P=S[N];if(P instanceof Array){for(var i=0;i<P.length;i++){R.push(encodeURIComponent(N)+l+encodeURIComponent(P[i]));}}else{R.push(encodeURIComponent(N)+l+encodeURIComponent(P));}}if(R.length>0){this.setData(R.join(j));}}var L=this.getFormFields();for(var N in L){var Q=document.createElement(c);Q.name=N;Q.appendChild(document.createTextNode(L[N]));this.__oi.appendChild(Q);}this.__oi.action=O;this.__oi.method=M;this.__oj.appendChild(document.createTextNode(this.getData()));this.__oi.submit();this.setState(r);},_onload:qx.event.GlobalError.observeMethod(function(e){if(qx.bom.client.Engine.NAME==u&&this.getIframeHtmlContent()==k){return;}if(this.__oi.src){return;}this._switchReadyState(qx.io.remote.transport.Iframe._numericMap.complete);}),_onreadystatechange:qx.event.GlobalError.observeMethod(function(e){this._switchReadyState(qx.io.remote.transport.Iframe._numericMap[this.__oh.readyState]);}),_switchReadyState:function(T){switch(this.getState()){case E:case s:case p:case v:this.warn("Ignore Ready State Change");return;}while(this.__ol<T){this.setState(qx.io.remote.Exchange._nativeMap[++this.__ol]);}},setRequestHeader:function(U,V){},getResponseHeader:function(W){return null;},getResponseHeaders:function(){return {};},getStatusCode:function(){return 200;},getStatusText:function(){return k;},getIframeWindow:function(){return qx.bom.Iframe.getWindow(this.__oh);},getIframeDocument:function(){return qx.bom.Iframe.getDocument(this.__oh);},getIframeBody:function(){return qx.bom.Iframe.getBody(this.__oh);},getIframeTextContent:function(){var X=this.getIframeBody();if(!X){return null;}if(!X.firstChild){return k;}if(X.firstChild.tagName&&X.firstChild.tagName.toLowerCase()==t){return X.firstChild.innerHTML;}else{return X.innerHTML;}},getIframeHtmlContent:function(){var Y=this.getIframeBody();return Y?Y.innerHTML:null;},getFetchedLength:function(){return 0;},getResponseContent:function(){if(this.getState()!==E){{};return null;}{};var ba=this.getIframeTextContent();switch(this.getResponseType()){case G:{};return ba;break;case f:ba=this.getIframeHtmlContent();{};return ba;break;case g:ba=this.getIframeHtmlContent();{};try{return ba&&ba.length>0?qx.util.Json.parse(ba,false):null;}catch(bb){return this.error("Could not execute json: ("+ba+")",bb);}case F:ba=this.getIframeHtmlContent();{};try{return ba&&ba.length>0?window.eval(ba):null;}catch(bc){return this.error("Could not execute javascript: ("+ba+")",bc);}case h:ba=this.getIframeDocument();{};return ba;default:this.warn("No valid responseType specified ("+this.getResponseType()+")!");return null;}}},defer:function(){qx.io.remote.Exchange.registerType(qx.io.remote.transport.Iframe,B);},destruct:function(){if(this.__oh){qx.event.Registration.removeListener(this.__oh,a,this._onload,this);qx.bom.Event.removeNativeListener(this.__oh,D,this.__ok);if(qx.core.Variant.isSet(d,y)){this.__oh.src=qx.util.ResourceManager.getInstance().toUri(w);}qx.dom.Element.remove(this.__oh);}if(this.__oi){qx.dom.Element.remove(this.__oi);}this.__oh=this.__oi=this.__oj=null;}});})();(function(){var c="qx.event.handler.Iframe",b="load",a="iframe";qx.Class.define(c,{extend:qx.core.Object,implement:qx.event.IEventHandler,statics:{PRIORITY:qx.event.Registration.PRIORITY_NORMAL,SUPPORTED_TYPES:{load:1},TARGET_CHECK:qx.event.IEventHandler.TARGET_DOMNODE,IGNORE_CAN_HANDLE:false,onevent:qx.event.GlobalError.observeMethod(function(d){qx.event.Registration.fireEvent(d,b);})},members:{canHandleEvent:function(e,f){return e.tagName.toLowerCase()===a;},registerEvent:function(g,h,i){},unregisterEvent:function(j,k,l){}},defer:function(m){qx.event.Registration.addHandler(m);}});})();(function(){var e="qx.client",d="webkit",c="body",b="iframe",a="qx.bom.Iframe";qx.Class.define(a,{statics:{DEFAULT_ATTRIBUTES:{onload:"qx.event.handler.Iframe.onevent(this)",frameBorder:0,frameSpacing:0,marginWidth:0,marginHeight:0,hspace:0,vspace:0,border:0,allowTransparency:true},create:function(f,g){var f=f?qx.lang.Object.clone(f):{};var h=qx.bom.Iframe.DEFAULT_ATTRIBUTES;for(var i in h){if(f[i]==null){f[i]=h[i];}}return qx.bom.Element.create(b,f,g);},getWindow:qx.core.Variant.select(e,{"mshtml|gecko":function(j){try{return j.contentWindow;}catch(k){return null;}},"default":function(l){try{var m=this.getDocument(l);return m?m.defaultView:null;}catch(n){return null;}}}),getDocument:qx.core.Variant.select(e,{"mshtml":function(o){try{var p=this.getWindow(o);return p?p.document:null;}catch(q){return null;}},"default":function(r){try{return r.contentDocument;}catch(s){return null;}}}),getBody:function(t){try{var u=this.getDocument(t);return u?u.getElementsByTagName(c)[0]:null;}catch(v){return null;}},setSource:function(w,x){try{if(this.getWindow(w)&&qx.dom.Hierarchy.isRendered(w)){try{if(qx.core.Variant.isSet(e,d)&&qx.bom.client.Platform.MAC){var y=this.getContentWindow();if(y){y.stop();}}this.getWindow(w).location.replace(x);}catch(z){w.src=x;}}else{w.src=x;}}catch(A){qx.log.Logger.warn("Iframe source could not be set!");}},queryCurrentUrl:function(B){var C=this.getDocument(B);try{if(C&&C.location){return C.location.href;}}catch(D){}return null;}}});})();(function(){var a="qx.dom.Element";qx.Class.define(a,{statics:{hasChild:function(parent,b){return b.parentNode===parent;},hasChildren:function(c){return !!c.firstChild;},hasChildElements:function(d){d=d.firstChild;while(d){if(d.nodeType===1){return true;}d=d.nextSibling;}return false;},getParentElement:function(e){return e.parentNode;},isInDom:function(f,g){if(!g){g=window;}var h=g.document.getElementsByTagName(f.nodeName);for(var i=0,l=h.length;i<l;i++){if(h[i]===f){return true;}}return false;},insertAt:function(j,parent,k){var m=parent.childNodes[k];if(m){parent.insertBefore(j,m);}else{parent.appendChild(j);}return true;},insertBegin:function(n,parent){if(parent.firstChild){this.insertBefore(n,parent.firstChild);}else{parent.appendChild(n);}},insertEnd:function(o,parent){parent.appendChild(o);},insertBefore:function(p,q){q.parentNode.insertBefore(p,q);return true;},insertAfter:function(r,s){var parent=s.parentNode;if(s==parent.lastChild){parent.appendChild(r);}else{return this.insertBefore(r,s.nextSibling);}return true;},remove:function(t){if(!t.parentNode){return false;}t.parentNode.removeChild(t);return true;},removeChild:function(u,parent){if(u.parentNode!==parent){return false;}parent.removeChild(u);return true;},removeChildAt:function(v,parent){var w=parent.childNodes[v];if(!w){return false;}parent.removeChild(w);return true;},replaceChild:function(x,y){if(!y.parentNode){return false;}y.parentNode.replaceChild(x,y);return true;},replaceAt:function(z,A,parent){var B=parent.childNodes[A];if(!B){return false;}parent.replaceChild(z,B);return true;}}});})();(function(){var r="&",q="=",p="?",o="application/json",n="completed",m="text/plain",l="text/javascript",k="qx.io.remote.transport.Script",j="",h="_ScriptTransport_data",c="script",g="timeout",f="_ScriptTransport_",b="_ScriptTransport_id",a="aborted",e="utf-8",d="failed";qx.Class.define(k,{extend:qx.io.remote.transport.Abstract,construct:function(){qx.io.remote.transport.Abstract.call(this);var s=++qx.io.remote.transport.Script.__pg;if(s>=2000000000){qx.io.remote.transport.Script.__pg=s=1;}this.__ph=null;this.__pg=s;},statics:{__pg:0,_instanceRegistry:{},ScriptTransport_PREFIX:f,ScriptTransport_ID_PARAM:b,ScriptTransport_DATA_PARAM:h,handles:{synchronous:false,asynchronous:true,crossDomain:true,fileUpload:false,programaticFormFields:false,responseTypes:[m,l,o]},isSupported:function(){return true;},_numericMap:{"uninitialized":1,"loading":2,"loaded":2,"interactive":3,"complete":4},_requestFinished:qx.event.GlobalError.observeMethod(function(t,content){var u=qx.io.remote.transport.Script._instanceRegistry[t];if(u==null){{};}else{u._responseContent=content;u._switchReadyState(qx.io.remote.transport.Script._numericMap.complete);}})},members:{__pi:0,__ph:null,__pg:null,send:function(){var x=this.getUrl();x+=(x.indexOf(p)>=0?r:p)+qx.io.remote.transport.Script.ScriptTransport_ID_PARAM+q+this.__pg;var A=this.getParameters();var z=[];for(var w in A){if(w.indexOf(qx.io.remote.transport.Script.ScriptTransport_PREFIX)==0){this.error("Illegal parameter name. The following prefix is used internally by qooxdoo): "+qx.io.remote.transport.Script.ScriptTransport_PREFIX);}var y=A[w];if(y instanceof Array){for(var i=0;i<y.length;i++){z.push(encodeURIComponent(w)+q+encodeURIComponent(y[i]));}}else{z.push(encodeURIComponent(w)+q+encodeURIComponent(y));}}if(z.length>0){x+=r+z.join(r);}var v=this.getData();if(v!=null){x+=r+qx.io.remote.transport.Script.ScriptTransport_DATA_PARAM+q+encodeURIComponent(v);}qx.io.remote.transport.Script._instanceRegistry[this.__pg]=this;this.__ph=document.createElement(c);this.__ph.charset=e;this.__ph.src=x;{};document.body.appendChild(this.__ph);},_switchReadyState:function(B){switch(this.getState()){case n:case a:case d:case g:this.warn("Ignore Ready State Change");return;}while(this.__pi<B){this.setState(qx.io.remote.Exchange._nativeMap[++this.__pi]);}},setRequestHeader:function(C,D){},getResponseHeader:function(E){return null;},getResponseHeaders:function(){return {};},getStatusCode:function(){return 200;},getStatusText:function(){return j;},getFetchedLength:function(){return 0;},getResponseContent:function(){if(this.getState()!==n){{};return null;}{};switch(this.getResponseType()){case m:case o:case l:{};var F=this._responseContent;return (F===0?0:(F||null));default:this.warn("No valid responseType specified ("+this.getResponseType()+")!");return null;}}},defer:function(){qx.io.remote.Exchange.registerType(qx.io.remote.transport.Script,k);},destruct:function(){if(this.__ph){delete qx.io.remote.transport.Script._instanceRegistry[this.__pg];document.body.removeChild(this.__ph);}this.__ph=this._responseContent=null;}});})();(function(){var m="failed",k="completed",j="=",h="aborted",g="",f="sending",d="&",c="configured",b="timeout",a="application/xml",J="qx.io.remote.transport.XmlHttp",I="application/json",H="text/html",G="qx.client",F="receiving",E="text/plain",D="text/javascript",C="?",B="created",A="Boolean",u='Referer',v='Basic ',r="\n</pre>",t="string",p='Authorization',q="<pre>Could not execute json: \n",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=':',w="parseerror",x="file:",z="webkit",y="object";qx.Class.define(J,{extend:qx.io.remote.transport.Abstract,statics:{handles:{synchronous:true,asynchronous:true,crossDomain:false,fileUpload:false,programaticFormFields:false,responseTypes:[E,D,I,a,H]},requestObjects:[],requestObjectCount:0,createRequestObject:qx.core.Variant.select(G,{"default":function(){return new XMLHttpRequest;},"mshtml":function(){if(window.ActiveXObject&&qx.xml.Document.XMLHTTP){return new ActiveXObject(qx.xml.Document.XMLHTTP);}if(window.XMLHttpRequest){return new XMLHttpRequest;}}}),isSupported:function(){return !!this.createRequestObject();}},properties:{parseJson:{check:A,init:true}},members:{__nh:false,__ni:0,__nj:null,getRequest:function(){if(this.__nj===null){this.__nj=qx.io.remote.transport.XmlHttp.createRequestObject();this.__nj.onreadystatechange=qx.lang.Function.bind(this._onreadystatechange,this);}return this.__nj;},send:function(){this.__ni=0;var O=this.getRequest();var K=this.getMethod();var R=this.getAsynchronous();var Q=this.getUrl();var M=(window.location.protocol===x&&!(/^http(s){0,1}\:/.test(Q)));this.__nh=M;var U=this.getParameters(false);var S=[];for(var L in U){var P=U[L];if(P instanceof Array){for(var i=0;i<P.length;i++){S.push(encodeURIComponent(L)+j+encodeURIComponent(P[i]));}}else{S.push(encodeURIComponent(L)+j+encodeURIComponent(P));}}if(S.length>0){Q+=(Q.indexOf(C)>=0?d:C)+S.join(d);}if(this.getData()===null){var U=this.getParameters(true);var S=[];for(var L in U){var P=U[L];if(P instanceof Array){for(var i=0;i<P.length;i++){S.push(encodeURIComponent(L)+j+encodeURIComponent(P[i]));}}else{S.push(encodeURIComponent(L)+j+encodeURIComponent(P));}}if(S.length>0){this.setData(S.join(d));}}var T=function(V){var bb=n;var bf=g;var Y,X,W;var bc,bd,be,ba;var i=0;do{Y=V.charCodeAt(i++);X=V.charCodeAt(i++);W=V.charCodeAt(i++);bc=Y>>2;bd=((Y&3)<<4)|(X>>4);be=((X&15)<<2)|(W>>6);ba=W&63;if(isNaN(X)){be=ba=64;}else if(isNaN(W)){ba=64;}bf+=bb.charAt(bc)+bb.charAt(bd)+bb.charAt(be)+bb.charAt(ba);}while(i<V.length);return bf;};try{if(this.getUsername()){if(this.getUseBasicHttpAuth()){O.open(K,Q,R);O.setRequestHeader(p,v+T(this.getUsername()+o+this.getPassword()));}else{O.open(K,Q,R,this.getUsername(),this.getPassword());}}else{O.open(K,Q,R);}}catch(bg){this.error("Failed with exception: "+bg);this.failed();return;}if(!qx.core.Variant.isSet(G,z)){O.setRequestHeader(u,window.location.href);}var N=this.getRequestHeaders();for(var L in N){O.setRequestHeader(L,N[L]);}try{{};O.send(this.getData());}catch(bh){if(M){this.failedLocally();}else{this.error("Failed to send data: "+bh,"send");this.failed();}return;}if(!R){this._onreadystatechange();}},failedLocally:function(){if(this.getState()===m){return;}this.warn("Could not load from file: "+this.getUrl());this.failed();},_onreadystatechange:qx.event.GlobalError.observeMethod(function(e){switch(this.getState()){case k:case h:case m:case b:{};return;}var bi=this.getReadyState();if(bi==4){if(!qx.io.remote.Exchange.wasSuccessful(this.getStatusCode(),bi,this.__nh)){if(this.getState()===c){this.setState(f);}this.failed();return;}}while(this.__ni<bi){this.setState(qx.io.remote.Exchange._nativeMap[++this.__ni]);}}),getReadyState:function(){var bj=null;try{bj=this.getRequest().readyState;}catch(bk){}return bj;},setRequestHeader:function(bl,bm){this.getRequestHeaders()[bl]=bm;},getResponseHeader:function(bn){var bo=null;try{bo=this.getRequest().getResponseHeader(bn)||null;}catch(bp){}return bo;},getStringResponseHeaders:function(){var br=null;try{var bq=this.getRequest().getAllResponseHeaders();if(bq){br=bq;}}catch(bs){}return br;},getResponseHeaders:function(){var bv=this.getStringResponseHeaders();var bw={};if(bv){var bt=bv.split(/[\r\n]+/g);for(var i=0,l=bt.length;i<l;i++){var bu=bt[i].match(/^([^:]+)\s*:\s*(.+)$/i);if(bu){bw[bu[1]]=bu[2];}}}return bw;},getStatusCode:function(){var bx=-1;try{bx=this.getRequest().status;}catch(by){}return bx;},getStatusText:function(){var bz=g;try{bz=this.getRequest().statusText;}catch(bA){}return bz;},getResponseText:function(){var bB=null;try{bB=this.getRequest().responseText;}catch(bC){bB=null;}return bB;},getResponseXml:function(){var bF=null;var bD=this.getStatusCode();var bE=this.getReadyState();if(qx.io.remote.Exchange.wasSuccessful(bD,bE,this.__nh)){try{bF=this.getRequest().responseXML;}catch(bG){}}if(typeof bF==y&&bF!=null){if(!bF.documentElement){var s=String(this.getRequest().responseText).replace(/<\?xml[^\?]*\?>/,g);bF.loadXML(s);}if(!bF.documentElement){throw new Error("Missing Document Element!");}if(bF.documentElement.tagName==w){throw new Error("XML-File is not well-formed!");}}else{throw new Error("Response was not a valid xml document ["+this.getRequest().responseText+"]");}return bF;},getFetchedLength:function(){var bH=this.getResponseText();return typeof bH==t?bH.length:0;},getResponseContent:function(){var bI=this.getState();if(bI!==k&&bI!=m){{};return null;}{};var bK=this.getResponseText();if(bI==m){{};return bK;}switch(this.getResponseType()){case E:case H:{};return bK;case I:{};try{if(bK&&bK.length>0){var bJ;if(this.getParseJson()){bJ=qx.util.Json.parse(bK,false);bJ=(bJ===0?0:(bJ||null));}else{bJ=bK;}return bJ;}else{return null;}}catch(bL){this.error("Could not execute json: ["+bK+"]",bL);return q+bK+r;}case D:{};try{if(bK&&bK.length>0){var bJ=window.eval(bK);return (bJ===0?0:(bJ||null));}else{return null;}}catch(bM){this.error("Could not execute javascript: ["+bK+"]",bM);return null;}case a:bK=this.getResponseXml();{};return (bK===0?0:(bK||null));default:this.warn("No valid responseType specified ("+this.getResponseType()+")!");return null;}},_applyState:function(bN,bO){{};switch(bN){case B:this.fireEvent(B);break;case c:this.fireEvent(c);break;case f:this.fireEvent(f);break;case F:this.fireEvent(F);break;case k:this.fireEvent(k);break;case m:this.fireEvent(m);break;case h:this.getRequest().abort();this.fireEvent(h);break;case b:this.getRequest().abort();this.fireEvent(b);break;}}},defer:function(){qx.io.remote.Exchange.registerType(qx.io.remote.transport.XmlHttp,J);},destruct:function(){var bP=this.getRequest();if(bP){bP.onreadystatechange=qx.lang.Function.empty;switch(bP.readyState){case 1:case 2:case 3:bP.abort();}}this.__nj=null;}});})();(function(){var c="Integer",b="Object",a="qx.io.remote.Response";qx.Class.define(a,{extend:qx.event.type.Event,properties:{state:{check:c,nullable:true},statusCode:{check:c,nullable:true},content:{nullable:true},responseHeaders:{check:b,nullable:true}},members:{clone:function(d){var e=qx.event.type.Event.prototype.clone.call(this,d);e.setType(this.getType());e.setState(this.getState());e.setStatusCode(this.getStatusCode());e.setContent(this.getContent());e.setResponseHeaders(this.getResponseHeaders());return e;},getResponseHeader:function(f){var g=this.getResponseHeaders();if(g){return g[f]||null;}return null;}}});})();(function(){var b="pane",a="qx.ui.container.Scroll";qx.Class.define(a,{extend:qx.ui.core.scroll.AbstractScrollArea,include:[qx.ui.core.MContentPadding],construct:function(content){qx.ui.core.scroll.AbstractScrollArea.call(this);if(content){this.add(content);}},members:{add:function(c){this.getChildControl(b).add(c);},remove:function(d){this.getChildControl(b).remove(d);},getChildren:function(){return this.getChildControl(b).getChildren();},_getContentPaddingTarget:function(){return this.getChildControl(b);}}});})();(function(){var k="legendview-label-important",j="Package/Class/Mixin/Interface is not fully documented",h="ICON_PROPERTY_PUB",g="Themeable Property",f="Child Control",e="ICON_CLASS_SINGLETON",d="Public Property",c="Private Method",b="Public Method",a="ICON_CHILDCONTROL",bd="string",bc="ICON_INTERFACE",bb='<span style="text-decoration: line-through;color: #7193b9;">deprecated</span>',ba="center",Y="ICON_EVENT",X="apiviewer.ui.LegendView",W="Singleton Class",V="Private Property",U="OVERLAY_WARN",T="ICON_PACKAGE",r="Method/Property/Event is inherited from one of the super classes",s="legend",p="ICON_PROPERTY_PRIV",q="middle",n="ICON_BLANK",o="__Tb",l="ICON_PROPERTY_PROT",m="ICON_CLASS_ABSTRACT",v="ICON_CLASS",w="ICON_PROPERTY_PUB_THEMEABLE",E="Protected Method",C="Constant",L="Method/Property/Event is not fully documented",G="OVERLAY_OVERRIDDEN",P="Abstract Class",N="OVERLAY_MIXIN",y="Class",S="Interface",R="ICON_METHOD_PUB",Q="Event",x="Mixin",A="Package",B="Protected Property",D="OVERLAY_ERROR",F="ICON_MIXIN",H="legendview-label",M="ICON_CLASS_STATIC",O="Method/Property overrides the Method/Property of the super class",t="ICON_METHOD_PRIV",u="Static Class",z="Method/Property is included from a mixin",K="ICON_METHOD_PROT",J="OVERLAY_INHERITED",I="ICON_CONSTANT";qx.Class.define(X,{extend:qx.ui.container.Scroll,construct:function(){qx.ui.container.Scroll.call(this);this.setAppearance(s);var be=new qx.ui.layout.Grid(10,10);be.setColumnWidth(1,150);be.setColumnFlex(1,1);var content=new qx.ui.container.Composite(be);this.__Tb=[{icon:T,desc:A},{icon:v,desc:y},{icon:M,desc:u},{icon:m,desc:P},{icon:e,desc:W},{icon:bc,desc:S},{icon:F,desc:x},{icon:a,desc:f},{icon:R,desc:b},{icon:K,desc:E},{icon:t,desc:c},{icon:h,desc:d},{icon:l,desc:B},{icon:p,desc:V},{icon:w,desc:g},{icon:Y,desc:Q},{icon:I,desc:C},{icon:n,desc:bb},{icon:U,desc:j},{icon:D,desc:L},{icon:N,desc:z},{icon:J,desc:r},{icon:G,desc:O}];var length=this.__Tb.length;var bg,bf;for(var i=0;i<length;i++){bg=this.__Tb[i];bf=apiviewer.TreeUtil.iconNameToIconPath(bg.icon);if(typeof (bf)!=bd){bf=bf[0];}content.add(new qx.ui.basic.Image(bf).set({alignX:ba,alignY:q}),{row:i,column:0});content.add(new qx.ui.basic.Label(bg.desc).set({rich:true,appearance:(i<17)?k:H}),{row:i,column:1});}this.add(content);},members:{__Tb:null},destruct:function(){this._disposeMap(o);}});})();(function(){var d="_applyDynamic",c="changeSelection",b="Boolean",a="qx.ui.container.Stack";qx.Class.define(a,{extend:qx.ui.core.Widget,implement:qx.ui.core.ISingleSelection,include:qx.ui.core.MSingleSelectionHandling,construct:function(){qx.ui.core.Widget.call(this);this._setLayout(new qx.ui.layout.Grow);this.addListener(c,this.__nu,this);},properties:{dynamic:{check:b,init:false,apply:d}},members:{_applyDynamic:function(f){var h=this._getChildren();var g=this.getSelection()[0];var j;for(var i=0,l=h.length;i<l;i++){j=h[i];if(j!=g){if(f){h[i].exclude();}else{h[i].hide();}}}},_getItems:function(){return this.getChildren();},_isAllowEmptySelection:function(){return true;},_isItemSelectable:function(k){return true;},__nu:function(e){var m=e.getOldData()[0];var n=e.getData()[0];if(m){if(this.isDynamic()){m.exclude();}else{m.hide();}}if(n){n.show();}},add:function(o){this._add(o);var p=this.getSelection()[0];if(!p){this.setSelection([o]);}else if(p!==o){if(this.isDynamic()){o.exclude();}else{o.hide();}}},remove:function(q){this._remove(q);if(this.getSelection()[0]===q){var r=this._getChildren()[0];if(r){this.setSelection([r]);}else{this.resetSelection();}}},indexOf:function(s){return this._indexOf(s);},getChildren:function(){return this._getChildren();},previous:function(){var v=this.getSelection()[0];var t=this._indexOf(v)-1;var w=this._getChildren();if(t<0){t=w.length-1;}var u=w[t];this.setSelection([u]);},next:function(){var y=this.getSelection()[0];var x=this._indexOf(y)+1;var z=this._getChildren();var A=z[x]||z[0];this.setSelection([A]);}}});})();(function(){var k="pressed",j="abandoned",i="hovered",h="Boolean",g="Space",f="undetermined",d="Enter",c="checked",b="mousedown",a="_applyTriState",w="mouseout",v="changeValue",u="keydown",t="_applyGroup",s="button",r="execute",q="qx.ui.form.RadioGroup",p="_applyValue",o="qx.ui.form.ToggleButton",n="mouseover",l="keyup",m="mouseup";qx.Class.define(o,{extend:qx.ui.basic.Atom,include:[qx.ui.core.MExecutable],implement:[qx.ui.form.IBooleanForm,qx.ui.form.IExecutable,qx.ui.form.IRadioItem],construct:function(x,y){qx.ui.basic.Atom.call(this,x,y);this.addListener(n,this._onMouseOver);this.addListener(w,this._onMouseOut);this.addListener(b,this._onMouseDown);this.addListener(m,this._onMouseUp);this.addListener(u,this._onKeyDown);this.addListener(l,this._onKeyUp);this.addListener(r,this._onExecute,this);},properties:{appearance:{refine:true,init:s},focusable:{refine:true,init:true},value:{check:h,nullable:true,event:v,apply:p,init:false},group:{check:q,nullable:true,apply:t},triState:{check:h,apply:a,nullable:true,init:null}},members:{_applyGroup:function(z,A){if(A){A.remove(this);}if(z){z.add(this);}},_applyValue:function(B,C){B?this.addState(c):this.removeState(c);if(this.isTriState()){if(B===null){this.addState(f);}else if(C===null){this.removeState(f);}}},_applyTriState:function(D,E){this._applyValue(this.getValue());},_onExecute:function(e){this.toggleValue();},_onMouseOver:function(e){if(e.getTarget()!==this){return;}this.addState(i);if(this.hasState(j)){this.removeState(j);this.addState(k);}},_onMouseOut:function(e){if(e.getTarget()!==this){return;}this.removeState(i);if(this.hasState(k)){if(!this.getValue()){this.removeState(k);}this.addState(j);}},_onMouseDown:function(e){if(!e.isLeftPressed()){return;}this.capture();this.removeState(j);this.addState(k);e.stopPropagation();},_onMouseUp:function(e){this.releaseCapture();if(this.hasState(j)){this.removeState(j);}else if(this.hasState(k)){this.execute();}this.removeState(k);e.stopPropagation();},_onKeyDown:function(e){switch(e.getKeyIdentifier()){case d:case g:this.removeState(j);this.addState(k);e.stopPropagation();}},_onKeyUp:function(e){if(!this.hasState(k)){return;}switch(e.getKeyIdentifier()){case d:case g:this.removeState(j);this.execute();this.removeState(k);e.stopPropagation();}}}});})();(function(){var e="inherit",d="toolbar-button",c="qx.ui.toolbar.CheckBox",b="keydown",a="keyup";qx.Class.define(c,{extend:qx.ui.form.ToggleButton,construct:function(f,g){qx.ui.form.ToggleButton.call(this,f,g);this.removeListener(b,this._onKeyDown);this.removeListener(a,this._onKeyUp);},properties:{appearance:{refine:true,init:d},show:{refine:true,init:e},focusable:{refine:true,init:false}}});})();(function(){var a="qx.ui.toolbar.RadioButton";qx.Class.define(a,{extend:qx.ui.toolbar.CheckBox,include:[qx.ui.form.MModelProperty],implement:[qx.ui.form.IModel,qx.ui.form.IRadioItem],members:{_applyValue:function(b,c){qx.ui.toolbar.CheckBox.prototype._applyValue.call(this,b,c);if(b){var d=this.getGroup();if(d){d.setSelection([this]);}}},_onExecute:function(e){var f=this.getGroup();if(f&&f.getAllowEmptySelection()||!f){this.toggleValue();}else{this.setValue(true);}}}});})();(function(){var e="arrow",d="qx.ui.toolbar.MenuButton",c="Boolean",b="_applyShowArrow",a="toolbar-menubutton";qx.Class.define(d,{extend:qx.ui.menubar.Button,properties:{appearance:{refine:true,init:a},showArrow:{check:c,init:false,themeable:true,apply:b}},members:{_createChildControlImpl:function(f,g){var h;switch(f){case e:h=new qx.ui.basic.Image();h.setAnonymous(true);this._addAt(h,10);break;}return h||qx.ui.menubar.Button.prototype._createChildControlImpl.call(this,f);},_applyShowArrow:function(i,j){if(i){this._showChildControl(e);}else{this._excludeChildControl(e);}}}});})();(function(){var j="checked",i="qx.ui.form.RadioGroup",h="Boolean",g="menu-radiobutton",f="_applyValue",d="qx.ui.menu.RadioButton",c="changeValue",b="_applyGroup",a="execute";qx.Class.define(d,{extend:qx.ui.menu.AbstractButton,include:[qx.ui.form.MModelProperty],implement:[qx.ui.form.IRadioItem,qx.ui.form.IBooleanForm,qx.ui.form.IModel],construct:function(k,l){qx.ui.menu.AbstractButton.call(this);if(k!=null){this.setLabel(k);}if(l!=null){this.setMenu(l);}this.addListener(a,this._onExecute,this);},properties:{appearance:{refine:true,init:g},value:{check:h,nullable:true,event:c,apply:f,init:false},group:{check:i,nullable:true,apply:b}},members:{_applyValue:function(m,n){m?this.addState(j):this.removeState(j);},_applyGroup:function(o,p){if(p){p.remove(this);}if(o){o.add(this);}},_onExecute:function(e){this.setValue(true);},_onMouseUp:function(e){if(e.isLeftPressed()){this.execute();}qx.ui.menu.Manager.getInstance().hideAll();},_onKeyPress:function(e){this.execute();}}});})();(function(){var x="pane",w="lastTab",v="page",u="bar",t="firstTab",s="right",r="button",q="bottom",p="left",o="close",f="top",n="changeSelection",j="tabview",c="vertical",b="horizontal",h="_applyBarPosition",g="beforeChangeSelection",k="__DQ",a="qx.ui.tabview.TabView",m="close-button",d="qx.event.type.Data";qx.Class.define(a,{extend:qx.ui.core.Widget,implement:qx.ui.core.ISingleSelection,include:[qx.ui.core.MContentPadding],construct:function(y){qx.ui.core.Widget.call(this);this.__DP={top:"barTop",right:"barRight",bottom:"barBottom",left:"barLeft"};this._createChildControl(u);this._createChildControl(x);var z=this.__DQ=new qx.ui.form.RadioGroup;z.setWrap(false);z.addListener(n,this._onChangeSelection,this);if(y!=null){this.setBarPosition(y);}else{this.initBarPosition();}},events:{"changeSelection":d},properties:{appearance:{refine:true,init:j},barPosition:{check:[p,s,f,q],init:f,apply:h}},members:{__DQ:null,_createChildControlImpl:function(A,B){var C;switch(A){case u:C=new qx.ui.container.SlideBar();C.setZIndex(10);this._add(C);break;case x:C=new qx.ui.container.Stack;C.setZIndex(5);this._add(C,{flex:1});break;}return C||qx.ui.core.Widget.prototype._createChildControlImpl.call(this,A);},_getContentPaddingTarget:function(){return this.getChildControl(x);},add:function(D){{};var E=D.getButton();var F=this.getChildControl(u);var H=this.getChildControl(x);D.exclude();F.add(E);H.add(D);this.__DQ.add(E);D.addState(this.__DP[this.getBarPosition()]);D.addState(w);var G=this.getChildren();if(G[0]==D){D.addState(t);}else{G[G.length-2].removeState(w);}D.addListener(o,this._onPageClose,this);},remove:function(I){var N=this.getChildControl(x);var L=this.getChildControl(u);var K=I.getButton();var M=N.getChildren();if(this.getSelection()[0]==I){var J=M.indexOf(I);if(J==0){if(M[1]){this.setSelection([M[1]]);}else{this.resetSelection();}}else{this.setSelection([M[J-1]]);}}L.remove(K);N.remove(I);this.__DQ.remove(K);I.removeState(this.__DP[this.getBarPosition()]);if(I.hasState(t)){I.removeState(t);if(M[0]){M[0].addState(t);}}if(I.hasState(w)){I.removeState(w);if(M.length>0){M[M.length-1].addState(w);}}I.removeListener(o,this._onPageClose,this);},getChildren:function(){return this.getChildControl(x).getChildren();},indexOf:function(O){return this.getChildControl(x).indexOf(O);},__DP:null,_applyBarPosition:function(P,Q){var R=this.getChildControl(u);var W=P==p||P==s;var U=P==s||P==q;var V=W?qx.ui.layout.HBox:qx.ui.layout.VBox;var Y=this._getLayout();if(Y&&Y instanceof V){}else{this._setLayout(Y=new V);}Y.setReversed(U);R.setOrientation(W?c:b);var X=this.getChildren();if(Q){var S=this.__DP[Q];R.removeState(S);for(var i=0,l=X.length;i<l;i++){X[i].removeState(S);}}if(P){var T=this.__DP[P];R.addState(T);for(var i=0,l=X.length;i<l;i++){X[i].addState(T);}}},getSelection:function(){var ba=this.__DQ.getSelection();var bb=[];for(var i=0;i<ba.length;i++){bb.push(ba[i].getUserData(v));}return bb;},setSelection:function(bc){var bd=[];for(var i=0;i<bc.length;i++){bd.push(bc[i].getChildControl(r));}this.__DQ.setSelection(bd);},resetSelection:function(){this.__DQ.resetSelection();},isSelected:function(be){var bf=be.getChildControl(r);return this.__DQ.isSelected(bf);},isSelectionEmpty:function(){return this.__DQ.isSelectionEmpty();},getSelectables:function(bg){var bh=this.__DQ.getSelectables(bg);var bi=[];for(var i=0;i<bh.length;i++){bi.push(bh[i].getUserData(v));}return bi;},_onChangeSelection:function(e){var bn=this.getChildControl(x);var bk=e.getData()[0];var bm=e.getOldData()[0];var bj=[];var bl=[];if(bk){bj=[bk.getUserData(v)];bn.setSelection(bj);bk.focus();this.scrollChildIntoView(bk,null,null,false);}else{bn.resetSelection();}if(bm){bl=[bm.getUserData(v)];}this.fireDataEvent(n,bj,bl);},_onBeforeChangeSelection:function(e){if(!this.fireNonBubblingEvent(g,qx.event.type.Event,[false,true])){e.preventDefault();}},_onRadioChangeSelection:function(e){var bo=e.getData()[0];if(bo){this.setSelection([bo.getUserData(v)]);}else{this.resetSelection();}},_onPageClose:function(e){var bq=e.getTarget();var bp=bq.getButton().getChildControl(m);bp.reset();this.remove(bq);}},destruct:function(){this._disposeObjects(k);this.__DP=null;}});})();(function(){var k="slider",j="splitter",i="horizontal",h="px",g="vertical",f="knob",d="mousedown",c="mouseout",b="Integer",a="height",D="mousemove",C="move",B="maxHeight",A="resize",z="width",w="_applyOrientation",v="_applyOffset",u="splitpane",t="qx.ui.splitpane.Pane",s="top",q="minHeight",r="mouseup",o="minWidth",p="appear",m="losecapture",n="left",l="maxWidth";qx.Class.define(t,{extend:qx.ui.core.Widget,construct:function(E){qx.ui.core.Widget.call(this);this.__mT=[];if(E){this.setOrientation(E);}else{this.initOrientation();}this.__nc.addListener(d,this._onMouseDown,this);this.__nc.addListener(r,this._onMouseUp,this);this.__nc.addListener(D,this._onMouseMove,this);this.__nc.addListener(c,this._onMouseOut,this);this.__nc.addListener(m,this._onMouseUp,this);},properties:{appearance:{refine:true,init:u},offset:{check:b,init:6,apply:v},orientation:{init:i,check:[i,g],apply:w}},members:{__mU:null,__mV:false,__mW:null,__mX:null,__mY:null,__na:null,__nb:null,__mT:null,__nc:null,_createChildControlImpl:function(F,G){var H;switch(F){case k:H=new qx.ui.splitpane.Slider(this);H.exclude();this._add(H,{type:F});break;case j:H=new qx.ui.splitpane.Splitter(this);this._add(H,{type:F});H.addListener(C,this.__nd,this);break;}return H||qx.ui.core.Widget.prototype._createChildControlImpl.call(this,F);},__nd:function(e){this.__nf(e.getData());},__ne:function(I){this.__nc=new qx.ui.splitpane.Blocker(I);this.getContentElement().add(this.__nc);var J=this.getChildControl(j);var K=J.getWidth();if(!K){J.addListenerOnce(p,function(){this.__nf();},this);}J.addListener(A,function(e){var L=e.getData();if(L.height==0||L.width==0){this.__nc.hide();}else{this.__nc.show();}},this);},getBlocker:function(){return this.__nc;},_applyOrientation:function(M,N){var O=this.getChildControl(k);var R=this.getChildControl(j);this.__mY=M===i;if(!this.__nc){this.__ne(M);}this.__nc.setOrientation(M);var Q=this._getLayout();if(Q){Q.dispose();}var P=M===g?new qx.ui.splitpane.VLayout:new qx.ui.splitpane.HLayout;this._setLayout(P);R.removeState(N);R.addState(M);R.getChildControl(f).removeState(N);R.getChildControl(f).addState(M);O.removeState(N);O.addState(M);qx.ui.core.queue.Manager.flush();this.__nf();},_applyOffset:function(S,T){this.__nf();},__nf:function(U){var V=this.getChildControl(j);var ba=this.getOffset();var bb=V.getBounds();var Y=V.getContainerElement().getDomElement();if(!Y){return;}if(this.__mY){var X=null;if(U){X=U.width;}else if(bb){X=bb.width;}var bc=U&&U.left;if(X){if(!bc){bc=qx.bom.element.Location.getPosition(Y).left;}this.__nc.setWidth(ba,X);this.__nc.setLeft(ba,bc);}}else{var W=null;if(U){W=U.height;}else if(bb){W=bb.height;}var top=U&&U.top;if(W){if(!top){top=qx.bom.element.Location.getPosition(Y).top;}this.__nc.setHeight(ba,W);this.__nc.setTop(ba,top);}}},add:function(bd,be){if(be==null){this._add(bd);}else{this._add(bd,{flex:be});}this.__mT.push(bd);},remove:function(bf){this._remove(bf);qx.lang.Array.remove(this.__mT,bf);},getChildren:function(){return this.__mT;},_onMouseDown:function(e){if(!e.isLeftPressed()){return;}var bg=this.getChildControl(j);var bi=bg.getContainerLocation();var bh=this.getContentLocation();this.__mU=this.__mY?e.getDocumentLeft()-bi.left+bh.left:e.getDocumentTop()-bi.top+bh.top;var bk=this.getChildControl(k);var bj=bg.getBounds();bk.setUserBounds(bj.left,bj.top,bj.width,bj.height);bk.setZIndex(bg.getZIndex()+1);bk.show();this.__mV=true;this.__nc.capture();e.stop();},_onMouseMove:function(e){this._setLastMousePosition(e.getDocumentLeft(),e.getDocumentTop());if(this.__mV){this.__ng();var bl=this.getChildControl(k);var bm=this.__na;if(this.__mY){bl.setDomLeft(bm);this.__nc.setStyle(n,(bm-this.getOffset())+h);}else{bl.setDomTop(bm);this.__nc.setStyle(s,(bm-this.getOffset())+h);}e.stop();}},_onMouseOut:function(e){this._setLastMousePosition(e.getDocumentLeft(),e.getDocumentTop());},_onMouseUp:function(e){if(!this.__mV){return;}this._finalizeSizes();var bn=this.getChildControl(k);bn.exclude();this.__mV=false;this.releaseCapture();e.stop();},_finalizeSizes:function(){var br=this.__na;var bo=this.__nb;if(br==null){return;}var bt=this._getChildren();var bs=bt[2];var bp=bt[3];var bq=bs.getLayoutProperties().flex;var bu=bp.getLayoutProperties().flex;if((bq!=0)&&(bu!=0)){bs.setLayoutProperties({flex:br});bp.setLayoutProperties({flex:bo});}else{if(this.__mY){bs.setWidth(br);bp.setWidth(bo);}else{bs.setHeight(br);bp.setHeight(bo);}}},__ng:function(){if(this.__mY){var bx=o,bE=z,by=l,bC=this.__mW;}else{var bx=q,bE=a,by=B,bC=this.__mX;}var bD=this._getChildren();var bv=bD[2].getSizeHint();var bA=bD[3].getSizeHint();var bB=bD[2].getBounds()[bE]+bD[3].getBounds()[bE];var bz=bC-this.__mU;var bw=bB-bz;if(bz<bv[bx]){bw-=bv[bx]-bz;bz=bv[bx];}else if(bw<bA[bx]){bz-=bA[bx]-bw;bw=bA[bx];}if(bz>bv[by]){bw+=bz-bv[by];bz=bv[by];}else if(bw>bA[by]){bz+=bw-bA[by];bw=bA[by];}this.__na=bz;this.__nb=bw;},_isActiveDragSession:function(){return this.__mV;},_setLastMousePosition:function(x,y){this.__mW=x;this.__mX=y;}},destruct:function(){this.__mT=null;}});})();(function(){var a="qx.ui.splitpane.Slider";qx.Class.define(a,{extend:qx.ui.core.Widget,properties:{allowShrinkX:{refine:true,init:false},allowShrinkY:{refine:true,init:false}}});})();(function(){var e="center",d="knob",c="middle",b="qx.ui.splitpane.Splitter",a="vertical";qx.Class.define(b,{extend:qx.ui.core.Widget,construct:function(f){qx.ui.core.Widget.call(this);if(f.getOrientation()==a){this._setLayout(new qx.ui.layout.HBox(0,e));this._getLayout().setAlignY(c);}else{this._setLayout(new qx.ui.layout.VBox(0,c));this._getLayout().setAlignX(e);}this._createChildControl(d);},properties:{allowShrinkX:{refine:true,init:false},allowShrinkY:{refine:true,init:false}},members:{_createChildControlImpl:function(g,h){var i;switch(g){case d:i=new qx.ui.basic.Image;this._add(i);break;}return i||qx.ui.core.Widget.prototype._createChildControlImpl.call(this,g);}}});})();(function(){var o="px",n="horizontal",m="top",l="height",k="width",j="left",i="100%",h="cursor",g="vertical",f="_applyOrientation",c="qx.ui.splitpane.Blocker",e="col-resize",d="row-resize",b="div",a="absolute";qx.Class.define(c,{extend:qx.html.Element,construct:function(p){var q={position:a,zIndex:11};qx.html.Element.call(this,b,q);if(p){this.setOrientation(p);}else{this.initOrientation();}},properties:{orientation:{init:n,check:[n,g],apply:f}},members:{_applyOrientation:function(r,s){if(r==n){this.setStyle(l,i);this.setStyle(h,e);this.setStyle(m,null);}else{this.setStyle(k,i);this.setStyle(j,null);this.setStyle(h,d);}},setWidth:function(t,u){var v=u+2*t;this.setStyle(k,v+o);},setHeight:function(w,x){var y=x+2*w;this.setStyle(l,y+o);},setLeft:function(z,A){var B=A-z;this.setStyle(j,B+o);},setTop:function(C,D){var top=D-C;this.setStyle(m,top+o);}}});})();(function(){var c="slider",b="splitter",a="qx.ui.splitpane.VLayout";qx.Class.define(a,{extend:qx.ui.layout.Abstract,members:{verifyLayoutProperty:null,renderLayout:function(d,e){var v=this._getLayoutChildren();var length=v.length;var r,u;var g,f,p,h;for(var i=0;i<length;i++){r=v[i];u=r.getLayoutProperties().type;if(u===b){f=r;}else if(u===c){p=r;}else if(!g){g=r;}else{h=r;}}if(g&&h){var x=g.getLayoutProperties().flex;var k=h.getLayoutProperties().flex;if(x==null){x=1;}if(k==null){k=1;}var w=g.getSizeHint();var n=f.getSizeHint();var o=h.getSizeHint();var j=w.height;var s=n.height;var t=o.height;if(x>0&&k>0){var l=x+k;var m=e-s;var j=Math.round((m/l)*x);var t=m-j;var q=qx.ui.layout.Util.arrangeIdeals(w.minHeight,j,w.maxHeight,o.minHeight,t,o.maxHeight);j=q.begin;t=q.end;}else if(x>0){j=e-s-t;if(j<w.minHeight){j=w.minHeight;}if(j>w.maxHeight){j=w.maxHeight;}}else if(k>0){t=e-j-s;if(t<o.minHeight){t=o.minHeight;}if(t>o.maxHeight){t=o.maxHeight;}}g.renderLayout(0,0,d,j);f.renderLayout(0,j,d,s);h.renderLayout(0,j+s,d,t);}else{f.renderLayout(0,0,0,0);if(g){g.renderLayout(0,0,d,e);}else if(h){h.renderLayout(0,0,d,e);}}},_computeSizeHint:function(){var H=this._getLayoutChildren();var length=H.length;var A,z,G;var B=0,D=0,C=0;var E=0,F=0,y=0;for(var i=0;i<length;i++){A=H[i];G=A.getLayoutProperties();if(G.type===c){continue;}z=A.getSizeHint();B+=z.minHeight;D+=z.height;C+=z.maxHeight;if(z.minWidth>E){E=z.minWidth;}if(z.width>F){F=z.width;}if(z.maxWidth>y){y=z.maxWidth;}}return {minHeight:B,height:D,maxHeight:C,minWidth:E,width:F,maxWidth:y};}}});})();(function(){var c="slider",b="splitter",a="qx.ui.splitpane.HLayout";qx.Class.define(a,{extend:qx.ui.layout.Abstract,members:{verifyLayoutProperty:null,renderLayout:function(d,e){var v=this._getLayoutChildren();var length=v.length;var s,u;var g,f,p,h;for(var i=0;i<length;i++){s=v[i];u=s.getLayoutProperties().type;if(u===b){f=s;}else if(u===c){p=s;}else if(!g){g=s;}else{h=s;}}if(g&&h){var x=g.getLayoutProperties().flex;var j=h.getLayoutProperties().flex;if(x==null){x=1;}if(j==null){j=1;}var w=g.getSizeHint();var m=f.getSizeHint();var o=h.getSizeHint();var t=w.width;var r=m.width;var q=o.width;if(x>0&&j>0){var k=x+j;var l=d-r;var t=Math.round((l/k)*x);var q=l-t;var n=qx.ui.layout.Util.arrangeIdeals(w.minWidth,t,w.maxWidth,o.minWidth,q,o.maxWidth);t=n.begin;q=n.end;}else if(x>0){t=d-r-q;if(t<w.minWidth){t=w.minWidth;}if(t>w.maxWidth){t=w.maxWidth;}}else if(j>0){q=d-t-r;if(q<o.minWidth){q=o.minWidth;}if(q>o.maxWidth){q=o.maxWidth;}}g.renderLayout(0,0,t,e);f.renderLayout(t,0,r,e);h.renderLayout(t+r,0,q,e);}else{f.renderLayout(0,0,0,0);if(g){g.renderLayout(0,0,d,e);}else if(h){h.renderLayout(0,0,d,e);}}},_computeSizeHint:function(){var H=this._getLayoutChildren();var length=H.length;var A,z,G;var E=0,F=0,y=0;var B=0,D=0,C=0;for(var i=0;i<length;i++){A=H[i];G=A.getLayoutProperties();if(G.type===c){continue;}z=A.getSizeHint();E+=z.minWidth;F+=z.width;y+=z.maxWidth;if(z.minHeight>B){B=z.minHeight;}if(z.height>D){D=z.height;}if(z.maxHeight>C){C=z.maxHeight;}}return {minWidth:E,width:F,maxWidth:y,minHeight:B,height:D,maxHeight:C};}}});})();(function(){var a="apiviewer.test.LayoutItem";qx.Class.define(a,{extend:qx.core.Object,members:{renderSeparator:function(b,c){}}});})();(function(){var p="other",o="widgets",n="fonts",m="appearances",k="qx.Theme",j="]",h="[Theme ",g="colors",f="decorations",e="Theme",b="meta",d="borders",c="icons";qx.Bootstrap.define(k,{statics:{define:function(name,q){if(!q){var q={};}q.include=this.__rg(q.include);q.patch=this.__rg(q.patch);{};var r={$$type:e,name:name,title:q.title,toString:this.genericToString};if(q.extend){r.supertheme=q.extend;}r.basename=qx.Bootstrap.createNamespace(name,r);this.__rj(r,q);this.__rh(r,q);this.$$registry[name]=r;for(var i=0,a=q.include,l=a.length;i<l;i++){this.include(r,a[i]);}for(var i=0,a=q.patch,l=a.length;i<l;i++){this.patch(r,a[i]);}},__rg:function(s){if(!s){return [];}if(qx.Bootstrap.isArray(s)){return s;}else{return [s];}},__rh:function(t,u){var v=u.aliases||{};if(u.extend&&u.extend.aliases){qx.Bootstrap.objectMergeWith(v,u.extend.aliases,false);}t.aliases=v;},getAll:function(){return this.$$registry;},getByName:function(name){return this.$$registry[name];},isDefined:function(name){return this.getByName(name)!==undefined;},getTotalNumber:function(){return qx.Bootstrap.objectGetLength(this.$$registry);},genericToString:function(){return h+this.name+j;},__ri:function(w){for(var i=0,x=this.__rk,l=x.length;i<l;i++){if(w[x[i]]){return x[i];}}},__rj:function(y,z){var C=this.__ri(z);if(z.extend&&!C){C=z.extend.type;}y.type=C||p;if(!C){return;}var E=function(){};if(z.extend){E.prototype=new z.extend.$$clazz;}var D=E.prototype;var B=z[C];for(var A in B){D[A]=B[A];if(D[A].base){{};D[A].base=z.extend;}}y.$$clazz=E;y[C]=new E;},$$registry:{},__rk:[g,d,f,n,c,o,m,b],__rl:null,__rm:null,__rn:function(){},patch:function(F,G){var I=this.__ri(G);if(I!==this.__ri(F)){throw new Error("The mixins '"+F.name+"' are not compatible '"+G.name+"'!");}var H=G[I];var J=F.$$clazz.prototype;for(var K in H){J[K]=H[K];}},include:function(L,M){var O=M.type;if(O!==L.type){throw new Error("The mixins '"+L.name+"' are not compatible '"+M.name+"'!");}var N=M[O];var P=L.$$clazz.prototype;for(var Q in N){if(P[Q]!==undefined){continue;}P[Q]=N[Q];}}}});})();(function(){var dN="button-frame",dM="atom",dL="widget",dK="main",dJ="button",dI="bold",dH="text-selected",dG="image",dF="middle",dE="selected",co="background-light",cn="cell",cm="text-disabled",cl="groupbox",ck="decoration/arrows/down.png",cj="label",ci="border-invalid",ch="input",cg="white",cf="input-disabled",dU="menu-button",dV="input-focused-invalid",dS="toolbar-button",dT="spinner",dQ="input-focused",dR="popup",dO="tooltip",dP="list",dW="tree-item",dX="treevirtual-contract",dk="scrollbar",dj="datechooser/nav-button",dm="text-hovered",dl="center",dp="treevirtual-expand",dn="textfield",dr="decoration/arrows/right.png",dq="background-application",di="radiobutton",dh="invalid",k="combobox",l="right-top",m="checkbox",n="text-title",o="icon/16/places/folder-open.png",p="qx/static/blank.gif",q="scrollbar/button",r="right",s="combobox/button",t="icon/16/places/folder.png",em="text-label",el="decoration/tree/closed.png",ek="scrollbar-slider-horizontal",ej="checkbox-checked",eq="decoration/arrows/left.png",ep="button-focused",eo="text-light",en="menu-slidebar-button",es="checkbox-undetermined",er="text-input",bm="slidebar/button-forward",bn="background-splitpane",bk=".png",bl="decoration/tree/open.png",bq="default",br="decoration/arrows/down-small.png",bo="datechooser",bp="slidebar/button-backward",bi="selectbox",bj="treevirtual-folder",N="shadow-popup",M="icon/16/mimetypes/office-document.png",P="background-medium",O="icon/32/places/folder-open.png",J="icon/22/places/folder-open.png",I="table",L="decoration/arrows/up.png",K="decoration/form/",H="",G="-invalid",bx="button-checked",by="decoration/window/maximize-active-hovered.png",bz="radiobutton-hovered",bA="keyboard-focus",bt="group-item",bu="decoration/cursors/",bv="slidebar",bw="tooltip-error-arrow",bB="table-scroller-focus-indicator",bC="move-frame",bb="nodrop",ba="decoration/table/boolean-true.png",Y="table-header-cell",X="menu",W="app-header",V="row-layer",U="text-inactive",T="move",bf="radiobutton-checked-focused",be="decoration/window/restore-active-hovered.png",bD="shadow-window",bE="table-column-button",bF="right.png",bG="checkbox-undetermined-hovered",bH="tabview-page-button-bottom-inactive",bI="tooltip-error",bJ="window-statusbar",bK="button-hovered",bL="decoration/scrollbar/scrollbar-",bM="background-tip",cw="scrollbar-slider-horizontal-disabled",cv="table-scroller-header",cu="button-pressed",ct="table-pane",cA="decoration/window/close-active.png",cz="native",cy="checkbox-hovered",cx="button-invalid-shadow",cE="decoration/window/minimize-active-hovered.png",cD="menubar",dc="icon/16/actions/dialog-cancel.png",dd="tabview-page-button-top-inactive",da="tabview-page-button-left-inactive",db="menu-slidebar",cX="toolbar-button-checked",cY="decoration/tree/open-selected.png",cV="radiobutton-checked",cW="decoration/window/minimize-inactive.png",de="icon/16/apps/office-calendar.png",df="group",dv="tabview-page-button-right-inactive",du="decoration/window/minimize-active.png",dx="decoration/window/restore-inactive.png",dw="checkbox-checked-focused",dz="splitpane",dy="combobox/textfield",dB="button-preselected-focused",dA="decoration/window/close-active-hovered.png",dt="qx/icon/Tango/16/actions/window-close.png",ds="checkbox-pressed",ef="button-disabled",eg="selected-dragover",eh="border-separator",ei="decoration/window/maximize-inactive.png",eb="dragover",ec="scrollarea",ed="scrollbar-vertical",ee="decoration/menu/checkbox-invert.gif",dY="decoration/toolbar/toolbar-handle-knob.gif",ea="icon/22/mimetypes/office-document.png",j="button-preselected",i="button-checked-focused",h="up.png",g="best-fit",f="decoration/tree/closed-selected.png",e="qx.theme.modern.Appearance",d="text-active",c="toolbar-button-hovered",b="progressive-table-header",a="decoration/table/select-column-order.png",w="decoration/menu/radiobutton.gif",x="decoration/arrows/forward.png",u="decoration/table/descending.png",v="progressbar",A="window-captionbar-active",B="checkbox-checked-hovered",y="scrollbar-slider-vertical",z="toolbar",D="alias",E="decoration/window/restore-active.png",cI="decoration/table/boolean-false.png",cC="icon/32/mimetypes/office-document.png",cP="radiobutton-checked-disabled",cL="tabview-pane",cr="decoration/arrows/rewind.png",cp="checkbox-focused",R="top",cs="icon/16/actions/dialog-ok.png",bd="radiobutton-checked-hovered",bc="table-header-cell-hovered",bW="window",bX="text-gray",bY="decoration/menu/radiobutton-invert.gif",ca="text-placeholder",cb="slider",cc="keep-align",cd="down.png",ce="tabview-page-button-top-active",bT="icon/22/places/folder.png",bU="decoration/window/maximize-active.png",cq="checkbox-checked-pressed",cO="decoration/window/close-inactive.png",cN="tabview-page-button-left-active",cM="toolbar-part",cT="decoration/splitpane/knob-vertical.png",cS=".gif",cR="radiobutton-checked-pressed",cQ="table-statusbar",cK="radiobutton-pressed",cJ="window-captionbar-inactive",C="copy",bh="radiobutton-focused",bg="decoration/arrows/down-invert.png",cB="decoration/menu/checkbox.gif",bs="decoration/splitpane/knob-horizontal.png",cH="icon/32/places/folder.png",cG="toolbar-separator",cF="tabview-page-button-bottom-active",Q="decoration/arrows/up-small.png",cU="decoration/table/ascending.png",F="decoration/arrows/up-invert.png",S="small",bN="tabview-page-button-right-active",bO="-disabled",bP="scrollbar-horizontal",bQ="checkbox-undetermined-focused",bR="progressive-table-header-cell",bS="menu-separator",dg="pane",bV="decoration/arrows/right-invert.png",dD="left.png",dC="icon/16/actions/view-refresh.png";qx.Theme.define(e,{appearances:{"widget":{},"root":{style:function(et){return {backgroundColor:dq,textColor:em,font:bq};}},"label":{style:function(eu){return {textColor:eu.disabled?cm:undefined};}},"move-frame":{style:function(ev){return {decorator:dK};}},"resize-frame":bC,"dragdrop-cursor":{style:function(ew){var ex=bb;if(ew.copy){ex=C;}else if(ew.move){ex=T;}else if(ew.alias){ex=D;}return {source:bu+ex+cS,position:l,offset:[2,16,2,6]};}},"image":{style:function(ey){return {opacity:!ey.replacement&&ey.disabled?0.3:1};}},"atom":{},"atom/label":cj,"atom/icon":dG,"popup":{style:function(ez){return {decorator:dK,backgroundColor:co,shadow:N};}},"button-frame":{alias:dM,style:function(eA){var eC,eB;if(eA.checked&&eA.focused&&!eA.inner){eC=i;eB=undefined;}else if(eA.disabled){eC=ef;eB=undefined;}else if(eA.pressed){eC=cu;eB=dm;}else if(eA.checked){eC=bx;eB=undefined;}else if(eA.hovered){eC=bK;eB=dm;}else if(eA.preselected&&eA.focused&&!eA.inner){eC=dB;eB=dm;}else if(eA.preselected){eC=j;eB=dm;}else if(eA.focused&&!eA.inner){eC=ep;eB=undefined;}else{eC=dJ;eB=undefined;}return {decorator:eC,textColor:eB,shadow:eA.invalid&&!eA.disabled?cx:undefined};}},"button-frame/image":{style:function(eD){return {opacity:!eD.replacement&&eD.disabled?0.5:1};}},"button":{alias:dN,include:dN,style:function(eE){return {padding:[2,8],center:true};}},"hover-button":{alias:dM,include:dM,style:function(eF){return {decorator:eF.hovered?dE:undefined,textColor:eF.hovered?dH:undefined};}},"splitbutton":{},"splitbutton/button":dJ,"splitbutton/arrow":{alias:dJ,include:dJ,style:function(eG){return {icon:ck,padding:2,marginLeft:1};}},"checkbox":{alias:dM,style:function(eH){var eJ;if(eH.checked){if(eH.disabled){eJ=ej;}else if(eH.focused){eJ=dw;}else if(eH.pressed){eJ=cq;}else if(eH.hovered){eJ=B;}else{eJ=ej;}}else if(eH.undetermined){if(eH.disabled){eJ=es;}else if(eH.focused){eJ=bQ;}else if(eH.hovered){eJ=bG;}else{eJ=es;}}else if(!eH.disabled){if(eH.focused){eJ=cp;}else if(eH.pressed){eJ=ds;}else if(eH.hovered){eJ=cy;}}eJ=eJ||m;var eI=eH.invalid&&!eH.disabled?G:H;return {icon:K+eJ+eI+bk,gap:6};}},"radiobutton":{alias:dM,style:function(eK){var eM;if(eK.checked&&eK.focused){eM=bf;}else if(eK.checked&&eK.disabled){eM=cP;}else if(eK.checked&&eK.pressed){eM=cR;}else if(eK.checked&&eK.hovered){eM=bd;}else if(eK.checked){eM=cV;}else if(eK.focused){eM=bh;}else if(eK.pressed){eM=cK;}else if(eK.hovered){eM=bz;}else{eM=di;}var eL=eK.invalid&&!eK.disabled?G:H;return {icon:K+eM+eL+bk,gap:6};}},"textfield":{style:function(eN){var eS;var eQ=!!eN.focused;var eR=!!eN.invalid;var eO=!!eN.disabled;if(eQ&&eR&&!eO){eS=dV;}else if(eQ&&!eR&&!eO){eS=dQ;}else if(eO){eS=cf;}else if(!eQ&&eR&&!eO){eS=ci;}else{eS=ch;}var eP;if(eN.disabled){eP=cm;}else if(eN.showingPlaceholder){eP=ca;}else{eP=er;}return {decorator:eS,padding:[2,4,1],textColor:eP};}},"textarea":{include:dn,style:function(eT){return {padding:4};}},"spinner":{style:function(eU){var eY;var eW=!!eU.focused;var eX=!!eU.invalid;var eV=!!eU.disabled;if(eW&&eX&&!eV){eY=dV;}else if(eW&&!eX&&!eV){eY=dQ;}else if(eV){eY=cf;}else if(!eW&&eX&&!eV){eY=ci;}else{eY=ch;}return {decorator:eY};}},"spinner/textfield":{style:function(fa){return {marginRight:2,padding:[2,4,1],textColor:fa.disabled?cm:er};}},"spinner/upbutton":{alias:dN,include:dN,style:function(fb){return {icon:Q,padding:fb.pressed?[2,2,0,4]:[1,3,1,3],shadow:undefined};}},"spinner/downbutton":{alias:dN,include:dN,style:function(fc){return {icon:br,padding:fc.pressed?[2,2,0,4]:[1,3,1,3],shadow:undefined};}},"datefield":k,"datefield/button":{alias:s,include:s,style:function(fd){return {icon:de,padding:[0,3],decorator:undefined};}},"datefield/textfield":dy,"datefield/list":{alias:bo,include:bo,style:function(fe){return {decorator:undefined};}},"groupbox":{style:function(ff){return {legendPosition:R};}},"groupbox/legend":{alias:dM,style:function(fg){return {padding:[1,0,1,4],textColor:fg.invalid?dh:n,font:dI};}},"groupbox/frame":{style:function(fh){return {padding:12,decorator:df};}},"check-groupbox":cl,"check-groupbox/legend":{alias:m,include:m,style:function(fi){return {padding:[1,0,1,4],textColor:fi.invalid?dh:n,font:dI};}},"radio-groupbox":cl,"radio-groupbox/legend":{alias:di,include:di,style:function(fj){return {padding:[1,0,1,4],textColor:fj.invalid?dh:n,font:dI};}},"scrollarea":{style:function(fk){return {minWidth:50,minHeight:50};}},"scrollarea/corner":{style:function(fl){return {backgroundColor:dq};}},"scrollarea/pane":dL,"scrollarea/scrollbar-x":dk,"scrollarea/scrollbar-y":dk,"scrollbar":{style:function(fm){if(fm[cz]){return {};}return {width:fm.horizontal?undefined:16,height:fm.horizontal?16:undefined,decorator:fm.horizontal?bP:ed,padding:1};}},"scrollbar/slider":{alias:cb,style:function(fn){return {padding:fn.horizontal?[0,1,0,1]:[1,0,1,0]};}},"scrollbar/slider/knob":{include:dN,style:function(fo){var fp=fo.horizontal?ek:y;if(fo.disabled){fp+=bO;}return {decorator:fp,minHeight:fo.horizontal?undefined:9,minWidth:fo.horizontal?9:undefined};}},"scrollbar/button":{alias:dN,include:dN,style:function(fq){var fr=bL;if(fq.left){fr+=dD;}else if(fq.right){fr+=bF;}else if(fq.up){fr+=h;}else{fr+=cd;}if(fq.left||fq.right){return {padding:[0,0,0,fq.left?3:4],icon:fr,width:15,height:14};}else{return {padding:[0,0,0,2],icon:fr,width:14,height:15};}}},"scrollbar/button-begin":q,"scrollbar/button-end":q,"slider":{style:function(fs){var fw;var fu=!!fs.focused;var fv=!!fs.invalid;var ft=!!fs.disabled;if(fu&&fv&&!ft){fw=dV;}else if(fu&&!fv&&!ft){fw=dQ;}else if(ft){fw=cf;}else if(!fu&&fv&&!ft){fw=ci;}else{fw=ch;}return {decorator:fw};}},"slider/knob":{include:dN,style:function(fx){return {decorator:fx.disabled?cw:ek,shadow:undefined,height:14,width:14};}},"list":{alias:ec,style:function(fy){var fC;var fA=!!fy.focused;var fB=!!fy.invalid;var fz=!!fy.disabled;if(fA&&fB&&!fz){fC=dV;}else if(fA&&!fB&&!fz){fC=dQ;}else if(fz){fC=cf;}else if(!fA&&fB&&!fz){fC=ci;}else{fC=ch;}return {backgroundColor:co,decorator:fC};}},"list/pane":dL,"listitem":{alias:dM,style:function(fD){var fE;if(fD.dragover){fE=fD.selected?eg:eb;}else{fE=fD.selected?dE:undefined;}return {padding:fD.dragover?[4,4,2,4]:4,textColor:fD.selected?dH:undefined,decorator:fE};}},"slidebar":{},"slidebar/scrollpane":{},"slidebar/content":{},"slidebar/button-forward":{alias:dN,include:dN,style:function(fF){return {padding:5,center:true,icon:fF.vertical?ck:dr};}},"slidebar/button-backward":{alias:dN,include:dN,style:function(fG){return {padding:5,center:true,icon:fG.vertical?L:eq};}},"tabview":{style:function(fH){return {contentPadding:16};}},"tabview/bar":{alias:bv,style:function(fI){var fJ={marginBottom:fI.barTop?-1:0,marginTop:fI.barBottom?-4:0,marginLeft:fI.barRight?-3:0,marginRight:fI.barLeft?-1:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0};if(fI.barTop||fI.barBottom){fJ.paddingLeft=5;fJ.paddingRight=7;}else{fJ.paddingTop=5;fJ.paddingBottom=7;}return fJ;}},"tabview/bar/button-forward":{include:bm,alias:bm,style:function(fK){if(fK.barTop||fK.barBottom){return {marginTop:2,marginBottom:2};}else{return {marginLeft:2,marginRight:2};}}},"tabview/bar/button-backward":{include:bp,alias:bp,style:function(fL){if(fL.barTop||fL.barBottom){return {marginTop:2,marginBottom:2};}else{return {marginLeft:2,marginRight:2};}}},"tabview/bar/scrollpane":{},"tabview/pane":{style:function(fM){return {decorator:cL,minHeight:100,marginBottom:fM.barBottom?-1:0,marginTop:fM.barTop?-1:0,marginLeft:fM.barLeft?-1:0,marginRight:fM.barRight?-1:0};}},"tabview-page":dL,"tabview-page/button":{alias:dM,style:function(fN){var fT,fP=0;var fS=0,fO=0,fQ=0,fR=0;if(fN.checked){if(fN.barTop){fT=ce;fP=[6,14];fQ=fN.firstTab?0:-5;fR=fN.lastTab?0:-5;}else if(fN.barBottom){fT=cF;fP=[6,14];fQ=fN.firstTab?0:-5;fR=fN.lastTab?0:-5;}else if(fN.barRight){fT=bN;fP=[6,13];fS=fN.firstTab?0:-5;fO=fN.lastTab?0:-5;}else{fT=cN;fP=[6,13];fS=fN.firstTab?0:-5;fO=fN.lastTab?0:-5;}}else{if(fN.barTop){fT=dd;fP=[4,10];fS=4;fQ=fN.firstTab?5:1;fR=1;}else if(fN.barBottom){fT=bH;fP=[4,10];fO=4;fQ=fN.firstTab?5:1;fR=1;}else if(fN.barRight){fT=dv;fP=[4,10];fR=5;fS=fN.firstTab?5:1;fO=1;fQ=1;}else{fT=da;fP=[4,10];fQ=5;fS=fN.firstTab?5:1;fO=1;fR=1;}}return {zIndex:fN.checked?10:5,decorator:fT,padding:fP,marginTop:fS,marginBottom:fO,marginLeft:fQ,marginRight:fR,textColor:fN.checked?d:U};}},"tabview-page/button/label":{alias:cj,style:function(fU){return {padding:[0,1,0,1],margin:fU.focused?0:1,decorator:fU.focused?bA:undefined};}},"tabview-page/button/close-button":{alias:dM,style:function(fV){return {icon:dt};}},"toolbar":{style:function(fW){return {decorator:z,spacing:2};}},"toolbar/part":{style:function(fX){return {decorator:cM,spacing:2};}},"toolbar/part/container":{style:function(fY){return {paddingLeft:2,paddingRight:2};}},"toolbar/part/handle":{style:function(ga){return {source:dY,marginLeft:3,marginRight:3};}},"toolbar-button":{alias:dM,style:function(gb){return {marginTop:2,marginBottom:2,padding:(gb.pressed||gb.checked||gb.hovered)&&!gb.disabled||(gb.disabled&&gb.checked)?3:5,decorator:gb.pressed||(gb.checked&&!gb.hovered)||(gb.checked&&gb.disabled)?cX:gb.hovered&&!gb.disabled?c:undefined};}},"toolbar-menubutton":{alias:dS,include:dS,style:function(gc){return {showArrow:true};}},"toolbar-menubutton/arrow":{alias:dG,include:dG,style:function(gd){return {source:br};}},"toolbar-splitbutton":{style:function(ge){return {marginTop:2,marginBottom:2};}},"toolbar-splitbutton/button":{alias:dS,include:dS,style:function(gf){return {icon:ck,marginTop:undefined,marginBottom:undefined};}},"toolbar-splitbutton/arrow":{alias:dS,include:dS,style:function(gg){if(gg.pressed||gg.checked||(gg.hovered&&!gg.disabled)){var gh=1;}else{var gh=3;}return {padding:gh,icon:ck,marginTop:undefined,marginBottom:undefined};}},"toolbar-separator":{style:function(gi){return {decorator:cG,margin:7};}},"tree":dP,"tree-item":{style:function(gj){return {padding:[2,6],textColor:gj.selected?dH:undefined,decorator:gj.selected?dE:undefined};}},"tree-item/icon":{include:dG,style:function(gk){return {paddingRight:5};}},"tree-item/label":cj,"tree-item/open":{include:dG,style:function(gl){var gm;if(gl.selected&&gl.opened){gm=cY;}else if(gl.selected&&!gl.opened){gm=f;}else if(gl.opened){gm=bl;}else{gm=el;}return {padding:[0,5,0,2],source:gm};}},"tree-folder":{include:dW,alias:dW,style:function(gn){var gp,go;if(gn.small){gp=gn.opened?o:t;go=o;}else if(gn.large){gp=gn.opened?O:cH;go=O;}else{gp=gn.opened?J:bT;go=J;}return {icon:gp,iconOpened:go};}},"tree-file":{include:dW,alias:dW,style:function(gq){return {icon:gq.small?M:gq.large?cC:ea};}},"treevirtual":I,"treevirtual-folder":{style:function(gr){return {icon:gr.opened?o:t};}},"treevirtual-file":{include:bj,alias:bj,style:function(gs){return {icon:M};}},"treevirtual-line":{style:function(gt){return {icon:p};}},"treevirtual-contract":{style:function(gu){return {icon:bl,paddingLeft:5,paddingTop:2};}},"treevirtual-expand":{style:function(gv){return {icon:el,paddingLeft:5,paddingTop:2};}},"treevirtual-only-contract":dX,"treevirtual-only-expand":dp,"treevirtual-start-contract":dX,"treevirtual-start-expand":dp,"treevirtual-end-contract":dX,"treevirtual-end-expand":dp,"treevirtual-cross-contract":dX,"treevirtual-cross-expand":dp,"treevirtual-end":{style:function(gw){return {icon:p};}},"treevirtual-cross":{style:function(gx){return {icon:p};}},"tooltip":{include:dR,style:function(gy){return {backgroundColor:bM,padding:[1,3,2,3],offset:[15,5,5,5]};}},"tooltip/atom":dM,"tooltip-error":{include:dO,style:function(gz){return {textColor:dH,placeMethod:dL,offset:[0,0,0,14],marginTop:-2,position:l,showTimeout:100,hideTimeout:10000,decorator:bI,shadow:bw,font:dI};}},"tooltip-error/atom":dM,"window":{style:function(gA){return {shadow:bD,contentPadding:[10,10,10,10]};}},"window/pane":{style:function(gB){return {decorator:bW};}},"window/captionbar":{style:function(gC){return {decorator:gC.active?A:cJ,textColor:gC.active?cg:bX,minHeight:26,paddingRight:2};}},"window/icon":{style:function(gD){return {margin:[5,0,3,6]};}},"window/title":{style:function(gE){return {alignY:dF,font:dI,marginLeft:6,marginRight:12};}},"window/minimize-button":{alias:dM,style:function(gF){return {icon:gF.active?gF.hovered?cE:du:cW,margin:[4,8,2,0]};}},"window/restore-button":{alias:dM,style:function(gG){return {icon:gG.active?gG.hovered?be:E:dx,margin:[5,8,2,0]};}},"window/maximize-button":{alias:dM,style:function(gH){return {icon:gH.active?gH.hovered?by:bU:ei,margin:[4,8,2,0]};}},"window/close-button":{alias:dM,style:function(gI){return {icon:gI.active?gI.hovered?dA:cA:cO,margin:[4,8,2,0]};}},"window/statusbar":{style:function(gJ){return {padding:[2,6],decorator:bJ,minHeight:18};}},"window/statusbar-text":{style:function(gK){return {font:S};}},"iframe":{style:function(gL){return {decorator:dK};}},"resizer":{style:function(gM){return {decorator:dg};}},"splitpane":{style:function(gN){return {decorator:dz};}},"splitpane/splitter":{style:function(gO){return {width:gO.horizontal?3:undefined,height:gO.vertical?3:undefined,backgroundColor:bn};}},"splitpane/splitter/knob":{style:function(gP){return {source:gP.horizontal?bs:cT};}},"splitpane/slider":{style:function(gQ){return {width:gQ.horizontal?3:undefined,height:gQ.vertical?3:undefined,backgroundColor:bn};}},"selectbox":{alias:dN,include:dN,style:function(gR){return {padding:[2,8]};}},"selectbox/atom":dM,"selectbox/popup":dR,"selectbox/list":{alias:dP},"selectbox/arrow":{include:dG,style:function(gS){return {source:ck,paddingLeft:5};}},"datechooser":{style:function(gT){var gX;var gV=!!gT.focused;var gW=!!gT.invalid;var gU=!!gT.disabled;if(gV&&gW&&!gU){gX=dV;}else if(gV&&!gW&&!gU){gX=dQ;}else if(gU){gX=cf;}else if(!gV&&gW&&!gU){gX=ci;}else{gX=ch;}return {padding:2,decorator:gX,backgroundColor:co};}},"datechooser/navigation-bar":{},"datechooser/nav-button":{include:dN,alias:dN,style:function(gY){var ha={padding:[2,4],shadow:undefined};if(gY.lastYear){ha.icon=cr;ha.marginRight=1;}else if(gY.lastMonth){ha.icon=eq;}else if(gY.nextYear){ha.icon=x;ha.marginLeft=1;}else if(gY.nextMonth){ha.icon=dr;}return ha;}},"datechooser/last-year-button-tooltip":dO,"datechooser/last-month-button-tooltip":dO,"datechooser/next-year-button-tooltip":dO,"datechooser/next-month-button-tooltip":dO,"datechooser/last-year-button":dj,"datechooser/last-month-button":dj,"datechooser/next-month-button":dj,"datechooser/next-year-button":dj,"datechooser/month-year-label":{style:function(hb){return {font:dI,textAlign:dl,textColor:hb.disabled?cm:undefined};}},"datechooser/date-pane":{style:function(hc){return {textColor:hc.disabled?cm:undefined,marginTop:2};}},"datechooser/weekday":{style:function(hd){return {textColor:hd.disabled?cm:hd.weekend?eo:undefined,textAlign:dl,paddingTop:2,backgroundColor:P};}},"datechooser/week":{style:function(he){return {textAlign:dl,padding:[2,4],backgroundColor:P};}},"datechooser/day":{style:function(hf){return {textAlign:dl,decorator:hf.disabled?undefined:hf.selected?dE:undefined,textColor:hf.disabled?cm:hf.selected?dH:hf.otherMonth?eo:undefined,font:hf.today?dI:undefined,padding:[2,4]};}},"combobox":{style:function(hg){var hk;var hi=!!hg.focused;var hj=!!hg.invalid;var hh=!!hg.disabled;if(hi&&hj&&!hh){hk=dV;}else if(hi&&!hj&&!hh){hk=dQ;}else if(hh){hk=cf;}else if(!hi&&hj&&!hh){hk=ci;}else{hk=ch;}return {decorator:hk};}},"combobox/popup":dR,"combobox/list":{alias:dP},"combobox/button":{include:dN,alias:dN,style:function(hl){var hm={icon:ck,padding:2};if(hl.selected){hm.decorator=ep;}return hm;}},"combobox/textfield":{include:dn,style:function(hn){return {decorator:undefined};}},"menu":{style:function(ho){var hp={decorator:X,shadow:N,spacingX:6,spacingY:1,iconColumnWidth:16,arrowColumnWidth:4,placementModeY:ho.submenu||ho.contextmenu?g:cc};if(ho.submenu){hp.position=l;hp.offset=[-2,-3];}return hp;}},"menu/slidebar":db,"menu-slidebar":dL,"menu-slidebar-button":{style:function(hq){return {decorator:hq.hovered?dE:undefined,padding:7,center:true};}},"menu-slidebar/button-backward":{include:en,style:function(hr){return {icon:hr.hovered?F:L};}},"menu-slidebar/button-forward":{include:en,style:function(hs){return {icon:hs.hovered?bg:ck};}},"menu-separator":{style:function(ht){return {height:0,decorator:bS,margin:[4,2]};}},"menu-button":{alias:dM,style:function(hu){return {decorator:hu.selected?dE:undefined,textColor:hu.selected?dH:undefined,padding:[4,6]};}},"menu-button/icon":{include:dG,style:function(hv){return {alignY:dF};}},"menu-button/label":{include:cj,style:function(hw){return {alignY:dF,padding:1};}},"menu-button/shortcut":{include:cj,style:function(hx){return {alignY:dF,marginLeft:14,padding:1};}},"menu-button/arrow":{include:dG,style:function(hy){return {source:hy.selected?bV:dr,alignY:dF};}},"menu-checkbox":{alias:dU,include:dU,style:function(hz){return {icon:!hz.checked?undefined:hz.selected?ee:cB};}},"menu-radiobutton":{alias:dU,include:dU,style:function(hA){return {icon:!hA.checked?undefined:hA.selected?bY:w};}},"menubar":{style:function(hB){return {decorator:cD};}},"menubar-button":{alias:dM,style:function(hC){return {decorator:(hC.pressed||hC.hovered)&&!hC.disabled?dE:undefined,textColor:hC.pressed||hC.hovered?dH:undefined,padding:[3,8]};}},"colorselector":dL,"colorselector/control-bar":dL,"colorselector/control-pane":dL,"colorselector/visual-pane":cl,"colorselector/preset-grid":dL,"colorselector/colorbucket":{style:function(hD){return {decorator:dK,width:16,height:16};}},"colorselector/preset-field-set":cl,"colorselector/input-field-set":cl,"colorselector/preview-field-set":cl,"colorselector/hex-field-composite":dL,"colorselector/hex-field":dn,"colorselector/rgb-spinner-composite":dL,"colorselector/rgb-spinner-red":dT,"colorselector/rgb-spinner-green":dT,"colorselector/rgb-spinner-blue":dT,"colorselector/hsb-spinner-composite":dL,"colorselector/hsb-spinner-hue":dT,"colorselector/hsb-spinner-saturation":dT,"colorselector/hsb-spinner-brightness":dT,"colorselector/preview-content-old":{style:function(hE){return {decorator:dK,width:50,height:10};}},"colorselector/preview-content-new":{style:function(hF){return {decorator:dK,backgroundColor:co,width:50,height:10};}},"colorselector/hue-saturation-field":{style:function(hG){return {decorator:dK,margin:5};}},"colorselector/brightness-field":{style:function(hH){return {decorator:dK,margin:[5,7]};}},"colorselector/hue-saturation-pane":dL,"colorselector/hue-saturation-handle":dL,"colorselector/brightness-pane":dL,"colorselector/brightness-handle":dL,"colorpopup":{alias:dR,include:dR,style:function(hI){return {padding:5,backgroundColor:dq};}},"colorpopup/field":{style:function(hJ){return {decorator:dK,margin:2,width:14,height:14,backgroundColor:co};}},"colorpopup/selector-button":dJ,"colorpopup/auto-button":dJ,"colorpopup/preview-pane":cl,"colorpopup/current-preview":{style:function(hK){return {height:20,padding:4,marginLeft:4,decorator:dK,allowGrowX:true};}},"colorpopup/selected-preview":{style:function(hL){return {height:20,padding:4,marginRight:4,decorator:dK,allowGrowX:true};}},"colorpopup/colorselector-okbutton":{alias:dJ,include:dJ,style:function(hM){return {icon:cs};}},"colorpopup/colorselector-cancelbutton":{alias:dJ,include:dJ,style:function(hN){return {icon:dc};}},"table":{alias:dL,style:function(hO){return {decorator:I};}},"table-header":{},"table/statusbar":{style:function(hP){return {decorator:cQ,padding:[0,2]};}},"table/column-button":{alias:dN,style:function(hQ){return {decorator:bE,padding:3,icon:a};}},"table-column-reset-button":{include:dU,alias:dU,style:function(){return {icon:dC};}},"table-scroller":dL,"table-scroller/scrollbar-x":dk,"table-scroller/scrollbar-y":dk,"table-scroller/header":{style:function(hR){return {decorator:cv};}},"table-scroller/pane":{style:function(hS){return {backgroundColor:ct};}},"table-scroller/focus-indicator":{style:function(hT){return {decorator:bB};}},"table-scroller/resize-line":{style:function(hU){return {backgroundColor:eh,width:2};}},"table-header-cell":{alias:dM,style:function(hV){return {minWidth:13,minHeight:20,padding:hV.hovered?[3,4,2,4]:[3,4],decorator:hV.hovered?bc:Y,sortIcon:hV.sorted?(hV.sortedAscending?cU:u):undefined};}},"table-header-cell/label":{style:function(hW){return {minWidth:0,alignY:dF,paddingRight:5};}},"table-header-cell/sort-icon":{style:function(hX){return {alignY:dF,alignX:r};}},"table-header-cell/icon":{style:function(hY){return {minWidth:0,alignY:dF,paddingRight:5};}},"table-editor-textfield":{include:dn,style:function(ia){return {decorator:undefined,padding:[2,2],backgroundColor:co};}},"table-editor-selectbox":{include:bi,alias:bi,style:function(ib){return {padding:[0,2],backgroundColor:co};}},"table-editor-combobox":{include:k,alias:k,style:function(ic){return {decorator:undefined,backgroundColor:co};}},"progressive-table-header":{alias:dL,style:function(id){return {decorator:b};}},"progressive-table-header-cell":{alias:dM,style:function(ie){return {minWidth:40,minHeight:25,paddingLeft:6,decorator:bR};}},"app-header":{style:function(ig){return {font:dI,textColor:dH,padding:[8,12],decorator:W};}},"virtual-list":dP,"virtual-list/row-layer":V,"row-layer":{style:function(ih){return {colorEven:cg,colorOdd:cg};}},"group-item":{include:cj,alias:cj,style:function(ii){return {padding:4,decorator:bt,textColor:cg,font:dI};}},"column-layer":dL,"cell":{style:function(ij){return {textColor:ij.selected?dH:em,padding:[3,6],font:bq};}},"cell-string":cn,"cell-number":{include:cn,style:function(ik){return {textAlign:r};}},"cell-image":cn,"cell-boolean":{include:cn,style:function(il){return {iconTrue:ba,iconFalse:cI};}},"cell-atom":cn,"cell-date":cn,"cell-html":cn,"htmlarea":{"include":dL,style:function(im){return {backgroundColor:cg};}},"progressbar":{style:function(io){return {decorator:v,padding:[1],backgroundColor:cg};}},"progressbar/progress":{style:function(ip){return {decorator:dE};}}}});})();(function(){var g="#134275",f="scrollarea",e="main",d="Theme for API Viewer",c="apiviewer.Appearance",b="white",a="bold";qx.Theme.define(c,{title:d,extend:qx.theme.modern.Appearance,appearances:{"toggleview":{style:function(h){return {width:240,decorator:e};}},"detailviewer":{style:function(i){return {backgroundColor:b,decorator:e};}},"legend":{include:f,alias:f,style:function(j){return {contentPadding:[10,10,10,10]};}},"legendview-label-important":{style:function(k){return {textColor:g,font:a};}},"legendview-label":{style:function(l){return {textColor:g};}},"tabview":{style:function(m){return {contentPadding:0};}},"tabview/pane":{style:function(n){return {minHeight:100,marginBottom:n.barBottom?-1:0,marginTop:n.barTop?-1:0,marginLeft:n.barLeft?-1:0,marginRight:n.barRight?-1:0};}}}});})();(function(){var a="apiviewer.test.Widget";qx.Class.define(a,{extend:apiviewer.test.LayoutItem,members:{renderSeparator:function(b,c){}}});})();(function(){var a="apiviewer.test.Methods";qx.Class.define(a,{extend:Object,members:{toString:function(){},valueOf:function(){},isPrototypeOf:function(){},hasOwnProperty:function(){},toLocaleString:function(){}}});})();(function(){var h="apiviewer.ClassLoader",g="(",f=")",e=".json",d="completed",c=".",b="/",a="failed";qx.Class.define(h,{extend:qx.core.Object,construct:function(j){qx.core.Object.call(this);this._baseUri=j;},members:{load:function(k,l,m,self){var n=this._baseUri+b+k+e;var o=new qx.io.remote.Request(n);var p=null;o.setAsynchronous(l);o.setTimeout(30000);o.setProhibitCaching(false);o.addListener(d,function(q){var content=eval(g+q.getContent()+f);var r=k.substring(0,k.lastIndexOf(c));var s=apiviewer.dao.Class.getClassByName(r);p=new apiviewer.dao.Class(content,s);s.addClass(p);this.__Tc(p,m,self);},this);o.addListener(a,function(t){alert("Couldn't load file: "+n);},this);o.send();return p;},__Tc:function(u,v,self){if(v){if(self){v.call(self,u);}else{v(u);}}},__Td:function(w,x,self){var z=[];var y=0;var A,i;for(i=0;i<w.length;i++){A=w[i];if(!A.isLoaded()){z.push(A);}}for(i=0;i<z.length;i++){this.load(z[i].getFullName(),true,function(B){y+=1;if(y==z.length){this.__Tc(apiviewer.dao.Class.getClassByName(w[0].getFullName()),x,self);}},this);}if(z.length==0){this.__Tc(w[0],x,self);}},classLoadDependendClasses:function(C,D,self){var E=C.getDependendClasses();this.__Td(E,D,self);},packageLoadDependendClasses:function(F,G,self){var H=F.getClasses();this.__Td(H,G,self);}}});})();(function(){var a="qx.application.IApplication";qx.Interface.define(a,{members:{main:function(){},finalize:function(){},close:function(){},terminate:function(){}}});})();(function(){var b="abstract",a="qx.application.AbstractGui";qx.Class.define(a,{type:b,extend:qx.core.Object,implement:[qx.application.IApplication],include:qx.locale.MTranslation,members:{__nv:null,_createRootWidget:function(){throw new Error("Abstract method call");},getRoot:function(){return this.__nv;},main:function(){qx.theme.manager.Meta.getInstance().initialize();qx.ui.tooltip.Manager.getInstance();this.__nv=this._createRootWidget();},finalize:function(){this.render();},render:function(){qx.ui.core.queue.Manager.flush();},close:function(c){},terminate:function(){}},destruct:function(){this.__nv=null;}});})();(function(){var a="qx.application.Standalone";qx.Class.define(a,{extend:qx.application.AbstractGui,members:{_createRootWidget:function(){return new qx.ui.root.Application(document);}}});})();(function(){var e="controller",d="script/apidata.json",c="apiviewer/css/apiviewer.css",b="apiviewer.Application",a="viewer";qx.Class.define(b,{extend:qx.application.Standalone,construct:function(){qx.application.Standalone.call(this);qx.bom.Stylesheet.includeFile(c);},members:{main:function(){qx.application.Standalone.prototype.main.call(this);{};qx.Class.include(qx.ui.core.Widget,apiviewer.MWidgetRegistry);this.viewer=new apiviewer.Viewer();this.controller=new apiviewer.Controller();this.getRoot().add(this.viewer,{edge:0});},finalize:function(){qx.application.Standalone.prototype.finalize.call(this);this.controller.load(d);}},destruct:function(){this._disposeObjects(a,e);}});})();(function(){var f="_applyTheme",e="qx.theme",d="qx.theme.manager.Meta",c="qx.theme.Modern",b="Theme",a="singleton";qx.Class.define(d,{type:a,extend:qx.core.Object,properties:{theme:{check:b,nullable:true,apply:f}},members:{_applyTheme:function(g,h){var k=null;var n=null;var q=null;var r=null;var m=null;if(g){k=g.meta.color||null;n=g.meta.decoration||null;q=g.meta.font||null;r=g.meta.icon||null;m=g.meta.appearance||null;}var o=qx.theme.manager.Color.getInstance();var p=qx.theme.manager.Decoration.getInstance();var i=qx.theme.manager.Font.getInstance();var l=qx.theme.manager.Icon.getInstance();var j=qx.theme.manager.Appearance.getInstance();o.setTheme(k);p.setTheme(n);i.setTheme(q);l.setTheme(r);j.setTheme(m);},initialize:function(){var t=qx.core.Setting;var s,u;s=t.get(e);if(s){u=qx.Theme.getByName(s);if(!u){throw new Error("The theme to use is not available: "+s);}this.setTheme(u);}}},settings:{"qx.theme":c}});})();(function(){var e="qx.theme.manager.Icon",d="Theme",c="changeTheme",b="_applyTheme",a="singleton";qx.Class.define(e,{type:a,extend:qx.core.Object,properties:{theme:{check:d,nullable:true,apply:b,event:c}},members:{_applyTheme:function(f,g){var i=qx.util.AliasManager.getInstance();if(g){for(var h in g.aliases){i.remove(h);}}if(f){for(var h in f.aliases){i.add(h,f.aliases[h]);}}}}});})();(function(){var p="Boolean",o="focusout",n="interval",m="mouseover",l="mouseout",k="mousemove",j="widget",i="qx.ui.tooltip.ToolTip",h="_applyCurrent",g="qx.ui.tooltip.Manager",c="__qV",f="__qS",d="tooltip-error",b="__qT",a="singleton";qx.Class.define(g,{type:a,extend:qx.core.Object,construct:function(){qx.core.Object.call(this);qx.event.Registration.addListener(document.body,m,this.__rd,this,true);this.__qS=new qx.event.Timer();this.__qS.addListener(n,this.__ra,this);this.__qT=new qx.event.Timer();this.__qT.addListener(n,this.__rb,this);this.__qU={left:0,top:0};},properties:{current:{check:i,nullable:true,apply:h},showInvalidToolTips:{check:p,init:true},showToolTips:{check:p,init:true}},members:{__qU:null,__qT:null,__qS:null,__qV:null,__qW:null,__qX:function(){if(!this.__qV){this.__qV=new qx.ui.tooltip.ToolTip().set({rich:true});}return this.__qV;},__qY:function(){if(!this.__qW){this.__qW=new qx.ui.tooltip.ToolTip().set({appearance:d});this.__qW.syncAppearance();}return this.__qW;},_applyCurrent:function(q,r){if(r&&qx.ui.core.Widget.contains(r,q)){return;}if(r){if(!r.isDisposed()){r.exclude();}this.__qS.stop();this.__qT.stop();}var t=qx.event.Registration;var s=document.body;if(q){this.__qS.startWith(q.getShowTimeout());t.addListener(s,l,this.__re,this,true);t.addListener(s,o,this.__rf,this,true);t.addListener(s,k,this.__rc,this,true);}else{t.removeListener(s,l,this.__re,this,true);t.removeListener(s,o,this.__rf,this,true);t.removeListener(s,k,this.__rc,this,true);}},__ra:function(e){var u=this.getCurrent();if(u&&!u.isDisposed()){this.__qT.startWith(u.getHideTimeout());if(u.getPlaceMethod()==j){u.placeToWidget(u.getOpener());}else{u.placeToPoint(this.__qU);}u.show();}this.__qS.stop();},__rb:function(e){var v=this.getCurrent();if(v&&!v.isDisposed()){v.exclude();}this.__qT.stop();this.resetCurrent();},__rc:function(e){var w=this.__qU;w.left=e.getDocumentLeft();w.top=e.getDocumentTop();},__rd:function(e){var z=qx.ui.core.Widget.getWidgetByElement(e.getTarget());if(!z){return;}var A,B,y,x;while(z!=null){A=z.getToolTip();B=z.getToolTipText()||null;y=z.getToolTipIcon()||null;if(qx.Class.hasInterface(z.constructor,qx.ui.form.IForm)&&!z.isValid()){x=z.getInvalidMessage();}if(A||B||y||x){break;}z=z.getLayoutParent();}if(!z||!z.getEnabled()||z.isBlockToolTip()||(!x&&!this.getShowToolTips())||(x&&!this.getShowInvalidToolTips())){return;}if(x){A=this.__qY().set({label:x});}if(!A){A=this.__qX().set({label:B,icon:y});}this.setCurrent(A);A.setOpener(z);},__re:function(e){var C=qx.ui.core.Widget.getWidgetByElement(e.getTarget());if(!C){return;}var D=qx.ui.core.Widget.getWidgetByElement(e.getRelatedTarget());if(!D){return;}var E=this.getCurrent();if(E&&(D==E||qx.ui.core.Widget.contains(E,D))){return;}if(D&&C&&qx.ui.core.Widget.contains(C,D)){return;}if(E&&!D){this.setCurrent(null);}else{this.resetCurrent();}},__rf:function(e){var F=qx.ui.core.Widget.getWidgetByElement(e.getTarget());if(!F){return;}var G=this.getCurrent();if(G&&G==F.getToolTip()){this.setCurrent(null);}}},destruct:function(){qx.event.Registration.removeListener(document.body,m,this.__rd,this,true);this._disposeObjects(f,b,c);this.__qU=null;}});})();(function(){var c="_applyId",b="String",a="apiviewer.MWidgetRegistry";qx.Mixin.define(a,{properties:{id:{check:b,apply:c,nullable:true,init:null}},members:{_applyId:function(d,e){var f=apiviewer.MWidgetRegistry;if(e){f.unregister(this,e);}if(d){f.register(this,d);}},getWidgetById:function(g){return apiviewer.MWidgetRegistry.getWidgetById(g);}},statics:{__Te:{},getWidgetById:function(h){return this.__Te[h];},register:function(i,j){if(this.__Te[j]){throw new Error("An object with the id '"+j+"' already exists.");}this.__Te[j]=i;},unregister:function(k,l){if(this.__Te[l]!==k){throw new Error("The object is not registered with the id '"+l+"'.");}delete (this.__Te[l]);}}});})();(function(){var k="value",j="nodeName",i="showPrivate",h="#",g="expandProperties",f="changeSelection",d="(",c="showInherited",b="showProtected",a="request",L="mousedown",K="btn_inherited",J=")",I="application",H="_detailLoader",G="aborted",F="_classLoader",E="btn_protected",D="detail_loader",C=" - ",r="btn_expand",s="$1#$2",p="package",q="tree",n="./script",o="btn_private",l="apiviewer.Controller",m="_tabViewController",t="completed",u="failed",x="$1~$2",w="API Documentation",z="file:",y="_history",B="_tree",A="itemName",v="classLinkClicked";qx.Class.define(l,{extend:qx.core.Object,construct:function(M){qx.core.Object.call(this);this._widgetRegistry=apiviewer.MWidgetRegistry;this._titlePrefix=w;document.title=this._titlePrefix;this._classLoader=new apiviewer.ClassLoader(n);this._detailLoader=this._widgetRegistry.getWidgetById(D);this._tabViewController=new apiviewer.TabViewController(this._widgetRegistry);this.__Tg();this._tree=this._widgetRegistry.getWidgetById(q);this.__Th();this.__Ti();this._history=qx.bom.History.getInstance();this.__Tj();qx.core.Init.getApplication().getRoot().addListener(L,function(e){this.__Tf=e.isShiftPressed()||e.isCtrlOrCommandPressed();},this,true);},members:{__Tf:false,$$logCategory:I,load:function(N){var P=new qx.io.remote.Request(N);P.setTimeout(180000);P.setProhibitCaching(false);P.addListener(t,function(R){var V=new Date();{};var content=R.getContent();var S=new Date();var T=eval(d+content+J);var U=new Date();{};qx.event.Timer.once(function(){this.__Tk(T);qx.event.Timer.once(function(){var W=this._history.getState();if(W){this.__Tl(this.__Tn(W));}else{var Y=this.__To(T);var X=Y.attributes.fullName;this.__Tl(X);}},this,0);},this,0);},this);var O=function(ba){this.error("Couldn't load file: "+N);if(window.location.protocol==z){alert("Failed to load API data from the file system.\n\n"+"The security settings of your browser may prohibit AJAX "+"when using the file protocol. Please try the http protocol "+"instead.");}};P.addListener(u,O,this);P.addListener(G,O,this);var Q=new Date();P.send();},__Tg:function(){this._tabViewController.addListener(v,function(bb){this._updateHistory(bb.getData());},this);this._tabViewController.addListener(f,function(bc){var be=bc.getData()[0];if(this._ignoreTabViewSelection==true){return;}if(be&&be.getUserData(j)){var bf=be.getUserData(j);var bd=be.getUserData(A);if(bd!=null){this._updateHistory(bf+h+bd);}else{this._updateHistory(bf);}}else{this._tree.resetSelection();}},this);},__Th:function(){this._tree.addListener(f,function(bg){var bh=bg.getData()[0];if(bh&&bh.getUserData(j)&&!this._ignoreTreeSelection){var bi=bh.getUserData(j);this._updateHistory(bi);}},this);},__Ti:function(){var bk=apiviewer.UiModel.getInstance();var bm=this._widgetRegistry.getWidgetById(K);bm.bind(k,bk,c);bk.bind(c,bm,k);var bj=this._widgetRegistry.getWidgetById(r);bj.bind(k,bk,g);bk.bind(g,bj,k);var bl=this._widgetRegistry.getWidgetById(E);bl.bind(k,bk,b);bk.bind(b,bl,k);var bn=this._widgetRegistry.getWidgetById(o);bn.bind(k,bk,i);bk.bind(i,bn,k);},__Tj:function(){this._history.addListener(a,function(bo){var bp=this.__Tn(bo.getData());if(bp){this.__Tl(bp);}},this);},__Tk:function(bq){var br=new Date();var bs=new apiviewer.dao.Package(bq);var bt=new Date();{};var br=new Date();this._tree.setTreeData(bs);var bt=new Date();{};return true;},_updateHistory:function(bu){var bv=bu+C+this._titlePrefix;qx.bom.History.getInstance().addToHistory(this.__Tm(bu),bv);},_selectClass:function(bw,bx,self){this._detailLoader.exclude();this._tabViewController.showTabView();var by=bx?qx.lang.Function.bind(bx,self):function(){};if(bw instanceof apiviewer.dao.Class){this._classLoader.classLoadDependendClasses(bw,function(bz){this._tabViewController.openClass(bz,this.__Tf);by();},this);}else{this._classLoader.packageLoadDependendClasses(bw,function(){this._tabViewController.openPackage(bw,this.__Tf);by();},this);}},__Tl:function(bA){var bD=bA;var bG=null;var bC=bA.indexOf(h);if(bC!=-1){bD=bA.substring(0,bC);bG=bA.substring(bC+1);var bE=bG.indexOf(d);if(bE!=-1){bG=qx.lang.String.trim(bG.substring(0,bE));}}this._ignoreTreeSelection=true;var bF=this._tree.selectTreeNodeByClassName(bD);this._ignoreTreeSelection=false;if(!bF){this.error("Unknown class: "+bD);alert("Unknown class: "+bD);return;}var bB=this._tree.getSelection()[0].getUserData(j)||bD;this._ignoreTabViewSelection=true;this._selectClass(apiviewer.dao.Class.getClassByName(bB),function(){if(bG){if(!this._tabViewController.showItem(bG)){this.error("Unknown item of class '"+bD+"': "+bG);alert("Unknown item of class '"+bD+"': "+bG);this._updateHistory(bD);this._ignoreTabViewSelection=false;return;}}this._updateHistory(bA);this._ignoreTabViewSelection=false;},this);},__Tm:function(bH){return bH.replace(/(.*)#(.*)/g,x);},__Tn:function(bI){return bI.replace(/(.*)~(.*)/g,s);},__To:function(bJ){if(bJ.type&&bJ.type==p){return bJ;}else{return this.__To(bJ.children[0]);}}},destruct:function(){this._widgetRegistry=null;this._disposeObjects(H,F,B,y,m);}});})();(function(){var m="",l='#',k="String",j="request",i="mshtml",h="changeTitle",g="abstract",f="_applyState",e="qx.client",d="changeState",a="qx.bom.History",c="_applyTitle",b="qx.event.type.Data";qx.Class.define(a,{extend:qx.core.Object,type:g,construct:function(){qx.core.Object.call(this);this._baseUrl=window.location.href.split(l)[0]+l;this.__vx={};this._setInitialState();},events:{"request":b},statics:{SUPPORTS_HASH_CHANGE_EVENT:(qx.bom.client.Engine.MSHTML&&document.documentMode>=8)||(!qx.bom.client.Engine.MSHTML&&document.documentMode&&"onhashchange" in window),getInstance:function(){if(!this.$$instance){if(this.SUPPORTS_HASH_CHANGE_EVENT){this.$$instance=new qx.bom.NativeHistory();}else if(qx.core.Variant.isSet(e,i)){this.$$instance=new qx.bom.IframeHistory();}else{this.$$instance=new qx.bom.NativeHistory();}}return this.$$instance;}},properties:{title:{check:k,event:h,nullable:true,apply:c},state:{check:k,event:d,nullable:true,apply:f}},members:{__vx:null,_applyState:function(n,o){this._writeState(n);},_setInitialState:function(){this.setState(this._readState());},_encode:function(p){if(qx.lang.Type.isString(p)){return encodeURIComponent(p);}return m;},_decode:function(q){if(qx.lang.Type.isString(q)){return decodeURIComponent(q);}return m;},_applyTitle:function(r){if(r!=null){document.title=r||m;}},addToHistory:function(s,t){if(!qx.lang.Type.isString(s)){s=s+m;}if(qx.lang.Type.isString(t)){this.setTitle(t);this.__vx[s]=t;}if(this.getState()!==s){this._writeState(s);}},navigateBack:function(){qx.event.Timer.once(function(){history.back();},0);},navigateForward:function(){qx.event.Timer.once(function(){history.forward();},0);},_onHistoryLoad:function(u){this.setState(u);this.fireDataEvent(j,u);if(this.__vx[u]!=null){this.setTitle(this.__vx[u]);}},_readState:function(){throw new Error("Abstract method call");},_writeState:function(){throw new Error("Abstract method call");},_setHash:function(v){var w=this._baseUrl+(v||m);var x=window.location;if(w!=x.href){x.href=w;}},_getHash:function(){var y=/#(.*)$/.exec(window.location.href);return y&&y[1]?y[1]:m;}},destruct:function(){this.__vx=null;}});})();(function(){var d="hashchange",c="interval",b="qx.bom.NativeHistory",a="qx.client";qx.Class.define(b,{extend:qx.bom.History,construct:function(){qx.bom.History.call(this);this.__vz();},members:{__vy:null,__vz:function(){if(qx.bom.History.SUPPORTS_HASH_CHANGE_EVENT){this.__vy=qx.lang.Function.bind(this.__vB,this);qx.bom.Event.addNativeListener(window,d,this.__vy);}else{qx.event.Idle.getInstance().addListener(c,this.__vB,this);}},__vA:function(){if(qx.bom.History.SUPPORTS_HASH_CHANGE_EVENT){qx.bom.Event.removeNativeListener(window,d,this.__vy);}else{qx.event.Idle.getInstance().removeListener(c,this.__vB,this);}},__vB:function(){var e=this._readState();if(qx.lang.Type.isString(e)&&e!=this.getState()){this._onHistoryLoad(e);}},_readState:function(){return this._decode(this._getHash());},_writeState:qx.core.Variant.select(a,{"opera":function(f){qx.event.Timer.once(function(){this._setHash(this._encode(f));},this,0);},"default":function(g){this._setHash(this._encode(g));}})},destruct:function(){this.__vA();}});})();(function(){var n="interval",m="-1000px",l="mshtml",k="",j="qx.bom.IframeHistory",i="qx/static/blank.html",h="state",g='<html><body><div id="state">',f='</div></body></html>',d="hidden",a="qx.client",c="undefined",b="absolute";if(qx.core.Variant.isSet(a,l)){qx.Class.define(j,{extend:qx.bom.History,construct:function(){qx.bom.History.call(this);this.__vF();},members:{__vC:null,__vD:false,__vE:null,_setInitialState:function(){qx.bom.History.prototype._setInitialState.call(this);this.__vE=this._getHash();},_setHash:function(o){qx.bom.History.prototype._setHash.call(this,o);this.__vE=this._encode(o);},_readState:function(){if(!this.__vD){return this._decode(this._getHash());}var p=this.__vC.contentWindow.document;var q=p.getElementById(h);return q?this._decode(q.innerText):k;},_writeState:function(r){var r=this._encode(r);this._setHash(r);this.__vE=r;try{var s=this.__vC.contentWindow.document;s.open();s.write(g+r+f);s.close();}catch(t){}},__vF:function(){this.__vJ(function(){qx.event.Idle.getInstance().addListener(n,this.__vG,this);});},__vG:function(e){var v=null;var u=this._getHash();if(!this.__vI(u)){v=this.__vH(u);}else{v=this._readState();}if(qx.lang.Type.isString(v)&&v!=this.getState()){this._onHistoryLoad(v);}},__vH:function(w){w=this._decode(w);this._writeState(w);return w;},__vI:function(x){return qx.lang.Type.isString(x)&&x==this.__vE;},__vJ:function(y){this.__vC=this.__vK();document.body.appendChild(this.__vC);this.__vL(function(){this._writeState(this.getState());if(y){y.call(this);}},this);},__vK:function(){var z=qx.bom.Iframe.create({src:qx.util.ResourceManager.getInstance().toUri(i)});z.style.visibility=d;z.style.position=b;z.style.left=m;z.style.top=m;return z;},__vL:function(A,B,C){if(typeof C===c){C=0;}if(!this.__vC.contentWindow||!this.__vC.contentWindow.document){if(C>20){throw new Error("can't initialize iframe");}qx.event.Timer.once(function(){this.__vL(A,B,++C);},this,10);return;}this.__vD=true;A.call(B||window);}},destruct:function(){this.__vC=null;qx.event.Idle.getInstance().addListener(n,this.__vG,this);}});}})();(function(){var n="Liberation Sans",m="Arial",l="Lucida Grande",k="sans-serif",j="Tahoma",i="Candara",h="Segoe UI",g="Consolas",f="Courier New",e="Monaco",b="monospace",d="Lucida Console",c="qx.theme.modern.Font",a="DejaVu Sans Mono";qx.Theme.define(c,{fonts:{"default":{size:(qx.bom.client.System.WINVISTA||qx.bom.client.System.WIN7)?12:11,lineHeight:1.4,family:qx.bom.client.Platform.MAC?[l]:(qx.bom.client.System.WINVISTA||qx.bom.client.System.WIN7)?[h,i]:[j,n,m,k]},"bold":{size:(qx.bom.client.System.WINVISTA||qx.bom.client.System.WIN7)?12:11,lineHeight:1.4,family:qx.bom.client.Platform.MAC?[l]:(qx.bom.client.System.WINVISTA||qx.bom.client.System.WIN7)?[h,i]:[j,n,m,k],bold:true},"small":{size:(qx.bom.client.System.WINVISTA||qx.bom.client.System.WIN7)?11:10,lineHeight:1.4,family:qx.bom.client.Platform.MAC?[l]:(qx.bom.client.System.WINVISTA||qx.bom.client.System.WIN7)?[h,i]:[j,n,m,k]},"monospace":{size:11,lineHeight:1.4,family:qx.bom.client.Platform.MAC?[d,e]:(qx.bom.client.System.WINVISTA||qx.bom.client.System.WIN7)?[g]:[g,a,f,b]}}});})();(function(){var c="Tango",b="qx/icon/Tango",a="qx.theme.icon.Tango";qx.Theme.define(a,{title:c,aliases:{"icon":b},icons:{}});})();(function(){var i="Number",h="_applyInsets",g="abstract",f="insetRight",e="insetTop",d="insetBottom",c="qx.ui.decoration.Abstract",b="shorthand",a="insetLeft";qx.Class.define(c,{extend:qx.core.Object,implement:[qx.ui.decoration.IDecorator],type:g,properties:{insetLeft:{check:i,nullable:true,apply:h},insetRight:{check:i,nullable:true,apply:h},insetBottom:{check:i,nullable:true,apply:h},insetTop:{check:i,nullable:true,apply:h},insets:{group:[e,f,d,a],mode:b}},members:{__oa:null,_getDefaultInsets:function(){throw new Error("Abstract method called.");},_isInitialized:function(){throw new Error("Abstract method called.");},_resetInsets:function(){this.__oa=null;},getInsets:function(){if(this.__oa){return this.__oa;}var j=this._getDefaultInsets();return this.__oa={left:this.getInsetLeft()==null?j.left:this.getInsetLeft(),right:this.getInsetRight()==null?j.right:this.getInsetRight(),bottom:this.getInsetBottom()==null?j.bottom:this.getInsetBottom(),top:this.getInsetTop()==null?j.top:this.getInsetTop()};},_applyInsets:function(){{};this.__oa=null;}},destruct:function(){this.__oa=null;}});})();(function(){var q="_applyBackground",p="repeat",o="mshtml",n="backgroundPositionX",m="",l="backgroundPositionY",k="no-repeat",j="scale",i=" ",h="repeat-x",c="qx.client",g="repeat-y",f="hidden",b="qx.ui.decoration.MBackgroundImage",a="String",e='"></div>',d='<div style="';qx.Mixin.define(b,{properties:{backgroundImage:{check:a,nullable:true,apply:q},backgroundRepeat:{check:[p,h,g,k,j],init:p,apply:q},backgroundPositionX:{nullable:true,apply:q},backgroundPositionY:{nullable:true,apply:q},backgroundPosition:{group:[l,n]}},members:{_generateBackgroundMarkup:function(r){var v=m;var u=this.getBackgroundImage();var t=this.getBackgroundRepeat();var top=this.getBackgroundPositionY();if(top==null){top=0;}var w=this.getBackgroundPositionX();if(w==null){w=0;}r.backgroundPosition=w+i+top;if(u){var s=qx.util.AliasManager.getInstance().resolve(u);v=qx.bom.element.Decoration.create(s,t,r);}else{if(r){if(qx.core.Variant.isSet(c,o)){if(qx.bom.client.Engine.VERSION<7||qx.bom.client.Feature.QUIRKS_MODE){r.overflow=f;}}v=d+qx.bom.element.Style.compile(r)+e;}}return v;},_applyBackground:function(){{};}}});})();(function(){var j="_applyStyle",i="solid",h="Color",g="",f="double",e="px",d="px ",c="dotted",b="_applyWidth",a="dashed",E="Number",D=" ",C="shorthand",B="widthTop",A="styleRight",z="styleLeft",y="widthLeft",x="widthBottom",w="styleTop",v="colorBottom",q="styleBottom",r="widthRight",o="colorLeft",p="colorRight",m="colorTop",n="border-top",k="border-left",l="border-right",s="qx.ui.decoration.Single",t="border-bottom",u="absolute";qx.Class.define(s,{extend:qx.ui.decoration.Abstract,include:[qx.ui.decoration.MBackgroundImage],construct:function(F,G,H){qx.ui.decoration.Abstract.call(this);if(F!=null){this.setWidth(F);}if(G!=null){this.setStyle(G);}if(H!=null){this.setColor(H);}},properties:{widthTop:{check:E,init:0,apply:b},widthRight:{check:E,init:0,apply:b},widthBottom:{check:E,init:0,apply:b},widthLeft:{check:E,init:0,apply:b},styleTop:{nullable:true,check:[i,c,a,f],init:i,apply:j},styleRight:{nullable:true,check:[i,c,a,f],init:i,apply:j},styleBottom:{nullable:true,check:[i,c,a,f],init:i,apply:j},styleLeft:{nullable:true,check:[i,c,a,f],init:i,apply:j},colorTop:{nullable:true,check:h,apply:j},colorRight:{nullable:true,check:h,apply:j},colorBottom:{nullable:true,check:h,apply:j},colorLeft:{nullable:true,check:h,apply:j},backgroundColor:{check:h,nullable:true,apply:j},left:{group:[y,z,o]},right:{group:[r,A,p]},top:{group:[B,w,m]},bottom:{group:[x,q,v]},width:{group:[B,r,x,y],mode:C},style:{group:[w,A,q,z],mode:C},color:{group:[m,p,v,o],mode:C}},members:{__pl:null,_getDefaultInsets:function(){return {top:this.getWidthTop(),right:this.getWidthRight(),bottom:this.getWidthBottom(),left:this.getWidthLeft()};},_isInitialized:function(){return !!this.__pl;},getMarkup:function(I){if(this.__pl){return this.__pl;}var J=qx.theme.manager.Color.getInstance();var K={};var M=this.getWidthTop();if(M>0){K[n]=M+d+this.getStyleTop()+D+(J.resolve(this.getColorTop())||g);}var M=this.getWidthRight();if(M>0){K[l]=M+d+this.getStyleRight()+D+(J.resolve(this.getColorRight())||g);}var M=this.getWidthBottom();if(M>0){K[t]=M+d+this.getStyleBottom()+D+(J.resolve(this.getColorBottom())||g);}var M=this.getWidthLeft();if(M>0){K[k]=M+d+this.getStyleLeft()+D+(J.resolve(this.getColorLeft())||g);}{};K.position=u;K.top=0;K.left=0;var L=this._generateBackgroundMarkup(K);return this.__pl=L;},resize:function(N,O,P){var Q=this.getInsets();O-=Q.left+Q.right;P-=Q.top+Q.bottom;if(O<0){O=0;}if(P<0){P=0;}N.style.width=O+e;N.style.height=P+e;N.style.left=(parseInt(N.style.left,10)+Q.left-this.getWidthLeft())+e;N.style.top=(parseInt(N.style.top,10)+Q.top-this.getWidthTop())+e;},tint:function(R,S){var T=qx.theme.manager.Color.getInstance();if(S==null){S=this.getBackgroundColor();}R.style.backgroundColor=T.resolve(S)||g;},_applyWidth:function(){{};this._resetInsets();},_applyStyle:function(){{};}},destruct:function(){this.__pl=null;}});})();(function(){var f="px",e="qx.ui.decoration.Background",d="",c="_applyStyle",b="Color",a="absolute";qx.Class.define(e,{extend:qx.ui.decoration.Abstract,include:[qx.ui.decoration.MBackgroundImage],construct:function(g){qx.ui.decoration.Abstract.call(this);if(g!=null){this.setBackgroundColor(g);}},properties:{backgroundColor:{check:b,nullable:true,apply:c}},members:{__oe:null,_getDefaultInsets:function(){return {top:0,right:0,bottom:0,left:0};},_isInitialized:function(){return !!this.__oe;},getMarkup:function(){if(this.__oe){return this.__oe;}var h={position:a,top:0,left:0};var i=this._generateBackgroundMarkup(h);return this.__oe=i;},resize:function(j,k,l){var m=this.getInsets();j.style.width=(k-m.left-m.right)+f;j.style.height=(l-m.top-m.bottom)+f;j.style.left=-m.left+f;j.style.top=-m.top+f;},tint:function(n,o){var p=qx.theme.manager.Color.getInstance();if(o==null){o=this.getBackgroundColor();}n.style.backgroundColor=p.resolve(o)||d;},_applyStyle:function(){{};}},destruct:function(){this.__oe=null;}});})();(function(){var j="_applyStyle",i='"></div>',h="Color",g="1px",f='<div style="',e='border:',d="1px solid ",c="",b=";",a="px",v='</div>',u="qx.ui.decoration.Beveled",t='<div style="position:absolute;top:1px;left:1px;',s='border-bottom:',r='border-right:',q='border-left:',p='border-top:',o="Number",n='<div style="position:absolute;top:1px;left:0px;',m='position:absolute;top:0px;left:1px;',k='<div style="overflow:hidden;font-size:0;line-height:0;">',l="absolute";qx.Class.define(u,{extend:qx.ui.decoration.Abstract,include:[qx.ui.decoration.MBackgroundImage],construct:function(w,x,y){qx.ui.decoration.Abstract.call(this);if(w!=null){this.setOuterColor(w);}if(x!=null){this.setInnerColor(x);}if(y!=null){this.setInnerOpacity(y);}},properties:{innerColor:{check:h,nullable:true,apply:j},innerOpacity:{check:o,init:1,apply:j},outerColor:{check:h,nullable:true,apply:j},backgroundColor:{check:h,nullable:true,apply:j}},members:{__ry:null,_getDefaultInsets:function(){return {top:2,right:2,bottom:2,left:2};},_isInitialized:function(){return !!this.__ry;},_applyStyle:function(){{};},getMarkup:function(){if(this.__ry){return this.__ry;}var z=qx.theme.manager.Color.getInstance();var A=[];var D=d+z.resolve(this.getOuterColor())+b;var C=d+z.resolve(this.getInnerColor())+b;A.push(k);A.push(f);A.push(e,D);A.push(qx.bom.element.Opacity.compile(0.35));A.push(i);A.push(n);A.push(q,D);A.push(r,D);A.push(qx.bom.element.Opacity.compile(1));A.push(i);A.push(f);A.push(m);A.push(p,D);A.push(s,D);A.push(qx.bom.element.Opacity.compile(1));A.push(i);var B={position:l,top:g,left:g,opacity:1};A.push(this._generateBackgroundMarkup(B));A.push(t);A.push(e,C);A.push(qx.bom.element.Opacity.compile(this.getInnerOpacity()));A.push(i);A.push(v);return this.__ry=A.join(c);},resize:function(E,F,G){if(F<4){F=4;}if(G<4){G=4;}if(qx.bom.client.Feature.CONTENT_BOX){var outerWidth=F-2;var outerHeight=G-2;var M=outerWidth;var L=outerHeight;var innerWidth=F-4;var innerHeight=G-4;}else{var outerWidth=F;var outerHeight=G;var M=F-2;var L=G-2;var innerWidth=M;var innerHeight=L;}var O=a;var K=E.childNodes[0].style;K.width=outerWidth+O;K.height=outerHeight+O;var J=E.childNodes[1].style;J.width=outerWidth+O;J.height=L+O;var I=E.childNodes[2].style;I.width=M+O;I.height=outerHeight+O;var H=E.childNodes[3].style;H.width=M+O;H.height=L+O;var N=E.childNodes[4].style;N.width=innerWidth+O;N.height=innerHeight+O;},tint:function(P,Q){var R=qx.theme.manager.Color.getInstance();if(Q==null){Q=this.getBackgroundColor();}P.childNodes[3].style.backgroundColor=R.resolve(Q)||c;}},destruct:function(){this.__ry=null;}});})();(function(){var o="_applyStyle",n="",m="Color",l="px",k="solid",j="dotted",i="double",h="dashed",g="_applyWidth",f="qx.ui.decoration.Uniform",c="px ",e=" ",d="scale",b="PositiveInteger",a="absolute";qx.Class.define(f,{extend:qx.ui.decoration.Abstract,include:[qx.ui.decoration.MBackgroundImage],construct:function(p,q,r){qx.ui.decoration.Abstract.call(this);if(p!=null){this.setWidth(p);}if(q!=null){this.setStyle(q);}if(r!=null){this.setColor(r);}},properties:{width:{check:b,init:0,apply:g},style:{nullable:true,check:[k,j,h,i],init:k,apply:o},color:{nullable:true,check:m,apply:o},backgroundColor:{check:m,nullable:true,apply:o}},members:{__rP:null,_getDefaultInsets:function(){var s=this.getWidth();return {top:s,right:s,bottom:s,left:s};},_isInitialized:function(){return !!this.__rP;},getMarkup:function(){if(this.__rP){return this.__rP;}var t={position:a,top:0,left:0};var u=this.getWidth();{};var w=qx.theme.manager.Color.getInstance();t.border=u+c+this.getStyle()+e+(w.resolve(this.getColor())||n);var v=this._generateBackgroundMarkup(t);return this.__rP=v;},resize:function(x,y,z){var B=this.getBackgroundImage()&&this.getBackgroundRepeat()==d;if(B||qx.bom.client.Feature.CONTENT_BOX){var A=this.getWidth()*2;y-=A;z-=A;if(y<0){y=0;}if(z<0){z=0;}}x.style.width=y+l;x.style.height=z+l;},tint:function(C,D){var E=qx.theme.manager.Color.getInstance();if(D==null){D=this.getBackgroundColor();}C.style.backgroundColor=E.resolve(D)||n;},_applyWidth:function(){{};this._resetInsets();},_applyStyle:function(){{};}},destruct:function(){this.__rP=null;}});})();(function(){var m="Number",l="_applyInsets",k="-l",j="insetRight",i="insetTop",h="_applyBaseImage",g="insetBottom",f="set",e="shorthand",d="-t",a="insetLeft",c="String",b="qx.ui.decoration.Grid";qx.Class.define(b,{extend:qx.core.Object,implement:[qx.ui.decoration.IDecorator],construct:function(n,o){qx.core.Object.call(this);if(qx.ui.decoration.css3.BorderImage.IS_SUPPORTED){this.__oA=new qx.ui.decoration.css3.BorderImage();if(n){this.__oB(n);}}else{this.__oA=new qx.ui.decoration.GridDiv(n);}if(o!=null){this.__oA.setInsets(o);}},properties:{baseImage:{check:c,nullable:true,apply:h},insetLeft:{check:m,nullable:true,apply:l},insetRight:{check:m,nullable:true,apply:l},insetBottom:{check:m,nullable:true,apply:l},insetTop:{check:m,nullable:true,apply:l},insets:{group:[i,j,g,a],mode:e}},members:{__oA:null,getMarkup:function(){return this.__oA.getMarkup();},resize:function(p,q,r){this.__oA.resize(p,q,r);},tint:function(s,t){},getInsets:function(){return this.__oA.getInsets();},_applyInsets:function(u,v,name){var w=f+qx.lang.String.firstUp(name);this.__oA[w](u);},_applyBaseImage:function(x,y){if(this.__oA instanceof qx.ui.decoration.GridDiv){this.__oA.setBaseImage(x);}else{this.__oB(x);}},__oB:function(z){var B,D;this.__oA.setBorderImage(z);var F=qx.util.AliasManager.getInstance().resolve(z);var G=/(.*)(\.[a-z]+)$/.exec(F);var C=G[1];var E=G[2];var A=qx.util.ResourceManager.getInstance();var H=A.getImageHeight(C+d+E);var I=A.getImageWidth(C+k+E);{};this.__oA.setSlice([H,I]);}},destruct:function(){this.__oA=null;}});})();(function(){var m="solid",l="scale",k="border-main",j="white",i="repeat-x",h="border-separator",g="background-light",f="invalid",e="border-focused-invalid",d="border-input",bt="border-disabled",bs="decoration/table/header-cell.png",br="decoration/form/input.png",bq="#f8f8f8",bp="decoration/scrollbar/scrollbar-button-bg-horizontal.png",bo="#b6b6b6",bn="background-pane",bm="repeat-y",bl="decoration/form/input-focused.png",bk="#33508D",t="decoration/selection.png",u="decoration/scrollbar/scrollbar-button-bg-vertical.png",r="decoration/tabview/tab-button-top-active.png",s="black",p="decoration/group-item.png",q="decoration/form/button-c.png",n="decoration/scrollbar/scrollbar-bg-vertical.png",o="decoration/form/button.png",B="decoration/form/button-checked.png",C="decoration/tabview/tab-button-left-inactive.png",O="decoration/groupbox/groupbox.png",K="#FAFAFA",W="decoration/pane/pane.png",R="dotted",bg="decoration/toolbar/toolbar-part.gif",bc="decoration/tabview/tab-button-top-inactive.png",G="decoration/menu/bar-background.png",bj="center",bi="decoration/tabview/tab-button-bottom-active.png",bh="decoration/form/button-hovered.png",F="decoration/form/tooltip-error-arrow.png",I="decoration/window/captionbar-inactive.png",J="qx/decoration/Modern",M="decoration/menu/background.png",P="decoration/window/statusbar.png",S="border-focused",Y="table-focus-indicator",be="#F2F2F2",v="decoration/form/button-checked-c.png",w="decoration/scrollbar/scrollbar-bg-horizontal.png",H="qx.theme.modern.Decoration",V="#f4f4f4",U="decoration/shadow/shadow-small.png",T="decoration/app-header.png",bb="decoration/tabview/tabview-pane.png",ba="decoration/form/tooltip-error.png",Q="decoration/form/button-focused.png",X="decoration/tabview/tab-button-bottom-inactive.png",a="decoration/form/button-disabled.png",bd="decoration/tabview/tab-button-right-active.png",x="decoration/form/button-pressed.png",y="no-repeat",L="decoration/window/captionbar-active.png",b="decoration/tabview/tab-button-left-active.png",c="background-splitpane",E="decoration/form/button-checked-focused.png",z="#C5C5C5",A="decoration/toolbar/toolbar-gradient.png",D="decoration/tabview/tab-button-right-inactive.png",N="#b8b8b8",bf="decoration/shadow/shadow.png";qx.Theme.define(H,{aliases:{decoration:J},decorations:{"main":{decorator:qx.ui.decoration.Uniform,style:{width:1,color:k}},"selected":{decorator:qx.ui.decoration.Background,style:{backgroundImage:t,backgroundRepeat:l}},"selected-dragover":{decorator:qx.ui.decoration.Single,style:{backgroundImage:t,backgroundRepeat:l,bottom:[2,m,bk]}},"dragover":{decorator:qx.ui.decoration.Single,style:{bottom:[2,m,bk]}},"pane":{decorator:qx.ui.decoration.Grid,style:{baseImage:W,insets:[0,2,3,0]}},"group":{decorator:qx.ui.decoration.Grid,style:{baseImage:O}},"border-invalid":{decorator:qx.ui.decoration.Beveled,style:{outerColor:f,innerColor:j,innerOpacity:0.5,backgroundImage:br,backgroundRepeat:i,backgroundColor:g}},"keyboard-focus":{decorator:qx.ui.decoration.Single,style:{width:1,color:s,style:R}},"separator-horizontal":{decorator:qx.ui.decoration.Single,style:{widthLeft:1,colorLeft:h}},"separator-vertical":{decorator:qx.ui.decoration.Single,style:{widthTop:1,colorTop:h}},"tooltip-error":{decorator:qx.ui.decoration.Grid,style:{baseImage:ba,insets:[2,5,5,2]}},"tooltip-error-arrow":{decorator:qx.ui.decoration.Background,style:{backgroundImage:F,backgroundPositionY:bj,backgroundRepeat:y,insets:[0,0,0,10]}},"shadow-window":{decorator:qx.ui.decoration.Grid,style:{baseImage:bf,insets:[4,8,8,4]}},"shadow-popup":{decorator:qx.ui.decoration.Grid,style:{baseImage:U,insets:[0,3,3,0]}},"scrollbar-horizontal":{decorator:qx.ui.decoration.Background,style:{backgroundImage:w,backgroundRepeat:i}},"scrollbar-vertical":{decorator:qx.ui.decoration.Background,style:{backgroundImage:n,backgroundRepeat:bm}},"scrollbar-slider-horizontal":{decorator:qx.ui.decoration.Beveled,style:{backgroundImage:bp,backgroundRepeat:l,outerColor:k,innerColor:j,innerOpacity:0.5}},"scrollbar-slider-horizontal-disabled":{decorator:qx.ui.decoration.Beveled,style:{backgroundImage:bp,backgroundRepeat:l,outerColor:bt,innerColor:j,innerOpacity:0.3}},"scrollbar-slider-vertical":{decorator:qx.ui.decoration.Beveled,style:{backgroundImage:u,backgroundRepeat:l,outerColor:k,innerColor:j,innerOpacity:0.5}},"scrollbar-slider-vertical-disabled":{decorator:qx.ui.decoration.Beveled,style:{backgroundImage:u,backgroundRepeat:l,outerColor:bt,innerColor:j,innerOpacity:0.3}},"button":{decorator:qx.ui.decoration.Grid,style:{baseImage:o,insets:2}},"button-disabled":{decorator:qx.ui.decoration.Grid,style:{baseImage:a,insets:2}},"button-focused":{decorator:qx.ui.decoration.Grid,style:{baseImage:Q,insets:2}},"button-hovered":{decorator:qx.ui.decoration.Grid,style:{baseImage:bh,insets:2}},"button-pressed":{decorator:qx.ui.decoration.Grid,style:{baseImage:x,insets:2}},"button-checked":{decorator:qx.ui.decoration.Grid,style:{baseImage:B,insets:2}},"button-checked-focused":{decorator:qx.ui.decoration.Grid,style:{baseImage:E,insets:2}},"button-invalid-shadow":{decorator:qx.ui.decoration.Beveled,style:{outerColor:f,innerColor:e,insets:[1]}},"checkbox-invalid-shadow":{decorator:qx.ui.decoration.Beveled,style:{outerColor:f,innerColor:e,insets:[0]}},"input":{decorator:qx.ui.decoration.Beveled,style:{outerColor:d,innerColor:j,innerOpacity:0.5,backgroundImage:br,backgroundRepeat:i,backgroundColor:g}},"input-focused":{decorator:qx.ui.decoration.Beveled,style:{outerColor:d,innerColor:S,backgroundImage:bl,backgroundRepeat:i,backgroundColor:g}},"input-focused-invalid":{decorator:qx.ui.decoration.Beveled,style:{outerColor:f,innerColor:e,backgroundImage:bl,backgroundRepeat:i,backgroundColor:g,insets:[2]}},"input-disabled":{decorator:qx.ui.decoration.Beveled,style:{outerColor:bt,innerColor:j,innerOpacity:0.5,backgroundImage:br,backgroundRepeat:i,backgroundColor:g}},"toolbar":{decorator:qx.ui.decoration.Background,style:{backgroundImage:A,backgroundRepeat:l}},"toolbar-button-hovered":{decorator:qx.ui.decoration.Beveled,style:{outerColor:bo,innerColor:bq,backgroundImage:q,backgroundRepeat:l}},"toolbar-button-checked":{decorator:qx.ui.decoration.Beveled,style:{outerColor:bo,innerColor:bq,backgroundImage:v,backgroundRepeat:l}},"toolbar-separator":{decorator:qx.ui.decoration.Single,style:{widthLeft:1,widthRight:1,colorLeft:N,colorRight:V,styleLeft:m,styleRight:m}},"toolbar-part":{decorator:qx.ui.decoration.Background,style:{backgroundImage:bg,backgroundRepeat:bm}},"tabview-pane":{decorator:qx.ui.decoration.Grid,style:{baseImage:bb,insets:[4,6,7,4]}},"tabview-page-button-top-active":{decorator:qx.ui.decoration.Grid,style:{baseImage:r}},"tabview-page-button-top-inactive":{decorator:qx.ui.decoration.Grid,style:{baseImage:bc}},"tabview-page-button-bottom-active":{decorator:qx.ui.decoration.Grid,style:{baseImage:bi}},"tabview-page-button-bottom-inactive":{decorator:qx.ui.decoration.Grid,style:{baseImage:X}},"tabview-page-button-left-active":{decorator:qx.ui.decoration.Grid,style:{baseImage:b}},"tabview-page-button-left-inactive":{decorator:qx.ui.decoration.Grid,style:{baseImage:C}},"tabview-page-button-right-active":{decorator:qx.ui.decoration.Grid,style:{baseImage:bd}},"tabview-page-button-right-inactive":{decorator:qx.ui.decoration.Grid,style:{baseImage:D}},"splitpane":{decorator:qx.ui.decoration.Uniform,style:{backgroundColor:bn,width:3,color:c,style:m}},"window":{decorator:qx.ui.decoration.Single,style:{backgroundColor:bn,width:1,color:k,widthTop:0}},"window-captionbar-active":{decorator:qx.ui.decoration.Grid,style:{baseImage:L}},"window-captionbar-inactive":{decorator:qx.ui.decoration.Grid,style:{baseImage:I}},"window-statusbar":{decorator:qx.ui.decoration.Grid,style:{baseImage:P}},"table":{decorator:qx.ui.decoration.Single,style:{width:1,color:k,style:m}},"table-statusbar":{decorator:qx.ui.decoration.Single,style:{widthTop:1,colorTop:k,style:m}},"table-scroller-header":{decorator:qx.ui.decoration.Single,style:{backgroundImage:bs,backgroundRepeat:l,widthBottom:1,colorBottom:k,style:m}},"table-header-cell":{decorator:qx.ui.decoration.Single,style:{widthRight:1,colorRight:h,styleRight:m}},"table-header-cell-hovered":{decorator:qx.ui.decoration.Single,style:{widthRight:1,colorRight:h,styleRight:m,widthBottom:1,colorBottom:j,styleBottom:m}},"table-column-button":{decorator:qx.ui.decoration.Single,style:{backgroundImage:bs,backgroundRepeat:l,widthBottom:1,colorBottom:k,style:m}},"table-scroller-focus-indicator":{decorator:qx.ui.decoration.Single,style:{width:2,color:Y,style:m}},"progressive-table-header":{decorator:qx.ui.decoration.Single,style:{width:1,color:k,style:m}},"progressive-table-header-cell":{decorator:qx.ui.decoration.Single,style:{backgroundImage:bs,backgroundRepeat:l,widthRight:1,colorRight:be,style:m}},"menu":{decorator:qx.ui.decoration.Single,style:{backgroundImage:M,backgroundRepeat:l,width:1,color:k,style:m}},"menu-separator":{decorator:qx.ui.decoration.Single,style:{widthTop:1,colorTop:z,widthBottom:1,colorBottom:K}},"menubar":{decorator:qx.ui.decoration.Single,style:{backgroundImage:G,backgroundRepeat:l,width:1,color:h,style:m}},"app-header":{decorator:qx.ui.decoration.Background,style:{backgroundImage:T,backgroundRepeat:l}},"progressbar":{decorator:qx.ui.decoration.Single,style:{width:1,color:d}},"group-item":{decorator:qx.ui.decoration.Background,style:{backgroundImage:p,backgroundRepeat:l}}}});})();(function(){var j="#CCCCCC",i="#F3F3F3",h="#E4E4E4",g="#1a1a1a",f="#084FAB",e="gray",d="#fffefe",c="white",b="#4a4a4a",a="#EEEEEE",K="#80B4EF",J="#C72B2B",I="#ffffdd",H="#334866",G="#00204D",F="#666666",E="#CBC8CD",D="#99C3FE",C="#808080",B="#F4F4F4",q="#001533",r="#909090",o="#FCFCFC",p="#314a6e",m="#B6B6B6",n="#0880EF",k="#4d4d4d",l="#DFDFDF",s="#000000",t="#FF9999",w="#7B7A7E",v="#26364D",y="#990000",x="#AFAFAF",A="#404955",z="#AAAAAA",u="qx.theme.modern.Color";qx.Theme.define(u,{colors:{"background-application":l,"background-pane":i,"background-light":o,"background-medium":a,"background-splitpane":x,"background-tip":I,"background-tip-error":J,"background-odd":h,"text-light":r,"text-gray":b,"text-label":g,"text-title":p,"text-input":s,"text-hovered":q,"text-disabled":w,"text-selected":d,"text-active":v,"text-inactive":A,"text-placeholder":E,"border-main":k,"border-separator":C,"border-input":H,"border-disabled":m,"border-pane":G,"border-button":F,"border-column":j,"border-focused":D,"invalid":y,"border-focused-invalid":t,"table-pane":i,"table-focus-indicator":n,"table-row-background-focused-selected":f,"table-row-background-focused":K,"table-row-background-selected":f,"table-row-background-even":i,"table-row-background-odd":h,"table-row-selected":d,"table-row":g,"table-row-line":j,"table-column-line":j,"progressive-table-header":z,"progressive-table-row-background-even":B,"progressive-table-row-background-odd":h,"progressive-progressbar-background":e,"progressive-progressbar-indicator-done":j,"progressive-progressbar-indicator-undone":c,"progressive-progressbar-percent-background":e,"progressive-progressbar-percent-text":c}});})();(function(){var b="apiviewer.Theme",a="APIViewer theme";qx.Theme.define(b,{title:a,meta:{color:qx.theme.modern.Color,decoration:qx.theme.modern.Decoration,font:qx.theme.modern.Font,appearance:apiviewer.Appearance,icon:qx.theme.icon.Tango}});})();(function(){var j="_applyStyle",i="stretch",h="Integer",g="px",f=" ",e="repeat",d="round",c="shorthand",b="px ",a="sliceBottom",y=";'></div>",x="<div style='",w="sliceLeft",v="sliceRight",u="repeatX",t="String",s="qx.ui.decoration.css3.BorderImage",r="border-box",q="",p='") ',n="sliceTop",o='url("',l="hidden",m="repeatY",k="absolute";qx.Class.define(s,{extend:qx.ui.decoration.Abstract,construct:function(z,A){qx.ui.decoration.Abstract.call(this);if(z!=null){this.setBorderImage(z);}if(A!=null){this.setSlice(A);}},statics:{IS_SUPPORTED:qx.bom.element.Style.isPropertySupported("borderImage")},properties:{borderImage:{check:t,nullable:true,apply:j},sliceTop:{check:h,init:0,apply:j},sliceRight:{check:h,init:0,apply:j},sliceBottom:{check:h,init:0,apply:j},sliceLeft:{check:h,init:0,apply:j},slice:{group:[n,v,a,w],mode:c},repeatX:{check:[i,e,d],init:i,apply:j},repeatY:{check:[i,e,d],init:i,apply:j},repeat:{group:[u,m],mode:c}},members:{__nw:null,_getDefaultInsets:function(){return {top:0,right:0,bottom:0,left:0};},_isInitialized:function(){return !!this.__nw;},getMarkup:function(){if(this.__nw){return this.__nw;}var B=this._resolveImageUrl(this.getBorderImage());var C=[this.getSliceTop(),this.getSliceRight(),this.getSliceBottom(),this.getSliceLeft()];var D=[this.getRepeatX(),this.getRepeatY()].join(f);this.__nw=[x,qx.bom.element.Style.compile({"borderImage":o+B+p+C.join(f)+f+D,position:k,lineHeight:0,fontSize:0,overflow:l,boxSizing:r,borderWidth:C.join(b)+g}),y].join(q);return this.__nw;},resize:function(E,F,G){E.style.width=F+g;E.style.height=G+g;},tint:function(H,I){},_applyStyle:function(){{};},_resolveImageUrl:function(J){return qx.util.ResourceManager.getInstance().toUri(qx.util.AliasManager.getInstance().resolve(J));}},destruct:function(){this.__nw=null;}});})();(function(){var j="px",i="0px",h="-1px",g="no-repeat",f="scale-x",e="scale-y",d="-tr",c="-l",b='</div>',a="scale",x="qx.client",w="-br",v="-t",u="-tl",t="-r",s='<div style="position:absolute;top:0;left:0;overflow:hidden;font-size:0;line-height:0;">',r="_applyBaseImage",q="-b",p="String",o="",m="-bl",n="qx.ui.decoration.GridDiv",k="-c",l="mshtml";qx.Class.define(n,{extend:qx.ui.decoration.Abstract,construct:function(y,z){qx.ui.decoration.Abstract.call(this);if(y!=null){this.setBaseImage(y);}if(z!=null){this.setInsets(z);}},properties:{baseImage:{check:p,nullable:true,apply:r}},members:{__nx:null,__ny:null,__nz:null,_getDefaultInsets:function(){return {top:0,right:0,bottom:0,left:0};},_isInitialized:function(){return !!this.__nx;},getMarkup:function(){if(this.__nx){return this.__nx;}var A=qx.bom.element.Decoration;var B=this.__ny;var C=this.__nz;var D=[];D.push(s);D.push(A.create(B.tl,g,{top:0,left:0}));D.push(A.create(B.t,f,{top:0,left:C.left+j}));D.push(A.create(B.tr,g,{top:0,right:0}));D.push(A.create(B.bl,g,{bottom:0,left:0}));D.push(A.create(B.b,f,{bottom:0,left:C.left+j}));D.push(A.create(B.br,g,{bottom:0,right:0}));D.push(A.create(B.l,e,{top:C.top+j,left:0}));D.push(A.create(B.c,a,{top:C.top+j,left:C.left+j}));D.push(A.create(B.r,e,{top:C.top+j,right:0}));D.push(b);return this.__nx=D.join(o);},resize:function(E,F,G){var H=this.__nz;var innerWidth=F-H.left-H.right;var innerHeight=G-H.top-H.bottom;if(innerWidth<0){innerWidth=0;}if(innerHeight<0){innerHeight=0;}E.style.width=F+j;E.style.height=G+j;E.childNodes[1].style.width=innerWidth+j;E.childNodes[4].style.width=innerWidth+j;E.childNodes[7].style.width=innerWidth+j;E.childNodes[6].style.height=innerHeight+j;E.childNodes[7].style.height=innerHeight+j;E.childNodes[8].style.height=innerHeight+j;if(qx.core.Variant.isSet(x,l)){if(qx.bom.client.Engine.VERSION<7||(qx.bom.client.Feature.QUIRKS_MODE&&qx.bom.client.Engine.VERSION<8)){if(F%2==1){E.childNodes[2].style.marginRight=h;E.childNodes[5].style.marginRight=h;E.childNodes[8].style.marginRight=h;}else{E.childNodes[2].style.marginRight=i;E.childNodes[5].style.marginRight=i;E.childNodes[8].style.marginRight=i;}if(G%2==1){E.childNodes[3].style.marginBottom=h;E.childNodes[4].style.marginBottom=h;E.childNodes[5].style.marginBottom=h;}else{E.childNodes[3].style.marginBottom=i;E.childNodes[4].style.marginBottom=i;E.childNodes[5].style.marginBottom=i;}}}},tint:function(I,J){},_applyBaseImage:function(K,L){{};if(K){var P=this._resolveImageUrl(K);var Q=/(.*)(\.[a-z]+)$/.exec(P);var O=Q[1];var N=Q[2];var M=this.__ny={tl:O+u+N,t:O+v+N,tr:O+d+N,bl:O+m+N,b:O+q+N,br:O+w+N,l:O+c+N,c:O+k+N,r:O+t+N};this.__nz=this._computeEdgeSizes(M);}},_resolveImageUrl:function(R){return qx.util.AliasManager.getInstance().resolve(R);},_computeEdgeSizes:function(S){var T=qx.util.ResourceManager.getInstance();return {top:T.getImageHeight(S.t),bottom:T.getImageHeight(S.b),left:T.getImageWidth(S.l),right:T.getImageWidth(S.r)};}},destruct:function(){this.__nx=this.__ny=this.__nz=null;}});})();(function(){var a="apiviewer.test.StringExtend";qx.Class.define(a,{extend:String,members:{}});})();
-
-qx.$$loader.init();
-
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/bootstrap.js b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/bootstrap.js
deleted file mode 100644
index c7b9d89d18e..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/bootstrap.js
+++ /dev/null
@@ -1,1829 +0,0 @@
-/* Modifications: replaced one ; with \n for testing purposes
- * Before the second !function -- nd */
-
-/* ===================================================
- * bootstrap-transition.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#transitions
- * ===================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function ($) {
-
- $(function () {
-
- "use strict"; // jshint ;_;
-
-
- /* CSS TRANSITION SUPPORT (http://www.modernizr.com/)
- * ======================================================= */
-
- $.support.transition = (function () {
-
- var transitionEnd = (function () {
-
- var el = document.createElement('bootstrap')
- , transEndEventNames = {
- 'WebkitTransition' : 'webkitTransitionEnd'
- , 'MozTransition' : 'transitionend'
- , 'OTransition' : 'oTransitionEnd'
- , 'msTransition' : 'MSTransitionEnd'
- , 'transition' : 'transitionend'
- }
- , name
-
- for (name in transEndEventNames){
- if (el.style[name] !== undefined) {
- return transEndEventNames[name]
- }
- }
-
- }())
-
- return transitionEnd && {
- end: transitionEnd
- }
-
- })()
-
- })
-
-}(window.jQuery)
-/* ==========================================================
- * bootstrap-alert.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#alerts
- * ==========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* ALERT CLASS DEFINITION
- * ====================== */
-
- var dismiss = '[data-dismiss="alert"]'
- , Alert = function (el) {
- $(el).on('click', dismiss, this.close)
- }
-
- Alert.prototype.close = function (e) {
- var $this = $(this)
- , selector = $this.attr('data-target')
- , $parent
-
- if (!selector) {
- selector = $this.attr('href')
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
- }
-
- $parent = $(selector)
-
- e && e.preventDefault()
-
- $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent())
-
- $parent.trigger(e = $.Event('close'))
-
- if (e.isDefaultPrevented()) return
-
- $parent.removeClass('in')
-
- function removeElement() {
- $parent
- .trigger('closed')
- .remove()
- }
-
- $.support.transition && $parent.hasClass('fade') ?
- $parent.on($.support.transition.end, removeElement) :
- removeElement()
- }
-
-
- /* ALERT PLUGIN DEFINITION
- * ======================= */
-
- $.fn.alert = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('alert')
- if (!data) $this.data('alert', (data = new Alert(this)))
- if (typeof option == 'string') data[option].call($this)
- })
- }
-
- $.fn.alert.Constructor = Alert
-
-
- /* ALERT DATA-API
- * ============== */
-
- $(function () {
- $('body').on('click.alert.data-api', dismiss, Alert.prototype.close)
- })
-
-}(window.jQuery);/* ============================================================
- * bootstrap-button.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#buttons
- * ============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================ */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* BUTTON PUBLIC CLASS DEFINITION
- * ============================== */
-
- var Button = function (element, options) {
- this.$element = $(element)
- this.options = $.extend({}, $.fn.button.defaults, options)
- }
-
- Button.prototype.setState = function (state) {
- var d = 'disabled'
- , $el = this.$element
- , data = $el.data()
- , val = $el.is('input') ? 'val' : 'html'
-
- state = state + 'Text'
- data.resetText || $el.data('resetText', $el[val]())
-
- $el[val](data[state] || this.options[state])
-
- // push to event loop to allow forms to submit
- setTimeout(function () {
- state == 'loadingText' ?
- $el.addClass(d).attr(d, d) :
- $el.removeClass(d).removeAttr(d)
- }, 0)
- }
-
- Button.prototype.toggle = function () {
- var $parent = this.$element.parent('[data-toggle="buttons-radio"]')
-
- $parent && $parent
- .find('.active')
- .removeClass('active')
-
- this.$element.toggleClass('active')
- }
-
-
- /* BUTTON PLUGIN DEFINITION
- * ======================== */
-
- $.fn.button = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('button')
- , options = typeof option == 'object' && option
- if (!data) $this.data('button', (data = new Button(this, options)))
- if (option == 'toggle') data.toggle()
- else if (option) data.setState(option)
- })
- }
-
- $.fn.button.defaults = {
- loadingText: 'loading...'
- }
-
- $.fn.button.Constructor = Button
-
-
- /* BUTTON DATA-API
- * =============== */
-
- $(function () {
- $('body').on('click.button.data-api', '[data-toggle^=button]', function ( e ) {
- var $btn = $(e.target)
- if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn')
- $btn.button('toggle')
- })
- })
-
-}(window.jQuery);/* ==========================================================
- * bootstrap-carousel.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#carousel
- * ==========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* CAROUSEL CLASS DEFINITION
- * ========================= */
-
- var Carousel = function (element, options) {
- this.$element = $(element)
- this.options = options
- this.options.slide && this.slide(this.options.slide)
- this.options.pause == 'hover' && this.$element
- .on('mouseenter', $.proxy(this.pause, this))
- .on('mouseleave', $.proxy(this.cycle, this))
- }
-
- Carousel.prototype = {
-
- cycle: function (e) {
- if (!e) this.paused = false
- this.options.interval
- && !this.paused
- && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))
- return this
- }
-
- , to: function (pos) {
- var $active = this.$element.find('.active')
- , children = $active.parent().children()
- , activePos = children.index($active)
- , that = this
-
- if (pos > (children.length - 1) || pos < 0) return
-
- if (this.sliding) {
- return this.$element.one('slid', function () {
- that.to(pos)
- })
- }
-
- if (activePos == pos) {
- return this.pause().cycle()
- }
-
- return this.slide(pos > activePos ? 'next' : 'prev', $(children[pos]))
- }
-
- , pause: function (e) {
- if (!e) this.paused = true
- clearInterval(this.interval)
- this.interval = null
- return this
- }
-
- , next: function () {
- if (this.sliding) return
- return this.slide('next')
- }
-
- , prev: function () {
- if (this.sliding) return
- return this.slide('prev')
- }
-
- , slide: function (type, next) {
- var $active = this.$element.find('.active')
- , $next = next || $active[type]()
- , isCycling = this.interval
- , direction = type == 'next' ? 'left' : 'right'
- , fallback = type == 'next' ? 'first' : 'last'
- , that = this
- , e = $.Event('slide')
-
- this.sliding = true
-
- isCycling && this.pause()
-
- $next = $next.length ? $next : this.$element.find('.item')[fallback]()
-
- if ($next.hasClass('active')) return
-
- if ($.support.transition && this.$element.hasClass('slide')) {
- this.$element.trigger(e)
- if (e.isDefaultPrevented()) return
- $next.addClass(type)
- $next[0].offsetWidth // force reflow
- $active.addClass(direction)
- $next.addClass(direction)
- this.$element.one($.support.transition.end, function () {
- $next.removeClass([type, direction].join(' ')).addClass('active')
- $active.removeClass(['active', direction].join(' '))
- that.sliding = false
- setTimeout(function () { that.$element.trigger('slid') }, 0)
- })
- } else {
- this.$element.trigger(e)
- if (e.isDefaultPrevented()) return
- $active.removeClass('active')
- $next.addClass('active')
- this.sliding = false
- this.$element.trigger('slid')
- }
-
- isCycling && this.cycle()
-
- return this
- }
-
- }
-
-
- /* CAROUSEL PLUGIN DEFINITION
- * ========================== */
-
- $.fn.carousel = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('carousel')
- , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option)
- if (!data) $this.data('carousel', (data = new Carousel(this, options)))
- if (typeof option == 'number') data.to(option)
- else if (typeof option == 'string' || (option = options.slide)) data[option]()
- else if (options.interval) data.cycle()
- })
- }
-
- $.fn.carousel.defaults = {
- interval: 5000
- , pause: 'hover'
- }
-
- $.fn.carousel.Constructor = Carousel
-
-
- /* CAROUSEL DATA-API
- * ================= */
-
- $(function () {
- $('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
- var $this = $(this), href
- , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
- , options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
- $target.carousel(options)
- e.preventDefault()
- })
- })
-
-}(window.jQuery);/* =============================================================
- * bootstrap-collapse.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#collapse
- * =============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================ */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* COLLAPSE PUBLIC CLASS DEFINITION
- * ================================ */
-
- var Collapse = function (element, options) {
- this.$element = $(element)
- this.options = $.extend({}, $.fn.collapse.defaults, options)
-
- if (this.options.parent) {
- this.$parent = $(this.options.parent)
- }
-
- this.options.toggle && this.toggle()
- }
-
- Collapse.prototype = {
-
- constructor: Collapse
-
- , dimension: function () {
- var hasWidth = this.$element.hasClass('width')
- return hasWidth ? 'width' : 'height'
- }
-
- , show: function () {
- var dimension
- , scroll
- , actives
- , hasData
-
- if (this.transitioning) return
-
- dimension = this.dimension()
- scroll = $.camelCase(['scroll', dimension].join('-'))
- actives = this.$parent && this.$parent.find('> .accordion-group > .in')
-
- if (actives && actives.length) {
- hasData = actives.data('collapse')
- if (hasData && hasData.transitioning) return
- actives.collapse('hide')
- hasData || actives.data('collapse', null)
- }
-
- this.$element[dimension](0)
- this.transition('addClass', $.Event('show'), 'shown')
- this.$element[dimension](this.$element[0][scroll])
- }
-
- , hide: function () {
- var dimension
- if (this.transitioning) return
- dimension = this.dimension()
- this.reset(this.$element[dimension]())
- this.transition('removeClass', $.Event('hide'), 'hidden')
- this.$element[dimension](0)
- }
-
- , reset: function (size) {
- var dimension = this.dimension()
-
- this.$element
- .removeClass('collapse')
- [dimension](size || 'auto')
- [0].offsetWidth
-
- this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
-
- return this
- }
-
- , transition: function (method, startEvent, completeEvent) {
- var that = this
- , complete = function () {
- if (startEvent.type == 'show') that.reset()
- that.transitioning = 0
- that.$element.trigger(completeEvent)
- }
-
- this.$element.trigger(startEvent)
-
- if (startEvent.isDefaultPrevented()) return
-
- this.transitioning = 1
-
- this.$element[method]('in')
-
- $.support.transition && this.$element.hasClass('collapse') ?
- this.$element.one($.support.transition.end, complete) :
- complete()
- }
-
- , toggle: function () {
- this[this.$element.hasClass('in') ? 'hide' : 'show']()
- }
-
- }
-
-
- /* COLLAPSIBLE PLUGIN DEFINITION
- * ============================== */
-
- $.fn.collapse = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('collapse')
- , options = typeof option == 'object' && option
- if (!data) $this.data('collapse', (data = new Collapse(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.collapse.defaults = {
- toggle: true
- }
-
- $.fn.collapse.Constructor = Collapse
-
-
- /* COLLAPSIBLE DATA-API
- * ==================== */
-
- $(function () {
- $('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
- var $this = $(this), href
- , target = $this.attr('data-target')
- || e.preventDefault()
- || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
- , option = $(target).data('collapse') ? 'toggle' : $this.data()
- $(target).collapse(option)
- })
- })
-
-}(window.jQuery);/* ============================================================
- * bootstrap-dropdown.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#dropdowns
- * ============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================ */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* DROPDOWN CLASS DEFINITION
- * ========================= */
-
- var toggle = '[data-toggle="dropdown"]'
- , Dropdown = function (element) {
- var $el = $(element).on('click.dropdown.data-api', this.toggle)
- $('html').on('click.dropdown.data-api', function () {
- $el.parent().removeClass('open')
- })
- }
-
- Dropdown.prototype = {
-
- constructor: Dropdown
-
- , toggle: function (e) {
- var $this = $(this)
- , $parent
- , selector
- , isActive
-
- if ($this.is('.disabled, :disabled')) return
-
- selector = $this.attr('data-target')
-
- if (!selector) {
- selector = $this.attr('href')
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
- }
-
- $parent = $(selector)
- $parent.length || ($parent = $this.parent())
-
- isActive = $parent.hasClass('open')
-
- clearMenus()
-
- if (!isActive) $parent.toggleClass('open')
-
- return false
- }
-
- }
-
- function clearMenus() {
- $(toggle).parent().removeClass('open')
- }
-
-
- /* DROPDOWN PLUGIN DEFINITION
- * ========================== */
-
- $.fn.dropdown = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('dropdown')
- if (!data) $this.data('dropdown', (data = new Dropdown(this)))
- if (typeof option == 'string') data[option].call($this)
- })
- }
-
- $.fn.dropdown.Constructor = Dropdown
-
-
- /* APPLY TO STANDARD DROPDOWN ELEMENTS
- * =================================== */
-
- $(function () {
- $('html').on('click.dropdown.data-api', clearMenus)
- $('body')
- .on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })
- .on('click.dropdown.data-api', toggle, Dropdown.prototype.toggle)
- })
-
-}(window.jQuery);/* =========================================================
- * bootstrap-modal.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#modals
- * =========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================= */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* MODAL CLASS DEFINITION
- * ====================== */
-
- var Modal = function (content, options) {
- this.options = options
- this.$element = $(content)
- .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this))
- }
-
- Modal.prototype = {
-
- constructor: Modal
-
- , toggle: function () {
- return this[!this.isShown ? 'show' : 'hide']()
- }
-
- , show: function () {
- var that = this
- , e = $.Event('show')
-
- this.$element.trigger(e)
-
- if (this.isShown || e.isDefaultPrevented()) return
-
- $('body').addClass('modal-open')
-
- this.isShown = true
-
- escape.call(this)
- backdrop.call(this, function () {
- var transition = $.support.transition && that.$element.hasClass('fade')
-
- if (!that.$element.parent().length) {
- that.$element.appendTo(document.body) //don't move modals dom position
- }
-
- that.$element
- .show()
-
- if (transition) {
- that.$element[0].offsetWidth // force reflow
- }
-
- that.$element.addClass('in')
-
- transition ?
- that.$element.one($.support.transition.end, function () { that.$element.trigger('shown') }) :
- that.$element.trigger('shown')
-
- })
- }
-
- , hide: function (e) {
- e && e.preventDefault()
-
- var that = this
-
- e = $.Event('hide')
-
- this.$element.trigger(e)
-
- if (!this.isShown || e.isDefaultPrevented()) return
-
- this.isShown = false
-
- $('body').removeClass('modal-open')
-
- escape.call(this)
-
- this.$element.removeClass('in')
-
- $.support.transition && this.$element.hasClass('fade') ?
- hideWithTransition.call(this) :
- hideModal.call(this)
- }
-
- }
-
-
- /* MODAL PRIVATE METHODS
- * ===================== */
-
- function hideWithTransition() {
- var that = this
- , timeout = setTimeout(function () {
- that.$element.off($.support.transition.end)
- hideModal.call(that)
- }, 500)
-
- this.$element.one($.support.transition.end, function () {
- clearTimeout(timeout)
- hideModal.call(that)
- })
- }
-
- function hideModal(that) {
- this.$element
- .hide()
- .trigger('hidden')
-
- backdrop.call(this)
- }
-
- function backdrop(callback) {
- var that = this
- , animate = this.$element.hasClass('fade') ? 'fade' : ''
-
- if (this.isShown && this.options.backdrop) {
- var doAnimate = $.support.transition && animate
-
- this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />')
- .appendTo(document.body)
-
- if (this.options.backdrop != 'static') {
- this.$backdrop.click($.proxy(this.hide, this))
- }
-
- if (doAnimate) this.$backdrop[0].offsetWidth // force reflow
-
- this.$backdrop.addClass('in')
-
- doAnimate ?
- this.$backdrop.one($.support.transition.end, callback) :
- callback()
-
- } else if (!this.isShown && this.$backdrop) {
- this.$backdrop.removeClass('in')
-
- $.support.transition && this.$element.hasClass('fade')?
- this.$backdrop.one($.support.transition.end, $.proxy(removeBackdrop, this)) :
- removeBackdrop.call(this)
-
- } else if (callback) {
- callback()
- }
- }
-
- function removeBackdrop() {
- this.$backdrop.remove()
- this.$backdrop = null
- }
-
- function escape() {
- var that = this
- if (this.isShown && this.options.keyboard) {
- $(document).on('keyup.dismiss.modal', function ( e ) {
- e.which == 27 && that.hide()
- })
- } else if (!this.isShown) {
- $(document).off('keyup.dismiss.modal')
- }
- }
-
-
- /* MODAL PLUGIN DEFINITION
- * ======================= */
-
- $.fn.modal = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('modal')
- , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
- if (!data) $this.data('modal', (data = new Modal(this, options)))
- if (typeof option == 'string') data[option]()
- else if (options.show) data.show()
- })
- }
-
- $.fn.modal.defaults = {
- backdrop: true
- , keyboard: true
- , show: true
- }
-
- $.fn.modal.Constructor = Modal
-
-
- /* MODAL DATA-API
- * ============== */
-
- $(function () {
- $('body').on('click.modal.data-api', '[data-toggle="modal"]', function ( e ) {
- var $this = $(this), href
- , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
- , option = $target.data('modal') ? 'toggle' : $.extend({}, $target.data(), $this.data())
-
- e.preventDefault()
- $target.modal(option)
- })
- })
-
-}(window.jQuery);/* ===========================================================
- * bootstrap-tooltip.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#tooltips
- * Inspired by the original jQuery.tipsy by Jason Frame
- * ===========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* TOOLTIP PUBLIC CLASS DEFINITION
- * =============================== */
-
- var Tooltip = function (element, options) {
- this.init('tooltip', element, options)
- }
-
- Tooltip.prototype = {
-
- constructor: Tooltip
-
- , init: function (type, element, options) {
- var eventIn
- , eventOut
-
- this.type = type
- this.$element = $(element)
- this.options = this.getOptions(options)
- this.enabled = true
-
- if (this.options.trigger != 'manual') {
- eventIn = this.options.trigger == 'hover' ? 'mouseenter' : 'focus'
- eventOut = this.options.trigger == 'hover' ? 'mouseleave' : 'blur'
- this.$element.on(eventIn, this.options.selector, $.proxy(this.enter, this))
- this.$element.on(eventOut, this.options.selector, $.proxy(this.leave, this))
- }
-
- this.options.selector ?
- (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :
- this.fixTitle()
- }
-
- , getOptions: function (options) {
- options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data())
-
- if (options.delay && typeof options.delay == 'number') {
- options.delay = {
- show: options.delay
- , hide: options.delay
- }
- }
-
- return options
- }
-
- , enter: function (e) {
- var self = $(e.currentTarget)[this.type](this._options).data(this.type)
-
- if (!self.options.delay || !self.options.delay.show) return self.show()
-
- clearTimeout(this.timeout)
- self.hoverState = 'in'
- this.timeout = setTimeout(function() {
- if (self.hoverState == 'in') self.show()
- }, self.options.delay.show)
- }
-
- , leave: function (e) {
- var self = $(e.currentTarget)[this.type](this._options).data(this.type)
-
- if (this.timeout) clearTimeout(this.timeout)
- if (!self.options.delay || !self.options.delay.hide) return self.hide()
-
- self.hoverState = 'out'
- this.timeout = setTimeout(function() {
- if (self.hoverState == 'out') self.hide()
- }, self.options.delay.hide)
- }
-
- , show: function () {
- var $tip
- , inside
- , pos
- , actualWidth
- , actualHeight
- , placement
- , tp
-
- if (this.hasContent() && this.enabled) {
- $tip = this.tip()
- this.setContent()
-
- if (this.options.animation) {
- $tip.addClass('fade')
- }
-
- placement = typeof this.options.placement == 'function' ?
- this.options.placement.call(this, $tip[0], this.$element[0]) :
- this.options.placement
-
- inside = /in/.test(placement)
-
- $tip
- .remove()
- .css({ top: 0, left: 0, display: 'block' })
- .appendTo(inside ? this.$element : document.body)
-
- pos = this.getPosition(inside)
-
- actualWidth = $tip[0].offsetWidth
- actualHeight = $tip[0].offsetHeight
-
- switch (inside ? placement.split(' ')[1] : placement) {
- case 'bottom':
- tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}
- break
- case 'top':
- tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}
- break
- case 'left':
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}
- break
- case 'right':
- tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}
- break
- }
-
- $tip
- .css(tp)
- .addClass(placement)
- .addClass('in')
- }
- }
-
- , isHTML: function(text) {
- // html string detection logic adapted from jQuery
- return typeof text != 'string'
- || ( text.charAt(0) === "<"
- && text.charAt( text.length - 1 ) === ">"
- && text.length >= 3
- ) || /^(?:[^<]*<[\w\W]+>[^>]*$)/.exec(text)
- }
-
- , setContent: function () {
- var $tip = this.tip()
- , title = this.getTitle()
-
- $tip.find('.tooltip-inner')[this.isHTML(title) ? 'html' : 'text'](title)
- $tip.removeClass('fade in top bottom left right')
- }
-
- , hide: function () {
- var that = this
- , $tip = this.tip()
-
- $tip.removeClass('in')
-
- function removeWithAnimation() {
- var timeout = setTimeout(function () {
- $tip.off($.support.transition.end).remove()
- }, 500)
-
- $tip.one($.support.transition.end, function () {
- clearTimeout(timeout)
- $tip.remove()
- })
- }
-
- $.support.transition && this.$tip.hasClass('fade') ?
- removeWithAnimation() :
- $tip.remove()
- }
-
- , fixTitle: function () {
- var $e = this.$element
- if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') {
- $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title')
- }
- }
-
- , hasContent: function () {
- return this.getTitle()
- }
-
- , getPosition: function (inside) {
- return $.extend({}, (inside ? {top: 0, left: 0} : this.$element.offset()), {
- width: this.$element[0].offsetWidth
- , height: this.$element[0].offsetHeight
- })
- }
-
- , getTitle: function () {
- var title
- , $e = this.$element
- , o = this.options
-
- title = $e.attr('data-original-title')
- || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)
-
- return title
- }
-
- , tip: function () {
- return this.$tip = this.$tip || $(this.options.template)
- }
-
- , validate: function () {
- if (!this.$element[0].parentNode) {
- this.hide()
- this.$element = null
- this.options = null
- }
- }
-
- , enable: function () {
- this.enabled = true
- }
-
- , disable: function () {
- this.enabled = false
- }
-
- , toggleEnabled: function () {
- this.enabled = !this.enabled
- }
-
- , toggle: function () {
- this[this.tip().hasClass('in') ? 'hide' : 'show']()
- }
-
- }
-
-
- /* TOOLTIP PLUGIN DEFINITION
- * ========================= */
-
- $.fn.tooltip = function ( option ) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('tooltip')
- , options = typeof option == 'object' && option
- if (!data) $this.data('tooltip', (data = new Tooltip(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.tooltip.Constructor = Tooltip
-
- $.fn.tooltip.defaults = {
- animation: true
- , placement: 'top'
- , selector: false
- , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
- , trigger: 'hover'
- , title: ''
- , delay: 0
- }
-
-}(window.jQuery);
-/* ===========================================================
- * bootstrap-popover.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#popovers
- * ===========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * =========================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* POPOVER PUBLIC CLASS DEFINITION
- * =============================== */
-
- var Popover = function ( element, options ) {
- this.init('popover', element, options)
- }
-
-
- /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js
- ========================================== */
-
- Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, {
-
- constructor: Popover
-
- , setContent: function () {
- var $tip = this.tip()
- , title = this.getTitle()
- , content = this.getContent()
-
- $tip.find('.popover-title')[this.isHTML(title) ? 'html' : 'text'](title)
- $tip.find('.popover-content > *')[this.isHTML(content) ? 'html' : 'text'](content)
-
- $tip.removeClass('fade top bottom left right in')
- }
-
- , hasContent: function () {
- return this.getTitle() || this.getContent()
- }
-
- , getContent: function () {
- var content
- , $e = this.$element
- , o = this.options
-
- content = $e.attr('data-content')
- || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content)
-
- return content
- }
-
- , tip: function () {
- if (!this.$tip) {
- this.$tip = $(this.options.template)
- }
- return this.$tip
- }
-
- })
-
-
- /* POPOVER PLUGIN DEFINITION
- * ======================= */
-
- $.fn.popover = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('popover')
- , options = typeof option == 'object' && option
- if (!data) $this.data('popover', (data = new Popover(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.popover.Constructor = Popover
-
- $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, {
- placement: 'right'
- , content: ''
- , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"><p></p></div></div></div>'
- })
-
-}(window.jQuery);/* =============================================================
- * bootstrap-scrollspy.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#scrollspy
- * =============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* SCROLLSPY CLASS DEFINITION
- * ========================== */
-
- function ScrollSpy( element, options) {
- var process = $.proxy(this.process, this)
- , $element = $(element).is('body') ? $(window) : $(element)
- , href
- this.options = $.extend({}, $.fn.scrollspy.defaults, options)
- this.$scrollElement = $element.on('scroll.scroll.data-api', process)
- this.selector = (this.options.target
- || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
- || '') + ' .nav li > a'
- this.$body = $('body')
- this.refresh()
- this.process()
- }
-
- ScrollSpy.prototype = {
-
- constructor: ScrollSpy
-
- , refresh: function () {
- var self = this
- , $targets
-
- this.offsets = $([])
- this.targets = $([])
-
- $targets = this.$body
- .find(this.selector)
- .map(function () {
- var $el = $(this)
- , href = $el.data('target') || $el.attr('href')
- , $href = /^#\w/.test(href) && $(href)
- return ( $href
- && href.length
- && [[ $href.position().top, href ]] ) || null
- })
- .sort(function (a, b) { return a[0] - b[0] })
- .each(function () {
- self.offsets.push(this[0])
- self.targets.push(this[1])
- })
- }
-
- , process: function () {
- var scrollTop = this.$scrollElement.scrollTop() + this.options.offset
- , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight
- , maxScroll = scrollHeight - this.$scrollElement.height()
- , offsets = this.offsets
- , targets = this.targets
- , activeTarget = this.activeTarget
- , i
-
- if (scrollTop >= maxScroll) {
- return activeTarget != (i = targets.last()[0])
- && this.activate ( i )
- }
-
- for (i = offsets.length; i--;) {
- activeTarget != targets[i]
- && scrollTop >= offsets[i]
- && (!offsets[i + 1] || scrollTop <= offsets[i + 1])
- && this.activate( targets[i] )
- }
- }
-
- , activate: function (target) {
- var active
- , selector
-
- this.activeTarget = target
-
- $(this.selector)
- .parent('.active')
- .removeClass('active')
-
- selector = this.selector
- + '[data-target="' + target + '"],'
- + this.selector + '[href="' + target + '"]'
-
- active = $(selector)
- .parent('li')
- .addClass('active')
-
- if (active.parent('.dropdown-menu')) {
- active = active.closest('li.dropdown').addClass('active')
- }
-
- active.trigger('activate')
- }
-
- }
-
-
- /* SCROLLSPY PLUGIN DEFINITION
- * =========================== */
-
- $.fn.scrollspy = function ( option ) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('scrollspy')
- , options = typeof option == 'object' && option
- if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.scrollspy.Constructor = ScrollSpy
-
- $.fn.scrollspy.defaults = {
- offset: 10
- }
-
-
- /* SCROLLSPY DATA-API
- * ================== */
-
- $(function () {
- $('[data-spy="scroll"]').each(function () {
- var $spy = $(this)
- $spy.scrollspy($spy.data())
- })
- })
-
-}(window.jQuery);/* ========================================================
- * bootstrap-tab.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#tabs
- * ========================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ======================================================== */
-
-
-!function ($) {
-
- "use strict"; // jshint ;_;
-
-
- /* TAB CLASS DEFINITION
- * ==================== */
-
- var Tab = function ( element ) {
- this.element = $(element)
- }
-
- Tab.prototype = {
-
- constructor: Tab
-
- , show: function () {
- var $this = this.element
- , $ul = $this.closest('ul:not(.dropdown-menu)')
- , selector = $this.attr('data-target')
- , previous
- , $target
- , e
-
- if (!selector) {
- selector = $this.attr('href')
- selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7
- }
-
- if ( $this.parent('li').hasClass('active') ) return
-
- previous = $ul.find('.active a').last()[0]
-
- e = $.Event('show', {
- relatedTarget: previous
- })
-
- $this.trigger(e)
-
- if (e.isDefaultPrevented()) return
-
- $target = $(selector)
-
- this.activate($this.parent('li'), $ul)
- this.activate($target, $target.parent(), function () {
- $this.trigger({
- type: 'shown'
- , relatedTarget: previous
- })
- })
- }
-
- , activate: function ( element, container, callback) {
- var $active = container.find('> .active')
- , transition = callback
- && $.support.transition
- && $active.hasClass('fade')
-
- function next() {
- $active
- .removeClass('active')
- .find('> .dropdown-menu > .active')
- .removeClass('active')
-
- element.addClass('active')
-
- if (transition) {
- element[0].offsetWidth // reflow for transition
- element.addClass('in')
- } else {
- element.removeClass('fade')
- }
-
- if ( element.parent('.dropdown-menu') ) {
- element.closest('li.dropdown').addClass('active')
- }
-
- callback && callback()
- }
-
- transition ?
- $active.one($.support.transition.end, next) :
- next()
-
- $active.removeClass('in')
- }
- }
-
-
- /* TAB PLUGIN DEFINITION
- * ===================== */
-
- $.fn.tab = function ( option ) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('tab')
- if (!data) $this.data('tab', (data = new Tab(this)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.tab.Constructor = Tab
-
-
- /* TAB DATA-API
- * ============ */
-
- $(function () {
- $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) {
- e.preventDefault()
- $(this).tab('show')
- })
- })
-
-}(window.jQuery);/* =============================================================
- * bootstrap-typeahead.js v2.0.4
- * http://twitter.github.com/bootstrap/javascript.html#typeahead
- * =============================================================
- * Copyright 2012 Twitter, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============================================================ */
-
-
-!function($){
-
- "use strict"; // jshint ;_;
-
-
- /* TYPEAHEAD PUBLIC CLASS DEFINITION
- * ================================= */
-
- var Typeahead = function (element, options) {
- this.$element = $(element)
- this.options = $.extend({}, $.fn.typeahead.defaults, options)
- this.matcher = this.options.matcher || this.matcher
- this.sorter = this.options.sorter || this.sorter
- this.highlighter = this.options.highlighter || this.highlighter
- this.updater = this.options.updater || this.updater
- this.$menu = $(this.options.menu).appendTo('body')
- this.source = this.options.source
- this.shown = false
- this.listen()
- }
-
- Typeahead.prototype = {
-
- constructor: Typeahead
-
- , select: function () {
- var val = this.$menu.find('.active').attr('data-value')
- this.$element
- .val(this.updater(val))
- .change()
- return this.hide()
- }
-
- , updater: function (item) {
- return item
- }
-
- , show: function () {
- var pos = $.extend({}, this.$element.offset(), {
- height: this.$element[0].offsetHeight
- })
-
- this.$menu.css({
- top: pos.top + pos.height
- , left: pos.left
- })
-
- this.$menu.show()
- this.shown = true
- return this
- }
-
- , hide: function () {
- this.$menu.hide()
- this.shown = false
- return this
- }
-
- , lookup: function (event) {
- var that = this
- , items
- , q
-
- this.query = this.$element.val()
-
- if (!this.query) {
- return this.shown ? this.hide() : this
- }
-
- items = $.grep(this.source, function (item) {
- return that.matcher(item)
- })
-
- items = this.sorter(items)
-
- if (!items.length) {
- return this.shown ? this.hide() : this
- }
-
- return this.render(items.slice(0, this.options.items)).show()
- }
-
- , matcher: function (item) {
- return ~item.toLowerCase().indexOf(this.query.toLowerCase())
- }
-
- , sorter: function (items) {
- var beginswith = []
- , caseSensitive = []
- , caseInsensitive = []
- , item
-
- while (item = items.shift()) {
- if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item)
- else if (~item.indexOf(this.query)) caseSensitive.push(item)
- else caseInsensitive.push(item)
- }
-
- return beginswith.concat(caseSensitive, caseInsensitive)
- }
-
- , highlighter: function (item) {
- var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&')
- return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) {
- return '<strong>' + match + '</strong>'
- })
- }
-
- , render: function (items) {
- var that = this
-
- items = $(items).map(function (i, item) {
- i = $(that.options.item).attr('data-value', item)
- i.find('a').html(that.highlighter(item))
- return i[0]
- })
-
- items.first().addClass('active')
- this.$menu.html(items)
- return this
- }
-
- , next: function (event) {
- var active = this.$menu.find('.active').removeClass('active')
- , next = active.next()
-
- if (!next.length) {
- next = $(this.$menu.find('li')[0])
- }
-
- next.addClass('active')
- }
-
- , prev: function (event) {
- var active = this.$menu.find('.active').removeClass('active')
- , prev = active.prev()
-
- if (!prev.length) {
- prev = this.$menu.find('li').last()
- }
-
- prev.addClass('active')
- }
-
- , listen: function () {
- this.$element
- .on('blur', $.proxy(this.blur, this))
- .on('keypress', $.proxy(this.keypress, this))
- .on('keyup', $.proxy(this.keyup, this))
-
- if ($.browser.webkit || $.browser.msie) {
- this.$element.on('keydown', $.proxy(this.keypress, this))
- }
-
- this.$menu
- .on('click', $.proxy(this.click, this))
- .on('mouseenter', 'li', $.proxy(this.mouseenter, this))
- }
-
- , keyup: function (e) {
- switch(e.keyCode) {
- case 40: // down arrow
- case 38: // up arrow
- break
-
- case 9: // tab
- case 13: // enter
- if (!this.shown) return
- this.select()
- break
-
- case 27: // escape
- if (!this.shown) return
- this.hide()
- break
-
- default:
- this.lookup()
- }
-
- e.stopPropagation()
- e.preventDefault()
- }
-
- , keypress: function (e) {
- if (!this.shown) return
-
- switch(e.keyCode) {
- case 9: // tab
- case 13: // enter
- case 27: // escape
- e.preventDefault()
- break
-
- case 38: // up arrow
- if (e.type != 'keydown') break
- e.preventDefault()
- this.prev()
- break
-
- case 40: // down arrow
- if (e.type != 'keydown') break
- e.preventDefault()
- this.next()
- break
- }
-
- e.stopPropagation()
- }
-
- , blur: function (e) {
- var that = this
- setTimeout(function () { that.hide() }, 150)
- }
-
- , click: function (e) {
- e.stopPropagation()
- e.preventDefault()
- this.select()
- }
-
- , mouseenter: function (e) {
- this.$menu.find('.active').removeClass('active')
- $(e.currentTarget).addClass('active')
- }
-
- }
-
-
- /* TYPEAHEAD PLUGIN DEFINITION
- * =========================== */
-
- $.fn.typeahead = function (option) {
- return this.each(function () {
- var $this = $(this)
- , data = $this.data('typeahead')
- , options = typeof option == 'object' && option
- if (!data) $this.data('typeahead', (data = new Typeahead(this, options)))
- if (typeof option == 'string') data[option]()
- })
- }
-
- $.fn.typeahead.defaults = {
- source: []
- , items: 8
- , menu: '<ul class="typeahead dropdown-menu"></ul>'
- , item: '<li><a href="#"></a></li>'
- }
-
- $.fn.typeahead.Constructor = Typeahead
-
-
- /* TYPEAHEAD DATA-API
- * ================== */
-
- $(function () {
- $('body').on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) {
- var $this = $(this)
- if ($this.data('typeahead')) return
- e.preventDefault()
- $this.typeahead($this.data())
- })
- })
-
-}(window.jQuery);
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js
deleted file mode 100644
index 8ccd0ea786e..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jquery-1.7.1.js
+++ /dev/null
@@ -1,9266 +0,0 @@
-/*!
- * jQuery JavaScript Library v1.7.1
- * http://jquery.com/
- *
- * Copyright 2011, John Resig
- * Dual licensed under the MIT or GPL Version 2 licenses.
- * http://jquery.org/license
- *
- * Includes Sizzle.js
- * http://sizzlejs.com/
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- *
- * Date: Mon Nov 21 21:11:03 2011 -0500
- */
-(function( window, undefined ) {
-
-// Use the correct document accordingly with window argument (sandbox)
-var document = window.document,
- navigator = window.navigator,
- location = window.location;
-var jQuery = (function() {
-
-// Define a local copy of jQuery
-var jQuery = function( selector, context ) {
- // The jQuery object is actually just the init constructor 'enhanced'
- return new jQuery.fn.init( selector, context, rootjQuery );
- },
-
- // Map over jQuery in case of overwrite
- _jQuery = window.jQuery,
-
- // Map over the $ in case of overwrite
- _$ = window.$,
-
- // A central reference to the root jQuery(document)
- rootjQuery,
-
- // A simple way to check for HTML strings or ID strings
- // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
- quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
-
- // Check if a string has a non-whitespace character in it
- rnotwhite = /\S/,
-
- // Used for trimming whitespace
- trimLeft = /^\s+/,
- trimRight = /\s+$/,
-
- // Match a standalone tag
- rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
-
- // JSON RegExp
- rvalidchars = /^[\],:{}\s]*$/,
- rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
- rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
- rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
-
- // Useragent RegExp
- rwebkit = /(webkit)[ \/]([\w.]+)/,
- ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
- rmsie = /(msie) ([\w.]+)/,
- rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
-
- // Matches dashed string for camelizing
- rdashAlpha = /-([a-z]|[0-9])/ig,
- rmsPrefix = /^-ms-/,
-
- // Used by jQuery.camelCase as callback to replace()
- fcamelCase = function( all, letter ) {
- return ( letter + "" ).toUpperCase();
- },
-
- // Keep a UserAgent string for use with jQuery.browser
- userAgent = navigator.userAgent,
-
- // For matching the engine and version of the browser
- browserMatch,
-
- // The deferred used on DOM ready
- readyList,
-
- // The ready event handler
- DOMContentLoaded,
-
- // Save a reference to some core methods
- toString = Object.prototype.toString,
- hasOwn = Object.prototype.hasOwnProperty,
- push = Array.prototype.push,
- slice = Array.prototype.slice,
- trim = String.prototype.trim,
- indexOf = Array.prototype.indexOf,
-
- // [[Class]] -> type pairs
- class2type = {};
-
-jQuery.fn = jQuery.prototype = {
- constructor: jQuery,
- init: function( selector, context, rootjQuery ) {
- var match, elem, ret, doc;
-
- // Handle $(""), $(null), or $(undefined)
- if ( !selector ) {
- return this;
- }
-
- // Handle $(DOMElement)
- if ( selector.nodeType ) {
- this.context = this[0] = selector;
- this.length = 1;
- return this;
- }
-
- // The body element only exists once, optimize finding it
- if ( selector === "body" && !context && document.body ) {
- this.context = document;
- this[0] = document.body;
- this.selector = selector;
- this.length = 1;
- return this;
- }
-
- // Handle HTML strings
- if ( typeof selector === "string" ) {
- // Are we dealing with HTML string or an ID?
- if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
- // Assume that strings that start and end with <> are HTML and skip the regex check
- match = [ null, selector, null ];
-
- } else {
- match = quickExpr.exec( selector );
- }
-
- // Verify a match, and that no context was specified for #id
- if ( match && (match[1] || !context) ) {
-
- // HANDLE: $(html) -> $(array)
- if ( match[1] ) {
- context = context instanceof jQuery ? context[0] : context;
- doc = ( context ? context.ownerDocument || context : document );
-
- // If a single string is passed in and it's a single tag
- // just do a createElement and skip the rest
- ret = rsingleTag.exec( selector );
-
- if ( ret ) {
- if ( jQuery.isPlainObject( context ) ) {
- selector = [ document.createElement( ret[1] ) ];
- jQuery.fn.attr.call( selector, context, true );
-
- } else {
- selector = [ doc.createElement( ret[1] ) ];
- }
-
- } else {
- ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
- selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
- }
-
- return jQuery.merge( this, selector );
-
- // HANDLE: $("#id")
- } else {
- elem = document.getElementById( match[2] );
-
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id !== match[2] ) {
- return rootjQuery.find( selector );
- }
-
- // Otherwise, we inject the element directly into the jQuery object
- this.length = 1;
- this[0] = elem;
- }
-
- this.context = document;
- this.selector = selector;
- return this;
- }
-
- // HANDLE: $(expr, $(...))
- } else if ( !context || context.jquery ) {
- return ( context || rootjQuery ).find( selector );
-
- // HANDLE: $(expr, context)
- // (which is just equivalent to: $(context).find(expr)
- } else {
- return this.constructor( context ).find( selector );
- }
-
- // HANDLE: $(function)
- // Shortcut for document ready
- } else if ( jQuery.isFunction( selector ) ) {
- return rootjQuery.ready( selector );
- }
-
- if ( selector.selector !== undefined ) {
- this.selector = selector.selector;
- this.context = selector.context;
- }
-
- return jQuery.makeArray( selector, this );
- },
-
- // Start with an empty selector
- selector: "",
-
- // The current version of jQuery being used
- jquery: "1.7.1",
-
- // The default length of a jQuery object is 0
- length: 0,
-
- // The number of elements contained in the matched element set
- size: function() {
- return this.length;
- },
-
- toArray: function() {
- return slice.call( this, 0 );
- },
-
- // Get the Nth element in the matched element set OR
- // Get the whole matched element set as a clean array
- get: function( num ) {
- return num == null ?
-
- // Return a 'clean' array
- this.toArray() :
-
- // Return just the object
- ( num < 0 ? this[ this.length + num ] : this[ num ] );
- },
-
- // Take an array of elements and push it onto the stack
- // (returning the new matched element set)
- pushStack: function( elems, name, selector ) {
- // Build a new jQuery matched element set
- var ret = this.constructor();
-
- if ( jQuery.isArray( elems ) ) {
- push.apply( ret, elems );
-
- } else {
- jQuery.merge( ret, elems );
- }
-
- // Add the old object onto the stack (as a reference)
- ret.prevObject = this;
-
- ret.context = this.context;
-
- if ( name === "find" ) {
- ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
- } else if ( name ) {
- ret.selector = this.selector + "." + name + "(" + selector + ")";
- }
-
- // Return the newly-formed element set
- return ret;
- },
-
- // Execute a callback for every element in the matched set.
- // (You can seed the arguments with an array of args, but this is
- // only used internally.)
- each: function( callback, args ) {
- return jQuery.each( this, callback, args );
- },
-
- ready: function( fn ) {
- // Attach the listeners
- jQuery.bindReady();
-
- // Add the callback
- readyList.add( fn );
-
- return this;
- },
-
- eq: function( i ) {
- i = +i;
- return i === -1 ?
- this.slice( i ) :
- this.slice( i, i + 1 );
- },
-
- first: function() {
- return this.eq( 0 );
- },
-
- last: function() {
- return this.eq( -1 );
- },
-
- slice: function() {
- return this.pushStack( slice.apply( this, arguments ),
- "slice", slice.call(arguments).join(",") );
- },
-
- map: function( callback ) {
- return this.pushStack( jQuery.map(this, function( elem, i ) {
- return callback.call( elem, i, elem );
- }));
- },
-
- end: function() {
- return this.prevObject || this.constructor(null);
- },
-
- // For internal use only.
- // Behaves like an Array's method, not like a jQuery method.
- push: push,
- sort: [].sort,
- splice: [].splice
-};
-
-// Give the init function the jQuery prototype for later instantiation
-jQuery.fn.init.prototype = jQuery.fn;
-
-jQuery.extend = jQuery.fn.extend = function() {
- var options, name, src, copy, copyIsArray, clone,
- target = arguments[0] || {},
- i = 1,
- length = arguments.length,
- deep = false;
-
- // Handle a deep copy situation
- if ( typeof target === "boolean" ) {
- deep = target;
- target = arguments[1] || {};
- // skip the boolean and the target
- i = 2;
- }
-
- // Handle case when target is a string or something (possible in deep copy)
- if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
- target = {};
- }
-
- // extend jQuery itself if only one argument is passed
- if ( length === i ) {
- target = this;
- --i;
- }
-
- for ( ; i < length; i++ ) {
- // Only deal with non-null/undefined values
- if ( (options = arguments[ i ]) != null ) {
- // Extend the base object
- for ( name in options ) {
- src = target[ name ];
- copy = options[ name ];
-
- // Prevent never-ending loop
- if ( target === copy ) {
- continue;
- }
-
- // Recurse if we're merging plain objects or arrays
- if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
- if ( copyIsArray ) {
- copyIsArray = false;
- clone = src && jQuery.isArray(src) ? src : [];
-
- } else {
- clone = src && jQuery.isPlainObject(src) ? src : {};
- }
-
- // Never move original objects, clone them
- target[ name ] = jQuery.extend( deep, clone, copy );
-
- // Don't bring in undefined values
- } else if ( copy !== undefined ) {
- target[ name ] = copy;
- }
- }
- }
- }
-
- // Return the modified object
- return target;
-};
-
-jQuery.extend({
- noConflict: function( deep ) {
- if ( window.$ === jQuery ) {
- window.$ = _$;
- }
-
- if ( deep && window.jQuery === jQuery ) {
- window.jQuery = _jQuery;
- }
-
- return jQuery;
- },
-
- // Is the DOM ready to be used? Set to true once it occurs.
- isReady: false,
-
- // A counter to track how many items to wait for before
- // the ready event fires. See #6781
- readyWait: 1,
-
- // Hold (or release) the ready event
- holdReady: function( hold ) {
- if ( hold ) {
- jQuery.readyWait++;
- } else {
- jQuery.ready( true );
- }
- },
-
- // Handle when the DOM is ready
- ready: function( wait ) {
- // Either a released hold or an DOMready/load event and not yet ready
- if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
- if ( !document.body ) {
- return setTimeout( jQuery.ready, 1 );
- }
-
- // Remember that the DOM is ready
- jQuery.isReady = true;
-
- // If a normal DOM Ready event fired, decrement, and wait if need be
- if ( wait !== true && --jQuery.readyWait > 0 ) {
- return;
- }
-
- // If there are functions bound, to execute
- readyList.fireWith( document, [ jQuery ] );
-
- // Trigger any bound ready events
- if ( jQuery.fn.trigger ) {
- jQuery( document ).trigger( "ready" ).off( "ready" );
- }
- }
- },
-
- bindReady: function() {
- if ( readyList ) {
- return;
- }
-
- readyList = jQuery.Callbacks( "once memory" );
-
- // Catch cases where $(document).ready() is called after the
- // browser event has already occurred.
- if ( document.readyState === "complete" ) {
- // Handle it asynchronously to allow scripts the opportunity to delay ready
- return setTimeout( jQuery.ready, 1 );
- }
-
- // Mozilla, Opera and webkit nightlies currently support this event
- if ( document.addEventListener ) {
- // Use the handy event callback
- document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
-
- // A fallback to window.onload, that will always work
- window.addEventListener( "load", jQuery.ready, false );
-
- // If IE event model is used
- } else if ( document.attachEvent ) {
- // ensure firing before onload,
- // maybe late but safe also for iframes
- document.attachEvent( "onreadystatechange", DOMContentLoaded );
-
- // A fallback to window.onload, that will always work
- window.attachEvent( "onload", jQuery.ready );
-
- // If IE and not a frame
- // continually check to see if the document is ready
- var toplevel = false;
-
- try {
- toplevel = window.frameElement == null;
- } catch(e) {}
-
- if ( document.documentElement.doScroll && toplevel ) {
- doScrollCheck();
- }
- }
- },
-
- // See test/unit/core.js for details concerning isFunction.
- // Since version 1.3, DOM methods and functions like alert
- // aren't supported. They return false on IE (#2968).
- isFunction: function( obj ) {
- return jQuery.type(obj) === "function";
- },
-
- isArray: Array.isArray || function( obj ) {
- return jQuery.type(obj) === "array";
- },
-
- // A crude way of determining if an object is a window
- isWindow: function( obj ) {
- return obj && typeof obj === "object" && "setInterval" in obj;
- },
-
- isNumeric: function( obj ) {
- return !isNaN( parseFloat(obj) ) && isFinite( obj );
- },
-
- type: function( obj ) {
- return obj == null ?
- String( obj ) :
- class2type[ toString.call(obj) ] || "object";
- },
-
- isPlainObject: function( obj ) {
- // Must be an Object.
- // Because of IE, we also have to check the presence of the constructor property.
- // Make sure that DOM nodes and window objects don't pass through, as well
- if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
- return false;
- }
-
- try {
- // Not own constructor property must be Object
- if ( obj.constructor &&
- !hasOwn.call(obj, "constructor") &&
- !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
- return false;
- }
- } catch ( e ) {
- // IE8,9 Will throw exceptions on certain host objects #9897
- return false;
- }
-
- // Own properties are enumerated firstly, so to speed up,
- // if last one is own, then all properties are own.
-
- var key;
- for ( key in obj ) {}
-
- return key === undefined || hasOwn.call( obj, key );
- },
-
- isEmptyObject: function( obj ) {
- for ( var name in obj ) {
- return false;
- }
- return true;
- },
-
- error: function( msg ) {
- throw new Error( msg );
- },
-
- parseJSON: function( data ) {
- if ( typeof data !== "string" || !data ) {
- return null;
- }
-
- // Make sure leading/trailing whitespace is removed (IE can't handle it)
- data = jQuery.trim( data );
-
- // Attempt to parse using the native JSON parser first
- if ( window.JSON && window.JSON.parse ) {
- return window.JSON.parse( data );
- }
-
- // Make sure the incoming data is actual JSON
- // Logic borrowed from http://json.org/json2.js
- if ( rvalidchars.test( data.replace( rvalidescape, "@" )
- .replace( rvalidtokens, "]" )
- .replace( rvalidbraces, "")) ) {
-
- return ( new Function( "return " + data ) )();
-
- }
- jQuery.error( "Invalid JSON: " + data );
- },
-
- // Cross-browser xml parsing
- parseXML: function( data ) {
- var xml, tmp;
- try {
- if ( window.DOMParser ) { // Standard
- tmp = new DOMParser();
- xml = tmp.parseFromString( data , "text/xml" );
- } else { // IE
- xml = new ActiveXObject( "Microsoft.XMLDOM" );
- xml.async = "false";
- xml.loadXML( data );
- }
- } catch( e ) {
- xml = undefined;
- }
- if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
- jQuery.error( "Invalid XML: " + data );
- }
- return xml;
- },
-
- noop: function() {},
-
- // Evaluates a script in a global context
- // Workarounds based on findings by Jim Driscoll
- // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
- globalEval: function( data ) {
- if ( data && rnotwhite.test( data ) ) {
- // We use execScript on Internet Explorer
- // We use an anonymous function so that context is window
- // rather than jQuery in Firefox
- ( window.execScript || function( data ) {
- window[ "eval" ].call( window, data );
- } )( data );
- }
- },
-
- // Convert dashed to camelCase; used by the css and data modules
- // Microsoft forgot to hump their vendor prefix (#9572)
- camelCase: function( string ) {
- return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
- },
-
- nodeName: function( elem, name ) {
- return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
- },
-
- // args is for internal usage only
- each: function( object, callback, args ) {
- var name, i = 0,
- length = object.length,
- isObj = length === undefined || jQuery.isFunction( object );
-
- if ( args ) {
- if ( isObj ) {
- for ( name in object ) {
- if ( callback.apply( object[ name ], args ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.apply( object[ i++ ], args ) === false ) {
- break;
- }
- }
- }
-
- // A special, fast, case for the most common use of each
- } else {
- if ( isObj ) {
- for ( name in object ) {
- if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
- break;
- }
- }
- } else {
- for ( ; i < length; ) {
- if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
- break;
- }
- }
- }
- }
-
- return object;
- },
-
- // Use native String.trim function wherever possible
- trim: trim ?
- function( text ) {
- return text == null ?
- "" :
- trim.call( text );
- } :
-
- // Otherwise use our own trimming functionality
- function( text ) {
- return text == null ?
- "" :
- text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
- },
-
- // results is for internal usage only
- makeArray: function( array, results ) {
- var ret = results || [];
-
- if ( array != null ) {
- // The window, strings (and functions) also have 'length'
- // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
- var type = jQuery.type( array );
-
- if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
- push.call( ret, array );
- } else {
- jQuery.merge( ret, array );
- }
- }
-
- return ret;
- },
-
- inArray: function( elem, array, i ) {
- var len;
-
- if ( array ) {
- if ( indexOf ) {
- return indexOf.call( array, elem, i );
- }
-
- len = array.length;
- i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
-
- for ( ; i < len; i++ ) {
- // Skip accessing in sparse arrays
- if ( i in array && array[ i ] === elem ) {
- return i;
- }
- }
- }
-
- return -1;
- },
-
- merge: function( first, second ) {
- var i = first.length,
- j = 0;
-
- if ( typeof second.length === "number" ) {
- for ( var l = second.length; j < l; j++ ) {
- first[ i++ ] = second[ j ];
- }
-
- } else {
- while ( second[j] !== undefined ) {
- first[ i++ ] = second[ j++ ];
- }
- }
-
- first.length = i;
-
- return first;
- },
-
- grep: function( elems, callback, inv ) {
- var ret = [], retVal;
- inv = !!inv;
-
- // Go through the array, only saving the items
- // that pass the validator function
- for ( var i = 0, length = elems.length; i < length; i++ ) {
- retVal = !!callback( elems[ i ], i );
- if ( inv !== retVal ) {
- ret.push( elems[ i ] );
- }
- }
-
- return ret;
- },
-
- // arg is for internal usage only
- map: function( elems, callback, arg ) {
- var value, key, ret = [],
- i = 0,
- length = elems.length,
- // jquery objects are treated as arrays
- isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
-
- // Go through the array, translating each of the items to their
- if ( isArray ) {
- for ( ; i < length; i++ ) {
- value = callback( elems[ i ], i, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
-
- // Go through every key on the object,
- } else {
- for ( key in elems ) {
- value = callback( elems[ key ], key, arg );
-
- if ( value != null ) {
- ret[ ret.length ] = value;
- }
- }
- }
-
- // Flatten any nested arrays
- return ret.concat.apply( [], ret );
- },
-
- // A global GUID counter for objects
- guid: 1,
-
- // Bind a function to a context, optionally partially applying any
- // arguments.
- proxy: function( fn, context ) {
- if ( typeof context === "string" ) {
- var tmp = fn[ context ];
- context = fn;
- fn = tmp;
- }
-
- // Quick check to determine if target is callable, in the spec
- // this throws a TypeError, but we will just return undefined.
- if ( !jQuery.isFunction( fn ) ) {
- return undefined;
- }
-
- // Simulated bind
- var args = slice.call( arguments, 2 ),
- proxy = function() {
- return fn.apply( context, args.concat( slice.call( arguments ) ) );
- };
-
- // Set the guid of unique handler to the same of original handler, so it can be removed
- proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
-
- return proxy;
- },
-
- // Mutifunctional method to get and set values to a collection
- // The value/s can optionally be executed if it's a function
- access: function( elems, key, value, exec, fn, pass ) {
- var length = elems.length;
-
- // Setting many attributes
- if ( typeof key === "object" ) {
- for ( var k in key ) {
- jQuery.access( elems, k, key[k], exec, fn, value );
- }
- return elems;
- }
-
- // Setting one attribute
- if ( value !== undefined ) {
- // Optionally, function values get executed if exec is true
- exec = !pass && exec && jQuery.isFunction(value);
-
- for ( var i = 0; i < length; i++ ) {
- fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
- }
-
- return elems;
- }
-
- // Getting an attribute
- return length ? fn( elems[0], key ) : undefined;
- },
-
- now: function() {
- return ( new Date() ).getTime();
- },
-
- // Use of jQuery.browser is frowned upon.
- // More details: http://docs.jquery.com/Utilities/jQuery.browser
- uaMatch: function( ua ) {
- ua = ua.toLowerCase();
-
- var match = rwebkit.exec( ua ) ||
- ropera.exec( ua ) ||
- rmsie.exec( ua ) ||
- ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
- [];
-
- return { browser: match[1] || "", version: match[2] || "0" };
- },
-
- sub: function() {
- function jQuerySub( selector, context ) {
- return new jQuerySub.fn.init( selector, context );
- }
- jQuery.extend( true, jQuerySub, this );
- jQuerySub.superclass = this;
- jQuerySub.fn = jQuerySub.prototype = this();
- jQuerySub.fn.constructor = jQuerySub;
- jQuerySub.sub = this.sub;
- jQuerySub.fn.init = function init( selector, context ) {
- if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
- context = jQuerySub( context );
- }
-
- return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
- };
- jQuerySub.fn.init.prototype = jQuerySub.fn;
- var rootjQuerySub = jQuerySub(document);
- return jQuerySub;
- },
-
- browser: {}
-});
-
-// Populate the class2type map
-jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
- class2type[ "[object " + name + "]" ] = name.toLowerCase();
-});
-
-browserMatch = jQuery.uaMatch( userAgent );
-if ( browserMatch.browser ) {
- jQuery.browser[ browserMatch.browser ] = true;
- jQuery.browser.version = browserMatch.version;
-}
-
-// Deprecated, use jQuery.browser.webkit instead
-if ( jQuery.browser.webkit ) {
- jQuery.browser.safari = true;
-}
-
-// IE doesn't match non-breaking spaces with \s
-if ( rnotwhite.test( "\xA0" ) ) {
- trimLeft = /^[\s\xA0]+/;
- trimRight = /[\s\xA0]+$/;
-}
-
-// All jQuery objects should point back to these
-rootjQuery = jQuery(document);
-
-// Cleanup functions for the document ready method
-if ( document.addEventListener ) {
- DOMContentLoaded = function() {
- document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
- jQuery.ready();
- };
-
-} else if ( document.attachEvent ) {
- DOMContentLoaded = function() {
- // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
- if ( document.readyState === "complete" ) {
- document.detachEvent( "onreadystatechange", DOMContentLoaded );
- jQuery.ready();
- }
- };
-}
-
-// The DOM ready check for Internet Explorer
-function doScrollCheck() {
- if ( jQuery.isReady ) {
- return;
- }
-
- try {
- // If IE is used, use the trick by Diego Perini
- // http://javascript.nwbox.com/IEContentLoaded/
- document.documentElement.doScroll("left");
- } catch(e) {
- setTimeout( doScrollCheck, 1 );
- return;
- }
-
- // and execute any waiting functions
- jQuery.ready();
-}
-
-return jQuery;
-
-})();
-
-
-// String to Object flags format cache
-var flagsCache = {};
-
-// Convert String-formatted flags into Object-formatted ones and store in cache
-function createFlags( flags ) {
- var object = flagsCache[ flags ] = {},
- i, length;
- flags = flags.split( /\s+/ );
- for ( i = 0, length = flags.length; i < length; i++ ) {
- object[ flags[i] ] = true;
- }
- return object;
-}
-
-/*
- * Create a callback list using the following parameters:
- *
- * flags: an optional list of space-separated flags that will change how
- * the callback list behaves
- *
- * By default a callback list will act like an event callback list and can be
- * "fired" multiple times.
- *
- * Possible flags:
- *
- * once: will ensure the callback list can only be fired once (like a Deferred)
- *
- * memory: will keep track of previous values and will call any callback added
- * after the list has been fired right away with the latest "memorized"
- * values (like a Deferred)
- *
- * unique: will ensure a callback can only be added once (no duplicate in the list)
- *
- * stopOnFalse: interrupt callings when a callback returns false
- *
- */
-jQuery.Callbacks = function( flags ) {
-
- // Convert flags from String-formatted to Object-formatted
- // (we check in cache first)
- flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
-
- var // Actual callback list
- list = [],
- // Stack of fire calls for repeatable lists
- stack = [],
- // Last fire value (for non-forgettable lists)
- memory,
- // Flag to know if list is currently firing
- firing,
- // First callback to fire (used internally by add and fireWith)
- firingStart,
- // End of the loop when firing
- firingLength,
- // Index of currently firing callback (modified by remove if needed)
- firingIndex,
- // Add one or several callbacks to the list
- add = function( args ) {
- var i,
- length,
- elem,
- type,
- actual;
- for ( i = 0, length = args.length; i < length; i++ ) {
- elem = args[ i ];
- type = jQuery.type( elem );
- if ( type === "array" ) {
- // Inspect recursively
- add( elem );
- } else if ( type === "function" ) {
- // Add if not in unique mode and callback is not in
- if ( !flags.unique || !self.has( elem ) ) {
- list.push( elem );
- }
- }
- }
- },
- // Fire callbacks
- fire = function( context, args ) {
- args = args || [];
- memory = !flags.memory || [ context, args ];
- firing = true;
- firingIndex = firingStart || 0;
- firingStart = 0;
- firingLength = list.length;
- for ( ; list && firingIndex < firingLength; firingIndex++ ) {
- if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
- memory = true; // Mark as halted
- break;
- }
- }
- firing = false;
- if ( list ) {
- if ( !flags.once ) {
- if ( stack && stack.length ) {
- memory = stack.shift();
- self.fireWith( memory[ 0 ], memory[ 1 ] );
- }
- } else if ( memory === true ) {
- self.disable();
- } else {
- list = [];
- }
- }
- },
- // Actual Callbacks object
- self = {
- // Add a callback or a collection of callbacks to the list
- add: function() {
- if ( list ) {
- var length = list.length;
- add( arguments );
- // Do we need to add the callbacks to the
- // current firing batch?
- if ( firing ) {
- firingLength = list.length;
- // With memory, if we're not firing then
- // we should call right away, unless previous
- // firing was halted (stopOnFalse)
- } else if ( memory && memory !== true ) {
- firingStart = length;
- fire( memory[ 0 ], memory[ 1 ] );
- }
- }
- return this;
- },
- // Remove a callback from the list
- remove: function() {
- if ( list ) {
- var args = arguments,
- argIndex = 0,
- argLength = args.length;
- for ( ; argIndex < argLength ; argIndex++ ) {
- for ( var i = 0; i < list.length; i++ ) {
- if ( args[ argIndex ] === list[ i ] ) {
- // Handle firingIndex and firingLength
- if ( firing ) {
- if ( i <= firingLength ) {
- firingLength--;
- if ( i <= firingIndex ) {
- firingIndex--;
- }
- }
- }
- // Remove the element
- list.splice( i--, 1 );
- // If we have some unicity property then
- // we only need to do this once
- if ( flags.unique ) {
- break;
- }
- }
- }
- }
- }
- return this;
- },
- // Control if a given callback is in the list
- has: function( fn ) {
- if ( list ) {
- var i = 0,
- length = list.length;
- for ( ; i < length; i++ ) {
- if ( fn === list[ i ] ) {
- return true;
- }
- }
- }
- return false;
- },
- // Remove all callbacks from the list
- empty: function() {
- list = [];
- return this;
- },
- // Have the list do nothing anymore
- disable: function() {
- list = stack = memory = undefined;
- return this;
- },
- // Is it disabled?
- disabled: function() {
- return !list;
- },
- // Lock the list in its current state
- lock: function() {
- stack = undefined;
- if ( !memory || memory === true ) {
- self.disable();
- }
- return this;
- },
- // Is it locked?
- locked: function() {
- return !stack;
- },
- // Call all callbacks with the given context and arguments
- fireWith: function( context, args ) {
- if ( stack ) {
- if ( firing ) {
- if ( !flags.once ) {
- stack.push( [ context, args ] );
- }
- } else if ( !( flags.once && memory ) ) {
- fire( context, args );
- }
- }
- return this;
- },
- // Call all the callbacks with the given arguments
- fire: function() {
- self.fireWith( this, arguments );
- return this;
- },
- // To know if the callbacks have already been called at least once
- fired: function() {
- return !!memory;
- }
- };
-
- return self;
-};
-
-
-
-
-var // Static reference to slice
- sliceDeferred = [].slice;
-
-jQuery.extend({
-
- Deferred: function( func ) {
- var doneList = jQuery.Callbacks( "once memory" ),
- failList = jQuery.Callbacks( "once memory" ),
- progressList = jQuery.Callbacks( "memory" ),
- state = "pending",
- lists = {
- resolve: doneList,
- reject: failList,
- notify: progressList
- },
- promise = {
- done: doneList.add,
- fail: failList.add,
- progress: progressList.add,
-
- state: function() {
- return state;
- },
-
- // Deprecated
- isResolved: doneList.fired,
- isRejected: failList.fired,
-
- then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
- deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
- return this;
- },
- always: function() {
- deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
- return this;
- },
- pipe: function( fnDone, fnFail, fnProgress ) {
- return jQuery.Deferred(function( newDefer ) {
- jQuery.each( {
- done: [ fnDone, "resolve" ],
- fail: [ fnFail, "reject" ],
- progress: [ fnProgress, "notify" ]
- }, function( handler, data ) {
- var fn = data[ 0 ],
- action = data[ 1 ],
- returned;
- if ( jQuery.isFunction( fn ) ) {
- deferred[ handler ](function() {
- returned = fn.apply( this, arguments );
- if ( returned && jQuery.isFunction( returned.promise ) ) {
- returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
- } else {
- newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
- }
- });
- } else {
- deferred[ handler ]( newDefer[ action ] );
- }
- });
- }).promise();
- },
- // Get a promise for this deferred
- // If obj is provided, the promise aspect is added to the object
- promise: function( obj ) {
- if ( obj == null ) {
- obj = promise;
- } else {
- for ( var key in promise ) {
- obj[ key ] = promise[ key ];
- }
- }
- return obj;
- }
- },
- deferred = promise.promise({}),
- key;
-
- for ( key in lists ) {
- deferred[ key ] = lists[ key ].fire;
- deferred[ key + "With" ] = lists[ key ].fireWith;
- }
-
- // Handle state
- deferred.done( function() {
- state = "resolved";
- }, failList.disable, progressList.lock ).fail( function() {
- state = "rejected";
- }, doneList.disable, progressList.lock );
-
- // Call given func if any
- if ( func ) {
- func.call( deferred, deferred );
- }
-
- // All done!
- return deferred;
- },
-
- // Deferred helper
- when: function( firstParam ) {
- var args = sliceDeferred.call( arguments, 0 ),
- i = 0,
- length = args.length,
- pValues = new Array( length ),
- count = length,
- pCount = length,
- deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
- firstParam :
- jQuery.Deferred(),
- promise = deferred.promise();
- function resolveFunc( i ) {
- return function( value ) {
- args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
- if ( !( --count ) ) {
- deferred.resolveWith( deferred, args );
- }
- };
- }
- function progressFunc( i ) {
- return function( value ) {
- pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
- deferred.notifyWith( promise, pValues );
- };
- }
- if ( length > 1 ) {
- for ( ; i < length; i++ ) {
- if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
- args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
- } else {
- --count;
- }
- }
- if ( !count ) {
- deferred.resolveWith( deferred, args );
- }
- } else if ( deferred !== firstParam ) {
- deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
- }
- return promise;
- }
-});
-
-
-
-
-jQuery.support = (function() {
-
- var support,
- all,
- a,
- select,
- opt,
- input,
- marginDiv,
- fragment,
- tds,
- events,
- eventName,
- i,
- isSupported,
- div = document.createElement( "div" ),
- documentElement = document.documentElement;
-
- // Preliminary tests
- div.setAttribute("className", "t");
- div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
-
- all = div.getElementsByTagName( "*" );
- a = div.getElementsByTagName( "a" )[ 0 ];
-
- // Can't get basic test support
- if ( !all || !all.length || !a ) {
- return {};
- }
-
- // First batch of supports tests
- select = document.createElement( "select" );
- opt = select.appendChild( document.createElement("option") );
- input = div.getElementsByTagName( "input" )[ 0 ];
-
- support = {
- // IE strips leading whitespace when .innerHTML is used
- leadingWhitespace: ( div.firstChild.nodeType === 3 ),
-
- // Make sure that tbody elements aren't automatically inserted
- // IE will insert them into empty tables
- tbody: !div.getElementsByTagName("tbody").length,
-
- // Make sure that link elements get serialized correctly by innerHTML
- // This requires a wrapper element in IE
- htmlSerialize: !!div.getElementsByTagName("link").length,
-
- // Get the style information from getAttribute
- // (IE uses .cssText instead)
- style: /top/.test( a.getAttribute("style") ),
-
- // Make sure that URLs aren't manipulated
- // (IE normalizes it by default)
- hrefNormalized: ( a.getAttribute("href") === "/a" ),
-
- // Make sure that element opacity exists
- // (IE uses filter instead)
- // Use a regex to work around a WebKit issue. See #5145
- opacity: /^0.55/.test( a.style.opacity ),
-
- // Verify style float existence
- // (IE uses styleFloat instead of cssFloat)
- cssFloat: !!a.style.cssFloat,
-
- // Make sure that if no value is specified for a checkbox
- // that it defaults to "on".
- // (WebKit defaults to "" instead)
- checkOn: ( input.value === "on" ),
-
- // Make sure that a selected-by-default option has a working selected property.
- // (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
- optSelected: opt.selected,
-
- // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
- getSetAttribute: div.className !== "t",
-
- // Tests for enctype support on a form(#6743)
- enctype: !!document.createElement("form").enctype,
-
- // Makes sure cloning an html5 element does not cause problems
- // Where outerHTML is undefined, this still works
- html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
-
- // Will be defined later
- submitBubbles: true,
- changeBubbles: true,
- focusinBubbles: false,
- deleteExpando: true,
- noCloneEvent: true,
- inlineBlockNeedsLayout: false,
- shrinkWrapBlocks: false,
- reliableMarginRight: true
- };
-
- // Make sure checked status is properly cloned
- input.checked = true;
- support.noCloneChecked = input.cloneNode( true ).checked;
-
- // Make sure that the options inside disabled selects aren't marked as disabled
- // (WebKit marks them as disabled)
- select.disabled = true;
- support.optDisabled = !opt.disabled;
-
- // Test to see if it's possible to delete an expando from an element
- // Fails in Internet Explorer
- try {
- delete div.test;
- } catch( e ) {
- support.deleteExpando = false;
- }
-
- if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
- div.attachEvent( "onclick", function() {
- // Cloning a node shouldn't copy over any
- // bound event handlers (IE does this)
- support.noCloneEvent = false;
- });
- div.cloneNode( true ).fireEvent( "onclick" );
- }
-
- // Check if a radio maintains its value
- // after being appended to the DOM
- input = document.createElement("input");
- input.value = "t";
- input.setAttribute("type", "radio");
- support.radioValue = input.value === "t";
-
- input.setAttribute("checked", "checked");
- div.appendChild( input );
- fragment = document.createDocumentFragment();
- fragment.appendChild( div.lastChild );
-
- // WebKit doesn't clone checked state correctly in fragments
- support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
-
- // Check if a disconnected checkbox will retain its checked
- // value of true after appended to the DOM (IE6/7)
- support.appendChecked = input.checked;
-
- fragment.removeChild( input );
- fragment.appendChild( div );
-
- div.innerHTML = "";
-
- // Check if div with explicit width and no margin-right incorrectly
- // gets computed margin-right based on width of container. For more
- // info see bug #3333
- // Fails in WebKit before Feb 2011 nightlies
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- if ( window.getComputedStyle ) {
- marginDiv = document.createElement( "div" );
- marginDiv.style.width = "0";
- marginDiv.style.marginRight = "0";
- div.style.width = "2px";
- div.appendChild( marginDiv );
- support.reliableMarginRight =
- ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
- }
-
- // Technique from Juriy Zaytsev
- // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
- // We only care about the case where non-standard event systems
- // are used, namely in IE. Short-circuiting here helps us to
- // avoid an eval call (in setAttribute) which can cause CSP
- // to go haywire. See: https://developer.mozilla.org/en/Security/CSP
- if ( div.attachEvent ) {
- for( i in {
- submit: 1,
- change: 1,
- focusin: 1
- }) {
- eventName = "on" + i;
- isSupported = ( eventName in div );
- if ( !isSupported ) {
- div.setAttribute( eventName, "return;" );
- isSupported = ( typeof div[ eventName ] === "function" );
- }
- support[ i + "Bubbles" ] = isSupported;
- }
- }
-
- fragment.removeChild( div );
-
- // Null elements to avoid leaks in IE
- fragment = select = opt = marginDiv = div = input = null;
-
- // Run tests that need a body at doc ready
- jQuery(function() {
- var container, outer, inner, table, td, offsetSupport,
- conMarginTop, ptlm, vb, style, html,
- body = document.getElementsByTagName("body")[0];
-
- if ( !body ) {
- // Return for frameset docs that don't have a body
- return;
- }
-
- conMarginTop = 1;
- ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";
- vb = "visibility:hidden;border:0;";
- style = "style='" + ptlm + "border:5px solid #000;padding:0;'";
- html = "<div " + style + "><div></div></div>" +
- "<table " + style + " cellpadding='0' cellspacing='0'>" +
- "<tr><td></td></tr></table>";
-
- container = document.createElement("div");
- container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
- body.insertBefore( container, body.firstChild );
-
- // Construct the test element
- div = document.createElement("div");
- container.appendChild( div );
-
- // Check if table cells still have offsetWidth/Height when they are set
- // to display:none and there are still other visible table cells in a
- // table row; if so, offsetWidth/Height are not reliable for use when
- // determining if an element has been hidden directly using
- // display:none (it is still safe to use offsets if a parent element is
- // hidden; don safety goggles and see bug #4512 for more information).
- // (only IE 8 fails this test)
- div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
- tds = div.getElementsByTagName( "td" );
- isSupported = ( tds[ 0 ].offsetHeight === 0 );
-
- tds[ 0 ].style.display = "";
- tds[ 1 ].style.display = "none";
-
- // Check if empty table cells still have offsetWidth/Height
- // (IE <= 8 fail this test)
- support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
-
- // Figure out if the W3C box model works as expected
- div.innerHTML = "";
- div.style.width = div.style.paddingLeft = "1px";
- jQuery.boxModel = support.boxModel = div.offsetWidth === 2;
-
- if ( typeof div.style.zoom !== "undefined" ) {
- // Check if natively block-level elements act like inline-block
- // elements when setting their display to 'inline' and giving
- // them layout
- // (IE < 8 does this)
- div.style.display = "inline";
- div.style.zoom = 1;
- support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
-
- // Check if elements with layout shrink-wrap their children
- // (IE 6 does this)
- div.style.display = "";
- div.innerHTML = "<div style='width:4px;'></div>";
- support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
- }
-
- div.style.cssText = ptlm + vb;
- div.innerHTML = html;
-
- outer = div.firstChild;
- inner = outer.firstChild;
- td = outer.nextSibling.firstChild.firstChild;
-
- offsetSupport = {
- doesNotAddBorder: ( inner.offsetTop !== 5 ),
- doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
- };
-
- inner.style.position = "fixed";
- inner.style.top = "20px";
-
- // safari subtracts parent border width here which is 5px
- offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
- inner.style.position = inner.style.top = "";
-
- outer.style.overflow = "hidden";
- outer.style.position = "relative";
-
- offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
- offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
-
- body.removeChild( container );
- div = container = null;
-
- jQuery.extend( support, offsetSupport );
- });
-
- return support;
-})();
-
-
-
-
-var rbrace = /^(?:\{.*\}|\[.*\])$/,
- rmultiDash = /([A-Z])/g;
-
-jQuery.extend({
- cache: {},
-
- // Please use with caution
- uuid: 0,
-
- // Unique for each copy of jQuery on the page
- // Non-digits removed to match rinlinejQuery
- expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
-
- // The following elements throw uncatchable exceptions if you
- // attempt to add expando properties to them.
- noData: {
- "embed": true,
- // Ban all objects except for Flash (which handle expandos)
- "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
- "applet": true
- },
-
- hasData: function( elem ) {
- elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
- return !!elem && !isEmptyDataObject( elem );
- },
-
- data: function( elem, name, data, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var privateCache, thisCache, ret,
- internalKey = jQuery.expando,
- getByName = typeof name === "string",
-
- // We have to handle DOM nodes and JS objects differently because IE6-7
- // can't GC object references properly across the DOM-JS boundary
- isNode = elem.nodeType,
-
- // Only DOM nodes need the global jQuery cache; JS object data is
- // attached directly to the object so GC can occur automatically
- cache = isNode ? jQuery.cache : elem,
-
- // Only defining an ID for JS objects if its cache already exists allows
- // the code to shortcut on the same path as a DOM node with no cache
- id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,
- isEvents = name === "events";
-
- // Avoid doing any more work than we need to when trying to get data on an
- // object that has no data at all
- if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
- return;
- }
-
- if ( !id ) {
- // Only DOM nodes need a new unique ID for each element since their data
- // ends up in the global cache
- if ( isNode ) {
- elem[ internalKey ] = id = ++jQuery.uuid;
- } else {
- id = internalKey;
- }
- }
-
- if ( !cache[ id ] ) {
- cache[ id ] = {};
-
- // Avoids exposing jQuery metadata on plain JS objects when the object
- // is serialized using JSON.stringify
- if ( !isNode ) {
- cache[ id ].toJSON = jQuery.noop;
- }
- }
-
- // An object can be passed to jQuery.data instead of a key/value pair; this gets
- // shallow copied over onto the existing cache
- if ( typeof name === "object" || typeof name === "function" ) {
- if ( pvt ) {
- cache[ id ] = jQuery.extend( cache[ id ], name );
- } else {
- cache[ id ].data = jQuery.extend( cache[ id ].data, name );
- }
- }
-
- privateCache = thisCache = cache[ id ];
-
- // jQuery data() is stored in a separate object inside the object's internal data
- // cache in order to avoid key collisions between internal data and user-defined
- // data.
- if ( !pvt ) {
- if ( !thisCache.data ) {
- thisCache.data = {};
- }
-
- thisCache = thisCache.data;
- }
-
- if ( data !== undefined ) {
- thisCache[ jQuery.camelCase( name ) ] = data;
- }
-
- // Users should not attempt to inspect the internal events object using jQuery.data,
- // it is undocumented and subject to change. But does anyone listen? No.
- if ( isEvents && !thisCache[ name ] ) {
- return privateCache.events;
- }
-
- // Check for both converted-to-camel and non-converted data property names
- // If a data property was specified
- if ( getByName ) {
-
- // First Try to find as-is property data
- ret = thisCache[ name ];
-
- // Test for null|undefined property data
- if ( ret == null ) {
-
- // Try to find the camelCased property
- ret = thisCache[ jQuery.camelCase( name ) ];
- }
- } else {
- ret = thisCache;
- }
-
- return ret;
- },
-
- removeData: function( elem, name, pvt /* Internal Use Only */ ) {
- if ( !jQuery.acceptData( elem ) ) {
- return;
- }
-
- var thisCache, i, l,
-
- // Reference to internal data cache key
- internalKey = jQuery.expando,
-
- isNode = elem.nodeType,
-
- // See jQuery.data for more information
- cache = isNode ? jQuery.cache : elem,
-
- // See jQuery.data for more information
- id = isNode ? elem[ internalKey ] : internalKey;
-
- // If there is already no cache entry for this object, there is no
- // purpose in continuing
- if ( !cache[ id ] ) {
- return;
- }
-
- if ( name ) {
-
- thisCache = pvt ? cache[ id ] : cache[ id ].data;
-
- if ( thisCache ) {
-
- // Support array or space separated string names for data keys
- if ( !jQuery.isArray( name ) ) {
-
- // try the string as a key before any manipulation
- if ( name in thisCache ) {
- name = [ name ];
- } else {
-
- // split the camel cased version by spaces unless a key with the spaces exists
- name = jQuery.camelCase( name );
- if ( name in thisCache ) {
- name = [ name ];
- } else {
- name = name.split( " " );
- }
- }
- }
-
- for ( i = 0, l = name.length; i < l; i++ ) {
- delete thisCache[ name[i] ];
- }
-
- // If there is no data left in the cache, we want to continue
- // and let the cache object itself get destroyed
- if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
- return;
- }
- }
- }
-
- // See jQuery.data for more information
- if ( !pvt ) {
- delete cache[ id ].data;
-
- // Don't destroy the parent cache unless the internal data object
- // had been the only thing left in it
- if ( !isEmptyDataObject(cache[ id ]) ) {
- return;
- }
- }
-
- // Browsers that fail expando deletion also refuse to delete expandos on
- // the window, but it will allow it on all other JS objects; other browsers
- // don't care
- // Ensure that `cache` is not a window object #10080
- if ( jQuery.support.deleteExpando || !cache.setInterval ) {
- delete cache[ id ];
- } else {
- cache[ id ] = null;
- }
-
- // We destroyed the cache and need to eliminate the expando on the node to avoid
- // false lookups in the cache for entries that no longer exist
- if ( isNode ) {
- // IE does not allow us to delete expando properties from nodes,
- // nor does it have a removeAttribute function on Document nodes;
- // we must handle all of these cases
- if ( jQuery.support.deleteExpando ) {
- delete elem[ internalKey ];
- } else if ( elem.removeAttribute ) {
- elem.removeAttribute( internalKey );
- } else {
- elem[ internalKey ] = null;
- }
- }
- },
-
- // For internal use only.
- _data: function( elem, name, data ) {
- return jQuery.data( elem, name, data, true );
- },
-
- // A method for determining if a DOM node can handle the data expando
- acceptData: function( elem ) {
- if ( elem.nodeName ) {
- var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
-
- if ( match ) {
- return !(match === true || elem.getAttribute("classid") !== match);
- }
- }
-
- return true;
- }
-});
-
-jQuery.fn.extend({
- data: function( key, value ) {
- var parts, attr, name,
- data = null;
-
- if ( typeof key === "undefined" ) {
- if ( this.length ) {
- data = jQuery.data( this[0] );
-
- if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) {
- attr = this[0].attributes;
- for ( var i = 0, l = attr.length; i < l; i++ ) {
- name = attr[i].name;
-
- if ( name.indexOf( "data-" ) === 0 ) {
- name = jQuery.camelCase( name.substring(5) );
-
- dataAttr( this[0], name, data[ name ] );
- }
- }
- jQuery._data( this[0], "parsedAttrs", true );
- }
- }
-
- return data;
-
- } else if ( typeof key === "object" ) {
- return this.each(function() {
- jQuery.data( this, key );
- });
- }
-
- parts = key.split(".");
- parts[1] = parts[1] ? "." + parts[1] : "";
-
- if ( value === undefined ) {
- data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
-
- // Try to fetch any internally stored data first
- if ( data === undefined && this.length ) {
- data = jQuery.data( this[0], key );
- data = dataAttr( this[0], key, data );
- }
-
- return data === undefined && parts[1] ?
- this.data( parts[0] ) :
- data;
-
- } else {
- return this.each(function() {
- var self = jQuery( this ),
- args = [ parts[0], value ];
-
- self.triggerHandler( "setData" + parts[1] + "!", args );
- jQuery.data( this, key, value );
- self.triggerHandler( "changeData" + parts[1] + "!", args );
- });
- }
- },
-
- removeData: function( key ) {
- return this.each(function() {
- jQuery.removeData( this, key );
- });
- }
-});
-
-function dataAttr( elem, key, data ) {
- // If nothing was found internally, try to fetch any
- // data from the HTML5 data-* attribute
- if ( data === undefined && elem.nodeType === 1 ) {
-
- var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
-
- data = elem.getAttribute( name );
-
- if ( typeof data === "string" ) {
- try {
- data = data === "true" ? true :
- data === "false" ? false :
- data === "null" ? null :
- jQuery.isNumeric( data ) ? parseFloat( data ) :
- rbrace.test( data ) ? jQuery.parseJSON( data ) :
- data;
- } catch( e ) {}
-
- // Make sure we set the data so it isn't changed later
- jQuery.data( elem, key, data );
-
- } else {
- data = undefined;
- }
- }
-
- return data;
-}
-
-// checks a cache object for emptiness
-function isEmptyDataObject( obj ) {
- for ( var name in obj ) {
-
- // if the public data object is empty, the private is still empty
- if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
- continue;
- }
- if ( name !== "toJSON" ) {
- return false;
- }
- }
-
- return true;
-}
-
-
-
-
-function handleQueueMarkDefer( elem, type, src ) {
- var deferDataKey = type + "defer",
- queueDataKey = type + "queue",
- markDataKey = type + "mark",
- defer = jQuery._data( elem, deferDataKey );
- if ( defer &&
- ( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
- ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
- // Give room for hard-coded callbacks to fire first
- // and eventually mark/queue something else on the element
- setTimeout( function() {
- if ( !jQuery._data( elem, queueDataKey ) &&
- !jQuery._data( elem, markDataKey ) ) {
- jQuery.removeData( elem, deferDataKey, true );
- defer.fire();
- }
- }, 0 );
- }
-}
-
-jQuery.extend({
-
- _mark: function( elem, type ) {
- if ( elem ) {
- type = ( type || "fx" ) + "mark";
- jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );
- }
- },
-
- _unmark: function( force, elem, type ) {
- if ( force !== true ) {
- type = elem;
- elem = force;
- force = false;
- }
- if ( elem ) {
- type = type || "fx";
- var key = type + "mark",
- count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );
- if ( count ) {
- jQuery._data( elem, key, count );
- } else {
- jQuery.removeData( elem, key, true );
- handleQueueMarkDefer( elem, type, "mark" );
- }
- }
- },
-
- queue: function( elem, type, data ) {
- var q;
- if ( elem ) {
- type = ( type || "fx" ) + "queue";
- q = jQuery._data( elem, type );
-
- // Speed up dequeue by getting out quickly if this is just a lookup
- if ( data ) {
- if ( !q || jQuery.isArray(data) ) {
- q = jQuery._data( elem, type, jQuery.makeArray(data) );
- } else {
- q.push( data );
- }
- }
- return q || [];
- }
- },
-
- dequeue: function( elem, type ) {
- type = type || "fx";
-
- var queue = jQuery.queue( elem, type ),
- fn = queue.shift(),
- hooks = {};
-
- // If the fx queue is dequeued, always remove the progress sentinel
- if ( fn === "inprogress" ) {
- fn = queue.shift();
- }
-
- if ( fn ) {
- // Add a progress sentinel to prevent the fx queue from being
- // automatically dequeued
- if ( type === "fx" ) {
- queue.unshift( "inprogress" );
- }
-
- jQuery._data( elem, type + ".run", hooks );
- fn.call( elem, function() {
- jQuery.dequeue( elem, type );
- }, hooks );
- }
-
- if ( !queue.length ) {
- jQuery.removeData( elem, type + "queue " + type + ".run", true );
- handleQueueMarkDefer( elem, type, "queue" );
- }
- }
-});
-
-jQuery.fn.extend({
- queue: function( type, data ) {
- if ( typeof type !== "string" ) {
- data = type;
- type = "fx";
- }
-
- if ( data === undefined ) {
- return jQuery.queue( this[0], type );
- }
- return this.each(function() {
- var queue = jQuery.queue( this, type, data );
-
- if ( type === "fx" && queue[0] !== "inprogress" ) {
- jQuery.dequeue( this, type );
- }
- });
- },
- dequeue: function( type ) {
- return this.each(function() {
- jQuery.dequeue( this, type );
- });
- },
- // Based off of the plugin by Clint Helfers, with permission.
- // http://blindsignals.com/index.php/2009/07/jquery-delay/
- delay: function( time, type ) {
- time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
- type = type || "fx";
-
- return this.queue( type, function( next, hooks ) {
- var timeout = setTimeout( next, time );
- hooks.stop = function() {
- clearTimeout( timeout );
- };
- });
- },
- clearQueue: function( type ) {
- return this.queue( type || "fx", [] );
- },
- // Get a promise resolved when queues of a certain type
- // are emptied (fx is the type by default)
- promise: function( type, object ) {
- if ( typeof type !== "string" ) {
- object = type;
- type = undefined;
- }
- type = type || "fx";
- var defer = jQuery.Deferred(),
- elements = this,
- i = elements.length,
- count = 1,
- deferDataKey = type + "defer",
- queueDataKey = type + "queue",
- markDataKey = type + "mark",
- tmp;
- function resolve() {
- if ( !( --count ) ) {
- defer.resolveWith( elements, [ elements ] );
- }
- }
- while( i-- ) {
- if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
- ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
- jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
- jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
- count++;
- tmp.add( resolve );
- }
- }
- resolve();
- return defer.promise();
- }
-});
-
-
-
-
-var rclass = /[\n\t\r]/g,
- rspace = /\s+/,
- rreturn = /\r/g,
- rtype = /^(?:button|input)$/i,
- rfocusable = /^(?:button|input|object|select|textarea)$/i,
- rclickable = /^a(?:rea)?$/i,
- rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
- getSetAttribute = jQuery.support.getSetAttribute,
- nodeHook, boolHook, fixSpecified;
-
-jQuery.fn.extend({
- attr: function( name, value ) {
- return jQuery.access( this, name, value, true, jQuery.attr );
- },
-
- removeAttr: function( name ) {
- return this.each(function() {
- jQuery.removeAttr( this, name );
- });
- },
-
- prop: function( name, value ) {
- return jQuery.access( this, name, value, true, jQuery.prop );
- },
-
- removeProp: function( name ) {
- name = jQuery.propFix[ name ] || name;
- return this.each(function() {
- // try/catch handles cases where IE balks (such as removing a property on window)
- try {
- this[ name ] = undefined;
- delete this[ name ];
- } catch( e ) {}
- });
- },
-
- addClass: function( value ) {
- var classNames, i, l, elem,
- setClass, c, cl;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).addClass( value.call(this, j, this.className) );
- });
- }
-
- if ( value && typeof value === "string" ) {
- classNames = value.split( rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
-
- if ( elem.nodeType === 1 ) {
- if ( !elem.className && classNames.length === 1 ) {
- elem.className = value;
-
- } else {
- setClass = " " + elem.className + " ";
-
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
- if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
- setClass += classNames[ c ] + " ";
- }
- }
- elem.className = jQuery.trim( setClass );
- }
- }
- }
- }
-
- return this;
- },
-
- removeClass: function( value ) {
- var classNames, i, l, elem, className, c, cl;
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( j ) {
- jQuery( this ).removeClass( value.call(this, j, this.className) );
- });
- }
-
- if ( (value && typeof value === "string") || value === undefined ) {
- classNames = ( value || "" ).split( rspace );
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- elem = this[ i ];
-
- if ( elem.nodeType === 1 && elem.className ) {
- if ( value ) {
- className = (" " + elem.className + " ").replace( rclass, " " );
- for ( c = 0, cl = classNames.length; c < cl; c++ ) {
- className = className.replace(" " + classNames[ c ] + " ", " ");
- }
- elem.className = jQuery.trim( className );
-
- } else {
- elem.className = "";
- }
- }
- }
- }
-
- return this;
- },
-
- toggleClass: function( value, stateVal ) {
- var type = typeof value,
- isBool = typeof stateVal === "boolean";
-
- if ( jQuery.isFunction( value ) ) {
- return this.each(function( i ) {
- jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
- });
- }
-
- return this.each(function() {
- if ( type === "string" ) {
- // toggle individual class names
- var className,
- i = 0,
- self = jQuery( this ),
- state = stateVal,
- classNames = value.split( rspace );
-
- while ( (className = classNames[ i++ ]) ) {
- // check each className given, space seperated list
- state = isBool ? state : !self.hasClass( className );
- self[ state ? "addClass" : "removeClass" ]( className );
- }
-
- } else if ( type === "undefined" || type === "boolean" ) {
- if ( this.className ) {
- // store className if set
- jQuery._data( this, "__className__", this.className );
- }
-
- // toggle whole className
- this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
- }
- });
- },
-
- hasClass: function( selector ) {
- var className = " " + selector + " ",
- i = 0,
- l = this.length;
- for ( ; i < l; i++ ) {
- if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
- return true;
- }
- }
-
- return false;
- },
-
- val: function( value ) {
- var hooks, ret, isFunction,
- elem = this[0];
-
- if ( !arguments.length ) {
- if ( elem ) {
- hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
-
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
- return ret;
- }
-
- ret = elem.value;
-
- return typeof ret === "string" ?
- // handle most common string cases
- ret.replace(rreturn, "") :
- // handle cases where value is null/undef or number
- ret == null ? "" : ret;
- }
-
- return;
- }
-
- isFunction = jQuery.isFunction( value );
-
- return this.each(function( i ) {
- var self = jQuery(this), val;
-
- if ( this.nodeType !== 1 ) {
- return;
- }
-
- if ( isFunction ) {
- val = value.call( this, i, self.val() );
- } else {
- val = value;
- }
-
- // Treat null/undefined as ""; convert numbers to string
- if ( val == null ) {
- val = "";
- } else if ( typeof val === "number" ) {
- val += "";
- } else if ( jQuery.isArray( val ) ) {
- val = jQuery.map(val, function ( value ) {
- return value == null ? "" : value + "";
- });
- }
-
- hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
-
- // If set returns undefined, fall back to normal setting
- if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
- this.value = val;
- }
- });
- }
-});
-
-jQuery.extend({
- valHooks: {
- option: {
- get: function( elem ) {
- // attributes.value is undefined in Blackberry 4.7 but
- // uses .value. See #6932
- var val = elem.attributes.value;
- return !val || val.specified ? elem.value : elem.text;
- }
- },
- select: {
- get: function( elem ) {
- var value, i, max, option,
- index = elem.selectedIndex,
- values = [],
- options = elem.options,
- one = elem.type === "select-one";
-
- // Nothing was selected
- if ( index < 0 ) {
- return null;
- }
-
- // Loop through all the selected options
- i = one ? index : 0;
- max = one ? index + 1 : options.length;
- for ( ; i < max; i++ ) {
- option = options[ i ];
-
- // Don't return options that are disabled or in a disabled optgroup
- if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
- (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
-
- // Get the specific value for the option
- value = jQuery( option ).val();
-
- // We don't need an array for one selects
- if ( one ) {
- return value;
- }
-
- // Multi-Selects return an array
- values.push( value );
- }
- }
-
- // Fixes Bug #2551 -- select.val() broken in IE after form.reset()
- if ( one && !values.length && options.length ) {
- return jQuery( options[ index ] ).val();
- }
-
- return values;
- },
-
- set: function( elem, value ) {
- var values = jQuery.makeArray( value );
-
- jQuery(elem).find("option").each(function() {
- this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
- });
-
- if ( !values.length ) {
- elem.selectedIndex = -1;
- }
- return values;
- }
- }
- },
-
- attrFn: {
- val: true,
- css: true,
- html: true,
- text: true,
- data: true,
- width: true,
- height: true,
- offset: true
- },
-
- attr: function( elem, name, value, pass ) {
- var ret, hooks, notxml,
- nType = elem.nodeType;
-
- // don't get/set attributes on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return;
- }
-
- if ( pass && name in jQuery.attrFn ) {
- return jQuery( elem )[ name ]( value );
- }
-
- // Fallback to prop when attributes are not supported
- if ( typeof elem.getAttribute === "undefined" ) {
- return jQuery.prop( elem, name, value );
- }
-
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- // All attributes are lowercase
- // Grab necessary hook if one is defined
- if ( notxml ) {
- name = name.toLowerCase();
- hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
- }
-
- if ( value !== undefined ) {
-
- if ( value === null ) {
- jQuery.removeAttr( elem, name );
- return;
-
- } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- elem.setAttribute( name, "" + value );
- return value;
- }
-
- } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
- return ret;
-
- } else {
-
- ret = elem.getAttribute( name );
-
- // Non-existent attributes return null, we normalize to undefined
- return ret === null ?
- undefined :
- ret;
- }
- },
-
- removeAttr: function( elem, value ) {
- var propName, attrNames, name, l,
- i = 0;
-
- if ( value && elem.nodeType === 1 ) {
- attrNames = value.toLowerCase().split( rspace );
- l = attrNames.length;
-
- for ( ; i < l; i++ ) {
- name = attrNames[ i ];
-
- if ( name ) {
- propName = jQuery.propFix[ name ] || name;
-
- // See #9699 for explanation of this approach (setting first, then removal)
- jQuery.attr( elem, name, "" );
- elem.removeAttribute( getSetAttribute ? name : propName );
-
- // Set corresponding property to false for boolean attributes
- if ( rboolean.test( name ) && propName in elem ) {
- elem[ propName ] = false;
- }
- }
- }
- }
- },
-
- attrHooks: {
- type: {
- set: function( elem, value ) {
- // We can't allow the type property to be changed (since it causes problems in IE)
- if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
- jQuery.error( "type property can't be changed" );
- } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
- // Setting the type on a radio button after the value resets the value in IE6-9
- // Reset value to it's default in case type is set after value
- // This is for element creation
- var val = elem.value;
- elem.setAttribute( "type", value );
- if ( val ) {
- elem.value = val;
- }
- return value;
- }
- }
- },
- // Use the value property for back compat
- // Use the nodeHook for button elements in IE6/7 (#1954)
- value: {
- get: function( elem, name ) {
- if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
- return nodeHook.get( elem, name );
- }
- return name in elem ?
- elem.value :
- null;
- },
- set: function( elem, value, name ) {
- if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
- return nodeHook.set( elem, value, name );
- }
- // Does not return so that setAttribute is also used
- elem.value = value;
- }
- }
- },
-
- propFix: {
- tabindex: "tabIndex",
- readonly: "readOnly",
- "for": "htmlFor",
- "class": "className",
- maxlength: "maxLength",
- cellspacing: "cellSpacing",
- cellpadding: "cellPadding",
- rowspan: "rowSpan",
- colspan: "colSpan",
- usemap: "useMap",
- frameborder: "frameBorder",
- contenteditable: "contentEditable"
- },
-
- prop: function( elem, name, value ) {
- var ret, hooks, notxml,
- nType = elem.nodeType;
-
- // don't get/set properties on text, comment and attribute nodes
- if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
- return;
- }
-
- notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
-
- if ( notxml ) {
- // Fix name and attach hooks
- name = jQuery.propFix[ name ] || name;
- hooks = jQuery.propHooks[ name ];
- }
-
- if ( value !== undefined ) {
- if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
- return ret;
-
- } else {
- return ( elem[ name ] = value );
- }
-
- } else {
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
- return ret;
-
- } else {
- return elem[ name ];
- }
- }
- },
-
- propHooks: {
- tabIndex: {
- get: function( elem ) {
- // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
- // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
- var attributeNode = elem.getAttributeNode("tabindex");
-
- return attributeNode && attributeNode.specified ?
- parseInt( attributeNode.value, 10 ) :
- rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
- 0 :
- undefined;
- }
- }
- }
-});
-
-// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)
-jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;
-
-// Hook for boolean attributes
-boolHook = {
- get: function( elem, name ) {
- // Align boolean attributes with corresponding properties
- // Fall back to attribute presence where some booleans are not supported
- var attrNode,
- property = jQuery.prop( elem, name );
- return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
- name.toLowerCase() :
- undefined;
- },
- set: function( elem, value, name ) {
- var propName;
- if ( value === false ) {
- // Remove boolean attributes when set to false
- jQuery.removeAttr( elem, name );
- } else {
- // value is true since we know at this point it's type boolean and not false
- // Set boolean attributes to the same name and set the DOM property
- propName = jQuery.propFix[ name ] || name;
- if ( propName in elem ) {
- // Only set the IDL specifically if it already exists on the element
- elem[ propName ] = true;
- }
-
- elem.setAttribute( name, name.toLowerCase() );
- }
- return name;
- }
-};
-
-// IE6/7 do not support getting/setting some attributes with get/setAttribute
-if ( !getSetAttribute ) {
-
- fixSpecified = {
- name: true,
- id: true
- };
-
- // Use this for any attribute in IE6/7
- // This fixes almost every IE6/7 issue
- nodeHook = jQuery.valHooks.button = {
- get: function( elem, name ) {
- var ret;
- ret = elem.getAttributeNode( name );
- return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ?
- ret.nodeValue :
- undefined;
- },
- set: function( elem, value, name ) {
- // Set the existing or create a new attribute node
- var ret = elem.getAttributeNode( name );
- if ( !ret ) {
- ret = document.createAttribute( name );
- elem.setAttributeNode( ret );
- }
- return ( ret.nodeValue = value + "" );
- }
- };
-
- // Apply the nodeHook to tabindex
- jQuery.attrHooks.tabindex.set = nodeHook.set;
-
- // Set width and height to auto instead of 0 on empty string( Bug #8150 )
- // This is for removals
- jQuery.each([ "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- set: function( elem, value ) {
- if ( value === "" ) {
- elem.setAttribute( name, "auto" );
- return value;
- }
- }
- });
- });
-
- // Set contenteditable to false on removals(#10429)
- // Setting to empty string throws an error as an invalid value
- jQuery.attrHooks.contenteditable = {
- get: nodeHook.get,
- set: function( elem, value, name ) {
- if ( value === "" ) {
- value = "false";
- }
- nodeHook.set( elem, value, name );
- }
- };
-}
-
-
-// Some attributes require a special call on IE
-if ( !jQuery.support.hrefNormalized ) {
- jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
- jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
- get: function( elem ) {
- var ret = elem.getAttribute( name, 2 );
- return ret === null ? undefined : ret;
- }
- });
- });
-}
-
-if ( !jQuery.support.style ) {
- jQuery.attrHooks.style = {
- get: function( elem ) {
- // Return undefined in the case of empty string
- // Normalize to lowercase since IE uppercases css property names
- return elem.style.cssText.toLowerCase() || undefined;
- },
- set: function( elem, value ) {
- return ( elem.style.cssText = "" + value );
- }
- };
-}
-
-// Safari mis-reports the default selected property of an option
-// Accessing the parent's selectedIndex property fixes it
-if ( !jQuery.support.optSelected ) {
- jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
- get: function( elem ) {
- var parent = elem.parentNode;
-
- if ( parent ) {
- parent.selectedIndex;
-
- // Make sure that it also works with optgroups, see #5701
- if ( parent.parentNode ) {
- parent.parentNode.selectedIndex;
- }
- }
- return null;
- }
- });
-}
-
-// IE6/7 call enctype encoding
-if ( !jQuery.support.enctype ) {
- jQuery.propFix.enctype = "encoding";
-}
-
-// Radios and checkboxes getter/setter
-if ( !jQuery.support.checkOn ) {
- jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = {
- get: function( elem ) {
- // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
- return elem.getAttribute("value") === null ? "on" : elem.value;
- }
- };
- });
-}
-jQuery.each([ "radio", "checkbox" ], function() {
- jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
- set: function( elem, value ) {
- if ( jQuery.isArray( value ) ) {
- return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
- }
- }
- });
-});
-
-
-
-
-var rformElems = /^(?:textarea|input|select)$/i,
- rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
- rhoverHack = /\bhover(\.\S+)?\b/,
- rkeyEvent = /^key/,
- rmouseEvent = /^(?:mouse|contextmenu)|click/,
- rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
- rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
- quickParse = function( selector ) {
- var quick = rquickIs.exec( selector );
- if ( quick ) {
- // 0 1 2 3
- // [ _, tag, id, class ]
- quick[1] = ( quick[1] || "" ).toLowerCase();
- quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );
- }
- return quick;
- },
- quickIs = function( elem, m ) {
- var attrs = elem.attributes || {};
- return (
- (!m[1] || elem.nodeName.toLowerCase() === m[1]) &&
- (!m[2] || (attrs.id || {}).value === m[2]) &&
- (!m[3] || m[3].test( (attrs[ "class" ] || {}).value ))
- );
- },
- hoverHack = function( events ) {
- return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
- };
-
-/*
- * Helper functions for managing events -- not part of the public interface.
- * Props to Dean Edwards' addEvent library for many of the ideas.
- */
-jQuery.event = {
-
- add: function( elem, types, handler, data, selector ) {
-
- var elemData, eventHandle, events,
- t, tns, type, namespaces, handleObj,
- handleObjIn, quick, handlers, special;
-
- // Don't attach events to noData or text/comment nodes (allow plain objects tho)
- if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
- return;
- }
-
- // Caller can pass in an object of custom data in lieu of the handler
- if ( handler.handler ) {
- handleObjIn = handler;
- handler = handleObjIn.handler;
- }
-
- // Make sure that the handler has a unique ID, used to find/remove it later
- if ( !handler.guid ) {
- handler.guid = jQuery.guid++;
- }
-
- // Init the element's event structure and main handler, if this is the first
- events = elemData.events;
- if ( !events ) {
- elemData.events = events = {};
- }
- eventHandle = elemData.handle;
- if ( !eventHandle ) {
- elemData.handle = eventHandle = function( e ) {
- // Discard the second event of a jQuery.event.trigger() and
- // when an event is called after a page has unloaded
- return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
- jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
- undefined;
- };
- // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
- eventHandle.elem = elem;
- }
-
- // Handle multiple events separated by a space
- // jQuery(...).bind("mouseover mouseout", fn);
- types = jQuery.trim( hoverHack(types) ).split( " " );
- for ( t = 0; t < types.length; t++ ) {
-
- tns = rtypenamespace.exec( types[t] ) || [];
- type = tns[1];
- namespaces = ( tns[2] || "" ).split( "." ).sort();
-
- // If event changes its type, use the special event handlers for the changed type
- special = jQuery.event.special[ type ] || {};
-
- // If selector defined, determine special event api type, otherwise given type
- type = ( selector ? special.delegateType : special.bindType ) || type;
-
- // Update special based on newly reset type
- special = jQuery.event.special[ type ] || {};
-
- // handleObj is passed to all event handlers
- handleObj = jQuery.extend({
- type: type,
- origType: tns[1],
- data: data,
- handler: handler,
- guid: handler.guid,
- selector: selector,
- quick: quickParse( selector ),
- namespace: namespaces.join(".")
- }, handleObjIn );
-
- // Init the event handler queue if we're the first
- handlers = events[ type ];
- if ( !handlers ) {
- handlers = events[ type ] = [];
- handlers.delegateCount = 0;
-
- // Only use addEventListener/attachEvent if the special events handler returns false
- if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
- // Bind the global event handler to the element
- if ( elem.addEventListener ) {
- elem.addEventListener( type, eventHandle, false );
-
- } else if ( elem.attachEvent ) {
- elem.attachEvent( "on" + type, eventHandle );
- }
- }
- }
-
- if ( special.add ) {
- special.add.call( elem, handleObj );
-
- if ( !handleObj.handler.guid ) {
- handleObj.handler.guid = handler.guid;
- }
- }
-
- // Add to the element's handler list, delegates in front
- if ( selector ) {
- handlers.splice( handlers.delegateCount++, 0, handleObj );
- } else {
- handlers.push( handleObj );
- }
-
- // Keep track of which events have ever been used, for event optimization
- jQuery.event.global[ type ] = true;
- }
-
- // Nullify elem to prevent memory leaks in IE
- elem = null;
- },
-
- global: {},
-
- // Detach an event or set of events from an element
- remove: function( elem, types, handler, selector, mappedTypes ) {
-
- var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
- t, tns, type, origType, namespaces, origCount,
- j, events, special, handle, eventType, handleObj;
-
- if ( !elemData || !(events = elemData.events) ) {
- return;
- }
-
- // Once for each type.namespace in types; type may be omitted
- types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
- for ( t = 0; t < types.length; t++ ) {
- tns = rtypenamespace.exec( types[t] ) || [];
- type = origType = tns[1];
- namespaces = tns[2];
-
- // Unbind all events (on this namespace, if provided) for the element
- if ( !type ) {
- for ( type in events ) {
- jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
- }
- continue;
- }
-
- special = jQuery.event.special[ type ] || {};
- type = ( selector? special.delegateType : special.bindType ) || type;
- eventType = events[ type ] || [];
- origCount = eventType.length;
- namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
-
- // Remove matching events
- for ( j = 0; j < eventType.length; j++ ) {
- handleObj = eventType[ j ];
-
- if ( ( mappedTypes || origType === handleObj.origType ) &&
- ( !handler || handler.guid === handleObj.guid ) &&
- ( !namespaces || namespaces.test( handleObj.namespace ) ) &&
- ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
- eventType.splice( j--, 1 );
-
- if ( handleObj.selector ) {
- eventType.delegateCount--;
- }
- if ( special.remove ) {
- special.remove.call( elem, handleObj );
- }
- }
- }
-
- // Remove generic event handler if we removed something and no more handlers exist
- // (avoids potential for endless recursion during removal of special event handlers)
- if ( eventType.length === 0 && origCount !== eventType.length ) {
- if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
- jQuery.removeEvent( elem, type, elemData.handle );
- }
-
- delete events[ type ];
- }
- }
-
- // Remove the expando if it's no longer used
- if ( jQuery.isEmptyObject( events ) ) {
- handle = elemData.handle;
- if ( handle ) {
- handle.elem = null;
- }
-
- // removeData also checks for emptiness and clears the expando if empty
- // so use it instead of delete
- jQuery.removeData( elem, [ "events", "handle" ], true );
- }
- },
-
- // Events that are safe to short-circuit if no handlers are attached.
- // Native DOM events should not be added, they may have inline handlers.
- customEvent: {
- "getData": true,
- "setData": true,
- "changeData": true
- },
-
- trigger: function( event, data, elem, onlyHandlers ) {
- // Don't do events on text and comment nodes
- if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
- return;
- }
-
- // Event object or event type
- var type = event.type || event,
- namespaces = [],
- cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;
-
- // focus/blur morphs to focusin/out; ensure we're not firing them right now
- if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
- return;
- }
-
- if ( type.indexOf( "!" ) >= 0 ) {
- // Exclusive events trigger only for the exact event (no namespaces)
- type = type.slice(0, -1);
- exclusive = true;
- }
-
- if ( type.indexOf( "." ) >= 0 ) {
- // Namespaced trigger; create a regexp to match event type in handle()
- namespaces = type.split(".");
- type = namespaces.shift();
- namespaces.sort();
- }
-
- if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
- // No jQuery handlers for this event type, and it can't have inline handlers
- return;
- }
-
- // Caller can pass in an Event, Object, or just an event type string
- event = typeof event === "object" ?
- // jQuery.Event object
- event[ jQuery.expando ] ? event :
- // Object literal
- new jQuery.Event( type, event ) :
- // Just the event type (string)
- new jQuery.Event( type );
-
- event.type = type;
- event.isTrigger = true;
- event.exclusive = exclusive;
- event.namespace = namespaces.join( "." );
- event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
- ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
-
- // Handle a global trigger
- if ( !elem ) {
-
- // TODO: Stop taunting the data cache; remove global events and always attach to document
- cache = jQuery.cache;
- for ( i in cache ) {
- if ( cache[ i ].events && cache[ i ].events[ type ] ) {
- jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
- }
- }
- return;
- }
-
- // Clean up the event in case it is being reused
- event.result = undefined;
- if ( !event.target ) {
- event.target = elem;
- }
-
- // Clone any incoming data and prepend the event, creating the handler arg list
- data = data != null ? jQuery.makeArray( data ) : [];
- data.unshift( event );
-
- // Allow special events to draw outside the lines
- special = jQuery.event.special[ type ] || {};
- if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
- return;
- }
-
- // Determine event propagation path in advance, per W3C events spec (#9951)
- // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
- eventPath = [[ elem, special.bindType || type ]];
- if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
-
- bubbleType = special.delegateType || type;
- cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
- old = null;
- for ( ; cur; cur = cur.parentNode ) {
- eventPath.push([ cur, bubbleType ]);
- old = cur;
- }
-
- // Only add window if we got to document (e.g., not plain obj or detached DOM)
- if ( old && old === elem.ownerDocument ) {
- eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
- }
- }
-
- // Fire handlers on the event path
- for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
-
- cur = eventPath[i][0];
- event.type = eventPath[i][1];
-
- handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
- if ( handle ) {
- handle.apply( cur, data );
- }
- // Note that this is a bare JS function and not a jQuery handler
- handle = ontype && cur[ ontype ];
- if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {
- event.preventDefault();
- }
- }
- event.type = type;
-
- // If nobody prevented the default action, do it now
- if ( !onlyHandlers && !event.isDefaultPrevented() ) {
-
- if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
- !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
-
- // Call a native DOM method on the target with the same name name as the event.
- // Can't use an .isFunction() check here because IE6/7 fails that test.
- // Don't do default actions on window, that's where global variables be (#6170)
- // IE<9 dies on focus/blur to hidden element (#1486)
- if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
-
- // Don't re-trigger an onFOO event when we call its FOO() method
- old = elem[ ontype ];
-
- if ( old ) {
- elem[ ontype ] = null;
- }
-
- // Prevent re-triggering of the same event, since we already bubbled it above
- jQuery.event.triggered = type;
- elem[ type ]();
- jQuery.event.triggered = undefined;
-
- if ( old ) {
- elem[ ontype ] = old;
- }
- }
- }
- }
-
- return event.result;
- },
-
- dispatch: function( event ) {
-
- // Make a writable jQuery.Event from the native event object
- event = jQuery.event.fix( event || window.event );
-
- var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
- delegateCount = handlers.delegateCount,
- args = [].slice.call( arguments, 0 ),
- run_all = !event.exclusive && !event.namespace,
- handlerQueue = [],
- i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
-
- // Use the fix-ed jQuery.Event rather than the (read-only) native event
- args[0] = event;
- event.delegateTarget = this;
-
- // Determine handlers that should run if there are delegated events
- // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861)
- if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) {
-
- // Pregenerate a single jQuery object for reuse with .is()
- jqcur = jQuery(this);
- jqcur.context = this.ownerDocument || this;
-
- for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
- selMatch = {};
- matches = [];
- jqcur[0] = cur;
- for ( i = 0; i < delegateCount; i++ ) {
- handleObj = handlers[ i ];
- sel = handleObj.selector;
-
- if ( selMatch[ sel ] === undefined ) {
- selMatch[ sel ] = (
- handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )
- );
- }
- if ( selMatch[ sel ] ) {
- matches.push( handleObj );
- }
- }
- if ( matches.length ) {
- handlerQueue.push({ elem: cur, matches: matches });
- }
- }
- }
-
- // Add the remaining (directly-bound) handlers
- if ( handlers.length > delegateCount ) {
- handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
- }
-
- // Run delegates first; they may want to stop propagation beneath us
- for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
- matched = handlerQueue[ i ];
- event.currentTarget = matched.elem;
-
- for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
- handleObj = matched.matches[ j ];
-
- // Triggered event must either 1) be non-exclusive and have no namespace, or
- // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
- if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
-
- event.data = handleObj.data;
- event.handleObj = handleObj;
-
- ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
- .apply( matched.elem, args );
-
- if ( ret !== undefined ) {
- event.result = ret;
- if ( ret === false ) {
- event.preventDefault();
- event.stopPropagation();
- }
- }
- }
- }
- }
-
- return event.result;
- },
-
- // Includes some event props shared by KeyEvent and MouseEvent
- // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
- props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
-
- fixHooks: {},
-
- keyHooks: {
- props: "char charCode key keyCode".split(" "),
- filter: function( event, original ) {
-
- // Add which for key events
- if ( event.which == null ) {
- event.which = original.charCode != null ? original.charCode : original.keyCode;
- }
-
- return event;
- }
- },
-
- mouseHooks: {
- props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
- filter: function( event, original ) {
- var eventDoc, doc, body,
- button = original.button,
- fromElement = original.fromElement;
-
- // Calculate pageX/Y if missing and clientX/Y available
- if ( event.pageX == null && original.clientX != null ) {
- eventDoc = event.target.ownerDocument || document;
- doc = eventDoc.documentElement;
- body = eventDoc.body;
-
- event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
- event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
- }
-
- // Add relatedTarget, if necessary
- if ( !event.relatedTarget && fromElement ) {
- event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
- }
-
- // Add which for click: 1 === left; 2 === middle; 3 === right
- // Note: button is not normalized, so don't use it
- if ( !event.which && button !== undefined ) {
- event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
- }
-
- return event;
- }
- },
-
- fix: function( event ) {
- if ( event[ jQuery.expando ] ) {
- return event;
- }
-
- // Create a writable copy of the event object and normalize some properties
- var i, prop,
- originalEvent = event,
- fixHook = jQuery.event.fixHooks[ event.type ] || {},
- copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
-
- event = jQuery.Event( originalEvent );
-
- for ( i = copy.length; i; ) {
- prop = copy[ --i ];
- event[ prop ] = originalEvent[ prop ];
- }
-
- // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
- if ( !event.target ) {
- event.target = originalEvent.srcElement || document;
- }
-
- // Target should not be a text node (#504, Safari)
- if ( event.target.nodeType === 3 ) {
- event.target = event.target.parentNode;
- }
-
- // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8)
- if ( event.metaKey === undefined ) {
- event.metaKey = event.ctrlKey;
- }
-
- return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
- },
-
- special: {
- ready: {
- // Make sure the ready event is setup
- setup: jQuery.bindReady
- },
-
- load: {
- // Prevent triggered image.load events from bubbling to window.load
- noBubble: true
- },
-
- focus: {
- delegateType: "focusin"
- },
- blur: {
- delegateType: "focusout"
- },
-
- beforeunload: {
- setup: function( data, namespaces, eventHandle ) {
- // We only want to do this special case on windows
- if ( jQuery.isWindow( this ) ) {
- this.onbeforeunload = eventHandle;
- }
- },
-
- teardown: function( namespaces, eventHandle ) {
- if ( this.onbeforeunload === eventHandle ) {
- this.onbeforeunload = null;
- }
- }
- }
- },
-
- simulate: function( type, elem, event, bubble ) {
- // Piggyback on a donor event to simulate a different one.
- // Fake originalEvent to avoid donor's stopPropagation, but if the
- // simulated event prevents default then we do the same on the donor.
- var e = jQuery.extend(
- new jQuery.Event(),
- event,
- { type: type,
- isSimulated: true,
- originalEvent: {}
- }
- );
- if ( bubble ) {
- jQuery.event.trigger( e, null, elem );
- } else {
- jQuery.event.dispatch.call( elem, e );
- }
- if ( e.isDefaultPrevented() ) {
- event.preventDefault();
- }
- }
-};
-
-// Some plugins are using, but it's undocumented/deprecated and will be removed.
-// The 1.7 special event interface should provide all the hooks needed now.
-jQuery.event.handle = jQuery.event.dispatch;
-
-jQuery.removeEvent = document.removeEventListener ?
- function( elem, type, handle ) {
- if ( elem.removeEventListener ) {
- elem.removeEventListener( type, handle, false );
- }
- } :
- function( elem, type, handle ) {
- if ( elem.detachEvent ) {
- elem.detachEvent( "on" + type, handle );
- }
- };
-
-jQuery.Event = function( src, props ) {
- // Allow instantiation without the 'new' keyword
- if ( !(this instanceof jQuery.Event) ) {
- return new jQuery.Event( src, props );
- }
-
- // Event object
- if ( src && src.type ) {
- this.originalEvent = src;
- this.type = src.type;
-
- // Events bubbling up the document may have been marked as prevented
- // by a handler lower down the tree; reflect the correct value.
- this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
- src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
-
- // Event type
- } else {
- this.type = src;
- }
-
- // Put explicitly provided properties onto the event object
- if ( props ) {
- jQuery.extend( this, props );
- }
-
- // Create a timestamp if incoming event doesn't have one
- this.timeStamp = src && src.timeStamp || jQuery.now();
-
- // Mark it as fixed
- this[ jQuery.expando ] = true;
-};
-
-function returnFalse() {
- return false;
-}
-function returnTrue() {
- return true;
-}
-
-// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
-// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
-jQuery.Event.prototype = {
- preventDefault: function() {
- this.isDefaultPrevented = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
-
- // if preventDefault exists run it on the original event
- if ( e.preventDefault ) {
- e.preventDefault();
-
- // otherwise set the returnValue property of the original event to false (IE)
- } else {
- e.returnValue = false;
- }
- },
- stopPropagation: function() {
- this.isPropagationStopped = returnTrue;
-
- var e = this.originalEvent;
- if ( !e ) {
- return;
- }
- // if stopPropagation exists run it on the original event
- if ( e.stopPropagation ) {
- e.stopPropagation();
- }
- // otherwise set the cancelBubble property of the original event to true (IE)
- e.cancelBubble = true;
- },
- stopImmediatePropagation: function() {
- this.isImmediatePropagationStopped = returnTrue;
- this.stopPropagation();
- },
- isDefaultPrevented: returnFalse,
- isPropagationStopped: returnFalse,
- isImmediatePropagationStopped: returnFalse
-};
-
-// Create mouseenter/leave events using mouseover/out and event-time checks
-jQuery.each({
- mouseenter: "mouseover",
- mouseleave: "mouseout"
-}, function( orig, fix ) {
- jQuery.event.special[ orig ] = {
- delegateType: fix,
- bindType: fix,
-
- handle: function( event ) {
- var target = this,
- related = event.relatedTarget,
- handleObj = event.handleObj,
- selector = handleObj.selector,
- ret;
-
- // For mousenter/leave call the handler if related is outside the target.
- // NB: No relatedTarget if the mouse left/entered the browser window
- if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
- event.type = handleObj.origType;
- ret = handleObj.handler.apply( this, arguments );
- event.type = fix;
- }
- return ret;
- }
- };
-});
-
-// IE submit delegation
-if ( !jQuery.support.submitBubbles ) {
-
- jQuery.event.special.submit = {
- setup: function() {
- // Only need this for delegated form submit events
- if ( jQuery.nodeName( this, "form" ) ) {
- return false;
- }
-
- // Lazy-add a submit handler when a descendant form may potentially be submitted
- jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
- // Node name check avoids a VML-related crash in IE (#9807)
- var elem = e.target,
- form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
- if ( form && !form._submit_attached ) {
- jQuery.event.add( form, "submit._submit", function( event ) {
- // If form was submitted by the user, bubble the event up the tree
- if ( this.parentNode && !event.isTrigger ) {
- jQuery.event.simulate( "submit", this.parentNode, event, true );
- }
- });
- form._submit_attached = true;
- }
- });
- // return undefined since we don't need an event listener
- },
-
- teardown: function() {
- // Only need this for delegated form submit events
- if ( jQuery.nodeName( this, "form" ) ) {
- return false;
- }
-
- // Remove delegated handlers; cleanData eventually reaps submit handlers attached above
- jQuery.event.remove( this, "._submit" );
- }
- };
-}
-
-// IE change delegation and checkbox/radio fix
-if ( !jQuery.support.changeBubbles ) {
-
- jQuery.event.special.change = {
-
- setup: function() {
-
- if ( rformElems.test( this.nodeName ) ) {
- // IE doesn't fire change on a check/radio until blur; trigger it on click
- // after a propertychange. Eat the blur-change in special.change.handle.
- // This still fires onchange a second time for check/radio after blur.
- if ( this.type === "checkbox" || this.type === "radio" ) {
- jQuery.event.add( this, "propertychange._change", function( event ) {
- if ( event.originalEvent.propertyName === "checked" ) {
- this._just_changed = true;
- }
- });
- jQuery.event.add( this, "click._change", function( event ) {
- if ( this._just_changed && !event.isTrigger ) {
- this._just_changed = false;
- jQuery.event.simulate( "change", this, event, true );
- }
- });
- }
- return false;
- }
- // Delegated event; lazy-add a change handler on descendant inputs
- jQuery.event.add( this, "beforeactivate._change", function( e ) {
- var elem = e.target;
-
- if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {
- jQuery.event.add( elem, "change._change", function( event ) {
- if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
- jQuery.event.simulate( "change", this.parentNode, event, true );
- }
- });
- elem._change_attached = true;
- }
- });
- },
-
- handle: function( event ) {
- var elem = event.target;
-
- // Swallow native change events from checkbox/radio, we already triggered them above
- if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
- return event.handleObj.handler.apply( this, arguments );
- }
- },
-
- teardown: function() {
- jQuery.event.remove( this, "._change" );
-
- return rformElems.test( this.nodeName );
- }
- };
-}
-
-// Create "bubbling" focus and blur events
-if ( !jQuery.support.focusinBubbles ) {
- jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
-
- // Attach a single capturing handler while someone wants focusin/focusout
- var attaches = 0,
- handler = function( event ) {
- jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
- };
-
- jQuery.event.special[ fix ] = {
- setup: function() {
- if ( attaches++ === 0 ) {
- document.addEventListener( orig, handler, true );
- }
- },
- teardown: function() {
- if ( --attaches === 0 ) {
- document.removeEventListener( orig, handler, true );
- }
- }
- };
- });
-}
-
-jQuery.fn.extend({
-
- on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
- var origFn, type;
-
- // Types can be a map of types/handlers
- if ( typeof types === "object" ) {
- // ( types-Object, selector, data )
- if ( typeof selector !== "string" ) {
- // ( types-Object, data )
- data = selector;
- selector = undefined;
- }
- for ( type in types ) {
- this.on( type, selector, data, types[ type ], one );
- }
- return this;
- }
-
- if ( data == null && fn == null ) {
- // ( types, fn )
- fn = selector;
- data = selector = undefined;
- } else if ( fn == null ) {
- if ( typeof selector === "string" ) {
- // ( types, selector, fn )
- fn = data;
- data = undefined;
- } else {
- // ( types, data, fn )
- fn = data;
- data = selector;
- selector = undefined;
- }
- }
- if ( fn === false ) {
- fn = returnFalse;
- } else if ( !fn ) {
- return this;
- }
-
- if ( one === 1 ) {
- origFn = fn;
- fn = function( event ) {
- // Can use an empty set, since event contains the info
- jQuery().off( event );
- return origFn.apply( this, arguments );
- };
- // Use same guid so caller can remove using origFn
- fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
- }
- return this.each( function() {
- jQuery.event.add( this, types, fn, data, selector );
- });
- },
- one: function( types, selector, data, fn ) {
- return this.on.call( this, types, selector, data, fn, 1 );
- },
- off: function( types, selector, fn ) {
- if ( types && types.preventDefault && types.handleObj ) {
- // ( event ) dispatched jQuery.Event
- var handleObj = types.handleObj;
- jQuery( types.delegateTarget ).off(
- handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type,
- handleObj.selector,
- handleObj.handler
- );
- return this;
- }
- if ( typeof types === "object" ) {
- // ( types-object [, selector] )
- for ( var type in types ) {
- this.off( type, selector, types[ type ] );
- }
- return this;
- }
- if ( selector === false || typeof selector === "function" ) {
- // ( types [, fn] )
- fn = selector;
- selector = undefined;
- }
- if ( fn === false ) {
- fn = returnFalse;
- }
- return this.each(function() {
- jQuery.event.remove( this, types, fn, selector );
- });
- },
-
- bind: function( types, data, fn ) {
- return this.on( types, null, data, fn );
- },
- unbind: function( types, fn ) {
- return this.off( types, null, fn );
- },
-
- live: function( types, data, fn ) {
- jQuery( this.context ).on( types, this.selector, data, fn );
- return this;
- },
- die: function( types, fn ) {
- jQuery( this.context ).off( types, this.selector || "**", fn );
- return this;
- },
-
- delegate: function( selector, types, data, fn ) {
- return this.on( types, selector, data, fn );
- },
- undelegate: function( selector, types, fn ) {
- // ( namespace ) or ( selector, types [, fn] )
- return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn );
- },
-
- trigger: function( type, data ) {
- return this.each(function() {
- jQuery.event.trigger( type, data, this );
- });
- },
- triggerHandler: function( type, data ) {
- if ( this[0] ) {
- return jQuery.event.trigger( type, data, this[0], true );
- }
- },
-
- toggle: function( fn ) {
- // Save reference to arguments for access in closure
- var args = arguments,
- guid = fn.guid || jQuery.guid++,
- i = 0,
- toggler = function( event ) {
- // Figure out which function to execute
- var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
- jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
-
- // Make sure that clicks stop
- event.preventDefault();
-
- // and execute the function
- return args[ lastToggle ].apply( this, arguments ) || false;
- };
-
- // link all the functions, so any of them can unbind this click handler
- toggler.guid = guid;
- while ( i < args.length ) {
- args[ i++ ].guid = guid;
- }
-
- return this.click( toggler );
- },
-
- hover: function( fnOver, fnOut ) {
- return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
- }
-});
-
-jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
- "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
- "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
-
- // Handle event binding
- jQuery.fn[ name ] = function( data, fn ) {
- if ( fn == null ) {
- fn = data;
- data = null;
- }
-
- return arguments.length > 0 ?
- this.on( name, null, data, fn ) :
- this.trigger( name );
- };
-
- if ( jQuery.attrFn ) {
- jQuery.attrFn[ name ] = true;
- }
-
- if ( rkeyEvent.test( name ) ) {
- jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
- }
-
- if ( rmouseEvent.test( name ) ) {
- jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
- }
-});
-
-
-
-/*!
- * Sizzle CSS Selector Engine
- * Copyright 2011, The Dojo Foundation
- * Released under the MIT, BSD, and GPL Licenses.
- * More information: http://sizzlejs.com/
- */
-(function(){
-
-var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
- expando = "sizcache" + (Math.random() + '').replace('.', ''),
- done = 0,
- toString = Object.prototype.toString,
- hasDuplicate = false,
- baseHasDuplicate = true,
- rBackslash = /\\/g,
- rReturn = /\r\n/g,
- rNonWord = /\W/;
-
-// Here we check if the JavaScript engine is using some sort of
-// optimization where it does not always call our comparision
-// function. If that is the case, discard the hasDuplicate value.
-// Thus far that includes Google Chrome.
-[0, 0].sort(function() {
- baseHasDuplicate = false;
- return 0;
-});
-
-var Sizzle = function( selector, context, results, seed ) {
- results = results || [];
- context = context || document;
-
- var origContext = context;
-
- if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
- return [];
- }
-
- if ( !selector || typeof selector !== "string" ) {
- return results;
- }
-
- var m, set, checkSet, extra, ret, cur, pop, i,
- prune = true,
- contextXML = Sizzle.isXML( context ),
- parts = [],
- soFar = selector;
-
- // Reset the position of the chunker regexp (start from head)
- do {
- chunker.exec( "" );
- m = chunker.exec( soFar );
-
- if ( m ) {
- soFar = m[3];
-
- parts.push( m[1] );
-
- if ( m[2] ) {
- extra = m[3];
- break;
- }
- }
- } while ( m );
-
- if ( parts.length > 1 && origPOS.exec( selector ) ) {
-
- if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
- set = posProcess( parts[0] + parts[1], context, seed );
-
- } else {
- set = Expr.relative[ parts[0] ] ?
- [ context ] :
- Sizzle( parts.shift(), context );
-
- while ( parts.length ) {
- selector = parts.shift();
-
- if ( Expr.relative[ selector ] ) {
- selector += parts.shift();
- }
-
- set = posProcess( selector, set, seed );
- }
- }
-
- } else {
- // Take a shortcut and set the context if the root selector is an ID
- // (but not if it'll be faster if the inner selector is an ID)
- if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
- Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
-
- ret = Sizzle.find( parts.shift(), context, contextXML );
- context = ret.expr ?
- Sizzle.filter( ret.expr, ret.set )[0] :
- ret.set[0];
- }
-
- if ( context ) {
- ret = seed ?
- { expr: parts.pop(), set: makeArray(seed) } :
- Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
-
- set = ret.expr ?
- Sizzle.filter( ret.expr, ret.set ) :
- ret.set;
-
- if ( parts.length > 0 ) {
- checkSet = makeArray( set );
-
- } else {
- prune = false;
- }
-
- while ( parts.length ) {
- cur = parts.pop();
- pop = cur;
-
- if ( !Expr.relative[ cur ] ) {
- cur = "";
- } else {
- pop = parts.pop();
- }
-
- if ( pop == null ) {
- pop = context;
- }
-
- Expr.relative[ cur ]( checkSet, pop, contextXML );
- }
-
- } else {
- checkSet = parts = [];
- }
- }
-
- if ( !checkSet ) {
- checkSet = set;
- }
-
- if ( !checkSet ) {
- Sizzle.error( cur || selector );
- }
-
- if ( toString.call(checkSet) === "[object Array]" ) {
- if ( !prune ) {
- results.push.apply( results, checkSet );
-
- } else if ( context && context.nodeType === 1 ) {
- for ( i = 0; checkSet[i] != null; i++ ) {
- if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
- results.push( set[i] );
- }
- }
-
- } else {
- for ( i = 0; checkSet[i] != null; i++ ) {
- if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
- results.push( set[i] );
- }
- }
- }
-
- } else {
- makeArray( checkSet, results );
- }
-
- if ( extra ) {
- Sizzle( extra, origContext, results, seed );
- Sizzle.uniqueSort( results );
- }
-
- return results;
-};
-
-Sizzle.uniqueSort = function( results ) {
- if ( sortOrder ) {
- hasDuplicate = baseHasDuplicate;
- results.sort( sortOrder );
-
- if ( hasDuplicate ) {
- for ( var i = 1; i < results.length; i++ ) {
- if ( results[i] === results[ i - 1 ] ) {
- results.splice( i--, 1 );
- }
- }
- }
- }
-
- return results;
-};
-
-Sizzle.matches = function( expr, set ) {
- return Sizzle( expr, null, null, set );
-};
-
-Sizzle.matchesSelector = function( node, expr ) {
- return Sizzle( expr, null, null, [node] ).length > 0;
-};
-
-Sizzle.find = function( expr, context, isXML ) {
- var set, i, len, match, type, left;
-
- if ( !expr ) {
- return [];
- }
-
- for ( i = 0, len = Expr.order.length; i < len; i++ ) {
- type = Expr.order[i];
-
- if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
- left = match[1];
- match.splice( 1, 1 );
-
- if ( left.substr( left.length - 1 ) !== "\\" ) {
- match[1] = (match[1] || "").replace( rBackslash, "" );
- set = Expr.find[ type ]( match, context, isXML );
-
- if ( set != null ) {
- expr = expr.replace( Expr.match[ type ], "" );
- break;
- }
- }
- }
- }
-
- if ( !set ) {
- set = typeof context.getElementsByTagName !== "undefined" ?
- context.getElementsByTagName( "*" ) :
- [];
- }
-
- return { set: set, expr: expr };
-};
-
-Sizzle.filter = function( expr, set, inplace, not ) {
- var match, anyFound,
- type, found, item, filter, left,
- i, pass,
- old = expr,
- result = [],
- curLoop = set,
- isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
-
- while ( expr && set.length ) {
- for ( type in Expr.filter ) {
- if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
- filter = Expr.filter[ type ];
- left = match[1];
-
- anyFound = false;
-
- match.splice(1,1);
-
- if ( left.substr( left.length - 1 ) === "\\" ) {
- continue;
- }
-
- if ( curLoop === result ) {
- result = [];
- }
-
- if ( Expr.preFilter[ type ] ) {
- match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
-
- if ( !match ) {
- anyFound = found = true;
-
- } else if ( match === true ) {
- continue;
- }
- }
-
- if ( match ) {
- for ( i = 0; (item = curLoop[i]) != null; i++ ) {
- if ( item ) {
- found = filter( item, match, i, curLoop );
- pass = not ^ found;
-
- if ( inplace && found != null ) {
- if ( pass ) {
- anyFound = true;
-
- } else {
- curLoop[i] = false;
- }
-
- } else if ( pass ) {
- result.push( item );
- anyFound = true;
- }
- }
- }
- }
-
- if ( found !== undefined ) {
- if ( !inplace ) {
- curLoop = result;
- }
-
- expr = expr.replace( Expr.match[ type ], "" );
-
- if ( !anyFound ) {
- return [];
- }
-
- break;
- }
- }
- }
-
- // Improper expression
- if ( expr === old ) {
- if ( anyFound == null ) {
- Sizzle.error( expr );
-
- } else {
- break;
- }
- }
-
- old = expr;
- }
-
- return curLoop;
-};
-
-Sizzle.error = function( msg ) {
- throw new Error( "Syntax error, unrecognized expression: " + msg );
-};
-
-/**
- * Utility function for retreiving the text value of an array of DOM nodes
- * @param {Array|Element} elem
- */
-var getText = Sizzle.getText = function( elem ) {
- var i, node,
- nodeType = elem.nodeType,
- ret = "";
-
- if ( nodeType ) {
- if ( nodeType === 1 || nodeType === 9 ) {
- // Use textContent || innerText for elements
- if ( typeof elem.textContent === 'string' ) {
- return elem.textContent;
- } else if ( typeof elem.innerText === 'string' ) {
- // Replace IE's carriage returns
- return elem.innerText.replace( rReturn, '' );
- } else {
- // Traverse it's children
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
- ret += getText( elem );
- }
- }
- } else if ( nodeType === 3 || nodeType === 4 ) {
- return elem.nodeValue;
- }
- } else {
-
- // If no nodeType, this is expected to be an array
- for ( i = 0; (node = elem[i]); i++ ) {
- // Do not traverse comment nodes
- if ( node.nodeType !== 8 ) {
- ret += getText( node );
- }
- }
- }
- return ret;
-};
-
-var Expr = Sizzle.selectors = {
- order: [ "ID", "NAME", "TAG" ],
-
- match: {
- ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
- CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
- NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
- ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
- TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
- CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
- POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
- PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
- },
-
- leftMatch: {},
-
- attrMap: {
- "class": "className",
- "for": "htmlFor"
- },
-
- attrHandle: {
- href: function( elem ) {
- return elem.getAttribute( "href" );
- },
- type: function( elem ) {
- return elem.getAttribute( "type" );
- }
- },
-
- relative: {
- "+": function(checkSet, part){
- var isPartStr = typeof part === "string",
- isTag = isPartStr && !rNonWord.test( part ),
- isPartStrNotTag = isPartStr && !isTag;
-
- if ( isTag ) {
- part = part.toLowerCase();
- }
-
- for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
- if ( (elem = checkSet[i]) ) {
- while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
-
- checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
- elem || false :
- elem === part;
- }
- }
-
- if ( isPartStrNotTag ) {
- Sizzle.filter( part, checkSet, true );
- }
- },
-
- ">": function( checkSet, part ) {
- var elem,
- isPartStr = typeof part === "string",
- i = 0,
- l = checkSet.length;
-
- if ( isPartStr && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
-
- for ( ; i < l; i++ ) {
- elem = checkSet[i];
-
- if ( elem ) {
- var parent = elem.parentNode;
- checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
- }
- }
-
- } else {
- for ( ; i < l; i++ ) {
- elem = checkSet[i];
-
- if ( elem ) {
- checkSet[i] = isPartStr ?
- elem.parentNode :
- elem.parentNode === part;
- }
- }
-
- if ( isPartStr ) {
- Sizzle.filter( part, checkSet, true );
- }
- }
- },
-
- "": function(checkSet, part, isXML){
- var nodeCheck,
- doneName = done++,
- checkFn = dirCheck;
-
- if ( typeof part === "string" && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
- nodeCheck = part;
- checkFn = dirNodeCheck;
- }
-
- checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
- },
-
- "~": function( checkSet, part, isXML ) {
- var nodeCheck,
- doneName = done++,
- checkFn = dirCheck;
-
- if ( typeof part === "string" && !rNonWord.test( part ) ) {
- part = part.toLowerCase();
- nodeCheck = part;
- checkFn = dirNodeCheck;
- }
-
- checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
- }
- },
-
- find: {
- ID: function( match, context, isXML ) {
- if ( typeof context.getElementById !== "undefined" && !isXML ) {
- var m = context.getElementById(match[1]);
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- return m && m.parentNode ? [m] : [];
- }
- },
-
- NAME: function( match, context ) {
- if ( typeof context.getElementsByName !== "undefined" ) {
- var ret = [],
- results = context.getElementsByName( match[1] );
-
- for ( var i = 0, l = results.length; i < l; i++ ) {
- if ( results[i].getAttribute("name") === match[1] ) {
- ret.push( results[i] );
- }
- }
-
- return ret.length === 0 ? null : ret;
- }
- },
-
- TAG: function( match, context ) {
- if ( typeof context.getElementsByTagName !== "undefined" ) {
- return context.getElementsByTagName( match[1] );
- }
- }
- },
- preFilter: {
- CLASS: function( match, curLoop, inplace, result, not, isXML ) {
- match = " " + match[1].replace( rBackslash, "" ) + " ";
-
- if ( isXML ) {
- return match;
- }
-
- for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
- if ( elem ) {
- if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
- if ( !inplace ) {
- result.push( elem );
- }
-
- } else if ( inplace ) {
- curLoop[i] = false;
- }
- }
- }
-
- return false;
- },
-
- ID: function( match ) {
- return match[1].replace( rBackslash, "" );
- },
-
- TAG: function( match, curLoop ) {
- return match[1].replace( rBackslash, "" ).toLowerCase();
- },
-
- CHILD: function( match ) {
- if ( match[1] === "nth" ) {
- if ( !match[2] ) {
- Sizzle.error( match[0] );
- }
-
- match[2] = match[2].replace(/^\+|\s*/g, '');
-
- // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
- var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
- match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
- !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
-
- // calculate the numbers (first)n+(last) including if they are negative
- match[2] = (test[1] + (test[2] || 1)) - 0;
- match[3] = test[3] - 0;
- }
- else if ( match[2] ) {
- Sizzle.error( match[0] );
- }
-
- // TODO: Move to normal caching system
- match[0] = done++;
-
- return match;
- },
-
- ATTR: function( match, curLoop, inplace, result, not, isXML ) {
- var name = match[1] = match[1].replace( rBackslash, "" );
-
- if ( !isXML && Expr.attrMap[name] ) {
- match[1] = Expr.attrMap[name];
- }
-
- // Handle if an un-quoted value was used
- match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
-
- if ( match[2] === "~=" ) {
- match[4] = " " + match[4] + " ";
- }
-
- return match;
- },
-
- PSEUDO: function( match, curLoop, inplace, result, not ) {
- if ( match[1] === "not" ) {
- // If we're dealing with a complex expression, or a simple one
- if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
- match[3] = Sizzle(match[3], null, null, curLoop);
-
- } else {
- var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
-
- if ( !inplace ) {
- result.push.apply( result, ret );
- }
-
- return false;
- }
-
- } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
- return true;
- }
-
- return match;
- },
-
- POS: function( match ) {
- match.unshift( true );
-
- return match;
- }
- },
-
- filters: {
- enabled: function( elem ) {
- return elem.disabled === false && elem.type !== "hidden";
- },
-
- disabled: function( elem ) {
- return elem.disabled === true;
- },
-
- checked: function( elem ) {
- return elem.checked === true;
- },
-
- selected: function( elem ) {
- // Accessing this property makes selected-by-default
- // options in Safari work properly
- if ( elem.parentNode ) {
- elem.parentNode.selectedIndex;
- }
-
- return elem.selected === true;
- },
-
- parent: function( elem ) {
- return !!elem.firstChild;
- },
-
- empty: function( elem ) {
- return !elem.firstChild;
- },
-
- has: function( elem, i, match ) {
- return !!Sizzle( match[3], elem ).length;
- },
-
- header: function( elem ) {
- return (/h\d/i).test( elem.nodeName );
- },
-
- text: function( elem ) {
- var attr = elem.getAttribute( "type" ), type = elem.type;
- // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
- // use getAttribute instead to test this case
- return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
- },
-
- radio: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
- },
-
- checkbox: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
- },
-
- file: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
- },
-
- password: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
- },
-
- submit: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && "submit" === elem.type;
- },
-
- image: function( elem ) {
- return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
- },
-
- reset: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return (name === "input" || name === "button") && "reset" === elem.type;
- },
-
- button: function( elem ) {
- var name = elem.nodeName.toLowerCase();
- return name === "input" && "button" === elem.type || name === "button";
- },
-
- input: function( elem ) {
- return (/input|select|textarea|button/i).test( elem.nodeName );
- },
-
- focus: function( elem ) {
- return elem === elem.ownerDocument.activeElement;
- }
- },
- setFilters: {
- first: function( elem, i ) {
- return i === 0;
- },
-
- last: function( elem, i, match, array ) {
- return i === array.length - 1;
- },
-
- even: function( elem, i ) {
- return i % 2 === 0;
- },
-
- odd: function( elem, i ) {
- return i % 2 === 1;
- },
-
- lt: function( elem, i, match ) {
- return i < match[3] - 0;
- },
-
- gt: function( elem, i, match ) {
- return i > match[3] - 0;
- },
-
- nth: function( elem, i, match ) {
- return match[3] - 0 === i;
- },
-
- eq: function( elem, i, match ) {
- return match[3] - 0 === i;
- }
- },
- filter: {
- PSEUDO: function( elem, match, i, array ) {
- var name = match[1],
- filter = Expr.filters[ name ];
-
- if ( filter ) {
- return filter( elem, i, match, array );
-
- } else if ( name === "contains" ) {
- return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
-
- } else if ( name === "not" ) {
- var not = match[3];
-
- for ( var j = 0, l = not.length; j < l; j++ ) {
- if ( not[j] === elem ) {
- return false;
- }
- }
-
- return true;
-
- } else {
- Sizzle.error( name );
- }
- },
-
- CHILD: function( elem, match ) {
- var first, last,
- doneName, parent, cache,
- count, diff,
- type = match[1],
- node = elem;
-
- switch ( type ) {
- case "only":
- case "first":
- while ( (node = node.previousSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- if ( type === "first" ) {
- return true;
- }
-
- node = elem;
-
- case "last":
- while ( (node = node.nextSibling) ) {
- if ( node.nodeType === 1 ) {
- return false;
- }
- }
-
- return true;
-
- case "nth":
- first = match[2];
- last = match[3];
-
- if ( first === 1 && last === 0 ) {
- return true;
- }
-
- doneName = match[0];
- parent = elem.parentNode;
-
- if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
- count = 0;
-
- for ( node = parent.firstChild; node; node = node.nextSibling ) {
- if ( node.nodeType === 1 ) {
- node.nodeIndex = ++count;
- }
- }
-
- parent[ expando ] = doneName;
- }
-
- diff = elem.nodeIndex - last;
-
- if ( first === 0 ) {
- return diff === 0;
-
- } else {
- return ( diff % first === 0 && diff / first >= 0 );
- }
- }
- },
-
- ID: function( elem, match ) {
- return elem.nodeType === 1 && elem.getAttribute("id") === match;
- },
-
- TAG: function( elem, match ) {
- return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
- },
-
- CLASS: function( elem, match ) {
- return (" " + (elem.className || elem.getAttribute("class")) + " ")
- .indexOf( match ) > -1;
- },
-
- ATTR: function( elem, match ) {
- var name = match[1],
- result = Sizzle.attr ?
- Sizzle.attr( elem, name ) :
- Expr.attrHandle[ name ] ?
- Expr.attrHandle[ name ]( elem ) :
- elem[ name ] != null ?
- elem[ name ] :
- elem.getAttribute( name ),
- value = result + "",
- type = match[2],
- check = match[4];
-
- return result == null ?
- type === "!=" :
- !type && Sizzle.attr ?
- result != null :
- type === "=" ?
- value === check :
- type === "*=" ?
- value.indexOf(check) >= 0 :
- type === "~=" ?
- (" " + value + " ").indexOf(check) >= 0 :
- !check ?
- value && result !== false :
- type === "!=" ?
- value !== check :
- type === "^=" ?
- value.indexOf(check) === 0 :
- type === "$=" ?
- value.substr(value.length - check.length) === check :
- type === "|=" ?
- value === check || value.substr(0, check.length + 1) === check + "-" :
- false;
- },
-
- POS: function( elem, match, i, array ) {
- var name = match[2],
- filter = Expr.setFilters[ name ];
-
- if ( filter ) {
- return filter( elem, i, match, array );
- }
- }
- }
-};
-
-var origPOS = Expr.match.POS,
- fescape = function(all, num){
- return "\\" + (num - 0 + 1);
- };
-
-for ( var type in Expr.match ) {
- Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
- Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
-}
-
-var makeArray = function( array, results ) {
- array = Array.prototype.slice.call( array, 0 );
-
- if ( results ) {
- results.push.apply( results, array );
- return results;
- }
-
- return array;
-};
-
-// Perform a simple check to determine if the browser is capable of
-// converting a NodeList to an array using builtin methods.
-// Also verifies that the returned array holds DOM nodes
-// (which is not the case in the Blackberry browser)
-try {
- Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
-
-// Provide a fallback method if it does not work
-} catch( e ) {
- makeArray = function( array, results ) {
- var i = 0,
- ret = results || [];
-
- if ( toString.call(array) === "[object Array]" ) {
- Array.prototype.push.apply( ret, array );
-
- } else {
- if ( typeof array.length === "number" ) {
- for ( var l = array.length; i < l; i++ ) {
- ret.push( array[i] );
- }
-
- } else {
- for ( ; array[i]; i++ ) {
- ret.push( array[i] );
- }
- }
- }
-
- return ret;
- };
-}
-
-var sortOrder, siblingCheck;
-
-if ( document.documentElement.compareDocumentPosition ) {
- sortOrder = function( a, b ) {
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
- }
-
- if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
- return a.compareDocumentPosition ? -1 : 1;
- }
-
- return a.compareDocumentPosition(b) & 4 ? -1 : 1;
- };
-
-} else {
- sortOrder = function( a, b ) {
- // The nodes are identical, we can exit early
- if ( a === b ) {
- hasDuplicate = true;
- return 0;
-
- // Fallback to using sourceIndex (in IE) if it's available on both nodes
- } else if ( a.sourceIndex && b.sourceIndex ) {
- return a.sourceIndex - b.sourceIndex;
- }
-
- var al, bl,
- ap = [],
- bp = [],
- aup = a.parentNode,
- bup = b.parentNode,
- cur = aup;
-
- // If the nodes are siblings (or identical) we can do a quick check
- if ( aup === bup ) {
- return siblingCheck( a, b );
-
- // If no parents were found then the nodes are disconnected
- } else if ( !aup ) {
- return -1;
-
- } else if ( !bup ) {
- return 1;
- }
-
- // Otherwise they're somewhere else in the tree so we need
- // to build up a full list of the parentNodes for comparison
- while ( cur ) {
- ap.unshift( cur );
- cur = cur.parentNode;
- }
-
- cur = bup;
-
- while ( cur ) {
- bp.unshift( cur );
- cur = cur.parentNode;
- }
-
- al = ap.length;
- bl = bp.length;
-
- // Start walking down the tree looking for a discrepancy
- for ( var i = 0; i < al && i < bl; i++ ) {
- if ( ap[i] !== bp[i] ) {
- return siblingCheck( ap[i], bp[i] );
- }
- }
-
- // We ended someplace up the tree so do a sibling check
- return i === al ?
- siblingCheck( a, bp[i], -1 ) :
- siblingCheck( ap[i], b, 1 );
- };
-
- siblingCheck = function( a, b, ret ) {
- if ( a === b ) {
- return ret;
- }
-
- var cur = a.nextSibling;
-
- while ( cur ) {
- if ( cur === b ) {
- return -1;
- }
-
- cur = cur.nextSibling;
- }
-
- return 1;
- };
-}
-
-// Check to see if the browser returns elements by name when
-// querying by getElementById (and provide a workaround)
-(function(){
- // We're going to inject a fake input element with a specified name
- var form = document.createElement("div"),
- id = "script" + (new Date()).getTime(),
- root = document.documentElement;
-
- form.innerHTML = "<a name='" + id + "'/>";
-
- // Inject it into the root element, check its status, and remove it quickly
- root.insertBefore( form, root.firstChild );
-
- // The workaround has to do additional checks after a getElementById
- // Which slows things down for other browsers (hence the branching)
- if ( document.getElementById( id ) ) {
- Expr.find.ID = function( match, context, isXML ) {
- if ( typeof context.getElementById !== "undefined" && !isXML ) {
- var m = context.getElementById(match[1]);
-
- return m ?
- m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
- [m] :
- undefined :
- [];
- }
- };
-
- Expr.filter.ID = function( elem, match ) {
- var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
-
- return elem.nodeType === 1 && node && node.nodeValue === match;
- };
- }
-
- root.removeChild( form );
-
- // release memory in IE
- root = form = null;
-})();
-
-(function(){
- // Check to see if the browser returns only elements
- // when doing getElementsByTagName("*")
-
- // Create a fake element
- var div = document.createElement("div");
- div.appendChild( document.createComment("") );
-
- // Make sure no comments are found
- if ( div.getElementsByTagName("*").length > 0 ) {
- Expr.find.TAG = function( match, context ) {
- var results = context.getElementsByTagName( match[1] );
-
- // Filter out possible comments
- if ( match[1] === "*" ) {
- var tmp = [];
-
- for ( var i = 0; results[i]; i++ ) {
- if ( results[i].nodeType === 1 ) {
- tmp.push( results[i] );
- }
- }
-
- results = tmp;
- }
-
- return results;
- };
- }
-
- // Check to see if an attribute returns normalized href attributes
- div.innerHTML = "<a href='#'></a>";
-
- if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
- div.firstChild.getAttribute("href") !== "#" ) {
-
- Expr.attrHandle.href = function( elem ) {
- return elem.getAttribute( "href", 2 );
- };
- }
-
- // release memory in IE
- div = null;
-})();
-
-if ( document.querySelectorAll ) {
- (function(){
- var oldSizzle = Sizzle,
- div = document.createElement("div"),
- id = "__sizzle__";
-
- div.innerHTML = "<p class='TEST'></p>";
-
- // Safari can't handle uppercase or unicode characters when
- // in quirks mode.
- if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
- return;
- }
-
- Sizzle = function( query, context, extra, seed ) {
- context = context || document;
-
- // Only use querySelectorAll on non-XML documents
- // (ID selectors don't work in non-HTML documents)
- if ( !seed && !Sizzle.isXML(context) ) {
- // See if we find a selector to speed up
- var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
-
- if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
- // Speed-up: Sizzle("TAG")
- if ( match[1] ) {
- return makeArray( context.getElementsByTagName( query ), extra );
-
- // Speed-up: Sizzle(".CLASS")
- } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
- return makeArray( context.getElementsByClassName( match[2] ), extra );
- }
- }
-
- if ( context.nodeType === 9 ) {
- // Speed-up: Sizzle("body")
- // The body element only exists once, optimize finding it
- if ( query === "body" && context.body ) {
- return makeArray( [ context.body ], extra );
-
- // Speed-up: Sizzle("#ID")
- } else if ( match && match[3] ) {
- var elem = context.getElementById( match[3] );
-
- // Check parentNode to catch when Blackberry 4.6 returns
- // nodes that are no longer in the document #6963
- if ( elem && elem.parentNode ) {
- // Handle the case where IE and Opera return items
- // by name instead of ID
- if ( elem.id === match[3] ) {
- return makeArray( [ elem ], extra );
- }
-
- } else {
- return makeArray( [], extra );
- }
- }
-
- try {
- return makeArray( context.querySelectorAll(query), extra );
- } catch(qsaError) {}
-
- // qSA works strangely on Element-rooted queries
- // We can work around this by specifying an extra ID on the root
- // and working up from there (Thanks to Andrew Dupont for the technique)
- // IE 8 doesn't work on object elements
- } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
- var oldContext = context,
- old = context.getAttribute( "id" ),
- nid = old || id,
- hasParent = context.parentNode,
- relativeHierarchySelector = /^\s*[+~]/.test( query );
-
- if ( !old ) {
- context.setAttribute( "id", nid );
- } else {
- nid = nid.replace( /'/g, "\\$&" );
- }
- if ( relativeHierarchySelector && hasParent ) {
- context = context.parentNode;
- }
-
- try {
- if ( !relativeHierarchySelector || hasParent ) {
- return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
- }
-
- } catch(pseudoError) {
- } finally {
- if ( !old ) {
- oldContext.removeAttribute( "id" );
- }
- }
- }
- }
-
- return oldSizzle(query, context, extra, seed);
- };
-
- for ( var prop in oldSizzle ) {
- Sizzle[ prop ] = oldSizzle[ prop ];
- }
-
- // release memory in IE
- div = null;
- })();
-}
-
-(function(){
- var html = document.documentElement,
- matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
-
- if ( matches ) {
- // Check to see if it's possible to do matchesSelector
- // on a disconnected node (IE 9 fails this)
- var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
- pseudoWorks = false;
-
- try {
- // This should fail with an exception
- // Gecko does not error, returns false instead
- matches.call( document.documentElement, "[test!='']:sizzle" );
-
- } catch( pseudoError ) {
- pseudoWorks = true;
- }
-
- Sizzle.matchesSelector = function( node, expr ) {
- // Make sure that attribute selectors are quoted
- expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
-
- if ( !Sizzle.isXML( node ) ) {
- try {
- if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
- var ret = matches.call( node, expr );
-
- // IE 9's matchesSelector returns false on disconnected nodes
- if ( ret || !disconnectedMatch ||
- // As well, disconnected nodes are said to be in a document
- // fragment in IE 9, so check for that
- node.document && node.document.nodeType !== 11 ) {
- return ret;
- }
- }
- } catch(e) {}
- }
-
- return Sizzle(expr, null, null, [node]).length > 0;
- };
- }
-})();
-
-(function(){
- var div = document.createElement("div");
-
- div.innerHTML = "<div class='test e'></div><div class='test'></div>";
-
- // Opera can't find a second classname (in 9.6)
- // Also, make sure that getElementsByClassName actually exists
- if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
- return;
- }
-
- // Safari caches class attributes, doesn't catch changes (in 3.2)
- div.lastChild.className = "e";
-
- if ( div.getElementsByClassName("e").length === 1 ) {
- return;
- }
-
- Expr.order.splice(1, 0, "CLASS");
- Expr.find.CLASS = function( match, context, isXML ) {
- if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
- return context.getElementsByClassName(match[1]);
- }
- };
-
- // release memory in IE
- div = null;
-})();
-
-function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
- var elem = checkSet[i];
-
- if ( elem ) {
- var match = false;
-
- elem = elem[dir];
-
- while ( elem ) {
- if ( elem[ expando ] === doneName ) {
- match = checkSet[elem.sizset];
- break;
- }
-
- if ( elem.nodeType === 1 && !isXML ){
- elem[ expando ] = doneName;
- elem.sizset = i;
- }
-
- if ( elem.nodeName.toLowerCase() === cur ) {
- match = elem;
- break;
- }
-
- elem = elem[dir];
- }
-
- checkSet[i] = match;
- }
- }
-}
-
-function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
- for ( var i = 0, l = checkSet.length; i < l; i++ ) {
- var elem = checkSet[i];
-
- if ( elem ) {
- var match = false;
-
- elem = elem[dir];
-
- while ( elem ) {
- if ( elem[ expando ] === doneName ) {
- match = checkSet[elem.sizset];
- break;
- }
-
- if ( elem.nodeType === 1 ) {
- if ( !isXML ) {
- elem[ expando ] = doneName;
- elem.sizset = i;
- }
-
- if ( typeof cur !== "string" ) {
- if ( elem === cur ) {
- match = true;
- break;
- }
-
- } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
- match = elem;
- break;
- }
- }
-
- elem = elem[dir];
- }
-
- checkSet[i] = match;
- }
- }
-}
-
-if ( document.documentElement.contains ) {
- Sizzle.contains = function( a, b ) {
- return a !== b && (a.contains ? a.contains(b) : true);
- };
-
-} else if ( document.documentElement.compareDocumentPosition ) {
- Sizzle.contains = function( a, b ) {
- return !!(a.compareDocumentPosition(b) & 16);
- };
-
-} else {
- Sizzle.contains = function() {
- return false;
- };
-}
-
-Sizzle.isXML = function( elem ) {
- // documentElement is verified for cases where it doesn't yet exist
- // (such as loading iframes in IE - #4833)
- var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
-
- return documentElement ? documentElement.nodeName !== "HTML" : false;
-};
-
-var posProcess = function( selector, context, seed ) {
- var match,
- tmpSet = [],
- later = "",
- root = context.nodeType ? [context] : context;
-
- // Position selectors must be done after the filter
- // And so must :not(positional) so we move all PSEUDOs to the end
- while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
- later += match[0];
- selector = selector.replace( Expr.match.PSEUDO, "" );
- }
-
- selector = Expr.relative[selector] ? selector + "*" : selector;
-
- for ( var i = 0, l = root.length; i < l; i++ ) {
- Sizzle( selector, root[i], tmpSet, seed );
- }
-
- return Sizzle.filter( later, tmpSet );
-};
-
-// EXPOSE
-// Override sizzle attribute retrieval
-Sizzle.attr = jQuery.attr;
-Sizzle.selectors.attrMap = {};
-jQuery.find = Sizzle;
-jQuery.expr = Sizzle.selectors;
-jQuery.expr[":"] = jQuery.expr.filters;
-jQuery.unique = Sizzle.uniqueSort;
-jQuery.text = Sizzle.getText;
-jQuery.isXMLDoc = Sizzle.isXML;
-jQuery.contains = Sizzle.contains;
-
-
-})();
-
-
-var runtil = /Until$/,
- rparentsprev = /^(?:parents|prevUntil|prevAll)/,
- // Note: This RegExp should be improved, or likely pulled from Sizzle
- rmultiselector = /,/,
- isSimple = /^.[^:#\[\.,]*$/,
- slice = Array.prototype.slice,
- POS = jQuery.expr.match.POS,
- // methods guaranteed to produce a unique set when starting from a unique set
- guaranteedUnique = {
- children: true,
- contents: true,
- next: true,
- prev: true
- };
-
-jQuery.fn.extend({
- find: function( selector ) {
- var self = this,
- i, l;
-
- if ( typeof selector !== "string" ) {
- return jQuery( selector ).filter(function() {
- for ( i = 0, l = self.length; i < l; i++ ) {
- if ( jQuery.contains( self[ i ], this ) ) {
- return true;
- }
- }
- });
- }
-
- var ret = this.pushStack( "", "find", selector ),
- length, n, r;
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- length = ret.length;
- jQuery.find( selector, this[i], ret );
-
- if ( i > 0 ) {
- // Make sure that the results are unique
- for ( n = length; n < ret.length; n++ ) {
- for ( r = 0; r < length; r++ ) {
- if ( ret[r] === ret[n] ) {
- ret.splice(n--, 1);
- break;
- }
- }
- }
- }
- }
-
- return ret;
- },
-
- has: function( target ) {
- var targets = jQuery( target );
- return this.filter(function() {
- for ( var i = 0, l = targets.length; i < l; i++ ) {
- if ( jQuery.contains( this, targets[i] ) ) {
- return true;
- }
- }
- });
- },
-
- not: function( selector ) {
- return this.pushStack( winnow(this, selector, false), "not", selector);
- },
-
- filter: function( selector ) {
- return this.pushStack( winnow(this, selector, true), "filter", selector );
- },
-
- is: function( selector ) {
- return !!selector && (
- typeof selector === "string" ?
- // If this is a positional selector, check membership in the returned set
- // so $("p:first").is("p:last") won't return true for a doc with two "p".
- POS.test( selector ) ?
- jQuery( selector, this.context ).index( this[0] ) >= 0 :
- jQuery.filter( selector, this ).length > 0 :
- this.filter( selector ).length > 0 );
- },
-
- closest: function( selectors, context ) {
- var ret = [], i, l, cur = this[0];
-
- // Array (deprecated as of jQuery 1.7)
- if ( jQuery.isArray( selectors ) ) {
- var level = 1;
-
- while ( cur && cur.ownerDocument && cur !== context ) {
- for ( i = 0; i < selectors.length; i++ ) {
-
- if ( jQuery( cur ).is( selectors[ i ] ) ) {
- ret.push({ selector: selectors[ i ], elem: cur, level: level });
- }
- }
-
- cur = cur.parentNode;
- level++;
- }
-
- return ret;
- }
-
- // String
- var pos = POS.test( selectors ) || typeof selectors !== "string" ?
- jQuery( selectors, context || this.context ) :
- 0;
-
- for ( i = 0, l = this.length; i < l; i++ ) {
- cur = this[i];
-
- while ( cur ) {
- if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
- ret.push( cur );
- break;
-
- } else {
- cur = cur.parentNode;
- if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
- break;
- }
- }
- }
- }
-
- ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
-
- return this.pushStack( ret, "closest", selectors );
- },
-
- // Determine the position of an element within
- // the matched set of elements
- index: function( elem ) {
-
- // No argument, return index in parent
- if ( !elem ) {
- return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
- }
-
- // index in selector
- if ( typeof elem === "string" ) {
- return jQuery.inArray( this[0], jQuery( elem ) );
- }
-
- // Locate the position of the desired element
- return jQuery.inArray(
- // If it receives a jQuery object, the first element is used
- elem.jquery ? elem[0] : elem, this );
- },
-
- add: function( selector, context ) {
- var set = typeof selector === "string" ?
- jQuery( selector, context ) :
- jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
- all = jQuery.merge( this.get(), set );
-
- return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
- all :
- jQuery.unique( all ) );
- },
-
- andSelf: function() {
- return this.add( this.prevObject );
- }
-});
-
-// A painfully simple check to see if an element is disconnected
-// from a document (should be improved, where feasible).
-function isDisconnected( node ) {
- return !node || !node.parentNode || node.parentNode.nodeType === 11;
-}
-
-jQuery.each({
- parent: function( elem ) {
- var parent = elem.parentNode;
- return parent && parent.nodeType !== 11 ? parent : null;
- },
- parents: function( elem ) {
- return jQuery.dir( elem, "parentNode" );
- },
- parentsUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "parentNode", until );
- },
- next: function( elem ) {
- return jQuery.nth( elem, 2, "nextSibling" );
- },
- prev: function( elem ) {
- return jQuery.nth( elem, 2, "previousSibling" );
- },
- nextAll: function( elem ) {
- return jQuery.dir( elem, "nextSibling" );
- },
- prevAll: function( elem ) {
- return jQuery.dir( elem, "previousSibling" );
- },
- nextUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "nextSibling", until );
- },
- prevUntil: function( elem, i, until ) {
- return jQuery.dir( elem, "previousSibling", until );
- },
- siblings: function( elem ) {
- return jQuery.sibling( elem.parentNode.firstChild, elem );
- },
- children: function( elem ) {
- return jQuery.sibling( elem.firstChild );
- },
- contents: function( elem ) {
- return jQuery.nodeName( elem, "iframe" ) ?
- elem.contentDocument || elem.contentWindow.document :
- jQuery.makeArray( elem.childNodes );
- }
-}, function( name, fn ) {
- jQuery.fn[ name ] = function( until, selector ) {
- var ret = jQuery.map( this, fn, until );
-
- if ( !runtil.test( name ) ) {
- selector = until;
- }
-
- if ( selector && typeof selector === "string" ) {
- ret = jQuery.filter( selector, ret );
- }
-
- ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
-
- if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
- ret = ret.reverse();
- }
-
- return this.pushStack( ret, name, slice.call( arguments ).join(",") );
- };
-});
-
-jQuery.extend({
- filter: function( expr, elems, not ) {
- if ( not ) {
- expr = ":not(" + expr + ")";
- }
-
- return elems.length === 1 ?
- jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
- jQuery.find.matches(expr, elems);
- },
-
- dir: function( elem, dir, until ) {
- var matched = [],
- cur = elem[ dir ];
-
- while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
- if ( cur.nodeType === 1 ) {
- matched.push( cur );
- }
- cur = cur[dir];
- }
- return matched;
- },
-
- nth: function( cur, result, dir, elem ) {
- result = result || 1;
- var num = 0;
-
- for ( ; cur; cur = cur[dir] ) {
- if ( cur.nodeType === 1 && ++num === result ) {
- break;
- }
- }
-
- return cur;
- },
-
- sibling: function( n, elem ) {
- var r = [];
-
- for ( ; n; n = n.nextSibling ) {
- if ( n.nodeType === 1 && n !== elem ) {
- r.push( n );
- }
- }
-
- return r;
- }
-});
-
-// Implement the identical functionality for filter and not
-function winnow( elements, qualifier, keep ) {
-
- // Can't pass null or undefined to indexOf in Firefox 4
- // Set to 0 to skip string check
- qualifier = qualifier || 0;
-
- if ( jQuery.isFunction( qualifier ) ) {
- return jQuery.grep(elements, function( elem, i ) {
- var retVal = !!qualifier.call( elem, i, elem );
- return retVal === keep;
- });
-
- } else if ( qualifier.nodeType ) {
- return jQuery.grep(elements, function( elem, i ) {
- return ( elem === qualifier ) === keep;
- });
-
- } else if ( typeof qualifier === "string" ) {
- var filtered = jQuery.grep(elements, function( elem ) {
- return elem.nodeType === 1;
- });
-
- if ( isSimple.test( qualifier ) ) {
- return jQuery.filter(qualifier, filtered, !keep);
- } else {
- qualifier = jQuery.filter( qualifier, filtered );
- }
- }
-
- return jQuery.grep(elements, function( elem, i ) {
- return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
- });
-}
-
-
-
-
-function createSafeFragment( document ) {
- var list = nodeNames.split( "|" ),
- safeFrag = document.createDocumentFragment();
-
- if ( safeFrag.createElement ) {
- while ( list.length ) {
- safeFrag.createElement(
- list.pop()
- );
- }
- }
- return safeFrag;
-}
-
-var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" +
- "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
- rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
- rleadingWhitespace = /^\s+/,
- rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
- rtagName = /<([\w:]+)/,
- rtbody = /<tbody/i,
- rhtml = /<|&#?\w+;/,
- rnoInnerhtml = /<(?:script|style)/i,
- rnocache = /<(?:script|object|embed|option|style)/i,
- rnoshimcache = new RegExp("<(?:" + nodeNames + ")", "i"),
- // checked="checked" or checked
- rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
- rscriptType = /\/(java|ecma)script/i,
- rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
- wrapMap = {
- option: [ 1, "<select multiple='multiple'>", "</select>" ],
- legend: [ 1, "<fieldset>", "</fieldset>" ],
- thead: [ 1, "<table>", "</table>" ],
- tr: [ 2, "<table><tbody>", "</tbody></table>" ],
- td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
- col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
- area: [ 1, "<map>", "</map>" ],
- _default: [ 0, "", "" ]
- },
- safeFragment = createSafeFragment( document );
-
-wrapMap.optgroup = wrapMap.option;
-wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
-wrapMap.th = wrapMap.td;
-
-// IE can't serialize <link> and <script> tags normally
-if ( !jQuery.support.htmlSerialize ) {
- wrapMap._default = [ 1, "div<div>", "</div>" ];
-}
-
-jQuery.fn.extend({
- text: function( text ) {
- if ( jQuery.isFunction(text) ) {
- return this.each(function(i) {
- var self = jQuery( this );
-
- self.text( text.call(this, i, self.text()) );
- });
- }
-
- if ( typeof text !== "object" && text !== undefined ) {
- return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
- }
-
- return jQuery.text( this );
- },
-
- wrapAll: function( html ) {
- if ( jQuery.isFunction( html ) ) {
- return this.each(function(i) {
- jQuery(this).wrapAll( html.call(this, i) );
- });
- }
-
- if ( this[0] ) {
- // The elements to wrap the target around
- var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
-
- if ( this[0].parentNode ) {
- wrap.insertBefore( this[0] );
- }
-
- wrap.map(function() {
- var elem = this;
-
- while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
- elem = elem.firstChild;
- }
-
- return elem;
- }).append( this );
- }
-
- return this;
- },
-
- wrapInner: function( html ) {
- if ( jQuery.isFunction( html ) ) {
- return this.each(function(i) {
- jQuery(this).wrapInner( html.call(this, i) );
- });
- }
-
- return this.each(function() {
- var self = jQuery( this ),
- contents = self.contents();
-
- if ( contents.length ) {
- contents.wrapAll( html );
-
- } else {
- self.append( html );
- }
- });
- },
-
- wrap: function( html ) {
- var isFunction = jQuery.isFunction( html );
-
- return this.each(function(i) {
- jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
- });
- },
-
- unwrap: function() {
- return this.parent().each(function() {
- if ( !jQuery.nodeName( this, "body" ) ) {
- jQuery( this ).replaceWith( this.childNodes );
- }
- }).end();
- },
-
- append: function() {
- return this.domManip(arguments, true, function( elem ) {
- if ( this.nodeType === 1 ) {
- this.appendChild( elem );
- }
- });
- },
-
- prepend: function() {
- return this.domManip(arguments, true, function( elem ) {
- if ( this.nodeType === 1 ) {
- this.insertBefore( elem, this.firstChild );
- }
- });
- },
-
- before: function() {
- if ( this[0] && this[0].parentNode ) {
- return this.domManip(arguments, false, function( elem ) {
- this.parentNode.insertBefore( elem, this );
- });
- } else if ( arguments.length ) {
- var set = jQuery.clean( arguments );
- set.push.apply( set, this.toArray() );
- return this.pushStack( set, "before", arguments );
- }
- },
-
- after: function() {
- if ( this[0] && this[0].parentNode ) {
- return this.domManip(arguments, false, function( elem ) {
- this.parentNode.insertBefore( elem, this.nextSibling );
- });
- } else if ( arguments.length ) {
- var set = this.pushStack( this, "after", arguments );
- set.push.apply( set, jQuery.clean(arguments) );
- return set;
- }
- },
-
- // keepData is for internal use only--do not document
- remove: function( selector, keepData ) {
- for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
- if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
- if ( !keepData && elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName("*") );
- jQuery.cleanData( [ elem ] );
- }
-
- if ( elem.parentNode ) {
- elem.parentNode.removeChild( elem );
- }
- }
- }
-
- return this;
- },
-
- empty: function() {
- for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
- // Remove element nodes and prevent memory leaks
- if ( elem.nodeType === 1 ) {
- jQuery.cleanData( elem.getElementsByTagName("*") );
- }
-
- // Remove any remaining nodes
- while ( elem.firstChild ) {
- elem.removeChild( elem.firstChild );
- }
- }
-
- return this;
- },
-
- clone: function( dataAndEvents, deepDataAndEvents ) {
- dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
- deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
-
- return this.map( function () {
- return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
- });
- },
-
- html: function( value ) {
- if ( value === undefined ) {
- return this[0] && this[0].nodeType === 1 ?
- this[0].innerHTML.replace(rinlinejQuery, "") :
- null;
-
- // See if we can take a shortcut and just use innerHTML
- } else if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
- (jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
- !wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
-
- value = value.replace(rxhtmlTag, "<$1></$2>");
-
- try {
- for ( var i = 0, l = this.length; i < l; i++ ) {
- // Remove element nodes and prevent memory leaks
- if ( this[i].nodeType === 1 ) {
- jQuery.cleanData( this[i].getElementsByTagName("*") );
- this[i].innerHTML = value;
- }
- }
-
- // If using innerHTML throws an exception, use the fallback method
- } catch(e) {
- this.empty().append( value );
- }
-
- } else if ( jQuery.isFunction( value ) ) {
- this.each(function(i){
- var self = jQuery( this );
-
- self.html( value.call(this, i, self.html()) );
- });
-
- } else {
- this.empty().append( value );
- }
-
- return this;
- },
-
- replaceWith: function( value ) {
- if ( this[0] && this[0].parentNode ) {
- // Make sure that the elements are removed from the DOM before they are inserted
- // this can help fix replacing a parent with child elements
- if ( jQuery.isFunction( value ) ) {
- return this.each(function(i) {
- var self = jQuery(this), old = self.html();
- self.replaceWith( value.call( this, i, old ) );
- });
- }
-
- if ( typeof value !== "string" ) {
- value = jQuery( value ).detach();
- }
-
- return this.each(function() {
- var next = this.nextSibling,
- parent = this.parentNode;
-
- jQuery( this ).remove();
-
- if ( next ) {
- jQuery(next).before( value );
- } else {
- jQuery(parent).append( value );
- }
- });
- } else {
- return this.length ?
- this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
- this;
- }
- },
-
- detach: function( selector ) {
- return this.remove( selector, true );
- },
-
- domManip: function( args, table, callback ) {
- var results, first, fragment, parent,
- value = args[0],
- scripts = [];
-
- // We can't cloneNode fragments that contain checked, in WebKit
- if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
- return this.each(function() {
- jQuery(this).domManip( args, table, callback, true );
- });
- }
-
- if ( jQuery.isFunction(value) ) {
- return this.each(function(i) {
- var self = jQuery(this);
- args[0] = value.call(this, i, table ? self.html() : undefined);
- self.domManip( args, table, callback );
- });
- }
-
- if ( this[0] ) {
- parent = value && value.parentNode;
-
- // If we're in a fragment, just use that instead of building a new one
- if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
- results = { fragment: parent };
-
- } else {
- results = jQuery.buildFragment( args, this, scripts );
- }
-
- fragment = results.fragment;
-
- if ( fragment.childNodes.length === 1 ) {
- first = fragment = fragment.firstChild;
- } else {
- first = fragment.firstChild;
- }
-
- if ( first ) {
- table = table && jQuery.nodeName( first, "tr" );
-
- for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
- callback.call(
- table ?
- root(this[i], first) :
- this[i],
- // Make sure that we do not leak memory by inadvertently discarding
- // the original fragment (which might have attached data) instead of
- // using it; in addition, use the original fragment object for the last
- // item instead of first because it can end up being emptied incorrectly
- // in certain situations (Bug #8070).
- // Fragments from the fragment cache must always be cloned and never used
- // in place.
- results.cacheable || ( l > 1 && i < lastIndex ) ?
- jQuery.clone( fragment, true, true ) :
- fragment
- );
- }
- }
-
- if ( scripts.length ) {
- jQuery.each( scripts, evalScript );
- }
- }
-
- return this;
- }
-});
-
-function root( elem, cur ) {
- return jQuery.nodeName(elem, "table") ?
- (elem.getElementsByTagName("tbody")[0] ||
- elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
- elem;
-}
-
-function cloneCopyEvent( src, dest ) {
-
- if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
- return;
- }
-
- var type, i, l,
- oldData = jQuery._data( src ),
- curData = jQuery._data( dest, oldData ),
- events = oldData.events;
-
- if ( events ) {
- delete curData.handle;
- curData.events = {};
-
- for ( type in events ) {
- for ( i = 0, l = events[ type ].length; i < l; i++ ) {
- jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
- }
- }
- }
-
- // make the cloned public data object a copy from the original
- if ( curData.data ) {
- curData.data = jQuery.extend( {}, curData.data );
- }
-}
-
-function cloneFixAttributes( src, dest ) {
- var nodeName;
-
- // We do not need to do anything for non-Elements
- if ( dest.nodeType !== 1 ) {
- return;
- }
-
- // clearAttributes removes the attributes, which we don't want,
- // but also removes the attachEvent events, which we *do* want
- if ( dest.clearAttributes ) {
- dest.clearAttributes();
- }
-
- // mergeAttributes, in contrast, only merges back on the
- // original attributes, not the events
- if ( dest.mergeAttributes ) {
- dest.mergeAttributes( src );
- }
-
- nodeName = dest.nodeName.toLowerCase();
-
- // IE6-8 fail to clone children inside object elements that use
- // the proprietary classid attribute value (rather than the type
- // attribute) to identify the type of content to display
- if ( nodeName === "object" ) {
- dest.outerHTML = src.outerHTML;
-
- } else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
- // IE6-8 fails to persist the checked state of a cloned checkbox
- // or radio button. Worse, IE6-7 fail to give the cloned element
- // a checked appearance if the defaultChecked value isn't also set
- if ( src.checked ) {
- dest.defaultChecked = dest.checked = src.checked;
- }
-
- // IE6-7 get confused and end up setting the value of a cloned
- // checkbox/radio button to an empty string instead of "on"
- if ( dest.value !== src.value ) {
- dest.value = src.value;
- }
-
- // IE6-8 fails to return the selected option to the default selected
- // state when cloning options
- } else if ( nodeName === "option" ) {
- dest.selected = src.defaultSelected;
-
- // IE6-8 fails to set the defaultValue to the correct value when
- // cloning other types of input fields
- } else if ( nodeName === "input" || nodeName === "textarea" ) {
- dest.defaultValue = src.defaultValue;
- }
-
- // Event data gets referenced instead of copied if the expando
- // gets copied too
- dest.removeAttribute( jQuery.expando );
-}
-
-jQuery.buildFragment = function( args, nodes, scripts ) {
- var fragment, cacheable, cacheresults, doc,
- first = args[ 0 ];
-
- // nodes may contain either an explicit document object,
- // a jQuery collection or context object.
- // If nodes[0] contains a valid object to assign to doc
- if ( nodes && nodes[0] ) {
- doc = nodes[0].ownerDocument || nodes[0];
- }
-
- // Ensure that an attr object doesn't incorrectly stand in as a document object
- // Chrome and Firefox seem to allow this to occur and will throw exception
- // Fixes #8950
- if ( !doc.createDocumentFragment ) {
- doc = document;
- }
-
- // Only cache "small" (1/2 KB) HTML strings that are associated with the main document
- // Cloning options loses the selected state, so don't cache them
- // IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
- // Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
- // Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
- if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document &&
- first.charAt(0) === "<" && !rnocache.test( first ) &&
- (jQuery.support.checkClone || !rchecked.test( first )) &&
- (jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
-
- cacheable = true;
-
- cacheresults = jQuery.fragments[ first ];
- if ( cacheresults && cacheresults !== 1 ) {
- fragment = cacheresults;
- }
- }
-
- if ( !fragment ) {
- fragment = doc.createDocumentFragment();
- jQuery.clean( args, doc, fragment, scripts );
- }
-
- if ( cacheable ) {
- jQuery.fragments[ first ] = cacheresults ? fragment : 1;
- }
-
- return { fragment: fragment, cacheable: cacheable };
-};
-
-jQuery.fragments = {};
-
-jQuery.each({
- appendTo: "append",
- prependTo: "prepend",
- insertBefore: "before",
- insertAfter: "after",
- replaceAll: "replaceWith"
-}, function( name, original ) {
- jQuery.fn[ name ] = function( selector ) {
- var ret = [],
- insert = jQuery( selector ),
- parent = this.length === 1 && this[0].parentNode;
-
- if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
- insert[ original ]( this[0] );
- return this;
-
- } else {
- for ( var i = 0, l = insert.length; i < l; i++ ) {
- var elems = ( i > 0 ? this.clone(true) : this ).get();
- jQuery( insert[i] )[ original ]( elems );
- ret = ret.concat( elems );
- }
-
- return this.pushStack( ret, name, insert.selector );
- }
- };
-});
-
-function getAll( elem ) {
- if ( typeof elem.getElementsByTagName !== "undefined" ) {
- return elem.getElementsByTagName( "*" );
-
- } else if ( typeof elem.querySelectorAll !== "undefined" ) {
- return elem.querySelectorAll( "*" );
-
- } else {
- return [];
- }
-}
-
-// Used in clean, fixes the defaultChecked property
-function fixDefaultChecked( elem ) {
- if ( elem.type === "checkbox" || elem.type === "radio" ) {
- elem.defaultChecked = elem.checked;
- }
-}
-// Finds all inputs and passes them to fixDefaultChecked
-function findInputs( elem ) {
- var nodeName = ( elem.nodeName || "" ).toLowerCase();
- if ( nodeName === "input" ) {
- fixDefaultChecked( elem );
- // Skip scripts, get other children
- } else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) {
- jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
- }
-}
-
-// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js
-function shimCloneNode( elem ) {
- var div = document.createElement( "div" );
- safeFragment.appendChild( div );
-
- div.innerHTML = elem.outerHTML;
- return div.firstChild;
-}
-
-jQuery.extend({
- clone: function( elem, dataAndEvents, deepDataAndEvents ) {
- var srcElements,
- destElements,
- i,
- // IE<=8 does not properly clone detached, unknown element nodes
- clone = jQuery.support.html5Clone || !rnoshimcache.test( "<" + elem.nodeName ) ?
- elem.cloneNode( true ) :
- shimCloneNode( elem );
-
- if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
- (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
- // IE copies events bound via attachEvent when using cloneNode.
- // Calling detachEvent on the clone will also remove the events
- // from the original. In order to get around this, we use some
- // proprietary methods to clear the events. Thanks to MooTools
- // guys for this hotness.
-
- cloneFixAttributes( elem, clone );
-
- // Using Sizzle here is crazy slow, so we use getElementsByTagName instead
- srcElements = getAll( elem );
- destElements = getAll( clone );
-
- // Weird iteration because IE will replace the length property
- // with an element if you are cloning the body and one of the
- // elements on the page has a name or id of "length"
- for ( i = 0; srcElements[i]; ++i ) {
- // Ensure that the destination node is not null; Fixes #9587
- if ( destElements[i] ) {
- cloneFixAttributes( srcElements[i], destElements[i] );
- }
- }
- }
-
- // Copy the events from the original to the clone
- if ( dataAndEvents ) {
- cloneCopyEvent( elem, clone );
-
- if ( deepDataAndEvents ) {
- srcElements = getAll( elem );
- destElements = getAll( clone );
-
- for ( i = 0; srcElements[i]; ++i ) {
- cloneCopyEvent( srcElements[i], destElements[i] );
- }
- }
- }
-
- srcElements = destElements = null;
-
- // Return the cloned set
- return clone;
- },
-
- clean: function( elems, context, fragment, scripts ) {
- var checkScriptType;
-
- context = context || document;
-
- // !context.createElement fails in IE with an error but returns typeof 'object'
- if ( typeof context.createElement === "undefined" ) {
- context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
- }
-
- var ret = [], j;
-
- for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
- if ( typeof elem === "number" ) {
- elem += "";
- }
-
- if ( !elem ) {
- continue;
- }
-
- // Convert html string into DOM nodes
- if ( typeof elem === "string" ) {
- if ( !rhtml.test( elem ) ) {
- elem = context.createTextNode( elem );
- } else {
- // Fix "XHTML"-style tags in all browsers
- elem = elem.replace(rxhtmlTag, "<$1></$2>");
-
- // Trim whitespace, otherwise indexOf won't work as expected
- var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
- wrap = wrapMap[ tag ] || wrapMap._default,
- depth = wrap[0],
- div = context.createElement("div");
-
- // Append wrapper element to unknown element safe doc fragment
- if ( context === document ) {
- // Use the fragment we've already created for this document
- safeFragment.appendChild( div );
- } else {
- // Use a fragment created with the owner document
- createSafeFragment( context ).appendChild( div );
- }
-
- // Go to html and back, then peel off extra wrappers
- div.innerHTML = wrap[1] + elem + wrap[2];
-
- // Move to the right depth
- while ( depth-- ) {
- div = div.lastChild;
- }
-
- // Remove IE's autoinserted <tbody> from table fragments
- if ( !jQuery.support.tbody ) {
-
- // String was a <table>, *may* have spurious <tbody>
- var hasBody = rtbody.test(elem),
- tbody = tag === "table" && !hasBody ?
- div.firstChild && div.firstChild.childNodes :
-
- // String was a bare <thead> or <tfoot>
- wrap[1] === "<table>" && !hasBody ?
- div.childNodes :
- [];
-
- for ( j = tbody.length - 1; j >= 0 ; --j ) {
- if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
- tbody[ j ].parentNode.removeChild( tbody[ j ] );
- }
- }
- }
-
- // IE completely kills leading whitespace when innerHTML is used
- if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
- div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
- }
-
- elem = div.childNodes;
- }
- }
-
- // Resets defaultChecked for any radios and checkboxes
- // about to be appended to the DOM in IE 6/7 (#8060)
- var len;
- if ( !jQuery.support.appendChecked ) {
- if ( elem[0] && typeof (len = elem.length) === "number" ) {
- for ( j = 0; j < len; j++ ) {
- findInputs( elem[j] );
- }
- } else {
- findInputs( elem );
- }
- }
-
- if ( elem.nodeType ) {
- ret.push( elem );
- } else {
- ret = jQuery.merge( ret, elem );
- }
- }
-
- if ( fragment ) {
- checkScriptType = function( elem ) {
- return !elem.type || rscriptType.test( elem.type );
- };
- for ( i = 0; ret[i]; i++ ) {
- if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
- scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
-
- } else {
- if ( ret[i].nodeType === 1 ) {
- var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
-
- ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
- }
- fragment.appendChild( ret[i] );
- }
- }
- }
-
- return ret;
- },
-
- cleanData: function( elems ) {
- var data, id,
- cache = jQuery.cache,
- special = jQuery.event.special,
- deleteExpando = jQuery.support.deleteExpando;
-
- for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
- if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
- continue;
- }
-
- id = elem[ jQuery.expando ];
-
- if ( id ) {
- data = cache[ id ];
-
- if ( data && data.events ) {
- for ( var type in data.events ) {
- if ( special[ type ] ) {
- jQuery.event.remove( elem, type );
-
- // This is a shortcut to avoid jQuery.event.remove's overhead
- } else {
- jQuery.removeEvent( elem, type, data.handle );
- }
- }
-
- // Null the DOM reference to avoid IE6/7/8 leak (#7054)
- if ( data.handle ) {
- data.handle.elem = null;
- }
- }
-
- if ( deleteExpando ) {
- delete elem[ jQuery.expando ];
-
- } else if ( elem.removeAttribute ) {
- elem.removeAttribute( jQuery.expando );
- }
-
- delete cache[ id ];
- }
- }
- }
-});
-
-function evalScript( i, elem ) {
- if ( elem.src ) {
- jQuery.ajax({
- url: elem.src,
- async: false,
- dataType: "script"
- });
- } else {
- jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
- }
-
- if ( elem.parentNode ) {
- elem.parentNode.removeChild( elem );
- }
-}
-
-
-
-
-var ralpha = /alpha\([^)]*\)/i,
- ropacity = /opacity=([^)]*)/,
- // fixed for IE9, see #8346
- rupper = /([A-Z]|^ms)/g,
- rnumpx = /^-?\d+(?:px)?$/i,
- rnum = /^-?\d/,
- rrelNum = /^([\-+])=([\-+.\de]+)/,
-
- cssShow = { position: "absolute", visibility: "hidden", display: "block" },
- cssWidth = [ "Left", "Right" ],
- cssHeight = [ "Top", "Bottom" ],
- curCSS,
-
- getComputedStyle,
- currentStyle;
-
-jQuery.fn.css = function( name, value ) {
- // Setting 'undefined' is a no-op
- if ( arguments.length === 2 && value === undefined ) {
- return this;
- }
-
- return jQuery.access( this, name, value, true, function( elem, name, value ) {
- return value !== undefined ?
- jQuery.style( elem, name, value ) :
- jQuery.css( elem, name );
- });
-};
-
-jQuery.extend({
- // Add in style property hooks for overriding the default
- // behavior of getting and setting a style property
- cssHooks: {
- opacity: {
- get: function( elem, computed ) {
- if ( computed ) {
- // We should always get a number back from opacity
- var ret = curCSS( elem, "opacity", "opacity" );
- return ret === "" ? "1" : ret;
-
- } else {
- return elem.style.opacity;
- }
- }
- }
- },
-
- // Exclude the following css properties to add px
- cssNumber: {
- "fillOpacity": true,
- "fontWeight": true,
- "lineHeight": true,
- "opacity": true,
- "orphans": true,
- "widows": true,
- "zIndex": true,
- "zoom": true
- },
-
- // Add in properties whose names you wish to fix before
- // setting or getting the value
- cssProps: {
- // normalize float css property
- "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
- },
-
- // Get and set the style property on a DOM Node
- style: function( elem, name, value, extra ) {
- // Don't set styles on text and comment nodes
- if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
- return;
- }
-
- // Make sure that we're working with the right name
- var ret, type, origName = jQuery.camelCase( name ),
- style = elem.style, hooks = jQuery.cssHooks[ origName ];
-
- name = jQuery.cssProps[ origName ] || origName;
-
- // Check if we're setting a value
- if ( value !== undefined ) {
- type = typeof value;
-
- // convert relative number strings (+= or -=) to relative numbers. #7345
- if ( type === "string" && (ret = rrelNum.exec( value )) ) {
- value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
- // Fixes bug #9237
- type = "number";
- }
-
- // Make sure that NaN and null values aren't set. See: #7116
- if ( value == null || type === "number" && isNaN( value ) ) {
- return;
- }
-
- // If a number was passed in, add 'px' to the (except for certain CSS properties)
- if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
- value += "px";
- }
-
- // If a hook was provided, use that value, otherwise just set the specified value
- if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
- // Wrapped to prevent IE from throwing errors when 'invalid' values are provided
- // Fixes bug #5509
- try {
- style[ name ] = value;
- } catch(e) {}
- }
-
- } else {
- // If a hook was provided get the non-computed value from there
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
- return ret;
- }
-
- // Otherwise just get the value from the style object
- return style[ name ];
- }
- },
-
- css: function( elem, name, extra ) {
- var ret, hooks;
-
- // Make sure that we're working with the right name
- name = jQuery.camelCase( name );
- hooks = jQuery.cssHooks[ name ];
- name = jQuery.cssProps[ name ] || name;
-
- // cssFloat needs a special treatment
- if ( name === "cssFloat" ) {
- name = "float";
- }
-
- // If a hook was provided get the computed value from there
- if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
- return ret;
-
- // Otherwise, if a way to get the computed value exists, use that
- } else if ( curCSS ) {
- return curCSS( elem, name );
- }
- },
-
- // A method for quickly swapping in/out CSS properties to get correct calculations
- swap: function( elem, options, callback ) {
- var old = {};
-
- // Remember the old values, and insert the new ones
- for ( var name in options ) {
- old[ name ] = elem.style[ name ];
- elem.style[ name ] = options[ name ];
- }
-
- callback.call( elem );
-
- // Revert the old values
- for ( name in options ) {
- elem.style[ name ] = old[ name ];
- }
- }
-});
-
-// DEPRECATED, Use jQuery.css() instead
-jQuery.curCSS = jQuery.css;
-
-jQuery.each(["height", "width"], function( i, name ) {
- jQuery.cssHooks[ name ] = {
- get: function( elem, computed, extra ) {
- var val;
-
- if ( computed ) {
- if ( elem.offsetWidth !== 0 ) {
- return getWH( elem, name, extra );
- } else {
- jQuery.swap( elem, cssShow, function() {
- val = getWH( elem, name, extra );
- });
- }
-
- return val;
- }
- },
-
- set: function( elem, value ) {
- if ( rnumpx.test( value ) ) {
- // ignore negative width and height values #1599
- value = parseFloat( value );
-
- if ( value >= 0 ) {
- return value + "px";
- }
-
- } else {
- return value;
- }
- }
- };
-});
-
-if ( !jQuery.support.opacity ) {
- jQuery.cssHooks.opacity = {
- get: function( elem, computed ) {
- // IE uses filters for opacity
- return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
- ( parseFloat( RegExp.$1 ) / 100 ) + "" :
- computed ? "1" : "";
- },
-
- set: function( elem, value ) {
- var style = elem.style,
- currentStyle = elem.currentStyle,
- opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
- filter = currentStyle && currentStyle.filter || style.filter || "";
-
- // IE has trouble with opacity if it does not have layout
- // Force it by setting the zoom level
- style.zoom = 1;
-
- // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
- if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
-
- // Setting style.filter to null, "" & " " still leave "filter:" in the cssText
- // if "filter:" is present at all, clearType is disabled, we want to avoid this
- // style.removeAttribute is IE Only, but so apparently is this code path...
- style.removeAttribute( "filter" );
-
- // if there there is no filter style applied in a css rule, we are done
- if ( currentStyle && !currentStyle.filter ) {
- return;
- }
- }
-
- // otherwise, set new filter values
- style.filter = ralpha.test( filter ) ?
- filter.replace( ralpha, opacity ) :
- filter + " " + opacity;
- }
- };
-}
-
-jQuery(function() {
- // This hook cannot be added until DOM ready because the support test
- // for it is not run until after DOM ready
- if ( !jQuery.support.reliableMarginRight ) {
- jQuery.cssHooks.marginRight = {
- get: function( elem, computed ) {
- // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
- // Work around by temporarily setting element display to inline-block
- var ret;
- jQuery.swap( elem, { "display": "inline-block" }, function() {
- if ( computed ) {
- ret = curCSS( elem, "margin-right", "marginRight" );
- } else {
- ret = elem.style.marginRight;
- }
- });
- return ret;
- }
- };
- }
-});
-
-if ( document.defaultView && document.defaultView.getComputedStyle ) {
- getComputedStyle = function( elem, name ) {
- var ret, defaultView, computedStyle;
-
- name = name.replace( rupper, "-$1" ).toLowerCase();
-
- if ( (defaultView = elem.ownerDocument.defaultView) &&
- (computedStyle = defaultView.getComputedStyle( elem, null )) ) {
- ret = computedStyle.getPropertyValue( name );
- if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
- ret = jQuery.style( elem, name );
- }
- }
-
- return ret;
- };
-}
-
-if ( document.documentElement.currentStyle ) {
- currentStyle = function( elem, name ) {
- var left, rsLeft, uncomputed,
- ret = elem.currentStyle && elem.currentStyle[ name ],
- style = elem.style;
-
- // Avoid setting ret to empty string here
- // so we don't default to auto
- if ( ret === null && style && (uncomputed = style[ name ]) ) {
- ret = uncomputed;
- }
-
- // From the awesome hack by Dean Edwards
- // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
-
- // If we're not dealing with a regular pixel number
- // but a number that has a weird ending, we need to convert it to pixels
- if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
-
- // Remember the original values
- left = style.left;
- rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
-
- // Put in the new values to get a computed value out
- if ( rsLeft ) {
- elem.runtimeStyle.left = elem.currentStyle.left;
- }
- style.left = name === "fontSize" ? "1em" : ( ret || 0 );
- ret = style.pixelLeft + "px";
-
- // Revert the changed values
- style.left = left;
- if ( rsLeft ) {
- elem.runtimeStyle.left = rsLeft;
- }
- }
-
- return ret === "" ? "auto" : ret;
- };
-}
-
-curCSS = getComputedStyle || currentStyle;
-
-function getWH( elem, name, extra ) {
-
- // Start with offset property
- var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
- which = name === "width" ? cssWidth : cssHeight,
- i = 0,
- len = which.length;
-
- if ( val > 0 ) {
- if ( extra !== "border" ) {
- for ( ; i < len; i++ ) {
- if ( !extra ) {
- val -= parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0;
- }
- if ( extra === "margin" ) {
- val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0;
- } else {
- val -= parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0;
- }
- }
- }
-
- return val + "px";
- }
-
- // Fall back to computed then uncomputed css if necessary
- val = curCSS( elem, name, name );
- if ( val < 0 || val == null ) {
- val = elem.style[ name ] || 0;
- }
- // Normalize "", auto, and prepare for extra
- val = parseFloat( val ) || 0;
-
- // Add padding, border, margin
- if ( extra ) {
- for ( ; i < len; i++ ) {
- val += parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0;
- if ( extra !== "padding" ) {
- val += parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0;
- }
- if ( extra === "margin" ) {
- val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0;
- }
- }
- }
-
- return val + "px";
-}
-
-if ( jQuery.expr && jQuery.expr.filters ) {
- jQuery.expr.filters.hidden = function( elem ) {
- var width = elem.offsetWidth,
- height = elem.offsetHeight;
-
- return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
- };
-
- jQuery.expr.filters.visible = function( elem ) {
- return !jQuery.expr.filters.hidden( elem );
- };
-}
-
-
-
-
-var r20 = /%20/g,
- rbracket = /\[\]$/,
- rCRLF = /\r?\n/g,
- rhash = /#.*$/,
- rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
- rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
- // #7653, #8125, #8152: local protocol detection
- rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
- rnoContent = /^(?:GET|HEAD)$/,
- rprotocol = /^\/\//,
- rquery = /\?/,
- rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
- rselectTextarea = /^(?:select|textarea)/i,
- rspacesAjax = /\s+/,
- rts = /([?&])_=[^&]*/,
- rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
-
- // Keep a copy of the old load method
- _load = jQuery.fn.load,
-
- /* Prefilters
- * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
- * 2) These are called:
- * - BEFORE asking for a transport
- * - AFTER param serialization (s.data is a string if s.processData is true)
- * 3) key is the dataType
- * 4) the catchall symbol "*" can be used
- * 5) execution will start with transport dataType and THEN continue down to "*" if needed
- */
- prefilters = {},
-
- /* Transports bindings
- * 1) key is the dataType
- * 2) the catchall symbol "*" can be used
- * 3) selection will start with transport dataType and THEN go to "*" if needed
- */
- transports = {},
-
- // Document location
- ajaxLocation,
-
- // Document location segments
- ajaxLocParts,
-
- // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
- allTypes = ["*/"] + ["*"];
-
-// #8138, IE may throw an exception when accessing
-// a field from window.location if document.domain has been set
-try {
- ajaxLocation = location.href;
-} catch( e ) {
- // Use the href attribute of an A element
- // since IE will modify it given document.location
- ajaxLocation = document.createElement( "a" );
- ajaxLocation.href = "";
- ajaxLocation = ajaxLocation.href;
-}
-
-// Segment location into parts
-ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
-
-// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
-function addToPrefiltersOrTransports( structure ) {
-
- // dataTypeExpression is optional and defaults to "*"
- return function( dataTypeExpression, func ) {
-
- if ( typeof dataTypeExpression !== "string" ) {
- func = dataTypeExpression;
- dataTypeExpression = "*";
- }
-
- if ( jQuery.isFunction( func ) ) {
- var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
- i = 0,
- length = dataTypes.length,
- dataType,
- list,
- placeBefore;
-
- // For each dataType in the dataTypeExpression
- for ( ; i < length; i++ ) {
- dataType = dataTypes[ i ];
- // We control if we're asked to add before
- // any existing element
- placeBefore = /^\+/.test( dataType );
- if ( placeBefore ) {
- dataType = dataType.substr( 1 ) || "*";
- }
- list = structure[ dataType ] = structure[ dataType ] || [];
- // then we add to the structure accordingly
- list[ placeBefore ? "unshift" : "push" ]( func );
- }
- }
- };
-}
-
-// Base inspection function for prefilters and transports
-function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
- dataType /* internal */, inspected /* internal */ ) {
-
- dataType = dataType || options.dataTypes[ 0 ];
- inspected = inspected || {};
-
- inspected[ dataType ] = true;
-
- var list = structure[ dataType ],
- i = 0,
- length = list ? list.length : 0,
- executeOnly = ( structure === prefilters ),
- selection;
-
- for ( ; i < length && ( executeOnly || !selection ); i++ ) {
- selection = list[ i ]( options, originalOptions, jqXHR );
- // If we got redirected to another dataType
- // we try there if executing only and not done already
- if ( typeof selection === "string" ) {
- if ( !executeOnly || inspected[ selection ] ) {
- selection = undefined;
- } else {
- options.dataTypes.unshift( selection );
- selection = inspectPrefiltersOrTransports(
- structure, options, originalOptions, jqXHR, selection, inspected );
- }
- }
- }
- // If we're only executing or nothing was selected
- // we try the catchall dataType if not done already
- if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
- selection = inspectPrefiltersOrTransports(
- structure, options, originalOptions, jqXHR, "*", inspected );
- }
- // unnecessary when only executing (prefilters)
- // but it'll be ignored by the caller in that case
- return selection;
-}
-
-// A special extend for ajax options
-// that takes "flat" options (not to be deep extended)
-// Fixes #9887
-function ajaxExtend( target, src ) {
- var key, deep,
- flatOptions = jQuery.ajaxSettings.flatOptions || {};
- for ( key in src ) {
- if ( src[ key ] !== undefined ) {
- ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
- }
- }
- if ( deep ) {
- jQuery.extend( true, target, deep );
- }
-}
-
-jQuery.fn.extend({
- load: function( url, params, callback ) {
- if ( typeof url !== "string" && _load ) {
- return _load.apply( this, arguments );
-
- // Don't do a request if no elements are being requested
- } else if ( !this.length ) {
- return this;
- }
-
- var off = url.indexOf( " " );
- if ( off >= 0 ) {
- var selector = url.slice( off, url.length );
- url = url.slice( 0, off );
- }
-
- // Default to a GET request
- var type = "GET";
-
- // If the second parameter was provided
- if ( params ) {
- // If it's a function
- if ( jQuery.isFunction( params ) ) {
- // We assume that it's the callback
- callback = params;
- params = undefined;
-
- // Otherwise, build a param string
- } else if ( typeof params === "object" ) {
- params = jQuery.param( params, jQuery.ajaxSettings.traditional );
- type = "POST";
- }
- }
-
- var self = this;
-
- // Request the remote document
- jQuery.ajax({
- url: url,
- type: type,
- dataType: "html",
- data: params,
- // Complete callback (responseText is used internally)
- complete: function( jqXHR, status, responseText ) {
- // Store the response as specified by the jqXHR object
- responseText = jqXHR.responseText;
- // If successful, inject the HTML into all the matched elements
- if ( jqXHR.isResolved() ) {
- // #4825: Get the actual response in case
- // a dataFilter is present in ajaxSettings
- jqXHR.done(function( r ) {
- responseText = r;
- });
- // See if a selector was specified
- self.html( selector ?
- // Create a dummy div to hold the results
- jQuery("<div>")
- // inject the contents of the document in, removing the scripts
- // to avoid any 'Permission Denied' errors in IE
- .append(responseText.replace(rscript, ""))
-
- // Locate the specified elements
- .find(selector) :
-
- // If not, just inject the full result
- responseText );
- }
-
- if ( callback ) {
- self.each( callback, [ responseText, status, jqXHR ] );
- }
- }
- });
-
- return this;
- },
-
- serialize: function() {
- return jQuery.param( this.serializeArray() );
- },
-
- serializeArray: function() {
- return this.map(function(){
- return this.elements ? jQuery.makeArray( this.elements ) : this;
- })
- .filter(function(){
- return this.name && !this.disabled &&
- ( this.checked || rselectTextarea.test( this.nodeName ) ||
- rinput.test( this.type ) );
- })
- .map(function( i, elem ){
- var val = jQuery( this ).val();
-
- return val == null ?
- null :
- jQuery.isArray( val ) ?
- jQuery.map( val, function( val, i ){
- return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- }) :
- { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
- }).get();
- }
-});
-
-// Attach a bunch of functions for handling common AJAX events
-jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
- jQuery.fn[ o ] = function( f ){
- return this.on( o, f );
- };
-});
-
-jQuery.each( [ "get", "post" ], function( i, method ) {
- jQuery[ method ] = function( url, data, callback, type ) {
- // shift arguments if data argument was omitted
- if ( jQuery.isFunction( data ) ) {
- type = type || callback;
- callback = data;
- data = undefined;
- }
-
- return jQuery.ajax({
- type: method,
- url: url,
- data: data,
- success: callback,
- dataType: type
- });
- };
-});
-
-jQuery.extend({
-
- getScript: function( url, callback ) {
- return jQuery.get( url, undefined, callback, "script" );
- },
-
- getJSON: function( url, data, callback ) {
- return jQuery.get( url, data, callback, "json" );
- },
-
- // Creates a full fledged settings object into target
- // with both ajaxSettings and settings fields.
- // If target is omitted, writes into ajaxSettings.
- ajaxSetup: function( target, settings ) {
- if ( settings ) {
- // Building a settings object
- ajaxExtend( target, jQuery.ajaxSettings );
- } else {
- // Extending ajaxSettings
- settings = target;
- target = jQuery.ajaxSettings;
- }
- ajaxExtend( target, settings );
- return target;
- },
-
- ajaxSettings: {
- url: ajaxLocation,
- isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
- global: true,
- type: "GET",
- contentType: "application/x-www-form-urlencoded",
- processData: true,
- async: true,
- /*
- timeout: 0,
- data: null,
- dataType: null,
- username: null,
- password: null,
- cache: null,
- traditional: false,
- headers: {},
- */
-
- accepts: {
- xml: "application/xml, text/xml",
- html: "text/html",
- text: "text/plain",
- json: "application/json, text/javascript",
- "*": allTypes
- },
-
- contents: {
- xml: /xml/,
- html: /html/,
- json: /json/
- },
-
- responseFields: {
- xml: "responseXML",
- text: "responseText"
- },
-
- // List of data converters
- // 1) key format is "source_type destination_type" (a single space in-between)
- // 2) the catchall symbol "*" can be used for source_type
- converters: {
-
- // Convert anything to text
- "* text": window.String,
-
- // Text to html (true = no transformation)
- "text html": true,
-
- // Evaluate text as a json expression
- "text json": jQuery.parseJSON,
-
- // Parse text as xml
- "text xml": jQuery.parseXML
- },
-
- // For options that shouldn't be deep extended:
- // you can add your own custom options here if
- // and when you create one that shouldn't be
- // deep extended (see ajaxExtend)
- flatOptions: {
- context: true,
- url: true
- }
- },
-
- ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
- ajaxTransport: addToPrefiltersOrTransports( transports ),
-
- // Main method
- ajax: function( url, options ) {
-
- // If url is an object, simulate pre-1.5 signature
- if ( typeof url === "object" ) {
- options = url;
- url = undefined;
- }
-
- // Force options to be an object
- options = options || {};
-
- var // Create the final options object
- s = jQuery.ajaxSetup( {}, options ),
- // Callbacks context
- callbackContext = s.context || s,
- // Context for global events
- // It's the callbackContext if one was provided in the options
- // and if it's a DOM node or a jQuery collection
- globalEventContext = callbackContext !== s &&
- ( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
- jQuery( callbackContext ) : jQuery.event,
- // Deferreds
- deferred = jQuery.Deferred(),
- completeDeferred = jQuery.Callbacks( "once memory" ),
- // Status-dependent callbacks
- statusCode = s.statusCode || {},
- // ifModified key
- ifModifiedKey,
- // Headers (they are sent all at once)
- requestHeaders = {},
- requestHeadersNames = {},
- // Response headers
- responseHeadersString,
- responseHeaders,
- // transport
- transport,
- // timeout handle
- timeoutTimer,
- // Cross-domain detection vars
- parts,
- // The jqXHR state
- state = 0,
- // To know if global events are to be dispatched
- fireGlobals,
- // Loop variable
- i,
- // Fake xhr
- jqXHR = {
-
- readyState: 0,
-
- // Caches the header
- setRequestHeader: function( name, value ) {
- if ( !state ) {
- var lname = name.toLowerCase();
- name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
- requestHeaders[ name ] = value;
- }
- return this;
- },
-
- // Raw string
- getAllResponseHeaders: function() {
- return state === 2 ? responseHeadersString : null;
- },
-
- // Builds headers hashtable if needed
- getResponseHeader: function( key ) {
- var match;
- if ( state === 2 ) {
- if ( !responseHeaders ) {
- responseHeaders = {};
- while( ( match = rheaders.exec( responseHeadersString ) ) ) {
- responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
- }
- }
- match = responseHeaders[ key.toLowerCase() ];
- }
- return match === undefined ? null : match;
- },
-
- // Overrides response content-type header
- overrideMimeType: function( type ) {
- if ( !state ) {
- s.mimeType = type;
- }
- return this;
- },
-
- // Cancel the request
- abort: function( statusText ) {
- statusText = statusText || "abort";
- if ( transport ) {
- transport.abort( statusText );
- }
- done( 0, statusText );
- return this;
- }
- };
-
- // Callback for when everything is done
- // It is defined here because jslint complains if it is declared
- // at the end of the function (which would be more logical and readable)
- function done( status, nativeStatusText, responses, headers ) {
-
- // Called once
- if ( state === 2 ) {
- return;
- }
-
- // State is "done" now
- state = 2;
-
- // Clear timeout if it exists
- if ( timeoutTimer ) {
- clearTimeout( timeoutTimer );
- }
-
- // Dereference transport for early garbage collection
- // (no matter how long the jqXHR object will be used)
- transport = undefined;
-
- // Cache response headers
- responseHeadersString = headers || "";
-
- // Set readyState
- jqXHR.readyState = status > 0 ? 4 : 0;
-
- var isSuccess,
- success,
- error,
- statusText = nativeStatusText,
- response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
- lastModified,
- etag;
-
- // If successful, handle type chaining
- if ( status >= 200 && status < 300 || status === 304 ) {
-
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
-
- if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
- jQuery.lastModified[ ifModifiedKey ] = lastModified;
- }
- if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
- jQuery.etag[ ifModifiedKey ] = etag;
- }
- }
-
- // If not modified
- if ( status === 304 ) {
-
- statusText = "notmodified";
- isSuccess = true;
-
- // If we have data
- } else {
-
- try {
- success = ajaxConvert( s, response );
- statusText = "success";
- isSuccess = true;
- } catch(e) {
- // We have a parsererror
- statusText = "parsererror";
- error = e;
- }
- }
- } else {
- // We extract error from statusText
- // then normalize statusText and status for non-aborts
- error = statusText;
- if ( !statusText || status ) {
- statusText = "error";
- if ( status < 0 ) {
- status = 0;
- }
- }
- }
-
- // Set data for the fake xhr object
- jqXHR.status = status;
- jqXHR.statusText = "" + ( nativeStatusText || statusText );
-
- // Success/Error
- if ( isSuccess ) {
- deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
- } else {
- deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
- }
-
- // Status-dependent callbacks
- jqXHR.statusCode( statusCode );
- statusCode = undefined;
-
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
- [ jqXHR, s, isSuccess ? success : error ] );
- }
-
- // Complete
- completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
-
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
- // Handle the global AJAX counter
- if ( !( --jQuery.active ) ) {
- jQuery.event.trigger( "ajaxStop" );
- }
- }
- }
-
- // Attach deferreds
- deferred.promise( jqXHR );
- jqXHR.success = jqXHR.done;
- jqXHR.error = jqXHR.fail;
- jqXHR.complete = completeDeferred.add;
-
- // Status-dependent callbacks
- jqXHR.statusCode = function( map ) {
- if ( map ) {
- var tmp;
- if ( state < 2 ) {
- for ( tmp in map ) {
- statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
- }
- } else {
- tmp = map[ jqXHR.status ];
- jqXHR.then( tmp, tmp );
- }
- }
- return this;
- };
-
- // Remove hash character (#7531: and string promotion)
- // Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
- // We also use the url parameter if available
- s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
-
- // Extract dataTypes list
- s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
-
- // Determine if a cross-domain request is in order
- if ( s.crossDomain == null ) {
- parts = rurl.exec( s.url.toLowerCase() );
- s.crossDomain = !!( parts &&
- ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
- ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
- ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
- );
- }
-
- // Convert data if not already a string
- if ( s.data && s.processData && typeof s.data !== "string" ) {
- s.data = jQuery.param( s.data, s.traditional );
- }
-
- // Apply prefilters
- inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
-
- // If request was aborted inside a prefiler, stop there
- if ( state === 2 ) {
- return false;
- }
-
- // We can fire global events as of now if asked to
- fireGlobals = s.global;
-
- // Uppercase the type
- s.type = s.type.toUpperCase();
-
- // Determine if request has content
- s.hasContent = !rnoContent.test( s.type );
-
- // Watch for a new set of requests
- if ( fireGlobals && jQuery.active++ === 0 ) {
- jQuery.event.trigger( "ajaxStart" );
- }
-
- // More options handling for requests with no content
- if ( !s.hasContent ) {
-
- // If data is available, append data to url
- if ( s.data ) {
- s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
- // #9682: remove data so that it's not used in an eventual retry
- delete s.data;
- }
-
- // Get ifModifiedKey before adding the anti-cache parameter
- ifModifiedKey = s.url;
-
- // Add anti-cache in url if needed
- if ( s.cache === false ) {
-
- var ts = jQuery.now(),
- // try replacing _= if it is there
- ret = s.url.replace( rts, "$1_=" + ts );
-
- // if nothing was replaced, add timestamp to the end
- s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
- }
- }
-
- // Set the correct header, if data is being sent
- if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
- jqXHR.setRequestHeader( "Content-Type", s.contentType );
- }
-
- // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
- if ( s.ifModified ) {
- ifModifiedKey = ifModifiedKey || s.url;
- if ( jQuery.lastModified[ ifModifiedKey ] ) {
- jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
- }
- if ( jQuery.etag[ ifModifiedKey ] ) {
- jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
- }
- }
-
- // Set the Accepts header for the server, depending on the dataType
- jqXHR.setRequestHeader(
- "Accept",
- s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
- s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
- s.accepts[ "*" ]
- );
-
- // Check for headers option
- for ( i in s.headers ) {
- jqXHR.setRequestHeader( i, s.headers[ i ] );
- }
-
- // Allow custom headers/mimetypes and early abort
- if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
- // Abort if not done already
- jqXHR.abort();
- return false;
-
- }
-
- // Install callbacks on deferreds
- for ( i in { success: 1, error: 1, complete: 1 } ) {
- jqXHR[ i ]( s[ i ] );
- }
-
- // Get transport
- transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
-
- // If no transport, we auto-abort
- if ( !transport ) {
- done( -1, "No Transport" );
- } else {
- jqXHR.readyState = 1;
- // Send global event
- if ( fireGlobals ) {
- globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
- }
- // Timeout
- if ( s.async && s.timeout > 0 ) {
- timeoutTimer = setTimeout( function(){
- jqXHR.abort( "timeout" );
- }, s.timeout );
- }
-
- try {
- state = 1;
- transport.send( requestHeaders, done );
- } catch (e) {
- // Propagate exception as error if not done
- if ( state < 2 ) {
- done( -1, e );
- // Simply rethrow otherwise
- } else {
- throw e;
- }
- }
- }
-
- return jqXHR;
- },
-
- // Serialize an array of form elements or a set of
- // key/values into a query string
- param: function( a, traditional ) {
- var s = [],
- add = function( key, value ) {
- // If value is a function, invoke it and return its value
- value = jQuery.isFunction( value ) ? value() : value;
- s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
- };
-
- // Set traditional to true for jQuery <= 1.3.2 behavior.
- if ( traditional === undefined ) {
- traditional = jQuery.ajaxSettings.traditional;
- }
-
- // If an array was passed in, assume that it is an array of form elements.
- if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
- // Serialize the form elements
- jQuery.each( a, function() {
- add( this.name, this.value );
- });
-
- } else {
- // If traditional, encode the "old" way (the way 1.3.2 or older
- // did it), otherwise encode params recursively.
- for ( var prefix in a ) {
- buildParams( prefix, a[ prefix ], traditional, add );
- }
- }
-
- // Return the resulting serialization
- return s.join( "&" ).replace( r20, "+" );
- }
-});
-
-function buildParams( prefix, obj, traditional, add ) {
- if ( jQuery.isArray( obj ) ) {
- // Serialize array item.
- jQuery.each( obj, function( i, v ) {
- if ( traditional || rbracket.test( prefix ) ) {
- // Treat each array item as a scalar.
- add( prefix, v );
-
- } else {
- // If array item is non-scalar (array or object), encode its
- // numeric index to resolve deserialization ambiguity issues.
- // Note that rack (as of 1.0.0) can't currently deserialize
- // nested arrays properly, and attempting to do so may cause
- // a server error. Possible fixes are to modify rack's
- // deserialization algorithm or to provide an option or flag
- // to force array serialization to be shallow.
- buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
- }
- });
-
- } else if ( !traditional && obj != null && typeof obj === "object" ) {
- // Serialize object item.
- for ( var name in obj ) {
- buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
- }
-
- } else {
- // Serialize scalar item.
- add( prefix, obj );
- }
-}
-
-// This is still on the jQuery object... for now
-// Want to move this to jQuery.ajax some day
-jQuery.extend({
-
- // Counter for holding the number of active queries
- active: 0,
-
- // Last-Modified header cache for next request
- lastModified: {},
- etag: {}
-
-});
-
-/* Handles responses to an ajax request:
- * - sets all responseXXX fields accordingly
- * - finds the right dataType (mediates between content-type and expected dataType)
- * - returns the corresponding response
- */
-function ajaxHandleResponses( s, jqXHR, responses ) {
-
- var contents = s.contents,
- dataTypes = s.dataTypes,
- responseFields = s.responseFields,
- ct,
- type,
- finalDataType,
- firstDataType;
-
- // Fill responseXXX fields
- for ( type in responseFields ) {
- if ( type in responses ) {
- jqXHR[ responseFields[type] ] = responses[ type ];
- }
- }
-
- // Remove auto dataType and get content-type in the process
- while( dataTypes[ 0 ] === "*" ) {
- dataTypes.shift();
- if ( ct === undefined ) {
- ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
- }
- }
-
- // Check if we're dealing with a known content-type
- if ( ct ) {
- for ( type in contents ) {
- if ( contents[ type ] && contents[ type ].test( ct ) ) {
- dataTypes.unshift( type );
- break;
- }
- }
- }
-
- // Check to see if we have a response for the expected dataType
- if ( dataTypes[ 0 ] in responses ) {
- finalDataType = dataTypes[ 0 ];
- } else {
- // Try convertible dataTypes
- for ( type in responses ) {
- if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
- finalDataType = type;
- break;
- }
- if ( !firstDataType ) {
- firstDataType = type;
- }
- }
- // Or just use first one
- finalDataType = finalDataType || firstDataType;
- }
-
- // If we found a dataType
- // We add the dataType to the list if needed
- // and return the corresponding response
- if ( finalDataType ) {
- if ( finalDataType !== dataTypes[ 0 ] ) {
- dataTypes.unshift( finalDataType );
- }
- return responses[ finalDataType ];
- }
-}
-
-// Chain conversions given the request and the original response
-function ajaxConvert( s, response ) {
-
- // Apply the dataFilter if provided
- if ( s.dataFilter ) {
- response = s.dataFilter( response, s.dataType );
- }
-
- var dataTypes = s.dataTypes,
- converters = {},
- i,
- key,
- length = dataTypes.length,
- tmp,
- // Current and previous dataTypes
- current = dataTypes[ 0 ],
- prev,
- // Conversion expression
- conversion,
- // Conversion function
- conv,
- // Conversion functions (transitive conversion)
- conv1,
- conv2;
-
- // For each dataType in the chain
- for ( i = 1; i < length; i++ ) {
-
- // Create converters map
- // with lowercased keys
- if ( i === 1 ) {
- for ( key in s.converters ) {
- if ( typeof key === "string" ) {
- converters[ key.toLowerCase() ] = s.converters[ key ];
- }
- }
- }
-
- // Get the dataTypes
- prev = current;
- current = dataTypes[ i ];
-
- // If current is auto dataType, update it to prev
- if ( current === "*" ) {
- current = prev;
- // If no auto and dataTypes are actually different
- } else if ( prev !== "*" && prev !== current ) {
-
- // Get the converter
- conversion = prev + " " + current;
- conv = converters[ conversion ] || converters[ "* " + current ];
-
- // If there is no direct converter, search transitively
- if ( !conv ) {
- conv2 = undefined;
- for ( conv1 in converters ) {
- tmp = conv1.split( " " );
- if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
- conv2 = converters[ tmp[1] + " " + current ];
- if ( conv2 ) {
- conv1 = converters[ conv1 ];
- if ( conv1 === true ) {
- conv = conv2;
- } else if ( conv2 === true ) {
- conv = conv1;
- }
- break;
- }
- }
- }
- }
- // If we found no converter, dispatch an error
- if ( !( conv || conv2 ) ) {
- jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
- }
- // If found converter is not an equivalence
- if ( conv !== true ) {
- // Convert with 1 or 2 converters accordingly
- response = conv ? conv( response ) : conv2( conv1(response) );
- }
- }
- }
- return response;
-}
-
-
-
-
-var jsc = jQuery.now(),
- jsre = /(\=)\?(&|$)|\?\?/i;
-
-// Default jsonp settings
-jQuery.ajaxSetup({
- jsonp: "callback",
- jsonpCallback: function() {
- return jQuery.expando + "_" + ( jsc++ );
- }
-});
-
-// Detect, normalize options and install callbacks for jsonp requests
-jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
-
- var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
- ( typeof s.data === "string" );
-
- if ( s.dataTypes[ 0 ] === "jsonp" ||
- s.jsonp !== false && ( jsre.test( s.url ) ||
- inspectData && jsre.test( s.data ) ) ) {
-
- var responseContainer,
- jsonpCallback = s.jsonpCallback =
- jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
- previous = window[ jsonpCallback ],
- url = s.url,
- data = s.data,
- replace = "$1" + jsonpCallback + "$2";
-
- if ( s.jsonp !== false ) {
- url = url.replace( jsre, replace );
- if ( s.url === url ) {
- if ( inspectData ) {
- data = data.replace( jsre, replace );
- }
- if ( s.data === data ) {
- // Add callback manually
- url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
- }
- }
- }
-
- s.url = url;
- s.data = data;
-
- // Install callback
- window[ jsonpCallback ] = function( response ) {
- responseContainer = [ response ];
- };
-
- // Clean-up function
- jqXHR.always(function() {
- // Set callback back to previous value
- window[ jsonpCallback ] = previous;
- // Call if it was a function and we have a response
- if ( responseContainer && jQuery.isFunction( previous ) ) {
- window[ jsonpCallback ]( responseContainer[ 0 ] );
- }
- });
-
- // Use data converter to retrieve json after script execution
- s.converters["script json"] = function() {
- if ( !responseContainer ) {
- jQuery.error( jsonpCallback + " was not called" );
- }
- return responseContainer[ 0 ];
- };
-
- // force json dataType
- s.dataTypes[ 0 ] = "json";
-
- // Delegate to script
- return "script";
- }
-});
-
-
-
-
-// Install script dataType
-jQuery.ajaxSetup({
- accepts: {
- script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
- },
- contents: {
- script: /javascript|ecmascript/
- },
- converters: {
- "text script": function( text ) {
- jQuery.globalEval( text );
- return text;
- }
- }
-});
-
-// Handle cache's special case and global
-jQuery.ajaxPrefilter( "script", function( s ) {
- if ( s.cache === undefined ) {
- s.cache = false;
- }
- if ( s.crossDomain ) {
- s.type = "GET";
- s.global = false;
- }
-});
-
-// Bind script tag hack transport
-jQuery.ajaxTransport( "script", function(s) {
-
- // This transport only deals with cross domain requests
- if ( s.crossDomain ) {
-
- var script,
- head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
-
- return {
-
- send: function( _, callback ) {
-
- script = document.createElement( "script" );
-
- script.async = "async";
-
- if ( s.scriptCharset ) {
- script.charset = s.scriptCharset;
- }
-
- script.src = s.url;
-
- // Attach handlers for all browsers
- script.onload = script.onreadystatechange = function( _, isAbort ) {
-
- if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
-
- // Handle memory leak in IE
- script.onload = script.onreadystatechange = null;
-
- // Remove the script
- if ( head && script.parentNode ) {
- head.removeChild( script );
- }
-
- // Dereference the script
- script = undefined;
-
- // Callback if not abort
- if ( !isAbort ) {
- callback( 200, "success" );
- }
- }
- };
- // Use insertBefore instead of appendChild to circumvent an IE6 bug.
- // This arises when a base node is used (#2709 and #4378).
- head.insertBefore( script, head.firstChild );
- },
-
- abort: function() {
- if ( script ) {
- script.onload( 0, 1 );
- }
- }
- };
- }
-});
-
-
-
-
-var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
- xhrOnUnloadAbort = window.ActiveXObject ? function() {
- // Abort all pending requests
- for ( var key in xhrCallbacks ) {
- xhrCallbacks[ key ]( 0, 1 );
- }
- } : false,
- xhrId = 0,
- xhrCallbacks;
-
-// Functions to create xhrs
-function createStandardXHR() {
- try {
- return new window.XMLHttpRequest();
- } catch( e ) {}
-}
-
-function createActiveXHR() {
- try {
- return new window.ActiveXObject( "Microsoft.XMLHTTP" );
- } catch( e ) {}
-}
-
-// Create the request object
-// (This is still attached to ajaxSettings for backward compatibility)
-jQuery.ajaxSettings.xhr = window.ActiveXObject ?
- /* Microsoft failed to properly
- * implement the XMLHttpRequest in IE7 (can't request local files),
- * so we use the ActiveXObject when it is available
- * Additionally XMLHttpRequest can be disabled in IE7/IE8 so
- * we need a fallback.
- */
- function() {
- return !this.isLocal && createStandardXHR() || createActiveXHR();
- } :
- // For all other browsers, use the standard XMLHttpRequest object
- createStandardXHR;
-
-// Determine support properties
-(function( xhr ) {
- jQuery.extend( jQuery.support, {
- ajax: !!xhr,
- cors: !!xhr && ( "withCredentials" in xhr )
- });
-})( jQuery.ajaxSettings.xhr() );
-
-// Create transport if the browser can provide an xhr
-if ( jQuery.support.ajax ) {
-
- jQuery.ajaxTransport(function( s ) {
- // Cross domain only allowed if supported through XMLHttpRequest
- if ( !s.crossDomain || jQuery.support.cors ) {
-
- var callback;
-
- return {
- send: function( headers, complete ) {
-
- // Get a new xhr
- var xhr = s.xhr(),
- handle,
- i;
-
- // Open the socket
- // Passing null username, generates a login popup on Opera (#2865)
- if ( s.username ) {
- xhr.open( s.type, s.url, s.async, s.username, s.password );
- } else {
- xhr.open( s.type, s.url, s.async );
- }
-
- // Apply custom fields if provided
- if ( s.xhrFields ) {
- for ( i in s.xhrFields ) {
- xhr[ i ] = s.xhrFields[ i ];
- }
- }
-
- // Override mime type if needed
- if ( s.mimeType && xhr.overrideMimeType ) {
- xhr.overrideMimeType( s.mimeType );
- }
-
- // X-Requested-With header
- // For cross-domain requests, seeing as conditions for a preflight are
- // akin to a jigsaw puzzle, we simply never set it to be sure.
- // (it can always be set on a per-request basis or even using ajaxSetup)
- // For same-domain requests, won't change header if already provided.
- if ( !s.crossDomain && !headers["X-Requested-With"] ) {
- headers[ "X-Requested-With" ] = "XMLHttpRequest";
- }
-
- // Need an extra try/catch for cross domain requests in Firefox 3
- try {
- for ( i in headers ) {
- xhr.setRequestHeader( i, headers[ i ] );
- }
- } catch( _ ) {}
-
- // Do send the request
- // This may raise an exception which is actually
- // handled in jQuery.ajax (so no try/catch here)
- xhr.send( ( s.hasContent && s.data ) || null );
-
- // Listener
- callback = function( _, isAbort ) {
-
- var status,
- statusText,
- responseHeaders,
- responses,
- xml;
-
- // Firefox throws exceptions when accessing properties
- // of an xhr when a network error occured
- // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
- try {
-
- // Was never called and is aborted or complete
- if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
-
- // Only called once
- callback = undefined;
-
- // Do not keep as active anymore
- if ( handle ) {
- xhr.onreadystatechange = jQuery.noop;
- if ( xhrOnUnloadAbort ) {
- delete xhrCallbacks[ handle ];
- }
- }
-
- // If it's an abort
- if ( isAbort ) {
- // Abort it manually if needed
- if ( xhr.readyState !== 4 ) {
- xhr.abort();
- }
- } else {
- status = xhr.status;
- responseHeaders = xhr.getAllResponseHeaders();
- responses = {};
- xml = xhr.responseXML;
-
- // Construct response list
- if ( xml && xml.documentElement /* #4958 */ ) {
- responses.xml = xml;
- }
- responses.text = xhr.responseText;
-
- // Firefox throws an exception when accessing
- // statusText for faulty cross-domain requests
- try {
- statusText = xhr.statusText;
- } catch( e ) {
- // We normalize with Webkit giving an empty statusText
- statusText = "";
- }
-
- // Filter status for non standard behaviors
-
- // If the request is local and we have data: assume a success
- // (success with no data won't get notified, that's the best we
- // can do given current implementations)
- if ( !status && s.isLocal && !s.crossDomain ) {
- status = responses.text ? 200 : 404;
- // IE - #1450: sometimes returns 1223 when it should be 204
- } else if ( status === 1223 ) {
- status = 204;
- }
- }
- }
- } catch( firefoxAccessException ) {
- if ( !isAbort ) {
- complete( -1, firefoxAccessException );
- }
- }
-
- // Call complete if needed
- if ( responses ) {
- complete( status, statusText, responses, responseHeaders );
- }
- };
-
- // if we're in sync mode or it's in cache
- // and has been retrieved directly (IE6 & IE7)
- // we need to manually fire the callback
- if ( !s.async || xhr.readyState === 4 ) {
- callback();
- } else {
- handle = ++xhrId;
- if ( xhrOnUnloadAbort ) {
- // Create the active xhrs callbacks list if needed
- // and attach the unload handler
- if ( !xhrCallbacks ) {
- xhrCallbacks = {};
- jQuery( window ).unload( xhrOnUnloadAbort );
- }
- // Add to list of active xhrs callbacks
- xhrCallbacks[ handle ] = callback;
- }
- xhr.onreadystatechange = callback;
- }
- },
-
- abort: function() {
- if ( callback ) {
- callback(0,1);
- }
- }
- };
- }
- });
-}
-
-
-
-
-var elemdisplay = {},
- iframe, iframeDoc,
- rfxtypes = /^(?:toggle|show|hide)$/,
- rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
- timerId,
- fxAttrs = [
- // height animations
- [ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
- // width animations
- [ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
- // opacity animations
- [ "opacity" ]
- ],
- fxNow;
-
-jQuery.fn.extend({
- show: function( speed, easing, callback ) {
- var elem, display;
-
- if ( speed || speed === 0 ) {
- return this.animate( genFx("show", 3), speed, easing, callback );
-
- } else {
- for ( var i = 0, j = this.length; i < j; i++ ) {
- elem = this[ i ];
-
- if ( elem.style ) {
- display = elem.style.display;
-
- // Reset the inline display of this element to learn if it is
- // being hidden by cascaded rules or not
- if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
- display = elem.style.display = "";
- }
-
- // Set elements which have been overridden with display: none
- // in a stylesheet to whatever the default browser style is
- // for such an element
- if ( display === "" && jQuery.css(elem, "display") === "none" ) {
- jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
- }
- }
- }
-
- // Set the display of most of the elements in a second loop
- // to avoid the constant reflow
- for ( i = 0; i < j; i++ ) {
- elem = this[ i ];
-
- if ( elem.style ) {
- display = elem.style.display;
-
- if ( display === "" || display === "none" ) {
- elem.style.display = jQuery._data( elem, "olddisplay" ) || "";
- }
- }
- }
-
- return this;
- }
- },
-
- hide: function( speed, easing, callback ) {
- if ( speed || speed === 0 ) {
- return this.animate( genFx("hide", 3), speed, easing, callback);
-
- } else {
- var elem, display,
- i = 0,
- j = this.length;
-
- for ( ; i < j; i++ ) {
- elem = this[i];
- if ( elem.style ) {
- display = jQuery.css( elem, "display" );
-
- if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) {
- jQuery._data( elem, "olddisplay", display );
- }
- }
- }
-
- // Set the display of the elements in a second loop
- // to avoid the constant reflow
- for ( i = 0; i < j; i++ ) {
- if ( this[i].style ) {
- this[i].style.display = "none";
- }
- }
-
- return this;
- }
- },
-
- // Save the old toggle function
- _toggle: jQuery.fn.toggle,
-
- toggle: function( fn, fn2, callback ) {
- var bool = typeof fn === "boolean";
-
- if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
- this._toggle.apply( this, arguments );
-
- } else if ( fn == null || bool ) {
- this.each(function() {
- var state = bool ? fn : jQuery(this).is(":hidden");
- jQuery(this)[ state ? "show" : "hide" ]();
- });
-
- } else {
- this.animate(genFx("toggle", 3), fn, fn2, callback);
- }
-
- return this;
- },
-
- fadeTo: function( speed, to, easing, callback ) {
- return this.filter(":hidden").css("opacity", 0).show().end()
- .animate({opacity: to}, speed, easing, callback);
- },
-
- animate: function( prop, speed, easing, callback ) {
- var optall = jQuery.speed( speed, easing, callback );
-
- if ( jQuery.isEmptyObject( prop ) ) {
- return this.each( optall.complete, [ false ] );
- }
-
- // Do not change referenced properties as per-property easing will be lost
- prop = jQuery.extend( {}, prop );
-
- function doAnimation() {
- // XXX 'this' does not always have a nodeName when running the
- // test suite
-
- if ( optall.queue === false ) {
- jQuery._mark( this );
- }
-
- var opt = jQuery.extend( {}, optall ),
- isElement = this.nodeType === 1,
- hidden = isElement && jQuery(this).is(":hidden"),
- name, val, p, e,
- parts, start, end, unit,
- method;
-
- // will store per property easing and be used to determine when an animation is complete
- opt.animatedProperties = {};
-
- for ( p in prop ) {
-
- // property name normalization
- name = jQuery.camelCase( p );
- if ( p !== name ) {
- prop[ name ] = prop[ p ];
- delete prop[ p ];
- }
-
- val = prop[ name ];
-
- // easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
- if ( jQuery.isArray( val ) ) {
- opt.animatedProperties[ name ] = val[ 1 ];
- val = prop[ name ] = val[ 0 ];
- } else {
- opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
- }
-
- if ( val === "hide" && hidden || val === "show" && !hidden ) {
- return opt.complete.call( this );
- }
-
- if ( isElement && ( name === "height" || name === "width" ) ) {
- // Make sure that nothing sneaks out
- // Record all 3 overflow attributes because IE does not
- // change the overflow attribute when overflowX and
- // overflowY are set to the same value
- opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
-
- // Set display property to inline-block for height/width
- // animations on inline elements that are having width/height animated
- if ( jQuery.css( this, "display" ) === "inline" &&
- jQuery.css( this, "float" ) === "none" ) {
-
- // inline-level elements accept inline-block;
- // block-level elements need to be inline with layout
- if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) {
- this.style.display = "inline-block";
-
- } else {
- this.style.zoom = 1;
- }
- }
- }
- }
-
- if ( opt.overflow != null ) {
- this.style.overflow = "hidden";
- }
-
- for ( p in prop ) {
- e = new jQuery.fx( this, opt, p );
- val = prop[ p ];
-
- if ( rfxtypes.test( val ) ) {
-
- // Tracks whether to show or hide based on private
- // data attached to the element
- method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 );
- if ( method ) {
- jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" );
- e[ method ]();
- } else {
- e[ val ]();
- }
-
- } else {
- parts = rfxnum.exec( val );
- start = e.cur();
-
- if ( parts ) {
- end = parseFloat( parts[2] );
- unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
-
- // We need to compute starting value
- if ( unit !== "px" ) {
- jQuery.style( this, p, (end || 1) + unit);
- start = ( (end || 1) / e.cur() ) * start;
- jQuery.style( this, p, start + unit);
- }
-
- // If a +=/-= token was provided, we're doing a relative animation
- if ( parts[1] ) {
- end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
- }
-
- e.custom( start, end, unit );
-
- } else {
- e.custom( start, val, "" );
- }
- }
- }
-
- // For JS strict compliance
- return true;
- }
-
- return optall.queue === false ?
- this.each( doAnimation ) :
- this.queue( optall.queue, doAnimation );
- },
-
- stop: function( type, clearQueue, gotoEnd ) {
- if ( typeof type !== "string" ) {
- gotoEnd = clearQueue;
- clearQueue = type;
- type = undefined;
- }
- if ( clearQueue && type !== false ) {
- this.queue( type || "fx", [] );
- }
-
- return this.each(function() {
- var index,
- hadTimers = false,
- timers = jQuery.timers,
- data = jQuery._data( this );
-
- // clear marker counters if we know they won't be
- if ( !gotoEnd ) {
- jQuery._unmark( true, this );
- }
-
- function stopQueue( elem, data, index ) {
- var hooks = data[ index ];
- jQuery.removeData( elem, index, true );
- hooks.stop( gotoEnd );
- }
-
- if ( type == null ) {
- for ( index in data ) {
- if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) {
- stopQueue( this, data, index );
- }
- }
- } else if ( data[ index = type + ".run" ] && data[ index ].stop ){
- stopQueue( this, data, index );
- }
-
- for ( index = timers.length; index--; ) {
- if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
- if ( gotoEnd ) {
-
- // force the next step to be the last
- timers[ index ]( true );
- } else {
- timers[ index ].saveState();
- }
- hadTimers = true;
- timers.splice( index, 1 );
- }
- }
-
- // start the next in the queue if the last step wasn't forced
- // timers currently will call their complete callbacks, which will dequeue
- // but only if they were gotoEnd
- if ( !( gotoEnd && hadTimers ) ) {
- jQuery.dequeue( this, type );
- }
- });
- }
-
-});
-
-// Animations created synchronously will run synchronously
-function createFxNow() {
- setTimeout( clearFxNow, 0 );
- return ( fxNow = jQuery.now() );
-}
-
-function clearFxNow() {
- fxNow = undefined;
-}
-
-// Generate parameters to create a standard animation
-function genFx( type, num ) {
- var obj = {};
-
- jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() {
- obj[ this ] = type;
- });
-
- return obj;
-}
-
-// Generate shortcuts for custom animations
-jQuery.each({
- slideDown: genFx( "show", 1 ),
- slideUp: genFx( "hide", 1 ),
- slideToggle: genFx( "toggle", 1 ),
- fadeIn: { opacity: "show" },
- fadeOut: { opacity: "hide" },
- fadeToggle: { opacity: "toggle" }
-}, function( name, props ) {
- jQuery.fn[ name ] = function( speed, easing, callback ) {
- return this.animate( props, speed, easing, callback );
- };
-});
-
-jQuery.extend({
- speed: function( speed, easing, fn ) {
- var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
- complete: fn || !fn && easing ||
- jQuery.isFunction( speed ) && speed,
- duration: speed,
- easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
- };
-
- opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
- opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
-
- // normalize opt.queue - true/undefined/null -> "fx"
- if ( opt.queue == null || opt.queue === true ) {
- opt.queue = "fx";
- }
-
- // Queueing
- opt.old = opt.complete;
-
- opt.complete = function( noUnmark ) {
- if ( jQuery.isFunction( opt.old ) ) {
- opt.old.call( this );
- }
-
- if ( opt.queue ) {
- jQuery.dequeue( this, opt.queue );
- } else if ( noUnmark !== false ) {
- jQuery._unmark( this );
- }
- };
-
- return opt;
- },
-
- easing: {
- linear: function( p, n, firstNum, diff ) {
- return firstNum + diff * p;
- },
- swing: function( p, n, firstNum, diff ) {
- return ( ( -Math.cos( p*Math.PI ) / 2 ) + 0.5 ) * diff + firstNum;
- }
- },
-
- timers: [],
-
- fx: function( elem, options, prop ) {
- this.options = options;
- this.elem = elem;
- this.prop = prop;
-
- options.orig = options.orig || {};
- }
-
-});
-
-jQuery.fx.prototype = {
- // Simple function for setting a style value
- update: function() {
- if ( this.options.step ) {
- this.options.step.call( this.elem, this.now, this );
- }
-
- ( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this );
- },
-
- // Get the current size
- cur: function() {
- if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) {
- return this.elem[ this.prop ];
- }
-
- var parsed,
- r = jQuery.css( this.elem, this.prop );
- // Empty strings, null, undefined and "auto" are converted to 0,
- // complex values such as "rotate(1rad)" are returned as is,
- // simple values such as "10px" are parsed to Float.
- return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
- },
-
- // Start an animation from one number to another
- custom: function( from, to, unit ) {
- var self = this,
- fx = jQuery.fx;
-
- this.startTime = fxNow || createFxNow();
- this.end = to;
- this.now = this.start = from;
- this.pos = this.state = 0;
- this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
-
- function t( gotoEnd ) {
- return self.step( gotoEnd );
- }
-
- t.queue = this.options.queue;
- t.elem = this.elem;
- t.saveState = function() {
- if ( self.options.hide && jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
- jQuery._data( self.elem, "fxshow" + self.prop, self.start );
- }
- };
-
- if ( t() && jQuery.timers.push(t) && !timerId ) {
- timerId = setInterval( fx.tick, fx.interval );
- }
- },
-
- // Simple 'show' function
- show: function() {
- var dataShow = jQuery._data( this.elem, "fxshow" + this.prop );
-
- // Remember where we started, so that we can go back to it later
- this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop );
- this.options.show = true;
-
- // Begin the animation
- // Make sure that we start at a small width/height to avoid any flash of content
- if ( dataShow !== undefined ) {
- // This show is picking up where a previous hide or show left off
- this.custom( this.cur(), dataShow );
- } else {
- this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() );
- }
-
- // Start by showing the element
- jQuery( this.elem ).show();
- },
-
- // Simple 'hide' function
- hide: function() {
- // Remember where we started, so that we can go back to it later
- this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop );
- this.options.hide = true;
-
- // Begin the animation
- this.custom( this.cur(), 0 );
- },
-
- // Each step of an animation
- step: function( gotoEnd ) {
- var p, n, complete,
- t = fxNow || createFxNow(),
- done = true,
- elem = this.elem,
- options = this.options;
-
- if ( gotoEnd || t >= options.duration + this.startTime ) {
- this.now = this.end;
- this.pos = this.state = 1;
- this.update();
-
- options.animatedProperties[ this.prop ] = true;
-
- for ( p in options.animatedProperties ) {
- if ( options.animatedProperties[ p ] !== true ) {
- done = false;
- }
- }
-
- if ( done ) {
- // Reset the overflow
- if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
-
- jQuery.each( [ "", "X", "Y" ], function( index, value ) {
- elem.style[ "overflow" + value ] = options.overflow[ index ];
- });
- }
-
- // Hide the element if the "hide" operation was done
- if ( options.hide ) {
- jQuery( elem ).hide();
- }
-
- // Reset the properties, if the item has been hidden or shown
- if ( options.hide || options.show ) {
- for ( p in options.animatedProperties ) {
- jQuery.style( elem, p, options.orig[ p ] );
- jQuery.removeData( elem, "fxshow" + p, true );
- // Toggle data is no longer needed
- jQuery.removeData( elem, "toggle" + p, true );
- }
- }
-
- // Execute the complete function
- // in the event that the complete function throws an exception
- // we must ensure it won't be called twice. #5684
-
- complete = options.complete;
- if ( complete ) {
-
- options.complete = false;
- complete.call( elem );
- }
- }
-
- return false;
-
- } else {
- // classical easing cannot be used with an Infinity duration
- if ( options.duration == Infinity ) {
- this.now = t;
- } else {
- n = t - this.startTime;
- this.state = n / options.duration;
-
- // Perform the easing function, defaults to swing
- this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration );
- this.now = this.start + ( (this.end - this.start) * this.pos );
- }
- // Perform the next step of the animation
- this.update();
- }
-
- return true;
- }
-};
-
-jQuery.extend( jQuery.fx, {
- tick: function() {
- var timer,
- timers = jQuery.timers,
- i = 0;
-
- for ( ; i < timers.length; i++ ) {
- timer = timers[ i ];
- // Checks the timer has not already been removed
- if ( !timer() && timers[ i ] === timer ) {
- timers.splice( i--, 1 );
- }
- }
-
- if ( !timers.length ) {
- jQuery.fx.stop();
- }
- },
-
- interval: 13,
-
- stop: function() {
- clearInterval( timerId );
- timerId = null;
- },
-
- speeds: {
- slow: 600,
- fast: 200,
- // Default speed
- _default: 400
- },
-
- step: {
- opacity: function( fx ) {
- jQuery.style( fx.elem, "opacity", fx.now );
- },
-
- _default: function( fx ) {
- if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
- fx.elem.style[ fx.prop ] = fx.now + fx.unit;
- } else {
- fx.elem[ fx.prop ] = fx.now;
- }
- }
- }
-});
-
-// Adds width/height step functions
-// Do not set anything below 0
-jQuery.each([ "width", "height" ], function( i, prop ) {
- jQuery.fx.step[ prop ] = function( fx ) {
- jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
- };
-});
-
-if ( jQuery.expr && jQuery.expr.filters ) {
- jQuery.expr.filters.animated = function( elem ) {
- return jQuery.grep(jQuery.timers, function( fn ) {
- return elem === fn.elem;
- }).length;
- };
-}
-
-// Try to restore the default display value of an element
-function defaultDisplay( nodeName ) {
-
- if ( !elemdisplay[ nodeName ] ) {
-
- var body = document.body,
- elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
- display = elem.css( "display" );
- elem.remove();
-
- // If the simple way fails,
- // get element's real default display by attaching it to a temp iframe
- if ( display === "none" || display === "" ) {
- // No iframe to use yet, so create it
- if ( !iframe ) {
- iframe = document.createElement( "iframe" );
- iframe.frameBorder = iframe.width = iframe.height = 0;
- }
-
- body.appendChild( iframe );
-
- // Create a cacheable copy of the iframe document on first call.
- // IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
- // document to it; WebKit & Firefox won't allow reusing the iframe document.
- if ( !iframeDoc || !iframe.createElement ) {
- iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
- iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
- iframeDoc.close();
- }
-
- elem = iframeDoc.createElement( nodeName );
-
- iframeDoc.body.appendChild( elem );
-
- display = jQuery.css( elem, "display" );
- body.removeChild( iframe );
- }
-
- // Store the correct default display
- elemdisplay[ nodeName ] = display;
- }
-
- return elemdisplay[ nodeName ];
-}
-
-
-
-
-var rtable = /^t(?:able|d|h)$/i,
- rroot = /^(?:body|html)$/i;
-
-if ( "getBoundingClientRect" in document.documentElement ) {
- jQuery.fn.offset = function( options ) {
- var elem = this[0], box;
-
- if ( options ) {
- return this.each(function( i ) {
- jQuery.offset.setOffset( this, options, i );
- });
- }
-
- if ( !elem || !elem.ownerDocument ) {
- return null;
- }
-
- if ( elem === elem.ownerDocument.body ) {
- return jQuery.offset.bodyOffset( elem );
- }
-
- try {
- box = elem.getBoundingClientRect();
- } catch(e) {}
-
- var doc = elem.ownerDocument,
- docElem = doc.documentElement;
-
- // Make sure we're not dealing with a disconnected DOM node
- if ( !box || !jQuery.contains( docElem, elem ) ) {
- return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
- }
-
- var body = doc.body,
- win = getWindow(doc),
- clientTop = docElem.clientTop || body.clientTop || 0,
- clientLeft = docElem.clientLeft || body.clientLeft || 0,
- scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
- scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
- top = box.top + scrollTop - clientTop,
- left = box.left + scrollLeft - clientLeft;
-
- return { top: top, left: left };
- };
-
-} else {
- jQuery.fn.offset = function( options ) {
- var elem = this[0];
-
- if ( options ) {
- return this.each(function( i ) {
- jQuery.offset.setOffset( this, options, i );
- });
- }
-
- if ( !elem || !elem.ownerDocument ) {
- return null;
- }
-
- if ( elem === elem.ownerDocument.body ) {
- return jQuery.offset.bodyOffset( elem );
- }
-
- var computedStyle,
- offsetParent = elem.offsetParent,
- prevOffsetParent = elem,
- doc = elem.ownerDocument,
- docElem = doc.documentElement,
- body = doc.body,
- defaultView = doc.defaultView,
- prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
- top = elem.offsetTop,
- left = elem.offsetLeft;
-
- while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
- if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
- break;
- }
-
- computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
- top -= elem.scrollTop;
- left -= elem.scrollLeft;
-
- if ( elem === offsetParent ) {
- top += elem.offsetTop;
- left += elem.offsetLeft;
-
- if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
- top += parseFloat( computedStyle.borderTopWidth ) || 0;
- left += parseFloat( computedStyle.borderLeftWidth ) || 0;
- }
-
- prevOffsetParent = offsetParent;
- offsetParent = elem.offsetParent;
- }
-
- if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
- top += parseFloat( computedStyle.borderTopWidth ) || 0;
- left += parseFloat( computedStyle.borderLeftWidth ) || 0;
- }
-
- prevComputedStyle = computedStyle;
- }
-
- if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
- top += body.offsetTop;
- left += body.offsetLeft;
- }
-
- if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
- top += Math.max( docElem.scrollTop, body.scrollTop );
- left += Math.max( docElem.scrollLeft, body.scrollLeft );
- }
-
- return { top: top, left: left };
- };
-}
-
-jQuery.offset = {
-
- bodyOffset: function( body ) {
- var top = body.offsetTop,
- left = body.offsetLeft;
-
- if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
- top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
- left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
- }
-
- return { top: top, left: left };
- },
-
- setOffset: function( elem, options, i ) {
- var position = jQuery.css( elem, "position" );
-
- // set position first, in-case top/left are set even on static elem
- if ( position === "static" ) {
- elem.style.position = "relative";
- }
-
- var curElem = jQuery( elem ),
- curOffset = curElem.offset(),
- curCSSTop = jQuery.css( elem, "top" ),
- curCSSLeft = jQuery.css( elem, "left" ),
- calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
- props = {}, curPosition = {}, curTop, curLeft;
-
- // need to be able to calculate position if either top or left is auto and position is either absolute or fixed
- if ( calculatePosition ) {
- curPosition = curElem.position();
- curTop = curPosition.top;
- curLeft = curPosition.left;
- } else {
- curTop = parseFloat( curCSSTop ) || 0;
- curLeft = parseFloat( curCSSLeft ) || 0;
- }
-
- if ( jQuery.isFunction( options ) ) {
- options = options.call( elem, i, curOffset );
- }
-
- if ( options.top != null ) {
- props.top = ( options.top - curOffset.top ) + curTop;
- }
- if ( options.left != null ) {
- props.left = ( options.left - curOffset.left ) + curLeft;
- }
-
- if ( "using" in options ) {
- options.using.call( elem, props );
- } else {
- curElem.css( props );
- }
- }
-};
-
-
-jQuery.fn.extend({
-
- position: function() {
- if ( !this[0] ) {
- return null;
- }
-
- var elem = this[0],
-
- // Get *real* offsetParent
- offsetParent = this.offsetParent(),
-
- // Get correct offsets
- offset = this.offset(),
- parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
-
- // Subtract element margins
- // note: when an element has margin: auto the offsetLeft and marginLeft
- // are the same in Safari causing offset.left to incorrectly be 0
- offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
- offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
-
- // Add offsetParent borders
- parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
- parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
-
- // Subtract the two offsets
- return {
- top: offset.top - parentOffset.top,
- left: offset.left - parentOffset.left
- };
- },
-
- offsetParent: function() {
- return this.map(function() {
- var offsetParent = this.offsetParent || document.body;
- while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
- offsetParent = offsetParent.offsetParent;
- }
- return offsetParent;
- });
- }
-});
-
-
-// Create scrollLeft and scrollTop methods
-jQuery.each( ["Left", "Top"], function( i, name ) {
- var method = "scroll" + name;
-
- jQuery.fn[ method ] = function( val ) {
- var elem, win;
-
- if ( val === undefined ) {
- elem = this[ 0 ];
-
- if ( !elem ) {
- return null;
- }
-
- win = getWindow( elem );
-
- // Return the scroll offset
- return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
- jQuery.support.boxModel && win.document.documentElement[ method ] ||
- win.document.body[ method ] :
- elem[ method ];
- }
-
- // Set the scroll offset
- return this.each(function() {
- win = getWindow( this );
-
- if ( win ) {
- win.scrollTo(
- !i ? val : jQuery( win ).scrollLeft(),
- i ? val : jQuery( win ).scrollTop()
- );
-
- } else {
- this[ method ] = val;
- }
- });
- };
-});
-
-function getWindow( elem ) {
- return jQuery.isWindow( elem ) ?
- elem :
- elem.nodeType === 9 ?
- elem.defaultView || elem.parentWindow :
- false;
-}
-
-
-
-
-// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
-jQuery.each([ "Height", "Width" ], function( i, name ) {
-
- var type = name.toLowerCase();
-
- // innerHeight and innerWidth
- jQuery.fn[ "inner" + name ] = function() {
- var elem = this[0];
- return elem ?
- elem.style ?
- parseFloat( jQuery.css( elem, type, "padding" ) ) :
- this[ type ]() :
- null;
- };
-
- // outerHeight and outerWidth
- jQuery.fn[ "outer" + name ] = function( margin ) {
- var elem = this[0];
- return elem ?
- elem.style ?
- parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
- this[ type ]() :
- null;
- };
-
- jQuery.fn[ type ] = function( size ) {
- // Get window width or height
- var elem = this[0];
- if ( !elem ) {
- return size == null ? null : this;
- }
-
- if ( jQuery.isFunction( size ) ) {
- return this.each(function( i ) {
- var self = jQuery( this );
- self[ type ]( size.call( this, i, self[ type ]() ) );
- });
- }
-
- if ( jQuery.isWindow( elem ) ) {
- // Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
- // 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
- var docElemProp = elem.document.documentElement[ "client" + name ],
- body = elem.document.body;
- return elem.document.compatMode === "CSS1Compat" && docElemProp ||
- body && body[ "client" + name ] || docElemProp;
-
- // Get document width or height
- } else if ( elem.nodeType === 9 ) {
- // Either scroll[Width/Height] or offset[Width/Height], whichever is greater
- return Math.max(
- elem.documentElement["client" + name],
- elem.body["scroll" + name], elem.documentElement["scroll" + name],
- elem.body["offset" + name], elem.documentElement["offset" + name]
- );
-
- // Get or set width or height on the element
- } else if ( size === undefined ) {
- var orig = jQuery.css( elem, type ),
- ret = parseFloat( orig );
-
- return jQuery.isNumeric( ret ) ? ret : orig;
-
- // Set the width or height on the element (default to pixels if value is unitless)
- } else {
- return this.css( type, typeof size === "string" ? size : size + "px" );
- }
- };
-
-});
-
-
-
-
-// Expose jQuery to the global object
-window.jQuery = window.$ = jQuery;
-
-// Expose jQuery as an AMD module, but only for AMD loaders that
-// understand the issues with loading multiple versions of jQuery
-// in a page that all might call define(). The loader will indicate
-// they have special allowances for multiple jQuery versions by
-// specifying define.amd.jQuery = true. Register as a named module,
-// since jQuery can be concatenated with other files that may use define,
-// but not use a proper concatenation script that understands anonymous
-// AMD modules. A named AMD is safest and most robust way to register.
-// Lowercase jquery is used because AMD module names are derived from
-// file names, and jQuery is normally delivered in a lowercase file name.
-// Do this after creating the global so that if an AMD module wants to call
-// noConflict to hide this version of jQuery, it will work.
-if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
- define( "jquery", [], function () { return jQuery; } );
-}
-
-
-
-})( window );
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jsmin.c b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jsmin.c
deleted file mode 100644
index 03158289674..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jsmin.c
+++ /dev/null
@@ -1,291 +0,0 @@
-/* jsmin.c
- 2011-01-22
-
-Copyright (c) 2002 Douglas Crockford (www.crockford.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-
-static int theA;
-static int theB;
-static int theLookahead = EOF;
-
-
-/* isAlphanum -- return true if the character is a letter, digit, underscore,
- dollar sign, or non-ASCII character.
-*/
-
-static int
-isAlphanum(int c)
-{
- return ((c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') ||
- (c >= 'A' && c <= 'Z') || c == '_' || c == '$' || c == '\\' ||
- c > 126);
-}
-
-
-/* get -- return the next character from stdin. Watch out for lookahead. If
- the character is a control character, translate it to a space or
- linefeed.
-*/
-
-static int
-get()
-{
- int c = theLookahead;
- theLookahead = EOF;
- if (c == EOF) {
- c = getc(stdin);
- }
- if (c >= ' ' || c == '\n' || c == EOF) {
- return c;
- }
- if (c == '\r') {
- return '\n';
- }
- return ' ';
-}
-
-
-/* peek -- get the next character without getting it.
-*/
-
-static int
-peek()
-{
- theLookahead = get();
- return theLookahead;
-}
-
-
-/* next -- get the next character, excluding comments. peek() is used to see
- if a '/' is followed by a '/' or '*'.
-*/
-
-static int
-next()
-{
- int c = get();
- if (c == '/') {
- switch (peek()) {
- case '/':
- for (;;) {
- c = get();
- if (c <= '\n') {
- return c;
- }
- }
- case '*':
- get();
- for (;;) {
- switch (get()) {
- case '*':
- if (peek() == '/') {
- get();
- return ' ';
- }
- break;
- case EOF:
- fprintf(stderr, "Error: JSMIN Unterminated comment.\n");
- exit(1);
- }
- }
- default:
- return c;
- }
- }
- return c;
-}
-
-
-/* action -- do something! What you do is determined by the argument:
- 1 Output A. Copy B to A. Get the next B.
- 2 Copy B to A. Get the next B. (Delete A).
- 3 Get the next B. (Delete B).
- action treats a string as a single character. Wow!
- action recognizes a regular expression if it is preceded by ( or , or =.
-*/
-
-static void
-action(int d)
-{
- switch (d) {
- case 1:
- putc(theA, stdout);
- case 2:
- theA = theB;
- if (theA == '\'' || theA == '"') {
- for (;;) {
- putc(theA, stdout);
- theA = get();
- if (theA == theB) {
- break;
- }
- if (theA == '\\') {
- putc(theA, stdout);
- theA = get();
- }
- if (theA == EOF) {
- fprintf(stderr, "Error: JSMIN unterminated string literal.");
- exit(1);
- }
- }
- }
- case 3:
- theB = next();
- if (theB == '/' && (theA == '(' || theA == ',' || theA == '=' ||
- theA == ':' || theA == '[' || theA == '!' ||
- theA == '&' || theA == '|' || theA == '?' ||
- theA == '{' || theA == '}' || theA == ';' ||
- theA == '\n')) {
- putc(theA, stdout);
- putc(theB, stdout);
- for (;;) {
- theA = get();
- if (theA == '[') {
- for (;;) {
- putc(theA, stdout);
- theA = get();
- if (theA == ']') {
- break;
- }
- if (theA == '\\') {
- putc(theA, stdout);
- theA = get();
- }
- if (theA == EOF) {
- fprintf(stderr,
- "Error: JSMIN unterminated set in Regular Expression literal.\n");
- exit(1);
- }
- }
- } else if (theA == '/') {
- break;
- } else if (theA =='\\') {
- putc(theA, stdout);
- theA = get();
- }
- if (theA == EOF) {
- fprintf(stderr,
- "Error: JSMIN unterminated Regular Expression literal.\n");
- exit(1);
- }
- putc(theA, stdout);
- }
- theB = next();
- }
- }
-}
-
-
-/* jsmin -- Copy the input to the output, deleting the characters which are
- insignificant to JavaScript. Comments will be removed. Tabs will be
- replaced with spaces. Carriage returns will be replaced with linefeeds.
- Most spaces and linefeeds will be removed.
-*/
-
-static void
-jsmin()
-{
- theA = '\n';
- action(3);
- while (theA != EOF) {
- switch (theA) {
- case ' ':
- if (isAlphanum(theB)) {
- action(1);
- } else {
- action(2);
- }
- break;
- case '\n':
- switch (theB) {
- case '{':
- case '[':
- case '(':
- case '+':
- case '-':
- action(1);
- break;
- case ' ':
- action(3);
- break;
- default:
- if (isAlphanum(theB)) {
- action(1);
- } else {
- action(2);
- }
- }
- break;
- default:
- switch (theB) {
- case ' ':
- if (isAlphanum(theA)) {
- action(1);
- break;
- }
- action(3);
- break;
- case '\n':
- switch (theA) {
- case '}':
- case ']':
- case ')':
- case '+':
- case '-':
- case '"':
- case '\'':
- action(1);
- break;
- default:
- if (isAlphanum(theA)) {
- action(1);
- } else {
- action(3);
- }
- }
- break;
- default:
- action(1);
- break;
- }
- }
- }
-}
-
-
-/* main -- Output any command line arguments as comments
- and then minify the input.
-*/
-extern int
-main(int argc, char* argv[])
-{
- int i;
- for (i = 1; i < argc; i += 1) {
- fprintf(stdout, "// %s\n", argv[i]);
- }
- jsmin();
- return 0;
-}
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jsmin.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jsmin.py
deleted file mode 100644
index b1f7dd7e62e..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jsmin.py
+++ /dev/null
@@ -1,226 +0,0 @@
-#!/usr/bin/env python
-
-# This code is original from jsmin by Douglas Crockford, it was translated to
-# Python by Baruch Even. The original code had the following copyright and
-# license.
-#
-# /* jsmin.c
-# 2007-05-22
-#
-# Copyright (c) 2002 Douglas Crockford (www.crockford.com)
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy of
-# this software and associated documentation files (the "Software"), to deal in
-# the Software without restriction, including without limitation the rights to
-# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-# of the Software, and to permit persons to whom the Software is furnished to do
-# so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in all
-# copies or substantial portions of the Software.
-#
-# The Software shall be used for Good, not Evil.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-# */
-
-# imports adjusted for speed (cStringIO) and python 3 (io) -- nd
-try:
- from cStringIO import StringIO
-except ImportError:
- try:
- from StringIO import StringIO
- except ImportError:
- from io import StringIO
-
-
-def jsmin(js):
- ins = StringIO(js)
- outs = StringIO()
- JavascriptMinify().minify(ins, outs)
- str = outs.getvalue()
- if len(str) > 0 and str[0] == '\n':
- str = str[1:]
- return str
-
-def isAlphanum(c):
- """return true if the character is a letter, digit, underscore,
- dollar sign, or non-ASCII character.
- """
- return ((c >= 'a' and c <= 'z') or (c >= '0' and c <= '9') or
- (c >= 'A' and c <= 'Z') or c == '_' or c == '$' or c == '\\' or (c is not None and ord(c) > 126));
-
-class UnterminatedComment(Exception):
- pass
-
-class UnterminatedStringLiteral(Exception):
- pass
-
-class UnterminatedRegularExpression(Exception):
- pass
-
-class JavascriptMinify(object):
-
- def _outA(self):
- self.outstream.write(self.theA)
- def _outB(self):
- self.outstream.write(self.theB)
-
- def _get(self):
- """return the next character from stdin. Watch out for lookahead. If
- the character is a control character, translate it to a space or
- linefeed.
- """
- c = self.theLookahead
- self.theLookahead = None
- if c == None:
- c = self.instream.read(1)
- if c >= ' ' or c == '\n':
- return c
- if c == '': # EOF
- return '\000'
- if c == '\r':
- return '\n'
- return ' '
-
- def _peek(self):
- self.theLookahead = self._get()
- return self.theLookahead
-
- def _next(self):
- """get the next character, excluding comments. peek() is used to see
- if an unescaped '/' is followed by a '/' or '*'.
- """
- c = self._get()
- if c == '/' and self.theA != '\\':
- p = self._peek()
- if p == '/':
- c = self._get()
- while c > '\n':
- c = self._get()
- return c
- if p == '*':
- c = self._get()
- while 1:
- c = self._get()
- if c == '*':
- if self._peek() == '/':
- self._get()
- return ' '
- if c == '\000':
- raise UnterminatedComment()
-
- return c
-
- def _action(self, action):
- """do something! What you do is determined by the argument:
- 1 Output A. Copy B to A. Get the next B.
- 2 Copy B to A. Get the next B. (Delete A).
- 3 Get the next B. (Delete B).
- action treats a string as a single character. Wow!
- action recognizes a regular expression if it is preceded by ( or , or =.
- """
- if action <= 1:
- self._outA()
-
- if action <= 2:
- self.theA = self.theB
- if self.theA == "'" or self.theA == '"':
- while 1:
- self._outA()
- self.theA = self._get()
- if self.theA == self.theB:
- break
- if self.theA <= '\n':
- raise UnterminatedStringLiteral()
- if self.theA == '\\':
- self._outA()
- self.theA = self._get()
-
-
- if action <= 3:
- self.theB = self._next()
- if self.theB == '/' and (self.theA == '(' or self.theA == ',' or
- self.theA == '=' or self.theA == ':' or
- self.theA == '[' or self.theA == '?' or
- self.theA == '!' or self.theA == '&' or
- self.theA == '|' or self.theA == ';' or
- self.theA == '{' or self.theA == '}' or
- self.theA == '\n'):
- self._outA()
- self._outB()
- while 1:
- self.theA = self._get()
- if self.theA == '/':
- break
- elif self.theA == '\\':
- self._outA()
- self.theA = self._get()
- elif self.theA <= '\n':
- raise UnterminatedRegularExpression()
- self._outA()
- self.theB = self._next()
-
-
- def _jsmin(self):
- """Copy the input to the output, deleting the characters which are
- insignificant to JavaScript. Comments will be removed. Tabs will be
- replaced with spaces. Carriage returns will be replaced with linefeeds.
- Most spaces and linefeeds will be removed.
- """
- self.theA = '\n'
- self._action(3)
-
- while self.theA != '\000':
- if self.theA == ' ':
- if isAlphanum(self.theB):
- self._action(1)
- else:
- self._action(2)
- elif self.theA == '\n':
- if self.theB in ['{', '[', '(', '+', '-']:
- self._action(1)
- elif self.theB == ' ':
- self._action(3)
- else:
- if isAlphanum(self.theB):
- self._action(1)
- else:
- self._action(2)
- else:
- if self.theB == ' ':
- if isAlphanum(self.theA):
- self._action(1)
- else:
- self._action(3)
- elif self.theB == '\n':
- if self.theA in ['}', ']', ')', '+', '-', '"', '\'']:
- self._action(1)
- else:
- if isAlphanum(self.theA):
- self._action(1)
- else:
- self._action(3)
- else:
- self._action(1)
-
- def minify(self, instream, outstream):
- self.instream = instream
- self.outstream = outstream
- self.theA = '\n'
- self.theB = None
- self.theLookahead = None
-
- self._jsmin()
- self.instream.close()
-
-if __name__ == '__main__':
- import sys
- jsm = JavascriptMinify()
- jsm.minify(sys.stdin, sys.stdout)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jsmin_2_0_9.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jsmin_2_0_9.py
deleted file mode 100644
index 23bed6082b8..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/jsmin_2_0_9.py
+++ /dev/null
@@ -1,233 +0,0 @@
-# This code is original from jsmin by Douglas Crockford, it was translated to
-# Python by Baruch Even. It was rewritten by Dave St.Germain for speed.
-#
-# The MIT License (MIT)
-#
-# Copyright (c) 2013 Dave St.Germain
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-# THE SOFTWARE.
-
-
-import sys
-is_3 = sys.version_info >= (3, 0)
-if is_3:
- import io
-else:
- import StringIO
- try:
- import cStringIO
- except ImportError:
- cStringIO = None
-
-
-__all__ = ['jsmin', 'JavascriptMinify']
-__version__ = '2.0.9'
-
-
-def jsmin(js):
- """
- returns a minified version of the javascript string
- """
- if not is_3:
- if cStringIO and not isinstance(js, unicode):
- # strings can use cStringIO for a 3x performance
- # improvement, but unicode (in python2) cannot
- klass = cStringIO.StringIO
- else:
- klass = StringIO.StringIO
- else:
- klass = io.StringIO
- ins = klass(js)
- outs = klass()
- JavascriptMinify(ins, outs).minify()
- return outs.getvalue()
-
-
-class JavascriptMinify(object):
- """
- Minify an input stream of javascript, writing
- to an output stream
- """
-
- def __init__(self, instream=None, outstream=None):
- self.ins = instream
- self.outs = outstream
-
- def minify(self, instream=None, outstream=None):
- if instream and outstream:
- self.ins, self.outs = instream, outstream
-
- self.is_return = False
- self.return_buf = ''
-
- def write(char):
- # all of this is to support literal regular expressions.
- # sigh
- if char in 'return':
- self.return_buf += char
- self.is_return = self.return_buf == 'return'
- self.outs.write(char)
- if self.is_return:
- self.return_buf = ''
-
- read = self.ins.read
-
- space_strings = "abcdefghijklmnopqrstuvwxyz"\
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$\\"
- starters, enders = '{[(+-', '}])+-"\''
- newlinestart_strings = starters + space_strings
- newlineend_strings = enders + space_strings
- do_newline = False
- do_space = False
- escape_slash_count = 0
- doing_single_comment = False
- previous_before_comment = ''
- doing_multi_comment = False
- in_re = False
- in_quote = ''
- quote_buf = []
-
- previous = read(1)
- if previous == '\\':
- escape_slash_count += 1
- next1 = read(1)
- if previous == '/':
- if next1 == '/':
- doing_single_comment = True
- elif next1 == '*':
- doing_multi_comment = True
- previous = next1
- next1 = read(1)
- else:
- write(previous)
- elif not previous:
- return
- elif previous >= '!':
- if previous in "'\"":
- in_quote = previous
- write(previous)
- previous_non_space = previous
- else:
- previous_non_space = ' '
- if not next1:
- return
-
- while 1:
- next2 = read(1)
- if not next2:
- last = next1.strip()
- if not (doing_single_comment or doing_multi_comment)\
- and last not in ('', '/'):
- if in_quote:
- write(''.join(quote_buf))
- write(last)
- break
- if doing_multi_comment:
- if next1 == '*' and next2 == '/':
- doing_multi_comment = False
- next2 = read(1)
- elif doing_single_comment:
- if next1 in '\r\n':
- doing_single_comment = False
- while next2 in '\r\n':
- next2 = read(1)
- if not next2:
- break
- if previous_before_comment in ')}]':
- do_newline = True
- elif previous_before_comment in space_strings:
- write('\n')
- elif in_quote:
- quote_buf.append(next1)
-
- if next1 == in_quote:
- numslashes = 0
- for c in reversed(quote_buf[:-1]):
- if c != '\\':
- break
- else:
- numslashes += 1
- if numslashes % 2 == 0:
- in_quote = ''
- write(''.join(quote_buf))
- elif next1 in '\r\n':
- if previous_non_space in newlineend_strings \
- or previous_non_space > '~':
- while 1:
- if next2 < '!':
- next2 = read(1)
- if not next2:
- break
- else:
- if next2 in newlinestart_strings \
- or next2 > '~' or next2 == '/':
- do_newline = True
- break
- elif next1 < '!' and not in_re:
- if (previous_non_space in space_strings \
- or previous_non_space > '~') \
- and (next2 in space_strings or next2 > '~'):
- do_space = True
- elif previous_non_space in '-+' and next2 == previous_non_space:
- # protect against + ++ or - -- sequences
- do_space = True
- elif self.is_return and next2 == '/':
- # returning a regex...
- write(' ')
- elif next1 == '/':
- if do_space:
- write(' ')
- if in_re:
- if previous != '\\' or (not escape_slash_count % 2) or next2 in 'gimy':
- in_re = False
- write('/')
- elif next2 == '/':
- doing_single_comment = True
- previous_before_comment = previous_non_space
- elif next2 == '*':
- doing_multi_comment = True
- previous = next1
- next1 = next2
- next2 = read(1)
- else:
- in_re = previous_non_space in '(,=:[?!&|' or self.is_return # literal regular expression
- write('/')
- else:
- if do_space:
- do_space = False
- write(' ')
- if do_newline:
- write('\n')
- do_newline = False
-
- write(next1)
- if not in_re and next1 in "'\"":
- in_quote = next1
- quote_buf = []
-
- previous = next1
- next1 = next2
-
- if previous >= '!':
- previous_non_space = previous
-
- if previous == '\\':
- escape_slash_count += 1
- else:
- escape_slash_count = 0
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/knockout-2.0.0.js b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/knockout-2.0.0.js
deleted file mode 100644
index e5577ebdf0d..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/knockout-2.0.0.js
+++ /dev/null
@@ -1,97 +0,0 @@
-// Knockout JavaScript library v2.0.0
-// (c) Steven Sanderson - http://knockoutjs.com/
-// License: MIT (http://www.opensource.org/licenses/mit-license.php)
-
-(function(window,undefined){
-function c(a){throw a;}var l=void 0,m=!0,o=null,p=!1,r=window.ko={};r.b=function(a,b){for(var d=a.split("."),e=window,f=0;f<d.length-1;f++)e=e[d[f]];e[d[d.length-1]]=b};r.l=function(a,b,d){a[b]=d};
-r.a=new function(){function a(a,e){if("INPUT"!=a.tagName||!a.type)return p;if("click"!=e.toLowerCase())return p;var b=a.type.toLowerCase();return"checkbox"==b||"radio"==b}var b=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,d={},e={};d[/Firefox\/2/i.test(navigator.userAgent)?"KeyboardEvent":"UIEvents"]=["keyup","keydown","keypress"];d.MouseEvents="click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave".split(",");for(var f in d){var h=d[f];if(h.length)for(var g=0,i=h.length;g<i;g++)e[h[g]]=
-f}var j=function(){for(var a=3,e=document.createElement("div"),b=e.getElementsByTagName("i");e.innerHTML="<\!--[if gt IE "+ ++a+"]><i></i><![endif]--\>",b[0];);return 4<a?a:l}();return{Ba:["authenticity_token",/^__RequestVerificationToken(_.*)?$/],n:function(a,e){for(var b=0,f=a.length;b<f;b++)e(a[b])},k:function(a,e){if("function"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(a,e);for(var b=0,f=a.length;b<f;b++)if(a[b]===e)return b;return-1},Wa:function(a,e,b){for(var f=0,d=
-a.length;f<d;f++)if(e.call(b,a[f]))return a[f];return o},ca:function(a,e){var b=r.a.k(a,e);0<=b&&a.splice(b,1)},ya:function(a){for(var a=a||[],e=[],b=0,f=a.length;b<f;b++)0>r.a.k(e,a[b])&&e.push(a[b]);return e},ba:function(a,e){for(var a=a||[],b=[],f=0,d=a.length;f<d;f++)b.push(e(a[f]));return b},aa:function(a,e){for(var a=a||[],b=[],f=0,d=a.length;f<d;f++)e(a[f])&&b.push(a[f]);return b},J:function(a,e){for(var b=0,f=e.length;b<f;b++)a.push(e[b]);return a},extend:function(a,e){for(var b in e)e.hasOwnProperty(b)&&
-(a[b]=e[b]);return a},U:function(a){for(;a.firstChild;)r.removeNode(a.firstChild)},oa:function(a,e){r.a.U(a);e&&r.a.n(e,function(e){a.appendChild(e)})},Ja:function(a,e){var b=a.nodeType?[a]:a;if(0<b.length){for(var f=b[0],d=f.parentNode,h=0,g=e.length;h<g;h++)d.insertBefore(e[h],f);h=0;for(g=b.length;h<g;h++)r.removeNode(b[h])}},La:function(a,e){0<=navigator.userAgent.indexOf("MSIE 6")?a.setAttribute("selected",e):a.selected=e},z:function(a){return(a||"").replace(b,"")},Db:function(a,e){for(var b=
-[],f=(a||"").split(e),d=0,h=f.length;d<h;d++){var g=r.a.z(f[d]);""!==g&&b.push(g)}return b},Cb:function(a,e){a=a||"";return e.length>a.length?p:a.substring(0,e.length)===e},hb:function(a){for(var e=Array.prototype.slice.call(arguments,1),b="return ("+a+")",f=0;f<e.length;f++)e[f]&&"object"==typeof e[f]&&(b="with(sc["+f+"]) { "+b+" } ");return(new Function("sc",b))(e)},fb:function(a,e){if(e.compareDocumentPosition)return 16==(e.compareDocumentPosition(a)&16);for(;a!=o;){if(a==e)return m;a=a.parentNode}return p},
-ga:function(a){return r.a.fb(a,document)},s:function(e,b,f){if("undefined"!=typeof jQuery){if(a(e,b))var d=f,f=function(a,e){var b=this.checked;if(e)this.checked=e.Ya!==m;d.call(this,a);this.checked=b};jQuery(e).bind(b,f)}else"function"==typeof e.addEventListener?e.addEventListener(b,f,p):"undefined"!=typeof e.attachEvent?e.attachEvent("on"+b,function(a){f.call(e,a)}):c(Error("Browser doesn't support addEventListener or attachEvent"))},sa:function(b,f){(!b||!b.nodeType)&&c(Error("element must be a DOM node when calling triggerEvent"));
-if("undefined"!=typeof jQuery){var d=[];a(b,f)&&d.push({Ya:b.checked});jQuery(b).trigger(f,d)}else if("function"==typeof document.createEvent)"function"==typeof b.dispatchEvent?(d=document.createEvent(e[f]||"HTMLEvents"),d.initEvent(f,m,m,window,0,0,0,0,0,p,p,p,p,0,b),b.dispatchEvent(d)):c(Error("The supplied element doesn't support dispatchEvent"));else if("undefined"!=typeof b.fireEvent){if("click"==f&&"INPUT"==b.tagName&&("checkbox"==b.type.toLowerCase()||"radio"==b.type.toLowerCase()))b.checked=
-b.checked!==m;b.fireEvent("on"+f)}else c(Error("Browser doesn't support triggering events"))},d:function(a){return r.V(a)?a():a},eb:function(a,e){return 0<=r.a.k((a.className||"").split(/\s+/),e)},Qa:function(a,e,b){var f=r.a.eb(a,e);if(b&&!f)a.className=(a.className||"")+" "+e;else if(f&&!b){for(var b=(a.className||"").split(/\s+/),f="",d=0;d<b.length;d++)b[d]!=e&&(f+=b[d]+" ");a.className=r.a.z(f)}},outerHTML:function(a){if(j===l){var e=a.outerHTML;if("string"==typeof e)return e}e=window.document.createElement("div");
-e.appendChild(a.cloneNode(m));return e.innerHTML},Ma:function(a,e){var b=r.a.d(e);if(b===o||b===l)b="";"innerText"in a?a.innerText=b:a.textContent=b;if(9<=j)a.innerHTML=a.innerHTML},yb:function(a,e){for(var a=r.a.d(a),e=r.a.d(e),b=[],f=a;f<=e;f++)b.push(f);return b},X:function(a){for(var e=[],b=0,f=a.length;b<f;b++)e.push(a[b]);return e},ob:6===j,pb:7===j,Ca:function(a,e){for(var b=r.a.X(a.getElementsByTagName("INPUT")).concat(r.a.X(a.getElementsByTagName("TEXTAREA"))),f="string"==typeof e?function(a){return a.name===
-e}:function(a){return e.test(a.name)},d=[],h=b.length-1;0<=h;h--)f(b[h])&&d.push(b[h]);return d},vb:function(a){return"string"==typeof a&&(a=r.a.z(a))?window.JSON&&window.JSON.parse?window.JSON.parse(a):(new Function("return "+a))():o},qa:function(a){("undefined"==typeof JSON||"undefined"==typeof JSON.stringify)&&c(Error("Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js"));
-return JSON.stringify(r.a.d(a))},wb:function(a,e,b){var b=b||{},f=b.params||{},d=b.includeFields||this.Ba,h=a;if("object"==typeof a&&"FORM"==a.tagName)for(var h=a.action,g=d.length-1;0<=g;g--)for(var j=r.a.Ca(a,d[g]),i=j.length-1;0<=i;i--)f[j[i].name]=j[i].value;var e=r.a.d(e),u=document.createElement("FORM");u.style.display="none";u.action=h;u.method="post";for(var y in e)a=document.createElement("INPUT"),a.name=y,a.value=r.a.qa(r.a.d(e[y])),u.appendChild(a);for(y in f)a=document.createElement("INPUT"),
-a.name=y,a.value=f[y],u.appendChild(a);document.body.appendChild(u);b.submitter?b.submitter(u):u.submit();setTimeout(function(){u.parentNode.removeChild(u)},0)}}};r.b("ko.utils",r.a);
-r.a.n([["arrayForEach",r.a.n],["arrayFirst",r.a.Wa],["arrayFilter",r.a.aa],["arrayGetDistinctValues",r.a.ya],["arrayIndexOf",r.a.k],["arrayMap",r.a.ba],["arrayPushAll",r.a.J],["arrayRemoveItem",r.a.ca],["extend",r.a.extend],["fieldsIncludedWithJsonPost",r.a.Ba],["getFormFields",r.a.Ca],["postJson",r.a.wb],["parseJson",r.a.vb],["registerEventHandler",r.a.s],["stringifyJson",r.a.qa],["range",r.a.yb],["toggleDomNodeCssClass",r.a.Qa],["triggerEvent",r.a.sa],["unwrapObservable",r.a.d]],function(a){r.b("ko.utils."+
-a[0],a[1])});Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,d=Array.prototype.slice.call(arguments),a=d.shift();return function(){return b.apply(a,d.concat(Array.prototype.slice.call(arguments)))}});
-r.a.e=new function(){var a=0,b="__ko__"+(new Date).getTime(),d={};return{get:function(a,b){var d=r.a.e.getAll(a,p);return d===l?l:d[b]},set:function(a,b,d){d===l&&r.a.e.getAll(a,p)===l||(r.a.e.getAll(a,m)[b]=d)},getAll:function(e,f){var h=e[b];if(!(h&&"null"!==h)){if(!f)return;h=e[b]="ko"+a++;d[h]={}}return d[h]},clear:function(a){var f=a[b];f&&(delete d[f],a[b]=o)}}};r.b("ko.utils.domData",r.a.e);r.b("ko.utils.domData.clear",r.a.e.clear);
-r.a.A=new function(){function a(a,b){var h=r.a.e.get(a,d);h===l&&b&&(h=[],r.a.e.set(a,d,h));return h}function b(e){var b=a(e,p);if(b)for(var b=b.slice(0),d=0;d<b.length;d++)b[d](e);r.a.e.clear(e);"function"==typeof jQuery&&"function"==typeof jQuery.cleanData&&jQuery.cleanData([e])}var d="__ko_domNodeDisposal__"+(new Date).getTime();return{va:function(e,b){"function"!=typeof b&&c(Error("Callback must be a function"));a(e,m).push(b)},Ia:function(e,b){var h=a(e,p);h&&(r.a.ca(h,b),0==h.length&&r.a.e.set(e,
-d,l))},F:function(a){if(!(1!=a.nodeType&&9!=a.nodeType)){b(a);var f=[];r.a.J(f,a.getElementsByTagName("*"));for(var a=0,d=f.length;a<d;a++)b(f[a])}},removeNode:function(a){r.F(a);a.parentNode&&a.parentNode.removeChild(a)}}};r.F=r.a.A.F;r.removeNode=r.a.A.removeNode;r.b("ko.cleanNode",r.F);r.b("ko.removeNode",r.removeNode);r.b("ko.utils.domNodeDisposal",r.a.A);r.b("ko.utils.domNodeDisposal.addDisposeCallback",r.a.A.va);r.b("ko.utils.domNodeDisposal.removeDisposeCallback",r.a.A.Ia);
-r.a.ma=function(a){var b;if("undefined"!=typeof jQuery){if((b=jQuery.clean([a]))&&b[0]){for(a=b[0];a.parentNode&&11!==a.parentNode.nodeType;)a=a.parentNode;a.parentNode&&a.parentNode.removeChild(a)}}else{var d=r.a.z(a).toLowerCase();b=document.createElement("div");d=d.match(/^<(thead|tbody|tfoot)/)&&[1,"<table>","</table>"]||!d.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!d.indexOf("<td")||!d.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];a="ignored<div>"+
-d[1]+a+d[2]+"</div>";for("function"==typeof window.innerShiv?b.appendChild(window.innerShiv(a)):b.innerHTML=a;d[0]--;)b=b.lastChild;b=r.a.X(b.lastChild.childNodes)}return b};r.a.Z=function(a,b){r.a.U(a);if(b!==o&&b!==l)if("string"!=typeof b&&(b=b.toString()),"undefined"!=typeof jQuery)jQuery(a).html(b);else for(var d=r.a.ma(b),e=0;e<d.length;e++)a.appendChild(d[e])};r.b("ko.utils.parseHtmlFragment",r.a.ma);r.b("ko.utils.setHtml",r.a.Z);
-r.r=function(){function a(){return(4294967296*(1+Math.random())|0).toString(16).substring(1)}function b(a,f){if(a)if(8==a.nodeType){var d=r.r.Ga(a.nodeValue);d!=o&&f.push({cb:a,tb:d})}else if(1==a.nodeType)for(var d=0,g=a.childNodes,i=g.length;d<i;d++)b(g[d],f)}var d={};return{ka:function(b){"function"!=typeof b&&c(Error("You can only pass a function to ko.memoization.memoize()"));var f=a()+a();d[f]=b;return"<\!--[ko_memo:"+f+"]--\>"},Ra:function(a,b){var h=d[a];h===l&&c(Error("Couldn't find any memo with ID "+
-a+". Perhaps it's already been unmemoized."));try{return h.apply(o,b||[]),m}finally{delete d[a]}},Sa:function(a,f){var d=[];b(a,d);for(var g=0,i=d.length;g<i;g++){var j=d[g].cb,k=[j];f&&r.a.J(k,f);r.r.Ra(d[g].tb,k);j.nodeValue="";j.parentNode&&j.parentNode.removeChild(j)}},Ga:function(a){return(a=a.match(/^\[ko_memo\:(.*?)\]$/))?a[1]:o}}}();r.b("ko.memoization",r.r);r.b("ko.memoization.memoize",r.r.ka);r.b("ko.memoization.unmemoize",r.r.Ra);r.b("ko.memoization.parseMemoText",r.r.Ga);
-r.b("ko.memoization.unmemoizeDomNodeAndDescendants",r.r.Sa);r.Aa={throttle:function(a,b){a.throttleEvaluation=b;var d=o;return r.i({read:a,write:function(e){clearTimeout(d);d=setTimeout(function(){a(e)},b)}})},notify:function(a,b){a.equalityComparer="always"==b?function(){return p}:r.w.fn.equalityComparer;return a}};r.b("ko.extenders",r.Aa);r.Oa=function(a,b){this.da=a;this.bb=b;r.l(this,"dispose",this.v)};r.Oa.prototype.v=function(){this.nb=m;this.bb()};
-r.R=function(){this.u={};r.a.extend(this,r.R.fn);r.l(this,"subscribe",this.ra);r.l(this,"extend",this.extend);r.l(this,"getSubscriptionsCount",this.kb)};
-r.R.fn={ra:function(a,b,d){var d=d||"change",a=b?a.bind(b):a,e=new r.Oa(a,function(){r.a.ca(this.u[d],e)}.bind(this));this.u[d]||(this.u[d]=[]);this.u[d].push(e);return e},notifySubscribers:function(a,b){b=b||"change";this.u[b]&&r.a.n(this.u[b].slice(0),function(b){b&&b.nb!==m&&b.da(a)})},kb:function(){var a=0,b;for(b in this.u)this.u.hasOwnProperty(b)&&(a+=this.u[b].length);return a},extend:function(a){var b=this;if(a)for(var d in a){var e=r.Aa[d];"function"==typeof e&&(b=e(b,a[d]))}return b}};
-r.Ea=function(a){return"function"==typeof a.ra&&"function"==typeof a.notifySubscribers};r.b("ko.subscribable",r.R);r.b("ko.isSubscribable",r.Ea);r.T=function(){var a=[];return{Xa:function(b){a.push({da:b,za:[]})},end:function(){a.pop()},Ha:function(b){r.Ea(b)||c("Only subscribable things can act as dependencies");if(0<a.length){var d=a[a.length-1];0<=r.a.k(d.za,b)||(d.za.push(b),d.da(b))}}}}();var B={undefined:m,"boolean":m,number:m,string:m};
-r.w=function(a){function b(){if(0<arguments.length){if(!b.equalityComparer||!b.equalityComparer(d,arguments[0]))b.H(),d=arguments[0],b.G();return this}r.T.Ha(b);return d}var d=a;r.R.call(b);b.G=function(){b.notifySubscribers(d)};b.H=function(){b.notifySubscribers(d,"beforeChange")};r.a.extend(b,r.w.fn);r.l(b,"valueHasMutated",b.G);r.l(b,"valueWillMutate",b.H);return b};r.w.fn={B:r.w,equalityComparer:function(a,b){return a===o||typeof a in B?a===b:p}};
-r.V=function(a){return a===o||a===l||a.B===l?p:a.B===r.w?m:r.V(a.B)};r.P=function(a){return"function"==typeof a&&a.B===r.w?m:"function"==typeof a&&a.B===r.i&&a.lb?m:p};r.b("ko.observable",r.w);r.b("ko.isObservable",r.V);r.b("ko.isWriteableObservable",r.P);
-r.Q=function(a){0==arguments.length&&(a=[]);a!==o&&a!==l&&!("length"in a)&&c(Error("The argument passed when initializing an observable array must be an array, or null, or undefined."));var b=new r.w(a);r.a.extend(b,r.Q.fn);r.l(b,"remove",b.remove);r.l(b,"removeAll",b.zb);r.l(b,"destroy",b.fa);r.l(b,"destroyAll",b.ab);r.l(b,"indexOf",b.indexOf);r.l(b,"replace",b.replace);return b};
-r.Q.fn={remove:function(a){for(var b=this(),d=[],e="function"==typeof a?a:function(b){return b===a},f=0;f<b.length;f++){var h=b[f];e(h)&&(0===d.length&&this.H(),d.push(h),b.splice(f,1),f--)}d.length&&this.G();return d},zb:function(a){if(a===l){var b=this(),d=b.slice(0);this.H();b.splice(0,b.length);this.G();return d}return!a?[]:this.remove(function(b){return 0<=r.a.k(a,b)})},fa:function(a){var b=this(),d="function"==typeof a?a:function(b){return b===a};this.H();for(var e=b.length-1;0<=e;e--)d(b[e])&&
-(b[e]._destroy=m);this.G()},ab:function(a){return a===l?this.fa(function(){return m}):!a?[]:this.fa(function(b){return 0<=r.a.k(a,b)})},indexOf:function(a){var b=this();return r.a.k(b,a)},replace:function(a,b){var d=this.indexOf(a);0<=d&&(this.H(),this()[d]=b,this.G())}};r.a.n("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){r.Q.fn[a]=function(){var b=this();this.H();b=b[a].apply(b,arguments);this.G();return b}});
-r.a.n(["slice"],function(a){r.Q.fn[a]=function(){var b=this();return b[a].apply(b,arguments)}});r.b("ko.observableArray",r.Q);function C(a,b){a&&"object"==typeof a?b=a:(b=b||{},b.read=a||b.read);"function"!=typeof b.read&&c("Pass a function that returns the value of the dependentObservable");return b}
-r.i=function(a,b,d){function e(){r.a.n(q,function(a){a.v()});q=[]}function f(){var a=g.throttleEvaluation;a&&0<=a?(clearTimeout(v),v=setTimeout(h,a)):h()}function h(){if(j&&"function"==typeof d.disposeWhen&&d.disposeWhen())g.v();else{try{e();r.T.Xa(function(a){q.push(a.ra(f))});var a=d.read.call(d.owner||b);g.notifySubscribers(i,"beforeChange");i=a}finally{r.T.end()}g.notifySubscribers(i);j=m}}function g(){if(0<arguments.length)"function"===typeof d.write?d.write.apply(d.owner||b,arguments):c("Cannot write a value to a dependentObservable unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.");
-else return j||h(),r.T.Ha(g),i}var i,j=p,d=C(a,d),k="object"==typeof d.disposeWhenNodeIsRemoved?d.disposeWhenNodeIsRemoved:o,n=o;if(k){n=function(){g.v()};r.a.A.va(k,n);var t=d.disposeWhen;d.disposeWhen=function(){return!r.a.ga(k)||"function"==typeof t&&t()}}var q=[],v=o;g.jb=function(){return q.length};g.lb="function"===typeof d.write;g.v=function(){k&&r.a.A.Ia(k,n);e()};r.R.call(g);r.a.extend(g,r.i.fn);d.deferEvaluation!==m&&h();r.l(g,"dispose",g.v);r.l(g,"getDependenciesCount",g.jb);return g};
-r.i.fn={B:r.i};r.i.B=r.w;r.b("ko.dependentObservable",r.i);r.b("ko.computed",r.i);
-(function(){function a(e,f,h){h=h||new d;e=f(e);if(!("object"==typeof e&&e!==o&&e!==l&&!(e instanceof Date)))return e;var g=e instanceof Array?[]:{};h.save(e,g);b(e,function(b){var d=f(e[b]);switch(typeof d){case "boolean":case "number":case "string":case "function":g[b]=d;break;case "object":case "undefined":var k=h.get(d);g[b]=k!==l?k:a(d,f,h)}});return g}function b(a,b){if(a instanceof Array)for(var d=0;d<a.length;d++)b(d);else for(d in a)b(d)}function d(){var a=[],b=[];this.save=function(d,g){var i=
-r.a.k(a,d);0<=i?b[i]=g:(a.push(d),b.push(g))};this.get=function(d){d=r.a.k(a,d);return 0<=d?b[d]:l}}r.Pa=function(b){0==arguments.length&&c(Error("When calling ko.toJS, pass the object you want to convert."));return a(b,function(a){for(var b=0;r.V(a)&&10>b;b++)a=a();return a})};r.toJSON=function(a){a=r.Pa(a);return r.a.qa(a)}})();r.b("ko.toJS",r.Pa);r.b("ko.toJSON",r.toJSON);
-r.h={q:function(a){return"OPTION"==a.tagName?a.__ko__hasDomDataOptionValue__===m?r.a.e.get(a,r.c.options.la):a.getAttribute("value"):"SELECT"==a.tagName?0<=a.selectedIndex?r.h.q(a.options[a.selectedIndex]):l:a.value},S:function(a,b){if("OPTION"==a.tagName)switch(typeof b){case "string":r.a.e.set(a,r.c.options.la,l);"__ko__hasDomDataOptionValue__"in a&&delete a.__ko__hasDomDataOptionValue__;a.value=b;break;default:r.a.e.set(a,r.c.options.la,b),a.__ko__hasDomDataOptionValue__=m,a.value="number"===typeof b?
-b:""}else if("SELECT"==a.tagName)for(var d=a.options.length-1;0<=d;d--){if(r.h.q(a.options[d])==b){a.selectedIndex=d;break}}else{if(b===o||b===l)b="";a.value=b}}};r.b("ko.selectExtensions",r.h);r.b("ko.selectExtensions.readValue",r.h.q);r.b("ko.selectExtensions.writeValue",r.h.S);
-r.j=function(){function a(a,e){for(var d=o;a!=d;)d=a,a=a.replace(b,function(a,b){return e[b]});return a}var b=/\@ko_token_(\d+)\@/g,d=/^[\_$a-z][\_$a-z0-9]*(\[.*?\])*(\.[\_$a-z][\_$a-z0-9]*(\[.*?\])*)*$/i,e=["true","false"];return{D:[],Y:function(b){var e=r.a.z(b);if(3>e.length)return[];"{"===e.charAt(0)&&(e=e.substring(1,e.length-1));for(var b=[],d=o,i,j=0;j<e.length;j++){var k=e.charAt(j);if(d===o)switch(k){case '"':case "'":case "/":d=j,i=k}else if(k==i&&"\\"!==e.charAt(j-1)){k=e.substring(d,j+
-1);b.push(k);var n="@ko_token_"+(b.length-1)+"@",e=e.substring(0,d)+n+e.substring(j+1),j=j-(k.length-n.length),d=o}}i=d=o;for(var t=0,q=o,j=0;j<e.length;j++){k=e.charAt(j);if(d===o)switch(k){case "{":d=j;q=k;i="}";break;case "(":d=j;q=k;i=")";break;case "[":d=j,q=k,i="]"}k===q?t++:k===i&&(t--,0===t&&(k=e.substring(d,j+1),b.push(k),n="@ko_token_"+(b.length-1)+"@",e=e.substring(0,d)+n+e.substring(j+1),j-=k.length-n.length,d=o))}i=[];e=e.split(",");d=0;for(j=e.length;d<j;d++)t=e[d],q=t.indexOf(":"),
-0<q&&q<t.length-1?(k=t.substring(q+1),i.push({key:a(t.substring(0,q),b),value:a(k,b)})):i.push({unknown:a(t,b)});return i},ia:function(a){for(var b="string"===typeof a?r.j.Y(a):a,g=[],a=[],i,j=0;i=b[j];j++)if(0<g.length&&g.push(","),i.key){var k;a:{k=i.key;var n=r.a.z(k);switch(n.length&&n.charAt(0)){case "'":case '"':break a;default:k="'"+n+"'"}}i=i.value;g.push(k);g.push(":");g.push(i);n=r.a.z(i);if(0<=r.a.k(e,r.a.z(n).toLowerCase())?0:n.match(d)!==o)0<a.length&&a.push(", "),a.push(k+" : function(__ko_value) { "+
-i+" = __ko_value; }")}else i.unknown&&g.push(i.unknown);b=g.join("");0<a.length&&(b=b+", '_ko_property_writers' : { "+a.join("")+" } ");return b},rb:function(a,b){for(var e=0;e<a.length;e++)if(r.a.z(a[e].key)==b)return m;return p}}}();r.b("ko.jsonExpressionRewriting",r.j);r.b("ko.jsonExpressionRewriting.bindingRewriteValidators",r.j.D);r.b("ko.jsonExpressionRewriting.parseObjectLiteral",r.j.Y);r.b("ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson",r.j.ia);
-(function(){function a(a){return 8==a.nodeType&&(f?a.text:a.nodeValue).match(h)}function b(a){return 8==a.nodeType&&(f?a.text:a.nodeValue).match(g)}function d(e,d){for(var f=e,g=1,h=[];f=f.nextSibling;){if(b(f)&&(g--,0===g))return h;h.push(f);a(f)&&g++}d||c(Error("Cannot find closing comment tag to match: "+e.nodeValue));return o}function e(a,b){var e=d(a,b);return e?0<e.length?e[e.length-1].nextSibling:a.nextSibling:o}var f="<\!--test--\>"===document.createComment("test").text,h=f?/^<\!--\s*ko\s+(.*\:.*)\s*--\>$/:
-/^\s*ko\s+(.*\:.*)\s*$/,g=f?/^<\!--\s*\/ko\s*--\>$/:/^\s*\/ko\s*$/,i={ul:m,ol:m};r.f={C:{},childNodes:function(b){return a(b)?d(b):b.childNodes},ha:function(b){if(a(b))for(var b=r.f.childNodes(b),e=0,d=b.length;e<d;e++)r.removeNode(b[e]);else r.a.U(b)},oa:function(b,e){if(a(b)){r.f.ha(b);for(var d=b.nextSibling,f=0,g=e.length;f<g;f++)d.parentNode.insertBefore(e[f],d)}else r.a.oa(b,e)},xb:function(b,e){a(b)?b.parentNode.insertBefore(e,b.nextSibling):b.firstChild?b.insertBefore(e,b.firstChild):b.appendChild(e)},
-mb:function(b,e,d){a(b)?b.parentNode.insertBefore(e,d.nextSibling):d.nextSibling?b.insertBefore(e,d.nextSibling):b.appendChild(e)},nextSibling:function(d){return a(d)?e(d).nextSibling:d.nextSibling&&b(d.nextSibling)?l:d.nextSibling},ta:function(b){return(b=a(b))?b[1]:o},ib:function(a){if(r.f.ta(a)){var b;b=r.f.childNodes(a);for(var e=[],d=0,f=b.length;d<f;d++)r.a.A.F(b[d]),e.push(r.a.outerHTML(b[d]));b=String.prototype.concat.apply("",e);r.f.ha(a);(new r.m.I(a)).text(b)}},Fa:function(d){if(i[d.tagName.toLowerCase()]){var f=
-d.firstChild;if(f){do if(1===f.nodeType){var g;g=f.firstChild;var h=o;if(g){do if(h)h.push(g);else if(a(g)){var q=e(g,m);q?g=q:h=[g]}else b(g)&&(h=[g]);while(g=g.nextSibling)}if(g=h){h=f.nextSibling;for(q=0;q<g.length;q++)h?d.insertBefore(g[q],h):d.appendChild(g[q])}}while(f=f.nextSibling)}}}}})();r.L=function(){};
-r.a.extend(r.L.prototype,{nodeHasBindings:function(a){switch(a.nodeType){case 1:return a.getAttribute("data-bind")!=o;case 8:return r.f.ta(a)!=o;default:return p}},getBindings:function(a,b){var d=this.getBindingsString(a,b);return d?this.parseBindingsString(d,b):o},getBindingsString:function(a){switch(a.nodeType){case 1:return a.getAttribute("data-bind");case 8:return r.f.ta(a);default:return o}},parseBindingsString:function(a,b){try{var d=b.$data,e=" { "+r.j.ia(a)+" } ";return r.a.hb(e,d===o?window:
-d,b)}catch(f){c(Error("Unable to parse bindings.\nMessage: "+f+";\nBindings value: "+a))}}});r.L.instance=new r.L;r.b("ko.bindingProvider",r.L);
-(function(){function a(a,d){for(var h,g=d.childNodes[0];h=g;)g=r.f.nextSibling(h),b(a,h,p)}function b(b,f,h){var g=m,i=1==f.nodeType;i&&r.f.Fa(f);if(i&&h||r.L.instance.nodeHasBindings(f))g=d(f,o,b,h).Bb;i&&g&&a(b,f)}function d(a,b,d,g){function i(a){return function(){return n[a]}}function j(){return n}var k=0;r.f.ib(a);var n,t;new r.i(function(){var q=d&&d instanceof r.K?d:new r.K(r.a.d(d)),v=q.$data;g&&r.Na(a,q);if(n=("function"==typeof b?b():b)||r.L.instance.getBindings(a,q)){if(0===k){k=1;for(var s in n){var w=
-r.c[s];w&&8===a.nodeType&&!r.f.C[s]&&c(Error("The binding '"+s+"' cannot be used with virtual elements"));if(w&&"function"==typeof w.init&&(w=(0,w.init)(a,i(s),j,v,q))&&w.controlsDescendantBindings)t!==l&&c(Error("Multiple bindings ("+t+" and "+s+") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.")),t=s}k=2}if(2===k)for(s in n)(w=r.c[s])&&"function"==typeof w.update&&(0,w.update)(a,i(s),j,v,q)}},o,{disposeWhenNodeIsRemoved:a});
-return{Bb:t===l}}r.c={};r.K=function(a,b){this.$data=a;b?(this.$parent=b.$data,this.$parents=(b.$parents||[]).slice(0),this.$parents.unshift(this.$parent),this.$root=b.$root):(this.$parents=[],this.$root=a)};r.K.prototype.createChildContext=function(a){return new r.K(a,this)};r.Na=function(a,b){if(2==arguments.length)r.a.e.set(a,"__ko_bindingContext__",b);else return r.a.e.get(a,"__ko_bindingContext__")};r.xa=function(a,b,h){1===a.nodeType&&r.f.Fa(a);return d(a,b,h,m)};r.Ta=function(b,d){1===d.nodeType&&
-a(b,d)};r.wa=function(a,d){d&&1!==d.nodeType&&8!==d.nodeType&&c(Error("ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node"));d=d||window.document.body;b(a,d,m)};r.ea=function(a){switch(a.nodeType){case 1:case 8:var b=r.Na(a);if(b)return b;if(a.parentNode)return r.ea(a.parentNode)}};r.$a=function(a){return(a=r.ea(a))?a.$data:l};r.b("ko.bindingHandlers",r.c);r.b("ko.applyBindings",r.wa);r.b("ko.applyBindingsToDescendants",r.Ta);r.b("ko.applyBindingsToNode",
-r.xa);r.b("ko.contextFor",r.ea);r.b("ko.dataFor",r.$a)})();r.a.n(["click"],function(a){r.c[a]={init:function(b,d,e,f){return r.c.event.init.call(this,b,function(){var b={};b[a]=d();return b},e,f)}}});
-r.c.event={init:function(a,b,d,e){var f=b()||{},h;for(h in f)(function(){var f=h;"string"==typeof f&&r.a.s(a,f,function(a){var h,k=b()[f];if(k){var n=d();try{var t=r.a.X(arguments);t.unshift(e);h=k.apply(e,t)}finally{if(h!==m)a.preventDefault?a.preventDefault():a.returnValue=p}if(n[f+"Bubble"]===p)a.cancelBubble=m,a.stopPropagation&&a.stopPropagation()}})})()}};
-r.c.submit={init:function(a,b,d,e){"function"!=typeof b()&&c(Error("The value for a submit binding must be a function"));r.a.s(a,"submit",function(d){var h,g=b();try{h=g.call(e,a)}finally{if(h!==m)d.preventDefault?d.preventDefault():d.returnValue=p}})}};r.c.visible={update:function(a,b){var d=r.a.d(b()),e="none"!=a.style.display;if(d&&!e)a.style.display="";else if(!d&&e)a.style.display="none"}};
-r.c.enable={update:function(a,b){var d=r.a.d(b());if(d&&a.disabled)a.removeAttribute("disabled");else if(!d&&!a.disabled)a.disabled=m}};r.c.disable={update:function(a,b){r.c.enable.update(a,function(){return!r.a.d(b())})}};function D(a,b,d){d&&b!==r.h.q(a)&&r.h.S(a,b);b!==r.h.q(a)&&r.a.sa(a,"change")}
-r.c.value={init:function(a,b,d){var e=["change"],f=d().valueUpdate;f&&("string"==typeof f&&(f=[f]),r.a.J(e,f),e=r.a.ya(e));r.a.n(e,function(e){var f=p;r.a.Cb(e,"after")&&(f=m,e=e.substring(5));var i=f?function(a){setTimeout(a,0)}:function(a){a()};r.a.s(a,e,function(){i(function(){var e=b(),f=r.h.q(a);r.P(e)?e(f):(e=d(),e._ko_property_writers&&e._ko_property_writers.value&&e._ko_property_writers.value(f))})})})},update:function(a,b){var d=r.a.d(b()),e=r.h.q(a),f=d!=e;0===d&&0!==e&&"0"!==e&&(f=m);f&&
-(e=function(){r.h.S(a,d)},e(),"SELECT"==a.tagName&&setTimeout(e,0));"SELECT"==a.tagName&&0<a.length&&D(a,d,p)}};
-r.c.options={update:function(a,b,d){"SELECT"!=a.tagName&&c(Error("options binding applies only to SELECT elements"));var e=0==a.length,f=r.a.ba(r.a.aa(a.childNodes,function(a){return a.tagName&&"OPTION"==a.tagName&&a.selected}),function(a){return r.h.q(a)||a.innerText||a.textContent}),h=a.scrollTop;a.scrollTop=0;for(var g=r.a.d(b());0<a.length;)r.F(a.options[0]),a.remove(0);if(g){d=d();"number"!=typeof g.length&&(g=[g]);if(d.optionsCaption){var i=document.createElement("OPTION");r.a.Z(i,d.optionsCaption);
-r.h.S(i,l);a.appendChild(i)}for(var b=0,j=g.length;b<j;b++){var i=document.createElement("OPTION"),k="string"==typeof d.optionsValue?g[b][d.optionsValue]:g[b],k=r.a.d(k);r.h.S(i,k);var n=d.optionsText,k="function"==typeof n?n(g[b]):"string"==typeof n?g[b][n]:k;if(k===o||k===l)k="";r.a.Ma(i,k);a.appendChild(i)}g=a.getElementsByTagName("OPTION");b=i=0;for(j=g.length;b<j;b++)0<=r.a.k(f,r.h.q(g[b]))&&(r.a.La(g[b],m),i++);if(h)a.scrollTop=h;e&&"value"in d&&D(a,r.a.d(d.value),m)}}};r.c.options.la="__ko.optionValueDomData__";
-r.c.selectedOptions={Da:function(a){for(var b=[],a=a.childNodes,d=0,e=a.length;d<e;d++){var f=a[d];"OPTION"==f.tagName&&f.selected&&b.push(r.h.q(f))}return b},init:function(a,b,d){r.a.s(a,"change",function(){var a=b();r.P(a)?a(r.c.selectedOptions.Da(this)):(a=d(),a._ko_property_writers&&a._ko_property_writers.value&&a._ko_property_writers.value(r.c.selectedOptions.Da(this)))})},update:function(a,b){"SELECT"!=a.tagName&&c(Error("values binding applies only to SELECT elements"));var d=r.a.d(b());if(d&&
-"number"==typeof d.length)for(var e=a.childNodes,f=0,h=e.length;f<h;f++){var g=e[f];"OPTION"==g.tagName&&r.a.La(g,0<=r.a.k(d,r.h.q(g)))}}};r.c.text={update:function(a,b){r.a.Ma(a,b())}};r.c.html={init:function(){return{controlsDescendantBindings:m}},update:function(a,b){var d=r.a.d(b());r.a.Z(a,d)}};r.c.css={update:function(a,b){var d=r.a.d(b()||{}),e;for(e in d)if("string"==typeof e){var f=r.a.d(d[e]);r.a.Qa(a,e,f)}}};
-r.c.style={update:function(a,b){var d=r.a.d(b()||{}),e;for(e in d)if("string"==typeof e){var f=r.a.d(d[e]);a.style[e]=f||""}}};r.c.uniqueName={init:function(a,b){if(b())a.name="ko_unique_"+ ++r.c.uniqueName.Za,(r.a.ob||r.a.pb)&&a.mergeAttributes(document.createElement("<input name='"+a.name+"'/>"),p)}};r.c.uniqueName.Za=0;
-r.c.checked={init:function(a,b,d){r.a.s(a,"click",function(){var e;if("checkbox"==a.type)e=a.checked;else if("radio"==a.type&&a.checked)e=a.value;else return;var f=b();"checkbox"==a.type&&r.a.d(f)instanceof Array?(e=r.a.k(r.a.d(f),a.value),a.checked&&0>e?f.push(a.value):!a.checked&&0<=e&&f.splice(e,1)):r.P(f)?f()!==e&&f(e):(f=d(),f._ko_property_writers&&f._ko_property_writers.checked&&f._ko_property_writers.checked(e))});"radio"==a.type&&!a.name&&r.c.uniqueName.init(a,function(){return m})},update:function(a,
-b){var d=r.a.d(b());if("checkbox"==a.type)a.checked=d instanceof Array?0<=r.a.k(d,a.value):d;else if("radio"==a.type)a.checked=a.value==d}};r.c.attr={update:function(a,b){var d=r.a.d(b())||{},e;for(e in d)if("string"==typeof e){var f=r.a.d(d[e]);f===p||f===o||f===l?a.removeAttribute(e):a.setAttribute(e,f.toString())}}};
-r.c.hasfocus={init:function(a,b,d){function e(a){var e=b();a!=r.a.d(e)&&(r.P(e)?e(a):(e=d(),e._ko_property_writers&&e._ko_property_writers.hasfocus&&e._ko_property_writers.hasfocus(a)))}r.a.s(a,"focus",function(){e(m)});r.a.s(a,"focusin",function(){e(m)});r.a.s(a,"blur",function(){e(p)});r.a.s(a,"focusout",function(){e(p)})},update:function(a,b){var d=r.a.d(b());d?a.focus():a.blur();r.a.sa(a,d?"focusin":"focusout")}};
-r.c["with"]={o:function(a){return function(){var b=a();return{"if":b,data:b,templateEngine:r.p.M}}},init:function(a,b){return r.c.template.init(a,r.c["with"].o(b))},update:function(a,b,d,e,f){return r.c.template.update(a,r.c["with"].o(b),d,e,f)}};r.j.D["with"]=p;r.f.C["with"]=m;r.c["if"]={o:function(a){return function(){return{"if":a(),templateEngine:r.p.M}}},init:function(a,b){return r.c.template.init(a,r.c["if"].o(b))},update:function(a,b,d,e,f){return r.c.template.update(a,r.c["if"].o(b),d,e,f)}};
-r.j.D["if"]=p;r.f.C["if"]=m;r.c.ifnot={o:function(a){return function(){return{ifnot:a(),templateEngine:r.p.M}}},init:function(a,b){return r.c.template.init(a,r.c.ifnot.o(b))},update:function(a,b,d,e,f){return r.c.template.update(a,r.c.ifnot.o(b),d,e,f)}};r.j.D.ifnot=p;r.f.C.ifnot=m;
-r.c.foreach={o:function(a){return function(){var b=r.a.d(a());return!b||"number"==typeof b.length?{foreach:b,templateEngine:r.p.M}:{foreach:b.data,includeDestroyed:b.includeDestroyed,afterAdd:b.afterAdd,beforeRemove:b.beforeRemove,afterRender:b.afterRender,templateEngine:r.p.M}}},init:function(a,b){return r.c.template.init(a,r.c.foreach.o(b))},update:function(a,b,d,e,f){return r.c.template.update(a,r.c.foreach.o(b),d,e,f)}};r.j.D.foreach=p;r.f.C.foreach=m;r.b("ko.allowedVirtualElementBindings",r.f.C);
-r.t=function(){};r.t.prototype.renderTemplateSource=function(){c("Override renderTemplateSource")};r.t.prototype.createJavaScriptEvaluatorBlock=function(){c("Override createJavaScriptEvaluatorBlock")};r.t.prototype.makeTemplateSource=function(a){if("string"==typeof a){var b=document.getElementById(a);b||c(Error("Cannot find template with ID "+a));return new r.m.g(b)}if(1==a.nodeType||8==a.nodeType)return new r.m.I(a);c(Error("Unknown template type: "+a))};
-r.t.prototype.renderTemplate=function(a,b,d){return this.renderTemplateSource(this.makeTemplateSource(a),b,d)};r.t.prototype.isTemplateRewritten=function(a){return this.allowTemplateRewriting===p?m:this.W&&this.W[a]?m:this.makeTemplateSource(a).data("isRewritten")};r.t.prototype.rewriteTemplate=function(a,b){var d=this.makeTemplateSource(a),e=b(d.text());d.text(e);d.data("isRewritten",m);if("string"==typeof a)this.W=this.W||{},this.W[a]=m};r.b("ko.templateEngine",r.t);
-r.$=function(){function a(a,b,d){for(var a=r.j.Y(a),g=r.j.D,i=0;i<a.length;i++){var j=a[i].key;if(g.hasOwnProperty(j)){var k=g[j];"function"===typeof k?(j=k(a[i].value))&&c(Error(j)):k||c(Error("This template engine does not support the '"+j+"' binding within its templates"))}}a="ko.templateRewriting.applyMemoizedBindingsToNextSibling(function() { return (function() { return { "+r.j.ia(a)+" } })() })";return d.createJavaScriptEvaluatorBlock(a)+b}var b=/(<[a-z]+\d*(\s+(?!data-bind=)[a-z0-9\-]+(=(\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind=(["'])([\s\S]*?)\5/gi,
-d=/<\!--\s*ko\b\s*([\s\S]*?)\s*--\>/g;return{gb:function(a,b){b.isTemplateRewritten(a)||b.rewriteTemplate(a,function(a){return r.$.ub(a,b)})},ub:function(e,f){return e.replace(b,function(b,e,d,j,k,n,t){return a(t,e,f)}).replace(d,function(b,e){return a(e,"<\!-- ko --\>",f)})},Ua:function(a){return r.r.ka(function(b,d){b.nextSibling&&r.xa(b.nextSibling,a,d)})}}}();r.b("ko.templateRewriting",r.$);r.b("ko.templateRewriting.applyMemoizedBindingsToNextSibling",r.$.Ua);r.m={};r.m.g=function(a){this.g=a};
-r.m.g.prototype.text=function(){if(0==arguments.length)return"script"==this.g.tagName.toLowerCase()?this.g.text:this.g.innerHTML;var a=arguments[0];"script"==this.g.tagName.toLowerCase()?this.g.text=a:r.a.Z(this.g,a)};r.m.g.prototype.data=function(a){if(1===arguments.length)return r.a.e.get(this.g,"templateSourceData_"+a);r.a.e.set(this.g,"templateSourceData_"+a,arguments[1])};r.m.I=function(a){this.g=a};r.m.I.prototype=new r.m.g;
-r.m.I.prototype.text=function(){if(0==arguments.length)return r.a.e.get(this.g,"__ko_anon_template__");r.a.e.set(this.g,"__ko_anon_template__",arguments[0])};r.b("ko.templateSources",r.m);r.b("ko.templateSources.domElement",r.m.g);r.b("ko.templateSources.anonymousTemplate",r.m.I);
-(function(){function a(a,b,d){for(var g=0;node=a[g];g++)node.parentNode===b&&(1===node.nodeType||8===node.nodeType)&&d(node)}function b(a,b,h,g,i){var i=i||{},j=i.templateEngine||d;r.$.gb(h,j);h=j.renderTemplate(h,g,i);("number"!=typeof h.length||0<h.length&&"number"!=typeof h[0].nodeType)&&c("Template engine must return an array of DOM nodes");j=p;switch(b){case "replaceChildren":r.f.oa(a,h);j=m;break;case "replaceNode":r.a.Ja(a,h);j=m;break;case "ignoreTargetNode":break;default:c(Error("Unknown renderMode: "+
-b))}j&&(r.ua(h,g),i.afterRender&&i.afterRender(h,g.$data));return h}var d;r.pa=function(a){a!=l&&!(a instanceof r.t)&&c("templateEngine must inherit from ko.templateEngine");d=a};r.ua=function(b,d){var h=r.a.J([],b),g=0<b.length?b[0].parentNode:o;a(h,g,function(a){r.wa(d,a)});a(h,g,function(a){r.r.Sa(a,[d])})};r.na=function(a,f,h,g,i){h=h||{};(h.templateEngine||d)==l&&c("Set a template engine before calling renderTemplate");i=i||"replaceChildren";if(g){var j=g.nodeType?g:0<g.length?g[0]:o;return new r.i(function(){var d=
-f&&f instanceof r.K?f:new r.K(r.a.d(f)),n="function"==typeof a?a(d.$data):a,d=b(g,i,n,d,h);"replaceNode"==i&&(g=d,j=g.nodeType?g:0<g.length?g[0]:o)},o,{disposeWhen:function(){return!j||!r.a.ga(j)},disposeWhenNodeIsRemoved:j&&"replaceNode"==i?j.parentNode:j})}return r.r.ka(function(b){r.na(a,f,h,b,"replaceNode")})};r.Ab=function(a,d,h,g,i){function j(a,b){var d=k(a);r.ua(b,d);h.afterRender&&h.afterRender(b,d.$data)}function k(a){return i.createChildContext(r.a.d(a))}return new r.i(function(){var i=
-r.a.d(d)||[];"undefined"==typeof i.length&&(i=[i]);i=r.a.aa(i,function(a){return h.includeDestroyed||a===l||a===o||!r.a.d(a._destroy)});r.a.Ka(g,i,function(d){var f="function"==typeof a?a(d):a;return b(o,"ignoreTargetNode",f,k(d),h)},h,j)},o,{disposeWhenNodeIsRemoved:g})};r.c.template={init:function(a,b){var d=r.a.d(b());"string"!=typeof d&&!d.name&&1==a.nodeType&&((new r.m.I(a)).text(a.innerHTML),r.a.U(a));return{controlsDescendantBindings:m}},update:function(a,b,d,g,i){b=r.a.d(b());g=m;"string"==
-typeof b?d=b:(d=b.name,"if"in b&&(g=g&&r.a.d(b["if"])),"ifnot"in b&&(g=g&&!r.a.d(b.ifnot)));var j=o;"object"===typeof b&&"foreach"in b?j=r.Ab(d||a,g&&b.foreach||[],b,a,i):g?(i="object"==typeof b&&"data"in b?i.createChildContext(r.a.d(b.data)):i,j=r.na(d||a,i,b,a)):r.f.ha(a);i=j;(b=r.a.e.get(a,"__ko__templateSubscriptionDomDataKey__"))&&"function"==typeof b.v&&b.v();r.a.e.set(a,"__ko__templateSubscriptionDomDataKey__",i)}};r.j.D.template=function(a){a=r.j.Y(a);return 1==a.length&&a[0].unknown?o:r.j.rb(a,
-"name")?o:"This template engine does not support anonymous templates nested within its templates"};r.f.C.template=m})();r.b("ko.setTemplateEngine",r.pa);r.b("ko.renderTemplate",r.na);
-r.a.N=function(a,b,d){if(d===l)return r.a.N(a,b,1)||r.a.N(a,b,10)||r.a.N(a,b,Number.MAX_VALUE);for(var a=a||[],b=b||[],e=a,f=b,h=[],g=0;g<=f.length;g++)h[g]=[];for(var g=0,i=Math.min(e.length,d);g<=i;g++)h[0][g]=g;g=1;for(i=Math.min(f.length,d);g<=i;g++)h[g][0]=g;for(var i=e.length,j,k=f.length,g=1;g<=i;g++){j=Math.max(1,g-d);for(var n=Math.min(k,g+d);j<=n;j++)h[j][g]=e[g-1]===f[j-1]?h[j-1][g-1]:Math.min(h[j-1][g]===l?Number.MAX_VALUE:h[j-1][g]+1,h[j][g-1]===l?Number.MAX_VALUE:h[j][g-1]+1)}d=a.length;
-e=b.length;f=[];g=h[e][d];if(g===l)h=o;else{for(;0<d||0<e;){i=h[e][d];k=0<e?h[e-1][d]:g+1;n=0<d?h[e][d-1]:g+1;j=0<e&&0<d?h[e-1][d-1]:g+1;if(k===l||k<i-1)k=g+1;if(n===l||n<i-1)n=g+1;j<i-1&&(j=g+1);k<=n&&k<j?(f.push({status:"added",value:b[e-1]}),e--):(n<k&&n<j?f.push({status:"deleted",value:a[d-1]}):(f.push({status:"retained",value:a[d-1]}),e--),d--)}h=f.reverse()}return h};r.b("ko.utils.compareArrays",r.a.N);
-(function(){function a(a){if(2<a.length){for(var b=a[0],f=a[a.length-1],h=[b];b!==f;){b=b.nextSibling;if(!b)return;h.push(b)}Array.prototype.splice.apply(a,[0,a.length].concat(h))}}function b(b,e,f,h){var g=[],b=r.i(function(){var b=e(f)||[];0<g.length&&(a(g),r.a.Ja(g,b),h&&h(f,b));g.splice(0,g.length);r.a.J(g,b)},o,{disposeWhenNodeIsRemoved:b,disposeWhen:function(){return 0==g.length||!r.a.ga(g[0])}});return{sb:g,i:b}}r.a.Ka=function(d,e,f,h,g){for(var e=e||[],h=h||{},i=r.a.e.get(d,"setDomNodeChildrenFromArrayMapping_lastMappingResult")===
-l,j=r.a.e.get(d,"setDomNodeChildrenFromArrayMapping_lastMappingResult")||[],k=r.a.ba(j,function(a){return a.Va}),n=r.a.N(k,e),e=[],t=0,q=[],k=[],v=o,s=0,w=n.length;s<w;s++)switch(n[s].status){case "retained":var x=j[t];e.push(x);0<x.O.length&&(v=x.O[x.O.length-1]);t++;break;case "deleted":j[t].i.v();a(j[t].O);r.a.n(j[t].O,function(a){q.push({element:a,index:s,value:n[s].value});v=a});t++;break;case "added":var x=n[s].value,z=b(d,f,x,g),u=z.sb;e.push({Va:n[s].value,O:u,i:z.i});for(var z=0,y=u.length;z<
-y;z++){var A=u[z];k.push({element:A,index:s,value:n[s].value});v==o?r.f.xb(d,A):r.f.mb(d,A,v);v=A}g&&g(x,u)}r.a.n(q,function(a){r.F(a.element)});f=p;if(!i){if(h.afterAdd)for(s=0;s<k.length;s++)h.afterAdd(k[s].element,k[s].index,k[s].value);if(h.beforeRemove){for(s=0;s<q.length;s++)h.beforeRemove(q[s].element,q[s].index,q[s].value);f=m}}f||r.a.n(q,function(a){r.removeNode(a.element)});r.a.e.set(d,"setDomNodeChildrenFromArrayMapping_lastMappingResult",e)}})();
-r.b("ko.utils.setDomNodeChildrenFromArrayMapping",r.a.Ka);r.p=function(){this.allowTemplateRewriting=p};r.p.prototype=new r.t;r.p.prototype.renderTemplateSource=function(a){a=a.text();return r.a.ma(a)};r.p.M=new r.p;r.pa(r.p.M);r.b("ko.nativeTemplateEngine",r.p);
-(function(){r.ja=function(){var a=this.qb=function(){if("undefined"==typeof jQuery||!jQuery.tmpl)return 0;try{if(0<=jQuery.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(a){}return 1}();this.renderTemplateSource=function(d,e,f){f=f||{};2>a&&c(Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later."));var h=d.data("precompiled");h||(h=d.text()||"",h=jQuery.template(o,"{{ko_with $item.koBindingContext}}"+h+"{{/ko_with}}"),d.data("precompiled",h));
-d=[e.$data];e=jQuery.extend({koBindingContext:e},f.templateOptions);e=jQuery.tmpl(h,d,e);e.appendTo(document.createElement("div"));jQuery.fragments={};return e};this.createJavaScriptEvaluatorBlock=function(a){return"{{ko_code ((function() { return "+a+" })()) }}"};this.addTemplate=function(a,b){document.write("<script type='text/html' id='"+a+"'>"+b+"<\/script>")};if(0<a)jQuery.tmpl.tag.ko_code={open:"__.push($1 || '');"},jQuery.tmpl.tag.ko_with={open:"with($1) {",close:"} "}};r.ja.prototype=new r.t;
-var a=new r.ja;0<a.qb&&r.pa(a);r.b("ko.jqueryTmplTemplateEngine",r.ja)})();
-})(window);
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/main.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/main.py
deleted file mode 100644
index ed9af3eb50d..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/main.py
+++ /dev/null
@@ -1,249 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: ascii -*-
-r"""
-=================================
- Benchmark jsmin implementations
-=================================
-
-Benchmark jsmin implementations.
-
-:Copyright:
-
- Copyright 2011 - 2014
- Andr\xe9 Malo or his licensors, as applicable
-
-:License:
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-Usage::
-
- python -mbench.main [-c COUNT] [-p file] jsfile ...
-
- -c COUNT number of runs per jsfile and minifier. Defaults to 10.
- -p file File to write the benchmark results in (pickled)
-
-"""
-if __doc__:
- __doc__ = __doc__.encode('ascii').decode('unicode_escape')
-__author__ = r"Andr\xe9 Malo".encode('ascii').decode('unicode_escape')
-__docformat__ = "restructuredtext en"
-__license__ = "Apache License, Version 2.0"
-__version__ = "1.0.0"
-
-import sys as _sys
-import time as _time
-
-import_notes = []
-class jsmins(object):
- from bench import jsmin as p_01_simple_port
- if _sys.version_info >= (2, 4):
- from bench import jsmin_2_0_9 as p_02_jsmin_2_0_9
- else:
- import_notes.append(
- "jsmin_2_0_9 available for python 2.4 and later..."
- )
- print(import_notes[-1])
- try:
- import slimit as _slimit_0_8_1
- except (ImportError, SyntaxError):
- import_notes.append("slimit_0_8_1 could not be imported")
- print(import_notes[-1])
- else:
- class p_03_slimit_0_8_1(object):
- pass
- p_03_slimit_0_8_1 = p_03_slimit_0_8_1()
- p_03_slimit_0_8_1.jsmin = _slimit_0_8_1.minify
- class p_04_slimit_0_8_1_mangle(object):
- pass
- p_04_slimit_0_8_1_mangle = p_04_slimit_0_8_1_mangle()
- p_04_slimit_0_8_1_mangle.jsmin = \
- lambda x, s=_slimit_0_8_1: s.minify(x, True)
-
- import rjsmin as p_05_rjsmin
- try:
- import _rjsmin as p_06__rjsmin
- except ImportError:
- import_notes.append("_rjsmin (C-Port) not available")
- print(import_notes[-1])
-jsmins.p_05_rjsmin.jsmin = jsmins.p_05_rjsmin._make_jsmin(
- python_only=True
-)
-print("Python Release: %s" % ".".join(map(str, _sys.version_info[:3])))
-print("")
-
-
-def slurp(filename):
- """ Load a file """
- fp = open(filename)
- try:
- return fp.read()
- finally:
- fp.close()
-
-
-def print_(*value, **kwargs):
- """ Print stuff """
- (kwargs.get('file') or _sys.stdout).write(
- ''.join(value) + kwargs.get('end', '\n')
- )
-
-
-def bench(filenames, count):
- """
- Benchmark the minifiers with given javascript samples
-
- :Parameters:
- `filenames` : sequence
- List of filenames
-
- `count` : ``int``
- Number of runs per js file and minifier
-
- :Exceptions:
- - `RuntimeError` : empty filenames sequence
- """
- if not filenames:
- raise RuntimeError("Missing files to benchmark")
- try:
- xrange
- except NameError:
- xrange = range
- try:
- cmp
- except NameError:
- cmp = lambda a, b: (a > b) - (a < b)
-
- ports = [item for item in dir(jsmins) if item.startswith('p_')]
- ports.sort()
- space = max(map(len, ports)) - 4
- ports = [(item[5:], getattr(jsmins, item).jsmin) for item in ports]
- flush = _sys.stdout.flush
-
- struct = []
- inputs = [(filename, slurp(filename)) for filename in filenames]
- for filename, script in inputs:
- print_("Benchmarking %r..." % filename, end=" ")
- flush()
- outputs = []
- for _, jsmin in ports:
- try:
- outputs.append(jsmin(script))
- except (SystemExit, KeyboardInterrupt):
- raise
- except:
- outputs.append(None)
- struct.append(dict(
- filename=filename,
- sizes=[
- (item is not None and len(item) or None) for item in outputs
- ],
- size=len(script),
- messages=[],
- times=[],
- ))
- print_("(%.1f KiB)" % (struct[-1]['size'] / 1024.0,))
- flush()
- times = []
- for idx, (name, jsmin) in enumerate(ports):
- if outputs[idx] is None:
- print_(" FAILED %s" % (name,))
- struct[-1]['times'].append((name, None))
- else:
- print_(" Timing %s%s... (%5.1f KiB %s)" % (
- name,
- " " * (space - len(name)),
- len(outputs[idx]) / 1024.0,
- idx == 0 and '*' or ['=', '>', '<'][
- cmp(len(outputs[idx]), len(outputs[0]))
- ],
- ), end=" ")
- flush()
-
- xcount = count
- while True:
- counted = [None for _ in xrange(xcount)]
- start = _time.time()
- for _ in counted:
- jsmin(script)
- end = _time.time()
- result = (end - start) * 1000
- if result < 10: # avoid measuring within the error range
- xcount *= 10
- continue
- times.append(result / xcount)
- break
-
- print_("%8.2f ms" % times[-1], end=" ")
- flush()
- if len(times) <= 1:
- print_()
- else:
- print_("(factor: %s)" % (', '.join([
- '%.2f' % (timed / times[-1]) for timed in times[:-1]
- ])))
- struct[-1]['times'].append((name, times[-1]))
-
- flush()
- print_()
-
- return struct
-
-
-def main(argv=None):
- """ Main """
- import getopt as _getopt
- import os as _os
- import pickle as _pickle
-
- if argv is None:
- argv = _sys.argv[1:]
- try:
- opts, args = _getopt.getopt(argv, "hc:p:", ["help"])
- except getopt.GetoptError:
- e = _sys.exc_info()[0](_sys.exc_info()[1])
- print >> _sys.stderr, "%s\nTry %s -mbench.main --help" % (
- e,
- _os.path.basename(_sys.executable),
- )
- _sys.exit(2)
-
- count, pickle = 10, None
- for key, value in opts:
- if key in ("-h", "--help"):
- print >> _sys.stderr, (
- "%s -mbench.main [-c count] [-p file] cssfile ..." % (
- _os.path.basename(_sys.executable),
- )
- )
- _sys.exit(0)
- elif key == '-c':
- count = int(value)
- elif key == '-p':
- pickle = str(value)
-
- struct = bench(args, count)
- if pickle:
- fp = open(pickle, 'wb')
- try:
- fp.write(_pickle.dumps((
- ".".join(map(str, _sys.version_info[:3])),
- import_notes,
- struct,
- ), 0))
- finally:
- fp.close()
-
-
-if __name__ == '__main__':
- main()
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/markermanager.js b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/markermanager.js
deleted file mode 100644
index 10066507512..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/markermanager.js
+++ /dev/null
@@ -1,976 +0,0 @@
-/**
- * @name MarkerManager v3
- * @version 1.0
- * @copyright (c) 2007 Google Inc.
- * @author Doug Ricket, Bjorn Brala (port to v3), others,
- *
- * @fileoverview Marker manager is an interface between the map and the user,
- * designed to manage adding and removing many points when the viewport changes.
- * <br /><br />
- * <b>How it Works</b>:<br/>
- * The MarkerManager places its markers onto a grid, similar to the map tiles.
- * When the user moves the viewport, it computes which grid cells have
- * entered or left the viewport, and shows or hides all the markers in those
- * cells.
- * (If the users scrolls the viewport beyond the markers that are loaded,
- * no markers will be visible until the <code>EVENT_moveend</code>
- * triggers an update.)
- * In practical consequences, this allows 10,000 markers to be distributed over
- * a large area, and as long as only 100-200 are visible in any given viewport,
- * the user will see good performance corresponding to the 100 visible markers,
- * rather than poor performance corresponding to the total 10,000 markers.
- * Note that some code is optimized for speed over space,
- * with the goal of accommodating thousands of markers.
- */
-
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @name MarkerManagerOptions
- * @class This class represents optional arguments to the {@link MarkerManager}
- * constructor.
- * @property {Number} maxZoom Sets the maximum zoom level monitored by a
- * marker manager. If not given, the manager assumes the maximum map zoom
- * level. This value is also used when markers are added to the manager
- * without the optional {@link maxZoom} parameter.
- * @property {Number} borderPadding Specifies, in pixels, the extra padding
- * outside the map's current viewport monitored by a manager. Markers that
- * fall within this padding are added to the map, even if they are not fully
- * visible.
- * @property {Boolean} trackMarkers=false Indicates whether or not a marker
- * manager should track markers' movements. If you wish to move managed
- * markers using the {@link setPoint}/{@link setLatLng} methods,
- * this option should be set to {@link true}.
- */
-
-/**
- * Creates a new MarkerManager that will show/hide markers on a map.
- *
- * Events:
- * @event changed (Parameters: shown bounds, shown markers) Notify listeners when the state of what is displayed changes.
- * @event loaded MarkerManager has succesfully been initialized.
- *
- * @constructor
- * @param {Map} map The map to manage.
- * @param {Object} opt_opts A container for optional arguments:
- * {Number} maxZoom The maximum zoom level for which to create tiles.
- * {Number} borderPadding The width in pixels beyond the map border,
- * where markers should be display.
- * {Boolean} trackMarkers Whether or not this manager should track marker
- * movements.
- */
-function MarkerManager(map, opt_opts) {
- var me = this;
- me.map_ = map;
- me.mapZoom_ = map.getZoom();
-
- me.projectionHelper_ = new ProjectionHelperOverlay(map);
- google.maps.event.addListener(me.projectionHelper_, 'ready', function () {
- me.projection_ = this.getProjection();
- me.initialize(map, opt_opts);
- });
-}
-
-
-MarkerManager.prototype.initialize = function (map, opt_opts) {
- var me = this;
-
- opt_opts = opt_opts || {};
- me.tileSize_ = MarkerManager.DEFAULT_TILE_SIZE_;
-
- var mapTypes = map.mapTypes;
-
- // Find max zoom level
- var mapMaxZoom = 1;
- for (var sType in mapTypes ) {
- if (typeof map.mapTypes.get(sType) === 'object' && typeof map.mapTypes.get(sType).maxZoom === 'number') {
- var mapTypeMaxZoom = map.mapTypes.get(sType).maxZoom;
- if (mapTypeMaxZoom > mapMaxZoom) {
- mapMaxZoom = mapTypeMaxZoom;
- }
- }
- }
-
- me.maxZoom_ = opt_opts.maxZoom || 19;
-
- me.trackMarkers_ = opt_opts.trackMarkers;
- me.show_ = opt_opts.show || true;
-
- var padding;
- if (typeof opt_opts.borderPadding === 'number') {
- padding = opt_opts.borderPadding;
- } else {
- padding = MarkerManager.DEFAULT_BORDER_PADDING_;
- }
- // The padding in pixels beyond the viewport, where we will pre-load markers.
- me.swPadding_ = new google.maps.Size(-padding, padding);
- me.nePadding_ = new google.maps.Size(padding, -padding);
- me.borderPadding_ = padding;
-
- me.gridWidth_ = {};
-
- me.grid_ = {};
- me.grid_[me.maxZoom_] = {};
- me.numMarkers_ = {};
- me.numMarkers_[me.maxZoom_] = 0;
-
-
- google.maps.event.addListener(map, 'dragend', function () {
- me.onMapMoveEnd_();
- });
- google.maps.event.addListener(map, 'zoom_changed', function () {
- me.onMapMoveEnd_();
- });
-
-
-
- /**
- * This closure provide easy access to the map.
- * They are used as callbacks, not as methods.
- * @param GMarker marker Marker to be removed from the map
- * @private
- */
- me.removeOverlay_ = function (marker) {
- marker.setMap(null);
- me.shownMarkers_--;
- };
-
- /**
- * This closure provide easy access to the map.
- * They are used as callbacks, not as methods.
- * @param GMarker marker Marker to be added to the map
- * @private
- */
- me.addOverlay_ = function (marker) {
- if (me.show_) {
- marker.setMap(me.map_);
- me.shownMarkers_++;
- }
- };
-
- me.resetManager_();
- me.shownMarkers_ = 0;
-
- me.shownBounds_ = me.getMapGridBounds_();
-
- google.maps.event.trigger(me, 'loaded');
-
-};
-
-/**
- * Default tile size used for deviding the map into a grid.
- */
-MarkerManager.DEFAULT_TILE_SIZE_ = 1024;
-
-/*
- * How much extra space to show around the map border so
- * dragging doesn't result in an empty place.
- */
-MarkerManager.DEFAULT_BORDER_PADDING_ = 100;
-
-/**
- * Default tilesize of single tile world.
- */
-MarkerManager.MERCATOR_ZOOM_LEVEL_ZERO_RANGE = 256;
-
-
-/**
- * Initializes MarkerManager arrays for all zoom levels
- * Called by constructor and by clearAllMarkers
- */
-MarkerManager.prototype.resetManager_ = function () {
- var mapWidth = MarkerManager.MERCATOR_ZOOM_LEVEL_ZERO_RANGE;
- for (var zoom = 0; zoom <= this.maxZoom_; ++zoom) {
- this.grid_[zoom] = {};
- this.numMarkers_[zoom] = 0;
- this.gridWidth_[zoom] = Math.ceil(mapWidth / this.tileSize_);
- mapWidth <<= 1;
- }
-
-};
-
-/**
- * Removes all markers in the manager, and
- * removes any visible markers from the map.
- */
-MarkerManager.prototype.clearMarkers = function () {
- this.processAll_(this.shownBounds_, this.removeOverlay_);
- this.resetManager_();
-};
-
-
-/**
- * Gets the tile coordinate for a given latlng point.
- *
- * @param {LatLng} latlng The geographical point.
- * @param {Number} zoom The zoom level.
- * @param {google.maps.Size} padding The padding used to shift the pixel coordinate.
- * Used for expanding a bounds to include an extra padding
- * of pixels surrounding the bounds.
- * @return {GPoint} The point in tile coordinates.
- *
- */
-MarkerManager.prototype.getTilePoint_ = function (latlng, zoom, padding) {
-
- var pixelPoint = this.projectionHelper_.LatLngToPixel(latlng, zoom);
-
- var point = new google.maps.Point(
- Math.floor((pixelPoint.x + padding.width) / this.tileSize_),
- Math.floor((pixelPoint.y + padding.height) / this.tileSize_)
- );
-
- return point;
-};
-
-
-/**
- * Finds the appropriate place to add the marker to the grid.
- * Optimized for speed; does not actually add the marker to the map.
- * Designed for batch-processing thousands of markers.
- *
- * @param {Marker} marker The marker to add.
- * @param {Number} minZoom The minimum zoom for displaying the marker.
- * @param {Number} maxZoom The maximum zoom for displaying the marker.
- */
-MarkerManager.prototype.addMarkerBatch_ = function (marker, minZoom, maxZoom) {
- var me = this;
-
- var mPoint = marker.getPosition();
- marker.MarkerManager_minZoom = minZoom;
-
-
- // Tracking markers is expensive, so we do this only if the
- // user explicitly requested it when creating marker manager.
- if (this.trackMarkers_) {
- google.maps.event.addListener(marker, 'changed', function (a, b, c) {
- me.onMarkerMoved_(a, b, c);
- });
- }
-
- var gridPoint = this.getTilePoint_(mPoint, maxZoom, new google.maps.Size(0, 0, 0, 0));
-
- for (var zoom = maxZoom; zoom >= minZoom; zoom--) {
- var cell = this.getGridCellCreate_(gridPoint.x, gridPoint.y, zoom);
- cell.push(marker);
-
- gridPoint.x = gridPoint.x >> 1;
- gridPoint.y = gridPoint.y >> 1;
- }
-};
-
-
-/**
- * Returns whether or not the given point is visible in the shown bounds. This
- * is a helper method that takes care of the corner case, when shownBounds have
- * negative minX value.
- *
- * @param {Point} point a point on a grid.
- * @return {Boolean} Whether or not the given point is visible in the currently
- * shown bounds.
- */
-MarkerManager.prototype.isGridPointVisible_ = function (point) {
- var vertical = this.shownBounds_.minY <= point.y &&
- point.y <= this.shownBounds_.maxY;
- var minX = this.shownBounds_.minX;
- var horizontal = minX <= point.x && point.x <= this.shownBounds_.maxX;
- if (!horizontal && minX < 0) {
- // Shifts the negative part of the rectangle. As point.x is always less
- // than grid width, only test shifted minX .. 0 part of the shown bounds.
- var width = this.gridWidth_[this.shownBounds_.z];
- horizontal = minX + width <= point.x && point.x <= width - 1;
- }
- return vertical && horizontal;
-};
-
-
-/**
- * Reacts to a notification from a marker that it has moved to a new location.
- * It scans the grid all all zoom levels and moves the marker from the old grid
- * location to a new grid location.
- *
- * @param {Marker} marker The marker that moved.
- * @param {LatLng} oldPoint The old position of the marker.
- * @param {LatLng} newPoint The new position of the marker.
- */
-MarkerManager.prototype.onMarkerMoved_ = function (marker, oldPoint, newPoint) {
- // NOTE: We do not know the minimum or maximum zoom the marker was
- // added at, so we start at the absolute maximum. Whenever we successfully
- // remove a marker at a given zoom, we add it at the new grid coordinates.
- var zoom = this.maxZoom_;
- var changed = false;
- var oldGrid = this.getTilePoint_(oldPoint, zoom, new google.maps.Size(0, 0, 0, 0));
- var newGrid = this.getTilePoint_(newPoint, zoom, new google.maps.Size(0, 0, 0, 0));
- while (zoom >= 0 && (oldGrid.x !== newGrid.x || oldGrid.y !== newGrid.y)) {
- var cell = this.getGridCellNoCreate_(oldGrid.x, oldGrid.y, zoom);
- if (cell) {
- if (this.removeFromArray_(cell, marker)) {
- this.getGridCellCreate_(newGrid.x, newGrid.y, zoom).push(marker);
- }
- }
- // For the current zoom we also need to update the map. Markers that no
- // longer are visible are removed from the map. Markers that moved into
- // the shown bounds are added to the map. This also lets us keep the count
- // of visible markers up to date.
- if (zoom === this.mapZoom_) {
- if (this.isGridPointVisible_(oldGrid)) {
- if (!this.isGridPointVisible_(newGrid)) {
- this.removeOverlay_(marker);
- changed = true;
- }
- } else {
- if (this.isGridPointVisible_(newGrid)) {
- this.addOverlay_(marker);
- changed = true;
- }
- }
- }
- oldGrid.x = oldGrid.x >> 1;
- oldGrid.y = oldGrid.y >> 1;
- newGrid.x = newGrid.x >> 1;
- newGrid.y = newGrid.y >> 1;
- --zoom;
- }
- if (changed) {
- this.notifyListeners_();
- }
-};
-
-
-/**
- * Removes marker from the manager and from the map
- * (if it's currently visible).
- * @param {GMarker} marker The marker to delete.
- */
-MarkerManager.prototype.removeMarker = function (marker) {
- var zoom = this.maxZoom_;
- var changed = false;
- var point = marker.getPosition();
- var grid = this.getTilePoint_(point, zoom, new google.maps.Size(0, 0, 0, 0));
- while (zoom >= 0) {
- var cell = this.getGridCellNoCreate_(grid.x, grid.y, zoom);
-
- if (cell) {
- this.removeFromArray_(cell, marker);
- }
- // For the current zoom we also need to update the map. Markers that no
- // longer are visible are removed from the map. This also lets us keep the count
- // of visible markers up to date.
- if (zoom === this.mapZoom_) {
- if (this.isGridPointVisible_(grid)) {
- this.removeOverlay_(marker);
- changed = true;
- }
- }
- grid.x = grid.x >> 1;
- grid.y = grid.y >> 1;
- --zoom;
- }
- if (changed) {
- this.notifyListeners_();
- }
- this.numMarkers_[marker.MarkerManager_minZoom]--;
-};
-
-
-/**
- * Add many markers at once.
- * Does not actually update the map, just the internal grid.
- *
- * @param {Array of Marker} markers The markers to add.
- * @param {Number} minZoom The minimum zoom level to display the markers.
- * @param {Number} opt_maxZoom The maximum zoom level to display the markers.
- */
-MarkerManager.prototype.addMarkers = function (markers, minZoom, opt_maxZoom) {
- var maxZoom = this.getOptMaxZoom_(opt_maxZoom);
- for (var i = markers.length - 1; i >= 0; i--) {
- this.addMarkerBatch_(markers[i], minZoom, maxZoom);
- }
-
- this.numMarkers_[minZoom] += markers.length;
-};
-
-
-/**
- * Returns the value of the optional maximum zoom. This method is defined so
- * that we have just one place where optional maximum zoom is calculated.
- *
- * @param {Number} opt_maxZoom The optinal maximum zoom.
- * @return The maximum zoom.
- */
-MarkerManager.prototype.getOptMaxZoom_ = function (opt_maxZoom) {
- return opt_maxZoom || this.maxZoom_;
-};
-
-
-/**
- * Calculates the total number of markers potentially visible at a given
- * zoom level.
- *
- * @param {Number} zoom The zoom level to check.
- */
-MarkerManager.prototype.getMarkerCount = function (zoom) {
- var total = 0;
- for (var z = 0; z <= zoom; z++) {
- total += this.numMarkers_[z];
- }
- return total;
-};
-
-/**
- * Returns a marker given latitude, longitude and zoom. If the marker does not
- * exist, the method will return a new marker. If a new marker is created,
- * it will NOT be added to the manager.
- *
- * @param {Number} lat - the latitude of a marker.
- * @param {Number} lng - the longitude of a marker.
- * @param {Number} zoom - the zoom level
- * @return {GMarker} marker - the marker found at lat and lng
- */
-MarkerManager.prototype.getMarker = function (lat, lng, zoom) {
- var mPoint = new google.maps.LatLng(lat, lng);
- var gridPoint = this.getTilePoint_(mPoint, zoom, new google.maps.Size(0, 0, 0, 0));
-
- var marker = new google.maps.Marker({position: mPoint});
-
- var cellArray = this.getGridCellNoCreate_(gridPoint.x, gridPoint.y, zoom);
- if (cellArray !== undefined) {
- for (var i = 0; i < cellArray.length; i++)
- {
- if (lat === cellArray[i].getLatLng().lat() && lng === cellArray[i].getLatLng().lng()) {
- marker = cellArray[i];
- }
- }
- }
- return marker;
-};
-
-/**
- * Add a single marker to the map.
- *
- * @param {Marker} marker The marker to add.
- * @param {Number} minZoom The minimum zoom level to display the marker.
- * @param {Number} opt_maxZoom The maximum zoom level to display the marker.
- */
-MarkerManager.prototype.addMarker = function (marker, minZoom, opt_maxZoom) {
- var maxZoom = this.getOptMaxZoom_(opt_maxZoom);
- this.addMarkerBatch_(marker, minZoom, maxZoom);
- var gridPoint = this.getTilePoint_(marker.getPosition(), this.mapZoom_, new google.maps.Size(0, 0, 0, 0));
- if (this.isGridPointVisible_(gridPoint) &&
- minZoom <= this.shownBounds_.z &&
- this.shownBounds_.z <= maxZoom) {
- this.addOverlay_(marker);
- this.notifyListeners_();
- }
- this.numMarkers_[minZoom]++;
-};
-
-
-/**
- * Helper class to create a bounds of INT ranges.
- * @param bounds Array.<Object.<string, number>> Bounds object.
- * @constructor
- */
-function GridBounds(bounds) {
- // [sw, ne]
-
- this.minX = Math.min(bounds[0].x, bounds[1].x);
- this.maxX = Math.max(bounds[0].x, bounds[1].x);
- this.minY = Math.min(bounds[0].y, bounds[1].y);
- this.maxY = Math.max(bounds[0].y, bounds[1].y);
-
-}
-
-/**
- * Returns true if this bounds equal the given bounds.
- * @param {GridBounds} gridBounds GridBounds The bounds to test.
- * @return {Boolean} This Bounds equals the given GridBounds.
- */
-GridBounds.prototype.equals = function (gridBounds) {
- if (this.maxX === gridBounds.maxX && this.maxY === gridBounds.maxY && this.minX === gridBounds.minX && this.minY === gridBounds.minY) {
- return true;
- } else {
- return false;
- }
-};
-
-/**
- * Returns true if this bounds (inclusively) contains the given point.
- * @param {Point} point The point to test.
- * @return {Boolean} This Bounds contains the given Point.
- */
-GridBounds.prototype.containsPoint = function (point) {
- var outer = this;
- return (outer.minX <= point.x && outer.maxX >= point.x && outer.minY <= point.y && outer.maxY >= point.y);
-};
-
-/**
- * Get a cell in the grid, creating it first if necessary.
- *
- * Optimization candidate
- *
- * @param {Number} x The x coordinate of the cell.
- * @param {Number} y The y coordinate of the cell.
- * @param {Number} z The z coordinate of the cell.
- * @return {Array} The cell in the array.
- */
-MarkerManager.prototype.getGridCellCreate_ = function (x, y, z) {
- var grid = this.grid_[z];
- if (x < 0) {
- x += this.gridWidth_[z];
- }
- var gridCol = grid[x];
- if (!gridCol) {
- gridCol = grid[x] = [];
- return (gridCol[y] = []);
- }
- var gridCell = gridCol[y];
- if (!gridCell) {
- return (gridCol[y] = []);
- }
- return gridCell;
-};
-
-
-/**
- * Get a cell in the grid, returning undefined if it does not exist.
- *
- * NOTE: Optimized for speed -- otherwise could combine with getGridCellCreate_.
- *
- * @param {Number} x The x coordinate of the cell.
- * @param {Number} y The y coordinate of the cell.
- * @param {Number} z The z coordinate of the cell.
- * @return {Array} The cell in the array.
- */
-MarkerManager.prototype.getGridCellNoCreate_ = function (x, y, z) {
- var grid = this.grid_[z];
-
- if (x < 0) {
- x += this.gridWidth_[z];
- }
- var gridCol = grid[x];
- return gridCol ? gridCol[y] : undefined;
-};
-
-
-/**
- * Turns at geographical bounds into a grid-space bounds.
- *
- * @param {LatLngBounds} bounds The geographical bounds.
- * @param {Number} zoom The zoom level of the bounds.
- * @param {google.maps.Size} swPadding The padding in pixels to extend beyond the
- * given bounds.
- * @param {google.maps.Size} nePadding The padding in pixels to extend beyond the
- * given bounds.
- * @return {GridBounds} The bounds in grid space.
- */
-MarkerManager.prototype.getGridBounds_ = function (bounds, zoom, swPadding, nePadding) {
- zoom = Math.min(zoom, this.maxZoom_);
-
- var bl = bounds.getSouthWest();
- var tr = bounds.getNorthEast();
- var sw = this.getTilePoint_(bl, zoom, swPadding);
-
- var ne = this.getTilePoint_(tr, zoom, nePadding);
- var gw = this.gridWidth_[zoom];
-
- // Crossing the prime meridian requires correction of bounds.
- if (tr.lng() < bl.lng() || ne.x < sw.x) {
- sw.x -= gw;
- }
- if (ne.x - sw.x + 1 >= gw) {
- // Computed grid bounds are larger than the world; truncate.
- sw.x = 0;
- ne.x = gw - 1;
- }
-
- var gridBounds = new GridBounds([sw, ne]);
- gridBounds.z = zoom;
-
- return gridBounds;
-};
-
-
-/**
- * Gets the grid-space bounds for the current map viewport.
- *
- * @return {Bounds} The bounds in grid space.
- */
-MarkerManager.prototype.getMapGridBounds_ = function () {
- return this.getGridBounds_(this.map_.getBounds(), this.mapZoom_, this.swPadding_, this.nePadding_);
-};
-
-
-/**
- * Event listener for map:movend.
- * NOTE: Use a timeout so that the user is not blocked
- * from moving the map.
- *
- * Removed this because a a lack of a scopy override/callback function on events.
- */
-MarkerManager.prototype.onMapMoveEnd_ = function () {
- this.objectSetTimeout_(this, this.updateMarkers_, 0);
-};
-
-
-/**
- * Call a function or evaluate an expression after a specified number of
- * milliseconds.
- *
- * Equivalent to the standard window.setTimeout function, but the given
- * function executes as a method of this instance. So the function passed to
- * objectSetTimeout can contain references to this.
- * objectSetTimeout(this, function () { alert(this.x) }, 1000);
- *
- * @param {Object} object The target object.
- * @param {Function} command The command to run.
- * @param {Number} milliseconds The delay.
- * @return {Boolean} Success.
- */
-MarkerManager.prototype.objectSetTimeout_ = function (object, command, milliseconds) {
- return window.setTimeout(function () {
- command.call(object);
- }, milliseconds);
-};
-
-
-/**
- * Is this layer visible?
- *
- * Returns visibility setting
- *
- * @return {Boolean} Visible
- */
-MarkerManager.prototype.visible = function () {
- return this.show_ ? true : false;
-};
-
-
-/**
- * Returns true if the manager is hidden.
- * Otherwise returns false.
- * @return {Boolean} Hidden
- */
-MarkerManager.prototype.isHidden = function () {
- return !this.show_;
-};
-
-
-/**
- * Shows the manager if it's currently hidden.
- */
-MarkerManager.prototype.show = function () {
- this.show_ = true;
- this.refresh();
-};
-
-
-/**
- * Hides the manager if it's currently visible
- */
-MarkerManager.prototype.hide = function () {
- this.show_ = false;
- this.refresh();
-};
-
-
-/**
- * Toggles the visibility of the manager.
- */
-MarkerManager.prototype.toggle = function () {
- this.show_ = !this.show_;
- this.refresh();
-};
-
-
-/**
- * Refresh forces the marker-manager into a good state.
- * <ol>
- * <li>If never before initialized, shows all the markers.</li>
- * <li>If previously initialized, removes and re-adds all markers.</li>
- * </ol>
- */
-MarkerManager.prototype.refresh = function () {
- if (this.shownMarkers_ > 0) {
- this.processAll_(this.shownBounds_, this.removeOverlay_);
- }
- // An extra check on this.show_ to increase performance (no need to processAll_)
- if (this.show_) {
- this.processAll_(this.shownBounds_, this.addOverlay_);
- }
- this.notifyListeners_();
-};
-
-
-/**
- * After the viewport may have changed, add or remove markers as needed.
- */
-MarkerManager.prototype.updateMarkers_ = function () {
- this.mapZoom_ = this.map_.getZoom();
- var newBounds = this.getMapGridBounds_();
-
- // If the move does not include new grid sections,
- // we have no work to do:
- if (newBounds.equals(this.shownBounds_) && newBounds.z === this.shownBounds_.z) {
- return;
- }
-
- if (newBounds.z !== this.shownBounds_.z) {
- this.processAll_(this.shownBounds_, this.removeOverlay_);
- if (this.show_) { // performance
- this.processAll_(newBounds, this.addOverlay_);
- }
- } else {
- // Remove markers:
- this.rectangleDiff_(this.shownBounds_, newBounds, this.removeCellMarkers_);
-
- // Add markers:
- if (this.show_) { // performance
- this.rectangleDiff_(newBounds, this.shownBounds_, this.addCellMarkers_);
- }
- }
- this.shownBounds_ = newBounds;
-
- this.notifyListeners_();
-};
-
-
-/**
- * Notify listeners when the state of what is displayed changes.
- */
-MarkerManager.prototype.notifyListeners_ = function () {
- google.maps.event.trigger(this, 'changed', this.shownBounds_, this.shownMarkers_);
-};
-
-
-/**
- * Process all markers in the bounds provided, using a callback.
- *
- * @param {Bounds} bounds The bounds in grid space.
- * @param {Function} callback The function to call for each marker.
- */
-MarkerManager.prototype.processAll_ = function (bounds, callback) {
- for (var x = bounds.minX; x <= bounds.maxX; x++) {
- for (var y = bounds.minY; y <= bounds.maxY; y++) {
- this.processCellMarkers_(x, y, bounds.z, callback);
- }
- }
-};
-
-
-/**
- * Process all markers in the grid cell, using a callback.
- *
- * @param {Number} x The x coordinate of the cell.
- * @param {Number} y The y coordinate of the cell.
- * @param {Number} z The z coordinate of the cell.
- * @param {Function} callback The function to call for each marker.
- */
-MarkerManager.prototype.processCellMarkers_ = function (x, y, z, callback) {
- var cell = this.getGridCellNoCreate_(x, y, z);
- if (cell) {
- for (var i = cell.length - 1; i >= 0; i--) {
- callback(cell[i]);
- }
- }
-};
-
-
-/**
- * Remove all markers in a grid cell.
- *
- * @param {Number} x The x coordinate of the cell.
- * @param {Number} y The y coordinate of the cell.
- * @param {Number} z The z coordinate of the cell.
- */
-MarkerManager.prototype.removeCellMarkers_ = function (x, y, z) {
- this.processCellMarkers_(x, y, z, this.removeOverlay_);
-};
-
-
-/**
- * Add all markers in a grid cell.
- *
- * @param {Number} x The x coordinate of the cell.
- * @param {Number} y The y coordinate of the cell.
- * @param {Number} z The z coordinate of the cell.
- */
-MarkerManager.prototype.addCellMarkers_ = function (x, y, z) {
- this.processCellMarkers_(x, y, z, this.addOverlay_);
-};
-
-
-/**
- * Use the rectangleDiffCoords_ function to process all grid cells
- * that are in bounds1 but not bounds2, using a callback, and using
- * the current MarkerManager object as the instance.
- *
- * Pass the z parameter to the callback in addition to x and y.
- *
- * @param {Bounds} bounds1 The bounds of all points we may process.
- * @param {Bounds} bounds2 The bounds of points to exclude.
- * @param {Function} callback The callback function to call
- * for each grid coordinate (x, y, z).
- */
-MarkerManager.prototype.rectangleDiff_ = function (bounds1, bounds2, callback) {
- var me = this;
- me.rectangleDiffCoords_(bounds1, bounds2, function (x, y) {
- callback.apply(me, [x, y, bounds1.z]);
- });
-};
-
-
-/**
- * Calls the function for all points in bounds1, not in bounds2
- *
- * @param {Bounds} bounds1 The bounds of all points we may process.
- * @param {Bounds} bounds2 The bounds of points to exclude.
- * @param {Function} callback The callback function to call
- * for each grid coordinate.
- */
-MarkerManager.prototype.rectangleDiffCoords_ = function (bounds1, bounds2, callback) {
- var minX1 = bounds1.minX;
- var minY1 = bounds1.minY;
- var maxX1 = bounds1.maxX;
- var maxY1 = bounds1.maxY;
- var minX2 = bounds2.minX;
- var minY2 = bounds2.minY;
- var maxX2 = bounds2.maxX;
- var maxY2 = bounds2.maxY;
-
- var x, y;
- for (x = minX1; x <= maxX1; x++) { // All x in R1
- // All above:
- for (y = minY1; y <= maxY1 && y < minY2; y++) { // y in R1 above R2
- callback(x, y);
- }
- // All below:
- for (y = Math.max(maxY2 + 1, minY1); // y in R1 below R2
- y <= maxY1; y++) {
- callback(x, y);
- }
- }
-
- for (y = Math.max(minY1, minY2);
- y <= Math.min(maxY1, maxY2); y++) { // All y in R2 and in R1
- // Strictly left:
- for (x = Math.min(maxX1 + 1, minX2) - 1;
- x >= minX1; x--) { // x in R1 left of R2
- callback(x, y);
- }
- // Strictly right:
- for (x = Math.max(minX1, maxX2 + 1); // x in R1 right of R2
- x <= maxX1; x++) {
- callback(x, y);
- }
- }
-};
-
-
-/**
- * Removes value from array. O(N).
- *
- * @param {Array} array The array to modify.
- * @param {any} value The value to remove.
- * @param {Boolean} opt_notype Flag to disable type checking in equality.
- * @return {Number} The number of instances of value that were removed.
- */
-MarkerManager.prototype.removeFromArray_ = function (array, value, opt_notype) {
- var shift = 0;
- for (var i = 0; i < array.length; ++i) {
- if (array[i] === value || (opt_notype && array[i] === value)) {
- array.splice(i--, 1);
- shift++;
- }
- }
- return shift;
-};
-
-
-
-
-
-
-
-/**
-* Projection overlay helper. Helps in calculating
-* that markers get into the right grid.
-* @constructor
-* @param {Map} map The map to manage.
-**/
-function ProjectionHelperOverlay(map) {
-
- this.setMap(map);
-
- var TILEFACTOR = 8;
- var TILESIDE = 1 << TILEFACTOR;
- var RADIUS = 7;
-
- this._map = map;
- this._zoom = -1;
- this._X0 =
- this._Y0 =
- this._X1 =
- this._Y1 = -1;
-
-
-}
-if (typeof(google) != 'undefined' && google.maps) { // make sure it exists -- amalo
-ProjectionHelperOverlay.prototype = new google.maps.OverlayView();
-}
-
-/**
- * Helper function to convert Lng to X
- * @private
- * @param {float} lng
- **/
-ProjectionHelperOverlay.prototype.LngToX_ = function (lng) {
- return (1 + lng / 180);
-};
-
-/**
- * Helper function to convert Lat to Y
- * @private
- * @param {float} lat
- **/
-ProjectionHelperOverlay.prototype.LatToY_ = function (lat) {
- var sinofphi = Math.sin(lat * Math.PI / 180);
- return (1 - 0.5 / Math.PI * Math.log((1 + sinofphi) / (1 - sinofphi)));
-};
-
-/**
-* Old school LatLngToPixel
-* @param {LatLng} latlng google.maps.LatLng object
-* @param {Number} zoom Zoom level
-* @return {position} {x: pixelPositionX, y: pixelPositionY}
-**/
-ProjectionHelperOverlay.prototype.LatLngToPixel = function (latlng, zoom) {
- var map = this._map;
- var div = this.getProjection().fromLatLngToDivPixel(latlng);
- var abs = {x: ~~(0.5 + this.LngToX_(latlng.lng()) * (2 << (zoom + 6))), y: ~~(0.5 + this.LatToY_(latlng.lat()) * (2 << (zoom + 6)))};
- return abs;
-};
-
-
-/**
- * Draw function only triggers a ready event for
- * MarkerManager to know projection can proceed to
- * initialize.
- */
-ProjectionHelperOverlay.prototype.draw = function () {
- if (!this.ready) {
- this.ready = true;
- google.maps.event.trigger(this, 'ready');
- }
-};
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/write.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/write.py
deleted file mode 100644
index a55f226e245..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/bench/write.py
+++ /dev/null
@@ -1,347 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: ascii -*-
-r"""
-=========================
- Write benchmark results
-=========================
-
-Write benchmark results.
-
-:Copyright:
-
- Copyright 2014
- Andr\xe9 Malo or his licensors, as applicable
-
-:License:
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-Usage::
-
- python -mbench.write [-p plain] [-t table] <pickled
-
- -p plain Plain file to write to (like docs/BENCHMARKS).
- -t table Table file to write to (like docs/_userdoc/benchmark.txt).
-
-"""
-if __doc__:
- __doc__ = __doc__.encode('ascii').decode('unicode_escape')
-__author__ = r"Andr\xe9 Malo".encode('ascii').decode('unicode_escape')
-__docformat__ = "restructuredtext en"
-__license__ = "Apache License, Version 2.0"
-__version__ = "1.0.0"
-
-import os as _os
-import re as _re
-import sys as _sys
-
-
-try:
- unicode
-except NameError:
- def uni(v):
- if hasattr(v, 'decode'):
- return v.decode('latin-1')
- return str(v)
-else:
- def uni(v):
- if isinstance(v, unicode):
- return v.encode('utf-8')
- return str(v)
-
-
-def write_table(filename, results):
- """
- Output tabled benchmark results
-
- :Parameters:
- `filename` : ``str``
- Filename to write to
-
- `results` : ``list``
- Results
- """
- try:
- next
- except NameError:
- next = lambda i: (getattr(i, 'next', None) or i.__next__)()
- try:
- cmp
- except NameError:
- cmp = lambda a, b: (a > b) - (a < b)
-
- names = [
- ('simple_port', 'Simple Port'),
- ('jsmin_2_0_9', 'jsmin 2.0.9'),
- ('slimit_0_8_1', 'slimit 0.8.1'),
- ('slimit_0_8_1_mangle', 'slimit 0.8.1 (mangle)'),
- ('rjsmin', '|rjsmin|'),
- ('_rjsmin', r'_\ |rjsmin|'),
- ]
- benched_per_table = 2
-
- results = sorted(results, reverse=True)
-
- # First we transform our data into a table (list of lists)
- pythons, widths = [], [0] * (benched_per_table + 1)
- last_version = None
- for version, _, result in results:
- version = uni(version)
- if not(last_version is None or version.startswith('2.')):
- continue
- last_version = version
-
- namesub = _re.compile(r'(?:-\d+(?:\.\d+)*)?\.js$').sub
- result = iter(result)
- tables = []
-
- # given our data it's easier to create the table transposed...
- for benched in result:
- rows = [['Name'] + [desc for _, desc in names]]
- for _ in range(benched_per_table):
- if _:
- try:
- benched = next(result)
- except StopIteration:
- rows.append([''] + ['' for _ in names])
- continue
-
- times = dict((
- uni(port), (time, benched['sizes'][idx])
- ) for idx, (port, time) in enumerate(benched['times']))
- columns = ['%s (%.1f)' % (
- namesub('', _os.path.basename(uni(benched['filename']))),
- benched['size'] / 1024.0,
- )]
- for idx, (port, _) in enumerate(names):
- if port not in times:
- columns.append('n/a')
- continue
- time, size = times[port]
- if time is None:
- columns.append('(failed)')
- continue
- columns.append('%s%.2f ms (%.1f %s)' % (
- idx == 0 and ' ' or '',
- time,
- size / 1024.0,
- idx == 0 and '\\*' or ['=', '>', '<'][
- cmp(size, benched['sizes'][0])
- ],
- ))
- rows.append(columns)
-
- # calculate column widths (global for all tables)
- for idx, row in enumerate(rows):
- widths[idx] = max(widths[idx], max(map(len, row)))
-
- # ... and transpose it back.
- tables.append(zip(*rows))
- pythons.append((version, tables))
-
- if last_version.startswith('2.'):
- break
-
- # Second we create a rest table from it
- lines = []
- separator = lambda c='-': '+'.join([''] + [
- c * (width + 2) for width in widths
- ] + [''])
-
- for idx, (version, tables) in enumerate(pythons):
- if idx:
- lines.append('')
- lines.append('')
-
- line = 'Python %s' % (version,)
- lines.append(line)
- lines.append('~' * len(line))
-
- for table in tables:
- lines.append('')
- lines.append('.. rst-class:: benchmark')
- lines.append('')
-
- for idx, row in enumerate(table):
- if idx == 0:
- # header
- lines.append(separator())
- lines.append('|'.join([''] + [
- ' %s%*s ' % (col, len(col) - width, '')
- for width, col in zip(widths, row)
- ] + ['']))
- lines.append(separator('='))
- else: # data
- lines.append('|'.join([''] + [
- j == 0 and (
- ' %s%*s ' % (col, len(col) - widths[j], '')
- ) or (
- ['%*s ', ' %*s '][idx == 1] % (widths[j], col)
- )
- for j, col in enumerate(row)
- ] + ['']))
- lines.append(separator())
-
- fplines = []
- fp = open(filename)
- try:
- fpiter = iter(fp)
- for line in fpiter:
- line = line.rstrip()
- if line == '.. begin tables':
- buf = []
- for line in fpiter:
- line = line.rstrip()
- if line == '.. end tables':
- fplines.append('.. begin tables')
- fplines.append('')
- fplines.extend(lines)
- fplines.append('')
- fplines.append('.. end tables')
- buf = []
- break
- else:
- buf.append(line)
- else:
- fplines.extend(buf)
- _sys.stderr.write("Placeholder container not found!\n")
- else:
- fplines.append(line)
- finally:
- fp.close()
-
- fp = open(filename, 'w')
- try:
- fp.write('\n'.join(fplines) + '\n')
- finally:
- fp.close()
-
-
-def write_plain(filename, results):
- """
- Output plain benchmark results
-
- :Parameters:
- `filename` : ``str``
- Filename to write to
-
- `results` : ``list``
- Results
- """
- lines = []
- results = sorted(results, reverse=True)
- for idx, (version, import_notes, result) in enumerate(results):
- if idx:
- lines.append('')
- lines.append('')
-
- lines.append('$ python%s -OO bench/main.py bench/*.js' % (
- '.'.join(version.split('.')[:2])
- ))
- lines.append('~' * 72)
- for note in import_notes:
- lines.append(uni(note))
- lines.append('Python Release: %s' % (version,))
-
- for single in result:
- lines.append('')
- lines.append('Benchmarking %r... (%.1f KiB)' % (
- uni(single['filename']), single['size'] / 1024.0
- ))
- for msg in single['messages']:
- lines.append(msg)
- times = []
- space = max([len(uni(port)) for port, _ in single['times']])
- for idx, (port, time) in enumerate(single['times']):
- port = uni(port)
- if time is None:
- lines.append(" FAILED %s" % (port,))
- else:
- times.append(time)
- lines.append(
- " Timing %s%s ... (%5.1f KiB %s) %8.2f ms" % (
- port,
- " " * (space - len(port)),
- single['sizes'][idx] / 1024.0,
- idx == 0 and '*' or ['=', '>', '<'][
- cmp(single['sizes'][idx], single['sizes'][0])
- ],
- time
- )
- )
- if len(times) > 1:
- lines[-1] += " (factor: %s)" % (', '.join([
- '%.2f' % (timed / time) for timed in times[:-1]
- ]))
-
- lines.append('')
- lines.append('')
- lines.append('# vim: nowrap')
- fp = open(filename, 'w')
- try:
- fp.write('\n'.join(lines) + '\n')
- finally:
- fp.close()
-
-
-def main(argv=None):
- """ Main """
- import getopt as _getopt
- import pickle as _pickle
-
- if argv is None:
- argv = _sys.argv[1:]
- try:
- opts, args = _getopt.getopt(argv, "hp:t:", ["help"])
- except getopt.GetoptError:
- e = _sys.exc_info()[0](_sys.exc_info()[1])
- print >> _sys.stderr, "%s\nTry %s -mbench.write --help" % (
- e,
- _os.path.basename(_sys.executable),
- )
- _sys.exit(2)
-
- plain, table = None, None
- for key, value in opts:
- if key in ("-h", "--help"):
- print >> _sys.stderr, (
- "%s -mbench.write [-p plain] [-t table] <pickled" % (
- _os.path.basename(_sys.executable),
- )
- )
- _sys.exit(0)
- elif key == '-p':
- plain = str(value)
- elif key == '-t':
- table = str(value)
-
- struct = []
- _sys.stdin = getattr(_sys.stdin, 'detach', lambda: _sys.stdin)()
- try:
- while True:
- version, import_notes, result = _pickle.load(_sys.stdin)
- if hasattr(version, 'decode'):
- version = version.decode('latin-1')
- struct.append((version, import_notes, result))
- except EOFError:
- pass
-
- if plain:
- write_plain(plain, struct)
-
- if table:
- write_table(table, struct)
-
-
-if __name__ == '__main__':
- main()
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/BENCHMARKS b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/BENCHMARKS
deleted file mode 100644
index f6ab429e648..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/BENCHMARKS
+++ /dev/null
@@ -1,388 +0,0 @@
-$ python3.4 -OO bench/main.py bench/*.js
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Python Release: 3.4.0
-
-Benchmarking 'bench/apiviewer.js'... (953.2 KiB)
- Timing simple_port ... (951.5 KiB *) 2083.14 ms
- Timing jsmin_2_0_9 ... (951.5 KiB >) 2439.38 ms (factor: 0.85)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... (951.5 KiB =) 56.03 ms (factor: 37.18, 43.54)
- Timing _rjsmin ... (951.5 KiB =) 2.11 ms (factor: 987.34, 1156.19, 26.56)
-
-Benchmarking 'bench/bootstrap.js'... (49.0 KiB)
- Timing simple_port ... ( 26.4 KiB *) 90.13 ms
- Timing jsmin_2_0_9 ... ( 26.4 KiB >) 38.70 ms (factor: 2.33)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... ( 26.4 KiB >) 13.78 ms (factor: 6.54, 2.81)
- Timing _rjsmin ... ( 26.4 KiB >) 0.17 ms (factor: 526.72, 226.19, 80.51)
-
-Benchmarking 'bench/jquery-1.7.1.js'... (242.4 KiB)
- Timing simple_port ... (135.9 KiB *) 468.94 ms
- Timing jsmin_2_0_9 ... (136.8 KiB >) 251.12 ms (factor: 1.87)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... (135.9 KiB =) 95.54 ms (factor: 4.91, 2.63)
- Timing _rjsmin ... (135.9 KiB =) 1.12 ms (factor: 420.55, 225.20, 85.68)
-
-Benchmarking 'bench/knockout-2.0.0.js'... (38.9 KiB)
- Timing simple_port ... ( 38.6 KiB *) 83.92 ms
- Timing jsmin_2_0_9 ... ( 38.6 KiB >) 42.35 ms (factor: 1.98)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... ( 38.6 KiB >) 2.87 ms (factor: 29.21, 14.74)
- Timing _rjsmin ... ( 38.6 KiB >) 0.09 ms (factor: 895.82, 452.10, 30.66)
-
-Benchmarking 'bench/markermanager.js'... (28.6 KiB)
- Timing simple_port ... ( 11.6 KiB *) 44.58 ms
- Timing jsmin_2_0_9 ... ( 11.6 KiB >) 19.18 ms (factor: 2.32)
- Timing slimit_0_8_1 ... ( 11.5 KiB <) 149.82 ms (factor: 0.30, 0.13)
- Timing slimit_0_8_1_mangle ... ( 9.3 KiB <) 174.04 ms (factor: 0.26, 0.11, 0.86)
- Timing rjsmin ... ( 11.6 KiB =) 5.88 ms (factor: 7.59, 3.26, 25.50, 29.62)
- Timing _rjsmin ... ( 11.6 KiB =) 0.08 ms (factor: 565.73, 243.38, 1901.13, 2208.49, 74.56)
-
-
-$ python3.3 -OO bench/main.py bench/*.js
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Python Release: 3.3.3
-
-Benchmarking 'bench/apiviewer.js'... (953.2 KiB)
- Timing simple_port ... (951.5 KiB *) 2805.14 ms
- Timing jsmin_2_0_9 ... (951.5 KiB >) 2741.73 ms (factor: 1.02)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... (951.5 KiB =) 75.86 ms (factor: 36.98, 36.14)
- Timing _rjsmin ... (951.5 KiB =) 2.14 ms (factor: 1309.39, 1279.78, 35.41)
-
-Benchmarking 'bench/bootstrap.js'... (49.0 KiB)
- Timing simple_port ... ( 26.4 KiB *) 112.96 ms
- Timing jsmin_2_0_9 ... ( 26.4 KiB >) 48.69 ms (factor: 2.32)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... ( 26.4 KiB >) 18.50 ms (factor: 6.11, 2.63)
- Timing _rjsmin ... ( 26.4 KiB >) 0.18 ms (factor: 629.94, 271.54, 103.15)
-
-Benchmarking 'bench/jquery-1.7.1.js'... (242.4 KiB)
- Timing simple_port ... (135.9 KiB *) 596.73 ms
- Timing jsmin_2_0_9 ... (136.8 KiB >) 309.95 ms (factor: 1.93)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... (135.9 KiB =) 127.05 ms (factor: 4.70, 2.44)
- Timing _rjsmin ... (135.9 KiB =) 1.14 ms (factor: 524.99, 272.68, 111.77)
-
-Benchmarking 'bench/knockout-2.0.0.js'... (38.9 KiB)
- Timing simple_port ... ( 38.6 KiB *) 110.93 ms
- Timing jsmin_2_0_9 ... ( 38.6 KiB >) 50.83 ms (factor: 2.18)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... ( 38.6 KiB >) 4.20 ms (factor: 26.40, 12.10)
- Timing _rjsmin ... ( 38.6 KiB >) 0.10 ms (factor: 1131.98, 518.66, 42.88)
-
-Benchmarking 'bench/markermanager.js'... (28.6 KiB)
- Timing simple_port ... ( 11.6 KiB *) 56.39 ms
- Timing jsmin_2_0_9 ... ( 11.6 KiB >) 24.10 ms (factor: 2.34)
- Timing slimit_0_8_1 ... ( 11.5 KiB <) 159.78 ms (factor: 0.35, 0.15)
- Timing slimit_0_8_1_mangle ... ( 9.3 KiB <) 186.04 ms (factor: 0.30, 0.13, 0.86)
- Timing rjsmin ... ( 11.6 KiB =) 8.30 ms (factor: 6.80, 2.90, 19.26, 22.42)
- Timing _rjsmin ... ( 11.6 KiB =) 0.08 ms (factor: 684.74, 292.67, 1940.24, 2259.20, 100.76)
-
-
-$ python3.2 -OO bench/main.py bench/*.js
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Python Release: 3.2.5
-
-Benchmarking 'bench/apiviewer.js'... (953.2 KiB)
- Timing simple_port ... (951.5 KiB *) 2372.53 ms
- Timing jsmin_2_0_9 ... (951.5 KiB >) 8911.83 ms (factor: 0.27)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... (951.5 KiB =) 68.91 ms (factor: 34.43, 129.32)
- Timing _rjsmin ... (951.5 KiB =) 1.96 ms (factor: 1208.26, 4538.54, 35.10)
-
-Benchmarking 'bench/bootstrap.js'... (49.0 KiB)
- Timing simple_port ... ( 26.4 KiB *) 97.80 ms
- Timing jsmin_2_0_9 ... ( 26.4 KiB >) 44.32 ms (factor: 2.21)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... ( 26.4 KiB >) 17.00 ms (factor: 5.75, 2.61)
- Timing _rjsmin ... ( 26.4 KiB >) 0.17 ms (factor: 561.85, 254.60, 97.65)
-
-Benchmarking 'bench/jquery-1.7.1.js'... (242.4 KiB)
- Timing simple_port ... (135.9 KiB *) 517.50 ms
- Timing jsmin_2_0_9 ... (136.8 KiB >) 411.85 ms (factor: 1.26)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... (135.9 KiB =) 117.36 ms (factor: 4.41, 3.51)
- Timing _rjsmin ... (135.9 KiB =) 1.11 ms (factor: 464.76, 369.88, 105.40)
-
-Benchmarking 'bench/knockout-2.0.0.js'... (38.9 KiB)
- Timing simple_port ... ( 38.6 KiB *) 95.02 ms
- Timing jsmin_2_0_9 ... ( 38.6 KiB >) 48.91 ms (factor: 1.94)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... ( 38.6 KiB >) 3.85 ms (factor: 24.69, 12.71)
- Timing _rjsmin ... ( 38.6 KiB >) 0.09 ms (factor: 1088.37, 560.23, 44.08)
-
-Benchmarking 'bench/markermanager.js'... (28.6 KiB)
- Timing simple_port ... ( 11.6 KiB *) 48.13 ms
- Timing jsmin_2_0_9 ... ( 11.6 KiB >) 20.64 ms (factor: 2.33)
- Timing slimit_0_8_1 ... ( 11.5 KiB <) 150.11 ms (factor: 0.32, 0.14)
- Timing slimit_0_8_1_mangle ... ( 9.3 KiB <) 177.11 ms (factor: 0.27, 0.12, 0.85)
- Timing rjsmin ... ( 11.6 KiB =) 7.37 ms (factor: 6.53, 2.80, 20.35, 24.02)
- Timing _rjsmin ... ( 11.6 KiB =) 0.08 ms (factor: 606.20, 259.99, 1890.49, 2230.53, 92.88)
-
-
-$ python3.1 -OO bench/main.py bench/*.js
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Python Release: 3.1.5
-
-Benchmarking 'bench/apiviewer.js'... (953.2 KiB)
- Timing simple_port ... (951.5 KiB *) 2418.96 ms
- Timing jsmin_2_0_9 ... (951.5 KiB >) 4455.01 ms (factor: 0.54)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... (951.5 KiB =) 61.65 ms (factor: 39.24, 72.26)
- Timing _rjsmin ... (951.5 KiB =) 1.89 ms (factor: 1277.38, 2352.56, 32.56)
-
-Benchmarking 'bench/bootstrap.js'... (49.0 KiB)
- Timing simple_port ... ( 26.4 KiB *) 102.87 ms
- Timing jsmin_2_0_9 ... ( 26.4 KiB >) 50.26 ms (factor: 2.05)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... ( 26.4 KiB >) 15.10 ms (factor: 6.81, 3.33)
- Timing _rjsmin ... ( 26.4 KiB >) 0.18 ms (factor: 583.83, 285.25, 85.68)
-
-Benchmarking 'bench/jquery-1.7.1.js'... (242.4 KiB)
- Timing simple_port ... (135.9 KiB *) 540.63 ms
- Timing jsmin_2_0_9 ... (136.8 KiB >) 349.77 ms (factor: 1.55)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... (135.9 KiB =) 105.46 ms (factor: 5.13, 3.32)
- Timing _rjsmin ... (135.9 KiB =) 1.09 ms (factor: 494.63, 320.01, 96.49)
-
-Benchmarking 'bench/knockout-2.0.0.js'... (38.9 KiB)
- Timing simple_port ... ( 38.6 KiB *) 96.75 ms
- Timing jsmin_2_0_9 ... ( 38.6 KiB >) 53.25 ms (factor: 1.82)
- FAILED slimit_0_8_1
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... ( 38.6 KiB >) 3.43 ms (factor: 28.22, 15.53)
- Timing _rjsmin ... ( 38.6 KiB >) 0.09 ms (factor: 1096.85, 603.67, 38.86)
-
-Benchmarking 'bench/markermanager.js'... (28.6 KiB)
- Timing simple_port ... ( 11.6 KiB *) 50.98 ms
- Timing jsmin_2_0_9 ... ( 11.6 KiB >) 26.19 ms (factor: 1.95)
- Timing slimit_0_8_1 ... ( 11.5 KiB <) 137.84 ms (factor: 0.37, 0.19)
- Timing slimit_0_8_1_mangle ... ( 9.3 KiB <) 159.43 ms (factor: 0.32, 0.16, 0.86)
- Timing rjsmin ... ( 11.6 KiB =) 6.47 ms (factor: 7.88, 4.05, 21.29, 24.63)
- Timing _rjsmin ... ( 11.6 KiB =) 0.08 ms (factor: 659.94, 338.97, 1784.33, 2063.88, 83.80)
-
-
-$ python3.0 -OO bench/main.py bench/*.js
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-slimit_0_8_1 not installed for python 3.0...
-Python Release: 3.0.1
-
-Benchmarking 'bench/apiviewer.js'... (953.2 KiB)
- Timing simple_port ... (951.5 KiB *) 6725.57 ms
- Timing jsmin_2_0_9 ... (951.5 KiB >) 8824.69 ms (factor: 0.76)
- Timing rjsmin ... (951.5 KiB =) 60.97 ms (factor: 110.31, 144.74)
- Timing _rjsmin ... (951.5 KiB =) 1.93 ms (factor: 3489.97, 4579.23, 31.64)
-
-Benchmarking 'bench/bootstrap.js'... (49.0 KiB)
- Timing simple_port ... ( 26.4 KiB *) 294.93 ms
- Timing jsmin_2_0_9 ... ( 26.4 KiB >) 238.16 ms (factor: 1.24)
- Timing rjsmin ... ( 26.4 KiB >) 15.68 ms (factor: 18.81, 15.19)
- Timing _rjsmin ... ( 26.4 KiB >) 0.17 ms (factor: 1767.00, 1426.89, 93.93)
-
-Benchmarking 'bench/jquery-1.7.1.js'... (242.4 KiB)
- Timing simple_port ... (135.9 KiB *) 1495.38 ms
- Timing jsmin_2_0_9 ... (136.8 KiB >) 1315.18 ms (factor: 1.14)
- Timing rjsmin ... (135.9 KiB =) 108.75 ms (factor: 13.75, 12.09)
- Timing _rjsmin ... (135.9 KiB =) 1.08 ms (factor: 1381.18, 1214.74, 100.44)
-
-Benchmarking 'bench/knockout-2.0.0.js'... (38.9 KiB)
- Timing simple_port ... ( 38.6 KiB *) 273.43 ms
- Timing jsmin_2_0_9 ... ( 38.6 KiB >) 223.27 ms (factor: 1.22)
- Timing rjsmin ... ( 38.6 KiB >) 3.40 ms (factor: 80.39, 65.64)
- Timing _rjsmin ... ( 38.6 KiB >) 0.09 ms (factor: 3093.63, 2526.05, 38.48)
-
-Benchmarking 'bench/markermanager.js'... (28.6 KiB)
- Timing simple_port ... ( 11.6 KiB *) 157.33 ms
- Timing jsmin_2_0_9 ... ( 11.6 KiB >) 130.73 ms (factor: 1.20)
- Timing rjsmin ... ( 11.6 KiB =) 6.71 ms (factor: 23.44, 19.47)
- Timing _rjsmin ... ( 11.6 KiB =) 0.08 ms (factor: 2046.53, 1700.44, 87.32)
-
-
-$ python2.7 -OO bench/main.py bench/*.js
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Python Release: 2.7.5
-
-Benchmarking 'bench/apiviewer.js'... (953.2 KiB)
- Timing simple_port ... (951.5 KiB *) 2960.91 ms
- Timing jsmin_2_0_9 ... (951.5 KiB >) 3087.26 ms (factor: 0.96)
- Timing slimit_0_8_1 ... (944.3 KiB <) 13520.48 ms (factor: 0.22, 0.23)
- Timing slimit_0_8_1_mangle ... (922.9 KiB <) 16463.29 ms (factor: 0.18, 0.19, 0.82)
- Timing rjsmin ... (951.5 KiB =) 60.45 ms (factor: 48.98, 51.07, 223.66, 272.35)
- Timing _rjsmin ... (951.5 KiB =) 1.92 ms (factor: 1544.14, 1610.04, 7051.08, 8585.79, 31.53)
-
-Benchmarking 'bench/bootstrap.js'... (49.0 KiB)
- Timing simple_port ... ( 26.4 KiB *) 118.82 ms
- Timing jsmin_2_0_9 ... ( 26.4 KiB >) 60.82 ms (factor: 1.95)
- Timing slimit_0_8_1 ... ( 26.5 KiB >) 379.62 ms (factor: 0.31, 0.16)
- Timing slimit_0_8_1_mangle ... ( 22.2 KiB <) 404.06 ms (factor: 0.29, 0.15, 0.94)
- Timing rjsmin ... ( 26.4 KiB >) 15.94 ms (factor: 7.45, 3.81, 23.81, 25.34)
- Timing _rjsmin ... ( 26.4 KiB >) 0.18 ms (factor: 674.14, 345.09, 2153.87, 2292.52, 90.46)
-
-Benchmarking 'bench/jquery-1.7.1.js'... (242.4 KiB)
- Timing simple_port ... (135.9 KiB *) 624.62 ms
- Timing jsmin_2_0_9 ... (136.8 KiB >) 370.86 ms (factor: 1.68)
- Timing slimit_0_8_1 ... (134.0 KiB <) 1800.29 ms (factor: 0.35, 0.21)
- Timing slimit_0_8_1_mangle ... ( 95.0 KiB <) 2129.26 ms (factor: 0.29, 0.17, 0.85)
- Timing rjsmin ... (135.9 KiB =) 113.71 ms (factor: 5.49, 3.26, 15.83, 18.73)
- Timing _rjsmin ... (135.9 KiB =) 1.12 ms (factor: 559.59, 332.25, 1612.87, 1907.59, 101.87)
-
-Benchmarking 'bench/knockout-2.0.0.js'... (38.9 KiB)
- Timing simple_port ... ( 38.6 KiB *) 118.56 ms
- Timing jsmin_2_0_9 ... ( 38.6 KiB >) 67.29 ms (factor: 1.76)
- Timing slimit_0_8_1 ... ( 39.0 KiB >) 703.96 ms (factor: 0.17, 0.10)
- Timing slimit_0_8_1_mangle ... ( 38.9 KiB >) 844.49 ms (factor: 0.14, 0.08, 0.83)
- Timing rjsmin ... ( 38.6 KiB >) 3.38 ms (factor: 35.11, 19.93, 208.47, 250.09)
- Timing _rjsmin ... ( 38.6 KiB >) 0.09 ms (factor: 1288.21, 731.08, 7648.52, 9175.39, 36.69)
-
-Benchmarking 'bench/markermanager.js'... (28.6 KiB)
- Timing simple_port ... ( 11.6 KiB *) 59.09 ms
- Timing jsmin_2_0_9 ... ( 11.6 KiB >) 30.78 ms (factor: 1.92)
- Timing slimit_0_8_1 ... ( 11.5 KiB <) 145.18 ms (factor: 0.41, 0.21)
- Timing slimit_0_8_1_mangle ... ( 9.3 KiB <) 164.81 ms (factor: 0.36, 0.19, 0.88)
- Timing rjsmin ... ( 11.6 KiB =) 6.94 ms (factor: 8.51, 4.43, 20.91, 23.74)
- Timing _rjsmin ... ( 11.6 KiB =) 0.08 ms (factor: 725.97, 378.16, 1783.50, 2024.64, 85.28)
-
-
-$ python2.6 -OO bench/main.py bench/*.js
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Python Release: 2.6.8
-
-Benchmarking 'bench/apiviewer.js'... (953.2 KiB)
- Timing simple_port ... (951.5 KiB *) 2666.59 ms
- Timing jsmin_2_0_9 ... (951.5 KiB >) 2628.62 ms (factor: 1.01)
- Timing slimit_0_8_1 ... (944.3 KiB <) 13410.38 ms (factor: 0.20, 0.20)
- Timing slimit_0_8_1_mangle ... (922.9 KiB <) 16661.34 ms (factor: 0.16, 0.16, 0.80)
- Timing rjsmin ... (951.5 KiB =) 62.67 ms (factor: 42.55, 41.94, 213.97, 265.84)
- Timing _rjsmin ... (951.5 KiB =) 1.92 ms (factor: 1387.91, 1368.15, 6979.86, 8671.93, 32.62)
-
-Benchmarking 'bench/bootstrap.js'... (49.0 KiB)
- Timing simple_port ... ( 26.4 KiB *) 109.21 ms
- Timing jsmin_2_0_9 ... ( 26.4 KiB >) 49.00 ms (factor: 2.23)
- Timing slimit_0_8_1 ... ( 26.5 KiB >) 380.13 ms (factor: 0.29, 0.13)
- Timing slimit_0_8_1_mangle ... ( 22.2 KiB <) 409.65 ms (factor: 0.27, 0.12, 0.93)
- Timing rjsmin ... ( 26.4 KiB >) 16.14 ms (factor: 6.77, 3.04, 23.55, 25.38)
- Timing _rjsmin ... ( 26.4 KiB >) 0.18 ms (factor: 621.09, 278.66, 2161.76, 2329.63, 91.80)
-
-Benchmarking 'bench/jquery-1.7.1.js'... (242.4 KiB)
- Timing simple_port ... (135.9 KiB *) 569.29 ms
- Timing jsmin_2_0_9 ... (136.8 KiB >) 303.84 ms (factor: 1.87)
- Timing slimit_0_8_1 ... (134.0 KiB <) 1775.18 ms (factor: 0.32, 0.17)
- Timing slimit_0_8_1_mangle ... ( 95.0 KiB <) 2175.70 ms (factor: 0.26, 0.14, 0.82)
- Timing rjsmin ... (135.9 KiB =) 114.20 ms (factor: 4.98, 2.66, 15.54, 19.05)
- Timing _rjsmin ... (135.9 KiB =) 1.14 ms (factor: 498.07, 265.83, 1553.12, 1903.54, 99.92)
-
-Benchmarking 'bench/knockout-2.0.0.js'... (38.9 KiB)
- Timing simple_port ... ( 38.6 KiB *) 106.63 ms
- Timing jsmin_2_0_9 ... ( 38.6 KiB >) 52.70 ms (factor: 2.02)
- Timing slimit_0_8_1 ... ( 39.0 KiB >) 698.62 ms (factor: 0.15, 0.08)
- Timing slimit_0_8_1_mangle ... ( 38.9 KiB >) 865.02 ms (factor: 0.12, 0.06, 0.81)
- Timing rjsmin ... ( 38.6 KiB >) 3.57 ms (factor: 29.90, 14.78, 195.88, 242.54)
- Timing _rjsmin ... ( 38.6 KiB >) 0.09 ms (factor: 1160.17, 573.35, 7601.29, 9411.79, 38.81)
-
-Benchmarking 'bench/markermanager.js'... (28.6 KiB)
- Timing simple_port ... ( 11.6 KiB *) 54.44 ms
- Timing jsmin_2_0_9 ... ( 11.6 KiB >) 25.41 ms (factor: 2.14)
- Timing slimit_0_8_1 ... ( 11.5 KiB <) 137.57 ms (factor: 0.40, 0.18)
- Timing slimit_0_8_1_mangle ... ( 9.3 KiB <) 172.31 ms (factor: 0.32, 0.15, 0.80)
- Timing rjsmin ... ( 11.6 KiB =) 6.93 ms (factor: 7.86, 3.67, 19.86, 24.87)
- Timing _rjsmin ... ( 11.6 KiB =) 0.08 ms (factor: 671.23, 313.25, 1696.29, 2124.63, 85.42)
-
-
-$ python2.5 -OO bench/main.py bench/*.js
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Python Release: 2.5.6
-
-Benchmarking 'bench/apiviewer.js'... (953.2 KiB)
- Timing simple_port ... (951.5 KiB *) 2702.99 ms
- Timing jsmin_2_0_9 ... (951.5 KiB >) 2716.83 ms (factor: 0.99)
- Timing slimit_0_8_1 ... (944.3 KiB <) 14369.86 ms (factor: 0.19, 0.19)
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... (951.5 KiB =) 57.95 ms (factor: 46.64, 46.88, 247.96)
- Timing _rjsmin ... (951.5 KiB =) 1.87 ms (factor: 1443.98, 1451.38, 7676.63, 30.96)
-
-Benchmarking 'bench/bootstrap.js'... (49.0 KiB)
- Timing simple_port ... ( 26.4 KiB *) 109.86 ms
- Timing jsmin_2_0_9 ... ( 26.4 KiB >) 51.67 ms (factor: 2.13)
- Timing slimit_0_8_1 ... ( 26.5 KiB >) 364.04 ms (factor: 0.30, 0.14)
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... ( 26.4 KiB >) 15.45 ms (factor: 7.11, 3.34, 23.57)
- Timing _rjsmin ... ( 26.4 KiB >) 0.17 ms (factor: 652.77, 306.98, 2163.04, 91.78)
-
-Benchmarking 'bench/jquery-1.7.1.js'... (242.4 KiB)
- Timing simple_port ... (135.9 KiB *) 571.75 ms
- Timing jsmin_2_0_9 ... (136.8 KiB >) 320.28 ms (factor: 1.79)
- Timing slimit_0_8_1 ... (134.0 KiB <) 1744.62 ms (factor: 0.33, 0.18)
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... (135.9 KiB =) 108.43 ms (factor: 5.27, 2.95, 16.09)
- Timing _rjsmin ... (135.9 KiB =) 1.11 ms (factor: 514.49, 288.20, 1569.90, 97.57)
-
-Benchmarking 'bench/knockout-2.0.0.js'... (38.9 KiB)
- Timing simple_port ... ( 38.6 KiB *) 107.76 ms
- Timing jsmin_2_0_9 ... ( 38.6 KiB >) 56.06 ms (factor: 1.92)
- Timing slimit_0_8_1 ... ( 39.0 KiB >) 685.51 ms (factor: 0.16, 0.08)
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... ( 38.6 KiB >) 3.34 ms (factor: 32.24, 16.77, 205.10)
- Timing _rjsmin ... ( 38.6 KiB >) 0.09 ms (factor: 1218.61, 633.96, 7752.04, 37.80)
-
-Benchmarking 'bench/markermanager.js'... (28.6 KiB)
- Timing simple_port ... ( 11.6 KiB *) 54.28 ms
- Timing jsmin_2_0_9 ... ( 11.6 KiB >) 26.70 ms (factor: 2.03)
- Timing slimit_0_8_1 ... ( 11.5 KiB <) 142.60 ms (factor: 0.38, 0.19)
- FAILED slimit_0_8_1_mangle
- Timing rjsmin ... ( 11.6 KiB =) 6.66 ms (factor: 8.15, 4.01, 21.40)
- Timing _rjsmin ... ( 11.6 KiB =) 0.08 ms (factor: 684.64, 336.80, 1798.82, 84.04)
-
-
-$ python2.4 -OO bench/main.py bench/*.js
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-slimit_0_8_1 not installed for python 2.4...
-Python Release: 2.4.6
-
-Benchmarking 'bench/apiviewer.js'... (953.2 KiB)
- Timing simple_port ... (951.5 KiB *) 2683.16 ms
- Timing jsmin_2_0_9 ... (951.5 KiB >) 2613.60 ms (factor: 1.03)
- Timing rjsmin ... (951.5 KiB =) 59.43 ms (factor: 45.15, 43.98)
- Timing _rjsmin ... (951.5 KiB =) 1.90 ms (factor: 1413.59, 1376.94, 31.31)
-
-Benchmarking 'bench/bootstrap.js'... (49.0 KiB)
- Timing simple_port ... ( 26.4 KiB *) 111.40 ms
- Timing jsmin_2_0_9 ... ( 26.4 KiB >) 48.93 ms (factor: 2.28)
- Timing rjsmin ... ( 26.4 KiB >) 15.83 ms (factor: 7.04, 3.09)
- Timing _rjsmin ... ( 26.4 KiB >) 0.17 ms (factor: 657.59, 288.82, 93.41)
-
-Benchmarking 'bench/jquery-1.7.1.js'... (242.4 KiB)
- Timing simple_port ... (135.9 KiB *) 579.89 ms
- Timing jsmin_2_0_9 ... (136.8 KiB >) 302.57 ms (factor: 1.92)
- Timing rjsmin ... (135.9 KiB =) 108.56 ms (factor: 5.34, 2.79)
- Timing _rjsmin ... (135.9 KiB =) 1.08 ms (factor: 539.43, 281.45, 100.98)
-
-Benchmarking 'bench/knockout-2.0.0.js'... (38.9 KiB)
- Timing simple_port ... ( 38.6 KiB *) 107.04 ms
- Timing jsmin_2_0_9 ... ( 38.6 KiB >) 52.66 ms (factor: 2.03)
- Timing rjsmin ... ( 38.6 KiB >) 3.26 ms (factor: 32.88, 16.18)
- Timing _rjsmin ... ( 38.6 KiB >) 0.09 ms (factor: 1211.21, 595.89, 36.83)
-
-Benchmarking 'bench/markermanager.js'... (28.6 KiB)
- Timing simple_port ... ( 11.6 KiB *) 55.65 ms
- Timing jsmin_2_0_9 ... ( 11.6 KiB >) 25.33 ms (factor: 2.20)
- Timing rjsmin ... ( 11.6 KiB =) 6.62 ms (factor: 8.41, 3.83)
- Timing _rjsmin ... ( 11.6 KiB =) 0.08 ms (factor: 711.59, 323.87, 84.60)
-
-
-# vim: nowrap
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/CHANGES b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/CHANGES
deleted file mode 100644
index e40b765234a..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/CHANGES
+++ /dev/null
@@ -1,89 +0,0 @@
-Changes with version 1.0.10
-
- *) Added support for pypy 2.2
-
- *) Relint with newer pylint
-
- *) Fix locale problem with the setup script on python3.
- Submitted by https://github.com/svenstaro
-
-
-Changes with version 1.0.9
-
- *) Documentation and benchmark updates
-
-
-Changes with version 1.0.8
-
- *) Updated benchmarks
-
- *) Added command line option for keeping comments starting with an exclamation
- mark (-b)
-
- *) Added command line option for disabling the C implemention (-p)
-
- *) Added support for python 3.4
-
- *) Added support for keeping comments starting with an exclamation mark. This
- feature can be enabled by passing keep_bang_comments=True to the jsmin
- function.
-
-
-Changes with version 1.0.7
-
- *) Fix inconsistency between Python and C (Python implementation was buggy).
- Spotted by: Dave Smith <dave thesmithfam.org>
-
- *) Added support for jython 2.7
-
-
-Changes with version 1.0.6
-
- *) Added compat option to setup.py supporting the pip installer
-
- *) Added support for pypy (1.9, 2.0)
-
- *) Added support for jython (2.5)
-
-
-Changes with version 1.0.5
-
- *) Newline removal before ! operator was made more sensible.
-
-
-Changes with version 1.0.4
-
- *) Added support for Python 3.3
-
- *) Collapsion protection was reduced to "+ +" and "- -" sequences (which
- still includes longer sequences like "+ ++")
-
-
-Changes with version 1.0.3
-
- *) "+ ++" and "- --" sequences are no longer collapsed. They were before,
- because the original jsmin collapsed them, too.
-
- *) Updated benchmarks, added slimit and removed jsmin v8 (because it produced
- invalid results).
-
- *) Removed "classic" regex variant.
-
-
-Changes with version 1.0.2
-
- *) Although it should work, python 2.3 is no longer supported.
- (No suitable test environment)
-
- *) "return /regex/" is now recognized as regex expression. It wasn't before,
- because the original jsmin ignored that, too.
-
-
-Changes with version 1.0.1
-
- *) Add C extension reimplementing the regex from rjsmin.py
-
-
-Changes with version 1.0.0
-
- *) First stable release.
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/CLASSIFIERS b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/CLASSIFIERS
deleted file mode 100644
index 10d59650380..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/CLASSIFIERS
+++ /dev/null
@@ -1,19 +0,0 @@
-Development Status :: 5 - Production/Stable
-Environment :: Web Environment
-Intended Audience :: Developers
-License :: OSI Approved
-License :: OSI Approved :: Apache License, Version 2.0
-Operating System :: OS Independent
-Programming Language :: C
-Programming Language :: Python
-Programming Language :: Python :: 2
-Programming Language :: Python :: 3
-Programming Language :: Python :: Implementation :: CPython
-Programming Language :: Python :: Implementation :: Jython
-Programming Language :: Python :: Implementation :: PyPy
-Topic :: Internet :: WWW/HTTP :: Dynamic Content
-Topic :: Software Development :: Libraries
-Topic :: Software Development :: Libraries :: Python Modules
-Topic :: Text Processing
-Topic :: Text Processing :: Filters
-Topic :: Utilities
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/DESCRIPTION b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/DESCRIPTION
deleted file mode 100644
index ceef827edd1..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/DESCRIPTION
+++ /dev/null
@@ -1,72 +0,0 @@
-=====================
- Javascript Minifier
-=====================
-
-rJSmin is a javascript minifier written in python.
-
-The minifier is based on the semantics of `jsmin.c by Douglas Crockford`_\.
-
-The module is a re-implementation aiming for speed, so it can be used at
-runtime (rather than during a preprocessing step). Usually it produces the
-same results as the original ``jsmin.c``. It differs in the following ways:
-
-- there is no error detection: unterminated string, regex and comment
- literals are treated as regular javascript code and minified as such.
-- Control characters inside string and regex literals are left untouched; they
- are not converted to spaces (nor to \n)
-- Newline characters are not allowed inside string and regex literals, except
- for line continuations in string literals (ECMA-5).
-- "return /regex/" is recognized correctly.
-- "+ +" and "- -" sequences are not collapsed to '++' or '--'
-- Newlines before ! operators are removed more sensibly
-- Comments starting with an exclamation mark (``!``) can be kept optionally
-- rJSmin does not handle streams, but only complete strings. (However, the
- module provides a "streamy" interface).
-
-Since most parts of the logic are handled by the regex engine it's way faster
-than the original python port of ``jsmin.c`` by Baruch Even. The speed factor
-varies between about 6 and 55 depending on input and python version (it gets
-faster the more compressed the input already is). Compared to the
-speed-refactored python port by Dave St.Germain the performance gain is less
-dramatic but still between 3 and 50 (for huge inputs)). See the
-docs/BENCHMARKS file for details.
-
-rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more.
-
-Both python 2 (>=2.4) and python 3 are supported.
-
-.. _jsmin.c by Douglas Crockford: http://www.crockford.com/javascript/jsmin.c
-
-
-Copyright and License
-~~~~~~~~~~~~~~~~~~~~~
-
-Copyright 2011 - 2014
-André Malo or his licensors, as applicable.
-
-The whole package (except for the files in the bench/ directory) is
-distributed under the Apache License Version 2.0. You'll find a copy in the
-root directory of the distribution or online at:
-<http://www.apache.org/licenses/LICENSE-2.0>.
-
-
-Bugs
-~~~~
-
-No bugs, of course. ;-)
-But if you've found one or have an idea how to improve rjsmin, feel free
-to send a pull request on `github <https://github.com/ndparker/rjsmin>`_
-or send a mail to <rjsmin-bugs@perlig.de>.
-
-
-Author Information
-~~~~~~~~~~~~~~~~~~
-
-André "nd" Malo <nd perlig.de>
-GPG: 0x8103A37E
-
-
- If God intended people to be naked, they would be born that way.
- -- Oscar Wilde
-
-.. vim:tw=72 syntax=rest
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/PROVIDES b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/PROVIDES
deleted file mode 100644
index 8e9e6633191..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/PROVIDES
+++ /dev/null
@@ -1 +0,0 @@
-rjsmin (1.0)
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/SUMMARY b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/SUMMARY
deleted file mode 100644
index 52064ce19c4..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/SUMMARY
+++ /dev/null
@@ -1 +0,0 @@
-Javascript Minifier
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/api-objects.txt b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/api-objects.txt
deleted file mode 100644
index e5f2e820866..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/api-objects.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-rjsmin rjsmin-module.html
-rjsmin.__license__ rjsmin-module.html#__license__
-rjsmin.jsmin rjsmin-module.html#jsmin
-rjsmin.__package__ rjsmin-module.html#__package__
-rjsmin._make_jsmin rjsmin-module.html#_make_jsmin
-rjsmin.jsmin_for_posers rjsmin-module.html#jsmin_for_posers
-rjsmin.__doc__ rjsmin-module.html#__doc__
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/crarr.png b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/crarr.png
deleted file mode 100644
index 26b43c52433..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/crarr.png
+++ /dev/null
Binary files differ
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/epydoc.css b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/epydoc.css
deleted file mode 100644
index 86d41706824..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/epydoc.css
+++ /dev/null
@@ -1,322 +0,0 @@
-
-
-/* Epydoc CSS Stylesheet
- *
- * This stylesheet can be used to customize the appearance of epydoc's
- * HTML output.
- *
- */
-
-/* Default Colors & Styles
- * - Set the default foreground & background color with 'body'; and
- * link colors with 'a:link' and 'a:visited'.
- * - Use bold for decision list terms.
- * - The heading styles defined here are used for headings *within*
- * docstring descriptions. All headings used by epydoc itself use
- * either class='epydoc' or class='toc' (CSS styles for both
- * defined below).
- */
-body { background: #ffffff; color: #000000; }
-p { margin-top: 0.5em; margin-bottom: 0.5em; }
-a:link { color: #0000ff; }
-a:visited { color: #204080; }
-dt { font-weight: bold; }
-h1 { font-size: +140%; font-style: italic;
- font-weight: bold; }
-h2 { font-size: +125%; font-style: italic;
- font-weight: bold; }
-h3 { font-size: +110%; font-style: italic;
- font-weight: normal; }
-code { font-size: 100%; }
-/* N.B.: class, not pseudoclass */
-a.link { font-family: monospace; }
-
-/* Page Header & Footer
- * - The standard page header consists of a navigation bar (with
- * pointers to standard pages such as 'home' and 'trees'); a
- * breadcrumbs list, which can be used to navigate to containing
- * classes or modules; options links, to show/hide private
- * variables and to show/hide frames; and a page title (using
- * <h1>). The page title may be followed by a link to the
- * corresponding source code (using 'span.codelink').
- * - The footer consists of a navigation bar, a timestamp, and a
- * pointer to epydoc's homepage.
- */
-h1.epydoc { margin: 0; font-size: +140%; font-weight: bold; }
-h2.epydoc { font-size: +130%; font-weight: bold; }
-h3.epydoc { font-size: +115%; font-weight: bold;
- margin-top: 0.2em; }
-td h3.epydoc { font-size: +115%; font-weight: bold;
- margin-bottom: 0; }
-table.navbar { background: #a0c0ff; color: #000000;
- border: 2px groove #c0d0d0; }
-table.navbar table { color: #000000; }
-th.navbar-select { background: #70b0ff;
- color: #000000; }
-table.navbar a { text-decoration: none; }
-table.navbar a:link { color: #0000ff; }
-table.navbar a:visited { color: #204080; }
-span.breadcrumbs { font-size: 85%; font-weight: bold; }
-span.options { font-size: 70%; }
-span.codelink { font-size: 85%; }
-td.footer { font-size: 85%; }
-
-/* Table Headers
- * - Each summary table and details section begins with a 'header'
- * row. This row contains a section title (marked by
- * 'span.table-header') as well as a show/hide private link
- * (marked by 'span.options', defined above).
- * - Summary tables that contain user-defined groups mark those
- * groups using 'group header' rows.
- */
-td.table-header { background: #70b0ff; color: #000000;
- border: 1px solid #608090; }
-td.table-header table { color: #000000; }
-td.table-header table a:link { color: #0000ff; }
-td.table-header table a:visited { color: #204080; }
-span.table-header { font-size: 120%; font-weight: bold; }
-th.group-header { background: #c0e0f8; color: #000000;
- text-align: left; font-style: italic;
- font-size: 115%;
- border: 1px solid #608090; }
-
-/* Summary Tables (functions, variables, etc)
- * - Each object is described by a single row of the table with
- * two cells. The left cell gives the object's type, and is
- * marked with 'code.summary-type'. The right cell gives the
- * object's name and a summary description.
- * - CSS styles for the table's header and group headers are
- * defined above, under 'Table Headers'
- */
-table.summary { border-collapse: collapse;
- background: #e8f0f8; color: #000000;
- border: 1px solid #608090;
- margin-bottom: 0.5em; }
-td.summary { border: 1px solid #608090; }
-code.summary-type { font-size: 85%; }
-table.summary a:link { color: #0000ff; }
-table.summary a:visited { color: #204080; }
-
-
-/* Details Tables (functions, variables, etc)
- * - Each object is described in its own div.
- * - A single-row summary table w/ table-header is used as
- * a header for each details section (CSS style for table-header
- * is defined above, under 'Table Headers').
- */
-table.details { border-collapse: collapse;
- background: #e8f0f8; color: #000000;
- border: 1px solid #608090;
- margin: .2em 0 0 0; }
-table.details table { color: #000000; }
-table.details a:link { color: #0000ff; }
-table.details a:visited { color: #204080; }
-
-/* Fields */
-dl.fields { margin-left: 2em; margin-top: 1em;
- margin-bottom: 1em; }
-dl.fields dd ul { margin-left: 0em; padding-left: 0em; }
-dl.fields dd ul li ul { margin-left: 2em; padding-left: 0em; }
-div.fields { margin-left: 2em; }
-div.fields p { margin-bottom: 0.5em; }
-
-/* Index tables (identifier index, term index, etc)
- * - link-index is used for indices containing lists of links
- * (namely, the identifier index & term index).
- * - index-where is used in link indices for the text indicating
- * the container/source for each link.
- * - metadata-index is used for indices containing metadata
- * extracted from fields (namely, the bug index & todo index).
- */
-table.link-index { border-collapse: collapse;
- background: #e8f0f8; color: #000000;
- border: 1px solid #608090; }
-td.link-index { border-width: 0px; }
-table.link-index a:link { color: #0000ff; }
-table.link-index a:visited { color: #204080; }
-span.index-where { font-size: 70%; }
-table.metadata-index { border-collapse: collapse;
- background: #e8f0f8; color: #000000;
- border: 1px solid #608090;
- margin: .2em 0 0 0; }
-td.metadata-index { border-width: 1px; border-style: solid; }
-table.metadata-index a:link { color: #0000ff; }
-table.metadata-index a:visited { color: #204080; }
-
-/* Function signatures
- * - sig* is used for the signature in the details section.
- * - .summary-sig* is used for the signature in the summary
- * table, and when listing property accessor functions.
- * */
-.sig-name { color: #006080; }
-.sig-arg { color: #008060; }
-.sig-default { color: #602000; }
-.summary-sig { font-family: monospace; }
-.summary-sig-name { color: #006080; font-weight: bold; }
-table.summary a.summary-sig-name:link
- { color: #006080; font-weight: bold; }
-table.summary a.summary-sig-name:visited
- { color: #006080; font-weight: bold; }
-.summary-sig-arg { color: #006040; }
-.summary-sig-default { color: #501800; }
-
-/* Subclass list
- */
-ul.subclass-list { display: inline; }
-ul.subclass-list li { display: inline; }
-
-/* To render variables, classes etc. like functions */
-table.summary .summary-name { color: #006080; font-weight: bold;
- font-family: monospace; }
-table.summary
- a.summary-name:link { color: #006080; font-weight: bold;
- font-family: monospace; }
-table.summary
- a.summary-name:visited { color: #006080; font-weight: bold;
- font-family: monospace; }
-
-/* Variable values
- * - In the 'variable details' sections, each varaible's value is
- * listed in a 'pre.variable' box. The width of this box is
- * restricted to 80 chars; if the value's repr is longer than
- * this it will be wrapped, using a backslash marked with
- * class 'variable-linewrap'. If the value's repr is longer
- * than 3 lines, the rest will be ellided; and an ellipsis
- * marker ('...' marked with 'variable-ellipsis') will be used.
- * - If the value is a string, its quote marks will be marked
- * with 'variable-quote'.
- * - If the variable is a regexp, it is syntax-highlighted using
- * the re* CSS classes.
- */
-pre.variable { padding: .5em; margin: 0;
- background: #dce4ec; color: #000000;
- border: 1px solid #708890; }
-.variable-linewrap { color: #604000; font-weight: bold; }
-.variable-ellipsis { color: #604000; font-weight: bold; }
-.variable-quote { color: #604000; font-weight: bold; }
-.variable-group { color: #008000; font-weight: bold; }
-.variable-op { color: #604000; font-weight: bold; }
-.variable-string { color: #006030; }
-.variable-unknown { color: #a00000; font-weight: bold; }
-.re { color: #000000; }
-.re-char { color: #006030; }
-.re-op { color: #600000; }
-.re-group { color: #003060; }
-.re-ref { color: #404040; }
-
-/* Base tree
- * - Used by class pages to display the base class hierarchy.
- */
-pre.base-tree { font-size: 80%; margin: 0; }
-
-/* Frames-based table of contents headers
- * - Consists of two frames: one for selecting modules; and
- * the other listing the contents of the selected module.
- * - h1.toc is used for each frame's heading
- * - h2.toc is used for subheadings within each frame.
- */
-h1.toc { text-align: center; font-size: 105%;
- margin: 0; font-weight: bold;
- padding: 0; }
-h2.toc { font-size: 100%; font-weight: bold;
- margin: 0.5em 0 0 -0.3em; }
-
-/* Syntax Highlighting for Source Code
- * - doctest examples are displayed in a 'pre.py-doctest' block.
- * If the example is in a details table entry, then it will use
- * the colors specified by the 'table pre.py-doctest' line.
- * - Source code listings are displayed in a 'pre.py-src' block.
- * Each line is marked with 'span.py-line' (used to draw a line
- * down the left margin, separating the code from the line
- * numbers). Line numbers are displayed with 'span.py-lineno'.
- * The expand/collapse block toggle button is displayed with
- * 'a.py-toggle' (Note: the CSS style for 'a.py-toggle' should not
- * modify the font size of the text.)
- * - If a source code page is opened with an anchor, then the
- * corresponding code block will be highlighted. The code
- * block's header is highlighted with 'py-highlight-hdr'; and
- * the code block's body is highlighted with 'py-highlight'.
- * - The remaining py-* classes are used to perform syntax
- * highlighting (py-string for string literals, py-name for names,
- * etc.)
- */
-pre.py-doctest { padding: .5em; margin: 1em;
- background: #e8f0f8; color: #000000;
- border: 1px solid #708890; }
-table pre.py-doctest { background: #dce4ec;
- color: #000000; }
-pre.py-src { border: 2px solid #000000;
- background: #f0f0f0; color: #000000; }
-.py-line { border-left: 2px solid #000000;
- margin-left: .2em; padding-left: .4em; }
-.py-lineno { font-style: italic; font-size: 90%;
- padding-left: .5em; }
-a.py-toggle { text-decoration: none; }
-div.py-highlight-hdr { border-top: 2px solid #000000;
- border-bottom: 2px solid #000000;
- background: #d8e8e8; }
-div.py-highlight { border-bottom: 2px solid #000000;
- background: #d0e0e0; }
-.py-prompt { color: #005050; font-weight: bold;}
-.py-more { color: #005050; font-weight: bold;}
-.py-string { color: #006030; }
-.py-comment { color: #003060; }
-.py-keyword { color: #600000; }
-.py-output { color: #404040; }
-.py-name { color: #000050; }
-.py-name:link { color: #000050 !important; }
-.py-name:visited { color: #000050 !important; }
-.py-number { color: #005000; }
-.py-defname { color: #000060; font-weight: bold; }
-.py-def-name { color: #000060; font-weight: bold; }
-.py-base-class { color: #000060; }
-.py-param { color: #000060; }
-.py-docstring { color: #006030; }
-.py-decorator { color: #804020; }
-/* Use this if you don't want links to names underlined: */
-/*a.py-name { text-decoration: none; }*/
-
-/* Graphs & Diagrams
- * - These CSS styles are used for graphs & diagrams generated using
- * Graphviz dot. 'img.graph-without-title' is used for bare
- * diagrams (to remove the border created by making the image
- * clickable).
- */
-img.graph-without-title { border: none; }
-img.graph-with-title { border: 1px solid #000000; }
-span.graph-title { font-weight: bold; }
-span.graph-caption { }
-
-/* General-purpose classes
- * - 'p.indent-wrapped-lines' defines a paragraph whose first line
- * is not indented, but whose subsequent lines are.
- * - The 'nomargin-top' class is used to remove the top margin (e.g.
- * from lists). The 'nomargin' class is used to remove both the
- * top and bottom margin (but not the left or right margin --
- * for lists, that would cause the bullets to disappear.)
- */
-p.indent-wrapped-lines { padding: 0 0 0 7em; text-indent: -7em;
- margin: 0; }
-.nomargin-top { margin-top: 0; }
-.nomargin { margin-top: 0; margin-bottom: 0; }
-
-/* HTML Log */
-div.log-block { padding: 0; margin: .5em 0 .5em 0;
- background: #e8f0f8; color: #000000;
- border: 1px solid #000000; }
-div.log-error { padding: .1em .3em .1em .3em; margin: 4px;
- background: #ffb0b0; color: #000000;
- border: 1px solid #000000; }
-div.log-warning { padding: .1em .3em .1em .3em; margin: 4px;
- background: #ffffb0; color: #000000;
- border: 1px solid #000000; }
-div.log-info { padding: .1em .3em .1em .3em; margin: 4px;
- background: #b0ffb0; color: #000000;
- border: 1px solid #000000; }
-h2.log-hdr { background: #70b0ff; color: #000000;
- margin: 0; padding: 0em 0.5em 0em 0.5em;
- border-bottom: 1px solid #000000; font-size: 110%; }
-p.log { font-weight: bold; margin: .5em 0 .5em 0; }
-tr.opt-changed { color: #000000; font-weight: bold; }
-tr.opt-default { color: #606060; }
-pre.log { margin: 0; padding: 0; padding-left: 1em; }
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/epydoc.js b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/epydoc.js
deleted file mode 100644
index e787dbcf471..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/epydoc.js
+++ /dev/null
@@ -1,293 +0,0 @@
-function toggle_private() {
- // Search for any private/public links on this page. Store
- // their old text in "cmd," so we will know what action to
- // take; and change their text to the opposite action.
- var cmd = "?";
- var elts = document.getElementsByTagName("a");
- for(var i=0; i<elts.length; i++) {
- if (elts[i].className == "privatelink") {
- cmd = elts[i].innerHTML;
- elts[i].innerHTML = ((cmd && cmd.substr(0,4)=="show")?
- "hide&nbsp;private":"show&nbsp;private");
- }
- }
- // Update all DIVs containing private objects.
- var elts = document.getElementsByTagName("div");
- for(var i=0; i<elts.length; i++) {
- if (elts[i].className == "private") {
- elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"none":"block");
- }
- else if (elts[i].className == "public") {
- elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"block":"none");
- }
- }
- // Update all table rows containing private objects. Note, we
- // use "" instead of "block" becaue IE & firefox disagree on what
- // this should be (block vs table-row), and "" just gives the
- // default for both browsers.
- var elts = document.getElementsByTagName("tr");
- for(var i=0; i<elts.length; i++) {
- if (elts[i].className == "private") {
- elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"none":"");
- }
- }
- // Update all list items containing private objects.
- var elts = document.getElementsByTagName("li");
- for(var i=0; i<elts.length; i++) {
- if (elts[i].className == "private") {
- elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?
- "none":"");
- }
- }
- // Update all list items containing private objects.
- var elts = document.getElementsByTagName("ul");
- for(var i=0; i<elts.length; i++) {
- if (elts[i].className == "private") {
- elts[i].style.display = ((cmd && cmd.substr(0,4)=="hide")?"none":"block");
- }
- }
- // Set a cookie to remember the current option.
- document.cookie = "EpydocPrivate="+cmd;
- }
-function show_private() {
- var elts = document.getElementsByTagName("a");
- for(var i=0; i<elts.length; i++) {
- if (elts[i].className == "privatelink") {
- cmd = elts[i].innerHTML;
- if (cmd && cmd.substr(0,4)=="show")
- toggle_private();
- }
- }
- }
-function getCookie(name) {
- var dc = document.cookie;
- var prefix = name + "=";
- var begin = dc.indexOf("; " + prefix);
- if (begin == -1) {
- begin = dc.indexOf(prefix);
- if (begin != 0) return null;
- } else
- { begin += 2; }
- var end = document.cookie.indexOf(";", begin);
- if (end == -1)
- { end = dc.length; }
- return unescape(dc.substring(begin + prefix.length, end));
- }
-function setFrame(url1, url2) {
- parent.frames[1].location.href = url1;
- parent.frames[2].location.href = url2;
- }
-function checkCookie() {
- var cmd=getCookie("EpydocPrivate");
- if (cmd && cmd.substr(0,4)!="show" && location.href.indexOf("#_") < 0)
- toggle_private();
- }
-function toggleCallGraph(id) {
- var elt = document.getElementById(id);
- if (elt.style.display == "none")
- elt.style.display = "block";
- else
- elt.style.display = "none";
- }
-function expand(id) {
- var elt = document.getElementById(id+"-expanded");
- if (elt) elt.style.display = "block";
- var elt = document.getElementById(id+"-expanded-linenums");
- if (elt) elt.style.display = "block";
- var elt = document.getElementById(id+"-collapsed");
- if (elt) { elt.innerHTML = ""; elt.style.display = "none"; }
- var elt = document.getElementById(id+"-collapsed-linenums");
- if (elt) { elt.innerHTML = ""; elt.style.display = "none"; }
- var elt = document.getElementById(id+"-toggle");
- if (elt) { elt.innerHTML = "-"; }
-}
-
-function collapse(id) {
- var elt = document.getElementById(id+"-expanded");
- if (elt) elt.style.display = "none";
- var elt = document.getElementById(id+"-expanded-linenums");
- if (elt) elt.style.display = "none";
- var elt = document.getElementById(id+"-collapsed-linenums");
- if (elt) { elt.innerHTML = "<br />"; elt.style.display="block"; }
- var elt = document.getElementById(id+"-toggle");
- if (elt) { elt.innerHTML = "+"; }
- var elt = document.getElementById(id+"-collapsed");
- if (elt) {
- elt.style.display = "block";
-
- var indent = elt.getAttribute("indent");
- var pad = elt.getAttribute("pad");
- var s = "<tt class='py-lineno'>";
- for (var i=0; i<pad.length; i++) { s += "&nbsp;" }
- s += "</tt>";
- s += "&nbsp;&nbsp;<tt class='py-line'>";
- for (var i=0; i<indent.length; i++) { s += "&nbsp;" }
- s += "<a href='#' onclick='expand(\"" + id;
- s += "\");return false'>...</a></tt><br />";
- elt.innerHTML = s;
- }
-}
-
-function toggle(id) {
- elt = document.getElementById(id+"-toggle");
- if (elt.innerHTML == "-")
- collapse(id);
- else
- expand(id);
- return false;
-}
-
-function highlight(id) {
- var elt = document.getElementById(id+"-def");
- if (elt) elt.className = "py-highlight-hdr";
- var elt = document.getElementById(id+"-expanded");
- if (elt) elt.className = "py-highlight";
- var elt = document.getElementById(id+"-collapsed");
- if (elt) elt.className = "py-highlight";
-}
-
-function num_lines(s) {
- var n = 1;
- var pos = s.indexOf("\n");
- while ( pos > 0) {
- n += 1;
- pos = s.indexOf("\n", pos+1);
- }
- return n;
-}
-
-// Collapse all blocks that mave more than `min_lines` lines.
-function collapse_all(min_lines) {
- var elts = document.getElementsByTagName("div");
- for (var i=0; i<elts.length; i++) {
- var elt = elts[i];
- var split = elt.id.indexOf("-");
- if (split > 0)
- if (elt.id.substring(split, elt.id.length) == "-expanded")
- if (num_lines(elt.innerHTML) > min_lines)
- collapse(elt.id.substring(0, split));
- }
-}
-
-function expandto(href) {
- var start = href.indexOf("#")+1;
- if (start != 0 && start != href.length) {
- if (href.substring(start, href.length) != "-") {
- collapse_all(4);
- pos = href.indexOf(".", start);
- while (pos != -1) {
- var id = href.substring(start, pos);
- expand(id);
- pos = href.indexOf(".", pos+1);
- }
- var id = href.substring(start, href.length);
- expand(id);
- highlight(id);
- }
- }
-}
-
-function kill_doclink(id) {
- var parent = document.getElementById(id);
- parent.removeChild(parent.childNodes.item(0));
-}
-function auto_kill_doclink(ev) {
- if (!ev) var ev = window.event;
- if (!this.contains(ev.toElement)) {
- var parent = document.getElementById(this.parentID);
- parent.removeChild(parent.childNodes.item(0));
- }
-}
-
-function doclink(id, name, targets_id) {
- var elt = document.getElementById(id);
-
- // If we already opened the box, then destroy it.
- // (This case should never occur, but leave it in just in case.)
- if (elt.childNodes.length > 1) {
- elt.removeChild(elt.childNodes.item(0));
- }
- else {
- // The outer box: relative + inline positioning.
- var box1 = document.createElement("div");
- box1.style.position = "relative";
- box1.style.display = "inline";
- box1.style.top = 0;
- box1.style.left = 0;
-
- // A shadow for fun
- var shadow = document.createElement("div");
- shadow.style.position = "absolute";
- shadow.style.left = "-1.3em";
- shadow.style.top = "-1.3em";
- shadow.style.background = "#404040";
-
- // The inner box: absolute positioning.
- var box2 = document.createElement("div");
- box2.style.position = "relative";
- box2.style.border = "1px solid #a0a0a0";
- box2.style.left = "-.2em";
- box2.style.top = "-.2em";
- box2.style.background = "white";
- box2.style.padding = ".3em .4em .3em .4em";
- box2.style.fontStyle = "normal";
- box2.onmouseout=auto_kill_doclink;
- box2.parentID = id;
-
- // Get the targets
- var targets_elt = document.getElementById(targets_id);
- var targets = targets_elt.getAttribute("targets");
- var links = "";
- target_list = targets.split(",");
- for (var i=0; i<target_list.length; i++) {
- var target = target_list[i].split("=");
- links += "<li><a href='" + target[1] +
- "' style='text-decoration:none'>" +
- target[0] + "</a></li>";
- }
-
- // Put it all together.
- elt.insertBefore(box1, elt.childNodes.item(0));
- //box1.appendChild(box2);
- box1.appendChild(shadow);
- shadow.appendChild(box2);
- box2.innerHTML =
- "Which <b>"+name+"</b> do you want to see documentation for?" +
- "<ul style='margin-bottom: 0;'>" +
- links +
- "<li><a href='#' style='text-decoration:none' " +
- "onclick='kill_doclink(\""+id+"\");return false;'>"+
- "<i>None of the above</i></a></li></ul>";
- }
- return false;
-}
-
-function get_anchor() {
- var href = location.href;
- var start = href.indexOf("#")+1;
- if ((start != 0) && (start != href.length))
- return href.substring(start, href.length);
- }
-function redirect_url(dottedName) {
- // Scan through each element of the "pages" list, and check
- // if "name" matches with any of them.
- for (var i=0; i<pages.length; i++) {
-
- // Each page has the form "<pagename>-m" or "<pagename>-c";
- // extract the <pagename> portion & compare it to dottedName.
- var pagename = pages[i].substring(0, pages[i].length-2);
- if (pagename == dottedName.substring(0,pagename.length)) {
-
- // We've found a page that matches `dottedName`;
- // construct its URL, using leftover `dottedName`
- // content to form an anchor.
- var pagetype = pages[i].charAt(pages[i].length-1);
- var url = pagename + ((pagetype=="m")?"-module.html":
- "-class.html");
- if (dottedName.length > pagename.length)
- url += "#" + dottedName.substring(pagename.length+1,
- dottedName.length);
- return url;
- }
- }
- }
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/help.html b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/help.html
deleted file mode 100644
index 729bb89a415..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/help.html
+++ /dev/null
@@ -1,261 +0,0 @@
-<?xml version="1.0" encoding="ascii"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Help</title>
- <link rel="stylesheet" href="epydoc.css" type="text/css" />
- <script type="text/javascript" src="epydoc.js"></script>
-</head>
-
-<body bgcolor="white" text="black" link="blue" vlink="#204080"
- alink="#204080">
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="rjsmin-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Help&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rjsmin/" target="_top">Visit rjsmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-<table width="100%" cellpadding="0" cellspacing="0">
- <tr valign="top">
- <td width="100%">&nbsp;</td>
- <td>
- <table cellpadding="0" cellspacing="0">
- <!-- hide/show private -->
- </table>
- </td>
- </tr>
-</table>
-
-<h1 class="epydoc"> API Documentation </h1>
-
-<p> This document contains the API (Application Programming Interface)
-documentation for this project. Documentation for the Python
-objects defined by the project is divided into separate pages for each
-package, module, and class. The API documentation also includes two
-pages containing information about the project as a whole: a trees
-page, and an index page. </p>
-
-<h2> Object Documentation </h2>
-
- <p>Each <strong>Package Documentation</strong> page contains: </p>
- <ul>
- <li> A description of the package. </li>
- <li> A list of the modules and sub-packages contained by the
- package. </li>
- <li> A summary of the classes defined by the package. </li>
- <li> A summary of the functions defined by the package. </li>
- <li> A summary of the variables defined by the package. </li>
- <li> A detailed description of each function defined by the
- package. </li>
- <li> A detailed description of each variable defined by the
- package. </li>
- </ul>
-
- <p>Each <strong>Module Documentation</strong> page contains:</p>
- <ul>
- <li> A description of the module. </li>
- <li> A summary of the classes defined by the module. </li>
- <li> A summary of the functions defined by the module. </li>
- <li> A summary of the variables defined by the module. </li>
- <li> A detailed description of each function defined by the
- module. </li>
- <li> A detailed description of each variable defined by the
- module. </li>
- </ul>
-
- <p>Each <strong>Class Documentation</strong> page contains: </p>
- <ul>
- <li> A class inheritance diagram. </li>
- <li> A list of known subclasses. </li>
- <li> A description of the class. </li>
- <li> A summary of the methods defined by the class. </li>
- <li> A summary of the instance variables defined by the class. </li>
- <li> A summary of the class (static) variables defined by the
- class. </li>
- <li> A detailed description of each method defined by the
- class. </li>
- <li> A detailed description of each instance variable defined by the
- class. </li>
- <li> A detailed description of each class (static) variable defined
- by the class. </li>
- </ul>
-
-<h2> Project Documentation </h2>
-
- <p> The <strong>Trees</strong> page contains the module and class hierarchies: </p>
- <ul>
- <li> The <em>module hierarchy</em> lists every package and module, with
- modules grouped into packages. At the top level, and within each
- package, modules and sub-packages are listed alphabetically. </li>
- <li> The <em>class hierarchy</em> lists every class, grouped by base
- class. If a class has more than one base class, then it will be
- listed under each base class. At the top level, and under each base
- class, classes are listed alphabetically. </li>
- </ul>
-
- <p> The <strong>Index</strong> page contains indices of terms and
- identifiers: </p>
- <ul>
- <li> The <em>term index</em> lists every term indexed by any object's
- documentation. For each term, the index provides links to each
- place where the term is indexed. </li>
- <li> The <em>identifier index</em> lists the (short) name of every package,
- module, class, method, function, variable, and parameter. For each
- identifier, the index provides a short description, and a link to
- its documentation. </li>
- </ul>
-
-<h2> The Table of Contents </h2>
-
-<p> The table of contents occupies the two frames on the left side of
-the window. The upper-left frame displays the <em>project
-contents</em>, and the lower-left frame displays the <em>module
-contents</em>: </p>
-
-<table class="help summary" border="1" cellspacing="0" cellpadding="3">
- <tr style="height: 30%">
- <td align="center" style="font-size: small">
- Project<br />Contents<hr />...</td>
- <td align="center" style="font-size: small" rowspan="2" width="70%">
- API<br />Documentation<br />Frame<br /><br /><br />
- </td>
- </tr>
- <tr>
- <td align="center" style="font-size: small">
- Module<br />Contents<hr />&nbsp;<br />...<br />&nbsp;
- </td>
- </tr>
-</table><br />
-
-<p> The <strong>project contents frame</strong> contains a list of all packages
-and modules that are defined by the project. Clicking on an entry
-will display its contents in the module contents frame. Clicking on a
-special entry, labeled "Everything," will display the contents of
-the entire project. </p>
-
-<p> The <strong>module contents frame</strong> contains a list of every
-submodule, class, type, exception, function, and variable defined by a
-module or package. Clicking on an entry will display its
-documentation in the API documentation frame. Clicking on the name of
-the module, at the top of the frame, will display the documentation
-for the module itself. </p>
-
-<p> The "<strong>frames</strong>" and "<strong>no frames</strong>" buttons below the top
-navigation bar can be used to control whether the table of contents is
-displayed or not. </p>
-
-<h2> The Navigation Bar </h2>
-
-<p> A navigation bar is located at the top and bottom of every page.
-It indicates what type of page you are currently viewing, and allows
-you to go to related pages. The following table describes the labels
-on the navigation bar. Note that not some labels (such as
-[Parent]) are not displayed on all pages. </p>
-
-<table class="summary" border="1" cellspacing="0" cellpadding="3" width="100%">
-<tr class="summary">
- <th>Label</th>
- <th>Highlighted when...</th>
- <th>Links to...</th>
-</tr>
- <tr><td valign="top"><strong>[Parent]</strong></td>
- <td valign="top"><em>(never highlighted)</em></td>
- <td valign="top"> the parent of the current package </td></tr>
- <tr><td valign="top"><strong>[Package]</strong></td>
- <td valign="top">viewing a package</td>
- <td valign="top">the package containing the current object
- </td></tr>
- <tr><td valign="top"><strong>[Module]</strong></td>
- <td valign="top">viewing a module</td>
- <td valign="top">the module containing the current object
- </td></tr>
- <tr><td valign="top"><strong>[Class]</strong></td>
- <td valign="top">viewing a class </td>
- <td valign="top">the class containing the current object</td></tr>
- <tr><td valign="top"><strong>[Trees]</strong></td>
- <td valign="top">viewing the trees page</td>
- <td valign="top"> the trees page </td></tr>
- <tr><td valign="top"><strong>[Index]</strong></td>
- <td valign="top">viewing the index page</td>
- <td valign="top"> the index page </td></tr>
- <tr><td valign="top"><strong>[Help]</strong></td>
- <td valign="top">viewing the help page</td>
- <td valign="top"> the help page </td></tr>
-</table>
-
-<p> The "<strong>show private</strong>" and "<strong>hide private</strong>" buttons below
-the top navigation bar can be used to control whether documentation
-for private objects is displayed. Private objects are usually defined
-as objects whose (short) names begin with a single underscore, but do
-not end with an underscore. For example, "<code>_x</code>",
-"<code>__pprint</code>", and "<code>epydoc.epytext._tokenize</code>"
-are private objects; but "<code>re.sub</code>",
-"<code>__init__</code>", and "<code>type_</code>" are not. However,
-if a module defines the "<code>__all__</code>" variable, then its
-contents are used to decide which objects are private. </p>
-
-<p> A timestamp below the bottom navigation bar indicates when each
-page was last updated. </p>
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="rjsmin-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Help&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rjsmin/" target="_top">Visit rjsmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-
-<script type="text/javascript">
- <!--
- // Private objects are initially displayed (because if
- // javascript is turned off then we want them to be
- // visible); but by default, we want to hide them. So hide
- // them unless we have a cookie that says to show them.
- checkCookie();
- // -->
-</script>
-</body>
-</html>
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/identifier-index.html b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/identifier-index.html
deleted file mode 100644
index 37b4b984d89..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/identifier-index.html
+++ /dev/null
@@ -1,163 +0,0 @@
-<?xml version="1.0" encoding="ascii"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Identifier Index</title>
- <link rel="stylesheet" href="epydoc.css" type="text/css" />
- <script type="text/javascript" src="epydoc.js"></script>
-</head>
-
-<body bgcolor="white" text="black" link="blue" vlink="#204080"
- alink="#204080">
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="rjsmin-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Indices&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rjsmin/" target="_top">Visit rjsmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-<table width="100%" cellpadding="0" cellspacing="0">
- <tr valign="top">
- <td width="100%">&nbsp;</td>
- <td>
- <table cellpadding="0" cellspacing="0">
- <!-- hide/show private -->
- </table>
- </td>
- </tr>
-</table>
-<table border="0" width="100%">
-<tr valign="bottom"><td>
-<h1 class="epydoc">Identifier Index</h1>
-</td><td>
-[
- A
- B
- C
- D
- E
- F
- G
- H
- I
- <a href="#J">J</a>
- K
- L
- M
- N
- O
- P
- Q
- <a href="#R">R</a>
- S
- T
- U
- V
- W
- X
- Y
- Z
- <a href="#_">_</a>
-]
-</td></table>
-<table border="0" width="100%">
-<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="J">J</a></h2></td>
-<td valign="top">
-<table class="link-index" width="100%" border="1">
-<tr>
-<td width="33%" class="link-index"><a href="rjsmin-module.html#jsmin">jsmin()</a><br />
-<span class="index-where">(in&nbsp;<a href="rjsmin-module.html">rjsmin</a>)</span></td>
-<td width="33%" class="link-index">&nbsp;</td>
-<td width="33%" class="link-index">&nbsp;</td>
-</tr>
-<tr><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td></tr>
-</table>
-</td></tr>
-<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="R">R</a></h2></td>
-<td valign="top">
-<table class="link-index" width="100%" border="1">
-<tr>
-<td width="33%" class="link-index"><a href="rjsmin-module.html">rjsmin</a></td>
-<td width="33%" class="link-index">&nbsp;</td>
-<td width="33%" class="link-index">&nbsp;</td>
-</tr>
-<tr><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td></tr>
-</table>
-</td></tr>
-<tr valign="top"><td valign="top" width="1%"><h2 class="epydoc"><a name="_">_</a></h2></td>
-<td valign="top">
-<table class="link-index" width="100%" border="1">
-<tr>
-<td width="33%" class="link-index"><a href="rjsmin-module.html#__doc__">__doc__</a><br />
-<span class="index-where">(in&nbsp;<a href="rjsmin-module.html">rjsmin</a>)</span></td>
-<td width="33%" class="link-index"><a href="rjsmin-module.html#__license__">__license__</a><br />
-<span class="index-where">(in&nbsp;<a href="rjsmin-module.html">rjsmin</a>)</span></td>
-<td width="33%" class="link-index"><a href="rjsmin-module.html#__package__">__package__</a><br />
-<span class="index-where">(in&nbsp;<a href="rjsmin-module.html">rjsmin</a>)</span></td>
-</tr>
-<tr><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td><td class="link-index">&nbsp;</td></tr>
-</table>
-</td></tr>
-</table>
-<br /><br /><!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="rjsmin-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Indices&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rjsmin/" target="_top">Visit rjsmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-
-<script type="text/javascript">
- <!--
- // Private objects are initially displayed (because if
- // javascript is turned off then we want them to be
- // visible); but by default, we want to hide them. So hide
- // them unless we have a cookie that says to show them.
- checkCookie();
- // -->
-</script>
-</body>
-</html>
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/index.html b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/index.html
deleted file mode 100644
index 70f36d3efa7..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/index.html
+++ /dev/null
@@ -1,219 +0,0 @@
-<?xml version="1.0" encoding="ascii"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>rjsmin</title>
- <link rel="stylesheet" href="epydoc.css" type="text/css" />
- <script type="text/javascript" src="epydoc.js"></script>
-</head>
-
-<body bgcolor="white" text="black" link="blue" vlink="#204080"
- alink="#204080">
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rjsmin/" target="_top">Visit rjsmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-<table width="100%" cellpadding="0" cellspacing="0">
- <tr valign="top">
- <td width="100%">
- <span class="breadcrumbs">
- Module&nbsp;rjsmin
- </span>
- </td>
- <td>
- <table cellpadding="0" cellspacing="0">
- <!-- hide/show private -->
- </table>
- </td>
- </tr>
-</table>
-<!-- ==================== MODULE DESCRIPTION ==================== -->
-<h1 class="epydoc">Module rjsmin</h1><p class="nomargin-top"><span class="codelink"><a href="rjsmin-pysrc.html">source&nbsp;code</a></span></p>
-<p>rJSmin is a javascript minifier written in python.</p>
-<p>The minifier is based on the semantics of <a class="rst-reference external" href="http://www.crockford.com/javascript/jsmin.c" target="_top">jsmin.c by Douglas Crockford</a>.</p>
-<p>The module is a re-implementation aiming for speed, so it can be used at
-runtime (rather than during a preprocessing step). Usually it produces the
-same results as the original <tt class="rst-docutils literal">jsmin.c</tt>. It differs in the following ways:</p>
-<ul class="rst-simple">
-<li>there is no error detection: unterminated string, regex and comment
-literals are treated as regular javascript code and minified as such.</li>
-<li>Control characters inside string and regex literals are left untouched; they
-are not converted to spaces (nor to n)</li>
-<li>Newline characters are not allowed inside string and regex literals, except
-for line continuations in string literals (ECMA-5).</li>
-<li>&quot;return /regex/&quot; is recognized correctly.</li>
-<li>&quot;+ +&quot; and &quot;- -&quot; sequences are not collapsed to '++' or '--'</li>
-<li>Newlines before ! operators are removed more sensibly</li>
-<li>Comments starting with an exclamation mark (<tt class="rst-docutils literal">!</tt>) can be kept optionally</li>
-<li>rJSmin does not handle streams, but only complete strings. (However, the
-module provides a &quot;streamy&quot; interface).</li>
-</ul>
-<p>Since most parts of the logic are handled by the regex engine it's way faster
-than the original python port of <tt class="rst-docutils literal">jsmin.c</tt> by Baruch Even. The speed factor
-varies between about 6 and 55 depending on input and python version (it gets
-faster the more compressed the input already is). Compared to the
-speed-refactored python port by Dave St.Germain the performance gain is less
-dramatic but still between 3 and 50 (for huge inputs). See the docs/BENCHMARKS
-file for details.</p>
-<p>rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more.</p>
-<p>Both python 2 and python 3 are supported.</p>
-
-<hr />
-<div class="fields"> <p><strong>Copyright:</strong>
- Copyright 2011 - 2014
-Andr&#233; Malo or his licensors, as applicable
- </p>
- <p><strong>License:</strong>
- <p>Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at</p>
-<blockquote>
-<a class="rst-reference external" href="http://www.apache.org/licenses/LICENSE-2.0" target="_top">http://www.apache.org/licenses/LICENSE-2.0</a></blockquote>
-<p>Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.</p>
- </p>
- <p><strong>Version:</strong>
- 1.0.10
- </p>
- <p><strong>Author:</strong>
- Andr&#233; Malo
- </p>
-</div><!-- ==================== FUNCTIONS ==================== -->
-<a name="section-Functions"></a>
-<table class="summary" border="1" cellpadding="3"
- cellspacing="0" width="100%" bgcolor="white">
-<tr bgcolor="#70b0f0" class="table-header">
- <td align="left" colspan="2" class="table-header">
- <span class="table-header">Functions</span></td>
-</tr>
-<tr>
- <td width="15%" align="right" valign="top" class="summary">
- <span class="summary-type"><tt class="rst-docutils literal">str</tt></span>
- </td><td class="summary">
- <table width="100%" cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td><span class="summary-sig"><a href="rjsmin-module.html#jsmin" class="summary-sig-name">jsmin</a>(<span class="summary-sig-arg">script</span>,
- <span class="summary-sig-arg">keep_bang_comments</span>=<span class="summary-sig-default">False</span>)</span><br />
- Minify javascript based on <a class="rst-reference external" href="http://www.crockford.com/javascript/jsmin.c" target="_top">jsmin.c by Douglas Crockford</a>.</td>
- <td align="right" valign="top">
-
-
- </td>
- </tr>
- </table>
-
- </td>
- </tr>
-</table>
-<!-- ==================== FUNCTION DETAILS ==================== -->
-<a name="section-FunctionDetails"></a>
-<table class="details" border="1" cellpadding="3"
- cellspacing="0" width="100%" bgcolor="white">
-<tr bgcolor="#70b0f0" class="table-header">
- <td align="left" colspan="2" class="table-header">
- <span class="table-header">Function Details</span></td>
-</tr>
-</table>
-<a name="jsmin"></a>
-<div>
-<table class="details" border="1" cellpadding="3"
- cellspacing="0" width="100%" bgcolor="white">
-<tr><td>
- <table width="100%" cellpadding="0" cellspacing="0" border="0">
- <tr valign="top"><td>
- <h3 class="epydoc"><span class="sig"><span class="sig-name">jsmin</span>(<span class="sig-arg">script</span>,
- <span class="sig-arg">keep_bang_comments</span>=<span class="sig-default">False</span>)</span>
- </h3>
- </td><td align="right" valign="top"
- >&nbsp;
- </td>
- </tr></table>
-
- <p>Minify javascript based on <a class="rst-reference external" href="http://www.crockford.com/javascript/jsmin.c" target="_top">jsmin.c by Douglas Crockford</a>.</p>
-<p>Instead of parsing the stream char by char, it uses a regular
-expression approach which minifies the whole script with one big
-substitution regex.</p>
- <dl class="fields">
- <dt>Parameters:</dt>
- <dd><ul class="nomargin-top">
- <li><strong class="pname"><code>script</code></strong> (<tt class="rst-docutils literal">str</tt>) - Script to minify</li>
- <li><strong class="pname"><code>keep_bang_comments</code></strong> (<tt class="rst-docutils literal">bool</tt>) - Keep comments starting with an exclamation mark? (<tt class="rst-docutils literal"><span class="pre">/*!...*/</span></tt>)</li>
- </ul></dd>
- <dt>Returns: <tt class="rst-docutils literal">str</tt></dt>
- <dd>Minified script</dd>
- </dl>
-<div class="fields"> <p><strong>Note:</strong>
- This is a hand crafted C implementation built on the regex
-semantics.
- </p>
-</div></td></tr></table>
-</div>
-<br />
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rjsmin/" target="_top">Visit rjsmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-
-<script type="text/javascript">
- <!--
- // Private objects are initially displayed (because if
- // javascript is turned off then we want them to be
- // visible); but by default, we want to hide them. So hide
- // them unless we have a cookie that says to show them.
- checkCookie();
- // -->
-</script>
-</body>
-</html>
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/module-tree.html b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/module-tree.html
deleted file mode 100644
index d89305d211c..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/module-tree.html
+++ /dev/null
@@ -1,94 +0,0 @@
-<?xml version="1.0" encoding="ascii"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>Module Hierarchy</title>
- <link rel="stylesheet" href="epydoc.css" type="text/css" />
- <script type="text/javascript" src="epydoc.js"></script>
-</head>
-
-<body bgcolor="white" text="black" link="blue" vlink="#204080"
- alink="#204080">
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="rjsmin-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Trees&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rjsmin/" target="_top">Visit rjsmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-<table width="100%" cellpadding="0" cellspacing="0">
- <tr valign="top">
- <td width="100%">&nbsp;</td>
- <td>
- <table cellpadding="0" cellspacing="0">
- <!-- hide/show private -->
- </table>
- </td>
- </tr>
-</table>
-<h1 class="epydoc">Module Hierarchy</h1>
-<ul class="nomargin-top">
- <li> <strong class="uidlink"><a href="rjsmin-module.html">rjsmin</a></strong>: <em class="summary">rJSmin is a javascript minifier written in python.</em> </li>
-</ul>
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="rjsmin-module.html">Home</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Trees&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rjsmin/" target="_top">Visit rjsmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-
-<script type="text/javascript">
- <!--
- // Private objects are initially displayed (because if
- // javascript is turned off then we want them to be
- // visible); but by default, we want to hide them. So hide
- // them unless we have a cookie that says to show them.
- checkCookie();
- // -->
-</script>
-</body>
-</html>
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/redirect.html b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/redirect.html
deleted file mode 100644
index 50aee0e9f95..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/redirect.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<html><head><title>Epydoc Redirect Page</title>
-<meta http-equiv="cache-control" content="no-cache" />
-<meta http-equiv="expires" content="0" />
-<meta http-equiv="pragma" content="no-cache" />
- <script type="text/javascript" src="epydoc.js"></script>
-</head>
-<body>
-<script type="text/javascript">
-<!--
-var pages = ["rjsmin-m"];
-var dottedName = get_anchor();
-if (dottedName) {
- var target = redirect_url(dottedName);
- if (target) window.location.replace(target);
-}
-// -->
-</script>
-
-<h3>Epydoc Auto-redirect page</h3>
-
-<p>When javascript is enabled, this page will redirect URLs of
-the form <tt>redirect.html#<i>dotted.name</i></tt> to the
-documentation for the object with the given fully-qualified
-dotted name.</p>
-<p><a id="message"> &nbsp; </a></p>
-
-<script type="text/javascript">
-<!--
-if (dottedName) {
- var msg = document.getElementById("message");
- msg.innerHTML = "No documentation found for <tt>"+
- dottedName+"</tt>";
-}
-// -->
-</script>
-
-</body>
-</html>
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/rjsmin-module.html b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/rjsmin-module.html
deleted file mode 100644
index 70f36d3efa7..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/rjsmin-module.html
+++ /dev/null
@@ -1,219 +0,0 @@
-<?xml version="1.0" encoding="ascii"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>rjsmin</title>
- <link rel="stylesheet" href="epydoc.css" type="text/css" />
- <script type="text/javascript" src="epydoc.js"></script>
-</head>
-
-<body bgcolor="white" text="black" link="blue" vlink="#204080"
- alink="#204080">
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rjsmin/" target="_top">Visit rjsmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-<table width="100%" cellpadding="0" cellspacing="0">
- <tr valign="top">
- <td width="100%">
- <span class="breadcrumbs">
- Module&nbsp;rjsmin
- </span>
- </td>
- <td>
- <table cellpadding="0" cellspacing="0">
- <!-- hide/show private -->
- </table>
- </td>
- </tr>
-</table>
-<!-- ==================== MODULE DESCRIPTION ==================== -->
-<h1 class="epydoc">Module rjsmin</h1><p class="nomargin-top"><span class="codelink"><a href="rjsmin-pysrc.html">source&nbsp;code</a></span></p>
-<p>rJSmin is a javascript minifier written in python.</p>
-<p>The minifier is based on the semantics of <a class="rst-reference external" href="http://www.crockford.com/javascript/jsmin.c" target="_top">jsmin.c by Douglas Crockford</a>.</p>
-<p>The module is a re-implementation aiming for speed, so it can be used at
-runtime (rather than during a preprocessing step). Usually it produces the
-same results as the original <tt class="rst-docutils literal">jsmin.c</tt>. It differs in the following ways:</p>
-<ul class="rst-simple">
-<li>there is no error detection: unterminated string, regex and comment
-literals are treated as regular javascript code and minified as such.</li>
-<li>Control characters inside string and regex literals are left untouched; they
-are not converted to spaces (nor to n)</li>
-<li>Newline characters are not allowed inside string and regex literals, except
-for line continuations in string literals (ECMA-5).</li>
-<li>&quot;return /regex/&quot; is recognized correctly.</li>
-<li>&quot;+ +&quot; and &quot;- -&quot; sequences are not collapsed to '++' or '--'</li>
-<li>Newlines before ! operators are removed more sensibly</li>
-<li>Comments starting with an exclamation mark (<tt class="rst-docutils literal">!</tt>) can be kept optionally</li>
-<li>rJSmin does not handle streams, but only complete strings. (However, the
-module provides a &quot;streamy&quot; interface).</li>
-</ul>
-<p>Since most parts of the logic are handled by the regex engine it's way faster
-than the original python port of <tt class="rst-docutils literal">jsmin.c</tt> by Baruch Even. The speed factor
-varies between about 6 and 55 depending on input and python version (it gets
-faster the more compressed the input already is). Compared to the
-speed-refactored python port by Dave St.Germain the performance gain is less
-dramatic but still between 3 and 50 (for huge inputs). See the docs/BENCHMARKS
-file for details.</p>
-<p>rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more.</p>
-<p>Both python 2 and python 3 are supported.</p>
-
-<hr />
-<div class="fields"> <p><strong>Copyright:</strong>
- Copyright 2011 - 2014
-Andr&#233; Malo or his licensors, as applicable
- </p>
- <p><strong>License:</strong>
- <p>Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at</p>
-<blockquote>
-<a class="rst-reference external" href="http://www.apache.org/licenses/LICENSE-2.0" target="_top">http://www.apache.org/licenses/LICENSE-2.0</a></blockquote>
-<p>Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.</p>
- </p>
- <p><strong>Version:</strong>
- 1.0.10
- </p>
- <p><strong>Author:</strong>
- Andr&#233; Malo
- </p>
-</div><!-- ==================== FUNCTIONS ==================== -->
-<a name="section-Functions"></a>
-<table class="summary" border="1" cellpadding="3"
- cellspacing="0" width="100%" bgcolor="white">
-<tr bgcolor="#70b0f0" class="table-header">
- <td align="left" colspan="2" class="table-header">
- <span class="table-header">Functions</span></td>
-</tr>
-<tr>
- <td width="15%" align="right" valign="top" class="summary">
- <span class="summary-type"><tt class="rst-docutils literal">str</tt></span>
- </td><td class="summary">
- <table width="100%" cellpadding="0" cellspacing="0" border="0">
- <tr>
- <td><span class="summary-sig"><a href="rjsmin-module.html#jsmin" class="summary-sig-name">jsmin</a>(<span class="summary-sig-arg">script</span>,
- <span class="summary-sig-arg">keep_bang_comments</span>=<span class="summary-sig-default">False</span>)</span><br />
- Minify javascript based on <a class="rst-reference external" href="http://www.crockford.com/javascript/jsmin.c" target="_top">jsmin.c by Douglas Crockford</a>.</td>
- <td align="right" valign="top">
-
-
- </td>
- </tr>
- </table>
-
- </td>
- </tr>
-</table>
-<!-- ==================== FUNCTION DETAILS ==================== -->
-<a name="section-FunctionDetails"></a>
-<table class="details" border="1" cellpadding="3"
- cellspacing="0" width="100%" bgcolor="white">
-<tr bgcolor="#70b0f0" class="table-header">
- <td align="left" colspan="2" class="table-header">
- <span class="table-header">Function Details</span></td>
-</tr>
-</table>
-<a name="jsmin"></a>
-<div>
-<table class="details" border="1" cellpadding="3"
- cellspacing="0" width="100%" bgcolor="white">
-<tr><td>
- <table width="100%" cellpadding="0" cellspacing="0" border="0">
- <tr valign="top"><td>
- <h3 class="epydoc"><span class="sig"><span class="sig-name">jsmin</span>(<span class="sig-arg">script</span>,
- <span class="sig-arg">keep_bang_comments</span>=<span class="sig-default">False</span>)</span>
- </h3>
- </td><td align="right" valign="top"
- >&nbsp;
- </td>
- </tr></table>
-
- <p>Minify javascript based on <a class="rst-reference external" href="http://www.crockford.com/javascript/jsmin.c" target="_top">jsmin.c by Douglas Crockford</a>.</p>
-<p>Instead of parsing the stream char by char, it uses a regular
-expression approach which minifies the whole script with one big
-substitution regex.</p>
- <dl class="fields">
- <dt>Parameters:</dt>
- <dd><ul class="nomargin-top">
- <li><strong class="pname"><code>script</code></strong> (<tt class="rst-docutils literal">str</tt>) - Script to minify</li>
- <li><strong class="pname"><code>keep_bang_comments</code></strong> (<tt class="rst-docutils literal">bool</tt>) - Keep comments starting with an exclamation mark? (<tt class="rst-docutils literal"><span class="pre">/*!...*/</span></tt>)</li>
- </ul></dd>
- <dt>Returns: <tt class="rst-docutils literal">str</tt></dt>
- <dd>Minified script</dd>
- </dl>
-<div class="fields"> <p><strong>Note:</strong>
- This is a hand crafted C implementation built on the regex
-semantics.
- </p>
-</div></td></tr></table>
-</div>
-<br />
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rjsmin/" target="_top">Visit rjsmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-
-<script type="text/javascript">
- <!--
- // Private objects are initially displayed (because if
- // javascript is turned off then we want them to be
- // visible); but by default, we want to hide them. So hide
- // them unless we have a cookie that says to show them.
- checkCookie();
- // -->
-</script>
-</body>
-</html>
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/rjsmin-pysrc.html b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/rjsmin-pysrc.html
deleted file mode 100644
index fe4f283d190..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/docs/apidoc/rjsmin-pysrc.html
+++ /dev/null
@@ -1,549 +0,0 @@
-<?xml version="1.0" encoding="ascii"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <title>rjsmin</title>
- <link rel="stylesheet" href="epydoc.css" type="text/css" />
- <script type="text/javascript" src="epydoc.js"></script>
-</head>
-
-<body bgcolor="white" text="black" link="blue" vlink="#204080"
- alink="#204080">
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rjsmin/" target="_top">Visit rjsmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-<table width="100%" cellpadding="0" cellspacing="0">
- <tr valign="top">
- <td width="100%">
- <span class="breadcrumbs">
- Module&nbsp;rjsmin
- </span>
- </td>
- <td>
- <table cellpadding="0" cellspacing="0">
- <!-- hide/show private -->
- </table>
- </td>
- </tr>
-</table>
-<h1 class="epydoc">Source Code for <a href="rjsmin-module.html">Module rjsmin</a></h1>
-<pre class="py-src">
-<a name="L1"></a><tt class="py-lineno"> 1</tt> <tt class="py-line"><tt class="py-comment">#!/usr/bin/env python</tt> </tt>
-<a name="L2"></a><tt class="py-lineno"> 2</tt> <tt class="py-line"><tt class="py-comment"># -*- coding: ascii -*-</tt> </tt>
-<a name="L3"></a><tt class="py-lineno"> 3</tt> <tt class="py-line"><tt class="py-docstring">r"""</tt> </tt>
-<a name="L4"></a><tt class="py-lineno"> 4</tt> <tt class="py-line"><tt class="py-docstring">=====================</tt> </tt>
-<a name="L5"></a><tt class="py-lineno"> 5</tt> <tt class="py-line"><tt class="py-docstring"> Javascript Minifier</tt> </tt>
-<a name="L6"></a><tt class="py-lineno"> 6</tt> <tt class="py-line"><tt class="py-docstring">=====================</tt> </tt>
-<a name="L7"></a><tt class="py-lineno"> 7</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L8"></a><tt class="py-lineno"> 8</tt> <tt class="py-line"><tt class="py-docstring">rJSmin is a javascript minifier written in python.</tt> </tt>
-<a name="L9"></a><tt class="py-lineno"> 9</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L10"></a><tt class="py-lineno"> 10</tt> <tt class="py-line"><tt class="py-docstring">The minifier is based on the semantics of `jsmin.c by Douglas Crockford`_\\.</tt> </tt>
-<a name="L11"></a><tt class="py-lineno"> 11</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L12"></a><tt class="py-lineno"> 12</tt> <tt class="py-line"><tt class="py-docstring">:Copyright:</tt> </tt>
-<a name="L13"></a><tt class="py-lineno"> 13</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L14"></a><tt class="py-lineno"> 14</tt> <tt class="py-line"><tt class="py-docstring"> Copyright 2011 - 2014</tt> </tt>
-<a name="L15"></a><tt class="py-lineno"> 15</tt> <tt class="py-line"><tt class="py-docstring"> Andr\xe9 Malo or his licensors, as applicable</tt> </tt>
-<a name="L16"></a><tt class="py-lineno"> 16</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L17"></a><tt class="py-lineno"> 17</tt> <tt class="py-line"><tt class="py-docstring">:License:</tt> </tt>
-<a name="L18"></a><tt class="py-lineno"> 18</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L19"></a><tt class="py-lineno"> 19</tt> <tt class="py-line"><tt class="py-docstring"> Licensed under the Apache License, Version 2.0 (the "License");</tt> </tt>
-<a name="L20"></a><tt class="py-lineno"> 20</tt> <tt class="py-line"><tt class="py-docstring"> you may not use this file except in compliance with the License.</tt> </tt>
-<a name="L21"></a><tt class="py-lineno"> 21</tt> <tt class="py-line"><tt class="py-docstring"> You may obtain a copy of the License at</tt> </tt>
-<a name="L22"></a><tt class="py-lineno"> 22</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L23"></a><tt class="py-lineno"> 23</tt> <tt class="py-line"><tt class="py-docstring"> http://www.apache.org/licenses/LICENSE-2.0</tt> </tt>
-<a name="L24"></a><tt class="py-lineno"> 24</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L25"></a><tt class="py-lineno"> 25</tt> <tt class="py-line"><tt class="py-docstring"> Unless required by applicable law or agreed to in writing, software</tt> </tt>
-<a name="L26"></a><tt class="py-lineno"> 26</tt> <tt class="py-line"><tt class="py-docstring"> distributed under the License is distributed on an "AS IS" BASIS,</tt> </tt>
-<a name="L27"></a><tt class="py-lineno"> 27</tt> <tt class="py-line"><tt class="py-docstring"> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</tt> </tt>
-<a name="L28"></a><tt class="py-lineno"> 28</tt> <tt class="py-line"><tt class="py-docstring"> See the License for the specific language governing permissions and</tt> </tt>
-<a name="L29"></a><tt class="py-lineno"> 29</tt> <tt class="py-line"><tt class="py-docstring"> limitations under the License.</tt> </tt>
-<a name="L30"></a><tt class="py-lineno"> 30</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L31"></a><tt class="py-lineno"> 31</tt> <tt class="py-line"><tt class="py-docstring">The module is a re-implementation aiming for speed, so it can be used at</tt> </tt>
-<a name="L32"></a><tt class="py-lineno"> 32</tt> <tt class="py-line"><tt class="py-docstring">runtime (rather than during a preprocessing step). Usually it produces the</tt> </tt>
-<a name="L33"></a><tt class="py-lineno"> 33</tt> <tt class="py-line"><tt class="py-docstring">same results as the original ``jsmin.c``. It differs in the following ways:</tt> </tt>
-<a name="L34"></a><tt class="py-lineno"> 34</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L35"></a><tt class="py-lineno"> 35</tt> <tt class="py-line"><tt class="py-docstring">- there is no error detection: unterminated string, regex and comment</tt> </tt>
-<a name="L36"></a><tt class="py-lineno"> 36</tt> <tt class="py-line"><tt class="py-docstring"> literals are treated as regular javascript code and minified as such.</tt> </tt>
-<a name="L37"></a><tt class="py-lineno"> 37</tt> <tt class="py-line"><tt class="py-docstring">- Control characters inside string and regex literals are left untouched; they</tt> </tt>
-<a name="L38"></a><tt class="py-lineno"> 38</tt> <tt class="py-line"><tt class="py-docstring"> are not converted to spaces (nor to \\n)</tt> </tt>
-<a name="L39"></a><tt class="py-lineno"> 39</tt> <tt class="py-line"><tt class="py-docstring">- Newline characters are not allowed inside string and regex literals, except</tt> </tt>
-<a name="L40"></a><tt class="py-lineno"> 40</tt> <tt class="py-line"><tt class="py-docstring"> for line continuations in string literals (ECMA-5).</tt> </tt>
-<a name="L41"></a><tt class="py-lineno"> 41</tt> <tt class="py-line"><tt class="py-docstring">- "return /regex/" is recognized correctly.</tt> </tt>
-<a name="L42"></a><tt class="py-lineno"> 42</tt> <tt class="py-line"><tt class="py-docstring">- "+ +" and "- -" sequences are not collapsed to '++' or '--'</tt> </tt>
-<a name="L43"></a><tt class="py-lineno"> 43</tt> <tt class="py-line"><tt class="py-docstring">- Newlines before ! operators are removed more sensibly</tt> </tt>
-<a name="L44"></a><tt class="py-lineno"> 44</tt> <tt class="py-line"><tt class="py-docstring">- Comments starting with an exclamation mark (``!``) can be kept optionally</tt> </tt>
-<a name="L45"></a><tt class="py-lineno"> 45</tt> <tt class="py-line"><tt class="py-docstring">- rJSmin does not handle streams, but only complete strings. (However, the</tt> </tt>
-<a name="L46"></a><tt class="py-lineno"> 46</tt> <tt class="py-line"><tt class="py-docstring"> module provides a "streamy" interface).</tt> </tt>
-<a name="L47"></a><tt class="py-lineno"> 47</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L48"></a><tt class="py-lineno"> 48</tt> <tt class="py-line"><tt class="py-docstring">Since most parts of the logic are handled by the regex engine it's way faster</tt> </tt>
-<a name="L49"></a><tt class="py-lineno"> 49</tt> <tt class="py-line"><tt class="py-docstring">than the original python port of ``jsmin.c`` by Baruch Even. The speed factor</tt> </tt>
-<a name="L50"></a><tt class="py-lineno"> 50</tt> <tt class="py-line"><tt class="py-docstring">varies between about 6 and 55 depending on input and python version (it gets</tt> </tt>
-<a name="L51"></a><tt class="py-lineno"> 51</tt> <tt class="py-line"><tt class="py-docstring">faster the more compressed the input already is). Compared to the</tt> </tt>
-<a name="L52"></a><tt class="py-lineno"> 52</tt> <tt class="py-line"><tt class="py-docstring">speed-refactored python port by Dave St.Germain the performance gain is less</tt> </tt>
-<a name="L53"></a><tt class="py-lineno"> 53</tt> <tt class="py-line"><tt class="py-docstring">dramatic but still between 3 and 50 (for huge inputs). See the docs/BENCHMARKS</tt> </tt>
-<a name="L54"></a><tt class="py-lineno"> 54</tt> <tt class="py-line"><tt class="py-docstring">file for details.</tt> </tt>
-<a name="L55"></a><tt class="py-lineno"> 55</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L56"></a><tt class="py-lineno"> 56</tt> <tt class="py-line"><tt class="py-docstring">rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more.</tt> </tt>
-<a name="L57"></a><tt class="py-lineno"> 57</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L58"></a><tt class="py-lineno"> 58</tt> <tt class="py-line"><tt class="py-docstring">Both python 2 and python 3 are supported.</tt> </tt>
-<a name="L59"></a><tt class="py-lineno"> 59</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L60"></a><tt class="py-lineno"> 60</tt> <tt class="py-line"><tt class="py-docstring">.. _jsmin.c by Douglas Crockford:</tt> </tt>
-<a name="L61"></a><tt class="py-lineno"> 61</tt> <tt class="py-line"><tt class="py-docstring"> http://www.crockford.com/javascript/jsmin.c</tt> </tt>
-<a name="L62"></a><tt class="py-lineno"> 62</tt> <tt class="py-line"><tt class="py-docstring">"""</tt> </tt>
-<a name="L63"></a><tt class="py-lineno"> 63</tt> <tt class="py-line"><tt class="py-keyword">if</tt> <tt id="link-0" class="py-name" targets="Variable rjsmin.__doc__=rjsmin-module.html#__doc__"><a title="rjsmin.__doc__" class="py-name" href="#" onclick="return doclink('link-0', '__doc__', 'link-0');">__doc__</a></tt><tt class="py-op">:</tt> </tt>
-<a name="L64"></a><tt class="py-lineno"> 64</tt> <tt class="py-line"> <tt class="py-comment"># pylint: disable = W0622</tt> </tt>
-<a name="L65"></a><tt class="py-lineno"> 65</tt> <tt class="py-line"> <tt id="link-1" class="py-name"><a title="rjsmin.__doc__" class="py-name" href="#" onclick="return doclink('link-1', '__doc__', 'link-0');">__doc__</a></tt> <tt class="py-op">=</tt> <tt id="link-2" class="py-name"><a title="rjsmin.__doc__" class="py-name" href="#" onclick="return doclink('link-2', '__doc__', 'link-0');">__doc__</a></tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'ascii'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">decode</tt><tt class="py-op">(</tt><tt class="py-string">'unicode_escape'</tt><tt class="py-op">)</tt> </tt>
-<a name="L66"></a><tt class="py-lineno"> 66</tt> <tt class="py-line"><tt class="py-name">__author__</tt> <tt class="py-op">=</tt> <tt class="py-string">r"Andr\xe9 Malo"</tt><tt class="py-op">.</tt><tt class="py-name">encode</tt><tt class="py-op">(</tt><tt class="py-string">'ascii'</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">decode</tt><tt class="py-op">(</tt><tt class="py-string">'unicode_escape'</tt><tt class="py-op">)</tt> </tt>
-<a name="L67"></a><tt class="py-lineno"> 67</tt> <tt class="py-line"><tt class="py-name">__docformat__</tt> <tt class="py-op">=</tt> <tt class="py-string">"restructuredtext en"</tt> </tt>
-<a name="L68"></a><tt class="py-lineno"> 68</tt> <tt class="py-line"><tt id="link-3" class="py-name" targets="Variable rjsmin.__license__=rjsmin-module.html#__license__"><a title="rjsmin.__license__" class="py-name" href="#" onclick="return doclink('link-3', '__license__', 'link-3');">__license__</a></tt> <tt class="py-op">=</tt> <tt class="py-string">"Apache License, Version 2.0"</tt> </tt>
-<a name="L69"></a><tt class="py-lineno"> 69</tt> <tt class="py-line"><tt class="py-name">__version__</tt> <tt class="py-op">=</tt> <tt class="py-string">'1.0.10'</tt> </tt>
-<a name="L70"></a><tt class="py-lineno"> 70</tt> <tt class="py-line"><tt class="py-name">__all__</tt> <tt class="py-op">=</tt> <tt class="py-op">[</tt><tt class="py-string">'jsmin'</tt><tt class="py-op">]</tt> </tt>
-<a name="L71"></a><tt class="py-lineno"> 71</tt> <tt class="py-line"> </tt>
-<a name="L72"></a><tt class="py-lineno"> 72</tt> <tt class="py-line"><tt class="py-keyword">import</tt> <tt class="py-name">re</tt> <tt class="py-keyword">as</tt> <tt class="py-name">_re</tt> </tt>
-<a name="L73"></a><tt class="py-lineno"> 73</tt> <tt class="py-line"> </tt>
-<a name="L74"></a><tt class="py-lineno"> 74</tt> <tt class="py-line"> </tt>
-<a name="_make_jsmin"></a><div id="_make_jsmin-def"><a name="L75"></a><tt class="py-lineno"> 75</tt> <a class="py-toggle" href="#" id="_make_jsmin-toggle" onclick="return toggle('_make_jsmin');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="rjsmin-module.html#_make_jsmin">_make_jsmin</a><tt class="py-op">(</tt><tt class="py-param">python_only</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-</div><div id="_make_jsmin-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="_make_jsmin-expanded"><a name="L76"></a><tt class="py-lineno"> 76</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt>
-<a name="L77"></a><tt class="py-lineno"> 77</tt> <tt class="py-line"><tt class="py-docstring"> Generate JS minifier based on `jsmin.c by Douglas Crockford`_</tt> </tt>
-<a name="L78"></a><tt class="py-lineno"> 78</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L79"></a><tt class="py-lineno"> 79</tt> <tt class="py-line"><tt class="py-docstring"> .. _jsmin.c by Douglas Crockford:</tt> </tt>
-<a name="L80"></a><tt class="py-lineno"> 80</tt> <tt class="py-line"><tt class="py-docstring"> http://www.crockford.com/javascript/jsmin.c</tt> </tt>
-<a name="L81"></a><tt class="py-lineno"> 81</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L82"></a><tt class="py-lineno"> 82</tt> <tt class="py-line"><tt class="py-docstring"> :Parameters:</tt> </tt>
-<a name="L83"></a><tt class="py-lineno"> 83</tt> <tt class="py-line"><tt class="py-docstring"> `python_only` : ``bool``</tt> </tt>
-<a name="L84"></a><tt class="py-lineno"> 84</tt> <tt class="py-line"><tt class="py-docstring"> Use only the python variant. If true, the c extension is not even</tt> </tt>
-<a name="L85"></a><tt class="py-lineno"> 85</tt> <tt class="py-line"><tt class="py-docstring"> tried to be loaded.</tt> </tt>
-<a name="L86"></a><tt class="py-lineno"> 86</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L87"></a><tt class="py-lineno"> 87</tt> <tt class="py-line"><tt class="py-docstring"> :Return: Minifier</tt> </tt>
-<a name="L88"></a><tt class="py-lineno"> 88</tt> <tt class="py-line"><tt class="py-docstring"> :Rtype: ``callable``</tt> </tt>
-<a name="L89"></a><tt class="py-lineno"> 89</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
-<a name="L90"></a><tt class="py-lineno"> 90</tt> <tt class="py-line"> <tt class="py-comment"># pylint: disable = R0912, R0914, W0612</tt> </tt>
-<a name="L91"></a><tt class="py-lineno"> 91</tt> <tt class="py-line"> </tt>
-<a name="L92"></a><tt class="py-lineno"> 92</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">python_only</tt><tt class="py-op">:</tt> </tt>
-<a name="L93"></a><tt class="py-lineno"> 93</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
-<a name="L94"></a><tt class="py-lineno"> 94</tt> <tt class="py-line"> <tt class="py-keyword">import</tt> <tt class="py-name">_rjsmin</tt> <tt class="py-comment"># pylint: disable = F0401</tt> </tt>
-<a name="L95"></a><tt class="py-lineno"> 95</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">ImportError</tt><tt class="py-op">:</tt> </tt>
-<a name="L96"></a><tt class="py-lineno"> 96</tt> <tt class="py-line"> <tt class="py-keyword">pass</tt> </tt>
-<a name="L97"></a><tt class="py-lineno"> 97</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
-<a name="L98"></a><tt class="py-lineno"> 98</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">_rjsmin</tt><tt class="py-op">.</tt><tt id="link-4" class="py-name" targets="Function rjsmin.jsmin()=rjsmin-module.html#jsmin"><a title="rjsmin.jsmin" class="py-name" href="#" onclick="return doclink('link-4', 'jsmin', 'link-4');">jsmin</a></tt> </tt>
-<a name="L99"></a><tt class="py-lineno"> 99</tt> <tt class="py-line"> <tt class="py-keyword">try</tt><tt class="py-op">:</tt> </tt>
-<a name="L100"></a><tt class="py-lineno">100</tt> <tt class="py-line"> <tt class="py-name">xrange</tt> </tt>
-<a name="L101"></a><tt class="py-lineno">101</tt> <tt class="py-line"> <tt class="py-keyword">except</tt> <tt class="py-name">NameError</tt><tt class="py-op">:</tt> </tt>
-<a name="L102"></a><tt class="py-lineno">102</tt> <tt class="py-line"> <tt class="py-name">xrange</tt> <tt class="py-op">=</tt> <tt class="py-name">range</tt> <tt class="py-comment"># pylint: disable = W0622</tt> </tt>
-<a name="L103"></a><tt class="py-lineno">103</tt> <tt class="py-line"> </tt>
-<a name="L104"></a><tt class="py-lineno">104</tt> <tt class="py-line"> <tt class="py-name">space_chars</tt> <tt class="py-op">=</tt> <tt class="py-string">r'[\000-\011\013\014\016-\040]'</tt> </tt>
-<a name="L105"></a><tt class="py-lineno">105</tt> <tt class="py-line"> </tt>
-<a name="L106"></a><tt class="py-lineno">106</tt> <tt class="py-line"> <tt class="py-name">line_comment</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?://[^\r\n]*)'</tt> </tt>
-<a name="L107"></a><tt class="py-lineno">107</tt> <tt class="py-line"> <tt class="py-name">space_comment</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)'</tt> </tt>
-<a name="L108"></a><tt class="py-lineno">108</tt> <tt class="py-line"> <tt class="py-name">space_comment_nobang</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/)'</tt> </tt>
-<a name="L109"></a><tt class="py-lineno">109</tt> <tt class="py-line"> <tt class="py-name">bang_comment</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:/\*![^*]*\*+(?:[^/*][^*]*\*+)*/)'</tt> </tt>
-<a name="L110"></a><tt class="py-lineno">110</tt> <tt class="py-line"> </tt>
-<a name="L111"></a><tt class="py-lineno">111</tt> <tt class="py-line"> <tt class="py-name">string1</tt> <tt class="py-op">=</tt> \ </tt>
-<a name="L112"></a><tt class="py-lineno">112</tt> <tt class="py-line"> <tt class="py-string">r'(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|\r)[^\047\\\r\n]*)*\047)'</tt> </tt>
-<a name="L113"></a><tt class="py-lineno">113</tt> <tt class="py-line"> <tt class="py-name">string2</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|\r)[^"\\\r\n]*)*")'</tt> </tt>
-<a name="L114"></a><tt class="py-lineno">114</tt> <tt class="py-line"> <tt class="py-name">strings</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:%s|%s)'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">string1</tt><tt class="py-op">,</tt> <tt class="py-name">string2</tt><tt class="py-op">)</tt> </tt>
-<a name="L115"></a><tt class="py-lineno">115</tt> <tt class="py-line"> </tt>
-<a name="L116"></a><tt class="py-lineno">116</tt> <tt class="py-line"> <tt class="py-name">charclass</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\])'</tt> </tt>
-<a name="L117"></a><tt class="py-lineno">117</tt> <tt class="py-line"> <tt class="py-name">nospecial</tt> <tt class="py-op">=</tt> <tt class="py-string">r'[^/\\\[\r\n]'</tt> </tt>
-<a name="L118"></a><tt class="py-lineno">118</tt> <tt class="py-line"> <tt class="py-name">regex</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:/(?![\r\n/*])%s*(?:(?:\\[^\r\n]|%s)%s*)*/)'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt> </tt>
-<a name="L119"></a><tt class="py-lineno">119</tt> <tt class="py-line"> <tt class="py-name">nospecial</tt><tt class="py-op">,</tt> <tt class="py-name">charclass</tt><tt class="py-op">,</tt> <tt class="py-name">nospecial</tt> </tt>
-<a name="L120"></a><tt class="py-lineno">120</tt> <tt class="py-line"> <tt class="py-op">)</tt> </tt>
-<a name="L121"></a><tt class="py-lineno">121</tt> <tt class="py-line"> <tt class="py-name">space</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:%s|%s)'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">space_chars</tt><tt class="py-op">,</tt> <tt class="py-name">space_comment</tt><tt class="py-op">)</tt> </tt>
-<a name="L122"></a><tt class="py-lineno">122</tt> <tt class="py-line"> <tt class="py-name">space_nobang</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:%s|%s)'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">space_chars</tt><tt class="py-op">,</tt> <tt class="py-name">space_comment_nobang</tt><tt class="py-op">)</tt> </tt>
-<a name="L123"></a><tt class="py-lineno">123</tt> <tt class="py-line"> <tt class="py-name">newline</tt> <tt class="py-op">=</tt> <tt class="py-string">r'(?:%s?[\r\n])'</tt> <tt class="py-op">%</tt> <tt class="py-name">line_comment</tt> </tt>
-<a name="L124"></a><tt class="py-lineno">124</tt> <tt class="py-line"> </tt>
-<a name="L125"></a><tt class="py-lineno">125</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">fix_charclass</tt><tt class="py-op">(</tt><tt class="py-param">result</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L126"></a><tt class="py-lineno">126</tt> <tt class="py-line"> <tt class="py-docstring">""" Fixup string of chars to fit into a regex char class """</tt> </tt>
-<a name="L127"></a><tt class="py-lineno">127</tt> <tt class="py-line"> <tt class="py-name">pos</tt> <tt class="py-op">=</tt> <tt class="py-name">result</tt><tt class="py-op">.</tt><tt class="py-name">find</tt><tt class="py-op">(</tt><tt class="py-string">'-'</tt><tt class="py-op">)</tt> </tt>
-<a name="L128"></a><tt class="py-lineno">128</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">pos</tt> <tt class="py-op">&gt;=</tt> <tt class="py-number">0</tt><tt class="py-op">:</tt> </tt>
-<a name="L129"></a><tt class="py-lineno">129</tt> <tt class="py-line"> <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-string">r'%s%s-'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt><tt class="py-name">result</tt><tt class="py-op">[</tt><tt class="py-op">:</tt><tt class="py-name">pos</tt><tt class="py-op">]</tt><tt class="py-op">,</tt> <tt class="py-name">result</tt><tt class="py-op">[</tt><tt class="py-name">pos</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
-<a name="L130"></a><tt class="py-lineno">130</tt> <tt class="py-line"> </tt>
-<a name="L131"></a><tt class="py-lineno">131</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">sequentize</tt><tt class="py-op">(</tt><tt class="py-param">string</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L132"></a><tt class="py-lineno">132</tt> <tt class="py-line"> <tt class="py-docstring">"""</tt> </tt>
-<a name="L133"></a><tt class="py-lineno">133</tt> <tt class="py-line"><tt class="py-docstring"> Notate consecutive characters as sequence</tt> </tt>
-<a name="L134"></a><tt class="py-lineno">134</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L135"></a><tt class="py-lineno">135</tt> <tt class="py-line"><tt class="py-docstring"> (1-4 instead of 1234)</tt> </tt>
-<a name="L136"></a><tt class="py-lineno">136</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
-<a name="L137"></a><tt class="py-lineno">137</tt> <tt class="py-line"> <tt class="py-name">first</tt><tt class="py-op">,</tt> <tt class="py-name">last</tt><tt class="py-op">,</tt> <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-name">None</tt><tt class="py-op">,</tt> <tt class="py-op">[</tt><tt class="py-op">]</tt> </tt>
-<a name="L138"></a><tt class="py-lineno">138</tt> <tt class="py-line"> <tt class="py-keyword">for</tt> <tt class="py-name">char</tt> <tt class="py-keyword">in</tt> <tt class="py-name">map</tt><tt class="py-op">(</tt><tt class="py-name">ord</tt><tt class="py-op">,</tt> <tt class="py-name">string</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L139"></a><tt class="py-lineno">139</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">last</tt> <tt class="py-keyword">is</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
-<a name="L140"></a><tt class="py-lineno">140</tt> <tt class="py-line"> <tt class="py-name">first</tt> <tt class="py-op">=</tt> <tt class="py-name">last</tt> <tt class="py-op">=</tt> <tt class="py-name">char</tt> </tt>
-<a name="L141"></a><tt class="py-lineno">141</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">last</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> <tt class="py-op">==</tt> <tt class="py-name">char</tt><tt class="py-op">:</tt> </tt>
-<a name="L142"></a><tt class="py-lineno">142</tt> <tt class="py-line"> <tt class="py-name">last</tt> <tt class="py-op">=</tt> <tt class="py-name">char</tt> </tt>
-<a name="L143"></a><tt class="py-lineno">143</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
-<a name="L144"></a><tt class="py-lineno">144</tt> <tt class="py-line"> <tt class="py-name">result</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">first</tt><tt class="py-op">,</tt> <tt class="py-name">last</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
-<a name="L145"></a><tt class="py-lineno">145</tt> <tt class="py-line"> <tt class="py-name">first</tt> <tt class="py-op">=</tt> <tt class="py-name">last</tt> <tt class="py-op">=</tt> <tt class="py-name">char</tt> </tt>
-<a name="L146"></a><tt class="py-lineno">146</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">last</tt> <tt class="py-keyword">is</tt> <tt class="py-keyword">not</tt> <tt class="py-name">None</tt><tt class="py-op">:</tt> </tt>
-<a name="L147"></a><tt class="py-lineno">147</tt> <tt class="py-line"> <tt class="py-name">result</tt><tt class="py-op">.</tt><tt class="py-name">append</tt><tt class="py-op">(</tt><tt class="py-op">(</tt><tt class="py-name">first</tt><tt class="py-op">,</tt> <tt class="py-name">last</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
-<a name="L148"></a><tt class="py-lineno">148</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">''</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-op">[</tt><tt class="py-string">'%s%s%s'</tt> <tt class="py-op">%</tt> <tt class="py-op">(</tt> </tt>
-<a name="L149"></a><tt class="py-lineno">149</tt> <tt class="py-line"> <tt class="py-name">chr</tt><tt class="py-op">(</tt><tt class="py-name">first</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> </tt>
-<a name="L150"></a><tt class="py-lineno">150</tt> <tt class="py-line"> <tt class="py-name">last</tt> <tt class="py-op">&gt;</tt> <tt class="py-name">first</tt> <tt class="py-op">+</tt> <tt class="py-number">1</tt> <tt class="py-keyword">and</tt> <tt class="py-string">'-'</tt> <tt class="py-keyword">or</tt> <tt class="py-string">''</tt><tt class="py-op">,</tt> </tt>
-<a name="L151"></a><tt class="py-lineno">151</tt> <tt class="py-line"> <tt class="py-name">last</tt> <tt class="py-op">!=</tt> <tt class="py-name">first</tt> <tt class="py-keyword">and</tt> <tt class="py-name">chr</tt><tt class="py-op">(</tt><tt class="py-name">last</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> <tt class="py-string">''</tt> </tt>
-<a name="L152"></a><tt class="py-lineno">152</tt> <tt class="py-line"> <tt class="py-op">)</tt> <tt class="py-keyword">for</tt> <tt class="py-name">first</tt><tt class="py-op">,</tt> <tt class="py-name">last</tt> <tt class="py-keyword">in</tt> <tt class="py-name">result</tt><tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
-</div><a name="L153"></a><tt class="py-lineno">153</tt> <tt class="py-line"> </tt>
-<a name="L154"></a><tt class="py-lineno">154</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">_re</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt><tt class="py-op">(</tt> </tt>
-<a name="L155"></a><tt class="py-lineno">155</tt> <tt class="py-line"> <tt class="py-string">r'([\000-\040\047])'</tt><tt class="py-op">,</tt> <tt class="py-comment"># \047 for better portability</tt> </tt>
-<a name="L156"></a><tt class="py-lineno">156</tt> <tt class="py-line"> <tt class="py-keyword">lambda</tt> <tt class="py-name">m</tt><tt class="py-op">:</tt> <tt class="py-string">'\\%03o'</tt> <tt class="py-op">%</tt> <tt class="py-name">ord</tt><tt class="py-op">(</tt><tt class="py-name">m</tt><tt class="py-op">.</tt><tt class="py-name">group</tt><tt class="py-op">(</tt><tt class="py-number">1</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-op">(</tt> </tt>
-<a name="L157"></a><tt class="py-lineno">157</tt> <tt class="py-line"> <tt class="py-name">sequentize</tt><tt class="py-op">(</tt><tt class="py-name">result</tt><tt class="py-op">)</tt> </tt>
-<a name="L158"></a><tt class="py-lineno">158</tt> <tt class="py-line"> <tt class="py-op">.</tt><tt class="py-name">replace</tt><tt class="py-op">(</tt><tt class="py-string">'\\'</tt><tt class="py-op">,</tt> <tt class="py-string">'\\\\'</tt><tt class="py-op">)</tt> </tt>
-<a name="L159"></a><tt class="py-lineno">159</tt> <tt class="py-line"> <tt class="py-op">.</tt><tt class="py-name">replace</tt><tt class="py-op">(</tt><tt class="py-string">'['</tt><tt class="py-op">,</tt> <tt class="py-string">'\\['</tt><tt class="py-op">)</tt> </tt>
-<a name="L160"></a><tt class="py-lineno">160</tt> <tt class="py-line"> <tt class="py-op">.</tt><tt class="py-name">replace</tt><tt class="py-op">(</tt><tt class="py-string">']'</tt><tt class="py-op">,</tt> <tt class="py-string">'\\]'</tt><tt class="py-op">)</tt> </tt>
-<a name="L161"></a><tt class="py-lineno">161</tt> <tt class="py-line"> <tt class="py-op">)</tt> </tt>
-<a name="L162"></a><tt class="py-lineno">162</tt> <tt class="py-line"> <tt class="py-op">)</tt> </tt>
-</div><a name="L163"></a><tt class="py-lineno">163</tt> <tt class="py-line"> </tt>
-<a name="L164"></a><tt class="py-lineno">164</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">id_literal_</tt><tt class="py-op">(</tt><tt class="py-param">what</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L165"></a><tt class="py-lineno">165</tt> <tt class="py-line"> <tt class="py-docstring">""" Make id_literal like char class """</tt> </tt>
-<a name="L166"></a><tt class="py-lineno">166</tt> <tt class="py-line"> <tt class="py-name">match</tt> <tt class="py-op">=</tt> <tt class="py-name">_re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-name">what</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">match</tt> </tt>
-<a name="L167"></a><tt class="py-lineno">167</tt> <tt class="py-line"> <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-op">[</tt> </tt>
-<a name="L168"></a><tt class="py-lineno">168</tt> <tt class="py-line"> <tt class="py-name">chr</tt><tt class="py-op">(</tt><tt class="py-name">c</tt><tt class="py-op">)</tt> <tt class="py-keyword">for</tt> <tt class="py-name">c</tt> <tt class="py-keyword">in</tt> <tt class="py-name">xrange</tt><tt class="py-op">(</tt><tt class="py-number">127</tt><tt class="py-op">)</tt> <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">match</tt><tt class="py-op">(</tt><tt class="py-name">chr</tt><tt class="py-op">(</tt><tt class="py-name">c</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
-<a name="L169"></a><tt class="py-lineno">169</tt> <tt class="py-line"> <tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
-<a name="L170"></a><tt class="py-lineno">170</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">'[^%s]'</tt> <tt class="py-op">%</tt> <tt class="py-name">fix_charclass</tt><tt class="py-op">(</tt><tt class="py-name">result</tt><tt class="py-op">)</tt> </tt>
-</div><a name="L171"></a><tt class="py-lineno">171</tt> <tt class="py-line"> </tt>
-<a name="L172"></a><tt class="py-lineno">172</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">not_id_literal_</tt><tt class="py-op">(</tt><tt class="py-param">keep</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L173"></a><tt class="py-lineno">173</tt> <tt class="py-line"> <tt class="py-docstring">""" Make negated id_literal like char class """</tt> </tt>
-<a name="L174"></a><tt class="py-lineno">174</tt> <tt class="py-line"> <tt class="py-name">match</tt> <tt class="py-op">=</tt> <tt class="py-name">_re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-name">id_literal_</tt><tt class="py-op">(</tt><tt class="py-name">keep</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">match</tt> </tt>
-<a name="L175"></a><tt class="py-lineno">175</tt> <tt class="py-line"> <tt class="py-name">result</tt> <tt class="py-op">=</tt> <tt class="py-string">''</tt><tt class="py-op">.</tt><tt class="py-name">join</tt><tt class="py-op">(</tt><tt class="py-op">[</tt> </tt>
-<a name="L176"></a><tt class="py-lineno">176</tt> <tt class="py-line"> <tt class="py-name">chr</tt><tt class="py-op">(</tt><tt class="py-name">c</tt><tt class="py-op">)</tt> <tt class="py-keyword">for</tt> <tt class="py-name">c</tt> <tt class="py-keyword">in</tt> <tt class="py-name">xrange</tt><tt class="py-op">(</tt><tt class="py-number">127</tt><tt class="py-op">)</tt> <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">match</tt><tt class="py-op">(</tt><tt class="py-name">chr</tt><tt class="py-op">(</tt><tt class="py-name">c</tt><tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
-<a name="L177"></a><tt class="py-lineno">177</tt> <tt class="py-line"> <tt class="py-op">]</tt><tt class="py-op">)</tt> </tt>
-<a name="L178"></a><tt class="py-lineno">178</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">r'[%s]'</tt> <tt class="py-op">%</tt> <tt class="py-name">fix_charclass</tt><tt class="py-op">(</tt><tt class="py-name">result</tt><tt class="py-op">)</tt> </tt>
-</div><a name="L179"></a><tt class="py-lineno">179</tt> <tt class="py-line"> </tt>
-<a name="L180"></a><tt class="py-lineno">180</tt> <tt class="py-line"> <tt class="py-name">not_id_literal</tt> <tt class="py-op">=</tt> <tt class="py-name">not_id_literal_</tt><tt class="py-op">(</tt><tt class="py-string">r'[a-zA-Z0-9_$]'</tt><tt class="py-op">)</tt> </tt>
-<a name="L181"></a><tt class="py-lineno">181</tt> <tt class="py-line"> <tt class="py-name">preregex1</tt> <tt class="py-op">=</tt> <tt class="py-string">r'[(,=:\[!&amp;|?{};\r\n]'</tt> </tt>
-<a name="L182"></a><tt class="py-lineno">182</tt> <tt class="py-line"> <tt class="py-name">preregex2</tt> <tt class="py-op">=</tt> <tt class="py-string">r'%(not_id_literal)sreturn'</tt> <tt class="py-op">%</tt> <tt class="py-name">locals</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-<a name="L183"></a><tt class="py-lineno">183</tt> <tt class="py-line"> </tt>
-<a name="L184"></a><tt class="py-lineno">184</tt> <tt class="py-line"> <tt class="py-name">id_literal</tt> <tt class="py-op">=</tt> <tt class="py-name">id_literal_</tt><tt class="py-op">(</tt><tt class="py-string">r'[a-zA-Z0-9_$]'</tt><tt class="py-op">)</tt> </tt>
-<a name="L185"></a><tt class="py-lineno">185</tt> <tt class="py-line"> <tt class="py-name">id_literal_open</tt> <tt class="py-op">=</tt> <tt class="py-name">id_literal_</tt><tt class="py-op">(</tt><tt class="py-string">r'[a-zA-Z0-9_${\[(!+-]'</tt><tt class="py-op">)</tt> </tt>
-<a name="L186"></a><tt class="py-lineno">186</tt> <tt class="py-line"> <tt class="py-name">id_literal_close</tt> <tt class="py-op">=</tt> <tt class="py-name">id_literal_</tt><tt class="py-op">(</tt><tt class="py-string">r'[a-zA-Z0-9_$}\])"\047+-]'</tt><tt class="py-op">)</tt> </tt>
-<a name="L187"></a><tt class="py-lineno">187</tt> <tt class="py-line"> </tt>
-<a name="L188"></a><tt class="py-lineno">188</tt> <tt class="py-line"> <tt class="py-name">dull</tt> <tt class="py-op">=</tt> <tt class="py-string">r'[^\047"/\000-\040]'</tt> </tt>
-<a name="L189"></a><tt class="py-lineno">189</tt> <tt class="py-line"> </tt>
-<a name="L190"></a><tt class="py-lineno">190</tt> <tt class="py-line"> <tt class="py-name">space_sub_simple</tt> <tt class="py-op">=</tt> <tt class="py-name">_re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-op">(</tt> </tt>
-<a name="L191"></a><tt class="py-lineno">191</tt> <tt class="py-line"> <tt class="py-comment"># noqa pylint: disable = C0330</tt> </tt>
-<a name="L192"></a><tt class="py-lineno">192</tt> <tt class="py-line"> </tt>
-<a name="L193"></a><tt class="py-lineno">193</tt> <tt class="py-line"> <tt class="py-string">r'(%(dull)s+)'</tt> </tt>
-<a name="L194"></a><tt class="py-lineno">194</tt> <tt class="py-line"> <tt class="py-string">r'|(%(strings)s%(dull)s*)'</tt> </tt>
-<a name="L195"></a><tt class="py-lineno">195</tt> <tt class="py-line"> <tt class="py-string">r'|(?&lt;=%(preregex1)s)'</tt> </tt>
-<a name="L196"></a><tt class="py-lineno">196</tt> <tt class="py-line"> <tt class="py-string">r'%(space)s*(?:%(newline)s%(space)s*)*'</tt> </tt>
-<a name="L197"></a><tt class="py-lineno">197</tt> <tt class="py-line"> <tt class="py-string">r'(%(regex)s%(dull)s*)'</tt> </tt>
-<a name="L198"></a><tt class="py-lineno">198</tt> <tt class="py-line"> <tt class="py-string">r'|(?&lt;=%(preregex2)s)'</tt> </tt>
-<a name="L199"></a><tt class="py-lineno">199</tt> <tt class="py-line"> <tt class="py-string">r'%(space)s*(?:%(newline)s%(space)s)*'</tt> </tt>
-<a name="L200"></a><tt class="py-lineno">200</tt> <tt class="py-line"> <tt class="py-string">r'(%(regex)s%(dull)s*)'</tt> </tt>
-<a name="L201"></a><tt class="py-lineno">201</tt> <tt class="py-line"> <tt class="py-string">r'|(?&lt;=%(id_literal_close)s)'</tt> </tt>
-<a name="L202"></a><tt class="py-lineno">202</tt> <tt class="py-line"> <tt class="py-string">r'%(space)s*(?:(%(newline)s)%(space)s*)+'</tt> </tt>
-<a name="L203"></a><tt class="py-lineno">203</tt> <tt class="py-line"> <tt class="py-string">r'(?=%(id_literal_open)s)'</tt> </tt>
-<a name="L204"></a><tt class="py-lineno">204</tt> <tt class="py-line"> <tt class="py-string">r'|(?&lt;=%(id_literal)s)(%(space)s)+(?=%(id_literal)s)'</tt> </tt>
-<a name="L205"></a><tt class="py-lineno">205</tt> <tt class="py-line"> <tt class="py-string">r'|(?&lt;=\+)(%(space)s)+(?=\+)'</tt> </tt>
-<a name="L206"></a><tt class="py-lineno">206</tt> <tt class="py-line"> <tt class="py-string">r'|(?&lt;=-)(%(space)s)+(?=-)'</tt> </tt>
-<a name="L207"></a><tt class="py-lineno">207</tt> <tt class="py-line"> <tt class="py-string">r'|%(space)s+'</tt> </tt>
-<a name="L208"></a><tt class="py-lineno">208</tt> <tt class="py-line"> <tt class="py-string">r'|(?:%(newline)s%(space)s*)+'</tt> </tt>
-<a name="L209"></a><tt class="py-lineno">209</tt> <tt class="py-line"> <tt class="py-op">)</tt> <tt class="py-op">%</tt> <tt class="py-name">locals</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt> </tt>
-<a name="L210"></a><tt class="py-lineno">210</tt> <tt class="py-line"> <tt class="py-comment">#print space_sub_simple.__self__.pattern</tt> </tt>
-<a name="L211"></a><tt class="py-lineno">211</tt> <tt class="py-line"> </tt>
-<a name="L212"></a><tt class="py-lineno">212</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">space_subber_simple</tt><tt class="py-op">(</tt><tt class="py-param">match</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L213"></a><tt class="py-lineno">213</tt> <tt class="py-line"> <tt class="py-docstring">""" Substitution callback """</tt> </tt>
-<a name="L214"></a><tt class="py-lineno">214</tt> <tt class="py-line"> <tt class="py-comment"># pylint: disable = R0911</tt> </tt>
-<a name="L215"></a><tt class="py-lineno">215</tt> <tt class="py-line"> </tt>
-<a name="L216"></a><tt class="py-lineno">216</tt> <tt class="py-line"> <tt class="py-name">groups</tt> <tt class="py-op">=</tt> <tt class="py-name">match</tt><tt class="py-op">.</tt><tt class="py-name">groups</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-<a name="L217"></a><tt class="py-lineno">217</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L218"></a><tt class="py-lineno">218</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
-<a name="L219"></a><tt class="py-lineno">219</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L220"></a><tt class="py-lineno">220</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
-<a name="L221"></a><tt class="py-lineno">221</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L222"></a><tt class="py-lineno">222</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> </tt>
-<a name="L223"></a><tt class="py-lineno">223</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">3</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L224"></a><tt class="py-lineno">224</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">3</tt><tt class="py-op">]</tt> </tt>
-<a name="L225"></a><tt class="py-lineno">225</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">4</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L226"></a><tt class="py-lineno">226</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">'\n'</tt> </tt>
-<a name="L227"></a><tt class="py-lineno">227</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">5</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">6</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">7</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L228"></a><tt class="py-lineno">228</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">' '</tt> </tt>
-<a name="L229"></a><tt class="py-lineno">229</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
-<a name="L230"></a><tt class="py-lineno">230</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">''</tt> </tt>
-</div><a name="L231"></a><tt class="py-lineno">231</tt> <tt class="py-line"> </tt>
-<a name="L232"></a><tt class="py-lineno">232</tt> <tt class="py-line"> <tt class="py-name">space_sub_banged</tt> <tt class="py-op">=</tt> <tt class="py-name">_re</tt><tt class="py-op">.</tt><tt class="py-name">compile</tt><tt class="py-op">(</tt><tt class="py-op">(</tt> </tt>
-<a name="L233"></a><tt class="py-lineno">233</tt> <tt class="py-line"> <tt class="py-comment"># noqa pylint: disable = C0330</tt> </tt>
-<a name="L234"></a><tt class="py-lineno">234</tt> <tt class="py-line"> </tt>
-<a name="L235"></a><tt class="py-lineno">235</tt> <tt class="py-line"> <tt class="py-string">r'(%(dull)s+)'</tt> </tt>
-<a name="L236"></a><tt class="py-lineno">236</tt> <tt class="py-line"> <tt class="py-string">r'|(%(strings)s%(dull)s*)'</tt> </tt>
-<a name="L237"></a><tt class="py-lineno">237</tt> <tt class="py-line"> <tt class="py-string">r'|(%(bang_comment)s%(dull)s*)'</tt> </tt>
-<a name="L238"></a><tt class="py-lineno">238</tt> <tt class="py-line"> <tt class="py-string">r'|(?&lt;=%(preregex1)s)'</tt> </tt>
-<a name="L239"></a><tt class="py-lineno">239</tt> <tt class="py-line"> <tt class="py-string">r'%(space)s*(?:%(newline)s%(space)s*)*'</tt> </tt>
-<a name="L240"></a><tt class="py-lineno">240</tt> <tt class="py-line"> <tt class="py-string">r'(%(regex)s%(dull)s*)'</tt> </tt>
-<a name="L241"></a><tt class="py-lineno">241</tt> <tt class="py-line"> <tt class="py-string">r'|(?&lt;=%(preregex2)s)'</tt> </tt>
-<a name="L242"></a><tt class="py-lineno">242</tt> <tt class="py-line"> <tt class="py-string">r'%(space)s*(?:%(newline)s%(space)s)*'</tt> </tt>
-<a name="L243"></a><tt class="py-lineno">243</tt> <tt class="py-line"> <tt class="py-string">r'(%(regex)s%(dull)s*)'</tt> </tt>
-<a name="L244"></a><tt class="py-lineno">244</tt> <tt class="py-line"> <tt class="py-string">r'|(?&lt;=%(id_literal_close)s)'</tt> </tt>
-<a name="L245"></a><tt class="py-lineno">245</tt> <tt class="py-line"> <tt class="py-string">r'%(space)s*(?:(%(newline)s)%(space)s*)+'</tt> </tt>
-<a name="L246"></a><tt class="py-lineno">246</tt> <tt class="py-line"> <tt class="py-string">r'(?=%(id_literal_open)s)'</tt> </tt>
-<a name="L247"></a><tt class="py-lineno">247</tt> <tt class="py-line"> <tt class="py-string">r'|(?&lt;=%(id_literal)s)(%(space)s)+(?=%(id_literal)s)'</tt> </tt>
-<a name="L248"></a><tt class="py-lineno">248</tt> <tt class="py-line"> <tt class="py-string">r'|(?&lt;=\+)(%(space)s)+(?=\+)'</tt> </tt>
-<a name="L249"></a><tt class="py-lineno">249</tt> <tt class="py-line"> <tt class="py-string">r'|(?&lt;=-)(%(space)s)+(?=-)'</tt> </tt>
-<a name="L250"></a><tt class="py-lineno">250</tt> <tt class="py-line"> <tt class="py-string">r'|%(space)s+'</tt> </tt>
-<a name="L251"></a><tt class="py-lineno">251</tt> <tt class="py-line"> <tt class="py-string">r'|(?:%(newline)s%(space)s*)+'</tt> </tt>
-<a name="L252"></a><tt class="py-lineno">252</tt> <tt class="py-line"> <tt class="py-op">)</tt> <tt class="py-op">%</tt> <tt class="py-name">dict</tt><tt class="py-op">(</tt><tt class="py-name">locals</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">space</tt><tt class="py-op">=</tt><tt class="py-name">space_nobang</tt><tt class="py-op">)</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt> </tt>
-<a name="L253"></a><tt class="py-lineno">253</tt> <tt class="py-line"> <tt class="py-comment">#print space_sub_banged.__self__.pattern</tt> </tt>
-<a name="L254"></a><tt class="py-lineno">254</tt> <tt class="py-line"> </tt>
-<a name="L255"></a><tt class="py-lineno">255</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">space_subber_banged</tt><tt class="py-op">(</tt><tt class="py-param">match</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L256"></a><tt class="py-lineno">256</tt> <tt class="py-line"> <tt class="py-docstring">""" Substitution callback """</tt> </tt>
-<a name="L257"></a><tt class="py-lineno">257</tt> <tt class="py-line"> <tt class="py-comment"># pylint: disable = R0911</tt> </tt>
-<a name="L258"></a><tt class="py-lineno">258</tt> <tt class="py-line"> </tt>
-<a name="L259"></a><tt class="py-lineno">259</tt> <tt class="py-line"> <tt class="py-name">groups</tt> <tt class="py-op">=</tt> <tt class="py-name">match</tt><tt class="py-op">.</tt><tt class="py-name">groups</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-<a name="L260"></a><tt class="py-lineno">260</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L261"></a><tt class="py-lineno">261</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> </tt>
-<a name="L262"></a><tt class="py-lineno">262</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L263"></a><tt class="py-lineno">263</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> </tt>
-<a name="L264"></a><tt class="py-lineno">264</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L265"></a><tt class="py-lineno">265</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> </tt>
-<a name="L266"></a><tt class="py-lineno">266</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">3</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L267"></a><tt class="py-lineno">267</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">3</tt><tt class="py-op">]</tt> </tt>
-<a name="L268"></a><tt class="py-lineno">268</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">4</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L269"></a><tt class="py-lineno">269</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">4</tt><tt class="py-op">]</tt> </tt>
-<a name="L270"></a><tt class="py-lineno">270</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">5</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L271"></a><tt class="py-lineno">271</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">'\n'</tt> </tt>
-<a name="L272"></a><tt class="py-lineno">272</tt> <tt class="py-line"> <tt class="py-keyword">elif</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">6</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">7</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">8</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L273"></a><tt class="py-lineno">273</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">' '</tt> </tt>
-<a name="L274"></a><tt class="py-lineno">274</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
-<a name="L275"></a><tt class="py-lineno">275</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-string">''</tt> </tt>
-</div><a name="L276"></a><tt class="py-lineno">276</tt> <tt class="py-line"> </tt>
-<a name="L277"></a><tt class="py-lineno">277</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">jsmin</tt><tt class="py-op">(</tt><tt class="py-param">script</tt><tt class="py-op">,</tt> <tt class="py-param">keep_bang_comments</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> <tt class="py-comment"># pylint: disable = W0621</tt> </tt>
-<a name="L278"></a><tt class="py-lineno">278</tt> <tt class="py-line"> <tt class="py-docstring">r"""</tt> </tt>
-<a name="L279"></a><tt class="py-lineno">279</tt> <tt class="py-line"><tt class="py-docstring"> Minify javascript based on `jsmin.c by Douglas Crockford`_\.</tt> </tt>
-<a name="L280"></a><tt class="py-lineno">280</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L281"></a><tt class="py-lineno">281</tt> <tt class="py-line"><tt class="py-docstring"> Instead of parsing the stream char by char, it uses a regular</tt> </tt>
-<a name="L282"></a><tt class="py-lineno">282</tt> <tt class="py-line"><tt class="py-docstring"> expression approach which minifies the whole script with one big</tt> </tt>
-<a name="L283"></a><tt class="py-lineno">283</tt> <tt class="py-line"><tt class="py-docstring"> substitution regex.</tt> </tt>
-<a name="L284"></a><tt class="py-lineno">284</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L285"></a><tt class="py-lineno">285</tt> <tt class="py-line"><tt class="py-docstring"> .. _jsmin.c by Douglas Crockford:</tt> </tt>
-<a name="L286"></a><tt class="py-lineno">286</tt> <tt class="py-line"><tt class="py-docstring"> http://www.crockford.com/javascript/jsmin.c</tt> </tt>
-<a name="L287"></a><tt class="py-lineno">287</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L288"></a><tt class="py-lineno">288</tt> <tt class="py-line"><tt class="py-docstring"> :Parameters:</tt> </tt>
-<a name="L289"></a><tt class="py-lineno">289</tt> <tt class="py-line"><tt class="py-docstring"> `script` : ``str``</tt> </tt>
-<a name="L290"></a><tt class="py-lineno">290</tt> <tt class="py-line"><tt class="py-docstring"> Script to minify</tt> </tt>
-<a name="L291"></a><tt class="py-lineno">291</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L292"></a><tt class="py-lineno">292</tt> <tt class="py-line"><tt class="py-docstring"> `keep_bang_comments` : ``bool``</tt> </tt>
-<a name="L293"></a><tt class="py-lineno">293</tt> <tt class="py-line"><tt class="py-docstring"> Keep comments starting with an exclamation mark? (``/*!...*/``)</tt> </tt>
-<a name="L294"></a><tt class="py-lineno">294</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L295"></a><tt class="py-lineno">295</tt> <tt class="py-line"><tt class="py-docstring"> :Return: Minified script</tt> </tt>
-<a name="L296"></a><tt class="py-lineno">296</tt> <tt class="py-line"><tt class="py-docstring"> :Rtype: ``str``</tt> </tt>
-<a name="L297"></a><tt class="py-lineno">297</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
-<a name="L298"></a><tt class="py-lineno">298</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-name">keep_bang_comments</tt><tt class="py-op">:</tt> </tt>
-<a name="L299"></a><tt class="py-lineno">299</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">space_sub_banged</tt><tt class="py-op">(</tt> </tt>
-<a name="L300"></a><tt class="py-lineno">300</tt> <tt class="py-line"> <tt class="py-name">space_subber_banged</tt><tt class="py-op">,</tt> <tt class="py-string">'\n%s\n'</tt> <tt class="py-op">%</tt> <tt class="py-name">script</tt> </tt>
-<a name="L301"></a><tt class="py-lineno">301</tt> <tt class="py-line"> <tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">strip</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-<a name="L302"></a><tt class="py-lineno">302</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
-<a name="L303"></a><tt class="py-lineno">303</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">space_sub_simple</tt><tt class="py-op">(</tt> </tt>
-<a name="L304"></a><tt class="py-lineno">304</tt> <tt class="py-line"> <tt class="py-name">space_subber_simple</tt><tt class="py-op">,</tt> <tt class="py-string">'\n%s\n'</tt> <tt class="py-op">%</tt> <tt class="py-name">script</tt> </tt>
-<a name="L305"></a><tt class="py-lineno">305</tt> <tt class="py-line"> <tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">strip</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-</div><a name="L306"></a><tt class="py-lineno">306</tt> <tt class="py-line"> </tt>
-<a name="L307"></a><tt class="py-lineno">307</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt id="link-5" class="py-name"><a title="rjsmin.jsmin" class="py-name" href="#" onclick="return doclink('link-5', 'jsmin', 'link-4');">jsmin</a></tt> </tt>
-</div><a name="L308"></a><tt class="py-lineno">308</tt> <tt class="py-line"> </tt>
-<a name="L309"></a><tt class="py-lineno">309</tt> <tt class="py-line"><tt id="link-6" class="py-name"><a title="rjsmin.jsmin" class="py-name" href="#" onclick="return doclink('link-6', 'jsmin', 'link-4');">jsmin</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_make_jsmin</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-<a name="L310"></a><tt class="py-lineno">310</tt> <tt class="py-line"> </tt>
-<a name="L311"></a><tt class="py-lineno">311</tt> <tt class="py-line"> </tt>
-<a name="jsmin_for_posers"></a><div id="jsmin_for_posers-def"><a name="L312"></a><tt class="py-lineno">312</tt> <a class="py-toggle" href="#" id="jsmin_for_posers-toggle" onclick="return toggle('jsmin_for_posers');">-</a><tt class="py-line"><tt class="py-keyword">def</tt> <a class="py-def-name" href="rjsmin-module.html#jsmin_for_posers">jsmin_for_posers</a><tt class="py-op">(</tt><tt class="py-param">script</tt><tt class="py-op">,</tt> <tt class="py-param">keep_bang_comments</tt><tt class="py-op">=</tt><tt class="py-name">False</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-</div><div id="jsmin_for_posers-collapsed" style="display:none;" pad="+++" indent="++++"></div><div id="jsmin_for_posers-expanded"><a name="L313"></a><tt class="py-lineno">313</tt> <tt class="py-line"> <tt class="py-docstring">r"""</tt> </tt>
-<a name="L314"></a><tt class="py-lineno">314</tt> <tt class="py-line"><tt class="py-docstring"> Minify javascript based on `jsmin.c by Douglas Crockford`_\.</tt> </tt>
-<a name="L315"></a><tt class="py-lineno">315</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L316"></a><tt class="py-lineno">316</tt> <tt class="py-line"><tt class="py-docstring"> Instead of parsing the stream char by char, it uses a regular</tt> </tt>
-<a name="L317"></a><tt class="py-lineno">317</tt> <tt class="py-line"><tt class="py-docstring"> expression approach which minifies the whole script with one big</tt> </tt>
-<a name="L318"></a><tt class="py-lineno">318</tt> <tt class="py-line"><tt class="py-docstring"> substitution regex.</tt> </tt>
-<a name="L319"></a><tt class="py-lineno">319</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L320"></a><tt class="py-lineno">320</tt> <tt class="py-line"><tt class="py-docstring"> .. _jsmin.c by Douglas Crockford:</tt> </tt>
-<a name="L321"></a><tt class="py-lineno">321</tt> <tt class="py-line"><tt class="py-docstring"> http://www.crockford.com/javascript/jsmin.c</tt> </tt>
-<a name="L322"></a><tt class="py-lineno">322</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L323"></a><tt class="py-lineno">323</tt> <tt class="py-line"><tt class="py-docstring"> :Warning: This function is the digest of a _make_jsmin() call. It just</tt> </tt>
-<a name="L324"></a><tt class="py-lineno">324</tt> <tt class="py-line"><tt class="py-docstring"> utilizes the resulting regexes. It's here for fun and may</tt> </tt>
-<a name="L325"></a><tt class="py-lineno">325</tt> <tt class="py-line"><tt class="py-docstring"> vanish any time. Use the `jsmin` function instead.</tt> </tt>
-<a name="L326"></a><tt class="py-lineno">326</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L327"></a><tt class="py-lineno">327</tt> <tt class="py-line"><tt class="py-docstring"> :Parameters:</tt> </tt>
-<a name="L328"></a><tt class="py-lineno">328</tt> <tt class="py-line"><tt class="py-docstring"> `script` : ``str``</tt> </tt>
-<a name="L329"></a><tt class="py-lineno">329</tt> <tt class="py-line"><tt class="py-docstring"> Script to minify</tt> </tt>
-<a name="L330"></a><tt class="py-lineno">330</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L331"></a><tt class="py-lineno">331</tt> <tt class="py-line"><tt class="py-docstring"> `keep_bang_comments` : ``bool``</tt> </tt>
-<a name="L332"></a><tt class="py-lineno">332</tt> <tt class="py-line"><tt class="py-docstring"> Keep comments starting with an exclamation mark? (``/*!...*/``)</tt> </tt>
-<a name="L333"></a><tt class="py-lineno">333</tt> <tt class="py-line"><tt class="py-docstring"></tt> </tt>
-<a name="L334"></a><tt class="py-lineno">334</tt> <tt class="py-line"><tt class="py-docstring"> :Return: Minified script</tt> </tt>
-<a name="L335"></a><tt class="py-lineno">335</tt> <tt class="py-line"><tt class="py-docstring"> :Rtype: ``str``</tt> </tt>
-<a name="L336"></a><tt class="py-lineno">336</tt> <tt class="py-line"><tt class="py-docstring"> """</tt> </tt>
-<a name="L337"></a><tt class="py-lineno">337</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-keyword">not</tt> <tt class="py-name">keep_bang_comments</tt><tt class="py-op">:</tt> </tt>
-<a name="L338"></a><tt class="py-lineno">338</tt> <tt class="py-line"> <tt class="py-name">rex</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt> </tt>
-<a name="L339"></a><tt class="py-lineno">339</tt> <tt class="py-line"> <tt class="py-string">r'([^\047"/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]'</tt> </tt>
-<a name="L340"></a><tt class="py-lineno">340</tt> <tt class="py-line"> <tt class="py-string">r'|\r?\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]'</tt> </tt>
-<a name="L341"></a><tt class="py-lineno">341</tt> <tt class="py-line"> <tt class="py-string">r'|\r?\n|\r)[^"\\\r\n]*)*"))[^\047"/\000-\040]*)|(?&lt;=[(,=:\[!&amp;|?'</tt> </tt>
-<a name="L342"></a><tt class="py-lineno">342</tt> <tt class="py-line"> <tt class="py-string">r'{};\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*'</tt> </tt>
-<a name="L343"></a><tt class="py-lineno">343</tt> <tt class="py-line"> <tt class="py-string">r'][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\0'</tt> </tt>
-<a name="L344"></a><tt class="py-lineno">344</tt> <tt class="py-line"> <tt class="py-string">r'14\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*((?:/(?![\r'</tt> </tt>
-<a name="L345"></a><tt class="py-lineno">345</tt> <tt class="py-line"> <tt class="py-string">r'\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r'</tt> </tt>
-<a name="L346"></a><tt class="py-lineno">346</tt> <tt class="py-line"> <tt class="py-string">r'\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/)[^\047"/\000-\040]*)|(?&lt;'</tt> </tt>
-<a name="L347"></a><tt class="py-lineno">347</tt> <tt class="py-line"> <tt class="py-string">r'=[\000-#%-,./:-@\[-^`{-~-]return)(?:[\000-\011\013\014\016-\04'</tt> </tt>
-<a name="L348"></a><tt class="py-lineno">348</tt> <tt class="py-line"> <tt class="py-string">r'0]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?['</tt> </tt>
-<a name="L349"></a><tt class="py-lineno">349</tt> <tt class="py-line"> <tt class="py-string">r'\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^'</tt> </tt>
-<a name="L350"></a><tt class="py-lineno">350</tt> <tt class="py-line"> <tt class="py-string">r'*]*\*+)*/)))*((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:'</tt> </tt>
-<a name="L351"></a><tt class="py-lineno">351</tt> <tt class="py-line"> <tt class="py-string">r'\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/)['</tt> </tt>
-<a name="L352"></a><tt class="py-lineno">352</tt> <tt class="py-line"> <tt class="py-string">r'^\047"/\000-\040]*)|(?&lt;=[^\000-!#%&amp;(*,./:-@\[\\^`{|~])(?:[\000'</tt> </tt>
-<a name="L353"></a><tt class="py-lineno">353</tt> <tt class="py-line"> <tt class="py-string">r'-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?'</tt> </tt>
-<a name="L354"></a><tt class="py-lineno">354</tt> <tt class="py-line"> <tt class="py-string">r':((?:(?://[^\r\n]*)?[\r\n]))(?:[\000-\011\013\014\016-\040]|(?'</tt> </tt>
-<a name="L355"></a><tt class="py-lineno">355</tt> <tt class="py-line"> <tt class="py-string">r':/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040"#%-\047)*,.'</tt> </tt>
-<a name="L356"></a><tt class="py-lineno">356</tt> <tt class="py-line"> <tt class="py-string">r'/:-@\\-^`|-~])|(?&lt;=[^\000-#%-,./:-@\[-^`{-~-])((?:[\000-\011\0'</tt> </tt>
-<a name="L357"></a><tt class="py-lineno">357</tt> <tt class="py-line"> <tt class="py-string">r'13\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=[^\00'</tt> </tt>
-<a name="L358"></a><tt class="py-lineno">358</tt> <tt class="py-line"> <tt class="py-string">r'0-#%-,./:-@\[-^`{-~-])|(?&lt;=\+)((?:[\000-\011\013\014\016-\040]'</tt> </tt>
-<a name="L359"></a><tt class="py-lineno">359</tt> <tt class="py-line"> <tt class="py-string">r'|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=\+)|(?&lt;=-)((?:[\000-'</tt> </tt>
-<a name="L360"></a><tt class="py-lineno">360</tt> <tt class="py-line"> <tt class="py-string">r'\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?'</tt> </tt>
-<a name="L361"></a><tt class="py-lineno">361</tt> <tt class="py-line"> <tt class="py-string">r'=-)|(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]'</tt> </tt>
-<a name="L362"></a><tt class="py-lineno">362</tt> <tt class="py-line"> <tt class="py-string">r'*\*+)*/))+|(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\0'</tt> </tt>
-<a name="L363"></a><tt class="py-lineno">363</tt> <tt class="py-line"> <tt class="py-string">r'16-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+'</tt> </tt>
-<a name="L364"></a><tt class="py-lineno">364</tt> <tt class="py-line"> <tt class="py-op">)</tt> </tt>
-<a name="L365"></a><tt class="py-lineno">365</tt> <tt class="py-line"> </tt>
-<a name="L366"></a><tt class="py-lineno">366</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">subber</tt><tt class="py-op">(</tt><tt class="py-param">match</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L367"></a><tt class="py-lineno">367</tt> <tt class="py-line"> <tt class="py-docstring">""" Substitution callback """</tt> </tt>
-<a name="L368"></a><tt class="py-lineno">368</tt> <tt class="py-line"> <tt class="py-name">groups</tt> <tt class="py-op">=</tt> <tt class="py-name">match</tt><tt class="py-op">.</tt><tt class="py-name">groups</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-<a name="L369"></a><tt class="py-lineno">369</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-op">(</tt> </tt>
-<a name="L370"></a><tt class="py-lineno">370</tt> <tt class="py-line"> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L371"></a><tt class="py-lineno">371</tt> <tt class="py-line"> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L372"></a><tt class="py-lineno">372</tt> <tt class="py-line"> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L373"></a><tt class="py-lineno">373</tt> <tt class="py-line"> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">3</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L374"></a><tt class="py-lineno">374</tt> <tt class="py-line"> <tt class="py-op">(</tt><tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">4</tt><tt class="py-op">]</tt> <tt class="py-keyword">and</tt> <tt class="py-string">'\n'</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L375"></a><tt class="py-lineno">375</tt> <tt class="py-line"> <tt class="py-op">(</tt><tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">5</tt><tt class="py-op">]</tt> <tt class="py-keyword">and</tt> <tt class="py-string">' '</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L376"></a><tt class="py-lineno">376</tt> <tt class="py-line"> <tt class="py-op">(</tt><tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">6</tt><tt class="py-op">]</tt> <tt class="py-keyword">and</tt> <tt class="py-string">' '</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L377"></a><tt class="py-lineno">377</tt> <tt class="py-line"> <tt class="py-op">(</tt><tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">7</tt><tt class="py-op">]</tt> <tt class="py-keyword">and</tt> <tt class="py-string">' '</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L378"></a><tt class="py-lineno">378</tt> <tt class="py-line"> <tt class="py-string">''</tt> </tt>
-<a name="L379"></a><tt class="py-lineno">379</tt> <tt class="py-line"> <tt class="py-op">)</tt> </tt>
-</div><a name="L380"></a><tt class="py-lineno">380</tt> <tt class="py-line"> <tt class="py-keyword">else</tt><tt class="py-op">:</tt> </tt>
-<a name="L381"></a><tt class="py-lineno">381</tt> <tt class="py-line"> <tt class="py-name">rex</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt> </tt>
-<a name="L382"></a><tt class="py-lineno">382</tt> <tt class="py-line"> <tt class="py-string">r'([^\047"/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]'</tt> </tt>
-<a name="L383"></a><tt class="py-lineno">383</tt> <tt class="py-line"> <tt class="py-string">r'|\r?\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]'</tt> </tt>
-<a name="L384"></a><tt class="py-lineno">384</tt> <tt class="py-line"> <tt class="py-string">r'|\r?\n|\r)[^"\\\r\n]*)*"))[^\047"/\000-\040]*)|((?:/\*![^*]*\*'</tt> </tt>
-<a name="L385"></a><tt class="py-lineno">385</tt> <tt class="py-line"> <tt class="py-string">r'+(?:[^/*][^*]*\*+)*/)[^\047"/\000-\040]*)|(?&lt;=[(,=:\[!&amp;|?{};\r'</tt> </tt>
-<a name="L386"></a><tt class="py-lineno">386</tt> <tt class="py-line"> <tt class="py-string">r'\n])(?:[\000-\011\013\014\016-\040]|(?:/\*(?!!)[^*]*\*+(?:[^/*'</tt> </tt>
-<a name="L387"></a><tt class="py-lineno">387</tt> <tt class="py-line"> <tt class="py-string">r'][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\0'</tt> </tt>
-<a name="L388"></a><tt class="py-lineno">388</tt> <tt class="py-line"> <tt class="py-string">r'14\016-\040]|(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*((?:/('</tt> </tt>
-<a name="L389"></a><tt class="py-lineno">389</tt> <tt class="py-line"> <tt class="py-string">r'?![\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:'</tt> </tt>
-<a name="L390"></a><tt class="py-lineno">390</tt> <tt class="py-line"> <tt class="py-string">r'\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/)[^\047"/\000-\040]'</tt> </tt>
-<a name="L391"></a><tt class="py-lineno">391</tt> <tt class="py-line"> <tt class="py-string">r'*)|(?&lt;=[\000-#%-,./:-@\[-^`{-~-]return)(?:[\000-\011\013\014\0'</tt> </tt>
-<a name="L392"></a><tt class="py-lineno">392</tt> <tt class="py-line"> <tt class="py-string">r'16-\040]|(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://['</tt> </tt>
-<a name="L393"></a><tt class="py-lineno">393</tt> <tt class="py-line"> <tt class="py-string">r'^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*(?!!)[^*'</tt> </tt>
-<a name="L394"></a><tt class="py-lineno">394</tt> <tt class="py-line"> <tt class="py-string">r']*\*+(?:[^/*][^*]*\*+)*/)))*((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:('</tt> </tt>
-<a name="L395"></a><tt class="py-lineno">395</tt> <tt class="py-line"> <tt class="py-string">r'?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/'</tt> </tt>
-<a name="L396"></a><tt class="py-lineno">396</tt> <tt class="py-line"> <tt class="py-string">r'\\\[\r\n]*)*/)[^\047"/\000-\040]*)|(?&lt;=[^\000-!#%&amp;(*,./:-@\[\\'</tt> </tt>
-<a name="L397"></a><tt class="py-lineno">397</tt> <tt class="py-line"> <tt class="py-string">r'^`{|~])(?:[\000-\011\013\014\016-\040]|(?:/\*(?!!)[^*]*\*+(?:['</tt> </tt>
-<a name="L398"></a><tt class="py-lineno">398</tt> <tt class="py-line"> <tt class="py-string">r'^/*][^*]*\*+)*/))*(?:((?:(?://[^\r\n]*)?[\r\n]))(?:[\000-\011'</tt> </tt>
-<a name="L399"></a><tt class="py-lineno">399</tt> <tt class="py-line"> <tt class="py-string">r'\013\014\016-\040]|(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+'</tt> </tt>
-<a name="L400"></a><tt class="py-lineno">400</tt> <tt class="py-line"> <tt class="py-string">r'(?=[^\000-\040"#%-\047)*,./:-@\\-^`|-~])|(?&lt;=[^\000-#%-,./:-@'</tt> </tt>
-<a name="L401"></a><tt class="py-lineno">401</tt> <tt class="py-line"> <tt class="py-string">r'\[-^`{-~-])((?:[\000-\011\013\014\016-\040]|(?:/\*(?!!)[^*]*\*'</tt> </tt>
-<a name="L402"></a><tt class="py-lineno">402</tt> <tt class="py-line"> <tt class="py-string">r'+(?:[^/*][^*]*\*+)*/)))+(?=[^\000-#%-,./:-@\[-^`{-~-])|(?&lt;=\+)'</tt> </tt>
-<a name="L403"></a><tt class="py-lineno">403</tt> <tt class="py-line"> <tt class="py-string">r'((?:[\000-\011\013\014\016-\040]|(?:/\*(?!!)[^*]*\*+(?:[^/*][^'</tt> </tt>
-<a name="L404"></a><tt class="py-lineno">404</tt> <tt class="py-line"> <tt class="py-string">r'*]*\*+)*/)))+(?=\+)|(?&lt;=-)((?:[\000-\011\013\014\016-\040]|(?:'</tt> </tt>
-<a name="L405"></a><tt class="py-lineno">405</tt> <tt class="py-line"> <tt class="py-string">r'/\*(?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=-)|(?:[\000-\011\013'</tt> </tt>
-<a name="L406"></a><tt class="py-lineno">406</tt> <tt class="py-line"> <tt class="py-string">r'\014\016-\040]|(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/))+|(?:(?'</tt> </tt>
-<a name="L407"></a><tt class="py-lineno">407</tt> <tt class="py-line"> <tt class="py-string">r':(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*('</tt> </tt>
-<a name="L408"></a><tt class="py-lineno">408</tt> <tt class="py-line"> <tt class="py-string">r'?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+'</tt> </tt>
-<a name="L409"></a><tt class="py-lineno">409</tt> <tt class="py-line"> <tt class="py-op">)</tt> </tt>
-<a name="L410"></a><tt class="py-lineno">410</tt> <tt class="py-line"> </tt>
-<a name="L411"></a><tt class="py-lineno">411</tt> <tt class="py-line"> <tt class="py-keyword">def</tt> <tt class="py-def-name">subber</tt><tt class="py-op">(</tt><tt class="py-param">match</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-<a name="L412"></a><tt class="py-lineno">412</tt> <tt class="py-line"> <tt class="py-docstring">""" Substitution callback """</tt> </tt>
-<a name="L413"></a><tt class="py-lineno">413</tt> <tt class="py-line"> <tt class="py-name">groups</tt> <tt class="py-op">=</tt> <tt class="py-name">match</tt><tt class="py-op">.</tt><tt class="py-name">groups</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-<a name="L414"></a><tt class="py-lineno">414</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-op">(</tt> </tt>
-<a name="L415"></a><tt class="py-lineno">415</tt> <tt class="py-line"> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">0</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L416"></a><tt class="py-lineno">416</tt> <tt class="py-line"> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L417"></a><tt class="py-lineno">417</tt> <tt class="py-line"> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">2</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L418"></a><tt class="py-lineno">418</tt> <tt class="py-line"> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">3</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L419"></a><tt class="py-lineno">419</tt> <tt class="py-line"> <tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">4</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L420"></a><tt class="py-lineno">420</tt> <tt class="py-line"> <tt class="py-op">(</tt><tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">5</tt><tt class="py-op">]</tt> <tt class="py-keyword">and</tt> <tt class="py-string">'\n'</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L421"></a><tt class="py-lineno">421</tt> <tt class="py-line"> <tt class="py-op">(</tt><tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">6</tt><tt class="py-op">]</tt> <tt class="py-keyword">and</tt> <tt class="py-string">' '</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L422"></a><tt class="py-lineno">422</tt> <tt class="py-line"> <tt class="py-op">(</tt><tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">7</tt><tt class="py-op">]</tt> <tt class="py-keyword">and</tt> <tt class="py-string">' '</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L423"></a><tt class="py-lineno">423</tt> <tt class="py-line"> <tt class="py-op">(</tt><tt class="py-name">groups</tt><tt class="py-op">[</tt><tt class="py-number">8</tt><tt class="py-op">]</tt> <tt class="py-keyword">and</tt> <tt class="py-string">' '</tt><tt class="py-op">)</tt> <tt class="py-keyword">or</tt> </tt>
-<a name="L424"></a><tt class="py-lineno">424</tt> <tt class="py-line"> <tt class="py-string">''</tt> </tt>
-<a name="L425"></a><tt class="py-lineno">425</tt> <tt class="py-line"> <tt class="py-op">)</tt> </tt>
-</div><a name="L426"></a><tt class="py-lineno">426</tt> <tt class="py-line"> </tt>
-<a name="L427"></a><tt class="py-lineno">427</tt> <tt class="py-line"> <tt class="py-keyword">return</tt> <tt class="py-name">_re</tt><tt class="py-op">.</tt><tt class="py-name">sub</tt><tt class="py-op">(</tt><tt class="py-name">rex</tt><tt class="py-op">,</tt> <tt class="py-name">subber</tt><tt class="py-op">,</tt> <tt class="py-string">'\n%s\n'</tt> <tt class="py-op">%</tt> <tt class="py-name">script</tt><tt class="py-op">)</tt><tt class="py-op">.</tt><tt class="py-name">strip</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-</div><a name="L428"></a><tt class="py-lineno">428</tt> <tt class="py-line"> </tt>
-<a name="L429"></a><tt class="py-lineno">429</tt> <tt class="py-line"> </tt>
-<a name="L430"></a><tt class="py-lineno">430</tt> <tt class="py-line"><tt class="py-keyword">if</tt> <tt class="py-name">__name__</tt> <tt class="py-op">==</tt> <tt class="py-string">'__main__'</tt><tt class="py-op">:</tt> </tt>
-<a name="main"></a><div id="main-def"><a name="L431"></a><tt class="py-lineno">431</tt> <a class="py-toggle" href="#" id="main-toggle" onclick="return toggle('main');">-</a><tt class="py-line"> <tt class="py-keyword">def</tt> <a class="py-def-name" href="rjsmin-module.html#main">main</a><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">:</tt> </tt>
-</div><div id="main-collapsed" style="display:none;" pad="+++" indent="++++++++"></div><div id="main-expanded"><a name="L432"></a><tt class="py-lineno">432</tt> <tt class="py-line"> <tt class="py-docstring">""" Main """</tt> </tt>
-<a name="L433"></a><tt class="py-lineno">433</tt> <tt class="py-line"> <tt class="py-keyword">import</tt> <tt class="py-name">sys</tt> <tt class="py-keyword">as</tt> <tt class="py-name">_sys</tt> </tt>
-<a name="L434"></a><tt class="py-lineno">434</tt> <tt class="py-line"> <tt class="py-name">keep_bang_comments</tt> <tt class="py-op">=</tt> <tt class="py-op">(</tt> </tt>
-<a name="L435"></a><tt class="py-lineno">435</tt> <tt class="py-line"> <tt class="py-string">'-b'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
-<a name="L436"></a><tt class="py-lineno">436</tt> <tt class="py-line"> <tt class="py-keyword">or</tt> <tt class="py-string">'-bp'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
-<a name="L437"></a><tt class="py-lineno">437</tt> <tt class="py-line"> <tt class="py-keyword">or</tt> <tt class="py-string">'-pb'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> </tt>
-<a name="L438"></a><tt class="py-lineno">438</tt> <tt class="py-line"> <tt class="py-op">)</tt> </tt>
-<a name="L439"></a><tt class="py-lineno">439</tt> <tt class="py-line"> <tt class="py-keyword">if</tt> <tt class="py-string">'-p'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> <tt class="py-keyword">or</tt> <tt class="py-string">'-bp'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt> \ </tt>
-<a name="L440"></a><tt class="py-lineno">440</tt> <tt class="py-line"> <tt class="py-keyword">or</tt> <tt class="py-string">'-pb'</tt> <tt class="py-keyword">in</tt> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">argv</tt><tt class="py-op">[</tt><tt class="py-number">1</tt><tt class="py-op">:</tt><tt class="py-op">]</tt><tt class="py-op">:</tt> </tt>
-<a name="L441"></a><tt class="py-lineno">441</tt> <tt class="py-line"> <tt class="py-keyword">global</tt> <tt id="link-7" class="py-name"><a title="rjsmin.jsmin" class="py-name" href="#" onclick="return doclink('link-7', 'jsmin', 'link-4');">jsmin</a></tt> <tt class="py-comment"># pylint: disable = W0603</tt> </tt>
-<a name="L442"></a><tt class="py-lineno">442</tt> <tt class="py-line"> <tt id="link-8" class="py-name"><a title="rjsmin.jsmin" class="py-name" href="#" onclick="return doclink('link-8', 'jsmin', 'link-4');">jsmin</a></tt> <tt class="py-op">=</tt> <tt class="py-name">_make_jsmin</tt><tt class="py-op">(</tt><tt class="py-name">python_only</tt><tt class="py-op">=</tt><tt class="py-name">True</tt><tt class="py-op">)</tt> </tt>
-<a name="L443"></a><tt class="py-lineno">443</tt> <tt class="py-line"> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">stdout</tt><tt class="py-op">.</tt><tt class="py-name">write</tt><tt class="py-op">(</tt><tt id="link-9" class="py-name"><a title="rjsmin.jsmin" class="py-name" href="#" onclick="return doclink('link-9', 'jsmin', 'link-4');">jsmin</a></tt><tt class="py-op">(</tt> </tt>
-<a name="L444"></a><tt class="py-lineno">444</tt> <tt class="py-line"> <tt class="py-name">_sys</tt><tt class="py-op">.</tt><tt class="py-name">stdin</tt><tt class="py-op">.</tt><tt class="py-name">read</tt><tt class="py-op">(</tt><tt class="py-op">)</tt><tt class="py-op">,</tt> <tt class="py-name">keep_bang_comments</tt><tt class="py-op">=</tt><tt class="py-name">keep_bang_comments</tt> </tt>
-<a name="L445"></a><tt class="py-lineno">445</tt> <tt class="py-line"> <tt class="py-op">)</tt><tt class="py-op">)</tt> </tt>
-</div><a name="L446"></a><tt class="py-lineno">446</tt> <tt class="py-line"> <tt class="py-name">main</tt><tt class="py-op">(</tt><tt class="py-op">)</tt> </tt>
-<a name="L447"></a><tt class="py-lineno">447</tt> <tt class="py-line"> </tt><script type="text/javascript">
-<!--
-expandto(location.href);
-// -->
-</script>
-</pre>
-<br />
-<!-- ==================== NAVIGATION BAR ==================== -->
-<table class="navbar" border="0" width="100%" cellpadding="0"
- bgcolor="#a0c0ff" cellspacing="0">
- <tr valign="middle">
- <!-- Home link -->
- <th bgcolor="#70b0f0" class="navbar-select"
- >&nbsp;&nbsp;&nbsp;Home&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Tree link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Index link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Help link -->
- <th>&nbsp;&nbsp;&nbsp;<a
- href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>
-
- <!-- Project homepage -->
- <th class="navbar" align="right" width="100%">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr><th class="navbar" align="center"
- ><a href="http://opensource.perlig.de/rjsmin/" target="_top">Visit rjsmin Online</a></th>
- </tr></table></th>
- </tr>
-</table>
-
-<script type="text/javascript">
- <!--
- // Private objects are initially displayed (because if
- // javascript is turned off then we want them to be
- // visible); but by default, we want to hide them. So hide
- // them unless we have a cookie that says to show them.
- checkCookie();
- // -->
-</script>
-</body>
-</html>
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/package.cfg b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/package.cfg
deleted file mode 100644
index a09401d5ea2..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/package.cfg
+++ /dev/null
@@ -1,78 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright 2009 - 2014
-# André Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-[package]
-name = rjsmin
-
-python.min = 2.4
-python.max = 3.4
-pypy.min = 1.9
-pypy.max = 2.2
-jython.min = 2.5
-jython.max = 2.7
-
-version.number = 1.0.10
-
-author.name = André Malo
-author.email = nd@perlig.de
-#maintainer.name =
-#maintainer.email =
-url.homepage = http://opensource.perlig.de/rjsmin/
-url.download = http://storage.perlig.de/rjsmin/
-
-
-[docs]
-meta.classifiers = docs/CLASSIFIERS
-meta.description = docs/DESCRIPTION
-meta.summary = docs/SUMMARY
-meta.provides = docs/PROVIDES
-meta.license = LICENSE
-meta.keywords =
- Javascript
- Minimization
-
-apidoc.dir = docs/apidoc
-apidoc.strip = 1
-#apidoc.ignore =
-
-#userdoc.dir = docs/userdoc
-#userdoc.strip = 1
-#userdoc.ignore =
-# .buildinfo
-
-#examples.dir = docs/examples
-#examples.strip = 1
-#examples.ignore =
-
-#man =
-
-extra =
- README.rst
- docs/CHANGES
- docs/BENCHMARKS
-
-
-[manifest]
-#packages.lib = .
-#packages.collect =
-modules = rjsmin
-
-#scripts =
-
-dist =
- bench
- bench.sh
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/rjsmin.c b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/rjsmin.c
deleted file mode 100644
index 53900720bf8..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/rjsmin.c
+++ /dev/null
@@ -1,456 +0,0 @@
-/*
- * Copyright 2011 - 2014
- * Andr\xe9 Malo or his licensors, as applicable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "cext.h"
-EXT_INIT_FUNC;
-
-#define RJSMIN_DULL_BIT (1 << 0)
-#define RJSMIN_PRE_REGEX_BIT (1 << 1)
-#define RJSMIN_REGEX_DULL_BIT (1 << 2)
-#define RJSMIN_REGEX_CC_DULL_BIT (1 << 3)
-#define RJSMIN_ID_LIT_BIT (1 << 4)
-#define RJSMIN_ID_LIT_O_BIT (1 << 5)
-#define RJSMIN_ID_LIT_C_BIT (1 << 6)
-#define RJSMIN_STRING_DULL_BIT (1 << 7)
-#define RJSMIN_SPACE_BIT (1 << 8)
-
-#ifdef EXT3
-typedef Py_UNICODE rchar;
-#else
-typedef unsigned char rchar;
-#endif
-#define U(c) ((rchar)(c))
-
-#define RJSMIN_IS_DULL(c) ((U(c) > 127) || \
- (rjsmin_charmask[U(c) & 0x7F] & RJSMIN_DULL_BIT))
-
-#define RJSMIN_IS_REGEX_DULL(c) ((U(c) > 127) || \
- (rjsmin_charmask[U(c) & 0x7F] & RJSMIN_REGEX_DULL_BIT))
-
-#define RJSMIN_IS_REGEX_CC_DULL(c) ((U(c) > 127) || \
- (rjsmin_charmask[U(c) & 0x7F] & RJSMIN_REGEX_CC_DULL_BIT))
-
-#define RJSMIN_IS_STRING_DULL(c) ((U(c) > 127) || \
- (rjsmin_charmask[U(c) & 0x7F] & RJSMIN_STRING_DULL_BIT))
-
-#define RJSMIN_IS_ID_LITERAL(c) ((U(c) > 127) || \
- (rjsmin_charmask[U(c) & 0x7F] & RJSMIN_ID_LIT_BIT))
-
-#define RJSMIN_IS_ID_LITERAL_OPEN(c) ((U(c) > 127) || \
- (rjsmin_charmask[U(c) & 0x7F] & RJSMIN_ID_LIT_O_BIT))
-
-#define RJSMIN_IS_ID_LITERAL_CLOSE(c) ((U(c) > 127) || \
- (rjsmin_charmask[U(c) & 0x7F] & RJSMIN_ID_LIT_C_BIT))
-
-#define RJSMIN_IS_SPACE(c) ((U(c) <= 127) && \
- (rjsmin_charmask[U(c) & 0x7F] & RJSMIN_SPACE_BIT))
-
-#define RJSMIN_IS_PRE_REGEX_1(c) ((U(c) <= 127) && \
- (rjsmin_charmask[U(c) & 0x7F] & RJSMIN_PRE_REGEX_BIT))
-
-
-static const unsigned short rjsmin_charmask[128] = {
- 396, 396, 396, 396, 396, 396, 396, 396,
- 396, 396, 2, 396, 396, 2, 396, 396,
- 396, 396, 396, 396, 396, 396, 396, 396,
- 396, 396, 396, 396, 396, 396, 396, 396,
- 396, 175, 76, 141, 253, 141, 143, 76,
- 175, 205, 141, 237, 143, 237, 141, 136,
- 253, 253, 253, 253, 253, 253, 253, 253,
- 253, 253, 143, 143, 141, 143, 141, 143,
- 141, 253, 253, 253, 253, 253, 253, 253,
- 253, 253, 253, 253, 253, 253, 253, 253,
- 253, 253, 253, 253, 253, 253, 253, 253,
- 253, 253, 253, 171, 1, 197, 141, 253,
- 141, 253, 253, 253, 253, 253, 253, 253,
- 253, 253, 253, 253, 253, 253, 253, 253,
- 253, 253, 253, 253, 253, 253, 253, 253,
- 253, 253, 253, 175, 143, 207, 141, 253
-};
-
-static Py_ssize_t
-rjsmin(const rchar *source, rchar *target, Py_ssize_t length,
- int keep_bang_comments)
-{
- const rchar *reset, *sentinel = source + length;
- rchar *tstart = target;
- rchar c, quote;
-
- while (source < sentinel) {
- c = *source++;
- if (RJSMIN_IS_DULL(c)) {
- *target++ = c;
- continue;
- }
- switch (c) {
-
- /* String */
- case U('\''): case U('"'):
- reset = source;
- *target++ = quote = c;
- while (source < sentinel) {
- c = *source++;
- *target++ = c;
- if (RJSMIN_IS_STRING_DULL(c))
- continue;
- switch (c) {
- case U('\''): case U('"'):
- if (c == quote)
- goto cont;
- continue;
- case U('\\'):
- if (source < sentinel) {
- c = *source++;
- *target++ = c;
- if (c == U('\r') && source < sentinel
- && *source == U('\n'))
- *target++ = *source++;
- }
- continue;
- }
- break;
- }
- target -= source - reset;
- source = reset;
- continue;
-
- /* Comment or Regex or something else entirely */
- case U('/'):
- if (!(source < sentinel)) {
- *target++ = c;
- }
- else {
- switch (*source) {
- /* Comment */
- case U('*'): case U('/'):
- goto skip_or_copy_ws;
-
- default:
- if ( target == tstart
- || RJSMIN_IS_PRE_REGEX_1(*(target - 1))
- || (
- (target - tstart >= 6)
- && *(target - 1) == U('n')
- && *(target - 2) == U('r')
- && *(target - 3) == U('u')
- && *(target - 4) == U('t')
- && *(target - 5) == U('e')
- && *(target - 6) == U('r')
- && (
- target - tstart == 6
- || !RJSMIN_IS_ID_LITERAL(*(target - 7))
- )
- )) {
-
- /* Regex */
- reset = source;
- *target++ = U('/');
- while (source < sentinel) {
- c = *source++;
- *target++ = c;
- if (RJSMIN_IS_REGEX_DULL(c))
- continue;
- switch (c) {
- case U('/'):
- goto cont;
- case U('\\'):
- if (source < sentinel) {
- c = *source++;
- *target++ = c;
- if (c == U('\r') || c == U('\n'))
- break;
- }
- continue;
- case U('['):
- while (source < sentinel) {
- c = *source++;
- *target++ = c;
- if (RJSMIN_IS_REGEX_CC_DULL(c))
- continue;
- switch (c) {
- case U('\\'):
- if (source < sentinel) {
- c = *source++;
- *target++ = c;
- if (c == U('\r') || c == U('\n'))
- break;
- }
- continue;
- case U(']'):
- goto cont_regex;
- }
- }
- break;
- }
- break;
- cont_regex:
- continue;
- }
- target -= source - reset;
- source = reset;
- }
- else {
- /* Just a slash */
- *target++ = c;
- }
- continue;
- }
- }
- continue;
-
- /* Whitespace */
- default:
- skip_or_copy_ws:
- quote = U(' ');
- --source;
- while (source < sentinel) {
- c = *source++;
- if (RJSMIN_IS_SPACE(c))
- continue;
- switch (c) {
- case U('\r'): case U('\n'):
- quote = U('\n');
- continue;
- case U('/'):
- if (source < sentinel) {
- switch (*source) {
- case U('*'):
- reset = source++;
- /* copy bang comment, if requested */
- if ( keep_bang_comments && source < sentinel
- && *source == U('!')) {
- *target++ = U('/');
- *target++ = U('*');
- *target++ = *source++;
- while (source < sentinel) {
- c = *source++;
- *target++ = c;
- if (c == U('*') && source < sentinel
- && *source == U('/')) {
- *target++ = *source++;
- reset = NULL;
- break;
- }
- }
- if (!reset)
- continue;
- target -= source - reset;
- source = reset;
- }
- /* strip regular comment */
- else {
- while (source < sentinel) {
- c = *source++;
- if (c == U('*') && source < sentinel
- && *source == U('/')) {
- ++source;
- reset = NULL;
- break;
- }
- }
- if (!reset)
- continue;
- source = reset;
- *target++ = U('/');
- }
- goto cont;
- case U('/'):
- ++source;
- while (source < sentinel) {
- c = *source++;
- switch (c) {
- case U('\n'):
- break;
- case U('\r'):
- if (source < sentinel
- && *source == U('\n'))
- ++source;
- break;
- default:
- continue;
- }
- break;
- }
- quote = U('\n');
- continue;
- }
- }
- }
- --source;
- break;
- }
-
- if ((tstart < target && source < sentinel)
- && ((quote == U('\n')
- && RJSMIN_IS_ID_LITERAL_CLOSE(*(target - 1))
- && RJSMIN_IS_ID_LITERAL_OPEN(*source))
- ||
- (quote == U(' ')
- && ((RJSMIN_IS_ID_LITERAL(*(target - 1))
- && RJSMIN_IS_ID_LITERAL(*source))
- || (source < sentinel
- && ((*(target - 1) == U('+')
- && *source == U('+'))
- || (*(target - 1) == U('-')
- && *source == U('-'))))))))
- *target++ = quote;
- }
- cont:
- continue;
- }
- return (Py_ssize_t)(target - tstart);
-}
-
-
-PyDoc_STRVAR(rjsmin_jsmin__doc__,
-"jsmin(script, keep_bang_comments=False)\n\
-\n\
-Minify javascript based on `jsmin.c by Douglas Crockford`_\\.\n\
-\n\
-Instead of parsing the stream char by char, it uses a regular\n\
-expression approach which minifies the whole script with one big\n\
-substitution regex.\n\
-\n\
-.. _jsmin.c by Douglas Crockford:\n\
- http://www.crockford.com/javascript/jsmin.c\n\
-\n\
-:Note: This is a hand crafted C implementation built on the regex\n\
- semantics.\n\
-\n\
-:Parameters:\n\
- `script` : ``str``\n\
- Script to minify\n\
-\n\
- `keep_bang_comments` : ``bool``\n\
- Keep comments starting with an exclamation mark? (``/*!...*/``)\n\
-\n\
-:Return: Minified script\n\
-:Rtype: ``str``");
-
-static PyObject *
-rjsmin_jsmin(PyObject *self, PyObject *args, PyObject *kwds)
-{
- PyObject *script, *keep_bang_comments_ = NULL, *result;
- static char *kwlist[] = {"script", "keep_bang_comments", NULL};
- Py_ssize_t slength, length;
- int keep_bang_comments;
-#ifdef EXT2
- int uni;
-#define UOBJ "O"
-#endif
-#ifdef EXT3
-#define UOBJ "U"
-#endif
-
- if (!PyArg_ParseTupleAndKeywords(args, kwds, UOBJ "|O", kwlist,
- &script, &keep_bang_comments_))
- return NULL;
-
- if (!keep_bang_comments_)
- keep_bang_comments = 0;
- else {
- keep_bang_comments = PyObject_IsTrue(keep_bang_comments_);
- if (keep_bang_comments == -1)
- return NULL;
- }
-
-#ifdef EXT2
- if (PyUnicode_Check(script)) {
- if (!(script = PyUnicode_AsUTF8String(script)))
- return NULL;
- uni = 1;
- }
- else {
- if (!(script = PyObject_Str(script)))
- return NULL;
- uni = 0;
- }
-#endif
-
-#ifdef EXT3
- Py_INCREF(script);
-#define PyString_GET_SIZE PyUnicode_GET_SIZE
-#define PyString_AS_STRING PyUnicode_AS_UNICODE
-#define _PyString_Resize PyUnicode_Resize
-#define PyString_FromStringAndSize PyUnicode_FromUnicode
-#endif
-
- slength = PyString_GET_SIZE(script);
- if (!(result = PyString_FromStringAndSize(NULL, slength))) {
- Py_DECREF(script);
- return NULL;
- }
- Py_BEGIN_ALLOW_THREADS
- length = rjsmin((rchar *)PyString_AS_STRING(script),
- (rchar *)PyString_AS_STRING(result),
- slength, keep_bang_comments);
- Py_END_ALLOW_THREADS
-
- Py_DECREF(script);
- if (length < 0) {
- Py_DECREF(result);
- return NULL;
- }
- if (length != slength && _PyString_Resize(&result, length) == -1)
- return NULL;
-
-#ifdef EXT2
- if (uni) {
- script = PyUnicode_DecodeUTF8(PyString_AS_STRING(result),
- PyString_GET_SIZE(result), "strict");
- Py_DECREF(result);
- if (!script)
- return NULL;
- result = script;
- }
-#endif
- return result;
-}
-
-/* ------------------------ BEGIN MODULE DEFINITION ------------------------ */
-
-EXT_METHODS = {
- {"jsmin",
- (PyCFunction)rjsmin_jsmin, METH_VARARGS | METH_KEYWORDS,
- rjsmin_jsmin__doc__},
-
- {NULL} /* Sentinel */
-};
-
-PyDoc_STRVAR(EXT_DOCS_VAR,
-"C implementation of rjsmin\n\
-==========================\n\
-\n\
-C implementation of rjsmin.");
-
-
-EXT_DEFINE(EXT_MODULE_NAME, EXT_METHODS_VAR, EXT_DOCS_VAR);
-
-EXT_INIT_FUNC {
- PyObject *m;
-
- /* Create the module and populate stuff */
- if (!(m = EXT_CREATE(&EXT_DEFINE_VAR)))
- EXT_INIT_ERROR(NULL);
-
- EXT_ADD_UNICODE(m, "__author__", "Andr\xe9 Malo", "latin-1");
- EXT_ADD_STRING(m, "__docformat__", "restructuredtext en");
-
- EXT_INIT_RETURN(m);
-}
-
-/* ------------------------- END MODULE DEFINITION ------------------------- */
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/rjsmin.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/rjsmin.py
deleted file mode 100755
index e7854798a3a..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/rjsmin.py
+++ /dev/null
@@ -1,446 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: ascii -*-
-r"""
-=====================
- Javascript Minifier
-=====================
-
-rJSmin is a javascript minifier written in python.
-
-The minifier is based on the semantics of `jsmin.c by Douglas Crockford`_\\.
-
-:Copyright:
-
- Copyright 2011 - 2014
- Andr\xe9 Malo or his licensors, as applicable
-
-:License:
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
-The module is a re-implementation aiming for speed, so it can be used at
-runtime (rather than during a preprocessing step). Usually it produces the
-same results as the original ``jsmin.c``. It differs in the following ways:
-
-- there is no error detection: unterminated string, regex and comment
- literals are treated as regular javascript code and minified as such.
-- Control characters inside string and regex literals are left untouched; they
- are not converted to spaces (nor to \\n)
-- Newline characters are not allowed inside string and regex literals, except
- for line continuations in string literals (ECMA-5).
-- "return /regex/" is recognized correctly.
-- "+ +" and "- -" sequences are not collapsed to '++' or '--'
-- Newlines before ! operators are removed more sensibly
-- Comments starting with an exclamation mark (``!``) can be kept optionally
-- rJSmin does not handle streams, but only complete strings. (However, the
- module provides a "streamy" interface).
-
-Since most parts of the logic are handled by the regex engine it's way faster
-than the original python port of ``jsmin.c`` by Baruch Even. The speed factor
-varies between about 6 and 55 depending on input and python version (it gets
-faster the more compressed the input already is). Compared to the
-speed-refactored python port by Dave St.Germain the performance gain is less
-dramatic but still between 3 and 50 (for huge inputs). See the docs/BENCHMARKS
-file for details.
-
-rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more.
-
-Both python 2 and python 3 are supported.
-
-.. _jsmin.c by Douglas Crockford:
- http://www.crockford.com/javascript/jsmin.c
-"""
-if __doc__:
- # pylint: disable = W0622
- __doc__ = __doc__.encode('ascii').decode('unicode_escape')
-__author__ = r"Andr\xe9 Malo".encode('ascii').decode('unicode_escape')
-__docformat__ = "restructuredtext en"
-__license__ = "Apache License, Version 2.0"
-__version__ = '1.0.10'
-__all__ = ['jsmin']
-
-import re as _re
-
-
-def _make_jsmin(python_only=False):
- """
- Generate JS minifier based on `jsmin.c by Douglas Crockford`_
-
- .. _jsmin.c by Douglas Crockford:
- http://www.crockford.com/javascript/jsmin.c
-
- :Parameters:
- `python_only` : ``bool``
- Use only the python variant. If true, the c extension is not even
- tried to be loaded.
-
- :Return: Minifier
- :Rtype: ``callable``
- """
- # pylint: disable = R0912, R0914, W0612
-
- if not python_only:
- try:
- import _rjsmin # pylint: disable = F0401
- except ImportError:
- pass
- else:
- return _rjsmin.jsmin
- try:
- xrange
- except NameError:
- xrange = range # pylint: disable = W0622
-
- space_chars = r'[\000-\011\013\014\016-\040]'
-
- line_comment = r'(?://[^\r\n]*)'
- space_comment = r'(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)'
- space_comment_nobang = r'(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/)'
- bang_comment = r'(?:/\*![^*]*\*+(?:[^/*][^*]*\*+)*/)'
-
- string1 = \
- r'(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|\r)[^\047\\\r\n]*)*\047)'
- string2 = r'(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]|\r?\n|\r)[^"\\\r\n]*)*")'
- strings = r'(?:%s|%s)' % (string1, string2)
-
- charclass = r'(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\])'
- nospecial = r'[^/\\\[\r\n]'
- regex = r'(?:/(?![\r\n/*])%s*(?:(?:\\[^\r\n]|%s)%s*)*/)' % (
- nospecial, charclass, nospecial
- )
- space = r'(?:%s|%s)' % (space_chars, space_comment)
- space_nobang = r'(?:%s|%s)' % (space_chars, space_comment_nobang)
- newline = r'(?:%s?[\r\n])' % line_comment
-
- def fix_charclass(result):
- """ Fixup string of chars to fit into a regex char class """
- pos = result.find('-')
- if pos >= 0:
- result = r'%s%s-' % (result[:pos], result[pos + 1:])
-
- def sequentize(string):
- """
- Notate consecutive characters as sequence
-
- (1-4 instead of 1234)
- """
- first, last, result = None, None, []
- for char in map(ord, string):
- if last is None:
- first = last = char
- elif last + 1 == char:
- last = char
- else:
- result.append((first, last))
- first = last = char
- if last is not None:
- result.append((first, last))
- return ''.join(['%s%s%s' % (
- chr(first),
- last > first + 1 and '-' or '',
- last != first and chr(last) or ''
- ) for first, last in result])
-
- return _re.sub(
- r'([\000-\040\047])', # \047 for better portability
- lambda m: '\\%03o' % ord(m.group(1)), (
- sequentize(result)
- .replace('\\', '\\\\')
- .replace('[', '\\[')
- .replace(']', '\\]')
- )
- )
-
- def id_literal_(what):
- """ Make id_literal like char class """
- match = _re.compile(what).match
- result = ''.join([
- chr(c) for c in xrange(127) if not match(chr(c))
- ])
- return '[^%s]' % fix_charclass(result)
-
- def not_id_literal_(keep):
- """ Make negated id_literal like char class """
- match = _re.compile(id_literal_(keep)).match
- result = ''.join([
- chr(c) for c in xrange(127) if not match(chr(c))
- ])
- return r'[%s]' % fix_charclass(result)
-
- not_id_literal = not_id_literal_(r'[a-zA-Z0-9_$]')
- preregex1 = r'[(,=:\[!&|?{};\r\n]'
- preregex2 = r'%(not_id_literal)sreturn' % locals()
-
- id_literal = id_literal_(r'[a-zA-Z0-9_$]')
- id_literal_open = id_literal_(r'[a-zA-Z0-9_${\[(!+-]')
- id_literal_close = id_literal_(r'[a-zA-Z0-9_$}\])"\047+-]')
-
- dull = r'[^\047"/\000-\040]'
-
- space_sub_simple = _re.compile((
- # noqa pylint: disable = C0330
-
- r'(%(dull)s+)'
- r'|(%(strings)s%(dull)s*)'
- r'|(?<=%(preregex1)s)'
- r'%(space)s*(?:%(newline)s%(space)s*)*'
- r'(%(regex)s%(dull)s*)'
- r'|(?<=%(preregex2)s)'
- r'%(space)s*(?:%(newline)s%(space)s)*'
- r'(%(regex)s%(dull)s*)'
- r'|(?<=%(id_literal_close)s)'
- r'%(space)s*(?:(%(newline)s)%(space)s*)+'
- r'(?=%(id_literal_open)s)'
- r'|(?<=%(id_literal)s)(%(space)s)+(?=%(id_literal)s)'
- r'|(?<=\+)(%(space)s)+(?=\+)'
- r'|(?<=-)(%(space)s)+(?=-)'
- r'|%(space)s+'
- r'|(?:%(newline)s%(space)s*)+'
- ) % locals()).sub
- #print space_sub_simple.__self__.pattern
-
- def space_subber_simple(match):
- """ Substitution callback """
- # pylint: disable = R0911
-
- groups = match.groups()
- if groups[0]:
- return groups[0]
- elif groups[1]:
- return groups[1]
- elif groups[2]:
- return groups[2]
- elif groups[3]:
- return groups[3]
- elif groups[4]:
- return '\n'
- elif groups[5] or groups[6] or groups[7]:
- return ' '
- else:
- return ''
-
- space_sub_banged = _re.compile((
- # noqa pylint: disable = C0330
-
- r'(%(dull)s+)'
- r'|(%(strings)s%(dull)s*)'
- r'|(%(bang_comment)s%(dull)s*)'
- r'|(?<=%(preregex1)s)'
- r'%(space)s*(?:%(newline)s%(space)s*)*'
- r'(%(regex)s%(dull)s*)'
- r'|(?<=%(preregex2)s)'
- r'%(space)s*(?:%(newline)s%(space)s)*'
- r'(%(regex)s%(dull)s*)'
- r'|(?<=%(id_literal_close)s)'
- r'%(space)s*(?:(%(newline)s)%(space)s*)+'
- r'(?=%(id_literal_open)s)'
- r'|(?<=%(id_literal)s)(%(space)s)+(?=%(id_literal)s)'
- r'|(?<=\+)(%(space)s)+(?=\+)'
- r'|(?<=-)(%(space)s)+(?=-)'
- r'|%(space)s+'
- r'|(?:%(newline)s%(space)s*)+'
- ) % dict(locals(), space=space_nobang)).sub
- #print space_sub_banged.__self__.pattern
-
- def space_subber_banged(match):
- """ Substitution callback """
- # pylint: disable = R0911
-
- groups = match.groups()
- if groups[0]:
- return groups[0]
- elif groups[1]:
- return groups[1]
- elif groups[2]:
- return groups[2]
- elif groups[3]:
- return groups[3]
- elif groups[4]:
- return groups[4]
- elif groups[5]:
- return '\n'
- elif groups[6] or groups[7] or groups[8]:
- return ' '
- else:
- return ''
-
- def jsmin(script, keep_bang_comments=False): # pylint: disable = W0621
- r"""
- Minify javascript based on `jsmin.c by Douglas Crockford`_\.
-
- Instead of parsing the stream char by char, it uses a regular
- expression approach which minifies the whole script with one big
- substitution regex.
-
- .. _jsmin.c by Douglas Crockford:
- http://www.crockford.com/javascript/jsmin.c
-
- :Parameters:
- `script` : ``str``
- Script to minify
-
- `keep_bang_comments` : ``bool``
- Keep comments starting with an exclamation mark? (``/*!...*/``)
-
- :Return: Minified script
- :Rtype: ``str``
- """
- if keep_bang_comments:
- return space_sub_banged(
- space_subber_banged, '\n%s\n' % script
- ).strip()
- else:
- return space_sub_simple(
- space_subber_simple, '\n%s\n' % script
- ).strip()
-
- return jsmin
-
-jsmin = _make_jsmin()
-
-
-def jsmin_for_posers(script, keep_bang_comments=False):
- r"""
- Minify javascript based on `jsmin.c by Douglas Crockford`_\.
-
- Instead of parsing the stream char by char, it uses a regular
- expression approach which minifies the whole script with one big
- substitution regex.
-
- .. _jsmin.c by Douglas Crockford:
- http://www.crockford.com/javascript/jsmin.c
-
- :Warning: This function is the digest of a _make_jsmin() call. It just
- utilizes the resulting regexes. It's here for fun and may
- vanish any time. Use the `jsmin` function instead.
-
- :Parameters:
- `script` : ``str``
- Script to minify
-
- `keep_bang_comments` : ``bool``
- Keep comments starting with an exclamation mark? (``/*!...*/``)
-
- :Return: Minified script
- :Rtype: ``str``
- """
- if not keep_bang_comments:
- rex = (
- r'([^\047"/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]'
- r'|\r?\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]'
- r'|\r?\n|\r)[^"\\\r\n]*)*"))[^\047"/\000-\040]*)|(?<=[(,=:\[!&|?'
- r'{};\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*'
- r'][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\0'
- r'14\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*((?:/(?![\r'
- r'\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r'
- r'\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/)[^\047"/\000-\040]*)|(?<'
- r'=[\000-#%-,./:-@\[-^`{-~-]return)(?:[\000-\011\013\014\016-\04'
- r'0]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?['
- r'\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^'
- r'*]*\*+)*/)))*((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:'
- r'\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/)['
- r'^\047"/\000-\040]*)|(?<=[^\000-!#%&(*,./:-@\[\\^`{|~])(?:[\000'
- r'-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?'
- r':((?:(?://[^\r\n]*)?[\r\n]))(?:[\000-\011\013\014\016-\040]|(?'
- r':/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+(?=[^\000-\040"#%-\047)*,.'
- r'/:-@\\-^`|-~])|(?<=[^\000-#%-,./:-@\[-^`{-~-])((?:[\000-\011\0'
- r'13\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=[^\00'
- r'0-#%-,./:-@\[-^`{-~-])|(?<=\+)((?:[\000-\011\013\014\016-\040]'
- r'|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=\+)|(?<=-)((?:[\000-'
- r'\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?'
- r'=-)|(?:[\000-\011\013\014\016-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]'
- r'*\*+)*/))+|(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\0'
- r'16-\040]|(?:/\*[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+'
- )
-
- def subber(match):
- """ Substitution callback """
- groups = match.groups()
- return (
- groups[0] or
- groups[1] or
- groups[2] or
- groups[3] or
- (groups[4] and '\n') or
- (groups[5] and ' ') or
- (groups[6] and ' ') or
- (groups[7] and ' ') or
- ''
- )
- else:
- rex = (
- r'([^\047"/\000-\040]+)|((?:(?:\047[^\047\\\r\n]*(?:\\(?:[^\r\n]'
- r'|\r?\n|\r)[^\047\\\r\n]*)*\047)|(?:"[^"\\\r\n]*(?:\\(?:[^\r\n]'
- r'|\r?\n|\r)[^"\\\r\n]*)*"))[^\047"/\000-\040]*)|((?:/\*![^*]*\*'
- r'+(?:[^/*][^*]*\*+)*/)[^\047"/\000-\040]*)|(?<=[(,=:\[!&|?{};\r'
- r'\n])(?:[\000-\011\013\014\016-\040]|(?:/\*(?!!)[^*]*\*+(?:[^/*'
- r'][^*]*\*+)*/))*(?:(?:(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\0'
- r'14\016-\040]|(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/))*)*((?:/('
- r'?![\r\n/*])[^/\\\[\r\n]*(?:(?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:'
- r'\\[^\r\n][^\\\]\r\n]*)*\]))[^/\\\[\r\n]*)*/)[^\047"/\000-\040]'
- r'*)|(?<=[\000-#%-,./:-@\[-^`{-~-]return)(?:[\000-\011\013\014\0'
- r'16-\040]|(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/))*(?:(?:(?://['
- r'^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*(?!!)[^*'
- r']*\*+(?:[^/*][^*]*\*+)*/)))*((?:/(?![\r\n/*])[^/\\\[\r\n]*(?:('
- r'?:\\[^\r\n]|(?:\[[^\\\]\r\n]*(?:\\[^\r\n][^\\\]\r\n]*)*\]))[^/'
- r'\\\[\r\n]*)*/)[^\047"/\000-\040]*)|(?<=[^\000-!#%&(*,./:-@\[\\'
- r'^`{|~])(?:[\000-\011\013\014\016-\040]|(?:/\*(?!!)[^*]*\*+(?:['
- r'^/*][^*]*\*+)*/))*(?:((?:(?://[^\r\n]*)?[\r\n]))(?:[\000-\011'
- r'\013\014\016-\040]|(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+'
- r'(?=[^\000-\040"#%-\047)*,./:-@\\-^`|-~])|(?<=[^\000-#%-,./:-@'
- r'\[-^`{-~-])((?:[\000-\011\013\014\016-\040]|(?:/\*(?!!)[^*]*\*'
- r'+(?:[^/*][^*]*\*+)*/)))+(?=[^\000-#%-,./:-@\[-^`{-~-])|(?<=\+)'
- r'((?:[\000-\011\013\014\016-\040]|(?:/\*(?!!)[^*]*\*+(?:[^/*][^'
- r'*]*\*+)*/)))+(?=\+)|(?<=-)((?:[\000-\011\013\014\016-\040]|(?:'
- r'/\*(?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/)))+(?=-)|(?:[\000-\011\013'
- r'\014\016-\040]|(?:/\*(?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/))+|(?:(?'
- r':(?://[^\r\n]*)?[\r\n])(?:[\000-\011\013\014\016-\040]|(?:/\*('
- r'?!!)[^*]*\*+(?:[^/*][^*]*\*+)*/))*)+'
- )
-
- def subber(match):
- """ Substitution callback """
- groups = match.groups()
- return (
- groups[0] or
- groups[1] or
- groups[2] or
- groups[3] or
- groups[4] or
- (groups[5] and '\n') or
- (groups[6] and ' ') or
- (groups[7] and ' ') or
- (groups[8] and ' ') or
- ''
- )
-
- return _re.sub(rex, subber, '\n%s\n' % script).strip()
-
-
-if __name__ == '__main__':
- def main():
- """ Main """
- import sys as _sys
- keep_bang_comments = (
- '-b' in _sys.argv[1:]
- or '-bp' in _sys.argv[1:]
- or '-pb' in _sys.argv[1:]
- )
- if '-p' in _sys.argv[1:] or '-bp' in _sys.argv[1:] \
- or '-pb' in _sys.argv[1:]:
- global jsmin # pylint: disable = W0603
- jsmin = _make_jsmin(python_only=True)
- _sys.stdout.write(jsmin(
- _sys.stdin.read(), keep_bang_comments=keep_bang_comments
- ))
- main()
diff --git a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/setup.py b/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/setup.py
deleted file mode 100644
index d281913400a..00000000000
--- a/chromium/third_party/catapult/third_party/py_vulcanize/third_party/rjsmin/setup.py
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: ascii -*-
-#
-# Copyright 2006 - 2013
-# Andr\xe9 Malo or his licensors, as applicable
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys as _sys
-from _setup import run
-
-
-def setup(args=None, _manifest=0):
- """ Main setup function """
- from _setup.ext import Extension
-
- if 'java' in _sys.platform.lower():
- # no c extension for jython
- ext = None
- else:
- ext=[Extension('_rjsmin', sources=['rjsmin.c'])]
-
- return run(script_args=args, ext=ext, manifest_only=_manifest)
-
-
-def manifest():
- """ Create List of packaged files """
- return setup((), _manifest=1)
-
-
-if __name__ == '__main__':
- setup()
diff --git a/chromium/third_party/catapult/tracing/bin/PRESUBMIT.py b/chromium/third_party/catapult/tracing/bin/PRESUBMIT.py
deleted file mode 100644
index 799215d729d..00000000000
--- a/chromium/third_party/catapult/tracing/bin/PRESUBMIT.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-import os
-
-def CheckChange(input_api, output_api):
- init_py_path = os.path.join(input_api.PresubmitLocalPath(), '__init__.py')
- res = []
- if os.path.exists(init_py_path):
- res += [output_api.PresubmitError(
- '__init__.py is not allowed to exist in bin/')]
- return res
-
-def CheckChangeOnUpload(input_api, output_api):
- return CheckChange(input_api, output_api)
-
-
-def CheckChangeOnCommit(input_api, output_api):
- return CheckChange(input_api, output_api)
diff --git a/chromium/third_party/catapult/tracing/bin/generate_about_tracing_contents b/chromium/third_party/catapult/tracing/bin/generate_about_tracing_contents
deleted file mode 100755
index 37b868ccfd5..00000000000
--- a/chromium/third_party/catapult/tracing/bin/generate_about_tracing_contents
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import sys
-
-if __name__ == '__main__':
- tracing_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
- '..'))
- sys.path.append(tracing_path)
- from tracing_build import generate_about_tracing_contents
- sys.exit(generate_about_tracing_contents.Main(sys.argv[1:]))
diff --git a/chromium/third_party/catapult/tracing/bin/html2trace b/chromium/third_party/catapult/tracing/bin/html2trace
deleted file mode 100755
index 2d81211368e..00000000000
--- a/chromium/third_party/catapult/tracing/bin/html2trace
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import argparse
-import sys
-import os
-
-sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
-from tracing_build import html2trace
-
-
-def main():
- parser = argparse.ArgumentParser(description='Extract trace data from an '
- 'HTML trace.', add_help=False)
- parser.add_argument('html_path', metavar='HTML_PATH',
- help='HTML file path (input).')
- parser.add_argument('trace_path', metavar='TRACE_PATH',
- help='Trace file path (output). If the HTML file '
- 'contains more than one trace data block, the first '
- 'block will be extracted into %(metavar)s and the rest '
- 'will be extracted into separate files %(metavar)s.1, '
- '%(metavar)s.2, etc.')
- parser.add_argument('--gzipped_output', choices=['true', 'false', 'auto'],
- default='auto', help='Flag whether the output trace '
- 'file should be gzipped.')
- parser.add_argument('-q', '--quiet', action='store_true',
- help='Don\'t print the saved file name(s).')
- parser.add_argument('-h', '--help', action='help',
- help='Show this help message and exit.')
- args = parser.parse_args()
-
- if args.gzipped_output == 'true':
- gzipped_output = True
- elif args.gzipped_output == 'false':
- gzipped_output = False
- else:
- gzipped_output = args.trace_path.endswith('.gz')
-
- saved_paths = html2trace.CopyTraceDataFromHTMLFilePath(
- args.html_path, args.trace_path, gzipped_output)
-
- if not args.quiet:
- print '\n'.join(saved_paths)
-
-
-if __name__ == '__main__':
- sys.exit(main())
diff --git a/chromium/third_party/catapult/tracing/bin/index.html b/chromium/third_party/catapult/tracing/bin/index.html
deleted file mode 100644
index dca63e3e970..00000000000
--- a/chromium/third_party/catapult/tracing/bin/index.html
+++ /dev/null
@@ -1,111 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<head>
-<script>
-function onTraceViewerImportFail() {
- document.addEventListener('DOMContentLoaded', function() {
- document.body.textContent =
- 'tracing/bin/trace_viewer_full.html is missing. ' +
- 'Run vulcanize_trace_viewer from $TRACE_VIEWER and reload.';
- });
-}
-</script>
-<link rel="import" href="trace_viewer_full.html"
- onerror="onTraceViewerImportFail(event)">
-
-<style>
- html, body {
- box-sizing: border-box;
- overflow: hidden;
- margin: 0px;
- padding: 0;
- width: 100%;
- height: 100%;
- }
- #trace-viewer {
- width: 100%;
- height: 100%;
- }
- #trace-viewer:focus {
- outline: none;
- }
-</style>
-<script>
-(function() {
- var viewer;
- var url;
- var model;
-
- function load() {
- var req = new XMLHttpRequest();
- var is_binary = /[.]gz$/.test(url) || /[.]zip$/.test(url);
- req.overrideMimeType('text/plain; charset=x-user-defined');
- req.open('GET', url, true);
- if (is_binary)
- req.responseType = 'arraybuffer';
-
- req.onreadystatechange = function(event) {
- if (req.readyState !== 4)
- return;
-
- window.setTimeout(function() {
- if (req.status === 200)
- onResult(is_binary ? req.response : req.responseText);
- else
- onResultFail(req.status);
- }, 0);
- };
- req.send(null);
- }
-
- function onResultFail(err) {
- var overlay = new tr.ui.b.Overlay();
- overlay.textContent = err + ': ' + url + ' could not be loaded';
- overlay.title = 'Failed to fetch data';
- overlay.visible = true;
- }
-
- function onResult(result) {
- model = new tr.Model();
- var i = new tr.importer.Import(model);
- var p = i.importTracesWithProgressDialog([result]);
- p.then(onModelLoaded, onImportFail);
- }
-
- function onModelLoaded() {
- viewer.model = model;
- viewer.viewTitle = url;
- }
-
- function onImportFail() {
- var overlay = new tr.ui.b.Overlay();
- overlay.textContent = tr.b.normalizeException(err).message;
- overlay.title = 'Import error';
- overlay.visible = true;
- }
-
- document.addEventListener('DOMContentLoaded', function() {
- var container = document.createElement('track-view-container');
- container.id = 'track_view_container';
-
- viewer = document.createElement('tr-ui-timeline-view');
- viewer.track_view_container = container;
- viewer.appendChild(container);
-
- viewer.id = 'trace-viewer';
- viewer.globalMode = true;
- document.body.appendChild(viewer);
-
- url = '../test_data/big_trace.json';
- load();
- });
-}());
-</script>
-</head>
-<body>
-</body>
-</html>
diff --git a/chromium/third_party/catapult/tracing/bin/merge_traces b/chromium/third_party/catapult/tracing/bin/merge_traces
deleted file mode 100755
index bce07dba316..00000000000
--- a/chromium/third_party/catapult/tracing/bin/merge_traces
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import sys
-
-if __name__ == '__main__':
- tracing_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
- sys.path.append(tracing_path)
- from tracing_build import merge_traces
- sys.exit(merge_traces.Main(sys.argv))
diff --git a/chromium/third_party/catapult/tracing/bin/run_dev_server_tests b/chromium/third_party/catapult/tracing/bin/run_dev_server_tests
deleted file mode 100755
index 1e97395009c..00000000000
--- a/chromium/third_party/catapult/tracing/bin/run_dev_server_tests
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import sys
-
-if __name__ == '__main__':
- catapult_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
- '..', '..'))
- sys.path.append(catapult_path)
- from catapult_build import run_dev_server_tests
- sys.exit(run_dev_server_tests.Main(sys.argv + ['--tests=tracing']))
diff --git a/chromium/third_party/catapult/tracing/bin/run_metric b/chromium/third_party/catapult/tracing/bin/run_metric
deleted file mode 100755
index 91a0eb35fb8..00000000000
--- a/chromium/third_party/catapult/tracing/bin/run_metric
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import argparse
-import json
-import os
-import sys
-
-sys.path.insert(1, os.path.join(os.path.dirname(__file__), '..'))
-from tracing.metrics import metric_runner
-from tracing.metrics import discover
-
-def Main(argv):
- all_metrics = discover.DiscoverMetrics(
- ['/tracing/metrics/all_metrics.html'])
- parser = argparse.ArgumentParser(
- description='Runs metrics on local traces')
- parser.add_argument('metric_name',
- help=('The function name of a registered metric, NOT '
- 'filename. Available metrics are: %s' %
- ', '.join(all_metrics)),
- choices=all_metrics, metavar='metricName')
- parser.add_argument('trace_file_or_dir',
- help='A trace file, or a dir containing trace files')
-
- args = parser.parse_args(argv[1:])
- metric = args.metric_name
-
- if os.path.isdir(args.trace_file_or_dir):
- trace_dir = args.trace_file_or_dir
- traces = [os.path.join(trace_dir, trace) for trace in os.listdir(trace_dir)]
- else:
- traces = [args.trace_file_or_dir]
-
- results = {k: v.AsDict()
- for k, v in metric_runner.RunMetricOnTraces(traces, metric).iteritems()}
-
- failures = []
- for trace in traces:
- failures.extend(results[trace].get('failures', []))
- if failures:
- print 'Running metric failed:'
- for failure in failures:
- print failure['stack']
- else:
- print json.dumps(results, indent=2, sort_keys=True, separators=(',', ': '))
-
-
-if __name__ == '__main__':
- sys.exit(Main(sys.argv))
diff --git a/chromium/third_party/catapult/tracing/bin/run_node_tests b/chromium/third_party/catapult/tracing/bin/run_node_tests
deleted file mode 100755
index d044e0f1c22..00000000000
--- a/chromium/third_party/catapult/tracing/bin/run_node_tests
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env node
-// Copyright (c) 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-'use strict';
-
-var fs = require('fs');
-var path = require('path');
-
-var catapultPath = fs.realpathSync(path.join(__dirname, '..', '..'));
-var catapultBuildPath = path.join(catapultPath, 'catapult_build');
-
-var node_bootstrap = require(path.join(catapultBuildPath, 'node_bootstrap.js'));
-
-HTMLImportsLoader.addArrayToSourcePath(
- node_bootstrap.getSourcePathsForProject('tracing'));
-
-// Go!
-var headless_test_module_filenames =
- node_bootstrap.getHeadlessTestModuleFilenamesForProject('tracing');
-
-HTMLImportsLoader.loadHTML('/tracing/base/headless_tests.html');
-tr.b.unittest.loadAndRunTests(headless_test_module_filenames); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/bin/run_py_tests b/chromium/third_party/catapult/tracing/bin/run_py_tests
deleted file mode 100755
index d5cf781888a..00000000000
--- a/chromium/third_party/catapult/tracing/bin/run_py_tests
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import platform
-import sys
-
-_CATAPULT_PATH = os.path.abspath(os.path.join(
- os.path.dirname(__file__), os.path.pardir, os.path.pardir))
-_TRACING_PATH = os.path.join(_CATAPULT_PATH, 'tracing')
-
-
-def _RunTestsOrDie(top_level_dir):
- exit_code = run_with_typ.Run(top_level_dir, path=[_TRACING_PATH])
- if exit_code:
- sys.exit(exit_code)
-
-
-def _AddToPathIfNeeded(path):
- if path not in sys.path:
- sys.path.insert(0, path)
-
-
-if __name__ == '__main__':
- _AddToPathIfNeeded(_CATAPULT_PATH)
-
- from hooks import install
- if '--no-install-hooks' in sys.argv:
- sys.argv.remove('--no-install-hooks')
- else:
- install.InstallHooks()
-
- from catapult_build import run_with_typ
- # https://github.com/catapult-project/catapult/issues/2050
- if platform.system() != 'Windows':
- _RunTestsOrDie(os.path.join(_TRACING_PATH, 'tracing'))
- _RunTestsOrDie(os.path.join(_TRACING_PATH, 'tracing_build'))
- sys.exit(0)
diff --git a/chromium/third_party/catapult/tracing/bin/run_tests b/chromium/third_party/catapult/tracing/bin/run_tests
deleted file mode 100755
index a1bbf158267..00000000000
--- a/chromium/third_party/catapult/tracing/bin/run_tests
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import sys
-
-
-_THIS_PATH = os.path.dirname(__file__)
-_TESTS = [
- {'path': os.path.join(_THIS_PATH, 'run_py_tests')},
- {'path': os.path.join(_THIS_PATH, 'run_vinn_tests'),
- 'disabled': {'win32'}},
- {'path': os.path.join(_THIS_PATH, 'run_dev_server_tests'),
- 'chrome_path_arg': True}
-]
-
-
-if __name__ == '__main__':
- catapult_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
- '..', '..'))
- sys.path.append(catapult_path)
- from catapult_build import test_runner
- sys.exit(test_runner.Main('tracing', _TESTS, sys.argv))
diff --git a/chromium/third_party/catapult/tracing/bin/run_vinn_tests b/chromium/third_party/catapult/tracing/bin/run_vinn_tests
deleted file mode 100755
index cc68ef0d267..00000000000
--- a/chromium/third_party/catapult/tracing/bin/run_vinn_tests
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import sys
-
-if __name__ == '__main__':
- tracing_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
- '..'))
- sys.path.append(tracing_path)
- from tracing_build import run_vinn_tests
- sys.exit(run_vinn_tests.Main(sys.argv))
diff --git a/chromium/third_party/catapult/tracing/bin/symbolize_trace b/chromium/third_party/catapult/tracing/bin/symbolize_trace
deleted file mode 100755
index 4aad7d94e52..00000000000
--- a/chromium/third_party/catapult/tracing/bin/symbolize_trace
+++ /dev/null
@@ -1,389 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import argparse
-import bisect
-import collections
-import gzip
-import json
-import os
-import re
-import sys
-
-_SYMBOLS_PATH = os.path.abspath(os.path.join(
- os.path.dirname(__file__),
- '..',
- 'third_party',
- 'symbols'))
-sys.path.append(_SYMBOLS_PATH)
-# pylint: disable=import-error
-import symbols.elf_symbolizer as elf_symbolizer
-
-
-# Relevant trace event phases from Chromium's
-# src/base/trace_event/common/trace_event_common.h.
-TRACE_EVENT_PHASE_METADATA = 'M'
-TRACE_EVENT_PHASE_MEMORY_DUMP = 'v'
-
-
-# Matches Android library paths, supports both K (/data/app-lib/<>/lib.so)
-# as well as L+ (/data/app/<>/lib/<>/lib.so). Library name is available
-# via 'name' group.
-ANDROID_PATH_MATCHER = re.compile(
- r'^/data/(?:app/[^/]+/lib/[^/]+/|app-lib/[^/]+/)(?P<name>.*\.so)')
-
-# Subpath of output path where unstripped libraries are stored.
-ANDROID_UNSTRIPPED_SUBPATH = 'lib.unstripped'
-
-
-class ProcessMemoryMaps(object):
- """Represents 'process_mmaps' trace file entry."""
-
- class Region(object):
- def __init__(self, start_address, size, file_path):
- self._start_address = start_address
- self._size = size
- self._file_path = file_path
-
- @property
- def start_address(self):
- return self._start_address
-
- @property
- def end_address(self):
- return self._start_address + self._size
-
- @property
- def size(self):
- return self._size
-
- @property
- def file_path(self):
- return self._file_path
-
- def __cmp__(self, other):
- if isinstance(other, type(self)):
- return long(self._start_address).__cmp__(long(other._start_address))
- elif isinstance(other, (long, int)):
- return long(self._start_address).__cmp__(long(other))
- else:
- raise Exception('Cannot compare with %s' % type(other))
-
- def __repr__(self):
- return 'Region(0x{:X} - 0x{:X}, {})'.format(
- self.start_address, self.end_address, self.file_path)
-
- def __init__(self, process_mmaps):
- """Parses 'process_mmaps' dictionary."""
-
- regions = []
- for region_value in process_mmaps['vm_regions']:
- regions.append(self.Region(
- long(region_value['sa'], 16),
- long(region_value['sz'], 16),
- region_value['mf']))
- regions.sort()
-
- # Copy regions without duplicates and check for overlaps.
- self._regions = []
- previous_region = None
- for region in regions:
- if previous_region is not None:
- if region == previous_region:
- continue
- assert region.start_address >= previous_region.end_address, \
- 'Regions {} and {} overlap.'.format(previous_region, region)
- previous_region = region
- self._regions.append(region)
-
- @property
- def regions(self):
- return self._regions
-
- def FindRegion(self, address):
- """Finds region containing |address|. Returns None if none found."""
-
- region_index = bisect.bisect_right(self._regions, address) - 1
- if region_index >= 0:
- region = self._regions[region_index]
- if address >= region.start_address and address < region.end_address:
- return region
- return None
-
-
-class StackFrames(object):
- """Represents 'stackFrames' trace file entry."""
-
- class PCFrame(object):
- def __init__(self, pc, frame):
- self._modified = False
- self._pc = pc
- self._frame = frame
-
- @property
- def modified(self):
- return self._modified
-
- @property
- def pc(self):
- return self._pc
-
- @property
- def name(self):
- return self._frame['name']
-
- @name.setter
- def name(self, value):
- self._modified = True
- self._frame['name'] = value
-
- def __init__(self, stack_frames):
- """Constructs object using 'stackFrames' dictionary."""
- self._pc_frames = []
- for frame in stack_frames.itervalues():
- pc_frame = self._ParsePCFrame(frame)
- if pc_frame:
- self._pc_frames.append(pc_frame)
-
- @property
- def pc_frames(self):
- return self._pc_frames
-
- @property
- def modified(self):
- return any(f.modified for f in self._pc_frames)
-
- _PC_TAG = 'pc:'
-
- @classmethod
- def _ParsePCFrame(self, frame):
- name = frame['name']
- if not name.startswith(self._PC_TAG):
- return None
- pc = long(name[len(self._PC_TAG):], 16)
- return self.PCFrame(pc, frame)
-
-
-class Process(object):
- """Holds various bits of information about a process in a trace file."""
-
- def __init__(self, pid):
- self.pid = pid
- self.name = None
- self.mmaps = None
- self.stack_frames = None
-
-
-def CollectProcesses(trace):
- """Parses trace dictionary and returns pid->Process map of all processes
- suitable for symbolization (which have both mmaps and stack_frames).
- """
-
- process_map = {}
-
- # Android traces produced via 'chrome://inspect/?tracing#devices' are
- # just list of events.
- events = trace if isinstance(trace, list) else trace['traceEvents']
- for event in events:
- name = event.get('name')
- if not name:
- continue
-
- pid = event['pid']
- process = process_map.get(pid)
- if process is None:
- process = Process(pid)
- process_map[pid] = process
-
- phase = event['ph']
- if phase == TRACE_EVENT_PHASE_METADATA:
- if name == 'process_name':
- process.name = event['args']['name']
- elif name == 'stackFrames':
- process.stack_frames = StackFrames(event['args']['stackFrames'])
- elif phase == TRACE_EVENT_PHASE_MEMORY_DUMP:
- process_mmaps = event['args']['dumps'].get('process_mmaps')
- if process_mmaps:
- # TODO(dskiba): this parses all process_mmaps, but retains only the
- # last one. We need to parse only once (lazy parsing?).
- process.mmaps = ProcessMemoryMaps(process_mmaps)
-
- return [p for p in process_map.itervalues() if p.mmaps and p.stack_frames]
-
-
-class SymbolizableFile(object):
- """Holds file path, addresses to symbolize and stack frames to update.
-
- This class is a link between ELFSymbolizer and a trace file: it specifies
- what to symbolize (addresses) and what to update with the symbolization
- result (frames).
- """
- def __init__(self, file_path):
- self.path = file_path
- self.frames_by_address = collections.defaultdict(list)
-
-
-def ResolveSymbolizableFiles(processes):
- """Resolves and groups PCs into list of SymbolizableFiles.
-
- As part of the grouping process, this function resolves PC from each stack
- frame to the corresponding mmap region. Stack frames that failed to resolve
- are symbolized with '<unresolved>'.
- """
- symfile_by_path = {}
- for process in processes:
- for frame in process.stack_frames.pc_frames:
- region = process.mmaps.FindRegion(frame.pc)
- if region is None:
- frame.name = '<unresolved>'
- continue
-
- symfile = symfile_by_path.get(region.file_path)
- if symfile is None:
- symfile = SymbolizableFile(region.file_path)
- symfile_by_path[symfile.path] = symfile
-
- relative_pc = frame.pc - region.start_address
- symfile.frames_by_address[relative_pc].append(frame)
- return symfile_by_path.values()
-
-
-def SymbolizeFiles(symfiles, addr2line_path):
- """Symbolizes each file in the given list of SymbolizableFiles
- and updates stack frames with symbolization results."""
- print 'Symbolizing...'
-
- def _SubPrintf(message, *args):
- print (' ' + message).format(*args)
-
- symbolized = False
- for symfile in symfiles:
- unsymbolized_name = '<{}>'.format(
- symfile.path if symfile.path else 'unnamed')
-
- problem = None
- if not os.path.isabs(symfile.path):
- problem = 'not a file'
- elif not os.path.isfile(symfile.path):
- problem = "file doesn't exist"
- if problem:
- _SubPrintf("Can't symbolize {} PCs for '{}': {}.",
- len(symfile.frames_by_address),
- symfile.path,
- problem)
- for frames in symfile.frames_by_address.itervalues():
- for frame in frames:
- frame.name = unsymbolized_name
- continue
-
- def _SymbolizerCallback(sym_info, frames):
- # Unwind inline chain to the top.
- while sym_info.inlined_by:
- sym_info = sym_info.inlined_by
-
- symbolized_name = sym_info.name if sym_info.name else unsymbolized_name
- for frame in frames:
- frame.name = symbolized_name
-
- symbolizer = elf_symbolizer.ELFSymbolizer(symfile.path,
- addr2line_path,
- _SymbolizerCallback,
- inlines=True)
-
- _SubPrintf('Symbolizing {} PCs from {}...',
- len(symfile.frames_by_address),
- symfile.path)
-
- for address, frames in symfile.frames_by_address.iteritems():
- # SymbolizeAsync() asserts that the type of address is int. We operate
- # on longs (since they are raw pointers possibly from 64-bit processes).
- # It's OK to cast here because we're passing relative PC, which should
- # always fit into int.
- symbolizer.SymbolizeAsync(int(address), frames)
-
- symbolizer.Join()
- symbolized = True
-
- return symbolized
-
-
-def FindInSystemPath(binary_name):
- paths = os.environ['PATH'].split(os.pathsep)
- for path in paths:
- binary_path = os.path.join(path, binary_name)
- if os.path.isfile(binary_path):
- return binary_path
- return None
-
-
-def HaveFilesFromAndroid(symfiles):
- return any(ANDROID_PATH_MATCHER.match(f.path) for f in symfiles)
-
-
-def RemapAndroidFiles(symfiles, output_path):
- for symfile in symfiles:
- match = ANDROID_PATH_MATCHER.match(symfile.path)
- if match:
- name = match.group('name')
- symfile.path = os.path.join(output_path, ANDROID_UNSTRIPPED_SUBPATH, name)
-
-
-# Suffix used for backup files.
-BACKUP_FILE_TAG = '.BACKUP'
-
-def main():
- parser = argparse.ArgumentParser()
- parser.add_argument('file',
- help='Trace file to symbolize (.json or .json.gz)')
- parser.add_argument('--no-backup',
- dest='backup', default='true', action='store_false',
- help="Don't create {} files".format(BACKUP_FILE_TAG))
- parser.add_argument('--output-directory',
- help='The path to the build output directory, such ' +
- 'as out/Debug. Only needed for Android.')
- options = parser.parse_args()
-
- trace_file_path = options.file
- def _OpenTraceFile(mode):
- if trace_file_path.endswith('.gz'):
- return gzip.open(trace_file_path, mode + 'b')
- else:
- return open(trace_file_path, mode + 't')
-
- addr2line_path = FindInSystemPath('addr2line')
- if addr2line_path is None:
- sys.exit("Can't symbolize - no addr2line in PATH.")
-
- print 'Reading trace file...'
- with _OpenTraceFile('r') as trace_file:
- trace = json.load(trace_file)
-
- processes = CollectProcesses(trace)
- symfiles = ResolveSymbolizableFiles(processes)
-
- # Android trace files don't have any indication they are from Android.
- # So we're checking for Android-specific paths.
- if HaveFilesFromAndroid(symfiles):
- if not options.output_directory:
- parser.error('The trace file appears to be from Android. Please '
- "specify output directory (e.g. 'out/Debug') to properly "
- 'symbolize it.')
- RemapAndroidFiles(symfiles, os.path.abspath(options.output_directory))
-
- if SymbolizeFiles(symfiles, addr2line_path):
- if options.backup:
- backup_file_path = trace_file_path + BACKUP_FILE_TAG
- print 'Backing up trace file to {}...'.format(backup_file_path)
- os.rename(trace_file_path, backup_file_path)
-
- print 'Updating trace file...'
- with _OpenTraceFile('w') as trace_file:
- json.dump(trace, trace_file)
- else:
- print 'No PCs symbolized - not updating trace file.'
-
-
-if __name__ == '__main__':
- main()
diff --git a/chromium/third_party/catapult/tracing/bin/trace2html b/chromium/third_party/catapult/tracing/bin/trace2html
deleted file mode 100755
index 2aa20273b2d..00000000000
--- a/chromium/third_party/catapult/tracing/bin/trace2html
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import sys
-import os
-
-if __name__ == '__main__':
- tracing_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
- '..'))
- sys.path.append(tracing_path)
- from tracing_build import trace2html
- sys.exit(trace2html.Main(sys.argv))
diff --git a/chromium/third_party/catapult/tracing/bin/update_gypi b/chromium/third_party/catapult/tracing/bin/update_gypi
deleted file mode 100755
index 2c66ae1a38f..00000000000
--- a/chromium/third_party/catapult/tracing/bin/update_gypi
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import sys
-
-if __name__ == '__main__':
- tracing_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
- '..'))
- sys.path.append(tracing_path)
- from tracing_build import update_gypi
- sys.exit(update_gypi.Update())
diff --git a/chromium/third_party/catapult/tracing/bin/validate_all_metrics b/chromium/third_party/catapult/tracing/bin/validate_all_metrics
deleted file mode 100755
index 4711c5590f8..00000000000
--- a/chromium/third_party/catapult/tracing/bin/validate_all_metrics
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import argparse
-import json
-import os
-import string
-import sys
-
-sys.path.insert(1, os.path.join(os.path.dirname(__file__), '..'))
-from tracing.metrics import discover
-import tracing_project
-
-
-def Main():
- all_registered_metrics = set(discover.DiscoverMetrics(
- ['/tracing/metrics/all_metrics.html']))
- all_modules = list(
- '/' + rel_path for rel_path in
- tracing_project.TracingProject().FindAllMetricsModuleRelPaths())
- all_possible_metrics = set(discover.DiscoverMetrics(all_modules))
- unregistered_metrics = all_possible_metrics - all_registered_metrics
- if unregistered_metrics:
- print ('These metrics are unregistered: %s. Please import their modules in '
- 'tracing/tracing/metrics/all_metrics.html' %
- ', '.join(unregistered_metrics))
- return 1
- uppercased_metrics = []
- for m in all_possible_metrics:
- if str.isupper(m[0]):
- uppercased_metrics.append(m)
- if uppercased_metrics:
- print ('These metrics must be renamed to start with a lower-case: %s' %
- uppercased_metrics)
- return 1
- return 0
-
-if __name__ == '__main__':
- sys.exit(Main())
diff --git a/chromium/third_party/catapult/tracing/bin/vulcanize_trace_viewer b/chromium/third_party/catapult/tracing/bin/vulcanize_trace_viewer
deleted file mode 100755
index 2ce8d81deac..00000000000
--- a/chromium/third_party/catapult/tracing/bin/vulcanize_trace_viewer
+++ /dev/null
@@ -1,14 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import sys
-
-if __name__ == '__main__':
- tracing_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
- '..'))
- sys.path.append(tracing_path)
- from tracing_build import vulcanize_trace_viewer
- sys.exit(vulcanize_trace_viewer.Main(sys.argv))
diff --git a/chromium/third_party/catapult/tracing/bin/why_imported b/chromium/third_party/catapult/tracing/bin/why_imported
deleted file mode 100755
index a8c78220749..00000000000
--- a/chromium/third_party/catapult/tracing/bin/why_imported
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Produces a dot file showing dependency relationships between modules.
-
-The dot file contains a text-based representation of a directed graph that
-explains why given module names were included in a trace_viewer config.
-
-Example usage:
-$ ./why_imported tracing.ui.analysis.analysis_view > ~/analysis_view.dot
-
-This can then be converted to a graphical representation with the dot tool:
-$ dot -Grankdir=LR -Tpng ~/analysis_view.dot -o ~/analysis_view.png
-"""
-
-import os
-import sys
-import argparse
-
-
-def Main():
- project = tracing_project.TracingProject()
-
- parser = argparse.ArgumentParser(
- usage='%(prog)s <options> moduleNames', epilog=__doc__)
- parser.add_argument('--config', choices=project.GetConfigNames())
- parser.add_argument('module_names', nargs='+')
- args = parser.parse_args()
-
- if args.config:
- names = [project.GetModuleNameForConfigName(options.config)]
- vulcanizer = project.CreateVulcanizer()
- load_sequence = vulcanizer.CalcLoadSequenceForModuleNames(names)
- else:
- parser.error('No config specified.')
- print vulcanizer.GetDominatorGraphForModulesNamed(
- args.module_names, load_sequence)
-
-
-if __name__ == '__main__':
- tracing_path = os.path.abspath(os.path.join(os.path.dirname(__file__),
- os.path.pardir))
- sys.path.append(tracing_path)
- import tracing_project
- tracing_project.UpdateSysPathIfNeeded()
- sys.exit(Main())
diff --git a/chromium/third_party/catapult/tracing/third_party/chai/LICENSE b/chromium/third_party/catapult/tracing/third_party/chai/LICENSE
deleted file mode 100644
index 227b598fc61..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/chai/LICENSE
+++ /dev/null
@@ -1,7 +0,0 @@
-Copyright (c) 2011-2015 Jake Luer jake@alogicalparadox.com
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/chromium/third_party/catapult/tracing/third_party/chai/README.chromium b/chromium/third_party/catapult/tracing/third_party/chai/README.chromium
deleted file mode 100644
index 4a1fb8e791a..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/chai/README.chromium
+++ /dev/null
@@ -1,15 +0,0 @@
-Name: chai
-Short Name: chai
-URL: https://github.com/chaijs/chai
-Version: 2.1.2
-Revision: 1abc3845e3ef96afa003d62478692a1cb9a435b0
-Date: Fri Mar 20 09:46:02 2015 +0000
-License: MIT
-License File: NOT_SHIPPED
-Security Critical: no
-
-Description:
-BDD / TDD assertion framework for node.js and the browser that can be paired with any testing framework.
-
-Local Modifications:
-Copied license text out of README.md. Unminified chai.js and ripped out parts pertaining to Buffer because we're not using node and don't want could-not-require exceptions to be thrown. Reminified to prevent jslint from complaining.
diff --git a/chromium/third_party/catapult/tracing/third_party/chai/chai.js b/chromium/third_party/catapult/tracing/third_party/chai/chai.js
deleted file mode 100644
index 5956853750b..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/chai/chai.js
+++ /dev/null
@@ -1,2 +0,0 @@
-!function(){function require(e){var t=require.modules[e];if(t)return"exports"in t||"function"!=typeof t.definition||(t.client=t.component=!0,t.definition.call(this,t.exports={},t),delete t.definition),t.exports}require.loader="component",require.helper={},require.helper.semVerSort=function(e,t){for(var r=e.version.split("."),i=t.version.split("."),n=0;n<r.length;++n){var o=parseInt(r[n],10),s=parseInt(i[n],10);if(o!==s)return o>s?1:-1;var a=r[n].substr((""+o).length),c=i[n].substr((""+s).length);if(""===a&&""!==c)return 1;if(""!==a&&""===c)return-1;if(""!==a&&""!==c)return a>c?1:-1}return 0},require.latest=function(e,t){function r(e){throw new Error('failed to find latest module of "'+e+'"')}var i=/(.*)~(.*)@v?(\d+\.\d+\.\d+[^\/]*)$/,n=/(.*)~(.*)/;n.test(e)||r(e);for(var o=Object.keys(require.modules),s=[],a=[],c=0;c<o.length;c++){var u=o[c];if(new RegExp(e+"@").test(u)){var h=u.substr(e.length+1),l=i.exec(u);null!=l?s.push({version:h,name:u}):a.push({version:h,name:u})}}if(0===s.concat(a).length&&r(e),s.length>0){var f=s.sort(require.helper.semVerSort).pop().name;return t===!0?f:require(f)}var f=a.sort(function(e,t){return e.name>t.name})[0].name;return t===!0?f:require(f)},require.modules={},require.register=function(e,t){require.modules[e]={definition:t}},require.define=function(e,t){require.modules[e]={exports:t}},require.register("chaijs~assertion-error@1.0.0",function(e,t){function r(){function e(e,r){Object.keys(r).forEach(function(i){~t.indexOf(i)||(e[i]=r[i])})}var t=[].slice.call(arguments);return function(){for(var t=[].slice.call(arguments),r=0,i={};r<t.length;r++)e(i,t[r]);return i}}function i(e,t,i){var n=r("name","message","stack","constructor","toJSON"),o=n(t||{});this.message=e||"Unspecified AssertionError",this.showDiff=!1;for(var s in o)this[s]=o[s];i=i||arguments.callee,i&&Error.captureStackTrace&&Error.captureStackTrace(this,i)}t.exports=i,i.prototype=Object.create(Error.prototype),i.prototype.name="AssertionError",i.prototype.constructor=i,i.prototype.toJSON=function(e){var t=r("constructor","toJSON","stack"),i=t({name:this.name},this);return!1!==e&&this.stack&&(i.stack=this.stack),i}}),require.register("chaijs~type-detect@0.1.1",function(e,t){function r(e){var t=Object.prototype.toString.call(e);return n[t]?n[t]:null===e?"null":void 0===e?"undefined":e===Object(e)?"object":typeof e}function i(){this.tests={}}var e=t.exports=r,n={"[object Array]":"array","[object RegExp]":"regexp","[object Function]":"function","[object Arguments]":"arguments","[object Date]":"date"};e.Library=i,i.prototype.of=r,i.prototype.define=function(e,t){return 1===arguments.length?this.tests[e]:(this.tests[e]=t,this)},i.prototype.test=function(e,t){if(t===r(e))return!0;var i=this.tests[t];if(i&&"regexp"===r(i))return i.test(e);if(i&&"function"===r(i))return i(e);throw new ReferenceError('Type test "'+t+'" not defined or invalid.')}}),require.register("chaijs~deep-eql@0.1.3",function(e,t){function r(e,t,r){return i(e,t)?!0:"date"===f(e)?o(e,t):"regexp"===f(e)?s(e,t):"arguments"===f(e)?a(e,t,r):n(e,t)?"object"!==f(e)&&"object"!==f(t)&&"array"!==f(e)&&"array"!==f(t)?i(e,t):l(e,t,r):!1}function i(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function n(e,t){return f(e)===f(t)}function o(e,t){return"date"!==f(t)?!1:i(e.getTime(),t.getTime())}function s(e,t){return"regexp"!==f(t)?!1:i(e.toString(),t.toString())}function a(e,t,i){return"arguments"!==f(t)?!1:(e=[].slice.call(e),t=[].slice.call(t),r(e,t,i))}function c(e){var t=[];for(var r in e)t.push(r);return t}function u(e,t){if(e.length!==t.length)return!1;for(var r=0,i=!0;r<e.length;r++)if(e[r]!==t[r]){i=!1;break}return i}function h(e){return null!==e&&void 0!==e}function l(e,t,i){if(!h(e)||!h(t))return!1;if(e.prototype!==t.prototype)return!1;var n;if(i){for(n=0;n<i.length;n++)if(i[n][0]===e&&i[n][1]===t||i[n][0]===t&&i[n][1]===e)return!0}else i=[];try{var o=c(e),s=c(t)}catch(a){return!1}if(o.sort(),s.sort(),!u(o,s))return!1;i.push([e,t]);var l;for(n=o.length-1;n>=0;n--)if(l=o[n],!r(e[l],t[l],i))return!1;return!0}var f=require("chaijs~type-detect@0.1.1");t.exports=r}),require.register("chai",function(e,t){t.exports=require("chai/lib/chai.js")}),require.register("chai/lib/chai.js",function(e,t){var r=[],e=t.exports={};e.version="2.1.0",e.AssertionError=require("chaijs~assertion-error@1.0.0");var i=require("chai/lib/chai/utils/index.js");e.use=function(e){return~r.indexOf(e)||(e(this,i),r.push(e)),this},e.util=i;var n=require("chai/lib/chai/config.js");e.config=n;var o=require("chai/lib/chai/assertion.js");e.use(o);var s=require("chai/lib/chai/core/assertions.js");e.use(s);var a=require("chai/lib/chai/interface/expect.js");e.use(a);var c=require("chai/lib/chai/interface/should.js");e.use(c);var u=require("chai/lib/chai/interface/assert.js");e.use(u)}),require.register("chai/lib/chai/assertion.js",function(e,t){var r=require("chai/lib/chai/config.js");t.exports=function(e,t){function i(e,t,r){o(this,"ssfi",r||arguments.callee),o(this,"object",e),o(this,"message",t)}var n=e.AssertionError,o=t.flag;e.Assertion=i,Object.defineProperty(i,"includeStack",{get:function(){return console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),r.includeStack},set:function(e){console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead."),r.includeStack=e}}),Object.defineProperty(i,"showDiff",{get:function(){return console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),r.showDiff},set:function(e){console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead."),r.showDiff=e}}),i.addProperty=function(e,r){t.addProperty(this.prototype,e,r)},i.addMethod=function(e,r){t.addMethod(this.prototype,e,r)},i.addChainableMethod=function(e,r,i){t.addChainableMethod(this.prototype,e,r,i)},i.overwriteProperty=function(e,r){t.overwriteProperty(this.prototype,e,r)},i.overwriteMethod=function(e,r){t.overwriteMethod(this.prototype,e,r)},i.overwriteChainableMethod=function(e,r,i){t.overwriteChainableMethod(this.prototype,e,r,i)},i.prototype.assert=function(e,i,s,a,c,u){var h=t.test(this,arguments);if(!0!==u&&(u=!1),!0!==r.showDiff&&(u=!1),!h){var i=t.getMessage(this,arguments),l=t.getActual(this,arguments);throw new n(i,{actual:l,expected:a,showDiff:u},r.includeStack?this.assert:o(this,"ssfi"))}},Object.defineProperty(i.prototype,"_obj",{get:function(){return o(this,"object")},set:function(e){o(this,"object",e)}})}}),require.register("chai/lib/chai/config.js",function(e,t){t.exports={includeStack:!1,showDiff:!0,truncateThreshold:40}}),require.register("chai/lib/chai/core/assertions.js",function(e,t){t.exports=function(e,t){function r(e,r){r&&q(this,"message",r),e=e.toLowerCase();var i=q(this,"object"),n=~["a","e","i","o","u"].indexOf(e.charAt(0))?"an ":"a ";this.assert(e===t.type(i),"expected #{this} to be "+n+e,"expected #{this} not to be "+n+e)}function i(){q(this,"contains",!0)}function n(e,r){r&&q(this,"message",r);var i=q(this,"object"),n=!1;if("array"===t.type(i)&&"object"===t.type(e)){for(var o in i)if(t.eql(i[o],e)){n=!0;break}}else if("object"===t.type(e)){if(!q(this,"negate")){for(var s in e)new m(i).property(s,e[s]);return}var a={};for(var s in e)a[s]=i[s];n=t.eql(a,e)}else n=i&&~i.indexOf(e);this.assert(n,"expected #{this} to include "+t.inspect(e),"expected #{this} to not include "+t.inspect(e))}function o(){var e=q(this,"object"),t=Object.prototype.toString.call(e);this.assert("[object Arguments]"===t,"expected #{this} to be arguments but got "+t,"expected #{this} to not be arguments")}function s(e,t){t&&q(this,"message",t);var r=q(this,"object");return q(this,"deep")?this.eql(e):void this.assert(e===r,"expected #{this} to equal #{exp}","expected #{this} to not equal #{exp}",e,this._obj,!0)}function a(e,r){r&&q(this,"message",r),this.assert(t.eql(e,q(this,"object")),"expected #{this} to deeply equal #{exp}","expected #{this} to not deeply equal #{exp}",e,this._obj,!0)}function c(e,t){t&&q(this,"message",t);var r=q(this,"object");if(q(this,"doLength")){new m(r,t).to.have.property("length");var i=r.length;this.assert(i>e,"expected #{this} to have a length above #{exp} but got #{act}","expected #{this} to not have a length above #{exp}",e,i)}else this.assert(r>e,"expected #{this} to be above "+e,"expected #{this} to be at most "+e)}function u(e,t){t&&q(this,"message",t);var r=q(this,"object");if(q(this,"doLength")){new m(r,t).to.have.property("length");var i=r.length;this.assert(i>=e,"expected #{this} to have a length at least #{exp} but got #{act}","expected #{this} to have a length below #{exp}",e,i)}else this.assert(r>=e,"expected #{this} to be at least "+e,"expected #{this} to be below "+e)}function h(e,t){t&&q(this,"message",t);var r=q(this,"object");if(q(this,"doLength")){new m(r,t).to.have.property("length");var i=r.length;this.assert(e>i,"expected #{this} to have a length below #{exp} but got #{act}","expected #{this} to not have a length below #{exp}",e,i)}else this.assert(e>r,"expected #{this} to be below "+e,"expected #{this} to be at least "+e)}function l(e,t){t&&q(this,"message",t);var r=q(this,"object");if(q(this,"doLength")){new m(r,t).to.have.property("length");var i=r.length;this.assert(e>=i,"expected #{this} to have a length at most #{exp} but got #{act}","expected #{this} to have a length above #{exp}",e,i)}else this.assert(e>=r,"expected #{this} to be at most "+e,"expected #{this} to be above "+e)}function f(e,r){r&&q(this,"message",r);var i=t.getName(e);this.assert(q(this,"object")instanceof e,"expected #{this} to be an instance of "+i,"expected #{this} to not be an instance of "+i)}function p(e,r){r&&q(this,"message",r);var i=q(this,"object");this.assert(i.hasOwnProperty(e),"expected #{this} to have own property "+t.inspect(e),"expected #{this} to not have own property "+t.inspect(e))}function d(){q(this,"doLength",!0)}function g(e,t){t&&q(this,"message",t);var r=q(this,"object");new m(r,t).to.have.property("length");var i=r.length;this.assert(i==e,"expected #{this} to have a length of #{exp} but got #{act}","expected #{this} to not have a length of #{act}",e,i)}function b(e){var r,i=q(this,"object"),n=!0,o="keys must be given single argument of Array|Object|String, or multiple String arguments";switch(t.type(e)){case"array":if(arguments.length>1)throw new Error(o);break;case"object":if(arguments.length>1)throw new Error(o);e=Object.keys(e);break;default:e=Array.prototype.slice.call(arguments)}if(!e.length)throw new Error("keys required");var s=Object.keys(i),a=e,c=e.length,u=q(this,"any"),h=q(this,"all");if(u||h||(h=!0),u){var l=a.filter(function(e){return~s.indexOf(e)});n=l.length>0}if(h&&(n=e.every(function(e){return~s.indexOf(e)}),q(this,"negate")||q(this,"contains")||(n=n&&e.length==s.length)),c>1){e=e.map(function(e){return t.inspect(e)});var f=e.pop();h&&(r=e.join(", ")+", and "+f),u&&(r=e.join(", ")+", or "+f)}else r=t.inspect(e[0]);r=(c>1?"keys ":"key ")+r,r=(q(this,"contains")?"contain ":"have ")+r,this.assert(n,"expected #{this} to "+r,"expected #{this} to not "+r,a.slice(0).sort(),s.sort(),!0)}function v(e,r,i){i&&q(this,"message",i);var n=q(this,"object");new m(n,i).is.a("function");var o=!1,s=null,a=null,c=null;0===arguments.length?(r=null,e=null):e&&(e instanceof RegExp||"string"==typeof e)?(r=e,e=null):e&&e instanceof Error?(s=e,e=null,r=null):"function"==typeof e?(a=e.prototype.name||e.name,"Error"===a&&e!==Error&&(a=(new e).name)):e=null;try{n()}catch(u){if(s)return this.assert(u===s,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp}",s instanceof Error?s.toString():s,u instanceof Error?u.toString():u),q(this,"object",u),this;if(e&&(this.assert(u instanceof e,"expected #{this} to throw #{exp} but #{act} was thrown","expected #{this} to not throw #{exp} but #{act} was thrown",a,u instanceof Error?u.toString():u),!r))return q(this,"object",u),this;var h="object"===t.type(u)&&"message"in u?u.message:""+u;if(null!=h&&r&&r instanceof RegExp)return this.assert(r.exec(h),"expected #{this} to throw error matching #{exp} but got #{act}","expected #{this} to throw error not matching #{exp}",r,h),q(this,"object",u),this;if(null!=h&&r&&"string"==typeof r)return this.assert(~h.indexOf(r),"expected #{this} to throw error including #{exp} but got #{act}","expected #{this} to throw error not including #{act}",r,h),q(this,"object",u),this;o=!0,c=u}var l="",f=null!==a?a:s?"#{exp}":"an error";o&&(l=" but #{act} was thrown"),this.assert(o===!0,"expected #{this} to throw "+f+l,"expected #{this} to not throw "+f+l,s instanceof Error?s.toString():s,c instanceof Error?c.toString():c),q(this,"object",c)}function y(e,t,r){return e.every(function(e){return r?t.some(function(t){return r(e,t)}):-1!==t.indexOf(e)})}function j(e,t,r){r&&q(this,"message",r);var i=q(this,"object");new m(e,r).to.have.property(t),new m(i).is.a("function");var n=e[t];i(),this.assert(n!==e[t],"expected ."+t+" to change","expected ."+t+" to not change")}function w(e,t,r){r&&q(this,"message",r);var i=q(this,"object");new m(e,r).to.have.property(t),new m(i).is.a("function");var n=e[t];i(),this.assert(e[t]-n>0,"expected ."+t+" to increase","expected ."+t+" to not increase")}function x(e,t,r){r&&q(this,"message",r);var i=q(this,"object");new m(e,r).to.have.property(t),new m(i).is.a("function");var n=e[t];i(),this.assert(e[t]-n<0,"expected ."+t+" to decrease","expected ."+t+" to not decrease")}var m=e.Assertion,q=(Object.prototype.toString,t.flag);["to","be","been","is","and","has","have","with","that","which","at","of","same"].forEach(function(e){m.addProperty(e,function(){return this})}),m.addProperty("not",function(){q(this,"negate",!0)}),m.addProperty("deep",function(){q(this,"deep",!0)}),m.addProperty("any",function(){q(this,"any",!0),q(this,"all",!1)}),m.addProperty("all",function(){q(this,"all",!0),q(this,"any",!1)}),m.addChainableMethod("an",r),m.addChainableMethod("a",r),m.addChainableMethod("include",n,i),m.addChainableMethod("contain",n,i),m.addChainableMethod("contains",n,i),m.addChainableMethod("includes",n,i),m.addProperty("ok",function(){this.assert(q(this,"object"),"expected #{this} to be truthy","expected #{this} to be falsy")}),m.addProperty("true",function(){this.assert(!0===q(this,"object"),"expected #{this} to be true","expected #{this} to be false",this.negate?!1:!0)}),m.addProperty("false",function(){this.assert(!1===q(this,"object"),"expected #{this} to be false","expected #{this} to be true",this.negate?!0:!1)}),m.addProperty("null",function(){this.assert(null===q(this,"object"),"expected #{this} to be null","expected #{this} not to be null")}),m.addProperty("undefined",function(){this.assert(void 0===q(this,"object"),"expected #{this} to be undefined","expected #{this} not to be undefined")}),m.addProperty("exist",function(){this.assert(null!=q(this,"object"),"expected #{this} to exist","expected #{this} to not exist")}),m.addProperty("empty",function(){var e=q(this,"object"),t=e;Array.isArray(e)||"string"==typeof object?t=e.length:"object"==typeof e&&(t=Object.keys(e).length),this.assert(!t,"expected #{this} to be empty","expected #{this} not to be empty")}),m.addProperty("arguments",o),m.addProperty("Arguments",o),m.addMethod("equal",s),m.addMethod("equals",s),m.addMethod("eq",s),m.addMethod("eql",a),m.addMethod("eqls",a),m.addMethod("above",c),m.addMethod("gt",c),m.addMethod("greaterThan",c),m.addMethod("least",u),m.addMethod("gte",u),m.addMethod("below",h),m.addMethod("lt",h),m.addMethod("lessThan",h),m.addMethod("most",l),m.addMethod("lte",l),m.addMethod("within",function(e,t,r){r&&q(this,"message",r);var i=q(this,"object"),n=e+".."+t;if(q(this,"doLength")){new m(i,r).to.have.property("length");var o=i.length;this.assert(o>=e&&t>=o,"expected #{this} to have a length within "+n,"expected #{this} to not have a length within "+n)}else this.assert(i>=e&&t>=i,"expected #{this} to be within "+n,"expected #{this} to not be within "+n)}),m.addMethod("instanceof",f),m.addMethod("instanceOf",f),m.addMethod("property",function(e,r,i){i&&q(this,"message",i);var n=!!q(this,"deep"),o=n?"deep property ":"property ",s=q(this,"negate"),a=q(this,"object"),c=n?t.getPathInfo(e,a):null,u=n?c.exists:t.hasProperty(e,a),h=n?c.value:a[e];if(s&&void 0!==r){if(void 0===h)throw i=null!=i?i+": ":"",new Error(i+t.inspect(a)+" has no "+o+t.inspect(e))}else this.assert(u,"expected #{this} to have a "+o+t.inspect(e),"expected #{this} to not have "+o+t.inspect(e));void 0!==r&&this.assert(r===h,"expected #{this} to have a "+o+t.inspect(e)+" of #{exp}, but got #{act}","expected #{this} to not have a "+o+t.inspect(e)+" of #{act}",r,h),q(this,"object",h)}),m.addMethod("ownProperty",p),m.addMethod("haveOwnProperty",p),m.addChainableMethod("length",g,d),m.addMethod("lengthOf",g),m.addMethod("match",function(e,t){t&&q(this,"message",t);var r=q(this,"object");this.assert(e.exec(r),"expected #{this} to match "+e,"expected #{this} not to match "+e)}),m.addMethod("string",function(e,r){r&&q(this,"message",r);var i=q(this,"object");new m(i,r).is.a("string"),this.assert(~i.indexOf(e),"expected #{this} to contain "+t.inspect(e),"expected #{this} to not contain "+t.inspect(e))}),m.addMethod("keys",b),m.addMethod("key",b),m.addMethod("throw",v),m.addMethod("throws",v),m.addMethod("Throw",v),m.addMethod("respondTo",function(e,r){r&&q(this,"message",r);var i=q(this,"object"),n=q(this,"itself"),o="function"!==t.type(i)||n?i[e]:i.prototype[e];this.assert("function"==typeof o,"expected #{this} to respond to "+t.inspect(e),"expected #{this} to not respond to "+t.inspect(e))}),m.addProperty("itself",function(){q(this,"itself",!0)}),m.addMethod("satisfy",function(e,r){r&&q(this,"message",r);var i=q(this,"object"),n=e(i);this.assert(n,"expected #{this} to satisfy "+t.objDisplay(e),"expected #{this} to not satisfy"+t.objDisplay(e),this.negate?!1:!0,n)}),m.addMethod("closeTo",function(e,r,i){i&&q(this,"message",i);var n=q(this,"object");if(new m(n,i).is.a("number"),"number"!==t.type(e)||"number"!==t.type(r))throw new Error("the arguments to closeTo must be numbers");this.assert(Math.abs(n-e)<=r,"expected #{this} to be close to "+e+" +/- "+r,"expected #{this} not to be close to "+e+" +/- "+r)}),m.addMethod("members",function(e,r){r&&q(this,"message",r);var i=q(this,"object");new m(i).to.be.an("array"),new m(e).to.be.an("array");var n=q(this,"deep")?t.eql:void 0;return q(this,"contains")?this.assert(y(e,i,n),"expected #{this} to be a superset of #{act}","expected #{this} to not be a superset of #{act}",i,e):void this.assert(y(i,e,n)&&y(e,i,n),"expected #{this} to have the same members as #{act}","expected #{this} to not have the same members as #{act}",i,e)}),m.addChainableMethod("change",j),m.addChainableMethod("changes",j),m.addChainableMethod("increase",w),m.addChainableMethod("increases",w),m.addChainableMethod("decrease",x),m.addChainableMethod("decreases",x)}}),require.register("chai/lib/chai/interface/assert.js",function(exports,module){module.exports=function(chai,util){var Assertion=chai.Assertion,flag=util.flag,assert=chai.assert=function(e,t){var r=new Assertion(null,null,chai.assert);r.assert(e,t,"[ negation message unavailable ]")};assert.fail=function(e,t,r,i){throw r=r||"assert.fail()",new chai.AssertionError(r,{actual:e,expected:t,operator:i},assert.fail)},assert.ok=function(e,t){new Assertion(e,t).is.ok},assert.notOk=function(e,t){new Assertion(e,t).is.not.ok},assert.equal=function(e,t,r){var i=new Assertion(e,r,assert.equal);i.assert(t==flag(i,"object"),"expected #{this} to equal #{exp}","expected #{this} to not equal #{act}",t,e)},assert.notEqual=function(e,t,r){var i=new Assertion(e,r,assert.notEqual);i.assert(t!=flag(i,"object"),"expected #{this} to not equal #{exp}","expected #{this} to equal #{act}",t,e)},assert.strictEqual=function(e,t,r){new Assertion(e,r).to.equal(t)},assert.notStrictEqual=function(e,t,r){new Assertion(e,r).to.not.equal(t)},assert.deepEqual=function(e,t,r){new Assertion(e,r).to.eql(t)},assert.notDeepEqual=function(e,t,r){new Assertion(e,r).to.not.eql(t)},assert.isAbove=function(e,t,r){new Assertion(e,r).to.be.above(t)},assert.isBelow=function(e,t,r){new Assertion(e,r).to.be.below(t)},assert.isTrue=function(e,t){new Assertion(e,t).is["true"]},assert.isFalse=function(e,t){new Assertion(e,t).is["false"]},assert.isNull=function(e,t){new Assertion(e,t).to.equal(null)},assert.isNotNull=function(e,t){new Assertion(e,t).to.not.equal(null)},assert.isUndefined=function(e,t){new Assertion(e,t).to.equal(void 0)},assert.isDefined=function(e,t){new Assertion(e,t).to.not.equal(void 0)},assert.isFunction=function(e,t){new Assertion(e,t).to.be.a("function")},assert.isNotFunction=function(e,t){new Assertion(e,t).to.not.be.a("function")},assert.isObject=function(e,t){new Assertion(e,t).to.be.a("object")},assert.isNotObject=function(e,t){new Assertion(e,t).to.not.be.a("object")},assert.isArray=function(e,t){new Assertion(e,t).to.be.an("array")},assert.isNotArray=function(e,t){new Assertion(e,t).to.not.be.an("array")},assert.isString=function(e,t){new Assertion(e,t).to.be.a("string")},assert.isNotString=function(e,t){new Assertion(e,t).to.not.be.a("string")},assert.isNumber=function(e,t){new Assertion(e,t).to.be.a("number")},assert.isNotNumber=function(e,t){new Assertion(e,t).to.not.be.a("number")},assert.isBoolean=function(e,t){new Assertion(e,t).to.be.a("boolean")},assert.isNotBoolean=function(e,t){new Assertion(e,t).to.not.be.a("boolean")},assert.typeOf=function(e,t,r){new Assertion(e,r).to.be.a(t)},assert.notTypeOf=function(e,t,r){new Assertion(e,r).to.not.be.a(t)},assert.instanceOf=function(e,t,r){new Assertion(e,r).to.be.instanceOf(t)},assert.notInstanceOf=function(e,t,r){new Assertion(e,r).to.not.be.instanceOf(t)},assert.include=function(e,t,r){new Assertion(e,r,assert.include).include(t)},assert.notInclude=function(e,t,r){new Assertion(e,r,assert.notInclude).not.include(t)},assert.match=function(e,t,r){new Assertion(e,r).to.match(t)},assert.notMatch=function(e,t,r){new Assertion(e,r).to.not.match(t)},assert.property=function(e,t,r){new Assertion(e,r).to.have.property(t)},assert.notProperty=function(e,t,r){new Assertion(e,r).to.not.have.property(t)},assert.deepProperty=function(e,t,r){new Assertion(e,r).to.have.deep.property(t)},assert.notDeepProperty=function(e,t,r){new Assertion(e,r).to.not.have.deep.property(t)},assert.propertyVal=function(e,t,r,i){new Assertion(e,i).to.have.property(t,r)},assert.propertyNotVal=function(e,t,r,i){new Assertion(e,i).to.not.have.property(t,r)},assert.deepPropertyVal=function(e,t,r,i){new Assertion(e,i).to.have.deep.property(t,r)},assert.deepPropertyNotVal=function(e,t,r,i){new Assertion(e,i).to.not.have.deep.property(t,r)},assert.lengthOf=function(e,t,r){new Assertion(e,r).to.have.length(t)},assert.Throw=function(e,t,r,i){("string"==typeof t||t instanceof RegExp)&&(r=t,t=null);var n=new Assertion(e,i).to.Throw(t,r);return flag(n,"object")},assert.doesNotThrow=function(e,t,r){"string"==typeof t&&(r=t,t=null),new Assertion(e,r).to.not.Throw(t)},assert.operator=function(val,operator,val2,msg){if(!~["==","===",">",">=","<","<=","!=","!=="].indexOf(operator))throw new Error('Invalid operator "'+operator+'"');var test=new Assertion(eval(val+operator+val2),msg);test.assert(!0===flag(test,"object"),"expected "+util.inspect(val)+" to be "+operator+" "+util.inspect(val2),"expected "+util.inspect(val)+" to not be "+operator+" "+util.inspect(val2))},assert.closeTo=function(e,t,r,i){new Assertion(e,i).to.be.closeTo(t,r)},assert.sameMembers=function(e,t,r){new Assertion(e,r).to.have.same.members(t)},assert.sameDeepMembers=function(e,t,r){new Assertion(e,r).to.have.same.deep.members(t)},assert.includeMembers=function(e,t,r){new Assertion(e,r).to.include.members(t)},assert.changes=function(e,t,r){new Assertion(e).to.change(t,r)},assert.doesNotChange=function(e,t,r){new Assertion(e).to.not.change(t,r)},assert.increases=function(e,t,r){new Assertion(e).to.increase(t,r)},assert.doesNotIncrease=function(e,t,r){new Assertion(e).to.not.increase(t,r)},assert.decreases=function(e,t,r){new Assertion(e).to.decrease(t,r)},assert.doesNotDecrease=function(e,t,r){new Assertion(e).to.not.decrease(t,r)},assert.ifError=function(e,t){new Assertion(e,t).to.not.be.ok},function e(t,r){return assert[r]=assert[t],e}("Throw","throw")("Throw","throws")}}),require.register("chai/lib/chai/interface/expect.js",function(e,t){t.exports=function(e){e.expect=function(t,r){return new e.Assertion(t,r)},e.expect.fail=function(t,r,i,n){throw i=i||"expect.fail()",new e.AssertionError(i,{actual:t,expected:r,operator:n},e.expect.fail)}}}),require.register("chai/lib/chai/interface/should.js",function(e,t){t.exports=function(e){function t(){function t(){return this instanceof String||this instanceof Number?new r(this.constructor(this),null,t):this instanceof Boolean?new r(1==this,null,t):new r(this,null,t)}function i(e){Object.defineProperty(this,"should",{value:e,enumerable:!0,configurable:!0,writable:!0})}Object.defineProperty(Object.prototype,"should",{set:i,get:t,configurable:!0});var n={};return n.fail=function(t,r,i,o){throw i=i||"should.fail()",new e.AssertionError(i,{actual:t,expected:r,operator:o},n.fail)},n.equal=function(e,t,i){new r(e,i).to.equal(t)},n.Throw=function(e,t,i,n){new r(e,n).to.Throw(t,i)},n.exist=function(e,t){new r(e,t).to.exist},n.not={},n.not.equal=function(e,t,i){new r(e,i).to.not.equal(t)},n.not.Throw=function(e,t,i,n){new r(e,n).to.not.Throw(t,i)},n.not.exist=function(e,t){new r(e,t).to.not.exist},n["throw"]=n.Throw,n.not["throw"]=n.not.Throw,n}var r=e.Assertion;e.should=t,e.Should=t}}),require.register("chai/lib/chai/utils/addChainableMethod.js",function(e,t){var r=require("chai/lib/chai/utils/transferFlags.js"),i=require("chai/lib/chai/utils/flag.js"),n=require("chai/lib/chai/config.js"),o="__proto__"in Object,s=/^(?:length|name|arguments|caller)$/,a=Function.prototype.call,c=Function.prototype.apply;t.exports=function(e,t,u,h){"function"!=typeof h&&(h=function(){});var l={method:u,chainingBehavior:h};e.__methods||(e.__methods={}),e.__methods[t]=l,Object.defineProperty(e,t,{get:function(){l.chainingBehavior.call(this);var t=function f(){var e=i(this,"ssfi");e&&n.includeStack===!1&&i(this,"ssfi",f);var t=l.method.apply(this,arguments);return void 0===t?this:t};if(o){var u=t.__proto__=Object.create(this);u.call=a,u.apply=c}else{var h=Object.getOwnPropertyNames(e);h.forEach(function(r){if(!s.test(r)){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i)}})}return r(this,t),t},configurable:!0})}}),require.register("chai/lib/chai/utils/addMethod.js",function(e,t){var r=require("chai/lib/chai/config.js"),i=require("chai/lib/chai/utils/flag.js");t.exports=function(e,t,n){e[t]=function(){var o=i(this,"ssfi");o&&r.includeStack===!1&&i(this,"ssfi",e[t]);var s=n.apply(this,arguments);return void 0===s?this:s}}}),require.register("chai/lib/chai/utils/addProperty.js",function(e,t){t.exports=function(e,t,r){Object.defineProperty(e,t,{get:function(){var e=r.call(this);return void 0===e?this:e},configurable:!0})}}),require.register("chai/lib/chai/utils/flag.js",function(e,t){t.exports=function(e,t,r){var i=e.__flags||(e.__flags=Object.create(null));return 3!==arguments.length?i[t]:void(i[t]=r)}}),require.register("chai/lib/chai/utils/getActual.js",function(e,t){t.exports=function(e,t){return t.length>4?t[4]:e._obj}}),require.register("chai/lib/chai/utils/getEnumerableProperties.js",function(e,t){t.exports=function(e){var t=[];for(var r in e)t.push(r);return t}}),require.register("chai/lib/chai/utils/getMessage.js",function(e,t){var r=require("chai/lib/chai/utils/flag.js"),i=require("chai/lib/chai/utils/getActual.js"),n=(require("chai/lib/chai/utils/inspect.js"),require("chai/lib/chai/utils/objDisplay.js"));t.exports=function(e,t){var o=r(e,"negate"),s=r(e,"object"),a=t[3],c=i(e,t),u=o?t[2]:t[1],h=r(e,"message");return"function"==typeof u&&(u=u()),u=u||"",u=u.replace(/#{this}/g,n(s)).replace(/#{act}/g,n(c)).replace(/#{exp}/g,n(a)),h?h+": "+u:u}}),require.register("chai/lib/chai/utils/getName.js",function(e,t){t.exports=function(e){if(e.name)return e.name;var t=/^\s?function ([^(]*)\(/.exec(e);return t&&t[1]?t[1]:""}}),require.register("chai/lib/chai/utils/getPathValue.js",function(e,t){var r=require("chai/lib/chai/utils/getPathInfo.js");t.exports=function(e,t){var i=r(e,t);return i.value}}),require.register("chai/lib/chai/utils/getPathInfo.js",function(e,t){function r(e){var t=e.replace(/\[/g,".["),r=t.match(/(\\\.|[^.]+?)+/g);return r.map(function(e){var t=/\[(\d+)\]$/,r=t.exec(e);return r?{i:parseFloat(r[1])}:{p:e}})}function i(e,t,r){var i,n=t;r=void 0===r?e.length:r;for(var o=0,s=r;s>o;o++){var a=e[o];n?("undefined"!=typeof a.p?n=n[a.p]:"undefined"!=typeof a.i&&(n=n[a.i]),o==s-1&&(i=n)):i=void 0}return i}var n=require("chai/lib/chai/utils/hasProperty.js");t.exports=function(e,t){var o=r(e),s=o[o.length-1],a={parent:i(o,t,o.length-1),name:s.p||s.i,value:i(o,t)};return a.exists=n(a.name,a.parent),a}}),require.register("chai/lib/chai/utils/hasProperty.js",function(e,t){var r=require("chai/lib/chai/utils/type.js"),i={number:Number,string:String};t.exports=function(e,t){var n=r(t);return"null"===n||"undefined"===n?!1:(i[n]&&"object"!=typeof t&&(t=new i[n](t)),e in t)}}),require.register("chai/lib/chai/utils/getProperties.js",function(e,t){t.exports=function(){function e(e){-1===t.indexOf(e)&&t.push(e)}for(var t=Object.getOwnPropertyNames(subject),r=Object.getPrototypeOf(subject);null!==r;)Object.getOwnPropertyNames(r).forEach(e),r=Object.getPrototypeOf(r);return t}}),require.register("chai/lib/chai/utils/index.js",function(e,t){var e=t.exports={};e.test=require("chai/lib/chai/utils/test.js"),e.type=require("chai/lib/chai/utils/type.js"),e.getMessage=require("chai/lib/chai/utils/getMessage.js"),e.getActual=require("chai/lib/chai/utils/getActual.js"),e.inspect=require("chai/lib/chai/utils/inspect.js"),e.objDisplay=require("chai/lib/chai/utils/objDisplay.js"),e.flag=require("chai/lib/chai/utils/flag.js"),e.transferFlags=require("chai/lib/chai/utils/transferFlags.js"),e.eql=require("chaijs~deep-eql@0.1.3"),e.getPathValue=require("chai/lib/chai/utils/getPathValue.js"),e.getPathInfo=require("chai/lib/chai/utils/getPathInfo.js"),e.hasProperty=require("chai/lib/chai/utils/hasProperty.js"),e.getName=require("chai/lib/chai/utils/getName.js"),e.addProperty=require("chai/lib/chai/utils/addProperty.js"),e.addMethod=require("chai/lib/chai/utils/addMethod.js"),e.overwriteProperty=require("chai/lib/chai/utils/overwriteProperty.js"),e.overwriteMethod=require("chai/lib/chai/utils/overwriteMethod.js"),e.addChainableMethod=require("chai/lib/chai/utils/addChainableMethod.js"),e.overwriteChainableMethod=require("chai/lib/chai/utils/overwriteChainableMethod.js")}),require.register("chai/lib/chai/utils/inspect.js",function(e,t){function r(e,t,r){var n={showHidden:t,seen:[],stylize:function(e){return e}};return i(n,e,"undefined"==typeof r?2:r)}function i(t,r,p){if(r&&"function"==typeof r.inspect&&r.inspect!==e.inspect&&(!r.constructor||r.constructor.prototype!==r)){var y=r.inspect(p);return"string"!=typeof y&&(y=i(t,y,p)),y}var j=n(t,r);if(j)return j;if(v(r)){if("outerHTML"in r)return r.outerHTML;try{if(document.xmlVersion){var w=new XMLSerializer;return w.serializeToString(r)}var x="http://www.w3.org/1999/xhtml",m=document.createElementNS(x,"_");return m.appendChild(r.cloneNode(!1)),html=m.innerHTML.replace("><",">"+r.innerHTML+"<"),m.innerHTML="",html}catch(q){}}var A=b(r),O=t.showHidden?g(r):A;if(0===O.length||f(r)&&(1===O.length&&"stack"===O[0]||2===O.length&&"description"===O[0]&&"stack"===O[1])){if("function"==typeof r){var M=d(r),P=M?": "+M:"";return t.stylize("[Function"+P+"]","special")}if(h(r))return t.stylize(RegExp.prototype.toString.call(r),"regexp");if(l(r))return t.stylize(Date.prototype.toUTCString.call(r),"date");if(f(r))return o(r)}var S="",E=!1,_=["{","}"];if(u(r)&&(E=!0,_=["[","]"]),"function"==typeof r){var M=d(r),P=M?": "+M:"";S=" [Function"+P+"]"}if(h(r)&&(S=" "+RegExp.prototype.toString.call(r)),l(r)&&(S=" "+Date.prototype.toUTCString.call(r)),
-f(r))return o(r);if(0===O.length&&(!E||0==r.length))return _[0]+S+_[1];if(0>p)return h(r)?t.stylize(RegExp.prototype.toString.call(r),"regexp"):t.stylize("[Object]","special");t.seen.push(r);var k;return k=E?s(t,r,p,A,O):O.map(function(e){return a(t,r,p,A,e,E)}),t.seen.pop(),c(k,S,_)}function n(e,t){switch(typeof t){case"undefined":return e.stylize("undefined","undefined");case"string":var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string");case"number":return 0===t&&1/t===-(1/0)?e.stylize("-0","number"):e.stylize(""+t,"number");case"boolean":return e.stylize(""+t,"boolean")}return null===t?e.stylize("null","null"):void 0}function o(e){return"["+Error.prototype.toString.call(e)+"]"}function s(e,t,r,i,n){for(var o=[],s=0,c=t.length;c>s;++s)o.push(Object.prototype.hasOwnProperty.call(t,String(s))?a(e,t,r,i,String(s),!0):"");return n.forEach(function(n){n.match(/^\d+$/)||o.push(a(e,t,r,i,n,!0))}),o}function a(e,t,r,n,o,s){var a,c;if(t.__lookupGetter__&&(t.__lookupGetter__(o)?c=t.__lookupSetter__(o)?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):t.__lookupSetter__(o)&&(c=e.stylize("[Setter]","special"))),n.indexOf(o)<0&&(a="["+o+"]"),c||(e.seen.indexOf(t[o])<0?(c=null===r?i(e,t[o],null):i(e,t[o],r-1),c.indexOf("\n")>-1&&(c=s?c.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+c.split("\n").map(function(e){return" "+e}).join("\n"))):c=e.stylize("[Circular]","special")),"undefined"==typeof a){if(s&&o.match(/^\d+$/))return c;a=JSON.stringify(""+o),a.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+c}function c(e,t,r){var i=0,n=e.reduce(function(e,t){return i++,t.indexOf("\n")>=0&&i++,e+t.length+1},0);return n>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function u(e){return Array.isArray(e)||"object"==typeof e&&"[object Array]"===p(e)}function h(e){return"object"==typeof e&&"[object RegExp]"===p(e)}function l(e){return"object"==typeof e&&"[object Date]"===p(e)}function f(e){return"object"==typeof e&&"[object Error]"===p(e)}function p(e){return Object.prototype.toString.call(e)}var d=require("chai/lib/chai/utils/getName.js"),g=require("chai/lib/chai/utils/getProperties.js"),b=require("chai/lib/chai/utils/getEnumerableProperties.js");t.exports=r;var v=function(e){return"object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&1===e.nodeType&&"string"==typeof e.nodeName}}),require.register("chai/lib/chai/utils/objDisplay.js",function(e,t){var r=require("chai/lib/chai/utils/inspect.js"),i=require("chai/lib/chai/config.js");t.exports=function(e){var t=r(e),n=Object.prototype.toString.call(e);if(i.truncateThreshold&&t.length>=i.truncateThreshold){if("[object Function]"===n)return e.name&&""!==e.name?"[Function: "+e.name+"]":"[Function]";if("[object Array]"===n)return"[ Array("+e.length+") ]";if("[object Object]"===n){var o=Object.keys(e),s=o.length>2?o.splice(0,2).join(", ")+", ...":o.join(", ");return"{ Object ("+s+") }"}return t}return t}}),require.register("chai/lib/chai/utils/overwriteMethod.js",function(e,t){t.exports=function(e,t,r){var i=e[t],n=function(){return this};i&&"function"==typeof i&&(n=i),e[t]=function(){var e=r(n).apply(this,arguments);return void 0===e?this:e}}}),require.register("chai/lib/chai/utils/overwriteProperty.js",function(e,t){t.exports=function(e,t,r){var i=Object.getOwnPropertyDescriptor(e,t),n=function(){};i&&"function"==typeof i.get&&(n=i.get),Object.defineProperty(e,t,{get:function(){var e=r(n).call(this);return void 0===e?this:e},configurable:!0})}}),require.register("chai/lib/chai/utils/overwriteChainableMethod.js",function(e,t){t.exports=function(e,t,r,i){var n=e.__methods[t],o=n.chainingBehavior;n.chainingBehavior=function(){var e=i(o).call(this);return void 0===e?this:e};var s=n.method;n.method=function(){var e=r(s).apply(this,arguments);return void 0===e?this:e}}}),require.register("chai/lib/chai/utils/test.js",function(e,t){var r=require("chai/lib/chai/utils/flag.js");t.exports=function(e,t){var i=r(e,"negate"),n=t[0];return i?!n:n}}),require.register("chai/lib/chai/utils/transferFlags.js",function(e,t){t.exports=function(e,t,r){var i=e.__flags||(e.__flags=Object.create(null));t.__flags||(t.__flags=Object.create(null)),r=3===arguments.length?r:!0;for(var n in i)(r||"object"!==n&&"ssfi"!==n&&"message"!=n)&&(t.__flags[n]=i[n])}}),require.register("chai/lib/chai/utils/type.js",function(e,t){var r={"[object Arguments]":"arguments","[object Array]":"array","[object Date]":"date","[object Function]":"function","[object Number]":"number","[object RegExp]":"regexp","[object String]":"string"};t.exports=function(e){var t=Object.prototype.toString.call(e);return r[t]?r[t]:null===e?"null":void 0===e?"undefined":e===Object(e)?"object":typeof e}}),"object"==typeof exports?module.exports=require("chai"):"function"==typeof define&&define.amd?define("chai",[],function(){return require("chai")}):(this||window).chai=require("chai")}();
diff --git a/chromium/third_party/catapult/tracing/third_party/components/core-component-page/.bower.json b/chromium/third_party/catapult/tracing/third_party/components/core-component-page/.bower.json
deleted file mode 100644
index 0a244bdc190..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/core-component-page/.bower.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name": "core-component-page",
- "private": true,
- "dependencies": {
- "webcomponentsjs": "Polymer/webcomponentsjs#^0.5",
- "polymer": "Polymer/polymer#^0.5"
- },
- "version": "0.5.5",
- "homepage": "https://github.com/Polymer/core-component-page",
- "_release": "0.5.5",
- "_resolution": {
- "type": "version",
- "tag": "0.5.5",
- "commit": "f91588e0297bb3e8e723d4558ab015cf82885571"
- },
- "_source": "git://github.com/Polymer/core-component-page.git",
- "_target": "^0.5",
- "_originalSource": "Polymer/core-component-page"
-} \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/core-component-page/README.md b/chromium/third_party/catapult/tracing/third_party/components/core-component-page/README.md
deleted file mode 100644
index 7cb18ec7fef..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/core-component-page/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-core-component-page
-===================
-
-See the [component page](http://polymer-project.org/docs/elements/core-elements.html#core-component-page) for more information.
-
-Note: this is the vulcanized version of [`core-component-page-dev`](https://github.com/Polymer/core-component-page-dev) (the source).
diff --git a/chromium/third_party/catapult/tracing/third_party/components/core-component-page/bowager-logo.png b/chromium/third_party/catapult/tracing/third_party/components/core-component-page/bowager-logo.png
deleted file mode 100644
index 76be9fb04c1..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/core-component-page/bowager-logo.png
+++ /dev/null
Binary files differ
diff --git a/chromium/third_party/catapult/tracing/third_party/components/core-component-page/bower.json b/chromium/third_party/catapult/tracing/third_party/components/core-component-page/bower.json
deleted file mode 100644
index 361124c2dfc..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/core-component-page/bower.json
+++ /dev/null
@@ -1,9 +0,0 @@
-{
- "name": "core-component-page",
- "private": true,
- "dependencies": {
- "webcomponentsjs": "Polymer/webcomponentsjs#^0.5",
- "polymer": "Polymer/polymer#^0.5"
- },
- "version": "0.5.5"
-} \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/core-component-page/core-component-page.html b/chromium/third_party/catapult/tracing/third_party/components/core-component-page/core-component-page.html
deleted file mode 100644
index 5c642c77667..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/core-component-page/core-component-page.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!--
-Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<style>body{margin:0}</style>
-
-<div hidden><link rel="import" href="../polymer/polymer.html"><polymer-element name="core-meta" attributes="label type" hidden assetpath="../core-meta/"><script>(function(){var SKIP_ID="meta";var metaData={},metaArray={};Polymer("core-meta",{type:"default",alwaysPrepare:true,ready:function(){this.register(this.id)},get metaArray(){var t=this.type;if(!metaArray[t]){metaArray[t]=[]}return metaArray[t]},get metaData(){var t=this.type;if(!metaData[t]){metaData[t]={}}return metaData[t]},register:function(id,old){if(id&&id!==SKIP_ID){this.unregister(this,old);this.metaData[id]=this;this.metaArray.push(this)}},unregister:function(meta,id){delete this.metaData[id||meta.id];var i=this.metaArray.indexOf(meta);if(i>=0){this.metaArray.splice(i,1)}},get list(){return this.metaArray},byId:function(id){return this.metaData[id]}})})();</script></polymer-element><polymer-element name="core-iconset" extends="core-meta" attributes="src width icons iconSize" assetpath="../core-iconset/"><script>Polymer("core-iconset",{src:"",width:0,icons:"",iconSize:24,offsetX:0,offsetY:0,type:"iconset",created:function(){this.iconMap={};this.iconNames=[];this.themes={}},ready:function(){if(this.src&&this.ownerDocument!==document){this.src=this.resolvePath(this.src,this.ownerDocument.baseURI)}this.super();this.updateThemes()},iconsChanged:function(){var ox=this.offsetX;var oy=this.offsetY;this.icons&&this.icons.split(/\s+/g).forEach(function(name,i){this.iconNames.push(name);this.iconMap[name]={offsetX:ox,offsetY:oy};if(ox+this.iconSize<this.width){ox+=this.iconSize}else{ox=this.offsetX;oy+=this.iconSize}},this)},updateThemes:function(){var ts=this.querySelectorAll("property[theme]");ts&&ts.array().forEach(function(t){this.themes[t.getAttribute("theme")]={offsetX:parseInt(t.getAttribute("offsetX"))||0,offsetY:parseInt(t.getAttribute("offsetY"))||0}},this)},getOffset:function(icon,theme){var i=this.iconMap[icon];if(!i){var n=this.iconNames[Number(icon)];i=this.iconMap[n]}var t=this.themes[theme];if(i&&t){return{offsetX:i.offsetX+t.offsetX,offsetY:i.offsetY+t.offsetY}}return i},applyIcon:function(element,icon,scale){var offset=this.getOffset(icon);scale=scale||1;if(element&&offset){var icon=element._icon||document.createElement("div");var style=icon.style;style.backgroundImage="url("+this.src+")";style.backgroundPosition=-offset.offsetX*scale+"px"+" "+(-offset.offsetY*scale+"px");style.backgroundSize=scale===1?"auto":this.width*scale+"px";if(icon.parentNode!==element){element.appendChild(icon)}return icon}}});</script></polymer-element><style shim-shadowdom="">html /deep/ core-icon{display:inline-block;vertical-align:middle;background-repeat:no-repeat;fill:currentcolor;position:relative;height:24px;width:24px}</style><polymer-element name="core-icon" attributes="src icon alt" assetpath="../core-icon/"><script>(function(){var meta;Polymer("core-icon",{src:"",icon:"",alt:null,observe:{icon:"updateIcon",alt:"updateAlt"},defaultIconset:"icons",ready:function(){if(!meta){meta=document.createElement("core-iconset")}if(this.hasAttribute("aria-label")){if(!this.hasAttribute("role")){this.setAttribute("role","img")}return}this.updateAlt()},srcChanged:function(){var icon=this._icon||document.createElement("div");icon.textContent="";icon.setAttribute("fit","");icon.style.backgroundImage="url("+this.src+")";icon.style.backgroundPosition="center";icon.style.backgroundSize="100%";if(!icon.parentNode){this.appendChild(icon)}this._icon=icon},getIconset:function(name){return meta.byId(name||this.defaultIconset)},updateIcon:function(oldVal,newVal){if(!this.icon){this.updateAlt();return}var parts=String(this.icon).split(":");var icon=parts.pop();if(icon){var set=this.getIconset(parts.pop());if(set){this._icon=set.applyIcon(this,icon);if(this._icon){this._icon.setAttribute("fit","")}}}if(oldVal){if(oldVal.split(":").pop()==this.getAttribute("aria-label")){this.updateAlt()}}},updateAlt:function(){if(this.getAttribute("aria-hidden")){return}if(this.alt===""){this.setAttribute("aria-hidden","true");if(this.hasAttribute("role")){this.removeAttribute("role")}if(this.hasAttribute("aria-label")){this.removeAttribute("aria-label")}}else{this.setAttribute("aria-label",this.alt||this.icon.split(":").pop());if(!this.hasAttribute("role")){this.setAttribute("role","img")}if(this.hasAttribute("aria-hidden")){this.removeAttribute("aria-hidden")}}}})})();</script></polymer-element><polymer-element name="core-iconset-svg" extends="core-meta" attributes="iconSize" assetpath="../core-iconset-svg/"><script>Polymer("core-iconset-svg",{iconSize:24,type:"iconset",created:function(){this._icons={}},ready:function(){this.super();this.updateIcons()},iconById:function(id){return this._icons[id]||(this._icons[id]=this.querySelector("#"+id))},cloneIcon:function(id){var icon=this.iconById(id);if(icon){var content=icon.cloneNode(true);content.removeAttribute("id");var svg=document.createElementNS("http://www.w3.org/2000/svg","svg");svg.setAttribute("viewBox","0 0 "+this.iconSize+" "+this.iconSize);svg.style.pointerEvents="none";svg.appendChild(content);return svg}},get iconNames(){if(!this._iconNames){this._iconNames=this.findIconNames()}return this._iconNames},findIconNames:function(){var icons=this.querySelectorAll("[id]").array();if(icons.length){return icons.map(function(n){return n.id})}},applyIcon:function(element,icon){var root=element;var old=root.querySelector("svg");if(old){old.remove()}var svg=this.cloneIcon(icon);if(!svg){return}svg.setAttribute("height","100%");svg.setAttribute("width","100%");svg.setAttribute("preserveAspectRatio","xMidYMid meet");svg.style.display="block";root.insertBefore(svg,root.firstElementChild);return svg},updateIcons:function(selector,method){selector=selector||"[icon]";method=method||"updateIcon";var deep=window.ShadowDOMPolyfill?"":"html /deep/ ";var i$=document.querySelectorAll(deep+selector);for(var i=0,e;e=i$[i];i++){if(e[method]){e[method].call(e)}}}});</script></polymer-element><core-iconset-svg id="icons" iconsize="24"><svg><defs><g id="accessibility"><path d="M12 2c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm9 7h-6v13h-2v-6h-2v6h-2v-13h-6v-2h18v2z"/></g><g id="account-balance"><path d="M4 10v7h3v-7h-3zm6 0v7h3v-7h-3zm-8 12h19v-3h-19v3zm14-12v7h3v-7h-3zm-4.5-9l-9.5 5v2h19v-2l-9.5-5z"/></g><g id="account-balance-wallet"><path d="M21 18v1c0 1.1-.9 2-2 2h-14c-1.11 0-2-.9-2-2v-14c0-1.1.89-2 2-2h14c1.1 0 2 .9 2 2v1h-9c-1.11 0-2 .9-2 2v8c0 1.1.89 2 2 2h9zm-9-2h10v-8h-10v8zm4-2.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"/></g><g id="account-box"><path d="M3 5v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2h-14c-1.11 0-2 .9-2 2zm12 4c0 1.66-1.34 3-3 3s-3-1.34-3-3 1.34-3 3-3 3 1.34 3 3zm-9 8c0-2 4-3.1 6-3.1s6 1.1 6 3.1v1h-12v-1z"/></g><g id="account-child"><path d="M16.5 12c1.38 0 2.49-1.12 2.49-2.5s-1.11-2.5-2.49-2.5c-1.38 0-2.5 1.12-2.5 2.5s1.12 2.5 2.5 2.5zm-7.5-1c1.66 0 2.99-1.34 2.99-3s-1.33-3-2.99-3c-1.66 0-3 1.34-3 3s1.34 3 3 3zm7.5 3c-1.83 0-5.5.92-5.5 2.75v2.25h11v-2.25c0-1.83-3.67-2.75-5.5-2.75zm-7.5-1c-2.33 0-7 1.17-7 3.5v2.5h7v-2.25c0-.85.33-2.34 2.37-3.47-.87-.18-1.71-.28-2.37-.28z"/></g><g id="account-circle"><path d="M12 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"/></g><g id="add-box"><path d="M19 3h-14c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm-2 10h-4v4h-2v-4h-4v-2h4v-4h2v4h4v2z"/></g><g id="add-circle-outline"><path d="M13 7h-2v4h-4v2h4v4h2v-4h4v-2h-4v-4zm-1-5c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></g><g id="add-circle"><path d="M12 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm5 11h-4v4h-2v-4h-4v-2h4v-4h2v4h4v2z"/></g><g id="add"><path d="M19 13h-6v6h-2v-6h-6v-2h6v-6h2v6h6v2z"/></g><g id="add-shopping-cart"><path d="M11 9h2v-3h3v-2h-3v-3h-2v3h-3v2h3v3zm-4 9c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2zm-9.83-3.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.86-7.01-1.74-.96h-.01l-1.1 2-2.76 5h-7.02l-.13-.27-2.24-4.73-.95-2-.94-2h-3.27v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2h-11.58c-.13 0-.25-.11-.25-.25z"/></g><g id="alarm-add"><path d="M7.88 3.39l-1.28-1.53-4.6 3.85 1.29 1.53 4.59-3.85zm14.12 2.33l-4.6-3.86-1.29 1.53 4.6 3.86 1.29-1.53zm-10-1.72c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7zm1-11h-2v3h-3v2h3v3h2v-3h3v-2h-3v-3z"/></g><g id="alarm-off"><path d="M12 6c3.87 0 7 3.13 7 7 0 .84-.16 1.65-.43 2.4l1.52 1.52c.58-1.19.91-2.51.91-3.92 0-4.97-4.03-9-9-9-1.41 0-2.73.33-3.92.91l1.52 1.52c.75-.27 1.56-.43 2.4-.43zm10-.28l-4.6-3.86-1.29 1.53 4.6 3.86 1.29-1.53zm-19.08-3.43l-1.27 1.28 1.33 1.33-1.11.93 1.42 1.42 1.11-.94.8.8c-1.37 1.58-2.2 3.64-2.2 5.89 0 4.97 4.02 9 9 9 2.25 0 4.31-.83 5.89-2.2l2.2 2.2 1.27-1.27-17.47-17.46-.97-.98zm13.55 16.1c-1.21 1-2.77 1.61-4.47 1.61-3.87 0-7-3.13-7-7 0-1.7.61-3.26 1.61-4.47l9.86 9.86zm-8.45-15.11l-1.42-1.42-.86.71 1.42 1.42.86-.71z"/></g><g id="alarm-on"><path d="M22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86 1.29-1.53zm-14.12-2.33l-1.28-1.53-4.6 3.85 1.29 1.53 4.59-3.85zm4.12.61c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7zm-1.46-5.47l-2.13-2.13-1.06 1.06 3.18 3.18 6-6-1.06-1.06-4.93 4.95z"/></g><g id="alarm"><path d="M22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86 1.29-1.53zm-14.12-2.33l-1.28-1.53-4.6 3.85 1.29 1.53 4.59-3.85zm4.62 4.61h-1.5v6l4.75 2.85.75-1.23-4-2.37v-5.25zm-.5-4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"/></g><g id="android"><path d="M6 18c0 .55.45 1 1 1h1v3.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-3.5h2v3.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-3.5h1c.55 0 1-.45 1-1v-10h-12v10zm-2.5-10c-.83 0-1.5.67-1.5 1.5v7c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-7c0-.83-.67-1.5-1.5-1.5zm17 0c-.83 0-1.5.67-1.5 1.5v7c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-7c0-.83-.67-1.5-1.5-1.5zm-4.97-5.84l1.3-1.3c.2-.2.2-.51 0-.71-.2-.2-.51-.2-.71 0l-1.48 1.48c-.79-.4-1.69-.63-2.64-.63-.96 0-1.86.23-2.66.63l-1.49-1.48c-.2-.2-.51-.2-.71 0-.2.2-.2.51 0 .71l1.31 1.31c-1.48 1.09-2.45 2.84-2.45 4.83h12c0-1.99-.97-3.75-2.47-4.84zm-5.53 2.84h-1v-1h1v1zm5 0h-1v-1h1v1z"/></g><g id="announcement"><path d="M20 2h-16c-1.1 0-1.99.9-1.99 2l-.01 18 4-4h14c1.1 0 2-.9 2-2v-12c0-1.1-.9-2-2-2zm-7 9h-2v-6h2v6zm0 4h-2v-2h2v2z"/></g><g id="apps"><path d="M4 8h4v-4h-4v4zm6 12h4v-4h-4v4zm-6 0h4v-4h-4v4zm0-6h4v-4h-4v4zm6 0h4v-4h-4v4zm6-10v4h4v-4h-4zm-6 4h4v-4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"/></g><g id="archive"><path d="M20.54 5.23l-1.39-1.68c-.27-.34-.68-.55-1.15-.55h-12c-.47 0-.88.21-1.16.55l-1.38 1.68c-.29.34-.46.79-.46 1.27v12.5c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-12.5c0-.48-.17-.93-.46-1.27zm-8.54 12.27l-5.5-5.5h3.5v-2h4v2h3.5l-5.5 5.5zm-6.88-12.5l.81-1h12l.94 1h-13.75z"/></g><g id="arrow-back"><path d="M20 11h-12.17l5.59-5.59-1.42-1.41-8 8 8 8 1.41-1.41-5.58-5.59h12.17v-2z"/></g><g id="arrow-drop-down-circle"><path d="M12 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 12l-4-4h8l-4 4z"/></g><g id="arrow-drop-down"><path d="M7 10l5 5 5-5z"/></g><g id="arrow-drop-up"><path d="M7 14l5-5 5 5z"/></g><g id="arrow-forward"><path d="M12 4l-1.41 1.41 5.58 5.59h-12.17v2h12.17l-5.58 5.59 1.41 1.41 8-8z"/></g><g id="aspect-ratio"><path d="M19 12h-2v3h-3v2h5v-5zm-12-3h3v-2h-5v5h2v-3zm14-6h-18c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm0 16.01h-18v-14.02h18v14.02z"/></g><g id="assessment"><path d="M19 3h-14c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm-10 14h-2v-7h2v7zm4 0h-2v-10h2v10zm4 0h-2v-4h2v4z"/></g><g id="assignment-ind"><path d="M19 3h-4.18c-.42-1.16-1.52-2-2.82-2-1.3 0-2.4.84-2.82 2h-4.18c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm0 4c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm6 12h-12v-1.4c0-2 4-3.1 6-3.1s6 1.1 6 3.1v1.4z"/></g><g id="assignment-late"><path d="M19 3h-4.18c-.42-1.16-1.52-2-2.82-2-1.3 0-2.4.84-2.82 2h-4.18c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm-6 15h-2v-2h2v2zm0-4h-2v-6h2v6zm-1-9c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z"/></g><g id="assignment"><path d="M19 3h-4.18c-.42-1.16-1.52-2-2.82-2-1.3 0-2.4.84-2.82 2h-4.18c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm2 14h-7v-2h7v2zm3-4h-10v-2h10v2zm0-4h-10v-2h10v2z"/></g><g id="assignment-returned"><path d="M19 3h-4.18c-.42-1.16-1.52-2-2.82-2-1.3 0-2.4.84-2.82 2h-4.18c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm0 15l-5-5h3v-4h4v4h3l-5 5z"/></g><g id="assignment-return"><path d="M19 3h-4.18c-.42-1.16-1.52-2-2.82-2-1.3 0-2.4.84-2.82 2h-4.18c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm4 12h-4v3l-5-5 5-5v3h4v4z"/></g><g id="assignment-turned-in"><path d="M19 3h-4.18c-.42-1.16-1.52-2-2.82-2-1.3 0-2.4.84-2.82 2h-4.18c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm-2 14l-4-4 1.41-1.41 2.59 2.58 6.59-6.59 1.41 1.42-8 8z"/></g><g id="attachment"><path d="M7.5 18c-3.04 0-5.5-2.46-5.5-5.5s2.46-5.5 5.5-5.5h10.5c2.21 0 4 1.79 4 4s-1.79 4-4 4h-8.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5h7.5v1.5h-7.5c-.55 0-1 .45-1 1s.45 1 1 1h8.5c1.38 0 2.5-1.12 2.5-2.5s-1.12-2.5-2.5-2.5h-10.5c-2.21 0-4 1.79-4 4s1.79 4 4 4h9.5v1.5h-9.5z"/></g><g id="autorenew"><path d="M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26l1.46-1.46c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6zm6.76 1.74l-1.46 1.46c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26z"/></g><g id="backspace"><path d="M22 3h-15c-.69 0-1.23.35-1.59.88l-5.41 8.12 5.41 8.11c.36.53.9.89 1.59.89h15c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm-3 12.59l-1.41 1.41-3.59-3.59-3.59 3.59-1.41-1.41 3.59-3.59-3.59-3.59 1.41-1.41 3.59 3.59 3.59-3.59 1.41 1.41-3.59 3.59 3.59 3.59z"/></g><g id="backup"><path d="M19.35 10.04c-.68-3.45-3.71-6.04-7.35-6.04-2.89 0-5.4 1.64-6.65 4.04-3.01.32-5.35 2.87-5.35 5.96 0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zm-5.35 2.96v4h-4v-4h-3l5-5 5 5h-3z"/></g><g id="block"><path d="M12 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm-8 10c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69l-11.21 11.21c-1.06-1.35-1.69-3.05-1.69-4.9zm8 8c-1.85 0-3.55-.63-4.9-1.69l11.21-11.21c1.06 1.35 1.69 3.05 1.69 4.9 0 4.42-3.58 8-8 8z"/></g><g id="bookmark-outline"><path d="M17 3h-10c-1.1 0-1.99.9-1.99 2l-.01 16 7-3 7 3v-16c0-1.1-.9-2-2-2zm0 15l-5-2.18-5 2.18v-13h10v13z"/></g><g id="bookmark"><path d="M17 3h-10c-1.1 0-1.99.9-1.99 2l-.01 16 7-3 7 3v-16c0-1.1-.9-2-2-2z"/></g><g id="book"><path d="M18 2h-12c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-16c0-1.1-.9-2-2-2zm-12 2h5v8l-2.5-1.5-2.5 1.5v-8z"/></g><g id="bug-report"><path d="M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96l1.63-1.63-1.41-1.41-2.17 2.17c-.46-.11-.93-.17-1.42-.17-.49 0-.96.06-1.41.17l-2.18-2.17-1.41 1.41 1.62 1.63c-.74.51-1.36 1.18-1.81 1.96h-2.81v2h2.09c-.05.33-.09.66-.09 1v1h-2v2h2v1c0 .34.04.67.09 1h-2.09v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3h2.81v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1h2.09v-2zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z"/></g><g id="cached"><path d="M19 8l-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46c1.23.78 2.69 1.24 4.26 1.24 4.42 0 8-3.58 8-8h3l-4-4zm-13 4c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46c-1.23-.78-2.69-1.24-4.26-1.24-4.42 0-8 3.58-8 8h-3l4 4 4-4h-3z"/></g><g id="cancel"><path d="M12 2c-5.53 0-10 4.47-10 10s4.47 10 10 10 10-4.47 10-10-4.47-10-10-10zm5 13.59l-1.41 1.41-3.59-3.59-3.59 3.59-1.41-1.41 3.59-3.59-3.59-3.59 1.41-1.41 3.59 3.59 3.59-3.59 1.41 1.41-3.59 3.59 3.59 3.59z"/></g><g id="check-box-outline-blank"><path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/></g><g id="check-box"><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></g><g id="check"><path d="M9 16.17l-4.17-4.17-1.42 1.41 5.59 5.59 12-12-1.41-1.41z"/></g><g id="chevron-left"><path d="M15.41 7.41l-1.41-1.41-6 6 6 6 1.41-1.41-4.58-4.59z"/></g><g id="chevron-right"><path d="M10 6l-1.41 1.41 4.58 4.59-4.58 4.59 1.41 1.41 6-6z"/></g><g id="class"><path d="M18 2h-12c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-16c0-1.1-.9-2-2-2zm-12 2h5v8l-2.5-1.5-2.5 1.5v-8z"/></g><g id="clear"><path d="M19 6.41l-1.41-1.41-5.59 5.59-5.59-5.59-1.41 1.41 5.59 5.59-5.59 5.59 1.41 1.41 5.59-5.59 5.59 5.59 1.41-1.41-5.59-5.59z"/></g><g id="close"><path d="M19 6.41l-1.41-1.41-5.59 5.59-5.59-5.59-1.41 1.41 5.59 5.59-5.59 5.59 1.41 1.41 5.59-5.59 5.59 5.59 1.41-1.41-5.59-5.59z"/></g><g id="cloud-circle"><path d="M12 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm4.5 14h-8.5c-1.66 0-3-1.34-3-3s1.34-3 3-3l.14.01c.44-1.73 1.99-3.01 3.86-3.01 2.21 0 4 1.79 4 4h.5c1.38 0 2.5 1.12 2.5 2.5s-1.12 2.5-2.5 2.5z"/></g><g id="cloud-done"><path d="M19.35 10.04c-.68-3.45-3.71-6.04-7.35-6.04-2.89 0-5.4 1.64-6.65 4.04-3.01.32-5.35 2.87-5.35 5.96 0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zm-9.35 6.96l-3.5-3.5 1.41-1.41 2.09 2.08 5.18-5.17 1.41 1.41-6.59 6.59z"/></g><g id="cloud-download"><path d="M19.35 10.04c-.68-3.45-3.71-6.04-7.35-6.04-2.89 0-5.4 1.64-6.65 4.04-3.01.32-5.35 2.87-5.35 5.96 0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zm-2.35 2.96l-5 5-5-5h3v-4h4v4h3z"/></g><g id="cloud-off"><path d="M19.35 10.04c-.68-3.45-3.71-6.04-7.35-6.04-1.48 0-2.85.43-4.01 1.17l1.46 1.46c.76-.4 1.63-.63 2.55-.63 3.04 0 5.5 2.46 5.5 5.5v.5h1.5c1.66 0 3 1.34 3 3 0 1.13-.64 2.11-1.56 2.62l1.45 1.45c1.27-.91 2.11-2.39 2.11-4.07 0-2.64-2.05-4.78-4.65-4.96zm-16.35-4.77l2.75 2.74c-3.19.14-5.75 2.76-5.75 5.99 0 3.31 2.69 6 6 6h11.73l2 2 1.27-1.27-16.73-16.73-1.27 1.27zm4.73 4.73l8 8h-9.73c-2.21 0-4-1.79-4-4s1.79-4 4-4h1.73z"/></g><g id="cloud"><path d="M19.35 10.04c-.68-3.45-3.71-6.04-7.35-6.04-2.89 0-5.4 1.64-6.65 4.04-3.01.32-5.35 2.87-5.35 5.96 0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z"/></g><g id="cloud-queue"><path d="M19.35 10.04c-.68-3.45-3.71-6.04-7.35-6.04-2.89 0-5.4 1.64-6.65 4.04-3.01.32-5.35 2.87-5.35 5.96 0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zm-.35 7.96h-13c-2.21 0-4-1.79-4-4s1.79-4 4-4h.71c.66-2.31 2.77-4 5.29-4 3.04 0 5.5 2.46 5.5 5.5v.5h1.5c1.66 0 3 1.34 3 3s-1.34 3-3 3z"/></g><g id="cloud-upload"><path d="M19.35 10.04c-.68-3.45-3.71-6.04-7.35-6.04-2.89 0-5.4 1.64-6.65 4.04-3.01.32-5.35 2.87-5.35 5.96 0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zm-5.35 2.96v4h-4v-4h-3l5-5 5 5h-3z"/></g><g id="content-copy"><path d="M16 1h-12c-1.1 0-2 .9-2 2v14h2v-14h12v-2zm3 4h-11c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm0 16h-11v-14h11v14z"/></g><g id="content-cut"><path d="M9.64 7.64c.23-.5.36-1.05.36-1.64 0-2.21-1.79-4-4-4s-4 1.79-4 4 1.79 4 4 4c.59 0 1.14-.13 1.64-.36l2.36 2.36-2.36 2.36c-.5-.23-1.05-.36-1.64-.36-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4c0-.59-.13-1.14-.36-1.64l2.36-2.36 7 7h3v-1l-12.36-12.36zm-3.64.36c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm0 12c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm6-7.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5.5.22.5.5-.22.5-.5.5zm7-9.5l-6 6 2 2 7-7v-1z"/></g><g id="content-paste"><path d="M19 2h-4.18c-.42-1.16-1.52-2-2.82-2-1.3 0-2.4.84-2.82 2h-4.18c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-16c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm7 18h-14v-16h2v3h10v-3h2v16z"/></g><g id="create"><path d="M3 17.25v3.75h3.75l11.06-11.06-3.75-3.75-11.06 11.06zm17.71-10.21c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"/></g><g id="credit-card"><path d="M4 12h16v6h-16z"/><path d="M20 4h-16c-1.11 0-1.99.89-1.99 2l-.01 12c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2v-12c0-1.11-.89-2-2-2zm0 14h-16v-6h16v6zm0-10h-16v-2h16v2z"/></g><g id="dashboard"><path d="M3 13h8v-10h-8v10zm0 8h8v-6h-8v6zm10 0h8v-10h-8v10zm0-18v6h8v-6h-8z"/></g><g id="delete"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2v-12h-12v12zm13-15h-3.5l-1-1h-5l-1 1h-3.5v2h14v-2z"/></g><g id="description"><path d="M14 2h-8c-1.1 0-1.99.9-1.99 2l-.01 16c0 1.1.89 2 1.99 2h12.01c1.1 0 2-.9 2-2v-12l-6-6zm2 16h-8v-2h8v2zm0-4h-8v-2h8v2zm-3-5v-5.5l5.5 5.5h-5.5z"/></g><g id="developer-mode-tv"><path d="M4 5h16v2h2v-2c0-1.1-.9-2-2-2h-16c-1.1 0-2 .9-2 2v2h2v-2zm3.55 8.83l-2.83-2.83 2.83-2.83-1.41-1.41-4.25 4.24 4.24 4.24 1.42-1.41zm12.45 3.17h-16v-2h-2v2c0 1.1.9 2 2 2h4v2h8v-2h4c1.1 0 1.99-.9 1.99-2v-2h-1.99v2zm2-6.01l-4.24-4.24-1.41 1.41 2.82 2.84-2.83 2.83 1.41 1.41 4.25-4.23v-.02z"/></g><g id="dns"><path d="M20 13h-16c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1zm-13 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm13-16h-16c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1zm-13 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"/></g><g id="done-all"><path d="M18 7l-1.41-1.41-6.34 6.34 1.41 1.41 6.34-6.34zm4.24-1.41l-10.58 10.58-4.18-4.17-1.41 1.41 5.59 5.59 12-12-1.42-1.41zm-21.83 7.82l5.59 5.59 1.41-1.41-5.58-5.59-1.42 1.41z"/></g><g id="done"><path d="M9 16.17l-4.17-4.17-1.42 1.41 5.59 5.59 12-12-1.41-1.41z"/></g><g id="drafts"><path d="M21.99 8c0-.72-.37-1.35-.94-1.7l-9.05-5.3-9.05 5.3c-.57.35-.95.98-.95 1.7v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2l-.01-10zm-9.99 5l-8.26-5.16 8.26-4.84 8.26 4.84-8.26 5.16z"/></g><g id="drawer"><path d="M20,4H4C2.8,4,2,4.8,2,6v12c0,1.2,0.8,2,2,2h16c1,0,2-0.8,2-2V6C22,4.8,21,4,20,4z M20,18h-6V6h6V18z"/></g><g id="error"><path d="M12 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm1 15h-2v-2h2v2zm0-4h-2v-6h2v6z"/></g><g id="event"><path d="M17 12h-5v5h5v-5zm-1-11v2h-8v-2h-2v2h-1c-1.11 0-1.99.9-1.99 2l-.01 14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2h-1v-2h-2zm3 18h-14v-11h14v11z"/></g><g id="exit-to-app"><path d="M10.09 15.59l1.41 1.41 5-5-5-5-1.41 1.41 2.58 2.59h-9.67v2h9.67l-2.58 2.59zm8.91-12.59h-14c-1.11 0-2 .9-2 2v4h2v-4h14v14h-14v-4h-2v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2z"/></g><g id="expand-less"><path d="M12 8l-6 6 1.41 1.41 4.59-4.58 4.59 4.58 1.41-1.41z"/></g><g id="expand-more"><path d="M16.59 8.59l-4.59 4.58-4.59-4.58-1.41 1.41 6 6 6-6z"/></g><g id="explore"><path d="M12 10.9c-.61 0-1.1.49-1.1 1.1s.49 1.1 1.1 1.1c.61 0 1.1-.49 1.1-1.1s-.49-1.1-1.1-1.1zm0-8.9c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm2.19 12.19l-8.19 3.81 3.81-8.19 8.19-3.81-3.81 8.19z"/></g><g id="extension"><path d="M20.5 11h-1.5v-4c0-1.1-.9-2-2-2h-4v-1.5c0-1.38-1.12-2.5-2.5-2.5s-2.5 1.12-2.5 2.5v1.5h-4c-1.1 0-1.99.9-1.99 2v3.8h1.49c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7h-1.5v3.8c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7 1.49 0 2.7 1.21 2.7 2.7v1.5h3.8c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5s-1.12-2.5-2.5-2.5z"/></g><g id="face-unlock"><path d="M14.69 17.1c-.74.58-1.7.9-2.69.9s-1.95-.32-2.69-.9c-.22-.17-.53-.13-.7.09-.17.22-.13.53.09.7.91.72 2.09 1.11 3.3 1.11s2.39-.39 3.31-1.1c.22-.17.26-.48.09-.7-.17-.23-.49-.26-.71-.1z"/><circle cx="8.5" cy="12.5" r="1"/><path d="M12 0c-6.63 0-12 5.37-12 12s5.37 12 12 12 12-5.37 12-12-5.37-12-12-12zm7.96 14.82c-1.09 3.74-4.27 6.46-8.04 6.46-3.78 0-6.96-2.72-8.04-6.47-1.19-.11-2.13-1.18-2.13-2.52 0-1.27.85-2.31 1.97-2.5 2.09-1.46 3.8-3.49 4.09-5.05v-.01c1.35 2.63 6.3 5.19 11.83 5.06l.3-.03c1.28 0 2.31 1.14 2.31 2.54 0 1.38-1.02 2.51-2.29 2.52z"/><circle cx="15.5" cy="12.5" r="1"/></g><g id="favorite-outline"><path d="M16.5 3c-1.74 0-3.41.81-4.5 2.09-1.09-1.28-2.76-2.09-4.5-2.09-3.08 0-5.5 2.42-5.5 5.5 0 3.78 3.4 6.86 8.55 11.54l1.45 1.31 1.45-1.32c5.15-4.67 8.55-7.75 8.55-11.53 0-3.08-2.42-5.5-5.5-5.5zm-4.4 15.55l-.1.1-.1-.1c-4.76-4.31-7.9-7.16-7.9-10.05 0-2 1.5-3.5 3.5-3.5 1.54 0 3.04.99 3.57 2.36h1.87c.52-1.37 2.02-2.36 3.56-2.36 2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z"/></g><g id="favorite"><path d="M12 21.35l-1.45-1.32c-5.15-4.67-8.55-7.75-8.55-11.53 0-3.08 2.42-5.5 5.5-5.5 1.74 0 3.41.81 4.5 2.09 1.09-1.28 2.76-2.09 4.5-2.09 3.08 0 5.5 2.42 5.5 5.5 0 3.78-3.4 6.86-8.55 11.54l-1.45 1.31z"/></g><g id="file-download"><path d="M19 9h-4v-6h-6v6h-4l7 7 7-7zm-14 9v2h14v-2h-14z"/></g><g id="file-map"><path d="M12 6.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm7-5.5h-14c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm-6.5 16h-1c-.95-4.09-3.99-5.84-3.99-9 0-2.49 2-4.5 4.49-4.5s4.51 2.01 4.51 4.5c0 3.16-3.06 4.91-4.01 9z"/></g><g id="file-upload"><path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2h-14z"/></g><g id="filter-list"><path d="M10 18h4v-2h-4v2zm-7-12v2h18v-2h-18zm3 7h12v-2h-12v2z"/></g><g id="find-in-page"><path d="M20 19.59v-11.59l-6-6h-8c-1.1 0-1.99.9-1.99 2l-.01 16c0 1.1.89 2 1.99 2h12.01c.45 0 .85-.15 1.19-.4l-4.43-4.43c-.8.52-1.74.83-2.76.83-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5c0 1.02-.31 1.96-.83 2.75l3.83 3.84zm-11-6.59c0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3-3 1.34-3 3z"/></g><g id="find-replace"><path d="M11 6c1.38 0 2.63.56 3.54 1.46l-2.54 2.54h6v-6l-2.05 2.05c-1.27-1.27-3.02-2.05-4.95-2.05-3.53 0-6.43 2.61-6.92 6h2.02c.46-2.28 2.48-4 4.9-4zm5.64 9.14c.66-.9 1.12-1.97 1.28-3.14h-2.02c-.46 2.28-2.48 4-4.9 4-1.38 0-2.63-.56-3.54-1.46l2.54-2.54h-6v6l2.05-2.05c1.27 1.27 3.02 2.05 4.95 2.05 1.55 0 2.98-.51 4.14-1.36l4.86 4.85 1.49-1.49-4.85-4.86z"/></g><g id="flag"><path d="M14.4 6l-.4-2h-9v17h2v-7h5.6l.4 2h7v-10z"/></g><g id="flip-to-back"><path d="M9 7h-2v2h2v-2zm0 4h-2v2h2v-2zm0-8c-1.11 0-2 .9-2 2h2v-2zm4 12h-2v2h2v-2zm6-12v2h2c0-1.1-.9-2-2-2zm-6 0h-2v2h2v-2zm-4 14v-2h-2c0 1.1.89 2 2 2zm10-4h2v-2h-2v2zm0-4h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2zm-14-10h-2v12c0 1.1.89 2 2 2h12v-2h-12v-12zm10-2h2v-2h-2v2zm0 12h2v-2h-2v2z"/></g><g id="flip-to-front"><path d="M3 13h2v-2h-2v2zm0 4h2v-2h-2v2zm2 4v-2h-2c0 1.1.89 2 2 2zm-2-12h2v-2h-2v2zm12 12h2v-2h-2v2zm4-18h-10c-1.11 0-2 .9-2 2v10c0 1.1.89 2 2 2h10c1.1 0 2-.9 2-2v-10c0-1.1-.9-2-2-2zm0 12h-10v-10h10v10zm-8 6h2v-2h-2v2zm-4 0h2v-2h-2v2z"/></g><g id="folder-open"><path d="M20 6h-8l-2-2h-6c-1.1 0-1.99.9-1.99 2l-.01 12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-10c0-1.1-.9-2-2-2zm0 12h-16v-10h16v10z"/></g><g id="folder"><path d="M10 4h-6c-1.1 0-1.99.9-1.99 2l-.01 12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-10c0-1.1-.9-2-2-2h-8l-2-2z"/></g><g id="folder-shared"><path d="M20 6h-8l-2-2h-6c-1.1 0-1.99.9-1.99 2l-.01 12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-10c0-1.1-.9-2-2-2zm-5 3c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm4 8h-8v-1c0-1.33 2.67-2 4-2s4 .67 4 2v1z"/></g><g id="forward"><path d="M12 8v-4l8 8-8 8v-4h-8v-8z"/></g><g id="fullscreen-exit"><path d="M5 16h3v3h2v-5h-5v2zm3-8h-3v2h5v-5h-2v3zm6 11h2v-3h3v-2h-5v5zm2-11v-3h-2v5h5v-2h-3z"/></g><g id="fullscreen"><path d="M7 14h-2v5h5v-2h-3v-3zm-2-4h2v-3h3v-2h-5v5zm12 7h-3v2h5v-5h-2v3zm-3-12v2h3v3h2v-5h-5z"/></g><g id="gesture"><path d="M4.59 6.89c.7-.71 1.4-1.35 1.71-1.22.5.2 0 1.03-.3 1.52-.25.42-2.86 3.89-2.86 6.31 0 1.28.48 2.34 1.34 2.98.75.56 1.74.73 2.64.46 1.07-.31 1.95-1.4 3.06-2.77 1.21-1.49 2.83-3.44 4.08-3.44 1.63 0 1.65 1.01 1.76 1.79-3.78.64-5.38 3.67-5.38 5.37 0 1.7 1.44 3.09 3.21 3.09 1.63 0 4.29-1.33 4.69-6.1h2.46v-2.5h-2.47c-.15-1.65-1.09-4.2-4.03-4.2-2.25 0-4.18 1.91-4.94 2.84-.58.73-2.06 2.48-2.29 2.72-.25.3-.68.84-1.11.84-.45 0-.72-.83-.36-1.92.35-1.09 1.4-2.86 1.85-3.52.78-1.14 1.3-1.92 1.3-3.28 0-2.17-1.64-2.86-2.51-2.86-1.32 0-2.47 1-2.72 1.25-.36.36-.66.66-.88.93l1.75 1.71zm9.29 11.66c-.31 0-.74-.26-.74-.72 0-.6.73-2.2 2.87-2.76-.3 2.69-1.43 3.48-2.13 3.48z"/></g><g id="get-app"><path d="M19 9h-4v-6h-6v6h-4l7 7 7-7zm-14 9v2h14v-2h-14z"/></g><g id="grade"><path d="M12 17.27l6.18 3.73-1.64-7.03 5.46-4.73-7.19-.61-2.81-6.63-2.81 6.63-7.19.61 5.46 4.73-1.64 7.03z"/></g><g id="group-work"><path d="M12 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm-4 15.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5zm1.5-9.5c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5-2.5-1.12-2.5-2.5zm6.5 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/></g><g id="help"><path d="M12 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92c-.72.73-1.17 1.33-1.17 2.83h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2h-2c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"/></g><g id="highlight-remove"><path d="M14.59 8l-2.59 2.59-2.59-2.59-1.41 1.41 2.59 2.59-2.59 2.59 1.41 1.41 2.59-2.59 2.59 2.59 1.41-1.41-2.59-2.59 2.59-2.59-1.41-1.41zm-2.59-6c-5.53 0-10 4.47-10 10s4.47 10 10 10 10-4.47 10-10-4.47-10-10-10zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></g><g id="history"><path opacity=".9" d="M13 3c-4.97 0-9 4.03-9 9h-3l3.89 3.89.07.14 4.04-4.03h-3c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42c1.63 1.63 3.87 2.64 6.36 2.64 4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08v-4.25h-1.5z"/></g><g id="home"><path d="M10 20v-6h4v6h5v-8h3l-10-9-10 9h3v8z"/></g><g id="https"><path d="M18 8h-1v-2c0-2.76-2.24-5-5-5s-5 2.24-5 5v2h-1c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9h-6.2v-2c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></g><g id="inbox"><path d="M19 3h-14.01c-1.1 0-1.98.9-1.98 2l-.01 14c0 1.1.89 2 1.99 2h14.01c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm0 12h-4c0 1.66-1.34 3-3 3s-3-1.34-3-3h-4.01v-10h14.01v10zm-3-5h-2v-3h-4v3h-2l4 4 4-4z"/></g><g id="info-outline"><path d="M11 17h2v-6h-2v6zm1-15c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm-1-11h2v-2h-2v2z"/></g><g id="info"><path d="M12 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm1 15h-2v-6h2v6zm0-8h-2v-2h2v2z"/></g><g id="input"><path d="M21 3.01h-18c-1.1 0-2 .9-2 2v3.99h2v-4.01h18v14.03h-18v-4.02h-2v4.01c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98v-14c0-1.11-.9-2-2-2zm-10 12.99l4-4-4-4v3h-10v2h10v3z"/></g><g id="invert-colors"><path d="M17.66 7.93l-5.66-5.66-5.66 5.66c-3.12 3.12-3.12 8.19 0 11.31 1.56 1.56 3.61 2.34 5.66 2.34 2.05 0 4.1-.78 5.66-2.34 3.12-3.12 3.12-8.19 0-11.31zm-5.66 11.66c-1.6 0-3.11-.62-4.24-1.76-1.14-1.14-1.76-2.64-1.76-4.24s.62-3.11 1.76-4.24l4.24-4.25v14.49z"/></g><g id="label-outline"><path d="M17.63 5.84c-.36-.51-.96-.84-1.63-.84l-11 .01c-1.1 0-2 .89-2 1.99v10c0 1.1.9 1.99 2 1.99l11 .01c.67 0 1.27-.33 1.63-.84l4.37-6.16-4.37-6.16zm-1.63 11.16h-11v-10h11l3.55 5-3.55 5z"/></g><g id="label"><path d="M17.63 5.84c-.36-.51-.96-.84-1.63-.84l-11 .01c-1.1 0-2 .89-2 1.99v10c0 1.1.9 1.99 2 1.99l11 .01c.67 0 1.27-.33 1.63-.84l4.37-6.16-4.37-6.16z"/></g><g id="language"><path d="M11.99 2c-5.52 0-9.99 4.48-9.99 10s4.47 10 9.99 10c5.53 0 10.01-4.48 10.01-10s-4.48-10-10.01-10zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zm-6.92-3.96c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zm-7.74 9.96c-.16-.64-.26-1.31-.26-2s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2h-3.38zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8h-2.95c.96-1.66 2.49-2.93 4.33-3.56-.6 1.11-1.06 2.31-1.38 3.56zm3.97 11.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zm2.34-5.96h-4.68c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zm1.77-5.56c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"/></g><g id="launch"><path d="M19 19h-14v-14h7v-2h-7c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zm-5-16v2h3.59l-9.83 9.83 1.41 1.41 9.83-9.83v3.59h2v-7h-7z"/></g><g id="link"><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4v-1.9h-4c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9h-4c-1.71 0-3.1-1.39-3.1-3.1zm4.1 1h8v-2h-8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4v1.9h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"/></g><g id="list"><path d="M3 13h2v-2h-2v2zm0 4h2v-2h-2v2zm0-8h2v-2h-2v2zm4 4h14v-2h-14v2zm0 4h14v-2h-14v2zm0-10v2h14v-2h-14z"/></g><g id="lock-open"><path d="M12 17c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm6-9h-1v-2c0-2.76-2.24-5-5-5s-5 2.24-5 5h1.9c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2h-9.1c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-10c0-1.1-.9-2-2-2zm0 12h-12v-10h12v10z"/></g><g id="lock-outline"><path d="M18 8h-1v-2c0-2.76-2.24-5-5-5s-5 2.24-5 5v2h-1c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-10c0-1.1-.9-2-2-2zm-6-5.1c1.71 0 3.1 1.39 3.1 3.1v2h-6.1v-2h-.1c0-1.71 1.39-3.1 3.1-3.1zm6 17.1h-12v-10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"/></g><g id="lock"><path d="M18 8h-1v-2c0-2.76-2.24-5-5-5s-5 2.24-5 5v2h-1c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9h-6.2v-2c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></g><g id="loyalty"><path d="M21.41 11.58l-9-9c-.36-.36-.86-.58-1.41-.58h-7c-1.1 0-2 .9-2 2v7c0 .55.22 1.05.59 1.42l9 9c.36.36.86.58 1.41.58.55 0 1.05-.22 1.41-.59l7-7c.37-.36.59-.86.59-1.41 0-.55-.23-1.06-.59-1.42zm-15.91-4.58c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm11.77 8.27l-4.27 4.27-4.27-4.27c-.45-.46-.73-1.08-.73-1.77 0-1.38 1.12-2.5 2.5-2.5.69 0 1.32.28 1.77.74l.73.72.73-.73c.45-.45 1.08-.73 1.77-.73 1.38 0 2.5 1.12 2.5 2.5 0 .69-.28 1.32-.73 1.77z"/></g><g id="mail"><path d="M20 4h-16c-1.1 0-1.99.9-1.99 2l-.01 12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-12c0-1.1-.9-2-2-2zm0 4l-8 5-8-5v-2l8 5 8-5v2z"/></g><g id="markunread-mailbox"><path d="M20 6h-10v6h-2v-8h6v-4h-8v6h-2c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-12c0-1.1-.9-2-2-2z"/></g><g id="markunread"><path d="M20 4h-16c-1.1 0-1.99.9-1.99 2l-.01 12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-12c0-1.1-.9-2-2-2zm0 4l-8 5-8-5v-2l8 5 8-5v2z"/></g><g id="menu"><path d="M3 18h18v-2h-18v2zm0-5h18v-2h-18v2zm0-7v2h18v-2h-18z"/></g><g id="more-horiz"><path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/></g><g id="more-vert"><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/></g><g id="note-add"><path d="M14 2h-8c-1.1 0-1.99.9-1.99 2l-.01 16c0 1.1.89 2 1.99 2h12.01c1.1 0 2-.9 2-2v-12l-6-6zm2 14h-3v3h-2v-3h-3v-2h3v-3h2v3h3v2zm-3-7v-5.5l5.5 5.5h-5.5z"/></g><g id="open-in-browser"><path d="M19 4h-14c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h4v-2h-4v-10h14v10h-4v2h4c1.1 0 2-.9 2-2v-12c0-1.1-.89-2-2-2zm-7 6l-4 4h3v6h2v-6h3l-4-4z"/></g><g id="open-in-new"><path d="M19 19h-14v-14h7v-2h-7c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zm-5-16v2h3.59l-9.83 9.83 1.41 1.41 9.83-9.83v3.59h2v-7h-7z"/></g><g id="open-with"><path d="M10 9h4v-3h3l-5-5-5 5h3v3zm-1 1h-3v-3l-5 5 5 5v-3h3v-4zm14 2l-5-5v3h-3v4h3v3l5-5zm-9 3h-4v3h-3l5 5 5-5h-3v-3z"/></g><g id="pageview"><path d="M11 8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3zm8-5h-14c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm-1.41 16l-3.83-3.83c-.8.52-1.74.83-2.76.83-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5c0 1.02-.31 1.96-.83 2.75l3.83 3.84-1.41 1.41z"/></g><g id="payment"><path d="M20 4h-16c-1.11 0-1.99.89-1.99 2l-.01 12c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2v-12c0-1.11-.89-2-2-2zm0 14h-16v-6h16v6zm0-10h-16v-2h16v2z"/></g><g id="perm-camera-mic"><path d="M20 5h-3.17l-1.83-2h-6l-1.83 2h-3.17c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h7v-2.09c-2.83-.48-5-2.94-5-5.91h2c0 2.21 1.79 4 4 4s4-1.79 4-4h2c0 2.97-2.17 5.43-5 5.91v2.09h7c1.1 0 2-.9 2-2v-12c0-1.1-.9-2-2-2zm-6 8c0 1.1-.9 2-2 2s-2-.9-2-2v-4c0-1.1.9-2 2-2s2 .9 2 2v4z"/></g><g id="perm-contact-cal"><path d="M19 3h-1v-2h-2v2h-8v-2h-2v2h-1c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm-7 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm6 12h-12v-1c0-2 4-3.1 6-3.1s6 1.1 6 3.1v1z"/></g><g id="perm-data-setting"><path d="M18.99 11.5c.34 0 .67.03 1 .07l.01-11.57-20 20h11.56c-.04-.33-.07-.66-.07-1 0-4.14 3.36-7.5 7.5-7.5zm3.71 7.99c.02-.16.04-.32.04-.49 0-.17-.01-.33-.04-.49l1.06-.83c.09-.08.12-.21.06-.32l-1-1.73c-.06-.11-.19-.15-.31-.11l-1.24.5c-.26-.2-.54-.37-.85-.49l-.19-1.32c-.01-.12-.12-.21-.24-.21h-2c-.12 0-.23.09-.25.21l-.19 1.32c-.3.13-.59.29-.85.49l-1.24-.5c-.11-.04-.24 0-.31.11l-1 1.73c-.06.11-.04.24.06.32l1.06.83c-.02.16-.03.32-.03.49 0 .17.01.33.03.49l-1.06.83c-.09.08-.12.21-.06.32l1 1.73c.06.11.19.15.31.11l1.24-.5c.26.2.54.37.85.49l.19 1.32c.02.12.12.21.25.21h2c.12 0 .23-.09.25-.21l.19-1.32c.3-.13.59-.29.84-.49l1.25.5c.11.04.24 0 .31-.11l1-1.73c.06-.11.03-.24-.06-.32l-1.07-.83zm-3.71 1.01c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"/></g><g id="perm-device-info"><path d="M13 7h-2v2h2v-2zm0 4h-2v6h2v-6zm4-9.99l-10-.01c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2v-18c0-1.1-.9-1.99-2-1.99zm0 17.99h-10v-14h10v14z"/></g><g id="perm-identity"><path d="M12 5.9c1.16 0 2.1.94 2.1 2.1s-.94 2.1-2.1 2.1-2.1-.94-2.1-2.1.94-2.1 2.1-2.1m0 9c2.97 0 6.1 1.46 6.1 2.1v1.1h-12.2v-1.1c0-.64 3.13-2.1 6.1-2.1m0-10.9c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4z"/></g><g id="perm-media"><path d="M2 6h-2v5h.01l-.01 9c0 1.1.9 2 2 2h18v-2h-18v-14zm20-2h-8l-2-2h-6c-1.1 0-1.99.9-1.99 2l-.01 12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2v-10c0-1.1-.9-2-2-2zm-15 11l4.5-6 3.5 4.51 2.5-3.01 3.5 4.5h-14z"/></g><g id="perm-phone-msg"><path d="M20 15.5c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.58l2.2-2.21c.28-.27.36-.66.25-1.01-.37-1.12-.57-2.32-.57-3.57 0-.55-.45-1-1-1h-3.5c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1zm-8-12.5v10l3-3h6v-7h-9z"/></g><g id="perm-scan-wifi"><path d="M12 3c-5.05 0-8.85 1.85-12 4.23l12 14.77 12-14.75c-3.15-2.38-6.95-4.25-12-4.25zm1 13h-2v-6h2v6zm-2-8v-2h2v2h-2z"/></g><g id="picture-in-picture"><path d="M19 7h-8v6h8v-6zm2-4h-18c-1.1 0-2 .9-2 2v14c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98v-14c0-1.1-.9-2-2-2zm0 16.01h-18v-14.03h18v14.03z"/></g><g id="polymer"><path d="M19 4h-4l-7.89 12.63-2.61-4.63 4.5-8h-4l-4.5 8 4.5 8h4l7.89-12.63 2.61 4.63-4.5 8h4l4.5-8z"/></g><g id="print"><path d="M19 8h-14c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11h-8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9h-12v4h12v-4z"/></g><g id="query-builder"><path d="M11.99 2c-5.52 0-9.99 4.48-9.99 10s4.47 10 9.99 10c5.53 0 10.01-4.48 10.01-10s-4.48-10-10.01-10zm.01 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/><path d="M12.5 7h-1.5v6l5.25 3.15.75-1.23-4.5-2.67z"/></g><g id="question-answer"><path d="M21 6h-2v9h-13v2c0 .55.45 1 1 1h11l4 4v-15c0-.55-.45-1-1-1zm-4 6v-9c0-.55-.45-1-1-1h-13c-.55 0-1 .45-1 1v14l4-4h10c.55 0 1-.45 1-1z"/></g><g id="radio-button-off"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/></g><g id="radio-button-on"><path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/></g><g id="receipt"><path d="M18 17h-12v-2h12v2zm0-4h-12v-2h12v2zm0-4h-12v-2h12v2zm-15 13l1.5-1.5 1.5 1.5 1.5-1.5 1.5 1.5 1.5-1.5 1.5 1.5 1.5-1.5 1.5 1.5 1.5-1.5 1.5 1.5 1.5-1.5 1.5 1.5v-20l-1.5 1.5-1.5-1.5-1.5 1.5-1.5-1.5-1.5 1.5-1.5-1.5-1.5 1.5-1.5-1.5-1.5 1.5-1.5-1.5-1.5 1.5-1.5-1.5v20z"/></g><g id="redeem"><path d="M20 6h-2.18c.11-.31.18-.65.18-1 0-1.66-1.34-3-3-3-1.05 0-1.96.54-2.5 1.35l-.5.67-.5-.68c-.54-.8-1.45-1.34-2.5-1.34-1.66 0-3 1.34-3 3 0 .35.07.69.18 1h-2.18c-1.11 0-1.99.89-1.99 2l-.01 11c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2v-11c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm11 15h-16v-2h16v2zm0-5h-16v-6h5.08l-2.08 2.83 1.62 1.17 2.38-3.24 1-1.36 1 1.36 2.38 3.24 1.62-1.17-2.08-2.83h5.08v6z"/></g><g id="redo"><path d="M18.4 10.6c-1.85-1.61-4.25-2.6-6.9-2.6-4.65 0-8.58 3.03-9.96 7.22l2.36.78c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88l-3.62 3.62h9v-9l-3.6 3.6z"/></g><g id="refresh"><path d="M17.65 6.35c-1.45-1.45-3.44-2.35-5.65-2.35-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78l-3.22 3.22h7v-7l-2.35 2.35z"/></g><g id="remove-circle-outline"><path d="M7 11v2h10v-2h-10zm5-9c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"/></g><g id="remove-circle"><path d="M12 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm5 11h-10v-2h10v2z"/></g><g id="remove"><path d="M19 13h-14v-2h14v2z"/></g><g id="reorder"><path d="M3,15h18v-2H3V15z M3,19h18v-2H3V19z M3,11h18V9H3V11z M3,5v2h18V5H3z"/></g><g id="reply-all"><path d="M7 8v-3l-7 7 7 7v-3l-4-4 4-4zm6 1v-4l-7 7 7 7v-4.1c5 0 8.5 1.6 11 5.1-1-5-4-10-11-11z"/></g><g id="reply"><path d="M10 9v-4l-7 7 7 7v-4.1c5 0 8.5 1.6 11 5.1-1-5-4-10-11-11z"/></g><g id="report"><path d="M15.73 3h-7.46l-5.27 5.27v7.46l5.27 5.27h7.46l5.27-5.27v-7.46l-5.27-5.27zm-3.73 14.3c-.72 0-1.3-.58-1.3-1.3 0-.72.58-1.3 1.3-1.3.72 0 1.3.58 1.3 1.3 0 .72-.58 1.3-1.3 1.3zm1-4.3h-2v-6h2v6z"/></g><g id="report-problem"><path d="M1 21h22l-11-19-11 19zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/></g><g id="restore"><path d="M13 3c-4.97 0-9 4.03-9 9h-3l3.89 3.89.07.14 4.04-4.03h-3c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42c1.63 1.63 3.87 2.64 6.36 2.64 4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08v-4.25h-1.5z"/></g><g id="room"><path d="M12 2c-3.87 0-7 3.13-7 7 0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"/></g><g id="rotation-3d"><path d="M7.52 21.48c-3.27-1.54-5.61-4.72-5.97-8.48h-1.5c.51 6.16 5.66 11 11.95 11l.66-.03-3.81-3.81-1.33 1.32zm.89-6.52c-.19 0-.37-.03-.52-.08-.16-.06-.29-.13-.4-.24-.11-.1-.2-.22-.26-.37-.06-.14-.09-.3-.09-.47h-1.3c0 .36.07.68.21.95.14.27.33.5.56.69.24.18.51.32.82.41.3.1.62.15.96.15.37 0 .72-.05 1.03-.15.32-.1.6-.25.83-.44s.42-.43.55-.72c.13-.29.2-.61.2-.97 0-.19-.02-.38-.07-.56-.05-.18-.12-.35-.23-.51-.1-.16-.24-.3-.4-.43-.17-.13-.37-.23-.61-.31.2-.09.37-.2.52-.33.15-.13.27-.27.37-.42.1-.15.17-.3.22-.46.05-.16.07-.32.07-.48 0-.36-.06-.68-.18-.96-.12-.28-.29-.51-.51-.69-.2-.19-.47-.33-.77-.43-.31-.09-.65-.14-1.02-.14-.36 0-.69.05-1 .16-.3.11-.57.26-.79.45-.21.19-.38.41-.51.67-.12.26-.18.54-.18.85h1.3c0-.17.03-.32.09-.45s.14-.25.25-.34c.11-.09.23-.17.38-.22.15-.05.3-.08.48-.08.4 0 .7.1.89.31.19.2.29.49.29.86 0 .18-.03.34-.08.49-.05.15-.14.27-.25.37-.11.1-.25.18-.41.24-.16.06-.36.09-.58.09h-.77v1.03h.77c.22 0 .42.02.6.07s.33.13.45.23c.12.11.22.24.29.4.07.16.1.35.1.57 0 .41-.12.72-.35.93-.23.23-.55.33-.95.33zm8.55-5.92c-.32-.33-.7-.59-1.14-.77-.43-.18-.92-.27-1.46-.27h-2.36v8h2.3c.55 0 1.06-.09 1.51-.27.45-.18.84-.43 1.16-.76.32-.33.57-.73.74-1.19.17-.47.26-.99.26-1.57v-.4c0-.58-.09-1.1-.26-1.57-.18-.47-.43-.87-.75-1.2zm-.39 3.16c0 .42-.05.79-.14 1.13-.1.33-.24.62-.43.85-.19.23-.43.41-.71.53-.29.12-.62.18-.99.18h-.91v-5.77h.97c.72 0 1.27.23 1.64.69.38.46.57 1.12.57 1.99v.4zm-4.57-12.2l-.66.03 3.81 3.81 1.33-1.33c3.27 1.55 5.61 4.72 5.96 8.48h1.5c-.5-6.15-5.65-10.99-11.94-10.99z"/></g><g id="save"><path d="M17 3h-12c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-12l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10h-10v-4h10v4z"/></g><g id="schedule"><path fill-opacity=".9" d="M11.99 2c-5.52 0-9.99 4.48-9.99 10s4.47 10 9.99 10c5.53 0 10.01-4.48 10.01-10s-4.48-10-10.01-10zm.01 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"/><path fill-opacity=".9" d="M12.5 7h-1.5v6l5.25 3.15.75-1.23-4.5-2.67z"/></g><g id="search"><path d="M15.5 14h-.79l-.28-.27c.98-1.14 1.57-2.62 1.57-4.23 0-3.59-2.91-6.5-6.5-6.5s-6.5 2.91-6.5 6.5 2.91 6.5 6.5 6.5c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99 1.49-1.49-4.99-5zm-6 0c-2.49 0-4.5-2.01-4.5-4.5s2.01-4.5 4.5-4.5 4.5 2.01 4.5 4.5-2.01 4.5-4.5 4.5z"/></g><g id="select-all"><path d="M3 5h2v-2c-1.1 0-2 .9-2 2zm0 8h2v-2h-2v2zm4 8h2v-2h-2v2zm-4-12h2v-2h-2v2zm10-6h-2v2h2v-2zm6 0v2h2c0-1.1-.9-2-2-2zm-14 18v-2h-2c0 1.1.9 2 2 2zm-2-4h2v-2h-2v2zm6-14h-2v2h2v-2zm2 18h2v-2h-2v2zm8-8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2zm0-12h2v-2h-2v2zm0 8h2v-2h-2v2zm-4 4h2v-2h-2v2zm0-16h2v-2h-2v2zm-8 12h10v-10h-10v10zm2-8h6v6h-6v-6z"/></g><g id="send-money"><path d="M2 12c0-2.61 1.67-4.83 4-5.65v-2.09c-3.45.89-6 4.01-6 7.74s2.55 6.85 6 7.74v-2.09c-2.33-.82-4-3.04-4-5.65zm22 0l-4-4v3h-7v2h7v3l4-4zm-10 6c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.16.67 4.24 1.76l1.42-1.41c-1.45-1.45-3.45-2.35-5.66-2.35-4.42 0-8 3.58-8 8s3.58 8 8 8c2.21 0 4.21-.9 5.66-2.34l-1.42-1.41c-1.08 1.08-2.58 1.75-4.24 1.75z"/></g><g id="send"><path d="M2.01 21l20.99-9-20.99-9-.01 7 15 2-15 2z"/></g><g id="settings-applications"><path d="M12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm7-7h-14c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2v-14c0-1.1-.89-2-2-2zm-1.75 9c0 .23-.02.46-.05.68l1.48 1.16c.13.11.17.3.08.45l-1.4 2.42c-.09.15-.27.21-.43.15l-1.74-.7c-.36.28-.76.51-1.18.69l-.26 1.85c-.03.17-.18.3-.35.3h-2.8c-.17 0-.32-.13-.35-.29l-.26-1.85c-.43-.18-.82-.41-1.18-.69l-1.74.7c-.16.06-.34 0-.43-.15l-1.4-2.42c-.09-.15-.05-.34.08-.45l1.48-1.16c-.03-.23-.05-.46-.05-.69 0-.23.02-.46.05-.68l-1.48-1.16c-.13-.11-.17-.3-.08-.45l1.4-2.42c.09-.15.27-.21.43-.15l1.74.7c.36-.28.76-.51 1.18-.69l.26-1.85c.03-.17.18-.3.35-.3h2.8c.17 0 .32.13.35.29l.26 1.85c.43.18.82.41 1.18.69l1.74-.7c.16-.06.34 0 .43.15l1.4 2.42c.09.15.05.34-.08.45l-1.48 1.16c.03.23.05.46.05.69z"/></g><g id="settings-backup-restore"><path d="M14 12c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2zm-2-9c-4.97 0-9 4.03-9 9h-3l4 4 4-4h-3c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.51 0-2.91-.49-4.06-1.3l-1.42 1.44c1.52 1.16 3.42 1.86 5.48 1.86 4.97 0 9-4.03 9-9s-4.03-9-9-9z"/></g><g id="settings-bluetooth"><path d="M11 24h2v-2h-2v2zm-4 0h2v-2h-2v2zm8 0h2v-2h-2v2zm2.71-18.29l-5.71-5.71h-1v7.59l-4.59-4.59-1.41 1.41 5.59 5.59-5.59 5.59 1.41 1.41 4.59-4.59v7.59h1l5.71-5.71-4.3-4.29 4.3-4.29zm-4.71-1.88l1.88 1.88-1.88 1.88v-3.76zm1.88 10.46l-1.88 1.88v-3.76l1.88 1.88z"/></g><g id="settings-cell"><path d="M7 24h2v-2h-2v2zm4 0h2v-2h-2v2zm4 0h2v-2h-2v2zm1-23.99l-8-.01c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2v-16c0-1.1-.9-1.99-2-1.99zm0 15.99h-8v-12h8v12z"/></g><g id="settings-display"><path d="M21 3h-18c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm0 16.01h-18v-14.02h18v14.02zm-13-3.01h2.5l1.5 1.5 1.5-1.5h2.5v-2.5l1.5-1.5-1.5-1.5v-2.5h-2.5l-1.5-1.5-1.5 1.5h-2.5v2.5l-1.5 1.5 1.5 1.5v2.5zm4-7c1.66 0 3 1.34 3 3s-1.34 3-3 3v-6z"/></g><g id="settings-ethernet"><path d="M7.77 6.76l-1.54-1.28-5.41 6.52 5.41 6.52 1.54-1.28-4.35-5.24 4.35-5.24zm-.77 6.24h2v-2h-2v2zm10-2h-2v2h2v-2zm-6 2h2v-2h-2v2zm6.77-7.52l-1.54 1.28 4.35 5.24-4.35 5.24 1.54 1.28 5.41-6.52-5.41-6.52z"/></g><g id="settings-input-antenna"><path d="M12 5c-3.87 0-7 3.13-7 7h2c0-2.76 2.24-5 5-5s5 2.24 5 5h2c0-3.87-3.13-7-7-7zm1 9.29c.88-.39 1.5-1.26 1.5-2.29 0-1.38-1.12-2.5-2.5-2.5s-2.5 1.12-2.5 2.5c0 1.02.62 1.9 1.5 2.29v3.3l-3.41 3.41 1.41 1.41 3-3 3 3 1.41-1.41-3.41-3.41v-3.3zm-1-13.29c-6.07 0-11 4.93-11 11h2c0-4.97 4.03-9 9-9s9 4.03 9 9h2c0-6.07-4.93-11-11-11z"/></g><g id="settings-input-component"><path d="M5 2c0-.55-.45-1-1-1s-1 .45-1 1v4h-2v6h6v-6h-2v-4zm4 14c0 1.3.84 2.4 2 2.82v4.18h2v-4.18c1.16-.41 2-1.51 2-2.82v-2h-6v2zm-8 0c0 1.3.84 2.4 2 2.82v4.18h2v-4.18c1.16-.42 2-1.52 2-2.82v-2h-6v2zm20-10v-4c0-.55-.45-1-1-1s-1 .45-1 1v4h-2v6h6v-6h-2zm-8-4c0-.55-.45-1-1-1s-1 .45-1 1v4h-2v6h6v-6h-2v-4zm4 14c0 1.3.84 2.4 2 2.82v4.18h2v-4.18c1.16-.41 2-1.51 2-2.82v-2h-6v2z"/></g><g id="settings-input-composite"><path d="M5 2c0-.55-.45-1-1-1s-1 .45-1 1v4h-2v6h6v-6h-2v-4zm4 14c0 1.3.84 2.4 2 2.82v4.18h2v-4.18c1.16-.41 2-1.51 2-2.82v-2h-6v2zm-8 0c0 1.3.84 2.4 2 2.82v4.18h2v-4.18c1.16-.42 2-1.52 2-2.82v-2h-6v2zm20-10v-4c0-.55-.45-1-1-1s-1 .45-1 1v4h-2v6h6v-6h-2zm-8-4c0-.55-.45-1-1-1s-1 .45-1 1v4h-2v6h6v-6h-2v-4zm4 14c0 1.3.84 2.4 2 2.82v4.18h2v-4.18c1.16-.41 2-1.51 2-2.82v-2h-6v2z"/></g><g id="settings-input-hdmi"><path d="M18 7v-3c0-1.1-.9-2-2-2h-8c-1.1 0-2 .9-2 2v3h-1v6l3 6v3h8v-3l3-6v-6h-1zm-10-3h8v3h-2v-2h-1v2h-2v-2h-1v2h-2v-3z"/></g><g id="settings-input-svideo"><path d="M8 11.5c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5.67 1.5 1.5 1.5 1.5-.67 1.5-1.5zm7-5c0-.83-.67-1.5-1.5-1.5h-3c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5h3c.83 0 1.5-.67 1.5-1.5zm-6.5 8.5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm3.5-14c-6.07 0-11 4.93-11 11s4.93 11 11 11 11-4.93 11-11-4.93-11-11-11zm0 20c-4.96 0-9-4.04-9-9s4.04-9 9-9 9 4.04 9 9-4.04 9-9 9zm5.5-11c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm-2 5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5z"/></g><g id="settings-overscan"><path d="M12.01 5.5l-2.01 2.5h4l-1.99-2.5zm5.99 4.5v4l2.5-1.99-2.5-2.01zm-12 0l-2.5 2.01 2.5 1.99v-4zm8 6h-4l2.01 2.5 1.99-2.5zm7-13h-18c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm0 16.01h-18v-14.02h18v14.02z"/></g><g id="settings"><path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65c-.03-.24-.24-.42-.49-.42h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zm-7.43 2.52c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"/></g><g id="settings-phone"><path d="M13 9h-2v2h2v-2zm4 0h-2v2h2v-2zm3 6.5c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.58l2.2-2.21c.28-.27.36-.66.25-1.01-.37-1.12-.57-2.32-.57-3.57 0-.55-.45-1-1-1h-3.5c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1zm-1-6.5v2h2v-2h-2z"/></g><g id="settings-power"><path d="M7 24h2v-2h-2v2zm4 0h2v-2h-2v2zm2-22h-2v10h2v-10zm3.56 2.44l-1.45 1.45c1.73 1.05 2.89 2.94 2.89 5.11 0 3.31-2.69 6-6 6s-6-2.69-6-6c0-2.17 1.16-4.06 2.88-5.12l-1.44-1.44c-2.08 1.44-3.44 3.84-3.44 6.56 0 4.42 3.58 8 8 8s8-3.58 8-8c0-2.72-1.36-5.12-3.44-6.56zm-1.56 19.56h2v-2h-2v2z"/></g><g id="settings-remote"><path d="M15 9h-6c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-12c0-.55-.45-1-1-1zm-3 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm-4.95-8.95l1.41 1.41c.91-.9 2.16-1.46 3.54-1.46s2.63.56 3.54 1.46l1.41-1.41c-1.27-1.27-3.02-2.05-4.95-2.05s-3.68.78-4.95 2.05zm4.95-6.05c-3.04 0-5.79 1.23-7.78 3.22l1.41 1.41c1.63-1.62 3.88-2.63 6.37-2.63s4.74 1.01 6.36 2.64l1.41-1.41c-1.98-2-4.73-3.23-7.77-3.23z"/></g><g id="settings-voice"><path d="M7 24h2v-2h-2v2zm5-11c1.66 0 2.99-1.34 2.99-3l.01-6c0-1.66-1.34-3-3-3s-3 1.34-3 3v6c0 1.66 1.34 3 3 3zm-1 11h2v-2h-2v2zm4 0h2v-2h-2v2zm4-14h-1.7c0 3-2.54 5.1-5.3 5.1s-5.3-2.1-5.3-5.1h-1.7c0 3.41 2.72 6.23 6 6.72v3.28h2v-3.28c3.28-.49 6-3.31 6-6.72z"/></g><g id="shop"><path d="M16 6v-2c0-1.11-.89-2-2-2h-4c-1.11 0-2 .89-2 2v2h-6v13c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2v-13h-6zm-6-2h4v2h-4v-2zm-1 14v-9l7.5 4-7.5 5z"/></g><g id="shopping-basket"><path d="M17.21 9l-4.38-6.56c-.19-.28-.51-.42-.83-.42-.32 0-.64.14-.83.43l-4.38 6.55h-4.79c-.55 0-1 .45-1 1 0 .09.01.18.04.27l2.54 9.27c.23.84 1 1.46 1.92 1.46h13c.92 0 1.69-.62 1.93-1.46l2.54-9.27.03-.27c0-.55-.45-1-1-1h-4.79zm-8.21 0l3-4.4 3 4.4h-6zm3 8c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"/></g><g id="shopping-cart"><path d="M7 18c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2zm-6-16v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2h-11.58c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.08-.14.12-.31.12-.48 0-.55-.45-1-1-1h-14.79l-.94-2h-3.27zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"/></g><g id="shop-two"><path d="M3 9h-2v11c0 1.11.89 2 2 2h14c1.11 0 2-.89 2-2h-16v-11zm15-4v-2c0-1.11-.89-2-2-2h-4c-1.11 0-2 .89-2 2v2h-5v11c0 1.11.89 2 2 2h14c1.11 0 2-.89 2-2v-11h-5zm-6-2h4v2h-4v-2zm0 12v-7l5.5 3-5.5 4z"/></g><g id="sort"><path d="M3 18h6v-2h-6v2zm0-12v2h18v-2h-18zm0 7h12v-2h-12v2z"/></g><g id="speaker-notes"><path d="M20 2h-16c-1.1 0-1.99.9-1.99 2l-.01 18 4-4h14c1.1 0 2-.9 2-2v-12c0-1.1-.9-2-2-2zm-12 12h-2v-2h2v2zm0-3h-2v-2h2v2zm0-3h-2v-2h2v2zm7 6h-5v-2h5v2zm3-3h-8v-2h8v2zm0-3h-8v-2h8v2z"/></g><g id="spellcheck"><path d="M12.45 16h2.09l-5.11-13h-1.86l-5.11 13h2.09l1.12-3h5.64l1.14 3zm-6.02-5l2.07-5.52 2.07 5.52h-4.14zm15.16.59l-8.09 8.09-3.67-3.68-1.41 1.41 5.09 5.09 9.49-9.5-1.41-1.41z"/></g><g id="star-half"><path d="M22 9.74l-7.19-.62L12 2.5 9.19 9.13 2 9.74l5.46 4.73-1.64 7.03L12 17.77l6.18 3.73-1.63-7.03L22 9.74zM12 15.9V6.6l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.9z"/></g><g id="star-outline"><path d="M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"/></g><g id="star"><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"/></g><g id="star-rate"><path d="M12 14.3l3.71 2.7-1.42-4.36 3.71-2.64h-4.55l-1.45-4.5-1.45 4.5h-4.55l3.71 2.64-1.42 4.36z"/></g><g id="stars"><path d="M11.99 2c-5.52 0-9.99 4.48-9.99 10s4.47 10 9.99 10c5.53 0 10.01-4.48 10.01-10s-4.48-10-10.01-10zm4.24 16l-4.23-2.55-4.23 2.55 1.12-4.81-3.73-3.23 4.92-.42 1.92-4.54 1.92 4.53 4.92.42-3.73 3.23 1.12 4.82z"/></g><g id="store"><path d="M20 4h-16v2h16v-2zm1 10v-2l-1-5h-16l-1 5v2h1v6h10v-6h4v6h2v-6h1zm-9 4h-6v-4h6v4z"/></g><g id="subject"><path d="M14 17h-10v2h10v-2zm6-8h-16v2h16v-2zm-16 6h16v-2h-16v2zm0-10v2h16v-2h-16z"/></g><g id="supervisor-account"><circle cx="12" cy="13.49" r="1.5"/><path d="M12 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm0 2.5c1.24 0 2.25 1.01 2.25 2.25s-1.01 2.25-2.25 2.25-2.25-1.01-2.25-2.25 1.01-2.25 2.25-2.25zm5 10.56v2.5c-.45.41-.96.77-1.5 1.05v-.68c0-.34-.17-.65-.46-.92-.65-.62-1.89-1.02-3.04-1.02-.96 0-1.96.28-2.65.73l-.17.12-.21.17c.78.47 1.63.72 2.54.82l1.33.15c.37.04.66.36.66.75 0 .29-.16.53-.4.66-.28.15-.64.09-.95.09-.35 0-.69-.01-1.03-.05-.5-.06-.99-.17-1.46-.33-.49-.16-.97-.38-1.42-.64-.22-.13-.44-.27-.65-.43l-.31-.24c-.04-.02-.28-.18-.28-.23v-4.28c0-1.58 2.63-2.78 5-2.78s5 1.2 5 2.78v1.78z"/></g><g id="swap-horiz"><path d="M6.99 11l-3.99 4 3.99 4v-3h7.01v-2h-7.01v-3zm14.01-2l-3.99-4v3h-7.01v2h7.01v3l3.99-4z"/></g><g id="swap-vert-circle"><path d="M12 2c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10-4.48-10-10-10zm-5.5 7l3.5-3.5 3.5 3.5h-2.5v4h-2v-4h-2.5zm11 6l-3.5 3.5-3.5-3.5h2.5v-4h2v4h2.5z"/></g><g id="swap-vert"><path d="M16 17.01v-7.01h-2v7.01h-3l4 3.99 4-3.99h-3zm-7-14.01l-4 3.99h3v7.01h2v-7.01h3l-4-3.99z"/></g><g id="system-update-tv"><path d="M12 16.5l4-4h-3v-9h-2v9h-3l4 4zm9-13h-6v1.99h6v14.03h-18v-14.03h6v-1.99h-6c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2z"/></g><g id="tab"><path d="M21 3h-18c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm0 16h-18v-14h10v4h8v10z"/></g><g id="tab-unselected"><path d="M1 9h2v-2h-2v2zm0 4h2v-2h-2v2zm0-8h2v-2c-1.1 0-2 .9-2 2zm8 16h2v-2h-2v2zm-8-4h2v-2h-2v2zm2 4v-2h-2c0 1.1.9 2 2 2zm18-18h-8v6h10v-4c0-1.1-.9-2-2-2zm0 14h2v-2h-2v2zm-12-12h2v-2h-2v2zm-4 16h2v-2h-2v2zm0-16h2v-2h-2v2zm16 16c1.1 0 2-.9 2-2h-2v2zm0-8h2v-2h-2v2zm-8 8h2v-2h-2v2zm4 0h2v-2h-2v2z"/></g><g id="text-format"><path d="M5 17v2h14v-2h-14zm4.5-4.2h5l.9 2.2h2.1l-4.75-11h-1.5l-4.75 11h2.1l.9-2.2zm2.5-6.82l1.87 5.02h-3.74l1.87-5.02z"/></g><g id="theaters"><path d="M18 3v2h-2v-2h-8v2h-2v-2h-2v18h2v-2h2v2h8v-2h2v2h2v-18h-2zm-10 14h-2v-2h2v2zm0-4h-2v-2h2v2zm0-4h-2v-2h2v2zm10 8h-2v-2h2v2zm0-4h-2v-2h2v2zm0-4h-2v-2h2v2z"/></g><g id="thumb-down"><path d="M15 3h-9c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v1.91l.01.01-.01.08c0 1.1.9 2 2 2h6.31l-.95 4.57-.03.32c0 .41.17.79.44 1.06l1.06 1.05 6.59-6.59c.36-.36.58-.86.58-1.41v-10c0-1.1-.9-2-2-2zm4 0v12h4v-12h-4z"/></g><g id="thumbs-up-down"><path d="M12 6c0-.55-.45-1-1-1h-5.18l.66-3.18.02-.23c0-.31-.13-.59-.33-.8l-.79-.79-4.94 4.94c-.27.27-.44.65-.44 1.06v6.5c0 .83.67 1.5 1.5 1.5h6.75c.62 0 1.15-.38 1.38-.91l2.26-5.29c.07-.17.11-.36.11-.55v-1.25zm10.5 4h-6.75c-.62 0-1.15.38-1.38.91l-2.26 5.29c-.07.17-.11.36-.11.55v1.25c0 .55.45 1 1 1h5.18l-.66 3.18-.02.24c0 .31.13.59.33.8l.79.78 4.94-4.94c.27-.27.44-.65.44-1.06v-6.5c0-.83-.67-1.5-1.5-1.5z"/></g><g id="thumb-up"><path d="M1 21h4v-12h-4v12zm22-11c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06l-1.06-1.05-6.58 6.59c-.37.36-.59.86-.59 1.41v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-1.91l-.01-.01.01-.08z"/></g><g id="toc"><path d="M3 9h14v-2h-14v2zm0 4h14v-2h-14v2zm0 4h14v-2h-14v2zm16 0h2v-2h-2v2zm0-10v2h2v-2h-2zm0 6h2v-2h-2v2z"/></g><g id="today"><path d="M19 3h-1v-2h-2v2h-8v-2h-2v2h-1c-1.11 0-1.99.9-1.99 2l-.01 14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2zm0 16h-14v-11h14v11zm-12-9h5v5h-5z"/></g><g id="track-changes"><path d="M19.07 4.93l-1.41 1.41c1.44 1.45 2.34 3.45 2.34 5.66 0 4.42-3.58 8-8 8s-8-3.58-8-8c0-4.08 3.05-7.44 7-7.93v2.02c-2.84.48-5 2.94-5 5.91 0 3.31 2.69 6 6 6s6-2.69 6-6c0-1.66-.67-3.16-1.76-4.24l-1.41 1.41c.72.73 1.17 1.73 1.17 2.83 0 2.21-1.79 4-4 4s-4-1.79-4-4c0-1.86 1.28-3.41 3-3.86v2.14c-.6.35-1 .98-1 1.72 0 1.1.9 2 2 2s2-.9 2-2c0-.74-.4-1.38-1-1.72v-8.28h-1c-5.52 0-10 4.48-10 10s4.48 10 10 10 10-4.48 10-10c0-2.76-1.12-5.26-2.93-7.07z"/></g><g id="translate"><path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53h2.93v-2h-7v-2h-2v2h-7v1.99h11.17c-.67 1.93-1.73 3.76-3.17 5.36-.93-1.03-1.7-2.16-2.31-3.35h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02 1.42 1.42 5-5 3.11 3.11.76-2.04zm5.63-5.07h-2l-4.5 12h2l1.12-3h4.75l1.13 3h2l-4.5-12zm-2.62 7l1.62-4.33 1.62 4.33h-3.24z"/></g><g id="trending-down"><path d="M16 18l2.29-2.29-4.88-4.88-4 4-7.41-7.42 1.41-1.41 6 6 4-4 6.3 6.29 2.29-2.29v6z"/></g><g id="trending-neutral"><path d="M22 12l-4-4v3h-15v2h15v3z"/></g><g id="trending-up"><path d="M16 6l2.29 2.29-4.88 4.88-4-4-7.41 7.42 1.41 1.41 6-6 4 4 6.3-6.29 2.29 2.29v-6z"/></g><g id="turned-in-not"><path d="M17 3h-10c-1.1 0-1.99.9-1.99 2l-.01 16 7-3 7 3v-16c0-1.1-.9-2-2-2zm0 15l-5-2.18-5 2.18v-13h10v13z"/></g><g id="turned-in"><path d="M17 3h-10c-1.1 0-1.99.9-1.99 2l-.01 16 7-3 7 3v-16c0-1.1-.9-2-2-2z"/></g><g id="undo"><path d="M12.5 8c-2.65 0-5.05.99-6.9 2.6l-3.6-3.6v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78c-1.39-4.19-5.32-7.22-9.97-7.22z"/></g><g id="unfold-less"><path d="M7.41 18.59l1.42 1.41 3.17-3.17 3.17 3.17 1.41-1.41-4.58-4.59-4.59 4.59zm9.18-13.18l-1.42-1.41-3.17 3.17-3.17-3.17-1.42 1.41 4.59 4.59 4.59-4.59z"/></g><g id="unfold-more"><path d="M12 5.83l3.17 3.17 1.41-1.41-4.58-4.59-4.59 4.59 1.42 1.41 3.17-3.17zm0 12.34l-3.17-3.17-1.41 1.41 4.58 4.59 4.59-4.59-1.42-1.41-3.17 3.17z"/></g><g id="verified-user"><path d="M12 1l-9 4v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12v-6l-9-4zm-2 16l-4-4 1.41-1.41 2.59 2.58 6.59-6.59 1.41 1.42-8 8z"/></g><g id="view-agenda"><path d="M20 13h-17c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h17c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1zm0-10h-17c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h17c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1z"/></g><g id="view-array"><path d="M4 18h3v-13h-3v13zm14-13v13h3v-13h-3zm-10 13h9v-13h-9v13z"/></g><g id="view-carousel"><path d="M7 19h10v-15h-10v15zm-5-2h4v-11h-4v11zm16-11v11h4v-11h-4z"/></g><g id="view-column"><path d="M10 18h5v-13h-5v13zm-6 0h5v-13h-5v13zm12-13v13h5v-13h-5z"/></g><g id="view-day"><path d="M2 21h19v-3h-19v3zm18-13h-17c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h17c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1zm-18-5v3h19v-3h-19z"/></g><g id="view-headline"><path d="M4 15h17v-2h-17v2zm0 4h17v-2h-17v2zm0-8h17v-2h-17v2zm0-6v2h17v-2h-17z"/></g><g id="view-list"><path d="M4 14h4v-4h-4v4zm0 5h4v-4h-4v4zm0-10h4v-4h-4v4zm5 5h12v-4h-12v4zm0 5h12v-4h-12v4zm0-14v4h12v-4h-12z"/></g><g id="view-module"><path d="M4 11h5v-6h-5v6zm0 7h5v-6h-5v6zm6 0h5v-6h-5v6zm6 0h5v-6h-5v6zm-6-7h5v-6h-5v6zm6-6v6h5v-6h-5z"/></g><g id="view-quilt"><path d="M10 18h5v-6h-5v6zm-6 0h5v-13h-5v13zm12 0h5v-6h-5v6zm-6-13v6h11v-6h-11z"/></g><g id="view-stream"><path d="M4 18h17v-6h-17v6zm0-13v6h17v-6h-17z"/></g><g id="view-week"><path d="M6 5h-3c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-12c0-.55-.45-1-1-1zm14 0h-3c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-12c0-.55-.45-1-1-1zm-7 0h-3c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-12c0-.55-.45-1-1-1z"/></g><g id="visibility-off"><path d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16c.57-.23 1.18-.36 1.83-.36zm-10-2.73l2.28 2.28.46.46c-1.66 1.29-2.96 3.01-3.74 4.99 1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42 2.93 2.92 1.27-1.27-17.73-17.73-1.27 1.27zm5.53 5.53l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></g><g id="visibility"><path d="M12 4.5c-5 0-9.27 3.11-11 7.5 1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zm0 12.5c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></g><g id="wallet-giftcard"><path d="M20 6h-2.18c.11-.31.18-.65.18-1 0-1.66-1.34-3-3-3-1.05 0-1.96.54-2.5 1.35l-.5.67-.5-.68c-.54-.8-1.45-1.34-2.5-1.34-1.66 0-3 1.34-3 3 0 .35.07.69.18 1h-2.18c-1.11 0-1.99.89-1.99 2l-.01 11c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2v-11c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm-6 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm11 15h-16v-2h16v2zm0-5h-16v-6h5.08l-2.08 2.83 1.62 1.17 2.38-3.24 1-1.36 1 1.36 2.38 3.24 1.62-1.17-2.08-2.83h5.08v6z"/></g><g id="wallet-membership"><path d="M20 2h-16c-1.11 0-2 .89-2 2v11c0 1.11.89 2 2 2h4v5l4-2 4 2v-5h4c1.11 0 2-.89 2-2v-11c0-1.11-.89-2-2-2zm0 13h-16v-2h16v2zm0-5h-16v-6h16v6z"/></g><g id="wallet-travel"><path d="M20 6h-3v-2c0-1.11-.89-2-2-2h-6c-1.11 0-2 .89-2 2v2h-3c-1.11 0-2 .89-2 2v11c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2v-11c0-1.11-.89-2-2-2zm-11-2h6v2h-6v-2zm11 15h-16v-2h16v2zm0-5h-16v-6h3v2h2v-2h6v2h2v-2h3v6z"/></g><g id="warning"><path d="M1 21h22l-11-19-11 19zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"/></g><g id="work"><path d="M24 0v24h-24v-24h24m1-1h-26v26h26v-26z"/><path d="M20 6h-4v-2c0-1.11-.89-2-2-2h-4c-1.11 0-2 .89-2 2v2h-4c-1.11 0-1.99.89-1.99 2l-.01 11c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2v-11c0-1.11-.89-2-2-2zm-6 0h-4v-2h4v2z"/></g></defs></svg></core-iconset-svg><polymer-element name="core-icon-button" attributes="src icon active" assetpath="../core-icon-button/"><template><style>:host{display:inline-block;box-sizing:border-box;-moz-box-sizing:border-box;user-select:none;-moz-user-select:none;-webkit-user-select:none;border-radius:2px;padding:7px;margin:2px;vertical-align:middle;font-size:1rem;cursor:pointer}:host([disabled]){opacity:.6;pointer-events:none}:host(.outline){box-shadow:0 0 0 1px rgba(0,0,0,.1)}:host(:hover:not([disabled])){box-shadow:0 1px 0 0 rgba(0,0,0,.12),0 0 0 1px rgba(0,0,0,.1)}:host(.selected:not([disabled])){background-color:rgba(0,0,0,.05);box-shadow:inset 0 1px 0 0 rgba(0,0,0,.05),0 0 0 1px rgba(0,0,0,.12)}:host(:active:not([disabled]),.selected:active:not([disabled])){background-color:rgba(0,0,0,.05);box-shadow:inset 0 1px 0 0 rgba(0,0,0,.1),0 0 0 1px rgba(0,0,0,.12)}:host(.core-dark-theme.outline){background-color:rgba(200,200,200,.05);box-shadow:0 0 0 1px rgba(200,200,200,.1)}:host(.core-dark-theme:hover){background-color:rgba(200,200,200,.05);box-shadow:0 1px 0 0 rgba(200,200,200,.12),0 0 0 1px rgba(200,200,200,.1)}:host(.core-dark-theme.selected){background-color:rgba(220,220,220,.05);box-shadow:inset 0 1px 0 0 rgba(200,200,200,.05),0 0 0 1px rgba(200,200,200,.12)}:host(.core-dark-theme:active,.core-dark-theme.selected:active){background-color:rgba(200,200,200,.05);box-shadow:inset 0 1px 0 0 rgba(200,200,200,.1),0 0 0 1px rgba(200,200,200,.12)}core-icon{pointer-events:none}:host ::content>:not(core-icon){margin-left:4px}</style><core-icon src="{{src}}" icon="{{icon}}"></core-icon><content></content></template><script>Polymer("core-icon-button",{src:"",active:false,icon:"",activeChanged:function(){this.classList.toggle("selected",this.active)}});</script></polymer-element><polymer-element name="core-toolbar" attributes="justify middleJustify bottomJustify" assetpath="../core-toolbar/"><template><style>:host{display:block;position:relative;box-sizing:border-box;-moz-box-sizing:border-box;height:64px;font-size:1.3em;background-color:#CFD8DC}:host(.animate){transition:height .18s ease-in}:host(.medium-tall){height:128px}:host(.tall){height:192px}.toolbar-tools{position:relative;height:64px;padding:0 8px;pointer-events:none}:host(.core-narrow),:host-context(.core-narrow){height:56px}polyfill-next-selector{content:':host.core-narrow.medium-tall, .core-narrow :host.medium-tall'}:host(.core-narrow.medium-tall),:host-context(.core-narrow):host(.medium-tall){height:112px}polyfill-next-selector{content:':host.core-narrow.tall, .core-narrow :host.tall'}:host(.core-narrow.tall),:host-context(.core-narrow):host(.tall){height:168px}polyfill-next-selector{content:':host.core-narrow .toolbar-tools, .core-narrow :host .toolbar-tools'}:host(.core-narrow) .toolbar-tools,:host-context(.core-narrow) .toolbar-tools{height:56px;padding:0}#middleBar{position:absolute;top:0;right:0;left:0}:host(.tall,.medium-tall) #middleBar{-webkit-transform:translateY(100%);transform:translateY(100%)}#bottomBar{position:absolute;right:0;bottom:0;left:0}polyfill-next-selector{content:'.toolbar-tools > *'}::content>*{pointer-events:auto}polyfill-next-selector{content:'.toolbar-tools > *'}::content>*{margin:0 8px}polyfill-next-selector{content:'.toolbar-tools > .fit'}::content>.fit{position:absolute;top:auto;right:0;bottom:0;left:0;width:auto;margin:0}polyfill-next-selector{content:':host .indent'}::content>.indent{margin-left:60px}</style><div id="bottomBar" class="toolbar-tools" center="" horizontal="" layout=""><content select=".bottom"></content></div><div id="middleBar" class="toolbar-tools" center="" horizontal="" layout=""><content select=".middle"></content></div><div id="topBar" class="toolbar-tools" center="" horizontal="" layout=""><content></content></div></template><script>(function(){Polymer("core-toolbar",{justify:"",middleJustify:"",bottomJustify:"",justifyChanged:function(old){this.updateBarJustify(this.$.topBar,this.justify,old)},middleJustifyChanged:function(old){this.updateBarJustify(this.$.middleBar,this.middleJustify,old)},bottomJustifyChanged:function(old){this.updateBarJustify(this.$.bottomBar,this.bottomJustify,old)},updateBarJustify:function(bar,justify,old){if(old){bar.removeAttribute(this.toLayoutAttrName(old))}if(this.justify){bar.setAttribute(this.toLayoutAttrName(justify),"")}},toLayoutAttrName:function(value){return value==="between"?"justified":value+"-justified"}})})();</script></polymer-element><polymer-element name="core-header-panel" assetpath="../core-header-panel/"><template><style>:host{display:block;position:relative}#outerContainer{position:absolute;top:0;right:0;bottom:0;left:0}#mainPanel{position:relative}#mainContainer{position:relative;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch}#dropShadow{position:absolute;top:0;left:0;right:0;height:6px;box-shadow:inset 0 5px 6px -3px rgba(0,0,0,.4)}#dropShadow.hidden{display:none}:host([mode=scroll]) #mainContainer{overflow:visible}:host([mode=scroll]) #outerContainer{overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch}:host([mode=cover]) #mainPanel{position:static}:host([mode=cover]) #mainContainer{position:absolute;top:0;right:0;bottom:0;left:0}:host([mode=cover]) #dropShadow{position:static;width:100%}</style><div id="outerContainer" vertical="" layout=""><content id="headerContent" select="core-toolbar, .core-header"></content><div id="mainPanel" flex="" vertical="" layout=""><div id="mainContainer" flex?="{{mode !== 'cover'}}"><content id="mainContent" select="*"></content></div><div id="dropShadow"></div></div></div></template><script>Polymer("core-header-panel",{publish:{mode:{value:"",reflect:true},tallClass:"tall",shadow:false},animateDuration:200,modeConfigs:{shadowMode:{waterfall:1,"waterfall-tall":1},noShadow:{seamed:1,cover:1,scroll:1},tallMode:{"waterfall-tall":1},outerScroll:{scroll:1}},ready:function(){this.scrollHandler=this.scroll.bind(this);this.addListener()},detached:function(){this.removeListener(this.mode)},addListener:function(){this.scroller.addEventListener("scroll",this.scrollHandler)},removeListener:function(mode){var s=this.getScrollerForMode(mode);s.removeEventListener("scroll",this.scrollHandler)},domReady:function(){this.async("scroll")},modeChanged:function(old){var header=this.header;if(header){var configs=this.modeConfigs;if(configs.tallMode[old]&&!configs.tallMode[this.mode]){header.classList.remove(this.tallClass);this.async(function(){header.classList.remove("animate")},null,this.animateDuration)}else{header.classList.toggle("animate",configs.tallMode[this.mode])}}if(configs&&(configs.outerScroll[this.mode]||configs.outerScroll[old])){this.removeListener(old);this.addListener()}this.scroll()},get header(){return this.$.headerContent.getDistributedNodes()[0]},getScrollerForMode:function(mode){return this.modeConfigs.outerScroll[mode]?this.$.outerContainer:this.$.mainContainer},get scroller(){return this.getScrollerForMode(this.mode)},scroll:function(){var configs=this.modeConfigs;var main=this.$.mainContainer;var header=this.header;var sTop=main.scrollTop;var atTop=sTop===0;this.$.dropShadow.classList.toggle("hidden",!this.shadow&&(atTop&&configs.shadowMode[this.mode]||configs.noShadow[this.mode]));if(header&&configs.tallMode[this.mode]){header.classList.toggle(this.tallClass,atTop||header.classList.contains(this.tallClass)&&main.scrollHeight<this.$.outerContainer.offsetHeight)}this.fire("scroll",{target:this.scroller},this,false)}});</script></polymer-element><script>(function(){var block={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:noop,hr:/^( *[-*_]){3,} *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *#* *(?:\n+|$)/,nptable:noop,lheading:/^([^\n]+)\n *(=|-){2,} *(?:\n+|$)/,blockquote:/^( *>[^\n]+(\n(?!def)[^\n]+)*\n*)+/,list:/^( *)(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:/^ *(?:comment|closed|closing) *(?:\n{2,}|\s*$)/,def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +["(]([^\n]+)[")])? *(?:\n+|$)/,table:noop,paragraph:/^((?:[^\n]+\n?(?!hr|heading|lheading|blockquote|tag|def))+)\n*/,text:/^[^\n]+/};block.bullet=/(?:[*+-]|\d+\.)/;block.item=/^( *)(bull) [^\n]*(?:\n(?!\1bull )[^\n]*)*/;block.item=replace(block.item,"gm")(/bull/g,block.bullet)();block.list=replace(block.list)(/bull/g,block.bullet)("hr","\\n+(?=\\1?(?:[-*_] *){3,}(?:\\n+|$))")("def","\\n+(?="+block.def.source+")")();block.blockquote=replace(block.blockquote)("def",block.def)();block._tag="(?!(?:"+"a|em|strong|small|s|cite|q|dfn|abbr|data|time|code"+"|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo"+"|span|br|wbr|ins|del|img)\\b)\\w+(?!:/|[^\\w\\s@]*@)\\b";block.html=replace(block.html)("comment",/<!--[\s\S]*?-->/)("closed",/<(tag)[\s\S]+?<\/\1>/)("closing",/<tag(?:"[^"]*"|'[^']*'|[^'">])*?>/)(/tag/g,block._tag)();block.paragraph=replace(block.paragraph)("hr",block.hr)("heading",block.heading)("lheading",block.lheading)("blockquote",block.blockquote)("tag","<"+block._tag)("def",block.def)();block.normal=merge({},block);block.gfm=merge({},block.normal,{fences:/^ *(`{3,}|~{3,}) *(\S+)? *\n([\s\S]+?)\s*\1 *(?:\n+|$)/,paragraph:/^/});block.gfm.paragraph=replace(block.paragraph)("(?!","(?!"+block.gfm.fences.source.replace("\\1","\\2")+"|"+block.list.source.replace("\\1","\\3")+"|")();block.tables=merge({},block.gfm,{nptable:/^ *(\S.*\|.*)\n *([-:]+ *\|[-| :]*)\n((?:.*\|.*(?:\n|$))*)\n*/,table:/^ *\|(.+)\n *\|( *[-:]+[-| :]*)\n((?: *\|.*(?:\n|$))*)\n*/});function Lexer(options){this.tokens=[];this.tokens.links={};this.options=options||marked.defaults;this.rules=block.normal;if(this.options.gfm){if(this.options.tables){this.rules=block.tables}else{this.rules=block.gfm}}}Lexer.rules=block;Lexer.lex=function(src,options){var lexer=new Lexer(options);return lexer.lex(src)};Lexer.prototype.lex=function(src){src=src.replace(/\r\n|\r/g,"\n").replace(/\t/g," ").replace(/\u00a0/g," ").replace(/\u2424/g,"\n");return this.token(src,true)};Lexer.prototype.token=function(src,top,bq){var src=src.replace(/^ +$/gm,""),next,loose,cap,bull,b,item,space,i,l;while(src){if(cap=this.rules.newline.exec(src)){src=src.substring(cap[0].length);if(cap[0].length>1){this.tokens.push({type:"space"})}}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);cap=cap[0].replace(/^ {4}/gm,"");this.tokens.push({type:"code",text:!this.options.pedantic?cap.replace(/\n+$/,""):cap});continue}if(cap=this.rules.fences.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"code",lang:cap[2],text:cap[3]});continue}if(cap=this.rules.heading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[1].length,text:cap[2]});continue}if(top&&(cap=this.rules.nptable.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/\n$/,"").split("\n")};for(i=0;i<item.align.length;i++){if(/^ *-+: *$/.test(item.align[i])){item.align[i]="right"}else if(/^ *:-+: *$/.test(item.align[i])){item.align[i]="center"}else if(/^ *:-+ *$/.test(item.align[i])){item.align[i]="left"}else{item.align[i]=null}}for(i=0;i<item.cells.length;i++){item.cells[i]=item.cells[i].split(/ *\| */)}this.tokens.push(item);continue}if(cap=this.rules.lheading.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"heading",depth:cap[2]==="="?1:2,text:cap[1]});continue}if(cap=this.rules.hr.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"hr"});continue}if(cap=this.rules.blockquote.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"blockquote_start"});cap=cap[0].replace(/^ *> ?/gm,"");this.token(cap,top,true);this.tokens.push({type:"blockquote_end"});continue}if(cap=this.rules.list.exec(src)){src=src.substring(cap[0].length);bull=cap[2];this.tokens.push({type:"list_start",ordered:bull.length>1});cap=cap[0].match(this.rules.item);next=false;l=cap.length;i=0;for(;i<l;i++){item=cap[i];space=item.length;item=item.replace(/^ *([*+-]|\d+\.) +/,"");if(~item.indexOf("\n ")){space-=item.length;item=!this.options.pedantic?item.replace(new RegExp("^ {1,"+space+"}","gm"),""):item.replace(/^ {1,4}/gm,"")}if(this.options.smartLists&&i!==l-1){b=block.bullet.exec(cap[i+1])[0];if(bull!==b&&!(bull.length>1&&b.length>1)){src=cap.slice(i+1).join("\n")+src;i=l-1}}loose=next||/\n\n(?!\s*$)/.test(item);if(i!==l-1){next=item.charAt(item.length-1)==="\n";if(!loose)loose=next}this.tokens.push({type:loose?"loose_item_start":"list_item_start"});this.token(item,false,bq);this.tokens.push({type:"list_item_end"})}this.tokens.push({type:"list_end"});continue}if(cap=this.rules.html.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:this.options.sanitize?"paragraph":"html",pre:cap[1]==="pre"||cap[1]==="script"||cap[1]==="style",text:cap[0]});continue}if(!bq&&top&&(cap=this.rules.def.exec(src))){src=src.substring(cap[0].length);this.tokens.links[cap[1].toLowerCase()]={href:cap[2],title:cap[3]};continue}if(top&&(cap=this.rules.table.exec(src))){src=src.substring(cap[0].length);item={type:"table",header:cap[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:cap[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:cap[3].replace(/(?: *\| *)?\n$/,"").split("\n")};for(i=0;i<item.align.length;i++){if(/^ *-+: *$/.test(item.align[i])){item.align[i]="right"}else if(/^ *:-+: *$/.test(item.align[i])){item.align[i]="center"}else if(/^ *:-+ *$/.test(item.align[i])){item.align[i]="left"}else{item.align[i]=null}}for(i=0;i<item.cells.length;i++){item.cells[i]=item.cells[i].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */)}this.tokens.push(item);continue}if(top&&(cap=this.rules.paragraph.exec(src))){src=src.substring(cap[0].length);this.tokens.push({type:"paragraph",text:cap[1].charAt(cap[1].length-1)==="\n"?cap[1].slice(0,-1):cap[1]});continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);this.tokens.push({type:"text",text:cap[0]});continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return this.tokens};var inline={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:noop,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:__|[\s\S])+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:noop,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};inline._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/;inline._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/;inline.link=replace(inline.link)("inside",inline._inside)("href",inline._href)();inline.reflink=replace(inline.reflink)("inside",inline._inside)();inline.normal=merge({},inline);inline.pedantic=merge({},inline.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/});inline.gfm=merge({},inline.normal,{escape:replace(inline.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:replace(inline.text)("]|","~]|")("|","|https?://|")()});inline.breaks=merge({},inline.gfm,{br:replace(inline.br)("{2,}","*")(),text:replace(inline.gfm.text)("{2,}","*")()});function InlineLexer(links,options){this.options=options||marked.defaults;this.links=links;this.rules=inline.normal;this.renderer=this.options.renderer||new Renderer;this.renderer.options=this.options;if(!this.links){throw new Error("Tokens array requires a `links` property.")}if(this.options.gfm){if(this.options.breaks){this.rules=inline.breaks}else{this.rules=inline.gfm}}else if(this.options.pedantic){this.rules=inline.pedantic}}InlineLexer.rules=inline;InlineLexer.output=function(src,links,options){var inline=new InlineLexer(links,options);return inline.output(src)};InlineLexer.prototype.output=function(src){var out="",link,text,href,cap;while(src){if(cap=this.rules.escape.exec(src)){src=src.substring(cap[0].length);out+=cap[1];continue}if(cap=this.rules.autolink.exec(src)){src=src.substring(cap[0].length);if(cap[2]==="@"){text=cap[1].charAt(6)===":"?this.mangle(cap[1].substring(7)):this.mangle(cap[1]);href=this.mangle("mailto:")+text}else{text=escape(cap[1]);href=text}out+=this.renderer.link(href,null,text);continue}if(!this.inLink&&(cap=this.rules.url.exec(src))){src=src.substring(cap[0].length);text=escape(cap[1]);href=text;out+=this.renderer.link(href,null,text);continue}if(cap=this.rules.tag.exec(src)){if(!this.inLink&&/^<a /i.test(cap[0])){this.inLink=true}else if(this.inLink&&/^<\/a>/i.test(cap[0])){this.inLink=false}src=src.substring(cap[0].length);out+=this.options.sanitize?escape(cap[0]):cap[0];continue}if(cap=this.rules.link.exec(src)){src=src.substring(cap[0].length);this.inLink=true;out+=this.outputLink(cap,{href:cap[2],title:cap[3]});this.inLink=false;continue}if((cap=this.rules.reflink.exec(src))||(cap=this.rules.nolink.exec(src))){src=src.substring(cap[0].length);link=(cap[2]||cap[1]).replace(/\s+/g," ");link=this.links[link.toLowerCase()];if(!link||!link.href){out+=cap[0].charAt(0);src=cap[0].substring(1)+src;continue}this.inLink=true;out+=this.outputLink(cap,link);this.inLink=false;continue}if(cap=this.rules.strong.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.strong(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.em.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.em(this.output(cap[2]||cap[1]));continue}if(cap=this.rules.code.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.codespan(escape(cap[2],true));continue}if(cap=this.rules.br.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.br();continue}if(cap=this.rules.del.exec(src)){src=src.substring(cap[0].length);out+=this.renderer.del(this.output(cap[1]));continue}if(cap=this.rules.text.exec(src)){src=src.substring(cap[0].length);out+=escape(this.smartypants(cap[0]));continue}if(src){throw new Error("Infinite loop on byte: "+src.charCodeAt(0))}}return out};InlineLexer.prototype.outputLink=function(cap,link){var href=escape(link.href),title=link.title?escape(link.title):null;return cap[0].charAt(0)!=="!"?this.renderer.link(href,title,this.output(cap[1])):this.renderer.image(href,title,escape(cap[1]))};InlineLexer.prototype.smartypants=function(text){if(!this.options.smartypants)return text;return text.replace(/--/g,"—").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")};InlineLexer.prototype.mangle=function(text){var out="",l=text.length,i=0,ch;for(;i<l;i++){ch=text.charCodeAt(i);if(Math.random()>.5){ch="x"+ch.toString(16)}out+="&#"+ch+";"}return out};function Renderer(options){this.options=options||{}}Renderer.prototype.code=function(code,lang,escaped){if(this.options.highlight){var out=this.options.highlight(code,lang);if(out!=null&&out!==code){escaped=true;code=out}}if(!lang){return"<pre><code>"+(escaped?code:escape(code,true))+"\n</code></pre>"}return'<pre><code class="'+this.options.langPrefix+escape(lang,true)+'">'+(escaped?code:escape(code,true))+"\n</code></pre>\n"};Renderer.prototype.blockquote=function(quote){return"<blockquote>\n"+quote+"</blockquote>\n"};Renderer.prototype.html=function(html){return html};Renderer.prototype.heading=function(text,level,raw){return"<h"+level+' id="'+this.options.headerPrefix+raw.toLowerCase().replace(/[^\w]+/g,"-")+'">'+text+"</h"+level+">\n"};Renderer.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"};Renderer.prototype.list=function(body,ordered){var type=ordered?"ol":"ul";return"<"+type+">\n"+body+"</"+type+">\n"};Renderer.prototype.listitem=function(text){return"<li>"+text+"</li>\n"};Renderer.prototype.paragraph=function(text){return"<p>"+text+"</p>\n"};Renderer.prototype.table=function(header,body){return"<table>\n"+"<thead>\n"+header+"</thead>\n"+"<tbody>\n"+body+"</tbody>\n"+"</table>\n"};Renderer.prototype.tablerow=function(content){return"<tr>\n"+content+"</tr>\n"};Renderer.prototype.tablecell=function(content,flags){var type=flags.header?"th":"td";var tag=flags.align?"<"+type+' style="text-align:'+flags.align+'">':"<"+type+">";return tag+content+"</"+type+">\n"};Renderer.prototype.strong=function(text){return"<strong>"+text+"</strong>"};Renderer.prototype.em=function(text){return"<em>"+text+"</em>"};Renderer.prototype.codespan=function(text){return"<code>"+text+"</code>"};Renderer.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"};Renderer.prototype.del=function(text){return"<del>"+text+"</del>"};Renderer.prototype.link=function(href,title,text){if(this.options.sanitize){try{var prot=decodeURIComponent(unescape(href)).replace(/[^\w:]/g,"").toLowerCase()}catch(e){return""}if(prot.indexOf("javascript:")===0){return""}}var out='<a href="'+href+'"';if(title){out+=' title="'+title+'"'}out+=">"+text+"</a>";return out};Renderer.prototype.image=function(href,title,text){var out='<img src="'+href+'" alt="'+text+'"';if(title){out+=' title="'+title+'"'}out+=this.options.xhtml?"/>":">";return out};function Parser(options){this.tokens=[];this.token=null;this.options=options||marked.defaults;this.options.renderer=this.options.renderer||new Renderer;this.renderer=this.options.renderer;this.renderer.options=this.options}Parser.parse=function(src,options,renderer){var parser=new Parser(options,renderer);return parser.parse(src)};Parser.prototype.parse=function(src){this.inline=new InlineLexer(src.links,this.options,this.renderer);this.tokens=src.reverse();var out="";while(this.next()){out+=this.tok()}return out};Parser.prototype.next=function(){return this.token=this.tokens.pop()};Parser.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0};Parser.prototype.parseText=function(){var body=this.token.text;while(this.peek().type==="text"){body+="\n"+this.next().text}return this.inline.output(body)};Parser.prototype.tok=function(){switch(this.token.type){case"space":{return""}case"hr":{return this.renderer.hr()}case"heading":{return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text)}case"code":{return this.renderer.code(this.token.text,this.token.lang,this.token.escaped)}case"table":{var header="",body="",i,row,cell,flags,j;cell="";for(i=0;i<this.token.header.length;i++){flags={header:true,align:this.token.align[i]};cell+=this.renderer.tablecell(this.inline.output(this.token.header[i]),{header:true,align:this.token.align[i]})}header+=this.renderer.tablerow(cell);for(i=0;i<this.token.cells.length;i++){row=this.token.cells[i];cell="";for(j=0;j<row.length;j++){cell+=this.renderer.tablecell(this.inline.output(row[j]),{header:false,align:this.token.align[j]})}body+=this.renderer.tablerow(cell)}return this.renderer.table(header,body)}case"blockquote_start":{var body="";while(this.next().type!=="blockquote_end"){body+=this.tok()}return this.renderer.blockquote(body)}case"list_start":{var body="",ordered=this.token.ordered;while(this.next().type!=="list_end"){body+=this.tok()}return this.renderer.list(body,ordered)}case"list_item_start":{var body="";while(this.next().type!=="list_item_end"){body+=this.token.type==="text"?this.parseText():this.tok()}return this.renderer.listitem(body)}case"loose_item_start":{var body="";while(this.next().type!=="list_item_end"){body+=this.tok()}return this.renderer.listitem(body)}case"html":{var html=!this.token.pre&&!this.options.pedantic?this.inline.output(this.token.text):this.token.text;return this.renderer.html(html)}case"paragraph":{return this.renderer.paragraph(this.inline.output(this.token.text))}case"text":{return this.renderer.paragraph(this.parseText())}}};function escape(html,encode){return html.replace(!encode?/&(?!#?\w+;)/g:/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function unescape(html){return html.replace(/&([#\w]+);/g,function(_,n){n=n.toLowerCase();if(n==="colon")return":";if(n.charAt(0)==="#"){return n.charAt(1)==="x"?String.fromCharCode(parseInt(n.substring(2),16)):String.fromCharCode(+n.substring(1))}return""})}function replace(regex,opt){regex=regex.source;opt=opt||"";return function self(name,val){if(!name)return new RegExp(regex,opt);val=val.source||val;val=val.replace(/(^|[^\[])\^/g,"$1");regex=regex.replace(name,val);return self}}function noop(){}noop.exec=noop;function merge(obj){var i=1,target,key;for(;i<arguments.length;i++){target=arguments[i];for(key in target){if(Object.prototype.hasOwnProperty.call(target,key)){obj[key]=target[key]}}}return obj}function marked(src,opt,callback){if(callback||typeof opt==="function"){if(!callback){callback=opt;opt=null}opt=merge({},marked.defaults,opt||{});var highlight=opt.highlight,tokens,pending,i=0;try{tokens=Lexer.lex(src,opt)}catch(e){return callback(e)}pending=tokens.length;var done=function(){var out,err;try{out=Parser.parse(tokens,opt)}catch(e){err=e}opt.highlight=highlight;return err?callback(err):callback(null,out)};if(!highlight||highlight.length<3){return done()}delete opt.highlight;if(!pending)return done();for(;i<tokens.length;i++){(function(token){if(token.type!=="code"){return--pending||done()}return highlight(token.text,token.lang,function(err,code){if(code==null||code===token.text){return--pending||done()}token.text=code;token.escaped=true;--pending||done()})})(tokens[i])}return}try{if(opt)opt=merge({},marked.defaults,opt);return Parser.parse(Lexer.lex(src,opt),opt)}catch(e){e.message+="\nPlease report this to https://github.com/chjj/marked.";if((opt||marked.defaults).silent){return"<p>An error occured:</p><pre>"+escape(e.message+"",true)+"</pre>"}throw e}}marked.options=marked.setOptions=function(opt){merge(marked.defaults,opt);return marked};marked.defaults={gfm:true,tables:true,breaks:false,pedantic:false,sanitize:false,smartLists:false,silent:false,highlight:null,langPrefix:"lang-",smartypants:false,headerPrefix:"",renderer:new Renderer,xhtml:false};marked.Parser=Parser;marked.parser=Parser.parse;marked.Renderer=Renderer;marked.Lexer=Lexer;marked.lexer=Lexer.lex;marked.InlineLexer=InlineLexer;marked.inlineLexer=InlineLexer.output;marked.parse=marked;if(typeof exports==="object"){module.exports=marked}else if(typeof define==="function"&&define.amd){define(function(){return marked})}else{this.marked=marked}}).call(function(){return this||(typeof window!=="undefined"?window:global)}());</script><polymer-element name="marked-element" attributes="text" assetpath="../marked-element/"><script>Polymer("marked-element",{text:"",attached:function(){marked.setOptions({highlight:this.highlight.bind(this)});if(!this.text){this.text=this.innerHTML}},textChanged:function(oldVal,newVal){if(newVal){this.innerHTML=marked(this.text)}},highlight:function(code,lang){var event=this.fire("marked-js-highlight",{code:code,lang:lang});return event.detail.code||code}});</script></polymer-element><script>var IN_GLOBAL_SCOPE=true;window["PR_SHOULD_USE_CONTINUATION"]=true;var prettyPrintOne;var prettyPrint;(function(){var win=window;var FLOW_CONTROL_KEYWORDS=["break,continue,do,else,for,if,return,while"];var C_KEYWORDS=[FLOW_CONTROL_KEYWORDS,"auto,case,char,const,default,"+"double,enum,extern,float,goto,inline,int,long,register,short,signed,"+"sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var COMMON_KEYWORDS=[C_KEYWORDS,"catch,class,delete,false,import,"+"new,operator,private,protected,public,this,throw,true,try,typeof"];var CPP_KEYWORDS=[COMMON_KEYWORDS,"alignof,align_union,asm,axiom,bool,"+"concept,concept_map,const_cast,constexpr,decltype,delegate,"+"dynamic_cast,explicit,export,friend,generic,late_check,"+"mutable,namespace,nullptr,property,reinterpret_cast,static_assert,"+"static_cast,template,typeid,typename,using,virtual,where"];var JAVA_KEYWORDS=[COMMON_KEYWORDS,"abstract,assert,boolean,byte,extends,final,finally,implements,import,"+"instanceof,interface,null,native,package,strictfp,super,synchronized,"+"throws,transient"];var CSHARP_KEYWORDS=[JAVA_KEYWORDS,"as,base,by,checked,decimal,delegate,descending,dynamic,event,"+"fixed,foreach,from,group,implicit,in,internal,into,is,let,"+"lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,"+"sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,"+"var,virtual,where"];var COFFEE_KEYWORDS="all,and,by,catch,class,else,extends,false,finally,"+"for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,"+"throw,true,try,unless,until,when,while,yes";var JSCRIPT_KEYWORDS=[COMMON_KEYWORDS,"debugger,eval,export,function,get,null,set,undefined,var,with,"+"Infinity,NaN"];var PERL_KEYWORDS="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,"+"goto,if,import,last,local,my,next,no,our,print,package,redo,require,"+"sub,undef,unless,until,use,wantarray,while,BEGIN,END";var PYTHON_KEYWORDS=[FLOW_CONTROL_KEYWORDS,"and,as,assert,class,def,del,"+"elif,except,exec,finally,from,global,import,in,is,lambda,"+"nonlocal,not,or,pass,print,raise,try,with,yield,"+"False,True,None"];var RUBY_KEYWORDS=[FLOW_CONTROL_KEYWORDS,"alias,and,begin,case,class,"+"def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,"+"rescue,retry,self,super,then,true,undef,unless,until,when,yield,"+"BEGIN,END"];var RUST_KEYWORDS=[FLOW_CONTROL_KEYWORDS,"as,assert,const,copy,drop,"+"enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,"+"pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"];var SH_KEYWORDS=[FLOW_CONTROL_KEYWORDS,"case,done,elif,esac,eval,fi,"+"function,in,local,set,then,until"];var ALL_KEYWORDS=[CPP_KEYWORDS,CSHARP_KEYWORDS,JSCRIPT_KEYWORDS,PERL_KEYWORDS,PYTHON_KEYWORDS,RUBY_KEYWORDS,SH_KEYWORDS];var C_TYPES=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/;var PR_STRING="str";var PR_KEYWORD="kwd";var PR_COMMENT="com";var PR_TYPE="typ";var PR_LITERAL="lit";var PR_PUNCTUATION="pun";var PR_PLAIN="pln";var PR_TAG="tag";var PR_DECLARATION="dec";var PR_SOURCE="src";var PR_ATTRIB_NAME="atn";var PR_ATTRIB_VALUE="atv";var PR_NOCODE="nocode";var REGEXP_PRECEDER_PATTERN="(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function combinePrefixPatterns(regexs){var capturedGroupIndex=0;var needToFoldCase=false;var ignoreCase=false;for(var i=0,n=regexs.length;i<n;++i){var regex=regexs[i];if(regex.ignoreCase){ignoreCase=true}else if(/[a-z]/i.test(regex.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){needToFoldCase=true;ignoreCase=false;break}}var escapeCharToCodeUnit={b:8,t:9,n:10,v:11,f:12,r:13};function decodeEscape(charsetPart){var cc0=charsetPart.charCodeAt(0);if(cc0!==92){return cc0}var c1=charsetPart.charAt(1);cc0=escapeCharToCodeUnit[c1];if(cc0){return cc0}else if("0"<=c1&&c1<="7"){return parseInt(charsetPart.substring(1),8)}else if(c1==="u"||c1==="x"){return parseInt(charsetPart.substring(2),16)}else{return charsetPart.charCodeAt(1)}}function encodeEscape(charCode){if(charCode<32){return(charCode<16?"\\x0":"\\x")+charCode.toString(16)}var ch=String.fromCharCode(charCode);return ch==="\\"||ch==="-"||ch==="]"||ch==="^"?"\\"+ch:ch}function caseFoldCharset(charSet){var charsetParts=charSet.substring(1,charSet.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}"+"|\\\\x[0-9A-Fa-f]{2}"+"|\\\\[0-3][0-7]{0,2}"+"|\\\\[0-7]{1,2}"+"|\\\\[\\s\\S]"+"|-"+"|[^-\\\\]","g"));var ranges=[];var inverse=charsetParts[0]==="^";var out=["["];if(inverse){out.push("^")}for(var i=inverse?1:0,n=charsetParts.length;i<n;++i){var p=charsetParts[i];if(/\\[bdsw]/i.test(p)){out.push(p)}else{var start=decodeEscape(p);var end;if(i+2<n&&"-"===charsetParts[i+1]){end=decodeEscape(charsetParts[i+2]);i+=2}else{end=start}ranges.push([start,end]);if(!(end<65||start>122)){if(!(end<65||start>90)){ranges.push([Math.max(65,start)|32,Math.min(end,90)|32])}if(!(end<97||start>122)){ranges.push([Math.max(97,start)&~32,Math.min(end,122)&~32])}}}}ranges.sort(function(a,b){return a[0]-b[0]||b[1]-a[1]});var consolidatedRanges=[];var lastRange=[];for(var i=0;i<ranges.length;++i){var range=ranges[i];if(range[0]<=lastRange[1]+1){lastRange[1]=Math.max(lastRange[1],range[1])}else{consolidatedRanges.push(lastRange=range)}}for(var i=0;i<consolidatedRanges.length;++i){var range=consolidatedRanges[i];out.push(encodeEscape(range[0]));if(range[1]>range[0]){if(range[1]+1>range[0]){out.push("-")}out.push(encodeEscape(range[1]))}}out.push("]");return out.join("")}function allowAnywhereFoldCaseAndRenumberGroups(regex){var parts=regex.source.match(new RegExp("(?:"+"\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]"+"|\\\\u[A-Fa-f0-9]{4}"+"|\\\\x[A-Fa-f0-9]{2}"+"|\\\\[0-9]+"+"|\\\\[^ux0-9]"+"|\\(\\?[:!=]"+"|[\\(\\)\\^]"+"|[^\\x5B\\x5C\\(\\)\\^]+"+")","g"));var n=parts.length;var capturedGroups=[];for(var i=0,groupIndex=0;i<n;++i){var p=parts[i];if(p==="("){++groupIndex}else if("\\"===p.charAt(0)){var decimalValue=+p.substring(1);if(decimalValue){if(decimalValue<=groupIndex){capturedGroups[decimalValue]=-1}else{parts[i]=encodeEscape(decimalValue)}}}}for(var i=1;i<capturedGroups.length;++i){if(-1===capturedGroups[i]){capturedGroups[i]=++capturedGroupIndex}}for(var i=0,groupIndex=0;i<n;++i){var p=parts[i];if(p==="("){++groupIndex;if(!capturedGroups[groupIndex]){parts[i]="(?:"}}else if("\\"===p.charAt(0)){var decimalValue=+p.substring(1);if(decimalValue&&decimalValue<=groupIndex){parts[i]="\\"+capturedGroups[decimalValue]}}}for(var i=0;i<n;++i){if("^"===parts[i]&&"^"!==parts[i+1]){parts[i]=""}}if(regex.ignoreCase&&needToFoldCase){for(var i=0;i<n;++i){var p=parts[i];var ch0=p.charAt(0);if(p.length>=2&&ch0==="["){parts[i]=caseFoldCharset(p)}else if(ch0!=="\\"){parts[i]=p.replace(/[a-zA-Z]/g,function(ch){var cc=ch.charCodeAt(0);return"["+String.fromCharCode(cc&~32,cc|32)+"]"})}}}return parts.join("")}var rewritten=[];for(var i=0,n=regexs.length;i<n;++i){var regex=regexs[i];if(regex.global||regex.multiline){throw new Error(""+regex)}rewritten.push("(?:"+allowAnywhereFoldCaseAndRenumberGroups(regex)+")")}return new RegExp(rewritten.join("|"),ignoreCase?"gi":"g")}function extractSourceSpans(node,isPreformatted){var nocode=/(?:^|\s)nocode(?:\s|$)/;var chunks=[];var length=0;var spans=[];var k=0;function walk(node){var type=node.nodeType;if(type==1){if(nocode.test(node.className)){return}for(var child=node.firstChild;child;child=child.nextSibling){walk(child)}var nodeName=node.nodeName.toLowerCase();if("br"===nodeName||"li"===nodeName){chunks[k]="\n";spans[k<<1]=length++;spans[k++<<1|1]=node}}else if(type==3||type==4){var text=node.nodeValue;if(text.length){if(!isPreformatted){text=text.replace(/[ \t\r\n]+/g," ")}else{text=text.replace(/\r\n?/g,"\n")}chunks[k]=text;spans[k<<1]=length;length+=text.length;spans[k++<<1|1]=node}}}walk(node);return{sourceCode:chunks.join("").replace(/\n$/,""),spans:spans}}function appendDecorations(basePos,sourceCode,langHandler,out){if(!sourceCode){return}var job={sourceCode:sourceCode,basePos:basePos};langHandler(job);out.push.apply(out,job.decorations)}var notWs=/\S/;function childContentWrapper(element){var wrapper=undefined;for(var c=element.firstChild;c;c=c.nextSibling){var type=c.nodeType;wrapper=type===1?wrapper?element:c:type===3?notWs.test(c.nodeValue)?element:wrapper:wrapper}return wrapper===element?undefined:wrapper}function createSimpleLexer(shortcutStylePatterns,fallthroughStylePatterns){var shortcuts={};var tokenizer;(function(){var allPatterns=shortcutStylePatterns.concat(fallthroughStylePatterns);var allRegexs=[];var regexKeys={};for(var i=0,n=allPatterns.length;i<n;++i){var patternParts=allPatterns[i];var shortcutChars=patternParts[3];if(shortcutChars){for(var c=shortcutChars.length;--c>=0;){shortcuts[shortcutChars.charAt(c)]=patternParts}}var regex=patternParts[1];var k=""+regex;if(!regexKeys.hasOwnProperty(k)){allRegexs.push(regex);regexKeys[k]=null}}allRegexs.push(/[\0-\uffff]/);tokenizer=combinePrefixPatterns(allRegexs)})();var nPatterns=fallthroughStylePatterns.length;var decorate=function(job){var sourceCode=job.sourceCode,basePos=job.basePos;var decorations=[basePos,PR_PLAIN];var pos=0;var tokens=sourceCode.match(tokenizer)||[];var styleCache={};for(var ti=0,nTokens=tokens.length;ti<nTokens;++ti){var token=tokens[ti];var style=styleCache[token];var match=void 0;var isEmbedded;if(typeof style==="string"){isEmbedded=false}else{var patternParts=shortcuts[token.charAt(0)];if(patternParts){match=token.match(patternParts[1]);style=patternParts[0]}else{for(var i=0;i<nPatterns;++i){patternParts=fallthroughStylePatterns[i];match=token.match(patternParts[1]);if(match){style=patternParts[0];break}}if(!match){style=PR_PLAIN}}isEmbedded=style.length>=5&&"lang-"===style.substring(0,5);if(isEmbedded&&!(match&&typeof match[1]==="string")){isEmbedded=false;style=PR_SOURCE}if(!isEmbedded){styleCache[token]=style}}var tokenStart=pos;pos+=token.length;if(!isEmbedded){decorations.push(basePos+tokenStart,style)}else{var embeddedSource=match[1];var embeddedSourceStart=token.indexOf(embeddedSource);var embeddedSourceEnd=embeddedSourceStart+embeddedSource.length;if(match[2]){embeddedSourceEnd=token.length-match[2].length;embeddedSourceStart=embeddedSourceEnd-embeddedSource.length}var lang=style.substring(5);appendDecorations(basePos+tokenStart,token.substring(0,embeddedSourceStart),decorate,decorations);appendDecorations(basePos+tokenStart+embeddedSourceStart,embeddedSource,langHandlerForExtension(lang,embeddedSource),decorations);appendDecorations(basePos+tokenStart+embeddedSourceEnd,token.substring(embeddedSourceEnd),decorate,decorations)}}job.decorations=decorations};return decorate}function sourceDecorator(options){var shortcutStylePatterns=[],fallthroughStylePatterns=[];if(options["tripleQuotedStrings"]){shortcutStylePatterns.push([PR_STRING,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else if(options["multiLineStrings"]){shortcutStylePatterns.push([PR_STRING,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{shortcutStylePatterns.push([PR_STRING,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}if(options["verbatimStrings"]){fallthroughStylePatterns.push([PR_STRING,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var hc=options["hashComments"];if(hc){if(options["cStyleComments"]){if(hc>1){shortcutStylePatterns.push([PR_COMMENT,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{shortcutStylePatterns.push([PR_COMMENT,/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}fallthroughStylePatterns.push([PR_STRING,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,null])}else{shortcutStylePatterns.push([PR_COMMENT,/^#[^\r\n]*/,null,"#"])}}if(options["cStyleComments"]){fallthroughStylePatterns.push([PR_COMMENT,/^\/\/[^\r\n]*/,null]);fallthroughStylePatterns.push([PR_COMMENT,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}var regexLiterals=options["regexLiterals"];if(regexLiterals){var regexExcls=regexLiterals>1?"":"\n\r";var regexAny=regexExcls?".":"[\\S\\s]";var REGEX_LITERAL="/(?=[^/*"+regexExcls+"])"+"(?:[^/\\x5B\\x5C"+regexExcls+"]"+"|\\x5C"+regexAny+"|\\x5B(?:[^\\x5C\\x5D"+regexExcls+"]"+"|\\x5C"+regexAny+")*(?:\\x5D|$))+"+"/";fallthroughStylePatterns.push(["lang-regex",RegExp("^"+REGEXP_PRECEDER_PATTERN+"("+REGEX_LITERAL+")")])}var types=options["types"];if(types){fallthroughStylePatterns.push([PR_TYPE,types])}var keywords=(""+options["keywords"]).replace(/^ | $/g,"");if(keywords.length){fallthroughStylePatterns.push([PR_KEYWORD,new RegExp("^(?:"+keywords.replace(/[\s,]+/g,"|")+")\\b"),null])}shortcutStylePatterns.push([PR_PLAIN,/^\s+/,null," \r\n  "]);var punctuation="^.[^\\s\\w.$@'\"`/\\\\]*";if(options["regexLiterals"]){punctuation+="(?!s*/)"}fallthroughStylePatterns.push([PR_LITERAL,/^@[a-z_$][a-z_$@0-9]*/i,null],[PR_TYPE,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[PR_PLAIN,/^[a-z_$][a-z_$@0-9]*/i,null],[PR_LITERAL,new RegExp("^(?:"+"0x[a-f0-9]+"+"|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)"+"(?:e[+\\-]?\\d+)?"+")"+"[a-z]*","i"),null,"0123456789"],[PR_PLAIN,/^\\[\s\S]?/,null],[PR_PUNCTUATION,new RegExp(punctuation),null]);return createSimpleLexer(shortcutStylePatterns,fallthroughStylePatterns)}var decorateSource=sourceDecorator({keywords:ALL_KEYWORDS,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function numberLines(node,opt_startLineNum,isPreformatted){var nocode=/(?:^|\s)nocode(?:\s|$)/;var lineBreak=/\r\n?|\n/;var document=node.ownerDocument;var li=document.createElement("li");while(node.firstChild){li.appendChild(node.firstChild)}var listItems=[li];function walk(node){var type=node.nodeType;if(type==1&&!nocode.test(node.className)){if("br"===node.nodeName){breakAfter(node);if(node.parentNode){node.parentNode.removeChild(node)}}else{for(var child=node.firstChild;child;child=child.nextSibling){walk(child)}}}else if((type==3||type==4)&&isPreformatted){var text=node.nodeValue;var match=text.match(lineBreak);if(match){var firstLine=text.substring(0,match.index);node.nodeValue=firstLine;var tail=text.substring(match.index+match[0].length);if(tail){var parent=node.parentNode;parent.insertBefore(document.createTextNode(tail),node.nextSibling)}breakAfter(node);if(!firstLine){node.parentNode.removeChild(node)}}}}function breakAfter(lineEndNode){while(!lineEndNode.nextSibling){lineEndNode=lineEndNode.parentNode;if(!lineEndNode){return}}function breakLeftOf(limit,copy){var rightSide=copy?limit.cloneNode(false):limit;var parent=limit.parentNode;if(parent){var parentClone=breakLeftOf(parent,1);var next=limit.nextSibling;parentClone.appendChild(rightSide);for(var sibling=next;sibling;sibling=next){next=sibling.nextSibling;parentClone.appendChild(sibling)}}return rightSide}var copiedListItem=breakLeftOf(lineEndNode.nextSibling,0);for(var parent;(parent=copiedListItem.parentNode)&&parent.nodeType===1;){copiedListItem=parent}listItems.push(copiedListItem)}for(var i=0;i<listItems.length;++i){walk(listItems[i])}if(opt_startLineNum===(opt_startLineNum|0)){listItems[0].setAttribute("value",opt_startLineNum)}var ol=document.createElement("ol");ol.className="linenums";var offset=Math.max(0,opt_startLineNum-1|0)||0;for(var i=0,n=listItems.length;i<n;++i){li=listItems[i];li.className="L"+(i+offset)%10;if(!li.firstChild){li.appendChild(document.createTextNode(" "))}ol.appendChild(li)}node.appendChild(ol)}function recombineTagsAndDecorations(job){var isIE8OrEarlier=/\bMSIE\s(\d+)/.exec(navigator.userAgent);isIE8OrEarlier=isIE8OrEarlier&&+isIE8OrEarlier[1]<=8;var newlineRe=/\n/g;var source=job.sourceCode;var sourceLength=source.length;var sourceIndex=0;var spans=job.spans;var nSpans=spans.length;var spanIndex=0;var decorations=job.decorations;var nDecorations=decorations.length;var decorationIndex=0;decorations[nDecorations]=sourceLength;var decPos,i;for(i=decPos=0;i<nDecorations;){if(decorations[i]!==decorations[i+2]){decorations[decPos++]=decorations[i++];decorations[decPos++]=decorations[i++]}else{i+=2}}nDecorations=decPos;for(i=decPos=0;i<nDecorations;){var startPos=decorations[i];var startDec=decorations[i+1];var end=i+2;while(end+2<=nDecorations&&decorations[end+1]===startDec){end+=2}decorations[decPos++]=startPos;decorations[decPos++]=startDec;i=end}nDecorations=decorations.length=decPos;var sourceNode=job.sourceNode;var oldDisplay;if(sourceNode){oldDisplay=sourceNode.style.display;sourceNode.style.display="none"}try{var decoration=null;while(spanIndex<nSpans){var spanStart=spans[spanIndex];var spanEnd=spans[spanIndex+2]||sourceLength;var decEnd=decorations[decorationIndex+2]||sourceLength;var end=Math.min(spanEnd,decEnd);var textNode=spans[spanIndex+1];var styledText;if(textNode.nodeType!==1&&(styledText=source.substring(sourceIndex,end))){if(isIE8OrEarlier){styledText=styledText.replace(newlineRe,"\r")}textNode.nodeValue=styledText;var document=textNode.ownerDocument;var span=document.createElement("span");span.className=decorations[decorationIndex+1];var parentNode=textNode.parentNode;parentNode.replaceChild(span,textNode);span.appendChild(textNode);if(sourceIndex<spanEnd){spans[spanIndex+1]=textNode=document.createTextNode(source.substring(end,spanEnd));parentNode.insertBefore(textNode,span.nextSibling)}}sourceIndex=end;if(sourceIndex>=spanEnd){spanIndex+=2}if(sourceIndex>=decEnd){decorationIndex+=2}}}finally{if(sourceNode){sourceNode.style.display=oldDisplay}}}var langHandlerRegistry={};function registerLangHandler(handler,fileExtensions){for(var i=fileExtensions.length;--i>=0;){var ext=fileExtensions[i];if(!langHandlerRegistry.hasOwnProperty(ext)){langHandlerRegistry[ext]=handler}else if(win["console"]){console["warn"]("cannot override language handler %s",ext)}}}function langHandlerForExtension(extension,source){if(!(extension&&langHandlerRegistry.hasOwnProperty(extension))){extension=/^\s*</.test(source)?"default-markup":"default-code"}return langHandlerRegistry[extension]}registerLangHandler(decorateSource,["default-code"]);registerLangHandler(createSimpleLexer([],[[PR_PLAIN,/^[^<?]+/],[PR_DECLARATION,/^<!\w[^>]*(?:>|$)/],[PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);registerLangHandler(createSimpleLexer([[PR_PLAIN,/^[\s]+/,null," \r\n"],[PR_ATTRIB_VALUE,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[PR_TAG,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[PR_ATTRIB_NAME,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[PR_PUNCTUATION,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);registerLangHandler(createSimpleLexer([],[[PR_ATTRIB_VALUE,/^[\s\S]+/]]),["uq.val"]);registerLangHandler(sourceDecorator({keywords:CPP_KEYWORDS,hashComments:true,cStyleComments:true,types:C_TYPES}),["c","cc","cpp","cxx","cyc","m"]);registerLangHandler(sourceDecorator({keywords:"null,true,false"}),["json"]);registerLangHandler(sourceDecorator({keywords:CSHARP_KEYWORDS,hashComments:true,cStyleComments:true,verbatimStrings:true,types:C_TYPES}),["cs"]);registerLangHandler(sourceDecorator({keywords:JAVA_KEYWORDS,cStyleComments:true}),["java"]);registerLangHandler(sourceDecorator({keywords:SH_KEYWORDS,hashComments:true,multiLineStrings:true}),["bash","bsh","csh","sh"]);registerLangHandler(sourceDecorator({keywords:PYTHON_KEYWORDS,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py","python"]);registerLangHandler(sourceDecorator({keywords:PERL_KEYWORDS,hashComments:true,multiLineStrings:true,regexLiterals:2}),["perl","pl","pm"]);registerLangHandler(sourceDecorator({keywords:RUBY_KEYWORDS,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb","ruby"]);registerLangHandler(sourceDecorator({keywords:JSCRIPT_KEYWORDS,cStyleComments:true,regexLiterals:true}),["javascript","js"]);registerLangHandler(sourceDecorator({keywords:COFFEE_KEYWORDS,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);registerLangHandler(sourceDecorator({keywords:RUST_KEYWORDS,cStyleComments:true,multilineStrings:true}),["rc","rs","rust"]);registerLangHandler(createSimpleLexer([],[[PR_STRING,/^[\s\S]+/]]),["regex"]);function applyDecorator(job){var opt_langExtension=job.langExtension;try{var sourceAndSpans=extractSourceSpans(job.sourceNode,job.pre);var source=sourceAndSpans.sourceCode;job.sourceCode=source;job.spans=sourceAndSpans.spans;job.basePos=0;langHandlerForExtension(opt_langExtension,source)(job);recombineTagsAndDecorations(job)}catch(e){if(win["console"]){console["log"](e&&e["stack"]||e)}}}function $prettyPrintOne(sourceCodeHtml,opt_langExtension,opt_numberLines){var container=document.createElement("div");container.innerHTML="<pre>"+sourceCodeHtml+"</pre>";container=container.firstChild;if(opt_numberLines){numberLines(container,opt_numberLines,true)}var job={langExtension:opt_langExtension,numberLines:opt_numberLines,sourceNode:container,pre:1};applyDecorator(job);return container.innerHTML}function $prettyPrint(opt_whenDone,opt_root){var root=opt_root||document.body;var doc=root.ownerDocument||document;function byTagName(tn){return root.getElementsByTagName(tn)}var codeSegments=[byTagName("pre"),byTagName("code"),byTagName("xmp")];var elements=[];for(var i=0;i<codeSegments.length;++i){for(var j=0,n=codeSegments[i].length;j<n;++j){elements.push(codeSegments[i][j])}}codeSegments=null;var clock=Date;if(!clock["now"]){clock={now:function(){return+new Date}}}var k=0;var prettyPrintingJob;var langExtensionRe=/\blang(?:uage)?-([\w.]+)(?!\S)/;var prettyPrintRe=/\bprettyprint\b/;var prettyPrintedRe=/\bprettyprinted\b/;var preformattedTagNameRe=/pre|xmp/i;var codeRe=/^code$/i;var preCodeXmpRe=/^(?:pre|code|xmp)$/i;var EMPTY={};function doWork(){var endTime=win["PR_SHOULD_USE_CONTINUATION"]?clock["now"]()+250:Infinity;for(;k<elements.length&&clock["now"]()<endTime;k++){var cs=elements[k];var attrs=EMPTY;{for(var preceder=cs;preceder=preceder.previousSibling;){var nt=preceder.nodeType;var value=(nt===7||nt===8)&&preceder.nodeValue;if(value?!/^\??prettify\b/.test(value):nt!==3||/\S/.test(preceder.nodeValue)){break}if(value){attrs={};value.replace(/\b(\w+)=([\w:.%+-]+)/g,function(_,name,value){attrs[name]=value});break}}}var className=cs.className;if((attrs!==EMPTY||prettyPrintRe.test(className))&&!prettyPrintedRe.test(className)){var nested=false;for(var p=cs.parentNode;p;p=p.parentNode){var tn=p.tagName;if(preCodeXmpRe.test(tn)&&p.className&&prettyPrintRe.test(p.className)){nested=true;break}}if(!nested){cs.className+=" prettyprinted";var langExtension=attrs["lang"];if(!langExtension){langExtension=className.match(langExtensionRe);var wrapper;if(!langExtension&&(wrapper=childContentWrapper(cs))&&codeRe.test(wrapper.tagName)){langExtension=wrapper.className.match(langExtensionRe)}if(langExtension){langExtension=langExtension[1]}}var preformatted;if(preformattedTagNameRe.test(cs.tagName)){preformatted=1}else{var currentStyle=cs["currentStyle"];var defaultView=doc.defaultView;var whitespace=currentStyle?currentStyle["whiteSpace"]:defaultView&&defaultView.getComputedStyle?defaultView.getComputedStyle(cs,null).getPropertyValue("white-space"):0;preformatted=whitespace&&"pre"===whitespace.substring(0,3)}var lineNums=attrs["linenums"];if(!(lineNums=lineNums==="true"||+lineNums)){lineNums=className.match(/\blinenums\b(?::(\d+))?/);lineNums=lineNums?lineNums[1]&&lineNums[1].length?+lineNums[1]:true:false}if(lineNums){numberLines(cs,lineNums,preformatted)}prettyPrintingJob={langExtension:langExtension,sourceNode:cs,numberLines:lineNums,pre:preformatted};applyDecorator(prettyPrintingJob)}}}if(k<elements.length){setTimeout(doWork,250)}else if("function"===typeof opt_whenDone){opt_whenDone()}}doWork()}var PR=win["PR"]={createSimpleLexer:createSimpleLexer,registerLangHandler:registerLangHandler,sourceDecorator:sourceDecorator,PR_ATTRIB_NAME:PR_ATTRIB_NAME,PR_ATTRIB_VALUE:PR_ATTRIB_VALUE,PR_COMMENT:PR_COMMENT,PR_DECLARATION:PR_DECLARATION,PR_KEYWORD:PR_KEYWORD,PR_LITERAL:PR_LITERAL,PR_NOCODE:PR_NOCODE,PR_PLAIN:PR_PLAIN,PR_PUNCTUATION:PR_PUNCTUATION,PR_SOURCE:PR_SOURCE,PR_STRING:PR_STRING,PR_TAG:PR_TAG,PR_TYPE:PR_TYPE,prettyPrintOne:IN_GLOBAL_SCOPE?win["prettyPrintOne"]=$prettyPrintOne:prettyPrintOne=$prettyPrintOne,prettyPrint:prettyPrint=IN_GLOBAL_SCOPE?win["prettyPrint"]=$prettyPrint:prettyPrint=$prettyPrint};if(typeof define==="function"&&define["amd"]){define("google-code-prettify",[],function(){return PR})}})();</script><script>(function(scope){var ContextFreeParser={parse:function(text){var top={};var entities=[];var current=top;var subCurrent={};var scriptDocCommentClause="\\/\\*\\*([\\s\\S]*?)\\*\\/";var htmlDocCommentClause="<!--([\\s\\S]*?)-->";var docCommentRegex=new RegExp(scriptDocCommentClause+"|"+htmlDocCommentClause,"g");var docComments=text.match(docCommentRegex)||[];docComments.forEach(function(m){var lines=m.replace(/\r\n/g,"\n").replace(/^\s*\/\*\*|^\s*\*\/|^\s*\* ?|^\s*\<\!-\-|^s*\-\-\>/gm,"").split("\n");var pragmas=[];lines=lines.filter(function(l){var m=l.match(/\s*@([\w-]*) (.*)/);if(!m){return true}pragmas.push(m)});var code=lines.join("\n");pragmas.forEach(function(m){var pragma=m[1],content=m[2];switch(pragma){case"class":case"element":current={name:content,description:code};entities.push(current);break;case"attribute":case"property":case"method":case"event":subCurrent={name:content,description:code};var label=pragma=="property"?"properties":pragma+"s";makePragma(current,label,subCurrent);break;case"default":case"type":subCurrent[pragma]=content;break;case"param":var eventParmsRe=/\{(.+)\}\s+(\w+[.\w+]+)\s+(.*)$/;var params=content.match(eventParmsRe);if(params){var subEventObj={type:params[1],name:params[2],description:params[3]};makePragma(subCurrent,pragma+"s",subEventObj)}break;default:current[pragma]=content;break}});function makePragma(object,pragma,content){var p$=object;var p=p$[pragma];if(!p){p$[pragma]=p=[]}p.push(content)}});if(entities.length===0){entities.push({name:"Entity",description:"**Undocumented**"})}return entities}};if(typeof module!=="undefined"&&module.exports){module.exports=ContextFreeParser}else{scope.ContextFreeParser=ContextFreeParser}})(this);</script><polymer-element name="core-xhr" hidden assetpath="../core-ajax/"><script>Polymer("core-xhr",{request:function(options){var xhr=new XMLHttpRequest;var url=options.url;var method=options.method||"GET";var async=!options.sync;var params=this.toQueryString(options.params);if(params&&method=="GET"){url+=(url.indexOf("?")>0?"&":"?")+params}var xhrParams=this.isBodyMethod(method)?options.body||params:null;xhr.open(method,url,async);if(options.responseType){xhr.responseType=options.responseType}if(options.withCredentials){xhr.withCredentials=true}this.makeReadyStateHandler(xhr,options.callback);this.setRequestHeaders(xhr,options.headers);xhr.send(xhrParams);if(!async){xhr.onreadystatechange(xhr)}return xhr},toQueryString:function(params){var r=[];for(var n in params){var v=params[n];n=encodeURIComponent(n);r.push(v==null?n:n+"="+encodeURIComponent(v))}return r.join("&")},isBodyMethod:function(method){return this.bodyMethods[(method||"").toUpperCase()]},bodyMethods:{POST:1,PUT:1,DELETE:1},makeReadyStateHandler:function(xhr,callback){xhr.onreadystatechange=function(){if(xhr.readyState==4){callback&&callback.call(null,xhr.response,xhr)}}},setRequestHeaders:function(xhr,headers){if(headers){for(var name in headers){xhr.setRequestHeader(name,headers[name])}}}});</script></polymer-element><polymer-element name="core-ajax" hidden attributes="url handleAs auto params response error method headers body contentType withCredentials" assetpath="../core-ajax/"><script>Polymer("core-ajax",{url:"",handleAs:"",auto:false,params:"",response:null,error:null,method:"",headers:null,body:null,contentType:"application/x-www-form-urlencoded",withCredentials:false,xhrArgs:null,ready:function(){this.xhr=document.createElement("core-xhr")},receive:function(response,xhr){if(this.isSuccess(xhr)){this.processResponse(xhr)}else{this.processError(xhr)}this.complete(xhr)},isSuccess:function(xhr){var status=xhr.status||0;return!status||status>=200&&status<300},processResponse:function(xhr){var response=this.evalResponse(xhr);if(xhr===this.activeRequest){this.response=response}this.fire("core-response",{response:response,xhr:xhr})},processError:function(xhr){var response=xhr.status+": "+xhr.responseText;if(xhr===this.activeRequest){this.error=response}this.fire("core-error",{response:response,xhr:xhr})},complete:function(xhr){this.fire("core-complete",{response:xhr.status,xhr:xhr})},evalResponse:function(xhr){return this[(this.handleAs||"text")+"Handler"](xhr)},xmlHandler:function(xhr){return xhr.responseXML},textHandler:function(xhr){return xhr.responseText},jsonHandler:function(xhr){var r=xhr.responseText;try{return JSON.parse(r)}catch(x){console.warn("core-ajax caught an exception trying to parse response as JSON:");console.warn("url:",this.url);console.warn(x);return r}},documentHandler:function(xhr){return xhr.response},blobHandler:function(xhr){return xhr.response},arraybufferHandler:function(xhr){return xhr.response},urlChanged:function(){if(!this.handleAs){var ext=String(this.url).split(".").pop();switch(ext){case"json":this.handleAs="json";break}}this.autoGo()},paramsChanged:function(){this.autoGo()},autoChanged:function(){this.autoGo()},autoGo:function(){if(this.auto){this.goJob=this.job(this.goJob,this.go,0)}},go:function(){var args=this.xhrArgs||{};args.body=this.body||args.body;args.params=this.params||args.params;if(args.params&&typeof args.params=="string"){args.params=JSON.parse(args.params)}args.headers=this.headers||args.headers||{};if(args.headers&&typeof args.headers=="string"){args.headers=JSON.parse(args.headers)}var hasContentType=Object.keys(args.headers).some(function(header){return header.toLowerCase()==="content-type"});if(!hasContentType&&this.contentType){args.headers["Content-Type"]=this.contentType}if(this.handleAs==="arraybuffer"||this.handleAs==="blob"||this.handleAs==="document"){args.responseType=this.handleAs}args.withCredentials=this.withCredentials;args.callback=this.receive.bind(this);args.url=this.url;args.method=this.method;this.response=this.error=null;this.activeRequest=args.url&&this.xhr.request(args);return this.activeRequest}});</script></polymer-element><polymer-element name="context-free-parser" attributes="url text data" assetpath="../context-free-parser/"><template><core-ajax url="{{url}}" response="{{text}}" auto=""></core-ajax></template><script>Polymer("context-free-parser",{text:null,textChanged:function(){if(this.text){var entities=ContextFreeParser.parse(this.text);if(!entities||entities.length===0){entities=[{name:this.url.split("/").pop(),description:"**Undocumented**"}]}this.data={classes:entities}}},dataChanged:function(){this.fire("data-ready")}});</script></polymer-element><polymer-element name="core-doc-page" attributes="data" relative="" assetpath="../core-doc-viewer/elements/"><template><style>:host{display:block}#info>*{margin-right:20px}core-icon{margin-right:5px}.main{padding:0 72px;max-width:832px;margin:0 auto}marked-element{display:block}h1{color:#E91E63;font-size:52px;line-height:60px;font-weight:inherit}.box{margin-bottom:40px}.box:not(.top) .details{padding:16px}.box:not(.top) .details .params{margin-top:40px}.box:not(.top) h3{padding:16px;color:#fff;font-weight:inherit;font-size:20px;line-height:48px;margin:0}.box:not(.top) pre{padding:initial;background-color:transparent;margin:initial;font-size:12px}.box code{color:currentcolor;font-weight:500}.top pre{background-color:#fafafa;padding:16px}pre{max-width:832px;white-space:pre-wrap;overflow:hidden;border:none}.attribute-box .details{background-color:#ffcbbb;border-bottom:1px solid rgba(255,86,33,.5)}.attribute-box h3{background-color:#ff5621}.property-box .details{background-color:#fbe7b1;border-bottom:1px solid rgba(243,179,0,.5)}.property-box h3{background-color:#f3b300}.method-box .details{background-color:#a6ffea;border-bottom:1px solid rgba(0,190,164,.5)}.method-box h3{background-color:#00bea4}.event-box .details{background-color:#c5d9fb;border-bottom:1px solid rgba(65,132,243,.5)}.event-box h3{background-color:#4184f3}.badge{color:currentcolor}code,pre{color:#9f499b;font-family:"Source Code Pro",Monaco,Menlo,Consolas,"Courier New",monospace}pre .typ,pre .inline,.prettyprint .typ,.prettyprint .inline{color:#6b499f}pre .pun,.prettyprint .pun{color:#5c6bc0}pre .str,pre .string,.prettyprint .str,.prettyprint .string{color:#ff4081}pre .pln,.prettyprint .pln{color:#7986cb}pre .kwd,.prettyprint .kwd{color:#d61a7f}pre .atn,pre .attribute-name,.prettyprint .atn,.prettyprint .attribute-name{color:#6b499f}pre .atv,pre .attribute-value,.prettyprint .atv,.prettyprint .attribute-value{color:#7986cb}pre .com,pre .comment,.prettyprint .com,.prettyprint .comment{color:#8a8a8a}</style><core-header-panel id="panel" mode="waterfall" fit=""><div class="main" on-marked-js-highlight="{{hilight}}"><h1>{{data.name}}</h1><p id="info" layout="" horizontal="" center=""><span layout="" horizontal="" center=""><core-icon icon="home"></core-icon><a href="{{data | homepageFilter}}">Home Page</a></span><span layout="" horizontal="" center="" hidden?="{{!data.version}}"><core-icon icon="info-outline"></core-icon>Version: {{data.version}}</span></p><template if="{{data.extends}}"><section class="top"><h3 id="{{data.name}}.extends">Extends: <a href="#{{data.extends}}">{{data.extends}}</a></h3></section></template><template if="{{data.description}}"><section class="box top"><h3 id="{{data.name}}.summary">Summary</h3><marked-element text="{{data.description}}"></marked-element></section></template><template if="{{data.attributes.length}}"><section class="box attribute-box"><h3 id="{{data.name}}.attributes">Attributes</h3><template repeat="{{attribute in data.attributes}}"><div class="details" horizontal="" layout=""><div class="details-name" flex="" id="{{data.name}}.attributes.{{attribute.name}}"><p><code>{{attribute.name}}</code></p></div><div class="details-info" flex="" three=""><p layout="" horizontal="" center="" justified=""><code>&lt;<em>{{attribute.type}}</em>&gt;</code><span class="default" hidden?="{{!attribute.default}}">default: <code>{{attribute.default}}</code></span></p><marked-element text="{{attribute.description}}"></marked-element></div></div></template></section></template><template if="{{data.properties.length}}"><section class="box property-box"><h3 id="{{data.name}}.properties">Properties</h3><template repeat="{{property in data.properties}}"><div class="details" horizontal="" layout=""><div class="details-name" flex="" id="{{data.name}}.properties.{{property.name}}"><p><code>{{property.name}}</code></p></div><div class="details-info" flex="" three=""><p layout="" horizontal="" center="" justified=""><code>&lt;<em>{{property.type}}</em>&gt;</code><span class="default" hidden?="{{!property.default}}">default: <code>{{property.default}}</code></span></p><marked-element text="{{property.description}}"></marked-element></div></div></template></section></template><template if="{{data.events.length}}"><section class="box event-box"><h3 id="{{data.name}}.events">Events</h3><template repeat="{{event in data.events}}"><div class="details" horizontal="" layout=""><div class="details-name" flex="" id="{{data.name}}.events.{{event.name}}"><p><code>{{event.name}}</code></p></div><div class="details-info" flex="" three=""><marked-element text="{{event.description}}"></marked-element><template if="{{event.params.length}}"><div class="params"><p>Event details:</p><template repeat="{{param in event.params}}"><p><code>&lt;<em>{{param.type}}</em>&gt; {{param.name}}</code></p><p><span>{{param.description}}</span></p></template></div></template></div></div></template></section></template><template if="{{data.methods.length}}"><section class="box method-box"><h3 id="{{data.name}}.methods">Methods</h3><template repeat="{{method in data.methods}}"><div class="details" horizontal="" layout=""><div class="details-name" flex="" id="{{data.name}}.methods.{{method.name}}"><p><code>{{method.name}}</code></p></div><div class="details-info" flex="" three=""><marked-element text="{{method.description}}"></marked-element><template if="{{method.params.length}}"><div class="params"><p>Method parameters:</p><template repeat="{{param in method.params}}"><p><code>&lt;<em>{{param.type}}</em>&gt; {{param.name}}</code></p><p><span>{{param.description}}</span></p></template></div></template></div></div></template></section></template></div></core-header-panel></template><script>Polymer("core-doc-page",{hilight:function(event,detail,sender){detail.code=prettyPrintOne((detail.code||"").replace(/</g,"&lt;").replace(/>/g,"&gt;"))},homepageFilter:function(data){if(!data){return""}if(!data.homepage||data.homepage==="github.io"){return"//polymer.github.io/"+data.name}else{return data.homepage}},dataChanged:function(){this.async(function(){var elementToFocus=this.shadowRoot.getElementById(window.location.hash.slice(1));if(elementToFocus){elementToFocus.scrollIntoView()}})}});</script></polymer-element><polymer-element name="core-selection" attributes="multi" hidden assetpath="../core-selection/"><script>Polymer("core-selection",{multi:false,ready:function(){this.clear()},clear:function(){this.selection=[]},getSelection:function(){return this.multi?this.selection:this.selection[0]},isSelected:function(item){return this.selection.indexOf(item)>=0},setItemSelected:function(item,isSelected){if(item!==undefined&&item!==null){if(isSelected){this.selection.push(item)}else{var i=this.selection.indexOf(item);if(i>=0){this.selection.splice(i,1)}}this.fire("core-select",{isSelected:isSelected,item:item})}},select:function(item){if(this.multi){this.toggle(item)}else if(this.getSelection()!==item){this.setItemSelected(this.getSelection(),false);this.setItemSelected(item,true)}},toggle:function(item){this.setItemSelected(item,!this.isSelected(item))}});</script></polymer-element><polymer-element name="core-selector" attributes="selected multi valueattr selectedClass selectedProperty selectedAttribute selectedItem selectedModel selectedIndex notap excludedLocalNames target itemsSelector activateEvent" assetpath="../core-selector/"><template><core-selection id="selection" multi="{{multi}}" on-core-select="{{selectionSelect}}"></core-selection><content id="items" select="*"></content></template><script>Polymer("core-selector",{selected:null,multi:false,valueattr:"name",selectedClass:"core-selected",selectedProperty:"",selectedAttribute:"active",selectedItem:null,selectedModel:null,selectedIndex:-1,excludedLocalNames:"",target:null,itemsSelector:"",activateEvent:"tap",notap:false,defaultExcludedLocalNames:"template",observe:{"selected multi":"selectedChanged"},ready:function(){this.activateListener=this.activateHandler.bind(this);this.itemFilter=this.filterItem.bind(this);this.excludedLocalNamesChanged();this.observer=new MutationObserver(this.updateSelected.bind(this));if(!this.target){this.target=this}},get items(){if(!this.target){return[]}var nodes=this.target!==this?this.itemsSelector?this.target.querySelectorAll(this.itemsSelector):this.target.children:this.$.items.getDistributedNodes();return Array.prototype.filter.call(nodes,this.itemFilter)},filterItem:function(node){return!this._excludedNames[node.localName]},excludedLocalNamesChanged:function(){this._excludedNames={};var s=this.defaultExcludedLocalNames;if(this.excludedLocalNames){s+=" "+this.excludedLocalNames}s.split(/\s+/g).forEach(function(n){this._excludedNames[n]=1},this)},targetChanged:function(old){if(old){this.removeListener(old);this.observer.disconnect();this.clearSelection()}if(this.target){this.addListener(this.target);this.observer.observe(this.target,{childList:true});this.updateSelected()}},addListener:function(node){Polymer.addEventListener(node,this.activateEvent,this.activateListener)},removeListener:function(node){Polymer.removeEventListener(node,this.activateEvent,this.activateListener)},get selection(){return this.$.selection.getSelection()},selectedChanged:function(){if(arguments.length===1){this.processSplices(arguments[0])}else{this.updateSelected()}},updateSelected:function(){this.validateSelected();if(this.multi){this.clearSelection(this.selected);this.selected&&this.selected.forEach(function(s){this.setValueSelected(s,true)},this)}else{this.valueToSelection(this.selected)}},validateSelected:function(){if(this.multi&&!Array.isArray(this.selected)&&this.selected!=null){this.selected=[this.selected]}else if(!this.multi&&Array.isArray(this.selected)){var s=this.selected[0];this.clearSelection([s]);this.selected=s}},processSplices:function(splices){for(var i=0,splice;splice=splices[i];i++){for(var j=0;j<splice.removed.length;j++){this.setValueSelected(splice.removed[j],false)}for(var j=0;j<splice.addedCount;j++){this.setValueSelected(this.selected[splice.index+j],true)}}},clearSelection:function(excludes){this.$.selection.selection.slice().forEach(function(item){var v=this.valueForNode(item)||this.items.indexOf(item);if(!excludes||excludes.indexOf(v)<0){this.$.selection.setItemSelected(item,false)}},this)},valueToSelection:function(value){var item=this.valueToItem(value);this.$.selection.select(item)},setValueSelected:function(value,isSelected){var item=this.valueToItem(value);if(isSelected^this.$.selection.isSelected(item)){this.$.selection.setItemSelected(item,isSelected)}},updateSelectedItem:function(){this.selectedItem=this.selection},selectedItemChanged:function(){if(this.selectedItem){var t=this.selectedItem.templateInstance;this.selectedModel=t?t.model:undefined}else{this.selectedModel=null}this.selectedIndex=this.selectedItem?parseInt(this.valueToIndex(this.selected)):-1},valueToItem:function(value){return value===null||value===undefined?null:this.items[this.valueToIndex(value)]},valueToIndex:function(value){for(var i=0,items=this.items,c;c=items[i];i++){if(this.valueForNode(c)==value){return i}}return value},valueForNode:function(node){return node[this.valueattr]||node.getAttribute(this.valueattr)},selectionSelect:function(e,detail){this.updateSelectedItem();if(detail.item){this.applySelection(detail.item,detail.isSelected)}},applySelection:function(item,isSelected){if(this.selectedClass){item.classList.toggle(this.selectedClass,isSelected)}if(this.selectedProperty){item[this.selectedProperty]=isSelected}if(this.selectedAttribute&&item.setAttribute){if(isSelected){item.setAttribute(this.selectedAttribute,"")}else{item.removeAttribute(this.selectedAttribute)}}},activateHandler:function(e){if(!this.notap){var i=this.findDistributedTarget(e.target,this.items);if(i>=0){var item=this.items[i];var s=this.valueForNode(item)||i;if(this.multi){if(this.selected){this.addRemoveSelected(s)}else{this.selected=[s]}}else{this.selected=s}this.asyncFire("core-activate",{item:item})}}},addRemoveSelected:function(value){var i=this.selected.indexOf(value);if(i>=0){this.selected.splice(i,1)}else{this.selected.push(value)}},findDistributedTarget:function(target,nodes){while(target&&target!=this){var i=Array.prototype.indexOf.call(nodes,target);if(i>=0){return i}target=target.parentNode}},selectIndex:function(index){var item=this.items[index];if(item){this.selected=this.valueForNode(item)||index;return item}},selectPrevious:function(wrapped){var i=wrapped&&!this.selectedIndex?this.items.length-1:this.selectedIndex-1;return this.selectIndex(i)},selectNext:function(wrapped){var i=wrapped&&this.selectedIndex>=this.items.length-1?0:this.selectedIndex+1;return this.selectIndex(i)}});</script></polymer-element><polymer-element name="core-menu" extends="core-selector" assetpath="../core-menu/"><template><style>:host{display:block;margin:12px}polyfill-next-selector{content:':host > core-item'}::content>core-item{cursor:default}</style><shadow></shadow></template><script>Polymer("core-menu");</script></polymer-element><polymer-element name="core-item" attributes="label icon src" horizontal="" center="" layout="" assetpath="../core-item/"><template><style>:host{display:block;position:relative;min-height:40px;white-space:nowrap}:host(.font-scalable){min-height:2.5em}:host(.core-selected){font-weight:700}#icon{margin:0 16px 0 4px}:host(.font-scalable) #icon{margin:0 1em 0 .25em;height:1.5em;width:1.5em}polyfill-next-selector{content:':host > a'}::content>a{position:absolute;top:0;right:0;bottom:0;left:0;background-color:rgba(0,0,0,.000001)}</style><template if="{{icon || src}}"><core-icon src="{{src}}" id="icon" icon="{{icon}}" hidden?="{{!src && !icon}}"></core-icon></template><div id="label">{{label}}</div><content></content></template><script>Polymer("core-item",{});</script></polymer-element><polymer-element name="core-doc-toc" attributes="data selected" assetpath="../core-doc-viewer/elements/"><template><style>:host{display:block;position:relative;border-right:1px solid silver}core-header-panel{position:absolute;top:0;left:0;height:100%;width:100%}core-toolbar{background-color:#eee}</style><core-header-panel mode="waterfall"><core-menu selected="{{selected}}"><template repeat="{{data}}"><core-item><a href="#{{name}}">{{name}}</a></core-item></template></core-menu></core-header-panel></template><script>Polymer("core-doc-toc",{searchAction:function(){this.$.searchBar.style.opacity=1;this.$.searchBar.style.display=""},closeSearchAction:function(){this.$.searchBar.style.opacity=0;this.$.searchBar.style.display="none"}});</script></polymer-element><polymer-element name="core-doc-viewer" attributes="sources route url" horizontal="" layout="" assetpath="../core-doc-viewer/"><template><style>core-doc-toc{display:none;width:332px;overflow-x:hidden}</style><context-free-parser url="{{url}}" on-data-ready="{{parserDataReady}}"></context-free-parser><template repeat="{{sources}}"><context-free-parser url="{{}}" on-data-ready="{{parserDataReady}}"></context-free-parser></template><core-doc-toc id="toc" data="{{classes}}" selected="{{selected}}"></core-doc-toc><core-doc-page flex="" data="{{data}}"></core-doc-page></template><script>Polymer("core-doc-viewer",{classes:[],sources:[],ready:function(){window.addEventListener("hashchange",this.parseLocationHash.bind(this));this.parseLocationHash()},parseLocationHash:function(){this.route=window.location.hash.slice(1)},routeChanged:function(){this.validateRoute()},validateRoute:function(){if(this.route){this.classes.some(function(c){if(c.name===this.route.split(".")[0]){this.data=c;this.route="";return}},this)}},selectedChanged:function(){this.data=this.classes[this.selected]},parserDataReady:function(event,detail,sender){var path="";if(this.sources.length){var path=event.target.templateInstance.model;var idx=path.lastIndexOf("/");path=idx!=-1?path.substr(0,idx):"."}else{var parts=location.pathname.split("/");parts.pop();path=parts.join("/")}var data=event.target.data;var xhr=new XMLHttpRequest;xhr.open("GET",path+"/bower.json");xhr.onerror=function(e){this.assimilateData(data)}.bind(this);xhr.onloadend=function(e){if(e.target.status==200){var version=JSON.parse(e.target.response).version;for(var i=0,c;c=data.classes[i];++i){c.version=version}}this.assimilateData(data)}.bind(this);xhr.send()},assimilateData:function(data){this.classes=this.classes.concat(data.classes);this.classes.sort(function(a,b){var na=a&&a.name.toLowerCase(),nb=b&&b.name.toLowerCase();return na<nb?-1:na==nb?0:1});if(!this.data&&!this.route&&this.classes.length){this.data=this.classes[0]}if(this.classes.length>1){this.$.toc.style.display="block"}this.validateRoute()}});</script></polymer-element></div>
-<div hidden>undefined</div>
-
-<!--
-
-Implements the default landing page for Polymer components.
-
-`<core-component-page>` can render an information page for any component.
-Polymer components use this component in `index.html` to provide the standard landing page.
-
-`<core-component-page>` is _vulcanized_, which means it contains all it's dependencies baked in.
-Therefore, this component is intended to be used only by itself in a page.
-
-This *-dev package contains the raw source and the dependency manifest necessary
-to reconstruct `core-component-page/core-component-page.html` via vulcanize. To vulcanize,
-check out the core-component-page repo alongside this repo and run build.sh. This will
-drop the vulcanize output into `core-component-page/core-component-page.html`.
-
-Note: `<core-component-page>` sets the page title automatically.
-
-@group Polymer Core Elements
-@element core-component-page
-
--->
-
-<polymer-element name="core-component-page" attributes="moduleName sources" layout="" vertical="" assetpath="../core-component-page-dev/"><template><style>:host{font-family:Arial,sans-serif;height:100vh}h2{display:inline-block;margin:8px 6px;vertical-align:middle}.choiceB,.choiceC,.choiceD{color:#fff;font-size:12px;font-weight:700;text-decoration:none;background-color:#4285F4;box-shadow:0 1px 2px 0 rgba(0,0,0,.1);box-shadow:0 0 1px 0 rgba(0,0,0,.1);border-radius:2px;cursor:pointer;display:inline-block;padding:4px 12px 5px 12px;margin:4px 0}.appbar{background-color:#E91E63;color:#fff}</style><core-toolbar class="appbar"><span>{{moduleName}}</span><a class="choiceC" target="_blank" href="../{{moduleName}}/demo.html">demo</a></core-toolbar><core-doc-viewer flex="" url="{{url}}" sources="{{sources}}"></core-doc-viewer></template><script>Polymer("core-component-page",{moduleName:"",sources:[],ready:function(){this.moduleName=this.moduleName||this.findModuleName()},moduleNameChanged:function(){document.title=this.moduleName;this.url=!this.sources.length&&this.moduleName?this.moduleName+".html":""},findModuleName:function(){var path=location.pathname.split("/");var name=path.pop()||path.pop();if(name.indexOf(".html")>=0){name=path.pop()}return name||""}});</script></polymer-element>
diff --git a/chromium/third_party/catapult/tracing/third_party/components/core-component-page/demo.html b/chromium/third_party/catapult/tracing/third_party/components/core-component-page/demo.html
deleted file mode 100644
index 92313c48211..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/core-component-page/demo.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!doctype html>
-<!--
-Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
-The complete set of authors may be found at http://polymer.github.io/AUTHORS
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
--->
-<html>
-<head>
-
- <script src="../webcomponentsjs/webcomponents.js"></script>
- <link rel="import" href="../polymer/polymer.html">
- <link rel="import" href="core-component-page.html">
-
-</head>
-<body unresolved>
-
- <core-component-page></core-component-page>
-
-</body>
-</html>
diff --git a/chromium/third_party/catapult/tracing/third_party/components/core-component-page/index.html b/chromium/third_party/catapult/tracing/third_party/components/core-component-page/index.html
deleted file mode 100644
index 294215a738b..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/core-component-page/index.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!doctype html>
-<!--
-Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
-The complete set of authors may be found at http://polymer.github.io/AUTHORS
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
--->
-<html>
-<head>
-
- <script src="../webcomponentsjs/webcomponents.js"></script>
- <link rel="import" href="../core-component-page/core-component-page.html">
-
-</head>
-<body unresolved>
-
- <core-component-page></core-component-page>
-
-</body>
-</html>
diff --git a/chromium/third_party/catapult/tracing/third_party/components/polymer/.bower.json b/chromium/third_party/catapult/tracing/third_party/components/polymer/.bower.json
deleted file mode 100644
index 5f5e0c1acfd..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/polymer/.bower.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "name": "polymer",
- "description": "Polymer is a new type of library for the web, built on top of Web Components, and designed to leverage the evolving web platform on modern browsers.",
- "homepage": "http://www.polymer-project.org/",
- "keywords": [
- "util",
- "client",
- "browser",
- "web components",
- "web-components"
- ],
- "author": "Polymer Authors <polymer-dev@googlegroups.com>",
- "private": true,
- "dependencies": {
- "core-component-page": "Polymer/core-component-page#^0.5",
- "webcomponentsjs": "Polymer/webcomponentsjs#^0.5"
- },
- "devDependencies": {
- "tools": "Polymer/tools#master",
- "web-component-tester": "Polymer/web-component-tester#^1.4.2"
- },
- "version": "0.5.5",
- "_release": "0.5.5",
- "_resolution": {
- "type": "version",
- "tag": "0.5.5",
- "commit": "b94b680c966fc9ea86bc8f14b3af6f13d77f217a"
- },
- "_source": "git://github.com/Polymer/polymer.git",
- "_target": "~0.5.5",
- "_originalSource": "Polymer/polymer"
-} \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/polymer/README.chromium b/chromium/third_party/catapult/tracing/third_party/components/polymer/README.chromium
deleted file mode 100644
index 80aa4db6604..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/polymer/README.chromium
+++ /dev/null
@@ -1,16 +0,0 @@
-me: polymer
-Short Name: polymer
-URL: http://www.polymer-project.org/
-Version: 0.5.5
-Revision: None
-Date: Mar 24, 2015
-License: BSD
-License File: NOT_SHIPPED
-Security Critical: no
-
-Description:
-Polymer framework.
-
-Local modifications:
- - Removed comment lines with {{var_names}} from polymer.js because of
- breaking GRIT in Chromium. See #854
diff --git a/chromium/third_party/catapult/tracing/third_party/components/polymer/README.md b/chromium/third_party/catapult/tracing/third_party/components/polymer/README.md
deleted file mode 100644
index 2c03674f3db..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/polymer/README.md
+++ /dev/null
@@ -1,21 +0,0 @@
-# Polymer
-
-[![Polymer build status](http://www.polymer-project.org/build/polymer-dev/status.png "Polymer build status")](http://build.chromium.org/p/client.polymer/waterfall)
-
-## Brief Overview
-
-For more detailed info goto [http://polymer-project.org/](http://polymer-project.org/).
-
-Polymer is a new type of library for the web, designed to leverage the existing browser infrastructure to provide the encapsulation and extendability currently only available in JS libraries.
-
-Polymer is based on a set of future technologies, including [Shadow DOM](http://w3c.github.io/webcomponents/spec/shadow/), [Custom Elements](http://w3c.github.io/webcomponents/spec/custom/) and Model Driven Views. Currently these technologies are implemented as polyfills or shims, but as browsers adopt these features natively, the platform code that drives Polymer evacipates, leaving only the value-adds.
-
-## Tools & Testing
-
-For running tests or building minified files, consult the [tooling information](https://www.polymer-project.org/resources/tooling-strategy.html).
-
-## Releases
-
-[Release (tagged) versions](https://github.com/Polymer/polymer/releases) of Polymer include concatenated and minified sources for your convenience.
-
-[![Analytics](https://ga-beacon.appspot.com/UA-39334307-2/Polymer/polymer/README)](https://github.com/igrigorik/ga-beacon)
diff --git a/chromium/third_party/catapult/tracing/third_party/components/polymer/bower.json b/chromium/third_party/catapult/tracing/third_party/components/polymer/bower.json
deleted file mode 100644
index dbc759605bf..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/polymer/bower.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "name": "polymer",
- "description": "Polymer is a new type of library for the web, built on top of Web Components, and designed to leverage the evolving web platform on modern browsers.",
- "homepage": "http://www.polymer-project.org/",
- "keywords": [
- "util",
- "client",
- "browser",
- "web components",
- "web-components"
- ],
- "author": "Polymer Authors <polymer-dev@googlegroups.com>",
- "private": true,
- "dependencies": {
- "core-component-page": "Polymer/core-component-page#^0.5",
- "webcomponentsjs": "Polymer/webcomponentsjs#^0.5"
- },
- "devDependencies": {
- "tools": "Polymer/tools#master",
- "web-component-tester": "Polymer/web-component-tester#^1.4.2"
- },
- "version": "0.5.5"
-} \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/polymer/build.log b/chromium/third_party/catapult/tracing/third_party/components/polymer/build.log
deleted file mode 100644
index 3eef92a1232..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/polymer/build.log
+++ /dev/null
@@ -1,26 +0,0 @@
-BUILD LOG
----------
-Build Time: 2015-02-17T17:25:22
-
-NODEJS INFORMATION
-==================
-nodejs: v0.12.0
-grunt: 0.4.5
-grunt-audit: 1.0.0
-grunt-contrib-concat: 0.5.0
-grunt-contrib-copy: 0.7.0
-grunt-contrib-uglify: 0.6.0
-grunt-string-replace: 1.0.0
-web-component-tester: 1.6.2
-
-REPO REVISIONS
-==============
-polymer-expressions: f2229c2f3db2332aab5c4dba029c17f8bc3f99f2
-polymer-gestures: ccd9dfae58896dff2e4fe9ce123870d321e393d1
-polymer: f53db3fe961a3094844ad46e70e3f721604b0a2b
-
-BUILD HASHES
-============
-dist/polymer.js: 0238138d46a41de3724926295213f1babf66ed41
-dist/polymer.min.js: d5907053e8535c422393aa240e9026ffe0b5fefc
-dist/layout.html: 348d358a91712ecc2f8811efa430fcd954b4590c \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/polymer/layout.html b/chromium/third_party/catapult/tracing/third_party/components/polymer/layout.html
deleted file mode 100644
index d3b7aa76f10..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/polymer/layout.html
+++ /dev/null
@@ -1,286 +0,0 @@
-<!--
-Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-<style shim-shadowdom>
-/*******************************
- Flex Layout
-*******************************/
-
-html /deep/ [layout][horizontal], html /deep/ [layout][vertical] {
- display: -ms-flexbox;
- display: -webkit-flex;
- display: flex;
-}
-
-html /deep/ [layout][horizontal][inline], html /deep/ [layout][vertical][inline] {
- display: -ms-inline-flexbox;
- display: -webkit-inline-flex;
- display: inline-flex;
-}
-
-html /deep/ [layout][horizontal] {
- -ms-flex-direction: row;
- -webkit-flex-direction: row;
- flex-direction: row;
-}
-
-html /deep/ [layout][horizontal][reverse] {
- -ms-flex-direction: row-reverse;
- -webkit-flex-direction: row-reverse;
- flex-direction: row-reverse;
-}
-
-html /deep/ [layout][vertical] {
- -ms-flex-direction: column;
- -webkit-flex-direction: column;
- flex-direction: column;
-}
-
-html /deep/ [layout][vertical][reverse] {
- -ms-flex-direction: column-reverse;
- -webkit-flex-direction: column-reverse;
- flex-direction: column-reverse;
-}
-
-html /deep/ [layout][wrap] {
- -ms-flex-wrap: wrap;
- -webkit-flex-wrap: wrap;
- flex-wrap: wrap;
-}
-
-html /deep/ [layout][wrap-reverse] {
- -ms-flex-wrap: wrap-reverse;
- -webkit-flex-wrap: wrap-reverse;
- flex-wrap: wrap-reverse;
-}
-
-html /deep/ [flex] {
- -ms-flex: 1 1 0.000000001px;
- -webkit-flex: 1;
- flex: 1;
- -webkit-flex-basis: 0.000000001px;
- flex-basis: 0.000000001px;
-}
-
-html /deep/ [vertical][layout] > [flex][auto-vertical], html /deep/ [vertical][layout]::shadow [flex][auto-vertical] {
- -ms-flex: 1 1 auto;
- -webkit-flex-basis: auto;
- flex-basis: auto;
-}
-
-html /deep/ [flex][auto] {
- -ms-flex: 1 1 auto;
- -webkit-flex-basis: auto;
- flex-basis: auto;
-}
-
-html /deep/ [flex][none] {
- -ms-flex: none;
- -webkit-flex: none;
- flex: none;
-}
-
-html /deep/ [flex][one] {
- -ms-flex: 1;
- -webkit-flex: 1;
- flex: 1;
-}
-
-html /deep/ [flex][two] {
- -ms-flex: 2;
- -webkit-flex: 2;
- flex: 2;
-}
-
-html /deep/ [flex][three] {
- -ms-flex: 3;
- -webkit-flex: 3;
- flex: 3;
-}
-
-html /deep/ [flex][four] {
- -ms-flex: 4;
- -webkit-flex: 4;
- flex: 4;
-}
-
-html /deep/ [flex][five] {
- -ms-flex: 5;
- -webkit-flex: 5;
- flex: 5;
-}
-
-html /deep/ [flex][six] {
- -ms-flex: 6;
- -webkit-flex: 6;
- flex: 6;
-}
-
-html /deep/ [flex][seven] {
- -ms-flex: 7;
- -webkit-flex: 7;
- flex: 7;
-}
-
-html /deep/ [flex][eight] {
- -ms-flex: 8;
- -webkit-flex: 8;
- flex: 8;
-}
-
-html /deep/ [flex][nine] {
- -ms-flex: 9;
- -webkit-flex: 9;
- flex: 9;
-}
-
-html /deep/ [flex][ten] {
- -ms-flex: 10;
- -webkit-flex: 10;
- flex: 10;
-}
-
-html /deep/ [flex][eleven] {
- -ms-flex: 11;
- -webkit-flex: 11;
- flex: 11;
-}
-
-html /deep/ [flex][twelve] {
- -ms-flex: 12;
- -webkit-flex: 12;
- flex: 12;
-}
-
-/* alignment in cross axis */
-
-html /deep/ [layout][start] {
- -ms-flex-align: start;
- -webkit-align-items: flex-start;
- align-items: flex-start;
-}
-
-html /deep/ [layout][center], html /deep/ [layout][center-center] {
- -ms-flex-align: center;
- -webkit-align-items: center;
- align-items: center;
-}
-
-html /deep/ [layout][end] {
- -ms-flex-align: end;
- -webkit-align-items: flex-end;
- align-items: flex-end;
-}
-
-/* alignment in main axis */
-
-html /deep/ [layout][start-justified] {
- -ms-flex-pack: start;
- -webkit-justify-content: flex-start;
- justify-content: flex-start;
-}
-
-html /deep/ [layout][center-justified], html /deep/ [layout][center-center] {
- -ms-flex-pack: center;
- -webkit-justify-content: center;
- justify-content: center;
-}
-
-html /deep/ [layout][end-justified] {
- -ms-flex-pack: end;
- -webkit-justify-content: flex-end;
- justify-content: flex-end;
-}
-
-html /deep/ [layout][around-justified] {
- -ms-flex-pack: distribute;
- -webkit-justify-content: space-around;
- justify-content: space-around;
-}
-
-html /deep/ [layout][justified] {
- -ms-flex-pack: justify;
- -webkit-justify-content: space-between;
- justify-content: space-between;
-}
-
-/* self alignment */
-
-html /deep/ [self-start] {
- -ms-align-self: flex-start;
- -webkit-align-self: flex-start;
- align-self: flex-start;
-}
-
-html /deep/ [self-center] {
- -ms-align-self: center;
- -webkit-align-self: center;
- align-self: center;
-}
-
-html /deep/ [self-end] {
- -ms-align-self: flex-end;
- -webkit-align-self: flex-end;
- align-self: flex-end;
-}
-
-html /deep/ [self-stretch] {
- -ms-align-self: stretch;
- -webkit-align-self: stretch;
- align-self: stretch;
-}
-
-/*******************************
- Other Layout
-*******************************/
-
-html /deep/ [block] {
- display: block;
-}
-
-/* ie support for hidden */
-html /deep/ [hidden] {
- display: none !important;
-}
-
-html /deep/ [relative] {
- position: relative;
-}
-
-html /deep/ [fit] {
- position: absolute;
- top: 0;
- right: 0;
- bottom: 0;
- left: 0;
-}
-
-body[fullbleed] {
- margin: 0;
- height: 100vh;
-}
-
-/*******************************
- Other
-*******************************/
-
-html /deep/ [segment], html /deep/ segment {
- display: block;
- position: relative;
- -webkit-box-sizing: border-box;
- -ms-box-sizing: border-box;
- box-sizing: border-box;
- margin: 1em 0.5em;
- padding: 1em;
- background-color: white;
- -webkit-box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
- box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.1);
- border-radius: 5px 5px 5px 5px;
-}
-
-</style>
diff --git a/chromium/third_party/catapult/tracing/third_party/components/polymer/polymer.html b/chromium/third_party/catapult/tracing/third_party/components/polymer/polymer.html
deleted file mode 100644
index 7e3d8f1e498..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/polymer/polymer.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!--
-Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
-This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-Code distributed by Google as part of the polymer project is also
-subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--->
-
-<link rel="import" href="layout.html">
-
-<script src="polymer.js"></script>
diff --git a/chromium/third_party/catapult/tracing/third_party/components/polymer/polymer.js b/chromium/third_party/catapult/tracing/third_party/components/polymer/polymer.js
deleted file mode 100644
index 3b720aab4f8..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/polymer/polymer.js
+++ /dev/null
@@ -1,11857 +0,0 @@
-/**
- * @license
- * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
- */
-// @version 0.5.5
-window.PolymerGestures = {};
-
-(function(scope) {
- var hasFullPath = false;
-
- // test for full event path support
- var pathTest = document.createElement('meta');
- if (pathTest.createShadowRoot) {
- var sr = pathTest.createShadowRoot();
- var s = document.createElement('span');
- sr.appendChild(s);
- pathTest.addEventListener('testpath', function(ev) {
- if (ev.path) {
- // if the span is in the event path, then path[0] is the real source for all events
- hasFullPath = ev.path[0] === s;
- }
- ev.stopPropagation();
- });
- var ev = new CustomEvent('testpath', {bubbles: true});
- // must add node to DOM to trigger event listener
- document.head.appendChild(pathTest);
- s.dispatchEvent(ev);
- pathTest.parentNode.removeChild(pathTest);
- sr = s = null;
- }
- pathTest = null;
-
- var target = {
- shadow: function(inEl) {
- if (inEl) {
- return inEl.shadowRoot || inEl.webkitShadowRoot;
- }
- },
- canTarget: function(shadow) {
- return shadow && Boolean(shadow.elementFromPoint);
- },
- targetingShadow: function(inEl) {
- var s = this.shadow(inEl);
- if (this.canTarget(s)) {
- return s;
- }
- },
- olderShadow: function(shadow) {
- var os = shadow.olderShadowRoot;
- if (!os) {
- var se = shadow.querySelector('shadow');
- if (se) {
- os = se.olderShadowRoot;
- }
- }
- return os;
- },
- allShadows: function(element) {
- var shadows = [], s = this.shadow(element);
- while(s) {
- shadows.push(s);
- s = this.olderShadow(s);
- }
- return shadows;
- },
- searchRoot: function(inRoot, x, y) {
- var t, st, sr, os;
- if (inRoot) {
- t = inRoot.elementFromPoint(x, y);
- if (t) {
- // found element, check if it has a ShadowRoot
- sr = this.targetingShadow(t);
- } else if (inRoot !== document) {
- // check for sibling roots
- sr = this.olderShadow(inRoot);
- }
- // search other roots, fall back to light dom element
- return this.searchRoot(sr, x, y) || t;
- }
- },
- owner: function(element) {
- if (!element) {
- return document;
- }
- var s = element;
- // walk up until you hit the shadow root or document
- while (s.parentNode) {
- s = s.parentNode;
- }
- // the owner element is expected to be a Document or ShadowRoot
- if (s.nodeType != Node.DOCUMENT_NODE && s.nodeType != Node.DOCUMENT_FRAGMENT_NODE) {
- s = document;
- }
- return s;
- },
- findTarget: function(inEvent) {
- if (hasFullPath && inEvent.path && inEvent.path.length) {
- return inEvent.path[0];
- }
- var x = inEvent.clientX, y = inEvent.clientY;
- // if the listener is in the shadow root, it is much faster to start there
- var s = this.owner(inEvent.target);
- // if x, y is not in this root, fall back to document search
- if (!s.elementFromPoint(x, y)) {
- s = document;
- }
- return this.searchRoot(s, x, y);
- },
- findTouchAction: function(inEvent) {
- var n;
- if (hasFullPath && inEvent.path && inEvent.path.length) {
- var path = inEvent.path;
- for (var i = 0; i < path.length; i++) {
- n = path[i];
- if (n.nodeType === Node.ELEMENT_NODE && n.hasAttribute('touch-action')) {
- return n.getAttribute('touch-action');
- }
- }
- } else {
- n = inEvent.target;
- while(n) {
- if (n.nodeType === Node.ELEMENT_NODE && n.hasAttribute('touch-action')) {
- return n.getAttribute('touch-action');
- }
- n = n.parentNode || n.host;
- }
- }
- // auto is default
- return "auto";
- },
- LCA: function(a, b) {
- if (a === b) {
- return a;
- }
- if (a && !b) {
- return a;
- }
- if (b && !a) {
- return b;
- }
- if (!b && !a) {
- return document;
- }
- // fast case, a is a direct descendant of b or vice versa
- if (a.contains && a.contains(b)) {
- return a;
- }
- if (b.contains && b.contains(a)) {
- return b;
- }
- var adepth = this.depth(a);
- var bdepth = this.depth(b);
- var d = adepth - bdepth;
- if (d >= 0) {
- a = this.walk(a, d);
- } else {
- b = this.walk(b, -d);
- }
- while (a && b && a !== b) {
- a = a.parentNode || a.host;
- b = b.parentNode || b.host;
- }
- return a;
- },
- walk: function(n, u) {
- for (var i = 0; n && (i < u); i++) {
- n = n.parentNode || n.host;
- }
- return n;
- },
- depth: function(n) {
- var d = 0;
- while(n) {
- d++;
- n = n.parentNode || n.host;
- }
- return d;
- },
- deepContains: function(a, b) {
- var common = this.LCA(a, b);
- // if a is the common ancestor, it must "deeply" contain b
- return common === a;
- },
- insideNode: function(node, x, y) {
- var rect = node.getBoundingClientRect();
- return (rect.left <= x) && (x <= rect.right) && (rect.top <= y) && (y <= rect.bottom);
- },
- path: function(event) {
- var p;
- if (hasFullPath && event.path && event.path.length) {
- p = event.path;
- } else {
- p = [];
- var n = this.findTarget(event);
- while (n) {
- p.push(n);
- n = n.parentNode || n.host;
- }
- }
- return p;
- }
- };
- scope.targetFinding = target;
- /**
- * Given an event, finds the "deepest" node that could have been the original target before ShadowDOM retargetting
- *
- * @param {Event} Event An event object with clientX and clientY properties
- * @return {Element} The probable event origninator
- */
- scope.findTarget = target.findTarget.bind(target);
- /**
- * Determines if the "container" node deeply contains the "containee" node, including situations where the "containee" is contained by one or more ShadowDOM
- * roots.
- *
- * @param {Node} container
- * @param {Node} containee
- * @return {Boolean}
- */
- scope.deepContains = target.deepContains.bind(target);
-
- /**
- * Determines if the x/y position is inside the given node.
- *
- * Example:
- *
- * function upHandler(event) {
- * var innode = PolymerGestures.insideNode(event.target, event.clientX, event.clientY);
- * if (innode) {
- * // wait for tap?
- * } else {
- * // tap will never happen
- * }
- * }
- *
- * @param {Node} node
- * @param {Number} x Screen X position
- * @param {Number} y screen Y position
- * @return {Boolean}
- */
- scope.insideNode = target.insideNode;
-
-})(window.PolymerGestures);
-
-(function() {
- function shadowSelector(v) {
- return 'html /deep/ ' + selector(v);
- }
- function selector(v) {
- return '[touch-action="' + v + '"]';
- }
- function rule(v) {
- return '{ -ms-touch-action: ' + v + '; touch-action: ' + v + ';}';
- }
- var attrib2css = [
- 'none',
- 'auto',
- 'pan-x',
- 'pan-y',
- {
- rule: 'pan-x pan-y',
- selectors: [
- 'pan-x pan-y',
- 'pan-y pan-x'
- ]
- },
- 'manipulation'
- ];
- var styles = '';
- // only install stylesheet if the browser has touch action support
- var hasTouchAction = typeof document.head.style.touchAction === 'string';
- // only add shadow selectors if shadowdom is supported
- var hasShadowRoot = !window.ShadowDOMPolyfill && document.head.createShadowRoot;
-
- if (hasTouchAction) {
- attrib2css.forEach(function(r) {
- if (String(r) === r) {
- styles += selector(r) + rule(r) + '\n';
- if (hasShadowRoot) {
- styles += shadowSelector(r) + rule(r) + '\n';
- }
- } else {
- styles += r.selectors.map(selector) + rule(r.rule) + '\n';
- if (hasShadowRoot) {
- styles += r.selectors.map(shadowSelector) + rule(r.rule) + '\n';
- }
- }
- });
-
- var el = document.createElement('style');
- el.textContent = styles;
- document.head.appendChild(el);
- }
-})();
-
-/**
- * This is the constructor for new PointerEvents.
- *
- * New Pointer Events must be given a type, and an optional dictionary of
- * initialization properties.
- *
- * Due to certain platform requirements, events returned from the constructor
- * identify as MouseEvents.
- *
- * @constructor
- * @param {String} inType The type of the event to create.
- * @param {Object} [inDict] An optional dictionary of initial event properties.
- * @return {Event} A new PointerEvent of type `inType` and initialized with properties from `inDict`.
- */
-(function(scope) {
-
- var MOUSE_PROPS = [
- 'bubbles',
- 'cancelable',
- 'view',
- 'detail',
- 'screenX',
- 'screenY',
- 'clientX',
- 'clientY',
- 'ctrlKey',
- 'altKey',
- 'shiftKey',
- 'metaKey',
- 'button',
- 'relatedTarget',
- 'pageX',
- 'pageY'
- ];
-
- var MOUSE_DEFAULTS = [
- false,
- false,
- null,
- null,
- 0,
- 0,
- 0,
- 0,
- false,
- false,
- false,
- false,
- 0,
- null,
- 0,
- 0
- ];
-
- var NOP_FACTORY = function(){ return function(){}; };
-
- var eventFactory = {
- // TODO(dfreedm): this is overridden by tap recognizer, needs review
- preventTap: NOP_FACTORY,
- makeBaseEvent: function(inType, inDict) {
- var e = document.createEvent('Event');
- e.initEvent(inType, inDict.bubbles || false, inDict.cancelable || false);
- e.preventTap = eventFactory.preventTap(e);
- return e;
- },
- makeGestureEvent: function(inType, inDict) {
- inDict = inDict || Object.create(null);
-
- var e = this.makeBaseEvent(inType, inDict);
- for (var i = 0, keys = Object.keys(inDict), k; i < keys.length; i++) {
- k = keys[i];
- if( k !== 'bubbles' && k !== 'cancelable' ) {
- e[k] = inDict[k];
- }
- }
- return e;
- },
- makePointerEvent: function(inType, inDict) {
- inDict = inDict || Object.create(null);
-
- var e = this.makeBaseEvent(inType, inDict);
- // define inherited MouseEvent properties
- for(var i = 2, p; i < MOUSE_PROPS.length; i++) {
- p = MOUSE_PROPS[i];
- e[p] = inDict[p] || MOUSE_DEFAULTS[i];
- }
- e.buttons = inDict.buttons || 0;
-
- // Spec requires that pointers without pressure specified use 0.5 for down
- // state and 0 for up state.
- var pressure = 0;
- if (inDict.pressure) {
- pressure = inDict.pressure;
- } else {
- pressure = e.buttons ? 0.5 : 0;
- }
-
- // add x/y properties aliased to clientX/Y
- e.x = e.clientX;
- e.y = e.clientY;
-
- // define the properties of the PointerEvent interface
- e.pointerId = inDict.pointerId || 0;
- e.width = inDict.width || 0;
- e.height = inDict.height || 0;
- e.pressure = pressure;
- e.tiltX = inDict.tiltX || 0;
- e.tiltY = inDict.tiltY || 0;
- e.pointerType = inDict.pointerType || '';
- e.hwTimestamp = inDict.hwTimestamp || 0;
- e.isPrimary = inDict.isPrimary || false;
- e._source = inDict._source || '';
- return e;
- }
- };
-
- scope.eventFactory = eventFactory;
-})(window.PolymerGestures);
-
-/**
- * This module implements an map of pointer states
- */
-(function(scope) {
- var USE_MAP = window.Map && window.Map.prototype.forEach;
- var POINTERS_FN = function(){ return this.size; };
- function PointerMap() {
- if (USE_MAP) {
- var m = new Map();
- m.pointers = POINTERS_FN;
- return m;
- } else {
- this.keys = [];
- this.values = [];
- }
- }
-
- PointerMap.prototype = {
- set: function(inId, inEvent) {
- var i = this.keys.indexOf(inId);
- if (i > -1) {
- this.values[i] = inEvent;
- } else {
- this.keys.push(inId);
- this.values.push(inEvent);
- }
- },
- has: function(inId) {
- return this.keys.indexOf(inId) > -1;
- },
- 'delete': function(inId) {
- var i = this.keys.indexOf(inId);
- if (i > -1) {
- this.keys.splice(i, 1);
- this.values.splice(i, 1);
- }
- },
- get: function(inId) {
- var i = this.keys.indexOf(inId);
- return this.values[i];
- },
- clear: function() {
- this.keys.length = 0;
- this.values.length = 0;
- },
- // return value, key, map
- forEach: function(callback, thisArg) {
- this.values.forEach(function(v, i) {
- callback.call(thisArg, v, this.keys[i], this);
- }, this);
- },
- pointers: function() {
- return this.keys.length;
- }
- };
-
- scope.PointerMap = PointerMap;
-})(window.PolymerGestures);
-
-(function(scope) {
- var CLONE_PROPS = [
- // MouseEvent
- 'bubbles',
- 'cancelable',
- 'view',
- 'detail',
- 'screenX',
- 'screenY',
- 'clientX',
- 'clientY',
- 'ctrlKey',
- 'altKey',
- 'shiftKey',
- 'metaKey',
- 'button',
- 'relatedTarget',
- // DOM Level 3
- 'buttons',
- // PointerEvent
- 'pointerId',
- 'width',
- 'height',
- 'pressure',
- 'tiltX',
- 'tiltY',
- 'pointerType',
- 'hwTimestamp',
- 'isPrimary',
- // event instance
- 'type',
- 'target',
- 'currentTarget',
- 'which',
- 'pageX',
- 'pageY',
- 'timeStamp',
- // gesture addons
- 'preventTap',
- 'tapPrevented',
- '_source'
- ];
-
- var CLONE_DEFAULTS = [
- // MouseEvent
- false,
- false,
- null,
- null,
- 0,
- 0,
- 0,
- 0,
- false,
- false,
- false,
- false,
- 0,
- null,
- // DOM Level 3
- 0,
- // PointerEvent
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- '',
- 0,
- false,
- // event instance
- '',
- null,
- null,
- 0,
- 0,
- 0,
- 0,
- function(){},
- false
- ];
-
- var HAS_SVG_INSTANCE = (typeof SVGElementInstance !== 'undefined');
-
- var eventFactory = scope.eventFactory;
-
- // set of recognizers to run for the currently handled event
- var currentGestures;
-
- /**
- * This module is for normalizing events. Mouse and Touch events will be
- * collected here, and fire PointerEvents that have the same semantics, no
- * matter the source.
- * Events fired:
- * - pointerdown: a pointing is added
- * - pointerup: a pointer is removed
- * - pointermove: a pointer is moved
- * - pointerover: a pointer crosses into an element
- * - pointerout: a pointer leaves an element
- * - pointercancel: a pointer will no longer generate events
- */
- var dispatcher = {
- IS_IOS: false,
- pointermap: new scope.PointerMap(),
- requiredGestures: new scope.PointerMap(),
- eventMap: Object.create(null),
- // Scope objects for native events.
- // This exists for ease of testing.
- eventSources: Object.create(null),
- eventSourceList: [],
- gestures: [],
- // map gesture event -> {listeners: int, index: gestures[int]}
- dependencyMap: {
- // make sure down and up are in the map to trigger "register"
- down: {listeners: 0, index: -1},
- up: {listeners: 0, index: -1}
- },
- gestureQueue: [],
- /**
- * Add a new event source that will generate pointer events.
- *
- * `inSource` must contain an array of event names named `events`, and
- * functions with the names specified in the `events` array.
- * @param {string} name A name for the event source
- * @param {Object} source A new source of platform events.
- */
- registerSource: function(name, source) {
- var s = source;
- var newEvents = s.events;
- if (newEvents) {
- newEvents.forEach(function(e) {
- if (s[e]) {
- this.eventMap[e] = s[e].bind(s);
- }
- }, this);
- this.eventSources[name] = s;
- this.eventSourceList.push(s);
- }
- },
- registerGesture: function(name, source) {
- var obj = Object.create(null);
- obj.listeners = 0;
- obj.index = this.gestures.length;
- for (var i = 0, g; i < source.exposes.length; i++) {
- g = source.exposes[i].toLowerCase();
- this.dependencyMap[g] = obj;
- }
- this.gestures.push(source);
- },
- register: function(element, initial) {
- var l = this.eventSourceList.length;
- for (var i = 0, es; (i < l) && (es = this.eventSourceList[i]); i++) {
- // call eventsource register
- es.register.call(es, element, initial);
- }
- },
- unregister: function(element) {
- var l = this.eventSourceList.length;
- for (var i = 0, es; (i < l) && (es = this.eventSourceList[i]); i++) {
- // call eventsource register
- es.unregister.call(es, element);
- }
- },
- // EVENTS
- down: function(inEvent) {
- this.requiredGestures.set(inEvent.pointerId, currentGestures);
- this.fireEvent('down', inEvent);
- },
- move: function(inEvent) {
- // pipe move events into gesture queue directly
- inEvent.type = 'move';
- this.fillGestureQueue(inEvent);
- },
- up: function(inEvent) {
- this.fireEvent('up', inEvent);
- this.requiredGestures.delete(inEvent.pointerId);
- },
- cancel: function(inEvent) {
- inEvent.tapPrevented = true;
- this.fireEvent('up', inEvent);
- this.requiredGestures.delete(inEvent.pointerId);
- },
- addGestureDependency: function(node, currentGestures) {
- var gesturesWanted = node._pgEvents;
- if (gesturesWanted && currentGestures) {
- var gk = Object.keys(gesturesWanted);
- for (var i = 0, r, ri, g; i < gk.length; i++) {
- // gesture
- g = gk[i];
- if (gesturesWanted[g] > 0) {
- // lookup gesture recognizer
- r = this.dependencyMap[g];
- // recognizer index
- ri = r ? r.index : -1;
- currentGestures[ri] = true;
- }
- }
- }
- },
- // LISTENER LOGIC
- eventHandler: function(inEvent) {
- // This is used to prevent multiple dispatch of events from
- // platform events. This can happen when two elements in different scopes
- // are set up to create pointer events, which is relevant to Shadow DOM.
-
- var type = inEvent.type;
-
- // only generate the list of desired events on "down"
- if (type === 'touchstart' || type === 'mousedown' || type === 'pointerdown' || type === 'MSPointerDown') {
- if (!inEvent._handledByPG) {
- currentGestures = {};
- }
-
- // in IOS mode, there is only a listener on the document, so this is not re-entrant
- if (this.IS_IOS) {
- var ev = inEvent;
- if (type === 'touchstart') {
- var ct = inEvent.changedTouches[0];
- // set up a fake event to give to the path builder
- ev = {target: inEvent.target, clientX: ct.clientX, clientY: ct.clientY, path: inEvent.path};
- }
- // use event path if available, otherwise build a path from target finding
- var nodes = inEvent.path || scope.targetFinding.path(ev);
- for (var i = 0, n; i < nodes.length; i++) {
- n = nodes[i];
- this.addGestureDependency(n, currentGestures);
- }
- } else {
- this.addGestureDependency(inEvent.currentTarget, currentGestures);
- }
- }
-
- if (inEvent._handledByPG) {
- return;
- }
- var fn = this.eventMap && this.eventMap[type];
- if (fn) {
- fn(inEvent);
- }
- inEvent._handledByPG = true;
- },
- // set up event listeners
- listen: function(target, events) {
- for (var i = 0, l = events.length, e; (i < l) && (e = events[i]); i++) {
- this.addEvent(target, e);
- }
- },
- // remove event listeners
- unlisten: function(target, events) {
- for (var i = 0, l = events.length, e; (i < l) && (e = events[i]); i++) {
- this.removeEvent(target, e);
- }
- },
- addEvent: function(target, eventName) {
- target.addEventListener(eventName, this.boundHandler);
- },
- removeEvent: function(target, eventName) {
- target.removeEventListener(eventName, this.boundHandler);
- },
- // EVENT CREATION AND TRACKING
- /**
- * Creates a new Event of type `inType`, based on the information in
- * `inEvent`.
- *
- * @param {string} inType A string representing the type of event to create
- * @param {Event} inEvent A platform event with a target
- * @return {Event} A PointerEvent of type `inType`
- */
- makeEvent: function(inType, inEvent) {
- var e = eventFactory.makePointerEvent(inType, inEvent);
- e.preventDefault = inEvent.preventDefault;
- e.tapPrevented = inEvent.tapPrevented;
- e._target = e._target || inEvent.target;
- return e;
- },
- // make and dispatch an event in one call
- fireEvent: function(inType, inEvent) {
- var e = this.makeEvent(inType, inEvent);
- return this.dispatchEvent(e);
- },
- /**
- * Returns a snapshot of inEvent, with writable properties.
- *
- * @param {Event} inEvent An event that contains properties to copy.
- * @return {Object} An object containing shallow copies of `inEvent`'s
- * properties.
- */
- cloneEvent: function(inEvent) {
- var eventCopy = Object.create(null), p;
- for (var i = 0; i < CLONE_PROPS.length; i++) {
- p = CLONE_PROPS[i];
- eventCopy[p] = inEvent[p] || CLONE_DEFAULTS[i];
- // Work around SVGInstanceElement shadow tree
- // Return the <use> element that is represented by the instance for Safari, Chrome, IE.
- // This is the behavior implemented by Firefox.
- if (p === 'target' || p === 'relatedTarget') {
- if (HAS_SVG_INSTANCE && eventCopy[p] instanceof SVGElementInstance) {
- eventCopy[p] = eventCopy[p].correspondingUseElement;
- }
- }
- }
- // keep the semantics of preventDefault
- eventCopy.preventDefault = function() {
- inEvent.preventDefault();
- };
- return eventCopy;
- },
- /**
- * Dispatches the event to its target.
- *
- * @param {Event} inEvent The event to be dispatched.
- * @return {Boolean} True if an event handler returns true, false otherwise.
- */
- dispatchEvent: function(inEvent) {
- var t = inEvent._target;
- if (t) {
- t.dispatchEvent(inEvent);
- // clone the event for the gesture system to process
- // clone after dispatch to pick up gesture prevention code
- var clone = this.cloneEvent(inEvent);
- clone.target = t;
- this.fillGestureQueue(clone);
- }
- },
- gestureTrigger: function() {
- // process the gesture queue
- for (var i = 0, e, rg; i < this.gestureQueue.length; i++) {
- e = this.gestureQueue[i];
- rg = e._requiredGestures;
- if (rg) {
- for (var j = 0, g, fn; j < this.gestures.length; j++) {
- // only run recognizer if an element in the source event's path is listening for those gestures
- if (rg[j]) {
- g = this.gestures[j];
- fn = g[e.type];
- if (fn) {
- fn.call(g, e);
- }
- }
- }
- }
- }
- this.gestureQueue.length = 0;
- },
- fillGestureQueue: function(ev) {
- // only trigger the gesture queue once
- if (!this.gestureQueue.length) {
- requestAnimationFrame(this.boundGestureTrigger);
- }
- ev._requiredGestures = this.requiredGestures.get(ev.pointerId);
- this.gestureQueue.push(ev);
- }
- };
- dispatcher.boundHandler = dispatcher.eventHandler.bind(dispatcher);
- dispatcher.boundGestureTrigger = dispatcher.gestureTrigger.bind(dispatcher);
- scope.dispatcher = dispatcher;
-
- /**
- * Listen for `gesture` on `node` with the `handler` function
- *
- * If `handler` is the first listener for `gesture`, the underlying gesture recognizer is then enabled.
- *
- * @param {Element} node
- * @param {string} gesture
- * @return Boolean `gesture` is a valid gesture
- */
- scope.activateGesture = function(node, gesture) {
- var g = gesture.toLowerCase();
- var dep = dispatcher.dependencyMap[g];
- if (dep) {
- var recognizer = dispatcher.gestures[dep.index];
- if (!node._pgListeners) {
- dispatcher.register(node);
- node._pgListeners = 0;
- }
- // TODO(dfreedm): re-evaluate bookkeeping to avoid using attributes
- if (recognizer) {
- var touchAction = recognizer.defaultActions && recognizer.defaultActions[g];
- var actionNode;
- switch(node.nodeType) {
- case Node.ELEMENT_NODE:
- actionNode = node;
- break;
- case Node.DOCUMENT_FRAGMENT_NODE:
- actionNode = node.host;
- break;
- default:
- actionNode = null;
- break;
- }
- if (touchAction && actionNode && !actionNode.hasAttribute('touch-action')) {
- actionNode.setAttribute('touch-action', touchAction);
- }
- }
- if (!node._pgEvents) {
- node._pgEvents = {};
- }
- node._pgEvents[g] = (node._pgEvents[g] || 0) + 1;
- node._pgListeners++;
- }
- return Boolean(dep);
- };
-
- /**
- *
- * Listen for `gesture` from `node` with `handler` function.
- *
- * @param {Element} node
- * @param {string} gesture
- * @param {Function} handler
- * @param {Boolean} capture
- */
- scope.addEventListener = function(node, gesture, handler, capture) {
- if (handler) {
- scope.activateGesture(node, gesture);
- node.addEventListener(gesture, handler, capture);
- }
- };
-
- /**
- * Tears down the gesture configuration for `node`
- *
- * If `handler` is the last listener for `gesture`, the underlying gesture recognizer is disabled.
- *
- * @param {Element} node
- * @param {string} gesture
- * @return Boolean `gesture` is a valid gesture
- */
- scope.deactivateGesture = function(node, gesture) {
- var g = gesture.toLowerCase();
- var dep = dispatcher.dependencyMap[g];
- if (dep) {
- if (node._pgListeners > 0) {
- node._pgListeners--;
- }
- if (node._pgListeners === 0) {
- dispatcher.unregister(node);
- }
- if (node._pgEvents) {
- if (node._pgEvents[g] > 0) {
- node._pgEvents[g]--;
- } else {
- node._pgEvents[g] = 0;
- }
- }
- }
- return Boolean(dep);
- };
-
- /**
- * Stop listening for `gesture` from `node` with `handler` function.
- *
- * @param {Element} node
- * @param {string} gesture
- * @param {Function} handler
- * @param {Boolean} capture
- */
- scope.removeEventListener = function(node, gesture, handler, capture) {
- if (handler) {
- scope.deactivateGesture(node, gesture);
- node.removeEventListener(gesture, handler, capture);
- }
- };
-})(window.PolymerGestures);
-
-(function(scope) {
- var dispatcher = scope.dispatcher;
- var pointermap = dispatcher.pointermap;
- // radius around touchend that swallows mouse events
- var DEDUP_DIST = 25;
-
- var WHICH_TO_BUTTONS = [0, 1, 4, 2];
-
- var currentButtons = 0;
-
- var FIREFOX_LINUX = /Linux.*Firefox\//i;
-
- var HAS_BUTTONS = (function() {
- // firefox on linux returns spec-incorrect values for mouseup.buttons
- // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.buttons#See_also
- // https://codereview.chromium.org/727593003/#msg16
- if (FIREFOX_LINUX.test(navigator.userAgent)) {
- return false;
- }
- try {
- return new MouseEvent('test', {buttons: 1}).buttons === 1;
- } catch (e) {
- return false;
- }
- })();
-
- // handler block for native mouse events
- var mouseEvents = {
- POINTER_ID: 1,
- POINTER_TYPE: 'mouse',
- events: [
- 'mousedown',
- 'mousemove',
- 'mouseup'
- ],
- exposes: [
- 'down',
- 'up',
- 'move'
- ],
- register: function(target) {
- dispatcher.listen(target, this.events);
- },
- unregister: function(target) {
- if (target.nodeType === Node.DOCUMENT_NODE) {
- return;
- }
- dispatcher.unlisten(target, this.events);
- },
- lastTouches: [],
- // collide with the global mouse listener
- isEventSimulatedFromTouch: function(inEvent) {
- var lts = this.lastTouches;
- var x = inEvent.clientX, y = inEvent.clientY;
- for (var i = 0, l = lts.length, t; i < l && (t = lts[i]); i++) {
- // simulated mouse events will be swallowed near a primary touchend
- var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y);
- if (dx <= DEDUP_DIST && dy <= DEDUP_DIST) {
- return true;
- }
- }
- },
- prepareEvent: function(inEvent) {
- var e = dispatcher.cloneEvent(inEvent);
- e.pointerId = this.POINTER_ID;
- e.isPrimary = true;
- e.pointerType = this.POINTER_TYPE;
- e._source = 'mouse';
- if (!HAS_BUTTONS) {
- var type = inEvent.type;
- var bit = WHICH_TO_BUTTONS[inEvent.which] || 0;
- if (type === 'mousedown') {
- currentButtons |= bit;
- } else if (type === 'mouseup') {
- currentButtons &= ~bit;
- }
- e.buttons = currentButtons;
- }
- return e;
- },
- mousedown: function(inEvent) {
- if (!this.isEventSimulatedFromTouch(inEvent)) {
- var p = pointermap.has(this.POINTER_ID);
- var e = this.prepareEvent(inEvent);
- e.target = scope.findTarget(inEvent);
- pointermap.set(this.POINTER_ID, e.target);
- dispatcher.down(e);
- }
- },
- mousemove: function(inEvent) {
- if (!this.isEventSimulatedFromTouch(inEvent)) {
- var target = pointermap.get(this.POINTER_ID);
- if (target) {
- var e = this.prepareEvent(inEvent);
- e.target = target;
- // handle case where we missed a mouseup
- if ((HAS_BUTTONS ? e.buttons : e.which) === 0) {
- if (!HAS_BUTTONS) {
- currentButtons = e.buttons = 0;
- }
- dispatcher.cancel(e);
- this.cleanupMouse(e.buttons);
- } else {
- dispatcher.move(e);
- }
- }
- }
- },
- mouseup: function(inEvent) {
- if (!this.isEventSimulatedFromTouch(inEvent)) {
- var e = this.prepareEvent(inEvent);
- e.relatedTarget = scope.findTarget(inEvent);
- e.target = pointermap.get(this.POINTER_ID);
- dispatcher.up(e);
- this.cleanupMouse(e.buttons);
- }
- },
- cleanupMouse: function(buttons) {
- if (buttons === 0) {
- pointermap.delete(this.POINTER_ID);
- }
- }
- };
-
- scope.mouseEvents = mouseEvents;
-})(window.PolymerGestures);
-
-(function(scope) {
- var dispatcher = scope.dispatcher;
- var allShadows = scope.targetFinding.allShadows.bind(scope.targetFinding);
- var pointermap = dispatcher.pointermap;
- var touchMap = Array.prototype.map.call.bind(Array.prototype.map);
- // This should be long enough to ignore compat mouse events made by touch
- var DEDUP_TIMEOUT = 2500;
- var DEDUP_DIST = 25;
- var CLICK_COUNT_TIMEOUT = 200;
- var HYSTERESIS = 20;
- var ATTRIB = 'touch-action';
- // TODO(dfreedm): disable until http://crbug.com/399765 is resolved
- // var HAS_TOUCH_ACTION = ATTRIB in document.head.style;
- var HAS_TOUCH_ACTION = false;
-
- // handler block for native touch events
- var touchEvents = {
- IS_IOS: false,
- events: [
- 'touchstart',
- 'touchmove',
- 'touchend',
- 'touchcancel'
- ],
- exposes: [
- 'down',
- 'up',
- 'move'
- ],
- register: function(target, initial) {
- if (this.IS_IOS ? initial : !initial) {
- dispatcher.listen(target, this.events);
- }
- },
- unregister: function(target) {
- if (!this.IS_IOS) {
- dispatcher.unlisten(target, this.events);
- }
- },
- scrollTypes: {
- EMITTER: 'none',
- XSCROLLER: 'pan-x',
- YSCROLLER: 'pan-y',
- },
- touchActionToScrollType: function(touchAction) {
- var t = touchAction;
- var st = this.scrollTypes;
- if (t === st.EMITTER) {
- return 'none';
- } else if (t === st.XSCROLLER) {
- return 'X';
- } else if (t === st.YSCROLLER) {
- return 'Y';
- } else {
- return 'XY';
- }
- },
- POINTER_TYPE: 'touch',
- firstTouch: null,
- isPrimaryTouch: function(inTouch) {
- return this.firstTouch === inTouch.identifier;
- },
- setPrimaryTouch: function(inTouch) {
- // set primary touch if there no pointers, or the only pointer is the mouse
- if (pointermap.pointers() === 0 || (pointermap.pointers() === 1 && pointermap.has(1))) {
- this.firstTouch = inTouch.identifier;
- this.firstXY = {X: inTouch.clientX, Y: inTouch.clientY};
- this.firstTarget = inTouch.target;
- this.scrolling = null;
- this.cancelResetClickCount();
- }
- },
- removePrimaryPointer: function(inPointer) {
- if (inPointer.isPrimary) {
- this.firstTouch = null;
- this.firstXY = null;
- this.resetClickCount();
- }
- },
- clickCount: 0,
- resetId: null,
- resetClickCount: function() {
- var fn = function() {
- this.clickCount = 0;
- this.resetId = null;
- }.bind(this);
- this.resetId = setTimeout(fn, CLICK_COUNT_TIMEOUT);
- },
- cancelResetClickCount: function() {
- if (this.resetId) {
- clearTimeout(this.resetId);
- }
- },
- typeToButtons: function(type) {
- var ret = 0;
- if (type === 'touchstart' || type === 'touchmove') {
- ret = 1;
- }
- return ret;
- },
- findTarget: function(touch, id) {
- if (this.currentTouchEvent.type === 'touchstart') {
- if (this.isPrimaryTouch(touch)) {
- var fastPath = {
- clientX: touch.clientX,
- clientY: touch.clientY,
- path: this.currentTouchEvent.path,
- target: this.currentTouchEvent.target
- };
- return scope.findTarget(fastPath);
- } else {
- return scope.findTarget(touch);
- }
- }
- // reuse target we found in touchstart
- return pointermap.get(id);
- },
- touchToPointer: function(inTouch) {
- var cte = this.currentTouchEvent;
- var e = dispatcher.cloneEvent(inTouch);
- // Spec specifies that pointerId 1 is reserved for Mouse.
- // Touch identifiers can start at 0.
- // Add 2 to the touch identifier for compatibility.
- var id = e.pointerId = inTouch.identifier + 2;
- e.target = this.findTarget(inTouch, id);
- e.bubbles = true;
- e.cancelable = true;
- e.detail = this.clickCount;
- e.buttons = this.typeToButtons(cte.type);
- e.width = inTouch.webkitRadiusX || inTouch.radiusX || 0;
- e.height = inTouch.webkitRadiusY || inTouch.radiusY || 0;
- e.pressure = inTouch.webkitForce || inTouch.force || 0.5;
- e.isPrimary = this.isPrimaryTouch(inTouch);
- e.pointerType = this.POINTER_TYPE;
- e._source = 'touch';
- // forward touch preventDefaults
- var self = this;
- e.preventDefault = function() {
- self.scrolling = false;
- self.firstXY = null;
- cte.preventDefault();
- };
- return e;
- },
- processTouches: function(inEvent, inFunction) {
- var tl = inEvent.changedTouches;
- this.currentTouchEvent = inEvent;
- for (var i = 0, t, p; i < tl.length; i++) {
- t = tl[i];
- p = this.touchToPointer(t);
- if (inEvent.type === 'touchstart') {
- pointermap.set(p.pointerId, p.target);
- }
- if (pointermap.has(p.pointerId)) {
- inFunction.call(this, p);
- }
- if (inEvent.type === 'touchend' || inEvent._cancel) {
- this.cleanUpPointer(p);
- }
- }
- },
- // For single axis scrollers, determines whether the element should emit
- // pointer events or behave as a scroller
- shouldScroll: function(inEvent) {
- if (this.firstXY) {
- var ret;
- var touchAction = scope.targetFinding.findTouchAction(inEvent);
- var scrollAxis = this.touchActionToScrollType(touchAction);
- if (scrollAxis === 'none') {
- // this element is a touch-action: none, should never scroll
- ret = false;
- } else if (scrollAxis === 'XY') {
- // this element should always scroll
- ret = true;
- } else {
- var t = inEvent.changedTouches[0];
- // check the intended scroll axis, and other axis
- var a = scrollAxis;
- var oa = scrollAxis === 'Y' ? 'X' : 'Y';
- var da = Math.abs(t['client' + a] - this.firstXY[a]);
- var doa = Math.abs(t['client' + oa] - this.firstXY[oa]);
- // if delta in the scroll axis > delta other axis, scroll instead of
- // making events
- ret = da >= doa;
- }
- return ret;
- }
- },
- findTouch: function(inTL, inId) {
- for (var i = 0, l = inTL.length, t; i < l && (t = inTL[i]); i++) {
- if (t.identifier === inId) {
- return true;
- }
- }
- },
- // In some instances, a touchstart can happen without a touchend. This
- // leaves the pointermap in a broken state.
- // Therefore, on every touchstart, we remove the touches that did not fire a
- // touchend event.
- // To keep state globally consistent, we fire a
- // pointercancel for this "abandoned" touch
- vacuumTouches: function(inEvent) {
- var tl = inEvent.touches;
- // pointermap.pointers() should be < tl.length here, as the touchstart has not
- // been processed yet.
- if (pointermap.pointers() >= tl.length) {
- var d = [];
- pointermap.forEach(function(value, key) {
- // Never remove pointerId == 1, which is mouse.
- // Touch identifiers are 2 smaller than their pointerId, which is the
- // index in pointermap.
- if (key !== 1 && !this.findTouch(tl, key - 2)) {
- var p = value;
- d.push(p);
- }
- }, this);
- d.forEach(function(p) {
- this.cancel(p);
- pointermap.delete(p.pointerId);
- }, this);
- }
- },
- touchstart: function(inEvent) {
- this.vacuumTouches(inEvent);
- this.setPrimaryTouch(inEvent.changedTouches[0]);
- this.dedupSynthMouse(inEvent);
- if (!this.scrolling) {
- this.clickCount++;
- this.processTouches(inEvent, this.down);
- }
- },
- down: function(inPointer) {
- dispatcher.down(inPointer);
- },
- touchmove: function(inEvent) {
- if (HAS_TOUCH_ACTION) {
- // touchevent.cancelable == false is sent when the page is scrolling under native Touch Action in Chrome 36
- // https://groups.google.com/a/chromium.org/d/msg/input-dev/wHnyukcYBcA/b9kmtwM1jJQJ
- if (inEvent.cancelable) {
- this.processTouches(inEvent, this.move);
- }
- } else {
- if (!this.scrolling) {
- if (this.scrolling === null && this.shouldScroll(inEvent)) {
- this.scrolling = true;
- } else {
- this.scrolling = false;
- inEvent.preventDefault();
- this.processTouches(inEvent, this.move);
- }
- } else if (this.firstXY) {
- var t = inEvent.changedTouches[0];
- var dx = t.clientX - this.firstXY.X;
- var dy = t.clientY - this.firstXY.Y;
- var dd = Math.sqrt(dx * dx + dy * dy);
- if (dd >= HYSTERESIS) {
- this.touchcancel(inEvent);
- this.scrolling = true;
- this.firstXY = null;
- }
- }
- }
- },
- move: function(inPointer) {
- dispatcher.move(inPointer);
- },
- touchend: function(inEvent) {
- this.dedupSynthMouse(inEvent);
- this.processTouches(inEvent, this.up);
- },
- up: function(inPointer) {
- inPointer.relatedTarget = scope.findTarget(inPointer);
- dispatcher.up(inPointer);
- },
- cancel: function(inPointer) {
- dispatcher.cancel(inPointer);
- },
- touchcancel: function(inEvent) {
- inEvent._cancel = true;
- this.processTouches(inEvent, this.cancel);
- },
- cleanUpPointer: function(inPointer) {
- pointermap['delete'](inPointer.pointerId);
- this.removePrimaryPointer(inPointer);
- },
- // prevent synth mouse events from creating pointer events
- dedupSynthMouse: function(inEvent) {
- var lts = scope.mouseEvents.lastTouches;
- var t = inEvent.changedTouches[0];
- // only the primary finger will synth mouse events
- if (this.isPrimaryTouch(t)) {
- // remember x/y of last touch
- var lt = {x: t.clientX, y: t.clientY};
- lts.push(lt);
- var fn = (function(lts, lt){
- var i = lts.indexOf(lt);
- if (i > -1) {
- lts.splice(i, 1);
- }
- }).bind(null, lts, lt);
- setTimeout(fn, DEDUP_TIMEOUT);
- }
- }
- };
-
- // prevent "ghost clicks" that come from elements that were removed in a touch handler
- var STOP_PROP_FN = Event.prototype.stopImmediatePropagation || Event.prototype.stopPropagation;
- document.addEventListener('click', function(ev) {
- var x = ev.clientX, y = ev.clientY;
- // check if a click is within DEDUP_DIST px radius of the touchstart
- var closeTo = function(touch) {
- var dx = Math.abs(x - touch.x), dy = Math.abs(y - touch.y);
- return (dx <= DEDUP_DIST && dy <= DEDUP_DIST);
- };
- // if click coordinates are close to touch coordinates, assume the click came from a touch
- var wasTouched = scope.mouseEvents.lastTouches.some(closeTo);
- // if the click came from touch, and the touchstart target is not in the path of the click event,
- // then the touchstart target was probably removed, and the click should be "busted"
- var path = scope.targetFinding.path(ev);
- if (wasTouched) {
- for (var i = 0; i < path.length; i++) {
- if (path[i] === touchEvents.firstTarget) {
- return;
- }
- }
- ev.preventDefault();
- STOP_PROP_FN.call(ev);
- }
- }, true);
-
- scope.touchEvents = touchEvents;
-})(window.PolymerGestures);
-
-(function(scope) {
- var dispatcher = scope.dispatcher;
- var pointermap = dispatcher.pointermap;
- var HAS_BITMAP_TYPE = window.MSPointerEvent && typeof window.MSPointerEvent.MSPOINTER_TYPE_MOUSE === 'number';
- var msEvents = {
- events: [
- 'MSPointerDown',
- 'MSPointerMove',
- 'MSPointerUp',
- 'MSPointerCancel',
- ],
- register: function(target) {
- dispatcher.listen(target, this.events);
- },
- unregister: function(target) {
- if (target.nodeType === Node.DOCUMENT_NODE) {
- return;
- }
- dispatcher.unlisten(target, this.events);
- },
- POINTER_TYPES: [
- '',
- 'unavailable',
- 'touch',
- 'pen',
- 'mouse'
- ],
- prepareEvent: function(inEvent) {
- var e = inEvent;
- e = dispatcher.cloneEvent(inEvent);
- if (HAS_BITMAP_TYPE) {
- e.pointerType = this.POINTER_TYPES[inEvent.pointerType];
- }
- e._source = 'ms';
- return e;
- },
- cleanup: function(id) {
- pointermap['delete'](id);
- },
- MSPointerDown: function(inEvent) {
- var e = this.prepareEvent(inEvent);
- e.target = scope.findTarget(inEvent);
- pointermap.set(inEvent.pointerId, e.target);
- dispatcher.down(e);
- },
- MSPointerMove: function(inEvent) {
- var target = pointermap.get(inEvent.pointerId);
- if (target) {
- var e = this.prepareEvent(inEvent);
- e.target = target;
- dispatcher.move(e);
- }
- },
- MSPointerUp: function(inEvent) {
- var e = this.prepareEvent(inEvent);
- e.relatedTarget = scope.findTarget(inEvent);
- e.target = pointermap.get(e.pointerId);
- dispatcher.up(e);
- this.cleanup(inEvent.pointerId);
- },
- MSPointerCancel: function(inEvent) {
- var e = this.prepareEvent(inEvent);
- e.relatedTarget = scope.findTarget(inEvent);
- e.target = pointermap.get(e.pointerId);
- dispatcher.cancel(e);
- this.cleanup(inEvent.pointerId);
- }
- };
-
- scope.msEvents = msEvents;
-})(window.PolymerGestures);
-
-(function(scope) {
- var dispatcher = scope.dispatcher;
- var pointermap = dispatcher.pointermap;
- var pointerEvents = {
- events: [
- 'pointerdown',
- 'pointermove',
- 'pointerup',
- 'pointercancel'
- ],
- prepareEvent: function(inEvent) {
- var e = dispatcher.cloneEvent(inEvent);
- e._source = 'pointer';
- return e;
- },
- register: function(target) {
- dispatcher.listen(target, this.events);
- },
- unregister: function(target) {
- if (target.nodeType === Node.DOCUMENT_NODE) {
- return;
- }
- dispatcher.unlisten(target, this.events);
- },
- cleanup: function(id) {
- pointermap['delete'](id);
- },
- pointerdown: function(inEvent) {
- var e = this.prepareEvent(inEvent);
- e.target = scope.findTarget(inEvent);
- pointermap.set(e.pointerId, e.target);
- dispatcher.down(e);
- },
- pointermove: function(inEvent) {
- var target = pointermap.get(inEvent.pointerId);
- if (target) {
- var e = this.prepareEvent(inEvent);
- e.target = target;
- dispatcher.move(e);
- }
- },
- pointerup: function(inEvent) {
- var e = this.prepareEvent(inEvent);
- e.relatedTarget = scope.findTarget(inEvent);
- e.target = pointermap.get(e.pointerId);
- dispatcher.up(e);
- this.cleanup(inEvent.pointerId);
- },
- pointercancel: function(inEvent) {
- var e = this.prepareEvent(inEvent);
- e.relatedTarget = scope.findTarget(inEvent);
- e.target = pointermap.get(e.pointerId);
- dispatcher.cancel(e);
- this.cleanup(inEvent.pointerId);
- }
- };
-
- scope.pointerEvents = pointerEvents;
-})(window.PolymerGestures);
-
-/**
- * This module contains the handlers for native platform events.
- * From here, the dispatcher is called to create unified pointer events.
- * Included are touch events (v1), mouse events, and MSPointerEvents.
- */
-(function(scope) {
-
- var dispatcher = scope.dispatcher;
- var nav = window.navigator;
-
- if (window.PointerEvent) {
- dispatcher.registerSource('pointer', scope.pointerEvents);
- } else if (nav.msPointerEnabled) {
- dispatcher.registerSource('ms', scope.msEvents);
- } else {
- dispatcher.registerSource('mouse', scope.mouseEvents);
- if (window.ontouchstart !== undefined) {
- dispatcher.registerSource('touch', scope.touchEvents);
- }
- }
-
- // Work around iOS bugs https://bugs.webkit.org/show_bug.cgi?id=135628 and https://bugs.webkit.org/show_bug.cgi?id=136506
- var ua = navigator.userAgent;
- var IS_IOS = ua.match(/iPad|iPhone|iPod/) && 'ontouchstart' in window;
-
- dispatcher.IS_IOS = IS_IOS;
- scope.touchEvents.IS_IOS = IS_IOS;
-
- dispatcher.register(document, true);
-})(window.PolymerGestures);
-
-/**
- * This event denotes the beginning of a series of tracking events.
- *
- * @module PointerGestures
- * @submodule Events
- * @class trackstart
- */
-/**
- * Pixels moved in the x direction since trackstart.
- * @type Number
- * @property dx
- */
-/**
- * Pixes moved in the y direction since trackstart.
- * @type Number
- * @property dy
- */
-/**
- * Pixels moved in the x direction since the last track.
- * @type Number
- * @property ddx
- */
-/**
- * Pixles moved in the y direction since the last track.
- * @type Number
- * @property ddy
- */
-/**
- * The clientX position of the track gesture.
- * @type Number
- * @property clientX
- */
-/**
- * The clientY position of the track gesture.
- * @type Number
- * @property clientY
- */
-/**
- * The pageX position of the track gesture.
- * @type Number
- * @property pageX
- */
-/**
- * The pageY position of the track gesture.
- * @type Number
- * @property pageY
- */
-/**
- * The screenX position of the track gesture.
- * @type Number
- * @property screenX
- */
-/**
- * The screenY position of the track gesture.
- * @type Number
- * @property screenY
- */
-/**
- * The last x axis direction of the pointer.
- * @type Number
- * @property xDirection
- */
-/**
- * The last y axis direction of the pointer.
- * @type Number
- * @property yDirection
- */
-/**
- * A shared object between all tracking events.
- * @type Object
- * @property trackInfo
- */
-/**
- * The element currently under the pointer.
- * @type Element
- * @property relatedTarget
- */
-/**
- * The type of pointer that make the track gesture.
- * @type String
- * @property pointerType
- */
-/**
- *
- * This event fires for all pointer movement being tracked.
- *
- * @class track
- * @extends trackstart
- */
-/**
- * This event fires when the pointer is no longer being tracked.
- *
- * @class trackend
- * @extends trackstart
- */
-
- (function(scope) {
- var dispatcher = scope.dispatcher;
- var eventFactory = scope.eventFactory;
- var pointermap = new scope.PointerMap();
- var track = {
- events: [
- 'down',
- 'move',
- 'up',
- ],
- exposes: [
- 'trackstart',
- 'track',
- 'trackx',
- 'tracky',
- 'trackend'
- ],
- defaultActions: {
- 'track': 'none',
- 'trackx': 'pan-y',
- 'tracky': 'pan-x'
- },
- WIGGLE_THRESHOLD: 4,
- clampDir: function(inDelta) {
- return inDelta > 0 ? 1 : -1;
- },
- calcPositionDelta: function(inA, inB) {
- var x = 0, y = 0;
- if (inA && inB) {
- x = inB.pageX - inA.pageX;
- y = inB.pageY - inA.pageY;
- }
- return {x: x, y: y};
- },
- fireTrack: function(inType, inEvent, inTrackingData) {
- var t = inTrackingData;
- var d = this.calcPositionDelta(t.downEvent, inEvent);
- var dd = this.calcPositionDelta(t.lastMoveEvent, inEvent);
- if (dd.x) {
- t.xDirection = this.clampDir(dd.x);
- } else if (inType === 'trackx') {
- return;
- }
- if (dd.y) {
- t.yDirection = this.clampDir(dd.y);
- } else if (inType === 'tracky') {
- return;
- }
- var gestureProto = {
- bubbles: true,
- cancelable: true,
- trackInfo: t.trackInfo,
- relatedTarget: inEvent.relatedTarget,
- pointerType: inEvent.pointerType,
- pointerId: inEvent.pointerId,
- _source: 'track'
- };
- if (inType !== 'tracky') {
- gestureProto.x = inEvent.x;
- gestureProto.dx = d.x;
- gestureProto.ddx = dd.x;
- gestureProto.clientX = inEvent.clientX;
- gestureProto.pageX = inEvent.pageX;
- gestureProto.screenX = inEvent.screenX;
- gestureProto.xDirection = t.xDirection;
- }
- if (inType !== 'trackx') {
- gestureProto.dy = d.y;
- gestureProto.ddy = dd.y;
- gestureProto.y = inEvent.y;
- gestureProto.clientY = inEvent.clientY;
- gestureProto.pageY = inEvent.pageY;
- gestureProto.screenY = inEvent.screenY;
- gestureProto.yDirection = t.yDirection;
- }
- var e = eventFactory.makeGestureEvent(inType, gestureProto);
- t.downTarget.dispatchEvent(e);
- },
- down: function(inEvent) {
- if (inEvent.isPrimary && (inEvent.pointerType === 'mouse' ? inEvent.buttons === 1 : true)) {
- var p = {
- downEvent: inEvent,
- downTarget: inEvent.target,
- trackInfo: {},
- lastMoveEvent: null,
- xDirection: 0,
- yDirection: 0,
- tracking: false
- };
- pointermap.set(inEvent.pointerId, p);
- }
- },
- move: function(inEvent) {
- var p = pointermap.get(inEvent.pointerId);
- if (p) {
- if (!p.tracking) {
- var d = this.calcPositionDelta(p.downEvent, inEvent);
- var move = d.x * d.x + d.y * d.y;
- // start tracking only if finger moves more than WIGGLE_THRESHOLD
- if (move > this.WIGGLE_THRESHOLD) {
- p.tracking = true;
- p.lastMoveEvent = p.downEvent;
- this.fireTrack('trackstart', inEvent, p);
- }
- }
- if (p.tracking) {
- this.fireTrack('track', inEvent, p);
- this.fireTrack('trackx', inEvent, p);
- this.fireTrack('tracky', inEvent, p);
- }
- p.lastMoveEvent = inEvent;
- }
- },
- up: function(inEvent) {
- var p = pointermap.get(inEvent.pointerId);
- if (p) {
- if (p.tracking) {
- this.fireTrack('trackend', inEvent, p);
- }
- pointermap.delete(inEvent.pointerId);
- }
- }
- };
- dispatcher.registerGesture('track', track);
- })(window.PolymerGestures);
-
-/**
- * This event is fired when a pointer is held down for 200ms.
- *
- * @module PointerGestures
- * @submodule Events
- * @class hold
- */
-/**
- * Type of pointer that made the holding event.
- * @type String
- * @property pointerType
- */
-/**
- * Screen X axis position of the held pointer
- * @type Number
- * @property clientX
- */
-/**
- * Screen Y axis position of the held pointer
- * @type Number
- * @property clientY
- */
-/**
- * Type of pointer that made the holding event.
- * @type String
- * @property pointerType
- */
-/**
- * This event is fired every 200ms while a pointer is held down.
- *
- * @class holdpulse
- * @extends hold
- */
-/**
- * Milliseconds pointer has been held down.
- * @type Number
- * @property holdTime
- */
-/**
- * This event is fired when a held pointer is released or moved.
- *
- * @class release
- */
-
-(function(scope) {
- var dispatcher = scope.dispatcher;
- var eventFactory = scope.eventFactory;
- var hold = {
- // wait at least HOLD_DELAY ms between hold and pulse events
- HOLD_DELAY: 200,
- // pointer can move WIGGLE_THRESHOLD pixels before not counting as a hold
- WIGGLE_THRESHOLD: 16,
- events: [
- 'down',
- 'move',
- 'up',
- ],
- exposes: [
- 'hold',
- 'holdpulse',
- 'release'
- ],
- heldPointer: null,
- holdJob: null,
- pulse: function() {
- var hold = Date.now() - this.heldPointer.timeStamp;
- var type = this.held ? 'holdpulse' : 'hold';
- this.fireHold(type, hold);
- this.held = true;
- },
- cancel: function() {
- clearInterval(this.holdJob);
- if (this.held) {
- this.fireHold('release');
- }
- this.held = false;
- this.heldPointer = null;
- this.target = null;
- this.holdJob = null;
- },
- down: function(inEvent) {
- if (inEvent.isPrimary && !this.heldPointer) {
- this.heldPointer = inEvent;
- this.target = inEvent.target;
- this.holdJob = setInterval(this.pulse.bind(this), this.HOLD_DELAY);
- }
- },
- up: function(inEvent) {
- if (this.heldPointer && this.heldPointer.pointerId === inEvent.pointerId) {
- this.cancel();
- }
- },
- move: function(inEvent) {
- if (this.heldPointer && this.heldPointer.pointerId === inEvent.pointerId) {
- var x = inEvent.clientX - this.heldPointer.clientX;
- var y = inEvent.clientY - this.heldPointer.clientY;
- if ((x * x + y * y) > this.WIGGLE_THRESHOLD) {
- this.cancel();
- }
- }
- },
- fireHold: function(inType, inHoldTime) {
- var p = {
- bubbles: true,
- cancelable: true,
- pointerType: this.heldPointer.pointerType,
- pointerId: this.heldPointer.pointerId,
- x: this.heldPointer.clientX,
- y: this.heldPointer.clientY,
- _source: 'hold'
- };
- if (inHoldTime) {
- p.holdTime = inHoldTime;
- }
- var e = eventFactory.makeGestureEvent(inType, p);
- this.target.dispatchEvent(e);
- }
- };
- dispatcher.registerGesture('hold', hold);
-})(window.PolymerGestures);
-
-/**
- * This event is fired when a pointer quickly goes down and up, and is used to
- * denote activation.
- *
- * Any gesture event can prevent the tap event from being created by calling
- * `event.preventTap`.
- *
- * Any pointer event can prevent the tap by setting the `tapPrevented` property
- * on itself.
- *
- * @module PointerGestures
- * @submodule Events
- * @class tap
- */
-/**
- * X axis position of the tap.
- * @property x
- * @type Number
- */
-/**
- * Y axis position of the tap.
- * @property y
- * @type Number
- */
-/**
- * Type of the pointer that made the tap.
- * @property pointerType
- * @type String
- */
-(function(scope) {
- var dispatcher = scope.dispatcher;
- var eventFactory = scope.eventFactory;
- var pointermap = new scope.PointerMap();
- var tap = {
- events: [
- 'down',
- 'up'
- ],
- exposes: [
- 'tap'
- ],
- down: function(inEvent) {
- if (inEvent.isPrimary && !inEvent.tapPrevented) {
- pointermap.set(inEvent.pointerId, {
- target: inEvent.target,
- buttons: inEvent.buttons,
- x: inEvent.clientX,
- y: inEvent.clientY
- });
- }
- },
- shouldTap: function(e, downState) {
- var tap = true;
- if (e.pointerType === 'mouse') {
- // only allow left click to tap for mouse
- tap = (e.buttons ^ 1) && (downState.buttons & 1);
- }
- return tap && !e.tapPrevented;
- },
- up: function(inEvent) {
- var start = pointermap.get(inEvent.pointerId);
- if (start && this.shouldTap(inEvent, start)) {
- // up.relatedTarget is target currently under finger
- var t = scope.targetFinding.LCA(start.target, inEvent.relatedTarget);
- if (t) {
- var e = eventFactory.makeGestureEvent('tap', {
- bubbles: true,
- cancelable: true,
- x: inEvent.clientX,
- y: inEvent.clientY,
- detail: inEvent.detail,
- pointerType: inEvent.pointerType,
- pointerId: inEvent.pointerId,
- altKey: inEvent.altKey,
- ctrlKey: inEvent.ctrlKey,
- metaKey: inEvent.metaKey,
- shiftKey: inEvent.shiftKey,
- _source: 'tap'
- });
- t.dispatchEvent(e);
- }
- }
- pointermap.delete(inEvent.pointerId);
- }
- };
- // patch eventFactory to remove id from tap's pointermap for preventTap calls
- eventFactory.preventTap = function(e) {
- return function() {
- e.tapPrevented = true;
- pointermap.delete(e.pointerId);
- };
- };
- dispatcher.registerGesture('tap', tap);
-})(window.PolymerGestures);
-
-/*
- * Basic strategy: find the farthest apart points, use as diameter of circle
- * react to size change and rotation of the chord
- */
-
-/**
- * @module pointer-gestures
- * @submodule Events
- * @class pinch
- */
-/**
- * Scale of the pinch zoom gesture
- * @property scale
- * @type Number
- */
-/**
- * Center X position of pointers causing pinch
- * @property centerX
- * @type Number
- */
-/**
- * Center Y position of pointers causing pinch
- * @property centerY
- * @type Number
- */
-
-/**
- * @module pointer-gestures
- * @submodule Events
- * @class rotate
- */
-/**
- * Angle (in degrees) of rotation. Measured from starting positions of pointers.
- * @property angle
- * @type Number
- */
-/**
- * Center X position of pointers causing rotation
- * @property centerX
- * @type Number
- */
-/**
- * Center Y position of pointers causing rotation
- * @property centerY
- * @type Number
- */
-(function(scope) {
- var dispatcher = scope.dispatcher;
- var eventFactory = scope.eventFactory;
- var pointermap = new scope.PointerMap();
- var RAD_TO_DEG = 180 / Math.PI;
- var pinch = {
- events: [
- 'down',
- 'up',
- 'move',
- 'cancel'
- ],
- exposes: [
- 'pinchstart',
- 'pinch',
- 'pinchend',
- 'rotate'
- ],
- defaultActions: {
- 'pinch': 'none',
- 'rotate': 'none'
- },
- reference: {},
- down: function(inEvent) {
- pointermap.set(inEvent.pointerId, inEvent);
- if (pointermap.pointers() == 2) {
- var points = this.calcChord();
- var angle = this.calcAngle(points);
- this.reference = {
- angle: angle,
- diameter: points.diameter,
- target: scope.targetFinding.LCA(points.a.target, points.b.target)
- };
-
- this.firePinch('pinchstart', points.diameter, points);
- }
- },
- up: function(inEvent) {
- var p = pointermap.get(inEvent.pointerId);
- var num = pointermap.pointers();
- if (p) {
- if (num === 2) {
- // fire 'pinchend' before deleting pointer
- var points = this.calcChord();
- this.firePinch('pinchend', points.diameter, points);
- }
- pointermap.delete(inEvent.pointerId);
- }
- },
- move: function(inEvent) {
- if (pointermap.has(inEvent.pointerId)) {
- pointermap.set(inEvent.pointerId, inEvent);
- if (pointermap.pointers() > 1) {
- this.calcPinchRotate();
- }
- }
- },
- cancel: function(inEvent) {
- this.up(inEvent);
- },
- firePinch: function(type, diameter, points) {
- var zoom = diameter / this.reference.diameter;
- var e = eventFactory.makeGestureEvent(type, {
- bubbles: true,
- cancelable: true,
- scale: zoom,
- centerX: points.center.x,
- centerY: points.center.y,
- _source: 'pinch'
- });
- this.reference.target.dispatchEvent(e);
- },
- fireRotate: function(angle, points) {
- var diff = Math.round((angle - this.reference.angle) % 360);
- var e = eventFactory.makeGestureEvent('rotate', {
- bubbles: true,
- cancelable: true,
- angle: diff,
- centerX: points.center.x,
- centerY: points.center.y,
- _source: 'pinch'
- });
- this.reference.target.dispatchEvent(e);
- },
- calcPinchRotate: function() {
- var points = this.calcChord();
- var diameter = points.diameter;
- var angle = this.calcAngle(points);
- if (diameter != this.reference.diameter) {
- this.firePinch('pinch', diameter, points);
- }
- if (angle != this.reference.angle) {
- this.fireRotate(angle, points);
- }
- },
- calcChord: function() {
- var pointers = [];
- pointermap.forEach(function(p) {
- pointers.push(p);
- });
- var dist = 0;
- // start with at least two pointers
- var points = {a: pointers[0], b: pointers[1]};
- var x, y, d;
- for (var i = 0; i < pointers.length; i++) {
- var a = pointers[i];
- for (var j = i + 1; j < pointers.length; j++) {
- var b = pointers[j];
- x = Math.abs(a.clientX - b.clientX);
- y = Math.abs(a.clientY - b.clientY);
- d = x + y;
- if (d > dist) {
- dist = d;
- points = {a: a, b: b};
- }
- }
- }
- x = Math.abs(points.a.clientX + points.b.clientX) / 2;
- y = Math.abs(points.a.clientY + points.b.clientY) / 2;
- points.center = { x: x, y: y };
- points.diameter = dist;
- return points;
- },
- calcAngle: function(points) {
- var x = points.a.clientX - points.b.clientX;
- var y = points.a.clientY - points.b.clientY;
- return (360 + Math.atan2(y, x) * RAD_TO_DEG) % 360;
- }
- };
- dispatcher.registerGesture('pinch', pinch);
-})(window.PolymerGestures);
-
-(function (global) {
- 'use strict';
-
- var Token,
- TokenName,
- Syntax,
- Messages,
- source,
- index,
- length,
- delegate,
- lookahead,
- state;
-
- Token = {
- BooleanLiteral: 1,
- EOF: 2,
- Identifier: 3,
- Keyword: 4,
- NullLiteral: 5,
- NumericLiteral: 6,
- Punctuator: 7,
- StringLiteral: 8
- };
-
- TokenName = {};
- TokenName[Token.BooleanLiteral] = 'Boolean';
- TokenName[Token.EOF] = '<end>';
- TokenName[Token.Identifier] = 'Identifier';
- TokenName[Token.Keyword] = 'Keyword';
- TokenName[Token.NullLiteral] = 'Null';
- TokenName[Token.NumericLiteral] = 'Numeric';
- TokenName[Token.Punctuator] = 'Punctuator';
- TokenName[Token.StringLiteral] = 'String';
-
- Syntax = {
- ArrayExpression: 'ArrayExpression',
- BinaryExpression: 'BinaryExpression',
- CallExpression: 'CallExpression',
- ConditionalExpression: 'ConditionalExpression',
- EmptyStatement: 'EmptyStatement',
- ExpressionStatement: 'ExpressionStatement',
- Identifier: 'Identifier',
- Literal: 'Literal',
- LabeledStatement: 'LabeledStatement',
- LogicalExpression: 'LogicalExpression',
- MemberExpression: 'MemberExpression',
- ObjectExpression: 'ObjectExpression',
- Program: 'Program',
- Property: 'Property',
- ThisExpression: 'ThisExpression',
- UnaryExpression: 'UnaryExpression'
- };
-
- // Error messages should be identical to V8.
- Messages = {
- UnexpectedToken: 'Unexpected token %0',
- UnknownLabel: 'Undefined label \'%0\'',
- Redeclaration: '%0 \'%1\' has already been declared'
- };
-
- // Ensure the condition is true, otherwise throw an error.
- // This is only to have a better contract semantic, i.e. another safety net
- // to catch a logic error. The condition shall be fulfilled in normal case.
- // Do NOT use this to enforce a certain condition on any user input.
-
- function assert(condition, message) {
- if (!condition) {
- throw new Error('ASSERT: ' + message);
- }
- }
-
- function isDecimalDigit(ch) {
- return (ch >= 48 && ch <= 57); // 0..9
- }
-
-
- // 7.2 White Space
-
- function isWhiteSpace(ch) {
- return (ch === 32) || // space
- (ch === 9) || // tab
- (ch === 0xB) ||
- (ch === 0xC) ||
- (ch === 0xA0) ||
- (ch >= 0x1680 && '\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\uFEFF'.indexOf(String.fromCharCode(ch)) > 0);
- }
-
- // 7.3 Line Terminators
-
- function isLineTerminator(ch) {
- return (ch === 10) || (ch === 13) || (ch === 0x2028) || (ch === 0x2029);
- }
-
- // 7.6 Identifier Names and Identifiers
-
- function isIdentifierStart(ch) {
- return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
- (ch >= 65 && ch <= 90) || // A..Z
- (ch >= 97 && ch <= 122); // a..z
- }
-
- function isIdentifierPart(ch) {
- return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
- (ch >= 65 && ch <= 90) || // A..Z
- (ch >= 97 && ch <= 122) || // a..z
- (ch >= 48 && ch <= 57); // 0..9
- }
-
- // 7.6.1.1 Keywords
-
- function isKeyword(id) {
- return (id === 'this')
- }
-
- // 7.4 Comments
-
- function skipWhitespace() {
- while (index < length && isWhiteSpace(source.charCodeAt(index))) {
- ++index;
- }
- }
-
- function getIdentifier() {
- var start, ch;
-
- start = index++;
- while (index < length) {
- ch = source.charCodeAt(index);
- if (isIdentifierPart(ch)) {
- ++index;
- } else {
- break;
- }
- }
-
- return source.slice(start, index);
- }
-
- function scanIdentifier() {
- var start, id, type;
-
- start = index;
-
- id = getIdentifier();
-
- // There is no keyword or literal with only one character.
- // Thus, it must be an identifier.
- if (id.length === 1) {
- type = Token.Identifier;
- } else if (isKeyword(id)) {
- type = Token.Keyword;
- } else if (id === 'null') {
- type = Token.NullLiteral;
- } else if (id === 'true' || id === 'false') {
- type = Token.BooleanLiteral;
- } else {
- type = Token.Identifier;
- }
-
- return {
- type: type,
- value: id,
- range: [start, index]
- };
- }
-
-
- // 7.7 Punctuators
-
- function scanPunctuator() {
- var start = index,
- code = source.charCodeAt(index),
- code2,
- ch1 = source[index],
- ch2;
-
- switch (code) {
-
- // Check for most common single-character punctuators.
- case 46: // . dot
- case 40: // ( open bracket
- case 41: // ) close bracket
- case 59: // ; semicolon
- case 44: // , comma
- case 123: // { open curly brace
- case 125: // } close curly brace
- case 91: // [
- case 93: // ]
- case 58: // :
- case 63: // ?
- ++index;
- return {
- type: Token.Punctuator,
- value: String.fromCharCode(code),
- range: [start, index]
- };
-
- default:
- code2 = source.charCodeAt(index + 1);
-
- // '=' (char #61) marks an assignment or comparison operator.
- if (code2 === 61) {
- switch (code) {
- case 37: // %
- case 38: // &
- case 42: // *:
- case 43: // +
- case 45: // -
- case 47: // /
- case 60: // <
- case 62: // >
- case 124: // |
- index += 2;
- return {
- type: Token.Punctuator,
- value: String.fromCharCode(code) + String.fromCharCode(code2),
- range: [start, index]
- };
-
- case 33: // !
- case 61: // =
- index += 2;
-
- // !== and ===
- if (source.charCodeAt(index) === 61) {
- ++index;
- }
- return {
- type: Token.Punctuator,
- value: source.slice(start, index),
- range: [start, index]
- };
- default:
- break;
- }
- }
- break;
- }
-
- // Peek more characters.
-
- ch2 = source[index + 1];
-
- // Other 2-character punctuators: && ||
-
- if (ch1 === ch2 && ('&|'.indexOf(ch1) >= 0)) {
- index += 2;
- return {
- type: Token.Punctuator,
- value: ch1 + ch2,
- range: [start, index]
- };
- }
-
- if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
- ++index;
- return {
- type: Token.Punctuator,
- value: ch1,
- range: [start, index]
- };
- }
-
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- // 7.8.3 Numeric Literals
- function scanNumericLiteral() {
- var number, start, ch;
-
- ch = source[index];
- assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),
- 'Numeric literal must start with a decimal digit or a decimal point');
-
- start = index;
- number = '';
- if (ch !== '.') {
- number = source[index++];
- ch = source[index];
-
- // Hex number starts with '0x'.
- // Octal number starts with '0'.
- if (number === '0') {
- // decimal number starts with '0' such as '09' is illegal.
- if (ch && isDecimalDigit(ch.charCodeAt(0))) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
- }
-
- while (isDecimalDigit(source.charCodeAt(index))) {
- number += source[index++];
- }
- ch = source[index];
- }
-
- if (ch === '.') {
- number += source[index++];
- while (isDecimalDigit(source.charCodeAt(index))) {
- number += source[index++];
- }
- ch = source[index];
- }
-
- if (ch === 'e' || ch === 'E') {
- number += source[index++];
-
- ch = source[index];
- if (ch === '+' || ch === '-') {
- number += source[index++];
- }
- if (isDecimalDigit(source.charCodeAt(index))) {
- while (isDecimalDigit(source.charCodeAt(index))) {
- number += source[index++];
- }
- } else {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
- }
-
- if (isIdentifierStart(source.charCodeAt(index))) {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- return {
- type: Token.NumericLiteral,
- value: parseFloat(number),
- range: [start, index]
- };
- }
-
- // 7.8.4 String Literals
-
- function scanStringLiteral() {
- var str = '', quote, start, ch, octal = false;
-
- quote = source[index];
- assert((quote === '\'' || quote === '"'),
- 'String literal must starts with a quote');
-
- start = index;
- ++index;
-
- while (index < length) {
- ch = source[index++];
-
- if (ch === quote) {
- quote = '';
- break;
- } else if (ch === '\\') {
- ch = source[index++];
- if (!ch || !isLineTerminator(ch.charCodeAt(0))) {
- switch (ch) {
- case 'n':
- str += '\n';
- break;
- case 'r':
- str += '\r';
- break;
- case 't':
- str += '\t';
- break;
- case 'b':
- str += '\b';
- break;
- case 'f':
- str += '\f';
- break;
- case 'v':
- str += '\x0B';
- break;
-
- default:
- str += ch;
- break;
- }
- } else {
- if (ch === '\r' && source[index] === '\n') {
- ++index;
- }
- }
- } else if (isLineTerminator(ch.charCodeAt(0))) {
- break;
- } else {
- str += ch;
- }
- }
-
- if (quote !== '') {
- throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
- }
-
- return {
- type: Token.StringLiteral,
- value: str,
- octal: octal,
- range: [start, index]
- };
- }
-
- function isIdentifierName(token) {
- return token.type === Token.Identifier ||
- token.type === Token.Keyword ||
- token.type === Token.BooleanLiteral ||
- token.type === Token.NullLiteral;
- }
-
- function advance() {
- var ch;
-
- skipWhitespace();
-
- if (index >= length) {
- return {
- type: Token.EOF,
- range: [index, index]
- };
- }
-
- ch = source.charCodeAt(index);
-
- // Very common: ( and ) and ;
- if (ch === 40 || ch === 41 || ch === 58) {
- return scanPunctuator();
- }
-
- // String literal starts with single quote (#39) or double quote (#34).
- if (ch === 39 || ch === 34) {
- return scanStringLiteral();
- }
-
- if (isIdentifierStart(ch)) {
- return scanIdentifier();
- }
-
- // Dot (.) char #46 can also start a floating-point number, hence the need
- // to check the next character.
- if (ch === 46) {
- if (isDecimalDigit(source.charCodeAt(index + 1))) {
- return scanNumericLiteral();
- }
- return scanPunctuator();
- }
-
- if (isDecimalDigit(ch)) {
- return scanNumericLiteral();
- }
-
- return scanPunctuator();
- }
-
- function lex() {
- var token;
-
- token = lookahead;
- index = token.range[1];
-
- lookahead = advance();
-
- index = token.range[1];
-
- return token;
- }
-
- function peek() {
- var pos;
-
- pos = index;
- lookahead = advance();
- index = pos;
- }
-
- // Throw an exception
-
- function throwError(token, messageFormat) {
- var error,
- args = Array.prototype.slice.call(arguments, 2),
- msg = messageFormat.replace(
- /%(\d)/g,
- function (whole, index) {
- assert(index < args.length, 'Message reference must be in range');
- return args[index];
- }
- );
-
- error = new Error(msg);
- error.index = index;
- error.description = msg;
- throw error;
- }
-
- // Throw an exception because of the token.
-
- function throwUnexpected(token) {
- throwError(token, Messages.UnexpectedToken, token.value);
- }
-
- // Expect the next token to match the specified punctuator.
- // If not, an exception will be thrown.
-
- function expect(value) {
- var token = lex();
- if (token.type !== Token.Punctuator || token.value !== value) {
- throwUnexpected(token);
- }
- }
-
- // Return true if the next token matches the specified punctuator.
-
- function match(value) {
- return lookahead.type === Token.Punctuator && lookahead.value === value;
- }
-
- // Return true if the next token matches the specified keyword
-
- function matchKeyword(keyword) {
- return lookahead.type === Token.Keyword && lookahead.value === keyword;
- }
-
- function consumeSemicolon() {
- // Catch the very common case first: immediately a semicolon (char #59).
- if (source.charCodeAt(index) === 59) {
- lex();
- return;
- }
-
- skipWhitespace();
-
- if (match(';')) {
- lex();
- return;
- }
-
- if (lookahead.type !== Token.EOF && !match('}')) {
- throwUnexpected(lookahead);
- }
- }
-
- // 11.1.4 Array Initialiser
-
- function parseArrayInitialiser() {
- var elements = [];
-
- expect('[');
-
- while (!match(']')) {
- if (match(',')) {
- lex();
- elements.push(null);
- } else {
- elements.push(parseExpression());
-
- if (!match(']')) {
- expect(',');
- }
- }
- }
-
- expect(']');
-
- return delegate.createArrayExpression(elements);
- }
-
- // 11.1.5 Object Initialiser
-
- function parseObjectPropertyKey() {
- var token;
-
- skipWhitespace();
- token = lex();
-
- // Note: This function is called only from parseObjectProperty(), where
- // EOF and Punctuator tokens are already filtered out.
- if (token.type === Token.StringLiteral || token.type === Token.NumericLiteral) {
- return delegate.createLiteral(token);
- }
-
- return delegate.createIdentifier(token.value);
- }
-
- function parseObjectProperty() {
- var token, key;
-
- token = lookahead;
- skipWhitespace();
-
- if (token.type === Token.EOF || token.type === Token.Punctuator) {
- throwUnexpected(token);
- }
-
- key = parseObjectPropertyKey();
- expect(':');
- return delegate.createProperty('init', key, parseExpression());
- }
-
- function parseObjectInitialiser() {
- var properties = [];
-
- expect('{');
-
- while (!match('}')) {
- properties.push(parseObjectProperty());
-
- if (!match('}')) {
- expect(',');
- }
- }
-
- expect('}');
-
- return delegate.createObjectExpression(properties);
- }
-
- // 11.1.6 The Grouping Operator
-
- function parseGroupExpression() {
- var expr;
-
- expect('(');
-
- expr = parseExpression();
-
- expect(')');
-
- return expr;
- }
-
-
- // 11.1 Primary Expressions
-
- function parsePrimaryExpression() {
- var type, token, expr;
-
- if (match('(')) {
- return parseGroupExpression();
- }
-
- type = lookahead.type;
-
- if (type === Token.Identifier) {
- expr = delegate.createIdentifier(lex().value);
- } else if (type === Token.StringLiteral || type === Token.NumericLiteral) {
- expr = delegate.createLiteral(lex());
- } else if (type === Token.Keyword) {
- if (matchKeyword('this')) {
- lex();
- expr = delegate.createThisExpression();
- }
- } else if (type === Token.BooleanLiteral) {
- token = lex();
- token.value = (token.value === 'true');
- expr = delegate.createLiteral(token);
- } else if (type === Token.NullLiteral) {
- token = lex();
- token.value = null;
- expr = delegate.createLiteral(token);
- } else if (match('[')) {
- expr = parseArrayInitialiser();
- } else if (match('{')) {
- expr = parseObjectInitialiser();
- }
-
- if (expr) {
- return expr;
- }
-
- throwUnexpected(lex());
- }
-
- // 11.2 Left-Hand-Side Expressions
-
- function parseArguments() {
- var args = [];
-
- expect('(');
-
- if (!match(')')) {
- while (index < length) {
- args.push(parseExpression());
- if (match(')')) {
- break;
- }
- expect(',');
- }
- }
-
- expect(')');
-
- return args;
- }
-
- function parseNonComputedProperty() {
- var token;
-
- token = lex();
-
- if (!isIdentifierName(token)) {
- throwUnexpected(token);
- }
-
- return delegate.createIdentifier(token.value);
- }
-
- function parseNonComputedMember() {
- expect('.');
-
- return parseNonComputedProperty();
- }
-
- function parseComputedMember() {
- var expr;
-
- expect('[');
-
- expr = parseExpression();
-
- expect(']');
-
- return expr;
- }
-
- function parseLeftHandSideExpression() {
- var expr, args, property;
-
- expr = parsePrimaryExpression();
-
- while (true) {
- if (match('[')) {
- property = parseComputedMember();
- expr = delegate.createMemberExpression('[', expr, property);
- } else if (match('.')) {
- property = parseNonComputedMember();
- expr = delegate.createMemberExpression('.', expr, property);
- } else if (match('(')) {
- args = parseArguments();
- expr = delegate.createCallExpression(expr, args);
- } else {
- break;
- }
- }
-
- return expr;
- }
-
- // 11.3 Postfix Expressions
-
- var parsePostfixExpression = parseLeftHandSideExpression;
-
- // 11.4 Unary Operators
-
- function parseUnaryExpression() {
- var token, expr;
-
- if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
- expr = parsePostfixExpression();
- } else if (match('+') || match('-') || match('!')) {
- token = lex();
- expr = parseUnaryExpression();
- expr = delegate.createUnaryExpression(token.value, expr);
- } else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
- throwError({}, Messages.UnexpectedToken);
- } else {
- expr = parsePostfixExpression();
- }
-
- return expr;
- }
-
- function binaryPrecedence(token) {
- var prec = 0;
-
- if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {
- return 0;
- }
-
- switch (token.value) {
- case '||':
- prec = 1;
- break;
-
- case '&&':
- prec = 2;
- break;
-
- case '==':
- case '!=':
- case '===':
- case '!==':
- prec = 6;
- break;
-
- case '<':
- case '>':
- case '<=':
- case '>=':
- case 'instanceof':
- prec = 7;
- break;
-
- case 'in':
- prec = 7;
- break;
-
- case '+':
- case '-':
- prec = 9;
- break;
-
- case '*':
- case '/':
- case '%':
- prec = 11;
- break;
-
- default:
- break;
- }
-
- return prec;
- }
-
- // 11.5 Multiplicative Operators
- // 11.6 Additive Operators
- // 11.7 Bitwise Shift Operators
- // 11.8 Relational Operators
- // 11.9 Equality Operators
- // 11.10 Binary Bitwise Operators
- // 11.11 Binary Logical Operators
-
- function parseBinaryExpression() {
- var expr, token, prec, stack, right, operator, left, i;
-
- left = parseUnaryExpression();
-
- token = lookahead;
- prec = binaryPrecedence(token);
- if (prec === 0) {
- return left;
- }
- token.prec = prec;
- lex();
-
- right = parseUnaryExpression();
-
- stack = [left, token, right];
-
- while ((prec = binaryPrecedence(lookahead)) > 0) {
-
- // Reduce: make a binary expression from the three topmost entries.
- while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {
- right = stack.pop();
- operator = stack.pop().value;
- left = stack.pop();
- expr = delegate.createBinaryExpression(operator, left, right);
- stack.push(expr);
- }
-
- // Shift.
- token = lex();
- token.prec = prec;
- stack.push(token);
- expr = parseUnaryExpression();
- stack.push(expr);
- }
-
- // Final reduce to clean-up the stack.
- i = stack.length - 1;
- expr = stack[i];
- while (i > 1) {
- expr = delegate.createBinaryExpression(stack[i - 1].value, stack[i - 2], expr);
- i -= 2;
- }
-
- return expr;
- }
-
-
- // 11.12 Conditional Operator
-
- function parseConditionalExpression() {
- var expr, consequent, alternate;
-
- expr = parseBinaryExpression();
-
- if (match('?')) {
- lex();
- consequent = parseConditionalExpression();
- expect(':');
- alternate = parseConditionalExpression();
-
- expr = delegate.createConditionalExpression(expr, consequent, alternate);
- }
-
- return expr;
- }
-
- // Simplification since we do not support AssignmentExpression.
- var parseExpression = parseConditionalExpression;
-
- // Polymer Syntax extensions
-
- // Filter ::
- // Identifier
- // Identifier "(" ")"
- // Identifier "(" FilterArguments ")"
-
- function parseFilter() {
- var identifier, args;
-
- identifier = lex();
-
- if (identifier.type !== Token.Identifier) {
- throwUnexpected(identifier);
- }
-
- args = match('(') ? parseArguments() : [];
-
- return delegate.createFilter(identifier.value, args);
- }
-
- // Filters ::
- // "|" Filter
- // Filters "|" Filter
-
- function parseFilters() {
- while (match('|')) {
- lex();
- parseFilter();
- }
- }
-
- // TopLevel ::
- // LabelledExpressions
- // AsExpression
- // InExpression
- // FilterExpression
-
- // AsExpression ::
- // FilterExpression as Identifier
-
- // InExpression ::
- // Identifier, Identifier in FilterExpression
- // Identifier in FilterExpression
-
- // FilterExpression ::
- // Expression
- // Expression Filters
-
- function parseTopLevel() {
- skipWhitespace();
- peek();
-
- var expr = parseExpression();
- if (expr) {
- if (lookahead.value === ',' || lookahead.value == 'in' &&
- expr.type === Syntax.Identifier) {
- parseInExpression(expr);
- } else {
- parseFilters();
- if (lookahead.value === 'as') {
- parseAsExpression(expr);
- } else {
- delegate.createTopLevel(expr);
- }
- }
- }
-
- if (lookahead.type !== Token.EOF) {
- throwUnexpected(lookahead);
- }
- }
-
- function parseAsExpression(expr) {
- lex(); // as
- var identifier = lex().value;
- delegate.createAsExpression(expr, identifier);
- }
-
- function parseInExpression(identifier) {
- var indexName;
- if (lookahead.value === ',') {
- lex();
- if (lookahead.type !== Token.Identifier)
- throwUnexpected(lookahead);
- indexName = lex().value;
- }
-
- lex(); // in
- var expr = parseExpression();
- parseFilters();
- delegate.createInExpression(identifier.name, indexName, expr);
- }
-
- function parse(code, inDelegate) {
- delegate = inDelegate;
- source = code;
- index = 0;
- length = source.length;
- lookahead = null;
- state = {
- labelSet: {}
- };
-
- return parseTopLevel();
- }
-
- global.esprima = {
- parse: parse
- };
-})(this);
-
-// Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
-// This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-// The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-// The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-// Code distributed by Google as part of the polymer project is also
-// subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-
-(function (global) {
- 'use strict';
-
- function prepareBinding(expressionText, name, node, filterRegistry) {
- var expression;
- try {
- expression = getExpression(expressionText);
- if (expression.scopeIdent &&
- (node.nodeType !== Node.ELEMENT_NODE ||
- node.tagName !== 'TEMPLATE' ||
- (name !== 'bind' && name !== 'repeat'))) {
- throw Error('as and in can only be used within <template bind/repeat>');
- }
- } catch (ex) {
- console.error('Invalid expression syntax: ' + expressionText, ex);
- return;
- }
-
- return function(model, node, oneTime) {
- var binding = expression.getBinding(model, filterRegistry, oneTime);
- if (expression.scopeIdent && binding) {
- node.polymerExpressionScopeIdent_ = expression.scopeIdent;
- if (expression.indexIdent)
- node.polymerExpressionIndexIdent_ = expression.indexIdent;
- }
-
- return binding;
- }
- }
-
- // TODO(rafaelw): Implement simple LRU.
- var expressionParseCache = Object.create(null);
-
- function getExpression(expressionText) {
- var expression = expressionParseCache[expressionText];
- if (!expression) {
- var delegate = new ASTDelegate();
- esprima.parse(expressionText, delegate);
- expression = new Expression(delegate);
- expressionParseCache[expressionText] = expression;
- }
- return expression;
- }
-
- function Literal(value) {
- this.value = value;
- this.valueFn_ = undefined;
- }
-
- Literal.prototype = {
- valueFn: function() {
- if (!this.valueFn_) {
- var value = this.value;
- this.valueFn_ = function() {
- return value;
- }
- }
-
- return this.valueFn_;
- }
- }
-
- function IdentPath(name) {
- this.name = name;
- this.path = Path.get(name);
- }
-
- IdentPath.prototype = {
- valueFn: function() {
- if (!this.valueFn_) {
- var name = this.name;
- var path = this.path;
- this.valueFn_ = function(model, observer) {
- if (observer)
- observer.addPath(model, path);
-
- return path.getValueFrom(model);
- }
- }
-
- return this.valueFn_;
- },
-
- setValue: function(model, newValue) {
- if (this.path.length == 1)
- model = findScope(model, this.path[0]);
-
- return this.path.setValueFrom(model, newValue);
- }
- };
-
- function MemberExpression(object, property, accessor) {
- this.computed = accessor == '[';
-
- this.dynamicDeps = typeof object == 'function' ||
- object.dynamicDeps ||
- (this.computed && !(property instanceof Literal));
-
- this.simplePath =
- !this.dynamicDeps &&
- (property instanceof IdentPath || property instanceof Literal) &&
- (object instanceof MemberExpression || object instanceof IdentPath);
-
- this.object = this.simplePath ? object : getFn(object);
- this.property = !this.computed || this.simplePath ?
- property : getFn(property);
- }
-
- MemberExpression.prototype = {
- get fullPath() {
- if (!this.fullPath_) {
-
- var parts = this.object instanceof MemberExpression ?
- this.object.fullPath.slice() : [this.object.name];
- parts.push(this.property instanceof IdentPath ?
- this.property.name : this.property.value);
- this.fullPath_ = Path.get(parts);
- }
-
- return this.fullPath_;
- },
-
- valueFn: function() {
- if (!this.valueFn_) {
- var object = this.object;
-
- if (this.simplePath) {
- var path = this.fullPath;
-
- this.valueFn_ = function(model, observer) {
- if (observer)
- observer.addPath(model, path);
-
- return path.getValueFrom(model);
- };
- } else if (!this.computed) {
- var path = Path.get(this.property.name);
-
- this.valueFn_ = function(model, observer, filterRegistry) {
- var context = object(model, observer, filterRegistry);
-
- if (observer)
- observer.addPath(context, path);
-
- return path.getValueFrom(context);
- }
- } else {
- // Computed property.
- var property = this.property;
-
- this.valueFn_ = function(model, observer, filterRegistry) {
- var context = object(model, observer, filterRegistry);
- var propName = property(model, observer, filterRegistry);
- if (observer)
- observer.addPath(context, [propName]);
-
- return context ? context[propName] : undefined;
- };
- }
- }
- return this.valueFn_;
- },
-
- setValue: function(model, newValue) {
- if (this.simplePath) {
- this.fullPath.setValueFrom(model, newValue);
- return newValue;
- }
-
- var object = this.object(model);
- var propName = this.property instanceof IdentPath ? this.property.name :
- this.property(model);
- return object[propName] = newValue;
- }
- };
-
- function Filter(name, args) {
- this.name = name;
- this.args = [];
- for (var i = 0; i < args.length; i++) {
- this.args[i] = getFn(args[i]);
- }
- }
-
- Filter.prototype = {
- transform: function(model, observer, filterRegistry, toModelDirection,
- initialArgs) {
- var context = model;
- var fn = context[this.name];
-
- if (!fn) {
- fn = filterRegistry[this.name];
- if (!fn) {
- console.error('Cannot find function or filter: ' + this.name);
- return;
- }
- }
-
- // If toModelDirection is falsey, then the "normal" (dom-bound) direction
- // is used. Otherwise, it looks for a 'toModel' property function on the
- // object.
- if (toModelDirection) {
- fn = fn.toModel;
- } else if (typeof fn.toDOM == 'function') {
- fn = fn.toDOM;
- }
-
- if (typeof fn != 'function') {
- console.error('Cannot find function or filter: ' + this.name);
- return;
- }
-
- var args = initialArgs || [];
- for (var i = 0; i < this.args.length; i++) {
- args.push(getFn(this.args[i])(model, observer, filterRegistry));
- }
-
- return fn.apply(context, args);
- }
- };
-
- function notImplemented() { throw Error('Not Implemented'); }
-
- var unaryOperators = {
- '+': function(v) { return +v; },
- '-': function(v) { return -v; },
- '!': function(v) { return !v; }
- };
-
- var binaryOperators = {
- '+': function(l, r) { return l+r; },
- '-': function(l, r) { return l-r; },
- '*': function(l, r) { return l*r; },
- '/': function(l, r) { return l/r; },
- '%': function(l, r) { return l%r; },
- '<': function(l, r) { return l<r; },
- '>': function(l, r) { return l>r; },
- '<=': function(l, r) { return l<=r; },
- '>=': function(l, r) { return l>=r; },
- '==': function(l, r) { return l==r; },
- '!=': function(l, r) { return l!=r; },
- '===': function(l, r) { return l===r; },
- '!==': function(l, r) { return l!==r; },
- '&&': function(l, r) { return l&&r; },
- '||': function(l, r) { return l||r; },
- };
-
- function getFn(arg) {
- return typeof arg == 'function' ? arg : arg.valueFn();
- }
-
- function ASTDelegate() {
- this.expression = null;
- this.filters = [];
- this.deps = {};
- this.currentPath = undefined;
- this.scopeIdent = undefined;
- this.indexIdent = undefined;
- this.dynamicDeps = false;
- }
-
- ASTDelegate.prototype = {
- createUnaryExpression: function(op, argument) {
- if (!unaryOperators[op])
- throw Error('Disallowed operator: ' + op);
-
- argument = getFn(argument);
-
- return function(model, observer, filterRegistry) {
- return unaryOperators[op](argument(model, observer, filterRegistry));
- };
- },
-
- createBinaryExpression: function(op, left, right) {
- if (!binaryOperators[op])
- throw Error('Disallowed operator: ' + op);
-
- left = getFn(left);
- right = getFn(right);
-
- switch (op) {
- case '||':
- this.dynamicDeps = true;
- return function(model, observer, filterRegistry) {
- return left(model, observer, filterRegistry) ||
- right(model, observer, filterRegistry);
- };
- case '&&':
- this.dynamicDeps = true;
- return function(model, observer, filterRegistry) {
- return left(model, observer, filterRegistry) &&
- right(model, observer, filterRegistry);
- };
- }
-
- return function(model, observer, filterRegistry) {
- return binaryOperators[op](left(model, observer, filterRegistry),
- right(model, observer, filterRegistry));
- };
- },
-
- createConditionalExpression: function(test, consequent, alternate) {
- test = getFn(test);
- consequent = getFn(consequent);
- alternate = getFn(alternate);
-
- this.dynamicDeps = true;
-
- return function(model, observer, filterRegistry) {
- return test(model, observer, filterRegistry) ?
- consequent(model, observer, filterRegistry) :
- alternate(model, observer, filterRegistry);
- }
- },
-
- createIdentifier: function(name) {
- var ident = new IdentPath(name);
- ident.type = 'Identifier';
- return ident;
- },
-
- createMemberExpression: function(accessor, object, property) {
- var ex = new MemberExpression(object, property, accessor);
- if (ex.dynamicDeps)
- this.dynamicDeps = true;
- return ex;
- },
-
- createCallExpression: function(expression, args) {
- if (!(expression instanceof IdentPath))
- throw Error('Only identifier function invocations are allowed');
-
- var filter = new Filter(expression.name, args);
-
- return function(model, observer, filterRegistry) {
- return filter.transform(model, observer, filterRegistry, false);
- };
- },
-
- createLiteral: function(token) {
- return new Literal(token.value);
- },
-
- createArrayExpression: function(elements) {
- for (var i = 0; i < elements.length; i++)
- elements[i] = getFn(elements[i]);
-
- return function(model, observer, filterRegistry) {
- var arr = []
- for (var i = 0; i < elements.length; i++)
- arr.push(elements[i](model, observer, filterRegistry));
- return arr;
- }
- },
-
- createProperty: function(kind, key, value) {
- return {
- key: key instanceof IdentPath ? key.name : key.value,
- value: value
- };
- },
-
- createObjectExpression: function(properties) {
- for (var i = 0; i < properties.length; i++)
- properties[i].value = getFn(properties[i].value);
-
- return function(model, observer, filterRegistry) {
- var obj = {};
- for (var i = 0; i < properties.length; i++)
- obj[properties[i].key] =
- properties[i].value(model, observer, filterRegistry);
- return obj;
- }
- },
-
- createFilter: function(name, args) {
- this.filters.push(new Filter(name, args));
- },
-
- createAsExpression: function(expression, scopeIdent) {
- this.expression = expression;
- this.scopeIdent = scopeIdent;
- },
-
- createInExpression: function(scopeIdent, indexIdent, expression) {
- this.expression = expression;
- this.scopeIdent = scopeIdent;
- this.indexIdent = indexIdent;
- },
-
- createTopLevel: function(expression) {
- this.expression = expression;
- },
-
- createThisExpression: notImplemented
- }
-
- function ConstantObservable(value) {
- this.value_ = value;
- }
-
- ConstantObservable.prototype = {
- open: function() { return this.value_; },
- discardChanges: function() { return this.value_; },
- deliver: function() {},
- close: function() {},
- }
-
- function Expression(delegate) {
- this.scopeIdent = delegate.scopeIdent;
- this.indexIdent = delegate.indexIdent;
-
- if (!delegate.expression)
- throw Error('No expression found.');
-
- this.expression = delegate.expression;
- getFn(this.expression); // forces enumeration of path dependencies
-
- this.filters = delegate.filters;
- this.dynamicDeps = delegate.dynamicDeps;
- }
-
- Expression.prototype = {
- getBinding: function(model, filterRegistry, oneTime) {
- if (oneTime)
- return this.getValue(model, undefined, filterRegistry);
-
- var observer = new CompoundObserver();
- // captures deps.
- var firstValue = this.getValue(model, observer, filterRegistry);
- var firstTime = true;
- var self = this;
-
- function valueFn() {
- // deps cannot have changed on first value retrieval.
- if (firstTime) {
- firstTime = false;
- return firstValue;
- }
-
- if (self.dynamicDeps)
- observer.startReset();
-
- var value = self.getValue(model,
- self.dynamicDeps ? observer : undefined,
- filterRegistry);
- if (self.dynamicDeps)
- observer.finishReset();
-
- return value;
- }
-
- function setValueFn(newValue) {
- self.setValue(model, newValue, filterRegistry);
- return newValue;
- }
-
- return new ObserverTransform(observer, valueFn, setValueFn, true);
- },
-
- getValue: function(model, observer, filterRegistry) {
- var value = getFn(this.expression)(model, observer, filterRegistry);
- for (var i = 0; i < this.filters.length; i++) {
- value = this.filters[i].transform(model, observer, filterRegistry,
- false, [value]);
- }
-
- return value;
- },
-
- setValue: function(model, newValue, filterRegistry) {
- var count = this.filters ? this.filters.length : 0;
- while (count-- > 0) {
- newValue = this.filters[count].transform(model, undefined,
- filterRegistry, true, [newValue]);
- }
-
- if (this.expression.setValue)
- return this.expression.setValue(model, newValue);
- }
- }
-
- /**
- * Converts a style property name to a css property name. For example:
- * "WebkitUserSelect" to "-webkit-user-select"
- */
- function convertStylePropertyName(name) {
- return String(name).replace(/[A-Z]/g, function(c) {
- return '-' + c.toLowerCase();
- });
- }
-
- var parentScopeName = '@' + Math.random().toString(36).slice(2);
-
- // Single ident paths must bind directly to the appropriate scope object.
- // I.e. Pushed values in two-bindings need to be assigned to the actual model
- // object.
- function findScope(model, prop) {
- while (model[parentScopeName] &&
- !Object.prototype.hasOwnProperty.call(model, prop)) {
- model = model[parentScopeName];
- }
-
- return model;
- }
-
- function isLiteralExpression(pathString) {
- switch (pathString) {
- case '':
- return false;
-
- case 'false':
- case 'null':
- case 'true':
- return true;
- }
-
- if (!isNaN(Number(pathString)))
- return true;
-
- return false;
- };
-
- function PolymerExpressions() {}
-
- PolymerExpressions.prototype = {
- // "built-in" filters
- styleObject: function(value) {
- var parts = [];
- for (var key in value) {
- parts.push(convertStylePropertyName(key) + ': ' + value[key]);
- }
- return parts.join('; ');
- },
-
- tokenList: function(value) {
- var tokens = [];
- for (var key in value) {
- if (value[key])
- tokens.push(key);
- }
- return tokens.join(' ');
- },
-
- // binding delegate API
- prepareInstancePositionChanged: function(template) {
- var indexIdent = template.polymerExpressionIndexIdent_;
- if (!indexIdent)
- return;
-
- return function(templateInstance, index) {
- templateInstance.model[indexIdent] = index;
- };
- },
-
- prepareBinding: function(pathString, name, node) {
- var path = Path.get(pathString);
-
- if (!isLiteralExpression(pathString) && path.valid) {
- if (path.length == 1) {
- return function(model, node, oneTime) {
- if (oneTime)
- return path.getValueFrom(model);
-
- var scope = findScope(model, path[0]);
- return new PathObserver(scope, path);
- };
- }
- return; // bail out early if pathString is simple path.
- }
-
- return prepareBinding(pathString, name, node, this);
- },
-
- prepareInstanceModel: function(template) {
- var scopeName = template.polymerExpressionScopeIdent_;
- if (!scopeName)
- return;
-
- var parentScope = template.templateInstance ?
- template.templateInstance.model :
- template.model;
-
- var indexName = template.polymerExpressionIndexIdent_;
-
- return function(model) {
- return createScopeObject(parentScope, model, scopeName, indexName);
- };
- }
- };
-
- var createScopeObject = ('__proto__' in {}) ?
- function(parentScope, model, scopeName, indexName) {
- var scope = {};
- scope[scopeName] = model;
- scope[indexName] = undefined;
- scope[parentScopeName] = parentScope;
- scope.__proto__ = parentScope;
- return scope;
- } :
- function(parentScope, model, scopeName, indexName) {
- var scope = Object.create(parentScope);
- Object.defineProperty(scope, scopeName,
- { value: model, configurable: true, writable: true });
- Object.defineProperty(scope, indexName,
- { value: undefined, configurable: true, writable: true });
- Object.defineProperty(scope, parentScopeName,
- { value: parentScope, configurable: true, writable: true });
- return scope;
- };
-
- global.PolymerExpressions = PolymerExpressions;
- PolymerExpressions.getExpression = getExpression;
-})(this);
-
-Polymer = {
- version: '0.5.5'
-};
-
-// TODO(sorvell): this ensures Polymer is an object and not a function
-// Platform is currently defining it as a function to allow for async loading
-// of polymer; once we refine the loading process this likely goes away.
-if (typeof window.Polymer === 'function') {
- Polymer = {};
-}
-
-
-(function(scope) {
-
- function withDependencies(task, depends) {
- depends = depends || [];
- if (!depends.map) {
- depends = [depends];
- }
- return task.apply(this, depends.map(marshal));
- }
-
- function module(name, dependsOrFactory, moduleFactory) {
- var module;
- switch (arguments.length) {
- case 0:
- return;
- case 1:
- module = null;
- break;
- case 2:
- // dependsOrFactory is `factory` in this case
- module = dependsOrFactory.apply(this);
- break;
- default:
- // dependsOrFactory is `depends` in this case
- module = withDependencies(moduleFactory, dependsOrFactory);
- break;
- }
- modules[name] = module;
- };
-
- function marshal(name) {
- return modules[name];
- }
-
- var modules = {};
-
- function using(depends, task) {
- HTMLImports.whenImportsReady(function() {
- withDependencies(task, depends);
- });
- };
-
- // exports
-
- scope.marshal = marshal;
- // `module` confuses commonjs detectors
- scope.modularize = module;
- scope.using = using;
-
-})(window);
-
-/*
- Build only script.
-
- Ensures scripts needed for basic x-platform compatibility
- will be run when platform.js is not loaded.
- */
-if (!window.WebComponents) {
-
-/*
- On supported platforms, platform.js is not needed. To retain compatibility
- with the polyfills, we stub out minimal functionality.
- */
-if (!window.WebComponents) {
-
- WebComponents = {
- flush: function() {},
- flags: {log: {}}
- };
-
- Platform = WebComponents;
-
- CustomElements = {
- useNative: true,
- ready: true,
- takeRecords: function() {},
- instanceof: function(obj, base) {
- return obj instanceof base;
- }
- };
-
- HTMLImports = {
- useNative: true
- };
-
-
- addEventListener('HTMLImportsLoaded', function() {
- document.dispatchEvent(
- new CustomEvent('WebComponentsReady', {bubbles: true})
- );
- });
-
-
- // ShadowDOM
- ShadowDOMPolyfill = null;
- wrap = unwrap = function(n){
- return n;
- };
-
-}
-
-/*
- Create polyfill scope and feature detect native support.
-*/
-window.HTMLImports = window.HTMLImports || {flags:{}};
-
-(function(scope) {
-
-/**
- Basic setup and simple module executer. We collect modules and then execute
- the code later, only if it's necessary for polyfilling.
-*/
-var IMPORT_LINK_TYPE = 'import';
-var useNative = Boolean(IMPORT_LINK_TYPE in document.createElement('link'));
-
-/**
- Support `currentScript` on all browsers as `document._currentScript.`
-
- NOTE: We cannot polyfill `document.currentScript` because it's not possible
- both to override and maintain the ability to capture the native value.
- Therefore we choose to expose `_currentScript` both when native imports
- and the polyfill are in use.
-*/
-// NOTE: ShadowDOMPolyfill intrusion.
-var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill);
-var wrap = function(node) {
- return hasShadowDOMPolyfill ? ShadowDOMPolyfill.wrapIfNeeded(node) : node;
-};
-var rootDocument = wrap(document);
-
-var currentScriptDescriptor = {
- get: function() {
- var script = HTMLImports.currentScript || document.currentScript ||
- // NOTE: only works when called in synchronously executing code.
- // readyState should check if `loading` but IE10 is
- // interactive when scripts run so we cheat.
- (document.readyState !== 'complete' ?
- document.scripts[document.scripts.length - 1] : null);
- return wrap(script);
- },
- configurable: true
-};
-
-Object.defineProperty(document, '_currentScript', currentScriptDescriptor);
-Object.defineProperty(rootDocument, '_currentScript', currentScriptDescriptor);
-
-/**
- Add support for the `HTMLImportsLoaded` event and the `HTMLImports.whenReady`
- method. This api is necessary because unlike the native implementation,
- script elements do not force imports to resolve. Instead, users should wrap
- code in either an `HTMLImportsLoaded` hander or after load time in an
- `HTMLImports.whenReady(callback)` call.
-
- NOTE: This module also supports these apis under the native implementation.
- Therefore, if this file is loaded, the same code can be used under both
- the polyfill and native implementation.
- */
-
-var isIE = /Trident/.test(navigator.userAgent);
-
-// call a callback when all HTMLImports in the document at call time
-// (or at least document ready) have loaded.
-// 1. ensure the document is in a ready state (has dom), then
-// 2. watch for loading of imports and call callback when done
-function whenReady(callback, doc) {
- doc = doc || rootDocument;
- // if document is loading, wait and try again
- whenDocumentReady(function() {
- watchImportsLoad(callback, doc);
- }, doc);
-}
-
-// call the callback when the document is in a ready state (has dom)
-var requiredReadyState = isIE ? 'complete' : 'interactive';
-var READY_EVENT = 'readystatechange';
-function isDocumentReady(doc) {
- return (doc.readyState === 'complete' ||
- doc.readyState === requiredReadyState);
-}
-
-// call <callback> when we ensure the document is in a ready state
-function whenDocumentReady(callback, doc) {
- if (!isDocumentReady(doc)) {
- var checkReady = function() {
- if (doc.readyState === 'complete' ||
- doc.readyState === requiredReadyState) {
- doc.removeEventListener(READY_EVENT, checkReady);
- whenDocumentReady(callback, doc);
- }
- };
- doc.addEventListener(READY_EVENT, checkReady);
- } else if (callback) {
- callback();
- }
-}
-
-function markTargetLoaded(event) {
- event.target.__loaded = true;
-}
-
-// call <callback> when we ensure all imports have loaded
-function watchImportsLoad(callback, doc) {
- var imports = doc.querySelectorAll('link[rel=import]');
- var loaded = 0, l = imports.length;
- function checkDone(d) {
- if ((loaded == l) && callback) {
- callback();
- }
- }
- function loadedImport(e) {
- markTargetLoaded(e);
- loaded++;
- checkDone();
- }
- if (l) {
- for (var i=0, imp; (i<l) && (imp=imports[i]); i++) {
- if (isImportLoaded(imp)) {
- loadedImport.call(imp, {target: imp});
- } else {
- imp.addEventListener('load', loadedImport);
- imp.addEventListener('error', loadedImport);
- }
- }
- } else {
- checkDone();
- }
-}
-
-// NOTE: test for native imports loading is based on explicitly watching
-// all imports (see below).
-// However, we cannot rely on this entirely without watching the entire document
-// for import links. For perf reasons, currently only head is watched.
-// Instead, we fallback to checking if the import property is available
-// and the document is not itself loading.
-function isImportLoaded(link) {
- return useNative ? link.__loaded ||
- (link.import && link.import.readyState !== 'loading') :
- link.__importParsed;
-}
-
-// TODO(sorvell): Workaround for
-// https://www.w3.org/Bugs/Public/show_bug.cgi?id=25007, should be removed when
-// this bug is addressed.
-// (1) Install a mutation observer to see when HTMLImports have loaded
-// (2) if this script is run during document load it will watch any existing
-// imports for loading.
-//
-// NOTE: The workaround has restricted functionality: (1) it's only compatible
-// with imports that are added to document.head since the mutation observer
-// watches only head for perf reasons, (2) it requires this script
-// to run before any imports have completed loading.
-if (useNative) {
- new MutationObserver(function(mxns) {
- for (var i=0, l=mxns.length, m; (i < l) && (m=mxns[i]); i++) {
- if (m.addedNodes) {
- handleImports(m.addedNodes);
- }
- }
- }).observe(document.head, {childList: true});
-
- function handleImports(nodes) {
- for (var i=0, l=nodes.length, n; (i<l) && (n=nodes[i]); i++) {
- if (isImport(n)) {
- handleImport(n);
- }
- }
- }
-
- function isImport(element) {
- return element.localName === 'link' && element.rel === 'import';
- }
-
- function handleImport(element) {
- var loaded = element.import;
- if (loaded) {
- markTargetLoaded({target: element});
- } else {
- element.addEventListener('load', markTargetLoaded);
- element.addEventListener('error', markTargetLoaded);
- }
- }
-
- // make sure to catch any imports that are in the process of loading
- // when this script is run.
- (function() {
- if (document.readyState === 'loading') {
- var imports = document.querySelectorAll('link[rel=import]');
- for (var i=0, l=imports.length, imp; (i<l) && (imp=imports[i]); i++) {
- handleImport(imp);
- }
- }
- })();
-
-}
-
-// Fire the 'HTMLImportsLoaded' event when imports in document at load time
-// have loaded. This event is required to simulate the script blocking
-// behavior of native imports. A main document script that needs to be sure
-// imports have loaded should wait for this event.
-whenReady(function() {
- HTMLImports.ready = true;
- HTMLImports.readyTime = new Date().getTime();
- rootDocument.dispatchEvent(
- new CustomEvent('HTMLImportsLoaded', {bubbles: true})
- );
-});
-
-// exports
-scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE;
-scope.useNative = useNative;
-scope.rootDocument = rootDocument;
-scope.whenReady = whenReady;
-scope.isIE = isIE;
-
-})(HTMLImports);
-
-(function(scope) {
-
- // TODO(sorvell): It's desireable to provide a default stylesheet
- // that's convenient for styling unresolved elements, but
- // it's cumbersome to have to include this manually in every page.
- // It would make sense to put inside some HTMLImport but
- // the HTMLImports polyfill does not allow loading of stylesheets
- // that block rendering. Therefore this injection is tolerated here.
- var style = document.createElement('style');
- style.textContent = ''
- + 'body {'
- + 'transition: opacity ease-in 0.2s;'
- + ' } \n'
- + 'body[unresolved] {'
- + 'opacity: 0; display: block; overflow: hidden;'
- + ' } \n'
- ;
- var head = document.querySelector('head');
- head.insertBefore(style, head.firstChild);
-
-})(Platform);
-
-/*
- Build only script.
-
- Ensures scripts needed for basic x-platform compatibility
- will be run when platform.js is not loaded.
- */
-}
-(function(global) {
- 'use strict';
-
- var testingExposeCycleCount = global.testingExposeCycleCount;
-
- // Detect and do basic sanity checking on Object/Array.observe.
- function detectObjectObserve() {
- if (typeof Object.observe !== 'function' ||
- typeof Array.observe !== 'function') {
- return false;
- }
-
- var records = [];
-
- function callback(recs) {
- records = recs;
- }
-
- var test = {};
- var arr = [];
- Object.observe(test, callback);
- Array.observe(arr, callback);
- test.id = 1;
- test.id = 2;
- delete test.id;
- arr.push(1, 2);
- arr.length = 0;
-
- Object.deliverChangeRecords(callback);
- if (records.length !== 5)
- return false;
-
- if (records[0].type != 'add' ||
- records[1].type != 'update' ||
- records[2].type != 'delete' ||
- records[3].type != 'splice' ||
- records[4].type != 'splice') {
- return false;
- }
-
- Object.unobserve(test, callback);
- Array.unobserve(arr, callback);
-
- return true;
- }
-
- var hasObserve = detectObjectObserve();
-
- function detectEval() {
- // Don't test for eval if we're running in a Chrome App environment.
- // We check for APIs set that only exist in a Chrome App context.
- if (typeof chrome !== 'undefined' && chrome.app && chrome.app.runtime) {
- return false;
- }
-
- // Firefox OS Apps do not allow eval. This feature detection is very hacky
- // but even if some other platform adds support for this function this code
- // will continue to work.
- if (typeof navigator != 'undefined' && navigator.getDeviceStorage) {
- return false;
- }
-
- try {
- var f = new Function('', 'return true;');
- return f();
- } catch (ex) {
- return false;
- }
- }
-
- var hasEval = detectEval();
-
- function isIndex(s) {
- return +s === s >>> 0 && s !== '';
- }
-
- function toNumber(s) {
- return +s;
- }
-
- function isObject(obj) {
- return obj === Object(obj);
- }
-
- var numberIsNaN = global.Number.isNaN || function(value) {
- return typeof value === 'number' && global.isNaN(value);
- }
-
- function areSameValue(left, right) {
- if (left === right)
- return left !== 0 || 1 / left === 1 / right;
- if (numberIsNaN(left) && numberIsNaN(right))
- return true;
-
- return left !== left && right !== right;
- }
-
- var createObject = ('__proto__' in {}) ?
- function(obj) { return obj; } :
- function(obj) {
- var proto = obj.__proto__;
- if (!proto)
- return obj;
- var newObject = Object.create(proto);
- Object.getOwnPropertyNames(obj).forEach(function(name) {
- Object.defineProperty(newObject, name,
- Object.getOwnPropertyDescriptor(obj, name));
- });
- return newObject;
- };
-
- var identStart = '[\$_a-zA-Z]';
- var identPart = '[\$_a-zA-Z0-9]';
- var identRegExp = new RegExp('^' + identStart + '+' + identPart + '*' + '$');
-
- function getPathCharType(char) {
- if (char === undefined)
- return 'eof';
-
- var code = char.charCodeAt(0);
-
- switch(code) {
- case 0x5B: // [
- case 0x5D: // ]
- case 0x2E: // .
- case 0x22: // "
- case 0x27: // '
- case 0x30: // 0
- return char;
-
- case 0x5F: // _
- case 0x24: // $
- return 'ident';
-
- case 0x20: // Space
- case 0x09: // Tab
- case 0x0A: // Newline
- case 0x0D: // Return
- case 0xA0: // No-break space
- case 0xFEFF: // Byte Order Mark
- case 0x2028: // Line Separator
- case 0x2029: // Paragraph Separator
- return 'ws';
- }
-
- // a-z, A-Z
- if ((0x61 <= code && code <= 0x7A) || (0x41 <= code && code <= 0x5A))
- return 'ident';
-
- // 1-9
- if (0x31 <= code && code <= 0x39)
- return 'number';
-
- return 'else';
- }
-
- var pathStateMachine = {
- 'beforePath': {
- 'ws': ['beforePath'],
- 'ident': ['inIdent', 'append'],
- '[': ['beforeElement'],
- 'eof': ['afterPath']
- },
-
- 'inPath': {
- 'ws': ['inPath'],
- '.': ['beforeIdent'],
- '[': ['beforeElement'],
- 'eof': ['afterPath']
- },
-
- 'beforeIdent': {
- 'ws': ['beforeIdent'],
- 'ident': ['inIdent', 'append']
- },
-
- 'inIdent': {
- 'ident': ['inIdent', 'append'],
- '0': ['inIdent', 'append'],
- 'number': ['inIdent', 'append'],
- 'ws': ['inPath', 'push'],
- '.': ['beforeIdent', 'push'],
- '[': ['beforeElement', 'push'],
- 'eof': ['afterPath', 'push']
- },
-
- 'beforeElement': {
- 'ws': ['beforeElement'],
- '0': ['afterZero', 'append'],
- 'number': ['inIndex', 'append'],
- "'": ['inSingleQuote', 'append', ''],
- '"': ['inDoubleQuote', 'append', '']
- },
-
- 'afterZero': {
- 'ws': ['afterElement', 'push'],
- ']': ['inPath', 'push']
- },
-
- 'inIndex': {
- '0': ['inIndex', 'append'],
- 'number': ['inIndex', 'append'],
- 'ws': ['afterElement'],
- ']': ['inPath', 'push']
- },
-
- 'inSingleQuote': {
- "'": ['afterElement'],
- 'eof': ['error'],
- 'else': ['inSingleQuote', 'append']
- },
-
- 'inDoubleQuote': {
- '"': ['afterElement'],
- 'eof': ['error'],
- 'else': ['inDoubleQuote', 'append']
- },
-
- 'afterElement': {
- 'ws': ['afterElement'],
- ']': ['inPath', 'push']
- }
- }
-
- function noop() {}
-
- function parsePath(path) {
- var keys = [];
- var index = -1;
- var c, newChar, key, type, transition, action, typeMap, mode = 'beforePath';
-
- var actions = {
- push: function() {
- if (key === undefined)
- return;
-
- keys.push(key);
- key = undefined;
- },
-
- append: function() {
- if (key === undefined)
- key = newChar
- else
- key += newChar;
- }
- };
-
- function maybeUnescapeQuote() {
- if (index >= path.length)
- return;
-
- var nextChar = path[index + 1];
- if ((mode == 'inSingleQuote' && nextChar == "'") ||
- (mode == 'inDoubleQuote' && nextChar == '"')) {
- index++;
- newChar = nextChar;
- actions.append();
- return true;
- }
- }
-
- while (mode) {
- index++;
- c = path[index];
-
- if (c == '\\' && maybeUnescapeQuote(mode))
- continue;
-
- type = getPathCharType(c);
- typeMap = pathStateMachine[mode];
- transition = typeMap[type] || typeMap['else'] || 'error';
-
- if (transition == 'error')
- return; // parse error;
-
- mode = transition[0];
- action = actions[transition[1]] || noop;
- newChar = transition[2] === undefined ? c : transition[2];
- action();
-
- if (mode === 'afterPath') {
- return keys;
- }
- }
-
- return; // parse error
- }
-
- function isIdent(s) {
- return identRegExp.test(s);
- }
-
- var constructorIsPrivate = {};
-
- function Path(parts, privateToken) {
- if (privateToken !== constructorIsPrivate)
- throw Error('Use Path.get to retrieve path objects');
-
- for (var i = 0; i < parts.length; i++) {
- this.push(String(parts[i]));
- }
-
- if (hasEval && this.length) {
- this.getValueFrom = this.compiledGetValueFromFn();
- }
- }
-
- // TODO(rafaelw): Make simple LRU cache
- var pathCache = {};
-
- function getPath(pathString) {
- if (pathString instanceof Path)
- return pathString;
-
- if (pathString == null || pathString.length == 0)
- pathString = '';
-
- if (typeof pathString != 'string') {
- if (isIndex(pathString.length)) {
- // Constructed with array-like (pre-parsed) keys
- return new Path(pathString, constructorIsPrivate);
- }
-
- pathString = String(pathString);
- }
-
- var path = pathCache[pathString];
- if (path)
- return path;
-
- var parts = parsePath(pathString);
- if (!parts)
- return invalidPath;
-
- var path = new Path(parts, constructorIsPrivate);
- pathCache[pathString] = path;
- return path;
- }
-
- Path.get = getPath;
-
- function formatAccessor(key) {
- if (isIndex(key)) {
- return '[' + key + ']';
- } else {
- return '["' + key.replace(/"/g, '\\"') + '"]';
- }
- }
-
- Path.prototype = createObject({
- __proto__: [],
- valid: true,
-
- toString: function() {
- var pathString = '';
- for (var i = 0; i < this.length; i++) {
- var key = this[i];
- if (isIdent(key)) {
- pathString += i ? '.' + key : key;
- } else {
- pathString += formatAccessor(key);
- }
- }
-
- return pathString;
- },
-
- getValueFrom: function(obj, directObserver) {
- for (var i = 0; i < this.length; i++) {
- if (obj == null)
- return;
- obj = obj[this[i]];
- }
- return obj;
- },
-
- iterateObjects: function(obj, observe) {
- for (var i = 0; i < this.length; i++) {
- if (i)
- obj = obj[this[i - 1]];
- if (!isObject(obj))
- return;
- observe(obj, this[i]);
- }
- },
-
- compiledGetValueFromFn: function() {
- var str = '';
- var pathString = 'obj';
- str += 'if (obj != null';
- var i = 0;
- var key;
- for (; i < (this.length - 1); i++) {
- key = this[i];
- pathString += isIdent(key) ? '.' + key : formatAccessor(key);
- str += ' &&\n ' + pathString + ' != null';
- }
- str += ')\n';
-
- var key = this[i];
- pathString += isIdent(key) ? '.' + key : formatAccessor(key);
-
- str += ' return ' + pathString + ';\nelse\n return undefined;';
- return new Function('obj', str);
- },
-
- setValueFrom: function(obj, value) {
- if (!this.length)
- return false;
-
- for (var i = 0; i < this.length - 1; i++) {
- if (!isObject(obj))
- return false;
- obj = obj[this[i]];
- }
-
- if (!isObject(obj))
- return false;
-
- obj[this[i]] = value;
- return true;
- }
- });
-
- var invalidPath = new Path('', constructorIsPrivate);
- invalidPath.valid = false;
- invalidPath.getValueFrom = invalidPath.setValueFrom = function() {};
-
- var MAX_DIRTY_CHECK_CYCLES = 1000;
-
- function dirtyCheck(observer) {
- var cycles = 0;
- while (cycles < MAX_DIRTY_CHECK_CYCLES && observer.check_()) {
- cycles++;
- }
- if (testingExposeCycleCount)
- global.dirtyCheckCycleCount = cycles;
-
- return cycles > 0;
- }
-
- function objectIsEmpty(object) {
- for (var prop in object)
- return false;
- return true;
- }
-
- function diffIsEmpty(diff) {
- return objectIsEmpty(diff.added) &&
- objectIsEmpty(diff.removed) &&
- objectIsEmpty(diff.changed);
- }
-
- function diffObjectFromOldObject(object, oldObject) {
- var added = {};
- var removed = {};
- var changed = {};
-
- for (var prop in oldObject) {
- var newValue = object[prop];
-
- if (newValue !== undefined && newValue === oldObject[prop])
- continue;
-
- if (!(prop in object)) {
- removed[prop] = undefined;
- continue;
- }
-
- if (newValue !== oldObject[prop])
- changed[prop] = newValue;
- }
-
- for (var prop in object) {
- if (prop in oldObject)
- continue;
-
- added[prop] = object[prop];
- }
-
- if (Array.isArray(object) && object.length !== oldObject.length)
- changed.length = object.length;
-
- return {
- added: added,
- removed: removed,
- changed: changed
- };
- }
-
- var eomTasks = [];
- function runEOMTasks() {
- if (!eomTasks.length)
- return false;
-
- for (var i = 0; i < eomTasks.length; i++) {
- eomTasks[i]();
- }
- eomTasks.length = 0;
- return true;
- }
-
- var runEOM = hasObserve ? (function(){
- return function(fn) {
- return Promise.resolve().then(fn);
- }
- })() :
- (function() {
- return function(fn) {
- eomTasks.push(fn);
- };
- })();
-
- var observedObjectCache = [];
-
- function newObservedObject() {
- var observer;
- var object;
- var discardRecords = false;
- var first = true;
-
- function callback(records) {
- if (observer && observer.state_ === OPENED && !discardRecords)
- observer.check_(records);
- }
-
- return {
- open: function(obs) {
- if (observer)
- throw Error('ObservedObject in use');
-
- if (!first)
- Object.deliverChangeRecords(callback);
-
- observer = obs;
- first = false;
- },
- observe: function(obj, arrayObserve) {
- object = obj;
- if (arrayObserve)
- Array.observe(object, callback);
- else
- Object.observe(object, callback);
- },
- deliver: function(discard) {
- discardRecords = discard;
- Object.deliverChangeRecords(callback);
- discardRecords = false;
- },
- close: function() {
- observer = undefined;
- Object.unobserve(object, callback);
- observedObjectCache.push(this);
- }
- };
- }
-
- /*
- * The observedSet abstraction is a perf optimization which reduces the total
- * number of Object.observe observations of a set of objects. The idea is that
- * groups of Observers will have some object dependencies in common and this
- * observed set ensures that each object in the transitive closure of
- * dependencies is only observed once. The observedSet acts as a write barrier
- * such that whenever any change comes through, all Observers are checked for
- * changed values.
- *
- * Note that this optimization is explicitly moving work from setup-time to
- * change-time.
- *
- * TODO(rafaelw): Implement "garbage collection". In order to move work off
- * the critical path, when Observers are closed, their observed objects are
- * not Object.unobserve(d). As a result, it's possible that if the observedSet
- * is kept open, but some Observers have been closed, it could cause "leaks"
- * (prevent otherwise collectable objects from being collected). At some
- * point, we should implement incremental "gc" which keeps a list of
- * observedSets which may need clean-up and does small amounts of cleanup on a
- * timeout until all is clean.
- */
-
- function getObservedObject(observer, object, arrayObserve) {
- var dir = observedObjectCache.pop() || newObservedObject();
- dir.open(observer);
- dir.observe(object, arrayObserve);
- return dir;
- }
-
- var observedSetCache = [];
-
- function newObservedSet() {
- var observerCount = 0;
- var observers = [];
- var objects = [];
- var rootObj;
- var rootObjProps;
-
- function observe(obj, prop) {
- if (!obj)
- return;
-
- if (obj === rootObj)
- rootObjProps[prop] = true;
-
- if (objects.indexOf(obj) < 0) {
- objects.push(obj);
- Object.observe(obj, callback);
- }
-
- observe(Object.getPrototypeOf(obj), prop);
- }
-
- function allRootObjNonObservedProps(recs) {
- for (var i = 0; i < recs.length; i++) {
- var rec = recs[i];
- if (rec.object !== rootObj ||
- rootObjProps[rec.name] ||
- rec.type === 'setPrototype') {
- return false;
- }
- }
- return true;
- }
-
- function callback(recs) {
- if (allRootObjNonObservedProps(recs))
- return;
-
- var observer;
- for (var i = 0; i < observers.length; i++) {
- observer = observers[i];
- if (observer.state_ == OPENED) {
- observer.iterateObjects_(observe);
- }
- }
-
- for (var i = 0; i < observers.length; i++) {
- observer = observers[i];
- if (observer.state_ == OPENED) {
- observer.check_();
- }
- }
- }
-
- var record = {
- objects: objects,
- get rootObject() { return rootObj; },
- set rootObject(value) {
- rootObj = value;
- rootObjProps = {};
- },
- open: function(obs, object) {
- observers.push(obs);
- observerCount++;
- obs.iterateObjects_(observe);
- },
- close: function(obs) {
- observerCount--;
- if (observerCount > 0) {
- return;
- }
-
- for (var i = 0; i < objects.length; i++) {
- Object.unobserve(objects[i], callback);
- Observer.unobservedCount++;
- }
-
- observers.length = 0;
- objects.length = 0;
- rootObj = undefined;
- rootObjProps = undefined;
- observedSetCache.push(this);
- if (lastObservedSet === this)
- lastObservedSet = null;
- },
- };
-
- return record;
- }
-
- var lastObservedSet;
-
- function getObservedSet(observer, obj) {
- if (!lastObservedSet || lastObservedSet.rootObject !== obj) {
- lastObservedSet = observedSetCache.pop() || newObservedSet();
- lastObservedSet.rootObject = obj;
- }
- lastObservedSet.open(observer, obj);
- return lastObservedSet;
- }
-
- var UNOPENED = 0;
- var OPENED = 1;
- var CLOSED = 2;
- var RESETTING = 3;
-
- var nextObserverId = 1;
-
- function Observer() {
- this.state_ = UNOPENED;
- this.callback_ = undefined;
- this.target_ = undefined; // TODO(rafaelw): Should be WeakRef
- this.directObserver_ = undefined;
- this.value_ = undefined;
- this.id_ = nextObserverId++;
- }
-
- Observer.prototype = {
- open: function(callback, target) {
- if (this.state_ != UNOPENED)
- throw Error('Observer has already been opened.');
-
- addToAll(this);
- this.callback_ = callback;
- this.target_ = target;
- this.connect_();
- this.state_ = OPENED;
- return this.value_;
- },
-
- close: function() {
- if (this.state_ != OPENED)
- return;
-
- removeFromAll(this);
- this.disconnect_();
- this.value_ = undefined;
- this.callback_ = undefined;
- this.target_ = undefined;
- this.state_ = CLOSED;
- },
-
- deliver: function() {
- if (this.state_ != OPENED)
- return;
-
- dirtyCheck(this);
- },
-
- report_: function(changes) {
- try {
- this.callback_.apply(this.target_, changes);
- } catch (ex) {
- Observer._errorThrownDuringCallback = true;
- console.error('Exception caught during observer callback: ' +
- (ex.stack || ex));
- }
- },
-
- discardChanges: function() {
- this.check_(undefined, true);
- return this.value_;
- }
- }
-
- var collectObservers = !hasObserve;
- var allObservers;
- Observer._allObserversCount = 0;
-
- if (collectObservers) {
- allObservers = [];
- }
-
- function addToAll(observer) {
- Observer._allObserversCount++;
- if (!collectObservers)
- return;
-
- allObservers.push(observer);
- }
-
- function removeFromAll(observer) {
- Observer._allObserversCount--;
- }
-
- var runningMicrotaskCheckpoint = false;
-
- global.Platform = global.Platform || {};
-
- global.Platform.performMicrotaskCheckpoint = function() {
- if (runningMicrotaskCheckpoint)
- return;
-
- if (!collectObservers)
- return;
-
- runningMicrotaskCheckpoint = true;
-
- var cycles = 0;
- var anyChanged, toCheck;
-
- do {
- cycles++;
- toCheck = allObservers;
- allObservers = [];
- anyChanged = false;
-
- for (var i = 0; i < toCheck.length; i++) {
- var observer = toCheck[i];
- if (observer.state_ != OPENED)
- continue;
-
- if (observer.check_())
- anyChanged = true;
-
- allObservers.push(observer);
- }
- if (runEOMTasks())
- anyChanged = true;
- } while (cycles < MAX_DIRTY_CHECK_CYCLES && anyChanged);
-
- if (testingExposeCycleCount)
- global.dirtyCheckCycleCount = cycles;
-
- runningMicrotaskCheckpoint = false;
- };
-
- if (collectObservers) {
- global.Platform.clearObservers = function() {
- allObservers = [];
- };
- }
-
- function ObjectObserver(object) {
- Observer.call(this);
- this.value_ = object;
- this.oldObject_ = undefined;
- }
-
- ObjectObserver.prototype = createObject({
- __proto__: Observer.prototype,
-
- arrayObserve: false,
-
- connect_: function(callback, target) {
- if (hasObserve) {
- this.directObserver_ = getObservedObject(this, this.value_,
- this.arrayObserve);
- } else {
- this.oldObject_ = this.copyObject(this.value_);
- }
-
- },
-
- copyObject: function(object) {
- var copy = Array.isArray(object) ? [] : {};
- for (var prop in object) {
- copy[prop] = object[prop];
- };
- if (Array.isArray(object))
- copy.length = object.length;
- return copy;
- },
-
- check_: function(changeRecords, skipChanges) {
- var diff;
- var oldValues;
- if (hasObserve) {
- if (!changeRecords)
- return false;
-
- oldValues = {};
- diff = diffObjectFromChangeRecords(this.value_, changeRecords,
- oldValues);
- } else {
- oldValues = this.oldObject_;
- diff = diffObjectFromOldObject(this.value_, this.oldObject_);
- }
-
- if (diffIsEmpty(diff))
- return false;
-
- if (!hasObserve)
- this.oldObject_ = this.copyObject(this.value_);
-
- this.report_([
- diff.added || {},
- diff.removed || {},
- diff.changed || {},
- function(property) {
- return oldValues[property];
- }
- ]);
-
- return true;
- },
-
- disconnect_: function() {
- if (hasObserve) {
- this.directObserver_.close();
- this.directObserver_ = undefined;
- } else {
- this.oldObject_ = undefined;
- }
- },
-
- deliver: function() {
- if (this.state_ != OPENED)
- return;
-
- if (hasObserve)
- this.directObserver_.deliver(false);
- else
- dirtyCheck(this);
- },
-
- discardChanges: function() {
- if (this.directObserver_)
- this.directObserver_.deliver(true);
- else
- this.oldObject_ = this.copyObject(this.value_);
-
- return this.value_;
- }
- });
-
- function ArrayObserver(array) {
- if (!Array.isArray(array))
- throw Error('Provided object is not an Array');
- ObjectObserver.call(this, array);
- }
-
- ArrayObserver.prototype = createObject({
-
- __proto__: ObjectObserver.prototype,
-
- arrayObserve: true,
-
- copyObject: function(arr) {
- return arr.slice();
- },
-
- check_: function(changeRecords) {
- var splices;
- if (hasObserve) {
- if (!changeRecords)
- return false;
- splices = projectArraySplices(this.value_, changeRecords);
- } else {
- splices = calcSplices(this.value_, 0, this.value_.length,
- this.oldObject_, 0, this.oldObject_.length);
- }
-
- if (!splices || !splices.length)
- return false;
-
- if (!hasObserve)
- this.oldObject_ = this.copyObject(this.value_);
-
- this.report_([splices]);
- return true;
- }
- });
-
- ArrayObserver.applySplices = function(previous, current, splices) {
- splices.forEach(function(splice) {
- var spliceArgs = [splice.index, splice.removed.length];
- var addIndex = splice.index;
- while (addIndex < splice.index + splice.addedCount) {
- spliceArgs.push(current[addIndex]);
- addIndex++;
- }
-
- Array.prototype.splice.apply(previous, spliceArgs);
- });
- };
-
- function PathObserver(object, path) {
- Observer.call(this);
-
- this.object_ = object;
- this.path_ = getPath(path);
- this.directObserver_ = undefined;
- }
-
- PathObserver.prototype = createObject({
- __proto__: Observer.prototype,
-
- get path() {
- return this.path_;
- },
-
- connect_: function() {
- if (hasObserve)
- this.directObserver_ = getObservedSet(this, this.object_);
-
- this.check_(undefined, true);
- },
-
- disconnect_: function() {
- this.value_ = undefined;
-
- if (this.directObserver_) {
- this.directObserver_.close(this);
- this.directObserver_ = undefined;
- }
- },
-
- iterateObjects_: function(observe) {
- this.path_.iterateObjects(this.object_, observe);
- },
-
- check_: function(changeRecords, skipChanges) {
- var oldValue = this.value_;
- this.value_ = this.path_.getValueFrom(this.object_);
- if (skipChanges || areSameValue(this.value_, oldValue))
- return false;
-
- this.report_([this.value_, oldValue, this]);
- return true;
- },
-
- setValue: function(newValue) {
- if (this.path_)
- this.path_.setValueFrom(this.object_, newValue);
- }
- });
-
- function CompoundObserver(reportChangesOnOpen) {
- Observer.call(this);
-
- this.reportChangesOnOpen_ = reportChangesOnOpen;
- this.value_ = [];
- this.directObserver_ = undefined;
- this.observed_ = [];
- }
-
- var observerSentinel = {};
-
- CompoundObserver.prototype = createObject({
- __proto__: Observer.prototype,
-
- connect_: function() {
- if (hasObserve) {
- var object;
- var needsDirectObserver = false;
- for (var i = 0; i < this.observed_.length; i += 2) {
- object = this.observed_[i]
- if (object !== observerSentinel) {
- needsDirectObserver = true;
- break;
- }
- }
-
- if (needsDirectObserver)
- this.directObserver_ = getObservedSet(this, object);
- }
-
- this.check_(undefined, !this.reportChangesOnOpen_);
- },
-
- disconnect_: function() {
- for (var i = 0; i < this.observed_.length; i += 2) {
- if (this.observed_[i] === observerSentinel)
- this.observed_[i + 1].close();
- }
- this.observed_.length = 0;
- this.value_.length = 0;
-
- if (this.directObserver_) {
- this.directObserver_.close(this);
- this.directObserver_ = undefined;
- }
- },
-
- addPath: function(object, path) {
- if (this.state_ != UNOPENED && this.state_ != RESETTING)
- throw Error('Cannot add paths once started.');
-
- var path = getPath(path);
- this.observed_.push(object, path);
- if (!this.reportChangesOnOpen_)
- return;
- var index = this.observed_.length / 2 - 1;
- this.value_[index] = path.getValueFrom(object);
- },
-
- addObserver: function(observer) {
- if (this.state_ != UNOPENED && this.state_ != RESETTING)
- throw Error('Cannot add observers once started.');
-
- this.observed_.push(observerSentinel, observer);
- if (!this.reportChangesOnOpen_)
- return;
- var index = this.observed_.length / 2 - 1;
- this.value_[index] = observer.open(this.deliver, this);
- },
-
- startReset: function() {
- if (this.state_ != OPENED)
- throw Error('Can only reset while open');
-
- this.state_ = RESETTING;
- this.disconnect_();
- },
-
- finishReset: function() {
- if (this.state_ != RESETTING)
- throw Error('Can only finishReset after startReset');
- this.state_ = OPENED;
- this.connect_();
-
- return this.value_;
- },
-
- iterateObjects_: function(observe) {
- var object;
- for (var i = 0; i < this.observed_.length; i += 2) {
- object = this.observed_[i]
- if (object !== observerSentinel)
- this.observed_[i + 1].iterateObjects(object, observe)
- }
- },
-
- check_: function(changeRecords, skipChanges) {
- var oldValues;
- for (var i = 0; i < this.observed_.length; i += 2) {
- var object = this.observed_[i];
- var path = this.observed_[i+1];
- var value;
- if (object === observerSentinel) {
- var observable = path;
- value = this.state_ === UNOPENED ?
- observable.open(this.deliver, this) :
- observable.discardChanges();
- } else {
- value = path.getValueFrom(object);
- }
-
- if (skipChanges) {
- this.value_[i / 2] = value;
- continue;
- }
-
- if (areSameValue(value, this.value_[i / 2]))
- continue;
-
- oldValues = oldValues || [];
- oldValues[i / 2] = this.value_[i / 2];
- this.value_[i / 2] = value;
- }
-
- if (!oldValues)
- return false;
-
- // TODO(rafaelw): Having observed_ as the third callback arg here is
- // pretty lame API. Fix.
- this.report_([this.value_, oldValues, this.observed_]);
- return true;
- }
- });
-
- function identFn(value) { return value; }
-
- function ObserverTransform(observable, getValueFn, setValueFn,
- dontPassThroughSet) {
- this.callback_ = undefined;
- this.target_ = undefined;
- this.value_ = undefined;
- this.observable_ = observable;
- this.getValueFn_ = getValueFn || identFn;
- this.setValueFn_ = setValueFn || identFn;
- // TODO(rafaelw): This is a temporary hack. PolymerExpressions needs this
- // at the moment because of a bug in it's dependency tracking.
- this.dontPassThroughSet_ = dontPassThroughSet;
- }
-
- ObserverTransform.prototype = {
- open: function(callback, target) {
- this.callback_ = callback;
- this.target_ = target;
- this.value_ =
- this.getValueFn_(this.observable_.open(this.observedCallback_, this));
- return this.value_;
- },
-
- observedCallback_: function(value) {
- value = this.getValueFn_(value);
- if (areSameValue(value, this.value_))
- return;
- var oldValue = this.value_;
- this.value_ = value;
- this.callback_.call(this.target_, this.value_, oldValue);
- },
-
- discardChanges: function() {
- this.value_ = this.getValueFn_(this.observable_.discardChanges());
- return this.value_;
- },
-
- deliver: function() {
- return this.observable_.deliver();
- },
-
- setValue: function(value) {
- value = this.setValueFn_(value);
- if (!this.dontPassThroughSet_ && this.observable_.setValue)
- return this.observable_.setValue(value);
- },
-
- close: function() {
- if (this.observable_)
- this.observable_.close();
- this.callback_ = undefined;
- this.target_ = undefined;
- this.observable_ = undefined;
- this.value_ = undefined;
- this.getValueFn_ = undefined;
- this.setValueFn_ = undefined;
- }
- }
-
- var expectedRecordTypes = {
- add: true,
- update: true,
- delete: true
- };
-
- function diffObjectFromChangeRecords(object, changeRecords, oldValues) {
- var added = {};
- var removed = {};
-
- for (var i = 0; i < changeRecords.length; i++) {
- var record = changeRecords[i];
- if (!expectedRecordTypes[record.type]) {
- console.error('Unknown changeRecord type: ' + record.type);
- console.error(record);
- continue;
- }
-
- if (!(record.name in oldValues))
- oldValues[record.name] = record.oldValue;
-
- if (record.type == 'update')
- continue;
-
- if (record.type == 'add') {
- if (record.name in removed)
- delete removed[record.name];
- else
- added[record.name] = true;
-
- continue;
- }
-
- // type = 'delete'
- if (record.name in added) {
- delete added[record.name];
- delete oldValues[record.name];
- } else {
- removed[record.name] = true;
- }
- }
-
- for (var prop in added)
- added[prop] = object[prop];
-
- for (var prop in removed)
- removed[prop] = undefined;
-
- var changed = {};
- for (var prop in oldValues) {
- if (prop in added || prop in removed)
- continue;
-
- var newValue = object[prop];
- if (oldValues[prop] !== newValue)
- changed[prop] = newValue;
- }
-
- return {
- added: added,
- removed: removed,
- changed: changed
- };
- }
-
- function newSplice(index, removed, addedCount) {
- return {
- index: index,
- removed: removed,
- addedCount: addedCount
- };
- }
-
- var EDIT_LEAVE = 0;
- var EDIT_UPDATE = 1;
- var EDIT_ADD = 2;
- var EDIT_DELETE = 3;
-
- function ArraySplice() {}
-
- ArraySplice.prototype = {
-
- // Note: This function is *based* on the computation of the Levenshtein
- // "edit" distance. The one change is that "updates" are treated as two
- // edits - not one. With Array splices, an update is really a delete
- // followed by an add. By retaining this, we optimize for "keeping" the
- // maximum array items in the original array. For example:
- //
- // 'xxxx123' -> '123yyyy'
- //
- // With 1-edit updates, the shortest path would be just to update all seven
- // characters. With 2-edit updates, we delete 4, leave 3, and add 4. This
- // leaves the substring '123' intact.
- calcEditDistances: function(current, currentStart, currentEnd,
- old, oldStart, oldEnd) {
- // "Deletion" columns
- var rowCount = oldEnd - oldStart + 1;
- var columnCount = currentEnd - currentStart + 1;
- var distances = new Array(rowCount);
-
- // "Addition" rows. Initialize null column.
- for (var i = 0; i < rowCount; i++) {
- distances[i] = new Array(columnCount);
- distances[i][0] = i;
- }
-
- // Initialize null row
- for (var j = 0; j < columnCount; j++)
- distances[0][j] = j;
-
- for (var i = 1; i < rowCount; i++) {
- for (var j = 1; j < columnCount; j++) {
- if (this.equals(current[currentStart + j - 1], old[oldStart + i - 1]))
- distances[i][j] = distances[i - 1][j - 1];
- else {
- var north = distances[i - 1][j] + 1;
- var west = distances[i][j - 1] + 1;
- distances[i][j] = north < west ? north : west;
- }
- }
- }
-
- return distances;
- },
-
- // This starts at the final weight, and walks "backward" by finding
- // the minimum previous weight recursively until the origin of the weight
- // matrix.
- spliceOperationsFromEditDistances: function(distances) {
- var i = distances.length - 1;
- var j = distances[0].length - 1;
- var current = distances[i][j];
- var edits = [];
- while (i > 0 || j > 0) {
- if (i == 0) {
- edits.push(EDIT_ADD);
- j--;
- continue;
- }
- if (j == 0) {
- edits.push(EDIT_DELETE);
- i--;
- continue;
- }
- var northWest = distances[i - 1][j - 1];
- var west = distances[i - 1][j];
- var north = distances[i][j - 1];
-
- var min;
- if (west < north)
- min = west < northWest ? west : northWest;
- else
- min = north < northWest ? north : northWest;
-
- if (min == northWest) {
- if (northWest == current) {
- edits.push(EDIT_LEAVE);
- } else {
- edits.push(EDIT_UPDATE);
- current = northWest;
- }
- i--;
- j--;
- } else if (min == west) {
- edits.push(EDIT_DELETE);
- i--;
- current = west;
- } else {
- edits.push(EDIT_ADD);
- j--;
- current = north;
- }
- }
-
- edits.reverse();
- return edits;
- },
-
- /**
- * Splice Projection functions:
- *
- * A splice map is a representation of how a previous array of items
- * was transformed into a new array of items. Conceptually it is a list of
- * tuples of
- *
- * <index, removed, addedCount>
- *
- * which are kept in ascending index order of. The tuple represents that at
- * the |index|, |removed| sequence of items were removed, and counting forward
- * from |index|, |addedCount| items were added.
- */
-
- /**
- * Lacking individual splice mutation information, the minimal set of
- * splices can be synthesized given the previous state and final state of an
- * array. The basic approach is to calculate the edit distance matrix and
- * choose the shortest path through it.
- *
- * Complexity: O(l * p)
- * l: The length of the current array
- * p: The length of the old array
- */
- calcSplices: function(current, currentStart, currentEnd,
- old, oldStart, oldEnd) {
- var prefixCount = 0;
- var suffixCount = 0;
-
- var minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
- if (currentStart == 0 && oldStart == 0)
- prefixCount = this.sharedPrefix(current, old, minLength);
-
- if (currentEnd == current.length && oldEnd == old.length)
- suffixCount = this.sharedSuffix(current, old, minLength - prefixCount);
-
- currentStart += prefixCount;
- oldStart += prefixCount;
- currentEnd -= suffixCount;
- oldEnd -= suffixCount;
-
- if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0)
- return [];
-
- if (currentStart == currentEnd) {
- var splice = newSplice(currentStart, [], 0);
- while (oldStart < oldEnd)
- splice.removed.push(old[oldStart++]);
-
- return [ splice ];
- } else if (oldStart == oldEnd)
- return [ newSplice(currentStart, [], currentEnd - currentStart) ];
-
- var ops = this.spliceOperationsFromEditDistances(
- this.calcEditDistances(current, currentStart, currentEnd,
- old, oldStart, oldEnd));
-
- var splice = undefined;
- var splices = [];
- var index = currentStart;
- var oldIndex = oldStart;
- for (var i = 0; i < ops.length; i++) {
- switch(ops[i]) {
- case EDIT_LEAVE:
- if (splice) {
- splices.push(splice);
- splice = undefined;
- }
-
- index++;
- oldIndex++;
- break;
- case EDIT_UPDATE:
- if (!splice)
- splice = newSplice(index, [], 0);
-
- splice.addedCount++;
- index++;
-
- splice.removed.push(old[oldIndex]);
- oldIndex++;
- break;
- case EDIT_ADD:
- if (!splice)
- splice = newSplice(index, [], 0);
-
- splice.addedCount++;
- index++;
- break;
- case EDIT_DELETE:
- if (!splice)
- splice = newSplice(index, [], 0);
-
- splice.removed.push(old[oldIndex]);
- oldIndex++;
- break;
- }
- }
-
- if (splice) {
- splices.push(splice);
- }
- return splices;
- },
-
- sharedPrefix: function(current, old, searchLength) {
- for (var i = 0; i < searchLength; i++)
- if (!this.equals(current[i], old[i]))
- return i;
- return searchLength;
- },
-
- sharedSuffix: function(current, old, searchLength) {
- var index1 = current.length;
- var index2 = old.length;
- var count = 0;
- while (count < searchLength && this.equals(current[--index1], old[--index2]))
- count++;
-
- return count;
- },
-
- calculateSplices: function(current, previous) {
- return this.calcSplices(current, 0, current.length, previous, 0,
- previous.length);
- },
-
- equals: function(currentValue, previousValue) {
- return currentValue === previousValue;
- }
- };
-
- var arraySplice = new ArraySplice();
-
- function calcSplices(current, currentStart, currentEnd,
- old, oldStart, oldEnd) {
- return arraySplice.calcSplices(current, currentStart, currentEnd,
- old, oldStart, oldEnd);
- }
-
- function intersect(start1, end1, start2, end2) {
- // Disjoint
- if (end1 < start2 || end2 < start1)
- return -1;
-
- // Adjacent
- if (end1 == start2 || end2 == start1)
- return 0;
-
- // Non-zero intersect, span1 first
- if (start1 < start2) {
- if (end1 < end2)
- return end1 - start2; // Overlap
- else
- return end2 - start2; // Contained
- } else {
- // Non-zero intersect, span2 first
- if (end2 < end1)
- return end2 - start1; // Overlap
- else
- return end1 - start1; // Contained
- }
- }
-
- function mergeSplice(splices, index, removed, addedCount) {
-
- var splice = newSplice(index, removed, addedCount);
-
- var inserted = false;
- var insertionOffset = 0;
-
- for (var i = 0; i < splices.length; i++) {
- var current = splices[i];
- current.index += insertionOffset;
-
- if (inserted)
- continue;
-
- var intersectCount = intersect(splice.index,
- splice.index + splice.removed.length,
- current.index,
- current.index + current.addedCount);
-
- if (intersectCount >= 0) {
- // Merge the two splices
-
- splices.splice(i, 1);
- i--;
-
- insertionOffset -= current.addedCount - current.removed.length;
-
- splice.addedCount += current.addedCount - intersectCount;
- var deleteCount = splice.removed.length +
- current.removed.length - intersectCount;
-
- if (!splice.addedCount && !deleteCount) {
- // merged splice is a noop. discard.
- inserted = true;
- } else {
- var removed = current.removed;
-
- if (splice.index < current.index) {
- // some prefix of splice.removed is prepended to current.removed.
- var prepend = splice.removed.slice(0, current.index - splice.index);
- Array.prototype.push.apply(prepend, removed);
- removed = prepend;
- }
-
- if (splice.index + splice.removed.length > current.index + current.addedCount) {
- // some suffix of splice.removed is appended to current.removed.
- var append = splice.removed.slice(current.index + current.addedCount - splice.index);
- Array.prototype.push.apply(removed, append);
- }
-
- splice.removed = removed;
- if (current.index < splice.index) {
- splice.index = current.index;
- }
- }
- } else if (splice.index < current.index) {
- // Insert splice here.
-
- inserted = true;
-
- splices.splice(i, 0, splice);
- i++;
-
- var offset = splice.addedCount - splice.removed.length
- current.index += offset;
- insertionOffset += offset;
- }
- }
-
- if (!inserted)
- splices.push(splice);
- }
-
- function createInitialSplices(array, changeRecords) {
- var splices = [];
-
- for (var i = 0; i < changeRecords.length; i++) {
- var record = changeRecords[i];
- switch(record.type) {
- case 'splice':
- mergeSplice(splices, record.index, record.removed.slice(), record.addedCount);
- break;
- case 'add':
- case 'update':
- case 'delete':
- if (!isIndex(record.name))
- continue;
- var index = toNumber(record.name);
- if (index < 0)
- continue;
- mergeSplice(splices, index, [record.oldValue], 1);
- break;
- default:
- console.error('Unexpected record type: ' + JSON.stringify(record));
- break;
- }
- }
-
- return splices;
- }
-
- function projectArraySplices(array, changeRecords) {
- var splices = [];
-
- createInitialSplices(array, changeRecords).forEach(function(splice) {
- if (splice.addedCount == 1 && splice.removed.length == 1) {
- if (splice.removed[0] !== array[splice.index])
- splices.push(splice);
-
- return
- };
-
- splices = splices.concat(calcSplices(array, splice.index, splice.index + splice.addedCount,
- splice.removed, 0, splice.removed.length));
- });
-
- return splices;
- }
-
- // Export the observe-js object for **Node.js**, with backwards-compatibility
- // for the old `require()` API. Also ensure `exports` is not a DOM Element.
- // If we're in the browser, export as a global object.
-
- var expose = global;
-
- if (typeof exports !== 'undefined' && !exports.nodeType) {
- if (typeof module !== 'undefined' && module.exports) {
- exports = module.exports;
- }
- expose = exports;
- }
-
- expose.Observer = Observer;
- expose.Observer.runEOM_ = runEOM;
- expose.Observer.observerSentinel_ = observerSentinel; // for testing.
- expose.Observer.hasObjectObserve = hasObserve;
- expose.ArrayObserver = ArrayObserver;
- expose.ArrayObserver.calculateSplices = function(current, previous) {
- return arraySplice.calculateSplices(current, previous);
- };
-
- expose.ArraySplice = ArraySplice;
- expose.ObjectObserver = ObjectObserver;
- expose.PathObserver = PathObserver;
- expose.CompoundObserver = CompoundObserver;
- expose.Path = Path;
- expose.ObserverTransform = ObserverTransform;
-
-})(typeof global !== 'undefined' && global && typeof module !== 'undefined' && module ? global : this || window);
-
-// Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
-// This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-// The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-// The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-// Code distributed by Google as part of the polymer project is also
-// subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-
-(function(global) {
- 'use strict';
-
- var filter = Array.prototype.filter.call.bind(Array.prototype.filter);
-
- function getTreeScope(node) {
- while (node.parentNode) {
- node = node.parentNode;
- }
-
- return typeof node.getElementById === 'function' ? node : null;
- }
-
- Node.prototype.bind = function(name, observable) {
- console.error('Unhandled binding to Node: ', this, name, observable);
- };
-
- Node.prototype.bindFinished = function() {};
-
- function updateBindings(node, name, binding) {
- var bindings = node.bindings_;
- if (!bindings)
- bindings = node.bindings_ = {};
-
- if (bindings[name])
- binding[name].close();
-
- return bindings[name] = binding;
- }
-
- function returnBinding(node, name, binding) {
- return binding;
- }
-
- function sanitizeValue(value) {
- return value == null ? '' : value;
- }
-
- function updateText(node, value) {
- node.data = sanitizeValue(value);
- }
-
- function textBinding(node) {
- return function(value) {
- return updateText(node, value);
- };
- }
-
- var maybeUpdateBindings = returnBinding;
-
- Object.defineProperty(Platform, 'enableBindingsReflection', {
- get: function() {
- return maybeUpdateBindings === updateBindings;
- },
- set: function(enable) {
- maybeUpdateBindings = enable ? updateBindings : returnBinding;
- return enable;
- },
- configurable: true
- });
-
- Text.prototype.bind = function(name, value, oneTime) {
- if (name !== 'textContent')
- return Node.prototype.bind.call(this, name, value, oneTime);
-
- if (oneTime)
- return updateText(this, value);
-
- var observable = value;
- updateText(this, observable.open(textBinding(this)));
- return maybeUpdateBindings(this, name, observable);
- }
-
- function updateAttribute(el, name, conditional, value) {
- if (conditional) {
- if (value)
- el.setAttribute(name, '');
- else
- el.removeAttribute(name);
- return;
- }
-
- el.setAttribute(name, sanitizeValue(value));
- }
-
- function attributeBinding(el, name, conditional) {
- return function(value) {
- updateAttribute(el, name, conditional, value);
- };
- }
-
- Element.prototype.bind = function(name, value, oneTime) {
- var conditional = name[name.length - 1] == '?';
- if (conditional) {
- this.removeAttribute(name);
- name = name.slice(0, -1);
- }
-
- if (oneTime)
- return updateAttribute(this, name, conditional, value);
-
-
- var observable = value;
- updateAttribute(this, name, conditional,
- observable.open(attributeBinding(this, name, conditional)));
-
- return maybeUpdateBindings(this, name, observable);
- };
-
- var checkboxEventType;
- (function() {
- // Attempt to feature-detect which event (change or click) is fired first
- // for checkboxes.
- var div = document.createElement('div');
- var checkbox = div.appendChild(document.createElement('input'));
- checkbox.setAttribute('type', 'checkbox');
- var first;
- var count = 0;
- checkbox.addEventListener('click', function(e) {
- count++;
- first = first || 'click';
- });
- checkbox.addEventListener('change', function() {
- count++;
- first = first || 'change';
- });
-
- var event = document.createEvent('MouseEvent');
- event.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false,
- false, false, false, 0, null);
- checkbox.dispatchEvent(event);
- // WebKit/Blink don't fire the change event if the element is outside the
- // document, so assume 'change' for that case.
- checkboxEventType = count == 1 ? 'change' : first;
- })();
-
- function getEventForInputType(element) {
- switch (element.type) {
- case 'checkbox':
- return checkboxEventType;
- case 'radio':
- case 'select-multiple':
- case 'select-one':
- return 'change';
- case 'range':
- if (/Trident|MSIE/.test(navigator.userAgent))
- return 'change';
- default:
- return 'input';
- }
- }
-
- function updateInput(input, property, value, santizeFn) {
- input[property] = (santizeFn || sanitizeValue)(value);
- }
-
- function inputBinding(input, property, santizeFn) {
- return function(value) {
- return updateInput(input, property, value, santizeFn);
- }
- }
-
- function noop() {}
-
- function bindInputEvent(input, property, observable, postEventFn) {
- var eventType = getEventForInputType(input);
-
- function eventHandler() {
- var isNum = property == 'value' && input.type == 'number';
- observable.setValue(isNum ? input.valueAsNumber : input[property]);
- observable.discardChanges();
- (postEventFn || noop)(input);
- Platform.performMicrotaskCheckpoint();
- }
- input.addEventListener(eventType, eventHandler);
-
- return {
- close: function() {
- input.removeEventListener(eventType, eventHandler);
- observable.close();
- },
-
- observable_: observable
- }
- }
-
- function booleanSanitize(value) {
- return Boolean(value);
- }
-
- // |element| is assumed to be an HTMLInputElement with |type| == 'radio'.
- // Returns an array containing all radio buttons other than |element| that
- // have the same |name|, either in the form that |element| belongs to or,
- // if no form, in the document tree to which |element| belongs.
- //
- // This implementation is based upon the HTML spec definition of a
- // "radio button group":
- // http://www.whatwg.org/specs/web-apps/current-work/multipage/number-state.html#radio-button-group
- //
- function getAssociatedRadioButtons(element) {
- if (element.form) {
- return filter(element.form.elements, function(el) {
- return el != element &&
- el.tagName == 'INPUT' &&
- el.type == 'radio' &&
- el.name == element.name;
- });
- } else {
- var treeScope = getTreeScope(element);
- if (!treeScope)
- return [];
- var radios = treeScope.querySelectorAll(
- 'input[type="radio"][name="' + element.name + '"]');
- return filter(radios, function(el) {
- return el != element && !el.form;
- });
- }
- }
-
- function checkedPostEvent(input) {
- // Only the radio button that is getting checked gets an event. We
- // therefore find all the associated radio buttons and update their
- // check binding manually.
- if (input.tagName === 'INPUT' &&
- input.type === 'radio') {
- getAssociatedRadioButtons(input).forEach(function(radio) {
- var checkedBinding = radio.bindings_.checked;
- if (checkedBinding) {
- // Set the value directly to avoid an infinite call stack.
- checkedBinding.observable_.setValue(false);
- }
- });
- }
- }
-
- HTMLInputElement.prototype.bind = function(name, value, oneTime) {
- if (name !== 'value' && name !== 'checked')
- return HTMLElement.prototype.bind.call(this, name, value, oneTime);
-
- this.removeAttribute(name);
- var sanitizeFn = name == 'checked' ? booleanSanitize : sanitizeValue;
- var postEventFn = name == 'checked' ? checkedPostEvent : noop;
-
- if (oneTime)
- return updateInput(this, name, value, sanitizeFn);
-
-
- var observable = value;
- var binding = bindInputEvent(this, name, observable, postEventFn);
- updateInput(this, name,
- observable.open(inputBinding(this, name, sanitizeFn)),
- sanitizeFn);
-
- // Checkboxes may need to update bindings of other checkboxes.
- return updateBindings(this, name, binding);
- }
-
- HTMLTextAreaElement.prototype.bind = function(name, value, oneTime) {
- if (name !== 'value')
- return HTMLElement.prototype.bind.call(this, name, value, oneTime);
-
- this.removeAttribute('value');
-
- if (oneTime)
- return updateInput(this, 'value', value);
-
- var observable = value;
- var binding = bindInputEvent(this, 'value', observable);
- updateInput(this, 'value',
- observable.open(inputBinding(this, 'value', sanitizeValue)));
- return maybeUpdateBindings(this, name, binding);
- }
-
- function updateOption(option, value) {
- var parentNode = option.parentNode;;
- var select;
- var selectBinding;
- var oldValue;
- if (parentNode instanceof HTMLSelectElement &&
- parentNode.bindings_ &&
- parentNode.bindings_.value) {
- select = parentNode;
- selectBinding = select.bindings_.value;
- oldValue = select.value;
- }
-
- option.value = sanitizeValue(value);
-
- if (select && select.value != oldValue) {
- selectBinding.observable_.setValue(select.value);
- selectBinding.observable_.discardChanges();
- Platform.performMicrotaskCheckpoint();
- }
- }
-
- function optionBinding(option) {
- return function(value) {
- updateOption(option, value);
- }
- }
-
- HTMLOptionElement.prototype.bind = function(name, value, oneTime) {
- if (name !== 'value')
- return HTMLElement.prototype.bind.call(this, name, value, oneTime);
-
- this.removeAttribute('value');
-
- if (oneTime)
- return updateOption(this, value);
-
- var observable = value;
- var binding = bindInputEvent(this, 'value', observable);
- updateOption(this, observable.open(optionBinding(this)));
- return maybeUpdateBindings(this, name, binding);
- }
-
- HTMLSelectElement.prototype.bind = function(name, value, oneTime) {
- if (name === 'selectedindex')
- name = 'selectedIndex';
-
- if (name !== 'selectedIndex' && name !== 'value')
- return HTMLElement.prototype.bind.call(this, name, value, oneTime);
-
- this.removeAttribute(name);
-
- if (oneTime)
- return updateInput(this, name, value);
-
- var observable = value;
- var binding = bindInputEvent(this, name, observable);
- updateInput(this, name,
- observable.open(inputBinding(this, name)));
-
- // Option update events may need to access select bindings.
- return updateBindings(this, name, binding);
- }
-})(this);
-
-// Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
-// This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
-// The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
-// The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
-// Code distributed by Google as part of the polymer project is also
-// subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-
-(function(global) {
- 'use strict';
-
- function assert(v) {
- if (!v)
- throw new Error('Assertion failed');
- }
-
- var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
-
- function getFragmentRoot(node) {
- var p;
- while (p = node.parentNode) {
- node = p;
- }
-
- return node;
- }
-
- function searchRefId(node, id) {
- if (!id)
- return;
-
- var ref;
- var selector = '#' + id;
- while (!ref) {
- node = getFragmentRoot(node);
-
- if (node.protoContent_)
- ref = node.protoContent_.querySelector(selector);
- else if (node.getElementById)
- ref = node.getElementById(id);
-
- if (ref || !node.templateCreator_)
- break
-
- node = node.templateCreator_;
- }
-
- return ref;
- }
-
- function getInstanceRoot(node) {
- while (node.parentNode) {
- node = node.parentNode;
- }
- return node.templateCreator_ ? node : null;
- }
-
- var Map;
- if (global.Map && typeof global.Map.prototype.forEach === 'function') {
- Map = global.Map;
- } else {
- Map = function() {
- this.keys = [];
- this.values = [];
- };
-
- Map.prototype = {
- set: function(key, value) {
- var index = this.keys.indexOf(key);
- if (index < 0) {
- this.keys.push(key);
- this.values.push(value);
- } else {
- this.values[index] = value;
- }
- },
-
- get: function(key) {
- var index = this.keys.indexOf(key);
- if (index < 0)
- return;
-
- return this.values[index];
- },
-
- delete: function(key, value) {
- var index = this.keys.indexOf(key);
- if (index < 0)
- return false;
-
- this.keys.splice(index, 1);
- this.values.splice(index, 1);
- return true;
- },
-
- forEach: function(f, opt_this) {
- for (var i = 0; i < this.keys.length; i++)
- f.call(opt_this || this, this.values[i], this.keys[i], this);
- }
- };
- }
-
- // JScript does not have __proto__. We wrap all object literals with
- // createObject which uses Object.create, Object.defineProperty and
- // Object.getOwnPropertyDescriptor to create a new object that does the exact
- // same thing. The main downside to this solution is that we have to extract
- // all those property descriptors for IE.
- var createObject = ('__proto__' in {}) ?
- function(obj) { return obj; } :
- function(obj) {
- var proto = obj.__proto__;
- if (!proto)
- return obj;
- var newObject = Object.create(proto);
- Object.getOwnPropertyNames(obj).forEach(function(name) {
- Object.defineProperty(newObject, name,
- Object.getOwnPropertyDescriptor(obj, name));
- });
- return newObject;
- };
-
- // IE does not support have Document.prototype.contains.
- if (typeof document.contains != 'function') {
- Document.prototype.contains = function(node) {
- if (node === this || node.parentNode === this)
- return true;
- return this.documentElement.contains(node);
- }
- }
-
- var BIND = 'bind';
- var REPEAT = 'repeat';
- var IF = 'if';
-
- var templateAttributeDirectives = {
- 'template': true,
- 'repeat': true,
- 'bind': true,
- 'ref': true,
- 'if': true
- };
-
- var semanticTemplateElements = {
- 'THEAD': true,
- 'TBODY': true,
- 'TFOOT': true,
- 'TH': true,
- 'TR': true,
- 'TD': true,
- 'COLGROUP': true,
- 'COL': true,
- 'CAPTION': true,
- 'OPTION': true,
- 'OPTGROUP': true
- };
-
- var hasTemplateElement = typeof HTMLTemplateElement !== 'undefined';
- if (hasTemplateElement) {
- // TODO(rafaelw): Remove when fix for
- // https://codereview.chromium.org/164803002/
- // makes it to Chrome release.
- (function() {
- var t = document.createElement('template');
- var d = t.content.ownerDocument;
- var html = d.appendChild(d.createElement('html'));
- var head = html.appendChild(d.createElement('head'));
- var base = d.createElement('base');
- base.href = document.baseURI;
- head.appendChild(base);
- })();
- }
-
- var allTemplatesSelectors = 'template, ' +
- Object.keys(semanticTemplateElements).map(function(tagName) {
- return tagName.toLowerCase() + '[template]';
- }).join(', ');
-
- function isSVGTemplate(el) {
- return el.tagName == 'template' &&
- el.namespaceURI == 'http://www.w3.org/2000/svg';
- }
-
- function isHTMLTemplate(el) {
- return el.tagName == 'TEMPLATE' &&
- el.namespaceURI == 'http://www.w3.org/1999/xhtml';
- }
-
- function isAttributeTemplate(el) {
- return Boolean(semanticTemplateElements[el.tagName] &&
- el.hasAttribute('template'));
- }
-
- function isTemplate(el) {
- if (el.isTemplate_ === undefined)
- el.isTemplate_ = el.tagName == 'TEMPLATE' || isAttributeTemplate(el);
-
- return el.isTemplate_;
- }
-
- // FIXME: Observe templates being added/removed from documents
- // FIXME: Expose imperative API to decorate and observe templates in
- // "disconnected tress" (e.g. ShadowRoot)
- document.addEventListener('DOMContentLoaded', function(e) {
- bootstrapTemplatesRecursivelyFrom(document);
- // FIXME: Is this needed? Seems like it shouldn't be.
- Platform.performMicrotaskCheckpoint();
- }, false);
-
- function forAllTemplatesFrom(node, fn) {
- var subTemplates = node.querySelectorAll(allTemplatesSelectors);
-
- if (isTemplate(node))
- fn(node)
- forEach(subTemplates, fn);
- }
-
- function bootstrapTemplatesRecursivelyFrom(node) {
- function bootstrap(template) {
- if (!HTMLTemplateElement.decorate(template))
- bootstrapTemplatesRecursivelyFrom(template.content);
- }
-
- forAllTemplatesFrom(node, bootstrap);
- }
-
- if (!hasTemplateElement) {
- /**
- * This represents a <template> element.
- * @constructor
- * @extends {HTMLElement}
- */
- global.HTMLTemplateElement = function() {
- throw TypeError('Illegal constructor');
- };
- }
-
- var hasProto = '__proto__' in {};
-
- function mixin(to, from) {
- Object.getOwnPropertyNames(from).forEach(function(name) {
- Object.defineProperty(to, name,
- Object.getOwnPropertyDescriptor(from, name));
- });
- }
-
- // http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html#dfn-template-contents-owner
- function getOrCreateTemplateContentsOwner(template) {
- var doc = template.ownerDocument
- if (!doc.defaultView)
- return doc;
- var d = doc.templateContentsOwner_;
- if (!d) {
- // TODO(arv): This should either be a Document or HTMLDocument depending
- // on doc.
- d = doc.implementation.createHTMLDocument('');
- while (d.lastChild) {
- d.removeChild(d.lastChild);
- }
- doc.templateContentsOwner_ = d;
- }
- return d;
- }
-
- function getTemplateStagingDocument(template) {
- if (!template.stagingDocument_) {
- var owner = template.ownerDocument;
- if (!owner.stagingDocument_) {
- owner.stagingDocument_ = owner.implementation.createHTMLDocument('');
- owner.stagingDocument_.isStagingDocument = true;
- // TODO(rafaelw): Remove when fix for
- // https://codereview.chromium.org/164803002/
- // makes it to Chrome release.
- var base = owner.stagingDocument_.createElement('base');
- base.href = document.baseURI;
- owner.stagingDocument_.head.appendChild(base);
-
- owner.stagingDocument_.stagingDocument_ = owner.stagingDocument_;
- }
-
- template.stagingDocument_ = owner.stagingDocument_;
- }
-
- return template.stagingDocument_;
- }
-
- // For non-template browsers, the parser will disallow <template> in certain
- // locations, so we allow "attribute templates" which combine the template
- // element with the top-level container node of the content, e.g.
- //
- // <tr template repeat="{{ foo }}"" class="bar"><td>Bar</td></tr>
- //
- // becomes
- //
- // <template repeat="{{ foo }}">
- // + #document-fragment
- // + <tr class="bar">
- // + <td>Bar</td>
- //
- function extractTemplateFromAttributeTemplate(el) {
- var template = el.ownerDocument.createElement('template');
- el.parentNode.insertBefore(template, el);
-
- var attribs = el.attributes;
- var count = attribs.length;
- while (count-- > 0) {
- var attrib = attribs[count];
- if (templateAttributeDirectives[attrib.name]) {
- if (attrib.name !== 'template')
- template.setAttribute(attrib.name, attrib.value);
- el.removeAttribute(attrib.name);
- }
- }
-
- return template;
- }
-
- function extractTemplateFromSVGTemplate(el) {
- var template = el.ownerDocument.createElement('template');
- el.parentNode.insertBefore(template, el);
-
- var attribs = el.attributes;
- var count = attribs.length;
- while (count-- > 0) {
- var attrib = attribs[count];
- template.setAttribute(attrib.name, attrib.value);
- el.removeAttribute(attrib.name);
- }
-
- el.parentNode.removeChild(el);
- return template;
- }
-
- function liftNonNativeTemplateChildrenIntoContent(template, el, useRoot) {
- var content = template.content;
- if (useRoot) {
- content.appendChild(el);
- return;
- }
-
- var child;
- while (child = el.firstChild) {
- content.appendChild(child);
- }
- }
-
- var templateObserver;
- if (typeof MutationObserver == 'function') {
- templateObserver = new MutationObserver(function(records) {
- for (var i = 0; i < records.length; i++) {
- records[i].target.refChanged_();
- }
- });
- }
-
- /**
- * Ensures proper API and content model for template elements.
- * @param {HTMLTemplateElement} opt_instanceRef The template element which
- * |el| template element will return as the value of its ref(), and whose
- * content will be used as source when createInstance() is invoked.
- */
- HTMLTemplateElement.decorate = function(el, opt_instanceRef) {
- if (el.templateIsDecorated_)
- return false;
-
- var templateElement = el;
- templateElement.templateIsDecorated_ = true;
-
- var isNativeHTMLTemplate = isHTMLTemplate(templateElement) &&
- hasTemplateElement;
- var bootstrapContents = isNativeHTMLTemplate;
- var liftContents = !isNativeHTMLTemplate;
- var liftRoot = false;
-
- if (!isNativeHTMLTemplate) {
- if (isAttributeTemplate(templateElement)) {
- assert(!opt_instanceRef);
- templateElement = extractTemplateFromAttributeTemplate(el);
- templateElement.templateIsDecorated_ = true;
- isNativeHTMLTemplate = hasTemplateElement;
- liftRoot = true;
- } else if (isSVGTemplate(templateElement)) {
- templateElement = extractTemplateFromSVGTemplate(el);
- templateElement.templateIsDecorated_ = true;
- isNativeHTMLTemplate = hasTemplateElement;
- }
- }
-
- if (!isNativeHTMLTemplate) {
- fixTemplateElementPrototype(templateElement);
- var doc = getOrCreateTemplateContentsOwner(templateElement);
- templateElement.content_ = doc.createDocumentFragment();
- }
-
- if (opt_instanceRef) {
- // template is contained within an instance, its direct content must be
- // empty
- templateElement.instanceRef_ = opt_instanceRef;
- } else if (liftContents) {
- liftNonNativeTemplateChildrenIntoContent(templateElement,
- el,
- liftRoot);
- } else if (bootstrapContents) {
- bootstrapTemplatesRecursivelyFrom(templateElement.content);
- }
-
- return true;
- };
-
- // TODO(rafaelw): This used to decorate recursively all templates from a given
- // node. This happens by default on 'DOMContentLoaded', but may be needed
- // in subtrees not descendent from document (e.g. ShadowRoot).
- // Review whether this is the right public API.
- HTMLTemplateElement.bootstrap = bootstrapTemplatesRecursivelyFrom;
-
- var htmlElement = global.HTMLUnknownElement || HTMLElement;
-
- var contentDescriptor = {
- get: function() {
- return this.content_;
- },
- enumerable: true,
- configurable: true
- };
-
- if (!hasTemplateElement) {
- // Gecko is more picky with the prototype than WebKit. Make sure to use the
- // same prototype as created in the constructor.
- HTMLTemplateElement.prototype = Object.create(htmlElement.prototype);
-
- Object.defineProperty(HTMLTemplateElement.prototype, 'content',
- contentDescriptor);
- }
-
- function fixTemplateElementPrototype(el) {
- if (hasProto)
- el.__proto__ = HTMLTemplateElement.prototype;
- else
- mixin(el, HTMLTemplateElement.prototype);
- }
-
- function ensureSetModelScheduled(template) {
- if (!template.setModelFn_) {
- template.setModelFn_ = function() {
- template.setModelFnScheduled_ = false;
- var map = getBindings(template,
- template.delegate_ && template.delegate_.prepareBinding);
- processBindings(template, map, template.model_);
- };
- }
-
- if (!template.setModelFnScheduled_) {
- template.setModelFnScheduled_ = true;
- Observer.runEOM_(template.setModelFn_);
- }
- }
-
- mixin(HTMLTemplateElement.prototype, {
- bind: function(name, value, oneTime) {
- if (name != 'ref')
- return Element.prototype.bind.call(this, name, value, oneTime);
-
- var self = this;
- var ref = oneTime ? value : value.open(function(ref) {
- self.setAttribute('ref', ref);
- self.refChanged_();
- });
-
- this.setAttribute('ref', ref);
- this.refChanged_();
- if (oneTime)
- return;
-
- if (!this.bindings_) {
- this.bindings_ = { ref: value };
- } else {
- this.bindings_.ref = value;
- }
-
- return value;
- },
-
- processBindingDirectives_: function(directives) {
- if (this.iterator_)
- this.iterator_.closeDeps();
-
- if (!directives.if && !directives.bind && !directives.repeat) {
- if (this.iterator_) {
- this.iterator_.close();
- this.iterator_ = undefined;
- }
-
- return;
- }
-
- if (!this.iterator_) {
- this.iterator_ = new TemplateIterator(this);
- }
-
- this.iterator_.updateDependencies(directives, this.model_);
-
- if (templateObserver) {
- templateObserver.observe(this, { attributes: true,
- attributeFilter: ['ref'] });
- }
-
- return this.iterator_;
- },
-
- createInstance: function(model, bindingDelegate, delegate_) {
- if (bindingDelegate)
- delegate_ = this.newDelegate_(bindingDelegate);
- else if (!delegate_)
- delegate_ = this.delegate_;
-
- if (!this.refContent_)
- this.refContent_ = this.ref_.content;
- var content = this.refContent_;
- if (content.firstChild === null)
- return emptyInstance;
-
- var map = getInstanceBindingMap(content, delegate_);
- var stagingDocument = getTemplateStagingDocument(this);
- var instance = stagingDocument.createDocumentFragment();
- instance.templateCreator_ = this;
- instance.protoContent_ = content;
- instance.bindings_ = [];
- instance.terminator_ = null;
- var instanceRecord = instance.templateInstance_ = {
- firstNode: null,
- lastNode: null,
- model: model
- };
-
- var i = 0;
- var collectTerminator = false;
- for (var child = content.firstChild; child; child = child.nextSibling) {
- // The terminator of the instance is the clone of the last child of the
- // content. If the last child is an active template, it may produce
- // instances as a result of production, so simply collecting the last
- // child of the instance after it has finished producing may be wrong.
- if (child.nextSibling === null)
- collectTerminator = true;
-
- var clone = cloneAndBindInstance(child, instance, stagingDocument,
- map.children[i++],
- model,
- delegate_,
- instance.bindings_);
- clone.templateInstance_ = instanceRecord;
- if (collectTerminator)
- instance.terminator_ = clone;
- }
-
- instanceRecord.firstNode = instance.firstChild;
- instanceRecord.lastNode = instance.lastChild;
- instance.templateCreator_ = undefined;
- instance.protoContent_ = undefined;
- return instance;
- },
-
- get model() {
- return this.model_;
- },
-
- set model(model) {
- this.model_ = model;
- ensureSetModelScheduled(this);
- },
-
- get bindingDelegate() {
- return this.delegate_ && this.delegate_.raw;
- },
-
- refChanged_: function() {
- if (!this.iterator_ || this.refContent_ === this.ref_.content)
- return;
-
- this.refContent_ = undefined;
- this.iterator_.valueChanged();
- this.iterator_.updateIteratedValue(this.iterator_.getUpdatedValue());
- },
-
- clear: function() {
- this.model_ = undefined;
- this.delegate_ = undefined;
- if (this.bindings_ && this.bindings_.ref)
- this.bindings_.ref.close()
- this.refContent_ = undefined;
- if (!this.iterator_)
- return;
- this.iterator_.valueChanged();
- this.iterator_.close()
- this.iterator_ = undefined;
- },
-
- setDelegate_: function(delegate) {
- this.delegate_ = delegate;
- this.bindingMap_ = undefined;
- if (this.iterator_) {
- this.iterator_.instancePositionChangedFn_ = undefined;
- this.iterator_.instanceModelFn_ = undefined;
- }
- },
-
- newDelegate_: function(bindingDelegate) {
- if (!bindingDelegate)
- return;
-
- function delegateFn(name) {
- var fn = bindingDelegate && bindingDelegate[name];
- if (typeof fn != 'function')
- return;
-
- return function() {
- return fn.apply(bindingDelegate, arguments);
- };
- }
-
- return {
- bindingMaps: {},
- raw: bindingDelegate,
- prepareBinding: delegateFn('prepareBinding'),
- prepareInstanceModel: delegateFn('prepareInstanceModel'),
- prepareInstancePositionChanged:
- delegateFn('prepareInstancePositionChanged')
- };
- },
-
- set bindingDelegate(bindingDelegate) {
- if (this.delegate_) {
- throw Error('Template must be cleared before a new bindingDelegate ' +
- 'can be assigned');
- }
-
- this.setDelegate_(this.newDelegate_(bindingDelegate));
- },
-
- get ref_() {
- var ref = searchRefId(this, this.getAttribute('ref'));
- if (!ref)
- ref = this.instanceRef_;
-
- if (!ref)
- return this;
-
- var nextRef = ref.ref_;
- return nextRef ? nextRef : ref;
- }
- });
-
- // Returns
- // a) undefined if there are no mustaches.
- // b) [TEXT, (ONE_TIME?, PATH, DELEGATE_FN, TEXT)+] if there is at least one mustache.
- function parseMustaches(s, name, node, prepareBindingFn) {
- if (!s || !s.length)
- return;
-
- var tokens;
- var length = s.length;
- var startIndex = 0, lastIndex = 0, endIndex = 0;
- var onlyOneTime = true;
- while (lastIndex < length) {
- var startIndex = s.indexOf('{{', lastIndex);
- var oneTimeStart = s.indexOf('[[', lastIndex);
- var oneTime = false;
- var terminator = '}}';
-
- if (oneTimeStart >= 0 &&
- (startIndex < 0 || oneTimeStart < startIndex)) {
- startIndex = oneTimeStart;
- oneTime = true;
- terminator = ']]';
- }
-
- endIndex = startIndex < 0 ? -1 : s.indexOf(terminator, startIndex + 2);
-
- if (endIndex < 0) {
- if (!tokens)
- return;
-
- tokens.push(s.slice(lastIndex)); // TEXT
- break;
- }
-
- tokens = tokens || [];
- tokens.push(s.slice(lastIndex, startIndex)); // TEXT
- var pathString = s.slice(startIndex + 2, endIndex).trim();
- tokens.push(oneTime); // ONE_TIME?
- onlyOneTime = onlyOneTime && oneTime;
- var delegateFn = prepareBindingFn &&
- prepareBindingFn(pathString, name, node);
- // Don't try to parse the expression if there's a prepareBinding function
- if (delegateFn == null) {
- tokens.push(Path.get(pathString)); // PATH
- } else {
- tokens.push(null);
- }
- tokens.push(delegateFn); // DELEGATE_FN
- lastIndex = endIndex + 2;
- }
-
- if (lastIndex === length)
- tokens.push(''); // TEXT
-
- tokens.hasOnePath = tokens.length === 5;
- tokens.isSimplePath = tokens.hasOnePath &&
- tokens[0] == '' &&
- tokens[4] == '';
- tokens.onlyOneTime = onlyOneTime;
-
- tokens.combinator = function(values) {
- var newValue = tokens[0];
-
- for (var i = 1; i < tokens.length; i += 4) {
- var value = tokens.hasOnePath ? values : values[(i - 1) / 4];
- if (value !== undefined)
- newValue += value;
- newValue += tokens[i + 3];
- }
-
- return newValue;
- }
-
- return tokens;
- };
-
- function processOneTimeBinding(name, tokens, node, model) {
- if (tokens.hasOnePath) {
- var delegateFn = tokens[3];
- var value = delegateFn ? delegateFn(model, node, true) :
- tokens[2].getValueFrom(model);
- return tokens.isSimplePath ? value : tokens.combinator(value);
- }
-
- var values = [];
- for (var i = 1; i < tokens.length; i += 4) {
- var delegateFn = tokens[i + 2];
- values[(i - 1) / 4] = delegateFn ? delegateFn(model, node) :
- tokens[i + 1].getValueFrom(model);
- }
-
- return tokens.combinator(values);
- }
-
- function processSinglePathBinding(name, tokens, node, model) {
- var delegateFn = tokens[3];
- var observer = delegateFn ? delegateFn(model, node, false) :
- new PathObserver(model, tokens[2]);
-
- return tokens.isSimplePath ? observer :
- new ObserverTransform(observer, tokens.combinator);
- }
-
- function processBinding(name, tokens, node, model) {
- if (tokens.onlyOneTime)
- return processOneTimeBinding(name, tokens, node, model);
-
- if (tokens.hasOnePath)
- return processSinglePathBinding(name, tokens, node, model);
-
- var observer = new CompoundObserver();
-
- for (var i = 1; i < tokens.length; i += 4) {
- var oneTime = tokens[i];
- var delegateFn = tokens[i + 2];
-
- if (delegateFn) {
- var value = delegateFn(model, node, oneTime);
- if (oneTime)
- observer.addPath(value)
- else
- observer.addObserver(value);
- continue;
- }
-
- var path = tokens[i + 1];
- if (oneTime)
- observer.addPath(path.getValueFrom(model))
- else
- observer.addPath(model, path);
- }
-
- return new ObserverTransform(observer, tokens.combinator);
- }
-
- function processBindings(node, bindings, model, instanceBindings) {
- for (var i = 0; i < bindings.length; i += 2) {
- var name = bindings[i]
- var tokens = bindings[i + 1];
- var value = processBinding(name, tokens, node, model);
- var binding = node.bind(name, value, tokens.onlyOneTime);
- if (binding && instanceBindings)
- instanceBindings.push(binding);
- }
-
- node.bindFinished();
- if (!bindings.isTemplate)
- return;
-
- node.model_ = model;
- var iter = node.processBindingDirectives_(bindings);
- if (instanceBindings && iter)
- instanceBindings.push(iter);
- }
-
- function parseWithDefault(el, name, prepareBindingFn) {
- var v = el.getAttribute(name);
- return parseMustaches(v == '' ? '{{}}' : v, name, el, prepareBindingFn);
- }
-
- function parseAttributeBindings(element, prepareBindingFn) {
- assert(element);
-
- var bindings = [];
- var ifFound = false;
- var bindFound = false;
-
- for (var i = 0; i < element.attributes.length; i++) {
- var attr = element.attributes[i];
- var name = attr.name;
- var value = attr.value;
-
- // Allow bindings expressed in attributes to be prefixed with underbars.
- // We do this to allow correct semantics for browsers that don't implement
- // <template> where certain attributes might trigger side-effects -- and
- // for IE which sanitizes certain attributes, disallowing mustache
- // replacements in their text.
- while (name[0] === '_') {
- name = name.substring(1);
- }
-
- if (isTemplate(element) &&
- (name === IF || name === BIND || name === REPEAT)) {
- continue;
- }
-
- var tokens = parseMustaches(value, name, element,
- prepareBindingFn);
- if (!tokens)
- continue;
-
- bindings.push(name, tokens);
- }
-
- if (isTemplate(element)) {
- bindings.isTemplate = true;
- bindings.if = parseWithDefault(element, IF, prepareBindingFn);
- bindings.bind = parseWithDefault(element, BIND, prepareBindingFn);
- bindings.repeat = parseWithDefault(element, REPEAT, prepareBindingFn);
-
- if (bindings.if && !bindings.bind && !bindings.repeat)
- bindings.bind = parseMustaches('{{}}', BIND, element, prepareBindingFn);
- }
-
- return bindings;
- }
-
- function getBindings(node, prepareBindingFn) {
- if (node.nodeType === Node.ELEMENT_NODE)
- return parseAttributeBindings(node, prepareBindingFn);
-
- if (node.nodeType === Node.TEXT_NODE) {
- var tokens = parseMustaches(node.data, 'textContent', node,
- prepareBindingFn);
- if (tokens)
- return ['textContent', tokens];
- }
-
- return [];
- }
-
- function cloneAndBindInstance(node, parent, stagingDocument, bindings, model,
- delegate,
- instanceBindings,
- instanceRecord) {
- var clone = parent.appendChild(stagingDocument.importNode(node, false));
-
- var i = 0;
- for (var child = node.firstChild; child; child = child.nextSibling) {
- cloneAndBindInstance(child, clone, stagingDocument,
- bindings.children[i++],
- model,
- delegate,
- instanceBindings);
- }
-
- if (bindings.isTemplate) {
- HTMLTemplateElement.decorate(clone, node);
- if (delegate)
- clone.setDelegate_(delegate);
- }
-
- processBindings(clone, bindings, model, instanceBindings);
- return clone;
- }
-
- function createInstanceBindingMap(node, prepareBindingFn) {
- var map = getBindings(node, prepareBindingFn);
- map.children = {};
- var index = 0;
- for (var child = node.firstChild; child; child = child.nextSibling) {
- map.children[index++] = createInstanceBindingMap(child, prepareBindingFn);
- }
-
- return map;
- }
-
- var contentUidCounter = 1;
-
- // TODO(rafaelw): Setup a MutationObserver on content which clears the id
- // so that bindingMaps regenerate when the template.content changes.
- function getContentUid(content) {
- var id = content.id_;
- if (!id)
- id = content.id_ = contentUidCounter++;
- return id;
- }
-
- // Each delegate is associated with a set of bindingMaps, one for each
- // content which may be used by a template. The intent is that each binding
- // delegate gets the opportunity to prepare the instance (via the prepare*
- // delegate calls) once across all uses.
- // TODO(rafaelw): Separate out the parse map from the binding map. In the
- // current implementation, if two delegates need a binding map for the same
- // content, the second will have to reparse.
- function getInstanceBindingMap(content, delegate_) {
- var contentId = getContentUid(content);
- if (delegate_) {
- var map = delegate_.bindingMaps[contentId];
- if (!map) {
- map = delegate_.bindingMaps[contentId] =
- createInstanceBindingMap(content, delegate_.prepareBinding) || [];
- }
- return map;
- }
-
- var map = content.bindingMap_;
- if (!map) {
- map = content.bindingMap_ =
- createInstanceBindingMap(content, undefined) || [];
- }
- return map;
- }
-
- Object.defineProperty(Node.prototype, 'templateInstance', {
- get: function() {
- var instance = this.templateInstance_;
- return instance ? instance :
- (this.parentNode ? this.parentNode.templateInstance : undefined);
- }
- });
-
- var emptyInstance = document.createDocumentFragment();
- emptyInstance.bindings_ = [];
- emptyInstance.terminator_ = null;
-
- function TemplateIterator(templateElement) {
- this.closed = false;
- this.templateElement_ = templateElement;
- this.instances = [];
- this.deps = undefined;
- this.iteratedValue = [];
- this.presentValue = undefined;
- this.arrayObserver = undefined;
- }
-
- TemplateIterator.prototype = {
- closeDeps: function() {
- var deps = this.deps;
- if (deps) {
- if (deps.ifOneTime === false)
- deps.ifValue.close();
- if (deps.oneTime === false)
- deps.value.close();
- }
- },
-
- updateDependencies: function(directives, model) {
- this.closeDeps();
-
- var deps = this.deps = {};
- var template = this.templateElement_;
-
- var ifValue = true;
- if (directives.if) {
- deps.hasIf = true;
- deps.ifOneTime = directives.if.onlyOneTime;
- deps.ifValue = processBinding(IF, directives.if, template, model);
-
- ifValue = deps.ifValue;
-
- // oneTime if & predicate is false. nothing else to do.
- if (deps.ifOneTime && !ifValue) {
- this.valueChanged();
- return;
- }
-
- if (!deps.ifOneTime)
- ifValue = ifValue.open(this.updateIfValue, this);
- }
-
- if (directives.repeat) {
- deps.repeat = true;
- deps.oneTime = directives.repeat.onlyOneTime;
- deps.value = processBinding(REPEAT, directives.repeat, template, model);
- } else {
- deps.repeat = false;
- deps.oneTime = directives.bind.onlyOneTime;
- deps.value = processBinding(BIND, directives.bind, template, model);
- }
-
- var value = deps.value;
- if (!deps.oneTime)
- value = value.open(this.updateIteratedValue, this);
-
- if (!ifValue) {
- this.valueChanged();
- return;
- }
-
- this.updateValue(value);
- },
-
- /**
- * Gets the updated value of the bind/repeat. This can potentially call
- * user code (if a bindingDelegate is set up) so we try to avoid it if we
- * already have the value in hand (from Observer.open).
- */
- getUpdatedValue: function() {
- var value = this.deps.value;
- if (!this.deps.oneTime)
- value = value.discardChanges();
- return value;
- },
-
- updateIfValue: function(ifValue) {
- if (!ifValue) {
- this.valueChanged();
- return;
- }
-
- this.updateValue(this.getUpdatedValue());
- },
-
- updateIteratedValue: function(value) {
- if (this.deps.hasIf) {
- var ifValue = this.deps.ifValue;
- if (!this.deps.ifOneTime)
- ifValue = ifValue.discardChanges();
- if (!ifValue) {
- this.valueChanged();
- return;
- }
- }
-
- this.updateValue(value);
- },
-
- updateValue: function(value) {
- if (!this.deps.repeat)
- value = [value];
- var observe = this.deps.repeat &&
- !this.deps.oneTime &&
- Array.isArray(value);
- this.valueChanged(value, observe);
- },
-
- valueChanged: function(value, observeValue) {
- if (!Array.isArray(value))
- value = [];
-
- if (value === this.iteratedValue)
- return;
-
- this.unobserve();
- this.presentValue = value;
- if (observeValue) {
- this.arrayObserver = new ArrayObserver(this.presentValue);
- this.arrayObserver.open(this.handleSplices, this);
- }
-
- this.handleSplices(ArrayObserver.calculateSplices(this.presentValue,
- this.iteratedValue));
- },
-
- getLastInstanceNode: function(index) {
- if (index == -1)
- return this.templateElement_;
- var instance = this.instances[index];
- var terminator = instance.terminator_;
- if (!terminator)
- return this.getLastInstanceNode(index - 1);
-
- if (terminator.nodeType !== Node.ELEMENT_NODE ||
- this.templateElement_ === terminator) {
- return terminator;
- }
-
- var subtemplateIterator = terminator.iterator_;
- if (!subtemplateIterator)
- return terminator;
-
- return subtemplateIterator.getLastTemplateNode();
- },
-
- getLastTemplateNode: function() {
- return this.getLastInstanceNode(this.instances.length - 1);
- },
-
- insertInstanceAt: function(index, fragment) {
- var previousInstanceLast = this.getLastInstanceNode(index - 1);
- var parent = this.templateElement_.parentNode;
- this.instances.splice(index, 0, fragment);
-
- parent.insertBefore(fragment, previousInstanceLast.nextSibling);
- },
-
- extractInstanceAt: function(index) {
- var previousInstanceLast = this.getLastInstanceNode(index - 1);
- var lastNode = this.getLastInstanceNode(index);
- var parent = this.templateElement_.parentNode;
- var instance = this.instances.splice(index, 1)[0];
-
- while (lastNode !== previousInstanceLast) {
- var node = previousInstanceLast.nextSibling;
- if (node == lastNode)
- lastNode = previousInstanceLast;
-
- instance.appendChild(parent.removeChild(node));
- }
-
- return instance;
- },
-
- getDelegateFn: function(fn) {
- fn = fn && fn(this.templateElement_);
- return typeof fn === 'function' ? fn : null;
- },
-
- handleSplices: function(splices) {
- if (this.closed || !splices.length)
- return;
-
- var template = this.templateElement_;
-
- if (!template.parentNode) {
- this.close();
- return;
- }
-
- ArrayObserver.applySplices(this.iteratedValue, this.presentValue,
- splices);
-
- var delegate = template.delegate_;
- if (this.instanceModelFn_ === undefined) {
- this.instanceModelFn_ =
- this.getDelegateFn(delegate && delegate.prepareInstanceModel);
- }
-
- if (this.instancePositionChangedFn_ === undefined) {
- this.instancePositionChangedFn_ =
- this.getDelegateFn(delegate &&
- delegate.prepareInstancePositionChanged);
- }
-
- // Instance Removals
- var instanceCache = new Map;
- var removeDelta = 0;
- for (var i = 0; i < splices.length; i++) {
- var splice = splices[i];
- var removed = splice.removed;
- for (var j = 0; j < removed.length; j++) {
- var model = removed[j];
- var instance = this.extractInstanceAt(splice.index + removeDelta);
- if (instance !== emptyInstance) {
- instanceCache.set(model, instance);
- }
- }
-
- removeDelta -= splice.addedCount;
- }
-
- // Instance Insertions
- for (var i = 0; i < splices.length; i++) {
- var splice = splices[i];
- var addIndex = splice.index;
- for (; addIndex < splice.index + splice.addedCount; addIndex++) {
- var model = this.iteratedValue[addIndex];
- var instance = instanceCache.get(model);
- if (instance) {
- instanceCache.delete(model);
- } else {
- if (this.instanceModelFn_) {
- model = this.instanceModelFn_(model);
- }
-
- if (model === undefined) {
- instance = emptyInstance;
- } else {
- instance = template.createInstance(model, undefined, delegate);
- }
- }
-
- this.insertInstanceAt(addIndex, instance);
- }
- }
-
- instanceCache.forEach(function(instance) {
- this.closeInstanceBindings(instance);
- }, this);
-
- if (this.instancePositionChangedFn_)
- this.reportInstancesMoved(splices);
- },
-
- reportInstanceMoved: function(index) {
- var instance = this.instances[index];
- if (instance === emptyInstance)
- return;
-
- this.instancePositionChangedFn_(instance.templateInstance_, index);
- },
-
- reportInstancesMoved: function(splices) {
- var index = 0;
- var offset = 0;
- for (var i = 0; i < splices.length; i++) {
- var splice = splices[i];
- if (offset != 0) {
- while (index < splice.index) {
- this.reportInstanceMoved(index);
- index++;
- }
- } else {
- index = splice.index;
- }
-
- while (index < splice.index + splice.addedCount) {
- this.reportInstanceMoved(index);
- index++;
- }
-
- offset += splice.addedCount - splice.removed.length;
- }
-
- if (offset == 0)
- return;
-
- var length = this.instances.length;
- while (index < length) {
- this.reportInstanceMoved(index);
- index++;
- }
- },
-
- closeInstanceBindings: function(instance) {
- var bindings = instance.bindings_;
- for (var i = 0; i < bindings.length; i++) {
- bindings[i].close();
- }
- },
-
- unobserve: function() {
- if (!this.arrayObserver)
- return;
-
- this.arrayObserver.close();
- this.arrayObserver = undefined;
- },
-
- close: function() {
- if (this.closed)
- return;
- this.unobserve();
- for (var i = 0; i < this.instances.length; i++) {
- this.closeInstanceBindings(this.instances[i]);
- }
-
- this.instances.length = 0;
- this.closeDeps();
- this.templateElement_.iterator_ = undefined;
- this.closed = true;
- }
- };
-
- // Polyfill-specific API.
- HTMLTemplateElement.forAllTemplatesFrom_ = forAllTemplatesFrom;
-})(this);
-
-(function(scope) {
- 'use strict';
-
- // feature detect for URL constructor
- var hasWorkingUrl = false;
- if (!scope.forceJURL) {
- try {
- var u = new URL('b', 'http://a');
- u.pathname = 'c%20d';
- hasWorkingUrl = u.href === 'http://a/c%20d';
- } catch(e) {}
- }
-
- if (hasWorkingUrl)
- return;
-
- var relative = Object.create(null);
- relative['ftp'] = 21;
- relative['file'] = 0;
- relative['gopher'] = 70;
- relative['http'] = 80;
- relative['https'] = 443;
- relative['ws'] = 80;
- relative['wss'] = 443;
-
- var relativePathDotMapping = Object.create(null);
- relativePathDotMapping['%2e'] = '.';
- relativePathDotMapping['.%2e'] = '..';
- relativePathDotMapping['%2e.'] = '..';
- relativePathDotMapping['%2e%2e'] = '..';
-
- function isRelativeScheme(scheme) {
- return relative[scheme] !== undefined;
- }
-
- function invalid() {
- clear.call(this);
- this._isInvalid = true;
- }
-
- function IDNAToASCII(h) {
- if ('' == h) {
- invalid.call(this)
- }
- // XXX
- return h.toLowerCase()
- }
-
- function percentEscape(c) {
- var unicode = c.charCodeAt(0);
- if (unicode > 0x20 &&
- unicode < 0x7F &&
- // " # < > ? `
- [0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) == -1
- ) {
- return c;
- }
- return encodeURIComponent(c);
- }
-
- function percentEscapeQuery(c) {
- // XXX This actually needs to encode c using encoding and then
- // convert the bytes one-by-one.
-
- var unicode = c.charCodeAt(0);
- if (unicode > 0x20 &&
- unicode < 0x7F &&
- // " # < > ` (do not escape '?')
- [0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) == -1
- ) {
- return c;
- }
- return encodeURIComponent(c);
- }
-
- var EOF = undefined,
- ALPHA = /[a-zA-Z]/,
- ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
-
- function parse(input, stateOverride, base) {
- function err(message) {
- errors.push(message)
- }
-
- var state = stateOverride || 'scheme start',
- cursor = 0,
- buffer = '',
- seenAt = false,
- seenBracket = false,
- errors = [];
-
- loop: while ((input[cursor - 1] != EOF || cursor == 0) && !this._isInvalid) {
- var c = input[cursor];
- switch (state) {
- case 'scheme start':
- if (c && ALPHA.test(c)) {
- buffer += c.toLowerCase(); // ASCII-safe
- state = 'scheme';
- } else if (!stateOverride) {
- buffer = '';
- state = 'no scheme';
- continue;
- } else {
- err('Invalid scheme.');
- break loop;
- }
- break;
-
- case 'scheme':
- if (c && ALPHANUMERIC.test(c)) {
- buffer += c.toLowerCase(); // ASCII-safe
- } else if (':' == c) {
- this._scheme = buffer;
- buffer = '';
- if (stateOverride) {
- break loop;
- }
- if (isRelativeScheme(this._scheme)) {
- this._isRelative = true;
- }
- if ('file' == this._scheme) {
- state = 'relative';
- } else if (this._isRelative && base && base._scheme == this._scheme) {
- state = 'relative or authority';
- } else if (this._isRelative) {
- state = 'authority first slash';
- } else {
- state = 'scheme data';
- }
- } else if (!stateOverride) {
- buffer = '';
- cursor = 0;
- state = 'no scheme';
- continue;
- } else if (EOF == c) {
- break loop;
- } else {
- err('Code point not allowed in scheme: ' + c)
- break loop;
- }
- break;
-
- case 'scheme data':
- if ('?' == c) {
- query = '?';
- state = 'query';
- } else if ('#' == c) {
- this._fragment = '#';
- state = 'fragment';
- } else {
- // XXX error handling
- if (EOF != c && '\t' != c && '\n' != c && '\r' != c) {
- this._schemeData += percentEscape(c);
- }
- }
- break;
-
- case 'no scheme':
- if (!base || !(isRelativeScheme(base._scheme))) {
- err('Missing scheme.');
- invalid.call(this);
- } else {
- state = 'relative';
- continue;
- }
- break;
-
- case 'relative or authority':
- if ('/' == c && '/' == input[cursor+1]) {
- state = 'authority ignore slashes';
- } else {
- err('Expected /, got: ' + c);
- state = 'relative';
- continue
- }
- break;
-
- case 'relative':
- this._isRelative = true;
- if ('file' != this._scheme)
- this._scheme = base._scheme;
- if (EOF == c) {
- this._host = base._host;
- this._port = base._port;
- this._path = base._path.slice();
- this._query = base._query;
- break loop;
- } else if ('/' == c || '\\' == c) {
- if ('\\' == c)
- err('\\ is an invalid code point.');
- state = 'relative slash';
- } else if ('?' == c) {
- this._host = base._host;
- this._port = base._port;
- this._path = base._path.slice();
- this._query = '?';
- state = 'query';
- } else if ('#' == c) {
- this._host = base._host;
- this._port = base._port;
- this._path = base._path.slice();
- this._query = base._query;
- this._fragment = '#';
- state = 'fragment';
- } else {
- var nextC = input[cursor+1]
- var nextNextC = input[cursor+2]
- if (
- 'file' != this._scheme || !ALPHA.test(c) ||
- (nextC != ':' && nextC != '|') ||
- (EOF != nextNextC && '/' != nextNextC && '\\' != nextNextC && '?' != nextNextC && '#' != nextNextC)) {
- this._host = base._host;
- this._port = base._port;
- this._path = base._path.slice();
- this._path.pop();
- }
- state = 'relative path';
- continue;
- }
- break;
-
- case 'relative slash':
- if ('/' == c || '\\' == c) {
- if ('\\' == c) {
- err('\\ is an invalid code point.');
- }
- if ('file' == this._scheme) {
- state = 'file host';
- } else {
- state = 'authority ignore slashes';
- }
- } else {
- if ('file' != this._scheme) {
- this._host = base._host;
- this._port = base._port;
- }
- state = 'relative path';
- continue;
- }
- break;
-
- case 'authority first slash':
- if ('/' == c) {
- state = 'authority second slash';
- } else {
- err("Expected '/', got: " + c);
- state = 'authority ignore slashes';
- continue;
- }
- break;
-
- case 'authority second slash':
- state = 'authority ignore slashes';
- if ('/' != c) {
- err("Expected '/', got: " + c);
- continue;
- }
- break;
-
- case 'authority ignore slashes':
- if ('/' != c && '\\' != c) {
- state = 'authority';
- continue;
- } else {
- err('Expected authority, got: ' + c);
- }
- break;
-
- case 'authority':
- if ('@' == c) {
- if (seenAt) {
- err('@ already seen.');
- buffer += '%40';
- }
- seenAt = true;
- for (var i = 0; i < buffer.length; i++) {
- var cp = buffer[i];
- if ('\t' == cp || '\n' == cp || '\r' == cp) {
- err('Invalid whitespace in authority.');
- continue;
- }
- // XXX check URL code points
- if (':' == cp && null === this._password) {
- this._password = '';
- continue;
- }
- var tempC = percentEscape(cp);
- (null !== this._password) ? this._password += tempC : this._username += tempC;
- }
- buffer = '';
- } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) {
- cursor -= buffer.length;
- buffer = '';
- state = 'host';
- continue;
- } else {
- buffer += c;
- }
- break;
-
- case 'file host':
- if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) {
- if (buffer.length == 2 && ALPHA.test(buffer[0]) && (buffer[1] == ':' || buffer[1] == '|')) {
- state = 'relative path';
- } else if (buffer.length == 0) {
- state = 'relative path start';
- } else {
- this._host = IDNAToASCII.call(this, buffer);
- buffer = '';
- state = 'relative path start';
- }
- continue;
- } else if ('\t' == c || '\n' == c || '\r' == c) {
- err('Invalid whitespace in file host.');
- } else {
- buffer += c;
- }
- break;
-
- case 'host':
- case 'hostname':
- if (':' == c && !seenBracket) {
- // XXX host parsing
- this._host = IDNAToASCII.call(this, buffer);
- buffer = '';
- state = 'port';
- if ('hostname' == stateOverride) {
- break loop;
- }
- } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) {
- this._host = IDNAToASCII.call(this, buffer);
- buffer = '';
- state = 'relative path start';
- if (stateOverride) {
- break loop;
- }
- continue;
- } else if ('\t' != c && '\n' != c && '\r' != c) {
- if ('[' == c) {
- seenBracket = true;
- } else if (']' == c) {
- seenBracket = false;
- }
- buffer += c;
- } else {
- err('Invalid code point in host/hostname: ' + c);
- }
- break;
-
- case 'port':
- if (/[0-9]/.test(c)) {
- buffer += c;
- } else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c || stateOverride) {
- if ('' != buffer) {
- var temp = parseInt(buffer, 10);
- if (temp != relative[this._scheme]) {
- this._port = temp + '';
- }
- buffer = '';
- }
- if (stateOverride) {
- break loop;
- }
- state = 'relative path start';
- continue;
- } else if ('\t' == c || '\n' == c || '\r' == c) {
- err('Invalid code point in port: ' + c);
- } else {
- invalid.call(this);
- }
- break;
-
- case 'relative path start':
- if ('\\' == c)
- err("'\\' not allowed in path.");
- state = 'relative path';
- if ('/' != c && '\\' != c) {
- continue;
- }
- break;
-
- case 'relative path':
- if (EOF == c || '/' == c || '\\' == c || (!stateOverride && ('?' == c || '#' == c))) {
- if ('\\' == c) {
- err('\\ not allowed in relative path.');
- }
- var tmp;
- if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
- buffer = tmp;
- }
- if ('..' == buffer) {
- this._path.pop();
- if ('/' != c && '\\' != c) {
- this._path.push('');
- }
- } else if ('.' == buffer && '/' != c && '\\' != c) {
- this._path.push('');
- } else if ('.' != buffer) {
- if ('file' == this._scheme && this._path.length == 0 && buffer.length == 2 && ALPHA.test(buffer[0]) && buffer[1] == '|') {
- buffer = buffer[0] + ':';
- }
- this._path.push(buffer);
- }
- buffer = '';
- if ('?' == c) {
- this._query = '?';
- state = 'query';
- } else if ('#' == c) {
- this._fragment = '#';
- state = 'fragment';
- }
- } else if ('\t' != c && '\n' != c && '\r' != c) {
- buffer += percentEscape(c);
- }
- break;
-
- case 'query':
- if (!stateOverride && '#' == c) {
- this._fragment = '#';
- state = 'fragment';
- } else if (EOF != c && '\t' != c && '\n' != c && '\r' != c) {
- this._query += percentEscapeQuery(c);
- }
- break;
-
- case 'fragment':
- if (EOF != c && '\t' != c && '\n' != c && '\r' != c) {
- this._fragment += c;
- }
- break;
- }
-
- cursor++;
- }
- }
-
- function clear() {
- this._scheme = '';
- this._schemeData = '';
- this._username = '';
- this._password = null;
- this._host = '';
- this._port = '';
- this._path = [];
- this._query = '';
- this._fragment = '';
- this._isInvalid = false;
- this._isRelative = false;
- }
-
- // Does not process domain names or IP addresses.
- // Does not handle encoding for the query parameter.
- function jURL(url, base /* , encoding */) {
- if (base !== undefined && !(base instanceof jURL))
- base = new jURL(String(base));
-
- this._url = url;
- clear.call(this);
-
- var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
- // encoding = encoding || 'utf-8'
-
- parse.call(this, input, null, base);
- }
-
- jURL.prototype = {
- get href() {
- if (this._isInvalid)
- return this._url;
-
- var authority = '';
- if ('' != this._username || null != this._password) {
- authority = this._username +
- (null != this._password ? ':' + this._password : '') + '@';
- }
-
- return this.protocol +
- (this._isRelative ? '//' + authority + this.host : '') +
- this.pathname + this._query + this._fragment;
- },
- set href(href) {
- clear.call(this);
- parse.call(this, href);
- },
-
- get protocol() {
- return this._scheme + ':';
- },
- set protocol(protocol) {
- if (this._isInvalid)
- return;
- parse.call(this, protocol + ':', 'scheme start');
- },
-
- get host() {
- return this._isInvalid ? '' : this._port ?
- this._host + ':' + this._port : this._host;
- },
- set host(host) {
- if (this._isInvalid || !this._isRelative)
- return;
- parse.call(this, host, 'host');
- },
-
- get hostname() {
- return this._host;
- },
- set hostname(hostname) {
- if (this._isInvalid || !this._isRelative)
- return;
- parse.call(this, hostname, 'hostname');
- },
-
- get port() {
- return this._port;
- },
- set port(port) {
- if (this._isInvalid || !this._isRelative)
- return;
- parse.call(this, port, 'port');
- },
-
- get pathname() {
- return this._isInvalid ? '' : this._isRelative ?
- '/' + this._path.join('/') : this._schemeData;
- },
- set pathname(pathname) {
- if (this._isInvalid || !this._isRelative)
- return;
- this._path = [];
- parse.call(this, pathname, 'relative path start');
- },
-
- get search() {
- return this._isInvalid || !this._query || '?' == this._query ?
- '' : this._query;
- },
- set search(search) {
- if (this._isInvalid || !this._isRelative)
- return;
- this._query = '?';
- if ('?' == search[0])
- search = search.slice(1);
- parse.call(this, search, 'query');
- },
-
- get hash() {
- return this._isInvalid || !this._fragment || '#' == this._fragment ?
- '' : this._fragment;
- },
- set hash(hash) {
- if (this._isInvalid)
- return;
- this._fragment = '#';
- if ('#' == hash[0])
- hash = hash.slice(1);
- parse.call(this, hash, 'fragment');
- },
-
- get origin() {
- var host;
- if (this._isInvalid || !this._scheme) {
- return '';
- }
- // javascript: Gecko returns String(""), WebKit/Blink String("null")
- // Gecko throws error for "data://"
- // data: Gecko returns "", Blink returns "data://", WebKit returns "null"
- // Gecko returns String("") for file: mailto:
- // WebKit/Blink returns String("SCHEME://") for file: mailto:
- switch (this._scheme) {
- case 'data':
- case 'file':
- case 'javascript':
- case 'mailto':
- return 'null';
- }
- host = this.host;
- if (!host) {
- return '';
- }
- return this._scheme + '://' + host;
- }
- };
-
- // Copy over the static methods
- var OriginalURL = scope.URL;
- if (OriginalURL) {
- jURL.createObjectURL = function(blob) {
- // IE extension allows a second optional options argument.
- // http://msdn.microsoft.com/en-us/library/ie/hh772302(v=vs.85).aspx
- return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
- };
- jURL.revokeObjectURL = function(url) {
- OriginalURL.revokeObjectURL(url);
- };
- }
-
- scope.URL = jURL;
-
-})(this);
-
-(function(scope) {
-
-var iterations = 0;
-var callbacks = [];
-var twiddle = document.createTextNode('');
-
-function endOfMicrotask(callback) {
- twiddle.textContent = iterations++;
- callbacks.push(callback);
-}
-
-function atEndOfMicrotask() {
- while (callbacks.length) {
- callbacks.shift()();
- }
-}
-
-new (window.MutationObserver || JsMutationObserver)(atEndOfMicrotask)
- .observe(twiddle, {characterData: true})
- ;
-
-// exports
-scope.endOfMicrotask = endOfMicrotask;
-// bc
-Platform.endOfMicrotask = endOfMicrotask;
-
-})(Polymer);
-
-
-(function(scope) {
-
-/**
- * @class Polymer
- */
-
-// imports
-var endOfMicrotask = scope.endOfMicrotask;
-
-// logging
-var log = window.WebComponents ? WebComponents.flags.log : {};
-
-// inject style sheet
-var style = document.createElement('style');
-style.textContent = 'template {display: none !important;} /* injected by platform.js */';
-var head = document.querySelector('head');
-head.insertBefore(style, head.firstChild);
-
-
-/**
- * Force any pending data changes to be observed before
- * the next task. Data changes are processed asynchronously but are guaranteed
- * to be processed, for example, before painting. This method should rarely be
- * needed. It does nothing when Object.observe is available;
- * when Object.observe is not available, Polymer automatically flushes data
- * changes approximately every 1/10 second.
- * Therefore, `flush` should only be used when a data mutation should be
- * observed sooner than this.
- *
- * @method flush
- */
-// flush (with logging)
-var flushing;
-function flush() {
- if (!flushing) {
- flushing = true;
- endOfMicrotask(function() {
- flushing = false;
- log.data && console.group('flush');
- Platform.performMicrotaskCheckpoint();
- log.data && console.groupEnd();
- });
- }
-};
-
-// polling dirty checker
-// flush periodically if platform does not have object observe.
-if (!Observer.hasObjectObserve) {
- var FLUSH_POLL_INTERVAL = 125;
- window.addEventListener('WebComponentsReady', function() {
- flush();
- // watch document visiblity to toggle dirty-checking
- var visibilityHandler = function() {
- // only flush if the page is visibile
- if (document.visibilityState === 'hidden') {
- if (scope.flushPoll) {
- clearInterval(scope.flushPoll);
- }
- } else {
- scope.flushPoll = setInterval(flush, FLUSH_POLL_INTERVAL);
- }
- };
- if (typeof document.visibilityState === 'string') {
- document.addEventListener('visibilitychange', visibilityHandler);
- }
- visibilityHandler();
- });
-} else {
- // make flush a no-op when we have Object.observe
- flush = function() {};
-}
-
-if (window.CustomElements && !CustomElements.useNative) {
- var originalImportNode = Document.prototype.importNode;
- Document.prototype.importNode = function(node, deep) {
- var imported = originalImportNode.call(this, node, deep);
- CustomElements.upgradeAll(imported);
- return imported;
- };
-}
-
-// exports
-scope.flush = flush;
-// bc
-Platform.flush = flush;
-
-})(window.Polymer);
-
-
-(function(scope) {
-
-var urlResolver = {
- resolveDom: function(root, url) {
- url = url || baseUrl(root);
- this.resolveAttributes(root, url);
- this.resolveStyles(root, url);
- // handle template.content
- var templates = root.querySelectorAll('template');
- if (templates) {
- for (var i = 0, l = templates.length, t; (i < l) && (t = templates[i]); i++) {
- if (t.content) {
- this.resolveDom(t.content, url);
- }
- }
- }
- },
- resolveTemplate: function(template) {
- this.resolveDom(template.content, baseUrl(template));
- },
- resolveStyles: function(root, url) {
- var styles = root.querySelectorAll('style');
- if (styles) {
- for (var i = 0, l = styles.length, s; (i < l) && (s = styles[i]); i++) {
- this.resolveStyle(s, url);
- }
- }
- },
- resolveStyle: function(style, url) {
- url = url || baseUrl(style);
- style.textContent = this.resolveCssText(style.textContent, url);
- },
- resolveCssText: function(cssText, baseUrl, keepAbsolute) {
- cssText = replaceUrlsInCssText(cssText, baseUrl, keepAbsolute, CSS_URL_REGEXP);
- return replaceUrlsInCssText(cssText, baseUrl, keepAbsolute, CSS_IMPORT_REGEXP);
- },
- resolveAttributes: function(root, url) {
- if (root.hasAttributes && root.hasAttributes()) {
- this.resolveElementAttributes(root, url);
- }
- // search for attributes that host urls
- var nodes = root && root.querySelectorAll(URL_ATTRS_SELECTOR);
- if (nodes) {
- for (var i = 0, l = nodes.length, n; (i < l) && (n = nodes[i]); i++) {
- this.resolveElementAttributes(n, url);
- }
- }
- },
- resolveElementAttributes: function(node, url) {
- url = url || baseUrl(node);
- URL_ATTRS.forEach(function(v) {
- var attr = node.attributes[v];
- var value = attr && attr.value;
- var replacement;
- if (value && value.search(URL_TEMPLATE_SEARCH) < 0) {
- if (v === 'style') {
- replacement = replaceUrlsInCssText(value, url, false, CSS_URL_REGEXP);
- } else {
- replacement = resolveRelativeUrl(url, value);
- }
- attr.value = replacement;
- }
- });
- }
-};
-
-var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
-var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
-var URL_ATTRS = ['href', 'src', 'action', 'style', 'url'];
-var URL_ATTRS_SELECTOR = '[' + URL_ATTRS.join('],[') + ']';
-var URL_TEMPLATE_SEARCH = '{{.*}}';
-var URL_HASH = '#';
-
-function baseUrl(node) {
- var u = new URL(node.ownerDocument.baseURI);
- u.search = '';
- u.hash = '';
- return u;
-}
-
-function replaceUrlsInCssText(cssText, baseUrl, keepAbsolute, regexp) {
- return cssText.replace(regexp, function(m, pre, url, post) {
- var urlPath = url.replace(/["']/g, '');
- urlPath = resolveRelativeUrl(baseUrl, urlPath, keepAbsolute);
- return pre + '\'' + urlPath + '\'' + post;
- });
-}
-
-function resolveRelativeUrl(baseUrl, url, keepAbsolute) {
- // do not resolve '/' absolute urls
- if (url && url[0] === '/') {
- return url;
- }
- // do not resolve '#' links, they are used for routing
- if (url && url[0] === '#') {
- return url;
- }
- var u = new URL(url, baseUrl);
- return keepAbsolute ? u.href : makeDocumentRelPath(u.href);
-}
-
-function makeDocumentRelPath(url) {
- var root = baseUrl(document.documentElement);
- var u = new URL(url, root);
- if (u.host === root.host && u.port === root.port &&
- u.protocol === root.protocol) {
- return makeRelPath(root, u);
- } else {
- return url;
- }
-}
-
-// make a relative path from source to target
-function makeRelPath(sourceUrl, targetUrl) {
- var source = sourceUrl.pathname;
- var target = targetUrl.pathname;
- var s = source.split('/');
- var t = target.split('/');
- while (s.length && s[0] === t[0]){
- s.shift();
- t.shift();
- }
- for (var i = 0, l = s.length - 1; i < l; i++) {
- t.unshift('..');
- }
- // empty '#' is discarded but we need to preserve it.
- var hash = (targetUrl.href.slice(-1) === URL_HASH) ? URL_HASH : targetUrl.hash;
- return t.join('/') + targetUrl.search + hash;
-}
-
-// exports
-scope.urlResolver = urlResolver;
-
-})(Polymer);
-
-(function(scope) {
- var endOfMicrotask = Polymer.endOfMicrotask;
-
- // Generic url loader
- function Loader(regex) {
- this.cache = Object.create(null);
- this.map = Object.create(null);
- this.requests = 0;
- this.regex = regex;
- }
- Loader.prototype = {
-
- // TODO(dfreedm): there may be a better factoring here
- // extract absolute urls from the text (full of relative urls)
- extractUrls: function(text, base) {
- var matches = [];
- var matched, u;
- while ((matched = this.regex.exec(text))) {
- u = new URL(matched[1], base);
- matches.push({matched: matched[0], url: u.href});
- }
- return matches;
- },
- // take a text blob, a root url, and a callback and load all the urls found within the text
- // returns a map of absolute url to text
- process: function(text, root, callback) {
- var matches = this.extractUrls(text, root);
-
- // every call to process returns all the text this loader has ever received
- var done = callback.bind(null, this.map);
- this.fetch(matches, done);
- },
- // build a mapping of url -> text from matches
- fetch: function(matches, callback) {
- var inflight = matches.length;
-
- // return early if there is no fetching to be done
- if (!inflight) {
- return callback();
- }
-
- // wait for all subrequests to return
- var done = function() {
- if (--inflight === 0) {
- callback();
- }
- };
-
- // start fetching all subrequests
- var m, req, url;
- for (var i = 0; i < inflight; i++) {
- m = matches[i];
- url = m.url;
- req = this.cache[url];
- // if this url has already been requested, skip requesting it again
- if (!req) {
- req = this.xhr(url);
- req.match = m;
- this.cache[url] = req;
- }
- // wait for the request to process its subrequests
- req.wait(done);
- }
- },
- handleXhr: function(request) {
- var match = request.match;
- var url = match.url;
-
- // handle errors with an empty string
- var response = request.response || request.responseText || '';
- this.map[url] = response;
- this.fetch(this.extractUrls(response, url), request.resolve);
- },
- xhr: function(url) {
- this.requests++;
- var request = new XMLHttpRequest();
- request.open('GET', url, true);
- request.send();
- request.onerror = request.onload = this.handleXhr.bind(this, request);
-
- // queue of tasks to run after XHR returns
- request.pending = [];
- request.resolve = function() {
- var pending = request.pending;
- for(var i = 0; i < pending.length; i++) {
- pending[i]();
- }
- request.pending = null;
- };
-
- // if we have already resolved, pending is null, async call the callback
- request.wait = function(fn) {
- if (request.pending) {
- request.pending.push(fn);
- } else {
- endOfMicrotask(fn);
- }
- };
-
- return request;
- }
- };
-
- scope.Loader = Loader;
-})(Polymer);
-
-(function(scope) {
-
-var urlResolver = scope.urlResolver;
-var Loader = scope.Loader;
-
-function StyleResolver() {
- this.loader = new Loader(this.regex);
-}
-StyleResolver.prototype = {
- regex: /@import\s+(?:url)?["'\(]*([^'"\)]*)['"\)]*;/g,
- // Recursively replace @imports with the text at that url
- resolve: function(text, url, callback) {
- var done = function(map) {
- callback(this.flatten(text, url, map));
- }.bind(this);
- this.loader.process(text, url, done);
- },
- // resolve the textContent of a style node
- resolveNode: function(style, url, callback) {
- var text = style.textContent;
- var done = function(text) {
- style.textContent = text;
- callback(style);
- };
- this.resolve(text, url, done);
- },
- // flatten all the @imports to text
- flatten: function(text, base, map) {
- var matches = this.loader.extractUrls(text, base);
- var match, url, intermediate;
- for (var i = 0; i < matches.length; i++) {
- match = matches[i];
- url = match.url;
- // resolve any css text to be relative to the importer, keep absolute url
- intermediate = urlResolver.resolveCssText(map[url], url, true);
- // flatten intermediate @imports
- intermediate = this.flatten(intermediate, base, map);
- text = text.replace(match.matched, intermediate);
- }
- return text;
- },
- loadStyles: function(styles, base, callback) {
- var loaded=0, l = styles.length;
- // called in the context of the style
- function loadedStyle(style) {
- loaded++;
- if (loaded === l && callback) {
- callback();
- }
- }
- for (var i=0, s; (i<l) && (s=styles[i]); i++) {
- this.resolveNode(s, base, loadedStyle);
- }
- }
-};
-
-var styleResolver = new StyleResolver();
-
-// exports
-scope.styleResolver = styleResolver;
-
-})(Polymer);
-
-(function(scope) {
-
- // copy own properties from 'api' to 'prototype, with name hinting for 'super'
- function extend(prototype, api) {
- if (prototype && api) {
- // use only own properties of 'api'
- Object.getOwnPropertyNames(api).forEach(function(n) {
- // acquire property descriptor
- var pd = Object.getOwnPropertyDescriptor(api, n);
- if (pd) {
- // clone property via descriptor
- Object.defineProperty(prototype, n, pd);
- // cache name-of-method for 'super' engine
- if (typeof pd.value == 'function') {
- // hint the 'super' engine
- pd.value.nom = n;
- }
- }
- });
- }
- return prototype;
- }
-
-
- // mixin
-
- // copy all properties from inProps (et al) to inObj
- function mixin(inObj/*, inProps, inMoreProps, ...*/) {
- var obj = inObj || {};
- for (var i = 1; i < arguments.length; i++) {
- var p = arguments[i];
- try {
- for (var n in p) {
- copyProperty(n, p, obj);
- }
- } catch(x) {
- }
- }
- return obj;
- }
-
- // copy property inName from inSource object to inTarget object
- function copyProperty(inName, inSource, inTarget) {
- var pd = getPropertyDescriptor(inSource, inName);
- Object.defineProperty(inTarget, inName, pd);
- }
-
- // get property descriptor for inName on inObject, even if
- // inName exists on some link in inObject's prototype chain
- function getPropertyDescriptor(inObject, inName) {
- if (inObject) {
- var pd = Object.getOwnPropertyDescriptor(inObject, inName);
- return pd || getPropertyDescriptor(Object.getPrototypeOf(inObject), inName);
- }
- }
-
- // exports
-
- scope.extend = extend;
- scope.mixin = mixin;
-
- // for bc
- Platform.mixin = mixin;
-
-})(Polymer);
-
-(function(scope) {
-
- // usage
-
- // invoke cb.call(this) in 100ms, unless the job is re-registered,
- // which resets the timer
- //
- // this.myJob = this.job(this.myJob, cb, 100)
- //
- // returns a job handle which can be used to re-register a job
-
- var Job = function(inContext) {
- this.context = inContext;
- this.boundComplete = this.complete.bind(this)
- };
- Job.prototype = {
- go: function(callback, wait) {
- this.callback = callback;
- var h;
- if (!wait) {
- h = requestAnimationFrame(this.boundComplete);
- this.handle = function() {
- cancelAnimationFrame(h);
- }
- } else {
- h = setTimeout(this.boundComplete, wait);
- this.handle = function() {
- clearTimeout(h);
- }
- }
- },
- stop: function() {
- if (this.handle) {
- this.handle();
- this.handle = null;
- }
- },
- complete: function() {
- if (this.handle) {
- this.stop();
- this.callback.call(this.context);
- }
- }
- };
-
- function job(job, callback, wait) {
- if (job) {
- job.stop();
- } else {
- job = new Job(this);
- }
- job.go(callback, wait);
- return job;
- }
-
- // exports
-
- scope.job = job;
-
-})(Polymer);
-
-(function(scope) {
-
- // dom polyfill, additions, and utility methods
-
- var registry = {};
-
- HTMLElement.register = function(tag, prototype) {
- registry[tag] = prototype;
- };
-
- // get prototype mapped to node <tag>
- HTMLElement.getPrototypeForTag = function(tag) {
- var prototype = !tag ? HTMLElement.prototype : registry[tag];
- // TODO(sjmiles): creating <tag> is likely to have wasteful side-effects
- return prototype || Object.getPrototypeOf(document.createElement(tag));
- };
-
- // we have to flag propagation stoppage for the event dispatcher
- var originalStopPropagation = Event.prototype.stopPropagation;
- Event.prototype.stopPropagation = function() {
- this.cancelBubble = true;
- originalStopPropagation.apply(this, arguments);
- };
-
-
- // polyfill DOMTokenList
- // * add/remove: allow these methods to take multiple classNames
- // * toggle: add a 2nd argument which forces the given state rather
- // than toggling.
-
- var add = DOMTokenList.prototype.add;
- var remove = DOMTokenList.prototype.remove;
- DOMTokenList.prototype.add = function() {
- for (var i = 0; i < arguments.length; i++) {
- add.call(this, arguments[i]);
- }
- };
- DOMTokenList.prototype.remove = function() {
- for (var i = 0; i < arguments.length; i++) {
- remove.call(this, arguments[i]);
- }
- };
- DOMTokenList.prototype.toggle = function(name, bool) {
- if (arguments.length == 1) {
- bool = !this.contains(name);
- }
- bool ? this.add(name) : this.remove(name);
- };
- DOMTokenList.prototype.switch = function(oldName, newName) {
- oldName && this.remove(oldName);
- newName && this.add(newName);
- };
-
- // add array() to NodeList, NamedNodeMap, HTMLCollection
-
- var ArraySlice = function() {
- return Array.prototype.slice.call(this);
- };
-
- var namedNodeMap = (window.NamedNodeMap || window.MozNamedAttrMap || {});
-
- NodeList.prototype.array = ArraySlice;
- namedNodeMap.prototype.array = ArraySlice;
- HTMLCollection.prototype.array = ArraySlice;
-
- // utility
-
- function createDOM(inTagOrNode, inHTML, inAttrs) {
- var dom = typeof inTagOrNode == 'string' ?
- document.createElement(inTagOrNode) : inTagOrNode.cloneNode(true);
- dom.innerHTML = inHTML;
- if (inAttrs) {
- for (var n in inAttrs) {
- dom.setAttribute(n, inAttrs[n]);
- }
- }
- return dom;
- }
-
- // exports
-
- scope.createDOM = createDOM;
-
-})(Polymer);
-
-(function(scope) {
- // super
-
- // `arrayOfArgs` is an optional array of args like one might pass
- // to `Function.apply`
-
- // TODO(sjmiles):
- // $super must be installed on an instance or prototype chain
- // as `super`, and invoked via `this`, e.g.
- // `this.super();`
-
- // will not work if function objects are not unique, for example,
- // when using mixins.
- // The memoization strategy assumes each function exists on only one
- // prototype chain i.e. we use the function object for memoizing)
- // perhaps we can bookkeep on the prototype itself instead
- function $super(arrayOfArgs) {
- // since we are thunking a method call, performance is important here:
- // memoize all lookups, once memoized the fast path calls no other
- // functions
- //
- // find the caller (cannot be `strict` because of 'caller')
- var caller = $super.caller;
- // memoized 'name of method'
- var nom = caller.nom;
- // memoized next implementation prototype
- var _super = caller._super;
- if (!_super) {
- if (!nom) {
- nom = caller.nom = nameInThis.call(this, caller);
- }
- if (!nom) {
- console.warn('called super() on a method not installed declaratively (has no .nom property)');
- }
- // super prototype is either cached or we have to find it
- // by searching __proto__ (at the 'top')
- // invariant: because we cache _super on fn below, we never reach
- // here from inside a series of calls to super(), so it's ok to
- // start searching from the prototype of 'this' (at the 'top')
- // we must never memoize a null super for this reason
- _super = memoizeSuper(caller, nom, getPrototypeOf(this));
- }
- // our super function
- var fn = _super[nom];
- if (fn) {
- // memoize information so 'fn' can call 'super'
- if (!fn._super) {
- // must not memoize null, or we lose our invariant above
- memoizeSuper(fn, nom, _super);
- }
- // invoke the inherited method
- // if 'fn' is not function valued, this will throw
- return fn.apply(this, arrayOfArgs || []);
- }
- }
-
- function nameInThis(value) {
- var p = this.__proto__;
- while (p && p !== HTMLElement.prototype) {
- // TODO(sjmiles): getOwnPropertyNames is absurdly expensive
- var n$ = Object.getOwnPropertyNames(p);
- for (var i=0, l=n$.length, n; i<l && (n=n$[i]); i++) {
- var d = Object.getOwnPropertyDescriptor(p, n);
- if (typeof d.value === 'function' && d.value === value) {
- return n;
- }
- }
- p = p.__proto__;
- }
- }
-
- function memoizeSuper(method, name, proto) {
- // find and cache next prototype containing `name`
- // we need the prototype so we can do another lookup
- // from here
- var s = nextSuper(proto, name, method);
- if (s[name]) {
- // `s` is a prototype, the actual method is `s[name]`
- // tag super method with it's name for quicker lookups
- s[name].nom = name;
- }
- return method._super = s;
- }
-
- function nextSuper(proto, name, caller) {
- // look for an inherited prototype that implements name
- while (proto) {
- if ((proto[name] !== caller) && proto[name]) {
- return proto;
- }
- proto = getPrototypeOf(proto);
- }
- // must not return null, or we lose our invariant above
- // in this case, a super() call was invoked where no superclass
- // method exists
- // TODO(sjmiles): thow an exception?
- return Object;
- }
-
- // NOTE: In some platforms (IE10) the prototype chain is faked via
- // __proto__. Therefore, always get prototype via __proto__ instead of
- // the more standard Object.getPrototypeOf.
- function getPrototypeOf(prototype) {
- return prototype.__proto__;
- }
-
- // utility function to precompute name tags for functions
- // in a (unchained) prototype
- function hintSuper(prototype) {
- // tag functions with their prototype name to optimize
- // super call invocations
- for (var n in prototype) {
- var pd = Object.getOwnPropertyDescriptor(prototype, n);
- if (pd && typeof pd.value === 'function') {
- pd.value.nom = n;
- }
- }
- }
-
- // exports
-
- scope.super = $super;
-
-})(Polymer);
-
-(function(scope) {
-
- function noopHandler(value) {
- return value;
- }
-
- // helper for deserializing properties of various types to strings
- var typeHandlers = {
- string: noopHandler,
- 'undefined': noopHandler,
- date: function(value) {
- return new Date(Date.parse(value) || Date.now());
- },
- boolean: function(value) {
- if (value === '') {
- return true;
- }
- return value === 'false' ? false : !!value;
- },
- number: function(value) {
- var n = parseFloat(value);
- // hex values like "0xFFFF" parseFloat as 0
- if (n === 0) {
- n = parseInt(value);
- }
- return isNaN(n) ? value : n;
- // this code disabled because encoded values (like "0xFFFF")
- // do not round trip to their original format
- //return (String(floatVal) === value) ? floatVal : value;
- },
- object: function(value, currentValue) {
- if (currentValue === null) {
- return value;
- }
- try {
- // If the string is an object, we can parse is with the JSON library.
- // include convenience replace for single-quotes. If the author omits
- // quotes altogether, parse will fail.
- return JSON.parse(value.replace(/'/g, '"'));
- } catch(e) {
- // The object isn't valid JSON, return the raw value
- return value;
- }
- },
- // avoid deserialization of functions
- 'function': function(value, currentValue) {
- return currentValue;
- }
- };
-
- function deserializeValue(value, currentValue) {
- // attempt to infer type from default value
- var inferredType = typeof currentValue;
- // invent 'date' type value for Date
- if (currentValue instanceof Date) {
- inferredType = 'date';
- }
- // delegate deserialization via type string
- return typeHandlers[inferredType](value, currentValue);
- }
-
- // exports
-
- scope.deserializeValue = deserializeValue;
-
-})(Polymer);
-
-(function(scope) {
-
- // imports
-
- var extend = scope.extend;
-
- // module
-
- var api = {};
-
- api.declaration = {};
- api.instance = {};
-
- api.publish = function(apis, prototype) {
- for (var n in apis) {
- extend(prototype, apis[n]);
- }
- };
-
- // exports
-
- scope.api = api;
-
-})(Polymer);
-
-(function(scope) {
-
- /**
- * @class polymer-base
- */
-
- var utils = {
-
- /**
- * Invokes a function asynchronously. The context of the callback
- * function is bound to 'this' automatically. Returns a handle which may
- * be passed to <a href="#cancelAsync">cancelAsync</a> to cancel the
- * asynchronous call.
- *
- * @method async
- * @param {Function|String} method
- * @param {any|Array} args
- * @param {number} timeout
- */
- async: function(method, args, timeout) {
- // when polyfilling Object.observe, ensure changes
- // propagate before executing the async method
- Polymer.flush();
- // second argument to `apply` must be an array
- args = (args && args.length) ? args : [args];
- // function to invoke
- var fn = function() {
- (this[method] || method).apply(this, args);
- }.bind(this);
- // execute `fn` sooner or later
- var handle = timeout ? setTimeout(fn, timeout) :
- requestAnimationFrame(fn);
- // NOTE: switch on inverting handle to determine which time is used.
- return timeout ? handle : ~handle;
- },
-
- /**
- * Cancels a pending callback that was scheduled via
- * <a href="#async">async</a>.
- *
- * @method cancelAsync
- * @param {handle} handle Handle of the `async` to cancel.
- */
- cancelAsync: function(handle) {
- if (handle < 0) {
- cancelAnimationFrame(~handle);
- } else {
- clearTimeout(handle);
- }
- },
-
- /**
- * Fire an event.
- *
- * @method fire
- * @returns {Object} event
- * @param {string} type An event name.
- * @param {any} detail
- * @param {Node} onNode Target node.
- * @param {Boolean} bubbles Set false to prevent bubbling, defaults to true
- * @param {Boolean} cancelable Set false to prevent cancellation, defaults to true
- */
- fire: function(type, detail, onNode, bubbles, cancelable) {
- var node = onNode || this;
- var detail = detail === null || detail === undefined ? {} : detail;
- var event = new CustomEvent(type, {
- bubbles: bubbles !== undefined ? bubbles : true,
- cancelable: cancelable !== undefined ? cancelable : true,
- detail: detail
- });
- node.dispatchEvent(event);
- return event;
- },
-
- /**
- * Fire an event asynchronously.
- *
- * @method asyncFire
- * @param {string} type An event name.
- * @param detail
- * @param {Node} toNode Target node.
- */
- asyncFire: function(/*inType, inDetail*/) {
- this.async("fire", arguments);
- },
-
- /**
- * Remove class from old, add class to anew, if they exist.
- *
- * @param classFollows
- * @param anew A node.
- * @param old A node
- * @param className
- */
- classFollows: function(anew, old, className) {
- if (old) {
- old.classList.remove(className);
- }
- if (anew) {
- anew.classList.add(className);
- }
- },
-
- /**
- * Inject HTML which contains markup bound to this element into
- * a target element (replacing target element content).
- *
- * @param String html to inject
- * @param Element target element
- */
- injectBoundHTML: function(html, element) {
- var template = document.createElement('template');
- template.innerHTML = html;
- var fragment = this.instanceTemplate(template);
- if (element) {
- element.textContent = '';
- element.appendChild(fragment);
- }
- return fragment;
- }
- };
-
- // no-operation function for handy stubs
- var nop = function() {};
-
- // null-object for handy stubs
- var nob = {};
-
- // deprecated
-
- utils.asyncMethod = utils.async;
-
- // exports
-
- scope.api.instance.utils = utils;
- scope.nop = nop;
- scope.nob = nob;
-
-})(Polymer);
-
-(function(scope) {
-
- // imports
-
- var log = window.WebComponents ? WebComponents.flags.log : {};
- var EVENT_PREFIX = 'on-';
-
- // instance events api
- var events = {
- // read-only
- EVENT_PREFIX: EVENT_PREFIX,
- // event listeners on host
- addHostListeners: function() {
- var events = this.eventDelegates;
- log.events && (Object.keys(events).length > 0) && console.log('[%s] addHostListeners:', this.localName, events);
- // NOTE: host events look like bindings but really are not;
- // (1) we don't want the attribute to be set and (2) we want to support
- // multiple event listeners ('host' and 'instance') and Node.bind
- // by default supports 1 thing being bound.
- for (var type in events) {
- var methodName = events[type];
- PolymerGestures.addEventListener(this, type, this.element.getEventHandler(this, this, methodName));
- }
- },
- // call 'method' or function method on 'obj' with 'args', if the method exists
- dispatchMethod: function(obj, method, args) {
- if (obj) {
- log.events && console.group('[%s] dispatch [%s]', obj.localName, method);
- var fn = typeof method === 'function' ? method : obj[method];
- if (fn) {
- fn[args ? 'apply' : 'call'](obj, args);
- }
- log.events && console.groupEnd();
- // NOTE: dirty check right after calling method to ensure
- // changes apply quickly; in a very complicated app using high
- // frequency events, this can be a perf concern; in this case,
- // imperative handlers can be used to avoid flushing.
- Polymer.flush();
- }
- }
- };
-
- // exports
-
- scope.api.instance.events = events;
-
- /**
- * @class Polymer
- */
-
- /**
- * Add a gesture aware event handler to the given `node`. Can be used
- * in place of `element.addEventListener` and ensures gestures will function
- * as expected on mobile platforms. Please note that Polymer's declarative
- * event handlers include this functionality by default.
- *
- * @method addEventListener
- * @param {Node} node node on which to listen
- * @param {String} eventType name of the event
- * @param {Function} handlerFn event handler function
- * @param {Boolean} capture set to true to invoke event capturing
- * @type Function
- */
- // alias PolymerGestures event listener logic
- scope.addEventListener = function(node, eventType, handlerFn, capture) {
- PolymerGestures.addEventListener(wrap(node), eventType, handlerFn, capture);
- };
-
- /**
- * Remove a gesture aware event handler on the given `node`. To remove an
- * event listener, the exact same arguments are required that were passed
- * to `Polymer.addEventListener`.
- *
- * @method removeEventListener
- * @param {Node} node node on which to listen
- * @param {String} eventType name of the event
- * @param {Function} handlerFn event handler function
- * @param {Boolean} capture set to true to invoke event capturing
- * @type Function
- */
- scope.removeEventListener = function(node, eventType, handlerFn, capture) {
- PolymerGestures.removeEventListener(wrap(node), eventType, handlerFn, capture);
- };
-
-})(Polymer);
-
-(function(scope) {
-
- // instance api for attributes
-
- var attributes = {
- // copy attributes defined in the element declaration to the instance
- // e.g. <polymer-element name="x-foo" tabIndex="0"> tabIndex is copied
- // to the element instance here.
- copyInstanceAttributes: function () {
- var a$ = this._instanceAttributes;
- for (var k in a$) {
- if (!this.hasAttribute(k)) {
- this.setAttribute(k, a$[k]);
- }
- }
- },
- // for each attribute on this, deserialize value to property as needed
- takeAttributes: function() {
- // if we have no publish lookup table, we have no attributes to take
- // TODO(sjmiles): ad hoc
- if (this._publishLC) {
- for (var i=0, a$=this.attributes, l=a$.length, a; (a=a$[i]) && i<l; i++) {
- this.attributeToProperty(a.name, a.value);
- }
- }
- },
- // if attribute 'name' is mapped to a property, deserialize
- // 'value' into that property
- attributeToProperty: function(name, value) {
- // try to match this attribute to a property (attributes are
- // all lower-case, so this is case-insensitive search)
- var name = this.propertyForAttribute(name);
- if (name) {
- // filter out 'mustached' values, these are to be
- // replaced with bound-data and are not yet values
- // themselves
- if (value && value.search(scope.bindPattern) >= 0) {
- return;
- }
- // get original value
- var currentValue = this[name];
- // deserialize Boolean or Number values from attribute
- var value = this.deserializeValue(value, currentValue);
- // only act if the value has changed
- if (value !== currentValue) {
- // install new value (has side-effects)
- this[name] = value;
- }
- }
- },
- // return the published property matching name, or undefined
- propertyForAttribute: function(name) {
- var match = this._publishLC && this._publishLC[name];
- return match;
- },
- // convert representation of `stringValue` based on type of `currentValue`
- deserializeValue: function(stringValue, currentValue) {
- return scope.deserializeValue(stringValue, currentValue);
- },
- // convert to a string value based on the type of `inferredType`
- serializeValue: function(value, inferredType) {
- if (inferredType === 'boolean') {
- return value ? '' : undefined;
- } else if (inferredType !== 'object' && inferredType !== 'function'
- && value !== undefined) {
- return value;
- }
- },
- // serializes `name` property value and updates the corresponding attribute
- // note that reflection is opt-in.
- reflectPropertyToAttribute: function(name) {
- var inferredType = typeof this[name];
- // try to intelligently serialize property value
- var serializedValue = this.serializeValue(this[name], inferredType);
- // boolean properties must reflect as boolean attributes
- if (serializedValue !== undefined) {
- this.setAttribute(name, serializedValue);
- // TODO(sorvell): we should remove attr for all properties
- // that have undefined serialization; however, we will need to
- // refine the attr reflection system to achieve this; pica, for example,
- // relies on having inferredType object properties not removed as
- // attrs.
- } else if (inferredType === 'boolean') {
- this.removeAttribute(name);
- }
- }
- };
-
- // exports
-
- scope.api.instance.attributes = attributes;
-
-})(Polymer);
-
-(function(scope) {
-
- /**
- * @class polymer-base
- */
-
- // imports
-
- var log = window.WebComponents ? WebComponents.flags.log : {};
-
- // magic words
-
- var OBSERVE_SUFFIX = 'Changed';
-
- // element api
-
- var empty = [];
-
- var updateRecord = {
- object: undefined,
- type: 'update',
- name: undefined,
- oldValue: undefined
- };
-
- var numberIsNaN = Number.isNaN || function(value) {
- return typeof value === 'number' && isNaN(value);
- };
-
- function areSameValue(left, right) {
- if (left === right)
- return left !== 0 || 1 / left === 1 / right;
- if (numberIsNaN(left) && numberIsNaN(right))
- return true;
- return left !== left && right !== right;
- }
-
- // capture A's value if B's value is null or undefined,
- // otherwise use B's value
- function resolveBindingValue(oldValue, value) {
- if (value === undefined && oldValue === null) {
- return value;
- }
- return (value === null || value === undefined) ? oldValue : value;
- }
-
- var properties = {
-
- // creates a CompoundObserver to observe property changes
- // NOTE, this is only done there are any properties in the `observe` object
- createPropertyObserver: function() {
- var n$ = this._observeNames;
- if (n$ && n$.length) {
- var o = this._propertyObserver = new CompoundObserver(true);
- this.registerObserver(o);
- // TODO(sorvell): may not be kosher to access the value here (this[n]);
- // previously we looked at the descriptor on the prototype
- // this doesn't work for inheritance and not for accessors without
- // a value property
- for (var i=0, l=n$.length, n; (i<l) && (n=n$[i]); i++) {
- o.addPath(this, n);
- this.observeArrayValue(n, this[n], null);
- }
- }
- },
-
- // start observing property changes
- openPropertyObserver: function() {
- if (this._propertyObserver) {
- this._propertyObserver.open(this.notifyPropertyChanges, this);
- }
- },
-
- // handler for property changes; routes changes to observing methods
- // note: array valued properties are observed for array splices
- notifyPropertyChanges: function(newValues, oldValues, paths) {
- var name, method, called = {};
- for (var i in oldValues) {
- // note: paths is of form [object, path, object, path]
- name = paths[2 * i + 1];
- method = this.observe[name];
- if (method) {
- var ov = oldValues[i], nv = newValues[i];
- // observes the value if it is an array
- this.observeArrayValue(name, nv, ov);
- if (!called[method]) {
- // only invoke change method if one of ov or nv is not (undefined | null)
- if ((ov !== undefined && ov !== null) || (nv !== undefined && nv !== null)) {
- called[method] = true;
- // TODO(sorvell): call method with the set of values it's expecting;
- // e.g. 'foo bar': 'invalidate' expects the new and old values for
- // foo and bar. Currently we give only one of these and then
- // deliver all the arguments.
- this.invokeMethod(method, [ov, nv, arguments]);
- }
- }
- }
- }
- },
-
- // call method iff it exists.
- invokeMethod: function(method, args) {
- var fn = this[method] || method;
- if (typeof fn === 'function') {
- fn.apply(this, args);
- }
- },
-
- /**
- * Force any pending property changes to synchronously deliver to
- * handlers specified in the `observe` object.
- * Note, normally changes are processed at microtask time.
- *
- * @method deliverChanges
- */
- deliverChanges: function() {
- if (this._propertyObserver) {
- this._propertyObserver.deliver();
- }
- },
-
- observeArrayValue: function(name, value, old) {
- // we only care if there are registered side-effects
- var callbackName = this.observe[name];
- if (callbackName) {
- // if we are observing the previous value, stop
- if (Array.isArray(old)) {
- log.observe && console.log('[%s] observeArrayValue: unregister observer [%s]', this.localName, name);
- this.closeNamedObserver(name + '__array');
- }
- // if the new value is an array, being observing it
- if (Array.isArray(value)) {
- log.observe && console.log('[%s] observeArrayValue: register observer [%s]', this.localName, name, value);
- var observer = new ArrayObserver(value);
- observer.open(function(splices) {
- this.invokeMethod(callbackName, [splices]);
- }, this);
- this.registerNamedObserver(name + '__array', observer);
- }
- }
- },
-
- emitPropertyChangeRecord: function(name, value, oldValue) {
- var object = this;
- if (areSameValue(value, oldValue)) {
- return;
- }
- // invoke property change side effects
- this._propertyChanged(name, value, oldValue);
- // emit change record
- if (!Observer.hasObjectObserve) {
- return;
- }
- var notifier = this._objectNotifier;
- if (!notifier) {
- notifier = this._objectNotifier = Object.getNotifier(this);
- }
- updateRecord.object = this;
- updateRecord.name = name;
- updateRecord.oldValue = oldValue;
- notifier.notify(updateRecord);
- },
-
- _propertyChanged: function(name, value, oldValue) {
- if (this.reflect[name]) {
- this.reflectPropertyToAttribute(name);
- }
- },
-
- // creates a property binding (called via bind) to a published property.
- bindProperty: function(property, observable, oneTime) {
- if (oneTime) {
- this[property] = observable;
- return;
- }
- var computed = this.element.prototype.computed;
- // Binding an "out-only" value to a computed property. Note that
- // since this observer isn't opened, it doesn't need to be closed on
- // cleanup.
- if (computed && computed[property]) {
- var privateComputedBoundValue = property + 'ComputedBoundObservable_';
- this[privateComputedBoundValue] = observable;
- return;
- }
- return this.bindToAccessor(property, observable, resolveBindingValue);
- },
-
- // NOTE property `name` must be published. This makes it an accessor.
- bindToAccessor: function(name, observable, resolveFn) {
- var privateName = name + '_';
- var privateObservable = name + 'Observable_';
- // Present for properties which are computed and published and have a
- // bound value.
- var privateComputedBoundValue = name + 'ComputedBoundObservable_';
- this[privateObservable] = observable;
- var oldValue = this[privateName];
- // observable callback
- var self = this;
- function updateValue(value, oldValue) {
- self[privateName] = value;
- var setObserveable = self[privateComputedBoundValue];
- if (setObserveable && typeof setObserveable.setValue == 'function') {
- setObserveable.setValue(value);
- }
- self.emitPropertyChangeRecord(name, value, oldValue);
- }
- // resolve initial value
- var value = observable.open(updateValue);
- if (resolveFn && !areSameValue(oldValue, value)) {
- var resolvedValue = resolveFn(oldValue, value);
- if (!areSameValue(value, resolvedValue)) {
- value = resolvedValue;
- if (observable.setValue) {
- observable.setValue(value);
- }
- }
- }
- updateValue(value, oldValue);
- // register and return observable
- var observer = {
- close: function() {
- observable.close();
- self[privateObservable] = undefined;
- self[privateComputedBoundValue] = undefined;
- }
- };
- this.registerObserver(observer);
- return observer;
- },
-
- createComputedProperties: function() {
- if (!this._computedNames) {
- return;
- }
- for (var i = 0; i < this._computedNames.length; i++) {
- var name = this._computedNames[i];
- var expressionText = this.computed[name];
- try {
- var expression = PolymerExpressions.getExpression(expressionText);
- var observable = expression.getBinding(this, this.element.syntax);
- this.bindToAccessor(name, observable);
- } catch (ex) {
- console.error('Failed to create computed property', ex);
- }
- }
- },
-
- // property bookkeeping
- registerObserver: function(observer) {
- if (!this._observers) {
- this._observers = [observer];
- return;
- }
- this._observers.push(observer);
- },
-
- closeObservers: function() {
- if (!this._observers) {
- return;
- }
- // observer array items are arrays of observers.
- var observers = this._observers;
- for (var i = 0; i < observers.length; i++) {
- var observer = observers[i];
- if (observer && typeof observer.close == 'function') {
- observer.close();
- }
- }
- this._observers = [];
- },
-
- // bookkeeping observers for memory management
- registerNamedObserver: function(name, observer) {
- var o$ = this._namedObservers || (this._namedObservers = {});
- o$[name] = observer;
- },
-
- closeNamedObserver: function(name) {
- var o$ = this._namedObservers;
- if (o$ && o$[name]) {
- o$[name].close();
- o$[name] = null;
- return true;
- }
- },
-
- closeNamedObservers: function() {
- if (this._namedObservers) {
- for (var i in this._namedObservers) {
- this.closeNamedObserver(i);
- }
- this._namedObservers = {};
- }
- }
-
- };
-
- // logging
- var LOG_OBSERVE = '[%s] watching [%s]';
- var LOG_OBSERVED = '[%s#%s] watch: [%s] now [%s] was [%s]';
- var LOG_CHANGED = '[%s#%s] propertyChanged: [%s] now [%s] was [%s]';
-
- // exports
-
- scope.api.instance.properties = properties;
-
-})(Polymer);
-
-(function(scope) {
-
- /**
- * @class polymer-base
- */
-
- // imports
-
- var log = window.WebComponents ? WebComponents.flags.log : {};
-
- // element api supporting mdv
- var mdv = {
-
- /**
- * Creates dom cloned from the given template, instantiating bindings
- * with this element as the template model and `PolymerExpressions` as the
- * binding delegate.
- *
- * @method instanceTemplate
- * @param {Template} template source template from which to create dom.
- */
- instanceTemplate: function(template) {
- // ensure template is decorated (lets' things like <tr template ...> work)
- HTMLTemplateElement.decorate(template);
- // ensure a default bindingDelegate
- var syntax = this.syntax || (!template.bindingDelegate &&
- this.element.syntax);
- var dom = template.createInstance(this, syntax);
- var observers = dom.bindings_;
- for (var i = 0; i < observers.length; i++) {
- this.registerObserver(observers[i]);
- }
- return dom;
- },
-
- // Called by TemplateBinding/NodeBind to setup a binding to the given
- // property. It's overridden here to support property bindings
- // in addition to attribute bindings that are supported by default.
- bind: function(name, observable, oneTime) {
- var property = this.propertyForAttribute(name);
- if (!property) {
- // TODO(sjmiles): this mixin method must use the special form
- // of `super` installed by `mixinMethod` in declaration/prototype.js
- return this.mixinSuper(arguments);
- } else {
- // use n-way Polymer binding
- var observer = this.bindProperty(property, observable, oneTime);
- // NOTE: reflecting binding information is typically required only for
- // tooling. It has a performance cost so it's opt-in in Node.bind.
- if (Platform.enableBindingsReflection && observer) {
- observer.path = observable.path_;
- this._recordBinding(property, observer);
- }
- if (this.reflect[property]) {
- this.reflectPropertyToAttribute(property);
- }
- return observer;
- }
- },
-
- _recordBinding: function(name, observer) {
- this.bindings_ = this.bindings_ || {};
- this.bindings_[name] = observer;
- },
-
- // Called by TemplateBinding when all bindings on an element have been
- // executed. This signals that all element inputs have been gathered
- // and it's safe to ready the element, create shadow-root and start
- // data-observation.
- bindFinished: function() {
- this.makeElementReady();
- },
-
- // called at detached time to signal that an element's bindings should be
- // cleaned up. This is done asynchronously so that users have the chance
- // to call `cancelUnbindAll` to prevent unbinding.
- asyncUnbindAll: function() {
- if (!this._unbound) {
- log.unbind && console.log('[%s] asyncUnbindAll', this.localName);
- this._unbindAllJob = this.job(this._unbindAllJob, this.unbindAll, 0);
- }
- },
-
- /**
- * This method should rarely be used and only if
- * <a href="#cancelUnbindAll">`cancelUnbindAll`</a> has been called to
- * prevent element unbinding. In this case, the element's bindings will
- * not be automatically cleaned up and it cannot be garbage collected
- * by the system. If memory pressure is a concern or a
- * large amount of elements need to be managed in this way, `unbindAll`
- * can be called to deactivate the element's bindings and allow its
- * memory to be reclaimed.
- *
- * @method unbindAll
- */
- unbindAll: function() {
- if (!this._unbound) {
- this.closeObservers();
- this.closeNamedObservers();
- this._unbound = true;
- }
- },
-
- /**
- * Call in `detached` to prevent the element from unbinding when it is
- * detached from the dom. The element is unbound as a cleanup step that
- * allows its memory to be reclaimed.
- * If `cancelUnbindAll` is used, consider calling
- * <a href="#unbindAll">`unbindAll`</a> when the element is no longer
- * needed. This will allow its memory to be reclaimed.
- *
- * @method cancelUnbindAll
- */
- cancelUnbindAll: function() {
- if (this._unbound) {
- log.unbind && console.warn('[%s] already unbound, cannot cancel unbindAll', this.localName);
- return;
- }
- log.unbind && console.log('[%s] cancelUnbindAll', this.localName);
- if (this._unbindAllJob) {
- this._unbindAllJob = this._unbindAllJob.stop();
- }
- }
-
- };
-
- function unbindNodeTree(node) {
- forNodeTree(node, _nodeUnbindAll);
- }
-
- function _nodeUnbindAll(node) {
- node.unbindAll();
- }
-
- function forNodeTree(node, callback) {
- if (node) {
- callback(node);
- for (var child = node.firstChild; child; child = child.nextSibling) {
- forNodeTree(child, callback);
- }
- }
- }
-
- var mustachePattern = /\{\{([^{}]*)}}/;
-
- // exports
-
- scope.bindPattern = mustachePattern;
- scope.api.instance.mdv = mdv;
-
-})(Polymer);
-
-(function(scope) {
-
- /**
- * Common prototype for all Polymer Elements.
- *
- * @class polymer-base
- * @homepage polymer.github.io
- */
- var base = {
- /**
- * Tags this object as the canonical Base prototype.
- *
- * @property PolymerBase
- * @type boolean
- * @default true
- */
- PolymerBase: true,
-
- /**
- * Debounce signals.
- *
- * Call `job` to defer a named signal, and all subsequent matching signals,
- * until a wait time has elapsed with no new signal.
- *
- * debouncedClickAction: function(e) {
- * // processClick only when it's been 100ms since the last click
- * this.job('click', function() {
- * this.processClick;
- * }, 100);
- * }
- *
- * @method job
- * @param String {String} job A string identifier for the job to debounce.
- * @param Function {Function} callback A function that is called (with `this` context) when the wait time elapses.
- * @param Number {Number} wait Time in milliseconds (ms) after the last signal that must elapse before invoking `callback`
- * @type Handle
- */
- job: function(job, callback, wait) {
- if (typeof job === 'string') {
- var n = '___' + job;
- this[n] = Polymer.job.call(this, this[n], callback, wait);
- } else {
- // TODO(sjmiles): suggest we deprecate this call signature
- return Polymer.job.call(this, job, callback, wait);
- }
- },
-
- /**
- * Invoke a superclass method.
- *
- * Use `super()` to invoke the most recently overridden call to the
- * currently executing function.
- *
- * To pass arguments through, use the literal `arguments` as the parameter
- * to `super()`.
- *
- * nextPageAction: function(e) {
- * // invoke the superclass version of `nextPageAction`
- * this.super(arguments);
- * }
- *
- * To pass custom arguments, arrange them in an array.
- *
- * appendSerialNo: function(value, serial) {
- * // prefix the superclass serial number with our lot # before
- * // invoking the superlcass
- * return this.super([value, this.lotNo + serial])
- * }
- *
- * @method super
- * @type Any
- * @param {args) An array of arguments to use when calling the superclass method, or null.
- */
- super: Polymer.super,
-
- /**
- * Lifecycle method called when the element is instantiated.
- *
- * Override `created` to perform custom create-time tasks. No need to call
- * super-class `created` unless you are extending another Polymer element.
- * Created is called before the element creates `shadowRoot` or prepares
- * data-observation.
- *
- * @method created
- * @type void
- */
- created: function() {
- },
-
- /**
- * Lifecycle method called when the element has populated it's `shadowRoot`,
- * prepared data-observation, and made itself ready for API interaction.
- *
- * @method ready
- * @type void
- */
- ready: function() {
- },
-
- /**
- * Low-level lifecycle method called as part of standard Custom Elements
- * operation. Polymer implements this method to provide basic default
- * functionality. For custom create-time tasks, implement `created`
- * instead, which is called immediately after `createdCallback`.
- *
- * @method createdCallback
- */
- createdCallback: function() {
- if (this.templateInstance && this.templateInstance.model) {
- console.warn('Attributes on ' + this.localName + ' were data bound ' +
- 'prior to Polymer upgrading the element. This may result in ' +
- 'incorrect binding types.');
- }
- this.created();
- this.prepareElement();
- if (!this.ownerDocument.isStagingDocument) {
- this.makeElementReady();
- }
- },
-
- // system entry point, do not override
- prepareElement: function() {
- if (this._elementPrepared) {
- console.warn('Element already prepared', this.localName);
- return;
- }
- this._elementPrepared = true;
- // storage for shadowRoots info
- this.shadowRoots = {};
- // install property observers
- this.createPropertyObserver();
- this.openPropertyObserver();
- // install boilerplate attributes
- this.copyInstanceAttributes();
- // process input attributes
- this.takeAttributes();
- // add event listeners
- this.addHostListeners();
- },
-
- // system entry point, do not override
- makeElementReady: function() {
- if (this._readied) {
- return;
- }
- this._readied = true;
- this.createComputedProperties();
- this.parseDeclarations(this.__proto__);
- // NOTE: Support use of the `unresolved` attribute to help polyfill
- // custom elements' `:unresolved` feature.
- this.removeAttribute('unresolved');
- // user entry point
- this.ready();
- },
-
- /**
- * Low-level lifecycle method called as part of standard Custom Elements
- * operation. Polymer implements this method to provide basic default
- * functionality. For custom tasks in your element, implement `attributeChanged`
- * instead, which is called immediately after `attributeChangedCallback`.
- *
- * @method attributeChangedCallback
- */
- attributeChangedCallback: function(name, oldValue) {
- // TODO(sjmiles): adhoc filter
- if (name !== 'class' && name !== 'style') {
- this.attributeToProperty(name, this.getAttribute(name));
- }
- if (this.attributeChanged) {
- this.attributeChanged.apply(this, arguments);
- }
- },
-
- /**
- * Low-level lifecycle method called as part of standard Custom Elements
- * operation. Polymer implements this method to provide basic default
- * functionality. For custom create-time tasks, implement `attached`
- * instead, which is called immediately after `attachedCallback`.
- *
- * @method attachedCallback
- */
- attachedCallback: function() {
- // when the element is attached, prevent it from unbinding.
- this.cancelUnbindAll();
- // invoke user action
- if (this.attached) {
- this.attached();
- }
- if (!this.hasBeenAttached) {
- this.hasBeenAttached = true;
- if (this.domReady) {
- this.async('domReady');
- }
- }
- },
-
- /**
- * Implement to access custom elements in dom descendants, ancestors,
- * or siblings. Because custom elements upgrade in document order,
- * elements accessed in `ready` or `attached` may not be upgraded. When
- * `domReady` is called, all registered custom elements are guaranteed
- * to have been upgraded.
- *
- * @method domReady
- */
-
- /**
- * Low-level lifecycle method called as part of standard Custom Elements
- * operation. Polymer implements this method to provide basic default
- * functionality. For custom create-time tasks, implement `detached`
- * instead, which is called immediately after `detachedCallback`.
- *
- * @method detachedCallback
- */
- detachedCallback: function() {
- if (!this.preventDispose) {
- this.asyncUnbindAll();
- }
- // invoke user action
- if (this.detached) {
- this.detached();
- }
- // TODO(sorvell): bc
- if (this.leftView) {
- this.leftView();
- }
- },
-
- /**
- * Walks the prototype-chain of this element and allows specific
- * classes a chance to process static declarations.
- *
- * In particular, each polymer-element has it's own `template`.
- * `parseDeclarations` is used to accumulate all element `template`s
- * from an inheritance chain.
- *
- * `parseDeclaration` static methods implemented in the chain are called
- * recursively, oldest first, with the `<polymer-element>` associated
- * with the current prototype passed as an argument.
- *
- * An element may override this method to customize shadow-root generation.
- *
- * @method parseDeclarations
- */
- parseDeclarations: function(p) {
- if (p && p.element) {
- this.parseDeclarations(p.__proto__);
- p.parseDeclaration.call(this, p.element);
- }
- },
-
- /**
- * Perform init-time actions based on static information in the
- * `<polymer-element>` instance argument.
- *
- * For example, the standard implementation locates the template associated
- * with the given `<polymer-element>` and stamps it into a shadow-root to
- * implement shadow inheritance.
- *
- * An element may override this method for custom behavior.
- *
- * @method parseDeclaration
- */
- parseDeclaration: function(elementElement) {
- var template = this.fetchTemplate(elementElement);
- if (template) {
- var root = this.shadowFromTemplate(template);
- this.shadowRoots[elementElement.name] = root;
- }
- },
-
- /**
- * Given a `<polymer-element>`, find an associated template (if any) to be
- * used for shadow-root generation.
- *
- * An element may override this method for custom behavior.
- *
- * @method fetchTemplate
- */
- fetchTemplate: function(elementElement) {
- return elementElement.querySelector('template');
- },
-
- /**
- * Create a shadow-root in this host and stamp `template` as it's
- * content.
- *
- * An element may override this method for custom behavior.
- *
- * @method shadowFromTemplate
- */
- shadowFromTemplate: function(template) {
- if (template) {
- // make a shadow root
- var root = this.createShadowRoot();
- // stamp template
- // which includes parsing and applying MDV bindings before being
- // inserted (to avoid {{}} in attribute values).
- var dom = this.instanceTemplate(template);
- // append to shadow dom
- root.appendChild(dom);
- // perform post-construction initialization tasks on shadow root
- this.shadowRootReady(root, template);
- // return the created shadow root
- return root;
- }
- },
-
- // utility function that stamps a <template> into light-dom
- lightFromTemplate: function(template, refNode) {
- if (template) {
- // TODO(sorvell): mark this element as an eventController so that
- // event listeners on bound nodes inside it will be called on it.
- // Note, the expectation here is that events on all descendants
- // should be handled by this element.
- this.eventController = this;
- // stamp template
- // which includes parsing and applying MDV bindings before being
- // inserted (to avoid {{}} in attribute values).
- var dom = this.instanceTemplate(template);
- // append to shadow dom
- if (refNode) {
- this.insertBefore(dom, refNode);
- } else {
- this.appendChild(dom);
- }
- // perform post-construction initialization tasks on ahem, light root
- this.shadowRootReady(this);
- // return the created shadow root
- return dom;
- }
- },
-
- shadowRootReady: function(root) {
- // locate nodes with id and store references to them in this.$ hash
- this.marshalNodeReferences(root);
- },
-
- // locate nodes with id and store references to them in this.$ hash
- marshalNodeReferences: function(root) {
- // establish $ instance variable
- var $ = this.$ = this.$ || {};
- // populate $ from nodes with ID from the LOCAL tree
- if (root) {
- var n$ = root.querySelectorAll("[id]");
- for (var i=0, l=n$.length, n; (i<l) && (n=n$[i]); i++) {
- $[n.id] = n;
- };
- }
- },
-
- /**
- * Register a one-time callback when a child-list or sub-tree mutation
- * occurs on node.
- *
- * For persistent callbacks, call onMutation from your listener.
- *
- * @method onMutation
- * @param Node {Node} node Node to watch for mutations.
- * @param Function {Function} listener Function to call on mutation. The function is invoked as `listener.call(this, observer, mutations);` where `observer` is the MutationObserver that triggered the notification, and `mutations` is the native mutation list.
- */
- onMutation: function(node, listener) {
- var observer = new MutationObserver(function(mutations) {
- listener.call(this, observer, mutations);
- observer.disconnect();
- }.bind(this));
- observer.observe(node, {childList: true, subtree: true});
- }
- };
-
- /**
- * @class Polymer
- */
-
- /**
- * Returns true if the object includes <a href="#polymer-base">polymer-base</a> in it's prototype chain.
- *
- * @method isBase
- * @param Object {Object} object Object to test.
- * @type Boolean
- */
- function isBase(object) {
- return object.hasOwnProperty('PolymerBase')
- }
-
- // name a base constructor for dev tools
-
- /**
- * The Polymer base-class constructor.
- *
- * @property Base
- * @type Function
- */
- function PolymerBase() {};
- PolymerBase.prototype = base;
- base.constructor = PolymerBase;
-
- // exports
-
- scope.Base = PolymerBase;
- scope.isBase = isBase;
- scope.api.instance.base = base;
-
-})(Polymer);
-
-(function(scope) {
-
- // imports
-
- var log = window.WebComponents ? WebComponents.flags.log : {};
- var hasShadowDOMPolyfill = window.ShadowDOMPolyfill;
-
- // magic words
-
- var STYLE_SCOPE_ATTRIBUTE = 'element';
- var STYLE_CONTROLLER_SCOPE = 'controller';
-
- var styles = {
- STYLE_SCOPE_ATTRIBUTE: STYLE_SCOPE_ATTRIBUTE,
- /**
- * Installs external stylesheets and <style> elements with the attribute
- * polymer-scope='controller' into the scope of element. This is intended
- * to be a called during custom element construction.
- */
- installControllerStyles: function() {
- // apply controller styles, but only if they are not yet applied
- var scope = this.findStyleScope();
- if (scope && !this.scopeHasNamedStyle(scope, this.localName)) {
- // allow inherited controller styles
- var proto = getPrototypeOf(this), cssText = '';
- while (proto && proto.element) {
- cssText += proto.element.cssTextForScope(STYLE_CONTROLLER_SCOPE);
- proto = getPrototypeOf(proto);
- }
- if (cssText) {
- this.installScopeCssText(cssText, scope);
- }
- }
- },
- installScopeStyle: function(style, name, scope) {
- var scope = scope || this.findStyleScope(), name = name || '';
- if (scope && !this.scopeHasNamedStyle(scope, this.localName + name)) {
- var cssText = '';
- if (style instanceof Array) {
- for (var i=0, l=style.length, s; (i<l) && (s=style[i]); i++) {
- cssText += s.textContent + '\n\n';
- }
- } else {
- cssText = style.textContent;
- }
- this.installScopeCssText(cssText, scope, name);
- }
- },
- installScopeCssText: function(cssText, scope, name) {
- scope = scope || this.findStyleScope();
- name = name || '';
- if (!scope) {
- return;
- }
- if (hasShadowDOMPolyfill) {
- cssText = shimCssText(cssText, scope.host);
- }
- var style = this.element.cssTextToScopeStyle(cssText,
- STYLE_CONTROLLER_SCOPE);
- Polymer.applyStyleToScope(style, scope);
- // cache that this style has been applied
- this.styleCacheForScope(scope)[this.localName + name] = true;
- },
- findStyleScope: function(node) {
- // find the shadow root that contains this element
- var n = node || this;
- while (n.parentNode) {
- n = n.parentNode;
- }
- return n;
- },
- scopeHasNamedStyle: function(scope, name) {
- var cache = this.styleCacheForScope(scope);
- return cache[name];
- },
- styleCacheForScope: function(scope) {
- if (hasShadowDOMPolyfill) {
- var scopeName = scope.host ? scope.host.localName : scope.localName;
- return polyfillScopeStyleCache[scopeName] || (polyfillScopeStyleCache[scopeName] = {});
- } else {
- return scope._scopeStyles = (scope._scopeStyles || {});
- }
- }
- };
-
- var polyfillScopeStyleCache = {};
-
- // NOTE: use raw prototype traversal so that we ensure correct traversal
- // on platforms where the protoype chain is simulated via __proto__ (IE10)
- function getPrototypeOf(prototype) {
- return prototype.__proto__;
- }
-
- function shimCssText(cssText, host) {
- var name = '', is = false;
- if (host) {
- name = host.localName;
- is = host.hasAttribute('is');
- }
- var selector = WebComponents.ShadowCSS.makeScopeSelector(name, is);
- return WebComponents.ShadowCSS.shimCssText(cssText, selector);
- }
-
- // exports
-
- scope.api.instance.styles = styles;
-
-})(Polymer);
-
-(function(scope) {
-
- // imports
-
- var extend = scope.extend;
- var api = scope.api;
-
- // imperative implementation: Polymer()
-
- // specify an 'own' prototype for tag `name`
- function element(name, prototype) {
- if (typeof name !== 'string') {
- var script = prototype || document._currentScript;
- prototype = name;
- name = script && script.parentNode && script.parentNode.getAttribute ?
- script.parentNode.getAttribute('name') : '';
- if (!name) {
- throw 'Element name could not be inferred.';
- }
- }
- if (getRegisteredPrototype(name)) {
- throw 'Already registered (Polymer) prototype for element ' + name;
- }
- // cache the prototype
- registerPrototype(name, prototype);
- // notify the registrar waiting for 'name', if any
- notifyPrototype(name);
- }
-
- // async prototype source
-
- function waitingForPrototype(name, client) {
- waitPrototype[name] = client;
- }
-
- var waitPrototype = {};
-
- function notifyPrototype(name) {
- if (waitPrototype[name]) {
- waitPrototype[name].registerWhenReady();
- delete waitPrototype[name];
- }
- }
-
- // utility and bookkeeping
-
- // maps tag names to prototypes, as registered with
- // Polymer. Prototypes associated with a tag name
- // using document.registerElement are available from
- // HTMLElement.getPrototypeForTag().
- // If an element was fully registered by Polymer, then
- // Polymer.getRegisteredPrototype(name) ===
- // HTMLElement.getPrototypeForTag(name)
-
- var prototypesByName = {};
-
- function registerPrototype(name, prototype) {
- return prototypesByName[name] = prototype || {};
- }
-
- function getRegisteredPrototype(name) {
- return prototypesByName[name];
- }
-
- function instanceOfType(element, type) {
- if (typeof type !== 'string') {
- return false;
- }
- var proto = HTMLElement.getPrototypeForTag(type);
- var ctor = proto && proto.constructor;
- if (!ctor) {
- return false;
- }
- if (CustomElements.instanceof) {
- return CustomElements.instanceof(element, ctor);
- }
- return element instanceof ctor;
- }
-
- // exports
-
- scope.getRegisteredPrototype = getRegisteredPrototype;
- scope.waitingForPrototype = waitingForPrototype;
- scope.instanceOfType = instanceOfType;
-
- // namespace shenanigans so we can expose our scope on the registration
- // function
-
- // make window.Polymer reference `element()`
-
- window.Polymer = element;
-
- // TODO(sjmiles): find a way to do this that is less terrible
- // copy window.Polymer properties onto `element()`
-
- extend(Polymer, scope);
-
- // Under the HTMLImports polyfill, scripts in the main document
- // do not block on imports; we want to allow calls to Polymer in the main
- // document. WebComponents collects those calls until we can process them, which
- // we do here.
-
- if (WebComponents.consumeDeclarations) {
- WebComponents.consumeDeclarations(function(declarations) {
- if (declarations) {
- for (var i=0, l=declarations.length, d; (i<l) && (d=declarations[i]); i++) {
- element.apply(null, d);
- }
- }
- });
- }
-
-})(Polymer);
-
-(function(scope) {
-
-/**
- * @class polymer-base
- */
-
- /**
- * Resolve a url path to be relative to a `base` url. If unspecified, `base`
- * defaults to the element's ownerDocument url. Can be used to resolve
- * paths from element's in templates loaded in HTMLImports to be relative
- * to the document containing the element. Polymer automatically does this for
- * url attributes in element templates; however, if a url, for
- * example, contains a binding, then `resolvePath` can be used to ensure it is
- * relative to the element document. For example, in an element's template,
- *
- * <a href="{{resolvePath(path)}}">Resolved</a>
- *
- * @method resolvePath
- * @param {String} url Url path to resolve.
- * @param {String} base Optional base url against which to resolve, defaults
- * to the element's ownerDocument url.
- * returns {String} resolved url.
- */
-
-var path = {
- resolveElementPaths: function(node) {
- Polymer.urlResolver.resolveDom(node);
- },
- addResolvePathApi: function() {
- // let assetpath attribute modify the resolve path
- var assetPath = this.getAttribute('assetpath') || '';
- var root = new URL(assetPath, this.ownerDocument.baseURI);
- this.prototype.resolvePath = function(urlPath, base) {
- var u = new URL(urlPath, base || root);
- return u.href;
- };
- }
-};
-
-// exports
-scope.api.declaration.path = path;
-
-})(Polymer);
-
-(function(scope) {
-
- // imports
-
- var log = window.WebComponents ? WebComponents.flags.log : {};
- var api = scope.api.instance.styles;
- var STYLE_SCOPE_ATTRIBUTE = api.STYLE_SCOPE_ATTRIBUTE;
-
- var hasShadowDOMPolyfill = window.ShadowDOMPolyfill;
-
- // magic words
-
- var STYLE_SELECTOR = 'style';
- var STYLE_LOADABLE_MATCH = '@import';
- var SHEET_SELECTOR = 'link[rel=stylesheet]';
- var STYLE_GLOBAL_SCOPE = 'global';
- var SCOPE_ATTR = 'polymer-scope';
-
- var styles = {
- // returns true if resources are loading
- loadStyles: function(callback) {
- var template = this.fetchTemplate();
- var content = template && this.templateContent();
- if (content) {
- this.convertSheetsToStyles(content);
- var styles = this.findLoadableStyles(content);
- if (styles.length) {
- var templateUrl = template.ownerDocument.baseURI;
- return Polymer.styleResolver.loadStyles(styles, templateUrl, callback);
- }
- }
- if (callback) {
- callback();
- }
- },
- convertSheetsToStyles: function(root) {
- var s$ = root.querySelectorAll(SHEET_SELECTOR);
- for (var i=0, l=s$.length, s, c; (i<l) && (s=s$[i]); i++) {
- c = createStyleElement(importRuleForSheet(s, this.ownerDocument.baseURI),
- this.ownerDocument);
- this.copySheetAttributes(c, s);
- s.parentNode.replaceChild(c, s);
- }
- },
- copySheetAttributes: function(style, link) {
- for (var i=0, a$=link.attributes, l=a$.length, a; (a=a$[i]) && i<l; i++) {
- if (a.name !== 'rel' && a.name !== 'href') {
- style.setAttribute(a.name, a.value);
- }
- }
- },
- findLoadableStyles: function(root) {
- var loadables = [];
- if (root) {
- var s$ = root.querySelectorAll(STYLE_SELECTOR);
- for (var i=0, l=s$.length, s; (i<l) && (s=s$[i]); i++) {
- if (s.textContent.match(STYLE_LOADABLE_MATCH)) {
- loadables.push(s);
- }
- }
- }
- return loadables;
- },
- /**
- * Install external stylesheets loaded in <polymer-element> elements into the
- * element's template.
- * @param elementElement The <element> element to style.
- */
- installSheets: function() {
- this.cacheSheets();
- this.cacheStyles();
- this.installLocalSheets();
- this.installGlobalStyles();
- },
- /**
- * Remove all sheets from element and store for later use.
- */
- cacheSheets: function() {
- this.sheets = this.findNodes(SHEET_SELECTOR);
- this.sheets.forEach(function(s) {
- if (s.parentNode) {
- s.parentNode.removeChild(s);
- }
- });
- },
- cacheStyles: function() {
- this.styles = this.findNodes(STYLE_SELECTOR + '[' + SCOPE_ATTR + ']');
- this.styles.forEach(function(s) {
- if (s.parentNode) {
- s.parentNode.removeChild(s);
- }
- });
- },
- /**
- * Takes external stylesheets loaded in an <element> element and moves
- * their content into a <style> element inside the <element>'s template.
- * The sheet is then removed from the <element>. This is done only so
- * that if the element is loaded in the main document, the sheet does
- * not become active.
- * Note, ignores sheets with the attribute 'polymer-scope'.
- * @param elementElement The <element> element to style.
- */
- installLocalSheets: function () {
- var sheets = this.sheets.filter(function(s) {
- return !s.hasAttribute(SCOPE_ATTR);
- });
- var content = this.templateContent();
- if (content) {
- var cssText = '';
- sheets.forEach(function(sheet) {
- cssText += cssTextFromSheet(sheet) + '\n';
- });
- if (cssText) {
- var style = createStyleElement(cssText, this.ownerDocument);
- content.insertBefore(style, content.firstChild);
- }
- }
- },
- findNodes: function(selector, matcher) {
- var nodes = this.querySelectorAll(selector).array();
- var content = this.templateContent();
- if (content) {
- var templateNodes = content.querySelectorAll(selector).array();
- nodes = nodes.concat(templateNodes);
- }
- return matcher ? nodes.filter(matcher) : nodes;
- },
- /**
- * Promotes external stylesheets and <style> elements with the attribute
- * polymer-scope='global' into global scope.
- * This is particularly useful for defining @keyframe rules which
- * currently do not function in scoped or shadow style elements.
- * (See wkb.ug/72462)
- * @param elementElement The <element> element to style.
- */
- // TODO(sorvell): remove when wkb.ug/72462 is addressed.
- installGlobalStyles: function() {
- var style = this.styleForScope(STYLE_GLOBAL_SCOPE);
- applyStyleToScope(style, document.head);
- },
- cssTextForScope: function(scopeDescriptor) {
- var cssText = '';
- // handle stylesheets
- var selector = '[' + SCOPE_ATTR + '=' + scopeDescriptor + ']';
- var matcher = function(s) {
- return matchesSelector(s, selector);
- };
- var sheets = this.sheets.filter(matcher);
- sheets.forEach(function(sheet) {
- cssText += cssTextFromSheet(sheet) + '\n\n';
- });
- // handle cached style elements
- var styles = this.styles.filter(matcher);
- styles.forEach(function(style) {
- cssText += style.textContent + '\n\n';
- });
- return cssText;
- },
- styleForScope: function(scopeDescriptor) {
- var cssText = this.cssTextForScope(scopeDescriptor);
- return this.cssTextToScopeStyle(cssText, scopeDescriptor);
- },
- cssTextToScopeStyle: function(cssText, scopeDescriptor) {
- if (cssText) {
- var style = createStyleElement(cssText);
- style.setAttribute(STYLE_SCOPE_ATTRIBUTE, this.getAttribute('name') +
- '-' + scopeDescriptor);
- return style;
- }
- }
- };
-
- function importRuleForSheet(sheet, baseUrl) {
- var href = new URL(sheet.getAttribute('href'), baseUrl).href;
- return '@import \'' + href + '\';';
- }
-
- function applyStyleToScope(style, scope) {
- if (style) {
- if (scope === document) {
- scope = document.head;
- }
- if (hasShadowDOMPolyfill) {
- scope = document.head;
- }
- // TODO(sorvell): necessary for IE
- // see https://connect.microsoft.com/IE/feedback/details/790212/
- // cloning-a-style-element-and-adding-to-document-produces
- // -unexpected-result#details
- // var clone = style.cloneNode(true);
- var clone = createStyleElement(style.textContent);
- var attr = style.getAttribute(STYLE_SCOPE_ATTRIBUTE);
- if (attr) {
- clone.setAttribute(STYLE_SCOPE_ATTRIBUTE, attr);
- }
- // TODO(sorvell): probably too brittle; try to figure out
- // where to put the element.
- var refNode = scope.firstElementChild;
- if (scope === document.head) {
- var selector = 'style[' + STYLE_SCOPE_ATTRIBUTE + ']';
- var s$ = document.head.querySelectorAll(selector);
- if (s$.length) {
- refNode = s$[s$.length-1].nextElementSibling;
- }
- }
- scope.insertBefore(clone, refNode);
- }
- }
-
- function createStyleElement(cssText, scope) {
- scope = scope || document;
- scope = scope.createElement ? scope : scope.ownerDocument;
- var style = scope.createElement('style');
- style.textContent = cssText;
- return style;
- }
-
- function cssTextFromSheet(sheet) {
- return (sheet && sheet.__resource) || '';
- }
-
- function matchesSelector(node, inSelector) {
- if (matches) {
- return matches.call(node, inSelector);
- }
- }
- var p = HTMLElement.prototype;
- var matches = p.matches || p.matchesSelector || p.webkitMatchesSelector
- || p.mozMatchesSelector;
-
- // exports
-
- scope.api.declaration.styles = styles;
- scope.applyStyleToScope = applyStyleToScope;
-
-})(Polymer);
-
-(function(scope) {
-
- // imports
-
- var log = window.WebComponents ? WebComponents.flags.log : {};
- var api = scope.api.instance.events;
- var EVENT_PREFIX = api.EVENT_PREFIX;
-
- var mixedCaseEventTypes = {};
- [
- 'webkitAnimationStart',
- 'webkitAnimationEnd',
- 'webkitTransitionEnd',
- 'DOMFocusOut',
- 'DOMFocusIn',
- 'DOMMouseScroll'
- ].forEach(function(e) {
- mixedCaseEventTypes[e.toLowerCase()] = e;
- });
-
- // polymer-element declarative api: events feature
- var events = {
- parseHostEvents: function() {
- // our delegates map
- var delegates = this.prototype.eventDelegates;
- // extract data from attributes into delegates
- this.addAttributeDelegates(delegates);
- },
- addAttributeDelegates: function(delegates) {
- // for each attribute
- for (var i=0, a; a=this.attributes[i]; i++) {
- // does it have magic marker identifying it as an event delegate?
- if (this.hasEventPrefix(a.name)) {
- // if so, add the info to delegates
- delegates[this.removeEventPrefix(a.name)] = a.value.replace('{{', '')
- .replace('}}', '').trim();
- }
- }
- },
- // starts with 'on-'
- hasEventPrefix: function (n) {
- return n && (n[0] === 'o') && (n[1] === 'n') && (n[2] === '-');
- },
- removeEventPrefix: function(n) {
- return n.slice(prefixLength);
- },
- findController: function(node) {
- while (node.parentNode) {
- if (node.eventController) {
- return node.eventController;
- }
- node = node.parentNode;
- }
- return node.host;
- },
- getEventHandler: function(controller, target, method) {
- var events = this;
- return function(e) {
- if (!controller || !controller.PolymerBase) {
- controller = events.findController(target);
- }
-
- var args = [e, e.detail, e.currentTarget];
- controller.dispatchMethod(controller, method, args);
- };
- },
- prepareEventBinding: function(pathString, name, node) {
- if (!this.hasEventPrefix(name))
- return;
-
- var eventType = this.removeEventPrefix(name);
- eventType = mixedCaseEventTypes[eventType] || eventType;
-
- var events = this;
-
- return function(model, node, oneTime) {
- var handler = events.getEventHandler(undefined, node, pathString);
- PolymerGestures.addEventListener(node, eventType, handler);
-
- if (oneTime)
- return;
-
- // TODO(rafaelw): This is really pointless work. Aside from the cost
- // of these allocations, NodeBind is going to setAttribute back to its
- // current value. Fixing this would mean changing the TemplateBinding
- // binding delegate API.
- function bindingValue() {
- return '{{ ' + pathString + ' }}';
- }
-
- return {
- open: bindingValue,
- discardChanges: bindingValue,
- close: function() {
- PolymerGestures.removeEventListener(node, eventType, handler);
- }
- };
- };
- }
- };
-
- var prefixLength = EVENT_PREFIX.length;
-
- // exports
- scope.api.declaration.events = events;
-
-})(Polymer);
-
-(function(scope) {
-
- // element api
-
- var observationBlacklist = ['attribute'];
-
- var properties = {
- inferObservers: function(prototype) {
- // called before prototype.observe is chained to inherited object
- var observe = prototype.observe, property;
- for (var n in prototype) {
- if (n.slice(-7) === 'Changed') {
- property = n.slice(0, -7);
- if (this.canObserveProperty(property)) {
- if (!observe) {
- observe = (prototype.observe = {});
- }
- observe[property] = observe[property] || n;
- }
- }
- }
- },
- canObserveProperty: function(property) {
- return (observationBlacklist.indexOf(property) < 0);
- },
- explodeObservers: function(prototype) {
- // called before prototype.observe is chained to inherited object
- var o = prototype.observe;
- if (o) {
- var exploded = {};
- for (var n in o) {
- var names = n.split(' ');
- for (var i=0, ni; ni=names[i]; i++) {
- exploded[ni] = o[n];
- }
- }
- prototype.observe = exploded;
- }
- },
- optimizePropertyMaps: function(prototype) {
- if (prototype.observe) {
- // construct name list
- var a = prototype._observeNames = [];
- for (var n in prototype.observe) {
- var names = n.split(' ');
- for (var i=0, ni; ni=names[i]; i++) {
- a.push(ni);
- }
- }
- }
- if (prototype.publish) {
- // construct name list
- var a = prototype._publishNames = [];
- for (var n in prototype.publish) {
- a.push(n);
- }
- }
- if (prototype.computed) {
- // construct name list
- var a = prototype._computedNames = [];
- for (var n in prototype.computed) {
- a.push(n);
- }
- }
- },
- publishProperties: function(prototype, base) {
- // if we have any properties to publish
- var publish = prototype.publish;
- if (publish) {
- // transcribe `publish` entries onto own prototype
- this.requireProperties(publish, prototype, base);
- // warn and remove accessor names that are broken on some browsers
- this.filterInvalidAccessorNames(publish);
- // construct map of lower-cased property names
- prototype._publishLC = this.lowerCaseMap(publish);
- }
- var computed = prototype.computed;
- if (computed) {
- // warn and remove accessor names that are broken on some browsers
- this.filterInvalidAccessorNames(computed);
- }
- },
- // Publishing/computing a property where the name might conflict with a
- // browser property is not currently supported to help users of Polymer
- // avoid browser bugs:
- //
- // https://code.google.com/p/chromium/issues/detail?id=43394
- // https://bugs.webkit.org/show_bug.cgi?id=49739
- //
- // We can lift this restriction when those bugs are fixed.
- filterInvalidAccessorNames: function(propertyNames) {
- for (var name in propertyNames) {
- // Check if the name is in our blacklist.
- if (this.propertyNameBlacklist[name]) {
- console.warn('Cannot define property "' + name + '" for element "' +
- this.name + '" because it has the same name as an HTMLElement ' +
- 'property, and not all browsers support overriding that. ' +
- 'Consider giving it a different name.');
- // Remove the invalid accessor from the list.
- delete propertyNames[name];
- }
- }
- },
- //
- // `name: value` entries in the `publish` object may need to generate
- // matching properties on the prototype.
- //
- // Values that are objects may have a `reflect` property, which
- // signals that the value describes property control metadata.
- // In metadata objects, the prototype default value (if any)
- // is encoded in the `value` property.
- //
- // publish: {
- // foo: 5,
- // bar: {value: true, reflect: true},
- // zot: {}
- // }
- //
- // `reflect` metadata property controls whether changes to the property
- // are reflected back to the attribute (default false).
- //
- // A value is stored on the prototype unless it's === `undefined`,
- // in which case the base chain is checked for a value.
- // If the basal value is also undefined, `null` is stored on the prototype.
- //
- // The reflection data is stored on another prototype object, `reflect`
- // which also can be specified directly.
- //
- // reflect: {
- // foo: true
- // }
- //
- requireProperties: function(propertyInfos, prototype, base) {
- // per-prototype storage for reflected properties
- prototype.reflect = prototype.reflect || {};
- // ensure a prototype value for each property
- // and update the property's reflect to attribute status
- for (var n in propertyInfos) {
- var value = propertyInfos[n];
- // value has metadata if it has a `reflect` property
- if (value && value.reflect !== undefined) {
- prototype.reflect[n] = Boolean(value.reflect);
- value = value.value;
- }
- // only set a value if one is specified
- if (value !== undefined) {
- prototype[n] = value;
- }
- }
- },
- lowerCaseMap: function(properties) {
- var map = {};
- for (var n in properties) {
- map[n.toLowerCase()] = n;
- }
- return map;
- },
- createPropertyAccessor: function(name, ignoreWrites) {
- var proto = this.prototype;
-
- var privateName = name + '_';
- var privateObservable = name + 'Observable_';
- proto[privateName] = proto[name];
-
- Object.defineProperty(proto, name, {
- get: function() {
- var observable = this[privateObservable];
- if (observable)
- observable.deliver();
-
- return this[privateName];
- },
- set: function(value) {
- if (ignoreWrites) {
- return this[privateName];
- }
-
- var observable = this[privateObservable];
- if (observable) {
- observable.setValue(value);
- return;
- }
-
- var oldValue = this[privateName];
- this[privateName] = value;
- this.emitPropertyChangeRecord(name, value, oldValue);
-
- return value;
- },
- configurable: true
- });
- },
- createPropertyAccessors: function(prototype) {
- var n$ = prototype._computedNames;
- if (n$ && n$.length) {
- for (var i=0, l=n$.length, n, fn; (i<l) && (n=n$[i]); i++) {
- this.createPropertyAccessor(n, true);
- }
- }
- var n$ = prototype._publishNames;
- if (n$ && n$.length) {
- for (var i=0, l=n$.length, n, fn; (i<l) && (n=n$[i]); i++) {
- // If the property is computed and published, the accessor is created
- // above.
- if (!prototype.computed || !prototype.computed[n]) {
- this.createPropertyAccessor(n);
- }
- }
- }
- },
- // This list contains some property names that people commonly want to use,
- // but won't work because of Chrome/Safari bugs. It isn't an exhaustive
- // list. In particular it doesn't contain any property names found on
- // subtypes of HTMLElement (e.g. name, value). Rather it attempts to catch
- // some common cases.
- propertyNameBlacklist: {
- children: 1,
- 'class': 1,
- id: 1,
- hidden: 1,
- style: 1,
- title: 1,
- }
- };
-
- // exports
-
- scope.api.declaration.properties = properties;
-
-})(Polymer);
-
-(function(scope) {
-
- // magic words
-
- var ATTRIBUTES_ATTRIBUTE = 'attributes';
- var ATTRIBUTES_REGEX = /\s|,/;
-
- // attributes api
-
- var attributes = {
-
- inheritAttributesObjects: function(prototype) {
- // chain our lower-cased publish map to the inherited version
- this.inheritObject(prototype, 'publishLC');
- // chain our instance attributes map to the inherited version
- this.inheritObject(prototype, '_instanceAttributes');
- },
-
- publishAttributes: function(prototype, base) {
- // merge names from 'attributes' attribute into the 'publish' object
- var attributes = this.getAttribute(ATTRIBUTES_ATTRIBUTE);
- if (attributes) {
- // create a `publish` object if needed.
- // the `publish` object is only relevant to this prototype, the
- // publishing logic in `declaration/properties.js` is responsible for
- // managing property values on the prototype chain.
- // TODO(sjmiles): the `publish` object is later chained to it's
- // ancestor object, presumably this is only for
- // reflection or other non-library uses.
- var publish = prototype.publish || (prototype.publish = {});
- // names='a b c' or names='a,b,c'
- var names = attributes.split(ATTRIBUTES_REGEX);
- // record each name for publishing
- for (var i=0, l=names.length, n; i<l; i++) {
- // remove excess ws
- n = names[i].trim();
- // looks weird, but causes n to exist on `publish` if it does not;
- // a more careful test would need expensive `in` operator
- if (n && publish[n] === undefined) {
- publish[n] = undefined;
- }
- }
- }
- },
-
- // record clonable attributes from <element>
- accumulateInstanceAttributes: function() {
- // inherit instance attributes
- var clonable = this.prototype._instanceAttributes;
- // merge attributes from element
- var a$ = this.attributes;
- for (var i=0, l=a$.length, a; (i<l) && (a=a$[i]); i++) {
- if (this.isInstanceAttribute(a.name)) {
- clonable[a.name] = a.value;
- }
- }
- },
-
- isInstanceAttribute: function(name) {
- return !this.blackList[name] && name.slice(0,3) !== 'on-';
- },
-
- // do not clone these attributes onto instances
- blackList: {
- name: 1,
- 'extends': 1,
- constructor: 1,
- noscript: 1,
- assetpath: 1,
- 'cache-csstext': 1
- }
-
- };
-
- // add ATTRIBUTES_ATTRIBUTE to the blacklist
- attributes.blackList[ATTRIBUTES_ATTRIBUTE] = 1;
-
- // exports
-
- scope.api.declaration.attributes = attributes;
-
-})(Polymer);
-
-(function(scope) {
-
- // imports
- var events = scope.api.declaration.events;
-
- var syntax = new PolymerExpressions();
- var prepareBinding = syntax.prepareBinding;
-
- // Polymer takes a first crack at the binding to see if it's a declarative
- // event handler.
- syntax.prepareBinding = function(pathString, name, node) {
- return events.prepareEventBinding(pathString, name, node) ||
- prepareBinding.call(syntax, pathString, name, node);
- };
-
- // declaration api supporting mdv
- var mdv = {
- syntax: syntax,
- fetchTemplate: function() {
- return this.querySelector('template');
- },
- templateContent: function() {
- var template = this.fetchTemplate();
- return template && template.content;
- },
- installBindingDelegate: function(template) {
- if (template) {
- template.bindingDelegate = this.syntax;
- }
- }
- };
-
- // exports
- scope.api.declaration.mdv = mdv;
-
-})(Polymer);
-
-(function(scope) {
-
- // imports
-
- var api = scope.api;
- var isBase = scope.isBase;
- var extend = scope.extend;
-
- var hasShadowDOMPolyfill = window.ShadowDOMPolyfill;
-
- // prototype api
-
- var prototype = {
-
- register: function(name, extendeeName) {
- // build prototype combining extendee, Polymer base, and named api
- this.buildPrototype(name, extendeeName);
- // register our custom element with the platform
- this.registerPrototype(name, extendeeName);
- // reference constructor in a global named by 'constructor' attribute
- this.publishConstructor();
- },
-
- buildPrototype: function(name, extendeeName) {
- // get our custom prototype (before chaining)
- var extension = scope.getRegisteredPrototype(name);
- // get basal prototype
- var base = this.generateBasePrototype(extendeeName);
- // implement declarative features
- this.desugarBeforeChaining(extension, base);
- // join prototypes
- this.prototype = this.chainPrototypes(extension, base);
- // more declarative features
- this.desugarAfterChaining(name, extendeeName);
- },
-
- desugarBeforeChaining: function(prototype, base) {
- // back reference declaration element
- // TODO(sjmiles): replace `element` with `elementElement` or `declaration`
- prototype.element = this;
- // transcribe `attributes` declarations onto own prototype's `publish`
- this.publishAttributes(prototype, base);
- // `publish` properties to the prototype and to attribute watch
- this.publishProperties(prototype, base);
- // infer observers for `observe` list based on method names
- this.inferObservers(prototype);
- // desugar compound observer syntax, e.g. 'a b c'
- this.explodeObservers(prototype);
- },
-
- chainPrototypes: function(prototype, base) {
- // chain various meta-data objects to inherited versions
- this.inheritMetaData(prototype, base);
- // chain custom api to inherited
- var chained = this.chainObject(prototype, base);
- // x-platform fixup
- ensurePrototypeTraversal(chained);
- return chained;
- },
-
- inheritMetaData: function(prototype, base) {
- // chain observe object to inherited
- this.inheritObject('observe', prototype, base);
- // chain publish object to inherited
- this.inheritObject('publish', prototype, base);
- // chain reflect object to inherited
- this.inheritObject('reflect', prototype, base);
- // chain our lower-cased publish map to the inherited version
- this.inheritObject('_publishLC', prototype, base);
- // chain our instance attributes map to the inherited version
- this.inheritObject('_instanceAttributes', prototype, base);
- // chain our event delegates map to the inherited version
- this.inheritObject('eventDelegates', prototype, base);
- },
-
- // implement various declarative features
- desugarAfterChaining: function(name, extendee) {
- // build side-chained lists to optimize iterations
- this.optimizePropertyMaps(this.prototype);
- this.createPropertyAccessors(this.prototype);
- // install mdv delegate on template
- this.installBindingDelegate(this.fetchTemplate());
- // install external stylesheets as if they are inline
- this.installSheets();
- // adjust any paths in dom from imports
- this.resolveElementPaths(this);
- // compile list of attributes to copy to instances
- this.accumulateInstanceAttributes();
- // parse on-* delegates declared on `this` element
- this.parseHostEvents();
- //
- // install a helper method this.resolvePath to aid in
- // setting resource urls. e.g.
- // this.$.image.src = this.resolvePath('images/foo.png')
- this.addResolvePathApi();
- // under ShadowDOMPolyfill, transforms to approximate missing CSS features
- if (hasShadowDOMPolyfill) {
- WebComponents.ShadowCSS.shimStyling(this.templateContent(), name,
- extendee);
- }
- // allow custom element access to the declarative context
- if (this.prototype.registerCallback) {
- this.prototype.registerCallback(this);
- }
- },
-
- // if a named constructor is requested in element, map a reference
- // to the constructor to the given symbol
- publishConstructor: function() {
- var symbol = this.getAttribute('constructor');
- if (symbol) {
- window[symbol] = this.ctor;
- }
- },
-
- // build prototype combining extendee, Polymer base, and named api
- generateBasePrototype: function(extnds) {
- var prototype = this.findBasePrototype(extnds);
- if (!prototype) {
- // create a prototype based on tag-name extension
- var prototype = HTMLElement.getPrototypeForTag(extnds);
- // insert base api in inheritance chain (if needed)
- prototype = this.ensureBaseApi(prototype);
- // memoize this base
- memoizedBases[extnds] = prototype;
- }
- return prototype;
- },
-
- findBasePrototype: function(name) {
- return memoizedBases[name];
- },
-
- // install Polymer instance api into prototype chain, as needed
- ensureBaseApi: function(prototype) {
- if (prototype.PolymerBase) {
- return prototype;
- }
- var extended = Object.create(prototype);
- // we need a unique copy of base api for each base prototype
- // therefore we 'extend' here instead of simply chaining
- api.publish(api.instance, extended);
- // TODO(sjmiles): sharing methods across prototype chains is
- // not supported by 'super' implementation which optimizes
- // by memoizing prototype relationships.
- // Probably we should have a version of 'extend' that is
- // share-aware: it could study the text of each function,
- // look for usage of 'super', and wrap those functions in
- // closures.
- // As of now, there is only one problematic method, so
- // we just patch it manually.
- // To avoid re-entrancy problems, the special super method
- // installed is called `mixinSuper` and the mixin method
- // must use this method instead of the default `super`.
- this.mixinMethod(extended, prototype, api.instance.mdv, 'bind');
- // return buffed-up prototype
- return extended;
- },
-
- mixinMethod: function(extended, prototype, api, name) {
- var $super = function(args) {
- return prototype[name].apply(this, args);
- };
- extended[name] = function() {
- this.mixinSuper = $super;
- return api[name].apply(this, arguments);
- }
- },
-
- // ensure prototype[name] inherits from a prototype.prototype[name]
- inheritObject: function(name, prototype, base) {
- // require an object
- var source = prototype[name] || {};
- // chain inherited properties onto a new object
- prototype[name] = this.chainObject(source, base[name]);
- },
-
- // register 'prototype' to custom element 'name', store constructor
- registerPrototype: function(name, extendee) {
- var info = {
- prototype: this.prototype
- }
- // native element must be specified in extends
- var typeExtension = this.findTypeExtension(extendee);
- if (typeExtension) {
- info.extends = typeExtension;
- }
- // register the prototype with HTMLElement for name lookup
- HTMLElement.register(name, this.prototype);
- // register the custom type
- this.ctor = document.registerElement(name, info);
- },
-
- findTypeExtension: function(name) {
- if (name && name.indexOf('-') < 0) {
- return name;
- } else {
- var p = this.findBasePrototype(name);
- if (p.element) {
- return this.findTypeExtension(p.element.extends);
- }
- }
- }
-
- };
-
- // memoize base prototypes
- var memoizedBases = {};
-
- // implementation of 'chainObject' depends on support for __proto__
- if (Object.__proto__) {
- prototype.chainObject = function(object, inherited) {
- if (object && inherited && object !== inherited) {
- object.__proto__ = inherited;
- }
- return object;
- }
- } else {
- prototype.chainObject = function(object, inherited) {
- if (object && inherited && object !== inherited) {
- var chained = Object.create(inherited);
- object = extend(chained, object);
- }
- return object;
- }
- }
-
- // On platforms that do not support __proto__ (versions of IE), the prototype
- // chain of a custom element is simulated via installation of __proto__.
- // Although custom elements manages this, we install it here so it's
- // available during desugaring.
- function ensurePrototypeTraversal(prototype) {
- if (!Object.__proto__) {
- var ancestor = Object.getPrototypeOf(prototype);
- prototype.__proto__ = ancestor;
- if (isBase(ancestor)) {
- ancestor.__proto__ = Object.getPrototypeOf(ancestor);
- }
- }
- }
-
- // exports
-
- api.declaration.prototype = prototype;
-
-})(Polymer);
-
-(function(scope) {
-
- /*
-
- Elements are added to a registration queue so that they register in
- the proper order at the appropriate time. We do this for a few reasons:
-
- * to enable elements to load resources (like stylesheets)
- asynchronously. We need to do this until the platform provides an efficient
- alternative. One issue is that remote @import stylesheets are
- re-fetched whenever stamped into a shadowRoot.
-
- * to ensure elements loaded 'at the same time' (e.g. via some set of
- imports) are registered as a batch. This allows elements to be enured from
- upgrade ordering as long as they query the dom tree 1 task after
- upgrade (aka domReady). This is a performance tradeoff. On the one hand,
- elements that could register while imports are loading are prevented from
- doing so. On the other, grouping upgrades into a single task means less
- incremental work (for example style recalcs), Also, we can ensure the
- document is in a known state at the single quantum of time when
- elements upgrade.
-
- */
- var queue = {
-
- // tell the queue to wait for an element to be ready
- wait: function(element) {
- if (!element.__queue) {
- element.__queue = {};
- elements.push(element);
- }
- },
-
- // enqueue an element to the next spot in the queue.
- enqueue: function(element, check, go) {
- var shouldAdd = element.__queue && !element.__queue.check;
- if (shouldAdd) {
- queueForElement(element).push(element);
- element.__queue.check = check;
- element.__queue.go = go;
- }
- return (this.indexOf(element) !== 0);
- },
-
- indexOf: function(element) {
- var i = queueForElement(element).indexOf(element);
- if (i >= 0 && document.contains(element)) {
- i += (HTMLImports.useNative || HTMLImports.ready) ?
- importQueue.length : 1e9;
- }
- return i;
- },
-
- // tell the queue an element is ready to be registered
- go: function(element) {
- var readied = this.remove(element);
- if (readied) {
- element.__queue.flushable = true;
- this.addToFlushQueue(readied);
- this.check();
- }
- },
-
- remove: function(element) {
- var i = this.indexOf(element);
- if (i !== 0) {
- //console.warn('queue order wrong', i);
- return;
- }
- return queueForElement(element).shift();
- },
-
- check: function() {
- // next
- var element = this.nextElement();
- if (element) {
- element.__queue.check.call(element);
- }
- if (this.canReady()) {
- this.ready();
- return true;
- }
- },
-
- nextElement: function() {
- return nextQueued();
- },
-
- canReady: function() {
- return !this.waitToReady && this.isEmpty();
- },
-
- isEmpty: function() {
- for (var i=0, l=elements.length, e; (i<l) &&
- (e=elements[i]); i++) {
- if (e.__queue && !e.__queue.flushable) {
- return;
- }
- }
- return true;
- },
-
- addToFlushQueue: function(element) {
- flushQueue.push(element);
- },
-
- flush: function() {
- // prevent re-entrance
- if (this.flushing) {
- return;
- }
- this.flushing = true;
- var element;
- while (flushQueue.length) {
- element = flushQueue.shift();
- element.__queue.go.call(element);
- element.__queue = null;
- }
- this.flushing = false;
- },
-
- ready: function() {
- // TODO(sorvell): As an optimization, turn off CE polyfill upgrading
- // while registering. This way we avoid having to upgrade each document
- // piecemeal per registration and can instead register all elements
- // and upgrade once in a batch. Without this optimization, upgrade time
- // degrades significantly when SD polyfill is used. This is mainly because
- // querying the document tree for elements is slow under the SD polyfill.
- var polyfillWasReady = CustomElements.ready;
- CustomElements.ready = false;
- this.flush();
- if (!CustomElements.useNative) {
- CustomElements.upgradeDocumentTree(document);
- }
- CustomElements.ready = polyfillWasReady;
- Polymer.flush();
- requestAnimationFrame(this.flushReadyCallbacks);
- },
-
- addReadyCallback: function(callback) {
- if (callback) {
- readyCallbacks.push(callback);
- }
- },
-
- flushReadyCallbacks: function() {
- if (readyCallbacks) {
- var fn;
- while (readyCallbacks.length) {
- fn = readyCallbacks.shift();
- fn();
- }
- }
- },
-
- /**
- Returns a list of elements that have had polymer-elements created but
- are not yet ready to register. The list is an array of element definitions.
- */
- waitingFor: function() {
- var e$ = [];
- for (var i=0, l=elements.length, e; (i<l) &&
- (e=elements[i]); i++) {
- if (e.__queue && !e.__queue.flushable) {
- e$.push(e);
- }
- }
- return e$;
- },
-
- waitToReady: true
-
- };
-
- var elements = [];
- var flushQueue = [];
- var importQueue = [];
- var mainQueue = [];
- var readyCallbacks = [];
-
- function queueForElement(element) {
- return document.contains(element) ? mainQueue : importQueue;
- }
-
- function nextQueued() {
- return importQueue.length ? importQueue[0] : mainQueue[0];
- }
-
- function whenReady(callback) {
- queue.waitToReady = true;
- Polymer.endOfMicrotask(function() {
- HTMLImports.whenReady(function() {
- queue.addReadyCallback(callback);
- queue.waitToReady = false;
- queue.check();
- });
- });
- }
-
- /**
- Forces polymer to register any pending elements. Can be used to abort
- waiting for elements that are partially defined.
- @param timeout {Integer} Optional timeout in milliseconds
- */
- function forceReady(timeout) {
- if (timeout === undefined) {
- queue.ready();
- return;
- }
- var handle = setTimeout(function() {
- queue.ready();
- }, timeout);
- Polymer.whenReady(function() {
- clearTimeout(handle);
- });
- }
-
- // exports
- scope.elements = elements;
- scope.waitingFor = queue.waitingFor.bind(queue);
- scope.forceReady = forceReady;
- scope.queue = queue;
- scope.whenReady = scope.whenPolymerReady = whenReady;
-})(Polymer);
-
-(function(scope) {
-
- // imports
-
- var extend = scope.extend;
- var api = scope.api;
- var queue = scope.queue;
- var whenReady = scope.whenReady;
- var getRegisteredPrototype = scope.getRegisteredPrototype;
- var waitingForPrototype = scope.waitingForPrototype;
-
- // declarative implementation: <polymer-element>
-
- var prototype = extend(Object.create(HTMLElement.prototype), {
-
- createdCallback: function() {
- if (this.getAttribute('name')) {
- this.init();
- }
- },
-
- init: function() {
- // fetch declared values
- this.name = this.getAttribute('name');
- this.extends = this.getAttribute('extends');
- queue.wait(this);
- // initiate any async resource fetches
- this.loadResources();
- // register when all constraints are met
- this.registerWhenReady();
- },
-
- // TODO(sorvell): we currently queue in the order the prototypes are
- // registered, but we should queue in the order that polymer-elements
- // are registered. We are currently blocked from doing this based on
- // crbug.com/395686.
- registerWhenReady: function() {
- if (this.registered
- || this.waitingForPrototype(this.name)
- || this.waitingForQueue()
- || this.waitingForResources()) {
- return;
- }
- queue.go(this);
- },
-
- _register: function() {
- //console.log('registering', this.name);
- // warn if extending from a custom element not registered via Polymer
- if (isCustomTag(this.extends) && !isRegistered(this.extends)) {
- console.warn('%s is attempting to extend %s, an unregistered element ' +
- 'or one that was not registered with Polymer.', this.name,
- this.extends);
- }
- this.register(this.name, this.extends);
- this.registered = true;
- },
-
- waitingForPrototype: function(name) {
- if (!getRegisteredPrototype(name)) {
- // then wait for a prototype
- waitingForPrototype(name, this);
- // emulate script if user is not supplying one
- this.handleNoScript(name);
- // prototype not ready yet
- return true;
- }
- },
-
- handleNoScript: function(name) {
- // if explicitly marked as 'noscript'
- if (this.hasAttribute('noscript') && !this.noscript) {
- this.noscript = true;
- // imperative element registration
- Polymer(name);
- }
- },
-
- waitingForResources: function() {
- return this._needsResources;
- },
-
- // NOTE: Elements must be queued in proper order for inheritance/composition
- // dependency resolution. Previously this was enforced for inheritance,
- // and by rule for composition. It's now entirely by rule.
- waitingForQueue: function() {
- return queue.enqueue(this, this.registerWhenReady, this._register);
- },
-
- loadResources: function() {
- this._needsResources = true;
- this.loadStyles(function() {
- this._needsResources = false;
- this.registerWhenReady();
- }.bind(this));
- }
-
- });
-
- // semi-pluggable APIs
-
- // TODO(sjmiles): should be fully pluggable (aka decoupled, currently
- // the various plugins are allowed to depend on each other directly)
- api.publish(api.declaration, prototype);
-
- // utility and bookkeeping
-
- function isRegistered(name) {
- return Boolean(HTMLElement.getPrototypeForTag(name));
- }
-
- function isCustomTag(name) {
- return (name && name.indexOf('-') >= 0);
- }
-
- // boot tasks
-
- whenReady(function() {
- document.body.removeAttribute('unresolved');
- document.dispatchEvent(
- new CustomEvent('polymer-ready', {bubbles: true})
- );
- });
-
- // register polymer-element with document
-
- document.registerElement('polymer-element', {prototype: prototype});
-
-})(Polymer);
-
-(function(scope) {
-
-/**
- * @class Polymer
- */
-
-var whenReady = scope.whenReady;
-
-/**
- * Loads the set of HTMLImports contained in `node`. Notifies when all
- * the imports have loaded by calling the `callback` function argument.
- * This method can be used to lazily load imports. For example, given a
- * template:
- *
- * <template>
- * <link rel="import" href="my-import1.html">
- * <link rel="import" href="my-import2.html">
- * </template>
- *
- * Polymer.importElements(template.content, function() {
- * console.log('imports lazily loaded');
- * });
- *
- * @method importElements
- * @param {Node} node Node containing the HTMLImports to load.
- * @param {Function} callback Callback called when all imports have loaded.
- */
-function importElements(node, callback) {
- if (node) {
- document.head.appendChild(node);
- whenReady(callback);
- } else if (callback) {
- callback();
- }
-}
-
-/**
- * Loads an HTMLImport for each url specified in the `urls` array.
- * Notifies when all the imports have loaded by calling the `callback`
- * function argument. This method can be used to lazily load imports.
- * For example,
- *
- * Polymer.import(['my-import1.html', 'my-import2.html'], function() {
- * console.log('imports lazily loaded');
- * });
- *
- * @method import
- * @param {Array} urls Array of urls to load as HTMLImports.
- * @param {Function} callback Callback called when all imports have loaded.
- */
-function _import(urls, callback) {
- if (urls && urls.length) {
- var frag = document.createDocumentFragment();
- for (var i=0, l=urls.length, url, link; (i<l) && (url=urls[i]); i++) {
- link = document.createElement('link');
- link.rel = 'import';
- link.href = url;
- frag.appendChild(link);
- }
- importElements(frag, callback);
- } else if (callback) {
- callback();
- }
-}
-
-// exports
-scope.import = _import;
-scope.importElements = importElements;
-
-})(Polymer);
-
-/**
- * The `auto-binding` element extends the template element. It provides a quick
- * and easy way to do data binding without the need to setup a model.
- * The `auto-binding` element itself serves as the model and controller for the
- * elements it contains. Both data and event handlers can be bound.
- *
- * The `auto-binding` element acts just like a template that is bound to
- * a model. It stamps its content in the dom adjacent to itself. When the
- * content is stamped, the `template-bound` event is fired.
- *
- * Example:
- *
- * <template is="auto-binding">
- * <div>Say something: <input value="{{value}}"></div>
- * <div>You said: {{value}}</div>
- * <button on-tap="{{buttonTap}}">Tap me!</button>
- * </template>
- * <script>
- * var template = document.querySelector('template');
- * template.value = 'something';
- * template.buttonTap = function() {
- * console.log('tap!');
- * };
- * </script>
- *
- * @module Polymer
- * @status stable
-*/
-
-(function() {
-
- var element = document.createElement('polymer-element');
- element.setAttribute('name', 'auto-binding');
- element.setAttribute('extends', 'template');
- element.init();
-
- Polymer('auto-binding', {
-
- createdCallback: function() {
- this.syntax = this.bindingDelegate = this.makeSyntax();
- // delay stamping until polymer-ready so that auto-binding is not
- // required to load last.
- Polymer.whenPolymerReady(function() {
- this.model = this;
- this.setAttribute('bind', '');
- // we don't bother with an explicit signal here, we could ust a MO
- // if necessary
- this.async(function() {
- // note: this will marshall *all* the elements in the parentNode
- // rather than just stamped ones. We'd need to use createInstance
- // to fix this or something else fancier.
- this.marshalNodeReferences(this.parentNode);
- // template stamping is asynchronous so stamping isn't complete
- // by polymer-ready; fire an event so users can use stamped elements
- this.fire('template-bound');
- });
- }.bind(this));
- },
-
- makeSyntax: function() {
- var events = Object.create(Polymer.api.declaration.events);
- var self = this;
- events.findController = function() { return self.model; };
-
- var syntax = new PolymerExpressions();
- var prepareBinding = syntax.prepareBinding;
- syntax.prepareBinding = function(pathString, name, node) {
- return events.prepareEventBinding(pathString, name, node) ||
- prepareBinding.call(syntax, pathString, name, node);
- };
- return syntax;
- }
-
- });
-
-})();
diff --git a/chromium/third_party/catapult/tracing/third_party/components/polymer/polymer.min.js b/chromium/third_party/catapult/tracing/third_party/components/polymer/polymer.min.js
deleted file mode 100644
index dcd0bd6763f..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/polymer/polymer.min.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * @license
- * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
- */
-// @version 0.5.5
-window.PolymerGestures={},function(a){var b=!1,c=document.createElement("meta");if(c.createShadowRoot){var d=c.createShadowRoot(),e=document.createElement("span");d.appendChild(e),c.addEventListener("testpath",function(a){a.path&&(b=a.path[0]===e),a.stopPropagation()});var f=new CustomEvent("testpath",{bubbles:!0});document.head.appendChild(c),e.dispatchEvent(f),c.parentNode.removeChild(c),d=e=null}c=null;var g={shadow:function(a){return a?a.shadowRoot||a.webkitShadowRoot:void 0},canTarget:function(a){return a&&Boolean(a.elementFromPoint)},targetingShadow:function(a){var b=this.shadow(a);return this.canTarget(b)?b:void 0},olderShadow:function(a){var b=a.olderShadowRoot;if(!b){var c=a.querySelector("shadow");c&&(b=c.olderShadowRoot)}return b},allShadows:function(a){for(var b=[],c=this.shadow(a);c;)b.push(c),c=this.olderShadow(c);return b},searchRoot:function(a,b,c){var d,e;return a?(d=a.elementFromPoint(b,c),d?e=this.targetingShadow(d):a!==document&&(e=this.olderShadow(a)),this.searchRoot(e,b,c)||d):void 0},owner:function(a){if(!a)return document;for(var b=a;b.parentNode;)b=b.parentNode;return b.nodeType!=Node.DOCUMENT_NODE&&b.nodeType!=Node.DOCUMENT_FRAGMENT_NODE&&(b=document),b},findTarget:function(a){if(b&&a.path&&a.path.length)return a.path[0];var c=a.clientX,d=a.clientY,e=this.owner(a.target);return e.elementFromPoint(c,d)||(e=document),this.searchRoot(e,c,d)},findTouchAction:function(a){var c;if(b&&a.path&&a.path.length){for(var d=a.path,e=0;e<d.length;e++)if(c=d[e],c.nodeType===Node.ELEMENT_NODE&&c.hasAttribute("touch-action"))return c.getAttribute("touch-action")}else for(c=a.target;c;){if(c.nodeType===Node.ELEMENT_NODE&&c.hasAttribute("touch-action"))return c.getAttribute("touch-action");c=c.parentNode||c.host}return"auto"},LCA:function(a,b){if(a===b)return a;if(a&&!b)return a;if(b&&!a)return b;if(!b&&!a)return document;if(a.contains&&a.contains(b))return a;if(b.contains&&b.contains(a))return b;var c=this.depth(a),d=this.depth(b),e=c-d;for(e>=0?a=this.walk(a,e):b=this.walk(b,-e);a&&b&&a!==b;)a=a.parentNode||a.host,b=b.parentNode||b.host;return a},walk:function(a,b){for(var c=0;a&&b>c;c++)a=a.parentNode||a.host;return a},depth:function(a){for(var b=0;a;)b++,a=a.parentNode||a.host;return b},deepContains:function(a,b){var c=this.LCA(a,b);return c===a},insideNode:function(a,b,c){var d=a.getBoundingClientRect();return d.left<=b&&b<=d.right&&d.top<=c&&c<=d.bottom},path:function(a){var c;if(b&&a.path&&a.path.length)c=a.path;else{c=[];for(var d=this.findTarget(a);d;)c.push(d),d=d.parentNode||d.host}return c}};a.targetFinding=g,a.findTarget=g.findTarget.bind(g),a.deepContains=g.deepContains.bind(g),a.insideNode=g.insideNode}(window.PolymerGestures),function(){function a(a){return"html /deep/ "+b(a)}function b(a){return'[touch-action="'+a+'"]'}function c(a){return"{ -ms-touch-action: "+a+"; touch-action: "+a+";}"}var d=["none","auto","pan-x","pan-y",{rule:"pan-x pan-y",selectors:["pan-x pan-y","pan-y pan-x"]},"manipulation"],e="",f="string"==typeof document.head.style.touchAction,g=!window.ShadowDOMPolyfill&&document.head.createShadowRoot;if(f){d.forEach(function(d){String(d)===d?(e+=b(d)+c(d)+"\n",g&&(e+=a(d)+c(d)+"\n")):(e+=d.selectors.map(b)+c(d.rule)+"\n",g&&(e+=d.selectors.map(a)+c(d.rule)+"\n"))});var h=document.createElement("style");h.textContent=e,document.head.appendChild(h)}}(),function(a){var b=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","pageX","pageY"],c=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0],d=function(){return function(){}},e={preventTap:d,makeBaseEvent:function(a,b){var c=document.createEvent("Event");return c.initEvent(a,b.bubbles||!1,b.cancelable||!1),c.preventTap=e.preventTap(c),c},makeGestureEvent:function(a,b){b=b||Object.create(null);for(var c,d=this.makeBaseEvent(a,b),e=0,f=Object.keys(b);e<f.length;e++)c=f[e],"bubbles"!==c&&"cancelable"!==c&&(d[c]=b[c]);return d},makePointerEvent:function(a,d){d=d||Object.create(null);for(var e,f=this.makeBaseEvent(a,d),g=2;g<b.length;g++)e=b[g],f[e]=d[e]||c[g];f.buttons=d.buttons||0;var h=0;return h=d.pressure?d.pressure:f.buttons?.5:0,f.x=f.clientX,f.y=f.clientY,f.pointerId=d.pointerId||0,f.width=d.width||0,f.height=d.height||0,f.pressure=h,f.tiltX=d.tiltX||0,f.tiltY=d.tiltY||0,f.pointerType=d.pointerType||"",f.hwTimestamp=d.hwTimestamp||0,f.isPrimary=d.isPrimary||!1,f._source=d._source||"",f}};a.eventFactory=e}(window.PolymerGestures),function(a){function b(){if(c){var a=new Map;return a.pointers=d,a}this.keys=[],this.values=[]}var c=window.Map&&window.Map.prototype.forEach,d=function(){return this.size};b.prototype={set:function(a,b){var c=this.keys.indexOf(a);c>-1?this.values[c]=b:(this.keys.push(a),this.values.push(b))},has:function(a){return this.keys.indexOf(a)>-1},"delete":function(a){var b=this.keys.indexOf(a);b>-1&&(this.keys.splice(b,1),this.values.splice(b,1))},get:function(a){var b=this.keys.indexOf(a);return this.values[b]},clear:function(){this.keys.length=0,this.values.length=0},forEach:function(a,b){this.values.forEach(function(c,d){a.call(b,c,this.keys[d],this)},this)},pointers:function(){return this.keys.length}},a.PointerMap=b}(window.PolymerGestures),function(a){var b,c=["bubbles","cancelable","view","detail","screenX","screenY","clientX","clientY","ctrlKey","altKey","shiftKey","metaKey","button","relatedTarget","buttons","pointerId","width","height","pressure","tiltX","tiltY","pointerType","hwTimestamp","isPrimary","type","target","currentTarget","which","pageX","pageY","timeStamp","preventTap","tapPrevented","_source"],d=[!1,!1,null,null,0,0,0,0,!1,!1,!1,!1,0,null,0,0,0,0,0,0,0,"",0,!1,"",null,null,0,0,0,0,function(){},!1],e="undefined"!=typeof SVGElementInstance,f=a.eventFactory,g={IS_IOS:!1,pointermap:new a.PointerMap,requiredGestures:new a.PointerMap,eventMap:Object.create(null),eventSources:Object.create(null),eventSourceList:[],gestures:[],dependencyMap:{down:{listeners:0,index:-1},up:{listeners:0,index:-1}},gestureQueue:[],registerSource:function(a,b){var c=b,d=c.events;d&&(d.forEach(function(a){c[a]&&(this.eventMap[a]=c[a].bind(c))},this),this.eventSources[a]=c,this.eventSourceList.push(c))},registerGesture:function(a,b){var c=Object.create(null);c.listeners=0,c.index=this.gestures.length;for(var d,e=0;e<b.exposes.length;e++)d=b.exposes[e].toLowerCase(),this.dependencyMap[d]=c;this.gestures.push(b)},register:function(a,b){for(var c,d=this.eventSourceList.length,e=0;d>e&&(c=this.eventSourceList[e]);e++)c.register.call(c,a,b)},unregister:function(a){for(var b,c=this.eventSourceList.length,d=0;c>d&&(b=this.eventSourceList[d]);d++)b.unregister.call(b,a)},down:function(a){this.requiredGestures.set(a.pointerId,b),this.fireEvent("down",a)},move:function(a){a.type="move",this.fillGestureQueue(a)},up:function(a){this.fireEvent("up",a),this.requiredGestures["delete"](a.pointerId)},cancel:function(a){a.tapPrevented=!0,this.fireEvent("up",a),this.requiredGestures["delete"](a.pointerId)},addGestureDependency:function(a,b){var c=a._pgEvents;if(c&&b)for(var d,e,f,g=Object.keys(c),h=0;h<g.length;h++)f=g[h],c[f]>0&&(d=this.dependencyMap[f],e=d?d.index:-1,b[e]=!0)},eventHandler:function(c){var d=c.type;if("touchstart"===d||"mousedown"===d||"pointerdown"===d||"MSPointerDown"===d)if(c._handledByPG||(b={}),this.IS_IOS){var e=c;if("touchstart"===d){var f=c.changedTouches[0];e={target:c.target,clientX:f.clientX,clientY:f.clientY,path:c.path}}for(var g,h=c.path||a.targetFinding.path(e),i=0;i<h.length;i++)g=h[i],this.addGestureDependency(g,b)}else this.addGestureDependency(c.currentTarget,b);if(!c._handledByPG){var j=this.eventMap&&this.eventMap[d];j&&j(c),c._handledByPG=!0}},listen:function(a,b){for(var c,d=0,e=b.length;e>d&&(c=b[d]);d++)this.addEvent(a,c)},unlisten:function(a,b){for(var c,d=0,e=b.length;e>d&&(c=b[d]);d++)this.removeEvent(a,c)},addEvent:function(a,b){a.addEventListener(b,this.boundHandler)},removeEvent:function(a,b){a.removeEventListener(b,this.boundHandler)},makeEvent:function(a,b){var c=f.makePointerEvent(a,b);return c.preventDefault=b.preventDefault,c.tapPrevented=b.tapPrevented,c._target=c._target||b.target,c},fireEvent:function(a,b){var c=this.makeEvent(a,b);return this.dispatchEvent(c)},cloneEvent:function(a){for(var b,f=Object.create(null),g=0;g<c.length;g++)b=c[g],f[b]=a[b]||d[g],("target"===b||"relatedTarget"===b)&&e&&f[b]instanceof SVGElementInstance&&(f[b]=f[b].correspondingUseElement);return f.preventDefault=function(){a.preventDefault()},f},dispatchEvent:function(a){var b=a._target;if(b){b.dispatchEvent(a);var c=this.cloneEvent(a);c.target=b,this.fillGestureQueue(c)}},gestureTrigger:function(){for(var a,b,c=0;c<this.gestureQueue.length;c++)if(a=this.gestureQueue[c],b=a._requiredGestures)for(var d,e,f=0;f<this.gestures.length;f++)b[f]&&(d=this.gestures[f],e=d[a.type],e&&e.call(d,a));this.gestureQueue.length=0},fillGestureQueue:function(a){this.gestureQueue.length||requestAnimationFrame(this.boundGestureTrigger),a._requiredGestures=this.requiredGestures.get(a.pointerId),this.gestureQueue.push(a)}};g.boundHandler=g.eventHandler.bind(g),g.boundGestureTrigger=g.gestureTrigger.bind(g),a.dispatcher=g,a.activateGesture=function(a,b){var c=b.toLowerCase(),d=g.dependencyMap[c];if(d){var e=g.gestures[d.index];if(a._pgListeners||(g.register(a),a._pgListeners=0),e){var f,h=e.defaultActions&&e.defaultActions[c];switch(a.nodeType){case Node.ELEMENT_NODE:f=a;break;case Node.DOCUMENT_FRAGMENT_NODE:f=a.host;break;default:f=null}h&&f&&!f.hasAttribute("touch-action")&&f.setAttribute("touch-action",h)}a._pgEvents||(a._pgEvents={}),a._pgEvents[c]=(a._pgEvents[c]||0)+1,a._pgListeners++}return Boolean(d)},a.addEventListener=function(b,c,d,e){d&&(a.activateGesture(b,c),b.addEventListener(c,d,e))},a.deactivateGesture=function(a,b){var c=b.toLowerCase(),d=g.dependencyMap[c];return d&&(a._pgListeners>0&&a._pgListeners--,0===a._pgListeners&&g.unregister(a),a._pgEvents&&(a._pgEvents[c]>0?a._pgEvents[c]--:a._pgEvents[c]=0)),Boolean(d)},a.removeEventListener=function(b,c,d,e){d&&(a.deactivateGesture(b,c),b.removeEventListener(c,d,e))}}(window.PolymerGestures),function(a){var b=a.dispatcher,c=b.pointermap,d=25,e=[0,1,4,2],f=0,g=/Linux.*Firefox\//i,h=function(){if(g.test(navigator.userAgent))return!1;try{return 1===new MouseEvent("test",{buttons:1}).buttons}catch(a){return!1}}(),i={POINTER_ID:1,POINTER_TYPE:"mouse",events:["mousedown","mousemove","mouseup"],exposes:["down","up","move"],register:function(a){b.listen(a,this.events)},unregister:function(a){a.nodeType!==Node.DOCUMENT_NODE&&b.unlisten(a,this.events)},lastTouches:[],isEventSimulatedFromTouch:function(a){for(var b,c=this.lastTouches,e=a.clientX,f=a.clientY,g=0,h=c.length;h>g&&(b=c[g]);g++){var i=Math.abs(e-b.x),j=Math.abs(f-b.y);if(d>=i&&d>=j)return!0}},prepareEvent:function(a){var c=b.cloneEvent(a);if(c.pointerId=this.POINTER_ID,c.isPrimary=!0,c.pointerType=this.POINTER_TYPE,c._source="mouse",!h){var d=a.type,g=e[a.which]||0;"mousedown"===d?f|=g:"mouseup"===d&&(f&=~g),c.buttons=f}return c},mousedown:function(d){if(!this.isEventSimulatedFromTouch(d)){var e=(c.has(this.POINTER_ID),this.prepareEvent(d));e.target=a.findTarget(d),c.set(this.POINTER_ID,e.target),b.down(e)}},mousemove:function(a){if(!this.isEventSimulatedFromTouch(a)){var d=c.get(this.POINTER_ID);if(d){var e=this.prepareEvent(a);e.target=d,0===(h?e.buttons:e.which)?(h||(f=e.buttons=0),b.cancel(e),this.cleanupMouse(e.buttons)):b.move(e)}}},mouseup:function(d){if(!this.isEventSimulatedFromTouch(d)){var e=this.prepareEvent(d);e.relatedTarget=a.findTarget(d),e.target=c.get(this.POINTER_ID),b.up(e),this.cleanupMouse(e.buttons)}},cleanupMouse:function(a){0===a&&c["delete"](this.POINTER_ID)}};a.mouseEvents=i}(window.PolymerGestures),function(a){var b=a.dispatcher,c=(a.targetFinding.allShadows.bind(a.targetFinding),b.pointermap),d=(Array.prototype.map.call.bind(Array.prototype.map),2500),e=25,f=200,g=20,h=!1,i={IS_IOS:!1,events:["touchstart","touchmove","touchend","touchcancel"],exposes:["down","up","move"],register:function(a,c){(this.IS_IOS?c:!c)&&b.listen(a,this.events)},unregister:function(a){this.IS_IOS||b.unlisten(a,this.events)},scrollTypes:{EMITTER:"none",XSCROLLER:"pan-x",YSCROLLER:"pan-y"},touchActionToScrollType:function(a){var b=a,c=this.scrollTypes;return b===c.EMITTER?"none":b===c.XSCROLLER?"X":b===c.YSCROLLER?"Y":"XY"},POINTER_TYPE:"touch",firstTouch:null,isPrimaryTouch:function(a){return this.firstTouch===a.identifier},setPrimaryTouch:function(a){(0===c.pointers()||1===c.pointers()&&c.has(1))&&(this.firstTouch=a.identifier,this.firstXY={X:a.clientX,Y:a.clientY},this.firstTarget=a.target,this.scrolling=null,this.cancelResetClickCount())},removePrimaryPointer:function(a){a.isPrimary&&(this.firstTouch=null,this.firstXY=null,this.resetClickCount())},clickCount:0,resetId:null,resetClickCount:function(){var a=function(){this.clickCount=0,this.resetId=null}.bind(this);this.resetId=setTimeout(a,f)},cancelResetClickCount:function(){this.resetId&&clearTimeout(this.resetId)},typeToButtons:function(a){var b=0;return("touchstart"===a||"touchmove"===a)&&(b=1),b},findTarget:function(b,d){if("touchstart"===this.currentTouchEvent.type){if(this.isPrimaryTouch(b)){var e={clientX:b.clientX,clientY:b.clientY,path:this.currentTouchEvent.path,target:this.currentTouchEvent.target};return a.findTarget(e)}return a.findTarget(b)}return c.get(d)},touchToPointer:function(a){var c=this.currentTouchEvent,d=b.cloneEvent(a),e=d.pointerId=a.identifier+2;d.target=this.findTarget(a,e),d.bubbles=!0,d.cancelable=!0,d.detail=this.clickCount,d.buttons=this.typeToButtons(c.type),d.width=a.webkitRadiusX||a.radiusX||0,d.height=a.webkitRadiusY||a.radiusY||0,d.pressure=a.webkitForce||a.force||.5,d.isPrimary=this.isPrimaryTouch(a),d.pointerType=this.POINTER_TYPE,d._source="touch";var f=this;return d.preventDefault=function(){f.scrolling=!1,f.firstXY=null,c.preventDefault()},d},processTouches:function(a,b){var d=a.changedTouches;this.currentTouchEvent=a;for(var e,f,g=0;g<d.length;g++)e=d[g],f=this.touchToPointer(e),"touchstart"===a.type&&c.set(f.pointerId,f.target),c.has(f.pointerId)&&b.call(this,f),("touchend"===a.type||a._cancel)&&this.cleanUpPointer(f)},shouldScroll:function(b){if(this.firstXY){var c,d=a.targetFinding.findTouchAction(b),e=this.touchActionToScrollType(d);if("none"===e)c=!1;else if("XY"===e)c=!0;else{var f=b.changedTouches[0],g=e,h="Y"===e?"X":"Y",i=Math.abs(f["client"+g]-this.firstXY[g]),j=Math.abs(f["client"+h]-this.firstXY[h]);c=i>=j}return c}},findTouch:function(a,b){for(var c,d=0,e=a.length;e>d&&(c=a[d]);d++)if(c.identifier===b)return!0},vacuumTouches:function(a){var b=a.touches;if(c.pointers()>=b.length){var d=[];c.forEach(function(a,c){if(1!==c&&!this.findTouch(b,c-2)){var e=a;d.push(e)}},this),d.forEach(function(a){this.cancel(a),c["delete"](a.pointerId)},this)}},touchstart:function(a){this.vacuumTouches(a),this.setPrimaryTouch(a.changedTouches[0]),this.dedupSynthMouse(a),this.scrolling||(this.clickCount++,this.processTouches(a,this.down))},down:function(a){b.down(a)},touchmove:function(a){if(h)a.cancelable&&this.processTouches(a,this.move);else if(this.scrolling){if(this.firstXY){var b=a.changedTouches[0],c=b.clientX-this.firstXY.X,d=b.clientY-this.firstXY.Y,e=Math.sqrt(c*c+d*d);e>=g&&(this.touchcancel(a),this.scrolling=!0,this.firstXY=null)}}else null===this.scrolling&&this.shouldScroll(a)?this.scrolling=!0:(this.scrolling=!1,a.preventDefault(),this.processTouches(a,this.move))},move:function(a){b.move(a)},touchend:function(a){this.dedupSynthMouse(a),this.processTouches(a,this.up)},up:function(c){c.relatedTarget=a.findTarget(c),b.up(c)},cancel:function(a){b.cancel(a)},touchcancel:function(a){a._cancel=!0,this.processTouches(a,this.cancel)},cleanUpPointer:function(a){c["delete"](a.pointerId),this.removePrimaryPointer(a)},dedupSynthMouse:function(b){var c=a.mouseEvents.lastTouches,e=b.changedTouches[0];if(this.isPrimaryTouch(e)){var f={x:e.clientX,y:e.clientY};c.push(f);var g=function(a,b){var c=a.indexOf(b);c>-1&&a.splice(c,1)}.bind(null,c,f);setTimeout(g,d)}}},j=Event.prototype.stopImmediatePropagation||Event.prototype.stopPropagation;document.addEventListener("click",function(b){var c=b.clientX,d=b.clientY,f=function(a){var b=Math.abs(c-a.x),f=Math.abs(d-a.y);return e>=b&&e>=f},g=a.mouseEvents.lastTouches.some(f),h=a.targetFinding.path(b);if(g){for(var k=0;k<h.length;k++)if(h[k]===i.firstTarget)return;b.preventDefault(),j.call(b)}},!0),a.touchEvents=i}(window.PolymerGestures),function(a){var b=a.dispatcher,c=b.pointermap,d=window.MSPointerEvent&&"number"==typeof window.MSPointerEvent.MSPOINTER_TYPE_MOUSE,e={events:["MSPointerDown","MSPointerMove","MSPointerUp","MSPointerCancel"],register:function(a){b.listen(a,this.events)},unregister:function(a){a.nodeType!==Node.DOCUMENT_NODE&&b.unlisten(a,this.events)},POINTER_TYPES:["","unavailable","touch","pen","mouse"],prepareEvent:function(a){var c=a;return c=b.cloneEvent(a),d&&(c.pointerType=this.POINTER_TYPES[a.pointerType]),c._source="ms",c},cleanup:function(a){c["delete"](a)},MSPointerDown:function(d){var e=this.prepareEvent(d);e.target=a.findTarget(d),c.set(d.pointerId,e.target),b.down(e)},MSPointerMove:function(a){var d=c.get(a.pointerId);if(d){var e=this.prepareEvent(a);e.target=d,b.move(e)}},MSPointerUp:function(d){var e=this.prepareEvent(d);e.relatedTarget=a.findTarget(d),e.target=c.get(e.pointerId),b.up(e),this.cleanup(d.pointerId)},MSPointerCancel:function(d){var e=this.prepareEvent(d);e.relatedTarget=a.findTarget(d),e.target=c.get(e.pointerId),b.cancel(e),this.cleanup(d.pointerId)}};a.msEvents=e}(window.PolymerGestures),function(a){var b=a.dispatcher,c=b.pointermap,d={events:["pointerdown","pointermove","pointerup","pointercancel"],prepareEvent:function(a){var c=b.cloneEvent(a);return c._source="pointer",c},register:function(a){b.listen(a,this.events)},unregister:function(a){a.nodeType!==Node.DOCUMENT_NODE&&b.unlisten(a,this.events)},cleanup:function(a){c["delete"](a)},pointerdown:function(d){var e=this.prepareEvent(d);e.target=a.findTarget(d),c.set(e.pointerId,e.target),b.down(e)},pointermove:function(a){var d=c.get(a.pointerId);if(d){var e=this.prepareEvent(a);e.target=d,b.move(e)}},pointerup:function(d){var e=this.prepareEvent(d);e.relatedTarget=a.findTarget(d),e.target=c.get(e.pointerId),b.up(e),this.cleanup(d.pointerId)},pointercancel:function(d){var e=this.prepareEvent(d);e.relatedTarget=a.findTarget(d),e.target=c.get(e.pointerId),b.cancel(e),this.cleanup(d.pointerId)}};a.pointerEvents=d}(window.PolymerGestures),function(a){var b=a.dispatcher,c=window.navigator;window.PointerEvent?b.registerSource("pointer",a.pointerEvents):c.msPointerEnabled?b.registerSource("ms",a.msEvents):(b.registerSource("mouse",a.mouseEvents),void 0!==window.ontouchstart&&b.registerSource("touch",a.touchEvents));var d=navigator.userAgent,e=d.match(/iPad|iPhone|iPod/)&&"ontouchstart"in window;b.IS_IOS=e,a.touchEvents.IS_IOS=e,b.register(document,!0)}(window.PolymerGestures),function(a){var b=a.dispatcher,c=a.eventFactory,d=new a.PointerMap,e={events:["down","move","up"],exposes:["trackstart","track","trackx","tracky","trackend"],defaultActions:{track:"none",trackx:"pan-y",tracky:"pan-x"},WIGGLE_THRESHOLD:4,clampDir:function(a){return a>0?1:-1},calcPositionDelta:function(a,b){var c=0,d=0;return a&&b&&(c=b.pageX-a.pageX,d=b.pageY-a.pageY),{x:c,y:d}},fireTrack:function(a,b,d){var e=d,f=this.calcPositionDelta(e.downEvent,b),g=this.calcPositionDelta(e.lastMoveEvent,b);if(g.x)e.xDirection=this.clampDir(g.x);else if("trackx"===a)return;if(g.y)e.yDirection=this.clampDir(g.y);else if("tracky"===a)return;var h={bubbles:!0,cancelable:!0,trackInfo:e.trackInfo,relatedTarget:b.relatedTarget,pointerType:b.pointerType,pointerId:b.pointerId,_source:"track"};"tracky"!==a&&(h.x=b.x,h.dx=f.x,h.ddx=g.x,h.clientX=b.clientX,h.pageX=b.pageX,h.screenX=b.screenX,h.xDirection=e.xDirection),"trackx"!==a&&(h.dy=f.y,h.ddy=g.y,h.y=b.y,h.clientY=b.clientY,h.pageY=b.pageY,h.screenY=b.screenY,h.yDirection=e.yDirection);var i=c.makeGestureEvent(a,h);e.downTarget.dispatchEvent(i)},down:function(a){if(a.isPrimary&&("mouse"===a.pointerType?1===a.buttons:!0)){var b={downEvent:a,downTarget:a.target,trackInfo:{},lastMoveEvent:null,xDirection:0,yDirection:0,tracking:!1};d.set(a.pointerId,b)}},move:function(a){var b=d.get(a.pointerId);if(b){if(!b.tracking){var c=this.calcPositionDelta(b.downEvent,a),e=c.x*c.x+c.y*c.y;e>this.WIGGLE_THRESHOLD&&(b.tracking=!0,b.lastMoveEvent=b.downEvent,this.fireTrack("trackstart",a,b))}b.tracking&&(this.fireTrack("track",a,b),this.fireTrack("trackx",a,b),this.fireTrack("tracky",a,b)),b.lastMoveEvent=a}},up:function(a){var b=d.get(a.pointerId);b&&(b.tracking&&this.fireTrack("trackend",a,b),d["delete"](a.pointerId))}};b.registerGesture("track",e)}(window.PolymerGestures),function(a){var b=a.dispatcher,c=a.eventFactory,d={HOLD_DELAY:200,WIGGLE_THRESHOLD:16,events:["down","move","up"],exposes:["hold","holdpulse","release"],heldPointer:null,holdJob:null,pulse:function(){var a=Date.now()-this.heldPointer.timeStamp,b=this.held?"holdpulse":"hold";this.fireHold(b,a),this.held=!0},cancel:function(){clearInterval(this.holdJob),this.held&&this.fireHold("release"),this.held=!1,this.heldPointer=null,this.target=null,this.holdJob=null},down:function(a){a.isPrimary&&!this.heldPointer&&(this.heldPointer=a,this.target=a.target,this.holdJob=setInterval(this.pulse.bind(this),this.HOLD_DELAY))},up:function(a){this.heldPointer&&this.heldPointer.pointerId===a.pointerId&&this.cancel()},move:function(a){if(this.heldPointer&&this.heldPointer.pointerId===a.pointerId){var b=a.clientX-this.heldPointer.clientX,c=a.clientY-this.heldPointer.clientY;b*b+c*c>this.WIGGLE_THRESHOLD&&this.cancel()}},fireHold:function(a,b){var d={bubbles:!0,cancelable:!0,pointerType:this.heldPointer.pointerType,pointerId:this.heldPointer.pointerId,x:this.heldPointer.clientX,y:this.heldPointer.clientY,_source:"hold"};b&&(d.holdTime=b);var e=c.makeGestureEvent(a,d);this.target.dispatchEvent(e)}};b.registerGesture("hold",d)}(window.PolymerGestures),function(a){var b=a.dispatcher,c=a.eventFactory,d=new a.PointerMap,e={events:["down","up"],exposes:["tap"],down:function(a){a.isPrimary&&!a.tapPrevented&&d.set(a.pointerId,{target:a.target,buttons:a.buttons,x:a.clientX,y:a.clientY})},shouldTap:function(a,b){var c=!0;return"mouse"===a.pointerType&&(c=1^a.buttons&&1&b.buttons),c&&!a.tapPrevented},up:function(b){var e=d.get(b.pointerId);if(e&&this.shouldTap(b,e)){var f=a.targetFinding.LCA(e.target,b.relatedTarget);if(f){var g=c.makeGestureEvent("tap",{bubbles:!0,cancelable:!0,x:b.clientX,y:b.clientY,detail:b.detail,pointerType:b.pointerType,pointerId:b.pointerId,altKey:b.altKey,ctrlKey:b.ctrlKey,metaKey:b.metaKey,shiftKey:b.shiftKey,_source:"tap"});f.dispatchEvent(g)}}d["delete"](b.pointerId)}};c.preventTap=function(a){return function(){a.tapPrevented=!0,d["delete"](a.pointerId)}},b.registerGesture("tap",e)}(window.PolymerGestures),function(a){var b=a.dispatcher,c=a.eventFactory,d=new a.PointerMap,e=180/Math.PI,f={events:["down","up","move","cancel"],exposes:["pinchstart","pinch","pinchend","rotate"],defaultActions:{pinch:"none",rotate:"none"},reference:{},down:function(b){if(d.set(b.pointerId,b),2==d.pointers()){var c=this.calcChord(),e=this.calcAngle(c);this.reference={angle:e,diameter:c.diameter,target:a.targetFinding.LCA(c.a.target,c.b.target)},this.firePinch("pinchstart",c.diameter,c)}},up:function(a){var b=d.get(a.pointerId),c=d.pointers();if(b){if(2===c){var e=this.calcChord();this.firePinch("pinchend",e.diameter,e)}d["delete"](a.pointerId)}},move:function(a){d.has(a.pointerId)&&(d.set(a.pointerId,a),d.pointers()>1&&this.calcPinchRotate())},cancel:function(a){this.up(a)},firePinch:function(a,b,d){var e=b/this.reference.diameter,f=c.makeGestureEvent(a,{bubbles:!0,cancelable:!0,scale:e,centerX:d.center.x,centerY:d.center.y,_source:"pinch"});this.reference.target.dispatchEvent(f)},fireRotate:function(a,b){var d=Math.round((a-this.reference.angle)%360),e=c.makeGestureEvent("rotate",{bubbles:!0,cancelable:!0,angle:d,centerX:b.center.x,centerY:b.center.y,_source:"pinch"});this.reference.target.dispatchEvent(e)},calcPinchRotate:function(){var a=this.calcChord(),b=a.diameter,c=this.calcAngle(a);b!=this.reference.diameter&&this.firePinch("pinch",b,a),c!=this.reference.angle&&this.fireRotate(c,a)},calcChord:function(){var a=[];d.forEach(function(b){a.push(b)});for(var b,c,e,f=0,g={a:a[0],b:a[1]},h=0;h<a.length;h++)for(var i=a[h],j=h+1;j<a.length;j++){var k=a[j];b=Math.abs(i.clientX-k.clientX),c=Math.abs(i.clientY-k.clientY),e=b+c,e>f&&(f=e,g={a:i,b:k})}return b=Math.abs(g.a.clientX+g.b.clientX)/2,c=Math.abs(g.a.clientY+g.b.clientY)/2,g.center={x:b,y:c},g.diameter=f,g},calcAngle:function(a){var b=a.a.clientX-a.b.clientX,c=a.a.clientY-a.b.clientY;return(360+Math.atan2(c,b)*e)%360}};b.registerGesture("pinch",f)}(window.PolymerGestures),function(a){"use strict";function b(a,b){if(!a)throw new Error("ASSERT: "+b)}function c(a){return a>=48&&57>=a}function d(a){return 32===a||9===a||11===a||12===a||160===a||a>=5760&&" ᠎              ".indexOf(String.fromCharCode(a))>0}function e(a){return 10===a||13===a||8232===a||8233===a}function f(a){return 36===a||95===a||a>=65&&90>=a||a>=97&&122>=a}function g(a){return 36===a||95===a||a>=65&&90>=a||a>=97&&122>=a||a>=48&&57>=a}function h(a){return"this"===a}function i(){for(;Y>X&&d(W.charCodeAt(X));)++X}function j(){var a,b;for(a=X++;Y>X&&(b=W.charCodeAt(X),g(b));)++X;return W.slice(a,X)}function k(){var a,b,c;return a=X,b=j(),c=1===b.length?S.Identifier:h(b)?S.Keyword:"null"===b?S.NullLiteral:"true"===b||"false"===b?S.BooleanLiteral:S.Identifier,{type:c,value:b,range:[a,X]}}function l(){var a,b,c=X,d=W.charCodeAt(X),e=W[X];switch(d){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:return++X,{type:S.Punctuator,value:String.fromCharCode(d),range:[c,X]};default:if(a=W.charCodeAt(X+1),61===a)switch(d){case 37:case 38:case 42:case 43:case 45:case 47:case 60:case 62:case 124:return X+=2,{type:S.Punctuator,value:String.fromCharCode(d)+String.fromCharCode(a),range:[c,X]};case 33:case 61:return X+=2,61===W.charCodeAt(X)&&++X,{type:S.Punctuator,value:W.slice(c,X),range:[c,X]}}}return b=W[X+1],e===b&&"&|".indexOf(e)>=0?(X+=2,{type:S.Punctuator,value:e+b,range:[c,X]}):"<>=!+-*%&|^/".indexOf(e)>=0?(++X,{type:S.Punctuator,value:e,range:[c,X]}):void s({},V.UnexpectedToken,"ILLEGAL")}function m(){var a,d,e;if(e=W[X],b(c(e.charCodeAt(0))||"."===e,"Numeric literal must start with a decimal digit or a decimal point"),d=X,a="","."!==e){for(a=W[X++],e=W[X],"0"===a&&e&&c(e.charCodeAt(0))&&s({},V.UnexpectedToken,"ILLEGAL");c(W.charCodeAt(X));)a+=W[X++];e=W[X]}if("."===e){for(a+=W[X++];c(W.charCodeAt(X));)a+=W[X++];e=W[X]}if("e"===e||"E"===e)if(a+=W[X++],e=W[X],("+"===e||"-"===e)&&(a+=W[X++]),c(W.charCodeAt(X)))for(;c(W.charCodeAt(X));)a+=W[X++];else s({},V.UnexpectedToken,"ILLEGAL");return f(W.charCodeAt(X))&&s({},V.UnexpectedToken,"ILLEGAL"),{type:S.NumericLiteral,value:parseFloat(a),range:[d,X]}}function n(){var a,c,d,f="",g=!1;for(a=W[X],b("'"===a||'"'===a,"String literal must starts with a quote"),c=X,++X;Y>X;){if(d=W[X++],d===a){a="";break}if("\\"===d)if(d=W[X++],d&&e(d.charCodeAt(0)))"\r"===d&&"\n"===W[X]&&++X;else switch(d){case"n":f+="\n";break;case"r":f+="\r";break;case"t":f+=" ";break;case"b":f+="\b";break;case"f":f+="\f";break;case"v":f+=" ";break;default:f+=d}else{if(e(d.charCodeAt(0)))break;f+=d}}return""!==a&&s({},V.UnexpectedToken,"ILLEGAL"),{type:S.StringLiteral,value:f,octal:g,range:[c,X]}}function o(a){return a.type===S.Identifier||a.type===S.Keyword||a.type===S.BooleanLiteral||a.type===S.NullLiteral}function p(){var a;return i(),X>=Y?{type:S.EOF,range:[X,X]}:(a=W.charCodeAt(X),40===a||41===a||58===a?l():39===a||34===a?n():f(a)?k():46===a?c(W.charCodeAt(X+1))?m():l():c(a)?m():l())}function q(){var a;return a=$,X=a.range[1],$=p(),X=a.range[1],a}function r(){var a;a=X,$=p(),X=a}function s(a,c){var d,e=Array.prototype.slice.call(arguments,2),f=c.replace(/%(\d)/g,function(a,c){return b(c<e.length,"Message reference must be in range"),e[c]});throw d=new Error(f),d.index=X,d.description=f,d}function t(a){s(a,V.UnexpectedToken,a.value)}function u(a){var b=q();(b.type!==S.Punctuator||b.value!==a)&&t(b)}function v(a){return $.type===S.Punctuator&&$.value===a}function w(a){return $.type===S.Keyword&&$.value===a}function x(){var a=[];for(u("[");!v("]");)v(",")?(q(),a.push(null)):(a.push(bb()),v("]")||u(","));return u("]"),Z.createArrayExpression(a)}function y(){var a;return i(),a=q(),a.type===S.StringLiteral||a.type===S.NumericLiteral?Z.createLiteral(a):Z.createIdentifier(a.value)}function z(){var a,b;return a=$,i(),(a.type===S.EOF||a.type===S.Punctuator)&&t(a),b=y(),u(":"),Z.createProperty("init",b,bb())}function A(){var a=[];for(u("{");!v("}");)a.push(z()),v("}")||u(",");return u("}"),Z.createObjectExpression(a)}function B(){var a;return u("("),a=bb(),u(")"),a}function C(){var a,b,c;return v("(")?B():(a=$.type,a===S.Identifier?c=Z.createIdentifier(q().value):a===S.StringLiteral||a===S.NumericLiteral?c=Z.createLiteral(q()):a===S.Keyword?w("this")&&(q(),c=Z.createThisExpression()):a===S.BooleanLiteral?(b=q(),b.value="true"===b.value,c=Z.createLiteral(b)):a===S.NullLiteral?(b=q(),b.value=null,c=Z.createLiteral(b)):v("[")?c=x():v("{")&&(c=A()),c?c:void t(q()))}function D(){var a=[];if(u("("),!v(")"))for(;Y>X&&(a.push(bb()),!v(")"));)u(",");return u(")"),a}function E(){var a;return a=q(),o(a)||t(a),Z.createIdentifier(a.value)}function F(){return u("."),E()}function G(){var a;return u("["),a=bb(),u("]"),a}function H(){var a,b,c;for(a=C();;)if(v("["))c=G(),a=Z.createMemberExpression("[",a,c);else if(v("."))c=F(),a=Z.createMemberExpression(".",a,c);else{if(!v("("))break;b=D(),a=Z.createCallExpression(a,b)}return a}function I(){var a,b;return $.type!==S.Punctuator&&$.type!==S.Keyword?b=ab():v("+")||v("-")||v("!")?(a=q(),b=I(),b=Z.createUnaryExpression(a.value,b)):w("delete")||w("void")||w("typeof")?s({},V.UnexpectedToken):b=ab(),b}function J(a){var b=0;if(a.type!==S.Punctuator&&a.type!==S.Keyword)return 0;switch(a.value){case"||":b=1;break;case"&&":b=2;break;case"==":case"!=":case"===":case"!==":b=6;break;case"<":case">":case"<=":case">=":case"instanceof":b=7;break;case"in":b=7;break;case"+":case"-":b=9;break;case"*":case"/":case"%":b=11}return b}function K(){var a,b,c,d,e,f,g,h;if(g=I(),b=$,c=J(b),0===c)return g;for(b.prec=c,q(),e=I(),d=[g,b,e];(c=J($))>0;){for(;d.length>2&&c<=d[d.length-2].prec;)e=d.pop(),f=d.pop().value,g=d.pop(),a=Z.createBinaryExpression(f,g,e),d.push(a);b=q(),b.prec=c,d.push(b),a=I(),d.push(a)}for(h=d.length-1,a=d[h];h>1;)a=Z.createBinaryExpression(d[h-1].value,d[h-2],a),h-=2;return a}function L(){var a,b,c;return a=K(),v("?")&&(q(),b=L(),u(":"),c=L(),a=Z.createConditionalExpression(a,b,c)),a}function M(){var a,b;return a=q(),a.type!==S.Identifier&&t(a),b=v("(")?D():[],Z.createFilter(a.value,b)}function N(){for(;v("|");)q(),M()}function O(){i(),r();var a=bb();a&&(","===$.value||"in"==$.value&&a.type===U.Identifier?Q(a):(N(),"as"===$.value?P(a):Z.createTopLevel(a))),$.type!==S.EOF&&t($)}function P(a){q();var b=q().value;Z.createAsExpression(a,b)}function Q(a){var b;","===$.value&&(q(),$.type!==S.Identifier&&t($),b=q().value),q();var c=bb();N(),Z.createInExpression(a.name,b,c)}function R(a,b){return Z=b,W=a,X=0,Y=W.length,$=null,_={labelSet:{}},O()}var S,T,U,V,W,X,Y,Z,$,_;S={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8},T={},T[S.BooleanLiteral]="Boolean",T[S.EOF]="<end>",T[S.Identifier]="Identifier",T[S.Keyword]="Keyword",T[S.NullLiteral]="Null",T[S.NumericLiteral]="Numeric",T[S.Punctuator]="Punctuator",T[S.StringLiteral]="String",U={ArrayExpression:"ArrayExpression",BinaryExpression:"BinaryExpression",CallExpression:"CallExpression",ConditionalExpression:"ConditionalExpression",EmptyStatement:"EmptyStatement",ExpressionStatement:"ExpressionStatement",Identifier:"Identifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",ObjectExpression:"ObjectExpression",Program:"Program",Property:"Property",ThisExpression:"ThisExpression",UnaryExpression:"UnaryExpression"},V={UnexpectedToken:"Unexpected token %0",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared"};
-var ab=H,bb=L;a.esprima={parse:R}}(this),function(a){"use strict";function b(a,b,d,e){var f;try{if(f=c(a),f.scopeIdent&&(d.nodeType!==Node.ELEMENT_NODE||"TEMPLATE"!==d.tagName||"bind"!==b&&"repeat"!==b))throw Error("as and in can only be used within <template bind/repeat>")}catch(g){return void console.error("Invalid expression syntax: "+a,g)}return function(a,b,c){var d=f.getBinding(a,e,c);return f.scopeIdent&&d&&(b.polymerExpressionScopeIdent_=f.scopeIdent,f.indexIdent&&(b.polymerExpressionIndexIdent_=f.indexIdent)),d}}function c(a){var b=q[a];if(!b){var c=new j;esprima.parse(a,c),b=new l(c),q[a]=b}return b}function d(a){this.value=a,this.valueFn_=void 0}function e(a){this.name=a,this.path=Path.get(a)}function f(a,b,c){this.computed="["==c,this.dynamicDeps="function"==typeof a||a.dynamicDeps||this.computed&&!(b instanceof d),this.simplePath=!this.dynamicDeps&&(b instanceof e||b instanceof d)&&(a instanceof f||a instanceof e),this.object=this.simplePath?a:i(a),this.property=!this.computed||this.simplePath?b:i(b)}function g(a,b){this.name=a,this.args=[];for(var c=0;c<b.length;c++)this.args[c]=i(b[c])}function h(){throw Error("Not Implemented")}function i(a){return"function"==typeof a?a:a.valueFn()}function j(){this.expression=null,this.filters=[],this.deps={},this.currentPath=void 0,this.scopeIdent=void 0,this.indexIdent=void 0,this.dynamicDeps=!1}function k(a){this.value_=a}function l(a){if(this.scopeIdent=a.scopeIdent,this.indexIdent=a.indexIdent,!a.expression)throw Error("No expression found.");this.expression=a.expression,i(this.expression),this.filters=a.filters,this.dynamicDeps=a.dynamicDeps}function m(a){return String(a).replace(/[A-Z]/g,function(a){return"-"+a.toLowerCase()})}function n(a,b){for(;a[t]&&!Object.prototype.hasOwnProperty.call(a,b);)a=a[t];return a}function o(a){switch(a){case"":return!1;case"false":case"null":case"true":return!0}return isNaN(Number(a))?!1:!0}function p(){}var q=Object.create(null);d.prototype={valueFn:function(){if(!this.valueFn_){var a=this.value;this.valueFn_=function(){return a}}return this.valueFn_}},e.prototype={valueFn:function(){if(!this.valueFn_){var a=(this.name,this.path);this.valueFn_=function(b,c){return c&&c.addPath(b,a),a.getValueFrom(b)}}return this.valueFn_},setValue:function(a,b){return 1==this.path.length&&(a=n(a,this.path[0])),this.path.setValueFrom(a,b)}},f.prototype={get fullPath(){if(!this.fullPath_){var a=this.object instanceof f?this.object.fullPath.slice():[this.object.name];a.push(this.property instanceof e?this.property.name:this.property.value),this.fullPath_=Path.get(a)}return this.fullPath_},valueFn:function(){if(!this.valueFn_){var a=this.object;if(this.simplePath){var b=this.fullPath;this.valueFn_=function(a,c){return c&&c.addPath(a,b),b.getValueFrom(a)}}else if(this.computed){var c=this.property;this.valueFn_=function(b,d,e){var f=a(b,d,e),g=c(b,d,e);return d&&d.addPath(f,[g]),f?f[g]:void 0}}else{var b=Path.get(this.property.name);this.valueFn_=function(c,d,e){var f=a(c,d,e);return d&&d.addPath(f,b),b.getValueFrom(f)}}}return this.valueFn_},setValue:function(a,b){if(this.simplePath)return this.fullPath.setValueFrom(a,b),b;var c=this.object(a),d=this.property instanceof e?this.property.name:this.property(a);return c[d]=b}},g.prototype={transform:function(a,b,c,d,e){var f=a,g=f[this.name];if(!g&&(g=c[this.name],!g))return void console.error("Cannot find function or filter: "+this.name);if(d?g=g.toModel:"function"==typeof g.toDOM&&(g=g.toDOM),"function"!=typeof g)return void console.error("Cannot find function or filter: "+this.name);for(var h=e||[],j=0;j<this.args.length;j++)h.push(i(this.args[j])(a,b,c));return g.apply(f,h)}};var r={"+":function(a){return+a},"-":function(a){return-a},"!":function(a){return!a}},s={"+":function(a,b){return a+b},"-":function(a,b){return a-b},"*":function(a,b){return a*b},"/":function(a,b){return a/b},"%":function(a,b){return a%b},"<":function(a,b){return b>a},">":function(a,b){return a>b},"<=":function(a,b){return b>=a},">=":function(a,b){return a>=b},"==":function(a,b){return a==b},"!=":function(a,b){return a!=b},"===":function(a,b){return a===b},"!==":function(a,b){return a!==b},"&&":function(a,b){return a&&b},"||":function(a,b){return a||b}};j.prototype={createUnaryExpression:function(a,b){if(!r[a])throw Error("Disallowed operator: "+a);return b=i(b),function(c,d,e){return r[a](b(c,d,e))}},createBinaryExpression:function(a,b,c){if(!s[a])throw Error("Disallowed operator: "+a);switch(b=i(b),c=i(c),a){case"||":return this.dynamicDeps=!0,function(a,d,e){return b(a,d,e)||c(a,d,e)};case"&&":return this.dynamicDeps=!0,function(a,d,e){return b(a,d,e)&&c(a,d,e)}}return function(d,e,f){return s[a](b(d,e,f),c(d,e,f))}},createConditionalExpression:function(a,b,c){return a=i(a),b=i(b),c=i(c),this.dynamicDeps=!0,function(d,e,f){return a(d,e,f)?b(d,e,f):c(d,e,f)}},createIdentifier:function(a){var b=new e(a);return b.type="Identifier",b},createMemberExpression:function(a,b,c){var d=new f(b,c,a);return d.dynamicDeps&&(this.dynamicDeps=!0),d},createCallExpression:function(a,b){if(!(a instanceof e))throw Error("Only identifier function invocations are allowed");var c=new g(a.name,b);return function(a,b,d){return c.transform(a,b,d,!1)}},createLiteral:function(a){return new d(a.value)},createArrayExpression:function(a){for(var b=0;b<a.length;b++)a[b]=i(a[b]);return function(b,c,d){for(var e=[],f=0;f<a.length;f++)e.push(a[f](b,c,d));return e}},createProperty:function(a,b,c){return{key:b instanceof e?b.name:b.value,value:c}},createObjectExpression:function(a){for(var b=0;b<a.length;b++)a[b].value=i(a[b].value);return function(b,c,d){for(var e={},f=0;f<a.length;f++)e[a[f].key]=a[f].value(b,c,d);return e}},createFilter:function(a,b){this.filters.push(new g(a,b))},createAsExpression:function(a,b){this.expression=a,this.scopeIdent=b},createInExpression:function(a,b,c){this.expression=c,this.scopeIdent=a,this.indexIdent=b},createTopLevel:function(a){this.expression=a},createThisExpression:h},k.prototype={open:function(){return this.value_},discardChanges:function(){return this.value_},deliver:function(){},close:function(){}},l.prototype={getBinding:function(a,b,c){function d(){if(h)return h=!1,g;i.dynamicDeps&&f.startReset();var c=i.getValue(a,i.dynamicDeps?f:void 0,b);return i.dynamicDeps&&f.finishReset(),c}function e(c){return i.setValue(a,c,b),c}if(c)return this.getValue(a,void 0,b);var f=new CompoundObserver,g=this.getValue(a,f,b),h=!0,i=this;return new ObserverTransform(f,d,e,!0)},getValue:function(a,b,c){for(var d=i(this.expression)(a,b,c),e=0;e<this.filters.length;e++)d=this.filters[e].transform(a,b,c,!1,[d]);return d},setValue:function(a,b,c){for(var d=this.filters?this.filters.length:0;d-->0;)b=this.filters[d].transform(a,void 0,c,!0,[b]);return this.expression.setValue?this.expression.setValue(a,b):void 0}};var t="@"+Math.random().toString(36).slice(2);p.prototype={styleObject:function(a){var b=[];for(var c in a)b.push(m(c)+": "+a[c]);return b.join("; ")},tokenList:function(a){var b=[];for(var c in a)a[c]&&b.push(c);return b.join(" ")},prepareInstancePositionChanged:function(a){var b=a.polymerExpressionIndexIdent_;if(b)return function(a,c){a.model[b]=c}},prepareBinding:function(a,c,d){var e=Path.get(a);{if(o(a)||!e.valid)return b(a,c,d,this);if(1==e.length)return function(a,b,c){if(c)return e.getValueFrom(a);var d=n(a,e[0]);return new PathObserver(d,e)}}},prepareInstanceModel:function(a){var b=a.polymerExpressionScopeIdent_;if(b){var c=a.templateInstance?a.templateInstance.model:a.model,d=a.polymerExpressionIndexIdent_;return function(a){return u(c,a,b,d)}}}};var u="__proto__"in{}?function(a,b,c,d){var e={};return e[c]=b,e[d]=void 0,e[t]=a,e.__proto__=a,e}:function(a,b,c,d){var e=Object.create(a);return Object.defineProperty(e,c,{value:b,configurable:!0,writable:!0}),Object.defineProperty(e,d,{value:void 0,configurable:!0,writable:!0}),Object.defineProperty(e,t,{value:a,configurable:!0,writable:!0}),e};a.PolymerExpressions=p,p.getExpression=c}(this),Polymer={version:"0.5.5"},"function"==typeof window.Polymer&&(Polymer={}),function(a){function b(a,b){return b=b||[],b.map||(b=[b]),a.apply(this,b.map(d))}function c(a,c,d){var e;switch(arguments.length){case 0:return;case 1:e=null;break;case 2:e=c.apply(this);break;default:e=b(d,c)}f[a]=e}function d(a){return f[a]}function e(a,c){HTMLImports.whenImportsReady(function(){b(c,a)})}var f={};a.marshal=d,a.modularize=c,a.using=e}(window),window.WebComponents||(window.WebComponents||(WebComponents={flush:function(){},flags:{log:{}}},Platform=WebComponents,CustomElements={useNative:!0,ready:!0,takeRecords:function(){},"instanceof":function(a,b){return a instanceof b}},HTMLImports={useNative:!0},addEventListener("HTMLImportsLoaded",function(){document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))}),ShadowDOMPolyfill=null,wrap=unwrap=function(a){return a}),window.HTMLImports=window.HTMLImports||{flags:{}},function(a){function b(a,b){b=b||o,d(function(){f(a,b)},b)}function c(a){return"complete"===a.readyState||a.readyState===r}function d(a,b){if(c(b))a&&a();else{var e=function(){("complete"===b.readyState||b.readyState===r)&&(b.removeEventListener(s,e),d(a,b))};b.addEventListener(s,e)}}function e(a){a.target.__loaded=!0}function f(a,b){function c(){h==i&&a&&a()}function d(a){e(a),h++,c()}var f=b.querySelectorAll("link[rel=import]"),h=0,i=f.length;if(i)for(var j,k=0;i>k&&(j=f[k]);k++)g(j)?d.call(j,{target:j}):(j.addEventListener("load",d),j.addEventListener("error",d));else c()}function g(a){return l?a.__loaded||a["import"]&&"loading"!==a["import"].readyState:a.__importParsed}function h(a){for(var b,c=0,d=a.length;d>c&&(b=a[c]);c++)i(b)&&j(b)}function i(a){return"link"===a.localName&&"import"===a.rel}function j(a){var b=a["import"];b?e({target:a}):(a.addEventListener("load",e),a.addEventListener("error",e))}var k="import",l=Boolean(k in document.createElement("link")),m=Boolean(window.ShadowDOMPolyfill),n=function(a){return m?ShadowDOMPolyfill.wrapIfNeeded(a):a},o=n(document),p={get:function(){var a=HTMLImports.currentScript||document.currentScript||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null);return n(a)},configurable:!0};Object.defineProperty(document,"_currentScript",p),Object.defineProperty(o,"_currentScript",p);var q=/Trident/.test(navigator.userAgent),r=q?"complete":"interactive",s="readystatechange";l&&(new MutationObserver(function(a){for(var b,c=0,d=a.length;d>c&&(b=a[c]);c++)b.addedNodes&&h(b.addedNodes)}).observe(document.head,{childList:!0}),function(){if("loading"===document.readyState)for(var a,b=document.querySelectorAll("link[rel=import]"),c=0,d=b.length;d>c&&(a=b[c]);c++)j(a)}()),b(function(){HTMLImports.ready=!0,HTMLImports.readyTime=(new Date).getTime(),o.dispatchEvent(new CustomEvent("HTMLImportsLoaded",{bubbles:!0}))}),a.IMPORT_LINK_TYPE=k,a.useNative=l,a.rootDocument=o,a.whenReady=b,a.isIE=q}(HTMLImports),function(){var a=document.createElement("style");a.textContent="body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; } \n";var b=document.querySelector("head");b.insertBefore(a,b.firstChild)}(Platform)),function(a){"use strict";function b(){function a(a){b=a}if("function"!=typeof Object.observe||"function"!=typeof Array.observe)return!1;var b=[],c={},d=[];return Object.observe(c,a),Array.observe(d,a),c.id=1,c.id=2,delete c.id,d.push(1,2),d.length=0,Object.deliverChangeRecords(a),5!==b.length?!1:"add"!=b[0].type||"update"!=b[1].type||"delete"!=b[2].type||"splice"!=b[3].type||"splice"!=b[4].type?!1:(Object.unobserve(c,a),Array.unobserve(d,a),!0)}function c(){if("undefined"!=typeof chrome&&chrome.app&&chrome.app.runtime)return!1;if("undefined"!=typeof navigator&&navigator.getDeviceStorage)return!1;try{var a=new Function("","return true;");return a()}catch(b){return!1}}function d(a){return+a===a>>>0&&""!==a}function e(a){return+a}function f(a){return a===Object(a)}function g(a,b){return a===b?0!==a||1/a===1/b:R(a)&&R(b)?!0:a!==a&&b!==b}function h(a){if(void 0===a)return"eof";var b=a.charCodeAt(0);switch(b){case 91:case 93:case 46:case 34:case 39:case 48:return a;case 95:case 36:return"ident";case 32:case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"ws"}return b>=97&&122>=b||b>=65&&90>=b?"ident":b>=49&&57>=b?"number":"else"}function i(){}function j(a){function b(){if(!(m>=a.length)){var b=a[m+1];return"inSingleQuote"==n&&"'"==b||"inDoubleQuote"==n&&'"'==b?(m++,d=b,o.append(),!0):void 0}}for(var c,d,e,f,g,j,k,l=[],m=-1,n="beforePath",o={push:function(){void 0!==e&&(l.push(e),e=void 0)},append:function(){void 0===e?e=d:e+=d}};n;)if(m++,c=a[m],"\\"!=c||!b(n)){if(f=h(c),k=W[n],g=k[f]||k["else"]||"error","error"==g)return;if(n=g[0],j=o[g[1]]||i,d=void 0===g[2]?c:g[2],j(),"afterPath"===n)return l}}function k(a){return V.test(a)}function l(a,b){if(b!==X)throw Error("Use Path.get to retrieve path objects");for(var c=0;c<a.length;c++)this.push(String(a[c]));Q&&this.length&&(this.getValueFrom=this.compiledGetValueFromFn())}function m(a){if(a instanceof l)return a;if((null==a||0==a.length)&&(a=""),"string"!=typeof a){if(d(a.length))return new l(a,X);a=String(a)}var b=Y[a];if(b)return b;var c=j(a);if(!c)return Z;var b=new l(c,X);return Y[a]=b,b}function n(a){return d(a)?"["+a+"]":'["'+a.replace(/"/g,'\\"')+'"]'}function o(b){for(var c=0;_>c&&b.check_();)c++;return O&&(a.dirtyCheckCycleCount=c),c>0}function p(a){for(var b in a)return!1;return!0}function q(a){return p(a.added)&&p(a.removed)&&p(a.changed)}function r(a,b){var c={},d={},e={};for(var f in b){var g=a[f];(void 0===g||g!==b[f])&&(f in a?g!==b[f]&&(e[f]=g):d[f]=void 0)}for(var f in a)f in b||(c[f]=a[f]);return Array.isArray(a)&&a.length!==b.length&&(e.length=a.length),{added:c,removed:d,changed:e}}function s(){if(!ab.length)return!1;for(var a=0;a<ab.length;a++)ab[a]();return ab.length=0,!0}function t(){function a(a){b&&b.state_===fb&&!d&&b.check_(a)}var b,c,d=!1,e=!0;return{open:function(c){if(b)throw Error("ObservedObject in use");e||Object.deliverChangeRecords(a),b=c,e=!1},observe:function(b,d){c=b,d?Array.observe(c,a):Object.observe(c,a)},deliver:function(b){d=b,Object.deliverChangeRecords(a),d=!1},close:function(){b=void 0,Object.unobserve(c,a),cb.push(this)}}}function u(a,b,c){var d=cb.pop()||t();return d.open(a),d.observe(b,c),d}function v(){function a(b,f){b&&(b===d&&(e[f]=!0),h.indexOf(b)<0&&(h.push(b),Object.observe(b,c)),a(Object.getPrototypeOf(b),f))}function b(a){for(var b=0;b<a.length;b++){var c=a[b];if(c.object!==d||e[c.name]||"setPrototype"===c.type)return!1}return!0}function c(c){if(!b(c)){for(var d,e=0;e<g.length;e++)d=g[e],d.state_==fb&&d.iterateObjects_(a);for(var e=0;e<g.length;e++)d=g[e],d.state_==fb&&d.check_()}}var d,e,f=0,g=[],h=[],i={objects:h,get rootObject(){return d},set rootObject(a){d=a,e={}},open:function(b){g.push(b),f++,b.iterateObjects_(a)},close:function(){if(f--,!(f>0)){for(var a=0;a<h.length;a++)Object.unobserve(h[a],c),x.unobservedCount++;g.length=0,h.length=0,d=void 0,e=void 0,db.push(this),$===this&&($=null)}}};return i}function w(a,b){return $&&$.rootObject===b||($=db.pop()||v(),$.rootObject=b),$.open(a,b),$}function x(){this.state_=eb,this.callback_=void 0,this.target_=void 0,this.directObserver_=void 0,this.value_=void 0,this.id_=ib++}function y(a){x._allObserversCount++,kb&&jb.push(a)}function z(){x._allObserversCount--}function A(a){x.call(this),this.value_=a,this.oldObject_=void 0}function B(a){if(!Array.isArray(a))throw Error("Provided object is not an Array");A.call(this,a)}function C(a,b){x.call(this),this.object_=a,this.path_=m(b),this.directObserver_=void 0}function D(a){x.call(this),this.reportChangesOnOpen_=a,this.value_=[],this.directObserver_=void 0,this.observed_=[]}function E(a){return a}function F(a,b,c,d){this.callback_=void 0,this.target_=void 0,this.value_=void 0,this.observable_=a,this.getValueFn_=b||E,this.setValueFn_=c||E,this.dontPassThroughSet_=d}function G(a,b,c){for(var d={},e={},f=0;f<b.length;f++){var g=b[f];nb[g.type]?(g.name in c||(c[g.name]=g.oldValue),"update"!=g.type&&("add"!=g.type?g.name in d?(delete d[g.name],delete c[g.name]):e[g.name]=!0:g.name in e?delete e[g.name]:d[g.name]=!0)):(console.error("Unknown changeRecord type: "+g.type),console.error(g))}for(var h in d)d[h]=a[h];for(var h in e)e[h]=void 0;var i={};for(var h in c)if(!(h in d||h in e)){var j=a[h];c[h]!==j&&(i[h]=j)}return{added:d,removed:e,changed:i}}function H(a,b,c){return{index:a,removed:b,addedCount:c}}function I(){}function J(a,b,c,d,e,f){return sb.calcSplices(a,b,c,d,e,f)}function K(a,b,c,d){return c>b||a>d?-1:b==c||d==a?0:c>a?d>b?b-c:d-c:b>d?d-a:b-a}function L(a,b,c,d){for(var e=H(b,c,d),f=!1,g=0,h=0;h<a.length;h++){var i=a[h];if(i.index+=g,!f){var j=K(e.index,e.index+e.removed.length,i.index,i.index+i.addedCount);if(j>=0){a.splice(h,1),h--,g-=i.addedCount-i.removed.length,e.addedCount+=i.addedCount-j;var k=e.removed.length+i.removed.length-j;if(e.addedCount||k){var c=i.removed;if(e.index<i.index){var l=e.removed.slice(0,i.index-e.index);Array.prototype.push.apply(l,c),c=l}if(e.index+e.removed.length>i.index+i.addedCount){var m=e.removed.slice(i.index+i.addedCount-e.index);Array.prototype.push.apply(c,m)}e.removed=c,i.index<e.index&&(e.index=i.index)}else f=!0}else if(e.index<i.index){f=!0,a.splice(h,0,e),h++;var n=e.addedCount-e.removed.length;i.index+=n,g+=n}}}f||a.push(e)}function M(a,b){for(var c=[],f=0;f<b.length;f++){var g=b[f];switch(g.type){case"splice":L(c,g.index,g.removed.slice(),g.addedCount);break;case"add":case"update":case"delete":if(!d(g.name))continue;var h=e(g.name);if(0>h)continue;L(c,h,[g.oldValue],1);break;default:console.error("Unexpected record type: "+JSON.stringify(g))}}return c}function N(a,b){var c=[];return M(a,b).forEach(function(b){return 1==b.addedCount&&1==b.removed.length?void(b.removed[0]!==a[b.index]&&c.push(b)):void(c=c.concat(J(a,b.index,b.index+b.addedCount,b.removed,0,b.removed.length)))}),c}var O=a.testingExposeCycleCount,P=b(),Q=c(),R=a.Number.isNaN||function(b){return"number"==typeof b&&a.isNaN(b)},S="__proto__"in{}?function(a){return a}:function(a){var b=a.__proto__;if(!b)return a;var c=Object.create(b);return Object.getOwnPropertyNames(a).forEach(function(b){Object.defineProperty(c,b,Object.getOwnPropertyDescriptor(a,b))}),c},T="[$_a-zA-Z]",U="[$_a-zA-Z0-9]",V=new RegExp("^"+T+"+"+U+"*$"),W={beforePath:{ws:["beforePath"],ident:["inIdent","append"],"[":["beforeElement"],eof:["afterPath"]},inPath:{ws:["inPath"],".":["beforeIdent"],"[":["beforeElement"],eof:["afterPath"]},beforeIdent:{ws:["beforeIdent"],ident:["inIdent","append"]},inIdent:{ident:["inIdent","append"],0:["inIdent","append"],number:["inIdent","append"],ws:["inPath","push"],".":["beforeIdent","push"],"[":["beforeElement","push"],eof:["afterPath","push"]},beforeElement:{ws:["beforeElement"],0:["afterZero","append"],number:["inIndex","append"],"'":["inSingleQuote","append",""],'"':["inDoubleQuote","append",""]},afterZero:{ws:["afterElement","push"],"]":["inPath","push"]},inIndex:{0:["inIndex","append"],number:["inIndex","append"],ws:["afterElement"],"]":["inPath","push"]},inSingleQuote:{"'":["afterElement"],eof:["error"],"else":["inSingleQuote","append"]},inDoubleQuote:{'"':["afterElement"],eof:["error"],"else":["inDoubleQuote","append"]},afterElement:{ws:["afterElement"],"]":["inPath","push"]}},X={},Y={};l.get=m,l.prototype=S({__proto__:[],valid:!0,toString:function(){for(var a="",b=0;b<this.length;b++){var c=this[b];a+=k(c)?b?"."+c:c:n(c)}return a},getValueFrom:function(a){for(var b=0;b<this.length;b++){if(null==a)return;a=a[this[b]]}return a},iterateObjects:function(a,b){for(var c=0;c<this.length;c++){if(c&&(a=a[this[c-1]]),!f(a))return;b(a,this[c])}},compiledGetValueFromFn:function(){var a="",b="obj";a+="if (obj != null";for(var c,d=0;d<this.length-1;d++)c=this[d],b+=k(c)?"."+c:n(c),a+=" &&\n "+b+" != null";a+=")\n";var c=this[d];return b+=k(c)?"."+c:n(c),a+=" return "+b+";\nelse\n return undefined;",new Function("obj",a)},setValueFrom:function(a,b){if(!this.length)return!1;for(var c=0;c<this.length-1;c++){if(!f(a))return!1;a=a[this[c]]}return f(a)?(a[this[c]]=b,!0):!1}});var Z=new l("",X);Z.valid=!1,Z.getValueFrom=Z.setValueFrom=function(){};var $,_=1e3,ab=[],bb=P?function(){return function(a){return Promise.resolve().then(a)}}():function(){return function(a){ab.push(a)}}(),cb=[],db=[],eb=0,fb=1,gb=2,hb=3,ib=1;x.prototype={open:function(a,b){if(this.state_!=eb)throw Error("Observer has already been opened.");return y(this),this.callback_=a,this.target_=b,this.connect_(),this.state_=fb,this.value_},close:function(){this.state_==fb&&(z(this),this.disconnect_(),this.value_=void 0,this.callback_=void 0,this.target_=void 0,this.state_=gb)},deliver:function(){this.state_==fb&&o(this)},report_:function(a){try{this.callback_.apply(this.target_,a)}catch(b){x._errorThrownDuringCallback=!0,console.error("Exception caught during observer callback: "+(b.stack||b))}},discardChanges:function(){return this.check_(void 0,!0),this.value_}};var jb,kb=!P;x._allObserversCount=0,kb&&(jb=[]);var lb=!1;a.Platform=a.Platform||{},a.Platform.performMicrotaskCheckpoint=function(){if(!lb&&kb){lb=!0;var b,c,d=0;do{d++,c=jb,jb=[],b=!1;for(var e=0;e<c.length;e++){var f=c[e];f.state_==fb&&(f.check_()&&(b=!0),jb.push(f))}s()&&(b=!0)}while(_>d&&b);O&&(a.dirtyCheckCycleCount=d),lb=!1}},kb&&(a.Platform.clearObservers=function(){jb=[]}),A.prototype=S({__proto__:x.prototype,arrayObserve:!1,connect_:function(){P?this.directObserver_=u(this,this.value_,this.arrayObserve):this.oldObject_=this.copyObject(this.value_)},copyObject:function(a){var b=Array.isArray(a)?[]:{};for(var c in a)b[c]=a[c];return Array.isArray(a)&&(b.length=a.length),b},check_:function(a){var b,c;if(P){if(!a)return!1;c={},b=G(this.value_,a,c)}else c=this.oldObject_,b=r(this.value_,this.oldObject_);return q(b)?!1:(P||(this.oldObject_=this.copyObject(this.value_)),this.report_([b.added||{},b.removed||{},b.changed||{},function(a){return c[a]}]),!0)},disconnect_:function(){P?(this.directObserver_.close(),this.directObserver_=void 0):this.oldObject_=void 0},deliver:function(){this.state_==fb&&(P?this.directObserver_.deliver(!1):o(this))},discardChanges:function(){return this.directObserver_?this.directObserver_.deliver(!0):this.oldObject_=this.copyObject(this.value_),this.value_}}),B.prototype=S({__proto__:A.prototype,arrayObserve:!0,copyObject:function(a){return a.slice()},check_:function(a){var b;if(P){if(!a)return!1;b=N(this.value_,a)}else b=J(this.value_,0,this.value_.length,this.oldObject_,0,this.oldObject_.length);return b&&b.length?(P||(this.oldObject_=this.copyObject(this.value_)),this.report_([b]),!0):!1}}),B.applySplices=function(a,b,c){c.forEach(function(c){for(var d=[c.index,c.removed.length],e=c.index;e<c.index+c.addedCount;)d.push(b[e]),e++;Array.prototype.splice.apply(a,d)})},C.prototype=S({__proto__:x.prototype,get path(){return this.path_},connect_:function(){P&&(this.directObserver_=w(this,this.object_)),this.check_(void 0,!0)},disconnect_:function(){this.value_=void 0,this.directObserver_&&(this.directObserver_.close(this),this.directObserver_=void 0)},iterateObjects_:function(a){this.path_.iterateObjects(this.object_,a)},check_:function(a,b){var c=this.value_;return this.value_=this.path_.getValueFrom(this.object_),b||g(this.value_,c)?!1:(this.report_([this.value_,c,this]),!0)},setValue:function(a){this.path_&&this.path_.setValueFrom(this.object_,a)}});var mb={};D.prototype=S({__proto__:x.prototype,connect_:function(){if(P){for(var a,b=!1,c=0;c<this.observed_.length;c+=2)if(a=this.observed_[c],a!==mb){b=!0;break}b&&(this.directObserver_=w(this,a))}this.check_(void 0,!this.reportChangesOnOpen_)},disconnect_:function(){for(var a=0;a<this.observed_.length;a+=2)this.observed_[a]===mb&&this.observed_[a+1].close();this.observed_.length=0,this.value_.length=0,this.directObserver_&&(this.directObserver_.close(this),this.directObserver_=void 0)},addPath:function(a,b){if(this.state_!=eb&&this.state_!=hb)throw Error("Cannot add paths once started.");var b=m(b);if(this.observed_.push(a,b),this.reportChangesOnOpen_){var c=this.observed_.length/2-1;this.value_[c]=b.getValueFrom(a)}},addObserver:function(a){if(this.state_!=eb&&this.state_!=hb)throw Error("Cannot add observers once started.");if(this.observed_.push(mb,a),this.reportChangesOnOpen_){var b=this.observed_.length/2-1;this.value_[b]=a.open(this.deliver,this)}},startReset:function(){if(this.state_!=fb)throw Error("Can only reset while open");this.state_=hb,this.disconnect_()},finishReset:function(){if(this.state_!=hb)throw Error("Can only finishReset after startReset");return this.state_=fb,this.connect_(),this.value_},iterateObjects_:function(a){for(var b,c=0;c<this.observed_.length;c+=2)b=this.observed_[c],b!==mb&&this.observed_[c+1].iterateObjects(b,a)},check_:function(a,b){for(var c,d=0;d<this.observed_.length;d+=2){var e,f=this.observed_[d],h=this.observed_[d+1];if(f===mb){var i=h;e=this.state_===eb?i.open(this.deliver,this):i.discardChanges()}else e=h.getValueFrom(f);b?this.value_[d/2]=e:g(e,this.value_[d/2])||(c=c||[],c[d/2]=this.value_[d/2],this.value_[d/2]=e)}return c?(this.report_([this.value_,c,this.observed_]),!0):!1}}),F.prototype={open:function(a,b){return this.callback_=a,this.target_=b,this.value_=this.getValueFn_(this.observable_.open(this.observedCallback_,this)),this.value_},observedCallback_:function(a){if(a=this.getValueFn_(a),!g(a,this.value_)){var b=this.value_;this.value_=a,this.callback_.call(this.target_,this.value_,b)}},discardChanges:function(){return this.value_=this.getValueFn_(this.observable_.discardChanges()),this.value_},deliver:function(){return this.observable_.deliver()},setValue:function(a){return a=this.setValueFn_(a),!this.dontPassThroughSet_&&this.observable_.setValue?this.observable_.setValue(a):void 0},close:function(){this.observable_&&this.observable_.close(),this.callback_=void 0,this.target_=void 0,this.observable_=void 0,this.value_=void 0,this.getValueFn_=void 0,this.setValueFn_=void 0}};var nb={add:!0,update:!0,"delete":!0},ob=0,pb=1,qb=2,rb=3;I.prototype={calcEditDistances:function(a,b,c,d,e,f){for(var g=f-e+1,h=c-b+1,i=new Array(g),j=0;g>j;j++)i[j]=new Array(h),i[j][0]=j;for(var k=0;h>k;k++)i[0][k]=k;for(var j=1;g>j;j++)for(var k=1;h>k;k++)if(this.equals(a[b+k-1],d[e+j-1]))i[j][k]=i[j-1][k-1];else{var l=i[j-1][k]+1,m=i[j][k-1]+1;i[j][k]=m>l?l:m}return i},spliceOperationsFromEditDistances:function(a){for(var b=a.length-1,c=a[0].length-1,d=a[b][c],e=[];b>0||c>0;)if(0!=b)if(0!=c){var f,g=a[b-1][c-1],h=a[b-1][c],i=a[b][c-1];f=i>h?g>h?h:g:g>i?i:g,f==g?(g==d?e.push(ob):(e.push(pb),d=g),b--,c--):f==h?(e.push(rb),b--,d=h):(e.push(qb),c--,d=i)}else e.push(rb),b--;else e.push(qb),c--;return e.reverse(),e},calcSplices:function(a,b,c,d,e,f){var g=0,h=0,i=Math.min(c-b,f-e);if(0==b&&0==e&&(g=this.sharedPrefix(a,d,i)),c==a.length&&f==d.length&&(h=this.sharedSuffix(a,d,i-g)),b+=g,e+=g,c-=h,f-=h,c-b==0&&f-e==0)return[];if(b==c){for(var j=H(b,[],0);f>e;)j.removed.push(d[e++]);return[j]}if(e==f)return[H(b,[],c-b)];for(var k=this.spliceOperationsFromEditDistances(this.calcEditDistances(a,b,c,d,e,f)),j=void 0,l=[],m=b,n=e,o=0;o<k.length;o++)switch(k[o]){case ob:j&&(l.push(j),j=void 0),m++,n++;break;case pb:j||(j=H(m,[],0)),j.addedCount++,m++,j.removed.push(d[n]),n++;break;case qb:j||(j=H(m,[],0)),j.addedCount++,m++;break;case rb:j||(j=H(m,[],0)),j.removed.push(d[n]),n++}return j&&l.push(j),l},sharedPrefix:function(a,b,c){for(var d=0;c>d;d++)if(!this.equals(a[d],b[d]))return d;return c},sharedSuffix:function(a,b,c){for(var d=a.length,e=b.length,f=0;c>f&&this.equals(a[--d],b[--e]);)f++;return f},calculateSplices:function(a,b){return this.calcSplices(a,0,a.length,b,0,b.length)},equals:function(a,b){return a===b}};var sb=new I,tb=a;"undefined"==typeof exports||exports.nodeType||("undefined"!=typeof module&&module.exports&&(exports=module.exports),tb=exports),tb.Observer=x,tb.Observer.runEOM_=bb,tb.Observer.observerSentinel_=mb,tb.Observer.hasObjectObserve=P,tb.ArrayObserver=B,tb.ArrayObserver.calculateSplices=function(a,b){return sb.calculateSplices(a,b)},tb.ArraySplice=I,tb.ObjectObserver=A,tb.PathObserver=C,tb.CompoundObserver=D,tb.Path=l,tb.ObserverTransform=F}("undefined"!=typeof global&&global&&"undefined"!=typeof module&&module?global:this||window),function(){"use strict";function a(a){for(;a.parentNode;)a=a.parentNode;return"function"==typeof a.getElementById?a:null}function b(a,b,c){var d=a.bindings_;return d||(d=a.bindings_={}),d[b]&&c[b].close(),d[b]=c}function c(a,b,c){return c}function d(a){return null==a?"":a}function e(a,b){a.data=d(b)}function f(a){return function(b){return e(a,b)}}function g(a,b,c,e){return c?void(e?a.setAttribute(b,""):a.removeAttribute(b)):void a.setAttribute(b,d(e))}function h(a,b,c){return function(d){g(a,b,c,d)}}function i(a){switch(a.type){case"checkbox":return u;case"radio":case"select-multiple":case"select-one":return"change";case"range":if(/Trident|MSIE/.test(navigator.userAgent))return"change";default:return"input"}}function j(a,b,c,e){a[b]=(e||d)(c)}function k(a,b,c){return function(d){return j(a,b,d,c)}}function l(){}function m(a,b,c,d){function e(){var e="value"==b&&"number"==a.type;c.setValue(e?a.valueAsNumber:a[b]),c.discardChanges(),(d||l)(a),Platform.performMicrotaskCheckpoint()}var f=i(a);return a.addEventListener(f,e),{close:function(){a.removeEventListener(f,e),c.close()},observable_:c}}function n(a){return Boolean(a)}function o(b){if(b.form)return s(b.form.elements,function(a){return a!=b&&"INPUT"==a.tagName&&"radio"==a.type&&a.name==b.name});var c=a(b);if(!c)return[];var d=c.querySelectorAll('input[type="radio"][name="'+b.name+'"]');return s(d,function(a){return a!=b&&!a.form})}function p(a){"INPUT"===a.tagName&&"radio"===a.type&&o(a).forEach(function(a){var b=a.bindings_.checked;b&&b.observable_.setValue(!1)})}function q(a,b){var c,e,f,g=a.parentNode;g instanceof HTMLSelectElement&&g.bindings_&&g.bindings_.value&&(c=g,e=c.bindings_.value,f=c.value),a.value=d(b),c&&c.value!=f&&(e.observable_.setValue(c.value),e.observable_.discardChanges(),Platform.performMicrotaskCheckpoint())}function r(a){return function(b){q(a,b)}}var s=Array.prototype.filter.call.bind(Array.prototype.filter);Node.prototype.bind=function(a,b){console.error("Unhandled binding to Node: ",this,a,b)},Node.prototype.bindFinished=function(){};var t=c;Object.defineProperty(Platform,"enableBindingsReflection",{get:function(){return t===b},set:function(a){return t=a?b:c,a},configurable:!0}),Text.prototype.bind=function(a,b,c){if("textContent"!==a)return Node.prototype.bind.call(this,a,b,c);if(c)return e(this,b);var d=b;return e(this,d.open(f(this))),t(this,a,d)},Element.prototype.bind=function(a,b,c){var d="?"==a[a.length-1];if(d&&(this.removeAttribute(a),a=a.slice(0,-1)),c)return g(this,a,d,b);var e=b;return g(this,a,d,e.open(h(this,a,d))),t(this,a,e)};var u;!function(){var a=document.createElement("div"),b=a.appendChild(document.createElement("input"));b.setAttribute("type","checkbox");var c,d=0;b.addEventListener("click",function(){d++,c=c||"click"}),b.addEventListener("change",function(){d++,c=c||"change"});var e=document.createEvent("MouseEvent");e.initMouseEvent("click",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),b.dispatchEvent(e),u=1==d?"change":c}(),HTMLInputElement.prototype.bind=function(a,c,e){if("value"!==a&&"checked"!==a)return HTMLElement.prototype.bind.call(this,a,c,e);this.removeAttribute(a);var f="checked"==a?n:d,g="checked"==a?p:l;if(e)return j(this,a,c,f);var h=c,i=m(this,a,h,g);return j(this,a,h.open(k(this,a,f)),f),b(this,a,i)},HTMLTextAreaElement.prototype.bind=function(a,b,c){if("value"!==a)return HTMLElement.prototype.bind.call(this,a,b,c);if(this.removeAttribute("value"),c)return j(this,"value",b);var e=b,f=m(this,"value",e);return j(this,"value",e.open(k(this,"value",d))),t(this,a,f)},HTMLOptionElement.prototype.bind=function(a,b,c){if("value"!==a)return HTMLElement.prototype.bind.call(this,a,b,c);if(this.removeAttribute("value"),c)return q(this,b);var d=b,e=m(this,"value",d);
-return q(this,d.open(r(this))),t(this,a,e)},HTMLSelectElement.prototype.bind=function(a,c,d){if("selectedindex"===a&&(a="selectedIndex"),"selectedIndex"!==a&&"value"!==a)return HTMLElement.prototype.bind.call(this,a,c,d);if(this.removeAttribute(a),d)return j(this,a,c);var e=c,f=m(this,a,e);return j(this,a,e.open(k(this,a))),b(this,a,f)}}(this),function(a){"use strict";function b(a){if(!a)throw new Error("Assertion failed")}function c(a){for(var b;b=a.parentNode;)a=b;return a}function d(a,b){if(b){for(var d,e="#"+b;!d&&(a=c(a),a.protoContent_?d=a.protoContent_.querySelector(e):a.getElementById&&(d=a.getElementById(b)),!d&&a.templateCreator_);)a=a.templateCreator_;return d}}function e(a){return"template"==a.tagName&&"http://www.w3.org/2000/svg"==a.namespaceURI}function f(a){return"TEMPLATE"==a.tagName&&"http://www.w3.org/1999/xhtml"==a.namespaceURI}function g(a){return Boolean(L[a.tagName]&&a.hasAttribute("template"))}function h(a){return void 0===a.isTemplate_&&(a.isTemplate_="TEMPLATE"==a.tagName||g(a)),a.isTemplate_}function i(a,b){var c=a.querySelectorAll(N);h(a)&&b(a),G(c,b)}function j(a){function b(a){HTMLTemplateElement.decorate(a)||j(a.content)}i(a,b)}function k(a,b){Object.getOwnPropertyNames(b).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(b,c))})}function l(a){var b=a.ownerDocument;if(!b.defaultView)return b;var c=b.templateContentsOwner_;if(!c){for(c=b.implementation.createHTMLDocument("");c.lastChild;)c.removeChild(c.lastChild);b.templateContentsOwner_=c}return c}function m(a){if(!a.stagingDocument_){var b=a.ownerDocument;if(!b.stagingDocument_){b.stagingDocument_=b.implementation.createHTMLDocument(""),b.stagingDocument_.isStagingDocument=!0;var c=b.stagingDocument_.createElement("base");c.href=document.baseURI,b.stagingDocument_.head.appendChild(c),b.stagingDocument_.stagingDocument_=b.stagingDocument_}a.stagingDocument_=b.stagingDocument_}return a.stagingDocument_}function n(a){var b=a.ownerDocument.createElement("template");a.parentNode.insertBefore(b,a);for(var c=a.attributes,d=c.length;d-->0;){var e=c[d];K[e.name]&&("template"!==e.name&&b.setAttribute(e.name,e.value),a.removeAttribute(e.name))}return b}function o(a){var b=a.ownerDocument.createElement("template");a.parentNode.insertBefore(b,a);for(var c=a.attributes,d=c.length;d-->0;){var e=c[d];b.setAttribute(e.name,e.value),a.removeAttribute(e.name)}return a.parentNode.removeChild(a),b}function p(a,b,c){var d=a.content;if(c)return void d.appendChild(b);for(var e;e=b.firstChild;)d.appendChild(e)}function q(a){P?a.__proto__=HTMLTemplateElement.prototype:k(a,HTMLTemplateElement.prototype)}function r(a){a.setModelFn_||(a.setModelFn_=function(){a.setModelFnScheduled_=!1;var b=z(a,a.delegate_&&a.delegate_.prepareBinding);w(a,b,a.model_)}),a.setModelFnScheduled_||(a.setModelFnScheduled_=!0,Observer.runEOM_(a.setModelFn_))}function s(a,b,c,d){if(a&&a.length){for(var e,f=a.length,g=0,h=0,i=0,j=!0;f>h;){var g=a.indexOf("{{",h),k=a.indexOf("[[",h),l=!1,m="}}";if(k>=0&&(0>g||g>k)&&(g=k,l=!0,m="]]"),i=0>g?-1:a.indexOf(m,g+2),0>i){if(!e)return;e.push(a.slice(h));break}e=e||[],e.push(a.slice(h,g));var n=a.slice(g+2,i).trim();e.push(l),j=j&&l;var o=d&&d(n,b,c);e.push(null==o?Path.get(n):null),e.push(o),h=i+2}return h===f&&e.push(""),e.hasOnePath=5===e.length,e.isSimplePath=e.hasOnePath&&""==e[0]&&""==e[4],e.onlyOneTime=j,e.combinator=function(a){for(var b=e[0],c=1;c<e.length;c+=4){var d=e.hasOnePath?a:a[(c-1)/4];void 0!==d&&(b+=d),b+=e[c+3]}return b},e}}function t(a,b,c,d){if(b.hasOnePath){var e=b[3],f=e?e(d,c,!0):b[2].getValueFrom(d);return b.isSimplePath?f:b.combinator(f)}for(var g=[],h=1;h<b.length;h+=4){var e=b[h+2];g[(h-1)/4]=e?e(d,c):b[h+1].getValueFrom(d)}return b.combinator(g)}function u(a,b,c,d){var e=b[3],f=e?e(d,c,!1):new PathObserver(d,b[2]);return b.isSimplePath?f:new ObserverTransform(f,b.combinator)}function v(a,b,c,d){if(b.onlyOneTime)return t(a,b,c,d);if(b.hasOnePath)return u(a,b,c,d);for(var e=new CompoundObserver,f=1;f<b.length;f+=4){var g=b[f],h=b[f+2];if(h){var i=h(d,c,g);g?e.addPath(i):e.addObserver(i)}else{var j=b[f+1];g?e.addPath(j.getValueFrom(d)):e.addPath(d,j)}}return new ObserverTransform(e,b.combinator)}function w(a,b,c,d){for(var e=0;e<b.length;e+=2){var f=b[e],g=b[e+1],h=v(f,g,a,c),i=a.bind(f,h,g.onlyOneTime);i&&d&&d.push(i)}if(a.bindFinished(),b.isTemplate){a.model_=c;var j=a.processBindingDirectives_(b);d&&j&&d.push(j)}}function x(a,b,c){var d=a.getAttribute(b);return s(""==d?"{{}}":d,b,a,c)}function y(a,c){b(a);for(var d=[],e=0;e<a.attributes.length;e++){for(var f=a.attributes[e],g=f.name,i=f.value;"_"===g[0];)g=g.substring(1);if(!h(a)||g!==J&&g!==H&&g!==I){var j=s(i,g,a,c);j&&d.push(g,j)}}return h(a)&&(d.isTemplate=!0,d["if"]=x(a,J,c),d.bind=x(a,H,c),d.repeat=x(a,I,c),!d["if"]||d.bind||d.repeat||(d.bind=s("{{}}",H,a,c))),d}function z(a,b){if(a.nodeType===Node.ELEMENT_NODE)return y(a,b);if(a.nodeType===Node.TEXT_NODE){var c=s(a.data,"textContent",a,b);if(c)return["textContent",c]}return[]}function A(a,b,c,d,e,f,g){for(var h=b.appendChild(c.importNode(a,!1)),i=0,j=a.firstChild;j;j=j.nextSibling)A(j,h,c,d.children[i++],e,f,g);return d.isTemplate&&(HTMLTemplateElement.decorate(h,a),f&&h.setDelegate_(f)),w(h,d,e,g),h}function B(a,b){var c=z(a,b);c.children={};for(var d=0,e=a.firstChild;e;e=e.nextSibling)c.children[d++]=B(e,b);return c}function C(a){var b=a.id_;return b||(b=a.id_=S++),b}function D(a,b){var c=C(a);if(b){var d=b.bindingMaps[c];return d||(d=b.bindingMaps[c]=B(a,b.prepareBinding)||[]),d}var d=a.bindingMap_;return d||(d=a.bindingMap_=B(a,void 0)||[]),d}function E(a){this.closed=!1,this.templateElement_=a,this.instances=[],this.deps=void 0,this.iteratedValue=[],this.presentValue=void 0,this.arrayObserver=void 0}var F,G=Array.prototype.forEach.call.bind(Array.prototype.forEach);a.Map&&"function"==typeof a.Map.prototype.forEach?F=a.Map:(F=function(){this.keys=[],this.values=[]},F.prototype={set:function(a,b){var c=this.keys.indexOf(a);0>c?(this.keys.push(a),this.values.push(b)):this.values[c]=b},get:function(a){var b=this.keys.indexOf(a);if(!(0>b))return this.values[b]},"delete":function(a){var b=this.keys.indexOf(a);return 0>b?!1:(this.keys.splice(b,1),this.values.splice(b,1),!0)},forEach:function(a,b){for(var c=0;c<this.keys.length;c++)a.call(b||this,this.values[c],this.keys[c],this)}});"function"!=typeof document.contains&&(Document.prototype.contains=function(a){return a===this||a.parentNode===this?!0:this.documentElement.contains(a)});var H="bind",I="repeat",J="if",K={template:!0,repeat:!0,bind:!0,ref:!0,"if":!0},L={THEAD:!0,TBODY:!0,TFOOT:!0,TH:!0,TR:!0,TD:!0,COLGROUP:!0,COL:!0,CAPTION:!0,OPTION:!0,OPTGROUP:!0},M="undefined"!=typeof HTMLTemplateElement;M&&!function(){var a=document.createElement("template"),b=a.content.ownerDocument,c=b.appendChild(b.createElement("html")),d=c.appendChild(b.createElement("head")),e=b.createElement("base");e.href=document.baseURI,d.appendChild(e)}();var N="template, "+Object.keys(L).map(function(a){return a.toLowerCase()+"[template]"}).join(", ");document.addEventListener("DOMContentLoaded",function(){j(document),Platform.performMicrotaskCheckpoint()},!1),M||(a.HTMLTemplateElement=function(){throw TypeError("Illegal constructor")});var O,P="__proto__"in{};"function"==typeof MutationObserver&&(O=new MutationObserver(function(a){for(var b=0;b<a.length;b++)a[b].target.refChanged_()})),HTMLTemplateElement.decorate=function(a,c){if(a.templateIsDecorated_)return!1;var d=a;d.templateIsDecorated_=!0;var h=f(d)&&M,i=h,k=!h,m=!1;if(h||(g(d)?(b(!c),d=n(a),d.templateIsDecorated_=!0,h=M,m=!0):e(d)&&(d=o(a),d.templateIsDecorated_=!0,h=M)),!h){q(d);var r=l(d);d.content_=r.createDocumentFragment()}return c?d.instanceRef_=c:k?p(d,a,m):i&&j(d.content),!0},HTMLTemplateElement.bootstrap=j;var Q=a.HTMLUnknownElement||HTMLElement,R={get:function(){return this.content_},enumerable:!0,configurable:!0};M||(HTMLTemplateElement.prototype=Object.create(Q.prototype),Object.defineProperty(HTMLTemplateElement.prototype,"content",R)),k(HTMLTemplateElement.prototype,{bind:function(a,b,c){if("ref"!=a)return Element.prototype.bind.call(this,a,b,c);var d=this,e=c?b:b.open(function(a){d.setAttribute("ref",a),d.refChanged_()});return this.setAttribute("ref",e),this.refChanged_(),c?void 0:(this.bindings_?this.bindings_.ref=b:this.bindings_={ref:b},b)},processBindingDirectives_:function(a){return this.iterator_&&this.iterator_.closeDeps(),a["if"]||a.bind||a.repeat?(this.iterator_||(this.iterator_=new E(this)),this.iterator_.updateDependencies(a,this.model_),O&&O.observe(this,{attributes:!0,attributeFilter:["ref"]}),this.iterator_):void(this.iterator_&&(this.iterator_.close(),this.iterator_=void 0))},createInstance:function(a,b,c){b?c=this.newDelegate_(b):c||(c=this.delegate_),this.refContent_||(this.refContent_=this.ref_.content);var d=this.refContent_;if(null===d.firstChild)return T;var e=D(d,c),f=m(this),g=f.createDocumentFragment();g.templateCreator_=this,g.protoContent_=d,g.bindings_=[],g.terminator_=null;for(var h=g.templateInstance_={firstNode:null,lastNode:null,model:a},i=0,j=!1,k=d.firstChild;k;k=k.nextSibling){null===k.nextSibling&&(j=!0);var l=A(k,g,f,e.children[i++],a,c,g.bindings_);l.templateInstance_=h,j&&(g.terminator_=l)}return h.firstNode=g.firstChild,h.lastNode=g.lastChild,g.templateCreator_=void 0,g.protoContent_=void 0,g},get model(){return this.model_},set model(a){this.model_=a,r(this)},get bindingDelegate(){return this.delegate_&&this.delegate_.raw},refChanged_:function(){this.iterator_&&this.refContent_!==this.ref_.content&&(this.refContent_=void 0,this.iterator_.valueChanged(),this.iterator_.updateIteratedValue(this.iterator_.getUpdatedValue()))},clear:function(){this.model_=void 0,this.delegate_=void 0,this.bindings_&&this.bindings_.ref&&this.bindings_.ref.close(),this.refContent_=void 0,this.iterator_&&(this.iterator_.valueChanged(),this.iterator_.close(),this.iterator_=void 0)},setDelegate_:function(a){this.delegate_=a,this.bindingMap_=void 0,this.iterator_&&(this.iterator_.instancePositionChangedFn_=void 0,this.iterator_.instanceModelFn_=void 0)},newDelegate_:function(a){function b(b){var c=a&&a[b];if("function"==typeof c)return function(){return c.apply(a,arguments)}}if(a)return{bindingMaps:{},raw:a,prepareBinding:b("prepareBinding"),prepareInstanceModel:b("prepareInstanceModel"),prepareInstancePositionChanged:b("prepareInstancePositionChanged")}},set bindingDelegate(a){if(this.delegate_)throw Error("Template must be cleared before a new bindingDelegate can be assigned");this.setDelegate_(this.newDelegate_(a))},get ref_(){var a=d(this,this.getAttribute("ref"));if(a||(a=this.instanceRef_),!a)return this;var b=a.ref_;return b?b:a}});var S=1;Object.defineProperty(Node.prototype,"templateInstance",{get:function(){var a=this.templateInstance_;return a?a:this.parentNode?this.parentNode.templateInstance:void 0}});var T=document.createDocumentFragment();T.bindings_=[],T.terminator_=null,E.prototype={closeDeps:function(){var a=this.deps;a&&(a.ifOneTime===!1&&a.ifValue.close(),a.oneTime===!1&&a.value.close())},updateDependencies:function(a,b){this.closeDeps();var c=this.deps={},d=this.templateElement_,e=!0;if(a["if"]){if(c.hasIf=!0,c.ifOneTime=a["if"].onlyOneTime,c.ifValue=v(J,a["if"],d,b),e=c.ifValue,c.ifOneTime&&!e)return void this.valueChanged();c.ifOneTime||(e=e.open(this.updateIfValue,this))}a.repeat?(c.repeat=!0,c.oneTime=a.repeat.onlyOneTime,c.value=v(I,a.repeat,d,b)):(c.repeat=!1,c.oneTime=a.bind.onlyOneTime,c.value=v(H,a.bind,d,b));var f=c.value;return c.oneTime||(f=f.open(this.updateIteratedValue,this)),e?void this.updateValue(f):void this.valueChanged()},getUpdatedValue:function(){var a=this.deps.value;return this.deps.oneTime||(a=a.discardChanges()),a},updateIfValue:function(a){return a?void this.updateValue(this.getUpdatedValue()):void this.valueChanged()},updateIteratedValue:function(a){if(this.deps.hasIf){var b=this.deps.ifValue;if(this.deps.ifOneTime||(b=b.discardChanges()),!b)return void this.valueChanged()}this.updateValue(a)},updateValue:function(a){this.deps.repeat||(a=[a]);var b=this.deps.repeat&&!this.deps.oneTime&&Array.isArray(a);this.valueChanged(a,b)},valueChanged:function(a,b){Array.isArray(a)||(a=[]),a!==this.iteratedValue&&(this.unobserve(),this.presentValue=a,b&&(this.arrayObserver=new ArrayObserver(this.presentValue),this.arrayObserver.open(this.handleSplices,this)),this.handleSplices(ArrayObserver.calculateSplices(this.presentValue,this.iteratedValue)))},getLastInstanceNode:function(a){if(-1==a)return this.templateElement_;var b=this.instances[a],c=b.terminator_;if(!c)return this.getLastInstanceNode(a-1);if(c.nodeType!==Node.ELEMENT_NODE||this.templateElement_===c)return c;var d=c.iterator_;return d?d.getLastTemplateNode():c},getLastTemplateNode:function(){return this.getLastInstanceNode(this.instances.length-1)},insertInstanceAt:function(a,b){var c=this.getLastInstanceNode(a-1),d=this.templateElement_.parentNode;this.instances.splice(a,0,b),d.insertBefore(b,c.nextSibling)},extractInstanceAt:function(a){for(var b=this.getLastInstanceNode(a-1),c=this.getLastInstanceNode(a),d=this.templateElement_.parentNode,e=this.instances.splice(a,1)[0];c!==b;){var f=b.nextSibling;f==c&&(c=b),e.appendChild(d.removeChild(f))}return e},getDelegateFn:function(a){return a=a&&a(this.templateElement_),"function"==typeof a?a:null},handleSplices:function(a){if(!this.closed&&a.length){var b=this.templateElement_;if(!b.parentNode)return void this.close();ArrayObserver.applySplices(this.iteratedValue,this.presentValue,a);var c=b.delegate_;void 0===this.instanceModelFn_&&(this.instanceModelFn_=this.getDelegateFn(c&&c.prepareInstanceModel)),void 0===this.instancePositionChangedFn_&&(this.instancePositionChangedFn_=this.getDelegateFn(c&&c.prepareInstancePositionChanged));for(var d=new F,e=0,f=0;f<a.length;f++){for(var g=a[f],h=g.removed,i=0;i<h.length;i++){var j=h[i],k=this.extractInstanceAt(g.index+e);k!==T&&d.set(j,k)}e-=g.addedCount}for(var f=0;f<a.length;f++)for(var g=a[f],l=g.index;l<g.index+g.addedCount;l++){var j=this.iteratedValue[l],k=d.get(j);k?d["delete"](j):(this.instanceModelFn_&&(j=this.instanceModelFn_(j)),k=void 0===j?T:b.createInstance(j,void 0,c)),this.insertInstanceAt(l,k)}d.forEach(function(a){this.closeInstanceBindings(a)},this),this.instancePositionChangedFn_&&this.reportInstancesMoved(a)}},reportInstanceMoved:function(a){var b=this.instances[a];b!==T&&this.instancePositionChangedFn_(b.templateInstance_,a)},reportInstancesMoved:function(a){for(var b=0,c=0,d=0;d<a.length;d++){var e=a[d];if(0!=c)for(;b<e.index;)this.reportInstanceMoved(b),b++;else b=e.index;for(;b<e.index+e.addedCount;)this.reportInstanceMoved(b),b++;c+=e.addedCount-e.removed.length}if(0!=c)for(var f=this.instances.length;f>b;)this.reportInstanceMoved(b),b++},closeInstanceBindings:function(a){for(var b=a.bindings_,c=0;c<b.length;c++)b[c].close()},unobserve:function(){this.arrayObserver&&(this.arrayObserver.close(),this.arrayObserver=void 0)},close:function(){if(!this.closed){this.unobserve();for(var a=0;a<this.instances.length;a++)this.closeInstanceBindings(this.instances[a]);this.instances.length=0,this.closeDeps(),this.templateElement_.iterator_=void 0,this.closed=!0}}},HTMLTemplateElement.forAllTemplatesFrom_=i}(this),function(a){"use strict";function b(a){return void 0!==m[a]}function c(){h.call(this),this._isInvalid=!0}function d(a){return""==a&&c.call(this),a.toLowerCase()}function e(a){var b=a.charCodeAt(0);return b>32&&127>b&&-1==[34,35,60,62,63,96].indexOf(b)?a:encodeURIComponent(a)}function f(a){var b=a.charCodeAt(0);return b>32&&127>b&&-1==[34,35,60,62,96].indexOf(b)?a:encodeURIComponent(a)}function g(a,g,h){function i(a){t.push(a)}var j=g||"scheme start",k=0,l="",r=!1,s=!1,t=[];a:for(;(a[k-1]!=o||0==k)&&!this._isInvalid;){var u=a[k];switch(j){case"scheme start":if(!u||!p.test(u)){if(g){i("Invalid scheme.");break a}l="",j="no scheme";continue}l+=u.toLowerCase(),j="scheme";break;case"scheme":if(u&&q.test(u))l+=u.toLowerCase();else{if(":"!=u){if(g){if(o==u)break a;i("Code point not allowed in scheme: "+u);break a}l="",k=0,j="no scheme";continue}if(this._scheme=l,l="",g)break a;b(this._scheme)&&(this._isRelative=!0),j="file"==this._scheme?"relative":this._isRelative&&h&&h._scheme==this._scheme?"relative or authority":this._isRelative?"authority first slash":"scheme data"}break;case"scheme data":"?"==u?(query="?",j="query"):"#"==u?(this._fragment="#",j="fragment"):o!=u&&" "!=u&&"\n"!=u&&"\r"!=u&&(this._schemeData+=e(u));break;case"no scheme":if(h&&b(h._scheme)){j="relative";continue}i("Missing scheme."),c.call(this);break;case"relative or authority":if("/"!=u||"/"!=a[k+1]){i("Expected /, got: "+u),j="relative";continue}j="authority ignore slashes";break;case"relative":if(this._isRelative=!0,"file"!=this._scheme&&(this._scheme=h._scheme),o==u){this._host=h._host,this._port=h._port,this._path=h._path.slice(),this._query=h._query;break a}if("/"==u||"\\"==u)"\\"==u&&i("\\ is an invalid code point."),j="relative slash";else if("?"==u)this._host=h._host,this._port=h._port,this._path=h._path.slice(),this._query="?",j="query";else{if("#"!=u){var v=a[k+1],w=a[k+2];("file"!=this._scheme||!p.test(u)||":"!=v&&"|"!=v||o!=w&&"/"!=w&&"\\"!=w&&"?"!=w&&"#"!=w)&&(this._host=h._host,this._port=h._port,this._path=h._path.slice(),this._path.pop()),j="relative path";continue}this._host=h._host,this._port=h._port,this._path=h._path.slice(),this._query=h._query,this._fragment="#",j="fragment"}break;case"relative slash":if("/"!=u&&"\\"!=u){"file"!=this._scheme&&(this._host=h._host,this._port=h._port),j="relative path";continue}"\\"==u&&i("\\ is an invalid code point."),j="file"==this._scheme?"file host":"authority ignore slashes";break;case"authority first slash":if("/"!=u){i("Expected '/', got: "+u),j="authority ignore slashes";continue}j="authority second slash";break;case"authority second slash":if(j="authority ignore slashes","/"!=u){i("Expected '/', got: "+u);continue}break;case"authority ignore slashes":if("/"!=u&&"\\"!=u){j="authority";continue}i("Expected authority, got: "+u);break;case"authority":if("@"==u){r&&(i("@ already seen."),l+="%40"),r=!0;for(var x=0;x<l.length;x++){var y=l[x];if(" "!=y&&"\n"!=y&&"\r"!=y)if(":"!=y||null!==this._password){var z=e(y);null!==this._password?this._password+=z:this._username+=z}else this._password="";else i("Invalid whitespace in authority.")}l=""}else{if(o==u||"/"==u||"\\"==u||"?"==u||"#"==u){k-=l.length,l="",j="host";continue}l+=u}break;case"file host":if(o==u||"/"==u||"\\"==u||"?"==u||"#"==u){2!=l.length||!p.test(l[0])||":"!=l[1]&&"|"!=l[1]?0==l.length?j="relative path start":(this._host=d.call(this,l),l="",j="relative path start"):j="relative path";continue}" "==u||"\n"==u||"\r"==u?i("Invalid whitespace in file host."):l+=u;break;case"host":case"hostname":if(":"!=u||s){if(o==u||"/"==u||"\\"==u||"?"==u||"#"==u){if(this._host=d.call(this,l),l="",j="relative path start",g)break a;continue}" "!=u&&"\n"!=u&&"\r"!=u?("["==u?s=!0:"]"==u&&(s=!1),l+=u):i("Invalid code point in host/hostname: "+u)}else if(this._host=d.call(this,l),l="",j="port","hostname"==g)break a;break;case"port":if(/[0-9]/.test(u))l+=u;else{if(o==u||"/"==u||"\\"==u||"?"==u||"#"==u||g){if(""!=l){var A=parseInt(l,10);A!=m[this._scheme]&&(this._port=A+""),l=""}if(g)break a;j="relative path start";continue}" "==u||"\n"==u||"\r"==u?i("Invalid code point in port: "+u):c.call(this)}break;case"relative path start":if("\\"==u&&i("'\\' not allowed in path."),j="relative path","/"!=u&&"\\"!=u)continue;break;case"relative path":if(o!=u&&"/"!=u&&"\\"!=u&&(g||"?"!=u&&"#"!=u))" "!=u&&"\n"!=u&&"\r"!=u&&(l+=e(u));else{"\\"==u&&i("\\ not allowed in relative path.");var B;(B=n[l.toLowerCase()])&&(l=B),".."==l?(this._path.pop(),"/"!=u&&"\\"!=u&&this._path.push("")):"."==l&&"/"!=u&&"\\"!=u?this._path.push(""):"."!=l&&("file"==this._scheme&&0==this._path.length&&2==l.length&&p.test(l[0])&&"|"==l[1]&&(l=l[0]+":"),this._path.push(l)),l="","?"==u?(this._query="?",j="query"):"#"==u&&(this._fragment="#",j="fragment")}break;case"query":g||"#"!=u?o!=u&&" "!=u&&"\n"!=u&&"\r"!=u&&(this._query+=f(u)):(this._fragment="#",j="fragment");break;case"fragment":o!=u&&" "!=u&&"\n"!=u&&"\r"!=u&&(this._fragment+=u)}k++}}function h(){this._scheme="",this._schemeData="",this._username="",this._password=null,this._host="",this._port="",this._path=[],this._query="",this._fragment="",this._isInvalid=!1,this._isRelative=!1}function i(a,b){void 0===b||b instanceof i||(b=new i(String(b))),this._url=a,h.call(this);var c=a.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g,"");g.call(this,c,null,b)}var j=!1;if(!a.forceJURL)try{var k=new URL("b","http://a");k.pathname="c%20d",j="http://a/c%20d"===k.href}catch(l){}if(!j){var m=Object.create(null);m.ftp=21,m.file=0,m.gopher=70,m.http=80,m.https=443,m.ws=80,m.wss=443;var n=Object.create(null);n["%2e"]=".",n[".%2e"]="..",n["%2e."]="..",n["%2e%2e"]="..";var o=void 0,p=/[a-zA-Z]/,q=/[a-zA-Z0-9\+\-\.]/;i.prototype={get href(){if(this._isInvalid)return this._url;var a="";return(""!=this._username||null!=this._password)&&(a=this._username+(null!=this._password?":"+this._password:"")+"@"),this.protocol+(this._isRelative?"//"+a+this.host:"")+this.pathname+this._query+this._fragment},set href(a){h.call(this),g.call(this,a)},get protocol(){return this._scheme+":"},set protocol(a){this._isInvalid||g.call(this,a+":","scheme start")},get host(){return this._isInvalid?"":this._port?this._host+":"+this._port:this._host},set host(a){!this._isInvalid&&this._isRelative&&g.call(this,a,"host")},get hostname(){return this._host},set hostname(a){!this._isInvalid&&this._isRelative&&g.call(this,a,"hostname")},get port(){return this._port},set port(a){!this._isInvalid&&this._isRelative&&g.call(this,a,"port")},get pathname(){return this._isInvalid?"":this._isRelative?"/"+this._path.join("/"):this._schemeData},set pathname(a){!this._isInvalid&&this._isRelative&&(this._path=[],g.call(this,a,"relative path start"))},get search(){return this._isInvalid||!this._query||"?"==this._query?"":this._query},set search(a){!this._isInvalid&&this._isRelative&&(this._query="?","?"==a[0]&&(a=a.slice(1)),g.call(this,a,"query"))},get hash(){return this._isInvalid||!this._fragment||"#"==this._fragment?"":this._fragment},set hash(a){this._isInvalid||(this._fragment="#","#"==a[0]&&(a=a.slice(1)),g.call(this,a,"fragment"))},get origin(){var a;if(this._isInvalid||!this._scheme)return"";switch(this._scheme){case"data":case"file":case"javascript":case"mailto":return"null"}return a=this.host,a?this._scheme+"://"+a:""}};var r=a.URL;r&&(i.createObjectURL=function(){return r.createObjectURL.apply(r,arguments)},i.revokeObjectURL=function(a){r.revokeObjectURL(a)}),a.URL=i}}(this),function(a){function b(a){f.textContent=d++,e.push(a)}function c(){for(;e.length;)e.shift()()}var d=0,e=[],f=document.createTextNode("");new(window.MutationObserver||JsMutationObserver)(c).observe(f,{characterData:!0}),a.endOfMicrotask=b,Platform.endOfMicrotask=b}(Polymer),function(a){function b(){g||(g=!0,c(function(){g=!1,d.data&&console.group("flush"),Platform.performMicrotaskCheckpoint(),d.data&&console.groupEnd()}))}var c=a.endOfMicrotask,d=window.WebComponents?WebComponents.flags.log:{},e=document.createElement("style");e.textContent="template {display: none !important;} /* injected by platform.js */";var f=document.querySelector("head");f.insertBefore(e,f.firstChild);var g;if(Observer.hasObjectObserve)b=function(){};else{var h=125;window.addEventListener("WebComponentsReady",function(){b();var c=function(){"hidden"===document.visibilityState?a.flushPoll&&clearInterval(a.flushPoll):a.flushPoll=setInterval(b,h)};"string"==typeof document.visibilityState&&document.addEventListener("visibilitychange",c),c()})}if(window.CustomElements&&!CustomElements.useNative){var i=Document.prototype.importNode;Document.prototype.importNode=function(a,b){var c=i.call(this,a,b);return CustomElements.upgradeAll(c),c}}a.flush=b,Platform.flush=b}(window.Polymer),function(a){function b(a){var b=new URL(a.ownerDocument.baseURI);return b.search="",b.hash="",b}function c(a,b,c,e){return a.replace(e,function(a,e,f,g){var h=f.replace(/["']/g,"");return h=d(b,h,c),e+"'"+h+"'"+g})}function d(a,b,c){if(b&&"/"===b[0])return b;if(b&&"#"===b[0])return b;var d=new URL(b,a);return c?d.href:e(d.href)}function e(a){var c=b(document.documentElement),d=new URL(a,c);return d.host===c.host&&d.port===c.port&&d.protocol===c.protocol?f(c,d):a}function f(a,b){for(var c=a.pathname,d=b.pathname,e=c.split("/"),f=d.split("/");e.length&&e[0]===f[0];)e.shift(),f.shift();for(var g=0,h=e.length-1;h>g;g++)f.unshift("..");var i=b.href.slice(-1)===m?m:b.hash;return f.join("/")+b.search+i}var g={resolveDom:function(a,c){c=c||b(a),this.resolveAttributes(a,c),this.resolveStyles(a,c);var d=a.querySelectorAll("template");if(d)for(var e,f=0,g=d.length;g>f&&(e=d[f]);f++)e.content&&this.resolveDom(e.content,c)},resolveTemplate:function(a){this.resolveDom(a.content,b(a))},resolveStyles:function(a,b){var c=a.querySelectorAll("style");if(c)for(var d,e=0,f=c.length;f>e&&(d=c[e]);e++)this.resolveStyle(d,b)},resolveStyle:function(a,c){c=c||b(a),a.textContent=this.resolveCssText(a.textContent,c)},resolveCssText:function(a,b,d){return a=c(a,b,d,h),c(a,b,d,i)},resolveAttributes:function(a,b){a.hasAttributes&&a.hasAttributes()&&this.resolveElementAttributes(a,b);var c=a&&a.querySelectorAll(k);if(c)for(var d,e=0,f=c.length;f>e&&(d=c[e]);e++)this.resolveElementAttributes(d,b)},resolveElementAttributes:function(a,e){e=e||b(a),j.forEach(function(b){var f,g=a.attributes[b],i=g&&g.value;i&&i.search(l)<0&&(f="style"===b?c(i,e,!1,h):d(e,i),g.value=f)})}},h=/(url\()([^)]*)(\))/g,i=/(@import[\s]+(?!url\())([^;]*)(;)/g,j=["href","src","action","style","url"],k="["+j.join("],[")+"]",l="{{.*}}",m="#";a.urlResolver=g}(Polymer),function(a){function b(a){this.cache=Object.create(null),this.map=Object.create(null),this.requests=0,this.regex=a}var c=Polymer.endOfMicrotask;b.prototype={extractUrls:function(a,b){for(var c,d,e=[];c=this.regex.exec(a);)d=new URL(c[1],b),e.push({matched:c[0],url:d.href});return e},process:function(a,b,c){var d=this.extractUrls(a,b),e=c.bind(null,this.map);this.fetch(d,e)},fetch:function(a,b){var c=a.length;if(!c)return b();for(var d,e,f,g=function(){0===--c&&b()},h=0;c>h;h++)d=a[h],f=d.url,e=this.cache[f],e||(e=this.xhr(f),e.match=d,this.cache[f]=e),e.wait(g)},handleXhr:function(a){var b=a.match,c=b.url,d=a.response||a.responseText||"";this.map[c]=d,this.fetch(this.extractUrls(d,c),a.resolve)},xhr:function(a){this.requests++;var b=new XMLHttpRequest;return b.open("GET",a,!0),b.send(),b.onerror=b.onload=this.handleXhr.bind(this,b),b.pending=[],b.resolve=function(){for(var a=b.pending,c=0;c<a.length;c++)a[c]();b.pending=null},b.wait=function(a){b.pending?b.pending.push(a):c(a)},b}},a.Loader=b}(Polymer),function(a){function b(){this.loader=new d(this.regex)}var c=a.urlResolver,d=a.Loader;b.prototype={regex:/@import\s+(?:url)?["'\(]*([^'"\)]*)['"\)]*;/g,resolve:function(a,b,c){var d=function(d){c(this.flatten(a,b,d))}.bind(this);this.loader.process(a,b,d)},resolveNode:function(a,b,c){var d=a.textContent,e=function(b){a.textContent=b,c(a)};this.resolve(d,b,e)},flatten:function(a,b,d){for(var e,f,g,h=this.loader.extractUrls(a,b),i=0;i<h.length;i++)e=h[i],f=e.url,g=c.resolveCssText(d[f],f,!0),g=this.flatten(g,b,d),a=a.replace(e.matched,g);return a},loadStyles:function(a,b,c){function d(){f++,f===g&&c&&c()}for(var e,f=0,g=a.length,h=0;g>h&&(e=a[h]);h++)this.resolveNode(e,b,d)}};var e=new b;a.styleResolver=e}(Polymer),function(a){function b(a,b){return a&&b&&Object.getOwnPropertyNames(b).forEach(function(c){var d=Object.getOwnPropertyDescriptor(b,c);d&&(Object.defineProperty(a,c,d),"function"==typeof d.value&&(d.value.nom=c))}),a}function c(a){for(var b=a||{},c=1;c<arguments.length;c++){var e=arguments[c];try{for(var f in e)d(f,e,b)}catch(g){}}return b}function d(a,b,c){var d=e(b,a);Object.defineProperty(c,a,d)}function e(a,b){if(a){var c=Object.getOwnPropertyDescriptor(a,b);return c||e(Object.getPrototypeOf(a),b)}}a.extend=b,a.mixin=c,Platform.mixin=c}(Polymer),function(a){function b(a,b,d){return a?a.stop():a=new c(this),a.go(b,d),a}var c=function(a){this.context=a,this.boundComplete=this.complete.bind(this)};c.prototype={go:function(a,b){this.callback=a;var c;b?(c=setTimeout(this.boundComplete,b),this.handle=function(){clearTimeout(c)}):(c=requestAnimationFrame(this.boundComplete),this.handle=function(){cancelAnimationFrame(c)})},stop:function(){this.handle&&(this.handle(),this.handle=null)},complete:function(){this.handle&&(this.stop(),this.callback.call(this.context))}},a.job=b}(Polymer),function(a){function b(a,b,c){var d="string"==typeof a?document.createElement(a):a.cloneNode(!0);if(d.innerHTML=b,c)for(var e in c)d.setAttribute(e,c[e]);return d}var c={};HTMLElement.register=function(a,b){c[a]=b},HTMLElement.getPrototypeForTag=function(a){var b=a?c[a]:HTMLElement.prototype;return b||Object.getPrototypeOf(document.createElement(a))};var d=Event.prototype.stopPropagation;Event.prototype.stopPropagation=function(){this.cancelBubble=!0,d.apply(this,arguments)};var e=DOMTokenList.prototype.add,f=DOMTokenList.prototype.remove;DOMTokenList.prototype.add=function(){for(var a=0;a<arguments.length;a++)e.call(this,arguments[a])},DOMTokenList.prototype.remove=function(){for(var a=0;a<arguments.length;a++)f.call(this,arguments[a])},DOMTokenList.prototype.toggle=function(a,b){1==arguments.length&&(b=!this.contains(a)),b?this.add(a):this.remove(a)},DOMTokenList.prototype["switch"]=function(a,b){a&&this.remove(a),b&&this.add(b)};var g=function(){return Array.prototype.slice.call(this)},h=window.NamedNodeMap||window.MozNamedAttrMap||{};NodeList.prototype.array=g,h.prototype.array=g,HTMLCollection.prototype.array=g,a.createDOM=b}(Polymer),function(a){function b(a){var e=b.caller,g=e.nom,h=e._super;h||(g||(g=e.nom=c.call(this,e)),g||console.warn("called super() on a method not installed declaratively (has no .nom property)"),h=d(e,g,f(this)));var i=h[g];return i?(i._super||d(i,g,h),i.apply(this,a||[])):void 0}function c(a){for(var b=this.__proto__;b&&b!==HTMLElement.prototype;){for(var c,d=Object.getOwnPropertyNames(b),e=0,f=d.length;f>e&&(c=d[e]);e++){var g=Object.getOwnPropertyDescriptor(b,c);if("function"==typeof g.value&&g.value===a)return c}b=b.__proto__}}function d(a,b,c){var d=e(c,b,a);return d[b]&&(d[b].nom=b),a._super=d}function e(a,b,c){for(;a;){if(a[b]!==c&&a[b])return a;a=f(a)}return Object}function f(a){return a.__proto__}a["super"]=b}(Polymer),function(a){function b(a){return a}function c(a,b){var c=typeof b;return b instanceof Date&&(c="date"),d[c](a,b)}var d={string:b,undefined:b,date:function(a){return new Date(Date.parse(a)||Date.now())},"boolean":function(a){return""===a?!0:"false"===a?!1:!!a},number:function(a){var b=parseFloat(a);return 0===b&&(b=parseInt(a)),isNaN(b)?a:b},object:function(a,b){if(null===b)return a;try{return JSON.parse(a.replace(/'/g,'"'))}catch(c){return a}},"function":function(a,b){return b}};a.deserializeValue=c}(Polymer),function(a){var b=a.extend,c={};c.declaration={},c.instance={},c.publish=function(a,c){for(var d in a)b(c,a[d])},a.api=c}(Polymer),function(a){var b={async:function(a,b,c){Polymer.flush(),b=b&&b.length?b:[b];var d=function(){(this[a]||a).apply(this,b)}.bind(this),e=c?setTimeout(d,c):requestAnimationFrame(d);return c?e:~e},cancelAsync:function(a){0>a?cancelAnimationFrame(~a):clearTimeout(a)},fire:function(a,b,c,d,e){var f=c||this,b=null===b||void 0===b?{}:b,g=new CustomEvent(a,{bubbles:void 0!==d?d:!0,cancelable:void 0!==e?e:!0,detail:b});return f.dispatchEvent(g),g},asyncFire:function(){this.async("fire",arguments)},classFollows:function(a,b,c){b&&b.classList.remove(c),a&&a.classList.add(c)},injectBoundHTML:function(a,b){var c=document.createElement("template");c.innerHTML=a;var d=this.instanceTemplate(c);return b&&(b.textContent="",b.appendChild(d)),d}},c=function(){},d={};b.asyncMethod=b.async,a.api.instance.utils=b,a.nop=c,a.nob=d}(Polymer),function(a){var b=window.WebComponents?WebComponents.flags.log:{},c="on-",d={EVENT_PREFIX:c,addHostListeners:function(){var a=this.eventDelegates;
-b.events&&Object.keys(a).length>0&&console.log("[%s] addHostListeners:",this.localName,a);for(var c in a){var d=a[c];PolymerGestures.addEventListener(this,c,this.element.getEventHandler(this,this,d))}},dispatchMethod:function(a,c,d){if(a){b.events&&console.group("[%s] dispatch [%s]",a.localName,c);var e="function"==typeof c?c:a[c];e&&e[d?"apply":"call"](a,d),b.events&&console.groupEnd(),Polymer.flush()}}};a.api.instance.events=d,a.addEventListener=function(a,b,c,d){PolymerGestures.addEventListener(wrap(a),b,c,d)},a.removeEventListener=function(a,b,c,d){PolymerGestures.removeEventListener(wrap(a),b,c,d)}}(Polymer),function(a){var b={copyInstanceAttributes:function(){var a=this._instanceAttributes;for(var b in a)this.hasAttribute(b)||this.setAttribute(b,a[b])},takeAttributes:function(){if(this._publishLC)for(var a,b=0,c=this.attributes,d=c.length;(a=c[b])&&d>b;b++)this.attributeToProperty(a.name,a.value)},attributeToProperty:function(b,c){var b=this.propertyForAttribute(b);if(b){if(c&&c.search(a.bindPattern)>=0)return;var d=this[b],c=this.deserializeValue(c,d);c!==d&&(this[b]=c)}},propertyForAttribute:function(a){var b=this._publishLC&&this._publishLC[a];return b},deserializeValue:function(b,c){return a.deserializeValue(b,c)},serializeValue:function(a,b){return"boolean"===b?a?"":void 0:"object"!==b&&"function"!==b&&void 0!==a?a:void 0},reflectPropertyToAttribute:function(a){var b=typeof this[a],c=this.serializeValue(this[a],b);void 0!==c?this.setAttribute(a,c):"boolean"===b&&this.removeAttribute(a)}};a.api.instance.attributes=b}(Polymer),function(a){function b(a,b){return a===b?0!==a||1/a===1/b:f(a)&&f(b)?!0:a!==a&&b!==b}function c(a,b){return void 0===b&&null===a?b:null===b||void 0===b?a:b}var d=window.WebComponents?WebComponents.flags.log:{},e={object:void 0,type:"update",name:void 0,oldValue:void 0},f=Number.isNaN||function(a){return"number"==typeof a&&isNaN(a)},g={createPropertyObserver:function(){var a=this._observeNames;if(a&&a.length){var b=this._propertyObserver=new CompoundObserver(!0);this.registerObserver(b);for(var c,d=0,e=a.length;e>d&&(c=a[d]);d++)b.addPath(this,c),this.observeArrayValue(c,this[c],null)}},openPropertyObserver:function(){this._propertyObserver&&this._propertyObserver.open(this.notifyPropertyChanges,this)},notifyPropertyChanges:function(a,b,c){var d,e,f={};for(var g in b)if(d=c[2*g+1],e=this.observe[d]){var h=b[g],i=a[g];this.observeArrayValue(d,i,h),f[e]||(void 0!==h&&null!==h||void 0!==i&&null!==i)&&(f[e]=!0,this.invokeMethod(e,[h,i,arguments]))}},invokeMethod:function(a,b){var c=this[a]||a;"function"==typeof c&&c.apply(this,b)},deliverChanges:function(){this._propertyObserver&&this._propertyObserver.deliver()},observeArrayValue:function(a,b,c){var e=this.observe[a];if(e&&(Array.isArray(c)&&(d.observe&&console.log("[%s] observeArrayValue: unregister observer [%s]",this.localName,a),this.closeNamedObserver(a+"__array")),Array.isArray(b))){d.observe&&console.log("[%s] observeArrayValue: register observer [%s]",this.localName,a,b);var f=new ArrayObserver(b);f.open(function(a){this.invokeMethod(e,[a])},this),this.registerNamedObserver(a+"__array",f)}},emitPropertyChangeRecord:function(a,c,d){if(!b(c,d)&&(this._propertyChanged(a,c,d),Observer.hasObjectObserve)){var f=this._objectNotifier;f||(f=this._objectNotifier=Object.getNotifier(this)),e.object=this,e.name=a,e.oldValue=d,f.notify(e)}},_propertyChanged:function(a){this.reflect[a]&&this.reflectPropertyToAttribute(a)},bindProperty:function(a,b,d){if(d)return void(this[a]=b);var e=this.element.prototype.computed;if(e&&e[a]){var f=a+"ComputedBoundObservable_";return void(this[f]=b)}return this.bindToAccessor(a,b,c)},bindToAccessor:function(a,c,d){function e(b,c){j[f]=b;var d=j[h];d&&"function"==typeof d.setValue&&d.setValue(b),j.emitPropertyChangeRecord(a,b,c)}var f=a+"_",g=a+"Observable_",h=a+"ComputedBoundObservable_";this[g]=c;var i=this[f],j=this,k=c.open(e);if(d&&!b(i,k)){var l=d(i,k);b(k,l)||(k=l,c.setValue&&c.setValue(k))}e(k,i);var m={close:function(){c.close(),j[g]=void 0,j[h]=void 0}};return this.registerObserver(m),m},createComputedProperties:function(){if(this._computedNames)for(var a=0;a<this._computedNames.length;a++){var b=this._computedNames[a],c=this.computed[b];try{var d=PolymerExpressions.getExpression(c),e=d.getBinding(this,this.element.syntax);this.bindToAccessor(b,e)}catch(f){console.error("Failed to create computed property",f)}}},registerObserver:function(a){return this._observers?void this._observers.push(a):void(this._observers=[a])},closeObservers:function(){if(this._observers){for(var a=this._observers,b=0;b<a.length;b++){var c=a[b];c&&"function"==typeof c.close&&c.close()}this._observers=[]}},registerNamedObserver:function(a,b){var c=this._namedObservers||(this._namedObservers={});c[a]=b},closeNamedObserver:function(a){var b=this._namedObservers;return b&&b[a]?(b[a].close(),b[a]=null,!0):void 0},closeNamedObservers:function(){if(this._namedObservers){for(var a in this._namedObservers)this.closeNamedObserver(a);this._namedObservers={}}}};a.api.instance.properties=g}(Polymer),function(a){var b=window.WebComponents?WebComponents.flags.log:{},c={instanceTemplate:function(a){HTMLTemplateElement.decorate(a);for(var b=this.syntax||!a.bindingDelegate&&this.element.syntax,c=a.createInstance(this,b),d=c.bindings_,e=0;e<d.length;e++)this.registerObserver(d[e]);return c},bind:function(a,b,c){var d=this.propertyForAttribute(a);if(d){var e=this.bindProperty(d,b,c);return Platform.enableBindingsReflection&&e&&(e.path=b.path_,this._recordBinding(d,e)),this.reflect[d]&&this.reflectPropertyToAttribute(d),e}return this.mixinSuper(arguments)},_recordBinding:function(a,b){this.bindings_=this.bindings_||{},this.bindings_[a]=b},bindFinished:function(){this.makeElementReady()},asyncUnbindAll:function(){this._unbound||(b.unbind&&console.log("[%s] asyncUnbindAll",this.localName),this._unbindAllJob=this.job(this._unbindAllJob,this.unbindAll,0))},unbindAll:function(){this._unbound||(this.closeObservers(),this.closeNamedObservers(),this._unbound=!0)},cancelUnbindAll:function(){return this._unbound?void(b.unbind&&console.warn("[%s] already unbound, cannot cancel unbindAll",this.localName)):(b.unbind&&console.log("[%s] cancelUnbindAll",this.localName),void(this._unbindAllJob&&(this._unbindAllJob=this._unbindAllJob.stop())))}},d=/\{\{([^{}]*)}}/;a.bindPattern=d,a.api.instance.mdv=c}(Polymer),function(a){function b(a){return a.hasOwnProperty("PolymerBase")}function c(){}var d={PolymerBase:!0,job:function(a,b,c){if("string"!=typeof a)return Polymer.job.call(this,a,b,c);var d="___"+a;this[d]=Polymer.job.call(this,this[d],b,c)},"super":Polymer["super"],created:function(){},ready:function(){},createdCallback:function(){this.templateInstance&&this.templateInstance.model&&console.warn("Attributes on "+this.localName+" were data bound prior to Polymer upgrading the element. This may result in incorrect binding types."),this.created(),this.prepareElement(),this.ownerDocument.isStagingDocument||this.makeElementReady()},prepareElement:function(){return this._elementPrepared?void console.warn("Element already prepared",this.localName):(this._elementPrepared=!0,this.shadowRoots={},this.createPropertyObserver(),this.openPropertyObserver(),this.copyInstanceAttributes(),this.takeAttributes(),void this.addHostListeners())},makeElementReady:function(){this._readied||(this._readied=!0,this.createComputedProperties(),this.parseDeclarations(this.__proto__),this.removeAttribute("unresolved"),this.ready())},attributeChangedCallback:function(a){"class"!==a&&"style"!==a&&this.attributeToProperty(a,this.getAttribute(a)),this.attributeChanged&&this.attributeChanged.apply(this,arguments)},attachedCallback:function(){this.cancelUnbindAll(),this.attached&&this.attached(),this.hasBeenAttached||(this.hasBeenAttached=!0,this.domReady&&this.async("domReady"))},detachedCallback:function(){this.preventDispose||this.asyncUnbindAll(),this.detached&&this.detached(),this.leftView&&this.leftView()},parseDeclarations:function(a){a&&a.element&&(this.parseDeclarations(a.__proto__),a.parseDeclaration.call(this,a.element))},parseDeclaration:function(a){var b=this.fetchTemplate(a);if(b){var c=this.shadowFromTemplate(b);this.shadowRoots[a.name]=c}},fetchTemplate:function(a){return a.querySelector("template")},shadowFromTemplate:function(a){if(a){var b=this.createShadowRoot(),c=this.instanceTemplate(a);return b.appendChild(c),this.shadowRootReady(b,a),b}},lightFromTemplate:function(a,b){if(a){this.eventController=this;var c=this.instanceTemplate(a);return b?this.insertBefore(c,b):this.appendChild(c),this.shadowRootReady(this),c}},shadowRootReady:function(a){this.marshalNodeReferences(a)},marshalNodeReferences:function(a){var b=this.$=this.$||{};if(a)for(var c,d=a.querySelectorAll("[id]"),e=0,f=d.length;f>e&&(c=d[e]);e++)b[c.id]=c},onMutation:function(a,b){var c=new MutationObserver(function(a){b.call(this,c,a),c.disconnect()}.bind(this));c.observe(a,{childList:!0,subtree:!0})}};c.prototype=d,d.constructor=c,a.Base=c,a.isBase=b,a.api.instance.base=d}(Polymer),function(a){function b(a){return a.__proto__}function c(a,b){var c="",d=!1;b&&(c=b.localName,d=b.hasAttribute("is"));var e=WebComponents.ShadowCSS.makeScopeSelector(c,d);return WebComponents.ShadowCSS.shimCssText(a,e)}var d=(window.WebComponents?WebComponents.flags.log:{},window.ShadowDOMPolyfill),e="element",f="controller",g={STYLE_SCOPE_ATTRIBUTE:e,installControllerStyles:function(){var a=this.findStyleScope();if(a&&!this.scopeHasNamedStyle(a,this.localName)){for(var c=b(this),d="";c&&c.element;)d+=c.element.cssTextForScope(f),c=b(c);d&&this.installScopeCssText(d,a)}},installScopeStyle:function(a,b,c){var c=c||this.findStyleScope(),b=b||"";if(c&&!this.scopeHasNamedStyle(c,this.localName+b)){var d="";if(a instanceof Array)for(var e,f=0,g=a.length;g>f&&(e=a[f]);f++)d+=e.textContent+"\n\n";else d=a.textContent;this.installScopeCssText(d,c,b)}},installScopeCssText:function(a,b,e){if(b=b||this.findStyleScope(),e=e||"",b){d&&(a=c(a,b.host));var g=this.element.cssTextToScopeStyle(a,f);Polymer.applyStyleToScope(g,b),this.styleCacheForScope(b)[this.localName+e]=!0}},findStyleScope:function(a){for(var b=a||this;b.parentNode;)b=b.parentNode;return b},scopeHasNamedStyle:function(a,b){var c=this.styleCacheForScope(a);return c[b]},styleCacheForScope:function(a){if(d){var b=a.host?a.host.localName:a.localName;return h[b]||(h[b]={})}return a._scopeStyles=a._scopeStyles||{}}},h={};a.api.instance.styles=g}(Polymer),function(a){function b(a,b){if("string"!=typeof a){var c=b||document._currentScript;if(b=a,a=c&&c.parentNode&&c.parentNode.getAttribute?c.parentNode.getAttribute("name"):"",!a)throw"Element name could not be inferred."}if(f(a))throw"Already registered (Polymer) prototype for element "+a;e(a,b),d(a)}function c(a,b){i[a]=b}function d(a){i[a]&&(i[a].registerWhenReady(),delete i[a])}function e(a,b){return j[a]=b||{}}function f(a){return j[a]}function g(a,b){if("string"!=typeof b)return!1;var c=HTMLElement.getPrototypeForTag(b),d=c&&c.constructor;return d?CustomElements["instanceof"]?CustomElements["instanceof"](a,d):a instanceof d:!1}var h=a.extend,i=(a.api,{}),j={};a.getRegisteredPrototype=f,a.waitingForPrototype=c,a.instanceOfType=g,window.Polymer=b,h(Polymer,a),WebComponents.consumeDeclarations&&WebComponents.consumeDeclarations(function(a){if(a)for(var c,d=0,e=a.length;e>d&&(c=a[d]);d++)b.apply(null,c)})}(Polymer),function(a){var b={resolveElementPaths:function(a){Polymer.urlResolver.resolveDom(a)},addResolvePathApi:function(){var a=this.getAttribute("assetpath")||"",b=new URL(a,this.ownerDocument.baseURI);this.prototype.resolvePath=function(a,c){var d=new URL(a,c||b);return d.href}}};a.api.declaration.path=b}(Polymer),function(a){function b(a,b){var c=new URL(a.getAttribute("href"),b).href;return"@import '"+c+"';"}function c(a,b){if(a){b===document&&(b=document.head),i&&(b=document.head);var c=d(a.textContent),e=a.getAttribute(h);e&&c.setAttribute(h,e);var f=b.firstElementChild;if(b===document.head){var g="style["+h+"]",j=document.head.querySelectorAll(g);j.length&&(f=j[j.length-1].nextElementSibling)}b.insertBefore(c,f)}}function d(a,b){b=b||document,b=b.createElement?b:b.ownerDocument;var c=b.createElement("style");return c.textContent=a,c}function e(a){return a&&a.__resource||""}function f(a,b){return q?q.call(a,b):void 0}var g=(window.WebComponents?WebComponents.flags.log:{},a.api.instance.styles),h=g.STYLE_SCOPE_ATTRIBUTE,i=window.ShadowDOMPolyfill,j="style",k="@import",l="link[rel=stylesheet]",m="global",n="polymer-scope",o={loadStyles:function(a){var b=this.fetchTemplate(),c=b&&this.templateContent();if(c){this.convertSheetsToStyles(c);var d=this.findLoadableStyles(c);if(d.length){var e=b.ownerDocument.baseURI;return Polymer.styleResolver.loadStyles(d,e,a)}}a&&a()},convertSheetsToStyles:function(a){for(var c,e,f=a.querySelectorAll(l),g=0,h=f.length;h>g&&(c=f[g]);g++)e=d(b(c,this.ownerDocument.baseURI),this.ownerDocument),this.copySheetAttributes(e,c),c.parentNode.replaceChild(e,c)},copySheetAttributes:function(a,b){for(var c,d=0,e=b.attributes,f=e.length;(c=e[d])&&f>d;d++)"rel"!==c.name&&"href"!==c.name&&a.setAttribute(c.name,c.value)},findLoadableStyles:function(a){var b=[];if(a)for(var c,d=a.querySelectorAll(j),e=0,f=d.length;f>e&&(c=d[e]);e++)c.textContent.match(k)&&b.push(c);return b},installSheets:function(){this.cacheSheets(),this.cacheStyles(),this.installLocalSheets(),this.installGlobalStyles()},cacheSheets:function(){this.sheets=this.findNodes(l),this.sheets.forEach(function(a){a.parentNode&&a.parentNode.removeChild(a)})},cacheStyles:function(){this.styles=this.findNodes(j+"["+n+"]"),this.styles.forEach(function(a){a.parentNode&&a.parentNode.removeChild(a)})},installLocalSheets:function(){var a=this.sheets.filter(function(a){return!a.hasAttribute(n)}),b=this.templateContent();if(b){var c="";if(a.forEach(function(a){c+=e(a)+"\n"}),c){var f=d(c,this.ownerDocument);b.insertBefore(f,b.firstChild)}}},findNodes:function(a,b){var c=this.querySelectorAll(a).array(),d=this.templateContent();if(d){var e=d.querySelectorAll(a).array();c=c.concat(e)}return b?c.filter(b):c},installGlobalStyles:function(){var a=this.styleForScope(m);c(a,document.head)},cssTextForScope:function(a){var b="",c="["+n+"="+a+"]",d=function(a){return f(a,c)},g=this.sheets.filter(d);g.forEach(function(a){b+=e(a)+"\n\n"});var h=this.styles.filter(d);return h.forEach(function(a){b+=a.textContent+"\n\n"}),b},styleForScope:function(a){var b=this.cssTextForScope(a);return this.cssTextToScopeStyle(b,a)},cssTextToScopeStyle:function(a,b){if(a){var c=d(a);return c.setAttribute(h,this.getAttribute("name")+"-"+b),c}}},p=HTMLElement.prototype,q=p.matches||p.matchesSelector||p.webkitMatchesSelector||p.mozMatchesSelector;a.api.declaration.styles=o,a.applyStyleToScope=c}(Polymer),function(a){var b=(window.WebComponents?WebComponents.flags.log:{},a.api.instance.events),c=b.EVENT_PREFIX,d={};["webkitAnimationStart","webkitAnimationEnd","webkitTransitionEnd","DOMFocusOut","DOMFocusIn","DOMMouseScroll"].forEach(function(a){d[a.toLowerCase()]=a});var e={parseHostEvents:function(){var a=this.prototype.eventDelegates;this.addAttributeDelegates(a)},addAttributeDelegates:function(a){for(var b,c=0;b=this.attributes[c];c++)this.hasEventPrefix(b.name)&&(a[this.removeEventPrefix(b.name)]=b.value.replace("{{","").replace("}}","").trim())},hasEventPrefix:function(a){return a&&"o"===a[0]&&"n"===a[1]&&"-"===a[2]},removeEventPrefix:function(a){return a.slice(f)},findController:function(a){for(;a.parentNode;){if(a.eventController)return a.eventController;a=a.parentNode}return a.host},getEventHandler:function(a,b,c){var d=this;return function(e){a&&a.PolymerBase||(a=d.findController(b));var f=[e,e.detail,e.currentTarget];a.dispatchMethod(a,c,f)}},prepareEventBinding:function(a,b){if(this.hasEventPrefix(b)){var c=this.removeEventPrefix(b);c=d[c]||c;var e=this;return function(b,d,f){function g(){return"{{ "+a+" }}"}var h=e.getEventHandler(void 0,d,a);return PolymerGestures.addEventListener(d,c,h),f?void 0:{open:g,discardChanges:g,close:function(){PolymerGestures.removeEventListener(d,c,h)}}}}}},f=c.length;a.api.declaration.events=e}(Polymer),function(a){var b=["attribute"],c={inferObservers:function(a){var b,c=a.observe;for(var d in a)"Changed"===d.slice(-7)&&(b=d.slice(0,-7),this.canObserveProperty(b)&&(c||(c=a.observe={}),c[b]=c[b]||d))},canObserveProperty:function(a){return b.indexOf(a)<0},explodeObservers:function(a){var b=a.observe;if(b){var c={};for(var d in b)for(var e,f=d.split(" "),g=0;e=f[g];g++)c[e]=b[d];a.observe=c}},optimizePropertyMaps:function(a){if(a.observe){var b=a._observeNames=[];for(var c in a.observe)for(var d,e=c.split(" "),f=0;d=e[f];f++)b.push(d)}if(a.publish){var b=a._publishNames=[];for(var c in a.publish)b.push(c)}if(a.computed){var b=a._computedNames=[];for(var c in a.computed)b.push(c)}},publishProperties:function(a,b){var c=a.publish;c&&(this.requireProperties(c,a,b),this.filterInvalidAccessorNames(c),a._publishLC=this.lowerCaseMap(c));var d=a.computed;d&&this.filterInvalidAccessorNames(d)},filterInvalidAccessorNames:function(a){for(var b in a)this.propertyNameBlacklist[b]&&(console.warn('Cannot define property "'+b+'" for element "'+this.name+'" because it has the same name as an HTMLElement property, and not all browsers support overriding that. Consider giving it a different name.'),delete a[b])},requireProperties:function(a,b){b.reflect=b.reflect||{};for(var c in a){var d=a[c];d&&void 0!==d.reflect&&(b.reflect[c]=Boolean(d.reflect),d=d.value),void 0!==d&&(b[c]=d)}},lowerCaseMap:function(a){var b={};for(var c in a)b[c.toLowerCase()]=c;return b},createPropertyAccessor:function(a,b){var c=this.prototype,d=a+"_",e=a+"Observable_";c[d]=c[a],Object.defineProperty(c,a,{get:function(){var a=this[e];return a&&a.deliver(),this[d]},set:function(c){if(b)return this[d];var f=this[e];if(f)return void f.setValue(c);var g=this[d];return this[d]=c,this.emitPropertyChangeRecord(a,c,g),c},configurable:!0})},createPropertyAccessors:function(a){var b=a._computedNames;if(b&&b.length)for(var c,d=0,e=b.length;e>d&&(c=b[d]);d++)this.createPropertyAccessor(c,!0);var b=a._publishNames;if(b&&b.length)for(var c,d=0,e=b.length;e>d&&(c=b[d]);d++)a.computed&&a.computed[c]||this.createPropertyAccessor(c)},propertyNameBlacklist:{children:1,"class":1,id:1,hidden:1,style:1,title:1}};a.api.declaration.properties=c}(Polymer),function(a){var b="attributes",c=/\s|,/,d={inheritAttributesObjects:function(a){this.inheritObject(a,"publishLC"),this.inheritObject(a,"_instanceAttributes")},publishAttributes:function(a){var d=this.getAttribute(b);if(d)for(var e,f=a.publish||(a.publish={}),g=d.split(c),h=0,i=g.length;i>h;h++)e=g[h].trim(),e&&void 0===f[e]&&(f[e]=void 0)},accumulateInstanceAttributes:function(){for(var a,b=this.prototype._instanceAttributes,c=this.attributes,d=0,e=c.length;e>d&&(a=c[d]);d++)this.isInstanceAttribute(a.name)&&(b[a.name]=a.value)},isInstanceAttribute:function(a){return!this.blackList[a]&&"on-"!==a.slice(0,3)},blackList:{name:1,"extends":1,constructor:1,noscript:1,assetpath:1,"cache-csstext":1}};d.blackList[b]=1,a.api.declaration.attributes=d}(Polymer),function(a){var b=a.api.declaration.events,c=new PolymerExpressions,d=c.prepareBinding;c.prepareBinding=function(a,e,f){return b.prepareEventBinding(a,e,f)||d.call(c,a,e,f)};var e={syntax:c,fetchTemplate:function(){return this.querySelector("template")},templateContent:function(){var a=this.fetchTemplate();return a&&a.content},installBindingDelegate:function(a){a&&(a.bindingDelegate=this.syntax)}};a.api.declaration.mdv=e}(Polymer),function(a){function b(a){if(!Object.__proto__){var b=Object.getPrototypeOf(a);a.__proto__=b,d(b)&&(b.__proto__=Object.getPrototypeOf(b))}}var c=a.api,d=a.isBase,e=a.extend,f=window.ShadowDOMPolyfill,g={register:function(a,b){this.buildPrototype(a,b),this.registerPrototype(a,b),this.publishConstructor()},buildPrototype:function(b,c){var d=a.getRegisteredPrototype(b),e=this.generateBasePrototype(c);this.desugarBeforeChaining(d,e),this.prototype=this.chainPrototypes(d,e),this.desugarAfterChaining(b,c)},desugarBeforeChaining:function(a,b){a.element=this,this.publishAttributes(a,b),this.publishProperties(a,b),this.inferObservers(a),this.explodeObservers(a)},chainPrototypes:function(a,c){this.inheritMetaData(a,c);var d=this.chainObject(a,c);return b(d),d},inheritMetaData:function(a,b){this.inheritObject("observe",a,b),this.inheritObject("publish",a,b),this.inheritObject("reflect",a,b),this.inheritObject("_publishLC",a,b),this.inheritObject("_instanceAttributes",a,b),this.inheritObject("eventDelegates",a,b)},desugarAfterChaining:function(a,b){this.optimizePropertyMaps(this.prototype),this.createPropertyAccessors(this.prototype),this.installBindingDelegate(this.fetchTemplate()),this.installSheets(),this.resolveElementPaths(this),this.accumulateInstanceAttributes(),this.parseHostEvents(),this.addResolvePathApi(),f&&WebComponents.ShadowCSS.shimStyling(this.templateContent(),a,b),this.prototype.registerCallback&&this.prototype.registerCallback(this)},publishConstructor:function(){var a=this.getAttribute("constructor");a&&(window[a]=this.ctor)},generateBasePrototype:function(a){var b=this.findBasePrototype(a);if(!b){var b=HTMLElement.getPrototypeForTag(a);b=this.ensureBaseApi(b),h[a]=b}return b},findBasePrototype:function(a){return h[a]},ensureBaseApi:function(a){if(a.PolymerBase)return a;var b=Object.create(a);return c.publish(c.instance,b),this.mixinMethod(b,a,c.instance.mdv,"bind"),b},mixinMethod:function(a,b,c,d){var e=function(a){return b[d].apply(this,a)};a[d]=function(){return this.mixinSuper=e,c[d].apply(this,arguments)}},inheritObject:function(a,b,c){var d=b[a]||{};b[a]=this.chainObject(d,c[a])},registerPrototype:function(a,b){var c={prototype:this.prototype},d=this.findTypeExtension(b);d&&(c["extends"]=d),HTMLElement.register(a,this.prototype),this.ctor=document.registerElement(a,c)},findTypeExtension:function(a){if(a&&a.indexOf("-")<0)return a;var b=this.findBasePrototype(a);return b.element?this.findTypeExtension(b.element["extends"]):void 0}},h={};g.chainObject=Object.__proto__?function(a,b){return a&&b&&a!==b&&(a.__proto__=b),a}:function(a,b){if(a&&b&&a!==b){var c=Object.create(b);a=e(c,a)}return a},c.declaration.prototype=g}(Polymer),function(a){function b(a){return document.contains(a)?j:i}function c(){return i.length?i[0]:j[0]}function d(a){f.waitToReady=!0,Polymer.endOfMicrotask(function(){HTMLImports.whenReady(function(){f.addReadyCallback(a),f.waitToReady=!1,f.check()})})}function e(a){if(void 0===a)return void f.ready();var b=setTimeout(function(){f.ready()},a);Polymer.whenReady(function(){clearTimeout(b)})}var f={wait:function(a){a.__queue||(a.__queue={},g.push(a))},enqueue:function(a,c,d){var e=a.__queue&&!a.__queue.check;return e&&(b(a).push(a),a.__queue.check=c,a.__queue.go=d),0!==this.indexOf(a)},indexOf:function(a){var c=b(a).indexOf(a);return c>=0&&document.contains(a)&&(c+=HTMLImports.useNative||HTMLImports.ready?i.length:1e9),c},go:function(a){var b=this.remove(a);b&&(a.__queue.flushable=!0,this.addToFlushQueue(b),this.check())},remove:function(a){var c=this.indexOf(a);if(0===c)return b(a).shift()},check:function(){var a=this.nextElement();return a&&a.__queue.check.call(a),this.canReady()?(this.ready(),!0):void 0},nextElement:function(){return c()},canReady:function(){return!this.waitToReady&&this.isEmpty()},isEmpty:function(){for(var a,b=0,c=g.length;c>b&&(a=g[b]);b++)if(a.__queue&&!a.__queue.flushable)return;return!0},addToFlushQueue:function(a){h.push(a)},flush:function(){if(!this.flushing){this.flushing=!0;for(var a;h.length;)a=h.shift(),a.__queue.go.call(a),a.__queue=null;this.flushing=!1}},ready:function(){var a=CustomElements.ready;CustomElements.ready=!1,this.flush(),CustomElements.useNative||CustomElements.upgradeDocumentTree(document),CustomElements.ready=a,Polymer.flush(),requestAnimationFrame(this.flushReadyCallbacks)},addReadyCallback:function(a){a&&k.push(a)},flushReadyCallbacks:function(){if(k)for(var a;k.length;)(a=k.shift())()},waitingFor:function(){for(var a,b=[],c=0,d=g.length;d>c&&(a=g[c]);c++)a.__queue&&!a.__queue.flushable&&b.push(a);return b},waitToReady:!0},g=[],h=[],i=[],j=[],k=[];a.elements=g,a.waitingFor=f.waitingFor.bind(f),a.forceReady=e,a.queue=f,a.whenReady=a.whenPolymerReady=d}(Polymer),function(a){function b(a){return Boolean(HTMLElement.getPrototypeForTag(a))}function c(a){return a&&a.indexOf("-")>=0}var d=a.extend,e=a.api,f=a.queue,g=a.whenReady,h=a.getRegisteredPrototype,i=a.waitingForPrototype,j=d(Object.create(HTMLElement.prototype),{createdCallback:function(){this.getAttribute("name")&&this.init()},init:function(){this.name=this.getAttribute("name"),this["extends"]=this.getAttribute("extends"),f.wait(this),this.loadResources(),this.registerWhenReady()},registerWhenReady:function(){this.registered||this.waitingForPrototype(this.name)||this.waitingForQueue()||this.waitingForResources()||f.go(this)},_register:function(){c(this["extends"])&&!b(this["extends"])&&console.warn("%s is attempting to extend %s, an unregistered element or one that was not registered with Polymer.",this.name,this["extends"]),this.register(this.name,this["extends"]),this.registered=!0},waitingForPrototype:function(a){return h(a)?void 0:(i(a,this),this.handleNoScript(a),!0)},handleNoScript:function(a){this.hasAttribute("noscript")&&!this.noscript&&(this.noscript=!0,Polymer(a))},waitingForResources:function(){return this._needsResources},waitingForQueue:function(){return f.enqueue(this,this.registerWhenReady,this._register)},loadResources:function(){this._needsResources=!0,this.loadStyles(function(){this._needsResources=!1,this.registerWhenReady()}.bind(this))}});e.publish(e.declaration,j),g(function(){document.body.removeAttribute("unresolved"),document.dispatchEvent(new CustomEvent("polymer-ready",{bubbles:!0}))}),document.registerElement("polymer-element",{prototype:j})}(Polymer),function(a){function b(a,b){a?(document.head.appendChild(a),d(b)):b&&b()}function c(a,c){if(a&&a.length){for(var d,e,f=document.createDocumentFragment(),g=0,h=a.length;h>g&&(d=a[g]);g++)e=document.createElement("link"),e.rel="import",e.href=d,f.appendChild(e);b(f,c)}else c&&c()}var d=a.whenReady;a["import"]=c,a.importElements=b}(Polymer),function(){var a=document.createElement("polymer-element");a.setAttribute("name","auto-binding"),a.setAttribute("extends","template"),a.init(),Polymer("auto-binding",{createdCallback:function(){this.syntax=this.bindingDelegate=this.makeSyntax(),Polymer.whenPolymerReady(function(){this.model=this,this.setAttribute("bind",""),this.async(function(){this.marshalNodeReferences(this.parentNode),this.fire("template-bound")})}.bind(this))},makeSyntax:function(){var a=Object.create(Polymer.api.declaration.events),b=this;a.findController=function(){return b.model};var c=new PolymerExpressions,d=c.prepareBinding;return c.prepareBinding=function(b,e,f){return a.prepareEventBinding(b,e,f)||d.call(c,b,e,f)},c}})}(); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/.bower.json b/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/.bower.json
deleted file mode 100644
index e763b61c2da..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/.bower.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "name": "webcomponentsjs",
- "main": "webcomponents.js",
- "version": "0.5.5",
- "homepage": "http://webcomponents.org",
- "authors": [
- "The Polymer Authors"
- ],
- "keywords": [
- "webcomponents"
- ],
- "license": "BSD",
- "ignore": [],
- "_release": "0.5.5",
- "_resolution": {
- "type": "version",
- "tag": "0.5.5",
- "commit": "46f8f2665f7b91e3f248bc9bdb20a29b91f921b5"
- },
- "_source": "git://github.com/Polymer/webcomponentsjs.git",
- "_target": "^0.5",
- "_originalSource": "Polymer/webcomponentsjs"
-} \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/CustomElements.js b/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/CustomElements.js
deleted file mode 100644
index 8ec15f6b8c2..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/CustomElements.js
+++ /dev/null
@@ -1,634 +0,0 @@
-/**
- * @license
- * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
- */
-// @version 0.5.5
-if (typeof WeakMap === "undefined") {
- (function() {
- var defineProperty = Object.defineProperty;
- var counter = Date.now() % 1e9;
- var WeakMap = function() {
- this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
- };
- WeakMap.prototype = {
- set: function(key, value) {
- var entry = key[this.name];
- if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {
- value: [ key, value ],
- writable: true
- });
- return this;
- },
- get: function(key) {
- var entry;
- return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
- },
- "delete": function(key) {
- var entry = key[this.name];
- if (!entry || entry[0] !== key) return false;
- entry[0] = entry[1] = undefined;
- return true;
- },
- has: function(key) {
- var entry = key[this.name];
- if (!entry) return false;
- return entry[0] === key;
- }
- };
- window.WeakMap = WeakMap;
- })();
-}
-
-window.CustomElements = window.CustomElements || {
- flags: {}
-};
-
-(function(scope) {
- var flags = scope.flags;
- var modules = [];
- var addModule = function(module) {
- modules.push(module);
- };
- var initializeModules = function() {
- modules.forEach(function(module) {
- module(scope);
- });
- };
- scope.addModule = addModule;
- scope.initializeModules = initializeModules;
- scope.hasNative = Boolean(document.registerElement);
- scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || HTMLImports.useNative);
-})(CustomElements);
-
-CustomElements.addModule(function(scope) {
- var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : "none";
- function forSubtree(node, cb) {
- findAllElements(node, function(e) {
- if (cb(e)) {
- return true;
- }
- forRoots(e, cb);
- });
- forRoots(node, cb);
- }
- function findAllElements(node, find, data) {
- var e = node.firstElementChild;
- if (!e) {
- e = node.firstChild;
- while (e && e.nodeType !== Node.ELEMENT_NODE) {
- e = e.nextSibling;
- }
- }
- while (e) {
- if (find(e, data) !== true) {
- findAllElements(e, find, data);
- }
- e = e.nextElementSibling;
- }
- return null;
- }
- function forRoots(node, cb) {
- var root = node.shadowRoot;
- while (root) {
- forSubtree(root, cb);
- root = root.olderShadowRoot;
- }
- }
- var processingDocuments;
- function forDocumentTree(doc, cb) {
- processingDocuments = [];
- _forDocumentTree(doc, cb);
- processingDocuments = null;
- }
- function _forDocumentTree(doc, cb) {
- doc = wrap(doc);
- if (processingDocuments.indexOf(doc) >= 0) {
- return;
- }
- processingDocuments.push(doc);
- var imports = doc.querySelectorAll("link[rel=" + IMPORT_LINK_TYPE + "]");
- for (var i = 0, l = imports.length, n; i < l && (n = imports[i]); i++) {
- if (n.import) {
- _forDocumentTree(n.import, cb);
- }
- }
- cb(doc);
- }
- scope.forDocumentTree = forDocumentTree;
- scope.forSubtree = forSubtree;
-});
-
-CustomElements.addModule(function(scope) {
- var flags = scope.flags;
- var forSubtree = scope.forSubtree;
- var forDocumentTree = scope.forDocumentTree;
- function addedNode(node) {
- return added(node) || addedSubtree(node);
- }
- function added(node) {
- if (scope.upgrade(node)) {
- return true;
- }
- attached(node);
- }
- function addedSubtree(node) {
- forSubtree(node, function(e) {
- if (added(e)) {
- return true;
- }
- });
- }
- function attachedNode(node) {
- attached(node);
- if (inDocument(node)) {
- forSubtree(node, function(e) {
- attached(e);
- });
- }
- }
- var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
- scope.hasPolyfillMutations = hasPolyfillMutations;
- var isPendingMutations = false;
- var pendingMutations = [];
- function deferMutation(fn) {
- pendingMutations.push(fn);
- if (!isPendingMutations) {
- isPendingMutations = true;
- setTimeout(takeMutations);
- }
- }
- function takeMutations() {
- isPendingMutations = false;
- var $p = pendingMutations;
- for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
- p();
- }
- pendingMutations = [];
- }
- function attached(element) {
- if (hasPolyfillMutations) {
- deferMutation(function() {
- _attached(element);
- });
- } else {
- _attached(element);
- }
- }
- function _attached(element) {
- if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
- if (!element.__attached && inDocument(element)) {
- element.__attached = true;
- if (element.attachedCallback) {
- element.attachedCallback();
- }
- }
- }
- }
- function detachedNode(node) {
- detached(node);
- forSubtree(node, function(e) {
- detached(e);
- });
- }
- function detached(element) {
- if (hasPolyfillMutations) {
- deferMutation(function() {
- _detached(element);
- });
- } else {
- _detached(element);
- }
- }
- function _detached(element) {
- if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
- if (element.__attached && !inDocument(element)) {
- element.__attached = false;
- if (element.detachedCallback) {
- element.detachedCallback();
- }
- }
- }
- }
- function inDocument(element) {
- var p = element;
- var doc = wrap(document);
- while (p) {
- if (p == doc) {
- return true;
- }
- p = p.parentNode || p.host;
- }
- }
- function watchShadow(node) {
- if (node.shadowRoot && !node.shadowRoot.__watched) {
- flags.dom && console.log("watching shadow-root for: ", node.localName);
- var root = node.shadowRoot;
- while (root) {
- observe(root);
- root = root.olderShadowRoot;
- }
- }
- }
- function handler(mutations) {
- if (flags.dom) {
- var mx = mutations[0];
- if (mx && mx.type === "childList" && mx.addedNodes) {
- if (mx.addedNodes) {
- var d = mx.addedNodes[0];
- while (d && d !== document && !d.host) {
- d = d.parentNode;
- }
- var u = d && (d.URL || d._URL || d.host && d.host.localName) || "";
- u = u.split("/?").shift().split("/").pop();
- }
- }
- console.group("mutations (%d) [%s]", mutations.length, u || "");
- }
- mutations.forEach(function(mx) {
- if (mx.type === "childList") {
- forEach(mx.addedNodes, function(n) {
- if (!n.localName) {
- return;
- }
- addedNode(n);
- });
- forEach(mx.removedNodes, function(n) {
- if (!n.localName) {
- return;
- }
- detachedNode(n);
- });
- }
- });
- flags.dom && console.groupEnd();
- }
- function takeRecords(node) {
- node = wrap(node);
- if (!node) {
- node = wrap(document);
- }
- while (node.parentNode) {
- node = node.parentNode;
- }
- var observer = node.__observer;
- if (observer) {
- handler(observer.takeRecords());
- takeMutations();
- }
- }
- var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
- function observe(inRoot) {
- if (inRoot.__observer) {
- return;
- }
- var observer = new MutationObserver(handler);
- observer.observe(inRoot, {
- childList: true,
- subtree: true
- });
- inRoot.__observer = observer;
- }
- function upgradeDocument(doc) {
- doc = wrap(doc);
- flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
- addedNode(doc);
- observe(doc);
- flags.dom && console.groupEnd();
- }
- function upgradeDocumentTree(doc) {
- forDocumentTree(doc, upgradeDocument);
- }
- var originalCreateShadowRoot = Element.prototype.createShadowRoot;
- if (originalCreateShadowRoot) {
- Element.prototype.createShadowRoot = function() {
- var root = originalCreateShadowRoot.call(this);
- CustomElements.watchShadow(this);
- return root;
- };
- }
- scope.watchShadow = watchShadow;
- scope.upgradeDocumentTree = upgradeDocumentTree;
- scope.upgradeSubtree = addedSubtree;
- scope.upgradeAll = addedNode;
- scope.attachedNode = attachedNode;
- scope.takeRecords = takeRecords;
-});
-
-CustomElements.addModule(function(scope) {
- var flags = scope.flags;
- function upgrade(node) {
- if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
- var is = node.getAttribute("is");
- var definition = scope.getRegisteredDefinition(is || node.localName);
- if (definition) {
- if (is && definition.tag == node.localName) {
- return upgradeWithDefinition(node, definition);
- } else if (!is && !definition.extends) {
- return upgradeWithDefinition(node, definition);
- }
- }
- }
- }
- function upgradeWithDefinition(element, definition) {
- flags.upgrade && console.group("upgrade:", element.localName);
- if (definition.is) {
- element.setAttribute("is", definition.is);
- }
- implementPrototype(element, definition);
- element.__upgraded__ = true;
- created(element);
- scope.attachedNode(element);
- scope.upgradeSubtree(element);
- flags.upgrade && console.groupEnd();
- return element;
- }
- function implementPrototype(element, definition) {
- if (Object.__proto__) {
- element.__proto__ = definition.prototype;
- } else {
- customMixin(element, definition.prototype, definition.native);
- element.__proto__ = definition.prototype;
- }
- }
- function customMixin(inTarget, inSrc, inNative) {
- var used = {};
- var p = inSrc;
- while (p !== inNative && p !== HTMLElement.prototype) {
- var keys = Object.getOwnPropertyNames(p);
- for (var i = 0, k; k = keys[i]; i++) {
- if (!used[k]) {
- Object.defineProperty(inTarget, k, Object.getOwnPropertyDescriptor(p, k));
- used[k] = 1;
- }
- }
- p = Object.getPrototypeOf(p);
- }
- }
- function created(element) {
- if (element.createdCallback) {
- element.createdCallback();
- }
- }
- scope.upgrade = upgrade;
- scope.upgradeWithDefinition = upgradeWithDefinition;
- scope.implementPrototype = implementPrototype;
-});
-
-CustomElements.addModule(function(scope) {
- var upgradeDocumentTree = scope.upgradeDocumentTree;
- var upgrade = scope.upgrade;
- var upgradeWithDefinition = scope.upgradeWithDefinition;
- var implementPrototype = scope.implementPrototype;
- var useNative = scope.useNative;
- function register(name, options) {
- var definition = options || {};
- if (!name) {
- throw new Error("document.registerElement: first argument `name` must not be empty");
- }
- if (name.indexOf("-") < 0) {
- throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(name) + "'.");
- }
- if (isReservedTag(name)) {
- throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '" + String(name) + "'. The type name is invalid.");
- }
- if (getRegisteredDefinition(name)) {
- throw new Error("DuplicateDefinitionError: a type with name '" + String(name) + "' is already registered");
- }
- if (!definition.prototype) {
- definition.prototype = Object.create(HTMLElement.prototype);
- }
- definition.__name = name.toLowerCase();
- definition.lifecycle = definition.lifecycle || {};
- definition.ancestry = ancestry(definition.extends);
- resolveTagName(definition);
- resolvePrototypeChain(definition);
- overrideAttributeApi(definition.prototype);
- registerDefinition(definition.__name, definition);
- definition.ctor = generateConstructor(definition);
- definition.ctor.prototype = definition.prototype;
- definition.prototype.constructor = definition.ctor;
- if (scope.ready) {
- upgradeDocumentTree(document);
- }
- return definition.ctor;
- }
- function overrideAttributeApi(prototype) {
- if (prototype.setAttribute._polyfilled) {
- return;
- }
- var setAttribute = prototype.setAttribute;
- prototype.setAttribute = function(name, value) {
- changeAttribute.call(this, name, value, setAttribute);
- };
- var removeAttribute = prototype.removeAttribute;
- prototype.removeAttribute = function(name) {
- changeAttribute.call(this, name, null, removeAttribute);
- };
- prototype.setAttribute._polyfilled = true;
- }
- function changeAttribute(name, value, operation) {
- name = name.toLowerCase();
- var oldValue = this.getAttribute(name);
- operation.apply(this, arguments);
- var newValue = this.getAttribute(name);
- if (this.attributeChangedCallback && newValue !== oldValue) {
- this.attributeChangedCallback(name, oldValue, newValue);
- }
- }
- function isReservedTag(name) {
- for (var i = 0; i < reservedTagList.length; i++) {
- if (name === reservedTagList[i]) {
- return true;
- }
- }
- }
- var reservedTagList = [ "annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph" ];
- function ancestry(extnds) {
- var extendee = getRegisteredDefinition(extnds);
- if (extendee) {
- return ancestry(extendee.extends).concat([ extendee ]);
- }
- return [];
- }
- function resolveTagName(definition) {
- var baseTag = definition.extends;
- for (var i = 0, a; a = definition.ancestry[i]; i++) {
- baseTag = a.is && a.tag;
- }
- definition.tag = baseTag || definition.__name;
- if (baseTag) {
- definition.is = definition.__name;
- }
- }
- function resolvePrototypeChain(definition) {
- if (!Object.__proto__) {
- var nativePrototype = HTMLElement.prototype;
- if (definition.is) {
- var inst = document.createElement(definition.tag);
- var expectedPrototype = Object.getPrototypeOf(inst);
- if (expectedPrototype === definition.prototype) {
- nativePrototype = expectedPrototype;
- }
- }
- var proto = definition.prototype, ancestor;
- while (proto && proto !== nativePrototype) {
- ancestor = Object.getPrototypeOf(proto);
- proto.__proto__ = ancestor;
- proto = ancestor;
- }
- definition.native = nativePrototype;
- }
- }
- function instantiate(definition) {
- return upgradeWithDefinition(domCreateElement(definition.tag), definition);
- }
- var registry = {};
- function getRegisteredDefinition(name) {
- if (name) {
- return registry[name.toLowerCase()];
- }
- }
- function registerDefinition(name, definition) {
- registry[name] = definition;
- }
- function generateConstructor(definition) {
- return function() {
- return instantiate(definition);
- };
- }
- var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
- function createElementNS(namespace, tag, typeExtension) {
- if (namespace === HTML_NAMESPACE) {
- return createElement(tag, typeExtension);
- } else {
- return domCreateElementNS(namespace, tag);
- }
- }
- function createElement(tag, typeExtension) {
- var definition = getRegisteredDefinition(typeExtension || tag);
- if (definition) {
- if (tag == definition.tag && typeExtension == definition.is) {
- return new definition.ctor();
- }
- if (!typeExtension && !definition.is) {
- return new definition.ctor();
- }
- }
- var element;
- if (typeExtension) {
- element = createElement(tag);
- element.setAttribute("is", typeExtension);
- return element;
- }
- element = domCreateElement(tag);
- if (tag.indexOf("-") >= 0) {
- implementPrototype(element, HTMLElement);
- }
- return element;
- }
- function cloneNode(deep) {
- var n = domCloneNode.call(this, deep);
- upgrade(n);
- return n;
- }
- var domCreateElement = document.createElement.bind(document);
- var domCreateElementNS = document.createElementNS.bind(document);
- var domCloneNode = Node.prototype.cloneNode;
- var isInstance;
- if (!Object.__proto__ && !useNative) {
- isInstance = function(obj, ctor) {
- var p = obj;
- while (p) {
- if (p === ctor.prototype) {
- return true;
- }
- p = p.__proto__;
- }
- return false;
- };
- } else {
- isInstance = function(obj, base) {
- return obj instanceof base;
- };
- }
- document.registerElement = register;
- document.createElement = createElement;
- document.createElementNS = createElementNS;
- Node.prototype.cloneNode = cloneNode;
- scope.registry = registry;
- scope.instanceof = isInstance;
- scope.reservedTagList = reservedTagList;
- scope.getRegisteredDefinition = getRegisteredDefinition;
- document.register = document.registerElement;
-});
-
-(function(scope) {
- var useNative = scope.useNative;
- var initializeModules = scope.initializeModules;
- var isIE11OrOlder = /Trident/.test(navigator.userAgent);
- if (useNative) {
- var nop = function() {};
- scope.watchShadow = nop;
- scope.upgrade = nop;
- scope.upgradeAll = nop;
- scope.upgradeDocumentTree = nop;
- scope.upgradeSubtree = nop;
- scope.takeRecords = nop;
- scope.instanceof = function(obj, base) {
- return obj instanceof base;
- };
- } else {
- initializeModules();
- }
- var upgradeDocumentTree = scope.upgradeDocumentTree;
- if (!window.wrap) {
- if (window.ShadowDOMPolyfill) {
- window.wrap = ShadowDOMPolyfill.wrapIfNeeded;
- window.unwrap = ShadowDOMPolyfill.unwrapIfNeeded;
- } else {
- window.wrap = window.unwrap = function(node) {
- return node;
- };
- }
- }
- function bootstrap() {
- upgradeDocumentTree(wrap(document));
- if (window.HTMLImports) {
- HTMLImports.__importsParsingHook = function(elt) {
- upgradeDocumentTree(wrap(elt.import));
- };
- }
- CustomElements.ready = true;
- setTimeout(function() {
- CustomElements.readyTime = Date.now();
- if (window.HTMLImports) {
- CustomElements.elapsed = CustomElements.readyTime - HTMLImports.readyTime;
- }
- document.dispatchEvent(new CustomEvent("WebComponentsReady", {
- bubbles: true
- }));
- });
- }
- if (isIE11OrOlder && typeof window.CustomEvent !== "function") {
- window.CustomEvent = function(inType, params) {
- params = params || {};
- var e = document.createEvent("CustomEvent");
- e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
- return e;
- };
- window.CustomEvent.prototype = window.Event.prototype;
- }
- if (document.readyState === "complete" || scope.flags.eager) {
- bootstrap();
- } else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) {
- bootstrap();
- } else {
- var loadEvent = window.HTMLImports && !HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
- window.addEventListener(loadEvent, bootstrap);
- }
-})(window.CustomElements); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/CustomElements.min.js b/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/CustomElements.min.js
deleted file mode 100644
index c29c57e3f81..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/CustomElements.min.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @license
- * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
- */
-// @version 0.5.5
-"undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,o=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};o.prototype={set:function(t,o){var n=t[this.name];return n&&n[0]===t?n[1]=o:e(t,this.name,{value:[t,o],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=o}(),window.CustomElements=window.CustomElements||{flags:{}},function(e){var t=e.flags,o=[],n=function(e){o.push(e)},r=function(){o.forEach(function(t){t(e)})};e.addModule=n,e.initializeModules=r,e.hasNative=Boolean(document.registerElement),e.useNative=!t.register&&e.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||HTMLImports.useNative)}(CustomElements),CustomElements.addModule(function(e){function t(e,t){o(e,function(e){return t(e)?!0:void n(e,t)}),n(e,t)}function o(e,t,n){var r=e.firstElementChild;if(!r)for(r=e.firstChild;r&&r.nodeType!==Node.ELEMENT_NODE;)r=r.nextSibling;for(;r;)t(r,n)!==!0&&o(r,t,n),r=r.nextElementSibling;return null}function n(e,o){for(var n=e.shadowRoot;n;)t(n,o),n=n.olderShadowRoot}function r(e,t){i=[],a(e,t),i=null}function a(e,t){if(e=wrap(e),!(i.indexOf(e)>=0)){i.push(e);for(var o,n=e.querySelectorAll("link[rel="+u+"]"),r=0,d=n.length;d>r&&(o=n[r]);r++)o["import"]&&a(o["import"],t);t(e)}}var i,u=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none";e.forDocumentTree=r,e.forSubtree=t}),CustomElements.addModule(function(e){function t(e){return o(e)||n(e)}function o(t){return e.upgrade(t)?!0:void u(t)}function n(e){y(e,function(e){return o(e)?!0:void 0})}function r(e){u(e),f(e)&&y(e,function(e){u(e)})}function a(e){M.push(e),C||(C=!0,setTimeout(i))}function i(){C=!1;for(var e,t=M,o=0,n=t.length;n>o&&(e=t[o]);o++)e();M=[]}function u(e){E?a(function(){d(e)}):d(e)}function d(e){e.__upgraded__&&(e.attachedCallback||e.detachedCallback)&&!e.__attached&&f(e)&&(e.__attached=!0,e.attachedCallback&&e.attachedCallback())}function c(e){s(e),y(e,function(e){s(e)})}function s(e){E?a(function(){l(e)}):l(e)}function l(e){e.__upgraded__&&(e.attachedCallback||e.detachedCallback)&&e.__attached&&!f(e)&&(e.__attached=!1,e.detachedCallback&&e.detachedCallback())}function f(e){for(var t=e,o=wrap(document);t;){if(t==o)return!0;t=t.parentNode||t.host}}function p(e){if(e.shadowRoot&&!e.shadowRoot.__watched){_.dom&&console.log("watching shadow-root for: ",e.localName);for(var t=e.shadowRoot;t;)h(t),t=t.olderShadowRoot}}function m(e){if(_.dom){var o=e[0];if(o&&"childList"===o.type&&o.addedNodes&&o.addedNodes){for(var n=o.addedNodes[0];n&&n!==document&&!n.host;)n=n.parentNode;var r=n&&(n.URL||n._URL||n.host&&n.host.localName)||"";r=r.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",e.length,r||"")}e.forEach(function(e){"childList"===e.type&&(N(e.addedNodes,function(e){e.localName&&t(e)}),N(e.removedNodes,function(e){e.localName&&c(e)}))}),_.dom&&console.groupEnd()}function w(e){for(e=wrap(e),e||(e=wrap(document));e.parentNode;)e=e.parentNode;var t=e.__observer;t&&(m(t.takeRecords()),i())}function h(e){if(!e.__observer){var t=new MutationObserver(m);t.observe(e,{childList:!0,subtree:!0}),e.__observer=t}}function g(e){e=wrap(e),_.dom&&console.group("upgradeDocument: ",e.baseURI.split("/").pop()),t(e),h(e),_.dom&&console.groupEnd()}function v(e){b(e,g)}var _=e.flags,y=e.forSubtree,b=e.forDocumentTree,E=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;e.hasPolyfillMutations=E;var C=!1,M=[],N=Array.prototype.forEach.call.bind(Array.prototype.forEach),T=Element.prototype.createShadowRoot;T&&(Element.prototype.createShadowRoot=function(){var e=T.call(this);return CustomElements.watchShadow(this),e}),e.watchShadow=p,e.upgradeDocumentTree=v,e.upgradeSubtree=n,e.upgradeAll=t,e.attachedNode=r,e.takeRecords=w}),CustomElements.addModule(function(e){function t(t){if(!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var n=t.getAttribute("is"),r=e.getRegisteredDefinition(n||t.localName);if(r){if(n&&r.tag==t.localName)return o(t,r);if(!n&&!r["extends"])return o(t,r)}}}function o(t,o){return i.upgrade&&console.group("upgrade:",t.localName),o.is&&t.setAttribute("is",o.is),n(t,o),t.__upgraded__=!0,a(t),e.attachedNode(t),e.upgradeSubtree(t),i.upgrade&&console.groupEnd(),t}function n(e,t){Object.__proto__?e.__proto__=t.prototype:(r(e,t.prototype,t["native"]),e.__proto__=t.prototype)}function r(e,t,o){for(var n={},r=t;r!==o&&r!==HTMLElement.prototype;){for(var a,i=Object.getOwnPropertyNames(r),u=0;a=i[u];u++)n[a]||(Object.defineProperty(e,a,Object.getOwnPropertyDescriptor(r,a)),n[a]=1);r=Object.getPrototypeOf(r)}}function a(e){e.createdCallback&&e.createdCallback()}var i=e.flags;e.upgrade=t,e.upgradeWithDefinition=o,e.implementPrototype=n}),CustomElements.addModule(function(e){function t(t,n){var d=n||{};if(!t)throw new Error("document.registerElement: first argument `name` must not be empty");if(t.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(t)+"'.");if(r(t))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(t)+"'. The type name is invalid.");if(c(t))throw new Error("DuplicateDefinitionError: a type with name '"+String(t)+"' is already registered");return d.prototype||(d.prototype=Object.create(HTMLElement.prototype)),d.__name=t.toLowerCase(),d.lifecycle=d.lifecycle||{},d.ancestry=a(d["extends"]),i(d),u(d),o(d.prototype),s(d.__name,d),d.ctor=l(d),d.ctor.prototype=d.prototype,d.prototype.constructor=d.ctor,e.ready&&h(document),d.ctor}function o(e){if(!e.setAttribute._polyfilled){var t=e.setAttribute;e.setAttribute=function(e,o){n.call(this,e,o,t)};var o=e.removeAttribute;e.removeAttribute=function(e){n.call(this,e,null,o)},e.setAttribute._polyfilled=!0}}function n(e,t,o){e=e.toLowerCase();var n=this.getAttribute(e);o.apply(this,arguments);var r=this.getAttribute(e);this.attributeChangedCallback&&r!==n&&this.attributeChangedCallback(e,n,r)}function r(e){for(var t=0;t<b.length;t++)if(e===b[t])return!0}function a(e){var t=c(e);return t?a(t["extends"]).concat([t]):[]}function i(e){for(var t,o=e["extends"],n=0;t=e.ancestry[n];n++)o=t.is&&t.tag;e.tag=o||e.__name,o&&(e.is=e.__name)}function u(e){if(!Object.__proto__){var t=HTMLElement.prototype;if(e.is){var o=document.createElement(e.tag),n=Object.getPrototypeOf(o);n===e.prototype&&(t=n)}for(var r,a=e.prototype;a&&a!==t;)r=Object.getPrototypeOf(a),a.__proto__=r,a=r;e["native"]=t}}function d(e){return v(M(e.tag),e)}function c(e){return e?E[e.toLowerCase()]:void 0}function s(e,t){E[e]=t}function l(e){return function(){return d(e)}}function f(e,t,o){return e===C?p(t,o):N(e,t)}function p(e,t){var o=c(t||e);if(o){if(e==o.tag&&t==o.is)return new o.ctor;if(!t&&!o.is)return new o.ctor}var n;return t?(n=p(e),n.setAttribute("is",t),n):(n=M(e),e.indexOf("-")>=0&&_(n,HTMLElement),n)}function m(e){var t=T.call(this,e);return g(t),t}var w,h=e.upgradeDocumentTree,g=e.upgrade,v=e.upgradeWithDefinition,_=e.implementPrototype,y=e.useNative,b=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],E={},C="http://www.w3.org/1999/xhtml",M=document.createElement.bind(document),N=document.createElementNS.bind(document),T=Node.prototype.cloneNode;w=Object.__proto__||y?function(e,t){return e instanceof t}:function(e,t){for(var o=e;o;){if(o===t.prototype)return!0;o=o.__proto__}return!1},document.registerElement=t,document.createElement=p,document.createElementNS=f,Node.prototype.cloneNode=m,e.registry=E,e["instanceof"]=w,e.reservedTagList=b,e.getRegisteredDefinition=c,document.register=document.registerElement}),function(e){function t(){i(wrap(document)),window.HTMLImports&&(HTMLImports.__importsParsingHook=function(e){i(wrap(e["import"]))}),CustomElements.ready=!0,setTimeout(function(){CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}var o=e.useNative,n=e.initializeModules,r=/Trident/.test(navigator.userAgent);if(o){var a=function(){};e.watchShadow=a,e.upgrade=a,e.upgradeAll=a,e.upgradeDocumentTree=a,e.upgradeSubtree=a,e.takeRecords=a,e["instanceof"]=function(e,t){return e instanceof t}}else n();var i=e.upgradeDocumentTree;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){return e}),r&&"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e,t){t=t||{};var o=document.createEvent("CustomEvent");return o.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),o},window.CustomEvent.prototype=window.Event.prototype),"complete"===document.readyState||e.flags.eager)t();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var u=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(u,t)}else t()}(window.CustomElements); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/HTMLImports.js b/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/HTMLImports.js
deleted file mode 100644
index 9a194e14457..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/HTMLImports.js
+++ /dev/null
@@ -1,764 +0,0 @@
-/**
- * @license
- * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
- */
-// @version 0.5.5
-if (typeof WeakMap === "undefined") {
- (function() {
- var defineProperty = Object.defineProperty;
- var counter = Date.now() % 1e9;
- var WeakMap = function() {
- this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
- };
- WeakMap.prototype = {
- set: function(key, value) {
- var entry = key[this.name];
- if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {
- value: [ key, value ],
- writable: true
- });
- return this;
- },
- get: function(key) {
- var entry;
- return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
- },
- "delete": function(key) {
- var entry = key[this.name];
- if (!entry || entry[0] !== key) return false;
- entry[0] = entry[1] = undefined;
- return true;
- },
- has: function(key) {
- var entry = key[this.name];
- if (!entry) return false;
- return entry[0] === key;
- }
- };
- window.WeakMap = WeakMap;
- })();
-}
-
-window.HTMLImports = window.HTMLImports || {
- flags: {}
-};
-
-(function(scope) {
- var IMPORT_LINK_TYPE = "import";
- var useNative = Boolean(IMPORT_LINK_TYPE in document.createElement("link"));
- var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill);
- var wrap = function(node) {
- return hasShadowDOMPolyfill ? ShadowDOMPolyfill.wrapIfNeeded(node) : node;
- };
- var rootDocument = wrap(document);
- var currentScriptDescriptor = {
- get: function() {
- var script = HTMLImports.currentScript || document.currentScript || (document.readyState !== "complete" ? document.scripts[document.scripts.length - 1] : null);
- return wrap(script);
- },
- configurable: true
- };
- Object.defineProperty(document, "_currentScript", currentScriptDescriptor);
- Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor);
- var isIE = /Trident|Edge/.test(navigator.userAgent);
- function whenReady(callback, doc) {
- doc = doc || rootDocument;
- whenDocumentReady(function() {
- watchImportsLoad(callback, doc);
- }, doc);
- }
- var requiredReadyState = isIE ? "complete" : "interactive";
- var READY_EVENT = "readystatechange";
- function isDocumentReady(doc) {
- return doc.readyState === "complete" || doc.readyState === requiredReadyState;
- }
- function whenDocumentReady(callback, doc) {
- if (!isDocumentReady(doc)) {
- var checkReady = function() {
- if (doc.readyState === "complete" || doc.readyState === requiredReadyState) {
- doc.removeEventListener(READY_EVENT, checkReady);
- whenDocumentReady(callback, doc);
- }
- };
- doc.addEventListener(READY_EVENT, checkReady);
- } else if (callback) {
- callback();
- }
- }
- function markTargetLoaded(event) {
- event.target.__loaded = true;
- }
- function watchImportsLoad(callback, doc) {
- var imports = doc.querySelectorAll("link[rel=import]");
- var loaded = 0, l = imports.length;
- function checkDone(d) {
- if (loaded == l && callback) {
- callback();
- }
- }
- function loadedImport(e) {
- markTargetLoaded(e);
- loaded++;
- checkDone();
- }
- if (l) {
- for (var i = 0, imp; i < l && (imp = imports[i]); i++) {
- if (isImportLoaded(imp)) {
- loadedImport.call(imp, {
- target: imp
- });
- } else {
- imp.addEventListener("load", loadedImport);
- imp.addEventListener("error", loadedImport);
- }
- }
- } else {
- checkDone();
- }
- }
- function isImportLoaded(link) {
- return useNative ? link.__loaded || link.import && link.import.readyState !== "loading" : link.__importParsed;
- }
- if (useNative) {
- new MutationObserver(function(mxns) {
- for (var i = 0, l = mxns.length, m; i < l && (m = mxns[i]); i++) {
- if (m.addedNodes) {
- handleImports(m.addedNodes);
- }
- }
- }).observe(document.head, {
- childList: true
- });
- function handleImports(nodes) {
- for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
- if (isImport(n)) {
- handleImport(n);
- }
- }
- }
- function isImport(element) {
- return element.localName === "link" && element.rel === "import";
- }
- function handleImport(element) {
- var loaded = element.import;
- if (loaded) {
- markTargetLoaded({
- target: element
- });
- } else {
- element.addEventListener("load", markTargetLoaded);
- element.addEventListener("error", markTargetLoaded);
- }
- }
- (function() {
- if (document.readyState === "loading") {
- var imports = document.querySelectorAll("link[rel=import]");
- for (var i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i++) {
- handleImport(imp);
- }
- }
- })();
- }
- whenReady(function() {
- HTMLImports.ready = true;
- HTMLImports.readyTime = new Date().getTime();
- var evt = rootDocument.createEvent("CustomEvent");
- evt.initCustomEvent("HTMLImportsLoaded", true, true, {});
- rootDocument.dispatchEvent(evt);
- });
- scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE;
- scope.useNative = useNative;
- scope.rootDocument = rootDocument;
- scope.whenReady = whenReady;
- scope.isIE = isIE;
-})(HTMLImports);
-
-(function(scope) {
- var modules = [];
- var addModule = function(module) {
- modules.push(module);
- };
- var initializeModules = function() {
- modules.forEach(function(module) {
- module(scope);
- });
- };
- scope.addModule = addModule;
- scope.initializeModules = initializeModules;
-})(HTMLImports);
-
-HTMLImports.addModule(function(scope) {
- var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
- var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
- var path = {
- resolveUrlsInStyle: function(style) {
- var doc = style.ownerDocument;
- var resolver = doc.createElement("a");
- style.textContent = this.resolveUrlsInCssText(style.textContent, resolver);
- return style;
- },
- resolveUrlsInCssText: function(cssText, urlObj) {
- var r = this.replaceUrls(cssText, urlObj, CSS_URL_REGEXP);
- r = this.replaceUrls(r, urlObj, CSS_IMPORT_REGEXP);
- return r;
- },
- replaceUrls: function(text, urlObj, regexp) {
- return text.replace(regexp, function(m, pre, url, post) {
- var urlPath = url.replace(/["']/g, "");
- urlObj.href = urlPath;
- urlPath = urlObj.href;
- return pre + "'" + urlPath + "'" + post;
- });
- }
- };
- scope.path = path;
-});
-
-HTMLImports.addModule(function(scope) {
- var xhr = {
- async: true,
- ok: function(request) {
- return request.status >= 200 && request.status < 300 || request.status === 304 || request.status === 0;
- },
- load: function(url, next, nextContext) {
- var request = new XMLHttpRequest();
- if (scope.flags.debug || scope.flags.bust) {
- url += "?" + Math.random();
- }
- request.open("GET", url, xhr.async);
- request.addEventListener("readystatechange", function(e) {
- if (request.readyState === 4) {
- var locationHeader = request.getResponseHeader("Location");
- var redirectedUrl = null;
- if (locationHeader) {
- var redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
- }
- next.call(nextContext, !xhr.ok(request) && request, request.response || request.responseText, redirectedUrl);
- }
- });
- request.send();
- return request;
- },
- loadDocument: function(url, next, nextContext) {
- this.load(url, next, nextContext).responseType = "document";
- }
- };
- scope.xhr = xhr;
-});
-
-HTMLImports.addModule(function(scope) {
- var xhr = scope.xhr;
- var flags = scope.flags;
- var Loader = function(onLoad, onComplete) {
- this.cache = {};
- this.onload = onLoad;
- this.oncomplete = onComplete;
- this.inflight = 0;
- this.pending = {};
- };
- Loader.prototype = {
- addNodes: function(nodes) {
- this.inflight += nodes.length;
- for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
- this.require(n);
- }
- this.checkDone();
- },
- addNode: function(node) {
- this.inflight++;
- this.require(node);
- this.checkDone();
- },
- require: function(elt) {
- var url = elt.src || elt.href;
- elt.__nodeUrl = url;
- if (!this.dedupe(url, elt)) {
- this.fetch(url, elt);
- }
- },
- dedupe: function(url, elt) {
- if (this.pending[url]) {
- this.pending[url].push(elt);
- return true;
- }
- var resource;
- if (this.cache[url]) {
- this.onload(url, elt, this.cache[url]);
- this.tail();
- return true;
- }
- this.pending[url] = [ elt ];
- return false;
- },
- fetch: function(url, elt) {
- flags.load && console.log("fetch", url, elt);
- if (!url) {
- setTimeout(function() {
- this.receive(url, elt, {
- error: "href must be specified"
- }, null);
- }.bind(this), 0);
- } else if (url.match(/^data:/)) {
- var pieces = url.split(",");
- var header = pieces[0];
- var body = pieces[1];
- if (header.indexOf(";base64") > -1) {
- body = atob(body);
- } else {
- body = decodeURIComponent(body);
- }
- setTimeout(function() {
- this.receive(url, elt, null, body);
- }.bind(this), 0);
- } else {
- var receiveXhr = function(err, resource, redirectedUrl) {
- this.receive(url, elt, err, resource, redirectedUrl);
- }.bind(this);
- xhr.load(url, receiveXhr);
- }
- },
- receive: function(url, elt, err, resource, redirectedUrl) {
- this.cache[url] = resource;
- var $p = this.pending[url];
- for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
- this.onload(url, p, resource, err, redirectedUrl);
- this.tail();
- }
- this.pending[url] = null;
- },
- tail: function() {
- --this.inflight;
- this.checkDone();
- },
- checkDone: function() {
- if (!this.inflight) {
- this.oncomplete();
- }
- }
- };
- scope.Loader = Loader;
-});
-
-HTMLImports.addModule(function(scope) {
- var Observer = function(addCallback) {
- this.addCallback = addCallback;
- this.mo = new MutationObserver(this.handler.bind(this));
- };
- Observer.prototype = {
- handler: function(mutations) {
- for (var i = 0, l = mutations.length, m; i < l && (m = mutations[i]); i++) {
- if (m.type === "childList" && m.addedNodes.length) {
- this.addedNodes(m.addedNodes);
- }
- }
- },
- addedNodes: function(nodes) {
- if (this.addCallback) {
- this.addCallback(nodes);
- }
- for (var i = 0, l = nodes.length, n, loading; i < l && (n = nodes[i]); i++) {
- if (n.children && n.children.length) {
- this.addedNodes(n.children);
- }
- }
- },
- observe: function(root) {
- this.mo.observe(root, {
- childList: true,
- subtree: true
- });
- }
- };
- scope.Observer = Observer;
-});
-
-HTMLImports.addModule(function(scope) {
- var path = scope.path;
- var rootDocument = scope.rootDocument;
- var flags = scope.flags;
- var isIE = scope.isIE;
- var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
- var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]";
- var importParser = {
- documentSelectors: IMPORT_SELECTOR,
- importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]", "style", "script:not([type])", 'script[type="text/javascript"]' ].join(","),
- map: {
- link: "parseLink",
- script: "parseScript",
- style: "parseStyle"
- },
- dynamicElements: [],
- parseNext: function() {
- var next = this.nextToParse();
- if (next) {
- this.parse(next);
- }
- },
- parse: function(elt) {
- if (this.isParsed(elt)) {
- flags.parse && console.log("[%s] is already parsed", elt.localName);
- return;
- }
- var fn = this[this.map[elt.localName]];
- if (fn) {
- this.markParsing(elt);
- fn.call(this, elt);
- }
- },
- parseDynamic: function(elt, quiet) {
- this.dynamicElements.push(elt);
- if (!quiet) {
- this.parseNext();
- }
- },
- markParsing: function(elt) {
- flags.parse && console.log("parsing", elt);
- this.parsingElement = elt;
- },
- markParsingComplete: function(elt) {
- elt.__importParsed = true;
- this.markDynamicParsingComplete(elt);
- if (elt.__importElement) {
- elt.__importElement.__importParsed = true;
- this.markDynamicParsingComplete(elt.__importElement);
- }
- this.parsingElement = null;
- flags.parse && console.log("completed", elt);
- },
- markDynamicParsingComplete: function(elt) {
- var i = this.dynamicElements.indexOf(elt);
- if (i >= 0) {
- this.dynamicElements.splice(i, 1);
- }
- },
- parseImport: function(elt) {
- if (HTMLImports.__importsParsingHook) {
- HTMLImports.__importsParsingHook(elt);
- }
- if (elt.import) {
- elt.import.__importParsed = true;
- }
- this.markParsingComplete(elt);
- if (elt.__resource && !elt.__error) {
- elt.dispatchEvent(new CustomEvent("load", {
- bubbles: false
- }));
- } else {
- elt.dispatchEvent(new CustomEvent("error", {
- bubbles: false
- }));
- }
- if (elt.__pending) {
- var fn;
- while (elt.__pending.length) {
- fn = elt.__pending.shift();
- if (fn) {
- fn({
- target: elt
- });
- }
- }
- }
- this.parseNext();
- },
- parseLink: function(linkElt) {
- if (nodeIsImport(linkElt)) {
- this.parseImport(linkElt);
- } else {
- linkElt.href = linkElt.href;
- this.parseGeneric(linkElt);
- }
- },
- parseStyle: function(elt) {
- var src = elt;
- elt = cloneStyle(elt);
- elt.__importElement = src;
- this.parseGeneric(elt);
- },
- parseGeneric: function(elt) {
- this.trackElement(elt);
- this.addElementToDocument(elt);
- },
- rootImportForElement: function(elt) {
- var n = elt;
- while (n.ownerDocument.__importLink) {
- n = n.ownerDocument.__importLink;
- }
- return n;
- },
- addElementToDocument: function(elt) {
- var port = this.rootImportForElement(elt.__importElement || elt);
- port.parentNode.insertBefore(elt, port);
- },
- trackElement: function(elt, callback) {
- var self = this;
- var done = function(e) {
- if (callback) {
- callback(e);
- }
- self.markParsingComplete(elt);
- self.parseNext();
- };
- elt.addEventListener("load", done);
- elt.addEventListener("error", done);
- if (isIE && elt.localName === "style") {
- var fakeLoad = false;
- if (elt.textContent.indexOf("@import") == -1) {
- fakeLoad = true;
- } else if (elt.sheet) {
- fakeLoad = true;
- var csr = elt.sheet.cssRules;
- var len = csr ? csr.length : 0;
- for (var i = 0, r; i < len && (r = csr[i]); i++) {
- if (r.type === CSSRule.IMPORT_RULE) {
- fakeLoad = fakeLoad && Boolean(r.styleSheet);
- }
- }
- }
- if (fakeLoad) {
- elt.dispatchEvent(new CustomEvent("load", {
- bubbles: false
- }));
- }
- }
- },
- parseScript: function(scriptElt) {
- var script = document.createElement("script");
- script.__importElement = scriptElt;
- script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
- scope.currentScript = scriptElt;
- this.trackElement(script, function(e) {
- script.parentNode.removeChild(script);
- scope.currentScript = null;
- });
- this.addElementToDocument(script);
- },
- nextToParse: function() {
- this._mayParse = [];
- return !this.parsingElement && (this.nextToParseInDoc(rootDocument) || this.nextToParseDynamic());
- },
- nextToParseInDoc: function(doc, link) {
- if (doc && this._mayParse.indexOf(doc) < 0) {
- this._mayParse.push(doc);
- var nodes = doc.querySelectorAll(this.parseSelectorsForNode(doc));
- for (var i = 0, l = nodes.length, p = 0, n; i < l && (n = nodes[i]); i++) {
- if (!this.isParsed(n)) {
- if (this.hasResource(n)) {
- return nodeIsImport(n) ? this.nextToParseInDoc(n.import, n) : n;
- } else {
- return;
- }
- }
- }
- }
- return link;
- },
- nextToParseDynamic: function() {
- return this.dynamicElements[0];
- },
- parseSelectorsForNode: function(node) {
- var doc = node.ownerDocument || node;
- return doc === rootDocument ? this.documentSelectors : this.importsSelectors;
- },
- isParsed: function(node) {
- return node.__importParsed;
- },
- needsDynamicParsing: function(elt) {
- return this.dynamicElements.indexOf(elt) >= 0;
- },
- hasResource: function(node) {
- if (nodeIsImport(node) && node.import === undefined) {
- return false;
- }
- return true;
- }
- };
- function nodeIsImport(elt) {
- return elt.localName === "link" && elt.rel === IMPORT_LINK_TYPE;
- }
- function generateScriptDataUrl(script) {
- var scriptContent = generateScriptContent(script);
- return "data:text/javascript;charset=utf-8," + encodeURIComponent(scriptContent);
- }
- function generateScriptContent(script) {
- return script.textContent + generateSourceMapHint(script);
- }
- function generateSourceMapHint(script) {
- var owner = script.ownerDocument;
- owner.__importedScripts = owner.__importedScripts || 0;
- var moniker = script.ownerDocument.baseURI;
- var num = owner.__importedScripts ? "-" + owner.__importedScripts : "";
- owner.__importedScripts++;
- return "\n//# sourceURL=" + moniker + num + ".js\n";
- }
- function cloneStyle(style) {
- var clone = style.ownerDocument.createElement("style");
- clone.textContent = style.textContent;
- path.resolveUrlsInStyle(clone);
- return clone;
- }
- scope.parser = importParser;
- scope.IMPORT_SELECTOR = IMPORT_SELECTOR;
-});
-
-HTMLImports.addModule(function(scope) {
- var flags = scope.flags;
- var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
- var IMPORT_SELECTOR = scope.IMPORT_SELECTOR;
- var rootDocument = scope.rootDocument;
- var Loader = scope.Loader;
- var Observer = scope.Observer;
- var parser = scope.parser;
- var importer = {
- documents: {},
- documentPreloadSelectors: IMPORT_SELECTOR,
- importsPreloadSelectors: [ IMPORT_SELECTOR ].join(","),
- loadNode: function(node) {
- importLoader.addNode(node);
- },
- loadSubtree: function(parent) {
- var nodes = this.marshalNodes(parent);
- importLoader.addNodes(nodes);
- },
- marshalNodes: function(parent) {
- return parent.querySelectorAll(this.loadSelectorsForNode(parent));
- },
- loadSelectorsForNode: function(node) {
- var doc = node.ownerDocument || node;
- return doc === rootDocument ? this.documentPreloadSelectors : this.importsPreloadSelectors;
- },
- loaded: function(url, elt, resource, err, redirectedUrl) {
- flags.load && console.log("loaded", url, elt);
- elt.__resource = resource;
- elt.__error = err;
- if (isImportLink(elt)) {
- var doc = this.documents[url];
- if (doc === undefined) {
- doc = err ? null : makeDocument(resource, redirectedUrl || url);
- if (doc) {
- doc.__importLink = elt;
- this.bootDocument(doc);
- }
- this.documents[url] = doc;
- }
- elt.import = doc;
- }
- parser.parseNext();
- },
- bootDocument: function(doc) {
- this.loadSubtree(doc);
- this.observer.observe(doc);
- parser.parseNext();
- },
- loadedAll: function() {
- parser.parseNext();
- }
- };
- var importLoader = new Loader(importer.loaded.bind(importer), importer.loadedAll.bind(importer));
- importer.observer = new Observer();
- function isImportLink(elt) {
- return isLinkRel(elt, IMPORT_LINK_TYPE);
- }
- function isLinkRel(elt, rel) {
- return elt.localName === "link" && elt.getAttribute("rel") === rel;
- }
- function hasBaseURIAccessor(doc) {
- return !!Object.getOwnPropertyDescriptor(doc, "baseURI");
- }
- function makeDocument(resource, url) {
- var doc = document.implementation.createHTMLDocument(IMPORT_LINK_TYPE);
- doc._URL = url;
- var base = doc.createElement("base");
- base.setAttribute("href", url);
- if (!doc.baseURI && !hasBaseURIAccessor(doc)) {
- Object.defineProperty(doc, "baseURI", {
- value: url
- });
- }
- var meta = doc.createElement("meta");
- meta.setAttribute("charset", "utf-8");
- doc.head.appendChild(meta);
- doc.head.appendChild(base);
- doc.body.innerHTML = resource;
- if (window.HTMLTemplateElement && HTMLTemplateElement.bootstrap) {
- HTMLTemplateElement.bootstrap(doc);
- }
- return doc;
- }
- if (!document.baseURI) {
- var baseURIDescriptor = {
- get: function() {
- var base = document.querySelector("base");
- return base ? base.href : window.location.href;
- },
- configurable: true
- };
- Object.defineProperty(document, "baseURI", baseURIDescriptor);
- Object.defineProperty(rootDocument, "baseURI", baseURIDescriptor);
- }
- scope.importer = importer;
- scope.importLoader = importLoader;
-});
-
-HTMLImports.addModule(function(scope) {
- var parser = scope.parser;
- var importer = scope.importer;
- var dynamic = {
- added: function(nodes) {
- var owner, parsed, loading;
- for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
- if (!owner) {
- owner = n.ownerDocument;
- parsed = parser.isParsed(owner);
- }
- loading = this.shouldLoadNode(n);
- if (loading) {
- importer.loadNode(n);
- }
- if (this.shouldParseNode(n) && parsed) {
- parser.parseDynamic(n, loading);
- }
- }
- },
- shouldLoadNode: function(node) {
- return node.nodeType === 1 && matches.call(node, importer.loadSelectorsForNode(node));
- },
- shouldParseNode: function(node) {
- return node.nodeType === 1 && matches.call(node, parser.parseSelectorsForNode(node));
- }
- };
- importer.observer.addCallback = dynamic.added.bind(dynamic);
- var matches = HTMLElement.prototype.matches || HTMLElement.prototype.matchesSelector || HTMLElement.prototype.webkitMatchesSelector || HTMLElement.prototype.mozMatchesSelector || HTMLElement.prototype.msMatchesSelector;
-});
-
-(function(scope) {
- var initializeModules = scope.initializeModules;
- var isIE = scope.isIE;
- if (scope.useNative) {
- return;
- }
- if (isIE && typeof window.CustomEvent !== "function") {
- window.CustomEvent = function(inType, params) {
- params = params || {};
- var e = document.createEvent("CustomEvent");
- e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
- return e;
- };
- window.CustomEvent.prototype = window.Event.prototype;
- }
- initializeModules();
- var rootDocument = scope.rootDocument;
- function bootstrap() {
- HTMLImports.importer.bootDocument(rootDocument);
- }
- if (document.readyState === "complete" || document.readyState === "interactive" && !window.attachEvent) {
- bootstrap();
- } else {
- document.addEventListener("DOMContentLoaded", bootstrap);
- }
-})(HTMLImports); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/HTMLImports.min.js b/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/HTMLImports.min.js
deleted file mode 100644
index a1a45ce177b..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/HTMLImports.min.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @license
- * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
- */
-// @version 0.5.5
-"undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};n.prototype={set:function(t,n){var r=t[this.name];return r&&r[0]===t?r[1]=n:e(t,this.name,{value:[t,n],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=n}(),window.HTMLImports=window.HTMLImports||{flags:{}},function(e){function t(e,t){t=t||h,r(function(){i(e,t)},t)}function n(e){return"complete"===e.readyState||e.readyState===g}function r(e,t){if(n(t))e&&e();else{var o=function(){("complete"===t.readyState||t.readyState===g)&&(t.removeEventListener(_,o),r(e,t))};t.addEventListener(_,o)}}function o(e){e.target.__loaded=!0}function i(e,t){function n(){s==c&&e&&e()}function r(e){o(e),s++,n()}var i=t.querySelectorAll("link[rel=import]"),s=0,c=i.length;if(c)for(var d,l=0;c>l&&(d=i[l]);l++)a(d)?r.call(d,{target:d}):(d.addEventListener("load",r),d.addEventListener("error",r));else n()}function a(e){return u?e.__loaded||e["import"]&&"loading"!==e["import"].readyState:e.__importParsed}function s(e){for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)c(t)&&d(t)}function c(e){return"link"===e.localName&&"import"===e.rel}function d(e){var t=e["import"];t?o({target:e}):(e.addEventListener("load",o),e.addEventListener("error",o))}var l="import",u=Boolean(l in document.createElement("link")),m=Boolean(window.ShadowDOMPolyfill),p=function(e){return m?ShadowDOMPolyfill.wrapIfNeeded(e):e},h=p(document),f={get:function(){var e=HTMLImports.currentScript||document.currentScript||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null);return p(e)},configurable:!0};Object.defineProperty(document,"_currentScript",f),Object.defineProperty(h,"_currentScript",f);var v=/Trident|Edge/.test(navigator.userAgent),g=v?"complete":"interactive",_="readystatechange";u&&(new MutationObserver(function(e){for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)t.addedNodes&&s(t.addedNodes)}).observe(document.head,{childList:!0}),function(){if("loading"===document.readyState)for(var e,t=document.querySelectorAll("link[rel=import]"),n=0,r=t.length;r>n&&(e=t[n]);n++)d(e)}()),t(function(){HTMLImports.ready=!0,HTMLImports.readyTime=(new Date).getTime();var e=h.createEvent("CustomEvent");e.initCustomEvent("HTMLImportsLoaded",!0,!0,{}),h.dispatchEvent(e)}),e.IMPORT_LINK_TYPE=l,e.useNative=u,e.rootDocument=h,e.whenReady=t,e.isIE=v}(HTMLImports),function(e){var t=[],n=function(e){t.push(e)},r=function(){t.forEach(function(t){t(e)})};e.addModule=n,e.initializeModules=r}(HTMLImports),HTMLImports.addModule(function(e){var t=/(url\()([^)]*)(\))/g,n=/(@import[\s]+(?!url\())([^;]*)(;)/g,r={resolveUrlsInStyle:function(e){var t=e.ownerDocument,n=t.createElement("a");return e.textContent=this.resolveUrlsInCssText(e.textContent,n),e},resolveUrlsInCssText:function(e,r){var o=this.replaceUrls(e,r,t);return o=this.replaceUrls(o,r,n)},replaceUrls:function(e,t,n){return e.replace(n,function(e,n,r,o){var i=r.replace(/["']/g,"");return t.href=i,i=t.href,n+"'"+i+"'"+o})}};e.path=r}),HTMLImports.addModule(function(e){var t={async:!0,ok:function(e){return e.status>=200&&e.status<300||304===e.status||0===e.status},load:function(n,r,o){var i=new XMLHttpRequest;return(e.flags.debug||e.flags.bust)&&(n+="?"+Math.random()),i.open("GET",n,t.async),i.addEventListener("readystatechange",function(){if(4===i.readyState){var e=i.getResponseHeader("Location"),n=null;if(e)var n="/"===e.substr(0,1)?location.origin+e:e;r.call(o,!t.ok(i)&&i,i.response||i.responseText,n)}}),i.send(),i},loadDocument:function(e,t,n){this.load(e,t,n).responseType="document"}};e.xhr=t}),HTMLImports.addModule(function(e){var t=e.xhr,n=e.flags,r=function(e,t){this.cache={},this.onload=e,this.oncomplete=t,this.inflight=0,this.pending={}};r.prototype={addNodes:function(e){this.inflight+=e.length;for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)this.require(t);this.checkDone()},addNode:function(e){this.inflight++,this.require(e),this.checkDone()},require:function(e){var t=e.src||e.href;e.__nodeUrl=t,this.dedupe(t,e)||this.fetch(t,e)},dedupe:function(e,t){if(this.pending[e])return this.pending[e].push(t),!0;return this.cache[e]?(this.onload(e,t,this.cache[e]),this.tail(),!0):(this.pending[e]=[t],!1)},fetch:function(e,r){if(n.load&&console.log("fetch",e,r),e)if(e.match(/^data:/)){var o=e.split(","),i=o[0],a=o[1];a=i.indexOf(";base64")>-1?atob(a):decodeURIComponent(a),setTimeout(function(){this.receive(e,r,null,a)}.bind(this),0)}else{var s=function(t,n,o){this.receive(e,r,t,n,o)}.bind(this);t.load(e,s)}else setTimeout(function(){this.receive(e,r,{error:"href must be specified"},null)}.bind(this),0)},receive:function(e,t,n,r,o){this.cache[e]=r;for(var i,a=this.pending[e],s=0,c=a.length;c>s&&(i=a[s]);s++)this.onload(e,i,r,n,o),this.tail();this.pending[e]=null},tail:function(){--this.inflight,this.checkDone()},checkDone:function(){this.inflight||this.oncomplete()}},e.Loader=r}),HTMLImports.addModule(function(e){var t=function(e){this.addCallback=e,this.mo=new MutationObserver(this.handler.bind(this))};t.prototype={handler:function(e){for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)"childList"===t.type&&t.addedNodes.length&&this.addedNodes(t.addedNodes)},addedNodes:function(e){this.addCallback&&this.addCallback(e);for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)t.children&&t.children.length&&this.addedNodes(t.children)},observe:function(e){this.mo.observe(e,{childList:!0,subtree:!0})}},e.Observer=t}),HTMLImports.addModule(function(e){function t(e){return"link"===e.localName&&e.rel===l}function n(e){var t=r(e);return"data:text/javascript;charset=utf-8,"+encodeURIComponent(t)}function r(e){return e.textContent+o(e)}function o(e){var t=e.ownerDocument;t.__importedScripts=t.__importedScripts||0;var n=e.ownerDocument.baseURI,r=t.__importedScripts?"-"+t.__importedScripts:"";return t.__importedScripts++,"\n//# sourceURL="+n+r+".js\n"}function i(e){var t=e.ownerDocument.createElement("style");return t.textContent=e.textContent,a.resolveUrlsInStyle(t),t}var a=e.path,s=e.rootDocument,c=e.flags,d=e.isIE,l=e.IMPORT_LINK_TYPE,u="link[rel="+l+"]",m={documentSelectors:u,importsSelectors:[u,"link[rel=stylesheet]","style","script:not([type])",'script[type="text/javascript"]'].join(","),map:{link:"parseLink",script:"parseScript",style:"parseStyle"},dynamicElements:[],parseNext:function(){var e=this.nextToParse();e&&this.parse(e)},parse:function(e){if(this.isParsed(e))return void(c.parse&&console.log("[%s] is already parsed",e.localName));var t=this[this.map[e.localName]];t&&(this.markParsing(e),t.call(this,e))},parseDynamic:function(e,t){this.dynamicElements.push(e),t||this.parseNext()},markParsing:function(e){c.parse&&console.log("parsing",e),this.parsingElement=e},markParsingComplete:function(e){e.__importParsed=!0,this.markDynamicParsingComplete(e),e.__importElement&&(e.__importElement.__importParsed=!0,this.markDynamicParsingComplete(e.__importElement)),this.parsingElement=null,c.parse&&console.log("completed",e)},markDynamicParsingComplete:function(e){var t=this.dynamicElements.indexOf(e);t>=0&&this.dynamicElements.splice(t,1)},parseImport:function(e){if(HTMLImports.__importsParsingHook&&HTMLImports.__importsParsingHook(e),e["import"]&&(e["import"].__importParsed=!0),this.markParsingComplete(e),e.dispatchEvent(e.__resource&&!e.__error?new CustomEvent("load",{bubbles:!1}):new CustomEvent("error",{bubbles:!1})),e.__pending)for(var t;e.__pending.length;)t=e.__pending.shift(),t&&t({target:e});this.parseNext()},parseLink:function(e){t(e)?this.parseImport(e):(e.href=e.href,this.parseGeneric(e))},parseStyle:function(e){var t=e;e=i(e),e.__importElement=t,this.parseGeneric(e)},parseGeneric:function(e){this.trackElement(e),this.addElementToDocument(e)},rootImportForElement:function(e){for(var t=e;t.ownerDocument.__importLink;)t=t.ownerDocument.__importLink;return t},addElementToDocument:function(e){var t=this.rootImportForElement(e.__importElement||e);t.parentNode.insertBefore(e,t)},trackElement:function(e,t){var n=this,r=function(r){t&&t(r),n.markParsingComplete(e),n.parseNext()};if(e.addEventListener("load",r),e.addEventListener("error",r),d&&"style"===e.localName){var o=!1;if(-1==e.textContent.indexOf("@import"))o=!0;else if(e.sheet){o=!0;for(var i,a=e.sheet.cssRules,s=a?a.length:0,c=0;s>c&&(i=a[c]);c++)i.type===CSSRule.IMPORT_RULE&&(o=o&&Boolean(i.styleSheet))}o&&e.dispatchEvent(new CustomEvent("load",{bubbles:!1}))}},parseScript:function(t){var r=document.createElement("script");r.__importElement=t,r.src=t.src?t.src:n(t),e.currentScript=t,this.trackElement(r,function(){r.parentNode.removeChild(r),e.currentScript=null}),this.addElementToDocument(r)},nextToParse:function(){return this._mayParse=[],!this.parsingElement&&(this.nextToParseInDoc(s)||this.nextToParseDynamic())},nextToParseInDoc:function(e,n){if(e&&this._mayParse.indexOf(e)<0){this._mayParse.push(e);for(var r,o=e.querySelectorAll(this.parseSelectorsForNode(e)),i=0,a=o.length;a>i&&(r=o[i]);i++)if(!this.isParsed(r))return this.hasResource(r)?t(r)?this.nextToParseInDoc(r["import"],r):r:void 0}return n},nextToParseDynamic:function(){return this.dynamicElements[0]},parseSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===s?this.documentSelectors:this.importsSelectors},isParsed:function(e){return e.__importParsed},needsDynamicParsing:function(e){return this.dynamicElements.indexOf(e)>=0},hasResource:function(e){return t(e)&&void 0===e["import"]?!1:!0}};e.parser=m,e.IMPORT_SELECTOR=u}),HTMLImports.addModule(function(e){function t(e){return n(e,a)}function n(e,t){return"link"===e.localName&&e.getAttribute("rel")===t}function r(e){return!!Object.getOwnPropertyDescriptor(e,"baseURI")}function o(e,t){var n=document.implementation.createHTMLDocument(a);n._URL=t;var o=n.createElement("base");o.setAttribute("href",t),n.baseURI||r(n)||Object.defineProperty(n,"baseURI",{value:t});var i=n.createElement("meta");return i.setAttribute("charset","utf-8"),n.head.appendChild(i),n.head.appendChild(o),n.body.innerHTML=e,window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(n),n}var i=e.flags,a=e.IMPORT_LINK_TYPE,s=e.IMPORT_SELECTOR,c=e.rootDocument,d=e.Loader,l=e.Observer,u=e.parser,m={documents:{},documentPreloadSelectors:s,importsPreloadSelectors:[s].join(","),loadNode:function(e){p.addNode(e)},loadSubtree:function(e){var t=this.marshalNodes(e);p.addNodes(t)},marshalNodes:function(e){return e.querySelectorAll(this.loadSelectorsForNode(e))},loadSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===c?this.documentPreloadSelectors:this.importsPreloadSelectors},loaded:function(e,n,r,a,s){if(i.load&&console.log("loaded",e,n),n.__resource=r,n.__error=a,t(n)){var c=this.documents[e];void 0===c&&(c=a?null:o(r,s||e),c&&(c.__importLink=n,this.bootDocument(c)),this.documents[e]=c),n["import"]=c}u.parseNext()},bootDocument:function(e){this.loadSubtree(e),this.observer.observe(e),u.parseNext()},loadedAll:function(){u.parseNext()}},p=new d(m.loaded.bind(m),m.loadedAll.bind(m));if(m.observer=new l,!document.baseURI){var h={get:function(){var e=document.querySelector("base");return e?e.href:window.location.href},configurable:!0};Object.defineProperty(document,"baseURI",h),Object.defineProperty(c,"baseURI",h)}e.importer=m,e.importLoader=p}),HTMLImports.addModule(function(e){var t=e.parser,n=e.importer,r={added:function(e){for(var r,o,i,a,s=0,c=e.length;c>s&&(a=e[s]);s++)r||(r=a.ownerDocument,o=t.isParsed(r)),i=this.shouldLoadNode(a),i&&n.loadNode(a),this.shouldParseNode(a)&&o&&t.parseDynamic(a,i)},shouldLoadNode:function(e){return 1===e.nodeType&&o.call(e,n.loadSelectorsForNode(e))},shouldParseNode:function(e){return 1===e.nodeType&&o.call(e,t.parseSelectorsForNode(e))}};n.observer.addCallback=r.added.bind(r);var o=HTMLElement.prototype.matches||HTMLElement.prototype.matchesSelector||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector}),function(e){function t(){HTMLImports.importer.bootDocument(o)}var n=e.initializeModules,r=e.isIE;if(!e.useNative){r&&"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e,t){t=t||{};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),n},window.CustomEvent.prototype=window.Event.prototype),n();var o=e.rootDocument;"complete"===document.readyState||"interactive"===document.readyState&&!window.attachEvent?t():document.addEventListener("DOMContentLoaded",t)}}(HTMLImports); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/README.md b/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/README.md
deleted file mode 100644
index 49ed2b64f30..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/README.md
+++ /dev/null
@@ -1,73 +0,0 @@
-webcomponents.js
-================
-
-[![Join the chat at https://gitter.im/webcomponents/webcomponentsjs](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/webcomponents/webcomponentsjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-
-A suite of polyfills supporting the [Web Components](http://webcomponents.org) specs:
-
-**Custom Elements**: allows authors to define their own custom tags ([spec](https://w3c.github.io/webcomponents/spec/custom/)).
-
-**HTML Imports**: a way to include and reuse HTML documents via other HTML documents ([spec](https://w3c.github.io/webcomponents/spec/imports/)).
-
-**Shadow DOM**: provides encapsulation by hiding DOM subtrees under shadow roots ([spec](https://w3c.github.io/webcomponents/spec/shadow/)).
-
-This also folds in polyfills for `MutationObserver` and `WeakMap`.
-
-
-## Releases
-
-Pre-built (concatenated & minified) versions of the polyfills are maintained in the [tagged versions](https://github.com/webcomponents/webcomponentsjs/releases) of this repo. There are two variants:
-
-`webcomponents.js` includes all of the polyfills.
-
-`webcomponents-lite.js` includes all polyfills except for shadow DOM.
-
-
-## Browser Support
-
-Our polyfills are intended to work in the latest versions of evergreen browsers. See below
-for our complete browser support matrix:
-
-| Polyfill | IE10 | IE11+ | Chrome* | Firefox* | Safari 7+* | Chrome Android* | Mobile Safari* |
-| ---------- |:----:|:-----:|:-------:|:--------:|:----------:|:---------------:|:--------------:|
-| Custom Elements | ~ | ✓ | ✓ | ✓ | ✓ | ✓| ✓ |
-| HTML Imports | ~ | ✓ | ✓ | ✓ | ✓| ✓| ✓ |
-| Shadow DOM | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
-| Templates | ✓ | ✓ | ✓ | ✓| ✓ | ✓ | ✓ |
-
-
-*Indicates the current version of the browser
-
-~Indicates support may be flaky. If using Custom Elements or HTML Imports with Shadow DOM,
-you will get the non-flaky Mutation Observer polyfill that Shadow DOM includes.
-
-The polyfills may work in older browsers, however require additional polyfills (such as classList)
-to be used. We cannot guarantee support for browsers outside of our compatibility matrix.
-
-
-### Manually Building
-
-If you wish to build the polyfills yourself, you'll need `node` and `gulp` on your system:
-
- * install [node.js](http://nodejs.org/) using the instructions on their website
- * use `npm` to install [gulp.js](http://gulpjs.com/): `npm install -g gulp`
-
-Now you are ready to build the polyfills with:
-
- # install dependencies
- npm install
- # build
- gulp build
-
-The builds will be placed into the `dist/` directory.
-
-## Contribute
-
-See the [contributing guide](CONTRIBUTING.md)
-
-## License
-
-Everything in this repository is BSD style license unless otherwise specified.
-
-Copyright (c) 2015 The Polymer Authors. All rights reserved.
-
diff --git a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/ShadowDOM.js b/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/ShadowDOM.js
deleted file mode 100644
index fb5c08f3463..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/ShadowDOM.js
+++ /dev/null
@@ -1,4277 +0,0 @@
-/**
- * @license
- * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
- */
-// @version 0.5.5
-if (typeof WeakMap === "undefined") {
- (function() {
- var defineProperty = Object.defineProperty;
- var counter = Date.now() % 1e9;
- var WeakMap = function() {
- this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
- };
- WeakMap.prototype = {
- set: function(key, value) {
- var entry = key[this.name];
- if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {
- value: [ key, value ],
- writable: true
- });
- return this;
- },
- get: function(key) {
- var entry;
- return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
- },
- "delete": function(key) {
- var entry = key[this.name];
- if (!entry || entry[0] !== key) return false;
- entry[0] = entry[1] = undefined;
- return true;
- },
- has: function(key) {
- var entry = key[this.name];
- if (!entry) return false;
- return entry[0] === key;
- }
- };
- window.WeakMap = WeakMap;
- })();
-}
-
-window.ShadowDOMPolyfill = {};
-
-(function(scope) {
- "use strict";
- var constructorTable = new WeakMap();
- var nativePrototypeTable = new WeakMap();
- var wrappers = Object.create(null);
- function detectEval() {
- if (typeof chrome !== "undefined" && chrome.app && chrome.app.runtime) {
- return false;
- }
- if (navigator.getDeviceStorage) {
- return false;
- }
- try {
- var f = new Function("return true;");
- return f();
- } catch (ex) {
- return false;
- }
- }
- var hasEval = detectEval();
- function assert(b) {
- if (!b) throw new Error("Assertion failed");
- }
- var defineProperty = Object.defineProperty;
- var getOwnPropertyNames = Object.getOwnPropertyNames;
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- function mixin(to, from) {
- var names = getOwnPropertyNames(from);
- for (var i = 0; i < names.length; i++) {
- var name = names[i];
- defineProperty(to, name, getOwnPropertyDescriptor(from, name));
- }
- return to;
- }
- function mixinStatics(to, from) {
- var names = getOwnPropertyNames(from);
- for (var i = 0; i < names.length; i++) {
- var name = names[i];
- switch (name) {
- case "arguments":
- case "caller":
- case "length":
- case "name":
- case "prototype":
- case "toString":
- continue;
- }
- defineProperty(to, name, getOwnPropertyDescriptor(from, name));
- }
- return to;
- }
- function oneOf(object, propertyNames) {
- for (var i = 0; i < propertyNames.length; i++) {
- if (propertyNames[i] in object) return propertyNames[i];
- }
- }
- var nonEnumerableDataDescriptor = {
- value: undefined,
- configurable: true,
- enumerable: false,
- writable: true
- };
- function defineNonEnumerableDataProperty(object, name, value) {
- nonEnumerableDataDescriptor.value = value;
- defineProperty(object, name, nonEnumerableDataDescriptor);
- }
- getOwnPropertyNames(window);
- function getWrapperConstructor(node) {
- var nativePrototype = node.__proto__ || Object.getPrototypeOf(node);
- if (isFirefox) {
- try {
- getOwnPropertyNames(nativePrototype);
- } catch (error) {
- nativePrototype = nativePrototype.__proto__;
- }
- }
- var wrapperConstructor = constructorTable.get(nativePrototype);
- if (wrapperConstructor) return wrapperConstructor;
- var parentWrapperConstructor = getWrapperConstructor(nativePrototype);
- var GeneratedWrapper = createWrapperConstructor(parentWrapperConstructor);
- registerInternal(nativePrototype, GeneratedWrapper, node);
- return GeneratedWrapper;
- }
- function addForwardingProperties(nativePrototype, wrapperPrototype) {
- installProperty(nativePrototype, wrapperPrototype, true);
- }
- function registerInstanceProperties(wrapperPrototype, instanceObject) {
- installProperty(instanceObject, wrapperPrototype, false);
- }
- var isFirefox = /Firefox/.test(navigator.userAgent);
- var dummyDescriptor = {
- get: function() {},
- set: function(v) {},
- configurable: true,
- enumerable: true
- };
- function isEventHandlerName(name) {
- return /^on[a-z]+$/.test(name);
- }
- function isIdentifierName(name) {
- return /^\w[a-zA-Z_0-9]*$/.test(name);
- }
- function getGetter(name) {
- return hasEval && isIdentifierName(name) ? new Function("return this.__impl4cf1e782hg__." + name) : function() {
- return this.__impl4cf1e782hg__[name];
- };
- }
- function getSetter(name) {
- return hasEval && isIdentifierName(name) ? new Function("v", "this.__impl4cf1e782hg__." + name + " = v") : function(v) {
- this.__impl4cf1e782hg__[name] = v;
- };
- }
- function getMethod(name) {
- return hasEval && isIdentifierName(name) ? new Function("return this.__impl4cf1e782hg__." + name + ".apply(this.__impl4cf1e782hg__, arguments)") : function() {
- return this.__impl4cf1e782hg__[name].apply(this.__impl4cf1e782hg__, arguments);
- };
- }
- function getDescriptor(source, name) {
- try {
- return Object.getOwnPropertyDescriptor(source, name);
- } catch (ex) {
- return dummyDescriptor;
- }
- }
- var isBrokenSafari = function() {
- var descr = Object.getOwnPropertyDescriptor(Node.prototype, "nodeType");
- return descr && !descr.get && !descr.set;
- }();
- function installProperty(source, target, allowMethod, opt_blacklist) {
- var names = getOwnPropertyNames(source);
- for (var i = 0; i < names.length; i++) {
- var name = names[i];
- if (name === "polymerBlackList_") continue;
- if (name in target) continue;
- if (source.polymerBlackList_ && source.polymerBlackList_[name]) continue;
- if (isFirefox) {
- source.__lookupGetter__(name);
- }
- var descriptor = getDescriptor(source, name);
- var getter, setter;
- if (allowMethod && typeof descriptor.value === "function") {
- target[name] = getMethod(name);
- continue;
- }
- var isEvent = isEventHandlerName(name);
- if (isEvent) getter = scope.getEventHandlerGetter(name); else getter = getGetter(name);
- if (descriptor.writable || descriptor.set || isBrokenSafari) {
- if (isEvent) setter = scope.getEventHandlerSetter(name); else setter = getSetter(name);
- }
- var configurable = isBrokenSafari || descriptor.configurable;
- defineProperty(target, name, {
- get: getter,
- set: setter,
- configurable: configurable,
- enumerable: descriptor.enumerable
- });
- }
- }
- function register(nativeConstructor, wrapperConstructor, opt_instance) {
- var nativePrototype = nativeConstructor.prototype;
- registerInternal(nativePrototype, wrapperConstructor, opt_instance);
- mixinStatics(wrapperConstructor, nativeConstructor);
- }
- function registerInternal(nativePrototype, wrapperConstructor, opt_instance) {
- var wrapperPrototype = wrapperConstructor.prototype;
- assert(constructorTable.get(nativePrototype) === undefined);
- constructorTable.set(nativePrototype, wrapperConstructor);
- nativePrototypeTable.set(wrapperPrototype, nativePrototype);
- addForwardingProperties(nativePrototype, wrapperPrototype);
- if (opt_instance) registerInstanceProperties(wrapperPrototype, opt_instance);
- defineNonEnumerableDataProperty(wrapperPrototype, "constructor", wrapperConstructor);
- wrapperConstructor.prototype = wrapperPrototype;
- }
- function isWrapperFor(wrapperConstructor, nativeConstructor) {
- return constructorTable.get(nativeConstructor.prototype) === wrapperConstructor;
- }
- function registerObject(object) {
- var nativePrototype = Object.getPrototypeOf(object);
- var superWrapperConstructor = getWrapperConstructor(nativePrototype);
- var GeneratedWrapper = createWrapperConstructor(superWrapperConstructor);
- registerInternal(nativePrototype, GeneratedWrapper, object);
- return GeneratedWrapper;
- }
- function createWrapperConstructor(superWrapperConstructor) {
- function GeneratedWrapper(node) {
- superWrapperConstructor.call(this, node);
- }
- var p = Object.create(superWrapperConstructor.prototype);
- p.constructor = GeneratedWrapper;
- GeneratedWrapper.prototype = p;
- return GeneratedWrapper;
- }
- function isWrapper(object) {
- return object && object.__impl4cf1e782hg__;
- }
- function isNative(object) {
- return !isWrapper(object);
- }
- function wrap(impl) {
- if (impl === null) return null;
- assert(isNative(impl));
- return impl.__wrapper8e3dd93a60__ || (impl.__wrapper8e3dd93a60__ = new (getWrapperConstructor(impl))(impl));
- }
- function unwrap(wrapper) {
- if (wrapper === null) return null;
- assert(isWrapper(wrapper));
- return wrapper.__impl4cf1e782hg__;
- }
- function unsafeUnwrap(wrapper) {
- return wrapper.__impl4cf1e782hg__;
- }
- function setWrapper(impl, wrapper) {
- wrapper.__impl4cf1e782hg__ = impl;
- impl.__wrapper8e3dd93a60__ = wrapper;
- }
- function unwrapIfNeeded(object) {
- return object && isWrapper(object) ? unwrap(object) : object;
- }
- function wrapIfNeeded(object) {
- return object && !isWrapper(object) ? wrap(object) : object;
- }
- function rewrap(node, wrapper) {
- if (wrapper === null) return;
- assert(isNative(node));
- assert(wrapper === undefined || isWrapper(wrapper));
- node.__wrapper8e3dd93a60__ = wrapper;
- }
- var getterDescriptor = {
- get: undefined,
- configurable: true,
- enumerable: true
- };
- function defineGetter(constructor, name, getter) {
- getterDescriptor.get = getter;
- defineProperty(constructor.prototype, name, getterDescriptor);
- }
- function defineWrapGetter(constructor, name) {
- defineGetter(constructor, name, function() {
- return wrap(this.__impl4cf1e782hg__[name]);
- });
- }
- function forwardMethodsToWrapper(constructors, names) {
- constructors.forEach(function(constructor) {
- names.forEach(function(name) {
- constructor.prototype[name] = function() {
- var w = wrapIfNeeded(this);
- return w[name].apply(w, arguments);
- };
- });
- });
- }
- scope.assert = assert;
- scope.constructorTable = constructorTable;
- scope.defineGetter = defineGetter;
- scope.defineWrapGetter = defineWrapGetter;
- scope.forwardMethodsToWrapper = forwardMethodsToWrapper;
- scope.isWrapper = isWrapper;
- scope.isWrapperFor = isWrapperFor;
- scope.mixin = mixin;
- scope.nativePrototypeTable = nativePrototypeTable;
- scope.oneOf = oneOf;
- scope.registerObject = registerObject;
- scope.registerWrapper = register;
- scope.rewrap = rewrap;
- scope.setWrapper = setWrapper;
- scope.unsafeUnwrap = unsafeUnwrap;
- scope.unwrap = unwrap;
- scope.unwrapIfNeeded = unwrapIfNeeded;
- scope.wrap = wrap;
- scope.wrapIfNeeded = wrapIfNeeded;
- scope.wrappers = wrappers;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- function newSplice(index, removed, addedCount) {
- return {
- index: index,
- removed: removed,
- addedCount: addedCount
- };
- }
- var EDIT_LEAVE = 0;
- var EDIT_UPDATE = 1;
- var EDIT_ADD = 2;
- var EDIT_DELETE = 3;
- function ArraySplice() {}
- ArraySplice.prototype = {
- calcEditDistances: function(current, currentStart, currentEnd, old, oldStart, oldEnd) {
- var rowCount = oldEnd - oldStart + 1;
- var columnCount = currentEnd - currentStart + 1;
- var distances = new Array(rowCount);
- for (var i = 0; i < rowCount; i++) {
- distances[i] = new Array(columnCount);
- distances[i][0] = i;
- }
- for (var j = 0; j < columnCount; j++) distances[0][j] = j;
- for (var i = 1; i < rowCount; i++) {
- for (var j = 1; j < columnCount; j++) {
- if (this.equals(current[currentStart + j - 1], old[oldStart + i - 1])) distances[i][j] = distances[i - 1][j - 1]; else {
- var north = distances[i - 1][j] + 1;
- var west = distances[i][j - 1] + 1;
- distances[i][j] = north < west ? north : west;
- }
- }
- }
- return distances;
- },
- spliceOperationsFromEditDistances: function(distances) {
- var i = distances.length - 1;
- var j = distances[0].length - 1;
- var current = distances[i][j];
- var edits = [];
- while (i > 0 || j > 0) {
- if (i == 0) {
- edits.push(EDIT_ADD);
- j--;
- continue;
- }
- if (j == 0) {
- edits.push(EDIT_DELETE);
- i--;
- continue;
- }
- var northWest = distances[i - 1][j - 1];
- var west = distances[i - 1][j];
- var north = distances[i][j - 1];
- var min;
- if (west < north) min = west < northWest ? west : northWest; else min = north < northWest ? north : northWest;
- if (min == northWest) {
- if (northWest == current) {
- edits.push(EDIT_LEAVE);
- } else {
- edits.push(EDIT_UPDATE);
- current = northWest;
- }
- i--;
- j--;
- } else if (min == west) {
- edits.push(EDIT_DELETE);
- i--;
- current = west;
- } else {
- edits.push(EDIT_ADD);
- j--;
- current = north;
- }
- }
- edits.reverse();
- return edits;
- },
- calcSplices: function(current, currentStart, currentEnd, old, oldStart, oldEnd) {
- var prefixCount = 0;
- var suffixCount = 0;
- var minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
- if (currentStart == 0 && oldStart == 0) prefixCount = this.sharedPrefix(current, old, minLength);
- if (currentEnd == current.length && oldEnd == old.length) suffixCount = this.sharedSuffix(current, old, minLength - prefixCount);
- currentStart += prefixCount;
- oldStart += prefixCount;
- currentEnd -= suffixCount;
- oldEnd -= suffixCount;
- if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0) return [];
- if (currentStart == currentEnd) {
- var splice = newSplice(currentStart, [], 0);
- while (oldStart < oldEnd) splice.removed.push(old[oldStart++]);
- return [ splice ];
- } else if (oldStart == oldEnd) return [ newSplice(currentStart, [], currentEnd - currentStart) ];
- var ops = this.spliceOperationsFromEditDistances(this.calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd));
- var splice = undefined;
- var splices = [];
- var index = currentStart;
- var oldIndex = oldStart;
- for (var i = 0; i < ops.length; i++) {
- switch (ops[i]) {
- case EDIT_LEAVE:
- if (splice) {
- splices.push(splice);
- splice = undefined;
- }
- index++;
- oldIndex++;
- break;
-
- case EDIT_UPDATE:
- if (!splice) splice = newSplice(index, [], 0);
- splice.addedCount++;
- index++;
- splice.removed.push(old[oldIndex]);
- oldIndex++;
- break;
-
- case EDIT_ADD:
- if (!splice) splice = newSplice(index, [], 0);
- splice.addedCount++;
- index++;
- break;
-
- case EDIT_DELETE:
- if (!splice) splice = newSplice(index, [], 0);
- splice.removed.push(old[oldIndex]);
- oldIndex++;
- break;
- }
- }
- if (splice) {
- splices.push(splice);
- }
- return splices;
- },
- sharedPrefix: function(current, old, searchLength) {
- for (var i = 0; i < searchLength; i++) if (!this.equals(current[i], old[i])) return i;
- return searchLength;
- },
- sharedSuffix: function(current, old, searchLength) {
- var index1 = current.length;
- var index2 = old.length;
- var count = 0;
- while (count < searchLength && this.equals(current[--index1], old[--index2])) count++;
- return count;
- },
- calculateSplices: function(current, previous) {
- return this.calcSplices(current, 0, current.length, previous, 0, previous.length);
- },
- equals: function(currentValue, previousValue) {
- return currentValue === previousValue;
- }
- };
- scope.ArraySplice = ArraySplice;
-})(window.ShadowDOMPolyfill);
-
-(function(context) {
- "use strict";
- var OriginalMutationObserver = window.MutationObserver;
- var callbacks = [];
- var pending = false;
- var timerFunc;
- function handle() {
- pending = false;
- var copies = callbacks.slice(0);
- callbacks = [];
- for (var i = 0; i < copies.length; i++) {
- (0, copies[i])();
- }
- }
- if (OriginalMutationObserver) {
- var counter = 1;
- var observer = new OriginalMutationObserver(handle);
- var textNode = document.createTextNode(counter);
- observer.observe(textNode, {
- characterData: true
- });
- timerFunc = function() {
- counter = (counter + 1) % 2;
- textNode.data = counter;
- };
- } else {
- timerFunc = window.setTimeout;
- }
- function setEndOfMicrotask(func) {
- callbacks.push(func);
- if (pending) return;
- pending = true;
- timerFunc(handle, 0);
- }
- context.setEndOfMicrotask = setEndOfMicrotask;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var setEndOfMicrotask = scope.setEndOfMicrotask;
- var wrapIfNeeded = scope.wrapIfNeeded;
- var wrappers = scope.wrappers;
- var registrationsTable = new WeakMap();
- var globalMutationObservers = [];
- var isScheduled = false;
- function scheduleCallback(observer) {
- if (observer.scheduled_) return;
- observer.scheduled_ = true;
- globalMutationObservers.push(observer);
- if (isScheduled) return;
- setEndOfMicrotask(notifyObservers);
- isScheduled = true;
- }
- function notifyObservers() {
- isScheduled = false;
- while (globalMutationObservers.length) {
- var notifyList = globalMutationObservers;
- globalMutationObservers = [];
- notifyList.sort(function(x, y) {
- return x.uid_ - y.uid_;
- });
- for (var i = 0; i < notifyList.length; i++) {
- var mo = notifyList[i];
- mo.scheduled_ = false;
- var queue = mo.takeRecords();
- removeTransientObserversFor(mo);
- if (queue.length) {
- mo.callback_(queue, mo);
- }
- }
- }
- }
- function MutationRecord(type, target) {
- this.type = type;
- this.target = target;
- this.addedNodes = new wrappers.NodeList();
- this.removedNodes = new wrappers.NodeList();
- this.previousSibling = null;
- this.nextSibling = null;
- this.attributeName = null;
- this.attributeNamespace = null;
- this.oldValue = null;
- }
- function registerTransientObservers(ancestor, node) {
- for (;ancestor; ancestor = ancestor.parentNode) {
- var registrations = registrationsTable.get(ancestor);
- if (!registrations) continue;
- for (var i = 0; i < registrations.length; i++) {
- var registration = registrations[i];
- if (registration.options.subtree) registration.addTransientObserver(node);
- }
- }
- }
- function removeTransientObserversFor(observer) {
- for (var i = 0; i < observer.nodes_.length; i++) {
- var node = observer.nodes_[i];
- var registrations = registrationsTable.get(node);
- if (!registrations) return;
- for (var j = 0; j < registrations.length; j++) {
- var registration = registrations[j];
- if (registration.observer === observer) registration.removeTransientObservers();
- }
- }
- }
- function enqueueMutation(target, type, data) {
- var interestedObservers = Object.create(null);
- var associatedStrings = Object.create(null);
- for (var node = target; node; node = node.parentNode) {
- var registrations = registrationsTable.get(node);
- if (!registrations) continue;
- for (var j = 0; j < registrations.length; j++) {
- var registration = registrations[j];
- var options = registration.options;
- if (node !== target && !options.subtree) continue;
- if (type === "attributes" && !options.attributes) continue;
- if (type === "attributes" && options.attributeFilter && (data.namespace !== null || options.attributeFilter.indexOf(data.name) === -1)) {
- continue;
- }
- if (type === "characterData" && !options.characterData) continue;
- if (type === "childList" && !options.childList) continue;
- var observer = registration.observer;
- interestedObservers[observer.uid_] = observer;
- if (type === "attributes" && options.attributeOldValue || type === "characterData" && options.characterDataOldValue) {
- associatedStrings[observer.uid_] = data.oldValue;
- }
- }
- }
- for (var uid in interestedObservers) {
- var observer = interestedObservers[uid];
- var record = new MutationRecord(type, target);
- if ("name" in data && "namespace" in data) {
- record.attributeName = data.name;
- record.attributeNamespace = data.namespace;
- }
- if (data.addedNodes) record.addedNodes = data.addedNodes;
- if (data.removedNodes) record.removedNodes = data.removedNodes;
- if (data.previousSibling) record.previousSibling = data.previousSibling;
- if (data.nextSibling) record.nextSibling = data.nextSibling;
- if (associatedStrings[uid] !== undefined) record.oldValue = associatedStrings[uid];
- scheduleCallback(observer);
- observer.records_.push(record);
- }
- }
- var slice = Array.prototype.slice;
- function MutationObserverOptions(options) {
- this.childList = !!options.childList;
- this.subtree = !!options.subtree;
- if (!("attributes" in options) && ("attributeOldValue" in options || "attributeFilter" in options)) {
- this.attributes = true;
- } else {
- this.attributes = !!options.attributes;
- }
- if ("characterDataOldValue" in options && !("characterData" in options)) this.characterData = true; else this.characterData = !!options.characterData;
- if (!this.attributes && (options.attributeOldValue || "attributeFilter" in options) || !this.characterData && options.characterDataOldValue) {
- throw new TypeError();
- }
- this.characterData = !!options.characterData;
- this.attributeOldValue = !!options.attributeOldValue;
- this.characterDataOldValue = !!options.characterDataOldValue;
- if ("attributeFilter" in options) {
- if (options.attributeFilter == null || typeof options.attributeFilter !== "object") {
- throw new TypeError();
- }
- this.attributeFilter = slice.call(options.attributeFilter);
- } else {
- this.attributeFilter = null;
- }
- }
- var uidCounter = 0;
- function MutationObserver(callback) {
- this.callback_ = callback;
- this.nodes_ = [];
- this.records_ = [];
- this.uid_ = ++uidCounter;
- this.scheduled_ = false;
- }
- MutationObserver.prototype = {
- constructor: MutationObserver,
- observe: function(target, options) {
- target = wrapIfNeeded(target);
- var newOptions = new MutationObserverOptions(options);
- var registration;
- var registrations = registrationsTable.get(target);
- if (!registrations) registrationsTable.set(target, registrations = []);
- for (var i = 0; i < registrations.length; i++) {
- if (registrations[i].observer === this) {
- registration = registrations[i];
- registration.removeTransientObservers();
- registration.options = newOptions;
- }
- }
- if (!registration) {
- registration = new Registration(this, target, newOptions);
- registrations.push(registration);
- this.nodes_.push(target);
- }
- },
- disconnect: function() {
- this.nodes_.forEach(function(node) {
- var registrations = registrationsTable.get(node);
- for (var i = 0; i < registrations.length; i++) {
- var registration = registrations[i];
- if (registration.observer === this) {
- registrations.splice(i, 1);
- break;
- }
- }
- }, this);
- this.records_ = [];
- },
- takeRecords: function() {
- var copyOfRecords = this.records_;
- this.records_ = [];
- return copyOfRecords;
- }
- };
- function Registration(observer, target, options) {
- this.observer = observer;
- this.target = target;
- this.options = options;
- this.transientObservedNodes = [];
- }
- Registration.prototype = {
- addTransientObserver: function(node) {
- if (node === this.target) return;
- scheduleCallback(this.observer);
- this.transientObservedNodes.push(node);
- var registrations = registrationsTable.get(node);
- if (!registrations) registrationsTable.set(node, registrations = []);
- registrations.push(this);
- },
- removeTransientObservers: function() {
- var transientObservedNodes = this.transientObservedNodes;
- this.transientObservedNodes = [];
- for (var i = 0; i < transientObservedNodes.length; i++) {
- var node = transientObservedNodes[i];
- var registrations = registrationsTable.get(node);
- for (var j = 0; j < registrations.length; j++) {
- if (registrations[j] === this) {
- registrations.splice(j, 1);
- break;
- }
- }
- }
- }
- };
- scope.enqueueMutation = enqueueMutation;
- scope.registerTransientObservers = registerTransientObservers;
- scope.wrappers.MutationObserver = MutationObserver;
- scope.wrappers.MutationRecord = MutationRecord;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- function TreeScope(root, parent) {
- this.root = root;
- this.parent = parent;
- }
- TreeScope.prototype = {
- get renderer() {
- if (this.root instanceof scope.wrappers.ShadowRoot) {
- return scope.getRendererForHost(this.root.host);
- }
- return null;
- },
- contains: function(treeScope) {
- for (;treeScope; treeScope = treeScope.parent) {
- if (treeScope === this) return true;
- }
- return false;
- }
- };
- function setTreeScope(node, treeScope) {
- if (node.treeScope_ !== treeScope) {
- node.treeScope_ = treeScope;
- for (var sr = node.shadowRoot; sr; sr = sr.olderShadowRoot) {
- sr.treeScope_.parent = treeScope;
- }
- for (var child = node.firstChild; child; child = child.nextSibling) {
- setTreeScope(child, treeScope);
- }
- }
- }
- function getTreeScope(node) {
- if (node instanceof scope.wrappers.Window) {
- debugger;
- }
- if (node.treeScope_) return node.treeScope_;
- var parent = node.parentNode;
- var treeScope;
- if (parent) treeScope = getTreeScope(parent); else treeScope = new TreeScope(node, null);
- return node.treeScope_ = treeScope;
- }
- scope.TreeScope = TreeScope;
- scope.getTreeScope = getTreeScope;
- scope.setTreeScope = setTreeScope;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var forwardMethodsToWrapper = scope.forwardMethodsToWrapper;
- var getTreeScope = scope.getTreeScope;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var setWrapper = scope.setWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var wrappers = scope.wrappers;
- var wrappedFuns = new WeakMap();
- var listenersTable = new WeakMap();
- var handledEventsTable = new WeakMap();
- var currentlyDispatchingEvents = new WeakMap();
- var targetTable = new WeakMap();
- var currentTargetTable = new WeakMap();
- var relatedTargetTable = new WeakMap();
- var eventPhaseTable = new WeakMap();
- var stopPropagationTable = new WeakMap();
- var stopImmediatePropagationTable = new WeakMap();
- var eventHandlersTable = new WeakMap();
- var eventPathTable = new WeakMap();
- function isShadowRoot(node) {
- return node instanceof wrappers.ShadowRoot;
- }
- function rootOfNode(node) {
- return getTreeScope(node).root;
- }
- function getEventPath(node, event) {
- var path = [];
- var current = node;
- path.push(current);
- while (current) {
- var destinationInsertionPoints = getDestinationInsertionPoints(current);
- if (destinationInsertionPoints && destinationInsertionPoints.length > 0) {
- for (var i = 0; i < destinationInsertionPoints.length; i++) {
- var insertionPoint = destinationInsertionPoints[i];
- if (isShadowInsertionPoint(insertionPoint)) {
- var shadowRoot = rootOfNode(insertionPoint);
- var olderShadowRoot = shadowRoot.olderShadowRoot;
- if (olderShadowRoot) path.push(olderShadowRoot);
- }
- path.push(insertionPoint);
- }
- current = destinationInsertionPoints[destinationInsertionPoints.length - 1];
- } else {
- if (isShadowRoot(current)) {
- if (inSameTree(node, current) && eventMustBeStopped(event)) {
- break;
- }
- current = current.host;
- path.push(current);
- } else {
- current = current.parentNode;
- if (current) path.push(current);
- }
- }
- }
- return path;
- }
- function eventMustBeStopped(event) {
- if (!event) return false;
- switch (event.type) {
- case "abort":
- case "error":
- case "select":
- case "change":
- case "load":
- case "reset":
- case "resize":
- case "scroll":
- case "selectstart":
- return true;
- }
- return false;
- }
- function isShadowInsertionPoint(node) {
- return node instanceof HTMLShadowElement;
- }
- function getDestinationInsertionPoints(node) {
- return scope.getDestinationInsertionPoints(node);
- }
- function eventRetargetting(path, currentTarget) {
- if (path.length === 0) return currentTarget;
- if (currentTarget instanceof wrappers.Window) currentTarget = currentTarget.document;
- var currentTargetTree = getTreeScope(currentTarget);
- var originalTarget = path[0];
- var originalTargetTree = getTreeScope(originalTarget);
- var relativeTargetTree = lowestCommonInclusiveAncestor(currentTargetTree, originalTargetTree);
- for (var i = 0; i < path.length; i++) {
- var node = path[i];
- if (getTreeScope(node) === relativeTargetTree) return node;
- }
- return path[path.length - 1];
- }
- function getTreeScopeAncestors(treeScope) {
- var ancestors = [];
- for (;treeScope; treeScope = treeScope.parent) {
- ancestors.push(treeScope);
- }
- return ancestors;
- }
- function lowestCommonInclusiveAncestor(tsA, tsB) {
- var ancestorsA = getTreeScopeAncestors(tsA);
- var ancestorsB = getTreeScopeAncestors(tsB);
- var result = null;
- while (ancestorsA.length > 0 && ancestorsB.length > 0) {
- var a = ancestorsA.pop();
- var b = ancestorsB.pop();
- if (a === b) result = a; else break;
- }
- return result;
- }
- function getTreeScopeRoot(ts) {
- if (!ts.parent) return ts;
- return getTreeScopeRoot(ts.parent);
- }
- function relatedTargetResolution(event, currentTarget, relatedTarget) {
- if (currentTarget instanceof wrappers.Window) currentTarget = currentTarget.document;
- var currentTargetTree = getTreeScope(currentTarget);
- var relatedTargetTree = getTreeScope(relatedTarget);
- var relatedTargetEventPath = getEventPath(relatedTarget, event);
- var lowestCommonAncestorTree;
- var lowestCommonAncestorTree = lowestCommonInclusiveAncestor(currentTargetTree, relatedTargetTree);
- if (!lowestCommonAncestorTree) lowestCommonAncestorTree = relatedTargetTree.root;
- for (var commonAncestorTree = lowestCommonAncestorTree; commonAncestorTree; commonAncestorTree = commonAncestorTree.parent) {
- var adjustedRelatedTarget;
- for (var i = 0; i < relatedTargetEventPath.length; i++) {
- var node = relatedTargetEventPath[i];
- if (getTreeScope(node) === commonAncestorTree) return node;
- }
- }
- return null;
- }
- function inSameTree(a, b) {
- return getTreeScope(a) === getTreeScope(b);
- }
- var NONE = 0;
- var CAPTURING_PHASE = 1;
- var AT_TARGET = 2;
- var BUBBLING_PHASE = 3;
- var pendingError;
- function dispatchOriginalEvent(originalEvent) {
- if (handledEventsTable.get(originalEvent)) return;
- handledEventsTable.set(originalEvent, true);
- dispatchEvent(wrap(originalEvent), wrap(originalEvent.target));
- if (pendingError) {
- var err = pendingError;
- pendingError = null;
- throw err;
- }
- }
- function isLoadLikeEvent(event) {
- switch (event.type) {
- case "load":
- case "beforeunload":
- case "unload":
- return true;
- }
- return false;
- }
- function dispatchEvent(event, originalWrapperTarget) {
- if (currentlyDispatchingEvents.get(event)) throw new Error("InvalidStateError");
- currentlyDispatchingEvents.set(event, true);
- scope.renderAllPending();
- var eventPath;
- var overrideTarget;
- var win;
- if (isLoadLikeEvent(event) && !event.bubbles) {
- var doc = originalWrapperTarget;
- if (doc instanceof wrappers.Document && (win = doc.defaultView)) {
- overrideTarget = doc;
- eventPath = [];
- }
- }
- if (!eventPath) {
- if (originalWrapperTarget instanceof wrappers.Window) {
- win = originalWrapperTarget;
- eventPath = [];
- } else {
- eventPath = getEventPath(originalWrapperTarget, event);
- if (!isLoadLikeEvent(event)) {
- var doc = eventPath[eventPath.length - 1];
- if (doc instanceof wrappers.Document) win = doc.defaultView;
- }
- }
- }
- eventPathTable.set(event, eventPath);
- if (dispatchCapturing(event, eventPath, win, overrideTarget)) {
- if (dispatchAtTarget(event, eventPath, win, overrideTarget)) {
- dispatchBubbling(event, eventPath, win, overrideTarget);
- }
- }
- eventPhaseTable.set(event, NONE);
- currentTargetTable.delete(event, null);
- currentlyDispatchingEvents.delete(event);
- return event.defaultPrevented;
- }
- function dispatchCapturing(event, eventPath, win, overrideTarget) {
- var phase = CAPTURING_PHASE;
- if (win) {
- if (!invoke(win, event, phase, eventPath, overrideTarget)) return false;
- }
- for (var i = eventPath.length - 1; i > 0; i--) {
- if (!invoke(eventPath[i], event, phase, eventPath, overrideTarget)) return false;
- }
- return true;
- }
- function dispatchAtTarget(event, eventPath, win, overrideTarget) {
- var phase = AT_TARGET;
- var currentTarget = eventPath[0] || win;
- return invoke(currentTarget, event, phase, eventPath, overrideTarget);
- }
- function dispatchBubbling(event, eventPath, win, overrideTarget) {
- var phase = BUBBLING_PHASE;
- for (var i = 1; i < eventPath.length; i++) {
- if (!invoke(eventPath[i], event, phase, eventPath, overrideTarget)) return;
- }
- if (win && eventPath.length > 0) {
- invoke(win, event, phase, eventPath, overrideTarget);
- }
- }
- function invoke(currentTarget, event, phase, eventPath, overrideTarget) {
- var listeners = listenersTable.get(currentTarget);
- if (!listeners) return true;
- var target = overrideTarget || eventRetargetting(eventPath, currentTarget);
- if (target === currentTarget) {
- if (phase === CAPTURING_PHASE) return true;
- if (phase === BUBBLING_PHASE) phase = AT_TARGET;
- } else if (phase === BUBBLING_PHASE && !event.bubbles) {
- return true;
- }
- if ("relatedTarget" in event) {
- var originalEvent = unwrap(event);
- var unwrappedRelatedTarget = originalEvent.relatedTarget;
- if (unwrappedRelatedTarget) {
- if (unwrappedRelatedTarget instanceof Object && unwrappedRelatedTarget.addEventListener) {
- var relatedTarget = wrap(unwrappedRelatedTarget);
- var adjusted = relatedTargetResolution(event, currentTarget, relatedTarget);
- if (adjusted === target) return true;
- } else {
- adjusted = null;
- }
- relatedTargetTable.set(event, adjusted);
- }
- }
- eventPhaseTable.set(event, phase);
- var type = event.type;
- var anyRemoved = false;
- targetTable.set(event, target);
- currentTargetTable.set(event, currentTarget);
- listeners.depth++;
- for (var i = 0, len = listeners.length; i < len; i++) {
- var listener = listeners[i];
- if (listener.removed) {
- anyRemoved = true;
- continue;
- }
- if (listener.type !== type || !listener.capture && phase === CAPTURING_PHASE || listener.capture && phase === BUBBLING_PHASE) {
- continue;
- }
- try {
- if (typeof listener.handler === "function") listener.handler.call(currentTarget, event); else listener.handler.handleEvent(event);
- if (stopImmediatePropagationTable.get(event)) return false;
- } catch (ex) {
- if (!pendingError) pendingError = ex;
- }
- }
- listeners.depth--;
- if (anyRemoved && listeners.depth === 0) {
- var copy = listeners.slice();
- listeners.length = 0;
- for (var i = 0; i < copy.length; i++) {
- if (!copy[i].removed) listeners.push(copy[i]);
- }
- }
- return !stopPropagationTable.get(event);
- }
- function Listener(type, handler, capture) {
- this.type = type;
- this.handler = handler;
- this.capture = Boolean(capture);
- }
- Listener.prototype = {
- equals: function(that) {
- return this.handler === that.handler && this.type === that.type && this.capture === that.capture;
- },
- get removed() {
- return this.handler === null;
- },
- remove: function() {
- this.handler = null;
- }
- };
- var OriginalEvent = window.Event;
- OriginalEvent.prototype.polymerBlackList_ = {
- returnValue: true,
- keyLocation: true
- };
- function Event(type, options) {
- if (type instanceof OriginalEvent) {
- var impl = type;
- if (!OriginalBeforeUnloadEvent && impl.type === "beforeunload" && !(this instanceof BeforeUnloadEvent)) {
- return new BeforeUnloadEvent(impl);
- }
- setWrapper(impl, this);
- } else {
- return wrap(constructEvent(OriginalEvent, "Event", type, options));
- }
- }
- Event.prototype = {
- get target() {
- return targetTable.get(this);
- },
- get currentTarget() {
- return currentTargetTable.get(this);
- },
- get eventPhase() {
- return eventPhaseTable.get(this);
- },
- get path() {
- var eventPath = eventPathTable.get(this);
- if (!eventPath) return [];
- return eventPath.slice();
- },
- stopPropagation: function() {
- stopPropagationTable.set(this, true);
- },
- stopImmediatePropagation: function() {
- stopPropagationTable.set(this, true);
- stopImmediatePropagationTable.set(this, true);
- }
- };
- registerWrapper(OriginalEvent, Event, document.createEvent("Event"));
- function unwrapOptions(options) {
- if (!options || !options.relatedTarget) return options;
- return Object.create(options, {
- relatedTarget: {
- value: unwrap(options.relatedTarget)
- }
- });
- }
- function registerGenericEvent(name, SuperEvent, prototype) {
- var OriginalEvent = window[name];
- var GenericEvent = function(type, options) {
- if (type instanceof OriginalEvent) setWrapper(type, this); else return wrap(constructEvent(OriginalEvent, name, type, options));
- };
- GenericEvent.prototype = Object.create(SuperEvent.prototype);
- if (prototype) mixin(GenericEvent.prototype, prototype);
- if (OriginalEvent) {
- try {
- registerWrapper(OriginalEvent, GenericEvent, new OriginalEvent("temp"));
- } catch (ex) {
- registerWrapper(OriginalEvent, GenericEvent, document.createEvent(name));
- }
- }
- return GenericEvent;
- }
- var UIEvent = registerGenericEvent("UIEvent", Event);
- var CustomEvent = registerGenericEvent("CustomEvent", Event);
- var relatedTargetProto = {
- get relatedTarget() {
- var relatedTarget = relatedTargetTable.get(this);
- if (relatedTarget !== undefined) return relatedTarget;
- return wrap(unwrap(this).relatedTarget);
- }
- };
- function getInitFunction(name, relatedTargetIndex) {
- return function() {
- arguments[relatedTargetIndex] = unwrap(arguments[relatedTargetIndex]);
- var impl = unwrap(this);
- impl[name].apply(impl, arguments);
- };
- }
- var mouseEventProto = mixin({
- initMouseEvent: getInitFunction("initMouseEvent", 14)
- }, relatedTargetProto);
- var focusEventProto = mixin({
- initFocusEvent: getInitFunction("initFocusEvent", 5)
- }, relatedTargetProto);
- var MouseEvent = registerGenericEvent("MouseEvent", UIEvent, mouseEventProto);
- var FocusEvent = registerGenericEvent("FocusEvent", UIEvent, focusEventProto);
- var defaultInitDicts = Object.create(null);
- var supportsEventConstructors = function() {
- try {
- new window.FocusEvent("focus");
- } catch (ex) {
- return false;
- }
- return true;
- }();
- function constructEvent(OriginalEvent, name, type, options) {
- if (supportsEventConstructors) return new OriginalEvent(type, unwrapOptions(options));
- var event = unwrap(document.createEvent(name));
- var defaultDict = defaultInitDicts[name];
- var args = [ type ];
- Object.keys(defaultDict).forEach(function(key) {
- var v = options != null && key in options ? options[key] : defaultDict[key];
- if (key === "relatedTarget") v = unwrap(v);
- args.push(v);
- });
- event["init" + name].apply(event, args);
- return event;
- }
- if (!supportsEventConstructors) {
- var configureEventConstructor = function(name, initDict, superName) {
- if (superName) {
- var superDict = defaultInitDicts[superName];
- initDict = mixin(mixin({}, superDict), initDict);
- }
- defaultInitDicts[name] = initDict;
- };
- configureEventConstructor("Event", {
- bubbles: false,
- cancelable: false
- });
- configureEventConstructor("CustomEvent", {
- detail: null
- }, "Event");
- configureEventConstructor("UIEvent", {
- view: null,
- detail: 0
- }, "Event");
- configureEventConstructor("MouseEvent", {
- screenX: 0,
- screenY: 0,
- clientX: 0,
- clientY: 0,
- ctrlKey: false,
- altKey: false,
- shiftKey: false,
- metaKey: false,
- button: 0,
- relatedTarget: null
- }, "UIEvent");
- configureEventConstructor("FocusEvent", {
- relatedTarget: null
- }, "UIEvent");
- }
- var OriginalBeforeUnloadEvent = window.BeforeUnloadEvent;
- function BeforeUnloadEvent(impl) {
- Event.call(this, impl);
- }
- BeforeUnloadEvent.prototype = Object.create(Event.prototype);
- mixin(BeforeUnloadEvent.prototype, {
- get returnValue() {
- return unsafeUnwrap(this).returnValue;
- },
- set returnValue(v) {
- unsafeUnwrap(this).returnValue = v;
- }
- });
- if (OriginalBeforeUnloadEvent) registerWrapper(OriginalBeforeUnloadEvent, BeforeUnloadEvent);
- function isValidListener(fun) {
- if (typeof fun === "function") return true;
- return fun && fun.handleEvent;
- }
- function isMutationEvent(type) {
- switch (type) {
- case "DOMAttrModified":
- case "DOMAttributeNameChanged":
- case "DOMCharacterDataModified":
- case "DOMElementNameChanged":
- case "DOMNodeInserted":
- case "DOMNodeInsertedIntoDocument":
- case "DOMNodeRemoved":
- case "DOMNodeRemovedFromDocument":
- case "DOMSubtreeModified":
- return true;
- }
- return false;
- }
- var OriginalEventTarget = window.EventTarget;
- function EventTarget(impl) {
- setWrapper(impl, this);
- }
- var methodNames = [ "addEventListener", "removeEventListener", "dispatchEvent" ];
- [ Node, Window ].forEach(function(constructor) {
- var p = constructor.prototype;
- methodNames.forEach(function(name) {
- Object.defineProperty(p, name + "_", {
- value: p[name]
- });
- });
- });
- function getTargetToListenAt(wrapper) {
- if (wrapper instanceof wrappers.ShadowRoot) wrapper = wrapper.host;
- return unwrap(wrapper);
- }
- EventTarget.prototype = {
- addEventListener: function(type, fun, capture) {
- if (!isValidListener(fun) || isMutationEvent(type)) return;
- var listener = new Listener(type, fun, capture);
- var listeners = listenersTable.get(this);
- if (!listeners) {
- listeners = [];
- listeners.depth = 0;
- listenersTable.set(this, listeners);
- } else {
- for (var i = 0; i < listeners.length; i++) {
- if (listener.equals(listeners[i])) return;
- }
- }
- listeners.push(listener);
- var target = getTargetToListenAt(this);
- target.addEventListener_(type, dispatchOriginalEvent, true);
- },
- removeEventListener: function(type, fun, capture) {
- capture = Boolean(capture);
- var listeners = listenersTable.get(this);
- if (!listeners) return;
- var count = 0, found = false;
- for (var i = 0; i < listeners.length; i++) {
- if (listeners[i].type === type && listeners[i].capture === capture) {
- count++;
- if (listeners[i].handler === fun) {
- found = true;
- listeners[i].remove();
- }
- }
- }
- if (found && count === 1) {
- var target = getTargetToListenAt(this);
- target.removeEventListener_(type, dispatchOriginalEvent, true);
- }
- },
- dispatchEvent: function(event) {
- var nativeEvent = unwrap(event);
- var eventType = nativeEvent.type;
- handledEventsTable.set(nativeEvent, false);
- scope.renderAllPending();
- var tempListener;
- if (!hasListenerInAncestors(this, eventType)) {
- tempListener = function() {};
- this.addEventListener(eventType, tempListener, true);
- }
- try {
- return unwrap(this).dispatchEvent_(nativeEvent);
- } finally {
- if (tempListener) this.removeEventListener(eventType, tempListener, true);
- }
- }
- };
- function hasListener(node, type) {
- var listeners = listenersTable.get(node);
- if (listeners) {
- for (var i = 0; i < listeners.length; i++) {
- if (!listeners[i].removed && listeners[i].type === type) return true;
- }
- }
- return false;
- }
- function hasListenerInAncestors(target, type) {
- for (var node = unwrap(target); node; node = node.parentNode) {
- if (hasListener(wrap(node), type)) return true;
- }
- return false;
- }
- if (OriginalEventTarget) registerWrapper(OriginalEventTarget, EventTarget);
- function wrapEventTargetMethods(constructors) {
- forwardMethodsToWrapper(constructors, methodNames);
- }
- var originalElementFromPoint = document.elementFromPoint;
- function elementFromPoint(self, document, x, y) {
- scope.renderAllPending();
- var element = wrap(originalElementFromPoint.call(unsafeUnwrap(document), x, y));
- if (!element) return null;
- var path = getEventPath(element, null);
- var idx = path.lastIndexOf(self);
- if (idx == -1) return null; else path = path.slice(0, idx);
- return eventRetargetting(path, self);
- }
- function getEventHandlerGetter(name) {
- return function() {
- var inlineEventHandlers = eventHandlersTable.get(this);
- return inlineEventHandlers && inlineEventHandlers[name] && inlineEventHandlers[name].value || null;
- };
- }
- function getEventHandlerSetter(name) {
- var eventType = name.slice(2);
- return function(value) {
- var inlineEventHandlers = eventHandlersTable.get(this);
- if (!inlineEventHandlers) {
- inlineEventHandlers = Object.create(null);
- eventHandlersTable.set(this, inlineEventHandlers);
- }
- var old = inlineEventHandlers[name];
- if (old) this.removeEventListener(eventType, old.wrapped, false);
- if (typeof value === "function") {
- var wrapped = function(e) {
- var rv = value.call(this, e);
- if (rv === false) e.preventDefault(); else if (name === "onbeforeunload" && typeof rv === "string") e.returnValue = rv;
- };
- this.addEventListener(eventType, wrapped, false);
- inlineEventHandlers[name] = {
- value: value,
- wrapped: wrapped
- };
- }
- };
- }
- scope.elementFromPoint = elementFromPoint;
- scope.getEventHandlerGetter = getEventHandlerGetter;
- scope.getEventHandlerSetter = getEventHandlerSetter;
- scope.wrapEventTargetMethods = wrapEventTargetMethods;
- scope.wrappers.BeforeUnloadEvent = BeforeUnloadEvent;
- scope.wrappers.CustomEvent = CustomEvent;
- scope.wrappers.Event = Event;
- scope.wrappers.EventTarget = EventTarget;
- scope.wrappers.FocusEvent = FocusEvent;
- scope.wrappers.MouseEvent = MouseEvent;
- scope.wrappers.UIEvent = UIEvent;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var UIEvent = scope.wrappers.UIEvent;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var setWrapper = scope.setWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var wrap = scope.wrap;
- var OriginalTouchEvent = window.TouchEvent;
- if (!OriginalTouchEvent) return;
- var nativeEvent;
- try {
- nativeEvent = document.createEvent("TouchEvent");
- } catch (ex) {
- return;
- }
- var nonEnumDescriptor = {
- enumerable: false
- };
- function nonEnum(obj, prop) {
- Object.defineProperty(obj, prop, nonEnumDescriptor);
- }
- function Touch(impl) {
- setWrapper(impl, this);
- }
- Touch.prototype = {
- get target() {
- return wrap(unsafeUnwrap(this).target);
- }
- };
- var descr = {
- configurable: true,
- enumerable: true,
- get: null
- };
- [ "clientX", "clientY", "screenX", "screenY", "pageX", "pageY", "identifier", "webkitRadiusX", "webkitRadiusY", "webkitRotationAngle", "webkitForce" ].forEach(function(name) {
- descr.get = function() {
- return unsafeUnwrap(this)[name];
- };
- Object.defineProperty(Touch.prototype, name, descr);
- });
- function TouchList() {
- this.length = 0;
- nonEnum(this, "length");
- }
- TouchList.prototype = {
- item: function(index) {
- return this[index];
- }
- };
- function wrapTouchList(nativeTouchList) {
- var list = new TouchList();
- for (var i = 0; i < nativeTouchList.length; i++) {
- list[i] = new Touch(nativeTouchList[i]);
- }
- list.length = i;
- return list;
- }
- function TouchEvent(impl) {
- UIEvent.call(this, impl);
- }
- TouchEvent.prototype = Object.create(UIEvent.prototype);
- mixin(TouchEvent.prototype, {
- get touches() {
- return wrapTouchList(unsafeUnwrap(this).touches);
- },
- get targetTouches() {
- return wrapTouchList(unsafeUnwrap(this).targetTouches);
- },
- get changedTouches() {
- return wrapTouchList(unsafeUnwrap(this).changedTouches);
- },
- initTouchEvent: function() {
- throw new Error("Not implemented");
- }
- });
- registerWrapper(OriginalTouchEvent, TouchEvent, nativeEvent);
- scope.wrappers.Touch = Touch;
- scope.wrappers.TouchEvent = TouchEvent;
- scope.wrappers.TouchList = TouchList;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var unsafeUnwrap = scope.unsafeUnwrap;
- var wrap = scope.wrap;
- var nonEnumDescriptor = {
- enumerable: false
- };
- function nonEnum(obj, prop) {
- Object.defineProperty(obj, prop, nonEnumDescriptor);
- }
- function NodeList() {
- this.length = 0;
- nonEnum(this, "length");
- }
- NodeList.prototype = {
- item: function(index) {
- return this[index];
- }
- };
- nonEnum(NodeList.prototype, "item");
- function wrapNodeList(list) {
- if (list == null) return list;
- var wrapperList = new NodeList();
- for (var i = 0, length = list.length; i < length; i++) {
- wrapperList[i] = wrap(list[i]);
- }
- wrapperList.length = length;
- return wrapperList;
- }
- function addWrapNodeListMethod(wrapperConstructor, name) {
- wrapperConstructor.prototype[name] = function() {
- return wrapNodeList(unsafeUnwrap(this)[name].apply(unsafeUnwrap(this), arguments));
- };
- }
- scope.wrappers.NodeList = NodeList;
- scope.addWrapNodeListMethod = addWrapNodeListMethod;
- scope.wrapNodeList = wrapNodeList;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- scope.wrapHTMLCollection = scope.wrapNodeList;
- scope.wrappers.HTMLCollection = scope.wrappers.NodeList;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var EventTarget = scope.wrappers.EventTarget;
- var NodeList = scope.wrappers.NodeList;
- var TreeScope = scope.TreeScope;
- var assert = scope.assert;
- var defineWrapGetter = scope.defineWrapGetter;
- var enqueueMutation = scope.enqueueMutation;
- var getTreeScope = scope.getTreeScope;
- var isWrapper = scope.isWrapper;
- var mixin = scope.mixin;
- var registerTransientObservers = scope.registerTransientObservers;
- var registerWrapper = scope.registerWrapper;
- var setTreeScope = scope.setTreeScope;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var unwrapIfNeeded = scope.unwrapIfNeeded;
- var wrap = scope.wrap;
- var wrapIfNeeded = scope.wrapIfNeeded;
- var wrappers = scope.wrappers;
- function assertIsNodeWrapper(node) {
- assert(node instanceof Node);
- }
- function createOneElementNodeList(node) {
- var nodes = new NodeList();
- nodes[0] = node;
- nodes.length = 1;
- return nodes;
- }
- var surpressMutations = false;
- function enqueueRemovalForInsertedNodes(node, parent, nodes) {
- enqueueMutation(parent, "childList", {
- removedNodes: nodes,
- previousSibling: node.previousSibling,
- nextSibling: node.nextSibling
- });
- }
- function enqueueRemovalForInsertedDocumentFragment(df, nodes) {
- enqueueMutation(df, "childList", {
- removedNodes: nodes
- });
- }
- function collectNodes(node, parentNode, previousNode, nextNode) {
- if (node instanceof DocumentFragment) {
- var nodes = collectNodesForDocumentFragment(node);
- surpressMutations = true;
- for (var i = nodes.length - 1; i >= 0; i--) {
- node.removeChild(nodes[i]);
- nodes[i].parentNode_ = parentNode;
- }
- surpressMutations = false;
- for (var i = 0; i < nodes.length; i++) {
- nodes[i].previousSibling_ = nodes[i - 1] || previousNode;
- nodes[i].nextSibling_ = nodes[i + 1] || nextNode;
- }
- if (previousNode) previousNode.nextSibling_ = nodes[0];
- if (nextNode) nextNode.previousSibling_ = nodes[nodes.length - 1];
- return nodes;
- }
- var nodes = createOneElementNodeList(node);
- var oldParent = node.parentNode;
- if (oldParent) {
- oldParent.removeChild(node);
- }
- node.parentNode_ = parentNode;
- node.previousSibling_ = previousNode;
- node.nextSibling_ = nextNode;
- if (previousNode) previousNode.nextSibling_ = node;
- if (nextNode) nextNode.previousSibling_ = node;
- return nodes;
- }
- function collectNodesNative(node) {
- if (node instanceof DocumentFragment) return collectNodesForDocumentFragment(node);
- var nodes = createOneElementNodeList(node);
- var oldParent = node.parentNode;
- if (oldParent) enqueueRemovalForInsertedNodes(node, oldParent, nodes);
- return nodes;
- }
- function collectNodesForDocumentFragment(node) {
- var nodes = new NodeList();
- var i = 0;
- for (var child = node.firstChild; child; child = child.nextSibling) {
- nodes[i++] = child;
- }
- nodes.length = i;
- enqueueRemovalForInsertedDocumentFragment(node, nodes);
- return nodes;
- }
- function snapshotNodeList(nodeList) {
- return nodeList;
- }
- function nodeWasAdded(node, treeScope) {
- setTreeScope(node, treeScope);
- node.nodeIsInserted_();
- }
- function nodesWereAdded(nodes, parent) {
- var treeScope = getTreeScope(parent);
- for (var i = 0; i < nodes.length; i++) {
- nodeWasAdded(nodes[i], treeScope);
- }
- }
- function nodeWasRemoved(node) {
- setTreeScope(node, new TreeScope(node, null));
- }
- function nodesWereRemoved(nodes) {
- for (var i = 0; i < nodes.length; i++) {
- nodeWasRemoved(nodes[i]);
- }
- }
- function ensureSameOwnerDocument(parent, child) {
- var ownerDoc = parent.nodeType === Node.DOCUMENT_NODE ? parent : parent.ownerDocument;
- if (ownerDoc !== child.ownerDocument) ownerDoc.adoptNode(child);
- }
- function adoptNodesIfNeeded(owner, nodes) {
- if (!nodes.length) return;
- var ownerDoc = owner.ownerDocument;
- if (ownerDoc === nodes[0].ownerDocument) return;
- for (var i = 0; i < nodes.length; i++) {
- scope.adoptNodeNoRemove(nodes[i], ownerDoc);
- }
- }
- function unwrapNodesForInsertion(owner, nodes) {
- adoptNodesIfNeeded(owner, nodes);
- var length = nodes.length;
- if (length === 1) return unwrap(nodes[0]);
- var df = unwrap(owner.ownerDocument.createDocumentFragment());
- for (var i = 0; i < length; i++) {
- df.appendChild(unwrap(nodes[i]));
- }
- return df;
- }
- function clearChildNodes(wrapper) {
- if (wrapper.firstChild_ !== undefined) {
- var child = wrapper.firstChild_;
- while (child) {
- var tmp = child;
- child = child.nextSibling_;
- tmp.parentNode_ = tmp.previousSibling_ = tmp.nextSibling_ = undefined;
- }
- }
- wrapper.firstChild_ = wrapper.lastChild_ = undefined;
- }
- function removeAllChildNodes(wrapper) {
- if (wrapper.invalidateShadowRenderer()) {
- var childWrapper = wrapper.firstChild;
- while (childWrapper) {
- assert(childWrapper.parentNode === wrapper);
- var nextSibling = childWrapper.nextSibling;
- var childNode = unwrap(childWrapper);
- var parentNode = childNode.parentNode;
- if (parentNode) originalRemoveChild.call(parentNode, childNode);
- childWrapper.previousSibling_ = childWrapper.nextSibling_ = childWrapper.parentNode_ = null;
- childWrapper = nextSibling;
- }
- wrapper.firstChild_ = wrapper.lastChild_ = null;
- } else {
- var node = unwrap(wrapper);
- var child = node.firstChild;
- var nextSibling;
- while (child) {
- nextSibling = child.nextSibling;
- originalRemoveChild.call(node, child);
- child = nextSibling;
- }
- }
- }
- function invalidateParent(node) {
- var p = node.parentNode;
- return p && p.invalidateShadowRenderer();
- }
- function cleanupNodes(nodes) {
- for (var i = 0, n; i < nodes.length; i++) {
- n = nodes[i];
- n.parentNode.removeChild(n);
- }
- }
- var originalImportNode = document.importNode;
- var originalCloneNode = window.Node.prototype.cloneNode;
- function cloneNode(node, deep, opt_doc) {
- var clone;
- if (opt_doc) clone = wrap(originalImportNode.call(opt_doc, unsafeUnwrap(node), false)); else clone = wrap(originalCloneNode.call(unsafeUnwrap(node), false));
- if (deep) {
- for (var child = node.firstChild; child; child = child.nextSibling) {
- clone.appendChild(cloneNode(child, true, opt_doc));
- }
- if (node instanceof wrappers.HTMLTemplateElement) {
- var cloneContent = clone.content;
- for (var child = node.content.firstChild; child; child = child.nextSibling) {
- cloneContent.appendChild(cloneNode(child, true, opt_doc));
- }
- }
- }
- return clone;
- }
- function contains(self, child) {
- if (!child || getTreeScope(self) !== getTreeScope(child)) return false;
- for (var node = child; node; node = node.parentNode) {
- if (node === self) return true;
- }
- return false;
- }
- var OriginalNode = window.Node;
- function Node(original) {
- assert(original instanceof OriginalNode);
- EventTarget.call(this, original);
- this.parentNode_ = undefined;
- this.firstChild_ = undefined;
- this.lastChild_ = undefined;
- this.nextSibling_ = undefined;
- this.previousSibling_ = undefined;
- this.treeScope_ = undefined;
- }
- var OriginalDocumentFragment = window.DocumentFragment;
- var originalAppendChild = OriginalNode.prototype.appendChild;
- var originalCompareDocumentPosition = OriginalNode.prototype.compareDocumentPosition;
- var originalInsertBefore = OriginalNode.prototype.insertBefore;
- var originalRemoveChild = OriginalNode.prototype.removeChild;
- var originalReplaceChild = OriginalNode.prototype.replaceChild;
- var isIe = /Trident|Edge/.test(navigator.userAgent);
- var removeChildOriginalHelper = isIe ? function(parent, child) {
- try {
- originalRemoveChild.call(parent, child);
- } catch (ex) {
- if (!(parent instanceof OriginalDocumentFragment)) throw ex;
- }
- } : function(parent, child) {
- originalRemoveChild.call(parent, child);
- };
- Node.prototype = Object.create(EventTarget.prototype);
- mixin(Node.prototype, {
- appendChild: function(childWrapper) {
- return this.insertBefore(childWrapper, null);
- },
- insertBefore: function(childWrapper, refWrapper) {
- assertIsNodeWrapper(childWrapper);
- var refNode;
- if (refWrapper) {
- if (isWrapper(refWrapper)) {
- refNode = unwrap(refWrapper);
- } else {
- refNode = refWrapper;
- refWrapper = wrap(refNode);
- }
- } else {
- refWrapper = null;
- refNode = null;
- }
- refWrapper && assert(refWrapper.parentNode === this);
- var nodes;
- var previousNode = refWrapper ? refWrapper.previousSibling : this.lastChild;
- var useNative = !this.invalidateShadowRenderer() && !invalidateParent(childWrapper);
- if (useNative) nodes = collectNodesNative(childWrapper); else nodes = collectNodes(childWrapper, this, previousNode, refWrapper);
- if (useNative) {
- ensureSameOwnerDocument(this, childWrapper);
- clearChildNodes(this);
- originalInsertBefore.call(unsafeUnwrap(this), unwrap(childWrapper), refNode);
- } else {
- if (!previousNode) this.firstChild_ = nodes[0];
- if (!refWrapper) {
- this.lastChild_ = nodes[nodes.length - 1];
- if (this.firstChild_ === undefined) this.firstChild_ = this.firstChild;
- }
- var parentNode = refNode ? refNode.parentNode : unsafeUnwrap(this);
- if (parentNode) {
- originalInsertBefore.call(parentNode, unwrapNodesForInsertion(this, nodes), refNode);
- } else {
- adoptNodesIfNeeded(this, nodes);
- }
- }
- enqueueMutation(this, "childList", {
- addedNodes: nodes,
- nextSibling: refWrapper,
- previousSibling: previousNode
- });
- nodesWereAdded(nodes, this);
- return childWrapper;
- },
- removeChild: function(childWrapper) {
- assertIsNodeWrapper(childWrapper);
- if (childWrapper.parentNode !== this) {
- var found = false;
- var childNodes = this.childNodes;
- for (var ieChild = this.firstChild; ieChild; ieChild = ieChild.nextSibling) {
- if (ieChild === childWrapper) {
- found = true;
- break;
- }
- }
- if (!found) {
- throw new Error("NotFoundError");
- }
- }
- var childNode = unwrap(childWrapper);
- var childWrapperNextSibling = childWrapper.nextSibling;
- var childWrapperPreviousSibling = childWrapper.previousSibling;
- if (this.invalidateShadowRenderer()) {
- var thisFirstChild = this.firstChild;
- var thisLastChild = this.lastChild;
- var parentNode = childNode.parentNode;
- if (parentNode) removeChildOriginalHelper(parentNode, childNode);
- if (thisFirstChild === childWrapper) this.firstChild_ = childWrapperNextSibling;
- if (thisLastChild === childWrapper) this.lastChild_ = childWrapperPreviousSibling;
- if (childWrapperPreviousSibling) childWrapperPreviousSibling.nextSibling_ = childWrapperNextSibling;
- if (childWrapperNextSibling) {
- childWrapperNextSibling.previousSibling_ = childWrapperPreviousSibling;
- }
- childWrapper.previousSibling_ = childWrapper.nextSibling_ = childWrapper.parentNode_ = undefined;
- } else {
- clearChildNodes(this);
- removeChildOriginalHelper(unsafeUnwrap(this), childNode);
- }
- if (!surpressMutations) {
- enqueueMutation(this, "childList", {
- removedNodes: createOneElementNodeList(childWrapper),
- nextSibling: childWrapperNextSibling,
- previousSibling: childWrapperPreviousSibling
- });
- }
- registerTransientObservers(this, childWrapper);
- return childWrapper;
- },
- replaceChild: function(newChildWrapper, oldChildWrapper) {
- assertIsNodeWrapper(newChildWrapper);
- var oldChildNode;
- if (isWrapper(oldChildWrapper)) {
- oldChildNode = unwrap(oldChildWrapper);
- } else {
- oldChildNode = oldChildWrapper;
- oldChildWrapper = wrap(oldChildNode);
- }
- if (oldChildWrapper.parentNode !== this) {
- throw new Error("NotFoundError");
- }
- var nextNode = oldChildWrapper.nextSibling;
- var previousNode = oldChildWrapper.previousSibling;
- var nodes;
- var useNative = !this.invalidateShadowRenderer() && !invalidateParent(newChildWrapper);
- if (useNative) {
- nodes = collectNodesNative(newChildWrapper);
- } else {
- if (nextNode === newChildWrapper) nextNode = newChildWrapper.nextSibling;
- nodes = collectNodes(newChildWrapper, this, previousNode, nextNode);
- }
- if (!useNative) {
- if (this.firstChild === oldChildWrapper) this.firstChild_ = nodes[0];
- if (this.lastChild === oldChildWrapper) this.lastChild_ = nodes[nodes.length - 1];
- oldChildWrapper.previousSibling_ = oldChildWrapper.nextSibling_ = oldChildWrapper.parentNode_ = undefined;
- if (oldChildNode.parentNode) {
- originalReplaceChild.call(oldChildNode.parentNode, unwrapNodesForInsertion(this, nodes), oldChildNode);
- }
- } else {
- ensureSameOwnerDocument(this, newChildWrapper);
- clearChildNodes(this);
- originalReplaceChild.call(unsafeUnwrap(this), unwrap(newChildWrapper), oldChildNode);
- }
- enqueueMutation(this, "childList", {
- addedNodes: nodes,
- removedNodes: createOneElementNodeList(oldChildWrapper),
- nextSibling: nextNode,
- previousSibling: previousNode
- });
- nodeWasRemoved(oldChildWrapper);
- nodesWereAdded(nodes, this);
- return oldChildWrapper;
- },
- nodeIsInserted_: function() {
- for (var child = this.firstChild; child; child = child.nextSibling) {
- child.nodeIsInserted_();
- }
- },
- hasChildNodes: function() {
- return this.firstChild !== null;
- },
- get parentNode() {
- return this.parentNode_ !== undefined ? this.parentNode_ : wrap(unsafeUnwrap(this).parentNode);
- },
- get firstChild() {
- return this.firstChild_ !== undefined ? this.firstChild_ : wrap(unsafeUnwrap(this).firstChild);
- },
- get lastChild() {
- return this.lastChild_ !== undefined ? this.lastChild_ : wrap(unsafeUnwrap(this).lastChild);
- },
- get nextSibling() {
- return this.nextSibling_ !== undefined ? this.nextSibling_ : wrap(unsafeUnwrap(this).nextSibling);
- },
- get previousSibling() {
- return this.previousSibling_ !== undefined ? this.previousSibling_ : wrap(unsafeUnwrap(this).previousSibling);
- },
- get parentElement() {
- var p = this.parentNode;
- while (p && p.nodeType !== Node.ELEMENT_NODE) {
- p = p.parentNode;
- }
- return p;
- },
- get textContent() {
- var s = "";
- for (var child = this.firstChild; child; child = child.nextSibling) {
- if (child.nodeType != Node.COMMENT_NODE) {
- s += child.textContent;
- }
- }
- return s;
- },
- set textContent(textContent) {
- if (textContent == null) textContent = "";
- var removedNodes = snapshotNodeList(this.childNodes);
- if (this.invalidateShadowRenderer()) {
- removeAllChildNodes(this);
- if (textContent !== "") {
- var textNode = unsafeUnwrap(this).ownerDocument.createTextNode(textContent);
- this.appendChild(textNode);
- }
- } else {
- clearChildNodes(this);
- unsafeUnwrap(this).textContent = textContent;
- }
- var addedNodes = snapshotNodeList(this.childNodes);
- enqueueMutation(this, "childList", {
- addedNodes: addedNodes,
- removedNodes: removedNodes
- });
- nodesWereRemoved(removedNodes);
- nodesWereAdded(addedNodes, this);
- },
- get childNodes() {
- var wrapperList = new NodeList();
- var i = 0;
- for (var child = this.firstChild; child; child = child.nextSibling) {
- wrapperList[i++] = child;
- }
- wrapperList.length = i;
- return wrapperList;
- },
- cloneNode: function(deep) {
- return cloneNode(this, deep);
- },
- contains: function(child) {
- return contains(this, wrapIfNeeded(child));
- },
- compareDocumentPosition: function(otherNode) {
- return originalCompareDocumentPosition.call(unsafeUnwrap(this), unwrapIfNeeded(otherNode));
- },
- normalize: function() {
- var nodes = snapshotNodeList(this.childNodes);
- var remNodes = [];
- var s = "";
- var modNode;
- for (var i = 0, n; i < nodes.length; i++) {
- n = nodes[i];
- if (n.nodeType === Node.TEXT_NODE) {
- if (!modNode && !n.data.length) this.removeChild(n); else if (!modNode) modNode = n; else {
- s += n.data;
- remNodes.push(n);
- }
- } else {
- if (modNode && remNodes.length) {
- modNode.data += s;
- cleanupNodes(remNodes);
- }
- remNodes = [];
- s = "";
- modNode = null;
- if (n.childNodes.length) n.normalize();
- }
- }
- if (modNode && remNodes.length) {
- modNode.data += s;
- cleanupNodes(remNodes);
- }
- }
- });
- defineWrapGetter(Node, "ownerDocument");
- registerWrapper(OriginalNode, Node, document.createDocumentFragment());
- delete Node.prototype.querySelector;
- delete Node.prototype.querySelectorAll;
- Node.prototype = mixin(Object.create(EventTarget.prototype), Node.prototype);
- scope.cloneNode = cloneNode;
- scope.nodeWasAdded = nodeWasAdded;
- scope.nodeWasRemoved = nodeWasRemoved;
- scope.nodesWereAdded = nodesWereAdded;
- scope.nodesWereRemoved = nodesWereRemoved;
- scope.originalInsertBefore = originalInsertBefore;
- scope.originalRemoveChild = originalRemoveChild;
- scope.snapshotNodeList = snapshotNodeList;
- scope.wrappers.Node = Node;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLCollection = scope.wrappers.HTMLCollection;
- var NodeList = scope.wrappers.NodeList;
- var getTreeScope = scope.getTreeScope;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var wrap = scope.wrap;
- var originalDocumentQuerySelector = document.querySelector;
- var originalElementQuerySelector = document.documentElement.querySelector;
- var originalDocumentQuerySelectorAll = document.querySelectorAll;
- var originalElementQuerySelectorAll = document.documentElement.querySelectorAll;
- var originalDocumentGetElementsByTagName = document.getElementsByTagName;
- var originalElementGetElementsByTagName = document.documentElement.getElementsByTagName;
- var originalDocumentGetElementsByTagNameNS = document.getElementsByTagNameNS;
- var originalElementGetElementsByTagNameNS = document.documentElement.getElementsByTagNameNS;
- var OriginalElement = window.Element;
- var OriginalDocument = window.HTMLDocument || window.Document;
- function filterNodeList(list, index, result, deep) {
- var wrappedItem = null;
- var root = null;
- for (var i = 0, length = list.length; i < length; i++) {
- wrappedItem = wrap(list[i]);
- if (!deep && (root = getTreeScope(wrappedItem).root)) {
- if (root instanceof scope.wrappers.ShadowRoot) {
- continue;
- }
- }
- result[index++] = wrappedItem;
- }
- return index;
- }
- function shimSelector(selector) {
- return String(selector).replace(/\/deep\/|::shadow/g, " ");
- }
- function shimMatchesSelector(selector) {
- return String(selector).replace(/:host\(([^\s]+)\)/g, "$1").replace(/([^\s]):host/g, "$1").replace(":host", "*").replace(/\^|\/shadow\/|\/shadow-deep\/|::shadow|\/deep\/|::content/g, " ");
- }
- function findOne(node, selector) {
- var m, el = node.firstElementChild;
- while (el) {
- if (el.matches(selector)) return el;
- m = findOne(el, selector);
- if (m) return m;
- el = el.nextElementSibling;
- }
- return null;
- }
- function matchesSelector(el, selector) {
- return el.matches(selector);
- }
- var XHTML_NS = "http://www.w3.org/1999/xhtml";
- function matchesTagName(el, localName, localNameLowerCase) {
- var ln = el.localName;
- return ln === localName || ln === localNameLowerCase && el.namespaceURI === XHTML_NS;
- }
- function matchesEveryThing() {
- return true;
- }
- function matchesLocalNameOnly(el, ns, localName) {
- return el.localName === localName;
- }
- function matchesNameSpace(el, ns) {
- return el.namespaceURI === ns;
- }
- function matchesLocalNameNS(el, ns, localName) {
- return el.namespaceURI === ns && el.localName === localName;
- }
- function findElements(node, index, result, p, arg0, arg1) {
- var el = node.firstElementChild;
- while (el) {
- if (p(el, arg0, arg1)) result[index++] = el;
- index = findElements(el, index, result, p, arg0, arg1);
- el = el.nextElementSibling;
- }
- return index;
- }
- function querySelectorAllFiltered(p, index, result, selector, deep) {
- var target = unsafeUnwrap(this);
- var list;
- var root = getTreeScope(this).root;
- if (root instanceof scope.wrappers.ShadowRoot) {
- return findElements(this, index, result, p, selector, null);
- } else if (target instanceof OriginalElement) {
- list = originalElementQuerySelectorAll.call(target, selector);
- } else if (target instanceof OriginalDocument) {
- list = originalDocumentQuerySelectorAll.call(target, selector);
- } else {
- return findElements(this, index, result, p, selector, null);
- }
- return filterNodeList(list, index, result, deep);
- }
- var SelectorsInterface = {
- querySelector: function(selector) {
- var shimmed = shimSelector(selector);
- var deep = shimmed !== selector;
- selector = shimmed;
- var target = unsafeUnwrap(this);
- var wrappedItem;
- var root = getTreeScope(this).root;
- if (root instanceof scope.wrappers.ShadowRoot) {
- return findOne(this, selector);
- } else if (target instanceof OriginalElement) {
- wrappedItem = wrap(originalElementQuerySelector.call(target, selector));
- } else if (target instanceof OriginalDocument) {
- wrappedItem = wrap(originalDocumentQuerySelector.call(target, selector));
- } else {
- return findOne(this, selector);
- }
- if (!wrappedItem) {
- return wrappedItem;
- } else if (!deep && (root = getTreeScope(wrappedItem).root)) {
- if (root instanceof scope.wrappers.ShadowRoot) {
- return findOne(this, selector);
- }
- }
- return wrappedItem;
- },
- querySelectorAll: function(selector) {
- var shimmed = shimSelector(selector);
- var deep = shimmed !== selector;
- selector = shimmed;
- var result = new NodeList();
- result.length = querySelectorAllFiltered.call(this, matchesSelector, 0, result, selector, deep);
- return result;
- }
- };
- var MatchesInterface = {
- matches: function(selector) {
- selector = shimMatchesSelector(selector);
- return scope.originalMatches.call(unsafeUnwrap(this), selector);
- }
- };
- function getElementsByTagNameFiltered(p, index, result, localName, lowercase) {
- var target = unsafeUnwrap(this);
- var list;
- var root = getTreeScope(this).root;
- if (root instanceof scope.wrappers.ShadowRoot) {
- return findElements(this, index, result, p, localName, lowercase);
- } else if (target instanceof OriginalElement) {
- list = originalElementGetElementsByTagName.call(target, localName, lowercase);
- } else if (target instanceof OriginalDocument) {
- list = originalDocumentGetElementsByTagName.call(target, localName, lowercase);
- } else {
- return findElements(this, index, result, p, localName, lowercase);
- }
- return filterNodeList(list, index, result, false);
- }
- function getElementsByTagNameNSFiltered(p, index, result, ns, localName) {
- var target = unsafeUnwrap(this);
- var list;
- var root = getTreeScope(this).root;
- if (root instanceof scope.wrappers.ShadowRoot) {
- return findElements(this, index, result, p, ns, localName);
- } else if (target instanceof OriginalElement) {
- list = originalElementGetElementsByTagNameNS.call(target, ns, localName);
- } else if (target instanceof OriginalDocument) {
- list = originalDocumentGetElementsByTagNameNS.call(target, ns, localName);
- } else {
- return findElements(this, index, result, p, ns, localName);
- }
- return filterNodeList(list, index, result, false);
- }
- var GetElementsByInterface = {
- getElementsByTagName: function(localName) {
- var result = new HTMLCollection();
- var match = localName === "*" ? matchesEveryThing : matchesTagName;
- result.length = getElementsByTagNameFiltered.call(this, match, 0, result, localName, localName.toLowerCase());
- return result;
- },
- getElementsByClassName: function(className) {
- return this.querySelectorAll("." + className);
- },
- getElementsByTagNameNS: function(ns, localName) {
- var result = new HTMLCollection();
- var match = null;
- if (ns === "*") {
- match = localName === "*" ? matchesEveryThing : matchesLocalNameOnly;
- } else {
- match = localName === "*" ? matchesNameSpace : matchesLocalNameNS;
- }
- result.length = getElementsByTagNameNSFiltered.call(this, match, 0, result, ns || null, localName);
- return result;
- }
- };
- scope.GetElementsByInterface = GetElementsByInterface;
- scope.SelectorsInterface = SelectorsInterface;
- scope.MatchesInterface = MatchesInterface;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var NodeList = scope.wrappers.NodeList;
- function forwardElement(node) {
- while (node && node.nodeType !== Node.ELEMENT_NODE) {
- node = node.nextSibling;
- }
- return node;
- }
- function backwardsElement(node) {
- while (node && node.nodeType !== Node.ELEMENT_NODE) {
- node = node.previousSibling;
- }
- return node;
- }
- var ParentNodeInterface = {
- get firstElementChild() {
- return forwardElement(this.firstChild);
- },
- get lastElementChild() {
- return backwardsElement(this.lastChild);
- },
- get childElementCount() {
- var count = 0;
- for (var child = this.firstElementChild; child; child = child.nextElementSibling) {
- count++;
- }
- return count;
- },
- get children() {
- var wrapperList = new NodeList();
- var i = 0;
- for (var child = this.firstElementChild; child; child = child.nextElementSibling) {
- wrapperList[i++] = child;
- }
- wrapperList.length = i;
- return wrapperList;
- },
- remove: function() {
- var p = this.parentNode;
- if (p) p.removeChild(this);
- }
- };
- var ChildNodeInterface = {
- get nextElementSibling() {
- return forwardElement(this.nextSibling);
- },
- get previousElementSibling() {
- return backwardsElement(this.previousSibling);
- }
- };
- scope.ChildNodeInterface = ChildNodeInterface;
- scope.ParentNodeInterface = ParentNodeInterface;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var ChildNodeInterface = scope.ChildNodeInterface;
- var Node = scope.wrappers.Node;
- var enqueueMutation = scope.enqueueMutation;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var OriginalCharacterData = window.CharacterData;
- function CharacterData(node) {
- Node.call(this, node);
- }
- CharacterData.prototype = Object.create(Node.prototype);
- mixin(CharacterData.prototype, {
- get textContent() {
- return this.data;
- },
- set textContent(value) {
- this.data = value;
- },
- get data() {
- return unsafeUnwrap(this).data;
- },
- set data(value) {
- var oldValue = unsafeUnwrap(this).data;
- enqueueMutation(this, "characterData", {
- oldValue: oldValue
- });
- unsafeUnwrap(this).data = value;
- }
- });
- mixin(CharacterData.prototype, ChildNodeInterface);
- registerWrapper(OriginalCharacterData, CharacterData, document.createTextNode(""));
- scope.wrappers.CharacterData = CharacterData;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var CharacterData = scope.wrappers.CharacterData;
- var enqueueMutation = scope.enqueueMutation;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- function toUInt32(x) {
- return x >>> 0;
- }
- var OriginalText = window.Text;
- function Text(node) {
- CharacterData.call(this, node);
- }
- Text.prototype = Object.create(CharacterData.prototype);
- mixin(Text.prototype, {
- splitText: function(offset) {
- offset = toUInt32(offset);
- var s = this.data;
- if (offset > s.length) throw new Error("IndexSizeError");
- var head = s.slice(0, offset);
- var tail = s.slice(offset);
- this.data = head;
- var newTextNode = this.ownerDocument.createTextNode(tail);
- if (this.parentNode) this.parentNode.insertBefore(newTextNode, this.nextSibling);
- return newTextNode;
- }
- });
- registerWrapper(OriginalText, Text, document.createTextNode(""));
- scope.wrappers.Text = Text;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- if (!window.DOMTokenList) {
- console.warn("Missing DOMTokenList prototype, please include a " + "compatible classList polyfill such as http://goo.gl/uTcepH.");
- return;
- }
- var unsafeUnwrap = scope.unsafeUnwrap;
- var enqueueMutation = scope.enqueueMutation;
- function getClass(el) {
- return unsafeUnwrap(el).getAttribute("class");
- }
- function enqueueClassAttributeChange(el, oldValue) {
- enqueueMutation(el, "attributes", {
- name: "class",
- namespace: null,
- oldValue: oldValue
- });
- }
- function invalidateClass(el) {
- scope.invalidateRendererBasedOnAttribute(el, "class");
- }
- function changeClass(tokenList, method, args) {
- var ownerElement = tokenList.ownerElement_;
- if (ownerElement == null) {
- return method.apply(tokenList, args);
- }
- var oldValue = getClass(ownerElement);
- var retv = method.apply(tokenList, args);
- if (getClass(ownerElement) !== oldValue) {
- enqueueClassAttributeChange(ownerElement, oldValue);
- invalidateClass(ownerElement);
- }
- return retv;
- }
- var oldAdd = DOMTokenList.prototype.add;
- DOMTokenList.prototype.add = function() {
- changeClass(this, oldAdd, arguments);
- };
- var oldRemove = DOMTokenList.prototype.remove;
- DOMTokenList.prototype.remove = function() {
- changeClass(this, oldRemove, arguments);
- };
- var oldToggle = DOMTokenList.prototype.toggle;
- DOMTokenList.prototype.toggle = function() {
- return changeClass(this, oldToggle, arguments);
- };
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var ChildNodeInterface = scope.ChildNodeInterface;
- var GetElementsByInterface = scope.GetElementsByInterface;
- var Node = scope.wrappers.Node;
- var ParentNodeInterface = scope.ParentNodeInterface;
- var SelectorsInterface = scope.SelectorsInterface;
- var MatchesInterface = scope.MatchesInterface;
- var addWrapNodeListMethod = scope.addWrapNodeListMethod;
- var enqueueMutation = scope.enqueueMutation;
- var mixin = scope.mixin;
- var oneOf = scope.oneOf;
- var registerWrapper = scope.registerWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var wrappers = scope.wrappers;
- var OriginalElement = window.Element;
- var matchesNames = [ "matches", "mozMatchesSelector", "msMatchesSelector", "webkitMatchesSelector" ].filter(function(name) {
- return OriginalElement.prototype[name];
- });
- var matchesName = matchesNames[0];
- var originalMatches = OriginalElement.prototype[matchesName];
- function invalidateRendererBasedOnAttribute(element, name) {
- var p = element.parentNode;
- if (!p || !p.shadowRoot) return;
- var renderer = scope.getRendererForHost(p);
- if (renderer.dependsOnAttribute(name)) renderer.invalidate();
- }
- function enqueAttributeChange(element, name, oldValue) {
- enqueueMutation(element, "attributes", {
- name: name,
- namespace: null,
- oldValue: oldValue
- });
- }
- var classListTable = new WeakMap();
- function Element(node) {
- Node.call(this, node);
- }
- Element.prototype = Object.create(Node.prototype);
- mixin(Element.prototype, {
- createShadowRoot: function() {
- var newShadowRoot = new wrappers.ShadowRoot(this);
- unsafeUnwrap(this).polymerShadowRoot_ = newShadowRoot;
- var renderer = scope.getRendererForHost(this);
- renderer.invalidate();
- return newShadowRoot;
- },
- get shadowRoot() {
- return unsafeUnwrap(this).polymerShadowRoot_ || null;
- },
- setAttribute: function(name, value) {
- var oldValue = unsafeUnwrap(this).getAttribute(name);
- unsafeUnwrap(this).setAttribute(name, value);
- enqueAttributeChange(this, name, oldValue);
- invalidateRendererBasedOnAttribute(this, name);
- },
- removeAttribute: function(name) {
- var oldValue = unsafeUnwrap(this).getAttribute(name);
- unsafeUnwrap(this).removeAttribute(name);
- enqueAttributeChange(this, name, oldValue);
- invalidateRendererBasedOnAttribute(this, name);
- },
- get classList() {
- var list = classListTable.get(this);
- if (!list) {
- list = unsafeUnwrap(this).classList;
- if (!list) return;
- list.ownerElement_ = this;
- classListTable.set(this, list);
- }
- return list;
- },
- get className() {
- return unsafeUnwrap(this).className;
- },
- set className(v) {
- this.setAttribute("class", v);
- },
- get id() {
- return unsafeUnwrap(this).id;
- },
- set id(v) {
- this.setAttribute("id", v);
- }
- });
- matchesNames.forEach(function(name) {
- if (name !== "matches") {
- Element.prototype[name] = function(selector) {
- return this.matches(selector);
- };
- }
- });
- if (OriginalElement.prototype.webkitCreateShadowRoot) {
- Element.prototype.webkitCreateShadowRoot = Element.prototype.createShadowRoot;
- }
- mixin(Element.prototype, ChildNodeInterface);
- mixin(Element.prototype, GetElementsByInterface);
- mixin(Element.prototype, ParentNodeInterface);
- mixin(Element.prototype, SelectorsInterface);
- mixin(Element.prototype, MatchesInterface);
- registerWrapper(OriginalElement, Element, document.createElementNS(null, "x"));
- scope.invalidateRendererBasedOnAttribute = invalidateRendererBasedOnAttribute;
- scope.matchesNames = matchesNames;
- scope.originalMatches = originalMatches;
- scope.wrappers.Element = Element;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var Element = scope.wrappers.Element;
- var defineGetter = scope.defineGetter;
- var enqueueMutation = scope.enqueueMutation;
- var mixin = scope.mixin;
- var nodesWereAdded = scope.nodesWereAdded;
- var nodesWereRemoved = scope.nodesWereRemoved;
- var registerWrapper = scope.registerWrapper;
- var snapshotNodeList = scope.snapshotNodeList;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var wrappers = scope.wrappers;
- var escapeAttrRegExp = /[&\u00A0"]/g;
- var escapeDataRegExp = /[&\u00A0<>]/g;
- function escapeReplace(c) {
- switch (c) {
- case "&":
- return "&amp;";
-
- case "<":
- return "&lt;";
-
- case ">":
- return "&gt;";
-
- case '"':
- return "&quot;";
-
- case " ":
- return "&nbsp;";
- }
- }
- function escapeAttr(s) {
- return s.replace(escapeAttrRegExp, escapeReplace);
- }
- function escapeData(s) {
- return s.replace(escapeDataRegExp, escapeReplace);
- }
- function makeSet(arr) {
- var set = {};
- for (var i = 0; i < arr.length; i++) {
- set[arr[i]] = true;
- }
- return set;
- }
- var voidElements = makeSet([ "area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr" ]);
- var plaintextParents = makeSet([ "style", "script", "xmp", "iframe", "noembed", "noframes", "plaintext", "noscript" ]);
- function getOuterHTML(node, parentNode) {
- switch (node.nodeType) {
- case Node.ELEMENT_NODE:
- var tagName = node.tagName.toLowerCase();
- var s = "<" + tagName;
- var attrs = node.attributes;
- for (var i = 0, attr; attr = attrs[i]; i++) {
- s += " " + attr.name + '="' + escapeAttr(attr.value) + '"';
- }
- s += ">";
- if (voidElements[tagName]) return s;
- return s + getInnerHTML(node) + "</" + tagName + ">";
-
- case Node.TEXT_NODE:
- var data = node.data;
- if (parentNode && plaintextParents[parentNode.localName]) return data;
- return escapeData(data);
-
- case Node.COMMENT_NODE:
- return "<!--" + node.data + "-->";
-
- default:
- console.error(node);
- throw new Error("not implemented");
- }
- }
- function getInnerHTML(node) {
- if (node instanceof wrappers.HTMLTemplateElement) node = node.content;
- var s = "";
- for (var child = node.firstChild; child; child = child.nextSibling) {
- s += getOuterHTML(child, node);
- }
- return s;
- }
- function setInnerHTML(node, value, opt_tagName) {
- var tagName = opt_tagName || "div";
- node.textContent = "";
- var tempElement = unwrap(node.ownerDocument.createElement(tagName));
- tempElement.innerHTML = value;
- var firstChild;
- while (firstChild = tempElement.firstChild) {
- node.appendChild(wrap(firstChild));
- }
- }
- var oldIe = /MSIE/.test(navigator.userAgent);
- var OriginalHTMLElement = window.HTMLElement;
- var OriginalHTMLTemplateElement = window.HTMLTemplateElement;
- function HTMLElement(node) {
- Element.call(this, node);
- }
- HTMLElement.prototype = Object.create(Element.prototype);
- mixin(HTMLElement.prototype, {
- get innerHTML() {
- return getInnerHTML(this);
- },
- set innerHTML(value) {
- if (oldIe && plaintextParents[this.localName]) {
- this.textContent = value;
- return;
- }
- var removedNodes = snapshotNodeList(this.childNodes);
- if (this.invalidateShadowRenderer()) {
- if (this instanceof wrappers.HTMLTemplateElement) setInnerHTML(this.content, value); else setInnerHTML(this, value, this.tagName);
- } else if (!OriginalHTMLTemplateElement && this instanceof wrappers.HTMLTemplateElement) {
- setInnerHTML(this.content, value);
- } else {
- unsafeUnwrap(this).innerHTML = value;
- }
- var addedNodes = snapshotNodeList(this.childNodes);
- enqueueMutation(this, "childList", {
- addedNodes: addedNodes,
- removedNodes: removedNodes
- });
- nodesWereRemoved(removedNodes);
- nodesWereAdded(addedNodes, this);
- },
- get outerHTML() {
- return getOuterHTML(this, this.parentNode);
- },
- set outerHTML(value) {
- var p = this.parentNode;
- if (p) {
- p.invalidateShadowRenderer();
- var df = frag(p, value);
- p.replaceChild(df, this);
- }
- },
- insertAdjacentHTML: function(position, text) {
- var contextElement, refNode;
- switch (String(position).toLowerCase()) {
- case "beforebegin":
- contextElement = this.parentNode;
- refNode = this;
- break;
-
- case "afterend":
- contextElement = this.parentNode;
- refNode = this.nextSibling;
- break;
-
- case "afterbegin":
- contextElement = this;
- refNode = this.firstChild;
- break;
-
- case "beforeend":
- contextElement = this;
- refNode = null;
- break;
-
- default:
- return;
- }
- var df = frag(contextElement, text);
- contextElement.insertBefore(df, refNode);
- },
- get hidden() {
- return this.hasAttribute("hidden");
- },
- set hidden(v) {
- if (v) {
- this.setAttribute("hidden", "");
- } else {
- this.removeAttribute("hidden");
- }
- }
- });
- function frag(contextElement, html) {
- var p = unwrap(contextElement.cloneNode(false));
- p.innerHTML = html;
- var df = unwrap(document.createDocumentFragment());
- var c;
- while (c = p.firstChild) {
- df.appendChild(c);
- }
- return wrap(df);
- }
- function getter(name) {
- return function() {
- scope.renderAllPending();
- return unsafeUnwrap(this)[name];
- };
- }
- function getterRequiresRendering(name) {
- defineGetter(HTMLElement, name, getter(name));
- }
- [ "clientHeight", "clientLeft", "clientTop", "clientWidth", "offsetHeight", "offsetLeft", "offsetTop", "offsetWidth", "scrollHeight", "scrollWidth" ].forEach(getterRequiresRendering);
- function getterAndSetterRequiresRendering(name) {
- Object.defineProperty(HTMLElement.prototype, name, {
- get: getter(name),
- set: function(v) {
- scope.renderAllPending();
- unsafeUnwrap(this)[name] = v;
- },
- configurable: true,
- enumerable: true
- });
- }
- [ "scrollLeft", "scrollTop" ].forEach(getterAndSetterRequiresRendering);
- function methodRequiresRendering(name) {
- Object.defineProperty(HTMLElement.prototype, name, {
- value: function() {
- scope.renderAllPending();
- return unsafeUnwrap(this)[name].apply(unsafeUnwrap(this), arguments);
- },
- configurable: true,
- enumerable: true
- });
- }
- [ "getBoundingClientRect", "getClientRects", "scrollIntoView" ].forEach(methodRequiresRendering);
- registerWrapper(OriginalHTMLElement, HTMLElement, document.createElement("b"));
- scope.wrappers.HTMLElement = HTMLElement;
- scope.getInnerHTML = getInnerHTML;
- scope.setInnerHTML = setInnerHTML;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var wrap = scope.wrap;
- var OriginalHTMLCanvasElement = window.HTMLCanvasElement;
- function HTMLCanvasElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLCanvasElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLCanvasElement.prototype, {
- getContext: function() {
- var context = unsafeUnwrap(this).getContext.apply(unsafeUnwrap(this), arguments);
- return context && wrap(context);
- }
- });
- registerWrapper(OriginalHTMLCanvasElement, HTMLCanvasElement, document.createElement("canvas"));
- scope.wrappers.HTMLCanvasElement = HTMLCanvasElement;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var OriginalHTMLContentElement = window.HTMLContentElement;
- function HTMLContentElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLContentElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLContentElement.prototype, {
- constructor: HTMLContentElement,
- get select() {
- return this.getAttribute("select");
- },
- set select(value) {
- this.setAttribute("select", value);
- },
- setAttribute: function(n, v) {
- HTMLElement.prototype.setAttribute.call(this, n, v);
- if (String(n).toLowerCase() === "select") this.invalidateShadowRenderer(true);
- }
- });
- if (OriginalHTMLContentElement) registerWrapper(OriginalHTMLContentElement, HTMLContentElement);
- scope.wrappers.HTMLContentElement = HTMLContentElement;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var wrapHTMLCollection = scope.wrapHTMLCollection;
- var unwrap = scope.unwrap;
- var OriginalHTMLFormElement = window.HTMLFormElement;
- function HTMLFormElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLFormElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLFormElement.prototype, {
- get elements() {
- return wrapHTMLCollection(unwrap(this).elements);
- }
- });
- registerWrapper(OriginalHTMLFormElement, HTMLFormElement, document.createElement("form"));
- scope.wrappers.HTMLFormElement = HTMLFormElement;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var registerWrapper = scope.registerWrapper;
- var unwrap = scope.unwrap;
- var rewrap = scope.rewrap;
- var OriginalHTMLImageElement = window.HTMLImageElement;
- function HTMLImageElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLImageElement.prototype = Object.create(HTMLElement.prototype);
- registerWrapper(OriginalHTMLImageElement, HTMLImageElement, document.createElement("img"));
- function Image(width, height) {
- if (!(this instanceof Image)) {
- throw new TypeError("DOM object constructor cannot be called as a function.");
- }
- var node = unwrap(document.createElement("img"));
- HTMLElement.call(this, node);
- rewrap(node, this);
- if (width !== undefined) node.width = width;
- if (height !== undefined) node.height = height;
- }
- Image.prototype = HTMLImageElement.prototype;
- scope.wrappers.HTMLImageElement = HTMLImageElement;
- scope.wrappers.Image = Image;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var NodeList = scope.wrappers.NodeList;
- var registerWrapper = scope.registerWrapper;
- var OriginalHTMLShadowElement = window.HTMLShadowElement;
- function HTMLShadowElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLShadowElement.prototype = Object.create(HTMLElement.prototype);
- HTMLShadowElement.prototype.constructor = HTMLShadowElement;
- if (OriginalHTMLShadowElement) registerWrapper(OriginalHTMLShadowElement, HTMLShadowElement);
- scope.wrappers.HTMLShadowElement = HTMLShadowElement;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var contentTable = new WeakMap();
- var templateContentsOwnerTable = new WeakMap();
- function getTemplateContentsOwner(doc) {
- if (!doc.defaultView) return doc;
- var d = templateContentsOwnerTable.get(doc);
- if (!d) {
- d = doc.implementation.createHTMLDocument("");
- while (d.lastChild) {
- d.removeChild(d.lastChild);
- }
- templateContentsOwnerTable.set(doc, d);
- }
- return d;
- }
- function extractContent(templateElement) {
- var doc = getTemplateContentsOwner(templateElement.ownerDocument);
- var df = unwrap(doc.createDocumentFragment());
- var child;
- while (child = templateElement.firstChild) {
- df.appendChild(child);
- }
- return df;
- }
- var OriginalHTMLTemplateElement = window.HTMLTemplateElement;
- function HTMLTemplateElement(node) {
- HTMLElement.call(this, node);
- if (!OriginalHTMLTemplateElement) {
- var content = extractContent(node);
- contentTable.set(this, wrap(content));
- }
- }
- HTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLTemplateElement.prototype, {
- constructor: HTMLTemplateElement,
- get content() {
- if (OriginalHTMLTemplateElement) return wrap(unsafeUnwrap(this).content);
- return contentTable.get(this);
- }
- });
- if (OriginalHTMLTemplateElement) registerWrapper(OriginalHTMLTemplateElement, HTMLTemplateElement);
- scope.wrappers.HTMLTemplateElement = HTMLTemplateElement;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var registerWrapper = scope.registerWrapper;
- var OriginalHTMLMediaElement = window.HTMLMediaElement;
- if (!OriginalHTMLMediaElement) return;
- function HTMLMediaElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLMediaElement.prototype = Object.create(HTMLElement.prototype);
- registerWrapper(OriginalHTMLMediaElement, HTMLMediaElement, document.createElement("audio"));
- scope.wrappers.HTMLMediaElement = HTMLMediaElement;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLMediaElement = scope.wrappers.HTMLMediaElement;
- var registerWrapper = scope.registerWrapper;
- var unwrap = scope.unwrap;
- var rewrap = scope.rewrap;
- var OriginalHTMLAudioElement = window.HTMLAudioElement;
- if (!OriginalHTMLAudioElement) return;
- function HTMLAudioElement(node) {
- HTMLMediaElement.call(this, node);
- }
- HTMLAudioElement.prototype = Object.create(HTMLMediaElement.prototype);
- registerWrapper(OriginalHTMLAudioElement, HTMLAudioElement, document.createElement("audio"));
- function Audio(src) {
- if (!(this instanceof Audio)) {
- throw new TypeError("DOM object constructor cannot be called as a function.");
- }
- var node = unwrap(document.createElement("audio"));
- HTMLMediaElement.call(this, node);
- rewrap(node, this);
- node.setAttribute("preload", "auto");
- if (src !== undefined) node.setAttribute("src", src);
- }
- Audio.prototype = HTMLAudioElement.prototype;
- scope.wrappers.HTMLAudioElement = HTMLAudioElement;
- scope.wrappers.Audio = Audio;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var rewrap = scope.rewrap;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var OriginalHTMLOptionElement = window.HTMLOptionElement;
- function trimText(s) {
- return s.replace(/\s+/g, " ").trim();
- }
- function HTMLOptionElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLOptionElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLOptionElement.prototype, {
- get text() {
- return trimText(this.textContent);
- },
- set text(value) {
- this.textContent = trimText(String(value));
- },
- get form() {
- return wrap(unwrap(this).form);
- }
- });
- registerWrapper(OriginalHTMLOptionElement, HTMLOptionElement, document.createElement("option"));
- function Option(text, value, defaultSelected, selected) {
- if (!(this instanceof Option)) {
- throw new TypeError("DOM object constructor cannot be called as a function.");
- }
- var node = unwrap(document.createElement("option"));
- HTMLElement.call(this, node);
- rewrap(node, this);
- if (text !== undefined) node.text = text;
- if (value !== undefined) node.setAttribute("value", value);
- if (defaultSelected === true) node.setAttribute("selected", "");
- node.selected = selected === true;
- }
- Option.prototype = HTMLOptionElement.prototype;
- scope.wrappers.HTMLOptionElement = HTMLOptionElement;
- scope.wrappers.Option = Option;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var OriginalHTMLSelectElement = window.HTMLSelectElement;
- function HTMLSelectElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLSelectElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLSelectElement.prototype, {
- add: function(element, before) {
- if (typeof before === "object") before = unwrap(before);
- unwrap(this).add(unwrap(element), before);
- },
- remove: function(indexOrNode) {
- if (indexOrNode === undefined) {
- HTMLElement.prototype.remove.call(this);
- return;
- }
- if (typeof indexOrNode === "object") indexOrNode = unwrap(indexOrNode);
- unwrap(this).remove(indexOrNode);
- },
- get form() {
- return wrap(unwrap(this).form);
- }
- });
- registerWrapper(OriginalHTMLSelectElement, HTMLSelectElement, document.createElement("select"));
- scope.wrappers.HTMLSelectElement = HTMLSelectElement;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var wrapHTMLCollection = scope.wrapHTMLCollection;
- var OriginalHTMLTableElement = window.HTMLTableElement;
- function HTMLTableElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLTableElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLTableElement.prototype, {
- get caption() {
- return wrap(unwrap(this).caption);
- },
- createCaption: function() {
- return wrap(unwrap(this).createCaption());
- },
- get tHead() {
- return wrap(unwrap(this).tHead);
- },
- createTHead: function() {
- return wrap(unwrap(this).createTHead());
- },
- createTFoot: function() {
- return wrap(unwrap(this).createTFoot());
- },
- get tFoot() {
- return wrap(unwrap(this).tFoot);
- },
- get tBodies() {
- return wrapHTMLCollection(unwrap(this).tBodies);
- },
- createTBody: function() {
- return wrap(unwrap(this).createTBody());
- },
- get rows() {
- return wrapHTMLCollection(unwrap(this).rows);
- },
- insertRow: function(index) {
- return wrap(unwrap(this).insertRow(index));
- }
- });
- registerWrapper(OriginalHTMLTableElement, HTMLTableElement, document.createElement("table"));
- scope.wrappers.HTMLTableElement = HTMLTableElement;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var wrapHTMLCollection = scope.wrapHTMLCollection;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var OriginalHTMLTableSectionElement = window.HTMLTableSectionElement;
- function HTMLTableSectionElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLTableSectionElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLTableSectionElement.prototype, {
- constructor: HTMLTableSectionElement,
- get rows() {
- return wrapHTMLCollection(unwrap(this).rows);
- },
- insertRow: function(index) {
- return wrap(unwrap(this).insertRow(index));
- }
- });
- registerWrapper(OriginalHTMLTableSectionElement, HTMLTableSectionElement, document.createElement("thead"));
- scope.wrappers.HTMLTableSectionElement = HTMLTableSectionElement;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var wrapHTMLCollection = scope.wrapHTMLCollection;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var OriginalHTMLTableRowElement = window.HTMLTableRowElement;
- function HTMLTableRowElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLTableRowElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLTableRowElement.prototype, {
- get cells() {
- return wrapHTMLCollection(unwrap(this).cells);
- },
- insertCell: function(index) {
- return wrap(unwrap(this).insertCell(index));
- }
- });
- registerWrapper(OriginalHTMLTableRowElement, HTMLTableRowElement, document.createElement("tr"));
- scope.wrappers.HTMLTableRowElement = HTMLTableRowElement;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLContentElement = scope.wrappers.HTMLContentElement;
- var HTMLElement = scope.wrappers.HTMLElement;
- var HTMLShadowElement = scope.wrappers.HTMLShadowElement;
- var HTMLTemplateElement = scope.wrappers.HTMLTemplateElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var OriginalHTMLUnknownElement = window.HTMLUnknownElement;
- function HTMLUnknownElement(node) {
- switch (node.localName) {
- case "content":
- return new HTMLContentElement(node);
-
- case "shadow":
- return new HTMLShadowElement(node);
-
- case "template":
- return new HTMLTemplateElement(node);
- }
- HTMLElement.call(this, node);
- }
- HTMLUnknownElement.prototype = Object.create(HTMLElement.prototype);
- registerWrapper(OriginalHTMLUnknownElement, HTMLUnknownElement);
- scope.wrappers.HTMLUnknownElement = HTMLUnknownElement;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var Element = scope.wrappers.Element;
- var HTMLElement = scope.wrappers.HTMLElement;
- var registerObject = scope.registerObject;
- var defineWrapGetter = scope.defineWrapGetter;
- var SVG_NS = "http://www.w3.org/2000/svg";
- var svgTitleElement = document.createElementNS(SVG_NS, "title");
- var SVGTitleElement = registerObject(svgTitleElement);
- var SVGElement = Object.getPrototypeOf(SVGTitleElement.prototype).constructor;
- if (!("classList" in svgTitleElement)) {
- var descr = Object.getOwnPropertyDescriptor(Element.prototype, "classList");
- Object.defineProperty(HTMLElement.prototype, "classList", descr);
- delete Element.prototype.classList;
- }
- defineWrapGetter(SVGElement, "ownerSVGElement");
- scope.wrappers.SVGElement = SVGElement;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var OriginalSVGUseElement = window.SVGUseElement;
- var SVG_NS = "http://www.w3.org/2000/svg";
- var gWrapper = wrap(document.createElementNS(SVG_NS, "g"));
- var useElement = document.createElementNS(SVG_NS, "use");
- var SVGGElement = gWrapper.constructor;
- var parentInterfacePrototype = Object.getPrototypeOf(SVGGElement.prototype);
- var parentInterface = parentInterfacePrototype.constructor;
- function SVGUseElement(impl) {
- parentInterface.call(this, impl);
- }
- SVGUseElement.prototype = Object.create(parentInterfacePrototype);
- if ("instanceRoot" in useElement) {
- mixin(SVGUseElement.prototype, {
- get instanceRoot() {
- return wrap(unwrap(this).instanceRoot);
- },
- get animatedInstanceRoot() {
- return wrap(unwrap(this).animatedInstanceRoot);
- }
- });
- }
- registerWrapper(OriginalSVGUseElement, SVGUseElement, useElement);
- scope.wrappers.SVGUseElement = SVGUseElement;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var EventTarget = scope.wrappers.EventTarget;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var wrap = scope.wrap;
- var OriginalSVGElementInstance = window.SVGElementInstance;
- if (!OriginalSVGElementInstance) return;
- function SVGElementInstance(impl) {
- EventTarget.call(this, impl);
- }
- SVGElementInstance.prototype = Object.create(EventTarget.prototype);
- mixin(SVGElementInstance.prototype, {
- get correspondingElement() {
- return wrap(unsafeUnwrap(this).correspondingElement);
- },
- get correspondingUseElement() {
- return wrap(unsafeUnwrap(this).correspondingUseElement);
- },
- get parentNode() {
- return wrap(unsafeUnwrap(this).parentNode);
- },
- get childNodes() {
- throw new Error("Not implemented");
- },
- get firstChild() {
- return wrap(unsafeUnwrap(this).firstChild);
- },
- get lastChild() {
- return wrap(unsafeUnwrap(this).lastChild);
- },
- get previousSibling() {
- return wrap(unsafeUnwrap(this).previousSibling);
- },
- get nextSibling() {
- return wrap(unsafeUnwrap(this).nextSibling);
- }
- });
- registerWrapper(OriginalSVGElementInstance, SVGElementInstance);
- scope.wrappers.SVGElementInstance = SVGElementInstance;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var setWrapper = scope.setWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var unwrapIfNeeded = scope.unwrapIfNeeded;
- var wrap = scope.wrap;
- var OriginalCanvasRenderingContext2D = window.CanvasRenderingContext2D;
- function CanvasRenderingContext2D(impl) {
- setWrapper(impl, this);
- }
- mixin(CanvasRenderingContext2D.prototype, {
- get canvas() {
- return wrap(unsafeUnwrap(this).canvas);
- },
- drawImage: function() {
- arguments[0] = unwrapIfNeeded(arguments[0]);
- unsafeUnwrap(this).drawImage.apply(unsafeUnwrap(this), arguments);
- },
- createPattern: function() {
- arguments[0] = unwrap(arguments[0]);
- return unsafeUnwrap(this).createPattern.apply(unsafeUnwrap(this), arguments);
- }
- });
- registerWrapper(OriginalCanvasRenderingContext2D, CanvasRenderingContext2D, document.createElement("canvas").getContext("2d"));
- scope.wrappers.CanvasRenderingContext2D = CanvasRenderingContext2D;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var setWrapper = scope.setWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrapIfNeeded = scope.unwrapIfNeeded;
- var wrap = scope.wrap;
- var OriginalWebGLRenderingContext = window.WebGLRenderingContext;
- if (!OriginalWebGLRenderingContext) return;
- function WebGLRenderingContext(impl) {
- setWrapper(impl, this);
- }
- mixin(WebGLRenderingContext.prototype, {
- get canvas() {
- return wrap(unsafeUnwrap(this).canvas);
- },
- texImage2D: function() {
- arguments[5] = unwrapIfNeeded(arguments[5]);
- unsafeUnwrap(this).texImage2D.apply(unsafeUnwrap(this), arguments);
- },
- texSubImage2D: function() {
- arguments[6] = unwrapIfNeeded(arguments[6]);
- unsafeUnwrap(this).texSubImage2D.apply(unsafeUnwrap(this), arguments);
- }
- });
- var instanceProperties = /WebKit/.test(navigator.userAgent) ? {
- drawingBufferHeight: null,
- drawingBufferWidth: null
- } : {};
- registerWrapper(OriginalWebGLRenderingContext, WebGLRenderingContext, instanceProperties);
- scope.wrappers.WebGLRenderingContext = WebGLRenderingContext;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var registerWrapper = scope.registerWrapper;
- var setWrapper = scope.setWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var unwrapIfNeeded = scope.unwrapIfNeeded;
- var wrap = scope.wrap;
- var OriginalRange = window.Range;
- function Range(impl) {
- setWrapper(impl, this);
- }
- Range.prototype = {
- get startContainer() {
- return wrap(unsafeUnwrap(this).startContainer);
- },
- get endContainer() {
- return wrap(unsafeUnwrap(this).endContainer);
- },
- get commonAncestorContainer() {
- return wrap(unsafeUnwrap(this).commonAncestorContainer);
- },
- setStart: function(refNode, offset) {
- unsafeUnwrap(this).setStart(unwrapIfNeeded(refNode), offset);
- },
- setEnd: function(refNode, offset) {
- unsafeUnwrap(this).setEnd(unwrapIfNeeded(refNode), offset);
- },
- setStartBefore: function(refNode) {
- unsafeUnwrap(this).setStartBefore(unwrapIfNeeded(refNode));
- },
- setStartAfter: function(refNode) {
- unsafeUnwrap(this).setStartAfter(unwrapIfNeeded(refNode));
- },
- setEndBefore: function(refNode) {
- unsafeUnwrap(this).setEndBefore(unwrapIfNeeded(refNode));
- },
- setEndAfter: function(refNode) {
- unsafeUnwrap(this).setEndAfter(unwrapIfNeeded(refNode));
- },
- selectNode: function(refNode) {
- unsafeUnwrap(this).selectNode(unwrapIfNeeded(refNode));
- },
- selectNodeContents: function(refNode) {
- unsafeUnwrap(this).selectNodeContents(unwrapIfNeeded(refNode));
- },
- compareBoundaryPoints: function(how, sourceRange) {
- return unsafeUnwrap(this).compareBoundaryPoints(how, unwrap(sourceRange));
- },
- extractContents: function() {
- return wrap(unsafeUnwrap(this).extractContents());
- },
- cloneContents: function() {
- return wrap(unsafeUnwrap(this).cloneContents());
- },
- insertNode: function(node) {
- unsafeUnwrap(this).insertNode(unwrapIfNeeded(node));
- },
- surroundContents: function(newParent) {
- unsafeUnwrap(this).surroundContents(unwrapIfNeeded(newParent));
- },
- cloneRange: function() {
- return wrap(unsafeUnwrap(this).cloneRange());
- },
- isPointInRange: function(node, offset) {
- return unsafeUnwrap(this).isPointInRange(unwrapIfNeeded(node), offset);
- },
- comparePoint: function(node, offset) {
- return unsafeUnwrap(this).comparePoint(unwrapIfNeeded(node), offset);
- },
- intersectsNode: function(node) {
- return unsafeUnwrap(this).intersectsNode(unwrapIfNeeded(node));
- },
- toString: function() {
- return unsafeUnwrap(this).toString();
- }
- };
- if (OriginalRange.prototype.createContextualFragment) {
- Range.prototype.createContextualFragment = function(html) {
- return wrap(unsafeUnwrap(this).createContextualFragment(html));
- };
- }
- registerWrapper(window.Range, Range, document.createRange());
- scope.wrappers.Range = Range;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var GetElementsByInterface = scope.GetElementsByInterface;
- var ParentNodeInterface = scope.ParentNodeInterface;
- var SelectorsInterface = scope.SelectorsInterface;
- var mixin = scope.mixin;
- var registerObject = scope.registerObject;
- var DocumentFragment = registerObject(document.createDocumentFragment());
- mixin(DocumentFragment.prototype, ParentNodeInterface);
- mixin(DocumentFragment.prototype, SelectorsInterface);
- mixin(DocumentFragment.prototype, GetElementsByInterface);
- var Comment = registerObject(document.createComment(""));
- scope.wrappers.Comment = Comment;
- scope.wrappers.DocumentFragment = DocumentFragment;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var DocumentFragment = scope.wrappers.DocumentFragment;
- var TreeScope = scope.TreeScope;
- var elementFromPoint = scope.elementFromPoint;
- var getInnerHTML = scope.getInnerHTML;
- var getTreeScope = scope.getTreeScope;
- var mixin = scope.mixin;
- var rewrap = scope.rewrap;
- var setInnerHTML = scope.setInnerHTML;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var shadowHostTable = new WeakMap();
- var nextOlderShadowTreeTable = new WeakMap();
- var spaceCharRe = /[ \t\n\r\f]/;
- function ShadowRoot(hostWrapper) {
- var node = unwrap(unsafeUnwrap(hostWrapper).ownerDocument.createDocumentFragment());
- DocumentFragment.call(this, node);
- rewrap(node, this);
- var oldShadowRoot = hostWrapper.shadowRoot;
- nextOlderShadowTreeTable.set(this, oldShadowRoot);
- this.treeScope_ = new TreeScope(this, getTreeScope(oldShadowRoot || hostWrapper));
- shadowHostTable.set(this, hostWrapper);
- }
- ShadowRoot.prototype = Object.create(DocumentFragment.prototype);
- mixin(ShadowRoot.prototype, {
- constructor: ShadowRoot,
- get innerHTML() {
- return getInnerHTML(this);
- },
- set innerHTML(value) {
- setInnerHTML(this, value);
- this.invalidateShadowRenderer();
- },
- get olderShadowRoot() {
- return nextOlderShadowTreeTable.get(this) || null;
- },
- get host() {
- return shadowHostTable.get(this) || null;
- },
- invalidateShadowRenderer: function() {
- return shadowHostTable.get(this).invalidateShadowRenderer();
- },
- elementFromPoint: function(x, y) {
- return elementFromPoint(this, this.ownerDocument, x, y);
- },
- getElementById: function(id) {
- if (spaceCharRe.test(id)) return null;
- return this.querySelector('[id="' + id + '"]');
- }
- });
- scope.wrappers.ShadowRoot = ShadowRoot;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var Element = scope.wrappers.Element;
- var HTMLContentElement = scope.wrappers.HTMLContentElement;
- var HTMLShadowElement = scope.wrappers.HTMLShadowElement;
- var Node = scope.wrappers.Node;
- var ShadowRoot = scope.wrappers.ShadowRoot;
- var assert = scope.assert;
- var getTreeScope = scope.getTreeScope;
- var mixin = scope.mixin;
- var oneOf = scope.oneOf;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var ArraySplice = scope.ArraySplice;
- function updateWrapperUpAndSideways(wrapper) {
- wrapper.previousSibling_ = wrapper.previousSibling;
- wrapper.nextSibling_ = wrapper.nextSibling;
- wrapper.parentNode_ = wrapper.parentNode;
- }
- function updateWrapperDown(wrapper) {
- wrapper.firstChild_ = wrapper.firstChild;
- wrapper.lastChild_ = wrapper.lastChild;
- }
- function updateAllChildNodes(parentNodeWrapper) {
- assert(parentNodeWrapper instanceof Node);
- for (var childWrapper = parentNodeWrapper.firstChild; childWrapper; childWrapper = childWrapper.nextSibling) {
- updateWrapperUpAndSideways(childWrapper);
- }
- updateWrapperDown(parentNodeWrapper);
- }
- function insertBefore(parentNodeWrapper, newChildWrapper, refChildWrapper) {
- var parentNode = unwrap(parentNodeWrapper);
- var newChild = unwrap(newChildWrapper);
- var refChild = refChildWrapper ? unwrap(refChildWrapper) : null;
- remove(newChildWrapper);
- updateWrapperUpAndSideways(newChildWrapper);
- if (!refChildWrapper) {
- parentNodeWrapper.lastChild_ = parentNodeWrapper.lastChild;
- if (parentNodeWrapper.lastChild === parentNodeWrapper.firstChild) parentNodeWrapper.firstChild_ = parentNodeWrapper.firstChild;
- var lastChildWrapper = wrap(parentNode.lastChild);
- if (lastChildWrapper) lastChildWrapper.nextSibling_ = lastChildWrapper.nextSibling;
- } else {
- if (parentNodeWrapper.firstChild === refChildWrapper) parentNodeWrapper.firstChild_ = refChildWrapper;
- refChildWrapper.previousSibling_ = refChildWrapper.previousSibling;
- }
- scope.originalInsertBefore.call(parentNode, newChild, refChild);
- }
- function remove(nodeWrapper) {
- var node = unwrap(nodeWrapper);
- var parentNode = node.parentNode;
- if (!parentNode) return;
- var parentNodeWrapper = wrap(parentNode);
- updateWrapperUpAndSideways(nodeWrapper);
- if (nodeWrapper.previousSibling) nodeWrapper.previousSibling.nextSibling_ = nodeWrapper;
- if (nodeWrapper.nextSibling) nodeWrapper.nextSibling.previousSibling_ = nodeWrapper;
- if (parentNodeWrapper.lastChild === nodeWrapper) parentNodeWrapper.lastChild_ = nodeWrapper;
- if (parentNodeWrapper.firstChild === nodeWrapper) parentNodeWrapper.firstChild_ = nodeWrapper;
- scope.originalRemoveChild.call(parentNode, node);
- }
- var distributedNodesTable = new WeakMap();
- var destinationInsertionPointsTable = new WeakMap();
- var rendererForHostTable = new WeakMap();
- function resetDistributedNodes(insertionPoint) {
- distributedNodesTable.set(insertionPoint, []);
- }
- function getDistributedNodes(insertionPoint) {
- var rv = distributedNodesTable.get(insertionPoint);
- if (!rv) distributedNodesTable.set(insertionPoint, rv = []);
- return rv;
- }
- function getChildNodesSnapshot(node) {
- var result = [], i = 0;
- for (var child = node.firstChild; child; child = child.nextSibling) {
- result[i++] = child;
- }
- return result;
- }
- var request = oneOf(window, [ "requestAnimationFrame", "mozRequestAnimationFrame", "webkitRequestAnimationFrame", "setTimeout" ]);
- var pendingDirtyRenderers = [];
- var renderTimer;
- function renderAllPending() {
- for (var i = 0; i < pendingDirtyRenderers.length; i++) {
- var renderer = pendingDirtyRenderers[i];
- var parentRenderer = renderer.parentRenderer;
- if (parentRenderer && parentRenderer.dirty) continue;
- renderer.render();
- }
- pendingDirtyRenderers = [];
- }
- function handleRequestAnimationFrame() {
- renderTimer = null;
- renderAllPending();
- }
- function getRendererForHost(host) {
- var renderer = rendererForHostTable.get(host);
- if (!renderer) {
- renderer = new ShadowRenderer(host);
- rendererForHostTable.set(host, renderer);
- }
- return renderer;
- }
- function getShadowRootAncestor(node) {
- var root = getTreeScope(node).root;
- if (root instanceof ShadowRoot) return root;
- return null;
- }
- function getRendererForShadowRoot(shadowRoot) {
- return getRendererForHost(shadowRoot.host);
- }
- var spliceDiff = new ArraySplice();
- spliceDiff.equals = function(renderNode, rawNode) {
- return unwrap(renderNode.node) === rawNode;
- };
- function RenderNode(node) {
- this.skip = false;
- this.node = node;
- this.childNodes = [];
- }
- RenderNode.prototype = {
- append: function(node) {
- var rv = new RenderNode(node);
- this.childNodes.push(rv);
- return rv;
- },
- sync: function(opt_added) {
- if (this.skip) return;
- var nodeWrapper = this.node;
- var newChildren = this.childNodes;
- var oldChildren = getChildNodesSnapshot(unwrap(nodeWrapper));
- var added = opt_added || new WeakMap();
- var splices = spliceDiff.calculateSplices(newChildren, oldChildren);
- var newIndex = 0, oldIndex = 0;
- var lastIndex = 0;
- for (var i = 0; i < splices.length; i++) {
- var splice = splices[i];
- for (;lastIndex < splice.index; lastIndex++) {
- oldIndex++;
- newChildren[newIndex++].sync(added);
- }
- var removedCount = splice.removed.length;
- for (var j = 0; j < removedCount; j++) {
- var wrapper = wrap(oldChildren[oldIndex++]);
- if (!added.get(wrapper)) remove(wrapper);
- }
- var addedCount = splice.addedCount;
- var refNode = oldChildren[oldIndex] && wrap(oldChildren[oldIndex]);
- for (var j = 0; j < addedCount; j++) {
- var newChildRenderNode = newChildren[newIndex++];
- var newChildWrapper = newChildRenderNode.node;
- insertBefore(nodeWrapper, newChildWrapper, refNode);
- added.set(newChildWrapper, true);
- newChildRenderNode.sync(added);
- }
- lastIndex += addedCount;
- }
- for (var i = lastIndex; i < newChildren.length; i++) {
- newChildren[i].sync(added);
- }
- }
- };
- function ShadowRenderer(host) {
- this.host = host;
- this.dirty = false;
- this.invalidateAttributes();
- this.associateNode(host);
- }
- ShadowRenderer.prototype = {
- render: function(opt_renderNode) {
- if (!this.dirty) return;
- this.invalidateAttributes();
- var host = this.host;
- this.distribution(host);
- var renderNode = opt_renderNode || new RenderNode(host);
- this.buildRenderTree(renderNode, host);
- var topMostRenderer = !opt_renderNode;
- if (topMostRenderer) renderNode.sync();
- this.dirty = false;
- },
- get parentRenderer() {
- return getTreeScope(this.host).renderer;
- },
- invalidate: function() {
- if (!this.dirty) {
- this.dirty = true;
- var parentRenderer = this.parentRenderer;
- if (parentRenderer) parentRenderer.invalidate();
- pendingDirtyRenderers.push(this);
- if (renderTimer) return;
- renderTimer = window[request](handleRequestAnimationFrame, 0);
- }
- },
- distribution: function(root) {
- this.resetAllSubtrees(root);
- this.distributionResolution(root);
- },
- resetAll: function(node) {
- if (isInsertionPoint(node)) resetDistributedNodes(node); else resetDestinationInsertionPoints(node);
- this.resetAllSubtrees(node);
- },
- resetAllSubtrees: function(node) {
- for (var child = node.firstChild; child; child = child.nextSibling) {
- this.resetAll(child);
- }
- if (node.shadowRoot) this.resetAll(node.shadowRoot);
- if (node.olderShadowRoot) this.resetAll(node.olderShadowRoot);
- },
- distributionResolution: function(node) {
- if (isShadowHost(node)) {
- var shadowHost = node;
- var pool = poolPopulation(shadowHost);
- var shadowTrees = getShadowTrees(shadowHost);
- for (var i = 0; i < shadowTrees.length; i++) {
- this.poolDistribution(shadowTrees[i], pool);
- }
- for (var i = shadowTrees.length - 1; i >= 0; i--) {
- var shadowTree = shadowTrees[i];
- var shadow = getShadowInsertionPoint(shadowTree);
- if (shadow) {
- var olderShadowRoot = shadowTree.olderShadowRoot;
- if (olderShadowRoot) {
- pool = poolPopulation(olderShadowRoot);
- }
- for (var j = 0; j < pool.length; j++) {
- destributeNodeInto(pool[j], shadow);
- }
- }
- this.distributionResolution(shadowTree);
- }
- }
- for (var child = node.firstChild; child; child = child.nextSibling) {
- this.distributionResolution(child);
- }
- },
- poolDistribution: function(node, pool) {
- if (node instanceof HTMLShadowElement) return;
- if (node instanceof HTMLContentElement) {
- var content = node;
- this.updateDependentAttributes(content.getAttribute("select"));
- var anyDistributed = false;
- for (var i = 0; i < pool.length; i++) {
- var node = pool[i];
- if (!node) continue;
- if (matches(node, content)) {
- destributeNodeInto(node, content);
- pool[i] = undefined;
- anyDistributed = true;
- }
- }
- if (!anyDistributed) {
- for (var child = content.firstChild; child; child = child.nextSibling) {
- destributeNodeInto(child, content);
- }
- }
- return;
- }
- for (var child = node.firstChild; child; child = child.nextSibling) {
- this.poolDistribution(child, pool);
- }
- },
- buildRenderTree: function(renderNode, node) {
- var children = this.compose(node);
- for (var i = 0; i < children.length; i++) {
- var child = children[i];
- var childRenderNode = renderNode.append(child);
- this.buildRenderTree(childRenderNode, child);
- }
- if (isShadowHost(node)) {
- var renderer = getRendererForHost(node);
- renderer.dirty = false;
- }
- },
- compose: function(node) {
- var children = [];
- var p = node.shadowRoot || node;
- for (var child = p.firstChild; child; child = child.nextSibling) {
- if (isInsertionPoint(child)) {
- this.associateNode(p);
- var distributedNodes = getDistributedNodes(child);
- for (var j = 0; j < distributedNodes.length; j++) {
- var distributedNode = distributedNodes[j];
- if (isFinalDestination(child, distributedNode)) children.push(distributedNode);
- }
- } else {
- children.push(child);
- }
- }
- return children;
- },
- invalidateAttributes: function() {
- this.attributes = Object.create(null);
- },
- updateDependentAttributes: function(selector) {
- if (!selector) return;
- var attributes = this.attributes;
- if (/\.\w+/.test(selector)) attributes["class"] = true;
- if (/#\w+/.test(selector)) attributes["id"] = true;
- selector.replace(/\[\s*([^\s=\|~\]]+)/g, function(_, name) {
- attributes[name] = true;
- });
- },
- dependsOnAttribute: function(name) {
- return this.attributes[name];
- },
- associateNode: function(node) {
- unsafeUnwrap(node).polymerShadowRenderer_ = this;
- }
- };
- function poolPopulation(node) {
- var pool = [];
- for (var child = node.firstChild; child; child = child.nextSibling) {
- if (isInsertionPoint(child)) {
- pool.push.apply(pool, getDistributedNodes(child));
- } else {
- pool.push(child);
- }
- }
- return pool;
- }
- function getShadowInsertionPoint(node) {
- if (node instanceof HTMLShadowElement) return node;
- if (node instanceof HTMLContentElement) return null;
- for (var child = node.firstChild; child; child = child.nextSibling) {
- var res = getShadowInsertionPoint(child);
- if (res) return res;
- }
- return null;
- }
- function destributeNodeInto(child, insertionPoint) {
- getDistributedNodes(insertionPoint).push(child);
- var points = destinationInsertionPointsTable.get(child);
- if (!points) destinationInsertionPointsTable.set(child, [ insertionPoint ]); else points.push(insertionPoint);
- }
- function getDestinationInsertionPoints(node) {
- return destinationInsertionPointsTable.get(node);
- }
- function resetDestinationInsertionPoints(node) {
- destinationInsertionPointsTable.set(node, undefined);
- }
- var selectorStartCharRe = /^(:not\()?[*.#[a-zA-Z_|]/;
- function matches(node, contentElement) {
- var select = contentElement.getAttribute("select");
- if (!select) return true;
- select = select.trim();
- if (!select) return true;
- if (!(node instanceof Element)) return false;
- if (!selectorStartCharRe.test(select)) return false;
- try {
- return node.matches(select);
- } catch (ex) {
- return false;
- }
- }
- function isFinalDestination(insertionPoint, node) {
- var points = getDestinationInsertionPoints(node);
- return points && points[points.length - 1] === insertionPoint;
- }
- function isInsertionPoint(node) {
- return node instanceof HTMLContentElement || node instanceof HTMLShadowElement;
- }
- function isShadowHost(shadowHost) {
- return shadowHost.shadowRoot;
- }
- function getShadowTrees(host) {
- var trees = [];
- for (var tree = host.shadowRoot; tree; tree = tree.olderShadowRoot) {
- trees.push(tree);
- }
- return trees;
- }
- function render(host) {
- new ShadowRenderer(host).render();
- }
- Node.prototype.invalidateShadowRenderer = function(force) {
- var renderer = unsafeUnwrap(this).polymerShadowRenderer_;
- if (renderer) {
- renderer.invalidate();
- return true;
- }
- return false;
- };
- HTMLContentElement.prototype.getDistributedNodes = HTMLShadowElement.prototype.getDistributedNodes = function() {
- renderAllPending();
- return getDistributedNodes(this);
- };
- Element.prototype.getDestinationInsertionPoints = function() {
- renderAllPending();
- return getDestinationInsertionPoints(this) || [];
- };
- HTMLContentElement.prototype.nodeIsInserted_ = HTMLShadowElement.prototype.nodeIsInserted_ = function() {
- this.invalidateShadowRenderer();
- var shadowRoot = getShadowRootAncestor(this);
- var renderer;
- if (shadowRoot) renderer = getRendererForShadowRoot(shadowRoot);
- unsafeUnwrap(this).polymerShadowRenderer_ = renderer;
- if (renderer) renderer.invalidate();
- };
- scope.getRendererForHost = getRendererForHost;
- scope.getShadowTrees = getShadowTrees;
- scope.renderAllPending = renderAllPending;
- scope.getDestinationInsertionPoints = getDestinationInsertionPoints;
- scope.visual = {
- insertBefore: insertBefore,
- remove: remove
- };
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var assert = scope.assert;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var elementsWithFormProperty = [ "HTMLButtonElement", "HTMLFieldSetElement", "HTMLInputElement", "HTMLKeygenElement", "HTMLLabelElement", "HTMLLegendElement", "HTMLObjectElement", "HTMLOutputElement", "HTMLTextAreaElement" ];
- function createWrapperConstructor(name) {
- if (!window[name]) return;
- assert(!scope.wrappers[name]);
- var GeneratedWrapper = function(node) {
- HTMLElement.call(this, node);
- };
- GeneratedWrapper.prototype = Object.create(HTMLElement.prototype);
- mixin(GeneratedWrapper.prototype, {
- get form() {
- return wrap(unwrap(this).form);
- }
- });
- registerWrapper(window[name], GeneratedWrapper, document.createElement(name.slice(4, -7)));
- scope.wrappers[name] = GeneratedWrapper;
- }
- elementsWithFormProperty.forEach(createWrapperConstructor);
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var registerWrapper = scope.registerWrapper;
- var setWrapper = scope.setWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var unwrapIfNeeded = scope.unwrapIfNeeded;
- var wrap = scope.wrap;
- var OriginalSelection = window.Selection;
- function Selection(impl) {
- setWrapper(impl, this);
- }
- Selection.prototype = {
- get anchorNode() {
- return wrap(unsafeUnwrap(this).anchorNode);
- },
- get focusNode() {
- return wrap(unsafeUnwrap(this).focusNode);
- },
- addRange: function(range) {
- unsafeUnwrap(this).addRange(unwrap(range));
- },
- collapse: function(node, index) {
- unsafeUnwrap(this).collapse(unwrapIfNeeded(node), index);
- },
- containsNode: function(node, allowPartial) {
- return unsafeUnwrap(this).containsNode(unwrapIfNeeded(node), allowPartial);
- },
- extend: function(node, offset) {
- unsafeUnwrap(this).extend(unwrapIfNeeded(node), offset);
- },
- getRangeAt: function(index) {
- return wrap(unsafeUnwrap(this).getRangeAt(index));
- },
- removeRange: function(range) {
- unsafeUnwrap(this).removeRange(unwrap(range));
- },
- selectAllChildren: function(node) {
- unsafeUnwrap(this).selectAllChildren(unwrapIfNeeded(node));
- },
- toString: function() {
- return unsafeUnwrap(this).toString();
- }
- };
- registerWrapper(window.Selection, Selection, window.getSelection());
- scope.wrappers.Selection = Selection;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var GetElementsByInterface = scope.GetElementsByInterface;
- var Node = scope.wrappers.Node;
- var ParentNodeInterface = scope.ParentNodeInterface;
- var Selection = scope.wrappers.Selection;
- var SelectorsInterface = scope.SelectorsInterface;
- var ShadowRoot = scope.wrappers.ShadowRoot;
- var TreeScope = scope.TreeScope;
- var cloneNode = scope.cloneNode;
- var defineWrapGetter = scope.defineWrapGetter;
- var elementFromPoint = scope.elementFromPoint;
- var forwardMethodsToWrapper = scope.forwardMethodsToWrapper;
- var matchesNames = scope.matchesNames;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var renderAllPending = scope.renderAllPending;
- var rewrap = scope.rewrap;
- var setWrapper = scope.setWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var wrapEventTargetMethods = scope.wrapEventTargetMethods;
- var wrapNodeList = scope.wrapNodeList;
- var implementationTable = new WeakMap();
- function Document(node) {
- Node.call(this, node);
- this.treeScope_ = new TreeScope(this, null);
- }
- Document.prototype = Object.create(Node.prototype);
- defineWrapGetter(Document, "documentElement");
- defineWrapGetter(Document, "body");
- defineWrapGetter(Document, "head");
- function wrapMethod(name) {
- var original = document[name];
- Document.prototype[name] = function() {
- return wrap(original.apply(unsafeUnwrap(this), arguments));
- };
- }
- [ "createComment", "createDocumentFragment", "createElement", "createElementNS", "createEvent", "createEventNS", "createRange", "createTextNode", "getElementById" ].forEach(wrapMethod);
- var originalAdoptNode = document.adoptNode;
- function adoptNodeNoRemove(node, doc) {
- originalAdoptNode.call(unsafeUnwrap(doc), unwrap(node));
- adoptSubtree(node, doc);
- }
- function adoptSubtree(node, doc) {
- if (node.shadowRoot) doc.adoptNode(node.shadowRoot);
- if (node instanceof ShadowRoot) adoptOlderShadowRoots(node, doc);
- for (var child = node.firstChild; child; child = child.nextSibling) {
- adoptSubtree(child, doc);
- }
- }
- function adoptOlderShadowRoots(shadowRoot, doc) {
- var oldShadowRoot = shadowRoot.olderShadowRoot;
- if (oldShadowRoot) doc.adoptNode(oldShadowRoot);
- }
- var originalGetSelection = document.getSelection;
- mixin(Document.prototype, {
- adoptNode: function(node) {
- if (node.parentNode) node.parentNode.removeChild(node);
- adoptNodeNoRemove(node, this);
- return node;
- },
- elementFromPoint: function(x, y) {
- return elementFromPoint(this, this, x, y);
- },
- importNode: function(node, deep) {
- return cloneNode(node, deep, unsafeUnwrap(this));
- },
- getSelection: function() {
- renderAllPending();
- return new Selection(originalGetSelection.call(unwrap(this)));
- },
- getElementsByName: function(name) {
- return SelectorsInterface.querySelectorAll.call(this, "[name=" + JSON.stringify(String(name)) + "]");
- }
- });
- if (document.registerElement) {
- var originalRegisterElement = document.registerElement;
- Document.prototype.registerElement = function(tagName, object) {
- var prototype, extendsOption;
- if (object !== undefined) {
- prototype = object.prototype;
- extendsOption = object.extends;
- }
- if (!prototype) prototype = Object.create(HTMLElement.prototype);
- if (scope.nativePrototypeTable.get(prototype)) {
- throw new Error("NotSupportedError");
- }
- var proto = Object.getPrototypeOf(prototype);
- var nativePrototype;
- var prototypes = [];
- while (proto) {
- nativePrototype = scope.nativePrototypeTable.get(proto);
- if (nativePrototype) break;
- prototypes.push(proto);
- proto = Object.getPrototypeOf(proto);
- }
- if (!nativePrototype) {
- throw new Error("NotSupportedError");
- }
- var newPrototype = Object.create(nativePrototype);
- for (var i = prototypes.length - 1; i >= 0; i--) {
- newPrototype = Object.create(newPrototype);
- }
- [ "createdCallback", "attachedCallback", "detachedCallback", "attributeChangedCallback" ].forEach(function(name) {
- var f = prototype[name];
- if (!f) return;
- newPrototype[name] = function() {
- if (!(wrap(this) instanceof CustomElementConstructor)) {
- rewrap(this);
- }
- f.apply(wrap(this), arguments);
- };
- });
- var p = {
- prototype: newPrototype
- };
- if (extendsOption) p.extends = extendsOption;
- function CustomElementConstructor(node) {
- if (!node) {
- if (extendsOption) {
- return document.createElement(extendsOption, tagName);
- } else {
- return document.createElement(tagName);
- }
- }
- setWrapper(node, this);
- }
- CustomElementConstructor.prototype = prototype;
- CustomElementConstructor.prototype.constructor = CustomElementConstructor;
- scope.constructorTable.set(newPrototype, CustomElementConstructor);
- scope.nativePrototypeTable.set(prototype, newPrototype);
- var nativeConstructor = originalRegisterElement.call(unwrap(this), tagName, p);
- return CustomElementConstructor;
- };
- forwardMethodsToWrapper([ window.HTMLDocument || window.Document ], [ "registerElement" ]);
- }
- forwardMethodsToWrapper([ window.HTMLBodyElement, window.HTMLDocument || window.Document, window.HTMLHeadElement, window.HTMLHtmlElement ], [ "appendChild", "compareDocumentPosition", "contains", "getElementsByClassName", "getElementsByTagName", "getElementsByTagNameNS", "insertBefore", "querySelector", "querySelectorAll", "removeChild", "replaceChild" ]);
- forwardMethodsToWrapper([ window.HTMLBodyElement, window.HTMLHeadElement, window.HTMLHtmlElement ], matchesNames);
- forwardMethodsToWrapper([ window.HTMLDocument || window.Document ], [ "adoptNode", "importNode", "contains", "createComment", "createDocumentFragment", "createElement", "createElementNS", "createEvent", "createEventNS", "createRange", "createTextNode", "elementFromPoint", "getElementById", "getElementsByName", "getSelection" ]);
- mixin(Document.prototype, GetElementsByInterface);
- mixin(Document.prototype, ParentNodeInterface);
- mixin(Document.prototype, SelectorsInterface);
- mixin(Document.prototype, {
- get implementation() {
- var implementation = implementationTable.get(this);
- if (implementation) return implementation;
- implementation = new DOMImplementation(unwrap(this).implementation);
- implementationTable.set(this, implementation);
- return implementation;
- },
- get defaultView() {
- return wrap(unwrap(this).defaultView);
- }
- });
- registerWrapper(window.Document, Document, document.implementation.createHTMLDocument(""));
- if (window.HTMLDocument) registerWrapper(window.HTMLDocument, Document);
- wrapEventTargetMethods([ window.HTMLBodyElement, window.HTMLDocument || window.Document, window.HTMLHeadElement ]);
- function DOMImplementation(impl) {
- setWrapper(impl, this);
- }
- function wrapImplMethod(constructor, name) {
- var original = document.implementation[name];
- constructor.prototype[name] = function() {
- return wrap(original.apply(unsafeUnwrap(this), arguments));
- };
- }
- function forwardImplMethod(constructor, name) {
- var original = document.implementation[name];
- constructor.prototype[name] = function() {
- return original.apply(unsafeUnwrap(this), arguments);
- };
- }
- wrapImplMethod(DOMImplementation, "createDocumentType");
- wrapImplMethod(DOMImplementation, "createDocument");
- wrapImplMethod(DOMImplementation, "createHTMLDocument");
- forwardImplMethod(DOMImplementation, "hasFeature");
- registerWrapper(window.DOMImplementation, DOMImplementation);
- forwardMethodsToWrapper([ window.DOMImplementation ], [ "createDocumentType", "createDocument", "createHTMLDocument", "hasFeature" ]);
- scope.adoptNodeNoRemove = adoptNodeNoRemove;
- scope.wrappers.DOMImplementation = DOMImplementation;
- scope.wrappers.Document = Document;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var EventTarget = scope.wrappers.EventTarget;
- var Selection = scope.wrappers.Selection;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var renderAllPending = scope.renderAllPending;
- var unwrap = scope.unwrap;
- var unwrapIfNeeded = scope.unwrapIfNeeded;
- var wrap = scope.wrap;
- var OriginalWindow = window.Window;
- var originalGetComputedStyle = window.getComputedStyle;
- var originalGetDefaultComputedStyle = window.getDefaultComputedStyle;
- var originalGetSelection = window.getSelection;
- function Window(impl) {
- EventTarget.call(this, impl);
- }
- Window.prototype = Object.create(EventTarget.prototype);
- OriginalWindow.prototype.getComputedStyle = function(el, pseudo) {
- return wrap(this || window).getComputedStyle(unwrapIfNeeded(el), pseudo);
- };
- if (originalGetDefaultComputedStyle) {
- OriginalWindow.prototype.getDefaultComputedStyle = function(el, pseudo) {
- return wrap(this || window).getDefaultComputedStyle(unwrapIfNeeded(el), pseudo);
- };
- }
- OriginalWindow.prototype.getSelection = function() {
- return wrap(this || window).getSelection();
- };
- delete window.getComputedStyle;
- delete window.getDefaultComputedStyle;
- delete window.getSelection;
- [ "addEventListener", "removeEventListener", "dispatchEvent" ].forEach(function(name) {
- OriginalWindow.prototype[name] = function() {
- var w = wrap(this || window);
- return w[name].apply(w, arguments);
- };
- delete window[name];
- });
- mixin(Window.prototype, {
- getComputedStyle: function(el, pseudo) {
- renderAllPending();
- return originalGetComputedStyle.call(unwrap(this), unwrapIfNeeded(el), pseudo);
- },
- getSelection: function() {
- renderAllPending();
- return new Selection(originalGetSelection.call(unwrap(this)));
- },
- get document() {
- return wrap(unwrap(this).document);
- }
- });
- if (originalGetDefaultComputedStyle) {
- Window.prototype.getDefaultComputedStyle = function(el, pseudo) {
- renderAllPending();
- return originalGetDefaultComputedStyle.call(unwrap(this), unwrapIfNeeded(el), pseudo);
- };
- }
- registerWrapper(OriginalWindow, Window, window);
- scope.wrappers.Window = Window;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var unwrap = scope.unwrap;
- var OriginalDataTransfer = window.DataTransfer || window.Clipboard;
- var OriginalDataTransferSetDragImage = OriginalDataTransfer.prototype.setDragImage;
- if (OriginalDataTransferSetDragImage) {
- OriginalDataTransfer.prototype.setDragImage = function(image, x, y) {
- OriginalDataTransferSetDragImage.call(this, unwrap(image), x, y);
- };
- }
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var registerWrapper = scope.registerWrapper;
- var setWrapper = scope.setWrapper;
- var unwrap = scope.unwrap;
- var OriginalFormData = window.FormData;
- if (!OriginalFormData) return;
- function FormData(formElement) {
- var impl;
- if (formElement instanceof OriginalFormData) {
- impl = formElement;
- } else {
- impl = new OriginalFormData(formElement && unwrap(formElement));
- }
- setWrapper(impl, this);
- }
- registerWrapper(OriginalFormData, FormData, new OriginalFormData());
- scope.wrappers.FormData = FormData;
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var unwrapIfNeeded = scope.unwrapIfNeeded;
- var originalSend = XMLHttpRequest.prototype.send;
- XMLHttpRequest.prototype.send = function(obj) {
- return originalSend.call(this, unwrapIfNeeded(obj));
- };
-})(window.ShadowDOMPolyfill);
-
-(function(scope) {
- "use strict";
- var isWrapperFor = scope.isWrapperFor;
- var elements = {
- a: "HTMLAnchorElement",
- area: "HTMLAreaElement",
- audio: "HTMLAudioElement",
- base: "HTMLBaseElement",
- body: "HTMLBodyElement",
- br: "HTMLBRElement",
- button: "HTMLButtonElement",
- canvas: "HTMLCanvasElement",
- caption: "HTMLTableCaptionElement",
- col: "HTMLTableColElement",
- content: "HTMLContentElement",
- data: "HTMLDataElement",
- datalist: "HTMLDataListElement",
- del: "HTMLModElement",
- dir: "HTMLDirectoryElement",
- div: "HTMLDivElement",
- dl: "HTMLDListElement",
- embed: "HTMLEmbedElement",
- fieldset: "HTMLFieldSetElement",
- font: "HTMLFontElement",
- form: "HTMLFormElement",
- frame: "HTMLFrameElement",
- frameset: "HTMLFrameSetElement",
- h1: "HTMLHeadingElement",
- head: "HTMLHeadElement",
- hr: "HTMLHRElement",
- html: "HTMLHtmlElement",
- iframe: "HTMLIFrameElement",
- img: "HTMLImageElement",
- input: "HTMLInputElement",
- keygen: "HTMLKeygenElement",
- label: "HTMLLabelElement",
- legend: "HTMLLegendElement",
- li: "HTMLLIElement",
- link: "HTMLLinkElement",
- map: "HTMLMapElement",
- marquee: "HTMLMarqueeElement",
- menu: "HTMLMenuElement",
- menuitem: "HTMLMenuItemElement",
- meta: "HTMLMetaElement",
- meter: "HTMLMeterElement",
- object: "HTMLObjectElement",
- ol: "HTMLOListElement",
- optgroup: "HTMLOptGroupElement",
- option: "HTMLOptionElement",
- output: "HTMLOutputElement",
- p: "HTMLParagraphElement",
- param: "HTMLParamElement",
- pre: "HTMLPreElement",
- progress: "HTMLProgressElement",
- q: "HTMLQuoteElement",
- script: "HTMLScriptElement",
- select: "HTMLSelectElement",
- shadow: "HTMLShadowElement",
- source: "HTMLSourceElement",
- span: "HTMLSpanElement",
- style: "HTMLStyleElement",
- table: "HTMLTableElement",
- tbody: "HTMLTableSectionElement",
- template: "HTMLTemplateElement",
- textarea: "HTMLTextAreaElement",
- thead: "HTMLTableSectionElement",
- time: "HTMLTimeElement",
- title: "HTMLTitleElement",
- tr: "HTMLTableRowElement",
- track: "HTMLTrackElement",
- ul: "HTMLUListElement",
- video: "HTMLVideoElement"
- };
- function overrideConstructor(tagName) {
- var nativeConstructorName = elements[tagName];
- var nativeConstructor = window[nativeConstructorName];
- if (!nativeConstructor) return;
- var element = document.createElement(tagName);
- var wrapperConstructor = element.constructor;
- window[nativeConstructorName] = wrapperConstructor;
- }
- Object.keys(elements).forEach(overrideConstructor);
- Object.getOwnPropertyNames(scope.wrappers).forEach(function(name) {
- window[name] = scope.wrappers[name];
- });
-})(window.ShadowDOMPolyfill); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/ShadowDOM.min.js b/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/ShadowDOM.min.js
deleted file mode 100644
index 72faf74cac2..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/ShadowDOM.min.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/**
- * @license
- * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
- */
-// @version 0.5.5
-"undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};n.prototype={set:function(t,n){var r=t[this.name];return r&&r[0]===t?r[1]=n:e(t,this.name,{value:[t,n],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=n}(),window.ShadowDOMPolyfill={},function(e){"use strict";function t(){if("undefined"!=typeof chrome&&chrome.app&&chrome.app.runtime)return!1;if(navigator.getDeviceStorage)return!1;try{var e=new Function("return true;");return e()}catch(t){return!1}}function n(e){if(!e)throw new Error("Assertion failed")}function r(e,t){for(var n=k(t),r=0;r<n.length;r++){var o=n[r];I(e,o,F(t,o))}return e}function o(e,t){for(var n=k(t),r=0;r<n.length;r++){var o=n[r];switch(o){case"arguments":case"caller":case"length":case"name":case"prototype":case"toString":continue}I(e,o,F(t,o))}return e}function i(e,t){for(var n=0;n<t.length;n++)if(t[n]in e)return t[n]}function a(e,t,n){B.value=n,I(e,t,B)}function s(e){var t=e.__proto__||Object.getPrototypeOf(e);if(U)try{k(t)}catch(n){t=t.__proto__}var r=R.get(t);if(r)return r;var o=s(t),i=E(o);return v(t,i,e),i}function c(e,t){m(e,t,!0)}function u(e,t){m(t,e,!1)}function l(e){return/^on[a-z]+$/.test(e)}function p(e){return/^\w[a-zA-Z_0-9]*$/.test(e)}function d(e){return A&&p(e)?new Function("return this.__impl4cf1e782hg__."+e):function(){return this.__impl4cf1e782hg__[e]}}function f(e){return A&&p(e)?new Function("v","this.__impl4cf1e782hg__."+e+" = v"):function(t){this.__impl4cf1e782hg__[e]=t}}function h(e){return A&&p(e)?new Function("return this.__impl4cf1e782hg__."+e+".apply(this.__impl4cf1e782hg__, arguments)"):function(){return this.__impl4cf1e782hg__[e].apply(this.__impl4cf1e782hg__,arguments)}}function w(e,t){try{return Object.getOwnPropertyDescriptor(e,t)}catch(n){return q}}function m(t,n,r){for(var o=k(t),i=0;i<o.length;i++){var a=o[i];if("polymerBlackList_"!==a&&!(a in n||t.polymerBlackList_&&t.polymerBlackList_[a])){U&&t.__lookupGetter__(a);var s,c,u=w(t,a);if(r&&"function"==typeof u.value)n[a]=h(a);else{var p=l(a);s=p?e.getEventHandlerGetter(a):d(a),(u.writable||u.set||V)&&(c=p?e.getEventHandlerSetter(a):f(a));var m=V||u.configurable;I(n,a,{get:s,set:c,configurable:m,enumerable:u.enumerable})}}}}function g(e,t,n){var r=e.prototype;v(r,t,n),o(t,e)}function v(e,t,r){var o=t.prototype;n(void 0===R.get(e)),R.set(e,t),P.set(o,e),c(e,o),r&&u(o,r),a(o,"constructor",t),t.prototype=o}function b(e,t){return R.get(t.prototype)===e}function y(e){var t=Object.getPrototypeOf(e),n=s(t),r=E(n);return v(t,r,e),r}function E(e){function t(t){e.call(this,t)}var n=Object.create(e.prototype);return n.constructor=t,t.prototype=n,t}function S(e){return e&&e.__impl4cf1e782hg__}function M(e){return!S(e)}function T(e){return null===e?null:(n(M(e)),e.__wrapper8e3dd93a60__||(e.__wrapper8e3dd93a60__=new(s(e))(e)))}function O(e){return null===e?null:(n(S(e)),e.__impl4cf1e782hg__)}function L(e){return e.__impl4cf1e782hg__}function j(e,t){t.__impl4cf1e782hg__=e,e.__wrapper8e3dd93a60__=t}function N(e){return e&&S(e)?O(e):e}function _(e){return e&&!S(e)?T(e):e}function C(e,t){null!==t&&(n(M(e)),n(void 0===t||S(t)),e.__wrapper8e3dd93a60__=t)}function D(e,t,n){G.get=n,I(e.prototype,t,G)}function H(e,t){D(e,t,function(){return T(this.__impl4cf1e782hg__[t])})}function x(e,t){e.forEach(function(e){t.forEach(function(t){e.prototype[t]=function(){var e=_(this);return e[t].apply(e,arguments)}})})}var R=new WeakMap,P=new WeakMap,W=Object.create(null),A=t(),I=Object.defineProperty,k=Object.getOwnPropertyNames,F=Object.getOwnPropertyDescriptor,B={value:void 0,configurable:!0,enumerable:!1,writable:!0};k(window);var U=/Firefox/.test(navigator.userAgent),q={get:function(){},set:function(){},configurable:!0,enumerable:!0},V=function(){var e=Object.getOwnPropertyDescriptor(Node.prototype,"nodeType");return e&&!e.get&&!e.set}(),G={get:void 0,configurable:!0,enumerable:!0};e.assert=n,e.constructorTable=R,e.defineGetter=D,e.defineWrapGetter=H,e.forwardMethodsToWrapper=x,e.isWrapper=S,e.isWrapperFor=b,e.mixin=r,e.nativePrototypeTable=P,e.oneOf=i,e.registerObject=y,e.registerWrapper=g,e.rewrap=C,e.setWrapper=j,e.unsafeUnwrap=L,e.unwrap=O,e.unwrapIfNeeded=N,e.wrap=T,e.wrapIfNeeded=_,e.wrappers=W}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e,t,n){return{index:e,removed:t,addedCount:n}}function n(){}var r=0,o=1,i=2,a=3;n.prototype={calcEditDistances:function(e,t,n,r,o,i){for(var a=i-o+1,s=n-t+1,c=new Array(a),u=0;a>u;u++)c[u]=new Array(s),c[u][0]=u;for(var l=0;s>l;l++)c[0][l]=l;for(var u=1;a>u;u++)for(var l=1;s>l;l++)if(this.equals(e[t+l-1],r[o+u-1]))c[u][l]=c[u-1][l-1];else{var p=c[u-1][l]+1,d=c[u][l-1]+1;c[u][l]=d>p?p:d}return c},spliceOperationsFromEditDistances:function(e){for(var t=e.length-1,n=e[0].length-1,s=e[t][n],c=[];t>0||n>0;)if(0!=t)if(0!=n){var u,l=e[t-1][n-1],p=e[t-1][n],d=e[t][n-1];u=d>p?l>p?p:l:l>d?d:l,u==l?(l==s?c.push(r):(c.push(o),s=l),t--,n--):u==p?(c.push(a),t--,s=p):(c.push(i),n--,s=d)}else c.push(a),t--;else c.push(i),n--;return c.reverse(),c},calcSplices:function(e,n,s,c,u,l){var p=0,d=0,f=Math.min(s-n,l-u);if(0==n&&0==u&&(p=this.sharedPrefix(e,c,f)),s==e.length&&l==c.length&&(d=this.sharedSuffix(e,c,f-p)),n+=p,u+=p,s-=d,l-=d,s-n==0&&l-u==0)return[];if(n==s){for(var h=t(n,[],0);l>u;)h.removed.push(c[u++]);return[h]}if(u==l)return[t(n,[],s-n)];for(var w=this.spliceOperationsFromEditDistances(this.calcEditDistances(e,n,s,c,u,l)),h=void 0,m=[],g=n,v=u,b=0;b<w.length;b++)switch(w[b]){case r:h&&(m.push(h),h=void 0),g++,v++;break;case o:h||(h=t(g,[],0)),h.addedCount++,g++,h.removed.push(c[v]),v++;break;case i:h||(h=t(g,[],0)),h.addedCount++,g++;break;case a:h||(h=t(g,[],0)),h.removed.push(c[v]),v++}return h&&m.push(h),m},sharedPrefix:function(e,t,n){for(var r=0;n>r;r++)if(!this.equals(e[r],t[r]))return r;return n},sharedSuffix:function(e,t,n){for(var r=e.length,o=t.length,i=0;n>i&&this.equals(e[--r],t[--o]);)i++;return i},calculateSplices:function(e,t){return this.calcSplices(e,0,e.length,t,0,t.length)},equals:function(e,t){return e===t}},e.ArraySplice=n}(window.ShadowDOMPolyfill),function(e){"use strict";function t(){a=!1;var e=i.slice(0);i=[];for(var t=0;t<e.length;t++)e[t]()}function n(e){i.push(e),a||(a=!0,r(t,0))}var r,o=window.MutationObserver,i=[],a=!1;if(o){var s=1,c=new o(t),u=document.createTextNode(s);c.observe(u,{characterData:!0}),r=function(){s=(s+1)%2,u.data=s}}else r=window.setTimeout;e.setEndOfMicrotask=n}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){e.scheduled_||(e.scheduled_=!0,h.push(e),w||(l(n),w=!0))}function n(){for(w=!1;h.length;){var e=h;h=[],e.sort(function(e,t){return e.uid_-t.uid_});for(var t=0;t<e.length;t++){var n=e[t];n.scheduled_=!1;var r=n.takeRecords();i(n),r.length&&n.callback_(r,n)}}}function r(e,t){this.type=e,this.target=t,this.addedNodes=new d.NodeList,this.removedNodes=new d.NodeList,this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function o(e,t){for(;e;e=e.parentNode){var n=f.get(e);if(n)for(var r=0;r<n.length;r++){var o=n[r];o.options.subtree&&o.addTransientObserver(t)}}}function i(e){for(var t=0;t<e.nodes_.length;t++){var n=e.nodes_[t],r=f.get(n);if(!r)return;for(var o=0;o<r.length;o++){var i=r[o];i.observer===e&&i.removeTransientObservers()}}}function a(e,n,o){for(var i=Object.create(null),a=Object.create(null),s=e;s;s=s.parentNode){var c=f.get(s);if(c)for(var u=0;u<c.length;u++){var l=c[u],p=l.options;if((s===e||p.subtree)&&!("attributes"===n&&!p.attributes||"attributes"===n&&p.attributeFilter&&(null!==o.namespace||-1===p.attributeFilter.indexOf(o.name))||"characterData"===n&&!p.characterData||"childList"===n&&!p.childList)){var d=l.observer;i[d.uid_]=d,("attributes"===n&&p.attributeOldValue||"characterData"===n&&p.characterDataOldValue)&&(a[d.uid_]=o.oldValue)}}}for(var h in i){var d=i[h],w=new r(n,e);"name"in o&&"namespace"in o&&(w.attributeName=o.name,w.attributeNamespace=o.namespace),o.addedNodes&&(w.addedNodes=o.addedNodes),o.removedNodes&&(w.removedNodes=o.removedNodes),o.previousSibling&&(w.previousSibling=o.previousSibling),o.nextSibling&&(w.nextSibling=o.nextSibling),void 0!==a[h]&&(w.oldValue=a[h]),t(d),d.records_.push(w)}}function s(e){if(this.childList=!!e.childList,this.subtree=!!e.subtree,this.attributes="attributes"in e||!("attributeOldValue"in e||"attributeFilter"in e)?!!e.attributes:!0,this.characterData="characterDataOldValue"in e&&!("characterData"in e)?!0:!!e.characterData,!this.attributes&&(e.attributeOldValue||"attributeFilter"in e)||!this.characterData&&e.characterDataOldValue)throw new TypeError;if(this.characterData=!!e.characterData,this.attributeOldValue=!!e.attributeOldValue,this.characterDataOldValue=!!e.characterDataOldValue,"attributeFilter"in e){if(null==e.attributeFilter||"object"!=typeof e.attributeFilter)throw new TypeError;this.attributeFilter=m.call(e.attributeFilter)}else this.attributeFilter=null}function c(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++g,this.scheduled_=!1}function u(e,t,n){this.observer=e,this.target=t,this.options=n,this.transientObservedNodes=[]}var l=e.setEndOfMicrotask,p=e.wrapIfNeeded,d=e.wrappers,f=new WeakMap,h=[],w=!1,m=Array.prototype.slice,g=0;c.prototype={constructor:c,observe:function(e,t){e=p(e);var n,r=new s(t),o=f.get(e);o||f.set(e,o=[]);for(var i=0;i<o.length;i++)o[i].observer===this&&(n=o[i],n.removeTransientObservers(),n.options=r);n||(n=new u(this,e,r),o.push(n),this.nodes_.push(e))},disconnect:function(){this.nodes_.forEach(function(e){for(var t=f.get(e),n=0;n<t.length;n++){var r=t[n];if(r.observer===this){t.splice(n,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}},u.prototype={addTransientObserver:function(e){if(e!==this.target){t(this.observer),this.transientObservedNodes.push(e);var n=f.get(e);n||f.set(e,n=[]),n.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[];for(var t=0;t<e.length;t++)for(var n=e[t],r=f.get(n),o=0;o<r.length;o++)if(r[o]===this){r.splice(o,1);break}}},e.enqueueMutation=a,e.registerTransientObservers=o,e.wrappers.MutationObserver=c,e.wrappers.MutationRecord=r}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e,t){this.root=e,this.parent=t}function n(e,t){if(e.treeScope_!==t){e.treeScope_=t;for(var r=e.shadowRoot;r;r=r.olderShadowRoot)r.treeScope_.parent=t;for(var o=e.firstChild;o;o=o.nextSibling)n(o,t)}}function r(n){if(n instanceof e.wrappers.Window,n.treeScope_)return n.treeScope_;var o,i=n.parentNode;return o=i?r(i):new t(n,null),n.treeScope_=o}t.prototype={get renderer(){return this.root instanceof e.wrappers.ShadowRoot?e.getRendererForHost(this.root.host):null},contains:function(e){for(;e;e=e.parent)if(e===this)return!0;return!1}},e.TreeScope=t,e.getTreeScope=r,e.setTreeScope=n}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){return e instanceof G.ShadowRoot}function n(e){return I(e).root}function r(e,r){var s=[],c=e;for(s.push(c);c;){var u=a(c);if(u&&u.length>0){for(var l=0;l<u.length;l++){var d=u[l];if(i(d)){var f=n(d),h=f.olderShadowRoot;h&&s.push(h)}s.push(d)}c=u[u.length-1]}else if(t(c)){if(p(e,c)&&o(r))break;c=c.host,s.push(c)}else c=c.parentNode,c&&s.push(c)}return s}function o(e){if(!e)return!1;switch(e.type){case"abort":case"error":case"select":case"change":case"load":case"reset":case"resize":case"scroll":case"selectstart":return!0}return!1}function i(e){return e instanceof HTMLShadowElement}function a(t){return e.getDestinationInsertionPoints(t)}function s(e,t){if(0===e.length)return t;t instanceof G.Window&&(t=t.document);for(var n=I(t),r=e[0],o=I(r),i=u(n,o),a=0;a<e.length;a++){var s=e[a];if(I(s)===i)return s}return e[e.length-1]}function c(e){for(var t=[];e;e=e.parent)t.push(e);return t}function u(e,t){for(var n=c(e),r=c(t),o=null;n.length>0&&r.length>0;){var i=n.pop(),a=r.pop();if(i!==a)break;o=i}return o}function l(e,t,n){t instanceof G.Window&&(t=t.document);var o,i=I(t),a=I(n),s=r(n,e),o=u(i,a);o||(o=a.root);for(var c=o;c;c=c.parent)for(var l=0;l<s.length;l++){var p=s[l];if(I(p)===c)return p}return null}function p(e,t){return I(e)===I(t)}function d(e){if(!z.get(e)&&(z.set(e,!0),h(V(e),V(e.target)),W)){var t=W;throw W=null,t}}function f(e){switch(e.type){case"load":case"beforeunload":case"unload":return!0}return!1}function h(t,n){if(K.get(t))throw new Error("InvalidStateError");K.set(t,!0),e.renderAllPending();var o,i,a;if(f(t)&&!t.bubbles){var s=n;s instanceof G.Document&&(a=s.defaultView)&&(i=s,o=[])}if(!o)if(n instanceof G.Window)a=n,o=[];else if(o=r(n,t),!f(t)){var s=o[o.length-1];s instanceof G.Document&&(a=s.defaultView)}return nt.set(t,o),w(t,o,a,i)&&m(t,o,a,i)&&g(t,o,a,i),J.set(t,rt),$["delete"](t,null),K["delete"](t),t.defaultPrevented}function w(e,t,n,r){var o=ot;if(n&&!v(n,e,o,t,r))return!1;for(var i=t.length-1;i>0;i--)if(!v(t[i],e,o,t,r))return!1;return!0}function m(e,t,n,r){var o=it,i=t[0]||n;return v(i,e,o,t,r)}function g(e,t,n,r){for(var o=at,i=1;i<t.length;i++)if(!v(t[i],e,o,t,r))return;n&&t.length>0&&v(n,e,o,t,r)}function v(e,t,n,r,o){var i=X.get(e);if(!i)return!0;var a=o||s(r,e);if(a===e){if(n===ot)return!0;n===at&&(n=it)}else if(n===at&&!t.bubbles)return!0;if("relatedTarget"in t){var c=q(t),u=c.relatedTarget;if(u){if(u instanceof Object&&u.addEventListener){var p=V(u),d=l(t,e,p);if(d===a)return!0}else d=null;Z.set(t,d)}}J.set(t,n);var f=t.type,h=!1;Y.set(t,a),$.set(t,e),i.depth++;for(var w=0,m=i.length;m>w;w++){var g=i[w];if(g.removed)h=!0;else if(!(g.type!==f||!g.capture&&n===ot||g.capture&&n===at))try{if("function"==typeof g.handler?g.handler.call(e,t):g.handler.handleEvent(t),et.get(t))return!1}catch(v){W||(W=v)}}if(i.depth--,h&&0===i.depth){var b=i.slice();i.length=0;for(var w=0;w<b.length;w++)b[w].removed||i.push(b[w])}return!Q.get(t)}function b(e,t,n){this.type=e,this.handler=t,this.capture=Boolean(n)}function y(e,t){if(!(e instanceof st))return V(T(st,"Event",e,t));var n=e;return vt||"beforeunload"!==n.type||this instanceof O?void B(n,this):new O(n)}function E(e){return e&&e.relatedTarget?Object.create(e,{relatedTarget:{value:q(e.relatedTarget)}}):e}function S(e,t,n){var r=window[e],o=function(t,n){return t instanceof r?void B(t,this):V(T(r,e,t,n))};if(o.prototype=Object.create(t.prototype),n&&k(o.prototype,n),r)try{F(r,o,new r("temp"))}catch(i){F(r,o,document.createEvent(e))}return o}function M(e,t){return function(){arguments[t]=q(arguments[t]);var n=q(this);n[e].apply(n,arguments)}}function T(e,t,n,r){if(mt)return new e(n,E(r));var o=q(document.createEvent(t)),i=wt[t],a=[n];return Object.keys(i).forEach(function(e){var t=null!=r&&e in r?r[e]:i[e];"relatedTarget"===e&&(t=q(t)),a.push(t)}),o["init"+t].apply(o,a),o}function O(e){y.call(this,e)}function L(e){return"function"==typeof e?!0:e&&e.handleEvent}function j(e){switch(e){case"DOMAttrModified":case"DOMAttributeNameChanged":case"DOMCharacterDataModified":case"DOMElementNameChanged":case"DOMNodeInserted":case"DOMNodeInsertedIntoDocument":case"DOMNodeRemoved":case"DOMNodeRemovedFromDocument":case"DOMSubtreeModified":return!0}return!1}function N(e){B(e,this)}function _(e){return e instanceof G.ShadowRoot&&(e=e.host),q(e)}function C(e,t){var n=X.get(e);if(n)for(var r=0;r<n.length;r++)if(!n[r].removed&&n[r].type===t)return!0;return!1}function D(e,t){for(var n=q(e);n;n=n.parentNode)if(C(V(n),t))return!0;return!1}function H(e){A(e,yt)}function x(t,n,o,i){e.renderAllPending();var a=V(Et.call(U(n),o,i));if(!a)return null;var c=r(a,null),u=c.lastIndexOf(t);return-1==u?null:(c=c.slice(0,u),s(c,t))}function R(e){return function(){var t=tt.get(this);return t&&t[e]&&t[e].value||null}}function P(e){var t=e.slice(2);return function(n){var r=tt.get(this);r||(r=Object.create(null),tt.set(this,r));var o=r[e];if(o&&this.removeEventListener(t,o.wrapped,!1),"function"==typeof n){var i=function(t){var r=n.call(this,t);r===!1?t.preventDefault():"onbeforeunload"===e&&"string"==typeof r&&(t.returnValue=r)};this.addEventListener(t,i,!1),r[e]={value:n,wrapped:i}}}}var W,A=e.forwardMethodsToWrapper,I=e.getTreeScope,k=e.mixin,F=e.registerWrapper,B=e.setWrapper,U=e.unsafeUnwrap,q=e.unwrap,V=e.wrap,G=e.wrappers,X=(new WeakMap,new WeakMap),z=new WeakMap,K=new WeakMap,Y=new WeakMap,$=new WeakMap,Z=new WeakMap,J=new WeakMap,Q=new WeakMap,et=new WeakMap,tt=new WeakMap,nt=new WeakMap,rt=0,ot=1,it=2,at=3;b.prototype={equals:function(e){return this.handler===e.handler&&this.type===e.type&&this.capture===e.capture},get removed(){return null===this.handler},remove:function(){this.handler=null}};var st=window.Event;st.prototype.polymerBlackList_={returnValue:!0,keyLocation:!0},y.prototype={get target(){return Y.get(this)},get currentTarget(){return $.get(this)},get eventPhase(){return J.get(this)},get path(){var e=nt.get(this);return e?e.slice():[]},stopPropagation:function(){Q.set(this,!0)},stopImmediatePropagation:function(){Q.set(this,!0),et.set(this,!0)}},F(st,y,document.createEvent("Event"));var ct=S("UIEvent",y),ut=S("CustomEvent",y),lt={get relatedTarget(){var e=Z.get(this);return void 0!==e?e:V(q(this).relatedTarget)}},pt=k({initMouseEvent:M("initMouseEvent",14)},lt),dt=k({initFocusEvent:M("initFocusEvent",5)},lt),ft=S("MouseEvent",ct,pt),ht=S("FocusEvent",ct,dt),wt=Object.create(null),mt=function(){try{new window.FocusEvent("focus")}catch(e){return!1}return!0}();if(!mt){var gt=function(e,t,n){if(n){var r=wt[n];t=k(k({},r),t)}wt[e]=t};gt("Event",{bubbles:!1,cancelable:!1}),gt("CustomEvent",{detail:null},"Event"),gt("UIEvent",{view:null,detail:0},"Event"),gt("MouseEvent",{screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null},"UIEvent"),gt("FocusEvent",{relatedTarget:null},"UIEvent")}var vt=window.BeforeUnloadEvent;O.prototype=Object.create(y.prototype),k(O.prototype,{get returnValue(){return U(this).returnValue},set returnValue(e){U(this).returnValue=e}}),vt&&F(vt,O);var bt=window.EventTarget,yt=["addEventListener","removeEventListener","dispatchEvent"];[Node,Window].forEach(function(e){var t=e.prototype;yt.forEach(function(e){Object.defineProperty(t,e+"_",{value:t[e]})})}),N.prototype={addEventListener:function(e,t,n){if(L(t)&&!j(e)){var r=new b(e,t,n),o=X.get(this);if(o){for(var i=0;i<o.length;i++)if(r.equals(o[i]))return}else o=[],o.depth=0,X.set(this,o);o.push(r);var a=_(this);a.addEventListener_(e,d,!0)}},removeEventListener:function(e,t,n){n=Boolean(n);var r=X.get(this);if(r){for(var o=0,i=!1,a=0;a<r.length;a++)r[a].type===e&&r[a].capture===n&&(o++,r[a].handler===t&&(i=!0,r[a].remove()));if(i&&1===o){var s=_(this);s.removeEventListener_(e,d,!0)}}},dispatchEvent:function(t){var n=q(t),r=n.type;z.set(n,!1),e.renderAllPending();var o;D(this,r)||(o=function(){},this.addEventListener(r,o,!0));try{return q(this).dispatchEvent_(n)}finally{o&&this.removeEventListener(r,o,!0)}}},bt&&F(bt,N);var Et=document.elementFromPoint;e.elementFromPoint=x,e.getEventHandlerGetter=R,e.getEventHandlerSetter=P,e.wrapEventTargetMethods=H,e.wrappers.BeforeUnloadEvent=O,e.wrappers.CustomEvent=ut,e.wrappers.Event=y,e.wrappers.EventTarget=N,e.wrappers.FocusEvent=ht,e.wrappers.MouseEvent=ft,e.wrappers.UIEvent=ct}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e,t){Object.defineProperty(e,t,w)}function n(e){u(e,this)}function r(){this.length=0,t(this,"length")}function o(e){for(var t=new r,o=0;o<e.length;o++)t[o]=new n(e[o]);return t.length=o,t}function i(e){a.call(this,e)}var a=e.wrappers.UIEvent,s=e.mixin,c=e.registerWrapper,u=e.setWrapper,l=e.unsafeUnwrap,p=e.wrap,d=window.TouchEvent;if(d){var f;try{f=document.createEvent("TouchEvent")}catch(h){return}var w={enumerable:!1};n.prototype={get target(){return p(l(this).target)}};var m={configurable:!0,enumerable:!0,get:null};["clientX","clientY","screenX","screenY","pageX","pageY","identifier","webkitRadiusX","webkitRadiusY","webkitRotationAngle","webkitForce"].forEach(function(e){m.get=function(){return l(this)[e]},Object.defineProperty(n.prototype,e,m)}),r.prototype={item:function(e){return this[e]}},i.prototype=Object.create(a.prototype),s(i.prototype,{get touches(){return o(l(this).touches)},get targetTouches(){return o(l(this).targetTouches)},get changedTouches(){return o(l(this).changedTouches)},initTouchEvent:function(){throw new Error("Not implemented")}}),c(d,i,f),e.wrappers.Touch=n,e.wrappers.TouchEvent=i,e.wrappers.TouchList=r}}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e,t){Object.defineProperty(e,t,s)}function n(){this.length=0,t(this,"length")}function r(e){if(null==e)return e;for(var t=new n,r=0,o=e.length;o>r;r++)t[r]=a(e[r]);return t.length=o,t}function o(e,t){e.prototype[t]=function(){return r(i(this)[t].apply(i(this),arguments))}}var i=e.unsafeUnwrap,a=e.wrap,s={enumerable:!1};n.prototype={item:function(e){return this[e]}},t(n.prototype,"item"),e.wrappers.NodeList=n,e.addWrapNodeListMethod=o,e.wrapNodeList=r}(window.ShadowDOMPolyfill),function(e){"use strict";e.wrapHTMLCollection=e.wrapNodeList,e.wrappers.HTMLCollection=e.wrappers.NodeList}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){L(e instanceof S)}function n(e){var t=new T;return t[0]=e,t.length=1,t}function r(e,t,n){N(t,"childList",{removedNodes:n,previousSibling:e.previousSibling,nextSibling:e.nextSibling})}function o(e,t){N(e,"childList",{removedNodes:t})}function i(e,t,r,o){if(e instanceof DocumentFragment){var i=s(e);B=!0;for(var a=i.length-1;a>=0;a--)e.removeChild(i[a]),i[a].parentNode_=t;B=!1;for(var a=0;a<i.length;a++)i[a].previousSibling_=i[a-1]||r,i[a].nextSibling_=i[a+1]||o;return r&&(r.nextSibling_=i[0]),o&&(o.previousSibling_=i[i.length-1]),i}var i=n(e),c=e.parentNode;return c&&c.removeChild(e),e.parentNode_=t,e.previousSibling_=r,e.nextSibling_=o,r&&(r.nextSibling_=e),o&&(o.previousSibling_=e),i}function a(e){if(e instanceof DocumentFragment)return s(e);var t=n(e),o=e.parentNode;return o&&r(e,o,t),t}function s(e){for(var t=new T,n=0,r=e.firstChild;r;r=r.nextSibling)t[n++]=r;return t.length=n,o(e,t),t}function c(e){return e}function u(e,t){R(e,t),e.nodeIsInserted_()}function l(e,t){for(var n=_(t),r=0;r<e.length;r++)u(e[r],n)}function p(e){R(e,new O(e,null))}function d(e){for(var t=0;t<e.length;t++)p(e[t])}function f(e,t){var n=e.nodeType===S.DOCUMENT_NODE?e:e.ownerDocument;n!==t.ownerDocument&&n.adoptNode(t)}function h(t,n){if(n.length){var r=t.ownerDocument;if(r!==n[0].ownerDocument)for(var o=0;o<n.length;o++)e.adoptNodeNoRemove(n[o],r)}}function w(e,t){h(e,t);var n=t.length;if(1===n)return W(t[0]);for(var r=W(e.ownerDocument.createDocumentFragment()),o=0;n>o;o++)r.appendChild(W(t[o]));return r}function m(e){if(void 0!==e.firstChild_)for(var t=e.firstChild_;t;){var n=t;t=t.nextSibling_,n.parentNode_=n.previousSibling_=n.nextSibling_=void 0}e.firstChild_=e.lastChild_=void 0}function g(e){if(e.invalidateShadowRenderer()){for(var t=e.firstChild;t;){L(t.parentNode===e);var n=t.nextSibling,r=W(t),o=r.parentNode;o&&K.call(o,r),t.previousSibling_=t.nextSibling_=t.parentNode_=null,t=n}e.firstChild_=e.lastChild_=null}else for(var n,i=W(e),a=i.firstChild;a;)n=a.nextSibling,K.call(i,a),a=n}function v(e){var t=e.parentNode;return t&&t.invalidateShadowRenderer()}function b(e){for(var t,n=0;n<e.length;n++)t=e[n],t.parentNode.removeChild(t)}function y(e,t,n){var r;if(r=I(n?U.call(n,P(e),!1):q.call(P(e),!1)),t){for(var o=e.firstChild;o;o=o.nextSibling)r.appendChild(y(o,!0,n));if(e instanceof F.HTMLTemplateElement)for(var i=r.content,o=e.content.firstChild;o;o=o.nextSibling)i.appendChild(y(o,!0,n))}return r}function E(e,t){if(!t||_(e)!==_(t))return!1;for(var n=t;n;n=n.parentNode)if(n===e)return!0;return!1}function S(e){L(e instanceof V),M.call(this,e),this.parentNode_=void 0,this.firstChild_=void 0,this.lastChild_=void 0,this.nextSibling_=void 0,this.previousSibling_=void 0,this.treeScope_=void 0}var M=e.wrappers.EventTarget,T=e.wrappers.NodeList,O=e.TreeScope,L=e.assert,j=e.defineWrapGetter,N=e.enqueueMutation,_=e.getTreeScope,C=e.isWrapper,D=e.mixin,H=e.registerTransientObservers,x=e.registerWrapper,R=e.setTreeScope,P=e.unsafeUnwrap,W=e.unwrap,A=e.unwrapIfNeeded,I=e.wrap,k=e.wrapIfNeeded,F=e.wrappers,B=!1,U=document.importNode,q=window.Node.prototype.cloneNode,V=window.Node,G=window.DocumentFragment,X=(V.prototype.appendChild,V.prototype.compareDocumentPosition),z=V.prototype.insertBefore,K=V.prototype.removeChild,Y=V.prototype.replaceChild,$=/Trident|Edge/.test(navigator.userAgent),Z=$?function(e,t){try{K.call(e,t)}catch(n){if(!(e instanceof G))throw n}}:function(e,t){K.call(e,t)};S.prototype=Object.create(M.prototype),D(S.prototype,{appendChild:function(e){return this.insertBefore(e,null)},insertBefore:function(e,n){t(e);var r;n?C(n)?r=W(n):(r=n,n=I(r)):(n=null,r=null),n&&L(n.parentNode===this);var o,s=n?n.previousSibling:this.lastChild,c=!this.invalidateShadowRenderer()&&!v(e);if(o=c?a(e):i(e,this,s,n),c)f(this,e),m(this),z.call(P(this),W(e),r);else{s||(this.firstChild_=o[0]),n||(this.lastChild_=o[o.length-1],void 0===this.firstChild_&&(this.firstChild_=this.firstChild));var u=r?r.parentNode:P(this);u?z.call(u,w(this,o),r):h(this,o)}return N(this,"childList",{addedNodes:o,nextSibling:n,previousSibling:s}),l(o,this),e},removeChild:function(e){if(t(e),e.parentNode!==this){for(var r=!1,o=(this.childNodes,this.firstChild);o;o=o.nextSibling)if(o===e){r=!0;break}if(!r)throw new Error("NotFoundError")}var i=W(e),a=e.nextSibling,s=e.previousSibling;if(this.invalidateShadowRenderer()){var c=this.firstChild,u=this.lastChild,l=i.parentNode;l&&Z(l,i),c===e&&(this.firstChild_=a),u===e&&(this.lastChild_=s),s&&(s.nextSibling_=a),a&&(a.previousSibling_=s),e.previousSibling_=e.nextSibling_=e.parentNode_=void 0}else m(this),Z(P(this),i);return B||N(this,"childList",{removedNodes:n(e),nextSibling:a,previousSibling:s}),H(this,e),e},replaceChild:function(e,r){t(e);var o;if(C(r)?o=W(r):(o=r,r=I(o)),r.parentNode!==this)throw new Error("NotFoundError");var s,c=r.nextSibling,u=r.previousSibling,d=!this.invalidateShadowRenderer()&&!v(e);return d?s=a(e):(c===e&&(c=e.nextSibling),s=i(e,this,u,c)),d?(f(this,e),m(this),Y.call(P(this),W(e),o)):(this.firstChild===r&&(this.firstChild_=s[0]),this.lastChild===r&&(this.lastChild_=s[s.length-1]),r.previousSibling_=r.nextSibling_=r.parentNode_=void 0,o.parentNode&&Y.call(o.parentNode,w(this,s),o)),N(this,"childList",{addedNodes:s,removedNodes:n(r),nextSibling:c,previousSibling:u}),p(r),l(s,this),r},nodeIsInserted_:function(){for(var e=this.firstChild;e;e=e.nextSibling)e.nodeIsInserted_()},hasChildNodes:function(){return null!==this.firstChild},get parentNode(){return void 0!==this.parentNode_?this.parentNode_:I(P(this).parentNode)},get firstChild(){return void 0!==this.firstChild_?this.firstChild_:I(P(this).firstChild)},get lastChild(){return void 0!==this.lastChild_?this.lastChild_:I(P(this).lastChild)},get nextSibling(){return void 0!==this.nextSibling_?this.nextSibling_:I(P(this).nextSibling)},get previousSibling(){return void 0!==this.previousSibling_?this.previousSibling_:I(P(this).previousSibling)},get parentElement(){for(var e=this.parentNode;e&&e.nodeType!==S.ELEMENT_NODE;)e=e.parentNode;return e},get textContent(){for(var e="",t=this.firstChild;t;t=t.nextSibling)t.nodeType!=S.COMMENT_NODE&&(e+=t.textContent);return e},set textContent(e){null==e&&(e="");var t=c(this.childNodes);if(this.invalidateShadowRenderer()){if(g(this),""!==e){var n=P(this).ownerDocument.createTextNode(e);this.appendChild(n)}}else m(this),P(this).textContent=e;var r=c(this.childNodes);N(this,"childList",{addedNodes:r,removedNodes:t}),d(t),l(r,this)},get childNodes(){for(var e=new T,t=0,n=this.firstChild;n;n=n.nextSibling)e[t++]=n;return e.length=t,e},cloneNode:function(e){return y(this,e)},contains:function(e){return E(this,k(e))},compareDocumentPosition:function(e){return X.call(P(this),A(e))},normalize:function(){for(var e,t,n=c(this.childNodes),r=[],o="",i=0;i<n.length;i++)t=n[i],t.nodeType===S.TEXT_NODE?e||t.data.length?e?(o+=t.data,r.push(t)):e=t:this.removeChild(t):(e&&r.length&&(e.data+=o,b(r)),r=[],o="",e=null,t.childNodes.length&&t.normalize());e&&r.length&&(e.data+=o,b(r))}}),j(S,"ownerDocument"),x(V,S,document.createDocumentFragment()),delete S.prototype.querySelector,delete S.prototype.querySelectorAll,S.prototype=D(Object.create(M.prototype),S.prototype),e.cloneNode=y,e.nodeWasAdded=u,e.nodeWasRemoved=p,e.nodesWereAdded=l,e.nodesWereRemoved=d,e.originalInsertBefore=z,e.originalRemoveChild=K,e.snapshotNodeList=c,e.wrappers.Node=S}(window.ShadowDOMPolyfill),function(e){"use strict";function t(t,n,r,o){for(var i=null,a=null,s=0,c=t.length;c>s;s++)i=b(t[s]),!o&&(a=g(i).root)&&a instanceof e.wrappers.ShadowRoot||(r[n++]=i);return n}function n(e){return String(e).replace(/\/deep\/|::shadow/g," ")}function r(e){return String(e).replace(/:host\(([^\s]+)\)/g,"$1").replace(/([^\s]):host/g,"$1").replace(":host","*").replace(/\^|\/shadow\/|\/shadow-deep\/|::shadow|\/deep\/|::content/g," ")}function o(e,t){for(var n,r=e.firstElementChild;r;){if(r.matches(t))return r;if(n=o(r,t))return n;r=r.nextElementSibling}return null}function i(e,t){return e.matches(t)}function a(e,t,n){var r=e.localName;return r===t||r===n&&e.namespaceURI===C}function s(){return!0}function c(e,t,n){return e.localName===n}function u(e,t){return e.namespaceURI===t}function l(e,t,n){return e.namespaceURI===t&&e.localName===n}function p(e,t,n,r,o,i){for(var a=e.firstElementChild;a;)r(a,o,i)&&(n[t++]=a),t=p(a,t,n,r,o,i),a=a.nextElementSibling;return t}function d(n,r,o,i,a){var s,c=v(this),u=g(this).root;if(u instanceof e.wrappers.ShadowRoot)return p(this,r,o,n,i,null);if(c instanceof N)s=M.call(c,i);else{if(!(c instanceof _))return p(this,r,o,n,i,null);s=S.call(c,i)}return t(s,r,o,a)}function f(n,r,o,i,a){var s,c=v(this),u=g(this).root;if(u instanceof e.wrappers.ShadowRoot)return p(this,r,o,n,i,a);if(c instanceof N)s=O.call(c,i,a);else{if(!(c instanceof _))return p(this,r,o,n,i,a);s=T.call(c,i,a)}return t(s,r,o,!1)}function h(n,r,o,i,a){var s,c=v(this),u=g(this).root;if(u instanceof e.wrappers.ShadowRoot)return p(this,r,o,n,i,a);if(c instanceof N)s=j.call(c,i,a);else{if(!(c instanceof _))return p(this,r,o,n,i,a);s=L.call(c,i,a)}return t(s,r,o,!1)}var w=e.wrappers.HTMLCollection,m=e.wrappers.NodeList,g=e.getTreeScope,v=e.unsafeUnwrap,b=e.wrap,y=document.querySelector,E=document.documentElement.querySelector,S=document.querySelectorAll,M=document.documentElement.querySelectorAll,T=document.getElementsByTagName,O=document.documentElement.getElementsByTagName,L=document.getElementsByTagNameNS,j=document.documentElement.getElementsByTagNameNS,N=window.Element,_=window.HTMLDocument||window.Document,C="http://www.w3.org/1999/xhtml",D={querySelector:function(t){var r=n(t),i=r!==t;t=r;var a,s=v(this),c=g(this).root;if(c instanceof e.wrappers.ShadowRoot)return o(this,t);if(s instanceof N)a=b(E.call(s,t));else{if(!(s instanceof _))return o(this,t);a=b(y.call(s,t))}return a&&!i&&(c=g(a).root)&&c instanceof e.wrappers.ShadowRoot?o(this,t):a},querySelectorAll:function(e){var t=n(e),r=t!==e;e=t;var o=new m;return o.length=d.call(this,i,0,o,e,r),o}},H={matches:function(t){return t=r(t),e.originalMatches.call(v(this),t)}},x={getElementsByTagName:function(e){var t=new w,n="*"===e?s:a;return t.length=f.call(this,n,0,t,e,e.toLowerCase()),t},getElementsByClassName:function(e){return this.querySelectorAll("."+e)},getElementsByTagNameNS:function(e,t){var n=new w,r=null;return r="*"===e?"*"===t?s:c:"*"===t?u:l,n.length=h.call(this,r,0,n,e||null,t),n}};e.GetElementsByInterface=x,e.SelectorsInterface=D,e.MatchesInterface=H}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){for(;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.nextSibling;return e}function n(e){for(;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.previousSibling;return e}var r=e.wrappers.NodeList,o={get firstElementChild(){return t(this.firstChild)
-},get lastElementChild(){return n(this.lastChild)},get childElementCount(){for(var e=0,t=this.firstElementChild;t;t=t.nextElementSibling)e++;return e},get children(){for(var e=new r,t=0,n=this.firstElementChild;n;n=n.nextElementSibling)e[t++]=n;return e.length=t,e},remove:function(){var e=this.parentNode;e&&e.removeChild(this)}},i={get nextElementSibling(){return t(this.nextSibling)},get previousElementSibling(){return n(this.previousSibling)}};e.ChildNodeInterface=i,e.ParentNodeInterface=o}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){r.call(this,e)}var n=e.ChildNodeInterface,r=e.wrappers.Node,o=e.enqueueMutation,i=e.mixin,a=e.registerWrapper,s=e.unsafeUnwrap,c=window.CharacterData;t.prototype=Object.create(r.prototype),i(t.prototype,{get textContent(){return this.data},set textContent(e){this.data=e},get data(){return s(this).data},set data(e){var t=s(this).data;o(this,"characterData",{oldValue:t}),s(this).data=e}}),i(t.prototype,n),a(c,t,document.createTextNode("")),e.wrappers.CharacterData=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){return e>>>0}function n(e){r.call(this,e)}var r=e.wrappers.CharacterData,o=(e.enqueueMutation,e.mixin),i=e.registerWrapper,a=window.Text;n.prototype=Object.create(r.prototype),o(n.prototype,{splitText:function(e){e=t(e);var n=this.data;if(e>n.length)throw new Error("IndexSizeError");var r=n.slice(0,e),o=n.slice(e);this.data=r;var i=this.ownerDocument.createTextNode(o);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}}),i(a,n,document.createTextNode("")),e.wrappers.Text=n}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){return i(e).getAttribute("class")}function n(e,t){a(e,"attributes",{name:"class",namespace:null,oldValue:t})}function r(t){e.invalidateRendererBasedOnAttribute(t,"class")}function o(e,o,i){var a=e.ownerElement_;if(null==a)return o.apply(e,i);var s=t(a),c=o.apply(e,i);return t(a)!==s&&(n(a,s),r(a)),c}if(!window.DOMTokenList)return void console.warn("Missing DOMTokenList prototype, please include a compatible classList polyfill such as http://goo.gl/uTcepH.");var i=e.unsafeUnwrap,a=e.enqueueMutation,s=DOMTokenList.prototype.add;DOMTokenList.prototype.add=function(){o(this,s,arguments)};var c=DOMTokenList.prototype.remove;DOMTokenList.prototype.remove=function(){o(this,c,arguments)};var u=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(){return o(this,u,arguments)}}(window.ShadowDOMPolyfill),function(e){"use strict";function t(t,n){var r=t.parentNode;if(r&&r.shadowRoot){var o=e.getRendererForHost(r);o.dependsOnAttribute(n)&&o.invalidate()}}function n(e,t,n){l(e,"attributes",{name:t,namespace:null,oldValue:n})}function r(e){a.call(this,e)}var o=e.ChildNodeInterface,i=e.GetElementsByInterface,a=e.wrappers.Node,s=e.ParentNodeInterface,c=e.SelectorsInterface,u=e.MatchesInterface,l=(e.addWrapNodeListMethod,e.enqueueMutation),p=e.mixin,d=(e.oneOf,e.registerWrapper),f=e.unsafeUnwrap,h=e.wrappers,w=window.Element,m=["matches","mozMatchesSelector","msMatchesSelector","webkitMatchesSelector"].filter(function(e){return w.prototype[e]}),g=m[0],v=w.prototype[g],b=new WeakMap;r.prototype=Object.create(a.prototype),p(r.prototype,{createShadowRoot:function(){var t=new h.ShadowRoot(this);f(this).polymerShadowRoot_=t;var n=e.getRendererForHost(this);return n.invalidate(),t},get shadowRoot(){return f(this).polymerShadowRoot_||null},setAttribute:function(e,r){var o=f(this).getAttribute(e);f(this).setAttribute(e,r),n(this,e,o),t(this,e)},removeAttribute:function(e){var r=f(this).getAttribute(e);f(this).removeAttribute(e),n(this,e,r),t(this,e)},get classList(){var e=b.get(this);if(!e){if(e=f(this).classList,!e)return;e.ownerElement_=this,b.set(this,e)}return e},get className(){return f(this).className},set className(e){this.setAttribute("class",e)},get id(){return f(this).id},set id(e){this.setAttribute("id",e)}}),m.forEach(function(e){"matches"!==e&&(r.prototype[e]=function(e){return this.matches(e)})}),w.prototype.webkitCreateShadowRoot&&(r.prototype.webkitCreateShadowRoot=r.prototype.createShadowRoot),p(r.prototype,o),p(r.prototype,i),p(r.prototype,s),p(r.prototype,c),p(r.prototype,u),d(w,r,document.createElementNS(null,"x")),e.invalidateRendererBasedOnAttribute=t,e.matchesNames=m,e.originalMatches=v,e.wrappers.Element=r}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case" ":return"&nbsp;"}}function n(e){return e.replace(L,t)}function r(e){return e.replace(j,t)}function o(e){for(var t={},n=0;n<e.length;n++)t[e[n]]=!0;return t}function i(e,t){switch(e.nodeType){case Node.ELEMENT_NODE:for(var o,i=e.tagName.toLowerCase(),s="<"+i,c=e.attributes,u=0;o=c[u];u++)s+=" "+o.name+'="'+n(o.value)+'"';return s+=">",N[i]?s:s+a(e)+"</"+i+">";case Node.TEXT_NODE:var l=e.data;return t&&_[t.localName]?l:r(l);case Node.COMMENT_NODE:return"<!--"+e.data+"-->";default:throw console.error(e),new Error("not implemented")}}function a(e){e instanceof O.HTMLTemplateElement&&(e=e.content);for(var t="",n=e.firstChild;n;n=n.nextSibling)t+=i(n,e);return t}function s(e,t,n){var r=n||"div";e.textContent="";var o=M(e.ownerDocument.createElement(r));o.innerHTML=t;for(var i;i=o.firstChild;)e.appendChild(T(i))}function c(e){h.call(this,e)}function u(e,t){var n=M(e.cloneNode(!1));n.innerHTML=t;for(var r,o=M(document.createDocumentFragment());r=n.firstChild;)o.appendChild(r);return T(o)}function l(t){return function(){return e.renderAllPending(),S(this)[t]}}function p(e){w(c,e,l(e))}function d(t){Object.defineProperty(c.prototype,t,{get:l(t),set:function(n){e.renderAllPending(),S(this)[t]=n},configurable:!0,enumerable:!0})}function f(t){Object.defineProperty(c.prototype,t,{value:function(){return e.renderAllPending(),S(this)[t].apply(S(this),arguments)},configurable:!0,enumerable:!0})}var h=e.wrappers.Element,w=e.defineGetter,m=e.enqueueMutation,g=e.mixin,v=e.nodesWereAdded,b=e.nodesWereRemoved,y=e.registerWrapper,E=e.snapshotNodeList,S=e.unsafeUnwrap,M=e.unwrap,T=e.wrap,O=e.wrappers,L=/[&\u00A0"]/g,j=/[&\u00A0<>]/g,N=o(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),_=o(["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"]),C=/MSIE/.test(navigator.userAgent),D=window.HTMLElement,H=window.HTMLTemplateElement;c.prototype=Object.create(h.prototype),g(c.prototype,{get innerHTML(){return a(this)},set innerHTML(e){if(C&&_[this.localName])return void(this.textContent=e);var t=E(this.childNodes);this.invalidateShadowRenderer()?this instanceof O.HTMLTemplateElement?s(this.content,e):s(this,e,this.tagName):!H&&this instanceof O.HTMLTemplateElement?s(this.content,e):S(this).innerHTML=e;var n=E(this.childNodes);m(this,"childList",{addedNodes:n,removedNodes:t}),b(t),v(n,this)},get outerHTML(){return i(this,this.parentNode)},set outerHTML(e){var t=this.parentNode;if(t){t.invalidateShadowRenderer();var n=u(t,e);t.replaceChild(n,this)}},insertAdjacentHTML:function(e,t){var n,r;switch(String(e).toLowerCase()){case"beforebegin":n=this.parentNode,r=this;break;case"afterend":n=this.parentNode,r=this.nextSibling;break;case"afterbegin":n=this,r=this.firstChild;break;case"beforeend":n=this,r=null;break;default:return}var o=u(n,t);n.insertBefore(o,r)},get hidden(){return this.hasAttribute("hidden")},set hidden(e){e?this.setAttribute("hidden",""):this.removeAttribute("hidden")}}),["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetTop","offsetWidth","scrollHeight","scrollWidth"].forEach(p),["scrollLeft","scrollTop"].forEach(d),["getBoundingClientRect","getClientRects","scrollIntoView"].forEach(f),y(D,c,document.createElement("b")),e.wrappers.HTMLElement=c,e.getInnerHTML=a,e.setInnerHTML=s}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.unsafeUnwrap,a=e.wrap,s=window.HTMLCanvasElement;t.prototype=Object.create(n.prototype),r(t.prototype,{getContext:function(){var e=i(this).getContext.apply(i(this),arguments);return e&&a(e)}}),o(s,t,document.createElement("canvas")),e.wrappers.HTMLCanvasElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=window.HTMLContentElement;t.prototype=Object.create(n.prototype),r(t.prototype,{constructor:t,get select(){return this.getAttribute("select")},set select(e){this.setAttribute("select",e)},setAttribute:function(e,t){n.prototype.setAttribute.call(this,e,t),"select"===String(e).toLowerCase()&&this.invalidateShadowRenderer(!0)}}),i&&o(i,t),e.wrappers.HTMLContentElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.wrapHTMLCollection,a=e.unwrap,s=window.HTMLFormElement;t.prototype=Object.create(n.prototype),r(t.prototype,{get elements(){return i(a(this).elements)}}),o(s,t,document.createElement("form")),e.wrappers.HTMLFormElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){r.call(this,e)}function n(e,t){if(!(this instanceof n))throw new TypeError("DOM object constructor cannot be called as a function.");var o=i(document.createElement("img"));r.call(this,o),a(o,this),void 0!==e&&(o.width=e),void 0!==t&&(o.height=t)}var r=e.wrappers.HTMLElement,o=e.registerWrapper,i=e.unwrap,a=e.rewrap,s=window.HTMLImageElement;t.prototype=Object.create(r.prototype),o(s,t,document.createElement("img")),n.prototype=t.prototype,e.wrappers.HTMLImageElement=t,e.wrappers.Image=n}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=(e.mixin,e.wrappers.NodeList,e.registerWrapper),o=window.HTMLShadowElement;t.prototype=Object.create(n.prototype),t.prototype.constructor=t,o&&r(o,t),e.wrappers.HTMLShadowElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){if(!e.defaultView)return e;var t=p.get(e);if(!t){for(t=e.implementation.createHTMLDocument("");t.lastChild;)t.removeChild(t.lastChild);p.set(e,t)}return t}function n(e){for(var n,r=t(e.ownerDocument),o=c(r.createDocumentFragment());n=e.firstChild;)o.appendChild(n);return o}function r(e){if(o.call(this,e),!d){var t=n(e);l.set(this,u(t))}}var o=e.wrappers.HTMLElement,i=e.mixin,a=e.registerWrapper,s=e.unsafeUnwrap,c=e.unwrap,u=e.wrap,l=new WeakMap,p=new WeakMap,d=window.HTMLTemplateElement;r.prototype=Object.create(o.prototype),i(r.prototype,{constructor:r,get content(){return d?u(s(this).content):l.get(this)}}),d&&a(d,r),e.wrappers.HTMLTemplateElement=r}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.registerWrapper,o=window.HTMLMediaElement;o&&(t.prototype=Object.create(n.prototype),r(o,t,document.createElement("audio")),e.wrappers.HTMLMediaElement=t)}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){r.call(this,e)}function n(e){if(!(this instanceof n))throw new TypeError("DOM object constructor cannot be called as a function.");var t=i(document.createElement("audio"));r.call(this,t),a(t,this),t.setAttribute("preload","auto"),void 0!==e&&t.setAttribute("src",e)}var r=e.wrappers.HTMLMediaElement,o=e.registerWrapper,i=e.unwrap,a=e.rewrap,s=window.HTMLAudioElement;s&&(t.prototype=Object.create(r.prototype),o(s,t,document.createElement("audio")),n.prototype=t.prototype,e.wrappers.HTMLAudioElement=t,e.wrappers.Audio=n)}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){return e.replace(/\s+/g," ").trim()}function n(e){o.call(this,e)}function r(e,t,n,i){if(!(this instanceof r))throw new TypeError("DOM object constructor cannot be called as a function.");var a=c(document.createElement("option"));o.call(this,a),s(a,this),void 0!==e&&(a.text=e),void 0!==t&&a.setAttribute("value",t),n===!0&&a.setAttribute("selected",""),a.selected=i===!0}var o=e.wrappers.HTMLElement,i=e.mixin,a=e.registerWrapper,s=e.rewrap,c=e.unwrap,u=e.wrap,l=window.HTMLOptionElement;n.prototype=Object.create(o.prototype),i(n.prototype,{get text(){return t(this.textContent)},set text(e){this.textContent=t(String(e))},get form(){return u(c(this).form)}}),a(l,n,document.createElement("option")),r.prototype=n.prototype,e.wrappers.HTMLOptionElement=n,e.wrappers.Option=r}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.unwrap,a=e.wrap,s=window.HTMLSelectElement;t.prototype=Object.create(n.prototype),r(t.prototype,{add:function(e,t){"object"==typeof t&&(t=i(t)),i(this).add(i(e),t)},remove:function(e){return void 0===e?void n.prototype.remove.call(this):("object"==typeof e&&(e=i(e)),void i(this).remove(e))},get form(){return a(i(this).form)}}),o(s,t,document.createElement("select")),e.wrappers.HTMLSelectElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.unwrap,a=e.wrap,s=e.wrapHTMLCollection,c=window.HTMLTableElement;t.prototype=Object.create(n.prototype),r(t.prototype,{get caption(){return a(i(this).caption)},createCaption:function(){return a(i(this).createCaption())},get tHead(){return a(i(this).tHead)},createTHead:function(){return a(i(this).createTHead())},createTFoot:function(){return a(i(this).createTFoot())},get tFoot(){return a(i(this).tFoot)},get tBodies(){return s(i(this).tBodies)},createTBody:function(){return a(i(this).createTBody())},get rows(){return s(i(this).rows)},insertRow:function(e){return a(i(this).insertRow(e))}}),o(c,t,document.createElement("table")),e.wrappers.HTMLTableElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.wrapHTMLCollection,a=e.unwrap,s=e.wrap,c=window.HTMLTableSectionElement;t.prototype=Object.create(n.prototype),r(t.prototype,{constructor:t,get rows(){return i(a(this).rows)},insertRow:function(e){return s(a(this).insertRow(e))}}),o(c,t,document.createElement("thead")),e.wrappers.HTMLTableSectionElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.wrapHTMLCollection,a=e.unwrap,s=e.wrap,c=window.HTMLTableRowElement;t.prototype=Object.create(n.prototype),r(t.prototype,{get cells(){return i(a(this).cells)},insertCell:function(e){return s(a(this).insertCell(e))}}),o(c,t,document.createElement("tr")),e.wrappers.HTMLTableRowElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){switch(e.localName){case"content":return new n(e);case"shadow":return new o(e);case"template":return new i(e)}r.call(this,e)}var n=e.wrappers.HTMLContentElement,r=e.wrappers.HTMLElement,o=e.wrappers.HTMLShadowElement,i=e.wrappers.HTMLTemplateElement,a=(e.mixin,e.registerWrapper),s=window.HTMLUnknownElement;t.prototype=Object.create(r.prototype),a(s,t),e.wrappers.HTMLUnknownElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";var t=e.wrappers.Element,n=e.wrappers.HTMLElement,r=e.registerObject,o=e.defineWrapGetter,i="http://www.w3.org/2000/svg",a=document.createElementNS(i,"title"),s=r(a),c=Object.getPrototypeOf(s.prototype).constructor;if(!("classList"in a)){var u=Object.getOwnPropertyDescriptor(t.prototype,"classList");Object.defineProperty(n.prototype,"classList",u),delete t.prototype.classList}o(c,"ownerSVGElement"),e.wrappers.SVGElement=c}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){d.call(this,e)}var n=e.mixin,r=e.registerWrapper,o=e.unwrap,i=e.wrap,a=window.SVGUseElement,s="http://www.w3.org/2000/svg",c=i(document.createElementNS(s,"g")),u=document.createElementNS(s,"use"),l=c.constructor,p=Object.getPrototypeOf(l.prototype),d=p.constructor;t.prototype=Object.create(p),"instanceRoot"in u&&n(t.prototype,{get instanceRoot(){return i(o(this).instanceRoot)},get animatedInstanceRoot(){return i(o(this).animatedInstanceRoot)}}),r(a,t,u),e.wrappers.SVGUseElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.EventTarget,r=e.mixin,o=e.registerWrapper,i=e.unsafeUnwrap,a=e.wrap,s=window.SVGElementInstance;s&&(t.prototype=Object.create(n.prototype),r(t.prototype,{get correspondingElement(){return a(i(this).correspondingElement)},get correspondingUseElement(){return a(i(this).correspondingUseElement)},get parentNode(){return a(i(this).parentNode)},get childNodes(){throw new Error("Not implemented")},get firstChild(){return a(i(this).firstChild)},get lastChild(){return a(i(this).lastChild)},get previousSibling(){return a(i(this).previousSibling)},get nextSibling(){return a(i(this).nextSibling)}}),o(s,t),e.wrappers.SVGElementInstance=t)}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){o(e,this)}var n=e.mixin,r=e.registerWrapper,o=e.setWrapper,i=e.unsafeUnwrap,a=e.unwrap,s=e.unwrapIfNeeded,c=e.wrap,u=window.CanvasRenderingContext2D;n(t.prototype,{get canvas(){return c(i(this).canvas)},drawImage:function(){arguments[0]=s(arguments[0]),i(this).drawImage.apply(i(this),arguments)},createPattern:function(){return arguments[0]=a(arguments[0]),i(this).createPattern.apply(i(this),arguments)}}),r(u,t,document.createElement("canvas").getContext("2d")),e.wrappers.CanvasRenderingContext2D=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){o(e,this)}var n=e.mixin,r=e.registerWrapper,o=e.setWrapper,i=e.unsafeUnwrap,a=e.unwrapIfNeeded,s=e.wrap,c=window.WebGLRenderingContext;if(c){n(t.prototype,{get canvas(){return s(i(this).canvas)},texImage2D:function(){arguments[5]=a(arguments[5]),i(this).texImage2D.apply(i(this),arguments)},texSubImage2D:function(){arguments[6]=a(arguments[6]),i(this).texSubImage2D.apply(i(this),arguments)}});var u=/WebKit/.test(navigator.userAgent)?{drawingBufferHeight:null,drawingBufferWidth:null}:{};r(c,t,u),e.wrappers.WebGLRenderingContext=t}}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){r(e,this)}var n=e.registerWrapper,r=e.setWrapper,o=e.unsafeUnwrap,i=e.unwrap,a=e.unwrapIfNeeded,s=e.wrap,c=window.Range;t.prototype={get startContainer(){return s(o(this).startContainer)},get endContainer(){return s(o(this).endContainer)},get commonAncestorContainer(){return s(o(this).commonAncestorContainer)},setStart:function(e,t){o(this).setStart(a(e),t)},setEnd:function(e,t){o(this).setEnd(a(e),t)},setStartBefore:function(e){o(this).setStartBefore(a(e))},setStartAfter:function(e){o(this).setStartAfter(a(e))},setEndBefore:function(e){o(this).setEndBefore(a(e))},setEndAfter:function(e){o(this).setEndAfter(a(e))},selectNode:function(e){o(this).selectNode(a(e))},selectNodeContents:function(e){o(this).selectNodeContents(a(e))},compareBoundaryPoints:function(e,t){return o(this).compareBoundaryPoints(e,i(t))},extractContents:function(){return s(o(this).extractContents())},cloneContents:function(){return s(o(this).cloneContents())},insertNode:function(e){o(this).insertNode(a(e))},surroundContents:function(e){o(this).surroundContents(a(e))},cloneRange:function(){return s(o(this).cloneRange())},isPointInRange:function(e,t){return o(this).isPointInRange(a(e),t)},comparePoint:function(e,t){return o(this).comparePoint(a(e),t)},intersectsNode:function(e){return o(this).intersectsNode(a(e))},toString:function(){return o(this).toString()}},c.prototype.createContextualFragment&&(t.prototype.createContextualFragment=function(e){return s(o(this).createContextualFragment(e))}),n(window.Range,t,document.createRange()),e.wrappers.Range=t}(window.ShadowDOMPolyfill),function(e){"use strict";var t=e.GetElementsByInterface,n=e.ParentNodeInterface,r=e.SelectorsInterface,o=e.mixin,i=e.registerObject,a=i(document.createDocumentFragment());o(a.prototype,n),o(a.prototype,r),o(a.prototype,t);var s=i(document.createComment(""));e.wrappers.Comment=s,e.wrappers.DocumentFragment=a}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){var t=p(l(e).ownerDocument.createDocumentFragment());n.call(this,t),c(t,this);var o=e.shadowRoot;f.set(this,o),this.treeScope_=new r(this,a(o||e)),d.set(this,e)}var n=e.wrappers.DocumentFragment,r=e.TreeScope,o=e.elementFromPoint,i=e.getInnerHTML,a=e.getTreeScope,s=e.mixin,c=e.rewrap,u=e.setInnerHTML,l=e.unsafeUnwrap,p=e.unwrap,d=new WeakMap,f=new WeakMap,h=/[ \t\n\r\f]/;t.prototype=Object.create(n.prototype),s(t.prototype,{constructor:t,get innerHTML(){return i(this)},set innerHTML(e){u(this,e),this.invalidateShadowRenderer()},get olderShadowRoot(){return f.get(this)||null},get host(){return d.get(this)||null},invalidateShadowRenderer:function(){return d.get(this).invalidateShadowRenderer()},elementFromPoint:function(e,t){return o(this,this.ownerDocument,e,t)},getElementById:function(e){return h.test(e)?null:this.querySelector('[id="'+e+'"]')}}),e.wrappers.ShadowRoot=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){e.previousSibling_=e.previousSibling,e.nextSibling_=e.nextSibling,e.parentNode_=e.parentNode}function n(n,o,i){var a=x(n),s=x(o),c=i?x(i):null;if(r(o),t(o),i)n.firstChild===i&&(n.firstChild_=i),i.previousSibling_=i.previousSibling;else{n.lastChild_=n.lastChild,n.lastChild===n.firstChild&&(n.firstChild_=n.firstChild);var u=R(a.lastChild);u&&(u.nextSibling_=u.nextSibling)}e.originalInsertBefore.call(a,s,c)}function r(n){var r=x(n),o=r.parentNode;if(o){var i=R(o);t(n),n.previousSibling&&(n.previousSibling.nextSibling_=n),n.nextSibling&&(n.nextSibling.previousSibling_=n),i.lastChild===n&&(i.lastChild_=n),i.firstChild===n&&(i.firstChild_=n),e.originalRemoveChild.call(o,r)}}function o(e){W.set(e,[])}function i(e){var t=W.get(e);return t||W.set(e,t=[]),t}function a(e){for(var t=[],n=0,r=e.firstChild;r;r=r.nextSibling)t[n++]=r;return t}function s(){for(var e=0;e<F.length;e++){var t=F[e],n=t.parentRenderer;n&&n.dirty||t.render()}F=[]}function c(){T=null,s()}function u(e){var t=I.get(e);return t||(t=new f(e),I.set(e,t)),t}function l(e){var t=C(e).root;return t instanceof _?t:null}function p(e){return u(e.host)}function d(e){this.skip=!1,this.node=e,this.childNodes=[]}function f(e){this.host=e,this.dirty=!1,this.invalidateAttributes(),this.associateNode(e)}function h(e){for(var t=[],n=e.firstChild;n;n=n.nextSibling)E(n)?t.push.apply(t,i(n)):t.push(n);return t}function w(e){if(e instanceof j)return e;if(e instanceof L)return null;for(var t=e.firstChild;t;t=t.nextSibling){var n=w(t);if(n)return n}return null}function m(e,t){i(t).push(e);var n=A.get(e);n?n.push(t):A.set(e,[t])}function g(e){return A.get(e)}function v(e){A.set(e,void 0)}function b(e,t){var n=t.getAttribute("select");if(!n)return!0;if(n=n.trim(),!n)return!0;if(!(e instanceof O))return!1;if(!U.test(n))return!1;try{return e.matches(n)}catch(r){return!1}}function y(e,t){var n=g(t);return n&&n[n.length-1]===e}function E(e){return e instanceof L||e instanceof j}function S(e){return e.shadowRoot}function M(e){for(var t=[],n=e.shadowRoot;n;n=n.olderShadowRoot)t.push(n);return t}var T,O=e.wrappers.Element,L=e.wrappers.HTMLContentElement,j=e.wrappers.HTMLShadowElement,N=e.wrappers.Node,_=e.wrappers.ShadowRoot,C=(e.assert,e.getTreeScope),D=(e.mixin,e.oneOf),H=e.unsafeUnwrap,x=e.unwrap,R=e.wrap,P=e.ArraySplice,W=new WeakMap,A=new WeakMap,I=new WeakMap,k=D(window,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","setTimeout"]),F=[],B=new P;B.equals=function(e,t){return x(e.node)===t},d.prototype={append:function(e){var t=new d(e);return this.childNodes.push(t),t},sync:function(e){if(!this.skip){for(var t=this.node,o=this.childNodes,i=a(x(t)),s=e||new WeakMap,c=B.calculateSplices(o,i),u=0,l=0,p=0,d=0;d<c.length;d++){for(var f=c[d];p<f.index;p++)l++,o[u++].sync(s);for(var h=f.removed.length,w=0;h>w;w++){var m=R(i[l++]);s.get(m)||r(m)}for(var g=f.addedCount,v=i[l]&&R(i[l]),w=0;g>w;w++){var b=o[u++],y=b.node;n(t,y,v),s.set(y,!0),b.sync(s)}p+=g}for(var d=p;d<o.length;d++)o[d].sync(s)}}},f.prototype={render:function(e){if(this.dirty){this.invalidateAttributes();var t=this.host;this.distribution(t);var n=e||new d(t);this.buildRenderTree(n,t);var r=!e;r&&n.sync(),this.dirty=!1}},get parentRenderer(){return C(this.host).renderer},invalidate:function(){if(!this.dirty){this.dirty=!0;var e=this.parentRenderer;if(e&&e.invalidate(),F.push(this),T)return;T=window[k](c,0)}},distribution:function(e){this.resetAllSubtrees(e),this.distributionResolution(e)},resetAll:function(e){E(e)?o(e):v(e),this.resetAllSubtrees(e)},resetAllSubtrees:function(e){for(var t=e.firstChild;t;t=t.nextSibling)this.resetAll(t);e.shadowRoot&&this.resetAll(e.shadowRoot),e.olderShadowRoot&&this.resetAll(e.olderShadowRoot)},distributionResolution:function(e){if(S(e)){for(var t=e,n=h(t),r=M(t),o=0;o<r.length;o++)this.poolDistribution(r[o],n);for(var o=r.length-1;o>=0;o--){var i=r[o],a=w(i);if(a){var s=i.olderShadowRoot;s&&(n=h(s));for(var c=0;c<n.length;c++)m(n[c],a)}this.distributionResolution(i)}}for(var u=e.firstChild;u;u=u.nextSibling)this.distributionResolution(u)},poolDistribution:function(e,t){if(!(e instanceof j))if(e instanceof L){var n=e;this.updateDependentAttributes(n.getAttribute("select"));for(var r=!1,o=0;o<t.length;o++){var e=t[o];e&&b(e,n)&&(m(e,n),t[o]=void 0,r=!0)}if(!r)for(var i=n.firstChild;i;i=i.nextSibling)m(i,n)}else for(var i=e.firstChild;i;i=i.nextSibling)this.poolDistribution(i,t)},buildRenderTree:function(e,t){for(var n=this.compose(t),r=0;r<n.length;r++){var o=n[r],i=e.append(o);this.buildRenderTree(i,o)}if(S(t)){var a=u(t);a.dirty=!1}},compose:function(e){for(var t=[],n=e.shadowRoot||e,r=n.firstChild;r;r=r.nextSibling)if(E(r)){this.associateNode(n);for(var o=i(r),a=0;a<o.length;a++){var s=o[a];y(r,s)&&t.push(s)}}else t.push(r);return t},invalidateAttributes:function(){this.attributes=Object.create(null)},updateDependentAttributes:function(e){if(e){var t=this.attributes;/\.\w+/.test(e)&&(t["class"]=!0),/#\w+/.test(e)&&(t.id=!0),e.replace(/\[\s*([^\s=\|~\]]+)/g,function(e,n){t[n]=!0})}},dependsOnAttribute:function(e){return this.attributes[e]},associateNode:function(e){H(e).polymerShadowRenderer_=this}};var U=/^(:not\()?[*.#[a-zA-Z_|]/;N.prototype.invalidateShadowRenderer=function(){var e=H(this).polymerShadowRenderer_;return e?(e.invalidate(),!0):!1},L.prototype.getDistributedNodes=j.prototype.getDistributedNodes=function(){return s(),i(this)},O.prototype.getDestinationInsertionPoints=function(){return s(),g(this)||[]},L.prototype.nodeIsInserted_=j.prototype.nodeIsInserted_=function(){this.invalidateShadowRenderer();var e,t=l(this);t&&(e=p(t)),H(this).polymerShadowRenderer_=e,e&&e.invalidate()},e.getRendererForHost=u,e.getShadowTrees=M,e.renderAllPending=s,e.getDestinationInsertionPoints=g,e.visual={insertBefore:n,remove:r}}(window.ShadowDOMPolyfill),function(e){"use strict";function t(t){if(window[t]){r(!e.wrappers[t]);var c=function(e){n.call(this,e)};c.prototype=Object.create(n.prototype),o(c.prototype,{get form(){return s(a(this).form)}}),i(window[t],c,document.createElement(t.slice(4,-7))),e.wrappers[t]=c}}var n=e.wrappers.HTMLElement,r=e.assert,o=e.mixin,i=e.registerWrapper,a=e.unwrap,s=e.wrap,c=["HTMLButtonElement","HTMLFieldSetElement","HTMLInputElement","HTMLKeygenElement","HTMLLabelElement","HTMLLegendElement","HTMLObjectElement","HTMLOutputElement","HTMLTextAreaElement"];c.forEach(t)}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){r(e,this)}{var n=e.registerWrapper,r=e.setWrapper,o=e.unsafeUnwrap,i=e.unwrap,a=e.unwrapIfNeeded,s=e.wrap;window.Selection}t.prototype={get anchorNode(){return s(o(this).anchorNode)},get focusNode(){return s(o(this).focusNode)},addRange:function(e){o(this).addRange(i(e))},collapse:function(e,t){o(this).collapse(a(e),t)},containsNode:function(e,t){return o(this).containsNode(a(e),t)},extend:function(e,t){o(this).extend(a(e),t)},getRangeAt:function(e){return s(o(this).getRangeAt(e))},removeRange:function(e){o(this).removeRange(i(e))},selectAllChildren:function(e){o(this).selectAllChildren(a(e))},toString:function(){return o(this).toString()}},n(window.Selection,t,window.getSelection()),e.wrappers.Selection=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){l.call(this,e),this.treeScope_=new w(this,null)}function n(e){var n=document[e];t.prototype[e]=function(){return N(n.apply(L(this),arguments))}}function r(e,t){D.call(L(t),j(e)),o(e,t)}function o(e,t){e.shadowRoot&&t.adoptNode(e.shadowRoot),e instanceof h&&i(e,t);for(var n=e.firstChild;n;n=n.nextSibling)o(n,t)}function i(e,t){var n=e.olderShadowRoot;n&&t.adoptNode(n)}function a(e){O(e,this)}function s(e,t){var n=document.implementation[t];e.prototype[t]=function(){return N(n.apply(L(this),arguments))}}function c(e,t){var n=document.implementation[t];e.prototype[t]=function(){return n.apply(L(this),arguments)}}var u=e.GetElementsByInterface,l=e.wrappers.Node,p=e.ParentNodeInterface,d=e.wrappers.Selection,f=e.SelectorsInterface,h=e.wrappers.ShadowRoot,w=e.TreeScope,m=e.cloneNode,g=e.defineWrapGetter,v=e.elementFromPoint,b=e.forwardMethodsToWrapper,y=e.matchesNames,E=e.mixin,S=e.registerWrapper,M=e.renderAllPending,T=e.rewrap,O=e.setWrapper,L=e.unsafeUnwrap,j=e.unwrap,N=e.wrap,_=e.wrapEventTargetMethods,C=(e.wrapNodeList,new WeakMap);t.prototype=Object.create(l.prototype),g(t,"documentElement"),g(t,"body"),g(t,"head"),["createComment","createDocumentFragment","createElement","createElementNS","createEvent","createEventNS","createRange","createTextNode","getElementById"].forEach(n);var D=document.adoptNode,H=document.getSelection;if(E(t.prototype,{adoptNode:function(e){return e.parentNode&&e.parentNode.removeChild(e),r(e,this),e},elementFromPoint:function(e,t){return v(this,this,e,t)},importNode:function(e,t){return m(e,t,L(this))},getSelection:function(){return M(),new d(H.call(j(this)))},getElementsByName:function(e){return f.querySelectorAll.call(this,"[name="+JSON.stringify(String(e))+"]")}}),document.registerElement){var x=document.registerElement;t.prototype.registerElement=function(t,n){function r(e){return e?void O(e,this):i?document.createElement(i,t):document.createElement(t)}var o,i;if(void 0!==n&&(o=n.prototype,i=n["extends"]),o||(o=Object.create(HTMLElement.prototype)),e.nativePrototypeTable.get(o))throw new Error("NotSupportedError");for(var a,s=Object.getPrototypeOf(o),c=[];s&&!(a=e.nativePrototypeTable.get(s));)c.push(s),s=Object.getPrototypeOf(s);if(!a)throw new Error("NotSupportedError");for(var u=Object.create(a),l=c.length-1;l>=0;l--)u=Object.create(u);["createdCallback","attachedCallback","detachedCallback","attributeChangedCallback"].forEach(function(e){var t=o[e];t&&(u[e]=function(){N(this)instanceof r||T(this),t.apply(N(this),arguments)})});var p={prototype:u};i&&(p["extends"]=i),r.prototype=o,r.prototype.constructor=r,e.constructorTable.set(u,r),e.nativePrototypeTable.set(o,u);x.call(j(this),t,p);return r},b([window.HTMLDocument||window.Document],["registerElement"])}b([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement,window.HTMLHtmlElement],["appendChild","compareDocumentPosition","contains","getElementsByClassName","getElementsByTagName","getElementsByTagNameNS","insertBefore","querySelector","querySelectorAll","removeChild","replaceChild"]),b([window.HTMLBodyElement,window.HTMLHeadElement,window.HTMLHtmlElement],y),b([window.HTMLDocument||window.Document],["adoptNode","importNode","contains","createComment","createDocumentFragment","createElement","createElementNS","createEvent","createEventNS","createRange","createTextNode","elementFromPoint","getElementById","getElementsByName","getSelection"]),E(t.prototype,u),E(t.prototype,p),E(t.prototype,f),E(t.prototype,{get implementation(){var e=C.get(this);return e?e:(e=new a(j(this).implementation),C.set(this,e),e)},get defaultView(){return N(j(this).defaultView)}}),S(window.Document,t,document.implementation.createHTMLDocument("")),window.HTMLDocument&&S(window.HTMLDocument,t),_([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement]),s(a,"createDocumentType"),s(a,"createDocument"),s(a,"createHTMLDocument"),c(a,"hasFeature"),S(window.DOMImplementation,a),b([window.DOMImplementation],["createDocumentType","createDocument","createHTMLDocument","hasFeature"]),e.adoptNodeNoRemove=r,e.wrappers.DOMImplementation=a,e.wrappers.Document=t
-}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.EventTarget,r=e.wrappers.Selection,o=e.mixin,i=e.registerWrapper,a=e.renderAllPending,s=e.unwrap,c=e.unwrapIfNeeded,u=e.wrap,l=window.Window,p=window.getComputedStyle,d=window.getDefaultComputedStyle,f=window.getSelection;t.prototype=Object.create(n.prototype),l.prototype.getComputedStyle=function(e,t){return u(this||window).getComputedStyle(c(e),t)},d&&(l.prototype.getDefaultComputedStyle=function(e,t){return u(this||window).getDefaultComputedStyle(c(e),t)}),l.prototype.getSelection=function(){return u(this||window).getSelection()},delete window.getComputedStyle,delete window.getDefaultComputedStyle,delete window.getSelection,["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){l.prototype[e]=function(){var t=u(this||window);return t[e].apply(t,arguments)},delete window[e]}),o(t.prototype,{getComputedStyle:function(e,t){return a(),p.call(s(this),c(e),t)},getSelection:function(){return a(),new r(f.call(s(this)))},get document(){return u(s(this).document)}}),d&&(t.prototype.getDefaultComputedStyle=function(e,t){return a(),d.call(s(this),c(e),t)}),i(l,t,window),e.wrappers.Window=t}(window.ShadowDOMPolyfill),function(e){"use strict";var t=e.unwrap,n=window.DataTransfer||window.Clipboard,r=n.prototype.setDragImage;r&&(n.prototype.setDragImage=function(e,n,o){r.call(this,t(e),n,o)})}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){var t;t=e instanceof i?e:new i(e&&o(e)),r(t,this)}var n=e.registerWrapper,r=e.setWrapper,o=e.unwrap,i=window.FormData;i&&(n(i,t,new i),e.wrappers.FormData=t)}(window.ShadowDOMPolyfill),function(e){"use strict";var t=e.unwrapIfNeeded,n=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(e){return n.call(this,t(e))}}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){var t=n[e],r=window[t];if(r){var o=document.createElement(e),i=o.constructor;window[t]=i}}var n=(e.isWrapperFor,{a:"HTMLAnchorElement",area:"HTMLAreaElement",audio:"HTMLAudioElement",base:"HTMLBaseElement",body:"HTMLBodyElement",br:"HTMLBRElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",caption:"HTMLTableCaptionElement",col:"HTMLTableColElement",content:"HTMLContentElement",data:"HTMLDataElement",datalist:"HTMLDataListElement",del:"HTMLModElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",dl:"HTMLDListElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",font:"HTMLFontElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",h1:"HTMLHeadingElement",head:"HTMLHeadElement",hr:"HTMLHRElement",html:"HTMLHtmlElement",iframe:"HTMLIFrameElement",img:"HTMLImageElement",input:"HTMLInputElement",keygen:"HTMLKeygenElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",map:"HTMLMapElement",marquee:"HTMLMarqueeElement",menu:"HTMLMenuElement",menuitem:"HTMLMenuItemElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",object:"HTMLObjectElement",ol:"HTMLOListElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",script:"HTMLScriptElement",select:"HTMLSelectElement",shadow:"HTMLShadowElement",source:"HTMLSourceElement",span:"HTMLSpanElement",style:"HTMLStyleElement",table:"HTMLTableElement",tbody:"HTMLTableSectionElement",template:"HTMLTemplateElement",textarea:"HTMLTextAreaElement",thead:"HTMLTableSectionElement",time:"HTMLTimeElement",title:"HTMLTitleElement",tr:"HTMLTableRowElement",track:"HTMLTrackElement",ul:"HTMLUListElement",video:"HTMLVideoElement"});Object.keys(n).forEach(t),Object.getOwnPropertyNames(e.wrappers).forEach(function(t){window[t]=e.wrappers[t]})}(window.ShadowDOMPolyfill); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/bower.json b/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/bower.json
deleted file mode 100644
index 4129deb3d42..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/bower.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name": "webcomponentsjs",
- "main": "webcomponents.js",
- "version": "0.5.5",
- "homepage": "http://webcomponents.org",
- "authors": [
- "The Polymer Authors"
- ],
- "keywords": [
- "webcomponents"
- ],
- "license": "BSD",
- "ignore": []
-} \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/build.log b/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/build.log
deleted file mode 100644
index 44ece4a94d7..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/build.log
+++ /dev/null
@@ -1,31 +0,0 @@
-BUILD LOG
----------
-Build Time: 2015-02-17T17:24:48-0800
-
-NODEJS INFORMATION
-==================
-nodejs: v0.12.0
-gulp: 3.8.11
-gulp-audit: 1.0.0
-gulp-concat: 2.5.0
-gulp-header: 1.2.2
-gulp-uglify: 1.1.0
-run-sequence: 1.0.2
-web-component-tester: 2.2.3
-
-REPO REVISIONS
-==============
-webcomponentsjs: 74b6b18443dd13e1cee184f688e23ae3930ed30c
-
-BUILD HASHES
-============
-CustomElements.js: 939c4b32847bf8085532995428001c3402f96cff
-CustomElements.min.js: cb3fd472ea0a9c45f5f03f86a6c5083f5077e907
-HTMLImports.js: 018bc32bc02bc6dc7dcacbd409438b26c31c2e6d
-HTMLImports.min.js: a3cb3e4ded3d708ba8333a8d5927ec93587fc191
-ShadowDOM.js: e34e8e3707d015a0ac9ec718d17b93c54500d028
-ShadowDOM.min.js: b3c2f09259d03ec44bd08ebbe9ed67dae3a06aaf
-webcomponents-lite.js: 83f6c69c9f38d6c88b1717427e713e57a96e7d70
-webcomponents-lite.min.js: d369074b523ff3806e7f71770a4d360f33331d48
-webcomponents.js: b91a9a8ae8c79bfc0275a766f3153f390ef74d81
-webcomponents.min.js: 91901c97731fc010ba5bb43624aa37d5320071c4 \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/package.json b/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/package.json
deleted file mode 100644
index 52fdd0e7889..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/package.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "name": "webcomponents.js",
- "version": "0.5.5",
- "description": "webcomponents.js",
- "main": "webcomponents.js",
- "directories": {
- "test": "tests"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/webcomponents/webcomponentsjs.git"
- },
- "author": "The Polymer Authors",
- "license": {
- "type": "BSD-3-Clause",
- "url": "http://polymer.github.io/LICENSE.txt"
- },
- "bugs": {
- "url": "https://github.com/webcomponents/webcomponentsjs/issues"
- },
- "homepage": "http://webcomponents.org",
- "devDependencies": {
- "gulp": "^3.8.8",
- "gulp-audit": "^1.0.0",
- "gulp-concat": "^2.4.1",
- "gulp-header": "^1.1.1",
- "gulp-uglify": "^1.0.1",
- "run-sequence": "^1.0.1",
- "web-component-tester": "*"
- }
-}
diff --git a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents-lite.js b/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents-lite.js
deleted file mode 100644
index a6e17b56036..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents-lite.js
+++ /dev/null
@@ -1,1728 +0,0 @@
-/**
- * @license
- * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
- */
-// @version 0.5.5
-window.WebComponents = window.WebComponents || {};
-
-(function(scope) {
- var flags = scope.flags || {};
- var file = "webcomponents.js";
- var script = document.querySelector('script[src*="' + file + '"]');
- if (!flags.noOpts) {
- location.search.slice(1).split("&").forEach(function(o) {
- o = o.split("=");
- o[0] && (flags[o[0]] = o[1] || true);
- });
- if (script) {
- for (var i = 0, a; a = script.attributes[i]; i++) {
- if (a.name !== "src") {
- flags[a.name] = a.value || true;
- }
- }
- }
- if (flags.log) {
- var parts = flags.log.split(",");
- flags.log = {};
- parts.forEach(function(f) {
- flags.log[f] = true;
- });
- } else {
- flags.log = {};
- }
- }
- flags.shadow = flags.shadow || flags.shadowdom || flags.polyfill;
- if (flags.shadow === "native") {
- flags.shadow = false;
- } else {
- flags.shadow = flags.shadow || !HTMLElement.prototype.createShadowRoot;
- }
- if (flags.register) {
- window.CustomElements = window.CustomElements || {
- flags: {}
- };
- window.CustomElements.flags.register = flags.register;
- }
- scope.flags = flags;
-})(WebComponents);
-
-(function(global) {
- var registrationsTable = new WeakMap();
- var setImmediate;
- if (/Trident|Edge/.test(navigator.userAgent)) {
- setImmediate = setTimeout;
- } else if (window.setImmediate) {
- setImmediate = window.setImmediate;
- } else {
- var setImmediateQueue = [];
- var sentinel = String(Math.random());
- window.addEventListener("message", function(e) {
- if (e.data === sentinel) {
- var queue = setImmediateQueue;
- setImmediateQueue = [];
- queue.forEach(function(func) {
- func();
- });
- }
- });
- setImmediate = function(func) {
- setImmediateQueue.push(func);
- window.postMessage(sentinel, "*");
- };
- }
- var isScheduled = false;
- var scheduledObservers = [];
- function scheduleCallback(observer) {
- scheduledObservers.push(observer);
- if (!isScheduled) {
- isScheduled = true;
- setImmediate(dispatchCallbacks);
- }
- }
- function wrapIfNeeded(node) {
- return window.ShadowDOMPolyfill && window.ShadowDOMPolyfill.wrapIfNeeded(node) || node;
- }
- function dispatchCallbacks() {
- isScheduled = false;
- var observers = scheduledObservers;
- scheduledObservers = [];
- observers.sort(function(o1, o2) {
- return o1.uid_ - o2.uid_;
- });
- var anyNonEmpty = false;
- observers.forEach(function(observer) {
- var queue = observer.takeRecords();
- removeTransientObserversFor(observer);
- if (queue.length) {
- observer.callback_(queue, observer);
- anyNonEmpty = true;
- }
- });
- if (anyNonEmpty) dispatchCallbacks();
- }
- function removeTransientObserversFor(observer) {
- observer.nodes_.forEach(function(node) {
- var registrations = registrationsTable.get(node);
- if (!registrations) return;
- registrations.forEach(function(registration) {
- if (registration.observer === observer) registration.removeTransientObservers();
- });
- });
- }
- function forEachAncestorAndObserverEnqueueRecord(target, callback) {
- for (var node = target; node; node = node.parentNode) {
- var registrations = registrationsTable.get(node);
- if (registrations) {
- for (var j = 0; j < registrations.length; j++) {
- var registration = registrations[j];
- var options = registration.options;
- if (node !== target && !options.subtree) continue;
- var record = callback(options);
- if (record) registration.enqueue(record);
- }
- }
- }
- }
- var uidCounter = 0;
- function JsMutationObserver(callback) {
- this.callback_ = callback;
- this.nodes_ = [];
- this.records_ = [];
- this.uid_ = ++uidCounter;
- }
- JsMutationObserver.prototype = {
- observe: function(target, options) {
- target = wrapIfNeeded(target);
- if (!options.childList && !options.attributes && !options.characterData || options.attributeOldValue && !options.attributes || options.attributeFilter && options.attributeFilter.length && !options.attributes || options.characterDataOldValue && !options.characterData) {
- throw new SyntaxError();
- }
- var registrations = registrationsTable.get(target);
- if (!registrations) registrationsTable.set(target, registrations = []);
- var registration;
- for (var i = 0; i < registrations.length; i++) {
- if (registrations[i].observer === this) {
- registration = registrations[i];
- registration.removeListeners();
- registration.options = options;
- break;
- }
- }
- if (!registration) {
- registration = new Registration(this, target, options);
- registrations.push(registration);
- this.nodes_.push(target);
- }
- registration.addListeners();
- },
- disconnect: function() {
- this.nodes_.forEach(function(node) {
- var registrations = registrationsTable.get(node);
- for (var i = 0; i < registrations.length; i++) {
- var registration = registrations[i];
- if (registration.observer === this) {
- registration.removeListeners();
- registrations.splice(i, 1);
- break;
- }
- }
- }, this);
- this.records_ = [];
- },
- takeRecords: function() {
- var copyOfRecords = this.records_;
- this.records_ = [];
- return copyOfRecords;
- }
- };
- function MutationRecord(type, target) {
- this.type = type;
- this.target = target;
- this.addedNodes = [];
- this.removedNodes = [];
- this.previousSibling = null;
- this.nextSibling = null;
- this.attributeName = null;
- this.attributeNamespace = null;
- this.oldValue = null;
- }
- function copyMutationRecord(original) {
- var record = new MutationRecord(original.type, original.target);
- record.addedNodes = original.addedNodes.slice();
- record.removedNodes = original.removedNodes.slice();
- record.previousSibling = original.previousSibling;
- record.nextSibling = original.nextSibling;
- record.attributeName = original.attributeName;
- record.attributeNamespace = original.attributeNamespace;
- record.oldValue = original.oldValue;
- return record;
- }
- var currentRecord, recordWithOldValue;
- function getRecord(type, target) {
- return currentRecord = new MutationRecord(type, target);
- }
- function getRecordWithOldValue(oldValue) {
- if (recordWithOldValue) return recordWithOldValue;
- recordWithOldValue = copyMutationRecord(currentRecord);
- recordWithOldValue.oldValue = oldValue;
- return recordWithOldValue;
- }
- function clearRecords() {
- currentRecord = recordWithOldValue = undefined;
- }
- function recordRepresentsCurrentMutation(record) {
- return record === recordWithOldValue || record === currentRecord;
- }
- function selectRecord(lastRecord, newRecord) {
- if (lastRecord === newRecord) return lastRecord;
- if (recordWithOldValue && recordRepresentsCurrentMutation(lastRecord)) return recordWithOldValue;
- return null;
- }
- function Registration(observer, target, options) {
- this.observer = observer;
- this.target = target;
- this.options = options;
- this.transientObservedNodes = [];
- }
- Registration.prototype = {
- enqueue: function(record) {
- var records = this.observer.records_;
- var length = records.length;
- if (records.length > 0) {
- var lastRecord = records[length - 1];
- var recordToReplaceLast = selectRecord(lastRecord, record);
- if (recordToReplaceLast) {
- records[length - 1] = recordToReplaceLast;
- return;
- }
- } else {
- scheduleCallback(this.observer);
- }
- records[length] = record;
- },
- addListeners: function() {
- this.addListeners_(this.target);
- },
- addListeners_: function(node) {
- var options = this.options;
- if (options.attributes) node.addEventListener("DOMAttrModified", this, true);
- if (options.characterData) node.addEventListener("DOMCharacterDataModified", this, true);
- if (options.childList) node.addEventListener("DOMNodeInserted", this, true);
- if (options.childList || options.subtree) node.addEventListener("DOMNodeRemoved", this, true);
- },
- removeListeners: function() {
- this.removeListeners_(this.target);
- },
- removeListeners_: function(node) {
- var options = this.options;
- if (options.attributes) node.removeEventListener("DOMAttrModified", this, true);
- if (options.characterData) node.removeEventListener("DOMCharacterDataModified", this, true);
- if (options.childList) node.removeEventListener("DOMNodeInserted", this, true);
- if (options.childList || options.subtree) node.removeEventListener("DOMNodeRemoved", this, true);
- },
- addTransientObserver: function(node) {
- if (node === this.target) return;
- this.addListeners_(node);
- this.transientObservedNodes.push(node);
- var registrations = registrationsTable.get(node);
- if (!registrations) registrationsTable.set(node, registrations = []);
- registrations.push(this);
- },
- removeTransientObservers: function() {
- var transientObservedNodes = this.transientObservedNodes;
- this.transientObservedNodes = [];
- transientObservedNodes.forEach(function(node) {
- this.removeListeners_(node);
- var registrations = registrationsTable.get(node);
- for (var i = 0; i < registrations.length; i++) {
- if (registrations[i] === this) {
- registrations.splice(i, 1);
- break;
- }
- }
- }, this);
- },
- handleEvent: function(e) {
- e.stopImmediatePropagation();
- switch (e.type) {
- case "DOMAttrModified":
- var name = e.attrName;
- var namespace = e.relatedNode.namespaceURI;
- var target = e.target;
- var record = new getRecord("attributes", target);
- record.attributeName = name;
- record.attributeNamespace = namespace;
- var oldValue = e.attrChange === MutationEvent.ADDITION ? null : e.prevValue;
- forEachAncestorAndObserverEnqueueRecord(target, function(options) {
- if (!options.attributes) return;
- if (options.attributeFilter && options.attributeFilter.length && options.attributeFilter.indexOf(name) === -1 && options.attributeFilter.indexOf(namespace) === -1) {
- return;
- }
- if (options.attributeOldValue) return getRecordWithOldValue(oldValue);
- return record;
- });
- break;
-
- case "DOMCharacterDataModified":
- var target = e.target;
- var record = getRecord("characterData", target);
- var oldValue = e.prevValue;
- forEachAncestorAndObserverEnqueueRecord(target, function(options) {
- if (!options.characterData) return;
- if (options.characterDataOldValue) return getRecordWithOldValue(oldValue);
- return record;
- });
- break;
-
- case "DOMNodeRemoved":
- this.addTransientObserver(e.target);
-
- case "DOMNodeInserted":
- var changedNode = e.target;
- var addedNodes, removedNodes;
- if (e.type === "DOMNodeInserted") {
- addedNodes = [ changedNode ];
- removedNodes = [];
- } else {
- addedNodes = [];
- removedNodes = [ changedNode ];
- }
- var previousSibling = changedNode.previousSibling;
- var nextSibling = changedNode.nextSibling;
- var record = getRecord("childList", e.target.parentNode);
- record.addedNodes = addedNodes;
- record.removedNodes = removedNodes;
- record.previousSibling = previousSibling;
- record.nextSibling = nextSibling;
- forEachAncestorAndObserverEnqueueRecord(e.relatedNode, function(options) {
- if (!options.childList) return;
- return record;
- });
- }
- clearRecords();
- }
- };
- global.JsMutationObserver = JsMutationObserver;
- if (!global.MutationObserver) global.MutationObserver = JsMutationObserver;
-})(this);
-
-if (typeof WeakMap === "undefined") {
- (function() {
- var defineProperty = Object.defineProperty;
- var counter = Date.now() % 1e9;
- var WeakMap = function() {
- this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
- };
- WeakMap.prototype = {
- set: function(key, value) {
- var entry = key[this.name];
- if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {
- value: [ key, value ],
- writable: true
- });
- return this;
- },
- get: function(key) {
- var entry;
- return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
- },
- "delete": function(key) {
- var entry = key[this.name];
- if (!entry || entry[0] !== key) return false;
- entry[0] = entry[1] = undefined;
- return true;
- },
- has: function(key) {
- var entry = key[this.name];
- if (!entry) return false;
- return entry[0] === key;
- }
- };
- window.WeakMap = WeakMap;
- })();
-}
-
-window.HTMLImports = window.HTMLImports || {
- flags: {}
-};
-
-(function(scope) {
- var IMPORT_LINK_TYPE = "import";
- var useNative = Boolean(IMPORT_LINK_TYPE in document.createElement("link"));
- var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill);
- var wrap = function(node) {
- return hasShadowDOMPolyfill ? ShadowDOMPolyfill.wrapIfNeeded(node) : node;
- };
- var rootDocument = wrap(document);
- var currentScriptDescriptor = {
- get: function() {
- var script = HTMLImports.currentScript || document.currentScript || (document.readyState !== "complete" ? document.scripts[document.scripts.length - 1] : null);
- return wrap(script);
- },
- configurable: true
- };
- Object.defineProperty(document, "_currentScript", currentScriptDescriptor);
- Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor);
- var isIE = /Trident|Edge/.test(navigator.userAgent);
- function whenReady(callback, doc) {
- doc = doc || rootDocument;
- whenDocumentReady(function() {
- watchImportsLoad(callback, doc);
- }, doc);
- }
- var requiredReadyState = isIE ? "complete" : "interactive";
- var READY_EVENT = "readystatechange";
- function isDocumentReady(doc) {
- return doc.readyState === "complete" || doc.readyState === requiredReadyState;
- }
- function whenDocumentReady(callback, doc) {
- if (!isDocumentReady(doc)) {
- var checkReady = function() {
- if (doc.readyState === "complete" || doc.readyState === requiredReadyState) {
- doc.removeEventListener(READY_EVENT, checkReady);
- whenDocumentReady(callback, doc);
- }
- };
- doc.addEventListener(READY_EVENT, checkReady);
- } else if (callback) {
- callback();
- }
- }
- function markTargetLoaded(event) {
- event.target.__loaded = true;
- }
- function watchImportsLoad(callback, doc) {
- var imports = doc.querySelectorAll("link[rel=import]");
- var loaded = 0, l = imports.length;
- function checkDone(d) {
- if (loaded == l && callback) {
- callback();
- }
- }
- function loadedImport(e) {
- markTargetLoaded(e);
- loaded++;
- checkDone();
- }
- if (l) {
- for (var i = 0, imp; i < l && (imp = imports[i]); i++) {
- if (isImportLoaded(imp)) {
- loadedImport.call(imp, {
- target: imp
- });
- } else {
- imp.addEventListener("load", loadedImport);
- imp.addEventListener("error", loadedImport);
- }
- }
- } else {
- checkDone();
- }
- }
- function isImportLoaded(link) {
- return useNative ? link.__loaded || link.import && link.import.readyState !== "loading" : link.__importParsed;
- }
- if (useNative) {
- new MutationObserver(function(mxns) {
- for (var i = 0, l = mxns.length, m; i < l && (m = mxns[i]); i++) {
- if (m.addedNodes) {
- handleImports(m.addedNodes);
- }
- }
- }).observe(document.head, {
- childList: true
- });
- function handleImports(nodes) {
- for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
- if (isImport(n)) {
- handleImport(n);
- }
- }
- }
- function isImport(element) {
- return element.localName === "link" && element.rel === "import";
- }
- function handleImport(element) {
- var loaded = element.import;
- if (loaded) {
- markTargetLoaded({
- target: element
- });
- } else {
- element.addEventListener("load", markTargetLoaded);
- element.addEventListener("error", markTargetLoaded);
- }
- }
- (function() {
- if (document.readyState === "loading") {
- var imports = document.querySelectorAll("link[rel=import]");
- for (var i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i++) {
- handleImport(imp);
- }
- }
- })();
- }
- whenReady(function() {
- HTMLImports.ready = true;
- HTMLImports.readyTime = new Date().getTime();
- var evt = rootDocument.createEvent("CustomEvent");
- evt.initCustomEvent("HTMLImportsLoaded", true, true, {});
- rootDocument.dispatchEvent(evt);
- });
- scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE;
- scope.useNative = useNative;
- scope.rootDocument = rootDocument;
- scope.whenReady = whenReady;
- scope.isIE = isIE;
-})(HTMLImports);
-
-(function(scope) {
- var modules = [];
- var addModule = function(module) {
- modules.push(module);
- };
- var initializeModules = function() {
- modules.forEach(function(module) {
- module(scope);
- });
- };
- scope.addModule = addModule;
- scope.initializeModules = initializeModules;
-})(HTMLImports);
-
-HTMLImports.addModule(function(scope) {
- var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
- var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
- var path = {
- resolveUrlsInStyle: function(style) {
- var doc = style.ownerDocument;
- var resolver = doc.createElement("a");
- style.textContent = this.resolveUrlsInCssText(style.textContent, resolver);
- return style;
- },
- resolveUrlsInCssText: function(cssText, urlObj) {
- var r = this.replaceUrls(cssText, urlObj, CSS_URL_REGEXP);
- r = this.replaceUrls(r, urlObj, CSS_IMPORT_REGEXP);
- return r;
- },
- replaceUrls: function(text, urlObj, regexp) {
- return text.replace(regexp, function(m, pre, url, post) {
- var urlPath = url.replace(/["']/g, "");
- urlObj.href = urlPath;
- urlPath = urlObj.href;
- return pre + "'" + urlPath + "'" + post;
- });
- }
- };
- scope.path = path;
-});
-
-HTMLImports.addModule(function(scope) {
- var xhr = {
- async: true,
- ok: function(request) {
- return request.status >= 200 && request.status < 300 || request.status === 304 || request.status === 0;
- },
- load: function(url, next, nextContext) {
- var request = new XMLHttpRequest();
- if (scope.flags.debug || scope.flags.bust) {
- url += "?" + Math.random();
- }
- request.open("GET", url, xhr.async);
- request.addEventListener("readystatechange", function(e) {
- if (request.readyState === 4) {
- var locationHeader = request.getResponseHeader("Location");
- var redirectedUrl = null;
- if (locationHeader) {
- var redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
- }
- next.call(nextContext, !xhr.ok(request) && request, request.response || request.responseText, redirectedUrl);
- }
- });
- request.send();
- return request;
- },
- loadDocument: function(url, next, nextContext) {
- this.load(url, next, nextContext).responseType = "document";
- }
- };
- scope.xhr = xhr;
-});
-
-HTMLImports.addModule(function(scope) {
- var xhr = scope.xhr;
- var flags = scope.flags;
- var Loader = function(onLoad, onComplete) {
- this.cache = {};
- this.onload = onLoad;
- this.oncomplete = onComplete;
- this.inflight = 0;
- this.pending = {};
- };
- Loader.prototype = {
- addNodes: function(nodes) {
- this.inflight += nodes.length;
- for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
- this.require(n);
- }
- this.checkDone();
- },
- addNode: function(node) {
- this.inflight++;
- this.require(node);
- this.checkDone();
- },
- require: function(elt) {
- var url = elt.src || elt.href;
- elt.__nodeUrl = url;
- if (!this.dedupe(url, elt)) {
- this.fetch(url, elt);
- }
- },
- dedupe: function(url, elt) {
- if (this.pending[url]) {
- this.pending[url].push(elt);
- return true;
- }
- var resource;
- if (this.cache[url]) {
- this.onload(url, elt, this.cache[url]);
- this.tail();
- return true;
- }
- this.pending[url] = [ elt ];
- return false;
- },
- fetch: function(url, elt) {
- flags.load && console.log("fetch", url, elt);
- if (!url) {
- setTimeout(function() {
- this.receive(url, elt, {
- error: "href must be specified"
- }, null);
- }.bind(this), 0);
- } else if (url.match(/^data:/)) {
- var pieces = url.split(",");
- var header = pieces[0];
- var body = pieces[1];
- if (header.indexOf(";base64") > -1) {
- body = atob(body);
- } else {
- body = decodeURIComponent(body);
- }
- setTimeout(function() {
- this.receive(url, elt, null, body);
- }.bind(this), 0);
- } else {
- var receiveXhr = function(err, resource, redirectedUrl) {
- this.receive(url, elt, err, resource, redirectedUrl);
- }.bind(this);
- xhr.load(url, receiveXhr);
- }
- },
- receive: function(url, elt, err, resource, redirectedUrl) {
- this.cache[url] = resource;
- var $p = this.pending[url];
- for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
- this.onload(url, p, resource, err, redirectedUrl);
- this.tail();
- }
- this.pending[url] = null;
- },
- tail: function() {
- --this.inflight;
- this.checkDone();
- },
- checkDone: function() {
- if (!this.inflight) {
- this.oncomplete();
- }
- }
- };
- scope.Loader = Loader;
-});
-
-HTMLImports.addModule(function(scope) {
- var Observer = function(addCallback) {
- this.addCallback = addCallback;
- this.mo = new MutationObserver(this.handler.bind(this));
- };
- Observer.prototype = {
- handler: function(mutations) {
- for (var i = 0, l = mutations.length, m; i < l && (m = mutations[i]); i++) {
- if (m.type === "childList" && m.addedNodes.length) {
- this.addedNodes(m.addedNodes);
- }
- }
- },
- addedNodes: function(nodes) {
- if (this.addCallback) {
- this.addCallback(nodes);
- }
- for (var i = 0, l = nodes.length, n, loading; i < l && (n = nodes[i]); i++) {
- if (n.children && n.children.length) {
- this.addedNodes(n.children);
- }
- }
- },
- observe: function(root) {
- this.mo.observe(root, {
- childList: true,
- subtree: true
- });
- }
- };
- scope.Observer = Observer;
-});
-
-HTMLImports.addModule(function(scope) {
- var path = scope.path;
- var rootDocument = scope.rootDocument;
- var flags = scope.flags;
- var isIE = scope.isIE;
- var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
- var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]";
- var importParser = {
- documentSelectors: IMPORT_SELECTOR,
- importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]", "style", "script:not([type])", 'script[type="text/javascript"]' ].join(","),
- map: {
- link: "parseLink",
- script: "parseScript",
- style: "parseStyle"
- },
- dynamicElements: [],
- parseNext: function() {
- var next = this.nextToParse();
- if (next) {
- this.parse(next);
- }
- },
- parse: function(elt) {
- if (this.isParsed(elt)) {
- flags.parse && console.log("[%s] is already parsed", elt.localName);
- return;
- }
- var fn = this[this.map[elt.localName]];
- if (fn) {
- this.markParsing(elt);
- fn.call(this, elt);
- }
- },
- parseDynamic: function(elt, quiet) {
- this.dynamicElements.push(elt);
- if (!quiet) {
- this.parseNext();
- }
- },
- markParsing: function(elt) {
- flags.parse && console.log("parsing", elt);
- this.parsingElement = elt;
- },
- markParsingComplete: function(elt) {
- elt.__importParsed = true;
- this.markDynamicParsingComplete(elt);
- if (elt.__importElement) {
- elt.__importElement.__importParsed = true;
- this.markDynamicParsingComplete(elt.__importElement);
- }
- this.parsingElement = null;
- flags.parse && console.log("completed", elt);
- },
- markDynamicParsingComplete: function(elt) {
- var i = this.dynamicElements.indexOf(elt);
- if (i >= 0) {
- this.dynamicElements.splice(i, 1);
- }
- },
- parseImport: function(elt) {
- if (HTMLImports.__importsParsingHook) {
- HTMLImports.__importsParsingHook(elt);
- }
- if (elt.import) {
- elt.import.__importParsed = true;
- }
- this.markParsingComplete(elt);
- if (elt.__resource && !elt.__error) {
- elt.dispatchEvent(new CustomEvent("load", {
- bubbles: false
- }));
- } else {
- elt.dispatchEvent(new CustomEvent("error", {
- bubbles: false
- }));
- }
- if (elt.__pending) {
- var fn;
- while (elt.__pending.length) {
- fn = elt.__pending.shift();
- if (fn) {
- fn({
- target: elt
- });
- }
- }
- }
- this.parseNext();
- },
- parseLink: function(linkElt) {
- if (nodeIsImport(linkElt)) {
- this.parseImport(linkElt);
- } else {
- linkElt.href = linkElt.href;
- this.parseGeneric(linkElt);
- }
- },
- parseStyle: function(elt) {
- var src = elt;
- elt = cloneStyle(elt);
- elt.__importElement = src;
- this.parseGeneric(elt);
- },
- parseGeneric: function(elt) {
- this.trackElement(elt);
- this.addElementToDocument(elt);
- },
- rootImportForElement: function(elt) {
- var n = elt;
- while (n.ownerDocument.__importLink) {
- n = n.ownerDocument.__importLink;
- }
- return n;
- },
- addElementToDocument: function(elt) {
- var port = this.rootImportForElement(elt.__importElement || elt);
- port.parentNode.insertBefore(elt, port);
- },
- trackElement: function(elt, callback) {
- var self = this;
- var done = function(e) {
- if (callback) {
- callback(e);
- }
- self.markParsingComplete(elt);
- self.parseNext();
- };
- elt.addEventListener("load", done);
- elt.addEventListener("error", done);
- if (isIE && elt.localName === "style") {
- var fakeLoad = false;
- if (elt.textContent.indexOf("@import") == -1) {
- fakeLoad = true;
- } else if (elt.sheet) {
- fakeLoad = true;
- var csr = elt.sheet.cssRules;
- var len = csr ? csr.length : 0;
- for (var i = 0, r; i < len && (r = csr[i]); i++) {
- if (r.type === CSSRule.IMPORT_RULE) {
- fakeLoad = fakeLoad && Boolean(r.styleSheet);
- }
- }
- }
- if (fakeLoad) {
- elt.dispatchEvent(new CustomEvent("load", {
- bubbles: false
- }));
- }
- }
- },
- parseScript: function(scriptElt) {
- var script = document.createElement("script");
- script.__importElement = scriptElt;
- script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
- scope.currentScript = scriptElt;
- this.trackElement(script, function(e) {
- script.parentNode.removeChild(script);
- scope.currentScript = null;
- });
- this.addElementToDocument(script);
- },
- nextToParse: function() {
- this._mayParse = [];
- return !this.parsingElement && (this.nextToParseInDoc(rootDocument) || this.nextToParseDynamic());
- },
- nextToParseInDoc: function(doc, link) {
- if (doc && this._mayParse.indexOf(doc) < 0) {
- this._mayParse.push(doc);
- var nodes = doc.querySelectorAll(this.parseSelectorsForNode(doc));
- for (var i = 0, l = nodes.length, p = 0, n; i < l && (n = nodes[i]); i++) {
- if (!this.isParsed(n)) {
- if (this.hasResource(n)) {
- return nodeIsImport(n) ? this.nextToParseInDoc(n.import, n) : n;
- } else {
- return;
- }
- }
- }
- }
- return link;
- },
- nextToParseDynamic: function() {
- return this.dynamicElements[0];
- },
- parseSelectorsForNode: function(node) {
- var doc = node.ownerDocument || node;
- return doc === rootDocument ? this.documentSelectors : this.importsSelectors;
- },
- isParsed: function(node) {
- return node.__importParsed;
- },
- needsDynamicParsing: function(elt) {
- return this.dynamicElements.indexOf(elt) >= 0;
- },
- hasResource: function(node) {
- if (nodeIsImport(node) && node.import === undefined) {
- return false;
- }
- return true;
- }
- };
- function nodeIsImport(elt) {
- return elt.localName === "link" && elt.rel === IMPORT_LINK_TYPE;
- }
- function generateScriptDataUrl(script) {
- var scriptContent = generateScriptContent(script);
- return "data:text/javascript;charset=utf-8," + encodeURIComponent(scriptContent);
- }
- function generateScriptContent(script) {
- return script.textContent + generateSourceMapHint(script);
- }
- function generateSourceMapHint(script) {
- var owner = script.ownerDocument;
- owner.__importedScripts = owner.__importedScripts || 0;
- var moniker = script.ownerDocument.baseURI;
- var num = owner.__importedScripts ? "-" + owner.__importedScripts : "";
- owner.__importedScripts++;
- return "\n//# sourceURL=" + moniker + num + ".js\n";
- }
- function cloneStyle(style) {
- var clone = style.ownerDocument.createElement("style");
- clone.textContent = style.textContent;
- path.resolveUrlsInStyle(clone);
- return clone;
- }
- scope.parser = importParser;
- scope.IMPORT_SELECTOR = IMPORT_SELECTOR;
-});
-
-HTMLImports.addModule(function(scope) {
- var flags = scope.flags;
- var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
- var IMPORT_SELECTOR = scope.IMPORT_SELECTOR;
- var rootDocument = scope.rootDocument;
- var Loader = scope.Loader;
- var Observer = scope.Observer;
- var parser = scope.parser;
- var importer = {
- documents: {},
- documentPreloadSelectors: IMPORT_SELECTOR,
- importsPreloadSelectors: [ IMPORT_SELECTOR ].join(","),
- loadNode: function(node) {
- importLoader.addNode(node);
- },
- loadSubtree: function(parent) {
- var nodes = this.marshalNodes(parent);
- importLoader.addNodes(nodes);
- },
- marshalNodes: function(parent) {
- return parent.querySelectorAll(this.loadSelectorsForNode(parent));
- },
- loadSelectorsForNode: function(node) {
- var doc = node.ownerDocument || node;
- return doc === rootDocument ? this.documentPreloadSelectors : this.importsPreloadSelectors;
- },
- loaded: function(url, elt, resource, err, redirectedUrl) {
- flags.load && console.log("loaded", url, elt);
- elt.__resource = resource;
- elt.__error = err;
- if (isImportLink(elt)) {
- var doc = this.documents[url];
- if (doc === undefined) {
- doc = err ? null : makeDocument(resource, redirectedUrl || url);
- if (doc) {
- doc.__importLink = elt;
- this.bootDocument(doc);
- }
- this.documents[url] = doc;
- }
- elt.import = doc;
- }
- parser.parseNext();
- },
- bootDocument: function(doc) {
- this.loadSubtree(doc);
- this.observer.observe(doc);
- parser.parseNext();
- },
- loadedAll: function() {
- parser.parseNext();
- }
- };
- var importLoader = new Loader(importer.loaded.bind(importer), importer.loadedAll.bind(importer));
- importer.observer = new Observer();
- function isImportLink(elt) {
- return isLinkRel(elt, IMPORT_LINK_TYPE);
- }
- function isLinkRel(elt, rel) {
- return elt.localName === "link" && elt.getAttribute("rel") === rel;
- }
- function hasBaseURIAccessor(doc) {
- return !!Object.getOwnPropertyDescriptor(doc, "baseURI");
- }
- function makeDocument(resource, url) {
- var doc = document.implementation.createHTMLDocument(IMPORT_LINK_TYPE);
- doc._URL = url;
- var base = doc.createElement("base");
- base.setAttribute("href", url);
- if (!doc.baseURI && !hasBaseURIAccessor(doc)) {
- Object.defineProperty(doc, "baseURI", {
- value: url
- });
- }
- var meta = doc.createElement("meta");
- meta.setAttribute("charset", "utf-8");
- doc.head.appendChild(meta);
- doc.head.appendChild(base);
- doc.body.innerHTML = resource;
- if (window.HTMLTemplateElement && HTMLTemplateElement.bootstrap) {
- HTMLTemplateElement.bootstrap(doc);
- }
- return doc;
- }
- if (!document.baseURI) {
- var baseURIDescriptor = {
- get: function() {
- var base = document.querySelector("base");
- return base ? base.href : window.location.href;
- },
- configurable: true
- };
- Object.defineProperty(document, "baseURI", baseURIDescriptor);
- Object.defineProperty(rootDocument, "baseURI", baseURIDescriptor);
- }
- scope.importer = importer;
- scope.importLoader = importLoader;
-});
-
-HTMLImports.addModule(function(scope) {
- var parser = scope.parser;
- var importer = scope.importer;
- var dynamic = {
- added: function(nodes) {
- var owner, parsed, loading;
- for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
- if (!owner) {
- owner = n.ownerDocument;
- parsed = parser.isParsed(owner);
- }
- loading = this.shouldLoadNode(n);
- if (loading) {
- importer.loadNode(n);
- }
- if (this.shouldParseNode(n) && parsed) {
- parser.parseDynamic(n, loading);
- }
- }
- },
- shouldLoadNode: function(node) {
- return node.nodeType === 1 && matches.call(node, importer.loadSelectorsForNode(node));
- },
- shouldParseNode: function(node) {
- return node.nodeType === 1 && matches.call(node, parser.parseSelectorsForNode(node));
- }
- };
- importer.observer.addCallback = dynamic.added.bind(dynamic);
- var matches = HTMLElement.prototype.matches || HTMLElement.prototype.matchesSelector || HTMLElement.prototype.webkitMatchesSelector || HTMLElement.prototype.mozMatchesSelector || HTMLElement.prototype.msMatchesSelector;
-});
-
-(function(scope) {
- var initializeModules = scope.initializeModules;
- var isIE = scope.isIE;
- if (scope.useNative) {
- return;
- }
- if (isIE && typeof window.CustomEvent !== "function") {
- window.CustomEvent = function(inType, params) {
- params = params || {};
- var e = document.createEvent("CustomEvent");
- e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
- return e;
- };
- window.CustomEvent.prototype = window.Event.prototype;
- }
- initializeModules();
- var rootDocument = scope.rootDocument;
- function bootstrap() {
- HTMLImports.importer.bootDocument(rootDocument);
- }
- if (document.readyState === "complete" || document.readyState === "interactive" && !window.attachEvent) {
- bootstrap();
- } else {
- document.addEventListener("DOMContentLoaded", bootstrap);
- }
-})(HTMLImports);
-
-window.CustomElements = window.CustomElements || {
- flags: {}
-};
-
-(function(scope) {
- var flags = scope.flags;
- var modules = [];
- var addModule = function(module) {
- modules.push(module);
- };
- var initializeModules = function() {
- modules.forEach(function(module) {
- module(scope);
- });
- };
- scope.addModule = addModule;
- scope.initializeModules = initializeModules;
- scope.hasNative = Boolean(document.registerElement);
- scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || HTMLImports.useNative);
-})(CustomElements);
-
-CustomElements.addModule(function(scope) {
- var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : "none";
- function forSubtree(node, cb) {
- findAllElements(node, function(e) {
- if (cb(e)) {
- return true;
- }
- forRoots(e, cb);
- });
- forRoots(node, cb);
- }
- function findAllElements(node, find, data) {
- var e = node.firstElementChild;
- if (!e) {
- e = node.firstChild;
- while (e && e.nodeType !== Node.ELEMENT_NODE) {
- e = e.nextSibling;
- }
- }
- while (e) {
- if (find(e, data) !== true) {
- findAllElements(e, find, data);
- }
- e = e.nextElementSibling;
- }
- return null;
- }
- function forRoots(node, cb) {
- var root = node.shadowRoot;
- while (root) {
- forSubtree(root, cb);
- root = root.olderShadowRoot;
- }
- }
- var processingDocuments;
- function forDocumentTree(doc, cb) {
- processingDocuments = [];
- _forDocumentTree(doc, cb);
- processingDocuments = null;
- }
- function _forDocumentTree(doc, cb) {
- doc = wrap(doc);
- if (processingDocuments.indexOf(doc) >= 0) {
- return;
- }
- processingDocuments.push(doc);
- var imports = doc.querySelectorAll("link[rel=" + IMPORT_LINK_TYPE + "]");
- for (var i = 0, l = imports.length, n; i < l && (n = imports[i]); i++) {
- if (n.import) {
- _forDocumentTree(n.import, cb);
- }
- }
- cb(doc);
- }
- scope.forDocumentTree = forDocumentTree;
- scope.forSubtree = forSubtree;
-});
-
-CustomElements.addModule(function(scope) {
- var flags = scope.flags;
- var forSubtree = scope.forSubtree;
- var forDocumentTree = scope.forDocumentTree;
- function addedNode(node) {
- return added(node) || addedSubtree(node);
- }
- function added(node) {
- if (scope.upgrade(node)) {
- return true;
- }
- attached(node);
- }
- function addedSubtree(node) {
- forSubtree(node, function(e) {
- if (added(e)) {
- return true;
- }
- });
- }
- function attachedNode(node) {
- attached(node);
- if (inDocument(node)) {
- forSubtree(node, function(e) {
- attached(e);
- });
- }
- }
- var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
- scope.hasPolyfillMutations = hasPolyfillMutations;
- var isPendingMutations = false;
- var pendingMutations = [];
- function deferMutation(fn) {
- pendingMutations.push(fn);
- if (!isPendingMutations) {
- isPendingMutations = true;
- setTimeout(takeMutations);
- }
- }
- function takeMutations() {
- isPendingMutations = false;
- var $p = pendingMutations;
- for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
- p();
- }
- pendingMutations = [];
- }
- function attached(element) {
- if (hasPolyfillMutations) {
- deferMutation(function() {
- _attached(element);
- });
- } else {
- _attached(element);
- }
- }
- function _attached(element) {
- if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
- if (!element.__attached && inDocument(element)) {
- element.__attached = true;
- if (element.attachedCallback) {
- element.attachedCallback();
- }
- }
- }
- }
- function detachedNode(node) {
- detached(node);
- forSubtree(node, function(e) {
- detached(e);
- });
- }
- function detached(element) {
- if (hasPolyfillMutations) {
- deferMutation(function() {
- _detached(element);
- });
- } else {
- _detached(element);
- }
- }
- function _detached(element) {
- if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
- if (element.__attached && !inDocument(element)) {
- element.__attached = false;
- if (element.detachedCallback) {
- element.detachedCallback();
- }
- }
- }
- }
- function inDocument(element) {
- var p = element;
- var doc = wrap(document);
- while (p) {
- if (p == doc) {
- return true;
- }
- p = p.parentNode || p.host;
- }
- }
- function watchShadow(node) {
- if (node.shadowRoot && !node.shadowRoot.__watched) {
- flags.dom && console.log("watching shadow-root for: ", node.localName);
- var root = node.shadowRoot;
- while (root) {
- observe(root);
- root = root.olderShadowRoot;
- }
- }
- }
- function handler(mutations) {
- if (flags.dom) {
- var mx = mutations[0];
- if (mx && mx.type === "childList" && mx.addedNodes) {
- if (mx.addedNodes) {
- var d = mx.addedNodes[0];
- while (d && d !== document && !d.host) {
- d = d.parentNode;
- }
- var u = d && (d.URL || d._URL || d.host && d.host.localName) || "";
- u = u.split("/?").shift().split("/").pop();
- }
- }
- console.group("mutations (%d) [%s]", mutations.length, u || "");
- }
- mutations.forEach(function(mx) {
- if (mx.type === "childList") {
- forEach(mx.addedNodes, function(n) {
- if (!n.localName) {
- return;
- }
- addedNode(n);
- });
- forEach(mx.removedNodes, function(n) {
- if (!n.localName) {
- return;
- }
- detachedNode(n);
- });
- }
- });
- flags.dom && console.groupEnd();
- }
- function takeRecords(node) {
- node = wrap(node);
- if (!node) {
- node = wrap(document);
- }
- while (node.parentNode) {
- node = node.parentNode;
- }
- var observer = node.__observer;
- if (observer) {
- handler(observer.takeRecords());
- takeMutations();
- }
- }
- var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
- function observe(inRoot) {
- if (inRoot.__observer) {
- return;
- }
- var observer = new MutationObserver(handler);
- observer.observe(inRoot, {
- childList: true,
- subtree: true
- });
- inRoot.__observer = observer;
- }
- function upgradeDocument(doc) {
- doc = wrap(doc);
- flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
- addedNode(doc);
- observe(doc);
- flags.dom && console.groupEnd();
- }
- function upgradeDocumentTree(doc) {
- forDocumentTree(doc, upgradeDocument);
- }
- var originalCreateShadowRoot = Element.prototype.createShadowRoot;
- if (originalCreateShadowRoot) {
- Element.prototype.createShadowRoot = function() {
- var root = originalCreateShadowRoot.call(this);
- CustomElements.watchShadow(this);
- return root;
- };
- }
- scope.watchShadow = watchShadow;
- scope.upgradeDocumentTree = upgradeDocumentTree;
- scope.upgradeSubtree = addedSubtree;
- scope.upgradeAll = addedNode;
- scope.attachedNode = attachedNode;
- scope.takeRecords = takeRecords;
-});
-
-CustomElements.addModule(function(scope) {
- var flags = scope.flags;
- function upgrade(node) {
- if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
- var is = node.getAttribute("is");
- var definition = scope.getRegisteredDefinition(is || node.localName);
- if (definition) {
- if (is && definition.tag == node.localName) {
- return upgradeWithDefinition(node, definition);
- } else if (!is && !definition.extends) {
- return upgradeWithDefinition(node, definition);
- }
- }
- }
- }
- function upgradeWithDefinition(element, definition) {
- flags.upgrade && console.group("upgrade:", element.localName);
- if (definition.is) {
- element.setAttribute("is", definition.is);
- }
- implementPrototype(element, definition);
- element.__upgraded__ = true;
- created(element);
- scope.attachedNode(element);
- scope.upgradeSubtree(element);
- flags.upgrade && console.groupEnd();
- return element;
- }
- function implementPrototype(element, definition) {
- if (Object.__proto__) {
- element.__proto__ = definition.prototype;
- } else {
- customMixin(element, definition.prototype, definition.native);
- element.__proto__ = definition.prototype;
- }
- }
- function customMixin(inTarget, inSrc, inNative) {
- var used = {};
- var p = inSrc;
- while (p !== inNative && p !== HTMLElement.prototype) {
- var keys = Object.getOwnPropertyNames(p);
- for (var i = 0, k; k = keys[i]; i++) {
- if (!used[k]) {
- Object.defineProperty(inTarget, k, Object.getOwnPropertyDescriptor(p, k));
- used[k] = 1;
- }
- }
- p = Object.getPrototypeOf(p);
- }
- }
- function created(element) {
- if (element.createdCallback) {
- element.createdCallback();
- }
- }
- scope.upgrade = upgrade;
- scope.upgradeWithDefinition = upgradeWithDefinition;
- scope.implementPrototype = implementPrototype;
-});
-
-CustomElements.addModule(function(scope) {
- var upgradeDocumentTree = scope.upgradeDocumentTree;
- var upgrade = scope.upgrade;
- var upgradeWithDefinition = scope.upgradeWithDefinition;
- var implementPrototype = scope.implementPrototype;
- var useNative = scope.useNative;
- function register(name, options) {
- var definition = options || {};
- if (!name) {
- throw new Error("document.registerElement: first argument `name` must not be empty");
- }
- if (name.indexOf("-") < 0) {
- throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(name) + "'.");
- }
- if (isReservedTag(name)) {
- throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '" + String(name) + "'. The type name is invalid.");
- }
- if (getRegisteredDefinition(name)) {
- throw new Error("DuplicateDefinitionError: a type with name '" + String(name) + "' is already registered");
- }
- if (!definition.prototype) {
- definition.prototype = Object.create(HTMLElement.prototype);
- }
- definition.__name = name.toLowerCase();
- definition.lifecycle = definition.lifecycle || {};
- definition.ancestry = ancestry(definition.extends);
- resolveTagName(definition);
- resolvePrototypeChain(definition);
- overrideAttributeApi(definition.prototype);
- registerDefinition(definition.__name, definition);
- definition.ctor = generateConstructor(definition);
- definition.ctor.prototype = definition.prototype;
- definition.prototype.constructor = definition.ctor;
- if (scope.ready) {
- upgradeDocumentTree(document);
- }
- return definition.ctor;
- }
- function overrideAttributeApi(prototype) {
- if (prototype.setAttribute._polyfilled) {
- return;
- }
- var setAttribute = prototype.setAttribute;
- prototype.setAttribute = function(name, value) {
- changeAttribute.call(this, name, value, setAttribute);
- };
- var removeAttribute = prototype.removeAttribute;
- prototype.removeAttribute = function(name) {
- changeAttribute.call(this, name, null, removeAttribute);
- };
- prototype.setAttribute._polyfilled = true;
- }
- function changeAttribute(name, value, operation) {
- name = name.toLowerCase();
- var oldValue = this.getAttribute(name);
- operation.apply(this, arguments);
- var newValue = this.getAttribute(name);
- if (this.attributeChangedCallback && newValue !== oldValue) {
- this.attributeChangedCallback(name, oldValue, newValue);
- }
- }
- function isReservedTag(name) {
- for (var i = 0; i < reservedTagList.length; i++) {
- if (name === reservedTagList[i]) {
- return true;
- }
- }
- }
- var reservedTagList = [ "annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph" ];
- function ancestry(extnds) {
- var extendee = getRegisteredDefinition(extnds);
- if (extendee) {
- return ancestry(extendee.extends).concat([ extendee ]);
- }
- return [];
- }
- function resolveTagName(definition) {
- var baseTag = definition.extends;
- for (var i = 0, a; a = definition.ancestry[i]; i++) {
- baseTag = a.is && a.tag;
- }
- definition.tag = baseTag || definition.__name;
- if (baseTag) {
- definition.is = definition.__name;
- }
- }
- function resolvePrototypeChain(definition) {
- if (!Object.__proto__) {
- var nativePrototype = HTMLElement.prototype;
- if (definition.is) {
- var inst = document.createElement(definition.tag);
- var expectedPrototype = Object.getPrototypeOf(inst);
- if (expectedPrototype === definition.prototype) {
- nativePrototype = expectedPrototype;
- }
- }
- var proto = definition.prototype, ancestor;
- while (proto && proto !== nativePrototype) {
- ancestor = Object.getPrototypeOf(proto);
- proto.__proto__ = ancestor;
- proto = ancestor;
- }
- definition.native = nativePrototype;
- }
- }
- function instantiate(definition) {
- return upgradeWithDefinition(domCreateElement(definition.tag), definition);
- }
- var registry = {};
- function getRegisteredDefinition(name) {
- if (name) {
- return registry[name.toLowerCase()];
- }
- }
- function registerDefinition(name, definition) {
- registry[name] = definition;
- }
- function generateConstructor(definition) {
- return function() {
- return instantiate(definition);
- };
- }
- var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
- function createElementNS(namespace, tag, typeExtension) {
- if (namespace === HTML_NAMESPACE) {
- return createElement(tag, typeExtension);
- } else {
- return domCreateElementNS(namespace, tag);
- }
- }
- function createElement(tag, typeExtension) {
- var definition = getRegisteredDefinition(typeExtension || tag);
- if (definition) {
- if (tag == definition.tag && typeExtension == definition.is) {
- return new definition.ctor();
- }
- if (!typeExtension && !definition.is) {
- return new definition.ctor();
- }
- }
- var element;
- if (typeExtension) {
- element = createElement(tag);
- element.setAttribute("is", typeExtension);
- return element;
- }
- element = domCreateElement(tag);
- if (tag.indexOf("-") >= 0) {
- implementPrototype(element, HTMLElement);
- }
- return element;
- }
- function cloneNode(deep) {
- var n = domCloneNode.call(this, deep);
- upgrade(n);
- return n;
- }
- var domCreateElement = document.createElement.bind(document);
- var domCreateElementNS = document.createElementNS.bind(document);
- var domCloneNode = Node.prototype.cloneNode;
- var isInstance;
- if (!Object.__proto__ && !useNative) {
- isInstance = function(obj, ctor) {
- var p = obj;
- while (p) {
- if (p === ctor.prototype) {
- return true;
- }
- p = p.__proto__;
- }
- return false;
- };
- } else {
- isInstance = function(obj, base) {
- return obj instanceof base;
- };
- }
- document.registerElement = register;
- document.createElement = createElement;
- document.createElementNS = createElementNS;
- Node.prototype.cloneNode = cloneNode;
- scope.registry = registry;
- scope.instanceof = isInstance;
- scope.reservedTagList = reservedTagList;
- scope.getRegisteredDefinition = getRegisteredDefinition;
- document.register = document.registerElement;
-});
-
-(function(scope) {
- var useNative = scope.useNative;
- var initializeModules = scope.initializeModules;
- var isIE11OrOlder = /Trident/.test(navigator.userAgent);
- if (useNative) {
- var nop = function() {};
- scope.watchShadow = nop;
- scope.upgrade = nop;
- scope.upgradeAll = nop;
- scope.upgradeDocumentTree = nop;
- scope.upgradeSubtree = nop;
- scope.takeRecords = nop;
- scope.instanceof = function(obj, base) {
- return obj instanceof base;
- };
- } else {
- initializeModules();
- }
- var upgradeDocumentTree = scope.upgradeDocumentTree;
- if (!window.wrap) {
- if (window.ShadowDOMPolyfill) {
- window.wrap = ShadowDOMPolyfill.wrapIfNeeded;
- window.unwrap = ShadowDOMPolyfill.unwrapIfNeeded;
- } else {
- window.wrap = window.unwrap = function(node) {
- return node;
- };
- }
- }
- function bootstrap() {
- upgradeDocumentTree(wrap(document));
- if (window.HTMLImports) {
- HTMLImports.__importsParsingHook = function(elt) {
- upgradeDocumentTree(wrap(elt.import));
- };
- }
- CustomElements.ready = true;
- setTimeout(function() {
- CustomElements.readyTime = Date.now();
- if (window.HTMLImports) {
- CustomElements.elapsed = CustomElements.readyTime - HTMLImports.readyTime;
- }
- document.dispatchEvent(new CustomEvent("WebComponentsReady", {
- bubbles: true
- }));
- });
- }
- if (isIE11OrOlder && typeof window.CustomEvent !== "function") {
- window.CustomEvent = function(inType, params) {
- params = params || {};
- var e = document.createEvent("CustomEvent");
- e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
- return e;
- };
- window.CustomEvent.prototype = window.Event.prototype;
- }
- if (document.readyState === "complete" || scope.flags.eager) {
- bootstrap();
- } else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) {
- bootstrap();
- } else {
- var loadEvent = window.HTMLImports && !HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
- window.addEventListener(loadEvent, bootstrap);
- }
-})(window.CustomElements);
-
-if (typeof HTMLTemplateElement === "undefined") {
- (function() {
- var TEMPLATE_TAG = "template";
- HTMLTemplateElement = function() {};
- HTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);
- HTMLTemplateElement.decorate = function(template) {
- if (!template.content) {
- template.content = template.ownerDocument.createDocumentFragment();
- var child;
- while (child = template.firstChild) {
- template.content.appendChild(child);
- }
- }
- };
- HTMLTemplateElement.bootstrap = function(doc) {
- var templates = doc.querySelectorAll(TEMPLATE_TAG);
- for (var i = 0, l = templates.length, t; i < l && (t = templates[i]); i++) {
- HTMLTemplateElement.decorate(t);
- }
- };
- addEventListener("DOMContentLoaded", function() {
- HTMLTemplateElement.bootstrap(document);
- });
- })();
-}
-
-(function(scope) {
- var style = document.createElement("style");
- style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " } \n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; position: relative;" + " } \n";
- var head = document.querySelector("head");
- head.insertBefore(style, head.firstChild);
-})(window.WebComponents); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents-lite.min.js b/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents-lite.min.js
deleted file mode 100644
index db80a800edf..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents-lite.min.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/**
- * @license
- * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
- */
-// @version 0.5.5
-window.WebComponents=window.WebComponents||{},function(e){var t=e.flags||{},n="webcomponents.js",o=document.querySelector('script[src*="'+n+'"]');if(!t.noOpts){if(location.search.slice(1).split("&").forEach(function(e){e=e.split("="),e[0]&&(t[e[0]]=e[1]||!0)}),o)for(var r,i=0;r=o.attributes[i];i++)"src"!==r.name&&(t[r.name]=r.value||!0);if(t.log){var a=t.log.split(",");t.log={},a.forEach(function(e){t.log[e]=!0})}else t.log={}}t.shadow=t.shadow||t.shadowdom||t.polyfill,t.shadow="native"===t.shadow?!1:t.shadow||!HTMLElement.prototype.createShadowRoot,t.register&&(window.CustomElements=window.CustomElements||{flags:{}},window.CustomElements.flags.register=t.register),e.flags=t}(WebComponents),function(e){function t(e){_.push(e),w||(w=!0,h(o))}function n(e){return window.ShadowDOMPolyfill&&window.ShadowDOMPolyfill.wrapIfNeeded(e)||e}function o(){w=!1;var e=_;_=[],e.sort(function(e,t){return e.uid_-t.uid_});var t=!1;e.forEach(function(e){var n=e.takeRecords();r(e),n.length&&(e.callback_(n,e),t=!0)}),t&&o()}function r(e){e.nodes_.forEach(function(t){var n=v.get(t);n&&n.forEach(function(t){t.observer===e&&t.removeTransientObservers()})})}function i(e,t){for(var n=e;n;n=n.parentNode){var o=v.get(n);if(o)for(var r=0;r<o.length;r++){var i=o[r],a=i.options;if(n===e||a.subtree){var s=t(a);s&&i.enqueue(s)}}}}function a(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++E}function s(e,t){this.type=e,this.target=t,this.addedNodes=[],this.removedNodes=[],this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function d(e){var t=new s(e.type,e.target);return t.addedNodes=e.addedNodes.slice(),t.removedNodes=e.removedNodes.slice(),t.previousSibling=e.previousSibling,t.nextSibling=e.nextSibling,t.attributeName=e.attributeName,t.attributeNamespace=e.attributeNamespace,t.oldValue=e.oldValue,t}function c(e,t){return y=new s(e,t)}function u(e){return L?L:(L=d(y),L.oldValue=e,L)}function l(){y=L=void 0}function f(e){return e===L||e===y}function m(e,t){return e===t?e:L&&f(e)?L:null}function p(e,t,n){this.observer=e,this.target=t,this.options=n,this.transientObservedNodes=[]}var h,v=new WeakMap;if(/Trident|Edge/.test(navigator.userAgent))h=setTimeout;else if(window.setImmediate)h=window.setImmediate;else{var g=[],b=String(Math.random());window.addEventListener("message",function(e){if(e.data===b){var t=g;g=[],t.forEach(function(e){e()})}}),h=function(e){g.push(e),window.postMessage(b,"*")}}var w=!1,_=[],E=0;a.prototype={observe:function(e,t){if(e=n(e),!t.childList&&!t.attributes&&!t.characterData||t.attributeOldValue&&!t.attributes||t.attributeFilter&&t.attributeFilter.length&&!t.attributes||t.characterDataOldValue&&!t.characterData)throw new SyntaxError;var o=v.get(e);o||v.set(e,o=[]);for(var r,i=0;i<o.length;i++)if(o[i].observer===this){r=o[i],r.removeListeners(),r.options=t;break}r||(r=new p(this,e,t),o.push(r),this.nodes_.push(e)),r.addListeners()},disconnect:function(){this.nodes_.forEach(function(e){for(var t=v.get(e),n=0;n<t.length;n++){var o=t[n];if(o.observer===this){o.removeListeners(),t.splice(n,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}};var y,L;p.prototype={enqueue:function(e){var n=this.observer.records_,o=n.length;if(n.length>0){var r=n[o-1],i=m(r,e);if(i)return void(n[o-1]=i)}else t(this.observer);n[o]=e},addListeners:function(){this.addListeners_(this.target)},addListeners_:function(e){var t=this.options;t.attributes&&e.addEventListener("DOMAttrModified",this,!0),t.characterData&&e.addEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.addEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.addEventListener("DOMNodeRemoved",this,!0)},removeListeners:function(){this.removeListeners_(this.target)},removeListeners_:function(e){var t=this.options;t.attributes&&e.removeEventListener("DOMAttrModified",this,!0),t.characterData&&e.removeEventListener("DOMCharacterDataModified",this,!0),t.childList&&e.removeEventListener("DOMNodeInserted",this,!0),(t.childList||t.subtree)&&e.removeEventListener("DOMNodeRemoved",this,!0)},addTransientObserver:function(e){if(e!==this.target){this.addListeners_(e),this.transientObservedNodes.push(e);var t=v.get(e);t||v.set(e,t=[]),t.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[],e.forEach(function(e){this.removeListeners_(e);for(var t=v.get(e),n=0;n<t.length;n++)if(t[n]===this){t.splice(n,1);break}},this)},handleEvent:function(e){switch(e.stopImmediatePropagation(),e.type){case"DOMAttrModified":var t=e.attrName,n=e.relatedNode.namespaceURI,o=e.target,r=new c("attributes",o);r.attributeName=t,r.attributeNamespace=n;var a=e.attrChange===MutationEvent.ADDITION?null:e.prevValue;i(o,function(e){return!e.attributes||e.attributeFilter&&e.attributeFilter.length&&-1===e.attributeFilter.indexOf(t)&&-1===e.attributeFilter.indexOf(n)?void 0:e.attributeOldValue?u(a):r});break;case"DOMCharacterDataModified":var o=e.target,r=c("characterData",o),a=e.prevValue;i(o,function(e){return e.characterData?e.characterDataOldValue?u(a):r:void 0});break;case"DOMNodeRemoved":this.addTransientObserver(e.target);case"DOMNodeInserted":var s,d,f=e.target;"DOMNodeInserted"===e.type?(s=[f],d=[]):(s=[],d=[f]);var m=f.previousSibling,p=f.nextSibling,r=c("childList",e.target.parentNode);r.addedNodes=s,r.removedNodes=d,r.previousSibling=m,r.nextSibling=p,i(e.relatedNode,function(e){return e.childList?r:void 0})}l()}},e.JsMutationObserver=a,e.MutationObserver||(e.MutationObserver=a)}(this),"undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};n.prototype={set:function(t,n){var o=t[this.name];return o&&o[0]===t?o[1]=n:e(t,this.name,{value:[t,n],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=n}(),window.HTMLImports=window.HTMLImports||{flags:{}},function(e){function t(e,t){t=t||p,o(function(){i(e,t)},t)}function n(e){return"complete"===e.readyState||e.readyState===g}function o(e,t){if(n(t))e&&e();else{var r=function(){("complete"===t.readyState||t.readyState===g)&&(t.removeEventListener(b,r),o(e,t))};t.addEventListener(b,r)}}function r(e){e.target.__loaded=!0}function i(e,t){function n(){s==d&&e&&e()}function o(e){r(e),s++,n()}var i=t.querySelectorAll("link[rel=import]"),s=0,d=i.length;if(d)for(var c,u=0;d>u&&(c=i[u]);u++)a(c)?o.call(c,{target:c}):(c.addEventListener("load",o),c.addEventListener("error",o));else n()}function a(e){return l?e.__loaded||e["import"]&&"loading"!==e["import"].readyState:e.__importParsed}function s(e){for(var t,n=0,o=e.length;o>n&&(t=e[n]);n++)d(t)&&c(t)}function d(e){return"link"===e.localName&&"import"===e.rel}function c(e){var t=e["import"];t?r({target:e}):(e.addEventListener("load",r),e.addEventListener("error",r))}var u="import",l=Boolean(u in document.createElement("link")),f=Boolean(window.ShadowDOMPolyfill),m=function(e){return f?ShadowDOMPolyfill.wrapIfNeeded(e):e},p=m(document),h={get:function(){var e=HTMLImports.currentScript||document.currentScript||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null);return m(e)},configurable:!0};Object.defineProperty(document,"_currentScript",h),Object.defineProperty(p,"_currentScript",h);var v=/Trident|Edge/.test(navigator.userAgent),g=v?"complete":"interactive",b="readystatechange";l&&(new MutationObserver(function(e){for(var t,n=0,o=e.length;o>n&&(t=e[n]);n++)t.addedNodes&&s(t.addedNodes)}).observe(document.head,{childList:!0}),function(){if("loading"===document.readyState)for(var e,t=document.querySelectorAll("link[rel=import]"),n=0,o=t.length;o>n&&(e=t[n]);n++)c(e)}()),t(function(){HTMLImports.ready=!0,HTMLImports.readyTime=(new Date).getTime();var e=p.createEvent("CustomEvent");e.initCustomEvent("HTMLImportsLoaded",!0,!0,{}),p.dispatchEvent(e)}),e.IMPORT_LINK_TYPE=u,e.useNative=l,e.rootDocument=p,e.whenReady=t,e.isIE=v}(HTMLImports),function(e){var t=[],n=function(e){t.push(e)},o=function(){t.forEach(function(t){t(e)})};e.addModule=n,e.initializeModules=o}(HTMLImports),HTMLImports.addModule(function(e){var t=/(url\()([^)]*)(\))/g,n=/(@import[\s]+(?!url\())([^;]*)(;)/g,o={resolveUrlsInStyle:function(e){var t=e.ownerDocument,n=t.createElement("a");return e.textContent=this.resolveUrlsInCssText(e.textContent,n),e},resolveUrlsInCssText:function(e,o){var r=this.replaceUrls(e,o,t);return r=this.replaceUrls(r,o,n)},replaceUrls:function(e,t,n){return e.replace(n,function(e,n,o,r){var i=o.replace(/["']/g,"");return t.href=i,i=t.href,n+"'"+i+"'"+r})}};e.path=o}),HTMLImports.addModule(function(e){var t={async:!0,ok:function(e){return e.status>=200&&e.status<300||304===e.status||0===e.status},load:function(n,o,r){var i=new XMLHttpRequest;return(e.flags.debug||e.flags.bust)&&(n+="?"+Math.random()),i.open("GET",n,t.async),i.addEventListener("readystatechange",function(){if(4===i.readyState){var e=i.getResponseHeader("Location"),n=null;if(e)var n="/"===e.substr(0,1)?location.origin+e:e;o.call(r,!t.ok(i)&&i,i.response||i.responseText,n)}}),i.send(),i},loadDocument:function(e,t,n){this.load(e,t,n).responseType="document"}};e.xhr=t}),HTMLImports.addModule(function(e){var t=e.xhr,n=e.flags,o=function(e,t){this.cache={},this.onload=e,this.oncomplete=t,this.inflight=0,this.pending={}};o.prototype={addNodes:function(e){this.inflight+=e.length;for(var t,n=0,o=e.length;o>n&&(t=e[n]);n++)this.require(t);this.checkDone()},addNode:function(e){this.inflight++,this.require(e),this.checkDone()},require:function(e){var t=e.src||e.href;e.__nodeUrl=t,this.dedupe(t,e)||this.fetch(t,e)},dedupe:function(e,t){if(this.pending[e])return this.pending[e].push(t),!0;return this.cache[e]?(this.onload(e,t,this.cache[e]),this.tail(),!0):(this.pending[e]=[t],!1)},fetch:function(e,o){if(n.load&&console.log("fetch",e,o),e)if(e.match(/^data:/)){var r=e.split(","),i=r[0],a=r[1];a=i.indexOf(";base64")>-1?atob(a):decodeURIComponent(a),setTimeout(function(){this.receive(e,o,null,a)}.bind(this),0)}else{var s=function(t,n,r){this.receive(e,o,t,n,r)}.bind(this);t.load(e,s)}else setTimeout(function(){this.receive(e,o,{error:"href must be specified"},null)}.bind(this),0)},receive:function(e,t,n,o,r){this.cache[e]=o;for(var i,a=this.pending[e],s=0,d=a.length;d>s&&(i=a[s]);s++)this.onload(e,i,o,n,r),this.tail();this.pending[e]=null},tail:function(){--this.inflight,this.checkDone()},checkDone:function(){this.inflight||this.oncomplete()}},e.Loader=o}),HTMLImports.addModule(function(e){var t=function(e){this.addCallback=e,this.mo=new MutationObserver(this.handler.bind(this))};t.prototype={handler:function(e){for(var t,n=0,o=e.length;o>n&&(t=e[n]);n++)"childList"===t.type&&t.addedNodes.length&&this.addedNodes(t.addedNodes)},addedNodes:function(e){this.addCallback&&this.addCallback(e);for(var t,n=0,o=e.length;o>n&&(t=e[n]);n++)t.children&&t.children.length&&this.addedNodes(t.children)},observe:function(e){this.mo.observe(e,{childList:!0,subtree:!0})}},e.Observer=t}),HTMLImports.addModule(function(e){function t(e){return"link"===e.localName&&e.rel===u}function n(e){var t=o(e);return"data:text/javascript;charset=utf-8,"+encodeURIComponent(t)}function o(e){return e.textContent+r(e)}function r(e){var t=e.ownerDocument;t.__importedScripts=t.__importedScripts||0;var n=e.ownerDocument.baseURI,o=t.__importedScripts?"-"+t.__importedScripts:"";return t.__importedScripts++,"\n//# sourceURL="+n+o+".js\n"}function i(e){var t=e.ownerDocument.createElement("style");return t.textContent=e.textContent,a.resolveUrlsInStyle(t),t}var a=e.path,s=e.rootDocument,d=e.flags,c=e.isIE,u=e.IMPORT_LINK_TYPE,l="link[rel="+u+"]",f={documentSelectors:l,importsSelectors:[l,"link[rel=stylesheet]","style","script:not([type])",'script[type="text/javascript"]'].join(","),map:{link:"parseLink",script:"parseScript",style:"parseStyle"},dynamicElements:[],parseNext:function(){var e=this.nextToParse();e&&this.parse(e)},parse:function(e){if(this.isParsed(e))return void(d.parse&&console.log("[%s] is already parsed",e.localName));var t=this[this.map[e.localName]];t&&(this.markParsing(e),t.call(this,e))},parseDynamic:function(e,t){this.dynamicElements.push(e),t||this.parseNext()},markParsing:function(e){d.parse&&console.log("parsing",e),this.parsingElement=e},markParsingComplete:function(e){e.__importParsed=!0,this.markDynamicParsingComplete(e),e.__importElement&&(e.__importElement.__importParsed=!0,this.markDynamicParsingComplete(e.__importElement)),this.parsingElement=null,d.parse&&console.log("completed",e)},markDynamicParsingComplete:function(e){var t=this.dynamicElements.indexOf(e);t>=0&&this.dynamicElements.splice(t,1)},parseImport:function(e){if(HTMLImports.__importsParsingHook&&HTMLImports.__importsParsingHook(e),e["import"]&&(e["import"].__importParsed=!0),this.markParsingComplete(e),e.dispatchEvent(e.__resource&&!e.__error?new CustomEvent("load",{bubbles:!1}):new CustomEvent("error",{bubbles:!1})),e.__pending)for(var t;e.__pending.length;)t=e.__pending.shift(),t&&t({target:e});this.parseNext()},parseLink:function(e){t(e)?this.parseImport(e):(e.href=e.href,this.parseGeneric(e))},parseStyle:function(e){var t=e;e=i(e),e.__importElement=t,this.parseGeneric(e)},parseGeneric:function(e){this.trackElement(e),this.addElementToDocument(e)},rootImportForElement:function(e){for(var t=e;t.ownerDocument.__importLink;)t=t.ownerDocument.__importLink;return t},addElementToDocument:function(e){var t=this.rootImportForElement(e.__importElement||e);t.parentNode.insertBefore(e,t)},trackElement:function(e,t){var n=this,o=function(o){t&&t(o),n.markParsingComplete(e),n.parseNext()};if(e.addEventListener("load",o),e.addEventListener("error",o),c&&"style"===e.localName){var r=!1;if(-1==e.textContent.indexOf("@import"))r=!0;else if(e.sheet){r=!0;for(var i,a=e.sheet.cssRules,s=a?a.length:0,d=0;s>d&&(i=a[d]);d++)i.type===CSSRule.IMPORT_RULE&&(r=r&&Boolean(i.styleSheet))}r&&e.dispatchEvent(new CustomEvent("load",{bubbles:!1}))}},parseScript:function(t){var o=document.createElement("script");o.__importElement=t,o.src=t.src?t.src:n(t),e.currentScript=t,this.trackElement(o,function(){o.parentNode.removeChild(o),e.currentScript=null}),this.addElementToDocument(o)},nextToParse:function(){return this._mayParse=[],!this.parsingElement&&(this.nextToParseInDoc(s)||this.nextToParseDynamic())},nextToParseInDoc:function(e,n){if(e&&this._mayParse.indexOf(e)<0){this._mayParse.push(e);for(var o,r=e.querySelectorAll(this.parseSelectorsForNode(e)),i=0,a=r.length;a>i&&(o=r[i]);i++)if(!this.isParsed(o))return this.hasResource(o)?t(o)?this.nextToParseInDoc(o["import"],o):o:void 0}return n},nextToParseDynamic:function(){return this.dynamicElements[0]},parseSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===s?this.documentSelectors:this.importsSelectors},isParsed:function(e){return e.__importParsed},needsDynamicParsing:function(e){return this.dynamicElements.indexOf(e)>=0},hasResource:function(e){return t(e)&&void 0===e["import"]?!1:!0}};e.parser=f,e.IMPORT_SELECTOR=l}),HTMLImports.addModule(function(e){function t(e){return n(e,a)}function n(e,t){return"link"===e.localName&&e.getAttribute("rel")===t}function o(e){return!!Object.getOwnPropertyDescriptor(e,"baseURI")}function r(e,t){var n=document.implementation.createHTMLDocument(a);n._URL=t;var r=n.createElement("base");r.setAttribute("href",t),n.baseURI||o(n)||Object.defineProperty(n,"baseURI",{value:t});var i=n.createElement("meta");return i.setAttribute("charset","utf-8"),n.head.appendChild(i),n.head.appendChild(r),n.body.innerHTML=e,window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(n),n}var i=e.flags,a=e.IMPORT_LINK_TYPE,s=e.IMPORT_SELECTOR,d=e.rootDocument,c=e.Loader,u=e.Observer,l=e.parser,f={documents:{},documentPreloadSelectors:s,importsPreloadSelectors:[s].join(","),loadNode:function(e){m.addNode(e)},loadSubtree:function(e){var t=this.marshalNodes(e);m.addNodes(t)},marshalNodes:function(e){return e.querySelectorAll(this.loadSelectorsForNode(e))},loadSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===d?this.documentPreloadSelectors:this.importsPreloadSelectors},loaded:function(e,n,o,a,s){if(i.load&&console.log("loaded",e,n),n.__resource=o,n.__error=a,t(n)){var d=this.documents[e];void 0===d&&(d=a?null:r(o,s||e),d&&(d.__importLink=n,this.bootDocument(d)),this.documents[e]=d),n["import"]=d}l.parseNext()},bootDocument:function(e){this.loadSubtree(e),this.observer.observe(e),l.parseNext()},loadedAll:function(){l.parseNext()}},m=new c(f.loaded.bind(f),f.loadedAll.bind(f));if(f.observer=new u,!document.baseURI){var p={get:function(){var e=document.querySelector("base");return e?e.href:window.location.href},configurable:!0};Object.defineProperty(document,"baseURI",p),Object.defineProperty(d,"baseURI",p)}e.importer=f,e.importLoader=m}),HTMLImports.addModule(function(e){var t=e.parser,n=e.importer,o={added:function(e){for(var o,r,i,a,s=0,d=e.length;d>s&&(a=e[s]);s++)o||(o=a.ownerDocument,r=t.isParsed(o)),i=this.shouldLoadNode(a),i&&n.loadNode(a),this.shouldParseNode(a)&&r&&t.parseDynamic(a,i)},shouldLoadNode:function(e){return 1===e.nodeType&&r.call(e,n.loadSelectorsForNode(e))},shouldParseNode:function(e){return 1===e.nodeType&&r.call(e,t.parseSelectorsForNode(e))}};n.observer.addCallback=o.added.bind(o);var r=HTMLElement.prototype.matches||HTMLElement.prototype.matchesSelector||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector}),function(e){function t(){HTMLImports.importer.bootDocument(r)}var n=e.initializeModules,o=e.isIE;if(!e.useNative){o&&"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e,t){t=t||{};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),n},window.CustomEvent.prototype=window.Event.prototype),n();var r=e.rootDocument;"complete"===document.readyState||"interactive"===document.readyState&&!window.attachEvent?t():document.addEventListener("DOMContentLoaded",t)}}(HTMLImports),window.CustomElements=window.CustomElements||{flags:{}},function(e){var t=e.flags,n=[],o=function(e){n.push(e)},r=function(){n.forEach(function(t){t(e)})};e.addModule=o,e.initializeModules=r,e.hasNative=Boolean(document.registerElement),e.useNative=!t.register&&e.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||HTMLImports.useNative)}(CustomElements),CustomElements.addModule(function(e){function t(e,t){n(e,function(e){return t(e)?!0:void o(e,t)}),o(e,t)}function n(e,t,o){var r=e.firstElementChild;if(!r)for(r=e.firstChild;r&&r.nodeType!==Node.ELEMENT_NODE;)r=r.nextSibling;for(;r;)t(r,o)!==!0&&n(r,t,o),r=r.nextElementSibling;return null}function o(e,n){for(var o=e.shadowRoot;o;)t(o,n),o=o.olderShadowRoot}function r(e,t){a=[],i(e,t),a=null}function i(e,t){if(e=wrap(e),!(a.indexOf(e)>=0)){a.push(e);for(var n,o=e.querySelectorAll("link[rel="+s+"]"),r=0,d=o.length;d>r&&(n=o[r]);r++)n["import"]&&i(n["import"],t);t(e)}}var a,s=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none";e.forDocumentTree=r,e.forSubtree=t}),CustomElements.addModule(function(e){function t(e){return n(e)||o(e)}function n(t){return e.upgrade(t)?!0:void s(t)}function o(e){_(e,function(e){return n(e)?!0:void 0})}function r(e){s(e),f(e)&&_(e,function(e){s(e)})}function i(e){M.push(e),L||(L=!0,setTimeout(a))}function a(){L=!1;for(var e,t=M,n=0,o=t.length;o>n&&(e=t[n]);n++)e();M=[]}function s(e){y?i(function(){d(e)}):d(e)}function d(e){e.__upgraded__&&(e.attachedCallback||e.detachedCallback)&&!e.__attached&&f(e)&&(e.__attached=!0,e.attachedCallback&&e.attachedCallback())}function c(e){u(e),_(e,function(e){u(e)})}function u(e){y?i(function(){l(e)}):l(e)}function l(e){e.__upgraded__&&(e.attachedCallback||e.detachedCallback)&&e.__attached&&!f(e)&&(e.__attached=!1,e.detachedCallback&&e.detachedCallback())}function f(e){for(var t=e,n=wrap(document);t;){if(t==n)return!0;t=t.parentNode||t.host}}function m(e){if(e.shadowRoot&&!e.shadowRoot.__watched){w.dom&&console.log("watching shadow-root for: ",e.localName);for(var t=e.shadowRoot;t;)v(t),t=t.olderShadowRoot}}function p(e){if(w.dom){var n=e[0];if(n&&"childList"===n.type&&n.addedNodes&&n.addedNodes){for(var o=n.addedNodes[0];o&&o!==document&&!o.host;)o=o.parentNode;var r=o&&(o.URL||o._URL||o.host&&o.host.localName)||"";r=r.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",e.length,r||"")}e.forEach(function(e){"childList"===e.type&&(T(e.addedNodes,function(e){e.localName&&t(e)}),T(e.removedNodes,function(e){e.localName&&c(e)}))}),w.dom&&console.groupEnd()}function h(e){for(e=wrap(e),e||(e=wrap(document));e.parentNode;)e=e.parentNode;var t=e.__observer;t&&(p(t.takeRecords()),a())}function v(e){if(!e.__observer){var t=new MutationObserver(p);t.observe(e,{childList:!0,subtree:!0}),e.__observer=t}}function g(e){e=wrap(e),w.dom&&console.group("upgradeDocument: ",e.baseURI.split("/").pop()),t(e),v(e),w.dom&&console.groupEnd()}function b(e){E(e,g)}var w=e.flags,_=e.forSubtree,E=e.forDocumentTree,y=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;e.hasPolyfillMutations=y;var L=!1,M=[],T=Array.prototype.forEach.call.bind(Array.prototype.forEach),N=Element.prototype.createShadowRoot;N&&(Element.prototype.createShadowRoot=function(){var e=N.call(this);return CustomElements.watchShadow(this),e}),e.watchShadow=m,e.upgradeDocumentTree=b,e.upgradeSubtree=o,e.upgradeAll=t,e.attachedNode=r,e.takeRecords=h}),CustomElements.addModule(function(e){function t(t){if(!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var o=t.getAttribute("is"),r=e.getRegisteredDefinition(o||t.localName);if(r){if(o&&r.tag==t.localName)return n(t,r);if(!o&&!r["extends"])return n(t,r)}}}function n(t,n){return a.upgrade&&console.group("upgrade:",t.localName),n.is&&t.setAttribute("is",n.is),o(t,n),t.__upgraded__=!0,i(t),e.attachedNode(t),e.upgradeSubtree(t),a.upgrade&&console.groupEnd(),t}function o(e,t){Object.__proto__?e.__proto__=t.prototype:(r(e,t.prototype,t["native"]),e.__proto__=t.prototype)}function r(e,t,n){for(var o={},r=t;r!==n&&r!==HTMLElement.prototype;){for(var i,a=Object.getOwnPropertyNames(r),s=0;i=a[s];s++)o[i]||(Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(r,i)),o[i]=1);r=Object.getPrototypeOf(r)}}function i(e){e.createdCallback&&e.createdCallback()}var a=e.flags;e.upgrade=t,e.upgradeWithDefinition=n,e.implementPrototype=o}),CustomElements.addModule(function(e){function t(t,o){var d=o||{};if(!t)throw new Error("document.registerElement: first argument `name` must not be empty");if(t.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(t)+"'.");if(r(t))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(t)+"'. The type name is invalid.");if(c(t))throw new Error("DuplicateDefinitionError: a type with name '"+String(t)+"' is already registered");return d.prototype||(d.prototype=Object.create(HTMLElement.prototype)),d.__name=t.toLowerCase(),d.lifecycle=d.lifecycle||{},d.ancestry=i(d["extends"]),a(d),s(d),n(d.prototype),u(d.__name,d),d.ctor=l(d),d.ctor.prototype=d.prototype,d.prototype.constructor=d.ctor,e.ready&&v(document),d.ctor}function n(e){if(!e.setAttribute._polyfilled){var t=e.setAttribute;e.setAttribute=function(e,n){o.call(this,e,n,t)};var n=e.removeAttribute;e.removeAttribute=function(e){o.call(this,e,null,n)},e.setAttribute._polyfilled=!0}}function o(e,t,n){e=e.toLowerCase();var o=this.getAttribute(e);n.apply(this,arguments);var r=this.getAttribute(e);this.attributeChangedCallback&&r!==o&&this.attributeChangedCallback(e,o,r)}function r(e){for(var t=0;t<E.length;t++)if(e===E[t])return!0}function i(e){var t=c(e);return t?i(t["extends"]).concat([t]):[]}function a(e){for(var t,n=e["extends"],o=0;t=e.ancestry[o];o++)n=t.is&&t.tag;e.tag=n||e.__name,n&&(e.is=e.__name)}function s(e){if(!Object.__proto__){var t=HTMLElement.prototype;if(e.is){var n=document.createElement(e.tag),o=Object.getPrototypeOf(n);o===e.prototype&&(t=o)}for(var r,i=e.prototype;i&&i!==t;)r=Object.getPrototypeOf(i),i.__proto__=r,i=r;e["native"]=t}}function d(e){return b(M(e.tag),e)}function c(e){return e?y[e.toLowerCase()]:void 0}function u(e,t){y[e]=t}function l(e){return function(){return d(e)}}function f(e,t,n){return e===L?m(t,n):T(e,t)}function m(e,t){var n=c(t||e);if(n){if(e==n.tag&&t==n.is)return new n.ctor;if(!t&&!n.is)return new n.ctor}var o;return t?(o=m(e),o.setAttribute("is",t),o):(o=M(e),e.indexOf("-")>=0&&w(o,HTMLElement),o)}function p(e){var t=N.call(this,e);return g(t),t}var h,v=e.upgradeDocumentTree,g=e.upgrade,b=e.upgradeWithDefinition,w=e.implementPrototype,_=e.useNative,E=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],y={},L="http://www.w3.org/1999/xhtml",M=document.createElement.bind(document),T=document.createElementNS.bind(document),N=Node.prototype.cloneNode;h=Object.__proto__||_?function(e,t){return e instanceof t}:function(e,t){for(var n=e;n;){if(n===t.prototype)return!0;n=n.__proto__}return!1},document.registerElement=t,document.createElement=m,document.createElementNS=f,Node.prototype.cloneNode=p,e.registry=y,e["instanceof"]=h,e.reservedTagList=E,e.getRegisteredDefinition=c,document.register=document.registerElement}),function(e){function t(){a(wrap(document)),window.HTMLImports&&(HTMLImports.__importsParsingHook=function(e){a(wrap(e["import"]))}),CustomElements.ready=!0,setTimeout(function(){CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}var n=e.useNative,o=e.initializeModules,r=/Trident/.test(navigator.userAgent);if(n){var i=function(){};e.watchShadow=i,e.upgrade=i,e.upgradeAll=i,e.upgradeDocumentTree=i,e.upgradeSubtree=i,e.takeRecords=i,e["instanceof"]=function(e,t){return e instanceof t}}else o();var a=e.upgradeDocumentTree;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){return e}),r&&"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e,t){t=t||{};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),n},window.CustomEvent.prototype=window.Event.prototype),"complete"===document.readyState||e.flags.eager)t();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var s=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(s,t)}else t()}(window.CustomElements),"undefined"==typeof HTMLTemplateElement&&!function(){var e="template";HTMLTemplateElement=function(){},HTMLTemplateElement.prototype=Object.create(HTMLElement.prototype),HTMLTemplateElement.decorate=function(e){if(!e.content){e.content=e.ownerDocument.createDocumentFragment();for(var t;t=e.firstChild;)e.content.appendChild(t)}},HTMLTemplateElement.bootstrap=function(t){for(var n,o=t.querySelectorAll(e),r=0,i=o.length;i>r&&(n=o[r]);r++)HTMLTemplateElement.decorate(n)},addEventListener("DOMContentLoaded",function(){HTMLTemplateElement.bootstrap(document)})}(),function(){var e=document.createElement("style");e.textContent="body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } \n";var t=document.querySelector("head");t.insertBefore(e,t.firstChild)}(window.WebComponents); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents.js b/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents.js
deleted file mode 100644
index 26f5d5bf6cc..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents.js
+++ /dev/null
@@ -1,6114 +0,0 @@
-/**
- * @license
- * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
- */
-// @version 0.5.5
-window.WebComponents = window.WebComponents || {};
-
-(function(scope) {
- var flags = scope.flags || {};
- var file = "webcomponents.js";
- var script = document.querySelector('script[src*="' + file + '"]');
- if (!flags.noOpts) {
- location.search.slice(1).split("&").forEach(function(o) {
- o = o.split("=");
- o[0] && (flags[o[0]] = o[1] || true);
- });
- if (script) {
- for (var i = 0, a; a = script.attributes[i]; i++) {
- if (a.name !== "src") {
- flags[a.name] = a.value || true;
- }
- }
- }
- if (flags.log) {
- var parts = flags.log.split(",");
- flags.log = {};
- parts.forEach(function(f) {
- flags.log[f] = true;
- });
- } else {
- flags.log = {};
- }
- }
- flags.shadow = flags.shadow || flags.shadowdom || flags.polyfill;
- if (flags.shadow === "native") {
- flags.shadow = false;
- } else {
- flags.shadow = flags.shadow || !HTMLElement.prototype.createShadowRoot;
- }
- if (flags.register) {
- window.CustomElements = window.CustomElements || {
- flags: {}
- };
- window.CustomElements.flags.register = flags.register;
- }
- scope.flags = flags;
-})(WebComponents);
-
-if (WebComponents.flags.shadow) {
- if (typeof WeakMap === "undefined") {
- (function() {
- var defineProperty = Object.defineProperty;
- var counter = Date.now() % 1e9;
- var WeakMap = function() {
- this.name = "__st" + (Math.random() * 1e9 >>> 0) + (counter++ + "__");
- };
- WeakMap.prototype = {
- set: function(key, value) {
- var entry = key[this.name];
- if (entry && entry[0] === key) entry[1] = value; else defineProperty(key, this.name, {
- value: [ key, value ],
- writable: true
- });
- return this;
- },
- get: function(key) {
- var entry;
- return (entry = key[this.name]) && entry[0] === key ? entry[1] : undefined;
- },
- "delete": function(key) {
- var entry = key[this.name];
- if (!entry || entry[0] !== key) return false;
- entry[0] = entry[1] = undefined;
- return true;
- },
- has: function(key) {
- var entry = key[this.name];
- if (!entry) return false;
- return entry[0] === key;
- }
- };
- window.WeakMap = WeakMap;
- })();
- }
- window.ShadowDOMPolyfill = {};
- (function(scope) {
- "use strict";
- var constructorTable = new WeakMap();
- var nativePrototypeTable = new WeakMap();
- var wrappers = Object.create(null);
- function detectEval() {
- if (typeof chrome !== "undefined" && chrome.app && chrome.app.runtime) {
- return false;
- }
- if (navigator.getDeviceStorage) {
- return false;
- }
- try {
- var f = new Function("return true;");
- return f();
- } catch (ex) {
- return false;
- }
- }
- var hasEval = detectEval();
- function assert(b) {
- if (!b) throw new Error("Assertion failed");
- }
- var defineProperty = Object.defineProperty;
- var getOwnPropertyNames = Object.getOwnPropertyNames;
- var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- function mixin(to, from) {
- var names = getOwnPropertyNames(from);
- for (var i = 0; i < names.length; i++) {
- var name = names[i];
- defineProperty(to, name, getOwnPropertyDescriptor(from, name));
- }
- return to;
- }
- function mixinStatics(to, from) {
- var names = getOwnPropertyNames(from);
- for (var i = 0; i < names.length; i++) {
- var name = names[i];
- switch (name) {
- case "arguments":
- case "caller":
- case "length":
- case "name":
- case "prototype":
- case "toString":
- continue;
- }
- defineProperty(to, name, getOwnPropertyDescriptor(from, name));
- }
- return to;
- }
- function oneOf(object, propertyNames) {
- for (var i = 0; i < propertyNames.length; i++) {
- if (propertyNames[i] in object) return propertyNames[i];
- }
- }
- var nonEnumerableDataDescriptor = {
- value: undefined,
- configurable: true,
- enumerable: false,
- writable: true
- };
- function defineNonEnumerableDataProperty(object, name, value) {
- nonEnumerableDataDescriptor.value = value;
- defineProperty(object, name, nonEnumerableDataDescriptor);
- }
- getOwnPropertyNames(window);
- function getWrapperConstructor(node) {
- var nativePrototype = node.__proto__ || Object.getPrototypeOf(node);
- if (isFirefox) {
- try {
- getOwnPropertyNames(nativePrototype);
- } catch (error) {
- nativePrototype = nativePrototype.__proto__;
- }
- }
- var wrapperConstructor = constructorTable.get(nativePrototype);
- if (wrapperConstructor) return wrapperConstructor;
- var parentWrapperConstructor = getWrapperConstructor(nativePrototype);
- var GeneratedWrapper = createWrapperConstructor(parentWrapperConstructor);
- registerInternal(nativePrototype, GeneratedWrapper, node);
- return GeneratedWrapper;
- }
- function addForwardingProperties(nativePrototype, wrapperPrototype) {
- installProperty(nativePrototype, wrapperPrototype, true);
- }
- function registerInstanceProperties(wrapperPrototype, instanceObject) {
- installProperty(instanceObject, wrapperPrototype, false);
- }
- var isFirefox = /Firefox/.test(navigator.userAgent);
- var dummyDescriptor = {
- get: function() {},
- set: function(v) {},
- configurable: true,
- enumerable: true
- };
- function isEventHandlerName(name) {
- return /^on[a-z]+$/.test(name);
- }
- function isIdentifierName(name) {
- return /^\w[a-zA-Z_0-9]*$/.test(name);
- }
- function getGetter(name) {
- return hasEval && isIdentifierName(name) ? new Function("return this.__impl4cf1e782hg__." + name) : function() {
- return this.__impl4cf1e782hg__[name];
- };
- }
- function getSetter(name) {
- return hasEval && isIdentifierName(name) ? new Function("v", "this.__impl4cf1e782hg__." + name + " = v") : function(v) {
- this.__impl4cf1e782hg__[name] = v;
- };
- }
- function getMethod(name) {
- return hasEval && isIdentifierName(name) ? new Function("return this.__impl4cf1e782hg__." + name + ".apply(this.__impl4cf1e782hg__, arguments)") : function() {
- return this.__impl4cf1e782hg__[name].apply(this.__impl4cf1e782hg__, arguments);
- };
- }
- function getDescriptor(source, name) {
- try {
- return Object.getOwnPropertyDescriptor(source, name);
- } catch (ex) {
- return dummyDescriptor;
- }
- }
- var isBrokenSafari = function() {
- var descr = Object.getOwnPropertyDescriptor(Node.prototype, "nodeType");
- return descr && !descr.get && !descr.set;
- }();
- function installProperty(source, target, allowMethod, opt_blacklist) {
- var names = getOwnPropertyNames(source);
- for (var i = 0; i < names.length; i++) {
- var name = names[i];
- if (name === "polymerBlackList_") continue;
- if (name in target) continue;
- if (source.polymerBlackList_ && source.polymerBlackList_[name]) continue;
- if (isFirefox) {
- source.__lookupGetter__(name);
- }
- var descriptor = getDescriptor(source, name);
- var getter, setter;
- if (allowMethod && typeof descriptor.value === "function") {
- target[name] = getMethod(name);
- continue;
- }
- var isEvent = isEventHandlerName(name);
- if (isEvent) getter = scope.getEventHandlerGetter(name); else getter = getGetter(name);
- if (descriptor.writable || descriptor.set || isBrokenSafari) {
- if (isEvent) setter = scope.getEventHandlerSetter(name); else setter = getSetter(name);
- }
- var configurable = isBrokenSafari || descriptor.configurable;
- defineProperty(target, name, {
- get: getter,
- set: setter,
- configurable: configurable,
- enumerable: descriptor.enumerable
- });
- }
- }
- function register(nativeConstructor, wrapperConstructor, opt_instance) {
- var nativePrototype = nativeConstructor.prototype;
- registerInternal(nativePrototype, wrapperConstructor, opt_instance);
- mixinStatics(wrapperConstructor, nativeConstructor);
- }
- function registerInternal(nativePrototype, wrapperConstructor, opt_instance) {
- var wrapperPrototype = wrapperConstructor.prototype;
- assert(constructorTable.get(nativePrototype) === undefined);
- constructorTable.set(nativePrototype, wrapperConstructor);
- nativePrototypeTable.set(wrapperPrototype, nativePrototype);
- addForwardingProperties(nativePrototype, wrapperPrototype);
- if (opt_instance) registerInstanceProperties(wrapperPrototype, opt_instance);
- defineNonEnumerableDataProperty(wrapperPrototype, "constructor", wrapperConstructor);
- wrapperConstructor.prototype = wrapperPrototype;
- }
- function isWrapperFor(wrapperConstructor, nativeConstructor) {
- return constructorTable.get(nativeConstructor.prototype) === wrapperConstructor;
- }
- function registerObject(object) {
- var nativePrototype = Object.getPrototypeOf(object);
- var superWrapperConstructor = getWrapperConstructor(nativePrototype);
- var GeneratedWrapper = createWrapperConstructor(superWrapperConstructor);
- registerInternal(nativePrototype, GeneratedWrapper, object);
- return GeneratedWrapper;
- }
- function createWrapperConstructor(superWrapperConstructor) {
- function GeneratedWrapper(node) {
- superWrapperConstructor.call(this, node);
- }
- var p = Object.create(superWrapperConstructor.prototype);
- p.constructor = GeneratedWrapper;
- GeneratedWrapper.prototype = p;
- return GeneratedWrapper;
- }
- function isWrapper(object) {
- return object && object.__impl4cf1e782hg__;
- }
- function isNative(object) {
- return !isWrapper(object);
- }
- function wrap(impl) {
- if (impl === null) return null;
- assert(isNative(impl));
- return impl.__wrapper8e3dd93a60__ || (impl.__wrapper8e3dd93a60__ = new (getWrapperConstructor(impl))(impl));
- }
- function unwrap(wrapper) {
- if (wrapper === null) return null;
- assert(isWrapper(wrapper));
- return wrapper.__impl4cf1e782hg__;
- }
- function unsafeUnwrap(wrapper) {
- return wrapper.__impl4cf1e782hg__;
- }
- function setWrapper(impl, wrapper) {
- wrapper.__impl4cf1e782hg__ = impl;
- impl.__wrapper8e3dd93a60__ = wrapper;
- }
- function unwrapIfNeeded(object) {
- return object && isWrapper(object) ? unwrap(object) : object;
- }
- function wrapIfNeeded(object) {
- return object && !isWrapper(object) ? wrap(object) : object;
- }
- function rewrap(node, wrapper) {
- if (wrapper === null) return;
- assert(isNative(node));
- assert(wrapper === undefined || isWrapper(wrapper));
- node.__wrapper8e3dd93a60__ = wrapper;
- }
- var getterDescriptor = {
- get: undefined,
- configurable: true,
- enumerable: true
- };
- function defineGetter(constructor, name, getter) {
- getterDescriptor.get = getter;
- defineProperty(constructor.prototype, name, getterDescriptor);
- }
- function defineWrapGetter(constructor, name) {
- defineGetter(constructor, name, function() {
- return wrap(this.__impl4cf1e782hg__[name]);
- });
- }
- function forwardMethodsToWrapper(constructors, names) {
- constructors.forEach(function(constructor) {
- names.forEach(function(name) {
- constructor.prototype[name] = function() {
- var w = wrapIfNeeded(this);
- return w[name].apply(w, arguments);
- };
- });
- });
- }
- scope.assert = assert;
- scope.constructorTable = constructorTable;
- scope.defineGetter = defineGetter;
- scope.defineWrapGetter = defineWrapGetter;
- scope.forwardMethodsToWrapper = forwardMethodsToWrapper;
- scope.isWrapper = isWrapper;
- scope.isWrapperFor = isWrapperFor;
- scope.mixin = mixin;
- scope.nativePrototypeTable = nativePrototypeTable;
- scope.oneOf = oneOf;
- scope.registerObject = registerObject;
- scope.registerWrapper = register;
- scope.rewrap = rewrap;
- scope.setWrapper = setWrapper;
- scope.unsafeUnwrap = unsafeUnwrap;
- scope.unwrap = unwrap;
- scope.unwrapIfNeeded = unwrapIfNeeded;
- scope.wrap = wrap;
- scope.wrapIfNeeded = wrapIfNeeded;
- scope.wrappers = wrappers;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- function newSplice(index, removed, addedCount) {
- return {
- index: index,
- removed: removed,
- addedCount: addedCount
- };
- }
- var EDIT_LEAVE = 0;
- var EDIT_UPDATE = 1;
- var EDIT_ADD = 2;
- var EDIT_DELETE = 3;
- function ArraySplice() {}
- ArraySplice.prototype = {
- calcEditDistances: function(current, currentStart, currentEnd, old, oldStart, oldEnd) {
- var rowCount = oldEnd - oldStart + 1;
- var columnCount = currentEnd - currentStart + 1;
- var distances = new Array(rowCount);
- for (var i = 0; i < rowCount; i++) {
- distances[i] = new Array(columnCount);
- distances[i][0] = i;
- }
- for (var j = 0; j < columnCount; j++) distances[0][j] = j;
- for (var i = 1; i < rowCount; i++) {
- for (var j = 1; j < columnCount; j++) {
- if (this.equals(current[currentStart + j - 1], old[oldStart + i - 1])) distances[i][j] = distances[i - 1][j - 1]; else {
- var north = distances[i - 1][j] + 1;
- var west = distances[i][j - 1] + 1;
- distances[i][j] = north < west ? north : west;
- }
- }
- }
- return distances;
- },
- spliceOperationsFromEditDistances: function(distances) {
- var i = distances.length - 1;
- var j = distances[0].length - 1;
- var current = distances[i][j];
- var edits = [];
- while (i > 0 || j > 0) {
- if (i == 0) {
- edits.push(EDIT_ADD);
- j--;
- continue;
- }
- if (j == 0) {
- edits.push(EDIT_DELETE);
- i--;
- continue;
- }
- var northWest = distances[i - 1][j - 1];
- var west = distances[i - 1][j];
- var north = distances[i][j - 1];
- var min;
- if (west < north) min = west < northWest ? west : northWest; else min = north < northWest ? north : northWest;
- if (min == northWest) {
- if (northWest == current) {
- edits.push(EDIT_LEAVE);
- } else {
- edits.push(EDIT_UPDATE);
- current = northWest;
- }
- i--;
- j--;
- } else if (min == west) {
- edits.push(EDIT_DELETE);
- i--;
- current = west;
- } else {
- edits.push(EDIT_ADD);
- j--;
- current = north;
- }
- }
- edits.reverse();
- return edits;
- },
- calcSplices: function(current, currentStart, currentEnd, old, oldStart, oldEnd) {
- var prefixCount = 0;
- var suffixCount = 0;
- var minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
- if (currentStart == 0 && oldStart == 0) prefixCount = this.sharedPrefix(current, old, minLength);
- if (currentEnd == current.length && oldEnd == old.length) suffixCount = this.sharedSuffix(current, old, minLength - prefixCount);
- currentStart += prefixCount;
- oldStart += prefixCount;
- currentEnd -= suffixCount;
- oldEnd -= suffixCount;
- if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0) return [];
- if (currentStart == currentEnd) {
- var splice = newSplice(currentStart, [], 0);
- while (oldStart < oldEnd) splice.removed.push(old[oldStart++]);
- return [ splice ];
- } else if (oldStart == oldEnd) return [ newSplice(currentStart, [], currentEnd - currentStart) ];
- var ops = this.spliceOperationsFromEditDistances(this.calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd));
- var splice = undefined;
- var splices = [];
- var index = currentStart;
- var oldIndex = oldStart;
- for (var i = 0; i < ops.length; i++) {
- switch (ops[i]) {
- case EDIT_LEAVE:
- if (splice) {
- splices.push(splice);
- splice = undefined;
- }
- index++;
- oldIndex++;
- break;
-
- case EDIT_UPDATE:
- if (!splice) splice = newSplice(index, [], 0);
- splice.addedCount++;
- index++;
- splice.removed.push(old[oldIndex]);
- oldIndex++;
- break;
-
- case EDIT_ADD:
- if (!splice) splice = newSplice(index, [], 0);
- splice.addedCount++;
- index++;
- break;
-
- case EDIT_DELETE:
- if (!splice) splice = newSplice(index, [], 0);
- splice.removed.push(old[oldIndex]);
- oldIndex++;
- break;
- }
- }
- if (splice) {
- splices.push(splice);
- }
- return splices;
- },
- sharedPrefix: function(current, old, searchLength) {
- for (var i = 0; i < searchLength; i++) if (!this.equals(current[i], old[i])) return i;
- return searchLength;
- },
- sharedSuffix: function(current, old, searchLength) {
- var index1 = current.length;
- var index2 = old.length;
- var count = 0;
- while (count < searchLength && this.equals(current[--index1], old[--index2])) count++;
- return count;
- },
- calculateSplices: function(current, previous) {
- return this.calcSplices(current, 0, current.length, previous, 0, previous.length);
- },
- equals: function(currentValue, previousValue) {
- return currentValue === previousValue;
- }
- };
- scope.ArraySplice = ArraySplice;
- })(window.ShadowDOMPolyfill);
- (function(context) {
- "use strict";
- var OriginalMutationObserver = window.MutationObserver;
- var callbacks = [];
- var pending = false;
- var timerFunc;
- function handle() {
- pending = false;
- var copies = callbacks.slice(0);
- callbacks = [];
- for (var i = 0; i < copies.length; i++) {
- (0, copies[i])();
- }
- }
- if (OriginalMutationObserver) {
- var counter = 1;
- var observer = new OriginalMutationObserver(handle);
- var textNode = document.createTextNode(counter);
- observer.observe(textNode, {
- characterData: true
- });
- timerFunc = function() {
- counter = (counter + 1) % 2;
- textNode.data = counter;
- };
- } else {
- timerFunc = window.setTimeout;
- }
- function setEndOfMicrotask(func) {
- callbacks.push(func);
- if (pending) return;
- pending = true;
- timerFunc(handle, 0);
- }
- context.setEndOfMicrotask = setEndOfMicrotask;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var setEndOfMicrotask = scope.setEndOfMicrotask;
- var wrapIfNeeded = scope.wrapIfNeeded;
- var wrappers = scope.wrappers;
- var registrationsTable = new WeakMap();
- var globalMutationObservers = [];
- var isScheduled = false;
- function scheduleCallback(observer) {
- if (observer.scheduled_) return;
- observer.scheduled_ = true;
- globalMutationObservers.push(observer);
- if (isScheduled) return;
- setEndOfMicrotask(notifyObservers);
- isScheduled = true;
- }
- function notifyObservers() {
- isScheduled = false;
- while (globalMutationObservers.length) {
- var notifyList = globalMutationObservers;
- globalMutationObservers = [];
- notifyList.sort(function(x, y) {
- return x.uid_ - y.uid_;
- });
- for (var i = 0; i < notifyList.length; i++) {
- var mo = notifyList[i];
- mo.scheduled_ = false;
- var queue = mo.takeRecords();
- removeTransientObserversFor(mo);
- if (queue.length) {
- mo.callback_(queue, mo);
- }
- }
- }
- }
- function MutationRecord(type, target) {
- this.type = type;
- this.target = target;
- this.addedNodes = new wrappers.NodeList();
- this.removedNodes = new wrappers.NodeList();
- this.previousSibling = null;
- this.nextSibling = null;
- this.attributeName = null;
- this.attributeNamespace = null;
- this.oldValue = null;
- }
- function registerTransientObservers(ancestor, node) {
- for (;ancestor; ancestor = ancestor.parentNode) {
- var registrations = registrationsTable.get(ancestor);
- if (!registrations) continue;
- for (var i = 0; i < registrations.length; i++) {
- var registration = registrations[i];
- if (registration.options.subtree) registration.addTransientObserver(node);
- }
- }
- }
- function removeTransientObserversFor(observer) {
- for (var i = 0; i < observer.nodes_.length; i++) {
- var node = observer.nodes_[i];
- var registrations = registrationsTable.get(node);
- if (!registrations) return;
- for (var j = 0; j < registrations.length; j++) {
- var registration = registrations[j];
- if (registration.observer === observer) registration.removeTransientObservers();
- }
- }
- }
- function enqueueMutation(target, type, data) {
- var interestedObservers = Object.create(null);
- var associatedStrings = Object.create(null);
- for (var node = target; node; node = node.parentNode) {
- var registrations = registrationsTable.get(node);
- if (!registrations) continue;
- for (var j = 0; j < registrations.length; j++) {
- var registration = registrations[j];
- var options = registration.options;
- if (node !== target && !options.subtree) continue;
- if (type === "attributes" && !options.attributes) continue;
- if (type === "attributes" && options.attributeFilter && (data.namespace !== null || options.attributeFilter.indexOf(data.name) === -1)) {
- continue;
- }
- if (type === "characterData" && !options.characterData) continue;
- if (type === "childList" && !options.childList) continue;
- var observer = registration.observer;
- interestedObservers[observer.uid_] = observer;
- if (type === "attributes" && options.attributeOldValue || type === "characterData" && options.characterDataOldValue) {
- associatedStrings[observer.uid_] = data.oldValue;
- }
- }
- }
- for (var uid in interestedObservers) {
- var observer = interestedObservers[uid];
- var record = new MutationRecord(type, target);
- if ("name" in data && "namespace" in data) {
- record.attributeName = data.name;
- record.attributeNamespace = data.namespace;
- }
- if (data.addedNodes) record.addedNodes = data.addedNodes;
- if (data.removedNodes) record.removedNodes = data.removedNodes;
- if (data.previousSibling) record.previousSibling = data.previousSibling;
- if (data.nextSibling) record.nextSibling = data.nextSibling;
- if (associatedStrings[uid] !== undefined) record.oldValue = associatedStrings[uid];
- scheduleCallback(observer);
- observer.records_.push(record);
- }
- }
- var slice = Array.prototype.slice;
- function MutationObserverOptions(options) {
- this.childList = !!options.childList;
- this.subtree = !!options.subtree;
- if (!("attributes" in options) && ("attributeOldValue" in options || "attributeFilter" in options)) {
- this.attributes = true;
- } else {
- this.attributes = !!options.attributes;
- }
- if ("characterDataOldValue" in options && !("characterData" in options)) this.characterData = true; else this.characterData = !!options.characterData;
- if (!this.attributes && (options.attributeOldValue || "attributeFilter" in options) || !this.characterData && options.characterDataOldValue) {
- throw new TypeError();
- }
- this.characterData = !!options.characterData;
- this.attributeOldValue = !!options.attributeOldValue;
- this.characterDataOldValue = !!options.characterDataOldValue;
- if ("attributeFilter" in options) {
- if (options.attributeFilter == null || typeof options.attributeFilter !== "object") {
- throw new TypeError();
- }
- this.attributeFilter = slice.call(options.attributeFilter);
- } else {
- this.attributeFilter = null;
- }
- }
- var uidCounter = 0;
- function MutationObserver(callback) {
- this.callback_ = callback;
- this.nodes_ = [];
- this.records_ = [];
- this.uid_ = ++uidCounter;
- this.scheduled_ = false;
- }
- MutationObserver.prototype = {
- constructor: MutationObserver,
- observe: function(target, options) {
- target = wrapIfNeeded(target);
- var newOptions = new MutationObserverOptions(options);
- var registration;
- var registrations = registrationsTable.get(target);
- if (!registrations) registrationsTable.set(target, registrations = []);
- for (var i = 0; i < registrations.length; i++) {
- if (registrations[i].observer === this) {
- registration = registrations[i];
- registration.removeTransientObservers();
- registration.options = newOptions;
- }
- }
- if (!registration) {
- registration = new Registration(this, target, newOptions);
- registrations.push(registration);
- this.nodes_.push(target);
- }
- },
- disconnect: function() {
- this.nodes_.forEach(function(node) {
- var registrations = registrationsTable.get(node);
- for (var i = 0; i < registrations.length; i++) {
- var registration = registrations[i];
- if (registration.observer === this) {
- registrations.splice(i, 1);
- break;
- }
- }
- }, this);
- this.records_ = [];
- },
- takeRecords: function() {
- var copyOfRecords = this.records_;
- this.records_ = [];
- return copyOfRecords;
- }
- };
- function Registration(observer, target, options) {
- this.observer = observer;
- this.target = target;
- this.options = options;
- this.transientObservedNodes = [];
- }
- Registration.prototype = {
- addTransientObserver: function(node) {
- if (node === this.target) return;
- scheduleCallback(this.observer);
- this.transientObservedNodes.push(node);
- var registrations = registrationsTable.get(node);
- if (!registrations) registrationsTable.set(node, registrations = []);
- registrations.push(this);
- },
- removeTransientObservers: function() {
- var transientObservedNodes = this.transientObservedNodes;
- this.transientObservedNodes = [];
- for (var i = 0; i < transientObservedNodes.length; i++) {
- var node = transientObservedNodes[i];
- var registrations = registrationsTable.get(node);
- for (var j = 0; j < registrations.length; j++) {
- if (registrations[j] === this) {
- registrations.splice(j, 1);
- break;
- }
- }
- }
- }
- };
- scope.enqueueMutation = enqueueMutation;
- scope.registerTransientObservers = registerTransientObservers;
- scope.wrappers.MutationObserver = MutationObserver;
- scope.wrappers.MutationRecord = MutationRecord;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- function TreeScope(root, parent) {
- this.root = root;
- this.parent = parent;
- }
- TreeScope.prototype = {
- get renderer() {
- if (this.root instanceof scope.wrappers.ShadowRoot) {
- return scope.getRendererForHost(this.root.host);
- }
- return null;
- },
- contains: function(treeScope) {
- for (;treeScope; treeScope = treeScope.parent) {
- if (treeScope === this) return true;
- }
- return false;
- }
- };
- function setTreeScope(node, treeScope) {
- if (node.treeScope_ !== treeScope) {
- node.treeScope_ = treeScope;
- for (var sr = node.shadowRoot; sr; sr = sr.olderShadowRoot) {
- sr.treeScope_.parent = treeScope;
- }
- for (var child = node.firstChild; child; child = child.nextSibling) {
- setTreeScope(child, treeScope);
- }
- }
- }
- function getTreeScope(node) {
- if (node instanceof scope.wrappers.Window) {
- debugger;
- }
- if (node.treeScope_) return node.treeScope_;
- var parent = node.parentNode;
- var treeScope;
- if (parent) treeScope = getTreeScope(parent); else treeScope = new TreeScope(node, null);
- return node.treeScope_ = treeScope;
- }
- scope.TreeScope = TreeScope;
- scope.getTreeScope = getTreeScope;
- scope.setTreeScope = setTreeScope;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var forwardMethodsToWrapper = scope.forwardMethodsToWrapper;
- var getTreeScope = scope.getTreeScope;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var setWrapper = scope.setWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var wrappers = scope.wrappers;
- var wrappedFuns = new WeakMap();
- var listenersTable = new WeakMap();
- var handledEventsTable = new WeakMap();
- var currentlyDispatchingEvents = new WeakMap();
- var targetTable = new WeakMap();
- var currentTargetTable = new WeakMap();
- var relatedTargetTable = new WeakMap();
- var eventPhaseTable = new WeakMap();
- var stopPropagationTable = new WeakMap();
- var stopImmediatePropagationTable = new WeakMap();
- var eventHandlersTable = new WeakMap();
- var eventPathTable = new WeakMap();
- function isShadowRoot(node) {
- return node instanceof wrappers.ShadowRoot;
- }
- function rootOfNode(node) {
- return getTreeScope(node).root;
- }
- function getEventPath(node, event) {
- var path = [];
- var current = node;
- path.push(current);
- while (current) {
- var destinationInsertionPoints = getDestinationInsertionPoints(current);
- if (destinationInsertionPoints && destinationInsertionPoints.length > 0) {
- for (var i = 0; i < destinationInsertionPoints.length; i++) {
- var insertionPoint = destinationInsertionPoints[i];
- if (isShadowInsertionPoint(insertionPoint)) {
- var shadowRoot = rootOfNode(insertionPoint);
- var olderShadowRoot = shadowRoot.olderShadowRoot;
- if (olderShadowRoot) path.push(olderShadowRoot);
- }
- path.push(insertionPoint);
- }
- current = destinationInsertionPoints[destinationInsertionPoints.length - 1];
- } else {
- if (isShadowRoot(current)) {
- if (inSameTree(node, current) && eventMustBeStopped(event)) {
- break;
- }
- current = current.host;
- path.push(current);
- } else {
- current = current.parentNode;
- if (current) path.push(current);
- }
- }
- }
- return path;
- }
- function eventMustBeStopped(event) {
- if (!event) return false;
- switch (event.type) {
- case "abort":
- case "error":
- case "select":
- case "change":
- case "load":
- case "reset":
- case "resize":
- case "scroll":
- case "selectstart":
- return true;
- }
- return false;
- }
- function isShadowInsertionPoint(node) {
- return node instanceof HTMLShadowElement;
- }
- function getDestinationInsertionPoints(node) {
- return scope.getDestinationInsertionPoints(node);
- }
- function eventRetargetting(path, currentTarget) {
- if (path.length === 0) return currentTarget;
- if (currentTarget instanceof wrappers.Window) currentTarget = currentTarget.document;
- var currentTargetTree = getTreeScope(currentTarget);
- var originalTarget = path[0];
- var originalTargetTree = getTreeScope(originalTarget);
- var relativeTargetTree = lowestCommonInclusiveAncestor(currentTargetTree, originalTargetTree);
- for (var i = 0; i < path.length; i++) {
- var node = path[i];
- if (getTreeScope(node) === relativeTargetTree) return node;
- }
- return path[path.length - 1];
- }
- function getTreeScopeAncestors(treeScope) {
- var ancestors = [];
- for (;treeScope; treeScope = treeScope.parent) {
- ancestors.push(treeScope);
- }
- return ancestors;
- }
- function lowestCommonInclusiveAncestor(tsA, tsB) {
- var ancestorsA = getTreeScopeAncestors(tsA);
- var ancestorsB = getTreeScopeAncestors(tsB);
- var result = null;
- while (ancestorsA.length > 0 && ancestorsB.length > 0) {
- var a = ancestorsA.pop();
- var b = ancestorsB.pop();
- if (a === b) result = a; else break;
- }
- return result;
- }
- function getTreeScopeRoot(ts) {
- if (!ts.parent) return ts;
- return getTreeScopeRoot(ts.parent);
- }
- function relatedTargetResolution(event, currentTarget, relatedTarget) {
- if (currentTarget instanceof wrappers.Window) currentTarget = currentTarget.document;
- var currentTargetTree = getTreeScope(currentTarget);
- var relatedTargetTree = getTreeScope(relatedTarget);
- var relatedTargetEventPath = getEventPath(relatedTarget, event);
- var lowestCommonAncestorTree;
- var lowestCommonAncestorTree = lowestCommonInclusiveAncestor(currentTargetTree, relatedTargetTree);
- if (!lowestCommonAncestorTree) lowestCommonAncestorTree = relatedTargetTree.root;
- for (var commonAncestorTree = lowestCommonAncestorTree; commonAncestorTree; commonAncestorTree = commonAncestorTree.parent) {
- var adjustedRelatedTarget;
- for (var i = 0; i < relatedTargetEventPath.length; i++) {
- var node = relatedTargetEventPath[i];
- if (getTreeScope(node) === commonAncestorTree) return node;
- }
- }
- return null;
- }
- function inSameTree(a, b) {
- return getTreeScope(a) === getTreeScope(b);
- }
- var NONE = 0;
- var CAPTURING_PHASE = 1;
- var AT_TARGET = 2;
- var BUBBLING_PHASE = 3;
- var pendingError;
- function dispatchOriginalEvent(originalEvent) {
- if (handledEventsTable.get(originalEvent)) return;
- handledEventsTable.set(originalEvent, true);
- dispatchEvent(wrap(originalEvent), wrap(originalEvent.target));
- if (pendingError) {
- var err = pendingError;
- pendingError = null;
- throw err;
- }
- }
- function isLoadLikeEvent(event) {
- switch (event.type) {
- case "load":
- case "beforeunload":
- case "unload":
- return true;
- }
- return false;
- }
- function dispatchEvent(event, originalWrapperTarget) {
- if (currentlyDispatchingEvents.get(event)) throw new Error("InvalidStateError");
- currentlyDispatchingEvents.set(event, true);
- scope.renderAllPending();
- var eventPath;
- var overrideTarget;
- var win;
- if (isLoadLikeEvent(event) && !event.bubbles) {
- var doc = originalWrapperTarget;
- if (doc instanceof wrappers.Document && (win = doc.defaultView)) {
- overrideTarget = doc;
- eventPath = [];
- }
- }
- if (!eventPath) {
- if (originalWrapperTarget instanceof wrappers.Window) {
- win = originalWrapperTarget;
- eventPath = [];
- } else {
- eventPath = getEventPath(originalWrapperTarget, event);
- if (!isLoadLikeEvent(event)) {
- var doc = eventPath[eventPath.length - 1];
- if (doc instanceof wrappers.Document) win = doc.defaultView;
- }
- }
- }
- eventPathTable.set(event, eventPath);
- if (dispatchCapturing(event, eventPath, win, overrideTarget)) {
- if (dispatchAtTarget(event, eventPath, win, overrideTarget)) {
- dispatchBubbling(event, eventPath, win, overrideTarget);
- }
- }
- eventPhaseTable.set(event, NONE);
- currentTargetTable.delete(event, null);
- currentlyDispatchingEvents.delete(event);
- return event.defaultPrevented;
- }
- function dispatchCapturing(event, eventPath, win, overrideTarget) {
- var phase = CAPTURING_PHASE;
- if (win) {
- if (!invoke(win, event, phase, eventPath, overrideTarget)) return false;
- }
- for (var i = eventPath.length - 1; i > 0; i--) {
- if (!invoke(eventPath[i], event, phase, eventPath, overrideTarget)) return false;
- }
- return true;
- }
- function dispatchAtTarget(event, eventPath, win, overrideTarget) {
- var phase = AT_TARGET;
- var currentTarget = eventPath[0] || win;
- return invoke(currentTarget, event, phase, eventPath, overrideTarget);
- }
- function dispatchBubbling(event, eventPath, win, overrideTarget) {
- var phase = BUBBLING_PHASE;
- for (var i = 1; i < eventPath.length; i++) {
- if (!invoke(eventPath[i], event, phase, eventPath, overrideTarget)) return;
- }
- if (win && eventPath.length > 0) {
- invoke(win, event, phase, eventPath, overrideTarget);
- }
- }
- function invoke(currentTarget, event, phase, eventPath, overrideTarget) {
- var listeners = listenersTable.get(currentTarget);
- if (!listeners) return true;
- var target = overrideTarget || eventRetargetting(eventPath, currentTarget);
- if (target === currentTarget) {
- if (phase === CAPTURING_PHASE) return true;
- if (phase === BUBBLING_PHASE) phase = AT_TARGET;
- } else if (phase === BUBBLING_PHASE && !event.bubbles) {
- return true;
- }
- if ("relatedTarget" in event) {
- var originalEvent = unwrap(event);
- var unwrappedRelatedTarget = originalEvent.relatedTarget;
- if (unwrappedRelatedTarget) {
- if (unwrappedRelatedTarget instanceof Object && unwrappedRelatedTarget.addEventListener) {
- var relatedTarget = wrap(unwrappedRelatedTarget);
- var adjusted = relatedTargetResolution(event, currentTarget, relatedTarget);
- if (adjusted === target) return true;
- } else {
- adjusted = null;
- }
- relatedTargetTable.set(event, adjusted);
- }
- }
- eventPhaseTable.set(event, phase);
- var type = event.type;
- var anyRemoved = false;
- targetTable.set(event, target);
- currentTargetTable.set(event, currentTarget);
- listeners.depth++;
- for (var i = 0, len = listeners.length; i < len; i++) {
- var listener = listeners[i];
- if (listener.removed) {
- anyRemoved = true;
- continue;
- }
- if (listener.type !== type || !listener.capture && phase === CAPTURING_PHASE || listener.capture && phase === BUBBLING_PHASE) {
- continue;
- }
- try {
- if (typeof listener.handler === "function") listener.handler.call(currentTarget, event); else listener.handler.handleEvent(event);
- if (stopImmediatePropagationTable.get(event)) return false;
- } catch (ex) {
- if (!pendingError) pendingError = ex;
- }
- }
- listeners.depth--;
- if (anyRemoved && listeners.depth === 0) {
- var copy = listeners.slice();
- listeners.length = 0;
- for (var i = 0; i < copy.length; i++) {
- if (!copy[i].removed) listeners.push(copy[i]);
- }
- }
- return !stopPropagationTable.get(event);
- }
- function Listener(type, handler, capture) {
- this.type = type;
- this.handler = handler;
- this.capture = Boolean(capture);
- }
- Listener.prototype = {
- equals: function(that) {
- return this.handler === that.handler && this.type === that.type && this.capture === that.capture;
- },
- get removed() {
- return this.handler === null;
- },
- remove: function() {
- this.handler = null;
- }
- };
- var OriginalEvent = window.Event;
- OriginalEvent.prototype.polymerBlackList_ = {
- returnValue: true,
- keyLocation: true
- };
- function Event(type, options) {
- if (type instanceof OriginalEvent) {
- var impl = type;
- if (!OriginalBeforeUnloadEvent && impl.type === "beforeunload" && !(this instanceof BeforeUnloadEvent)) {
- return new BeforeUnloadEvent(impl);
- }
- setWrapper(impl, this);
- } else {
- return wrap(constructEvent(OriginalEvent, "Event", type, options));
- }
- }
- Event.prototype = {
- get target() {
- return targetTable.get(this);
- },
- get currentTarget() {
- return currentTargetTable.get(this);
- },
- get eventPhase() {
- return eventPhaseTable.get(this);
- },
- get path() {
- var eventPath = eventPathTable.get(this);
- if (!eventPath) return [];
- return eventPath.slice();
- },
- stopPropagation: function() {
- stopPropagationTable.set(this, true);
- },
- stopImmediatePropagation: function() {
- stopPropagationTable.set(this, true);
- stopImmediatePropagationTable.set(this, true);
- }
- };
- registerWrapper(OriginalEvent, Event, document.createEvent("Event"));
- function unwrapOptions(options) {
- if (!options || !options.relatedTarget) return options;
- return Object.create(options, {
- relatedTarget: {
- value: unwrap(options.relatedTarget)
- }
- });
- }
- function registerGenericEvent(name, SuperEvent, prototype) {
- var OriginalEvent = window[name];
- var GenericEvent = function(type, options) {
- if (type instanceof OriginalEvent) setWrapper(type, this); else return wrap(constructEvent(OriginalEvent, name, type, options));
- };
- GenericEvent.prototype = Object.create(SuperEvent.prototype);
- if (prototype) mixin(GenericEvent.prototype, prototype);
- if (OriginalEvent) {
- try {
- registerWrapper(OriginalEvent, GenericEvent, new OriginalEvent("temp"));
- } catch (ex) {
- registerWrapper(OriginalEvent, GenericEvent, document.createEvent(name));
- }
- }
- return GenericEvent;
- }
- var UIEvent = registerGenericEvent("UIEvent", Event);
- var CustomEvent = registerGenericEvent("CustomEvent", Event);
- var relatedTargetProto = {
- get relatedTarget() {
- var relatedTarget = relatedTargetTable.get(this);
- if (relatedTarget !== undefined) return relatedTarget;
- return wrap(unwrap(this).relatedTarget);
- }
- };
- function getInitFunction(name, relatedTargetIndex) {
- return function() {
- arguments[relatedTargetIndex] = unwrap(arguments[relatedTargetIndex]);
- var impl = unwrap(this);
- impl[name].apply(impl, arguments);
- };
- }
- var mouseEventProto = mixin({
- initMouseEvent: getInitFunction("initMouseEvent", 14)
- }, relatedTargetProto);
- var focusEventProto = mixin({
- initFocusEvent: getInitFunction("initFocusEvent", 5)
- }, relatedTargetProto);
- var MouseEvent = registerGenericEvent("MouseEvent", UIEvent, mouseEventProto);
- var FocusEvent = registerGenericEvent("FocusEvent", UIEvent, focusEventProto);
- var defaultInitDicts = Object.create(null);
- var supportsEventConstructors = function() {
- try {
- new window.FocusEvent("focus");
- } catch (ex) {
- return false;
- }
- return true;
- }();
- function constructEvent(OriginalEvent, name, type, options) {
- if (supportsEventConstructors) return new OriginalEvent(type, unwrapOptions(options));
- var event = unwrap(document.createEvent(name));
- var defaultDict = defaultInitDicts[name];
- var args = [ type ];
- Object.keys(defaultDict).forEach(function(key) {
- var v = options != null && key in options ? options[key] : defaultDict[key];
- if (key === "relatedTarget") v = unwrap(v);
- args.push(v);
- });
- event["init" + name].apply(event, args);
- return event;
- }
- if (!supportsEventConstructors) {
- var configureEventConstructor = function(name, initDict, superName) {
- if (superName) {
- var superDict = defaultInitDicts[superName];
- initDict = mixin(mixin({}, superDict), initDict);
- }
- defaultInitDicts[name] = initDict;
- };
- configureEventConstructor("Event", {
- bubbles: false,
- cancelable: false
- });
- configureEventConstructor("CustomEvent", {
- detail: null
- }, "Event");
- configureEventConstructor("UIEvent", {
- view: null,
- detail: 0
- }, "Event");
- configureEventConstructor("MouseEvent", {
- screenX: 0,
- screenY: 0,
- clientX: 0,
- clientY: 0,
- ctrlKey: false,
- altKey: false,
- shiftKey: false,
- metaKey: false,
- button: 0,
- relatedTarget: null
- }, "UIEvent");
- configureEventConstructor("FocusEvent", {
- relatedTarget: null
- }, "UIEvent");
- }
- var OriginalBeforeUnloadEvent = window.BeforeUnloadEvent;
- function BeforeUnloadEvent(impl) {
- Event.call(this, impl);
- }
- BeforeUnloadEvent.prototype = Object.create(Event.prototype);
- mixin(BeforeUnloadEvent.prototype, {
- get returnValue() {
- return unsafeUnwrap(this).returnValue;
- },
- set returnValue(v) {
- unsafeUnwrap(this).returnValue = v;
- }
- });
- if (OriginalBeforeUnloadEvent) registerWrapper(OriginalBeforeUnloadEvent, BeforeUnloadEvent);
- function isValidListener(fun) {
- if (typeof fun === "function") return true;
- return fun && fun.handleEvent;
- }
- function isMutationEvent(type) {
- switch (type) {
- case "DOMAttrModified":
- case "DOMAttributeNameChanged":
- case "DOMCharacterDataModified":
- case "DOMElementNameChanged":
- case "DOMNodeInserted":
- case "DOMNodeInsertedIntoDocument":
- case "DOMNodeRemoved":
- case "DOMNodeRemovedFromDocument":
- case "DOMSubtreeModified":
- return true;
- }
- return false;
- }
- var OriginalEventTarget = window.EventTarget;
- function EventTarget(impl) {
- setWrapper(impl, this);
- }
- var methodNames = [ "addEventListener", "removeEventListener", "dispatchEvent" ];
- [ Node, Window ].forEach(function(constructor) {
- var p = constructor.prototype;
- methodNames.forEach(function(name) {
- Object.defineProperty(p, name + "_", {
- value: p[name]
- });
- });
- });
- function getTargetToListenAt(wrapper) {
- if (wrapper instanceof wrappers.ShadowRoot) wrapper = wrapper.host;
- return unwrap(wrapper);
- }
- EventTarget.prototype = {
- addEventListener: function(type, fun, capture) {
- if (!isValidListener(fun) || isMutationEvent(type)) return;
- var listener = new Listener(type, fun, capture);
- var listeners = listenersTable.get(this);
- if (!listeners) {
- listeners = [];
- listeners.depth = 0;
- listenersTable.set(this, listeners);
- } else {
- for (var i = 0; i < listeners.length; i++) {
- if (listener.equals(listeners[i])) return;
- }
- }
- listeners.push(listener);
- var target = getTargetToListenAt(this);
- target.addEventListener_(type, dispatchOriginalEvent, true);
- },
- removeEventListener: function(type, fun, capture) {
- capture = Boolean(capture);
- var listeners = listenersTable.get(this);
- if (!listeners) return;
- var count = 0, found = false;
- for (var i = 0; i < listeners.length; i++) {
- if (listeners[i].type === type && listeners[i].capture === capture) {
- count++;
- if (listeners[i].handler === fun) {
- found = true;
- listeners[i].remove();
- }
- }
- }
- if (found && count === 1) {
- var target = getTargetToListenAt(this);
- target.removeEventListener_(type, dispatchOriginalEvent, true);
- }
- },
- dispatchEvent: function(event) {
- var nativeEvent = unwrap(event);
- var eventType = nativeEvent.type;
- handledEventsTable.set(nativeEvent, false);
- scope.renderAllPending();
- var tempListener;
- if (!hasListenerInAncestors(this, eventType)) {
- tempListener = function() {};
- this.addEventListener(eventType, tempListener, true);
- }
- try {
- return unwrap(this).dispatchEvent_(nativeEvent);
- } finally {
- if (tempListener) this.removeEventListener(eventType, tempListener, true);
- }
- }
- };
- function hasListener(node, type) {
- var listeners = listenersTable.get(node);
- if (listeners) {
- for (var i = 0; i < listeners.length; i++) {
- if (!listeners[i].removed && listeners[i].type === type) return true;
- }
- }
- return false;
- }
- function hasListenerInAncestors(target, type) {
- for (var node = unwrap(target); node; node = node.parentNode) {
- if (hasListener(wrap(node), type)) return true;
- }
- return false;
- }
- if (OriginalEventTarget) registerWrapper(OriginalEventTarget, EventTarget);
- function wrapEventTargetMethods(constructors) {
- forwardMethodsToWrapper(constructors, methodNames);
- }
- var originalElementFromPoint = document.elementFromPoint;
- function elementFromPoint(self, document, x, y) {
- scope.renderAllPending();
- var element = wrap(originalElementFromPoint.call(unsafeUnwrap(document), x, y));
- if (!element) return null;
- var path = getEventPath(element, null);
- var idx = path.lastIndexOf(self);
- if (idx == -1) return null; else path = path.slice(0, idx);
- return eventRetargetting(path, self);
- }
- function getEventHandlerGetter(name) {
- return function() {
- var inlineEventHandlers = eventHandlersTable.get(this);
- return inlineEventHandlers && inlineEventHandlers[name] && inlineEventHandlers[name].value || null;
- };
- }
- function getEventHandlerSetter(name) {
- var eventType = name.slice(2);
- return function(value) {
- var inlineEventHandlers = eventHandlersTable.get(this);
- if (!inlineEventHandlers) {
- inlineEventHandlers = Object.create(null);
- eventHandlersTable.set(this, inlineEventHandlers);
- }
- var old = inlineEventHandlers[name];
- if (old) this.removeEventListener(eventType, old.wrapped, false);
- if (typeof value === "function") {
- var wrapped = function(e) {
- var rv = value.call(this, e);
- if (rv === false) e.preventDefault(); else if (name === "onbeforeunload" && typeof rv === "string") e.returnValue = rv;
- };
- this.addEventListener(eventType, wrapped, false);
- inlineEventHandlers[name] = {
- value: value,
- wrapped: wrapped
- };
- }
- };
- }
- scope.elementFromPoint = elementFromPoint;
- scope.getEventHandlerGetter = getEventHandlerGetter;
- scope.getEventHandlerSetter = getEventHandlerSetter;
- scope.wrapEventTargetMethods = wrapEventTargetMethods;
- scope.wrappers.BeforeUnloadEvent = BeforeUnloadEvent;
- scope.wrappers.CustomEvent = CustomEvent;
- scope.wrappers.Event = Event;
- scope.wrappers.EventTarget = EventTarget;
- scope.wrappers.FocusEvent = FocusEvent;
- scope.wrappers.MouseEvent = MouseEvent;
- scope.wrappers.UIEvent = UIEvent;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var UIEvent = scope.wrappers.UIEvent;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var setWrapper = scope.setWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var wrap = scope.wrap;
- var OriginalTouchEvent = window.TouchEvent;
- if (!OriginalTouchEvent) return;
- var nativeEvent;
- try {
- nativeEvent = document.createEvent("TouchEvent");
- } catch (ex) {
- return;
- }
- var nonEnumDescriptor = {
- enumerable: false
- };
- function nonEnum(obj, prop) {
- Object.defineProperty(obj, prop, nonEnumDescriptor);
- }
- function Touch(impl) {
- setWrapper(impl, this);
- }
- Touch.prototype = {
- get target() {
- return wrap(unsafeUnwrap(this).target);
- }
- };
- var descr = {
- configurable: true,
- enumerable: true,
- get: null
- };
- [ "clientX", "clientY", "screenX", "screenY", "pageX", "pageY", "identifier", "webkitRadiusX", "webkitRadiusY", "webkitRotationAngle", "webkitForce" ].forEach(function(name) {
- descr.get = function() {
- return unsafeUnwrap(this)[name];
- };
- Object.defineProperty(Touch.prototype, name, descr);
- });
- function TouchList() {
- this.length = 0;
- nonEnum(this, "length");
- }
- TouchList.prototype = {
- item: function(index) {
- return this[index];
- }
- };
- function wrapTouchList(nativeTouchList) {
- var list = new TouchList();
- for (var i = 0; i < nativeTouchList.length; i++) {
- list[i] = new Touch(nativeTouchList[i]);
- }
- list.length = i;
- return list;
- }
- function TouchEvent(impl) {
- UIEvent.call(this, impl);
- }
- TouchEvent.prototype = Object.create(UIEvent.prototype);
- mixin(TouchEvent.prototype, {
- get touches() {
- return wrapTouchList(unsafeUnwrap(this).touches);
- },
- get targetTouches() {
- return wrapTouchList(unsafeUnwrap(this).targetTouches);
- },
- get changedTouches() {
- return wrapTouchList(unsafeUnwrap(this).changedTouches);
- },
- initTouchEvent: function() {
- throw new Error("Not implemented");
- }
- });
- registerWrapper(OriginalTouchEvent, TouchEvent, nativeEvent);
- scope.wrappers.Touch = Touch;
- scope.wrappers.TouchEvent = TouchEvent;
- scope.wrappers.TouchList = TouchList;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var unsafeUnwrap = scope.unsafeUnwrap;
- var wrap = scope.wrap;
- var nonEnumDescriptor = {
- enumerable: false
- };
- function nonEnum(obj, prop) {
- Object.defineProperty(obj, prop, nonEnumDescriptor);
- }
- function NodeList() {
- this.length = 0;
- nonEnum(this, "length");
- }
- NodeList.prototype = {
- item: function(index) {
- return this[index];
- }
- };
- nonEnum(NodeList.prototype, "item");
- function wrapNodeList(list) {
- if (list == null) return list;
- var wrapperList = new NodeList();
- for (var i = 0, length = list.length; i < length; i++) {
- wrapperList[i] = wrap(list[i]);
- }
- wrapperList.length = length;
- return wrapperList;
- }
- function addWrapNodeListMethod(wrapperConstructor, name) {
- wrapperConstructor.prototype[name] = function() {
- return wrapNodeList(unsafeUnwrap(this)[name].apply(unsafeUnwrap(this), arguments));
- };
- }
- scope.wrappers.NodeList = NodeList;
- scope.addWrapNodeListMethod = addWrapNodeListMethod;
- scope.wrapNodeList = wrapNodeList;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- scope.wrapHTMLCollection = scope.wrapNodeList;
- scope.wrappers.HTMLCollection = scope.wrappers.NodeList;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var EventTarget = scope.wrappers.EventTarget;
- var NodeList = scope.wrappers.NodeList;
- var TreeScope = scope.TreeScope;
- var assert = scope.assert;
- var defineWrapGetter = scope.defineWrapGetter;
- var enqueueMutation = scope.enqueueMutation;
- var getTreeScope = scope.getTreeScope;
- var isWrapper = scope.isWrapper;
- var mixin = scope.mixin;
- var registerTransientObservers = scope.registerTransientObservers;
- var registerWrapper = scope.registerWrapper;
- var setTreeScope = scope.setTreeScope;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var unwrapIfNeeded = scope.unwrapIfNeeded;
- var wrap = scope.wrap;
- var wrapIfNeeded = scope.wrapIfNeeded;
- var wrappers = scope.wrappers;
- function assertIsNodeWrapper(node) {
- assert(node instanceof Node);
- }
- function createOneElementNodeList(node) {
- var nodes = new NodeList();
- nodes[0] = node;
- nodes.length = 1;
- return nodes;
- }
- var surpressMutations = false;
- function enqueueRemovalForInsertedNodes(node, parent, nodes) {
- enqueueMutation(parent, "childList", {
- removedNodes: nodes,
- previousSibling: node.previousSibling,
- nextSibling: node.nextSibling
- });
- }
- function enqueueRemovalForInsertedDocumentFragment(df, nodes) {
- enqueueMutation(df, "childList", {
- removedNodes: nodes
- });
- }
- function collectNodes(node, parentNode, previousNode, nextNode) {
- if (node instanceof DocumentFragment) {
- var nodes = collectNodesForDocumentFragment(node);
- surpressMutations = true;
- for (var i = nodes.length - 1; i >= 0; i--) {
- node.removeChild(nodes[i]);
- nodes[i].parentNode_ = parentNode;
- }
- surpressMutations = false;
- for (var i = 0; i < nodes.length; i++) {
- nodes[i].previousSibling_ = nodes[i - 1] || previousNode;
- nodes[i].nextSibling_ = nodes[i + 1] || nextNode;
- }
- if (previousNode) previousNode.nextSibling_ = nodes[0];
- if (nextNode) nextNode.previousSibling_ = nodes[nodes.length - 1];
- return nodes;
- }
- var nodes = createOneElementNodeList(node);
- var oldParent = node.parentNode;
- if (oldParent) {
- oldParent.removeChild(node);
- }
- node.parentNode_ = parentNode;
- node.previousSibling_ = previousNode;
- node.nextSibling_ = nextNode;
- if (previousNode) previousNode.nextSibling_ = node;
- if (nextNode) nextNode.previousSibling_ = node;
- return nodes;
- }
- function collectNodesNative(node) {
- if (node instanceof DocumentFragment) return collectNodesForDocumentFragment(node);
- var nodes = createOneElementNodeList(node);
- var oldParent = node.parentNode;
- if (oldParent) enqueueRemovalForInsertedNodes(node, oldParent, nodes);
- return nodes;
- }
- function collectNodesForDocumentFragment(node) {
- var nodes = new NodeList();
- var i = 0;
- for (var child = node.firstChild; child; child = child.nextSibling) {
- nodes[i++] = child;
- }
- nodes.length = i;
- enqueueRemovalForInsertedDocumentFragment(node, nodes);
- return nodes;
- }
- function snapshotNodeList(nodeList) {
- return nodeList;
- }
- function nodeWasAdded(node, treeScope) {
- setTreeScope(node, treeScope);
- node.nodeIsInserted_();
- }
- function nodesWereAdded(nodes, parent) {
- var treeScope = getTreeScope(parent);
- for (var i = 0; i < nodes.length; i++) {
- nodeWasAdded(nodes[i], treeScope);
- }
- }
- function nodeWasRemoved(node) {
- setTreeScope(node, new TreeScope(node, null));
- }
- function nodesWereRemoved(nodes) {
- for (var i = 0; i < nodes.length; i++) {
- nodeWasRemoved(nodes[i]);
- }
- }
- function ensureSameOwnerDocument(parent, child) {
- var ownerDoc = parent.nodeType === Node.DOCUMENT_NODE ? parent : parent.ownerDocument;
- if (ownerDoc !== child.ownerDocument) ownerDoc.adoptNode(child);
- }
- function adoptNodesIfNeeded(owner, nodes) {
- if (!nodes.length) return;
- var ownerDoc = owner.ownerDocument;
- if (ownerDoc === nodes[0].ownerDocument) return;
- for (var i = 0; i < nodes.length; i++) {
- scope.adoptNodeNoRemove(nodes[i], ownerDoc);
- }
- }
- function unwrapNodesForInsertion(owner, nodes) {
- adoptNodesIfNeeded(owner, nodes);
- var length = nodes.length;
- if (length === 1) return unwrap(nodes[0]);
- var df = unwrap(owner.ownerDocument.createDocumentFragment());
- for (var i = 0; i < length; i++) {
- df.appendChild(unwrap(nodes[i]));
- }
- return df;
- }
- function clearChildNodes(wrapper) {
- if (wrapper.firstChild_ !== undefined) {
- var child = wrapper.firstChild_;
- while (child) {
- var tmp = child;
- child = child.nextSibling_;
- tmp.parentNode_ = tmp.previousSibling_ = tmp.nextSibling_ = undefined;
- }
- }
- wrapper.firstChild_ = wrapper.lastChild_ = undefined;
- }
- function removeAllChildNodes(wrapper) {
- if (wrapper.invalidateShadowRenderer()) {
- var childWrapper = wrapper.firstChild;
- while (childWrapper) {
- assert(childWrapper.parentNode === wrapper);
- var nextSibling = childWrapper.nextSibling;
- var childNode = unwrap(childWrapper);
- var parentNode = childNode.parentNode;
- if (parentNode) originalRemoveChild.call(parentNode, childNode);
- childWrapper.previousSibling_ = childWrapper.nextSibling_ = childWrapper.parentNode_ = null;
- childWrapper = nextSibling;
- }
- wrapper.firstChild_ = wrapper.lastChild_ = null;
- } else {
- var node = unwrap(wrapper);
- var child = node.firstChild;
- var nextSibling;
- while (child) {
- nextSibling = child.nextSibling;
- originalRemoveChild.call(node, child);
- child = nextSibling;
- }
- }
- }
- function invalidateParent(node) {
- var p = node.parentNode;
- return p && p.invalidateShadowRenderer();
- }
- function cleanupNodes(nodes) {
- for (var i = 0, n; i < nodes.length; i++) {
- n = nodes[i];
- n.parentNode.removeChild(n);
- }
- }
- var originalImportNode = document.importNode;
- var originalCloneNode = window.Node.prototype.cloneNode;
- function cloneNode(node, deep, opt_doc) {
- var clone;
- if (opt_doc) clone = wrap(originalImportNode.call(opt_doc, unsafeUnwrap(node), false)); else clone = wrap(originalCloneNode.call(unsafeUnwrap(node), false));
- if (deep) {
- for (var child = node.firstChild; child; child = child.nextSibling) {
- clone.appendChild(cloneNode(child, true, opt_doc));
- }
- if (node instanceof wrappers.HTMLTemplateElement) {
- var cloneContent = clone.content;
- for (var child = node.content.firstChild; child; child = child.nextSibling) {
- cloneContent.appendChild(cloneNode(child, true, opt_doc));
- }
- }
- }
- return clone;
- }
- function contains(self, child) {
- if (!child || getTreeScope(self) !== getTreeScope(child)) return false;
- for (var node = child; node; node = node.parentNode) {
- if (node === self) return true;
- }
- return false;
- }
- var OriginalNode = window.Node;
- function Node(original) {
- assert(original instanceof OriginalNode);
- EventTarget.call(this, original);
- this.parentNode_ = undefined;
- this.firstChild_ = undefined;
- this.lastChild_ = undefined;
- this.nextSibling_ = undefined;
- this.previousSibling_ = undefined;
- this.treeScope_ = undefined;
- }
- var OriginalDocumentFragment = window.DocumentFragment;
- var originalAppendChild = OriginalNode.prototype.appendChild;
- var originalCompareDocumentPosition = OriginalNode.prototype.compareDocumentPosition;
- var originalInsertBefore = OriginalNode.prototype.insertBefore;
- var originalRemoveChild = OriginalNode.prototype.removeChild;
- var originalReplaceChild = OriginalNode.prototype.replaceChild;
- var isIe = /Trident|Edge/.test(navigator.userAgent);
- var removeChildOriginalHelper = isIe ? function(parent, child) {
- try {
- originalRemoveChild.call(parent, child);
- } catch (ex) {
- if (!(parent instanceof OriginalDocumentFragment)) throw ex;
- }
- } : function(parent, child) {
- originalRemoveChild.call(parent, child);
- };
- Node.prototype = Object.create(EventTarget.prototype);
- mixin(Node.prototype, {
- appendChild: function(childWrapper) {
- return this.insertBefore(childWrapper, null);
- },
- insertBefore: function(childWrapper, refWrapper) {
- assertIsNodeWrapper(childWrapper);
- var refNode;
- if (refWrapper) {
- if (isWrapper(refWrapper)) {
- refNode = unwrap(refWrapper);
- } else {
- refNode = refWrapper;
- refWrapper = wrap(refNode);
- }
- } else {
- refWrapper = null;
- refNode = null;
- }
- refWrapper && assert(refWrapper.parentNode === this);
- var nodes;
- var previousNode = refWrapper ? refWrapper.previousSibling : this.lastChild;
- var useNative = !this.invalidateShadowRenderer() && !invalidateParent(childWrapper);
- if (useNative) nodes = collectNodesNative(childWrapper); else nodes = collectNodes(childWrapper, this, previousNode, refWrapper);
- if (useNative) {
- ensureSameOwnerDocument(this, childWrapper);
- clearChildNodes(this);
- originalInsertBefore.call(unsafeUnwrap(this), unwrap(childWrapper), refNode);
- } else {
- if (!previousNode) this.firstChild_ = nodes[0];
- if (!refWrapper) {
- this.lastChild_ = nodes[nodes.length - 1];
- if (this.firstChild_ === undefined) this.firstChild_ = this.firstChild;
- }
- var parentNode = refNode ? refNode.parentNode : unsafeUnwrap(this);
- if (parentNode) {
- originalInsertBefore.call(parentNode, unwrapNodesForInsertion(this, nodes), refNode);
- } else {
- adoptNodesIfNeeded(this, nodes);
- }
- }
- enqueueMutation(this, "childList", {
- addedNodes: nodes,
- nextSibling: refWrapper,
- previousSibling: previousNode
- });
- nodesWereAdded(nodes, this);
- return childWrapper;
- },
- removeChild: function(childWrapper) {
- assertIsNodeWrapper(childWrapper);
- if (childWrapper.parentNode !== this) {
- var found = false;
- var childNodes = this.childNodes;
- for (var ieChild = this.firstChild; ieChild; ieChild = ieChild.nextSibling) {
- if (ieChild === childWrapper) {
- found = true;
- break;
- }
- }
- if (!found) {
- throw new Error("NotFoundError");
- }
- }
- var childNode = unwrap(childWrapper);
- var childWrapperNextSibling = childWrapper.nextSibling;
- var childWrapperPreviousSibling = childWrapper.previousSibling;
- if (this.invalidateShadowRenderer()) {
- var thisFirstChild = this.firstChild;
- var thisLastChild = this.lastChild;
- var parentNode = childNode.parentNode;
- if (parentNode) removeChildOriginalHelper(parentNode, childNode);
- if (thisFirstChild === childWrapper) this.firstChild_ = childWrapperNextSibling;
- if (thisLastChild === childWrapper) this.lastChild_ = childWrapperPreviousSibling;
- if (childWrapperPreviousSibling) childWrapperPreviousSibling.nextSibling_ = childWrapperNextSibling;
- if (childWrapperNextSibling) {
- childWrapperNextSibling.previousSibling_ = childWrapperPreviousSibling;
- }
- childWrapper.previousSibling_ = childWrapper.nextSibling_ = childWrapper.parentNode_ = undefined;
- } else {
- clearChildNodes(this);
- removeChildOriginalHelper(unsafeUnwrap(this), childNode);
- }
- if (!surpressMutations) {
- enqueueMutation(this, "childList", {
- removedNodes: createOneElementNodeList(childWrapper),
- nextSibling: childWrapperNextSibling,
- previousSibling: childWrapperPreviousSibling
- });
- }
- registerTransientObservers(this, childWrapper);
- return childWrapper;
- },
- replaceChild: function(newChildWrapper, oldChildWrapper) {
- assertIsNodeWrapper(newChildWrapper);
- var oldChildNode;
- if (isWrapper(oldChildWrapper)) {
- oldChildNode = unwrap(oldChildWrapper);
- } else {
- oldChildNode = oldChildWrapper;
- oldChildWrapper = wrap(oldChildNode);
- }
- if (oldChildWrapper.parentNode !== this) {
- throw new Error("NotFoundError");
- }
- var nextNode = oldChildWrapper.nextSibling;
- var previousNode = oldChildWrapper.previousSibling;
- var nodes;
- var useNative = !this.invalidateShadowRenderer() && !invalidateParent(newChildWrapper);
- if (useNative) {
- nodes = collectNodesNative(newChildWrapper);
- } else {
- if (nextNode === newChildWrapper) nextNode = newChildWrapper.nextSibling;
- nodes = collectNodes(newChildWrapper, this, previousNode, nextNode);
- }
- if (!useNative) {
- if (this.firstChild === oldChildWrapper) this.firstChild_ = nodes[0];
- if (this.lastChild === oldChildWrapper) this.lastChild_ = nodes[nodes.length - 1];
- oldChildWrapper.previousSibling_ = oldChildWrapper.nextSibling_ = oldChildWrapper.parentNode_ = undefined;
- if (oldChildNode.parentNode) {
- originalReplaceChild.call(oldChildNode.parentNode, unwrapNodesForInsertion(this, nodes), oldChildNode);
- }
- } else {
- ensureSameOwnerDocument(this, newChildWrapper);
- clearChildNodes(this);
- originalReplaceChild.call(unsafeUnwrap(this), unwrap(newChildWrapper), oldChildNode);
- }
- enqueueMutation(this, "childList", {
- addedNodes: nodes,
- removedNodes: createOneElementNodeList(oldChildWrapper),
- nextSibling: nextNode,
- previousSibling: previousNode
- });
- nodeWasRemoved(oldChildWrapper);
- nodesWereAdded(nodes, this);
- return oldChildWrapper;
- },
- nodeIsInserted_: function() {
- for (var child = this.firstChild; child; child = child.nextSibling) {
- child.nodeIsInserted_();
- }
- },
- hasChildNodes: function() {
- return this.firstChild !== null;
- },
- get parentNode() {
- return this.parentNode_ !== undefined ? this.parentNode_ : wrap(unsafeUnwrap(this).parentNode);
- },
- get firstChild() {
- return this.firstChild_ !== undefined ? this.firstChild_ : wrap(unsafeUnwrap(this).firstChild);
- },
- get lastChild() {
- return this.lastChild_ !== undefined ? this.lastChild_ : wrap(unsafeUnwrap(this).lastChild);
- },
- get nextSibling() {
- return this.nextSibling_ !== undefined ? this.nextSibling_ : wrap(unsafeUnwrap(this).nextSibling);
- },
- get previousSibling() {
- return this.previousSibling_ !== undefined ? this.previousSibling_ : wrap(unsafeUnwrap(this).previousSibling);
- },
- get parentElement() {
- var p = this.parentNode;
- while (p && p.nodeType !== Node.ELEMENT_NODE) {
- p = p.parentNode;
- }
- return p;
- },
- get textContent() {
- var s = "";
- for (var child = this.firstChild; child; child = child.nextSibling) {
- if (child.nodeType != Node.COMMENT_NODE) {
- s += child.textContent;
- }
- }
- return s;
- },
- set textContent(textContent) {
- if (textContent == null) textContent = "";
- var removedNodes = snapshotNodeList(this.childNodes);
- if (this.invalidateShadowRenderer()) {
- removeAllChildNodes(this);
- if (textContent !== "") {
- var textNode = unsafeUnwrap(this).ownerDocument.createTextNode(textContent);
- this.appendChild(textNode);
- }
- } else {
- clearChildNodes(this);
- unsafeUnwrap(this).textContent = textContent;
- }
- var addedNodes = snapshotNodeList(this.childNodes);
- enqueueMutation(this, "childList", {
- addedNodes: addedNodes,
- removedNodes: removedNodes
- });
- nodesWereRemoved(removedNodes);
- nodesWereAdded(addedNodes, this);
- },
- get childNodes() {
- var wrapperList = new NodeList();
- var i = 0;
- for (var child = this.firstChild; child; child = child.nextSibling) {
- wrapperList[i++] = child;
- }
- wrapperList.length = i;
- return wrapperList;
- },
- cloneNode: function(deep) {
- return cloneNode(this, deep);
- },
- contains: function(child) {
- return contains(this, wrapIfNeeded(child));
- },
- compareDocumentPosition: function(otherNode) {
- return originalCompareDocumentPosition.call(unsafeUnwrap(this), unwrapIfNeeded(otherNode));
- },
- normalize: function() {
- var nodes = snapshotNodeList(this.childNodes);
- var remNodes = [];
- var s = "";
- var modNode;
- for (var i = 0, n; i < nodes.length; i++) {
- n = nodes[i];
- if (n.nodeType === Node.TEXT_NODE) {
- if (!modNode && !n.data.length) this.removeChild(n); else if (!modNode) modNode = n; else {
- s += n.data;
- remNodes.push(n);
- }
- } else {
- if (modNode && remNodes.length) {
- modNode.data += s;
- cleanupNodes(remNodes);
- }
- remNodes = [];
- s = "";
- modNode = null;
- if (n.childNodes.length) n.normalize();
- }
- }
- if (modNode && remNodes.length) {
- modNode.data += s;
- cleanupNodes(remNodes);
- }
- }
- });
- defineWrapGetter(Node, "ownerDocument");
- registerWrapper(OriginalNode, Node, document.createDocumentFragment());
- delete Node.prototype.querySelector;
- delete Node.prototype.querySelectorAll;
- Node.prototype = mixin(Object.create(EventTarget.prototype), Node.prototype);
- scope.cloneNode = cloneNode;
- scope.nodeWasAdded = nodeWasAdded;
- scope.nodeWasRemoved = nodeWasRemoved;
- scope.nodesWereAdded = nodesWereAdded;
- scope.nodesWereRemoved = nodesWereRemoved;
- scope.originalInsertBefore = originalInsertBefore;
- scope.originalRemoveChild = originalRemoveChild;
- scope.snapshotNodeList = snapshotNodeList;
- scope.wrappers.Node = Node;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLCollection = scope.wrappers.HTMLCollection;
- var NodeList = scope.wrappers.NodeList;
- var getTreeScope = scope.getTreeScope;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var wrap = scope.wrap;
- var originalDocumentQuerySelector = document.querySelector;
- var originalElementQuerySelector = document.documentElement.querySelector;
- var originalDocumentQuerySelectorAll = document.querySelectorAll;
- var originalElementQuerySelectorAll = document.documentElement.querySelectorAll;
- var originalDocumentGetElementsByTagName = document.getElementsByTagName;
- var originalElementGetElementsByTagName = document.documentElement.getElementsByTagName;
- var originalDocumentGetElementsByTagNameNS = document.getElementsByTagNameNS;
- var originalElementGetElementsByTagNameNS = document.documentElement.getElementsByTagNameNS;
- var OriginalElement = window.Element;
- var OriginalDocument = window.HTMLDocument || window.Document;
- function filterNodeList(list, index, result, deep) {
- var wrappedItem = null;
- var root = null;
- for (var i = 0, length = list.length; i < length; i++) {
- wrappedItem = wrap(list[i]);
- if (!deep && (root = getTreeScope(wrappedItem).root)) {
- if (root instanceof scope.wrappers.ShadowRoot) {
- continue;
- }
- }
- result[index++] = wrappedItem;
- }
- return index;
- }
- function shimSelector(selector) {
- return String(selector).replace(/\/deep\/|::shadow/g, " ");
- }
- function shimMatchesSelector(selector) {
- return String(selector).replace(/:host\(([^\s]+)\)/g, "$1").replace(/([^\s]):host/g, "$1").replace(":host", "*").replace(/\^|\/shadow\/|\/shadow-deep\/|::shadow|\/deep\/|::content/g, " ");
- }
- function findOne(node, selector) {
- var m, el = node.firstElementChild;
- while (el) {
- if (el.matches(selector)) return el;
- m = findOne(el, selector);
- if (m) return m;
- el = el.nextElementSibling;
- }
- return null;
- }
- function matchesSelector(el, selector) {
- return el.matches(selector);
- }
- var XHTML_NS = "http://www.w3.org/1999/xhtml";
- function matchesTagName(el, localName, localNameLowerCase) {
- var ln = el.localName;
- return ln === localName || ln === localNameLowerCase && el.namespaceURI === XHTML_NS;
- }
- function matchesEveryThing() {
- return true;
- }
- function matchesLocalNameOnly(el, ns, localName) {
- return el.localName === localName;
- }
- function matchesNameSpace(el, ns) {
- return el.namespaceURI === ns;
- }
- function matchesLocalNameNS(el, ns, localName) {
- return el.namespaceURI === ns && el.localName === localName;
- }
- function findElements(node, index, result, p, arg0, arg1) {
- var el = node.firstElementChild;
- while (el) {
- if (p(el, arg0, arg1)) result[index++] = el;
- index = findElements(el, index, result, p, arg0, arg1);
- el = el.nextElementSibling;
- }
- return index;
- }
- function querySelectorAllFiltered(p, index, result, selector, deep) {
- var target = unsafeUnwrap(this);
- var list;
- var root = getTreeScope(this).root;
- if (root instanceof scope.wrappers.ShadowRoot) {
- return findElements(this, index, result, p, selector, null);
- } else if (target instanceof OriginalElement) {
- list = originalElementQuerySelectorAll.call(target, selector);
- } else if (target instanceof OriginalDocument) {
- list = originalDocumentQuerySelectorAll.call(target, selector);
- } else {
- return findElements(this, index, result, p, selector, null);
- }
- return filterNodeList(list, index, result, deep);
- }
- var SelectorsInterface = {
- querySelector: function(selector) {
- var shimmed = shimSelector(selector);
- var deep = shimmed !== selector;
- selector = shimmed;
- var target = unsafeUnwrap(this);
- var wrappedItem;
- var root = getTreeScope(this).root;
- if (root instanceof scope.wrappers.ShadowRoot) {
- return findOne(this, selector);
- } else if (target instanceof OriginalElement) {
- wrappedItem = wrap(originalElementQuerySelector.call(target, selector));
- } else if (target instanceof OriginalDocument) {
- wrappedItem = wrap(originalDocumentQuerySelector.call(target, selector));
- } else {
- return findOne(this, selector);
- }
- if (!wrappedItem) {
- return wrappedItem;
- } else if (!deep && (root = getTreeScope(wrappedItem).root)) {
- if (root instanceof scope.wrappers.ShadowRoot) {
- return findOne(this, selector);
- }
- }
- return wrappedItem;
- },
- querySelectorAll: function(selector) {
- var shimmed = shimSelector(selector);
- var deep = shimmed !== selector;
- selector = shimmed;
- var result = new NodeList();
- result.length = querySelectorAllFiltered.call(this, matchesSelector, 0, result, selector, deep);
- return result;
- }
- };
- var MatchesInterface = {
- matches: function(selector) {
- selector = shimMatchesSelector(selector);
- return scope.originalMatches.call(unsafeUnwrap(this), selector);
- }
- };
- function getElementsByTagNameFiltered(p, index, result, localName, lowercase) {
- var target = unsafeUnwrap(this);
- var list;
- var root = getTreeScope(this).root;
- if (root instanceof scope.wrappers.ShadowRoot) {
- return findElements(this, index, result, p, localName, lowercase);
- } else if (target instanceof OriginalElement) {
- list = originalElementGetElementsByTagName.call(target, localName, lowercase);
- } else if (target instanceof OriginalDocument) {
- list = originalDocumentGetElementsByTagName.call(target, localName, lowercase);
- } else {
- return findElements(this, index, result, p, localName, lowercase);
- }
- return filterNodeList(list, index, result, false);
- }
- function getElementsByTagNameNSFiltered(p, index, result, ns, localName) {
- var target = unsafeUnwrap(this);
- var list;
- var root = getTreeScope(this).root;
- if (root instanceof scope.wrappers.ShadowRoot) {
- return findElements(this, index, result, p, ns, localName);
- } else if (target instanceof OriginalElement) {
- list = originalElementGetElementsByTagNameNS.call(target, ns, localName);
- } else if (target instanceof OriginalDocument) {
- list = originalDocumentGetElementsByTagNameNS.call(target, ns, localName);
- } else {
- return findElements(this, index, result, p, ns, localName);
- }
- return filterNodeList(list, index, result, false);
- }
- var GetElementsByInterface = {
- getElementsByTagName: function(localName) {
- var result = new HTMLCollection();
- var match = localName === "*" ? matchesEveryThing : matchesTagName;
- result.length = getElementsByTagNameFiltered.call(this, match, 0, result, localName, localName.toLowerCase());
- return result;
- },
- getElementsByClassName: function(className) {
- return this.querySelectorAll("." + className);
- },
- getElementsByTagNameNS: function(ns, localName) {
- var result = new HTMLCollection();
- var match = null;
- if (ns === "*") {
- match = localName === "*" ? matchesEveryThing : matchesLocalNameOnly;
- } else {
- match = localName === "*" ? matchesNameSpace : matchesLocalNameNS;
- }
- result.length = getElementsByTagNameNSFiltered.call(this, match, 0, result, ns || null, localName);
- return result;
- }
- };
- scope.GetElementsByInterface = GetElementsByInterface;
- scope.SelectorsInterface = SelectorsInterface;
- scope.MatchesInterface = MatchesInterface;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var NodeList = scope.wrappers.NodeList;
- function forwardElement(node) {
- while (node && node.nodeType !== Node.ELEMENT_NODE) {
- node = node.nextSibling;
- }
- return node;
- }
- function backwardsElement(node) {
- while (node && node.nodeType !== Node.ELEMENT_NODE) {
- node = node.previousSibling;
- }
- return node;
- }
- var ParentNodeInterface = {
- get firstElementChild() {
- return forwardElement(this.firstChild);
- },
- get lastElementChild() {
- return backwardsElement(this.lastChild);
- },
- get childElementCount() {
- var count = 0;
- for (var child = this.firstElementChild; child; child = child.nextElementSibling) {
- count++;
- }
- return count;
- },
- get children() {
- var wrapperList = new NodeList();
- var i = 0;
- for (var child = this.firstElementChild; child; child = child.nextElementSibling) {
- wrapperList[i++] = child;
- }
- wrapperList.length = i;
- return wrapperList;
- },
- remove: function() {
- var p = this.parentNode;
- if (p) p.removeChild(this);
- }
- };
- var ChildNodeInterface = {
- get nextElementSibling() {
- return forwardElement(this.nextSibling);
- },
- get previousElementSibling() {
- return backwardsElement(this.previousSibling);
- }
- };
- scope.ChildNodeInterface = ChildNodeInterface;
- scope.ParentNodeInterface = ParentNodeInterface;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var ChildNodeInterface = scope.ChildNodeInterface;
- var Node = scope.wrappers.Node;
- var enqueueMutation = scope.enqueueMutation;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var OriginalCharacterData = window.CharacterData;
- function CharacterData(node) {
- Node.call(this, node);
- }
- CharacterData.prototype = Object.create(Node.prototype);
- mixin(CharacterData.prototype, {
- get textContent() {
- return this.data;
- },
- set textContent(value) {
- this.data = value;
- },
- get data() {
- return unsafeUnwrap(this).data;
- },
- set data(value) {
- var oldValue = unsafeUnwrap(this).data;
- enqueueMutation(this, "characterData", {
- oldValue: oldValue
- });
- unsafeUnwrap(this).data = value;
- }
- });
- mixin(CharacterData.prototype, ChildNodeInterface);
- registerWrapper(OriginalCharacterData, CharacterData, document.createTextNode(""));
- scope.wrappers.CharacterData = CharacterData;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var CharacterData = scope.wrappers.CharacterData;
- var enqueueMutation = scope.enqueueMutation;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- function toUInt32(x) {
- return x >>> 0;
- }
- var OriginalText = window.Text;
- function Text(node) {
- CharacterData.call(this, node);
- }
- Text.prototype = Object.create(CharacterData.prototype);
- mixin(Text.prototype, {
- splitText: function(offset) {
- offset = toUInt32(offset);
- var s = this.data;
- if (offset > s.length) throw new Error("IndexSizeError");
- var head = s.slice(0, offset);
- var tail = s.slice(offset);
- this.data = head;
- var newTextNode = this.ownerDocument.createTextNode(tail);
- if (this.parentNode) this.parentNode.insertBefore(newTextNode, this.nextSibling);
- return newTextNode;
- }
- });
- registerWrapper(OriginalText, Text, document.createTextNode(""));
- scope.wrappers.Text = Text;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- if (!window.DOMTokenList) {
- console.warn("Missing DOMTokenList prototype, please include a " + "compatible classList polyfill such as http://goo.gl/uTcepH.");
- return;
- }
- var unsafeUnwrap = scope.unsafeUnwrap;
- var enqueueMutation = scope.enqueueMutation;
- function getClass(el) {
- return unsafeUnwrap(el).getAttribute("class");
- }
- function enqueueClassAttributeChange(el, oldValue) {
- enqueueMutation(el, "attributes", {
- name: "class",
- namespace: null,
- oldValue: oldValue
- });
- }
- function invalidateClass(el) {
- scope.invalidateRendererBasedOnAttribute(el, "class");
- }
- function changeClass(tokenList, method, args) {
- var ownerElement = tokenList.ownerElement_;
- if (ownerElement == null) {
- return method.apply(tokenList, args);
- }
- var oldValue = getClass(ownerElement);
- var retv = method.apply(tokenList, args);
- if (getClass(ownerElement) !== oldValue) {
- enqueueClassAttributeChange(ownerElement, oldValue);
- invalidateClass(ownerElement);
- }
- return retv;
- }
- var oldAdd = DOMTokenList.prototype.add;
- DOMTokenList.prototype.add = function() {
- changeClass(this, oldAdd, arguments);
- };
- var oldRemove = DOMTokenList.prototype.remove;
- DOMTokenList.prototype.remove = function() {
- changeClass(this, oldRemove, arguments);
- };
- var oldToggle = DOMTokenList.prototype.toggle;
- DOMTokenList.prototype.toggle = function() {
- return changeClass(this, oldToggle, arguments);
- };
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var ChildNodeInterface = scope.ChildNodeInterface;
- var GetElementsByInterface = scope.GetElementsByInterface;
- var Node = scope.wrappers.Node;
- var ParentNodeInterface = scope.ParentNodeInterface;
- var SelectorsInterface = scope.SelectorsInterface;
- var MatchesInterface = scope.MatchesInterface;
- var addWrapNodeListMethod = scope.addWrapNodeListMethod;
- var enqueueMutation = scope.enqueueMutation;
- var mixin = scope.mixin;
- var oneOf = scope.oneOf;
- var registerWrapper = scope.registerWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var wrappers = scope.wrappers;
- var OriginalElement = window.Element;
- var matchesNames = [ "matches", "mozMatchesSelector", "msMatchesSelector", "webkitMatchesSelector" ].filter(function(name) {
- return OriginalElement.prototype[name];
- });
- var matchesName = matchesNames[0];
- var originalMatches = OriginalElement.prototype[matchesName];
- function invalidateRendererBasedOnAttribute(element, name) {
- var p = element.parentNode;
- if (!p || !p.shadowRoot) return;
- var renderer = scope.getRendererForHost(p);
- if (renderer.dependsOnAttribute(name)) renderer.invalidate();
- }
- function enqueAttributeChange(element, name, oldValue) {
- enqueueMutation(element, "attributes", {
- name: name,
- namespace: null,
- oldValue: oldValue
- });
- }
- var classListTable = new WeakMap();
- function Element(node) {
- Node.call(this, node);
- }
- Element.prototype = Object.create(Node.prototype);
- mixin(Element.prototype, {
- createShadowRoot: function() {
- var newShadowRoot = new wrappers.ShadowRoot(this);
- unsafeUnwrap(this).polymerShadowRoot_ = newShadowRoot;
- var renderer = scope.getRendererForHost(this);
- renderer.invalidate();
- return newShadowRoot;
- },
- get shadowRoot() {
- return unsafeUnwrap(this).polymerShadowRoot_ || null;
- },
- setAttribute: function(name, value) {
- var oldValue = unsafeUnwrap(this).getAttribute(name);
- unsafeUnwrap(this).setAttribute(name, value);
- enqueAttributeChange(this, name, oldValue);
- invalidateRendererBasedOnAttribute(this, name);
- },
- removeAttribute: function(name) {
- var oldValue = unsafeUnwrap(this).getAttribute(name);
- unsafeUnwrap(this).removeAttribute(name);
- enqueAttributeChange(this, name, oldValue);
- invalidateRendererBasedOnAttribute(this, name);
- },
- get classList() {
- var list = classListTable.get(this);
- if (!list) {
- list = unsafeUnwrap(this).classList;
- if (!list) return;
- list.ownerElement_ = this;
- classListTable.set(this, list);
- }
- return list;
- },
- get className() {
- return unsafeUnwrap(this).className;
- },
- set className(v) {
- this.setAttribute("class", v);
- },
- get id() {
- return unsafeUnwrap(this).id;
- },
- set id(v) {
- this.setAttribute("id", v);
- }
- });
- matchesNames.forEach(function(name) {
- if (name !== "matches") {
- Element.prototype[name] = function(selector) {
- return this.matches(selector);
- };
- }
- });
- if (OriginalElement.prototype.webkitCreateShadowRoot) {
- Element.prototype.webkitCreateShadowRoot = Element.prototype.createShadowRoot;
- }
- mixin(Element.prototype, ChildNodeInterface);
- mixin(Element.prototype, GetElementsByInterface);
- mixin(Element.prototype, ParentNodeInterface);
- mixin(Element.prototype, SelectorsInterface);
- mixin(Element.prototype, MatchesInterface);
- registerWrapper(OriginalElement, Element, document.createElementNS(null, "x"));
- scope.invalidateRendererBasedOnAttribute = invalidateRendererBasedOnAttribute;
- scope.matchesNames = matchesNames;
- scope.originalMatches = originalMatches;
- scope.wrappers.Element = Element;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var Element = scope.wrappers.Element;
- var defineGetter = scope.defineGetter;
- var enqueueMutation = scope.enqueueMutation;
- var mixin = scope.mixin;
- var nodesWereAdded = scope.nodesWereAdded;
- var nodesWereRemoved = scope.nodesWereRemoved;
- var registerWrapper = scope.registerWrapper;
- var snapshotNodeList = scope.snapshotNodeList;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var wrappers = scope.wrappers;
- var escapeAttrRegExp = /[&\u00A0"]/g;
- var escapeDataRegExp = /[&\u00A0<>]/g;
- function escapeReplace(c) {
- switch (c) {
- case "&":
- return "&amp;";
-
- case "<":
- return "&lt;";
-
- case ">":
- return "&gt;";
-
- case '"':
- return "&quot;";
-
- case " ":
- return "&nbsp;";
- }
- }
- function escapeAttr(s) {
- return s.replace(escapeAttrRegExp, escapeReplace);
- }
- function escapeData(s) {
- return s.replace(escapeDataRegExp, escapeReplace);
- }
- function makeSet(arr) {
- var set = {};
- for (var i = 0; i < arr.length; i++) {
- set[arr[i]] = true;
- }
- return set;
- }
- var voidElements = makeSet([ "area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr" ]);
- var plaintextParents = makeSet([ "style", "script", "xmp", "iframe", "noembed", "noframes", "plaintext", "noscript" ]);
- function getOuterHTML(node, parentNode) {
- switch (node.nodeType) {
- case Node.ELEMENT_NODE:
- var tagName = node.tagName.toLowerCase();
- var s = "<" + tagName;
- var attrs = node.attributes;
- for (var i = 0, attr; attr = attrs[i]; i++) {
- s += " " + attr.name + '="' + escapeAttr(attr.value) + '"';
- }
- s += ">";
- if (voidElements[tagName]) return s;
- return s + getInnerHTML(node) + "</" + tagName + ">";
-
- case Node.TEXT_NODE:
- var data = node.data;
- if (parentNode && plaintextParents[parentNode.localName]) return data;
- return escapeData(data);
-
- case Node.COMMENT_NODE:
- return "<!--" + node.data + "-->";
-
- default:
- console.error(node);
- throw new Error("not implemented");
- }
- }
- function getInnerHTML(node) {
- if (node instanceof wrappers.HTMLTemplateElement) node = node.content;
- var s = "";
- for (var child = node.firstChild; child; child = child.nextSibling) {
- s += getOuterHTML(child, node);
- }
- return s;
- }
- function setInnerHTML(node, value, opt_tagName) {
- var tagName = opt_tagName || "div";
- node.textContent = "";
- var tempElement = unwrap(node.ownerDocument.createElement(tagName));
- tempElement.innerHTML = value;
- var firstChild;
- while (firstChild = tempElement.firstChild) {
- node.appendChild(wrap(firstChild));
- }
- }
- var oldIe = /MSIE/.test(navigator.userAgent);
- var OriginalHTMLElement = window.HTMLElement;
- var OriginalHTMLTemplateElement = window.HTMLTemplateElement;
- function HTMLElement(node) {
- Element.call(this, node);
- }
- HTMLElement.prototype = Object.create(Element.prototype);
- mixin(HTMLElement.prototype, {
- get innerHTML() {
- return getInnerHTML(this);
- },
- set innerHTML(value) {
- if (oldIe && plaintextParents[this.localName]) {
- this.textContent = value;
- return;
- }
- var removedNodes = snapshotNodeList(this.childNodes);
- if (this.invalidateShadowRenderer()) {
- if (this instanceof wrappers.HTMLTemplateElement) setInnerHTML(this.content, value); else setInnerHTML(this, value, this.tagName);
- } else if (!OriginalHTMLTemplateElement && this instanceof wrappers.HTMLTemplateElement) {
- setInnerHTML(this.content, value);
- } else {
- unsafeUnwrap(this).innerHTML = value;
- }
- var addedNodes = snapshotNodeList(this.childNodes);
- enqueueMutation(this, "childList", {
- addedNodes: addedNodes,
- removedNodes: removedNodes
- });
- nodesWereRemoved(removedNodes);
- nodesWereAdded(addedNodes, this);
- },
- get outerHTML() {
- return getOuterHTML(this, this.parentNode);
- },
- set outerHTML(value) {
- var p = this.parentNode;
- if (p) {
- p.invalidateShadowRenderer();
- var df = frag(p, value);
- p.replaceChild(df, this);
- }
- },
- insertAdjacentHTML: function(position, text) {
- var contextElement, refNode;
- switch (String(position).toLowerCase()) {
- case "beforebegin":
- contextElement = this.parentNode;
- refNode = this;
- break;
-
- case "afterend":
- contextElement = this.parentNode;
- refNode = this.nextSibling;
- break;
-
- case "afterbegin":
- contextElement = this;
- refNode = this.firstChild;
- break;
-
- case "beforeend":
- contextElement = this;
- refNode = null;
- break;
-
- default:
- return;
- }
- var df = frag(contextElement, text);
- contextElement.insertBefore(df, refNode);
- },
- get hidden() {
- return this.hasAttribute("hidden");
- },
- set hidden(v) {
- if (v) {
- this.setAttribute("hidden", "");
- } else {
- this.removeAttribute("hidden");
- }
- }
- });
- function frag(contextElement, html) {
- var p = unwrap(contextElement.cloneNode(false));
- p.innerHTML = html;
- var df = unwrap(document.createDocumentFragment());
- var c;
- while (c = p.firstChild) {
- df.appendChild(c);
- }
- return wrap(df);
- }
- function getter(name) {
- return function() {
- scope.renderAllPending();
- return unsafeUnwrap(this)[name];
- };
- }
- function getterRequiresRendering(name) {
- defineGetter(HTMLElement, name, getter(name));
- }
- [ "clientHeight", "clientLeft", "clientTop", "clientWidth", "offsetHeight", "offsetLeft", "offsetTop", "offsetWidth", "scrollHeight", "scrollWidth" ].forEach(getterRequiresRendering);
- function getterAndSetterRequiresRendering(name) {
- Object.defineProperty(HTMLElement.prototype, name, {
- get: getter(name),
- set: function(v) {
- scope.renderAllPending();
- unsafeUnwrap(this)[name] = v;
- },
- configurable: true,
- enumerable: true
- });
- }
- [ "scrollLeft", "scrollTop" ].forEach(getterAndSetterRequiresRendering);
- function methodRequiresRendering(name) {
- Object.defineProperty(HTMLElement.prototype, name, {
- value: function() {
- scope.renderAllPending();
- return unsafeUnwrap(this)[name].apply(unsafeUnwrap(this), arguments);
- },
- configurable: true,
- enumerable: true
- });
- }
- [ "getBoundingClientRect", "getClientRects", "scrollIntoView" ].forEach(methodRequiresRendering);
- registerWrapper(OriginalHTMLElement, HTMLElement, document.createElement("b"));
- scope.wrappers.HTMLElement = HTMLElement;
- scope.getInnerHTML = getInnerHTML;
- scope.setInnerHTML = setInnerHTML;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var wrap = scope.wrap;
- var OriginalHTMLCanvasElement = window.HTMLCanvasElement;
- function HTMLCanvasElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLCanvasElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLCanvasElement.prototype, {
- getContext: function() {
- var context = unsafeUnwrap(this).getContext.apply(unsafeUnwrap(this), arguments);
- return context && wrap(context);
- }
- });
- registerWrapper(OriginalHTMLCanvasElement, HTMLCanvasElement, document.createElement("canvas"));
- scope.wrappers.HTMLCanvasElement = HTMLCanvasElement;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var OriginalHTMLContentElement = window.HTMLContentElement;
- function HTMLContentElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLContentElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLContentElement.prototype, {
- constructor: HTMLContentElement,
- get select() {
- return this.getAttribute("select");
- },
- set select(value) {
- this.setAttribute("select", value);
- },
- setAttribute: function(n, v) {
- HTMLElement.prototype.setAttribute.call(this, n, v);
- if (String(n).toLowerCase() === "select") this.invalidateShadowRenderer(true);
- }
- });
- if (OriginalHTMLContentElement) registerWrapper(OriginalHTMLContentElement, HTMLContentElement);
- scope.wrappers.HTMLContentElement = HTMLContentElement;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var wrapHTMLCollection = scope.wrapHTMLCollection;
- var unwrap = scope.unwrap;
- var OriginalHTMLFormElement = window.HTMLFormElement;
- function HTMLFormElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLFormElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLFormElement.prototype, {
- get elements() {
- return wrapHTMLCollection(unwrap(this).elements);
- }
- });
- registerWrapper(OriginalHTMLFormElement, HTMLFormElement, document.createElement("form"));
- scope.wrappers.HTMLFormElement = HTMLFormElement;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var registerWrapper = scope.registerWrapper;
- var unwrap = scope.unwrap;
- var rewrap = scope.rewrap;
- var OriginalHTMLImageElement = window.HTMLImageElement;
- function HTMLImageElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLImageElement.prototype = Object.create(HTMLElement.prototype);
- registerWrapper(OriginalHTMLImageElement, HTMLImageElement, document.createElement("img"));
- function Image(width, height) {
- if (!(this instanceof Image)) {
- throw new TypeError("DOM object constructor cannot be called as a function.");
- }
- var node = unwrap(document.createElement("img"));
- HTMLElement.call(this, node);
- rewrap(node, this);
- if (width !== undefined) node.width = width;
- if (height !== undefined) node.height = height;
- }
- Image.prototype = HTMLImageElement.prototype;
- scope.wrappers.HTMLImageElement = HTMLImageElement;
- scope.wrappers.Image = Image;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var NodeList = scope.wrappers.NodeList;
- var registerWrapper = scope.registerWrapper;
- var OriginalHTMLShadowElement = window.HTMLShadowElement;
- function HTMLShadowElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLShadowElement.prototype = Object.create(HTMLElement.prototype);
- HTMLShadowElement.prototype.constructor = HTMLShadowElement;
- if (OriginalHTMLShadowElement) registerWrapper(OriginalHTMLShadowElement, HTMLShadowElement);
- scope.wrappers.HTMLShadowElement = HTMLShadowElement;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var contentTable = new WeakMap();
- var templateContentsOwnerTable = new WeakMap();
- function getTemplateContentsOwner(doc) {
- if (!doc.defaultView) return doc;
- var d = templateContentsOwnerTable.get(doc);
- if (!d) {
- d = doc.implementation.createHTMLDocument("");
- while (d.lastChild) {
- d.removeChild(d.lastChild);
- }
- templateContentsOwnerTable.set(doc, d);
- }
- return d;
- }
- function extractContent(templateElement) {
- var doc = getTemplateContentsOwner(templateElement.ownerDocument);
- var df = unwrap(doc.createDocumentFragment());
- var child;
- while (child = templateElement.firstChild) {
- df.appendChild(child);
- }
- return df;
- }
- var OriginalHTMLTemplateElement = window.HTMLTemplateElement;
- function HTMLTemplateElement(node) {
- HTMLElement.call(this, node);
- if (!OriginalHTMLTemplateElement) {
- var content = extractContent(node);
- contentTable.set(this, wrap(content));
- }
- }
- HTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLTemplateElement.prototype, {
- constructor: HTMLTemplateElement,
- get content() {
- if (OriginalHTMLTemplateElement) return wrap(unsafeUnwrap(this).content);
- return contentTable.get(this);
- }
- });
- if (OriginalHTMLTemplateElement) registerWrapper(OriginalHTMLTemplateElement, HTMLTemplateElement);
- scope.wrappers.HTMLTemplateElement = HTMLTemplateElement;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var registerWrapper = scope.registerWrapper;
- var OriginalHTMLMediaElement = window.HTMLMediaElement;
- if (!OriginalHTMLMediaElement) return;
- function HTMLMediaElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLMediaElement.prototype = Object.create(HTMLElement.prototype);
- registerWrapper(OriginalHTMLMediaElement, HTMLMediaElement, document.createElement("audio"));
- scope.wrappers.HTMLMediaElement = HTMLMediaElement;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLMediaElement = scope.wrappers.HTMLMediaElement;
- var registerWrapper = scope.registerWrapper;
- var unwrap = scope.unwrap;
- var rewrap = scope.rewrap;
- var OriginalHTMLAudioElement = window.HTMLAudioElement;
- if (!OriginalHTMLAudioElement) return;
- function HTMLAudioElement(node) {
- HTMLMediaElement.call(this, node);
- }
- HTMLAudioElement.prototype = Object.create(HTMLMediaElement.prototype);
- registerWrapper(OriginalHTMLAudioElement, HTMLAudioElement, document.createElement("audio"));
- function Audio(src) {
- if (!(this instanceof Audio)) {
- throw new TypeError("DOM object constructor cannot be called as a function.");
- }
- var node = unwrap(document.createElement("audio"));
- HTMLMediaElement.call(this, node);
- rewrap(node, this);
- node.setAttribute("preload", "auto");
- if (src !== undefined) node.setAttribute("src", src);
- }
- Audio.prototype = HTMLAudioElement.prototype;
- scope.wrappers.HTMLAudioElement = HTMLAudioElement;
- scope.wrappers.Audio = Audio;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var rewrap = scope.rewrap;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var OriginalHTMLOptionElement = window.HTMLOptionElement;
- function trimText(s) {
- return s.replace(/\s+/g, " ").trim();
- }
- function HTMLOptionElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLOptionElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLOptionElement.prototype, {
- get text() {
- return trimText(this.textContent);
- },
- set text(value) {
- this.textContent = trimText(String(value));
- },
- get form() {
- return wrap(unwrap(this).form);
- }
- });
- registerWrapper(OriginalHTMLOptionElement, HTMLOptionElement, document.createElement("option"));
- function Option(text, value, defaultSelected, selected) {
- if (!(this instanceof Option)) {
- throw new TypeError("DOM object constructor cannot be called as a function.");
- }
- var node = unwrap(document.createElement("option"));
- HTMLElement.call(this, node);
- rewrap(node, this);
- if (text !== undefined) node.text = text;
- if (value !== undefined) node.setAttribute("value", value);
- if (defaultSelected === true) node.setAttribute("selected", "");
- node.selected = selected === true;
- }
- Option.prototype = HTMLOptionElement.prototype;
- scope.wrappers.HTMLOptionElement = HTMLOptionElement;
- scope.wrappers.Option = Option;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var OriginalHTMLSelectElement = window.HTMLSelectElement;
- function HTMLSelectElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLSelectElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLSelectElement.prototype, {
- add: function(element, before) {
- if (typeof before === "object") before = unwrap(before);
- unwrap(this).add(unwrap(element), before);
- },
- remove: function(indexOrNode) {
- if (indexOrNode === undefined) {
- HTMLElement.prototype.remove.call(this);
- return;
- }
- if (typeof indexOrNode === "object") indexOrNode = unwrap(indexOrNode);
- unwrap(this).remove(indexOrNode);
- },
- get form() {
- return wrap(unwrap(this).form);
- }
- });
- registerWrapper(OriginalHTMLSelectElement, HTMLSelectElement, document.createElement("select"));
- scope.wrappers.HTMLSelectElement = HTMLSelectElement;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var wrapHTMLCollection = scope.wrapHTMLCollection;
- var OriginalHTMLTableElement = window.HTMLTableElement;
- function HTMLTableElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLTableElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLTableElement.prototype, {
- get caption() {
- return wrap(unwrap(this).caption);
- },
- createCaption: function() {
- return wrap(unwrap(this).createCaption());
- },
- get tHead() {
- return wrap(unwrap(this).tHead);
- },
- createTHead: function() {
- return wrap(unwrap(this).createTHead());
- },
- createTFoot: function() {
- return wrap(unwrap(this).createTFoot());
- },
- get tFoot() {
- return wrap(unwrap(this).tFoot);
- },
- get tBodies() {
- return wrapHTMLCollection(unwrap(this).tBodies);
- },
- createTBody: function() {
- return wrap(unwrap(this).createTBody());
- },
- get rows() {
- return wrapHTMLCollection(unwrap(this).rows);
- },
- insertRow: function(index) {
- return wrap(unwrap(this).insertRow(index));
- }
- });
- registerWrapper(OriginalHTMLTableElement, HTMLTableElement, document.createElement("table"));
- scope.wrappers.HTMLTableElement = HTMLTableElement;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var wrapHTMLCollection = scope.wrapHTMLCollection;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var OriginalHTMLTableSectionElement = window.HTMLTableSectionElement;
- function HTMLTableSectionElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLTableSectionElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLTableSectionElement.prototype, {
- constructor: HTMLTableSectionElement,
- get rows() {
- return wrapHTMLCollection(unwrap(this).rows);
- },
- insertRow: function(index) {
- return wrap(unwrap(this).insertRow(index));
- }
- });
- registerWrapper(OriginalHTMLTableSectionElement, HTMLTableSectionElement, document.createElement("thead"));
- scope.wrappers.HTMLTableSectionElement = HTMLTableSectionElement;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var wrapHTMLCollection = scope.wrapHTMLCollection;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var OriginalHTMLTableRowElement = window.HTMLTableRowElement;
- function HTMLTableRowElement(node) {
- HTMLElement.call(this, node);
- }
- HTMLTableRowElement.prototype = Object.create(HTMLElement.prototype);
- mixin(HTMLTableRowElement.prototype, {
- get cells() {
- return wrapHTMLCollection(unwrap(this).cells);
- },
- insertCell: function(index) {
- return wrap(unwrap(this).insertCell(index));
- }
- });
- registerWrapper(OriginalHTMLTableRowElement, HTMLTableRowElement, document.createElement("tr"));
- scope.wrappers.HTMLTableRowElement = HTMLTableRowElement;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLContentElement = scope.wrappers.HTMLContentElement;
- var HTMLElement = scope.wrappers.HTMLElement;
- var HTMLShadowElement = scope.wrappers.HTMLShadowElement;
- var HTMLTemplateElement = scope.wrappers.HTMLTemplateElement;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var OriginalHTMLUnknownElement = window.HTMLUnknownElement;
- function HTMLUnknownElement(node) {
- switch (node.localName) {
- case "content":
- return new HTMLContentElement(node);
-
- case "shadow":
- return new HTMLShadowElement(node);
-
- case "template":
- return new HTMLTemplateElement(node);
- }
- HTMLElement.call(this, node);
- }
- HTMLUnknownElement.prototype = Object.create(HTMLElement.prototype);
- registerWrapper(OriginalHTMLUnknownElement, HTMLUnknownElement);
- scope.wrappers.HTMLUnknownElement = HTMLUnknownElement;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var Element = scope.wrappers.Element;
- var HTMLElement = scope.wrappers.HTMLElement;
- var registerObject = scope.registerObject;
- var defineWrapGetter = scope.defineWrapGetter;
- var SVG_NS = "http://www.w3.org/2000/svg";
- var svgTitleElement = document.createElementNS(SVG_NS, "title");
- var SVGTitleElement = registerObject(svgTitleElement);
- var SVGElement = Object.getPrototypeOf(SVGTitleElement.prototype).constructor;
- if (!("classList" in svgTitleElement)) {
- var descr = Object.getOwnPropertyDescriptor(Element.prototype, "classList");
- Object.defineProperty(HTMLElement.prototype, "classList", descr);
- delete Element.prototype.classList;
- }
- defineWrapGetter(SVGElement, "ownerSVGElement");
- scope.wrappers.SVGElement = SVGElement;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var OriginalSVGUseElement = window.SVGUseElement;
- var SVG_NS = "http://www.w3.org/2000/svg";
- var gWrapper = wrap(document.createElementNS(SVG_NS, "g"));
- var useElement = document.createElementNS(SVG_NS, "use");
- var SVGGElement = gWrapper.constructor;
- var parentInterfacePrototype = Object.getPrototypeOf(SVGGElement.prototype);
- var parentInterface = parentInterfacePrototype.constructor;
- function SVGUseElement(impl) {
- parentInterface.call(this, impl);
- }
- SVGUseElement.prototype = Object.create(parentInterfacePrototype);
- if ("instanceRoot" in useElement) {
- mixin(SVGUseElement.prototype, {
- get instanceRoot() {
- return wrap(unwrap(this).instanceRoot);
- },
- get animatedInstanceRoot() {
- return wrap(unwrap(this).animatedInstanceRoot);
- }
- });
- }
- registerWrapper(OriginalSVGUseElement, SVGUseElement, useElement);
- scope.wrappers.SVGUseElement = SVGUseElement;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var EventTarget = scope.wrappers.EventTarget;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var wrap = scope.wrap;
- var OriginalSVGElementInstance = window.SVGElementInstance;
- if (!OriginalSVGElementInstance) return;
- function SVGElementInstance(impl) {
- EventTarget.call(this, impl);
- }
- SVGElementInstance.prototype = Object.create(EventTarget.prototype);
- mixin(SVGElementInstance.prototype, {
- get correspondingElement() {
- return wrap(unsafeUnwrap(this).correspondingElement);
- },
- get correspondingUseElement() {
- return wrap(unsafeUnwrap(this).correspondingUseElement);
- },
- get parentNode() {
- return wrap(unsafeUnwrap(this).parentNode);
- },
- get childNodes() {
- throw new Error("Not implemented");
- },
- get firstChild() {
- return wrap(unsafeUnwrap(this).firstChild);
- },
- get lastChild() {
- return wrap(unsafeUnwrap(this).lastChild);
- },
- get previousSibling() {
- return wrap(unsafeUnwrap(this).previousSibling);
- },
- get nextSibling() {
- return wrap(unsafeUnwrap(this).nextSibling);
- }
- });
- registerWrapper(OriginalSVGElementInstance, SVGElementInstance);
- scope.wrappers.SVGElementInstance = SVGElementInstance;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var setWrapper = scope.setWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var unwrapIfNeeded = scope.unwrapIfNeeded;
- var wrap = scope.wrap;
- var OriginalCanvasRenderingContext2D = window.CanvasRenderingContext2D;
- function CanvasRenderingContext2D(impl) {
- setWrapper(impl, this);
- }
- mixin(CanvasRenderingContext2D.prototype, {
- get canvas() {
- return wrap(unsafeUnwrap(this).canvas);
- },
- drawImage: function() {
- arguments[0] = unwrapIfNeeded(arguments[0]);
- unsafeUnwrap(this).drawImage.apply(unsafeUnwrap(this), arguments);
- },
- createPattern: function() {
- arguments[0] = unwrap(arguments[0]);
- return unsafeUnwrap(this).createPattern.apply(unsafeUnwrap(this), arguments);
- }
- });
- registerWrapper(OriginalCanvasRenderingContext2D, CanvasRenderingContext2D, document.createElement("canvas").getContext("2d"));
- scope.wrappers.CanvasRenderingContext2D = CanvasRenderingContext2D;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var setWrapper = scope.setWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrapIfNeeded = scope.unwrapIfNeeded;
- var wrap = scope.wrap;
- var OriginalWebGLRenderingContext = window.WebGLRenderingContext;
- if (!OriginalWebGLRenderingContext) return;
- function WebGLRenderingContext(impl) {
- setWrapper(impl, this);
- }
- mixin(WebGLRenderingContext.prototype, {
- get canvas() {
- return wrap(unsafeUnwrap(this).canvas);
- },
- texImage2D: function() {
- arguments[5] = unwrapIfNeeded(arguments[5]);
- unsafeUnwrap(this).texImage2D.apply(unsafeUnwrap(this), arguments);
- },
- texSubImage2D: function() {
- arguments[6] = unwrapIfNeeded(arguments[6]);
- unsafeUnwrap(this).texSubImage2D.apply(unsafeUnwrap(this), arguments);
- }
- });
- var instanceProperties = /WebKit/.test(navigator.userAgent) ? {
- drawingBufferHeight: null,
- drawingBufferWidth: null
- } : {};
- registerWrapper(OriginalWebGLRenderingContext, WebGLRenderingContext, instanceProperties);
- scope.wrappers.WebGLRenderingContext = WebGLRenderingContext;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var registerWrapper = scope.registerWrapper;
- var setWrapper = scope.setWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var unwrapIfNeeded = scope.unwrapIfNeeded;
- var wrap = scope.wrap;
- var OriginalRange = window.Range;
- function Range(impl) {
- setWrapper(impl, this);
- }
- Range.prototype = {
- get startContainer() {
- return wrap(unsafeUnwrap(this).startContainer);
- },
- get endContainer() {
- return wrap(unsafeUnwrap(this).endContainer);
- },
- get commonAncestorContainer() {
- return wrap(unsafeUnwrap(this).commonAncestorContainer);
- },
- setStart: function(refNode, offset) {
- unsafeUnwrap(this).setStart(unwrapIfNeeded(refNode), offset);
- },
- setEnd: function(refNode, offset) {
- unsafeUnwrap(this).setEnd(unwrapIfNeeded(refNode), offset);
- },
- setStartBefore: function(refNode) {
- unsafeUnwrap(this).setStartBefore(unwrapIfNeeded(refNode));
- },
- setStartAfter: function(refNode) {
- unsafeUnwrap(this).setStartAfter(unwrapIfNeeded(refNode));
- },
- setEndBefore: function(refNode) {
- unsafeUnwrap(this).setEndBefore(unwrapIfNeeded(refNode));
- },
- setEndAfter: function(refNode) {
- unsafeUnwrap(this).setEndAfter(unwrapIfNeeded(refNode));
- },
- selectNode: function(refNode) {
- unsafeUnwrap(this).selectNode(unwrapIfNeeded(refNode));
- },
- selectNodeContents: function(refNode) {
- unsafeUnwrap(this).selectNodeContents(unwrapIfNeeded(refNode));
- },
- compareBoundaryPoints: function(how, sourceRange) {
- return unsafeUnwrap(this).compareBoundaryPoints(how, unwrap(sourceRange));
- },
- extractContents: function() {
- return wrap(unsafeUnwrap(this).extractContents());
- },
- cloneContents: function() {
- return wrap(unsafeUnwrap(this).cloneContents());
- },
- insertNode: function(node) {
- unsafeUnwrap(this).insertNode(unwrapIfNeeded(node));
- },
- surroundContents: function(newParent) {
- unsafeUnwrap(this).surroundContents(unwrapIfNeeded(newParent));
- },
- cloneRange: function() {
- return wrap(unsafeUnwrap(this).cloneRange());
- },
- isPointInRange: function(node, offset) {
- return unsafeUnwrap(this).isPointInRange(unwrapIfNeeded(node), offset);
- },
- comparePoint: function(node, offset) {
- return unsafeUnwrap(this).comparePoint(unwrapIfNeeded(node), offset);
- },
- intersectsNode: function(node) {
- return unsafeUnwrap(this).intersectsNode(unwrapIfNeeded(node));
- },
- toString: function() {
- return unsafeUnwrap(this).toString();
- }
- };
- if (OriginalRange.prototype.createContextualFragment) {
- Range.prototype.createContextualFragment = function(html) {
- return wrap(unsafeUnwrap(this).createContextualFragment(html));
- };
- }
- registerWrapper(window.Range, Range, document.createRange());
- scope.wrappers.Range = Range;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var GetElementsByInterface = scope.GetElementsByInterface;
- var ParentNodeInterface = scope.ParentNodeInterface;
- var SelectorsInterface = scope.SelectorsInterface;
- var mixin = scope.mixin;
- var registerObject = scope.registerObject;
- var DocumentFragment = registerObject(document.createDocumentFragment());
- mixin(DocumentFragment.prototype, ParentNodeInterface);
- mixin(DocumentFragment.prototype, SelectorsInterface);
- mixin(DocumentFragment.prototype, GetElementsByInterface);
- var Comment = registerObject(document.createComment(""));
- scope.wrappers.Comment = Comment;
- scope.wrappers.DocumentFragment = DocumentFragment;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var DocumentFragment = scope.wrappers.DocumentFragment;
- var TreeScope = scope.TreeScope;
- var elementFromPoint = scope.elementFromPoint;
- var getInnerHTML = scope.getInnerHTML;
- var getTreeScope = scope.getTreeScope;
- var mixin = scope.mixin;
- var rewrap = scope.rewrap;
- var setInnerHTML = scope.setInnerHTML;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var shadowHostTable = new WeakMap();
- var nextOlderShadowTreeTable = new WeakMap();
- var spaceCharRe = /[ \t\n\r\f]/;
- function ShadowRoot(hostWrapper) {
- var node = unwrap(unsafeUnwrap(hostWrapper).ownerDocument.createDocumentFragment());
- DocumentFragment.call(this, node);
- rewrap(node, this);
- var oldShadowRoot = hostWrapper.shadowRoot;
- nextOlderShadowTreeTable.set(this, oldShadowRoot);
- this.treeScope_ = new TreeScope(this, getTreeScope(oldShadowRoot || hostWrapper));
- shadowHostTable.set(this, hostWrapper);
- }
- ShadowRoot.prototype = Object.create(DocumentFragment.prototype);
- mixin(ShadowRoot.prototype, {
- constructor: ShadowRoot,
- get innerHTML() {
- return getInnerHTML(this);
- },
- set innerHTML(value) {
- setInnerHTML(this, value);
- this.invalidateShadowRenderer();
- },
- get olderShadowRoot() {
- return nextOlderShadowTreeTable.get(this) || null;
- },
- get host() {
- return shadowHostTable.get(this) || null;
- },
- invalidateShadowRenderer: function() {
- return shadowHostTable.get(this).invalidateShadowRenderer();
- },
- elementFromPoint: function(x, y) {
- return elementFromPoint(this, this.ownerDocument, x, y);
- },
- getElementById: function(id) {
- if (spaceCharRe.test(id)) return null;
- return this.querySelector('[id="' + id + '"]');
- }
- });
- scope.wrappers.ShadowRoot = ShadowRoot;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var Element = scope.wrappers.Element;
- var HTMLContentElement = scope.wrappers.HTMLContentElement;
- var HTMLShadowElement = scope.wrappers.HTMLShadowElement;
- var Node = scope.wrappers.Node;
- var ShadowRoot = scope.wrappers.ShadowRoot;
- var assert = scope.assert;
- var getTreeScope = scope.getTreeScope;
- var mixin = scope.mixin;
- var oneOf = scope.oneOf;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var ArraySplice = scope.ArraySplice;
- function updateWrapperUpAndSideways(wrapper) {
- wrapper.previousSibling_ = wrapper.previousSibling;
- wrapper.nextSibling_ = wrapper.nextSibling;
- wrapper.parentNode_ = wrapper.parentNode;
- }
- function updateWrapperDown(wrapper) {
- wrapper.firstChild_ = wrapper.firstChild;
- wrapper.lastChild_ = wrapper.lastChild;
- }
- function updateAllChildNodes(parentNodeWrapper) {
- assert(parentNodeWrapper instanceof Node);
- for (var childWrapper = parentNodeWrapper.firstChild; childWrapper; childWrapper = childWrapper.nextSibling) {
- updateWrapperUpAndSideways(childWrapper);
- }
- updateWrapperDown(parentNodeWrapper);
- }
- function insertBefore(parentNodeWrapper, newChildWrapper, refChildWrapper) {
- var parentNode = unwrap(parentNodeWrapper);
- var newChild = unwrap(newChildWrapper);
- var refChild = refChildWrapper ? unwrap(refChildWrapper) : null;
- remove(newChildWrapper);
- updateWrapperUpAndSideways(newChildWrapper);
- if (!refChildWrapper) {
- parentNodeWrapper.lastChild_ = parentNodeWrapper.lastChild;
- if (parentNodeWrapper.lastChild === parentNodeWrapper.firstChild) parentNodeWrapper.firstChild_ = parentNodeWrapper.firstChild;
- var lastChildWrapper = wrap(parentNode.lastChild);
- if (lastChildWrapper) lastChildWrapper.nextSibling_ = lastChildWrapper.nextSibling;
- } else {
- if (parentNodeWrapper.firstChild === refChildWrapper) parentNodeWrapper.firstChild_ = refChildWrapper;
- refChildWrapper.previousSibling_ = refChildWrapper.previousSibling;
- }
- scope.originalInsertBefore.call(parentNode, newChild, refChild);
- }
- function remove(nodeWrapper) {
- var node = unwrap(nodeWrapper);
- var parentNode = node.parentNode;
- if (!parentNode) return;
- var parentNodeWrapper = wrap(parentNode);
- updateWrapperUpAndSideways(nodeWrapper);
- if (nodeWrapper.previousSibling) nodeWrapper.previousSibling.nextSibling_ = nodeWrapper;
- if (nodeWrapper.nextSibling) nodeWrapper.nextSibling.previousSibling_ = nodeWrapper;
- if (parentNodeWrapper.lastChild === nodeWrapper) parentNodeWrapper.lastChild_ = nodeWrapper;
- if (parentNodeWrapper.firstChild === nodeWrapper) parentNodeWrapper.firstChild_ = nodeWrapper;
- scope.originalRemoveChild.call(parentNode, node);
- }
- var distributedNodesTable = new WeakMap();
- var destinationInsertionPointsTable = new WeakMap();
- var rendererForHostTable = new WeakMap();
- function resetDistributedNodes(insertionPoint) {
- distributedNodesTable.set(insertionPoint, []);
- }
- function getDistributedNodes(insertionPoint) {
- var rv = distributedNodesTable.get(insertionPoint);
- if (!rv) distributedNodesTable.set(insertionPoint, rv = []);
- return rv;
- }
- function getChildNodesSnapshot(node) {
- var result = [], i = 0;
- for (var child = node.firstChild; child; child = child.nextSibling) {
- result[i++] = child;
- }
- return result;
- }
- var request = oneOf(window, [ "requestAnimationFrame", "mozRequestAnimationFrame", "webkitRequestAnimationFrame", "setTimeout" ]);
- var pendingDirtyRenderers = [];
- var renderTimer;
- function renderAllPending() {
- for (var i = 0; i < pendingDirtyRenderers.length; i++) {
- var renderer = pendingDirtyRenderers[i];
- var parentRenderer = renderer.parentRenderer;
- if (parentRenderer && parentRenderer.dirty) continue;
- renderer.render();
- }
- pendingDirtyRenderers = [];
- }
- function handleRequestAnimationFrame() {
- renderTimer = null;
- renderAllPending();
- }
- function getRendererForHost(host) {
- var renderer = rendererForHostTable.get(host);
- if (!renderer) {
- renderer = new ShadowRenderer(host);
- rendererForHostTable.set(host, renderer);
- }
- return renderer;
- }
- function getShadowRootAncestor(node) {
- var root = getTreeScope(node).root;
- if (root instanceof ShadowRoot) return root;
- return null;
- }
- function getRendererForShadowRoot(shadowRoot) {
- return getRendererForHost(shadowRoot.host);
- }
- var spliceDiff = new ArraySplice();
- spliceDiff.equals = function(renderNode, rawNode) {
- return unwrap(renderNode.node) === rawNode;
- };
- function RenderNode(node) {
- this.skip = false;
- this.node = node;
- this.childNodes = [];
- }
- RenderNode.prototype = {
- append: function(node) {
- var rv = new RenderNode(node);
- this.childNodes.push(rv);
- return rv;
- },
- sync: function(opt_added) {
- if (this.skip) return;
- var nodeWrapper = this.node;
- var newChildren = this.childNodes;
- var oldChildren = getChildNodesSnapshot(unwrap(nodeWrapper));
- var added = opt_added || new WeakMap();
- var splices = spliceDiff.calculateSplices(newChildren, oldChildren);
- var newIndex = 0, oldIndex = 0;
- var lastIndex = 0;
- for (var i = 0; i < splices.length; i++) {
- var splice = splices[i];
- for (;lastIndex < splice.index; lastIndex++) {
- oldIndex++;
- newChildren[newIndex++].sync(added);
- }
- var removedCount = splice.removed.length;
- for (var j = 0; j < removedCount; j++) {
- var wrapper = wrap(oldChildren[oldIndex++]);
- if (!added.get(wrapper)) remove(wrapper);
- }
- var addedCount = splice.addedCount;
- var refNode = oldChildren[oldIndex] && wrap(oldChildren[oldIndex]);
- for (var j = 0; j < addedCount; j++) {
- var newChildRenderNode = newChildren[newIndex++];
- var newChildWrapper = newChildRenderNode.node;
- insertBefore(nodeWrapper, newChildWrapper, refNode);
- added.set(newChildWrapper, true);
- newChildRenderNode.sync(added);
- }
- lastIndex += addedCount;
- }
- for (var i = lastIndex; i < newChildren.length; i++) {
- newChildren[i].sync(added);
- }
- }
- };
- function ShadowRenderer(host) {
- this.host = host;
- this.dirty = false;
- this.invalidateAttributes();
- this.associateNode(host);
- }
- ShadowRenderer.prototype = {
- render: function(opt_renderNode) {
- if (!this.dirty) return;
- this.invalidateAttributes();
- var host = this.host;
- this.distribution(host);
- var renderNode = opt_renderNode || new RenderNode(host);
- this.buildRenderTree(renderNode, host);
- var topMostRenderer = !opt_renderNode;
- if (topMostRenderer) renderNode.sync();
- this.dirty = false;
- },
- get parentRenderer() {
- return getTreeScope(this.host).renderer;
- },
- invalidate: function() {
- if (!this.dirty) {
- this.dirty = true;
- var parentRenderer = this.parentRenderer;
- if (parentRenderer) parentRenderer.invalidate();
- pendingDirtyRenderers.push(this);
- if (renderTimer) return;
- renderTimer = window[request](handleRequestAnimationFrame, 0);
- }
- },
- distribution: function(root) {
- this.resetAllSubtrees(root);
- this.distributionResolution(root);
- },
- resetAll: function(node) {
- if (isInsertionPoint(node)) resetDistributedNodes(node); else resetDestinationInsertionPoints(node);
- this.resetAllSubtrees(node);
- },
- resetAllSubtrees: function(node) {
- for (var child = node.firstChild; child; child = child.nextSibling) {
- this.resetAll(child);
- }
- if (node.shadowRoot) this.resetAll(node.shadowRoot);
- if (node.olderShadowRoot) this.resetAll(node.olderShadowRoot);
- },
- distributionResolution: function(node) {
- if (isShadowHost(node)) {
- var shadowHost = node;
- var pool = poolPopulation(shadowHost);
- var shadowTrees = getShadowTrees(shadowHost);
- for (var i = 0; i < shadowTrees.length; i++) {
- this.poolDistribution(shadowTrees[i], pool);
- }
- for (var i = shadowTrees.length - 1; i >= 0; i--) {
- var shadowTree = shadowTrees[i];
- var shadow = getShadowInsertionPoint(shadowTree);
- if (shadow) {
- var olderShadowRoot = shadowTree.olderShadowRoot;
- if (olderShadowRoot) {
- pool = poolPopulation(olderShadowRoot);
- }
- for (var j = 0; j < pool.length; j++) {
- destributeNodeInto(pool[j], shadow);
- }
- }
- this.distributionResolution(shadowTree);
- }
- }
- for (var child = node.firstChild; child; child = child.nextSibling) {
- this.distributionResolution(child);
- }
- },
- poolDistribution: function(node, pool) {
- if (node instanceof HTMLShadowElement) return;
- if (node instanceof HTMLContentElement) {
- var content = node;
- this.updateDependentAttributes(content.getAttribute("select"));
- var anyDistributed = false;
- for (var i = 0; i < pool.length; i++) {
- var node = pool[i];
- if (!node) continue;
- if (matches(node, content)) {
- destributeNodeInto(node, content);
- pool[i] = undefined;
- anyDistributed = true;
- }
- }
- if (!anyDistributed) {
- for (var child = content.firstChild; child; child = child.nextSibling) {
- destributeNodeInto(child, content);
- }
- }
- return;
- }
- for (var child = node.firstChild; child; child = child.nextSibling) {
- this.poolDistribution(child, pool);
- }
- },
- buildRenderTree: function(renderNode, node) {
- var children = this.compose(node);
- for (var i = 0; i < children.length; i++) {
- var child = children[i];
- var childRenderNode = renderNode.append(child);
- this.buildRenderTree(childRenderNode, child);
- }
- if (isShadowHost(node)) {
- var renderer = getRendererForHost(node);
- renderer.dirty = false;
- }
- },
- compose: function(node) {
- var children = [];
- var p = node.shadowRoot || node;
- for (var child = p.firstChild; child; child = child.nextSibling) {
- if (isInsertionPoint(child)) {
- this.associateNode(p);
- var distributedNodes = getDistributedNodes(child);
- for (var j = 0; j < distributedNodes.length; j++) {
- var distributedNode = distributedNodes[j];
- if (isFinalDestination(child, distributedNode)) children.push(distributedNode);
- }
- } else {
- children.push(child);
- }
- }
- return children;
- },
- invalidateAttributes: function() {
- this.attributes = Object.create(null);
- },
- updateDependentAttributes: function(selector) {
- if (!selector) return;
- var attributes = this.attributes;
- if (/\.\w+/.test(selector)) attributes["class"] = true;
- if (/#\w+/.test(selector)) attributes["id"] = true;
- selector.replace(/\[\s*([^\s=\|~\]]+)/g, function(_, name) {
- attributes[name] = true;
- });
- },
- dependsOnAttribute: function(name) {
- return this.attributes[name];
- },
- associateNode: function(node) {
- unsafeUnwrap(node).polymerShadowRenderer_ = this;
- }
- };
- function poolPopulation(node) {
- var pool = [];
- for (var child = node.firstChild; child; child = child.nextSibling) {
- if (isInsertionPoint(child)) {
- pool.push.apply(pool, getDistributedNodes(child));
- } else {
- pool.push(child);
- }
- }
- return pool;
- }
- function getShadowInsertionPoint(node) {
- if (node instanceof HTMLShadowElement) return node;
- if (node instanceof HTMLContentElement) return null;
- for (var child = node.firstChild; child; child = child.nextSibling) {
- var res = getShadowInsertionPoint(child);
- if (res) return res;
- }
- return null;
- }
- function destributeNodeInto(child, insertionPoint) {
- getDistributedNodes(insertionPoint).push(child);
- var points = destinationInsertionPointsTable.get(child);
- if (!points) destinationInsertionPointsTable.set(child, [ insertionPoint ]); else points.push(insertionPoint);
- }
- function getDestinationInsertionPoints(node) {
- return destinationInsertionPointsTable.get(node);
- }
- function resetDestinationInsertionPoints(node) {
- destinationInsertionPointsTable.set(node, undefined);
- }
- var selectorStartCharRe = /^(:not\()?[*.#[a-zA-Z_|]/;
- function matches(node, contentElement) {
- var select = contentElement.getAttribute("select");
- if (!select) return true;
- select = select.trim();
- if (!select) return true;
- if (!(node instanceof Element)) return false;
- if (!selectorStartCharRe.test(select)) return false;
- try {
- return node.matches(select);
- } catch (ex) {
- return false;
- }
- }
- function isFinalDestination(insertionPoint, node) {
- var points = getDestinationInsertionPoints(node);
- return points && points[points.length - 1] === insertionPoint;
- }
- function isInsertionPoint(node) {
- return node instanceof HTMLContentElement || node instanceof HTMLShadowElement;
- }
- function isShadowHost(shadowHost) {
- return shadowHost.shadowRoot;
- }
- function getShadowTrees(host) {
- var trees = [];
- for (var tree = host.shadowRoot; tree; tree = tree.olderShadowRoot) {
- trees.push(tree);
- }
- return trees;
- }
- function render(host) {
- new ShadowRenderer(host).render();
- }
- Node.prototype.invalidateShadowRenderer = function(force) {
- var renderer = unsafeUnwrap(this).polymerShadowRenderer_;
- if (renderer) {
- renderer.invalidate();
- return true;
- }
- return false;
- };
- HTMLContentElement.prototype.getDistributedNodes = HTMLShadowElement.prototype.getDistributedNodes = function() {
- renderAllPending();
- return getDistributedNodes(this);
- };
- Element.prototype.getDestinationInsertionPoints = function() {
- renderAllPending();
- return getDestinationInsertionPoints(this) || [];
- };
- HTMLContentElement.prototype.nodeIsInserted_ = HTMLShadowElement.prototype.nodeIsInserted_ = function() {
- this.invalidateShadowRenderer();
- var shadowRoot = getShadowRootAncestor(this);
- var renderer;
- if (shadowRoot) renderer = getRendererForShadowRoot(shadowRoot);
- unsafeUnwrap(this).polymerShadowRenderer_ = renderer;
- if (renderer) renderer.invalidate();
- };
- scope.getRendererForHost = getRendererForHost;
- scope.getShadowTrees = getShadowTrees;
- scope.renderAllPending = renderAllPending;
- scope.getDestinationInsertionPoints = getDestinationInsertionPoints;
- scope.visual = {
- insertBefore: insertBefore,
- remove: remove
- };
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var HTMLElement = scope.wrappers.HTMLElement;
- var assert = scope.assert;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var elementsWithFormProperty = [ "HTMLButtonElement", "HTMLFieldSetElement", "HTMLInputElement", "HTMLKeygenElement", "HTMLLabelElement", "HTMLLegendElement", "HTMLObjectElement", "HTMLOutputElement", "HTMLTextAreaElement" ];
- function createWrapperConstructor(name) {
- if (!window[name]) return;
- assert(!scope.wrappers[name]);
- var GeneratedWrapper = function(node) {
- HTMLElement.call(this, node);
- };
- GeneratedWrapper.prototype = Object.create(HTMLElement.prototype);
- mixin(GeneratedWrapper.prototype, {
- get form() {
- return wrap(unwrap(this).form);
- }
- });
- registerWrapper(window[name], GeneratedWrapper, document.createElement(name.slice(4, -7)));
- scope.wrappers[name] = GeneratedWrapper;
- }
- elementsWithFormProperty.forEach(createWrapperConstructor);
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var registerWrapper = scope.registerWrapper;
- var setWrapper = scope.setWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var unwrapIfNeeded = scope.unwrapIfNeeded;
- var wrap = scope.wrap;
- var OriginalSelection = window.Selection;
- function Selection(impl) {
- setWrapper(impl, this);
- }
- Selection.prototype = {
- get anchorNode() {
- return wrap(unsafeUnwrap(this).anchorNode);
- },
- get focusNode() {
- return wrap(unsafeUnwrap(this).focusNode);
- },
- addRange: function(range) {
- unsafeUnwrap(this).addRange(unwrap(range));
- },
- collapse: function(node, index) {
- unsafeUnwrap(this).collapse(unwrapIfNeeded(node), index);
- },
- containsNode: function(node, allowPartial) {
- return unsafeUnwrap(this).containsNode(unwrapIfNeeded(node), allowPartial);
- },
- extend: function(node, offset) {
- unsafeUnwrap(this).extend(unwrapIfNeeded(node), offset);
- },
- getRangeAt: function(index) {
- return wrap(unsafeUnwrap(this).getRangeAt(index));
- },
- removeRange: function(range) {
- unsafeUnwrap(this).removeRange(unwrap(range));
- },
- selectAllChildren: function(node) {
- unsafeUnwrap(this).selectAllChildren(unwrapIfNeeded(node));
- },
- toString: function() {
- return unsafeUnwrap(this).toString();
- }
- };
- registerWrapper(window.Selection, Selection, window.getSelection());
- scope.wrappers.Selection = Selection;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var GetElementsByInterface = scope.GetElementsByInterface;
- var Node = scope.wrappers.Node;
- var ParentNodeInterface = scope.ParentNodeInterface;
- var Selection = scope.wrappers.Selection;
- var SelectorsInterface = scope.SelectorsInterface;
- var ShadowRoot = scope.wrappers.ShadowRoot;
- var TreeScope = scope.TreeScope;
- var cloneNode = scope.cloneNode;
- var defineWrapGetter = scope.defineWrapGetter;
- var elementFromPoint = scope.elementFromPoint;
- var forwardMethodsToWrapper = scope.forwardMethodsToWrapper;
- var matchesNames = scope.matchesNames;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var renderAllPending = scope.renderAllPending;
- var rewrap = scope.rewrap;
- var setWrapper = scope.setWrapper;
- var unsafeUnwrap = scope.unsafeUnwrap;
- var unwrap = scope.unwrap;
- var wrap = scope.wrap;
- var wrapEventTargetMethods = scope.wrapEventTargetMethods;
- var wrapNodeList = scope.wrapNodeList;
- var implementationTable = new WeakMap();
- function Document(node) {
- Node.call(this, node);
- this.treeScope_ = new TreeScope(this, null);
- }
- Document.prototype = Object.create(Node.prototype);
- defineWrapGetter(Document, "documentElement");
- defineWrapGetter(Document, "body");
- defineWrapGetter(Document, "head");
- function wrapMethod(name) {
- var original = document[name];
- Document.prototype[name] = function() {
- return wrap(original.apply(unsafeUnwrap(this), arguments));
- };
- }
- [ "createComment", "createDocumentFragment", "createElement", "createElementNS", "createEvent", "createEventNS", "createRange", "createTextNode", "getElementById" ].forEach(wrapMethod);
- var originalAdoptNode = document.adoptNode;
- function adoptNodeNoRemove(node, doc) {
- originalAdoptNode.call(unsafeUnwrap(doc), unwrap(node));
- adoptSubtree(node, doc);
- }
- function adoptSubtree(node, doc) {
- if (node.shadowRoot) doc.adoptNode(node.shadowRoot);
- if (node instanceof ShadowRoot) adoptOlderShadowRoots(node, doc);
- for (var child = node.firstChild; child; child = child.nextSibling) {
- adoptSubtree(child, doc);
- }
- }
- function adoptOlderShadowRoots(shadowRoot, doc) {
- var oldShadowRoot = shadowRoot.olderShadowRoot;
- if (oldShadowRoot) doc.adoptNode(oldShadowRoot);
- }
- var originalGetSelection = document.getSelection;
- mixin(Document.prototype, {
- adoptNode: function(node) {
- if (node.parentNode) node.parentNode.removeChild(node);
- adoptNodeNoRemove(node, this);
- return node;
- },
- elementFromPoint: function(x, y) {
- return elementFromPoint(this, this, x, y);
- },
- importNode: function(node, deep) {
- return cloneNode(node, deep, unsafeUnwrap(this));
- },
- getSelection: function() {
- renderAllPending();
- return new Selection(originalGetSelection.call(unwrap(this)));
- },
- getElementsByName: function(name) {
- return SelectorsInterface.querySelectorAll.call(this, "[name=" + JSON.stringify(String(name)) + "]");
- }
- });
- if (document.registerElement) {
- var originalRegisterElement = document.registerElement;
- Document.prototype.registerElement = function(tagName, object) {
- var prototype, extendsOption;
- if (object !== undefined) {
- prototype = object.prototype;
- extendsOption = object.extends;
- }
- if (!prototype) prototype = Object.create(HTMLElement.prototype);
- if (scope.nativePrototypeTable.get(prototype)) {
- throw new Error("NotSupportedError");
- }
- var proto = Object.getPrototypeOf(prototype);
- var nativePrototype;
- var prototypes = [];
- while (proto) {
- nativePrototype = scope.nativePrototypeTable.get(proto);
- if (nativePrototype) break;
- prototypes.push(proto);
- proto = Object.getPrototypeOf(proto);
- }
- if (!nativePrototype) {
- throw new Error("NotSupportedError");
- }
- var newPrototype = Object.create(nativePrototype);
- for (var i = prototypes.length - 1; i >= 0; i--) {
- newPrototype = Object.create(newPrototype);
- }
- [ "createdCallback", "attachedCallback", "detachedCallback", "attributeChangedCallback" ].forEach(function(name) {
- var f = prototype[name];
- if (!f) return;
- newPrototype[name] = function() {
- if (!(wrap(this) instanceof CustomElementConstructor)) {
- rewrap(this);
- }
- f.apply(wrap(this), arguments);
- };
- });
- var p = {
- prototype: newPrototype
- };
- if (extendsOption) p.extends = extendsOption;
- function CustomElementConstructor(node) {
- if (!node) {
- if (extendsOption) {
- return document.createElement(extendsOption, tagName);
- } else {
- return document.createElement(tagName);
- }
- }
- setWrapper(node, this);
- }
- CustomElementConstructor.prototype = prototype;
- CustomElementConstructor.prototype.constructor = CustomElementConstructor;
- scope.constructorTable.set(newPrototype, CustomElementConstructor);
- scope.nativePrototypeTable.set(prototype, newPrototype);
- var nativeConstructor = originalRegisterElement.call(unwrap(this), tagName, p);
- return CustomElementConstructor;
- };
- forwardMethodsToWrapper([ window.HTMLDocument || window.Document ], [ "registerElement" ]);
- }
- forwardMethodsToWrapper([ window.HTMLBodyElement, window.HTMLDocument || window.Document, window.HTMLHeadElement, window.HTMLHtmlElement ], [ "appendChild", "compareDocumentPosition", "contains", "getElementsByClassName", "getElementsByTagName", "getElementsByTagNameNS", "insertBefore", "querySelector", "querySelectorAll", "removeChild", "replaceChild" ]);
- forwardMethodsToWrapper([ window.HTMLBodyElement, window.HTMLHeadElement, window.HTMLHtmlElement ], matchesNames);
- forwardMethodsToWrapper([ window.HTMLDocument || window.Document ], [ "adoptNode", "importNode", "contains", "createComment", "createDocumentFragment", "createElement", "createElementNS", "createEvent", "createEventNS", "createRange", "createTextNode", "elementFromPoint", "getElementById", "getElementsByName", "getSelection" ]);
- mixin(Document.prototype, GetElementsByInterface);
- mixin(Document.prototype, ParentNodeInterface);
- mixin(Document.prototype, SelectorsInterface);
- mixin(Document.prototype, {
- get implementation() {
- var implementation = implementationTable.get(this);
- if (implementation) return implementation;
- implementation = new DOMImplementation(unwrap(this).implementation);
- implementationTable.set(this, implementation);
- return implementation;
- },
- get defaultView() {
- return wrap(unwrap(this).defaultView);
- }
- });
- registerWrapper(window.Document, Document, document.implementation.createHTMLDocument(""));
- if (window.HTMLDocument) registerWrapper(window.HTMLDocument, Document);
- wrapEventTargetMethods([ window.HTMLBodyElement, window.HTMLDocument || window.Document, window.HTMLHeadElement ]);
- function DOMImplementation(impl) {
- setWrapper(impl, this);
- }
- function wrapImplMethod(constructor, name) {
- var original = document.implementation[name];
- constructor.prototype[name] = function() {
- return wrap(original.apply(unsafeUnwrap(this), arguments));
- };
- }
- function forwardImplMethod(constructor, name) {
- var original = document.implementation[name];
- constructor.prototype[name] = function() {
- return original.apply(unsafeUnwrap(this), arguments);
- };
- }
- wrapImplMethod(DOMImplementation, "createDocumentType");
- wrapImplMethod(DOMImplementation, "createDocument");
- wrapImplMethod(DOMImplementation, "createHTMLDocument");
- forwardImplMethod(DOMImplementation, "hasFeature");
- registerWrapper(window.DOMImplementation, DOMImplementation);
- forwardMethodsToWrapper([ window.DOMImplementation ], [ "createDocumentType", "createDocument", "createHTMLDocument", "hasFeature" ]);
- scope.adoptNodeNoRemove = adoptNodeNoRemove;
- scope.wrappers.DOMImplementation = DOMImplementation;
- scope.wrappers.Document = Document;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var EventTarget = scope.wrappers.EventTarget;
- var Selection = scope.wrappers.Selection;
- var mixin = scope.mixin;
- var registerWrapper = scope.registerWrapper;
- var renderAllPending = scope.renderAllPending;
- var unwrap = scope.unwrap;
- var unwrapIfNeeded = scope.unwrapIfNeeded;
- var wrap = scope.wrap;
- var OriginalWindow = window.Window;
- var originalGetComputedStyle = window.getComputedStyle;
- var originalGetDefaultComputedStyle = window.getDefaultComputedStyle;
- var originalGetSelection = window.getSelection;
- function Window(impl) {
- EventTarget.call(this, impl);
- }
- Window.prototype = Object.create(EventTarget.prototype);
- OriginalWindow.prototype.getComputedStyle = function(el, pseudo) {
- return wrap(this || window).getComputedStyle(unwrapIfNeeded(el), pseudo);
- };
- if (originalGetDefaultComputedStyle) {
- OriginalWindow.prototype.getDefaultComputedStyle = function(el, pseudo) {
- return wrap(this || window).getDefaultComputedStyle(unwrapIfNeeded(el), pseudo);
- };
- }
- OriginalWindow.prototype.getSelection = function() {
- return wrap(this || window).getSelection();
- };
- delete window.getComputedStyle;
- delete window.getDefaultComputedStyle;
- delete window.getSelection;
- [ "addEventListener", "removeEventListener", "dispatchEvent" ].forEach(function(name) {
- OriginalWindow.prototype[name] = function() {
- var w = wrap(this || window);
- return w[name].apply(w, arguments);
- };
- delete window[name];
- });
- mixin(Window.prototype, {
- getComputedStyle: function(el, pseudo) {
- renderAllPending();
- return originalGetComputedStyle.call(unwrap(this), unwrapIfNeeded(el), pseudo);
- },
- getSelection: function() {
- renderAllPending();
- return new Selection(originalGetSelection.call(unwrap(this)));
- },
- get document() {
- return wrap(unwrap(this).document);
- }
- });
- if (originalGetDefaultComputedStyle) {
- Window.prototype.getDefaultComputedStyle = function(el, pseudo) {
- renderAllPending();
- return originalGetDefaultComputedStyle.call(unwrap(this), unwrapIfNeeded(el), pseudo);
- };
- }
- registerWrapper(OriginalWindow, Window, window);
- scope.wrappers.Window = Window;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var unwrap = scope.unwrap;
- var OriginalDataTransfer = window.DataTransfer || window.Clipboard;
- var OriginalDataTransferSetDragImage = OriginalDataTransfer.prototype.setDragImage;
- if (OriginalDataTransferSetDragImage) {
- OriginalDataTransfer.prototype.setDragImage = function(image, x, y) {
- OriginalDataTransferSetDragImage.call(this, unwrap(image), x, y);
- };
- }
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var registerWrapper = scope.registerWrapper;
- var setWrapper = scope.setWrapper;
- var unwrap = scope.unwrap;
- var OriginalFormData = window.FormData;
- if (!OriginalFormData) return;
- function FormData(formElement) {
- var impl;
- if (formElement instanceof OriginalFormData) {
- impl = formElement;
- } else {
- impl = new OriginalFormData(formElement && unwrap(formElement));
- }
- setWrapper(impl, this);
- }
- registerWrapper(OriginalFormData, FormData, new OriginalFormData());
- scope.wrappers.FormData = FormData;
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var unwrapIfNeeded = scope.unwrapIfNeeded;
- var originalSend = XMLHttpRequest.prototype.send;
- XMLHttpRequest.prototype.send = function(obj) {
- return originalSend.call(this, unwrapIfNeeded(obj));
- };
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- "use strict";
- var isWrapperFor = scope.isWrapperFor;
- var elements = {
- a: "HTMLAnchorElement",
- area: "HTMLAreaElement",
- audio: "HTMLAudioElement",
- base: "HTMLBaseElement",
- body: "HTMLBodyElement",
- br: "HTMLBRElement",
- button: "HTMLButtonElement",
- canvas: "HTMLCanvasElement",
- caption: "HTMLTableCaptionElement",
- col: "HTMLTableColElement",
- content: "HTMLContentElement",
- data: "HTMLDataElement",
- datalist: "HTMLDataListElement",
- del: "HTMLModElement",
- dir: "HTMLDirectoryElement",
- div: "HTMLDivElement",
- dl: "HTMLDListElement",
- embed: "HTMLEmbedElement",
- fieldset: "HTMLFieldSetElement",
- font: "HTMLFontElement",
- form: "HTMLFormElement",
- frame: "HTMLFrameElement",
- frameset: "HTMLFrameSetElement",
- h1: "HTMLHeadingElement",
- head: "HTMLHeadElement",
- hr: "HTMLHRElement",
- html: "HTMLHtmlElement",
- iframe: "HTMLIFrameElement",
- img: "HTMLImageElement",
- input: "HTMLInputElement",
- keygen: "HTMLKeygenElement",
- label: "HTMLLabelElement",
- legend: "HTMLLegendElement",
- li: "HTMLLIElement",
- link: "HTMLLinkElement",
- map: "HTMLMapElement",
- marquee: "HTMLMarqueeElement",
- menu: "HTMLMenuElement",
- menuitem: "HTMLMenuItemElement",
- meta: "HTMLMetaElement",
- meter: "HTMLMeterElement",
- object: "HTMLObjectElement",
- ol: "HTMLOListElement",
- optgroup: "HTMLOptGroupElement",
- option: "HTMLOptionElement",
- output: "HTMLOutputElement",
- p: "HTMLParagraphElement",
- param: "HTMLParamElement",
- pre: "HTMLPreElement",
- progress: "HTMLProgressElement",
- q: "HTMLQuoteElement",
- script: "HTMLScriptElement",
- select: "HTMLSelectElement",
- shadow: "HTMLShadowElement",
- source: "HTMLSourceElement",
- span: "HTMLSpanElement",
- style: "HTMLStyleElement",
- table: "HTMLTableElement",
- tbody: "HTMLTableSectionElement",
- template: "HTMLTemplateElement",
- textarea: "HTMLTextAreaElement",
- thead: "HTMLTableSectionElement",
- time: "HTMLTimeElement",
- title: "HTMLTitleElement",
- tr: "HTMLTableRowElement",
- track: "HTMLTrackElement",
- ul: "HTMLUListElement",
- video: "HTMLVideoElement"
- };
- function overrideConstructor(tagName) {
- var nativeConstructorName = elements[tagName];
- var nativeConstructor = window[nativeConstructorName];
- if (!nativeConstructor) return;
- var element = document.createElement(tagName);
- var wrapperConstructor = element.constructor;
- window[nativeConstructorName] = wrapperConstructor;
- }
- Object.keys(elements).forEach(overrideConstructor);
- Object.getOwnPropertyNames(scope.wrappers).forEach(function(name) {
- window[name] = scope.wrappers[name];
- });
- })(window.ShadowDOMPolyfill);
- (function(scope) {
- var ShadowCSS = {
- strictStyling: false,
- registry: {},
- shimStyling: function(root, name, extendsName) {
- var scopeStyles = this.prepareRoot(root, name, extendsName);
- var typeExtension = this.isTypeExtension(extendsName);
- var scopeSelector = this.makeScopeSelector(name, typeExtension);
- var cssText = stylesToCssText(scopeStyles, true);
- cssText = this.scopeCssText(cssText, scopeSelector);
- if (root) {
- root.shimmedStyle = cssText;
- }
- this.addCssToDocument(cssText, name);
- },
- shimStyle: function(style, selector) {
- return this.shimCssText(style.textContent, selector);
- },
- shimCssText: function(cssText, selector) {
- cssText = this.insertDirectives(cssText);
- return this.scopeCssText(cssText, selector);
- },
- makeScopeSelector: function(name, typeExtension) {
- if (name) {
- return typeExtension ? "[is=" + name + "]" : name;
- }
- return "";
- },
- isTypeExtension: function(extendsName) {
- return extendsName && extendsName.indexOf("-") < 0;
- },
- prepareRoot: function(root, name, extendsName) {
- var def = this.registerRoot(root, name, extendsName);
- this.replaceTextInStyles(def.rootStyles, this.insertDirectives);
- this.removeStyles(root, def.rootStyles);
- if (this.strictStyling) {
- this.applyScopeToContent(root, name);
- }
- return def.scopeStyles;
- },
- removeStyles: function(root, styles) {
- for (var i = 0, l = styles.length, s; i < l && (s = styles[i]); i++) {
- s.parentNode.removeChild(s);
- }
- },
- registerRoot: function(root, name, extendsName) {
- var def = this.registry[name] = {
- root: root,
- name: name,
- extendsName: extendsName
- };
- var styles = this.findStyles(root);
- def.rootStyles = styles;
- def.scopeStyles = def.rootStyles;
- var extendee = this.registry[def.extendsName];
- if (extendee) {
- def.scopeStyles = extendee.scopeStyles.concat(def.scopeStyles);
- }
- return def;
- },
- findStyles: function(root) {
- if (!root) {
- return [];
- }
- var styles = root.querySelectorAll("style");
- return Array.prototype.filter.call(styles, function(s) {
- return !s.hasAttribute(NO_SHIM_ATTRIBUTE);
- });
- },
- applyScopeToContent: function(root, name) {
- if (root) {
- Array.prototype.forEach.call(root.querySelectorAll("*"), function(node) {
- node.setAttribute(name, "");
- });
- Array.prototype.forEach.call(root.querySelectorAll("template"), function(template) {
- this.applyScopeToContent(template.content, name);
- }, this);
- }
- },
- insertDirectives: function(cssText) {
- cssText = this.insertPolyfillDirectivesInCssText(cssText);
- return this.insertPolyfillRulesInCssText(cssText);
- },
- insertPolyfillDirectivesInCssText: function(cssText) {
- cssText = cssText.replace(cssCommentNextSelectorRe, function(match, p1) {
- return p1.slice(0, -2) + "{";
- });
- return cssText.replace(cssContentNextSelectorRe, function(match, p1) {
- return p1 + " {";
- });
- },
- insertPolyfillRulesInCssText: function(cssText) {
- cssText = cssText.replace(cssCommentRuleRe, function(match, p1) {
- return p1.slice(0, -1);
- });
- return cssText.replace(cssContentRuleRe, function(match, p1, p2, p3) {
- var rule = match.replace(p1, "").replace(p2, "");
- return p3 + rule;
- });
- },
- scopeCssText: function(cssText, scopeSelector) {
- var unscoped = this.extractUnscopedRulesFromCssText(cssText);
- cssText = this.insertPolyfillHostInCssText(cssText);
- cssText = this.convertColonHost(cssText);
- cssText = this.convertColonHostContext(cssText);
- cssText = this.convertShadowDOMSelectors(cssText);
- if (scopeSelector) {
- var self = this, cssText;
- withCssRules(cssText, function(rules) {
- cssText = self.scopeRules(rules, scopeSelector);
- });
- }
- cssText = cssText + "\n" + unscoped;
- return cssText.trim();
- },
- extractUnscopedRulesFromCssText: function(cssText) {
- var r = "", m;
- while (m = cssCommentUnscopedRuleRe.exec(cssText)) {
- r += m[1].slice(0, -1) + "\n\n";
- }
- while (m = cssContentUnscopedRuleRe.exec(cssText)) {
- r += m[0].replace(m[2], "").replace(m[1], m[3]) + "\n\n";
- }
- return r;
- },
- convertColonHost: function(cssText) {
- return this.convertColonRule(cssText, cssColonHostRe, this.colonHostPartReplacer);
- },
- convertColonHostContext: function(cssText) {
- return this.convertColonRule(cssText, cssColonHostContextRe, this.colonHostContextPartReplacer);
- },
- convertColonRule: function(cssText, regExp, partReplacer) {
- return cssText.replace(regExp, function(m, p1, p2, p3) {
- p1 = polyfillHostNoCombinator;
- if (p2) {
- var parts = p2.split(","), r = [];
- for (var i = 0, l = parts.length, p; i < l && (p = parts[i]); i++) {
- p = p.trim();
- r.push(partReplacer(p1, p, p3));
- }
- return r.join(",");
- } else {
- return p1 + p3;
- }
- });
- },
- colonHostContextPartReplacer: function(host, part, suffix) {
- if (part.match(polyfillHost)) {
- return this.colonHostPartReplacer(host, part, suffix);
- } else {
- return host + part + suffix + ", " + part + " " + host + suffix;
- }
- },
- colonHostPartReplacer: function(host, part, suffix) {
- return host + part.replace(polyfillHost, "") + suffix;
- },
- convertShadowDOMSelectors: function(cssText) {
- for (var i = 0; i < shadowDOMSelectorsRe.length; i++) {
- cssText = cssText.replace(shadowDOMSelectorsRe[i], " ");
- }
- return cssText;
- },
- scopeRules: function(cssRules, scopeSelector) {
- var cssText = "";
- if (cssRules) {
- Array.prototype.forEach.call(cssRules, function(rule) {
- if (rule.selectorText && (rule.style && rule.style.cssText !== undefined)) {
- cssText += this.scopeSelector(rule.selectorText, scopeSelector, this.strictStyling) + " {\n ";
- cssText += this.propertiesFromRule(rule) + "\n}\n\n";
- } else if (rule.type === CSSRule.MEDIA_RULE) {
- cssText += "@media " + rule.media.mediaText + " {\n";
- cssText += this.scopeRules(rule.cssRules, scopeSelector);
- cssText += "\n}\n\n";
- } else {
- try {
- if (rule.cssText) {
- cssText += rule.cssText + "\n\n";
- }
- } catch (x) {
- if (rule.type === CSSRule.KEYFRAMES_RULE && rule.cssRules) {
- cssText += this.ieSafeCssTextFromKeyFrameRule(rule);
- }
- }
- }
- }, this);
- }
- return cssText;
- },
- ieSafeCssTextFromKeyFrameRule: function(rule) {
- var cssText = "@keyframes " + rule.name + " {";
- Array.prototype.forEach.call(rule.cssRules, function(rule) {
- cssText += " " + rule.keyText + " {" + rule.style.cssText + "}";
- });
- cssText += " }";
- return cssText;
- },
- scopeSelector: function(selector, scopeSelector, strict) {
- var r = [], parts = selector.split(",");
- parts.forEach(function(p) {
- p = p.trim();
- if (this.selectorNeedsScoping(p, scopeSelector)) {
- p = strict && !p.match(polyfillHostNoCombinator) ? this.applyStrictSelectorScope(p, scopeSelector) : this.applySelectorScope(p, scopeSelector);
- }
- r.push(p);
- }, this);
- return r.join(", ");
- },
- selectorNeedsScoping: function(selector, scopeSelector) {
- if (Array.isArray(scopeSelector)) {
- return true;
- }
- var re = this.makeScopeMatcher(scopeSelector);
- return !selector.match(re);
- },
- makeScopeMatcher: function(scopeSelector) {
- scopeSelector = scopeSelector.replace(/\[/g, "\\[").replace(/\]/g, "\\]");
- return new RegExp("^(" + scopeSelector + ")" + selectorReSuffix, "m");
- },
- applySelectorScope: function(selector, selectorScope) {
- return Array.isArray(selectorScope) ? this.applySelectorScopeList(selector, selectorScope) : this.applySimpleSelectorScope(selector, selectorScope);
- },
- applySelectorScopeList: function(selector, scopeSelectorList) {
- var r = [];
- for (var i = 0, s; s = scopeSelectorList[i]; i++) {
- r.push(this.applySimpleSelectorScope(selector, s));
- }
- return r.join(", ");
- },
- applySimpleSelectorScope: function(selector, scopeSelector) {
- if (selector.match(polyfillHostRe)) {
- selector = selector.replace(polyfillHostNoCombinator, scopeSelector);
- return selector.replace(polyfillHostRe, scopeSelector + " ");
- } else {
- return scopeSelector + " " + selector;
- }
- },
- applyStrictSelectorScope: function(selector, scopeSelector) {
- scopeSelector = scopeSelector.replace(/\[is=([^\]]*)\]/g, "$1");
- var splits = [ " ", ">", "+", "~" ], scoped = selector, attrName = "[" + scopeSelector + "]";
- splits.forEach(function(sep) {
- var parts = scoped.split(sep);
- scoped = parts.map(function(p) {
- var t = p.trim().replace(polyfillHostRe, "");
- if (t && splits.indexOf(t) < 0 && t.indexOf(attrName) < 0) {
- p = t.replace(/([^:]*)(:*)(.*)/, "$1" + attrName + "$2$3");
- }
- return p;
- }).join(sep);
- });
- return scoped;
- },
- insertPolyfillHostInCssText: function(selector) {
- return selector.replace(colonHostContextRe, polyfillHostContext).replace(colonHostRe, polyfillHost);
- },
- propertiesFromRule: function(rule) {
- var cssText = rule.style.cssText;
- if (rule.style.content && !rule.style.content.match(/['"]+|attr/)) {
- cssText = cssText.replace(/content:[^;]*;/g, "content: '" + rule.style.content + "';");
- }
- var style = rule.style;
- for (var i in style) {
- if (style[i] === "initial") {
- cssText += i + ": initial; ";
- }
- }
- return cssText;
- },
- replaceTextInStyles: function(styles, action) {
- if (styles && action) {
- if (!(styles instanceof Array)) {
- styles = [ styles ];
- }
- Array.prototype.forEach.call(styles, function(s) {
- s.textContent = action.call(this, s.textContent);
- }, this);
- }
- },
- addCssToDocument: function(cssText, name) {
- if (cssText.match("@import")) {
- addOwnSheet(cssText, name);
- } else {
- addCssToDocument(cssText);
- }
- }
- };
- var selectorRe = /([^{]*)({[\s\S]*?})/gim, cssCommentRe = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim, cssCommentNextSelectorRe = /\/\*\s*@polyfill ([^*]*\*+([^/*][^*]*\*+)*\/)([^{]*?){/gim, cssContentNextSelectorRe = /polyfill-next-selector[^}]*content\:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim, cssCommentRuleRe = /\/\*\s@polyfill-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim, cssContentRuleRe = /(polyfill-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim, cssCommentUnscopedRuleRe = /\/\*\s@polyfill-unscoped-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim, cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim, cssPseudoRe = /::(x-[^\s{,(]*)/gim, cssPartRe = /::part\(([^)]*)\)/gim, polyfillHost = "-shadowcsshost", polyfillHostContext = "-shadowcsscontext", parenSuffix = ")(?:\\((" + "(?:\\([^)(]*\\)|[^)(]*)+?" + ")\\))?([^,{]*)";
- var cssColonHostRe = new RegExp("(" + polyfillHost + parenSuffix, "gim"), cssColonHostContextRe = new RegExp("(" + polyfillHostContext + parenSuffix, "gim"), selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$", colonHostRe = /\:host/gim, colonHostContextRe = /\:host-context/gim, polyfillHostNoCombinator = polyfillHost + "-no-combinator", polyfillHostRe = new RegExp(polyfillHost, "gim"), polyfillHostContextRe = new RegExp(polyfillHostContext, "gim"), shadowDOMSelectorsRe = [ /\^\^/g, /\^/g, /\/shadow\//g, /\/shadow-deep\//g, /::shadow/g, /\/deep\//g, /::content/g ];
- function stylesToCssText(styles, preserveComments) {
- var cssText = "";
- Array.prototype.forEach.call(styles, function(s) {
- cssText += s.textContent + "\n\n";
- });
- if (!preserveComments) {
- cssText = cssText.replace(cssCommentRe, "");
- }
- return cssText;
- }
- function cssTextToStyle(cssText) {
- var style = document.createElement("style");
- style.textContent = cssText;
- return style;
- }
- function cssToRules(cssText) {
- var style = cssTextToStyle(cssText);
- document.head.appendChild(style);
- var rules = [];
- if (style.sheet) {
- try {
- rules = style.sheet.cssRules;
- } catch (e) {}
- } else {
- console.warn("sheet not found", style);
- }
- style.parentNode.removeChild(style);
- return rules;
- }
- var frame = document.createElement("iframe");
- frame.style.display = "none";
- function initFrame() {
- frame.initialized = true;
- document.body.appendChild(frame);
- var doc = frame.contentDocument;
- var base = doc.createElement("base");
- base.href = document.baseURI;
- doc.head.appendChild(base);
- }
- function inFrame(fn) {
- if (!frame.initialized) {
- initFrame();
- }
- document.body.appendChild(frame);
- fn(frame.contentDocument);
- document.body.removeChild(frame);
- }
- var isChrome = navigator.userAgent.match("Chrome");
- function withCssRules(cssText, callback) {
- if (!callback) {
- return;
- }
- var rules;
- if (cssText.match("@import") && isChrome) {
- var style = cssTextToStyle(cssText);
- inFrame(function(doc) {
- doc.head.appendChild(style.impl);
- rules = Array.prototype.slice.call(style.sheet.cssRules, 0);
- callback(rules);
- });
- } else {
- rules = cssToRules(cssText);
- callback(rules);
- }
- }
- function rulesToCss(cssRules) {
- for (var i = 0, css = []; i < cssRules.length; i++) {
- css.push(cssRules[i].cssText);
- }
- return css.join("\n\n");
- }
- function addCssToDocument(cssText) {
- if (cssText) {
- getSheet().appendChild(document.createTextNode(cssText));
- }
- }
- function addOwnSheet(cssText, name) {
- var style = cssTextToStyle(cssText);
- style.setAttribute(name, "");
- style.setAttribute(SHIMMED_ATTRIBUTE, "");
- document.head.appendChild(style);
- }
- var SHIM_ATTRIBUTE = "shim-shadowdom";
- var SHIMMED_ATTRIBUTE = "shim-shadowdom-css";
- var NO_SHIM_ATTRIBUTE = "no-shim";
- var sheet;
- function getSheet() {
- if (!sheet) {
- sheet = document.createElement("style");
- sheet.setAttribute(SHIMMED_ATTRIBUTE, "");
- sheet[SHIMMED_ATTRIBUTE] = true;
- }
- return sheet;
- }
- if (window.ShadowDOMPolyfill) {
- addCssToDocument("style { display: none !important; }\n");
- var doc = ShadowDOMPolyfill.wrap(document);
- var head = doc.querySelector("head");
- head.insertBefore(getSheet(), head.childNodes[0]);
- document.addEventListener("DOMContentLoaded", function() {
- var urlResolver = scope.urlResolver;
- if (window.HTMLImports && !HTMLImports.useNative) {
- var SHIM_SHEET_SELECTOR = "link[rel=stylesheet]" + "[" + SHIM_ATTRIBUTE + "]";
- var SHIM_STYLE_SELECTOR = "style[" + SHIM_ATTRIBUTE + "]";
- HTMLImports.importer.documentPreloadSelectors += "," + SHIM_SHEET_SELECTOR;
- HTMLImports.importer.importsPreloadSelectors += "," + SHIM_SHEET_SELECTOR;
- HTMLImports.parser.documentSelectors = [ HTMLImports.parser.documentSelectors, SHIM_SHEET_SELECTOR, SHIM_STYLE_SELECTOR ].join(",");
- var originalParseGeneric = HTMLImports.parser.parseGeneric;
- HTMLImports.parser.parseGeneric = function(elt) {
- if (elt[SHIMMED_ATTRIBUTE]) {
- return;
- }
- var style = elt.__importElement || elt;
- if (!style.hasAttribute(SHIM_ATTRIBUTE)) {
- originalParseGeneric.call(this, elt);
- return;
- }
- if (elt.__resource) {
- style = elt.ownerDocument.createElement("style");
- style.textContent = elt.__resource;
- }
- HTMLImports.path.resolveUrlsInStyle(style);
- style.textContent = ShadowCSS.shimStyle(style);
- style.removeAttribute(SHIM_ATTRIBUTE, "");
- style.setAttribute(SHIMMED_ATTRIBUTE, "");
- style[SHIMMED_ATTRIBUTE] = true;
- if (style.parentNode !== head) {
- if (elt.parentNode === head) {
- head.replaceChild(style, elt);
- } else {
- this.addElementToDocument(style);
- }
- }
- style.__importParsed = true;
- this.markParsingComplete(elt);
- this.parseNext();
- };
- var hasResource = HTMLImports.parser.hasResource;
- HTMLImports.parser.hasResource = function(node) {
- if (node.localName === "link" && node.rel === "stylesheet" && node.hasAttribute(SHIM_ATTRIBUTE)) {
- return node.__resource;
- } else {
- return hasResource.call(this, node);
- }
- };
- }
- });
- }
- scope.ShadowCSS = ShadowCSS;
- })(window.WebComponents);
-}
-
-(function(scope) {
- if (window.ShadowDOMPolyfill) {
- window.wrap = ShadowDOMPolyfill.wrapIfNeeded;
- window.unwrap = ShadowDOMPolyfill.unwrapIfNeeded;
- } else {
- window.wrap = window.unwrap = function(n) {
- return n;
- };
- }
-})(window.WebComponents);
-
-window.HTMLImports = window.HTMLImports || {
- flags: {}
-};
-
-(function(scope) {
- var IMPORT_LINK_TYPE = "import";
- var useNative = Boolean(IMPORT_LINK_TYPE in document.createElement("link"));
- var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill);
- var wrap = function(node) {
- return hasShadowDOMPolyfill ? ShadowDOMPolyfill.wrapIfNeeded(node) : node;
- };
- var rootDocument = wrap(document);
- var currentScriptDescriptor = {
- get: function() {
- var script = HTMLImports.currentScript || document.currentScript || (document.readyState !== "complete" ? document.scripts[document.scripts.length - 1] : null);
- return wrap(script);
- },
- configurable: true
- };
- Object.defineProperty(document, "_currentScript", currentScriptDescriptor);
- Object.defineProperty(rootDocument, "_currentScript", currentScriptDescriptor);
- var isIE = /Trident|Edge/.test(navigator.userAgent);
- function whenReady(callback, doc) {
- doc = doc || rootDocument;
- whenDocumentReady(function() {
- watchImportsLoad(callback, doc);
- }, doc);
- }
- var requiredReadyState = isIE ? "complete" : "interactive";
- var READY_EVENT = "readystatechange";
- function isDocumentReady(doc) {
- return doc.readyState === "complete" || doc.readyState === requiredReadyState;
- }
- function whenDocumentReady(callback, doc) {
- if (!isDocumentReady(doc)) {
- var checkReady = function() {
- if (doc.readyState === "complete" || doc.readyState === requiredReadyState) {
- doc.removeEventListener(READY_EVENT, checkReady);
- whenDocumentReady(callback, doc);
- }
- };
- doc.addEventListener(READY_EVENT, checkReady);
- } else if (callback) {
- callback();
- }
- }
- function markTargetLoaded(event) {
- event.target.__loaded = true;
- }
- function watchImportsLoad(callback, doc) {
- var imports = doc.querySelectorAll("link[rel=import]");
- var loaded = 0, l = imports.length;
- function checkDone(d) {
- if (loaded == l && callback) {
- callback();
- }
- }
- function loadedImport(e) {
- markTargetLoaded(e);
- loaded++;
- checkDone();
- }
- if (l) {
- for (var i = 0, imp; i < l && (imp = imports[i]); i++) {
- if (isImportLoaded(imp)) {
- loadedImport.call(imp, {
- target: imp
- });
- } else {
- imp.addEventListener("load", loadedImport);
- imp.addEventListener("error", loadedImport);
- }
- }
- } else {
- checkDone();
- }
- }
- function isImportLoaded(link) {
- return useNative ? link.__loaded || link.import && link.import.readyState !== "loading" : link.__importParsed;
- }
- if (useNative) {
- new MutationObserver(function(mxns) {
- for (var i = 0, l = mxns.length, m; i < l && (m = mxns[i]); i++) {
- if (m.addedNodes) {
- handleImports(m.addedNodes);
- }
- }
- }).observe(document.head, {
- childList: true
- });
- function handleImports(nodes) {
- for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
- if (isImport(n)) {
- handleImport(n);
- }
- }
- }
- function isImport(element) {
- return element.localName === "link" && element.rel === "import";
- }
- function handleImport(element) {
- var loaded = element.import;
- if (loaded) {
- markTargetLoaded({
- target: element
- });
- } else {
- element.addEventListener("load", markTargetLoaded);
- element.addEventListener("error", markTargetLoaded);
- }
- }
- (function() {
- if (document.readyState === "loading") {
- var imports = document.querySelectorAll("link[rel=import]");
- for (var i = 0, l = imports.length, imp; i < l && (imp = imports[i]); i++) {
- handleImport(imp);
- }
- }
- })();
- }
- whenReady(function() {
- HTMLImports.ready = true;
- HTMLImports.readyTime = new Date().getTime();
- var evt = rootDocument.createEvent("CustomEvent");
- evt.initCustomEvent("HTMLImportsLoaded", true, true, {});
- rootDocument.dispatchEvent(evt);
- });
- scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE;
- scope.useNative = useNative;
- scope.rootDocument = rootDocument;
- scope.whenReady = whenReady;
- scope.isIE = isIE;
-})(HTMLImports);
-
-(function(scope) {
- var modules = [];
- var addModule = function(module) {
- modules.push(module);
- };
- var initializeModules = function() {
- modules.forEach(function(module) {
- module(scope);
- });
- };
- scope.addModule = addModule;
- scope.initializeModules = initializeModules;
-})(HTMLImports);
-
-HTMLImports.addModule(function(scope) {
- var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
- var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
- var path = {
- resolveUrlsInStyle: function(style) {
- var doc = style.ownerDocument;
- var resolver = doc.createElement("a");
- style.textContent = this.resolveUrlsInCssText(style.textContent, resolver);
- return style;
- },
- resolveUrlsInCssText: function(cssText, urlObj) {
- var r = this.replaceUrls(cssText, urlObj, CSS_URL_REGEXP);
- r = this.replaceUrls(r, urlObj, CSS_IMPORT_REGEXP);
- return r;
- },
- replaceUrls: function(text, urlObj, regexp) {
- return text.replace(regexp, function(m, pre, url, post) {
- var urlPath = url.replace(/["']/g, "");
- urlObj.href = urlPath;
- urlPath = urlObj.href;
- return pre + "'" + urlPath + "'" + post;
- });
- }
- };
- scope.path = path;
-});
-
-HTMLImports.addModule(function(scope) {
- var xhr = {
- async: true,
- ok: function(request) {
- return request.status >= 200 && request.status < 300 || request.status === 304 || request.status === 0;
- },
- load: function(url, next, nextContext) {
- var request = new XMLHttpRequest();
- if (scope.flags.debug || scope.flags.bust) {
- url += "?" + Math.random();
- }
- request.open("GET", url, xhr.async);
- request.addEventListener("readystatechange", function(e) {
- if (request.readyState === 4) {
- var locationHeader = request.getResponseHeader("Location");
- var redirectedUrl = null;
- if (locationHeader) {
- var redirectedUrl = locationHeader.substr(0, 1) === "/" ? location.origin + locationHeader : locationHeader;
- }
- next.call(nextContext, !xhr.ok(request) && request, request.response || request.responseText, redirectedUrl);
- }
- });
- request.send();
- return request;
- },
- loadDocument: function(url, next, nextContext) {
- this.load(url, next, nextContext).responseType = "document";
- }
- };
- scope.xhr = xhr;
-});
-
-HTMLImports.addModule(function(scope) {
- var xhr = scope.xhr;
- var flags = scope.flags;
- var Loader = function(onLoad, onComplete) {
- this.cache = {};
- this.onload = onLoad;
- this.oncomplete = onComplete;
- this.inflight = 0;
- this.pending = {};
- };
- Loader.prototype = {
- addNodes: function(nodes) {
- this.inflight += nodes.length;
- for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
- this.require(n);
- }
- this.checkDone();
- },
- addNode: function(node) {
- this.inflight++;
- this.require(node);
- this.checkDone();
- },
- require: function(elt) {
- var url = elt.src || elt.href;
- elt.__nodeUrl = url;
- if (!this.dedupe(url, elt)) {
- this.fetch(url, elt);
- }
- },
- dedupe: function(url, elt) {
- if (this.pending[url]) {
- this.pending[url].push(elt);
- return true;
- }
- var resource;
- if (this.cache[url]) {
- this.onload(url, elt, this.cache[url]);
- this.tail();
- return true;
- }
- this.pending[url] = [ elt ];
- return false;
- },
- fetch: function(url, elt) {
- flags.load && console.log("fetch", url, elt);
- if (!url) {
- setTimeout(function() {
- this.receive(url, elt, {
- error: "href must be specified"
- }, null);
- }.bind(this), 0);
- } else if (url.match(/^data:/)) {
- var pieces = url.split(",");
- var header = pieces[0];
- var body = pieces[1];
- if (header.indexOf(";base64") > -1) {
- body = atob(body);
- } else {
- body = decodeURIComponent(body);
- }
- setTimeout(function() {
- this.receive(url, elt, null, body);
- }.bind(this), 0);
- } else {
- var receiveXhr = function(err, resource, redirectedUrl) {
- this.receive(url, elt, err, resource, redirectedUrl);
- }.bind(this);
- xhr.load(url, receiveXhr);
- }
- },
- receive: function(url, elt, err, resource, redirectedUrl) {
- this.cache[url] = resource;
- var $p = this.pending[url];
- for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
- this.onload(url, p, resource, err, redirectedUrl);
- this.tail();
- }
- this.pending[url] = null;
- },
- tail: function() {
- --this.inflight;
- this.checkDone();
- },
- checkDone: function() {
- if (!this.inflight) {
- this.oncomplete();
- }
- }
- };
- scope.Loader = Loader;
-});
-
-HTMLImports.addModule(function(scope) {
- var Observer = function(addCallback) {
- this.addCallback = addCallback;
- this.mo = new MutationObserver(this.handler.bind(this));
- };
- Observer.prototype = {
- handler: function(mutations) {
- for (var i = 0, l = mutations.length, m; i < l && (m = mutations[i]); i++) {
- if (m.type === "childList" && m.addedNodes.length) {
- this.addedNodes(m.addedNodes);
- }
- }
- },
- addedNodes: function(nodes) {
- if (this.addCallback) {
- this.addCallback(nodes);
- }
- for (var i = 0, l = nodes.length, n, loading; i < l && (n = nodes[i]); i++) {
- if (n.children && n.children.length) {
- this.addedNodes(n.children);
- }
- }
- },
- observe: function(root) {
- this.mo.observe(root, {
- childList: true,
- subtree: true
- });
- }
- };
- scope.Observer = Observer;
-});
-
-HTMLImports.addModule(function(scope) {
- var path = scope.path;
- var rootDocument = scope.rootDocument;
- var flags = scope.flags;
- var isIE = scope.isIE;
- var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
- var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]";
- var importParser = {
- documentSelectors: IMPORT_SELECTOR,
- importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]", "style", "script:not([type])", 'script[type="text/javascript"]' ].join(","),
- map: {
- link: "parseLink",
- script: "parseScript",
- style: "parseStyle"
- },
- dynamicElements: [],
- parseNext: function() {
- var next = this.nextToParse();
- if (next) {
- this.parse(next);
- }
- },
- parse: function(elt) {
- if (this.isParsed(elt)) {
- flags.parse && console.log("[%s] is already parsed", elt.localName);
- return;
- }
- var fn = this[this.map[elt.localName]];
- if (fn) {
- this.markParsing(elt);
- fn.call(this, elt);
- }
- },
- parseDynamic: function(elt, quiet) {
- this.dynamicElements.push(elt);
- if (!quiet) {
- this.parseNext();
- }
- },
- markParsing: function(elt) {
- flags.parse && console.log("parsing", elt);
- this.parsingElement = elt;
- },
- markParsingComplete: function(elt) {
- elt.__importParsed = true;
- this.markDynamicParsingComplete(elt);
- if (elt.__importElement) {
- elt.__importElement.__importParsed = true;
- this.markDynamicParsingComplete(elt.__importElement);
- }
- this.parsingElement = null;
- flags.parse && console.log("completed", elt);
- },
- markDynamicParsingComplete: function(elt) {
- var i = this.dynamicElements.indexOf(elt);
- if (i >= 0) {
- this.dynamicElements.splice(i, 1);
- }
- },
- parseImport: function(elt) {
- if (HTMLImports.__importsParsingHook) {
- HTMLImports.__importsParsingHook(elt);
- }
- if (elt.import) {
- elt.import.__importParsed = true;
- }
- this.markParsingComplete(elt);
- if (elt.__resource && !elt.__error) {
- elt.dispatchEvent(new CustomEvent("load", {
- bubbles: false
- }));
- } else {
- elt.dispatchEvent(new CustomEvent("error", {
- bubbles: false
- }));
- }
- if (elt.__pending) {
- var fn;
- while (elt.__pending.length) {
- fn = elt.__pending.shift();
- if (fn) {
- fn({
- target: elt
- });
- }
- }
- }
- this.parseNext();
- },
- parseLink: function(linkElt) {
- if (nodeIsImport(linkElt)) {
- this.parseImport(linkElt);
- } else {
- linkElt.href = linkElt.href;
- this.parseGeneric(linkElt);
- }
- },
- parseStyle: function(elt) {
- var src = elt;
- elt = cloneStyle(elt);
- elt.__importElement = src;
- this.parseGeneric(elt);
- },
- parseGeneric: function(elt) {
- this.trackElement(elt);
- this.addElementToDocument(elt);
- },
- rootImportForElement: function(elt) {
- var n = elt;
- while (n.ownerDocument.__importLink) {
- n = n.ownerDocument.__importLink;
- }
- return n;
- },
- addElementToDocument: function(elt) {
- var port = this.rootImportForElement(elt.__importElement || elt);
- port.parentNode.insertBefore(elt, port);
- },
- trackElement: function(elt, callback) {
- var self = this;
- var done = function(e) {
- if (callback) {
- callback(e);
- }
- self.markParsingComplete(elt);
- self.parseNext();
- };
- elt.addEventListener("load", done);
- elt.addEventListener("error", done);
- if (isIE && elt.localName === "style") {
- var fakeLoad = false;
- if (elt.textContent.indexOf("@import") == -1) {
- fakeLoad = true;
- } else if (elt.sheet) {
- fakeLoad = true;
- var csr = elt.sheet.cssRules;
- var len = csr ? csr.length : 0;
- for (var i = 0, r; i < len && (r = csr[i]); i++) {
- if (r.type === CSSRule.IMPORT_RULE) {
- fakeLoad = fakeLoad && Boolean(r.styleSheet);
- }
- }
- }
- if (fakeLoad) {
- elt.dispatchEvent(new CustomEvent("load", {
- bubbles: false
- }));
- }
- }
- },
- parseScript: function(scriptElt) {
- var script = document.createElement("script");
- script.__importElement = scriptElt;
- script.src = scriptElt.src ? scriptElt.src : generateScriptDataUrl(scriptElt);
- scope.currentScript = scriptElt;
- this.trackElement(script, function(e) {
- script.parentNode.removeChild(script);
- scope.currentScript = null;
- });
- this.addElementToDocument(script);
- },
- nextToParse: function() {
- this._mayParse = [];
- return !this.parsingElement && (this.nextToParseInDoc(rootDocument) || this.nextToParseDynamic());
- },
- nextToParseInDoc: function(doc, link) {
- if (doc && this._mayParse.indexOf(doc) < 0) {
- this._mayParse.push(doc);
- var nodes = doc.querySelectorAll(this.parseSelectorsForNode(doc));
- for (var i = 0, l = nodes.length, p = 0, n; i < l && (n = nodes[i]); i++) {
- if (!this.isParsed(n)) {
- if (this.hasResource(n)) {
- return nodeIsImport(n) ? this.nextToParseInDoc(n.import, n) : n;
- } else {
- return;
- }
- }
- }
- }
- return link;
- },
- nextToParseDynamic: function() {
- return this.dynamicElements[0];
- },
- parseSelectorsForNode: function(node) {
- var doc = node.ownerDocument || node;
- return doc === rootDocument ? this.documentSelectors : this.importsSelectors;
- },
- isParsed: function(node) {
- return node.__importParsed;
- },
- needsDynamicParsing: function(elt) {
- return this.dynamicElements.indexOf(elt) >= 0;
- },
- hasResource: function(node) {
- if (nodeIsImport(node) && node.import === undefined) {
- return false;
- }
- return true;
- }
- };
- function nodeIsImport(elt) {
- return elt.localName === "link" && elt.rel === IMPORT_LINK_TYPE;
- }
- function generateScriptDataUrl(script) {
- var scriptContent = generateScriptContent(script);
- return "data:text/javascript;charset=utf-8," + encodeURIComponent(scriptContent);
- }
- function generateScriptContent(script) {
- return script.textContent + generateSourceMapHint(script);
- }
- function generateSourceMapHint(script) {
- var owner = script.ownerDocument;
- owner.__importedScripts = owner.__importedScripts || 0;
- var moniker = script.ownerDocument.baseURI;
- var num = owner.__importedScripts ? "-" + owner.__importedScripts : "";
- owner.__importedScripts++;
- return "\n//# sourceURL=" + moniker + num + ".js\n";
- }
- function cloneStyle(style) {
- var clone = style.ownerDocument.createElement("style");
- clone.textContent = style.textContent;
- path.resolveUrlsInStyle(clone);
- return clone;
- }
- scope.parser = importParser;
- scope.IMPORT_SELECTOR = IMPORT_SELECTOR;
-});
-
-HTMLImports.addModule(function(scope) {
- var flags = scope.flags;
- var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
- var IMPORT_SELECTOR = scope.IMPORT_SELECTOR;
- var rootDocument = scope.rootDocument;
- var Loader = scope.Loader;
- var Observer = scope.Observer;
- var parser = scope.parser;
- var importer = {
- documents: {},
- documentPreloadSelectors: IMPORT_SELECTOR,
- importsPreloadSelectors: [ IMPORT_SELECTOR ].join(","),
- loadNode: function(node) {
- importLoader.addNode(node);
- },
- loadSubtree: function(parent) {
- var nodes = this.marshalNodes(parent);
- importLoader.addNodes(nodes);
- },
- marshalNodes: function(parent) {
- return parent.querySelectorAll(this.loadSelectorsForNode(parent));
- },
- loadSelectorsForNode: function(node) {
- var doc = node.ownerDocument || node;
- return doc === rootDocument ? this.documentPreloadSelectors : this.importsPreloadSelectors;
- },
- loaded: function(url, elt, resource, err, redirectedUrl) {
- flags.load && console.log("loaded", url, elt);
- elt.__resource = resource;
- elt.__error = err;
- if (isImportLink(elt)) {
- var doc = this.documents[url];
- if (doc === undefined) {
- doc = err ? null : makeDocument(resource, redirectedUrl || url);
- if (doc) {
- doc.__importLink = elt;
- this.bootDocument(doc);
- }
- this.documents[url] = doc;
- }
- elt.import = doc;
- }
- parser.parseNext();
- },
- bootDocument: function(doc) {
- this.loadSubtree(doc);
- this.observer.observe(doc);
- parser.parseNext();
- },
- loadedAll: function() {
- parser.parseNext();
- }
- };
- var importLoader = new Loader(importer.loaded.bind(importer), importer.loadedAll.bind(importer));
- importer.observer = new Observer();
- function isImportLink(elt) {
- return isLinkRel(elt, IMPORT_LINK_TYPE);
- }
- function isLinkRel(elt, rel) {
- return elt.localName === "link" && elt.getAttribute("rel") === rel;
- }
- function hasBaseURIAccessor(doc) {
- return !!Object.getOwnPropertyDescriptor(doc, "baseURI");
- }
- function makeDocument(resource, url) {
- var doc = document.implementation.createHTMLDocument(IMPORT_LINK_TYPE);
- doc._URL = url;
- var base = doc.createElement("base");
- base.setAttribute("href", url);
- if (!doc.baseURI && !hasBaseURIAccessor(doc)) {
- Object.defineProperty(doc, "baseURI", {
- value: url
- });
- }
- var meta = doc.createElement("meta");
- meta.setAttribute("charset", "utf-8");
- doc.head.appendChild(meta);
- doc.head.appendChild(base);
- doc.body.innerHTML = resource;
- if (window.HTMLTemplateElement && HTMLTemplateElement.bootstrap) {
- HTMLTemplateElement.bootstrap(doc);
- }
- return doc;
- }
- if (!document.baseURI) {
- var baseURIDescriptor = {
- get: function() {
- var base = document.querySelector("base");
- return base ? base.href : window.location.href;
- },
- configurable: true
- };
- Object.defineProperty(document, "baseURI", baseURIDescriptor);
- Object.defineProperty(rootDocument, "baseURI", baseURIDescriptor);
- }
- scope.importer = importer;
- scope.importLoader = importLoader;
-});
-
-HTMLImports.addModule(function(scope) {
- var parser = scope.parser;
- var importer = scope.importer;
- var dynamic = {
- added: function(nodes) {
- var owner, parsed, loading;
- for (var i = 0, l = nodes.length, n; i < l && (n = nodes[i]); i++) {
- if (!owner) {
- owner = n.ownerDocument;
- parsed = parser.isParsed(owner);
- }
- loading = this.shouldLoadNode(n);
- if (loading) {
- importer.loadNode(n);
- }
- if (this.shouldParseNode(n) && parsed) {
- parser.parseDynamic(n, loading);
- }
- }
- },
- shouldLoadNode: function(node) {
- return node.nodeType === 1 && matches.call(node, importer.loadSelectorsForNode(node));
- },
- shouldParseNode: function(node) {
- return node.nodeType === 1 && matches.call(node, parser.parseSelectorsForNode(node));
- }
- };
- importer.observer.addCallback = dynamic.added.bind(dynamic);
- var matches = HTMLElement.prototype.matches || HTMLElement.prototype.matchesSelector || HTMLElement.prototype.webkitMatchesSelector || HTMLElement.prototype.mozMatchesSelector || HTMLElement.prototype.msMatchesSelector;
-});
-
-(function(scope) {
- var initializeModules = scope.initializeModules;
- var isIE = scope.isIE;
- if (scope.useNative) {
- return;
- }
- if (isIE && typeof window.CustomEvent !== "function") {
- window.CustomEvent = function(inType, params) {
- params = params || {};
- var e = document.createEvent("CustomEvent");
- e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
- return e;
- };
- window.CustomEvent.prototype = window.Event.prototype;
- }
- initializeModules();
- var rootDocument = scope.rootDocument;
- function bootstrap() {
- HTMLImports.importer.bootDocument(rootDocument);
- }
- if (document.readyState === "complete" || document.readyState === "interactive" && !window.attachEvent) {
- bootstrap();
- } else {
- document.addEventListener("DOMContentLoaded", bootstrap);
- }
-})(HTMLImports);
-
-window.CustomElements = window.CustomElements || {
- flags: {}
-};
-
-(function(scope) {
- var flags = scope.flags;
- var modules = [];
- var addModule = function(module) {
- modules.push(module);
- };
- var initializeModules = function() {
- modules.forEach(function(module) {
- module(scope);
- });
- };
- scope.addModule = addModule;
- scope.initializeModules = initializeModules;
- scope.hasNative = Boolean(document.registerElement);
- scope.useNative = !flags.register && scope.hasNative && !window.ShadowDOMPolyfill && (!window.HTMLImports || HTMLImports.useNative);
-})(CustomElements);
-
-CustomElements.addModule(function(scope) {
- var IMPORT_LINK_TYPE = window.HTMLImports ? HTMLImports.IMPORT_LINK_TYPE : "none";
- function forSubtree(node, cb) {
- findAllElements(node, function(e) {
- if (cb(e)) {
- return true;
- }
- forRoots(e, cb);
- });
- forRoots(node, cb);
- }
- function findAllElements(node, find, data) {
- var e = node.firstElementChild;
- if (!e) {
- e = node.firstChild;
- while (e && e.nodeType !== Node.ELEMENT_NODE) {
- e = e.nextSibling;
- }
- }
- while (e) {
- if (find(e, data) !== true) {
- findAllElements(e, find, data);
- }
- e = e.nextElementSibling;
- }
- return null;
- }
- function forRoots(node, cb) {
- var root = node.shadowRoot;
- while (root) {
- forSubtree(root, cb);
- root = root.olderShadowRoot;
- }
- }
- var processingDocuments;
- function forDocumentTree(doc, cb) {
- processingDocuments = [];
- _forDocumentTree(doc, cb);
- processingDocuments = null;
- }
- function _forDocumentTree(doc, cb) {
- doc = wrap(doc);
- if (processingDocuments.indexOf(doc) >= 0) {
- return;
- }
- processingDocuments.push(doc);
- var imports = doc.querySelectorAll("link[rel=" + IMPORT_LINK_TYPE + "]");
- for (var i = 0, l = imports.length, n; i < l && (n = imports[i]); i++) {
- if (n.import) {
- _forDocumentTree(n.import, cb);
- }
- }
- cb(doc);
- }
- scope.forDocumentTree = forDocumentTree;
- scope.forSubtree = forSubtree;
-});
-
-CustomElements.addModule(function(scope) {
- var flags = scope.flags;
- var forSubtree = scope.forSubtree;
- var forDocumentTree = scope.forDocumentTree;
- function addedNode(node) {
- return added(node) || addedSubtree(node);
- }
- function added(node) {
- if (scope.upgrade(node)) {
- return true;
- }
- attached(node);
- }
- function addedSubtree(node) {
- forSubtree(node, function(e) {
- if (added(e)) {
- return true;
- }
- });
- }
- function attachedNode(node) {
- attached(node);
- if (inDocument(node)) {
- forSubtree(node, function(e) {
- attached(e);
- });
- }
- }
- var hasPolyfillMutations = !window.MutationObserver || window.MutationObserver === window.JsMutationObserver;
- scope.hasPolyfillMutations = hasPolyfillMutations;
- var isPendingMutations = false;
- var pendingMutations = [];
- function deferMutation(fn) {
- pendingMutations.push(fn);
- if (!isPendingMutations) {
- isPendingMutations = true;
- setTimeout(takeMutations);
- }
- }
- function takeMutations() {
- isPendingMutations = false;
- var $p = pendingMutations;
- for (var i = 0, l = $p.length, p; i < l && (p = $p[i]); i++) {
- p();
- }
- pendingMutations = [];
- }
- function attached(element) {
- if (hasPolyfillMutations) {
- deferMutation(function() {
- _attached(element);
- });
- } else {
- _attached(element);
- }
- }
- function _attached(element) {
- if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
- if (!element.__attached && inDocument(element)) {
- element.__attached = true;
- if (element.attachedCallback) {
- element.attachedCallback();
- }
- }
- }
- }
- function detachedNode(node) {
- detached(node);
- forSubtree(node, function(e) {
- detached(e);
- });
- }
- function detached(element) {
- if (hasPolyfillMutations) {
- deferMutation(function() {
- _detached(element);
- });
- } else {
- _detached(element);
- }
- }
- function _detached(element) {
- if (element.__upgraded__ && (element.attachedCallback || element.detachedCallback)) {
- if (element.__attached && !inDocument(element)) {
- element.__attached = false;
- if (element.detachedCallback) {
- element.detachedCallback();
- }
- }
- }
- }
- function inDocument(element) {
- var p = element;
- var doc = wrap(document);
- while (p) {
- if (p == doc) {
- return true;
- }
- p = p.parentNode || p.host;
- }
- }
- function watchShadow(node) {
- if (node.shadowRoot && !node.shadowRoot.__watched) {
- flags.dom && console.log("watching shadow-root for: ", node.localName);
- var root = node.shadowRoot;
- while (root) {
- observe(root);
- root = root.olderShadowRoot;
- }
- }
- }
- function handler(mutations) {
- if (flags.dom) {
- var mx = mutations[0];
- if (mx && mx.type === "childList" && mx.addedNodes) {
- if (mx.addedNodes) {
- var d = mx.addedNodes[0];
- while (d && d !== document && !d.host) {
- d = d.parentNode;
- }
- var u = d && (d.URL || d._URL || d.host && d.host.localName) || "";
- u = u.split("/?").shift().split("/").pop();
- }
- }
- console.group("mutations (%d) [%s]", mutations.length, u || "");
- }
- mutations.forEach(function(mx) {
- if (mx.type === "childList") {
- forEach(mx.addedNodes, function(n) {
- if (!n.localName) {
- return;
- }
- addedNode(n);
- });
- forEach(mx.removedNodes, function(n) {
- if (!n.localName) {
- return;
- }
- detachedNode(n);
- });
- }
- });
- flags.dom && console.groupEnd();
- }
- function takeRecords(node) {
- node = wrap(node);
- if (!node) {
- node = wrap(document);
- }
- while (node.parentNode) {
- node = node.parentNode;
- }
- var observer = node.__observer;
- if (observer) {
- handler(observer.takeRecords());
- takeMutations();
- }
- }
- var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
- function observe(inRoot) {
- if (inRoot.__observer) {
- return;
- }
- var observer = new MutationObserver(handler);
- observer.observe(inRoot, {
- childList: true,
- subtree: true
- });
- inRoot.__observer = observer;
- }
- function upgradeDocument(doc) {
- doc = wrap(doc);
- flags.dom && console.group("upgradeDocument: ", doc.baseURI.split("/").pop());
- addedNode(doc);
- observe(doc);
- flags.dom && console.groupEnd();
- }
- function upgradeDocumentTree(doc) {
- forDocumentTree(doc, upgradeDocument);
- }
- var originalCreateShadowRoot = Element.prototype.createShadowRoot;
- if (originalCreateShadowRoot) {
- Element.prototype.createShadowRoot = function() {
- var root = originalCreateShadowRoot.call(this);
- CustomElements.watchShadow(this);
- return root;
- };
- }
- scope.watchShadow = watchShadow;
- scope.upgradeDocumentTree = upgradeDocumentTree;
- scope.upgradeSubtree = addedSubtree;
- scope.upgradeAll = addedNode;
- scope.attachedNode = attachedNode;
- scope.takeRecords = takeRecords;
-});
-
-CustomElements.addModule(function(scope) {
- var flags = scope.flags;
- function upgrade(node) {
- if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
- var is = node.getAttribute("is");
- var definition = scope.getRegisteredDefinition(is || node.localName);
- if (definition) {
- if (is && definition.tag == node.localName) {
- return upgradeWithDefinition(node, definition);
- } else if (!is && !definition.extends) {
- return upgradeWithDefinition(node, definition);
- }
- }
- }
- }
- function upgradeWithDefinition(element, definition) {
- flags.upgrade && console.group("upgrade:", element.localName);
- if (definition.is) {
- element.setAttribute("is", definition.is);
- }
- implementPrototype(element, definition);
- element.__upgraded__ = true;
- created(element);
- scope.attachedNode(element);
- scope.upgradeSubtree(element);
- flags.upgrade && console.groupEnd();
- return element;
- }
- function implementPrototype(element, definition) {
- if (Object.__proto__) {
- element.__proto__ = definition.prototype;
- } else {
- customMixin(element, definition.prototype, definition.native);
- element.__proto__ = definition.prototype;
- }
- }
- function customMixin(inTarget, inSrc, inNative) {
- var used = {};
- var p = inSrc;
- while (p !== inNative && p !== HTMLElement.prototype) {
- var keys = Object.getOwnPropertyNames(p);
- for (var i = 0, k; k = keys[i]; i++) {
- if (!used[k]) {
- Object.defineProperty(inTarget, k, Object.getOwnPropertyDescriptor(p, k));
- used[k] = 1;
- }
- }
- p = Object.getPrototypeOf(p);
- }
- }
- function created(element) {
- if (element.createdCallback) {
- element.createdCallback();
- }
- }
- scope.upgrade = upgrade;
- scope.upgradeWithDefinition = upgradeWithDefinition;
- scope.implementPrototype = implementPrototype;
-});
-
-CustomElements.addModule(function(scope) {
- var upgradeDocumentTree = scope.upgradeDocumentTree;
- var upgrade = scope.upgrade;
- var upgradeWithDefinition = scope.upgradeWithDefinition;
- var implementPrototype = scope.implementPrototype;
- var useNative = scope.useNative;
- function register(name, options) {
- var definition = options || {};
- if (!name) {
- throw new Error("document.registerElement: first argument `name` must not be empty");
- }
- if (name.indexOf("-") < 0) {
- throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '" + String(name) + "'.");
- }
- if (isReservedTag(name)) {
- throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '" + String(name) + "'. The type name is invalid.");
- }
- if (getRegisteredDefinition(name)) {
- throw new Error("DuplicateDefinitionError: a type with name '" + String(name) + "' is already registered");
- }
- if (!definition.prototype) {
- definition.prototype = Object.create(HTMLElement.prototype);
- }
- definition.__name = name.toLowerCase();
- definition.lifecycle = definition.lifecycle || {};
- definition.ancestry = ancestry(definition.extends);
- resolveTagName(definition);
- resolvePrototypeChain(definition);
- overrideAttributeApi(definition.prototype);
- registerDefinition(definition.__name, definition);
- definition.ctor = generateConstructor(definition);
- definition.ctor.prototype = definition.prototype;
- definition.prototype.constructor = definition.ctor;
- if (scope.ready) {
- upgradeDocumentTree(document);
- }
- return definition.ctor;
- }
- function overrideAttributeApi(prototype) {
- if (prototype.setAttribute._polyfilled) {
- return;
- }
- var setAttribute = prototype.setAttribute;
- prototype.setAttribute = function(name, value) {
- changeAttribute.call(this, name, value, setAttribute);
- };
- var removeAttribute = prototype.removeAttribute;
- prototype.removeAttribute = function(name) {
- changeAttribute.call(this, name, null, removeAttribute);
- };
- prototype.setAttribute._polyfilled = true;
- }
- function changeAttribute(name, value, operation) {
- name = name.toLowerCase();
- var oldValue = this.getAttribute(name);
- operation.apply(this, arguments);
- var newValue = this.getAttribute(name);
- if (this.attributeChangedCallback && newValue !== oldValue) {
- this.attributeChangedCallback(name, oldValue, newValue);
- }
- }
- function isReservedTag(name) {
- for (var i = 0; i < reservedTagList.length; i++) {
- if (name === reservedTagList[i]) {
- return true;
- }
- }
- }
- var reservedTagList = [ "annotation-xml", "color-profile", "font-face", "font-face-src", "font-face-uri", "font-face-format", "font-face-name", "missing-glyph" ];
- function ancestry(extnds) {
- var extendee = getRegisteredDefinition(extnds);
- if (extendee) {
- return ancestry(extendee.extends).concat([ extendee ]);
- }
- return [];
- }
- function resolveTagName(definition) {
- var baseTag = definition.extends;
- for (var i = 0, a; a = definition.ancestry[i]; i++) {
- baseTag = a.is && a.tag;
- }
- definition.tag = baseTag || definition.__name;
- if (baseTag) {
- definition.is = definition.__name;
- }
- }
- function resolvePrototypeChain(definition) {
- if (!Object.__proto__) {
- var nativePrototype = HTMLElement.prototype;
- if (definition.is) {
- var inst = document.createElement(definition.tag);
- var expectedPrototype = Object.getPrototypeOf(inst);
- if (expectedPrototype === definition.prototype) {
- nativePrototype = expectedPrototype;
- }
- }
- var proto = definition.prototype, ancestor;
- while (proto && proto !== nativePrototype) {
- ancestor = Object.getPrototypeOf(proto);
- proto.__proto__ = ancestor;
- proto = ancestor;
- }
- definition.native = nativePrototype;
- }
- }
- function instantiate(definition) {
- return upgradeWithDefinition(domCreateElement(definition.tag), definition);
- }
- var registry = {};
- function getRegisteredDefinition(name) {
- if (name) {
- return registry[name.toLowerCase()];
- }
- }
- function registerDefinition(name, definition) {
- registry[name] = definition;
- }
- function generateConstructor(definition) {
- return function() {
- return instantiate(definition);
- };
- }
- var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
- function createElementNS(namespace, tag, typeExtension) {
- if (namespace === HTML_NAMESPACE) {
- return createElement(tag, typeExtension);
- } else {
- return domCreateElementNS(namespace, tag);
- }
- }
- function createElement(tag, typeExtension) {
- var definition = getRegisteredDefinition(typeExtension || tag);
- if (definition) {
- if (tag == definition.tag && typeExtension == definition.is) {
- return new definition.ctor();
- }
- if (!typeExtension && !definition.is) {
- return new definition.ctor();
- }
- }
- var element;
- if (typeExtension) {
- element = createElement(tag);
- element.setAttribute("is", typeExtension);
- return element;
- }
- element = domCreateElement(tag);
- if (tag.indexOf("-") >= 0) {
- implementPrototype(element, HTMLElement);
- }
- return element;
- }
- function cloneNode(deep) {
- var n = domCloneNode.call(this, deep);
- upgrade(n);
- return n;
- }
- var domCreateElement = document.createElement.bind(document);
- var domCreateElementNS = document.createElementNS.bind(document);
- var domCloneNode = Node.prototype.cloneNode;
- var isInstance;
- if (!Object.__proto__ && !useNative) {
- isInstance = function(obj, ctor) {
- var p = obj;
- while (p) {
- if (p === ctor.prototype) {
- return true;
- }
- p = p.__proto__;
- }
- return false;
- };
- } else {
- isInstance = function(obj, base) {
- return obj instanceof base;
- };
- }
- document.registerElement = register;
- document.createElement = createElement;
- document.createElementNS = createElementNS;
- Node.prototype.cloneNode = cloneNode;
- scope.registry = registry;
- scope.instanceof = isInstance;
- scope.reservedTagList = reservedTagList;
- scope.getRegisteredDefinition = getRegisteredDefinition;
- document.register = document.registerElement;
-});
-
-(function(scope) {
- var useNative = scope.useNative;
- var initializeModules = scope.initializeModules;
- var isIE11OrOlder = /Trident/.test(navigator.userAgent);
- if (useNative) {
- var nop = function() {};
- scope.watchShadow = nop;
- scope.upgrade = nop;
- scope.upgradeAll = nop;
- scope.upgradeDocumentTree = nop;
- scope.upgradeSubtree = nop;
- scope.takeRecords = nop;
- scope.instanceof = function(obj, base) {
- return obj instanceof base;
- };
- } else {
- initializeModules();
- }
- var upgradeDocumentTree = scope.upgradeDocumentTree;
- if (!window.wrap) {
- if (window.ShadowDOMPolyfill) {
- window.wrap = ShadowDOMPolyfill.wrapIfNeeded;
- window.unwrap = ShadowDOMPolyfill.unwrapIfNeeded;
- } else {
- window.wrap = window.unwrap = function(node) {
- return node;
- };
- }
- }
- function bootstrap() {
- upgradeDocumentTree(wrap(document));
- if (window.HTMLImports) {
- HTMLImports.__importsParsingHook = function(elt) {
- upgradeDocumentTree(wrap(elt.import));
- };
- }
- CustomElements.ready = true;
- setTimeout(function() {
- CustomElements.readyTime = Date.now();
- if (window.HTMLImports) {
- CustomElements.elapsed = CustomElements.readyTime - HTMLImports.readyTime;
- }
- document.dispatchEvent(new CustomEvent("WebComponentsReady", {
- bubbles: true
- }));
- });
- }
- if (isIE11OrOlder && typeof window.CustomEvent !== "function") {
- window.CustomEvent = function(inType, params) {
- params = params || {};
- var e = document.createEvent("CustomEvent");
- e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);
- return e;
- };
- window.CustomEvent.prototype = window.Event.prototype;
- }
- if (document.readyState === "complete" || scope.flags.eager) {
- bootstrap();
- } else if (document.readyState === "interactive" && !window.attachEvent && (!window.HTMLImports || window.HTMLImports.ready)) {
- bootstrap();
- } else {
- var loadEvent = window.HTMLImports && !HTMLImports.ready ? "HTMLImportsLoaded" : "DOMContentLoaded";
- window.addEventListener(loadEvent, bootstrap);
- }
-})(window.CustomElements);
-
-(function(scope) {
- if (!Function.prototype.bind) {
- Function.prototype.bind = function(scope) {
- var self = this;
- var args = Array.prototype.slice.call(arguments, 1);
- return function() {
- var args2 = args.slice();
- args2.push.apply(args2, arguments);
- return self.apply(scope, args2);
- };
- };
- }
-})(window.WebComponents);
-
-(function(scope) {
- "use strict";
- if (!window.performance) {
- var start = Date.now();
- window.performance = {
- now: function() {
- return Date.now() - start;
- }
- };
- }
- if (!window.requestAnimationFrame) {
- window.requestAnimationFrame = function() {
- var nativeRaf = window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
- return nativeRaf ? function(callback) {
- return nativeRaf(function() {
- callback(performance.now());
- });
- } : function(callback) {
- return window.setTimeout(callback, 1e3 / 60);
- };
- }();
- }
- if (!window.cancelAnimationFrame) {
- window.cancelAnimationFrame = function() {
- return window.webkitCancelAnimationFrame || window.mozCancelAnimationFrame || function(id) {
- clearTimeout(id);
- };
- }();
- }
- var elementDeclarations = [];
- var polymerStub = function(name, dictionary) {
- if (typeof name !== "string" && arguments.length === 1) {
- Array.prototype.push.call(arguments, document._currentScript);
- }
- elementDeclarations.push(arguments);
- };
- window.Polymer = polymerStub;
- scope.consumeDeclarations = function(callback) {
- scope.consumeDeclarations = function() {
- throw "Possible attempt to load Polymer twice";
- };
- if (callback) {
- callback(elementDeclarations);
- }
- elementDeclarations = null;
- };
- function installPolymerWarning() {
- if (window.Polymer === polymerStub) {
- window.Polymer = function() {
- throw new Error("You tried to use polymer without loading it first. To " + 'load polymer, <link rel="import" href="' + 'components/polymer/polymer.html">');
- };
- }
- }
- if (HTMLImports.useNative) {
- installPolymerWarning();
- } else {
- addEventListener("DOMContentLoaded", installPolymerWarning);
- }
-})(window.WebComponents);
-
-(function(scope) {
- var style = document.createElement("style");
- style.textContent = "" + "body {" + "transition: opacity ease-in 0.2s;" + " } \n" + "body[unresolved] {" + "opacity: 0; display: block; overflow: hidden; position: relative;" + " } \n";
- var head = document.querySelector("head");
- head.insertBefore(style, head.firstChild);
-})(window.WebComponents);
-
-(function(scope) {
- window.Platform = scope;
-})(window.WebComponents); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents.min.js b/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents.min.js
deleted file mode 100644
index 474305f73fc..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/components/webcomponentsjs/webcomponents.min.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/**
- * @license
- * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
- * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
- * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
- * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
- * Code distributed by Google as part of the polymer project is also
- * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
- */
-// @version 0.5.5
-window.WebComponents=window.WebComponents||{},function(e){var t=e.flags||{},n="webcomponents.js",r=document.querySelector('script[src*="'+n+'"]');if(!t.noOpts){if(location.search.slice(1).split("&").forEach(function(e){e=e.split("="),e[0]&&(t[e[0]]=e[1]||!0)}),r)for(var o,i=0;o=r.attributes[i];i++)"src"!==o.name&&(t[o.name]=o.value||!0);if(t.log){var a=t.log.split(",");t.log={},a.forEach(function(e){t.log[e]=!0})}else t.log={}}t.shadow=t.shadow||t.shadowdom||t.polyfill,t.shadow="native"===t.shadow?!1:t.shadow||!HTMLElement.prototype.createShadowRoot,t.register&&(window.CustomElements=window.CustomElements||{flags:{}},window.CustomElements.flags.register=t.register),e.flags=t}(WebComponents),WebComponents.flags.shadow&&("undefined"==typeof WeakMap&&!function(){var e=Object.defineProperty,t=Date.now()%1e9,n=function(){this.name="__st"+(1e9*Math.random()>>>0)+(t++ +"__")};n.prototype={set:function(t,n){var r=t[this.name];return r&&r[0]===t?r[1]=n:e(t,this.name,{value:[t,n],writable:!0}),this},get:function(e){var t;return(t=e[this.name])&&t[0]===e?t[1]:void 0},"delete":function(e){var t=e[this.name];return t&&t[0]===e?(t[0]=t[1]=void 0,!0):!1},has:function(e){var t=e[this.name];return t?t[0]===e:!1}},window.WeakMap=n}(),window.ShadowDOMPolyfill={},function(e){"use strict";function t(){if("undefined"!=typeof chrome&&chrome.app&&chrome.app.runtime)return!1;if(navigator.getDeviceStorage)return!1;try{var e=new Function("return true;");return e()}catch(t){return!1}}function n(e){if(!e)throw new Error("Assertion failed")}function r(e,t){for(var n=W(t),r=0;r<n.length;r++){var o=n[r];k(e,o,F(t,o))}return e}function o(e,t){for(var n=W(t),r=0;r<n.length;r++){var o=n[r];switch(o){case"arguments":case"caller":case"length":case"name":case"prototype":case"toString":continue}k(e,o,F(t,o))}return e}function i(e,t){for(var n=0;n<t.length;n++)if(t[n]in e)return t[n]}function a(e,t,n){B.value=n,k(e,t,B)}function s(e){var t=e.__proto__||Object.getPrototypeOf(e);if(U)try{W(t)}catch(n){t=t.__proto__}var r=R.get(t);if(r)return r;var o=s(t),i=E(o);return g(t,i,e),i}function c(e,t){w(e,t,!0)}function l(e,t){w(t,e,!1)}function u(e){return/^on[a-z]+$/.test(e)}function d(e){return/^\w[a-zA-Z_0-9]*$/.test(e)}function p(e){return A&&d(e)?new Function("return this.__impl4cf1e782hg__."+e):function(){return this.__impl4cf1e782hg__[e]}}function f(e){return A&&d(e)?new Function("v","this.__impl4cf1e782hg__."+e+" = v"):function(t){this.__impl4cf1e782hg__[e]=t}}function h(e){return A&&d(e)?new Function("return this.__impl4cf1e782hg__."+e+".apply(this.__impl4cf1e782hg__, arguments)"):function(){return this.__impl4cf1e782hg__[e].apply(this.__impl4cf1e782hg__,arguments)}}function m(e,t){try{return Object.getOwnPropertyDescriptor(e,t)}catch(n){return q}}function w(t,n,r){for(var o=W(t),i=0;i<o.length;i++){var a=o[i];if("polymerBlackList_"!==a&&!(a in n||t.polymerBlackList_&&t.polymerBlackList_[a])){U&&t.__lookupGetter__(a);var s,c,l=m(t,a);if(r&&"function"==typeof l.value)n[a]=h(a);else{var d=u(a);s=d?e.getEventHandlerGetter(a):p(a),(l.writable||l.set||V)&&(c=d?e.getEventHandlerSetter(a):f(a));var w=V||l.configurable;k(n,a,{get:s,set:c,configurable:w,enumerable:l.enumerable})}}}}function v(e,t,n){var r=e.prototype;g(r,t,n),o(t,e)}function g(e,t,r){var o=t.prototype;n(void 0===R.get(e)),R.set(e,t),P.set(o,e),c(e,o),r&&l(o,r),a(o,"constructor",t),t.prototype=o}function b(e,t){return R.get(t.prototype)===e}function y(e){var t=Object.getPrototypeOf(e),n=s(t),r=E(n);return g(t,r,e),r}function E(e){function t(t){e.call(this,t)}var n=Object.create(e.prototype);return n.constructor=t,t.prototype=n,t}function S(e){return e&&e.__impl4cf1e782hg__}function T(e){return!S(e)}function M(e){return null===e?null:(n(T(e)),e.__wrapper8e3dd93a60__||(e.__wrapper8e3dd93a60__=new(s(e))(e)))}function _(e){return null===e?null:(n(S(e)),e.__impl4cf1e782hg__)}function L(e){return e.__impl4cf1e782hg__}function O(e,t){t.__impl4cf1e782hg__=e,e.__wrapper8e3dd93a60__=t}function C(e){return e&&S(e)?_(e):e}function N(e){return e&&!S(e)?M(e):e}function D(e,t){null!==t&&(n(T(e)),n(void 0===t||S(t)),e.__wrapper8e3dd93a60__=t)}function j(e,t,n){G.get=n,k(e.prototype,t,G)}function H(e,t){j(e,t,function(){return M(this.__impl4cf1e782hg__[t])})}function x(e,t){e.forEach(function(e){t.forEach(function(t){e.prototype[t]=function(){var e=N(this);return e[t].apply(e,arguments)}})})}var R=new WeakMap,P=new WeakMap,I=Object.create(null),A=t(),k=Object.defineProperty,W=Object.getOwnPropertyNames,F=Object.getOwnPropertyDescriptor,B={value:void 0,configurable:!0,enumerable:!1,writable:!0};W(window);var U=/Firefox/.test(navigator.userAgent),q={get:function(){},set:function(){},configurable:!0,enumerable:!0},V=function(){var e=Object.getOwnPropertyDescriptor(Node.prototype,"nodeType");return e&&!e.get&&!e.set}(),G={get:void 0,configurable:!0,enumerable:!0};e.assert=n,e.constructorTable=R,e.defineGetter=j,e.defineWrapGetter=H,e.forwardMethodsToWrapper=x,e.isWrapper=S,e.isWrapperFor=b,e.mixin=r,e.nativePrototypeTable=P,e.oneOf=i,e.registerObject=y,e.registerWrapper=v,e.rewrap=D,e.setWrapper=O,e.unsafeUnwrap=L,e.unwrap=_,e.unwrapIfNeeded=C,e.wrap=M,e.wrapIfNeeded=N,e.wrappers=I}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e,t,n){return{index:e,removed:t,addedCount:n}}function n(){}var r=0,o=1,i=2,a=3;n.prototype={calcEditDistances:function(e,t,n,r,o,i){for(var a=i-o+1,s=n-t+1,c=new Array(a),l=0;a>l;l++)c[l]=new Array(s),c[l][0]=l;for(var u=0;s>u;u++)c[0][u]=u;for(var l=1;a>l;l++)for(var u=1;s>u;u++)if(this.equals(e[t+u-1],r[o+l-1]))c[l][u]=c[l-1][u-1];else{var d=c[l-1][u]+1,p=c[l][u-1]+1;c[l][u]=p>d?d:p}return c},spliceOperationsFromEditDistances:function(e){for(var t=e.length-1,n=e[0].length-1,s=e[t][n],c=[];t>0||n>0;)if(0!=t)if(0!=n){var l,u=e[t-1][n-1],d=e[t-1][n],p=e[t][n-1];l=p>d?u>d?d:u:u>p?p:u,l==u?(u==s?c.push(r):(c.push(o),s=u),t--,n--):l==d?(c.push(a),t--,s=d):(c.push(i),n--,s=p)}else c.push(a),t--;else c.push(i),n--;return c.reverse(),c},calcSplices:function(e,n,s,c,l,u){var d=0,p=0,f=Math.min(s-n,u-l);if(0==n&&0==l&&(d=this.sharedPrefix(e,c,f)),s==e.length&&u==c.length&&(p=this.sharedSuffix(e,c,f-d)),n+=d,l+=d,s-=p,u-=p,s-n==0&&u-l==0)return[];if(n==s){for(var h=t(n,[],0);u>l;)h.removed.push(c[l++]);return[h]}if(l==u)return[t(n,[],s-n)];for(var m=this.spliceOperationsFromEditDistances(this.calcEditDistances(e,n,s,c,l,u)),h=void 0,w=[],v=n,g=l,b=0;b<m.length;b++)switch(m[b]){case r:h&&(w.push(h),h=void 0),v++,g++;break;case o:h||(h=t(v,[],0)),h.addedCount++,v++,h.removed.push(c[g]),g++;break;case i:h||(h=t(v,[],0)),h.addedCount++,v++;break;case a:h||(h=t(v,[],0)),h.removed.push(c[g]),g++}return h&&w.push(h),w},sharedPrefix:function(e,t,n){for(var r=0;n>r;r++)if(!this.equals(e[r],t[r]))return r;return n},sharedSuffix:function(e,t,n){for(var r=e.length,o=t.length,i=0;n>i&&this.equals(e[--r],t[--o]);)i++;return i},calculateSplices:function(e,t){return this.calcSplices(e,0,e.length,t,0,t.length)},equals:function(e,t){return e===t}},e.ArraySplice=n}(window.ShadowDOMPolyfill),function(e){"use strict";function t(){a=!1;var e=i.slice(0);i=[];for(var t=0;t<e.length;t++)e[t]()}function n(e){i.push(e),a||(a=!0,r(t,0))}var r,o=window.MutationObserver,i=[],a=!1;if(o){var s=1,c=new o(t),l=document.createTextNode(s);c.observe(l,{characterData:!0}),r=function(){s=(s+1)%2,l.data=s}}else r=window.setTimeout;e.setEndOfMicrotask=n}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){e.scheduled_||(e.scheduled_=!0,h.push(e),m||(u(n),m=!0))}function n(){for(m=!1;h.length;){var e=h;h=[],e.sort(function(e,t){return e.uid_-t.uid_});for(var t=0;t<e.length;t++){var n=e[t];n.scheduled_=!1;var r=n.takeRecords();i(n),r.length&&n.callback_(r,n)}}}function r(e,t){this.type=e,this.target=t,this.addedNodes=new p.NodeList,this.removedNodes=new p.NodeList,this.previousSibling=null,this.nextSibling=null,this.attributeName=null,this.attributeNamespace=null,this.oldValue=null}function o(e,t){for(;e;e=e.parentNode){var n=f.get(e);if(n)for(var r=0;r<n.length;r++){var o=n[r];o.options.subtree&&o.addTransientObserver(t)}}}function i(e){for(var t=0;t<e.nodes_.length;t++){var n=e.nodes_[t],r=f.get(n);if(!r)return;for(var o=0;o<r.length;o++){var i=r[o];i.observer===e&&i.removeTransientObservers()}}}function a(e,n,o){for(var i=Object.create(null),a=Object.create(null),s=e;s;s=s.parentNode){var c=f.get(s);if(c)for(var l=0;l<c.length;l++){var u=c[l],d=u.options;if((s===e||d.subtree)&&!("attributes"===n&&!d.attributes||"attributes"===n&&d.attributeFilter&&(null!==o.namespace||-1===d.attributeFilter.indexOf(o.name))||"characterData"===n&&!d.characterData||"childList"===n&&!d.childList)){var p=u.observer;i[p.uid_]=p,("attributes"===n&&d.attributeOldValue||"characterData"===n&&d.characterDataOldValue)&&(a[p.uid_]=o.oldValue)}}}for(var h in i){var p=i[h],m=new r(n,e);"name"in o&&"namespace"in o&&(m.attributeName=o.name,m.attributeNamespace=o.namespace),o.addedNodes&&(m.addedNodes=o.addedNodes),o.removedNodes&&(m.removedNodes=o.removedNodes),o.previousSibling&&(m.previousSibling=o.previousSibling),o.nextSibling&&(m.nextSibling=o.nextSibling),void 0!==a[h]&&(m.oldValue=a[h]),t(p),p.records_.push(m)}}function s(e){if(this.childList=!!e.childList,this.subtree=!!e.subtree,this.attributes="attributes"in e||!("attributeOldValue"in e||"attributeFilter"in e)?!!e.attributes:!0,this.characterData="characterDataOldValue"in e&&!("characterData"in e)?!0:!!e.characterData,!this.attributes&&(e.attributeOldValue||"attributeFilter"in e)||!this.characterData&&e.characterDataOldValue)throw new TypeError;if(this.characterData=!!e.characterData,this.attributeOldValue=!!e.attributeOldValue,this.characterDataOldValue=!!e.characterDataOldValue,"attributeFilter"in e){if(null==e.attributeFilter||"object"!=typeof e.attributeFilter)throw new TypeError;this.attributeFilter=w.call(e.attributeFilter)}else this.attributeFilter=null}function c(e){this.callback_=e,this.nodes_=[],this.records_=[],this.uid_=++v,this.scheduled_=!1}function l(e,t,n){this.observer=e,this.target=t,this.options=n,this.transientObservedNodes=[]}var u=e.setEndOfMicrotask,d=e.wrapIfNeeded,p=e.wrappers,f=new WeakMap,h=[],m=!1,w=Array.prototype.slice,v=0;c.prototype={constructor:c,observe:function(e,t){e=d(e);var n,r=new s(t),o=f.get(e);o||f.set(e,o=[]);for(var i=0;i<o.length;i++)o[i].observer===this&&(n=o[i],n.removeTransientObservers(),n.options=r);n||(n=new l(this,e,r),o.push(n),this.nodes_.push(e))},disconnect:function(){this.nodes_.forEach(function(e){for(var t=f.get(e),n=0;n<t.length;n++){var r=t[n];if(r.observer===this){t.splice(n,1);break}}},this),this.records_=[]},takeRecords:function(){var e=this.records_;return this.records_=[],e}},l.prototype={addTransientObserver:function(e){if(e!==this.target){t(this.observer),this.transientObservedNodes.push(e);var n=f.get(e);n||f.set(e,n=[]),n.push(this)}},removeTransientObservers:function(){var e=this.transientObservedNodes;this.transientObservedNodes=[];for(var t=0;t<e.length;t++)for(var n=e[t],r=f.get(n),o=0;o<r.length;o++)if(r[o]===this){r.splice(o,1);break}}},e.enqueueMutation=a,e.registerTransientObservers=o,e.wrappers.MutationObserver=c,e.wrappers.MutationRecord=r}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e,t){this.root=e,this.parent=t}function n(e,t){if(e.treeScope_!==t){e.treeScope_=t;for(var r=e.shadowRoot;r;r=r.olderShadowRoot)r.treeScope_.parent=t;for(var o=e.firstChild;o;o=o.nextSibling)n(o,t)}}function r(n){if(n instanceof e.wrappers.Window,n.treeScope_)return n.treeScope_;var o,i=n.parentNode;return o=i?r(i):new t(n,null),n.treeScope_=o}t.prototype={get renderer(){return this.root instanceof e.wrappers.ShadowRoot?e.getRendererForHost(this.root.host):null},contains:function(e){for(;e;e=e.parent)if(e===this)return!0;return!1}},e.TreeScope=t,e.getTreeScope=r,e.setTreeScope=n}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){return e instanceof G.ShadowRoot}function n(e){return k(e).root}function r(e,r){var s=[],c=e;for(s.push(c);c;){var l=a(c);if(l&&l.length>0){for(var u=0;u<l.length;u++){var p=l[u];if(i(p)){var f=n(p),h=f.olderShadowRoot;h&&s.push(h)}s.push(p)}c=l[l.length-1]}else if(t(c)){if(d(e,c)&&o(r))break;c=c.host,s.push(c)}else c=c.parentNode,c&&s.push(c)}return s}function o(e){if(!e)return!1;switch(e.type){case"abort":case"error":case"select":case"change":case"load":case"reset":case"resize":case"scroll":case"selectstart":return!0}return!1}function i(e){return e instanceof HTMLShadowElement}function a(t){return e.getDestinationInsertionPoints(t)}function s(e,t){if(0===e.length)return t;t instanceof G.Window&&(t=t.document);for(var n=k(t),r=e[0],o=k(r),i=l(n,o),a=0;a<e.length;a++){var s=e[a];if(k(s)===i)return s}return e[e.length-1]}function c(e){for(var t=[];e;e=e.parent)t.push(e);return t}function l(e,t){for(var n=c(e),r=c(t),o=null;n.length>0&&r.length>0;){var i=n.pop(),a=r.pop();if(i!==a)break;o=i}return o}function u(e,t,n){t instanceof G.Window&&(t=t.document);var o,i=k(t),a=k(n),s=r(n,e),o=l(i,a);o||(o=a.root);for(var c=o;c;c=c.parent)for(var u=0;u<s.length;u++){var d=s[u];if(k(d)===c)return d}return null}function d(e,t){return k(e)===k(t)}function p(e){if(!K.get(e)&&(K.set(e,!0),h(V(e),V(e.target)),I)){var t=I;throw I=null,t}}function f(e){switch(e.type){case"load":case"beforeunload":case"unload":return!0}return!1}function h(t,n){if(Y.get(t))throw new Error("InvalidStateError");Y.set(t,!0),e.renderAllPending();var o,i,a;if(f(t)&&!t.bubbles){var s=n;s instanceof G.Document&&(a=s.defaultView)&&(i=s,o=[])}if(!o)if(n instanceof G.Window)a=n,o=[];else if(o=r(n,t),!f(t)){var s=o[o.length-1];s instanceof G.Document&&(a=s.defaultView)}return nt.set(t,o),m(t,o,a,i)&&w(t,o,a,i)&&v(t,o,a,i),Z.set(t,rt),$["delete"](t,null),Y["delete"](t),t.defaultPrevented}function m(e,t,n,r){var o=ot;if(n&&!g(n,e,o,t,r))return!1;for(var i=t.length-1;i>0;i--)if(!g(t[i],e,o,t,r))return!1;return!0}function w(e,t,n,r){var o=it,i=t[0]||n;return g(i,e,o,t,r)}function v(e,t,n,r){for(var o=at,i=1;i<t.length;i++)if(!g(t[i],e,o,t,r))return;n&&t.length>0&&g(n,e,o,t,r)}function g(e,t,n,r,o){var i=z.get(e);if(!i)return!0;var a=o||s(r,e);if(a===e){if(n===ot)return!0;n===at&&(n=it)}else if(n===at&&!t.bubbles)return!0;if("relatedTarget"in t){var c=q(t),l=c.relatedTarget;if(l){if(l instanceof Object&&l.addEventListener){var d=V(l),p=u(t,e,d);if(p===a)return!0}else p=null;J.set(t,p)}}Z.set(t,n);var f=t.type,h=!1;X.set(t,a),$.set(t,e),i.depth++;for(var m=0,w=i.length;w>m;m++){var v=i[m];if(v.removed)h=!0;else if(!(v.type!==f||!v.capture&&n===ot||v.capture&&n===at))try{if("function"==typeof v.handler?v.handler.call(e,t):v.handler.handleEvent(t),et.get(t))return!1}catch(g){I||(I=g)}}if(i.depth--,h&&0===i.depth){var b=i.slice();i.length=0;for(var m=0;m<b.length;m++)b[m].removed||i.push(b[m])}return!Q.get(t)}function b(e,t,n){this.type=e,this.handler=t,this.capture=Boolean(n)}function y(e,t){if(!(e instanceof st))return V(M(st,"Event",e,t));var n=e;return gt||"beforeunload"!==n.type||this instanceof _?void B(n,this):new _(n)}function E(e){return e&&e.relatedTarget?Object.create(e,{relatedTarget:{value:q(e.relatedTarget)}}):e}function S(e,t,n){var r=window[e],o=function(t,n){return t instanceof r?void B(t,this):V(M(r,e,t,n))};if(o.prototype=Object.create(t.prototype),n&&W(o.prototype,n),r)try{F(r,o,new r("temp"))}catch(i){F(r,o,document.createEvent(e))}return o}function T(e,t){return function(){arguments[t]=q(arguments[t]);var n=q(this);n[e].apply(n,arguments)}}function M(e,t,n,r){if(wt)return new e(n,E(r));var o=q(document.createEvent(t)),i=mt[t],a=[n];return Object.keys(i).forEach(function(e){var t=null!=r&&e in r?r[e]:i[e];"relatedTarget"===e&&(t=q(t)),a.push(t)}),o["init"+t].apply(o,a),o}function _(e){y.call(this,e)}function L(e){return"function"==typeof e?!0:e&&e.handleEvent}function O(e){switch(e){case"DOMAttrModified":case"DOMAttributeNameChanged":case"DOMCharacterDataModified":case"DOMElementNameChanged":case"DOMNodeInserted":case"DOMNodeInsertedIntoDocument":case"DOMNodeRemoved":case"DOMNodeRemovedFromDocument":case"DOMSubtreeModified":return!0}return!1}function C(e){B(e,this)}function N(e){return e instanceof G.ShadowRoot&&(e=e.host),q(e)}function D(e,t){var n=z.get(e);if(n)for(var r=0;r<n.length;r++)if(!n[r].removed&&n[r].type===t)return!0;return!1}function j(e,t){for(var n=q(e);n;n=n.parentNode)if(D(V(n),t))return!0;return!1}function H(e){A(e,yt)}function x(t,n,o,i){e.renderAllPending();var a=V(Et.call(U(n),o,i));if(!a)return null;var c=r(a,null),l=c.lastIndexOf(t);return-1==l?null:(c=c.slice(0,l),s(c,t))}function R(e){return function(){var t=tt.get(this);return t&&t[e]&&t[e].value||null}}function P(e){var t=e.slice(2);return function(n){var r=tt.get(this);r||(r=Object.create(null),tt.set(this,r));var o=r[e];if(o&&this.removeEventListener(t,o.wrapped,!1),"function"==typeof n){var i=function(t){var r=n.call(this,t);r===!1?t.preventDefault():"onbeforeunload"===e&&"string"==typeof r&&(t.returnValue=r)};this.addEventListener(t,i,!1),r[e]={value:n,wrapped:i}}}}var I,A=e.forwardMethodsToWrapper,k=e.getTreeScope,W=e.mixin,F=e.registerWrapper,B=e.setWrapper,U=e.unsafeUnwrap,q=e.unwrap,V=e.wrap,G=e.wrappers,z=(new WeakMap,new WeakMap),K=new WeakMap,Y=new WeakMap,X=new WeakMap,$=new WeakMap,J=new WeakMap,Z=new WeakMap,Q=new WeakMap,et=new WeakMap,tt=new WeakMap,nt=new WeakMap,rt=0,ot=1,it=2,at=3;b.prototype={equals:function(e){return this.handler===e.handler&&this.type===e.type&&this.capture===e.capture},get removed(){return null===this.handler},remove:function(){this.handler=null}};var st=window.Event;st.prototype.polymerBlackList_={returnValue:!0,keyLocation:!0},y.prototype={get target(){return X.get(this)},get currentTarget(){return $.get(this)},get eventPhase(){return Z.get(this)},get path(){var e=nt.get(this);return e?e.slice():[]},stopPropagation:function(){Q.set(this,!0)},stopImmediatePropagation:function(){Q.set(this,!0),et.set(this,!0)}},F(st,y,document.createEvent("Event"));var ct=S("UIEvent",y),lt=S("CustomEvent",y),ut={get relatedTarget(){var e=J.get(this);return void 0!==e?e:V(q(this).relatedTarget)}},dt=W({initMouseEvent:T("initMouseEvent",14)},ut),pt=W({initFocusEvent:T("initFocusEvent",5)},ut),ft=S("MouseEvent",ct,dt),ht=S("FocusEvent",ct,pt),mt=Object.create(null),wt=function(){try{new window.FocusEvent("focus")}catch(e){return!1}return!0}();if(!wt){var vt=function(e,t,n){if(n){var r=mt[n];t=W(W({},r),t)}mt[e]=t};vt("Event",{bubbles:!1,cancelable:!1}),vt("CustomEvent",{detail:null},"Event"),vt("UIEvent",{view:null,detail:0},"Event"),vt("MouseEvent",{screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,altKey:!1,shiftKey:!1,metaKey:!1,button:0,relatedTarget:null},"UIEvent"),vt("FocusEvent",{relatedTarget:null},"UIEvent")}var gt=window.BeforeUnloadEvent;_.prototype=Object.create(y.prototype),W(_.prototype,{get returnValue(){return U(this).returnValue},set returnValue(e){U(this).returnValue=e}}),gt&&F(gt,_);var bt=window.EventTarget,yt=["addEventListener","removeEventListener","dispatchEvent"];[Node,Window].forEach(function(e){var t=e.prototype;yt.forEach(function(e){Object.defineProperty(t,e+"_",{value:t[e]})})}),C.prototype={addEventListener:function(e,t,n){if(L(t)&&!O(e)){var r=new b(e,t,n),o=z.get(this);if(o){for(var i=0;i<o.length;i++)if(r.equals(o[i]))return}else o=[],o.depth=0,z.set(this,o);o.push(r);var a=N(this);a.addEventListener_(e,p,!0)}},removeEventListener:function(e,t,n){n=Boolean(n);var r=z.get(this);if(r){for(var o=0,i=!1,a=0;a<r.length;a++)r[a].type===e&&r[a].capture===n&&(o++,r[a].handler===t&&(i=!0,r[a].remove()));if(i&&1===o){var s=N(this);s.removeEventListener_(e,p,!0)}}},dispatchEvent:function(t){var n=q(t),r=n.type;K.set(n,!1),e.renderAllPending();var o;j(this,r)||(o=function(){},this.addEventListener(r,o,!0));try{return q(this).dispatchEvent_(n)}finally{o&&this.removeEventListener(r,o,!0)}}},bt&&F(bt,C);var Et=document.elementFromPoint;e.elementFromPoint=x,e.getEventHandlerGetter=R,e.getEventHandlerSetter=P,e.wrapEventTargetMethods=H,e.wrappers.BeforeUnloadEvent=_,e.wrappers.CustomEvent=lt,e.wrappers.Event=y,e.wrappers.EventTarget=C,e.wrappers.FocusEvent=ht,e.wrappers.MouseEvent=ft,e.wrappers.UIEvent=ct}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e,t){Object.defineProperty(e,t,m)}function n(e){l(e,this)}function r(){this.length=0,t(this,"length")}function o(e){for(var t=new r,o=0;o<e.length;o++)t[o]=new n(e[o]);return t.length=o,t}function i(e){a.call(this,e)}var a=e.wrappers.UIEvent,s=e.mixin,c=e.registerWrapper,l=e.setWrapper,u=e.unsafeUnwrap,d=e.wrap,p=window.TouchEvent;if(p){var f;try{f=document.createEvent("TouchEvent")}catch(h){return}var m={enumerable:!1};n.prototype={get target(){return d(u(this).target)}};var w={configurable:!0,enumerable:!0,get:null};["clientX","clientY","screenX","screenY","pageX","pageY","identifier","webkitRadiusX","webkitRadiusY","webkitRotationAngle","webkitForce"].forEach(function(e){w.get=function(){return u(this)[e]},Object.defineProperty(n.prototype,e,w)}),r.prototype={item:function(e){return this[e]}},i.prototype=Object.create(a.prototype),s(i.prototype,{get touches(){return o(u(this).touches)},get targetTouches(){return o(u(this).targetTouches)},get changedTouches(){return o(u(this).changedTouches)},initTouchEvent:function(){throw new Error("Not implemented")}}),c(p,i,f),e.wrappers.Touch=n,e.wrappers.TouchEvent=i,e.wrappers.TouchList=r}}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e,t){Object.defineProperty(e,t,s)}function n(){this.length=0,t(this,"length")}function r(e){if(null==e)return e;for(var t=new n,r=0,o=e.length;o>r;r++)t[r]=a(e[r]);return t.length=o,t}function o(e,t){e.prototype[t]=function(){return r(i(this)[t].apply(i(this),arguments))}}var i=e.unsafeUnwrap,a=e.wrap,s={enumerable:!1};n.prototype={item:function(e){return this[e]}},t(n.prototype,"item"),e.wrappers.NodeList=n,e.addWrapNodeListMethod=o,e.wrapNodeList=r}(window.ShadowDOMPolyfill),function(e){"use strict";e.wrapHTMLCollection=e.wrapNodeList,e.wrappers.HTMLCollection=e.wrappers.NodeList}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){L(e instanceof S)}function n(e){var t=new M;return t[0]=e,t.length=1,t}function r(e,t,n){C(t,"childList",{removedNodes:n,previousSibling:e.previousSibling,nextSibling:e.nextSibling})}function o(e,t){C(e,"childList",{removedNodes:t})}function i(e,t,r,o){if(e instanceof DocumentFragment){var i=s(e);B=!0;for(var a=i.length-1;a>=0;a--)e.removeChild(i[a]),i[a].parentNode_=t;B=!1;for(var a=0;a<i.length;a++)i[a].previousSibling_=i[a-1]||r,i[a].nextSibling_=i[a+1]||o;return r&&(r.nextSibling_=i[0]),o&&(o.previousSibling_=i[i.length-1]),i}var i=n(e),c=e.parentNode;return c&&c.removeChild(e),e.parentNode_=t,e.previousSibling_=r,e.nextSibling_=o,r&&(r.nextSibling_=e),o&&(o.previousSibling_=e),i}function a(e){if(e instanceof DocumentFragment)return s(e);var t=n(e),o=e.parentNode;return o&&r(e,o,t),t}function s(e){for(var t=new M,n=0,r=e.firstChild;r;r=r.nextSibling)t[n++]=r;return t.length=n,o(e,t),t}function c(e){return e}function l(e,t){R(e,t),e.nodeIsInserted_()}function u(e,t){for(var n=N(t),r=0;r<e.length;r++)l(e[r],n)}function d(e){R(e,new _(e,null))}function p(e){for(var t=0;t<e.length;t++)d(e[t])}function f(e,t){var n=e.nodeType===S.DOCUMENT_NODE?e:e.ownerDocument;n!==t.ownerDocument&&n.adoptNode(t)}function h(t,n){if(n.length){var r=t.ownerDocument;if(r!==n[0].ownerDocument)for(var o=0;o<n.length;o++)e.adoptNodeNoRemove(n[o],r)}}function m(e,t){h(e,t);var n=t.length;if(1===n)return I(t[0]);for(var r=I(e.ownerDocument.createDocumentFragment()),o=0;n>o;o++)r.appendChild(I(t[o]));return r}function w(e){if(void 0!==e.firstChild_)for(var t=e.firstChild_;t;){var n=t;t=t.nextSibling_,n.parentNode_=n.previousSibling_=n.nextSibling_=void 0}e.firstChild_=e.lastChild_=void 0}function v(e){if(e.invalidateShadowRenderer()){for(var t=e.firstChild;t;){L(t.parentNode===e);var n=t.nextSibling,r=I(t),o=r.parentNode;o&&Y.call(o,r),t.previousSibling_=t.nextSibling_=t.parentNode_=null,t=n}e.firstChild_=e.lastChild_=null}else for(var n,i=I(e),a=i.firstChild;a;)n=a.nextSibling,Y.call(i,a),a=n}function g(e){var t=e.parentNode;return t&&t.invalidateShadowRenderer()}function b(e){for(var t,n=0;n<e.length;n++)t=e[n],t.parentNode.removeChild(t)}function y(e,t,n){var r;if(r=k(n?U.call(n,P(e),!1):q.call(P(e),!1)),t){for(var o=e.firstChild;o;o=o.nextSibling)r.appendChild(y(o,!0,n));if(e instanceof F.HTMLTemplateElement)for(var i=r.content,o=e.content.firstChild;o;o=o.nextSibling)i.appendChild(y(o,!0,n))}return r}function E(e,t){if(!t||N(e)!==N(t))return!1;for(var n=t;n;n=n.parentNode)if(n===e)return!0;return!1}function S(e){L(e instanceof V),T.call(this,e),this.parentNode_=void 0,this.firstChild_=void 0,this.lastChild_=void 0,this.nextSibling_=void 0,this.previousSibling_=void 0,this.treeScope_=void 0}var T=e.wrappers.EventTarget,M=e.wrappers.NodeList,_=e.TreeScope,L=e.assert,O=e.defineWrapGetter,C=e.enqueueMutation,N=e.getTreeScope,D=e.isWrapper,j=e.mixin,H=e.registerTransientObservers,x=e.registerWrapper,R=e.setTreeScope,P=e.unsafeUnwrap,I=e.unwrap,A=e.unwrapIfNeeded,k=e.wrap,W=e.wrapIfNeeded,F=e.wrappers,B=!1,U=document.importNode,q=window.Node.prototype.cloneNode,V=window.Node,G=window.DocumentFragment,z=(V.prototype.appendChild,V.prototype.compareDocumentPosition),K=V.prototype.insertBefore,Y=V.prototype.removeChild,X=V.prototype.replaceChild,$=/Trident|Edge/.test(navigator.userAgent),J=$?function(e,t){try{Y.call(e,t)}catch(n){if(!(e instanceof G))throw n}}:function(e,t){Y.call(e,t)};S.prototype=Object.create(T.prototype),j(S.prototype,{appendChild:function(e){return this.insertBefore(e,null)},insertBefore:function(e,n){t(e);var r;n?D(n)?r=I(n):(r=n,n=k(r)):(n=null,r=null),n&&L(n.parentNode===this);var o,s=n?n.previousSibling:this.lastChild,c=!this.invalidateShadowRenderer()&&!g(e);if(o=c?a(e):i(e,this,s,n),c)f(this,e),w(this),K.call(P(this),I(e),r);else{s||(this.firstChild_=o[0]),n||(this.lastChild_=o[o.length-1],void 0===this.firstChild_&&(this.firstChild_=this.firstChild));var l=r?r.parentNode:P(this);l?K.call(l,m(this,o),r):h(this,o)}return C(this,"childList",{addedNodes:o,nextSibling:n,previousSibling:s}),u(o,this),e},removeChild:function(e){if(t(e),e.parentNode!==this){for(var r=!1,o=(this.childNodes,this.firstChild);o;o=o.nextSibling)if(o===e){r=!0;break}if(!r)throw new Error("NotFoundError")}var i=I(e),a=e.nextSibling,s=e.previousSibling;if(this.invalidateShadowRenderer()){var c=this.firstChild,l=this.lastChild,u=i.parentNode;u&&J(u,i),c===e&&(this.firstChild_=a),l===e&&(this.lastChild_=s),s&&(s.nextSibling_=a),a&&(a.previousSibling_=s),e.previousSibling_=e.nextSibling_=e.parentNode_=void 0}else w(this),J(P(this),i);return B||C(this,"childList",{removedNodes:n(e),nextSibling:a,previousSibling:s}),H(this,e),e},replaceChild:function(e,r){t(e);var o;if(D(r)?o=I(r):(o=r,r=k(o)),r.parentNode!==this)throw new Error("NotFoundError");var s,c=r.nextSibling,l=r.previousSibling,p=!this.invalidateShadowRenderer()&&!g(e);return p?s=a(e):(c===e&&(c=e.nextSibling),s=i(e,this,l,c)),p?(f(this,e),w(this),X.call(P(this),I(e),o)):(this.firstChild===r&&(this.firstChild_=s[0]),this.lastChild===r&&(this.lastChild_=s[s.length-1]),r.previousSibling_=r.nextSibling_=r.parentNode_=void 0,o.parentNode&&X.call(o.parentNode,m(this,s),o)),C(this,"childList",{addedNodes:s,removedNodes:n(r),nextSibling:c,previousSibling:l}),d(r),u(s,this),r},nodeIsInserted_:function(){for(var e=this.firstChild;e;e=e.nextSibling)e.nodeIsInserted_()},hasChildNodes:function(){return null!==this.firstChild},get parentNode(){return void 0!==this.parentNode_?this.parentNode_:k(P(this).parentNode)},get firstChild(){return void 0!==this.firstChild_?this.firstChild_:k(P(this).firstChild)},get lastChild(){return void 0!==this.lastChild_?this.lastChild_:k(P(this).lastChild)},get nextSibling(){return void 0!==this.nextSibling_?this.nextSibling_:k(P(this).nextSibling)},get previousSibling(){return void 0!==this.previousSibling_?this.previousSibling_:k(P(this).previousSibling)},get parentElement(){for(var e=this.parentNode;e&&e.nodeType!==S.ELEMENT_NODE;)e=e.parentNode;return e},get textContent(){for(var e="",t=this.firstChild;t;t=t.nextSibling)t.nodeType!=S.COMMENT_NODE&&(e+=t.textContent);return e},set textContent(e){null==e&&(e="");var t=c(this.childNodes);if(this.invalidateShadowRenderer()){if(v(this),""!==e){var n=P(this).ownerDocument.createTextNode(e);this.appendChild(n)}}else w(this),P(this).textContent=e;var r=c(this.childNodes);C(this,"childList",{addedNodes:r,removedNodes:t}),p(t),u(r,this)},get childNodes(){for(var e=new M,t=0,n=this.firstChild;n;n=n.nextSibling)e[t++]=n;return e.length=t,e},cloneNode:function(e){return y(this,e)},contains:function(e){return E(this,W(e))},compareDocumentPosition:function(e){return z.call(P(this),A(e))},normalize:function(){for(var e,t,n=c(this.childNodes),r=[],o="",i=0;i<n.length;i++)t=n[i],t.nodeType===S.TEXT_NODE?e||t.data.length?e?(o+=t.data,r.push(t)):e=t:this.removeChild(t):(e&&r.length&&(e.data+=o,b(r)),r=[],o="",e=null,t.childNodes.length&&t.normalize());e&&r.length&&(e.data+=o,b(r))}}),O(S,"ownerDocument"),x(V,S,document.createDocumentFragment()),delete S.prototype.querySelector,delete S.prototype.querySelectorAll,S.prototype=j(Object.create(T.prototype),S.prototype),e.cloneNode=y,e.nodeWasAdded=l,e.nodeWasRemoved=d,e.nodesWereAdded=u,e.nodesWereRemoved=p,e.originalInsertBefore=K,e.originalRemoveChild=Y,e.snapshotNodeList=c,e.wrappers.Node=S}(window.ShadowDOMPolyfill),function(e){"use strict";function t(t,n,r,o){for(var i=null,a=null,s=0,c=t.length;c>s;s++)i=b(t[s]),!o&&(a=v(i).root)&&a instanceof e.wrappers.ShadowRoot||(r[n++]=i);return n}function n(e){return String(e).replace(/\/deep\/|::shadow/g," ")}function r(e){return String(e).replace(/:host\(([^\s]+)\)/g,"$1").replace(/([^\s]):host/g,"$1").replace(":host","*").replace(/\^|\/shadow\/|\/shadow-deep\/|::shadow|\/deep\/|::content/g," ")}function o(e,t){for(var n,r=e.firstElementChild;r;){if(r.matches(t))return r;if(n=o(r,t))return n;r=r.nextElementSibling}return null}function i(e,t){return e.matches(t)}function a(e,t,n){var r=e.localName;return r===t||r===n&&e.namespaceURI===D}function s(){return!0}function c(e,t,n){return e.localName===n}function l(e,t){return e.namespaceURI===t}function u(e,t,n){return e.namespaceURI===t&&e.localName===n}function d(e,t,n,r,o,i){for(var a=e.firstElementChild;a;)r(a,o,i)&&(n[t++]=a),t=d(a,t,n,r,o,i),a=a.nextElementSibling;return t}function p(n,r,o,i,a){var s,c=g(this),l=v(this).root;if(l instanceof e.wrappers.ShadowRoot)return d(this,r,o,n,i,null);if(c instanceof C)s=T.call(c,i);else{if(!(c instanceof N))return d(this,r,o,n,i,null);s=S.call(c,i)}return t(s,r,o,a)}function f(n,r,o,i,a){var s,c=g(this),l=v(this).root;if(l instanceof e.wrappers.ShadowRoot)return d(this,r,o,n,i,a);if(c instanceof C)s=_.call(c,i,a);else{if(!(c instanceof N))return d(this,r,o,n,i,a);s=M.call(c,i,a)}return t(s,r,o,!1)}function h(n,r,o,i,a){var s,c=g(this),l=v(this).root;if(l instanceof e.wrappers.ShadowRoot)return d(this,r,o,n,i,a);if(c instanceof C)s=O.call(c,i,a);else{if(!(c instanceof N))return d(this,r,o,n,i,a);s=L.call(c,i,a)}return t(s,r,o,!1)}var m=e.wrappers.HTMLCollection,w=e.wrappers.NodeList,v=e.getTreeScope,g=e.unsafeUnwrap,b=e.wrap,y=document.querySelector,E=document.documentElement.querySelector,S=document.querySelectorAll,T=document.documentElement.querySelectorAll,M=document.getElementsByTagName,_=document.documentElement.getElementsByTagName,L=document.getElementsByTagNameNS,O=document.documentElement.getElementsByTagNameNS,C=window.Element,N=window.HTMLDocument||window.Document,D="http://www.w3.org/1999/xhtml",j={querySelector:function(t){var r=n(t),i=r!==t;t=r;var a,s=g(this),c=v(this).root;if(c instanceof e.wrappers.ShadowRoot)return o(this,t);if(s instanceof C)a=b(E.call(s,t));else{if(!(s instanceof N))return o(this,t);a=b(y.call(s,t))}return a&&!i&&(c=v(a).root)&&c instanceof e.wrappers.ShadowRoot?o(this,t):a},querySelectorAll:function(e){var t=n(e),r=t!==e;e=t;var o=new w;return o.length=p.call(this,i,0,o,e,r),o
-}},H={matches:function(t){return t=r(t),e.originalMatches.call(g(this),t)}},x={getElementsByTagName:function(e){var t=new m,n="*"===e?s:a;return t.length=f.call(this,n,0,t,e,e.toLowerCase()),t},getElementsByClassName:function(e){return this.querySelectorAll("."+e)},getElementsByTagNameNS:function(e,t){var n=new m,r=null;return r="*"===e?"*"===t?s:c:"*"===t?l:u,n.length=h.call(this,r,0,n,e||null,t),n}};e.GetElementsByInterface=x,e.SelectorsInterface=j,e.MatchesInterface=H}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){for(;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.nextSibling;return e}function n(e){for(;e&&e.nodeType!==Node.ELEMENT_NODE;)e=e.previousSibling;return e}var r=e.wrappers.NodeList,o={get firstElementChild(){return t(this.firstChild)},get lastElementChild(){return n(this.lastChild)},get childElementCount(){for(var e=0,t=this.firstElementChild;t;t=t.nextElementSibling)e++;return e},get children(){for(var e=new r,t=0,n=this.firstElementChild;n;n=n.nextElementSibling)e[t++]=n;return e.length=t,e},remove:function(){var e=this.parentNode;e&&e.removeChild(this)}},i={get nextElementSibling(){return t(this.nextSibling)},get previousElementSibling(){return n(this.previousSibling)}};e.ChildNodeInterface=i,e.ParentNodeInterface=o}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){r.call(this,e)}var n=e.ChildNodeInterface,r=e.wrappers.Node,o=e.enqueueMutation,i=e.mixin,a=e.registerWrapper,s=e.unsafeUnwrap,c=window.CharacterData;t.prototype=Object.create(r.prototype),i(t.prototype,{get textContent(){return this.data},set textContent(e){this.data=e},get data(){return s(this).data},set data(e){var t=s(this).data;o(this,"characterData",{oldValue:t}),s(this).data=e}}),i(t.prototype,n),a(c,t,document.createTextNode("")),e.wrappers.CharacterData=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){return e>>>0}function n(e){r.call(this,e)}var r=e.wrappers.CharacterData,o=(e.enqueueMutation,e.mixin),i=e.registerWrapper,a=window.Text;n.prototype=Object.create(r.prototype),o(n.prototype,{splitText:function(e){e=t(e);var n=this.data;if(e>n.length)throw new Error("IndexSizeError");var r=n.slice(0,e),o=n.slice(e);this.data=r;var i=this.ownerDocument.createTextNode(o);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}}),i(a,n,document.createTextNode("")),e.wrappers.Text=n}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){return i(e).getAttribute("class")}function n(e,t){a(e,"attributes",{name:"class",namespace:null,oldValue:t})}function r(t){e.invalidateRendererBasedOnAttribute(t,"class")}function o(e,o,i){var a=e.ownerElement_;if(null==a)return o.apply(e,i);var s=t(a),c=o.apply(e,i);return t(a)!==s&&(n(a,s),r(a)),c}if(!window.DOMTokenList)return void console.warn("Missing DOMTokenList prototype, please include a compatible classList polyfill such as http://goo.gl/uTcepH.");var i=e.unsafeUnwrap,a=e.enqueueMutation,s=DOMTokenList.prototype.add;DOMTokenList.prototype.add=function(){o(this,s,arguments)};var c=DOMTokenList.prototype.remove;DOMTokenList.prototype.remove=function(){o(this,c,arguments)};var l=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(){return o(this,l,arguments)}}(window.ShadowDOMPolyfill),function(e){"use strict";function t(t,n){var r=t.parentNode;if(r&&r.shadowRoot){var o=e.getRendererForHost(r);o.dependsOnAttribute(n)&&o.invalidate()}}function n(e,t,n){u(e,"attributes",{name:t,namespace:null,oldValue:n})}function r(e){a.call(this,e)}var o=e.ChildNodeInterface,i=e.GetElementsByInterface,a=e.wrappers.Node,s=e.ParentNodeInterface,c=e.SelectorsInterface,l=e.MatchesInterface,u=(e.addWrapNodeListMethod,e.enqueueMutation),d=e.mixin,p=(e.oneOf,e.registerWrapper),f=e.unsafeUnwrap,h=e.wrappers,m=window.Element,w=["matches","mozMatchesSelector","msMatchesSelector","webkitMatchesSelector"].filter(function(e){return m.prototype[e]}),v=w[0],g=m.prototype[v],b=new WeakMap;r.prototype=Object.create(a.prototype),d(r.prototype,{createShadowRoot:function(){var t=new h.ShadowRoot(this);f(this).polymerShadowRoot_=t;var n=e.getRendererForHost(this);return n.invalidate(),t},get shadowRoot(){return f(this).polymerShadowRoot_||null},setAttribute:function(e,r){var o=f(this).getAttribute(e);f(this).setAttribute(e,r),n(this,e,o),t(this,e)},removeAttribute:function(e){var r=f(this).getAttribute(e);f(this).removeAttribute(e),n(this,e,r),t(this,e)},get classList(){var e=b.get(this);if(!e){if(e=f(this).classList,!e)return;e.ownerElement_=this,b.set(this,e)}return e},get className(){return f(this).className},set className(e){this.setAttribute("class",e)},get id(){return f(this).id},set id(e){this.setAttribute("id",e)}}),w.forEach(function(e){"matches"!==e&&(r.prototype[e]=function(e){return this.matches(e)})}),m.prototype.webkitCreateShadowRoot&&(r.prototype.webkitCreateShadowRoot=r.prototype.createShadowRoot),d(r.prototype,o),d(r.prototype,i),d(r.prototype,s),d(r.prototype,c),d(r.prototype,l),p(m,r,document.createElementNS(null,"x")),e.invalidateRendererBasedOnAttribute=t,e.matchesNames=w,e.originalMatches=g,e.wrappers.Element=r}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){switch(e){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;";case'"':return"&quot;";case" ":return"&nbsp;"}}function n(e){return e.replace(L,t)}function r(e){return e.replace(O,t)}function o(e){for(var t={},n=0;n<e.length;n++)t[e[n]]=!0;return t}function i(e,t){switch(e.nodeType){case Node.ELEMENT_NODE:for(var o,i=e.tagName.toLowerCase(),s="<"+i,c=e.attributes,l=0;o=c[l];l++)s+=" "+o.name+'="'+n(o.value)+'"';return s+=">",C[i]?s:s+a(e)+"</"+i+">";case Node.TEXT_NODE:var u=e.data;return t&&N[t.localName]?u:r(u);case Node.COMMENT_NODE:return"<!--"+e.data+"-->";default:throw console.error(e),new Error("not implemented")}}function a(e){e instanceof _.HTMLTemplateElement&&(e=e.content);for(var t="",n=e.firstChild;n;n=n.nextSibling)t+=i(n,e);return t}function s(e,t,n){var r=n||"div";e.textContent="";var o=T(e.ownerDocument.createElement(r));o.innerHTML=t;for(var i;i=o.firstChild;)e.appendChild(M(i))}function c(e){h.call(this,e)}function l(e,t){var n=T(e.cloneNode(!1));n.innerHTML=t;for(var r,o=T(document.createDocumentFragment());r=n.firstChild;)o.appendChild(r);return M(o)}function u(t){return function(){return e.renderAllPending(),S(this)[t]}}function d(e){m(c,e,u(e))}function p(t){Object.defineProperty(c.prototype,t,{get:u(t),set:function(n){e.renderAllPending(),S(this)[t]=n},configurable:!0,enumerable:!0})}function f(t){Object.defineProperty(c.prototype,t,{value:function(){return e.renderAllPending(),S(this)[t].apply(S(this),arguments)},configurable:!0,enumerable:!0})}var h=e.wrappers.Element,m=e.defineGetter,w=e.enqueueMutation,v=e.mixin,g=e.nodesWereAdded,b=e.nodesWereRemoved,y=e.registerWrapper,E=e.snapshotNodeList,S=e.unsafeUnwrap,T=e.unwrap,M=e.wrap,_=e.wrappers,L=/[&\u00A0"]/g,O=/[&\u00A0<>]/g,C=o(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]),N=o(["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"]),D=/MSIE/.test(navigator.userAgent),j=window.HTMLElement,H=window.HTMLTemplateElement;c.prototype=Object.create(h.prototype),v(c.prototype,{get innerHTML(){return a(this)},set innerHTML(e){if(D&&N[this.localName])return void(this.textContent=e);var t=E(this.childNodes);this.invalidateShadowRenderer()?this instanceof _.HTMLTemplateElement?s(this.content,e):s(this,e,this.tagName):!H&&this instanceof _.HTMLTemplateElement?s(this.content,e):S(this).innerHTML=e;var n=E(this.childNodes);w(this,"childList",{addedNodes:n,removedNodes:t}),b(t),g(n,this)},get outerHTML(){return i(this,this.parentNode)},set outerHTML(e){var t=this.parentNode;if(t){t.invalidateShadowRenderer();var n=l(t,e);t.replaceChild(n,this)}},insertAdjacentHTML:function(e,t){var n,r;switch(String(e).toLowerCase()){case"beforebegin":n=this.parentNode,r=this;break;case"afterend":n=this.parentNode,r=this.nextSibling;break;case"afterbegin":n=this,r=this.firstChild;break;case"beforeend":n=this,r=null;break;default:return}var o=l(n,t);n.insertBefore(o,r)},get hidden(){return this.hasAttribute("hidden")},set hidden(e){e?this.setAttribute("hidden",""):this.removeAttribute("hidden")}}),["clientHeight","clientLeft","clientTop","clientWidth","offsetHeight","offsetLeft","offsetTop","offsetWidth","scrollHeight","scrollWidth"].forEach(d),["scrollLeft","scrollTop"].forEach(p),["getBoundingClientRect","getClientRects","scrollIntoView"].forEach(f),y(j,c,document.createElement("b")),e.wrappers.HTMLElement=c,e.getInnerHTML=a,e.setInnerHTML=s}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.unsafeUnwrap,a=e.wrap,s=window.HTMLCanvasElement;t.prototype=Object.create(n.prototype),r(t.prototype,{getContext:function(){var e=i(this).getContext.apply(i(this),arguments);return e&&a(e)}}),o(s,t,document.createElement("canvas")),e.wrappers.HTMLCanvasElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=window.HTMLContentElement;t.prototype=Object.create(n.prototype),r(t.prototype,{constructor:t,get select(){return this.getAttribute("select")},set select(e){this.setAttribute("select",e)},setAttribute:function(e,t){n.prototype.setAttribute.call(this,e,t),"select"===String(e).toLowerCase()&&this.invalidateShadowRenderer(!0)}}),i&&o(i,t),e.wrappers.HTMLContentElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.wrapHTMLCollection,a=e.unwrap,s=window.HTMLFormElement;t.prototype=Object.create(n.prototype),r(t.prototype,{get elements(){return i(a(this).elements)}}),o(s,t,document.createElement("form")),e.wrappers.HTMLFormElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){r.call(this,e)}function n(e,t){if(!(this instanceof n))throw new TypeError("DOM object constructor cannot be called as a function.");var o=i(document.createElement("img"));r.call(this,o),a(o,this),void 0!==e&&(o.width=e),void 0!==t&&(o.height=t)}var r=e.wrappers.HTMLElement,o=e.registerWrapper,i=e.unwrap,a=e.rewrap,s=window.HTMLImageElement;t.prototype=Object.create(r.prototype),o(s,t,document.createElement("img")),n.prototype=t.prototype,e.wrappers.HTMLImageElement=t,e.wrappers.Image=n}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=(e.mixin,e.wrappers.NodeList,e.registerWrapper),o=window.HTMLShadowElement;t.prototype=Object.create(n.prototype),t.prototype.constructor=t,o&&r(o,t),e.wrappers.HTMLShadowElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){if(!e.defaultView)return e;var t=d.get(e);if(!t){for(t=e.implementation.createHTMLDocument("");t.lastChild;)t.removeChild(t.lastChild);d.set(e,t)}return t}function n(e){for(var n,r=t(e.ownerDocument),o=c(r.createDocumentFragment());n=e.firstChild;)o.appendChild(n);return o}function r(e){if(o.call(this,e),!p){var t=n(e);u.set(this,l(t))}}var o=e.wrappers.HTMLElement,i=e.mixin,a=e.registerWrapper,s=e.unsafeUnwrap,c=e.unwrap,l=e.wrap,u=new WeakMap,d=new WeakMap,p=window.HTMLTemplateElement;r.prototype=Object.create(o.prototype),i(r.prototype,{constructor:r,get content(){return p?l(s(this).content):u.get(this)}}),p&&a(p,r),e.wrappers.HTMLTemplateElement=r}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.registerWrapper,o=window.HTMLMediaElement;o&&(t.prototype=Object.create(n.prototype),r(o,t,document.createElement("audio")),e.wrappers.HTMLMediaElement=t)}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){r.call(this,e)}function n(e){if(!(this instanceof n))throw new TypeError("DOM object constructor cannot be called as a function.");var t=i(document.createElement("audio"));r.call(this,t),a(t,this),t.setAttribute("preload","auto"),void 0!==e&&t.setAttribute("src",e)}var r=e.wrappers.HTMLMediaElement,o=e.registerWrapper,i=e.unwrap,a=e.rewrap,s=window.HTMLAudioElement;s&&(t.prototype=Object.create(r.prototype),o(s,t,document.createElement("audio")),n.prototype=t.prototype,e.wrappers.HTMLAudioElement=t,e.wrappers.Audio=n)}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){return e.replace(/\s+/g," ").trim()}function n(e){o.call(this,e)}function r(e,t,n,i){if(!(this instanceof r))throw new TypeError("DOM object constructor cannot be called as a function.");var a=c(document.createElement("option"));o.call(this,a),s(a,this),void 0!==e&&(a.text=e),void 0!==t&&a.setAttribute("value",t),n===!0&&a.setAttribute("selected",""),a.selected=i===!0}var o=e.wrappers.HTMLElement,i=e.mixin,a=e.registerWrapper,s=e.rewrap,c=e.unwrap,l=e.wrap,u=window.HTMLOptionElement;n.prototype=Object.create(o.prototype),i(n.prototype,{get text(){return t(this.textContent)},set text(e){this.textContent=t(String(e))},get form(){return l(c(this).form)}}),a(u,n,document.createElement("option")),r.prototype=n.prototype,e.wrappers.HTMLOptionElement=n,e.wrappers.Option=r}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.unwrap,a=e.wrap,s=window.HTMLSelectElement;t.prototype=Object.create(n.prototype),r(t.prototype,{add:function(e,t){"object"==typeof t&&(t=i(t)),i(this).add(i(e),t)},remove:function(e){return void 0===e?void n.prototype.remove.call(this):("object"==typeof e&&(e=i(e)),void i(this).remove(e))},get form(){return a(i(this).form)}}),o(s,t,document.createElement("select")),e.wrappers.HTMLSelectElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.unwrap,a=e.wrap,s=e.wrapHTMLCollection,c=window.HTMLTableElement;t.prototype=Object.create(n.prototype),r(t.prototype,{get caption(){return a(i(this).caption)},createCaption:function(){return a(i(this).createCaption())},get tHead(){return a(i(this).tHead)},createTHead:function(){return a(i(this).createTHead())},createTFoot:function(){return a(i(this).createTFoot())},get tFoot(){return a(i(this).tFoot)},get tBodies(){return s(i(this).tBodies)},createTBody:function(){return a(i(this).createTBody())},get rows(){return s(i(this).rows)},insertRow:function(e){return a(i(this).insertRow(e))}}),o(c,t,document.createElement("table")),e.wrappers.HTMLTableElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.wrapHTMLCollection,a=e.unwrap,s=e.wrap,c=window.HTMLTableSectionElement;t.prototype=Object.create(n.prototype),r(t.prototype,{constructor:t,get rows(){return i(a(this).rows)},insertRow:function(e){return s(a(this).insertRow(e))}}),o(c,t,document.createElement("thead")),e.wrappers.HTMLTableSectionElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.HTMLElement,r=e.mixin,o=e.registerWrapper,i=e.wrapHTMLCollection,a=e.unwrap,s=e.wrap,c=window.HTMLTableRowElement;t.prototype=Object.create(n.prototype),r(t.prototype,{get cells(){return i(a(this).cells)},insertCell:function(e){return s(a(this).insertCell(e))}}),o(c,t,document.createElement("tr")),e.wrappers.HTMLTableRowElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){switch(e.localName){case"content":return new n(e);case"shadow":return new o(e);case"template":return new i(e)}r.call(this,e)}var n=e.wrappers.HTMLContentElement,r=e.wrappers.HTMLElement,o=e.wrappers.HTMLShadowElement,i=e.wrappers.HTMLTemplateElement,a=(e.mixin,e.registerWrapper),s=window.HTMLUnknownElement;t.prototype=Object.create(r.prototype),a(s,t),e.wrappers.HTMLUnknownElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";var t=e.wrappers.Element,n=e.wrappers.HTMLElement,r=e.registerObject,o=e.defineWrapGetter,i="http://www.w3.org/2000/svg",a=document.createElementNS(i,"title"),s=r(a),c=Object.getPrototypeOf(s.prototype).constructor;if(!("classList"in a)){var l=Object.getOwnPropertyDescriptor(t.prototype,"classList");Object.defineProperty(n.prototype,"classList",l),delete t.prototype.classList}o(c,"ownerSVGElement"),e.wrappers.SVGElement=c}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){p.call(this,e)}var n=e.mixin,r=e.registerWrapper,o=e.unwrap,i=e.wrap,a=window.SVGUseElement,s="http://www.w3.org/2000/svg",c=i(document.createElementNS(s,"g")),l=document.createElementNS(s,"use"),u=c.constructor,d=Object.getPrototypeOf(u.prototype),p=d.constructor;t.prototype=Object.create(d),"instanceRoot"in l&&n(t.prototype,{get instanceRoot(){return i(o(this).instanceRoot)},get animatedInstanceRoot(){return i(o(this).animatedInstanceRoot)}}),r(a,t,l),e.wrappers.SVGUseElement=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.EventTarget,r=e.mixin,o=e.registerWrapper,i=e.unsafeUnwrap,a=e.wrap,s=window.SVGElementInstance;s&&(t.prototype=Object.create(n.prototype),r(t.prototype,{get correspondingElement(){return a(i(this).correspondingElement)},get correspondingUseElement(){return a(i(this).correspondingUseElement)},get parentNode(){return a(i(this).parentNode)},get childNodes(){throw new Error("Not implemented")},get firstChild(){return a(i(this).firstChild)},get lastChild(){return a(i(this).lastChild)},get previousSibling(){return a(i(this).previousSibling)},get nextSibling(){return a(i(this).nextSibling)}}),o(s,t),e.wrappers.SVGElementInstance=t)}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){o(e,this)}var n=e.mixin,r=e.registerWrapper,o=e.setWrapper,i=e.unsafeUnwrap,a=e.unwrap,s=e.unwrapIfNeeded,c=e.wrap,l=window.CanvasRenderingContext2D;n(t.prototype,{get canvas(){return c(i(this).canvas)},drawImage:function(){arguments[0]=s(arguments[0]),i(this).drawImage.apply(i(this),arguments)},createPattern:function(){return arguments[0]=a(arguments[0]),i(this).createPattern.apply(i(this),arguments)}}),r(l,t,document.createElement("canvas").getContext("2d")),e.wrappers.CanvasRenderingContext2D=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){o(e,this)}var n=e.mixin,r=e.registerWrapper,o=e.setWrapper,i=e.unsafeUnwrap,a=e.unwrapIfNeeded,s=e.wrap,c=window.WebGLRenderingContext;if(c){n(t.prototype,{get canvas(){return s(i(this).canvas)},texImage2D:function(){arguments[5]=a(arguments[5]),i(this).texImage2D.apply(i(this),arguments)},texSubImage2D:function(){arguments[6]=a(arguments[6]),i(this).texSubImage2D.apply(i(this),arguments)}});var l=/WebKit/.test(navigator.userAgent)?{drawingBufferHeight:null,drawingBufferWidth:null}:{};r(c,t,l),e.wrappers.WebGLRenderingContext=t}}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){r(e,this)}var n=e.registerWrapper,r=e.setWrapper,o=e.unsafeUnwrap,i=e.unwrap,a=e.unwrapIfNeeded,s=e.wrap,c=window.Range;t.prototype={get startContainer(){return s(o(this).startContainer)},get endContainer(){return s(o(this).endContainer)},get commonAncestorContainer(){return s(o(this).commonAncestorContainer)},setStart:function(e,t){o(this).setStart(a(e),t)},setEnd:function(e,t){o(this).setEnd(a(e),t)},setStartBefore:function(e){o(this).setStartBefore(a(e))},setStartAfter:function(e){o(this).setStartAfter(a(e))},setEndBefore:function(e){o(this).setEndBefore(a(e))},setEndAfter:function(e){o(this).setEndAfter(a(e))},selectNode:function(e){o(this).selectNode(a(e))},selectNodeContents:function(e){o(this).selectNodeContents(a(e))},compareBoundaryPoints:function(e,t){return o(this).compareBoundaryPoints(e,i(t))},extractContents:function(){return s(o(this).extractContents())},cloneContents:function(){return s(o(this).cloneContents())},insertNode:function(e){o(this).insertNode(a(e))},surroundContents:function(e){o(this).surroundContents(a(e))},cloneRange:function(){return s(o(this).cloneRange())},isPointInRange:function(e,t){return o(this).isPointInRange(a(e),t)},comparePoint:function(e,t){return o(this).comparePoint(a(e),t)},intersectsNode:function(e){return o(this).intersectsNode(a(e))},toString:function(){return o(this).toString()}},c.prototype.createContextualFragment&&(t.prototype.createContextualFragment=function(e){return s(o(this).createContextualFragment(e))}),n(window.Range,t,document.createRange()),e.wrappers.Range=t}(window.ShadowDOMPolyfill),function(e){"use strict";var t=e.GetElementsByInterface,n=e.ParentNodeInterface,r=e.SelectorsInterface,o=e.mixin,i=e.registerObject,a=i(document.createDocumentFragment());o(a.prototype,n),o(a.prototype,r),o(a.prototype,t);var s=i(document.createComment(""));e.wrappers.Comment=s,e.wrappers.DocumentFragment=a}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){var t=d(u(e).ownerDocument.createDocumentFragment());n.call(this,t),c(t,this);var o=e.shadowRoot;f.set(this,o),this.treeScope_=new r(this,a(o||e)),p.set(this,e)}var n=e.wrappers.DocumentFragment,r=e.TreeScope,o=e.elementFromPoint,i=e.getInnerHTML,a=e.getTreeScope,s=e.mixin,c=e.rewrap,l=e.setInnerHTML,u=e.unsafeUnwrap,d=e.unwrap,p=new WeakMap,f=new WeakMap,h=/[ \t\n\r\f]/;t.prototype=Object.create(n.prototype),s(t.prototype,{constructor:t,get innerHTML(){return i(this)},set innerHTML(e){l(this,e),this.invalidateShadowRenderer()},get olderShadowRoot(){return f.get(this)||null},get host(){return p.get(this)||null},invalidateShadowRenderer:function(){return p.get(this).invalidateShadowRenderer()},elementFromPoint:function(e,t){return o(this,this.ownerDocument,e,t)},getElementById:function(e){return h.test(e)?null:this.querySelector('[id="'+e+'"]')}}),e.wrappers.ShadowRoot=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){e.previousSibling_=e.previousSibling,e.nextSibling_=e.nextSibling,e.parentNode_=e.parentNode}function n(n,o,i){var a=x(n),s=x(o),c=i?x(i):null;if(r(o),t(o),i)n.firstChild===i&&(n.firstChild_=i),i.previousSibling_=i.previousSibling;else{n.lastChild_=n.lastChild,n.lastChild===n.firstChild&&(n.firstChild_=n.firstChild);var l=R(a.lastChild);l&&(l.nextSibling_=l.nextSibling)}e.originalInsertBefore.call(a,s,c)}function r(n){var r=x(n),o=r.parentNode;if(o){var i=R(o);t(n),n.previousSibling&&(n.previousSibling.nextSibling_=n),n.nextSibling&&(n.nextSibling.previousSibling_=n),i.lastChild===n&&(i.lastChild_=n),i.firstChild===n&&(i.firstChild_=n),e.originalRemoveChild.call(o,r)}}function o(e){I.set(e,[])}function i(e){var t=I.get(e);return t||I.set(e,t=[]),t}function a(e){for(var t=[],n=0,r=e.firstChild;r;r=r.nextSibling)t[n++]=r;return t}function s(){for(var e=0;e<F.length;e++){var t=F[e],n=t.parentRenderer;n&&n.dirty||t.render()}F=[]}function c(){M=null,s()}function l(e){var t=k.get(e);return t||(t=new f(e),k.set(e,t)),t}function u(e){var t=D(e).root;return t instanceof N?t:null}function d(e){return l(e.host)}function p(e){this.skip=!1,this.node=e,this.childNodes=[]}function f(e){this.host=e,this.dirty=!1,this.invalidateAttributes(),this.associateNode(e)}function h(e){for(var t=[],n=e.firstChild;n;n=n.nextSibling)E(n)?t.push.apply(t,i(n)):t.push(n);return t}function m(e){if(e instanceof O)return e;if(e instanceof L)return null;for(var t=e.firstChild;t;t=t.nextSibling){var n=m(t);if(n)return n}return null}function w(e,t){i(t).push(e);var n=A.get(e);n?n.push(t):A.set(e,[t])}function v(e){return A.get(e)}function g(e){A.set(e,void 0)}function b(e,t){var n=t.getAttribute("select");if(!n)return!0;if(n=n.trim(),!n)return!0;if(!(e instanceof _))return!1;if(!U.test(n))return!1;try{return e.matches(n)}catch(r){return!1}}function y(e,t){var n=v(t);return n&&n[n.length-1]===e}function E(e){return e instanceof L||e instanceof O}function S(e){return e.shadowRoot}function T(e){for(var t=[],n=e.shadowRoot;n;n=n.olderShadowRoot)t.push(n);return t}var M,_=e.wrappers.Element,L=e.wrappers.HTMLContentElement,O=e.wrappers.HTMLShadowElement,C=e.wrappers.Node,N=e.wrappers.ShadowRoot,D=(e.assert,e.getTreeScope),j=(e.mixin,e.oneOf),H=e.unsafeUnwrap,x=e.unwrap,R=e.wrap,P=e.ArraySplice,I=new WeakMap,A=new WeakMap,k=new WeakMap,W=j(window,["requestAnimationFrame","mozRequestAnimationFrame","webkitRequestAnimationFrame","setTimeout"]),F=[],B=new P;B.equals=function(e,t){return x(e.node)===t},p.prototype={append:function(e){var t=new p(e);return this.childNodes.push(t),t},sync:function(e){if(!this.skip){for(var t=this.node,o=this.childNodes,i=a(x(t)),s=e||new WeakMap,c=B.calculateSplices(o,i),l=0,u=0,d=0,p=0;p<c.length;p++){for(var f=c[p];d<f.index;d++)u++,o[l++].sync(s);for(var h=f.removed.length,m=0;h>m;m++){var w=R(i[u++]);s.get(w)||r(w)}for(var v=f.addedCount,g=i[u]&&R(i[u]),m=0;v>m;m++){var b=o[l++],y=b.node;n(t,y,g),s.set(y,!0),b.sync(s)}d+=v}for(var p=d;p<o.length;p++)o[p].sync(s)}}},f.prototype={render:function(e){if(this.dirty){this.invalidateAttributes();var t=this.host;this.distribution(t);var n=e||new p(t);this.buildRenderTree(n,t);var r=!e;r&&n.sync(),this.dirty=!1}},get parentRenderer(){return D(this.host).renderer},invalidate:function(){if(!this.dirty){this.dirty=!0;var e=this.parentRenderer;if(e&&e.invalidate(),F.push(this),M)return;M=window[W](c,0)}},distribution:function(e){this.resetAllSubtrees(e),this.distributionResolution(e)},resetAll:function(e){E(e)?o(e):g(e),this.resetAllSubtrees(e)},resetAllSubtrees:function(e){for(var t=e.firstChild;t;t=t.nextSibling)this.resetAll(t);e.shadowRoot&&this.resetAll(e.shadowRoot),e.olderShadowRoot&&this.resetAll(e.olderShadowRoot)},distributionResolution:function(e){if(S(e)){for(var t=e,n=h(t),r=T(t),o=0;o<r.length;o++)this.poolDistribution(r[o],n);for(var o=r.length-1;o>=0;o--){var i=r[o],a=m(i);if(a){var s=i.olderShadowRoot;s&&(n=h(s));for(var c=0;c<n.length;c++)w(n[c],a)}this.distributionResolution(i)}}for(var l=e.firstChild;l;l=l.nextSibling)this.distributionResolution(l)},poolDistribution:function(e,t){if(!(e instanceof O))if(e instanceof L){var n=e;this.updateDependentAttributes(n.getAttribute("select"));for(var r=!1,o=0;o<t.length;o++){var e=t[o];e&&b(e,n)&&(w(e,n),t[o]=void 0,r=!0)}if(!r)for(var i=n.firstChild;i;i=i.nextSibling)w(i,n)}else for(var i=e.firstChild;i;i=i.nextSibling)this.poolDistribution(i,t)},buildRenderTree:function(e,t){for(var n=this.compose(t),r=0;r<n.length;r++){var o=n[r],i=e.append(o);this.buildRenderTree(i,o)}if(S(t)){var a=l(t);a.dirty=!1}},compose:function(e){for(var t=[],n=e.shadowRoot||e,r=n.firstChild;r;r=r.nextSibling)if(E(r)){this.associateNode(n);for(var o=i(r),a=0;a<o.length;a++){var s=o[a];y(r,s)&&t.push(s)}}else t.push(r);return t},invalidateAttributes:function(){this.attributes=Object.create(null)},updateDependentAttributes:function(e){if(e){var t=this.attributes;/\.\w+/.test(e)&&(t["class"]=!0),/#\w+/.test(e)&&(t.id=!0),e.replace(/\[\s*([^\s=\|~\]]+)/g,function(e,n){t[n]=!0})}},dependsOnAttribute:function(e){return this.attributes[e]},associateNode:function(e){H(e).polymerShadowRenderer_=this}};var U=/^(:not\()?[*.#[a-zA-Z_|]/;C.prototype.invalidateShadowRenderer=function(){var e=H(this).polymerShadowRenderer_;return e?(e.invalidate(),!0):!1},L.prototype.getDistributedNodes=O.prototype.getDistributedNodes=function(){return s(),i(this)},_.prototype.getDestinationInsertionPoints=function(){return s(),v(this)||[]},L.prototype.nodeIsInserted_=O.prototype.nodeIsInserted_=function(){this.invalidateShadowRenderer();var e,t=u(this);t&&(e=d(t)),H(this).polymerShadowRenderer_=e,e&&e.invalidate()},e.getRendererForHost=l,e.getShadowTrees=T,e.renderAllPending=s,e.getDestinationInsertionPoints=v,e.visual={insertBefore:n,remove:r}}(window.ShadowDOMPolyfill),function(e){"use strict";function t(t){if(window[t]){r(!e.wrappers[t]);var c=function(e){n.call(this,e)};c.prototype=Object.create(n.prototype),o(c.prototype,{get form(){return s(a(this).form)}}),i(window[t],c,document.createElement(t.slice(4,-7))),e.wrappers[t]=c}}var n=e.wrappers.HTMLElement,r=e.assert,o=e.mixin,i=e.registerWrapper,a=e.unwrap,s=e.wrap,c=["HTMLButtonElement","HTMLFieldSetElement","HTMLInputElement","HTMLKeygenElement","HTMLLabelElement","HTMLLegendElement","HTMLObjectElement","HTMLOutputElement","HTMLTextAreaElement"];c.forEach(t)}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){r(e,this)}{var n=e.registerWrapper,r=e.setWrapper,o=e.unsafeUnwrap,i=e.unwrap,a=e.unwrapIfNeeded,s=e.wrap;window.Selection}t.prototype={get anchorNode(){return s(o(this).anchorNode)},get focusNode(){return s(o(this).focusNode)},addRange:function(e){o(this).addRange(i(e))},collapse:function(e,t){o(this).collapse(a(e),t)},containsNode:function(e,t){return o(this).containsNode(a(e),t)},extend:function(e,t){o(this).extend(a(e),t)},getRangeAt:function(e){return s(o(this).getRangeAt(e))},removeRange:function(e){o(this).removeRange(i(e))},selectAllChildren:function(e){o(this).selectAllChildren(a(e))},toString:function(){return o(this).toString()}},n(window.Selection,t,window.getSelection()),e.wrappers.Selection=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){u.call(this,e),this.treeScope_=new m(this,null)}function n(e){var n=document[e];t.prototype[e]=function(){return C(n.apply(L(this),arguments))}}function r(e,t){j.call(L(t),O(e)),o(e,t)}function o(e,t){e.shadowRoot&&t.adoptNode(e.shadowRoot),e instanceof h&&i(e,t);for(var n=e.firstChild;n;n=n.nextSibling)o(n,t)}function i(e,t){var n=e.olderShadowRoot;n&&t.adoptNode(n)}function a(e){_(e,this)}function s(e,t){var n=document.implementation[t];e.prototype[t]=function(){return C(n.apply(L(this),arguments))}}function c(e,t){var n=document.implementation[t];e.prototype[t]=function(){return n.apply(L(this),arguments)}}var l=e.GetElementsByInterface,u=e.wrappers.Node,d=e.ParentNodeInterface,p=e.wrappers.Selection,f=e.SelectorsInterface,h=e.wrappers.ShadowRoot,m=e.TreeScope,w=e.cloneNode,v=e.defineWrapGetter,g=e.elementFromPoint,b=e.forwardMethodsToWrapper,y=e.matchesNames,E=e.mixin,S=e.registerWrapper,T=e.renderAllPending,M=e.rewrap,_=e.setWrapper,L=e.unsafeUnwrap,O=e.unwrap,C=e.wrap,N=e.wrapEventTargetMethods,D=(e.wrapNodeList,new WeakMap);t.prototype=Object.create(u.prototype),v(t,"documentElement"),v(t,"body"),v(t,"head"),["createComment","createDocumentFragment","createElement","createElementNS","createEvent","createEventNS","createRange","createTextNode","getElementById"].forEach(n);var j=document.adoptNode,H=document.getSelection;if(E(t.prototype,{adoptNode:function(e){return e.parentNode&&e.parentNode.removeChild(e),r(e,this),e},elementFromPoint:function(e,t){return g(this,this,e,t)},importNode:function(e,t){return w(e,t,L(this))},getSelection:function(){return T(),new p(H.call(O(this)))},getElementsByName:function(e){return f.querySelectorAll.call(this,"[name="+JSON.stringify(String(e))+"]")}}),document.registerElement){var x=document.registerElement;t.prototype.registerElement=function(t,n){function r(e){return e?void _(e,this):i?document.createElement(i,t):document.createElement(t)}var o,i;if(void 0!==n&&(o=n.prototype,i=n["extends"]),o||(o=Object.create(HTMLElement.prototype)),e.nativePrototypeTable.get(o))throw new Error("NotSupportedError");for(var a,s=Object.getPrototypeOf(o),c=[];s&&!(a=e.nativePrototypeTable.get(s));)c.push(s),s=Object.getPrototypeOf(s);if(!a)throw new Error("NotSupportedError");for(var l=Object.create(a),u=c.length-1;u>=0;u--)l=Object.create(l);["createdCallback","attachedCallback","detachedCallback","attributeChangedCallback"].forEach(function(e){var t=o[e];t&&(l[e]=function(){C(this)instanceof r||M(this),t.apply(C(this),arguments)})});var d={prototype:l};i&&(d["extends"]=i),r.prototype=o,r.prototype.constructor=r,e.constructorTable.set(l,r),e.nativePrototypeTable.set(o,l);x.call(O(this),t,d);return r},b([window.HTMLDocument||window.Document],["registerElement"])}b([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement,window.HTMLHtmlElement],["appendChild","compareDocumentPosition","contains","getElementsByClassName","getElementsByTagName","getElementsByTagNameNS","insertBefore","querySelector","querySelectorAll","removeChild","replaceChild"]),b([window.HTMLBodyElement,window.HTMLHeadElement,window.HTMLHtmlElement],y),b([window.HTMLDocument||window.Document],["adoptNode","importNode","contains","createComment","createDocumentFragment","createElement","createElementNS","createEvent","createEventNS","createRange","createTextNode","elementFromPoint","getElementById","getElementsByName","getSelection"]),E(t.prototype,l),E(t.prototype,d),E(t.prototype,f),E(t.prototype,{get implementation(){var e=D.get(this);
-return e?e:(e=new a(O(this).implementation),D.set(this,e),e)},get defaultView(){return C(O(this).defaultView)}}),S(window.Document,t,document.implementation.createHTMLDocument("")),window.HTMLDocument&&S(window.HTMLDocument,t),N([window.HTMLBodyElement,window.HTMLDocument||window.Document,window.HTMLHeadElement]),s(a,"createDocumentType"),s(a,"createDocument"),s(a,"createHTMLDocument"),c(a,"hasFeature"),S(window.DOMImplementation,a),b([window.DOMImplementation],["createDocumentType","createDocument","createHTMLDocument","hasFeature"]),e.adoptNodeNoRemove=r,e.wrappers.DOMImplementation=a,e.wrappers.Document=t}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){n.call(this,e)}var n=e.wrappers.EventTarget,r=e.wrappers.Selection,o=e.mixin,i=e.registerWrapper,a=e.renderAllPending,s=e.unwrap,c=e.unwrapIfNeeded,l=e.wrap,u=window.Window,d=window.getComputedStyle,p=window.getDefaultComputedStyle,f=window.getSelection;t.prototype=Object.create(n.prototype),u.prototype.getComputedStyle=function(e,t){return l(this||window).getComputedStyle(c(e),t)},p&&(u.prototype.getDefaultComputedStyle=function(e,t){return l(this||window).getDefaultComputedStyle(c(e),t)}),u.prototype.getSelection=function(){return l(this||window).getSelection()},delete window.getComputedStyle,delete window.getDefaultComputedStyle,delete window.getSelection,["addEventListener","removeEventListener","dispatchEvent"].forEach(function(e){u.prototype[e]=function(){var t=l(this||window);return t[e].apply(t,arguments)},delete window[e]}),o(t.prototype,{getComputedStyle:function(e,t){return a(),d.call(s(this),c(e),t)},getSelection:function(){return a(),new r(f.call(s(this)))},get document(){return l(s(this).document)}}),p&&(t.prototype.getDefaultComputedStyle=function(e,t){return a(),p.call(s(this),c(e),t)}),i(u,t,window),e.wrappers.Window=t}(window.ShadowDOMPolyfill),function(e){"use strict";var t=e.unwrap,n=window.DataTransfer||window.Clipboard,r=n.prototype.setDragImage;r&&(n.prototype.setDragImage=function(e,n,o){r.call(this,t(e),n,o)})}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){var t;t=e instanceof i?e:new i(e&&o(e)),r(t,this)}var n=e.registerWrapper,r=e.setWrapper,o=e.unwrap,i=window.FormData;i&&(n(i,t,new i),e.wrappers.FormData=t)}(window.ShadowDOMPolyfill),function(e){"use strict";var t=e.unwrapIfNeeded,n=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(e){return n.call(this,t(e))}}(window.ShadowDOMPolyfill),function(e){"use strict";function t(e){var t=n[e],r=window[t];if(r){var o=document.createElement(e),i=o.constructor;window[t]=i}}var n=(e.isWrapperFor,{a:"HTMLAnchorElement",area:"HTMLAreaElement",audio:"HTMLAudioElement",base:"HTMLBaseElement",body:"HTMLBodyElement",br:"HTMLBRElement",button:"HTMLButtonElement",canvas:"HTMLCanvasElement",caption:"HTMLTableCaptionElement",col:"HTMLTableColElement",content:"HTMLContentElement",data:"HTMLDataElement",datalist:"HTMLDataListElement",del:"HTMLModElement",dir:"HTMLDirectoryElement",div:"HTMLDivElement",dl:"HTMLDListElement",embed:"HTMLEmbedElement",fieldset:"HTMLFieldSetElement",font:"HTMLFontElement",form:"HTMLFormElement",frame:"HTMLFrameElement",frameset:"HTMLFrameSetElement",h1:"HTMLHeadingElement",head:"HTMLHeadElement",hr:"HTMLHRElement",html:"HTMLHtmlElement",iframe:"HTMLIFrameElement",img:"HTMLImageElement",input:"HTMLInputElement",keygen:"HTMLKeygenElement",label:"HTMLLabelElement",legend:"HTMLLegendElement",li:"HTMLLIElement",link:"HTMLLinkElement",map:"HTMLMapElement",marquee:"HTMLMarqueeElement",menu:"HTMLMenuElement",menuitem:"HTMLMenuItemElement",meta:"HTMLMetaElement",meter:"HTMLMeterElement",object:"HTMLObjectElement",ol:"HTMLOListElement",optgroup:"HTMLOptGroupElement",option:"HTMLOptionElement",output:"HTMLOutputElement",p:"HTMLParagraphElement",param:"HTMLParamElement",pre:"HTMLPreElement",progress:"HTMLProgressElement",q:"HTMLQuoteElement",script:"HTMLScriptElement",select:"HTMLSelectElement",shadow:"HTMLShadowElement",source:"HTMLSourceElement",span:"HTMLSpanElement",style:"HTMLStyleElement",table:"HTMLTableElement",tbody:"HTMLTableSectionElement",template:"HTMLTemplateElement",textarea:"HTMLTextAreaElement",thead:"HTMLTableSectionElement",time:"HTMLTimeElement",title:"HTMLTitleElement",tr:"HTMLTableRowElement",track:"HTMLTrackElement",ul:"HTMLUListElement",video:"HTMLVideoElement"});Object.keys(n).forEach(t),Object.getOwnPropertyNames(e.wrappers).forEach(function(t){window[t]=e.wrappers[t]})}(window.ShadowDOMPolyfill),function(e){function t(e,t){var n="";return Array.prototype.forEach.call(e,function(e){n+=e.textContent+"\n\n"}),t||(n=n.replace(d,"")),n}function n(e){var t=document.createElement("style");return t.textContent=e,t}function r(e){var t=n(e);document.head.appendChild(t);var r=[];if(t.sheet)try{r=t.sheet.cssRules}catch(o){}else console.warn("sheet not found",t);return t.parentNode.removeChild(t),r}function o(){N.initialized=!0,document.body.appendChild(N);var e=N.contentDocument,t=e.createElement("base");t.href=document.baseURI,e.head.appendChild(t)}function i(e){N.initialized||o(),document.body.appendChild(N),e(N.contentDocument),document.body.removeChild(N)}function a(e,t){if(t){var o;if(e.match("@import")&&j){var a=n(e);i(function(e){e.head.appendChild(a.impl),o=Array.prototype.slice.call(a.sheet.cssRules,0),t(o)})}else o=r(e),t(o)}}function s(e){e&&l().appendChild(document.createTextNode(e))}function c(e,t){var r=n(e);r.setAttribute(t,""),r.setAttribute(x,""),document.head.appendChild(r)}function l(){return D||(D=document.createElement("style"),D.setAttribute(x,""),D[x]=!0),D}var u={strictStyling:!1,registry:{},shimStyling:function(e,n,r){var o=this.prepareRoot(e,n,r),i=this.isTypeExtension(r),a=this.makeScopeSelector(n,i),s=t(o,!0);s=this.scopeCssText(s,a),e&&(e.shimmedStyle=s),this.addCssToDocument(s,n)},shimStyle:function(e,t){return this.shimCssText(e.textContent,t)},shimCssText:function(e,t){return e=this.insertDirectives(e),this.scopeCssText(e,t)},makeScopeSelector:function(e,t){return e?t?"[is="+e+"]":e:""},isTypeExtension:function(e){return e&&e.indexOf("-")<0},prepareRoot:function(e,t,n){var r=this.registerRoot(e,t,n);return this.replaceTextInStyles(r.rootStyles,this.insertDirectives),this.removeStyles(e,r.rootStyles),this.strictStyling&&this.applyScopeToContent(e,t),r.scopeStyles},removeStyles:function(e,t){for(var n,r=0,o=t.length;o>r&&(n=t[r]);r++)n.parentNode.removeChild(n)},registerRoot:function(e,t,n){var r=this.registry[t]={root:e,name:t,extendsName:n},o=this.findStyles(e);r.rootStyles=o,r.scopeStyles=r.rootStyles;var i=this.registry[r.extendsName];return i&&(r.scopeStyles=i.scopeStyles.concat(r.scopeStyles)),r},findStyles:function(e){if(!e)return[];var t=e.querySelectorAll("style");return Array.prototype.filter.call(t,function(e){return!e.hasAttribute(R)})},applyScopeToContent:function(e,t){e&&(Array.prototype.forEach.call(e.querySelectorAll("*"),function(e){e.setAttribute(t,"")}),Array.prototype.forEach.call(e.querySelectorAll("template"),function(e){this.applyScopeToContent(e.content,t)},this))},insertDirectives:function(e){return e=this.insertPolyfillDirectivesInCssText(e),this.insertPolyfillRulesInCssText(e)},insertPolyfillDirectivesInCssText:function(e){return e=e.replace(p,function(e,t){return t.slice(0,-2)+"{"}),e.replace(f,function(e,t){return t+" {"})},insertPolyfillRulesInCssText:function(e){return e=e.replace(h,function(e,t){return t.slice(0,-1)}),e.replace(m,function(e,t,n,r){var o=e.replace(t,"").replace(n,"");return r+o})},scopeCssText:function(e,t){var n=this.extractUnscopedRulesFromCssText(e);if(e=this.insertPolyfillHostInCssText(e),e=this.convertColonHost(e),e=this.convertColonHostContext(e),e=this.convertShadowDOMSelectors(e),t){var e,r=this;a(e,function(n){e=r.scopeRules(n,t)})}return e=e+"\n"+n,e.trim()},extractUnscopedRulesFromCssText:function(e){for(var t,n="";t=w.exec(e);)n+=t[1].slice(0,-1)+"\n\n";for(;t=v.exec(e);)n+=t[0].replace(t[2],"").replace(t[1],t[3])+"\n\n";return n},convertColonHost:function(e){return this.convertColonRule(e,E,this.colonHostPartReplacer)},convertColonHostContext:function(e){return this.convertColonRule(e,S,this.colonHostContextPartReplacer)},convertColonRule:function(e,t,n){return e.replace(t,function(e,t,r,o){if(t=L,r){for(var i,a=r.split(","),s=[],c=0,l=a.length;l>c&&(i=a[c]);c++)i=i.trim(),s.push(n(t,i,o));return s.join(",")}return t+o})},colonHostContextPartReplacer:function(e,t,n){return t.match(g)?this.colonHostPartReplacer(e,t,n):e+t+n+", "+t+" "+e+n},colonHostPartReplacer:function(e,t,n){return e+t.replace(g,"")+n},convertShadowDOMSelectors:function(e){for(var t=0;t<C.length;t++)e=e.replace(C[t]," ");return e},scopeRules:function(e,t){var n="";return e&&Array.prototype.forEach.call(e,function(e){if(e.selectorText&&e.style&&void 0!==e.style.cssText)n+=this.scopeSelector(e.selectorText,t,this.strictStyling)+" {\n ",n+=this.propertiesFromRule(e)+"\n}\n\n";else if(e.type===CSSRule.MEDIA_RULE)n+="@media "+e.media.mediaText+" {\n",n+=this.scopeRules(e.cssRules,t),n+="\n}\n\n";else try{e.cssText&&(n+=e.cssText+"\n\n")}catch(r){e.type===CSSRule.KEYFRAMES_RULE&&e.cssRules&&(n+=this.ieSafeCssTextFromKeyFrameRule(e))}},this),n},ieSafeCssTextFromKeyFrameRule:function(e){var t="@keyframes "+e.name+" {";return Array.prototype.forEach.call(e.cssRules,function(e){t+=" "+e.keyText+" {"+e.style.cssText+"}"}),t+=" }"},scopeSelector:function(e,t,n){var r=[],o=e.split(",");return o.forEach(function(e){e=e.trim(),this.selectorNeedsScoping(e,t)&&(e=n&&!e.match(L)?this.applyStrictSelectorScope(e,t):this.applySelectorScope(e,t)),r.push(e)},this),r.join(", ")},selectorNeedsScoping:function(e,t){if(Array.isArray(t))return!0;var n=this.makeScopeMatcher(t);return!e.match(n)},makeScopeMatcher:function(e){return e=e.replace(/\[/g,"\\[").replace(/\]/g,"\\]"),new RegExp("^("+e+")"+T,"m")},applySelectorScope:function(e,t){return Array.isArray(t)?this.applySelectorScopeList(e,t):this.applySimpleSelectorScope(e,t)},applySelectorScopeList:function(e,t){for(var n,r=[],o=0;n=t[o];o++)r.push(this.applySimpleSelectorScope(e,n));return r.join(", ")},applySimpleSelectorScope:function(e,t){return e.match(O)?(e=e.replace(L,t),e.replace(O,t+" ")):t+" "+e},applyStrictSelectorScope:function(e,t){t=t.replace(/\[is=([^\]]*)\]/g,"$1");var n=[" ",">","+","~"],r=e,o="["+t+"]";return n.forEach(function(e){var t=r.split(e);r=t.map(function(e){var t=e.trim().replace(O,"");return t&&n.indexOf(t)<0&&t.indexOf(o)<0&&(e=t.replace(/([^:]*)(:*)(.*)/,"$1"+o+"$2$3")),e}).join(e)}),r},insertPolyfillHostInCssText:function(e){return e.replace(_,b).replace(M,g)},propertiesFromRule:function(e){var t=e.style.cssText;e.style.content&&!e.style.content.match(/['"]+|attr/)&&(t=t.replace(/content:[^;]*;/g,"content: '"+e.style.content+"';"));var n=e.style;for(var r in n)"initial"===n[r]&&(t+=r+": initial; ");return t},replaceTextInStyles:function(e,t){e&&t&&(e instanceof Array||(e=[e]),Array.prototype.forEach.call(e,function(e){e.textContent=t.call(this,e.textContent)},this))},addCssToDocument:function(e,t){e.match("@import")?c(e,t):s(e)}},d=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,p=/\/\*\s*@polyfill ([^*]*\*+([^/*][^*]*\*+)*\/)([^{]*?){/gim,f=/polyfill-next-selector[^}]*content\:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim,h=/\/\*\s@polyfill-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim,m=/(polyfill-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,w=/\/\*\s@polyfill-unscoped-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim,v=/(polyfill-unscoped-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim,g="-shadowcsshost",b="-shadowcsscontext",y=")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)",E=new RegExp("("+g+y,"gim"),S=new RegExp("("+b+y,"gim"),T="([>\\s~+[.,{:][\\s\\S]*)?$",M=/\:host/gim,_=/\:host-context/gim,L=g+"-no-combinator",O=new RegExp(g,"gim"),C=(new RegExp(b,"gim"),[/\^\^/g,/\^/g,/\/shadow\//g,/\/shadow-deep\//g,/::shadow/g,/\/deep\//g,/::content/g]),N=document.createElement("iframe");N.style.display="none";var D,j=navigator.userAgent.match("Chrome"),H="shim-shadowdom",x="shim-shadowdom-css",R="no-shim";if(window.ShadowDOMPolyfill){s("style { display: none !important; }\n");var P=ShadowDOMPolyfill.wrap(document),I=P.querySelector("head");I.insertBefore(l(),I.childNodes[0]),document.addEventListener("DOMContentLoaded",function(){e.urlResolver;if(window.HTMLImports&&!HTMLImports.useNative){var t="link[rel=stylesheet]["+H+"]",n="style["+H+"]";HTMLImports.importer.documentPreloadSelectors+=","+t,HTMLImports.importer.importsPreloadSelectors+=","+t,HTMLImports.parser.documentSelectors=[HTMLImports.parser.documentSelectors,t,n].join(",");var r=HTMLImports.parser.parseGeneric;HTMLImports.parser.parseGeneric=function(e){if(!e[x]){var t=e.__importElement||e;if(!t.hasAttribute(H))return void r.call(this,e);e.__resource&&(t=e.ownerDocument.createElement("style"),t.textContent=e.__resource),HTMLImports.path.resolveUrlsInStyle(t),t.textContent=u.shimStyle(t),t.removeAttribute(H,""),t.setAttribute(x,""),t[x]=!0,t.parentNode!==I&&(e.parentNode===I?I.replaceChild(t,e):this.addElementToDocument(t)),t.__importParsed=!0,this.markParsingComplete(e),this.parseNext()}};var o=HTMLImports.parser.hasResource;HTMLImports.parser.hasResource=function(e){return"link"===e.localName&&"stylesheet"===e.rel&&e.hasAttribute(H)?e.__resource:o.call(this,e)}}})}e.ShadowCSS=u}(window.WebComponents)),function(){window.ShadowDOMPolyfill?(window.wrap=ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){return e}}(window.WebComponents),window.HTMLImports=window.HTMLImports||{flags:{}},function(e){function t(e,t){t=t||h,r(function(){i(e,t)},t)}function n(e){return"complete"===e.readyState||e.readyState===v}function r(e,t){if(n(t))e&&e();else{var o=function(){("complete"===t.readyState||t.readyState===v)&&(t.removeEventListener(g,o),r(e,t))};t.addEventListener(g,o)}}function o(e){e.target.__loaded=!0}function i(e,t){function n(){s==c&&e&&e()}function r(e){o(e),s++,n()}var i=t.querySelectorAll("link[rel=import]"),s=0,c=i.length;if(c)for(var l,u=0;c>u&&(l=i[u]);u++)a(l)?r.call(l,{target:l}):(l.addEventListener("load",r),l.addEventListener("error",r));else n()}function a(e){return d?e.__loaded||e["import"]&&"loading"!==e["import"].readyState:e.__importParsed}function s(e){for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)c(t)&&l(t)}function c(e){return"link"===e.localName&&"import"===e.rel}function l(e){var t=e["import"];t?o({target:e}):(e.addEventListener("load",o),e.addEventListener("error",o))}var u="import",d=Boolean(u in document.createElement("link")),p=Boolean(window.ShadowDOMPolyfill),f=function(e){return p?ShadowDOMPolyfill.wrapIfNeeded(e):e},h=f(document),m={get:function(){var e=HTMLImports.currentScript||document.currentScript||("complete"!==document.readyState?document.scripts[document.scripts.length-1]:null);return f(e)},configurable:!0};Object.defineProperty(document,"_currentScript",m),Object.defineProperty(h,"_currentScript",m);var w=/Trident|Edge/.test(navigator.userAgent),v=w?"complete":"interactive",g="readystatechange";d&&(new MutationObserver(function(e){for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)t.addedNodes&&s(t.addedNodes)}).observe(document.head,{childList:!0}),function(){if("loading"===document.readyState)for(var e,t=document.querySelectorAll("link[rel=import]"),n=0,r=t.length;r>n&&(e=t[n]);n++)l(e)}()),t(function(){HTMLImports.ready=!0,HTMLImports.readyTime=(new Date).getTime();var e=h.createEvent("CustomEvent");e.initCustomEvent("HTMLImportsLoaded",!0,!0,{}),h.dispatchEvent(e)}),e.IMPORT_LINK_TYPE=u,e.useNative=d,e.rootDocument=h,e.whenReady=t,e.isIE=w}(HTMLImports),function(e){var t=[],n=function(e){t.push(e)},r=function(){t.forEach(function(t){t(e)})};e.addModule=n,e.initializeModules=r}(HTMLImports),HTMLImports.addModule(function(e){var t=/(url\()([^)]*)(\))/g,n=/(@import[\s]+(?!url\())([^;]*)(;)/g,r={resolveUrlsInStyle:function(e){var t=e.ownerDocument,n=t.createElement("a");return e.textContent=this.resolveUrlsInCssText(e.textContent,n),e},resolveUrlsInCssText:function(e,r){var o=this.replaceUrls(e,r,t);return o=this.replaceUrls(o,r,n)},replaceUrls:function(e,t,n){return e.replace(n,function(e,n,r,o){var i=r.replace(/["']/g,"");return t.href=i,i=t.href,n+"'"+i+"'"+o})}};e.path=r}),HTMLImports.addModule(function(e){var t={async:!0,ok:function(e){return e.status>=200&&e.status<300||304===e.status||0===e.status},load:function(n,r,o){var i=new XMLHttpRequest;return(e.flags.debug||e.flags.bust)&&(n+="?"+Math.random()),i.open("GET",n,t.async),i.addEventListener("readystatechange",function(){if(4===i.readyState){var e=i.getResponseHeader("Location"),n=null;if(e)var n="/"===e.substr(0,1)?location.origin+e:e;r.call(o,!t.ok(i)&&i,i.response||i.responseText,n)}}),i.send(),i},loadDocument:function(e,t,n){this.load(e,t,n).responseType="document"}};e.xhr=t}),HTMLImports.addModule(function(e){var t=e.xhr,n=e.flags,r=function(e,t){this.cache={},this.onload=e,this.oncomplete=t,this.inflight=0,this.pending={}};r.prototype={addNodes:function(e){this.inflight+=e.length;for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)this.require(t);this.checkDone()},addNode:function(e){this.inflight++,this.require(e),this.checkDone()},require:function(e){var t=e.src||e.href;e.__nodeUrl=t,this.dedupe(t,e)||this.fetch(t,e)},dedupe:function(e,t){if(this.pending[e])return this.pending[e].push(t),!0;return this.cache[e]?(this.onload(e,t,this.cache[e]),this.tail(),!0):(this.pending[e]=[t],!1)},fetch:function(e,r){if(n.load&&console.log("fetch",e,r),e)if(e.match(/^data:/)){var o=e.split(","),i=o[0],a=o[1];a=i.indexOf(";base64")>-1?atob(a):decodeURIComponent(a),setTimeout(function(){this.receive(e,r,null,a)}.bind(this),0)}else{var s=function(t,n,o){this.receive(e,r,t,n,o)}.bind(this);t.load(e,s)}else setTimeout(function(){this.receive(e,r,{error:"href must be specified"},null)}.bind(this),0)},receive:function(e,t,n,r,o){this.cache[e]=r;for(var i,a=this.pending[e],s=0,c=a.length;c>s&&(i=a[s]);s++)this.onload(e,i,r,n,o),this.tail();this.pending[e]=null},tail:function(){--this.inflight,this.checkDone()},checkDone:function(){this.inflight||this.oncomplete()}},e.Loader=r}),HTMLImports.addModule(function(e){var t=function(e){this.addCallback=e,this.mo=new MutationObserver(this.handler.bind(this))};t.prototype={handler:function(e){for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)"childList"===t.type&&t.addedNodes.length&&this.addedNodes(t.addedNodes)},addedNodes:function(e){this.addCallback&&this.addCallback(e);for(var t,n=0,r=e.length;r>n&&(t=e[n]);n++)t.children&&t.children.length&&this.addedNodes(t.children)},observe:function(e){this.mo.observe(e,{childList:!0,subtree:!0})}},e.Observer=t}),HTMLImports.addModule(function(e){function t(e){return"link"===e.localName&&e.rel===u}function n(e){var t=r(e);return"data:text/javascript;charset=utf-8,"+encodeURIComponent(t)}function r(e){return e.textContent+o(e)}function o(e){var t=e.ownerDocument;t.__importedScripts=t.__importedScripts||0;var n=e.ownerDocument.baseURI,r=t.__importedScripts?"-"+t.__importedScripts:"";return t.__importedScripts++,"\n//# sourceURL="+n+r+".js\n"}function i(e){var t=e.ownerDocument.createElement("style");return t.textContent=e.textContent,a.resolveUrlsInStyle(t),t}var a=e.path,s=e.rootDocument,c=e.flags,l=e.isIE,u=e.IMPORT_LINK_TYPE,d="link[rel="+u+"]",p={documentSelectors:d,importsSelectors:[d,"link[rel=stylesheet]","style","script:not([type])",'script[type="text/javascript"]'].join(","),map:{link:"parseLink",script:"parseScript",style:"parseStyle"},dynamicElements:[],parseNext:function(){var e=this.nextToParse();e&&this.parse(e)},parse:function(e){if(this.isParsed(e))return void(c.parse&&console.log("[%s] is already parsed",e.localName));var t=this[this.map[e.localName]];t&&(this.markParsing(e),t.call(this,e))},parseDynamic:function(e,t){this.dynamicElements.push(e),t||this.parseNext()},markParsing:function(e){c.parse&&console.log("parsing",e),this.parsingElement=e},markParsingComplete:function(e){e.__importParsed=!0,this.markDynamicParsingComplete(e),e.__importElement&&(e.__importElement.__importParsed=!0,this.markDynamicParsingComplete(e.__importElement)),this.parsingElement=null,c.parse&&console.log("completed",e)},markDynamicParsingComplete:function(e){var t=this.dynamicElements.indexOf(e);t>=0&&this.dynamicElements.splice(t,1)},parseImport:function(e){if(HTMLImports.__importsParsingHook&&HTMLImports.__importsParsingHook(e),e["import"]&&(e["import"].__importParsed=!0),this.markParsingComplete(e),e.dispatchEvent(e.__resource&&!e.__error?new CustomEvent("load",{bubbles:!1}):new CustomEvent("error",{bubbles:!1})),e.__pending)for(var t;e.__pending.length;)t=e.__pending.shift(),t&&t({target:e});this.parseNext()},parseLink:function(e){t(e)?this.parseImport(e):(e.href=e.href,this.parseGeneric(e))},parseStyle:function(e){var t=e;e=i(e),e.__importElement=t,this.parseGeneric(e)},parseGeneric:function(e){this.trackElement(e),this.addElementToDocument(e)},rootImportForElement:function(e){for(var t=e;t.ownerDocument.__importLink;)t=t.ownerDocument.__importLink;return t},addElementToDocument:function(e){var t=this.rootImportForElement(e.__importElement||e);t.parentNode.insertBefore(e,t)},trackElement:function(e,t){var n=this,r=function(r){t&&t(r),n.markParsingComplete(e),n.parseNext()};if(e.addEventListener("load",r),e.addEventListener("error",r),l&&"style"===e.localName){var o=!1;if(-1==e.textContent.indexOf("@import"))o=!0;else if(e.sheet){o=!0;for(var i,a=e.sheet.cssRules,s=a?a.length:0,c=0;s>c&&(i=a[c]);c++)i.type===CSSRule.IMPORT_RULE&&(o=o&&Boolean(i.styleSheet))}o&&e.dispatchEvent(new CustomEvent("load",{bubbles:!1}))}},parseScript:function(t){var r=document.createElement("script");r.__importElement=t,r.src=t.src?t.src:n(t),e.currentScript=t,this.trackElement(r,function(){r.parentNode.removeChild(r),e.currentScript=null}),this.addElementToDocument(r)},nextToParse:function(){return this._mayParse=[],!this.parsingElement&&(this.nextToParseInDoc(s)||this.nextToParseDynamic())},nextToParseInDoc:function(e,n){if(e&&this._mayParse.indexOf(e)<0){this._mayParse.push(e);for(var r,o=e.querySelectorAll(this.parseSelectorsForNode(e)),i=0,a=o.length;a>i&&(r=o[i]);i++)if(!this.isParsed(r))return this.hasResource(r)?t(r)?this.nextToParseInDoc(r["import"],r):r:void 0}return n},nextToParseDynamic:function(){return this.dynamicElements[0]},parseSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===s?this.documentSelectors:this.importsSelectors},isParsed:function(e){return e.__importParsed},needsDynamicParsing:function(e){return this.dynamicElements.indexOf(e)>=0},hasResource:function(e){return t(e)&&void 0===e["import"]?!1:!0}};e.parser=p,e.IMPORT_SELECTOR=d}),HTMLImports.addModule(function(e){function t(e){return n(e,a)}function n(e,t){return"link"===e.localName&&e.getAttribute("rel")===t}function r(e){return!!Object.getOwnPropertyDescriptor(e,"baseURI")}function o(e,t){var n=document.implementation.createHTMLDocument(a);n._URL=t;var o=n.createElement("base");o.setAttribute("href",t),n.baseURI||r(n)||Object.defineProperty(n,"baseURI",{value:t});var i=n.createElement("meta");return i.setAttribute("charset","utf-8"),n.head.appendChild(i),n.head.appendChild(o),n.body.innerHTML=e,window.HTMLTemplateElement&&HTMLTemplateElement.bootstrap&&HTMLTemplateElement.bootstrap(n),n}var i=e.flags,a=e.IMPORT_LINK_TYPE,s=e.IMPORT_SELECTOR,c=e.rootDocument,l=e.Loader,u=e.Observer,d=e.parser,p={documents:{},documentPreloadSelectors:s,importsPreloadSelectors:[s].join(","),loadNode:function(e){f.addNode(e)},loadSubtree:function(e){var t=this.marshalNodes(e);f.addNodes(t)},marshalNodes:function(e){return e.querySelectorAll(this.loadSelectorsForNode(e))},loadSelectorsForNode:function(e){var t=e.ownerDocument||e;return t===c?this.documentPreloadSelectors:this.importsPreloadSelectors},loaded:function(e,n,r,a,s){if(i.load&&console.log("loaded",e,n),n.__resource=r,n.__error=a,t(n)){var c=this.documents[e];void 0===c&&(c=a?null:o(r,s||e),c&&(c.__importLink=n,this.bootDocument(c)),this.documents[e]=c),n["import"]=c}d.parseNext()},bootDocument:function(e){this.loadSubtree(e),this.observer.observe(e),d.parseNext()},loadedAll:function(){d.parseNext()}},f=new l(p.loaded.bind(p),p.loadedAll.bind(p));if(p.observer=new u,!document.baseURI){var h={get:function(){var e=document.querySelector("base");return e?e.href:window.location.href},configurable:!0};Object.defineProperty(document,"baseURI",h),Object.defineProperty(c,"baseURI",h)}e.importer=p,e.importLoader=f}),HTMLImports.addModule(function(e){var t=e.parser,n=e.importer,r={added:function(e){for(var r,o,i,a,s=0,c=e.length;c>s&&(a=e[s]);s++)r||(r=a.ownerDocument,o=t.isParsed(r)),i=this.shouldLoadNode(a),i&&n.loadNode(a),this.shouldParseNode(a)&&o&&t.parseDynamic(a,i)},shouldLoadNode:function(e){return 1===e.nodeType&&o.call(e,n.loadSelectorsForNode(e))},shouldParseNode:function(e){return 1===e.nodeType&&o.call(e,t.parseSelectorsForNode(e))}};n.observer.addCallback=r.added.bind(r);var o=HTMLElement.prototype.matches||HTMLElement.prototype.matchesSelector||HTMLElement.prototype.webkitMatchesSelector||HTMLElement.prototype.mozMatchesSelector||HTMLElement.prototype.msMatchesSelector}),function(e){function t(){HTMLImports.importer.bootDocument(o)}var n=e.initializeModules,r=e.isIE;if(!e.useNative){r&&"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e,t){t=t||{};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),n},window.CustomEvent.prototype=window.Event.prototype),n();var o=e.rootDocument;"complete"===document.readyState||"interactive"===document.readyState&&!window.attachEvent?t():document.addEventListener("DOMContentLoaded",t)}}(HTMLImports),window.CustomElements=window.CustomElements||{flags:{}},function(e){var t=e.flags,n=[],r=function(e){n.push(e)},o=function(){n.forEach(function(t){t(e)})};e.addModule=r,e.initializeModules=o,e.hasNative=Boolean(document.registerElement),e.useNative=!t.register&&e.hasNative&&!window.ShadowDOMPolyfill&&(!window.HTMLImports||HTMLImports.useNative)}(CustomElements),CustomElements.addModule(function(e){function t(e,t){n(e,function(e){return t(e)?!0:void r(e,t)}),r(e,t)}function n(e,t,r){var o=e.firstElementChild;if(!o)for(o=e.firstChild;o&&o.nodeType!==Node.ELEMENT_NODE;)o=o.nextSibling;for(;o;)t(o,r)!==!0&&n(o,t,r),o=o.nextElementSibling;return null}function r(e,n){for(var r=e.shadowRoot;r;)t(r,n),r=r.olderShadowRoot}function o(e,t){a=[],i(e,t),a=null}function i(e,t){if(e=wrap(e),!(a.indexOf(e)>=0)){a.push(e);for(var n,r=e.querySelectorAll("link[rel="+s+"]"),o=0,c=r.length;c>o&&(n=r[o]);o++)n["import"]&&i(n["import"],t);t(e)}}var a,s=window.HTMLImports?HTMLImports.IMPORT_LINK_TYPE:"none";e.forDocumentTree=o,e.forSubtree=t}),CustomElements.addModule(function(e){function t(e){return n(e)||r(e)}function n(t){return e.upgrade(t)?!0:void s(t)}function r(e){y(e,function(e){return n(e)?!0:void 0})}function o(e){s(e),p(e)&&y(e,function(e){s(e)})}function i(e){M.push(e),T||(T=!0,setTimeout(a))}function a(){T=!1;for(var e,t=M,n=0,r=t.length;r>n&&(e=t[n]);n++)e();M=[]}function s(e){S?i(function(){c(e)}):c(e)}function c(e){e.__upgraded__&&(e.attachedCallback||e.detachedCallback)&&!e.__attached&&p(e)&&(e.__attached=!0,e.attachedCallback&&e.attachedCallback())}function l(e){u(e),y(e,function(e){u(e)})}function u(e){S?i(function(){d(e)}):d(e)}function d(e){e.__upgraded__&&(e.attachedCallback||e.detachedCallback)&&e.__attached&&!p(e)&&(e.__attached=!1,e.detachedCallback&&e.detachedCallback())}function p(e){for(var t=e,n=wrap(document);t;){if(t==n)return!0;t=t.parentNode||t.host}}function f(e){if(e.shadowRoot&&!e.shadowRoot.__watched){b.dom&&console.log("watching shadow-root for: ",e.localName);for(var t=e.shadowRoot;t;)w(t),t=t.olderShadowRoot}}function h(e){if(b.dom){var n=e[0];if(n&&"childList"===n.type&&n.addedNodes&&n.addedNodes){for(var r=n.addedNodes[0];r&&r!==document&&!r.host;)r=r.parentNode;var o=r&&(r.URL||r._URL||r.host&&r.host.localName)||"";o=o.split("/?").shift().split("/").pop()}console.group("mutations (%d) [%s]",e.length,o||"")}e.forEach(function(e){"childList"===e.type&&(_(e.addedNodes,function(e){e.localName&&t(e)}),_(e.removedNodes,function(e){e.localName&&l(e)}))}),b.dom&&console.groupEnd()}function m(e){for(e=wrap(e),e||(e=wrap(document));e.parentNode;)e=e.parentNode;var t=e.__observer;t&&(h(t.takeRecords()),a())}function w(e){if(!e.__observer){var t=new MutationObserver(h);t.observe(e,{childList:!0,subtree:!0}),e.__observer=t}}function v(e){e=wrap(e),b.dom&&console.group("upgradeDocument: ",e.baseURI.split("/").pop()),t(e),w(e),b.dom&&console.groupEnd()}function g(e){E(e,v)}var b=e.flags,y=e.forSubtree,E=e.forDocumentTree,S=!window.MutationObserver||window.MutationObserver===window.JsMutationObserver;e.hasPolyfillMutations=S;var T=!1,M=[],_=Array.prototype.forEach.call.bind(Array.prototype.forEach),L=Element.prototype.createShadowRoot;L&&(Element.prototype.createShadowRoot=function(){var e=L.call(this);return CustomElements.watchShadow(this),e}),e.watchShadow=f,e.upgradeDocumentTree=g,e.upgradeSubtree=r,e.upgradeAll=t,e.attachedNode=o,e.takeRecords=m}),CustomElements.addModule(function(e){function t(t){if(!t.__upgraded__&&t.nodeType===Node.ELEMENT_NODE){var r=t.getAttribute("is"),o=e.getRegisteredDefinition(r||t.localName);if(o){if(r&&o.tag==t.localName)return n(t,o);if(!r&&!o["extends"])return n(t,o)}}}function n(t,n){return a.upgrade&&console.group("upgrade:",t.localName),n.is&&t.setAttribute("is",n.is),r(t,n),t.__upgraded__=!0,i(t),e.attachedNode(t),e.upgradeSubtree(t),a.upgrade&&console.groupEnd(),t}function r(e,t){Object.__proto__?e.__proto__=t.prototype:(o(e,t.prototype,t["native"]),e.__proto__=t.prototype)}function o(e,t,n){for(var r={},o=t;o!==n&&o!==HTMLElement.prototype;){for(var i,a=Object.getOwnPropertyNames(o),s=0;i=a[s];s++)r[i]||(Object.defineProperty(e,i,Object.getOwnPropertyDescriptor(o,i)),r[i]=1);o=Object.getPrototypeOf(o)}}function i(e){e.createdCallback&&e.createdCallback()}var a=e.flags;e.upgrade=t,e.upgradeWithDefinition=n,e.implementPrototype=r}),CustomElements.addModule(function(e){function t(t,r){var c=r||{};if(!t)throw new Error("document.registerElement: first argument `name` must not be empty");if(t.indexOf("-")<0)throw new Error("document.registerElement: first argument ('name') must contain a dash ('-'). Argument provided was '"+String(t)+"'.");if(o(t))throw new Error("Failed to execute 'registerElement' on 'Document': Registration failed for type '"+String(t)+"'. The type name is invalid.");if(l(t))throw new Error("DuplicateDefinitionError: a type with name '"+String(t)+"' is already registered");return c.prototype||(c.prototype=Object.create(HTMLElement.prototype)),c.__name=t.toLowerCase(),c.lifecycle=c.lifecycle||{},c.ancestry=i(c["extends"]),a(c),s(c),n(c.prototype),u(c.__name,c),c.ctor=d(c),c.ctor.prototype=c.prototype,c.prototype.constructor=c.ctor,e.ready&&w(document),c.ctor}function n(e){if(!e.setAttribute._polyfilled){var t=e.setAttribute;e.setAttribute=function(e,n){r.call(this,e,n,t)};var n=e.removeAttribute;e.removeAttribute=function(e){r.call(this,e,null,n)},e.setAttribute._polyfilled=!0}}function r(e,t,n){e=e.toLowerCase();var r=this.getAttribute(e);n.apply(this,arguments);var o=this.getAttribute(e);this.attributeChangedCallback&&o!==r&&this.attributeChangedCallback(e,r,o)}function o(e){for(var t=0;t<E.length;t++)if(e===E[t])return!0}function i(e){var t=l(e);return t?i(t["extends"]).concat([t]):[]}function a(e){for(var t,n=e["extends"],r=0;t=e.ancestry[r];r++)n=t.is&&t.tag;e.tag=n||e.__name,n&&(e.is=e.__name)}function s(e){if(!Object.__proto__){var t=HTMLElement.prototype;if(e.is){var n=document.createElement(e.tag),r=Object.getPrototypeOf(n);r===e.prototype&&(t=r)}for(var o,i=e.prototype;i&&i!==t;)o=Object.getPrototypeOf(i),i.__proto__=o,i=o;e["native"]=t}}function c(e){return g(M(e.tag),e)}function l(e){return e?S[e.toLowerCase()]:void 0}function u(e,t){S[e]=t}function d(e){return function(){return c(e)}}function p(e,t,n){return e===T?f(t,n):_(e,t)}function f(e,t){var n=l(t||e);
-if(n){if(e==n.tag&&t==n.is)return new n.ctor;if(!t&&!n.is)return new n.ctor}var r;return t?(r=f(e),r.setAttribute("is",t),r):(r=M(e),e.indexOf("-")>=0&&b(r,HTMLElement),r)}function h(e){var t=L.call(this,e);return v(t),t}var m,w=e.upgradeDocumentTree,v=e.upgrade,g=e.upgradeWithDefinition,b=e.implementPrototype,y=e.useNative,E=["annotation-xml","color-profile","font-face","font-face-src","font-face-uri","font-face-format","font-face-name","missing-glyph"],S={},T="http://www.w3.org/1999/xhtml",M=document.createElement.bind(document),_=document.createElementNS.bind(document),L=Node.prototype.cloneNode;m=Object.__proto__||y?function(e,t){return e instanceof t}:function(e,t){for(var n=e;n;){if(n===t.prototype)return!0;n=n.__proto__}return!1},document.registerElement=t,document.createElement=f,document.createElementNS=p,Node.prototype.cloneNode=h,e.registry=S,e["instanceof"]=m,e.reservedTagList=E,e.getRegisteredDefinition=l,document.register=document.registerElement}),function(e){function t(){a(wrap(document)),window.HTMLImports&&(HTMLImports.__importsParsingHook=function(e){a(wrap(e["import"]))}),CustomElements.ready=!0,setTimeout(function(){CustomElements.readyTime=Date.now(),window.HTMLImports&&(CustomElements.elapsed=CustomElements.readyTime-HTMLImports.readyTime),document.dispatchEvent(new CustomEvent("WebComponentsReady",{bubbles:!0}))})}var n=e.useNative,r=e.initializeModules,o=/Trident/.test(navigator.userAgent);if(n){var i=function(){};e.watchShadow=i,e.upgrade=i,e.upgradeAll=i,e.upgradeDocumentTree=i,e.upgradeSubtree=i,e.takeRecords=i,e["instanceof"]=function(e,t){return e instanceof t}}else r();var a=e.upgradeDocumentTree;if(window.wrap||(window.ShadowDOMPolyfill?(window.wrap=ShadowDOMPolyfill.wrapIfNeeded,window.unwrap=ShadowDOMPolyfill.unwrapIfNeeded):window.wrap=window.unwrap=function(e){return e}),o&&"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(e,t){t=t||{};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,Boolean(t.bubbles),Boolean(t.cancelable),t.detail),n},window.CustomEvent.prototype=window.Event.prototype),"complete"===document.readyState||e.flags.eager)t();else if("interactive"!==document.readyState||window.attachEvent||window.HTMLImports&&!window.HTMLImports.ready){var s=window.HTMLImports&&!HTMLImports.ready?"HTMLImportsLoaded":"DOMContentLoaded";window.addEventListener(s,t)}else t()}(window.CustomElements),function(){Function.prototype.bind||(Function.prototype.bind=function(e){var t=this,n=Array.prototype.slice.call(arguments,1);return function(){var r=n.slice();return r.push.apply(r,arguments),t.apply(e,r)}})}(window.WebComponents),function(e){"use strict";function t(){window.Polymer===o&&(window.Polymer=function(){throw new Error('You tried to use polymer without loading it first. To load polymer, <link rel="import" href="components/polymer/polymer.html">')})}if(!window.performance){var n=Date.now();window.performance={now:function(){return Date.now()-n}}}window.requestAnimationFrame||(window.requestAnimationFrame=function(){var e=window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame;return e?function(t){return e(function(){t(performance.now())})}:function(e){return window.setTimeout(e,1e3/60)}}()),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(){return window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||function(e){clearTimeout(e)}}());var r=[],o=function(e){"string"!=typeof e&&1===arguments.length&&Array.prototype.push.call(arguments,document._currentScript),r.push(arguments)};window.Polymer=o,e.consumeDeclarations=function(t){e.consumeDeclarations=function(){throw"Possible attempt to load Polymer twice"},t&&t(r),r=null},HTMLImports.useNative?t():addEventListener("DOMContentLoaded",t)}(window.WebComponents),function(){var e=document.createElement("style");e.textContent="body {transition: opacity ease-in 0.2s; } \nbody[unresolved] {opacity: 0; display: block; overflow: hidden; position: relative; } \n";var t=document.querySelector("head");t.insertBefore(e,t.firstChild)}(window.WebComponents),function(e){window.Platform=e}(window.WebComponents); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/css-element-queries/Gruntfile.js b/chromium/third_party/catapult/tracing/third_party/css-element-queries/Gruntfile.js
deleted file mode 100644
index 265a0de0fad..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/css-element-queries/Gruntfile.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/* jshint node: true */
-module.exports = function(grunt) {
- 'use strict';
-
- grunt.loadNpmTasks('grunt-bump');
-
- grunt.initConfig({
- bump: {
- options: {
- files: ['package.json', 'bower.json'],
- commitFiles: ['package.json', 'bower.json'],
- pushTo: 'origin'
- }
- }
- });
-};
diff --git a/chromium/third_party/catapult/tracing/third_party/css-element-queries/LICENSE b/chromium/third_party/catapult/tracing/third_party/css-element-queries/LICENSE
deleted file mode 100644
index 4de61dcef7e..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/css-element-queries/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2013 Marc J. Schmidt
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/chromium/third_party/catapult/tracing/third_party/css-element-queries/README.chromium b/chromium/third_party/catapult/tracing/third_party/css-element-queries/README.chromium
deleted file mode 100644
index 5ca52cf7cf4..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/css-element-queries/README.chromium
+++ /dev/null
@@ -1,16 +0,0 @@
-Name: css-element-queries
-Short Name: css-element-queries
-URL: https://github.com/marcj/css-element-queries
-Version: 0.2.1
-Revision: 996d9035b1a13bb6883c181aad742ae45bd74026
-Date: Thu May 28 13:57:31 2015 +0000
-License File: LICENSE
-Security Critical: no
-
-Description:
-ResizeSensor.js calls a callback when an element is resized for any reason.
-
-Local Modifications:
-Made test/index.html conform to the expectations of py_vulcanize:
-up-cased doctype, added 'use strict', downloaded mootools from cloudflare
-and added them to test/.
diff --git a/chromium/third_party/catapult/tracing/third_party/css-element-queries/README.md b/chromium/third_party/catapult/tracing/third_party/css-element-queries/README.md
deleted file mode 100644
index 389225eb002..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/css-element-queries/README.md
+++ /dev/null
@@ -1,74 +0,0 @@
-CSS Element Queries
-===================
-
-Element Queries is a polyfill adding support for element based media-queries to all new browsers (incl. IE7+).
-It allows not only to define media-queries based on window-size but also adds 'media-queries' functionality depending on element (any selector supported)
-size while not causing performance lags due to event based implementation.
-
-It's a proof-of-concept event-based CSS element dimension query with valid CSS selector syntax.
-
-Features:
-
- - no performance issues since it listens only on size changes of elements that have element query rules defined through css. Other element query polifills only listen on `window.onresize` which causes performance issues and allows only to detect changes via window.resize event and not inside layout changes like css3 animation, :hover, DOM changes etc.
- - no interval/timeout detection. Truly event-based through integrated ResizeSensor class.
- - no CSS modifications. Valid CSS Syntax
- - all CSS selectors available. Uses regular attribute selector. No need to write rules in HTML.
- - supports and tested in webkit, gecko and IE(7/8/9/10/11).
- - `min-width`, `min-height`, `max-width` and `max-height` are supported so far
- - works with any layout modifications: HTML (innerHTML etc), inline styles, DOM mutation, CSS3 transitions, fluid layout changes (also percent changes), pseudo classes (:hover etc.), window resizes and more
- - no Javascript-Framework dependency (works with jQuery, Mootools, etc.)
-
-More demos and information: http://marcj.github.io/css-element-queries/
-
-Example
--------
-
-```css
-.widget-name {
- padding: 25px;
-}
-.widget-name[max-width="200px"] {
- padding: 0;
-}
-.widget-name[min-width="500px"] {
- padding: 55px;
-}
-
-/* responsive images */
-.responsive-image img {
- width: 100%;
-}
-
-.responsive-image[max-width^='400px'] img {
- content: url(demo/image-400px.jpg);
-}
-
-.responsive-image[max-width^='1000px'] img {
- content: url(demo/image-1000px.jpg);
-}
-
-.responsive-image[min-width='1000px'] img {
- content: url(demo/image-full.jpg);
-}
-```
-
-Include the javascript files at the bottom and you're good to go. No custom javascript calls needed.
-
-```html
-<script src="src/ResizeSensor.js"></script>
-<script src="src/ElementQueries.js"></script>
-```
-
-Issues
-------
-
- - So far does not work on `img` and other elements that can't contain other elements. Wrapping with a `div` works fine though (See demo).
- - Adds additional hidden elements into selected target element and forces target element to be relative or absolute.
-
-
-[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/marcj/css-element-queries/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
-
-
-License
--------
-MIT license. Copyright [Marc J. Schmidt](http://marcjschmidt.de/).
diff --git a/chromium/third_party/catapult/tracing/third_party/css-element-queries/bower.json b/chromium/third_party/catapult/tracing/third_party/css-element-queries/bower.json
deleted file mode 100644
index 0295673d5d9..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/css-element-queries/bower.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "name": "css-element-queries",
- "version": "0.2.1",
- "main": [
- "./src/ElementQueries.js",
- "./src/ResizeSensor.js"
- ],
- "ignore": [
- "**/.*",
- "_*",
- "Gruntfile.js",
- "composer.json",
- "package.json",
- "*.html"
- ],
- "dependencies": {
- }
-}
-
diff --git a/chromium/third_party/catapult/tracing/third_party/css-element-queries/package.json b/chromium/third_party/catapult/tracing/third_party/css-element-queries/package.json
deleted file mode 100644
index a68c90e9c71..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/css-element-queries/package.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "name": "css-element-queries",
- "version": "0.2.1",
- "description": "CSS-Element-Queries Polyfill. proof-of-concept for high-speed element dimension/media queries in valid css.",
- "main": "src/ElementQueries.js",
- "directories": {
- "test": "test"
- },
- "scripts": {
- "test": "echo \"Error: no test specified\" && exit 1"
- },
- "repository": {
- "type": "git",
- "url": "git@github.com:marcj/css-element-queries.git"
- },
- "author": "Marc J. Schmidt",
- "license": "MIT",
- "bugs": {
- "url": "https://github.com/marcj/css-element-queries/issues"
- },
- "homepage": "https://github.com/marcj/css-element-queries",
- "devDependencies": {
- "grunt": "^0.4.5",
- "grunt-bump": "^0.3.1"
- }
-}
diff --git a/chromium/third_party/catapult/tracing/third_party/css-element-queries/src/ElementQueries.js b/chromium/third_party/catapult/tracing/third_party/css-element-queries/src/ElementQueries.js
deleted file mode 100755
index 3287b8d7a30..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/css-element-queries/src/ElementQueries.js
+++ /dev/null
@@ -1,340 +0,0 @@
-/**
- * Copyright Marc J. Schmidt. See the LICENSE file at the top-level
- * directory of this distribution and at
- * https://github.com/marcj/css-element-queries/blob/master/LICENSE.
- */
-;
-(function() {
- /**
- *
- * @type {Function}
- * @constructor
- */
- var ElementQueries = this.ElementQueries = function() {
-
- this.withTracking = false;
- var elements = [];
-
- /**
- *
- * @param element
- * @returns {Number}
- */
- function getEmSize(element) {
- if (!element) {
- element = document.documentElement;
- }
- var fontSize = getComputedStyle(element, 'fontSize');
- return parseFloat(fontSize) || 16;
- }
-
- /**
- *
- * @copyright https://github.com/Mr0grog/element-query/blob/master/LICENSE
- *
- * @param {HTMLElement} element
- * @param {*} value
- * @returns {*}
- */
- function convertToPx(element, value) {
- var units = value.replace(/[0-9]*/, '');
- value = parseFloat(value);
- switch (units) {
- case "px":
- return value;
- case "em":
- return value * getEmSize(element);
- case "rem":
- return value * getEmSize();
- // Viewport units!
- // According to http://quirksmode.org/mobile/tableViewport.html
- // documentElement.clientWidth/Height gets us the most reliable info
- case "vw":
- return value * document.documentElement.clientWidth / 100;
- case "vh":
- return value * document.documentElement.clientHeight / 100;
- case "vmin":
- case "vmax":
- var vw = document.documentElement.clientWidth / 100;
- var vh = document.documentElement.clientHeight / 100;
- var chooser = Math[units === "vmin" ? "min" : "max"];
- return value * chooser(vw, vh);
- default:
- return value;
- // for now, not supporting physical units (since they are just a set number of px)
- // or ex/ch (getting accurate measurements is hard)
- }
- }
-
- /**
- *
- * @param {HTMLElement} element
- * @constructor
- */
- function SetupInformation(element) {
- this.element = element;
- this.options = {};
- var key, option, width = 0, height = 0, value, actualValue, attrValues, attrValue, attrName;
-
- /**
- * @param {Object} option {mode: 'min|max', property: 'width|height', value: '123px'}
- */
- this.addOption = function(option) {
- var idx = [option.mode, option.property, option.value].join(',');
- this.options[idx] = option;
- };
-
- var attributes = ['min-width', 'min-height', 'max-width', 'max-height'];
-
- /**
- * Extracts the computed width/height and sets to min/max- attribute.
- */
- this.call = function() {
- // extract current dimensions
- width = this.element.offsetWidth;
- height = this.element.offsetHeight;
-
- attrValues = {};
-
- for (key in this.options) {
- if (!this.options.hasOwnProperty(key)){
- continue;
- }
- option = this.options[key];
-
- value = convertToPx(this.element, option.value);
-
- actualValue = option.property == 'width' ? width : height;
- attrName = option.mode + '-' + option.property;
- attrValue = '';
-
- if (option.mode == 'min' && actualValue >= value) {
- attrValue += option.value;
- }
-
- if (option.mode == 'max' && actualValue <= value) {
- attrValue += option.value;
- }
-
- if (!attrValues[attrName]) attrValues[attrName] = '';
- if (attrValue && -1 === (' '+attrValues[attrName]+' ').indexOf(' ' + attrValue + ' ')) {
- attrValues[attrName] += ' ' + attrValue;
- }
- }
-
- for (var k in attributes) {
- if (attrValues[attributes[k]]) {
- this.element.setAttribute(attributes[k], attrValues[attributes[k]].substr(1));
- } else {
- this.element.removeAttribute(attributes[k]);
- }
- }
- };
- }
-
- /**
- * @param {HTMLElement} element
- * @param {Object} options
- */
- function setupElement(element, options) {
- if (element.elementQueriesSetupInformation) {
- element.elementQueriesSetupInformation.addOption(options);
- } else {
- element.elementQueriesSetupInformation = new SetupInformation(element);
- element.elementQueriesSetupInformation.addOption(options);
- element.elementQueriesSensor = new ResizeSensor(element, function() {
- element.elementQueriesSetupInformation.call();
- });
- }
- element.elementQueriesSetupInformation.call();
-
- if (this.withTracking) {
- elements.push(element);
- }
- }
-
- /**
- * @param {String} selector
- * @param {String} mode min|max
- * @param {String} property width|height
- * @param {String} value
- */
- function queueQuery(selector, mode, property, value) {
- var query;
- if (document.querySelectorAll) query = document.querySelectorAll.bind(document);
- if (!query && 'undefined' !== typeof $$) query = $$;
- if (!query && 'undefined' !== typeof jQuery) query = jQuery;
-
- if (!query) {
- throw 'No document.querySelectorAll, jQuery or Mootools\'s $$ found.';
- }
-
- var elements = query(selector);
- for (var i = 0, j = elements.length; i < j; i++) {
- setupElement(elements[i], {
- mode: mode,
- property: property,
- value: value
- });
- }
- }
-
- var regex = /,?([^,\n]*)\[[\s\t]*(min|max)-(width|height)[\s\t]*[~$\^]?=[\s\t]*"([^"]*)"[\s\t]*]([^\n\s\{]*)/mgi;
-
- /**
- * @param {String} css
- */
- function extractQuery(css) {
- var match;
- css = css.replace(/'/g, '"');
- while (null !== (match = regex.exec(css))) {
- if (5 < match.length) {
- queueQuery(match[1] || match[5], match[2], match[3], match[4]);
- }
- }
- }
-
- /**
- * @param {CssRule[]|String} rules
- */
- function readRules(rules) {
- var selector = '';
- if (!rules) {
- return;
- }
- if ('string' === typeof rules) {
- rules = rules.toLowerCase();
- if (-1 !== rules.indexOf('min-width') || -1 !== rules.indexOf('max-width')) {
- extractQuery(rules);
- }
- } else {
- for (var i = 0, j = rules.length; i < j; i++) {
- if (1 === rules[i].type) {
- selector = rules[i].selectorText || rules[i].cssText;
- if (-1 !== selector.indexOf('min-height') || -1 !== selector.indexOf('max-height')) {
- extractQuery(selector);
- }else if(-1 !== selector.indexOf('min-width') || -1 !== selector.indexOf('max-width')) {
- extractQuery(selector);
- }
- } else if (4 === rules[i].type) {
- readRules(rules[i].cssRules || rules[i].rules);
- }
- }
- }
- }
-
- /**
- * Searches all css rules and setups the event listener to all elements with element query rules..
- *
- * @param {Boolean} withTracking allows and requires you to use detach, since we store internally all used elements
- * (no garbage collection possible if you don not call .detach() first)
- */
- this.init = function(withTracking) {
- this.withTracking = withTracking;
- for (var i = 0, j = document.styleSheets.length; i < j; i++) {
- try {
- readRules(document.styleSheets[i].cssText || document.styleSheets[i].cssRules || document.styleSheets[i].rules);
- } catch(e) {
- if (e.name !== 'SecurityError') {
- throw e;
- }
- }
- }
- };
-
- /**
- *
- * @param {Boolean} withTracking allows and requires you to use detach, since we store internally all used elements
- * (no garbage collection possible if you don not call .detach() first)
- */
- this.update = function(withTracking) {
- this.withTracking = withTracking;
- this.init();
- };
-
- this.detach = function() {
- if (!this.withTracking) {
- throw 'withTracking is not enabled. We can not detach elements since we don not store it.' +
- 'Use ElementQueries.withTracking = true; before domready.';
- }
-
- var element;
- while (element = elements.pop()) {
- ElementQueries.detach(element);
- }
-
- elements = [];
- };
- };
-
- /**
- *
- * @param {Boolean} withTracking allows and requires you to use detach, since we store internally all used elements
- * (no garbage collection possible if you don not call .detach() first)
- */
- ElementQueries.update = function(withTracking) {
- ElementQueries.instance.update(withTracking);
- };
-
- /**
- * Removes all sensor and elementquery information from the element.
- *
- * @param {HTMLElement} element
- */
- ElementQueries.detach = function(element) {
- if (element.elementQueriesSetupInformation) {
- element.elementQueriesSensor.detach();
- delete element.elementQueriesSetupInformation;
- delete element.elementQueriesSensor;
- console.log('detached');
- } else {
- console.log('detached already', element);
- }
- };
-
- ElementQueries.withTracking = false;
-
- ElementQueries.init = function() {
- if (!ElementQueries.instance) {
- ElementQueries.instance = new ElementQueries();
- }
-
- ElementQueries.instance.init(ElementQueries.withTracking);
- };
-
- var domLoaded = function (callback) {
- /* Internet Explorer */
- /*@cc_on
- @if (@_win32 || @_win64)
- document.write('<script id="ieScriptLoad" defer src="//:"><\/script>');
- document.getElementById('ieScriptLoad').onreadystatechange = function() {
- if (this.readyState == 'complete') {
- callback();
- }
- };
- @end @*/
- /* Mozilla, Chrome, Opera */
- if (document.addEventListener) {
- document.addEventListener('DOMContentLoaded', callback, false);
- }
- /* Safari, iCab, Konqueror */
- if (/KHTML|WebKit|iCab/i.test(navigator.userAgent)) {
- var DOMLoadTimer = setInterval(function () {
- if (/loaded|complete/i.test(document.readyState)) {
- callback();
- clearInterval(DOMLoadTimer);
- }
- }, 10);
- }
- /* Other web browsers */
- window.onload = callback;
- };
-
- if (window.addEventListener) {
- window.addEventListener('load', ElementQueries.init, false);
- } else {
- window.attachEvent('onload', ElementQueries.init);
- }
- domLoaded(ElementQueries.init);
-
-})();
diff --git a/chromium/third_party/catapult/tracing/third_party/css-element-queries/src/ResizeSensor.js b/chromium/third_party/catapult/tracing/third_party/css-element-queries/src/ResizeSensor.js
deleted file mode 100755
index 687e17d8625..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/css-element-queries/src/ResizeSensor.js
+++ /dev/null
@@ -1,158 +0,0 @@
-/**
- * Copyright Marc J. Schmidt. See the LICENSE file at the top-level
- * directory of this distribution and at
- * https://github.com/marcj/css-element-queries/blob/master/LICENSE.
- */
-;
-(function() {
-
- /**
- * Class for dimension change detection.
- *
- * @param {Element|Element[]|Elements|jQuery} element
- * @param {Function} callback
- *
- * @constructor
- */
- this.ResizeSensor = function(element, callback) {
- /**
- *
- * @constructor
- */
- function EventQueue() {
- this.q = [];
- this.add = function(ev) {
- this.q.push(ev);
- };
-
- var i, j;
- this.call = function() {
- for (i = 0, j = this.q.length; i < j; i++) {
- this.q[i].call();
- }
- };
- }
-
- /**
- * @param {HTMLElement} element
- * @param {String} prop
- * @returns {String|Number}
- */
- function getComputedStyle(element, prop) {
- if (element.currentStyle) {
- return element.currentStyle[prop];
- } else if (window.getComputedStyle) {
- return window.getComputedStyle(element, null).getPropertyValue(prop);
- } else {
- return element.style[prop];
- }
- }
-
- /**
- *
- * @param {HTMLElement} element
- * @param {Function} resized
- */
- function attachResizeEvent(element, resized) {
- if (!element.resizedAttached) {
- element.resizedAttached = new EventQueue();
- element.resizedAttached.add(resized);
- } else if (element.resizedAttached) {
- element.resizedAttached.add(resized);
- return;
- }
-
- element.resizeSensor = document.createElement('div');
- element.resizeSensor.className = 'resize-sensor';
- var style = 'position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: scroll; z-index: -1; visibility: hidden;';
- var styleChild = 'position: absolute; left: 0; top: 0;';
-
- element.resizeSensor.style.cssText = style;
- element.resizeSensor.innerHTML =
- '<div class="resize-sensor-expand" style="' + style + '">' +
- '<div style="' + styleChild + '"></div>' +
- '</div>' +
- '<div class="resize-sensor-shrink" style="' + style + '">' +
- '<div style="' + styleChild + ' width: 200%; height: 200%"></div>' +
- '</div>';
- element.appendChild(element.resizeSensor);
-
- if (!{fixed: 1, absolute: 1}[getComputedStyle(element, 'position')]) {
- element.style.position = 'relative';
- }
-
- var expand = element.resizeSensor.childNodes[0];
- var expandChild = expand.childNodes[0];
- var shrink = element.resizeSensor.childNodes[1];
- var shrinkChild = shrink.childNodes[0];
-
- var lastWidth, lastHeight;
-
- var reset = function() {
- expandChild.style.width = expand.offsetWidth + 10 + 'px';
- expandChild.style.height = expand.offsetHeight + 10 + 'px';
- expand.scrollLeft = expand.scrollWidth;
- expand.scrollTop = expand.scrollHeight;
- shrink.scrollLeft = shrink.scrollWidth;
- shrink.scrollTop = shrink.scrollHeight;
- lastWidth = element.offsetWidth;
- lastHeight = element.offsetHeight;
- };
-
- reset();
-
- var changed = function() {
- if (element.resizedAttached) {
- element.resizedAttached.call();
- }
- };
-
- var addEvent = function(el, name, cb) {
- if (el.attachEvent) {
- el.attachEvent('on' + name, cb);
- } else {
- el.addEventListener(name, cb);
- }
- };
-
- addEvent(expand, 'scroll', function() {
- if (element.offsetWidth > lastWidth || element.offsetHeight > lastHeight) {
- changed();
- }
- reset();
- });
-
- addEvent(shrink, 'scroll',function() {
- if (element.offsetWidth < lastWidth || element.offsetHeight < lastHeight) {
- changed();
- }
- reset();
- });
- }
-
- if ("[object Array]" === Object.prototype.toString.call(element)
- || ('undefined' !== typeof jQuery && element instanceof jQuery) //jquery
- || ('undefined' !== typeof Elements && element instanceof Elements) //mootools
- ) {
- var i = 0, j = element.length;
- for (; i < j; i++) {
- attachResizeEvent(element[i], callback);
- }
- } else {
- attachResizeEvent(element, callback);
- }
-
- this.detach = function() {
- ResizeSensor.detach(element);
- };
- };
-
- this.ResizeSensor.detach = function(element) {
- if (element.resizeSensor) {
- element.removeChild(element.resizeSensor);
- delete element.resizeSensor;
- delete element.resizedAttached;
- }
- };
-
-})(); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/d3/LICENSE b/chromium/third_party/catapult/tracing/third_party/d3/LICENSE
deleted file mode 100644
index fb7d95d70ba..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/d3/LICENSE
+++ /dev/null
@@ -1,26 +0,0 @@
-Copyright (c) 2014, Michael Bostock
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-* The name Michael Bostock may not be used to endorse or promote products
- derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/chromium/third_party/catapult/tracing/third_party/d3/README.chromium b/chromium/third_party/catapult/tracing/third_party/d3/README.chromium
deleted file mode 100644
index 35362f83284..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/d3/README.chromium
+++ /dev/null
@@ -1,15 +0,0 @@
-Name: d3
-Short Name: d3
-URL: https://github.com/mbostock/d3
-Version: 0
-Revision: 0b2fe8fe9eaa529f70f6ab93bc8580b2a5328f43
-Date: Sat Mar 1 11:31:09 2014 -0800
-License: BSD
-License File: NOT_SHIPPED
-Security Critical: no
-
-Description:
-A JavaScript visualization library for HTML and SVG.
-
-Local Modifications:
-Took only the minified JS file and associated license.
diff --git a/chromium/third_party/catapult/tracing/third_party/d3/d3.min.js b/chromium/third_party/catapult/tracing/third_party/d3/d3.min.js
deleted file mode 100644
index b0178b69e86..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/d3/d3.min.js
+++ /dev/null
@@ -1,5 +0,0 @@
-!function(){function n(n){return null!=n&&!isNaN(n)}function t(n){return n.length}function e(n){for(var t=1;n*t%1;)t*=10;return t}function r(n,t){try{for(var e in t)Object.defineProperty(n.prototype,e,{value:t[e],enumerable:!1})}catch(r){n.prototype=t}}function u(){}function i(n){return aa+n in this}function o(n){return n=aa+n,n in this&&delete this[n]}function a(){var n=[];return this.forEach(function(t){n.push(t)}),n}function c(){var n=0;for(var t in this)t.charCodeAt(0)===ca&&++n;return n}function s(){for(var n in this)if(n.charCodeAt(0)===ca)return!1;return!0}function l(){}function f(n,t,e){return function(){var r=e.apply(t,arguments);return r===t?n:r}}function h(n,t){if(t in n)return t;t=t.charAt(0).toUpperCase()+t.substring(1);for(var e=0,r=sa.length;r>e;++e){var u=sa[e]+t;if(u in n)return u}}function g(){}function p(){}function v(n){function t(){for(var t,r=e,u=-1,i=r.length;++u<i;)(t=r[u].on)&&t.apply(this,arguments);return n}var e=[],r=new u;return t.on=function(t,u){var i,o=r.get(t);return arguments.length<2?o&&o.on:(o&&(o.on=null,e=e.slice(0,i=e.indexOf(o)).concat(e.slice(i+1)),r.remove(t)),u&&e.push(r.set(t,{on:u})),n)},t}function d(){Xo.event.preventDefault()}function m(){for(var n,t=Xo.event;n=t.sourceEvent;)t=n;return t}function y(n){for(var t=new p,e=0,r=arguments.length;++e<r;)t[arguments[e]]=v(t);return t.of=function(e,r){return function(u){try{var i=u.sourceEvent=Xo.event;u.target=n,Xo.event=u,t[u.type].apply(e,r)}finally{Xo.event=i}}},t}function x(n){return fa(n,da),n}function M(n){return"function"==typeof n?n:function(){return ha(n,this)}}function _(n){return"function"==typeof n?n:function(){return ga(n,this)}}function b(n,t){function e(){this.removeAttribute(n)}function r(){this.removeAttributeNS(n.space,n.local)}function u(){this.setAttribute(n,t)}function i(){this.setAttributeNS(n.space,n.local,t)}function o(){var e=t.apply(this,arguments);null==e?this.removeAttribute(n):this.setAttribute(n,e)}function a(){var e=t.apply(this,arguments);null==e?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,e)}return n=Xo.ns.qualify(n),null==t?n.local?r:e:"function"==typeof t?n.local?a:o:n.local?i:u}function w(n){return n.trim().replace(/\s+/g," ")}function S(n){return new RegExp("(?:^|\\s+)"+Xo.requote(n)+"(?:\\s+|$)","g")}function k(n){return n.trim().split(/^|\s+/)}function E(n,t){function e(){for(var e=-1;++e<u;)n[e](this,t)}function r(){for(var e=-1,r=t.apply(this,arguments);++e<u;)n[e](this,r)}n=k(n).map(A);var u=n.length;return"function"==typeof t?r:e}function A(n){var t=S(n);return function(e,r){if(u=e.classList)return r?u.add(n):u.remove(n);var u=e.getAttribute("class")||"";r?(t.lastIndex=0,t.test(u)||e.setAttribute("class",w(u+" "+n))):e.setAttribute("class",w(u.replace(t," ")))}}function C(n,t,e){function r(){this.style.removeProperty(n)}function u(){this.style.setProperty(n,t,e)}function i(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(n):this.style.setProperty(n,r,e)}return null==t?r:"function"==typeof t?i:u}function N(n,t){function e(){delete this[n]}function r(){this[n]=t}function u(){var e=t.apply(this,arguments);null==e?delete this[n]:this[n]=e}return null==t?e:"function"==typeof t?u:r}function L(n){return"function"==typeof n?n:(n=Xo.ns.qualify(n)).local?function(){return this.ownerDocument.createElementNS(n.space,n.local)}:function(){return this.ownerDocument.createElementNS(this.namespaceURI,n)}}function T(n){return{__data__:n}}function q(n){return function(){return va(this,n)}}function z(n){return arguments.length||(n=Xo.ascending),function(t,e){return t&&e?n(t.__data__,e.__data__):!t-!e}}function R(n,t){for(var e=0,r=n.length;r>e;e++)for(var u,i=n[e],o=0,a=i.length;a>o;o++)(u=i[o])&&t(u,o,e);return n}function D(n){return fa(n,ya),n}function P(n){var t,e;return function(r,u,i){var o,a=n[i].update,c=a.length;for(i!=e&&(e=i,t=0),u>=t&&(t=u+1);!(o=a[t])&&++t<c;);return o}}function U(){var n=this.__transition__;n&&++n.active}function j(n,t,e){function r(){var t=this[o];t&&(this.removeEventListener(n,t,t.$),delete this[o])}function u(){var u=c(t,Bo(arguments));r.call(this),this.addEventListener(n,this[o]=u,u.$=e),u._=t}function i(){var t,e=new RegExp("^__on([^.]+)"+Xo.requote(n)+"$");for(var r in this)if(t=r.match(e)){var u=this[r];this.removeEventListener(t[1],u,u.$),delete this[r]}}var o="__on"+n,a=n.indexOf("."),c=H;a>0&&(n=n.substring(0,a));var s=Ma.get(n);return s&&(n=s,c=F),a?t?u:r:t?g:i}function H(n,t){return function(e){var r=Xo.event;Xo.event=e,t[0]=this.__data__;try{n.apply(this,t)}finally{Xo.event=r}}}function F(n,t){var e=H(n,t);return function(n){var t=this,r=n.relatedTarget;r&&(r===t||8&r.compareDocumentPosition(t))||e.call(t,n)}}function O(){var n=".dragsuppress-"+ ++ba,t="click"+n,e=Xo.select(Go).on("touchmove"+n,d).on("dragstart"+n,d).on("selectstart"+n,d);if(_a){var r=Jo.style,u=r[_a];r[_a]="none"}return function(i){function o(){e.on(t,null)}e.on(n,null),_a&&(r[_a]=u),i&&(e.on(t,function(){d(),o()},!0),setTimeout(o,0))}}function Y(n,t){t.changedTouches&&(t=t.changedTouches[0]);var e=n.ownerSVGElement||n;if(e.createSVGPoint){var r=e.createSVGPoint();if(0>wa&&(Go.scrollX||Go.scrollY)){e=Xo.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important");var u=e[0][0].getScreenCTM();wa=!(u.f||u.e),e.remove()}return wa?(r.x=t.pageX,r.y=t.pageY):(r.x=t.clientX,r.y=t.clientY),r=r.matrixTransform(n.getScreenCTM().inverse()),[r.x,r.y]}var i=n.getBoundingClientRect();return[t.clientX-i.left-n.clientLeft,t.clientY-i.top-n.clientTop]}function I(n){return n>0?1:0>n?-1:0}function Z(n,t,e){return(t[0]-n[0])*(e[1]-n[1])-(t[1]-n[1])*(e[0]-n[0])}function V(n){return n>1?0:-1>n?Sa:Math.acos(n)}function X(n){return n>1?Ea:-1>n?-Ea:Math.asin(n)}function $(n){return((n=Math.exp(n))-1/n)/2}function B(n){return((n=Math.exp(n))+1/n)/2}function W(n){return((n=Math.exp(2*n))-1)/(n+1)}function J(n){return(n=Math.sin(n/2))*n}function G(){}function K(n,t,e){return new Q(n,t,e)}function Q(n,t,e){this.h=n,this.s=t,this.l=e}function nt(n,t,e){function r(n){return n>360?n-=360:0>n&&(n+=360),60>n?i+(o-i)*n/60:180>n?o:240>n?i+(o-i)*(240-n)/60:i}function u(n){return Math.round(255*r(n))}var i,o;return n=isNaN(n)?0:(n%=360)<0?n+360:n,t=isNaN(t)?0:0>t?0:t>1?1:t,e=0>e?0:e>1?1:e,o=.5>=e?e*(1+t):e+t-e*t,i=2*e-o,gt(u(n+120),u(n),u(n-120))}function tt(n,t,e){return new et(n,t,e)}function et(n,t,e){this.h=n,this.c=t,this.l=e}function rt(n,t,e){return isNaN(n)&&(n=0),isNaN(t)&&(t=0),ut(e,Math.cos(n*=Na)*t,Math.sin(n)*t)}function ut(n,t,e){return new it(n,t,e)}function it(n,t,e){this.l=n,this.a=t,this.b=e}function ot(n,t,e){var r=(n+16)/116,u=r+t/500,i=r-e/200;return u=ct(u)*Fa,r=ct(r)*Oa,i=ct(i)*Ya,gt(lt(3.2404542*u-1.5371385*r-.4985314*i),lt(-.969266*u+1.8760108*r+.041556*i),lt(.0556434*u-.2040259*r+1.0572252*i))}function at(n,t,e){return n>0?tt(Math.atan2(e,t)*La,Math.sqrt(t*t+e*e),n):tt(0/0,0/0,n)}function ct(n){return n>.206893034?n*n*n:(n-4/29)/7.787037}function st(n){return n>.008856?Math.pow(n,1/3):7.787037*n+4/29}function lt(n){return Math.round(255*(.00304>=n?12.92*n:1.055*Math.pow(n,1/2.4)-.055))}function ft(n){return gt(n>>16,255&n>>8,255&n)}function ht(n){return ft(n)+""}function gt(n,t,e){return new pt(n,t,e)}function pt(n,t,e){this.r=n,this.g=t,this.b=e}function vt(n){return 16>n?"0"+Math.max(0,n).toString(16):Math.min(255,n).toString(16)}function dt(n,t,e){var r,u,i,o,a=0,c=0,s=0;if(u=/([a-z]+)\((.*)\)/i.exec(n))switch(i=u[2].split(","),u[1]){case"hsl":return e(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return t(Mt(i[0]),Mt(i[1]),Mt(i[2]))}return(o=Va.get(n))?t(o.r,o.g,o.b):(null!=n&&"#"===n.charAt(0)&&(r=parseInt(n.substring(1),16),isNaN(r)||(4===n.length?(a=(3840&r)>>4,a=a>>4|a,c=240&r,c=c>>4|c,s=15&r,s=s<<4|s):7===n.length&&(a=(16711680&r)>>16,c=(65280&r)>>8,s=255&r))),t(a,c,s))}function mt(n,t,e){var r,u,i=Math.min(n/=255,t/=255,e/=255),o=Math.max(n,t,e),a=o-i,c=(o+i)/2;return a?(u=.5>c?a/(o+i):a/(2-o-i),r=n==o?(t-e)/a+(e>t?6:0):t==o?(e-n)/a+2:(n-t)/a+4,r*=60):(r=0/0,u=c>0&&1>c?0:r),K(r,u,c)}function yt(n,t,e){n=xt(n),t=xt(t),e=xt(e);var r=st((.4124564*n+.3575761*t+.1804375*e)/Fa),u=st((.2126729*n+.7151522*t+.072175*e)/Oa),i=st((.0193339*n+.119192*t+.9503041*e)/Ya);return ut(116*u-16,500*(r-u),200*(u-i))}function xt(n){return(n/=255)<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Mt(n){var t=parseFloat(n);return"%"===n.charAt(n.length-1)?Math.round(2.55*t):t}function _t(n){return"function"==typeof n?n:function(){return n}}function bt(n){return n}function wt(n){return function(t,e,r){return 2===arguments.length&&"function"==typeof e&&(r=e,e=null),St(t,e,n,r)}}function St(n,t,e,r){function u(){var n,t=c.status;if(!t&&c.responseText||t>=200&&300>t||304===t){try{n=e.call(i,c)}catch(r){return o.error.call(i,r),void 0}o.load.call(i,n)}else o.error.call(i,c)}var i={},o=Xo.dispatch("beforesend","progress","load","error"),a={},c=new XMLHttpRequest,s=null;return!Go.XDomainRequest||"withCredentials"in c||!/^(http(s)?:)?\/\//.test(n)||(c=new XDomainRequest),"onload"in c?c.onload=c.onerror=u:c.onreadystatechange=function(){c.readyState>3&&u()},c.onprogress=function(n){var t=Xo.event;Xo.event=n;try{o.progress.call(i,c)}finally{Xo.event=t}},i.header=function(n,t){return n=(n+"").toLowerCase(),arguments.length<2?a[n]:(null==t?delete a[n]:a[n]=t+"",i)},i.mimeType=function(n){return arguments.length?(t=null==n?null:n+"",i):t},i.responseType=function(n){return arguments.length?(s=n,i):s},i.response=function(n){return e=n,i},["get","post"].forEach(function(n){i[n]=function(){return i.send.apply(i,[n].concat(Bo(arguments)))}}),i.send=function(e,r,u){if(2===arguments.length&&"function"==typeof r&&(u=r,r=null),c.open(e,n,!0),null==t||"accept"in a||(a.accept=t+",*/*"),c.setRequestHeader)for(var l in a)c.setRequestHeader(l,a[l]);return null!=t&&c.overrideMimeType&&c.overrideMimeType(t),null!=s&&(c.responseType=s),null!=u&&i.on("error",u).on("load",function(n){u(null,n)}),o.beforesend.call(i,c),c.send(null==r?null:r),i},i.abort=function(){return c.abort(),i},Xo.rebind(i,o,"on"),null==r?i:i.get(kt(r))}function kt(n){return 1===n.length?function(t,e){n(null==t?e:null)}:n}function Et(){var n=At(),t=Ct()-n;t>24?(isFinite(t)&&(clearTimeout(Wa),Wa=setTimeout(Et,t)),Ba=0):(Ba=1,Ga(Et))}function At(){var n=Date.now();for(Ja=Xa;Ja;)n>=Ja.t&&(Ja.f=Ja.c(n-Ja.t)),Ja=Ja.n;return n}function Ct(){for(var n,t=Xa,e=1/0;t;)t.f?t=n?n.n=t.n:Xa=t.n:(t.t<e&&(e=t.t),t=(n=t).n);return $a=n,e}function Nt(n,t){return t-(n?Math.ceil(Math.log(n)/Math.LN10):1)}function Lt(n,t){var e=Math.pow(10,3*oa(8-t));return{scale:t>8?function(n){return n/e}:function(n){return n*e},symbol:n}}function Tt(n){var t=n.decimal,e=n.thousands,r=n.grouping,u=n.currency,i=r?function(n){for(var t=n.length,u=[],i=0,o=r[0];t>0&&o>0;)u.push(n.substring(t-=o,t+o)),o=r[i=(i+1)%r.length];return u.reverse().join(e)}:bt;return function(n){var e=Qa.exec(n),r=e[1]||" ",o=e[2]||">",a=e[3]||"",c=e[4]||"",s=e[5],l=+e[6],f=e[7],h=e[8],g=e[9],p=1,v="",d="",m=!1;switch(h&&(h=+h.substring(1)),(s||"0"===r&&"="===o)&&(s=r="0",o="=",f&&(l-=Math.floor((l-1)/4))),g){case"n":f=!0,g="g";break;case"%":p=100,d="%",g="f";break;case"p":p=100,d="%",g="r";break;case"b":case"o":case"x":case"X":"#"===c&&(v="0"+g.toLowerCase());case"c":case"d":m=!0,h=0;break;case"s":p=-1,g="r"}"$"===c&&(v=u[0],d=u[1]),"r"!=g||h||(g="g"),null!=h&&("g"==g?h=Math.max(1,Math.min(21,h)):("e"==g||"f"==g)&&(h=Math.max(0,Math.min(20,h)))),g=nc.get(g)||qt;var y=s&&f;return function(n){var e=d;if(m&&n%1)return"";var u=0>n||0===n&&0>1/n?(n=-n,"-"):a;if(0>p){var c=Xo.formatPrefix(n,h);n=c.scale(n),e=c.symbol+d}else n*=p;n=g(n,h);var x=n.lastIndexOf("."),M=0>x?n:n.substring(0,x),_=0>x?"":t+n.substring(x+1);!s&&f&&(M=i(M));var b=v.length+M.length+_.length+(y?0:u.length),w=l>b?new Array(b=l-b+1).join(r):"";return y&&(M=i(w+M)),u+=v,n=M+_,("<"===o?u+n+w:">"===o?w+u+n:"^"===o?w.substring(0,b>>=1)+u+n+w.substring(b):u+(y?n:w+n))+e}}}function qt(n){return n+""}function zt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Rt(n,t,e){function r(t){var e=n(t),r=i(e,1);return r-t>t-e?e:r}function u(e){return t(e=n(new ec(e-1)),1),e}function i(n,e){return t(n=new ec(+n),e),n}function o(n,r,i){var o=u(n),a=[];if(i>1)for(;r>o;)e(o)%i||a.push(new Date(+o)),t(o,1);else for(;r>o;)a.push(new Date(+o)),t(o,1);return a}function a(n,t,e){try{ec=zt;var r=new zt;return r._=n,o(r,t,e)}finally{ec=Date}}n.floor=n,n.round=r,n.ceil=u,n.offset=i,n.range=o;var c=n.utc=Dt(n);return c.floor=c,c.round=Dt(r),c.ceil=Dt(u),c.offset=Dt(i),c.range=a,n}function Dt(n){return function(t,e){try{ec=zt;var r=new zt;return r._=t,n(r,e)._}finally{ec=Date}}}function Pt(n){function t(n){function t(t){for(var e,u,i,o=[],a=-1,c=0;++a<r;)37===n.charCodeAt(a)&&(o.push(n.substring(c,a)),null!=(u=uc[e=n.charAt(++a)])&&(e=n.charAt(++a)),(i=C[e])&&(e=i(t,null==u?"e"===e?" ":"0":u)),o.push(e),c=a+1);return o.push(n.substring(c,a)),o.join("")}var r=n.length;return t.parse=function(t){var r={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null},u=e(r,n,t,0);if(u!=t.length)return null;"p"in r&&(r.H=r.H%12+12*r.p);var i=null!=r.Z&&ec!==zt,o=new(i?zt:ec);return"j"in r?o.setFullYear(r.y,0,r.j):"w"in r&&("W"in r||"U"in r)?(o.setFullYear(r.y,0,1),o.setFullYear(r.y,0,"W"in r?(r.w+6)%7+7*r.W-(o.getDay()+5)%7:r.w+7*r.U-(o.getDay()+6)%7)):o.setFullYear(r.y,r.m,r.d),o.setHours(r.H+Math.floor(r.Z/100),r.M+r.Z%100,r.S,r.L),i?o._:o},t.toString=function(){return n},t}function e(n,t,e,r){for(var u,i,o,a=0,c=t.length,s=e.length;c>a;){if(r>=s)return-1;if(u=t.charCodeAt(a++),37===u){if(o=t.charAt(a++),i=N[o in uc?t.charAt(a++):o],!i||(r=i(n,e,r))<0)return-1}else if(u!=e.charCodeAt(r++))return-1}return r}function r(n,t,e){b.lastIndex=0;var r=b.exec(t.substring(e));return r?(n.w=w.get(r[0].toLowerCase()),e+r[0].length):-1}function u(n,t,e){M.lastIndex=0;var r=M.exec(t.substring(e));return r?(n.w=_.get(r[0].toLowerCase()),e+r[0].length):-1}function i(n,t,e){E.lastIndex=0;var r=E.exec(t.substring(e));return r?(n.m=A.get(r[0].toLowerCase()),e+r[0].length):-1}function o(n,t,e){S.lastIndex=0;var r=S.exec(t.substring(e));return r?(n.m=k.get(r[0].toLowerCase()),e+r[0].length):-1}function a(n,t,r){return e(n,C.c.toString(),t,r)}function c(n,t,r){return e(n,C.x.toString(),t,r)}function s(n,t,r){return e(n,C.X.toString(),t,r)}function l(n,t,e){var r=x.get(t.substring(e,e+=2).toLowerCase());return null==r?-1:(n.p=r,e)}var f=n.dateTime,h=n.date,g=n.time,p=n.periods,v=n.days,d=n.shortDays,m=n.months,y=n.shortMonths;t.utc=function(n){function e(n){try{ec=zt;var t=new ec;return t._=n,r(t)}finally{ec=Date}}var r=t(n);return e.parse=function(n){try{ec=zt;var t=r.parse(n);return t&&t._}finally{ec=Date}},e.toString=r.toString,e},t.multi=t.utc.multi=ee;var x=Xo.map(),M=jt(v),_=Ht(v),b=jt(d),w=Ht(d),S=jt(m),k=Ht(m),E=jt(y),A=Ht(y);p.forEach(function(n,t){x.set(n.toLowerCase(),t)});var C={a:function(n){return d[n.getDay()]},A:function(n){return v[n.getDay()]},b:function(n){return y[n.getMonth()]},B:function(n){return m[n.getMonth()]},c:t(f),d:function(n,t){return Ut(n.getDate(),t,2)},e:function(n,t){return Ut(n.getDate(),t,2)},H:function(n,t){return Ut(n.getHours(),t,2)},I:function(n,t){return Ut(n.getHours()%12||12,t,2)},j:function(n,t){return Ut(1+tc.dayOfYear(n),t,3)},L:function(n,t){return Ut(n.getMilliseconds(),t,3)},m:function(n,t){return Ut(n.getMonth()+1,t,2)},M:function(n,t){return Ut(n.getMinutes(),t,2)},p:function(n){return p[+(n.getHours()>=12)]},S:function(n,t){return Ut(n.getSeconds(),t,2)},U:function(n,t){return Ut(tc.sundayOfYear(n),t,2)},w:function(n){return n.getDay()},W:function(n,t){return Ut(tc.mondayOfYear(n),t,2)},x:t(h),X:t(g),y:function(n,t){return Ut(n.getFullYear()%100,t,2)},Y:function(n,t){return Ut(n.getFullYear()%1e4,t,4)},Z:ne,"%":function(){return"%"}},N={a:r,A:u,b:i,B:o,c:a,d:Bt,e:Bt,H:Jt,I:Jt,j:Wt,L:Qt,m:$t,M:Gt,p:l,S:Kt,U:Ot,w:Ft,W:Yt,x:c,X:s,y:Zt,Y:It,Z:Vt,"%":te};return t}function Ut(n,t,e){var r=0>n?"-":"",u=(r?-n:n)+"",i=u.length;return r+(e>i?new Array(e-i+1).join(t)+u:u)}function jt(n){return new RegExp("^(?:"+n.map(Xo.requote).join("|")+")","i")}function Ht(n){for(var t=new u,e=-1,r=n.length;++e<r;)t.set(n[e].toLowerCase(),e);return t}function Ft(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+1));return r?(n.w=+r[0],e+r[0].length):-1}function Ot(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e));return r?(n.U=+r[0],e+r[0].length):-1}function Yt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e));return r?(n.W=+r[0],e+r[0].length):-1}function It(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+4));return r?(n.y=+r[0],e+r[0].length):-1}function Zt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+2));return r?(n.y=Xt(+r[0]),e+r[0].length):-1}function Vt(n,t,e){return/^[+-]\d{4}$/.test(t=t.substring(e,e+5))?(n.Z=+t,e+5):-1}function Xt(n){return n+(n>68?1900:2e3)}function $t(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+2));return r?(n.m=r[0]-1,e+r[0].length):-1}function Bt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+2));return r?(n.d=+r[0],e+r[0].length):-1}function Wt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+3));return r?(n.j=+r[0],e+r[0].length):-1}function Jt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+2));return r?(n.H=+r[0],e+r[0].length):-1}function Gt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+2));return r?(n.M=+r[0],e+r[0].length):-1}function Kt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+2));return r?(n.S=+r[0],e+r[0].length):-1}function Qt(n,t,e){ic.lastIndex=0;var r=ic.exec(t.substring(e,e+3));return r?(n.L=+r[0],e+r[0].length):-1}function ne(n){var t=n.getTimezoneOffset(),e=t>0?"-":"+",r=~~(oa(t)/60),u=oa(t)%60;return e+Ut(r,"0",2)+Ut(u,"0",2)}function te(n,t,e){oc.lastIndex=0;var r=oc.exec(t.substring(e,e+1));return r?e+r[0].length:-1}function ee(n){for(var t=n.length,e=-1;++e<t;)n[e][0]=this(n[e][0]);return function(t){for(var e=0,r=n[e];!r[1](t);)r=n[++e];return r[0](t)}}function re(){}function ue(n,t,e){var r=e.s=n+t,u=r-n,i=r-u;e.t=n-i+(t-u)}function ie(n,t){n&&lc.hasOwnProperty(n.type)&&lc[n.type](n,t)}function oe(n,t,e){var r,u=-1,i=n.length-e;for(t.lineStart();++u<i;)r=n[u],t.point(r[0],r[1],r[2]);t.lineEnd()}function ae(n,t){var e=-1,r=n.length;for(t.polygonStart();++e<r;)oe(n[e],t,1);t.polygonEnd()}function ce(){function n(n,t){n*=Na,t=t*Na/2+Sa/4;var e=n-r,o=e>=0?1:-1,a=o*e,c=Math.cos(t),s=Math.sin(t),l=i*s,f=u*c+l*Math.cos(a),h=l*o*Math.sin(a);hc.add(Math.atan2(h,f)),r=n,u=c,i=s}var t,e,r,u,i;gc.point=function(o,a){gc.point=n,r=(t=o)*Na,u=Math.cos(a=(e=a)*Na/2+Sa/4),i=Math.sin(a)},gc.lineEnd=function(){n(t,e)}}function se(n){var t=n[0],e=n[1],r=Math.cos(e);return[r*Math.cos(t),r*Math.sin(t),Math.sin(e)]}function le(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]}function fe(n,t){return[n[1]*t[2]-n[2]*t[1],n[2]*t[0]-n[0]*t[2],n[0]*t[1]-n[1]*t[0]]}function he(n,t){n[0]+=t[0],n[1]+=t[1],n[2]+=t[2]}function ge(n,t){return[n[0]*t,n[1]*t,n[2]*t]}function pe(n){var t=Math.sqrt(n[0]*n[0]+n[1]*n[1]+n[2]*n[2]);n[0]/=t,n[1]/=t,n[2]/=t}function ve(n){return[Math.atan2(n[1],n[0]),X(n[2])]}function de(n,t){return oa(n[0]-t[0])<Aa&&oa(n[1]-t[1])<Aa}function me(n,t){n*=Na;var e=Math.cos(t*=Na);ye(e*Math.cos(n),e*Math.sin(n),Math.sin(t))}function ye(n,t,e){++pc,dc+=(n-dc)/pc,mc+=(t-mc)/pc,yc+=(e-yc)/pc}function xe(){function n(n,u){n*=Na;var i=Math.cos(u*=Na),o=i*Math.cos(n),a=i*Math.sin(n),c=Math.sin(u),s=Math.atan2(Math.sqrt((s=e*c-r*a)*s+(s=r*o-t*c)*s+(s=t*a-e*o)*s),t*o+e*a+r*c);vc+=s,xc+=s*(t+(t=o)),Mc+=s*(e+(e=a)),_c+=s*(r+(r=c)),ye(t,e,r)}var t,e,r;kc.point=function(u,i){u*=Na;var o=Math.cos(i*=Na);t=o*Math.cos(u),e=o*Math.sin(u),r=Math.sin(i),kc.point=n,ye(t,e,r)}}function Me(){kc.point=me}function _e(){function n(n,t){n*=Na;var e=Math.cos(t*=Na),o=e*Math.cos(n),a=e*Math.sin(n),c=Math.sin(t),s=u*c-i*a,l=i*o-r*c,f=r*a-u*o,h=Math.sqrt(s*s+l*l+f*f),g=r*o+u*a+i*c,p=h&&-V(g)/h,v=Math.atan2(h,g);bc+=p*s,wc+=p*l,Sc+=p*f,vc+=v,xc+=v*(r+(r=o)),Mc+=v*(u+(u=a)),_c+=v*(i+(i=c)),ye(r,u,i)}var t,e,r,u,i;kc.point=function(o,a){t=o,e=a,kc.point=n,o*=Na;var c=Math.cos(a*=Na);r=c*Math.cos(o),u=c*Math.sin(o),i=Math.sin(a),ye(r,u,i)},kc.lineEnd=function(){n(t,e),kc.lineEnd=Me,kc.point=me}}function be(){return!0}function we(n,t,e,r,u){var i=[],o=[];if(n.forEach(function(n){if(!((t=n.length-1)<=0)){var t,e=n[0],r=n[t];if(de(e,r)){u.lineStart();for(var a=0;t>a;++a)u.point((e=n[a])[0],e[1]);return u.lineEnd(),void 0}var c=new ke(e,n,null,!0),s=new ke(e,null,c,!1);c.o=s,i.push(c),o.push(s),c=new ke(r,n,null,!1),s=new ke(r,null,c,!0),c.o=s,i.push(c),o.push(s)}}),o.sort(t),Se(i),Se(o),i.length){for(var a=0,c=e,s=o.length;s>a;++a)o[a].e=c=!c;for(var l,f,h=i[0];;){for(var g=h,p=!0;g.v;)if((g=g.n)===h)return;l=g.z,u.lineStart();do{if(g.v=g.o.v=!0,g.e){if(p)for(var a=0,s=l.length;s>a;++a)u.point((f=l[a])[0],f[1]);else r(g.x,g.n.x,1,u);g=g.n}else{if(p){l=g.p.z;for(var a=l.length-1;a>=0;--a)u.point((f=l[a])[0],f[1])}else r(g.x,g.p.x,-1,u);g=g.p}g=g.o,l=g.z,p=!p}while(!g.v);u.lineEnd()}}}function Se(n){if(t=n.length){for(var t,e,r=0,u=n[0];++r<t;)u.n=e=n[r],e.p=u,u=e;u.n=e=n[0],e.p=u}}function ke(n,t,e,r){this.x=n,this.z=t,this.o=e,this.e=r,this.v=!1,this.n=this.p=null}function Ee(n,t,e,r){return function(u,i){function o(t,e){var r=u(t,e);n(t=r[0],e=r[1])&&i.point(t,e)}function a(n,t){var e=u(n,t);d.point(e[0],e[1])}function c(){y.point=a,d.lineStart()}function s(){y.point=o,d.lineEnd()}function l(n,t){v.push([n,t]);var e=u(n,t);M.point(e[0],e[1])}function f(){M.lineStart(),v=[]}function h(){l(v[0][0],v[0][1]),M.lineEnd();var n,t=M.clean(),e=x.buffer(),r=e.length;if(v.pop(),p.push(v),v=null,r){if(1&t){n=e[0];var u,r=n.length-1,o=-1;for(i.lineStart();++o<r;)i.point((u=n[o])[0],u[1]);return i.lineEnd(),void 0}r>1&&2&t&&e.push(e.pop().concat(e.shift())),g.push(e.filter(Ae))}}var g,p,v,d=t(i),m=u.invert(r[0],r[1]),y={point:o,lineStart:c,lineEnd:s,polygonStart:function(){y.point=l,y.lineStart=f,y.lineEnd=h,g=[],p=[],i.polygonStart()},polygonEnd:function(){y.point=o,y.lineStart=c,y.lineEnd=s,g=Xo.merge(g);var n=Le(m,p);g.length?we(g,Ne,n,e,i):n&&(i.lineStart(),e(null,null,1,i),i.lineEnd()),i.polygonEnd(),g=p=null},sphere:function(){i.polygonStart(),i.lineStart(),e(null,null,1,i),i.lineEnd(),i.polygonEnd()}},x=Ce(),M=t(x);return y}}function Ae(n){return n.length>1}function Ce(){var n,t=[];return{lineStart:function(){t.push(n=[])},point:function(t,e){n.push([t,e])},lineEnd:g,buffer:function(){var e=t;return t=[],n=null,e},rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))}}}function Ne(n,t){return((n=n.x)[0]<0?n[1]-Ea-Aa:Ea-n[1])-((t=t.x)[0]<0?t[1]-Ea-Aa:Ea-t[1])}function Le(n,t){var e=n[0],r=n[1],u=[Math.sin(e),-Math.cos(e),0],i=0,o=0;hc.reset();for(var a=0,c=t.length;c>a;++a){var s=t[a],l=s.length;if(l)for(var f=s[0],h=f[0],g=f[1]/2+Sa/4,p=Math.sin(g),v=Math.cos(g),d=1;;){d===l&&(d=0),n=s[d];var m=n[0],y=n[1]/2+Sa/4,x=Math.sin(y),M=Math.cos(y),_=m-h,b=_>=0?1:-1,w=b*_,S=w>Sa,k=p*x;if(hc.add(Math.atan2(k*b*Math.sin(w),v*M+k*Math.cos(w))),i+=S?_+b*ka:_,S^h>=e^m>=e){var E=fe(se(f),se(n));pe(E);var A=fe(u,E);pe(A);var C=(S^_>=0?-1:1)*X(A[2]);(r>C||r===C&&(E[0]||E[1]))&&(o+=S^_>=0?1:-1)}if(!d++)break;h=m,p=x,v=M,f=n}}return(-Aa>i||Aa>i&&0>hc)^1&o}function Te(n){var t,e=0/0,r=0/0,u=0/0;return{lineStart:function(){n.lineStart(),t=1},point:function(i,o){var a=i>0?Sa:-Sa,c=oa(i-e);oa(c-Sa)<Aa?(n.point(e,r=(r+o)/2>0?Ea:-Ea),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(a,r),n.point(i,r),t=0):u!==a&&c>=Sa&&(oa(e-u)<Aa&&(e-=u*Aa),oa(i-a)<Aa&&(i-=a*Aa),r=qe(e,r,i,o),n.point(u,r),n.lineEnd(),n.lineStart(),n.point(a,r),t=0),n.point(e=i,r=o),u=a},lineEnd:function(){n.lineEnd(),e=r=0/0},clean:function(){return 2-t}}}function qe(n,t,e,r){var u,i,o=Math.sin(n-e);return oa(o)>Aa?Math.atan((Math.sin(t)*(i=Math.cos(r))*Math.sin(e)-Math.sin(r)*(u=Math.cos(t))*Math.sin(n))/(u*i*o)):(t+r)/2}function ze(n,t,e,r){var u;if(null==n)u=e*Ea,r.point(-Sa,u),r.point(0,u),r.point(Sa,u),r.point(Sa,0),r.point(Sa,-u),r.point(0,-u),r.point(-Sa,-u),r.point(-Sa,0),r.point(-Sa,u);else if(oa(n[0]-t[0])>Aa){var i=n[0]<t[0]?Sa:-Sa;u=e*i/2,r.point(-i,u),r.point(0,u),r.point(i,u)}else r.point(t[0],t[1])}function Re(n){function t(n,t){return Math.cos(n)*Math.cos(t)>i}function e(n){var e,i,c,s,l;return{lineStart:function(){s=c=!1,l=1},point:function(f,h){var g,p=[f,h],v=t(f,h),d=o?v?0:u(f,h):v?u(f+(0>f?Sa:-Sa),h):0;if(!e&&(s=c=v)&&n.lineStart(),v!==c&&(g=r(e,p),(de(e,g)||de(p,g))&&(p[0]+=Aa,p[1]+=Aa,v=t(p[0],p[1]))),v!==c)l=0,v?(n.lineStart(),g=r(p,e),n.point(g[0],g[1])):(g=r(e,p),n.point(g[0],g[1]),n.lineEnd()),e=g;else if(a&&e&&o^v){var m;d&i||!(m=r(p,e,!0))||(l=0,o?(n.lineStart(),n.point(m[0][0],m[0][1]),n.point(m[1][0],m[1][1]),n.lineEnd()):(n.point(m[1][0],m[1][1]),n.lineEnd(),n.lineStart(),n.point(m[0][0],m[0][1])))}!v||e&&de(e,p)||n.point(p[0],p[1]),e=p,c=v,i=d},lineEnd:function(){c&&n.lineEnd(),e=null},clean:function(){return l|(s&&c)<<1}}}function r(n,t,e){var r=se(n),u=se(t),o=[1,0,0],a=fe(r,u),c=le(a,a),s=a[0],l=c-s*s;if(!l)return!e&&n;var f=i*c/l,h=-i*s/l,g=fe(o,a),p=ge(o,f),v=ge(a,h);he(p,v);var d=g,m=le(p,d),y=le(d,d),x=m*m-y*(le(p,p)-1);if(!(0>x)){var M=Math.sqrt(x),_=ge(d,(-m-M)/y);if(he(_,p),_=ve(_),!e)return _;var b,w=n[0],S=t[0],k=n[1],E=t[1];w>S&&(b=w,w=S,S=b);var A=S-w,C=oa(A-Sa)<Aa,N=C||Aa>A;if(!C&&k>E&&(b=k,k=E,E=b),N?C?k+E>0^_[1]<(oa(_[0]-w)<Aa?k:E):k<=_[1]&&_[1]<=E:A>Sa^(w<=_[0]&&_[0]<=S)){var L=ge(d,(-m+M)/y);return he(L,p),[_,ve(L)]}}}function u(t,e){var r=o?n:Sa-n,u=0;return-r>t?u|=1:t>r&&(u|=2),-r>e?u|=4:e>r&&(u|=8),u}var i=Math.cos(n),o=i>0,a=oa(i)>Aa,c=cr(n,6*Na);return Ee(t,e,c,o?[0,-n]:[-Sa,n-Sa])}function De(n,t,e,r){return function(u){var i,o=u.a,a=u.b,c=o.x,s=o.y,l=a.x,f=a.y,h=0,g=1,p=l-c,v=f-s;if(i=n-c,p||!(i>0)){if(i/=p,0>p){if(h>i)return;g>i&&(g=i)}else if(p>0){if(i>g)return;i>h&&(h=i)}if(i=e-c,p||!(0>i)){if(i/=p,0>p){if(i>g)return;i>h&&(h=i)}else if(p>0){if(h>i)return;g>i&&(g=i)}if(i=t-s,v||!(i>0)){if(i/=v,0>v){if(h>i)return;g>i&&(g=i)}else if(v>0){if(i>g)return;i>h&&(h=i)}if(i=r-s,v||!(0>i)){if(i/=v,0>v){if(i>g)return;i>h&&(h=i)}else if(v>0){if(h>i)return;g>i&&(g=i)}return h>0&&(u.a={x:c+h*p,y:s+h*v}),1>g&&(u.b={x:c+g*p,y:s+g*v}),u}}}}}}function Pe(n,t,e,r){function u(r,u){return oa(r[0]-n)<Aa?u>0?0:3:oa(r[0]-e)<Aa?u>0?2:1:oa(r[1]-t)<Aa?u>0?1:0:u>0?3:2}function i(n,t){return o(n.x,t.x)}function o(n,t){var e=u(n,1),r=u(t,1);return e!==r?e-r:0===e?t[1]-n[1]:1===e?n[0]-t[0]:2===e?n[1]-t[1]:t[0]-n[0]}return function(a){function c(n){for(var t=0,e=d.length,r=n[1],u=0;e>u;++u)for(var i,o=1,a=d[u],c=a.length,s=a[0];c>o;++o)i=a[o],s[1]<=r?i[1]>r&&Z(s,i,n)>0&&++t:i[1]<=r&&Z(s,i,n)<0&&--t,s=i;return 0!==t}function s(i,a,c,s){var l=0,f=0;if(null==i||(l=u(i,c))!==(f=u(a,c))||o(i,a)<0^c>0){do s.point(0===l||3===l?n:e,l>1?r:t);while((l=(l+c+4)%4)!==f)}else s.point(a[0],a[1])}function l(u,i){return u>=n&&e>=u&&i>=t&&r>=i}function f(n,t){l(n,t)&&a.point(n,t)}function h(){N.point=p,d&&d.push(m=[]),S=!0,w=!1,_=b=0/0}function g(){v&&(p(y,x),M&&w&&A.rejoin(),v.push(A.buffer())),N.point=f,w&&a.lineEnd()}function p(n,t){n=Math.max(-Ac,Math.min(Ac,n)),t=Math.max(-Ac,Math.min(Ac,t));var e=l(n,t);if(d&&m.push([n,t]),S)y=n,x=t,M=e,S=!1,e&&(a.lineStart(),a.point(n,t));else if(e&&w)a.point(n,t);else{var r={a:{x:_,y:b},b:{x:n,y:t}};C(r)?(w||(a.lineStart(),a.point(r.a.x,r.a.y)),a.point(r.b.x,r.b.y),e||a.lineEnd(),k=!1):e&&(a.lineStart(),a.point(n,t),k=!1)}_=n,b=t,w=e}var v,d,m,y,x,M,_,b,w,S,k,E=a,A=Ce(),C=De(n,t,e,r),N={point:f,lineStart:h,lineEnd:g,polygonStart:function(){a=A,v=[],d=[],k=!0},polygonEnd:function(){a=E,v=Xo.merge(v);var t=c([n,r]),e=k&&t,u=v.length;(e||u)&&(a.polygonStart(),e&&(a.lineStart(),s(null,null,1,a),a.lineEnd()),u&&we(v,i,t,s,a),a.polygonEnd()),v=d=m=null}};return N}}function Ue(n,t){function e(e,r){return e=n(e,r),t(e[0],e[1])}return n.invert&&t.invert&&(e.invert=function(e,r){return e=t.invert(e,r),e&&n.invert(e[0],e[1])}),e}function je(n){var t=0,e=Sa/3,r=nr(n),u=r(t,e);return u.parallels=function(n){return arguments.length?r(t=n[0]*Sa/180,e=n[1]*Sa/180):[180*(t/Sa),180*(e/Sa)]},u}function He(n,t){function e(n,t){var e=Math.sqrt(i-2*u*Math.sin(t))/u;return[e*Math.sin(n*=u),o-e*Math.cos(n)]}var r=Math.sin(n),u=(r+Math.sin(t))/2,i=1+r*(2*u-r),o=Math.sqrt(i)/u;return e.invert=function(n,t){var e=o-t;return[Math.atan2(n,e)/u,X((i-(n*n+e*e)*u*u)/(2*u))]},e}function Fe(){function n(n,t){Nc+=u*n-r*t,r=n,u=t}var t,e,r,u;Rc.point=function(i,o){Rc.point=n,t=r=i,e=u=o},Rc.lineEnd=function(){n(t,e)}}function Oe(n,t){Lc>n&&(Lc=n),n>qc&&(qc=n),Tc>t&&(Tc=t),t>zc&&(zc=t)}function Ye(){function n(n,t){o.push("M",n,",",t,i)}function t(n,t){o.push("M",n,",",t),a.point=e}function e(n,t){o.push("L",n,",",t)}function r(){a.point=n}function u(){o.push("Z")}var i=Ie(4.5),o=[],a={point:n,lineStart:function(){a.point=t},lineEnd:r,polygonStart:function(){a.lineEnd=u},polygonEnd:function(){a.lineEnd=r,a.point=n},pointRadius:function(n){return i=Ie(n),a},result:function(){if(o.length){var n=o.join("");return o=[],n}}};return a}function Ie(n){return"m0,"+n+"a"+n+","+n+" 0 1,1 0,"+-2*n+"a"+n+","+n+" 0 1,1 0,"+2*n+"z"}function Ze(n,t){dc+=n,mc+=t,++yc}function Ve(){function n(n,r){var u=n-t,i=r-e,o=Math.sqrt(u*u+i*i);xc+=o*(t+n)/2,Mc+=o*(e+r)/2,_c+=o,Ze(t=n,e=r)}var t,e;Pc.point=function(r,u){Pc.point=n,Ze(t=r,e=u)}}function Xe(){Pc.point=Ze}function $e(){function n(n,t){var e=n-r,i=t-u,o=Math.sqrt(e*e+i*i);xc+=o*(r+n)/2,Mc+=o*(u+t)/2,_c+=o,o=u*n-r*t,bc+=o*(r+n),wc+=o*(u+t),Sc+=3*o,Ze(r=n,u=t)}var t,e,r,u;Pc.point=function(i,o){Pc.point=n,Ze(t=r=i,e=u=o)},Pc.lineEnd=function(){n(t,e)}}function Be(n){function t(t,e){n.moveTo(t,e),n.arc(t,e,o,0,ka)}function e(t,e){n.moveTo(t,e),a.point=r}function r(t,e){n.lineTo(t,e)}function u(){a.point=t}function i(){n.closePath()}var o=4.5,a={point:t,lineStart:function(){a.point=e},lineEnd:u,polygonStart:function(){a.lineEnd=i},polygonEnd:function(){a.lineEnd=u,a.point=t},pointRadius:function(n){return o=n,a},result:g};return a}function We(n){function t(n){return(a?r:e)(n)}function e(t){return Ke(t,function(e,r){e=n(e,r),t.point(e[0],e[1])})}function r(t){function e(e,r){e=n(e,r),t.point(e[0],e[1])}function r(){x=0/0,S.point=i,t.lineStart()}function i(e,r){var i=se([e,r]),o=n(e,r);u(x,M,y,_,b,w,x=o[0],M=o[1],y=e,_=i[0],b=i[1],w=i[2],a,t),t.point(x,M)}function o(){S.point=e,t.lineEnd()}function c(){r(),S.point=s,S.lineEnd=l}function s(n,t){i(f=n,h=t),g=x,p=M,v=_,d=b,m=w,S.point=i}function l(){u(x,M,y,_,b,w,g,p,f,v,d,m,a,t),S.lineEnd=o,o()}var f,h,g,p,v,d,m,y,x,M,_,b,w,S={point:e,lineStart:r,lineEnd:o,polygonStart:function(){t.polygonStart(),S.lineStart=c},polygonEnd:function(){t.polygonEnd(),S.lineStart=r}};return S}function u(t,e,r,a,c,s,l,f,h,g,p,v,d,m){var y=l-t,x=f-e,M=y*y+x*x;if(M>4*i&&d--){var _=a+g,b=c+p,w=s+v,S=Math.sqrt(_*_+b*b+w*w),k=Math.asin(w/=S),E=oa(oa(w)-1)<Aa||oa(r-h)<Aa?(r+h)/2:Math.atan2(b,_),A=n(E,k),C=A[0],N=A[1],L=C-t,T=N-e,q=x*L-y*T;(q*q/M>i||oa((y*L+x*T)/M-.5)>.3||o>a*g+c*p+s*v)&&(u(t,e,r,a,c,s,C,N,E,_/=S,b/=S,w,d,m),m.point(C,N),u(C,N,E,_,b,w,l,f,h,g,p,v,d,m))}}var i=.5,o=Math.cos(30*Na),a=16;return t.precision=function(n){return arguments.length?(a=(i=n*n)>0&&16,t):Math.sqrt(i)},t}function Je(n){var t=We(function(t,e){return n([t*La,e*La])});return function(n){return tr(t(n))}}function Ge(n){this.stream=n}function Ke(n,t){return{point:t,sphere:function(){n.sphere()},lineStart:function(){n.lineStart()},lineEnd:function(){n.lineEnd()},polygonStart:function(){n.polygonStart()},polygonEnd:function(){n.polygonEnd()}}}function Qe(n){return nr(function(){return n})()}function nr(n){function t(n){return n=a(n[0]*Na,n[1]*Na),[n[0]*h+c,s-n[1]*h]}function e(n){return n=a.invert((n[0]-c)/h,(s-n[1])/h),n&&[n[0]*La,n[1]*La]}function r(){a=Ue(o=ur(m,y,x),i);var n=i(v,d);return c=g-n[0]*h,s=p+n[1]*h,u()}function u(){return l&&(l.valid=!1,l=null),t}var i,o,a,c,s,l,f=We(function(n,t){return n=i(n,t),[n[0]*h+c,s-n[1]*h]}),h=150,g=480,p=250,v=0,d=0,m=0,y=0,x=0,M=Ec,_=bt,b=null,w=null;return t.stream=function(n){return l&&(l.valid=!1),l=tr(M(o,f(_(n)))),l.valid=!0,l},t.clipAngle=function(n){return arguments.length?(M=null==n?(b=n,Ec):Re((b=+n)*Na),u()):b
-},t.clipExtent=function(n){return arguments.length?(w=n,_=n?Pe(n[0][0],n[0][1],n[1][0],n[1][1]):bt,u()):w},t.scale=function(n){return arguments.length?(h=+n,r()):h},t.translate=function(n){return arguments.length?(g=+n[0],p=+n[1],r()):[g,p]},t.center=function(n){return arguments.length?(v=n[0]%360*Na,d=n[1]%360*Na,r()):[v*La,d*La]},t.rotate=function(n){return arguments.length?(m=n[0]%360*Na,y=n[1]%360*Na,x=n.length>2?n[2]%360*Na:0,r()):[m*La,y*La,x*La]},Xo.rebind(t,f,"precision"),function(){return i=n.apply(this,arguments),t.invert=i.invert&&e,r()}}function tr(n){return Ke(n,function(t,e){n.point(t*Na,e*Na)})}function er(n,t){return[n,t]}function rr(n,t){return[n>Sa?n-ka:-Sa>n?n+ka:n,t]}function ur(n,t,e){return n?t||e?Ue(or(n),ar(t,e)):or(n):t||e?ar(t,e):rr}function ir(n){return function(t,e){return t+=n,[t>Sa?t-ka:-Sa>t?t+ka:t,e]}}function or(n){var t=ir(n);return t.invert=ir(-n),t}function ar(n,t){function e(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,s=Math.sin(t),l=s*r+a*u;return[Math.atan2(c*i-l*o,a*r-s*u),X(l*i+c*o)]}var r=Math.cos(n),u=Math.sin(n),i=Math.cos(t),o=Math.sin(t);return e.invert=function(n,t){var e=Math.cos(t),a=Math.cos(n)*e,c=Math.sin(n)*e,s=Math.sin(t),l=s*i-c*o;return[Math.atan2(c*i+s*o,a*r+l*u),X(l*r-a*u)]},e}function cr(n,t){var e=Math.cos(n),r=Math.sin(n);return function(u,i,o,a){var c=o*t;null!=u?(u=sr(e,u),i=sr(e,i),(o>0?i>u:u>i)&&(u+=o*ka)):(u=n+o*ka,i=n-.5*c);for(var s,l=u;o>0?l>i:i>l;l-=c)a.point((s=ve([e,-r*Math.cos(l),-r*Math.sin(l)]))[0],s[1])}}function sr(n,t){var e=se(t);e[0]-=n,pe(e);var r=V(-e[1]);return((-e[2]<0?-r:r)+2*Math.PI-Aa)%(2*Math.PI)}function lr(n,t,e){var r=Xo.range(n,t-Aa,e).concat(t);return function(n){return r.map(function(t){return[n,t]})}}function fr(n,t,e){var r=Xo.range(n,t-Aa,e).concat(t);return function(n){return r.map(function(t){return[t,n]})}}function hr(n){return n.source}function gr(n){return n.target}function pr(n,t,e,r){var u=Math.cos(t),i=Math.sin(t),o=Math.cos(r),a=Math.sin(r),c=u*Math.cos(n),s=u*Math.sin(n),l=o*Math.cos(e),f=o*Math.sin(e),h=2*Math.asin(Math.sqrt(J(r-t)+u*o*J(e-n))),g=1/Math.sin(h),p=h?function(n){var t=Math.sin(n*=h)*g,e=Math.sin(h-n)*g,r=e*c+t*l,u=e*s+t*f,o=e*i+t*a;return[Math.atan2(u,r)*La,Math.atan2(o,Math.sqrt(r*r+u*u))*La]}:function(){return[n*La,t*La]};return p.distance=h,p}function vr(){function n(n,u){var i=Math.sin(u*=Na),o=Math.cos(u),a=oa((n*=Na)-t),c=Math.cos(a);Uc+=Math.atan2(Math.sqrt((a=o*Math.sin(a))*a+(a=r*i-e*o*c)*a),e*i+r*o*c),t=n,e=i,r=o}var t,e,r;jc.point=function(u,i){t=u*Na,e=Math.sin(i*=Na),r=Math.cos(i),jc.point=n},jc.lineEnd=function(){jc.point=jc.lineEnd=g}}function dr(n,t){function e(t,e){var r=Math.cos(t),u=Math.cos(e),i=n(r*u);return[i*u*Math.sin(t),i*Math.sin(e)]}return e.invert=function(n,e){var r=Math.sqrt(n*n+e*e),u=t(r),i=Math.sin(u),o=Math.cos(u);return[Math.atan2(n*i,r*o),Math.asin(r&&e*i/r)]},e}function mr(n,t){function e(n,t){var e=oa(oa(t)-Ea)<Aa?0:o/Math.pow(u(t),i);return[e*Math.sin(i*n),o-e*Math.cos(i*n)]}var r=Math.cos(n),u=function(n){return Math.tan(Sa/4+n/2)},i=n===t?Math.sin(n):Math.log(r/Math.cos(t))/Math.log(u(t)/u(n)),o=r*Math.pow(u(n),i)/i;return i?(e.invert=function(n,t){var e=o-t,r=I(i)*Math.sqrt(n*n+e*e);return[Math.atan2(n,e)/i,2*Math.atan(Math.pow(o/r,1/i))-Ea]},e):xr}function yr(n,t){function e(n,t){var e=i-t;return[e*Math.sin(u*n),i-e*Math.cos(u*n)]}var r=Math.cos(n),u=n===t?Math.sin(n):(r-Math.cos(t))/(t-n),i=r/u+n;return oa(u)<Aa?er:(e.invert=function(n,t){var e=i-t;return[Math.atan2(n,e)/u,i-I(u)*Math.sqrt(n*n+e*e)]},e)}function xr(n,t){return[n,Math.log(Math.tan(Sa/4+t/2))]}function Mr(n){var t,e=Qe(n),r=e.scale,u=e.translate,i=e.clipExtent;return e.scale=function(){var n=r.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.translate=function(){var n=u.apply(e,arguments);return n===e?t?e.clipExtent(null):e:n},e.clipExtent=function(n){var o=i.apply(e,arguments);if(o===e){if(t=null==n){var a=Sa*r(),c=u();i([[c[0]-a,c[1]-a],[c[0]+a,c[1]+a]])}}else t&&(o=null);return o},e.clipExtent(null)}function _r(n,t){return[Math.log(Math.tan(Sa/4+t/2)),-n]}function br(n){return n[0]}function wr(n){return n[1]}function Sr(n){for(var t=n.length,e=[0,1],r=2,u=2;t>u;u++){for(;r>1&&Z(n[e[r-2]],n[e[r-1]],n[u])<=0;)--r;e[r++]=u}return e.slice(0,r)}function kr(n,t){return n[0]-t[0]||n[1]-t[1]}function Er(n,t,e){return(e[0]-t[0])*(n[1]-t[1])<(e[1]-t[1])*(n[0]-t[0])}function Ar(n,t,e,r){var u=n[0],i=e[0],o=t[0]-u,a=r[0]-i,c=n[1],s=e[1],l=t[1]-c,f=r[1]-s,h=(a*(c-s)-f*(u-i))/(f*o-a*l);return[u+h*o,c+h*l]}function Cr(n){var t=n[0],e=n[n.length-1];return!(t[0]-e[0]||t[1]-e[1])}function Nr(){Jr(this),this.edge=this.site=this.circle=null}function Lr(n){var t=Jc.pop()||new Nr;return t.site=n,t}function Tr(n){Or(n),$c.remove(n),Jc.push(n),Jr(n)}function qr(n){var t=n.circle,e=t.x,r=t.cy,u={x:e,y:r},i=n.P,o=n.N,a=[n];Tr(n);for(var c=i;c.circle&&oa(e-c.circle.x)<Aa&&oa(r-c.circle.cy)<Aa;)i=c.P,a.unshift(c),Tr(c),c=i;a.unshift(c),Or(c);for(var s=o;s.circle&&oa(e-s.circle.x)<Aa&&oa(r-s.circle.cy)<Aa;)o=s.N,a.push(s),Tr(s),s=o;a.push(s),Or(s);var l,f=a.length;for(l=1;f>l;++l)s=a[l],c=a[l-1],$r(s.edge,c.site,s.site,u);c=a[0],s=a[f-1],s.edge=Vr(c.site,s.site,null,u),Fr(c),Fr(s)}function zr(n){for(var t,e,r,u,i=n.x,o=n.y,a=$c._;a;)if(r=Rr(a,o)-i,r>Aa)a=a.L;else{if(u=i-Dr(a,o),!(u>Aa)){r>-Aa?(t=a.P,e=a):u>-Aa?(t=a,e=a.N):t=e=a;break}if(!a.R){t=a;break}a=a.R}var c=Lr(n);if($c.insert(t,c),t||e){if(t===e)return Or(t),e=Lr(t.site),$c.insert(c,e),c.edge=e.edge=Vr(t.site,c.site),Fr(t),Fr(e),void 0;if(!e)return c.edge=Vr(t.site,c.site),void 0;Or(t),Or(e);var s=t.site,l=s.x,f=s.y,h=n.x-l,g=n.y-f,p=e.site,v=p.x-l,d=p.y-f,m=2*(h*d-g*v),y=h*h+g*g,x=v*v+d*d,M={x:(d*y-g*x)/m+l,y:(h*x-v*y)/m+f};$r(e.edge,s,p,M),c.edge=Vr(s,n,null,M),e.edge=Vr(n,p,null,M),Fr(t),Fr(e)}}function Rr(n,t){var e=n.site,r=e.x,u=e.y,i=u-t;if(!i)return r;var o=n.P;if(!o)return-1/0;e=o.site;var a=e.x,c=e.y,s=c-t;if(!s)return a;var l=a-r,f=1/i-1/s,h=l/s;return f?(-h+Math.sqrt(h*h-2*f*(l*l/(-2*s)-c+s/2+u-i/2)))/f+r:(r+a)/2}function Dr(n,t){var e=n.N;if(e)return Rr(e,t);var r=n.site;return r.y===t?r.x:1/0}function Pr(n){this.site=n,this.edges=[]}function Ur(n){for(var t,e,r,u,i,o,a,c,s,l,f=n[0][0],h=n[1][0],g=n[0][1],p=n[1][1],v=Xc,d=v.length;d--;)if(i=v[d],i&&i.prepare())for(a=i.edges,c=a.length,o=0;c>o;)l=a[o].end(),r=l.x,u=l.y,s=a[++o%c].start(),t=s.x,e=s.y,(oa(r-t)>Aa||oa(u-e)>Aa)&&(a.splice(o,0,new Br(Xr(i.site,l,oa(r-f)<Aa&&p-u>Aa?{x:f,y:oa(t-f)<Aa?e:p}:oa(u-p)<Aa&&h-r>Aa?{x:oa(e-p)<Aa?t:h,y:p}:oa(r-h)<Aa&&u-g>Aa?{x:h,y:oa(t-h)<Aa?e:g}:oa(u-g)<Aa&&r-f>Aa?{x:oa(e-g)<Aa?t:f,y:g}:null),i.site,null)),++c)}function jr(n,t){return t.angle-n.angle}function Hr(){Jr(this),this.x=this.y=this.arc=this.site=this.cy=null}function Fr(n){var t=n.P,e=n.N;if(t&&e){var r=t.site,u=n.site,i=e.site;if(r!==i){var o=u.x,a=u.y,c=r.x-o,s=r.y-a,l=i.x-o,f=i.y-a,h=2*(c*f-s*l);if(!(h>=-Ca)){var g=c*c+s*s,p=l*l+f*f,v=(f*g-s*p)/h,d=(c*p-l*g)/h,f=d+a,m=Gc.pop()||new Hr;m.arc=n,m.site=u,m.x=v+o,m.y=f+Math.sqrt(v*v+d*d),m.cy=f,n.circle=m;for(var y=null,x=Wc._;x;)if(m.y<x.y||m.y===x.y&&m.x<=x.x){if(!x.L){y=x.P;break}x=x.L}else{if(!x.R){y=x;break}x=x.R}Wc.insert(y,m),y||(Bc=m)}}}}function Or(n){var t=n.circle;t&&(t.P||(Bc=t.N),Wc.remove(t),Gc.push(t),Jr(t),n.circle=null)}function Yr(n){for(var t,e=Vc,r=De(n[0][0],n[0][1],n[1][0],n[1][1]),u=e.length;u--;)t=e[u],(!Ir(t,n)||!r(t)||oa(t.a.x-t.b.x)<Aa&&oa(t.a.y-t.b.y)<Aa)&&(t.a=t.b=null,e.splice(u,1))}function Ir(n,t){var e=n.b;if(e)return!0;var r,u,i=n.a,o=t[0][0],a=t[1][0],c=t[0][1],s=t[1][1],l=n.l,f=n.r,h=l.x,g=l.y,p=f.x,v=f.y,d=(h+p)/2,m=(g+v)/2;if(v===g){if(o>d||d>=a)return;if(h>p){if(i){if(i.y>=s)return}else i={x:d,y:c};e={x:d,y:s}}else{if(i){if(i.y<c)return}else i={x:d,y:s};e={x:d,y:c}}}else if(r=(h-p)/(v-g),u=m-r*d,-1>r||r>1)if(h>p){if(i){if(i.y>=s)return}else i={x:(c-u)/r,y:c};e={x:(s-u)/r,y:s}}else{if(i){if(i.y<c)return}else i={x:(s-u)/r,y:s};e={x:(c-u)/r,y:c}}else if(v>g){if(i){if(i.x>=a)return}else i={x:o,y:r*o+u};e={x:a,y:r*a+u}}else{if(i){if(i.x<o)return}else i={x:a,y:r*a+u};e={x:o,y:r*o+u}}return n.a=i,n.b=e,!0}function Zr(n,t){this.l=n,this.r=t,this.a=this.b=null}function Vr(n,t,e,r){var u=new Zr(n,t);return Vc.push(u),e&&$r(u,n,t,e),r&&$r(u,t,n,r),Xc[n.i].edges.push(new Br(u,n,t)),Xc[t.i].edges.push(new Br(u,t,n)),u}function Xr(n,t,e){var r=new Zr(n,null);return r.a=t,r.b=e,Vc.push(r),r}function $r(n,t,e,r){n.a||n.b?n.l===e?n.b=r:n.a=r:(n.a=r,n.l=t,n.r=e)}function Br(n,t,e){var r=n.a,u=n.b;this.edge=n,this.site=t,this.angle=e?Math.atan2(e.y-t.y,e.x-t.x):n.l===t?Math.atan2(u.x-r.x,r.y-u.y):Math.atan2(r.x-u.x,u.y-r.y)}function Wr(){this._=null}function Jr(n){n.U=n.C=n.L=n.R=n.P=n.N=null}function Gr(n,t){var e=t,r=t.R,u=e.U;u?u.L===e?u.L=r:u.R=r:n._=r,r.U=u,e.U=r,e.R=r.L,e.R&&(e.R.U=e),r.L=e}function Kr(n,t){var e=t,r=t.L,u=e.U;u?u.L===e?u.L=r:u.R=r:n._=r,r.U=u,e.U=r,e.L=r.R,e.L&&(e.L.U=e),r.R=e}function Qr(n){for(;n.L;)n=n.L;return n}function nu(n,t){var e,r,u,i=n.sort(tu).pop();for(Vc=[],Xc=new Array(n.length),$c=new Wr,Wc=new Wr;;)if(u=Bc,i&&(!u||i.y<u.y||i.y===u.y&&i.x<u.x))(i.x!==e||i.y!==r)&&(Xc[i.i]=new Pr(i),zr(i),e=i.x,r=i.y),i=n.pop();else{if(!u)break;qr(u.arc)}t&&(Yr(t),Ur(t));var o={cells:Xc,edges:Vc};return $c=Wc=Vc=Xc=null,o}function tu(n,t){return t.y-n.y||t.x-n.x}function eu(n,t,e){return(n.x-e.x)*(t.y-n.y)-(n.x-t.x)*(e.y-n.y)}function ru(n){return n.x}function uu(n){return n.y}function iu(){return{leaf:!0,nodes:[],point:null,x:null,y:null}}function ou(n,t,e,r,u,i){if(!n(t,e,r,u,i)){var o=.5*(e+u),a=.5*(r+i),c=t.nodes;c[0]&&ou(n,c[0],e,r,o,a),c[1]&&ou(n,c[1],o,r,u,a),c[2]&&ou(n,c[2],e,a,o,i),c[3]&&ou(n,c[3],o,a,u,i)}}function au(n,t){n=Xo.rgb(n),t=Xo.rgb(t);var e=n.r,r=n.g,u=n.b,i=t.r-e,o=t.g-r,a=t.b-u;return function(n){return"#"+vt(Math.round(e+i*n))+vt(Math.round(r+o*n))+vt(Math.round(u+a*n))}}function cu(n,t){var e,r={},u={};for(e in n)e in t?r[e]=fu(n[e],t[e]):u[e]=n[e];for(e in t)e in n||(u[e]=t[e]);return function(n){for(e in r)u[e]=r[e](n);return u}}function su(n,t){return t-=n=+n,function(e){return n+t*e}}function lu(n,t){var e,r,u,i,o,a=0,c=0,s=[],l=[];for(n+="",t+="",Qc.lastIndex=0,r=0;e=Qc.exec(t);++r)e.index&&s.push(t.substring(a,c=e.index)),l.push({i:s.length,x:e[0]}),s.push(null),a=Qc.lastIndex;for(a<t.length&&s.push(t.substring(a)),r=0,i=l.length;(e=Qc.exec(n))&&i>r;++r)if(o=l[r],o.x==e[0]){if(o.i)if(null==s[o.i+1])for(s[o.i-1]+=o.x,s.splice(o.i,1),u=r+1;i>u;++u)l[u].i--;else for(s[o.i-1]+=o.x+s[o.i+1],s.splice(o.i,2),u=r+1;i>u;++u)l[u].i-=2;else if(null==s[o.i+1])s[o.i]=o.x;else for(s[o.i]=o.x+s[o.i+1],s.splice(o.i+1,1),u=r+1;i>u;++u)l[u].i--;l.splice(r,1),i--,r--}else o.x=su(parseFloat(e[0]),parseFloat(o.x));for(;i>r;)o=l.pop(),null==s[o.i+1]?s[o.i]=o.x:(s[o.i]=o.x+s[o.i+1],s.splice(o.i+1,1)),i--;return 1===s.length?null==s[0]?(o=l[0].x,function(n){return o(n)+""}):function(){return t}:function(n){for(r=0;i>r;++r)s[(o=l[r]).i]=o.x(n);return s.join("")}}function fu(n,t){for(var e,r=Xo.interpolators.length;--r>=0&&!(e=Xo.interpolators[r](n,t)););return e}function hu(n,t){var e,r=[],u=[],i=n.length,o=t.length,a=Math.min(n.length,t.length);for(e=0;a>e;++e)r.push(fu(n[e],t[e]));for(;i>e;++e)u[e]=n[e];for(;o>e;++e)u[e]=t[e];return function(n){for(e=0;a>e;++e)u[e]=r[e](n);return u}}function gu(n){return function(t){return 0>=t?0:t>=1?1:n(t)}}function pu(n){return function(t){return 1-n(1-t)}}function vu(n){return function(t){return.5*(.5>t?n(2*t):2-n(2-2*t))}}function du(n){return n*n}function mu(n){return n*n*n}function yu(n){if(0>=n)return 0;if(n>=1)return 1;var t=n*n,e=t*n;return 4*(.5>n?e:3*(n-t)+e-.75)}function xu(n){return function(t){return Math.pow(t,n)}}function Mu(n){return 1-Math.cos(n*Ea)}function _u(n){return Math.pow(2,10*(n-1))}function bu(n){return 1-Math.sqrt(1-n*n)}function wu(n,t){var e;return arguments.length<2&&(t=.45),arguments.length?e=t/ka*Math.asin(1/n):(n=1,e=t/4),function(r){return 1+n*Math.pow(2,-10*r)*Math.sin((r-e)*ka/t)}}function Su(n){return n||(n=1.70158),function(t){return t*t*((n+1)*t-n)}}function ku(n){return 1/2.75>n?7.5625*n*n:2/2.75>n?7.5625*(n-=1.5/2.75)*n+.75:2.5/2.75>n?7.5625*(n-=2.25/2.75)*n+.9375:7.5625*(n-=2.625/2.75)*n+.984375}function Eu(n,t){n=Xo.hcl(n),t=Xo.hcl(t);var e=n.h,r=n.c,u=n.l,i=t.h-e,o=t.c-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.c:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return rt(e+i*n,r+o*n,u+a*n)+""}}function Au(n,t){n=Xo.hsl(n),t=Xo.hsl(t);var e=n.h,r=n.s,u=n.l,i=t.h-e,o=t.s-r,a=t.l-u;return isNaN(o)&&(o=0,r=isNaN(r)?t.s:r),isNaN(i)?(i=0,e=isNaN(e)?t.h:e):i>180?i-=360:-180>i&&(i+=360),function(n){return nt(e+i*n,r+o*n,u+a*n)+""}}function Cu(n,t){n=Xo.lab(n),t=Xo.lab(t);var e=n.l,r=n.a,u=n.b,i=t.l-e,o=t.a-r,a=t.b-u;return function(n){return ot(e+i*n,r+o*n,u+a*n)+""}}function Nu(n,t){return t-=n,function(e){return Math.round(n+t*e)}}function Lu(n){var t=[n.a,n.b],e=[n.c,n.d],r=qu(t),u=Tu(t,e),i=qu(zu(e,t,-u))||0;t[0]*e[1]<e[0]*t[1]&&(t[0]*=-1,t[1]*=-1,r*=-1,u*=-1),this.rotate=(r?Math.atan2(t[1],t[0]):Math.atan2(-e[0],e[1]))*La,this.translate=[n.e,n.f],this.scale=[r,i],this.skew=i?Math.atan2(u,i)*La:0}function Tu(n,t){return n[0]*t[0]+n[1]*t[1]}function qu(n){var t=Math.sqrt(Tu(n,n));return t&&(n[0]/=t,n[1]/=t),t}function zu(n,t,e){return n[0]+=e*t[0],n[1]+=e*t[1],n}function Ru(n,t){var e,r=[],u=[],i=Xo.transform(n),o=Xo.transform(t),a=i.translate,c=o.translate,s=i.rotate,l=o.rotate,f=i.skew,h=o.skew,g=i.scale,p=o.scale;return a[0]!=c[0]||a[1]!=c[1]?(r.push("translate(",null,",",null,")"),u.push({i:1,x:su(a[0],c[0])},{i:3,x:su(a[1],c[1])})):c[0]||c[1]?r.push("translate("+c+")"):r.push(""),s!=l?(s-l>180?l+=360:l-s>180&&(s+=360),u.push({i:r.push(r.pop()+"rotate(",null,")")-2,x:su(s,l)})):l&&r.push(r.pop()+"rotate("+l+")"),f!=h?u.push({i:r.push(r.pop()+"skewX(",null,")")-2,x:su(f,h)}):h&&r.push(r.pop()+"skewX("+h+")"),g[0]!=p[0]||g[1]!=p[1]?(e=r.push(r.pop()+"scale(",null,",",null,")"),u.push({i:e-4,x:su(g[0],p[0])},{i:e-2,x:su(g[1],p[1])})):(1!=p[0]||1!=p[1])&&r.push(r.pop()+"scale("+p+")"),e=u.length,function(n){for(var t,i=-1;++i<e;)r[(t=u[i]).i]=t.x(n);return r.join("")}}function Du(n,t){return t=t-(n=+n)?1/(t-n):0,function(e){return(e-n)*t}}function Pu(n,t){return t=t-(n=+n)?1/(t-n):0,function(e){return Math.max(0,Math.min(1,(e-n)*t))}}function Uu(n){for(var t=n.source,e=n.target,r=Hu(t,e),u=[t];t!==r;)t=t.parent,u.push(t);for(var i=u.length;e!==r;)u.splice(i,0,e),e=e.parent;return u}function ju(n){for(var t=[],e=n.parent;null!=e;)t.push(n),n=e,e=e.parent;return t.push(n),t}function Hu(n,t){if(n===t)return n;for(var e=ju(n),r=ju(t),u=e.pop(),i=r.pop(),o=null;u===i;)o=u,u=e.pop(),i=r.pop();return o}function Fu(n){n.fixed|=2}function Ou(n){n.fixed&=-7}function Yu(n){n.fixed|=4,n.px=n.x,n.py=n.y}function Iu(n){n.fixed&=-5}function Zu(n,t,e){var r=0,u=0;if(n.charge=0,!n.leaf)for(var i,o=n.nodes,a=o.length,c=-1;++c<a;)i=o[c],null!=i&&(Zu(i,t,e),n.charge+=i.charge,r+=i.charge*i.cx,u+=i.charge*i.cy);if(n.point){n.leaf||(n.point.x+=Math.random()-.5,n.point.y+=Math.random()-.5);var s=t*e[n.point.index];n.charge+=n.pointCharge=s,r+=s*n.point.x,u+=s*n.point.y}n.cx=r/n.charge,n.cy=u/n.charge}function Vu(n,t){return Xo.rebind(n,t,"sort","children","value"),n.nodes=n,n.links=Wu,n}function Xu(n){return n.children}function $u(n){return n.value}function Bu(n,t){return t.value-n.value}function Wu(n){return Xo.merge(n.map(function(n){return(n.children||[]).map(function(t){return{source:n,target:t}})}))}function Ju(n){return n.x}function Gu(n){return n.y}function Ku(n,t,e){n.y0=t,n.y=e}function Qu(n){return Xo.range(n.length)}function ni(n){for(var t=-1,e=n[0].length,r=[];++t<e;)r[t]=0;return r}function ti(n){for(var t,e=1,r=0,u=n[0][1],i=n.length;i>e;++e)(t=n[e][1])>u&&(r=e,u=t);return r}function ei(n){return n.reduce(ri,0)}function ri(n,t){return n+t[1]}function ui(n,t){return ii(n,Math.ceil(Math.log(t.length)/Math.LN2+1))}function ii(n,t){for(var e=-1,r=+n[0],u=(n[1]-r)/t,i=[];++e<=t;)i[e]=u*e+r;return i}function oi(n){return[Xo.min(n),Xo.max(n)]}function ai(n,t){return n.parent==t.parent?1:2}function ci(n){var t=n.children;return t&&t.length?t[0]:n._tree.thread}function si(n){var t,e=n.children;return e&&(t=e.length)?e[t-1]:n._tree.thread}function li(n,t){var e=n.children;if(e&&(u=e.length))for(var r,u,i=-1;++i<u;)t(r=li(e[i],t),n)>0&&(n=r);return n}function fi(n,t){return n.x-t.x}function hi(n,t){return t.x-n.x}function gi(n,t){return n.depth-t.depth}function pi(n,t){function e(n,r){var u=n.children;if(u&&(o=u.length))for(var i,o,a=null,c=-1;++c<o;)i=u[c],e(i,a),a=i;t(n,r)}e(n,null)}function vi(n){for(var t,e=0,r=0,u=n.children,i=u.length;--i>=0;)t=u[i]._tree,t.prelim+=e,t.mod+=e,e+=t.shift+(r+=t.change)}function di(n,t,e){n=n._tree,t=t._tree;var r=e/(t.number-n.number);n.change+=r,t.change-=r,t.shift+=e,t.prelim+=e,t.mod+=e}function mi(n,t,e){return n._tree.ancestor.parent==t.parent?n._tree.ancestor:e}function yi(n,t){return n.value-t.value}function xi(n,t){var e=n._pack_next;n._pack_next=t,t._pack_prev=n,t._pack_next=e,e._pack_prev=t}function Mi(n,t){n._pack_next=t,t._pack_prev=n}function _i(n,t){var e=t.x-n.x,r=t.y-n.y,u=n.r+t.r;return.999*u*u>e*e+r*r}function bi(n){function t(n){l=Math.min(n.x-n.r,l),f=Math.max(n.x+n.r,f),h=Math.min(n.y-n.r,h),g=Math.max(n.y+n.r,g)}if((e=n.children)&&(s=e.length)){var e,r,u,i,o,a,c,s,l=1/0,f=-1/0,h=1/0,g=-1/0;if(e.forEach(wi),r=e[0],r.x=-r.r,r.y=0,t(r),s>1&&(u=e[1],u.x=u.r,u.y=0,t(u),s>2))for(i=e[2],Ei(r,u,i),t(i),xi(r,i),r._pack_prev=i,xi(i,u),u=r._pack_next,o=3;s>o;o++){Ei(r,u,i=e[o]);var p=0,v=1,d=1;for(a=u._pack_next;a!==u;a=a._pack_next,v++)if(_i(a,i)){p=1;break}if(1==p)for(c=r._pack_prev;c!==a._pack_prev&&!_i(c,i);c=c._pack_prev,d++);p?(d>v||v==d&&u.r<r.r?Mi(r,u=a):Mi(r=c,u),o--):(xi(r,i),u=i,t(i))}var m=(l+f)/2,y=(h+g)/2,x=0;for(o=0;s>o;o++)i=e[o],i.x-=m,i.y-=y,x=Math.max(x,i.r+Math.sqrt(i.x*i.x+i.y*i.y));n.r=x,e.forEach(Si)}}function wi(n){n._pack_next=n._pack_prev=n}function Si(n){delete n._pack_next,delete n._pack_prev}function ki(n,t,e,r){var u=n.children;if(n.x=t+=r*n.x,n.y=e+=r*n.y,n.r*=r,u)for(var i=-1,o=u.length;++i<o;)ki(u[i],t,e,r)}function Ei(n,t,e){var r=n.r+e.r,u=t.x-n.x,i=t.y-n.y;if(r&&(u||i)){var o=t.r+e.r,a=u*u+i*i;o*=o,r*=r;var c=.5+(r-o)/(2*a),s=Math.sqrt(Math.max(0,2*o*(r+a)-(r-=a)*r-o*o))/(2*a);e.x=n.x+c*u+s*i,e.y=n.y+c*i-s*u}else e.x=n.x+r,e.y=n.y}function Ai(n){return 1+Xo.max(n,function(n){return n.y})}function Ci(n){return n.reduce(function(n,t){return n+t.x},0)/n.length}function Ni(n){var t=n.children;return t&&t.length?Ni(t[0]):n}function Li(n){var t,e=n.children;return e&&(t=e.length)?Li(e[t-1]):n}function Ti(n){return{x:n.x,y:n.y,dx:n.dx,dy:n.dy}}function qi(n,t){var e=n.x+t[3],r=n.y+t[0],u=n.dx-t[1]-t[3],i=n.dy-t[0]-t[2];return 0>u&&(e+=u/2,u=0),0>i&&(r+=i/2,i=0),{x:e,y:r,dx:u,dy:i}}function zi(n){var t=n[0],e=n[n.length-1];return e>t?[t,e]:[e,t]}function Ri(n){return n.rangeExtent?n.rangeExtent():zi(n.range())}function Di(n,t,e,r){var u=e(n[0],n[1]),i=r(t[0],t[1]);return function(n){return i(u(n))}}function Pi(n,t){var e,r=0,u=n.length-1,i=n[r],o=n[u];return i>o&&(e=r,r=u,u=e,e=i,i=o,o=e),n[r]=t.floor(i),n[u]=t.ceil(o),n}function Ui(n){return n?{floor:function(t){return Math.floor(t/n)*n},ceil:function(t){return Math.ceil(t/n)*n}}:ls}function ji(n,t,e,r){var u=[],i=[],o=0,a=Math.min(n.length,t.length)-1;for(n[a]<n[0]&&(n=n.slice().reverse(),t=t.slice().reverse());++o<=a;)u.push(e(n[o-1],n[o])),i.push(r(t[o-1],t[o]));return function(t){var e=Xo.bisect(n,t,1,a)-1;return i[e](u[e](t))}}function Hi(n,t,e,r){function u(){var u=Math.min(n.length,t.length)>2?ji:Di,c=r?Pu:Du;return o=u(n,t,c,e),a=u(t,n,c,fu),i}function i(n){return o(n)}var o,a;return i.invert=function(n){return a(n)},i.domain=function(t){return arguments.length?(n=t.map(Number),u()):n},i.range=function(n){return arguments.length?(t=n,u()):t},i.rangeRound=function(n){return i.range(n).interpolate(Nu)},i.clamp=function(n){return arguments.length?(r=n,u()):r},i.interpolate=function(n){return arguments.length?(e=n,u()):e},i.ticks=function(t){return Ii(n,t)},i.tickFormat=function(t,e){return Zi(n,t,e)},i.nice=function(t){return Oi(n,t),u()},i.copy=function(){return Hi(n,t,e,r)},u()}function Fi(n,t){return Xo.rebind(n,t,"range","rangeRound","interpolate","clamp")}function Oi(n,t){return Pi(n,Ui(Yi(n,t)[2]))}function Yi(n,t){null==t&&(t=10);var e=zi(n),r=e[1]-e[0],u=Math.pow(10,Math.floor(Math.log(r/t)/Math.LN10)),i=t/r*u;return.15>=i?u*=10:.35>=i?u*=5:.75>=i&&(u*=2),e[0]=Math.ceil(e[0]/u)*u,e[1]=Math.floor(e[1]/u)*u+.5*u,e[2]=u,e}function Ii(n,t){return Xo.range.apply(Xo,Yi(n,t))}function Zi(n,t,e){var r=Yi(n,t);return Xo.format(e?e.replace(Qa,function(n,t,e,u,i,o,a,c,s,l){return[t,e,u,i,o,a,c,s||"."+Xi(l,r),l].join("")}):",."+Vi(r[2])+"f")}function Vi(n){return-Math.floor(Math.log(n)/Math.LN10+.01)}function Xi(n,t){var e=Vi(t[2]);return n in fs?Math.abs(e-Vi(Math.max(Math.abs(t[0]),Math.abs(t[1]))))+ +("e"!==n):e-2*("%"===n)}function $i(n,t,e,r){function u(n){return(e?Math.log(0>n?0:n):-Math.log(n>0?0:-n))/Math.log(t)}function i(n){return e?Math.pow(t,n):-Math.pow(t,-n)}function o(t){return n(u(t))}return o.invert=function(t){return i(n.invert(t))},o.domain=function(t){return arguments.length?(e=t[0]>=0,n.domain((r=t.map(Number)).map(u)),o):r},o.base=function(e){return arguments.length?(t=+e,n.domain(r.map(u)),o):t},o.nice=function(){var t=Pi(r.map(u),e?Math:gs);return n.domain(t),r=t.map(i),o},o.ticks=function(){var n=zi(r),o=[],a=n[0],c=n[1],s=Math.floor(u(a)),l=Math.ceil(u(c)),f=t%1?2:t;if(isFinite(l-s)){if(e){for(;l>s;s++)for(var h=1;f>h;h++)o.push(i(s)*h);o.push(i(s))}else for(o.push(i(s));s++<l;)for(var h=f-1;h>0;h--)o.push(i(s)*h);for(s=0;o[s]<a;s++);for(l=o.length;o[l-1]>c;l--);o=o.slice(s,l)}return o},o.tickFormat=function(n,t){if(!arguments.length)return hs;arguments.length<2?t=hs:"function"!=typeof t&&(t=Xo.format(t));var r,a=Math.max(.1,n/o.ticks().length),c=e?(r=1e-12,Math.ceil):(r=-1e-12,Math.floor);return function(n){return n/i(c(u(n)+r))<=a?t(n):""}},o.copy=function(){return $i(n.copy(),t,e,r)},Fi(o,n)}function Bi(n,t,e){function r(t){return n(u(t))}var u=Wi(t),i=Wi(1/t);return r.invert=function(t){return i(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain((e=t.map(Number)).map(u)),r):e},r.ticks=function(n){return Ii(e,n)},r.tickFormat=function(n,t){return Zi(e,n,t)},r.nice=function(n){return r.domain(Oi(e,n))},r.exponent=function(o){return arguments.length?(u=Wi(t=o),i=Wi(1/t),n.domain(e.map(u)),r):t},r.copy=function(){return Bi(n.copy(),t,e)},Fi(r,n)}function Wi(n){return function(t){return 0>t?-Math.pow(-t,n):Math.pow(t,n)}}function Ji(n,t){function e(e){return o[((i.get(e)||"range"===t.t&&i.set(e,n.push(e)))-1)%o.length]}function r(t,e){return Xo.range(n.length).map(function(n){return t+e*n})}var i,o,a;return e.domain=function(r){if(!arguments.length)return n;n=[],i=new u;for(var o,a=-1,c=r.length;++a<c;)i.has(o=r[a])||i.set(o,n.push(o));return e[t.t].apply(e,t.a)},e.range=function(n){return arguments.length?(o=n,a=0,t={t:"range",a:arguments},e):o},e.rangePoints=function(u,i){arguments.length<2&&(i=0);var c=u[0],s=u[1],l=(s-c)/(Math.max(1,n.length-1)+i);return o=r(n.length<2?(c+s)/2:c+l*i/2,l),a=0,t={t:"rangePoints",a:arguments},e},e.rangeBands=function(u,i,c){arguments.length<2&&(i=0),arguments.length<3&&(c=i);var s=u[1]<u[0],l=u[s-0],f=u[1-s],h=(f-l)/(n.length-i+2*c);return o=r(l+h*c,h),s&&o.reverse(),a=h*(1-i),t={t:"rangeBands",a:arguments},e},e.rangeRoundBands=function(u,i,c){arguments.length<2&&(i=0),arguments.length<3&&(c=i);var s=u[1]<u[0],l=u[s-0],f=u[1-s],h=Math.floor((f-l)/(n.length-i+2*c)),g=f-l-(n.length-i)*h;return o=r(l+Math.round(g/2),h),s&&o.reverse(),a=Math.round(h*(1-i)),t={t:"rangeRoundBands",a:arguments},e},e.rangeBand=function(){return a},e.rangeExtent=function(){return zi(t.a[0])},e.copy=function(){return Ji(n,t)},e.domain(n)}function Gi(n,t){function e(){var e=0,i=t.length;for(u=[];++e<i;)u[e-1]=Xo.quantile(n,e/i);return r}function r(n){return isNaN(n=+n)?void 0:t[Xo.bisect(u,n)]}var u;return r.domain=function(t){return arguments.length?(n=t.filter(function(n){return!isNaN(n)}).sort(Xo.ascending),e()):n},r.range=function(n){return arguments.length?(t=n,e()):t},r.quantiles=function(){return u},r.invertExtent=function(e){return e=t.indexOf(e),0>e?[0/0,0/0]:[e>0?u[e-1]:n[0],e<u.length?u[e]:n[n.length-1]]},r.copy=function(){return Gi(n,t)},e()}function Ki(n,t,e){function r(t){return e[Math.max(0,Math.min(o,Math.floor(i*(t-n))))]}function u(){return i=e.length/(t-n),o=e.length-1,r}var i,o;return r.domain=function(e){return arguments.length?(n=+e[0],t=+e[e.length-1],u()):[n,t]},r.range=function(n){return arguments.length?(e=n,u()):e},r.invertExtent=function(t){return t=e.indexOf(t),t=0>t?0/0:t/i+n,[t,t+1/i]},r.copy=function(){return Ki(n,t,e)},u()}function Qi(n,t){function e(e){return e>=e?t[Xo.bisect(n,e)]:void 0}return e.domain=function(t){return arguments.length?(n=t,e):n},e.range=function(n){return arguments.length?(t=n,e):t},e.invertExtent=function(e){return e=t.indexOf(e),[n[e-1],n[e]]},e.copy=function(){return Qi(n,t)},e}function no(n){function t(n){return+n}return t.invert=t,t.domain=t.range=function(e){return arguments.length?(n=e.map(t),t):n},t.ticks=function(t){return Ii(n,t)},t.tickFormat=function(t,e){return Zi(n,t,e)},t.copy=function(){return no(n)},t}function to(n){return n.innerRadius}function eo(n){return n.outerRadius}function ro(n){return n.startAngle}function uo(n){return n.endAngle}function io(n){function t(t){function o(){s.push("M",i(n(l),a))}for(var c,s=[],l=[],f=-1,h=t.length,g=_t(e),p=_t(r);++f<h;)u.call(this,c=t[f],f)?l.push([+g.call(this,c,f),+p.call(this,c,f)]):l.length&&(o(),l=[]);return l.length&&o(),s.length?s.join(""):null}var e=br,r=wr,u=be,i=oo,o=i.key,a=.7;return t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t.defined=function(n){return arguments.length?(u=n,t):u},t.interpolate=function(n){return arguments.length?(o="function"==typeof n?i=n:(i=Ms.get(n)||oo).key,t):o},t.tension=function(n){return arguments.length?(a=n,t):a},t}function oo(n){return n.join("L")}function ao(n){return oo(n)+"Z"}function co(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("H",(r[0]+(r=n[t])[0])/2,"V",r[1]);return e>1&&u.push("H",r[0]),u.join("")}function so(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("V",(r=n[t])[1],"H",r[0]);return u.join("")}function lo(n){for(var t=0,e=n.length,r=n[0],u=[r[0],",",r[1]];++t<e;)u.push("H",(r=n[t])[0],"V",r[1]);return u.join("")}function fo(n,t){return n.length<4?oo(n):n[1]+po(n.slice(1,n.length-1),vo(n,t))}function ho(n,t){return n.length<3?oo(n):n[0]+po((n.push(n[0]),n),vo([n[n.length-2]].concat(n,[n[1]]),t))}function go(n,t){return n.length<3?oo(n):n[0]+po(n,vo(n,t))}function po(n,t){if(t.length<1||n.length!=t.length&&n.length!=t.length+2)return oo(n);var e=n.length!=t.length,r="",u=n[0],i=n[1],o=t[0],a=o,c=1;if(e&&(r+="Q"+(i[0]-2*o[0]/3)+","+(i[1]-2*o[1]/3)+","+i[0]+","+i[1],u=n[1],c=2),t.length>1){a=t[1],i=n[c],c++,r+="C"+(u[0]+o[0])+","+(u[1]+o[1])+","+(i[0]-a[0])+","+(i[1]-a[1])+","+i[0]+","+i[1];for(var s=2;s<t.length;s++,c++)i=n[c],a=t[s],r+="S"+(i[0]-a[0])+","+(i[1]-a[1])+","+i[0]+","+i[1]}if(e){var l=n[c];r+="Q"+(i[0]+2*a[0]/3)+","+(i[1]+2*a[1]/3)+","+l[0]+","+l[1]}return r}function vo(n,t){for(var e,r=[],u=(1-t)/2,i=n[0],o=n[1],a=1,c=n.length;++a<c;)e=i,i=o,o=n[a],r.push([u*(o[0]-e[0]),u*(o[1]-e[1])]);return r}function mo(n){if(n.length<3)return oo(n);var t=1,e=n.length,r=n[0],u=r[0],i=r[1],o=[u,u,u,(r=n[1])[0]],a=[i,i,i,r[1]],c=[u,",",i,"L",_o(ws,o),",",_o(ws,a)];for(n.push(n[e-1]);++t<=e;)r=n[t],o.shift(),o.push(r[0]),a.shift(),a.push(r[1]),bo(c,o,a);return n.pop(),c.push("L",r),c.join("")}function yo(n){if(n.length<4)return oo(n);for(var t,e=[],r=-1,u=n.length,i=[0],o=[0];++r<3;)t=n[r],i.push(t[0]),o.push(t[1]);for(e.push(_o(ws,i)+","+_o(ws,o)),--r;++r<u;)t=n[r],i.shift(),i.push(t[0]),o.shift(),o.push(t[1]),bo(e,i,o);return e.join("")}function xo(n){for(var t,e,r=-1,u=n.length,i=u+4,o=[],a=[];++r<4;)e=n[r%u],o.push(e[0]),a.push(e[1]);for(t=[_o(ws,o),",",_o(ws,a)],--r;++r<i;)e=n[r%u],o.shift(),o.push(e[0]),a.shift(),a.push(e[1]),bo(t,o,a);return t.join("")}function Mo(n,t){var e=n.length-1;if(e)for(var r,u,i=n[0][0],o=n[0][1],a=n[e][0]-i,c=n[e][1]-o,s=-1;++s<=e;)r=n[s],u=s/e,r[0]=t*r[0]+(1-t)*(i+u*a),r[1]=t*r[1]+(1-t)*(o+u*c);return mo(n)}function _o(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]*t[3]}function bo(n,t,e){n.push("C",_o(_s,t),",",_o(_s,e),",",_o(bs,t),",",_o(bs,e),",",_o(ws,t),",",_o(ws,e))}function wo(n,t){return(t[1]-n[1])/(t[0]-n[0])}function So(n){for(var t=0,e=n.length-1,r=[],u=n[0],i=n[1],o=r[0]=wo(u,i);++t<e;)r[t]=(o+(o=wo(u=i,i=n[t+1])))/2;return r[t]=o,r}function ko(n){for(var t,e,r,u,i=[],o=So(n),a=-1,c=n.length-1;++a<c;)t=wo(n[a],n[a+1]),oa(t)<Aa?o[a]=o[a+1]=0:(e=o[a]/t,r=o[a+1]/t,u=e*e+r*r,u>9&&(u=3*t/Math.sqrt(u),o[a]=u*e,o[a+1]=u*r));for(a=-1;++a<=c;)u=(n[Math.min(c,a+1)][0]-n[Math.max(0,a-1)][0])/(6*(1+o[a]*o[a])),i.push([u||0,o[a]*u||0]);return i}function Eo(n){return n.length<3?oo(n):n[0]+po(n,ko(n))}function Ao(n){for(var t,e,r,u=-1,i=n.length;++u<i;)t=n[u],e=t[0],r=t[1]+ys,t[0]=e*Math.cos(r),t[1]=e*Math.sin(r);return n}function Co(n){function t(t){function c(){v.push("M",a(n(m),f),l,s(n(d.reverse()),f),"Z")}for(var h,g,p,v=[],d=[],m=[],y=-1,x=t.length,M=_t(e),_=_t(u),b=e===r?function(){return g}:_t(r),w=u===i?function(){return p}:_t(i);++y<x;)o.call(this,h=t[y],y)?(d.push([g=+M.call(this,h,y),p=+_.call(this,h,y)]),m.push([+b.call(this,h,y),+w.call(this,h,y)])):d.length&&(c(),d=[],m=[]);return d.length&&c(),v.length?v.join(""):null}var e=br,r=br,u=0,i=wr,o=be,a=oo,c=a.key,s=a,l="L",f=.7;return t.x=function(n){return arguments.length?(e=r=n,t):r},t.x0=function(n){return arguments.length?(e=n,t):e},t.x1=function(n){return arguments.length?(r=n,t):r},t.y=function(n){return arguments.length?(u=i=n,t):i},t.y0=function(n){return arguments.length?(u=n,t):u},t.y1=function(n){return arguments.length?(i=n,t):i},t.defined=function(n){return arguments.length?(o=n,t):o},t.interpolate=function(n){return arguments.length?(c="function"==typeof n?a=n:(a=Ms.get(n)||oo).key,s=a.reverse||a,l=a.closed?"M":"L",t):c},t.tension=function(n){return arguments.length?(f=n,t):f},t}function No(n){return n.radius}function Lo(n){return[n.x,n.y]}function To(n){return function(){var t=n.apply(this,arguments),e=t[0],r=t[1]+ys;return[e*Math.cos(r),e*Math.sin(r)]}}function qo(){return 64}function zo(){return"circle"}function Ro(n){var t=Math.sqrt(n/Sa);return"M0,"+t+"A"+t+","+t+" 0 1,1 0,"+-t+"A"+t+","+t+" 0 1,1 0,"+t+"Z"}function Do(n,t){return fa(n,Ns),n.id=t,n}function Po(n,t,e,r){var u=n.id;return R(n,"function"==typeof e?function(n,i,o){n.__transition__[u].tween.set(t,r(e.call(n,n.__data__,i,o)))}:(e=r(e),function(n){n.__transition__[u].tween.set(t,e)}))}function Uo(n){return null==n&&(n=""),function(){this.textContent=n}}function jo(n,t,e,r){var i=n.__transition__||(n.__transition__={active:0,count:0}),o=i[e];if(!o){var a=r.time;o=i[e]={tween:new u,time:a,ease:r.ease,delay:r.delay,duration:r.duration},++i.count,Xo.timer(function(r){function u(r){return i.active>e?s():(i.active=e,o.event&&o.event.start.call(n,l,t),o.tween.forEach(function(e,r){(r=r.call(n,l,t))&&v.push(r)}),Xo.timer(function(){return p.c=c(r||1)?be:c,1},0,a),void 0)}function c(r){if(i.active!==e)return s();for(var u=r/g,a=f(u),c=v.length;c>0;)v[--c].call(n,a);return u>=1?(o.event&&o.event.end.call(n,l,t),s()):void 0}function s(){return--i.count?delete i[e]:delete n.__transition__,1}var l=n.__data__,f=o.ease,h=o.delay,g=o.duration,p=Ja,v=[];return p.t=h+a,r>=h?u(r-h):(p.c=u,void 0)},0,a)}}function Ho(n,t){n.attr("transform",function(n){return"translate("+t(n)+",0)"})}function Fo(n,t){n.attr("transform",function(n){return"translate(0,"+t(n)+")"})}function Oo(n){return n.toISOString()}function Yo(n,t,e){function r(t){return n(t)}function u(n,e){var r=n[1]-n[0],u=r/e,i=Xo.bisect(js,u);return i==js.length?[t.year,Yi(n.map(function(n){return n/31536e6}),e)[2]]:i?t[u/js[i-1]<js[i]/u?i-1:i]:[Os,Yi(n,e)[2]]
-}return r.invert=function(t){return Io(n.invert(t))},r.domain=function(t){return arguments.length?(n.domain(t),r):n.domain().map(Io)},r.nice=function(n,t){function e(e){return!isNaN(e)&&!n.range(e,Io(+e+1),t).length}var i=r.domain(),o=zi(i),a=null==n?u(o,10):"number"==typeof n&&u(o,n);return a&&(n=a[0],t=a[1]),r.domain(Pi(i,t>1?{floor:function(t){for(;e(t=n.floor(t));)t=Io(t-1);return t},ceil:function(t){for(;e(t=n.ceil(t));)t=Io(+t+1);return t}}:n))},r.ticks=function(n,t){var e=zi(r.domain()),i=null==n?u(e,10):"number"==typeof n?u(e,n):!n.range&&[{range:n},t];return i&&(n=i[0],t=i[1]),n.range(e[0],Io(+e[1]+1),1>t?1:t)},r.tickFormat=function(){return e},r.copy=function(){return Yo(n.copy(),t,e)},Fi(r,n)}function Io(n){return new Date(n)}function Zo(n){return JSON.parse(n.responseText)}function Vo(n){var t=Wo.createRange();return t.selectNode(Wo.body),t.createContextualFragment(n.responseText)}var Xo={version:"3.4.3"};Date.now||(Date.now=function(){return+new Date});var $o=[].slice,Bo=function(n){return $o.call(n)},Wo=document,Jo=Wo.documentElement,Go=window;try{Bo(Jo.childNodes)[0].nodeType}catch(Ko){Bo=function(n){for(var t=n.length,e=new Array(t);t--;)e[t]=n[t];return e}}try{Wo.createElement("div").style.setProperty("opacity",0,"")}catch(Qo){var na=Go.Element.prototype,ta=na.setAttribute,ea=na.setAttributeNS,ra=Go.CSSStyleDeclaration.prototype,ua=ra.setProperty;na.setAttribute=function(n,t){ta.call(this,n,t+"")},na.setAttributeNS=function(n,t,e){ea.call(this,n,t,e+"")},ra.setProperty=function(n,t,e){ua.call(this,n,t+"",e)}}Xo.ascending=function(n,t){return t>n?-1:n>t?1:n>=t?0:0/0},Xo.descending=function(n,t){return n>t?-1:t>n?1:t>=n?0:0/0},Xo.min=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u<i&&!(null!=(e=n[u])&&e>=e);)e=void 0;for(;++u<i;)null!=(r=n[u])&&e>r&&(e=r)}else{for(;++u<i&&!(null!=(e=t.call(n,n[u],u))&&e>=e);)e=void 0;for(;++u<i;)null!=(r=t.call(n,n[u],u))&&e>r&&(e=r)}return e},Xo.max=function(n,t){var e,r,u=-1,i=n.length;if(1===arguments.length){for(;++u<i&&!(null!=(e=n[u])&&e>=e);)e=void 0;for(;++u<i;)null!=(r=n[u])&&r>e&&(e=r)}else{for(;++u<i&&!(null!=(e=t.call(n,n[u],u))&&e>=e);)e=void 0;for(;++u<i;)null!=(r=t.call(n,n[u],u))&&r>e&&(e=r)}return e},Xo.extent=function(n,t){var e,r,u,i=-1,o=n.length;if(1===arguments.length){for(;++i<o&&!(null!=(e=u=n[i])&&e>=e);)e=u=void 0;for(;++i<o;)null!=(r=n[i])&&(e>r&&(e=r),r>u&&(u=r))}else{for(;++i<o&&!(null!=(e=u=t.call(n,n[i],i))&&e>=e);)e=void 0;for(;++i<o;)null!=(r=t.call(n,n[i],i))&&(e>r&&(e=r),r>u&&(u=r))}return[e,u]},Xo.sum=function(n,t){var e,r=0,u=n.length,i=-1;if(1===arguments.length)for(;++i<u;)isNaN(e=+n[i])||(r+=e);else for(;++i<u;)isNaN(e=+t.call(n,n[i],i))||(r+=e);return r},Xo.mean=function(t,e){var r,u=t.length,i=0,o=-1,a=0;if(1===arguments.length)for(;++o<u;)n(r=t[o])&&(i+=(r-i)/++a);else for(;++o<u;)n(r=e.call(t,t[o],o))&&(i+=(r-i)/++a);return a?i:void 0},Xo.quantile=function(n,t){var e=(n.length-1)*t+1,r=Math.floor(e),u=+n[r-1],i=e-r;return i?u+i*(n[r]-u):u},Xo.median=function(t,e){return arguments.length>1&&(t=t.map(e)),t=t.filter(n),t.length?Xo.quantile(t.sort(Xo.ascending),.5):void 0},Xo.bisector=function(n){return{left:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;n.call(t,t[i],i)<e?r=i+1:u=i}return r},right:function(t,e,r,u){for(arguments.length<3&&(r=0),arguments.length<4&&(u=t.length);u>r;){var i=r+u>>>1;e<n.call(t,t[i],i)?u=i:r=i+1}return r}}};var ia=Xo.bisector(function(n){return n});Xo.bisectLeft=ia.left,Xo.bisect=Xo.bisectRight=ia.right,Xo.shuffle=function(n){for(var t,e,r=n.length;r;)e=0|Math.random()*r--,t=n[r],n[r]=n[e],n[e]=t;return n},Xo.permute=function(n,t){for(var e=t.length,r=new Array(e);e--;)r[e]=n[t[e]];return r},Xo.pairs=function(n){for(var t,e=0,r=n.length-1,u=n[0],i=new Array(0>r?0:r);r>e;)i[e]=[t=u,u=n[++e]];return i},Xo.zip=function(){if(!(u=arguments.length))return[];for(var n=-1,e=Xo.min(arguments,t),r=new Array(e);++n<e;)for(var u,i=-1,o=r[n]=new Array(u);++i<u;)o[i]=arguments[i][n];return r},Xo.transpose=function(n){return Xo.zip.apply(Xo,n)},Xo.keys=function(n){var t=[];for(var e in n)t.push(e);return t},Xo.values=function(n){var t=[];for(var e in n)t.push(n[e]);return t},Xo.entries=function(n){var t=[];for(var e in n)t.push({key:e,value:n[e]});return t},Xo.merge=function(n){for(var t,e,r,u=n.length,i=-1,o=0;++i<u;)o+=n[i].length;for(e=new Array(o);--u>=0;)for(r=n[u],t=r.length;--t>=0;)e[--o]=r[t];return e};var oa=Math.abs;Xo.range=function(n,t,r){if(arguments.length<3&&(r=1,arguments.length<2&&(t=n,n=0)),1/0===(t-n)/r)throw new Error("infinite range");var u,i=[],o=e(oa(r)),a=-1;if(n*=o,t*=o,r*=o,0>r)for(;(u=n+r*++a)>t;)i.push(u/o);else for(;(u=n+r*++a)<t;)i.push(u/o);return i},Xo.map=function(n){var t=new u;if(n instanceof u)n.forEach(function(n,e){t.set(n,e)});else for(var e in n)t.set(e,n[e]);return t},r(u,{has:i,get:function(n){return this[aa+n]},set:function(n,t){return this[aa+n]=t},remove:o,keys:a,values:function(){var n=[];return this.forEach(function(t,e){n.push(e)}),n},entries:function(){var n=[];return this.forEach(function(t,e){n.push({key:t,value:e})}),n},size:c,empty:s,forEach:function(n){for(var t in this)t.charCodeAt(0)===ca&&n.call(this,t.substring(1),this[t])}});var aa="\x00",ca=aa.charCodeAt(0);Xo.nest=function(){function n(t,a,c){if(c>=o.length)return r?r.call(i,a):e?a.sort(e):a;for(var s,l,f,h,g=-1,p=a.length,v=o[c++],d=new u;++g<p;)(h=d.get(s=v(l=a[g])))?h.push(l):d.set(s,[l]);return t?(l=t(),f=function(e,r){l.set(e,n(t,r,c))}):(l={},f=function(e,r){l[e]=n(t,r,c)}),d.forEach(f),l}function t(n,e){if(e>=o.length)return n;var r=[],u=a[e++];return n.forEach(function(n,u){r.push({key:n,values:t(u,e)})}),u?r.sort(function(n,t){return u(n.key,t.key)}):r}var e,r,i={},o=[],a=[];return i.map=function(t,e){return n(e,t,0)},i.entries=function(e){return t(n(Xo.map,e,0),0)},i.key=function(n){return o.push(n),i},i.sortKeys=function(n){return a[o.length-1]=n,i},i.sortValues=function(n){return e=n,i},i.rollup=function(n){return r=n,i},i},Xo.set=function(n){var t=new l;if(n)for(var e=0,r=n.length;r>e;++e)t.add(n[e]);return t},r(l,{has:i,add:function(n){return this[aa+n]=!0,n},remove:function(n){return n=aa+n,n in this&&delete this[n]},values:a,size:c,empty:s,forEach:function(n){for(var t in this)t.charCodeAt(0)===ca&&n.call(this,t.substring(1))}}),Xo.behavior={},Xo.rebind=function(n,t){for(var e,r=1,u=arguments.length;++r<u;)n[e=arguments[r]]=f(n,t,t[e]);return n};var sa=["webkit","ms","moz","Moz","o","O"];Xo.dispatch=function(){for(var n=new p,t=-1,e=arguments.length;++t<e;)n[arguments[t]]=v(n);return n},p.prototype.on=function(n,t){var e=n.indexOf("."),r="";if(e>=0&&(r=n.substring(e+1),n=n.substring(0,e)),n)return arguments.length<2?this[n].on(r):this[n].on(r,t);if(2===arguments.length){if(null==t)for(n in this)this.hasOwnProperty(n)&&this[n].on(r,null);return this}},Xo.event=null,Xo.requote=function(n){return n.replace(la,"\\$&")};var la=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,fa={}.__proto__?function(n,t){n.__proto__=t}:function(n,t){for(var e in t)n[e]=t[e]},ha=function(n,t){return t.querySelector(n)},ga=function(n,t){return t.querySelectorAll(n)},pa=Jo[h(Jo,"matchesSelector")],va=function(n,t){return pa.call(n,t)};"function"==typeof Sizzle&&(ha=function(n,t){return Sizzle(n,t)[0]||null},ga=Sizzle,va=Sizzle.matchesSelector),Xo.selection=function(){return xa};var da=Xo.selection.prototype=[];da.select=function(n){var t,e,r,u,i=[];n=M(n);for(var o=-1,a=this.length;++o<a;){i.push(t=[]),t.parentNode=(r=this[o]).parentNode;for(var c=-1,s=r.length;++c<s;)(u=r[c])?(t.push(e=n.call(u,u.__data__,c,o)),e&&"__data__"in u&&(e.__data__=u.__data__)):t.push(null)}return x(i)},da.selectAll=function(n){var t,e,r=[];n=_(n);for(var u=-1,i=this.length;++u<i;)for(var o=this[u],a=-1,c=o.length;++a<c;)(e=o[a])&&(r.push(t=Bo(n.call(e,e.__data__,a,u))),t.parentNode=e);return x(r)};var ma={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};Xo.ns={prefix:ma,qualify:function(n){var t=n.indexOf(":"),e=n;return t>=0&&(e=n.substring(0,t),n=n.substring(t+1)),ma.hasOwnProperty(e)?{space:ma[e],local:n}:n}},da.attr=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node();return n=Xo.ns.qualify(n),n.local?e.getAttributeNS(n.space,n.local):e.getAttribute(n)}for(t in n)this.each(b(t,n[t]));return this}return this.each(b(n,t))},da.classed=function(n,t){if(arguments.length<2){if("string"==typeof n){var e=this.node(),r=(n=k(n)).length,u=-1;if(t=e.classList){for(;++u<r;)if(!t.contains(n[u]))return!1}else for(t=e.getAttribute("class");++u<r;)if(!S(n[u]).test(t))return!1;return!0}for(t in n)this.each(E(t,n[t]));return this}return this.each(E(n,t))},da.style=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t="");for(e in n)this.each(C(e,n[e],t));return this}if(2>r)return Go.getComputedStyle(this.node(),null).getPropertyValue(n);e=""}return this.each(C(n,t,e))},da.property=function(n,t){if(arguments.length<2){if("string"==typeof n)return this.node()[n];for(t in n)this.each(N(t,n[t]));return this}return this.each(N(n,t))},da.text=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.textContent=null==t?"":t}:null==n?function(){this.textContent=""}:function(){this.textContent=n}):this.node().textContent},da.html=function(n){return arguments.length?this.each("function"==typeof n?function(){var t=n.apply(this,arguments);this.innerHTML=null==t?"":t}:null==n?function(){this.innerHTML=""}:function(){this.innerHTML=n}):this.node().innerHTML},da.append=function(n){return n=L(n),this.select(function(){return this.appendChild(n.apply(this,arguments))})},da.insert=function(n,t){return n=L(n),t=M(t),this.select(function(){return this.insertBefore(n.apply(this,arguments),t.apply(this,arguments)||null)})},da.remove=function(){return this.each(function(){var n=this.parentNode;n&&n.removeChild(this)})},da.data=function(n,t){function e(n,e){var r,i,o,a=n.length,f=e.length,h=Math.min(a,f),g=new Array(f),p=new Array(f),v=new Array(a);if(t){var d,m=new u,y=new u,x=[];for(r=-1;++r<a;)d=t.call(i=n[r],i.__data__,r),m.has(d)?v[r]=i:m.set(d,i),x.push(d);for(r=-1;++r<f;)d=t.call(e,o=e[r],r),(i=m.get(d))?(g[r]=i,i.__data__=o):y.has(d)||(p[r]=T(o)),y.set(d,o),m.remove(d);for(r=-1;++r<a;)m.has(x[r])&&(v[r]=n[r])}else{for(r=-1;++r<h;)i=n[r],o=e[r],i?(i.__data__=o,g[r]=i):p[r]=T(o);for(;f>r;++r)p[r]=T(e[r]);for(;a>r;++r)v[r]=n[r]}p.update=g,p.parentNode=g.parentNode=v.parentNode=n.parentNode,c.push(p),s.push(g),l.push(v)}var r,i,o=-1,a=this.length;if(!arguments.length){for(n=new Array(a=(r=this[0]).length);++o<a;)(i=r[o])&&(n[o]=i.__data__);return n}var c=D([]),s=x([]),l=x([]);if("function"==typeof n)for(;++o<a;)e(r=this[o],n.call(r,r.parentNode.__data__,o));else for(;++o<a;)e(r=this[o],n);return s.enter=function(){return c},s.exit=function(){return l},s},da.datum=function(n){return arguments.length?this.property("__data__",n):this.property("__data__")},da.filter=function(n){var t,e,r,u=[];"function"!=typeof n&&(n=q(n));for(var i=0,o=this.length;o>i;i++){u.push(t=[]),t.parentNode=(e=this[i]).parentNode;for(var a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return x(u)},da.order=function(){for(var n=-1,t=this.length;++n<t;)for(var e,r=this[n],u=r.length-1,i=r[u];--u>=0;)(e=r[u])&&(i&&i!==e.nextSibling&&i.parentNode.insertBefore(e,i),i=e);return this},da.sort=function(n){n=z.apply(this,arguments);for(var t=-1,e=this.length;++t<e;)this[t].sort(n);return this.order()},da.each=function(n){return R(this,function(t,e,r){n.call(t,t.__data__,e,r)})},da.call=function(n){var t=Bo(arguments);return n.apply(t[0]=this,t),this},da.empty=function(){return!this.node()},da.node=function(){for(var n=0,t=this.length;t>n;n++)for(var e=this[n],r=0,u=e.length;u>r;r++){var i=e[r];if(i)return i}return null},da.size=function(){var n=0;return this.each(function(){++n}),n};var ya=[];Xo.selection.enter=D,Xo.selection.enter.prototype=ya,ya.append=da.append,ya.empty=da.empty,ya.node=da.node,ya.call=da.call,ya.size=da.size,ya.select=function(n){for(var t,e,r,u,i,o=[],a=-1,c=this.length;++a<c;){r=(u=this[a]).update,o.push(t=[]),t.parentNode=u.parentNode;for(var s=-1,l=u.length;++s<l;)(i=u[s])?(t.push(r[s]=e=n.call(u.parentNode,i.__data__,s,a)),e.__data__=i.__data__):t.push(null)}return x(o)},ya.insert=function(n,t){return arguments.length<2&&(t=P(this)),da.insert.call(this,n,t)},da.transition=function(){for(var n,t,e=ks||++Ls,r=[],u=Es||{time:Date.now(),ease:yu,delay:0,duration:250},i=-1,o=this.length;++i<o;){r.push(n=[]);for(var a=this[i],c=-1,s=a.length;++c<s;)(t=a[c])&&jo(t,c,e,u),n.push(t)}return Do(r,e)},da.interrupt=function(){return this.each(U)},Xo.select=function(n){var t=["string"==typeof n?ha(n,Wo):n];return t.parentNode=Jo,x([t])},Xo.selectAll=function(n){var t=Bo("string"==typeof n?ga(n,Wo):n);return t.parentNode=Jo,x([t])};var xa=Xo.select(Jo);da.on=function(n,t,e){var r=arguments.length;if(3>r){if("string"!=typeof n){2>r&&(t=!1);for(e in n)this.each(j(e,n[e],t));return this}if(2>r)return(r=this.node()["__on"+n])&&r._;e=!1}return this.each(j(n,t,e))};var Ma=Xo.map({mouseenter:"mouseover",mouseleave:"mouseout"});Ma.forEach(function(n){"on"+n in Wo&&Ma.remove(n)});var _a="onselectstart"in Wo?null:h(Jo.style,"userSelect"),ba=0;Xo.mouse=function(n){return Y(n,m())};var wa=/WebKit/.test(Go.navigator.userAgent)?-1:0;Xo.touches=function(n,t){return arguments.length<2&&(t=m().touches),t?Bo(t).map(function(t){var e=Y(n,t);return e.identifier=t.identifier,e}):[]},Xo.behavior.drag=function(){function n(){this.on("mousedown.drag",o).on("touchstart.drag",a)}function t(){return Xo.event.changedTouches[0].identifier}function e(n,t){return Xo.touches(n).filter(function(n){return n.identifier===t})[0]}function r(n,t,e,r){return function(){function o(){var n=t(l,g),e=n[0]-v[0],r=n[1]-v[1];d|=e|r,v=n,f({type:"drag",x:n[0]+c[0],y:n[1]+c[1],dx:e,dy:r})}function a(){m.on(e+"."+p,null).on(r+"."+p,null),y(d&&Xo.event.target===h),f({type:"dragend"})}var c,s=this,l=s.parentNode,f=u.of(s,arguments),h=Xo.event.target,g=n(),p=null==g?"drag":"drag-"+g,v=t(l,g),d=0,m=Xo.select(Go).on(e+"."+p,o).on(r+"."+p,a),y=O();i?(c=i.apply(s,arguments),c=[c.x-v[0],c.y-v[1]]):c=[0,0],f({type:"dragstart"})}}var u=y(n,"drag","dragstart","dragend"),i=null,o=r(g,Xo.mouse,"mousemove","mouseup"),a=r(t,e,"touchmove","touchend");return n.origin=function(t){return arguments.length?(i=t,n):i},Xo.rebind(n,u,"on")};var Sa=Math.PI,ka=2*Sa,Ea=Sa/2,Aa=1e-6,Ca=Aa*Aa,Na=Sa/180,La=180/Sa,Ta=Math.SQRT2,qa=2,za=4;Xo.interpolateZoom=function(n,t){function e(n){var t=n*y;if(m){var e=B(v),o=i/(qa*h)*(e*W(Ta*t+v)-$(v));return[r+o*s,u+o*l,i*e/B(Ta*t+v)]}return[r+n*s,u+n*l,i*Math.exp(Ta*t)]}var r=n[0],u=n[1],i=n[2],o=t[0],a=t[1],c=t[2],s=o-r,l=a-u,f=s*s+l*l,h=Math.sqrt(f),g=(c*c-i*i+za*f)/(2*i*qa*h),p=(c*c-i*i-za*f)/(2*c*qa*h),v=Math.log(Math.sqrt(g*g+1)-g),d=Math.log(Math.sqrt(p*p+1)-p),m=d-v,y=(m||Math.log(c/i))/Ta;return e.duration=1e3*y,e},Xo.behavior.zoom=function(){function n(n){n.on(A,s).on(Pa+".zoom",f).on(C,h).on("dblclick.zoom",g).on(L,l)}function t(n){return[(n[0]-S.x)/S.k,(n[1]-S.y)/S.k]}function e(n){return[n[0]*S.k+S.x,n[1]*S.k+S.y]}function r(n){S.k=Math.max(E[0],Math.min(E[1],n))}function u(n,t){t=e(t),S.x+=n[0]-t[0],S.y+=n[1]-t[1]}function i(){_&&_.domain(M.range().map(function(n){return(n-S.x)/S.k}).map(M.invert)),w&&w.domain(b.range().map(function(n){return(n-S.y)/S.k}).map(b.invert))}function o(n){n({type:"zoomstart"})}function a(n){i(),n({type:"zoom",scale:S.k,translate:[S.x,S.y]})}function c(n){n({type:"zoomend"})}function s(){function n(){l=1,u(Xo.mouse(r),g),a(i)}function e(){f.on(C,Go===r?h:null).on(N,null),p(l&&Xo.event.target===s),c(i)}var r=this,i=T.of(r,arguments),s=Xo.event.target,l=0,f=Xo.select(Go).on(C,n).on(N,e),g=t(Xo.mouse(r)),p=O();U.call(r),o(i)}function l(){function n(){var n=Xo.touches(g);return h=S.k,n.forEach(function(n){n.identifier in v&&(v[n.identifier]=t(n))}),n}function e(){for(var t=Xo.event.changedTouches,e=0,i=t.length;i>e;++e)v[t[e].identifier]=null;var o=n(),c=Date.now();if(1===o.length){if(500>c-x){var s=o[0],l=v[s.identifier];r(2*S.k),u(s,l),d(),a(p)}x=c}else if(o.length>1){var s=o[0],f=o[1],h=s[0]-f[0],g=s[1]-f[1];m=h*h+g*g}}function i(){for(var n,t,e,i,o=Xo.touches(g),c=0,s=o.length;s>c;++c,i=null)if(e=o[c],i=v[e.identifier]){if(t)break;n=e,t=i}if(i){var l=(l=e[0]-n[0])*l+(l=e[1]-n[1])*l,f=m&&Math.sqrt(l/m);n=[(n[0]+e[0])/2,(n[1]+e[1])/2],t=[(t[0]+i[0])/2,(t[1]+i[1])/2],r(f*h)}x=null,u(n,t),a(p)}function f(){if(Xo.event.touches.length){for(var t=Xo.event.changedTouches,e=0,r=t.length;r>e;++e)delete v[t[e].identifier];for(var u in v)return void n()}b.on(M,null).on(_,null),w.on(A,s).on(L,l),k(),c(p)}var h,g=this,p=T.of(g,arguments),v={},m=0,y=Xo.event.changedTouches[0].identifier,M="touchmove.zoom-"+y,_="touchend.zoom-"+y,b=Xo.select(Go).on(M,i).on(_,f),w=Xo.select(g).on(A,null).on(L,e),k=O();U.call(g),e(),o(p)}function f(){var n=T.of(this,arguments);m?clearTimeout(m):(U.call(this),o(n)),m=setTimeout(function(){m=null,c(n)},50),d();var e=v||Xo.mouse(this);p||(p=t(e)),r(Math.pow(2,.002*Ra())*S.k),u(e,p),a(n)}function h(){p=null}function g(){var n=T.of(this,arguments),e=Xo.mouse(this),i=t(e),s=Math.log(S.k)/Math.LN2;o(n),r(Math.pow(2,Xo.event.shiftKey?Math.ceil(s)-1:Math.floor(s)+1)),u(e,i),a(n),c(n)}var p,v,m,x,M,_,b,w,S={x:0,y:0,k:1},k=[960,500],E=Da,A="mousedown.zoom",C="mousemove.zoom",N="mouseup.zoom",L="touchstart.zoom",T=y(n,"zoomstart","zoom","zoomend");return n.event=function(n){n.each(function(){var n=T.of(this,arguments),t=S;ks?Xo.select(this).transition().each("start.zoom",function(){S=this.__chart__||{x:0,y:0,k:1},o(n)}).tween("zoom:zoom",function(){var e=k[0],r=k[1],u=e/2,i=r/2,o=Xo.interpolateZoom([(u-S.x)/S.k,(i-S.y)/S.k,e/S.k],[(u-t.x)/t.k,(i-t.y)/t.k,e/t.k]);return function(t){var r=o(t),c=e/r[2];this.__chart__=S={x:u-r[0]*c,y:i-r[1]*c,k:c},a(n)}}).each("end.zoom",function(){c(n)}):(this.__chart__=S,o(n),a(n),c(n))})},n.translate=function(t){return arguments.length?(S={x:+t[0],y:+t[1],k:S.k},i(),n):[S.x,S.y]},n.scale=function(t){return arguments.length?(S={x:S.x,y:S.y,k:+t},i(),n):S.k},n.scaleExtent=function(t){return arguments.length?(E=null==t?Da:[+t[0],+t[1]],n):E},n.center=function(t){return arguments.length?(v=t&&[+t[0],+t[1]],n):v},n.size=function(t){return arguments.length?(k=t&&[+t[0],+t[1]],n):k},n.x=function(t){return arguments.length?(_=t,M=t.copy(),S={x:0,y:0,k:1},n):_},n.y=function(t){return arguments.length?(w=t,b=t.copy(),S={x:0,y:0,k:1},n):w},Xo.rebind(n,T,"on")};var Ra,Da=[0,1/0],Pa="onwheel"in Wo?(Ra=function(){return-Xo.event.deltaY*(Xo.event.deltaMode?120:1)},"wheel"):"onmousewheel"in Wo?(Ra=function(){return Xo.event.wheelDelta},"mousewheel"):(Ra=function(){return-Xo.event.detail},"MozMousePixelScroll");G.prototype.toString=function(){return this.rgb()+""},Xo.hsl=function(n,t,e){return 1===arguments.length?n instanceof Q?K(n.h,n.s,n.l):dt(""+n,mt,K):K(+n,+t,+e)};var Ua=Q.prototype=new G;Ua.brighter=function(n){return n=Math.pow(.7,arguments.length?n:1),K(this.h,this.s,this.l/n)},Ua.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),K(this.h,this.s,n*this.l)},Ua.rgb=function(){return nt(this.h,this.s,this.l)},Xo.hcl=function(n,t,e){return 1===arguments.length?n instanceof et?tt(n.h,n.c,n.l):n instanceof it?at(n.l,n.a,n.b):at((n=yt((n=Xo.rgb(n)).r,n.g,n.b)).l,n.a,n.b):tt(+n,+t,+e)};var ja=et.prototype=new G;ja.brighter=function(n){return tt(this.h,this.c,Math.min(100,this.l+Ha*(arguments.length?n:1)))},ja.darker=function(n){return tt(this.h,this.c,Math.max(0,this.l-Ha*(arguments.length?n:1)))},ja.rgb=function(){return rt(this.h,this.c,this.l).rgb()},Xo.lab=function(n,t,e){return 1===arguments.length?n instanceof it?ut(n.l,n.a,n.b):n instanceof et?rt(n.l,n.c,n.h):yt((n=Xo.rgb(n)).r,n.g,n.b):ut(+n,+t,+e)};var Ha=18,Fa=.95047,Oa=1,Ya=1.08883,Ia=it.prototype=new G;Ia.brighter=function(n){return ut(Math.min(100,this.l+Ha*(arguments.length?n:1)),this.a,this.b)},Ia.darker=function(n){return ut(Math.max(0,this.l-Ha*(arguments.length?n:1)),this.a,this.b)},Ia.rgb=function(){return ot(this.l,this.a,this.b)},Xo.rgb=function(n,t,e){return 1===arguments.length?n instanceof pt?gt(n.r,n.g,n.b):dt(""+n,gt,nt):gt(~~n,~~t,~~e)};var Za=pt.prototype=new G;Za.brighter=function(n){n=Math.pow(.7,arguments.length?n:1);var t=this.r,e=this.g,r=this.b,u=30;return t||e||r?(t&&u>t&&(t=u),e&&u>e&&(e=u),r&&u>r&&(r=u),gt(Math.min(255,~~(t/n)),Math.min(255,~~(e/n)),Math.min(255,~~(r/n)))):gt(u,u,u)},Za.darker=function(n){return n=Math.pow(.7,arguments.length?n:1),gt(~~(n*this.r),~~(n*this.g),~~(n*this.b))},Za.hsl=function(){return mt(this.r,this.g,this.b)},Za.toString=function(){return"#"+vt(this.r)+vt(this.g)+vt(this.b)};var Va=Xo.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});Va.forEach(function(n,t){Va.set(n,ft(t))}),Xo.functor=_t,Xo.xhr=wt(bt),Xo.dsv=function(n,t){function e(n,e,i){arguments.length<3&&(i=e,e=null);var o=St(n,t,null==e?r:u(e),i);return o.row=function(n){return arguments.length?o.response(null==(e=n)?r:u(n)):e},o}function r(n){return e.parse(n.responseText)}function u(n){return function(t){return e.parse(t.responseText,n)}}function i(t){return t.map(o).join(n)}function o(n){return a.test(n)?'"'+n.replace(/\"/g,'""')+'"':n}var a=new RegExp('["'+n+"\n]"),c=n.charCodeAt(0);return e.parse=function(n,t){var r;return e.parseRows(n,function(n,e){if(r)return r(n,e-1);var u=new Function("d","return {"+n.map(function(n,t){return JSON.stringify(n)+": d["+t+"]"}).join(",")+"}");r=t?function(n,e){return t(u(n),e)}:u})},e.parseRows=function(n,t){function e(){if(l>=s)return o;if(u)return u=!1,i;var t=l;if(34===n.charCodeAt(t)){for(var e=t;e++<s;)if(34===n.charCodeAt(e)){if(34!==n.charCodeAt(e+1))break;++e}l=e+2;var r=n.charCodeAt(e+1);return 13===r?(u=!0,10===n.charCodeAt(e+2)&&++l):10===r&&(u=!0),n.substring(t+1,e).replace(/""/g,'"')}for(;s>l;){var r=n.charCodeAt(l++),a=1;if(10===r)u=!0;else if(13===r)u=!0,10===n.charCodeAt(l)&&(++l,++a);else if(r!==c)continue;return n.substring(t,l-a)}return n.substring(t)}for(var r,u,i={},o={},a=[],s=n.length,l=0,f=0;(r=e())!==o;){for(var h=[];r!==i&&r!==o;)h.push(r),r=e();(!t||(h=t(h,f++)))&&a.push(h)}return a},e.format=function(t){if(Array.isArray(t[0]))return e.formatRows(t);var r=new l,u=[];return t.forEach(function(n){for(var t in n)r.has(t)||u.push(r.add(t))}),[u.map(o).join(n)].concat(t.map(function(t){return u.map(function(n){return o(t[n])}).join(n)})).join("\n")},e.formatRows=function(n){return n.map(i).join("\n")},e},Xo.csv=Xo.dsv(",","text/csv"),Xo.tsv=Xo.dsv(" ","text/tab-separated-values");var Xa,$a,Ba,Wa,Ja,Ga=Go[h(Go,"requestAnimationFrame")]||function(n){setTimeout(n,17)};Xo.timer=function(n,t,e){var r=arguments.length;2>r&&(t=0),3>r&&(e=Date.now());var u=e+t,i={c:n,t:u,f:!1,n:null};$a?$a.n=i:Xa=i,$a=i,Ba||(Wa=clearTimeout(Wa),Ba=1,Ga(Et))},Xo.timer.flush=function(){At(),Ct()},Xo.round=function(n,t){return t?Math.round(n*(t=Math.pow(10,t)))/t:Math.round(n)};var Ka=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(Lt);Xo.formatPrefix=function(n,t){var e=0;return n&&(0>n&&(n*=-1),t&&(n=Xo.round(n,Nt(n,t))),e=1+Math.floor(1e-12+Math.log(n)/Math.LN10),e=Math.max(-24,Math.min(24,3*Math.floor((0>=e?e+1:e-1)/3)))),Ka[8+e/3]};var Qa=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,nc=Xo.map({b:function(n){return n.toString(2)},c:function(n){return String.fromCharCode(n)},o:function(n){return n.toString(8)},x:function(n){return n.toString(16)},X:function(n){return n.toString(16).toUpperCase()},g:function(n,t){return n.toPrecision(t)},e:function(n,t){return n.toExponential(t)},f:function(n,t){return n.toFixed(t)},r:function(n,t){return(n=Xo.round(n,Nt(n,t))).toFixed(Math.max(0,Math.min(20,Nt(n*(1+1e-15),t))))}}),tc=Xo.time={},ec=Date;zt.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){rc.setUTCDate.apply(this._,arguments)},setDay:function(){rc.setUTCDay.apply(this._,arguments)},setFullYear:function(){rc.setUTCFullYear.apply(this._,arguments)},setHours:function(){rc.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){rc.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){rc.setUTCMinutes.apply(this._,arguments)},setMonth:function(){rc.setUTCMonth.apply(this._,arguments)},setSeconds:function(){rc.setUTCSeconds.apply(this._,arguments)},setTime:function(){rc.setTime.apply(this._,arguments)}};var rc=Date.prototype;tc.year=Rt(function(n){return n=tc.day(n),n.setMonth(0,1),n},function(n,t){n.setFullYear(n.getFullYear()+t)},function(n){return n.getFullYear()}),tc.years=tc.year.range,tc.years.utc=tc.year.utc.range,tc.day=Rt(function(n){var t=new ec(2e3,0);return t.setFullYear(n.getFullYear(),n.getMonth(),n.getDate()),t},function(n,t){n.setDate(n.getDate()+t)},function(n){return n.getDate()-1}),tc.days=tc.day.range,tc.days.utc=tc.day.utc.range,tc.dayOfYear=function(n){var t=tc.year(n);return Math.floor((n-t-6e4*(n.getTimezoneOffset()-t.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(n,t){t=7-t;var e=tc[n]=Rt(function(n){return(n=tc.day(n)).setDate(n.getDate()-(n.getDay()+t)%7),n},function(n,t){n.setDate(n.getDate()+7*Math.floor(t))},function(n){var e=tc.year(n).getDay();return Math.floor((tc.dayOfYear(n)+(e+t)%7)/7)-(e!==t)});tc[n+"s"]=e.range,tc[n+"s"].utc=e.utc.range,tc[n+"OfYear"]=function(n){var e=tc.year(n).getDay();return Math.floor((tc.dayOfYear(n)+(e+t)%7)/7)}}),tc.week=tc.sunday,tc.weeks=tc.sunday.range,tc.weeks.utc=tc.sunday.utc.range,tc.weekOfYear=tc.sundayOfYear;var uc={"-":"",_:" ",0:"0"},ic=/^\s*\d+/,oc=/^%/;Xo.locale=function(n){return{numberFormat:Tt(n),timeFormat:Pt(n)}};var ac=Xo.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});Xo.format=ac.numberFormat,Xo.geo={},re.prototype={s:0,t:0,add:function(n){ue(n,this.t,cc),ue(cc.s,this.s,this),this.s?this.t+=cc.t:this.s=cc.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var cc=new re;Xo.geo.stream=function(n,t){n&&sc.hasOwnProperty(n.type)?sc[n.type](n,t):ie(n,t)};var sc={Feature:function(n,t){ie(n.geometry,t)},FeatureCollection:function(n,t){for(var e=n.features,r=-1,u=e.length;++r<u;)ie(e[r].geometry,t)}},lc={Sphere:function(n,t){t.sphere()},Point:function(n,t){n=n.coordinates,t.point(n[0],n[1],n[2])},MultiPoint:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)n=e[r],t.point(n[0],n[1],n[2])},LineString:function(n,t){oe(n.coordinates,t,0)},MultiLineString:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)oe(e[r],t,0)},Polygon:function(n,t){ae(n.coordinates,t)},MultiPolygon:function(n,t){for(var e=n.coordinates,r=-1,u=e.length;++r<u;)ae(e[r],t)},GeometryCollection:function(n,t){for(var e=n.geometries,r=-1,u=e.length;++r<u;)ie(e[r],t)}};Xo.geo.area=function(n){return fc=0,Xo.geo.stream(n,gc),fc};var fc,hc=new re,gc={sphere:function(){fc+=4*Sa},point:g,lineStart:g,lineEnd:g,polygonStart:function(){hc.reset(),gc.lineStart=ce},polygonEnd:function(){var n=2*hc;fc+=0>n?4*Sa+n:n,gc.lineStart=gc.lineEnd=gc.point=g}};Xo.geo.bounds=function(){function n(n,t){x.push(M=[l=n,h=n]),f>t&&(f=t),t>g&&(g=t)}function t(t,e){var r=se([t*Na,e*Na]);if(m){var u=fe(m,r),i=[u[1],-u[0],0],o=fe(i,u);pe(o),o=ve(o);var c=t-p,s=c>0?1:-1,v=o[0]*La*s,d=oa(c)>180;if(d^(v>s*p&&s*t>v)){var y=o[1]*La;y>g&&(g=y)}else if(v=(v+360)%360-180,d^(v>s*p&&s*t>v)){var y=-o[1]*La;f>y&&(f=y)}else f>e&&(f=e),e>g&&(g=e);d?p>t?a(l,t)>a(l,h)&&(h=t):a(t,h)>a(l,h)&&(l=t):h>=l?(l>t&&(l=t),t>h&&(h=t)):t>p?a(l,t)>a(l,h)&&(h=t):a(t,h)>a(l,h)&&(l=t)}else n(t,e);m=r,p=t}function e(){_.point=t}function r(){M[0]=l,M[1]=h,_.point=n,m=null}function u(n,e){if(m){var r=n-p;y+=oa(r)>180?r+(r>0?360:-360):r}else v=n,d=e;gc.point(n,e),t(n,e)}function i(){gc.lineStart()}function o(){u(v,d),gc.lineEnd(),oa(y)>Aa&&(l=-(h=180)),M[0]=l,M[1]=h,m=null}function a(n,t){return(t-=n)<0?t+360:t}function c(n,t){return n[0]-t[0]}function s(n,t){return t[0]<=t[1]?t[0]<=n&&n<=t[1]:n<t[0]||t[1]<n}var l,f,h,g,p,v,d,m,y,x,M,_={point:n,lineStart:e,lineEnd:r,polygonStart:function(){_.point=u,_.lineStart=i,_.lineEnd=o,y=0,gc.polygonStart()},polygonEnd:function(){gc.polygonEnd(),_.point=n,_.lineStart=e,_.lineEnd=r,0>hc?(l=-(h=180),f=-(g=90)):y>Aa?g=90:-Aa>y&&(f=-90),M[0]=l,M[1]=h}};return function(n){g=h=-(l=f=1/0),x=[],Xo.geo.stream(n,_);
-var t=x.length;if(t){x.sort(c);for(var e,r=1,u=x[0],i=[u];t>r;++r)e=x[r],s(e[0],u)||s(e[1],u)?(a(u[0],e[1])>a(u[0],u[1])&&(u[1]=e[1]),a(e[0],u[1])>a(u[0],u[1])&&(u[0]=e[0])):i.push(u=e);for(var o,e,p=-1/0,t=i.length-1,r=0,u=i[t];t>=r;u=e,++r)e=i[r],(o=a(u[1],e[0]))>p&&(p=o,l=e[0],h=u[1])}return x=M=null,1/0===l||1/0===f?[[0/0,0/0],[0/0,0/0]]:[[l,f],[h,g]]}}(),Xo.geo.centroid=function(n){pc=vc=dc=mc=yc=xc=Mc=_c=bc=wc=Sc=0,Xo.geo.stream(n,kc);var t=bc,e=wc,r=Sc,u=t*t+e*e+r*r;return Ca>u&&(t=xc,e=Mc,r=_c,Aa>vc&&(t=dc,e=mc,r=yc),u=t*t+e*e+r*r,Ca>u)?[0/0,0/0]:[Math.atan2(e,t)*La,X(r/Math.sqrt(u))*La]};var pc,vc,dc,mc,yc,xc,Mc,_c,bc,wc,Sc,kc={sphere:g,point:me,lineStart:xe,lineEnd:Me,polygonStart:function(){kc.lineStart=_e},polygonEnd:function(){kc.lineStart=xe}},Ec=Ee(be,Te,ze,[-Sa,-Sa/2]),Ac=1e9;Xo.geo.clipExtent=function(){var n,t,e,r,u,i,o={stream:function(n){return u&&(u.valid=!1),u=i(n),u.valid=!0,u},extent:function(a){return arguments.length?(i=Pe(n=+a[0][0],t=+a[0][1],e=+a[1][0],r=+a[1][1]),u&&(u.valid=!1,u=null),o):[[n,t],[e,r]]}};return o.extent([[0,0],[960,500]])},(Xo.geo.conicEqualArea=function(){return je(He)}).raw=He,Xo.geo.albers=function(){return Xo.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},Xo.geo.albersUsa=function(){function n(n){var i=n[0],o=n[1];return t=null,e(i,o),t||(r(i,o),t)||u(i,o),t}var t,e,r,u,i=Xo.geo.albers(),o=Xo.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),a=Xo.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(n,e){t=[n,e]}};return n.invert=function(n){var t=i.scale(),e=i.translate(),r=(n[0]-e[0])/t,u=(n[1]-e[1])/t;return(u>=.12&&.234>u&&r>=-.425&&-.214>r?o:u>=.166&&.234>u&&r>=-.214&&-.115>r?a:i).invert(n)},n.stream=function(n){var t=i.stream(n),e=o.stream(n),r=a.stream(n);return{point:function(n,u){t.point(n,u),e.point(n,u),r.point(n,u)},sphere:function(){t.sphere(),e.sphere(),r.sphere()},lineStart:function(){t.lineStart(),e.lineStart(),r.lineStart()},lineEnd:function(){t.lineEnd(),e.lineEnd(),r.lineEnd()},polygonStart:function(){t.polygonStart(),e.polygonStart(),r.polygonStart()},polygonEnd:function(){t.polygonEnd(),e.polygonEnd(),r.polygonEnd()}}},n.precision=function(t){return arguments.length?(i.precision(t),o.precision(t),a.precision(t),n):i.precision()},n.scale=function(t){return arguments.length?(i.scale(t),o.scale(.35*t),a.scale(t),n.translate(i.translate())):i.scale()},n.translate=function(t){if(!arguments.length)return i.translate();var s=i.scale(),l=+t[0],f=+t[1];return e=i.translate(t).clipExtent([[l-.455*s,f-.238*s],[l+.455*s,f+.238*s]]).stream(c).point,r=o.translate([l-.307*s,f+.201*s]).clipExtent([[l-.425*s+Aa,f+.12*s+Aa],[l-.214*s-Aa,f+.234*s-Aa]]).stream(c).point,u=a.translate([l-.205*s,f+.212*s]).clipExtent([[l-.214*s+Aa,f+.166*s+Aa],[l-.115*s-Aa,f+.234*s-Aa]]).stream(c).point,n},n.scale(1070)};var Cc,Nc,Lc,Tc,qc,zc,Rc={point:g,lineStart:g,lineEnd:g,polygonStart:function(){Nc=0,Rc.lineStart=Fe},polygonEnd:function(){Rc.lineStart=Rc.lineEnd=Rc.point=g,Cc+=oa(Nc/2)}},Dc={point:Oe,lineStart:g,lineEnd:g,polygonStart:g,polygonEnd:g},Pc={point:Ze,lineStart:Ve,lineEnd:Xe,polygonStart:function(){Pc.lineStart=$e},polygonEnd:function(){Pc.point=Ze,Pc.lineStart=Ve,Pc.lineEnd=Xe}};Xo.geo.path=function(){function n(n){return n&&("function"==typeof a&&i.pointRadius(+a.apply(this,arguments)),o&&o.valid||(o=u(i)),Xo.geo.stream(n,o)),i.result()}function t(){return o=null,n}var e,r,u,i,o,a=4.5;return n.area=function(n){return Cc=0,Xo.geo.stream(n,u(Rc)),Cc},n.centroid=function(n){return dc=mc=yc=xc=Mc=_c=bc=wc=Sc=0,Xo.geo.stream(n,u(Pc)),Sc?[bc/Sc,wc/Sc]:_c?[xc/_c,Mc/_c]:yc?[dc/yc,mc/yc]:[0/0,0/0]},n.bounds=function(n){return qc=zc=-(Lc=Tc=1/0),Xo.geo.stream(n,u(Dc)),[[Lc,Tc],[qc,zc]]},n.projection=function(n){return arguments.length?(u=(e=n)?n.stream||Je(n):bt,t()):e},n.context=function(n){return arguments.length?(i=null==(r=n)?new Ye:new Be(n),"function"!=typeof a&&i.pointRadius(a),t()):r},n.pointRadius=function(t){return arguments.length?(a="function"==typeof t?t:(i.pointRadius(+t),+t),n):a},n.projection(Xo.geo.albersUsa()).context(null)},Xo.geo.transform=function(n){return{stream:function(t){var e=new Ge(t);for(var r in n)e[r]=n[r];return e}}},Ge.prototype={point:function(n,t){this.stream.point(n,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},Xo.geo.projection=Qe,Xo.geo.projectionMutator=nr,(Xo.geo.equirectangular=function(){return Qe(er)}).raw=er.invert=er,Xo.geo.rotation=function(n){function t(t){return t=n(t[0]*Na,t[1]*Na),t[0]*=La,t[1]*=La,t}return n=ur(n[0]%360*Na,n[1]*Na,n.length>2?n[2]*Na:0),t.invert=function(t){return t=n.invert(t[0]*Na,t[1]*Na),t[0]*=La,t[1]*=La,t},t},rr.invert=er,Xo.geo.circle=function(){function n(){var n="function"==typeof r?r.apply(this,arguments):r,t=ur(-n[0]*Na,-n[1]*Na,0).invert,u=[];return e(null,null,1,{point:function(n,e){u.push(n=t(n,e)),n[0]*=La,n[1]*=La}}),{type:"Polygon",coordinates:[u]}}var t,e,r=[0,0],u=6;return n.origin=function(t){return arguments.length?(r=t,n):r},n.angle=function(r){return arguments.length?(e=cr((t=+r)*Na,u*Na),n):t},n.precision=function(r){return arguments.length?(e=cr(t*Na,(u=+r)*Na),n):u},n.angle(90)},Xo.geo.distance=function(n,t){var e,r=(t[0]-n[0])*Na,u=n[1]*Na,i=t[1]*Na,o=Math.sin(r),a=Math.cos(r),c=Math.sin(u),s=Math.cos(u),l=Math.sin(i),f=Math.cos(i);return Math.atan2(Math.sqrt((e=f*o)*e+(e=s*l-c*f*a)*e),c*l+s*f*a)},Xo.geo.graticule=function(){function n(){return{type:"MultiLineString",coordinates:t()}}function t(){return Xo.range(Math.ceil(i/d)*d,u,d).map(h).concat(Xo.range(Math.ceil(s/m)*m,c,m).map(g)).concat(Xo.range(Math.ceil(r/p)*p,e,p).filter(function(n){return oa(n%d)>Aa}).map(l)).concat(Xo.range(Math.ceil(a/v)*v,o,v).filter(function(n){return oa(n%m)>Aa}).map(f))}var e,r,u,i,o,a,c,s,l,f,h,g,p=10,v=p,d=90,m=360,y=2.5;return n.lines=function(){return t().map(function(n){return{type:"LineString",coordinates:n}})},n.outline=function(){return{type:"Polygon",coordinates:[h(i).concat(g(c).slice(1),h(u).reverse().slice(1),g(s).reverse().slice(1))]}},n.extent=function(t){return arguments.length?n.majorExtent(t).minorExtent(t):n.minorExtent()},n.majorExtent=function(t){return arguments.length?(i=+t[0][0],u=+t[1][0],s=+t[0][1],c=+t[1][1],i>u&&(t=i,i=u,u=t),s>c&&(t=s,s=c,c=t),n.precision(y)):[[i,s],[u,c]]},n.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],a=+t[0][1],o=+t[1][1],r>e&&(t=r,r=e,e=t),a>o&&(t=a,a=o,o=t),n.precision(y)):[[r,a],[e,o]]},n.step=function(t){return arguments.length?n.majorStep(t).minorStep(t):n.minorStep()},n.majorStep=function(t){return arguments.length?(d=+t[0],m=+t[1],n):[d,m]},n.minorStep=function(t){return arguments.length?(p=+t[0],v=+t[1],n):[p,v]},n.precision=function(t){return arguments.length?(y=+t,l=lr(a,o,90),f=fr(r,e,y),h=lr(s,c,90),g=fr(i,u,y),n):y},n.majorExtent([[-180,-90+Aa],[180,90-Aa]]).minorExtent([[-180,-80-Aa],[180,80+Aa]])},Xo.geo.greatArc=function(){function n(){return{type:"LineString",coordinates:[t||r.apply(this,arguments),e||u.apply(this,arguments)]}}var t,e,r=hr,u=gr;return n.distance=function(){return Xo.geo.distance(t||r.apply(this,arguments),e||u.apply(this,arguments))},n.source=function(e){return arguments.length?(r=e,t="function"==typeof e?null:e,n):r},n.target=function(t){return arguments.length?(u=t,e="function"==typeof t?null:t,n):u},n.precision=function(){return arguments.length?n:0},n},Xo.geo.interpolate=function(n,t){return pr(n[0]*Na,n[1]*Na,t[0]*Na,t[1]*Na)},Xo.geo.length=function(n){return Uc=0,Xo.geo.stream(n,jc),Uc};var Uc,jc={sphere:g,point:g,lineStart:vr,lineEnd:g,polygonStart:g,polygonEnd:g},Hc=dr(function(n){return Math.sqrt(2/(1+n))},function(n){return 2*Math.asin(n/2)});(Xo.geo.azimuthalEqualArea=function(){return Qe(Hc)}).raw=Hc;var Fc=dr(function(n){var t=Math.acos(n);return t&&t/Math.sin(t)},bt);(Xo.geo.azimuthalEquidistant=function(){return Qe(Fc)}).raw=Fc,(Xo.geo.conicConformal=function(){return je(mr)}).raw=mr,(Xo.geo.conicEquidistant=function(){return je(yr)}).raw=yr;var Oc=dr(function(n){return 1/n},Math.atan);(Xo.geo.gnomonic=function(){return Qe(Oc)}).raw=Oc,xr.invert=function(n,t){return[n,2*Math.atan(Math.exp(t))-Ea]},(Xo.geo.mercator=function(){return Mr(xr)}).raw=xr;var Yc=dr(function(){return 1},Math.asin);(Xo.geo.orthographic=function(){return Qe(Yc)}).raw=Yc;var Ic=dr(function(n){return 1/(1+n)},function(n){return 2*Math.atan(n)});(Xo.geo.stereographic=function(){return Qe(Ic)}).raw=Ic,_r.invert=function(n,t){return[-t,2*Math.atan(Math.exp(n))-Ea]},(Xo.geo.transverseMercator=function(){var n=Mr(_r),t=n.center,e=n.rotate;return n.center=function(n){return n?t([-n[1],n[0]]):(n=t(),[-n[1],n[0]])},n.rotate=function(n){return n?e([n[0],n[1],n.length>2?n[2]+90:90]):(n=e(),[n[0],n[1],n[2]-90])},n.rotate([0,0])}).raw=_r,Xo.geom={},Xo.geom.hull=function(n){function t(n){if(n.length<3)return[];var t,u=_t(e),i=_t(r),o=n.length,a=[],c=[];for(t=0;o>t;t++)a.push([+u.call(this,n[t],t),+i.call(this,n[t],t),t]);for(a.sort(kr),t=0;o>t;t++)c.push([a[t][0],-a[t][1]]);var s=Sr(a),l=Sr(c),f=l[0]===s[0],h=l[l.length-1]===s[s.length-1],g=[];for(t=s.length-1;t>=0;--t)g.push(n[a[s[t]][2]]);for(t=+f;t<l.length-h;++t)g.push(n[a[l[t]][2]]);return g}var e=br,r=wr;return arguments.length?t(n):(t.x=function(n){return arguments.length?(e=n,t):e},t.y=function(n){return arguments.length?(r=n,t):r},t)},Xo.geom.polygon=function(n){return fa(n,Zc),n};var Zc=Xo.geom.polygon.prototype=[];Zc.area=function(){for(var n,t=-1,e=this.length,r=this[e-1],u=0;++t<e;)n=r,r=this[t],u+=n[1]*r[0]-n[0]*r[1];return.5*u},Zc.centroid=function(n){var t,e,r=-1,u=this.length,i=0,o=0,a=this[u-1];for(arguments.length||(n=-1/(6*this.area()));++r<u;)t=a,a=this[r],e=t[0]*a[1]-a[0]*t[1],i+=(t[0]+a[0])*e,o+=(t[1]+a[1])*e;return[i*n,o*n]},Zc.clip=function(n){for(var t,e,r,u,i,o,a=Cr(n),c=-1,s=this.length-Cr(this),l=this[s-1];++c<s;){for(t=n.slice(),n.length=0,u=this[c],i=t[(r=t.length-a)-1],e=-1;++e<r;)o=t[e],Er(o,l,u)?(Er(i,l,u)||n.push(Ar(i,o,l,u)),n.push(o)):Er(i,l,u)&&n.push(Ar(i,o,l,u)),i=o;a&&n.push(n[0]),l=u}return n};var Vc,Xc,$c,Bc,Wc,Jc=[],Gc=[];Pr.prototype.prepare=function(){for(var n,t=this.edges,e=t.length;e--;)n=t[e].edge,n.b&&n.a||t.splice(e,1);return t.sort(jr),t.length},Br.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},Wr.prototype={insert:function(n,t){var e,r,u;if(n){if(t.P=n,t.N=n.N,n.N&&(n.N.P=t),n.N=t,n.R){for(n=n.R;n.L;)n=n.L;n.L=t}else n.R=t;e=n}else this._?(n=Qr(this._),t.P=null,t.N=n,n.P=n.L=t,e=n):(t.P=t.N=null,this._=t,e=null);for(t.L=t.R=null,t.U=e,t.C=!0,n=t;e&&e.C;)r=e.U,e===r.L?(u=r.R,u&&u.C?(e.C=u.C=!1,r.C=!0,n=r):(n===e.R&&(Gr(this,e),n=e,e=n.U),e.C=!1,r.C=!0,Kr(this,r))):(u=r.L,u&&u.C?(e.C=u.C=!1,r.C=!0,n=r):(n===e.L&&(Kr(this,e),n=e,e=n.U),e.C=!1,r.C=!0,Gr(this,r))),e=n.U;this._.C=!1},remove:function(n){n.N&&(n.N.P=n.P),n.P&&(n.P.N=n.N),n.N=n.P=null;var t,e,r,u=n.U,i=n.L,o=n.R;if(e=i?o?Qr(o):i:o,u?u.L===n?u.L=e:u.R=e:this._=e,i&&o?(r=e.C,e.C=n.C,e.L=i,i.U=e,e!==o?(u=e.U,e.U=n.U,n=e.R,u.L=n,e.R=o,o.U=e):(e.U=u,u=e,n=e.R)):(r=n.C,n=e),n&&(n.U=u),!r){if(n&&n.C)return n.C=!1,void 0;do{if(n===this._)break;if(n===u.L){if(t=u.R,t.C&&(t.C=!1,u.C=!0,Gr(this,u),t=u.R),t.L&&t.L.C||t.R&&t.R.C){t.R&&t.R.C||(t.L.C=!1,t.C=!0,Kr(this,t),t=u.R),t.C=u.C,u.C=t.R.C=!1,Gr(this,u),n=this._;break}}else if(t=u.L,t.C&&(t.C=!1,u.C=!0,Kr(this,u),t=u.L),t.L&&t.L.C||t.R&&t.R.C){t.L&&t.L.C||(t.R.C=!1,t.C=!0,Gr(this,t),t=u.L),t.C=u.C,u.C=t.L.C=!1,Kr(this,u),n=this._;break}t.C=!0,n=u,u=u.U}while(!n.C);n&&(n.C=!1)}}},Xo.geom.voronoi=function(n){function t(n){var t=new Array(n.length),r=a[0][0],u=a[0][1],i=a[1][0],o=a[1][1];return nu(e(n),a).cells.forEach(function(e,a){var c=e.edges,s=e.site,l=t[a]=c.length?c.map(function(n){var t=n.start();return[t.x,t.y]}):s.x>=r&&s.x<=i&&s.y>=u&&s.y<=o?[[r,o],[i,o],[i,u],[r,u]]:[];l.point=n[a]}),t}function e(n){return n.map(function(n,t){return{x:Math.round(i(n,t)/Aa)*Aa,y:Math.round(o(n,t)/Aa)*Aa,i:t}})}var r=br,u=wr,i=r,o=u,a=Kc;return n?t(n):(t.links=function(n){return nu(e(n)).edges.filter(function(n){return n.l&&n.r}).map(function(t){return{source:n[t.l.i],target:n[t.r.i]}})},t.triangles=function(n){var t=[];return nu(e(n)).cells.forEach(function(e,r){for(var u,i,o=e.site,a=e.edges.sort(jr),c=-1,s=a.length,l=a[s-1].edge,f=l.l===o?l.r:l.l;++c<s;)u=l,i=f,l=a[c].edge,f=l.l===o?l.r:l.l,r<i.i&&r<f.i&&eu(o,i,f)<0&&t.push([n[r],n[i.i],n[f.i]])}),t},t.x=function(n){return arguments.length?(i=_t(r=n),t):r},t.y=function(n){return arguments.length?(o=_t(u=n),t):u},t.clipExtent=function(n){return arguments.length?(a=null==n?Kc:n,t):a===Kc?null:a},t.size=function(n){return arguments.length?t.clipExtent(n&&[[0,0],n]):a===Kc?null:a&&a[1]},t)};var Kc=[[-1e6,-1e6],[1e6,1e6]];Xo.geom.delaunay=function(n){return Xo.geom.voronoi().triangles(n)},Xo.geom.quadtree=function(n,t,e,r,u){function i(n){function i(n,t,e,r,u,i,o,a){if(!isNaN(e)&&!isNaN(r))if(n.leaf){var c=n.x,l=n.y;if(null!=c)if(oa(c-e)+oa(l-r)<.01)s(n,t,e,r,u,i,o,a);else{var f=n.point;n.x=n.y=n.point=null,s(n,f,c,l,u,i,o,a),s(n,t,e,r,u,i,o,a)}else n.x=e,n.y=r,n.point=t}else s(n,t,e,r,u,i,o,a)}function s(n,t,e,r,u,o,a,c){var s=.5*(u+a),l=.5*(o+c),f=e>=s,h=r>=l,g=(h<<1)+f;n.leaf=!1,n=n.nodes[g]||(n.nodes[g]=iu()),f?u=s:a=s,h?o=l:c=l,i(n,t,e,r,u,o,a,c)}var l,f,h,g,p,v,d,m,y,x=_t(a),M=_t(c);if(null!=t)v=t,d=e,m=r,y=u;else if(m=y=-(v=d=1/0),f=[],h=[],p=n.length,o)for(g=0;p>g;++g)l=n[g],l.x<v&&(v=l.x),l.y<d&&(d=l.y),l.x>m&&(m=l.x),l.y>y&&(y=l.y),f.push(l.x),h.push(l.y);else for(g=0;p>g;++g){var _=+x(l=n[g],g),b=+M(l,g);v>_&&(v=_),d>b&&(d=b),_>m&&(m=_),b>y&&(y=b),f.push(_),h.push(b)}var w=m-v,S=y-d;w>S?y=d+w:m=v+S;var k=iu();if(k.add=function(n){i(k,n,+x(n,++g),+M(n,g),v,d,m,y)},k.visit=function(n){ou(n,k,v,d,m,y)},g=-1,null==t){for(;++g<p;)i(k,n[g],f[g],h[g],v,d,m,y);--g}else n.forEach(k.add);return f=h=n=l=null,k}var o,a=br,c=wr;return(o=arguments.length)?(a=ru,c=uu,3===o&&(u=e,r=t,e=t=0),i(n)):(i.x=function(n){return arguments.length?(a=n,i):a},i.y=function(n){return arguments.length?(c=n,i):c},i.extent=function(n){return arguments.length?(null==n?t=e=r=u=null:(t=+n[0][0],e=+n[0][1],r=+n[1][0],u=+n[1][1]),i):null==t?null:[[t,e],[r,u]]},i.size=function(n){return arguments.length?(null==n?t=e=r=u=null:(t=e=0,r=+n[0],u=+n[1]),i):null==t?null:[r-t,u-e]},i)},Xo.interpolateRgb=au,Xo.interpolateObject=cu,Xo.interpolateNumber=su,Xo.interpolateString=lu;var Qc=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g;Xo.interpolate=fu,Xo.interpolators=[function(n,t){var e=typeof t;return("string"===e?Va.has(t)||/^(#|rgb\(|hsl\()/.test(t)?au:lu:t instanceof G?au:"object"===e?Array.isArray(t)?hu:cu:su)(n,t)}],Xo.interpolateArray=hu;var ns=function(){return bt},ts=Xo.map({linear:ns,poly:xu,quad:function(){return du},cubic:function(){return mu},sin:function(){return Mu},exp:function(){return _u},circle:function(){return bu},elastic:wu,back:Su,bounce:function(){return ku}}),es=Xo.map({"in":bt,out:pu,"in-out":vu,"out-in":function(n){return vu(pu(n))}});Xo.ease=function(n){var t=n.indexOf("-"),e=t>=0?n.substring(0,t):n,r=t>=0?n.substring(t+1):"in";return e=ts.get(e)||ns,r=es.get(r)||bt,gu(r(e.apply(null,$o.call(arguments,1))))},Xo.interpolateHcl=Eu,Xo.interpolateHsl=Au,Xo.interpolateLab=Cu,Xo.interpolateRound=Nu,Xo.transform=function(n){var t=Wo.createElementNS(Xo.ns.prefix.svg,"g");return(Xo.transform=function(n){if(null!=n){t.setAttribute("transform",n);var e=t.transform.baseVal.consolidate()}return new Lu(e?e.matrix:rs)})(n)},Lu.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var rs={a:1,b:0,c:0,d:1,e:0,f:0};Xo.interpolateTransform=Ru,Xo.layout={},Xo.layout.bundle=function(){return function(n){for(var t=[],e=-1,r=n.length;++e<r;)t.push(Uu(n[e]));return t}},Xo.layout.chord=function(){function n(){var n,s,f,h,g,p={},v=[],d=Xo.range(i),m=[];for(e=[],r=[],n=0,h=-1;++h<i;){for(s=0,g=-1;++g<i;)s+=u[h][g];v.push(s),m.push(Xo.range(i)),n+=s}for(o&&d.sort(function(n,t){return o(v[n],v[t])}),a&&m.forEach(function(n,t){n.sort(function(n,e){return a(u[t][n],u[t][e])})}),n=(ka-l*i)/n,s=0,h=-1;++h<i;){for(f=s,g=-1;++g<i;){var y=d[h],x=m[y][g],M=u[y][x],_=s,b=s+=M*n;p[y+"-"+x]={index:y,subindex:x,startAngle:_,endAngle:b,value:M}}r[y]={index:y,startAngle:f,endAngle:s,value:(s-f)/n},s+=l}for(h=-1;++h<i;)for(g=h-1;++g<i;){var w=p[h+"-"+g],S=p[g+"-"+h];(w.value||S.value)&&e.push(w.value<S.value?{source:S,target:w}:{source:w,target:S})}c&&t()}function t(){e.sort(function(n,t){return c((n.source.value+n.target.value)/2,(t.source.value+t.target.value)/2)})}var e,r,u,i,o,a,c,s={},l=0;return s.matrix=function(n){return arguments.length?(i=(u=n)&&u.length,e=r=null,s):u},s.padding=function(n){return arguments.length?(l=n,e=r=null,s):l},s.sortGroups=function(n){return arguments.length?(o=n,e=r=null,s):o},s.sortSubgroups=function(n){return arguments.length?(a=n,e=null,s):a},s.sortChords=function(n){return arguments.length?(c=n,e&&t(),s):c},s.chords=function(){return e||n(),e},s.groups=function(){return r||n(),r},s},Xo.layout.force=function(){function n(n){return function(t,e,r,u){if(t.point!==n){var i=t.cx-n.x,o=t.cy-n.y,a=u-e,c=i*i+o*o;if(c>a*a/d){if(p>c){var s=t.charge/c;n.px-=i*s,n.py-=o*s}return!0}if(t.point&&c&&p>c){var s=t.pointCharge/c;n.px-=i*s,n.py-=o*s}}return!t.charge}}function t(n){n.px=Xo.event.x,n.py=Xo.event.y,a.resume()}var e,r,u,i,o,a={},c=Xo.dispatch("start","tick","end"),s=[1,1],l=.9,f=us,h=is,g=-30,p=os,v=.1,d=.64,m=[],y=[];return a.tick=function(){if((r*=.99)<.005)return c.end({type:"end",alpha:r=0}),!0;var t,e,a,f,h,p,d,x,M,_=m.length,b=y.length;for(e=0;b>e;++e)a=y[e],f=a.source,h=a.target,x=h.x-f.x,M=h.y-f.y,(p=x*x+M*M)&&(p=r*i[e]*((p=Math.sqrt(p))-u[e])/p,x*=p,M*=p,h.x-=x*(d=f.weight/(h.weight+f.weight)),h.y-=M*d,f.x+=x*(d=1-d),f.y+=M*d);if((d=r*v)&&(x=s[0]/2,M=s[1]/2,e=-1,d))for(;++e<_;)a=m[e],a.x+=(x-a.x)*d,a.y+=(M-a.y)*d;if(g)for(Zu(t=Xo.geom.quadtree(m),r,o),e=-1;++e<_;)(a=m[e]).fixed||t.visit(n(a));for(e=-1;++e<_;)a=m[e],a.fixed?(a.x=a.px,a.y=a.py):(a.x-=(a.px-(a.px=a.x))*l,a.y-=(a.py-(a.py=a.y))*l);c.tick({type:"tick",alpha:r})},a.nodes=function(n){return arguments.length?(m=n,a):m},a.links=function(n){return arguments.length?(y=n,a):y},a.size=function(n){return arguments.length?(s=n,a):s},a.linkDistance=function(n){return arguments.length?(f="function"==typeof n?n:+n,a):f},a.distance=a.linkDistance,a.linkStrength=function(n){return arguments.length?(h="function"==typeof n?n:+n,a):h},a.friction=function(n){return arguments.length?(l=+n,a):l},a.charge=function(n){return arguments.length?(g="function"==typeof n?n:+n,a):g},a.chargeDistance=function(n){return arguments.length?(p=n*n,a):Math.sqrt(p)},a.gravity=function(n){return arguments.length?(v=+n,a):v},a.theta=function(n){return arguments.length?(d=n*n,a):Math.sqrt(d)},a.alpha=function(n){return arguments.length?(n=+n,r?r=n>0?n:0:n>0&&(c.start({type:"start",alpha:r=n}),Xo.timer(a.tick)),a):r},a.start=function(){function n(n,r){if(!e){for(e=new Array(c),a=0;c>a;++a)e[a]=[];for(a=0;s>a;++a){var u=y[a];e[u.source.index].push(u.target),e[u.target.index].push(u.source)}}for(var i,o=e[t],a=-1,s=o.length;++a<s;)if(!isNaN(i=o[a][n]))return i;return Math.random()*r}var t,e,r,c=m.length,l=y.length,p=s[0],v=s[1];for(t=0;c>t;++t)(r=m[t]).index=t,r.weight=0;for(t=0;l>t;++t)r=y[t],"number"==typeof r.source&&(r.source=m[r.source]),"number"==typeof r.target&&(r.target=m[r.target]),++r.source.weight,++r.target.weight;for(t=0;c>t;++t)r=m[t],isNaN(r.x)&&(r.x=n("x",p)),isNaN(r.y)&&(r.y=n("y",v)),isNaN(r.px)&&(r.px=r.x),isNaN(r.py)&&(r.py=r.y);if(u=[],"function"==typeof f)for(t=0;l>t;++t)u[t]=+f.call(this,y[t],t);else for(t=0;l>t;++t)u[t]=f;if(i=[],"function"==typeof h)for(t=0;l>t;++t)i[t]=+h.call(this,y[t],t);else for(t=0;l>t;++t)i[t]=h;if(o=[],"function"==typeof g)for(t=0;c>t;++t)o[t]=+g.call(this,m[t],t);else for(t=0;c>t;++t)o[t]=g;return a.resume()},a.resume=function(){return a.alpha(.1)},a.stop=function(){return a.alpha(0)},a.drag=function(){return e||(e=Xo.behavior.drag().origin(bt).on("dragstart.force",Fu).on("drag.force",t).on("dragend.force",Ou)),arguments.length?(this.on("mouseover.force",Yu).on("mouseout.force",Iu).call(e),void 0):e},Xo.rebind(a,c,"on")};var us=20,is=1,os=1/0;Xo.layout.hierarchy=function(){function n(t,o,a){var c=u.call(e,t,o);if(t.depth=o,a.push(t),c&&(s=c.length)){for(var s,l,f=-1,h=t.children=new Array(s),g=0,p=o+1;++f<s;)l=h[f]=n(c[f],p,a),l.parent=t,g+=l.value;r&&h.sort(r),i&&(t.value=g)}else delete t.children,i&&(t.value=+i.call(e,t,o)||0);return t}function t(n,r){var u=n.children,o=0;if(u&&(a=u.length))for(var a,c=-1,s=r+1;++c<a;)o+=t(u[c],s);else i&&(o=+i.call(e,n,r)||0);return i&&(n.value=o),o}function e(t){var e=[];return n(t,0,e),e}var r=Bu,u=Xu,i=$u;return e.sort=function(n){return arguments.length?(r=n,e):r},e.children=function(n){return arguments.length?(u=n,e):u},e.value=function(n){return arguments.length?(i=n,e):i},e.revalue=function(n){return t(n,0),n},e},Xo.layout.partition=function(){function n(t,e,r,u){var i=t.children;if(t.x=e,t.y=t.depth*u,t.dx=r,t.dy=u,i&&(o=i.length)){var o,a,c,s=-1;for(r=t.value?r/t.value:0;++s<o;)n(a=i[s],e,c=a.value*r,u),e+=c}}function t(n){var e=n.children,r=0;if(e&&(u=e.length))for(var u,i=-1;++i<u;)r=Math.max(r,t(e[i]));return 1+r}function e(e,i){var o=r.call(this,e,i);return n(o[0],0,u[0],u[1]/t(o[0])),o}var r=Xo.layout.hierarchy(),u=[1,1];return e.size=function(n){return arguments.length?(u=n,e):u},Vu(e,r)},Xo.layout.pie=function(){function n(i){var o=i.map(function(e,r){return+t.call(n,e,r)}),a=+("function"==typeof r?r.apply(this,arguments):r),c=(("function"==typeof u?u.apply(this,arguments):u)-a)/Xo.sum(o),s=Xo.range(i.length);null!=e&&s.sort(e===as?function(n,t){return o[t]-o[n]}:function(n,t){return e(i[n],i[t])});var l=[];return s.forEach(function(n){var t;l[n]={data:i[n],value:t=o[n],startAngle:a,endAngle:a+=t*c}}),l}var t=Number,e=as,r=0,u=ka;return n.value=function(e){return arguments.length?(t=e,n):t},n.sort=function(t){return arguments.length?(e=t,n):e},n.startAngle=function(t){return arguments.length?(r=t,n):r},n.endAngle=function(t){return arguments.length?(u=t,n):u},n};var as={};Xo.layout.stack=function(){function n(a,c){var s=a.map(function(e,r){return t.call(n,e,r)}),l=s.map(function(t){return t.map(function(t,e){return[i.call(n,t,e),o.call(n,t,e)]})}),f=e.call(n,l,c);s=Xo.permute(s,f),l=Xo.permute(l,f);var h,g,p,v=r.call(n,l,c),d=s.length,m=s[0].length;for(g=0;m>g;++g)for(u.call(n,s[0][g],p=v[g],l[0][g][1]),h=1;d>h;++h)u.call(n,s[h][g],p+=l[h-1][g][1],l[h][g][1]);return a}var t=bt,e=Qu,r=ni,u=Ku,i=Ju,o=Gu;return n.values=function(e){return arguments.length?(t=e,n):t},n.order=function(t){return arguments.length?(e="function"==typeof t?t:cs.get(t)||Qu,n):e},n.offset=function(t){return arguments.length?(r="function"==typeof t?t:ss.get(t)||ni,n):r},n.x=function(t){return arguments.length?(i=t,n):i},n.y=function(t){return arguments.length?(o=t,n):o},n.out=function(t){return arguments.length?(u=t,n):u},n};var cs=Xo.map({"inside-out":function(n){var t,e,r=n.length,u=n.map(ti),i=n.map(ei),o=Xo.range(r).sort(function(n,t){return u[n]-u[t]}),a=0,c=0,s=[],l=[];for(t=0;r>t;++t)e=o[t],c>a?(a+=i[e],s.push(e)):(c+=i[e],l.push(e));return l.reverse().concat(s)},reverse:function(n){return Xo.range(n.length).reverse()},"default":Qu}),ss=Xo.map({silhouette:function(n){var t,e,r,u=n.length,i=n[0].length,o=[],a=0,c=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];r>a&&(a=r),o.push(r)}for(e=0;i>e;++e)c[e]=(a-o[e])/2;return c},wiggle:function(n){var t,e,r,u,i,o,a,c,s,l=n.length,f=n[0],h=f.length,g=[];for(g[0]=c=s=0,e=1;h>e;++e){for(t=0,u=0;l>t;++t)u+=n[t][e][1];for(t=0,i=0,a=f[e][0]-f[e-1][0];l>t;++t){for(r=0,o=(n[t][e][1]-n[t][e-1][1])/(2*a);t>r;++r)o+=(n[r][e][1]-n[r][e-1][1])/a;i+=o*n[t][e][1]}g[e]=c-=u?i/u*a:0,s>c&&(s=c)}for(e=0;h>e;++e)g[e]-=s;return g},expand:function(n){var t,e,r,u=n.length,i=n[0].length,o=1/u,a=[];for(e=0;i>e;++e){for(t=0,r=0;u>t;t++)r+=n[t][e][1];if(r)for(t=0;u>t;t++)n[t][e][1]/=r;else for(t=0;u>t;t++)n[t][e][1]=o}for(e=0;i>e;++e)a[e]=0;return a},zero:ni});Xo.layout.histogram=function(){function n(n,i){for(var o,a,c=[],s=n.map(e,this),l=r.call(this,s,i),f=u.call(this,l,s,i),i=-1,h=s.length,g=f.length-1,p=t?1:1/h;++i<g;)o=c[i]=[],o.dx=f[i+1]-(o.x=f[i]),o.y=0;if(g>0)for(i=-1;++i<h;)a=s[i],a>=l[0]&&a<=l[1]&&(o=c[Xo.bisect(f,a,1,g)-1],o.y+=p,o.push(n[i]));return c}var t=!0,e=Number,r=oi,u=ui;return n.value=function(t){return arguments.length?(e=t,n):e},n.range=function(t){return arguments.length?(r=_t(t),n):r},n.bins=function(t){return arguments.length?(u="number"==typeof t?function(n){return ii(n,t)}:_t(t),n):u},n.frequency=function(e){return arguments.length?(t=!!e,n):t},n},Xo.layout.tree=function(){function n(n,i){function o(n,t){var r=n.children,u=n._tree;if(r&&(i=r.length)){for(var i,a,s,l=r[0],f=l,h=-1;++h<i;)s=r[h],o(s,a),f=c(s,a,f),a=s;vi(n);var g=.5*(l._tree.prelim+s._tree.prelim);t?(u.prelim=t._tree.prelim+e(n,t),u.mod=u.prelim-g):u.prelim=g}else t&&(u.prelim=t._tree.prelim+e(n,t))}function a(n,t){n.x=n._tree.prelim+t;var e=n.children;if(e&&(r=e.length)){var r,u=-1;for(t+=n._tree.mod;++u<r;)a(e[u],t)}}function c(n,t,r){if(t){for(var u,i=n,o=n,a=t,c=n.parent.children[0],s=i._tree.mod,l=o._tree.mod,f=a._tree.mod,h=c._tree.mod;a=si(a),i=ci(i),a&&i;)c=ci(c),o=si(o),o._tree.ancestor=n,u=a._tree.prelim+f-i._tree.prelim-s+e(a,i),u>0&&(di(mi(a,n,r),n,u),s+=u,l+=u),f+=a._tree.mod,s+=i._tree.mod,h+=c._tree.mod,l+=o._tree.mod;a&&!si(o)&&(o._tree.thread=a,o._tree.mod+=f-l),i&&!ci(c)&&(c._tree.thread=i,c._tree.mod+=s-h,r=n)}return r}var s=t.call(this,n,i),l=s[0];pi(l,function(n,t){n._tree={ancestor:n,prelim:0,mod:0,change:0,shift:0,number:t?t._tree.number+1:0}}),o(l),a(l,-l._tree.prelim);var f=li(l,hi),h=li(l,fi),g=li(l,gi),p=f.x-e(f,h)/2,v=h.x+e(h,f)/2,d=g.depth||1;return pi(l,u?function(n){n.x*=r[0],n.y=n.depth*r[1],delete n._tree}:function(n){n.x=(n.x-p)/(v-p)*r[0],n.y=n.depth/d*r[1],delete n._tree}),s}var t=Xo.layout.hierarchy().sort(null).value(null),e=ai,r=[1,1],u=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(u=null==(r=t),n):u?null:r},n.nodeSize=function(t){return arguments.length?(u=null!=(r=t),n):u?r:null},Vu(n,t)},Xo.layout.pack=function(){function n(n,i){var o=e.call(this,n,i),a=o[0],c=u[0],s=u[1],l=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(a.x=a.y=0,pi(a,function(n){n.r=+l(n.value)}),pi(a,bi),r){var f=r*(t?1:Math.max(2*a.r/c,2*a.r/s))/2;pi(a,function(n){n.r+=f}),pi(a,bi),pi(a,function(n){n.r-=f})}return ki(a,c/2,s/2,t?1:1/Math.max(2*a.r/c,2*a.r/s)),o}var t,e=Xo.layout.hierarchy().sort(yi),r=0,u=[1,1];return n.size=function(t){return arguments.length?(u=t,n):u},n.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,n):t},n.padding=function(t){return arguments.length?(r=+t,n):r},Vu(n,e)},Xo.layout.cluster=function(){function n(n,i){var o,a=t.call(this,n,i),c=a[0],s=0;pi(c,function(n){var t=n.children;t&&t.length?(n.x=Ci(t),n.y=Ai(t)):(n.x=o?s+=e(n,o):0,n.y=0,o=n)});var l=Ni(c),f=Li(c),h=l.x-e(l,f)/2,g=f.x+e(f,l)/2;return pi(c,u?function(n){n.x=(n.x-c.x)*r[0],n.y=(c.y-n.y)*r[1]}:function(n){n.x=(n.x-h)/(g-h)*r[0],n.y=(1-(c.y?n.y/c.y:1))*r[1]}),a}var t=Xo.layout.hierarchy().sort(null).value(null),e=ai,r=[1,1],u=!1;return n.separation=function(t){return arguments.length?(e=t,n):e},n.size=function(t){return arguments.length?(u=null==(r=t),n):u?null:r},n.nodeSize=function(t){return arguments.length?(u=null!=(r=t),n):u?r:null},Vu(n,t)},Xo.layout.treemap=function(){function n(n,t){for(var e,r,u=-1,i=n.length;++u<i;)r=(e=n[u]).value*(0>t?0:t),e.area=isNaN(r)||0>=r?0:r}function t(e){var i=e.children;if(i&&i.length){var o,a,c,s=f(e),l=[],h=i.slice(),p=1/0,v="slice"===g?s.dx:"dice"===g?s.dy:"slice-dice"===g?1&e.depth?s.dy:s.dx:Math.min(s.dx,s.dy);for(n(h,s.dx*s.dy/e.value),l.area=0;(c=h.length)>0;)l.push(o=h[c-1]),l.area+=o.area,"squarify"!==g||(a=r(l,v))<=p?(h.pop(),p=a):(l.area-=l.pop().area,u(l,v,s,!1),v=Math.min(s.dx,s.dy),l.length=l.area=0,p=1/0);l.length&&(u(l,v,s,!0),l.length=l.area=0),i.forEach(t)}}function e(t){var r=t.children;if(r&&r.length){var i,o=f(t),a=r.slice(),c=[];for(n(a,o.dx*o.dy/t.value),c.area=0;i=a.pop();)c.push(i),c.area+=i.area,null!=i.z&&(u(c,i.z?o.dx:o.dy,o,!a.length),c.length=c.area=0);r.forEach(e)}}function r(n,t){for(var e,r=n.area,u=0,i=1/0,o=-1,a=n.length;++o<a;)(e=n[o].area)&&(i>e&&(i=e),e>u&&(u=e));return r*=r,t*=t,r?Math.max(t*u*p/r,r/(t*i*p)):1/0}function u(n,t,e,r){var u,i=-1,o=n.length,a=e.x,s=e.y,l=t?c(n.area/t):0;if(t==e.dx){for((r||l>e.dy)&&(l=e.dy);++i<o;)u=n[i],u.x=a,u.y=s,u.dy=l,a+=u.dx=Math.min(e.x+e.dx-a,l?c(u.area/l):0);u.z=!0,u.dx+=e.x+e.dx-a,e.y+=l,e.dy-=l}else{for((r||l>e.dx)&&(l=e.dx);++i<o;)u=n[i],u.x=a,u.y=s,u.dx=l,s+=u.dy=Math.min(e.y+e.dy-s,l?c(u.area/l):0);u.z=!1,u.dy+=e.y+e.dy-s,e.x+=l,e.dx-=l}}function i(r){var u=o||a(r),i=u[0];return i.x=0,i.y=0,i.dx=s[0],i.dy=s[1],o&&a.revalue(i),n([i],i.dx*i.dy/i.value),(o?e:t)(i),h&&(o=u),u}var o,a=Xo.layout.hierarchy(),c=Math.round,s=[1,1],l=null,f=Ti,h=!1,g="squarify",p=.5*(1+Math.sqrt(5));return i.size=function(n){return arguments.length?(s=n,i):s},i.padding=function(n){function t(t){var e=n.call(i,t,t.depth);return null==e?Ti(t):qi(t,"number"==typeof e?[e,e,e,e]:e)}function e(t){return qi(t,n)}if(!arguments.length)return l;var r;return f=null==(l=n)?Ti:"function"==(r=typeof n)?t:"number"===r?(n=[n,n,n,n],e):e,i},i.round=function(n){return arguments.length?(c=n?Math.round:Number,i):c!=Number},i.sticky=function(n){return arguments.length?(h=n,o=null,i):h},i.ratio=function(n){return arguments.length?(p=n,i):p},i.mode=function(n){return arguments.length?(g=n+"",i):g},Vu(i,a)},Xo.random={normal:function(n,t){var e=arguments.length;return 2>e&&(t=1),1>e&&(n=0),function(){var e,r,u;do e=2*Math.random()-1,r=2*Math.random()-1,u=e*e+r*r;while(!u||u>1);return n+t*e*Math.sqrt(-2*Math.log(u)/u)}},logNormal:function(){var n=Xo.random.normal.apply(Xo,arguments);return function(){return Math.exp(n())}},bates:function(n){var t=Xo.random.irwinHall(n);return function(){return t()/n}},irwinHall:function(n){return function(){for(var t=0,e=0;n>e;e++)t+=Math.random();return t}}},Xo.scale={};var ls={floor:bt,ceil:bt};Xo.scale.linear=function(){return Hi([0,1],[0,1],fu,!1)};var fs={s:1,g:1,p:1,r:1,e:1};Xo.scale.log=function(){return $i(Xo.scale.linear().domain([0,1]),10,!0,[1,10])};var hs=Xo.format(".0e"),gs={floor:function(n){return-Math.ceil(-n)},ceil:function(n){return-Math.floor(-n)}};Xo.scale.pow=function(){return Bi(Xo.scale.linear(),1,[0,1])},Xo.scale.sqrt=function(){return Xo.scale.pow().exponent(.5)},Xo.scale.ordinal=function(){return Ji([],{t:"range",a:[[]]})},Xo.scale.category10=function(){return Xo.scale.ordinal().range(ps)},Xo.scale.category20=function(){return Xo.scale.ordinal().range(vs)},Xo.scale.category20b=function(){return Xo.scale.ordinal().range(ds)},Xo.scale.category20c=function(){return Xo.scale.ordinal().range(ms)};var ps=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(ht),vs=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(ht),ds=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(ht),ms=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(ht);Xo.scale.quantile=function(){return Gi([],[])},Xo.scale.quantize=function(){return Ki(0,1,[0,1])},Xo.scale.threshold=function(){return Qi([.5],[0,1])
-},Xo.scale.identity=function(){return no([0,1])},Xo.svg={},Xo.svg.arc=function(){function n(){var n=t.apply(this,arguments),i=e.apply(this,arguments),o=r.apply(this,arguments)+ys,a=u.apply(this,arguments)+ys,c=(o>a&&(c=o,o=a,a=c),a-o),s=Sa>c?"0":"1",l=Math.cos(o),f=Math.sin(o),h=Math.cos(a),g=Math.sin(a);return c>=xs?n?"M0,"+i+"A"+i+","+i+" 0 1,1 0,"+-i+"A"+i+","+i+" 0 1,1 0,"+i+"M0,"+n+"A"+n+","+n+" 0 1,0 0,"+-n+"A"+n+","+n+" 0 1,0 0,"+n+"Z":"M0,"+i+"A"+i+","+i+" 0 1,1 0,"+-i+"A"+i+","+i+" 0 1,1 0,"+i+"Z":n?"M"+i*l+","+i*f+"A"+i+","+i+" 0 "+s+",1 "+i*h+","+i*g+"L"+n*h+","+n*g+"A"+n+","+n+" 0 "+s+",0 "+n*l+","+n*f+"Z":"M"+i*l+","+i*f+"A"+i+","+i+" 0 "+s+",1 "+i*h+","+i*g+"L0,0"+"Z"}var t=to,e=eo,r=ro,u=uo;return n.innerRadius=function(e){return arguments.length?(t=_t(e),n):t},n.outerRadius=function(t){return arguments.length?(e=_t(t),n):e},n.startAngle=function(t){return arguments.length?(r=_t(t),n):r},n.endAngle=function(t){return arguments.length?(u=_t(t),n):u},n.centroid=function(){var n=(t.apply(this,arguments)+e.apply(this,arguments))/2,i=(r.apply(this,arguments)+u.apply(this,arguments))/2+ys;return[Math.cos(i)*n,Math.sin(i)*n]},n};var ys=-Ea,xs=ka-Aa;Xo.svg.line=function(){return io(bt)};var Ms=Xo.map({linear:oo,"linear-closed":ao,step:co,"step-before":so,"step-after":lo,basis:mo,"basis-open":yo,"basis-closed":xo,bundle:Mo,cardinal:go,"cardinal-open":fo,"cardinal-closed":ho,monotone:Eo});Ms.forEach(function(n,t){t.key=n,t.closed=/-closed$/.test(n)});var _s=[0,2/3,1/3,0],bs=[0,1/3,2/3,0],ws=[0,1/6,2/3,1/6];Xo.svg.line.radial=function(){var n=io(Ao);return n.radius=n.x,delete n.x,n.angle=n.y,delete n.y,n},so.reverse=lo,lo.reverse=so,Xo.svg.area=function(){return Co(bt)},Xo.svg.area.radial=function(){var n=Co(Ao);return n.radius=n.x,delete n.x,n.innerRadius=n.x0,delete n.x0,n.outerRadius=n.x1,delete n.x1,n.angle=n.y,delete n.y,n.startAngle=n.y0,delete n.y0,n.endAngle=n.y1,delete n.y1,n},Xo.svg.chord=function(){function n(n,a){var c=t(this,i,n,a),s=t(this,o,n,a);return"M"+c.p0+r(c.r,c.p1,c.a1-c.a0)+(e(c,s)?u(c.r,c.p1,c.r,c.p0):u(c.r,c.p1,s.r,s.p0)+r(s.r,s.p1,s.a1-s.a0)+u(s.r,s.p1,c.r,c.p0))+"Z"}function t(n,t,e,r){var u=t.call(n,e,r),i=a.call(n,u,r),o=c.call(n,u,r)+ys,l=s.call(n,u,r)+ys;return{r:i,a0:o,a1:l,p0:[i*Math.cos(o),i*Math.sin(o)],p1:[i*Math.cos(l),i*Math.sin(l)]}}function e(n,t){return n.a0==t.a0&&n.a1==t.a1}function r(n,t,e){return"A"+n+","+n+" 0 "+ +(e>Sa)+",1 "+t}function u(n,t,e,r){return"Q 0,0 "+r}var i=hr,o=gr,a=No,c=ro,s=uo;return n.radius=function(t){return arguments.length?(a=_t(t),n):a},n.source=function(t){return arguments.length?(i=_t(t),n):i},n.target=function(t){return arguments.length?(o=_t(t),n):o},n.startAngle=function(t){return arguments.length?(c=_t(t),n):c},n.endAngle=function(t){return arguments.length?(s=_t(t),n):s},n},Xo.svg.diagonal=function(){function n(n,u){var i=t.call(this,n,u),o=e.call(this,n,u),a=(i.y+o.y)/2,c=[i,{x:i.x,y:a},{x:o.x,y:a},o];return c=c.map(r),"M"+c[0]+"C"+c[1]+" "+c[2]+" "+c[3]}var t=hr,e=gr,r=Lo;return n.source=function(e){return arguments.length?(t=_t(e),n):t},n.target=function(t){return arguments.length?(e=_t(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},Xo.svg.diagonal.radial=function(){var n=Xo.svg.diagonal(),t=Lo,e=n.projection;return n.projection=function(n){return arguments.length?e(To(t=n)):t},n},Xo.svg.symbol=function(){function n(n,r){return(Ss.get(t.call(this,n,r))||Ro)(e.call(this,n,r))}var t=zo,e=qo;return n.type=function(e){return arguments.length?(t=_t(e),n):t},n.size=function(t){return arguments.length?(e=_t(t),n):e},n};var Ss=Xo.map({circle:Ro,cross:function(n){var t=Math.sqrt(n/5)/2;return"M"+-3*t+","+-t+"H"+-t+"V"+-3*t+"H"+t+"V"+-t+"H"+3*t+"V"+t+"H"+t+"V"+3*t+"H"+-t+"V"+t+"H"+-3*t+"Z"},diamond:function(n){var t=Math.sqrt(n/(2*Cs)),e=t*Cs;return"M0,"+-t+"L"+e+",0"+" 0,"+t+" "+-e+",0"+"Z"},square:function(n){var t=Math.sqrt(n)/2;return"M"+-t+","+-t+"L"+t+","+-t+" "+t+","+t+" "+-t+","+t+"Z"},"triangle-down":function(n){var t=Math.sqrt(n/As),e=t*As/2;return"M0,"+e+"L"+t+","+-e+" "+-t+","+-e+"Z"},"triangle-up":function(n){var t=Math.sqrt(n/As),e=t*As/2;return"M0,"+-e+"L"+t+","+e+" "+-t+","+e+"Z"}});Xo.svg.symbolTypes=Ss.keys();var ks,Es,As=Math.sqrt(3),Cs=Math.tan(30*Na),Ns=[],Ls=0;Ns.call=da.call,Ns.empty=da.empty,Ns.node=da.node,Ns.size=da.size,Xo.transition=function(n){return arguments.length?ks?n.transition():n:xa.transition()},Xo.transition.prototype=Ns,Ns.select=function(n){var t,e,r,u=this.id,i=[];n=M(n);for(var o=-1,a=this.length;++o<a;){i.push(t=[]);for(var c=this[o],s=-1,l=c.length;++s<l;)(r=c[s])&&(e=n.call(r,r.__data__,s,o))?("__data__"in r&&(e.__data__=r.__data__),jo(e,s,u,r.__transition__[u]),t.push(e)):t.push(null)}return Do(i,u)},Ns.selectAll=function(n){var t,e,r,u,i,o=this.id,a=[];n=_(n);for(var c=-1,s=this.length;++c<s;)for(var l=this[c],f=-1,h=l.length;++f<h;)if(r=l[f]){i=r.__transition__[o],e=n.call(r,r.__data__,f,c),a.push(t=[]);for(var g=-1,p=e.length;++g<p;)(u=e[g])&&jo(u,g,o,i),t.push(u)}return Do(a,o)},Ns.filter=function(n){var t,e,r,u=[];"function"!=typeof n&&(n=q(n));for(var i=0,o=this.length;o>i;i++){u.push(t=[]);for(var e=this[i],a=0,c=e.length;c>a;a++)(r=e[a])&&n.call(r,r.__data__,a,i)&&t.push(r)}return Do(u,this.id)},Ns.tween=function(n,t){var e=this.id;return arguments.length<2?this.node().__transition__[e].tween.get(n):R(this,null==t?function(t){t.__transition__[e].tween.remove(n)}:function(r){r.__transition__[e].tween.set(n,t)})},Ns.attr=function(n,t){function e(){this.removeAttribute(a)}function r(){this.removeAttributeNS(a.space,a.local)}function u(n){return null==n?e:(n+="",function(){var t,e=this.getAttribute(a);return e!==n&&(t=o(e,n),function(n){this.setAttribute(a,t(n))})})}function i(n){return null==n?r:(n+="",function(){var t,e=this.getAttributeNS(a.space,a.local);return e!==n&&(t=o(e,n),function(n){this.setAttributeNS(a.space,a.local,t(n))})})}if(arguments.length<2){for(t in n)this.attr(t,n[t]);return this}var o="transform"==n?Ru:fu,a=Xo.ns.qualify(n);return Po(this,"attr."+n,t,a.local?i:u)},Ns.attrTween=function(n,t){function e(n,e){var r=t.call(this,n,e,this.getAttribute(u));return r&&function(n){this.setAttribute(u,r(n))}}function r(n,e){var r=t.call(this,n,e,this.getAttributeNS(u.space,u.local));return r&&function(n){this.setAttributeNS(u.space,u.local,r(n))}}var u=Xo.ns.qualify(n);return this.tween("attr."+n,u.local?r:e)},Ns.style=function(n,t,e){function r(){this.style.removeProperty(n)}function u(t){return null==t?r:(t+="",function(){var r,u=Go.getComputedStyle(this,null).getPropertyValue(n);return u!==t&&(r=fu(u,t),function(t){this.style.setProperty(n,r(t),e)})})}var i=arguments.length;if(3>i){if("string"!=typeof n){2>i&&(t="");for(e in n)this.style(e,n[e],t);return this}e=""}return Po(this,"style."+n,t,u)},Ns.styleTween=function(n,t,e){function r(r,u){var i=t.call(this,r,u,Go.getComputedStyle(this,null).getPropertyValue(n));return i&&function(t){this.style.setProperty(n,i(t),e)}}return arguments.length<3&&(e=""),this.tween("style."+n,r)},Ns.text=function(n){return Po(this,"text",n,Uo)},Ns.remove=function(){return this.each("end.transition",function(){var n;this.__transition__.count<2&&(n=this.parentNode)&&n.removeChild(this)})},Ns.ease=function(n){var t=this.id;return arguments.length<1?this.node().__transition__[t].ease:("function"!=typeof n&&(n=Xo.ease.apply(Xo,arguments)),R(this,function(e){e.__transition__[t].ease=n}))},Ns.delay=function(n){var t=this.id;return R(this,"function"==typeof n?function(e,r,u){e.__transition__[t].delay=+n.call(e,e.__data__,r,u)}:(n=+n,function(e){e.__transition__[t].delay=n}))},Ns.duration=function(n){var t=this.id;return R(this,"function"==typeof n?function(e,r,u){e.__transition__[t].duration=Math.max(1,n.call(e,e.__data__,r,u))}:(n=Math.max(1,n),function(e){e.__transition__[t].duration=n}))},Ns.each=function(n,t){var e=this.id;if(arguments.length<2){var r=Es,u=ks;ks=e,R(this,function(t,r,u){Es=t.__transition__[e],n.call(t,t.__data__,r,u)}),Es=r,ks=u}else R(this,function(r){var u=r.__transition__[e];(u.event||(u.event=Xo.dispatch("start","end"))).on(n,t)});return this},Ns.transition=function(){for(var n,t,e,r,u=this.id,i=++Ls,o=[],a=0,c=this.length;c>a;a++){o.push(n=[]);for(var t=this[a],s=0,l=t.length;l>s;s++)(e=t[s])&&(r=Object.create(e.__transition__[u]),r.delay+=r.duration,jo(e,s,i,r)),n.push(e)}return Do(o,i)},Xo.svg.axis=function(){function n(n){n.each(function(){var n,s=Xo.select(this),l=this.__chart__||e,f=this.__chart__=e.copy(),h=null==c?f.ticks?f.ticks.apply(f,a):f.domain():c,g=null==t?f.tickFormat?f.tickFormat.apply(f,a):bt:t,p=s.selectAll(".tick").data(h,f),v=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Aa),d=Xo.transition(p.exit()).style("opacity",Aa).remove(),m=Xo.transition(p).style("opacity",1),y=Ri(f),x=s.selectAll(".domain").data([0]),M=(x.enter().append("path").attr("class","domain"),Xo.transition(x));v.append("line"),v.append("text");var _=v.select("line"),b=m.select("line"),w=p.select("text").text(g),S=v.select("text"),k=m.select("text");switch(r){case"bottom":n=Ho,_.attr("y2",u),S.attr("y",Math.max(u,0)+o),b.attr("x2",0).attr("y2",u),k.attr("x",0).attr("y",Math.max(u,0)+o),w.attr("dy",".71em").style("text-anchor","middle"),M.attr("d","M"+y[0]+","+i+"V0H"+y[1]+"V"+i);break;case"top":n=Ho,_.attr("y2",-u),S.attr("y",-(Math.max(u,0)+o)),b.attr("x2",0).attr("y2",-u),k.attr("x",0).attr("y",-(Math.max(u,0)+o)),w.attr("dy","0em").style("text-anchor","middle"),M.attr("d","M"+y[0]+","+-i+"V0H"+y[1]+"V"+-i);break;case"left":n=Fo,_.attr("x2",-u),S.attr("x",-(Math.max(u,0)+o)),b.attr("x2",-u).attr("y2",0),k.attr("x",-(Math.max(u,0)+o)).attr("y",0),w.attr("dy",".32em").style("text-anchor","end"),M.attr("d","M"+-i+","+y[0]+"H0V"+y[1]+"H"+-i);break;case"right":n=Fo,_.attr("x2",u),S.attr("x",Math.max(u,0)+o),b.attr("x2",u).attr("y2",0),k.attr("x",Math.max(u,0)+o).attr("y",0),w.attr("dy",".32em").style("text-anchor","start"),M.attr("d","M"+i+","+y[0]+"H0V"+y[1]+"H"+i)}if(f.rangeBand){var E=f,A=E.rangeBand()/2;l=f=function(n){return E(n)+A}}else l.rangeBand?l=f:d.call(n,f);v.call(n,l),m.call(n,f)})}var t,e=Xo.scale.linear(),r=Ts,u=6,i=6,o=3,a=[10],c=null;return n.scale=function(t){return arguments.length?(e=t,n):e},n.orient=function(t){return arguments.length?(r=t in qs?t+"":Ts,n):r},n.ticks=function(){return arguments.length?(a=arguments,n):a},n.tickValues=function(t){return arguments.length?(c=t,n):c},n.tickFormat=function(e){return arguments.length?(t=e,n):t},n.tickSize=function(t){var e=arguments.length;return e?(u=+t,i=+arguments[e-1],n):u},n.innerTickSize=function(t){return arguments.length?(u=+t,n):u},n.outerTickSize=function(t){return arguments.length?(i=+t,n):i},n.tickPadding=function(t){return arguments.length?(o=+t,n):o},n.tickSubdivide=function(){return arguments.length&&n},n};var Ts="bottom",qs={top:1,right:1,bottom:1,left:1};Xo.svg.brush=function(){function n(i){i.each(function(){var i=Xo.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",u).on("touchstart.brush",u),o=i.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),i.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var a=i.selectAll(".resize").data(p,bt);a.exit().remove(),a.enter().append("g").attr("class",function(n){return"resize "+n}).style("cursor",function(n){return zs[n]}).append("rect").attr("x",function(n){return/[ew]$/.test(n)?-3:null}).attr("y",function(n){return/^[ns]/.test(n)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),a.style("display",n.empty()?"none":null);var l,f=Xo.transition(i),h=Xo.transition(o);c&&(l=Ri(c),h.attr("x",l[0]).attr("width",l[1]-l[0]),e(f)),s&&(l=Ri(s),h.attr("y",l[0]).attr("height",l[1]-l[0]),r(f)),t(f)})}function t(n){n.selectAll(".resize").attr("transform",function(n){return"translate("+l[+/e$/.test(n)]+","+f[+/^s/.test(n)]+")"})}function e(n){n.select(".extent").attr("x",l[0]),n.selectAll(".extent,.n>rect,.s>rect").attr("width",l[1]-l[0])}function r(n){n.select(".extent").attr("y",f[0]),n.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function u(){function u(){32==Xo.event.keyCode&&(C||(x=null,L[0]-=l[1],L[1]-=f[1],C=2),d())}function p(){32==Xo.event.keyCode&&2==C&&(L[0]+=l[1],L[1]+=f[1],C=0,d())}function v(){var n=Xo.mouse(_),u=!1;M&&(n[0]+=M[0],n[1]+=M[1]),C||(Xo.event.altKey?(x||(x=[(l[0]+l[1])/2,(f[0]+f[1])/2]),L[0]=l[+(n[0]<x[0])],L[1]=f[+(n[1]<x[1])]):x=null),E&&m(n,c,0)&&(e(S),u=!0),A&&m(n,s,1)&&(r(S),u=!0),u&&(t(S),w({type:"brush",mode:C?"move":"resize"}))}function m(n,t,e){var r,u,a=Ri(t),c=a[0],s=a[1],p=L[e],v=e?f:l,d=v[1]-v[0];return C&&(c-=p,s-=d+p),r=(e?g:h)?Math.max(c,Math.min(s,n[e])):n[e],C?u=(r+=p)+d:(x&&(p=Math.max(c,Math.min(s,2*x[e]-r))),r>p?(u=r,r=p):u=p),v[0]!=r||v[1]!=u?(e?o=null:i=null,v[0]=r,v[1]=u,!0):void 0}function y(){v(),S.style("pointer-events","all").selectAll(".resize").style("display",n.empty()?"none":null),Xo.select("body").style("cursor",null),T.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),N(),w({type:"brushend"})}var x,M,_=this,b=Xo.select(Xo.event.target),w=a.of(_,arguments),S=Xo.select(_),k=b.datum(),E=!/^(n|s)$/.test(k)&&c,A=!/^(e|w)$/.test(k)&&s,C=b.classed("extent"),N=O(),L=Xo.mouse(_),T=Xo.select(Go).on("keydown.brush",u).on("keyup.brush",p);if(Xo.event.changedTouches?T.on("touchmove.brush",v).on("touchend.brush",y):T.on("mousemove.brush",v).on("mouseup.brush",y),S.interrupt().selectAll("*").interrupt(),C)L[0]=l[0]-L[0],L[1]=f[0]-L[1];else if(k){var q=+/w$/.test(k),z=+/^n/.test(k);M=[l[1-q]-L[0],f[1-z]-L[1]],L[0]=l[q],L[1]=f[z]}else Xo.event.altKey&&(x=L.slice());S.style("pointer-events","none").selectAll(".resize").style("display",null),Xo.select("body").style("cursor",b.style("cursor")),w({type:"brushstart"}),v()}var i,o,a=y(n,"brushstart","brush","brushend"),c=null,s=null,l=[0,0],f=[0,0],h=!0,g=!0,p=Rs[0];return n.event=function(n){n.each(function(){var n=a.of(this,arguments),t={x:l,y:f,i:i,j:o},e=this.__chart__||t;this.__chart__=t,ks?Xo.select(this).transition().each("start.brush",function(){i=e.i,o=e.j,l=e.x,f=e.y,n({type:"brushstart"})}).tween("brush:brush",function(){var e=hu(l,t.x),r=hu(f,t.y);return i=o=null,function(u){l=t.x=e(u),f=t.y=r(u),n({type:"brush",mode:"resize"})}}).each("end.brush",function(){i=t.i,o=t.j,n({type:"brush",mode:"resize"}),n({type:"brushend"})}):(n({type:"brushstart"}),n({type:"brush",mode:"resize"}),n({type:"brushend"}))})},n.x=function(t){return arguments.length?(c=t,p=Rs[!c<<1|!s],n):c},n.y=function(t){return arguments.length?(s=t,p=Rs[!c<<1|!s],n):s},n.clamp=function(t){return arguments.length?(c&&s?(h=!!t[0],g=!!t[1]):c?h=!!t:s&&(g=!!t),n):c&&s?[h,g]:c?h:s?g:null},n.extent=function(t){var e,r,u,a,h;return arguments.length?(c&&(e=t[0],r=t[1],s&&(e=e[0],r=r[0]),i=[e,r],c.invert&&(e=c(e),r=c(r)),e>r&&(h=e,e=r,r=h),(e!=l[0]||r!=l[1])&&(l=[e,r])),s&&(u=t[0],a=t[1],c&&(u=u[1],a=a[1]),o=[u,a],s.invert&&(u=s(u),a=s(a)),u>a&&(h=u,u=a,a=h),(u!=f[0]||a!=f[1])&&(f=[u,a])),n):(c&&(i?(e=i[0],r=i[1]):(e=l[0],r=l[1],c.invert&&(e=c.invert(e),r=c.invert(r)),e>r&&(h=e,e=r,r=h))),s&&(o?(u=o[0],a=o[1]):(u=f[0],a=f[1],s.invert&&(u=s.invert(u),a=s.invert(a)),u>a&&(h=u,u=a,a=h))),c&&s?[[e,u],[r,a]]:c?[e,r]:s&&[u,a])},n.clear=function(){return n.empty()||(l=[0,0],f=[0,0],i=o=null),n},n.empty=function(){return!!c&&l[0]==l[1]||!!s&&f[0]==f[1]},Xo.rebind(n,a,"on")};var zs={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Rs=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Ds=tc.format=ac.timeFormat,Ps=Ds.utc,Us=Ps("%Y-%m-%dT%H:%M:%S.%LZ");Ds.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Oo:Us,Oo.parse=function(n){var t=new Date(n);return isNaN(t)?null:t},Oo.toString=Us.toString,tc.second=Rt(function(n){return new ec(1e3*Math.floor(n/1e3))},function(n,t){n.setTime(n.getTime()+1e3*Math.floor(t))},function(n){return n.getSeconds()}),tc.seconds=tc.second.range,tc.seconds.utc=tc.second.utc.range,tc.minute=Rt(function(n){return new ec(6e4*Math.floor(n/6e4))},function(n,t){n.setTime(n.getTime()+6e4*Math.floor(t))},function(n){return n.getMinutes()}),tc.minutes=tc.minute.range,tc.minutes.utc=tc.minute.utc.range,tc.hour=Rt(function(n){var t=n.getTimezoneOffset()/60;return new ec(36e5*(Math.floor(n/36e5-t)+t))},function(n,t){n.setTime(n.getTime()+36e5*Math.floor(t))},function(n){return n.getHours()}),tc.hours=tc.hour.range,tc.hours.utc=tc.hour.utc.range,tc.month=Rt(function(n){return n=tc.day(n),n.setDate(1),n},function(n,t){n.setMonth(n.getMonth()+t)},function(n){return n.getMonth()}),tc.months=tc.month.range,tc.months.utc=tc.month.utc.range;var js=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Hs=[[tc.second,1],[tc.second,5],[tc.second,15],[tc.second,30],[tc.minute,1],[tc.minute,5],[tc.minute,15],[tc.minute,30],[tc.hour,1],[tc.hour,3],[tc.hour,6],[tc.hour,12],[tc.day,1],[tc.day,2],[tc.week,1],[tc.month,1],[tc.month,3],[tc.year,1]],Fs=Ds.multi([[".%L",function(n){return n.getMilliseconds()}],[":%S",function(n){return n.getSeconds()}],["%I:%M",function(n){return n.getMinutes()}],["%I %p",function(n){return n.getHours()}],["%a %d",function(n){return n.getDay()&&1!=n.getDate()}],["%b %d",function(n){return 1!=n.getDate()}],["%B",function(n){return n.getMonth()}],["%Y",be]]),Os={range:function(n,t,e){return Xo.range(Math.ceil(n/e)*e,+t,e).map(Io)},floor:bt,ceil:bt};Hs.year=tc.year,tc.scale=function(){return Yo(Xo.scale.linear(),Hs,Fs)};var Ys=Hs.map(function(n){return[n[0].utc,n[1]]}),Is=Ps.multi([[".%L",function(n){return n.getUTCMilliseconds()}],[":%S",function(n){return n.getUTCSeconds()}],["%I:%M",function(n){return n.getUTCMinutes()}],["%I %p",function(n){return n.getUTCHours()}],["%a %d",function(n){return n.getUTCDay()&&1!=n.getUTCDate()}],["%b %d",function(n){return 1!=n.getUTCDate()}],["%B",function(n){return n.getUTCMonth()}],["%Y",be]]);Ys.year=tc.year.utc,tc.scale.utc=function(){return Yo(Xo.scale.linear(),Ys,Is)},Xo.text=wt(function(n){return n.responseText}),Xo.json=function(n,t){return St(n,"application/json",Zo,t)},Xo.html=function(n,t){return St(n,"text/html",Vo,t)},Xo.xml=wt(function(n){return n.responseXML}),"function"==typeof define&&define.amd?define(Xo):"object"==typeof module&&module.exports?module.exports=Xo:this.d3=Xo}(); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/devscripts/COPYING b/chromium/third_party/catapult/tracing/third_party/devscripts/COPYING
deleted file mode 100644
index c74d291485b..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/devscripts/COPYING
+++ /dev/null
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/chromium/third_party/catapult/tracing/third_party/devscripts/README.chromium b/chromium/third_party/catapult/tracing/third_party/devscripts/README.chromium
deleted file mode 100644
index 1016e4cbebb..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/devscripts/README.chromium
+++ /dev/null
@@ -1,12 +0,0 @@
-Name: devscripts
-URL: http://anonscm.debian.org/gitweb/?p=devscripts/devscripts.git
-Version: 2.12.4
-Security Critical: no
-License: GPL 2.0
-
-Description:
-This directory contains selected tools from the Debian's devscripts collection.
-
-A .vanilla file is checked in so that our patched version can be easily
-compared with the unpatched script (e.g. when sending the changes upstream).
-Having a .patch file checked in was too inconvenient to keep up to date.
diff --git a/chromium/third_party/catapult/tracing/third_party/devscripts/licensecheck.pl b/chromium/third_party/catapult/tracing/third_party/devscripts/licensecheck.pl
deleted file mode 100755
index a59bbf96320..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/devscripts/licensecheck.pl
+++ /dev/null
@@ -1,671 +0,0 @@
-#!/usr/bin/perl -w
-# This script was originally based on the script of the same name from
-# the KDE SDK (by dfaure@kde.org)
-#
-# This version is
-# Copyright (C) 2007, 2008 Adam D. Barratt
-# Copyright (C) 2012 Francesco Poli
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
-
-=head1 NAME
-
-licensecheck - simple license checker for source files
-
-=head1 SYNOPSIS
-
-B<licensecheck> B<--help>|B<--version>
-
-B<licensecheck> [B<--no-conf>] [B<--verbose>] [B<--copyright>]
-[B<-l>|B<--lines=>I<N>] [B<-i>|B<--ignore=>I<regex>] [B<-c>|B<--check=>I<regex>]
-[B<-m>|B<--machine>] [B<-r>|B<--recursive>]
-I<list of files and directories to check>
-
-=head1 DESCRIPTION
-
-B<licensecheck> attempts to determine the license that applies to each file
-passed to it, by searching the start of the file for text belonging to
-various licenses.
-
-If any of the arguments passed are directories, B<licensecheck> will add
-the files contained within to the list of files to process.
-
-=head1 OPTIONS
-
-=over 4
-
-=item B<--verbose>, B<--no-verbose>
-
-Specify whether to output the text being processed from each file before
-the corresponding license information.
-
-Default is to be quiet.
-
-=item B<-l=>I<N>, B<--lines=>I<N>
-
-Specify the number of lines of each file's header which should be parsed
-for license information. (Default is 60).
-
-=item B<-i=>I<regex>, B<--ignore=>I<regex>
-
-When processing the list of files and directories, the regular
-expression specified by this option will be used to indicate those which
-should not be considered (e.g. backup files, VCS metadata).
-
-=item B<-r>, B<--recursive>
-
-Specify that the contents of directories should be added
-recursively.
-
-=item B<-c=>I<regex>, B<--check=>I<regex>
-
-Specify a pattern against which filenames will be matched in order to
-decide which files to check the license of.
-
-The default includes common source files.
-
-=item B<--copyright>
-
-Also display copyright text found within the file
-
-=item B<-m>, B<--machine>
-
-Display the information in a machine readable way, i.e. in the form
-<file><tab><license>[<tab><copyright>] so that it can be easily sorted
-and/or filtered, e.g. with the B<awk> and B<sort> commands.
-Note that using the B<--verbose> option will kill the readability.
-
-=item B<--no-conf>, B<--noconf>
-
-Do not read any configuration files. This can only be used as the first
-option given on the command-line.
-
-=back
-
-=head1 CONFIGURATION VARIABLES
-
-The two configuration files F</etc/devscripts.conf> and
-F<~/.devscripts> are sourced by a shell in that order to set
-configuration variables. Command line options can be used to override
-configuration file settings. Environment variable settings are
-ignored for this purpose. The currently recognised variables are:
-
-=over 4
-
-=item B<LICENSECHECK_VERBOSE>
-
-If this is set to I<yes>, then it is the same as the B<--verbose> command
-line parameter being used. The default is I<no>.
-
-=item B<LICENSECHECK_PARSELINES>
-
-If this is set to a positive number then the specified number of lines
-at the start of each file will be read whilst attempting to determine
-the license(s) in use. This is equivalent to the B<--lines> command line
-option.
-
-=back
-
-=head1 LICENSE
-
-This code is copyright by Adam D. Barratt <I<adam@adam-barratt.org.uk>>,
-all rights reserved; based on a script of the same name from the KDE
-SDK, which is copyright by <I<dfaure@kde.org>>.
-This program comes with ABSOLUTELY NO WARRANTY.
-You are free to redistribute this code under the terms of the GNU
-General Public License, version 2 or later.
-
-=head1 AUTHOR
-
-Adam D. Barratt <adam@adam-barratt.org.uk>
-
-=cut
-
-use strict;
-use warnings;
-use Getopt::Long qw(:config gnu_getopt);
-use File::Basename;
-use Tie::File;
-use Fcntl 'O_RDONLY';
-
-sub fatal($);
-sub parse_copyright($);
-sub parselicense($);
-sub remove_comments($);
-
-my $progname = basename($0);
-
-# From dpkg-source
-my $default_ignore_regex = '
-# Ignore general backup files
-(?:^|/).*~$|
-# Ignore emacs recovery files
-(?:^|/)\.#.*$|
-# Ignore vi swap files
-(?:^|/)\..*\.swp$|
-# Ignore baz-style junk files or directories
-(?:^|/),,.*(?:$|/.*$)|
-# File-names that should be ignored (never directories)
-(?:^|/)(?:DEADJOE|\.cvsignore|\.arch-inventory|\.bzrignore|\.gitignore)$|
-# File or directory names that should be ignored
-(?:^|/)(?:CVS|RCS|\.deps|\{arch\}|\.arch-ids|\.svn|\.hg|_darcs|\.git|
-\.shelf|_MTN|\.bzr(?:\.backup|tags)?)(?:$|/.*$)
-';
-
-# Take out comments and newlines
-$default_ignore_regex =~ s/^#.*$//mg;
-$default_ignore_regex =~ s/\n//sg;
-
-my $default_check_regex = '\.(c(c|pp|xx)?|h(h|pp|xx)?|f(77|90)?|p(l|m)|xs|sh|php|py(|x)|rb|java|vala|el|sc(i|e)|cs|pas|inc|dtd|xsl|mod|m|tex|mli?)$';
-
-my $modified_conf_msg;
-
-my ($opt_verbose, $opt_lines, $opt_noconf) = ('', '', '');
-my $opt_ignore_regex = $default_ignore_regex;
-my $opt_check_regex = $default_check_regex;
-my $opt_recursive = 0;
-my $opt_copyright = 0;
-my $opt_machine = 0;
-my ($opt_help, $opt_version);
-my $def_lines = 60;
-
-# Read configuration files and then command line
-# This is boilerplate
-
-if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) {
- $modified_conf_msg = " (no configuration files read)";
- shift;
-} else {
- my @config_files = ('/etc/devscripts.conf', '~/.devscripts');
- my %config_vars = (
- 'LICENSECHECK_VERBOSE' => 'no',
- 'LICENSECHECK_PARSELINES' => $def_lines,
- );
- my %config_default = %config_vars;
-
- my $shell_cmd;
- # Set defaults
- foreach my $var (keys %config_vars) {
- $shell_cmd .= qq[$var="$config_vars{$var}";\n];
- }
- $shell_cmd .= 'for file in ' . join(" ", @config_files) . "; do\n";
- $shell_cmd .= '[ -f $file ] && . $file; done;' . "\n";
- # Read back values
- foreach my $var (keys %config_vars) { $shell_cmd .= "echo \$$var;\n" }
- my $shell_out = `/bin/bash -c '$shell_cmd'`;
- @config_vars{keys %config_vars} = split /\n/, $shell_out, -1;
-
- # Check validity
- $config_vars{'LICENSECHECK_VERBOSE'} =~ /^(yes|no)$/
- or $config_vars{'LICENSECHECK_VERBOSE'} = 'no';
- $config_vars{'LICENSECHECK_PARSELINES'} =~ /^[1-9][0-9]*$/
- or $config_vars{'LICENSECHECK_PARSELINES'} = $def_lines;
-
- foreach my $var (sort keys %config_vars) {
- if ($config_vars{$var} ne $config_default{$var}) {
- $modified_conf_msg .= " $var=$config_vars{$var}\n";
- }
- }
- $modified_conf_msg ||= " (none)\n";
- chomp $modified_conf_msg;
-
- $opt_verbose = $config_vars{'LICENSECHECK_VERBOSE'} eq 'yes' ? 1 : 0;
- $opt_lines = $config_vars{'LICENSECHECK_PARSELINES'};
-}
-
-GetOptions("help|h" => \$opt_help,
- "version|v" => \$opt_version,
- "verbose!" => \$opt_verbose,
- "lines|l=i" => \$opt_lines,
- "ignore|i=s" => \$opt_ignore_regex,
- "recursive|r" => \$opt_recursive,
- "check|c=s" => \$opt_check_regex,
- "copyright" => \$opt_copyright,
- "machine|m" => \$opt_machine,
- "noconf" => \$opt_noconf,
- "no-conf" => \$opt_noconf,
- )
- or die "Usage: $progname [options] filelist\nRun $progname --help for more details\n";
-
-$opt_lines = $def_lines if $opt_lines !~ /^[1-9][0-9]*$/;
-
-if ($opt_noconf) {
- fatal "--no-conf is only acceptable as the first command-line option!";
-}
-if ($opt_help) { help(); exit 0; }
-if ($opt_version) { version(); exit 0; }
-
-die "Usage: $progname [options] filelist\nRun $progname --help for more details\n" unless @ARGV;
-
-$opt_lines = $def_lines if not defined $opt_lines;
-
-my @files = ();
-my @find_args = ();
-my $files_count = @ARGV;
-
-push @find_args, qw(-not ( -path */LayoutTests/* -prune ) );
-push @find_args, qw(-not ( -path */out/Debug/* -prune ) );
-push @find_args, qw(-not ( -path */out/Release/* -prune ) );
-push @find_args, qw(-not ( -path .git* -prune ) );
-push @find_args, qw(-not ( -path .svn* -prune ) );
-
-push @find_args, qw(-maxdepth 1) unless $opt_recursive;
-push @find_args, qw(-follow -type f -print);
-
-while (@ARGV) {
- my $file = shift @ARGV;
-
- if (-d $file) {
- open FIND, '-|', 'find', $file, @find_args
- or die "$progname: couldn't exec find: $!\n";
-
- while (<FIND>) {
- chomp;
- next unless m%$opt_check_regex%;
- # Skip empty files
- next if (-z $_);
- push @files, $_ unless m%$opt_ignore_regex%;
- }
- close FIND;
- } else {
- next unless ($files_count == 1) or $file =~ m%$opt_check_regex%;
- push @files, $file unless $file =~ m%$opt_ignore_regex%;
- }
-}
-
-while (@files) {
- my $file = shift @files;
- my $header = '';
- my $copyright_match;
- my $copyright = '';
- my $license = '';
- my %copyrights;
-
- open (F, "<$file") or die "Unable to access $file\n";
- while (<F>) {
- last if ($. > $opt_lines);
- $header .= $_;
- }
- close(F);
-
- $copyright = join(" / ", values %copyrights);
-
- print qq(----- $file header -----\n$header----- end header -----\n\n)
- if $opt_verbose;
-
- remove_comments($header);
- $license = parselicense($header);
-
- # If no license in header, check footer (slow, because read file backwards)
- # Need for instance for Perl files, which often use the footer
- if ($license eq "UNKNOWN") {
- my $footer = '';
- tie(my @file_lines, "Tie::File", $file, autochomp => 0, mode => O_RDONLY) or die("Unable to access $file\n");
- # Avoid indexing error if header is entire file
- if ($#file_lines >= $opt_lines) {
- foreach (@file_lines[-$opt_lines .. -1]) {
- $footer .= $_;
- }
- }
- print qq(----- $file footer -----\n$header----- end footer -----\n\n)
- if $opt_verbose;
- remove_comments($footer);
- $license = parselicense($footer);
- }
-
- if ($opt_machine) {
- print "$file\t$license";
- print "\t" . ($copyright or "*No copyright*") if $opt_copyright;
- print "\n";
- } else {
- print "$file: ";
- print "*No copyright* " unless $copyright;
- print $license . "\n";
- print " [Copyright: " . $copyright . "]\n"
- if $copyright and $opt_copyright;
- print "\n" if $opt_copyright;
- }
-}
-
-sub remove_comments($) {
- $_ = $_[0];
- # Remove Fortran comments
- s/^[cC] //gm;
- # Remove .ASM comments
- s#^;\*?##gm;
- # Remove .S comments
- s#^@ ##gm;
- # Remove new lines
- tr/\t\r\n/ /;
- # Remove C / C++ comments
- s#(\*/|/[/*])##g;
- # Remove all characters not matching search
- tr% A-Za-z.,@;0-9\(\)/-%%cd;
- # Collapse multiple spaces into single space
- tr/ //s;
- $_[0] = $_;
-}
-
-sub parse_copyright($) {
- my $copyright = '';
- my $match;
-
- my $copyright_indicator_regex = '
- (?:copyright # The full word
- |copr\. # Legally-valid abbreviation
- |\x{00a9} # Unicode character COPYRIGHT SIGN
- |\xc2\xa9 # Unicode copyright sign encoded in iso8859
- |\(c\) # Legally-null representation of sign
- )';
- my $copyright_disindicator_regex = '
- \b(?:info(?:rmation)? # Discussing copyright information
- |notice # Discussing the notice
- |and|or # Part of a sentence
- )\b';
-
- if (m%$copyright_indicator_regex(?::\s*|\s+)(\S.*)$%ix) {
- $match = $1;
-
- # Ignore lines matching "see foo for copyright information" etc.
- if ($match !~ m%^\s*$copyright_disindicator_regex%ix) {
- # De-cruft
- $match =~ s/([,.])?\s*$//;
- $match =~ s/$copyright_indicator_regex//igx;
- $match =~ s/^\s+//;
- $match =~ s/\s{2,}/ /g;
- $match =~ s/\\@/@/g;
- $copyright = $match;
- }
- }
-
- return $copyright;
-}
-
-sub help {
- print <<"EOF";
-Usage: $progname [options] filename [filename ...]
-Valid options are:
- --help, -h Display this message
- --version, -v Display version and copyright info
- --no-conf, --noconf Don't read devscripts config files; must be
- the first option given
- --verbose Display the header of each file before its
- license information
- --lines, -l Specify how many lines of the file header
- should be parsed for license information
- (Default: $def_lines)
- --check, -c Specify a pattern indicating which files should
- be checked
- (Default: '$default_check_regex')
- --machine, -m Display in a machine readable way (good for awk)
- --recursive, -r Add the contents of directories recursively
- --copyright Also display the file's copyright
- --ignore, -i Specify that files / directories matching the
- regular expression should be ignored when
- checking files
- (Default: '$default_ignore_regex')
-
-Default settings modified by devscripts configuration files:
-$modified_conf_msg
-EOF
-}
-
-sub version {
- print <<"EOF";
-This is $progname, from the Debian devscripts package, version ###VERSION###
-Copyright (C) 2007, 2008 by Adam D. Barratt <adam\@adam-barratt.org.uk>; based
-on a script of the same name from the KDE SDK by <dfaure\@kde.org>.
-
-This program comes with ABSOLUTELY NO WARRANTY.
-You are free to redistribute this code under the terms of the
-GNU General Public License, version 2, or (at your option) any
-later version.
-EOF
-}
-
-sub parselicense($) {
- my ($licensetext) = @_;
-
- my $gplver = "";
- my $lgplver = "";
- my $extrainfo = "";
- my $license = "";
-
- if ($licensetext =~ /version ([^, ]+?)[.,]? (?:\(?only\)?.? )?(?:of the GNU (Affero )?General Public License )?(as )?published by the Free Software Foundation/i or
- $licensetext =~ /GNU (?:Affero )?General Public License (?:as )?published by the Free Software Foundation; version ([^, ]+?)[.,]? /i or
- $licensetext =~ /GNU (?:Affero )?General Public License,? [Vv]ersion (\d+(?:\.\d+)?)[ \.]/) {
- $gplver = " (v$1)";
- } elsif ($licensetext =~ /either version ([^ ]+)(?: of the License)?, or \(at your option\) any later version/) {
- $gplver = " (v$1 or later)";
- }
-
- if ($licensetext =~ /version ([^, ]+?)[.,]? (?:or later|or any later version) (?:of the GNU (?:Lesser |Library )General Public License )(as )?published by the Free Software Foundation/i or
- $licensetext =~ /(?:GNU (?:Lesser |Library )|(?:Lesser|Library) GNU )General Public License (?:(?:as )?published by the Free Software Foundation;)?,? (?:either )?[Vv]ersion ([^, ]+?)(?: of the license)?[.,]? (?:or later|or (?:\(at your option\) )?any later version)/i or
- $licensetext =~ /GNU (?:Lesser |Library )General Public License(?: \(LGPL\))?,? [Vv]ersion (\d+(?:\.\d+)?)[ \.]/) {
- $lgplver = " (v$1 or later)";
- }
-
- if ($licensetext =~ /permission (?:is (also granted|given))? to link (the code of )?this program with (any edition of )?(Qt|the Qt library)/i) {
- $extrainfo = " (with Qt exception)$extrainfo"
- }
-
- if ($licensetext =~ /(All changes made in this file will be lost|DO NOT (EDIT|delete this file)|Generated (automatically|by|from)|generated.*file)/i) {
- $license = "GENERATED FILE";
- }
-
- if ($licensetext =~ /is (free software.? you can redistribute it and\/or modify it|licensed) under the terms of (version [^ ]+ of )?the (GNU (Library |Lesser )General Public License|LGPL)/i or
- $licensetext =~ /(is distributed|may be used|can redistribute).*terms.*(LGPL|(Lesser|Library) GNU General Public License)/) {
- if ($lgplver) {
- $license = "LGPL$lgplver$extrainfo $license";
- } else {
- $license = "LGPL (unversioned/unknown version) $license";
- }
- }
-
- if ($licensetext =~ /is free software.? you (can|may) redistribute it and\/or modify it under the terms of (?:version [^ ]+ (?:\(?only\)? )?of )?the GNU General Public License/i) {
- $license = "GPL$gplver$extrainfo $license";
- } elsif ($licensetext =~ /is distributed under the terms of the GNU General Public License,/
- and $gplver) {
- $license = "GPL$gplver$extrainfo $license";
- } elsif ($licensetext =~ /is distributed.*terms.*[^L]GPL/) {
- if ($gplver) {
- $license = "GPL$gplver$extrainfo $license";
- } else {
- $license = "GPL (unversioned/unknown version) $license";
- }
- }
-
- if ($licensetext =~ /This file is part of the .*Qt GUI Toolkit. This file may be distributed under the terms of the Q Public License as defined/) {
- $license = "QPL (part of Qt) $license";
- } elsif ($licensetext =~ /may be distributed under the terms of the Q Public License as defined/) {
- $license = "QPL $license";
- }
-
- if ($licensetext =~ /opensource\.org\/licenses\/mit/) {
- $license = "MIT/X11 (BSD like) $license";
- } elsif ($licensetext =~ /Permission is hereby granted, free of charge, to any person obtaining a copy of this software and(\/or)? associated documentation files \(the (Software|Materials)\), to deal in the (Software|Materials)/) {
- $license = "MIT/X11 (BSD like) $license";
- } elsif ($licensetext =~ /Permission is hereby granted, without written agreement and without license or royalty fees, to use, copy, modify, and distribute this software and its documentation for any purpose/) {
- $license = "MIT/X11 (BSD like) $license";
- } elsif ($licensetext =~ /Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee/) {
- $license = "MIT/X11 (BSD like) $license";
- } elsif ($licensetext =~ /MIT .* License/) {
- $license = "MIT/X11 (BSD like) $license";
- }
-
- if ($licensetext =~ /This file is part of the Independent JPEG Group(')?s software.*For conditions of distribution and use, see the accompanying README file/i) {
- $license = "Independent JPEG Group License $license";
- }
-
- if ($licensetext =~ /the University of Illinois Open Source License/){
- $license = "University of Illinois/NCSA Open Source License (BSD like) $license";
- }
-
- if ($licensetext =~ /Permission to use, copy, modify, and(\/or)? distribute this software (and its documentation )?for any purpose (with or )?without fee is hereby granted, provided.*(copyright|entire) notice.*all copies/i) {
- $license = "ISC $license";
- }
-
- if ($licensetext =~ /THIS SOFTWARE IS PROVIDED .*AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY/ ||
- $licensetext =~ /THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- ITY/) {
- if ($licensetext =~ /All advertising materials mentioning features or use of this software must display the following/) {
- $license = "BSD (4 clause) $license";
- } elsif ($licensetext =~ /be used to endorse or promote products derived from this software/) {
- $license = "BSD (3 clause) $license";
- } elsif ($licensetext =~ /Redistributions of source code must retain the above copyright notice/) {
- $license = "BSD (2 clause) $license";
- } else {
- $license = "BSD $license";
- }
- } elsif ($licensetext =~ /Use of this source code is governed by a BSD-style license/) {
- $license = "BSD-like $license";
- } elsif ($licensetext =~ /BSD terms apply/) {
- $license = "BSD-like $license";
- } elsif ($licensetext =~ /subject to the BSD License/) {
- # TODO(sbc): remove this case once we fix: http://crbug.com/177268
- $license = "BSD-like $license";
- } elsif ($licensetext =~ /license BSD/) {
- $license = "BSD-like $license";
- } elsif ($licensetext =~ /GOVERNED BY A BSD-STYLE SOURCE LICENSE/) {
- $license = "BSD-like $license";
- } elsif ($licensetext =~ /BSD 3-Clause license/) {
- $license = "BSD (3 clause) $license";
- }
-
- if ($licensetext =~ /Mozilla Public License( Version|, v.) ([^ ]+[^., ]),?/) {
- $license = "MPL (v$2) $license";
- }
-
- if ($licensetext =~ /Released under the terms of the Artistic License ([^ ]+)/) {
- $license = "Artistic (v$1) $license";
- }
-
- if ($licensetext =~ /is free software under the Artistic [Ll]icense/) {
- $license = "Artistic $license";
- }
-
- if ($licensetext =~ /This (program|library) is free software; you can redistribute it and\/or modify it under the same terms as Perl itself/) {
- $license = "Perl $license";
- }
-
- if ($licensetext =~ /under the terms of the Apache ([^ ]+) License OR version 2 of the GNU/) {
- $license = "Apache (v$1) GPL (v2) $license";
- } elsif ($licensetext =~ /under the Apache License, Version ([^ ]+)/) {
- $license = "Apache (v$1) $license";
- }
-
- if ($licensetext =~ /(THE BEER-WARE LICENSE)/i) {
- $license = "Beerware $license";
- }
-
- if ($licensetext =~ /This source file is subject to version ([^ ]+) of the PHP license/) {
- $license = "PHP (v$1) $license";
- }
-
- if ($licensetext =~ /under the terms of the CeCILL /) {
- $license = "CeCILL $license";
- }
-
- if ($licensetext =~ /under the terms of the CeCILL-([^ ]+) /) {
- $license = "CeCILL-$1 $license";
- }
-
- if ($licensetext =~ /under the SGI Free Software (B License|License B)/) {
- $license = "SGI Free Software License B $license";
- }
-
- if ($licensetext =~ /(in|into) the public domain/i) {
- $license = "Public domain $license";
- }
-
- if ($licensetext =~ /terms of the Common Development and Distribution License(, Version ([^(]+))? \(the License\)/) {
- $license = "CDDL " . ($1 ? "(v$2) " : '') . $license;
- }
-
- if ($licensetext =~ /Microsoft Permissive License \(Ms-PL\)/) {
- $license = "Ms-PL $license";
- }
-
- if ($licensetext =~ /as defined in and that are subject to the Apple Public Source License([ ,-]+Version ([^ ]+)?(\.))/) {
- $license = "APSL " . ($1 ? "(v$2) " : '') . $license;
- } elsif ($licensetext =~ /provided that if you redistribute the Apple Software in its entirety and without modifications, you must retain this notice and the following text and disclaimers in all such redistributions of the Apple Software/) {
- # https://fedoraproject.org/wiki/Licensing/Apple_MIT_License
- $license = "Apple MIT $license";
- }
-
- if ($licensetext =~ /Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license \([\"]?the Software[\"]?\)/ or
- $licensetext =~ /Boost Software License([ ,-]+Version ([^ ]+)?(\.))/i) {
- $license = "BSL " . ($1 ? "(v$2) " : '') . $license;
- }
-
- if ($licensetext =~ /PYTHON SOFTWARE FOUNDATION LICENSE (VERSION ([^ ]+))/i) {
- $license = "PSF " . ($1 ? "(v$2) " : '') . $license;
- }
-
- if ($licensetext =~ /The origin of this software must not be misrepresented.*Altered source versions must be plainly marked as such.*This notice may not be removed or altered from any source distribution/ or
- $licensetext =~ /see copyright notice in zlib\.h/) {
- $license = "zlib/libpng $license";
- } elsif ($licensetext =~ /This code is released under the libpng license/) {
- $license = "libpng $license";
- }
-
- if ($licensetext =~ /under MIT license/) {
- $license = "MIT/X11 (BSD like) $license";
- }
-
- if ($licensetext =~ /License MIT(-| )License/) {
- $license = "MIT/X11 (BSD like) $license";
- }
-
- if ($licensetext =~ /As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice/) {
- $license = $license . "with Bison parser exception";
- }
-
- if ($licensetext =~ /As a special exception to the GNU General Public License, if you distribute this file as part of a program or library that is built using GNU Libtool, you may include this file under the same distribution terms that you use for the rest of that program/) {
- $license = $license . "with libtool exception";
- }
-
- if ($licensetext =~ /These materials are protected by copyright laws and contain material proprietary to the Khronos Group, Inc\. You may use these materials for implementing Khronos specifications, without altering or removing any trademark, copyright or other notice from the specification/) {
- $license = $license . "Khronos Group";
- }
-
- if ($licensetext =~ /This file is part of the FreeType project, and may only be used(,)? modified(,)? and distributed under the terms of the FreeType project license, LICENSE\.TXT\. By continuing to use, modify, or distribute this file you indicate that you have read the license and understand and accept it fully/) {
- $license = "FreeType (BSD like) $license";
- }
- if ($licensetext =~ /This software, and all works of authorship, whether in source or object code form as indicated by the copyright notice.*is made available, and may only be used, modified, and distributed under the FreeType Project License, LICENSE\.TXT\. Additionally, subject to the terms and conditions of the FreeType Project License, each contributor to the Work hereby grants to any individual or legal entity exercising permissions granted by the FreeType Project License and this section.*a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable.*patent license to make/) {
- $license = "FreeType (BSD like) with patent clause $license";
- }
-
- if ($licensetext =~ /Anti-Grain Geometry.*Permission to copy, use, modify, sell and distribute this software is granted provided this copyright notice appears in all copies. This software is provided as is without express or impl/) {
- $license = "Anti-Grain Geometry $license";
- }
-
- if ($licensetext =~ /Developed at SunSoft, a Sun Microsystems, Inc\. business\. Permission to use, copy, modify, and distribute this software is freely granted, provided that this notice is preserved\./) {
- $license = "SunSoft (BSD like) $license";
- }
-
- $license = "UNKNOWN" unless $license;
-
- # Remove trailing spaces.
- $license =~ s/\s+$//;
-
- return $license;
-}
-
-sub fatal($) {
- my ($pack,$file,$line);
- ($pack,$file,$line) = caller();
- (my $msg = "$progname: fatal error at line $line:\n@_\n") =~ tr/\0//d;
- $msg =~ s/\n\n$/\n/;
- die $msg;
-}
diff --git a/chromium/third_party/catapult/tracing/third_party/devscripts/licensecheck.pl.vanilla b/chromium/third_party/catapult/tracing/third_party/devscripts/licensecheck.pl.vanilla
deleted file mode 100644
index d98b974adda..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/devscripts/licensecheck.pl.vanilla
+++ /dev/null
@@ -1,577 +0,0 @@
-#!/usr/bin/perl -w
-# This script was originally based on the script of the same name from
-# the KDE SDK (by dfaure@kde.org)
-#
-# This version is
-# Copyright (C) 2007, 2008 Adam D. Barratt
-# Copyright (C) 2012 Francesco Poli
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along
-# with this program. If not, see <http://www.gnu.org/licenses/>.
-
-=head1 NAME
-
-licensecheck - simple license checker for source files
-
-=head1 SYNOPSIS
-
-B<licensecheck> B<--help>|B<--version>
-
-B<licensecheck> [B<--no-conf>] [B<--verbose>] [B<--copyright>]
-[B<-l>|B<--lines=>I<N>] [B<-i>|B<--ignore=>I<regex>] [B<-c>|B<--check=>I<regex>]
-[B<-m>|B<--machine>] [B<-r>|B<--recursive>]
-I<list of files and directories to check>
-
-=head1 DESCRIPTION
-
-B<licensecheck> attempts to determine the license that applies to each file
-passed to it, by searching the start of the file for text belonging to
-various licenses.
-
-If any of the arguments passed are directories, B<licensecheck> will add
-the files contained within to the list of files to process.
-
-=head1 OPTIONS
-
-=over 4
-
-=item B<--verbose>, B<--no-verbose>
-
-Specify whether to output the text being processed from each file before
-the corresponding license information.
-
-Default is to be quiet.
-
-=item B<-l=>I<N>, B<--lines=>I<N>
-
-Specify the number of lines of each file's header which should be parsed
-for license information. (Default is 60).
-
-=item B<-i=>I<regex>, B<--ignore=>I<regex>
-
-When processing the list of files and directories, the regular
-expression specified by this option will be used to indicate those which
-should not be considered (e.g. backup files, VCS metadata).
-
-=item B<-r>, B<--recursive>
-
-Specify that the contents of directories should be added
-recursively.
-
-=item B<-c=>I<regex>, B<--check=>I<regex>
-
-Specify a pattern against which filenames will be matched in order to
-decide which files to check the license of.
-
-The default includes common source files.
-
-=item B<--copyright>
-
-Also display copyright text found within the file
-
-=item B<-m>, B<--machine>
-
-Display the information in a machine readable way, i.e. in the form
-<file><tab><license>[<tab><copyright>] so that it can be easily sorted
-and/or filtered, e.g. with the B<awk> and B<sort> commands.
-Note that using the B<--verbose> option will kill the readability.
-
-=item B<--no-conf>, B<--noconf>
-
-Do not read any configuration files. This can only be used as the first
-option given on the command-line.
-
-=back
-
-=head1 CONFIGURATION VARIABLES
-
-The two configuration files F</etc/devscripts.conf> and
-F<~/.devscripts> are sourced by a shell in that order to set
-configuration variables. Command line options can be used to override
-configuration file settings. Environment variable settings are
-ignored for this purpose. The currently recognised variables are:
-
-=over 4
-
-=item B<LICENSECHECK_VERBOSE>
-
-If this is set to I<yes>, then it is the same as the B<--verbose> command
-line parameter being used. The default is I<no>.
-
-=item B<LICENSECHECK_PARSELINES>
-
-If this is set to a positive number then the specified number of lines
-at the start of each file will be read whilst attempting to determine
-the license(s) in use. This is equivalent to the B<--lines> command line
-option.
-
-=back
-
-=head1 LICENSE
-
-This code is copyright by Adam D. Barratt <I<adam@adam-barratt.org.uk>>,
-all rights reserved; based on a script of the same name from the KDE
-SDK, which is copyright by <I<dfaure@kde.org>>.
-This program comes with ABSOLUTELY NO WARRANTY.
-You are free to redistribute this code under the terms of the GNU
-General Public License, version 2 or later.
-
-=head1 AUTHOR
-
-Adam D. Barratt <adam@adam-barratt.org.uk>
-
-=cut
-
-use strict;
-use warnings;
-use Getopt::Long qw(:config gnu_getopt);
-use File::Basename;
-
-sub fatal($);
-sub parse_copyright($);
-sub parselicense($);
-
-my $progname = basename($0);
-
-# From dpkg-source
-my $default_ignore_regex = '
-# Ignore general backup files
-(?:^|/).*~$|
-# Ignore emacs recovery files
-(?:^|/)\.#.*$|
-# Ignore vi swap files
-(?:^|/)\..*\.swp$|
-# Ignore baz-style junk files or directories
-(?:^|/),,.*(?:$|/.*$)|
-# File-names that should be ignored (never directories)
-(?:^|/)(?:DEADJOE|\.cvsignore|\.arch-inventory|\.bzrignore|\.gitignore)$|
-# File or directory names that should be ignored
-(?:^|/)(?:CVS|RCS|\.deps|\{arch\}|\.arch-ids|\.svn|\.hg|_darcs|\.git|
-\.shelf|_MTN|\.bzr(?:\.backup|tags)?)(?:$|/.*$)
-';
-
-# Take out comments and newlines
-$default_ignore_regex =~ s/^#.*$//mg;
-$default_ignore_regex =~ s/\n//sg;
-
-my $default_check_regex = '\.(c(c|pp|xx)?|h(h|pp|xx)?|f(77|90)?|p(l|m)|xs|sh|php|py(|x)|rb|java|vala|el|sc(i|e)|cs|pas|inc|dtd|xsl|mod|m|tex|mli?)$';
-
-my $modified_conf_msg;
-
-my ($opt_verbose, $opt_lines, $opt_noconf, $opt_ignore_regex, $opt_check_regex)
- = ('', '', '', '', '');
-my $opt_recursive = 0;
-my $opt_copyright = 0;
-my $opt_machine = 0;
-my ($opt_help, $opt_version);
-my $def_lines = 60;
-
-# Read configuration files and then command line
-# This is boilerplate
-
-if (@ARGV and $ARGV[0] =~ /^--no-?conf$/) {
- $modified_conf_msg = " (no configuration files read)";
- shift;
-} else {
- my @config_files = ('/etc/devscripts.conf', '~/.devscripts');
- my %config_vars = (
- 'LICENSECHECK_VERBOSE' => 'no',
- 'LICENSECHECK_PARSELINES' => $def_lines,
- );
- my %config_default = %config_vars;
-
- my $shell_cmd;
- # Set defaults
- foreach my $var (keys %config_vars) {
- $shell_cmd .= qq[$var="$config_vars{$var}";\n];
- }
- $shell_cmd .= 'for file in ' . join(" ", @config_files) . "; do\n";
- $shell_cmd .= '[ -f $file ] && . $file; done;' . "\n";
- # Read back values
- foreach my $var (keys %config_vars) { $shell_cmd .= "echo \$$var;\n" }
- my $shell_out = `/bin/bash -c '$shell_cmd'`;
- @config_vars{keys %config_vars} = split /\n/, $shell_out, -1;
-
- # Check validity
- $config_vars{'LICENSECHECK_VERBOSE'} =~ /^(yes|no)$/
- or $config_vars{'LICENSECHECK_VERBOSE'} = 'no';
- $config_vars{'LICENSECHECK_PARSELINES'} =~ /^[1-9][0-9]*$/
- or $config_vars{'LICENSECHECK_PARSELINES'} = $def_lines;
-
- foreach my $var (sort keys %config_vars) {
- if ($config_vars{$var} ne $config_default{$var}) {
- $modified_conf_msg .= " $var=$config_vars{$var}\n";
- }
- }
- $modified_conf_msg ||= " (none)\n";
- chomp $modified_conf_msg;
-
- $opt_verbose = $config_vars{'LICENSECHECK_VERBOSE'} eq 'yes' ? 1 : 0;
- $opt_lines = $config_vars{'LICENSECHECK_PARSELINES'};
-}
-
-GetOptions("help|h" => \$opt_help,
- "version|v" => \$opt_version,
- "verbose!" => \$opt_verbose,
- "lines|l=i" => \$opt_lines,
- "ignore|i=s" => \$opt_ignore_regex,
- "recursive|r" => \$opt_recursive,
- "check|c=s" => \$opt_check_regex,
- "copyright" => \$opt_copyright,
- "machine|m" => \$opt_machine,
- "noconf" => \$opt_noconf,
- "no-conf" => \$opt_noconf,
- )
- or die "Usage: $progname [options] filelist\nRun $progname --help for more details\n";
-
-$opt_lines = $def_lines if $opt_lines !~ /^[1-9][0-9]*$/;
-$opt_ignore_regex = $default_ignore_regex if ! length $opt_ignore_regex;
-$opt_check_regex = $default_check_regex if ! length $opt_check_regex;
-
-if ($opt_noconf) {
- fatal "--no-conf is only acceptable as the first command-line option!";
-}
-if ($opt_help) { help(); exit 0; }
-if ($opt_version) { version(); exit 0; }
-
-die "Usage: $progname [options] filelist\nRun $progname --help for more details\n" unless @ARGV;
-
-$opt_lines = $def_lines if not defined $opt_lines;
-
-my @files = ();
-my @find_args = ();
-my $files_count = @ARGV;
-
-push @find_args, qw(-maxdepth 1) unless $opt_recursive;
-push @find_args, qw(-follow -type f -print);
-
-while (@ARGV) {
- my $file = shift @ARGV;
-
- if (-d $file) {
- open FIND, '-|', 'find', $file, @find_args
- or die "$progname: couldn't exec find: $!\n";
-
- while (<FIND>) {
- chomp;
- next unless m%$opt_check_regex%;
- # Skip empty files
- next if (-z $_);
- push @files, $_ unless m%$opt_ignore_regex%;
- }
- close FIND;
- } else {
- next unless ($files_count == 1) or $file =~ m%$opt_check_regex%;
- push @files, $file unless $file =~ m%$opt_ignore_regex%;
- }
-}
-
-while (@files) {
- my $file = shift @files;
- my $content = '';
- my $copyright_match;
- my $copyright = '';
- my $license = '';
- my %copyrights;
-
- open (F, "<$file") or die "Unable to access $file\n";
- while (<F>) {
- last if ($. > $opt_lines);
- $content .= $_;
- $copyright_match = parse_copyright($_);
- if ($copyright_match) {
- $copyrights{lc("$copyright_match")} = "$copyright_match";
- }
- }
- close(F);
-
- $copyright = join(" / ", values %copyrights);
-
- print qq(----- $file header -----\n$content----- end header -----\n\n)
- if $opt_verbose;
-
- # Remove Fortran comments
- $content =~ s/^[cC] //gm;
- $content =~ tr/\t\r\n/ /;
- # Remove C / C++ comments
- $content =~ s#(\*/|/[/*])##g;
- $content =~ tr% A-Za-z.,@;0-9\(\)/-%%cd;
- $content =~ tr/ //s;
-
- $license = parselicense($content);
- if ($opt_machine) {
- print "$file\t$license";
- print "\t" . ($copyright or "*No copyright*") if $opt_copyright;
- print "\n";
- } else {
- print "$file: ";
- print "*No copyright* " unless $copyright;
- print $license . "\n";
- print " [Copyright: " . $copyright . "]\n"
- if $copyright and $opt_copyright;
- print "\n" if $opt_copyright;
- }
-}
-
-sub parse_copyright($) {
- my $copyright = '';
- my $match;
-
- my $copyright_indicator_regex = '
- (?:copyright # The full word
- |copr\. # Legally-valid abbreviation
- |\x{00a9} # Unicode character COPYRIGHT SIGN
- |\xc2\xa9 # Unicode copyright sign encoded in iso8859
- |\(c\) # Legally-null representation of sign
- )';
- my $copyright_disindicator_regex = '
- \b(?:info(?:rmation)? # Discussing copyright information
- |notice # Discussing the notice
- |and|or # Part of a sentence
- )\b';
-
- if (m%$copyright_indicator_regex(?::\s*|\s+)(\S.*)$%ix) {
- $match = $1;
-
- # Ignore lines matching "see foo for copyright information" etc.
- if ($match !~ m%^\s*$copyright_disindicator_regex%ix) {
- # De-cruft
- $match =~ s/([,.])?\s*$//;
- $match =~ s/$copyright_indicator_regex//igx;
- $match =~ s/^\s+//;
- $match =~ s/\s{2,}/ /g;
- $match =~ s/\\@/@/g;
- $copyright = $match;
- }
- }
-
- return $copyright;
-}
-
-sub help {
- print <<"EOF";
-Usage: $progname [options] filename [filename ...]
-Valid options are:
- --help, -h Display this message
- --version, -v Display version and copyright info
- --no-conf, --noconf Don't read devscripts config files; must be
- the first option given
- --verbose Display the header of each file before its
- license information
- --lines, -l Specify how many lines of the file header
- should be parsed for license information
- (Default: $def_lines)
- --check, -c Specify a pattern indicating which files should
- be checked
- (Default: '$default_check_regex')
- --machine, -m Display in a machine readable way (good for awk)
- --recursive, -r Add the contents of directories recursively
- --copyright Also display the file's copyright
- --ignore, -i Specify that files / directories matching the
- regular expression should be ignored when
- checking files
- (Default: '$default_ignore_regex')
-
-Default settings modified by devscripts configuration files:
-$modified_conf_msg
-EOF
-}
-
-sub version {
- print <<"EOF";
-This is $progname, from the Debian devscripts package, version ###VERSION###
-Copyright (C) 2007, 2008 by Adam D. Barratt <adam\@adam-barratt.org.uk>; based
-on a script of the same name from the KDE SDK by <dfaure\@kde.org>.
-
-This program comes with ABSOLUTELY NO WARRANTY.
-You are free to redistribute this code under the terms of the
-GNU General Public License, version 2, or (at your option) any
-later version.
-EOF
-}
-
-sub parselicense($) {
- my ($licensetext) = @_;
-
- my $gplver = "";
- my $extrainfo = "";
- my $license = "";
-
- if ($licensetext =~ /version ([^, ]+?)[.,]? (?:\(?only\)?.? )?(?:of the GNU (Affero )?(Lesser |Library )?General Public License )?(as )?published by the Free Software Foundation/i or
- $licensetext =~ /GNU (?:Affero )?(?:Lesser |Library )?General Public License (?:as )?published by the Free Software Foundation; version ([^, ]+?)[.,]? /i) {
-
- $gplver = " (v$1)";
- } elsif ($licensetext =~ /GNU (?:Affero )?(?:Lesser |Library )?General Public License, version (\d+(?:\.\d+)?)[ \.]/) {
- $gplver = " (v$1)";
- } elsif ($licensetext =~ /either version ([^ ]+)(?: of the License)?, or \(at your option\) any later version/) {
- $gplver = " (v$1 or later)";
- }
-
- if ($licensetext =~ /(?:675 Mass Ave|59 Temple Place|51 Franklin Steet|02139|02111-1307)/i) {
- $extrainfo = " (with incorrect FSF address)$extrainfo";
- }
-
- if ($licensetext =~ /permission (?:is (also granted|given))? to link (the code of )?this program with (any edition of )?(Qt|the Qt library)/i) {
- $extrainfo = " (with Qt exception)$extrainfo"
- }
-
- if ($licensetext =~ /(All changes made in this file will be lost|DO NOT (EDIT|delete this file)|Generated (automatically|by|from)|generated.*file)/i) {
- $license = "GENERATED FILE";
- }
-
- if ($licensetext =~ /is (free software.? you can redistribute it and\/or modify it|licensed) under the terms of (version [^ ]+ of )?the (GNU (Library |Lesser )General Public License|LGPL)/i) {
- $license = "LGPL$gplver$extrainfo $license";
- }
-
- if ($licensetext =~ /is free software.? you can redistribute it and\/or modify it under the terms of the (GNU Affero General Public License|AGPL)/i) {
- $license = "AGPL$gplver$extrainfo $license";
- }
-
- if ($licensetext =~ /is free software.? you (can|may) redistribute it and\/or modify it under the terms of (?:version [^ ]+ (?:\(?only\)? )?of )?the GNU General Public License/i) {
- $license = "GPL$gplver$extrainfo $license";
- }
-
- if ($licensetext =~ /is distributed under the terms of the GNU General Public License,/
- and length $gplver) {
- $license = "GPL$gplver$extrainfo $license";
- }
-
- if ($licensetext =~ /is distributed.*terms.*GPL/) {
- $license = "GPL (unversioned/unknown version) $license";
- }
-
- if ($licensetext =~ /This file is part of the .*Qt GUI Toolkit. This file may be distributed under the terms of the Q Public License as defined/) {
- $license = "QPL (part of Qt) $license";
- } elsif ($licensetext =~ /may be distributed under the terms of the Q Public License as defined/) {
- $license = "QPL $license";
- }
-
- if ($licensetext =~ /opensource\.org\/licenses\/mit-license\.php/) {
- $license = "MIT/X11 (BSD like) $license";
- } elsif ($licensetext =~ /Permission is hereby granted, free of charge, to any person obtaining a copy of this software and(\/or)? associated documentation files \(the (Software|Materials)\), to deal in the (Software|Materials)/) {
- $license = "MIT/X11 (BSD like) $license";
- } elsif ($licensetext =~ /Permission is hereby granted, without written agreement and without license or royalty fees, to use, copy, modify, and distribute this software and its documentation for any purpose/) {
- $license = "MIT/X11 (BSD like) $license";
- }
-
- if ($licensetext =~ /Permission to use, copy, modify, and(\/or)? distribute this software for any purpose with or without fee is hereby granted, provided.*copyright notice.*permission notice.*all copies/) {
- $license = "ISC $license";
- }
-
- if ($licensetext =~ /THIS SOFTWARE IS PROVIDED .*AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY/) {
- if ($licensetext =~ /All advertising materials mentioning features or use of this software must display the following acknowledge?ment.*This product includes software developed by/i) {
- $license = "BSD (4 clause) $license";
- } elsif ($licensetext =~ /(The name .*? may not|Neither the names? .*? nor the names of (its|their) contributors may) be used to endorse or promote products derived from this software/i) {
- $license = "BSD (3 clause) $license";
- } elsif ($licensetext =~ /Redistributions of source code must retain the above copyright notice/i) {
- $license = "BSD (2 clause) $license";
- } else {
- $license = "BSD $license";
- }
- }
-
- if ($licensetext =~ /Mozilla Public License Version ([^ ]+)/) {
- $license = "MPL (v$1) $license";
- }
-
- if ($licensetext =~ /Released under the terms of the Artistic License ([^ ]+)/) {
- $license = "Artistic (v$1) $license";
- }
-
- if ($licensetext =~ /is free software under the Artistic [Ll]icense/) {
- $license = "Artistic $license";
- }
-
- if ($licensetext =~ /This program is free software; you can redistribute it and\/or modify it under the same terms as Perl itself/) {
- $license = "Perl $license";
- }
-
- if ($licensetext =~ /under the Apache License, Version ([^ ]+)/) {
- $license = "Apache (v$1) $license";
- }
-
- if ($licensetext =~ /(THE BEER-WARE LICENSE)/i) {
- $license = "Beerware $license";
- }
-
- if ($licensetext =~ /This source file is subject to version ([^ ]+) of the PHP license/) {
- $license = "PHP (v$1) $license";
- }
-
- if ($licensetext =~ /under the terms of the CeCILL /) {
- $license = "CeCILL $license";
- }
-
- if ($licensetext =~ /under the terms of the CeCILL-([^ ]+) /) {
- $license = "CeCILL-$1 $license";
- }
-
- if ($licensetext =~ /under the SGI Free Software License B/) {
- $license = "SGI Free Software License B $license";
- }
-
- if ($licensetext =~ /is in the public domain/i) {
- $license = "Public domain $license";
- }
-
- if ($licensetext =~ /terms of the Common Development and Distribution License(, Version ([^(]+))? \(the License\)/) {
- $license = "CDDL " . ($1 ? "(v$2) " : '') . $license;
- }
-
- if ($licensetext =~ /Microsoft Permissive License \(Ms-PL\)/) {
- $license = "Ms-PL $license";
- }
-
- if ($licensetext =~ /Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license \(the \"Software\"\)/ or
- $licensetext =~ /Boost Software License([ ,-]+Version ([^ ]+)?(\.))/i) {
- $license = "BSL " . ($1 ? "(v$2) " : '') . $license;
- }
-
- if ($licensetext =~ /PYTHON SOFTWARE FOUNDATION LICENSE (VERSION ([^ ]+))/i) {
- $license = "PSF " . ($1 ? "(v$2) " : '') . $license;
- }
-
- if ($licensetext =~ /The origin of this software must not be misrepresented.*Altered source versions must be plainly marked as such.*This notice may not be removed or altered from any source distribution/ or
- $licensetext =~ /see copyright notice in zlib\.h/) {
- $license = "zlib/libpng $license";
- } elsif ($licensetext =~ /This code is released under the libpng license/) {
- $license = "libpng $license";
- }
-
- if ($licensetext =~ /Do What The Fuck You Want To Public License, Version ([^, ]+)/i) {
- $license = "WTFPL (v$1) $license";
- }
-
- if ($licensetext =~ /Do what The Fuck You Want To Public License/i) {
- $license = "WTFPL $license";
- }
-
- if ($licensetext =~ /(License WTFPL|Under (the|a) WTFPL)/i) {
- $license = "WTFPL $license";
- }
-
- $license = "UNKNOWN" if (!length($license));
-
- # Remove trailing spaces.
- $license =~ s/\s+$//;
-
- return $license;
-}
-
-sub fatal($) {
- my ($pack,$file,$line);
- ($pack,$file,$line) = caller();
- (my $msg = "$progname: fatal error at line $line:\n@_\n") =~ tr/\0//d;
- $msg =~ s/\n\n$/\n/;
- die $msg;
-}
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/BUILDING.md b/chromium/third_party/catapult/tracing/third_party/gl-matrix/BUILDING.md
deleted file mode 100644
index 9170ab3d5b1..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/BUILDING.md
+++ /dev/null
@@ -1,7 +0,0 @@
-Building for the browser
-========================
-
-
-To build `gl-matrix.js` and `gl-matrix-min.js` for use in the browser run the following command:
-
- webpack && webpack --config webpack.config.min.js \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/LICENSE.md b/chromium/third_party/catapult/tracing/third_party/gl-matrix/LICENSE.md
deleted file mode 100644
index 79698edab2c..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/LICENSE.md
+++ /dev/null
@@ -1,19 +0,0 @@
-Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/README.chromium b/chromium/third_party/catapult/tracing/third_party/gl-matrix/README.chromium
deleted file mode 100644
index 4e5c3d49ea1..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/README.chromium
+++ /dev/null
@@ -1,15 +0,0 @@
-Name: gl-matrix
-Short Name: gl-matrix
-URL: https://github.com/toji/gl-matrix
-Version: 0
-Revision: 8fc4869031e4ab1daf771e5206c2578e044cf495
-Date: Tue Feb 12 14:21:14 2013 -0800
-License: BSD
-License File: NOT_SHIPPED
-Security Critical: no
-
-Description:
-Matrix math in javascript
-
-Local Modifications:
-None.
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/README.md b/chromium/third_party/catapult/tracing/third_party/gl-matrix/README.md
deleted file mode 100644
index ad66cb07f84..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/README.md
+++ /dev/null
@@ -1,22 +0,0 @@
-glMatrix
-=======================
-
-Javascript has evolved into a language capable of handling realtime 3D graphics,
-via WebGL, and computationally intensive tasks such as physics simulations.
-These types of applications demand high performance vector and matrix math,
-which is something that Javascript doesn't provide by default.
-glMatrix to the rescue!
-
-glMatrix is designed to perform vector and matrix operations stupidly fast! By
-hand-tuning each function for maximum performance and encouraging efficient
-usage patterns through API conventions, glMatrix will help you get the most out
-of your browsers Javascript engine.
-
-Learn More
-----------------------
-For documentation, news, tutorials, and more visit the [glMatrix Homepage](http://glmatrix.net/)
-
-Contributing
-----------------------
-Contributions are welcome! Please make pull requests agains the `dev` branch,
-and please provide unit tests for new functionality. (See TESTING.md for details)
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/TESTING.md b/chromium/third_party/catapult/tracing/third_party/gl-matrix/TESTING.md
deleted file mode 100644
index affd5b27b41..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/TESTING.md
+++ /dev/null
@@ -1,12 +0,0 @@
-Running the test suite
-=======================
-
-
-The unit tests are built upon the following tools:
-
-* Jasmine -- the underlying test suite which executes the test and reports feedback
-* node.js -- used for testing at the command line, via the `jasmine-node` package
-
-To run the unit tests use `jasmine-node`:
-
- jasmine-node spec \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/VERSION b/chromium/third_party/catapult/tracing/third_party/gl-matrix/VERSION
deleted file mode 100644
index cc6612c36e0..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-2.3.0 \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/bower.json b/chromium/third_party/catapult/tracing/third_party/gl-matrix/bower.json
deleted file mode 100644
index 7e52c486673..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/bower.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "name": "gl-matrix",
- "homepage": "http://glmatrix.net",
- "authors": [
- "Brandon Jones <tojiro@gmail.com>",
- "Colin MacKenzie IV <sinisterchipmunk@gmail.com>"
- ],
- "description": "Javascript Matrix and Vector library for High Performance WebGL apps",
- "main": "dist/gl-matrix-min.js",
- "ignore": [
- "**/.*",
- "jsdoc-template",
- "spec",
- "src",
- "tasks",
- "Gemfile",
- "Gemfile.lock",
- "Rakefile",
- "TESTING.md"
- ],
- "keywords": [
- "webGL",
- "matrix",
- "vector"
- ],
- "license": "MIT"
-}
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/dist/gl-matrix-min.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/dist/gl-matrix-min.js
deleted file mode 100644
index 62db82edfd9..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/dist/gl-matrix-min.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * @fileoverview gl-matrix - High performance matrix and vector operations
- * @author Brandon Jones
- * @author Colin MacKenzie IV
- * @version 2.3.1
- */
-
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-!function(t,n){if("object"==typeof exports&&"object"==typeof module)module.exports=n();else if("function"==typeof define&&define.amd)define(n);else{var r=n();for(var a in r)("object"==typeof exports?exports:t)[a]=r[a]}}(this,function(){return function(t){function n(a){if(r[a])return r[a].exports;var e=r[a]={exports:{},id:a,loaded:!1};return t[a].call(e.exports,e,e.exports,n),e.loaded=!0,e.exports}var r={};return n.m=t,n.c=r,n.p="",n(0)}([function(t,n,r){n.glMatrix=r(1),n.mat2=r(2),n.mat2d=r(3),n.mat3=r(4),n.mat4=r(5),n.quat=r(6),n.vec2=r(9),n.vec3=r(7),n.vec4=r(8)},function(t,n,r){var a={};a.EPSILON=1e-6,a.ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array,a.RANDOM=Math.random,a.setMatrixArrayType=function(t){GLMAT_ARRAY_TYPE=t};var e=Math.PI/180;a.toRadian=function(t){return t*e},t.exports=a},function(t,n,r){var a=r(1),e={};e.create=function(){var t=new a.ARRAY_TYPE(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},e.clone=function(t){var n=new a.ARRAY_TYPE(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},e.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},e.transpose=function(t,n){if(t===n){var r=n[1];t[1]=n[2],t[2]=r}else t[0]=n[0],t[1]=n[2],t[2]=n[1],t[3]=n[3];return t},e.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r*u-e*a;return o?(o=1/o,t[0]=u*o,t[1]=-a*o,t[2]=-e*o,t[3]=r*o,t):null},e.adjoint=function(t,n){var r=n[0];return t[0]=n[3],t[1]=-n[1],t[2]=-n[2],t[3]=r,t},e.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},e.multiply=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[0],c=r[1],f=r[2],s=r[3];return t[0]=a*i+u*c,t[1]=e*i+o*c,t[2]=a*f+u*s,t[3]=e*f+o*s,t},e.mul=e.multiply,e.rotate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),c=Math.cos(r);return t[0]=a*c+u*i,t[1]=e*c+o*i,t[2]=a*-i+u*c,t[3]=e*-i+o*c,t},e.scale=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[0],c=r[1];return t[0]=a*i,t[1]=e*i,t[2]=u*c,t[3]=o*c,t},e.fromRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=r,t[2]=-r,t[3]=a,t},e.fromScaling=function(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=n[1],t},e.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},e.LDU=function(t,n,r,a){return t[2]=a[2]/a[0],r[0]=a[0],r[1]=a[1],r[3]=a[3]-t[2]*r[1],[t,n,r]},t.exports=e},function(t,n,r){var a=r(1),e={};e.create=function(){var t=new a.ARRAY_TYPE(6);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},e.clone=function(t){var n=new a.ARRAY_TYPE(6);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n},e.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},e.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],c=r*u-a*e;return c?(c=1/c,t[0]=u*c,t[1]=-a*c,t[2]=-e*c,t[3]=r*c,t[4]=(e*i-u*o)*c,t[5]=(a*o-r*i)*c,t):null},e.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},e.multiply=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=r[0],s=r[1],h=r[2],M=r[3],l=r[4],v=r[5];return t[0]=a*f+u*s,t[1]=e*f+o*s,t[2]=a*h+u*M,t[3]=e*h+o*M,t[4]=a*l+u*v+i,t[5]=e*l+o*v+c,t},e.mul=e.multiply,e.rotate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=Math.sin(r),s=Math.cos(r);return t[0]=a*s+u*f,t[1]=e*s+o*f,t[2]=a*-f+u*s,t[3]=e*-f+o*s,t[4]=i,t[5]=c,t},e.scale=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=r[0],s=r[1];return t[0]=a*f,t[1]=e*f,t[2]=u*s,t[3]=o*s,t[4]=i,t[5]=c,t},e.translate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=r[0],s=r[1];return t[0]=a,t[1]=e,t[2]=u,t[3]=o,t[4]=a*f+u*s+i,t[5]=e*f+o*s+c,t},e.fromRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=r,t[2]=-r,t[3]=a,t[4]=0,t[5]=0,t},e.fromScaling=function(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=n[1],t[4]=0,t[5]=0,t},e.fromTranslation=function(t,n){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=n[0],t[5]=n[1],t},e.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},t.exports=e},function(t,n,r){var a=r(1),e={};e.create=function(){var t=new a.ARRAY_TYPE(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromMat4=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[4],t[4]=n[5],t[5]=n[6],t[6]=n[8],t[7]=n[9],t[8]=n[10],t},e.clone=function(t){var n=new a.ARRAY_TYPE(9);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n},e.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.transpose=function(t,n){if(t===n){var r=n[1],a=n[2],e=n[5];t[1]=n[3],t[2]=n[6],t[3]=r,t[5]=n[7],t[6]=a,t[7]=e}else t[0]=n[0],t[1]=n[3],t[2]=n[6],t[3]=n[1],t[4]=n[4],t[5]=n[7],t[6]=n[2],t[7]=n[5],t[8]=n[8];return t},e.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],c=n[6],f=n[7],s=n[8],h=s*o-i*f,M=-s*u+i*c,l=f*u-o*c,v=r*h+a*M+e*l;return v?(v=1/v,t[0]=h*v,t[1]=(-s*a+e*f)*v,t[2]=(i*a-e*o)*v,t[3]=M*v,t[4]=(s*r-e*c)*v,t[5]=(-i*r+e*u)*v,t[6]=l*v,t[7]=(-f*r+a*c)*v,t[8]=(o*r-a*u)*v,t):null},e.adjoint=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],c=n[6],f=n[7],s=n[8];return t[0]=o*s-i*f,t[1]=e*f-a*s,t[2]=a*i-e*o,t[3]=i*c-u*s,t[4]=r*s-e*c,t[5]=e*u-r*i,t[6]=u*f-o*c,t[7]=a*c-r*f,t[8]=r*o-a*u,t},e.determinant=function(t){var n=t[0],r=t[1],a=t[2],e=t[3],u=t[4],o=t[5],i=t[6],c=t[7],f=t[8];return n*(f*u-o*c)+r*(-f*e+o*i)+a*(c*e-u*i)},e.multiply=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=n[6],s=n[7],h=n[8],M=r[0],l=r[1],v=r[2],m=r[3],p=r[4],d=r[5],A=r[6],R=r[7],w=r[8];return t[0]=M*a+l*o+v*f,t[1]=M*e+l*i+v*s,t[2]=M*u+l*c+v*h,t[3]=m*a+p*o+d*f,t[4]=m*e+p*i+d*s,t[5]=m*u+p*c+d*h,t[6]=A*a+R*o+w*f,t[7]=A*e+R*i+w*s,t[8]=A*u+R*c+w*h,t},e.mul=e.multiply,e.translate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=n[6],s=n[7],h=n[8],M=r[0],l=r[1];return t[0]=a,t[1]=e,t[2]=u,t[3]=o,t[4]=i,t[5]=c,t[6]=M*a+l*o+f,t[7]=M*e+l*i+s,t[8]=M*u+l*c+h,t},e.rotate=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=n[6],s=n[7],h=n[8],M=Math.sin(r),l=Math.cos(r);return t[0]=l*a+M*o,t[1]=l*e+M*i,t[2]=l*u+M*c,t[3]=l*o-M*a,t[4]=l*i-M*e,t[5]=l*c-M*u,t[6]=f,t[7]=s,t[8]=h,t},e.scale=function(t,n,r){var a=r[0],e=r[1];return t[0]=a*n[0],t[1]=a*n[1],t[2]=a*n[2],t[3]=e*n[3],t[4]=e*n[4],t[5]=e*n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t},e.fromTranslation=function(t,n){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=n[0],t[7]=n[1],t[8]=1,t},e.fromRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=r,t[2]=0,t[3]=-r,t[4]=a,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromScaling=function(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=0,t[4]=n[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},e.fromMat2d=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=0,t[3]=n[2],t[4]=n[3],t[5]=0,t[6]=n[4],t[7]=n[5],t[8]=1,t},e.fromQuat=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r+r,i=a+a,c=e+e,f=r*o,s=a*o,h=a*i,M=e*o,l=e*i,v=e*c,m=u*o,p=u*i,d=u*c;return t[0]=1-h-v,t[3]=s-d,t[6]=M+p,t[1]=s+d,t[4]=1-f-v,t[7]=l-m,t[2]=M-p,t[5]=l+m,t[8]=1-f-h,t},e.normalFromMat4=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],c=n[6],f=n[7],s=n[8],h=n[9],M=n[10],l=n[11],v=n[12],m=n[13],p=n[14],d=n[15],A=r*i-a*o,R=r*c-e*o,w=r*f-u*o,q=a*c-e*i,Y=a*f-u*i,g=e*f-u*c,y=s*m-h*v,x=s*p-M*v,P=s*d-l*v,E=h*p-M*m,T=h*d-l*m,b=M*d-l*p,D=A*b-R*T+w*E+q*P-Y*x+g*y;return D?(D=1/D,t[0]=(i*b-c*T+f*E)*D,t[1]=(c*P-o*b-f*x)*D,t[2]=(o*T-i*P+f*y)*D,t[3]=(e*T-a*b-u*E)*D,t[4]=(r*b-e*P+u*x)*D,t[5]=(a*P-r*T-u*y)*D,t[6]=(m*g-p*Y+d*q)*D,t[7]=(p*w-v*g-d*R)*D,t[8]=(v*Y-m*w+d*A)*D,t):null},e.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},t.exports=e},function(t,n,r){var a=r(1),e={};e.create=function(){var t=new a.ARRAY_TYPE(16);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.clone=function(t){var n=new a.ARRAY_TYPE(16);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},e.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},e.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.transpose=function(t,n){if(t===n){var r=n[1],a=n[2],e=n[3],u=n[6],o=n[7],i=n[11];t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=r,t[6]=n[9],t[7]=n[13],t[8]=a,t[9]=u,t[11]=n[14],t[12]=e,t[13]=o,t[14]=i}else t[0]=n[0],t[1]=n[4],t[2]=n[8],t[3]=n[12],t[4]=n[1],t[5]=n[5],t[6]=n[9],t[7]=n[13],t[8]=n[2],t[9]=n[6],t[10]=n[10],t[11]=n[14],t[12]=n[3],t[13]=n[7],t[14]=n[11],t[15]=n[15];return t},e.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],c=n[6],f=n[7],s=n[8],h=n[9],M=n[10],l=n[11],v=n[12],m=n[13],p=n[14],d=n[15],A=r*i-a*o,R=r*c-e*o,w=r*f-u*o,q=a*c-e*i,Y=a*f-u*i,g=e*f-u*c,y=s*m-h*v,x=s*p-M*v,P=s*d-l*v,E=h*p-M*m,T=h*d-l*m,b=M*d-l*p,D=A*b-R*T+w*E+q*P-Y*x+g*y;return D?(D=1/D,t[0]=(i*b-c*T+f*E)*D,t[1]=(e*T-a*b-u*E)*D,t[2]=(m*g-p*Y+d*q)*D,t[3]=(M*Y-h*g-l*q)*D,t[4]=(c*P-o*b-f*x)*D,t[5]=(r*b-e*P+u*x)*D,t[6]=(p*w-v*g-d*R)*D,t[7]=(s*g-M*w+l*R)*D,t[8]=(o*T-i*P+f*y)*D,t[9]=(a*P-r*T-u*y)*D,t[10]=(v*Y-m*w+d*A)*D,t[11]=(h*w-s*Y-l*A)*D,t[12]=(i*x-o*E-c*y)*D,t[13]=(r*E-a*x+e*y)*D,t[14]=(m*R-v*q-p*A)*D,t[15]=(s*q-h*R+M*A)*D,t):null},e.adjoint=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=n[4],i=n[5],c=n[6],f=n[7],s=n[8],h=n[9],M=n[10],l=n[11],v=n[12],m=n[13],p=n[14],d=n[15];return t[0]=i*(M*d-l*p)-h*(c*d-f*p)+m*(c*l-f*M),t[1]=-(a*(M*d-l*p)-h*(e*d-u*p)+m*(e*l-u*M)),t[2]=a*(c*d-f*p)-i*(e*d-u*p)+m*(e*f-u*c),t[3]=-(a*(c*l-f*M)-i*(e*l-u*M)+h*(e*f-u*c)),t[4]=-(o*(M*d-l*p)-s*(c*d-f*p)+v*(c*l-f*M)),t[5]=r*(M*d-l*p)-s*(e*d-u*p)+v*(e*l-u*M),t[6]=-(r*(c*d-f*p)-o*(e*d-u*p)+v*(e*f-u*c)),t[7]=r*(c*l-f*M)-o*(e*l-u*M)+s*(e*f-u*c),t[8]=o*(h*d-l*m)-s*(i*d-f*m)+v*(i*l-f*h),t[9]=-(r*(h*d-l*m)-s*(a*d-u*m)+v*(a*l-u*h)),t[10]=r*(i*d-f*m)-o*(a*d-u*m)+v*(a*f-u*i),t[11]=-(r*(i*l-f*h)-o*(a*l-u*h)+s*(a*f-u*i)),t[12]=-(o*(h*p-M*m)-s*(i*p-c*m)+v*(i*M-c*h)),t[13]=r*(h*p-M*m)-s*(a*p-e*m)+v*(a*M-e*h),t[14]=-(r*(i*p-c*m)-o*(a*p-e*m)+v*(a*c-e*i)),t[15]=r*(i*M-c*h)-o*(a*M-e*h)+s*(a*c-e*i),t},e.determinant=function(t){var n=t[0],r=t[1],a=t[2],e=t[3],u=t[4],o=t[5],i=t[6],c=t[7],f=t[8],s=t[9],h=t[10],M=t[11],l=t[12],v=t[13],m=t[14],p=t[15],d=n*o-r*u,A=n*i-a*u,R=n*c-e*u,w=r*i-a*o,q=r*c-e*o,Y=a*c-e*i,g=f*v-s*l,y=f*m-h*l,x=f*p-M*l,P=s*m-h*v,E=s*p-M*v,T=h*p-M*m;return d*T-A*E+R*P+w*x-q*y+Y*g},e.multiply=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=n[6],s=n[7],h=n[8],M=n[9],l=n[10],v=n[11],m=n[12],p=n[13],d=n[14],A=n[15],R=r[0],w=r[1],q=r[2],Y=r[3];return t[0]=R*a+w*i+q*h+Y*m,t[1]=R*e+w*c+q*M+Y*p,t[2]=R*u+w*f+q*l+Y*d,t[3]=R*o+w*s+q*v+Y*A,R=r[4],w=r[5],q=r[6],Y=r[7],t[4]=R*a+w*i+q*h+Y*m,t[5]=R*e+w*c+q*M+Y*p,t[6]=R*u+w*f+q*l+Y*d,t[7]=R*o+w*s+q*v+Y*A,R=r[8],w=r[9],q=r[10],Y=r[11],t[8]=R*a+w*i+q*h+Y*m,t[9]=R*e+w*c+q*M+Y*p,t[10]=R*u+w*f+q*l+Y*d,t[11]=R*o+w*s+q*v+Y*A,R=r[12],w=r[13],q=r[14],Y=r[15],t[12]=R*a+w*i+q*h+Y*m,t[13]=R*e+w*c+q*M+Y*p,t[14]=R*u+w*f+q*l+Y*d,t[15]=R*o+w*s+q*v+Y*A,t},e.mul=e.multiply,e.translate=function(t,n,r){var a,e,u,o,i,c,f,s,h,M,l,v,m=r[0],p=r[1],d=r[2];return n===t?(t[12]=n[0]*m+n[4]*p+n[8]*d+n[12],t[13]=n[1]*m+n[5]*p+n[9]*d+n[13],t[14]=n[2]*m+n[6]*p+n[10]*d+n[14],t[15]=n[3]*m+n[7]*p+n[11]*d+n[15]):(a=n[0],e=n[1],u=n[2],o=n[3],i=n[4],c=n[5],f=n[6],s=n[7],h=n[8],M=n[9],l=n[10],v=n[11],t[0]=a,t[1]=e,t[2]=u,t[3]=o,t[4]=i,t[5]=c,t[6]=f,t[7]=s,t[8]=h,t[9]=M,t[10]=l,t[11]=v,t[12]=a*m+i*p+h*d+n[12],t[13]=e*m+c*p+M*d+n[13],t[14]=u*m+f*p+l*d+n[14],t[15]=o*m+s*p+v*d+n[15]),t},e.scale=function(t,n,r){var a=r[0],e=r[1],u=r[2];return t[0]=n[0]*a,t[1]=n[1]*a,t[2]=n[2]*a,t[3]=n[3]*a,t[4]=n[4]*e,t[5]=n[5]*e,t[6]=n[6]*e,t[7]=n[7]*e,t[8]=n[8]*u,t[9]=n[9]*u,t[10]=n[10]*u,t[11]=n[11]*u,t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},e.rotate=function(t,n,r,e){var u,o,i,c,f,s,h,M,l,v,m,p,d,A,R,w,q,Y,g,y,x,P,E,T,b=e[0],D=e[1],L=e[2],_=Math.sqrt(b*b+D*D+L*L);return Math.abs(_)<a.EPSILON?null:(_=1/_,b*=_,D*=_,L*=_,u=Math.sin(r),o=Math.cos(r),i=1-o,c=n[0],f=n[1],s=n[2],h=n[3],M=n[4],l=n[5],v=n[6],m=n[7],p=n[8],d=n[9],A=n[10],R=n[11],w=b*b*i+o,q=D*b*i+L*u,Y=L*b*i-D*u,g=b*D*i-L*u,y=D*D*i+o,x=L*D*i+b*u,P=b*L*i+D*u,E=D*L*i-b*u,T=L*L*i+o,t[0]=c*w+M*q+p*Y,t[1]=f*w+l*q+d*Y,t[2]=s*w+v*q+A*Y,t[3]=h*w+m*q+R*Y,t[4]=c*g+M*y+p*x,t[5]=f*g+l*y+d*x,t[6]=s*g+v*y+A*x,t[7]=h*g+m*y+R*x,t[8]=c*P+M*E+p*T,t[9]=f*P+l*E+d*T,t[10]=s*P+v*E+A*T,t[11]=h*P+m*E+R*T,n!==t&&(t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t)},e.rotateX=function(t,n,r){var a=Math.sin(r),e=Math.cos(r),u=n[4],o=n[5],i=n[6],c=n[7],f=n[8],s=n[9],h=n[10],M=n[11];return n!==t&&(t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[4]=u*e+f*a,t[5]=o*e+s*a,t[6]=i*e+h*a,t[7]=c*e+M*a,t[8]=f*e-u*a,t[9]=s*e-o*a,t[10]=h*e-i*a,t[11]=M*e-c*a,t},e.rotateY=function(t,n,r){var a=Math.sin(r),e=Math.cos(r),u=n[0],o=n[1],i=n[2],c=n[3],f=n[8],s=n[9],h=n[10],M=n[11];return n!==t&&(t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=u*e-f*a,t[1]=o*e-s*a,t[2]=i*e-h*a,t[3]=c*e-M*a,t[8]=u*a+f*e,t[9]=o*a+s*e,t[10]=i*a+h*e,t[11]=c*a+M*e,t},e.rotateZ=function(t,n,r){var a=Math.sin(r),e=Math.cos(r),u=n[0],o=n[1],i=n[2],c=n[3],f=n[4],s=n[5],h=n[6],M=n[7];return n!==t&&(t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15]),t[0]=u*e+f*a,t[1]=o*e+s*a,t[2]=i*e+h*a,t[3]=c*e+M*a,t[4]=f*e-u*a,t[5]=s*e-o*a,t[6]=h*e-i*a,t[7]=M*e-c*a,t},e.fromTranslation=function(t,n){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=n[0],t[13]=n[1],t[14]=n[2],t[15]=1,t},e.fromScaling=function(t,n){return t[0]=n[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=n[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.fromRotation=function(t,n,r){var e,u,o,i=r[0],c=r[1],f=r[2],s=Math.sqrt(i*i+c*c+f*f);return Math.abs(s)<a.EPSILON?null:(s=1/s,i*=s,c*=s,f*=s,e=Math.sin(n),u=Math.cos(n),o=1-u,t[0]=i*i*o+u,t[1]=c*i*o+f*e,t[2]=f*i*o-c*e,t[3]=0,t[4]=i*c*o-f*e,t[5]=c*c*o+u,t[6]=f*c*o+i*e,t[7]=0,t[8]=i*f*o+c*e,t[9]=c*f*o-i*e,t[10]=f*f*o+u,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)},e.fromXRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.fromYRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.fromZRotation=function(t,n){var r=Math.sin(n),a=Math.cos(n);return t[0]=a,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.fromRotationTranslation=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=a+a,c=e+e,f=u+u,s=a*i,h=a*c,M=a*f,l=e*c,v=e*f,m=u*f,p=o*i,d=o*c,A=o*f;return t[0]=1-(l+m),t[1]=h+A,t[2]=M-d,t[3]=0,t[4]=h-A,t[5]=1-(s+m),t[6]=v+p,t[7]=0,t[8]=M+d,t[9]=v-p,t[10]=1-(s+l),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},e.fromRotationTranslationScale=function(t,n,r,a){var e=n[0],u=n[1],o=n[2],i=n[3],c=e+e,f=u+u,s=o+o,h=e*c,M=e*f,l=e*s,v=u*f,m=u*s,p=o*s,d=i*c,A=i*f,R=i*s,w=a[0],q=a[1],Y=a[2];return t[0]=(1-(v+p))*w,t[1]=(M+R)*w,t[2]=(l-A)*w,t[3]=0,t[4]=(M-R)*q,t[5]=(1-(h+p))*q,t[6]=(m+d)*q,t[7]=0,t[8]=(l+A)*Y,t[9]=(m-d)*Y,t[10]=(1-(h+v))*Y,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},e.fromRotationTranslationScaleOrigin=function(t,n,r,a,e){var u=n[0],o=n[1],i=n[2],c=n[3],f=u+u,s=o+o,h=i+i,M=u*f,l=u*s,v=u*h,m=o*s,p=o*h,d=i*h,A=c*f,R=c*s,w=c*h,q=a[0],Y=a[1],g=a[2],y=e[0],x=e[1],P=e[2];return t[0]=(1-(m+d))*q,t[1]=(l+w)*q,t[2]=(v-R)*q,t[3]=0,t[4]=(l-w)*Y,t[5]=(1-(M+d))*Y,t[6]=(p+A)*Y,t[7]=0,t[8]=(v+R)*g,t[9]=(p-A)*g,t[10]=(1-(M+m))*g,t[11]=0,t[12]=r[0]+y-(t[0]*y+t[4]*x+t[8]*P),t[13]=r[1]+x-(t[1]*y+t[5]*x+t[9]*P),t[14]=r[2]+P-(t[2]*y+t[6]*x+t[10]*P),t[15]=1,t},e.fromQuat=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r+r,i=a+a,c=e+e,f=r*o,s=a*o,h=a*i,M=e*o,l=e*i,v=e*c,m=u*o,p=u*i,d=u*c;return t[0]=1-h-v,t[1]=s+d,t[2]=M-p,t[3]=0,t[4]=s-d,t[5]=1-f-v,t[6]=l+m,t[7]=0,t[8]=M+p,t[9]=l-m,t[10]=1-f-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},e.frustum=function(t,n,r,a,e,u,o){var i=1/(r-n),c=1/(e-a),f=1/(u-o);return t[0]=2*u*i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*u*c,t[6]=0,t[7]=0,t[8]=(r+n)*i,t[9]=(e+a)*c,t[10]=(o+u)*f,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*u*2*f,t[15]=0,t},e.perspective=function(t,n,r,a,e){var u=1/Math.tan(n/2),o=1/(a-e);return t[0]=u/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=u,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(e+a)*o,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*e*a*o,t[15]=0,t},e.perspectiveFromFieldOfView=function(t,n,r,a){var e=Math.tan(n.upDegrees*Math.PI/180),u=Math.tan(n.downDegrees*Math.PI/180),o=Math.tan(n.leftDegrees*Math.PI/180),i=Math.tan(n.rightDegrees*Math.PI/180),c=2/(o+i),f=2/(e+u);return t[0]=c,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=f,t[6]=0,t[7]=0,t[8]=-((o-i)*c*.5),t[9]=(e-u)*f*.5,t[10]=a/(r-a),t[11]=-1,t[12]=0,t[13]=0,t[14]=a*r/(r-a),t[15]=0,t},e.ortho=function(t,n,r,a,e,u,o){var i=1/(n-r),c=1/(a-e),f=1/(u-o);return t[0]=-2*i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*f,t[11]=0,t[12]=(n+r)*i,t[13]=(e+a)*c,t[14]=(o+u)*f,t[15]=1,t},e.lookAt=function(t,n,r,u){var o,i,c,f,s,h,M,l,v,m,p=n[0],d=n[1],A=n[2],R=u[0],w=u[1],q=u[2],Y=r[0],g=r[1],y=r[2];return Math.abs(p-Y)<a.EPSILON&&Math.abs(d-g)<a.EPSILON&&Math.abs(A-y)<a.EPSILON?e.identity(t):(M=p-Y,l=d-g,v=A-y,m=1/Math.sqrt(M*M+l*l+v*v),M*=m,l*=m,v*=m,o=w*v-q*l,i=q*M-R*v,c=R*l-w*M,m=Math.sqrt(o*o+i*i+c*c),m?(m=1/m,o*=m,i*=m,c*=m):(o=0,i=0,c=0),f=l*c-v*i,s=v*o-M*c,h=M*i-l*o,m=Math.sqrt(f*f+s*s+h*h),m?(m=1/m,f*=m,s*=m,h*=m):(f=0,s=0,h=0),t[0]=o,t[1]=f,t[2]=M,t[3]=0,t[4]=i,t[5]=s,t[6]=l,t[7]=0,t[8]=c,t[9]=h,t[10]=v,t[11]=0,t[12]=-(o*p+i*d+c*A),t[13]=-(f*p+s*d+h*A),t[14]=-(M*p+l*d+v*A),t[15]=1,t)},e.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},e.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},t.exports=e},function(t,n,r){var a=r(1),e=r(4),u=r(7),o=r(8),i={};i.create=function(){var t=new a.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},i.rotationTo=function(){var t=u.create(),n=u.fromValues(1,0,0),r=u.fromValues(0,1,0);return function(a,e,o){var c=u.dot(e,o);return-.999999>c?(u.cross(t,n,e),u.length(t)<1e-6&&u.cross(t,r,e),u.normalize(t,t),i.setAxisAngle(a,t,Math.PI),a):c>.999999?(a[0]=0,a[1]=0,a[2]=0,a[3]=1,a):(u.cross(t,e,o),a[0]=t[0],a[1]=t[1],a[2]=t[2],a[3]=1+c,i.normalize(a,a))}}(),i.setAxes=function(){var t=e.create();return function(n,r,a,e){return t[0]=a[0],t[3]=a[1],t[6]=a[2],t[1]=e[0],t[4]=e[1],t[7]=e[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],i.normalize(n,i.fromMat3(n,t))}}(),i.clone=o.clone,i.fromValues=o.fromValues,i.copy=o.copy,i.set=o.set,i.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},i.setAxisAngle=function(t,n,r){r=.5*r;var a=Math.sin(r);return t[0]=a*n[0],t[1]=a*n[1],t[2]=a*n[2],t[3]=Math.cos(r),t},i.add=o.add,i.multiply=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3],i=r[0],c=r[1],f=r[2],s=r[3];return t[0]=a*s+o*i+e*f-u*c,t[1]=e*s+o*c+u*i-a*f,t[2]=u*s+o*f+a*c-e*i,t[3]=o*s-a*i-e*c-u*f,t},i.mul=i.multiply,i.scale=o.scale,i.rotateX=function(t,n,r){r*=.5;var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),c=Math.cos(r);return t[0]=a*c+o*i,t[1]=e*c+u*i,t[2]=u*c-e*i,t[3]=o*c-a*i,t},i.rotateY=function(t,n,r){r*=.5;var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),c=Math.cos(r);return t[0]=a*c-u*i,t[1]=e*c+o*i,t[2]=u*c+a*i,t[3]=o*c-e*i,t},i.rotateZ=function(t,n,r){r*=.5;var a=n[0],e=n[1],u=n[2],o=n[3],i=Math.sin(r),c=Math.cos(r);return t[0]=a*c+e*i,t[1]=e*c-a*i,t[2]=u*c+o*i,t[3]=o*c-u*i,t},i.calculateW=function(t,n){var r=n[0],a=n[1],e=n[2];return t[0]=r,t[1]=a,t[2]=e,t[3]=Math.sqrt(Math.abs(1-r*r-a*a-e*e)),t},i.dot=o.dot,i.lerp=o.lerp,i.slerp=function(t,n,r,a){var e,u,o,i,c,f=n[0],s=n[1],h=n[2],M=n[3],l=r[0],v=r[1],m=r[2],p=r[3];return u=f*l+s*v+h*m+M*p,0>u&&(u=-u,l=-l,v=-v,m=-m,p=-p),1-u>1e-6?(e=Math.acos(u),o=Math.sin(e),i=Math.sin((1-a)*e)/o,c=Math.sin(a*e)/o):(i=1-a,c=a),t[0]=i*f+c*l,t[1]=i*s+c*v,t[2]=i*h+c*m,t[3]=i*M+c*p,t},i.sqlerp=function(){var t=i.create(),n=i.create();return function(r,a,e,u,o,c){return i.slerp(t,a,o,c),i.slerp(n,e,u,c),i.slerp(r,t,n,2*c*(1-c)),r}}(),i.invert=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r*r+a*a+e*e+u*u,i=o?1/o:0;return t[0]=-r*i,t[1]=-a*i,t[2]=-e*i,t[3]=u*i,t},i.conjugate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=n[3],t},i.length=o.length,i.len=i.length,i.squaredLength=o.squaredLength,i.sqrLen=i.squaredLength,i.normalize=o.normalize,i.fromMat3=function(t,n){var r,a=n[0]+n[4]+n[8];if(a>0)r=Math.sqrt(a+1),t[3]=.5*r,r=.5/r,t[0]=(n[5]-n[7])*r,t[1]=(n[6]-n[2])*r,t[2]=(n[1]-n[3])*r;else{var e=0;n[4]>n[0]&&(e=1),n[8]>n[3*e+e]&&(e=2);var u=(e+1)%3,o=(e+2)%3;r=Math.sqrt(n[3*e+e]-n[3*u+u]-n[3*o+o]+1),t[e]=.5*r,r=.5/r,t[3]=(n[3*u+o]-n[3*o+u])*r,t[u]=(n[3*u+e]+n[3*e+u])*r,t[o]=(n[3*o+e]+n[3*e+o])*r}return t},i.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},t.exports=i},function(t,n,r){var a=r(1),e={};e.create=function(){var t=new a.ARRAY_TYPE(3);return t[0]=0,t[1]=0,t[2]=0,t},e.clone=function(t){var n=new a.ARRAY_TYPE(3);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n},e.fromValues=function(t,n,r){var e=new a.ARRAY_TYPE(3);return e[0]=t,e[1]=n,e[2]=r,e},e.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t},e.set=function(t,n,r,a){return t[0]=n,t[1]=r,t[2]=a,t},e.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t},e.subtract=function(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t},e.sub=e.subtract,e.multiply=function(t,n,r){return t[0]=n[0]*r[0],t[1]=n[1]*r[1],t[2]=n[2]*r[2],t},e.mul=e.multiply,e.divide=function(t,n,r){return t[0]=n[0]/r[0],t[1]=n[1]/r[1],t[2]=n[2]/r[2],t},e.div=e.divide,e.min=function(t,n,r){return t[0]=Math.min(n[0],r[0]),t[1]=Math.min(n[1],r[1]),t[2]=Math.min(n[2],r[2]),t},e.max=function(t,n,r){return t[0]=Math.max(n[0],r[0]),t[1]=Math.max(n[1],r[1]),t[2]=Math.max(n[2],r[2]),t},e.scale=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t},e.scaleAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t[2]=n[2]+r[2]*a,t},e.distance=function(t,n){var r=n[0]-t[0],a=n[1]-t[1],e=n[2]-t[2];return Math.sqrt(r*r+a*a+e*e)},e.dist=e.distance,e.squaredDistance=function(t,n){var r=n[0]-t[0],a=n[1]-t[1],e=n[2]-t[2];return r*r+a*a+e*e},e.sqrDist=e.squaredDistance,e.length=function(t){var n=t[0],r=t[1],a=t[2];return Math.sqrt(n*n+r*r+a*a)},e.len=e.length,e.squaredLength=function(t){var n=t[0],r=t[1],a=t[2];return n*n+r*r+a*a},e.sqrLen=e.squaredLength,e.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t},e.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t},e.normalize=function(t,n){var r=n[0],a=n[1],e=n[2],u=r*r+a*a+e*e;return u>0&&(u=1/Math.sqrt(u),t[0]=n[0]*u,t[1]=n[1]*u,t[2]=n[2]*u),t},e.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]},e.cross=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=r[0],i=r[1],c=r[2];return t[0]=e*c-u*i,t[1]=u*o-a*c,t[2]=a*i-e*o,t},e.lerp=function(t,n,r,a){var e=n[0],u=n[1],o=n[2];return t[0]=e+a*(r[0]-e),t[1]=u+a*(r[1]-u),t[2]=o+a*(r[2]-o),t},e.hermite=function(t,n,r,a,e,u){var o=u*u,i=o*(2*u-3)+1,c=o*(u-2)+u,f=o*(u-1),s=o*(3-2*u);return t[0]=n[0]*i+r[0]*c+a[0]*f+e[0]*s,t[1]=n[1]*i+r[1]*c+a[1]*f+e[1]*s,t[2]=n[2]*i+r[2]*c+a[2]*f+e[2]*s,t},e.bezier=function(t,n,r,a,e,u){var o=1-u,i=o*o,c=u*u,f=i*o,s=3*u*i,h=3*c*o,M=c*u;return t[0]=n[0]*f+r[0]*s+a[0]*h+e[0]*M,t[1]=n[1]*f+r[1]*s+a[1]*h+e[1]*M,t[2]=n[2]*f+r[2]*s+a[2]*h+e[2]*M,t},e.random=function(t,n){n=n||1;var r=2*a.RANDOM()*Math.PI,e=2*a.RANDOM()-1,u=Math.sqrt(1-e*e)*n;return t[0]=Math.cos(r)*u,t[1]=Math.sin(r)*u,t[2]=e*n,t},e.transformMat4=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=r[3]*a+r[7]*e+r[11]*u+r[15];return o=o||1,t[0]=(r[0]*a+r[4]*e+r[8]*u+r[12])/o,t[1]=(r[1]*a+r[5]*e+r[9]*u+r[13])/o,t[2]=(r[2]*a+r[6]*e+r[10]*u+r[14])/o,t},e.transformMat3=function(t,n,r){var a=n[0],e=n[1],u=n[2];return t[0]=a*r[0]+e*r[3]+u*r[6],t[1]=a*r[1]+e*r[4]+u*r[7],t[2]=a*r[2]+e*r[5]+u*r[8],t},e.transformQuat=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=r[0],i=r[1],c=r[2],f=r[3],s=f*a+i*u-c*e,h=f*e+c*a-o*u,M=f*u+o*e-i*a,l=-o*a-i*e-c*u;return t[0]=s*f+l*-o+h*-c-M*-i,t[1]=h*f+l*-i+M*-o-s*-c,t[2]=M*f+l*-c+s*-i-h*-o,t},e.rotateX=function(t,n,r,a){var e=[],u=[];return e[0]=n[0]-r[0],e[1]=n[1]-r[1],e[2]=n[2]-r[2],u[0]=e[0],u[1]=e[1]*Math.cos(a)-e[2]*Math.sin(a),u[2]=e[1]*Math.sin(a)+e[2]*Math.cos(a),t[0]=u[0]+r[0],t[1]=u[1]+r[1],t[2]=u[2]+r[2],t},e.rotateY=function(t,n,r,a){var e=[],u=[];return e[0]=n[0]-r[0],e[1]=n[1]-r[1],e[2]=n[2]-r[2],u[0]=e[2]*Math.sin(a)+e[0]*Math.cos(a),u[1]=e[1],u[2]=e[2]*Math.cos(a)-e[0]*Math.sin(a),t[0]=u[0]+r[0],t[1]=u[1]+r[1],t[2]=u[2]+r[2],t},e.rotateZ=function(t,n,r,a){var e=[],u=[];return e[0]=n[0]-r[0],e[1]=n[1]-r[1],e[2]=n[2]-r[2],u[0]=e[0]*Math.cos(a)-e[1]*Math.sin(a),u[1]=e[0]*Math.sin(a)+e[1]*Math.cos(a),u[2]=e[2],t[0]=u[0]+r[0],t[1]=u[1]+r[1],t[2]=u[2]+r[2],t},e.forEach=function(){var t=e.create();return function(n,r,a,e,u,o){var i,c;for(r||(r=3),a||(a=0),c=e?Math.min(e*r+a,n.length):n.length,i=a;c>i;i+=r)t[0]=n[i],t[1]=n[i+1],t[2]=n[i+2],u(t,t,o),n[i]=t[0],n[i+1]=t[1],n[i+2]=t[2];return n}}(),e.angle=function(t,n){var r=e.fromValues(t[0],t[1],t[2]),a=e.fromValues(n[0],n[1],n[2]);e.normalize(r,r),e.normalize(a,a);var u=e.dot(r,a);return u>1?0:Math.acos(u)},e.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},t.exports=e},function(t,n,r){var a=r(1),e={};e.create=function(){var t=new a.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},e.clone=function(t){var n=new a.ARRAY_TYPE(4);return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n},e.fromValues=function(t,n,r,e){var u=new a.ARRAY_TYPE(4);return u[0]=t,u[1]=n,u[2]=r,u[3]=e,u},e.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t},e.set=function(t,n,r,a,e){return t[0]=n,t[1]=r,t[2]=a,t[3]=e,t},e.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t[2]=n[2]+r[2],t[3]=n[3]+r[3],t},e.subtract=function(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t[2]=n[2]-r[2],t[3]=n[3]-r[3],t},e.sub=e.subtract,e.multiply=function(t,n,r){return t[0]=n[0]*r[0],t[1]=n[1]*r[1],t[2]=n[2]*r[2],t[3]=n[3]*r[3],t},e.mul=e.multiply,e.divide=function(t,n,r){return t[0]=n[0]/r[0],t[1]=n[1]/r[1],t[2]=n[2]/r[2],t[3]=n[3]/r[3],t},e.div=e.divide,e.min=function(t,n,r){return t[0]=Math.min(n[0],r[0]),t[1]=Math.min(n[1],r[1]),t[2]=Math.min(n[2],r[2]),t[3]=Math.min(n[3],r[3]),t},e.max=function(t,n,r){return t[0]=Math.max(n[0],r[0]),t[1]=Math.max(n[1],r[1]),t[2]=Math.max(n[2],r[2]),t[3]=Math.max(n[3],r[3]),t},e.scale=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=n[3]*r,t},e.scaleAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t[2]=n[2]+r[2]*a,t[3]=n[3]+r[3]*a,t},e.distance=function(t,n){var r=n[0]-t[0],a=n[1]-t[1],e=n[2]-t[2],u=n[3]-t[3];return Math.sqrt(r*r+a*a+e*e+u*u)},e.dist=e.distance,e.squaredDistance=function(t,n){var r=n[0]-t[0],a=n[1]-t[1],e=n[2]-t[2],u=n[3]-t[3];return r*r+a*a+e*e+u*u},e.sqrDist=e.squaredDistance,e.length=function(t){var n=t[0],r=t[1],a=t[2],e=t[3];return Math.sqrt(n*n+r*r+a*a+e*e)},e.len=e.length,e.squaredLength=function(t){var n=t[0],r=t[1],a=t[2],e=t[3];return n*n+r*r+a*a+e*e},e.sqrLen=e.squaredLength,e.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t[3]=-n[3],t},e.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t[3]=1/n[3],t},e.normalize=function(t,n){var r=n[0],a=n[1],e=n[2],u=n[3],o=r*r+a*a+e*e+u*u;return o>0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=a*o,t[2]=e*o,t[3]=u*o),t},e.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]+t[3]*n[3]},e.lerp=function(t,n,r,a){var e=n[0],u=n[1],o=n[2],i=n[3];return t[0]=e+a*(r[0]-e),t[1]=u+a*(r[1]-u),t[2]=o+a*(r[2]-o),t[3]=i+a*(r[3]-i),t},e.random=function(t,n){return n=n||1,t[0]=a.RANDOM(),t[1]=a.RANDOM(),t[2]=a.RANDOM(),t[3]=a.RANDOM(),e.normalize(t,t),e.scale(t,t,n),t},e.transformMat4=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=n[3];return t[0]=r[0]*a+r[4]*e+r[8]*u+r[12]*o,t[1]=r[1]*a+r[5]*e+r[9]*u+r[13]*o,t[2]=r[2]*a+r[6]*e+r[10]*u+r[14]*o,t[3]=r[3]*a+r[7]*e+r[11]*u+r[15]*o,t},e.transformQuat=function(t,n,r){var a=n[0],e=n[1],u=n[2],o=r[0],i=r[1],c=r[2],f=r[3],s=f*a+i*u-c*e,h=f*e+c*a-o*u,M=f*u+o*e-i*a,l=-o*a-i*e-c*u;return t[0]=s*f+l*-o+h*-c-M*-i,t[1]=h*f+l*-i+M*-o-s*-c,t[2]=M*f+l*-c+s*-i-h*-o,t[3]=n[3],t},e.forEach=function(){var t=e.create();return function(n,r,a,e,u,o){var i,c;for(r||(r=4),a||(a=0),c=e?Math.min(e*r+a,n.length):n.length,i=a;c>i;i+=r)t[0]=n[i],t[1]=n[i+1],t[2]=n[i+2],t[3]=n[i+3],u(t,t,o),n[i]=t[0],n[i+1]=t[1],n[i+2]=t[2],n[i+3]=t[3];return n}}(),e.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},t.exports=e},function(t,n,r){var a=r(1),e={};e.create=function(){var t=new a.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},e.clone=function(t){var n=new a.ARRAY_TYPE(2);return n[0]=t[0],n[1]=t[1],n},e.fromValues=function(t,n){var r=new a.ARRAY_TYPE(2);return r[0]=t,r[1]=n,r},e.copy=function(t,n){return t[0]=n[0],t[1]=n[1],t},e.set=function(t,n,r){return t[0]=n,t[1]=r,t},e.add=function(t,n,r){return t[0]=n[0]+r[0],t[1]=n[1]+r[1],t},e.subtract=function(t,n,r){return t[0]=n[0]-r[0],t[1]=n[1]-r[1],t},e.sub=e.subtract,e.multiply=function(t,n,r){return t[0]=n[0]*r[0],t[1]=n[1]*r[1],t},e.mul=e.multiply,e.divide=function(t,n,r){return t[0]=n[0]/r[0],t[1]=n[1]/r[1],t},e.div=e.divide,e.min=function(t,n,r){return t[0]=Math.min(n[0],r[0]),t[1]=Math.min(n[1],r[1]),t},e.max=function(t,n,r){return t[0]=Math.max(n[0],r[0]),t[1]=Math.max(n[1],r[1]),t},e.scale=function(t,n,r){return t[0]=n[0]*r,t[1]=n[1]*r,t},e.scaleAndAdd=function(t,n,r,a){return t[0]=n[0]+r[0]*a,t[1]=n[1]+r[1]*a,t},e.distance=function(t,n){var r=n[0]-t[0],a=n[1]-t[1];return Math.sqrt(r*r+a*a)},e.dist=e.distance,e.squaredDistance=function(t,n){var r=n[0]-t[0],a=n[1]-t[1];return r*r+a*a},e.sqrDist=e.squaredDistance,e.length=function(t){var n=t[0],r=t[1];return Math.sqrt(n*n+r*r)},e.len=e.length,e.squaredLength=function(t){var n=t[0],r=t[1];return n*n+r*r},e.sqrLen=e.squaredLength,e.negate=function(t,n){return t[0]=-n[0],t[1]=-n[1],t},e.inverse=function(t,n){return t[0]=1/n[0],t[1]=1/n[1],t},e.normalize=function(t,n){var r=n[0],a=n[1],e=r*r+a*a;return e>0&&(e=1/Math.sqrt(e),t[0]=n[0]*e,t[1]=n[1]*e),t},e.dot=function(t,n){return t[0]*n[0]+t[1]*n[1]},e.cross=function(t,n,r){var a=n[0]*r[1]-n[1]*r[0];return t[0]=t[1]=0,t[2]=a,t},e.lerp=function(t,n,r,a){var e=n[0],u=n[1];return t[0]=e+a*(r[0]-e),t[1]=u+a*(r[1]-u),t},e.random=function(t,n){n=n||1;var r=2*a.RANDOM()*Math.PI;return t[0]=Math.cos(r)*n,t[1]=Math.sin(r)*n,t},e.transformMat2=function(t,n,r){var a=n[0],e=n[1];return t[0]=r[0]*a+r[2]*e,t[1]=r[1]*a+r[3]*e,t},e.transformMat2d=function(t,n,r){var a=n[0],e=n[1];return t[0]=r[0]*a+r[2]*e+r[4],t[1]=r[1]*a+r[3]*e+r[5],t},e.transformMat3=function(t,n,r){
-var a=n[0],e=n[1];return t[0]=r[0]*a+r[3]*e+r[6],t[1]=r[1]*a+r[4]*e+r[7],t},e.transformMat4=function(t,n,r){var a=n[0],e=n[1];return t[0]=r[0]*a+r[4]*e+r[12],t[1]=r[1]*a+r[5]*e+r[13],t},e.forEach=function(){var t=e.create();return function(n,r,a,e,u,o){var i,c;for(r||(r=2),a||(a=0),c=e?Math.min(e*r+a,n.length):n.length,i=a;c>i;i+=r)t[0]=n[i],t[1]=n[i+1],u(t,t,o),n[i]=t[0],n[i+1]=t[1];return n}}(),e.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},t.exports=e}])}); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/dist/gl-matrix.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/dist/gl-matrix.js
deleted file mode 100644
index ab1e9b0aa58..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/dist/gl-matrix.js
+++ /dev/null
@@ -1,5020 +0,0 @@
-/**
- * @fileoverview gl-matrix - High performance matrix and vector operations
- * @author Brandon Jones
- * @author Colin MacKenzie IV
- * @version 2.3.1
- */
-
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-(function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory();
- else if(typeof define === 'function' && define.amd)
- define(factory);
- else {
- var a = factory();
- for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
- }
-})(this, function() {
-return /******/ (function(modules) { // webpackBootstrap
-/******/ // The module cache
-/******/ var installedModules = {};
-
-/******/ // The require function
-/******/ function __webpack_require__(moduleId) {
-
-/******/ // Check if module is in cache
-/******/ if(installedModules[moduleId])
-/******/ return installedModules[moduleId].exports;
-
-/******/ // Create a new module (and put it into the cache)
-/******/ var module = installedModules[moduleId] = {
-/******/ exports: {},
-/******/ id: moduleId,
-/******/ loaded: false
-/******/ };
-
-/******/ // Execute the module function
-/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-
-/******/ // Flag the module as loaded
-/******/ module.loaded = true;
-
-/******/ // Return the exports of the module
-/******/ return module.exports;
-/******/ }
-
-
-/******/ // expose the modules object (__webpack_modules__)
-/******/ __webpack_require__.m = modules;
-
-/******/ // expose the module cache
-/******/ __webpack_require__.c = installedModules;
-
-/******/ // __webpack_public_path__
-/******/ __webpack_require__.p = "";
-
-/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
-/******/ })
-/************************************************************************/
-/******/ ([
-/* 0 */
-/***/ function(module, exports, __webpack_require__) {
-
- /**
- * @fileoverview gl-matrix - High performance matrix and vector operations
- * @author Brandon Jones
- * @author Colin MacKenzie IV
- * @version 2.3.1
- */
-
- /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE. */
- // END HEADER
-
- exports.glMatrix = __webpack_require__(1);
- exports.mat2 = __webpack_require__(2);
- exports.mat2d = __webpack_require__(3);
- exports.mat3 = __webpack_require__(4);
- exports.mat4 = __webpack_require__(5);
- exports.quat = __webpack_require__(6);
- exports.vec2 = __webpack_require__(9);
- exports.vec3 = __webpack_require__(7);
- exports.vec4 = __webpack_require__(8);
-
-/***/ },
-/* 1 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE. */
-
- /**
- * @class Common utilities
- * @name glMatrix
- */
- var glMatrix = {};
-
- // Constants
- glMatrix.EPSILON = 0.000001;
- glMatrix.ARRAY_TYPE = (typeof Float32Array !== 'undefined') ? Float32Array : Array;
- glMatrix.RANDOM = Math.random;
-
- /**
- * Sets the type of array used when creating new vectors and matrices
- *
- * @param {Type} type Array type, such as Float32Array or Array
- */
- glMatrix.setMatrixArrayType = function(type) {
- GLMAT_ARRAY_TYPE = type;
- }
-
- var degree = Math.PI / 180;
-
- /**
- * Convert Degree To Radian
- *
- * @param {Number} Angle in Degrees
- */
- glMatrix.toRadian = function(a){
- return a * degree;
- }
-
- module.exports = glMatrix;
-
-
-/***/ },
-/* 2 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE. */
-
- var glMatrix = __webpack_require__(1);
-
- /**
- * @class 2x2 Matrix
- * @name mat2
- */
- var mat2 = {};
-
- /**
- * Creates a new identity mat2
- *
- * @returns {mat2} a new 2x2 matrix
- */
- mat2.create = function() {
- var out = new glMatrix.ARRAY_TYPE(4);
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- return out;
- };
-
- /**
- * Creates a new mat2 initialized with values from an existing matrix
- *
- * @param {mat2} a matrix to clone
- * @returns {mat2} a new 2x2 matrix
- */
- mat2.clone = function(a) {
- var out = new glMatrix.ARRAY_TYPE(4);
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- return out;
- };
-
- /**
- * Copy the values from one mat2 to another
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the source matrix
- * @returns {mat2} out
- */
- mat2.copy = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- return out;
- };
-
- /**
- * Set a mat2 to the identity matrix
- *
- * @param {mat2} out the receiving matrix
- * @returns {mat2} out
- */
- mat2.identity = function(out) {
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- return out;
- };
-
- /**
- * Transpose the values of a mat2
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the source matrix
- * @returns {mat2} out
- */
- mat2.transpose = function(out, a) {
- // If we are transposing ourselves we can skip a few steps but have to cache some values
- if (out === a) {
- var a1 = a[1];
- out[1] = a[2];
- out[2] = a1;
- } else {
- out[0] = a[0];
- out[1] = a[2];
- out[2] = a[1];
- out[3] = a[3];
- }
-
- return out;
- };
-
- /**
- * Inverts a mat2
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the source matrix
- * @returns {mat2} out
- */
- mat2.invert = function(out, a) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],
-
- // Calculate the determinant
- det = a0 * a3 - a2 * a1;
-
- if (!det) {
- return null;
- }
- det = 1.0 / det;
-
- out[0] = a3 * det;
- out[1] = -a1 * det;
- out[2] = -a2 * det;
- out[3] = a0 * det;
-
- return out;
- };
-
- /**
- * Calculates the adjugate of a mat2
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the source matrix
- * @returns {mat2} out
- */
- mat2.adjoint = function(out, a) {
- // Caching this value is nessecary if out == a
- var a0 = a[0];
- out[0] = a[3];
- out[1] = -a[1];
- out[2] = -a[2];
- out[3] = a0;
-
- return out;
- };
-
- /**
- * Calculates the determinant of a mat2
- *
- * @param {mat2} a the source matrix
- * @returns {Number} determinant of a
- */
- mat2.determinant = function (a) {
- return a[0] * a[3] - a[2] * a[1];
- };
-
- /**
- * Multiplies two mat2's
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the first operand
- * @param {mat2} b the second operand
- * @returns {mat2} out
- */
- mat2.multiply = function (out, a, b) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3];
- var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];
- out[0] = a0 * b0 + a2 * b1;
- out[1] = a1 * b0 + a3 * b1;
- out[2] = a0 * b2 + a2 * b3;
- out[3] = a1 * b2 + a3 * b3;
- return out;
- };
-
- /**
- * Alias for {@link mat2.multiply}
- * @function
- */
- mat2.mul = mat2.multiply;
-
- /**
- * Rotates a mat2 by the given angle
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the matrix to rotate
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat2} out
- */
- mat2.rotate = function (out, a, rad) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],
- s = Math.sin(rad),
- c = Math.cos(rad);
- out[0] = a0 * c + a2 * s;
- out[1] = a1 * c + a3 * s;
- out[2] = a0 * -s + a2 * c;
- out[3] = a1 * -s + a3 * c;
- return out;
- };
-
- /**
- * Scales the mat2 by the dimensions in the given vec2
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the matrix to rotate
- * @param {vec2} v the vec2 to scale the matrix by
- * @returns {mat2} out
- **/
- mat2.scale = function(out, a, v) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],
- v0 = v[0], v1 = v[1];
- out[0] = a0 * v0;
- out[1] = a1 * v0;
- out[2] = a2 * v1;
- out[3] = a3 * v1;
- return out;
- };
-
- /**
- * Creates a matrix from a given angle
- * This is equivalent to (but much faster than):
- *
- * mat2.identity(dest);
- * mat2.rotate(dest, dest, rad);
- *
- * @param {mat2} out mat2 receiving operation result
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat2} out
- */
- mat2.fromRotation = function(out, rad) {
- var s = Math.sin(rad),
- c = Math.cos(rad);
- out[0] = c;
- out[1] = s;
- out[2] = -s;
- out[3] = c;
- return out;
- }
-
- /**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat2.identity(dest);
- * mat2.scale(dest, dest, vec);
- *
- * @param {mat2} out mat2 receiving operation result
- * @param {vec2} v Scaling vector
- * @returns {mat2} out
- */
- mat2.fromScaling = function(out, v) {
- out[0] = v[0];
- out[1] = 0;
- out[2] = 0;
- out[3] = v[1];
- return out;
- }
-
- /**
- * Returns a string representation of a mat2
- *
- * @param {mat2} mat matrix to represent as a string
- * @returns {String} string representation of the matrix
- */
- mat2.str = function (a) {
- return 'mat2(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';
- };
-
- /**
- * Returns Frobenius norm of a mat2
- *
- * @param {mat2} a the matrix to calculate Frobenius norm of
- * @returns {Number} Frobenius norm
- */
- mat2.frob = function (a) {
- return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2)))
- };
-
- /**
- * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
- * @param {mat2} L the lower triangular matrix
- * @param {mat2} D the diagonal matrix
- * @param {mat2} U the upper triangular matrix
- * @param {mat2} a the input matrix to factorize
- */
-
- mat2.LDU = function (L, D, U, a) {
- L[2] = a[2]/a[0];
- U[0] = a[0];
- U[1] = a[1];
- U[3] = a[3] - L[2] * U[1];
- return [L, D, U];
- };
-
-
- module.exports = mat2;
-
-
-/***/ },
-/* 3 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE. */
-
- var glMatrix = __webpack_require__(1);
-
- /**
- * @class 2x3 Matrix
- * @name mat2d
- *
- * @description
- * A mat2d contains six elements defined as:
- * <pre>
- * [a, c, tx,
- * b, d, ty]
- * </pre>
- * This is a short form for the 3x3 matrix:
- * <pre>
- * [a, c, tx,
- * b, d, ty,
- * 0, 0, 1]
- * </pre>
- * The last row is ignored so the array is shorter and operations are faster.
- */
- var mat2d = {};
-
- /**
- * Creates a new identity mat2d
- *
- * @returns {mat2d} a new 2x3 matrix
- */
- mat2d.create = function() {
- var out = new glMatrix.ARRAY_TYPE(6);
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- out[4] = 0;
- out[5] = 0;
- return out;
- };
-
- /**
- * Creates a new mat2d initialized with values from an existing matrix
- *
- * @param {mat2d} a matrix to clone
- * @returns {mat2d} a new 2x3 matrix
- */
- mat2d.clone = function(a) {
- var out = new glMatrix.ARRAY_TYPE(6);
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- out[4] = a[4];
- out[5] = a[5];
- return out;
- };
-
- /**
- * Copy the values from one mat2d to another
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the source matrix
- * @returns {mat2d} out
- */
- mat2d.copy = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- out[4] = a[4];
- out[5] = a[5];
- return out;
- };
-
- /**
- * Set a mat2d to the identity matrix
- *
- * @param {mat2d} out the receiving matrix
- * @returns {mat2d} out
- */
- mat2d.identity = function(out) {
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- out[4] = 0;
- out[5] = 0;
- return out;
- };
-
- /**
- * Inverts a mat2d
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the source matrix
- * @returns {mat2d} out
- */
- mat2d.invert = function(out, a) {
- var aa = a[0], ab = a[1], ac = a[2], ad = a[3],
- atx = a[4], aty = a[5];
-
- var det = aa * ad - ab * ac;
- if(!det){
- return null;
- }
- det = 1.0 / det;
-
- out[0] = ad * det;
- out[1] = -ab * det;
- out[2] = -ac * det;
- out[3] = aa * det;
- out[4] = (ac * aty - ad * atx) * det;
- out[5] = (ab * atx - aa * aty) * det;
- return out;
- };
-
- /**
- * Calculates the determinant of a mat2d
- *
- * @param {mat2d} a the source matrix
- * @returns {Number} determinant of a
- */
- mat2d.determinant = function (a) {
- return a[0] * a[3] - a[1] * a[2];
- };
-
- /**
- * Multiplies two mat2d's
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the first operand
- * @param {mat2d} b the second operand
- * @returns {mat2d} out
- */
- mat2d.multiply = function (out, a, b) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],
- b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5];
- out[0] = a0 * b0 + a2 * b1;
- out[1] = a1 * b0 + a3 * b1;
- out[2] = a0 * b2 + a2 * b3;
- out[3] = a1 * b2 + a3 * b3;
- out[4] = a0 * b4 + a2 * b5 + a4;
- out[5] = a1 * b4 + a3 * b5 + a5;
- return out;
- };
-
- /**
- * Alias for {@link mat2d.multiply}
- * @function
- */
- mat2d.mul = mat2d.multiply;
-
- /**
- * Rotates a mat2d by the given angle
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the matrix to rotate
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat2d} out
- */
- mat2d.rotate = function (out, a, rad) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],
- s = Math.sin(rad),
- c = Math.cos(rad);
- out[0] = a0 * c + a2 * s;
- out[1] = a1 * c + a3 * s;
- out[2] = a0 * -s + a2 * c;
- out[3] = a1 * -s + a3 * c;
- out[4] = a4;
- out[5] = a5;
- return out;
- };
-
- /**
- * Scales the mat2d by the dimensions in the given vec2
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the matrix to translate
- * @param {vec2} v the vec2 to scale the matrix by
- * @returns {mat2d} out
- **/
- mat2d.scale = function(out, a, v) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],
- v0 = v[0], v1 = v[1];
- out[0] = a0 * v0;
- out[1] = a1 * v0;
- out[2] = a2 * v1;
- out[3] = a3 * v1;
- out[4] = a4;
- out[5] = a5;
- return out;
- };
-
- /**
- * Translates the mat2d by the dimensions in the given vec2
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the matrix to translate
- * @param {vec2} v the vec2 to translate the matrix by
- * @returns {mat2d} out
- **/
- mat2d.translate = function(out, a, v) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],
- v0 = v[0], v1 = v[1];
- out[0] = a0;
- out[1] = a1;
- out[2] = a2;
- out[3] = a3;
- out[4] = a0 * v0 + a2 * v1 + a4;
- out[5] = a1 * v0 + a3 * v1 + a5;
- return out;
- };
-
- /**
- * Creates a matrix from a given angle
- * This is equivalent to (but much faster than):
- *
- * mat2d.identity(dest);
- * mat2d.rotate(dest, dest, rad);
- *
- * @param {mat2d} out mat2d receiving operation result
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat2d} out
- */
- mat2d.fromRotation = function(out, rad) {
- var s = Math.sin(rad), c = Math.cos(rad);
- out[0] = c;
- out[1] = s;
- out[2] = -s;
- out[3] = c;
- out[4] = 0;
- out[5] = 0;
- return out;
- }
-
- /**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat2d.identity(dest);
- * mat2d.scale(dest, dest, vec);
- *
- * @param {mat2d} out mat2d receiving operation result
- * @param {vec2} v Scaling vector
- * @returns {mat2d} out
- */
- mat2d.fromScaling = function(out, v) {
- out[0] = v[0];
- out[1] = 0;
- out[2] = 0;
- out[3] = v[1];
- out[4] = 0;
- out[5] = 0;
- return out;
- }
-
- /**
- * Creates a matrix from a vector translation
- * This is equivalent to (but much faster than):
- *
- * mat2d.identity(dest);
- * mat2d.translate(dest, dest, vec);
- *
- * @param {mat2d} out mat2d receiving operation result
- * @param {vec2} v Translation vector
- * @returns {mat2d} out
- */
- mat2d.fromTranslation = function(out, v) {
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- out[4] = v[0];
- out[5] = v[1];
- return out;
- }
-
- /**
- * Returns a string representation of a mat2d
- *
- * @param {mat2d} a matrix to represent as a string
- * @returns {String} string representation of the matrix
- */
- mat2d.str = function (a) {
- return 'mat2d(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' +
- a[3] + ', ' + a[4] + ', ' + a[5] + ')';
- };
-
- /**
- * Returns Frobenius norm of a mat2d
- *
- * @param {mat2d} a the matrix to calculate Frobenius norm of
- * @returns {Number} Frobenius norm
- */
- mat2d.frob = function (a) {
- return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + 1))
- };
-
- module.exports = mat2d;
-
-
-/***/ },
-/* 4 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE. */
-
- var glMatrix = __webpack_require__(1);
-
- /**
- * @class 3x3 Matrix
- * @name mat3
- */
- var mat3 = {};
-
- /**
- * Creates a new identity mat3
- *
- * @returns {mat3} a new 3x3 matrix
- */
- mat3.create = function() {
- var out = new glMatrix.ARRAY_TYPE(9);
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 1;
- out[5] = 0;
- out[6] = 0;
- out[7] = 0;
- out[8] = 1;
- return out;
- };
-
- /**
- * Copies the upper-left 3x3 values into the given mat3.
- *
- * @param {mat3} out the receiving 3x3 matrix
- * @param {mat4} a the source 4x4 matrix
- * @returns {mat3} out
- */
- mat3.fromMat4 = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[4];
- out[4] = a[5];
- out[5] = a[6];
- out[6] = a[8];
- out[7] = a[9];
- out[8] = a[10];
- return out;
- };
-
- /**
- * Creates a new mat3 initialized with values from an existing matrix
- *
- * @param {mat3} a matrix to clone
- * @returns {mat3} a new 3x3 matrix
- */
- mat3.clone = function(a) {
- var out = new glMatrix.ARRAY_TYPE(9);
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- out[4] = a[4];
- out[5] = a[5];
- out[6] = a[6];
- out[7] = a[7];
- out[8] = a[8];
- return out;
- };
-
- /**
- * Copy the values from one mat3 to another
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the source matrix
- * @returns {mat3} out
- */
- mat3.copy = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- out[4] = a[4];
- out[5] = a[5];
- out[6] = a[6];
- out[7] = a[7];
- out[8] = a[8];
- return out;
- };
-
- /**
- * Set a mat3 to the identity matrix
- *
- * @param {mat3} out the receiving matrix
- * @returns {mat3} out
- */
- mat3.identity = function(out) {
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 1;
- out[5] = 0;
- out[6] = 0;
- out[7] = 0;
- out[8] = 1;
- return out;
- };
-
- /**
- * Transpose the values of a mat3
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the source matrix
- * @returns {mat3} out
- */
- mat3.transpose = function(out, a) {
- // If we are transposing ourselves we can skip a few steps but have to cache some values
- if (out === a) {
- var a01 = a[1], a02 = a[2], a12 = a[5];
- out[1] = a[3];
- out[2] = a[6];
- out[3] = a01;
- out[5] = a[7];
- out[6] = a02;
- out[7] = a12;
- } else {
- out[0] = a[0];
- out[1] = a[3];
- out[2] = a[6];
- out[3] = a[1];
- out[4] = a[4];
- out[5] = a[7];
- out[6] = a[2];
- out[7] = a[5];
- out[8] = a[8];
- }
-
- return out;
- };
-
- /**
- * Inverts a mat3
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the source matrix
- * @returns {mat3} out
- */
- mat3.invert = function(out, a) {
- var a00 = a[0], a01 = a[1], a02 = a[2],
- a10 = a[3], a11 = a[4], a12 = a[5],
- a20 = a[6], a21 = a[7], a22 = a[8],
-
- b01 = a22 * a11 - a12 * a21,
- b11 = -a22 * a10 + a12 * a20,
- b21 = a21 * a10 - a11 * a20,
-
- // Calculate the determinant
- det = a00 * b01 + a01 * b11 + a02 * b21;
-
- if (!det) {
- return null;
- }
- det = 1.0 / det;
-
- out[0] = b01 * det;
- out[1] = (-a22 * a01 + a02 * a21) * det;
- out[2] = (a12 * a01 - a02 * a11) * det;
- out[3] = b11 * det;
- out[4] = (a22 * a00 - a02 * a20) * det;
- out[5] = (-a12 * a00 + a02 * a10) * det;
- out[6] = b21 * det;
- out[7] = (-a21 * a00 + a01 * a20) * det;
- out[8] = (a11 * a00 - a01 * a10) * det;
- return out;
- };
-
- /**
- * Calculates the adjugate of a mat3
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the source matrix
- * @returns {mat3} out
- */
- mat3.adjoint = function(out, a) {
- var a00 = a[0], a01 = a[1], a02 = a[2],
- a10 = a[3], a11 = a[4], a12 = a[5],
- a20 = a[6], a21 = a[7], a22 = a[8];
-
- out[0] = (a11 * a22 - a12 * a21);
- out[1] = (a02 * a21 - a01 * a22);
- out[2] = (a01 * a12 - a02 * a11);
- out[3] = (a12 * a20 - a10 * a22);
- out[4] = (a00 * a22 - a02 * a20);
- out[5] = (a02 * a10 - a00 * a12);
- out[6] = (a10 * a21 - a11 * a20);
- out[7] = (a01 * a20 - a00 * a21);
- out[8] = (a00 * a11 - a01 * a10);
- return out;
- };
-
- /**
- * Calculates the determinant of a mat3
- *
- * @param {mat3} a the source matrix
- * @returns {Number} determinant of a
- */
- mat3.determinant = function (a) {
- var a00 = a[0], a01 = a[1], a02 = a[2],
- a10 = a[3], a11 = a[4], a12 = a[5],
- a20 = a[6], a21 = a[7], a22 = a[8];
-
- return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);
- };
-
- /**
- * Multiplies two mat3's
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the first operand
- * @param {mat3} b the second operand
- * @returns {mat3} out
- */
- mat3.multiply = function (out, a, b) {
- var a00 = a[0], a01 = a[1], a02 = a[2],
- a10 = a[3], a11 = a[4], a12 = a[5],
- a20 = a[6], a21 = a[7], a22 = a[8],
-
- b00 = b[0], b01 = b[1], b02 = b[2],
- b10 = b[3], b11 = b[4], b12 = b[5],
- b20 = b[6], b21 = b[7], b22 = b[8];
-
- out[0] = b00 * a00 + b01 * a10 + b02 * a20;
- out[1] = b00 * a01 + b01 * a11 + b02 * a21;
- out[2] = b00 * a02 + b01 * a12 + b02 * a22;
-
- out[3] = b10 * a00 + b11 * a10 + b12 * a20;
- out[4] = b10 * a01 + b11 * a11 + b12 * a21;
- out[5] = b10 * a02 + b11 * a12 + b12 * a22;
-
- out[6] = b20 * a00 + b21 * a10 + b22 * a20;
- out[7] = b20 * a01 + b21 * a11 + b22 * a21;
- out[8] = b20 * a02 + b21 * a12 + b22 * a22;
- return out;
- };
-
- /**
- * Alias for {@link mat3.multiply}
- * @function
- */
- mat3.mul = mat3.multiply;
-
- /**
- * Translate a mat3 by the given vector
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the matrix to translate
- * @param {vec2} v vector to translate by
- * @returns {mat3} out
- */
- mat3.translate = function(out, a, v) {
- var a00 = a[0], a01 = a[1], a02 = a[2],
- a10 = a[3], a11 = a[4], a12 = a[5],
- a20 = a[6], a21 = a[7], a22 = a[8],
- x = v[0], y = v[1];
-
- out[0] = a00;
- out[1] = a01;
- out[2] = a02;
-
- out[3] = a10;
- out[4] = a11;
- out[5] = a12;
-
- out[6] = x * a00 + y * a10 + a20;
- out[7] = x * a01 + y * a11 + a21;
- out[8] = x * a02 + y * a12 + a22;
- return out;
- };
-
- /**
- * Rotates a mat3 by the given angle
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the matrix to rotate
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat3} out
- */
- mat3.rotate = function (out, a, rad) {
- var a00 = a[0], a01 = a[1], a02 = a[2],
- a10 = a[3], a11 = a[4], a12 = a[5],
- a20 = a[6], a21 = a[7], a22 = a[8],
-
- s = Math.sin(rad),
- c = Math.cos(rad);
-
- out[0] = c * a00 + s * a10;
- out[1] = c * a01 + s * a11;
- out[2] = c * a02 + s * a12;
-
- out[3] = c * a10 - s * a00;
- out[4] = c * a11 - s * a01;
- out[5] = c * a12 - s * a02;
-
- out[6] = a20;
- out[7] = a21;
- out[8] = a22;
- return out;
- };
-
- /**
- * Scales the mat3 by the dimensions in the given vec2
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the matrix to rotate
- * @param {vec2} v the vec2 to scale the matrix by
- * @returns {mat3} out
- **/
- mat3.scale = function(out, a, v) {
- var x = v[0], y = v[1];
-
- out[0] = x * a[0];
- out[1] = x * a[1];
- out[2] = x * a[2];
-
- out[3] = y * a[3];
- out[4] = y * a[4];
- out[5] = y * a[5];
-
- out[6] = a[6];
- out[7] = a[7];
- out[8] = a[8];
- return out;
- };
-
- /**
- * Creates a matrix from a vector translation
- * This is equivalent to (but much faster than):
- *
- * mat3.identity(dest);
- * mat3.translate(dest, dest, vec);
- *
- * @param {mat3} out mat3 receiving operation result
- * @param {vec2} v Translation vector
- * @returns {mat3} out
- */
- mat3.fromTranslation = function(out, v) {
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 1;
- out[5] = 0;
- out[6] = v[0];
- out[7] = v[1];
- out[8] = 1;
- return out;
- }
-
- /**
- * Creates a matrix from a given angle
- * This is equivalent to (but much faster than):
- *
- * mat3.identity(dest);
- * mat3.rotate(dest, dest, rad);
- *
- * @param {mat3} out mat3 receiving operation result
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat3} out
- */
- mat3.fromRotation = function(out, rad) {
- var s = Math.sin(rad), c = Math.cos(rad);
-
- out[0] = c;
- out[1] = s;
- out[2] = 0;
-
- out[3] = -s;
- out[4] = c;
- out[5] = 0;
-
- out[6] = 0;
- out[7] = 0;
- out[8] = 1;
- return out;
- }
-
- /**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat3.identity(dest);
- * mat3.scale(dest, dest, vec);
- *
- * @param {mat3} out mat3 receiving operation result
- * @param {vec2} v Scaling vector
- * @returns {mat3} out
- */
- mat3.fromScaling = function(out, v) {
- out[0] = v[0];
- out[1] = 0;
- out[2] = 0;
-
- out[3] = 0;
- out[4] = v[1];
- out[5] = 0;
-
- out[6] = 0;
- out[7] = 0;
- out[8] = 1;
- return out;
- }
-
- /**
- * Copies the values from a mat2d into a mat3
- *
- * @param {mat3} out the receiving matrix
- * @param {mat2d} a the matrix to copy
- * @returns {mat3} out
- **/
- mat3.fromMat2d = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = 0;
-
- out[3] = a[2];
- out[4] = a[3];
- out[5] = 0;
-
- out[6] = a[4];
- out[7] = a[5];
- out[8] = 1;
- return out;
- };
-
- /**
- * Calculates a 3x3 matrix from the given quaternion
- *
- * @param {mat3} out mat3 receiving operation result
- * @param {quat} q Quaternion to create matrix from
- *
- * @returns {mat3} out
- */
- mat3.fromQuat = function (out, q) {
- var x = q[0], y = q[1], z = q[2], w = q[3],
- x2 = x + x,
- y2 = y + y,
- z2 = z + z,
-
- xx = x * x2,
- yx = y * x2,
- yy = y * y2,
- zx = z * x2,
- zy = z * y2,
- zz = z * z2,
- wx = w * x2,
- wy = w * y2,
- wz = w * z2;
-
- out[0] = 1 - yy - zz;
- out[3] = yx - wz;
- out[6] = zx + wy;
-
- out[1] = yx + wz;
- out[4] = 1 - xx - zz;
- out[7] = zy - wx;
-
- out[2] = zx - wy;
- out[5] = zy + wx;
- out[8] = 1 - xx - yy;
-
- return out;
- };
-
- /**
- * Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
- *
- * @param {mat3} out mat3 receiving operation result
- * @param {mat4} a Mat4 to derive the normal matrix from
- *
- * @returns {mat3} out
- */
- mat3.normalFromMat4 = function (out, a) {
- var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
- a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
- a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
- a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],
-
- b00 = a00 * a11 - a01 * a10,
- b01 = a00 * a12 - a02 * a10,
- b02 = a00 * a13 - a03 * a10,
- b03 = a01 * a12 - a02 * a11,
- b04 = a01 * a13 - a03 * a11,
- b05 = a02 * a13 - a03 * a12,
- b06 = a20 * a31 - a21 * a30,
- b07 = a20 * a32 - a22 * a30,
- b08 = a20 * a33 - a23 * a30,
- b09 = a21 * a32 - a22 * a31,
- b10 = a21 * a33 - a23 * a31,
- b11 = a22 * a33 - a23 * a32,
-
- // Calculate the determinant
- det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
-
- if (!det) {
- return null;
- }
- det = 1.0 / det;
-
- out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
- out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
- out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
-
- out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
- out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
- out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
-
- out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
- out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
- out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
-
- return out;
- };
-
- /**
- * Returns a string representation of a mat3
- *
- * @param {mat3} mat matrix to represent as a string
- * @returns {String} string representation of the matrix
- */
- mat3.str = function (a) {
- return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' +
- a[3] + ', ' + a[4] + ', ' + a[5] + ', ' +
- a[6] + ', ' + a[7] + ', ' + a[8] + ')';
- };
-
- /**
- * Returns Frobenius norm of a mat3
- *
- * @param {mat3} a the matrix to calculate Frobenius norm of
- * @returns {Number} Frobenius norm
- */
- mat3.frob = function (a) {
- return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2)))
- };
-
-
- module.exports = mat3;
-
-
-/***/ },
-/* 5 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE. */
-
- var glMatrix = __webpack_require__(1);
-
- /**
- * @class 4x4 Matrix
- * @name mat4
- */
- var mat4 = {};
-
- /**
- * Creates a new identity mat4
- *
- * @returns {mat4} a new 4x4 matrix
- */
- mat4.create = function() {
- var out = new glMatrix.ARRAY_TYPE(16);
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = 1;
- out[6] = 0;
- out[7] = 0;
- out[8] = 0;
- out[9] = 0;
- out[10] = 1;
- out[11] = 0;
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
- return out;
- };
-
- /**
- * Creates a new mat4 initialized with values from an existing matrix
- *
- * @param {mat4} a matrix to clone
- * @returns {mat4} a new 4x4 matrix
- */
- mat4.clone = function(a) {
- var out = new glMatrix.ARRAY_TYPE(16);
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- out[4] = a[4];
- out[5] = a[5];
- out[6] = a[6];
- out[7] = a[7];
- out[8] = a[8];
- out[9] = a[9];
- out[10] = a[10];
- out[11] = a[11];
- out[12] = a[12];
- out[13] = a[13];
- out[14] = a[14];
- out[15] = a[15];
- return out;
- };
-
- /**
- * Copy the values from one mat4 to another
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the source matrix
- * @returns {mat4} out
- */
- mat4.copy = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- out[4] = a[4];
- out[5] = a[5];
- out[6] = a[6];
- out[7] = a[7];
- out[8] = a[8];
- out[9] = a[9];
- out[10] = a[10];
- out[11] = a[11];
- out[12] = a[12];
- out[13] = a[13];
- out[14] = a[14];
- out[15] = a[15];
- return out;
- };
-
- /**
- * Set a mat4 to the identity matrix
- *
- * @param {mat4} out the receiving matrix
- * @returns {mat4} out
- */
- mat4.identity = function(out) {
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = 1;
- out[6] = 0;
- out[7] = 0;
- out[8] = 0;
- out[9] = 0;
- out[10] = 1;
- out[11] = 0;
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
- return out;
- };
-
- /**
- * Transpose the values of a mat4
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the source matrix
- * @returns {mat4} out
- */
- mat4.transpose = function(out, a) {
- // If we are transposing ourselves we can skip a few steps but have to cache some values
- if (out === a) {
- var a01 = a[1], a02 = a[2], a03 = a[3],
- a12 = a[6], a13 = a[7],
- a23 = a[11];
-
- out[1] = a[4];
- out[2] = a[8];
- out[3] = a[12];
- out[4] = a01;
- out[6] = a[9];
- out[7] = a[13];
- out[8] = a02;
- out[9] = a12;
- out[11] = a[14];
- out[12] = a03;
- out[13] = a13;
- out[14] = a23;
- } else {
- out[0] = a[0];
- out[1] = a[4];
- out[2] = a[8];
- out[3] = a[12];
- out[4] = a[1];
- out[5] = a[5];
- out[6] = a[9];
- out[7] = a[13];
- out[8] = a[2];
- out[9] = a[6];
- out[10] = a[10];
- out[11] = a[14];
- out[12] = a[3];
- out[13] = a[7];
- out[14] = a[11];
- out[15] = a[15];
- }
-
- return out;
- };
-
- /**
- * Inverts a mat4
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the source matrix
- * @returns {mat4} out
- */
- mat4.invert = function(out, a) {
- var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
- a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
- a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
- a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],
-
- b00 = a00 * a11 - a01 * a10,
- b01 = a00 * a12 - a02 * a10,
- b02 = a00 * a13 - a03 * a10,
- b03 = a01 * a12 - a02 * a11,
- b04 = a01 * a13 - a03 * a11,
- b05 = a02 * a13 - a03 * a12,
- b06 = a20 * a31 - a21 * a30,
- b07 = a20 * a32 - a22 * a30,
- b08 = a20 * a33 - a23 * a30,
- b09 = a21 * a32 - a22 * a31,
- b10 = a21 * a33 - a23 * a31,
- b11 = a22 * a33 - a23 * a32,
-
- // Calculate the determinant
- det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
-
- if (!det) {
- return null;
- }
- det = 1.0 / det;
-
- out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
- out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
- out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
- out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;
- out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
- out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
- out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
- out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;
- out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
- out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
- out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
- out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;
- out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;
- out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;
- out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;
- out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
-
- return out;
- };
-
- /**
- * Calculates the adjugate of a mat4
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the source matrix
- * @returns {mat4} out
- */
- mat4.adjoint = function(out, a) {
- var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
- a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
- a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
- a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];
-
- out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22));
- out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));
- out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12));
- out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));
- out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));
- out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22));
- out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));
- out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12));
- out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21));
- out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));
- out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11));
- out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));
- out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));
- out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21));
- out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));
- out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11));
- return out;
- };
-
- /**
- * Calculates the determinant of a mat4
- *
- * @param {mat4} a the source matrix
- * @returns {Number} determinant of a
- */
- mat4.determinant = function (a) {
- var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
- a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
- a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
- a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],
-
- b00 = a00 * a11 - a01 * a10,
- b01 = a00 * a12 - a02 * a10,
- b02 = a00 * a13 - a03 * a10,
- b03 = a01 * a12 - a02 * a11,
- b04 = a01 * a13 - a03 * a11,
- b05 = a02 * a13 - a03 * a12,
- b06 = a20 * a31 - a21 * a30,
- b07 = a20 * a32 - a22 * a30,
- b08 = a20 * a33 - a23 * a30,
- b09 = a21 * a32 - a22 * a31,
- b10 = a21 * a33 - a23 * a31,
- b11 = a22 * a33 - a23 * a32;
-
- // Calculate the determinant
- return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
- };
-
- /**
- * Multiplies two mat4's
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the first operand
- * @param {mat4} b the second operand
- * @returns {mat4} out
- */
- mat4.multiply = function (out, a, b) {
- var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
- a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
- a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
- a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];
-
- // Cache only the current line of the second matrix
- var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];
- out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30;
- out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31;
- out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32;
- out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33;
-
- b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7];
- out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30;
- out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31;
- out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32;
- out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33;
-
- b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11];
- out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30;
- out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31;
- out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32;
- out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33;
-
- b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15];
- out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30;
- out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31;
- out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32;
- out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33;
- return out;
- };
-
- /**
- * Alias for {@link mat4.multiply}
- * @function
- */
- mat4.mul = mat4.multiply;
-
- /**
- * Translate a mat4 by the given vector
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the matrix to translate
- * @param {vec3} v vector to translate by
- * @returns {mat4} out
- */
- mat4.translate = function (out, a, v) {
- var x = v[0], y = v[1], z = v[2],
- a00, a01, a02, a03,
- a10, a11, a12, a13,
- a20, a21, a22, a23;
-
- if (a === out) {
- out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];
- out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];
- out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];
- out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];
- } else {
- a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];
- a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];
- a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];
-
- out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;
- out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;
- out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;
-
- out[12] = a00 * x + a10 * y + a20 * z + a[12];
- out[13] = a01 * x + a11 * y + a21 * z + a[13];
- out[14] = a02 * x + a12 * y + a22 * z + a[14];
- out[15] = a03 * x + a13 * y + a23 * z + a[15];
- }
-
- return out;
- };
-
- /**
- * Scales the mat4 by the dimensions in the given vec3
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the matrix to scale
- * @param {vec3} v the vec3 to scale the matrix by
- * @returns {mat4} out
- **/
- mat4.scale = function(out, a, v) {
- var x = v[0], y = v[1], z = v[2];
-
- out[0] = a[0] * x;
- out[1] = a[1] * x;
- out[2] = a[2] * x;
- out[3] = a[3] * x;
- out[4] = a[4] * y;
- out[5] = a[5] * y;
- out[6] = a[6] * y;
- out[7] = a[7] * y;
- out[8] = a[8] * z;
- out[9] = a[9] * z;
- out[10] = a[10] * z;
- out[11] = a[11] * z;
- out[12] = a[12];
- out[13] = a[13];
- out[14] = a[14];
- out[15] = a[15];
- return out;
- };
-
- /**
- * Rotates a mat4 by the given angle around the given axis
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the matrix to rotate
- * @param {Number} rad the angle to rotate the matrix by
- * @param {vec3} axis the axis to rotate around
- * @returns {mat4} out
- */
- mat4.rotate = function (out, a, rad, axis) {
- var x = axis[0], y = axis[1], z = axis[2],
- len = Math.sqrt(x * x + y * y + z * z),
- s, c, t,
- a00, a01, a02, a03,
- a10, a11, a12, a13,
- a20, a21, a22, a23,
- b00, b01, b02,
- b10, b11, b12,
- b20, b21, b22;
-
- if (Math.abs(len) < glMatrix.EPSILON) { return null; }
-
- len = 1 / len;
- x *= len;
- y *= len;
- z *= len;
-
- s = Math.sin(rad);
- c = Math.cos(rad);
- t = 1 - c;
-
- a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];
- a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];
- a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];
-
- // Construct the elements of the rotation matrix
- b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s;
- b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s;
- b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c;
-
- // Perform rotation-specific matrix multiplication
- out[0] = a00 * b00 + a10 * b01 + a20 * b02;
- out[1] = a01 * b00 + a11 * b01 + a21 * b02;
- out[2] = a02 * b00 + a12 * b01 + a22 * b02;
- out[3] = a03 * b00 + a13 * b01 + a23 * b02;
- out[4] = a00 * b10 + a10 * b11 + a20 * b12;
- out[5] = a01 * b10 + a11 * b11 + a21 * b12;
- out[6] = a02 * b10 + a12 * b11 + a22 * b12;
- out[7] = a03 * b10 + a13 * b11 + a23 * b12;
- out[8] = a00 * b20 + a10 * b21 + a20 * b22;
- out[9] = a01 * b20 + a11 * b21 + a21 * b22;
- out[10] = a02 * b20 + a12 * b21 + a22 * b22;
- out[11] = a03 * b20 + a13 * b21 + a23 * b22;
-
- if (a !== out) { // If the source and destination differ, copy the unchanged last row
- out[12] = a[12];
- out[13] = a[13];
- out[14] = a[14];
- out[15] = a[15];
- }
- return out;
- };
-
- /**
- * Rotates a matrix by the given angle around the X axis
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the matrix to rotate
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
- mat4.rotateX = function (out, a, rad) {
- var s = Math.sin(rad),
- c = Math.cos(rad),
- a10 = a[4],
- a11 = a[5],
- a12 = a[6],
- a13 = a[7],
- a20 = a[8],
- a21 = a[9],
- a22 = a[10],
- a23 = a[11];
-
- if (a !== out) { // If the source and destination differ, copy the unchanged rows
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- out[12] = a[12];
- out[13] = a[13];
- out[14] = a[14];
- out[15] = a[15];
- }
-
- // Perform axis-specific matrix multiplication
- out[4] = a10 * c + a20 * s;
- out[5] = a11 * c + a21 * s;
- out[6] = a12 * c + a22 * s;
- out[7] = a13 * c + a23 * s;
- out[8] = a20 * c - a10 * s;
- out[9] = a21 * c - a11 * s;
- out[10] = a22 * c - a12 * s;
- out[11] = a23 * c - a13 * s;
- return out;
- };
-
- /**
- * Rotates a matrix by the given angle around the Y axis
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the matrix to rotate
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
- mat4.rotateY = function (out, a, rad) {
- var s = Math.sin(rad),
- c = Math.cos(rad),
- a00 = a[0],
- a01 = a[1],
- a02 = a[2],
- a03 = a[3],
- a20 = a[8],
- a21 = a[9],
- a22 = a[10],
- a23 = a[11];
-
- if (a !== out) { // If the source and destination differ, copy the unchanged rows
- out[4] = a[4];
- out[5] = a[5];
- out[6] = a[6];
- out[7] = a[7];
- out[12] = a[12];
- out[13] = a[13];
- out[14] = a[14];
- out[15] = a[15];
- }
-
- // Perform axis-specific matrix multiplication
- out[0] = a00 * c - a20 * s;
- out[1] = a01 * c - a21 * s;
- out[2] = a02 * c - a22 * s;
- out[3] = a03 * c - a23 * s;
- out[8] = a00 * s + a20 * c;
- out[9] = a01 * s + a21 * c;
- out[10] = a02 * s + a22 * c;
- out[11] = a03 * s + a23 * c;
- return out;
- };
-
- /**
- * Rotates a matrix by the given angle around the Z axis
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the matrix to rotate
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
- mat4.rotateZ = function (out, a, rad) {
- var s = Math.sin(rad),
- c = Math.cos(rad),
- a00 = a[0],
- a01 = a[1],
- a02 = a[2],
- a03 = a[3],
- a10 = a[4],
- a11 = a[5],
- a12 = a[6],
- a13 = a[7];
-
- if (a !== out) { // If the source and destination differ, copy the unchanged last row
- out[8] = a[8];
- out[9] = a[9];
- out[10] = a[10];
- out[11] = a[11];
- out[12] = a[12];
- out[13] = a[13];
- out[14] = a[14];
- out[15] = a[15];
- }
-
- // Perform axis-specific matrix multiplication
- out[0] = a00 * c + a10 * s;
- out[1] = a01 * c + a11 * s;
- out[2] = a02 * c + a12 * s;
- out[3] = a03 * c + a13 * s;
- out[4] = a10 * c - a00 * s;
- out[5] = a11 * c - a01 * s;
- out[6] = a12 * c - a02 * s;
- out[7] = a13 * c - a03 * s;
- return out;
- };
-
- /**
- * Creates a matrix from a vector translation
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, dest, vec);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {vec3} v Translation vector
- * @returns {mat4} out
- */
- mat4.fromTranslation = function(out, v) {
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = 1;
- out[6] = 0;
- out[7] = 0;
- out[8] = 0;
- out[9] = 0;
- out[10] = 1;
- out[11] = 0;
- out[12] = v[0];
- out[13] = v[1];
- out[14] = v[2];
- out[15] = 1;
- return out;
- }
-
- /**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.scale(dest, dest, vec);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {vec3} v Scaling vector
- * @returns {mat4} out
- */
- mat4.fromScaling = function(out, v) {
- out[0] = v[0];
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = v[1];
- out[6] = 0;
- out[7] = 0;
- out[8] = 0;
- out[9] = 0;
- out[10] = v[2];
- out[11] = 0;
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
- return out;
- }
-
- /**
- * Creates a matrix from a given angle around a given axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotate(dest, dest, rad, axis);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {Number} rad the angle to rotate the matrix by
- * @param {vec3} axis the axis to rotate around
- * @returns {mat4} out
- */
- mat4.fromRotation = function(out, rad, axis) {
- var x = axis[0], y = axis[1], z = axis[2],
- len = Math.sqrt(x * x + y * y + z * z),
- s, c, t;
-
- if (Math.abs(len) < glMatrix.EPSILON) { return null; }
-
- len = 1 / len;
- x *= len;
- y *= len;
- z *= len;
-
- s = Math.sin(rad);
- c = Math.cos(rad);
- t = 1 - c;
-
- // Perform rotation-specific matrix multiplication
- out[0] = x * x * t + c;
- out[1] = y * x * t + z * s;
- out[2] = z * x * t - y * s;
- out[3] = 0;
- out[4] = x * y * t - z * s;
- out[5] = y * y * t + c;
- out[6] = z * y * t + x * s;
- out[7] = 0;
- out[8] = x * z * t + y * s;
- out[9] = y * z * t - x * s;
- out[10] = z * z * t + c;
- out[11] = 0;
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
- return out;
- }
-
- /**
- * Creates a matrix from the given angle around the X axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotateX(dest, dest, rad);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
- mat4.fromXRotation = function(out, rad) {
- var s = Math.sin(rad),
- c = Math.cos(rad);
-
- // Perform axis-specific matrix multiplication
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = c;
- out[6] = s;
- out[7] = 0;
- out[8] = 0;
- out[9] = -s;
- out[10] = c;
- out[11] = 0;
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
- return out;
- }
-
- /**
- * Creates a matrix from the given angle around the Y axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotateY(dest, dest, rad);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
- mat4.fromYRotation = function(out, rad) {
- var s = Math.sin(rad),
- c = Math.cos(rad);
-
- // Perform axis-specific matrix multiplication
- out[0] = c;
- out[1] = 0;
- out[2] = -s;
- out[3] = 0;
- out[4] = 0;
- out[5] = 1;
- out[6] = 0;
- out[7] = 0;
- out[8] = s;
- out[9] = 0;
- out[10] = c;
- out[11] = 0;
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
- return out;
- }
-
- /**
- * Creates a matrix from the given angle around the Z axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotateZ(dest, dest, rad);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
- mat4.fromZRotation = function(out, rad) {
- var s = Math.sin(rad),
- c = Math.cos(rad);
-
- // Perform axis-specific matrix multiplication
- out[0] = c;
- out[1] = s;
- out[2] = 0;
- out[3] = 0;
- out[4] = -s;
- out[5] = c;
- out[6] = 0;
- out[7] = 0;
- out[8] = 0;
- out[9] = 0;
- out[10] = 1;
- out[11] = 0;
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
- return out;
- }
-
- /**
- * Creates a matrix from a quaternion rotation and vector translation
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, vec);
- * var quatMat = mat4.create();
- * quat4.toMat4(quat, quatMat);
- * mat4.multiply(dest, quatMat);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {quat4} q Rotation quaternion
- * @param {vec3} v Translation vector
- * @returns {mat4} out
- */
- mat4.fromRotationTranslation = function (out, q, v) {
- // Quaternion math
- var x = q[0], y = q[1], z = q[2], w = q[3],
- x2 = x + x,
- y2 = y + y,
- z2 = z + z,
-
- xx = x * x2,
- xy = x * y2,
- xz = x * z2,
- yy = y * y2,
- yz = y * z2,
- zz = z * z2,
- wx = w * x2,
- wy = w * y2,
- wz = w * z2;
-
- out[0] = 1 - (yy + zz);
- out[1] = xy + wz;
- out[2] = xz - wy;
- out[3] = 0;
- out[4] = xy - wz;
- out[5] = 1 - (xx + zz);
- out[6] = yz + wx;
- out[7] = 0;
- out[8] = xz + wy;
- out[9] = yz - wx;
- out[10] = 1 - (xx + yy);
- out[11] = 0;
- out[12] = v[0];
- out[13] = v[1];
- out[14] = v[2];
- out[15] = 1;
-
- return out;
- };
-
- /**
- * Creates a matrix from a quaternion rotation, vector translation and vector scale
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, vec);
- * var quatMat = mat4.create();
- * quat4.toMat4(quat, quatMat);
- * mat4.multiply(dest, quatMat);
- * mat4.scale(dest, scale)
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {quat4} q Rotation quaternion
- * @param {vec3} v Translation vector
- * @param {vec3} s Scaling vector
- * @returns {mat4} out
- */
- mat4.fromRotationTranslationScale = function (out, q, v, s) {
- // Quaternion math
- var x = q[0], y = q[1], z = q[2], w = q[3],
- x2 = x + x,
- y2 = y + y,
- z2 = z + z,
-
- xx = x * x2,
- xy = x * y2,
- xz = x * z2,
- yy = y * y2,
- yz = y * z2,
- zz = z * z2,
- wx = w * x2,
- wy = w * y2,
- wz = w * z2,
- sx = s[0],
- sy = s[1],
- sz = s[2];
-
- out[0] = (1 - (yy + zz)) * sx;
- out[1] = (xy + wz) * sx;
- out[2] = (xz - wy) * sx;
- out[3] = 0;
- out[4] = (xy - wz) * sy;
- out[5] = (1 - (xx + zz)) * sy;
- out[6] = (yz + wx) * sy;
- out[7] = 0;
- out[8] = (xz + wy) * sz;
- out[9] = (yz - wx) * sz;
- out[10] = (1 - (xx + yy)) * sz;
- out[11] = 0;
- out[12] = v[0];
- out[13] = v[1];
- out[14] = v[2];
- out[15] = 1;
-
- return out;
- };
-
- /**
- * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, vec);
- * mat4.translate(dest, origin);
- * var quatMat = mat4.create();
- * quat4.toMat4(quat, quatMat);
- * mat4.multiply(dest, quatMat);
- * mat4.scale(dest, scale)
- * mat4.translate(dest, negativeOrigin);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {quat4} q Rotation quaternion
- * @param {vec3} v Translation vector
- * @param {vec3} s Scaling vector
- * @param {vec3} o The origin vector around which to scale and rotate
- * @returns {mat4} out
- */
- mat4.fromRotationTranslationScaleOrigin = function (out, q, v, s, o) {
- // Quaternion math
- var x = q[0], y = q[1], z = q[2], w = q[3],
- x2 = x + x,
- y2 = y + y,
- z2 = z + z,
-
- xx = x * x2,
- xy = x * y2,
- xz = x * z2,
- yy = y * y2,
- yz = y * z2,
- zz = z * z2,
- wx = w * x2,
- wy = w * y2,
- wz = w * z2,
-
- sx = s[0],
- sy = s[1],
- sz = s[2],
-
- ox = o[0],
- oy = o[1],
- oz = o[2];
-
- out[0] = (1 - (yy + zz)) * sx;
- out[1] = (xy + wz) * sx;
- out[2] = (xz - wy) * sx;
- out[3] = 0;
- out[4] = (xy - wz) * sy;
- out[5] = (1 - (xx + zz)) * sy;
- out[6] = (yz + wx) * sy;
- out[7] = 0;
- out[8] = (xz + wy) * sz;
- out[9] = (yz - wx) * sz;
- out[10] = (1 - (xx + yy)) * sz;
- out[11] = 0;
- out[12] = v[0] + ox - (out[0] * ox + out[4] * oy + out[8] * oz);
- out[13] = v[1] + oy - (out[1] * ox + out[5] * oy + out[9] * oz);
- out[14] = v[2] + oz - (out[2] * ox + out[6] * oy + out[10] * oz);
- out[15] = 1;
-
- return out;
- };
-
- mat4.fromQuat = function (out, q) {
- var x = q[0], y = q[1], z = q[2], w = q[3],
- x2 = x + x,
- y2 = y + y,
- z2 = z + z,
-
- xx = x * x2,
- yx = y * x2,
- yy = y * y2,
- zx = z * x2,
- zy = z * y2,
- zz = z * z2,
- wx = w * x2,
- wy = w * y2,
- wz = w * z2;
-
- out[0] = 1 - yy - zz;
- out[1] = yx + wz;
- out[2] = zx - wy;
- out[3] = 0;
-
- out[4] = yx - wz;
- out[5] = 1 - xx - zz;
- out[6] = zy + wx;
- out[7] = 0;
-
- out[8] = zx + wy;
- out[9] = zy - wx;
- out[10] = 1 - xx - yy;
- out[11] = 0;
-
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
-
- return out;
- };
-
- /**
- * Generates a frustum matrix with the given bounds
- *
- * @param {mat4} out mat4 frustum matrix will be written into
- * @param {Number} left Left bound of the frustum
- * @param {Number} right Right bound of the frustum
- * @param {Number} bottom Bottom bound of the frustum
- * @param {Number} top Top bound of the frustum
- * @param {Number} near Near bound of the frustum
- * @param {Number} far Far bound of the frustum
- * @returns {mat4} out
- */
- mat4.frustum = function (out, left, right, bottom, top, near, far) {
- var rl = 1 / (right - left),
- tb = 1 / (top - bottom),
- nf = 1 / (near - far);
- out[0] = (near * 2) * rl;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = (near * 2) * tb;
- out[6] = 0;
- out[7] = 0;
- out[8] = (right + left) * rl;
- out[9] = (top + bottom) * tb;
- out[10] = (far + near) * nf;
- out[11] = -1;
- out[12] = 0;
- out[13] = 0;
- out[14] = (far * near * 2) * nf;
- out[15] = 0;
- return out;
- };
-
- /**
- * Generates a perspective projection matrix with the given bounds
- *
- * @param {mat4} out mat4 frustum matrix will be written into
- * @param {number} fovy Vertical field of view in radians
- * @param {number} aspect Aspect ratio. typically viewport width/height
- * @param {number} near Near bound of the frustum
- * @param {number} far Far bound of the frustum
- * @returns {mat4} out
- */
- mat4.perspective = function (out, fovy, aspect, near, far) {
- var f = 1.0 / Math.tan(fovy / 2),
- nf = 1 / (near - far);
- out[0] = f / aspect;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = f;
- out[6] = 0;
- out[7] = 0;
- out[8] = 0;
- out[9] = 0;
- out[10] = (far + near) * nf;
- out[11] = -1;
- out[12] = 0;
- out[13] = 0;
- out[14] = (2 * far * near) * nf;
- out[15] = 0;
- return out;
- };
-
- /**
- * Generates a perspective projection matrix with the given field of view.
- * This is primarily useful for generating projection matrices to be used
- * with the still experiemental WebVR API.
- *
- * @param {mat4} out mat4 frustum matrix will be written into
- * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees
- * @param {number} near Near bound of the frustum
- * @param {number} far Far bound of the frustum
- * @returns {mat4} out
- */
- mat4.perspectiveFromFieldOfView = function (out, fov, near, far) {
- var upTan = Math.tan(fov.upDegrees * Math.PI/180.0),
- downTan = Math.tan(fov.downDegrees * Math.PI/180.0),
- leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0),
- rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0),
- xScale = 2.0 / (leftTan + rightTan),
- yScale = 2.0 / (upTan + downTan);
-
- out[0] = xScale;
- out[1] = 0.0;
- out[2] = 0.0;
- out[3] = 0.0;
- out[4] = 0.0;
- out[5] = yScale;
- out[6] = 0.0;
- out[7] = 0.0;
- out[8] = -((leftTan - rightTan) * xScale * 0.5);
- out[9] = ((upTan - downTan) * yScale * 0.5);
- out[10] = far / (near - far);
- out[11] = -1.0;
- out[12] = 0.0;
- out[13] = 0.0;
- out[14] = (far * near) / (near - far);
- out[15] = 0.0;
- return out;
- }
-
- /**
- * Generates a orthogonal projection matrix with the given bounds
- *
- * @param {mat4} out mat4 frustum matrix will be written into
- * @param {number} left Left bound of the frustum
- * @param {number} right Right bound of the frustum
- * @param {number} bottom Bottom bound of the frustum
- * @param {number} top Top bound of the frustum
- * @param {number} near Near bound of the frustum
- * @param {number} far Far bound of the frustum
- * @returns {mat4} out
- */
- mat4.ortho = function (out, left, right, bottom, top, near, far) {
- var lr = 1 / (left - right),
- bt = 1 / (bottom - top),
- nf = 1 / (near - far);
- out[0] = -2 * lr;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = -2 * bt;
- out[6] = 0;
- out[7] = 0;
- out[8] = 0;
- out[9] = 0;
- out[10] = 2 * nf;
- out[11] = 0;
- out[12] = (left + right) * lr;
- out[13] = (top + bottom) * bt;
- out[14] = (far + near) * nf;
- out[15] = 1;
- return out;
- };
-
- /**
- * Generates a look-at matrix with the given eye position, focal point, and up axis
- *
- * @param {mat4} out mat4 frustum matrix will be written into
- * @param {vec3} eye Position of the viewer
- * @param {vec3} center Point the viewer is looking at
- * @param {vec3} up vec3 pointing up
- * @returns {mat4} out
- */
- mat4.lookAt = function (out, eye, center, up) {
- var x0, x1, x2, y0, y1, y2, z0, z1, z2, len,
- eyex = eye[0],
- eyey = eye[1],
- eyez = eye[2],
- upx = up[0],
- upy = up[1],
- upz = up[2],
- centerx = center[0],
- centery = center[1],
- centerz = center[2];
-
- if (Math.abs(eyex - centerx) < glMatrix.EPSILON &&
- Math.abs(eyey - centery) < glMatrix.EPSILON &&
- Math.abs(eyez - centerz) < glMatrix.EPSILON) {
- return mat4.identity(out);
- }
-
- z0 = eyex - centerx;
- z1 = eyey - centery;
- z2 = eyez - centerz;
-
- len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);
- z0 *= len;
- z1 *= len;
- z2 *= len;
-
- x0 = upy * z2 - upz * z1;
- x1 = upz * z0 - upx * z2;
- x2 = upx * z1 - upy * z0;
- len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);
- if (!len) {
- x0 = 0;
- x1 = 0;
- x2 = 0;
- } else {
- len = 1 / len;
- x0 *= len;
- x1 *= len;
- x2 *= len;
- }
-
- y0 = z1 * x2 - z2 * x1;
- y1 = z2 * x0 - z0 * x2;
- y2 = z0 * x1 - z1 * x0;
-
- len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);
- if (!len) {
- y0 = 0;
- y1 = 0;
- y2 = 0;
- } else {
- len = 1 / len;
- y0 *= len;
- y1 *= len;
- y2 *= len;
- }
-
- out[0] = x0;
- out[1] = y0;
- out[2] = z0;
- out[3] = 0;
- out[4] = x1;
- out[5] = y1;
- out[6] = z1;
- out[7] = 0;
- out[8] = x2;
- out[9] = y2;
- out[10] = z2;
- out[11] = 0;
- out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);
- out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);
- out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);
- out[15] = 1;
-
- return out;
- };
-
- /**
- * Returns a string representation of a mat4
- *
- * @param {mat4} mat matrix to represent as a string
- * @returns {String} string representation of the matrix
- */
- mat4.str = function (a) {
- return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' +
- a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' +
- a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' +
- a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')';
- };
-
- /**
- * Returns Frobenius norm of a mat4
- *
- * @param {mat4} a the matrix to calculate Frobenius norm of
- * @returns {Number} Frobenius norm
- */
- mat4.frob = function (a) {
- return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2) + Math.pow(a[9], 2) + Math.pow(a[10], 2) + Math.pow(a[11], 2) + Math.pow(a[12], 2) + Math.pow(a[13], 2) + Math.pow(a[14], 2) + Math.pow(a[15], 2) ))
- };
-
-
- module.exports = mat4;
-
-
-/***/ },
-/* 6 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE. */
-
- var glMatrix = __webpack_require__(1);
- var mat3 = __webpack_require__(4);
- var vec3 = __webpack_require__(7);
- var vec4 = __webpack_require__(8);
-
- /**
- * @class Quaternion
- * @name quat
- */
- var quat = {};
-
- /**
- * Creates a new identity quat
- *
- * @returns {quat} a new quaternion
- */
- quat.create = function() {
- var out = new glMatrix.ARRAY_TYPE(4);
- out[0] = 0;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- return out;
- };
-
- /**
- * Sets a quaternion to represent the shortest rotation from one
- * vector to another.
- *
- * Both vectors are assumed to be unit length.
- *
- * @param {quat} out the receiving quaternion.
- * @param {vec3} a the initial vector
- * @param {vec3} b the destination vector
- * @returns {quat} out
- */
- quat.rotationTo = (function() {
- var tmpvec3 = vec3.create();
- var xUnitVec3 = vec3.fromValues(1,0,0);
- var yUnitVec3 = vec3.fromValues(0,1,0);
-
- return function(out, a, b) {
- var dot = vec3.dot(a, b);
- if (dot < -0.999999) {
- vec3.cross(tmpvec3, xUnitVec3, a);
- if (vec3.length(tmpvec3) < 0.000001)
- vec3.cross(tmpvec3, yUnitVec3, a);
- vec3.normalize(tmpvec3, tmpvec3);
- quat.setAxisAngle(out, tmpvec3, Math.PI);
- return out;
- } else if (dot > 0.999999) {
- out[0] = 0;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- return out;
- } else {
- vec3.cross(tmpvec3, a, b);
- out[0] = tmpvec3[0];
- out[1] = tmpvec3[1];
- out[2] = tmpvec3[2];
- out[3] = 1 + dot;
- return quat.normalize(out, out);
- }
- };
- })();
-
- /**
- * Sets the specified quaternion with values corresponding to the given
- * axes. Each axis is a vec3 and is expected to be unit length and
- * perpendicular to all other specified axes.
- *
- * @param {vec3} view the vector representing the viewing direction
- * @param {vec3} right the vector representing the local "right" direction
- * @param {vec3} up the vector representing the local "up" direction
- * @returns {quat} out
- */
- quat.setAxes = (function() {
- var matr = mat3.create();
-
- return function(out, view, right, up) {
- matr[0] = right[0];
- matr[3] = right[1];
- matr[6] = right[2];
-
- matr[1] = up[0];
- matr[4] = up[1];
- matr[7] = up[2];
-
- matr[2] = -view[0];
- matr[5] = -view[1];
- matr[8] = -view[2];
-
- return quat.normalize(out, quat.fromMat3(out, matr));
- };
- })();
-
- /**
- * Creates a new quat initialized with values from an existing quaternion
- *
- * @param {quat} a quaternion to clone
- * @returns {quat} a new quaternion
- * @function
- */
- quat.clone = vec4.clone;
-
- /**
- * Creates a new quat initialized with the given values
- *
- * @param {Number} x X component
- * @param {Number} y Y component
- * @param {Number} z Z component
- * @param {Number} w W component
- * @returns {quat} a new quaternion
- * @function
- */
- quat.fromValues = vec4.fromValues;
-
- /**
- * Copy the values from one quat to another
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a the source quaternion
- * @returns {quat} out
- * @function
- */
- quat.copy = vec4.copy;
-
- /**
- * Set the components of a quat to the given values
- *
- * @param {quat} out the receiving quaternion
- * @param {Number} x X component
- * @param {Number} y Y component
- * @param {Number} z Z component
- * @param {Number} w W component
- * @returns {quat} out
- * @function
- */
- quat.set = vec4.set;
-
- /**
- * Set a quat to the identity quaternion
- *
- * @param {quat} out the receiving quaternion
- * @returns {quat} out
- */
- quat.identity = function(out) {
- out[0] = 0;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- return out;
- };
-
- /**
- * Sets a quat from the given angle and rotation axis,
- * then returns it.
- *
- * @param {quat} out the receiving quaternion
- * @param {vec3} axis the axis around which to rotate
- * @param {Number} rad the angle in radians
- * @returns {quat} out
- **/
- quat.setAxisAngle = function(out, axis, rad) {
- rad = rad * 0.5;
- var s = Math.sin(rad);
- out[0] = s * axis[0];
- out[1] = s * axis[1];
- out[2] = s * axis[2];
- out[3] = Math.cos(rad);
- return out;
- };
-
- /**
- * Adds two quat's
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a the first operand
- * @param {quat} b the second operand
- * @returns {quat} out
- * @function
- */
- quat.add = vec4.add;
-
- /**
- * Multiplies two quat's
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a the first operand
- * @param {quat} b the second operand
- * @returns {quat} out
- */
- quat.multiply = function(out, a, b) {
- var ax = a[0], ay = a[1], az = a[2], aw = a[3],
- bx = b[0], by = b[1], bz = b[2], bw = b[3];
-
- out[0] = ax * bw + aw * bx + ay * bz - az * by;
- out[1] = ay * bw + aw * by + az * bx - ax * bz;
- out[2] = az * bw + aw * bz + ax * by - ay * bx;
- out[3] = aw * bw - ax * bx - ay * by - az * bz;
- return out;
- };
-
- /**
- * Alias for {@link quat.multiply}
- * @function
- */
- quat.mul = quat.multiply;
-
- /**
- * Scales a quat by a scalar number
- *
- * @param {quat} out the receiving vector
- * @param {quat} a the vector to scale
- * @param {Number} b amount to scale the vector by
- * @returns {quat} out
- * @function
- */
- quat.scale = vec4.scale;
-
- /**
- * Rotates a quaternion by the given angle about the X axis
- *
- * @param {quat} out quat receiving operation result
- * @param {quat} a quat to rotate
- * @param {number} rad angle (in radians) to rotate
- * @returns {quat} out
- */
- quat.rotateX = function (out, a, rad) {
- rad *= 0.5;
-
- var ax = a[0], ay = a[1], az = a[2], aw = a[3],
- bx = Math.sin(rad), bw = Math.cos(rad);
-
- out[0] = ax * bw + aw * bx;
- out[1] = ay * bw + az * bx;
- out[2] = az * bw - ay * bx;
- out[3] = aw * bw - ax * bx;
- return out;
- };
-
- /**
- * Rotates a quaternion by the given angle about the Y axis
- *
- * @param {quat} out quat receiving operation result
- * @param {quat} a quat to rotate
- * @param {number} rad angle (in radians) to rotate
- * @returns {quat} out
- */
- quat.rotateY = function (out, a, rad) {
- rad *= 0.5;
-
- var ax = a[0], ay = a[1], az = a[2], aw = a[3],
- by = Math.sin(rad), bw = Math.cos(rad);
-
- out[0] = ax * bw - az * by;
- out[1] = ay * bw + aw * by;
- out[2] = az * bw + ax * by;
- out[3] = aw * bw - ay * by;
- return out;
- };
-
- /**
- * Rotates a quaternion by the given angle about the Z axis
- *
- * @param {quat} out quat receiving operation result
- * @param {quat} a quat to rotate
- * @param {number} rad angle (in radians) to rotate
- * @returns {quat} out
- */
- quat.rotateZ = function (out, a, rad) {
- rad *= 0.5;
-
- var ax = a[0], ay = a[1], az = a[2], aw = a[3],
- bz = Math.sin(rad), bw = Math.cos(rad);
-
- out[0] = ax * bw + ay * bz;
- out[1] = ay * bw - ax * bz;
- out[2] = az * bw + aw * bz;
- out[3] = aw * bw - az * bz;
- return out;
- };
-
- /**
- * Calculates the W component of a quat from the X, Y, and Z components.
- * Assumes that quaternion is 1 unit in length.
- * Any existing W component will be ignored.
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a quat to calculate W component of
- * @returns {quat} out
- */
- quat.calculateW = function (out, a) {
- var x = a[0], y = a[1], z = a[2];
-
- out[0] = x;
- out[1] = y;
- out[2] = z;
- out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));
- return out;
- };
-
- /**
- * Calculates the dot product of two quat's
- *
- * @param {quat} a the first operand
- * @param {quat} b the second operand
- * @returns {Number} dot product of a and b
- * @function
- */
- quat.dot = vec4.dot;
-
- /**
- * Performs a linear interpolation between two quat's
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a the first operand
- * @param {quat} b the second operand
- * @param {Number} t interpolation amount between the two inputs
- * @returns {quat} out
- * @function
- */
- quat.lerp = vec4.lerp;
-
- /**
- * Performs a spherical linear interpolation between two quat
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a the first operand
- * @param {quat} b the second operand
- * @param {Number} t interpolation amount between the two inputs
- * @returns {quat} out
- */
- quat.slerp = function (out, a, b, t) {
- // benchmarks:
- // http://jsperf.com/quaternion-slerp-implementations
-
- var ax = a[0], ay = a[1], az = a[2], aw = a[3],
- bx = b[0], by = b[1], bz = b[2], bw = b[3];
-
- var omega, cosom, sinom, scale0, scale1;
-
- // calc cosine
- cosom = ax * bx + ay * by + az * bz + aw * bw;
- // adjust signs (if necessary)
- if ( cosom < 0.0 ) {
- cosom = -cosom;
- bx = - bx;
- by = - by;
- bz = - bz;
- bw = - bw;
- }
- // calculate coefficients
- if ( (1.0 - cosom) > 0.000001 ) {
- // standard case (slerp)
- omega = Math.acos(cosom);
- sinom = Math.sin(omega);
- scale0 = Math.sin((1.0 - t) * omega) / sinom;
- scale1 = Math.sin(t * omega) / sinom;
- } else {
- // "from" and "to" quaternions are very close
- // ... so we can do a linear interpolation
- scale0 = 1.0 - t;
- scale1 = t;
- }
- // calculate final values
- out[0] = scale0 * ax + scale1 * bx;
- out[1] = scale0 * ay + scale1 * by;
- out[2] = scale0 * az + scale1 * bz;
- out[3] = scale0 * aw + scale1 * bw;
-
- return out;
- };
-
- /**
- * Performs a spherical linear interpolation with two control points
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a the first operand
- * @param {quat} b the second operand
- * @param {quat} c the third operand
- * @param {quat} d the fourth operand
- * @param {Number} t interpolation amount
- * @returns {quat} out
- */
- quat.sqlerp = (function () {
- var temp1 = quat.create();
- var temp2 = quat.create();
-
- return function (out, a, b, c, d, t) {
- quat.slerp(temp1, a, d, t);
- quat.slerp(temp2, b, c, t);
- quat.slerp(out, temp1, temp2, 2 * t * (1 - t));
-
- return out;
- };
- }());
-
- /**
- * Calculates the inverse of a quat
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a quat to calculate inverse of
- * @returns {quat} out
- */
- quat.invert = function(out, a) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],
- dot = a0*a0 + a1*a1 + a2*a2 + a3*a3,
- invDot = dot ? 1.0/dot : 0;
-
- // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0
-
- out[0] = -a0*invDot;
- out[1] = -a1*invDot;
- out[2] = -a2*invDot;
- out[3] = a3*invDot;
- return out;
- };
-
- /**
- * Calculates the conjugate of a quat
- * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a quat to calculate conjugate of
- * @returns {quat} out
- */
- quat.conjugate = function (out, a) {
- out[0] = -a[0];
- out[1] = -a[1];
- out[2] = -a[2];
- out[3] = a[3];
- return out;
- };
-
- /**
- * Calculates the length of a quat
- *
- * @param {quat} a vector to calculate length of
- * @returns {Number} length of a
- * @function
- */
- quat.length = vec4.length;
-
- /**
- * Alias for {@link quat.length}
- * @function
- */
- quat.len = quat.length;
-
- /**
- * Calculates the squared length of a quat
- *
- * @param {quat} a vector to calculate squared length of
- * @returns {Number} squared length of a
- * @function
- */
- quat.squaredLength = vec4.squaredLength;
-
- /**
- * Alias for {@link quat.squaredLength}
- * @function
- */
- quat.sqrLen = quat.squaredLength;
-
- /**
- * Normalize a quat
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a quaternion to normalize
- * @returns {quat} out
- * @function
- */
- quat.normalize = vec4.normalize;
-
- /**
- * Creates a quaternion from the given 3x3 rotation matrix.
- *
- * NOTE: The resultant quaternion is not normalized, so you should be sure
- * to renormalize the quaternion yourself where necessary.
- *
- * @param {quat} out the receiving quaternion
- * @param {mat3} m rotation matrix
- * @returns {quat} out
- * @function
- */
- quat.fromMat3 = function(out, m) {
- // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes
- // article "Quaternion Calculus and Fast Animation".
- var fTrace = m[0] + m[4] + m[8];
- var fRoot;
-
- if ( fTrace > 0.0 ) {
- // |w| > 1/2, may as well choose w > 1/2
- fRoot = Math.sqrt(fTrace + 1.0); // 2w
- out[3] = 0.5 * fRoot;
- fRoot = 0.5/fRoot; // 1/(4w)
- out[0] = (m[5]-m[7])*fRoot;
- out[1] = (m[6]-m[2])*fRoot;
- out[2] = (m[1]-m[3])*fRoot;
- } else {
- // |w| <= 1/2
- var i = 0;
- if ( m[4] > m[0] )
- i = 1;
- if ( m[8] > m[i*3+i] )
- i = 2;
- var j = (i+1)%3;
- var k = (i+2)%3;
-
- fRoot = Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k] + 1.0);
- out[i] = 0.5 * fRoot;
- fRoot = 0.5 / fRoot;
- out[3] = (m[j*3+k] - m[k*3+j]) * fRoot;
- out[j] = (m[j*3+i] + m[i*3+j]) * fRoot;
- out[k] = (m[k*3+i] + m[i*3+k]) * fRoot;
- }
-
- return out;
- };
-
- /**
- * Returns a string representation of a quatenion
- *
- * @param {quat} vec vector to represent as a string
- * @returns {String} string representation of the vector
- */
- quat.str = function (a) {
- return 'quat(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';
- };
-
- module.exports = quat;
-
-
-/***/ },
-/* 7 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE. */
-
- var glMatrix = __webpack_require__(1);
-
- /**
- * @class 3 Dimensional Vector
- * @name vec3
- */
- var vec3 = {};
-
- /**
- * Creates a new, empty vec3
- *
- * @returns {vec3} a new 3D vector
- */
- vec3.create = function() {
- var out = new glMatrix.ARRAY_TYPE(3);
- out[0] = 0;
- out[1] = 0;
- out[2] = 0;
- return out;
- };
-
- /**
- * Creates a new vec3 initialized with values from an existing vector
- *
- * @param {vec3} a vector to clone
- * @returns {vec3} a new 3D vector
- */
- vec3.clone = function(a) {
- var out = new glMatrix.ARRAY_TYPE(3);
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- return out;
- };
-
- /**
- * Creates a new vec3 initialized with the given values
- *
- * @param {Number} x X component
- * @param {Number} y Y component
- * @param {Number} z Z component
- * @returns {vec3} a new 3D vector
- */
- vec3.fromValues = function(x, y, z) {
- var out = new glMatrix.ARRAY_TYPE(3);
- out[0] = x;
- out[1] = y;
- out[2] = z;
- return out;
- };
-
- /**
- * Copy the values from one vec3 to another
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the source vector
- * @returns {vec3} out
- */
- vec3.copy = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- return out;
- };
-
- /**
- * Set the components of a vec3 to the given values
- *
- * @param {vec3} out the receiving vector
- * @param {Number} x X component
- * @param {Number} y Y component
- * @param {Number} z Z component
- * @returns {vec3} out
- */
- vec3.set = function(out, x, y, z) {
- out[0] = x;
- out[1] = y;
- out[2] = z;
- return out;
- };
-
- /**
- * Adds two vec3's
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {vec3} out
- */
- vec3.add = function(out, a, b) {
- out[0] = a[0] + b[0];
- out[1] = a[1] + b[1];
- out[2] = a[2] + b[2];
- return out;
- };
-
- /**
- * Subtracts vector b from vector a
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {vec3} out
- */
- vec3.subtract = function(out, a, b) {
- out[0] = a[0] - b[0];
- out[1] = a[1] - b[1];
- out[2] = a[2] - b[2];
- return out;
- };
-
- /**
- * Alias for {@link vec3.subtract}
- * @function
- */
- vec3.sub = vec3.subtract;
-
- /**
- * Multiplies two vec3's
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {vec3} out
- */
- vec3.multiply = function(out, a, b) {
- out[0] = a[0] * b[0];
- out[1] = a[1] * b[1];
- out[2] = a[2] * b[2];
- return out;
- };
-
- /**
- * Alias for {@link vec3.multiply}
- * @function
- */
- vec3.mul = vec3.multiply;
-
- /**
- * Divides two vec3's
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {vec3} out
- */
- vec3.divide = function(out, a, b) {
- out[0] = a[0] / b[0];
- out[1] = a[1] / b[1];
- out[2] = a[2] / b[2];
- return out;
- };
-
- /**
- * Alias for {@link vec3.divide}
- * @function
- */
- vec3.div = vec3.divide;
-
- /**
- * Returns the minimum of two vec3's
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {vec3} out
- */
- vec3.min = function(out, a, b) {
- out[0] = Math.min(a[0], b[0]);
- out[1] = Math.min(a[1], b[1]);
- out[2] = Math.min(a[2], b[2]);
- return out;
- };
-
- /**
- * Returns the maximum of two vec3's
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {vec3} out
- */
- vec3.max = function(out, a, b) {
- out[0] = Math.max(a[0], b[0]);
- out[1] = Math.max(a[1], b[1]);
- out[2] = Math.max(a[2], b[2]);
- return out;
- };
-
- /**
- * Scales a vec3 by a scalar number
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the vector to scale
- * @param {Number} b amount to scale the vector by
- * @returns {vec3} out
- */
- vec3.scale = function(out, a, b) {
- out[0] = a[0] * b;
- out[1] = a[1] * b;
- out[2] = a[2] * b;
- return out;
- };
-
- /**
- * Adds two vec3's after scaling the second operand by a scalar value
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @param {Number} scale the amount to scale b by before adding
- * @returns {vec3} out
- */
- vec3.scaleAndAdd = function(out, a, b, scale) {
- out[0] = a[0] + (b[0] * scale);
- out[1] = a[1] + (b[1] * scale);
- out[2] = a[2] + (b[2] * scale);
- return out;
- };
-
- /**
- * Calculates the euclidian distance between two vec3's
- *
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {Number} distance between a and b
- */
- vec3.distance = function(a, b) {
- var x = b[0] - a[0],
- y = b[1] - a[1],
- z = b[2] - a[2];
- return Math.sqrt(x*x + y*y + z*z);
- };
-
- /**
- * Alias for {@link vec3.distance}
- * @function
- */
- vec3.dist = vec3.distance;
-
- /**
- * Calculates the squared euclidian distance between two vec3's
- *
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {Number} squared distance between a and b
- */
- vec3.squaredDistance = function(a, b) {
- var x = b[0] - a[0],
- y = b[1] - a[1],
- z = b[2] - a[2];
- return x*x + y*y + z*z;
- };
-
- /**
- * Alias for {@link vec3.squaredDistance}
- * @function
- */
- vec3.sqrDist = vec3.squaredDistance;
-
- /**
- * Calculates the length of a vec3
- *
- * @param {vec3} a vector to calculate length of
- * @returns {Number} length of a
- */
- vec3.length = function (a) {
- var x = a[0],
- y = a[1],
- z = a[2];
- return Math.sqrt(x*x + y*y + z*z);
- };
-
- /**
- * Alias for {@link vec3.length}
- * @function
- */
- vec3.len = vec3.length;
-
- /**
- * Calculates the squared length of a vec3
- *
- * @param {vec3} a vector to calculate squared length of
- * @returns {Number} squared length of a
- */
- vec3.squaredLength = function (a) {
- var x = a[0],
- y = a[1],
- z = a[2];
- return x*x + y*y + z*z;
- };
-
- /**
- * Alias for {@link vec3.squaredLength}
- * @function
- */
- vec3.sqrLen = vec3.squaredLength;
-
- /**
- * Negates the components of a vec3
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a vector to negate
- * @returns {vec3} out
- */
- vec3.negate = function(out, a) {
- out[0] = -a[0];
- out[1] = -a[1];
- out[2] = -a[2];
- return out;
- };
-
- /**
- * Returns the inverse of the components of a vec3
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a vector to invert
- * @returns {vec3} out
- */
- vec3.inverse = function(out, a) {
- out[0] = 1.0 / a[0];
- out[1] = 1.0 / a[1];
- out[2] = 1.0 / a[2];
- return out;
- };
-
- /**
- * Normalize a vec3
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a vector to normalize
- * @returns {vec3} out
- */
- vec3.normalize = function(out, a) {
- var x = a[0],
- y = a[1],
- z = a[2];
- var len = x*x + y*y + z*z;
- if (len > 0) {
- //TODO: evaluate use of glm_invsqrt here?
- len = 1 / Math.sqrt(len);
- out[0] = a[0] * len;
- out[1] = a[1] * len;
- out[2] = a[2] * len;
- }
- return out;
- };
-
- /**
- * Calculates the dot product of two vec3's
- *
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {Number} dot product of a and b
- */
- vec3.dot = function (a, b) {
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
- };
-
- /**
- * Computes the cross product of two vec3's
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {vec3} out
- */
- vec3.cross = function(out, a, b) {
- var ax = a[0], ay = a[1], az = a[2],
- bx = b[0], by = b[1], bz = b[2];
-
- out[0] = ay * bz - az * by;
- out[1] = az * bx - ax * bz;
- out[2] = ax * by - ay * bx;
- return out;
- };
-
- /**
- * Performs a linear interpolation between two vec3's
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @param {Number} t interpolation amount between the two inputs
- * @returns {vec3} out
- */
- vec3.lerp = function (out, a, b, t) {
- var ax = a[0],
- ay = a[1],
- az = a[2];
- out[0] = ax + t * (b[0] - ax);
- out[1] = ay + t * (b[1] - ay);
- out[2] = az + t * (b[2] - az);
- return out;
- };
-
- /**
- * Performs a hermite interpolation with two control points
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @param {vec3} c the third operand
- * @param {vec3} d the fourth operand
- * @param {Number} t interpolation amount between the two inputs
- * @returns {vec3} out
- */
- vec3.hermite = function (out, a, b, c, d, t) {
- var factorTimes2 = t * t,
- factor1 = factorTimes2 * (2 * t - 3) + 1,
- factor2 = factorTimes2 * (t - 2) + t,
- factor3 = factorTimes2 * (t - 1),
- factor4 = factorTimes2 * (3 - 2 * t);
-
- out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
- out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
- out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
-
- return out;
- };
-
- /**
- * Performs a bezier interpolation with two control points
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @param {vec3} c the third operand
- * @param {vec3} d the fourth operand
- * @param {Number} t interpolation amount between the two inputs
- * @returns {vec3} out
- */
- vec3.bezier = function (out, a, b, c, d, t) {
- var inverseFactor = 1 - t,
- inverseFactorTimesTwo = inverseFactor * inverseFactor,
- factorTimes2 = t * t,
- factor1 = inverseFactorTimesTwo * inverseFactor,
- factor2 = 3 * t * inverseFactorTimesTwo,
- factor3 = 3 * factorTimes2 * inverseFactor,
- factor4 = factorTimes2 * t;
-
- out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
- out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
- out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
-
- return out;
- };
-
- /**
- * Generates a random vector with the given scale
- *
- * @param {vec3} out the receiving vector
- * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
- * @returns {vec3} out
- */
- vec3.random = function (out, scale) {
- scale = scale || 1.0;
-
- var r = glMatrix.RANDOM() * 2.0 * Math.PI;
- var z = (glMatrix.RANDOM() * 2.0) - 1.0;
- var zScale = Math.sqrt(1.0-z*z) * scale;
-
- out[0] = Math.cos(r) * zScale;
- out[1] = Math.sin(r) * zScale;
- out[2] = z * scale;
- return out;
- };
-
- /**
- * Transforms the vec3 with a mat4.
- * 4th vector component is implicitly '1'
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the vector to transform
- * @param {mat4} m matrix to transform with
- * @returns {vec3} out
- */
- vec3.transformMat4 = function(out, a, m) {
- var x = a[0], y = a[1], z = a[2],
- w = m[3] * x + m[7] * y + m[11] * z + m[15];
- w = w || 1.0;
- out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
- out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
- out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
- return out;
- };
-
- /**
- * Transforms the vec3 with a mat3.
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the vector to transform
- * @param {mat4} m the 3x3 matrix to transform with
- * @returns {vec3} out
- */
- vec3.transformMat3 = function(out, a, m) {
- var x = a[0], y = a[1], z = a[2];
- out[0] = x * m[0] + y * m[3] + z * m[6];
- out[1] = x * m[1] + y * m[4] + z * m[7];
- out[2] = x * m[2] + y * m[5] + z * m[8];
- return out;
- };
-
- /**
- * Transforms the vec3 with a quat
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the vector to transform
- * @param {quat} q quaternion to transform with
- * @returns {vec3} out
- */
- vec3.transformQuat = function(out, a, q) {
- // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations
-
- var x = a[0], y = a[1], z = a[2],
- qx = q[0], qy = q[1], qz = q[2], qw = q[3],
-
- // calculate quat * vec
- ix = qw * x + qy * z - qz * y,
- iy = qw * y + qz * x - qx * z,
- iz = qw * z + qx * y - qy * x,
- iw = -qx * x - qy * y - qz * z;
-
- // calculate result * inverse quat
- out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
- out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
- out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
- return out;
- };
-
- /**
- * Rotate a 3D vector around the x-axis
- * @param {vec3} out The receiving vec3
- * @param {vec3} a The vec3 point to rotate
- * @param {vec3} b The origin of the rotation
- * @param {Number} c The angle of rotation
- * @returns {vec3} out
- */
- vec3.rotateX = function(out, a, b, c){
- var p = [], r=[];
- //Translate point to the origin
- p[0] = a[0] - b[0];
- p[1] = a[1] - b[1];
- p[2] = a[2] - b[2];
-
- //perform rotation
- r[0] = p[0];
- r[1] = p[1]*Math.cos(c) - p[2]*Math.sin(c);
- r[2] = p[1]*Math.sin(c) + p[2]*Math.cos(c);
-
- //translate to correct position
- out[0] = r[0] + b[0];
- out[1] = r[1] + b[1];
- out[2] = r[2] + b[2];
-
- return out;
- };
-
- /**
- * Rotate a 3D vector around the y-axis
- * @param {vec3} out The receiving vec3
- * @param {vec3} a The vec3 point to rotate
- * @param {vec3} b The origin of the rotation
- * @param {Number} c The angle of rotation
- * @returns {vec3} out
- */
- vec3.rotateY = function(out, a, b, c){
- var p = [], r=[];
- //Translate point to the origin
- p[0] = a[0] - b[0];
- p[1] = a[1] - b[1];
- p[2] = a[2] - b[2];
-
- //perform rotation
- r[0] = p[2]*Math.sin(c) + p[0]*Math.cos(c);
- r[1] = p[1];
- r[2] = p[2]*Math.cos(c) - p[0]*Math.sin(c);
-
- //translate to correct position
- out[0] = r[0] + b[0];
- out[1] = r[1] + b[1];
- out[2] = r[2] + b[2];
-
- return out;
- };
-
- /**
- * Rotate a 3D vector around the z-axis
- * @param {vec3} out The receiving vec3
- * @param {vec3} a The vec3 point to rotate
- * @param {vec3} b The origin of the rotation
- * @param {Number} c The angle of rotation
- * @returns {vec3} out
- */
- vec3.rotateZ = function(out, a, b, c){
- var p = [], r=[];
- //Translate point to the origin
- p[0] = a[0] - b[0];
- p[1] = a[1] - b[1];
- p[2] = a[2] - b[2];
-
- //perform rotation
- r[0] = p[0]*Math.cos(c) - p[1]*Math.sin(c);
- r[1] = p[0]*Math.sin(c) + p[1]*Math.cos(c);
- r[2] = p[2];
-
- //translate to correct position
- out[0] = r[0] + b[0];
- out[1] = r[1] + b[1];
- out[2] = r[2] + b[2];
-
- return out;
- };
-
- /**
- * Perform some operation over an array of vec3s.
- *
- * @param {Array} a the array of vectors to iterate over
- * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
- * @param {Number} offset Number of elements to skip at the beginning of the array
- * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
- * @param {Function} fn Function to call for each vector in the array
- * @param {Object} [arg] additional argument to pass to fn
- * @returns {Array} a
- * @function
- */
- vec3.forEach = (function() {
- var vec = vec3.create();
-
- return function(a, stride, offset, count, fn, arg) {
- var i, l;
- if(!stride) {
- stride = 3;
- }
-
- if(!offset) {
- offset = 0;
- }
-
- if(count) {
- l = Math.min((count * stride) + offset, a.length);
- } else {
- l = a.length;
- }
-
- for(i = offset; i < l; i += stride) {
- vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2];
- fn(vec, vec, arg);
- a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2];
- }
-
- return a;
- };
- })();
-
- /**
- * Get the angle between two 3D vectors
- * @param {vec3} a The first operand
- * @param {vec3} b The second operand
- * @returns {Number} The angle in radians
- */
- vec3.angle = function(a, b) {
-
- var tempA = vec3.fromValues(a[0], a[1], a[2]);
- var tempB = vec3.fromValues(b[0], b[1], b[2]);
-
- vec3.normalize(tempA, tempA);
- vec3.normalize(tempB, tempB);
-
- var cosine = vec3.dot(tempA, tempB);
-
- if(cosine > 1.0){
- return 0;
- } else {
- return Math.acos(cosine);
- }
- };
-
- /**
- * Returns a string representation of a vector
- *
- * @param {vec3} vec vector to represent as a string
- * @returns {String} string representation of the vector
- */
- vec3.str = function (a) {
- return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';
- };
-
- module.exports = vec3;
-
-
-/***/ },
-/* 8 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE. */
-
- var glMatrix = __webpack_require__(1);
-
- /**
- * @class 4 Dimensional Vector
- * @name vec4
- */
- var vec4 = {};
-
- /**
- * Creates a new, empty vec4
- *
- * @returns {vec4} a new 4D vector
- */
- vec4.create = function() {
- var out = new glMatrix.ARRAY_TYPE(4);
- out[0] = 0;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- return out;
- };
-
- /**
- * Creates a new vec4 initialized with values from an existing vector
- *
- * @param {vec4} a vector to clone
- * @returns {vec4} a new 4D vector
- */
- vec4.clone = function(a) {
- var out = new glMatrix.ARRAY_TYPE(4);
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- return out;
- };
-
- /**
- * Creates a new vec4 initialized with the given values
- *
- * @param {Number} x X component
- * @param {Number} y Y component
- * @param {Number} z Z component
- * @param {Number} w W component
- * @returns {vec4} a new 4D vector
- */
- vec4.fromValues = function(x, y, z, w) {
- var out = new glMatrix.ARRAY_TYPE(4);
- out[0] = x;
- out[1] = y;
- out[2] = z;
- out[3] = w;
- return out;
- };
-
- /**
- * Copy the values from one vec4 to another
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the source vector
- * @returns {vec4} out
- */
- vec4.copy = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- return out;
- };
-
- /**
- * Set the components of a vec4 to the given values
- *
- * @param {vec4} out the receiving vector
- * @param {Number} x X component
- * @param {Number} y Y component
- * @param {Number} z Z component
- * @param {Number} w W component
- * @returns {vec4} out
- */
- vec4.set = function(out, x, y, z, w) {
- out[0] = x;
- out[1] = y;
- out[2] = z;
- out[3] = w;
- return out;
- };
-
- /**
- * Adds two vec4's
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {vec4} out
- */
- vec4.add = function(out, a, b) {
- out[0] = a[0] + b[0];
- out[1] = a[1] + b[1];
- out[2] = a[2] + b[2];
- out[3] = a[3] + b[3];
- return out;
- };
-
- /**
- * Subtracts vector b from vector a
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {vec4} out
- */
- vec4.subtract = function(out, a, b) {
- out[0] = a[0] - b[0];
- out[1] = a[1] - b[1];
- out[2] = a[2] - b[2];
- out[3] = a[3] - b[3];
- return out;
- };
-
- /**
- * Alias for {@link vec4.subtract}
- * @function
- */
- vec4.sub = vec4.subtract;
-
- /**
- * Multiplies two vec4's
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {vec4} out
- */
- vec4.multiply = function(out, a, b) {
- out[0] = a[0] * b[0];
- out[1] = a[1] * b[1];
- out[2] = a[2] * b[2];
- out[3] = a[3] * b[3];
- return out;
- };
-
- /**
- * Alias for {@link vec4.multiply}
- * @function
- */
- vec4.mul = vec4.multiply;
-
- /**
- * Divides two vec4's
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {vec4} out
- */
- vec4.divide = function(out, a, b) {
- out[0] = a[0] / b[0];
- out[1] = a[1] / b[1];
- out[2] = a[2] / b[2];
- out[3] = a[3] / b[3];
- return out;
- };
-
- /**
- * Alias for {@link vec4.divide}
- * @function
- */
- vec4.div = vec4.divide;
-
- /**
- * Returns the minimum of two vec4's
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {vec4} out
- */
- vec4.min = function(out, a, b) {
- out[0] = Math.min(a[0], b[0]);
- out[1] = Math.min(a[1], b[1]);
- out[2] = Math.min(a[2], b[2]);
- out[3] = Math.min(a[3], b[3]);
- return out;
- };
-
- /**
- * Returns the maximum of two vec4's
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {vec4} out
- */
- vec4.max = function(out, a, b) {
- out[0] = Math.max(a[0], b[0]);
- out[1] = Math.max(a[1], b[1]);
- out[2] = Math.max(a[2], b[2]);
- out[3] = Math.max(a[3], b[3]);
- return out;
- };
-
- /**
- * Scales a vec4 by a scalar number
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the vector to scale
- * @param {Number} b amount to scale the vector by
- * @returns {vec4} out
- */
- vec4.scale = function(out, a, b) {
- out[0] = a[0] * b;
- out[1] = a[1] * b;
- out[2] = a[2] * b;
- out[3] = a[3] * b;
- return out;
- };
-
- /**
- * Adds two vec4's after scaling the second operand by a scalar value
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @param {Number} scale the amount to scale b by before adding
- * @returns {vec4} out
- */
- vec4.scaleAndAdd = function(out, a, b, scale) {
- out[0] = a[0] + (b[0] * scale);
- out[1] = a[1] + (b[1] * scale);
- out[2] = a[2] + (b[2] * scale);
- out[3] = a[3] + (b[3] * scale);
- return out;
- };
-
- /**
- * Calculates the euclidian distance between two vec4's
- *
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {Number} distance between a and b
- */
- vec4.distance = function(a, b) {
- var x = b[0] - a[0],
- y = b[1] - a[1],
- z = b[2] - a[2],
- w = b[3] - a[3];
- return Math.sqrt(x*x + y*y + z*z + w*w);
- };
-
- /**
- * Alias for {@link vec4.distance}
- * @function
- */
- vec4.dist = vec4.distance;
-
- /**
- * Calculates the squared euclidian distance between two vec4's
- *
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {Number} squared distance between a and b
- */
- vec4.squaredDistance = function(a, b) {
- var x = b[0] - a[0],
- y = b[1] - a[1],
- z = b[2] - a[2],
- w = b[3] - a[3];
- return x*x + y*y + z*z + w*w;
- };
-
- /**
- * Alias for {@link vec4.squaredDistance}
- * @function
- */
- vec4.sqrDist = vec4.squaredDistance;
-
- /**
- * Calculates the length of a vec4
- *
- * @param {vec4} a vector to calculate length of
- * @returns {Number} length of a
- */
- vec4.length = function (a) {
- var x = a[0],
- y = a[1],
- z = a[2],
- w = a[3];
- return Math.sqrt(x*x + y*y + z*z + w*w);
- };
-
- /**
- * Alias for {@link vec4.length}
- * @function
- */
- vec4.len = vec4.length;
-
- /**
- * Calculates the squared length of a vec4
- *
- * @param {vec4} a vector to calculate squared length of
- * @returns {Number} squared length of a
- */
- vec4.squaredLength = function (a) {
- var x = a[0],
- y = a[1],
- z = a[2],
- w = a[3];
- return x*x + y*y + z*z + w*w;
- };
-
- /**
- * Alias for {@link vec4.squaredLength}
- * @function
- */
- vec4.sqrLen = vec4.squaredLength;
-
- /**
- * Negates the components of a vec4
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a vector to negate
- * @returns {vec4} out
- */
- vec4.negate = function(out, a) {
- out[0] = -a[0];
- out[1] = -a[1];
- out[2] = -a[2];
- out[3] = -a[3];
- return out;
- };
-
- /**
- * Returns the inverse of the components of a vec4
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a vector to invert
- * @returns {vec4} out
- */
- vec4.inverse = function(out, a) {
- out[0] = 1.0 / a[0];
- out[1] = 1.0 / a[1];
- out[2] = 1.0 / a[2];
- out[3] = 1.0 / a[3];
- return out;
- };
-
- /**
- * Normalize a vec4
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a vector to normalize
- * @returns {vec4} out
- */
- vec4.normalize = function(out, a) {
- var x = a[0],
- y = a[1],
- z = a[2],
- w = a[3];
- var len = x*x + y*y + z*z + w*w;
- if (len > 0) {
- len = 1 / Math.sqrt(len);
- out[0] = x * len;
- out[1] = y * len;
- out[2] = z * len;
- out[3] = w * len;
- }
- return out;
- };
-
- /**
- * Calculates the dot product of two vec4's
- *
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {Number} dot product of a and b
- */
- vec4.dot = function (a, b) {
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
- };
-
- /**
- * Performs a linear interpolation between two vec4's
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @param {Number} t interpolation amount between the two inputs
- * @returns {vec4} out
- */
- vec4.lerp = function (out, a, b, t) {
- var ax = a[0],
- ay = a[1],
- az = a[2],
- aw = a[3];
- out[0] = ax + t * (b[0] - ax);
- out[1] = ay + t * (b[1] - ay);
- out[2] = az + t * (b[2] - az);
- out[3] = aw + t * (b[3] - aw);
- return out;
- };
-
- /**
- * Generates a random vector with the given scale
- *
- * @param {vec4} out the receiving vector
- * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
- * @returns {vec4} out
- */
- vec4.random = function (out, scale) {
- scale = scale || 1.0;
-
- //TODO: This is a pretty awful way of doing this. Find something better.
- out[0] = glMatrix.RANDOM();
- out[1] = glMatrix.RANDOM();
- out[2] = glMatrix.RANDOM();
- out[3] = glMatrix.RANDOM();
- vec4.normalize(out, out);
- vec4.scale(out, out, scale);
- return out;
- };
-
- /**
- * Transforms the vec4 with a mat4.
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the vector to transform
- * @param {mat4} m matrix to transform with
- * @returns {vec4} out
- */
- vec4.transformMat4 = function(out, a, m) {
- var x = a[0], y = a[1], z = a[2], w = a[3];
- out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;
- out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;
- out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;
- out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;
- return out;
- };
-
- /**
- * Transforms the vec4 with a quat
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the vector to transform
- * @param {quat} q quaternion to transform with
- * @returns {vec4} out
- */
- vec4.transformQuat = function(out, a, q) {
- var x = a[0], y = a[1], z = a[2],
- qx = q[0], qy = q[1], qz = q[2], qw = q[3],
-
- // calculate quat * vec
- ix = qw * x + qy * z - qz * y,
- iy = qw * y + qz * x - qx * z,
- iz = qw * z + qx * y - qy * x,
- iw = -qx * x - qy * y - qz * z;
-
- // calculate result * inverse quat
- out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
- out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
- out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
- out[3] = a[3];
- return out;
- };
-
- /**
- * Perform some operation over an array of vec4s.
- *
- * @param {Array} a the array of vectors to iterate over
- * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed
- * @param {Number} offset Number of elements to skip at the beginning of the array
- * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array
- * @param {Function} fn Function to call for each vector in the array
- * @param {Object} [arg] additional argument to pass to fn
- * @returns {Array} a
- * @function
- */
- vec4.forEach = (function() {
- var vec = vec4.create();
-
- return function(a, stride, offset, count, fn, arg) {
- var i, l;
- if(!stride) {
- stride = 4;
- }
-
- if(!offset) {
- offset = 0;
- }
-
- if(count) {
- l = Math.min((count * stride) + offset, a.length);
- } else {
- l = a.length;
- }
-
- for(i = offset; i < l; i += stride) {
- vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2]; vec[3] = a[i+3];
- fn(vec, vec, arg);
- a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2]; a[i+3] = vec[3];
- }
-
- return a;
- };
- })();
-
- /**
- * Returns a string representation of a vector
- *
- * @param {vec4} vec vector to represent as a string
- * @returns {String} string representation of the vector
- */
- vec4.str = function (a) {
- return 'vec4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';
- };
-
- module.exports = vec4;
-
-
-/***/ },
-/* 9 */
-/***/ function(module, exports, __webpack_require__) {
-
- /* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE. */
-
- var glMatrix = __webpack_require__(1);
-
- /**
- * @class 2 Dimensional Vector
- * @name vec2
- */
- var vec2 = {};
-
- /**
- * Creates a new, empty vec2
- *
- * @returns {vec2} a new 2D vector
- */
- vec2.create = function() {
- var out = new glMatrix.ARRAY_TYPE(2);
- out[0] = 0;
- out[1] = 0;
- return out;
- };
-
- /**
- * Creates a new vec2 initialized with values from an existing vector
- *
- * @param {vec2} a vector to clone
- * @returns {vec2} a new 2D vector
- */
- vec2.clone = function(a) {
- var out = new glMatrix.ARRAY_TYPE(2);
- out[0] = a[0];
- out[1] = a[1];
- return out;
- };
-
- /**
- * Creates a new vec2 initialized with the given values
- *
- * @param {Number} x X component
- * @param {Number} y Y component
- * @returns {vec2} a new 2D vector
- */
- vec2.fromValues = function(x, y) {
- var out = new glMatrix.ARRAY_TYPE(2);
- out[0] = x;
- out[1] = y;
- return out;
- };
-
- /**
- * Copy the values from one vec2 to another
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the source vector
- * @returns {vec2} out
- */
- vec2.copy = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- return out;
- };
-
- /**
- * Set the components of a vec2 to the given values
- *
- * @param {vec2} out the receiving vector
- * @param {Number} x X component
- * @param {Number} y Y component
- * @returns {vec2} out
- */
- vec2.set = function(out, x, y) {
- out[0] = x;
- out[1] = y;
- return out;
- };
-
- /**
- * Adds two vec2's
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {vec2} out
- */
- vec2.add = function(out, a, b) {
- out[0] = a[0] + b[0];
- out[1] = a[1] + b[1];
- return out;
- };
-
- /**
- * Subtracts vector b from vector a
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {vec2} out
- */
- vec2.subtract = function(out, a, b) {
- out[0] = a[0] - b[0];
- out[1] = a[1] - b[1];
- return out;
- };
-
- /**
- * Alias for {@link vec2.subtract}
- * @function
- */
- vec2.sub = vec2.subtract;
-
- /**
- * Multiplies two vec2's
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {vec2} out
- */
- vec2.multiply = function(out, a, b) {
- out[0] = a[0] * b[0];
- out[1] = a[1] * b[1];
- return out;
- };
-
- /**
- * Alias for {@link vec2.multiply}
- * @function
- */
- vec2.mul = vec2.multiply;
-
- /**
- * Divides two vec2's
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {vec2} out
- */
- vec2.divide = function(out, a, b) {
- out[0] = a[0] / b[0];
- out[1] = a[1] / b[1];
- return out;
- };
-
- /**
- * Alias for {@link vec2.divide}
- * @function
- */
- vec2.div = vec2.divide;
-
- /**
- * Returns the minimum of two vec2's
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {vec2} out
- */
- vec2.min = function(out, a, b) {
- out[0] = Math.min(a[0], b[0]);
- out[1] = Math.min(a[1], b[1]);
- return out;
- };
-
- /**
- * Returns the maximum of two vec2's
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {vec2} out
- */
- vec2.max = function(out, a, b) {
- out[0] = Math.max(a[0], b[0]);
- out[1] = Math.max(a[1], b[1]);
- return out;
- };
-
- /**
- * Scales a vec2 by a scalar number
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the vector to scale
- * @param {Number} b amount to scale the vector by
- * @returns {vec2} out
- */
- vec2.scale = function(out, a, b) {
- out[0] = a[0] * b;
- out[1] = a[1] * b;
- return out;
- };
-
- /**
- * Adds two vec2's after scaling the second operand by a scalar value
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @param {Number} scale the amount to scale b by before adding
- * @returns {vec2} out
- */
- vec2.scaleAndAdd = function(out, a, b, scale) {
- out[0] = a[0] + (b[0] * scale);
- out[1] = a[1] + (b[1] * scale);
- return out;
- };
-
- /**
- * Calculates the euclidian distance between two vec2's
- *
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {Number} distance between a and b
- */
- vec2.distance = function(a, b) {
- var x = b[0] - a[0],
- y = b[1] - a[1];
- return Math.sqrt(x*x + y*y);
- };
-
- /**
- * Alias for {@link vec2.distance}
- * @function
- */
- vec2.dist = vec2.distance;
-
- /**
- * Calculates the squared euclidian distance between two vec2's
- *
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {Number} squared distance between a and b
- */
- vec2.squaredDistance = function(a, b) {
- var x = b[0] - a[0],
- y = b[1] - a[1];
- return x*x + y*y;
- };
-
- /**
- * Alias for {@link vec2.squaredDistance}
- * @function
- */
- vec2.sqrDist = vec2.squaredDistance;
-
- /**
- * Calculates the length of a vec2
- *
- * @param {vec2} a vector to calculate length of
- * @returns {Number} length of a
- */
- vec2.length = function (a) {
- var x = a[0],
- y = a[1];
- return Math.sqrt(x*x + y*y);
- };
-
- /**
- * Alias for {@link vec2.length}
- * @function
- */
- vec2.len = vec2.length;
-
- /**
- * Calculates the squared length of a vec2
- *
- * @param {vec2} a vector to calculate squared length of
- * @returns {Number} squared length of a
- */
- vec2.squaredLength = function (a) {
- var x = a[0],
- y = a[1];
- return x*x + y*y;
- };
-
- /**
- * Alias for {@link vec2.squaredLength}
- * @function
- */
- vec2.sqrLen = vec2.squaredLength;
-
- /**
- * Negates the components of a vec2
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a vector to negate
- * @returns {vec2} out
- */
- vec2.negate = function(out, a) {
- out[0] = -a[0];
- out[1] = -a[1];
- return out;
- };
-
- /**
- * Returns the inverse of the components of a vec2
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a vector to invert
- * @returns {vec2} out
- */
- vec2.inverse = function(out, a) {
- out[0] = 1.0 / a[0];
- out[1] = 1.0 / a[1];
- return out;
- };
-
- /**
- * Normalize a vec2
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a vector to normalize
- * @returns {vec2} out
- */
- vec2.normalize = function(out, a) {
- var x = a[0],
- y = a[1];
- var len = x*x + y*y;
- if (len > 0) {
- //TODO: evaluate use of glm_invsqrt here?
- len = 1 / Math.sqrt(len);
- out[0] = a[0] * len;
- out[1] = a[1] * len;
- }
- return out;
- };
-
- /**
- * Calculates the dot product of two vec2's
- *
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {Number} dot product of a and b
- */
- vec2.dot = function (a, b) {
- return a[0] * b[0] + a[1] * b[1];
- };
-
- /**
- * Computes the cross product of two vec2's
- * Note that the cross product must by definition produce a 3D vector
- *
- * @param {vec3} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {vec3} out
- */
- vec2.cross = function(out, a, b) {
- var z = a[0] * b[1] - a[1] * b[0];
- out[0] = out[1] = 0;
- out[2] = z;
- return out;
- };
-
- /**
- * Performs a linear interpolation between two vec2's
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @param {Number} t interpolation amount between the two inputs
- * @returns {vec2} out
- */
- vec2.lerp = function (out, a, b, t) {
- var ax = a[0],
- ay = a[1];
- out[0] = ax + t * (b[0] - ax);
- out[1] = ay + t * (b[1] - ay);
- return out;
- };
-
- /**
- * Generates a random vector with the given scale
- *
- * @param {vec2} out the receiving vector
- * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
- * @returns {vec2} out
- */
- vec2.random = function (out, scale) {
- scale = scale || 1.0;
- var r = glMatrix.RANDOM() * 2.0 * Math.PI;
- out[0] = Math.cos(r) * scale;
- out[1] = Math.sin(r) * scale;
- return out;
- };
-
- /**
- * Transforms the vec2 with a mat2
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the vector to transform
- * @param {mat2} m matrix to transform with
- * @returns {vec2} out
- */
- vec2.transformMat2 = function(out, a, m) {
- var x = a[0],
- y = a[1];
- out[0] = m[0] * x + m[2] * y;
- out[1] = m[1] * x + m[3] * y;
- return out;
- };
-
- /**
- * Transforms the vec2 with a mat2d
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the vector to transform
- * @param {mat2d} m matrix to transform with
- * @returns {vec2} out
- */
- vec2.transformMat2d = function(out, a, m) {
- var x = a[0],
- y = a[1];
- out[0] = m[0] * x + m[2] * y + m[4];
- out[1] = m[1] * x + m[3] * y + m[5];
- return out;
- };
-
- /**
- * Transforms the vec2 with a mat3
- * 3rd vector component is implicitly '1'
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the vector to transform
- * @param {mat3} m matrix to transform with
- * @returns {vec2} out
- */
- vec2.transformMat3 = function(out, a, m) {
- var x = a[0],
- y = a[1];
- out[0] = m[0] * x + m[3] * y + m[6];
- out[1] = m[1] * x + m[4] * y + m[7];
- return out;
- };
-
- /**
- * Transforms the vec2 with a mat4
- * 3rd vector component is implicitly '0'
- * 4th vector component is implicitly '1'
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the vector to transform
- * @param {mat4} m matrix to transform with
- * @returns {vec2} out
- */
- vec2.transformMat4 = function(out, a, m) {
- var x = a[0],
- y = a[1];
- out[0] = m[0] * x + m[4] * y + m[12];
- out[1] = m[1] * x + m[5] * y + m[13];
- return out;
- };
-
- /**
- * Perform some operation over an array of vec2s.
- *
- * @param {Array} a the array of vectors to iterate over
- * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed
- * @param {Number} offset Number of elements to skip at the beginning of the array
- * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array
- * @param {Function} fn Function to call for each vector in the array
- * @param {Object} [arg] additional argument to pass to fn
- * @returns {Array} a
- * @function
- */
- vec2.forEach = (function() {
- var vec = vec2.create();
-
- return function(a, stride, offset, count, fn, arg) {
- var i, l;
- if(!stride) {
- stride = 2;
- }
-
- if(!offset) {
- offset = 0;
- }
-
- if(count) {
- l = Math.min((count * stride) + offset, a.length);
- } else {
- l = a.length;
- }
-
- for(i = offset; i < l; i += stride) {
- vec[0] = a[i]; vec[1] = a[i+1];
- fn(vec, vec, arg);
- a[i] = vec[0]; a[i+1] = vec[1];
- }
-
- return a;
- };
- })();
-
- /**
- * Returns a string representation of a vector
- *
- * @param {vec2} vec vector to represent as a string
- * @returns {String} string representation of the vector
- */
- vec2.str = function (a) {
- return 'vec2(' + a[0] + ', ' + a[1] + ')';
- };
-
- module.exports = vec2;
-
-
-/***/ }
-/******/ ])
-});
-; \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/allclasses.tmpl b/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/allclasses.tmpl
deleted file mode 100644
index e89da024d82..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/allclasses.tmpl
+++ /dev/null
@@ -1,14 +0,0 @@
-<div align="center">{+new Link().toFile("index.html").withText("Class Index")+}
-| {+new Link().toFile("files.html").withText("File Index")+}</div>
-<hr />
-<h2>Classes</h2>
-<ul class="classList">
- <for each="thisClass" in="data">
- <li>{!
- if (thisClass.alias != "_global_") {
- output += new Link().toClass(thisClass.alias);
- }
- !}</li>
- </for>
-</ul>
-<hr /> \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/allfiles.tmpl b/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/allfiles.tmpl
deleted file mode 100644
index c6e40c9a4fe..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/allfiles.tmpl
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="content-type" content="text/html; charset={+IO.encoding+}" />
- {! Link.base = ""; /* all generated links will be relative to this */ !}
- <title>glMatrix - File Index</title>
- <meta name="generator" content="JsDoc Toolkit" />
-
- <style type="text/css">
- {+include("static/default.css")+}
- </style>
- </head>
-
- <body>
- {+include("static/header.html")+}
-
- <div class="wrapper">
-
- <header id="index">
- {+publish.classesIndex+}
- </header>
-
- <section id="content">
- <h1 class="classTitle">File Index</h1>
-
- <for each="item" in="data">
- <div>
- <h2>{+new Link().toSrc(item.alias).withText(item.name)+}</h2>
- <if test="item.desc">{+resolveLinks(item.desc)+}</if>
- <dl>
- <if test="item.author">
- <dt class="heading">Author:</dt>
- <dd>{+item.author+}</dd>
- </if>
- <if test="item.version">
- <dt class="heading">Version:</dt>
- <dd>{+item.version+}</dd>
- </if>
- {! var locations = item.comment.getTag('location').map(function($){return $.toString().replace(/(^\$ ?| ?\$$)/g, '').replace(/^HeadURL: https:/g, 'http:');}) !}
- <if test="locations.length">
- <dt class="heading">Location:</dt>
- <for each="location" in="locations">
- <dd><a href="{+location+}">{+location+}</a></dd>
- </for>
- </if>
- </dl>
- </div>
- <hr />
- </for>
-
- </section>
-
- <footer>
- <small>
- <if test="JSDOC.opt.D.copyright">&copy;{+JSDOC.opt.D.copyright+}<br /></if>
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> {+JSDOC.VERSION+} on {+new Date()+}
- <br/><br/>
- Theme based on Github Pages template by <a href="https://github.com/orderedlist">orderedlist</a>
- </small>
- </footer>
-
- </div>
- </body>
-</html> \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/class.tmpl b/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/class.tmpl
deleted file mode 100644
index cb1d2b0f3d6..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/class.tmpl
+++ /dev/null
@@ -1,340 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="content-type" content="text/html; charset={+IO.encoding+}" />
- <meta name="generator" content="JsDoc Toolkit" />
- {! Link.base = "../"; /* all generated links will be relative to this */ !}
- <title>glMatrix - {+data.alias+}</title>
-
- <style type="text/css">
- {+include("static/default.css")+}
- </style>
- </head>
-
- <body>
-<!-- ============================== header ================================= -->
- <!-- begin static/header.html -->
- {+include("static/header.html")+}
- <!-- end static/header.html -->
-
- <div class="wrapper">
-<!-- ============================== classes index ============================ -->
- <header id="index">
- <!-- begin publish.classesIndex -->
- {+publish.classesIndex+}
- <!-- end publish.classesIndex -->
- </header>
-
- <section id="content">
-<!-- ============================== class title ============================ -->
- <h1 class="classTitle">
- {!
- var classType = "";
-
- if (data.isBuiltin()) {
- classType += "Built-In ";
- }
-
- if (data.isNamespace) {
- if (data.is('FUNCTION')) {
- classType += "Function ";
- }
- classType += "Namespace ";
- }
- else {
- classType += "Class ";
- }
- !}
- {+classType+}{+data.alias+}
- </h1>
-
-<!-- ============================== class summary ========================== -->
- <p class="description">
- <if test="data.version"><br />Version
- {+ data.version +}.<br />
- </if>
- <if test="data.augments.length"><br />Extends
- {+
- data.augments
- .sort()
- .map(
- function($) { return new Link().toSymbol($); }
- )
- .join(", ")
- +}.<br />
- </if>
-
- {+resolveLinks(data.classDesc)+}
-
- <if test="data.desc">
- <div class="description">{+resolveLinks(summarize(data.desc))+}</div>
- </if>
-
- <if test="!data.isBuiltin()">{# isn't defined in any file #}
- <br /><i>Defined in: </i> {+new Link().toSrc(data.srcFile)+}.
- </if>
- </p>
-
-<!-- ============================== properties summary ===================== -->
- <if test="data.properties.length">
- {! var ownProperties = data.properties.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !}
- <if test="ownProperties.length">
- <table class="summaryTable" cellspacing="0" summary="A summary of the fields documented in the class {+data.alias+}.">
- <caption>Field Summary</caption>
- <thead>
- <tr>
- <th scope="col">Field Attributes</th>
- <th scope="col">Field Name and Description</th>
- </tr>
- </thead>
- <tbody>
- <for each="member" in="ownProperties">
- <tr>
- <td class="attributes">{!
- if (member.isPrivate) output += "&lt;private&gt; ";
- if (member.isInner) output += "&lt;inner&gt; ";
- if (member.isStatic) output += "&lt;static&gt; ";
- if (member.isConstant) output += "&lt;constant&gt; ";
- !}&nbsp;</td>
- <td class="nameDescription">
- <div class="fixedFont">
- <if test="member.isStatic && member.memberOf != '_global_'">{+member.memberOf+}.</if><b>{+new Link().toSymbol(member.alias).withText(member.name)+}</b>
- </div>
- <div class="description">{+resolveLinks(summarize(member.desc))+}</div>
- </td>
- </tr>
- </for>
- </tbody>
- </table>
- </if>
-
- <if test="data.inheritsFrom.length">
- <dl class="inheritsList">
- {!
- var borrowedMembers = data.properties.filter(function($) {return $.memberOf != data.alias});
-
- var contributers = [];
- borrowedMembers.map(function($) {if (contributers.indexOf($.memberOf) < 0) contributers.push($.memberOf)});
- for (var i = 0, l = contributers.length; i < l; i++) {
- output +=
- "<dt>Fields borrowed from class "+new Link().toSymbol(contributers[i])+": </dt>"
- +
- "<dd>" +
- borrowedMembers
- .filter(
- function($) { return $.memberOf == contributers[i] }
- )
- .sort(makeSortby("name"))
- .map(
- function($) { return new Link().toSymbol($.alias).withText($.name) }
- )
- .join(", ")
- +
- "</dd>";
- }
- !}
- </dl>
- </if>
- </if>
-
-<!-- ============================== methods summary ======================== -->
- <if test="data.methods.length">
- {! var ownMethods = data.methods.filter(function($){return $.memberOf == data.alias && !$.isNamespace}).sort(makeSortby("name")); !}
- <if test="ownMethods.length">
- <h2>Methods</h2>
- <table class="summaryTable" cellspacing="0" summary="A summary of the methods documented in the class {+data.alias+}.">
- <tbody>
- <for each="member" in="ownMethods">
- <tr>
- <td class="nameDescription">
- <code class="fixedFont"><if test="member.isStatic && member.memberOf != '_global_'">{+member.memberOf+}.</if><b>{+new Link().toSymbol(member.alias).withText(member.name.replace(/\^\d+$/, ''))+}</b>{+makeSignature(member.params)+}
- </code>
- <div class="description">{+resolveLinks(summarize(member.desc))+}</div>
- </td>
- </tr>
- </for>
- </tbody>
- </table>
- </if>
- </if>
-
-<!-- ============================== field details ========================== -->
- <if test="defined(ownProperties) && ownProperties.length">
- <div class="sectionTitle">
- Field Detail
- </div>
- <for each="member" in="ownProperties">
- <a name="{+Link.symbolNameToLinkName(member)+}"> </a>
- <div class="fixedFont">{!
- if (member.isPrivate) output += "&lt;private&gt; ";
- if (member.isInner) output += "&lt;inner&gt; ";
- if (member.isStatic) output += "&lt;static&gt; ";
- if (member.isConstant) output += "&lt;constant&gt; ";
- !}
-
- <if test="member.type"><span class="light">{{+new Link().toSymbol(member.type)+}}</span></if>
- <if test="member.isStatic && member.memberOf != '_global_'"><span class="light">{+member.memberOf+}.</span></if><b>{+member.name+}</b>
-
- </div>
- <div class="description">
- {+resolveLinks(member.desc)+}
- <if test="member.srcFile != data.srcFile">
- <br />
- <i>Defined in: </i> {+new Link().toSrc(member.srcFile)+}.
- </if>
- <if test="member.author"><br /><i>Author: </i>{+member.author+}.</if>
- </div>
-
- <if test="member.example.length">
- <for each="example" in="member.example">
- <pre class="code">{+example+}</pre>
- </for>
- </if>
-
- <if test="member.deprecated">
- <dl class="detailList">
- <dt class="heading">Deprecated:</dt>
- <dt>
- {+ resolveLinks(member.deprecated) +}
- </dt>
- </dl>
- </if>
- <if test="member.since">
- <dl class="detailList">
- <dt class="heading">Since:</dt>
- <dd>{+ member.since +}</dd>
- </dl>
- </if>
- <if test="member.see.length">
- <dl class="detailList">
- <dt class="heading">See:</dt>
- <for each="item" in="member.see">
- <dd>{+ new Link().toSymbol(item) +}</dd>
- </for>
- </dl>
- </if>
- <if test="member.defaultValue">
- <dl class="detailList">
- <dt class="heading">Default Value:</dt>
- <dd>
- {+resolveLinks(member.defaultValue)+}
- </dd>
- </dl>
- </if>
-
- <if test="!$member_last"><hr /></if>
- </for>
- </if>
-
-<!-- ============================== method details ========================= -->
- <if test="defined(ownMethods) && ownMethods.length">
- <h2>Method Detail</h2>
- <for each="member" in="ownMethods">
- <a name="{+Link.symbolNameToLinkName(member)+}"> </a>
- <h3 class="fixedFont">
- <if test="member.type"><span class="light">{{+new Link().toSymbol(member.type)+}}</span></if>
- <if test="member.isStatic && member.memberOf != '_global_'"><span class="light">{+member.memberOf+}.</span></if><b>{+member.name.replace(/\^\d+$/, '')+}</b>{+makeSignature(member.params)+}
- </h3>
-
- <div style="margin-left: 1em;">
- <p class="description">
- {+resolveLinks(member.desc)+}
- <if test="member.srcFile != data.srcFile">
- <br />
- <i>Defined in: </i> {+new Link().toSrc(member.srcFile)+}.
- </if>
- <if test="member.author"><br /><i>Author: </i>{+member.author+}.</if>
- </p>
-
- <if test="member.example.length">
- <for each="example" in="member.example">
- <pre class="code">{+example+}</pre>
- </for>
- </if>
-
- <if test="member.params.length">
- <dl class="detailList">
- <dt class="heading">Parameters:</dt>
- <for each="item" in="member.params">
- <dt>
- {+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+}<b>{+item.name+}</b>
- <if test="item.isOptional"><i>Optional<if test="item.defaultValue">, Default: {+item.defaultValue+}</if></i></if>
- </dt>
- <dd>{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="member.deprecated">
- <dl class="detailList">
- <dt class="heading">Deprecated:</dt>
- <dt>
- {+ resolveLinks(member.deprecated) +}
- </dt>
- </dl>
- </if>
- <if test="member.since">
- <dl class="detailList">
- <dt class="heading">Since:</dt>
- <dd>{+ member.since +}</dd>
- </dl>
- </dl>
- </if>
- <if test="member.exceptions.length">
- <dl class="detailList">
- <dt class="heading">Throws:</dt>
- <for each="item" in="member.exceptions">
- <dt>
- {+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+} <b>{+item.name+}</b>
- </dt>
- <dd>{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="member.returns.length">
- <dl class="detailList">
- <dt class="heading">Returns:</dt>
- <for each="item" in="member.returns">
- <dd>{+((item.type)?"<span class=\"light fixedFont\">{"+(new Link().toSymbol(item.type))+"}</span> " : "")+}{+resolveLinks(item.desc)+}</dd>
- </for>
- </dl>
- </if>
- <if test="member.requires.length">
- <dl class="detailList">
- <dt class="heading">Requires:</dt>
- <for each="item" in="member.requires">
- <dd>{+ resolveLinks(item) +}</dd>
- </for>
- </dl>
- </if>
- <if test="member.see.length">
- <dl class="detailList">
- <dt class="heading">See:</dt>
- <for each="item" in="member.see">
- <dd>{+ new Link().toSymbol(item) +}</dd>
- </for>
- </dl>
- </if>
-
- <if test="!$member_last"><hr /></if>
- </div>
- </for>
- </if>
-
- <hr />
- </section>
-
-
-<!-- ============================== footer ================================= -->
- <footer>
- <small>
- <if test="JSDOC.opt.D.copyright">&copy;{+JSDOC.opt.D.copyright+}<br /></if>
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> {+JSDOC.VERSION+} on {+new Date()+}
- <br/><br/>
- Theme based on Github Pages template by <a href="https://github.com/orderedlist">orderedlist</a>
- </small>
- </footer>
-
- </div>
- </body>
-</html>
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/index.tmpl b/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/index.tmpl
deleted file mode 100644
index 7c92dd40ccd..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/index.tmpl
+++ /dev/null
@@ -1,52 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="content-type" content="text/html; charset={+IO.encoding+}" />
-
- <title>glMatrix - Index</title>
- <meta name="generator" content="JsDoc Toolkit" />
-
- <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
-
- <style type="text/css">
- {+include("static/default.css")+}
- </style>
- </head>
-
- <body>
- {+include("static/header.html")+}
-
- <div class="wrapper">
-
- <header id="index">
- {+publish.classesIndex+}
- </header>
-
- <section id="content">
- <h1 class="classTitle">Class Index</h1>
-
- <for each="thisClass" in="data">
- <if test="thisClass.alias != '_global_'">
- <div>
- <h2>{+(new Link().toSymbol(thisClass.alias))+}</h2>
- {+resolveLinks(summarize(thisClass.classDesc))+}
- </div>
- <hr />
- </if>
- </for>
-
- </section>
-
- <footer>
- <small>
- <if test="JSDOC.opt.D.copyright">&copy;{+JSDOC.opt.D.copyright+}<br /></if>
- Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blank">JsDoc Toolkit</a> {+JSDOC.VERSION+} on {+new Date()+}
- <br/><br/>
- Theme based on Github Pages template by <a href="https://github.com/orderedlist">orderedlist</a>
- </small>
- </footer>
-
- </div>
- </body>
-</html> \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/publish.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/publish.js
deleted file mode 100644
index 82c20045e94..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/publish.js
+++ /dev/null
@@ -1,201 +0,0 @@
-/** Called automatically by JsDoc Toolkit. */
-function publish(symbolSet) {
- publish.conf = { // trailing slash expected for dirs
- ext: ".html",
- outDir: JSDOC.opt.d || SYS.pwd+"../out/jsdoc/",
- templatesDir: JSDOC.opt.t || SYS.pwd+"../jsdoc-template/",
- symbolsDir: "symbols/",
- srcDir: "symbols/src/"
- };
-
- // is source output is suppressed, just display the links to the source file
- if (JSDOC.opt.s && defined(Link) && Link.prototype._makeSrcLink) {
- Link.prototype._makeSrcLink = function(srcFilePath) {
- return "&lt;"+srcFilePath+"&gt;";
- }
- }
-
- // create the folders and subfolders to hold the output
- IO.mkPath((publish.conf.outDir+"symbols/src").split("/"));
-
- // used to allow Link to check the details of things being linked to
- Link.symbolSet = symbolSet;
-
- // create the required templates
- try {
- var classTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"class.tmpl");
- var classesTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allclasses.tmpl");
- }
- catch(e) {
- print("Couldn't create the required templates: "+e);
- quit();
- }
-
- // some ustility filters
- function hasNoParent($) {return ($.memberOf == "")}
- function isaFile($) {return ($.is("FILE"))}
- function isaClass($) {return ($.is("CONSTRUCTOR") || $.isNamespace)}
-
- // get an array version of the symbolset, useful for filtering
- var symbols = symbolSet.toArray();
-
- // create the hilited source code files
- var files = JSDOC.opt.srcFiles;
- for (var i = 0, l = files.length; i < l; i++) {
- var file = files[i];
- var srcDir = publish.conf.outDir + "symbols/src/";
- makeSrcFile(file, srcDir);
- }
-
- // get a list of all the classes in the symbolset
- var classes = symbols.filter(isaClass).sort(makeSortby("alias"));
-
- // create a filemap in which outfiles must be to be named uniquely, ignoring case
- if (JSDOC.opt.u) {
- var filemapCounts = {};
- Link.filemap = {};
- for (var i = 0, l = classes.length; i < l; i++) {
- var lcAlias = classes[i].alias.toLowerCase();
-
- if (!filemapCounts[lcAlias]) filemapCounts[lcAlias] = 1;
- else filemapCounts[lcAlias]++;
-
- Link.filemap[classes[i].alias] =
- (filemapCounts[lcAlias] > 1)?
- lcAlias+"_"+filemapCounts[lcAlias] : lcAlias;
- }
- }
-
- // create a class index, displayed in the left-hand column of every class page
- Link.base = "../";
- publish.classesIndex = classesTemplate.process(classes); // kept in memory
-
- // create each of the class pages
- for (var i = 0, l = classes.length; i < l; i++) {
- var symbol = classes[i];
-
- symbol.events = symbol.getEvents(); // 1 order matters
- symbol.methods = symbol.getMethods(); // 2
-
- Link.currentSymbol= symbol;
- var output = "";
- output = classTemplate.process(symbol);
-
- IO.saveFile(publish.conf.outDir+"symbols/", ((JSDOC.opt.u)? Link.filemap[symbol.alias] : symbol.alias) + publish.conf.ext, output);
- }
-
- // regenerate the index with different relative links, used in the index pages
- Link.base = "";
- publish.classesIndex = classesTemplate.process(classes);
-
- // create the class index page
- try {
- var classesindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"index.tmpl");
- }
- catch(e) { print(e.message); quit(); }
-
- var classesIndex = classesindexTemplate.process(classes);
- IO.saveFile(publish.conf.outDir, "index"+publish.conf.ext, classesIndex);
- classesindexTemplate = classesIndex = classes = null;
-
- // create the file index page
- try {
- var fileindexTemplate = new JSDOC.JsPlate(publish.conf.templatesDir+"allfiles.tmpl");
- }
- catch(e) { print(e.message); quit(); }
-
- var documentedFiles = symbols.filter(isaFile); // files that have file-level docs
- var allFiles = []; // not all files have file-level docs, but we need to list every one
-
- for (var i = 0; i < files.length; i++) {
- allFiles.push(new JSDOC.Symbol(files[i], [], "FILE", new JSDOC.DocComment("/** */")));
- }
-
- for (var i = 0; i < documentedFiles.length; i++) {
- var offset = files.indexOf(documentedFiles[i].alias);
- allFiles[offset] = documentedFiles[i];
- }
-
- allFiles = allFiles.sort(makeSortby("name"));
-
- // output the file index page
- var filesIndex = fileindexTemplate.process(allFiles);
- IO.saveFile(publish.conf.outDir, "files"+publish.conf.ext, filesIndex);
- fileindexTemplate = filesIndex = files = null;
-}
-
-
-/** Just the first sentence (up to a full stop). Should not break on dotted variable names. */
-function summarize(desc) {
- if (typeof desc != "undefined")
- return desc.match(/([\w\W]+?\.)[^a-z0-9_$]/i)? RegExp.$1 : desc;
-}
-
-/** Make a symbol sorter by some attribute. */
-function makeSortby(attribute) {
- return function(a, b) {
- if (a[attribute] != undefined && b[attribute] != undefined) {
- a = a[attribute].toLowerCase();
- b = b[attribute].toLowerCase();
- if (a < b) return -1;
- if (a > b) return 1;
- return 0;
- }
- }
-}
-
-/** Pull in the contents of an external file at the given path. */
-function include(path) {
- var path = publish.conf.templatesDir+path;
- return IO.readFile(path);
-}
-
-/** Turn a raw source file into a code-hilited page in the docs. */
-function makeSrcFile(path, srcDir, name) {
- if (JSDOC.opt.s) return;
-
- if (!name) {
- name = path.replace(/\.\.?[\\\/]/g, "").replace(/[\\\/]/g, "_");
- name = name.replace(/\:/g, "_");
- }
-
- var src = {path: path, name:name, charset: IO.encoding, hilited: ""};
-
- if (defined(JSDOC.PluginManager)) {
- JSDOC.PluginManager.run("onPublishSrc", src);
- }
-
- if (src.hilited) {
- IO.saveFile(srcDir, name+publish.conf.ext, src.hilited);
- }
-}
-
-/** Build output for displaying function parameters. */
-function makeSignature(params) {
- if (!params) return "()";
- var signature = "("
- +
- params.filter(
- function($) {
- return $.name.indexOf(".") == -1; // don't show config params in signature
- }
- ).map(
- function($) {
- return $.name;
- }
- ).join(", ")
- +
- ")";
- return signature;
-}
-
-/** Find symbol {@link ...} strings in text and turn into html links */
-function resolveLinks(str, from) {
- str = str.replace(/\{@link ([^} ]+) ?\}/gi,
- function(match, symbolName) {
- return new Link().toSymbol(symbolName);
- }
- );
-
- return str;
-}
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/static/default.css b/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/static/default.css
deleted file mode 100644
index efcf7827133..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/static/default.css
+++ /dev/null
@@ -1,428 +0,0 @@
-/* default.css */
-
-/*
-
-body
-{
- font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
- width: 800px;
-}
-
-.header
-{
- clear: both;
- background-color: #ccc;
- padding: 8px;
-}
-
-h1
-{
- font-size: 150%;
- font-weight: bold;
- padding: 0;
- margin: 1em 0 0 .3em;
-}
-
-hr
-{
- border: none 0;
- border-top: 1px solid #7F8FB1;
- height: 1px;
-}
-
-pre.code
-{
- display: block;
- padding: 8px;
- border: 1px dashed #ccc;
-}
-
-#index
-{
- margin-top: 24px;
- float: left;
- width: 160px;
- position: absolute;
- left: 8px;
- background-color: #F3F3F3;
- padding: 8px;
-}
-
-#content
-{
- margin-left: 190px;
- width: 600px;
-}
-
-.classList
-{
- list-style-type: none;
- padding: 0;
- margin: 0 0 0 8px;
- font-family: arial, sans-serif;
- font-size: 1em;
- overflow: auto;
-}
-
-.classList li
-{
- padding: 0;
- margin: 0 0 8px 0;
-}
-
-.summaryTable { width: 100%; }
-
-h1.classTitle
-{
- font-size:170%;
- line-height:130%;
-}
-
-h2 { font-size: 110%; }
-caption, div.sectionTitle
-{
- background-color: #7F8FB1;
- color: #fff;
- font-size:130%;
- text-align: left;
- padding: 2px 6px 2px 6px;
- border: 1px #7F8FB1 solid;
-}
-
-div.sectionTitle { margin-bottom: 8px; }
-.summaryTable thead { display: none; }
-
-.summaryTable td
-{
- vertical-align: top;
- padding: 4px;
- border-bottom: 1px #7F8FB1 solid;
- border-right: 1px #7F8FB1 solid;
- border-left: 1px #7F8FB1 solid;
-}
-
-.summaryTable td.attributes
-{
- border-left: 1px #7F8FB1 solid;
- width: 140px;
- text-align: right;
-}
-
-td.attributes, .fixedFont
-{
- line-height: 15px;
- color: #002EBE;
- font-family: "Courier New",Courier,monospace;
- font-size: 13px;
-}
-
-.summaryTable td.nameDescription
-{
- text-align: left;
- font-size: 13px;
- line-height: 15px;
-}
-
-.summaryTable td.nameDescription, .description
-{
- line-height: 15px;
- padding: 4px;
- padding-left: 4px;
-}
-
-.summaryTable { margin-bottom: 8px; }
-
-ul.inheritsList
-{
- list-style: square;
- margin-left: 20px;
- padding-left: 0;
-}
-
-.detailList {
- margin-left: 20px;
- line-height: 15px;
-}
-.detailList dt { margin-left: 20px; }
-
-.detailList .heading
-{
- font-weight: bold;
- padding-bottom: 6px;
- margin-left: 0;
-}
-
-.light, td.attributes, .light a:link, .light a:visited
-{
- color: #777;
- font-style: italic;
-}
-
-.fineprint
-{
- text-align: right;
- font-size: 10px;
-}
-
-*/
-
-/* Copied from styles.css generated by Github Pages */
-
-@import url(https://fonts.googleapis.com/css?family=Lato:300italic,700italic,300,700);
-
-body {
- padding:50px;
- font:14px/1.5 Lato, "Helvetica Neue", Helvetica, Arial, sans-serif;
- color:#777;
- font-weight:300;
-}
-
-h1, h2, h3, h4, h5, h6 {
- color:#222;
- margin:0 0 20px;
-}
-
-p, ul, ol, table, pre, dl {
- margin:0 0 20px;
-}
-
-h1, h2, h3 {
- line-height:1.1;
-}
-
-h1 {
- font-size:28px;
-}
-
-h2 {
- color:#393939;
-}
-
-h3, h4, h5, h6 {
- color:#494949;
-}
-
-a {
- color:#39c;
- font-weight:400;
- text-decoration:none;
-}
-
-a small {
- font-size:11px;
- color:#777;
- margin-top:-0.6em;
- display:block;
-}
-
-.wrapper {
- width:860px;
- margin:0 auto;
-}
-
-blockquote {
- border-left:1px solid #e5e5e5;
- margin:0;
- padding:0 0 0 20px;
- font-style:italic;
-}
-
-code, pre {
- font-family:Monaco, Bitstream Vera Sans Mono, Lucida Console, Terminal;
- color:#333;
- font-size:12px;
-}
-
-pre {
- padding:8px 15px;
- background: #f8f8f8;
- border-radius:5px;
- border:1px solid #e5e5e5;
- overflow-x: auto;
-}
-
-table {
- width:100%;
- border-collapse:collapse;
-}
-
-th, td {
- text-align:left;
- padding:5px 10px;
- border-bottom:1px solid #e5e5e5;
-}
-
-dt {
- color:#444;
- font-weight:700;
-}
-
-th {
- color:#444;
-}
-
-img {
- max-width:100%;
-}
-
-header {
- width:270px;
- float:left;
- position:fixed;
-}
-
-header ul {
- list-style:none;
- padding:0;
-
- /*background: #eee;
- background: -moz-linear-gradient(top, #f8f8f8 0%, #dddddd 100%);
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#dddddd));
- background: -webkit-linear-gradient(top, #f8f8f8 0%,#dddddd 100%);
- background: -o-linear-gradient(top, #f8f8f8 0%,#dddddd 100%);
- background: -ms-linear-gradient(top, #f8f8f8 0%,#dddddd 100%);
- background: linear-gradient(top, #f8f8f8 0%,#dddddd 100%);
-
- border-radius:5px;
- border:1px solid #d2d2d2;
- box-shadow:inset #fff 0 1px 0, inset rgba(0,0,0,0.03) 0 -1px 0;*/
- width:270px;
-}
-
-header li {
- width:89px;
- /*float:left;
- border-right:1px solid #d2d2d2;
- height:40px;*/
-}
-
-header ul a {
- line-height:1;
- font-size:11px;
- color:#999;
- display:block;
- text-align:center;
- padding-top:6px;
- /*height:40px;*/
-}
-
-strong {
- color:#222;
- font-weight:700;
-}
-
-/*header ul li + li {
- width:88px;
- border-left:1px solid #fff;
-}
-
-header ul li + li + li {
- border-right:none;
- width:89px;
-}*/
-
-header ul a strong {
- font-size:14px;
- display:block;
- color:#222;
-}
-
-section {
- width:500px;
- float:right;
- padding-bottom:50px;
-}
-
-small {
- font-size:11px;
-}
-
-hr {
- border:0;
- background:#e5e5e5;
- height:1px;
- margin:0 0 20px;
-}
-
-footer {
- width:270px;
- float:left;
- position:fixed;
- bottom:50px;
-}
-
-@media print, screen and (max-width: 960px) {
-
- div.wrapper {
- width:auto;
- margin:0;
- }
-
- header, section, footer {
- float:none;
- position:static;
- width:auto;
- }
-
- header {
- /*padding-right:320px;*/
- padding: 0;
- }
-
- section {
- border:1px solid #e5e5e5;
- border-width:1px 0;
- padding:20px 0;
- margin:0 0 20px;
- }
-
- header a small {
- display:inline;
- }
-
- header ul {
- position:static;
- height:40px;
- width: auto;
- }
-
- header ul li {
- float: left;
- }
-}
-
-@media print, screen and (max-width: 720px) {
- body {
- word-wrap:break-word;
- }
-
- header {
- padding:0;
- }
-
- header ul, header p.view {
- position:static;
- }
-
- pre, code {
- word-wrap:normal;
- }
-}
-
-@media print, screen and (max-width: 480px) {
- body {
- padding:15px;
- }
-
- /*header ul {
- display:none;
- }*/
-}
-
-@media print {
- body {
- padding:0.4in;
- font-size:12pt;
- color:#444;
- }
-}
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/static/header.html b/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/static/header.html
deleted file mode 100644
index 353b735a4ca..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/static/header.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<div id="header">
-</div> \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/static/index.html b/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/static/index.html
deleted file mode 100644
index d51d4efaa15..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/static/index.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="content-type" content="text/html; charset=utf-8" />
- <title>glMatrix Documentation</title>
-</head>
-<frameset cols="20%,80%">
- <frame src="allclasses-frame.html" name="packageFrame" />
- <frame src="splash.html" name="classFrame" />
- <noframes>
- <body>
- <p>
- This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
- </p>
- </body>
- </noframes>
-</frameset>
-</html> \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/symbol.tmpl b/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/symbol.tmpl
deleted file mode 100644
index f8f4bd1f6f2..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/jsdoc-template/symbol.tmpl
+++ /dev/null
@@ -1,35 +0,0 @@
-<symbol alias="{+data.alias+}">
- <name>{+data.name+}</name>
- <memberOf>{+data.memberOf+}</memberOf>
- <isStatic>{+data.isStatic+}</isStatic>
- <isa>{+data.isa+}</isa>
- <desc>{+data.desc+}</desc>
- <classDesc>{+data.classDesc+}</classDesc>
-
- <methods><for each="method" in="data.methods">
- <method>
- <name>{+method.name+}</name>
- <memberOf>{+method.memberOf+}</memberOf>
- <isStatic>{+method.isStatic+}</isStatic>
- <desc>{+method.desc+}</desc>
- <params><for each="param" in="method.params">
- <param>
- <type>{+param.type+}</type>
- <name>{+param.name+}</name>
- <desc>{+param.desc+}</desc>
- <defaultValue>{+param.defaultValue+}</defaultValue>
- </param></for>
- </params>
- </method></for>
- </methods>
-
- <properties><for each="property" in="data.properties">
- <property>
- <name>{+property.name+}</name>
- <memberOf>{+property.memberOf+}</memberOf>
- <isStatic>{+property.isStatic+}</isStatic>
- <desc>{+property.desc+}</desc>
- <type>{+property.type+}</type>
- </property></for>
- </properties>
-</symbol>
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/package.json b/chromium/third_party/catapult/tracing/third_party/gl-matrix/package.json
deleted file mode 100644
index f92ab7d2083..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/package.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "name": "gl-matrix",
- "description": "Javascript Matrix and Vector library for High Performance WebGL apps",
- "version": "2.3.1",
- "main": "src/gl-matrix.js",
- "homepage": "http://glmatrix.net",
- "bugs": {
- "url": "https://github.com/toji/gl-matrix/issues"
- },
- "repository": {
- "type": "git",
- "url": "https://github.com/toji/gl-matrix.git"
- },
- "contributors": [
- {
- "name": "Brandon Jones",
- "email": "tojiro@gmail.com"
- },
- {
- "name": "Colin MacKenzie IV",
- "email": "sinisterchipmunk@gmail.com"
- }
- ],
- "devDependencies": {
- "jasmine-node": "1.2.2",
- "node-libs-browser": "^0.5.2",
- "webpack": "^1.9.10"
- },
- "license": "MIT"
-}
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/common-spec.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/common-spec.js
deleted file mode 100644
index b6649d09587..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/common-spec.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
-* common.js unit test
-*/
-
-describe("glMatrix", function(){
- var result;
-
- var glMatrix = require("../../src/gl-matrix/common.js");
-
- describe("toRadian", function(){
- beforeEach(function(){ result = glMatrix.toRadian(180); });
- it("should return a value of 3.141592654(Math.PI)", function(){ expect(result).toBeEqualish(Math.PI); });
- });
-});
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat2-spec.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat2-spec.js
deleted file mode 100644
index e901d332a6c..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat2-spec.js
+++ /dev/null
@@ -1,210 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-describe("mat2", function() {
- var mat2 = require("../../src/gl-matrix/mat2.js");
-
- var out, matA, matB, identity, result;
-
- beforeEach(function() {
- matA = [1, 2,
- 3, 4];
-
- matB = [5, 6,
- 7, 8];
-
- out = [0, 0,
- 0, 0];
-
- identity = [1, 0,
- 0, 1];
- });
-
- describe("create", function() {
- beforeEach(function() { result = mat2.create(); });
- it("should return a 4 element array initialized to a 2x2 identity matrix", function() { expect(result).toBeEqualish(identity); });
- });
-
- describe("clone", function() {
- beforeEach(function() { result = mat2.clone(matA); });
- it("should return a 4 element array initialized to the values in matA", function() { expect(result).toBeEqualish(matA); });
- });
-
- describe("copy", function() {
- beforeEach(function() { result = mat2.copy(out, matA); });
- it("should place values into out", function() { expect(out).toBeEqualish(matA); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("identity", function() {
- beforeEach(function() { result = mat2.identity(out); });
- it("should place values into out", function() { expect(result).toBeEqualish(identity); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("transpose", function() {
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat2.transpose(out, matA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([1, 3, 2, 4]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat2.transpose(matA, matA); });
-
- it("should place values into matA", function() { expect(matA).toBeEqualish([1, 3, 2, 4]); });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("invert", function() {
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat2.invert(out, matA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([-2, 1, 1.5, -0.5]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat2.invert(matA, matA); });
-
- it("should place values into matA", function() { expect(matA).toBeEqualish([-2, 1, 1.5, -0.5]); });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("adjoint", function() {
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat2.adjoint(out, matA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([4, -2, -3, 1]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat2.adjoint(matA, matA); });
-
- it("should place values into matA", function() { expect(matA).toBeEqualish([4, -2, -3, 1]); });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("determinant", function() {
- beforeEach(function() { result = mat2.determinant(matA); });
-
- it("should return the determinant", function() { expect(result).toEqual(-2); });
- });
-
- describe("multiply", function() {
- it("should have an alias called 'mul'", function() { expect(mat2.mul).toEqual(mat2.multiply); });
-
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat2.multiply(out, matA, matB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([23, 34, 31, 46]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4]); });
- it("should not modify matB", function() { expect(matB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat2.multiply(matA, matA, matB); });
-
- it("should place values into matA", function() { expect(matA).toBeEqualish([23, 34, 31, 46]); });
- it("should return matA", function() { expect(result).toBe(matA); });
- it("should not modify matB", function() { expect(matB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when matB is the output matrix", function() {
- beforeEach(function() { result = mat2.multiply(matB, matA, matB); });
-
- it("should place values into matB", function() { expect(matB).toBeEqualish([23, 34, 31, 46]); });
- it("should return matB", function() { expect(result).toBe(matB); });
- it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4]); });
- });
- });
-
- describe("rotate", function() {
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat2.rotate(out, matA, Math.PI * 0.5); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([3, 4, -1, -2]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat2.rotate(matA, matA, Math.PI * 0.5); });
-
- it("should place values into matA", function() { expect(matA).toBeEqualish([3, 4, -1, -2]); });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("scale", function() {
- var vecA;
- beforeEach(function() { vecA = [2, 3]; });
-
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat2.scale(out, matA, vecA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([2, 4, 9, 12]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat2.scale(matA, matA, vecA); });
-
- it("should place values into matA", function() { expect(matA).toBeEqualish([2, 4, 9, 12]); });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("str", function() {
- beforeEach(function() { result = mat2.str(matA); });
-
- it("should return a string representation of the matrix", function() { expect(result).toEqual("mat2(1, 2, 3, 4)"); });
- });
-
- describe("frob", function() {
- beforeEach(function() { result = mat2.frob(matA); });
- it("should return the Frobenius Norm of the matrix", function() { expect(result).toEqual( Math.sqrt(Math.pow(1, 2) + Math.pow(2, 2) + Math.pow(3, 2) + Math.pow(4, 2))); });
- });
-
- describe("LDU", function() {
- beforeEach(function() {L = mat2.create(); D = mat2.create(); U = mat2.create(); result = mat2.LDU(L, D, U, [4,3,6,3]);
- L_result = mat2.create(); L_result[2] = 1.5;
- D_result = mat2.create();
- U_result = mat2.create();
- U_result[0] = 4; U_result[1] = 3; U_result[3] = -1.5;
- });
- it("should return a lower triangular, a diagonal and an upper triangular matrix", function() {
- expect(result[0]).toBeEqualish(L_result);
- expect(result[1]).toBeEqualish(D_result);
- expect(result[2]).toBeEqualish(U_result);
- });
- });
-
-});
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat2d-spec.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat2d-spec.js
deleted file mode 100644
index dda0ddd6bc2..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat2d-spec.js
+++ /dev/null
@@ -1,194 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-describe("mat2d", function() {
- var mat2d = require("../../src/gl-matrix/mat2d.js");
-
- var out, matA, matB, identity, result;
-
- beforeEach(function() {
- matA = [1, 2,
- 3, 4,
- 5, 6];
-
- oldA = [1, 2,
- 3, 4,
- 5, 6];
-
- matB = [7, 8,
- 9, 10,
- 11, 12];
-
- oldB = [7, 8,
- 9, 10,
- 11, 12];
-
- out = [0, 0,
- 0, 0,
- 0, 0];
-
- identity = [1, 0,
- 0, 1,
- 0, 0];
- });
-
- describe("create", function() {
- beforeEach(function() { result = mat2d.create(); });
- it("should return a 6 element array initialized to a 2x3 identity matrix", function() { expect(result).toBeEqualish(identity); });
- });
-
- describe("clone", function() {
- beforeEach(function() { result = mat2d.clone(matA); });
- it("should return a 6 element array initialized to the values in matA", function() { expect(result).toBeEqualish(matA); });
- });
-
- describe("copy", function() {
- beforeEach(function() { result = mat2d.copy(out, matA); });
- it("should place values into out", function() { expect(out).toBeEqualish(matA); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("identity", function() {
- beforeEach(function() { result = mat2d.identity(out); });
- it("should place values into out", function() { expect(result).toBeEqualish(identity); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("invert", function() {
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat2d.invert(out, matA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([ -2, 1, 1.5, -0.5, 1, -2 ]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat2d.invert(matA, matA); });
-
- it("should place values into matA", function() { expect(matA).toBeEqualish([ -2, 1, 1.5, -0.5, 1, -2 ]); });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("determinant", function() {
- beforeEach(function() { result = mat2d.determinant(matA); });
-
- it("should return the determinant", function() { expect(result).toEqual(-2); });
- });
-
- describe("multiply", function() {
- it("should have an alias called 'mul'", function() { expect(mat2d.mul).toEqual(mat2d.multiply); });
-
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat2d.multiply(out, matA, matB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([31, 46, 39, 58, 52, 76]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
- it("should not modify matB", function() { expect(matB).toBeEqualish(oldB); });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat2d.multiply(matA, matA, matB); });
-
- it("should place values into matA", function() { expect(matA).toBeEqualish([31, 46, 39, 58, 52, 76]); });
- it("should return matA", function() { expect(result).toBe(matA); });
- it("should not modify matB", function() { expect(matB).toBeEqualish(oldB); });
- });
-
- describe("when matB is the output matrix", function() {
- beforeEach(function() { result = mat2d.multiply(matB, matA, matB); });
-
- it("should place values into matB", function() { expect(matB).toBeEqualish([31, 46, 39, 58, 52, 76]); });
- it("should return matB", function() { expect(result).toBe(matB); });
- it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
- });
- });
-
- describe("rotate", function() {
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat2d.rotate(out, matA, Math.PI * 0.5); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([3, 4, -1, -2, 5, 6]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat2d.rotate(matA, matA, Math.PI * 0.5); });
-
- it("should place values into matA", function() { expect(matA).toBeEqualish([3, 4, -1, -2, 5, 6]); });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("scale", function() {
- var vecA;
- beforeEach(function() { vecA = [2, 3]; });
-
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat2d.scale(out, matA, vecA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([2, 4, 9, 12, 5, 6]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat2d.scale(matA, matA, vecA); });
-
- it("should place values into matA", function() { expect(matA).toBeEqualish([2, 4, 9, 12, 5, 6]); });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("translate", function() {
- var vecA;
- beforeEach(function() { vecA = [2, 3]; });
-
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat2d.translate(out, matA, vecA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([1, 2, 3, 4, 16, 22]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat2d.translate(matA, matA, vecA); });
-
- it("should place values into matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4, 16, 22]); });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("str", function() {
- beforeEach(function() { result = mat2d.str(matA); });
-
- it("should return a string representation of the matrix", function() { expect(result).toEqual("mat2d(1, 2, 3, 4, 5, 6)"); });
- });
-
- describe("frob", function() {
- beforeEach(function() { result = mat2d.frob(matA); });
- it("should return the Frobenius Norm of the matrix", function() { expect(result).toEqual( Math.sqrt(Math.pow(1, 2) + Math.pow(2, 2) + Math.pow(3, 2) + Math.pow(4, 2) + Math.pow(5, 2) + Math.pow(6, 2) + 1)); });
- });
-
-});
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat3-spec.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat3-spec.js
deleted file mode 100644
index 9a9d55a71de..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat3-spec.js
+++ /dev/null
@@ -1,347 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-describe("mat3", function() {
- var mat3 = require("../../src/gl-matrix/mat3.js");
- var mat4 = require("../../src/gl-matrix/mat4.js");
- var vec3 = require("../../src/gl-matrix/vec3.js");
-
- var out, matA, matB, identity, result;
-
- beforeEach(function() {
- matA = [1, 0, 0,
- 0, 1, 0,
- 1, 2, 1];
-
- matB = [1, 0, 0,
- 0, 1, 0,
- 3, 4, 1];
-
- out = [0, 0, 0,
- 0, 0, 0,
- 0, 0, 0];
-
- identity = [1, 0, 0,
- 0, 1, 0,
- 0, 0, 1];
- });
-
- describe("normalFromMat4", function() {
- beforeEach(function() {
- matA = [1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1];
- result = mat3.normalFromMat4(out, matA);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
-
- describe("with translation and rotation", function() {
- beforeEach(function() {
- mat4.translate(matA, matA, [2, 4, 6]);
- mat4.rotateX(matA, matA, Math.PI / 2);
-
- result = mat3.normalFromMat4(out, matA);
- });
-
- it("should give rotated matrix", function() {
- expect(result).toBeEqualish([1, 0, 0,
- 0, 0, 1,
- 0,-1, 0]);
- });
-
- describe("and scale", function() {
- beforeEach(function() {
- mat4.scale(matA, matA, [2, 3, 4]);
-
- result = mat3.normalFromMat4(out, matA);
- });
-
- it("should give rotated matrix", function() {
- expect(result).toBeEqualish([0.5, 0, 0,
- 0, 0, 0.333333,
- 0, -0.25, 0]);
- });
- });
- });
- });
-
- describe("fromQuat", function() {
- var q;
-
- beforeEach(function() {
- q = [ 0, -0.7071067811865475, 0, 0.7071067811865475 ];
- result = mat3.fromQuat(out, q);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
-
- it("should rotate a vector the same as the original quat", function() {
- expect(vec3.transformMat3([], [0,0,-1], out)).toBeEqualish(vec3.transformQuat([], [0,0,-1], q));
- });
-
- it("should rotate a vector by PI/2 radians", function() {
- expect(vec3.transformMat3([], [0,0,-1], out)).toBeEqualish([1,0,0]);
- });
- });
-
- describe("fromMat4", function() {
- beforeEach(function() {
- result = mat3.fromMat4(out, [ 1, 2, 3, 4,
- 5, 6, 7, 8,
- 9,10,11,12,
- 13,14,15,16]); });
-
- it("should return out", function() { expect(result).toBe(out); });
-
- it("should calculate proper mat3", function() {
- expect(out).toBeEqualish([ 1, 2, 3,
- 5, 6, 7,
- 9,10,11]);
- });
- });
-
- describe("scale", function() {
- beforeEach(function() { result = mat3.scale(out, matA, [2,2]); });
- it("should return out", function() { expect(result).toBe(out); });
- it('should place proper values in out', function() {
- expect(out).toBeEqualish([ 2, 0, 0,
- 0, 2, 0,
- 1, 2, 1 ]);
- });
- });
-
- describe("create", function() {
- beforeEach(function() { result = mat3.create(); });
- it("should return a 9 element array initialized to a 3x3 identity matrix", function() { expect(result).toBeEqualish(identity); });
- });
-
- describe("clone", function() {
- beforeEach(function() { result = mat3.clone(matA); });
- it("should return a 9 element array initialized to the values in matA", function() { expect(result).toBeEqualish(matA); });
- });
-
- describe("copy", function() {
- beforeEach(function() { result = mat3.copy(out, matA); });
- it("should place values into out", function() { expect(out).toBeEqualish(matA); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("identity", function() {
- beforeEach(function() { result = mat3.identity(out); });
- it("should place values into out", function() { expect(result).toBeEqualish(identity); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("transpose", function() {
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat3.transpose(out, matA); });
-
- it("should place values into out", function() {
- expect(out).toBeEqualish([
- 1, 0, 1,
- 0, 1, 2,
- 0, 0, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0,
- 0, 1, 0,
- 1, 2, 1
- ]);
- });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat3.transpose(matA, matA); });
-
- it("should place values into matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 1,
- 0, 1, 2,
- 0, 0, 1
- ]);
- });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("invert", function() {
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat3.invert(out, matA); });
-
- it("should place values into out", function() {
- expect(out).toBeEqualish([
- 1, 0, 0,
- 0, 1, 0,
- -1, -2, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0,
- 0, 1, 0,
- 1, 2, 1
- ]);
- });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat3.invert(matA, matA); });
-
- it("should place values into matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0,
- 0, 1, 0,
- -1, -2, 1
- ]);
- });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("adjoint", function() {
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat3.adjoint(out, matA); });
-
- it("should place values into out", function() {
- expect(out).toBeEqualish([
- 1, 0, 0,
- 0, 1, 0,
- -1, -2, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0,
- 0, 1, 0,
- 1, 2, 1
- ]);
- });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat3.adjoint(matA, matA); });
-
- it("should place values into matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0,
- 0, 1, 0,
- -1, -2, 1
- ]);
- });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("determinant", function() {
- beforeEach(function() { result = mat3.determinant(matA); });
-
- it("should return the determinant", function() { expect(result).toEqual(1); });
- });
-
- describe("multiply", function() {
- it("should have an alias called 'mul'", function() { expect(mat3.mul).toEqual(mat3.multiply); });
-
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat3.multiply(out, matA, matB); });
-
- it("should place values into out", function() {
- expect(out).toBeEqualish([
- 1, 0, 0,
- 0, 1, 0,
- 4, 6, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0,
- 0, 1, 0,
- 1, 2, 1
- ]);
- });
- it("should not modify matB", function() {
- expect(matB).toBeEqualish([
- 1, 0, 0,
- 0, 1, 0,
- 3, 4, 1
- ]);
- });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat3.multiply(matA, matA, matB); });
-
- it("should place values into matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0,
- 0, 1, 0,
- 4, 6, 1
- ]);
- });
- it("should return matA", function() { expect(result).toBe(matA); });
- it("should not modify matB", function() {
- expect(matB).toBeEqualish([
- 1, 0, 0,
- 0, 1, 0,
- 3, 4, 1
- ]);
- });
- });
-
- describe("when matB is the output matrix", function() {
- beforeEach(function() { result = mat3.multiply(matB, matA, matB); });
-
- it("should place values into matB", function() {
- expect(matB).toBeEqualish([
- 1, 0, 0,
- 0, 1, 0,
- 4, 6, 1
- ]);
- });
- it("should return matB", function() { expect(result).toBe(matB); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0,
- 0, 1, 0,
- 1, 2, 1
- ]);
- });
- });
- });
-
- describe("str", function() {
- beforeEach(function() { result = mat3.str(matA); });
-
- it("should return a string representation of the matrix", function() { expect(result).toEqual("mat3(1, 0, 0, 0, 1, 0, 1, 2, 1)"); });
- });
-
- describe("frob", function() {
- beforeEach(function() { result = mat3.frob(matA); });
- it("should return the Frobenius Norm of the matrix", function() { expect(result).toEqual( Math.sqrt(Math.pow(1, 2) + Math.pow(0, 2) + Math.pow(0, 2) + Math.pow(0, 2) + Math.pow(1, 2) + Math.pow(0, 2) + Math.pow(1, 2) + Math.pow(2, 2) + Math.pow(1, 2))); });
- });
-
-});
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat4-spec.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat4-spec.js
deleted file mode 100644
index 9b7a67f4ee6..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/mat4-spec.js
+++ /dev/null
@@ -1,637 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-describe("mat4", function() {
- var mat4 = require("../../src/gl-matrix/mat4.js");
- var vec3 = require("../../src/gl-matrix/vec3.js");
-
- var out, matA, matB, identity, result;
-
- beforeEach(function() {
- // Attempting to portray a semi-realistic transform matrix
- matA = [1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 2, 3, 1];
-
- matB = [1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 4, 5, 6, 1];
-
- out = [0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0,
- 0, 0, 0, 0];
-
- identity = [1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1];
- });
-
- describe("create", function() {
- beforeEach(function() { result = mat4.create(); });
- it("should return a 16 element array initialized to a 4x4 identity matrix", function() { expect(result).toBeEqualish(identity); });
- });
-
- describe("clone", function() {
- beforeEach(function() { result = mat4.clone(matA); });
- it("should return a 16 element array initialized to the values in matA", function() { expect(result).toBeEqualish(matA); });
- });
-
- describe("copy", function() {
- beforeEach(function() { result = mat4.copy(out, matA); });
- it("should place values into out", function() { expect(out).toBeEqualish(matA); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("identity", function() {
- beforeEach(function() { result = mat4.identity(out); });
- it("should place values into out", function() { expect(result).toBeEqualish(identity); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("transpose", function() {
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat4.transpose(out, matA); });
-
- it("should place values into out", function() {
- expect(out).toBeEqualish([
- 1, 0, 0, 1,
- 0, 1, 0, 2,
- 0, 0, 1, 3,
- 0, 0, 0, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 2, 3, 1
- ]);
- });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat4.transpose(matA, matA); });
-
- it("should place values into matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 1,
- 0, 1, 0, 2,
- 0, 0, 1, 3,
- 0, 0, 0, 1
- ]);
- });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("invert", function() {
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat4.invert(out, matA); });
-
- it("should place values into out", function() {
- expect(out).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- -1, -2, -3, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 2, 3, 1
- ]);
- });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat4.invert(matA, matA); });
-
- it("should place values into matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- -1, -2, -3, 1
- ]);
- });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("adjoint", function() {
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat4.adjoint(out, matA); });
-
- it("should place values into out", function() {
- expect(out).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- -1, -2, -3, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 2, 3, 1
- ]);
- });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat4.adjoint(matA, matA); });
-
- it("should place values into matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- -1, -2, -3, 1
- ]);
- });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("determinant", function() {
- beforeEach(function() { result = mat4.determinant(matA); });
-
- it("should return the determinant", function() { expect(result).toEqual(1); });
- });
-
- describe("multiply", function() {
- it("should have an alias called 'mul'", function() { expect(mat4.mul).toEqual(mat4.multiply); });
-
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat4.multiply(out, matA, matB); });
-
- it("should place values into out", function() {
- expect(out).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 5, 7, 9, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 2, 3, 1
- ]);
- });
- it("should not modify matB", function() {
- expect(matB).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 4, 5, 6, 1
- ]);
- });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat4.multiply(matA, matA, matB); });
-
- it("should place values into matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 5, 7, 9, 1
- ]);
- });
- it("should return matA", function() { expect(result).toBe(matA); });
- it("should not modify matB", function() {
- expect(matB).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 4, 5, 6, 1
- ]);
- });
- });
-
- describe("when matB is the output matrix", function() {
- beforeEach(function() { result = mat4.multiply(matB, matA, matB); });
-
- it("should place values into matB", function() {
- expect(matB).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 5, 7, 9, 1
- ]);
- });
- it("should return matB", function() { expect(result).toBe(matB); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 2, 3, 1
- ]);
- });
- });
- });
-
- describe("translate", function() {
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat4.translate(out, matA, [4, 5, 6]); });
-
- it("should place values into out", function() {
- expect(out).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 5, 7, 9, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 2, 3, 1
- ]);
- });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat4.translate(matA, matA, [4, 5, 6]); });
-
- it("should place values into matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 5, 7, 9, 1
- ]);
- });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("scale", function() {
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat4.scale(out, matA, [4, 5, 6]); });
-
- it("should place values into out", function() {
- expect(out).toBeEqualish([
- 4, 0, 0, 0,
- 0, 5, 0, 0,
- 0, 0, 6, 0,
- 1, 2, 3, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 2, 3, 1
- ]);
- });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat4.scale(matA, matA, [4, 5, 6]); });
-
- it("should place values into matA", function() {
- expect(matA).toBeEqualish([
- 4, 0, 0, 0,
- 0, 5, 0, 0,
- 0, 0, 6, 0,
- 1, 2, 3, 1
- ]);
- });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("rotate", function() {
- var rad = Math.PI * 0.5;
- var axis = [1, 0, 0];
-
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat4.rotate(out, matA, rad, axis); });
-
- it("should place values into out", function() {
- expect(out).toBeEqualish([
- 1, 0, 0, 0,
- 0, Math.cos(rad), Math.sin(rad), 0,
- 0, -Math.sin(rad), Math.cos(rad), 0,
- 1, 2, 3, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 2, 3, 1
- ]);
- });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat4.rotate(matA, matA, rad, axis); });
-
- it("should place values into matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, Math.cos(rad), Math.sin(rad), 0,
- 0, -Math.sin(rad), Math.cos(rad), 0,
- 1, 2, 3, 1
- ]);
- });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("rotateX", function() {
- var rad = Math.PI * 0.5;
-
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat4.rotateX(out, matA, rad); });
-
- it("should place values into out", function() {
- expect(out).toBeEqualish([
- 1, 0, 0, 0,
- 0, Math.cos(rad), Math.sin(rad), 0,
- 0, -Math.sin(rad), Math.cos(rad), 0,
- 1, 2, 3, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 2, 3, 1
- ]);
- });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat4.rotateX(matA, matA, rad); });
-
- it("should place values into matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, Math.cos(rad), Math.sin(rad), 0,
- 0, -Math.sin(rad), Math.cos(rad), 0,
- 1, 2, 3, 1
- ]);
- });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("rotateY", function() {
- var rad = Math.PI * 0.5;
-
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat4.rotateY(out, matA, rad); });
-
- it("should place values into out", function() {
- expect(out).toBeEqualish([
- Math.cos(rad), 0, -Math.sin(rad), 0,
- 0, 1, 0, 0,
- Math.sin(rad), 0, Math.cos(rad), 0,
- 1, 2, 3, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 2, 3, 1
- ]);
- });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat4.rotateY(matA, matA, rad); });
-
- it("should place values into matA", function() {
- expect(matA).toBeEqualish([
- Math.cos(rad), 0, -Math.sin(rad), 0,
- 0, 1, 0, 0,
- Math.sin(rad), 0, Math.cos(rad), 0,
- 1, 2, 3, 1
- ]);
- });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- describe("rotateZ", function() {
- var rad = Math.PI * 0.5;
-
- describe("with a separate output matrix", function() {
- beforeEach(function() { result = mat4.rotateZ(out, matA, rad); });
-
- it("should place values into out", function() {
- expect(out).toBeEqualish([
- Math.cos(rad), Math.sin(rad), 0, 0,
- -Math.sin(rad), Math.cos(rad), 0, 0,
- 0, 0, 1, 0,
- 1, 2, 3, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify matA", function() {
- expect(matA).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 2, 3, 1
- ]);
- });
- });
-
- describe("when matA is the output matrix", function() {
- beforeEach(function() { result = mat4.rotateZ(matA, matA, rad); });
-
- it("should place values into matA", function() {
- expect(matA).toBeEqualish([
- Math.cos(rad), Math.sin(rad), 0, 0,
- -Math.sin(rad), Math.cos(rad), 0, 0,
- 0, 0, 1, 0,
- 1, 2, 3, 1
- ]);
- });
- it("should return matA", function() { expect(result).toBe(matA); });
- });
- });
-
- // TODO: fromRotationTranslation
-
- describe("frustum", function() {
- beforeEach(function() { result = mat4.frustum(out, -1, 1, -1, 1, -1, 1); });
- it("should place values into out", function() { expect(result).toBeEqualish([
- -1, 0, 0, 0,
- 0, -1, 0, 0,
- 0, 0, 0, -1,
- 0, 0, 1, 0
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("perspective", function() {
- var fovy = Math.PI * 0.5;
- beforeEach(function() { result = mat4.perspective(out, fovy, 1, 0, 1); });
- it("should place values into out", function() { expect(result).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, -1, -1,
- 0, 0, 0, 0
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
-
- describe("with nonzero near, 45deg fovy, and realistic aspect ratio", function() {
- beforeEach(function() { result = mat4.perspective(out, 45 * Math.PI / 180.0, 640/480, 0.1, 200); });
- it("should calculate correct matrix", function() { expect(result).toBeEqualish([
- 1.81066, 0, 0, 0,
- 0, 2.414213, 0, 0,
- 0, 0, -1.001, -1,
- 0, 0, -0.2001, 0
- ]); });
- });
- });
-
- describe("ortho", function() {
- beforeEach(function() { result = mat4.ortho(out, -1, 1, -1, 1, -1, 1); });
- it("should place values into out", function() { expect(result).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, -1, 0,
- 0, 0, 0, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("lookAt", function() {
- var eye = [0, 0, 1];
- var center = [0, 0, -1];
- var up = [0, 1, 0];
- var view, up, right;
-
- describe("looking down", function() {
- beforeEach(function() {
- view = [0, -1, 0];
- up = [0, 0, -1];
- right= [1, 0, 0];
- result = mat4.lookAt(out, [0, 0, 0], view, up);
- });
-
- it("should transform view into local -Z", function() {
- result = vec3.transformMat4([], view, out);
- expect(result).toBeEqualish([0, 0, -1]);
- });
-
- it("should transform up into local +Y", function() {
- result = vec3.transformMat4([], up, out);
- expect(result).toBeEqualish([0, 1, 0]);
- });
-
- it("should transform right into local +X", function() {
- result = vec3.transformMat4([], right, out);
- expect(result).toBeEqualish([1, 0, 0]);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("#74", function() {
- beforeEach(function() {
- mat4.lookAt(out, [0,2,0], [0,0.6,0], [0,0,-1]);
- });
-
- it("should transform a point 'above' into local +Y", function() {
- result = vec3.transformMat4([], [0, 2, -1], out);
- expect(result).toBeEqualish([0, 1, 0]);
- });
-
- it("should transform a point 'right of' into local +X", function() {
- result = vec3.transformMat4([], [1, 2, 0], out);
- expect(result).toBeEqualish([1, 0, 0]);
- });
-
- it("should transform a point 'in front of' into local -Z", function() {
- result = vec3.transformMat4([], [0, 1, 0], out);
- expect(result).toBeEqualish([0, 0, -1]);
- });
- });
-
- beforeEach(function() {
- eye = [0, 0, 1];
- center = [0, 0, -1];
- up = [0, 1, 0];
- result = mat4.lookAt(out, eye, center, up);
- });
- it("should place values into out", function() { expect(result).toBeEqualish([
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, -1, 1
- ]);
- });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("str", function() {
- beforeEach(function() { result = mat4.str(matA); });
-
- it("should return a string representation of the matrix", function() { expect(result).toEqual("mat4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 2, 3, 1)"); });
- });
-
- describe("frob", function() {
- beforeEach(function() { result = mat4.frob(matA); });
- it("should return the Frobenius Norm of the matrix", function() { expect(result).toEqual( Math.sqrt(Math.pow(1, 2) + Math.pow(1, 2) + Math.pow(1, 2) + Math.pow(1, 2) + Math.pow(1, 2) + Math.pow(2, 2) + Math.pow(3, 2) )); });
- });
-
-
-});
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/quat-spec.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/quat-spec.js
deleted file mode 100644
index 4f5150014d0..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/quat-spec.js
+++ /dev/null
@@ -1,559 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-describe("quat", function() {
- var mat3 = require("../../src/gl-matrix/mat3.js");
- var mat4 = require("../../src/gl-matrix/mat4.js");
- var quat = require("../../src/gl-matrix/quat.js");
- var vec3 = require("../../src/gl-matrix/vec3.js");
-
- var out, quatA, quatB, result;
- var vec, id, deg90;
-
- beforeEach(function() {
- quatA = [1, 2, 3, 4];
- quatB = [5, 6, 7, 8];
- out = [0, 0, 0, 0];
- vec = [1, 1, -1];
- id = [0, 0, 0, 1];
- deg90 = Math.PI / 2;
- });
-
- describe("slerp", function() {
- describe("the normal case", function() {
- beforeEach(function() {
- result = quat.slerp(out, [0, 0, 0, 1], [0, 1, 0, 0], 0.5);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
- it("should calculate proper quat", function() {
- expect(result).toBeEqualish([0, 0.707106, 0, 0.707106]);
- });
- });
-
- describe("where a == b", function() {
- beforeEach(function() {
- result = quat.slerp(out, [0, 0, 0, 1], [0, 0, 0, 1], 0.5);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
- it("should calculate proper quat", function() {
- expect(result).toBeEqualish([0, 0, 0, 1]);
- });
- });
-
- describe("where theta == 180deg", function() {
- beforeEach(function() {
- quat.rotateX(quatA, [1,0,0,0], Math.PI); // 180 deg
- result = quat.slerp(out, [1,0,0,0], quatA, 1);
- });
-
- it("should calculate proper quat", function() {
- expect(result).toBeEqualish([0,0,0,-1]);
- });
- });
-
- describe("where a == -b", function() {
- beforeEach(function() {
- result = quat.slerp(out, [1, 0, 0, 0], [-1, 0, 0, 0], 0.5);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
- it("should calculate proper quat", function() {
- expect(result).toBeEqualish([1, 0, 0, 0]);
- });
- });
- });
-
- describe("rotateX", function() {
- beforeEach(function() {
- result = quat.rotateX(out, id, deg90);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
- it("should transform vec accordingly", function() {
- vec3.transformQuat(vec, [0,0,-1], out);
- expect(vec).toBeEqualish([0, 1, 0]);
- });
- });
-
- describe("rotateY", function() {
- beforeEach(function() {
- result = quat.rotateY(out, id, deg90);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
- it("should transform vec accordingly", function() {
- vec3.transformQuat(vec, [0,0,-1], out);
- expect(vec).toBeEqualish([-1, 0, 0]);
- });
- });
-
- describe("rotateZ", function() {
- beforeEach(function() {
- result = quat.rotateZ(out, id, deg90);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
- it("should transform vec accordingly", function() {
- vec3.transformQuat(vec, [0,1,0], out);
- expect(vec).toBeEqualish([-1, 0, 0]);
- });
- });
-
- describe("fromMat3", function() {
- var matr;
-
- describe("legacy", function() {
- beforeEach(function() {
- matr = [ 1, 0, 0,
- 0, 0, -1,
- 0, 1, 0 ];
- result = quat.fromMat3(out, matr);
- });
-
- it("should set dest to the correct value", function() {
- expect(result).toBeEqualish([-0.707106, 0, 0, 0.707106]);
- });
- });
-
- describe("where trace > 0", function() {
- beforeEach(function() {
- matr = [ 1, 0, 0,
- 0, 0, -1,
- 0, 1, 0 ];
- result = quat.fromMat3(out, matr);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
-
- it("should produce the correct transformation", function() {
- expect(vec3.transformQuat([], [0,1,0], out)).toBeEqualish([0,0,-1]);
- });
- });
-
- describe("from a normal matrix looking 'backward'", function() {
- beforeEach(function() {
- matr = mat3.create();
- mat3.transpose(matr, mat3.invert(matr, mat3.fromMat4(matr, mat4.lookAt(mat4.create(), [0, 0, 0], [0, 0, 1], [0, 1, 0]))));
- result = quat.fromMat3(out, matr);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
-
- it("should produce the same transformation as the given matrix", function() {
- expect(vec3.transformQuat([], [3,2,-1], quat.normalize(out, out))).toBeEqualish(vec3.transformMat3([], [3,2,-1], matr));
- });
- });
-
- describe("from a normal matrix looking 'left' and 'upside down'", function() {
- beforeEach(function() {
- matr = mat3.create();
- mat3.transpose(matr, mat3.invert(matr, mat3.fromMat4(matr, mat4.lookAt(mat4.create(), [0, 0, 0], [-1, 0, 0], [0, -1, 0]))));
- result = quat.fromMat3(out, matr);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
-
- it("should produce the same transformation as the given matrix", function() {
- expect(vec3.transformQuat([], [3,2,-1], quat.normalize(out, out))).toBeEqualish(vec3.transformMat3([], [3,2,-1], matr));
- });
- });
-
- describe("from a normal matrix looking 'upside down'", function() {
- beforeEach(function() {
- matr = mat3.create();
- mat3.transpose(matr, mat3.invert(matr, mat3.fromMat4(matr, mat4.lookAt(mat4.create(), [0, 0, 0], [0, 0, -1], [0, -1, 0]))));
- result = quat.fromMat3(out, matr);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
-
- it("should produce the same transformation as the given matrix", function() {
- expect(vec3.transformQuat([], [3,2,-1], quat.normalize(out, out))).toBeEqualish(vec3.transformMat3([], [3,2,-1], matr));
- });
- });
- });
-
- describe("setAxes", function() {
- var r;
- beforeEach(function() { r = vec3.create(); });
-
- describe("looking left", function() {
- var view, up, right;
- beforeEach(function() {
- view = [-1, 0, 0];
- up = [ 0, 1, 0];
- right= [ 0, 0,-1];
- result = quat.setAxes([], view, right, up);
- });
-
- it("should transform local view into world left", function() {
- r = vec3.transformQuat([], [0,0,-1], result);
- expect(r).toBeEqualish([1, 0, 0]);
- });
-
- it("should transform local right into world front", function() {
- r = vec3.transformQuat([], [1,0,0], result);
- expect(r).toBeEqualish([0, 0, 1]);
- });
- });
-
- describe("given opengl defaults", function() {
- var view, up, right;
- beforeEach(function() {
- view = [0, 0, -1];
- up = [0, 1, 0];
- right= [1, 0, 0];
- result = quat.setAxes(out, view, right, up);
- });
-
- it("should return out", function() {
- expect(result).toBe(out);
- });
-
- it("should produce identity", function() {
- expect(out).toBeEqualish([0, 0, 0, 1]);
- });
- });
-
- describe("legacy example", function() {
- var view, up, right;
- beforeEach(function() {
- right= [1, 0, 0];
- up = [0, 0, 1];
- view = [0, -1, 0];
- result = quat.setAxes(out, view, right, up);
- });
-
- xit("should set correct quat4 values", function() {
- expect(result).toBeEqualish([0.707106, 0, 0, 0.707106]);
- });
- });
- });
-
- describe("rotationTo", function() {
- var r;
- beforeEach(function() { r = vec3.create(); });
-
- describe("at right angle", function() {
- beforeEach(function() {
- result = quat.rotationTo(out, [0, 1, 0], [1, 0, 0]);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
-
- it("should calculate proper quaternion", function() {
- expect(out).toBeEqualish([0, 0, -0.707106, 0.707106]);
- });
- });
-
- describe("when vectors are parallel", function() {
- beforeEach(function() {
- result = quat.rotationTo(out, [0, 1, 0], [0, 1, 0]);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
-
- it("multiplying A should produce B", function() {
- expect(vec3.transformQuat(r, [0, 1, 0], out)).toBeEqualish([0, 1, 0]);
- });
- });
-
- describe("when vectors are opposed X", function() {
- beforeEach(function() {
- result = quat.rotationTo(out, [1, 0, 0], [-1, 0, 0]);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
-
- it("multiplying A should produce B", function() {
- expect(vec3.transformQuat(r, [1, 0, 0], out)).toBeEqualish([-1, 0, 0]);
- });
- });
-
- describe("when vectors are opposed Y", function() {
- beforeEach(function() {
- result = quat.rotationTo(out, [0, 1, 0], [0, -1, 0]);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
-
- it("multiplying A should produce B", function() {
- expect(vec3.transformQuat(r, [0, 1, 0], out)).toBeEqualish([0, -1, 0]);
- });
- });
-
- describe("when vectors are opposed Z", function() {
- beforeEach(function() {
- result = quat.rotationTo(out, [0, 0, 1], [0, 0, -1]);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
-
- it("multiplying A should produce B", function() {
- expect(vec3.transformQuat(r, [0, 0, 1], out)).toBeEqualish([0, 0, -1]);
- });
- });
- });
-
- describe("create", function() {
- beforeEach(function() { result = quat.create(); });
- it("should return a 4 element array initialized to an identity quaternion", function() { expect(result).toBeEqualish([0, 0, 0, 1]); });
- });
-
- describe("clone", function() {
- beforeEach(function() { result = quat.clone(quatA); });
- it("should return a 4 element array initialized to the values in quatA", function() { expect(result).toBeEqualish(quatA); });
- });
-
- describe("fromValues", function() {
- beforeEach(function() { result = quat.fromValues(1, 2, 3, 4); });
- it("should return a 4 element array initialized to the values passed", function() { expect(result).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("copy", function() {
- beforeEach(function() { result = quat.copy(out, quatA); });
- it("should place values into out", function() { expect(out).toBeEqualish([1, 2, 3, 4]); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("set", function() {
- beforeEach(function() { result = quat.set(out, 1, 2, 3, 4); });
- it("should place values into out", function() { expect(out).toBeEqualish([1, 2, 3, 4]); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("identity", function() {
- beforeEach(function() { result = quat.identity(out); });
- it("should place values into out", function() { expect(result).toBeEqualish([0, 0, 0, 1]); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("setAxisAngle", function() {
- beforeEach(function() { result = quat.setAxisAngle(out, [1, 0, 0], Math.PI * 0.5); });
- it("should place values into out", function() { expect(result).toBeEqualish([0.707106, 0, 0, 0.707106]); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("add", function() {
- describe("with a separate output quaternion", function() {
- beforeEach(function() { result = quat.add(out, quatA, quatB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([6, 8, 10, 12]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify quatA", function() { expect(quatA).toBeEqualish([1, 2, 3, 4]); });
- it("should not modify quatB", function() { expect(quatB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when quatA is the output quaternion", function() {
- beforeEach(function() { result = quat.add(quatA, quatA, quatB); });
-
- it("should place values into quatA", function() { expect(quatA).toBeEqualish([6, 8, 10, 12]); });
- it("should return quatA", function() { expect(result).toBe(quatA); });
- it("should not modify quatB", function() { expect(quatB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when quatB is the output quaternion", function() {
- beforeEach(function() { result = quat.add(quatB, quatA, quatB); });
-
- it("should place values into quatB", function() { expect(quatB).toBeEqualish([6, 8, 10, 12]); });
- it("should return quatB", function() { expect(result).toBe(quatB); });
- it("should not modify quatA", function() { expect(quatA).toBeEqualish([1, 2, 3, 4]); });
- });
- });
-
- describe("multiply", function() {
- it("should have an alias called 'mul'", function() { expect(quat.mul).toEqual(quat.multiply); });
-
- describe("with a separate output quaternion", function() {
- beforeEach(function() { result = quat.multiply(out, quatA, quatB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([24, 48, 48, -6]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify quatA", function() { expect(quatA).toBeEqualish([1, 2, 3, 4]); });
- it("should not modify quatB", function() { expect(quatB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when quatA is the output quaternion", function() {
- beforeEach(function() { result = quat.multiply(quatA, quatA, quatB); });
-
- it("should place values into quatA", function() { expect(quatA).toBeEqualish([24, 48, 48, -6]); });
- it("should return quatA", function() { expect(result).toBe(quatA); });
- it("should not modify quatB", function() { expect(quatB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when quatB is the output quaternion", function() {
- beforeEach(function() { result = quat.multiply(quatB, quatA, quatB); });
-
- it("should place values into quatB", function() { expect(quatB).toBeEqualish([24, 48, 48, -6]); });
- it("should return quatB", function() { expect(result).toBe(quatB); });
- it("should not modify quatA", function() { expect(quatA).toBeEqualish([1, 2, 3, 4]); });
- });
- });
-
- describe("scale", function() {
- describe("with a separate output quaternion", function() {
- beforeEach(function() { result = quat.scale(out, quatA, 2); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([2, 4, 6, 8]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify quatA", function() { expect(quatA).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("when quatA is the output quaternion", function() {
- beforeEach(function() { result = quat.scale(quatA, quatA, 2); });
-
- it("should place values into quatA", function() { expect(quatA).toBeEqualish([2, 4, 6, 8]); });
- it("should return quatA", function() { expect(result).toBe(quatA); });
- });
- });
-
- describe("length", function() {
- it("should have an alias called 'len'", function() { expect(quat.len).toEqual(quat.length); });
-
- beforeEach(function() { result = quat.length(quatA); });
-
- it("should return the length", function() { expect(result).toBeCloseTo(5.477225); });
- });
-
- describe("squaredLength", function() {
- it("should have an alias called 'sqrLen'", function() { expect(quat.sqrLen).toEqual(quat.squaredLength); });
-
- beforeEach(function() { result = quat.squaredLength(quatA); });
-
- it("should return the squared length", function() { expect(result).toEqual(30); });
- });
-
- describe("normalize", function() {
- beforeEach(function() { quatA = [5, 0, 0, 0]; });
-
- describe("with a separate output quaternion", function() {
- beforeEach(function() { result = quat.normalize(out, quatA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([1, 0, 0, 0]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify quatA", function() { expect(quatA).toBeEqualish([5, 0, 0, 0]); });
- });
-
- describe("when quatA is the output quaternion", function() {
- beforeEach(function() { result = quat.normalize(quatA, quatA); });
-
- it("should place values into quatA", function() { expect(quatA).toBeEqualish([1, 0, 0, 0]); });
- it("should return quatA", function() { expect(result).toBe(quatA); });
- });
- });
-
- describe("lerp", function() {
- describe("with a separate output quaternion", function() {
- beforeEach(function() { result = quat.lerp(out, quatA, quatB, 0.5); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([3, 4, 5, 6]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify quatA", function() { expect(quatA).toBeEqualish([1, 2, 3, 4]); });
- it("should not modify quatB", function() { expect(quatB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when quatA is the output quaternion", function() {
- beforeEach(function() { result = quat.lerp(quatA, quatA, quatB, 0.5); });
-
- it("should place values into quatA", function() { expect(quatA).toBeEqualish([3, 4, 5, 6]); });
- it("should return quatA", function() { expect(result).toBe(quatA); });
- it("should not modify quatB", function() { expect(quatB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when quatB is the output quaternion", function() {
- beforeEach(function() { result = quat.lerp(quatB, quatA, quatB, 0.5); });
-
- it("should place values into quatB", function() { expect(quatB).toBeEqualish([3, 4, 5, 6]); });
- it("should return quatB", function() { expect(result).toBe(quatB); });
- it("should not modify quatA", function() { expect(quatA).toBeEqualish([1, 2, 3, 4]); });
- });
- });
-
- /*describe("slerp", function() {
- describe("with a separate output quaternion", function() {
- beforeEach(function() { result = quat.slerp(out, quatA, quatB, 0.5); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([3, 4, 5, 6]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify quatA", function() { expect(quatA).toBeEqualish([1, 2, 3, 4]); });
- it("should not modify quatB", function() { expect(quatB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when quatA is the output quaternion", function() {
- beforeEach(function() { result = quat.slerp(quatA, quatA, quatB, 0.5); });
-
- it("should place values into quatA", function() { expect(quatA).toBeEqualish([3, 4, 5, 6]); });
- it("should return quatA", function() { expect(result).toBe(quatA); });
- it("should not modify quatB", function() { expect(quatB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when quatB is the output quaternion", function() {
- beforeEach(function() { result = quat.slerp(quatB, quatA, quatB, 0.5); });
-
- it("should place values into quatB", function() { expect(quatB).toBeEqualish([3, 4, 5, 6]); });
- it("should return quatB", function() { expect(result).toBe(quatB); });
- it("should not modify quatA", function() { expect(quatA).toBeEqualish([1, 2, 3, 4]); });
- });
- });*/
-
- // TODO: slerp, calcuateW, rotateX, rotateY, rotateZ
-
- describe("invert", function() {
- describe("with a separate output quaternion", function() {
- beforeEach(function() { result = quat.invert(out, quatA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([-0.033333, -0.066666, -0.1, 0.133333]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify quatA", function() { expect(quatA).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("when quatA is the output quaternion", function() {
- beforeEach(function() { result = quat.invert(quatA, quatA); });
-
- it("should place values into quatA", function() { expect(quatA).toBeEqualish([-0.033333, -0.066666, -0.1, 0.133333]); });
- it("should return quatA", function() { expect(result).toBe(quatA); });
- });
- });
-
- describe("conjugate", function() {
- describe("with a separate output quaternion", function() {
- beforeEach(function() { result = quat.conjugate(out, quatA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([-1, -2, -3, 4]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify quatA", function() { expect(quatA).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("when quatA is the output quaternion", function() {
- beforeEach(function() { result = quat.conjugate(quatA, quatA); });
-
- it("should place values into quatA", function() { expect(quatA).toBeEqualish([-1, -2, -3, 4]); });
- it("should return quatA", function() { expect(result).toBe(quatA); });
- });
- });
-
- describe("str", function() {
- beforeEach(function() { result = quat.str(quatA); });
-
- it("should return a string representation of the quaternion", function() { expect(result).toEqual("quat(1, 2, 3, 4)"); });
- });
-});
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/vec2-spec.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/vec2-spec.js
deleted file mode 100644
index 254c52739c3..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/vec2-spec.js
+++ /dev/null
@@ -1,549 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-describe("vec2", function() {
- var vec2 = require("../../src/gl-matrix/vec2.js");
-
- var out, vecA, vecB, result;
-
- beforeEach(function() { vecA = [1, 2]; vecB = [3, 4]; out = [0, 0]; });
-
- describe("create", function() {
- beforeEach(function() { result = vec2.create(); });
- it("should return a 2 element array initialized to 0s", function() { expect(result).toBeEqualish([0, 0]); });
- });
-
- describe("clone", function() {
- beforeEach(function() { result = vec2.clone(vecA); });
- it("should return a 2 element array initialized to the values in vecA", function() { expect(result).toBeEqualish(vecA); });
- });
-
- describe("fromValues", function() {
- beforeEach(function() { result = vec2.fromValues(1, 2); });
- it("should return a 2 element array initialized to the values passed", function() { expect(result).toBeEqualish([1, 2]); });
- });
-
- describe("copy", function() {
- beforeEach(function() { result = vec2.copy(out, vecA); });
- it("should place values into out", function() { expect(out).toBeEqualish([1, 2]); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("set", function() {
- beforeEach(function() { result = vec2.set(out, 1, 2); });
- it("should place values into out", function() { expect(out).toBeEqualish([1, 2]); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("add", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec2.add(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([4, 6]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec2.add(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([4, 6]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec2.add(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([4, 6]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- });
- });
-
- describe("subtract", function() {
- it("should have an alias called 'sub'", function() { expect(vec2.sub).toEqual(vec2.subtract); });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec2.subtract(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([-2, -2]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec2.subtract(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([-2, -2]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec2.subtract(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([-2, -2]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- });
- });
-
- describe("multiply", function() {
- it("should have an alias called 'mul'", function() { expect(vec2.mul).toEqual(vec2.multiply); });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec2.multiply(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([3, 8]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec2.multiply(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([3, 8]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec2.multiply(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([3, 8]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- });
- });
-
- describe("divide", function() {
- it("should have an alias called 'div'", function() { expect(vec2.div).toEqual(vec2.divide); });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec2.divide(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([0.3333333, 0.5]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec2.divide(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([0.3333333, 0.5]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec2.divide(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([0.3333333, 0.5]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- });
- });
-
- describe("min", function() {
- beforeEach(function() { vecA = [1, 4]; vecB = [3, 2]; });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec2.min(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([1, 2]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 4]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 2]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec2.min(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 2]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec2.min(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([1, 2]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 4]); });
- });
- });
-
- describe("max", function() {
- beforeEach(function() { vecA = [1, 4]; vecB = [3, 2]; });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec2.max(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([3, 4]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 4]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 2]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec2.max(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([3, 4]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 2]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec2.max(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([3, 4]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 4]); });
- });
- });
-
- describe("scale", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec2.scale(out, vecA, 2); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([2, 4]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec2.scale(vecA, vecA, 2); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([2, 4]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- });
- });
-
- describe("scaleAndAdd", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec2.scaleAndAdd(out, vecA, vecB, 0.5); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([2.5, 4]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec2.scaleAndAdd(vecA, vecA, vecB, 0.5); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([2.5, 4]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec2.scaleAndAdd(vecB, vecA, vecB, 0.5); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([2.5, 4]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- });
- });
-
- describe("distance", function() {
- it("should have an alias called 'dist'", function() { expect(vec2.dist).toEqual(vec2.distance); });
-
- beforeEach(function() { result = vec2.distance(vecA, vecB); });
-
- it("should return the distance", function() { expect(result).toBeCloseTo(2.828427); });
- });
-
- describe("squaredDistance", function() {
- it("should have an alias called 'sqrDist'", function() { expect(vec2.sqrDist).toEqual(vec2.squaredDistance); });
-
- beforeEach(function() { result = vec2.squaredDistance(vecA, vecB); });
-
- it("should return the squared distance", function() { expect(result).toEqual(8); });
- });
-
- describe("length", function() {
- it("should have an alias called 'len'", function() { expect(vec2.len).toEqual(vec2.length); });
-
- beforeEach(function() { result = vec2.length(vecA); });
-
- it("should return the length", function() { expect(result).toBeCloseTo(2.236067); });
- });
-
- describe("squaredLength", function() {
- it("should have an alias called 'sqrLen'", function() { expect(vec2.sqrLen).toEqual(vec2.squaredLength); });
-
- beforeEach(function() { result = vec2.squaredLength(vecA); });
-
- it("should return the squared length", function() { expect(result).toEqual(5); });
- });
-
- describe("negate", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec2.negate(out, vecA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([-1, -2]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec2.negate(vecA, vecA); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([-1, -2]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- });
- });
-
- describe("normalize", function() {
- beforeEach(function() { vecA = [5, 0]; });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec2.normalize(out, vecA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([1, 0]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([5, 0]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec2.normalize(vecA, vecA); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([1, 0]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- });
- });
-
- describe("dot", function() {
- beforeEach(function() { result = vec2.dot(vecA, vecB); });
-
- it("should return the dot product", function() { expect(result).toEqual(11); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); });
- });
-
- describe("cross", function() {
- var out3;
-
- beforeEach(function() {
- out3 = [0, 0, 0];
- result = vec2.cross(out3, vecA, vecB);
- });
-
- it("should place values into out", function() { expect(out3).toBeEqualish([0, 0, -2]); });
- it("should return out", function() { expect(result).toBe(out3); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); });
- });
-
- describe("lerp", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec2.lerp(out, vecA, vecB, 0.5); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([2, 3]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec2.lerp(vecA, vecA, vecB, 0.5); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([2, 3]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 4]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec2.lerp(vecB, vecA, vecB, 0.5); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([2, 3]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- });
- });
-
- describe("random", function() {
- describe("with no scale", function() {
- beforeEach(function() { result = vec2.random(out); });
-
- it("should result in a unit length vector", function() { expect(vec2.length(out)).toBeCloseTo(1.0); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("with a scale", function() {
- beforeEach(function() { result = vec2.random(out, 5.0); });
-
- it("should result in a unit length vector", function() { expect(vec2.length(out)).toBeCloseTo(5.0); });
- it("should return out", function() { expect(result).toBe(out); });
- });
- });
-
- describe("transformMat2", function() {
- var matA;
- beforeEach(function() { matA = [1, 2, 3, 4]; });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec2.transformMat2(out, vecA, matA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([7, 10]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec2.transformMat2(vecA, vecA, matA); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([7, 10]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4]); });
- });
- });
-
- describe("transformMat2d", function() {
- var matA;
- beforeEach(function() { matA = [1, 2, 3, 4, 5, 6]; });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec2.transformMat2d(out, vecA, matA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([12, 16]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4, 5, 6]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec2.transformMat2d(vecA, vecA, matA); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([12, 16]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4, 5, 6]); });
- });
- });
-
- describe("forEach", function() {
- var vecArray;
-
- beforeEach(function() {
- vecArray = [
- 1, 2,
- 3, 4,
- 0, 0
- ];
- });
-
- describe("when performing operations that take no extra arguments", function() {
- beforeEach(function() { result = vec2.forEach(vecArray, 0, 0, 0, vec2.normalize); });
-
- it("should update all values", function() {
- expect(vecArray).toBeEqualish([
- 0.447214, 0.894427,
- 0.6, 0.8,
- 0, 0
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- });
-
- describe("when performing operations that takes one extra arguments", function() {
- beforeEach(function() { result = vec2.forEach(vecArray, 0, 0, 0, vec2.add, vecA); });
-
- it("should update all values", function() {
- expect(vecArray).toBeEqualish([
- 2, 4,
- 4, 6,
- 1, 2
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- });
-
- describe("when specifying an offset", function() {
- beforeEach(function() { result = vec2.forEach(vecArray, 0, 2, 0, vec2.add, vecA); });
-
- it("should update all values except the first vector", function() {
- expect(vecArray).toBeEqualish([
- 1, 2,
- 4, 6,
- 1, 2
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- });
-
- describe("when specifying a count", function() {
- beforeEach(function() { result = vec2.forEach(vecArray, 0, 0, 2, vec2.add, vecA); });
-
- it("should update all values except the last vector", function() {
- expect(vecArray).toBeEqualish([
- 2, 4,
- 4, 6,
- 0, 0
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- });
-
- describe("when specifying a stride", function() {
- beforeEach(function() { result = vec2.forEach(vecArray, 4, 0, 0, vec2.add, vecA); });
-
- it("should update all values except the second vector", function() {
- expect(vecArray).toBeEqualish([
- 2, 4,
- 3, 4,
- 1, 2
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2]); });
- });
-
- describe("when calling a function that does not modify the out variable", function() {
- beforeEach(function() {
- result = vec2.forEach(vecArray, 0, 0, 0, function(out, vec) {});
- });
-
- it("values should remain unchanged", function() {
- expect(vecArray).toBeEqualish([
- 1, 2,
- 3, 4,
- 0, 0,
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- });
- });
-
- describe("str", function() {
- beforeEach(function() { result = vec2.str(vecA); });
-
- it("should return a string representation of the vector", function() { expect(result).toEqual("vec2(1, 2)"); });
- });
-});
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/vec3-spec.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/vec3-spec.js
deleted file mode 100644
index 8ef944f1a24..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/vec3-spec.js
+++ /dev/null
@@ -1,661 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-describe("vec3", function() {
- var mat3 = require("../../src/gl-matrix/mat3.js");
- var mat4 = require("../../src/gl-matrix/mat4.js");
- var vec3 = require("../../src/gl-matrix/vec3.js");
-
- var out, vecA, vecB, result;
-
- beforeEach(function() { vecA = [1, 2, 3]; vecB = [4, 5, 6]; out = [0, 0, 0]; });
-
- describe('rotateX', function(){
- describe('rotation around world origin [0, 0, 0]', function(){
- beforeEach(function(){ vecA = [0, 1, 0]; vecB = [0, 0, 0]; result = vec3.rotateX(out, vecA, vecB, Math.PI); });
- it("should return the rotated vector", function(){ expect(result).toBeEqualish([0, -1, 0]); });
- });
- describe('rotation around an arbitrary origin', function(){
- beforeEach(function(){ vecA = [2, 7, 0]; vecB = [2, 5, 0]; result = vec3.rotateX(out, vecA, vecB, Math.PI); });
- it("should return the rotated vector", function(){ expect(result).toBeEqualish([2, 3, 0]); });
- });
- });
-
- describe('rotateY', function(){
- describe('rotation around world origin [0, 0, 0]', function(){
- beforeEach(function(){ vecA = [1, 0, 0]; vecB = [0, 0, 0]; result = vec3.rotateY(out, vecA, vecB, Math.PI); });
- it("should return the rotated vector", function(){ expect(result).toBeEqualish([-1, 0, 0]); });
- });
- describe('rotation around an arbitrary origin', function(){
- beforeEach(function(){ vecA = [-2, 3, 10]; vecB = [-4, 3, 10]; result = vec3.rotateY(out, vecA, vecB, Math.PI); });
- it("should return the rotated vector", function(){ expect(result).toBeEqualish([-6, 3, 10]); });
- });
- });
-
- describe('rotateZ', function(){
- describe('rotation around world origin [0, 0, 0]', function(){
- beforeEach(function(){ vecA = [0, 1, 0]; vecB = [0, 0, 0]; result = vec3.rotateZ(out, vecA, vecB, Math.PI); });
- it("should return the rotated vector", function(){ expect(result).toBeEqualish([0, -1, 0]); });
- });
- describe('rotation around an arbitrary origin', function(){
- beforeEach(function(){ vecA = [0, 6, -5]; vecB = [0, 0, -5]; result = vec3.rotateZ(out, vecA, vecB, Math.PI); });
- it("should return the rotated vector", function(){ expect(result).toBeEqualish([0, -6, -5]); });
- });
- });
-
- describe('transformMat4', function() {
- var matr;
- describe("with an identity", function() {
- beforeEach(function() { matr = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ] });
-
- beforeEach(function() { result = vec3.transformMat4(out, vecA, matr); });
-
- it("should produce the input", function() {
- expect(out).toBeEqualish([1, 2, 3]);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("with a lookAt", function() {
- beforeEach(function() { matr = mat4.lookAt(mat4.create(), [5, 6, 7], [2, 6, 7], [0, 1, 0]); });
-
- beforeEach(function() { result = vec3.transformMat4(out, vecA, matr); });
-
- it("should rotate and translate the input", function() {
- expect(out).toBeEqualish([ 4, -4, -4 ]);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("with a perspective matrix (#92)", function() {
- it("should transform a point from perspective(pi/2, 4/3, 1, 100)", function() {
- matr = [0.750, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, -1.02, -1,
- 0, 0, -2.02, 0];
- result = vec3.transformMat4([], [10, 20, 30], matr);
- expect(result).toBeEqualish([-0.25, -0.666666, 1.087333]);
- });
- });
-
- });
-
- describe('transformMat3', function() {
- var matr;
- describe("with an identity", function() {
- beforeEach(function() { matr = [1, 0, 0, 0, 1, 0, 0, 0, 1 ] });
-
- beforeEach(function() { result = vec3.transformMat3(out, vecA, matr); });
-
- it("should produce the input", function() {
- expect(out).toBeEqualish([1, 2, 3]);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("with 90deg about X", function() {
- beforeEach(function() {
- result = vec3.transformMat3(out, [0,1,0], [1,0,0,0,0,1,0,-1,0]);
- });
-
- it("should produce correct output", function() {
- expect(out).toBeEqualish([0,0,1]);
- });
- });
-
- describe("with 90deg about Y", function() {
- beforeEach(function() {
- result = vec3.transformMat3(out, [1,0,0], [0,0,-1,0,1,0,1,0,0]);
- });
-
- it("should produce correct output", function() {
- expect(out).toBeEqualish([0,0,-1]);
- });
- });
-
- describe("with 90deg about Z", function() {
- beforeEach(function() {
- result = vec3.transformMat3(out, [1,0,0], [0,1,0,-1,0,0,0,0,1]);
- });
-
- it("should produce correct output", function() {
- expect(out).toBeEqualish([0,1,0]);
- });
- });
-
- describe("with a lookAt normal matrix", function() {
- beforeEach(function() {
- matr = mat4.lookAt(mat4.create(), [5, 6, 7], [2, 6, 7], [0, 1, 0]);
- var n = mat3.create();
- matr = mat3.transpose(n, mat3.invert(n, mat3.fromMat4(n, matr)));
- });
-
- beforeEach(function() { result = vec3.transformMat3(out, [1,0,0], matr); });
-
- it("should rotate the input", function() {
- expect(out).toBeEqualish([ 0,0,1 ]);
- });
-
- it("should return out", function() { expect(result).toBe(out); });
- });
- });
-
- describe("create", function() {
- beforeEach(function() { result = vec3.create(); });
- it("should return a 3 element array initialized to 0s", function() { expect(result).toBeEqualish([0, 0, 0]); });
- });
-
- describe("clone", function() {
- beforeEach(function() { result = vec3.clone(vecA); });
- it("should return a 3 element array initialized to the values in vecA", function() { expect(result).toBeEqualish(vecA); });
- });
-
- describe("fromValues", function() {
- beforeEach(function() { result = vec3.fromValues(1, 2, 3); });
- it("should return a 3 element array initialized to the values passed", function() { expect(result).toBeEqualish([1, 2, 3]); });
- });
-
- describe("copy", function() {
- beforeEach(function() { result = vec3.copy(out, vecA); });
- it("should place values into out", function() { expect(out).toBeEqualish([1, 2, 3]); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("set", function() {
- beforeEach(function() { result = vec3.set(out, 1, 2, 3); });
- it("should place values into out", function() { expect(out).toBeEqualish([1, 2, 3]); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("add", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec3.add(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([5, 7, 9]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec3.add(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([5, 7, 9]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec3.add(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([5, 7, 9]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- });
- });
-
- describe("subtract", function() {
- it("should have an alias called 'sub'", function() { expect(vec3.sub).toEqual(vec3.subtract); });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec3.subtract(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([-3, -3, -3]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec3.subtract(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([-3, -3, -3]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec3.subtract(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([-3, -3, -3]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- });
- });
-
- describe("multiply", function() {
- it("should have an alias called 'mul'", function() { expect(vec3.mul).toEqual(vec3.multiply); });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec3.multiply(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([4, 10, 18]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec3.multiply(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([4, 10, 18]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec3.multiply(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([4, 10, 18]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- });
- });
-
- describe("divide", function() {
- it("should have an alias called 'div'", function() { expect(vec3.div).toEqual(vec3.divide); });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec3.divide(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([0.25, 0.4, 0.5]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec3.divide(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([0.25, 0.4, 0.5]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec3.divide(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([0.25, 0.4, 0.5]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- });
- });
-
- describe("min", function() {
- beforeEach(function() { vecA = [1, 3, 1]; vecB = [3, 1, 3]; });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec3.min(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([1, 1, 1]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 3, 1]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 1, 3]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec3.min(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([1, 1, 1]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 1, 3]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec3.min(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([1, 1, 1]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 3, 1]); });
- });
- });
-
- describe("max", function() {
- beforeEach(function() { vecA = [1, 3, 1]; vecB = [3, 1, 3]; });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec3.max(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([3, 3, 3]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 3, 1]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 1, 3]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec3.max(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([3, 3, 3]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 1, 3]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec3.max(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([3, 3, 3]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 3, 1]); });
- });
- });
-
- describe("scale", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec3.scale(out, vecA, 2); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([2, 4, 6]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec3.scale(vecA, vecA, 2); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([2, 4, 6]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- });
- });
-
- describe("scaleAndAdd", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec3.scaleAndAdd(out, vecA, vecB, 0.5); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([3, 4.5, 6]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec3.scaleAndAdd(vecA, vecA, vecB, 0.5); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([3, 4.5, 6]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec3.scaleAndAdd(vecB, vecA, vecB, 0.5); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([3, 4.5, 6]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- });
- });
-
- describe("distance", function() {
- it("should have an alias called 'dist'", function() { expect(vec3.dist).toEqual(vec3.distance); });
-
- beforeEach(function() { result = vec3.distance(vecA, vecB); });
-
- it("should return the distance", function() { expect(result).toBeCloseTo(5.196152); });
- });
-
- describe("squaredDistance", function() {
- it("should have an alias called 'sqrDist'", function() { expect(vec3.sqrDist).toEqual(vec3.squaredDistance); });
-
- beforeEach(function() { result = vec3.squaredDistance(vecA, vecB); });
-
- it("should return the squared distance", function() { expect(result).toEqual(27); });
- });
-
- describe("length", function() {
- it("should have an alias called 'len'", function() { expect(vec3.len).toEqual(vec3.length); });
-
- beforeEach(function() { result = vec3.length(vecA); });
-
- it("should return the length", function() { expect(result).toBeCloseTo(3.741657); });
- });
-
- describe("squaredLength", function() {
- it("should have an alias called 'sqrLen'", function() { expect(vec3.sqrLen).toEqual(vec3.squaredLength); });
-
- beforeEach(function() { result = vec3.squaredLength(vecA); });
-
- it("should return the squared length", function() { expect(result).toEqual(14); });
- });
-
- describe("negate", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec3.negate(out, vecA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([-1, -2, -3]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec3.negate(vecA, vecA); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([-1, -2, -3]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- });
- });
-
- describe("normalize", function() {
- beforeEach(function() { vecA = [5, 0, 0]; });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec3.normalize(out, vecA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([1, 0, 0]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([5, 0, 0]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec3.normalize(vecA, vecA); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([1, 0, 0]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- });
- });
-
- describe("dot", function() {
- beforeEach(function() { result = vec3.dot(vecA, vecB); });
-
- it("should return the dot product", function() { expect(result).toEqual(32); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("cross", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec3.cross(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([-3, 6, -3]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec3.cross(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([-3, 6, -3]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec3.cross(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([-3, 6, -3]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- });
- });
-
- describe("lerp", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec3.lerp(out, vecA, vecB, 0.5); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([2.5, 3.5, 4.5]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec3.lerp(vecA, vecA, vecB, 0.5); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([2.5, 3.5, 4.5]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec3.lerp(vecB, vecA, vecB, 0.5); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([2.5, 3.5, 4.5]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- });
- });
-
- describe("random", function() {
- describe("with no scale", function() {
- beforeEach(function() { result = vec3.random(out); });
-
- it("should result in a unit length vector", function() { expect(vec3.length(out)).toBeCloseTo(1.0); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("with a scale", function() {
- beforeEach(function() { result = vec3.random(out, 5.0); });
-
- it("should result in a unit length vector", function() { expect(vec3.length(out)).toBeCloseTo(5.0); });
- it("should return out", function() { expect(result).toBe(out); });
- });
- });
-
- describe("forEach", function() {
- var vecArray;
-
- beforeEach(function() {
- vecArray = [
- 1, 2, 3,
- 4, 5, 6,
- 0, 0, 0
- ];
- });
-
- describe("when performing operations that take no extra arguments", function() {
- beforeEach(function() { result = vec3.forEach(vecArray, 0, 0, 0, vec3.normalize); });
-
- it("should update all values", function() {
- expect(vecArray).toBeEqualish([
- 0.267261, 0.534522, 0.801783,
- 0.455842, 0.569802, 0.683763,
- 0, 0, 0
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- });
-
- describe("when performing operations that takes one extra arguments", function() {
- beforeEach(function() { result = vec3.forEach(vecArray, 0, 0, 0, vec3.add, vecA); });
-
- it("should update all values", function() {
- expect(vecArray).toBeEqualish([
- 2, 4, 6,
- 5, 7, 9,
- 1, 2, 3
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- });
-
- describe("when specifying an offset", function() {
- beforeEach(function() { result = vec3.forEach(vecArray, 0, 3, 0, vec3.add, vecA); });
-
- it("should update all values except the first vector", function() {
- expect(vecArray).toBeEqualish([
- 1, 2, 3,
- 5, 7, 9,
- 1, 2, 3
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- });
-
- describe("when specifying a count", function() {
- beforeEach(function() { result = vec3.forEach(vecArray, 0, 0, 2, vec3.add, vecA); });
-
- it("should update all values except the last vector", function() {
- expect(vecArray).toBeEqualish([
- 2, 4, 6,
- 5, 7, 9,
- 0, 0, 0
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- });
-
- describe("when specifying a stride", function() {
- beforeEach(function() { result = vec3.forEach(vecArray, 6, 0, 0, vec3.add, vecA); });
-
- it("should update all values except the second vector", function() {
- expect(vecArray).toBeEqualish([
- 2, 4, 6,
- 4, 5, 6,
- 1, 2, 3
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- });
-
- describe("when calling a function that does not modify the out variable", function() {
- beforeEach(function() {
- result = vec3.forEach(vecArray, 0, 0, 0, function(out, vec) {});
- });
-
- it("values should remain unchanged", function() {
- expect(vecArray).toBeEqualish([
- 1, 2, 3,
- 4, 5, 6,
- 0, 0, 0
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- });
- });
-
- describe("angle", function() {
- beforeEach(function() { result = vec3.angle(vecA, vecB); });
-
- it("should return the angle", function() { expect(result).toBeEqualish(0.225726); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([4, 5, 6]); });
- });
-
- describe("str", function() {
- beforeEach(function() { result = vec3.str(vecA); });
-
- it("should return a string representation of the vector", function() { expect(result).toEqual("vec3(1, 2, 3)"); });
- });
-});
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/vec4-spec.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/vec4-spec.js
deleted file mode 100644
index 0c65908cb4a..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/vec4-spec.js
+++ /dev/null
@@ -1,492 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-describe("vec4", function() {
- var vec3 = require("../../src/gl-matrix/vec3.js");
- var vec4 = require("../../src/gl-matrix/vec4.js");
-
- var out, vecA, vecB, result;
-
- beforeEach(function() { vecA = [1, 2, 3, 4]; vecB = [5, 6, 7, 8]; out = [0, 0, 0, 0]; });
-
- describe("create", function() {
- beforeEach(function() { result = vec4.create(); });
- it("should return a 4 element array initialized to 0s", function() { expect(result).toBeEqualish([0, 0, 0, 0]); });
- });
-
- describe("clone", function() {
- beforeEach(function() { result = vec4.clone(vecA); });
- it("should return a 4 element array initialized to the values in vecA", function() { expect(result).toBeEqualish(vecA); });
- });
-
- describe("fromValues", function() {
- beforeEach(function() { result = vec4.fromValues(1, 2, 3, 4); });
- it("should return a 4 element array initialized to the values passed", function() { expect(result).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("copy", function() {
- beforeEach(function() { result = vec4.copy(out, vecA); });
- it("should place values into out", function() { expect(out).toBeEqualish([1, 2, 3, 4]); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("set", function() {
- beforeEach(function() { result = vec4.set(out, 1, 2, 3, 4); });
- it("should place values into out", function() { expect(out).toBeEqualish([1, 2, 3, 4]); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("add", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec4.add(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([6, 8, 10, 12]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec4.add(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([6, 8, 10, 12]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec4.add(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([6, 8, 10, 12]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- });
- });
-
- describe("subtract", function() {
- it("should have an alias called 'sub'", function() { expect(vec4.sub).toEqual(vec4.subtract); });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec4.subtract(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([-4, -4, -4, -4]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec4.subtract(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([-4, -4, -4, -4]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec4.subtract(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([-4, -4, -4, -4]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- });
- });
-
- describe("multiply", function() {
- it("should have an alias called 'mul'", function() { expect(vec4.mul).toEqual(vec4.multiply); });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec4.multiply(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([5, 12, 21, 32]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec4.multiply(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([5, 12, 21, 32]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec4.multiply(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([5, 12, 21, 32]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- });
- });
-
- describe("divide", function() {
- it("should have an alias called 'div'", function() { expect(vec4.div).toEqual(vec4.divide); });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec4.divide(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([0.2, 0.333333, 0.428571, 0.5]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec4.divide(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([0.2, 0.333333, 0.428571, 0.5]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec4.divide(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([0.2, 0.333333, 0.428571, 0.5]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- });
- });
-
- describe("min", function() {
- beforeEach(function() { vecA = [1, 3, 1, 3]; vecB = [3, 1, 3, 1]; });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec4.min(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([1, 1, 1, 1]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 3, 1, 3]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 1, 3, 1]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec4.min(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([1, 1, 1, 1]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 1, 3, 1]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec4.min(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([1, 1, 1, 1]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 3, 1, 3]); });
- });
- });
-
- describe("max", function() {
- beforeEach(function() { vecA = [1, 3, 1, 3]; vecB = [3, 1, 3, 1]; });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec4.max(out, vecA, vecB); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([3, 3, 3, 3]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 3, 1, 3]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 1, 3, 1]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec4.max(vecA, vecA, vecB); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([3, 3, 3, 3]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([3, 1, 3, 1]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec4.max(vecB, vecA, vecB); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([3, 3, 3, 3]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 3, 1, 3]); });
- });
- });
-
- describe("scale", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec4.scale(out, vecA, 2); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([2, 4, 6, 8]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec4.scale(vecA, vecA, 2); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([2, 4, 6, 8]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- });
- });
-
- describe("scaleAndAdd", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec4.scaleAndAdd(out, vecA, vecB, 0.5); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([3.5, 5, 6.5, 8]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec4.scaleAndAdd(vecA, vecA, vecB, 0.5); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([3.5, 5, 6.5, 8]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec4.scaleAndAdd(vecB, vecA, vecB, 0.5); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([3.5, 5, 6.5, 8]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- });
- });
-
- describe("distance", function() {
- it("should have an alias called 'dist'", function() { expect(vec4.dist).toEqual(vec4.distance); });
-
- beforeEach(function() { result = vec4.distance(vecA, vecB); });
-
- it("should return the distance", function() { expect(result).toBeCloseTo(8); });
- });
-
- describe("squaredDistance", function() {
- it("should have an alias called 'sqrDist'", function() { expect(vec4.sqrDist).toEqual(vec4.squaredDistance); });
-
- beforeEach(function() { result = vec4.squaredDistance(vecA, vecB); });
-
- it("should return the squared distance", function() { expect(result).toEqual(64); });
- });
-
- describe("length", function() {
- it("should have an alias called 'len'", function() { expect(vec4.len).toEqual(vec4.length); });
-
- beforeEach(function() { result = vec4.length(vecA); });
-
- it("should return the length", function() { expect(result).toBeCloseTo(5.477225); });
- });
-
- describe("squaredLength", function() {
- it("should have an alias called 'sqrLen'", function() { expect(vec4.sqrLen).toEqual(vec4.squaredLength); });
-
- beforeEach(function() { result = vec4.squaredLength(vecA); });
-
- it("should return the squared length", function() { expect(result).toEqual(30); });
- });
-
- describe("negate", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec4.negate(out, vecA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([-1, -2, -3, -4]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec4.negate(vecA, vecA); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([-1, -2, -3, -4]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- });
- });
-
- describe("normalize", function() {
- beforeEach(function() { vecA = [5, 0, 0, 0]; });
-
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec4.normalize(out, vecA); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([1, 0, 0, 0]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([5, 0, 0, 0]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec4.normalize(vecA, vecA); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([1, 0, 0, 0]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- });
- });
-
- describe("dot", function() {
- beforeEach(function() { result = vec4.dot(vecA, vecB); });
-
- it("should return the dot product", function() { expect(result).toEqual(70); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("lerp", function() {
- describe("with a separate output vector", function() {
- beforeEach(function() { result = vec4.lerp(out, vecA, vecB, 0.5); });
-
- it("should place values into out", function() { expect(out).toBeEqualish([3, 4, 5, 6]); });
- it("should return out", function() { expect(result).toBe(out); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when vecA is the output vector", function() {
- beforeEach(function() { result = vec4.lerp(vecA, vecA, vecB, 0.5); });
-
- it("should place values into vecA", function() { expect(vecA).toBeEqualish([3, 4, 5, 6]); });
- it("should return vecA", function() { expect(result).toBe(vecA); });
- it("should not modify vecB", function() { expect(vecB).toBeEqualish([5, 6, 7, 8]); });
- });
-
- describe("when vecB is the output vector", function() {
- beforeEach(function() { result = vec4.lerp(vecB, vecA, vecB, 0.5); });
-
- it("should place values into vecB", function() { expect(vecB).toBeEqualish([3, 4, 5, 6]); });
- it("should return vecB", function() { expect(result).toBe(vecB); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- });
- });
-
- describe("random", function() {
- describe("with no scale", function() {
- beforeEach(function() { result = vec4.random(out); });
-
- it("should result in a unit length vector", function() { expect(vec4.length(out)).toBeCloseTo(1.0); });
- it("should return out", function() { expect(result).toBe(out); });
- });
-
- describe("with a scale", function() {
- beforeEach(function() { result = vec4.random(out, 5.0); });
-
- it("should result in a unit length vector", function() { expect(vec4.length(out)).toBeCloseTo(5.0); });
- it("should return out", function() { expect(result).toBe(out); });
- });
- });
-
- describe("forEach", function() {
- var vecArray;
-
- beforeEach(function() {
- vecArray = [
- 1, 2, 3, 4,
- 5, 6, 7, 8,
- 0, 0, 0, 0
- ];
- });
-
- describe("when performing operations that take no extra arguments", function() {
- beforeEach(function() { result = vec4.forEach(vecArray, 0, 0, 0, vec4.normalize); });
-
- it("should update all values", function() {
- expect(vecArray).toBeEqualish([
- 0.182574, 0.365148, 0.547722, 0.730296,
- 0.379049, 0.454858, 0.530668, 0.606478,
- 0, 0, 0, 0
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- });
-
- describe("when performing operations that takes one extra arguments", function() {
- beforeEach(function() { result = vec4.forEach(vecArray, 0, 0, 0, vec4.add, vecA); });
-
- it("should update all values", function() {
- expect(vecArray).toBeEqualish([
- 2, 4, 6, 8,
- 6, 8, 10, 12,
- 1, 2, 3, 4
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("when specifying an offset", function() {
- beforeEach(function() { result = vec4.forEach(vecArray, 0, 4, 0, vec4.add, vecA); });
-
- it("should update all values except the first vector", function() {
- expect(vecArray).toBeEqualish([
- 1, 2, 3, 4,
- 6, 8, 10, 12,
- 1, 2, 3, 4
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("when specifying a count", function() {
- beforeEach(function() { result = vec4.forEach(vecArray, 0, 0, 2, vec4.add, vecA); });
-
- it("should update all values except the last vector", function() {
- expect(vecArray).toBeEqualish([
- 2, 4, 6, 8,
- 6, 8, 10, 12,
- 0, 0, 0, 0
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("when specifying a stride", function() {
- beforeEach(function() { result = vec4.forEach(vecArray, 8, 0, 0, vec4.add, vecA); });
-
- it("should update all values except the second vector", function() {
- expect(vecArray).toBeEqualish([
- 2, 4, 6, 8,
- 5, 6, 7, 8,
- 1, 2, 3, 4
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- it("should not modify vecA", function() { expect(vecA).toBeEqualish([1, 2, 3, 4]); });
- });
-
- describe("when calling a function that does not modify the out variable", function() {
- beforeEach(function() {
- result = vec3.forEach(vecArray, 0, 0, 0, function(out, vec) {});
- });
-
- it("values should remain unchanged", function() {
- expect(vecArray).toBeEqualish([
- 1, 2, 3, 4,
- 5, 6, 7, 8,
- 0, 0, 0, 0
- ]);
- });
- it("should return vecArray", function() { expect(result).toBe(vecArray); });
- });
- });
-
- describe("str", function() {
- beforeEach(function() { result = vec4.str(vecA); });
-
- it("should return a string representation of the vector", function() { expect(result).toEqual("vec4(1, 2, 3, 4)"); });
- });
-});
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/worker-spec.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/worker-spec.js
deleted file mode 100644
index 8b1754f4db1..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/gl-matrix/worker-spec.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* spec tests gl-matrix when embedded into a Web Worker */
-
-// only test with workers if workers are available
-if (typeof(Worker) !== 'undefined') {
- describe("Embedded within Web Workers", function() {
- it("should initialize successfully", function() {
- var xhr = new XMLHttpRequest();
- var source = null;
- xhr.onreadystatechange = function() {
- if (this.readyState == this.DONE) {
- if (this.status == 200) {
- source = this.responseText;
- }
- }
- };
- xhr.open("GET", "/dist/gl-matrix-min.js");
- xhr.send();
-
- var result = null;
-
- waitsFor(function() {
- if (!source) return false;
- var blob = new Blob([
- source,
- "self.postMessage(vec3.create());"
- ],
- {type: "application/javascript"}
- );
-
- var worker = new Worker(URL.createObjectURL(blob));
- worker.onmessage = function(e) {
- result = e.data;
- };
- return true;
- });
-
- waitsFor(function() {
- if (!result) return false;
- expect(result).toBeEqualish([0, 0, 0]);
- return true;
- });
- });
- });
-}
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/helpers/spec-helper.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/helpers/spec-helper.js
deleted file mode 100644
index 58e36714505..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/helpers/spec-helper.js
+++ /dev/null
@@ -1,32 +0,0 @@
-var HELPER_MATCHERS = (function() {
- var EPSILON = 0.00001;
-
- return {
- /*
- Returns true if `actual` has the same length as `expected`, and
- if each element of both arrays is within 0.000001 of each other.
- This is a way to check for "equal enough" conditions, as a way
- of working around floating point imprecision.
- */
- toBeEqualish: function(expected) {
- if (typeof(this.actual) == 'number')
- return Math.abs(this.actual - expected) < EPSILON;
-
- if (this.actual.length != expected.length) return false;
- for (var i = 0; i < this.actual.length; i++) {
- if (isNaN(this.actual[i]) !== isNaN(expected[i]))
- return false;
- if (Math.abs(this.actual[i] - expected[i]) >= EPSILON)
- return false;
- }
- return true;
- }
- };
-})();
-
-beforeEach(function() {
- this.addMatchers(HELPER_MATCHERS);
-});
-
-if (typeof(global) != 'undefined')
- global.HELPER_MATCHERS = HELPER_MATCHERS;
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/jasmine.yml b/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/jasmine.yml
deleted file mode 100644
index afb56ec62c9..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/spec/jasmine.yml
+++ /dev/null
@@ -1,74 +0,0 @@
-# src_files
-#
-# Return an array of filepaths relative to src_dir to include before jasmine specs.
-# Default: []
-#
-# EXAMPLE:
-#
-# src_files:
-# - lib/source1.js
-# - lib/source2.js
-# - dist/**/*.js
-#
-src_files:
- - src/gl-matrix.js
- - src/gl-matrix/common.js
-
-# stylesheets
-#
-# Return an array of stylesheet filepaths relative to src_dir to include before jasmine specs.
-# Default: []
-#
-# EXAMPLE:
-#
-# stylesheets:
-# - css/style.css
-# - stylesheets/*.css
-#
-stylesheets:
-
-# helpers
-#
-# Return an array of filepaths relative to spec_dir to include before jasmine specs.
-# Default: ["helpers/**/*.js"]
-#
-# EXAMPLE:
-#
-# helpers:
-# - helpers/**/*.js
-#
-helpers:
-
-# spec_files
-#
-# Return an array of filepaths relative to spec_dir to include.
-# Default: ["**/*[sS]pec.js"]
-#
-# EXAMPLE:
-#
-# spec_files:
-# - **/*[sS]pec.js
-#
-spec_files:
-
-# src_dir
-#
-# Source directory path. Your src_files must be returned relative to this path. Will use root if left blank.
-# Default: project root
-#
-# EXAMPLE:
-#
-# src_dir: public
-#
-src_dir:
-
-# spec_dir
-#
-# Spec directory path. Your spec_files must be returned relative to this path.
-# Default: spec/javascripts
-#
-# EXAMPLE:
-#
-# spec_dir: spec/javascripts
-#
-spec_dir: spec
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix.js
deleted file mode 100644
index da4fe60dfd2..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * @fileoverview gl-matrix - High performance matrix and vector operations
- * @author Brandon Jones
- * @author Colin MacKenzie IV
- * @version 2.3.1
- */
-
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-// END HEADER
-
-exports.glMatrix = require("./gl-matrix/common.js");
-exports.mat2 = require("./gl-matrix/mat2.js");
-exports.mat2d = require("./gl-matrix/mat2d.js");
-exports.mat3 = require("./gl-matrix/mat3.js");
-exports.mat4 = require("./gl-matrix/mat4.js");
-exports.quat = require("./gl-matrix/quat.js");
-exports.vec2 = require("./gl-matrix/vec2.js");
-exports.vec3 = require("./gl-matrix/vec3.js");
-exports.vec4 = require("./gl-matrix/vec4.js"); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/common.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/common.js
deleted file mode 100644
index 5253421532e..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/common.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-/**
- * @class Common utilities
- * @name glMatrix
- */
-var glMatrix = {};
-
-// Constants
-glMatrix.EPSILON = 0.000001;
-glMatrix.ARRAY_TYPE = (typeof Float32Array !== 'undefined') ? Float32Array : Array;
-glMatrix.RANDOM = Math.random;
-
-/**
- * Sets the type of array used when creating new vectors and matrices
- *
- * @param {Type} type Array type, such as Float32Array or Array
- */
-glMatrix.setMatrixArrayType = function(type) {
- GLMAT_ARRAY_TYPE = type;
-}
-
-var degree = Math.PI / 180;
-
-/**
-* Convert Degree To Radian
-*
-* @param {Number} Angle in Degrees
-*/
-glMatrix.toRadian = function(a){
- return a * degree;
-}
-
-module.exports = glMatrix;
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat2.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat2.js
deleted file mode 100644
index 012a5c1af6b..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat2.js
+++ /dev/null
@@ -1,302 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-var glMatrix = require("./common.js");
-
-/**
- * @class 2x2 Matrix
- * @name mat2
- */
-var mat2 = {};
-
-/**
- * Creates a new identity mat2
- *
- * @returns {mat2} a new 2x2 matrix
- */
-mat2.create = function() {
- var out = new glMatrix.ARRAY_TYPE(4);
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- return out;
-};
-
-/**
- * Creates a new mat2 initialized with values from an existing matrix
- *
- * @param {mat2} a matrix to clone
- * @returns {mat2} a new 2x2 matrix
- */
-mat2.clone = function(a) {
- var out = new glMatrix.ARRAY_TYPE(4);
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- return out;
-};
-
-/**
- * Copy the values from one mat2 to another
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the source matrix
- * @returns {mat2} out
- */
-mat2.copy = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- return out;
-};
-
-/**
- * Set a mat2 to the identity matrix
- *
- * @param {mat2} out the receiving matrix
- * @returns {mat2} out
- */
-mat2.identity = function(out) {
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- return out;
-};
-
-/**
- * Transpose the values of a mat2
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the source matrix
- * @returns {mat2} out
- */
-mat2.transpose = function(out, a) {
- // If we are transposing ourselves we can skip a few steps but have to cache some values
- if (out === a) {
- var a1 = a[1];
- out[1] = a[2];
- out[2] = a1;
- } else {
- out[0] = a[0];
- out[1] = a[2];
- out[2] = a[1];
- out[3] = a[3];
- }
-
- return out;
-};
-
-/**
- * Inverts a mat2
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the source matrix
- * @returns {mat2} out
- */
-mat2.invert = function(out, a) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],
-
- // Calculate the determinant
- det = a0 * a3 - a2 * a1;
-
- if (!det) {
- return null;
- }
- det = 1.0 / det;
-
- out[0] = a3 * det;
- out[1] = -a1 * det;
- out[2] = -a2 * det;
- out[3] = a0 * det;
-
- return out;
-};
-
-/**
- * Calculates the adjugate of a mat2
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the source matrix
- * @returns {mat2} out
- */
-mat2.adjoint = function(out, a) {
- // Caching this value is nessecary if out == a
- var a0 = a[0];
- out[0] = a[3];
- out[1] = -a[1];
- out[2] = -a[2];
- out[3] = a0;
-
- return out;
-};
-
-/**
- * Calculates the determinant of a mat2
- *
- * @param {mat2} a the source matrix
- * @returns {Number} determinant of a
- */
-mat2.determinant = function (a) {
- return a[0] * a[3] - a[2] * a[1];
-};
-
-/**
- * Multiplies two mat2's
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the first operand
- * @param {mat2} b the second operand
- * @returns {mat2} out
- */
-mat2.multiply = function (out, a, b) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3];
- var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];
- out[0] = a0 * b0 + a2 * b1;
- out[1] = a1 * b0 + a3 * b1;
- out[2] = a0 * b2 + a2 * b3;
- out[3] = a1 * b2 + a3 * b3;
- return out;
-};
-
-/**
- * Alias for {@link mat2.multiply}
- * @function
- */
-mat2.mul = mat2.multiply;
-
-/**
- * Rotates a mat2 by the given angle
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the matrix to rotate
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat2} out
- */
-mat2.rotate = function (out, a, rad) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],
- s = Math.sin(rad),
- c = Math.cos(rad);
- out[0] = a0 * c + a2 * s;
- out[1] = a1 * c + a3 * s;
- out[2] = a0 * -s + a2 * c;
- out[3] = a1 * -s + a3 * c;
- return out;
-};
-
-/**
- * Scales the mat2 by the dimensions in the given vec2
- *
- * @param {mat2} out the receiving matrix
- * @param {mat2} a the matrix to rotate
- * @param {vec2} v the vec2 to scale the matrix by
- * @returns {mat2} out
- **/
-mat2.scale = function(out, a, v) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],
- v0 = v[0], v1 = v[1];
- out[0] = a0 * v0;
- out[1] = a1 * v0;
- out[2] = a2 * v1;
- out[3] = a3 * v1;
- return out;
-};
-
-/**
- * Creates a matrix from a given angle
- * This is equivalent to (but much faster than):
- *
- * mat2.identity(dest);
- * mat2.rotate(dest, dest, rad);
- *
- * @param {mat2} out mat2 receiving operation result
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat2} out
- */
-mat2.fromRotation = function(out, rad) {
- var s = Math.sin(rad),
- c = Math.cos(rad);
- out[0] = c;
- out[1] = s;
- out[2] = -s;
- out[3] = c;
- return out;
-}
-
-/**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat2.identity(dest);
- * mat2.scale(dest, dest, vec);
- *
- * @param {mat2} out mat2 receiving operation result
- * @param {vec2} v Scaling vector
- * @returns {mat2} out
- */
-mat2.fromScaling = function(out, v) {
- out[0] = v[0];
- out[1] = 0;
- out[2] = 0;
- out[3] = v[1];
- return out;
-}
-
-/**
- * Returns a string representation of a mat2
- *
- * @param {mat2} mat matrix to represent as a string
- * @returns {String} string representation of the matrix
- */
-mat2.str = function (a) {
- return 'mat2(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';
-};
-
-/**
- * Returns Frobenius norm of a mat2
- *
- * @param {mat2} a the matrix to calculate Frobenius norm of
- * @returns {Number} Frobenius norm
- */
-mat2.frob = function (a) {
- return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2)))
-};
-
-/**
- * Returns L, D and U matrices (Lower triangular, Diagonal and Upper triangular) by factorizing the input matrix
- * @param {mat2} L the lower triangular matrix
- * @param {mat2} D the diagonal matrix
- * @param {mat2} U the upper triangular matrix
- * @param {mat2} a the input matrix to factorize
- */
-
-mat2.LDU = function (L, D, U, a) {
- L[2] = a[2]/a[0];
- U[0] = a[0];
- U[1] = a[1];
- U[3] = a[3] - L[2] * U[1];
- return [L, D, U];
-};
-
-
-module.exports = mat2;
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat2d.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat2d.js
deleted file mode 100644
index df3a0e6a0b3..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat2d.js
+++ /dev/null
@@ -1,317 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-var glMatrix = require("./common.js");
-
-/**
- * @class 2x3 Matrix
- * @name mat2d
- *
- * @description
- * A mat2d contains six elements defined as:
- * <pre>
- * [a, c, tx,
- * b, d, ty]
- * </pre>
- * This is a short form for the 3x3 matrix:
- * <pre>
- * [a, c, tx,
- * b, d, ty,
- * 0, 0, 1]
- * </pre>
- * The last row is ignored so the array is shorter and operations are faster.
- */
-var mat2d = {};
-
-/**
- * Creates a new identity mat2d
- *
- * @returns {mat2d} a new 2x3 matrix
- */
-mat2d.create = function() {
- var out = new glMatrix.ARRAY_TYPE(6);
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- out[4] = 0;
- out[5] = 0;
- return out;
-};
-
-/**
- * Creates a new mat2d initialized with values from an existing matrix
- *
- * @param {mat2d} a matrix to clone
- * @returns {mat2d} a new 2x3 matrix
- */
-mat2d.clone = function(a) {
- var out = new glMatrix.ARRAY_TYPE(6);
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- out[4] = a[4];
- out[5] = a[5];
- return out;
-};
-
-/**
- * Copy the values from one mat2d to another
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the source matrix
- * @returns {mat2d} out
- */
-mat2d.copy = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- out[4] = a[4];
- out[5] = a[5];
- return out;
-};
-
-/**
- * Set a mat2d to the identity matrix
- *
- * @param {mat2d} out the receiving matrix
- * @returns {mat2d} out
- */
-mat2d.identity = function(out) {
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- out[4] = 0;
- out[5] = 0;
- return out;
-};
-
-/**
- * Inverts a mat2d
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the source matrix
- * @returns {mat2d} out
- */
-mat2d.invert = function(out, a) {
- var aa = a[0], ab = a[1], ac = a[2], ad = a[3],
- atx = a[4], aty = a[5];
-
- var det = aa * ad - ab * ac;
- if(!det){
- return null;
- }
- det = 1.0 / det;
-
- out[0] = ad * det;
- out[1] = -ab * det;
- out[2] = -ac * det;
- out[3] = aa * det;
- out[4] = (ac * aty - ad * atx) * det;
- out[5] = (ab * atx - aa * aty) * det;
- return out;
-};
-
-/**
- * Calculates the determinant of a mat2d
- *
- * @param {mat2d} a the source matrix
- * @returns {Number} determinant of a
- */
-mat2d.determinant = function (a) {
- return a[0] * a[3] - a[1] * a[2];
-};
-
-/**
- * Multiplies two mat2d's
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the first operand
- * @param {mat2d} b the second operand
- * @returns {mat2d} out
- */
-mat2d.multiply = function (out, a, b) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],
- b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3], b4 = b[4], b5 = b[5];
- out[0] = a0 * b0 + a2 * b1;
- out[1] = a1 * b0 + a3 * b1;
- out[2] = a0 * b2 + a2 * b3;
- out[3] = a1 * b2 + a3 * b3;
- out[4] = a0 * b4 + a2 * b5 + a4;
- out[5] = a1 * b4 + a3 * b5 + a5;
- return out;
-};
-
-/**
- * Alias for {@link mat2d.multiply}
- * @function
- */
-mat2d.mul = mat2d.multiply;
-
-/**
- * Rotates a mat2d by the given angle
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the matrix to rotate
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat2d} out
- */
-mat2d.rotate = function (out, a, rad) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],
- s = Math.sin(rad),
- c = Math.cos(rad);
- out[0] = a0 * c + a2 * s;
- out[1] = a1 * c + a3 * s;
- out[2] = a0 * -s + a2 * c;
- out[3] = a1 * -s + a3 * c;
- out[4] = a4;
- out[5] = a5;
- return out;
-};
-
-/**
- * Scales the mat2d by the dimensions in the given vec2
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the matrix to translate
- * @param {vec2} v the vec2 to scale the matrix by
- * @returns {mat2d} out
- **/
-mat2d.scale = function(out, a, v) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],
- v0 = v[0], v1 = v[1];
- out[0] = a0 * v0;
- out[1] = a1 * v0;
- out[2] = a2 * v1;
- out[3] = a3 * v1;
- out[4] = a4;
- out[5] = a5;
- return out;
-};
-
-/**
- * Translates the mat2d by the dimensions in the given vec2
- *
- * @param {mat2d} out the receiving matrix
- * @param {mat2d} a the matrix to translate
- * @param {vec2} v the vec2 to translate the matrix by
- * @returns {mat2d} out
- **/
-mat2d.translate = function(out, a, v) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], a4 = a[4], a5 = a[5],
- v0 = v[0], v1 = v[1];
- out[0] = a0;
- out[1] = a1;
- out[2] = a2;
- out[3] = a3;
- out[4] = a0 * v0 + a2 * v1 + a4;
- out[5] = a1 * v0 + a3 * v1 + a5;
- return out;
-};
-
-/**
- * Creates a matrix from a given angle
- * This is equivalent to (but much faster than):
- *
- * mat2d.identity(dest);
- * mat2d.rotate(dest, dest, rad);
- *
- * @param {mat2d} out mat2d receiving operation result
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat2d} out
- */
-mat2d.fromRotation = function(out, rad) {
- var s = Math.sin(rad), c = Math.cos(rad);
- out[0] = c;
- out[1] = s;
- out[2] = -s;
- out[3] = c;
- out[4] = 0;
- out[5] = 0;
- return out;
-}
-
-/**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat2d.identity(dest);
- * mat2d.scale(dest, dest, vec);
- *
- * @param {mat2d} out mat2d receiving operation result
- * @param {vec2} v Scaling vector
- * @returns {mat2d} out
- */
-mat2d.fromScaling = function(out, v) {
- out[0] = v[0];
- out[1] = 0;
- out[2] = 0;
- out[3] = v[1];
- out[4] = 0;
- out[5] = 0;
- return out;
-}
-
-/**
- * Creates a matrix from a vector translation
- * This is equivalent to (but much faster than):
- *
- * mat2d.identity(dest);
- * mat2d.translate(dest, dest, vec);
- *
- * @param {mat2d} out mat2d receiving operation result
- * @param {vec2} v Translation vector
- * @returns {mat2d} out
- */
-mat2d.fromTranslation = function(out, v) {
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- out[4] = v[0];
- out[5] = v[1];
- return out;
-}
-
-/**
- * Returns a string representation of a mat2d
- *
- * @param {mat2d} a matrix to represent as a string
- * @returns {String} string representation of the matrix
- */
-mat2d.str = function (a) {
- return 'mat2d(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' +
- a[3] + ', ' + a[4] + ', ' + a[5] + ')';
-};
-
-/**
- * Returns Frobenius norm of a mat2d
- *
- * @param {mat2d} a the matrix to calculate Frobenius norm of
- * @returns {Number} Frobenius norm
- */
-mat2d.frob = function (a) {
- return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + 1))
-};
-
-module.exports = mat2d;
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat3.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat3.js
deleted file mode 100644
index bdda05ef020..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat3.js
+++ /dev/null
@@ -1,565 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-var glMatrix = require("./common.js");
-
-/**
- * @class 3x3 Matrix
- * @name mat3
- */
-var mat3 = {};
-
-/**
- * Creates a new identity mat3
- *
- * @returns {mat3} a new 3x3 matrix
- */
-mat3.create = function() {
- var out = new glMatrix.ARRAY_TYPE(9);
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 1;
- out[5] = 0;
- out[6] = 0;
- out[7] = 0;
- out[8] = 1;
- return out;
-};
-
-/**
- * Copies the upper-left 3x3 values into the given mat3.
- *
- * @param {mat3} out the receiving 3x3 matrix
- * @param {mat4} a the source 4x4 matrix
- * @returns {mat3} out
- */
-mat3.fromMat4 = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[4];
- out[4] = a[5];
- out[5] = a[6];
- out[6] = a[8];
- out[7] = a[9];
- out[8] = a[10];
- return out;
-};
-
-/**
- * Creates a new mat3 initialized with values from an existing matrix
- *
- * @param {mat3} a matrix to clone
- * @returns {mat3} a new 3x3 matrix
- */
-mat3.clone = function(a) {
- var out = new glMatrix.ARRAY_TYPE(9);
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- out[4] = a[4];
- out[5] = a[5];
- out[6] = a[6];
- out[7] = a[7];
- out[8] = a[8];
- return out;
-};
-
-/**
- * Copy the values from one mat3 to another
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the source matrix
- * @returns {mat3} out
- */
-mat3.copy = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- out[4] = a[4];
- out[5] = a[5];
- out[6] = a[6];
- out[7] = a[7];
- out[8] = a[8];
- return out;
-};
-
-/**
- * Set a mat3 to the identity matrix
- *
- * @param {mat3} out the receiving matrix
- * @returns {mat3} out
- */
-mat3.identity = function(out) {
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 1;
- out[5] = 0;
- out[6] = 0;
- out[7] = 0;
- out[8] = 1;
- return out;
-};
-
-/**
- * Transpose the values of a mat3
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the source matrix
- * @returns {mat3} out
- */
-mat3.transpose = function(out, a) {
- // If we are transposing ourselves we can skip a few steps but have to cache some values
- if (out === a) {
- var a01 = a[1], a02 = a[2], a12 = a[5];
- out[1] = a[3];
- out[2] = a[6];
- out[3] = a01;
- out[5] = a[7];
- out[6] = a02;
- out[7] = a12;
- } else {
- out[0] = a[0];
- out[1] = a[3];
- out[2] = a[6];
- out[3] = a[1];
- out[4] = a[4];
- out[5] = a[7];
- out[6] = a[2];
- out[7] = a[5];
- out[8] = a[8];
- }
-
- return out;
-};
-
-/**
- * Inverts a mat3
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the source matrix
- * @returns {mat3} out
- */
-mat3.invert = function(out, a) {
- var a00 = a[0], a01 = a[1], a02 = a[2],
- a10 = a[3], a11 = a[4], a12 = a[5],
- a20 = a[6], a21 = a[7], a22 = a[8],
-
- b01 = a22 * a11 - a12 * a21,
- b11 = -a22 * a10 + a12 * a20,
- b21 = a21 * a10 - a11 * a20,
-
- // Calculate the determinant
- det = a00 * b01 + a01 * b11 + a02 * b21;
-
- if (!det) {
- return null;
- }
- det = 1.0 / det;
-
- out[0] = b01 * det;
- out[1] = (-a22 * a01 + a02 * a21) * det;
- out[2] = (a12 * a01 - a02 * a11) * det;
- out[3] = b11 * det;
- out[4] = (a22 * a00 - a02 * a20) * det;
- out[5] = (-a12 * a00 + a02 * a10) * det;
- out[6] = b21 * det;
- out[7] = (-a21 * a00 + a01 * a20) * det;
- out[8] = (a11 * a00 - a01 * a10) * det;
- return out;
-};
-
-/**
- * Calculates the adjugate of a mat3
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the source matrix
- * @returns {mat3} out
- */
-mat3.adjoint = function(out, a) {
- var a00 = a[0], a01 = a[1], a02 = a[2],
- a10 = a[3], a11 = a[4], a12 = a[5],
- a20 = a[6], a21 = a[7], a22 = a[8];
-
- out[0] = (a11 * a22 - a12 * a21);
- out[1] = (a02 * a21 - a01 * a22);
- out[2] = (a01 * a12 - a02 * a11);
- out[3] = (a12 * a20 - a10 * a22);
- out[4] = (a00 * a22 - a02 * a20);
- out[5] = (a02 * a10 - a00 * a12);
- out[6] = (a10 * a21 - a11 * a20);
- out[7] = (a01 * a20 - a00 * a21);
- out[8] = (a00 * a11 - a01 * a10);
- return out;
-};
-
-/**
- * Calculates the determinant of a mat3
- *
- * @param {mat3} a the source matrix
- * @returns {Number} determinant of a
- */
-mat3.determinant = function (a) {
- var a00 = a[0], a01 = a[1], a02 = a[2],
- a10 = a[3], a11 = a[4], a12 = a[5],
- a20 = a[6], a21 = a[7], a22 = a[8];
-
- return a00 * (a22 * a11 - a12 * a21) + a01 * (-a22 * a10 + a12 * a20) + a02 * (a21 * a10 - a11 * a20);
-};
-
-/**
- * Multiplies two mat3's
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the first operand
- * @param {mat3} b the second operand
- * @returns {mat3} out
- */
-mat3.multiply = function (out, a, b) {
- var a00 = a[0], a01 = a[1], a02 = a[2],
- a10 = a[3], a11 = a[4], a12 = a[5],
- a20 = a[6], a21 = a[7], a22 = a[8],
-
- b00 = b[0], b01 = b[1], b02 = b[2],
- b10 = b[3], b11 = b[4], b12 = b[5],
- b20 = b[6], b21 = b[7], b22 = b[8];
-
- out[0] = b00 * a00 + b01 * a10 + b02 * a20;
- out[1] = b00 * a01 + b01 * a11 + b02 * a21;
- out[2] = b00 * a02 + b01 * a12 + b02 * a22;
-
- out[3] = b10 * a00 + b11 * a10 + b12 * a20;
- out[4] = b10 * a01 + b11 * a11 + b12 * a21;
- out[5] = b10 * a02 + b11 * a12 + b12 * a22;
-
- out[6] = b20 * a00 + b21 * a10 + b22 * a20;
- out[7] = b20 * a01 + b21 * a11 + b22 * a21;
- out[8] = b20 * a02 + b21 * a12 + b22 * a22;
- return out;
-};
-
-/**
- * Alias for {@link mat3.multiply}
- * @function
- */
-mat3.mul = mat3.multiply;
-
-/**
- * Translate a mat3 by the given vector
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the matrix to translate
- * @param {vec2} v vector to translate by
- * @returns {mat3} out
- */
-mat3.translate = function(out, a, v) {
- var a00 = a[0], a01 = a[1], a02 = a[2],
- a10 = a[3], a11 = a[4], a12 = a[5],
- a20 = a[6], a21 = a[7], a22 = a[8],
- x = v[0], y = v[1];
-
- out[0] = a00;
- out[1] = a01;
- out[2] = a02;
-
- out[3] = a10;
- out[4] = a11;
- out[5] = a12;
-
- out[6] = x * a00 + y * a10 + a20;
- out[7] = x * a01 + y * a11 + a21;
- out[8] = x * a02 + y * a12 + a22;
- return out;
-};
-
-/**
- * Rotates a mat3 by the given angle
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the matrix to rotate
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat3} out
- */
-mat3.rotate = function (out, a, rad) {
- var a00 = a[0], a01 = a[1], a02 = a[2],
- a10 = a[3], a11 = a[4], a12 = a[5],
- a20 = a[6], a21 = a[7], a22 = a[8],
-
- s = Math.sin(rad),
- c = Math.cos(rad);
-
- out[0] = c * a00 + s * a10;
- out[1] = c * a01 + s * a11;
- out[2] = c * a02 + s * a12;
-
- out[3] = c * a10 - s * a00;
- out[4] = c * a11 - s * a01;
- out[5] = c * a12 - s * a02;
-
- out[6] = a20;
- out[7] = a21;
- out[8] = a22;
- return out;
-};
-
-/**
- * Scales the mat3 by the dimensions in the given vec2
- *
- * @param {mat3} out the receiving matrix
- * @param {mat3} a the matrix to rotate
- * @param {vec2} v the vec2 to scale the matrix by
- * @returns {mat3} out
- **/
-mat3.scale = function(out, a, v) {
- var x = v[0], y = v[1];
-
- out[0] = x * a[0];
- out[1] = x * a[1];
- out[2] = x * a[2];
-
- out[3] = y * a[3];
- out[4] = y * a[4];
- out[5] = y * a[5];
-
- out[6] = a[6];
- out[7] = a[7];
- out[8] = a[8];
- return out;
-};
-
-/**
- * Creates a matrix from a vector translation
- * This is equivalent to (but much faster than):
- *
- * mat3.identity(dest);
- * mat3.translate(dest, dest, vec);
- *
- * @param {mat3} out mat3 receiving operation result
- * @param {vec2} v Translation vector
- * @returns {mat3} out
- */
-mat3.fromTranslation = function(out, v) {
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 1;
- out[5] = 0;
- out[6] = v[0];
- out[7] = v[1];
- out[8] = 1;
- return out;
-}
-
-/**
- * Creates a matrix from a given angle
- * This is equivalent to (but much faster than):
- *
- * mat3.identity(dest);
- * mat3.rotate(dest, dest, rad);
- *
- * @param {mat3} out mat3 receiving operation result
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat3} out
- */
-mat3.fromRotation = function(out, rad) {
- var s = Math.sin(rad), c = Math.cos(rad);
-
- out[0] = c;
- out[1] = s;
- out[2] = 0;
-
- out[3] = -s;
- out[4] = c;
- out[5] = 0;
-
- out[6] = 0;
- out[7] = 0;
- out[8] = 1;
- return out;
-}
-
-/**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat3.identity(dest);
- * mat3.scale(dest, dest, vec);
- *
- * @param {mat3} out mat3 receiving operation result
- * @param {vec2} v Scaling vector
- * @returns {mat3} out
- */
-mat3.fromScaling = function(out, v) {
- out[0] = v[0];
- out[1] = 0;
- out[2] = 0;
-
- out[3] = 0;
- out[4] = v[1];
- out[5] = 0;
-
- out[6] = 0;
- out[7] = 0;
- out[8] = 1;
- return out;
-}
-
-/**
- * Copies the values from a mat2d into a mat3
- *
- * @param {mat3} out the receiving matrix
- * @param {mat2d} a the matrix to copy
- * @returns {mat3} out
- **/
-mat3.fromMat2d = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = 0;
-
- out[3] = a[2];
- out[4] = a[3];
- out[5] = 0;
-
- out[6] = a[4];
- out[7] = a[5];
- out[8] = 1;
- return out;
-};
-
-/**
-* Calculates a 3x3 matrix from the given quaternion
-*
-* @param {mat3} out mat3 receiving operation result
-* @param {quat} q Quaternion to create matrix from
-*
-* @returns {mat3} out
-*/
-mat3.fromQuat = function (out, q) {
- var x = q[0], y = q[1], z = q[2], w = q[3],
- x2 = x + x,
- y2 = y + y,
- z2 = z + z,
-
- xx = x * x2,
- yx = y * x2,
- yy = y * y2,
- zx = z * x2,
- zy = z * y2,
- zz = z * z2,
- wx = w * x2,
- wy = w * y2,
- wz = w * z2;
-
- out[0] = 1 - yy - zz;
- out[3] = yx - wz;
- out[6] = zx + wy;
-
- out[1] = yx + wz;
- out[4] = 1 - xx - zz;
- out[7] = zy - wx;
-
- out[2] = zx - wy;
- out[5] = zy + wx;
- out[8] = 1 - xx - yy;
-
- return out;
-};
-
-/**
-* Calculates a 3x3 normal matrix (transpose inverse) from the 4x4 matrix
-*
-* @param {mat3} out mat3 receiving operation result
-* @param {mat4} a Mat4 to derive the normal matrix from
-*
-* @returns {mat3} out
-*/
-mat3.normalFromMat4 = function (out, a) {
- var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
- a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
- a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
- a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],
-
- b00 = a00 * a11 - a01 * a10,
- b01 = a00 * a12 - a02 * a10,
- b02 = a00 * a13 - a03 * a10,
- b03 = a01 * a12 - a02 * a11,
- b04 = a01 * a13 - a03 * a11,
- b05 = a02 * a13 - a03 * a12,
- b06 = a20 * a31 - a21 * a30,
- b07 = a20 * a32 - a22 * a30,
- b08 = a20 * a33 - a23 * a30,
- b09 = a21 * a32 - a22 * a31,
- b10 = a21 * a33 - a23 * a31,
- b11 = a22 * a33 - a23 * a32,
-
- // Calculate the determinant
- det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
-
- if (!det) {
- return null;
- }
- det = 1.0 / det;
-
- out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
- out[1] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
- out[2] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
-
- out[3] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
- out[4] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
- out[5] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
-
- out[6] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
- out[7] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
- out[8] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
-
- return out;
-};
-
-/**
- * Returns a string representation of a mat3
- *
- * @param {mat3} mat matrix to represent as a string
- * @returns {String} string representation of the matrix
- */
-mat3.str = function (a) {
- return 'mat3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' +
- a[3] + ', ' + a[4] + ', ' + a[5] + ', ' +
- a[6] + ', ' + a[7] + ', ' + a[8] + ')';
-};
-
-/**
- * Returns Frobenius norm of a mat3
- *
- * @param {mat3} a the matrix to calculate Frobenius norm of
- * @returns {Number} Frobenius norm
- */
-mat3.frob = function (a) {
- return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2)))
-};
-
-
-module.exports = mat3;
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat4.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat4.js
deleted file mode 100644
index b82526d1365..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/mat4.js
+++ /dev/null
@@ -1,1283 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-var glMatrix = require("./common.js");
-
-/**
- * @class 4x4 Matrix
- * @name mat4
- */
-var mat4 = {};
-
-/**
- * Creates a new identity mat4
- *
- * @returns {mat4} a new 4x4 matrix
- */
-mat4.create = function() {
- var out = new glMatrix.ARRAY_TYPE(16);
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = 1;
- out[6] = 0;
- out[7] = 0;
- out[8] = 0;
- out[9] = 0;
- out[10] = 1;
- out[11] = 0;
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
- return out;
-};
-
-/**
- * Creates a new mat4 initialized with values from an existing matrix
- *
- * @param {mat4} a matrix to clone
- * @returns {mat4} a new 4x4 matrix
- */
-mat4.clone = function(a) {
- var out = new glMatrix.ARRAY_TYPE(16);
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- out[4] = a[4];
- out[5] = a[5];
- out[6] = a[6];
- out[7] = a[7];
- out[8] = a[8];
- out[9] = a[9];
- out[10] = a[10];
- out[11] = a[11];
- out[12] = a[12];
- out[13] = a[13];
- out[14] = a[14];
- out[15] = a[15];
- return out;
-};
-
-/**
- * Copy the values from one mat4 to another
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the source matrix
- * @returns {mat4} out
- */
-mat4.copy = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- out[4] = a[4];
- out[5] = a[5];
- out[6] = a[6];
- out[7] = a[7];
- out[8] = a[8];
- out[9] = a[9];
- out[10] = a[10];
- out[11] = a[11];
- out[12] = a[12];
- out[13] = a[13];
- out[14] = a[14];
- out[15] = a[15];
- return out;
-};
-
-/**
- * Set a mat4 to the identity matrix
- *
- * @param {mat4} out the receiving matrix
- * @returns {mat4} out
- */
-mat4.identity = function(out) {
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = 1;
- out[6] = 0;
- out[7] = 0;
- out[8] = 0;
- out[9] = 0;
- out[10] = 1;
- out[11] = 0;
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
- return out;
-};
-
-/**
- * Transpose the values of a mat4
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the source matrix
- * @returns {mat4} out
- */
-mat4.transpose = function(out, a) {
- // If we are transposing ourselves we can skip a few steps but have to cache some values
- if (out === a) {
- var a01 = a[1], a02 = a[2], a03 = a[3],
- a12 = a[6], a13 = a[7],
- a23 = a[11];
-
- out[1] = a[4];
- out[2] = a[8];
- out[3] = a[12];
- out[4] = a01;
- out[6] = a[9];
- out[7] = a[13];
- out[8] = a02;
- out[9] = a12;
- out[11] = a[14];
- out[12] = a03;
- out[13] = a13;
- out[14] = a23;
- } else {
- out[0] = a[0];
- out[1] = a[4];
- out[2] = a[8];
- out[3] = a[12];
- out[4] = a[1];
- out[5] = a[5];
- out[6] = a[9];
- out[7] = a[13];
- out[8] = a[2];
- out[9] = a[6];
- out[10] = a[10];
- out[11] = a[14];
- out[12] = a[3];
- out[13] = a[7];
- out[14] = a[11];
- out[15] = a[15];
- }
-
- return out;
-};
-
-/**
- * Inverts a mat4
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the source matrix
- * @returns {mat4} out
- */
-mat4.invert = function(out, a) {
- var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
- a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
- a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
- a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],
-
- b00 = a00 * a11 - a01 * a10,
- b01 = a00 * a12 - a02 * a10,
- b02 = a00 * a13 - a03 * a10,
- b03 = a01 * a12 - a02 * a11,
- b04 = a01 * a13 - a03 * a11,
- b05 = a02 * a13 - a03 * a12,
- b06 = a20 * a31 - a21 * a30,
- b07 = a20 * a32 - a22 * a30,
- b08 = a20 * a33 - a23 * a30,
- b09 = a21 * a32 - a22 * a31,
- b10 = a21 * a33 - a23 * a31,
- b11 = a22 * a33 - a23 * a32,
-
- // Calculate the determinant
- det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
-
- if (!det) {
- return null;
- }
- det = 1.0 / det;
-
- out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det;
- out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det;
- out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det;
- out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det;
- out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det;
- out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det;
- out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det;
- out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det;
- out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det;
- out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det;
- out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det;
- out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det;
- out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det;
- out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det;
- out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det;
- out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det;
-
- return out;
-};
-
-/**
- * Calculates the adjugate of a mat4
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the source matrix
- * @returns {mat4} out
- */
-mat4.adjoint = function(out, a) {
- var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
- a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
- a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
- a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];
-
- out[0] = (a11 * (a22 * a33 - a23 * a32) - a21 * (a12 * a33 - a13 * a32) + a31 * (a12 * a23 - a13 * a22));
- out[1] = -(a01 * (a22 * a33 - a23 * a32) - a21 * (a02 * a33 - a03 * a32) + a31 * (a02 * a23 - a03 * a22));
- out[2] = (a01 * (a12 * a33 - a13 * a32) - a11 * (a02 * a33 - a03 * a32) + a31 * (a02 * a13 - a03 * a12));
- out[3] = -(a01 * (a12 * a23 - a13 * a22) - a11 * (a02 * a23 - a03 * a22) + a21 * (a02 * a13 - a03 * a12));
- out[4] = -(a10 * (a22 * a33 - a23 * a32) - a20 * (a12 * a33 - a13 * a32) + a30 * (a12 * a23 - a13 * a22));
- out[5] = (a00 * (a22 * a33 - a23 * a32) - a20 * (a02 * a33 - a03 * a32) + a30 * (a02 * a23 - a03 * a22));
- out[6] = -(a00 * (a12 * a33 - a13 * a32) - a10 * (a02 * a33 - a03 * a32) + a30 * (a02 * a13 - a03 * a12));
- out[7] = (a00 * (a12 * a23 - a13 * a22) - a10 * (a02 * a23 - a03 * a22) + a20 * (a02 * a13 - a03 * a12));
- out[8] = (a10 * (a21 * a33 - a23 * a31) - a20 * (a11 * a33 - a13 * a31) + a30 * (a11 * a23 - a13 * a21));
- out[9] = -(a00 * (a21 * a33 - a23 * a31) - a20 * (a01 * a33 - a03 * a31) + a30 * (a01 * a23 - a03 * a21));
- out[10] = (a00 * (a11 * a33 - a13 * a31) - a10 * (a01 * a33 - a03 * a31) + a30 * (a01 * a13 - a03 * a11));
- out[11] = -(a00 * (a11 * a23 - a13 * a21) - a10 * (a01 * a23 - a03 * a21) + a20 * (a01 * a13 - a03 * a11));
- out[12] = -(a10 * (a21 * a32 - a22 * a31) - a20 * (a11 * a32 - a12 * a31) + a30 * (a11 * a22 - a12 * a21));
- out[13] = (a00 * (a21 * a32 - a22 * a31) - a20 * (a01 * a32 - a02 * a31) + a30 * (a01 * a22 - a02 * a21));
- out[14] = -(a00 * (a11 * a32 - a12 * a31) - a10 * (a01 * a32 - a02 * a31) + a30 * (a01 * a12 - a02 * a11));
- out[15] = (a00 * (a11 * a22 - a12 * a21) - a10 * (a01 * a22 - a02 * a21) + a20 * (a01 * a12 - a02 * a11));
- return out;
-};
-
-/**
- * Calculates the determinant of a mat4
- *
- * @param {mat4} a the source matrix
- * @returns {Number} determinant of a
- */
-mat4.determinant = function (a) {
- var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
- a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
- a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
- a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15],
-
- b00 = a00 * a11 - a01 * a10,
- b01 = a00 * a12 - a02 * a10,
- b02 = a00 * a13 - a03 * a10,
- b03 = a01 * a12 - a02 * a11,
- b04 = a01 * a13 - a03 * a11,
- b05 = a02 * a13 - a03 * a12,
- b06 = a20 * a31 - a21 * a30,
- b07 = a20 * a32 - a22 * a30,
- b08 = a20 * a33 - a23 * a30,
- b09 = a21 * a32 - a22 * a31,
- b10 = a21 * a33 - a23 * a31,
- b11 = a22 * a33 - a23 * a32;
-
- // Calculate the determinant
- return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;
-};
-
-/**
- * Multiplies two mat4's
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the first operand
- * @param {mat4} b the second operand
- * @returns {mat4} out
- */
-mat4.multiply = function (out, a, b) {
- var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3],
- a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7],
- a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11],
- a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15];
-
- // Cache only the current line of the second matrix
- var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3];
- out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30;
- out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31;
- out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32;
- out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33;
-
- b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7];
- out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30;
- out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31;
- out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32;
- out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33;
-
- b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11];
- out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30;
- out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31;
- out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32;
- out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33;
-
- b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15];
- out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30;
- out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31;
- out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32;
- out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33;
- return out;
-};
-
-/**
- * Alias for {@link mat4.multiply}
- * @function
- */
-mat4.mul = mat4.multiply;
-
-/**
- * Translate a mat4 by the given vector
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the matrix to translate
- * @param {vec3} v vector to translate by
- * @returns {mat4} out
- */
-mat4.translate = function (out, a, v) {
- var x = v[0], y = v[1], z = v[2],
- a00, a01, a02, a03,
- a10, a11, a12, a13,
- a20, a21, a22, a23;
-
- if (a === out) {
- out[12] = a[0] * x + a[4] * y + a[8] * z + a[12];
- out[13] = a[1] * x + a[5] * y + a[9] * z + a[13];
- out[14] = a[2] * x + a[6] * y + a[10] * z + a[14];
- out[15] = a[3] * x + a[7] * y + a[11] * z + a[15];
- } else {
- a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];
- a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];
- a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];
-
- out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03;
- out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13;
- out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23;
-
- out[12] = a00 * x + a10 * y + a20 * z + a[12];
- out[13] = a01 * x + a11 * y + a21 * z + a[13];
- out[14] = a02 * x + a12 * y + a22 * z + a[14];
- out[15] = a03 * x + a13 * y + a23 * z + a[15];
- }
-
- return out;
-};
-
-/**
- * Scales the mat4 by the dimensions in the given vec3
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the matrix to scale
- * @param {vec3} v the vec3 to scale the matrix by
- * @returns {mat4} out
- **/
-mat4.scale = function(out, a, v) {
- var x = v[0], y = v[1], z = v[2];
-
- out[0] = a[0] * x;
- out[1] = a[1] * x;
- out[2] = a[2] * x;
- out[3] = a[3] * x;
- out[4] = a[4] * y;
- out[5] = a[5] * y;
- out[6] = a[6] * y;
- out[7] = a[7] * y;
- out[8] = a[8] * z;
- out[9] = a[9] * z;
- out[10] = a[10] * z;
- out[11] = a[11] * z;
- out[12] = a[12];
- out[13] = a[13];
- out[14] = a[14];
- out[15] = a[15];
- return out;
-};
-
-/**
- * Rotates a mat4 by the given angle around the given axis
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the matrix to rotate
- * @param {Number} rad the angle to rotate the matrix by
- * @param {vec3} axis the axis to rotate around
- * @returns {mat4} out
- */
-mat4.rotate = function (out, a, rad, axis) {
- var x = axis[0], y = axis[1], z = axis[2],
- len = Math.sqrt(x * x + y * y + z * z),
- s, c, t,
- a00, a01, a02, a03,
- a10, a11, a12, a13,
- a20, a21, a22, a23,
- b00, b01, b02,
- b10, b11, b12,
- b20, b21, b22;
-
- if (Math.abs(len) < glMatrix.EPSILON) { return null; }
-
- len = 1 / len;
- x *= len;
- y *= len;
- z *= len;
-
- s = Math.sin(rad);
- c = Math.cos(rad);
- t = 1 - c;
-
- a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3];
- a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7];
- a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11];
-
- // Construct the elements of the rotation matrix
- b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s;
- b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s;
- b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c;
-
- // Perform rotation-specific matrix multiplication
- out[0] = a00 * b00 + a10 * b01 + a20 * b02;
- out[1] = a01 * b00 + a11 * b01 + a21 * b02;
- out[2] = a02 * b00 + a12 * b01 + a22 * b02;
- out[3] = a03 * b00 + a13 * b01 + a23 * b02;
- out[4] = a00 * b10 + a10 * b11 + a20 * b12;
- out[5] = a01 * b10 + a11 * b11 + a21 * b12;
- out[6] = a02 * b10 + a12 * b11 + a22 * b12;
- out[7] = a03 * b10 + a13 * b11 + a23 * b12;
- out[8] = a00 * b20 + a10 * b21 + a20 * b22;
- out[9] = a01 * b20 + a11 * b21 + a21 * b22;
- out[10] = a02 * b20 + a12 * b21 + a22 * b22;
- out[11] = a03 * b20 + a13 * b21 + a23 * b22;
-
- if (a !== out) { // If the source and destination differ, copy the unchanged last row
- out[12] = a[12];
- out[13] = a[13];
- out[14] = a[14];
- out[15] = a[15];
- }
- return out;
-};
-
-/**
- * Rotates a matrix by the given angle around the X axis
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the matrix to rotate
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
-mat4.rotateX = function (out, a, rad) {
- var s = Math.sin(rad),
- c = Math.cos(rad),
- a10 = a[4],
- a11 = a[5],
- a12 = a[6],
- a13 = a[7],
- a20 = a[8],
- a21 = a[9],
- a22 = a[10],
- a23 = a[11];
-
- if (a !== out) { // If the source and destination differ, copy the unchanged rows
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- out[12] = a[12];
- out[13] = a[13];
- out[14] = a[14];
- out[15] = a[15];
- }
-
- // Perform axis-specific matrix multiplication
- out[4] = a10 * c + a20 * s;
- out[5] = a11 * c + a21 * s;
- out[6] = a12 * c + a22 * s;
- out[7] = a13 * c + a23 * s;
- out[8] = a20 * c - a10 * s;
- out[9] = a21 * c - a11 * s;
- out[10] = a22 * c - a12 * s;
- out[11] = a23 * c - a13 * s;
- return out;
-};
-
-/**
- * Rotates a matrix by the given angle around the Y axis
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the matrix to rotate
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
-mat4.rotateY = function (out, a, rad) {
- var s = Math.sin(rad),
- c = Math.cos(rad),
- a00 = a[0],
- a01 = a[1],
- a02 = a[2],
- a03 = a[3],
- a20 = a[8],
- a21 = a[9],
- a22 = a[10],
- a23 = a[11];
-
- if (a !== out) { // If the source and destination differ, copy the unchanged rows
- out[4] = a[4];
- out[5] = a[5];
- out[6] = a[6];
- out[7] = a[7];
- out[12] = a[12];
- out[13] = a[13];
- out[14] = a[14];
- out[15] = a[15];
- }
-
- // Perform axis-specific matrix multiplication
- out[0] = a00 * c - a20 * s;
- out[1] = a01 * c - a21 * s;
- out[2] = a02 * c - a22 * s;
- out[3] = a03 * c - a23 * s;
- out[8] = a00 * s + a20 * c;
- out[9] = a01 * s + a21 * c;
- out[10] = a02 * s + a22 * c;
- out[11] = a03 * s + a23 * c;
- return out;
-};
-
-/**
- * Rotates a matrix by the given angle around the Z axis
- *
- * @param {mat4} out the receiving matrix
- * @param {mat4} a the matrix to rotate
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
-mat4.rotateZ = function (out, a, rad) {
- var s = Math.sin(rad),
- c = Math.cos(rad),
- a00 = a[0],
- a01 = a[1],
- a02 = a[2],
- a03 = a[3],
- a10 = a[4],
- a11 = a[5],
- a12 = a[6],
- a13 = a[7];
-
- if (a !== out) { // If the source and destination differ, copy the unchanged last row
- out[8] = a[8];
- out[9] = a[9];
- out[10] = a[10];
- out[11] = a[11];
- out[12] = a[12];
- out[13] = a[13];
- out[14] = a[14];
- out[15] = a[15];
- }
-
- // Perform axis-specific matrix multiplication
- out[0] = a00 * c + a10 * s;
- out[1] = a01 * c + a11 * s;
- out[2] = a02 * c + a12 * s;
- out[3] = a03 * c + a13 * s;
- out[4] = a10 * c - a00 * s;
- out[5] = a11 * c - a01 * s;
- out[6] = a12 * c - a02 * s;
- out[7] = a13 * c - a03 * s;
- return out;
-};
-
-/**
- * Creates a matrix from a vector translation
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, dest, vec);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {vec3} v Translation vector
- * @returns {mat4} out
- */
-mat4.fromTranslation = function(out, v) {
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = 1;
- out[6] = 0;
- out[7] = 0;
- out[8] = 0;
- out[9] = 0;
- out[10] = 1;
- out[11] = 0;
- out[12] = v[0];
- out[13] = v[1];
- out[14] = v[2];
- out[15] = 1;
- return out;
-}
-
-/**
- * Creates a matrix from a vector scaling
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.scale(dest, dest, vec);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {vec3} v Scaling vector
- * @returns {mat4} out
- */
-mat4.fromScaling = function(out, v) {
- out[0] = v[0];
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = v[1];
- out[6] = 0;
- out[7] = 0;
- out[8] = 0;
- out[9] = 0;
- out[10] = v[2];
- out[11] = 0;
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
- return out;
-}
-
-/**
- * Creates a matrix from a given angle around a given axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotate(dest, dest, rad, axis);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {Number} rad the angle to rotate the matrix by
- * @param {vec3} axis the axis to rotate around
- * @returns {mat4} out
- */
-mat4.fromRotation = function(out, rad, axis) {
- var x = axis[0], y = axis[1], z = axis[2],
- len = Math.sqrt(x * x + y * y + z * z),
- s, c, t;
-
- if (Math.abs(len) < glMatrix.EPSILON) { return null; }
-
- len = 1 / len;
- x *= len;
- y *= len;
- z *= len;
-
- s = Math.sin(rad);
- c = Math.cos(rad);
- t = 1 - c;
-
- // Perform rotation-specific matrix multiplication
- out[0] = x * x * t + c;
- out[1] = y * x * t + z * s;
- out[2] = z * x * t - y * s;
- out[3] = 0;
- out[4] = x * y * t - z * s;
- out[5] = y * y * t + c;
- out[6] = z * y * t + x * s;
- out[7] = 0;
- out[8] = x * z * t + y * s;
- out[9] = y * z * t - x * s;
- out[10] = z * z * t + c;
- out[11] = 0;
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
- return out;
-}
-
-/**
- * Creates a matrix from the given angle around the X axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotateX(dest, dest, rad);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
-mat4.fromXRotation = function(out, rad) {
- var s = Math.sin(rad),
- c = Math.cos(rad);
-
- // Perform axis-specific matrix multiplication
- out[0] = 1;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = c;
- out[6] = s;
- out[7] = 0;
- out[8] = 0;
- out[9] = -s;
- out[10] = c;
- out[11] = 0;
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
- return out;
-}
-
-/**
- * Creates a matrix from the given angle around the Y axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotateY(dest, dest, rad);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
-mat4.fromYRotation = function(out, rad) {
- var s = Math.sin(rad),
- c = Math.cos(rad);
-
- // Perform axis-specific matrix multiplication
- out[0] = c;
- out[1] = 0;
- out[2] = -s;
- out[3] = 0;
- out[4] = 0;
- out[5] = 1;
- out[6] = 0;
- out[7] = 0;
- out[8] = s;
- out[9] = 0;
- out[10] = c;
- out[11] = 0;
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
- return out;
-}
-
-/**
- * Creates a matrix from the given angle around the Z axis
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.rotateZ(dest, dest, rad);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {Number} rad the angle to rotate the matrix by
- * @returns {mat4} out
- */
-mat4.fromZRotation = function(out, rad) {
- var s = Math.sin(rad),
- c = Math.cos(rad);
-
- // Perform axis-specific matrix multiplication
- out[0] = c;
- out[1] = s;
- out[2] = 0;
- out[3] = 0;
- out[4] = -s;
- out[5] = c;
- out[6] = 0;
- out[7] = 0;
- out[8] = 0;
- out[9] = 0;
- out[10] = 1;
- out[11] = 0;
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
- return out;
-}
-
-/**
- * Creates a matrix from a quaternion rotation and vector translation
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, vec);
- * var quatMat = mat4.create();
- * quat4.toMat4(quat, quatMat);
- * mat4.multiply(dest, quatMat);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {quat4} q Rotation quaternion
- * @param {vec3} v Translation vector
- * @returns {mat4} out
- */
-mat4.fromRotationTranslation = function (out, q, v) {
- // Quaternion math
- var x = q[0], y = q[1], z = q[2], w = q[3],
- x2 = x + x,
- y2 = y + y,
- z2 = z + z,
-
- xx = x * x2,
- xy = x * y2,
- xz = x * z2,
- yy = y * y2,
- yz = y * z2,
- zz = z * z2,
- wx = w * x2,
- wy = w * y2,
- wz = w * z2;
-
- out[0] = 1 - (yy + zz);
- out[1] = xy + wz;
- out[2] = xz - wy;
- out[3] = 0;
- out[4] = xy - wz;
- out[5] = 1 - (xx + zz);
- out[6] = yz + wx;
- out[7] = 0;
- out[8] = xz + wy;
- out[9] = yz - wx;
- out[10] = 1 - (xx + yy);
- out[11] = 0;
- out[12] = v[0];
- out[13] = v[1];
- out[14] = v[2];
- out[15] = 1;
-
- return out;
-};
-
-/**
- * Creates a matrix from a quaternion rotation, vector translation and vector scale
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, vec);
- * var quatMat = mat4.create();
- * quat4.toMat4(quat, quatMat);
- * mat4.multiply(dest, quatMat);
- * mat4.scale(dest, scale)
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {quat4} q Rotation quaternion
- * @param {vec3} v Translation vector
- * @param {vec3} s Scaling vector
- * @returns {mat4} out
- */
-mat4.fromRotationTranslationScale = function (out, q, v, s) {
- // Quaternion math
- var x = q[0], y = q[1], z = q[2], w = q[3],
- x2 = x + x,
- y2 = y + y,
- z2 = z + z,
-
- xx = x * x2,
- xy = x * y2,
- xz = x * z2,
- yy = y * y2,
- yz = y * z2,
- zz = z * z2,
- wx = w * x2,
- wy = w * y2,
- wz = w * z2,
- sx = s[0],
- sy = s[1],
- sz = s[2];
-
- out[0] = (1 - (yy + zz)) * sx;
- out[1] = (xy + wz) * sx;
- out[2] = (xz - wy) * sx;
- out[3] = 0;
- out[4] = (xy - wz) * sy;
- out[5] = (1 - (xx + zz)) * sy;
- out[6] = (yz + wx) * sy;
- out[7] = 0;
- out[8] = (xz + wy) * sz;
- out[9] = (yz - wx) * sz;
- out[10] = (1 - (xx + yy)) * sz;
- out[11] = 0;
- out[12] = v[0];
- out[13] = v[1];
- out[14] = v[2];
- out[15] = 1;
-
- return out;
-};
-
-/**
- * Creates a matrix from a quaternion rotation, vector translation and vector scale, rotating and scaling around the given origin
- * This is equivalent to (but much faster than):
- *
- * mat4.identity(dest);
- * mat4.translate(dest, vec);
- * mat4.translate(dest, origin);
- * var quatMat = mat4.create();
- * quat4.toMat4(quat, quatMat);
- * mat4.multiply(dest, quatMat);
- * mat4.scale(dest, scale)
- * mat4.translate(dest, negativeOrigin);
- *
- * @param {mat4} out mat4 receiving operation result
- * @param {quat4} q Rotation quaternion
- * @param {vec3} v Translation vector
- * @param {vec3} s Scaling vector
- * @param {vec3} o The origin vector around which to scale and rotate
- * @returns {mat4} out
- */
-mat4.fromRotationTranslationScaleOrigin = function (out, q, v, s, o) {
- // Quaternion math
- var x = q[0], y = q[1], z = q[2], w = q[3],
- x2 = x + x,
- y2 = y + y,
- z2 = z + z,
-
- xx = x * x2,
- xy = x * y2,
- xz = x * z2,
- yy = y * y2,
- yz = y * z2,
- zz = z * z2,
- wx = w * x2,
- wy = w * y2,
- wz = w * z2,
-
- sx = s[0],
- sy = s[1],
- sz = s[2],
-
- ox = o[0],
- oy = o[1],
- oz = o[2];
-
- out[0] = (1 - (yy + zz)) * sx;
- out[1] = (xy + wz) * sx;
- out[2] = (xz - wy) * sx;
- out[3] = 0;
- out[4] = (xy - wz) * sy;
- out[5] = (1 - (xx + zz)) * sy;
- out[6] = (yz + wx) * sy;
- out[7] = 0;
- out[8] = (xz + wy) * sz;
- out[9] = (yz - wx) * sz;
- out[10] = (1 - (xx + yy)) * sz;
- out[11] = 0;
- out[12] = v[0] + ox - (out[0] * ox + out[4] * oy + out[8] * oz);
- out[13] = v[1] + oy - (out[1] * ox + out[5] * oy + out[9] * oz);
- out[14] = v[2] + oz - (out[2] * ox + out[6] * oy + out[10] * oz);
- out[15] = 1;
-
- return out;
-};
-
-mat4.fromQuat = function (out, q) {
- var x = q[0], y = q[1], z = q[2], w = q[3],
- x2 = x + x,
- y2 = y + y,
- z2 = z + z,
-
- xx = x * x2,
- yx = y * x2,
- yy = y * y2,
- zx = z * x2,
- zy = z * y2,
- zz = z * z2,
- wx = w * x2,
- wy = w * y2,
- wz = w * z2;
-
- out[0] = 1 - yy - zz;
- out[1] = yx + wz;
- out[2] = zx - wy;
- out[3] = 0;
-
- out[4] = yx - wz;
- out[5] = 1 - xx - zz;
- out[6] = zy + wx;
- out[7] = 0;
-
- out[8] = zx + wy;
- out[9] = zy - wx;
- out[10] = 1 - xx - yy;
- out[11] = 0;
-
- out[12] = 0;
- out[13] = 0;
- out[14] = 0;
- out[15] = 1;
-
- return out;
-};
-
-/**
- * Generates a frustum matrix with the given bounds
- *
- * @param {mat4} out mat4 frustum matrix will be written into
- * @param {Number} left Left bound of the frustum
- * @param {Number} right Right bound of the frustum
- * @param {Number} bottom Bottom bound of the frustum
- * @param {Number} top Top bound of the frustum
- * @param {Number} near Near bound of the frustum
- * @param {Number} far Far bound of the frustum
- * @returns {mat4} out
- */
-mat4.frustum = function (out, left, right, bottom, top, near, far) {
- var rl = 1 / (right - left),
- tb = 1 / (top - bottom),
- nf = 1 / (near - far);
- out[0] = (near * 2) * rl;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = (near * 2) * tb;
- out[6] = 0;
- out[7] = 0;
- out[8] = (right + left) * rl;
- out[9] = (top + bottom) * tb;
- out[10] = (far + near) * nf;
- out[11] = -1;
- out[12] = 0;
- out[13] = 0;
- out[14] = (far * near * 2) * nf;
- out[15] = 0;
- return out;
-};
-
-/**
- * Generates a perspective projection matrix with the given bounds
- *
- * @param {mat4} out mat4 frustum matrix will be written into
- * @param {number} fovy Vertical field of view in radians
- * @param {number} aspect Aspect ratio. typically viewport width/height
- * @param {number} near Near bound of the frustum
- * @param {number} far Far bound of the frustum
- * @returns {mat4} out
- */
-mat4.perspective = function (out, fovy, aspect, near, far) {
- var f = 1.0 / Math.tan(fovy / 2),
- nf = 1 / (near - far);
- out[0] = f / aspect;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = f;
- out[6] = 0;
- out[7] = 0;
- out[8] = 0;
- out[9] = 0;
- out[10] = (far + near) * nf;
- out[11] = -1;
- out[12] = 0;
- out[13] = 0;
- out[14] = (2 * far * near) * nf;
- out[15] = 0;
- return out;
-};
-
-/**
- * Generates a perspective projection matrix with the given field of view.
- * This is primarily useful for generating projection matrices to be used
- * with the still experiemental WebVR API.
- *
- * @param {mat4} out mat4 frustum matrix will be written into
- * @param {number} fov Object containing the following values: upDegrees, downDegrees, leftDegrees, rightDegrees
- * @param {number} near Near bound of the frustum
- * @param {number} far Far bound of the frustum
- * @returns {mat4} out
- */
-mat4.perspectiveFromFieldOfView = function (out, fov, near, far) {
- var upTan = Math.tan(fov.upDegrees * Math.PI/180.0),
- downTan = Math.tan(fov.downDegrees * Math.PI/180.0),
- leftTan = Math.tan(fov.leftDegrees * Math.PI/180.0),
- rightTan = Math.tan(fov.rightDegrees * Math.PI/180.0),
- xScale = 2.0 / (leftTan + rightTan),
- yScale = 2.0 / (upTan + downTan);
-
- out[0] = xScale;
- out[1] = 0.0;
- out[2] = 0.0;
- out[3] = 0.0;
- out[4] = 0.0;
- out[5] = yScale;
- out[6] = 0.0;
- out[7] = 0.0;
- out[8] = -((leftTan - rightTan) * xScale * 0.5);
- out[9] = ((upTan - downTan) * yScale * 0.5);
- out[10] = far / (near - far);
- out[11] = -1.0;
- out[12] = 0.0;
- out[13] = 0.0;
- out[14] = (far * near) / (near - far);
- out[15] = 0.0;
- return out;
-}
-
-/**
- * Generates a orthogonal projection matrix with the given bounds
- *
- * @param {mat4} out mat4 frustum matrix will be written into
- * @param {number} left Left bound of the frustum
- * @param {number} right Right bound of the frustum
- * @param {number} bottom Bottom bound of the frustum
- * @param {number} top Top bound of the frustum
- * @param {number} near Near bound of the frustum
- * @param {number} far Far bound of the frustum
- * @returns {mat4} out
- */
-mat4.ortho = function (out, left, right, bottom, top, near, far) {
- var lr = 1 / (left - right),
- bt = 1 / (bottom - top),
- nf = 1 / (near - far);
- out[0] = -2 * lr;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- out[4] = 0;
- out[5] = -2 * bt;
- out[6] = 0;
- out[7] = 0;
- out[8] = 0;
- out[9] = 0;
- out[10] = 2 * nf;
- out[11] = 0;
- out[12] = (left + right) * lr;
- out[13] = (top + bottom) * bt;
- out[14] = (far + near) * nf;
- out[15] = 1;
- return out;
-};
-
-/**
- * Generates a look-at matrix with the given eye position, focal point, and up axis
- *
- * @param {mat4} out mat4 frustum matrix will be written into
- * @param {vec3} eye Position of the viewer
- * @param {vec3} center Point the viewer is looking at
- * @param {vec3} up vec3 pointing up
- * @returns {mat4} out
- */
-mat4.lookAt = function (out, eye, center, up) {
- var x0, x1, x2, y0, y1, y2, z0, z1, z2, len,
- eyex = eye[0],
- eyey = eye[1],
- eyez = eye[2],
- upx = up[0],
- upy = up[1],
- upz = up[2],
- centerx = center[0],
- centery = center[1],
- centerz = center[2];
-
- if (Math.abs(eyex - centerx) < glMatrix.EPSILON &&
- Math.abs(eyey - centery) < glMatrix.EPSILON &&
- Math.abs(eyez - centerz) < glMatrix.EPSILON) {
- return mat4.identity(out);
- }
-
- z0 = eyex - centerx;
- z1 = eyey - centery;
- z2 = eyez - centerz;
-
- len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2);
- z0 *= len;
- z1 *= len;
- z2 *= len;
-
- x0 = upy * z2 - upz * z1;
- x1 = upz * z0 - upx * z2;
- x2 = upx * z1 - upy * z0;
- len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2);
- if (!len) {
- x0 = 0;
- x1 = 0;
- x2 = 0;
- } else {
- len = 1 / len;
- x0 *= len;
- x1 *= len;
- x2 *= len;
- }
-
- y0 = z1 * x2 - z2 * x1;
- y1 = z2 * x0 - z0 * x2;
- y2 = z0 * x1 - z1 * x0;
-
- len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2);
- if (!len) {
- y0 = 0;
- y1 = 0;
- y2 = 0;
- } else {
- len = 1 / len;
- y0 *= len;
- y1 *= len;
- y2 *= len;
- }
-
- out[0] = x0;
- out[1] = y0;
- out[2] = z0;
- out[3] = 0;
- out[4] = x1;
- out[5] = y1;
- out[6] = z1;
- out[7] = 0;
- out[8] = x2;
- out[9] = y2;
- out[10] = z2;
- out[11] = 0;
- out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez);
- out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez);
- out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez);
- out[15] = 1;
-
- return out;
-};
-
-/**
- * Returns a string representation of a mat4
- *
- * @param {mat4} mat matrix to represent as a string
- * @returns {String} string representation of the matrix
- */
-mat4.str = function (a) {
- return 'mat4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ', ' +
- a[4] + ', ' + a[5] + ', ' + a[6] + ', ' + a[7] + ', ' +
- a[8] + ', ' + a[9] + ', ' + a[10] + ', ' + a[11] + ', ' +
- a[12] + ', ' + a[13] + ', ' + a[14] + ', ' + a[15] + ')';
-};
-
-/**
- * Returns Frobenius norm of a mat4
- *
- * @param {mat4} a the matrix to calculate Frobenius norm of
- * @returns {Number} Frobenius norm
- */
-mat4.frob = function (a) {
- return(Math.sqrt(Math.pow(a[0], 2) + Math.pow(a[1], 2) + Math.pow(a[2], 2) + Math.pow(a[3], 2) + Math.pow(a[4], 2) + Math.pow(a[5], 2) + Math.pow(a[6], 2) + Math.pow(a[7], 2) + Math.pow(a[8], 2) + Math.pow(a[9], 2) + Math.pow(a[10], 2) + Math.pow(a[11], 2) + Math.pow(a[12], 2) + Math.pow(a[13], 2) + Math.pow(a[14], 2) + Math.pow(a[15], 2) ))
-};
-
-
-module.exports = mat4;
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/quat.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/quat.js
deleted file mode 100644
index 2990f7ba52f..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/quat.js
+++ /dev/null
@@ -1,553 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-var glMatrix = require("./common.js");
-var mat3 = require("./mat3.js");
-var vec3 = require("./vec3.js");
-var vec4 = require("./vec4.js");
-
-/**
- * @class Quaternion
- * @name quat
- */
-var quat = {};
-
-/**
- * Creates a new identity quat
- *
- * @returns {quat} a new quaternion
- */
-quat.create = function() {
- var out = new glMatrix.ARRAY_TYPE(4);
- out[0] = 0;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- return out;
-};
-
-/**
- * Sets a quaternion to represent the shortest rotation from one
- * vector to another.
- *
- * Both vectors are assumed to be unit length.
- *
- * @param {quat} out the receiving quaternion.
- * @param {vec3} a the initial vector
- * @param {vec3} b the destination vector
- * @returns {quat} out
- */
-quat.rotationTo = (function() {
- var tmpvec3 = vec3.create();
- var xUnitVec3 = vec3.fromValues(1,0,0);
- var yUnitVec3 = vec3.fromValues(0,1,0);
-
- return function(out, a, b) {
- var dot = vec3.dot(a, b);
- if (dot < -0.999999) {
- vec3.cross(tmpvec3, xUnitVec3, a);
- if (vec3.length(tmpvec3) < 0.000001)
- vec3.cross(tmpvec3, yUnitVec3, a);
- vec3.normalize(tmpvec3, tmpvec3);
- quat.setAxisAngle(out, tmpvec3, Math.PI);
- return out;
- } else if (dot > 0.999999) {
- out[0] = 0;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- return out;
- } else {
- vec3.cross(tmpvec3, a, b);
- out[0] = tmpvec3[0];
- out[1] = tmpvec3[1];
- out[2] = tmpvec3[2];
- out[3] = 1 + dot;
- return quat.normalize(out, out);
- }
- };
-})();
-
-/**
- * Sets the specified quaternion with values corresponding to the given
- * axes. Each axis is a vec3 and is expected to be unit length and
- * perpendicular to all other specified axes.
- *
- * @param {vec3} view the vector representing the viewing direction
- * @param {vec3} right the vector representing the local "right" direction
- * @param {vec3} up the vector representing the local "up" direction
- * @returns {quat} out
- */
-quat.setAxes = (function() {
- var matr = mat3.create();
-
- return function(out, view, right, up) {
- matr[0] = right[0];
- matr[3] = right[1];
- matr[6] = right[2];
-
- matr[1] = up[0];
- matr[4] = up[1];
- matr[7] = up[2];
-
- matr[2] = -view[0];
- matr[5] = -view[1];
- matr[8] = -view[2];
-
- return quat.normalize(out, quat.fromMat3(out, matr));
- };
-})();
-
-/**
- * Creates a new quat initialized with values from an existing quaternion
- *
- * @param {quat} a quaternion to clone
- * @returns {quat} a new quaternion
- * @function
- */
-quat.clone = vec4.clone;
-
-/**
- * Creates a new quat initialized with the given values
- *
- * @param {Number} x X component
- * @param {Number} y Y component
- * @param {Number} z Z component
- * @param {Number} w W component
- * @returns {quat} a new quaternion
- * @function
- */
-quat.fromValues = vec4.fromValues;
-
-/**
- * Copy the values from one quat to another
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a the source quaternion
- * @returns {quat} out
- * @function
- */
-quat.copy = vec4.copy;
-
-/**
- * Set the components of a quat to the given values
- *
- * @param {quat} out the receiving quaternion
- * @param {Number} x X component
- * @param {Number} y Y component
- * @param {Number} z Z component
- * @param {Number} w W component
- * @returns {quat} out
- * @function
- */
-quat.set = vec4.set;
-
-/**
- * Set a quat to the identity quaternion
- *
- * @param {quat} out the receiving quaternion
- * @returns {quat} out
- */
-quat.identity = function(out) {
- out[0] = 0;
- out[1] = 0;
- out[2] = 0;
- out[3] = 1;
- return out;
-};
-
-/**
- * Sets a quat from the given angle and rotation axis,
- * then returns it.
- *
- * @param {quat} out the receiving quaternion
- * @param {vec3} axis the axis around which to rotate
- * @param {Number} rad the angle in radians
- * @returns {quat} out
- **/
-quat.setAxisAngle = function(out, axis, rad) {
- rad = rad * 0.5;
- var s = Math.sin(rad);
- out[0] = s * axis[0];
- out[1] = s * axis[1];
- out[2] = s * axis[2];
- out[3] = Math.cos(rad);
- return out;
-};
-
-/**
- * Adds two quat's
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a the first operand
- * @param {quat} b the second operand
- * @returns {quat} out
- * @function
- */
-quat.add = vec4.add;
-
-/**
- * Multiplies two quat's
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a the first operand
- * @param {quat} b the second operand
- * @returns {quat} out
- */
-quat.multiply = function(out, a, b) {
- var ax = a[0], ay = a[1], az = a[2], aw = a[3],
- bx = b[0], by = b[1], bz = b[2], bw = b[3];
-
- out[0] = ax * bw + aw * bx + ay * bz - az * by;
- out[1] = ay * bw + aw * by + az * bx - ax * bz;
- out[2] = az * bw + aw * bz + ax * by - ay * bx;
- out[3] = aw * bw - ax * bx - ay * by - az * bz;
- return out;
-};
-
-/**
- * Alias for {@link quat.multiply}
- * @function
- */
-quat.mul = quat.multiply;
-
-/**
- * Scales a quat by a scalar number
- *
- * @param {quat} out the receiving vector
- * @param {quat} a the vector to scale
- * @param {Number} b amount to scale the vector by
- * @returns {quat} out
- * @function
- */
-quat.scale = vec4.scale;
-
-/**
- * Rotates a quaternion by the given angle about the X axis
- *
- * @param {quat} out quat receiving operation result
- * @param {quat} a quat to rotate
- * @param {number} rad angle (in radians) to rotate
- * @returns {quat} out
- */
-quat.rotateX = function (out, a, rad) {
- rad *= 0.5;
-
- var ax = a[0], ay = a[1], az = a[2], aw = a[3],
- bx = Math.sin(rad), bw = Math.cos(rad);
-
- out[0] = ax * bw + aw * bx;
- out[1] = ay * bw + az * bx;
- out[2] = az * bw - ay * bx;
- out[3] = aw * bw - ax * bx;
- return out;
-};
-
-/**
- * Rotates a quaternion by the given angle about the Y axis
- *
- * @param {quat} out quat receiving operation result
- * @param {quat} a quat to rotate
- * @param {number} rad angle (in radians) to rotate
- * @returns {quat} out
- */
-quat.rotateY = function (out, a, rad) {
- rad *= 0.5;
-
- var ax = a[0], ay = a[1], az = a[2], aw = a[3],
- by = Math.sin(rad), bw = Math.cos(rad);
-
- out[0] = ax * bw - az * by;
- out[1] = ay * bw + aw * by;
- out[2] = az * bw + ax * by;
- out[3] = aw * bw - ay * by;
- return out;
-};
-
-/**
- * Rotates a quaternion by the given angle about the Z axis
- *
- * @param {quat} out quat receiving operation result
- * @param {quat} a quat to rotate
- * @param {number} rad angle (in radians) to rotate
- * @returns {quat} out
- */
-quat.rotateZ = function (out, a, rad) {
- rad *= 0.5;
-
- var ax = a[0], ay = a[1], az = a[2], aw = a[3],
- bz = Math.sin(rad), bw = Math.cos(rad);
-
- out[0] = ax * bw + ay * bz;
- out[1] = ay * bw - ax * bz;
- out[2] = az * bw + aw * bz;
- out[3] = aw * bw - az * bz;
- return out;
-};
-
-/**
- * Calculates the W component of a quat from the X, Y, and Z components.
- * Assumes that quaternion is 1 unit in length.
- * Any existing W component will be ignored.
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a quat to calculate W component of
- * @returns {quat} out
- */
-quat.calculateW = function (out, a) {
- var x = a[0], y = a[1], z = a[2];
-
- out[0] = x;
- out[1] = y;
- out[2] = z;
- out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z));
- return out;
-};
-
-/**
- * Calculates the dot product of two quat's
- *
- * @param {quat} a the first operand
- * @param {quat} b the second operand
- * @returns {Number} dot product of a and b
- * @function
- */
-quat.dot = vec4.dot;
-
-/**
- * Performs a linear interpolation between two quat's
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a the first operand
- * @param {quat} b the second operand
- * @param {Number} t interpolation amount between the two inputs
- * @returns {quat} out
- * @function
- */
-quat.lerp = vec4.lerp;
-
-/**
- * Performs a spherical linear interpolation between two quat
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a the first operand
- * @param {quat} b the second operand
- * @param {Number} t interpolation amount between the two inputs
- * @returns {quat} out
- */
-quat.slerp = function (out, a, b, t) {
- // benchmarks:
- // http://jsperf.com/quaternion-slerp-implementations
-
- var ax = a[0], ay = a[1], az = a[2], aw = a[3],
- bx = b[0], by = b[1], bz = b[2], bw = b[3];
-
- var omega, cosom, sinom, scale0, scale1;
-
- // calc cosine
- cosom = ax * bx + ay * by + az * bz + aw * bw;
- // adjust signs (if necessary)
- if ( cosom < 0.0 ) {
- cosom = -cosom;
- bx = - bx;
- by = - by;
- bz = - bz;
- bw = - bw;
- }
- // calculate coefficients
- if ( (1.0 - cosom) > 0.000001 ) {
- // standard case (slerp)
- omega = Math.acos(cosom);
- sinom = Math.sin(omega);
- scale0 = Math.sin((1.0 - t) * omega) / sinom;
- scale1 = Math.sin(t * omega) / sinom;
- } else {
- // "from" and "to" quaternions are very close
- // ... so we can do a linear interpolation
- scale0 = 1.0 - t;
- scale1 = t;
- }
- // calculate final values
- out[0] = scale0 * ax + scale1 * bx;
- out[1] = scale0 * ay + scale1 * by;
- out[2] = scale0 * az + scale1 * bz;
- out[3] = scale0 * aw + scale1 * bw;
-
- return out;
-};
-
-/**
- * Performs a spherical linear interpolation with two control points
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a the first operand
- * @param {quat} b the second operand
- * @param {quat} c the third operand
- * @param {quat} d the fourth operand
- * @param {Number} t interpolation amount
- * @returns {quat} out
- */
-quat.sqlerp = (function () {
- var temp1 = quat.create();
- var temp2 = quat.create();
-
- return function (out, a, b, c, d, t) {
- quat.slerp(temp1, a, d, t);
- quat.slerp(temp2, b, c, t);
- quat.slerp(out, temp1, temp2, 2 * t * (1 - t));
-
- return out;
- };
-}());
-
-/**
- * Calculates the inverse of a quat
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a quat to calculate inverse of
- * @returns {quat} out
- */
-quat.invert = function(out, a) {
- var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3],
- dot = a0*a0 + a1*a1 + a2*a2 + a3*a3,
- invDot = dot ? 1.0/dot : 0;
-
- // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0
-
- out[0] = -a0*invDot;
- out[1] = -a1*invDot;
- out[2] = -a2*invDot;
- out[3] = a3*invDot;
- return out;
-};
-
-/**
- * Calculates the conjugate of a quat
- * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a quat to calculate conjugate of
- * @returns {quat} out
- */
-quat.conjugate = function (out, a) {
- out[0] = -a[0];
- out[1] = -a[1];
- out[2] = -a[2];
- out[3] = a[3];
- return out;
-};
-
-/**
- * Calculates the length of a quat
- *
- * @param {quat} a vector to calculate length of
- * @returns {Number} length of a
- * @function
- */
-quat.length = vec4.length;
-
-/**
- * Alias for {@link quat.length}
- * @function
- */
-quat.len = quat.length;
-
-/**
- * Calculates the squared length of a quat
- *
- * @param {quat} a vector to calculate squared length of
- * @returns {Number} squared length of a
- * @function
- */
-quat.squaredLength = vec4.squaredLength;
-
-/**
- * Alias for {@link quat.squaredLength}
- * @function
- */
-quat.sqrLen = quat.squaredLength;
-
-/**
- * Normalize a quat
- *
- * @param {quat} out the receiving quaternion
- * @param {quat} a quaternion to normalize
- * @returns {quat} out
- * @function
- */
-quat.normalize = vec4.normalize;
-
-/**
- * Creates a quaternion from the given 3x3 rotation matrix.
- *
- * NOTE: The resultant quaternion is not normalized, so you should be sure
- * to renormalize the quaternion yourself where necessary.
- *
- * @param {quat} out the receiving quaternion
- * @param {mat3} m rotation matrix
- * @returns {quat} out
- * @function
- */
-quat.fromMat3 = function(out, m) {
- // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes
- // article "Quaternion Calculus and Fast Animation".
- var fTrace = m[0] + m[4] + m[8];
- var fRoot;
-
- if ( fTrace > 0.0 ) {
- // |w| > 1/2, may as well choose w > 1/2
- fRoot = Math.sqrt(fTrace + 1.0); // 2w
- out[3] = 0.5 * fRoot;
- fRoot = 0.5/fRoot; // 1/(4w)
- out[0] = (m[5]-m[7])*fRoot;
- out[1] = (m[6]-m[2])*fRoot;
- out[2] = (m[1]-m[3])*fRoot;
- } else {
- // |w| <= 1/2
- var i = 0;
- if ( m[4] > m[0] )
- i = 1;
- if ( m[8] > m[i*3+i] )
- i = 2;
- var j = (i+1)%3;
- var k = (i+2)%3;
-
- fRoot = Math.sqrt(m[i*3+i]-m[j*3+j]-m[k*3+k] + 1.0);
- out[i] = 0.5 * fRoot;
- fRoot = 0.5 / fRoot;
- out[3] = (m[j*3+k] - m[k*3+j]) * fRoot;
- out[j] = (m[j*3+i] + m[i*3+j]) * fRoot;
- out[k] = (m[k*3+i] + m[i*3+k]) * fRoot;
- }
-
- return out;
-};
-
-/**
- * Returns a string representation of a quatenion
- *
- * @param {quat} vec vector to represent as a string
- * @returns {String} string representation of the vector
- */
-quat.str = function (a) {
- return 'quat(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';
-};
-
-module.exports = quat;
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/vec2.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/vec2.js
deleted file mode 100644
index 9e790563af5..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/vec2.js
+++ /dev/null
@@ -1,523 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-var glMatrix = require("./common.js");
-
-/**
- * @class 2 Dimensional Vector
- * @name vec2
- */
-var vec2 = {};
-
-/**
- * Creates a new, empty vec2
- *
- * @returns {vec2} a new 2D vector
- */
-vec2.create = function() {
- var out = new glMatrix.ARRAY_TYPE(2);
- out[0] = 0;
- out[1] = 0;
- return out;
-};
-
-/**
- * Creates a new vec2 initialized with values from an existing vector
- *
- * @param {vec2} a vector to clone
- * @returns {vec2} a new 2D vector
- */
-vec2.clone = function(a) {
- var out = new glMatrix.ARRAY_TYPE(2);
- out[0] = a[0];
- out[1] = a[1];
- return out;
-};
-
-/**
- * Creates a new vec2 initialized with the given values
- *
- * @param {Number} x X component
- * @param {Number} y Y component
- * @returns {vec2} a new 2D vector
- */
-vec2.fromValues = function(x, y) {
- var out = new glMatrix.ARRAY_TYPE(2);
- out[0] = x;
- out[1] = y;
- return out;
-};
-
-/**
- * Copy the values from one vec2 to another
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the source vector
- * @returns {vec2} out
- */
-vec2.copy = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- return out;
-};
-
-/**
- * Set the components of a vec2 to the given values
- *
- * @param {vec2} out the receiving vector
- * @param {Number} x X component
- * @param {Number} y Y component
- * @returns {vec2} out
- */
-vec2.set = function(out, x, y) {
- out[0] = x;
- out[1] = y;
- return out;
-};
-
-/**
- * Adds two vec2's
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {vec2} out
- */
-vec2.add = function(out, a, b) {
- out[0] = a[0] + b[0];
- out[1] = a[1] + b[1];
- return out;
-};
-
-/**
- * Subtracts vector b from vector a
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {vec2} out
- */
-vec2.subtract = function(out, a, b) {
- out[0] = a[0] - b[0];
- out[1] = a[1] - b[1];
- return out;
-};
-
-/**
- * Alias for {@link vec2.subtract}
- * @function
- */
-vec2.sub = vec2.subtract;
-
-/**
- * Multiplies two vec2's
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {vec2} out
- */
-vec2.multiply = function(out, a, b) {
- out[0] = a[0] * b[0];
- out[1] = a[1] * b[1];
- return out;
-};
-
-/**
- * Alias for {@link vec2.multiply}
- * @function
- */
-vec2.mul = vec2.multiply;
-
-/**
- * Divides two vec2's
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {vec2} out
- */
-vec2.divide = function(out, a, b) {
- out[0] = a[0] / b[0];
- out[1] = a[1] / b[1];
- return out;
-};
-
-/**
- * Alias for {@link vec2.divide}
- * @function
- */
-vec2.div = vec2.divide;
-
-/**
- * Returns the minimum of two vec2's
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {vec2} out
- */
-vec2.min = function(out, a, b) {
- out[0] = Math.min(a[0], b[0]);
- out[1] = Math.min(a[1], b[1]);
- return out;
-};
-
-/**
- * Returns the maximum of two vec2's
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {vec2} out
- */
-vec2.max = function(out, a, b) {
- out[0] = Math.max(a[0], b[0]);
- out[1] = Math.max(a[1], b[1]);
- return out;
-};
-
-/**
- * Scales a vec2 by a scalar number
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the vector to scale
- * @param {Number} b amount to scale the vector by
- * @returns {vec2} out
- */
-vec2.scale = function(out, a, b) {
- out[0] = a[0] * b;
- out[1] = a[1] * b;
- return out;
-};
-
-/**
- * Adds two vec2's after scaling the second operand by a scalar value
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @param {Number} scale the amount to scale b by before adding
- * @returns {vec2} out
- */
-vec2.scaleAndAdd = function(out, a, b, scale) {
- out[0] = a[0] + (b[0] * scale);
- out[1] = a[1] + (b[1] * scale);
- return out;
-};
-
-/**
- * Calculates the euclidian distance between two vec2's
- *
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {Number} distance between a and b
- */
-vec2.distance = function(a, b) {
- var x = b[0] - a[0],
- y = b[1] - a[1];
- return Math.sqrt(x*x + y*y);
-};
-
-/**
- * Alias for {@link vec2.distance}
- * @function
- */
-vec2.dist = vec2.distance;
-
-/**
- * Calculates the squared euclidian distance between two vec2's
- *
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {Number} squared distance between a and b
- */
-vec2.squaredDistance = function(a, b) {
- var x = b[0] - a[0],
- y = b[1] - a[1];
- return x*x + y*y;
-};
-
-/**
- * Alias for {@link vec2.squaredDistance}
- * @function
- */
-vec2.sqrDist = vec2.squaredDistance;
-
-/**
- * Calculates the length of a vec2
- *
- * @param {vec2} a vector to calculate length of
- * @returns {Number} length of a
- */
-vec2.length = function (a) {
- var x = a[0],
- y = a[1];
- return Math.sqrt(x*x + y*y);
-};
-
-/**
- * Alias for {@link vec2.length}
- * @function
- */
-vec2.len = vec2.length;
-
-/**
- * Calculates the squared length of a vec2
- *
- * @param {vec2} a vector to calculate squared length of
- * @returns {Number} squared length of a
- */
-vec2.squaredLength = function (a) {
- var x = a[0],
- y = a[1];
- return x*x + y*y;
-};
-
-/**
- * Alias for {@link vec2.squaredLength}
- * @function
- */
-vec2.sqrLen = vec2.squaredLength;
-
-/**
- * Negates the components of a vec2
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a vector to negate
- * @returns {vec2} out
- */
-vec2.negate = function(out, a) {
- out[0] = -a[0];
- out[1] = -a[1];
- return out;
-};
-
-/**
- * Returns the inverse of the components of a vec2
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a vector to invert
- * @returns {vec2} out
- */
-vec2.inverse = function(out, a) {
- out[0] = 1.0 / a[0];
- out[1] = 1.0 / a[1];
- return out;
-};
-
-/**
- * Normalize a vec2
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a vector to normalize
- * @returns {vec2} out
- */
-vec2.normalize = function(out, a) {
- var x = a[0],
- y = a[1];
- var len = x*x + y*y;
- if (len > 0) {
- //TODO: evaluate use of glm_invsqrt here?
- len = 1 / Math.sqrt(len);
- out[0] = a[0] * len;
- out[1] = a[1] * len;
- }
- return out;
-};
-
-/**
- * Calculates the dot product of two vec2's
- *
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {Number} dot product of a and b
- */
-vec2.dot = function (a, b) {
- return a[0] * b[0] + a[1] * b[1];
-};
-
-/**
- * Computes the cross product of two vec2's
- * Note that the cross product must by definition produce a 3D vector
- *
- * @param {vec3} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @returns {vec3} out
- */
-vec2.cross = function(out, a, b) {
- var z = a[0] * b[1] - a[1] * b[0];
- out[0] = out[1] = 0;
- out[2] = z;
- return out;
-};
-
-/**
- * Performs a linear interpolation between two vec2's
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the first operand
- * @param {vec2} b the second operand
- * @param {Number} t interpolation amount between the two inputs
- * @returns {vec2} out
- */
-vec2.lerp = function (out, a, b, t) {
- var ax = a[0],
- ay = a[1];
- out[0] = ax + t * (b[0] - ax);
- out[1] = ay + t * (b[1] - ay);
- return out;
-};
-
-/**
- * Generates a random vector with the given scale
- *
- * @param {vec2} out the receiving vector
- * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
- * @returns {vec2} out
- */
-vec2.random = function (out, scale) {
- scale = scale || 1.0;
- var r = glMatrix.RANDOM() * 2.0 * Math.PI;
- out[0] = Math.cos(r) * scale;
- out[1] = Math.sin(r) * scale;
- return out;
-};
-
-/**
- * Transforms the vec2 with a mat2
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the vector to transform
- * @param {mat2} m matrix to transform with
- * @returns {vec2} out
- */
-vec2.transformMat2 = function(out, a, m) {
- var x = a[0],
- y = a[1];
- out[0] = m[0] * x + m[2] * y;
- out[1] = m[1] * x + m[3] * y;
- return out;
-};
-
-/**
- * Transforms the vec2 with a mat2d
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the vector to transform
- * @param {mat2d} m matrix to transform with
- * @returns {vec2} out
- */
-vec2.transformMat2d = function(out, a, m) {
- var x = a[0],
- y = a[1];
- out[0] = m[0] * x + m[2] * y + m[4];
- out[1] = m[1] * x + m[3] * y + m[5];
- return out;
-};
-
-/**
- * Transforms the vec2 with a mat3
- * 3rd vector component is implicitly '1'
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the vector to transform
- * @param {mat3} m matrix to transform with
- * @returns {vec2} out
- */
-vec2.transformMat3 = function(out, a, m) {
- var x = a[0],
- y = a[1];
- out[0] = m[0] * x + m[3] * y + m[6];
- out[1] = m[1] * x + m[4] * y + m[7];
- return out;
-};
-
-/**
- * Transforms the vec2 with a mat4
- * 3rd vector component is implicitly '0'
- * 4th vector component is implicitly '1'
- *
- * @param {vec2} out the receiving vector
- * @param {vec2} a the vector to transform
- * @param {mat4} m matrix to transform with
- * @returns {vec2} out
- */
-vec2.transformMat4 = function(out, a, m) {
- var x = a[0],
- y = a[1];
- out[0] = m[0] * x + m[4] * y + m[12];
- out[1] = m[1] * x + m[5] * y + m[13];
- return out;
-};
-
-/**
- * Perform some operation over an array of vec2s.
- *
- * @param {Array} a the array of vectors to iterate over
- * @param {Number} stride Number of elements between the start of each vec2. If 0 assumes tightly packed
- * @param {Number} offset Number of elements to skip at the beginning of the array
- * @param {Number} count Number of vec2s to iterate over. If 0 iterates over entire array
- * @param {Function} fn Function to call for each vector in the array
- * @param {Object} [arg] additional argument to pass to fn
- * @returns {Array} a
- * @function
- */
-vec2.forEach = (function() {
- var vec = vec2.create();
-
- return function(a, stride, offset, count, fn, arg) {
- var i, l;
- if(!stride) {
- stride = 2;
- }
-
- if(!offset) {
- offset = 0;
- }
-
- if(count) {
- l = Math.min((count * stride) + offset, a.length);
- } else {
- l = a.length;
- }
-
- for(i = offset; i < l; i += stride) {
- vec[0] = a[i]; vec[1] = a[i+1];
- fn(vec, vec, arg);
- a[i] = vec[0]; a[i+1] = vec[1];
- }
-
- return a;
- };
-})();
-
-/**
- * Returns a string representation of a vector
- *
- * @param {vec2} vec vector to represent as a string
- * @returns {String} string representation of the vector
- */
-vec2.str = function (a) {
- return 'vec2(' + a[0] + ', ' + a[1] + ')';
-};
-
-module.exports = vec2;
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/vec3.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/vec3.js
deleted file mode 100644
index c0676feefcd..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/vec3.js
+++ /dev/null
@@ -1,709 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-var glMatrix = require("./common.js");
-
-/**
- * @class 3 Dimensional Vector
- * @name vec3
- */
-var vec3 = {};
-
-/**
- * Creates a new, empty vec3
- *
- * @returns {vec3} a new 3D vector
- */
-vec3.create = function() {
- var out = new glMatrix.ARRAY_TYPE(3);
- out[0] = 0;
- out[1] = 0;
- out[2] = 0;
- return out;
-};
-
-/**
- * Creates a new vec3 initialized with values from an existing vector
- *
- * @param {vec3} a vector to clone
- * @returns {vec3} a new 3D vector
- */
-vec3.clone = function(a) {
- var out = new glMatrix.ARRAY_TYPE(3);
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- return out;
-};
-
-/**
- * Creates a new vec3 initialized with the given values
- *
- * @param {Number} x X component
- * @param {Number} y Y component
- * @param {Number} z Z component
- * @returns {vec3} a new 3D vector
- */
-vec3.fromValues = function(x, y, z) {
- var out = new glMatrix.ARRAY_TYPE(3);
- out[0] = x;
- out[1] = y;
- out[2] = z;
- return out;
-};
-
-/**
- * Copy the values from one vec3 to another
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the source vector
- * @returns {vec3} out
- */
-vec3.copy = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- return out;
-};
-
-/**
- * Set the components of a vec3 to the given values
- *
- * @param {vec3} out the receiving vector
- * @param {Number} x X component
- * @param {Number} y Y component
- * @param {Number} z Z component
- * @returns {vec3} out
- */
-vec3.set = function(out, x, y, z) {
- out[0] = x;
- out[1] = y;
- out[2] = z;
- return out;
-};
-
-/**
- * Adds two vec3's
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {vec3} out
- */
-vec3.add = function(out, a, b) {
- out[0] = a[0] + b[0];
- out[1] = a[1] + b[1];
- out[2] = a[2] + b[2];
- return out;
-};
-
-/**
- * Subtracts vector b from vector a
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {vec3} out
- */
-vec3.subtract = function(out, a, b) {
- out[0] = a[0] - b[0];
- out[1] = a[1] - b[1];
- out[2] = a[2] - b[2];
- return out;
-};
-
-/**
- * Alias for {@link vec3.subtract}
- * @function
- */
-vec3.sub = vec3.subtract;
-
-/**
- * Multiplies two vec3's
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {vec3} out
- */
-vec3.multiply = function(out, a, b) {
- out[0] = a[0] * b[0];
- out[1] = a[1] * b[1];
- out[2] = a[2] * b[2];
- return out;
-};
-
-/**
- * Alias for {@link vec3.multiply}
- * @function
- */
-vec3.mul = vec3.multiply;
-
-/**
- * Divides two vec3's
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {vec3} out
- */
-vec3.divide = function(out, a, b) {
- out[0] = a[0] / b[0];
- out[1] = a[1] / b[1];
- out[2] = a[2] / b[2];
- return out;
-};
-
-/**
- * Alias for {@link vec3.divide}
- * @function
- */
-vec3.div = vec3.divide;
-
-/**
- * Returns the minimum of two vec3's
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {vec3} out
- */
-vec3.min = function(out, a, b) {
- out[0] = Math.min(a[0], b[0]);
- out[1] = Math.min(a[1], b[1]);
- out[2] = Math.min(a[2], b[2]);
- return out;
-};
-
-/**
- * Returns the maximum of two vec3's
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {vec3} out
- */
-vec3.max = function(out, a, b) {
- out[0] = Math.max(a[0], b[0]);
- out[1] = Math.max(a[1], b[1]);
- out[2] = Math.max(a[2], b[2]);
- return out;
-};
-
-/**
- * Scales a vec3 by a scalar number
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the vector to scale
- * @param {Number} b amount to scale the vector by
- * @returns {vec3} out
- */
-vec3.scale = function(out, a, b) {
- out[0] = a[0] * b;
- out[1] = a[1] * b;
- out[2] = a[2] * b;
- return out;
-};
-
-/**
- * Adds two vec3's after scaling the second operand by a scalar value
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @param {Number} scale the amount to scale b by before adding
- * @returns {vec3} out
- */
-vec3.scaleAndAdd = function(out, a, b, scale) {
- out[0] = a[0] + (b[0] * scale);
- out[1] = a[1] + (b[1] * scale);
- out[2] = a[2] + (b[2] * scale);
- return out;
-};
-
-/**
- * Calculates the euclidian distance between two vec3's
- *
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {Number} distance between a and b
- */
-vec3.distance = function(a, b) {
- var x = b[0] - a[0],
- y = b[1] - a[1],
- z = b[2] - a[2];
- return Math.sqrt(x*x + y*y + z*z);
-};
-
-/**
- * Alias for {@link vec3.distance}
- * @function
- */
-vec3.dist = vec3.distance;
-
-/**
- * Calculates the squared euclidian distance between two vec3's
- *
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {Number} squared distance between a and b
- */
-vec3.squaredDistance = function(a, b) {
- var x = b[0] - a[0],
- y = b[1] - a[1],
- z = b[2] - a[2];
- return x*x + y*y + z*z;
-};
-
-/**
- * Alias for {@link vec3.squaredDistance}
- * @function
- */
-vec3.sqrDist = vec3.squaredDistance;
-
-/**
- * Calculates the length of a vec3
- *
- * @param {vec3} a vector to calculate length of
- * @returns {Number} length of a
- */
-vec3.length = function (a) {
- var x = a[0],
- y = a[1],
- z = a[2];
- return Math.sqrt(x*x + y*y + z*z);
-};
-
-/**
- * Alias for {@link vec3.length}
- * @function
- */
-vec3.len = vec3.length;
-
-/**
- * Calculates the squared length of a vec3
- *
- * @param {vec3} a vector to calculate squared length of
- * @returns {Number} squared length of a
- */
-vec3.squaredLength = function (a) {
- var x = a[0],
- y = a[1],
- z = a[2];
- return x*x + y*y + z*z;
-};
-
-/**
- * Alias for {@link vec3.squaredLength}
- * @function
- */
-vec3.sqrLen = vec3.squaredLength;
-
-/**
- * Negates the components of a vec3
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a vector to negate
- * @returns {vec3} out
- */
-vec3.negate = function(out, a) {
- out[0] = -a[0];
- out[1] = -a[1];
- out[2] = -a[2];
- return out;
-};
-
-/**
- * Returns the inverse of the components of a vec3
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a vector to invert
- * @returns {vec3} out
- */
-vec3.inverse = function(out, a) {
- out[0] = 1.0 / a[0];
- out[1] = 1.0 / a[1];
- out[2] = 1.0 / a[2];
- return out;
-};
-
-/**
- * Normalize a vec3
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a vector to normalize
- * @returns {vec3} out
- */
-vec3.normalize = function(out, a) {
- var x = a[0],
- y = a[1],
- z = a[2];
- var len = x*x + y*y + z*z;
- if (len > 0) {
- //TODO: evaluate use of glm_invsqrt here?
- len = 1 / Math.sqrt(len);
- out[0] = a[0] * len;
- out[1] = a[1] * len;
- out[2] = a[2] * len;
- }
- return out;
-};
-
-/**
- * Calculates the dot product of two vec3's
- *
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {Number} dot product of a and b
- */
-vec3.dot = function (a, b) {
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
-};
-
-/**
- * Computes the cross product of two vec3's
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @returns {vec3} out
- */
-vec3.cross = function(out, a, b) {
- var ax = a[0], ay = a[1], az = a[2],
- bx = b[0], by = b[1], bz = b[2];
-
- out[0] = ay * bz - az * by;
- out[1] = az * bx - ax * bz;
- out[2] = ax * by - ay * bx;
- return out;
-};
-
-/**
- * Performs a linear interpolation between two vec3's
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @param {Number} t interpolation amount between the two inputs
- * @returns {vec3} out
- */
-vec3.lerp = function (out, a, b, t) {
- var ax = a[0],
- ay = a[1],
- az = a[2];
- out[0] = ax + t * (b[0] - ax);
- out[1] = ay + t * (b[1] - ay);
- out[2] = az + t * (b[2] - az);
- return out;
-};
-
-/**
- * Performs a hermite interpolation with two control points
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @param {vec3} c the third operand
- * @param {vec3} d the fourth operand
- * @param {Number} t interpolation amount between the two inputs
- * @returns {vec3} out
- */
-vec3.hermite = function (out, a, b, c, d, t) {
- var factorTimes2 = t * t,
- factor1 = factorTimes2 * (2 * t - 3) + 1,
- factor2 = factorTimes2 * (t - 2) + t,
- factor3 = factorTimes2 * (t - 1),
- factor4 = factorTimes2 * (3 - 2 * t);
-
- out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
- out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
- out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
-
- return out;
-};
-
-/**
- * Performs a bezier interpolation with two control points
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the first operand
- * @param {vec3} b the second operand
- * @param {vec3} c the third operand
- * @param {vec3} d the fourth operand
- * @param {Number} t interpolation amount between the two inputs
- * @returns {vec3} out
- */
-vec3.bezier = function (out, a, b, c, d, t) {
- var inverseFactor = 1 - t,
- inverseFactorTimesTwo = inverseFactor * inverseFactor,
- factorTimes2 = t * t,
- factor1 = inverseFactorTimesTwo * inverseFactor,
- factor2 = 3 * t * inverseFactorTimesTwo,
- factor3 = 3 * factorTimes2 * inverseFactor,
- factor4 = factorTimes2 * t;
-
- out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4;
- out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4;
- out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4;
-
- return out;
-};
-
-/**
- * Generates a random vector with the given scale
- *
- * @param {vec3} out the receiving vector
- * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
- * @returns {vec3} out
- */
-vec3.random = function (out, scale) {
- scale = scale || 1.0;
-
- var r = glMatrix.RANDOM() * 2.0 * Math.PI;
- var z = (glMatrix.RANDOM() * 2.0) - 1.0;
- var zScale = Math.sqrt(1.0-z*z) * scale;
-
- out[0] = Math.cos(r) * zScale;
- out[1] = Math.sin(r) * zScale;
- out[2] = z * scale;
- return out;
-};
-
-/**
- * Transforms the vec3 with a mat4.
- * 4th vector component is implicitly '1'
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the vector to transform
- * @param {mat4} m matrix to transform with
- * @returns {vec3} out
- */
-vec3.transformMat4 = function(out, a, m) {
- var x = a[0], y = a[1], z = a[2],
- w = m[3] * x + m[7] * y + m[11] * z + m[15];
- w = w || 1.0;
- out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w;
- out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w;
- out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w;
- return out;
-};
-
-/**
- * Transforms the vec3 with a mat3.
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the vector to transform
- * @param {mat4} m the 3x3 matrix to transform with
- * @returns {vec3} out
- */
-vec3.transformMat3 = function(out, a, m) {
- var x = a[0], y = a[1], z = a[2];
- out[0] = x * m[0] + y * m[3] + z * m[6];
- out[1] = x * m[1] + y * m[4] + z * m[7];
- out[2] = x * m[2] + y * m[5] + z * m[8];
- return out;
-};
-
-/**
- * Transforms the vec3 with a quat
- *
- * @param {vec3} out the receiving vector
- * @param {vec3} a the vector to transform
- * @param {quat} q quaternion to transform with
- * @returns {vec3} out
- */
-vec3.transformQuat = function(out, a, q) {
- // benchmarks: http://jsperf.com/quaternion-transform-vec3-implementations
-
- var x = a[0], y = a[1], z = a[2],
- qx = q[0], qy = q[1], qz = q[2], qw = q[3],
-
- // calculate quat * vec
- ix = qw * x + qy * z - qz * y,
- iy = qw * y + qz * x - qx * z,
- iz = qw * z + qx * y - qy * x,
- iw = -qx * x - qy * y - qz * z;
-
- // calculate result * inverse quat
- out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
- out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
- out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
- return out;
-};
-
-/**
- * Rotate a 3D vector around the x-axis
- * @param {vec3} out The receiving vec3
- * @param {vec3} a The vec3 point to rotate
- * @param {vec3} b The origin of the rotation
- * @param {Number} c The angle of rotation
- * @returns {vec3} out
- */
-vec3.rotateX = function(out, a, b, c){
- var p = [], r=[];
- //Translate point to the origin
- p[0] = a[0] - b[0];
- p[1] = a[1] - b[1];
- p[2] = a[2] - b[2];
-
- //perform rotation
- r[0] = p[0];
- r[1] = p[1]*Math.cos(c) - p[2]*Math.sin(c);
- r[2] = p[1]*Math.sin(c) + p[2]*Math.cos(c);
-
- //translate to correct position
- out[0] = r[0] + b[0];
- out[1] = r[1] + b[1];
- out[2] = r[2] + b[2];
-
- return out;
-};
-
-/**
- * Rotate a 3D vector around the y-axis
- * @param {vec3} out The receiving vec3
- * @param {vec3} a The vec3 point to rotate
- * @param {vec3} b The origin of the rotation
- * @param {Number} c The angle of rotation
- * @returns {vec3} out
- */
-vec3.rotateY = function(out, a, b, c){
- var p = [], r=[];
- //Translate point to the origin
- p[0] = a[0] - b[0];
- p[1] = a[1] - b[1];
- p[2] = a[2] - b[2];
-
- //perform rotation
- r[0] = p[2]*Math.sin(c) + p[0]*Math.cos(c);
- r[1] = p[1];
- r[2] = p[2]*Math.cos(c) - p[0]*Math.sin(c);
-
- //translate to correct position
- out[0] = r[0] + b[0];
- out[1] = r[1] + b[1];
- out[2] = r[2] + b[2];
-
- return out;
-};
-
-/**
- * Rotate a 3D vector around the z-axis
- * @param {vec3} out The receiving vec3
- * @param {vec3} a The vec3 point to rotate
- * @param {vec3} b The origin of the rotation
- * @param {Number} c The angle of rotation
- * @returns {vec3} out
- */
-vec3.rotateZ = function(out, a, b, c){
- var p = [], r=[];
- //Translate point to the origin
- p[0] = a[0] - b[0];
- p[1] = a[1] - b[1];
- p[2] = a[2] - b[2];
-
- //perform rotation
- r[0] = p[0]*Math.cos(c) - p[1]*Math.sin(c);
- r[1] = p[0]*Math.sin(c) + p[1]*Math.cos(c);
- r[2] = p[2];
-
- //translate to correct position
- out[0] = r[0] + b[0];
- out[1] = r[1] + b[1];
- out[2] = r[2] + b[2];
-
- return out;
-};
-
-/**
- * Perform some operation over an array of vec3s.
- *
- * @param {Array} a the array of vectors to iterate over
- * @param {Number} stride Number of elements between the start of each vec3. If 0 assumes tightly packed
- * @param {Number} offset Number of elements to skip at the beginning of the array
- * @param {Number} count Number of vec3s to iterate over. If 0 iterates over entire array
- * @param {Function} fn Function to call for each vector in the array
- * @param {Object} [arg] additional argument to pass to fn
- * @returns {Array} a
- * @function
- */
-vec3.forEach = (function() {
- var vec = vec3.create();
-
- return function(a, stride, offset, count, fn, arg) {
- var i, l;
- if(!stride) {
- stride = 3;
- }
-
- if(!offset) {
- offset = 0;
- }
-
- if(count) {
- l = Math.min((count * stride) + offset, a.length);
- } else {
- l = a.length;
- }
-
- for(i = offset; i < l; i += stride) {
- vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2];
- fn(vec, vec, arg);
- a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2];
- }
-
- return a;
- };
-})();
-
-/**
- * Get the angle between two 3D vectors
- * @param {vec3} a The first operand
- * @param {vec3} b The second operand
- * @returns {Number} The angle in radians
- */
-vec3.angle = function(a, b) {
-
- var tempA = vec3.fromValues(a[0], a[1], a[2]);
- var tempB = vec3.fromValues(b[0], b[1], b[2]);
-
- vec3.normalize(tempA, tempA);
- vec3.normalize(tempB, tempB);
-
- var cosine = vec3.dot(tempA, tempB);
-
- if(cosine > 1.0){
- return 0;
- } else {
- return Math.acos(cosine);
- }
-};
-
-/**
- * Returns a string representation of a vector
- *
- * @param {vec3} vec vector to represent as a string
- * @returns {String} string representation of the vector
- */
-vec3.str = function (a) {
- return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';
-};
-
-module.exports = vec3;
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/vec4.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/vec4.js
deleted file mode 100644
index f18d17440ae..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/src/gl-matrix/vec4.js
+++ /dev/null
@@ -1,537 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-var glMatrix = require("./common.js");
-
-/**
- * @class 4 Dimensional Vector
- * @name vec4
- */
-var vec4 = {};
-
-/**
- * Creates a new, empty vec4
- *
- * @returns {vec4} a new 4D vector
- */
-vec4.create = function() {
- var out = new glMatrix.ARRAY_TYPE(4);
- out[0] = 0;
- out[1] = 0;
- out[2] = 0;
- out[3] = 0;
- return out;
-};
-
-/**
- * Creates a new vec4 initialized with values from an existing vector
- *
- * @param {vec4} a vector to clone
- * @returns {vec4} a new 4D vector
- */
-vec4.clone = function(a) {
- var out = new glMatrix.ARRAY_TYPE(4);
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- return out;
-};
-
-/**
- * Creates a new vec4 initialized with the given values
- *
- * @param {Number} x X component
- * @param {Number} y Y component
- * @param {Number} z Z component
- * @param {Number} w W component
- * @returns {vec4} a new 4D vector
- */
-vec4.fromValues = function(x, y, z, w) {
- var out = new glMatrix.ARRAY_TYPE(4);
- out[0] = x;
- out[1] = y;
- out[2] = z;
- out[3] = w;
- return out;
-};
-
-/**
- * Copy the values from one vec4 to another
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the source vector
- * @returns {vec4} out
- */
-vec4.copy = function(out, a) {
- out[0] = a[0];
- out[1] = a[1];
- out[2] = a[2];
- out[3] = a[3];
- return out;
-};
-
-/**
- * Set the components of a vec4 to the given values
- *
- * @param {vec4} out the receiving vector
- * @param {Number} x X component
- * @param {Number} y Y component
- * @param {Number} z Z component
- * @param {Number} w W component
- * @returns {vec4} out
- */
-vec4.set = function(out, x, y, z, w) {
- out[0] = x;
- out[1] = y;
- out[2] = z;
- out[3] = w;
- return out;
-};
-
-/**
- * Adds two vec4's
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {vec4} out
- */
-vec4.add = function(out, a, b) {
- out[0] = a[0] + b[0];
- out[1] = a[1] + b[1];
- out[2] = a[2] + b[2];
- out[3] = a[3] + b[3];
- return out;
-};
-
-/**
- * Subtracts vector b from vector a
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {vec4} out
- */
-vec4.subtract = function(out, a, b) {
- out[0] = a[0] - b[0];
- out[1] = a[1] - b[1];
- out[2] = a[2] - b[2];
- out[3] = a[3] - b[3];
- return out;
-};
-
-/**
- * Alias for {@link vec4.subtract}
- * @function
- */
-vec4.sub = vec4.subtract;
-
-/**
- * Multiplies two vec4's
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {vec4} out
- */
-vec4.multiply = function(out, a, b) {
- out[0] = a[0] * b[0];
- out[1] = a[1] * b[1];
- out[2] = a[2] * b[2];
- out[3] = a[3] * b[3];
- return out;
-};
-
-/**
- * Alias for {@link vec4.multiply}
- * @function
- */
-vec4.mul = vec4.multiply;
-
-/**
- * Divides two vec4's
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {vec4} out
- */
-vec4.divide = function(out, a, b) {
- out[0] = a[0] / b[0];
- out[1] = a[1] / b[1];
- out[2] = a[2] / b[2];
- out[3] = a[3] / b[3];
- return out;
-};
-
-/**
- * Alias for {@link vec4.divide}
- * @function
- */
-vec4.div = vec4.divide;
-
-/**
- * Returns the minimum of two vec4's
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {vec4} out
- */
-vec4.min = function(out, a, b) {
- out[0] = Math.min(a[0], b[0]);
- out[1] = Math.min(a[1], b[1]);
- out[2] = Math.min(a[2], b[2]);
- out[3] = Math.min(a[3], b[3]);
- return out;
-};
-
-/**
- * Returns the maximum of two vec4's
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {vec4} out
- */
-vec4.max = function(out, a, b) {
- out[0] = Math.max(a[0], b[0]);
- out[1] = Math.max(a[1], b[1]);
- out[2] = Math.max(a[2], b[2]);
- out[3] = Math.max(a[3], b[3]);
- return out;
-};
-
-/**
- * Scales a vec4 by a scalar number
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the vector to scale
- * @param {Number} b amount to scale the vector by
- * @returns {vec4} out
- */
-vec4.scale = function(out, a, b) {
- out[0] = a[0] * b;
- out[1] = a[1] * b;
- out[2] = a[2] * b;
- out[3] = a[3] * b;
- return out;
-};
-
-/**
- * Adds two vec4's after scaling the second operand by a scalar value
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @param {Number} scale the amount to scale b by before adding
- * @returns {vec4} out
- */
-vec4.scaleAndAdd = function(out, a, b, scale) {
- out[0] = a[0] + (b[0] * scale);
- out[1] = a[1] + (b[1] * scale);
- out[2] = a[2] + (b[2] * scale);
- out[3] = a[3] + (b[3] * scale);
- return out;
-};
-
-/**
- * Calculates the euclidian distance between two vec4's
- *
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {Number} distance between a and b
- */
-vec4.distance = function(a, b) {
- var x = b[0] - a[0],
- y = b[1] - a[1],
- z = b[2] - a[2],
- w = b[3] - a[3];
- return Math.sqrt(x*x + y*y + z*z + w*w);
-};
-
-/**
- * Alias for {@link vec4.distance}
- * @function
- */
-vec4.dist = vec4.distance;
-
-/**
- * Calculates the squared euclidian distance between two vec4's
- *
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {Number} squared distance between a and b
- */
-vec4.squaredDistance = function(a, b) {
- var x = b[0] - a[0],
- y = b[1] - a[1],
- z = b[2] - a[2],
- w = b[3] - a[3];
- return x*x + y*y + z*z + w*w;
-};
-
-/**
- * Alias for {@link vec4.squaredDistance}
- * @function
- */
-vec4.sqrDist = vec4.squaredDistance;
-
-/**
- * Calculates the length of a vec4
- *
- * @param {vec4} a vector to calculate length of
- * @returns {Number} length of a
- */
-vec4.length = function (a) {
- var x = a[0],
- y = a[1],
- z = a[2],
- w = a[3];
- return Math.sqrt(x*x + y*y + z*z + w*w);
-};
-
-/**
- * Alias for {@link vec4.length}
- * @function
- */
-vec4.len = vec4.length;
-
-/**
- * Calculates the squared length of a vec4
- *
- * @param {vec4} a vector to calculate squared length of
- * @returns {Number} squared length of a
- */
-vec4.squaredLength = function (a) {
- var x = a[0],
- y = a[1],
- z = a[2],
- w = a[3];
- return x*x + y*y + z*z + w*w;
-};
-
-/**
- * Alias for {@link vec4.squaredLength}
- * @function
- */
-vec4.sqrLen = vec4.squaredLength;
-
-/**
- * Negates the components of a vec4
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a vector to negate
- * @returns {vec4} out
- */
-vec4.negate = function(out, a) {
- out[0] = -a[0];
- out[1] = -a[1];
- out[2] = -a[2];
- out[3] = -a[3];
- return out;
-};
-
-/**
- * Returns the inverse of the components of a vec4
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a vector to invert
- * @returns {vec4} out
- */
-vec4.inverse = function(out, a) {
- out[0] = 1.0 / a[0];
- out[1] = 1.0 / a[1];
- out[2] = 1.0 / a[2];
- out[3] = 1.0 / a[3];
- return out;
-};
-
-/**
- * Normalize a vec4
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a vector to normalize
- * @returns {vec4} out
- */
-vec4.normalize = function(out, a) {
- var x = a[0],
- y = a[1],
- z = a[2],
- w = a[3];
- var len = x*x + y*y + z*z + w*w;
- if (len > 0) {
- len = 1 / Math.sqrt(len);
- out[0] = x * len;
- out[1] = y * len;
- out[2] = z * len;
- out[3] = w * len;
- }
- return out;
-};
-
-/**
- * Calculates the dot product of two vec4's
- *
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @returns {Number} dot product of a and b
- */
-vec4.dot = function (a, b) {
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
-};
-
-/**
- * Performs a linear interpolation between two vec4's
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the first operand
- * @param {vec4} b the second operand
- * @param {Number} t interpolation amount between the two inputs
- * @returns {vec4} out
- */
-vec4.lerp = function (out, a, b, t) {
- var ax = a[0],
- ay = a[1],
- az = a[2],
- aw = a[3];
- out[0] = ax + t * (b[0] - ax);
- out[1] = ay + t * (b[1] - ay);
- out[2] = az + t * (b[2] - az);
- out[3] = aw + t * (b[3] - aw);
- return out;
-};
-
-/**
- * Generates a random vector with the given scale
- *
- * @param {vec4} out the receiving vector
- * @param {Number} [scale] Length of the resulting vector. If ommitted, a unit vector will be returned
- * @returns {vec4} out
- */
-vec4.random = function (out, scale) {
- scale = scale || 1.0;
-
- //TODO: This is a pretty awful way of doing this. Find something better.
- out[0] = glMatrix.RANDOM();
- out[1] = glMatrix.RANDOM();
- out[2] = glMatrix.RANDOM();
- out[3] = glMatrix.RANDOM();
- vec4.normalize(out, out);
- vec4.scale(out, out, scale);
- return out;
-};
-
-/**
- * Transforms the vec4 with a mat4.
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the vector to transform
- * @param {mat4} m matrix to transform with
- * @returns {vec4} out
- */
-vec4.transformMat4 = function(out, a, m) {
- var x = a[0], y = a[1], z = a[2], w = a[3];
- out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w;
- out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w;
- out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w;
- out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w;
- return out;
-};
-
-/**
- * Transforms the vec4 with a quat
- *
- * @param {vec4} out the receiving vector
- * @param {vec4} a the vector to transform
- * @param {quat} q quaternion to transform with
- * @returns {vec4} out
- */
-vec4.transformQuat = function(out, a, q) {
- var x = a[0], y = a[1], z = a[2],
- qx = q[0], qy = q[1], qz = q[2], qw = q[3],
-
- // calculate quat * vec
- ix = qw * x + qy * z - qz * y,
- iy = qw * y + qz * x - qx * z,
- iz = qw * z + qx * y - qy * x,
- iw = -qx * x - qy * y - qz * z;
-
- // calculate result * inverse quat
- out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
- out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
- out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
- out[3] = a[3];
- return out;
-};
-
-/**
- * Perform some operation over an array of vec4s.
- *
- * @param {Array} a the array of vectors to iterate over
- * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed
- * @param {Number} offset Number of elements to skip at the beginning of the array
- * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array
- * @param {Function} fn Function to call for each vector in the array
- * @param {Object} [arg] additional argument to pass to fn
- * @returns {Array} a
- * @function
- */
-vec4.forEach = (function() {
- var vec = vec4.create();
-
- return function(a, stride, offset, count, fn, arg) {
- var i, l;
- if(!stride) {
- stride = 4;
- }
-
- if(!offset) {
- offset = 0;
- }
-
- if(count) {
- l = Math.min((count * stride) + offset, a.length);
- } else {
- l = a.length;
- }
-
- for(i = offset; i < l; i += stride) {
- vec[0] = a[i]; vec[1] = a[i+1]; vec[2] = a[i+2]; vec[3] = a[i+3];
- fn(vec, vec, arg);
- a[i] = vec[0]; a[i+1] = vec[1]; a[i+2] = vec[2]; a[i+3] = vec[3];
- }
-
- return a;
- };
-})();
-
-/**
- * Returns a string representation of a vector
- *
- * @param {vec4} vec vector to represent as a string
- * @returns {String} string representation of the vector
- */
-vec4.str = function (a) {
- return 'vec4(' + a[0] + ', ' + a[1] + ', ' + a[2] + ', ' + a[3] + ')';
-};
-
-module.exports = vec4;
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/build.rake b/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/build.rake
deleted file mode 100644
index a1783aabc7c..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/build.rake
+++ /dev/null
@@ -1,2 +0,0 @@
-desc "compile & minify sources into a single file"
-task :build => ['build:compile', 'build:minify']
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/build/compile.rake b/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/build/compile.rake
deleted file mode 100644
index 905e393d889..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/build/compile.rake
+++ /dev/null
@@ -1,5 +0,0 @@
-namespace :build do
- task :compile do
- compile
- end
-end
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/build/minify.rake b/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/build/minify.rake
deleted file mode 100644
index ea5fec42af5..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/build/minify.rake
+++ /dev/null
@@ -1,5 +0,0 @@
-namespace :build do
- task :minify do
- minify
- end
-end
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/default.rake b/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/default.rake
deleted file mode 100644
index c057922037d..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/default.rake
+++ /dev/null
@@ -1 +0,0 @@
-task :default => ['test:node', 'test:ci']
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/release.rake b/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/release.rake
deleted file mode 100644
index c70f70cfc13..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/release.rake
+++ /dev/null
@@ -1,21 +0,0 @@
-desc "tag and release gl-matrix v#{GLMatrix::VERSION}"
-task :release do
- require 'thor'
- Bundler.ui = Bundler::UI::Shell.new(Thor::Shell::Basic.new)
- Bundler.ui.debug! if ENV['DEBUG']
-
- # Sanity check: rebuild files just in case dev forgot to.
- # If so, files will change and release will abort since changes
- # were not checked in.
- Rake::Task['build'].invoke
-
- release do
- # Put other release-related stuff here, such as publishing docs;
- # if anything fails, gl-matrix will be untagged and not pushed.
- #
- # Example:
- #
- # Rake::Task['doc:publish'].invoke
- #
- end
-end
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/support/gl-matrix.rb b/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/support/gl-matrix.rb
deleted file mode 100644
index cecdc615a97..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/support/gl-matrix.rb
+++ /dev/null
@@ -1,84 +0,0 @@
-# Copyright (c) 2013 Brandon Jones, Colin MacKenzie IV
-#
-# This software is provided 'as-is', without any express or implied
-# warranty. In no event will the authors be held liable for any damages
-# arising from the use of this software.
-#
-# Permission is granted to anyone to use this software for any purpose,
-# including commercial applications, and to alter it and redistribute it
-# freely, subject to the following restrictions:
-#
-# 1. The origin of this software must not be misrepresented; you must not
-# claim that you wrote the original software. If you use this software
-# in a product, an acknowledgment in the product documentation would be
-# appreciated but is not required.
-#
-# 2. Altered source versions must be plainly marked as such, and must not
-# be misrepresented as being the original software.
-#
-# 3. This notice may not be removed or altered from any source distribution.
-#
-$:.unshift File.expand_path('.', File.dirname(__FILE__))
-require 'sprockets'
-require 'jasmine'
-
-class Jasmine::Config
- def simple_config_file
- File.expand_path GLMatrix.base_path.join('spec/jasmine.yml')
- end
-end
-
-class Rack::Jasmine::Runner
- alias_method :jasmine_call, :call
- def call(env)
- GLMatrix.compile
- jasmine_call env
- end
-end
-
-module GLMatrix
- autoload :ReleaseHelper, 'gl-matrix/release_helper'
- autoload :Version, 'gl-matrix/version'
- autoload :VERSION, 'gl-matrix/version'
-
- module_function
-
- def release(&block)
- GLMatrix::ReleaseHelper.release &block
- end
-
- def sprockets
- env = Sprockets::Environment.new base_path
- env.append_path base_path.join('src')
- env
- end
-
- def base_path
- Pathname.new File.expand_path('../..', File.dirname(__FILE__))
- end
-
- # Compiles the source file to the dest file. If a block
- # is given, the source file is yielded and replaced with
- # the result. Returns the destination as a Pathname.
- def compile(source = 'gl-matrix.js', dest = 'dist/gl-matrix.js')
- dest = base_path.join dest
- js = sprockets[source]
- js = yield js if block_given?
-
- File.open dest, "w" do |f|
- f.puts js
- end
-
- puts "compiled #{source} to #{dest.relative_path_from base_path}"
- dest
- end
-
- def minify(source = 'gl-matrix.js', dest = 'dist/gl-matrix-min.js')
- dest = compile source, dest do |js|
- Uglifier.compile js
- end
-
- puts "minified #{source} to #{dest.relative_path_from base_path}"
- end
-
-end
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/support/gl-matrix/release_helper.rb b/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/support/gl-matrix/release_helper.rb
deleted file mode 100644
index 4aca02baf88..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/support/gl-matrix/release_helper.rb
+++ /dev/null
@@ -1,104 +0,0 @@
-# Copyright (c) 2013 Brandon Jones, Colin MacKenzie IV
-#
-# This software is provided 'as-is', without any express or implied
-# warranty. In no event will the authors be held liable for any damages
-# arising from the use of this software.
-#
-# Permission is granted to anyone to use this software for any purpose,
-# including commercial applications, and to alter it and redistribute it
-# freely, subject to the following restrictions:
-#
-# 1. The origin of this software must not be misrepresented; you must not
-# claim that you wrote the original software. If you use this software
-# in a product, an acknowledgment in the product documentation would be
-# appreciated but is not required.
-#
-# 2. Altered source versions must be plainly marked as such, and must not
-# be misrepresented as being the original software.
-#
-# 3. This notice may not be removed or altered from any source distribution.
-
-# Pretty much everything here was ripped from Bundler.
-# https://github.com/carlhuda/bundler/blob/master/lib/bundler/gem_helper.rb
-module GLMatrix::ReleaseHelper
- module_function
-
- def release
- guard_clean
- guard_already_tagged
- tag_version {
- yield if block_given?
- git_push
- }
- end
-
- def base
- GLMatrix.base_path.to_s
- end
-
- def git_push
- perform_git_push
- perform_git_push ' --tags'
- Bundler.ui.confirm "Pushed git commits and tags"
- end
-
- def perform_git_push(options = '')
- cmd = "git push #{options}"
- out, code = sh_with_code(cmd)
- raise "Couldn't git push. `#{cmd}' failed with the following output:\n\n#{out}\n" unless code == 0
- end
-
- def guard_already_tagged
- if sh('git tag').split(/\n/).include?(version_tag)
- raise("This tag has already been committed to the repo.")
- end
- end
-
- def guard_clean
- clean? or raise("There are files that need to be committed first.")
- end
-
- def clean?
- sh_with_code("git diff --exit-code")[1] == 0
- end
-
- def tag_version
- sh "git tag -a -m \"Version #{version}\" #{version_tag}"
- Bundler.ui.confirm "Tagged #{version_tag}"
- yield if block_given?
- rescue
- Bundler.ui.error "Untagged #{version_tag} due to error"
- sh_with_code "git tag -d #{version_tag}"
- raise
- end
-
- def version
- GLMatrix::VERSION
- end
-
- def version_tag
- "v#{version}"
- end
-
- def name
- "gl-matrix"
- end
-
- def sh(cmd, &block)
- out, code = sh_with_code(cmd, &block)
- code == 0 ? out : raise(out.empty? ? "Running `#{cmd}' failed. Run this command directly for more detailed output." : out)
- end
-
- def sh_with_code(cmd, &block)
- cmd << " 2>&1"
- outbuf = ''
- Bundler.ui.debug(cmd)
- Dir.chdir(base) {
- outbuf = `#{cmd}`
- if $? == 0
- block.call(outbuf) if block
- end
- }
- [outbuf, $?]
- end
-end
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/support/gl-matrix/version.rb b/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/support/gl-matrix/version.rb
deleted file mode 100644
index 73bb9d2889d..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/tasks/support/gl-matrix/version.rb
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright (c) 2013 Brandon Jones, Colin MacKenzie IV
-#
-# This software is provided 'as-is', without any express or implied
-# warranty. In no event will the authors be held liable for any damages
-# arising from the use of this software.
-#
-# Permission is granted to anyone to use this software for any purpose,
-# including commercial applications, and to alter it and redistribute it
-# freely, subject to the following restrictions:
-#
-# 1. The origin of this software must not be misrepresented; you must not
-# claim that you wrote the original software. If you use this software
-# in a product, an acknowledgment in the product documentation would be
-# appreciated but is not required.
-#
-# 2. Altered source versions must be plainly marked as such, and must not
-# be misrepresented as being the original software.
-#
-# 3. This notice may not be removed or altered from any source distribution.
-
-module GLMatrix
- module Version
- MAJOR, MINOR, PATCH, REL = *File.read(base_path.join 'VERSION').split(".")
- STRING = [MAJOR, MINOR, PATCH, REL].compact.join '.'
- end
-
- VERSION = Version::STRING
-end
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/webpack.config.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/webpack.config.js
deleted file mode 100644
index b9eace3a5ad..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/webpack.config.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-var fs = require('fs');
-var webpack = require('webpack');
-
-var entryFile = './src/gl-matrix.js';
-
-// Read the comments from the top of the main gl-matrix file and append them to
-// the minified version.
-var header = '';
-var mainFile = fs.readFileSync(entryFile, { encoding: 'utf8' });
-if (mainFile) {
- var headerIndex = mainFile.indexOf('\/\/ END HEADER');
- if (headerIndex >= 0) {
- header = mainFile.substr(0, headerIndex);
- }
-}
-
-module.exports = {
- entry: entryFile,
- output: {
- path: __dirname + '/dist',
- filename: 'gl-matrix.js',
- libraryTarget: 'umd'
- },
- plugins: [
- new webpack.BannerPlugin(header, { raw: true }),
- ]
-}; \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/gl-matrix/webpack.config.min.js b/chromium/third_party/catapult/tracing/third_party/gl-matrix/webpack.config.min.js
deleted file mode 100644
index c7f91092d1b..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/gl-matrix/webpack.config.min.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE. */
-
-var webpack = require('webpack');
-module.exports = require('./webpack.config.js');
-
-module.exports.plugins.unshift(
- new webpack.optimize.UglifyJsPlugin()
-);
-
-module.exports.output.filename = 'gl-matrix-min.js'; \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/jszip/LICENSE.markdown b/chromium/third_party/catapult/tracing/third_party/jszip/LICENSE.markdown
deleted file mode 100644
index 77b40ad819e..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/jszip/LICENSE.markdown
+++ /dev/null
@@ -1,651 +0,0 @@
-JSZip is dual licensed. You may use it under the MIT license *or* the GPLv3
-license.
-
-The MIT License
-===============
-
-Copyright (c) 2009-2012 Stuart Knightley, David Duponchel, Franz Buchinger, António Afonso
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-
-GPL version 3
-=============
-
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
diff --git a/chromium/third_party/catapult/tracing/third_party/jszip/README.chromium b/chromium/third_party/catapult/tracing/third_party/jszip/README.chromium
deleted file mode 100644
index ab23a109aae..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/jszip/README.chromium
+++ /dev/null
@@ -1,16 +0,0 @@
-Name: JSZip
-Short Name: JSZip
-URL: https://github.com/Stuk/jszip
-Date: Wed Aug 28 23:10:31 EST 2013
-Revision: 1b5ef3c66bd676c24dd7337ca02ecc99e119e205
-License: LICENSE.markdown
-License File: MIT
-Security Critical: no
-
-Description:
-Create, read and edit .zip files with Javascript
-
-Local Modifications:
-I deleted the below comment from jszip-inflate.js in order to make things load
-correctly.
- //@ sourceMappingURL=rawinflate.min.js.map
diff --git a/chromium/third_party/catapult/tracing/third_party/jszip/README.markdown b/chromium/third_party/catapult/tracing/third_party/jszip/README.markdown
deleted file mode 100644
index 537c7adff7e..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/jszip/README.markdown
+++ /dev/null
@@ -1,32 +0,0 @@
-JSZip
-=====
-
-A library for creating, reading and editing .zip files with Javascript, with a
-lovely and simple API.
-
-See http://stuartk.com/jszip for all the documentation
-
-```javascript
-var zip = new JSZip();
-
-zip.file("Hello.txt", "Hello World\n");
-
-var img = zip.folder("images");
-img.file("smile.gif", imgData, {base64: true});
-
-var content = zip.generate();
-
-location.href = "data:application/zip;base64," + content;
-/*
-Results in a zip containing
-Hello.txt
-images/
- smile.gif
-*/
-```
-
-License
-=======
-
-JSZip is dual-licensed. You may use it under the MIT license *or* the GPLv3
-license. See LICENSE.markdown.
diff --git a/chromium/third_party/catapult/tracing/third_party/jszip/jszip.min.js b/chromium/third_party/catapult/tracing/third_party/jszip/jszip.min.js
deleted file mode 100644
index 767d8c11d27..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/jszip/jszip.min.js
+++ /dev/null
@@ -1,14 +0,0 @@
-/*!
-
-JSZip - A Javascript class for generating and reading zip files
-<http://stuartk.com/jszip>
-
-(c) 2009-2014 Stuart Knightley <stuart [at] stuartk.com>
-Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/jszip/master/LICENSE.markdown.
-
-JSZip uses the library pako released under the MIT license :
-https://github.com/nodeca/pako/blob/master/LICENSE
-*/
-!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.JSZip=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){"use strict";var d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";c.encode=function(a){for(var b,c,e,f,g,h,i,j="",k=0;k<a.length;)b=a.charCodeAt(k++),c=a.charCodeAt(k++),e=a.charCodeAt(k++),f=b>>2,g=(3&b)<<4|c>>4,h=(15&c)<<2|e>>6,i=63&e,isNaN(c)?h=i=64:isNaN(e)&&(i=64),j=j+d.charAt(f)+d.charAt(g)+d.charAt(h)+d.charAt(i);return j},c.decode=function(a){var b,c,e,f,g,h,i,j="",k=0;for(a=a.replace(/[^A-Za-z0-9\+\/\=]/g,"");k<a.length;)f=d.indexOf(a.charAt(k++)),g=d.indexOf(a.charAt(k++)),h=d.indexOf(a.charAt(k++)),i=d.indexOf(a.charAt(k++)),b=f<<2|g>>4,c=(15&g)<<4|h>>2,e=(3&h)<<6|i,j+=String.fromCharCode(b),64!=h&&(j+=String.fromCharCode(c)),64!=i&&(j+=String.fromCharCode(e));return j}},{}],2:[function(a,b){"use strict";function c(){this.compressedSize=0,this.uncompressedSize=0,this.crc32=0,this.compressionMethod=null,this.compressedContent=null}c.prototype={getContent:function(){return null},getCompressedContent:function(){return null}},b.exports=c},{}],3:[function(a,b,c){"use strict";c.STORE={magic:"\x00\x00",compress:function(a){return a},uncompress:function(a){return a},compressInputType:null,uncompressInputType:null},c.DEFLATE=a("./flate")},{"./flate":8}],4:[function(a,b){"use strict";var c=a("./utils"),d=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117];b.exports=function(a,b){if("undefined"==typeof a||!a.length)return 0;var e="string"!==c.getTypeOf(a);"undefined"==typeof b&&(b=0);var f=0,g=0,h=0;b=-1^b;for(var i=0,j=a.length;j>i;i++)h=e?a[i]:a.charCodeAt(i),g=255&(b^h),f=d[g],b=b>>>8^f;return-1^b}},{"./utils":21}],5:[function(a,b){"use strict";function c(){this.data=null,this.length=0,this.index=0}var d=a("./utils");c.prototype={checkOffset:function(a){this.checkIndex(this.index+a)},checkIndex:function(a){if(this.length<a||0>a)throw new Error("End of data reached (data length = "+this.length+", asked index = "+a+"). Corrupted zip ?")},setIndex:function(a){this.checkIndex(a),this.index=a},skip:function(a){this.setIndex(this.index+a)},byteAt:function(){},readInt:function(a){var b,c=0;for(this.checkOffset(a),b=this.index+a-1;b>=this.index;b--)c=(c<<8)+this.byteAt(b);return this.index+=a,c},readString:function(a){return d.transformTo("string",this.readData(a))},readData:function(){},lastIndexOfSignature:function(){},readDate:function(){var a=this.readInt(4);return new Date((a>>25&127)+1980,(a>>21&15)-1,a>>16&31,a>>11&31,a>>5&63,(31&a)<<1)}},b.exports=c},{"./utils":21}],6:[function(a,b,c){"use strict";c.base64=!1,c.binary=!1,c.dir=!1,c.createFolders=!1,c.date=null,c.compression=null,c.comment=null},{}],7:[function(a,b,c){"use strict";var d=a("./utils");c.string2binary=function(a){return d.string2binary(a)},c.string2Uint8Array=function(a){return d.transformTo("uint8array",a)},c.uint8Array2String=function(a){return d.transformTo("string",a)},c.string2Blob=function(a){var b=d.transformTo("arraybuffer",a);return d.arrayBuffer2Blob(b)},c.arrayBuffer2Blob=function(a){return d.arrayBuffer2Blob(a)},c.transformTo=function(a,b){return d.transformTo(a,b)},c.getTypeOf=function(a){return d.getTypeOf(a)},c.checkSupport=function(a){return d.checkSupport(a)},c.MAX_VALUE_16BITS=d.MAX_VALUE_16BITS,c.MAX_VALUE_32BITS=d.MAX_VALUE_32BITS,c.pretty=function(a){return d.pretty(a)},c.findCompression=function(a){return d.findCompression(a)},c.isRegExp=function(a){return d.isRegExp(a)}},{"./utils":21}],8:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,e=a("pako");c.uncompressInputType=d?"uint8array":"array",c.compressInputType=d?"uint8array":"array",c.magic="\b\x00",c.compress=function(a){return e.deflateRaw(a)},c.uncompress=function(a){return e.inflateRaw(a)}},{pako:24}],9:[function(a,b){"use strict";function c(a,b){return this instanceof c?(this.files={},this.comment=null,this.root="",a&&this.load(a,b),void(this.clone=function(){var a=new c;for(var b in this)"function"!=typeof this[b]&&(a[b]=this[b]);return a})):new c(a,b)}var d=a("./base64");c.prototype=a("./object"),c.prototype.load=a("./load"),c.support=a("./support"),c.defaults=a("./defaults"),c.utils=a("./deprecatedPublicUtils"),c.base64={encode:function(a){return d.encode(a)},decode:function(a){return d.decode(a)}},c.compressions=a("./compressions"),b.exports=c},{"./base64":1,"./compressions":3,"./defaults":6,"./deprecatedPublicUtils":7,"./load":10,"./object":13,"./support":17}],10:[function(a,b){"use strict";var c=a("./base64"),d=a("./zipEntries");b.exports=function(a,b){var e,f,g,h;for(b=b||{},b.base64&&(a=c.decode(a)),f=new d(a,b),e=f.files,g=0;g<e.length;g++)h=e[g],this.file(h.fileName,h.decompressed,{binary:!0,optimizedBinaryString:!0,date:h.date,dir:h.dir,comment:h.fileComment.length?h.fileComment:null,createFolders:b.createFolders});return f.zipComment.length&&(this.comment=f.zipComment),this}},{"./base64":1,"./zipEntries":22}],11:[function(a,b){(function(a){"use strict";b.exports=function(b,c){return new a(b,c)},b.exports.test=function(b){return a.isBuffer(b)}}).call(this,"undefined"!=typeof Buffer?Buffer:void 0)},{}],12:[function(a,b){"use strict";function c(a){this.data=a,this.length=this.data.length,this.index=0}var d=a("./uint8ArrayReader");c.prototype=new d,c.prototype.readData=function(a){this.checkOffset(a);var b=this.data.slice(this.index,this.index+a);return this.index+=a,b},b.exports=c},{"./uint8ArrayReader":18}],13:[function(a,b){"use strict";var c=a("./support"),d=a("./utils"),e=a("./crc32"),f=a("./signature"),g=a("./defaults"),h=a("./base64"),i=a("./compressions"),j=a("./compressedObject"),k=a("./nodeBuffer"),l=a("./utf8"),m=a("./stringWriter"),n=a("./uint8ArrayWriter"),o=function(a){if(a._data instanceof j&&(a._data=a._data.getContent(),a.options.binary=!0,a.options.base64=!1,"uint8array"===d.getTypeOf(a._data))){var b=a._data;a._data=new Uint8Array(b.length),0!==b.length&&a._data.set(b,0)}return a._data},p=function(a){var b=o(a),e=d.getTypeOf(b);return"string"===e?!a.options.binary&&c.nodebuffer?k(b,"utf-8"):a.asBinary():b},q=function(a){var b=o(this);return null===b||"undefined"==typeof b?"":(this.options.base64&&(b=h.decode(b)),b=a&&this.options.binary?A.utf8decode(b):d.transformTo("string",b),a||this.options.binary||(b=d.transformTo("string",A.utf8encode(b))),b)},r=function(a,b,c){this.name=a,this.dir=c.dir,this.date=c.date,this.comment=c.comment,this._data=b,this.options=c,this._initialMetadata={dir:c.dir,date:c.date}};r.prototype={asText:function(){return q.call(this,!0)},asBinary:function(){return q.call(this,!1)},asNodeBuffer:function(){var a=p(this);return d.transformTo("nodebuffer",a)},asUint8Array:function(){var a=p(this);return d.transformTo("uint8array",a)},asArrayBuffer:function(){return this.asUint8Array().buffer}};var s=function(a,b){var c,d="";for(c=0;b>c;c++)d+=String.fromCharCode(255&a),a>>>=8;return d},t=function(){var a,b,c={};for(a=0;a<arguments.length;a++)for(b in arguments[a])arguments[a].hasOwnProperty(b)&&"undefined"==typeof c[b]&&(c[b]=arguments[a][b]);return c},u=function(a){return a=a||{},a.base64!==!0||null!==a.binary&&void 0!==a.binary||(a.binary=!0),a=t(a,g),a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),a},v=function(a,b,c){var e,f=d.getTypeOf(b);if(c=u(c),c.createFolders&&(e=w(a))&&x.call(this,e,!0),c.dir||null===b||"undefined"==typeof b)c.base64=!1,c.binary=!1,b=null;else if("string"===f)c.binary&&!c.base64&&c.optimizedBinaryString!==!0&&(b=d.string2binary(b));else{if(c.base64=!1,c.binary=!0,!(f||b instanceof j))throw new Error("The data of '"+a+"' is in an unsupported format !");"arraybuffer"===f&&(b=d.transformTo("uint8array",b))}var g=new r(a,b,c);return this.files[a]=g,g},w=function(a){"/"==a.slice(-1)&&(a=a.substring(0,a.length-1));var b=a.lastIndexOf("/");return b>0?a.substring(0,b):""},x=function(a,b){return"/"!=a.slice(-1)&&(a+="/"),b="undefined"!=typeof b?b:!1,this.files[a]||v.call(this,a,null,{dir:!0,createFolders:b}),this.files[a]},y=function(a,b){var c,f=new j;return a._data instanceof j?(f.uncompressedSize=a._data.uncompressedSize,f.crc32=a._data.crc32,0===f.uncompressedSize||a.dir?(b=i.STORE,f.compressedContent="",f.crc32=0):a._data.compressionMethod===b.magic?f.compressedContent=a._data.getCompressedContent():(c=a._data.getContent(),f.compressedContent=b.compress(d.transformTo(b.compressInputType,c)))):(c=p(a),(!c||0===c.length||a.dir)&&(b=i.STORE,c=""),f.uncompressedSize=c.length,f.crc32=e(c),f.compressedContent=b.compress(d.transformTo(b.compressInputType,c))),f.compressedSize=f.compressedContent.length,f.compressionMethod=b.magic,f},z=function(a,b,c,g){var h,i,j,k,m=(c.compressedContent,d.transformTo("string",l.utf8encode(b.name))),n=b.comment||"",o=d.transformTo("string",l.utf8encode(n)),p=m.length!==b.name.length,q=o.length!==n.length,r=b.options,t="",u="",v="";j=b._initialMetadata.dir!==b.dir?b.dir:r.dir,k=b._initialMetadata.date!==b.date?b.date:r.date,h=k.getHours(),h<<=6,h|=k.getMinutes(),h<<=5,h|=k.getSeconds()/2,i=k.getFullYear()-1980,i<<=4,i|=k.getMonth()+1,i<<=5,i|=k.getDate(),p&&(u=s(1,1)+s(e(m),4)+m,t+="up"+s(u.length,2)+u),q&&(v=s(1,1)+s(this.crc32(o),4)+o,t+="uc"+s(v.length,2)+v);var w="";w+="\n\x00",w+=p||q?"\x00\b":"\x00\x00",w+=c.compressionMethod,w+=s(h,2),w+=s(i,2),w+=s(c.crc32,4),w+=s(c.compressedSize,4),w+=s(c.uncompressedSize,4),w+=s(m.length,2),w+=s(t.length,2);var x=f.LOCAL_FILE_HEADER+w+m+t,y=f.CENTRAL_FILE_HEADER+"\x00"+w+s(o.length,2)+"\x00\x00\x00\x00"+(j===!0?"\x00\x00\x00":"\x00\x00\x00\x00")+s(g,4)+m+t+o;return{fileRecord:x,dirRecord:y,compressedObject:c}},A={load:function(){throw new Error("Load method is not defined. Is the file jszip-load.js included ?")},filter:function(a){var b,c,d,e,f=[];for(b in this.files)this.files.hasOwnProperty(b)&&(d=this.files[b],e=new r(d.name,d._data,t(d.options)),c=b.slice(this.root.length,b.length),b.slice(0,this.root.length)===this.root&&a(c,e)&&f.push(e));return f},file:function(a,b,c){if(1===arguments.length){if(d.isRegExp(a)){var e=a;return this.filter(function(a,b){return!b.dir&&e.test(a)})}return this.filter(function(b,c){return!c.dir&&b===a})[0]||null}return a=this.root+a,v.call(this,a,b,c),this},folder:function(a){if(!a)return this;if(d.isRegExp(a))return this.filter(function(b,c){return c.dir&&a.test(b)});var b=this.root+a,c=x.call(this,b),e=this.clone();return e.root=c.name,e},remove:function(a){a=this.root+a;var b=this.files[a];if(b||("/"!=a.slice(-1)&&(a+="/"),b=this.files[a]),b&&!b.dir)delete this.files[a];else for(var c=this.filter(function(b,c){return c.name.slice(0,a.length)===a}),d=0;d<c.length;d++)delete this.files[c[d].name];return this},generate:function(a){a=t(a||{},{base64:!0,compression:"STORE",type:"base64",comment:null}),d.checkSupport(a.type);var b,c,e=[],g=0,j=0,k=d.transformTo("string",this.utf8encode(a.comment||this.comment||""));for(var l in this.files)if(this.files.hasOwnProperty(l)){var o=this.files[l],p=o.options.compression||a.compression.toUpperCase(),q=i[p];if(!q)throw new Error(p+" is not a valid compression method !");var r=y.call(this,o,q),u=z.call(this,l,o,r,g);g+=u.fileRecord.length+r.compressedSize,j+=u.dirRecord.length,e.push(u)}var v="";v=f.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+s(e.length,2)+s(e.length,2)+s(j,4)+s(g,4)+s(k.length,2)+k;var w=a.type.toLowerCase();for(b="uint8array"===w||"arraybuffer"===w||"blob"===w||"nodebuffer"===w?new n(g+j+v.length):new m(g+j+v.length),c=0;c<e.length;c++)b.append(e[c].fileRecord),b.append(e[c].compressedObject.compressedContent);for(c=0;c<e.length;c++)b.append(e[c].dirRecord);b.append(v);var x=b.finalize();switch(a.type.toLowerCase()){case"uint8array":case"arraybuffer":case"nodebuffer":return d.transformTo(a.type.toLowerCase(),x);case"blob":return d.arrayBuffer2Blob(d.transformTo("arraybuffer",x));case"base64":return a.base64?h.encode(x):x;default:return x}},crc32:function(a,b){return e(a,b)},utf8encode:function(a){return d.transformTo("string",l.utf8encode(a))},utf8decode:function(a){return l.utf8decode(a)}};b.exports=A},{"./base64":1,"./compressedObject":2,"./compressions":3,"./crc32":4,"./defaults":6,"./nodeBuffer":11,"./signature":14,"./stringWriter":16,"./support":17,"./uint8ArrayWriter":19,"./utf8":20,"./utils":21}],14:[function(a,b,c){"use strict";c.LOCAL_FILE_HEADER="PK",c.CENTRAL_FILE_HEADER="PK",c.CENTRAL_DIRECTORY_END="PK",c.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",c.ZIP64_CENTRAL_DIRECTORY_END="PK",c.DATA_DESCRIPTOR="PK\b"},{}],15:[function(a,b){"use strict";function c(a,b){this.data=a,b||(this.data=e.string2binary(this.data)),this.length=this.data.length,this.index=0}var d=a("./dataReader"),e=a("./utils");c.prototype=new d,c.prototype.byteAt=function(a){return this.data.charCodeAt(a)},c.prototype.lastIndexOfSignature=function(a){return this.data.lastIndexOf(a)},c.prototype.readData=function(a){this.checkOffset(a);var b=this.data.slice(this.index,this.index+a);return this.index+=a,b},b.exports=c},{"./dataReader":5,"./utils":21}],16:[function(a,b){"use strict";var c=a("./utils"),d=function(){this.data=[]};d.prototype={append:function(a){a=c.transformTo("string",a),this.data.push(a)},finalize:function(){return this.data.join("")}},b.exports=d},{"./utils":21}],17:[function(a,b,c){(function(a){"use strict";if(c.base64=!0,c.array=!0,c.string=!0,c.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,c.nodebuffer="undefined"!=typeof a,c.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)c.blob=!1;else{var b=new ArrayBuffer(0);try{c.blob=0===new Blob([b],{type:"application/zip"}).size}catch(d){try{var e=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,f=new e;f.append(b),c.blob=0===f.getBlob("application/zip").size}catch(d){c.blob=!1}}}}).call(this,"undefined"!=typeof Buffer?Buffer:void 0)},{}],18:[function(a,b){"use strict";function c(a){a&&(this.data=a,this.length=this.data.length,this.index=0)}var d=a("./dataReader");c.prototype=new d,c.prototype.byteAt=function(a){return this.data[a]},c.prototype.lastIndexOfSignature=function(a){for(var b=a.charCodeAt(0),c=a.charCodeAt(1),d=a.charCodeAt(2),e=a.charCodeAt(3),f=this.length-4;f>=0;--f)if(this.data[f]===b&&this.data[f+1]===c&&this.data[f+2]===d&&this.data[f+3]===e)return f;return-1},c.prototype.readData=function(a){if(this.checkOffset(a),0===a)return new Uint8Array(0);var b=this.data.subarray(this.index,this.index+a);return this.index+=a,b},b.exports=c},{"./dataReader":5}],19:[function(a,b){"use strict";var c=a("./utils"),d=function(a){this.data=new Uint8Array(a),this.index=0};d.prototype={append:function(a){0!==a.length&&(a=c.transformTo("uint8array",a),this.data.set(a,this.index),this.index+=a.length)},finalize:function(){return this.data}},b.exports=d},{"./utils":21}],20:[function(a,b,c){"use strict";for(var d=a("./utils"),e=a("./support"),f=a("./nodeBuffer"),g=new Array(256),h=0;256>h;h++)g[h]=h>=252?6:h>=248?5:h>=240?4:h>=224?3:h>=192?2:1;g[254]=g[254]=1;var i=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;h>f;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),i+=128>c?1:2048>c?2:65536>c?3:4;for(b=e.uint8array?new Uint8Array(i):new Array(i),g=0,f=0;i>g;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),128>c?b[g++]=c:2048>c?(b[g++]=192|c>>>6,b[g++]=128|63&c):65536>c?(b[g++]=224|c>>>12,b[g++]=128|c>>>6&63,b[g++]=128|63&c):(b[g++]=240|c>>>18,b[g++]=128|c>>>12&63,b[g++]=128|c>>>6&63,b[g++]=128|63&c);return b},j=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128===(192&a[c]);)c--;return 0>c?b:0===c?b:c+g[a[c]]>b?c:b},k=function(a){var b,c,e,f,h=a.length,i=new Array(2*h);for(c=0,b=0;h>b;)if(e=a[b++],128>e)i[c++]=e;else if(f=g[e],f>4)i[c++]=65533,b+=f-1;else{for(e&=2===f?31:3===f?15:7;f>1&&h>b;)e=e<<6|63&a[b++],f--;f>1?i[c++]=65533:65536>e?i[c++]=e:(e-=65536,i[c++]=55296|e>>10&1023,i[c++]=56320|1023&e)}return i.length!==c&&(i.subarray?i=i.subarray(0,c):i.length=c),d.applyFromCharCode(i)};c.utf8encode=function(a){return e.nodebuffer?f(a,"utf-8"):i(a)},c.utf8decode=function(a){if(e.nodebuffer)return d.transformTo("nodebuffer",a).toString("utf-8");a=d.transformTo(e.uint8array?"uint8array":"array",a);for(var b=[],c=0,f=a.length,g=65536;f>c;){var h=j(a,Math.min(c+g,f));b.push(e.uint8array?k(a.subarray(c,h)):k(a.slice(c,h))),c=h}return b.join("")}},{"./nodeBuffer":11,"./support":17,"./utils":21}],21:[function(a,b,c){"use strict";function d(a){return a}function e(a,b){for(var c=0;c<a.length;++c)b[c]=255&a.charCodeAt(c);return b}function f(a){var b=65536,d=[],e=a.length,f=c.getTypeOf(a),g=0,h=!0;try{switch(f){case"uint8array":String.fromCharCode.apply(null,new Uint8Array(0));break;case"nodebuffer":String.fromCharCode.apply(null,j(0))}}catch(i){h=!1}if(!h){for(var k="",l=0;l<a.length;l++)k+=String.fromCharCode(a[l]);return k}for(;e>g&&b>1;)try{d.push("array"===f||"nodebuffer"===f?String.fromCharCode.apply(null,a.slice(g,Math.min(g+b,e))):String.fromCharCode.apply(null,a.subarray(g,Math.min(g+b,e)))),g+=b}catch(i){b=Math.floor(b/2)}return d.join("")}function g(a,b){for(var c=0;c<a.length;c++)b[c]=a[c];return b}var h=a("./support"),i=a("./compressions"),j=a("./nodeBuffer");c.string2binary=function(a){for(var b="",c=0;c<a.length;c++)b+=String.fromCharCode(255&a.charCodeAt(c));return b},c.arrayBuffer2Blob=function(a){c.checkSupport("blob");try{return new Blob([a],{type:"application/zip"})}catch(b){try{var d=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,e=new d;return e.append(a),e.getBlob("application/zip")}catch(b){throw new Error("Bug : can't construct the Blob.")}}},c.applyFromCharCode=f;var k={};k.string={string:d,array:function(a){return e(a,new Array(a.length))},arraybuffer:function(a){return k.string.uint8array(a).buffer},uint8array:function(a){return e(a,new Uint8Array(a.length))},nodebuffer:function(a){return e(a,j(a.length))}},k.array={string:f,array:d,arraybuffer:function(a){return new Uint8Array(a).buffer},uint8array:function(a){return new Uint8Array(a)},nodebuffer:function(a){return j(a)}},k.arraybuffer={string:function(a){return f(new Uint8Array(a))},array:function(a){return g(new Uint8Array(a),new Array(a.byteLength))},arraybuffer:d,uint8array:function(a){return new Uint8Array(a)},nodebuffer:function(a){return j(new Uint8Array(a))}},k.uint8array={string:f,array:function(a){return g(a,new Array(a.length))},arraybuffer:function(a){return a.buffer},uint8array:d,nodebuffer:function(a){return j(a)}},k.nodebuffer={string:f,array:function(a){return g(a,new Array(a.length))},arraybuffer:function(a){return k.nodebuffer.uint8array(a).buffer},uint8array:function(a){return g(a,new Uint8Array(a.length))},nodebuffer:d},c.transformTo=function(a,b){if(b||(b=""),!a)return b;c.checkSupport(a);var d=c.getTypeOf(b),e=k[d][a](b);return e},c.getTypeOf=function(a){return"string"==typeof a?"string":"[object Array]"===Object.prototype.toString.call(a)?"array":h.nodebuffer&&j.test(a)?"nodebuffer":h.uint8array&&a instanceof Uint8Array?"uint8array":h.arraybuffer&&a instanceof ArrayBuffer?"arraybuffer":void 0},c.checkSupport=function(a){var b=h[a.toLowerCase()];if(!b)throw new Error(a+" is not supported by this browser")},c.MAX_VALUE_16BITS=65535,c.MAX_VALUE_32BITS=-1,c.pretty=function(a){var b,c,d="";for(c=0;c<(a||"").length;c++)b=a.charCodeAt(c),d+="\\x"+(16>b?"0":"")+b.toString(16).toUpperCase();return d},c.findCompression=function(a){for(var b in i)if(i.hasOwnProperty(b)&&i[b].magic===a)return i[b];return null},c.isRegExp=function(a){return"[object RegExp]"===Object.prototype.toString.call(a)}},{"./compressions":3,"./nodeBuffer":11,"./support":17}],22:[function(a,b){"use strict";function c(a,b){this.files=[],this.loadOptions=b,a&&this.load(a)}var d=a("./stringReader"),e=a("./nodeBufferReader"),f=a("./uint8ArrayReader"),g=a("./utils"),h=a("./signature"),i=a("./zipEntry"),j=a("./support"),k=a("./object");c.prototype={checkSignature:function(a){var b=this.reader.readString(4);if(b!==a)throw new Error("Corrupted zip or bug : unexpected signature ("+g.pretty(b)+", expected "+g.pretty(a)+")")},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2),this.zipComment=this.reader.readString(this.zipCommentLength),this.zipComment=k.utf8decode(this.zipComment)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.versionMadeBy=this.reader.readString(2),this.versionNeeded=this.reader.readInt(2),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var a,b,c,d=this.zip64EndOfCentralSize-44,e=0;d>e;)a=this.reader.readInt(2),b=this.reader.readInt(4),c=this.reader.readString(b),this.zip64ExtensibleData[a]={id:a,length:b,value:c}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),this.disksCount>1)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var a,b;for(a=0;a<this.files.length;a++)b=this.files[a],this.reader.setIndex(b.localHeaderOffset),this.checkSignature(h.LOCAL_FILE_HEADER),b.readLocalPart(this.reader),b.handleUTF8()},readCentralDir:function(){var a;for(this.reader.setIndex(this.centralDirOffset);this.reader.readString(4)===h.CENTRAL_FILE_HEADER;)a=new i({zip64:this.zip64},this.loadOptions),a.readCentralPart(this.reader),this.files.push(a)},readEndOfCentral:function(){var a=this.reader.lastIndexOfSignature(h.CENTRAL_DIRECTORY_END);if(-1===a)throw new Error("Corrupted zip : can't find end of central directory");if(this.reader.setIndex(a),this.checkSignature(h.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===g.MAX_VALUE_16BITS||this.diskWithCentralDirStart===g.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===g.MAX_VALUE_16BITS||this.centralDirRecords===g.MAX_VALUE_16BITS||this.centralDirSize===g.MAX_VALUE_32BITS||this.centralDirOffset===g.MAX_VALUE_32BITS){if(this.zip64=!0,a=this.reader.lastIndexOfSignature(h.ZIP64_CENTRAL_DIRECTORY_LOCATOR),-1===a)throw new Error("Corrupted zip : can't find the ZIP64 end of central directory locator");this.reader.setIndex(a),this.checkSignature(h.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(h.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}},prepareReader:function(a){var b=g.getTypeOf(a);this.reader="string"!==b||j.uint8array?"nodebuffer"===b?new e(a):new f(g.transformTo("uint8array",a)):new d(a,this.loadOptions.optimizedBinaryString)},load:function(a){this.prepareReader(a),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},b.exports=c},{"./nodeBufferReader":12,"./object":13,"./signature":14,"./stringReader":15,"./support":17,"./uint8ArrayReader":18,"./utils":21,"./zipEntry":23}],23:[function(a,b){"use strict";function c(a,b){this.options=a,this.loadOptions=b}var d=a("./stringReader"),e=a("./utils"),f=a("./compressedObject"),g=a("./object");c.prototype={isEncrypted:function(){return 1===(1&this.bitFlag)},useUTF8:function(){return 2048===(2048&this.bitFlag)},prepareCompressedContent:function(a,b,c){return function(){var d=a.index;a.setIndex(b);var e=a.readData(c);return a.setIndex(d),e}},prepareContent:function(a,b,c,d,f){return function(){var a=e.transformTo(d.uncompressInputType,this.getCompressedContent()),b=d.uncompress(a);if(b.length!==f)throw new Error("Bug : uncompressed data size mismatch");return b}},readLocalPart:function(a){var b,c;if(a.skip(22),this.fileNameLength=a.readInt(2),c=a.readInt(2),this.fileName=a.readString(this.fileNameLength),a.skip(c),-1==this.compressedSize||-1==this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough informations from the central directory (compressedSize == -1 || uncompressedSize == -1)");if(b=e.findCompression(this.compressionMethod),null===b)throw new Error("Corrupted zip : compression "+e.pretty(this.compressionMethod)+" unknown (inner file : "+this.fileName+")");if(this.decompressed=new f,this.decompressed.compressedSize=this.compressedSize,this.decompressed.uncompressedSize=this.uncompressedSize,this.decompressed.crc32=this.crc32,this.decompressed.compressionMethod=this.compressionMethod,this.decompressed.getCompressedContent=this.prepareCompressedContent(a,a.index,this.compressedSize,b),this.decompressed.getContent=this.prepareContent(a,a.index,this.compressedSize,b,this.uncompressedSize),this.loadOptions.checkCRC32&&(this.decompressed=e.transformTo("string",this.decompressed.getContent()),g.crc32(this.decompressed)!==this.crc32))throw new Error("Corrupted zip : CRC32 mismatch")},readCentralPart:function(a){if(this.versionMadeBy=a.readString(2),this.versionNeeded=a.readInt(2),this.bitFlag=a.readInt(2),this.compressionMethod=a.readString(2),this.date=a.readDate(),this.crc32=a.readInt(4),this.compressedSize=a.readInt(4),this.uncompressedSize=a.readInt(4),this.fileNameLength=a.readInt(2),this.extraFieldsLength=a.readInt(2),this.fileCommentLength=a.readInt(2),this.diskNumberStart=a.readInt(2),this.internalFileAttributes=a.readInt(2),this.externalFileAttributes=a.readInt(4),this.localHeaderOffset=a.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");this.fileName=a.readString(this.fileNameLength),this.readExtraFields(a),this.parseZIP64ExtraField(a),this.fileComment=a.readString(this.fileCommentLength),this.dir=16&this.externalFileAttributes?!0:!1},parseZIP64ExtraField:function(){if(this.extraFields[1]){var a=new d(this.extraFields[1].value);this.uncompressedSize===e.MAX_VALUE_32BITS&&(this.uncompressedSize=a.readInt(8)),this.compressedSize===e.MAX_VALUE_32BITS&&(this.compressedSize=a.readInt(8)),this.localHeaderOffset===e.MAX_VALUE_32BITS&&(this.localHeaderOffset=a.readInt(8)),this.diskNumberStart===e.MAX_VALUE_32BITS&&(this.diskNumberStart=a.readInt(4))}},readExtraFields:function(a){var b,c,d,e=a.index;for(this.extraFields=this.extraFields||{};a.index<e+this.extraFieldsLength;)b=a.readInt(2),c=a.readInt(2),d=a.readString(c),this.extraFields[b]={id:b,length:c,value:d}},handleUTF8:function(){if(this.useUTF8())this.fileName=g.utf8decode(this.fileName),this.fileComment=g.utf8decode(this.fileComment);else{var a=this.findExtraFieldUnicodePath();null!==a&&(this.fileName=a);var b=this.findExtraFieldUnicodeComment();null!==b&&(this.fileComment=b)}},findExtraFieldUnicodePath:function(){var a=this.extraFields[28789];if(a){var b=new d(a.value);return 1!==b.readInt(1)?null:g.crc32(this.fileName)!==b.readInt(4)?null:g.utf8decode(b.readString(a.length-5))}return null},findExtraFieldUnicodeComment:function(){var a=this.extraFields[25461];if(a){var b=new d(a.value);return 1!==b.readInt(1)?null:g.crc32(this.fileComment)!==b.readInt(4)?null:g.utf8decode(b.readString(a.length-5))}return null}},b.exports=c},{"./compressedObject":2,"./object":13,"./stringReader":15,"./utils":21}],24:[function(a,b){"use strict";var c=a("./lib/utils/common").assign,d=a("./lib/deflate"),e=a("./lib/inflate"),f=a("./lib/zlib/constants"),g={};c(g,d,e,f),b.exports=g},{"./lib/deflate":25,"./lib/inflate":26,"./lib/utils/common":27,"./lib/zlib/constants":30}],25:[function(a,b,c){"use strict";function d(a,b){var c=new s(b);if(c.push(a,!0),c.err)throw c.msg;return c.result}function e(a,b){return b=b||{},b.raw=!0,d(a,b)}function f(a,b){return b=b||{},b.gzip=!0,d(a,b)}var g=a("./zlib/deflate.js"),h=a("./utils/common"),i=a("./utils/strings"),j=a("./zlib/messages"),k=a("./zlib/zstream"),l=0,m=4,n=0,o=1,p=-1,q=0,r=8,s=function(a){this.options=h.assign({level:p,method:r,chunkSize:16384,windowBits:15,memLevel:8,strategy:q,to:""},a||{});var b=this.options;b.raw&&b.windowBits>0?b.windowBits=-b.windowBits:b.gzip&&b.windowBits>0&&b.windowBits<16&&(b.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k,this.strm.avail_out=0;var c=g.deflateInit2(this.strm,b.level,b.method,b.windowBits,b.memLevel,b.strategy);if(c!==n)throw new Error(j[c]);b.header&&g.deflateSetHeader(this.strm,b.header)
-};s.prototype.push=function(a,b){var c,d,e=this.strm,f=this.options.chunkSize;if(this.ended)return!1;d=b===~~b?b:b===!0?m:l,e.input="string"==typeof a?i.string2buf(a):a,e.next_in=0,e.avail_in=e.input.length;do{if(0===e.avail_out&&(e.output=new h.Buf8(f),e.next_out=0,e.avail_out=f),c=g.deflate(e,d),c!==o&&c!==n)return this.onEnd(c),this.ended=!0,!1;(0===e.avail_out||0===e.avail_in&&d===m)&&this.onData("string"===this.options.to?i.buf2binstring(h.shrinkBuf(e.output,e.next_out)):h.shrinkBuf(e.output,e.next_out))}while((e.avail_in>0||0===e.avail_out)&&c!==o);return d===m?(c=g.deflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===n):!0},s.prototype.onData=function(a){this.chunks.push(a)},s.prototype.onEnd=function(a){a===n&&(this.result="string"===this.options.to?this.chunks.join(""):h.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Deflate=s,c.deflate=d,c.deflateRaw=e,c.gzip=f},{"./utils/common":27,"./utils/strings":28,"./zlib/deflate.js":32,"./zlib/messages":37,"./zlib/zstream":39}],26:[function(a,b,c){"use strict";function d(a,b){var c=new m(b);if(c.push(a,!0),c.err)throw c.msg;return c.result}function e(a,b){return b=b||{},b.raw=!0,d(a,b)}var f=a("./zlib/inflate.js"),g=a("./utils/common"),h=a("./utils/strings"),i=a("./zlib/constants"),j=a("./zlib/messages"),k=a("./zlib/zstream"),l=a("./zlib/gzheader"),m=function(a){this.options=g.assign({chunkSize:16384,windowBits:0,to:""},a||{});var b=this.options;b.raw&&b.windowBits>=0&&b.windowBits<16&&(b.windowBits=-b.windowBits,0===b.windowBits&&(b.windowBits=-15)),!(b.windowBits>=0&&b.windowBits<16)||a&&a.windowBits||(b.windowBits+=32),b.windowBits>15&&b.windowBits<48&&0===(15&b.windowBits)&&(b.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new k,this.strm.avail_out=0;var c=f.inflateInit2(this.strm,b.windowBits);if(c!==i.Z_OK)throw new Error(j[c]);this.header=new l,f.inflateGetHeader(this.strm,this.header)};m.prototype.push=function(a,b){var c,d,e,j,k,l=this.strm,m=this.options.chunkSize;if(this.ended)return!1;d=b===~~b?b:b===!0?i.Z_FINISH:i.Z_NO_FLUSH,l.input="string"==typeof a?h.binstring2buf(a):a,l.next_in=0,l.avail_in=l.input.length;do{if(0===l.avail_out&&(l.output=new g.Buf8(m),l.next_out=0,l.avail_out=m),c=f.inflate(l,i.Z_NO_FLUSH),c!==i.Z_STREAM_END&&c!==i.Z_OK)return this.onEnd(c),this.ended=!0,!1;l.next_out&&(0===l.avail_out||c===i.Z_STREAM_END||0===l.avail_in&&d===i.Z_FINISH)&&("string"===this.options.to?(e=h.utf8border(l.output,l.next_out),j=l.next_out-e,k=h.buf2string(l.output,e),l.next_out=j,l.avail_out=m-j,j&&g.arraySet(l.output,l.output,e,j,0),this.onData(k)):this.onData(g.shrinkBuf(l.output,l.next_out)))}while(l.avail_in>0&&c!==i.Z_STREAM_END);return c===i.Z_STREAM_END&&(d=i.Z_FINISH),d===i.Z_FINISH?(c=f.inflateEnd(this.strm),this.onEnd(c),this.ended=!0,c===i.Z_OK):!0},m.prototype.onData=function(a){this.chunks.push(a)},m.prototype.onEnd=function(a){a===i.Z_OK&&(this.result="string"===this.options.to?this.chunks.join(""):g.flattenChunks(this.chunks)),this.chunks=[],this.err=a,this.msg=this.strm.msg},c.Inflate=m,c.inflate=d,c.inflateRaw=e,c.ungzip=d},{"./utils/common":27,"./utils/strings":28,"./zlib/constants":30,"./zlib/gzheader":33,"./zlib/inflate.js":35,"./zlib/messages":37,"./zlib/zstream":39}],27:[function(a,b,c){"use strict";var d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;c.assign=function(a){for(var b=Array.prototype.slice.call(arguments,1);b.length;){var c=b.shift();if(c){if("object"!=typeof c)throw new TypeError(c+"must be non-object");for(var d in c)c.hasOwnProperty(d)&&(a[d]=c[d])}}return a},c.shrinkBuf=function(a,b){return a.length===b?a:a.subarray?a.subarray(0,b):(a.length=b,a)};var e={arraySet:function(a,b,c,d,e){if(b.subarray&&a.subarray)return void a.set(b.subarray(c,c+d),e);for(var f=0;d>f;f++)a[e+f]=b[c+f]},flattenChunks:function(a){var b,c,d,e,f,g;for(d=0,b=0,c=a.length;c>b;b++)d+=a[b].length;for(g=new Uint8Array(d),e=0,b=0,c=a.length;c>b;b++)f=a[b],g.set(f,e),e+=f.length;return g}},f={arraySet:function(a,b,c,d,e){for(var f=0;d>f;f++)a[e+f]=b[c+f]},flattenChunks:function(a){return[].concat.apply([],a)}};c.setTyped=function(a){a?(c.Buf8=Uint8Array,c.Buf16=Uint16Array,c.Buf32=Int32Array,c.assign(c,e)):(c.Buf8=Array,c.Buf16=Array,c.Buf32=Array,c.assign(c,f))},c.setTyped(d)},{}],28:[function(a,b,c){"use strict";function d(a,b){if(65537>b&&(a.subarray&&g||!a.subarray&&f))return String.fromCharCode.apply(null,e.shrinkBuf(a,b));for(var c="",d=0;b>d;d++)c+=String.fromCharCode(a[d]);return c}var e=a("./common"),f=!0,g=!0;try{String.fromCharCode.apply(null,[0])}catch(h){f=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(h){g=!1}for(var i=new e.Buf8(256),j=0;256>j;j++)i[j]=j>=252?6:j>=248?5:j>=240?4:j>=224?3:j>=192?2:1;i[254]=i[254]=1,c.string2buf=function(a){var b,c,d,f,g,h=a.length,i=0;for(f=0;h>f;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),i+=128>c?1:2048>c?2:65536>c?3:4;for(b=new e.Buf8(i),g=0,f=0;i>g;f++)c=a.charCodeAt(f),55296===(64512&c)&&h>f+1&&(d=a.charCodeAt(f+1),56320===(64512&d)&&(c=65536+(c-55296<<10)+(d-56320),f++)),128>c?b[g++]=c:2048>c?(b[g++]=192|c>>>6,b[g++]=128|63&c):65536>c?(b[g++]=224|c>>>12,b[g++]=128|c>>>6&63,b[g++]=128|63&c):(b[g++]=240|c>>>18,b[g++]=128|c>>>12&63,b[g++]=128|c>>>6&63,b[g++]=128|63&c);return b},c.buf2binstring=function(a){return d(a,a.length)},c.binstring2buf=function(a){for(var b=new e.Buf8(a.length),c=0,d=b.length;d>c;c++)b[c]=a.charCodeAt(c);return b},c.buf2string=function(a,b){var c,e,f,g,h=b||a.length,j=new Array(2*h);for(e=0,c=0;h>c;)if(f=a[c++],128>f)j[e++]=f;else if(g=i[f],g>4)j[e++]=65533,c+=g-1;else{for(f&=2===g?31:3===g?15:7;g>1&&h>c;)f=f<<6|63&a[c++],g--;g>1?j[e++]=65533:65536>f?j[e++]=f:(f-=65536,j[e++]=55296|f>>10&1023,j[e++]=56320|1023&f)}return d(j,e)},c.utf8border=function(a,b){var c;for(b=b||a.length,b>a.length&&(b=a.length),c=b-1;c>=0&&128===(192&a[c]);)c--;return 0>c?b:0===c?b:c+i[a[c]]>b?c:b}},{"./common":27}],29:[function(a,b){"use strict";function c(a,b,c,d){for(var e=65535&a|0,f=a>>>16&65535|0,g=0;0!==c;){g=c>2e3?2e3:c,c-=g;do e=e+b[d++]|0,f=f+e|0;while(--g);e%=65521,f%=65521}return e|f<<16|0}b.exports=c},{}],30:[function(a,b){b.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],31:[function(a,b){"use strict";function c(){for(var a,b=[],c=0;256>c;c++){a=c;for(var d=0;8>d;d++)a=1&a?3988292384^a>>>1:a>>>1;b[c]=a}return b}function d(a,b,c,d){var f=e,g=d+c;a=-1^a;for(var h=d;g>h;h++)a=a>>>8^f[255&(a^b[h])];return-1^a}var e=c();b.exports=d},{}],32:[function(a,b,c){"use strict";function d(a,b){return a.msg=G[b],b}function e(a){return(a<<1)-(a>4?9:0)}function f(a){for(var b=a.length;--b>=0;)a[b]=0}function g(a){var b=a.state,c=b.pending;c>a.avail_out&&(c=a.avail_out),0!==c&&(C.arraySet(a.output,b.pending_buf,b.pending_out,c,a.next_out),a.next_out+=c,b.pending_out+=c,a.total_out+=c,a.avail_out-=c,b.pending-=c,0===b.pending&&(b.pending_out=0))}function h(a,b){D._tr_flush_block(a,a.block_start>=0?a.block_start:-1,a.strstart-a.block_start,b),a.block_start=a.strstart,g(a.strm)}function i(a,b){a.pending_buf[a.pending++]=b}function j(a,b){a.pending_buf[a.pending++]=b>>>8&255,a.pending_buf[a.pending++]=255&b}function k(a,b,c,d){var e=a.avail_in;return e>d&&(e=d),0===e?0:(a.avail_in-=e,C.arraySet(b,a.input,a.next_in,e,c),1===a.state.wrap?a.adler=E(a.adler,b,e,c):2===a.state.wrap&&(a.adler=F(a.adler,b,e,c)),a.next_in+=e,a.total_in+=e,e)}function l(a,b){var c,d,e=a.max_chain_length,f=a.strstart,g=a.prev_length,h=a.nice_match,i=a.strstart>a.w_size-jb?a.strstart-(a.w_size-jb):0,j=a.window,k=a.w_mask,l=a.prev,m=a.strstart+ib,n=j[f+g-1],o=j[f+g];a.prev_length>=a.good_match&&(e>>=2),h>a.lookahead&&(h=a.lookahead);do if(c=b,j[c+g]===o&&j[c+g-1]===n&&j[c]===j[f]&&j[++c]===j[f+1]){f+=2,c++;do;while(j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&j[++f]===j[++c]&&m>f);if(d=ib-(m-f),f=m-ib,d>g){if(a.match_start=b,g=d,d>=h)break;n=j[f+g-1],o=j[f+g]}}while((b=l[b&k])>i&&0!==--e);return g<=a.lookahead?g:a.lookahead}function m(a){var b,c,d,e,f,g=a.w_size;do{if(e=a.window_size-a.lookahead-a.strstart,a.strstart>=g+(g-jb)){C.arraySet(a.window,a.window,g,g,0),a.match_start-=g,a.strstart-=g,a.block_start-=g,c=a.hash_size,b=c;do d=a.head[--b],a.head[b]=d>=g?d-g:0;while(--c);c=g,b=c;do d=a.prev[--b],a.prev[b]=d>=g?d-g:0;while(--c);e+=g}if(0===a.strm.avail_in)break;if(c=k(a.strm,a.window,a.strstart+a.lookahead,e),a.lookahead+=c,a.lookahead+a.insert>=hb)for(f=a.strstart-a.insert,a.ins_h=a.window[f],a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+1])&a.hash_mask;a.insert&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[f+hb-1])&a.hash_mask,a.prev[f&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=f,f++,a.insert--,!(a.lookahead+a.insert<hb)););}while(a.lookahead<jb&&0!==a.strm.avail_in)}function n(a,b){var c=65535;for(c>a.pending_buf_size-5&&(c=a.pending_buf_size-5);;){if(a.lookahead<=1){if(m(a),0===a.lookahead&&b===H)return sb;if(0===a.lookahead)break}a.strstart+=a.lookahead,a.lookahead=0;var d=a.block_start+c;if((0===a.strstart||a.strstart>=d)&&(a.lookahead=a.strstart-d,a.strstart=d,h(a,!1),0===a.strm.avail_out))return sb;if(a.strstart-a.block_start>=a.w_size-jb&&(h(a,!1),0===a.strm.avail_out))return sb}return a.insert=0,b===K?(h(a,!0),0===a.strm.avail_out?ub:vb):a.strstart>a.block_start&&(h(a,!1),0===a.strm.avail_out)?sb:sb}function o(a,b){for(var c,d;;){if(a.lookahead<jb){if(m(a),a.lookahead<jb&&b===H)return sb;if(0===a.lookahead)break}if(c=0,a.lookahead>=hb&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+hb-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),0!==c&&a.strstart-c<=a.w_size-jb&&(a.match_length=l(a,c)),a.match_length>=hb)if(d=D._tr_tally(a,a.strstart-a.match_start,a.match_length-hb),a.lookahead-=a.match_length,a.match_length<=a.max_lazy_match&&a.lookahead>=hb){a.match_length--;do a.strstart++,a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+hb-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart;while(0!==--a.match_length);a.strstart++}else a.strstart+=a.match_length,a.match_length=0,a.ins_h=a.window[a.strstart],a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+1])&a.hash_mask;else d=D._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++;if(d&&(h(a,!1),0===a.strm.avail_out))return sb}return a.insert=a.strstart<hb-1?a.strstart:hb-1,b===K?(h(a,!0),0===a.strm.avail_out?ub:vb):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sb:tb}function p(a,b){for(var c,d,e;;){if(a.lookahead<jb){if(m(a),a.lookahead<jb&&b===H)return sb;if(0===a.lookahead)break}if(c=0,a.lookahead>=hb&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+hb-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart),a.prev_length=a.match_length,a.prev_match=a.match_start,a.match_length=hb-1,0!==c&&a.prev_length<a.max_lazy_match&&a.strstart-c<=a.w_size-jb&&(a.match_length=l(a,c),a.match_length<=5&&(a.strategy===S||a.match_length===hb&&a.strstart-a.match_start>4096)&&(a.match_length=hb-1)),a.prev_length>=hb&&a.match_length<=a.prev_length){e=a.strstart+a.lookahead-hb,d=D._tr_tally(a,a.strstart-1-a.prev_match,a.prev_length-hb),a.lookahead-=a.prev_length-1,a.prev_length-=2;do++a.strstart<=e&&(a.ins_h=(a.ins_h<<a.hash_shift^a.window[a.strstart+hb-1])&a.hash_mask,c=a.prev[a.strstart&a.w_mask]=a.head[a.ins_h],a.head[a.ins_h]=a.strstart);while(0!==--a.prev_length);if(a.match_available=0,a.match_length=hb-1,a.strstart++,d&&(h(a,!1),0===a.strm.avail_out))return sb}else if(a.match_available){if(d=D._tr_tally(a,0,a.window[a.strstart-1]),d&&h(a,!1),a.strstart++,a.lookahead--,0===a.strm.avail_out)return sb}else a.match_available=1,a.strstart++,a.lookahead--}return a.match_available&&(d=D._tr_tally(a,0,a.window[a.strstart-1]),a.match_available=0),a.insert=a.strstart<hb-1?a.strstart:hb-1,b===K?(h(a,!0),0===a.strm.avail_out?ub:vb):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sb:tb}function q(a,b){for(var c,d,e,f,g=a.window;;){if(a.lookahead<=ib){if(m(a),a.lookahead<=ib&&b===H)return sb;if(0===a.lookahead)break}if(a.match_length=0,a.lookahead>=hb&&a.strstart>0&&(e=a.strstart-1,d=g[e],d===g[++e]&&d===g[++e]&&d===g[++e])){f=a.strstart+ib;do;while(d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&d===g[++e]&&f>e);a.match_length=ib-(f-e),a.match_length>a.lookahead&&(a.match_length=a.lookahead)}if(a.match_length>=hb?(c=D._tr_tally(a,1,a.match_length-hb),a.lookahead-=a.match_length,a.strstart+=a.match_length,a.match_length=0):(c=D._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++),c&&(h(a,!1),0===a.strm.avail_out))return sb}return a.insert=0,b===K?(h(a,!0),0===a.strm.avail_out?ub:vb):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sb:tb}function r(a,b){for(var c;;){if(0===a.lookahead&&(m(a),0===a.lookahead)){if(b===H)return sb;break}if(a.match_length=0,c=D._tr_tally(a,0,a.window[a.strstart]),a.lookahead--,a.strstart++,c&&(h(a,!1),0===a.strm.avail_out))return sb}return a.insert=0,b===K?(h(a,!0),0===a.strm.avail_out?ub:vb):a.last_lit&&(h(a,!1),0===a.strm.avail_out)?sb:tb}function s(a){a.window_size=2*a.w_size,f(a.head),a.max_lazy_match=B[a.level].max_lazy,a.good_match=B[a.level].good_length,a.nice_match=B[a.level].nice_length,a.max_chain_length=B[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=hb-1,a.match_available=0,a.ins_h=0}function t(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Y,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new C.Buf16(2*fb),this.dyn_dtree=new C.Buf16(2*(2*db+1)),this.bl_tree=new C.Buf16(2*(2*eb+1)),f(this.dyn_ltree),f(this.dyn_dtree),f(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new C.Buf16(gb+1),this.heap=new C.Buf16(2*cb+1),f(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new C.Buf16(2*cb+1),f(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function u(a){var b;return a&&a.state?(a.total_in=a.total_out=0,a.data_type=X,b=a.state,b.pending=0,b.pending_out=0,b.wrap<0&&(b.wrap=-b.wrap),b.status=b.wrap?lb:qb,a.adler=2===b.wrap?0:1,b.last_flush=H,D._tr_init(b),M):d(a,O)}function v(a){var b=u(a);return b===M&&s(a.state),b}function w(a,b){return a&&a.state?2!==a.state.wrap?O:(a.state.gzhead=b,M):O}function x(a,b,c,e,f,g){if(!a)return O;var h=1;if(b===R&&(b=6),0>e?(h=0,e=-e):e>15&&(h=2,e-=16),1>f||f>Z||c!==Y||8>e||e>15||0>b||b>9||0>g||g>V)return d(a,O);8===e&&(e=9);var i=new t;return a.state=i,i.strm=a,i.wrap=h,i.gzhead=null,i.w_bits=e,i.w_size=1<<i.w_bits,i.w_mask=i.w_size-1,i.hash_bits=f+7,i.hash_size=1<<i.hash_bits,i.hash_mask=i.hash_size-1,i.hash_shift=~~((i.hash_bits+hb-1)/hb),i.window=new C.Buf8(2*i.w_size),i.head=new C.Buf16(i.hash_size),i.prev=new C.Buf16(i.w_size),i.lit_bufsize=1<<f+6,i.pending_buf_size=4*i.lit_bufsize,i.pending_buf=new C.Buf8(i.pending_buf_size),i.d_buf=i.lit_bufsize>>1,i.l_buf=3*i.lit_bufsize,i.level=b,i.strategy=g,i.method=c,v(a)}function y(a,b){return x(a,b,Y,$,_,W)}function z(a,b){var c,h,k,l;if(!a||!a.state||b>L||0>b)return a?d(a,O):O;if(h=a.state,!a.output||!a.input&&0!==a.avail_in||h.status===rb&&b!==K)return d(a,0===a.avail_out?Q:O);if(h.strm=a,c=h.last_flush,h.last_flush=b,h.status===lb)if(2===h.wrap)a.adler=0,i(h,31),i(h,139),i(h,8),h.gzhead?(i(h,(h.gzhead.text?1:0)+(h.gzhead.hcrc?2:0)+(h.gzhead.extra?4:0)+(h.gzhead.name?8:0)+(h.gzhead.comment?16:0)),i(h,255&h.gzhead.time),i(h,h.gzhead.time>>8&255),i(h,h.gzhead.time>>16&255),i(h,h.gzhead.time>>24&255),i(h,9===h.level?2:h.strategy>=T||h.level<2?4:0),i(h,255&h.gzhead.os),h.gzhead.extra&&h.gzhead.extra.length&&(i(h,255&h.gzhead.extra.length),i(h,h.gzhead.extra.length>>8&255)),h.gzhead.hcrc&&(a.adler=F(a.adler,h.pending_buf,h.pending,0)),h.gzindex=0,h.status=mb):(i(h,0),i(h,0),i(h,0),i(h,0),i(h,0),i(h,9===h.level?2:h.strategy>=T||h.level<2?4:0),i(h,wb),h.status=qb);else{var m=Y+(h.w_bits-8<<4)<<8,n=-1;n=h.strategy>=T||h.level<2?0:h.level<6?1:6===h.level?2:3,m|=n<<6,0!==h.strstart&&(m|=kb),m+=31-m%31,h.status=qb,j(h,m),0!==h.strstart&&(j(h,a.adler>>>16),j(h,65535&a.adler)),a.adler=1}if(h.status===mb)if(h.gzhead.extra){for(k=h.pending;h.gzindex<(65535&h.gzhead.extra.length)&&(h.pending!==h.pending_buf_size||(h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending!==h.pending_buf_size));)i(h,255&h.gzhead.extra[h.gzindex]),h.gzindex++;h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),h.gzindex===h.gzhead.extra.length&&(h.gzindex=0,h.status=nb)}else h.status=nb;if(h.status===nb)if(h.gzhead.name){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.name.length?255&h.gzhead.name.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.gzindex=0,h.status=ob)}else h.status=ob;if(h.status===ob)if(h.gzhead.comment){k=h.pending;do{if(h.pending===h.pending_buf_size&&(h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),g(a),k=h.pending,h.pending===h.pending_buf_size)){l=1;break}l=h.gzindex<h.gzhead.comment.length?255&h.gzhead.comment.charCodeAt(h.gzindex++):0,i(h,l)}while(0!==l);h.gzhead.hcrc&&h.pending>k&&(a.adler=F(a.adler,h.pending_buf,h.pending-k,k)),0===l&&(h.status=pb)}else h.status=pb;if(h.status===pb&&(h.gzhead.hcrc?(h.pending+2>h.pending_buf_size&&g(a),h.pending+2<=h.pending_buf_size&&(i(h,255&a.adler),i(h,a.adler>>8&255),a.adler=0,h.status=qb)):h.status=qb),0!==h.pending){if(g(a),0===a.avail_out)return h.last_flush=-1,M}else if(0===a.avail_in&&e(b)<=e(c)&&b!==K)return d(a,Q);if(h.status===rb&&0!==a.avail_in)return d(a,Q);if(0!==a.avail_in||0!==h.lookahead||b!==H&&h.status!==rb){var o=h.strategy===T?r(h,b):h.strategy===U?q(h,b):B[h.level].func(h,b);if((o===ub||o===vb)&&(h.status=rb),o===sb||o===ub)return 0===a.avail_out&&(h.last_flush=-1),M;if(o===tb&&(b===I?D._tr_align(h):b!==L&&(D._tr_stored_block(h,0,0,!1),b===J&&(f(h.head),0===h.lookahead&&(h.strstart=0,h.block_start=0,h.insert=0))),g(a),0===a.avail_out))return h.last_flush=-1,M}return b!==K?M:h.wrap<=0?N:(2===h.wrap?(i(h,255&a.adler),i(h,a.adler>>8&255),i(h,a.adler>>16&255),i(h,a.adler>>24&255),i(h,255&a.total_in),i(h,a.total_in>>8&255),i(h,a.total_in>>16&255),i(h,a.total_in>>24&255)):(j(h,a.adler>>>16),j(h,65535&a.adler)),g(a),h.wrap>0&&(h.wrap=-h.wrap),0!==h.pending?M:N)}function A(a){var b;return a&&a.state?(b=a.state.status,b!==lb&&b!==mb&&b!==nb&&b!==ob&&b!==pb&&b!==qb&&b!==rb?d(a,O):(a.state=null,b===qb?d(a,P):M)):O}var B,C=a("../utils/common"),D=a("./trees"),E=a("./adler32"),F=a("./crc32"),G=a("./messages"),H=0,I=1,J=3,K=4,L=5,M=0,N=1,O=-2,P=-3,Q=-5,R=-1,S=1,T=2,U=3,V=4,W=0,X=2,Y=8,Z=9,$=15,_=8,ab=29,bb=256,cb=bb+1+ab,db=30,eb=19,fb=2*cb+1,gb=15,hb=3,ib=258,jb=ib+hb+1,kb=32,lb=42,mb=69,nb=73,ob=91,pb=103,qb=113,rb=666,sb=1,tb=2,ub=3,vb=4,wb=3,xb=function(a,b,c,d,e){this.good_length=a,this.max_lazy=b,this.nice_length=c,this.max_chain=d,this.func=e};B=[new xb(0,0,0,0,n),new xb(4,4,8,4,o),new xb(4,5,16,8,o),new xb(4,6,32,32,o),new xb(4,4,16,16,p),new xb(8,16,32,32,p),new xb(8,16,128,128,p),new xb(8,32,128,256,p),new xb(32,128,258,1024,p),new xb(32,258,258,4096,p)],c.deflateInit=y,c.deflateInit2=x,c.deflateReset=v,c.deflateResetKeep=u,c.deflateSetHeader=w,c.deflate=z,c.deflateEnd=A,c.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":27,"./adler32":29,"./crc32":31,"./messages":37,"./trees":38}],33:[function(a,b){"use strict";function c(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}b.exports=c},{}],34:[function(a,b){"use strict";var c=30,d=12;b.exports=function(a,b){var e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C;e=a.state,f=a.next_in,B=a.input,g=f+(a.avail_in-5),h=a.next_out,C=a.output,i=h-(b-a.avail_out),j=h+(a.avail_out-257),k=e.dmax,l=e.wsize,m=e.whave,n=e.wnext,o=e.window,p=e.hold,q=e.bits,r=e.lencode,s=e.distcode,t=(1<<e.lenbits)-1,u=(1<<e.distbits)-1;a:do{15>q&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=r[p&t];b:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,0===w)C[h++]=65535&v;else{if(!(16&w)){if(0===(64&w)){v=r[(65535&v)+(p&(1<<w)-1)];continue b}if(32&w){e.mode=d;break a}a.msg="invalid literal/length code",e.mode=c;break a}x=65535&v,w&=15,w&&(w>q&&(p+=B[f++]<<q,q+=8),x+=p&(1<<w)-1,p>>>=w,q-=w),15>q&&(p+=B[f++]<<q,q+=8,p+=B[f++]<<q,q+=8),v=s[p&u];c:for(;;){if(w=v>>>24,p>>>=w,q-=w,w=v>>>16&255,!(16&w)){if(0===(64&w)){v=s[(65535&v)+(p&(1<<w)-1)];continue c}a.msg="invalid distance code",e.mode=c;break a}if(y=65535&v,w&=15,w>q&&(p+=B[f++]<<q,q+=8,w>q&&(p+=B[f++]<<q,q+=8)),y+=p&(1<<w)-1,y>k){a.msg="invalid distance too far back",e.mode=c;break a}if(p>>>=w,q-=w,w=h-i,y>w){if(w=y-w,w>m&&e.sane){a.msg="invalid distance too far back",e.mode=c;break a}if(z=0,A=o,0===n){if(z+=l-w,x>w){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}else if(w>n){if(z+=l+n-w,w-=n,x>w){x-=w;do C[h++]=o[z++];while(--w);if(z=0,x>n){w=n,x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}}}else if(z+=n-w,x>w){x-=w;do C[h++]=o[z++];while(--w);z=h-y,A=C}for(;x>2;)C[h++]=A[z++],C[h++]=A[z++],C[h++]=A[z++],x-=3;x&&(C[h++]=A[z++],x>1&&(C[h++]=A[z++]))}else{z=h-y;do C[h++]=C[z++],C[h++]=C[z++],C[h++]=C[z++],x-=3;while(x>2);x&&(C[h++]=C[z++],x>1&&(C[h++]=C[z++]))}break}}break}}while(g>f&&j>h);x=q>>3,f-=x,q-=x<<3,p&=(1<<q)-1,a.next_in=f,a.next_out=h,a.avail_in=g>f?5+(g-f):5-(f-g),a.avail_out=j>h?257+(j-h):257-(h-j),e.hold=p,e.bits=q}},{}],35:[function(a,b,c){"use strict";function d(a){return(a>>>24&255)+(a>>>8&65280)+((65280&a)<<8)+((255&a)<<24)}function e(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function f(a){var b;return a&&a.state?(b=a.state,a.total_in=a.total_out=b.total=0,a.msg="",b.wrap&&(a.adler=1&b.wrap),b.mode=K,b.last=0,b.havedict=0,b.dmax=32768,b.head=null,b.hold=0,b.bits=0,b.lencode=b.lendyn=new r.Buf32(ob),b.distcode=b.distdyn=new r.Buf32(pb),b.sane=1,b.back=-1,C):F}function g(a){var b;return a&&a.state?(b=a.state,b.wsize=0,b.whave=0,b.wnext=0,f(a)):F}function h(a,b){var c,d;return a&&a.state?(d=a.state,0>b?(c=0,b=-b):(c=(b>>4)+1,48>b&&(b&=15)),b&&(8>b||b>15)?F:(null!==d.window&&d.wbits!==b&&(d.window=null),d.wrap=c,d.wbits=b,g(a))):F}function i(a,b){var c,d;return a?(d=new e,a.state=d,d.window=null,c=h(a,b),c!==C&&(a.state=null),c):F}function j(a){return i(a,rb)}function k(a){if(sb){var b;for(p=new r.Buf32(512),q=new r.Buf32(32),b=0;144>b;)a.lens[b++]=8;for(;256>b;)a.lens[b++]=9;for(;280>b;)a.lens[b++]=7;for(;288>b;)a.lens[b++]=8;for(v(x,a.lens,0,288,p,0,a.work,{bits:9}),b=0;32>b;)a.lens[b++]=5;v(y,a.lens,0,32,q,0,a.work,{bits:5}),sb=!1}a.lencode=p,a.lenbits=9,a.distcode=q,a.distbits=5}function l(a,b,c,d){var e,f=a.state;return null===f.window&&(f.wsize=1<<f.wbits,f.wnext=0,f.whave=0,f.window=new r.Buf8(f.wsize)),d>=f.wsize?(r.arraySet(f.window,b,c-f.wsize,f.wsize,0),f.wnext=0,f.whave=f.wsize):(e=f.wsize-f.wnext,e>d&&(e=d),r.arraySet(f.window,b,c-d,e,f.wnext),d-=e,d?(r.arraySet(f.window,b,c-d,d,0),f.wnext=d,f.whave=f.wsize):(f.wnext+=e,f.wnext===f.wsize&&(f.wnext=0),f.whave<f.wsize&&(f.whave+=e))),0}function m(a,b){var c,e,f,g,h,i,j,m,n,o,p,q,ob,pb,qb,rb,sb,tb,ub,vb,wb,xb,yb,zb,Ab=0,Bb=new r.Buf8(4),Cb=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!a||!a.state||!a.output||!a.input&&0!==a.avail_in)return F;c=a.state,c.mode===V&&(c.mode=W),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,o=i,p=j,xb=C;a:for(;;)switch(c.mode){case K:if(0===c.wrap){c.mode=W;break}for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(2&c.wrap&&35615===m){c.check=0,Bb[0]=255&m,Bb[1]=m>>>8&255,c.check=t(c.check,Bb,2,0),m=0,n=0,c.mode=L;break}if(c.flags=0,c.head&&(c.head.done=!1),!(1&c.wrap)||(((255&m)<<8)+(m>>8))%31){a.msg="incorrect header check",c.mode=lb;break}if((15&m)!==J){a.msg="unknown compression method",c.mode=lb;break}if(m>>>=4,n-=4,wb=(15&m)+8,0===c.wbits)c.wbits=wb;else if(wb>c.wbits){a.msg="invalid window size",c.mode=lb;break}c.dmax=1<<wb,a.adler=c.check=1,c.mode=512&m?T:V,m=0,n=0;break;case L:for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.flags=m,(255&c.flags)!==J){a.msg="unknown compression method",c.mode=lb;break}if(57344&c.flags){a.msg="unknown header flags set",c.mode=lb;break}c.head&&(c.head.text=m>>8&1),512&c.flags&&(Bb[0]=255&m,Bb[1]=m>>>8&255,c.check=t(c.check,Bb,2,0)),m=0,n=0,c.mode=M;case M:for(;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.time=m),512&c.flags&&(Bb[0]=255&m,Bb[1]=m>>>8&255,Bb[2]=m>>>16&255,Bb[3]=m>>>24&255,c.check=t(c.check,Bb,4,0)),m=0,n=0,c.mode=N;case N:for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.head&&(c.head.xflags=255&m,c.head.os=m>>8),512&c.flags&&(Bb[0]=255&m,Bb[1]=m>>>8&255,c.check=t(c.check,Bb,2,0)),m=0,n=0,c.mode=O;case O:if(1024&c.flags){for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length=m,c.head&&(c.head.extra_len=m),512&c.flags&&(Bb[0]=255&m,Bb[1]=m>>>8&255,c.check=t(c.check,Bb,2,0)),m=0,n=0}else c.head&&(c.head.extra=null);c.mode=P;case P:if(1024&c.flags&&(q=c.length,q>i&&(q=i),q&&(c.head&&(wb=c.head.extra_len-c.length,c.head.extra||(c.head.extra=new Array(c.head.extra_len)),r.arraySet(c.head.extra,e,g,q,wb)),512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,c.length-=q),c.length))break a;c.length=0,c.mode=Q;case Q:if(2048&c.flags){if(0===i)break a;q=0;do wb=e[g+q++],c.head&&wb&&c.length<65536&&(c.head.name+=String.fromCharCode(wb));while(wb&&i>q);if(512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,wb)break a}else c.head&&(c.head.name=null);c.length=0,c.mode=R;case R:if(4096&c.flags){if(0===i)break a;q=0;do wb=e[g+q++],c.head&&wb&&c.length<65536&&(c.head.comment+=String.fromCharCode(wb));while(wb&&i>q);if(512&c.flags&&(c.check=t(c.check,e,q,g)),i-=q,g+=q,wb)break a}else c.head&&(c.head.comment=null);c.mode=S;case S:if(512&c.flags){for(;16>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(65535&c.check)){a.msg="header crc mismatch",c.mode=lb;break}m=0,n=0}c.head&&(c.head.hcrc=c.flags>>9&1,c.head.done=!0),a.adler=c.check=0,c.mode=V;break;case T:for(;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}a.adler=c.check=d(m),m=0,n=0,c.mode=U;case U:if(0===c.havedict)return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,E;a.adler=c.check=1,c.mode=V;case V:if(b===A||b===B)break a;case W:if(c.last){m>>>=7&n,n-=7&n,c.mode=ib;break}for(;3>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}switch(c.last=1&m,m>>>=1,n-=1,3&m){case 0:c.mode=X;break;case 1:if(k(c),c.mode=bb,b===B){m>>>=2,n-=2;break a}break;case 2:c.mode=$;break;case 3:a.msg="invalid block type",c.mode=lb}m>>>=2,n-=2;break;case X:for(m>>>=7&n,n-=7&n;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if((65535&m)!==(m>>>16^65535)){a.msg="invalid stored block lengths",c.mode=lb;break}if(c.length=65535&m,m=0,n=0,c.mode=Y,b===B)break a;case Y:c.mode=Z;case Z:if(q=c.length){if(q>i&&(q=i),q>j&&(q=j),0===q)break a;r.arraySet(f,e,g,q,h),i-=q,g+=q,j-=q,h+=q,c.length-=q;break}c.mode=V;break;case $:for(;14>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(c.nlen=(31&m)+257,m>>>=5,n-=5,c.ndist=(31&m)+1,m>>>=5,n-=5,c.ncode=(15&m)+4,m>>>=4,n-=4,c.nlen>286||c.ndist>30){a.msg="too many length or distance symbols",c.mode=lb;break}c.have=0,c.mode=_;case _:for(;c.have<c.ncode;){for(;3>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.lens[Cb[c.have++]]=7&m,m>>>=3,n-=3}for(;c.have<19;)c.lens[Cb[c.have++]]=0;if(c.lencode=c.lendyn,c.lenbits=7,yb={bits:c.lenbits},xb=v(w,c.lens,0,19,c.lencode,0,c.work,yb),c.lenbits=yb.bits,xb){a.msg="invalid code lengths set",c.mode=lb;break}c.have=0,c.mode=ab;case ab:for(;c.have<c.nlen+c.ndist;){for(;Ab=c.lencode[m&(1<<c.lenbits)-1],qb=Ab>>>24,rb=Ab>>>16&255,sb=65535&Ab,!(n>=qb);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(16>sb)m>>>=qb,n-=qb,c.lens[c.have++]=sb;else{if(16===sb){for(zb=qb+2;zb>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m>>>=qb,n-=qb,0===c.have){a.msg="invalid bit length repeat",c.mode=lb;break}wb=c.lens[c.have-1],q=3+(3&m),m>>>=2,n-=2}else if(17===sb){for(zb=qb+3;zb>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qb,n-=qb,wb=0,q=3+(7&m),m>>>=3,n-=3}else{for(zb=qb+7;zb>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=qb,n-=qb,wb=0,q=11+(127&m),m>>>=7,n-=7}if(c.have+q>c.nlen+c.ndist){a.msg="invalid bit length repeat",c.mode=lb;break}for(;q--;)c.lens[c.have++]=wb}}if(c.mode===lb)break;if(0===c.lens[256]){a.msg="invalid code -- missing end-of-block",c.mode=lb;break}if(c.lenbits=9,yb={bits:c.lenbits},xb=v(x,c.lens,0,c.nlen,c.lencode,0,c.work,yb),c.lenbits=yb.bits,xb){a.msg="invalid literal/lengths set",c.mode=lb;break}if(c.distbits=6,c.distcode=c.distdyn,yb={bits:c.distbits},xb=v(y,c.lens,c.nlen,c.ndist,c.distcode,0,c.work,yb),c.distbits=yb.bits,xb){a.msg="invalid distances set",c.mode=lb;break}if(c.mode=bb,b===B)break a;case bb:c.mode=cb;case cb:if(i>=6&&j>=258){a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,u(a,p),h=a.next_out,f=a.output,j=a.avail_out,g=a.next_in,e=a.input,i=a.avail_in,m=c.hold,n=c.bits,c.mode===V&&(c.back=-1);break}for(c.back=0;Ab=c.lencode[m&(1<<c.lenbits)-1],qb=Ab>>>24,rb=Ab>>>16&255,sb=65535&Ab,!(n>=qb);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(rb&&0===(240&rb)){for(tb=qb,ub=rb,vb=sb;Ab=c.lencode[vb+((m&(1<<tb+ub)-1)>>tb)],qb=Ab>>>24,rb=Ab>>>16&255,sb=65535&Ab,!(n>=tb+qb);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=tb,n-=tb,c.back+=tb}if(m>>>=qb,n-=qb,c.back+=qb,c.length=sb,0===rb){c.mode=hb;break}if(32&rb){c.back=-1,c.mode=V;break}if(64&rb){a.msg="invalid literal/length code",c.mode=lb;break}c.extra=15&rb,c.mode=db;case db:if(c.extra){for(zb=c.extra;zb>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.length+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}c.was=c.length,c.mode=eb;case eb:for(;Ab=c.distcode[m&(1<<c.distbits)-1],qb=Ab>>>24,rb=Ab>>>16&255,sb=65535&Ab,!(n>=qb);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(0===(240&rb)){for(tb=qb,ub=rb,vb=sb;Ab=c.distcode[vb+((m&(1<<tb+ub)-1)>>tb)],qb=Ab>>>24,rb=Ab>>>16&255,sb=65535&Ab,!(n>=tb+qb);){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}m>>>=tb,n-=tb,c.back+=tb}if(m>>>=qb,n-=qb,c.back+=qb,64&rb){a.msg="invalid distance code",c.mode=lb;break}c.offset=sb,c.extra=15&rb,c.mode=fb;case fb:if(c.extra){for(zb=c.extra;zb>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}c.offset+=m&(1<<c.extra)-1,m>>>=c.extra,n-=c.extra,c.back+=c.extra}if(c.offset>c.dmax){a.msg="invalid distance too far back",c.mode=lb;break}c.mode=gb;case gb:if(0===j)break a;
-if(q=p-j,c.offset>q){if(q=c.offset-q,q>c.whave&&c.sane){a.msg="invalid distance too far back",c.mode=lb;break}q>c.wnext?(q-=c.wnext,ob=c.wsize-q):ob=c.wnext-q,q>c.length&&(q=c.length),pb=c.window}else pb=f,ob=h-c.offset,q=c.length;q>j&&(q=j),j-=q,c.length-=q;do f[h++]=pb[ob++];while(--q);0===c.length&&(c.mode=cb);break;case hb:if(0===j)break a;f[h++]=c.length,j--,c.mode=cb;break;case ib:if(c.wrap){for(;32>n;){if(0===i)break a;i--,m|=e[g++]<<n,n+=8}if(p-=j,a.total_out+=p,c.total+=p,p&&(a.adler=c.check=c.flags?t(c.check,f,p,h-p):s(c.check,f,p,h-p)),p=j,(c.flags?m:d(m))!==c.check){a.msg="incorrect data check",c.mode=lb;break}m=0,n=0}c.mode=jb;case jb:if(c.wrap&&c.flags){for(;32>n;){if(0===i)break a;i--,m+=e[g++]<<n,n+=8}if(m!==(4294967295&c.total)){a.msg="incorrect length check",c.mode=lb;break}m=0,n=0}c.mode=kb;case kb:xb=D;break a;case lb:xb=G;break a;case mb:return H;case nb:default:return F}return a.next_out=h,a.avail_out=j,a.next_in=g,a.avail_in=i,c.hold=m,c.bits=n,(c.wsize||p!==a.avail_out&&c.mode<lb&&(c.mode<ib||b!==z))&&l(a,a.output,a.next_out,p-a.avail_out)?(c.mode=mb,H):(o-=a.avail_in,p-=a.avail_out,a.total_in+=o,a.total_out+=p,c.total+=p,c.wrap&&p&&(a.adler=c.check=c.flags?t(c.check,f,p,a.next_out-p):s(c.check,f,p,a.next_out-p)),a.data_type=c.bits+(c.last?64:0)+(c.mode===V?128:0)+(c.mode===bb||c.mode===Y?256:0),(0===o&&0===p||b===z)&&xb===C&&(xb=I),xb)}function n(a){if(!a||!a.state)return F;var b=a.state;return b.window&&(b.window=null),a.state=null,C}function o(a,b){var c;return a&&a.state?(c=a.state,0===(2&c.wrap)?F:(c.head=b,b.done=!1,C)):F}var p,q,r=a("../utils/common"),s=a("./adler32"),t=a("./crc32"),u=a("./inffast"),v=a("./inftrees"),w=0,x=1,y=2,z=4,A=5,B=6,C=0,D=1,E=2,F=-2,G=-3,H=-4,I=-5,J=8,K=1,L=2,M=3,N=4,O=5,P=6,Q=7,R=8,S=9,T=10,U=11,V=12,W=13,X=14,Y=15,Z=16,$=17,_=18,ab=19,bb=20,cb=21,db=22,eb=23,fb=24,gb=25,hb=26,ib=27,jb=28,kb=29,lb=30,mb=31,nb=32,ob=852,pb=592,qb=15,rb=qb,sb=!0;c.inflateReset=g,c.inflateReset2=h,c.inflateResetKeep=f,c.inflateInit=j,c.inflateInit2=i,c.inflate=m,c.inflateEnd=n,c.inflateGetHeader=o,c.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":27,"./adler32":29,"./crc32":31,"./inffast":34,"./inftrees":36}],36:[function(a,b){"use strict";var c=a("../utils/common"),d=15,e=852,f=592,g=0,h=1,i=2,j=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],k=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],l=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],m=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];b.exports=function(a,b,n,o,p,q,r,s){var t,u,v,w,x,y,z,A,B,C=s.bits,D=0,E=0,F=0,G=0,H=0,I=0,J=0,K=0,L=0,M=0,N=null,O=0,P=new c.Buf16(d+1),Q=new c.Buf16(d+1),R=null,S=0;for(D=0;d>=D;D++)P[D]=0;for(E=0;o>E;E++)P[b[n+E]]++;for(H=C,G=d;G>=1&&0===P[G];G--);if(H>G&&(H=G),0===G)return p[q++]=20971520,p[q++]=20971520,s.bits=1,0;for(F=1;G>F&&0===P[F];F++);for(F>H&&(H=F),K=1,D=1;d>=D;D++)if(K<<=1,K-=P[D],0>K)return-1;if(K>0&&(a===g||1!==G))return-1;for(Q[1]=0,D=1;d>D;D++)Q[D+1]=Q[D]+P[D];for(E=0;o>E;E++)0!==b[n+E]&&(r[Q[b[n+E]]++]=E);if(a===g?(N=R=r,y=19):a===h?(N=j,O-=257,R=k,S-=257,y=256):(N=l,R=m,y=-1),M=0,E=0,D=F,x=q,I=H,J=0,v=-1,L=1<<H,w=L-1,a===h&&L>e||a===i&&L>f)return 1;for(var T=0;;){T++,z=D-J,r[E]<y?(A=0,B=r[E]):r[E]>y?(A=R[S+r[E]],B=N[O+r[E]]):(A=96,B=0),t=1<<D-J,u=1<<I,F=u;do u-=t,p[x+(M>>J)+u]=z<<24|A<<16|B|0;while(0!==u);for(t=1<<D-1;M&t;)t>>=1;if(0!==t?(M&=t-1,M+=t):M=0,E++,0===--P[D]){if(D===G)break;D=b[n+r[E]]}if(D>H&&(M&w)!==v){for(0===J&&(J=H),x+=F,I=D-J,K=1<<I;G>I+J&&(K-=P[I+J],!(0>=K));)I++,K<<=1;if(L+=1<<I,a===h&&L>e||a===i&&L>f)return 1;v=M&w,p[v]=H<<24|I<<16|x-q|0}}return 0!==M&&(p[x+M]=D-J<<24|64<<16|0),s.bits=H,0}},{"../utils/common":27}],37:[function(a,b){"use strict";b.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],38:[function(a,b,c){"use strict";function d(a){for(var b=a.length;--b>=0;)a[b]=0}function e(a){return 256>a?gb[a]:gb[256+(a>>>7)]}function f(a,b){a.pending_buf[a.pending++]=255&b,a.pending_buf[a.pending++]=b>>>8&255}function g(a,b,c){a.bi_valid>V-c?(a.bi_buf|=b<<a.bi_valid&65535,f(a,a.bi_buf),a.bi_buf=b>>V-a.bi_valid,a.bi_valid+=c-V):(a.bi_buf|=b<<a.bi_valid&65535,a.bi_valid+=c)}function h(a,b,c){g(a,c[2*b],c[2*b+1])}function i(a,b){var c=0;do c|=1&a,a>>>=1,c<<=1;while(--b>0);return c>>>1}function j(a){16===a.bi_valid?(f(a,a.bi_buf),a.bi_buf=0,a.bi_valid=0):a.bi_valid>=8&&(a.pending_buf[a.pending++]=255&a.bi_buf,a.bi_buf>>=8,a.bi_valid-=8)}function k(a,b){var c,d,e,f,g,h,i=b.dyn_tree,j=b.max_code,k=b.stat_desc.static_tree,l=b.stat_desc.has_stree,m=b.stat_desc.extra_bits,n=b.stat_desc.extra_base,o=b.stat_desc.max_length,p=0;for(f=0;U>=f;f++)a.bl_count[f]=0;for(i[2*a.heap[a.heap_max]+1]=0,c=a.heap_max+1;T>c;c++)d=a.heap[c],f=i[2*i[2*d+1]+1]+1,f>o&&(f=o,p++),i[2*d+1]=f,d>j||(a.bl_count[f]++,g=0,d>=n&&(g=m[d-n]),h=i[2*d],a.opt_len+=h*(f+g),l&&(a.static_len+=h*(k[2*d+1]+g)));if(0!==p){do{for(f=o-1;0===a.bl_count[f];)f--;a.bl_count[f]--,a.bl_count[f+1]+=2,a.bl_count[o]--,p-=2}while(p>0);for(f=o;0!==f;f--)for(d=a.bl_count[f];0!==d;)e=a.heap[--c],e>j||(i[2*e+1]!==f&&(a.opt_len+=(f-i[2*e+1])*i[2*e],i[2*e+1]=f),d--)}}function l(a,b,c){var d,e,f=new Array(U+1),g=0;for(d=1;U>=d;d++)f[d]=g=g+c[d-1]<<1;for(e=0;b>=e;e++){var h=a[2*e+1];0!==h&&(a[2*e]=i(f[h]++,h))}}function m(){var a,b,c,d,e,f=new Array(U+1);for(c=0,d=0;O-1>d;d++)for(ib[d]=c,a=0;a<1<<_[d];a++)hb[c++]=d;for(hb[c-1]=d,e=0,d=0;16>d;d++)for(jb[d]=e,a=0;a<1<<ab[d];a++)gb[e++]=d;for(e>>=7;R>d;d++)for(jb[d]=e<<7,a=0;a<1<<ab[d]-7;a++)gb[256+e++]=d;for(b=0;U>=b;b++)f[b]=0;for(a=0;143>=a;)eb[2*a+1]=8,a++,f[8]++;for(;255>=a;)eb[2*a+1]=9,a++,f[9]++;for(;279>=a;)eb[2*a+1]=7,a++,f[7]++;for(;287>=a;)eb[2*a+1]=8,a++,f[8]++;for(l(eb,Q+1,f),a=0;R>a;a++)fb[2*a+1]=5,fb[2*a]=i(a,5);kb=new nb(eb,_,P+1,Q,U),lb=new nb(fb,ab,0,R,U),mb=new nb(new Array(0),bb,0,S,W)}function n(a){var b;for(b=0;Q>b;b++)a.dyn_ltree[2*b]=0;for(b=0;R>b;b++)a.dyn_dtree[2*b]=0;for(b=0;S>b;b++)a.bl_tree[2*b]=0;a.dyn_ltree[2*X]=1,a.opt_len=a.static_len=0,a.last_lit=a.matches=0}function o(a){a.bi_valid>8?f(a,a.bi_buf):a.bi_valid>0&&(a.pending_buf[a.pending++]=a.bi_buf),a.bi_buf=0,a.bi_valid=0}function p(a,b,c,d){o(a),d&&(f(a,c),f(a,~c)),E.arraySet(a.pending_buf,a.window,b,c,a.pending),a.pending+=c}function q(a,b,c,d){var e=2*b,f=2*c;return a[e]<a[f]||a[e]===a[f]&&d[b]<=d[c]}function r(a,b,c){for(var d=a.heap[c],e=c<<1;e<=a.heap_len&&(e<a.heap_len&&q(b,a.heap[e+1],a.heap[e],a.depth)&&e++,!q(b,d,a.heap[e],a.depth));)a.heap[c]=a.heap[e],c=e,e<<=1;a.heap[c]=d}function s(a,b,c){var d,f,i,j,k=0;if(0!==a.last_lit)do d=a.pending_buf[a.d_buf+2*k]<<8|a.pending_buf[a.d_buf+2*k+1],f=a.pending_buf[a.l_buf+k],k++,0===d?h(a,f,b):(i=hb[f],h(a,i+P+1,b),j=_[i],0!==j&&(f-=ib[i],g(a,f,j)),d--,i=e(d),h(a,i,c),j=ab[i],0!==j&&(d-=jb[i],g(a,d,j)));while(k<a.last_lit);h(a,X,b)}function t(a,b){var c,d,e,f=b.dyn_tree,g=b.stat_desc.static_tree,h=b.stat_desc.has_stree,i=b.stat_desc.elems,j=-1;for(a.heap_len=0,a.heap_max=T,c=0;i>c;c++)0!==f[2*c]?(a.heap[++a.heap_len]=j=c,a.depth[c]=0):f[2*c+1]=0;for(;a.heap_len<2;)e=a.heap[++a.heap_len]=2>j?++j:0,f[2*e]=1,a.depth[e]=0,a.opt_len--,h&&(a.static_len-=g[2*e+1]);for(b.max_code=j,c=a.heap_len>>1;c>=1;c--)r(a,f,c);e=i;do c=a.heap[1],a.heap[1]=a.heap[a.heap_len--],r(a,f,1),d=a.heap[1],a.heap[--a.heap_max]=c,a.heap[--a.heap_max]=d,f[2*e]=f[2*c]+f[2*d],a.depth[e]=(a.depth[c]>=a.depth[d]?a.depth[c]:a.depth[d])+1,f[2*c+1]=f[2*d+1]=e,a.heap[1]=e++,r(a,f,1);while(a.heap_len>=2);a.heap[--a.heap_max]=a.heap[1],k(a,b),l(f,j,a.bl_count)}function u(a,b,c){var d,e,f=-1,g=b[1],h=0,i=7,j=4;for(0===g&&(i=138,j=3),b[2*(c+1)+1]=65535,d=0;c>=d;d++)e=g,g=b[2*(d+1)+1],++h<i&&e===g||(j>h?a.bl_tree[2*e]+=h:0!==e?(e!==f&&a.bl_tree[2*e]++,a.bl_tree[2*Y]++):10>=h?a.bl_tree[2*Z]++:a.bl_tree[2*$]++,h=0,f=e,0===g?(i=138,j=3):e===g?(i=6,j=3):(i=7,j=4))}function v(a,b,c){var d,e,f=-1,i=b[1],j=0,k=7,l=4;for(0===i&&(k=138,l=3),d=0;c>=d;d++)if(e=i,i=b[2*(d+1)+1],!(++j<k&&e===i)){if(l>j){do h(a,e,a.bl_tree);while(0!==--j)}else 0!==e?(e!==f&&(h(a,e,a.bl_tree),j--),h(a,Y,a.bl_tree),g(a,j-3,2)):10>=j?(h(a,Z,a.bl_tree),g(a,j-3,3)):(h(a,$,a.bl_tree),g(a,j-11,7));j=0,f=e,0===i?(k=138,l=3):e===i?(k=6,l=3):(k=7,l=4)}}function w(a){var b;for(u(a,a.dyn_ltree,a.l_desc.max_code),u(a,a.dyn_dtree,a.d_desc.max_code),t(a,a.bl_desc),b=S-1;b>=3&&0===a.bl_tree[2*cb[b]+1];b--);return a.opt_len+=3*(b+1)+5+5+4,b}function x(a,b,c,d){var e;for(g(a,b-257,5),g(a,c-1,5),g(a,d-4,4),e=0;d>e;e++)g(a,a.bl_tree[2*cb[e]+1],3);v(a,a.dyn_ltree,b-1),v(a,a.dyn_dtree,c-1)}function y(a){var b,c=4093624447;for(b=0;31>=b;b++,c>>>=1)if(1&c&&0!==a.dyn_ltree[2*b])return G;if(0!==a.dyn_ltree[18]||0!==a.dyn_ltree[20]||0!==a.dyn_ltree[26])return H;for(b=32;P>b;b++)if(0!==a.dyn_ltree[2*b])return H;return G}function z(a){pb||(m(),pb=!0),a.l_desc=new ob(a.dyn_ltree,kb),a.d_desc=new ob(a.dyn_dtree,lb),a.bl_desc=new ob(a.bl_tree,mb),a.bi_buf=0,a.bi_valid=0,n(a)}function A(a,b,c,d){g(a,(J<<1)+(d?1:0),3),p(a,b,c,!0)}function B(a){g(a,K<<1,3),h(a,X,eb),j(a)}function C(a,b,c,d){var e,f,h=0;a.level>0?(a.strm.data_type===I&&(a.strm.data_type=y(a)),t(a,a.l_desc),t(a,a.d_desc),h=w(a),e=a.opt_len+3+7>>>3,f=a.static_len+3+7>>>3,e>=f&&(e=f)):e=f=c+5,e>=c+4&&-1!==b?A(a,b,c,d):a.strategy===F||f===e?(g(a,(K<<1)+(d?1:0),3),s(a,eb,fb)):(g(a,(L<<1)+(d?1:0),3),x(a,a.l_desc.max_code+1,a.d_desc.max_code+1,h+1),s(a,a.dyn_ltree,a.dyn_dtree)),n(a),d&&o(a)}function D(a,b,c){return a.pending_buf[a.d_buf+2*a.last_lit]=b>>>8&255,a.pending_buf[a.d_buf+2*a.last_lit+1]=255&b,a.pending_buf[a.l_buf+a.last_lit]=255&c,a.last_lit++,0===b?a.dyn_ltree[2*c]++:(a.matches++,b--,a.dyn_ltree[2*(hb[c]+P+1)]++,a.dyn_dtree[2*e(b)]++),a.last_lit===a.lit_bufsize-1}var E=a("../utils/common"),F=4,G=0,H=1,I=2,J=0,K=1,L=2,M=3,N=258,O=29,P=256,Q=P+1+O,R=30,S=19,T=2*Q+1,U=15,V=16,W=7,X=256,Y=16,Z=17,$=18,_=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],ab=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],bb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],cb=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],db=512,eb=new Array(2*(Q+2));d(eb);var fb=new Array(2*R);d(fb);var gb=new Array(db);d(gb);var hb=new Array(N-M+1);d(hb);var ib=new Array(O);d(ib);var jb=new Array(R);d(jb);var kb,lb,mb,nb=function(a,b,c,d,e){this.static_tree=a,this.extra_bits=b,this.extra_base=c,this.elems=d,this.max_length=e,this.has_stree=a&&a.length},ob=function(a,b){this.dyn_tree=a,this.max_code=0,this.stat_desc=b},pb=!1;c._tr_init=z,c._tr_stored_block=A,c._tr_flush_block=C,c._tr_tally=D,c._tr_align=B},{"../utils/common":27}],39:[function(a,b){"use strict";function c(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}b.exports=c},{}]},{},[9])(9)}); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/mannwhitneyu/README.chromium b/chromium/third_party/catapult/tracing/third_party/mannwhitneyu/README.chromium
deleted file mode 100644
index 78439f32f52..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/mannwhitneyu/README.chromium
+++ /dev/null
@@ -1,15 +0,0 @@
-Name: Mann-Whitney U Test
-Short Name: mannwhitneyu
-URL: https://gist.github.com/gungorbudak/1c3989cc26b9567c6e50
-Version: 0
-Revision: f8f2918a366798793f5fb7e92de0df9142feb737
-Date: Jan 16 2016
-License: MIT
-License File: NOT_SHIPPED
-Security Critical: no
-
-Description:
-Mann Whitney U Test implemented in javascript
-
-Local Modifications:
-None.
diff --git a/chromium/third_party/catapult/tracing/third_party/mannwhitneyu/mannwhitneyu.js b/chromium/third_party/catapult/tracing/third_party/mannwhitneyu/mannwhitneyu.js
deleted file mode 100644
index 2e2bda544b9..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/mannwhitneyu/mannwhitneyu.js
+++ /dev/null
@@ -1,197 +0,0 @@
-'use strict';
-
-(function(exports) {
-
- var rank = {
- /*
- * Standart ranking
- *
- * The MIT License, Copyright (c) 2014 Ben Magyar
- */
- standard: function(array, key) {
- // sort the array
- array = array.sort(function(a, b) {
- var x = a[key];
- var y = b[key];
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
- });
- // assign a naive ranking
- for (var i = 1; i < array.length + 1; i++) {
- array[i - 1]['rank'] = i;
- }
- return array;
- },
- /*
- * Fractional ranking
- *
- * The MIT License, Copyright (c) 2014 Ben Magyar
- */
- fractional: function(array, key) {
- array = this.standard(array, key);
- // now apply fractional
- var pos = 0;
- while (pos < array.length) {
- var sum = 0;
- var i = 0;
- for (i = 0; array[pos + i + 1] && (array[pos + i][key] === array[pos + i + 1][key]); i++) {
- sum += array[pos + i]['rank'];
- }
- sum += array[pos + i]['rank'];
- var endPos = pos + i + 1;
- for (pos; pos < endPos; pos++) {
- array[pos]['rank'] = sum / (i + 1);
- }
- pos = endPos;
- }
- return array;
- },
- rank: function(x, y) {
- var nx = x.length,
- ny = y.length,
- combined = [],
- ranked;
- while (nx--) {
- combined.push({
- set: 'x',
- val: x[nx]
- });
- }
- while (ny--) {
- combined.push({
- set: 'y',
- val: y[ny]
- });
- }
- ranked = this.fractional(combined, 'val');
- return ranked
- }
- };
-
- /*
- * Error function
- *
- * The MIT License, Copyright (c) 2013 jStat
- */
- var erf = function erf(x) {
- var cof = [-1.3026537197817094, 6.4196979235649026e-1, 1.9476473204185836e-2, -9.561514786808631e-3, -9.46595344482036e-4, 3.66839497852761e-4,
- 4.2523324806907e-5, -2.0278578112534e-5, -1.624290004647e-6,
- 1.303655835580e-6, 1.5626441722e-8, -8.5238095915e-8,
- 6.529054439e-9, 5.059343495e-9, -9.91364156e-10, -2.27365122e-10, 9.6467911e-11, 2.394038e-12, -6.886027e-12, 8.94487e-13, 3.13092e-13, -1.12708e-13, 3.81e-16, 7.106e-15, -1.523e-15, -9.4e-17, 1.21e-16, -2.8e-17
- ];
- var j = cof.length - 1;
- var isneg = false;
- var d = 0;
- var dd = 0;
- var t, ty, tmp, res;
-
- if (x < 0) {
- x = -x;
- isneg = true;
- }
-
- t = 2 / (2 + x);
- ty = 4 * t - 2;
-
- for (; j > 0; j--) {
- tmp = d;
- d = ty * d - dd + cof[j];
- dd = tmp;
- }
-
- res = t * Math.exp(-x * x + 0.5 * (cof[0] + ty * d) - dd);
- return isneg ? res - 1 : 1 - res;
- };
-
- /*
- * Normal distribution CDF
- *
- * The MIT License, Copyright (c) 2013 jStat
- */
- var dnorm = function(x, mean, std) {
- return 0.5 * (1 + erf((x - mean) / Math.sqrt(2 * std * std)));
- }
-
- var statistic = function(x, y) {
- var ranked = rank.rank(x, y),
- nr = ranked.length,
- nx = x.length,
- ny = y.length,
- ranksums = {
- x: 0,
- y: 0
- },
- i = 0, t = 0, nt = 1, tcf, ux, uy;
-
- while (i < nr) {
- if (i > 0) {
- if (ranked[i].val == ranked[i-1].val) {
- nt++;
- } else {
- if (nt > 1) {
- t += Math.pow(nt, 3) - nt
- nt = 1;
- }
- }
- }
- ranksums[ranked[i].set] += ranked[i].rank
- i++;
- }
- tcf = 1 - (t / (Math.pow(nr, 3) - nr))
- ux = nx*ny + (nx*(nx+1)/2) - ranksums.x;
- uy = nx*ny - ux;
-
- return {
- tcf: tcf,
- ux: ux,
- uy: uy,
- big: Math.max(ux, uy),
- small: Math.min(ux, uy)
- }
- }
-
- exports.test = function(x, y, alt, corr) {
- // set default value for alternative
- alt = typeof alt !== 'undefined' ? alt : 'two-sided';
- // set default value for continuity
- corr = typeof corr !== 'undefined' ? corr : true;
- var nx = x.length, // x's size
- ny = y.length, // y's size
- f = 1,
- u, mu, std, z, p;
-
- // test statistic
- u = statistic(x, y);
-
- // mean compute and correct if given
- if (corr) {
- mu = (nx * ny / 2) + 0.5;
- } else {
- mu = nx * ny / 2;
- }
-
- // compute standard deviation using tie correction factor
- std = Math.sqrt(u.tcf * nx * ny * (nx + ny + 1) / 12);
-
- // compute z according to given alternative
- if (alt == 'less') {
- z = (u.ux - mu) / std;
- } else if (alt == 'greater') {
- z = (u.uy - mu) / std;
- } else if (alt == 'two-sided') {
- z = Math.abs((u.big - mu) / std);
- } else {
- console.log('Unknown alternative argument');
- }
-
- // factor to correct two sided p-value
- if (alt == 'two-sided') {
- f = 2;
- }
-
- // compute p-value using CDF of standard normal
- p = dnorm(-z, 0, 1) * f;
-
- return {U: u.small, p: p};
- }
-
-})(typeof exports === 'undefined' ? this['mannwhitneyu'] = {} : exports); \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/mocha/LICENSE b/chromium/third_party/catapult/tracing/third_party/mocha/LICENSE
deleted file mode 100644
index ca47f261b3f..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/mocha/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-(The MIT License)
-
-Copyright (c) 2011-2015 TJ Holowaychuk <tj@vision-media.ca>
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/chromium/third_party/catapult/tracing/third_party/mocha/README.chromium b/chromium/third_party/catapult/tracing/third_party/mocha/README.chromium
deleted file mode 100644
index e492702c6ba..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/mocha/README.chromium
+++ /dev/null
@@ -1,9 +0,0 @@
-Name: Mocha, simple, flexible, fun javascript test framework for node.js & the browser
-Short Name: Mocha
-URL: https://github.com/mochajs/mocha
-Version: 2c2ed43ae7f047f333468e2043001bfb8c9d13d5
-License: MIT
-License File: NOT_SHIPPED
-Security Critical: no
-Description: Used for testing
-Local Modifications: None
diff --git a/chromium/third_party/catapult/tracing/third_party/mocha/mocha.css b/chromium/third_party/catapult/tracing/third_party/mocha/mocha.css
deleted file mode 100644
index 42b9798fa4e..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/mocha/mocha.css
+++ /dev/null
@@ -1,270 +0,0 @@
-@charset "utf-8";
-
-body {
- margin:0;
-}
-
-#mocha {
- font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
- margin: 60px 50px;
-}
-
-#mocha ul,
-#mocha li {
- margin: 0;
- padding: 0;
-}
-
-#mocha ul {
- list-style: none;
-}
-
-#mocha h1,
-#mocha h2 {
- margin: 0;
-}
-
-#mocha h1 {
- margin-top: 15px;
- font-size: 1em;
- font-weight: 200;
-}
-
-#mocha h1 a {
- text-decoration: none;
- color: inherit;
-}
-
-#mocha h1 a:hover {
- text-decoration: underline;
-}
-
-#mocha .suite .suite h1 {
- margin-top: 0;
- font-size: .8em;
-}
-
-#mocha .hidden {
- display: none;
-}
-
-#mocha h2 {
- font-size: 12px;
- font-weight: normal;
- cursor: pointer;
-}
-
-#mocha .suite {
- margin-left: 15px;
-}
-
-#mocha .test {
- margin-left: 15px;
- overflow: hidden;
-}
-
-#mocha .test.pending:hover h2::after {
- content: '(pending)';
- font-family: arial, sans-serif;
-}
-
-#mocha .test.pass.medium .duration {
- background: #c09853;
-}
-
-#mocha .test.pass.slow .duration {
- background: #b94a48;
-}
-
-#mocha .test.pass::before {
- content: '✓';
- font-size: 12px;
- display: block;
- float: left;
- margin-right: 5px;
- color: #00d6b2;
-}
-
-#mocha .test.pass .duration {
- font-size: 9px;
- margin-left: 5px;
- padding: 2px 5px;
- color: #fff;
- -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
- -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
- box-shadow: inset 0 1px 1px rgba(0,0,0,.2);
- -webkit-border-radius: 5px;
- -moz-border-radius: 5px;
- -ms-border-radius: 5px;
- -o-border-radius: 5px;
- border-radius: 5px;
-}
-
-#mocha .test.pass.fast .duration {
- display: none;
-}
-
-#mocha .test.pending {
- color: #0b97c4;
-}
-
-#mocha .test.pending::before {
- content: '◦';
- color: #0b97c4;
-}
-
-#mocha .test.fail {
- color: #c00;
-}
-
-#mocha .test.fail pre {
- color: black;
-}
-
-#mocha .test.fail::before {
- content: '✖';
- font-size: 12px;
- display: block;
- float: left;
- margin-right: 5px;
- color: #c00;
-}
-
-#mocha .test pre.error {
- color: #c00;
- max-height: 300px;
- overflow: auto;
-}
-
-/**
- * (1): approximate for browsers not supporting calc
- * (2): 42 = 2*15 + 2*10 + 2*1 (padding + margin + border)
- * ^^ seriously
- */
-#mocha .test pre {
- display: block;
- float: left;
- clear: left;
- font: 12px/1.5 monaco, monospace;
- margin: 5px;
- padding: 15px;
- border: 1px solid #eee;
- max-width: 85%; /*(1)*/
- max-width: calc(100% - 42px); /*(2)*/
- word-wrap: break-word;
- border-bottom-color: #ddd;
- -webkit-border-radius: 3px;
- -webkit-box-shadow: 0 1px 3px #eee;
- -moz-border-radius: 3px;
- -moz-box-shadow: 0 1px 3px #eee;
- border-radius: 3px;
-}
-
-#mocha .test h2 {
- position: relative;
-}
-
-#mocha .test a.replay {
- position: absolute;
- top: 3px;
- right: 0;
- text-decoration: none;
- vertical-align: middle;
- display: block;
- width: 15px;
- height: 15px;
- line-height: 15px;
- text-align: center;
- background: #eee;
- font-size: 15px;
- -moz-border-radius: 15px;
- border-radius: 15px;
- -webkit-transition: opacity 200ms;
- -moz-transition: opacity 200ms;
- transition: opacity 200ms;
- opacity: 0.3;
- color: #888;
-}
-
-#mocha .test:hover a.replay {
- opacity: 1;
-}
-
-#mocha-report.pass .test.fail {
- display: none;
-}
-
-#mocha-report.fail .test.pass {
- display: none;
-}
-
-#mocha-report.pending .test.pass,
-#mocha-report.pending .test.fail {
- display: none;
-}
-#mocha-report.pending .test.pass.pending {
- display: block;
-}
-
-#mocha-error {
- color: #c00;
- font-size: 1.5em;
- font-weight: 100;
- letter-spacing: 1px;
-}
-
-#mocha-stats {
- position: fixed;
- top: 15px;
- right: 10px;
- font-size: 12px;
- margin: 0;
- color: #888;
- z-index: 1;
-}
-
-#mocha-stats .progress {
- float: right;
- padding-top: 0;
-}
-
-#mocha-stats em {
- color: black;
-}
-
-#mocha-stats a {
- text-decoration: none;
- color: inherit;
-}
-
-#mocha-stats a:hover {
- border-bottom: 1px solid #eee;
-}
-
-#mocha-stats li {
- display: inline-block;
- margin: 0 5px;
- list-style: none;
- padding-top: 11px;
-}
-
-#mocha-stats canvas {
- width: 40px;
- height: 40px;
-}
-
-#mocha code .comment { color: #ddd; }
-#mocha code .init { color: #2f6fad; }
-#mocha code .string { color: #5890ad; }
-#mocha code .keyword { color: #8a6343; }
-#mocha code .number { color: #2f6fad; }
-
-@media screen and (max-device-width: 480px) {
- #mocha {
- margin: 60px 0px;
- }
-
- #mocha #stats {
- position: absolute;
- }
-}
diff --git a/chromium/third_party/catapult/tracing/third_party/mocha/mocha.js b/chromium/third_party/catapult/tracing/third_party/mocha/mocha.js
deleted file mode 100755
index cffddcbc130..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/mocha/mocha.js
+++ /dev/null
@@ -1,6557 +0,0 @@
-;(function(){
-
-// CommonJS require()
-
-function require(p){
- var path = require.resolve(p)
- , mod = require.modules[path];
- if (!mod) throw new Error('failed to require "' + p + '"');
- if (!mod.exports) {
- mod.exports = {};
- mod.call(mod.exports, mod, mod.exports, require.relative(path));
- }
- return mod.exports;
- }
-
-require.modules = {};
-
-require.resolve = function (path){
- var orig = path
- , reg = path + '.js'
- , index = path + '/index.js';
- return require.modules[reg] && reg
- || require.modules[index] && index
- || orig;
- };
-
-require.register = function (path, fn){
- require.modules[path] = fn;
- };
-
-require.relative = function (parent) {
- return function(p){
- if ('.' != p.charAt(0)) return require(p);
-
- var path = parent.split('/')
- , segs = p.split('/');
- path.pop();
-
- for (var i = 0; i < segs.length; i++) {
- var seg = segs[i];
- if ('..' == seg) path.pop();
- else if ('.' != seg) path.push(seg);
- }
-
- return require(path.join('/'));
- };
- };
-
-
-require.register("browser/debug.js", function(module, exports, require){
-module.exports = function(type){
- return function(){
- }
-};
-
-}); // module: browser/debug.js
-
-require.register("browser/diff.js", function(module, exports, require){
-/* See LICENSE file for terms of use */
-
-/*
- * Text diff implementation.
- *
- * This library supports the following APIS:
- * JsDiff.diffChars: Character by character diff
- * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace
- * JsDiff.diffLines: Line based diff
- *
- * JsDiff.diffCss: Diff targeted at CSS content
- *
- * These methods are based on the implementation proposed in
- * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986).
- * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927
- */
-var JsDiff = (function() {
- /*jshint maxparams: 5*/
- function clonePath(path) {
- return { newPos: path.newPos, components: path.components.slice(0) };
- }
- function removeEmpty(array) {
- var ret = [];
- for (var i = 0; i < array.length; i++) {
- if (array[i]) {
- ret.push(array[i]);
- }
- }
- return ret;
- }
- function escapeHTML(s) {
- var n = s;
- n = n.replace(/&/g, '&amp;');
- n = n.replace(/</g, '&lt;');
- n = n.replace(/>/g, '&gt;');
- n = n.replace(/"/g, '&quot;');
-
- return n;
- }
-
- var Diff = function(ignoreWhitespace) {
- this.ignoreWhitespace = ignoreWhitespace;
- };
- Diff.prototype = {
- diff: function(oldString, newString) {
- // Handle the identity case (this is due to unrolling editLength == 0
- if (newString === oldString) {
- return [{ value: newString }];
- }
- if (!newString) {
- return [{ value: oldString, removed: true }];
- }
- if (!oldString) {
- return [{ value: newString, added: true }];
- }
-
- newString = this.tokenize(newString);
- oldString = this.tokenize(oldString);
-
- var newLen = newString.length, oldLen = oldString.length;
- var maxEditLength = newLen + oldLen;
- var bestPath = [{ newPos: -1, components: [] }];
-
- // Seed editLength = 0
- var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0);
- if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) {
- return bestPath[0].components;
- }
-
- for (var editLength = 1; editLength <= maxEditLength; editLength++) {
- for (var diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) {
- var basePath;
- var addPath = bestPath[diagonalPath-1],
- removePath = bestPath[diagonalPath+1];
- oldPos = (removePath ? removePath.newPos : 0) - diagonalPath;
- if (addPath) {
- // No one else is going to attempt to use this value, clear it
- bestPath[diagonalPath-1] = undefined;
- }
-
- var canAdd = addPath && addPath.newPos+1 < newLen;
- var canRemove = removePath && 0 <= oldPos && oldPos < oldLen;
- if (!canAdd && !canRemove) {
- bestPath[diagonalPath] = undefined;
- continue;
- }
-
- // Select the diagonal that we want to branch from. We select the prior
- // path whose position in the new string is the farthest from the origin
- // and does not pass the bounds of the diff graph
- if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) {
- basePath = clonePath(removePath);
- this.pushComponent(basePath.components, oldString[oldPos], undefined, true);
- } else {
- basePath = clonePath(addPath);
- basePath.newPos++;
- this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined);
- }
-
- var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath);
-
- if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) {
- return basePath.components;
- } else {
- bestPath[diagonalPath] = basePath;
- }
- }
- }
- },
-
- pushComponent: function(components, value, added, removed) {
- var last = components[components.length-1];
- if (last && last.added === added && last.removed === removed) {
- // We need to clone here as the component clone operation is just
- // as shallow array clone
- components[components.length-1] =
- {value: this.join(last.value, value), added: added, removed: removed };
- } else {
- components.push({value: value, added: added, removed: removed });
- }
- },
- extractCommon: function(basePath, newString, oldString, diagonalPath) {
- var newLen = newString.length,
- oldLen = oldString.length,
- newPos = basePath.newPos,
- oldPos = newPos - diagonalPath;
- while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) {
- newPos++;
- oldPos++;
-
- this.pushComponent(basePath.components, newString[newPos], undefined, undefined);
- }
- basePath.newPos = newPos;
- return oldPos;
- },
-
- equals: function(left, right) {
- var reWhitespace = /\S/;
- if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) {
- return true;
- } else {
- return left === right;
- }
- },
- join: function(left, right) {
- return left + right;
- },
- tokenize: function(value) {
- return value;
- }
- };
-
- var CharDiff = new Diff();
-
- var WordDiff = new Diff(true);
- var WordWithSpaceDiff = new Diff();
- WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) {
- return removeEmpty(value.split(/(\s+|\b)/));
- };
-
- var CssDiff = new Diff(true);
- CssDiff.tokenize = function(value) {
- return removeEmpty(value.split(/([{}:;,]|\s+)/));
- };
-
- var LineDiff = new Diff();
- LineDiff.tokenize = function(value) {
- var retLines = [],
- lines = value.split(/^/m);
-
- for(var i = 0; i < lines.length; i++) {
- var line = lines[i],
- lastLine = lines[i - 1];
-
- // Merge lines that may contain windows new lines
- if (line == '\n' && lastLine && lastLine[lastLine.length - 1] === '\r') {
- retLines[retLines.length - 1] += '\n';
- } else if (line) {
- retLines.push(line);
- }
- }
-
- return retLines;
- };
-
- return {
- Diff: Diff,
-
- diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); },
- diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); },
- diffWordsWithSpace: function(oldStr, newStr) { return WordWithSpaceDiff.diff(oldStr, newStr); },
- diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); },
-
- diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); },
-
- createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) {
- var ret = [];
-
- ret.push('Index: ' + fileName);
- ret.push('===================================================================');
- ret.push('--- ' + fileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader));
- ret.push('+++ ' + fileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader));
-
- var diff = LineDiff.diff(oldStr, newStr);
- if (!diff[diff.length-1].value) {
- diff.pop(); // Remove trailing newline add
- }
- diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier
-
- function contextLines(lines) {
- return lines.map(function(entry) { return ' ' + entry; });
- }
- function eofNL(curRange, i, current) {
- var last = diff[diff.length-2],
- isLast = i === diff.length-2,
- isLastOfType = i === diff.length-3 && (current.added !== last.added || current.removed !== last.removed);
-
- // Figure out if this is the last line for the given file and missing NL
- if (!/\n$/.test(current.value) && (isLast || isLastOfType)) {
- curRange.push('\\ No newline at end of file');
- }
- }
-
- var oldRangeStart = 0, newRangeStart = 0, curRange = [],
- oldLine = 1, newLine = 1;
- for (var i = 0; i < diff.length; i++) {
- var current = diff[i],
- lines = current.lines || current.value.replace(/\n$/, '').split('\n');
- current.lines = lines;
-
- if (current.added || current.removed) {
- if (!oldRangeStart) {
- var prev = diff[i-1];
- oldRangeStart = oldLine;
- newRangeStart = newLine;
-
- if (prev) {
- curRange = contextLines(prev.lines.slice(-4));
- oldRangeStart -= curRange.length;
- newRangeStart -= curRange.length;
- }
- }
- curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?'+':'-') + entry; }));
- eofNL(curRange, i, current);
-
- if (current.added) {
- newLine += lines.length;
- } else {
- oldLine += lines.length;
- }
- } else {
- if (oldRangeStart) {
- // Close out any changes that have been output (or join overlapping)
- if (lines.length <= 8 && i < diff.length-2) {
- // Overlapping
- curRange.push.apply(curRange, contextLines(lines));
- } else {
- // end the range and output
- var contextSize = Math.min(lines.length, 4);
- ret.push(
- '@@ -' + oldRangeStart + ',' + (oldLine-oldRangeStart+contextSize)
- + ' +' + newRangeStart + ',' + (newLine-newRangeStart+contextSize)
- + ' @@');
- ret.push.apply(ret, curRange);
- ret.push.apply(ret, contextLines(lines.slice(0, contextSize)));
- if (lines.length <= 4) {
- eofNL(ret, i, current);
- }
-
- oldRangeStart = 0; newRangeStart = 0; curRange = [];
- }
- }
- oldLine += lines.length;
- newLine += lines.length;
- }
- }
-
- return ret.join('\n') + '\n';
- },
-
- applyPatch: function(oldStr, uniDiff) {
- var diffstr = uniDiff.split('\n');
- var diff = [];
- var remEOFNL = false,
- addEOFNL = false;
-
- for (var i = (diffstr[0][0]==='I'?4:0); i < diffstr.length; i++) {
- if(diffstr[i][0] === '@') {
- var meh = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/);
- diff.unshift({
- start:meh[3],
- oldlength:meh[2],
- oldlines:[],
- newlength:meh[4],
- newlines:[]
- });
- } else if(diffstr[i][0] === '+') {
- diff[0].newlines.push(diffstr[i].substr(1));
- } else if(diffstr[i][0] === '-') {
- diff[0].oldlines.push(diffstr[i].substr(1));
- } else if(diffstr[i][0] === ' ') {
- diff[0].newlines.push(diffstr[i].substr(1));
- diff[0].oldlines.push(diffstr[i].substr(1));
- } else if(diffstr[i][0] === '\\') {
- if (diffstr[i-1][0] === '+') {
- remEOFNL = true;
- } else if(diffstr[i-1][0] === '-') {
- addEOFNL = true;
- }
- }
- }
-
- var str = oldStr.split('\n');
- for (var i = diff.length - 1; i >= 0; i--) {
- var d = diff[i];
- for (var j = 0; j < d.oldlength; j++) {
- if(str[d.start-1+j] !== d.oldlines[j]) {
- return false;
- }
- }
- Array.prototype.splice.apply(str,[d.start-1,+d.oldlength].concat(d.newlines));
- }
-
- if (remEOFNL) {
- while (!str[str.length-1]) {
- str.pop();
- }
- } else if (addEOFNL) {
- str.push('');
- }
- return str.join('\n');
- },
-
- convertChangesToXML: function(changes){
- var ret = [];
- for ( var i = 0; i < changes.length; i++) {
- var change = changes[i];
- if (change.added) {
- ret.push('<ins>');
- } else if (change.removed) {
- ret.push('<del>');
- }
-
- ret.push(escapeHTML(change.value));
-
- if (change.added) {
- ret.push('</ins>');
- } else if (change.removed) {
- ret.push('</del>');
- }
- }
- return ret.join('');
- },
-
- // See: http://code.google.com/p/google-diff-match-patch/wiki/API
- convertChangesToDMP: function(changes){
- var ret = [], change;
- for ( var i = 0; i < changes.length; i++) {
- change = changes[i];
- ret.push([(change.added ? 1 : change.removed ? -1 : 0), change.value]);
- }
- return ret;
- }
- };
-})();
-
-if (typeof module !== 'undefined') {
- module.exports = JsDiff;
-}
-
-}); // module: browser/diff.js
-
-require.register("browser/escape-string-regexp.js", function(module, exports, require){
-'use strict';
-
-var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g;
-
-module.exports = function (str) {
- if (typeof str !== 'string') {
- throw new TypeError('Expected a string');
- }
-
- return str.replace(matchOperatorsRe, '\\$&');
-};
-
-}); // module: browser/escape-string-regexp.js
-
-require.register("browser/events.js", function(module, exports, require){
-/**
- * Module exports.
- */
-
-exports.EventEmitter = EventEmitter;
-
-/**
- * Check if `obj` is an array.
- */
-
-function isArray(obj) {
- return '[object Array]' == {}.toString.call(obj);
-}
-
-/**
- * Event emitter constructor.
- *
- * @api public
- */
-
-function EventEmitter(){};
-
-/**
- * Adds a listener.
- *
- * @api public
- */
-
-EventEmitter.prototype.on = function (name, fn) {
- if (!this.$events) {
- this.$events = {};
- }
-
- if (!this.$events[name]) {
- this.$events[name] = fn;
- } else if (isArray(this.$events[name])) {
- this.$events[name].push(fn);
- } else {
- this.$events[name] = [this.$events[name], fn];
- }
-
- return this;
-};
-
-EventEmitter.prototype.addListener = EventEmitter.prototype.on;
-
-/**
- * Adds a volatile listener.
- *
- * @api public
- */
-
-EventEmitter.prototype.once = function (name, fn) {
- var self = this;
-
- function on () {
- self.removeListener(name, on);
- fn.apply(this, arguments);
- };
-
- on.listener = fn;
- this.on(name, on);
-
- return this;
-};
-
-/**
- * Removes a listener.
- *
- * @api public
- */
-
-EventEmitter.prototype.removeListener = function (name, fn) {
- if (this.$events && this.$events[name]) {
- var list = this.$events[name];
-
- if (isArray(list)) {
- var pos = -1;
-
- for (var i = 0, l = list.length; i < l; i++) {
- if (list[i] === fn || (list[i].listener && list[i].listener === fn)) {
- pos = i;
- break;
- }
- }
-
- if (pos < 0) {
- return this;
- }
-
- list.splice(pos, 1);
-
- if (!list.length) {
- delete this.$events[name];
- }
- } else if (list === fn || (list.listener && list.listener === fn)) {
- delete this.$events[name];
- }
- }
-
- return this;
-};
-
-/**
- * Removes all listeners for an event.
- *
- * @api public
- */
-
-EventEmitter.prototype.removeAllListeners = function (name) {
- if (name === undefined) {
- this.$events = {};
- return this;
- }
-
- if (this.$events && this.$events[name]) {
- this.$events[name] = null;
- }
-
- return this;
-};
-
-/**
- * Gets all listeners for a certain event.
- *
- * @api public
- */
-
-EventEmitter.prototype.listeners = function (name) {
- if (!this.$events) {
- this.$events = {};
- }
-
- if (!this.$events[name]) {
- this.$events[name] = [];
- }
-
- if (!isArray(this.$events[name])) {
- this.$events[name] = [this.$events[name]];
- }
-
- return this.$events[name];
-};
-
-/**
- * Emits an event.
- *
- * @api public
- */
-
-EventEmitter.prototype.emit = function (name) {
- if (!this.$events) {
- return false;
- }
-
- var handler = this.$events[name];
-
- if (!handler) {
- return false;
- }
-
- var args = [].slice.call(arguments, 1);
-
- if ('function' == typeof handler) {
- handler.apply(this, args);
- } else if (isArray(handler)) {
- var listeners = handler.slice();
-
- for (var i = 0, l = listeners.length; i < l; i++) {
- listeners[i].apply(this, args);
- }
- } else {
- return false;
- }
-
- return true;
-};
-
-}); // module: browser/events.js
-
-require.register("browser/fs.js", function(module, exports, require){
-
-}); // module: browser/fs.js
-
-require.register("browser/glob.js", function(module, exports, require){
-
-}); // module: browser/glob.js
-
-require.register("browser/path.js", function(module, exports, require){
-
-}); // module: browser/path.js
-
-require.register("browser/progress.js", function(module, exports, require){
-/**
- * Expose `Progress`.
- */
-
-module.exports = Progress;
-
-/**
- * Initialize a new `Progress` indicator.
- */
-
-function Progress() {
- this.percent = 0;
- this.size(0);
- this.fontSize(11);
- this.font('helvetica, arial, sans-serif');
-}
-
-/**
- * Set progress size to `n`.
- *
- * @param {Number} n
- * @return {Progress} for chaining
- * @api public
- */
-
-Progress.prototype.size = function(n){
- this._size = n;
- return this;
-};
-
-/**
- * Set text to `str`.
- *
- * @param {String} str
- * @return {Progress} for chaining
- * @api public
- */
-
-Progress.prototype.text = function(str){
- this._text = str;
- return this;
-};
-
-/**
- * Set font size to `n`.
- *
- * @param {Number} n
- * @return {Progress} for chaining
- * @api public
- */
-
-Progress.prototype.fontSize = function(n){
- this._fontSize = n;
- return this;
-};
-
-/**
- * Set font `family`.
- *
- * @param {String} family
- * @return {Progress} for chaining
- */
-
-Progress.prototype.font = function(family){
- this._font = family;
- return this;
-};
-
-/**
- * Update percentage to `n`.
- *
- * @param {Number} n
- * @return {Progress} for chaining
- */
-
-Progress.prototype.update = function(n){
- this.percent = n;
- return this;
-};
-
-/**
- * Draw on `ctx`.
- *
- * @param {CanvasRenderingContext2d} ctx
- * @return {Progress} for chaining
- */
-
-Progress.prototype.draw = function(ctx){
- try {
- var percent = Math.min(this.percent, 100)
- , size = this._size
- , half = size / 2
- , x = half
- , y = half
- , rad = half - 1
- , fontSize = this._fontSize;
-
- ctx.font = fontSize + 'px ' + this._font;
-
- var angle = Math.PI * 2 * (percent / 100);
- ctx.clearRect(0, 0, size, size);
-
- // outer circle
- ctx.strokeStyle = '#9f9f9f';
- ctx.beginPath();
- ctx.arc(x, y, rad, 0, angle, false);
- ctx.stroke();
-
- // inner circle
- ctx.strokeStyle = '#eee';
- ctx.beginPath();
- ctx.arc(x, y, rad - 1, 0, angle, true);
- ctx.stroke();
-
- // text
- var text = this._text || (percent | 0) + '%'
- , w = ctx.measureText(text).width;
-
- ctx.fillText(
- text
- , x - w / 2 + 1
- , y + fontSize / 2 - 1);
- } catch (ex) {} //don't fail if we can't render progress
- return this;
-};
-
-}); // module: browser/progress.js
-
-require.register("browser/tty.js", function(module, exports, require){
-exports.isatty = function(){
- return true;
-};
-
-exports.getWindowSize = function(){
- if ('innerHeight' in global) {
- return [global.innerHeight, global.innerWidth];
- } else {
- // In a Web Worker, the DOM Window is not available.
- return [640, 480];
- }
-};
-
-}); // module: browser/tty.js
-
-require.register("context.js", function(module, exports, require){
-/**
- * Expose `Context`.
- */
-
-module.exports = Context;
-
-/**
- * Initialize a new `Context`.
- *
- * @api private
- */
-
-function Context(){}
-
-/**
- * Set or get the context `Runnable` to `runnable`.
- *
- * @param {Runnable} runnable
- * @return {Context}
- * @api private
- */
-
-Context.prototype.runnable = function(runnable){
- if (0 == arguments.length) return this._runnable;
- this.test = this._runnable = runnable;
- return this;
-};
-
-/**
- * Set test timeout `ms`.
- *
- * @param {Number} ms
- * @return {Context} self
- * @api private
- */
-
-Context.prototype.timeout = function(ms){
- if (arguments.length === 0) return this.runnable().timeout();
- this.runnable().timeout(ms);
- return this;
-};
-
-/**
- * Set test timeout `enabled`.
- *
- * @param {Boolean} enabled
- * @return {Context} self
- * @api private
- */
-
-Context.prototype.enableTimeouts = function (enabled) {
- this.runnable().enableTimeouts(enabled);
- return this;
-};
-
-
-/**
- * Set test slowness threshold `ms`.
- *
- * @param {Number} ms
- * @return {Context} self
- * @api private
- */
-
-Context.prototype.slow = function(ms){
- this.runnable().slow(ms);
- return this;
-};
-
-/**
- * Mark a test as skipped.
- *
- * @return {Context} self
- * @api private
- */
-
-Context.prototype.skip = function(){
- this.runnable().skip();
- return this;
-};
-
-/**
- * Inspect the context void of `._runnable`.
- *
- * @return {String}
- * @api private
- */
-
-Context.prototype.inspect = function(){
- return JSON.stringify(this, function(key, val){
- if ('_runnable' == key) return;
- if ('test' == key) return;
- return val;
- }, 2);
-};
-
-}); // module: context.js
-
-require.register("hook.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Runnable = require('./runnable');
-
-/**
- * Expose `Hook`.
- */
-
-module.exports = Hook;
-
-/**
- * Initialize a new `Hook` with the given `title` and callback `fn`.
- *
- * @param {String} title
- * @param {Function} fn
- * @api private
- */
-
-function Hook(title, fn) {
- Runnable.call(this, title, fn);
- this.type = 'hook';
-}
-
-/**
- * Inherit from `Runnable.prototype`.
- */
-
-function F(){};
-F.prototype = Runnable.prototype;
-Hook.prototype = new F;
-Hook.prototype.constructor = Hook;
-
-
-/**
- * Get or set the test `err`.
- *
- * @param {Error} err
- * @return {Error}
- * @api public
- */
-
-Hook.prototype.error = function(err){
- if (0 == arguments.length) {
- var err = this._error;
- this._error = null;
- return err;
- }
-
- this._error = err;
-};
-
-}); // module: hook.js
-
-require.register("interfaces/bdd.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Suite = require('../suite')
- , Test = require('../test')
- , utils = require('../utils')
- , escapeRe = require('browser/escape-string-regexp');
-
-/**
- * BDD-style interface:
- *
- * describe('Array', function(){
- * describe('#indexOf()', function(){
- * it('should return -1 when not present', function(){
- *
- * });
- *
- * it('should return the index when present', function(){
- *
- * });
- * });
- * });
- *
- */
-
-module.exports = function(suite){
- var suites = [suite];
-
- suite.on('pre-require', function(context, file, mocha){
-
- var common = require('./common')(suites, context);
-
- context.before = common.before;
- context.after = common.after;
- context.beforeEach = common.beforeEach;
- context.afterEach = common.afterEach;
- context.run = mocha.options.delay && common.runWithSuite(suite);
- /**
- * Describe a "suite" with the given `title`
- * and callback `fn` containing nested suites
- * and/or tests.
- */
-
- context.describe = context.context = function(title, fn){
- var suite = Suite.create(suites[0], title);
- suite.file = file;
- suites.unshift(suite);
- fn.call(suite);
- suites.shift();
- return suite;
- };
-
- /**
- * Pending describe.
- */
-
- context.xdescribe =
- context.xcontext =
- context.describe.skip = function(title, fn){
- var suite = Suite.create(suites[0], title);
- suite.pending = true;
- suites.unshift(suite);
- fn.call(suite);
- suites.shift();
- };
-
- /**
- * Exclusive suite.
- */
-
- context.describe.only = function(title, fn){
- var suite = context.describe(title, fn);
- mocha.grep(suite.fullTitle());
- return suite;
- };
-
- /**
- * Describe a specification or test-case
- * with the given `title` and callback `fn`
- * acting as a thunk.
- */
-
- context.it = context.specify = function(title, fn){
- var suite = suites[0];
- if (suite.pending) fn = null;
- var test = new Test(title, fn);
- test.file = file;
- suite.addTest(test);
- return test;
- };
-
- /**
- * Exclusive test-case.
- */
-
- context.it.only = function(title, fn){
- var test = context.it(title, fn);
- var reString = '^' + escapeRe(test.fullTitle()) + '$';
- mocha.grep(new RegExp(reString));
- return test;
- };
-
- /**
- * Pending test case.
- */
-
- context.xit =
- context.xspecify =
- context.it.skip = function(title){
- context.it(title);
- };
-
- });
-};
-
-}); // module: interfaces/bdd.js
-
-require.register("interfaces/common.js", function(module, exports, require){
-/**
- * Functions common to more than one interface
- * @module lib/interfaces/common
- */
-
-'use strict';
-
-module.exports = function (suites, context) {
-
- return {
- /**
- * This is only present if flag --delay is passed into Mocha. It triggers
- * root suite execution. Returns a function which runs the root suite.
- */
- runWithSuite: function runWithSuite(suite) {
- return function run() {
- suite.run();
- };
- },
-
- /**
- * Execute before running tests.
- */
- before: function (name, fn) {
- suites[0].beforeAll(name, fn);
- },
-
- /**
- * Execute after running tests.
- */
- after: function (name, fn) {
- suites[0].afterAll(name, fn);
- },
-
- /**
- * Execute before each test case.
- */
- beforeEach: function (name, fn) {
- suites[0].beforeEach(name, fn);
- },
-
- /**
- * Execute after each test case.
- */
- afterEach: function (name, fn) {
- suites[0].afterEach(name, fn);
- },
-
- test: {
- /**
- * Pending test case.
- */
- skip: function (title) {
- context.test(title);
- }
- }
- }
-};
-
-}); // module: interfaces/common.js
-
-require.register("interfaces/exports.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Suite = require('../suite')
- , Test = require('../test');
-
-/**
- * TDD-style interface:
- *
- * exports.Array = {
- * '#indexOf()': {
- * 'should return -1 when the value is not present': function(){
- *
- * },
- *
- * 'should return the correct index when the value is present': function(){
- *
- * }
- * }
- * };
- *
- */
-
-module.exports = function(suite){
- var suites = [suite];
-
- suite.on('require', visit);
-
- function visit(obj, file) {
- var suite;
- for (var key in obj) {
- if ('function' == typeof obj[key]) {
- var fn = obj[key];
- switch (key) {
- case 'before':
- suites[0].beforeAll(fn);
- break;
- case 'after':
- suites[0].afterAll(fn);
- break;
- case 'beforeEach':
- suites[0].beforeEach(fn);
- break;
- case 'afterEach':
- suites[0].afterEach(fn);
- break;
- default:
- var test = new Test(key, fn);
- test.file = file;
- suites[0].addTest(test);
- }
- } else {
- suite = Suite.create(suites[0], key);
- suites.unshift(suite);
- visit(obj[key]);
- suites.shift();
- }
- }
- }
-};
-
-}); // module: interfaces/exports.js
-
-require.register("interfaces/index.js", function(module, exports, require){
-exports.bdd = require('./bdd');
-exports.tdd = require('./tdd');
-exports.qunit = require('./qunit');
-exports.exports = require('./exports');
-
-}); // module: interfaces/index.js
-
-require.register("interfaces/qunit.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Suite = require('../suite')
- , Test = require('../test')
- , escapeRe = require('browser/escape-string-regexp')
- , utils = require('../utils');
-
-/**
- * QUnit-style interface:
- *
- * suite('Array');
- *
- * test('#length', function(){
- * var arr = [1,2,3];
- * ok(arr.length == 3);
- * });
- *
- * test('#indexOf()', function(){
- * var arr = [1,2,3];
- * ok(arr.indexOf(1) == 0);
- * ok(arr.indexOf(2) == 1);
- * ok(arr.indexOf(3) == 2);
- * });
- *
- * suite('String');
- *
- * test('#length', function(){
- * ok('foo'.length == 3);
- * });
- *
- */
-
-module.exports = function(suite){
- var suites = [suite];
-
- suite.on('pre-require', function(context, file, mocha){
-
- var common = require('./common')(suites, context);
-
- context.before = common.before;
- context.after = common.after;
- context.beforeEach = common.beforeEach;
- context.afterEach = common.afterEach;
- context.run = mocha.options.delay && common.runWithSuite(suite);
- /**
- * Describe a "suite" with the given `title`.
- */
-
- context.suite = function(title){
- if (suites.length > 1) suites.shift();
- var suite = Suite.create(suites[0], title);
- suite.file = file;
- suites.unshift(suite);
- return suite;
- };
-
- /**
- * Exclusive test-case.
- */
-
- context.suite.only = function(title, fn){
- var suite = context.suite(title, fn);
- mocha.grep(suite.fullTitle());
- };
-
- /**
- * Describe a specification or test-case
- * with the given `title` and callback `fn`
- * acting as a thunk.
- */
-
- context.test = function(title, fn){
- var test = new Test(title, fn);
- test.file = file;
- suites[0].addTest(test);
- return test;
- };
-
- /**
- * Exclusive test-case.
- */
-
- context.test.only = function(title, fn){
- var test = context.test(title, fn);
- var reString = '^' + escapeRe(test.fullTitle()) + '$';
- mocha.grep(new RegExp(reString));
- };
-
- context.test.skip = common.test.skip;
-
- });
-};
-
-}); // module: interfaces/qunit.js
-
-require.register("interfaces/tdd.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Suite = require('../suite')
- , Test = require('../test')
- , escapeRe = require('browser/escape-string-regexp')
- , utils = require('../utils');
-
-/**
- * TDD-style interface:
- *
- * suite('Array', function(){
- * suite('#indexOf()', function(){
- * suiteSetup(function(){
- *
- * });
- *
- * test('should return -1 when not present', function(){
- *
- * });
- *
- * test('should return the index when present', function(){
- *
- * });
- *
- * suiteTeardown(function(){
- *
- * });
- * });
- * });
- *
- */
-
-module.exports = function(suite){
- var suites = [suite];
-
- suite.on('pre-require', function(context, file, mocha){
-
- var common = require('./common')(suites, context);
-
- context.setup = common.beforeEach;
- context.teardown = common.afterEach;
- context.suiteSetup = common.before;
- context.suiteTeardown = common.after;
- context.run = mocha.options.delay && common.runWithSuite(suite);
- /**
- * Describe a "suite" with the given `title`
- * and callback `fn` containing nested suites
- * and/or tests.
- */
-
- context.suite = function(title, fn){
- var suite = Suite.create(suites[0], title);
- suite.file = file;
- suites.unshift(suite);
- fn.call(suite);
- suites.shift();
- return suite;
- };
-
- /**
- * Pending suite.
- */
- context.suite.skip = function(title, fn) {
- var suite = Suite.create(suites[0], title);
- suite.pending = true;
- suites.unshift(suite);
- fn.call(suite);
- suites.shift();
- };
-
- /**
- * Exclusive test-case.
- */
-
- context.suite.only = function(title, fn){
- var suite = context.suite(title, fn);
- mocha.grep(suite.fullTitle());
- };
-
- /**
- * Describe a specification or test-case
- * with the given `title` and callback `fn`
- * acting as a thunk.
- */
-
- context.test = function(title, fn){
- var suite = suites[0];
- if (suite.pending) fn = null;
- var test = new Test(title, fn);
- test.file = file;
- suite.addTest(test);
- return test;
- };
-
- /**
- * Exclusive test-case.
- */
-
- context.test.only = function(title, fn){
- var test = context.test(title, fn);
- var reString = '^' + escapeRe(test.fullTitle()) + '$';
- mocha.grep(new RegExp(reString));
- };
-
- context.test.skip = common.test.skip;
- });
-};
-
-}); // module: interfaces/tdd.js
-
-require.register("mocha.js", function(module, exports, require){
-/*!
- * mocha
- * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
- * MIT Licensed
- */
-
-/**
- * Module dependencies.
- */
-
-var path = require('browser/path')
- , escapeRe = require('browser/escape-string-regexp')
- , utils = require('./utils');
-
-/**
- * Expose `Mocha`.
- */
-
-exports = module.exports = Mocha;
-
-/**
- * To require local UIs and reporters when running in node.
- */
-
-if (typeof process !== 'undefined' && typeof process.cwd === 'function') {
- var join = path.join
- , cwd = process.cwd();
- module.paths.push(cwd, join(cwd, 'node_modules'));
-}
-
-/**
- * Expose internals.
- */
-
-exports.utils = utils;
-exports.interfaces = require('./interfaces');
-exports.reporters = require('./reporters');
-exports.Runnable = require('./runnable');
-exports.Context = require('./context');
-exports.Runner = require('./runner');
-exports.Suite = require('./suite');
-exports.Hook = require('./hook');
-exports.Test = require('./test');
-
-/**
- * Return image `name` path.
- *
- * @param {String} name
- * @return {String}
- * @api private
- */
-
-function image(name) {
- return __dirname + '/../images/' + name + '.png';
-}
-
-/**
- * Setup mocha with `options`.
- *
- * Options:
- *
- * - `ui` name "bdd", "tdd", "exports" etc
- * - `reporter` reporter instance, defaults to `mocha.reporters.spec`
- * - `globals` array of accepted globals
- * - `timeout` timeout in milliseconds
- * - `bail` bail on the first test failure
- * - `slow` milliseconds to wait before considering a test slow
- * - `ignoreLeaks` ignore global leaks
- * - `fullTrace` display the full stack-trace on failing
- * - `grep` string or regexp to filter tests with
- *
- * @param {Object} options
- * @api public
- */
-
-function Mocha(options) {
- options = options || {};
- this.files = [];
- this.options = options;
- if (options.grep) this.grep(new RegExp(options.grep));
- if (options.fgrep) this.grep(options.fgrep);
- this.suite = new exports.Suite('', new exports.Context);
- this.ui(options.ui);
- this.bail(options.bail);
- this.reporter(options.reporter, options.reporterOptions);
- if (null != options.timeout) this.timeout(options.timeout);
- this.useColors(options.useColors);
- if (options.enableTimeouts !== null) this.enableTimeouts(options.enableTimeouts);
- if (options.slow) this.slow(options.slow);
-
- this.suite.on('pre-require', function (context) {
- exports.afterEach = context.afterEach || context.teardown;
- exports.after = context.after || context.suiteTeardown;
- exports.beforeEach = context.beforeEach || context.setup;
- exports.before = context.before || context.suiteSetup;
- exports.describe = context.describe || context.suite;
- exports.it = context.it || context.test;
- exports.setup = context.setup || context.beforeEach;
- exports.suiteSetup = context.suiteSetup || context.before;
- exports.suiteTeardown = context.suiteTeardown || context.after;
- exports.suite = context.suite || context.describe;
- exports.teardown = context.teardown || context.afterEach;
- exports.test = context.test || context.it;
- exports.run = context.run;
- });
-}
-
-/**
- * Enable or disable bailing on the first failure.
- *
- * @param {Boolean} [bail]
- * @api public
- */
-
-Mocha.prototype.bail = function(bail){
- if (0 == arguments.length) bail = true;
- this.suite.bail(bail);
- return this;
-};
-
-/**
- * Add test `file`.
- *
- * @param {String} file
- * @api public
- */
-
-Mocha.prototype.addFile = function(file){
- this.files.push(file);
- return this;
-};
-
-/**
- * Set reporter to `reporter`, defaults to "spec".
- *
- * @param {String|Function} reporter name or constructor
- * @param {Object} reporterOptions optional options
- * @api public
- */
-Mocha.prototype.reporter = function(reporter, reporterOptions){
- if ('function' == typeof reporter) {
- this._reporter = reporter;
- } else {
- reporter = reporter || 'spec';
- var _reporter;
- try { _reporter = require('./reporters/' + reporter); } catch (err) {}
- if (!_reporter) try { _reporter = require(reporter); } catch (err) {}
- if (!_reporter && reporter === 'teamcity')
- console.warn('The Teamcity reporter was moved to a package named ' +
- 'mocha-teamcity-reporter ' +
- '(https://npmjs.org/package/mocha-teamcity-reporter).');
- if (!_reporter) throw new Error('invalid reporter "' + reporter + '"');
- this._reporter = _reporter;
- }
- this.options.reporterOptions = reporterOptions;
- return this;
-};
-
-/**
- * Set test UI `name`, defaults to "bdd".
- *
- * @param {String} bdd
- * @api public
- */
-
-Mocha.prototype.ui = function(name){
- name = name || 'bdd';
- this._ui = exports.interfaces[name];
- if (!this._ui) try { this._ui = require(name); } catch (err) {}
- if (!this._ui) throw new Error('invalid interface "' + name + '"');
- this._ui = this._ui(this.suite);
- return this;
-};
-
-/**
- * Load registered files.
- *
- * @api private
- */
-
-Mocha.prototype.loadFiles = function(fn){
- var self = this;
- var suite = this.suite;
- var pending = this.files.length;
- this.files.forEach(function(file){
- file = path.resolve(file);
- suite.emit('pre-require', global, file, self);
- suite.emit('require', require(file), file, self);
- suite.emit('post-require', global, file, self);
- --pending || (fn && fn());
- });
-};
-
-/**
- * Enable growl support.
- *
- * @api private
- */
-
-Mocha.prototype._growl = function(runner, reporter) {
- var notify = require('growl');
-
- runner.on('end', function(){
- var stats = reporter.stats;
- if (stats.failures) {
- var msg = stats.failures + ' of ' + runner.total + ' tests failed';
- notify(msg, { name: 'mocha', title: 'Failed', image: image('error') });
- } else {
- notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', {
- name: 'mocha'
- , title: 'Passed'
- , image: image('ok')
- });
- }
- });
-};
-
-/**
- * Add regexp to grep, if `re` is a string it is escaped.
- *
- * @param {RegExp|String} re
- * @return {Mocha}
- * @api public
- */
-
-Mocha.prototype.grep = function(re){
- this.options.grep = 'string' == typeof re
- ? new RegExp(escapeRe(re))
- : re;
- return this;
-};
-
-/**
- * Invert `.grep()` matches.
- *
- * @return {Mocha}
- * @api public
- */
-
-Mocha.prototype.invert = function(){
- this.options.invert = true;
- return this;
-};
-
-/**
- * Ignore global leaks.
- *
- * @param {Boolean} ignore
- * @return {Mocha}
- * @api public
- */
-
-Mocha.prototype.ignoreLeaks = function(ignore){
- this.options.ignoreLeaks = !!ignore;
- return this;
-};
-
-/**
- * Enable global leak checking.
- *
- * @return {Mocha}
- * @api public
- */
-
-Mocha.prototype.checkLeaks = function(){
- this.options.ignoreLeaks = false;
- return this;
-};
-
-/**
- * Display long stack-trace on failing
- *
- * @return {Mocha}
- * @api public
- */
-
-Mocha.prototype.fullTrace = function() {
- this.options.fullStackTrace = true;
- return this;
-};
-
-/**
- * Enable growl support.
- *
- * @return {Mocha}
- * @api public
- */
-
-Mocha.prototype.growl = function(){
- this.options.growl = true;
- return this;
-};
-
-/**
- * Ignore `globals` array or string.
- *
- * @param {Array|String} globals
- * @return {Mocha}
- * @api public
- */
-
-Mocha.prototype.globals = function(globals){
- this.options.globals = (this.options.globals || []).concat(globals);
- return this;
-};
-
-/**
- * Emit color output.
- *
- * @param {Boolean} colors
- * @return {Mocha}
- * @api public
- */
-
-Mocha.prototype.useColors = function(colors){
- if (colors !== undefined) {
- this.options.useColors = colors;
- }
- return this;
-};
-
-/**
- * Use inline diffs rather than +/-.
- *
- * @param {Boolean} inlineDiffs
- * @return {Mocha}
- * @api public
- */
-
-Mocha.prototype.useInlineDiffs = function(inlineDiffs) {
- this.options.useInlineDiffs = arguments.length && inlineDiffs != undefined
- ? inlineDiffs
- : false;
- return this;
-};
-
-/**
- * Set the timeout in milliseconds.
- *
- * @param {Number} timeout
- * @return {Mocha}
- * @api public
- */
-
-Mocha.prototype.timeout = function(timeout){
- this.suite.timeout(timeout);
- return this;
-};
-
-/**
- * Set slowness threshold in milliseconds.
- *
- * @param {Number} slow
- * @return {Mocha}
- * @api public
- */
-
-Mocha.prototype.slow = function(slow){
- this.suite.slow(slow);
- return this;
-};
-
-/**
- * Enable timeouts.
- *
- * @param {Boolean} enabled
- * @return {Mocha}
- * @api public
- */
-
-Mocha.prototype.enableTimeouts = function(enabled) {
- this.suite.enableTimeouts(arguments.length && enabled !== undefined
- ? enabled
- : true);
- return this
-};
-
-/**
- * Makes all tests async (accepting a callback)
- *
- * @return {Mocha}
- * @api public
- */
-
-Mocha.prototype.asyncOnly = function(){
- this.options.asyncOnly = true;
- return this;
-};
-
-/**
- * Disable syntax highlighting (in browser).
- * @returns {Mocha}
- * @api public
- */
-Mocha.prototype.noHighlighting = function() {
- this.options.noHighlighting = true;
- return this;
-};
-
-/**
- * Delay root suite execution.
- * @returns {Mocha}
- * @api public
- */
-Mocha.prototype.delay = function delay() {
- this.options.delay = true;
- return this;
-};
-
-/**
- * Run tests and invoke `fn()` when complete.
- *
- * @param {Function} fn
- * @return {Runner}
- * @api public
- */
-Mocha.prototype.run = function(fn){
- if (this.files.length) this.loadFiles();
- var suite = this.suite;
- var options = this.options;
- options.files = this.files;
- var runner = new exports.Runner(suite, options.delay);
- var reporter = new this._reporter(runner, options);
- runner.ignoreLeaks = false !== options.ignoreLeaks;
- runner.fullStackTrace = options.fullStackTrace;
- runner.asyncOnly = options.asyncOnly;
- if (options.grep) runner.grep(options.grep, options.invert);
- if (options.globals) runner.globals(options.globals);
- if (options.growl) this._growl(runner, reporter);
- if (options.useColors !== undefined) {
- exports.reporters.Base.useColors = options.useColors;
- }
- exports.reporters.Base.inlineDiffs = options.useInlineDiffs;
-
- function done(failures) {
- if (reporter.done) {
- reporter.done(failures, fn);
- } else fn && fn(failures);
- }
-
- return runner.run(done);
-};
-
-}); // module: mocha.js
-
-require.register("ms.js", function(module, exports, require){
-/**
- * Helpers.
- */
-
-var s = 1000;
-var m = s * 60;
-var h = m * 60;
-var d = h * 24;
-var y = d * 365.25;
-
-/**
- * Parse or format the given `val`.
- *
- * Options:
- *
- * - `long` verbose formatting [false]
- *
- * @param {String|Number} val
- * @param {Object} options
- * @return {String|Number}
- * @api public
- */
-
-module.exports = function(val, options){
- options = options || {};
- if ('string' == typeof val) return parse(val);
- return options['long'] ? longFormat(val) : shortFormat(val);
-};
-
-/**
- * Parse the given `str` and return milliseconds.
- *
- * @param {String} str
- * @return {Number}
- * @api private
- */
-
-function parse(str) {
- var match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str);
- if (!match) return;
- var n = parseFloat(match[1]);
- var type = (match[2] || 'ms').toLowerCase();
- switch (type) {
- case 'years':
- case 'year':
- case 'y':
- return n * y;
- case 'days':
- case 'day':
- case 'd':
- return n * d;
- case 'hours':
- case 'hour':
- case 'h':
- return n * h;
- case 'minutes':
- case 'minute':
- case 'm':
- return n * m;
- case 'seconds':
- case 'second':
- case 's':
- return n * s;
- case 'ms':
- return n;
- }
-}
-
-/**
- * Short format for `ms`.
- *
- * @param {Number} ms
- * @return {String}
- * @api private
- */
-
-function shortFormat(ms) {
- if (ms >= d) return Math.round(ms / d) + 'd';
- if (ms >= h) return Math.round(ms / h) + 'h';
- if (ms >= m) return Math.round(ms / m) + 'm';
- if (ms >= s) return Math.round(ms / s) + 's';
- return ms + 'ms';
-}
-
-/**
- * Long format for `ms`.
- *
- * @param {Number} ms
- * @return {String}
- * @api private
- */
-
-function longFormat(ms) {
- return plural(ms, d, 'day')
- || plural(ms, h, 'hour')
- || plural(ms, m, 'minute')
- || plural(ms, s, 'second')
- || ms + ' ms';
-}
-
-/**
- * Pluralization helper.
- */
-
-function plural(ms, n, name) {
- if (ms < n) return;
- if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;
- return Math.ceil(ms / n) + ' ' + name + 's';
-}
-
-}); // module: ms.js
-
-require.register("pending.js", function(module, exports, require){
-
-/**
- * Expose `Pending`.
- */
-
-module.exports = Pending;
-
-/**
- * Initialize a new `Pending` error with the given message.
- *
- * @param {String} message
- */
-
-function Pending(message) {
- this.message = message;
-}
-
-}); // module: pending.js
-
-require.register("reporters/base.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var tty = require('browser/tty')
- , diff = require('browser/diff')
- , ms = require('../ms')
- , utils = require('../utils')
- , supportsColor = process.env ? require('supports-color') : null;
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-var Date = global.Date
- , setTimeout = global.setTimeout
- , setInterval = global.setInterval
- , clearTimeout = global.clearTimeout
- , clearInterval = global.clearInterval;
-
-/**
- * Check if both stdio streams are associated with a tty.
- */
-
-var isatty = tty.isatty(1) && tty.isatty(2);
-
-/**
- * Expose `Base`.
- */
-
-exports = module.exports = Base;
-
-/**
- * Enable coloring by default, except in the browser interface.
- */
-
-exports.useColors = process.env
- ? (supportsColor || (process.env.MOCHA_COLORS !== undefined))
- : false;
-
-/**
- * Inline diffs instead of +/-
- */
-
-exports.inlineDiffs = false;
-
-/**
- * Default color map.
- */
-
-exports.colors = {
- 'pass': 90
- , 'fail': 31
- , 'bright pass': 92
- , 'bright fail': 91
- , 'bright yellow': 93
- , 'pending': 36
- , 'suite': 0
- , 'error title': 0
- , 'error message': 31
- , 'error stack': 90
- , 'checkmark': 32
- , 'fast': 90
- , 'medium': 33
- , 'slow': 31
- , 'green': 32
- , 'light': 90
- , 'diff gutter': 90
- , 'diff added': 42
- , 'diff removed': 41
-};
-
-/**
- * Default symbol map.
- */
-
-exports.symbols = {
- ok: '✓',
- err: '✖',
- dot: '․'
-};
-
-// With node.js on Windows: use symbols available in terminal default fonts
-if ('win32' == process.platform) {
- exports.symbols.ok = '\u221A';
- exports.symbols.err = '\u00D7';
- exports.symbols.dot = '.';
-}
-
-/**
- * Color `str` with the given `type`,
- * allowing colors to be disabled,
- * as well as user-defined color
- * schemes.
- *
- * @param {String} type
- * @param {String} str
- * @return {String}
- * @api private
- */
-
-var color = exports.color = function(type, str) {
- if (!exports.useColors) return String(str);
- return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m';
-};
-
-/**
- * Expose term window size, with some
- * defaults for when stderr is not a tty.
- */
-
-exports.window = {
- width: isatty
- ? process.stdout.getWindowSize
- ? process.stdout.getWindowSize(1)[0]
- : tty.getWindowSize()[1]
- : 75
-};
-
-/**
- * Expose some basic cursor interactions
- * that are common among reporters.
- */
-
-exports.cursor = {
- hide: function(){
- isatty && process.stdout.write('\u001b[?25l');
- },
-
- show: function(){
- isatty && process.stdout.write('\u001b[?25h');
- },
-
- deleteLine: function(){
- isatty && process.stdout.write('\u001b[2K');
- },
-
- beginningOfLine: function(){
- isatty && process.stdout.write('\u001b[0G');
- },
-
- CR: function(){
- if (isatty) {
- exports.cursor.deleteLine();
- exports.cursor.beginningOfLine();
- } else {
- process.stdout.write('\r');
- }
- }
-};
-
-/**
- * Outut the given `failures` as a list.
- *
- * @param {Array} failures
- * @api public
- */
-
-exports.list = function(failures){
- console.log();
- failures.forEach(function(test, i){
- // format
- var fmt = color('error title', ' %s) %s:\n')
- + color('error message', ' %s')
- + color('error stack', '\n%s\n');
-
- // msg
- var err = test.err
- , message = err.message || ''
- , stack = err.stack || message
- , index = stack.indexOf(message) + message.length
- , msg = stack.slice(0, index)
- , actual = err.actual
- , expected = err.expected
- , escape = true;
-
- // uncaught
- if (err.uncaught) {
- msg = 'Uncaught ' + msg;
- }
- // explicitly show diff
- if (err.showDiff && sameType(actual, expected)) {
-
- if ('string' !== typeof actual) {
- escape = false;
- err.actual = actual = utils.stringify(actual);
- err.expected = expected = utils.stringify(expected);
- }
-
- fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n');
- var match = message.match(/^([^:]+): expected/);
- msg = '\n ' + color('error message', match ? match[1] : msg);
-
- if (exports.inlineDiffs) {
- msg += inlineDiff(err, escape);
- } else {
- msg += unifiedDiff(err, escape);
- }
- }
-
- // indent stack trace without msg
- stack = stack.slice(index ? index + 1 : index)
- .replace(/^/gm, ' ');
-
- console.log(fmt, (i + 1), test.fullTitle(), msg, stack);
- });
-};
-
-/**
- * Initialize a new `Base` reporter.
- *
- * All other reporters generally
- * inherit from this reporter, providing
- * stats such as test duration, number
- * of tests passed / failed etc.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Base(runner) {
- var self = this
- , stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 }
- , failures = this.failures = [];
-
- if (!runner) return;
- this.runner = runner;
-
- runner.stats = stats;
-
- runner.on('start', function(){
- stats.start = new Date;
- });
-
- runner.on('suite', function(suite){
- stats.suites = stats.suites || 0;
- suite.root || stats.suites++;
- });
-
- runner.on('test end', function(test){
- stats.tests = stats.tests || 0;
- stats.tests++;
- });
-
- runner.on('pass', function(test){
- stats.passes = stats.passes || 0;
-
- var medium = test.slow() / 2;
- test.speed = test.duration > test.slow()
- ? 'slow'
- : test.duration > medium
- ? 'medium'
- : 'fast';
-
- stats.passes++;
- });
-
- runner.on('fail', function(test, err){
- stats.failures = stats.failures || 0;
- stats.failures++;
- test.err = err;
- failures.push(test);
- });
-
- runner.on('end', function(){
- stats.end = new Date;
- stats.duration = new Date - stats.start;
- });
-
- runner.on('pending', function(){
- stats.pending++;
- });
-}
-
-/**
- * Output common epilogue used by many of
- * the bundled reporters.
- *
- * @api public
- */
-
-Base.prototype.epilogue = function(){
- var stats = this.stats;
- var tests;
- var fmt;
-
- console.log();
-
- // passes
- fmt = color('bright pass', ' ')
- + color('green', ' %d passing')
- + color('light', ' (%s)');
-
- console.log(fmt,
- stats.passes || 0,
- ms(stats.duration));
-
- // pending
- if (stats.pending) {
- fmt = color('pending', ' ')
- + color('pending', ' %d pending');
-
- console.log(fmt, stats.pending);
- }
-
- // failures
- if (stats.failures) {
- fmt = color('fail', ' %d failing');
-
- console.log(fmt, stats.failures);
-
- Base.list(this.failures);
- console.log();
- }
-
- console.log();
-};
-
-/**
- * Pad the given `str` to `len`.
- *
- * @param {String} str
- * @param {String} len
- * @return {String}
- * @api private
- */
-
-function pad(str, len) {
- str = String(str);
- return Array(len - str.length + 1).join(' ') + str;
-}
-
-
-/**
- * Returns an inline diff between 2 strings with coloured ANSI output
- *
- * @param {Error} Error with actual/expected
- * @return {String} Diff
- * @api private
- */
-
-function inlineDiff(err, escape) {
- var msg = errorDiff(err, 'WordsWithSpace', escape);
-
- // linenos
- var lines = msg.split('\n');
- if (lines.length > 4) {
- var width = String(lines.length).length;
- msg = lines.map(function(str, i){
- return pad(++i, width) + ' |' + ' ' + str;
- }).join('\n');
- }
-
- // legend
- msg = '\n'
- + color('diff removed', 'actual')
- + ' '
- + color('diff added', 'expected')
- + '\n\n'
- + msg
- + '\n';
-
- // indent
- msg = msg.replace(/^/gm, ' ');
- return msg;
-}
-
-/**
- * Returns a unified diff between 2 strings
- *
- * @param {Error} Error with actual/expected
- * @return {String} Diff
- * @api private
- */
-
-function unifiedDiff(err, escape) {
- var indent = ' ';
- function cleanUp(line) {
- if (escape) {
- line = escapeInvisibles(line);
- }
- if (line[0] === '+') return indent + colorLines('diff added', line);
- if (line[0] === '-') return indent + colorLines('diff removed', line);
- if (line.match(/\@\@/)) return null;
- if (line.match(/\\ No newline/)) return null;
- else return indent + line;
- }
- function notBlank(line) {
- return line != null;
- }
- var msg = diff.createPatch('string', err.actual, err.expected);
- var lines = msg.split('\n').splice(4);
- return '\n '
- + colorLines('diff added', '+ expected') + ' '
- + colorLines('diff removed', '- actual')
- + '\n\n'
- + lines.map(cleanUp).filter(notBlank).join('\n');
-}
-
-/**
- * Return a character diff for `err`.
- *
- * @param {Error} err
- * @return {String}
- * @api private
- */
-
-function errorDiff(err, type, escape) {
- var actual = escape ? escapeInvisibles(err.actual) : err.actual;
- var expected = escape ? escapeInvisibles(err.expected) : err.expected;
- return diff['diff' + type](actual, expected).map(function(str){
- if (str.added) return colorLines('diff added', str.value);
- if (str.removed) return colorLines('diff removed', str.value);
- return str.value;
- }).join('');
-}
-
-/**
- * Returns a string with all invisible characters in plain text
- *
- * @param {String} line
- * @return {String}
- * @api private
- */
-function escapeInvisibles(line) {
- return line.replace(/\t/g, '<tab>')
- .replace(/\r/g, '<CR>')
- .replace(/\n/g, '<LF>\n');
-}
-
-/**
- * Color lines for `str`, using the color `name`.
- *
- * @param {String} name
- * @param {String} str
- * @return {String}
- * @api private
- */
-
-function colorLines(name, str) {
- return str.split('\n').map(function(str){
- return color(name, str);
- }).join('\n');
-}
-
-/**
- * Check that a / b have the same type.
- *
- * @param {Object} a
- * @param {Object} b
- * @return {Boolean}
- * @api private
- */
-
-function sameType(a, b) {
- a = Object.prototype.toString.call(a);
- b = Object.prototype.toString.call(b);
- return a == b;
-}
-
-}); // module: reporters/base.js
-
-require.register("reporters/doc.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , utils = require('../utils');
-
-/**
- * Expose `Doc`.
- */
-
-exports = module.exports = Doc;
-
-/**
- * Initialize a new `Doc` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Doc(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , total = runner.total
- , indents = 2;
-
- function indent() {
- return Array(indents).join(' ');
- }
-
- runner.on('suite', function(suite){
- if (suite.root) return;
- ++indents;
- console.log('%s<section class="suite">', indent());
- ++indents;
- console.log('%s<h1>%s</h1>', indent(), utils.escape(suite.title));
- console.log('%s<dl>', indent());
- });
-
- runner.on('suite end', function(suite){
- if (suite.root) return;
- console.log('%s</dl>', indent());
- --indents;
- console.log('%s</section>', indent());
- --indents;
- });
-
- runner.on('pass', function(test){
- console.log('%s <dt>%s</dt>', indent(), utils.escape(test.title));
- var code = utils.escape(utils.clean(test.fn.toString()));
- console.log('%s <dd><pre><code>%s</code></pre></dd>', indent(), code);
- });
-
- runner.on('fail', function(test, err){
- console.log('%s <dt class="error">%s</dt>', indent(), utils.escape(test.title));
- var code = utils.escape(utils.clean(test.fn.toString()));
- console.log('%s <dd class="error"><pre><code>%s</code></pre></dd>', indent(), code);
- console.log('%s <dd class="error">%s</dd>', indent(), utils.escape(err));
- });
-}
-
-}); // module: reporters/doc.js
-
-require.register("reporters/dot.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , color = Base.color;
-
-/**
- * Expose `Dot`.
- */
-
-exports = module.exports = Dot;
-
-/**
- * Initialize a new `Dot` matrix test reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Dot(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , width = Base.window.width * .75 | 0
- , n = -1;
-
- runner.on('start', function(){
- process.stdout.write('\n ');
- });
-
- runner.on('pending', function(test){
- if (++n % width == 0) process.stdout.write('\n ');
- process.stdout.write(color('pending', Base.symbols.dot));
- });
-
- runner.on('pass', function(test){
- if (++n % width == 0) process.stdout.write('\n ');
- if ('slow' == test.speed) {
- process.stdout.write(color('bright yellow', Base.symbols.dot));
- } else {
- process.stdout.write(color(test.speed, Base.symbols.dot));
- }
- });
-
- runner.on('fail', function(test, err){
- if (++n % width == 0) process.stdout.write('\n ');
- process.stdout.write(color('fail', Base.symbols.dot));
- });
-
- runner.on('end', function(){
- console.log();
- self.epilogue();
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-
-function F(){};
-F.prototype = Base.prototype;
-Dot.prototype = new F;
-Dot.prototype.constructor = Dot;
-
-
-}); // module: reporters/dot.js
-
-require.register("reporters/html-cov.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var JSONCov = require('./json-cov')
- , fs = require('browser/fs');
-
-/**
- * Expose `HTMLCov`.
- */
-
-exports = module.exports = HTMLCov;
-
-/**
- * Initialize a new `JsCoverage` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function HTMLCov(runner) {
- var jade = require('jade')
- , file = __dirname + '/templates/coverage.jade'
- , str = fs.readFileSync(file, 'utf8')
- , fn = jade.compile(str, { filename: file })
- , self = this;
-
- JSONCov.call(this, runner, false);
-
- runner.on('end', function(){
- process.stdout.write(fn({
- cov: self.cov
- , coverageClass: coverageClass
- }));
- });
-}
-
-/**
- * Return coverage class for `n`.
- *
- * @return {String}
- * @api private
- */
-
-function coverageClass(n) {
- if (n >= 75) return 'high';
- if (n >= 50) return 'medium';
- if (n >= 25) return 'low';
- return 'terrible';
-}
-
-}); // module: reporters/html-cov.js
-
-require.register("reporters/html.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , utils = require('../utils')
- , Progress = require('../browser/progress')
- , escape = utils.escape;
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-var Date = global.Date
- , setTimeout = global.setTimeout
- , setInterval = global.setInterval
- , clearTimeout = global.clearTimeout
- , clearInterval = global.clearInterval;
-
-/**
- * Expose `HTML`.
- */
-
-exports = module.exports = HTML;
-
-/**
- * Stats template.
- */
-
-var statsTemplate = '<ul id="mocha-stats">'
- + '<li class="progress"><canvas width="40" height="40"></canvas></li>'
- + '<li class="passes"><a href="#">passes:</a> <em>0</em></li>'
- + '<li class="failures"><a href="#">failures:</a> <em>0</em></li>'
- + '<li class="duration">duration: <em>0</em>s</li>'
- + '</ul>';
-
-/**
- * Initialize a new `HTML` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function HTML(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , total = runner.total
- , stat = fragment(statsTemplate)
- , items = stat.getElementsByTagName('li')
- , passes = items[1].getElementsByTagName('em')[0]
- , passesLink = items[1].getElementsByTagName('a')[0]
- , failures = items[2].getElementsByTagName('em')[0]
- , failuresLink = items[2].getElementsByTagName('a')[0]
- , duration = items[3].getElementsByTagName('em')[0]
- , canvas = stat.getElementsByTagName('canvas')[0]
- , report = fragment('<ul id="mocha-report"></ul>')
- , stack = [report]
- , progress
- , ctx
- , root = document.getElementById('mocha');
-
- if (canvas.getContext) {
- var ratio = window.devicePixelRatio || 1;
- canvas.style.width = canvas.width;
- canvas.style.height = canvas.height;
- canvas.width *= ratio;
- canvas.height *= ratio;
- ctx = canvas.getContext('2d');
- ctx.scale(ratio, ratio);
- progress = new Progress;
- }
-
- if (!root) return error('#mocha div missing, add it to your document');
-
- // pass toggle
- on(passesLink, 'click', function(){
- unhide();
- var name = /pass/.test(report.className) ? '' : ' pass';
- report.className = report.className.replace(/fail|pass/g, '') + name;
- if (report.className.trim()) hideSuitesWithout('test pass');
- });
-
- // failure toggle
- on(failuresLink, 'click', function(){
- unhide();
- var name = /fail/.test(report.className) ? '' : ' fail';
- report.className = report.className.replace(/fail|pass/g, '') + name;
- if (report.className.trim()) hideSuitesWithout('test fail');
- });
-
- root.appendChild(stat);
- root.appendChild(report);
-
- if (progress) progress.size(40);
-
- runner.on('suite', function(suite){
- if (suite.root) return;
-
- // suite
- var url = self.suiteURL(suite);
- var el = fragment('<li class="suite"><h1><a href="%s">%s</a></h1></li>', url, escape(suite.title));
-
- // container
- stack[0].appendChild(el);
- stack.unshift(document.createElement('ul'));
- el.appendChild(stack[0]);
- });
-
- runner.on('suite end', function(suite){
- if (suite.root) return;
- stack.shift();
- });
-
- runner.on('fail', function(test, err){
- if ('hook' == test.type) runner.emit('test end', test);
- });
-
- runner.on('test end', function(test){
- // TODO: add to stats
- var percent = stats.tests / this.total * 100 | 0;
- if (progress) progress.update(percent).draw(ctx);
-
- // update stats
- var ms = new Date - stats.start;
- text(passes, stats.passes);
- text(failures, stats.failures);
- text(duration, (ms / 1000).toFixed(2));
-
- // test
- if ('passed' == test.state) {
- var url = self.testURL(test);
- var el = fragment('<li class="test pass %e"><h2>%e<span class="duration">%ems</span> <a href="%s" class="replay">‣</a></h2></li>', test.speed, test.title, test.duration, url);
- } else if (test.pending) {
- var el = fragment('<li class="test pass pending"><h2>%e</h2></li>', test.title);
- } else {
- var el = fragment('<li class="test fail"><h2>%e <a href="%e" class="replay">‣</a></h2></li>', test.title, self.testURL(test));
- var str = test.err.stack || test.err.toString();
-
- // FF / Opera do not add the message
- if (!~str.indexOf(test.err.message)) {
- str = test.err.message + '\n' + str;
- }
-
- // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we
- // check for the result of the stringifying.
- if ('[object Error]' == str) str = test.err.message;
-
- // Safari doesn't give you a stack. Let's at least provide a source line.
- if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) {
- str += "\n(" + test.err.sourceURL + ":" + test.err.line + ")";
- }
-
- el.appendChild(fragment('<pre class="error">%e</pre>', str));
- }
-
- // toggle code
- // TODO: defer
- if (!test.pending) {
- var h2 = el.getElementsByTagName('h2')[0];
-
- on(h2, 'click', function(){
- pre.style.display = 'none' == pre.style.display
- ? 'block'
- : 'none';
- });
-
- var pre = fragment('<pre><code>%e</code></pre>', utils.clean(test.fn.toString()));
- el.appendChild(pre);
- pre.style.display = 'none';
- }
-
- // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack.
- if (stack[0]) stack[0].appendChild(el);
- });
-}
-
-/**
- * Makes a URL, preserving querystring ("search") parameters.
- * @param {string} s
- * @returns {string} your new URL
- */
-var makeUrl = function makeUrl(s) {
- var search = window.location.search;
-
- // Remove previous grep query parameter if present
- if (search) {
- search = search.replace(/[?&]grep=[^&\s]*/g, '').replace(/^&/, '?');
- }
-
- return window.location.pathname + (search ? search + '&' : '?' ) + 'grep=' + encodeURIComponent(s);
-};
-
-/**
- * Provide suite URL
- *
- * @param {Object} [suite]
- */
-HTML.prototype.suiteURL = function(suite){
- return makeUrl(suite.fullTitle());
-};
-
-/**
- * Provide test URL
- *
- * @param {Object} [test]
- */
-
-HTML.prototype.testURL = function(test){
- return makeUrl(test.fullTitle());
-};
-
-/**
- * Display error `msg`.
- */
-
-function error(msg) {
- document.body.appendChild(fragment('<div id="mocha-error">%s</div>', msg));
-}
-
-/**
- * Return a DOM fragment from `html`.
- */
-
-function fragment(html) {
- var args = arguments
- , div = document.createElement('div')
- , i = 1;
-
- div.innerHTML = html.replace(/%([se])/g, function(_, type){
- switch (type) {
- case 's': return String(args[i++]);
- case 'e': return escape(args[i++]);
- }
- });
-
- return div.firstChild;
-}
-
-/**
- * Check for suites that do not have elements
- * with `classname`, and hide them.
- */
-
-function hideSuitesWithout(classname) {
- var suites = document.getElementsByClassName('suite');
- for (var i = 0; i < suites.length; i++) {
- var els = suites[i].getElementsByClassName(classname);
- if (0 == els.length) suites[i].className += ' hidden';
- }
-}
-
-/**
- * Unhide .hidden suites.
- */
-
-function unhide() {
- var els = document.getElementsByClassName('suite hidden');
- for (var i = 0; i < els.length; ++i) {
- els[i].className = els[i].className.replace('suite hidden', 'suite');
- }
-}
-
-/**
- * Set `el` text to `str`.
- */
-
-function text(el, str) {
- if (el.textContent) {
- el.textContent = str;
- } else {
- el.innerText = str;
- }
-}
-
-/**
- * Listen on `event` with callback `fn`.
- */
-
-function on(el, event, fn) {
- if (el.addEventListener) {
- el.addEventListener(event, fn, false);
- } else {
- el.attachEvent('on' + event, fn);
- }
-}
-
-}); // module: reporters/html.js
-
-require.register("reporters/index.js", function(module, exports, require){
-exports.Base = require('./base');
-exports.Dot = require('./dot');
-exports.Doc = require('./doc');
-exports.TAP = require('./tap');
-exports.JSON = require('./json');
-exports.HTML = require('./html');
-exports.List = require('./list');
-exports.Min = require('./min');
-exports.Spec = require('./spec');
-exports.Nyan = require('./nyan');
-exports.XUnit = require('./xunit');
-exports.Markdown = require('./markdown');
-exports.Progress = require('./progress');
-exports.Landing = require('./landing');
-exports.JSONCov = require('./json-cov');
-exports.HTMLCov = require('./html-cov');
-exports.JSONStream = require('./json-stream');
-
-}); // module: reporters/index.js
-
-require.register("reporters/json-cov.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-
-/**
- * Expose `JSONCov`.
- */
-
-exports = module.exports = JSONCov;
-
-/**
- * Initialize a new `JsCoverage` reporter.
- *
- * @param {Runner} runner
- * @param {Boolean} output
- * @api public
- */
-
-function JSONCov(runner, output) {
- var self = this
- , output = 1 == arguments.length ? true : output;
-
- Base.call(this, runner);
-
- var tests = []
- , failures = []
- , passes = [];
-
- runner.on('test end', function(test){
- tests.push(test);
- });
-
- runner.on('pass', function(test){
- passes.push(test);
- });
-
- runner.on('fail', function(test){
- failures.push(test);
- });
-
- runner.on('end', function(){
- var cov = global._$jscoverage || {};
- var result = self.cov = map(cov);
- result.stats = self.stats;
- result.tests = tests.map(clean);
- result.failures = failures.map(clean);
- result.passes = passes.map(clean);
- if (!output) return;
- process.stdout.write(JSON.stringify(result, null, 2 ));
- });
-}
-
-/**
- * Map jscoverage data to a JSON structure
- * suitable for reporting.
- *
- * @param {Object} cov
- * @return {Object}
- * @api private
- */
-
-function map(cov) {
- var ret = {
- instrumentation: 'node-jscoverage'
- , sloc: 0
- , hits: 0
- , misses: 0
- , coverage: 0
- , files: []
- };
-
- for (var filename in cov) {
- var data = coverage(filename, cov[filename]);
- ret.files.push(data);
- ret.hits += data.hits;
- ret.misses += data.misses;
- ret.sloc += data.sloc;
- }
-
- ret.files.sort(function(a, b) {
- return a.filename.localeCompare(b.filename);
- });
-
- if (ret.sloc > 0) {
- ret.coverage = (ret.hits / ret.sloc) * 100;
- }
-
- return ret;
-}
-
-/**
- * Map jscoverage data for a single source file
- * to a JSON structure suitable for reporting.
- *
- * @param {String} filename name of the source file
- * @param {Object} data jscoverage coverage data
- * @return {Object}
- * @api private
- */
-
-function coverage(filename, data) {
- var ret = {
- filename: filename,
- coverage: 0,
- hits: 0,
- misses: 0,
- sloc: 0,
- source: {}
- };
-
- data.source.forEach(function(line, num){
- num++;
-
- if (data[num] === 0) {
- ret.misses++;
- ret.sloc++;
- } else if (data[num] !== undefined) {
- ret.hits++;
- ret.sloc++;
- }
-
- ret.source[num] = {
- source: line
- , coverage: data[num] === undefined
- ? ''
- : data[num]
- };
- });
-
- ret.coverage = ret.hits / ret.sloc * 100;
-
- return ret;
-}
-
-/**
- * Return a plain-object representation of `test`
- * free of cyclic properties etc.
- *
- * @param {Object} test
- * @return {Object}
- * @api private
- */
-
-function clean(test) {
- return {
- title: test.title
- , fullTitle: test.fullTitle()
- , duration: test.duration
- }
-}
-
-}); // module: reporters/json-cov.js
-
-require.register("reporters/json-stream.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , color = Base.color;
-
-/**
- * Expose `List`.
- */
-
-exports = module.exports = List;
-
-/**
- * Initialize a new `List` test reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function List(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , total = runner.total;
-
- runner.on('start', function(){
- console.log(JSON.stringify(['start', { total: total }]));
- });
-
- runner.on('pass', function(test){
- console.log(JSON.stringify(['pass', clean(test)]));
- });
-
- runner.on('fail', function(test, err){
- test = clean(test);
- test.err = err.message;
- console.log(JSON.stringify(['fail', test]));
- });
-
- runner.on('end', function(){
- process.stdout.write(JSON.stringify(['end', self.stats]));
- });
-}
-
-/**
- * Return a plain-object representation of `test`
- * free of cyclic properties etc.
- *
- * @param {Object} test
- * @return {Object}
- * @api private
- */
-
-function clean(test) {
- return {
- title: test.title
- , fullTitle: test.fullTitle()
- , duration: test.duration
- }
-}
-
-}); // module: reporters/json-stream.js
-
-require.register("reporters/json.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , cursor = Base.cursor
- , color = Base.color;
-
-/**
- * Expose `JSON`.
- */
-
-exports = module.exports = JSONReporter;
-
-/**
- * Initialize a new `JSON` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function JSONReporter(runner) {
- var self = this;
- Base.call(this, runner);
-
- var tests = []
- , pending = []
- , failures = []
- , passes = [];
-
- runner.on('test end', function(test){
- tests.push(test);
- });
-
- runner.on('pass', function(test){
- passes.push(test);
- });
-
- runner.on('fail', function(test){
- failures.push(test);
- });
-
- runner.on('pending', function(test){
- pending.push(test);
- });
-
- runner.on('end', function(){
- var obj = {
- stats: self.stats,
- tests: tests.map(clean),
- pending: pending.map(clean),
- failures: failures.map(clean),
- passes: passes.map(clean)
- };
-
- runner.testResults = obj;
-
- process.stdout.write(JSON.stringify(obj, null, 2));
- });
-}
-
-/**
- * Return a plain-object representation of `test`
- * free of cyclic properties etc.
- *
- * @param {Object} test
- * @return {Object}
- * @api private
- */
-
-function clean(test) {
- return {
- title: test.title,
- fullTitle: test.fullTitle(),
- duration: test.duration,
- err: errorJSON(test.err || {})
- }
-}
-
-/**
- * Transform `error` into a JSON object.
- * @param {Error} err
- * @return {Object}
- */
-
-function errorJSON(err) {
- var res = {};
- Object.getOwnPropertyNames(err).forEach(function(key) {
- res[key] = err[key];
- }, err);
- return res;
-}
-
-}); // module: reporters/json.js
-
-require.register("reporters/landing.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , cursor = Base.cursor
- , color = Base.color;
-
-/**
- * Expose `Landing`.
- */
-
-exports = module.exports = Landing;
-
-/**
- * Airplane color.
- */
-
-Base.colors.plane = 0;
-
-/**
- * Airplane crash color.
- */
-
-Base.colors['plane crash'] = 31;
-
-/**
- * Runway color.
- */
-
-Base.colors.runway = 90;
-
-/**
- * Initialize a new `Landing` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Landing(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , width = Base.window.width * .75 | 0
- , total = runner.total
- , stream = process.stdout
- , plane = color('plane', '✈')
- , crashed = -1
- , n = 0;
-
- function runway() {
- var buf = Array(width).join('-');
- return ' ' + color('runway', buf);
- }
-
- runner.on('start', function(){
- stream.write('\n\n\n ');
- cursor.hide();
- });
-
- runner.on('test end', function(test){
- // check if the plane crashed
- var col = -1 == crashed
- ? width * ++n / total | 0
- : crashed;
-
- // show the crash
- if ('failed' == test.state) {
- plane = color('plane crash', '✈');
- crashed = col;
- }
-
- // render landing strip
- stream.write('\u001b['+(width+1)+'D\u001b[2A');
- stream.write(runway());
- stream.write('\n ');
- stream.write(color('runway', Array(col).join('⋅')));
- stream.write(plane)
- stream.write(color('runway', Array(width - col).join('⋅') + '\n'));
- stream.write(runway());
- stream.write('\u001b[0m');
- });
-
- runner.on('end', function(){
- cursor.show();
- console.log();
- self.epilogue();
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-
-function F(){};
-F.prototype = Base.prototype;
-Landing.prototype = new F;
-Landing.prototype.constructor = Landing;
-
-
-}); // module: reporters/landing.js
-
-require.register("reporters/list.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , cursor = Base.cursor
- , color = Base.color;
-
-/**
- * Expose `List`.
- */
-
-exports = module.exports = List;
-
-/**
- * Initialize a new `List` test reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function List(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , n = 0;
-
- runner.on('start', function(){
- console.log();
- });
-
- runner.on('test', function(test){
- process.stdout.write(color('pass', ' ' + test.fullTitle() + ': '));
- });
-
- runner.on('pending', function(test){
- var fmt = color('checkmark', ' -')
- + color('pending', ' %s');
- console.log(fmt, test.fullTitle());
- });
-
- runner.on('pass', function(test){
- var fmt = color('checkmark', ' '+Base.symbols.dot)
- + color('pass', ' %s: ')
- + color(test.speed, '%dms');
- cursor.CR();
- console.log(fmt, test.fullTitle(), test.duration);
- });
-
- runner.on('fail', function(test, err){
- cursor.CR();
- console.log(color('fail', ' %d) %s'), ++n, test.fullTitle());
- });
-
- runner.on('end', self.epilogue.bind(self));
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-
-function F(){};
-F.prototype = Base.prototype;
-List.prototype = new F;
-List.prototype.constructor = List;
-
-
-}); // module: reporters/list.js
-
-require.register("reporters/markdown.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , utils = require('../utils');
-
-/**
- * Constants
- */
-
-var SUITE_PREFIX = '$';
-
-/**
- * Expose `Markdown`.
- */
-
-exports = module.exports = Markdown;
-
-/**
- * Initialize a new `Markdown` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Markdown(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , level = 0
- , buf = '';
-
- function title(str) {
- return Array(level).join('#') + ' ' + str;
- }
-
- function indent() {
- return Array(level).join(' ');
- }
-
- function mapTOC(suite, obj) {
- var ret = obj,
- key = SUITE_PREFIX + suite.title;
- obj = obj[key] = obj[key] || { suite: suite };
- suite.suites.forEach(function(suite){
- mapTOC(suite, obj);
- });
- return ret;
- }
-
- function stringifyTOC(obj, level) {
- ++level;
- var buf = '';
- var link;
- for (var key in obj) {
- if ('suite' == key) continue;
- if (key !== SUITE_PREFIX) {
- link = ' - [' + key.substring(1) + ']';
- link += '(#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
- buf += Array(level).join(' ') + link;
- }
- buf += stringifyTOC(obj[key], level);
- }
- return buf;
- }
-
- function generateTOC(suite) {
- var obj = mapTOC(suite, {});
- return stringifyTOC(obj, 0);
- }
-
- generateTOC(runner.suite);
-
- runner.on('suite', function(suite){
- ++level;
- var slug = utils.slug(suite.fullTitle());
- buf += '<a name="' + slug + '"></a>' + '\n';
- buf += title(suite.title) + '\n';
- });
-
- runner.on('suite end', function(suite){
- --level;
- });
-
- runner.on('pass', function(test){
- var code = utils.clean(test.fn.toString());
- buf += test.title + '.\n';
- buf += '\n```js\n';
- buf += code + '\n';
- buf += '```\n\n';
- });
-
- runner.on('end', function(){
- process.stdout.write('# TOC\n');
- process.stdout.write(generateTOC(runner.suite));
- process.stdout.write(buf);
- });
-}
-
-}); // module: reporters/markdown.js
-
-require.register("reporters/min.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-
-/**
- * Expose `Min`.
- */
-
-exports = module.exports = Min;
-
-/**
- * Initialize a new `Min` minimal test reporter (best used with --watch).
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Min(runner) {
- Base.call(this, runner);
-
- runner.on('start', function(){
- // clear screen
- process.stdout.write('\u001b[2J');
- // set cursor position
- process.stdout.write('\u001b[1;3H');
- });
-
- runner.on('end', this.epilogue.bind(this));
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-
-function F(){};
-F.prototype = Base.prototype;
-Min.prototype = new F;
-Min.prototype.constructor = Min;
-
-
-}); // module: reporters/min.js
-
-require.register("reporters/nyan.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base');
-
-/**
- * Expose `Dot`.
- */
-
-exports = module.exports = NyanCat;
-
-/**
- * Initialize a new `Dot` matrix test reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function NyanCat(runner) {
- Base.call(this, runner);
- var self = this
- , stats = this.stats
- , width = Base.window.width * .75 | 0
- , rainbowColors = this.rainbowColors = self.generateColors()
- , colorIndex = this.colorIndex = 0
- , numerOfLines = this.numberOfLines = 4
- , trajectories = this.trajectories = [[], [], [], []]
- , nyanCatWidth = this.nyanCatWidth = 11
- , trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth)
- , scoreboardWidth = this.scoreboardWidth = 5
- , tick = this.tick = 0
- , n = 0;
-
- runner.on('start', function(){
- Base.cursor.hide();
- self.draw();
- });
-
- runner.on('pending', function(test){
- self.draw();
- });
-
- runner.on('pass', function(test){
- self.draw();
- });
-
- runner.on('fail', function(test, err){
- self.draw();
- });
-
- runner.on('end', function(){
- Base.cursor.show();
- for (var i = 0; i < self.numberOfLines; i++) write('\n');
- self.epilogue();
- });
-}
-
-/**
- * Draw the nyan cat
- *
- * @api private
- */
-
-NyanCat.prototype.draw = function(){
- this.appendRainbow();
- this.drawScoreboard();
- this.drawRainbow();
- this.drawNyanCat();
- this.tick = !this.tick;
-};
-
-/**
- * Draw the "scoreboard" showing the number
- * of passes, failures and pending tests.
- *
- * @api private
- */
-
-NyanCat.prototype.drawScoreboard = function(){
- var stats = this.stats;
-
- function draw(type, n) {
- write(' ');
- write(Base.color(type, n));
- write('\n');
- }
-
- draw('green', stats.passes);
- draw('fail', stats.failures);
- draw('pending', stats.pending);
- write('\n');
-
- this.cursorUp(this.numberOfLines);
-};
-
-/**
- * Append the rainbow.
- *
- * @api private
- */
-
-NyanCat.prototype.appendRainbow = function(){
- var segment = this.tick ? '_' : '-';
- var rainbowified = this.rainbowify(segment);
-
- for (var index = 0; index < this.numberOfLines; index++) {
- var trajectory = this.trajectories[index];
- if (trajectory.length >= this.trajectoryWidthMax) trajectory.shift();
- trajectory.push(rainbowified);
- }
-};
-
-/**
- * Draw the rainbow.
- *
- * @api private
- */
-
-NyanCat.prototype.drawRainbow = function(){
- var self = this;
-
- this.trajectories.forEach(function(line, index) {
- write('\u001b[' + self.scoreboardWidth + 'C');
- write(line.join(''));
- write('\n');
- });
-
- this.cursorUp(this.numberOfLines);
-};
-
-/**
- * Draw the nyan cat
- *
- * @api private
- */
-
-NyanCat.prototype.drawNyanCat = function() {
- var self = this;
- var startWidth = this.scoreboardWidth + this.trajectories[0].length;
- var dist = '\u001b[' + startWidth + 'C';
- var padding = '';
-
- write(dist);
- write('_,------,');
- write('\n');
-
- write(dist);
- padding = self.tick ? ' ' : ' ';
- write('_|' + padding + '/\\_/\\ ');
- write('\n');
-
- write(dist);
- padding = self.tick ? '_' : '__';
- var tail = self.tick ? '~' : '^';
- var face;
- write(tail + '|' + padding + this.face() + ' ');
- write('\n');
-
- write(dist);
- padding = self.tick ? ' ' : ' ';
- write(padding + '"" "" ');
- write('\n');
-
- this.cursorUp(this.numberOfLines);
-};
-
-/**
- * Draw nyan cat face.
- *
- * @return {String}
- * @api private
- */
-
-NyanCat.prototype.face = function() {
- var stats = this.stats;
- if (stats.failures) {
- return '( x .x)';
- } else if (stats.pending) {
- return '( o .o)';
- } else if(stats.passes) {
- return '( ^ .^)';
- } else {
- return '( - .-)';
- }
-};
-
-/**
- * Move cursor up `n`.
- *
- * @param {Number} n
- * @api private
- */
-
-NyanCat.prototype.cursorUp = function(n) {
- write('\u001b[' + n + 'A');
-};
-
-/**
- * Move cursor down `n`.
- *
- * @param {Number} n
- * @api private
- */
-
-NyanCat.prototype.cursorDown = function(n) {
- write('\u001b[' + n + 'B');
-};
-
-/**
- * Generate rainbow colors.
- *
- * @return {Array}
- * @api private
- */
-
-NyanCat.prototype.generateColors = function(){
- var colors = [];
-
- for (var i = 0; i < (6 * 7); i++) {
- var pi3 = Math.floor(Math.PI / 3);
- var n = (i * (1.0 / 6));
- var r = Math.floor(3 * Math.sin(n) + 3);
- var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);
- var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);
- colors.push(36 * r + 6 * g + b + 16);
- }
-
- return colors;
-};
-
-/**
- * Apply rainbow to the given `str`.
- *
- * @param {String} str
- * @return {String}
- * @api private
- */
-
-NyanCat.prototype.rainbowify = function(str){
- if (!Base.useColors)
- return str;
- var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
- this.colorIndex += 1;
- return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
-};
-
-/**
- * Stdout helper.
- */
-
-function write(string) {
- process.stdout.write(string);
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-
-function F(){};
-F.prototype = Base.prototype;
-NyanCat.prototype = new F;
-NyanCat.prototype.constructor = NyanCat;
-
-
-}); // module: reporters/nyan.js
-
-require.register("reporters/progress.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , cursor = Base.cursor
- , color = Base.color;
-
-/**
- * Expose `Progress`.
- */
-
-exports = module.exports = Progress;
-
-/**
- * General progress bar color.
- */
-
-Base.colors.progress = 90;
-
-/**
- * Initialize a new `Progress` bar test reporter.
- *
- * @param {Runner} runner
- * @param {Object} options
- * @api public
- */
-
-function Progress(runner, options) {
- Base.call(this, runner);
-
- var self = this
- , options = options || {}
- , stats = this.stats
- , width = Base.window.width * .50 | 0
- , total = runner.total
- , complete = 0
- , max = Math.max
- , lastN = -1;
-
- // default chars
- options.open = options.open || '[';
- options.complete = options.complete || '▬';
- options.incomplete = options.incomplete || Base.symbols.dot;
- options.close = options.close || ']';
- options.verbose = false;
-
- // tests started
- runner.on('start', function(){
- console.log();
- cursor.hide();
- });
-
- // tests complete
- runner.on('test end', function(){
- complete++;
- var incomplete = total - complete
- , percent = complete / total
- , n = width * percent | 0
- , i = width - n;
-
- if (lastN === n && !options.verbose) {
- // Don't re-render the line if it hasn't changed
- return;
- }
- lastN = n;
-
- cursor.CR();
- process.stdout.write('\u001b[J');
- process.stdout.write(color('progress', ' ' + options.open));
- process.stdout.write(Array(n).join(options.complete));
- process.stdout.write(Array(i).join(options.incomplete));
- process.stdout.write(color('progress', options.close));
- if (options.verbose) {
- process.stdout.write(color('progress', ' ' + complete + ' of ' + total));
- }
- });
-
- // tests are complete, output some stats
- // and the failures if any
- runner.on('end', function(){
- cursor.show();
- console.log();
- self.epilogue();
- });
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-
-function F(){};
-F.prototype = Base.prototype;
-Progress.prototype = new F;
-Progress.prototype.constructor = Progress;
-
-
-}); // module: reporters/progress.js
-
-require.register("reporters/spec.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , cursor = Base.cursor
- , color = Base.color;
-
-/**
- * Expose `Spec`.
- */
-
-exports = module.exports = Spec;
-
-/**
- * Initialize a new `Spec` test reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function Spec(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , indents = 0
- , n = 0;
-
- function indent() {
- return Array(indents).join(' ')
- }
-
- runner.on('start', function(){
- console.log();
- });
-
- runner.on('suite', function(suite){
- ++indents;
- console.log(color('suite', '%s%s'), indent(), suite.title);
- });
-
- runner.on('suite end', function(suite){
- --indents;
- if (1 == indents) console.log();
- });
-
- runner.on('pending', function(test){
- var fmt = indent() + color('pending', ' - %s');
- console.log(fmt, test.title);
- });
-
- runner.on('pass', function(test){
- if ('fast' == test.speed) {
- var fmt = indent()
- + color('checkmark', ' ' + Base.symbols.ok)
- + color('pass', ' %s ');
- cursor.CR();
- console.log(fmt, test.title);
- } else {
- var fmt = indent()
- + color('checkmark', ' ' + Base.symbols.ok)
- + color('pass', ' %s ')
- + color(test.speed, '(%dms)');
- cursor.CR();
- console.log(fmt, test.title, test.duration);
- }
- });
-
- runner.on('fail', function(test, err){
- cursor.CR();
- console.log(indent() + color('fail', ' %d) %s'), ++n, test.title);
- });
-
- runner.on('end', self.epilogue.bind(self));
-}
-
-/**
- * Inherit from `Base.prototype`.
- */
-
-function F(){};
-F.prototype = Base.prototype;
-Spec.prototype = new F;
-Spec.prototype.constructor = Spec;
-
-
-}); // module: reporters/spec.js
-
-require.register("reporters/tap.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , cursor = Base.cursor
- , color = Base.color;
-
-/**
- * Expose `TAP`.
- */
-
-exports = module.exports = TAP;
-
-/**
- * Initialize a new `TAP` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function TAP(runner) {
- Base.call(this, runner);
-
- var self = this
- , stats = this.stats
- , n = 1
- , passes = 0
- , failures = 0;
-
- runner.on('start', function(){
- var total = runner.grepTotal(runner.suite);
- console.log('%d..%d', 1, total);
- });
-
- runner.on('test end', function(){
- ++n;
- });
-
- runner.on('pending', function(test){
- console.log('ok %d %s # SKIP -', n, title(test));
- });
-
- runner.on('pass', function(test){
- passes++;
- console.log('ok %d %s', n, title(test));
- });
-
- runner.on('fail', function(test, err){
- failures++;
- console.log('not ok %d %s', n, title(test));
- if (err.stack) console.log(err.stack.replace(/^/gm, ' '));
- });
-
- runner.on('end', function(){
- console.log('# tests ' + (passes + failures));
- console.log('# pass ' + passes);
- console.log('# fail ' + failures);
- });
-}
-
-/**
- * Return a TAP-safe title of `test`
- *
- * @param {Object} test
- * @return {String}
- * @api private
- */
-
-function title(test) {
- return test.fullTitle().replace(/#/g, '');
-}
-
-}); // module: reporters/tap.js
-
-require.register("reporters/xunit.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Base = require('./base')
- , utils = require('../utils')
- , fs = require('browser/fs')
- , escape = utils.escape;
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-var Date = global.Date
- , setTimeout = global.setTimeout
- , setInterval = global.setInterval
- , clearTimeout = global.clearTimeout
- , clearInterval = global.clearInterval;
-
-/**
- * Expose `XUnit`.
- */
-
-exports = module.exports = XUnit;
-
-/**
- * Initialize a new `XUnit` reporter.
- *
- * @param {Runner} runner
- * @api public
- */
-
-function XUnit(runner, options) {
- Base.call(this, runner);
- var stats = this.stats
- , tests = []
- , self = this;
-
- if (options.reporterOptions && options.reporterOptions.output) {
- if (! fs.createWriteStream) {
- throw new Error('file output not supported in browser');
- }
- self.fileStream = fs.createWriteStream(options.reporterOptions.output);
- }
-
- runner.on('pending', function(test){
- tests.push(test);
- });
-
- runner.on('pass', function(test){
- tests.push(test);
- });
-
- runner.on('fail', function(test){
- tests.push(test);
- });
-
- runner.on('end', function(){
- self.write(tag('testsuite', {
- name: 'Mocha Tests'
- , tests: stats.tests
- , failures: stats.failures
- , errors: stats.failures
- , skipped: stats.tests - stats.failures - stats.passes
- , timestamp: (new Date).toUTCString()
- , time: (stats.duration / 1000) || 0
- }, false));
-
- tests.forEach(function(t) { self.test(t); });
- self.write('</testsuite>');
- });
-}
-
-/**
- * Override done to close the stream (if it's a file).
- */
-XUnit.prototype.done = function(failures, fn) {
- if (this.fileStream) {
- this.fileStream.end(function() {
- fn(failures);
- });
- } else {
- fn(failures);
- }
-};
-
-/**
- * Inherit from `Base.prototype`.
- */
-
-function F(){};
-F.prototype = Base.prototype;
-XUnit.prototype = new F;
-XUnit.prototype.constructor = XUnit;
-
-
-/**
- * Write out the given line
- */
-XUnit.prototype.write = function(line) {
- if (this.fileStream) {
- this.fileStream.write(line + '\n');
- } else {
- console.log(line);
- }
-};
-
-/**
- * Output tag for the given `test.`
- */
-
-XUnit.prototype.test = function(test, ostream) {
- var attrs = {
- classname: test.parent.fullTitle()
- , name: test.title
- , time: (test.duration / 1000) || 0
- };
-
- if ('failed' == test.state) {
- var err = test.err;
- this.write(tag('testcase', attrs, false, tag('failure', {}, false, cdata(escape(err.message) + "\n" + err.stack))));
- } else if (test.pending) {
- this.write(tag('testcase', attrs, false, tag('skipped', {}, true)));
- } else {
- this.write(tag('testcase', attrs, true) );
- }
-};
-
-/**
- * HTML tag helper.
- */
-
-function tag(name, attrs, close, content) {
- var end = close ? '/>' : '>'
- , pairs = []
- , tag;
-
- for (var key in attrs) {
- pairs.push(key + '="' + escape(attrs[key]) + '"');
- }
-
- tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end;
- if (content) tag += content + '</' + name + end;
- return tag;
-}
-
-/**
- * Return cdata escaped CDATA `str`.
- */
-
-function cdata(str) {
- return '<![CDATA[' + escape(str) + ']]>';
-}
-
-}); // module: reporters/xunit.js
-
-require.register("runnable.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var EventEmitter = require('browser/events').EventEmitter
- , debug = require('browser/debug')('mocha:runnable')
- , Pending = require('./pending')
- , milliseconds = require('./ms')
- , utils = require('./utils');
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-var Date = global.Date
- , setTimeout = global.setTimeout
- , setInterval = global.setInterval
- , clearTimeout = global.clearTimeout
- , clearInterval = global.clearInterval;
-
-/**
- * Object#toString().
- */
-
-var toString = Object.prototype.toString;
-
-/**
- * Expose `Runnable`.
- */
-
-module.exports = Runnable;
-
-/**
- * Initialize a new `Runnable` with the given `title` and callback `fn`.
- *
- * @param {String} title
- * @param {Function} fn
- * @api private
- */
-
-function Runnable(title, fn) {
- this.title = title;
- this.fn = fn;
- this.async = fn && fn.length;
- this.sync = ! this.async;
- this._timeout = 2000;
- this._slow = 75;
- this._enableTimeouts = true;
- this.timedOut = false;
- this._trace = new Error('done() called multiple times')
-}
-
-/**
- * Inherit from `EventEmitter.prototype`.
- */
-
-function F(){};
-F.prototype = EventEmitter.prototype;
-Runnable.prototype = new F;
-Runnable.prototype.constructor = Runnable;
-
-
-/**
- * Set & get timeout `ms`.
- *
- * @param {Number|String} ms
- * @return {Runnable|Number} ms or self
- * @api private
- */
-
-Runnable.prototype.timeout = function(ms){
- if (0 == arguments.length) return this._timeout;
- if (ms === 0) this._enableTimeouts = false;
- if ('string' == typeof ms) ms = milliseconds(ms);
- debug('timeout %d', ms);
- this._timeout = ms;
- if (this.timer) this.resetTimeout();
- return this;
-};
-
-/**
- * Set & get slow `ms`.
- *
- * @param {Number|String} ms
- * @return {Runnable|Number} ms or self
- * @api private
- */
-
-Runnable.prototype.slow = function(ms){
- if (0 === arguments.length) return this._slow;
- if ('string' == typeof ms) ms = milliseconds(ms);
- debug('timeout %d', ms);
- this._slow = ms;
- return this;
-};
-
-/**
- * Set and & get timeout `enabled`.
- *
- * @param {Boolean} enabled
- * @return {Runnable|Boolean} enabled or self
- * @api private
- */
-
-Runnable.prototype.enableTimeouts = function(enabled){
- if (arguments.length === 0) return this._enableTimeouts;
- debug('enableTimeouts %s', enabled);
- this._enableTimeouts = enabled;
- return this;
-};
-
-/**
- * Halt and mark as pending.
- *
- * @api private
- */
-
-Runnable.prototype.skip = function(){
- throw new Pending();
-};
-
-/**
- * Return the full title generated by recursively
- * concatenating the parent's full title.
- *
- * @return {String}
- * @api public
- */
-
-Runnable.prototype.fullTitle = function(){
- return this.parent.fullTitle() + ' ' + this.title;
-};
-
-/**
- * Clear the timeout.
- *
- * @api private
- */
-
-Runnable.prototype.clearTimeout = function(){
- clearTimeout(this.timer);
-};
-
-/**
- * Inspect the runnable void of private properties.
- *
- * @return {String}
- * @api private
- */
-
-Runnable.prototype.inspect = function(){
- return JSON.stringify(this, function(key, val){
- if ('_' == key[0]) return;
- if ('parent' == key) return '#<Suite>';
- if ('ctx' == key) return '#<Context>';
- return val;
- }, 2);
-};
-
-/**
- * Reset the timeout.
- *
- * @api private
- */
-
-Runnable.prototype.resetTimeout = function(){
- var self = this;
- var ms = this.timeout() || 1e9;
-
- if (!this._enableTimeouts) return;
- this.clearTimeout();
- this.timer = setTimeout(function(){
- if (!self._enableTimeouts) return;
- self.callback(new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.'));
- self.timedOut = true;
- }, ms);
-};
-
-/**
- * Whitelist these globals for this test run
- *
- * @api private
- */
-Runnable.prototype.globals = function(arr){
- var self = this;
- this._allowedGlobals = arr;
-};
-
-/**
- * Run the test and invoke `fn(err)`.
- *
- * @param {Function} fn
- * @api private
- */
-
-Runnable.prototype.run = function(fn){
- var self = this
- , start = new Date
- , ctx = this.ctx
- , finished
- , emitted;
-
- // Some times the ctx exists but it is not runnable
- if (ctx && ctx.runnable) ctx.runnable(this);
-
- // called multiple times
- function multiple(err) {
- if (emitted) return;
- emitted = true;
- self.emit('error', err || new Error('done() called multiple times; stacktrace may be inaccurate'));
- }
-
- // finished
- function done(err) {
- var ms = self.timeout();
- if (self.timedOut) return;
- if (finished) return multiple(err || self._trace);
-
- // Discard the resolution if this test has already failed asynchronously
- if (self.state) return;
-
- self.clearTimeout();
- self.duration = new Date - start;
- finished = true;
- if (!err && self.duration > ms && self._enableTimeouts) err = new Error('timeout of ' + ms + 'ms exceeded. Ensure the done() callback is being called in this test.');
- fn(err);
- }
-
- // for .resetTimeout()
- this.callback = done;
-
- // explicit async with `done` argument
- if (this.async) {
- this.resetTimeout();
-
- try {
- this.fn.call(ctx, function(err){
- if (err instanceof Error || toString.call(err) === "[object Error]") return done(err);
- if (null != err) {
- if (Object.prototype.toString.call(err) === '[object Object]') {
- return done(new Error('done() invoked with non-Error: ' + JSON.stringify(err)));
- } else {
- return done(new Error('done() invoked with non-Error: ' + err));
- }
- }
- done();
- });
- } catch (err) {
- done(utils.getError(err));
- }
- return;
- }
-
- if (this.asyncOnly) {
- return done(new Error('--async-only option in use without declaring `done()`'));
- }
-
- // sync or promise-returning
- try {
- if (this.pending) {
- done();
- } else {
- callFn(this.fn);
- }
- } catch (err) {
- done(utils.getError(err));
- }
-
- function callFn(fn) {
- var result = fn.call(ctx);
- if (result && typeof result.then === 'function') {
- self.resetTimeout();
- result
- .then(function() {
- done()
- },
- function(reason) {
- done(reason || new Error('Promise rejected with no or falsy reason'))
- });
- } else {
- done();
- }
- }
-};
-
-}); // module: runnable.js
-
-require.register("runner.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var EventEmitter = require('browser/events').EventEmitter
- , debug = require('browser/debug')('mocha:runner')
- , Pending = require('./pending')
- , Test = require('./test')
- , utils = require('./utils')
- , filter = utils.filter
- , keys = utils.keys
- , type = utils.type
- , stringify = utils.stringify
- , stackFilter = utils.stackTraceFilter();
-
-/**
- * Non-enumerable globals.
- */
-
-var globals = [
- 'setTimeout',
- 'clearTimeout',
- 'setInterval',
- 'clearInterval',
- 'XMLHttpRequest',
- 'Date',
- 'setImmediate',
- 'clearImmediate'
-];
-
-/**
- * Expose `Runner`.
- */
-
-module.exports = Runner;
-
-/**
- * Initialize a `Runner` for the given `suite`.
- *
- * Events:
- *
- * - `start` execution started
- * - `end` execution complete
- * - `suite` (suite) test suite execution started
- * - `suite end` (suite) all tests (and sub-suites) have finished
- * - `test` (test) test execution started
- * - `test end` (test) test completed
- * - `hook` (hook) hook execution started
- * - `hook end` (hook) hook complete
- * - `pass` (test) test passed
- * - `fail` (test, err) test failed
- * - `pending` (test) test pending
- *
- * @param {Suite} suite Root suite
- * @param {boolean} [delay] Whether or not to delay execution of root suite
- * until ready.
- * @api public
- */
-
-function Runner(suite, delay) {
- var self = this;
- this._globals = [];
- this._abort = false;
- this._delay = delay;
- this.suite = suite;
- this.total = suite.total();
- this.failures = 0;
- this.on('test end', function(test){ self.checkGlobals(test); });
- this.on('hook end', function(hook){ self.checkGlobals(hook); });
- this.grep(/.*/);
- this.globals(this.globalProps().concat(extraGlobals()));
-}
-
-/**
- * Wrapper for setImmediate, process.nextTick, or browser polyfill.
- *
- * @param {Function} fn
- * @api private
- */
-
-Runner.immediately = global.setImmediate || process.nextTick;
-
-/**
- * Inherit from `EventEmitter.prototype`.
- */
-
-function F(){};
-F.prototype = EventEmitter.prototype;
-Runner.prototype = new F;
-Runner.prototype.constructor = Runner;
-
-
-/**
- * Run tests with full titles matching `re`. Updates runner.total
- * with number of tests matched.
- *
- * @param {RegExp} re
- * @param {Boolean} invert
- * @return {Runner} for chaining
- * @api public
- */
-
-Runner.prototype.grep = function(re, invert){
- debug('grep %s', re);
- this._grep = re;
- this._invert = invert;
- this.total = this.grepTotal(this.suite);
- return this;
-};
-
-/**
- * Returns the number of tests matching the grep search for the
- * given suite.
- *
- * @param {Suite} suite
- * @return {Number}
- * @api public
- */
-
-Runner.prototype.grepTotal = function(suite) {
- var self = this;
- var total = 0;
-
- suite.eachTest(function(test){
- var match = self._grep.test(test.fullTitle());
- if (self._invert) match = !match;
- if (match) total++;
- });
-
- return total;
-};
-
-/**
- * Return a list of global properties.
- *
- * @return {Array}
- * @api private
- */
-
-Runner.prototype.globalProps = function() {
- var props = utils.keys(global);
-
- // non-enumerables
- for (var i = 0; i < globals.length; ++i) {
- if (~utils.indexOf(props, globals[i])) continue;
- props.push(globals[i]);
- }
-
- return props;
-};
-
-/**
- * Allow the given `arr` of globals.
- *
- * @param {Array} arr
- * @return {Runner} for chaining
- * @api public
- */
-
-Runner.prototype.globals = function(arr){
- if (0 == arguments.length) return this._globals;
- debug('globals %j', arr);
- this._globals = this._globals.concat(arr);
- return this;
-};
-
-/**
- * Check for global variable leaks.
- *
- * @api private
- */
-
-Runner.prototype.checkGlobals = function(test){
- if (this.ignoreLeaks) return;
- var ok = this._globals;
-
- var globals = this.globalProps();
- var leaks;
-
- if (test) {
- ok = ok.concat(test._allowedGlobals || []);
- }
-
- if(this.prevGlobalsLength == globals.length) return;
- this.prevGlobalsLength = globals.length;
-
- leaks = filterLeaks(ok, globals);
- this._globals = this._globals.concat(leaks);
-
- if (leaks.length > 1) {
- this.fail(test, new Error('global leaks detected: ' + leaks.join(', ') + ''));
- } else if (leaks.length) {
- this.fail(test, new Error('global leak detected: ' + leaks[0]));
- }
-};
-
-/**
- * Fail the given `test`.
- *
- * @param {Test} test
- * @param {Error} err
- * @api private
- */
-
-Runner.prototype.fail = function(test, err) {
- ++this.failures;
- test.state = 'failed';
-
- if (!(err instanceof Error)) {
- err = new Error('the ' + type(err) + ' ' + stringify(err) + ' was thrown, throw an Error :)');
- }
-
- err.stack = this.fullStackTrace
- ? err.stack
- : stackFilter(err.stack);
-
- this.emit('fail', test, err);
-};
-
-/**
- * Fail the given `hook` with `err`.
- *
- * Hook failures work in the following pattern:
- * - If bail, then exit
- * - Failed `before` hook skips all tests in a suite and subsuites,
- * but jumps to corresponding `after` hook
- * - Failed `before each` hook skips remaining tests in a
- * suite and jumps to corresponding `after each` hook,
- * which is run only once
- * - Failed `after` hook does not alter
- * execution order
- * - Failed `after each` hook skips remaining tests in a
- * suite and subsuites, but executes other `after each`
- * hooks
- *
- * @param {Hook} hook
- * @param {Error} err
- * @api private
- */
-
-Runner.prototype.failHook = function(hook, err){
- this.fail(hook, err);
- if (this.suite.bail()) {
- this.emit('end');
- }
-};
-
-/**
- * Run hook `name` callbacks and then invoke `fn()`.
- *
- * @param {String} name
- * @param {Function} function
- * @api private
- */
-
-Runner.prototype.hook = function(name, fn){
- var suite = this.suite
- , hooks = suite['_' + name]
- , self = this
- , timer;
-
- function next(i) {
- var hook = hooks[i];
- if (!hook) return fn();
- self.currentRunnable = hook;
-
- hook.ctx.currentTest = self.test;
-
- self.emit('hook', hook);
-
- hook.on('error', function(err){
- self.failHook(hook, err);
- });
-
- hook.run(function(err){
- hook.removeAllListeners('error');
- var testError = hook.error();
- if (testError) self.fail(self.test, testError);
- if (err) {
- if (err instanceof Pending) {
- suite.pending = true;
- } else {
- self.failHook(hook, err);
-
- // stop executing hooks, notify callee of hook err
- return fn(err);
- }
- }
- self.emit('hook end', hook);
- delete hook.ctx.currentTest;
- next(++i);
- });
- }
-
- Runner.immediately(function(){
- next(0);
- });
-};
-
-/**
- * Run hook `name` for the given array of `suites`
- * in order, and callback `fn(err, errSuite)`.
- *
- * @param {String} name
- * @param {Array} suites
- * @param {Function} fn
- * @api private
- */
-
-Runner.prototype.hooks = function(name, suites, fn){
- var self = this
- , orig = this.suite;
-
- function next(suite) {
- self.suite = suite;
-
- if (!suite) {
- self.suite = orig;
- return fn();
- }
-
- self.hook(name, function(err){
- if (err) {
- var errSuite = self.suite;
- self.suite = orig;
- return fn(err, errSuite);
- }
-
- next(suites.pop());
- });
- }
-
- next(suites.pop());
-};
-
-/**
- * Run hooks from the top level down.
- *
- * @param {String} name
- * @param {Function} fn
- * @api private
- */
-
-Runner.prototype.hookUp = function(name, fn){
- var suites = [this.suite].concat(this.parents()).reverse();
- this.hooks(name, suites, fn);
-};
-
-/**
- * Run hooks from the bottom up.
- *
- * @param {String} name
- * @param {Function} fn
- * @api private
- */
-
-Runner.prototype.hookDown = function(name, fn){
- var suites = [this.suite].concat(this.parents());
- this.hooks(name, suites, fn);
-};
-
-/**
- * Return an array of parent Suites from
- * closest to furthest.
- *
- * @return {Array}
- * @api private
- */
-
-Runner.prototype.parents = function(){
- var suite = this.suite
- , suites = [];
- while (suite = suite.parent) suites.push(suite);
- return suites;
-};
-
-/**
- * Run the current test and callback `fn(err)`.
- *
- * @param {Function} fn
- * @api private
- */
-
-Runner.prototype.runTest = function(fn){
- var test = this.test
- , self = this;
-
- if (this.asyncOnly) test.asyncOnly = true;
-
- try {
- test.on('error', function(err){
- self.fail(test, err);
- });
- test.run(fn);
- } catch (err) {
- fn(err);
- }
-};
-
-/**
- * Run tests in the given `suite` and invoke
- * the callback `fn()` when complete.
- *
- * @param {Suite} suite
- * @param {Function} fn
- * @api private
- */
-
-Runner.prototype.runTests = function(suite, fn){
- var self = this
- , tests = suite.tests.slice()
- , test;
-
-
- function hookErr(err, errSuite, after) {
- // before/after Each hook for errSuite failed:
- var orig = self.suite;
-
- // for failed 'after each' hook start from errSuite parent,
- // otherwise start from errSuite itself
- self.suite = after ? errSuite.parent : errSuite;
-
- if (self.suite) {
- // call hookUp afterEach
- self.hookUp('afterEach', function(err2, errSuite2) {
- self.suite = orig;
- // some hooks may fail even now
- if (err2) return hookErr(err2, errSuite2, true);
- // report error suite
- fn(errSuite);
- });
- } else {
- // there is no need calling other 'after each' hooks
- self.suite = orig;
- fn(errSuite);
- }
- }
-
- function next(err, errSuite) {
- // if we bail after first err
- if (self.failures && suite._bail) return fn();
-
- if (self._abort) return fn();
-
- if (err) return hookErr(err, errSuite, true);
-
- // next test
- test = tests.shift();
-
- // all done
- if (!test) return fn();
-
- // grep
- var match = self._grep.test(test.fullTitle());
- if (self._invert) match = !match;
- if (!match) return next();
-
- // pending
- if (test.pending) {
- self.emit('pending', test);
- self.emit('test end', test);
- return next();
- }
-
- // execute test and hook(s)
- self.emit('test', self.test = test);
- self.hookDown('beforeEach', function(err, errSuite){
-
- if (suite.pending) {
- self.emit('pending', test);
- self.emit('test end', test);
- return next();
- }
- if (err) return hookErr(err, errSuite, false);
-
- self.currentRunnable = self.test;
- self.runTest(function(err){
- test = self.test;
-
- if (err) {
- if (err instanceof Pending) {
- self.emit('pending', test);
- } else {
- self.fail(test, err);
- }
- self.emit('test end', test);
-
- if (err instanceof Pending) {
- return next();
- }
-
- return self.hookUp('afterEach', next);
- }
-
- test.state = 'passed';
- self.emit('pass', test);
- self.emit('test end', test);
- self.hookUp('afterEach', next);
- });
- });
- }
-
- this.next = next;
- next();
-};
-
-/**
- * Run the given `suite` and invoke the
- * callback `fn()` when complete.
- *
- * @param {Suite} suite
- * @param {Function} fn
- * @api private
- */
-
-Runner.prototype.runSuite = function(suite, fn){
- var total = this.grepTotal(suite)
- , self = this
- , i = 0;
-
- debug('run suite %s', suite.fullTitle());
-
- if (!total) return fn();
-
- this.emit('suite', this.suite = suite);
-
- function next(errSuite) {
- if (errSuite) {
- // current suite failed on a hook from errSuite
- if (errSuite == suite) {
- // if errSuite is current suite
- // continue to the next sibling suite
- return done();
- } else {
- // errSuite is among the parents of current suite
- // stop execution of errSuite and all sub-suites
- return done(errSuite);
- }
- }
-
- if (self._abort) return done();
-
- var curr = suite.suites[i++];
- if (!curr) return done();
- self.runSuite(curr, next);
- }
-
- function done(errSuite) {
- self.suite = suite;
- self.hook('afterAll', function(){
- self.emit('suite end', suite);
- fn(errSuite);
- });
- }
-
- this.hook('beforeAll', function(err){
- if (err) return done();
- self.runTests(suite, next);
- });
-};
-
-/**
- * Handle uncaught exceptions.
- *
- * @param {Error} err
- * @api private
- */
-
-Runner.prototype.uncaught = function(err){
- if (err) {
- debug('uncaught exception %s', err !== function () {
- return this;
- }.call(err) ? err : ( err.message || err ));
- } else {
- debug('uncaught undefined exception');
- err = utils.undefinedError();
- }
- err.uncaught = true;
-
- var runnable = this.currentRunnable;
- if (!runnable) return;
-
- runnable.clearTimeout();
-
- // Ignore errors if complete
- if (runnable.state) return;
- this.fail(runnable, err);
-
- // recover from test
- if ('test' == runnable.type) {
- this.emit('test end', runnable);
- this.hookUp('afterEach', this.next);
- return;
- }
-
- // bail on hooks
- this.emit('end');
-};
-
-/**
- * Run the root suite and invoke `fn(failures)`
- * on completion.
- *
- * @param {Function} fn
- * @return {Runner} for chaining
- * @api public
- */
-
-Runner.prototype.run = function(fn){
- var self = this,
- rootSuite = this.suite;
-
- fn = fn || function(){};
-
- function uncaught(err){
- self.uncaught(err);
- }
-
- function start() {
- self.emit('start');
- self.runSuite(rootSuite, function(){
- debug('finished running');
- self.emit('end');
- });
- }
-
- debug('start');
-
- // callback
- this.on('end', function(){
- debug('end');
- process.removeListener('uncaughtException', uncaught);
- fn(self.failures);
- });
-
- // uncaught exception
- process.on('uncaughtException', uncaught);
-
- if (this._delay) {
- // for reporters, I guess.
- // might be nice to debounce some dots while we wait.
- this.emit('waiting', rootSuite);
- rootSuite.once('run', start);
- }
- else {
- start();
- }
-
- return this;
-};
-
-/**
- * Cleanly abort execution
- *
- * @return {Runner} for chaining
- * @api public
- */
-Runner.prototype.abort = function(){
- debug('aborting');
- this._abort = true;
-};
-
-/**
- * Filter leaks with the given globals flagged as `ok`.
- *
- * @param {Array} ok
- * @param {Array} globals
- * @return {Array}
- * @api private
- */
-
-function filterLeaks(ok, globals) {
- return filter(globals, function(key){
- // Firefox and Chrome exposes iframes as index inside the window object
- if (/^d+/.test(key)) return false;
-
- // in firefox
- // if runner runs in an iframe, this iframe's window.getInterface method not init at first
- // it is assigned in some seconds
- if (global.navigator && /^getInterface/.test(key)) return false;
-
- // an iframe could be approached by window[iframeIndex]
- // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak
- if (global.navigator && /^\d+/.test(key)) return false;
-
- // Opera and IE expose global variables for HTML element IDs (issue #243)
- if (/^mocha-/.test(key)) return false;
-
- var matched = filter(ok, function(ok){
- if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]);
- return key == ok;
- });
- return matched.length == 0 && (!global.navigator || 'onerror' !== key);
- });
-}
-
-/**
- * Array of globals dependent on the environment.
- *
- * @return {Array}
- * @api private
- */
-
-function extraGlobals() {
- if (typeof(process) === 'object' &&
- typeof(process.version) === 'string') {
-
- var nodeVersion = process.version.split('.').reduce(function(a, v) {
- return a << 8 | v;
- });
-
- // 'errno' was renamed to process._errno in v0.9.11.
-
- if (nodeVersion < 0x00090B) {
- return ['errno'];
- }
- }
-
- return [];
-}
-
-}); // module: runner.js
-
-require.register("suite.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var EventEmitter = require('browser/events').EventEmitter
- , debug = require('browser/debug')('mocha:suite')
- , milliseconds = require('./ms')
- , utils = require('./utils')
- , Hook = require('./hook');
-
-/**
- * Expose `Suite`.
- */
-
-exports = module.exports = Suite;
-
-/**
- * Create a new `Suite` with the given `title`
- * and parent `Suite`. When a suite with the
- * same title is already present, that suite
- * is returned to provide nicer reporter
- * and more flexible meta-testing.
- *
- * @param {Suite} parent
- * @param {String} title
- * @return {Suite}
- * @api public
- */
-
-exports.create = function(parent, title){
- var suite = new Suite(title, parent.ctx);
- suite.parent = parent;
- if (parent.pending) suite.pending = true;
- title = suite.fullTitle();
- parent.addSuite(suite);
- return suite;
-};
-
-/**
- * Initialize a new `Suite` with the given
- * `title` and `ctx`.
- *
- * @param {String} title
- * @param {Context} ctx
- * @api private
- */
-
-function Suite(title, parentContext) {
- this.title = title;
- var context = function() {};
- context.prototype = parentContext;
- this.ctx = new context();
- this.suites = [];
- this.tests = [];
- this.pending = false;
- this._beforeEach = [];
- this._beforeAll = [];
- this._afterEach = [];
- this._afterAll = [];
- this.root = !title;
- this._timeout = 2000;
- this._enableTimeouts = true;
- this._slow = 75;
- this._bail = false;
- this.delayed = false;
-}
-
-/**
- * Inherit from `EventEmitter.prototype`.
- */
-
-function F(){};
-F.prototype = EventEmitter.prototype;
-Suite.prototype = new F;
-Suite.prototype.constructor = Suite;
-
-
-/**
- * Return a clone of this `Suite`.
- *
- * @return {Suite}
- * @api private
- */
-
-Suite.prototype.clone = function(){
- var suite = new Suite(this.title);
- debug('clone');
- suite.ctx = this.ctx;
- suite.timeout(this.timeout());
- suite.enableTimeouts(this.enableTimeouts());
- suite.slow(this.slow());
- suite.bail(this.bail());
- return suite;
-};
-
-/**
- * Set timeout `ms` or short-hand such as "2s".
- *
- * @param {Number|String} ms
- * @return {Suite|Number} for chaining
- * @api private
- */
-
-Suite.prototype.timeout = function(ms){
- if (0 == arguments.length) return this._timeout;
- if (ms.toString() === '0') this._enableTimeouts = false;
- if ('string' == typeof ms) ms = milliseconds(ms);
- debug('timeout %d', ms);
- this._timeout = parseInt(ms, 10);
- return this;
-};
-
-/**
- * Set timeout `enabled`.
- *
- * @param {Boolean} enabled
- * @return {Suite|Boolean} self or enabled
- * @api private
- */
-
-Suite.prototype.enableTimeouts = function(enabled){
- if (arguments.length === 0) return this._enableTimeouts;
- debug('enableTimeouts %s', enabled);
- this._enableTimeouts = enabled;
- return this;
-};
-
-/**
- * Set slow `ms` or short-hand such as "2s".
- *
- * @param {Number|String} ms
- * @return {Suite|Number} for chaining
- * @api private
- */
-
-Suite.prototype.slow = function(ms){
- if (0 === arguments.length) return this._slow;
- if ('string' == typeof ms) ms = milliseconds(ms);
- debug('slow %d', ms);
- this._slow = ms;
- return this;
-};
-
-/**
- * Sets whether to bail after first error.
- *
- * @param {Boolean} bail
- * @return {Suite|Number} for chaining
- * @api private
- */
-
-Suite.prototype.bail = function(bail){
- if (0 == arguments.length) return this._bail;
- debug('bail %s', bail);
- this._bail = bail;
- return this;
-};
-
-/**
- * Run `fn(test[, done])` before running tests.
- *
- * @param {Function} fn
- * @return {Suite} for chaining
- * @api private
- */
-
-Suite.prototype.beforeAll = function(title, fn){
- if (this.pending) return this;
- if ('function' === typeof title) {
- fn = title;
- title = fn.name;
- }
- title = '"before all" hook' + (title ? ': ' + title : '');
-
- var hook = new Hook(title, fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.enableTimeouts(this.enableTimeouts());
- hook.slow(this.slow());
- hook.ctx = this.ctx;
- this._beforeAll.push(hook);
- this.emit('beforeAll', hook);
- return this;
-};
-
-/**
- * Run `fn(test[, done])` after running tests.
- *
- * @param {Function} fn
- * @return {Suite} for chaining
- * @api private
- */
-
-Suite.prototype.afterAll = function(title, fn){
- if (this.pending) return this;
- if ('function' === typeof title) {
- fn = title;
- title = fn.name;
- }
- title = '"after all" hook' + (title ? ': ' + title : '');
-
- var hook = new Hook(title, fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.enableTimeouts(this.enableTimeouts());
- hook.slow(this.slow());
- hook.ctx = this.ctx;
- this._afterAll.push(hook);
- this.emit('afterAll', hook);
- return this;
-};
-
-/**
- * Run `fn(test[, done])` before each test case.
- *
- * @param {Function} fn
- * @return {Suite} for chaining
- * @api private
- */
-
-Suite.prototype.beforeEach = function(title, fn){
- if (this.pending) return this;
- if ('function' === typeof title) {
- fn = title;
- title = fn.name;
- }
- title = '"before each" hook' + (title ? ': ' + title : '');
-
- var hook = new Hook(title, fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.enableTimeouts(this.enableTimeouts());
- hook.slow(this.slow());
- hook.ctx = this.ctx;
- this._beforeEach.push(hook);
- this.emit('beforeEach', hook);
- return this;
-};
-
-/**
- * Run `fn(test[, done])` after each test case.
- *
- * @param {Function} fn
- * @return {Suite} for chaining
- * @api private
- */
-
-Suite.prototype.afterEach = function(title, fn){
- if (this.pending) return this;
- if ('function' === typeof title) {
- fn = title;
- title = fn.name;
- }
- title = '"after each" hook' + (title ? ': ' + title : '');
-
- var hook = new Hook(title, fn);
- hook.parent = this;
- hook.timeout(this.timeout());
- hook.enableTimeouts(this.enableTimeouts());
- hook.slow(this.slow());
- hook.ctx = this.ctx;
- this._afterEach.push(hook);
- this.emit('afterEach', hook);
- return this;
-};
-
-/**
- * Add a test `suite`.
- *
- * @param {Suite} suite
- * @return {Suite} for chaining
- * @api private
- */
-
-Suite.prototype.addSuite = function(suite){
- suite.parent = this;
- suite.timeout(this.timeout());
- suite.enableTimeouts(this.enableTimeouts());
- suite.slow(this.slow());
- suite.bail(this.bail());
- this.suites.push(suite);
- this.emit('suite', suite);
- return this;
-};
-
-/**
- * Add a `test` to this suite.
- *
- * @param {Test} test
- * @return {Suite} for chaining
- * @api private
- */
-
-Suite.prototype.addTest = function(test){
- test.parent = this;
- test.timeout(this.timeout());
- test.enableTimeouts(this.enableTimeouts());
- test.slow(this.slow());
- test.ctx = this.ctx;
- this.tests.push(test);
- this.emit('test', test);
- return this;
-};
-
-/**
- * Return the full title generated by recursively
- * concatenating the parent's full title.
- *
- * @return {String}
- * @api public
- */
-
-Suite.prototype.fullTitle = function(){
- if (this.parent) {
- var full = this.parent.fullTitle();
- if (full) return full + ' ' + this.title;
- }
- return this.title;
-};
-
-/**
- * Return the total number of tests.
- *
- * @return {Number}
- * @api public
- */
-
-Suite.prototype.total = function(){
- return utils.reduce(this.suites, function(sum, suite){
- return sum + suite.total();
- }, 0) + this.tests.length;
-};
-
-/**
- * Iterates through each suite recursively to find
- * all tests. Applies a function in the format
- * `fn(test)`.
- *
- * @param {Function} fn
- * @return {Suite}
- * @api private
- */
-
-Suite.prototype.eachTest = function(fn){
- utils.forEach(this.tests, fn);
- utils.forEach(this.suites, function(suite){
- suite.eachTest(fn);
- });
- return this;
-};
-
-/**
- * This will run the root suite if we happen to be running in delayed mode.
- */
-Suite.prototype.run = function run() {
- if (this.root) {
- this.emit('run');
- }
-};
-
-}); // module: suite.js
-
-require.register("test.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var Runnable = require('./runnable');
-
-/**
- * Expose `Test`.
- */
-
-module.exports = Test;
-
-/**
- * Initialize a new `Test` with the given `title` and callback `fn`.
- *
- * @param {String} title
- * @param {Function} fn
- * @api private
- */
-
-function Test(title, fn) {
- Runnable.call(this, title, fn);
- this.pending = !fn;
- this.type = 'test';
-}
-
-/**
- * Inherit from `Runnable.prototype`.
- */
-
-function F(){};
-F.prototype = Runnable.prototype;
-Test.prototype = new F;
-Test.prototype.constructor = Test;
-
-
-}); // module: test.js
-
-require.register("utils.js", function(module, exports, require){
-/**
- * Module dependencies.
- */
-
-var fs = require('browser/fs')
- , path = require('browser/path')
- , basename = path.basename
- , exists = fs.existsSync || path.existsSync
- , glob = require('browser/glob')
- , join = path.join
- , debug = require('browser/debug')('mocha:watch');
-
-/**
- * Ignored directories.
- */
-
-var ignore = ['node_modules', '.git'];
-
-/**
- * Escape special characters in the given string of html.
- *
- * @param {String} html
- * @return {String}
- * @api private
- */
-
-exports.escape = function(html){
- return String(html)
- .replace(/&/g, '&amp;')
- .replace(/"/g, '&quot;')
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;');
-};
-
-/**
- * Array#forEach (<=IE8)
- *
- * @param {Array} array
- * @param {Function} fn
- * @param {Object} scope
- * @api private
- */
-
-exports.forEach = function(arr, fn, scope){
- for (var i = 0, l = arr.length; i < l; i++)
- fn.call(scope, arr[i], i);
-};
-
-/**
- * Array#map (<=IE8)
- *
- * @param {Array} array
- * @param {Function} fn
- * @param {Object} scope
- * @api private
- */
-
-exports.map = function(arr, fn, scope){
- var result = [];
- for (var i = 0, l = arr.length; i < l; i++)
- result.push(fn.call(scope, arr[i], i, arr));
- return result;
-};
-
-/**
- * Array#indexOf (<=IE8)
- *
- * @parma {Array} arr
- * @param {Object} obj to find index of
- * @param {Number} start
- * @api private
- */
-
-exports.indexOf = function(arr, obj, start){
- for (var i = start || 0, l = arr.length; i < l; i++) {
- if (arr[i] === obj)
- return i;
- }
- return -1;
-};
-
-/**
- * Array#reduce (<=IE8)
- *
- * @param {Array} array
- * @param {Function} fn
- * @param {Object} initial value
- * @api private
- */
-
-exports.reduce = function(arr, fn, val){
- var rval = val;
-
- for (var i = 0, l = arr.length; i < l; i++) {
- rval = fn(rval, arr[i], i, arr);
- }
-
- return rval;
-};
-
-/**
- * Array#filter (<=IE8)
- *
- * @param {Array} array
- * @param {Function} fn
- * @api private
- */
-
-exports.filter = function(arr, fn){
- var ret = [];
-
- for (var i = 0, l = arr.length; i < l; i++) {
- var val = arr[i];
- if (fn(val, i, arr)) ret.push(val);
- }
-
- return ret;
-};
-
-/**
- * Object.keys (<=IE8)
- *
- * @param {Object} obj
- * @return {Array} keys
- * @api private
- */
-
-exports.keys = Object.keys || function(obj) {
- var keys = []
- , has = Object.prototype.hasOwnProperty; // for `window` on <=IE8
-
- for (var key in obj) {
- if (has.call(obj, key)) {
- keys.push(key);
- }
- }
-
- return keys;
-};
-
-/**
- * Watch the given `files` for changes
- * and invoke `fn(file)` on modification.
- *
- * @param {Array} files
- * @param {Function} fn
- * @api private
- */
-
-exports.watch = function(files, fn){
- var options = { interval: 100 };
- files.forEach(function(file){
- debug('file %s', file);
- fs.watchFile(file, options, function(curr, prev){
- if (prev.mtime < curr.mtime) fn(file);
- });
- });
-};
-
-/**
- * Array.isArray (<=IE8)
- *
- * @param {Object} obj
- * @return {Boolean}
- * @api private
- */
-var isArray = Array.isArray || function (obj) {
- return '[object Array]' == {}.toString.call(obj);
-};
-
-/**
- * @description
- * Buffer.prototype.toJSON polyfill
- * @type {Function}
- */
-if(typeof Buffer !== 'undefined' && Buffer.prototype) {
- Buffer.prototype.toJSON = Buffer.prototype.toJSON || function () {
- return Array.prototype.slice.call(this, 0);
- };
-}
-
-/**
- * Ignored files.
- */
-
-function ignored(path){
- return !~ignore.indexOf(path);
-}
-
-/**
- * Lookup files in the given `dir`.
- *
- * @return {Array}
- * @api private
- */
-
-exports.files = function(dir, ext, ret){
- ret = ret || [];
- ext = ext || ['js'];
-
- var re = new RegExp('\\.(' + ext.join('|') + ')$');
-
- fs.readdirSync(dir)
- .filter(ignored)
- .forEach(function(path){
- path = join(dir, path);
- if (fs.statSync(path).isDirectory()) {
- exports.files(path, ext, ret);
- } else if (path.match(re)) {
- ret.push(path);
- }
- });
-
- return ret;
-};
-
-/**
- * Compute a slug from the given `str`.
- *
- * @param {String} str
- * @return {String}
- * @api private
- */
-
-exports.slug = function(str){
- return str
- .toLowerCase()
- .replace(/ +/g, '-')
- .replace(/[^-\w]/g, '');
-};
-
-/**
- * Strip the function definition from `str`,
- * and re-indent for pre whitespace.
- */
-
-exports.clean = function(str) {
- str = str
- .replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, '')
- .replace(/^function *\(.*\) *{|\(.*\) *=> *{?/, '')
- .replace(/\s+\}$/, '');
-
- var spaces = str.match(/^\n?( *)/)[1].length
- , tabs = str.match(/^\n?(\t*)/)[1].length
- , re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm');
-
- str = str.replace(re, '');
-
- return exports.trim(str);
-};
-
-/**
- * Trim the given `str`.
- *
- * @param {String} str
- * @return {String}
- * @api private
- */
-
-exports.trim = function(str){
- return str.replace(/^\s+|\s+$/g, '');
-};
-
-/**
- * Parse the given `qs`.
- *
- * @param {String} qs
- * @return {Object}
- * @api private
- */
-
-exports.parseQuery = function(qs){
- return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair){
- var i = pair.indexOf('=')
- , key = pair.slice(0, i)
- , val = pair.slice(++i);
-
- obj[key] = decodeURIComponent(val);
- return obj;
- }, {});
-};
-
-/**
- * Highlight the given string of `js`.
- *
- * @param {String} js
- * @return {String}
- * @api private
- */
-
-function highlight(js) {
- return js
- .replace(/</g, '&lt;')
- .replace(/>/g, '&gt;')
- .replace(/\/\/(.*)/gm, '<span class="comment">//$1</span>')
- .replace(/('.*?')/gm, '<span class="string">$1</span>')
- .replace(/(\d+\.\d+)/gm, '<span class="number">$1</span>')
- .replace(/(\d+)/gm, '<span class="number">$1</span>')
- .replace(/\bnew[ \t]+(\w+)/gm, '<span class="keyword">new</span> <span class="init">$1</span>')
- .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '<span class="keyword">$1</span>')
-}
-
-/**
- * Highlight the contents of tag `name`.
- *
- * @param {String} name
- * @api private
- */
-
-exports.highlightTags = function(name) {
- var code = document.getElementById('mocha').getElementsByTagName(name);
- for (var i = 0, len = code.length; i < len; ++i) {
- code[i].innerHTML = highlight(code[i].innerHTML);
- }
-};
-
-/**
- * If a value could have properties, and has none, this function is called, which returns
- * a string representation of the empty value.
- *
- * Functions w/ no properties return `'[Function]'`
- * Arrays w/ length === 0 return `'[]'`
- * Objects w/ no properties return `'{}'`
- * All else: return result of `value.toString()`
- *
- * @param {*} value Value to inspect
- * @param {string} [type] The type of the value, if known.
- * @returns {string}
- */
-var emptyRepresentation = function emptyRepresentation(value, type) {
- type = type || exports.type(value);
-
- switch(type) {
- case 'function':
- return '[Function]';
- case 'object':
- return '{}';
- case 'array':
- return '[]';
- default:
- return value.toString();
- }
-};
-
-/**
- * Takes some variable and asks `{}.toString()` what it thinks it is.
- * @param {*} value Anything
- * @example
- * type({}) // 'object'
- * type([]) // 'array'
- * type(1) // 'number'
- * type(false) // 'boolean'
- * type(Infinity) // 'number'
- * type(null) // 'null'
- * type(new Date()) // 'date'
- * type(/foo/) // 'regexp'
- * type('type') // 'string'
- * type(global) // 'global'
- * @api private
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
- * @returns {string}
- */
-exports.type = function type(value) {
- if (typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) {
- return 'buffer';
- }
- return Object.prototype.toString.call(value)
- .replace(/^\[.+\s(.+?)\]$/, '$1')
- .toLowerCase();
-};
-
-/**
- * @summary Stringify `value`.
- * @description Different behavior depending on type of value.
- * - If `value` is undefined or null, return `'[undefined]'` or `'[null]'`, respectively.
- * - If `value` is not an object, function or array, return result of `value.toString()` wrapped in double-quotes.
- * - If `value` is an *empty* object, function, or array, return result of function
- * {@link emptyRepresentation}.
- * - If `value` has properties, call {@link exports.canonicalize} on it, then return result of
- * JSON.stringify().
- *
- * @see exports.type
- * @param {*} value
- * @return {string}
- * @api private
- */
-
-exports.stringify = function(value) {
- var type = exports.type(value);
-
- if (!~exports.indexOf(['object', 'array', 'function'], type)) {
- if(type != 'buffer') {
- return jsonStringify(value);
- }
- var json = value.toJSON();
- // Based on the toJSON result
- return jsonStringify(json.data && json.type ? json.data : json, 2)
- .replace(/,(\n|$)/g, '$1');
- }
-
- for (var prop in value) {
- if (Object.prototype.hasOwnProperty.call(value, prop)) {
- return jsonStringify(exports.canonicalize(value), 2).replace(/,(\n|$)/g, '$1');
- }
- }
-
- return emptyRepresentation(value, type);
-};
-
-/**
- * @description
- * like JSON.stringify but more sense.
- * @param {Object} object
- * @param {Number=} spaces
- * @param {number=} depth
- * @returns {*}
- * @private
- */
-function jsonStringify(object, spaces, depth) {
- if(typeof spaces == 'undefined') return _stringify(object); // primitive types
-
- depth = depth || 1;
- var space = spaces * depth
- , str = isArray(object) ? '[' : '{'
- , end = isArray(object) ? ']' : '}'
- , length = object.length || exports.keys(object).length
- , repeat = function(s, n) { return new Array(n).join(s); }; // `.repeat()` polyfill
-
- function _stringify(val) {
- switch (exports.type(val)) {
- case 'null':
- case 'undefined':
- val = '[' + val + ']';
- break;
- case 'array':
- case 'object':
- val = jsonStringify(val, spaces, depth + 1);
- break;
- case 'boolean':
- case 'regexp':
- case 'number':
- val = val === 0 && (1/val) === -Infinity // `-0`
- ? '-0'
- : val.toString();
- break;
- case 'date':
- val = '[Date: ' + val.toISOString() + ']';
- break;
- case 'buffer':
- var json = val.toJSON();
- // Based on the toJSON result
- json = json.data && json.type ? json.data : json;
- val = '[Buffer: ' + jsonStringify(json, 2, depth + 1) + ']';
- break;
- default:
- val = (val == '[Function]' || val == '[Circular]')
- ? val
- : '"' + val + '"'; //string
- }
- return val;
- }
-
- for(var i in object) {
- if(!object.hasOwnProperty(i)) continue; // not my business
- --length;
- str += '\n ' + repeat(' ', space)
- + (isArray(object) ? '' : '"' + i + '": ') // key
- + _stringify(object[i]) // value
- + (length ? ',' : ''); // comma
- }
-
- return str + (str.length != 1 // [], {}
- ? '\n' + repeat(' ', --space) + end
- : end);
-}
-
-/**
- * Return if obj is a Buffer
- * @param {Object} arg
- * @return {Boolean}
- * @api private
- */
-exports.isBuffer = function (arg) {
- return typeof Buffer !== 'undefined' && Buffer.isBuffer(arg);
-};
-
-/**
- * @summary Return a new Thing that has the keys in sorted order. Recursive.
- * @description If the Thing...
- * - has already been seen, return string `'[Circular]'`
- * - is `undefined`, return string `'[undefined]'`
- * - is `null`, return value `null`
- * - is some other primitive, return the value
- * - is not a primitive or an `Array`, `Object`, or `Function`, return the value of the Thing's `toString()` method
- * - is a non-empty `Array`, `Object`, or `Function`, return the result of calling this function again.
- * - is an empty `Array`, `Object`, or `Function`, return the result of calling `emptyRepresentation()`
- *
- * @param {*} value Thing to inspect. May or may not have properties.
- * @param {Array} [stack=[]] Stack of seen values
- * @return {(Object|Array|Function|string|undefined)}
- * @see {@link exports.stringify}
- * @api private
- */
-
-exports.canonicalize = function(value, stack) {
- var canonicalizedObj,
- type = exports.type(value),
- prop,
- withStack = function withStack(value, fn) {
- stack.push(value);
- fn();
- stack.pop();
- };
-
- stack = stack || [];
-
- if (exports.indexOf(stack, value) !== -1) {
- return '[Circular]';
- }
-
- switch(type) {
- case 'undefined':
- case 'buffer':
- case 'null':
- canonicalizedObj = value;
- break;
- case 'array':
- withStack(value, function () {
- canonicalizedObj = exports.map(value, function (item) {
- return exports.canonicalize(item, stack);
- });
- });
- break;
- case 'function':
- for (prop in value) {
- canonicalizedObj = {};
- break;
- }
- if (!canonicalizedObj) {
- canonicalizedObj = emptyRepresentation(value, type);
- break;
- }
- /* falls through */
- case 'object':
- canonicalizedObj = canonicalizedObj || {};
- withStack(value, function () {
- exports.forEach(exports.keys(value).sort(), function (key) {
- canonicalizedObj[key] = exports.canonicalize(value[key], stack);
- });
- });
- break;
- case 'date':
- case 'number':
- case 'regexp':
- case 'boolean':
- canonicalizedObj = value;
- break;
- default:
- canonicalizedObj = value.toString();
- }
-
- return canonicalizedObj;
-};
-
-/**
- * Lookup file names at the given `path`.
- */
-exports.lookupFiles = function lookupFiles(path, extensions, recursive) {
- var files = [];
- var re = new RegExp('\\.(' + extensions.join('|') + ')$');
-
- if (!exists(path)) {
- if (exists(path + '.js')) {
- path += '.js';
- } else {
- files = glob.sync(path);
- if (!files.length) throw new Error("cannot resolve path (or pattern) '" + path + "'");
- return files;
- }
- }
-
- try {
- var stat = fs.statSync(path);
- if (stat.isFile()) return path;
- }
- catch (ignored) {
- return;
- }
-
- fs.readdirSync(path).forEach(function(file) {
- file = join(path, file);
- try {
- var stat = fs.statSync(file);
- if (stat.isDirectory()) {
- if (recursive) {
- files = files.concat(lookupFiles(file, extensions, recursive));
- }
- return;
- }
- }
- catch (ignored) {
- return;
- }
- if (!stat.isFile() || !re.test(file) || basename(file)[0] === '.') return;
- files.push(file);
- });
-
- return files;
-};
-
-/**
- * Generate an undefined error with a message warning the user.
- *
- * @return {Error}
- */
-
-exports.undefinedError = function() {
- return new Error('Caught undefined error, did you throw without specifying what?');
-};
-
-/**
- * Generate an undefined error if `err` is not defined.
- *
- * @param {Error} err
- * @return {Error}
- */
-
-exports.getError = function(err) {
- return err || exports.undefinedError();
-};
-
-
-/**
- * @summary
- * This Filter based on `mocha-clean` module.(see: `github.com/rstacruz/mocha-clean`)
- * @description
- * When invoking this function you get a filter function that get the Error.stack as an input,
- * and return a prettify output.
- * (i.e: strip Mocha, node_modules, bower and componentJS from stack trace).
- * @returns {Function}
- */
-
-exports.stackTraceFilter = function() {
- var slash = '/'
- , is = typeof document === 'undefined'
- ? { node: true }
- : { browser: true }
- , cwd = is.node
- ? process.cwd() + slash
- : location.href.replace(/\/[^\/]*$/, '/');
-
- function isNodeModule (line) {
- return (~line.indexOf('node_modules'));
- }
-
- function isMochaInternal (line) {
- return (~line.indexOf('node_modules' + slash + 'mocha')) ||
- (~line.indexOf('components' + slash + 'mochajs')) ||
- (~line.indexOf('components' + slash + 'mocha'));
- }
-
- // node_modules, bower, componentJS
- function isBrowserModule(line) {
- return (~line.indexOf('node_modules')) ||
- (~line.indexOf('components'));
- }
-
- function isNodeInternal (line) {
- return (~line.indexOf('(timers.js:')) ||
- (~line.indexOf('(events.js:')) ||
- (~line.indexOf('(node.js:')) ||
- (~line.indexOf('(module.js:')) ||
- (~line.indexOf('GeneratorFunctionPrototype.next (native)')) ||
- false
- }
-
- return function(stack) {
- stack = stack.split('\n');
-
- stack = stack.reduce(function (list, line) {
- if (is.node && (isNodeModule(line) ||
- isMochaInternal(line) ||
- isNodeInternal(line)))
- return list;
-
- if (is.browser && (isBrowserModule(line)))
- return list;
-
- // Clean up cwd(absolute)
- list.push(line.replace(cwd, ''));
- return list;
- }, []);
-
- return stack.join('\n');
- }
-};
-}); // module: utils.js
-// The global object is "self" in Web Workers.
-var global = (function() { return this; })();
-
-/**
- * Save timer references to avoid Sinon interfering (see GH-237).
- */
-
-var Date = global.Date;
-var setTimeout = global.setTimeout;
-var setInterval = global.setInterval;
-var clearTimeout = global.clearTimeout;
-var clearInterval = global.clearInterval;
-
-/**
- * Node shims.
- *
- * These are meant only to allow
- * mocha.js to run untouched, not
- * to allow running node code in
- * the browser.
- */
-
-var process = {};
-process.exit = function(status){};
-process.stdout = {};
-
-var uncaughtExceptionHandlers = [];
-
-var originalOnerrorHandler = global.onerror;
-
-/**
- * Remove uncaughtException listener.
- * Revert to original onerror handler if previously defined.
- */
-
-process.removeListener = function(e, fn){
- if ('uncaughtException' == e) {
- if (originalOnerrorHandler) {
- global.onerror = originalOnerrorHandler;
- } else {
- global.onerror = function() {};
- }
- var i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn);
- if (i != -1) { uncaughtExceptionHandlers.splice(i, 1); }
- }
-};
-
-/**
- * Implements uncaughtException listener.
- */
-
-process.on = function(e, fn){
- if ('uncaughtException' == e) {
- global.onerror = function(err, url, line){
- fn(new Error(err + ' (' + url + ':' + line + ')'));
- return true;
- };
- uncaughtExceptionHandlers.push(fn);
- }
-};
-
-/**
- * Expose mocha.
- */
-
-var Mocha = global.Mocha = require('mocha'),
- mocha = global.mocha = new Mocha({ reporter: 'html' });
-
-// The BDD UI is registered by default, but no UI will be functional in the
-// browser without an explicit call to the overridden `mocha.ui` (see below).
-// Ensure that this default UI does not expose its methods to the global scope.
-mocha.suite.removeAllListeners('pre-require');
-
-var immediateQueue = []
- , immediateTimeout;
-
-function timeslice() {
- var immediateStart = new Date().getTime();
- while (immediateQueue.length && (new Date().getTime() - immediateStart) < 100) {
- immediateQueue.shift()();
- }
- if (immediateQueue.length) {
- immediateTimeout = setTimeout(timeslice, 0);
- } else {
- immediateTimeout = null;
- }
-}
-
-/**
- * High-performance override of Runner.immediately.
- */
-
-Mocha.Runner.immediately = function(callback) {
- immediateQueue.push(callback);
- if (!immediateTimeout) {
- immediateTimeout = setTimeout(timeslice, 0);
- }
-};
-
-/**
- * Function to allow assertion libraries to throw errors directly into mocha.
- * This is useful when running tests in a browser because window.onerror will
- * only receive the 'message' attribute of the Error.
- */
-mocha.throwError = function(err) {
- Mocha.utils.forEach(uncaughtExceptionHandlers, function (fn) {
- fn(err);
- });
- throw err;
-};
-
-/**
- * Override ui to ensure that the ui functions are initialized.
- * Normally this would happen in Mocha.prototype.loadFiles.
- */
-
-mocha.ui = function(ui){
- Mocha.prototype.ui.call(this, ui);
- this.suite.emit('pre-require', global, null, this);
- return this;
-};
-
-/**
- * Setup mocha with the given setting options.
- */
-
-mocha.setup = function(opts){
- if ('string' == typeof opts) opts = { ui: opts };
- for (var opt in opts) {
- if (opts.hasOwnProperty(opt)) {
- this[opt](opts[opt]);
- }
- }
- return this;
-};
-
-/**
- * Run mocha, returning the Runner.
- */
-
-mocha.run = function(fn){
- var options = mocha.options;
- mocha.globals('location');
-
- var query = Mocha.utils.parseQuery(global.location.search || '');
- if (query.grep) mocha.grep(new RegExp(query.grep));
- if (query.fgrep) mocha.grep(query.fgrep);
- if (query.invert) mocha.invert();
-
- return Mocha.prototype.run.call(mocha, function(err){
- // The DOM Document is not available in Web Workers.
- var document = global.document;
- if (document && document.getElementById('mocha') && options.noHighlighting !== true) {
- Mocha.utils.highlightTags('code');
- }
- if (fn) fn(err);
- });
-};
-
-/**
- * Expose the process shim.
- */
-
-Mocha.process = process;
-})();
diff --git a/chromium/third_party/catapult/tracing/third_party/symbols/README.chromium b/chromium/third_party/catapult/tracing/third_party/symbols/README.chromium
deleted file mode 100644
index b50ed33a8e4..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/symbols/README.chromium
+++ /dev/null
@@ -1,21 +0,0 @@
-Name: symbols module from Chromium
-URL: https://chromium.googlesource.com/chromium/src.git
-License: BSD
-
-Description:
-
-Originally added to src/build/android/pylib/symbols by Primiano Tucci:
-
-commit eb3ad0de43537c5bff297326b11b121c77cc18e6
-Author: primiano@chromium.org
-Date: Mon Feb 24 19:23:59 2014 +0000
-
- Add fast ELF Symbolizer to memory_inspector.
-
- This CL introduces a multiprocess, pipelined and asynchronous ELF
- symbolizer (based on addr2line) which gives honor to a bulkly workstation
- when symbolizing large batches of symbols.
-
- BUG=340294,339059
-
- Review URL: https://codereview.chromium.org/167893009
diff --git a/chromium/third_party/catapult/tracing/third_party/symbols/symbols/PRESUBMIT.py b/chromium/third_party/catapult/tracing/third_party/symbols/symbols/PRESUBMIT.py
deleted file mode 100644
index b4d94ae225b..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/symbols/symbols/PRESUBMIT.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-def CommonChecks(input_api, output_api):
- output = []
- output.extend(input_api.canned_checks.RunPylint(input_api, output_api))
- output.extend(input_api.canned_checks.RunUnitTestsInDirectory(
- input_api,
- output_api,
- input_api.PresubmitLocalPath(),
- whitelist=[r'^.+_unittest\.py$']))
- return output
-
-
-def CheckChangeOnUpload(input_api, output_api):
- return CommonChecks(input_api, output_api)
-
-
-def CheckChangeOnCommit(input_api, output_api):
- return CommonChecks(input_api, output_api) \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/third_party/symbols/symbols/__init__.py b/chromium/third_party/catapult/tracing/third_party/symbols/symbols/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/symbols/symbols/__init__.py
+++ /dev/null
diff --git a/chromium/third_party/catapult/tracing/third_party/symbols/symbols/elf_symbolizer.py b/chromium/third_party/catapult/tracing/third_party/symbols/symbols/elf_symbolizer.py
deleted file mode 100644
index 374063a57f8..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/symbols/symbols/elf_symbolizer.py
+++ /dev/null
@@ -1,467 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import collections
-import datetime
-import logging
-import multiprocessing
-import os
-import posixpath
-import Queue
-import re
-import subprocess
-import sys
-import threading
-import time
-
-
-# addr2line builds a possibly infinite memory cache that can exhaust
-# the computer's memory if allowed to grow for too long. This constant
-# controls how many lookups we do before restarting the process. 4000
-# gives near peak performance without extreme memory usage.
-ADDR2LINE_RECYCLE_LIMIT = 4000
-
-
-class ELFSymbolizer(object):
- """An uber-fast (multiprocessing, pipelined and asynchronous) ELF symbolizer.
-
- This class is a frontend for addr2line (part of GNU binutils), designed to
- symbolize batches of large numbers of symbols for a given ELF file. It
- supports sharding symbolization against many addr2line instances and
- pipelining of multiple requests per each instance (in order to hide addr2line
- internals and OS pipe latencies).
-
- The interface exhibited by this class is a very simple asynchronous interface,
- which is based on the following three methods:
- - SymbolizeAsync(): used to request (enqueue) resolution of a given address.
- - The |callback| method: used to communicated back the symbol information.
- - Join(): called to conclude the batch to gather the last outstanding results.
- In essence, before the Join method returns, this class will have issued as
- many callbacks as the number of SymbolizeAsync() calls. In this regard, note
- that due to multiprocess sharding, callbacks can be delivered out of order.
-
- Some background about addr2line:
- - it is invoked passing the elf path in the cmdline, piping the addresses in
- its stdin and getting results on its stdout.
- - it has pretty large response times for the first requests, but it
- works very well in streaming mode once it has been warmed up.
- - it doesn't scale by itself (on more cores). However, spawning multiple
- instances at the same time on the same file is pretty efficient as they
- keep hitting the pagecache and become mostly CPU bound.
- - it might hang or crash, mostly for OOM. This class deals with both of these
- problems.
-
- Despite the "scary" imports and the multi* words above, (almost) no multi-
- threading/processing is involved from the python viewpoint. Concurrency
- here is achieved by spawning several addr2line subprocesses and handling their
- output pipes asynchronously. Therefore, all the code here (with the exception
- of the Queue instance in Addr2Line) should be free from mind-blowing
- thread-safety concerns.
-
- The multiprocess sharding works as follows:
- The symbolizer tries to use the lowest number of addr2line instances as
- possible (with respect of |max_concurrent_jobs|) and enqueue all the requests
- in a single addr2line instance. For few symbols (i.e. dozens) sharding isn't
- worth the startup cost.
- The multiprocess logic kicks in as soon as the queues for the existing
- instances grow. Specifically, once all the existing instances reach the
- |max_queue_size| bound, a new addr2line instance is kicked in.
- In the case of a very eager producer (i.e. all |max_concurrent_jobs| instances
- have a backlog of |max_queue_size|), back-pressure is applied on the caller by
- blocking the SymbolizeAsync method.
-
- This module has been deliberately designed to be dependency free (w.r.t. of
- other modules in this project), to allow easy reuse in external projects.
- """
-
- def __init__(self, elf_file_path, addr2line_path, callback, inlines=False,
- max_concurrent_jobs=None, addr2line_timeout=30, max_queue_size=50,
- source_root_path=None, strip_base_path=None):
- """Args:
- elf_file_path: path of the elf file to be symbolized.
- addr2line_path: path of the toolchain's addr2line binary.
- callback: a callback which will be invoked for each resolved symbol with
- the two args (sym_info, callback_arg). The former is an instance of
- |ELFSymbolInfo| and contains the symbol information. The latter is an
- embedder-provided argument which is passed to SymbolizeAsync().
- inlines: when True, the ELFSymbolInfo will contain also the details about
- the outer inlining functions. When False, only the innermost function
- will be provided.
- max_concurrent_jobs: Max number of addr2line instances spawned.
- Parallelize responsibly, addr2line is a memory and I/O monster.
- max_queue_size: Max number of outstanding requests per addr2line instance.
- addr2line_timeout: Max time (in seconds) to wait for a addr2line response.
- After the timeout, the instance will be considered hung and respawned.
- source_root_path: In some toolchains only the name of the source file is
- is output, without any path information; disambiguation searches
- through the source directory specified by |source_root_path| argument
- for files whose name matches, adding the full path information to the
- output. For example, if the toolchain outputs "unicode.cc" and there
- is a file called "unicode.cc" located under |source_root_path|/foo,
- the tool will replace "unicode.cc" with
- "|source_root_path|/foo/unicode.cc". If there are multiple files with
- the same name, disambiguation will fail because the tool cannot
- determine which of the files was the source of the symbol.
- strip_base_path: Rebases the symbols source paths onto |source_root_path|
- (i.e replace |strip_base_path| with |source_root_path).
- """
- assert(os.path.isfile(addr2line_path)), 'Cannot find ' + addr2line_path
- self.elf_file_path = elf_file_path
- self.addr2line_path = addr2line_path
- self.callback = callback
- self.inlines = inlines
- self.max_concurrent_jobs = (max_concurrent_jobs or
- min(multiprocessing.cpu_count(), 4))
- self.max_queue_size = max_queue_size
- self.addr2line_timeout = addr2line_timeout
- self.requests_counter = 0 # For generating monotonic request IDs.
- self._a2l_instances = [] # Up to |max_concurrent_jobs| _Addr2Line inst.
-
- # If necessary, create disambiguation lookup table
- self.disambiguate = source_root_path is not None
- self.disambiguation_table = {}
- self.strip_base_path = strip_base_path
- if(self.disambiguate):
- self.source_root_path = os.path.abspath(source_root_path)
- self._CreateDisambiguationTable()
-
- # Create one addr2line instance. More instances will be created on demand
- # (up to |max_concurrent_jobs|) depending on the rate of the requests.
- self._CreateNewA2LInstance()
-
- def SymbolizeAsync(self, addr, callback_arg=None):
- """Requests symbolization of a given address.
-
- This method is not guaranteed to return immediately. It generally does, but
- in some scenarios (e.g. all addr2line instances have full queues) it can
- block to create back-pressure.
-
- Args:
- addr: address to symbolize.
- callback_arg: optional argument which will be passed to the |callback|."""
- assert(isinstance(addr, int))
-
- # Process all the symbols that have been resolved in the meanwhile.
- # Essentially, this drains all the addr2line(s) out queues.
- for a2l_to_purge in self._a2l_instances:
- a2l_to_purge.ProcessAllResolvedSymbolsInQueue()
- a2l_to_purge.RecycleIfNecessary()
-
- # Find the best instance according to this logic:
- # 1. Find an existing instance with the shortest queue.
- # 2. If all of instances' queues are full, but there is room in the pool,
- # (i.e. < |max_concurrent_jobs|) create a new instance.
- # 3. If there were already |max_concurrent_jobs| instances and all of them
- # had full queues, make back-pressure.
-
- # 1.
- def _SortByQueueSizeAndReqID(a2l):
- return (a2l.queue_size, a2l.first_request_id)
- a2l = min(self._a2l_instances, key=_SortByQueueSizeAndReqID)
-
- # 2.
- if (a2l.queue_size >= self.max_queue_size and
- len(self._a2l_instances) < self.max_concurrent_jobs):
- a2l = self._CreateNewA2LInstance()
-
- # 3.
- if a2l.queue_size >= self.max_queue_size:
- a2l.WaitForNextSymbolInQueue()
-
- a2l.EnqueueRequest(addr, callback_arg)
-
- def Join(self):
- """Waits for all the outstanding requests to complete and terminates."""
- for a2l in self._a2l_instances:
- a2l.WaitForIdle()
- a2l.Terminate()
-
- def _CreateNewA2LInstance(self):
- assert(len(self._a2l_instances) < self.max_concurrent_jobs)
- a2l = ELFSymbolizer.Addr2Line(self)
- self._a2l_instances.append(a2l)
- return a2l
-
- def _CreateDisambiguationTable(self):
- """ Non-unique file names will result in None entries"""
- start_time = time.time()
- logging.info('Collecting information about available source files...')
- self.disambiguation_table = {}
-
- for root, _, filenames in os.walk(self.source_root_path):
- for f in filenames:
- self.disambiguation_table[f] = os.path.join(root, f) if (f not in
- self.disambiguation_table) else None
- logging.info('Finished collecting information about '
- 'possible files (took %.1f s).',
- (time.time() - start_time))
-
-
- class Addr2Line(object):
- """A python wrapper around an addr2line instance.
-
- The communication with the addr2line process looks as follows:
- [STDIN] [STDOUT] (from addr2line's viewpoint)
- > f001111
- > f002222
- < Symbol::Name(foo, bar) for f001111
- < /path/to/source/file.c:line_number
- > f003333
- < Symbol::Name2() for f002222
- < /path/to/source/file.c:line_number
- < Symbol::Name3() for f003333
- < /path/to/source/file.c:line_number
- """
-
- SYM_ADDR_RE = re.compile(r'([^:]+):(\?|\d+).*')
-
- def __init__(self, symbolizer):
- self._symbolizer = symbolizer
- self._lib_file_name = posixpath.basename(symbolizer.elf_file_path)
-
- # The request queue (i.e. addresses pushed to addr2line's stdin and not
- # yet retrieved on stdout)
- self._request_queue = collections.deque()
-
- # This is essentially len(self._request_queue). It has been optimized to a
- # separate field because turned out to be a perf hot-spot.
- self.queue_size = 0
-
- # Keep track of the number of symbols a process has processed to
- # avoid a single process growing too big and using all the memory.
- self._processed_symbols_count = 0
-
- # Objects required to handle the addr2line subprocess.
- self._proc = None # Subprocess.Popen(...) instance.
- self._thread = None # Threading.thread instance.
- self._out_queue = None # Queue.Queue instance (for buffering a2l stdout).
- self._RestartAddr2LineProcess()
-
- def EnqueueRequest(self, addr, callback_arg):
- """Pushes an address to addr2line's stdin (and keeps track of it)."""
- self._symbolizer.requests_counter += 1 # For global "age" of requests.
- req_idx = self._symbolizer.requests_counter
- self._request_queue.append((addr, callback_arg, req_idx))
- self.queue_size += 1
- self._WriteToA2lStdin(addr)
-
- def WaitForIdle(self):
- """Waits until all the pending requests have been symbolized."""
- while self.queue_size > 0:
- self.WaitForNextSymbolInQueue()
-
- def WaitForNextSymbolInQueue(self):
- """Waits for the next pending request to be symbolized."""
- if not self.queue_size:
- return
-
- # This outer loop guards against a2l hanging (detecting stdout timeout).
- while True:
- start_time = datetime.datetime.now()
- timeout = datetime.timedelta(seconds=self._symbolizer.addr2line_timeout)
-
- # The inner loop guards against a2l crashing (checking if it exited).
- while (datetime.datetime.now() - start_time < timeout):
- # poll() returns !None if the process exited. a2l should never exit.
- if self._proc.poll():
- logging.warning('addr2line crashed, respawning (lib: %s).' %
- self._lib_file_name)
- self._RestartAddr2LineProcess()
- # TODO(primiano): the best thing to do in this case would be
- # shrinking the pool size as, very likely, addr2line is crashed
- # due to low memory (and the respawned one will die again soon).
-
- try:
- lines = self._out_queue.get(block=True, timeout=0.25)
- except Queue.Empty:
- # On timeout (1/4 s.) repeat the inner loop and check if either the
- # addr2line process did crash or we waited its output for too long.
- continue
-
- # In nominal conditions, we get straight to this point.
- self._ProcessSymbolOutput(lines)
- return
-
- # If this point is reached, we waited more than |addr2line_timeout|.
- logging.warning('Hung addr2line process, respawning (lib: %s).' %
- self._lib_file_name)
- self._RestartAddr2LineProcess()
-
- def ProcessAllResolvedSymbolsInQueue(self):
- """Consumes all the addr2line output lines produced (without blocking)."""
- if not self.queue_size:
- return
- while True:
- try:
- lines = self._out_queue.get_nowait()
- except Queue.Empty:
- break
- self._ProcessSymbolOutput(lines)
-
- def RecycleIfNecessary(self):
- """Restarts the process if it has been used for too long.
-
- A long running addr2line process will consume excessive amounts
- of memory without any gain in performance."""
- if self._processed_symbols_count >= ADDR2LINE_RECYCLE_LIMIT:
- self._RestartAddr2LineProcess()
-
-
- def Terminate(self):
- """Kills the underlying addr2line process.
-
- The poller |_thread| will terminate as well due to the broken pipe."""
- try:
- self._proc.kill()
- self._proc.communicate() # Essentially wait() without risking deadlock.
- except Exception: # An exception while terminating? How interesting.
- pass
- self._proc = None
-
- def _WriteToA2lStdin(self, addr):
- self._proc.stdin.write('%s\n' % hex(addr))
- if self._symbolizer.inlines:
- # In the case of inlines we output an extra blank line, which causes
- # addr2line to emit a (??,??:0) tuple that we use as a boundary marker.
- self._proc.stdin.write('\n')
- self._proc.stdin.flush()
-
- def _ProcessSymbolOutput(self, lines):
- """Parses an addr2line symbol output and triggers the client callback."""
- (_, callback_arg, _) = self._request_queue.popleft()
- self.queue_size -= 1
-
- innermost_sym_info = None
- sym_info = None
- for (line1, line2) in lines:
- prev_sym_info = sym_info
- name = line1 if not line1.startswith('?') else None
- source_path = None
- source_line = None
- m = ELFSymbolizer.Addr2Line.SYM_ADDR_RE.match(line2)
- if m:
- if not m.group(1).startswith('?'):
- source_path = m.group(1)
- if not m.group(2).startswith('?'):
- source_line = int(m.group(2))
- else:
- logging.warning('Got invalid symbol path from addr2line: %s' % line2)
-
- # In case disambiguation is on, and needed
- was_ambiguous = False
- disambiguated = False
- if self._symbolizer.disambiguate:
- if source_path and not posixpath.isabs(source_path):
- path = self._symbolizer.disambiguation_table.get(source_path)
- was_ambiguous = True
- disambiguated = path is not None
- source_path = path if disambiguated else source_path
-
- # Use absolute paths (so that paths are consistent, as disambiguation
- # uses absolute paths)
- if source_path and not was_ambiguous:
- source_path = os.path.abspath(source_path)
-
- if source_path and self._symbolizer.strip_base_path:
- # Strip the base path
- source_path = re.sub('^' + self._symbolizer.strip_base_path,
- self._symbolizer.source_root_path or '', source_path)
-
- sym_info = ELFSymbolInfo(name, source_path, source_line, was_ambiguous,
- disambiguated)
- if prev_sym_info:
- prev_sym_info.inlined_by = sym_info
- if not innermost_sym_info:
- innermost_sym_info = sym_info
-
- self._processed_symbols_count += 1
- self._symbolizer.callback(innermost_sym_info, callback_arg)
-
- def _RestartAddr2LineProcess(self):
- if self._proc:
- self.Terminate()
-
- # The only reason of existence of this Queue (and the corresponding
- # Thread below) is the lack of a subprocess.stdout.poll_avail_lines().
- # Essentially this is a pipe able to extract a couple of lines atomically.
- self._out_queue = Queue.Queue()
-
- # Start the underlying addr2line process in line buffered mode.
-
- cmd = [self._symbolizer.addr2line_path, '--functions', '--demangle',
- '--exe=' + self._symbolizer.elf_file_path]
- if self._symbolizer.inlines:
- cmd += ['--inlines']
- self._proc = subprocess.Popen(cmd, bufsize=1, stdout=subprocess.PIPE,
- stdin=subprocess.PIPE, stderr=sys.stderr, close_fds=True)
-
- # Start the poller thread, which simply moves atomically the lines read
- # from the addr2line's stdout to the |_out_queue|.
- self._thread = threading.Thread(
- target=ELFSymbolizer.Addr2Line.StdoutReaderThread,
- args=(self._proc.stdout, self._out_queue, self._symbolizer.inlines))
- self._thread.daemon = True # Don't prevent early process exit.
- self._thread.start()
-
- self._processed_symbols_count = 0
-
- # Replay the pending requests on the new process (only for the case
- # of a hung addr2line timing out during the game).
- for (addr, _, _) in self._request_queue:
- self._WriteToA2lStdin(addr)
-
- @staticmethod
- def StdoutReaderThread(process_pipe, queue, inlines):
- """The poller thread fn, which moves the addr2line stdout to the |queue|.
-
- This is the only piece of code not running on the main thread. It merely
- writes to a Queue, which is thread-safe. In the case of inlines, it
- detects the ??,??:0 marker and sends the lines atomically, such that the
- main thread always receives all the lines corresponding to one symbol in
- one shot."""
- try:
- lines_for_one_symbol = []
- while True:
- line1 = process_pipe.readline().rstrip('\r\n')
- line2 = process_pipe.readline().rstrip('\r\n')
- if not line1 or not line2:
- break
- inline_has_more_lines = inlines and (len(lines_for_one_symbol) == 0 or
- (line1 != '??' and line2 != '??:0'))
- if not inlines or inline_has_more_lines:
- lines_for_one_symbol += [(line1, line2)]
- if inline_has_more_lines:
- continue
- queue.put(lines_for_one_symbol)
- lines_for_one_symbol = []
- process_pipe.close()
-
- # Every addr2line processes will die at some point, please die silently.
- except (IOError, OSError):
- pass
-
- @property
- def first_request_id(self):
- """Returns the request_id of the oldest pending request in the queue."""
- return self._request_queue[0][2] if self._request_queue else 0
-
-
-class ELFSymbolInfo(object):
- """The result of the symbolization passed as first arg. of each callback."""
-
- def __init__(self, name, source_path, source_line, was_ambiguous=False,
- disambiguated=False):
- """All the fields here can be None (if addr2line replies with '??')."""
- self.name = name
- self.source_path = source_path
- self.source_line = source_line
- # In the case of |inlines|=True, the |inlined_by| points to the outer
- # function inlining the current one (and so on, to form a chain).
- self.inlined_by = None
- self.disambiguated = disambiguated
- self.was_ambiguous = was_ambiguous
-
- def __str__(self):
- return '%s [%s:%d]' % (
- self.name or '??', self.source_path or '??', self.source_line or 0)
diff --git a/chromium/third_party/catapult/tracing/third_party/symbols/symbols/elf_symbolizer_unittest.py b/chromium/third_party/catapult/tracing/third_party/symbols/symbols/elf_symbolizer_unittest.py
deleted file mode 100755
index d7978aba0f8..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/symbols/symbols/elf_symbolizer_unittest.py
+++ /dev/null
@@ -1,174 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import functools
-import logging
-import os
-import sys
-import unittest
-
-sys.path.insert(0, os.path.dirname(__file__))
-# pylint: disable=relative-import
-import elf_symbolizer
-import mock_addr2line
-
-
-_MOCK_A2L_PATH = os.path.join(os.path.dirname(mock_addr2line.__file__),
- 'mock_addr2line')
-_INCOMPLETE_MOCK_ADDR = 1024 * 1024
-_UNKNOWN_MOCK_ADDR = 2 * 1024 * 1024
-_INLINE_MOCK_ADDR = 3 * 1024 * 1024
-
-
-class ELFSymbolizerTest(unittest.TestCase):
- def setUp(self):
- self._callback = functools.partial(
- ELFSymbolizerTest._SymbolizeCallback, self)
- self._resolved_addresses = set()
- # Mute warnings, we expect them due to the crash/hang tests.
- logging.getLogger().setLevel(logging.ERROR)
-
- def testParallelism1(self):
- self._RunTest(max_concurrent_jobs=1, num_symbols=100)
-
- def testParallelism4(self):
- self._RunTest(max_concurrent_jobs=4, num_symbols=100)
-
- def testParallelism8(self):
- self._RunTest(max_concurrent_jobs=8, num_symbols=100)
-
- def testCrash(self):
- os.environ['MOCK_A2L_CRASH_EVERY'] = '99'
- self._RunTest(max_concurrent_jobs=1, num_symbols=100)
- os.environ['MOCK_A2L_CRASH_EVERY'] = '0'
-
- def testHang(self):
- os.environ['MOCK_A2L_HANG_EVERY'] = '99'
- self._RunTest(max_concurrent_jobs=1, num_symbols=100)
- os.environ['MOCK_A2L_HANG_EVERY'] = '0'
-
- def testInlines(self):
- """Stimulate the inline processing logic."""
- symbolizer = elf_symbolizer.ELFSymbolizer(
- elf_file_path='/path/doesnt/matter/mock_lib1.so',
- addr2line_path=_MOCK_A2L_PATH,
- callback=self._callback,
- inlines=True,
- max_concurrent_jobs=4)
-
- for addr in xrange(1000):
- exp_inline = False
- exp_unknown = False
-
- # First 100 addresses with inlines.
- if addr < 100:
- addr += _INLINE_MOCK_ADDR
- exp_inline = True
-
- # Followed by 100 without inlines.
- elif addr < 200:
- pass
-
- # Followed by 100 interleaved inlines and not inlines.
- elif addr < 300:
- if addr & 1:
- addr += _INLINE_MOCK_ADDR
- exp_inline = True
-
- # Followed by 100 interleaved inlines and unknonwn.
- elif addr < 400:
- if addr & 1:
- addr += _INLINE_MOCK_ADDR
- exp_inline = True
- else:
- addr += _UNKNOWN_MOCK_ADDR
- exp_unknown = True
-
- exp_name = 'mock_sym_for_addr_%d' % addr if not exp_unknown else None
- exp_source_path = 'mock_src/mock_lib1.so.c' if not exp_unknown else None
- exp_source_line = addr if not exp_unknown else None
- cb_arg = (addr, exp_name, exp_source_path, exp_source_line, exp_inline)
- symbolizer.SymbolizeAsync(addr, cb_arg)
-
- symbolizer.Join()
-
- def testIncompleteSyminfo(self):
- """Stimulate the symbol-not-resolved logic."""
- symbolizer = elf_symbolizer.ELFSymbolizer(
- elf_file_path='/path/doesnt/matter/mock_lib1.so',
- addr2line_path=_MOCK_A2L_PATH,
- callback=self._callback,
- max_concurrent_jobs=1)
-
- # Test symbols with valid name but incomplete path.
- addr = _INCOMPLETE_MOCK_ADDR
- exp_name = 'mock_sym_for_addr_%d' % addr
- exp_source_path = None
- exp_source_line = None
- cb_arg = (addr, exp_name, exp_source_path, exp_source_line, False)
- symbolizer.SymbolizeAsync(addr, cb_arg)
-
- # Test symbols with no name or sym info.
- addr = _UNKNOWN_MOCK_ADDR
- exp_name = None
- exp_source_path = None
- exp_source_line = None
- cb_arg = (addr, exp_name, exp_source_path, exp_source_line, False)
- symbolizer.SymbolizeAsync(addr, cb_arg)
-
- symbolizer.Join()
-
- def _RunTest(self, max_concurrent_jobs, num_symbols):
- symbolizer = elf_symbolizer.ELFSymbolizer(
- elf_file_path='/path/doesnt/matter/mock_lib1.so',
- addr2line_path=_MOCK_A2L_PATH,
- callback=self._callback,
- max_concurrent_jobs=max_concurrent_jobs,
- addr2line_timeout=0.5)
-
- for addr in xrange(num_symbols):
- exp_name = 'mock_sym_for_addr_%d' % addr
- exp_source_path = 'mock_src/mock_lib1.so.c'
- exp_source_line = addr
- cb_arg = (addr, exp_name, exp_source_path, exp_source_line, False)
- symbolizer.SymbolizeAsync(addr, cb_arg)
-
- symbolizer.Join()
-
- # Check that all the expected callbacks have been received.
- for addr in xrange(num_symbols):
- self.assertIn(addr, self._resolved_addresses)
- self._resolved_addresses.remove(addr)
-
- # Check for unexpected callbacks.
- self.assertEqual(len(self._resolved_addresses), 0)
-
- def _SymbolizeCallback(self, sym_info, cb_arg):
- self.assertTrue(isinstance(sym_info, elf_symbolizer.ELFSymbolInfo))
- self.assertTrue(isinstance(cb_arg, tuple))
- self.assertEqual(len(cb_arg), 5)
-
- # Unpack expectations from the callback extra argument.
- (addr, exp_name, exp_source_path, exp_source_line, exp_inlines) = cb_arg
- if exp_name is None:
- self.assertIsNone(sym_info.name)
- else:
- self.assertTrue(sym_info.name.startswith(exp_name))
- self.assertEqual(sym_info.source_path, exp_source_path)
- self.assertEqual(sym_info.source_line, exp_source_line)
-
- if exp_inlines:
- self.assertEqual(sym_info.name, exp_name + '_inner')
- self.assertEqual(sym_info.inlined_by.name, exp_name + '_middle')
- self.assertEqual(sym_info.inlined_by.inlined_by.name,
- exp_name + '_outer')
-
- # Check against duplicate callbacks.
- self.assertNotIn(addr, self._resolved_addresses)
- self._resolved_addresses.add(addr)
-
-
-if __name__ == '__main__':
- unittest.main()
diff --git a/chromium/third_party/catapult/tracing/third_party/symbols/symbols/mock_addr2line/__init__.py b/chromium/third_party/catapult/tracing/third_party/symbols/symbols/mock_addr2line/__init__.py
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/symbols/symbols/mock_addr2line/__init__.py
+++ /dev/null
diff --git a/chromium/third_party/catapult/tracing/third_party/symbols/symbols/mock_addr2line/mock_addr2line b/chromium/third_party/catapult/tracing/third_party/symbols/symbols/mock_addr2line/mock_addr2line
deleted file mode 100755
index 5544359ad60..00000000000
--- a/chromium/third_party/catapult/tracing/third_party/symbols/symbols/mock_addr2line/mock_addr2line
+++ /dev/null
@@ -1,83 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Simple mock for addr2line.
-
-Outputs mock symbol information, with each symbol being a function of the
-original address (so it is easy to double-check consistency in unittests).
-"""
-
-import optparse
-import os
-import posixpath
-import sys
-import time
-
-
-def main(argv):
- parser = optparse.OptionParser()
- parser.add_option('-e', '--exe', dest='exe') # Path of the debug-library.so.
- # Silently swallow the other unnecessary arguments.
- parser.add_option('-C', '--demangle', action='store_true')
- parser.add_option('-f', '--functions', action='store_true')
- parser.add_option('-i', '--inlines', action='store_true')
- options, _ = parser.parse_args(argv[1:])
- lib_file_name = posixpath.basename(options.exe)
- processed_sym_count = 0
- crash_every = int(os.environ.get('MOCK_A2L_CRASH_EVERY', 0))
- hang_every = int(os.environ.get('MOCK_A2L_HANG_EVERY', 0))
-
- while(True):
- line = sys.stdin.readline().rstrip('\r')
- if not line:
- break
-
- # An empty line should generate '??,??:0' (is used as marker for inlines).
- if line == '\n':
- print '??'
- print '??:0'
- sys.stdout.flush()
- continue
-
- addr = int(line, 16)
- processed_sym_count += 1
- if crash_every and processed_sym_count % crash_every == 0:
- sys.exit(1)
- if hang_every and processed_sym_count % hang_every == 0:
- time.sleep(1)
-
- # Addresses < 1M will return good mock symbol information.
- if addr < 1024 * 1024:
- print 'mock_sym_for_addr_%d' % addr
- print 'mock_src/%s.c:%d' % (lib_file_name, addr)
-
- # Addresses 1M <= x < 2M will return symbols with a name but a missing path.
- elif addr < 2 * 1024 * 1024:
- print 'mock_sym_for_addr_%d' % addr
- print '??:0'
-
- # Addresses 2M <= x < 3M will return unknown symbol information.
- elif addr < 3 * 1024 * 1024:
- print '??'
- print '??'
-
- # Addresses 3M <= x < 4M will return inlines.
- elif addr < 4 * 1024 * 1024:
- print 'mock_sym_for_addr_%d_inner' % addr
- print 'mock_src/%s.c:%d' % (lib_file_name, addr)
- print 'mock_sym_for_addr_%d_middle' % addr
- print 'mock_src/%s.c:%d' % (lib_file_name, addr)
- print 'mock_sym_for_addr_%d_outer' % addr
- print 'mock_src/%s.c:%d' % (lib_file_name, addr)
-
- else:
- print 'mock_sym_for_addr_%d' % addr
- print 'mock_src/%s.c:%d' % (lib_file_name, addr)
-
- sys.stdout.flush()
-
-
-if __name__ == '__main__':
- main(sys.argv) \ No newline at end of file
diff --git a/chromium/third_party/catapult/tracing/tracing/__init__.py b/chromium/third_party/catapult/tracing/tracing/__init__.py
deleted file mode 100644
index 76063aae790..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/__init__.py
+++ /dev/null
@@ -1,6 +0,0 @@
-# Copyright (c) 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import tracing_project
-tracing_project.UpdateSysPathIfNeeded()
diff --git a/chromium/third_party/catapult/tracing/tracing/base/base.html b/chromium/third_party/catapult/tracing/tracing/base/base.html
deleted file mode 100644
index 9c9254b6c7f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/base.html
+++ /dev/null
@@ -1,194 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<script>
-'use strict';
-
-/**
- * The global object.
- * @type {!Object}
- * @const
- */
-var global = this;
-
-/** Platform, package, object property, and Event support. */
-this.tr = (function() {
- if (global.tr) {
- console.warn('Base was multiply initialized. First init wins.');
- return global.tr;
- }
-
- /**
- * Builds an object structure for the provided namespace path,
- * ensuring that names that already exist are not overwritten. For
- * example:
- * 'a.b.c' -> a = {};a.b={};a.b.c={};
- * @param {string} name Name of the object that this file defines.
- * @private
- */
- function exportPath(name) {
- var parts = name.split('.');
- var cur = global;
-
- for (var part; parts.length && (part = parts.shift());) {
- if (part in cur) {
- cur = cur[part];
- } else {
- cur = cur[part] = {};
- }
- }
- return cur;
- };
-
- function isExported(name) {
- var parts = name.split('.');
- var cur = global;
-
- for (var part; parts.length && (part = parts.shift());) {
- if (part in cur) {
- cur = cur[part];
- } else {
- return false;
- }
- }
- return true;
- }
-
- function isDefined(name) {
- var parts = name.split('.');
-
- var curObject = global;
-
- for (var i = 0; i < parts.length; i++) {
- var partName = parts[i];
- var nextObject = curObject[partName];
- if (nextObject === undefined)
- return false;
- curObject = nextObject;
- }
- return true;
- }
-
- var panicElement = undefined;
- var rawPanicMessages = [];
- function showPanicElementIfNeeded() {
- if (panicElement)
- return;
-
- var panicOverlay = document.createElement('div');
- panicOverlay.style.backgroundColor = 'white';
- panicOverlay.style.border = '3px solid red';
- panicOverlay.style.boxSizing = 'border-box';
- panicOverlay.style.color = 'black';
- panicOverlay.style.display = '-webkit-flex';
- panicOverlay.style.height = '100%';
- panicOverlay.style.left = 0;
- panicOverlay.style.padding = '8px';
- panicOverlay.style.position = 'fixed';
- panicOverlay.style.top = 0;
- panicOverlay.style.webkitFlexDirection = 'column';
- panicOverlay.style.width = '100%';
-
- panicElement = document.createElement('div');
- panicElement.style.webkitFlex = '1 1 auto';
- panicElement.style.overflow = 'auto';
- panicOverlay.appendChild(panicElement);
-
- if (!document.body) {
- setTimeout(function() {
- document.body.appendChild(panicOverlay);
- }, 150);
- } else {
- document.body.appendChild(panicOverlay);
- }
- }
-
- function showPanic(panicTitle, panicDetails) {
- if (tr.isHeadless) {
- if (panicDetails instanceof Error)
- throw panicDetails;
- throw new Error('Panic: ' + panicTitle + ':\n' + panicDetails);
- }
-
- if (panicDetails instanceof Error)
- panicDetails = panicDetails.stack;
-
- showPanicElementIfNeeded();
- var panicMessageEl = document.createElement('div');
- panicMessageEl.innerHTML =
- '<h2 id="message"></h2>' +
- '<pre id="details"></pre>';
- panicMessageEl.querySelector('#message').textContent = panicTitle;
- panicMessageEl.querySelector('#details').textContent = panicDetails;
- panicElement.appendChild(panicMessageEl);
-
- rawPanicMessages.push({
- title: panicTitle,
- details: panicDetails
- });
- }
-
- function hasPanic() {
- return rawPanicMessages.length !== 0;
- }
- function getPanicText() {
- return rawPanicMessages.map(function(msg) {
- return msg.title;
- }).join(', ');
- }
-
- function exportTo(namespace, fn) {
- var obj = exportPath(namespace);
- var exports = fn();
-
- for (var propertyName in exports) {
- // Maybe we should check the prototype chain here? The current usage
- // pattern is always using an object literal so we only care about own
- // properties.
- var propertyDescriptor = Object.getOwnPropertyDescriptor(exports,
- propertyName);
- if (propertyDescriptor)
- Object.defineProperty(obj, propertyName, propertyDescriptor);
- }
- };
-
- /**
- * Initialization which must be deferred until run-time.
- */
- function initialize() {
- if (global.isVinn) {
- tr.isVinn = true;
- } else if (global.process && global.process.versions.node) {
- tr.isNode = true;
- } else {
- tr.isVinn = false;
- tr.isNode = false;
- tr.doc = document;
-
- tr.isMac = /Mac/.test(navigator.platform);
- tr.isWindows = /Win/.test(navigator.platform);
- tr.isChromeOS = /CrOS/.test(navigator.userAgent);
- tr.isLinux = /Linux/.test(navigator.userAgent);
- }
- tr.isHeadless = tr.isVinn || tr.isNode;
- }
-
- return {
- initialize: initialize,
-
- exportTo: exportTo,
- isExported: isExported,
- isDefined: isDefined,
-
- showPanic: showPanic,
- hasPanic: hasPanic,
- getPanicText: getPanicText
- };
-})();
-
-tr.initialize();
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/base64.html b/chromium/third_party/catapult/tracing/tracing/base/base64.html
deleted file mode 100644
index bceb821c49e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/base64.html
+++ /dev/null
@@ -1,94 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
-
- function Base64() {
- }
-
- function b64ToUint6(nChr) {
- if (nChr > 64 && nChr < 91)
- return nChr - 65;
- if (nChr > 96 && nChr < 123)
- return nChr - 71;
- if (nChr > 47 && nChr < 58)
- return nChr + 4;
- if (nChr === 43)
- return 62;
- if (nChr === 47)
- return 63;
- return 0;
- }
-
- Base64.getDecodedBufferLength = function(input) {
- return input.length * 3 + 1 >> 2;
- };
-
- Base64.EncodeArrayBufferToString = function(input) {
- // http://stackoverflow.com/questions/9267899/
- var binary = '';
- var bytes = new Uint8Array(input);
- var len = bytes.byteLength;
- for (var i = 0; i < len; i++)
- binary += String.fromCharCode(bytes[i]);
- return btoa(binary);
- };
-
- Base64.DecodeToTypedArray = function(input, output) {
-
- var nInLen = input.length;
- var nOutLen = nInLen * 3 + 1 >> 2;
- var nMod3 = 0;
- var nMod4 = 0;
- var nUint24 = 0;
- var nOutIdx = 0;
-
- if (nOutLen > output.byteLength)
- throw new Error('Output buffer too small to decode.');
-
- for (var nInIdx = 0; nInIdx < nInLen; nInIdx++) {
- nMod4 = nInIdx & 3;
- nUint24 |= b64ToUint6(input.charCodeAt(nInIdx)) << 18 - 6 * nMod4;
- if (nMod4 === 3 || nInLen - nInIdx === 1) {
- for (nMod3 = 0; nMod3 < 3 && nOutIdx < nOutLen; nMod3++, nOutIdx++) {
- output.setUint8(nOutIdx, nUint24 >>> (16 >>> nMod3 & 24) & 255);
- }
- nUint24 = 0;
- }
- }
- return nOutIdx - 1;
- };
-
- /*
- * Wrapper of btoa
- * The reason is that window object has a builtin btoa,
- * but we also want to use btoa when it is headless.
- * For example we want to use it in a mapper
- */
- Base64.btoa = function(input) {
- return btoa(input);
- };
-
- /*
- * Wrapper of atob
- * The reason is that window object has a builtin atob,
- * but we also want to use atob when it is headless.
- * For example we want to use it in a mapper
- */
- Base64.atob = function(input) {
- return atob(input);
- };
-
- return {
- Base64: Base64
- };
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/base64_test.html b/chromium/third_party/catapult/tracing/tracing/base/base64_test.html
deleted file mode 100644
index a2b46d80ad9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/base64_test.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base64.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('getDecodedLength', function() {
- assert.isTrue(tr.b.Base64.getDecodedBufferLength('YQ==') >= 1);
- assert.isTrue(tr.b.Base64.getDecodedBufferLength('YWJjZA==') >= 4);
- assert.isTrue(tr.b.Base64.getDecodedBufferLength('YWJjZGVm') >= 6);
- });
-
- test('DecodeToTypedArray', function() {
- var buffer = new DataView(new ArrayBuffer(256));
- tr.b.Base64.DecodeToTypedArray('YQ==', buffer);
- assert.equal(buffer.getInt8(0), 97);
-
- tr.b.Base64.DecodeToTypedArray('YWJjZA==', buffer);
- for (var i = 0; i < 4; i++)
- assert.equal(buffer.getInt8(i), 97 + i);
-
- tr.b.Base64.DecodeToTypedArray('YWJjZGVm', buffer);
- for (var i = 0; i < 4; i++)
- assert.equal(buffer.getInt8(i), 97 + i);
- });
-
- test('DecodeLengthReturn', function() {
- var buffer = new DataView(new ArrayBuffer(256));
- var len = tr.b.Base64.DecodeToTypedArray(btoa('hello'), buffer);
- assert.equal(len, 5);
- });
-
- test('Base64.atob', function() {
- var output = tr.b.Base64.atob('aGVsbG8gd29ybGQ=');
- assert.equal(output, 'hello world');
- });
-
- test('Base64.btoa', function() {
- var output = tr.b.Base64.btoa('hello world');
- assert.equal(output, 'aGVsbG8gd29ybGQ=');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/bbox2.html b/chromium/third_party/catapult/tracing/tracing/base/bbox2.html
deleted file mode 100644
index 639a7a3e9f3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/bbox2.html
+++ /dev/null
@@ -1,158 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/math.html">
-<link rel="import" href="/tracing/base/rect.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview 2D bounding box computations.
- */
-tr.exportTo('tr.b', function() {
-
- /**
- * Tracks a 2D bounding box.
- * @constructor
- */
- function BBox2() {
- this.isEmpty_ = true;
- this.min_ = undefined;
- this.max_ = undefined;
- };
-
- BBox2.prototype = {
- __proto__: Object.prototype,
-
- reset: function() {
- this.isEmpty_ = true;
- this.min_ = undefined;
- this.max_ = undefined;
- },
-
- get isEmpty() {
- return this.isEmpty_;
- },
-
- addBBox2: function(bbox2) {
- if (bbox2.isEmpty)
- return;
- this.addVec2(bbox2.min_);
- this.addVec2(bbox2.max_);
- },
-
- clone: function() {
- var bbox = new BBox2();
- bbox.addBBox2(this);
- return bbox;
- },
-
- /**
- * Adds x, y to the range.
- */
- addXY: function(x, y) {
- if (this.isEmpty_) {
- this.max_ = vec2.create();
- this.min_ = vec2.create();
- vec2.set(this.max_, x, y);
- vec2.set(this.min_, x, y);
- this.isEmpty_ = false;
- return;
- }
- this.max_[0] = Math.max(this.max_[0], x);
- this.max_[1] = Math.max(this.max_[1], y);
- this.min_[0] = Math.min(this.min_[0], x);
- this.min_[1] = Math.min(this.min_[1], y);
- },
-
- /**
- * Adds value_x, value_y in the form [value_x,value_y] to the range.
- */
- addVec2: function(value) {
- if (this.isEmpty_) {
- this.max_ = vec2.create();
- this.min_ = vec2.create();
- vec2.set(this.max_, value[0], value[1]);
- vec2.set(this.min_, value[0], value[1]);
- this.isEmpty_ = false;
- return;
- }
- this.max_[0] = Math.max(this.max_[0], value[0]);
- this.max_[1] = Math.max(this.max_[1], value[1]);
- this.min_[0] = Math.min(this.min_[0], value[0]);
- this.min_[1] = Math.min(this.min_[1], value[1]);
- },
-
- addQuad: function(quad) {
- this.addVec2(quad.p1);
- this.addVec2(quad.p2);
- this.addVec2(quad.p3);
- this.addVec2(quad.p4);
- },
-
- get minVec2() {
- if (this.isEmpty_)
- return undefined;
- return this.min_;
- },
-
- get maxVec2() {
- if (this.isEmpty_)
- return undefined;
- return this.max_;
- },
-
- get sizeAsVec2() {
- if (this.isEmpty_)
- throw new Error('Empty BBox2 has no size');
- var size = vec2.create();
- vec2.subtract(size, this.max_, this.min_);
- return size;
- },
-
- get size() {
- if (this.isEmpty_)
- throw new Error('Empty BBox2 has no size');
- return {width: this.max_[0] - this.min_[0],
- height: this.max_[1] - this.min_[1]};
- },
-
- get width() {
- if (this.isEmpty_)
- throw new Error('Empty BBox2 has no width');
- return this.max_[0] - this.min_[0];
- },
-
- get height() {
- if (this.isEmpty_)
- throw new Error('Empty BBox2 has no width');
- return this.max_[1] - this.min_[1];
- },
-
- toString: function() {
- if (this.isEmpty_)
- return 'empty';
- return 'min=(' + this.min_[0] + ',' + this.min_[1] + ') ' +
- 'max=(' + this.max_[0] + ',' + this.max_[1] + ')';
- },
-
- asRect: function() {
- return tr.b.Rect.fromXYWH(
- this.min_[0],
- this.min_[1],
- this.max_[0] - this.min_[0],
- this.max_[1] - this.min_[1]);
- }
- };
-
- return {
- BBox2: BBox2
- };
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/bbox2_test.html b/chromium/third_party/catapult/tracing/tracing/base/bbox2_test.html
deleted file mode 100644
index 156c25e176c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/bbox2_test.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/bbox2.html">
-<script>
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('addVec2', function() {
- var bbox = new tr.b.BBox2();
- var x = vec2.create();
- vec2.set(x, 10, 10);
- bbox.addVec2(x);
- assert.equal(bbox.minVec2[0], 10);
- assert.equal(bbox.minVec2[1], 10);
- assert.equal(bbox.maxVec2[0], 10);
- assert.equal(bbox.maxVec2[1], 10);
-
- // Mutate x.
- vec2.set(x, 11, 11);
-
- // Bbox shouldn't have changed.
- assert.equal(bbox.minVec2[0], 10);
- assert.equal(bbox.minVec2[1], 10);
- assert.equal(bbox.maxVec2[0], 10);
- assert.equal(bbox.maxVec2[1], 10);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/category_util.html b/chromium/third_party/catapult/tracing/tracing/base/category_util.html
deleted file mode 100644
index 71fd210dd7e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/category_util.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-/**
- * @fileoverview Helper code for working with tracing categories.
- *
- */
-tr.exportTo('tr.b', function() {
-
- // Cached values for getCategoryParts.
- var categoryPartsFor = {};
-
- /**
- * Categories are stored in comma-separated form, e.g: 'a,b' meaning
- * that the event is part of the a and b category.
- *
- * This function returns the category split by string, caching the
- * array for performance.
- *
- * Do not mutate the returned array!!!!
- */
- function getCategoryParts(category) {
- var parts = categoryPartsFor[category];
- if (parts !== undefined)
- return parts;
- parts = category.split(',');
- categoryPartsFor[category] = parts;
- return parts;
- }
-
- return {
- getCategoryParts: getCategoryParts
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/color.html b/chromium/third_party/catapult/tracing/tracing/base/color.html
deleted file mode 100644
index 586706b6977..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/color.html
+++ /dev/null
@@ -1,252 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
- function clamp01(value) {
- return Math.max(0, Math.min(1, value));
- }
-
- function Color(opt_r, opt_g, opt_b, opt_a) {
- this.r = Math.floor(opt_r) || 0;
- this.g = Math.floor(opt_g) || 0;
- this.b = Math.floor(opt_b) || 0;
- this.a = opt_a;
- }
-
- Color.fromString = function(str) {
- var tmp;
- var values;
- if (str.substr(0, 4) == 'rgb(') {
- tmp = str.substr(4, str.length - 5);
- values = tmp.split(',').map(function(v) {
- return v.replace(/^\s+/, '', 'g');
- });
- if (values.length != 3)
- throw new Error('Malformatted rgb-expression');
- return new Color(
- parseInt(values[0]),
- parseInt(values[1]),
- parseInt(values[2]));
- } else if (str.substr(0, 5) == 'rgba(') {
- tmp = str.substr(5, str.length - 6);
- values = tmp.split(',').map(function(v) {
- return v.replace(/^\s+/, '', 'g');
- });
- if (values.length != 4)
- throw new Error('Malformatted rgb-expression');
- return new Color(
- parseInt(values[0]),
- parseInt(values[1]),
- parseInt(values[2]),
- parseFloat(values[3]));
- } else if (str[0] == '#' && str.length == 7) {
- return new Color(
- parseInt(str.substr(1, 2), 16),
- parseInt(str.substr(3, 2), 16),
- parseInt(str.substr(5, 2), 16));
- } else {
- throw new Error('Unrecognized string format.');
- }
- };
-
- Color.lerp = function(a, b, percent) {
- if (a.a !== undefined && b.a !== undefined)
- return Color.lerpRGBA(a, b, percent);
- return Color.lerpRGB(a, b, percent);
- };
-
- Color.lerpRGB = function(a, b, percent) {
- return new Color(
- ((b.r - a.r) * percent) + a.r,
- ((b.g - a.g) * percent) + a.g,
- ((b.b - a.b) * percent) + a.b);
- };
-
- Color.lerpRGBA = function(a, b, percent) {
- return new Color(
- ((b.r - a.r) * percent) + a.r,
- ((b.g - a.g) * percent) + a.g,
- ((b.b - a.b) * percent) + a.b,
- ((b.a - a.a) * percent) + a.a);
- };
-
- Color.fromDict = function(dict) {
- return new Color(dict.r, dict.g, dict.b, dict.a);
- };
-
- /**
- * Converts an HSL triplet with alpha to an RGB color.
- * |h| Hue value in [0, 1].
- * |s| Saturation value in [0, 1].
- * |l| Lightness in [0, 1].
- * |a| Alpha in [0, 1]
- */
- Color.fromHSLExplicit = function(h, s, l, a) {
- var r, g, b;
- function hue2rgb(p, q, t) {
- if (t < 0) t += 1;
- if (t > 1) t -= 1;
- if (t < 1 / 6) return p + (q - p) * 6 * t;
- if (t < 1 / 2) return q;
- if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
- return p;
- }
-
- if (s === 0) {
- r = g = b = l;
- } else {
- var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
- var p = 2 * l - q;
- r = hue2rgb(p, q, h + 1 / 3);
- g = hue2rgb(p, q, h);
- b = hue2rgb(p, q, h - 1 / 3);
- }
-
- return new Color(Math.floor(r * 255),
- Math.floor(g * 255),
- Math.floor(b * 255), a);
- }
-
- Color.fromHSL = function(hsl) {
- return Color.fromHSLExplicit(hsl.h, hsl.s, hsl.l, hsl.a);
- }
-
- Color.prototype = {
- clone: function() {
- var c = new Color();
- c.r = this.r;
- c.g = this.g;
- c.b = this.b;
- c.a = this.a;
- return c;
- },
-
- blendOver: function(bgColor) {
- var oneMinusThisAlpha = 1 - this.a;
- var outA = this.a + bgColor.a * oneMinusThisAlpha;
- var bgBlend = (bgColor.a * oneMinusThisAlpha) / bgColor.a;
- return new Color(
- this.r * this.a + bgColor.r * bgBlend,
- this.g * this.a + bgColor.g * bgBlend,
- this.b * this.a + bgColor.b * bgBlend,
- outA);
- },
-
- brighten: function(opt_k) {
- var k;
- k = opt_k || 0.45;
-
- return new Color(
- Math.min(255, this.r + Math.floor(this.r * k)),
- Math.min(255, this.g + Math.floor(this.g * k)),
- Math.min(255, this.b + Math.floor(this.b * k)),
- this.a);
- },
-
- lighten: function(k, opt_max_l) {
- var max_l = opt_max_l !== undefined ? opt_max_l : 1.0;
- var hsl = this.toHSL();
- hsl.l = clamp01(hsl.l + k);
- return Color.fromHSL(hsl);
- },
-
- darken: function(opt_k) {
- var k;
- if (opt_k !== undefined)
- k = opt_k;
- else
- k = 0.45;
-
- return new Color(
- Math.min(255, this.r - Math.floor(this.r * k)),
- Math.min(255, this.g - Math.floor(this.g * k)),
- Math.min(255, this.b - Math.floor(this.b * k)),
- this.a);
- },
-
- desaturate: function(opt_desaturateFactor) {
- var desaturateFactor;
- if (opt_desaturateFactor !== undefined)
- desaturateFactor = opt_desaturateFactor;
- else
- desaturateFactor = 1;
-
- var hsl = this.toHSL();
- hsl.s = clamp01(hsl.s * (1 - desaturateFactor));
- return Color.fromHSL(hsl);
- },
-
- withAlpha: function(a) {
- return new Color(this.r, this.g, this.b, a);
- },
-
- toString: function() {
- if (this.a !== undefined) {
- return 'rgba(' +
- this.r + ',' + this.g + ',' +
- this.b + ',' + this.a + ')';
- }
- return 'rgb(' + this.r + ',' + this.g + ',' + this.b + ')';
- },
-
- /**
- * Returns a dict {h, s, l, a} with:
- * |h| Hue value in [0, 1].
- * |s| Saturation value in [0, 1].
- * |l| Lightness in [0, 1].
- * |a| Alpha in [0, 1]
- */
- toHSL: function() {
- var r = this.r / 255;
- var g = this.g / 255;
- var b = this.b / 255;
-
- var max = Math.max(r, g, b);
- var min = Math.min(r, g, b);
-
- var h, s;
- var l = (max + min) / 2;
- if (min === max) {
- h = 0;
- s = 0;
- } else {
- var delta = max - min;
- if (l > 0.5)
- s = delta / (2 - max - min);
- else
- s = delta / (max + min);
-
- if (r === max) {
- h = (g - b) / delta;
- if (g < b)
- h += 6;
- } else if (g === max) {
- h = 2 + ((b - r) / delta);
- } else {
- h = 4 + ((r - g) / delta);
- }
- h /= 6;
- }
-
- return {h: h, s: s, l: l, a: this.a};
- },
-
- toStringWithAlphaOverride: function(alpha) {
- return 'rgba(' +
- this.r + ',' + this.g + ',' +
- this.b + ',' + alpha + ')';
- }
- };
-
- return {
- Color: Color
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/color_scheme.html b/chromium/third_party/catapult/tracing/tracing/base/color_scheme.html
deleted file mode 100644
index 8ae4d745eb1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/color_scheme.html
+++ /dev/null
@@ -1,240 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/color.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides color scheme related functions.
- */
-tr.exportTo('tr.b', function() {
- // Basic constants...
- var generalPurposeColors = [
- new tr.b.Color(122, 98, 135),
- new tr.b.Color(150, 83, 105),
- new tr.b.Color(44, 56, 189),
- new tr.b.Color(99, 86, 147),
- new tr.b.Color(104, 129, 107),
- new tr.b.Color(130, 178, 55),
- new tr.b.Color(87, 109, 147),
- new tr.b.Color(111, 145, 88),
- new tr.b.Color(81, 152, 131),
- new tr.b.Color(142, 91, 111),
- new tr.b.Color(81, 163, 70),
- new tr.b.Color(148, 94, 86),
- new tr.b.Color(144, 89, 118),
- new tr.b.Color(83, 150, 97),
- new tr.b.Color(105, 94, 139),
- new tr.b.Color(89, 144, 122),
- new tr.b.Color(105, 119, 128),
- new tr.b.Color(96, 128, 137),
- new tr.b.Color(145, 88, 145),
- new tr.b.Color(88, 145, 144),
- new tr.b.Color(90, 100, 143),
- new tr.b.Color(121, 97, 136),
- new tr.b.Color(111, 160, 73),
- new tr.b.Color(112, 91, 142),
- new tr.b.Color(86, 147, 86),
- new tr.b.Color(63, 100, 170),
- new tr.b.Color(81, 152, 107),
- new tr.b.Color(60, 164, 173),
- new tr.b.Color(143, 72, 161),
- new tr.b.Color(159, 74, 86)];
-
- var reservedColorsByName = {
- thread_state_uninterruptible: new tr.b.Color(182, 125, 143),
- thread_state_iowait: new tr.b.Color(255, 140, 0),
- thread_state_running: new tr.b.Color(126, 200, 148),
- thread_state_runnable: new tr.b.Color(133, 160, 210),
- thread_state_sleeping: new tr.b.Color(240, 240, 240),
- thread_state_unknown: new tr.b.Color(199, 155, 125),
-
- light_memory_dump: new tr.b.Color(0, 0, 180),
- detailed_memory_dump: new tr.b.Color(180, 0, 180),
-
- generic_work: new tr.b.Color(125, 125, 125),
-
- good: new tr.b.Color(0, 125, 0),
- bad: new tr.b.Color(180, 125, 0),
- terrible: new tr.b.Color(180, 0, 0),
-
- black: new tr.b.Color(0, 0, 0),
-
- rail_response: new tr.b.Color(67, 135, 253),
- rail_animation: new tr.b.Color(244, 74, 63),
- rail_idle: new tr.b.Color(238, 142, 0),
- rail_load: new tr.b.Color(13, 168, 97),
- startup: new tr.b.Color(230, 230, 0),
-
- used_memory_column: new tr.b.Color(0, 0, 255),
- older_used_memory_column: new tr.b.Color(153, 204, 255),
- tracing_memory_column: new tr.b.Color(153, 153, 153),
-
- heap_dump_stack_frame: new tr.b.Color(128, 128, 128),
- heap_dump_object_type: new tr.b.Color(0, 0, 255),
-
- cq_build_running: new tr.b.Color(255, 255, 119),
- cq_build_passed: new tr.b.Color(153, 238, 102),
- cq_build_failed: new tr.b.Color(238, 136, 136),
- cq_build_abandoned: new tr.b.Color(187, 187, 187),
-
- cq_build_attempt_runnig: new tr.b.Color(222, 222, 75),
- cq_build_attempt_passed: new tr.b.Color(103, 218, 35),
- cq_build_attempt_failed: new tr.b.Color(197, 81, 81)
- };
-
- // Some constants we'll need for later lookups.
- var numGeneralPurposeColorIds = generalPurposeColors.length;
- var numReservedColorIds = tr.b.dictionaryLength(reservedColorsByName);
- var numColorsPerVariant = numGeneralPurposeColorIds + numReservedColorIds;
-
- function ColorScheme() {
- }
-
- /*
- * A flat array of tr.b.Color values of the palette, and their variants.
- *
- * This array is made up of a set of base colors, repeated N times to form
- * a set of variants on that base color.
- *
- * Within the base colors, there are "general purpose" colors,
- * which can be used for random color selection, and
- * reserved colors, which are used when specific colors
- * need to be used, e.g. where red is desired.
- *
- * The variants are automatically generated from the base colors. The 0th
- * variant is the default apeparance of the color, and the varaiants are
- * mutations of that color, e.g. several brightening levels and desaturations.
- *
- * For example, a very simple version of this array looks like the following:
- * 0: Generic Color 0
- * 1: Generic Color 1
- * 2: Named Color 'foo'
- * 3: Brightened Generic Color 0
- * 4: Brightened Generic Color 1
- * 5: Brightened Named Color 'foo'
- */
- var paletteBase = [];
- paletteBase.push.apply(paletteBase, generalPurposeColors);
- paletteBase.push.apply(paletteBase,
- tr.b.dictionaryValues(reservedColorsByName));
- ColorScheme.colors = [];
- ColorScheme.properties = {};
- ColorScheme.properties = {
- numColorsPerVariant: numColorsPerVariant
- };
-
- function pushVariant(func) {
- var variantColors = paletteBase.map(func);
- ColorScheme.colors.push.apply(ColorScheme.colors, variantColors);
- }
-
- // Basic colors.
- pushVariant(function(c) { return c; });
-
- // Brightened variants.
- ColorScheme.properties.brightenedOffsets = [];
- ColorScheme.properties.brightenedOffsets.push(ColorScheme.colors.length);
- pushVariant(function(c) {
- return c.lighten(0.3, 0.9);
- });
-
- ColorScheme.properties.brightenedOffsets.push(ColorScheme.colors.length);
- pushVariant(function(c) {
- return c.lighten(0.48, 0.9);
- });
-
- ColorScheme.properties.brightenedOffsets.push(ColorScheme.colors.length);
- pushVariant(function(c) {
- return c.lighten(0.65, 0.9);
- });
-
-
- // Desaturated variants.
- ColorScheme.properties.dimmedOffsets = [];
- ColorScheme.properties.dimmedOffsets.push(ColorScheme.colors.length);
- pushVariant(function(c) {
- return c.desaturate();
- });
- ColorScheme.properties.dimmedOffsets.push(ColorScheme.colors.length);
- pushVariant(function(c) {
- return c.desaturate(0.5);
- });
- ColorScheme.properties.dimmedOffsets.push(ColorScheme.colors.length);
- pushVariant(function(c) {
- return c.desaturate(0.3);
- });
-
- /**
- * A toString'd representation of ColorScheme.colors.
- */
- ColorScheme.colorsAsStrings = ColorScheme.colors.map(function(c) {
- return c.toString();
- });
-
- // Build reservedColorNameToIdMap.
- var reservedColorNameToIdMap = (function() {
- var m = {};
- var i = generalPurposeColors.length;
- tr.b.iterItems(reservedColorsByName, function(key, value) {
- m[key] = i++;
- });
- return m;
- })();
-
- /**
- * @param {String} name The color name.
- * @return {Number} The color ID for the given color name.
- */
- ColorScheme.getColorIdForReservedName = function(name) {
- var id = reservedColorNameToIdMap[name];
- if (id === undefined)
- throw new Error('Unrecognized color ') + name;
- return id;
- };
-
- ColorScheme.getColorForReservedNameAsString = function(reservedName) {
- var id = ColorScheme.getColorIdForReservedName(reservedName);
- return ColorScheme.colorsAsStrings[id];
- };
-
- /**
- * Computes a simplistic hashcode of the provide name. Used to chose colors
- * for slices.
- * @param {string} name The string to hash.
- */
- ColorScheme.getStringHash = function(name) {
- var hash = 0;
- for (var i = 0; i < name.length; ++i)
- hash = (hash + 37 * hash + 11 * name.charCodeAt(i)) % 0xFFFFFFFF;
- return hash;
- };
-
- // Previously computed string color IDs. They are based on a stable hash, so
- // it is safe to save them throughout the program time.
- var stringColorIdCache = {};
-
- /**
- * @return {Number} A color ID that is stably associated to the provided via
- * the getStringHash method. The color ID will be chosen from the general
- * purpose ID space only, e.g. no reserved ID will be used.
- */
- ColorScheme.getColorIdForGeneralPurposeString = function(string) {
- if (stringColorIdCache[string] === undefined) {
- var hash = ColorScheme.getStringHash(string);
- stringColorIdCache[string] = hash % numGeneralPurposeColorIds;
- }
- return stringColorIdCache[string];
- };
-
- return {
- ColorScheme: ColorScheme
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/color_scheme_test.html b/chromium/third_party/catapult/tracing/tracing/base/color_scheme_test.html
deleted file mode 100644
index 602c91c2165..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/color_scheme_test.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ColorScheme = tr.b.ColorScheme;
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/color_test.html b/chromium/third_party/catapult/tracing/tracing/base/color_test.html
deleted file mode 100644
index 208ab9939c6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/color_test.html
+++ /dev/null
@@ -1,104 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/color.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('fromRGB', function() {
- var c = tr.b.Color.fromString('rgb(1, 2, 3)');
- assert.equal(c.r, 1);
- assert.equal(c.g, 2);
- assert.equal(c.b, 3);
- assert.isUndefined(c.a);
- });
-
- test('fromRGBA', function() {
- var c = tr.b.Color.fromString('rgba(1, 2, 3, 0.5)');
- assert.equal(c.r, 1);
- assert.equal(c.g, 2);
- assert.equal(c.b, 3);
- assert.equal(c.a, 0.5);
- });
-
- test('fromHex', function() {
- var c = tr.b.Color.fromString('#010203');
- assert.equal(c.r, 1);
- assert.equal(c.g, 2);
- assert.equal(c.b, 3);
- assert.isUndefined(c.a);
- });
-
- test('toStringRGB', function() {
- var c = new tr.b.Color(1, 2, 3);
- assert.equal(c.toString(), 'rgb(1,2,3)');
- });
-
- test('toStringRGBA', function() {
- var c = new tr.b.Color(1, 2, 3, 0.5);
- assert.equal(c.toString(), 'rgba(1,2,3,0.5)');
- });
-
- test('lerpRGB', function() {
- var a = new tr.b.Color(0, 127, 191);
- var b = new tr.b.Color(255, 255, 255);
- var x = tr.b.Color.lerpRGB(a, b, 0.25);
- assert.equal(x.r, 63);
- assert.equal(x.g, 159);
- assert.equal(x.b, 207);
- });
-
- test('lerpRGBA', function() {
- var a = new tr.b.Color(0, 127, 191, 0.5);
- var b = new tr.b.Color(255, 255, 255, 1);
- var x = tr.b.Color.lerpRGBA(a, b, 0.25);
- assert.equal(x.r, 63);
- assert.equal(x.g, 159);
- assert.equal(x.b, 207);
- assert.equal(x.a, 0.625);
- });
-
- test('blendRGBA', function() {
- var red = new tr.b.Color(255, 0, 0, 0.5);
- var white = new tr.b.Color(255, 255, 255, 1);
- var x = red.blendOver(white);
- assert.equal(x.r, 255);
- assert.equal(x.g, 127);
- assert.equal(x.b, 127);
- assert.equal(x.a, 1);
- });
-
- test('fromHSL', function() {
- var reddish = tr.b.Color.fromHSLExplicit(.994, 0.644, .484, 0.8);
- assert.equal(reddish.r, 202);
- assert.equal(reddish.g, 43);
- assert.equal(reddish.b, 49);
- assert.equal(reddish.a, 0.8);
-
- var gray = tr.b.Color.fromHSLExplicit(0, 0, .50, 1.0);
- assert.equal(gray.r, 127);
- assert.equal(gray.g, 127);
- assert.equal(gray.b, 127);
- assert.equal(gray.a, 1.0);
- });
-
- test('toHSL', function() {
- var reddish = new tr.b.Color(203, 44, 49, 0.8).toHSL();
- assert.closeTo(reddish.h, .994, 0.01);
- assert.closeTo(reddish.s, 0.644, 0.01);
- assert.closeTo(reddish.l, 0.484, 0.01);
- assert.equal(reddish.a, 0.8);
-
- var gray = new tr.b.Color(128, 128, 128, 1.0).toHSL();
- assert.equal(gray.h, 0);
- assert.equal(gray.s, 0);
- assert.closeTo(gray.l, .50, 0.01);
- assert.equal(gray.a, 1.0);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/event.html b/chromium/third_party/catapult/tracing/tracing/base/event.html
deleted file mode 100644
index 75ad3d5001a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/event.html
+++ /dev/null
@@ -1,93 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/event_target.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
- var Event;
- if (tr.isHeadless) {
- /**
- * Creates a new event to be used with tr.b.EventTarget or DOM EventTarget
- * objects.
- * @param {string} type The name of the event.
- * @param {boolean=} opt_bubbles Whether the event bubbles.
- * Default is false.
- * @param {boolean=} opt_preventable Whether the default action of the event
- * can be prevented.
- * @constructor
- * @extends {Event}
- */
- function HeadlessEvent(type, opt_bubbles, opt_preventable) {
- this.type = type;
- this.bubbles = (opt_bubbles !== undefined ?
- !!opt_bubbles : false);
- this.cancelable = (opt_preventable !== undefined ?
- !!opt_preventable : false);
-
- this.defaultPrevented = false;
- this.cancelBubble = false;
- };
-
- HeadlessEvent.prototype = {
- preventDefault: function() {
- this.defaultPrevented = true;
- },
-
- stopPropagation: function() {
- this.cancelBubble = true;
- }
- };
- Event = HeadlessEvent;
- } else {
- /**
- * Creates a new event to be used with tr.b.EventTarget or DOM EventTarget
- * objects.
- * @param {string} type The name of the event.
- * @param {boolean=} opt_bubbles Whether the event bubbles.
- * Default is false.
- * @param {boolean=} opt_preventable Whether the default action of the event
- * can be prevented.
- * @constructor
- * @extends {Event}
- */
- function TrEvent(type, opt_bubbles, opt_preventable) {
- var e = tr.doc.createEvent('Event');
- e.initEvent(type, !!opt_bubbles, !!opt_preventable);
- e.__proto__ = global.Event.prototype;
- return e;
- };
-
- TrEvent.prototype = {
- __proto__: global.Event.prototype
- };
- Event = TrEvent;
- }
-
- /**
- * Dispatches a simple event on an event target.
- * @param {!EventTarget} target The event target to dispatch the event on.
- * @param {string} type The type of the event.
- * @param {boolean=} opt_bubbles Whether the event bubbles or not.
- * @param {boolean=} opt_cancelable Whether the default action of the event
- * can be prevented.
- * @return {boolean} If any of the listeners called {@code preventDefault}
- * during the dispatch this will return false.
- */
- function dispatchSimpleEvent(target, type, opt_bubbles, opt_cancelable) {
- var e = new tr.b.Event(type, opt_bubbles, opt_cancelable);
- return target.dispatchEvent(e);
- }
-
- return {
- Event: Event,
- dispatchSimpleEvent: dispatchSimpleEvent
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/event_target.html b/chromium/third_party/catapult/tracing/tracing/base/event_target.html
deleted file mode 100644
index f1decc458e3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/event_target.html
+++ /dev/null
@@ -1,161 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview This contains an implementation of the EventTarget interface
- * as defined by DOM Level 2 Events.
- */
-tr.exportTo('tr.b', function() {
-
- /**
- * Creates a new EventTarget. This class implements the DOM level 2
- * EventTarget interface and can be used wherever those are used.
- * @constructor
- */
- function EventTarget() {
- }
- EventTarget.decorate = function(target) {
- for (var k in EventTarget.prototype) {
- if (k == 'decorate')
- continue;
- var v = EventTarget.prototype[k];
- if (typeof v !== 'function')
- continue;
- target[k] = v;
- }
- };
-
- EventTarget.prototype = {
-
- /**
- * Adds an event listener to the target.
- * @param {string} type The name of the event.
- * @param {!Function|{handleEvent:Function}} handler The handler for the
- * event. This is called when the event is dispatched.
- */
- addEventListener: function(type, handler) {
- if (!this.listeners_)
- this.listeners_ = Object.create(null);
- if (!(type in this.listeners_)) {
- this.listeners_[type] = [handler];
- } else {
- var handlers = this.listeners_[type];
- if (handlers.indexOf(handler) < 0)
- handlers.push(handler);
- }
- },
-
- /**
- * Removes an event listener from the target.
- * @param {string} type The name of the event.
- * @param {!Function|{handleEvent:Function}} handler The handler for the
- * event.
- */
- removeEventListener: function(type, handler) {
- if (!this.listeners_)
- return;
- if (type in this.listeners_) {
- var handlers = this.listeners_[type];
- var index = handlers.indexOf(handler);
- if (index >= 0) {
- // Clean up if this was the last listener.
- if (handlers.length == 1)
- delete this.listeners_[type];
- else
- handlers.splice(index, 1);
- }
- }
- },
-
- /**
- * Dispatches an event and calls all the listeners that are listening to
- * the type of the event.
- * @param {!cr.event.Event} event The event to dispatch.
- * @return {boolean} Whether the default action was prevented. If someone
- * calls preventDefault on the event object then this returns false.
- */
- dispatchEvent: function(event) {
- if (!this.listeners_)
- return true;
-
- // Since we are using DOM Event objects we need to override some of the
- // properties and methods so that we can emulate this correctly.
- var self = this;
- event.__defineGetter__('target', function() {
- return self;
- });
- var realPreventDefault = event.preventDefault;
- event.preventDefault = function() {
- realPreventDefault.call(this);
- this.rawReturnValue = false;
- };
-
- var type = event.type;
- var prevented = 0;
- if (type in this.listeners_) {
- // Clone to prevent removal during dispatch
- var handlers = this.listeners_[type].concat();
- for (var i = 0, handler; handler = handlers[i]; i++) {
- if (handler.handleEvent)
- prevented |= handler.handleEvent.call(handler, event) === false;
- else
- prevented |= handler.call(this, event) === false;
- }
- }
-
- return !prevented && event.rawReturnValue;
- },
-
- hasEventListener: function(type) {
- return this.listeners_[type] !== undefined;
- }
- };
-
- var EventTargetHelper = {
- decorate: function(target) {
- for (var k in EventTargetHelper) {
- if (k == 'decorate')
- continue;
- var v = EventTargetHelper[k];
- if (typeof v !== 'function')
- continue;
- target[k] = v;
- }
- target.listenerCounts_ = {};
- },
-
- addEventListener: function(type, listener, useCapture) {
- this.__proto__.addEventListener.call(
- this, type, listener, useCapture);
- if (this.listenerCounts_[type] === undefined)
- this.listenerCounts_[type] = 0;
- this.listenerCounts_[type]++;
- },
-
- removeEventListener: function(type, listener, useCapture) {
- this.__proto__.removeEventListener.call(
- this, type, listener, useCapture);
- this.listenerCounts_[type]--;
- },
-
- hasEventListener: function(type) {
- return this.listenerCounts_[type] > 0;
- }
- };
-
- // Export
- return {
- EventTarget: EventTarget,
- EventTargetHelper: EventTargetHelper
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/event_target_test.html b/chromium/third_party/catapult/tracing/tracing/base/event_target_test.html
deleted file mode 100644
index 5df964b6e50..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/event_target_test.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/event_target.html">
-<link rel="import" href="/tracing/base/event.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('eventTargetHelper', function() {
- var listenerCallCount = 0;
- function listener() { listenerCallCount++; }
-
- var div = new tr.b.EventTarget();
- tr.b.EventTargetHelper.decorate(div);
-
- assert.isFalse(div.hasEventListener('foo'));
-
- div.addEventListener('foo', listener);
- assert.isTrue(div.hasEventListener('foo'));
-
- tr.b.dispatchSimpleEvent(div, 'foo');
- assert.equal(listenerCallCount, 1);
-
- div.removeEventListener('foo', listener);
-
- tr.b.dispatchSimpleEvent(div, 'foo');
- assert.equal(listenerCallCount, 1);
-
- assert.isFalse(div.hasEventListener('foo'));
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/extension_registry.html b/chromium/third_party/catapult/tracing/tracing/base/extension_registry.html
deleted file mode 100644
index e4615927f05..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/extension_registry.html
+++ /dev/null
@@ -1,66 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/event_target.html">
-<link rel="import" href="/tracing/base/extension_registry_basic.html">
-<link rel="import" href="/tracing/base/extension_registry_type_based.html">
-<script>
-'use strict';
-
-/**
- * @fileoverview Helper code for defining extension registries, which can be
- * used to make a part of trace-viewer extensible.
- *
- * This file provides two basic types of extension registries:
- * - Generic: register a type with metadata, query for those types based on
- * a predicate
- *
- * - TypeName-based: register a type that handles some combination
- * of tracing categories or typeNames, then query
- * for it based on a category, typeName or both.
- *
- * Use these for pure-JS classes or ui.define'd classes. For polymer element
- * related registries, consult base/polymer_utils.html.
- *
- * When you register subtypes, you pass the constructor for the
- * subtype, and any metadata you want associated with the subtype. Use metadata
- * instead of stuffing fields onto the constructor. E.g.:
- * registry.register(MySubclass, {titleWhenShownInTabStrip: 'MySub'})
- *
- * Some registries want a default object that is returned when a more precise
- * subtype has been registered. To provide one, set the defaultConstructor
- * option on the registry options.
- *
- * TODO: Extension registry used to make reference to mandatoryBaseType but it
- * was never enforced. We may want to add it back in the future in order to
- * enforce the types that can be put into a given registry.
- */
-tr.exportTo('tr.b', function() {
-
- function decorateExtensionRegistry(registry, registryOptions) {
- if (registry.register)
- throw new Error('Already has registry');
-
- registryOptions.freeze();
- if (registryOptions.mode == tr.b.BASIC_REGISTRY_MODE) {
- tr.b._decorateBasicExtensionRegistry(registry, registryOptions);
- } else if (registryOptions.mode == tr.b.TYPE_BASED_REGISTRY_MODE) {
- tr.b._decorateTypeBasedExtensionRegistry(registry, registryOptions);
- } else {
- throw new Error('Unrecognized mode');
- }
-
- // Make it an event target.
- if (registry.addEventListener === undefined)
- tr.b.EventTarget.decorate(registry);
- }
-
- return {
- decorateExtensionRegistry: decorateExtensionRegistry
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/extension_registry_base.html b/chromium/third_party/catapult/tracing/tracing/base/extension_registry_base.html
deleted file mode 100644
index 29de7d7cd70..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/extension_registry_base.html
+++ /dev/null
@@ -1,101 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
- function RegisteredTypeInfo(constructor, metadata) {
- this.constructor = constructor;
- this.metadata = metadata;
- };
-
- var BASIC_REGISTRY_MODE = 'BASIC_REGISTRY_MODE';
- var TYPE_BASED_REGISTRY_MODE = 'TYPE_BASED_REGISTRY_MODE';
- var ALL_MODES = {BASIC_REGISTRY_MODE: true, TYPE_BASED_REGISTRY_MODE: true};
-
- function ExtensionRegistryOptions(mode) {
- if (mode === undefined)
- throw new Error('Mode is required');
- if (!ALL_MODES[mode])
- throw new Error('Not a mode.');
-
- this.mode_ = mode;
- this.defaultMetadata_ = {};
- this.defaultConstructor_ = undefined;
- this.defaultTypeInfo_ = undefined;
- this.frozen_ = false;
- }
- ExtensionRegistryOptions.prototype = {
- freeze: function() {
- if (this.frozen_)
- throw new Error('Frozen');
- this.frozen_ = true;
- },
-
- get mode() {
- return this.mode_;
- },
-
- get defaultMetadata() {
- return this.defaultMetadata_;
- },
-
- set defaultMetadata(defaultMetadata) {
- if (this.frozen_)
- throw new Error('Frozen');
- this.defaultMetadata_ = defaultMetadata;
- this.defaultTypeInfo_ = undefined;
- },
-
- get defaultConstructor() {
- return this.defaultConstructor_;
- },
-
- set defaultConstructor(defaultConstructor) {
- if (this.frozen_)
- throw new Error('Frozen');
- this.defaultConstructor_ = defaultConstructor;
- this.defaultTypeInfo_ = undefined;
- },
-
- get defaultTypeInfo() {
- if (this.defaultTypeInfo_ === undefined && this.defaultConstructor_) {
- this.defaultTypeInfo_ = new RegisteredTypeInfo(
- this.defaultConstructor,
- this.defaultMetadata);
- }
- return this.defaultTypeInfo_;
- },
-
- validateConstructor: function(constructor) {
- if (!this.mandatoryBaseClass)
- return;
- var curProto = constructor.prototype.__proto__;
- var ok = false;
- while (curProto) {
- if (curProto === this.mandatoryBaseClass.prototype) {
- ok = true;
- break;
- }
- curProto = curProto.__proto__;
- }
- if (!ok)
- throw new Error(constructor + 'must be subclass of ' + registry);
- }
- };
-
- return {
- BASIC_REGISTRY_MODE: BASIC_REGISTRY_MODE,
- TYPE_BASED_REGISTRY_MODE: TYPE_BASED_REGISTRY_MODE,
-
- ExtensionRegistryOptions: ExtensionRegistryOptions,
- RegisteredTypeInfo: RegisteredTypeInfo
- };
-});
-
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/extension_registry_basic.html b/chromium/third_party/catapult/tracing/tracing/base/extension_registry_basic.html
deleted file mode 100644
index d21d3941f5b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/extension_registry_basic.html
+++ /dev/null
@@ -1,120 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/base/extension_registry_base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
-
- var RegisteredTypeInfo = tr.b.RegisteredTypeInfo;
- var ExtensionRegistryOptions = tr.b.ExtensionRegistryOptions;
-
- function decorateBasicExtensionRegistry(registry, extensionRegistryOptions) {
- var savedStateStack = [];
- registry.registeredTypeInfos_ = [];
-
- registry.register = function(constructor,
- opt_metadata) {
- if (registry.findIndexOfRegisteredConstructor(
- constructor) !== undefined)
- throw new Error('Handler already registered for ' + constructor);
-
- extensionRegistryOptions.validateConstructor(constructor);
-
- var metadata = {};
- for (var k in extensionRegistryOptions.defaultMetadata)
- metadata[k] = extensionRegistryOptions.defaultMetadata[k];
- if (opt_metadata) {
- for (var k in opt_metadata)
- metadata[k] = opt_metadata[k];
- }
-
- var typeInfo = new RegisteredTypeInfo(
- constructor,
- metadata);
-
- var e = new tr.b.Event('will-register');
- e.typeInfo = typeInfo;
- registry.dispatchEvent(e);
-
- registry.registeredTypeInfos_.push(typeInfo);
-
- e = new tr.b.Event('registry-changed');
- registry.dispatchEvent(e);
- };
-
- registry.pushCleanStateBeforeTest = function() {
- savedStateStack.push(registry.registeredTypeInfos_);
- registry.registeredTypeInfos_ = [];
-
- var e = new tr.b.Event('registry-changed');
- registry.dispatchEvent(e);
- };
- registry.popCleanStateAfterTest = function() {
- registry.registeredTypeInfos_ = savedStateStack[0];
- savedStateStack.splice(0, 1);
-
- var e = new tr.b.Event('registry-changed');
- registry.dispatchEvent(e);
- };
-
- registry.findIndexOfRegisteredConstructor = function(constructor) {
- for (var i = 0; i < registry.registeredTypeInfos_.length; i++)
- if (registry.registeredTypeInfos_[i].constructor == constructor)
- return i;
- return undefined;
- };
-
- registry.unregister = function(constructor) {
- var foundIndex = registry.findIndexOfRegisteredConstructor(constructor);
- if (foundIndex === undefined)
- throw new Error(constructor + ' not registered');
- registry.registeredTypeInfos_.splice(foundIndex, 1);
-
- var e = new tr.b.Event('registry-changed');
- registry.dispatchEvent(e);
- };
-
- registry.getAllRegisteredTypeInfos = function() {
- return registry.registeredTypeInfos_;
- };
-
- registry.findTypeInfo = function(constructor) {
- var foundIndex = this.findIndexOfRegisteredConstructor(constructor);
- if (foundIndex !== undefined)
- return this.registeredTypeInfos_[foundIndex];
- return undefined;
- };
-
- registry.findTypeInfoMatching = function(predicate, opt_this) {
- opt_this = opt_this ? opt_this : undefined;
- for (var i = 0; i < registry.registeredTypeInfos_.length; ++i) {
- var typeInfo = registry.registeredTypeInfos_[i];
- if (predicate.call(opt_this, typeInfo))
- return typeInfo;
- }
- return extensionRegistryOptions.defaultTypeInfo;
- };
-
- registry.findTypeInfoWithName = function(name) {
- if (typeof(name) !== 'string')
- throw new Error('Name is not a string.');
- var typeInfo = registry.findTypeInfoMatching(function(ti) {
- return ti.constructor.name === name;
- });
- if (typeInfo)
- return typeInfo;
- return undefined;
- };
- }
-
- return {
- _decorateBasicExtensionRegistry: decorateBasicExtensionRegistry
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/extension_registry_test.html b/chromium/third_party/catapult/tracing/tracing/base/extension_registry_test.html
deleted file mode 100644
index d67f342b38f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/extension_registry_test.html
+++ /dev/null
@@ -1,132 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/extension_registry.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('tberSimpleNamedRegistration', function() {
- function DummyEvent() {
- }
- DummyEvent.prototype = {
- };
-
- function DummyEventSubclass() {
- }
- DummyEventSubclass.prototype = {
- __proto__: DummyEvent.prototype
- };
-
- var options = new tr.b.ExtensionRegistryOptions(
- tr.b.TYPE_BASED_REGISTRY_MODE);
- options.mandatoryBaseClass = DummyEvent;
- options.defaultConstructor = DummyEvent;
- tr.b.decorateExtensionRegistry(
- DummyEvent, options);
-
- DummyEvent.register(DummyEventSubclass, {typeName: 'dummy-name'});
- assert.equal(DummyEvent, DummyEvent.getConstructor('cat', 'name'));
- assert.equal(DummyEvent.getConstructor('dummy', 'dummy-name'),
- DummyEventSubclass);
- DummyEvent.unregister(DummyEventSubclass);
- assert.equal(DummyEvent, DummyEvent.getConstructor('dummy', 'dummy-name'));
- });
-
- test('tberSimpleCategoryRegistration', function() {
- function DummyEvent() {
- }
- DummyEvent.prototype = {
- };
-
- function DummyEventSubclass() {
- }
- DummyEventSubclass.prototype = {
- __proto__: DummyEvent.prototype
- };
-
- var options = new tr.b.ExtensionRegistryOptions(
- tr.b.TYPE_BASED_REGISTRY_MODE);
- options.mandatoryBaseClass = DummyEvent;
- options.defaultConstructor = DummyEvent;
- tr.b.decorateExtensionRegistry(
- DummyEvent, options);
-
- DummyEvent.register(
- DummyEventSubclass,
- {categoryParts: ['dummy']
- });
- assert.equal(DummyEvent, DummyEvent.getConstructor('cat', 'name'));
- assert.equal(DummyEvent.getConstructor('dummy', 'dummy-name'),
- DummyEventSubclass);
- DummyEvent.unregister(DummyEventSubclass);
- assert.equal(DummyEvent, DummyEvent.getConstructor('dummy', 'dummy-name'));
- });
-
- test('tberSimpleCompoundCategory', function() {
- function DummyEvent() {
- }
- DummyEvent.prototype = {
- };
-
- function DummyEventSubclass() {
- }
- DummyEventSubclass.prototype = {
- __proto__: DummyEvent.prototype
- };
-
- var options = new tr.b.ExtensionRegistryOptions(
- tr.b.TYPE_BASED_REGISTRY_MODE);
- options.mandatoryBaseClass = DummyEvent;
- options.defaultConstructor = DummyEvent;
- tr.b.decorateExtensionRegistry(
- DummyEvent, options);
-
- DummyEvent.register(
- DummyEventSubclass,
- {
- categoryParts: ['dummy']
- });
- assert.equal(DummyEvent, DummyEvent.getConstructor('cat', 'name'));
- assert.equal(DummyEventSubclass,
- DummyEvent.getConstructor('dummy,something-else',
- 'dummy-name'));
- });
-
- test('tberDefaultType', function() {
- function DummyEvent() {
- }
- DummyEvent.prototype = {
- };
-
- function DummyEventSubclass() {
- }
- DummyEventSubclass.prototype = {
- __proto__: DummyEvent.prototype
- };
-
- var options = new tr.b.ExtensionRegistryOptions(
- tr.b.TYPE_BASED_REGISTRY_MODE);
- options.mandatoryBaseClass = DummyEvent;
- options.defaultConstructor = DummyEvent;
- tr.b.decorateExtensionRegistry(
- DummyEvent, options);
-
- DummyEvent.register(
- DummyEventSubclass,
- {
- categoryParts: ['dummy']
- });
- assert.equal(DummyEvent, DummyEvent.getConstructor('cat', 'name'));
- assert.equal(DummyEventSubclass,
- DummyEvent.getConstructor('dummy,something-else',
- 'dummy-name'));
- });
-
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/extension_registry_type_based.html b/chromium/third_party/catapult/tracing/tracing/base/extension_registry_type_based.html
deleted file mode 100644
index 9d9bfcd9d67..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/extension_registry_type_based.html
+++ /dev/null
@@ -1,159 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/extension_registry_base.html">
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/base/category_util.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
- var getCategoryParts = tr.b.getCategoryParts;
-
- var RegisteredTypeInfo = tr.b.RegisteredTypeInfo;
- var ExtensionRegistryOptions = tr.b.ExtensionRegistryOptions;
-
-
- function decorateTypeBasedExtensionRegistry(registry,
- extensionRegistryOptions) {
- var savedStateStack = [];
-
- registry.registeredTypeInfos_ = [];
-
- registry.categoryPartToTypeInfoMap_ = {};
- registry.typeNameToTypeInfoMap_ = {};
-
- registry.register = function(constructor,
- metadata) {
-
- extensionRegistryOptions.validateConstructor(constructor);
-
- var typeInfo = new RegisteredTypeInfo(
- constructor,
- metadata || extensionRegistryOptions.defaultMetadata);
-
- typeInfo.typeNames = [];
- typeInfo.categoryParts = [];
- if (metadata && metadata.typeName)
- typeInfo.typeNames.push(metadata.typeName);
- if (metadata && metadata.typeNames) {
- typeInfo.typeNames.push.apply(
- typeInfo.typeNames, metadata.typeNames);
- }
- if (metadata && metadata.categoryParts) {
- typeInfo.categoryParts.push.apply(
- typeInfo.categoryParts, metadata.categoryParts);
- }
-
- if (typeInfo.typeNames.length === 0 &&
- typeInfo.categoryParts.length === 0)
- throw new Error('typeName or typeNames must be provided');
-
- // Sanity checks...
- typeInfo.typeNames.forEach(function(typeName) {
- if (registry.typeNameToTypeInfoMap_[typeName])
- throw new Error('typeName ' + typeName + ' already registered');
- });
- typeInfo.categoryParts.forEach(function(categoryPart) {
- if (registry.categoryPartToTypeInfoMap_[categoryPart]) {
- throw new Error('categoryPart ' + categoryPart +
- ' already registered');
- }
- });
-
- var e = new tr.b.Event('will-register');
- e.typeInfo = typeInfo;
- registry.dispatchEvent(e);
-
- // Actual registration.
- typeInfo.typeNames.forEach(function(typeName) {
- registry.typeNameToTypeInfoMap_[typeName] = typeInfo;
- });
- typeInfo.categoryParts.forEach(function(categoryPart) {
- registry.categoryPartToTypeInfoMap_[categoryPart] = typeInfo;
- });
- registry.registeredTypeInfos_.push(typeInfo);
-
- var e = new tr.b.Event('registry-changed');
- registry.dispatchEvent(e);
- };
-
- registry.pushCleanStateBeforeTest = function() {
- savedStateStack.push({
- registeredTypeInfos: registry.registeredTypeInfos_,
- typeNameToTypeInfoMap: registry.typeNameToTypeInfoMap_,
- categoryPartToTypeInfoMap: registry.categoryPartToTypeInfoMap_
- });
- registry.registeredTypeInfos_ = [];
- registry.typeNameToTypeInfoMap_ = {};
- registry.categoryPartToTypeInfoMap_ = {};
- var e = new tr.b.Event('registry-changed');
- registry.dispatchEvent(e);
- };
-
- registry.popCleanStateAfterTest = function() {
- var state = savedStateStack[0];
- savedStateStack.splice(0, 1);
-
- registry.registeredTypeInfos_ = state.registeredTypeInfos;
- registry.typeNameToTypeInfoMap_ = state.typeNameToTypeInfoMap;
- registry.categoryPartToTypeInfoMap_ = state.categoryPartToTypeInfoMap;
- var e = new tr.b.Event('registry-changed');
- registry.dispatchEvent(e);
- };
-
- registry.unregister = function(constructor) {
- var typeInfoIndex = -1;
- for (var i = 0; i < registry.registeredTypeInfos_.length; i++) {
- if (registry.registeredTypeInfos_[i].constructor == constructor) {
- typeInfoIndex = i;
- break;
- }
- }
- if (typeInfoIndex === -1)
- throw new Error(constructor + ' not registered');
-
- var typeInfo = registry.registeredTypeInfos_[typeInfoIndex];
- registry.registeredTypeInfos_.splice(typeInfoIndex, 1);
- typeInfo.typeNames.forEach(function(typeName) {
- delete registry.typeNameToTypeInfoMap_[typeName];
- });
- typeInfo.categoryParts.forEach(function(categoryPart) {
- delete registry.categoryPartToTypeInfoMap_[categoryPart];
- });
- var e = new tr.b.Event('registry-changed');
- registry.dispatchEvent(e);
- };
-
- registry.getTypeInfo = function(category, typeName) {
- if (category) {
- var categoryParts = getCategoryParts(category);
- for (var i = 0; i < categoryParts.length; i++) {
- var categoryPart = categoryParts[i];
- if (registry.categoryPartToTypeInfoMap_[categoryPart])
- return registry.categoryPartToTypeInfoMap_[categoryPart];
- }
- }
- if (registry.typeNameToTypeInfoMap_[typeName])
- return registry.typeNameToTypeInfoMap_[typeName];
-
- return extensionRegistryOptions.defaultTypeInfo;
- };
-
- // TODO(nduca): Remove or rename.
- registry.getConstructor = function(category, typeName) {
- var typeInfo = registry.getTypeInfo(category, typeName);
- if (typeInfo)
- return typeInfo.constructor;
- return undefined;
- };
- }
-
- return {
- _decorateTypeBasedExtensionRegistry: decorateTypeBasedExtensionRegistry
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/guid.html b/chromium/third_party/catapult/tracing/tracing/base/guid.html
deleted file mode 100644
index ab19ce10598..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/guid.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
- var nextGUID = 1;
-
- var UUID4_PATTERN = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx';
-
- var GUID = {
- /* Allocate an integer GUID.
- *
- * These GUIDs are not unique between loads, but are fast to generate, and
- * consume very little memory.
- *
- * @return {number} globally unique id.
- */
- allocateSimple: function() {
- return nextGUID++;
- },
-
- /* Return the last GUID allocated without allocating a new one.
- *
- * @return {number} last guid.
- */
- getLastSimpleGuid: function() {
- return nextGUID - 1;
- },
-
- /* Generate a random string UUID.
- *
- * Version 4 random UUIDs are practically guaranteed to be unique between
- * loads, so they can be serialized and compared with results from other
- * loads. These are slower to generate and consume more memory than simple
- * GUIDs.
- *
- * @return {string} universally unique id.
- */
- allocateUUID4: function() {
- return UUID4_PATTERN.replace(/[xy]/g, function(c) {
- var r = parseInt(Math.random() * 16);
- if (c === 'y')
- r = (r & 3) + 8;
- return r.toString(16);
- });
- }
- };
-
- return {
- GUID: GUID
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/headless_tests.html b/chromium/third_party/catapult/tracing/tracing/base/headless_tests.html
deleted file mode 100644
index 6c3f5f4d6ab..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/headless_tests.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/unittest.html">
-<link rel="import" href="/tracing/base/unittest/test_runner.html">
-<link rel="import" href="/tracing/base/unittest/text_test_results.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b.unittest', function() {
- if (!tr.isHeadless) {
- throw new Error('headless_tests.html only works in headless mode');
- }
- function quit(errCode) {
- if (tr.isVinn)
- global.quit(errCode);
- else
- process.exit(errCode);
- }
-
- function printSpacer() {
- console.log('\n\n------------------------------------------------------' +
- '----------------');
- }
- function loadAndRunTests(suiteRelpathsToLoad) {
- var results = new tr.b.unittest.TextTestResults();
-
- var loader = new tr.b.unittest.SuiteLoader(suiteRelpathsToLoad);
-
- var p = loader.allSuitesLoadedPromise;
-
- p = p.then(
- function didAllSuitesLoad() {
- var tests = loader.getAllTests().filter(function(testCase) {
- if (testCase instanceof tr.b.unittest.PerfTestCase)
- return false;
- return true;
- });
- if (tests.length === 0) {
- printSpacer();
- console.log('FAILED: No tests to run.');
- console.log(err.stack);
- quit(1);
- }
- var runner = new tr.b.unittest.TestRunner(results, tests);
- return runner.beginRunning();
- },
- function suiteLoadingFailure(err) {
- printSpacer();
- console.log('FAILED: A test suite failed to load.');
- console.log(err.stack);
- quit(1);
- });
-
- p = p.then(
- function didAllTestRun() {
- if (results.numTestsThatFailed > 0)
- quit(1);
- else
- quit(0);
- },
- function testHarnessError(e) {
- console.log('FAILED: A test harness error has ocurred.');
- console.log(e.stack);
- quit(1);
- });
- return p;
- }
-
- return {
- loadAndRunTests: loadAndRunTests
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/interval_tree.html b/chromium/third_party/catapult/tracing/tracing/base/interval_tree.html
deleted file mode 100644
index f8291dc45e4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/interval_tree.html
+++ /dev/null
@@ -1,349 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
- function max(a, b) {
- if (a === undefined)
- return b;
- if (b === undefined)
- return a;
- return Math.max(a, b);
- }
-
- /**
- * This class implements an interval tree.
- * See: http://wikipedia.org/wiki/Interval_tree
- *
- * Internally the tree is a Red-Black tree. The insertion/colour is done using
- * the Left-leaning Red-Black Trees algorithm as described in:
- * http://www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf
- *
- * @param {function} beginPositionCb Callback to retrieve the begin position.
- * @param {function} endPositionCb Callback to retrieve the end position.
- *
- * @constructor
- */
- function IntervalTree(beginPositionCb, endPositionCb) {
- this.beginPositionCb_ = beginPositionCb;
- this.endPositionCb_ = endPositionCb;
-
- this.root_ = undefined;
- this.size_ = 0;
- }
-
- IntervalTree.prototype = {
- /**
- * Insert events into the interval tree.
- *
- * @param {Object} datum The object to insert.
- */
- insert: function(datum) {
- var startPosition = this.beginPositionCb_(datum);
- var endPosition = this.endPositionCb_(datum);
-
- var node = new IntervalTreeNode(datum,
- startPosition, endPosition);
- this.size_++;
-
- this.root_ = this.insertNode_(this.root_, node);
- this.root_.colour = Colour.BLACK;
- return datum;
- },
-
- insertNode_: function(root, node) {
- if (root === undefined)
- return node;
-
- if (root.leftNode && root.leftNode.isRed &&
- root.rightNode && root.rightNode.isRed)
- this.flipNodeColour_(root);
-
- if (node.key < root.key)
- root.leftNode = this.insertNode_(root.leftNode, node);
- else if (node.key === root.key)
- root.merge(node);
- else
- root.rightNode = this.insertNode_(root.rightNode, node);
-
- if (root.rightNode && root.rightNode.isRed &&
- (root.leftNode === undefined || !root.leftNode.isRed))
- root = this.rotateLeft_(root);
-
- if (root.leftNode && root.leftNode.isRed &&
- root.leftNode.leftNode && root.leftNode.leftNode.isRed)
- root = this.rotateRight_(root);
-
- return root;
- },
-
- rotateRight_: function(node) {
- var sibling = node.leftNode;
- node.leftNode = sibling.rightNode;
- sibling.rightNode = node;
- sibling.colour = node.colour;
- node.colour = Colour.RED;
- return sibling;
- },
-
- rotateLeft_: function(node) {
- var sibling = node.rightNode;
- node.rightNode = sibling.leftNode;
- sibling.leftNode = node;
- sibling.colour = node.colour;
- node.colour = Colour.RED;
- return sibling;
- },
-
- flipNodeColour_: function(node) {
- node.colour = this.flipColour_(node.colour);
- node.leftNode.colour = this.flipColour_(node.leftNode.colour);
- node.rightNode.colour = this.flipColour_(node.rightNode.colour);
- },
-
- flipColour_: function(colour) {
- return colour === Colour.RED ? Colour.BLACK : Colour.RED;
- },
-
- /* The high values are used to find intersection. It should be called after
- * all of the nodes are inserted. Doing it each insert is _slow_. */
- updateHighValues: function() {
- this.updateHighValues_(this.root_);
- },
-
- /* There is probably a smarter way to do this by starting from the inserted
- * node, but need to handle the rotations correctly. Went the easy route
- * for now. */
- updateHighValues_: function(node) {
- if (node === undefined)
- return undefined;
-
- node.maxHighLeft = this.updateHighValues_(node.leftNode);
- node.maxHighRight = this.updateHighValues_(node.rightNode);
-
- return max(max(node.maxHighLeft, node.highValue), node.maxHighRight);
- },
-
- validateFindArguments_: function(queryLow, queryHigh) {
- if (queryLow === undefined || queryHigh === undefined)
- throw new Error('queryLow and queryHigh must be defined');
- if ((typeof queryLow !== 'number') || (typeof queryHigh !== 'number'))
- throw new Error('queryLow and queryHigh must be numbers');
- },
-
- /**
- * Retrieve all overlapping intervals.
- *
- * @param {number} queryLow The low value for the intersection interval.
- * @param {number} queryHigh The high value for the intersection interval.
- * @return {Array} All [begin, end] pairs inside intersecting intervals.
- */
- findIntersection: function(queryLow, queryHigh) {
- this.validateFindArguments_(queryLow, queryHigh);
- if (this.root_ === undefined)
- return [];
-
- var ret = [];
- this.root_.appendIntersectionsInto_(ret, queryLow, queryHigh);
- return ret;
- },
-
- /**
- * Returns the number of nodes in the tree.
- */
- get size() {
- return this.size_;
- },
-
- /**
- * Returns the root node in the tree.
- */
- get root() {
- return this.root_;
- },
-
- /**
- * Dumps out the [lowValue, highValue] pairs for each node in depth-first
- * order.
- */
- dump_: function() {
- if (this.root_ === undefined)
- return [];
- return this.root_.dump();
- }
- };
-
- var Colour = {
- RED: 'red',
- BLACK: 'black'
- };
-
- function IntervalTreeNode(datum, lowValue, highValue) {
- this.lowValue_ = lowValue;
-
- this.data_ = [{
- datum: datum,
- high: highValue,
- low: lowValue
- }];
-
- this.colour_ = Colour.RED;
-
- this.parentNode_ = undefined;
- this.leftNode_ = undefined;
- this.rightNode_ = undefined;
-
- this.maxHighLeft_ = undefined;
- this.maxHighRight_ = undefined;
- }
-
- IntervalTreeNode.prototype = {
- appendIntersectionsInto_: function(ret, queryLow, queryHigh) {
- /* This node starts has a start point at or further right then queryHigh
- * so we know this node is out and all right children are out. Just need
- * to check left */
- if (this.lowValue_ >= queryHigh) {
- if (!this.leftNode_)
- return;
- return this.leftNode_.appendIntersectionsInto_(
- ret, queryLow, queryHigh);
- }
-
- /* If we have a maximum left high value that is bigger then queryLow we
- * need to check left for matches */
- if (this.maxHighLeft_ > queryLow) {
- this.leftNode_.appendIntersectionsInto_(ret, queryLow, queryHigh);
- }
-
- /* We know that this node starts before queryHigh, if any of it's data
- * ends after queryLow we need to add those nodes */
- if (this.highValue > queryLow) {
- for (var i = (this.data.length - 1); i >= 0; --i) {
- /* data nodes are sorted by high value, so as soon as we see one
- * before low value we're done. */
- if (this.data[i].high < queryLow)
- break;
-
- ret.push(this.data[i].datum);
- }
- }
-
- /* check for matches in the right tree */
- if (this.rightNode_) {
- this.rightNode_.appendIntersectionsInto_(ret, queryLow, queryHigh);
- }
- },
-
- get colour() {
- return this.colour_;
- },
-
- set colour(colour) {
- this.colour_ = colour;
- },
-
- get key() {
- return this.lowValue_;
- },
-
- get lowValue() {
- return this.lowValue_;
- },
-
- get highValue() {
- return this.data_[this.data_.length - 1].high;
- },
-
- set leftNode(left) {
- this.leftNode_ = left;
- },
-
- get leftNode() {
- return this.leftNode_;
- },
-
- get hasLeftNode() {
- return this.leftNode_ !== undefined;
- },
-
- set rightNode(right) {
- this.rightNode_ = right;
- },
-
- get rightNode() {
- return this.rightNode_;
- },
-
- get hasRightNode() {
- return this.rightNode_ !== undefined;
- },
-
- set parentNode(parent) {
- this.parentNode_ = parent;
- },
-
- get parentNode() {
- return this.parentNode_;
- },
-
- get isRootNode() {
- return this.parentNode_ === undefined;
- },
-
- set maxHighLeft(high) {
- this.maxHighLeft_ = high;
- },
-
- get maxHighLeft() {
- return this.maxHighLeft_;
- },
-
- set maxHighRight(high) {
- this.maxHighRight_ = high;
- },
-
- get maxHighRight() {
- return this.maxHighRight_;
- },
-
- get data() {
- return this.data_;
- },
-
- get isRed() {
- return this.colour_ === Colour.RED;
- },
-
- merge: function(node) {
- for (var i = 0; i < node.data.length; i++)
- this.data_.push(node.data[i]);
- this.data_.sort(function(a, b) {
- return a.high - b.high;
- });
- },
-
- dump: function() {
- var ret = {};
- if (this.leftNode_)
- ret['left'] = this.leftNode_.dump();
-
- ret['data'] = this.data_.map(function(d) { return [d.low, d.high]; });
-
- if (this.rightNode_)
- ret['right'] = this.rightNode_.dump();
-
- return ret;
- }
- };
-
- return {
- IntervalTree: IntervalTree
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/interval_tree_test.html b/chromium/third_party/catapult/tracing/tracing/base/interval_tree_test.html
deleted file mode 100644
index dad90c45274..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/interval_tree_test.html
+++ /dev/null
@@ -1,236 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/interval_tree.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function SimpleIntervalTree() {
- tr.b.IntervalTree.call(this,
- function(s) { return s.start; },
- function(s) { return s.end; });
- return this;
- }
- SimpleIntervalTree.prototype = {
- __proto__: tr.b.IntervalTree.prototype
- };
-
- function buildSimpleTree() {
- var tree = new SimpleIntervalTree();
- tree.v0 = tree.insert({start: 2, end: 6});
- tree.v1 = tree.insert({start: 1, end: 3});
- tree.v2 = tree.insert({start: 5, end: 7});
- tree.v3 = tree.insert({start: 1, end: 5});
- tree.v4 = tree.insert({start: 3, end: 5});
- tree.v5 = tree.insert({start: 3, end: 5});
- tree.v6 = tree.insert({start: 3, end: 6});
- tree.v7 = tree.insert({start: 1, end: 1});
- tree.v8 = tree.insert({start: 4, end: 8});
- tree.v9 = tree.insert({start: 0, end: 2});
-
- tree.updateHighValues();
-
- return tree;
- }
-
- function sortSimpleResults(intersection) {
- intersection.sort(function(a, b) {
- if (a.start === b.start)
- return a.end - b.end;
- return a.start - b.start;
- });
- }
-
- test('findIntersection', function() {
- var tree = buildSimpleTree();
- var intersection = tree.findIntersection(2, 4);
- sortSimpleResults(intersection);
-
- var expected = [tree.v1, tree.v3, tree.v0, tree.v4, tree.v5, tree.v6];
- assert.equal(intersection.length, 6);
- assert.deepEqual(intersection, expected);
- });
-
- test('findIntersection_zeroDuration', function() {
- var tree = buildSimpleTree();
- var intersection = tree.findIntersection(2, 2);
- sortSimpleResults(intersection);
-
- var expected = [tree.v1, tree.v3];
- assert.equal(intersection.length, 2);
- assert.deepEqual(intersection, expected);
- });
-
- test('findIntersection_noMatching', function() {
- var tree = buildSimpleTree();
- var intersection = tree.findIntersection(9, 10);
- assert.deepEqual(intersection, []);
- });
-
- test('findIntersection_emptyTree', function() {
- var tree = new tr.b.IntervalTree();
- tree.updateHighValues();
-
- var intersection = tree.findIntersection(2, 4);
- assert.deepEqual(intersection, []);
- });
-
- test('findIntersection_emptyInterval', function() {
- var tree = new tr.b.IntervalTree();
- tree.updateHighValues();
-
- assert.throws(function() {
- tree.findIntersection();
- });
- assert.throws(function() {
- tree.findIntersection(1);
- });
- assert.throws(function() {
- tree.findIntersection('a', 'b');
- });
- });
-
- test('insert', function() {
- var tree = new tr.b.IntervalTree(
- function(s) { return s.start; },
- function(s) { return s.end; });
-
- assert.equal(tree.size, 0);
-
- tree.insert({start: 1, end: 4});
- tree.insert({start: 3, end: 5});
- tree.updateHighValues();
-
- var outTree = {
- 'left': {
- 'data': [[1, 4]]
- },
- 'data': [[3, 5]]
- };
-
- assert.equal(tree.size, 2);
- assert.deepEqual(tree.dump_(), outTree);
- });
-
- test('insert_withoutEnd', function() {
- var tree = new tr.b.IntervalTree(
- function(s) { return s.start; },
- function(s) { return s.end; });
-
- assert.equal(tree.size, 0);
-
- tree.insert({start: 3, end: 5});
- tree.insert({start: 1, end: 4});
- tree.updateHighValues();
-
- var outTree = {
- 'left': {
- 'data': [[1, 4]]
- },
- 'data': [[3, 5]]
- };
-
- assert.equal(tree.size, 2);
- assert.deepEqual(tree.dump_(), outTree);
- });
-
- test('insert_balancesTree', function() {
- var tree = new tr.b.IntervalTree(
- function(s) { return s.start; },
- function(s) { return s.end; });
-
- assert.equal(tree.size, 0);
-
- for (var i = 0; i < 10; ++i)
- tree.insert({start: i, end: 5});
- tree.updateHighValues();
-
- var outTree = {
- 'left': {
- 'left': {
- 'data': [[0, 5]]
- },
- 'data': [[1, 5]],
- 'right': {
- 'data': [[2, 5]]
- }
- },
- 'data': [[3, 5]],
- 'right': {
- 'left': {
- 'left': {
- 'data': [[4, 5]]
- },
- 'data': [[5, 5]],
- 'right': {
- 'data': [[6, 5]]
- }
- },
- 'data': [[7, 5]],
- 'right': {
- 'left': {
- 'data': [[8, 5]]
- },
- 'data': [[9, 5]]
- }
- }
- };
-
- assert.deepEqual(tree.dump_(), outTree);
- });
-
- test('insert_withDuplicateIntervals', function() {
- var tree = new tr.b.IntervalTree(
- function(s) { return s.start; },
- function(s) { return s.end; });
-
- assert.equal(tree.size, 0);
-
- tree.insert({start: 1, end: 4});
- tree.insert({start: 3, end: 5});
- tree.insert({start: 3, end: 5});
- tree.insert({start: 3, end: 6});
- tree.updateHighValues();
-
- var outTree = {
- 'left': {
- 'data': [[1, 4]]
- },
- 'data': [[3, 5], [3, 5], [3, 6]]
- };
-
- assert.equal(tree.size, 4);
- assert.deepEqual(tree.dump_(), outTree);
- });
-
- test('insert_updatesHighValues', function() {
- var tree = buildSimpleTree();
-
- var expected = [
- [undefined, undefined],
- [2, undefined],
- [5, 8],
- [undefined, undefined],
- [6, 7],
- [undefined, undefined]
- ];
-
- var result = [];
- function walk(node) {
- if (node === undefined)
- return;
-
- walk(node.leftNode);
- result.push([node.maxHighLeft, node.maxHighRight]);
- walk(node.rightNode);
- }
- walk(tree.root);
-
- assert.deepEqual(result, expected);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/iteration_helpers.html b/chromium/third_party/catapult/tracing/tracing/base/iteration_helpers.html
deleted file mode 100644
index ddd3a90d43e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/iteration_helpers.html
+++ /dev/null
@@ -1,447 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
- /**
- * Converts any object which is either (a) an iterable, or (b) an
- * "array-ish" obect (has length property and can be indexed into)
- * into an array.
- */
- function asArray(x) {
- var values = [];
- if (x[Symbol.iterator])
- for (var value of x)
- values.push(value);
- else
- for (var i = 0; i < x.length; i++)
- values.push(x[i]);
- return values;
- }
-
- /**
- * Returns the only element in the iterable. If the iterable is empty or has
- * more than one element, an error is thrown.
- */
- function getOnlyElement(iterable) {
- var iterator = iterable[Symbol.iterator]();
-
- var firstIteration = iterator.next();
- if (firstIteration.done)
- throw new Error('getOnlyElement was passed an empty iterable.');
-
- var secondIteration = iterator.next();
- if (!secondIteration.done)
- throw new Error(
- 'getOnlyElement was passed an iterable with multiple elements.');
-
- return firstIteration.value;
- }
-
- /**
- * Returns the first element in the iterable. If the iterable is empty, an
- * error is thrown.
- */
- function getFirstElement(iterable) {
- var iterator = iterable[Symbol.iterator]();
- var result = iterator.next();
- if (result.done)
- throw new Error('getFirstElement was passed an empty iterable.');
-
- return result.value;
- }
-
- function compareArrays(x, y, elementCmp) {
- var minLength = Math.min(x.length, y.length);
- for (var i = 0; i < minLength; i++) {
- var tmp = elementCmp(x[i], y[i]);
- if (tmp)
- return tmp;
- }
- if (x.length == y.length)
- return 0;
-
- if (x[i] === undefined)
- return -1;
-
- return 1;
- }
-
- /**
- * Compares two values when one or both might be undefined. Undefined
- * values are sorted after defined.
- */
- function comparePossiblyUndefinedValues(x, y, cmp, opt_this) {
- if (x !== undefined && y !== undefined)
- return cmp.call(opt_this, x, y);
- if (x !== undefined)
- return -1;
- if (y !== undefined)
- return 1;
- return 0;
- }
-
- /**
- * Compares two numeric values when one or both might be undefined or NaNs.
- * Undefined / NaN values are sorted after others.
- */
- function compareNumericWithNaNs(x, y) {
- if (!isNaN(x) && !isNaN(y))
- return x - y;
- if (isNaN(x))
- return 1;
- if (isNaN(y))
- return -1;
- return 0;
- }
-
- function concatenateArrays(/*arguments*/) {
- var values = [];
- for (var i = 0; i < arguments.length; i++) {
- if (!(arguments[i] instanceof Array))
- throw new Error('Arguments ' + i + 'is not an array');
- values.push.apply(values, arguments[i]);
- }
- return values;
- }
-
- function concatenateObjects(/*arguments*/) {
- var result = {};
- for (var i = 0; i < arguments.length; i++) {
- var object = arguments[i];
- for (var j in object) {
- result[j] = object[j];
- }
- }
- return result;
- }
-
- function cloneDictionary(dict) {
- var clone = {};
- for (var k in dict) {
- clone[k] = dict[k];
- }
- return clone;
- }
-
- function dictionaryKeys(dict) {
- var keys = [];
- for (var key in dict)
- keys.push(key);
- return keys;
- }
-
- function dictionaryValues(dict) {
- var values = [];
- for (var key in dict)
- values.push(dict[key]);
- return values;
- }
-
- function dictionaryLength(dict) {
- var n = 0;
- for (var key in dict)
- n++;
- return n;
- }
-
- function dictionaryContainsValue(dict, value) {
- for (var key in dict)
- if (dict[key] === value)
- return true;
- return false;
- }
-
- /**
- * Returns true if all the elements of the iterable pass the predicate.
- */
- function every(iterable, predicate) {
- for (var x of iterable)
- if (!predicate(x))
- return false;
- return true;
- }
-
- /**
- * Returns a new dictionary with items grouped by the return value of the
- * specified function being called on each item.
- * @param {!Array.<Object>} ary The array being iterated through
- * @param {!Function} fn The mapping function between the array value and the
- * map key.
- */
- function group(ary, fn) {
- return ary.reduce(function(accumulator, curr) {
- var key = fn(curr);
-
- if (key in accumulator)
- accumulator[key].push(curr);
- else
- accumulator[key] = [curr];
-
- return accumulator;
- }, {});
- }
-
- function iterItems(dict, fn, opt_this) {
- opt_this = opt_this || this;
- var keys = Object.keys(dict);
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- fn.call(opt_this, key, dict[key]);
- }
- }
-
- /**
- * Create a new dictionary with the same keys as the original dictionary
- * mapped to the results of the provided function called on the corresponding
- * entries in the original dictionary, i.e. result[key] = fn(key, dict[key])
- * for all keys in dict (own enumerable properties only).
- *
- * Example:
- * var srcDict = {a: 10, b: 15};
- * var dstDict = mapItems(srcDict, function(k, v) { return 2 * v; });
- * // srcDict is unmodified and dstDict is now equal to {a: 20, b: 30}.
- */
- function mapItems(dict, fn, opt_this) {
- opt_this = opt_this || this;
- var result = {};
- var keys = Object.keys(dict);
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- result[key] = fn.call(opt_this, key, dict[key]);
- }
- return result;
- }
-
- function filterItems(dict, predicate, opt_this) {
- opt_this = opt_this || this;
- var result = {};
- var keys = Object.keys(dict);
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- var value = dict[key];
- if (predicate.call(opt_this, key, value))
- result[key] = value;
- }
- return result;
- }
-
- function iterObjectFieldsRecursively(object, func) {
- if (!(object instanceof Object))
- return;
-
- if (object instanceof Array) {
- for (var i = 0; i < object.length; i++) {
- func(object, i, object[i]);
- iterObjectFieldsRecursively(object[i], func);
- }
- return;
- }
-
- for (var key in object) {
- var value = object[key];
- func(object, key, value);
- iterObjectFieldsRecursively(value, func);
- }
- }
-
- /**
- * Convert an array of dictionaries to a dictionary of arrays.
- *
- * The keys of the resulting dictionary are a union of the keys of all
- * dictionaries in the provided array. Each array in the resulting dictionary
- * has the same length as the provided array and contains the values of its
- * key in the dictionaries in the provided array. Example:
- *
- * INPUT:
- *
- * [
- * {a: 6, b: 5 },
- * undefined,
- * {a: 4, b: 3, c: 2},
- * { b: 1, c: 0}
- * ]
- *
- * OUTPUT:
- *
- * {
- * a: [6, undefined, 4, undefined],
- * b: [5, undefined, 3, 1 ],
- * c: [undefined, undefined, 2, 0 ]
- * }
- *
- * @param {!Array} array Array of items to be inverted. If opt_dictGetter
- * is not provided, all elements of the array must be either undefined,
- * or dictionaries.
- * @param {?(function(*): (!Object|undefined))=} opt_dictGetter Optional
- * function mapping defined elements of array to dictionaries.
- * @param {*=} opt_this Optional 'this' context for opt_dictGetter.
- */
- function invertArrayOfDicts(array, opt_dictGetter, opt_this) {
- opt_this = opt_this || this;
- var result = {};
- for (var i = 0; i < array.length; i++) {
- var item = array[i];
- if (item === undefined)
- continue;
- var dict = opt_dictGetter ? opt_dictGetter.call(opt_this, item) : item;
- if (dict === undefined)
- continue;
- for (var key in dict) {
- var valueList = result[key];
- if (valueList === undefined)
- result[key] = valueList = new Array(array.length);
- valueList[i] = dict[key];
- }
- }
- return result;
- }
-
- /**
- * Convert an array to a dictionary.
- *
- * Every element in the array is mapped in the dictionary to the key returned
- * by the provided function:
- *
- * dictionary[valueToKeyFn(element)] = element;
- *
- * @param {!Array} array Arbitrary array.
- * @param {function(*): string} valueToKeyFn Function mapping array elements
- * to dictionary keys.
- * @param {*=} opt_this Optional 'this' context for valueToKeyFn.
- */
- function arrayToDict(array, valueToKeyFn, opt_this) {
- opt_this = opt_this || this;
- var result = {};
- var length = array.length;
- for (var i = 0; i < length; i++) {
- var value = array[i];
- var key = valueToKeyFn.call(opt_this, value);
- result[key] = value;
- }
- return result;
- }
-
- /** Returns the value passed in. */
- function identity(d) {
- return d;
- }
-
- /**
- * Returns the index of the first element in |ary| for which |opt_func|
- * returns a truthy value.
- *
- * @param {!Array} ary The array being searched
- * @param {function(*): *=} opt_func The test function which accepts an array
- * element and returns a value that is coerced to a boolean. Defaults to
- * the identity function.
- * @param {*=} opt_this Optional 'this' context for opt_func.
- */
- function findFirstIndexInArray(ary, opt_func, opt_this) {
- var func = opt_func || identity;
- for (var i = 0; i < ary.length; i++) {
- if (func.call(opt_this, ary[i], i))
- return i;
- }
- return -1;
- }
-
- /**
- * Returns the value of the first element in |ary| for which |opt_func|
- * returns a truthy value.
- *
- * @param {!Array} ary The array being searched.
- * @param {function(*): *=} opt_func The test function which accepts an array
- * element and returns a value that is coerced to a boolean. Defaults to
- * the identity function.
- * @param {*=} opt_this Optional 'this' context for opt_func.
- */
- function findFirstInArray(ary, opt_func, opt_this) {
- var i = findFirstIndexInArray(ary, opt_func, opt_func);
- if (i === -1)
- return undefined;
- return ary[i];
- }
-
- /**
- * Returns the key of the first dictionary entry for which |opt_func| returns
- * a truthy value.
- *
- * @param {!Object} dict The dictionary being searched.
- * @param {function(*, *): *=} opt_func The test function which accepts a
- * dictionary key as its first parameter, the corresponding dictionary
- * value as its second parameter, and returns a value that is coerced to a
- * boolean. Defaults to the identity function (which returns the key).
- * @param {*=} opt_this Optional 'this' context for opt_func.
- */
- function findFirstKeyInDictMatching(dict, opt_func, opt_this) {
- var func = opt_func || identity;
- for (var key in dict) {
- if (func.call(opt_this, key, dict[key]))
- return key;
- }
- return undefined;
- }
-
- /** Returns the values in an ES6 Map object. */
- function mapValues(map) {
- var values = [];
- for (var value of map.values())
- values.push(value);
- return values;
- }
-
- /**
- * Calls |fn| on each entry in an ES6 Map.
- *
- * @param {!Map} The map whose entries are being processed.
- * @param {function(*, *): *} The function which accepts a map key as its
- * first parameter and a map value as its second parameter. Any return
- * value is ignored.
- * @param {*=} opt_this Optional 'this' context for fn.
- */
- function iterMapItems(map, fn, opt_this) {
- opt_this = opt_this || this;
- for (var key of map.keys())
- fn.call(opt_this, key, map.get(key));
- }
-
- return {
- asArray: asArray,
- concatenateArrays: concatenateArrays,
- concatenateObjects: concatenateObjects,
- compareArrays: compareArrays,
- comparePossiblyUndefinedValues: comparePossiblyUndefinedValues,
- compareNumericWithNaNs: compareNumericWithNaNs,
- cloneDictionary: cloneDictionary,
- dictionaryLength: dictionaryLength,
- dictionaryKeys: dictionaryKeys,
- dictionaryValues: dictionaryValues,
- dictionaryContainsValue: dictionaryContainsValue,
- every: every,
- getOnlyElement: getOnlyElement,
- getFirstElement: getFirstElement,
- group: group,
- iterItems: iterItems,
- mapItems: mapItems,
- filterItems: filterItems,
- iterObjectFieldsRecursively: iterObjectFieldsRecursively,
- invertArrayOfDicts: invertArrayOfDicts,
- arrayToDict: arrayToDict,
- identity: identity,
- findFirstIndexInArray: findFirstIndexInArray,
- findFirstInArray: findFirstInArray,
- findFirstKeyInDictMatching: findFirstKeyInDictMatching,
- mapValues: mapValues,
- iterMapItems: iterMapItems
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/iteration_helpers_test.html b/chromium/third_party/catapult/tracing/tracing/base/iteration_helpers_test.html
deleted file mode 100644
index b162763602f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/iteration_helpers_test.html
+++ /dev/null
@@ -1,333 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var comparePossiblyUndefinedValues = tr.b.comparePossiblyUndefinedValues;
- var compareArrays = tr.b.compareArrays;
- var asArray = tr.b.asArray;
- var getOnlyElement = tr.b.getOnlyElement;
- var every = tr.b.every;
- var getFirstElement = tr.b.getFirstElement;
-
- test('asArray_indexed', function() {
- assert.deepEqual(asArray({'0': 2, '1': 4, '2': 6, 'length': 3}), [2, 4, 6]);
- });
-
- test('asArray_iterable', function() {
- function *iterfunc() {
- yield 2;
- yield 4;
- yield 6;
- }
- assert.deepEqual(asArray({[Symbol.iterator]: iterfunc}), [2, 4, 6]);
- });
-
- test('comparePossiblyUndefinedValues', function() {
- function cmp(x, y) {
- assert.isDefined(x);
- assert.isDefined(y);
- return x - y;
- }
-
- assert.isBelow(comparePossiblyUndefinedValues(0, 1, cmp), 0);
- assert.isAbove(comparePossiblyUndefinedValues(1, 0, cmp), 0);
- assert.equal(comparePossiblyUndefinedValues(1, 1, cmp), 0);
-
- assert.isBelow(comparePossiblyUndefinedValues(0, undefined, cmp), 0);
- assert.isAbove(comparePossiblyUndefinedValues(undefined, 0, cmp), 0);
- assert.equal(comparePossiblyUndefinedValues(undefined, undefined, cmp), 0);
- });
-
- test('compareArrays', function() {
- function cmp(x, y) {
- assert.isDefined(x);
- assert.isDefined(y);
- return x - y;
- }
-
- assert.isBelow(compareArrays([1], [2], cmp), 0);
- assert.isAbove(compareArrays([2], [1], cmp), 0);
-
- assert.isBelow(compareArrays([1], [1, 2], cmp), 0);
- assert.isAbove(compareArrays([1, 2], [1], cmp), 0);
-
- assert.isBelow(compareArrays([], [1], cmp), 0);
- assert.isAbove(compareArrays([1], [], cmp), 0);
-
- assert.isAbove(compareArrays([2], [1], cmp), 0);
-
- assert.equal(compareArrays([], [], cmp), 0);
- assert.equal(compareArrays([1], [1], cmp), 0);
- });
-
- test('every_empty', function() {
- assert.isTrue(every([], x => false));
- });
-
- test('every_true', function() {
- assert.isTrue(every([2, 4, 6], x => x % 2 === 0));
- });
-
- test('every_false', function() {
- assert.isTrue(!every([2, 3, 4], x => x % 2 === 0));
- });
-
- test('getOnlyElement_throwsIfEmpty', function() {
- assert.throws(() => getOnlyElement([]),
- 'getOnlyElement was passed an empty iterable.');
- });
-
- test('getOnlyElement_oneItem', function() {
- assert.equal(getOnlyElement([1]), 1);
- });
-
- test('getOnlyElement_twoItems', function() {
- assert.throws(() => getOnlyElement([1, 2]),
- 'getOnlyElement was passed an iterable with multiple elements.');
- });
-
- test('getFirstElement_throwsIfEmpty', function() {
- assert.throws(() => getFirstElement([]),
- 'getFirstElement was passed an empty iterable.');
- });
-
- test('getFirstElement_oneItem', function() {
- assert.equal(getFirstElement([1]), 1);
- });
-
- test('getFirstElement_twoItems', function() {
- assert.equal(getFirstElement([1, 2]), 1);
- });
-
- test('group', function() {
- // Empty array
- var srcArray = [];
- var fn = function(curr) { return (curr % 2); };
- var dstDict = {};
-
- assert.deepEqual(tr.b.group(srcArray, fn), dstDict);
-
- // Non-empty array
- var srcArray = [0, 1, 2, 3, 4, 5, 6];
- var dstDict = {
- 0: [0, 2, 4, 6],
- 1: [1, 3, 5]
- };
-
- assert.deepEqual(tr.b.group(srcArray, fn), dstDict);
- });
-
- test('mapItems', function() {
- // Empty dictionary.
- var srcDict = {};
- var dstDict = tr.b.mapItems(srcDict, function(key, value) {
- return value;
- });
- assert.lengthOf(Object.keys(srcDict), 0);
- assert.lengthOf(Object.keys(dstDict), 0);
- assert.notStrictEqual(dstDict, srcDict);
-
- // Non-empty dictionary.
- var srcDict = {a: 0, b: 30};
- var dstDict = tr.b.mapItems(srcDict, function(key, value) {
- return 9 * value / 5 + 32;
- });
- assert.lengthOf(Object.keys(srcDict), 2);
- assert.equal(srcDict.a, 0);
- assert.equal(srcDict.b, 30);
- assert.lengthOf(Object.keys(dstDict), 2);
- assert.equal(dstDict.a, 32);
- assert.equal(dstDict.b, 86);
- assert.notStrictEqual(dstDict, srcDict);
-
- // Optional 'this' argument.
- var srcDict = {c: '?', d: '!', e: '.'};
- var dstDict = tr.b.mapItems(srcDict, function(key, value) {
- return key + this.delimiter + value;
- }, {delimiter: '='});
- assert.lengthOf(Object.keys(srcDict), 3);
- assert.equal(srcDict.c, '?');
- assert.equal(srcDict.d, '!');
- assert.equal(srcDict.e, '.');
- assert.lengthOf(Object.keys(dstDict), 3);
- assert.equal(dstDict.c, 'c=?');
- assert.equal(dstDict.d, 'd=!');
- assert.equal(dstDict.e, 'e=.');
- assert.notStrictEqual(dstDict, srcDict);
-
- // Inherited properties should not be mapped.
- var srcDict = {__proto__: {a: 10}};
- var dstDict = tr.b.mapItems(srcDict, function(key, value) {
- return value;
- });
- assert.lengthOf(Object.keys(srcDict), 0);
- assert.lengthOf(Object.keys(dstDict), 0);
- });
-
- test('filterItemsSimple', function() {
- var someThisArg = {};
- var srcDict = {a: 0, b: 30};
- var dstDict = tr.b.filterItems(srcDict, function(key, value) {
- assert.equal(this, someThisArg);
- return value >= 30;
- }, someThisArg);
- assert.lengthOf(Object.keys(dstDict), 1);
- assert.equal(dstDict.b, 30);
- });
-
- test('filterItemsInheritedProps', function() {
- var srcDict = {
- a: 0,
- b: 30,
- __proto__: {
- c: 40
- }
- };
- var dstDict = tr.b.filterItems(srcDict, function(key, value) {
- return value >= 30;
- });
- assert.lengthOf(Object.keys(dstDict), 1);
- assert.equal(dstDict.b, 30);
- });
-
- test('invertArrayOfDicts_defaultGetter', function() {
- var array = [
- {a: 6, b: 5},
- undefined,
- {a: 4, b: 3, c: 2},
- {b: 1, c: 0}
- ];
- var dict = tr.b.invertArrayOfDicts(array);
- assert.sameMembers(Object.keys(dict), ['a', 'b', 'c']);
- assert.deepEqual(tr.b.asArray(dict['a']), [6, undefined, 4, undefined]);
- assert.deepEqual(tr.b.asArray(dict['b']), [5, undefined, 3, 1]);
- assert.deepEqual(tr.b.asArray(dict['c']), [undefined, undefined, 2, 0]);
- });
-
- test('invertArrayOfDicts_customGetter', function() {
- var fakeThis = { itemToDict: JSON.parse };
- var array = [
- '{"a": "test", "b": true}',
- '{}',
- '{invalid-json}',
- '{"a": 42, "c": false}'
- ];
- var dict = tr.b.invertArrayOfDicts(array, function(item) {
- try {
- return this.itemToDict(item);
- } catch (e) {
- return undefined;
- }
- }, fakeThis);
- assert.sameMembers(Object.keys(dict), ['a', 'b', 'c']);
- assert.deepEqual(
- tr.b.asArray(dict['a']), ['test', undefined, undefined, 42]);
- assert.deepEqual(
- tr.b.asArray(dict['b']), [true, undefined, undefined, undefined]);
- assert.deepEqual(
- tr.b.asArray(dict['c']), [undefined, undefined, undefined, false]);
- });
-
- test('arrayToDict', function() {
- var fakeThis = { prefix: 'key_' };
- var array = [5, undefined, 'test'];
- var dict = tr.b.arrayToDict(array, function(value) {
- return this.prefix + value;
- }, fakeThis);
- assert.deepEqual(dict, {
- 'key_5': 5,
- 'key_undefined': undefined,
- 'key_test': 'test'
- });
- });
-
- test('identity', function() {
- // Undefined value.
- assert.isUndefined(tr.b.identity(undefined));
-
- // Primitive value.
- assert.equal(tr.b.identity(-273.15), -273.15);
-
- // List.
- var list = ['list', 'with', 1, undefined, 'value'];
- assert.strictEqual(tr.b.identity(list), list);
-
- // Object.
- var object = {'hasItems': true};
- assert.strictEqual(tr.b.identity(object), object);
- });
-
- test('findFirstKeyInDictMatching', function() {
- var dict = {a: 1, b: 2, c: 3};
-
- var that = this;
- var k = tr.b.findFirstKeyInDictMatching(dict, function(key, value) {
- assert.equal(this, that);
- return value == 2;
- }, this);
- assert.equal(k, 'b');
-
- var k = tr.b.findFirstKeyInDictMatching(dict, function(key, value) {
- assert.equal(this, that);
- return false;
- }, this);
- assert.equal(k, undefined);
- });
-
- test('dictionaryContainsValue', function() {
- var emptyDict = {};
- assert.isFalse(tr.b.dictionaryContainsValue(emptyDict, 'missing'));
-
- var nonEmptyDict = {a: 42, b: 'value'};
- assert.isTrue(tr.b.dictionaryContainsValue(nonEmptyDict, 42));
- assert.isTrue(tr.b.dictionaryContainsValue(nonEmptyDict, 'value'));
- assert.isFalse(tr.b.dictionaryContainsValue(nonEmptyDict, 'a'));
- assert.isFalse(tr.b.dictionaryContainsValue(nonEmptyDict, 'b'));
- assert.isFalse(tr.b.dictionaryContainsValue(nonEmptyDict, 'missing'));
- });
-
- test('mapValues', function() {
- var map = new Map();
- map.set('a', 1);
- map.set('b', 2);
- map.set('c', 3);
- var values = tr.b.mapValues(map);
- assert.strictEqual(values.length, 3);
- assert.sameMembers([1, 2, 3], values);
- });
-
- test('iterMapItems', function() {
- var map = new Map();
- map.set('a', 'aa');
- map.set('b', 'bb');
- map.set('c', 'cc');
- var counter = 0;
- var keyCheck = ['a', 'b', 'c'];
- var valueCheck = ['aa', 'bb', 'cc'];
- tr.b.iterMapItems(map, function(key, value) {
- assert.strictEqual(key, keyCheck[counter]);
- assert.strictEqual(value, valueCheck[counter]);
- ++counter;
- });
- assert.strictEqual(counter, 3);
-
- // Optional 'this' argument.
- var retObj = {delimiter: '=', result: {}};
- assert.lengthOf(Object.keys(retObj.result), 0);
- tr.b.iterMapItems(map, function(key, value) {
- this.result[key] = key + this.delimiter + value;
- }, retObj);
- assert.lengthOf(Object.keys(retObj.result), 3);
- assert.equal(retObj.result.a, 'a=aa');
- assert.equal(retObj.result.b, 'b=bb');
- assert.equal(retObj.result.c, 'c=cc');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/math.html b/chromium/third_party/catapult/tracing/tracing/base/math.html
deleted file mode 100644
index 59b5d3117b9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/math.html
+++ /dev/null
@@ -1,166 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script src="/gl-matrix-min.js"></script>
-
-<script>
-'use strict';
-
-// In node, the script-src for gl-matrix-min above brings in glmatrix into
-// a module, instead of into the global scope. Whereas, Tracing code
-// assumes that glMatrix is in the global scope. So, in Node only, we
-// require() it in, and then take all its exports and shove them into the
-// global scope by hand.
-(function(global) {
- if (tr.isNode) {
- var glMatrixAbsPath = HTMLImportsLoader.hrefToAbsolutePath(
- '/gl-matrix-min.js');
- var glMatrixModule = require(glMatrixAbsPath);
- for (var exportName in glMatrixModule) {
- global[exportName] = glMatrixModule[exportName];
- }
- }
-})(this);
-</script>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
- function clamp(x, lo, hi) {
- return Math.min(Math.max(x, lo), hi);
- }
-
- function lerp(percentage, lo, hi) {
- var range = hi - lo;
- return lo + percentage * range;
- }
-
- function normalize(value, lo, hi) {
- return (value - lo) / (hi - lo);
- }
-
- function deg2rad(deg) {
- return (Math.PI * deg) / 180.0;
- }
-
- /* The Gauss error function gives the probability that a measurement (which is
- * under the influence of normally distributed errors with standard deviation
- * sigma = 1) is less than x from the mean value of the standard normal
- * distribution.
- * https://www.desmos.com/calculator/t1v4bdpske
- *
- * @param {number} x A tolerance for error.
- * @return {number} The probability that a measurement is less than |x| from
- * the mean value of the standard normal distribution.
- */
- function erf(x) {
- // save the sign of x
- // erf(-x) = -erf(x);
- var sign = (x >= 0) ? 1 : -1;
- x = Math.abs(x);
-
- // constants
- var a1 = 0.254829592;
- var a2 = -0.284496736;
- var a3 = 1.421413741;
- var a4 = -1.453152027;
- var a5 = 1.061405429;
- var p = 0.3275911;
-
- // Abramowitz and Stegun formula 7.1.26
- // maximum error: 1.5e-7
- var t = 1.0 / (1.0 + p * x);
- var y = 1.0 - (((((a5 * t + a4) * t) + a3) * t + a2) * t + a1) * t *
- Math.exp(-x * x);
- return sign * y;
- }
-
- var tmp_vec2 = vec2.create();
- var tmp_vec2b = vec2.create();
- var tmp_vec4 = vec4.create();
- var tmp_mat2d = mat2d.create();
-
- vec2.createFromArray = function(arr) {
- if (arr.length != 2)
- throw new Error('Should be length 2');
- var v = vec2.create();
- vec2.set(v, arr[0], arr[1]);
- return v;
- };
-
- vec2.createXY = function(x, y) {
- var v = vec2.create();
- vec2.set(v, x, y);
- return v;
- };
-
- vec2.toString = function(a) {
- return '[' + a[0] + ', ' + a[1] + ']';
- };
-
- vec2.addTwoScaledUnitVectors = function(out, u1, scale1, u2, scale2) {
- // out = u1 * scale1 + u2 * scale2
- vec2.scale(tmp_vec2, u1, scale1);
- vec2.scale(tmp_vec2b, u2, scale2);
- vec2.add(out, tmp_vec2, tmp_vec2b);
- };
-
- vec2.interpolatePiecewiseFunction = function(points, x) {
- if (x < points[0][0])
- return points[0][1];
- for (var i = 1; i < points.length; ++i) {
- if (x < points[i][0]) {
- var percent = normalize(x, points[i - 1][0], points[i][0]);
- return lerp(percent, points[i - 1][1], points[i][1]);
- }
- }
- return points[points.length - 1][1];
- };
-
- vec3.createXYZ = function(x, y, z) {
- var v = vec3.create();
- vec3.set(v, x, y, z);
- return v;
- };
-
- vec3.toString = function(a) {
- return 'vec3(' + a[0] + ', ' + a[1] + ', ' + a[2] + ')';
- };
-
- mat2d.translateXY = function(out, x, y) {
- vec2.set(tmp_vec2, x, y);
- mat2d.translate(out, out, tmp_vec2);
- };
-
- mat2d.scaleXY = function(out, x, y) {
- vec2.set(tmp_vec2, x, y);
- mat2d.scale(out, out, tmp_vec2);
- };
-
- vec4.unitize = function(out, a) {
- out[0] = a[0] / a[3];
- out[1] = a[1] / a[3];
- out[2] = a[2] / a[3];
- out[3] = 1;
- return out;
- };
-
- vec2.copyFromVec4 = function(out, a) {
- vec4.unitize(tmp_vec4, a);
- vec2.copy(out, tmp_vec4);
- };
-
- return {
- clamp: clamp,
- lerp: lerp,
- normalize: normalize,
- deg2rad: deg2rad,
- erf: erf
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/math_test.html b/chromium/third_party/catapult/tracing/tracing/base/math_test.html
deleted file mode 100644
index d342aad5f66..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/math_test.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/math.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('erf', function() {
- assert.closeTo(-1, tr.b.erf(-1e10), 1e-6);
- assert.closeTo(-0.8427, tr.b.erf(-1), 1e-6);
- assert.closeTo(-0.5205, tr.b.erf(-0.5), 1e-6);
- assert.closeTo(0, tr.b.erf(0), 1e-6);
- assert.closeTo(0.5205, tr.b.erf(0.5), 1e-6);
- assert.closeTo(0.8427, tr.b.erf(1), 1e-6);
- assert.closeTo(1, tr.b.erf(1e10), 1e-6);
- });
-
- test('clamping', function() {
- assert.equal(tr.b.clamp(2, 1, 3), 2);
- assert.equal(tr.b.clamp(1, 1, 3), 1);
- assert.equal(tr.b.clamp(0, 1, 3), 1);
- assert.equal(tr.b.clamp(3, 1, 3), 3);
- assert.equal(tr.b.clamp(4, 1, 3), 3);
- });
-
- test('interpolatePiecewiseFunction', function() {
- var points = [[0, 0], [0.1, 0.5], [1, 1]];
- assert.equal(0, vec2.interpolatePiecewiseFunction(points, -1));
- assert.equal(0, vec2.interpolatePiecewiseFunction(points, 0));
- assert.equal(0.25, vec2.interpolatePiecewiseFunction(points, 0.05));
- assert.equal(0.5, vec2.interpolatePiecewiseFunction(points, 0.1));
- assert.equal(0.75, vec2.interpolatePiecewiseFunction(points, 0.55));
- assert.equal(1, vec2.interpolatePiecewiseFunction(points, 1));
- assert.equal(1, vec2.interpolatePiecewiseFunction(points, 2));
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/multi_dimensional_view.html b/chromium/third_party/catapult/tracing/tracing/base/multi_dimensional_view.html
deleted file mode 100644
index f0cdb346db4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/multi_dimensional_view.html
+++ /dev/null
@@ -1,1167 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Multi-dimensional view data structure.
- *
- * A multi-dimensional view provides a hierarchical representation of a
- * collection of multi-dimensional paths with associated scalar values. Unlike
- * separate single-dimensional views (e.g. one tree for each dimension),
- * multi-dimensional views facilitate aggregation over combinations of
- * substrings of the path dimensions (rather than just substrings of a single
- * path dimension).
- *
- * Every view consists of multi-dimensional nodes (see MultiDimensionalViewNode
- * for more details). This file also provides a builder class for constructing
- * top-down and bottom-up representations of arbitrary collections of
- * multi-dimensional paths (see MultiDimensionalViewBuilder for more details).
- *
- * Example: Given the following collection of two dimensional paths:
- *
- * <===================== Path =====================> <== Total values ===>
- * <------- dimension 0 -------> <- dimension 1 -> <- v 0 -> <- v 1 ->
- * [['Run()', 'Exec()', 'Call()'], ['Obj', 'View'] ]: [1 , 3
- * [['Run()', 'Exec()', 'Call()'], ['Obj', 'Widget']]: [2 , 5
- * [['Run()', 'Exec()', 'Load()'], ['Obj'] ]: [4 , 11
- * [['Run()', 'Exec()'] , ['int'] ]: [8 , 7
- * [['Run()'] , ['Obj', 'Window']]: [16 , 0
- * [['Stop()'] , ['Obj'] ]: [32 , 13
- *
- * a multi-dimensional view provides a recursive breakdown of the aggregated
- * values, e.g. (total values shown in square brackets):
- *
- * (root): [63, 39]
- * |
- * | break down by 0th dimension
- * v
- * Run(): [31, 26]
- * |
- * | break down by 0th dimension
- * v
- * Exec(): [15, 26]
- * |
- * | break down by 1st dimension
- * v
- * Obj: [7, 19]
- * |
- * | break down by 0th dimension again
- * v
- * Call(): [3, 8]
- * |
- * | break down by 1st dimension again
- * v
- * View: [1, 3]
- *
- * Observe that the recursive breakdown above is over both dimensions.
- * Furthermore, the underlying single-dimension paths (Run() -> Exec() -> Call()
- * and Obj -> View) can be arbitrarily interleaved in the breakdown.
- */
-tr.exportTo('tr.b', function() {
-
- /**
- * Node of a multi-dimensional view.
- *
- * The structure of a view is encoded in the nodes using links to their
- * children wrt each dimension. The diagram below shows how the nodes
- * corresponding to the following four two-dimensional view paths:
- *
- * 1. [['A', 'B'], ['1', '2']]
- * 2. [['A', 'C'], ['1', '2']]
- * 3. [['A', 'B'], ['1', '3']]
- * 4. [['A', 'C'], ['1', '3']]
- *
- * can be reached from the root of a two-dimensional view using these links
- * ('*' stands for undefined):
- *
- * +---------------------+
- * | title: [*,*] (root) |
- * +---------------------+
- * children wrt children wrt
- * 0th dimension 1st dimension
- * | :
- * _______A________| :........1.........
- * | :
- * v v
- * +--------------+ +--------------+
- * | title: [A,*] | | title: [*,1] |
- * +--------------+ +--------------+
- * children wrt children wrt children wrt children wrt
- * 0th dimension 1st dimension 0th dimension 1st dimension
- * | | :.....1...... _____A_____| : :
- * _B_| |__C__ : | ...2..: :.3..
- * | | : | : :
- * v v v v v v
- * +-------+ +-------+ +-------+ +-------+ +-------+
- * | [B,*] | | [C,*] | | [A,1] | | [*,2] | | [*,3] |
- * +-------+ +-------+ +-------+ +-------+ +-------+
- * : ___:_____B______| | : :......3.....|.... |
- * :.1.. | :.1.. __C___| :...2... _A_| : _A_|
- * : | : | : | : |
- * v v v v v v v v
- * +-------+ +-------+ +-------+ +-------+
- * | [B,1] | | [C,1] | | [A,2] | | [A,3] |
- * +-------+ +-------+ +-------+ +-------+
- * : : : :.......3.......||.......... ||
- * : :..3....:................ BC : BC
- * : ______:_______________:___|| : ||
- * 2 | 2 _______:____| ______:___||
- * : | : | : | : |
- * v v v v v v v v
- * +----------+ +----------+ +----------+ +----------+
- * | [B,2] | | [C,2] | | [B,3] | | [C,3] |
- * | (node 1) | | (node 2) | | (node 3) | | (node 4) |
- * +----------+ +----------+ +----------+ +----------+
- *
- * The self/total values of a node represents the aggregated values of all
- * paths (in the collection from which the view was built) matching the node
- * excluding/including the node's descendants.
- *
- * Terminology examples:
- *
- * - Children of [A,*] wrt 0th dimension: [B,*], [C,*]
- * - Children of [A,*] (wrt all dimensions): [B,*], [C,*], [A,1]
- * - Descendants of [A,*] wrt 1st dimension: [A,1], [A,2], [A,3]
- * - Single-dimensional descendants of [A,*]: [A,1], [A,2], [A,3], [B,*],
- * [C,*]
- * - Descendants of [A,*] (wrt all dimensions): [A,1], [A,2], [A,3], [B,*],
- * [C,*], [B,1], [C,1], [B,2], [C,2], [B,3], [C,3]
- *
- * @{constructor}
- */
- function MultiDimensionalViewNode(title, valueCount) {
- // List of titles of this node wrt each dimension.
- this.title = title;
-
- // Map from child name to child node for each dimension.
- var dimensions = title.length;
- this.children = new Array(dimensions);
- for (var i = 0; i < dimensions; i++)
- this.children[i] = new Map();
-
- // For each value index (from 0 to |valueCount| - 1), we store the self and
- // total values together with a Boolean flag whether the value is only a
- // lower bound (i.e. aggregated from children rather than provided
- // directly).
- this.values = new Array(valueCount);
- for (var v = 0; v < valueCount; v++)
- this.values[v] = { self: 0, total: 0, totalState: NOT_PROVIDED };
- }
-
- /**
- * States of total values stored in multi-dimensional view nodes.
- *
- * @enum
- */
- MultiDimensionalViewNode.TotalState = {
- // Neither total nor self value was provided for either the node or any of
- // its descendants.
- NOT_PROVIDED: 0,
-
- // The total value was NOT provided for the node, but the self value was
- // provided for the node or the total or self value was provided for at
- // least one of its descendants.
- LOWER_BOUND: 1,
-
- // The total value was provided for the node.
- EXACT: 2
- };
- // Cache the total value states to avoid repeated object field lookups.
- var NOT_PROVIDED = MultiDimensionalViewNode.TotalState.NOT_PROVIDED;
- var LOWER_BOUND = MultiDimensionalViewNode.TotalState.LOWER_BOUND;
- var EXACT = MultiDimensionalViewNode.TotalState.EXACT;
-
- MultiDimensionalViewNode.prototype = {
- /** Duck type <tr-ui-b-table> rows. */
- get subRows() {
- return tr.b.mapValues(this.children[0]);
- }
- };
-
- /**
- * Builder for multi-dimensional views.
- *
- * Given a collection of multi-dimensional paths, a builder can be used to
- * construct the following three representations of the paths:
- *
- * 1. Top-down tree view
- * A multi-dimensional path in the view corresponds to all paths in the
- * collection that have it as their prefix.
- *
- * 2. Top-down heavy view
- * A multi-dimensional path in the view corresponds to all paths in the
- * collection that have it as their substring
- *
- * 3. Bottom-up heavy view
- * A multi-dimensional path in the view corresponds to all paths in the
- * collection that have it as their substring reversed.
- *
- * For example, the following collection of 2-dimensional paths (with single
- * values):
- *
- * 2-dimensional path | self
- * Time (0th dimension) | Activity (1st dimension) | value
- * ========================+========================+=======
- * Saturday | Cooking | 1 h
- * Saturday | Sports -> Football | 2 h
- * Sunday | Sports -> Basketball | 3 h
- *
- * gives rise to the following top-down tree view, which aggregates the
- * scalar values over prefixes of the given paths:
- *
- * +---------+
- * | * |
- * | * |
- * | self=0 |
- * | total=6 |
- * +---------+
- * | : | :
- * _________Cooking_______| : | :............Sunday............
- * | : | :
- * | ...Saturday..: |_Sports_ :
- * | : | :
- * v v v v
- * +---------+ +---------+ +---------+ +---------+
- * | * | | Sat | | * | | Sun |
- * | Cooking | | * | | Sports | | * |
- * | self=0 | | self=0 | | self=0 | | self=0 |
- * | total=1 | | total=3 | | total=5 | | total=3 |
- * +---------+ +---------+ +---------+ +---------+
- * : | | : | | : |
- * Saturday | Sports : | | : Sports
- * : | | .....Saturday....: | | :.....Sunday....... |
- * : _Cook_| | : _Foot_| |_Bask_ : |
- * : | | : | | : |
- * v v v v v v v v
- * +---------+ +---------+ +------------+ +--------------+ +---------+
- * | Sat | | Sat | | * | | * | | Sun |
- * | Cooking | | Sports | | S/Football | | S/Basketball | | Sports |
- * | self=1 | | self=0 | | self=0 | | self=0 | | self=0 |
- * | total=1 | | total=2 | | total=2 | | total=3 | | total=3 |
- * +---------+ +---------+ +------------+ +--------------+ +---------+
- * | : : |
- * |_Foot_ ..Sat.: :.Sun.. _Bask_|
- * | : : |
- * v v v v
- * +------------+ +--------------+
- * | Sat | | Sun |
- * | S/Football | | S/Basketball |
- * | self=2 | | self=3 |
- * | total=2 | | total=3 |
- * +------------+ +--------------+
- *
- * To build a multi-dimensional view of a collection of multi-dimensional
- * paths, you create a builder, add the paths to it and then use it to
- * construct the view. For example, the following code generates the
- * 2-dimensional top-down tree view shown above:
- *
- * var builder = new MultiDimensionalViewBuilder(2);
- * builder.addPath([['Saturday'], ['Cooking']], [1], SELF);
- * builder.addPath([['Saturday'], ['Sports', 'Football']], [2], SELF);
- * builder.addPath([['Sunday'], ['Sports', 'Basketball']], [3], SELF);
- * var treeViewRoot = builder.buildTopDownTreeView();
- *
- * The heavy views can be constructed analogously (by calling
- * buildTopDownHeavyView() or buildBottomUpHeavyView() at the end instead).
- *
- * Note that the same builder can be used to construct both the tree and
- * heavy views (for the same collection of paths). However, no more paths can
- * be added once either view has been built.
- *
- * @{constructor}
- */
- function MultiDimensionalViewBuilder(dimensions, valueCount) {
- if (typeof(dimensions) !== 'number' || dimensions < 0)
- throw new Error('Dimensions must be a non-negative number');
- this.dimensions_ = dimensions;
-
- if (typeof(valueCount) !== 'number' || valueCount < 0)
- throw new Error('Number of values must be a non-negative number');
- this.valueCount_ = valueCount;
-
- this.buildRoot_ = this.createRootNode_();
- this.topDownTreeViewRoot_ = undefined;
- this.topDownHeavyViewRoot_ = undefined;
- this.bottomUpHeavyViewNode_ = undefined;
-
- this.maxDimensionDepths_ = new Array(dimensions);
- for (var d = 0; d < dimensions; d++)
- this.maxDimensionDepths_[d] = 0;
- }
-
- /** @{enum} */
- MultiDimensionalViewBuilder.ValueKind = {
- SELF: 0,
- TOTAL: 1
- };
-
- /**
- * Types of multi-dimensional views provided by MultiDimensionalViewBuilder.
- *
- * @enum
- */
- MultiDimensionalViewBuilder.ViewType = {
- TOP_DOWN_TREE_VIEW: 0,
- TOP_DOWN_HEAVY_VIEW: 1,
- BOTTOM_UP_HEAVY_VIEW: 2
- };
-
- MultiDimensionalViewBuilder.prototype = {
- /**
- * Add values associated with a multi-dimensional path to the tree.
- *
- * The path must have the same number of dimensions as the builder. Its
- * elements must be single-dimension paths (lists of strings) of arbitrary
- * length (empty for the root of the given dimension). Starting from the
- * root of the tree, each single-dimension path is traversed from left to
- * right to reach the node corresponding to the whole path.
- *
- * The length of the provided list of values must be equal to the builder's
- * value count. The builder supports adding both kinds of values
- * (self/total) wrt all value indices for an arbitrary multi-dimensional
- * path. The rationale for adding total values (in addition to/instead of
- * self values) is to cater for missing sub-paths. Example: Consider the
- * following collection of single-dimensional paths (with single values):
- *
- * [['Loop::Run()', 'Execute()', 'FunctionBig']]: self=99000
- * [['Loop::Run()', 'Execute()', 'FunctionSmall1']]: self=1
- * [['Loop::Run()', 'Execute()', 'FunctionSmall2']]: self=1
- * ...
- * [['Loop::Run()', 'Execute()', 'FunctionSmall1000']]: self=1
- *
- * If we required that only self values could be added to the builder, then
- * all of the 1001 paths would need to be provided (most likely in a trace)
- * to obtain the correct total of [['Loop::Run()', 'Execute()']]. However,
- * since we allow adding total values as well, only the following 2 paths
- * need to be provided to get the correct numbers explaining 99% of the
- * aggregated total value:
- *
- * [['Loop::Run()', 'Execute()']]: total=100000
- * [['Loop::Run()', 'Execute()', 'FunctionBig']]: self=99000
- *
- * In other words, the long tail containing 1000 small paths need not be
- * dumped (greatly reducing the size of a trace where applicable).
- *
- * Important: No paths can be added to a builder once either view has been
- * built!
- */
- addPath: function(path, values, valueKind) {
- if (this.buildRoot_ === undefined) {
- throw new Error(
- 'Paths cannot be added after either view has been built');
- }
- if (path.length !== this.dimensions_)
- throw new Error('Path must be ' + this.dimensions_ + '-dimensional');
- if (values.length !== this.valueCount_)
- throw new Error('Must provide ' + this.valueCount_ + ' values');
-
- var isTotal;
- switch (valueKind) {
- case MultiDimensionalViewBuilder.ValueKind.SELF:
- isTotal = false;
- break;
- case MultiDimensionalViewBuilder.ValueKind.TOTAL:
- isTotal = true;
- break;
- default:
- throw new Error('Invalid value kind: ' + valueKind);
- }
-
- var node = this.buildRoot_;
- for (var d = 0; d < path.length; d++) {
- var singleDimensionPath = path[d];
- var singleDimensionPathLength = singleDimensionPath.length;
- this.maxDimensionDepths_[d] =
- Math.max(this.maxDimensionDepths_[d], singleDimensionPathLength);
- for (var i = 0; i < singleDimensionPathLength; i++)
- node = this.getOrCreateChildNode_(node, d, singleDimensionPath[i]);
- }
-
- for (var v = 0; v < this.valueCount_; v++) {
- var addedValue = values[v];
- if (addedValue === undefined)
- continue;
- var nodeValue = node.values[v];
- if (isTotal) {
- nodeValue.total += addedValue;
- nodeValue.totalState = EXACT;
- } else {
- nodeValue.self += addedValue;
- nodeValue.totalState = Math.max(nodeValue.totalState, LOWER_BOUND);
- }
- }
- },
-
- buildView: function(viewType) {
- switch (viewType) {
- case MultiDimensionalViewBuilder.ViewType.TOP_DOWN_TREE_VIEW:
- return this.buildTopDownTreeView();
- case MultiDimensionalViewBuilder.ViewType.TOP_DOWN_HEAVY_VIEW:
- return this.buildTopDownHeavyView();
- case MultiDimensionalViewBuilder.ViewType.BOTTOM_UP_HEAVY_VIEW:
- return this.buildBottomUpHeavyView();
- default:
- throw new Error('Unknown multi-dimensional view type: ' + viewType);
- }
- },
-
- /**
- * Build the top-down tree view of the multi-dimensional view.
- *
- * Note that no more paths can be added to the builder once either view has
- * been built.
- */
- buildTopDownTreeView: function() {
- if (this.topDownTreeViewRoot_ === undefined) {
- var treeViewRoot = this.buildRoot_;
- this.buildRoot_ = undefined;
-
- this.setUpMissingChildRelationships_(treeViewRoot,
- 0 /* firstDimensionToSetUp */);
- this.finalizeTotalValues_(treeViewRoot,
- 0 /* firstDimensionToFinalize */,
- new WeakMap() /* dimensionalSelfSumsMap */);
-
- this.topDownTreeViewRoot_ = treeViewRoot;
- }
-
- return this.topDownTreeViewRoot_;
- },
-
- /**
- * Build the top-down heavy view of the multi-dimensional view.
- *
- * Note that no more paths can be added to the builder once either view has
- * been built.
- */
- buildTopDownHeavyView: function() {
- if (this.topDownHeavyViewRoot_ === undefined) {
- this.topDownHeavyViewRoot_ = this.buildGenericHeavyView_(
- this.addDimensionToTopDownHeavyViewNode_.bind(this));
- }
- return this.topDownHeavyViewRoot_;
- },
-
- /**
- * Build the bottom-up heavy view of the multi-dimensional view.
- *
- * Note that no more paths can be added to the builder once either view has
- * been built.
- */
- buildBottomUpHeavyView: function() {
- if (this.bottomUpHeavyViewNode_ === undefined) {
- this.bottomUpHeavyViewNode_ = this.buildGenericHeavyView_(
- this.addDimensionToBottomUpHeavyViewNode_.bind(this));
- }
- return this.bottomUpHeavyViewNode_;
- },
-
- createRootNode_: function() {
- return new MultiDimensionalViewNode(
- new Array(this.dimensions_) /* title */, this.valueCount_);
- },
-
- getOrCreateChildNode_: function(
- parentNode, dimension, childDimensionTitle) {
- if (dimension < 0 || dimension >= this.dimensions_)
- throw new Error('Invalid dimension');
-
- var dimensionChildren = parentNode.children[dimension];
-
- var childNode = dimensionChildren.get(childDimensionTitle);
- if (childNode !== undefined)
- return childNode;
-
- var childTitle = parentNode.title.slice();
- childTitle[dimension] = childDimensionTitle;
- childNode = new MultiDimensionalViewNode(childTitle, this.valueCount_);
- dimensionChildren.set(childDimensionTitle, childNode);
-
- return childNode;
- },
-
- /**
- * Set up missing child relationships.
- *
- * When an arbitrary multi-dimensional path [path1, path2, ..., pathN] is
- * added to the build tree (see addPath), only the nodes on the path1 ->
- * path2 -> ... -> pathN chain are created (i.e. no interleavings of the
- * single-dimensional paths are added to the tree). This method recursively
- * adds all the missing paths.
- *
- * Two-dimensional example:
- *
- * Initial build tree . After path . After missing child
- * (root only) . [[A, B], [1, 2]] . relationships were
- * . was added . set up
- * . .
- * +---+ . +---+ . +---+
- * |*,*| . |*,*| . |*,*|
- * +---+ . +---+ . +---+
- * . A . A 1
- * . | . | :
- * . v . v V
- * . +---+ . +---+ +---+
- * . |A,*| . |A,*| |*,1|
- * . +---+ . +---+ +---+
- * . B . B 1 A 2
- * . | . | : | :
- * . v . v v v v
- * . +---+ . +---+ +---+ +---+
- * . |B,*| . |B,*| |A,1| |*,2|
- * . +---+ . +---+ +---+ +---+
- * . 1 . 1 B 2 A
- * . : . : | : |
- * . v . v v v v
- * . +---+ . +---+ +---+
- * . |B,1| . |B,1| |A,2|
- * . +---+ . +---+ +---+
- * . 2 . 2 B
- * . : . : |
- * . v . v V
- * . +---+ . +---+
- * . |B,2| . |B,2|
- * . +---+ . +---+
- */
- setUpMissingChildRelationships_: function(node, firstDimensionToSetUp) {
- // Missing child relationships of this node wrt dimensions 0, ...,
- // (firstDimensionToSetUp - 1) and all descendants of the associated
- // children have already been set up. Now we do the same for dimensions
- // firstDimensionToSetUp, ..., (this.dimensions_ - 1).
- for (var d = firstDimensionToSetUp; d < this.dimensions_; d++) {
- // Step 1. Gather the names of all children wrt the current dimension.
- var currentDimensionChildTitles = new Set(node.children[d].keys());
- for (var i = 0; i < d; i++) {
- for (var previousDimensionChildNode of node.children[i].values()) {
- for (var previousDimensionGrandChildTitle of
- previousDimensionChildNode.children[d].keys()) {
- currentDimensionChildTitles.add(previousDimensionGrandChildTitle);
- }
- }
- }
-
- // Step 2. Add missing children wrt the current dimension and
- // recursively set up its missing child relationships.
- for (var currentDimensionChildTitle of currentDimensionChildTitles) {
- // Add a missing child (if it doesn't exist).
- var currentDimensionChildNode =
- this.getOrCreateChildNode_(node, d, currentDimensionChildTitle);
-
- // Set-up child relationships (of the child node) wrt dimensions 0,
- // ..., d - 1.
- for (var i = 0; i < d; i++) {
- for (var previousDimensionChildNode of node.children[i].values()) {
- var previousDimensionGrandChildNode =
- previousDimensionChildNode.children[d].get(
- currentDimensionChildTitle);
- if (previousDimensionGrandChildNode !== undefined) {
- currentDimensionChildNode.children[i].set(
- previousDimensionChildNode.title[i],
- previousDimensionGrandChildNode);
- }
- }
- }
-
- // Set-up child relationships (of the child node) wrt dimensions d,
- // ..., (this.dimensions_ - 1).
- this.setUpMissingChildRelationships_(currentDimensionChildNode, d);
- }
- }
- },
-
- /**
- * Finalize the total values of a multi-dimensional tree.
- *
- * The intermediate builder tree, a node of which we want to finalize
- * recursively, already has the right shape. The only thing that needs to
- * be done is to propagate self and total values from subsumed child nodes
- * in each dimension and update total value states appropriately.
- *
- * To derive the expression for the lower bound on the total value wrt
- * value index V (from 1 to |this.valueCount_| - 1), we rely on the
- * following assumptions:
- *
- * 1. Self/total values associated with different value indices are
- * independent. From this point onwards, "self/total value" refers to
- * self/total value wrt the fixed value index V.
- *
- * 2. Each node's self value does NOT overlap with the self or total value
- * of any other node.
- *
- * 3. The total values of a node's children wrt a single dimension (e.g.
- * [path1/A, path2] and [path1/B, path2]) do NOT overlap.
- *
- * 4. The total values of a node's children wrt different dimensions
- * (e.g. [path1/A, path2] and [path1, path2/1]) MIGHT overlap.
- *
- * As a consequence of assumptions 1 and 3, the total value of a node can
- * be split into the part that cannot overlap (so-called "self-sum") and
- * the part that can overlap (so-called "residual"):
- *
- * total(N, V) = selfSum(N, V) + residual(N, V) (A)
- *
- * where the self-sum is calculated as the sum of the node's self value
- * plus the sum of its descendants' self values (summed over all
- * dimensions):
- *
- * selfSum(N, V) = self(N, V) + sum over all descendants C of N {
- * self(C, V) (B)
- * }
- *
- * Observe that the residual of a node does not include any self value (of
- * any node in the view). Furthermore, by assumption 2, we derive that the
- * residuals of a node's children wrt a single dimension don't overlap. On
- * the other hand, the residuals of a node's children wrt different
- * dimensions might overlap. This gives us the following lower bound on the
- * residual of a node:
- *
- * residual(N, V) >= minResidual(N, V) = max over dimensions D {
- * sum over children C of N at dimension D {
- * residual(C, V) (C)
- * }
- * })
- *
- * By combining equation (A) and inequality (C), we get a lower bound on
- * the total value of a node:
- *
- * total(N, V) >= selfSum(N, V) + minResidual(N, V)
- *
- * For example, given a two-dimensional node [path1, path2] with self value
- * 10 and four children (2 wrt each dimension):
- *
- * Child | Self value | Total value
- * ==================+============+=============
- * [path1/A, path2] | 21 | 30
- * [path1/B, path2] | 25 | 32
- * [path1, path2/1] | 3 | 15
- * [path1, path2/2] | 40 | 41
- *
- * and assuming that the children have no further descendants (i.e. their
- * residual values are equal to the differences between their total and
- * self values), the lower bound on the total value of [path1, path2] is:
- *
- * total([path1, path2], 0)
- * >= selfSum([path1, path2], 0) +
- * minResidual([path1, path2], 0)
- * = self([path1, path2], 0) +
- * sum over all descendants C of [path1, path2] {
- * self (C, 0)
- * } +
- * max over dimensions D {
- * sum over children C of [path1, path2] at dimension D {
- * residual(C, 0)
- * }
- * }
- * = self([path1, path2], 0) +
- * ((self([path1/A, path2], 0) + self([path1/B, path2], 0)) +
- * (self([path1, path2/1], 0) + self([path1, path2/2], 0))) +
- * max(residual([path1/A, path2], 0) +
- * residual([path1/B, path2], 0),
- * residual([path1, path2/1], 0) +
- * residual([path1, path2/2], 0))
- * = 10 +
- * ((21 + 25) + (3 + 40)) +
- * max((30 - 21) + (32 - 25), (15 - 3) + (41 - 40))
- * = 115
- *
- * To reduce the complexity of the calculation, we keep a temporary list of
- * dimensional self-sums for each node that we have already visited. For a
- * given node, the Kth element in the list is equal to the self size of the
- * node plus the sum of self sizes of all its descendants wrt dimensions 0
- * to K (inclusive). The list has two important properties:
- *
- * 1. The last element in the list is equal to the self-sum of the
- * associated node (equation (B)).
- *
- * 2. The calculation of the list can be performed recursively using the
- * lists of the associated node's children (avoids square complexity
- * in the size of the graph):
- *
- * dimensionalSelfSum(N, V)[D] =
- * self(N, V) +
- * sum I = 0 to D {
- * sum over children C of N at dimension I {
- * dimensionalSelfSum(C, V)[I]
- * }
- * }
- *
- * This method also (recursively) ensures that, for each value index V, if
- * at least one of the descendants C of node N has at least a LOWER_BOUND
- * on total(C, V), then the N will also be marked as having a LOWER_BOUND
- * on total(N, V) (unless N contains the EXACT value of total(N, V), in
- * which case its relevant totalState won't be modified).
- */
- finalizeTotalValues_: function(
- node, firstDimensionToFinalize, dimensionalSelfSumsMap) {
- // Dimension D -> Value index V -> dimensionalSelfSum(|node|, V)[D].
- var dimensionalSelfSums = new Array(this.dimensions_);
-
- // Value index V -> minResidual(|node|, V).
- var minResidual = new Array(this.valueCount_);
- for (var v = 0; v < this.valueCount_; v++)
- minResidual[v] = 0;
-
- // Value index V -> |node| value V.
- var nodeValues = node.values;
-
- // Value index V -> dimensionalSelfSum(|node|, V)[|d|].
- var nodeSelfSums = new Array(this.valueCount_);
- for (var v = 0; v < this.valueCount_; v++)
- nodeSelfSums[v] = nodeValues[v].self;
-
- for (var d = 0; d < this.dimensions_; d++) {
- // Value index V -> sum over children C of |node| at dimension |d| {
- // residual(C, V) }.
- var childResidualSums = new Array(this.valueCount_);
- for (var v = 0; v < this.valueCount_; v++)
- childResidualSums[v] = 0;
-
- for (var childNode of node.children[d].values()) {
- if (d >= firstDimensionToFinalize)
- this.finalizeTotalValues_(childNode, d, dimensionalSelfSumsMap);
- // Dimension D -> Value index V ->
- // dimensionalSelfSum(|childNode|, V)[D].
- var childNodeSelfSums = dimensionalSelfSumsMap.get(childNode);
- var childNodeValues = childNode.values;
- for (var v = 0; v < this.valueCount_; v++) {
- nodeSelfSums[v] += childNodeSelfSums[d][v];
- var residual = childNodeValues[v].total -
- childNodeSelfSums[this.dimensions_ - 1][v];
- childResidualSums[v] += residual;
- if (childNodeValues[v].totalState > NOT_PROVIDED) {
- nodeValues[v].totalState = Math.max(
- nodeValues[v].totalState, LOWER_BOUND);
- }
- }
- }
-
- dimensionalSelfSums[d] = nodeSelfSums.slice();
- for (var v = 0; v < this.valueCount_; v++)
- minResidual[v] = Math.max(minResidual[v], childResidualSums[v]);
- }
-
- for (var v = 0; v < this.valueCount_; v++) {
- nodeValues[v].total = Math.max(
- nodeValues[v].total, nodeSelfSums[v] + minResidual[v]);
- }
-
- if (dimensionalSelfSumsMap.has(node))
- throw new Error('Internal error: Node finalized more than once');
- dimensionalSelfSumsMap.set(node, dimensionalSelfSums);
- },
-
- /**
- * Build a generic heavy view of the multi-dimensional view.
- */
- buildGenericHeavyView_: function(treeViewNodeHandler) {
- // 1. Clone the root node of the top-down tree view node (except
- // children).
- var treeViewRoot = this.buildTopDownTreeView();
- var heavyViewRoot = this.createRootNode_();
- heavyViewRoot.values = treeViewRoot.values;
-
- // 2. Create recursion depth trackers (to avoid total value
- // double-counting).
- var recursionDepthTrackers = new Array(this.dimensions_);
- for (var d = 0; d < this.dimensions_; d++) {
- recursionDepthTrackers[d] =
- new RecursionDepthTracker(this.maxDimensionDepths_[d], d);
- }
-
- // 3. Add all paths associated with the single-dimensional descendants of
- // the top-down tree view root node to the heavy view root node
- // (depending on the type of the target heavy view).
- this.addDimensionsToGenericHeavyViewNode_(treeViewRoot, heavyViewRoot,
- 0 /* startDimension */, recursionDepthTrackers,
- false /* previousDimensionsRecursive */, treeViewNodeHandler);
-
- // 4. Set up missing child relationships.
- this.setUpMissingChildRelationships_(heavyViewRoot,
- 0 /* firstDimensionToSetUp */);
-
- return heavyViewRoot;
- },
-
- /**
- * Add all paths associated with the single-dimensional descendants of a
- * top-down tree-view node wrt multiple dimensions to a generic heavy-view
- * node (depending on the type of the target heavy view).
- */
- addDimensionsToGenericHeavyViewNode_: function(treeViewParentNode,
- heavyViewParentNode, startDimension, recursionDepthTrackers,
- previousDimensionsRecursive, treeViewNodeHandler) {
- for (var d = startDimension; d < this.dimensions_; d++) {
- this.addDimensionDescendantsToGenericHeavyViewNode_(treeViewParentNode,
- heavyViewParentNode, d, recursionDepthTrackers,
- previousDimensionsRecursive, treeViewNodeHandler);
- }
- },
-
- /**
- * Add all paths associated with the descendants of a top-down tree-view
- * node wrt a single dimension to a generic heavy-view node (depending on
- * the type of the target heavy view).
- */
- addDimensionDescendantsToGenericHeavyViewNode_: function(treeViewParentNode,
- heavyViewParentNode, currentDimension, recursionDepthTrackers,
- previousDimensionsRecursive, treeViewNodeHandler) {
- var treeViewChildren = treeViewParentNode.children[currentDimension];
- var recursionDepthTracker = recursionDepthTrackers[currentDimension];
- for (var treeViewChildNode of treeViewChildren.values()) {
- recursionDepthTracker.push(treeViewChildNode);
-
- // Add all paths associated with the child node to the heavy view-node
- // parent node.
- treeViewNodeHandler(
- treeViewChildNode, heavyViewParentNode, currentDimension,
- recursionDepthTrackers, previousDimensionsRecursive);
-
- // Recursively add all paths associated with the descendants of the
- // tree view child node wrt the current dimension to the heavy-view
- // parent node.
- this.addDimensionDescendantsToGenericHeavyViewNode_(treeViewChildNode,
- heavyViewParentNode, currentDimension, recursionDepthTrackers,
- previousDimensionsRecursive, treeViewNodeHandler);
-
- recursionDepthTracker.pop();
- }
- },
-
- /**
- * Add a top-down tree-view child node together with its single-dimensional
- * subtree to a top-down heavy-view parent node (tree-view node handler for
- * top-down heavy view).
- *
- * Sample resulting top-down heavy view:
- *
- * +----------------+ +-----------------+
- * | source | | destination |
- * | tree-view root | ===============> | heavy-view root |
- * | self=0 | | self=0 |
- * | total=48 | | total=48 |
- * +----------------+ +-----------------+
- * | | ______| | |______
- * v v v v v
- * +----------+ +----------+ +----------+ +----------+ +----------+
- * | A* | | B | | A*** | | B | | C |
- * | self=10 | | self=12 | | self=13 | | self=13 | | self=2 |
- * | total=30 | | total=18 | | total=30 | | total=34 | | total=7 |
- * +----------+ +----------+ +----------+ +----------+ +----------+
- * | : : :.........
- * v v v v
- * +----------+ ............ ............ ............
- * | B | : B : : A : : C :
- * | self=1 | : self=1 : : self=3 : : self=2 :
- * | total=16 | : total=16 : : total=8 : : total=7 :
- * +----------+ ............ ............ ............
- * | |________ : :.........
- * v v v v
- * +----------+ +----------+ ............ ............
- * | A** | | C | : A : : C :
- * | self=3 | | self=2 | : self=3 : : self=2 :
- * | total=8 | | total=7 | : total=8 : : total=7 :
- * +----------+ +----------+ ............ ............
- *
- * Observe that care needs to be taken when dealing with recursion to avoid
- * double-counting, e.g. the total value of A** (8) was not added to the
- * total value of A*** (30) because it is already included in the total
- * value of A* (30) (which was also added to A***). That is why we need to
- * keep track of the path we traversed along the current dimension (to
- * determine whether total value should be added or not).
- */
- addDimensionToTopDownHeavyViewNode_: function(
- treeViewChildNode, heavyViewParentNode, currentDimension,
- recursionDepthTrackers, previousDimensionsRecursive) {
- this.addDimensionToTopDownHeavyViewNodeRecursively_(treeViewChildNode,
- heavyViewParentNode, currentDimension, recursionDepthTrackers,
- previousDimensionsRecursive, 1 /* subTreeDepth */);
- },
-
- addDimensionToTopDownHeavyViewNodeRecursively_: function(
- treeViewChildNode, heavyViewParentNode, currentDimension,
- recursionDepthTrackers, previousDimensionsRecursive, subTreeDepth) {
- var recursionDepthTracker = recursionDepthTrackers[currentDimension];
- var currentDimensionRecursive =
- subTreeDepth <= recursionDepthTracker.recursionDepth;
- var currentOrPreviousDimensionsRecursive =
- currentDimensionRecursive || previousDimensionsRecursive;
-
- var dimensionTitle = treeViewChildNode.title[currentDimension];
- var heavyViewChildNode = this.getOrCreateChildNode_(
- heavyViewParentNode, currentDimension, dimensionTitle);
-
- this.addNodeValues_(treeViewChildNode, heavyViewChildNode,
- !currentOrPreviousDimensionsRecursive /* addTotal */);
-
- // Add the descendants of the tree-view child node wrt the next
- // dimensions as children of the heavy-view child node.
- this.addDimensionsToGenericHeavyViewNode_(treeViewChildNode,
- heavyViewChildNode, currentDimension + 1, recursionDepthTrackers,
- currentOrPreviousDimensionsRecursive,
- this.addDimensionToTopDownHeavyViewNode_.bind(this));
-
- for (var treeViewGrandChildNode of
- treeViewChildNode.children[currentDimension].values()) {
- recursionDepthTracker.push(treeViewGrandChildNode);
-
- // Recursively add the tree-view grandchild node to the heavy-view
- // child node.
- this.addDimensionToTopDownHeavyViewNodeRecursively_(
- treeViewGrandChildNode, heavyViewChildNode, currentDimension,
- recursionDepthTrackers, previousDimensionsRecursive,
- subTreeDepth + 1);
-
- recursionDepthTracker.pop();
- }
- },
-
- /**
- * Add a top-down tree-view child node together with all its ancestors wrt
- * the given dimension as descendants of a bottom-up heavy-view parent node
- * in the reverse order (tree-view node handler for bottom-up heavy view).
- *
- * Sample resulting bottom-up heavy view:
- *
- * +----------------+ +-----------------+
- * | source | | destination |
- * | tree-view root | ===============> | heavy-view root |
- * | self=0 | | self=0 |
- * | total=48 | | total=48 |
- * +----------------+ +-----------------+
- * | | ______| | |______
- * v v v v v
- * +----------+ +----------+ +----------+ +----------+ +----------+
- * | A* | | B | | A*** | | B | | C |
- * | self=10 | | self=12 | | self=13 | | self=13 | | self=2 |
- * | total=30 | | total=18 | | total=30 | | total=34 | | total=7 |
- * +----------+ +----------+ +----------+ +----------+ +----------+
- * | : : :
- * v v v v
- * +----------+ ............ ............ ............
- * | B# | : B : : A : : B## :
- * | self=1 | : self=3 : : self=1 : : self=2 :
- * | total=16 | : total=8 : : total=16 : : total=7 :
- * +----------+ ............ ............ ............
- * | |________ : :
- * v v v v
- * +----------+ +----------+ ............ ............
- * | A** | | C | : A : : A :
- * | self=3 | | self=2 | : self=3 : : self=2 :
- * | total=8 | | total=7 | : total=8 : : total=7 :
- * +----------+ +----------+ ............ ............
- *
- * Similarly to the construction of the top-down heavy view, care needs to
- * be taken when dealing with recursion to avoid double-counting, e.g. the
- * total value of A** (8) was not added to the total value of A*** (30)
- * because it is already included in the total value of A* (30) (which was
- * also added to A***). That is why we need to keep track of the path we
- * traversed along the current dimension (to determine whether total value
- * should be added or not).
- *
- * Note that when we add an ancestor (B#) of a top-down tree-view node (C)
- * to the bottom-up heavy view, the values of the original tree-view node
- * (C) (rather than the ancestor's values) are added to the corresponding
- * heavy-view node (B##).
- */
- addDimensionToBottomUpHeavyViewNode_: function(
- treeViewChildNode, heavyViewParentNode, currentDimension,
- recursionDepthTrackers, previousDimensionsRecursive) {
- var recursionDepthTracker = recursionDepthTrackers[currentDimension];
- var bottomIndex = recursionDepthTracker.bottomIndex;
- var topIndex = recursionDepthTracker.topIndex;
- var firstNonRecursiveIndex =
- bottomIndex + recursionDepthTracker.recursionDepth;
- var viewNodePath = recursionDepthTracker.viewNodePath;
-
- var trackerAncestorNode = recursionDepthTracker.trackerAncestorNode;
- var heavyViewDescendantNode = heavyViewParentNode;
- for (var i = bottomIndex; i < topIndex; i++) {
- var treeViewAncestorNode = viewNodePath[i];
- var dimensionTitle = treeViewAncestorNode.title[currentDimension];
- heavyViewDescendantNode = this.getOrCreateChildNode_(
- heavyViewDescendantNode, currentDimension, dimensionTitle);
-
- var currentDimensionRecursive = i < firstNonRecursiveIndex;
- var currentOrPreviousDimensionsRecursive =
- currentDimensionRecursive || previousDimensionsRecursive;
-
- // The self and total values are taken from the original top-down tree
- // view child node (rather than the ancestor node).
- this.addNodeValues_(treeViewChildNode, heavyViewDescendantNode,
- !currentOrPreviousDimensionsRecursive);
-
- // Add the descendants of the tree-view child node wrt the next
- // dimensions as children of the heavy-view child node.
- this.addDimensionsToGenericHeavyViewNode_(treeViewChildNode,
- heavyViewDescendantNode, currentDimension + 1,
- recursionDepthTrackers, currentOrPreviousDimensionsRecursive,
- this.addDimensionToBottomUpHeavyViewNode_.bind(this));
- }
- },
-
- addNodeValues_: function(sourceNode, targetNode, addTotal) {
- var targetNodeValues = targetNode.values;
- var sourceNodeValues = sourceNode.values;
- for (var v = 0; v < this.valueCount_; v++) {
- var targetNodeValue = targetNodeValues[v];
- var sourceNodeValue = sourceNodeValues[v];
- targetNodeValue.self += sourceNodeValue.self;
- if (addTotal) {
- targetNodeValue.total += sourceNodeValue.total;
- if (sourceNodeValue.totalState > NOT_PROVIDED) {
- targetNodeValue.totalState = Math.max(
- targetNodeValue.totalState, LOWER_BOUND);
- }
- }
- }
- }
- };
-
- /**
- * Recursion depth tracker.
- *
- * This class tracks the recursion depth of the current stack (updated via
- * the push and pop methods). The recursion depth of a stack is the lengh of
- * its longest leaf suffix that is repeated within the stack itself.
- *
- * For example, the recursion depth of the stack A -> B -> C -> A -> B -> B
- * -> C (where C is the leaf node) is 2 because the suffix B -> C is repeated
- * within it.
- *
- * @{constructor}
- */
- function RecursionDepthTracker(maxDepth, dimension) {
- this.titlePath = new Array(maxDepth);
- this.viewNodePath = new Array(maxDepth);
- this.bottomIndex = this.topIndex = maxDepth;
-
- this.dimension_ = dimension;
- this.currentTrackerNode_ =
- this.createNode_(0 /* recursionDepth */, undefined /* parent */);
- }
-
- RecursionDepthTracker.prototype = {
- push: function(viewNode) {
- if (this.bottomIndex === 0)
- throw new Error('Cannot push to a full tracker');
- var title = viewNode.title[this.dimension_];
- this.bottomIndex--;
- this.titlePath[this.bottomIndex] = title;
- this.viewNodePath[this.bottomIndex] = viewNode;
-
- var childTrackerNode = this.currentTrackerNode_.children.get(title);
- if (childTrackerNode !== undefined) {
- // Child node already exists, so we don't need to calculate anything.
- this.currentTrackerNode_ = childTrackerNode;
- return;
- }
-
- // Child node doesn't exist yet, so we need to calculate its recursion
- // depth.
- var maxLengths = zFunction(this.titlePath, this.bottomIndex);
- var recursionDepth = 0;
- for (var i = 0; i < maxLengths.length; i++)
- recursionDepth = Math.max(recursionDepth, maxLengths[i]);
-
- childTrackerNode =
- this.createNode_(recursionDepth, this.currentTrackerNode_);
- this.currentTrackerNode_.children.set(title, childTrackerNode);
- this.currentTrackerNode_ = childTrackerNode;
- },
-
- pop: function() {
- if (this.bottomIndex === this.topIndex)
- throw new Error('Cannot pop from an empty tracker');
-
- this.titlePath[this.bottomIndex] = undefined;
- this.viewNodePath[this.bottomIndex] = undefined;
- this.bottomIndex++;
-
- this.currentTrackerNode_ = this.currentTrackerNode_.parent;
- },
-
- get recursionDepth() {
- return this.currentTrackerNode_.recursionDepth;
- },
-
- createNode_: function(recursionDepth, parent) {
- return {
- recursionDepth: recursionDepth,
- parent: parent,
- children: new Map()
- };
- }
- };
-
- /**
- * Calculate the Z-function of (a suffix of) a list.
- *
- * Z-function: Given a list (or a string) of length n, for each index i from
- * 1 to n - 1, find the length z[i] of the longest substring starting at
- * position i which is also a prefix of the list. This function returns the
- * list of maximum lengths z.
- *
- * Mathematically, for each i from 1 to n - 1, z[i] is the maximum value such
- * that [list[0], ..., list[i - 1]] = [list[i], ..., list[i + z[i] - 1]].
- * z[0] is defined to be zero for convenience.
- *
- * Example:
- *
- * Input (list): ['A', 'B', 'A', 'C', 'A', 'B', 'A']
- * Output (z): [ 0 , 0 , 1 , 0 , 3 , 0 , 1 ]
- *
- * Unlike the brute-force approach (which is O(n^2) in the worst case), the
- * complexity of this implementation is linear in the size of the list, i.e.
- * O(n).
- *
- * Source: http://e-maxx-eng.github.io/string/z-function.html
- */
- function zFunction(list, startIndex) {
- var n = list.length - startIndex;
- if (n === 0)
- return [];
-
- var z = new Array(n);
- z[0] = 0;
-
- for (var i = 1, left = 0, right = 0; i < n; ++i) {
- var maxLength;
- if (i <= right)
- maxLength = Math.min(right - i + 1, z[i - left]);
- else
- maxLength = 0;
-
- while (i + maxLength < n && list[startIndex + maxLength] ===
- list[startIndex + i + maxLength]) {
- ++maxLength;
- }
-
- if (i + maxLength - 1 > right) {
- left = i;
- right = i + maxLength - 1;
- }
-
- z[i] = maxLength;
- }
-
- return z;
- }
-
- return {
- MultiDimensionalViewBuilder: MultiDimensionalViewBuilder,
- MultiDimensionalViewNode: MultiDimensionalViewNode,
-
- // Exports below are for testing only.
- RecursionDepthTracker: RecursionDepthTracker,
- zFunction: zFunction
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/multi_dimensional_view_test.html b/chromium/third_party/catapult/tracing/tracing/base/multi_dimensional_view_test.html
deleted file mode 100644
index 43af9e74074..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/multi_dimensional_view_test.html
+++ /dev/null
@@ -1,13117 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/multi_dimensional_view.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var MultiDimensionalViewBuilder = tr.b.MultiDimensionalViewBuilder;
- var MultiDimensionalViewNode = tr.b.MultiDimensionalViewNode;
- var ViewType = MultiDimensionalViewBuilder.ViewType;
- var SELF = MultiDimensionalViewBuilder.ValueKind.SELF;
- var TOTAL = MultiDimensionalViewBuilder.ValueKind.TOTAL;
- var NOT_PROVIDED = MultiDimensionalViewNode.TotalState.NOT_PROVIDED;
- var LOWER_BOUND = MultiDimensionalViewNode.TotalState.LOWER_BOUND;
- var EXACT = MultiDimensionalViewNode.TotalState.EXACT;
- var RecursionDepthTracker = tr.b.RecursionDepthTracker;
- var zFunction = tr.b.zFunction;
-
- function assertListStrictEqual(a, b) {
- assert.lengthOf(a, b.length);
- for (var i = 0; i < a.length; i++)
- assert.strictEqual(a[i], b[i]);
- }
-
- function checkTree(actualTreeRootNode, expectedStructureRootNode) {
- // Build map from expected structure node IDs to expected structure nodes.
- var expectedStructureNodesById = new Map();
- addExpectedStructureToMap(
- expectedStructureRootNode, expectedStructureNodesById);
-
- // Recursively check the structure of the actual tree.
- var actualTreeNodesById = new Map();
- checkTreeStructure(actualTreeRootNode, expectedStructureRootNode,
- actualTreeNodesById, expectedStructureNodesById);
-
- // Test sanity check.
- assert.strictEqual(
- actualTreeNodesById.size, expectedStructureNodesById.size);
- }
-
- function addExpectedStructureToMap(expectedStructureNode, map) {
- if (typeof expectedStructureNode === 'string')
- return; // Reference to another expected structure node.
-
- var expectedStructureNodeId = expectedStructureNode.id;
- if (expectedStructureNodeId !== undefined) {
- assert.isFalse(map.has(expectedStructureNodeId));
- map.set(expectedStructureNodeId, expectedStructureNode);
- }
-
- var expectedStructureChildren = expectedStructureNode.children;
- for (var d = 0; d < expectedStructureChildren.length; d++) {
- var expectedStructureDimensionChildren = expectedStructureChildren[d];
- for (var i = 0; i < expectedStructureDimensionChildren.length; i++)
- addExpectedStructureToMap(expectedStructureDimensionChildren[i], map);
- }
- }
-
- function checkTreeStructure(actualTreeNode, expectedStructureNode,
- actualTreeNodesById, expectedStructureNodesById) {
- // Check the multi-dimensional title.
- assert.deepEqual(
- tr.b.asArray(actualTreeNode.title), expectedStructureNode.title);
-
- // Check the values.
- assert.deepEqual(actualTreeNode.values, expectedStructureNode.values);
-
- // Check the children.
- var expectedStructureChildNodes = expectedStructureNode.children;
- var actualTreeChildNodes = actualTreeNode.children;
- assert.lengthOf(actualTreeChildNodes, expectedStructureChildNodes.length);
-
- for (var d = 0; d < expectedStructureChildNodes.length; d++) {
- var expectedStructureDimensionChildNodes = expectedStructureChildNodes[d];
- var actualTreeDimensionChildNodes = actualTreeChildNodes[d];
- assert.strictEqual(actualTreeDimensionChildNodes.size,
- expectedStructureDimensionChildNodes.length);
-
- var expectedStructureDimensionChildNodeTitles = new Set();
-
- for (var i = 0; i < expectedStructureDimensionChildNodes.length; i++) {
- var expectedStructureDimensionChildNode =
- expectedStructureDimensionChildNodes[i];
- var isReference = false;
-
- // If the expected structure child node is a reference to another
- // expected structure node, resolve it.
- if (typeof expectedStructureDimensionChildNode === 'string') {
- expectedStructureDimensionChildNode = expectedStructureNodesById.get(
- expectedStructureDimensionChildNode);
- assert.isDefined(expectedStructureDimensionChildNode);
- isReference = true;
- }
-
- // Check that the expected structure doesn't contain two children with
- // the same title.
- var childTitle = expectedStructureDimensionChildNode.title[d];
- assert.isFalse(
- expectedStructureDimensionChildNodeTitles.has(childTitle));
- expectedStructureDimensionChildNodeTitles.add(childTitle);
-
- // Get the associated child node of the actual tree.
- var actualTreeDimensionChildNode =
- actualTreeDimensionChildNodes.get(childTitle);
- assert.isDefined(actualTreeDimensionChildNode);
-
- // Check that all expected structure nodes with the same ID correspond
- // to the same actual tree node.
- var childId = expectedStructureDimensionChildNode.id;
- if (childId !== undefined) {
- if (actualTreeNodesById.has(childId)) {
- assert.strictEqual(actualTreeDimensionChildNode,
- actualTreeNodesById.get(childId));
- } else {
- actualTreeNodesById.set(childId, actualTreeDimensionChildNode);
- }
- }
-
- // Recursively check the structure of the actual tree child node
- // (unless the expected structure child node was a reference).
- if (!isReference) {
- checkTreeStructure(actualTreeDimensionChildNode,
- expectedStructureDimensionChildNode, actualTreeNodesById,
- expectedStructureNodesById);
- }
- }
-
- // Test sanity check (all child titles should be unique).
- assert.strictEqual(expectedStructureDimensionChildNodeTitles.size,
- expectedStructureDimensionChildNodes.length);
- }
- }
-
- function createBuilderWithEntries(dimensions, valueCount, pathEntries) {
- var builder = new MultiDimensionalViewBuilder(dimensions, valueCount);
- pathEntries.forEach(function(pathEntry) {
- builder.addPath(pathEntry.path, pathEntry.values, pathEntry.kind);
- });
- return builder;
- }
-
- function builderTest(testName, dimensions, valueCount, pathEntries,
- expectedTopDownTreeViewStructure, expectedTopDownHeavyViewStructure,
- expectedBottomUpHeavyViewStructure) {
- test('builder_' + testName, function() {
- // Create a multi-dimensional tree builder and add all paths to it.
- var builder =
- createBuilderWithEntries(dimensions, valueCount, pathEntries);
-
- // Build and check the views.
- checkTree(
- builder.buildView(ViewType.TOP_DOWN_TREE_VIEW),
- expectedTopDownTreeViewStructure);
- checkTree(
- builder.buildView(ViewType.TOP_DOWN_HEAVY_VIEW),
- expectedTopDownHeavyViewStructure);
- checkTree(
- builder.buildView(ViewType.BOTTOM_UP_HEAVY_VIEW),
- expectedBottomUpHeavyViewStructure);
- });
- }
-
- /**
- * Calculate the sum of binary powers.
- *
- * Each exponent can either be (1) a single number corresponding to a single
- * power of two (2**exponent), or (2) a two-element list for a sum over a
- * range of exponents (2**exponent[0] + 2**(exponent[0] + 1) + ... +
- * 2**exponent[1]).
- */
- function b(/* exponent1, ..., exponentN */) {
-
- var sum = 0;
- for (var i = 0; i < arguments.length; i++) {
- var exponent = arguments[i];
- if (typeof exponent === 'number') {
- sum += 1 << arguments[i];
- } else {
- assert.lengthOf(exponent, 2); // Test sanity check.
- // We use the fact that 2**A + 2**(A + 1) ... + 2**B =
- // (2**0 + 2**1 + ... 2**B) - (2**0 + 2**1 + ... + 2**(A - 1)) =
- // (2**(B + 1) - 1) - (2**A - 1) = 2**(B + 1) - 2**A.
- sum += (1 << (exponent[1] + 1)) - (1 << exponent[0]);
- }
- }
- return sum;
- }
-
- function checkZFunction(list, expectedResult) {
- if (typeof list === 'string') {
- assert.deepEqual(zFunction(list, 0), expectedResult);
- assert.deepEqual(zFunction(list[0] + list, 1), expectedResult);
- assert.deepEqual(zFunction(list + list, list.length), expectedResult);
- } else {
- assert.deepEqual(zFunction([].concat(list), 0), expectedResult);
- assert.deepEqual(zFunction([list[0]].concat(list), 1), expectedResult);
- assert.deepEqual(
- zFunction(list.concat(list), list.length), expectedResult);
- }
- }
-
- /**
- * Helper function for generating builder tests. Given a number of dimensions
- * and a list of path entries, this function generates the source code of
- * the corresponding builder test with expected top-down tree view, top-down
- * heavy view and bottom-up heavy view structures.
- *
- * This avoids the need to write such tests manually, which is very tedious.
- * However, the correctness of the generated structures needs to be verified
- * by the developer! Maximum line length must also be enforced manually.
- */
- function generateBuilderTest(
- targetTestName, dimensions, valueCount, pathEntries) {
- test('builderTestGenerator_' + targetTestName, function() {
- // Create the builder.
- var builder =
- createBuilderWithEntries(dimensions, valueCount, pathEntries);
-
- // Generate the test case source code.
- var generator = new tr.c.TestUtils.SourceGenerator();
- generator.indentBlock(2, false /* don't break line */, function() {
- // Test name and number of dimensions (first line).
- generator.push('builderTest(\'', targetTestName, '\', ',
- String(dimensions), ' /* dimensions */, ',
- String(valueCount), ' /* valueCount */,');
-
- generator.indentBlock(4, true /* break line */, function() {
- // Path entries.
- generator.formatMultiLineList(pathEntries, function(pathEntry) {
- generator.push('{ path: ');
- generator.formatSingleLineList(
- pathEntry.path,
- function(singleDimensionPath) {
- generator.formatSingleLineList(
- singleDimensionPath, generator.formatString, generator);
- });
- generator.push(', values: ');
- generator.formatSingleLineList(
- pathEntry.values,
- function(value) {
- generator.push(String(value));
- });
- var kind = pathEntry.kind === SELF ? 'SELF' : 'TOTAL';
- generator.push(', kind: ', kind, ' }');
- });
- generator.push(',');
- generator.breakLine();
-
- function formatExpectedTreeStructure(root, label) {
- var nextNodeId = 0;
- var nodeInfos = new WeakMap();
-
- function assignNodeIdsToRepeatedNodes(node) {
- if (nodeInfos.has(node)) {
- // We have already visited the node (one or more times), so
- // there is no need to visit its children.
- if (nodeInfos.get(node) === undefined) {
- // This is the second time we visited the node: Change the
- // undefined entry to a defined node info entry.
- nodeInfos.set(node, { id: undefined });
- }
- return;
- }
-
- // This is the first time we visited the node: Add an undefined
- // entry to the node info map and recursively visit all its
- // children.
- nodeInfos.set(node, undefined);
- node.children.forEach(function(singleDimensionChildren) {
- for (var child of singleDimensionChildren.values())
- assignNodeIdsToRepeatedNodes(child);
- });
- }
- assignNodeIdsToRepeatedNodes(root);
-
- // Track the multi-dimensional path to the current node to generate
- // comments.
- var paths = new Array(dimensions);
- for (var i = 0; i < paths.length; i++)
- paths[i] = [];
- function withChild(childNode, dimension, callback) {
- paths[dimension].push(childNode.title[dimension]);
- callback();
- paths[dimension].pop();
- }
- function appendPathComment(opt_label) {
- if (opt_label) {
- generator.pushComment(opt_label);
- return;
- }
-
- paths.forEach(function(dimensionPath, dimensionIndex) {
- if (dimensionIndex > 0)
- generator.pushComment(', ');
- if (dimensionPath.length === 0) {
- generator.pushComment('*');
- return;
- }
- dimensionPath.forEach(function(ancestorTitle, ancestorIndex) {
- if (ancestorIndex > 0)
- generator.pushComment(' -> ');
- generator.pushComment(ancestorTitle);
- });
- });
- }
-
- function formatExpectedTreeStructureRecursively(node, opt_label) {
- var nodeId = undefined;
- var nodeInfo = nodeInfos.get(node);
- if (nodeInfo !== undefined) {
- // This node is referenced multiple times in the expected tree
- // structure.
- nodeId = nodeInfo.id;
- if (nodeId === undefined) {
- // This is the first time we visited the node: Assign it a
- // unique node id and then format it and its descendants
- // recursively.
- nodeId = '#' + (nextNodeId++);
- nodeInfo.id = nodeId;
- } else {
- // We have already visited this node: Just insert the node's
- // id (instead of formatting it and its descendants
- // recursively again).
- generator.push('\'', nodeId, '\'');
- appendPathComment();
- return;
- }
- }
-
- generator.push('{');
- appendPathComment(opt_label);
-
- generator.indentBlock(2, true /* break line */, function() {
- // Node id (if defined).
- if (nodeId !== undefined) {
- generator.push('id: \'', nodeId, '\',');
- generator.breakLine();
- }
-
- // Node title.
- generator.push('title: ');
- generator.formatSingleLineList(
- node.title, generator.formatString, generator);
- generator.push(',');
- generator.breakLine();
-
- // Node values.
- generator.push('values: ');
- generator.formatMultiLineList(
- node.values,
- function(value) {
- generator.push('{');
- generator.indentBlock(2, true /* break line */,
- function() {
- generator.push('total: ', String(value.total), ',');
- generator.breakLine();
- generator.push('self: ', String(value.self), ',');
- generator.breakLine();
- generator.push('totalState: ');
- var totalStateName =
- tr.b.findFirstKeyInDictMatching(
- MultiDimensionalViewNode.TotalState,
- (n, s) => s === value.totalState);
- if (totalStateName === undefined) {
- throw new Error(
- 'Unknown total state: ' + value.totalState);
- }
- generator.push(totalStateName);
- generator.breakLine();
- });
- generator.push('}');
- });
- generator.push(',');
- generator.breakLine();
-
- // Node children.
- var children = node.children;
- generator.push('children: ');
- generator.formatMultiLineList(
- children,
- function(singleDimensionChildren, dimension) {
- generator.formatMultiLineList(
- tr.b.mapValues(singleDimensionChildren),
- function(child, childIndex) {
- withChild(child, dimension, function() {
- formatExpectedTreeStructureRecursively(child);
- });
- });
- });
- });
- generator.breakLine();
- generator.push('}');
- }
-
- formatExpectedTreeStructureRecursively(root, label);
- }
-
- // Build and format the three multi-dimensional views.
- formatExpectedTreeStructure(
- builder.buildTopDownTreeView(), 'Top-down tree view');
- generator.push(',');
- generator.breakLine();
- formatExpectedTreeStructure(
- builder.buildTopDownHeavyView(), 'Top-down heavy view');
- generator.push(',');
- generator.breakLine();
- formatExpectedTreeStructure(
- builder.buildBottomUpHeavyView(), 'Bottom-up heavy view');
- generator.push(');');
- });
- });
-
- tr.c.TestUtils.addSourceListing(this, generator.build());
-
- throw new Error('This error is thrown to prevent accidentally ' +
- 'checking in a test generator instead of an actual test.');
- });
- }
-
- builderTest('zeroDimensions_noPaths', 0 /* dimensions */, 1 /* valueCount */,
- [],
- { // Top-down tree view.
- title: [],
- values: [
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- }
- ],
- children: []
- },
- { // Top-down heavy view.
- title: [],
- values: [
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- }
- ],
- children: []
- },
- { // Bottom-up heavy view.
- title: [],
- values: [
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- }
- ],
- children: []
- });
-
- builderTest('zeroDimensions_withPaths', 0 /* dimensions */,
- 1 /* valueCount */,
- [
- { path: [], values: [2], kind: SELF },
- { path: [], values: [3], kind: TOTAL },
- { path: [], values: [4], kind: SELF },
- { path: [], values: [5], kind: TOTAL }
- ],
- { // Top-down tree view.
- title: [],
- values: [
- {
- total: 8,
- self: 6,
- totalState: EXACT
- }
- ],
- children: []
- },
- { // Top-down heavy view.
- title: [],
- values: [
- {
- total: 8,
- self: 6,
- totalState: EXACT
- }
- ],
- children: []
- },
- { // Bottom-up heavy view.
- title: [],
- values: [
- {
- total: 8,
- self: 6,
- totalState: EXACT
- }
- ],
- children: []
- });
-
- builderTest('oneDimension_noPaths', 1 /* dimensions */, 1 /* valueCount */,
- [],
- { // Top-down tree view.
- title: [undefined],
- values: [
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- }
- ],
- children: [
- []
- ]
- },
- { // Top-down heavy view.
- title: [undefined],
- values: [
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- }
- ],
- children: [
- []
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined],
- values: [
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- }
- ],
- children: [
- []
- ]
- });
-
- builderTest('oneDimension_zeroLengthPath', 1 /* dimensions */,
- 1 /* valueCount */,
- [
- { path: [[]], values: [42], kind: SELF }
- ],
- { // Top-down tree view.
- title: [undefined],
- values: [
- {
- total: 42,
- self: 42,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // Top-down heavy view.
- title: [undefined],
- values: [
- {
- total: 42,
- self: 42,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // Top-down heavy view.
- title: [undefined],
- values: [
- {
- total: 42,
- self: 42,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- });
-
- builderTest('oneDimension_noRecursion', 1 /* dimensions */,
- 1 /* valueCount */,
- [
- { path: [['A', 'B', 'C']], values: [10], kind: SELF },
- { path: [['A', 'B']], values: [20], kind: SELF },
- { path: [['B', 'D']], values: [30], kind: SELF },
- { path: [['A', 'B', 'D']], values: [40], kind: SELF },
- { path: [['A', 'C']], values: [50], kind: SELF },
- { path: [[]], values: [60], kind: SELF }
- ],
- { // Top-down tree view.
- title: [undefined],
- values: [
- {
- total: 210,
- self: 60,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A.
- title: ['A'],
- values: [
- {
- total: 120,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B.
- title: ['B'],
- values: [
- {
- total: 70,
- self: 20,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B -> C.
- title: ['C'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // A -> B -> D.
- title: ['D'],
- values: [
- {
- total: 40,
- self: 40,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // A -> C.
- title: ['C'],
- values: [
- {
- total: 50,
- self: 50,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // B.
- title: ['B'],
- values: [
- {
- total: 30,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> D.
- title: ['D'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // Top-down heavy view.
- title: [undefined],
- values: [
- {
- total: 210,
- self: 60,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A.
- title: ['A'],
- values: [
- {
- total: 120,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B.
- title: ['B'],
- values: [
- {
- total: 70,
- self: 20,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B -> C.
- title: ['C'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // A -> B -> D.
- title: ['D'],
- values: [
- {
- total: 40,
- self: 40,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // A -> C.
- title: ['C'],
- values: [
- {
- total: 50,
- self: 50,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // B.
- title: ['B'],
- values: [
- {
- total: 100,
- self: 20,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> C.
- title: ['C'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // B -> D.
- title: ['D'],
- values: [
- {
- total: 70,
- self: 70,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // C.
- title: ['C'],
- values: [
- {
- total: 60,
- self: 60,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // D.
- title: ['D'],
- values: [
- {
- total: 70,
- self: 70,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined],
- values: [
- {
- total: 210,
- self: 60,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A.
- title: ['A'],
- values: [
- {
- total: 120,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // B.
- title: ['B'],
- values: [
- {
- total: 100,
- self: 20,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> A.
- title: ['A'],
- values: [
- {
- total: 70,
- self: 20,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // C.
- title: ['C'],
- values: [
- {
- total: 60,
- self: 60,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B.
- title: ['B'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> A.
- title: ['A'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // C -> A.
- title: ['A'],
- values: [
- {
- total: 50,
- self: 50,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // D.
- title: ['D'],
- values: [
- {
- total: 70,
- self: 70,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // D -> B.
- title: ['B'],
- values: [
- {
- total: 70,
- self: 70,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // D -> B -> A.
- title: ['A'],
- values: [
- {
- total: 40,
- self: 40,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- });
-
- builderTest('oneDimension_simpleRecursion', 1 /* dimensions */,
- 1 /* valueCount */,
- [
- { path: [['A']], values: [10], kind: SELF },
- { path: [['A', 'A', 'A']], values: [20], kind: SELF },
- { path: [['A', 'A']], values: [30], kind: SELF },
- { path: [['A', 'A', 'A', 'A']], values: [40], kind: SELF }
- ],
- { // Top-down tree view.
- title: [undefined],
- values: [
- {
- total: 100,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A.
- title: ['A'],
- values: [
- {
- total: 100,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> A.
- title: ['A'],
- values: [
- {
- total: 90,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> A -> A.
- title: ['A'],
- values: [
- {
- total: 60,
- self: 20,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> A -> A -> A.
- title: ['A'],
- values: [
- {
- total: 40,
- self: 40,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // Top-down heavy view.
- title: [undefined],
- values: [
- {
- total: 100,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A.
- title: ['A'],
- values: [
- {
- total: 100,
- self: 100,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> A.
- title: ['A'],
- values: [
- {
- total: 90,
- self: 90,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> A -> A.
- title: ['A'],
- values: [
- {
- total: 60,
- self: 60,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> A -> A -> A.
- title: ['A'],
- values: [
- {
- total: 40,
- self: 40,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined],
- values: [
- {
- total: 100,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A.
- title: ['A'],
- values: [
- {
- total: 100,
- self: 100,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> A.
- title: ['A'],
- values: [
- {
- total: 90,
- self: 90,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> A -> A.
- title: ['A'],
- values: [
- {
- total: 60,
- self: 60,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> A -> A -> A.
- title: ['A'],
- values: [
- {
- total: 40,
- self: 40,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- });
-
- builderTest('oneDimension_complexRecursion', 1 /* dimensions */,
- 1 /* valueCount */,
- [
- { path: [['A', 'B', 'C']], values: [10], kind: SELF },
- { path: [['A', 'D', 'B', 'C', 'A', 'B', 'C']], values: [20],
- kind: SELF },
- { path: [['A', 'D', 'B', 'C', 'A', 'B', 'D']], values: [30],
- kind: SELF },
- { path: [['C', 'B', 'C']], values: [40], kind: SELF },
- { path: [['C', 'B', 'C', 'B', 'C']], values: [50], kind: SELF }
- ],
- { // Top-down tree view.
- title: [undefined],
- values: [
- {
- total: 150,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A.
- title: ['A'],
- values: [
- {
- total: 60,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B.
- title: ['B'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B -> C.
- title: ['C'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // A -> D.
- title: ['D'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> D -> B.
- title: ['B'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> D -> B -> C.
- title: ['C'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> D -> B -> C -> A.
- title: ['A'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> D -> B -> C -> A -> B.
- title: ['B'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> D -> B -> C -> A ->
- // B -> C.
- title: ['C'],
- values: [
- {
- total: 20,
- self: 20,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // A -> D -> B -> C -> A ->
- // B -> D.
- title: ['D'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // C.
- title: ['C'],
- values: [
- {
- total: 90,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B.
- title: ['B'],
- values: [
- {
- total: 90,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> C.
- title: ['C'],
- values: [
- {
- total: 90,
- self: 40,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> C -> B.
- title: ['B'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> C -> B -> C.
- title: ['C'],
- values: [
- {
- total: 50,
- self: 50,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // Top-down heavy view.
- title: [undefined],
- values: [
- {
- total: 150,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A.
- title: ['A'],
- values: [
- {
- total: 60,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B.
- title: ['B'],
- values: [
- {
- total: 60,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B -> C.
- title: ['C'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // A -> B -> D.
- title: ['D'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // A -> D.
- title: ['D'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> D -> B.
- title: ['B'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> D -> B -> C.
- title: ['C'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> D -> B -> C -> A.
- title: ['A'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> D -> B -> C -> A -> B.
- title: ['B'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> D -> B -> C -> A ->
- // B -> C.
- title: ['C'],
- values: [
- {
- total: 20,
- self: 20,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // A -> D -> B -> C -> A ->
- // B -> D.
- title: ['D'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B.
- title: ['B'],
- values: [
- {
- total: 150,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> C.
- title: ['C'],
- values: [
- {
- total: 150,
- self: 120,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> C -> A.
- title: ['A'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> C -> A -> B.
- title: ['B'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> C -> A -> B -> C.
- title: ['C'],
- values: [
- {
- total: 20,
- self: 20,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // B -> C -> A -> B -> D.
- title: ['D'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B -> C -> B.
- title: ['B'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> C -> B -> C.
- title: ['C'],
- values: [
- {
- total: 50,
- self: 50,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B -> D.
- title: ['D'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // C.
- title: ['C'],
- values: [
- {
- total: 150,
- self: 120,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> A.
- title: ['A'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> A -> B.
- title: ['B'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> A -> B -> C.
- title: ['C'],
- values: [
- {
- total: 20,
- self: 20,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // C -> A -> B -> D.
- title: ['D'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // C -> B.
- title: ['B'],
- values: [
- {
- total: 90,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> C.
- title: ['C'],
- values: [
- {
- total: 90,
- self: 90,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> C -> B.
- title: ['B'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> C -> B -> C.
- title: ['C'],
- values: [
- {
- total: 50,
- self: 50,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // D.
- title: ['D'],
- values: [
- {
- total: 50,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // D -> B.
- title: ['B'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // D -> B -> C.
- title: ['C'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // D -> B -> C -> A.
- title: ['A'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // D -> B -> C -> A -> B.
- title: ['B'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // D -> B -> C -> A -> B -> C.
- title: ['C'],
- values: [
- {
- total: 20,
- self: 20,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // D -> B -> C -> A -> B -> D.
- title: ['D'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined],
- values: [
- {
- total: 150,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A.
- title: ['A'],
- values: [
- {
- total: 60,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> C.
- title: ['C'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> C -> B.
- title: ['B'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> C -> B -> D.
- title: ['D'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> C -> B -> D -> A.
- title: ['A'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B.
- title: ['B'],
- values: [
- {
- total: 150,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> A.
- title: ['A'],
- values: [
- {
- total: 60,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> A -> C.
- title: ['C'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> A -> C -> B.
- title: ['B'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> A -> C -> B -> D.
- title: ['D'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> A -> C -> B -> D -> A.
- title: ['A'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B -> D.
- title: ['D'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> D -> A.
- title: ['A'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // B -> C.
- title: ['C'],
- values: [
- {
- total: 90,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> C -> B.
- title: ['B'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> C -> B -> C.
- title: ['C'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // C.
- title: ['C'],
- values: [
- {
- total: 150,
- self: 120,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B.
- title: ['B'],
- values: [
- {
- total: 150,
- self: 120,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> A.
- title: ['A'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> A -> C.
- title: ['C'],
- values: [
- {
- total: 20,
- self: 20,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> A -> C -> B.
- title: ['B'],
- values: [
- {
- total: 20,
- self: 20,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> A -> C -> B -> D.
- title: ['D'],
- values: [
- {
- total: 20,
- self: 20,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> A -> C -> B ->
- // D -> A.
- title: ['A'],
- values: [
- {
- total: 20,
- self: 20,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // C -> B -> D.
- title: ['D'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> D -> A.
- title: ['A'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // C -> B -> C.
- title: ['C'],
- values: [
- {
- total: 90,
- self: 90,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> C -> B.
- title: ['B'],
- values: [
- {
- total: 50,
- self: 50,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> C -> B -> C.
- title: ['C'],
- values: [
- {
- total: 50,
- self: 50,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // D.
- title: ['D'],
- values: [
- {
- total: 50,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // D -> A.
- title: ['A'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // D -> B.
- title: ['B'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // D -> B -> A.
- title: ['A'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // D -> B -> A -> C.
- title: ['C'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // D -> B -> A -> C -> B.
- title: ['B'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // D -> B -> A -> C -> B -> D.
- title: ['D'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // D -> B -> A -> C -> B ->
- // D -> A.
- title: ['A'],
- values: [
- {
- total: 30,
- self: 30,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- });
-
- builderTest('oneDimension_withTotalSizes', 1 /* dimensions */,
- 1 /* valueCount */,
- [
- { path: [['B', 'C']], values: [10], kind: TOTAL },
- { path: [['B', 'C', 'D']], values: [5], kind: TOTAL },
- { path: [['B']], values: [15], kind: SELF },
- { path: [['B']], values: [20], kind: TOTAL },
- { path: [['B', 'D']], values: [40], kind: SELF },
- { path: [['C']], values: [50], kind: TOTAL }
- ],
- { // Top-down tree view.
- title: [undefined],
- values: [
- {
- total: 115,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B.
- title: ['B'],
- values: [
- {
- total: 65,
- self: 15,
- totalState: EXACT
- }
- ],
- children: [
- [
- { // B -> C.
- title: ['C'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- { // B -> C -> D.
- title: ['D'],
- values: [
- {
- total: 5,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // B -> D.
- title: ['D'],
- values: [
- {
- total: 40,
- self: 40,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // C.
- title: ['C'],
- values: [
- {
- total: 50,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // Top-down heavy view.
- title: [undefined],
- values: [
- {
- total: 115,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B.
- title: ['B'],
- values: [
- {
- total: 65,
- self: 15,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> C.
- title: ['C'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> C -> D.
- title: ['D'],
- values: [
- {
- total: 5,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // B -> D.
- title: ['D'],
- values: [
- {
- total: 40,
- self: 40,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // C.
- title: ['C'],
- values: [
- {
- total: 60,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> D.
- title: ['D'],
- values: [
- {
- total: 5,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // D.
- title: ['D'],
- values: [
- {
- total: 45,
- self: 40,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined],
- values: [
- {
- total: 115,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B.
- title: ['B'],
- values: [
- {
- total: 65,
- self: 15,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // C.
- title: ['C'],
- values: [
- {
- total: 60,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B.
- title: ['B'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // D.
- title: ['D'],
- values: [
- {
- total: 45,
- self: 40,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // D -> C.
- title: ['C'],
- values: [
- {
- total: 5,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // D -> C -> B.
- title: ['B'],
- values: [
- {
- total: 5,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // D -> B.
- title: ['B'],
- values: [
- {
- total: 40,
- self: 40,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- });
-
- builderTest('oneDimension_protoTitle', 1 /* dimensions */, 1 /* valueCount */,
- [
- { path: [['__proto__']], values: [45], kind: SELF },
- { path: [['A']], values: [18], kind: SELF },
- { path: [['A', '__proto__']], values: [89], kind: TOTAL }
- ],
- { // Top-down tree view.
- title: [undefined],
- values: [
- {
- total: 152,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // __proto__.
- title: ['__proto__'],
- values: [
- {
- total: 45,
- self: 45,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // A.
- title: ['A'],
- values: [
- {
- total: 107,
- self: 18,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> __proto__.
- title: ['__proto__'],
- values: [
- {
- total: 89,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // Top-down heavy view.
- title: [undefined],
- values: [
- {
- total: 152,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // __proto__.
- title: ['__proto__'],
- values: [
- {
- total: 134,
- self: 45,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // A.
- title: ['A'],
- values: [
- {
- total: 107,
- self: 18,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> __proto__.
- title: ['__proto__'],
- values: [
- {
- total: 89,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined],
- values: [
- {
- total: 152,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // __proto__.
- title: ['__proto__'],
- values: [
- {
- total: 134,
- self: 45,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // __proto__ -> A.
- title: ['A'],
- values: [
- {
- total: 89,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // A.
- title: ['A'],
- values: [
- {
- total: 107,
- self: 18,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- });
-
- // See tracing/tracing/base/multi_dimensional_view.html
- // (MultiDimensionalViewBuilder.addDimensionToTopDownHeavyViewNode_ and
- // MultiDimensionalViewBuilder.addDimensionToBottomUpHeavyViewNode_
- // documentation).
- builderTest('oneDimension_documentationExample', 1 /* dimensions */,
- 1 /* valueCount */,
- [
- { path: [['A']], values: [10], kind: SELF },
- { path: [['A']], values: [30], kind: TOTAL },
- { path: [['A', 'B']], values: [1], kind: SELF },
- { path: [['A', 'B', 'A']], values: [3], kind: SELF },
- { path: [['A', 'B', 'A']], values: [8], kind: TOTAL },
- { path: [['A', 'B', 'C']], values: [2], kind: SELF },
- { path: [['A', 'B', 'C']], values: [7], kind: TOTAL },
- { path: [['B']], values: [12], kind: SELF },
- { path: [['B']], values: [18], kind: TOTAL }
- ],
- { // Top-down tree view.
- title: [undefined],
- values: [
- {
- total: 48,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A.
- title: ['A'],
- values: [
- {
- total: 30,
- self: 10,
- totalState: EXACT
- }
- ],
- children: [
- [
- { // A -> B.
- title: ['B'],
- values: [
- {
- total: 16,
- self: 1,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B -> A.
- title: ['A'],
- values: [
- {
- total: 8,
- self: 3,
- totalState: EXACT
- }
- ],
- children: [
- []
- ]
- },
- { // A -> B -> C.
- title: ['C'],
- values: [
- {
- total: 7,
- self: 2,
- totalState: EXACT
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B.
- title: ['B'],
- values: [
- {
- total: 18,
- self: 12,
- totalState: EXACT
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // Top-down heavy view.
- title: [undefined],
- values: [
- {
- total: 48,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A.
- title: ['A'],
- values: [
- {
- total: 30,
- self: 13,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B.
- title: ['B'],
- values: [
- {
- total: 16,
- self: 1,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B -> A.
- title: ['A'],
- values: [
- {
- total: 8,
- self: 3,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // A -> B -> C.
- title: ['C'],
- values: [
- {
- total: 7,
- self: 2,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B.
- title: ['B'],
- values: [
- {
- total: 34,
- self: 13,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> A.
- title: ['A'],
- values: [
- {
- total: 8,
- self: 3,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- },
- { // B -> C.
- title: ['C'],
- values: [
- {
- total: 7,
- self: 2,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // C.
- title: ['C'],
- values: [
- {
- total: 7,
- self: 2,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined],
- values: [
- {
- total: 48,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A.
- title: ['A'],
- values: [
- {
- total: 30,
- self: 13,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B.
- title: ['B'],
- values: [
- {
- total: 8,
- self: 3,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B -> A.
- title: ['A'],
- values: [
- {
- total: 8,
- self: 3,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B.
- title: ['B'],
- values: [
- {
- total: 34,
- self: 13,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> A.
- title: ['A'],
- values: [
- {
- total: 16,
- self: 1,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- },
- { // C.
- title: ['C'],
- values: [
- {
- total: 7,
- self: 2,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B.
- title: ['B'],
- values: [
- {
- total: 7,
- self: 2,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> A.
- title: ['A'],
- values: [
- {
- total: 7,
- self: 2,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- });
-
- builderTest('twoDimensions_noPaths', 2 /* dimensions */, 1 /* valueCount */,
- [],
- { // Top-down tree view.
- title: [undefined, undefined],
- values: [
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // Top-down heavy view.
- title: [undefined, undefined],
- values: [
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined, undefined],
- values: [
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- }
- ],
- children: [
- [],
- []
- ]
- });
-
- // See tracing/tracing/base/multi_dimensional_view.html
- // (MultiDimensionalViewNode.finalizeTotalValues_ documentation).
- builderTest('twoDimensions_totalCalculation', 2 /* dimensions */,
- 1 /* valueCount */,
- [
- { path: [[], []], values: [10], kind: SELF },
- { path: [['A'], []], values: [21], kind: SELF },
- { path: [['A'], []], values: [30], kind: TOTAL },
- { path: [['B'], []], values: [25], kind: SELF },
- { path: [['B'], []], values: [32], kind: TOTAL },
- { path: [[], ['1']], values: [3], kind: SELF },
- { path: [[], ['1']], values: [15], kind: TOTAL },
- { path: [[], ['2']], values: [40], kind: SELF },
- { path: [[], ['2']], values: [41], kind: TOTAL }
- ],
- { // Top-down tree view.
- title: [undefined, undefined],
- values: [
- {
- total: 115,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A, *.
- title: ['A', undefined],
- values: [
- {
- total: 30,
- self: 21,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // B, *.
- title: ['B', undefined],
- values: [
- {
- total: 32,
- self: 25,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- }
- ],
- [
- { // *, 1.
- title: [undefined, '1'],
- values: [
- {
- total: 15,
- self: 3,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // *, 2.
- title: [undefined, '2'],
- values: [
- {
- total: 41,
- self: 40,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // Top-down heavy view.
- title: [undefined, undefined],
- values: [
- {
- total: 115,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A, *.
- title: ['A', undefined],
- values: [
- {
- total: 30,
- self: 21,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // B, *.
- title: ['B', undefined],
- values: [
- {
- total: 32,
- self: 25,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ],
- [
- { // *, 1.
- title: [undefined, '1'],
- values: [
- {
- total: 15,
- self: 3,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // *, 2.
- title: [undefined, '2'],
- values: [
- {
- total: 41,
- self: 40,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined, undefined],
- values: [
- {
- total: 115,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A, *.
- title: ['A', undefined],
- values: [
- {
- total: 30,
- self: 21,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // B, *.
- title: ['B', undefined],
- values: [
- {
- total: 32,
- self: 25,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ],
- [
- { // *, 1.
- title: [undefined, '1'],
- values: [
- {
- total: 15,
- self: 3,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // *, 2.
- title: [undefined, '2'],
- values: [
- {
- total: 41,
- self: 40,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- });
-
- // See tracing/tracing/base/multi_dimensional_view.html
- // (MultiDimensionalViewNode documentation).
- builderTest('twoDimensions_documentationExample1', 2 /* dimensions */,
- 1 /* valueCount */,
- [
- { path: [['A', 'B'], ['T1', 'T2']], values: [1], kind: TOTAL },
- { path: [['A', 'B'], ['T1']], values: [2], kind: TOTAL },
- { path: [['A', 'B'], []], values: [4], kind: TOTAL },
- { path: [['A'], ['T1', 'T2']], values: [10], kind: TOTAL },
- { path: [['A'], ['T1']], values: [20], kind: TOTAL },
- { path: [['A'], []], values: [40], kind: TOTAL },
- { path: [[], ['T1', 'T2']], values: [100], kind: TOTAL },
- { path: [[], ['T1']], values: [200], kind: TOTAL },
- { path: [[], []], values: [400], kind: TOTAL }
- ],
- { // Top-down tree view.
- title: [undefined, undefined],
- values: [
- {
- total: 400,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- { // A, *.
- title: ['A', undefined],
- values: [
- {
- total: 40,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- { // A -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 4,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- [
- { // A -> B, T1.
- id: '#0',
- title: ['B', 'T1'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- [
- { // A -> B, T1 -> T2.
- id: '#1',
- title: ['B', 'T2'],
- values: [
- {
- total: 1,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, T1.
- id: '#2',
- title: ['A', 'T1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- '#0' // A -> B, T1.
- ],
- [
- { // A, T1 -> T2.
- id: '#3',
- title: ['A', 'T2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- '#1' // A -> B, T1 -> T2.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, T1.
- title: [undefined, 'T1'],
- values: [
- {
- total: 200,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- '#2' // A, T1.
- ],
- [
- { // *, T1 -> T2.
- title: [undefined, 'T2'],
- values: [
- {
- total: 100,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- '#3' // A, T1 -> T2.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // Top-down heavy view.
- title: [undefined, undefined],
- values: [
- {
- total: 400,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- { // A, *.
- title: ['A', undefined],
- values: [
- {
- total: 40,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 4,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B, T1.
- id: '#0',
- title: ['B', 'T1'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B, T1 -> T2.
- id: '#1',
- title: ['B', 'T2'],
- values: [
- {
- total: 1,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // A -> B, T2.
- id: '#2',
- title: ['B', 'T2'],
- values: [
- {
- total: 1,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, T1.
- id: '#3',
- title: ['A', 'T1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#0' // A -> B, T1.
- ],
- [
- { // A, T1 -> T2.
- id: '#4',
- title: ['A', 'T2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#1' // A -> B, T1 -> T2.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // A, T2.
- id: '#5',
- title: ['A', 'T2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#2' // A -> B, T2.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // B, *.
- title: ['B', undefined],
- values: [
- {
- total: 4,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B, T1.
- id: '#6',
- title: ['B', 'T1'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B, T1 -> T2.
- id: '#7',
- title: ['B', 'T2'],
- values: [
- {
- total: 1,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // B, T2.
- id: '#8',
- title: ['B', 'T2'],
- values: [
- {
- total: 1,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, T1.
- title: [undefined, 'T1'],
- values: [
- {
- total: 200,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#3', // A, T1.
- '#6' // B, T1.
- ],
- [
- { // *, T1 -> T2.
- title: [undefined, 'T2'],
- values: [
- {
- total: 100,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#4', // A, T1 -> T2.
- '#7' // B, T1 -> T2.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // *, T2.
- title: [undefined, 'T2'],
- values: [
- {
- total: 100,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#5', // A, T2.
- '#8' // B, T2.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined, undefined],
- values: [
- {
- total: 400,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- { // A, *.
- title: ['A', undefined],
- values: [
- {
- total: 40,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A, T1.
- id: '#0',
- title: ['A', 'T1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // A, T2.
- id: '#1',
- title: ['A', 'T2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A, T2 -> T1.
- id: '#2',
- title: ['A', 'T1'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B, *.
- title: ['B', undefined],
- values: [
- {
- total: 4,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> A, *.
- title: ['A', undefined],
- values: [
- {
- total: 4,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> A, T1.
- id: '#3',
- title: ['A', 'T1'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // B -> A, T2.
- id: '#4',
- title: ['A', 'T2'],
- values: [
- {
- total: 1,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> A, T2 -> T1.
- id: '#5',
- title: ['A', 'T1'],
- values: [
- {
- total: 1,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B, T1.
- id: '#6',
- title: ['B', 'T1'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#3' // B -> A, T1.
- ],
- []
- ]
- },
- { // B, T2.
- id: '#7',
- title: ['B', 'T2'],
- values: [
- {
- total: 1,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#4' // B -> A, T2.
- ],
- [
- { // B, T2 -> T1.
- id: '#8',
- title: ['B', 'T1'],
- values: [
- {
- total: 1,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#5' // B -> A, T2 -> T1.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, T1.
- title: [undefined, 'T1'],
- values: [
- {
- total: 200,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#0', // A, T1.
- '#6' // B, T1.
- ],
- []
- ]
- },
- { // *, T2.
- title: [undefined, 'T2'],
- values: [
- {
- total: 100,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#1', // A, T2.
- '#7' // B, T2.
- ],
- [
- { // *, T2 -> T1.
- title: [undefined, 'T1'],
- values: [
- {
- total: 100,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#2', // A, T2 -> T1.
- '#8' // B, T2 -> T1.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- });
-
- // See tracing/tracing/base/multi_dimensional_view.html
- // (MultiDimensionalViewBuilder documentation).
- builderTest('twoDimensions_documentationExample2', 2 /* dimensions */,
- 1 /* valueCount */,
- [
- { path: [['Saturday'], ['Cooking']], values: [1], kind: SELF },
- { path: [['Saturday'], ['Sports', 'Football']], values: [2],
- kind: SELF },
- { path: [['Sunday'], ['Sports', 'Basketball']], values: [3],
- kind: SELF }
- ],
- { // Top-down tree view.
- title: [undefined, undefined],
- values: [
- {
- total: 6,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // Saturday, *.
- title: ['Saturday', undefined],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // Saturday, Cooking.
- id: '#0',
- title: ['Saturday', 'Cooking'],
- values: [
- {
- total: 1,
- self: 1,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // Saturday, Sports.
- id: '#1',
- title: ['Saturday', 'Sports'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // Saturday, Sports -> Football.
- id: '#2',
- title: ['Saturday', 'Football'],
- values: [
- {
- total: 2,
- self: 2,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // Sunday, *.
- title: ['Sunday', undefined],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // Sunday, Sports.
- id: '#3',
- title: ['Sunday', 'Sports'],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // Sunday, Sports -> Basketball.
- id: '#4',
- title: ['Sunday', 'Basketball'],
- values: [
- {
- total: 3,
- self: 3,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, Cooking.
- title: [undefined, 'Cooking'],
- values: [
- {
- total: 1,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#0' // Saturday, Cooking.
- ],
- []
- ]
- },
- { // *, Sports.
- title: [undefined, 'Sports'],
- values: [
- {
- total: 5,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#1', // Saturday, Sports.
- '#3' // Sunday, Sports.
- ],
- [
- { // *, Sports -> Football.
- title: [undefined, 'Football'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#2' // Saturday, Sports -> Football.
- ],
- []
- ]
- },
- { // *, Sports -> Basketball.
- title: [undefined, 'Basketball'],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#4' // Sunday, Sports -> Basketball.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // Top-down heavy view.
- title: [undefined, undefined],
- values: [
- {
- total: 6,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // Saturday, *.
- title: ['Saturday', undefined],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // Saturday, Cooking.
- id: '#0',
- title: ['Saturday', 'Cooking'],
- values: [
- {
- total: 1,
- self: 1,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // Saturday, Sports.
- id: '#1',
- title: ['Saturday', 'Sports'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // Saturday, Sports -> Football.
- id: '#2',
- title: ['Saturday', 'Football'],
- values: [
- {
- total: 2,
- self: 2,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // Saturday, Football.
- id: '#3',
- title: ['Saturday', 'Football'],
- values: [
- {
- total: 2,
- self: 2,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // Sunday, *.
- title: ['Sunday', undefined],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // Sunday, Sports.
- id: '#4',
- title: ['Sunday', 'Sports'],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // Sunday, Sports -> Basketball.
- id: '#5',
- title: ['Sunday', 'Basketball'],
- values: [
- {
- total: 3,
- self: 3,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // Sunday, Basketball.
- id: '#6',
- title: ['Sunday', 'Basketball'],
- values: [
- {
- total: 3,
- self: 3,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, Cooking.
- title: [undefined, 'Cooking'],
- values: [
- {
- total: 1,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#0' // Saturday, Cooking.
- ],
- []
- ]
- },
- { // *, Sports.
- title: [undefined, 'Sports'],
- values: [
- {
- total: 5,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#1', // Saturday, Sports.
- '#4' // Sunday, Sports.
- ],
- [
- { // *, Sports -> Football.
- title: [undefined, 'Football'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#2' // Saturday, Sports -> Football.
- ],
- []
- ]
- },
- { // *, Sports -> Basketball.
- title: [undefined, 'Basketball'],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#5' // Sunday, Sports -> Basketball.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // *, Football.
- title: [undefined, 'Football'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#3' // Saturday, Football.
- ],
- []
- ]
- },
- { // *, Basketball.
- title: [undefined, 'Basketball'],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#6' // Sunday, Basketball.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined, undefined],
- values: [
- {
- total: 6,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // Saturday, *.
- title: ['Saturday', undefined],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // Saturday, Cooking.
- id: '#0',
- title: ['Saturday', 'Cooking'],
- values: [
- {
- total: 1,
- self: 1,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // Saturday, Sports.
- id: '#1',
- title: ['Saturday', 'Sports'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // Saturday, Football.
- id: '#2',
- title: ['Saturday', 'Football'],
- values: [
- {
- total: 2,
- self: 2,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // Saturday, Football -> Sports.
- id: '#3',
- title: ['Saturday', 'Sports'],
- values: [
- {
- total: 2,
- self: 2,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // Sunday, *.
- title: ['Sunday', undefined],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // Sunday, Sports.
- id: '#4',
- title: ['Sunday', 'Sports'],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // Sunday, Basketball.
- id: '#5',
- title: ['Sunday', 'Basketball'],
- values: [
- {
- total: 3,
- self: 3,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // Sunday, Basketball -> Sports.
- id: '#6',
- title: ['Sunday', 'Sports'],
- values: [
- {
- total: 3,
- self: 3,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, Cooking.
- title: [undefined, 'Cooking'],
- values: [
- {
- total: 1,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#0' // Saturday, Cooking.
- ],
- []
- ]
- },
- { // *, Sports.
- title: [undefined, 'Sports'],
- values: [
- {
- total: 5,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#1', // Saturday, Sports.
- '#4' // Sunday, Sports.
- ],
- []
- ]
- },
- { // *, Football.
- title: [undefined, 'Football'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#2' // Saturday, Football.
- ],
- [
- { // *, Football -> Sports.
- title: [undefined, 'Sports'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#3' // Saturday, Football -> Sports.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // *, Basketball.
- title: [undefined, 'Basketball'],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#5' // Sunday, Basketball.
- ],
- [
- { // *, Basketball -> Sports.
- title: [undefined, 'Sports'],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#6' // Sunday, Basketball -> Sports.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- });
-
- // See https://goo.gl/KY7zVE.
- builderTest('twoDimensions_heapDumpExample', 2 /* dimensions */,
- 1 /* valueCount */,
- [
- { path: [['BrMain', 'Init'], ['T']], values: [151], kind: TOTAL },
- { path: [['BrMain', 'Init'], ['W']], values: [83], kind: TOTAL },
- { path: [['BrMain', 'Init'], []], values: [242], kind: TOTAL },
- { path: [['BrMain', 'MsgLp'], ['T']], values: [307], kind: TOTAL },
- { path: [['BrMain', 'MsgLp'], ['V']], values: [281], kind: TOTAL },
- { path: [['BrMain', 'MsgLp'], []], values: [601], kind: TOTAL },
- { path: [['RdMain', 'RTask'], ['T']], values: [211], kind: TOTAL },
- { path: [['RdMain', 'RTask'], ['W']], values: [337], kind: TOTAL },
- { path: [['RdMain', 'RTask'], []], values: [556], kind: TOTAL },
- { path: [[], ['T']], values: [698], kind: TOTAL },
- { path: [[], ['V']], values: [340], kind: TOTAL },
- { path: [[], ['W']], values: [461], kind: TOTAL },
- { path: [[], []], values: [1538], kind: TOTAL },
- { path: [['BrMain'], ['T']], values: [465], kind: TOTAL },
- { path: [['BrMain'], ['V']], values: [297], kind: TOTAL },
- { path: [['BrMain'], ['W']], values: [96], kind: TOTAL },
- { path: [['BrMain'], []], values: [876], kind: TOTAL },
- { path: [['RdMain'], ['T']], values: [229], kind: TOTAL },
- { path: [['RdMain'], ['W']], values: [355], kind: TOTAL },
- { path: [['RdMain'], []], values: [628], kind: TOTAL }
- ],
- { // Top-down tree view.
- title: [undefined, undefined],
- values: [
- {
- total: 1538,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- { // BrMain, *.
- title: ['BrMain', undefined],
- values: [
- {
- total: 876,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- { // BrMain -> Init, *.
- title: ['Init', undefined],
- values: [
- {
- total: 242,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- [
- { // BrMain -> Init, T.
- id: '#0',
- title: ['Init', 'T'],
- values: [
- {
- total: 151,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // BrMain -> Init, W.
- id: '#1',
- title: ['Init', 'W'],
- values: [
- {
- total: 83,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // BrMain -> MsgLp, *.
- title: ['MsgLp', undefined],
- values: [
- {
- total: 601,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- [
- { // BrMain -> MsgLp, T.
- id: '#2',
- title: ['MsgLp', 'T'],
- values: [
- {
- total: 307,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // BrMain -> MsgLp, V.
- id: '#3',
- title: ['MsgLp', 'V'],
- values: [
- {
- total: 281,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // BrMain, T.
- id: '#4',
- title: ['BrMain', 'T'],
- values: [
- {
- total: 465,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- '#0', // BrMain -> Init, T.
- '#2' // BrMain -> MsgLp, T.
- ],
- []
- ]
- },
- { // BrMain, V.
- id: '#5',
- title: ['BrMain', 'V'],
- values: [
- {
- total: 297,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- '#3' // BrMain -> MsgLp, V.
- ],
- []
- ]
- },
- { // BrMain, W.
- id: '#6',
- title: ['BrMain', 'W'],
- values: [
- {
- total: 96,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- '#1' // BrMain -> Init, W.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // RdMain, *.
- title: ['RdMain', undefined],
- values: [
- {
- total: 628,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- { // RdMain -> RTask, *.
- title: ['RTask', undefined],
- values: [
- {
- total: 556,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- [
- { // RdMain -> RTask, T.
- id: '#7',
- title: ['RTask', 'T'],
- values: [
- {
- total: 211,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // RdMain -> RTask, W.
- id: '#8',
- title: ['RTask', 'W'],
- values: [
- {
- total: 337,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // RdMain, T.
- id: '#9',
- title: ['RdMain', 'T'],
- values: [
- {
- total: 229,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- '#7' // RdMain -> RTask, T.
- ],
- []
- ]
- },
- { // RdMain, W.
- id: '#10',
- title: ['RdMain', 'W'],
- values: [
- {
- total: 355,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- '#8' // RdMain -> RTask, W.
- ],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, T.
- title: [undefined, 'T'],
- values: [
- {
- total: 698,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- '#4', // BrMain, T.
- '#9' // RdMain, T.
- ],
- []
- ]
- },
- { // *, V.
- title: [undefined, 'V'],
- values: [
- {
- total: 340,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- '#5' // BrMain, V.
- ],
- []
- ]
- },
- { // *, W.
- title: [undefined, 'W'],
- values: [
- {
- total: 461,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- '#6', // BrMain, W.
- '#10' // RdMain, W.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // Top-down heavy view.
- title: [undefined, undefined],
- values: [
- {
- total: 1538,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- { // BrMain, *.
- title: ['BrMain', undefined],
- values: [
- {
- total: 876,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // BrMain -> Init, *.
- title: ['Init', undefined],
- values: [
- {
- total: 242,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // BrMain -> Init, T.
- id: '#0',
- title: ['Init', 'T'],
- values: [
- {
- total: 151,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // BrMain -> Init, W.
- id: '#1',
- title: ['Init', 'W'],
- values: [
- {
- total: 83,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // BrMain -> MsgLp, *.
- title: ['MsgLp', undefined],
- values: [
- {
- total: 601,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // BrMain -> MsgLp, T.
- id: '#2',
- title: ['MsgLp', 'T'],
- values: [
- {
- total: 307,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // BrMain -> MsgLp, V.
- id: '#3',
- title: ['MsgLp', 'V'],
- values: [
- {
- total: 281,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // BrMain, T.
- id: '#4',
- title: ['BrMain', 'T'],
- values: [
- {
- total: 465,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#0', // BrMain -> Init, T.
- '#2' // BrMain -> MsgLp, T.
- ],
- []
- ]
- },
- { // BrMain, V.
- id: '#5',
- title: ['BrMain', 'V'],
- values: [
- {
- total: 297,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#3' // BrMain -> MsgLp, V.
- ],
- []
- ]
- },
- { // BrMain, W.
- id: '#6',
- title: ['BrMain', 'W'],
- values: [
- {
- total: 96,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#1' // BrMain -> Init, W.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // Init, *.
- title: ['Init', undefined],
- values: [
- {
- total: 242,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // Init, T.
- id: '#7',
- title: ['Init', 'T'],
- values: [
- {
- total: 151,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // Init, W.
- id: '#8',
- title: ['Init', 'W'],
- values: [
- {
- total: 83,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // MsgLp, *.
- title: ['MsgLp', undefined],
- values: [
- {
- total: 601,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // MsgLp, T.
- id: '#9',
- title: ['MsgLp', 'T'],
- values: [
- {
- total: 307,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // MsgLp, V.
- id: '#10',
- title: ['MsgLp', 'V'],
- values: [
- {
- total: 281,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // RdMain, *.
- title: ['RdMain', undefined],
- values: [
- {
- total: 628,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // RdMain -> RTask, *.
- title: ['RTask', undefined],
- values: [
- {
- total: 556,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // RdMain -> RTask, T.
- id: '#11',
- title: ['RTask', 'T'],
- values: [
- {
- total: 211,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // RdMain -> RTask, W.
- id: '#12',
- title: ['RTask', 'W'],
- values: [
- {
- total: 337,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // RdMain, T.
- id: '#13',
- title: ['RdMain', 'T'],
- values: [
- {
- total: 229,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#11' // RdMain -> RTask, T.
- ],
- []
- ]
- },
- { // RdMain, W.
- id: '#14',
- title: ['RdMain', 'W'],
- values: [
- {
- total: 355,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#12' // RdMain -> RTask, W.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // RTask, *.
- title: ['RTask', undefined],
- values: [
- {
- total: 556,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // RTask, T.
- id: '#15',
- title: ['RTask', 'T'],
- values: [
- {
- total: 211,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // RTask, W.
- id: '#16',
- title: ['RTask', 'W'],
- values: [
- {
- total: 337,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, T.
- title: [undefined, 'T'],
- values: [
- {
- total: 698,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#4', // BrMain, T.
- '#7', // Init, T.
- '#9', // MsgLp, T.
- '#13', // RdMain, T.
- '#15' // RTask, T.
- ],
- []
- ]
- },
- { // *, V.
- title: [undefined, 'V'],
- values: [
- {
- total: 340,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#5', // BrMain, V.
- '#10' // MsgLp, V.
- ],
- []
- ]
- },
- { // *, W.
- title: [undefined, 'W'],
- values: [
- {
- total: 461,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#6', // BrMain, W.
- '#8', // Init, W.
- '#14', // RdMain, W.
- '#16' // RTask, W.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined, undefined],
- values: [
- {
- total: 1538,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- { // BrMain, *.
- title: ['BrMain', undefined],
- values: [
- {
- total: 876,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // BrMain, T.
- id: '#0',
- title: ['BrMain', 'T'],
- values: [
- {
- total: 465,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // BrMain, V.
- id: '#1',
- title: ['BrMain', 'V'],
- values: [
- {
- total: 297,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // BrMain, W.
- id: '#2',
- title: ['BrMain', 'W'],
- values: [
- {
- total: 96,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // Init, *.
- title: ['Init', undefined],
- values: [
- {
- total: 242,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // Init -> BrMain, *.
- title: ['BrMain', undefined],
- values: [
- {
- total: 242,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // Init -> BrMain, T.
- id: '#3',
- title: ['BrMain', 'T'],
- values: [
- {
- total: 151,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // Init -> BrMain, W.
- id: '#4',
- title: ['BrMain', 'W'],
- values: [
- {
- total: 83,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // Init, T.
- id: '#5',
- title: ['Init', 'T'],
- values: [
- {
- total: 151,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#3' // Init -> BrMain, T.
- ],
- []
- ]
- },
- { // Init, W.
- id: '#6',
- title: ['Init', 'W'],
- values: [
- {
- total: 83,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#4' // Init -> BrMain, W.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // MsgLp, *.
- title: ['MsgLp', undefined],
- values: [
- {
- total: 601,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // MsgLp -> BrMain, *.
- title: ['BrMain', undefined],
- values: [
- {
- total: 601,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // MsgLp -> BrMain, T.
- id: '#7',
- title: ['BrMain', 'T'],
- values: [
- {
- total: 307,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // MsgLp -> BrMain, V.
- id: '#8',
- title: ['BrMain', 'V'],
- values: [
- {
- total: 281,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // MsgLp, T.
- id: '#9',
- title: ['MsgLp', 'T'],
- values: [
- {
- total: 307,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#7' // MsgLp -> BrMain, T.
- ],
- []
- ]
- },
- { // MsgLp, V.
- id: '#10',
- title: ['MsgLp', 'V'],
- values: [
- {
- total: 281,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#8' // MsgLp -> BrMain, V.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // RdMain, *.
- title: ['RdMain', undefined],
- values: [
- {
- total: 628,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // RdMain, T.
- id: '#11',
- title: ['RdMain', 'T'],
- values: [
- {
- total: 229,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // RdMain, W.
- id: '#12',
- title: ['RdMain', 'W'],
- values: [
- {
- total: 355,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // RTask, *.
- title: ['RTask', undefined],
- values: [
- {
- total: 556,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // RTask -> RdMain, *.
- title: ['RdMain', undefined],
- values: [
- {
- total: 556,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // RTask -> RdMain, T.
- id: '#13',
- title: ['RdMain', 'T'],
- values: [
- {
- total: 211,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // RTask -> RdMain, W.
- id: '#14',
- title: ['RdMain', 'W'],
- values: [
- {
- total: 337,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // RTask, T.
- id: '#15',
- title: ['RTask', 'T'],
- values: [
- {
- total: 211,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#13' // RTask -> RdMain, T.
- ],
- []
- ]
- },
- { // RTask, W.
- id: '#16',
- title: ['RTask', 'W'],
- values: [
- {
- total: 337,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#14' // RTask -> RdMain, W.
- ],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, T.
- title: [undefined, 'T'],
- values: [
- {
- total: 698,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#0', // BrMain, T.
- '#5', // Init, T.
- '#9', // MsgLp, T.
- '#11', // RdMain, T.
- '#15' // RTask, T.
- ],
- []
- ]
- },
- { // *, V.
- title: [undefined, 'V'],
- values: [
- {
- total: 340,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#1', // BrMain, V.
- '#10' // MsgLp, V.
- ],
- []
- ]
- },
- { // *, W.
- title: [undefined, 'W'],
- values: [
- {
- total: 461,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#2', // BrMain, W.
- '#6', // Init, W.
- '#12', // RdMain, W.
- '#16' // RTask, W.
- ],
- []
- ]
- }
- ]
- ]
- });
-
- builderTest('twoDimensions_oneRecursiveDimension', 2 /* dimensions */,
- 1 /* valueCount */,
- [
- { path: [['A', 'B'], []], values: [1500], kind: TOTAL },
- { path: [['A', 'B', 'A'], []], values: [200], kind: TOTAL },
- { path: [['A', 'B', 'B'], []], values: [300], kind: TOTAL },
- { path: [['A', 'B', 'C'], []], values: [700], kind: TOTAL },
- { path: [['A', 'B'], ['T1']], values: [15], kind: TOTAL },
- { path: [['A', 'B', 'A'], ['T1']], values: [2], kind: TOTAL },
- { path: [['A', 'B', 'B'], ['T1']], values: [3], kind: TOTAL },
- { path: [['A', 'B', 'C'], ['T1']], values: [7], kind: TOTAL },
- { path: [['B', 'A'], ['T1']], values: [30000], kind: TOTAL },
- { path: [['B', 'A'], []], values: [40000], kind: TOTAL }
- ],
- { // Top-down tree view.
- title: [undefined, undefined],
- values: [
- {
- total: 41500,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A, *.
- title: ['A', undefined],
- values: [
- {
- total: 1500,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 1500,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- { // A -> B -> A, *.
- title: ['A', undefined],
- values: [
- {
- total: 200,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- [
- { // A -> B -> A, T1.
- id: '#0',
- title: ['A', 'T1'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // A -> B -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 300,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- [
- { // A -> B -> B, T1.
- id: '#1',
- title: ['B', 'T1'],
- values: [
- {
- total: 3,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // A -> B -> C, *.
- title: ['C', undefined],
- values: [
- {
- total: 700,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- [
- { // A -> B -> C, T1.
- id: '#2',
- title: ['C', 'T1'],
- values: [
- {
- total: 7,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A -> B, T1.
- id: '#3',
- title: ['B', 'T1'],
- values: [
- {
- total: 15,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- '#0', // A -> B -> A, T1.
- '#1', // A -> B -> B, T1.
- '#2' // A -> B -> C, T1.
- ],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, T1.
- id: '#4',
- title: ['A', 'T1'],
- values: [
- {
- total: 15,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#3' // A -> B, T1.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // B, *.
- title: ['B', undefined],
- values: [
- {
- total: 40000,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> A, *.
- title: ['A', undefined],
- values: [
- {
- total: 40000,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- [
- { // B -> A, T1.
- id: '#5',
- title: ['A', 'T1'],
- values: [
- {
- total: 30000,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B, T1.
- id: '#6',
- title: ['B', 'T1'],
- values: [
- {
- total: 30000,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#5' // B -> A, T1.
- ],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, T1.
- title: [undefined, 'T1'],
- values: [
- {
- total: 30015,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#4', // A, T1.
- '#6' // B, T1.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // Top-down heavy view.
- title: [undefined, undefined],
- values: [
- {
- total: 41500,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A, *.
- title: ['A', undefined],
- values: [
- {
- total: 41500,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 1500,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B -> A, *.
- title: ['A', undefined],
- values: [
- {
- total: 200,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B -> A, T1.
- id: '#0',
- title: ['A', 'T1'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // A -> B -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 300,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B -> B, T1.
- id: '#1',
- title: ['B', 'T1'],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // A -> B -> C, *.
- title: ['C', undefined],
- values: [
- {
- total: 700,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B -> C, T1.
- id: '#2',
- title: ['C', 'T1'],
- values: [
- {
- total: 7,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A -> B, T1.
- id: '#3',
- title: ['B', 'T1'],
- values: [
- {
- total: 15,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#0', // A -> B -> A, T1.
- '#1', // A -> B -> B, T1.
- '#2' // A -> B -> C, T1.
- ],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, T1.
- id: '#4',
- title: ['A', 'T1'],
- values: [
- {
- total: 30015,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#3' // A -> B, T1.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // B, *.
- title: ['B', undefined],
- values: [
- {
- total: 41500,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> A, *.
- title: ['A', undefined],
- values: [
- {
- total: 40200,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> A, T1.
- id: '#5',
- title: ['A', 'T1'],
- values: [
- {
- total: 30002,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // B -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 300,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> B, T1.
- id: '#6',
- title: ['B', 'T1'],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // B -> C, *.
- title: ['C', undefined],
- values: [
- {
- total: 700,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> C, T1.
- id: '#7',
- title: ['C', 'T1'],
- values: [
- {
- total: 7,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B, T1.
- id: '#8',
- title: ['B', 'T1'],
- values: [
- {
- total: 30015,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#5', // B -> A, T1.
- '#6', // B -> B, T1.
- '#7' // B -> C, T1.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // C, *.
- title: ['C', undefined],
- values: [
- {
- total: 700,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // C, T1.
- id: '#9',
- title: ['C', 'T1'],
- values: [
- {
- total: 7,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, T1.
- title: [undefined, 'T1'],
- values: [
- {
- total: 30015,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#4', // A, T1.
- '#8', // B, T1.
- '#9' // C, T1.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined, undefined],
- values: [
- {
- total: 41500,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A, *.
- title: ['A', undefined],
- values: [
- {
- total: 41500,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 40200,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B -> A, *.
- title: ['A', undefined],
- values: [
- {
- total: 200,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B -> A, T1.
- id: '#0',
- title: ['A', 'T1'],
- values: [
- {
- total: 2,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A -> B, T1.
- id: '#1',
- title: ['B', 'T1'],
- values: [
- {
- total: 30002,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#0' // A -> B -> A, T1.
- ],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, T1.
- id: '#2',
- title: ['A', 'T1'],
- values: [
- {
- total: 30015,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#1' // A -> B, T1.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // B, *.
- title: ['B', undefined],
- values: [
- {
- total: 41500,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> A, *.
- title: ['A', undefined],
- values: [
- {
- total: 1500,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> A, T1.
- id: '#3',
- title: ['A', 'T1'],
- values: [
- {
- total: 15,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // B -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 300,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> B -> A, *.
- title: ['A', undefined],
- values: [
- {
- total: 300,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> B -> A, T1.
- id: '#4',
- title: ['A', 'T1'],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B -> B, T1.
- id: '#5',
- title: ['B', 'T1'],
- values: [
- {
- total: 3,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#4' // B -> B -> A, T1.
- ],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B, T1.
- id: '#6',
- title: ['B', 'T1'],
- values: [
- {
- total: 30015,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#3', // B -> A, T1.
- '#5' // B -> B, T1.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // C, *.
- title: ['C', undefined],
- values: [
- {
- total: 700,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 700,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // C -> B -> A, *.
- title: ['A', undefined],
- values: [
- {
- total: 700,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // C -> B -> A, T1.
- id: '#7',
- title: ['A', 'T1'],
- values: [
- {
- total: 7,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // C -> B, T1.
- id: '#8',
- title: ['B', 'T1'],
- values: [
- {
- total: 7,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#7' // C -> B -> A, T1.
- ],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // C, T1.
- id: '#9',
- title: ['C', 'T1'],
- values: [
- {
- total: 7,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#8' // C -> B, T1.
- ],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, T1.
- title: [undefined, 'T1'],
- values: [
- {
- total: 30015,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#2', // A, T1.
- '#6', // B, T1.
- '#9' // C, T1.
- ],
- []
- ]
- }
- ]
- ]
- });
-
- builderTest('twoDimensions_twoRecursiveDimensions', 2 /* dimensions */,
- 1 /* valueCount */,
- [
- { path: [['A', 'A', 'B'], ['1', '2', '2']], values: [10], kind: SELF },
- { path: [['A', 'A'], ['1', '2']], values: [40], kind: TOTAL },
- { path: [['A', 'B', 'B'], ['1', '1', '2']], values: [20], kind: TOTAL },
- { path: [['A', 'B'], ['1', '1']], values: [5], kind: SELF }
- ],
- { // Top-down tree view.
- title: [undefined, undefined],
- values: [
- {
- total: 65,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A, *.
- title: ['A', undefined],
- values: [
- {
- total: 65,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> A, *.
- title: ['A', undefined],
- values: [
- {
- total: 40,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> A -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> A -> B, 1.
- id: '#0',
- title: ['B', '1'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> A -> B, 1 -> 2.
- id: '#1',
- title: ['B', '2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> A -> B, 1 -> 2 -> 2.
- id: '#2',
- title: ['B', '2'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A -> A, 1.
- id: '#3',
- title: ['A', '1'],
- values: [
- {
- total: 40,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#0' // A -> A -> B, 1.
- ],
- [
- { // A -> A, 1 -> 2.
- id: '#4',
- title: ['A', '2'],
- values: [
- {
- total: 40,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [
- '#1' // A -> A -> B, 1 -> 2.
- ],
- [
- { // A -> A, 1 -> 2 -> 2.
- id: '#5',
- title: ['A', '2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#2' // A -> A -> B, 1 -> 2 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // A -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 25,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B -> B, 1.
- id: '#6',
- title: ['B', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B -> B, 1 -> 1.
- id: '#7',
- title: ['B', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B -> B, 1 -> 1 -> 2.
- id: '#8',
- title: ['B', '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A -> B, 1.
- id: '#9',
- title: ['B', '1'],
- values: [
- {
- total: 25,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#6' // A -> B -> B, 1.
- ],
- [
- { // A -> B, 1 -> 1.
- id: '#10',
- title: ['B', '1'],
- values: [
- {
- total: 25,
- self: 5,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#7' // A -> B -> B, 1 -> 1.
- ],
- [
- { // A -> B, 1 -> 1 -> 2.
- id: '#11',
- title: ['B', '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#8' // A -> B -> B, 1 -> 1 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, 1.
- id: '#12',
- title: ['A', '1'],
- values: [
- {
- total: 65,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#3', // A -> A, 1.
- '#9' // A -> B, 1.
- ],
- [
- { // A, 1 -> 2.
- id: '#13',
- title: ['A', '2'],
- values: [
- {
- total: 40,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#4' // A -> A, 1 -> 2.
- ],
- [
- { // A, 1 -> 2 -> 2.
- id: '#14',
- title: ['A', '2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#5' // A -> A, 1 -> 2 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // A, 1 -> 1.
- id: '#15',
- title: ['A', '1'],
- values: [
- {
- total: 25,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#10' // A -> B, 1 -> 1.
- ],
- [
- { // A, 1 -> 1 -> 2.
- id: '#16',
- title: ['A', '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#11' // A -> B, 1 -> 1 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, 1.
- title: [undefined, '1'],
- values: [
- {
- total: 65,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#12' // A, 1.
- ],
- [
- { // *, 1 -> 2.
- title: [undefined, '2'],
- values: [
- {
- total: 40,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#13' // A, 1 -> 2.
- ],
- [
- { // *, 1 -> 2 -> 2.
- title: [undefined, '2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#14' // A, 1 -> 2 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // *, 1 -> 1.
- title: [undefined, '1'],
- values: [
- {
- total: 25,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#15' // A, 1 -> 1.
- ],
- [
- { // *, 1 -> 1 -> 2.
- title: [undefined, '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#16' // A, 1 -> 1 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // Top-down heavy view.
- title: [undefined, undefined],
- values: [
- {
- total: 65,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A, *.
- title: ['A', undefined],
- values: [
- {
- total: 65,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> A, *.
- title: ['A', undefined],
- values: [
- {
- total: 40,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> A -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> A -> B, 1.
- id: '#0',
- title: ['B', '1'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> A -> B, 1 -> 2.
- id: '#1',
- title: ['B', '2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> A -> B, 1 -> 2 -> 2.
- id: '#2',
- title: ['B', '2'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // A -> A -> B, 2.
- id: '#3',
- title: ['B', '2'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> A -> B, 2 -> 2.
- id: '#4',
- title: ['B', '2'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A -> A, 1.
- id: '#5',
- title: ['A', '1'],
- values: [
- {
- total: 40,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#0' // A -> A -> B, 1.
- ],
- [
- { // A -> A, 1 -> 2.
- id: '#6',
- title: ['A', '2'],
- values: [
- {
- total: 40,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#1' // A -> A -> B, 1 -> 2.
- ],
- [
- { // A -> A, 1 -> 2 -> 2.
- id: '#7',
- title: ['A', '2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#2' // A -> A -> B, 1 -> 2 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // A -> A, 2.
- id: '#8',
- title: ['A', '2'],
- values: [
- {
- total: 40,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#3' // A -> A -> B, 2.
- ],
- [
- { // A -> A, 2 -> 2.
- id: '#9',
- title: ['A', '2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#4' // A -> A -> B, 2 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // A -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 35,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B -> B, 1.
- id: '#10',
- title: ['B', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B -> B, 1 -> 1.
- id: '#11',
- title: ['B', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B -> B, 1 -> 1 -> 2.
- id: '#12',
- title: ['B', '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // A -> B -> B, 1 -> 2.
- id: '#13',
- title: ['B', '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // A -> B -> B, 2.
- id: '#14',
- title: ['B', '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A -> B, 1.
- id: '#15',
- title: ['B', '1'],
- values: [
- {
- total: 35,
- self: 5,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#10' // A -> B -> B, 1.
- ],
- [
- { // A -> B, 1 -> 1.
- id: '#16',
- title: ['B', '1'],
- values: [
- {
- total: 25,
- self: 5,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#11' // A -> B -> B, 1 -> 1.
- ],
- [
- { // A -> B, 1 -> 1 -> 2.
- id: '#17',
- title: ['B', '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#12' // A -> B -> B, 1 -> 1 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // A -> B, 1 -> 2.
- id: '#18',
- title: ['B', '2'],
- values: [
- {
- total: 30,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#13' // A -> B -> B, 1 -> 2.
- ],
- [
- { // A -> B, 1 -> 2 -> 2.
- id: '#19',
- title: ['B', '2'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // A -> B, 2.
- id: '#20',
- title: ['B', '2'],
- values: [
- {
- total: 30,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#14' // A -> B -> B, 2.
- ],
- [
- { // A -> B, 2 -> 2.
- id: '#21',
- title: ['B', '2'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, 1.
- id: '#22',
- title: ['A', '1'],
- values: [
- {
- total: 65,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#5', // A -> A, 1.
- '#15' // A -> B, 1.
- ],
- [
- { // A, 1 -> 2.
- id: '#23',
- title: ['A', '2'],
- values: [
- {
- total: 60,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#6', // A -> A, 1 -> 2.
- '#18' // A -> B, 1 -> 2.
- ],
- [
- { // A, 1 -> 2 -> 2.
- id: '#24',
- title: ['A', '2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#7', // A -> A, 1 -> 2 -> 2.
- '#19' // A -> B, 1 -> 2 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // A, 1 -> 1.
- id: '#25',
- title: ['A', '1'],
- values: [
- {
- total: 25,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#16' // A -> B, 1 -> 1.
- ],
- [
- { // A, 1 -> 1 -> 2.
- id: '#26',
- title: ['A', '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#17' // A -> B, 1 -> 1 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // A, 2.
- id: '#27',
- title: ['A', '2'],
- values: [
- {
- total: 60,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#8', // A -> A, 2.
- '#20' // A -> B, 2.
- ],
- [
- { // A, 2 -> 2.
- id: '#28',
- title: ['A', '2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#9', // A -> A, 2 -> 2.
- '#21' // A -> B, 2 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B, *.
- title: ['B', undefined],
- values: [
- {
- total: 35,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> B, 1.
- id: '#29',
- title: ['B', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> B, 1 -> 1.
- id: '#30',
- title: ['B', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> B, 1 -> 1 -> 2.
- id: '#31',
- title: ['B', '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // B -> B, 1 -> 2.
- id: '#32',
- title: ['B', '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // B -> B, 2.
- id: '#33',
- title: ['B', '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B, 1.
- id: '#34',
- title: ['B', '1'],
- values: [
- {
- total: 35,
- self: 5,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#29' // B -> B, 1.
- ],
- [
- { // B, 1 -> 2.
- id: '#35',
- title: ['B', '2'],
- values: [
- {
- total: 30,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#32' // B -> B, 1 -> 2.
- ],
- [
- { // B, 1 -> 2 -> 2.
- id: '#36',
- title: ['B', '2'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // B, 1 -> 1.
- id: '#37',
- title: ['B', '1'],
- values: [
- {
- total: 25,
- self: 5,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#30' // B -> B, 1 -> 1.
- ],
- [
- { // B, 1 -> 1 -> 2.
- id: '#38',
- title: ['B', '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#31' // B -> B, 1 -> 1 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B, 2.
- id: '#39',
- title: ['B', '2'],
- values: [
- {
- total: 30,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#33' // B -> B, 2.
- ],
- [
- { // B, 2 -> 2.
- id: '#40',
- title: ['B', '2'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, 1.
- title: [undefined, '1'],
- values: [
- {
- total: 65,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#22', // A, 1.
- '#34' // B, 1.
- ],
- [
- { // *, 1 -> 2.
- title: [undefined, '2'],
- values: [
- {
- total: 60,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#23', // A, 1 -> 2.
- '#35' // B, 1 -> 2.
- ],
- [
- { // *, 1 -> 2 -> 2.
- title: [undefined, '2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#24', // A, 1 -> 2 -> 2.
- '#36' // B, 1 -> 2 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // *, 1 -> 1.
- title: [undefined, '1'],
- values: [
- {
- total: 25,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#25', // A, 1 -> 1.
- '#37' // B, 1 -> 1.
- ],
- [
- { // *, 1 -> 1 -> 2.
- title: [undefined, '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#26', // A, 1 -> 1 -> 2.
- '#38' // B, 1 -> 1 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // *, 2.
- title: [undefined, '2'],
- values: [
- {
- total: 60,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#27', // A, 2.
- '#39' // B, 2.
- ],
- [
- { // *, 2 -> 2.
- title: [undefined, '2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#28', // A, 2 -> 2.
- '#40' // B, 2 -> 2.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined, undefined],
- values: [
- {
- total: 65,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A, *.
- title: ['A', undefined],
- values: [
- {
- total: 65,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> A, *.
- title: ['A', undefined],
- values: [
- {
- total: 40,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> A, 1.
- id: '#0',
- title: ['A', '1'],
- values: [
- {
- total: 40,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // A -> A, 2.
- id: '#1',
- title: ['A', '2'],
- values: [
- {
- total: 40,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> A, 2 -> 1.
- id: '#2',
- title: ['A', '1'],
- values: [
- {
- total: 40,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // A -> A, 2 -> 2.
- id: '#3',
- title: ['A', '2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> A, 2 -> 2 -> 1.
- id: '#4',
- title: ['A', '1'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, 1.
- id: '#5',
- title: ['A', '1'],
- values: [
- {
- total: 65,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#0' // A -> A, 1.
- ],
- [
- { // A, 1 -> 1.
- id: '#6',
- title: ['A', '1'],
- values: [
- {
- total: 25,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // A, 2.
- id: '#7',
- title: ['A', '2'],
- values: [
- {
- total: 60,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#1' // A -> A, 2.
- ],
- [
- { // A, 2 -> 1.
- id: '#8',
- title: ['A', '1'],
- values: [
- {
- total: 60,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#2' // A -> A, 2 -> 1.
- ],
- [
- { // A, 2 -> 1 -> 1.
- id: '#9',
- title: ['A', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // A, 2 -> 2.
- id: '#10',
- title: ['A', '2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#3' // A -> A, 2 -> 2.
- ],
- [
- { // A, 2 -> 2 -> 1.
- id: '#11',
- title: ['A', '1'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#4' // A -> A, 2 -> 2 -> 1.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B, *.
- title: ['B', undefined],
- values: [
- {
- total: 35,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> A, *.
- title: ['A', undefined],
- values: [
- {
- total: 35,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> A -> A, *.
- title: ['A', undefined],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> A -> A, 1.
- id: '#12',
- title: ['A', '1'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // B -> A -> A, 2.
- id: '#13',
- title: ['A', '2'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> A -> A, 2 -> 1.
- id: '#14',
- title: ['A', '1'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- },
- { // B -> A -> A, 2 -> 2.
- id: '#15',
- title: ['A', '2'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> A -> A, 2 -> 2 -> 1.
- id: '#16',
- title: ['A', '1'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B -> A, 1.
- id: '#17',
- title: ['A', '1'],
- values: [
- {
- total: 35,
- self: 5,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#12' // B -> A -> A, 1.
- ],
- [
- { // B -> A, 1 -> 1.
- id: '#18',
- title: ['A', '1'],
- values: [
- {
- total: 25,
- self: 5,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // B -> A, 2.
- id: '#19',
- title: ['A', '2'],
- values: [
- {
- total: 30,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#13' // B -> A -> A, 2.
- ],
- [
- { // B -> A, 2 -> 1.
- id: '#20',
- title: ['A', '1'],
- values: [
- {
- total: 30,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#14' // B -> A -> A, 2 -> 1.
- ],
- [
- { // B -> A, 2 -> 1 -> 1.
- id: '#21',
- title: ['A', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // B -> A, 2 -> 2.
- id: '#22',
- title: ['A', '2'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#15' // B -> A -> A, 2 -> 2.
- ],
- [
- { // B -> A, 2 -> 2 -> 1.
- id: '#23',
- title: ['A', '1'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#16' // B -> A -> A, 2 -> 2 -> 1.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B -> B, *.
- title: ['B', undefined],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> B -> A, *.
- title: ['A', undefined],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> B -> A, 1.
- id: '#24',
- title: ['A', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> B -> A, 1 -> 1.
- id: '#25',
- title: ['A', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- },
- { // B -> B -> A, 2.
- id: '#26',
- title: ['A', '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> B -> A, 2 -> 1.
- id: '#27',
- title: ['A', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> B -> A, 2 -> 1 -> 1.
- id: '#28',
- title: ['A', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B -> B, 1.
- id: '#29',
- title: ['B', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#24' // B -> B -> A, 1.
- ],
- [
- { // B -> B, 1 -> 1.
- id: '#30',
- title: ['B', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#25' // B -> B -> A, 1 -> 1.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // B -> B, 2.
- id: '#31',
- title: ['B', '2'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#26' // B -> B -> A, 2.
- ],
- [
- { // B -> B, 2 -> 1.
- id: '#32',
- title: ['B', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#27' // B -> B -> A, 2 -> 1.
- ],
- [
- { // B -> B, 2 -> 1 -> 1.
- id: '#33',
- title: ['B', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#28' // B -> B -> A, 2 -> 1 -> 1.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B, 1.
- id: '#34',
- title: ['B', '1'],
- values: [
- {
- total: 35,
- self: 5,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#17', // B -> A, 1.
- '#29' // B -> B, 1.
- ],
- [
- { // B, 1 -> 1.
- id: '#35',
- title: ['B', '1'],
- values: [
- {
- total: 25,
- self: 5,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#18', // B -> A, 1 -> 1.
- '#30' // B -> B, 1 -> 1.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // B, 2.
- id: '#36',
- title: ['B', '2'],
- values: [
- {
- total: 30,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#19', // B -> A, 2.
- '#31' // B -> B, 2.
- ],
- [
- { // B, 2 -> 1.
- id: '#37',
- title: ['B', '1'],
- values: [
- {
- total: 30,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#20', // B -> A, 2 -> 1.
- '#32' // B -> B, 2 -> 1.
- ],
- [
- { // B, 2 -> 1 -> 1.
- id: '#38',
- title: ['B', '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#21', // B -> A, 2 -> 1 -> 1.
- '#33' // B -> B, 2 -> 1 -> 1.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // B, 2 -> 2.
- id: '#39',
- title: ['B', '2'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#22' // B -> A, 2 -> 2.
- ],
- [
- { // B, 2 -> 2 -> 1.
- id: '#40',
- title: ['B', '1'],
- values: [
- {
- total: 10,
- self: 10,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#23' // B -> A, 2 -> 2 -> 1.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, 1.
- title: [undefined, '1'],
- values: [
- {
- total: 65,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#5', // A, 1.
- '#34' // B, 1.
- ],
- [
- { // *, 1 -> 1.
- title: [undefined, '1'],
- values: [
- {
- total: 25,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#6', // A, 1 -> 1.
- '#35' // B, 1 -> 1.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // *, 2.
- title: [undefined, '2'],
- values: [
- {
- total: 60,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#7', // A, 2.
- '#36' // B, 2.
- ],
- [
- { // *, 2 -> 1.
- title: [undefined, '1'],
- values: [
- {
- total: 60,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#8', // A, 2 -> 1.
- '#37' // B, 2 -> 1.
- ],
- [
- { // *, 2 -> 1 -> 1.
- title: [undefined, '1'],
- values: [
- {
- total: 20,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#9', // A, 2 -> 1 -> 1.
- '#38' // B, 2 -> 1 -> 1.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // *, 2 -> 2.
- title: [undefined, '2'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#10', // A, 2 -> 2.
- '#39' // B, 2 -> 2.
- ],
- [
- { // *, 2 -> 2 -> 1.
- title: [undefined, '1'],
- values: [
- {
- total: 10,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#11', // A, 2 -> 2 -> 1.
- '#40' // B, 2 -> 2 -> 1.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ]
- ]
- });
-
- builderTest('threeDimensions', 3 /* dimensions */, 1 /* valueCount */,
- [
- { path: [['A', 'B'], ['C', 'D'], ['E', 'F']], values: [b(0)],
- kind: SELF },
- { path: [['A', 'B'], ['C', 'D'], ['E']], values: [b(1)], kind: SELF },
- { path: [['A', 'B'], ['C', 'D'], []], values: [b(2)], kind: SELF },
- { path: [['A', 'B'], ['C'], ['E', 'F']], values: [b(3)], kind: SELF },
- { path: [['A', 'B'], ['C'], ['E']], values: [b(4)], kind: SELF },
- { path: [['A', 'B'], ['C'], []], values: [b(5)], kind: SELF },
- { path: [['A', 'B'], [], ['E', 'F']], values: [b(6)], kind: SELF },
- { path: [['A', 'B'], [], ['E']], values: [b(7)], kind: SELF },
- { path: [['A', 'B'], [], []], values: [b(8)], kind: SELF },
-
- { path: [['A'], ['C', 'D'], ['E', 'F']], values: [b(9)], kind: SELF },
- { path: [['A'], ['C', 'D'], ['E']], values: [b(10)], kind: SELF },
- { path: [['A'], ['C', 'D'], []], values: [b(11)], kind: SELF },
- { path: [['A'], ['C'], ['E', 'F']], values: [b(12)], kind: SELF },
- { path: [['A'], ['C'], ['E']], values: [b(13)], kind: SELF },
- { path: [['A'], ['C'], []], values: [b(14)], kind: SELF },
- { path: [['A'], [], ['E', 'F']], values: [b(15)], kind: SELF },
- { path: [['A'], [], ['E']], values: [b(16)], kind: SELF },
- { path: [['A'], [], []], values: [b(17)], kind: SELF },
-
- { path: [[], ['C', 'D'], ['E', 'F']], values: [b(18)], kind: SELF },
- { path: [[], ['C', 'D'], ['E']], values: [b(19)], kind: SELF },
- { path: [[], ['C', 'D'], []], values: [b(20)], kind: SELF },
- { path: [[], ['C'], ['E', 'F']], values: [b(21)], kind: SELF },
- { path: [[], ['C'], ['E']], values: [b(22)], kind: SELF },
- { path: [[], ['C'], []], values: [b(23)], kind: SELF },
- { path: [[], [], ['E', 'F']], values: [b(24)], kind: SELF },
- { path: [[], [], ['E']], values: [b(25)], kind: SELF },
- { path: [[], [], []], values: [b(26)], kind: SELF }
- ],
- { // Top-down tree view.
- title: [undefined, undefined, undefined],
- values: [
- {
- total: b([0, 26]),
- self: b(26),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A, *, *.
- title: ['A', undefined, undefined],
- values: [
- {
- total: b([0, 17]),
- self: b(17),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B, *, *.
- title: ['B', undefined, undefined],
- values: [
- {
- total: b([0, 8]),
- self: b(8),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B, C, *.
- id: '#0',
- title: ['B', 'C', undefined],
- values: [
- {
- total: b([0, 5]),
- self: b(5),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B, C -> D, *.
- id: '#1',
- title: ['B', 'D', undefined],
- values: [
- {
- total: b([0, 2]),
- self: b(2),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // A -> B, C -> D, E.
- id: '#2',
- title: ['B', 'D', 'E'],
- values: [
- {
- total: b(0, 1),
- self: b(1),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // A -> B, C -> D, E -> F.
- id: '#3',
- title: ['B', 'D', 'F'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A -> B, C, E.
- id: '#4',
- title: ['B', 'C', 'E'],
- values: [
- {
- total: b(0, 1, 3, 4),
- self: b(4),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#2' // A -> B, C -> D, E.
- ],
- [
- { // A -> B, C, E -> F.
- id: '#5',
- title: ['B', 'C', 'F'],
- values: [
- {
- total: b(0, 3),
- self: b(3),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#3' // A -> B, C -> D, E -> F.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A -> B, *, E.
- id: '#6',
- title: ['B', undefined, 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 6, 7),
- self: b(7),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#4' // A -> B, C, E.
- ],
- [
- { // A -> B, *, E -> F.
- id: '#7',
- title: ['B', undefined, 'F'],
- values: [
- {
- total: b(0, 3, 6),
- self: b(6),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#5' // A -> B, C, E -> F.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, C, *.
- id: '#8',
- title: ['A', 'C', undefined],
- values: [
- {
- total: b([0, 5], [9, 14]),
- self: b(14),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#0' // A -> B, C, *.
- ],
- [
- { // A, C -> D, *.
- id: '#9',
- title: ['A', 'D', undefined],
- values: [
- {
- total: b([0, 2], [9, 11]),
- self: b(11),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#1' // A -> B, C -> D, *.
- ],
- [],
- [
- { // A, C -> D, E.
- id: '#10',
- title: ['A', 'D', 'E'],
- values: [
- {
- total: b(0, 1, 9, 10),
- self: b(10),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#2' // A -> B, C -> D, E.
- ],
- [],
- [
- { // A, C -> D, E -> F.
- id: '#11',
- title: ['A', 'D', 'F'],
- values: [
- {
- total: b(0, 9),
- self: b(9),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#3' // A -> B, C -> D, E -> F.
- ],
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, C, E.
- id: '#12',
- title: ['A', 'C', 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 9, 10, 12, 13),
- self: b(13),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#4' // A -> B, C, E.
- ],
- [
- '#10' // A, C -> D, E.
- ],
- [
- { // A, C, E -> F.
- id: '#13',
- title: ['A', 'C', 'F'],
- values: [
- {
- total: b(0, 3, 9, 12),
- self: b(12),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#5' // A -> B, C, E -> F.
- ],
- [
- '#11' // A, C -> D, E -> F.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, *, E.
- id: '#14',
- title: ['A', undefined, 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 15, 16),
- self: b(16),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#6' // A -> B, *, E.
- ],
- [
- '#12' // A, C, E.
- ],
- [
- { // A, *, E -> F.
- id: '#15',
- title: ['A', undefined, 'F'],
- values: [
- {
- total: b(0, 3, 6, 9, 12, 15),
- self: b(15),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#7' // A -> B, *, E -> F.
- ],
- [
- '#13' // A, C, E -> F.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, C, *.
- title: [undefined, 'C', undefined],
- values: [
- {
- total: b([0, 5], [9, 14], [18, 23]),
- self: b(23),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#8' // A, C, *.
- ],
- [
- { // *, C -> D, *.
- title: [undefined, 'D', undefined],
- values: [
- {
- total: b([0, 2], [9, 11], [18, 20]),
- self: b(20),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#9' // A, C -> D, *.
- ],
- [],
- [
- { // *, C -> D, E.
- id: '#16',
- title: [undefined, 'D', 'E'],
- values: [
- {
- total: b(0, 1, 9, 10, 18, 19),
- self: b(19),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#10' // A, C -> D, E.
- ],
- [],
- [
- { // *, C -> D, E -> F.
- id: '#17',
- title: [undefined, 'D', 'F'],
- values: [
- {
- total: b(0, 9, 18),
- self: b(18),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#11' // A, C -> D, E -> F.
- ],
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, C, E.
- id: '#18',
- title: [undefined, 'C', 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 9, 10, 12, 13, 18, 19, 21, 22),
- self: b(22),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#12' // A, C, E.
- ],
- [
- '#16' // *, C -> D, E.
- ],
- [
- { // *, C, E -> F.
- id: '#19',
- title: [undefined, 'C', 'F'],
- values: [
- {
- total: b(0, 3, 9, 12, 18, 21),
- self: b(21),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#13' // A, C, E -> F.
- ],
- [
- '#17' // *, C -> D, E -> F.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, *, E.
- title: [undefined, undefined, 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 15, 16, 18, 19, 21,
- 22, 24, 25),
- self: b(25),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#14' // A, *, E.
- ],
- [
- '#18' // *, C, E.
- ],
- [
- { // *, *, E -> F.
- title: [undefined, undefined, 'F'],
- values: [
- {
- total: b(0, 3, 6, 9, 12, 15, 18, 21, 24),
- self: b(24),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#15' // A, *, E -> F.
- ],
- [
- '#19' // *, C, E -> F.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // Top-down heavy view.
- title: [undefined, undefined, undefined],
- values: [
- {
- total: b([0, 26]),
- self: b(26),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A, *, *.
- title: ['A', undefined, undefined],
- values: [
- {
- total: b([0, 17]),
- self: b(17),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A -> B, *, *.
- title: ['B', undefined, undefined],
- values: [
- {
- total: b([0, 8]),
- self: b(8),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B, C, *.
- id: '#0',
- title: ['B', 'C', undefined],
- values: [
- {
- total: b([0, 5]),
- self: b(5),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A -> B, C -> D, *.
- id: '#1',
- title: ['B', 'D', undefined],
- values: [
- {
- total: b([0, 2]),
- self: b(2),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // A -> B, C -> D, E.
- id: '#2',
- title: ['B', 'D', 'E'],
- values: [
- {
- total: b(0, 1),
- self: b(1),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // A -> B, C -> D, E -> F.
- id: '#3',
- title: ['B', 'D', 'F'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- },
- { // A -> B, C -> D, F.
- id: '#4',
- title: ['B', 'D', 'F'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A -> B, C, E.
- id: '#5',
- title: ['B', 'C', 'E'],
- values: [
- {
- total: b(0, 1, 3, 4),
- self: b(4),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#2' // A -> B, C -> D, E.
- ],
- [
- { // A -> B, C, E -> F.
- id: '#6',
- title: ['B', 'C', 'F'],
- values: [
- {
- total: b(0, 3),
- self: b(3),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#3' // A -> B, C -> D, E -> F.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // A -> B, C, F.
- id: '#7',
- title: ['B', 'C', 'F'],
- values: [
- {
- total: b(0, 3),
- self: b(3),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#4' // A -> B, C -> D, F.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // A -> B, D, *.
- id: '#8',
- title: ['B', 'D', undefined],
- values: [
- {
- total: b([0, 2]),
- self: b(2),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // A -> B, D, E.
- id: '#9',
- title: ['B', 'D', 'E'],
- values: [
- {
- total: b(0, 1),
- self: b(1),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // A -> B, D, E -> F.
- id: '#10',
- title: ['B', 'D', 'F'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- },
- { // A -> B, D, F.
- id: '#11',
- title: ['B', 'D', 'F'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A -> B, *, E.
- id: '#12',
- title: ['B', undefined, 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 6, 7),
- self: b(7),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#5', // A -> B, C, E.
- '#9' // A -> B, D, E.
- ],
- [
- { // A -> B, *, E -> F.
- id: '#13',
- title: ['B', undefined, 'F'],
- values: [
- {
- total: b(0, 3, 6),
- self: b(6),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#6', // A -> B, C, E -> F.
- '#10' // A -> B, D, E -> F.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // A -> B, *, F.
- id: '#14',
- title: ['B', undefined, 'F'],
- values: [
- {
- total: b(0, 3, 6),
- self: b(6),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#7', // A -> B, C, F.
- '#11' // A -> B, D, F.
- ],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, C, *.
- id: '#15',
- title: ['A', 'C', undefined],
- values: [
- {
- total: b([0, 5], [9, 14]),
- self: b(14),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#0' // A -> B, C, *.
- ],
- [
- { // A, C -> D, *.
- id: '#16',
- title: ['A', 'D', undefined],
- values: [
- {
- total: b([0, 2], [9, 11]),
- self: b(11),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#1' // A -> B, C -> D, *.
- ],
- [],
- [
- { // A, C -> D, E.
- id: '#17',
- title: ['A', 'D', 'E'],
- values: [
- {
- total: b(0, 1, 9, 10),
- self: b(10),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#2' // A -> B, C -> D, E.
- ],
- [],
- [
- { // A, C -> D, E -> F.
- id: '#18',
- title: ['A', 'D', 'F'],
- values: [
- {
- total: b(0, 9),
- self: b(9),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#3' // A -> B, C -> D, E -> F.
- ],
- [],
- []
- ]
- }
- ]
- ]
- },
- { // A, C -> D, F.
- id: '#19',
- title: ['A', 'D', 'F'],
- values: [
- {
- total: b(0, 9),
- self: b(9),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#4' // A -> B, C -> D, F.
- ],
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, C, E.
- id: '#20',
- title: ['A', 'C', 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 9, 10, 12, 13),
- self: b(13),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#5' // A -> B, C, E.
- ],
- [
- '#17' // A, C -> D, E.
- ],
- [
- { // A, C, E -> F.
- id: '#21',
- title: ['A', 'C', 'F'],
- values: [
- {
- total: b(0, 3, 9, 12),
- self: b(12),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#6' // A -> B, C, E -> F.
- ],
- [
- '#18' // A, C -> D, E -> F.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // A, C, F.
- id: '#22',
- title: ['A', 'C', 'F'],
- values: [
- {
- total: b(0, 3, 9, 12),
- self: b(12),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#7' // A -> B, C, F.
- ],
- [
- '#19' // A, C -> D, F.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // A, D, *.
- id: '#23',
- title: ['A', 'D', undefined],
- values: [
- {
- total: b([0, 2], [9, 11]),
- self: b(11),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#8' // A -> B, D, *.
- ],
- [],
- [
- { // A, D, E.
- id: '#24',
- title: ['A', 'D', 'E'],
- values: [
- {
- total: b(0, 1, 9, 10),
- self: b(10),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#9' // A -> B, D, E.
- ],
- [],
- [
- { // A, D, E -> F.
- id: '#25',
- title: ['A', 'D', 'F'],
- values: [
- {
- total: b(0, 9),
- self: b(9),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#10' // A -> B, D, E -> F.
- ],
- [],
- []
- ]
- }
- ]
- ]
- },
- { // A, D, F.
- id: '#26',
- title: ['A', 'D', 'F'],
- values: [
- {
- total: b(0, 9),
- self: b(9),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#11' // A -> B, D, F.
- ],
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, *, E.
- id: '#27',
- title: ['A', undefined, 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 15, 16),
- self: b(16),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#12' // A -> B, *, E.
- ],
- [
- '#20', // A, C, E.
- '#24' // A, D, E.
- ],
- [
- { // A, *, E -> F.
- id: '#28',
- title: ['A', undefined, 'F'],
- values: [
- {
- total: b(0, 3, 6, 9, 12, 15),
- self: b(15),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#13' // A -> B, *, E -> F.
- ],
- [
- '#21', // A, C, E -> F.
- '#25' // A, D, E -> F.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // A, *, F.
- id: '#29',
- title: ['A', undefined, 'F'],
- values: [
- {
- total: b(0, 3, 6, 9, 12, 15),
- self: b(15),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#14' // A -> B, *, F.
- ],
- [
- '#22', // A, C, F.
- '#26' // A, D, F.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // B, *, *.
- title: ['B', undefined, undefined],
- values: [
- {
- total: b([0, 8]),
- self: b(8),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B, C, *.
- id: '#30',
- title: ['B', 'C', undefined],
- values: [
- {
- total: b([0, 5]),
- self: b(5),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B, C -> D, *.
- id: '#31',
- title: ['B', 'D', undefined],
- values: [
- {
- total: b([0, 2]),
- self: b(2),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // B, C -> D, E.
- id: '#32',
- title: ['B', 'D', 'E'],
- values: [
- {
- total: b(0, 1),
- self: b(1),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // B, C -> D, E -> F.
- id: '#33',
- title: ['B', 'D', 'F'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- },
- { // B, C -> D, F.
- id: '#34',
- title: ['B', 'D', 'F'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B, C, E.
- id: '#35',
- title: ['B', 'C', 'E'],
- values: [
- {
- total: b(0, 1, 3, 4),
- self: b(4),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#32' // B, C -> D, E.
- ],
- [
- { // B, C, E -> F.
- id: '#36',
- title: ['B', 'C', 'F'],
- values: [
- {
- total: b(0, 3),
- self: b(3),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#33' // B, C -> D, E -> F.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // B, C, F.
- id: '#37',
- title: ['B', 'C', 'F'],
- values: [
- {
- total: b(0, 3),
- self: b(3),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#34' // B, C -> D, F.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // B, D, *.
- id: '#38',
- title: ['B', 'D', undefined],
- values: [
- {
- total: b([0, 2]),
- self: b(2),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // B, D, E.
- id: '#39',
- title: ['B', 'D', 'E'],
- values: [
- {
- total: b(0, 1),
- self: b(1),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // B, D, E -> F.
- id: '#40',
- title: ['B', 'D', 'F'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- },
- { // B, D, F.
- id: '#41',
- title: ['B', 'D', 'F'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B, *, E.
- id: '#42',
- title: ['B', undefined, 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 6, 7),
- self: b(7),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#35', // B, C, E.
- '#39' // B, D, E.
- ],
- [
- { // B, *, E -> F.
- id: '#43',
- title: ['B', undefined, 'F'],
- values: [
- {
- total: b(0, 3, 6),
- self: b(6),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#36', // B, C, E -> F.
- '#40' // B, D, E -> F.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // B, *, F.
- id: '#44',
- title: ['B', undefined, 'F'],
- values: [
- {
- total: b(0, 3, 6),
- self: b(6),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#37', // B, C, F.
- '#41' // B, D, F.
- ],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, C, *.
- title: [undefined, 'C', undefined],
- values: [
- {
- total: b([0, 5], [9, 14], [18, 23]),
- self: b(23),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#15', // A, C, *.
- '#30' // B, C, *.
- ],
- [
- { // *, C -> D, *.
- title: [undefined, 'D', undefined],
- values: [
- {
- total: b([0, 2], [9, 11], [18, 20]),
- self: b(20),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#16', // A, C -> D, *.
- '#31' // B, C -> D, *.
- ],
- [],
- [
- { // *, C -> D, E.
- id: '#45',
- title: [undefined, 'D', 'E'],
- values: [
- {
- total: b(0, 1, 9, 10, 18, 19),
- self: b(19),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#17', // A, C -> D, E.
- '#32' // B, C -> D, E.
- ],
- [],
- [
- { // *, C -> D, E -> F.
- id: '#46',
- title: [undefined, 'D', 'F'],
- values: [
- {
- total: b(0, 9, 18),
- self: b(18),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#18', // A, C -> D, E -> F.
- '#33' // B, C -> D, E -> F.
- ],
- [],
- []
- ]
- }
- ]
- ]
- },
- { // *, C -> D, F.
- id: '#47',
- title: [undefined, 'D', 'F'],
- values: [
- {
- total: b(0, 9, 18),
- self: b(18),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#19', // A, C -> D, F.
- '#34' // B, C -> D, F.
- ],
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, C, E.
- id: '#48',
- title: [undefined, 'C', 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 9, 10, 12, 13, 18, 19, 21, 22),
- self: b(22),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#20', // A, C, E.
- '#35' // B, C, E.
- ],
- [
- '#45' // *, C -> D, E.
- ],
- [
- { // *, C, E -> F.
- id: '#49',
- title: [undefined, 'C', 'F'],
- values: [
- {
- total: b(0, 3, 9, 12, 18, 21),
- self: b(21),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#21', // A, C, E -> F.
- '#36' // B, C, E -> F.
- ],
- [
- '#46' // *, C -> D, E -> F.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // *, C, F.
- id: '#50',
- title: [undefined, 'C', 'F'],
- values: [
- {
- total: b(0, 3, 9, 12, 18, 21),
- self: b(21),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#22', // A, C, F.
- '#37' // B, C, F.
- ],
- [
- '#47' // *, C -> D, F.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // *, D, *.
- title: [undefined, 'D', undefined],
- values: [
- {
- total: b([0, 2], [9, 11], [18, 20]),
- self: b(20),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#23', // A, D, *.
- '#38' // B, D, *.
- ],
- [],
- [
- { // *, D, E.
- id: '#51',
- title: [undefined, 'D', 'E'],
- values: [
- {
- total: b(0, 1, 9, 10, 18, 19),
- self: b(19),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#24', // A, D, E.
- '#39' // B, D, E.
- ],
- [],
- [
- { // *, D, E -> F.
- id: '#52',
- title: [undefined, 'D', 'F'],
- values: [
- {
- total: b(0, 9, 18),
- self: b(18),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#25', // A, D, E -> F.
- '#40' // B, D, E -> F.
- ],
- [],
- []
- ]
- }
- ]
- ]
- },
- { // *, D, F.
- id: '#53',
- title: [undefined, 'D', 'F'],
- values: [
- {
- total: b(0, 9, 18),
- self: b(18),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#26', // A, D, F.
- '#41' // B, D, F.
- ],
- [],
- []
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, *, E.
- title: [undefined, undefined, 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 15, 16, 18, 19, 21,
- 22, 24, 25),
- self: b(25),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#27', // A, *, E.
- '#42' // B, *, E.
- ],
- [
- '#48', // *, C, E.
- '#51' // *, D, E.
- ],
- [
- { // *, *, E -> F.
- title: [undefined, undefined, 'F'],
- values: [
- {
- total: b(0, 3, 6, 9, 12, 15, 18, 21, 24),
- self: b(24),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#28', // A, *, E -> F.
- '#43' // B, *, E -> F.
- ],
- [
- '#49', // *, C, E -> F.
- '#52' // *, D, E -> F.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // *, *, F.
- title: [undefined, undefined, 'F'],
- values: [
- {
- total: b(0, 3, 6, 9, 12, 15, 18, 21, 24),
- self: b(24),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#29', // A, *, F.
- '#44' // B, *, F.
- ],
- [
- '#50', // *, C, F.
- '#53' // *, D, F.
- ],
- []
- ]
- }
- ]
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined, undefined, undefined],
- values: [
- {
- total: b([0, 26]),
- self: b(26),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A, *, *.
- title: ['A', undefined, undefined],
- values: [
- {
- total: b([0, 17]),
- self: b(17),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A, C, *.
- id: '#0',
- title: ['A', 'C', undefined],
- values: [
- {
- total: b([0, 5], [9, 14]),
- self: b(14),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // A, C, E.
- id: '#1',
- title: ['A', 'C', 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 9, 10, 12, 13),
- self: b(13),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // A, C, F.
- id: '#2',
- title: ['A', 'C', 'F'],
- values: [
- {
- total: b(0, 3, 9, 12),
- self: b(12),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // A, C, F -> E.
- id: '#3',
- title: ['A', 'C', 'E'],
- values: [
- {
- total: b(0, 3, 9, 12),
- self: b(12),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // A, D, *.
- id: '#4',
- title: ['A', 'D', undefined],
- values: [
- {
- total: b([0, 2], [9, 11]),
- self: b(11),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // A, D -> C, *.
- id: '#5',
- title: ['A', 'C', undefined],
- values: [
- {
- total: b([0, 2], [9, 11]),
- self: b(11),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // A, D -> C, E.
- id: '#6',
- title: ['A', 'C', 'E'],
- values: [
- {
- total: b(0, 1, 9, 10),
- self: b(10),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // A, D -> C, F.
- id: '#7',
- title: ['A', 'C', 'F'],
- values: [
- {
- total: b(0, 9),
- self: b(9),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // A, D -> C, F -> E.
- id: '#8',
- title: ['A', 'C', 'E'],
- values: [
- {
- total: b(0, 9),
- self: b(9),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, D, E.
- id: '#9',
- title: ['A', 'D', 'E'],
- values: [
- {
- total: b(0, 1, 9, 10),
- self: b(10),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#6' // A, D -> C, E.
- ],
- []
- ]
- },
- { // A, D, F.
- id: '#10',
- title: ['A', 'D', 'F'],
- values: [
- {
- total: b(0, 9),
- self: b(9),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#7' // A, D -> C, F.
- ],
- [
- { // A, D, F -> E.
- id: '#11',
- title: ['A', 'D', 'E'],
- values: [
- {
- total: b(0, 9),
- self: b(9),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#8' // A, D -> C, F -> E.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // A, *, E.
- id: '#12',
- title: ['A', undefined, 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 15, 16),
- self: b(16),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#1', // A, C, E.
- '#9' // A, D, E.
- ],
- []
- ]
- },
- { // A, *, F.
- id: '#13',
- title: ['A', undefined, 'F'],
- values: [
- {
- total: b(0, 3, 6, 9, 12, 15),
- self: b(15),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#2', // A, C, F.
- '#10' // A, D, F.
- ],
- [
- { // A, *, F -> E.
- id: '#14',
- title: ['A', undefined, 'E'],
- values: [
- {
- total: b(0, 3, 6, 9, 12, 15),
- self: b(15),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#3', // A, C, F -> E.
- '#11' // A, D, F -> E.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B, *, *.
- title: ['B', undefined, undefined],
- values: [
- {
- total: b([0, 8]),
- self: b(8),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // B -> A, *, *.
- title: ['A', undefined, undefined],
- values: [
- {
- total: b([0, 8]),
- self: b(8),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> A, C, *.
- id: '#15',
- title: ['A', 'C', undefined],
- values: [
- {
- total: b([0, 5]),
- self: b(5),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // B -> A, C, E.
- id: '#16',
- title: ['A', 'C', 'E'],
- values: [
- {
- total: b(0, 1, 3, 4),
- self: b(4),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // B -> A, C, F.
- id: '#17',
- title: ['A', 'C', 'F'],
- values: [
- {
- total: b(0, 3),
- self: b(3),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // B -> A, C, F -> E.
- id: '#18',
- title: ['A', 'C', 'E'],
- values: [
- {
- total: b(0, 3),
- self: b(3),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B -> A, D, *.
- id: '#19',
- title: ['A', 'D', undefined],
- values: [
- {
- total: b([0, 2]),
- self: b(2),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- { // B -> A, D -> C, *.
- id: '#20',
- title: ['A', 'C', undefined],
- values: [
- {
- total: b([0, 2]),
- self: b(2),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // B -> A, D -> C, E.
- id: '#21',
- title: ['A', 'C', 'E'],
- values: [
- {
- total: b(0, 1),
- self: b(1),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // B -> A, D -> C, F.
- id: '#22',
- title: ['A', 'C', 'F'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- [
- { // B -> A, D -> C, F -> E.
- id: '#23',
- title: ['A', 'C', 'E'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B -> A, D, E.
- id: '#24',
- title: ['A', 'D', 'E'],
- values: [
- {
- total: b(0, 1),
- self: b(1),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#21' // B -> A, D -> C, E.
- ],
- []
- ]
- },
- { // B -> A, D, F.
- id: '#25',
- title: ['A', 'D', 'F'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#22' // B -> A, D -> C, F.
- ],
- [
- { // B -> A, D, F -> E.
- id: '#26',
- title: ['A', 'D', 'E'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#23' // B -> A, D -> C, F -> E.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B -> A, *, E.
- id: '#27',
- title: ['A', undefined, 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 6, 7),
- self: b(7),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#16', // B -> A, C, E.
- '#24' // B -> A, D, E.
- ],
- []
- ]
- },
- { // B -> A, *, F.
- id: '#28',
- title: ['A', undefined, 'F'],
- values: [
- {
- total: b(0, 3, 6),
- self: b(6),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#17', // B -> A, C, F.
- '#25' // B -> A, D, F.
- ],
- [
- { // B -> A, *, F -> E.
- id: '#29',
- title: ['A', undefined, 'E'],
- values: [
- {
- total: b(0, 3, 6),
- self: b(6),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [
- '#18', // B -> A, C, F -> E.
- '#26' // B -> A, D, F -> E.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B, C, *.
- id: '#30',
- title: ['B', 'C', undefined],
- values: [
- {
- total: b([0, 5]),
- self: b(5),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#15' // B -> A, C, *.
- ],
- [],
- [
- { // B, C, E.
- id: '#31',
- title: ['B', 'C', 'E'],
- values: [
- {
- total: b(0, 1, 3, 4),
- self: b(4),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#16' // B -> A, C, E.
- ],
- [],
- []
- ]
- },
- { // B, C, F.
- id: '#32',
- title: ['B', 'C', 'F'],
- values: [
- {
- total: b(0, 3),
- self: b(3),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#17' // B -> A, C, F.
- ],
- [],
- [
- { // B, C, F -> E.
- id: '#33',
- title: ['B', 'C', 'E'],
- values: [
- {
- total: b(0, 3),
- self: b(3),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#18' // B -> A, C, F -> E.
- ],
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // B, D, *.
- id: '#34',
- title: ['B', 'D', undefined],
- values: [
- {
- total: b([0, 2]),
- self: b(2),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#19' // B -> A, D, *.
- ],
- [
- { // B, D -> C, *.
- id: '#35',
- title: ['B', 'C', undefined],
- values: [
- {
- total: b([0, 2]),
- self: b(2),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#20' // B -> A, D -> C, *.
- ],
- [],
- [
- { // B, D -> C, E.
- id: '#36',
- title: ['B', 'C', 'E'],
- values: [
- {
- total: b(0, 1),
- self: b(1),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#21' // B -> A, D -> C, E.
- ],
- [],
- []
- ]
- },
- { // B, D -> C, F.
- id: '#37',
- title: ['B', 'C', 'F'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#22' // B -> A, D -> C, F.
- ],
- [],
- [
- { // B, D -> C, F -> E.
- id: '#38',
- title: ['B', 'C', 'E'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#23' // B -> A, D -> C, F -> E.
- ],
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B, D, E.
- id: '#39',
- title: ['B', 'D', 'E'],
- values: [
- {
- total: b(0, 1),
- self: b(1),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#24' // B -> A, D, E.
- ],
- [
- '#36' // B, D -> C, E.
- ],
- []
- ]
- },
- { // B, D, F.
- id: '#40',
- title: ['B', 'D', 'F'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#25' // B -> A, D, F.
- ],
- [
- '#37' // B, D -> C, F.
- ],
- [
- { // B, D, F -> E.
- id: '#41',
- title: ['B', 'D', 'E'],
- values: [
- {
- total: b(0),
- self: b(0),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#26' // B -> A, D, F -> E.
- ],
- [
- '#38' // B, D -> C, F -> E.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // B, *, E.
- id: '#42',
- title: ['B', undefined, 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 6, 7),
- self: b(7),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#27' // B -> A, *, E.
- ],
- [
- '#31', // B, C, E.
- '#39' // B, D, E.
- ],
- []
- ]
- },
- { // B, *, F.
- id: '#43',
- title: ['B', undefined, 'F'],
- values: [
- {
- total: b(0, 3, 6),
- self: b(6),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#28' // B -> A, *, F.
- ],
- [
- '#32', // B, C, F.
- '#40' // B, D, F.
- ],
- [
- { // B, *, F -> E.
- id: '#44',
- title: ['B', undefined, 'E'],
- values: [
- {
- total: b(0, 3, 6),
- self: b(6),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#29' // B -> A, *, F -> E.
- ],
- [
- '#33', // B, C, F -> E.
- '#41' // B, D, F -> E.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, C, *.
- title: [undefined, 'C', undefined],
- values: [
- {
- total: b([0, 5], [9, 14], [18, 23]),
- self: b(23),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#0', // A, C, *.
- '#30' // B, C, *.
- ],
- [],
- [
- { // *, C, E.
- id: '#45',
- title: [undefined, 'C', 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 9, 10, 12, 13, 18, 19, 21, 22),
- self: b(22),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#1', // A, C, E.
- '#31' // B, C, E.
- ],
- [],
- []
- ]
- },
- { // *, C, F.
- id: '#46',
- title: [undefined, 'C', 'F'],
- values: [
- {
- total: b(0, 3, 9, 12, 18, 21),
- self: b(21),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#2', // A, C, F.
- '#32' // B, C, F.
- ],
- [],
- [
- { // *, C, F -> E.
- id: '#47',
- title: [undefined, 'C', 'E'],
- values: [
- {
- total: b(0, 3, 9, 12, 18, 21),
- self: b(21),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#3', // A, C, F -> E.
- '#33' // B, C, F -> E.
- ],
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- },
- { // *, D, *.
- title: [undefined, 'D', undefined],
- values: [
- {
- total: b([0, 2], [9, 11], [18, 20]),
- self: b(20),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#4', // A, D, *.
- '#34' // B, D, *.
- ],
- [
- { // *, D -> C, *.
- title: [undefined, 'C', undefined],
- values: [
- {
- total: b([0, 2], [9, 11], [18, 20]),
- self: b(20),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#5', // A, D -> C, *.
- '#35' // B, D -> C, *.
- ],
- [],
- [
- { // *, D -> C, E.
- id: '#48',
- title: [undefined, 'C', 'E'],
- values: [
- {
- total: b(0, 1, 9, 10, 18, 19),
- self: b(19),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#6', // A, D -> C, E.
- '#36' // B, D -> C, E.
- ],
- [],
- []
- ]
- },
- { // *, D -> C, F.
- id: '#49',
- title: [undefined, 'C', 'F'],
- values: [
- {
- total: b(0, 9, 18),
- self: b(18),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#7', // A, D -> C, F.
- '#37' // B, D -> C, F.
- ],
- [],
- [
- { // *, D -> C, F -> E.
- id: '#50',
- title: [undefined, 'C', 'E'],
- values: [
- {
- total: b(0, 9, 18),
- self: b(18),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#8', // A, D -> C, F -> E.
- '#38' // B, D -> C, F -> E.
- ],
- [],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, D, E.
- id: '#51',
- title: [undefined, 'D', 'E'],
- values: [
- {
- total: b(0, 1, 9, 10, 18, 19),
- self: b(19),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#9', // A, D, E.
- '#39' // B, D, E.
- ],
- [
- '#48' // *, D -> C, E.
- ],
- []
- ]
- },
- { // *, D, F.
- id: '#52',
- title: [undefined, 'D', 'F'],
- values: [
- {
- total: b(0, 9, 18),
- self: b(18),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#10', // A, D, F.
- '#40' // B, D, F.
- ],
- [
- '#49' // *, D -> C, F.
- ],
- [
- { // *, D, F -> E.
- id: '#53',
- title: [undefined, 'D', 'E'],
- values: [
- {
- total: b(0, 9, 18),
- self: b(18),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#11', // A, D, F -> E.
- '#41' // B, D, F -> E.
- ],
- [
- '#50' // *, D -> C, F -> E.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- }
- ],
- [
- { // *, *, E.
- title: [undefined, undefined, 'E'],
- values: [
- {
- total: b(0, 1, 3, 4, 6, 7, 9, 10, 12, 13, 15, 16, 18, 19, 21,
- 22, 24, 25),
- self: b(25),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#12', // A, *, E.
- '#42' // B, *, E.
- ],
- [
- '#45', // *, C, E.
- '#51' // *, D, E.
- ],
- []
- ]
- },
- { // *, *, F.
- title: [undefined, undefined, 'F'],
- values: [
- {
- total: b(0, 3, 6, 9, 12, 15, 18, 21, 24),
- self: b(24),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#13', // A, *, F.
- '#43' // B, *, F.
- ],
- [
- '#46', // *, C, F.
- '#52' // *, D, F.
- ],
- [
- { // *, *, F -> E.
- title: [undefined, undefined, 'E'],
- values: [
- {
- total: b(0, 3, 6, 9, 12, 15, 18, 21, 24),
- self: b(24),
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- '#14', // A, *, F -> E.
- '#44' // B, *, F -> E.
- ],
- [
- '#47', // *, C, F -> E.
- '#53' // *, D, F -> E.
- ],
- []
- ]
- }
- ]
- ]
- }
- ]
- ]
- });
-
- builderTest('threeDimensions_twoValues', 3 /* dimensions */,
- 2 /* valueCount */,
- [
- { path: [[], [], []], values: [1, 89], kind: SELF },
- { path: [['A'], [], []], values: [2, 34], kind: SELF },
- { path: [['A'], [], []], values: [4, 55], kind: TOTAL },
- { path: [['B'], [], []], values: [undefined, 13], kind: SELF },
- { path: [['B'], [], []], values: [16, 21], kind: TOTAL },
- { path: [[], ['1'], []], values: [32, undefined], kind: SELF },
- { path: [[], ['1'], []], values: [64, 8], kind: TOTAL },
- { path: [[], ['2'], []], values: [128, 2], kind: SELF },
- { path: [[], ['2'], []], values: [undefined, undefined], kind: TOTAL },
- { path: [[], [], ['%']], values: [undefined, 1], kind: TOTAL },
- { path: [[], [], ['$']], values: [1024, undefined], kind: TOTAL },
- { path: [[], [], ['@']], values: [undefined, undefined], kind: SELF }
- ],
- { // Top-down tree view.
- title: [undefined, undefined, undefined],
- values: [
- {
- total: (1 + 2 + 32 + 128) /* selfSum([[], [], []], 0) */ +
- 1024 /* minResidual([[], [], []], 0) */,
- self: 1,
- totalState: LOWER_BOUND
- },
- {
- total: (89 + 34 + 13 + 2) /* selfSum([[], [], []], 1) */ +
- ((55 - 34) + (21 - 13)) /* maxResidual([[], [], []], 1) */,
- self: 89,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A, *, *.
- title: ['A', undefined, undefined],
- values: [
- {
- total: 4,
- self: 2,
- totalState: EXACT
- },
- {
- total: 55,
- self: 34,
- totalState: EXACT
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // B, *, *.
- title: ['B', undefined, undefined],
- values: [
- {
- total: 16,
- self: 0,
- totalState: EXACT
- },
- {
- total: 21,
- self: 13,
- totalState: EXACT
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ],
- [
- { // *, 1, *.
- title: [undefined, '1', undefined],
- values: [
- {
- total: 64,
- self: 32,
- totalState: EXACT
- },
- {
- total: 8,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // *, 2, *.
- title: [undefined, '2', undefined],
- values: [
- {
- total: 128,
- self: 128,
- totalState: LOWER_BOUND
- },
- {
- total: 2,
- self: 2,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ],
- [
- { // *, *, %.
- title: [undefined, undefined, '%'],
- values: [
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- },
- {
- total: 1,
- self: 0,
- totalState: EXACT
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // *, *, $.
- title: [undefined, undefined, '$'],
- values: [
- {
- total: 1024,
- self: 0,
- totalState: EXACT
- },
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // *, *, @.
- title: [undefined, undefined, '@'],
- values: [
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- },
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- },
- { // Top-down heavy view.
- title: [undefined, undefined, undefined],
- values: [
- {
- total: 1187,
- self: 1,
- totalState: LOWER_BOUND
- },
- {
- total: 167,
- self: 89,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A, *, *.
- title: ['A', undefined, undefined],
- values: [
- {
- total: 4,
- self: 2,
- totalState: LOWER_BOUND
- },
- {
- total: 55,
- self: 34,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // B, *, *.
- title: ['B', undefined, undefined],
- values: [
- {
- total: 16,
- self: 0,
- totalState: LOWER_BOUND
- },
- {
- total: 21,
- self: 13,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ],
- [
- { // *, 1, *.
- title: [undefined, '1', undefined],
- values: [
- {
- total: 64,
- self: 32,
- totalState: LOWER_BOUND
- },
- {
- total: 8,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // *, 2, *.
- title: [undefined, '2', undefined],
- values: [
- {
- total: 128,
- self: 128,
- totalState: LOWER_BOUND
- },
- {
- total: 2,
- self: 2,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ],
- [
- { // *, *, %.
- title: [undefined, undefined, '%'],
- values: [
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- },
- {
- total: 1,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // *, *, $.
- title: [undefined, undefined, '$'],
- values: [
- {
- total: 1024,
- self: 0,
- totalState: LOWER_BOUND
- },
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // *, *, @.
- title: [undefined, undefined, '@'],
- values: [
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- },
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- },
- { // Bottom-up heavy view.
- title: [undefined, undefined, undefined],
- values: [
- {
- total: 1187,
- self: 1,
- totalState: LOWER_BOUND
- },
- {
- total: 167,
- self: 89,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [
- { // A, *, *.
- title: ['A', undefined, undefined],
- values: [
- {
- total: 4,
- self: 2,
- totalState: LOWER_BOUND
- },
- {
- total: 55,
- self: 34,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // B, *, *.
- title: ['B', undefined, undefined],
- values: [
- {
- total: 16,
- self: 0,
- totalState: LOWER_BOUND
- },
- {
- total: 21,
- self: 13,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ],
- [
- { // *, 1, *.
- title: [undefined, '1', undefined],
- values: [
- {
- total: 64,
- self: 32,
- totalState: LOWER_BOUND
- },
- {
- total: 8,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // *, 2, *.
- title: [undefined, '2', undefined],
- values: [
- {
- total: 128,
- self: 128,
- totalState: LOWER_BOUND
- },
- {
- total: 2,
- self: 2,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ],
- [
- { // *, *, %.
- title: [undefined, undefined, '%'],
- values: [
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- },
- {
- total: 1,
- self: 0,
- totalState: LOWER_BOUND
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // *, *, $.
- title: [undefined, undefined, '$'],
- values: [
- {
- total: 1024,
- self: 0,
- totalState: LOWER_BOUND
- },
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- }
- ],
- children: [
- [],
- [],
- []
- ]
- },
- { // *, *, @.
- title: [undefined, undefined, '@'],
- values: [
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- },
- {
- total: 0,
- self: 0,
- totalState: NOT_PROVIDED
- }
- ],
- children: [
- [],
- [],
- []
- ]
- }
- ]
- ]
- });
-
- test('recursionDepthTracker', function() {
- var MAX_DEPTH = 5;
- var tracker = new RecursionDepthTracker(MAX_DEPTH, 2 /* dimension */);
-
- function pushNewNode(title) {
- var node = new MultiDimensionalViewNode(
- [undefined, 'ignored dimension', title, 'also ignored'],
- 1 /* valueCount (not relevant for this test) */);
- tracker.push(node);
- return node;
- }
-
- function checkTracker(expectedDefinedViewNodePath, expectedRecursionDepth) {
- var expectedBottomIndex = MAX_DEPTH - expectedDefinedViewNodePath.length;
- assert.strictEqual(tracker.bottomIndex, expectedBottomIndex);
- assert.strictEqual(tracker.topIndex, MAX_DEPTH);
-
- var undefinedPadding = new Array(expectedBottomIndex);
- var expectedViewNodePath =
- undefinedPadding.concat(expectedDefinedViewNodePath);
- var expectedTitlePath =
- undefinedPadding.concat(expectedDefinedViewNodePath.map(
- function(node) { return node.title[2]; }));
- assertListStrictEqual(tracker.viewNodePath, expectedViewNodePath);
- assertListStrictEqual(tracker.titlePath, expectedTitlePath);
-
- assert.strictEqual(tracker.recursionDepth, expectedRecursionDepth);
- }
-
- checkTracker([] /* empty stack */, 0);
- var a1 = pushNewNode('A');
- checkTracker([a1], 0);
- var b1 = pushNewNode('B');
- checkTracker([b1, a1], 0);
- var c1 = pushNewNode('C');
- checkTracker([c1, b1, a1], 0);
- var d1 = pushNewNode('D');
- checkTracker([d1, c1, b1, a1], 0);
- tracker.pop();
- checkTracker([c1, b1, a1], 0);
- var a2 = pushNewNode('A');
- checkTracker([a2, c1, b1, a1], 1);
- var b2 = pushNewNode('B');
- checkTracker([b2, a2, c1, b1, a1], 2);
- tracker.pop();
- checkTracker([a2, c1, b1, a1], 1);
- tracker.pop();
- checkTracker([c1, b1, a1], 0);
- tracker.push(b2);
- checkTracker([b2, c1, b1, a1], 1);
- tracker.pop();
- checkTracker([c1, b1, a1], 0);
- tracker.pop();
- checkTracker([b1, a1], 0);
- tracker.pop();
- checkTracker([a1], 0);
- var a3 = pushNewNode('A');
- checkTracker([a3, a1], 1);
- tracker.push(a2);
- checkTracker([a2, a3, a1], 2);
- var a4 = pushNewNode('A');
- checkTracker([a4, a2, a3, a1], 3);
- tracker.pop();
- checkTracker([a2, a3, a1], 2);
- var b3 = pushNewNode('B');
- checkTracker([b3, a2, a3, a1], 0);
- tracker.push(a4);
- checkTracker([a4, b3, a2, a3, a1], 1);
- tracker.pop();
- checkTracker([b3, a2, a3, a1], 0);
- tracker.pop();
- checkTracker([a2, a3, a1], 2);
- tracker.pop();
- checkTracker([a3, a1], 1);
- tracker.pop();
- checkTracker([a1], 0);
- tracker.pop();
- checkTracker([], 0);
- tracker.push(a4);
- checkTracker([a4], 0);
- tracker.push(b1);
- checkTracker([b1, a4], 0);
- tracker.push(a1);
- checkTracker([a1, b1, a4], 1);
- tracker.pop();
- checkTracker([b1, a4], 0);
- var c2 = pushNewNode('C');
- checkTracker([c2, b1, a4], 0);
- tracker.push(a3);
- checkTracker([a3, c2, b1, a4], 1);
- tracker.pop();
- checkTracker([c2, b1, a4], 0);
- tracker.pop();
- checkTracker([b1, a4], 0);
- tracker.pop();
- checkTracker([a4], 0);
- tracker.pop();
- checkTracker([], 0);
-
- assert.throws(function() {
- // Try popping from an empty tracker.
- tracker.pop();
- });
-
- pushNewNode('F');
- pushNewNode('U');
- pushNewNode('L');
- pushNewNode('L');
- pushNewNode('!');
- assert.throws(function() {
- // Try pushing to a full tracker.
- pushNewNode(':-(');
- });
- });
-
- test('zFunction', function() {
- // Empty list/string (suffix).
- assert.deepEqual(zFunction([], 0), []);
- assert.deepEqual(zFunction(['A'], 1), []);
- assert.deepEqual(zFunction(['A', 'B', 'C'], 3), []);
- assert.deepEqual(zFunction('', 0), []);
- assert.deepEqual(zFunction('A', 1), []);
- assert.deepEqual(zFunction('ABC', 3), []);
-
- // Singleton list/string.
- checkZFunction([1], [0]);
- checkZFunction('T', [0]);
-
- // No duplicate elements.
- checkZFunction([1, 2, 3, 4, 5], [0, 0, 0, 0, 0]);
- checkZFunction('ABCDEF', [0, 0, 0, 0, 0, 0]);
-
- // No substring is a suffix.
- checkZFunction([1, 2, 3, 2], [0, 0, 0, 0]);
- checkZFunction('ABBB', [0, 0, 0, 0]);
-
- // Pure repetition.
- checkZFunction([1, 1, 1, 1, 1], [0, 4, 3, 2, 1]);
- checkZFunction('AAAAA', [0, 4, 3, 2, 1]);
-
- // Interleaved repetition.
- checkZFunction([1, 2, 1, 3, 1, 2, 1], [0, 0, 1, 0, 3, 0, 1]);
- checkZFunction('AAABAAB', [0, 2, 1, 0, 2, 1, 0]);
-
- // Complex patterns.
- checkZFunction([7, 9, 7, 9, 7, 9, 7, 9], [0, 0, 6, 0, 4, 0, 2, 0]);
- checkZFunction('CCGTCCCGTACC', [0, 1, 0, 0, 2, 4, 1, 0, 0, 0, 2, 1]);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/piecewise_linear_function.html b/chromium/third_party/catapult/tracing/tracing/base/piecewise_linear_function.html
deleted file mode 100644
index 9ed89349f69..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/piecewise_linear_function.html
+++ /dev/null
@@ -1,143 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
- var PERCENTILE_PRECISION = 1e-7;
- /**
- * A function that consists of linear pieces.
- * See https://en.wikipedia.org/wiki/Piecewise_linear_function.
- * @constructor
- */
- function PiecewiseLinearFunction() {
- this.pieces = [];
- }
-
- PiecewiseLinearFunction.prototype = {
- /**
- * Push a linear piece defined by linear interpolation between.
- * (x1, y1) and (x2, y2).
- * Pieces must be pushed in the order of increasing x coordinate.
- */
- push: function(x1, y1, x2, y2) {
- if (x1 >= x2)
- throw new Error('Invalid segment');
- if (this.pieces.length > 0 &&
- this.pieces[this.pieces.length - 1].x2 > x1) {
- throw new Error('Potentially overlapping segments');
- }
- if (x1 < x2)
- this.pieces.push(new Piece(x1, y1, x2, y2));
- },
-
- /**
- * Returns the size of the set A such that for all x in A: f(x) < y.
- */
- partBelow: function(y) {
- return this.pieces.reduce((acc, p) => (acc + p.partBelow(y)), 0);
- },
-
- get min() {
- return this.pieces.reduce((acc, p) => Math.min(acc, p.min), Infinity);
- },
-
- get max() {
- return this.pieces.reduce((acc, p) => Math.max(acc, p.max), -Infinity);
- },
-
- get average() {
- var weightedSum = 0;
- var totalWeight = 0;
- this.pieces.forEach(function(piece) {
- weightedSum += piece.width * piece.average;
- totalWeight += piece.width;
- });
- if (totalWeight === 0)
- return 0;
- return weightedSum / totalWeight;
- },
-
- /**
- * Returns the minimum possible value y such that the percentage of x points
- * that have f(x) <= y is approximately equal to the given |percent|.
- */
- percentile: function(percent) {
- if (!(percent >= 0 && percent <= 1))
- throw new Error('percent must be [0,1]');
- var lower = this.min;
- var upper = this.max;
- var total = this.partBelow(upper);
- if (total === 0)
- return 0;
- while (upper - lower > PERCENTILE_PRECISION) {
- var middle = (lower + upper) / 2;
- var below = this.partBelow(middle);
- if (below / total < percent)
- lower = middle;
- else
- upper = middle;
- }
- return (lower + upper) / 2;
- }
- };
-
- /**
- * A linear segment from (x1, y1) to (x2, y2).
- * @constructor
- */
- function Piece(x1, y1, x2, y2) {
- this.x1 = x1;
- this.y1 = y1;
- this.x2 = x2;
- this.y2 = y2;
- }
-
- Piece.prototype = {
- /**
- * The total length of all x points such that f(x) < y.
- * More formally:
- * max(x2 - x1) such that for all x in [x1 .. x2]: f(x) < y.
- */
- partBelow: function(y) {
- var width = this.width;
- if (width === 0)
- return 0;
- var minY = this.min;
- var maxY = this.max;
- if (y >= maxY)
- return width;
- if (y < minY)
- return 0;
- return (y - minY) / (maxY - minY) * width;
- },
-
- get min() {
- return Math.min(this.y1, this.y2);
- },
-
- get max() {
- return Math.max(this.y1, this.y2);
- },
-
- get average() {
- return (this.y1 + this.y2) / 2;
- },
-
- get width() {
- return this.x2 - this.x1;
- }
- };
-
- return {
- PiecewiseLinearFunction: PiecewiseLinearFunction
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/piecewise_linear_function_test.html b/chromium/third_party/catapult/tracing/tracing/base/piecewise_linear_function_test.html
deleted file mode 100644
index 7b36d7d256c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/piecewise_linear_function_test.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/piecewise_linear_function.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('PiecewiseLinearFunctionEmpty', function() {
- var f = new tr.b.PiecewiseLinearFunction();
- assert.strictEqual(f.max, -Infinity);
- assert.strictEqual(f.min, Infinity);
- assert.strictEqual(f.average, 0);
- assert.strictEqual(f.percentile(0.5), 0);
- });
-
- test('PiecewiseLinearFunction', function() {
- var f = new tr.b.PiecewiseLinearFunction();
- f.push(0, 0.0, 10, 1.0);
- f.push(10, 1.0, 20, 0.0);
- f.push(20, 0.0, 30, 0.0);
- assert.strictEqual(f.max, 1.0);
- assert.strictEqual(f.min, 0.0);
- assert.closeTo(f.average, 20 * 1 / 2.0 / 30, 1e-6);
- assert.closeTo(f.percentile(1.0 / 3.0), 0.0, 1e-6);
- assert.closeTo(f.percentile(2.0 / 3.0), 0.5, 1e-6);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/quad.html b/chromium/third_party/catapult/tracing/tracing/base/quad.html
deleted file mode 100644
index 0a1b4695886..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/quad.html
+++ /dev/null
@@ -1,232 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/math.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
- var tmpVec2s = [];
- for (var i = 0; i < 8; i++)
- tmpVec2s[i] = vec2.create();
-
- var tmpVec2a = vec4.create();
- var tmpVec4a = vec4.create();
- var tmpVec4b = vec4.create();
- var tmpMat4 = mat4.create();
- var tmpMat4b = mat4.create();
-
- var p00 = vec2.createXY(0, 0);
- var p10 = vec2.createXY(1, 0);
- var p01 = vec2.createXY(0, 1);
- var p11 = vec2.createXY(1, 1);
-
- var lerpingVecA = vec2.create();
- var lerpingVecB = vec2.create();
- function lerpVec2(out, a, b, amt) {
- vec2.scale(lerpingVecA, a, amt);
- vec2.scale(lerpingVecB, b, 1 - amt);
- vec2.add(out, lerpingVecA, lerpingVecB);
- vec2.normalize(out, out);
- return out;
- }
-
- /**
- * @constructor
- */
- function Quad() {
- this.p1 = vec2.create();
- this.p2 = vec2.create();
- this.p3 = vec2.create();
- this.p4 = vec2.create();
- }
-
- Quad.fromXYWH = function(x, y, w, h) {
- var q = new Quad();
- vec2.set(q.p1, x, y);
- vec2.set(q.p2, x + w, y);
- vec2.set(q.p3, x + w, y + h);
- vec2.set(q.p4, x, y + h);
- return q;
- }
-
- Quad.fromRect = function(r) {
- return new Quad.fromXYWH(
- r.x, r.y,
- r.width, r.height);
- }
-
- Quad.from4Vecs = function(p1, p2, p3, p4) {
- var q = new Quad();
- vec2.set(q.p1, p1[0], p1[1]);
- vec2.set(q.p2, p2[0], p2[1]);
- vec2.set(q.p3, p3[0], p3[1]);
- vec2.set(q.p4, p4[0], p4[1]);
- return q;
- }
-
- Quad.from8Array = function(arr) {
- if (arr.length != 8)
- throw new Error('Array must be 8 long');
- var q = new Quad();
- q.p1[0] = arr[0];
- q.p1[1] = arr[1];
- q.p2[0] = arr[2];
- q.p2[1] = arr[3];
- q.p3[0] = arr[4];
- q.p3[1] = arr[5];
- q.p4[0] = arr[6];
- q.p4[1] = arr[7];
- return q;
- };
-
- Quad.prototype = {
- pointInside: function(point) {
- return pointInImplicitQuad(point,
- this.p1, this.p2, this.p3, this.p4);
- },
-
- boundingRect: function() {
- var x0 = Math.min(this.p1[0], this.p2[0], this.p3[0], this.p4[0]);
- var y0 = Math.min(this.p1[1], this.p2[1], this.p3[1], this.p4[1]);
-
- var x1 = Math.max(this.p1[0], this.p2[0], this.p3[0], this.p4[0]);
- var y1 = Math.max(this.p1[1], this.p2[1], this.p3[1], this.p4[1]);
-
- return new tr.b.Rect.fromXYWH(x0, y0, x1 - x0, y1 - y0);
- },
-
- clone: function() {
- var q = new Quad();
- vec2.copy(q.p1, this.p1);
- vec2.copy(q.p2, this.p2);
- vec2.copy(q.p3, this.p3);
- vec2.copy(q.p4, this.p4);
- return q;
- },
-
- scale: function(s) {
- var q = new Quad();
- this.scaleFast(q, s);
- return q;
- },
-
- scaleFast: function(dstQuad, s) {
- vec2.copy(dstQuad.p1, this.p1, s);
- vec2.copy(dstQuad.p2, this.p2, s);
- vec2.copy(dstQuad.p3, this.p3, s);
- vec2.copy(dstQuad.p3, this.p3, s);
- },
-
- isRectangle: function() {
- // Simple rectangle check. Note: will not handle out-of-order components.
- var bounds = this.boundingRect();
- return (
- bounds.x == this.p1[0] &&
- bounds.y == this.p1[1] &&
- bounds.width == this.p2[0] - this.p1[0] &&
- bounds.y == this.p2[1] &&
- bounds.width == this.p3[0] - this.p1[0] &&
- bounds.height == this.p3[1] - this.p2[1] &&
- bounds.x == this.p4[0] &&
- bounds.height == this.p4[1] - this.p2[1]
- );
- },
-
- projectUnitRect: function(rect) {
- var q = new Quad();
- this.projectUnitRectFast(q, rect);
- return q;
- },
-
- projectUnitRectFast: function(dstQuad, rect) {
- var v12 = tmpVec2s[0];
- var v14 = tmpVec2s[1];
- var v23 = tmpVec2s[2];
- var v43 = tmpVec2s[3];
- var l12, l14, l23, l43;
-
- vec2.sub(v12, this.p2, this.p1);
- l12 = vec2.length(v12);
- vec2.scale(v12, v12, 1 / l12);
-
- vec2.sub(v14, this.p4, this.p1);
- l14 = vec2.length(v14);
- vec2.scale(v14, v14, 1 / l14);
-
- vec2.sub(v23, this.p3, this.p2);
- l23 = vec2.length(v23);
- vec2.scale(v23, v23, 1 / l23);
-
- vec2.sub(v43, this.p3, this.p4);
- l43 = vec2.length(v43);
- vec2.scale(v43, v43, 1 / l43);
-
- var b12 = tmpVec2s[0];
- var b14 = tmpVec2s[1];
- var b23 = tmpVec2s[2];
- var b43 = tmpVec2s[3];
- lerpVec2(b12, v12, v43, rect.y);
- lerpVec2(b43, v12, v43, 1 - rect.bottom);
- lerpVec2(b14, v14, v23, rect.x);
- lerpVec2(b23, v14, v23, 1 - rect.right);
-
- vec2.addTwoScaledUnitVectors(tmpVec2a,
- b12, l12 * rect.x,
- b14, l14 * rect.y);
- vec2.add(dstQuad.p1, this.p1, tmpVec2a);
-
- vec2.addTwoScaledUnitVectors(tmpVec2a,
- b12, l12 * -(1.0 - rect.right),
- b23, l23 * rect.y);
- vec2.add(dstQuad.p2, this.p2, tmpVec2a);
-
-
- vec2.addTwoScaledUnitVectors(tmpVec2a,
- b43, l43 * -(1.0 - rect.right),
- b23, l23 * -(1.0 - rect.bottom));
- vec2.add(dstQuad.p3, this.p3, tmpVec2a);
-
- vec2.addTwoScaledUnitVectors(tmpVec2a,
- b43, l43 * rect.left,
- b14, l14 * -(1.0 - rect.bottom));
- vec2.add(dstQuad.p4, this.p4, tmpVec2a);
- },
-
- toString: function() {
- return 'Quad(' +
- vec2.toString(this.p1) + ', ' +
- vec2.toString(this.p2) + ', ' +
- vec2.toString(this.p3) + ', ' +
- vec2.toString(this.p4) + ')';
- }
- };
-
- function sign(p1, p2, p3) {
- return (p1[0] - p3[0]) * (p2[1] - p3[1]) -
- (p2[0] - p3[0]) * (p1[1] - p3[1]);
- }
-
- function pointInTriangle2(pt, p1, p2, p3) {
- var b1 = sign(pt, p1, p2) < 0.0;
- var b2 = sign(pt, p2, p3) < 0.0;
- var b3 = sign(pt, p3, p1) < 0.0;
- return ((b1 == b2) && (b2 == b3));
- }
-
- function pointInImplicitQuad(point, p1, p2, p3, p4) {
- return pointInTriangle2(point, p1, p2, p3) ||
- pointInTriangle2(point, p1, p3, p4);
- }
-
- return {
- pointInTriangle2: pointInTriangle2,
- pointInImplicitQuad: pointInImplicitQuad,
- Quad: Quad
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/quad_test.html b/chromium/third_party/catapult/tracing/tracing/base/quad_test.html
deleted file mode 100644
index ab25ee62498..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/quad_test.html
+++ /dev/null
@@ -1,130 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/rect.html">
-<link rel="import" href="/tracing/base/quad.html">
-<script>
-'use strict';
-
-function assertQuadEquals(a, b, opt_message) {
- var ok = true;
- ok &= a.p1[0] === b.p1[0] && a.p1[1] === b.p1[1];
- ok &= a.p2[0] === b.p2[0] && a.p2[1] === b.p2[1];
- ok &= a.p3[0] === b.p3[0] && a.p3[1] === b.p3[1];
- ok &= a.p4[0] === b.p4[0] && a.p4[1] === b.p4[1];
- if (ok)
- return;
- var message = opt_message || 'Expected "' + a.toString() +
- '", got "' + b.toString() + '"';
- throw new tr.b.unittest.TestError(message);
-}
-
-tr.b.unittest.testSuite(function() {
- test('pointInTri', function() {
- var res = tr.b.pointInTriangle2(
- [0.25, 0.25],
- [0, 0],
- [1, 0],
- [0, 1]);
- assert.isTrue(res);
- });
-
- test('pointNotInTri', function() {
- var res = tr.b.pointInTriangle2(
- [0.75, 0.75],
- [0, 0],
- [1, 0],
- [0, 1]);
- assert.isFalse(res);
- });
-
- test('pointInside', function() {
- var q = tr.b.Quad.from4Vecs([0, 0],
- [1, 0],
- [1, 1],
- [0, 1]);
- var res = q.pointInside([0.5, 0.5]);
- assert.isTrue(res);
- });
-
- test('pointNotInQuad', function() {
- var q = tr.b.Quad.from4Vecs([0, 0],
- [1, 0],
- [1, 1],
- [0, 1]);
- var res = q.pointInside([1.5, 0.5]);
- assert.isFalse(res);
- });
-
- test('isRectangle', function() {
- assert.isTrue(tr.b.Quad.fromXYWH(0, 0, 10, 10).isRectangle());
- assert.isTrue(tr.b.Quad.fromXYWH(-10, -10, 5, 5).isRectangle());
- assert.isTrue(tr.b.Quad.fromXYWH(-10, -10, 20, 20).isRectangle());
- assert.isTrue(tr.b.Quad.fromXYWH(-10, 10, 5, 5).isRectangle());
-
- assert.isFalse(tr.b.Quad.fromXYWH(0, 0, -10, -10).isRectangle());
- assert.isFalse(
- tr.b.Quad.from8Array([0, 1, 2, 3, 4, 5, 6, 7]).isRectangle());
- assert.isFalse(
- tr.b.Quad.from8Array([0, 0, 0, 5, 5, 5, 0, 0]).isRectangle());
- });
-
- test('projectUnitRect', function() {
- var container = tr.b.Quad.fromXYWH(0, 0, 10, 10);
- var srcRect = tr.b.Rect.fromXYWH(0.1, 0.8, 0.8, 0.1);
- var expectedRect = srcRect.scale(10);
-
- var q = new tr.b.Quad();
- container.projectUnitRectFast(q, srcRect);
-
- assertQuadEquals(tr.b.Quad.fromRect(expectedRect), q);
- });
-
- test('projectUnitRectOntoUnitQuad', function() {
- var container = tr.b.Quad.fromXYWH(0, 0, 1, 1);
- var srcRect = tr.b.Rect.fromXYWH(0.0, 0, 1, 1);
- var expectedRect = srcRect;
-
- var q = new tr.b.Quad();
- container.projectUnitRectFast(q, srcRect);
-
- assertQuadEquals(tr.b.Quad.fromRect(expectedRect), q);
- });
-
- test('projectUnitRectOntoSizeTwoQuad', function() {
- var container = tr.b.Quad.fromXYWH(0, 0, 2, 2);
- var srcRect = tr.b.Rect.fromXYWH(0.0, 0, 1, 1);
- var expectedRect = srcRect.scale(2);
-
- var q = new tr.b.Quad();
- container.projectUnitRectFast(q, srcRect);
-
- assertQuadEquals(tr.b.Quad.fromRect(expectedRect), q);
- });
-
- test('projectUnitRectOntoTranslatedQuad', function() {
- var container = tr.b.Quad.fromXYWH(1, 1, 1, 1);
- var srcRect = tr.b.Rect.fromXYWH(0.0, 0, 1, 1);
- var expectedRect = srcRect.translate([1, 1]);
-
- var q = new tr.b.Quad();
- container.projectUnitRectFast(q, srcRect);
-
- assertQuadEquals(tr.b.Quad.fromRect(expectedRect), q);
- });
-
- test('projectShrunkUnitRectOntoUnitQuad', function() {
- var container = tr.b.Quad.fromXYWH(0, 0, 1, 1);
- var srcRect = tr.b.Rect.fromXYWH(0.1, 0.1, 0.8, 0.8);
- var expectedRect = srcRect;
-
- var q = new tr.b.Quad();
- container.projectUnitRectFast(q, srcRect);
-
- assertQuadEquals(tr.b.Quad.fromRect(expectedRect), q);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/raf.html b/chromium/third_party/catapult/tracing/tracing/base/raf.html
deleted file mode 100644
index 9082e972f1b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/raf.html
+++ /dev/null
@@ -1,214 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/utils.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
- var ESTIMATED_IDLE_PERIOD_LENGTH_MILLISECONDS = 10;
- // The maximum amount of time that we allow for a task to get scheduled
- // in idle time before forcing the task to run.
- var REQUEST_IDLE_CALLBACK_TIMEOUT_MILLISECONDS = 100;
-
- // Setting this to true will cause stack traces to get dumped into the
- // tasks. When an exception happens the original stack will be printed.
- //
- // NOTE: This should never be set committed as true.
- var recordRAFStacks = false;
-
- var pendingPreAFs = [];
- var pendingRAFs = [];
- var pendingIdleCallbacks = [];
- var currentRAFDispatchList = undefined;
-
- var rafScheduled = false;
- var idleWorkScheduled = false;
-
- function scheduleRAF() {
- if (rafScheduled)
- return;
- rafScheduled = true;
- if (tr.isHeadless) {
- Promise.resolve().then(function() {
- processRequests(false, 0);
- }, function(e) {
- console.log(e.stack);
- throw e;
- });
- } else {
- if (window.requestAnimationFrame) {
- window.requestAnimationFrame(processRequests.bind(this, false));
- } else {
- var delta = Date.now() - window.performance.now();
- window.webkitRequestAnimationFrame(function(domTimeStamp) {
- processRequests(false, domTimeStamp - delta);
- });
- }
- }
- }
-
- function nativeRequestIdleCallbackSupported() {
- return !tr.isHeadless && window.requestIdleCallback;
- }
-
- function scheduleIdleWork() {
- if (idleWorkScheduled)
- return;
- if (!nativeRequestIdleCallbackSupported()) {
- scheduleRAF();
- return;
- }
- idleWorkScheduled = true;
- window.requestIdleCallback(function(deadline, didTimeout) {
- processIdleWork(false /* forceAllTasksToRun */, deadline);
- }, { timeout: REQUEST_IDLE_CALLBACK_TIMEOUT_MILLISECONDS });
- }
-
- function onAnimationFrameError(e, opt_stack) {
- console.log(e.stack);
- if (tr.isHeadless)
- throw e;
-
- if (opt_stack)
- console.log(opt_stack);
-
- if (e.message)
- console.error(e.message, e.stack);
- else
- console.error(e);
- }
-
- function runTask(task, frameBeginTime) {
- try {
- task.callback.call(task.context, frameBeginTime);
- } catch (e) {
- tr.b.onAnimationFrameError(e, task.stack);
- }
- }
-
- function processRequests(forceAllTasksToRun, frameBeginTime) {
- rafScheduled = false;
-
- var currentPreAFs = pendingPreAFs;
- currentRAFDispatchList = pendingRAFs;
- pendingPreAFs = [];
- pendingRAFs = [];
- var hasRAFTasks = currentPreAFs.length || currentRAFDispatchList.length;
-
- for (var i = 0; i < currentPreAFs.length; i++)
- runTask(currentPreAFs[i], frameBeginTime);
-
- while (currentRAFDispatchList.length > 0)
- runTask(currentRAFDispatchList.shift(), frameBeginTime);
- currentRAFDispatchList = undefined;
-
- if ((!hasRAFTasks && !nativeRequestIdleCallbackSupported()) ||
- forceAllTasksToRun) {
- // We assume that we want to do a fixed maximum amount of optional work
- // per frame. Hopefully rAF will eventually pass this in for us.
- var rafCompletionDeadline =
- frameBeginTime + ESTIMATED_IDLE_PERIOD_LENGTH_MILLISECONDS;
- processIdleWork(
- forceAllTasksToRun, {
- timeRemaining: function() {
- return rafCompletionDeadline - window.performance.now();
- }
- }
- );
- }
-
- if (pendingIdleCallbacks.length > 0)
- scheduleIdleWork();
- }
-
- function processIdleWork(forceAllTasksToRun, deadline) {
- idleWorkScheduled = false;
- while (pendingIdleCallbacks.length > 0) {
- runTask(pendingIdleCallbacks.shift());
- // Check timer after running at least one idle task to avoid buggy
- // window.performance.now() on some platforms from blocking the idle
- // task queue.
- if (!forceAllTasksToRun &&
- (tr.isHeadless || deadline.timeRemaining() <= 0)) {
- break;
- }
- }
-
- if (pendingIdleCallbacks.length > 0)
- scheduleIdleWork();
- }
-
- function getStack_() {
- if (!recordRAFStacks)
- return '';
-
- var stackLines = tr.b.stackTrace();
- // Strip off getStack_.
- stackLines.shift();
- return stackLines.join('\n');
- }
-
- function requestPreAnimationFrame(callback, opt_this) {
- pendingPreAFs.push({
- callback: callback,
- context: opt_this || global,
- stack: getStack_()});
- scheduleRAF();
- }
-
- function requestAnimationFrameInThisFrameIfPossible(callback, opt_this) {
- if (!currentRAFDispatchList) {
- requestAnimationFrame(callback, opt_this);
- return;
- }
- currentRAFDispatchList.push({
- callback: callback,
- context: opt_this || global,
- stack: getStack_()});
- return;
- }
-
- function requestAnimationFrame(callback, opt_this) {
- pendingRAFs.push({
- callback: callback,
- context: opt_this || global,
- stack: getStack_()});
- scheduleRAF();
- }
-
- function requestIdleCallback(callback, opt_this) {
- pendingIdleCallbacks.push({
- callback: callback,
- context: opt_this || global,
- stack: getStack_()});
- scheduleIdleWork();
- }
-
- function forcePendingRAFTasksToRun(frameBeginTime) {
- if (!rafScheduled)
- return;
- processRequests(false, frameBeginTime);
- }
-
- function forceAllPendingTasksToRunForTest() {
- if (!rafScheduled && !idleWorkScheduled)
- return;
- processRequests(true, 0);
- }
-
- return {
- onAnimationFrameError: onAnimationFrameError,
- requestPreAnimationFrame: requestPreAnimationFrame,
- requestAnimationFrame: requestAnimationFrame,
- requestAnimationFrameInThisFrameIfPossible:
- requestAnimationFrameInThisFrameIfPossible,
- requestIdleCallback: requestIdleCallback,
- forcePendingRAFTasksToRun: forcePendingRAFTasksToRun,
- forceAllPendingTasksToRunForTest: forceAllPendingTasksToRunForTest
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/raf_test.html b/chromium/third_party/catapult/tracing/tracing/base/raf_test.html
deleted file mode 100644
index 289ab52a650..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/raf_test.html
+++ /dev/null
@@ -1,247 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/raf.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- if (tr.isHeadless)
- return;
-
- test('idleCallbackWorks', function() {
- return new Promise(function(resolve, reject) {
- tr.b.requestIdleCallback(resolve);
- });
- });
-
- test('forceAllPendingTasksToRunForTest', function() {
- var rafRan = false;
- tr.b.requestAnimationFrame(function() {
- rafRan = true;
- });
- var idleRan = false;
- tr.b.requestIdleCallback(function() {
- idleRan = true;
- });
- assert.isFalse(rafRan);
- assert.isFalse(idleRan);
- tr.b.forceAllPendingTasksToRunForTest();
- assert.isTrue(rafRan);
- assert.isTrue(idleRan);
- });
-
- test('forcePendingRAFTasksToRun', function() {
- var rafRan = false;
- tr.b.requestAnimationFrame(function() {
- rafRan = true;
- });
- var idleRan = false;
- tr.b.requestIdleCallback(function() {
- idleRan = true;
- });
- tr.b.forcePendingRAFTasksToRun();
- assert.isTrue(rafRan);
- assert.isFalse(idleRan);
- });
-
- var fakeNow = undefined;
- function withFakeWindowPerformanceNow(func) {
- var oldNow = window.performance.now;
- try {
- window.performance.now = function() { return fakeNow; };
- func();
- } finally {
- window.performance.now = oldNow;
- }
- }
-
- // None of the following tests are relevant if the browser supports idle
- // callbacks natively. Nevertheless, run them without native idle support to
- // make sure the fallback keeps working.
- function withoutNativeIdleCallbacks(func) {
- var oldRIC = window.requestIdleCallback;
- try {
- window.requestIdleCallback = undefined;
- func();
- } finally {
- window.requestIdleCallback = oldRIC;
- }
- }
-
- function withMockedScheduling(func) {
- withFakeWindowPerformanceNow(function() {
- withoutNativeIdleCallbacks(func);
- });
- }
-
- test('runIdleTaskWhileIdle', function() {
- withMockedScheduling(function() {
- tr.b.forceAllPendingTasksToRunForTest();
-
- var rafRan = false;
- tr.b.requestAnimationFrame(function() {
- rafRan = true;
- });
- var idleRan = false;
- tr.b.requestIdleCallback(function() {
- idleRan = true;
- });
- fakeNow = 0;
- tr.b.forcePendingRAFTasksToRun(fakeNow);
- assert.isFalse(idleRan);
- assert.isTrue(rafRan);
- tr.b.forcePendingRAFTasksToRun(fakeNow);
- assert.isTrue(idleRan);
- });
- });
-
- test('twoShortIdleCallbacks', function() {
- withMockedScheduling(function() {
- tr.b.forceAllPendingTasksToRunForTest();
-
- var idle1Ran = false;
- var idle2Ran = false;
- tr.b.requestIdleCallback(function() {
- fakeNow += 1;
- idle1Ran = true;
- });
- tr.b.requestIdleCallback(function() {
- fakeNow += 1;
- idle2Ran = true;
- });
- fakeNow = 0;
- tr.b.forcePendingRAFTasksToRun(fakeNow);
- assert.isTrue(idle1Ran);
- assert.isTrue(idle2Ran);
- });
- });
-
-
- test('oneLongOneShortIdleCallback', function() {
- withMockedScheduling(function() {
- tr.b.forceAllPendingTasksToRunForTest();
-
- var idle1Ran = false;
- var idle2Ran = false;
- tr.b.requestIdleCallback(function() {
- fakeNow += 100;
- idle1Ran = true;
- });
- tr.b.requestIdleCallback(function() {
- fakeNow += 1;
- idle2Ran = true;
- });
- fakeNow = 0;
- tr.b.forcePendingRAFTasksToRun(fakeNow);
- assert.isTrue(idle1Ran);
- assert.isFalse(idle2Ran);
-
- // Reset idle1Ran to verify that it dosn't run again.
- idle1Ran = false;
-
- // Now run. idle2 should now run.
- tr.b.forcePendingRAFTasksToRun(fakeNow);
- assert.isFalse(idle1Ran);
- assert.isTrue(idle2Ran);
- });
- });
-
- test('buggyPerformanceNowDoesNotBlockIdleTasks', function() {
- withMockedScheduling(function() {
- tr.b.forcePendingRAFTasksToRun(); // Clear current RAF task queue.
-
- var idle1Ran = false;
- var idle2Ran = false;
- tr.b.requestIdleCallback(function() {
- fakeNow += 100;
- idle1Ran = true;
- });
- tr.b.requestIdleCallback(function() {
- fakeNow += 1;
- idle2Ran = true;
- });
- fakeNow = 10000;
- tr.b.forcePendingRAFTasksToRun(0);
- assert.isTrue(idle1Ran);
- assert.isFalse(idle2Ran);
-
- // Reset idle1Ran to verify that it dosn't run again.
- idle1Ran = false;
-
- // Now run. idle2 should now run.
- tr.b.forcePendingRAFTasksToRun(0);
- assert.isFalse(idle1Ran);
- assert.isTrue(idle2Ran);
- });
- });
-
- function withFixedIdleTimeRemaining(idleTime, func) {
- var oldRIC = window.requestIdleCallback;
- try {
- var pendingIdleCallbacks = [];
- window.requestIdleCallback = function(callback) {
- var deadline = {
- timeRemaining: function() {
- return idleTime;
- }
- };
- pendingIdleCallbacks.push(function() {
- callback(deadline, false /* didTimeout */);
- });
- };
- func(pendingIdleCallbacks);
- } finally {
- window.requestIdleCallback = oldRIC;
- }
- }
-
- test('idleCallbackWithIdletime', function() {
- withFixedIdleTimeRemaining(1000, function(pendingIdleCallbacks) {
- var idle1Ran = false;
- var idle2Ran = false;
- tr.b.requestIdleCallback(function() {
- idle1Ran = true;
- });
- tr.b.requestIdleCallback(function() {
- idle2Ran = true;
- });
- assert.lengthOf(pendingIdleCallbacks, 1);
- pendingIdleCallbacks.shift()();
-
- // Both callbacks should have run since there was idle time.
- assert.isTrue(idle1Ran);
- assert.isTrue(idle2Ran);
- });
- });
-
- test('idleCallbackWithoutIdletime', function() {
- withFixedIdleTimeRemaining(0, function(pendingIdleCallbacks) {
- var idle1Ran = false;
- var idle2Ran = false;
- tr.b.requestIdleCallback(function() {
- idle1Ran = true;
- });
- tr.b.requestIdleCallback(function() {
- idle2Ran = true;
- });
- assert.lengthOf(pendingIdleCallbacks, 1);
- pendingIdleCallbacks.shift()();
-
- // Only the first idle callback should have run since there was no idle
- // time left.
- assert.isTrue(idle1Ran);
- assert.isFalse(idle2Ran);
-
- // Run the remaining idle task.
- assert.lengthOf(pendingIdleCallbacks, 1);
- pendingIdleCallbacks.shift()();
- assert.isTrue(idle2Ran);
- });
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/range.html b/chromium/third_party/catapult/tracing/tracing/base/range.html
deleted file mode 100644
index d24dc3327e4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/range.html
+++ /dev/null
@@ -1,265 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Quick range computations.
- */
-tr.exportTo('tr.b', function() {
-
- function Range() {
- this.isEmpty_ = true;
- this.min_ = undefined;
- this.max_ = undefined;
- };
-
- Range.prototype = {
- __proto__: Object.prototype,
-
- reset: function() {
- this.isEmpty_ = true;
- this.min_ = undefined;
- this.max_ = undefined;
- },
-
- get isEmpty() {
- return this.isEmpty_;
- },
-
- addRange: function(range) {
- if (range.isEmpty)
- return;
- this.addValue(range.min);
- this.addValue(range.max);
- },
-
- addValue: function(value) {
- if (this.isEmpty_) {
- this.max_ = value;
- this.min_ = value;
- this.isEmpty_ = false;
- return;
- }
- this.max_ = Math.max(this.max_, value);
- this.min_ = Math.min(this.min_, value);
- },
-
- set min(min) {
- this.isEmpty_ = false;
- this.min_ = min;
- },
-
- get min() {
- if (this.isEmpty_)
- return undefined;
- return this.min_;
- },
-
- get max() {
- if (this.isEmpty_)
- return undefined;
- return this.max_;
- },
-
- set max(max) {
- this.isEmpty_ = false;
- this.max_ = max;
- },
-
- get range() {
- if (this.isEmpty_)
- return undefined;
- return this.max_ - this.min_;
- },
-
- get center() {
- return (this.min_ + this.max_) * 0.5;
- },
-
- get duration() {
- if (this.isEmpty_)
- return 0;
- return this.max_ - this.min_;
- },
-
- normalize: function(x) {
- return tr.b.normalize(x, this.min, this.max);
- },
-
- lerp: function(x) {
- return tr.b.lerp(x, this.min, this.max);
- },
-
- equals: function(that) {
- if (this.isEmpty && that.isEmpty)
- return true;
- if (this.isEmpty != that.isEmpty)
- return false;
- return this.min === that.min &&
- this.max === that.max;
- },
-
- containsExplicitRangeInclusive: function(min, max) {
- if (this.isEmpty)
- return false;
- return this.min_ <= min && max <= this.max_;
- },
-
- containsExplicitRangeExclusive: function(min, max) {
- if (this.isEmpty)
- return false;
- return this.min_ < min && max < this.max_;
- },
-
- intersectsExplicitRangeInclusive: function(min, max) {
- if (this.isEmpty)
- return false;
- return this.min_ <= max && min <= this.max_;
- },
-
- intersectsExplicitRangeExclusive: function(min, max) {
- if (this.isEmpty)
- return false;
- return this.min_ < max && min < this.max_;
- },
-
- containsRangeInclusive: function(range) {
- if (range.isEmpty)
- return false;
- return this.containsExplicitRangeInclusive(range.min_, range.max_);
- },
-
- containsRangeExclusive: function(range) {
- if (range.isEmpty)
- return false;
- return this.containsExplicitRangeExclusive(range.min_, range.max_);
- },
-
- intersectsRangeInclusive: function(range) {
- if (range.isEmpty)
- return false;
- return this.intersectsExplicitRangeInclusive(range.min_, range.max_);
- },
-
- intersectsRangeExclusive: function(range) {
- if (range.isEmpty)
- return false;
- return this.intersectsExplicitRangeExclusive(range.min_, range.max_);
- },
-
- findIntersection: function(range) {
- if (this.isEmpty || range.isEmpty)
- return new Range();
-
- var min = Math.max(this.min, range.min);
- var max = Math.min(this.max, range.max);
-
- if (max < min)
- return new Range();
-
- return Range.fromExplicitRange(min, max);
- },
-
- toJSON: function() {
- if (this.isEmpty_)
- return {isEmpty: true};
- return {
- isEmpty: false,
- max: this.max,
- min: this.min
- };
- },
-
- /**
- * Returns a slice of the input array that intersects with this range
- * inclusively.
- * If the range does not have a min, it is treated as unbounded from below.
- * Similarly, if max is undefined, the range is unbounded from above.
- *
- * @param {Array} array The array of elements to be filtered.
- * @param {Funcation=} opt_keyFunc A function that extracts a numeric value,
- * to be used in comparisons, from an element of the array. If not
- * specified, array elements themselves will be used.
- * @param {Object=} opt_this An optional this argument to be passed to
- * opt_keyFunc.
- */
- filterArray: function(array, opt_keyFunc, opt_this) {
- if (this.isEmpty_)
- return [];
- // Binary search. |test| is a function that should return true when we
- // need to explore the left branch and false to explore the right branch.
- function binSearch(test) {
- var i0 = 0;
- var i1 = array.length;
- while (i0 < i1) {
- var i = Math.trunc((i0 + i1) / 2);
- if (test(i))
- i1 = i; // Explore the left branch.
- else
- i0 = i + 1; // Explore the right branch.
- }
- return i1;
- }
-
- var keyFunc = opt_keyFunc || tr.b.identity;
- function getValue(index) {
- return keyFunc.call(opt_this, array[index]);
- }
-
- var first = binSearch(function(i) {
- return this.min_ === undefined || this.min_ <= getValue(i);
- }.bind(this));
- var last = binSearch(function(i) {
- return this.max_ !== undefined && this.max_ < getValue(i);
- }.bind(this));
- return array.slice(first, last);
- }
- };
-
- Range.fromDict = function(d) {
- if (d.isEmpty === true) {
- return new Range();
- } else if (d.isEmpty === false) {
- var range = new Range();
- range.min = d.min;
- range.max = d.max;
- return range;
- } else {
- throw new Error('Not a range');
- }
- };
-
- Range.fromExplicitRange = function(min, max) {
- var range = new Range();
- range.min = min;
- range.max = max;
- return range;
- };
-
- Range.compareByMinTimes = function(a, b) {
- if (!a.isEmpty && !b.isEmpty)
- return a.min_ - b.min_;
-
- if (a.isEmpty && !b.isEmpty)
- return -1;
-
- if (!a.isEmpty && b.isEmpty)
- return 1;
-
- return 0;
- };
-
- return {
- Range: Range
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/range_test.html b/chromium/third_party/catapult/tracing/tracing/base/range_test.html
deleted file mode 100644
index 5d1f24cc296..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/range_test.html
+++ /dev/null
@@ -1,446 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Range = tr.b.Range;
-
- test('addValue', function() {
- var range = new Range();
- assert.isTrue(range.isEmpty);
- range.addValue(1);
- assert.isFalse(range.isEmpty);
- assert.equal(1, range.min);
- assert.equal(1, range.max);
-
- range.addValue(2);
- assert.isFalse(range.isEmpty);
- assert.equal(1, range.min);
- assert.equal(2, range.max);
- });
-
- test('addNonEmptyRange', function() {
- var r1 = new Range();
- r1.addValue(1);
- r1.addValue(2);
-
- var r = new Range();
- r.addRange(r1);
- assert.equal(1, r.min);
- assert.equal(2, r.max);
-
- var r2 = Range.fromDict(r.toJSON());
- assert.equal(r2.isEmpty, r.isEmpty);
- assert.equal(r2.max, r.max);
- assert.equal(r2.min, r.min);
- });
-
- test('addEmptyRange', function() {
- var r1 = new Range();
-
- var r = new Range();
- r.addRange(r1);
- assert.isTrue(r.isEmpty);
- assert.isUndefined(r.min);
- assert.isUndefined(r.max);
-
- var r2 = Range.fromDict(r.toJSON());
- assert.equal(r2.isEmpty, r.isEmpty);
- assert.isUndefined(r2.max);
- assert.isUndefined(r2.min);
- });
-
- test('addRangeToRange', function() {
- var r1 = new Range();
- r1.addValue(1);
- r1.addValue(2);
-
- var r = new Range();
- r.addValue(3);
- r.addRange(r1);
-
- assert.isFalse(r.isEmpty);
- assert.equal(1, r.min);
- assert.equal(3, r.max);
- });
-
- test('containsRange', function() {
- var r1 = Range.fromExplicitRange(0, 3);
- var r2 = Range.fromExplicitRange(1, 2);
-
- assert.isTrue(r1.containsRangeInclusive(r2));
- assert.isFalse(r2.containsRangeInclusive(r1));
- assert.isTrue(r1.containsRangeExclusive(r2));
- assert.isFalse(r2.containsRangeExclusive(r1));
- });
-
- test('containsRange_emptyRange', function() {
- var r1 = Range.fromExplicitRange(0, 3);
- var r2 = new Range();
-
- assert.isFalse(r1.containsRangeInclusive(r2));
- assert.isFalse(r2.containsRangeInclusive(r1));
- assert.isFalse(r1.containsRangeExclusive(r2));
- assert.isFalse(r2.containsRangeExclusive(r1));
- });
-
- test('containsRange_overlapping', function() {
- var r1 = Range.fromExplicitRange(0, 3);
- var r2 = Range.fromExplicitRange(2, 4);
-
- assert.isFalse(r1.containsRangeInclusive(r2));
- assert.isFalse(r2.containsRangeInclusive(r1));
- assert.isFalse(r1.containsRangeExclusive(r2));
- assert.isFalse(r2.containsRangeExclusive(r1));
- });
-
- test('containsRange_disjoint', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(3, 5);
-
- assert.isFalse(r1.containsRangeInclusive(r2));
- assert.isFalse(r2.containsRangeInclusive(r1));
- assert.isFalse(r1.containsRangeExclusive(r2));
- assert.isFalse(r2.containsRangeExclusive(r1));
- });
-
- test('containsRange_singlePointRange', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(1, 1);
-
- assert.isTrue(r1.containsRangeInclusive(r2));
- assert.isFalse(r2.containsRangeInclusive(r1));
- assert.isTrue(r1.containsRangeExclusive(r2));
- assert.isFalse(r2.containsRangeExclusive(r1));
- });
-
- test('containsRange_singlePointRangeAtBorder', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(2, 2);
-
- assert.isTrue(r1.containsRangeInclusive(r2));
- assert.isFalse(r2.containsRangeInclusive(r1));
- assert.isFalse(r1.containsRangeExclusive(r2));
- assert.isFalse(r2.containsRangeExclusive(r1));
- });
-
- test('containsExplicitRange', function() {
- var r1 = Range.fromExplicitRange(0, 3);
- var r2 = Range.fromExplicitRange(1, 2);
-
- assert.isTrue(r1.containsExplicitRangeInclusive(1, 2));
- assert.isFalse(r2.containsExplicitRangeInclusive(0, 3));
- assert.isTrue(r1.containsExplicitRangeExclusive(1, 2));
- assert.isFalse(r2.containsExplicitRangeExclusive(0, 3));
- });
-
- test('containsExplicitRange_overlapping', function() {
- var r1 = Range.fromExplicitRange(0, 3);
- var r2 = Range.fromExplicitRange(2, 4);
-
- assert.isFalse(r1.containsExplicitRangeInclusive(2, 4));
- assert.isFalse(r2.containsExplicitRangeInclusive(0, 3));
- assert.isFalse(r1.containsExplicitRangeExclusive(2, 4));
- assert.isFalse(r2.containsExplicitRangeExclusive(0, 3));
- });
-
- test('containsExplicitRange_disjoint', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(3, 5);
-
- assert.isFalse(r1.containsExplicitRangeInclusive(3, 5));
- assert.isFalse(r2.containsExplicitRangeInclusive(0, 2));
- assert.isFalse(r1.containsExplicitRangeExclusive(3, 5));
- assert.isFalse(r2.containsExplicitRangeExclusive(0, 2));
- });
-
- test('containsExplicitRange_singlePointRange', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(1, 1);
-
- assert.isTrue(r1.containsExplicitRangeInclusive(1, 1));
- assert.isFalse(r2.containsExplicitRangeInclusive(0, 2));
- assert.isTrue(r1.containsExplicitRangeExclusive(1, 1));
- assert.isFalse(r2.containsExplicitRangeExclusive(0, 2));
- });
-
- test('containsExplicitRange_singlePointRangeAtBorder', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(2, 2);
-
- assert.isTrue(r1.containsExplicitRangeInclusive(2, 2));
- assert.isFalse(r2.containsExplicitRangeInclusive(0, 2));
- assert.isFalse(r1.containsExplicitRangeExclusive(2, 2));
- assert.isFalse(r2.containsExplicitRangeExclusive(0, 2));
- });
-
- test('intersectsRange', function() {
- var r1 = Range.fromExplicitRange(0, 3);
- var r2 = Range.fromExplicitRange(1, 2);
-
- assert.isTrue(r1.intersectsRangeInclusive(r2));
- assert.isTrue(r2.intersectsRangeInclusive(r1));
- assert.isTrue(r1.intersectsRangeExclusive(r2));
- assert.isTrue(r2.intersectsRangeExclusive(r1));
- });
-
- test('intersectsRange_emptyRange', function() {
- var r1 = Range.fromExplicitRange(0, 3);
- var r2 = new Range();
-
- assert.isFalse(r1.intersectsRangeInclusive(r2));
- assert.isFalse(r2.intersectsRangeInclusive(r1));
- assert.isFalse(r1.intersectsRangeExclusive(r2));
- assert.isFalse(r2.intersectsRangeExclusive(r1));
- });
-
- test('intersectsRange_overlapping', function() {
- var r1 = Range.fromExplicitRange(0, 3);
- var r2 = Range.fromExplicitRange(2, 4);
-
- assert.isTrue(r1.intersectsRangeInclusive(r2));
- assert.isTrue(r2.intersectsRangeInclusive(r1));
- assert.isTrue(r1.intersectsRangeExclusive(r2));
- assert.isTrue(r2.intersectsRangeExclusive(r1));
- });
-
- test('intersectsRange_disjoint', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(3, 5);
-
- assert.isFalse(r1.intersectsRangeInclusive(r2));
- assert.isFalse(r2.intersectsRangeInclusive(r1));
- assert.isFalse(r1.intersectsRangeExclusive(r2));
- assert.isFalse(r2.intersectsRangeExclusive(r1));
- });
-
- test('intersectsRange_singlePointRange', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(1, 1);
-
- assert.isTrue(r1.intersectsRangeInclusive(r2));
- assert.isTrue(r2.intersectsRangeInclusive(r1));
- assert.isTrue(r1.intersectsRangeExclusive(r2));
- assert.isTrue(r2.intersectsRangeExclusive(r1));
- });
-
- test('intersectsRange_singlePointRangeAtBorder', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(2, 2);
-
- assert.isTrue(r1.intersectsRangeInclusive(r2));
- assert.isTrue(r2.intersectsRangeInclusive(r1));
- assert.isFalse(r1.intersectsRangeExclusive(r2));
- assert.isFalse(r2.intersectsRangeExclusive(r1));
- });
-
- test('intersectsExplicitRange', function() {
- var r1 = Range.fromExplicitRange(0, 3);
- var r2 = Range.fromExplicitRange(1, 2);
-
- assert.isTrue(r1.intersectsExplicitRangeInclusive(1, 2));
- assert.isTrue(r2.intersectsExplicitRangeInclusive(0, 3));
- assert.isTrue(r1.intersectsExplicitRangeExclusive(1, 2));
- assert.isTrue(r2.intersectsExplicitRangeExclusive(0, 3));
- });
-
- test('intersectsExplicitRange_overlapping', function() {
- var r1 = Range.fromExplicitRange(0, 3);
- var r2 = Range.fromExplicitRange(2, 4);
-
- assert.isTrue(r1.intersectsExplicitRangeInclusive(2, 4));
- assert.isTrue(r2.intersectsExplicitRangeInclusive(0, 3));
- assert.isTrue(r1.intersectsExplicitRangeExclusive(2, 4));
- assert.isTrue(r2.intersectsExplicitRangeExclusive(0, 3));
- });
-
- test('intersectsExplicitRange_disjoint', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(3, 5);
-
- assert.isFalse(r1.intersectsExplicitRangeInclusive(3, 5));
- assert.isFalse(r2.intersectsExplicitRangeInclusive(0, 2));
- assert.isFalse(r1.intersectsExplicitRangeExclusive(3, 5));
- assert.isFalse(r2.intersectsExplicitRangeExclusive(0, 2));
- });
-
- test('intersectsExplicitRange_singlePointRange', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(1, 1);
-
- assert.isTrue(r1.intersectsExplicitRangeInclusive(1, 1));
- assert.isTrue(r2.intersectsExplicitRangeInclusive(0, 2));
- assert.isTrue(r1.intersectsExplicitRangeExclusive(1, 1));
- assert.isTrue(r2.intersectsExplicitRangeExclusive(0, 2));
- });
-
- test('intersectsExplicitRange_singlePointRangeAtBorder', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(2, 2);
-
- assert.isTrue(r1.intersectsExplicitRangeInclusive(2, 2));
- assert.isTrue(r2.intersectsExplicitRangeInclusive(0, 2));
- assert.isFalse(r1.intersectsExplicitRangeExclusive(2, 2));
- assert.isFalse(r2.intersectsExplicitRangeExclusive(0, 2));
- });
-
- test('duration', function() {
- assert.equal(Range.fromExplicitRange(2, 4).duration, 2);
- });
-
- test('duration_singlePointRange', function() {
- assert.equal(Range.fromExplicitRange(2, 2).duration, 0);
- });
-
- test('duration_emptyRange', function() {
- assert.equal(new Range().duration, 0);
- });
-
- test('findIntersection_overlapping', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(1, 3);
-
- var result = Range.fromExplicitRange(1, 2);
- assert.deepEqual(r1.findIntersection(r2), result);
- assert.deepEqual(r2.findIntersection(r1), result);
- });
-
- test('findIntersection_bordering', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(2, 4);
-
- var result = Range.fromExplicitRange(2, 2);
- assert.deepEqual(r1.findIntersection(r2), result);
- assert.deepEqual(r2.findIntersection(r1), result);
- });
-
- test('findIntersection_singlePointRange', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(2, 2);
-
- var result = Range.fromExplicitRange(2, 2);
- assert.deepEqual(r1.findIntersection(r2), result);
- assert.deepEqual(r2.findIntersection(r1), result);
- });
-
- test('findIntersection_disjoint', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = Range.fromExplicitRange(3, 5);
-
- assert.isTrue(r1.findIntersection(r2).isEmpty);
- assert.isTrue(r2.findIntersection(r1).isEmpty);
- });
-
- test('findIntersection_emptyRange', function() {
- var r1 = Range.fromExplicitRange(0, 2);
- var r2 = new Range();
-
- assert.isTrue(r1.findIntersection(r2).isEmpty);
- assert.isTrue(r2.findIntersection(r1).isEmpty);
- });
-
- test('filter_numericField', function() {
- var r = Range.fromExplicitRange(2, 3);
- var array = [{start: 1},
- {start: 2},
- {start: 3},
- {start: 4}];
- assert.deepEqual([{start: 2}, {start: 3}], r.filterArray(
- array, function(value) {return value.start;}));
- });
-
- test('filter_noNumericField', function() {
- var r = Range.fromExplicitRange(2, 3);
- assert.deepEqual([2, 3], r.filterArray([1, 2, 3, 4]));
- });
-
- test('filter_empty', function() {
- var r = new Range();
- assert.deepEqual([], r.filterArray([1, 2, 3, 4]));
- });
-
- test('filter_oneSided', function() {
- var r = new Range();
- r.min = 2;
- assert.deepEqual([2, 3, 4], r.filterArray([1, 2, 3, 4]));
- });
-
- test('left_boundary_corner_case1', function() {
- var r = Range.fromExplicitRange(1, 2);
- var array = [{start: 1},
- {start: 2},
- {start: 3},
- {start: 4}];
- assert.deepEqual([{start: 1}, {start: 2}], r.filterArray(
- array, function(value) {return value.start;}));
- });
-
- test('left_boundary_corner_case2', function() {
- var r = Range.fromExplicitRange(0, 2);
- var array = [{start: 1},
- {start: 2},
- {start: 3},
- {start: 4}];
- assert.deepEqual([{start: 1}, {start: 2}], r.filterArray(
- array, function(value) {return value.start;}));
- });
-
- test('left_boundary_corner_case3', function() {
- var r = Range.fromExplicitRange(1, 1);
- var array = [{start: 1},
- {start: 2},
- {start: 3},
- {start: 4}];
- assert.deepEqual([{start: 1}], r.filterArray(
- array, function(value) {return value.start;}));
- });
-
- test('left_boundary_corner_case4', function() {
- var r = Range.fromExplicitRange(0, 0);
- var array = [{start: 1},
- {start: 2},
- {start: 3},
- {start: 4}];
- assert.deepEqual([], r.filterArray(
- array, function(value) {return value.start;}));
- });
-
- test('right_boundary_corner_case1', function() {
- var r = Range.fromExplicitRange(4, 5);
- var array = [{start: 1},
- {start: 2},
- {start: 3},
- {start: 4}];
- assert.deepEqual([{start: 4}], r.filterArray(
- array, function(value) {return value.start;}));
- });
-
- test('right_boundary_corner_case2', function() {
- var r = Range.fromExplicitRange(4, 4);
- var array = [{start: 1},
- {start: 2},
- {start: 3},
- {start: 4}];
- assert.deepEqual([{start: 4}], r.filterArray(
- array, function(value) {return value.start;}));
- });
-
- test('right_boundary_corner_case3', function() {
- var r = Range.fromExplicitRange(5, 5);
- var array = [{start: 1},
- {start: 2},
- {start: 3},
- {start: 4}];
- assert.deepEqual([], r.filterArray(
- array, function(value) {return value.start;}));
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/range_utils.html b/chromium/third_party/catapult/tracing/tracing/base/range_utils.html
deleted file mode 100644
index bc6810bc5d3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/range_utils.html
+++ /dev/null
@@ -1,140 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides event merging functionality for grouping/analysis.
- */
-tr.exportTo('tr.b', function() {
- function convertEventsToRanges(events) {
- return events.map(function(event) {
- return tr.b.Range.fromExplicitRange(event.start, event.end);
- });
- }
-
- function mergeRanges(inRanges, mergeThreshold, mergeFunction) {
- var remainingEvents = inRanges.slice();
- remainingEvents.sort(function(x, y) {
- return x.min - y.min;
- });
-
- if (remainingEvents.length <= 1) {
- var merged = [];
- if (remainingEvents.length == 1) {
- merged.push(mergeFunction(remainingEvents));
- }
- return merged;
- }
-
- var mergedEvents = [];
-
- var currentMergeBuffer = [];
- var rightEdge;
- function beginMerging() {
- currentMergeBuffer.push(remainingEvents[0]);
- remainingEvents.splice(0, 1);
- rightEdge = currentMergeBuffer[0].max;
- }
-
- function flushCurrentMergeBuffer() {
- if (currentMergeBuffer.length == 0)
- return;
-
- mergedEvents.push(mergeFunction(currentMergeBuffer));
- currentMergeBuffer = [];
-
- // Refill merge buffer if needed.
- if (remainingEvents.length != 0)
- beginMerging();
- }
-
- beginMerging();
-
- while (remainingEvents.length) {
- var currentEvent = remainingEvents[0];
-
- var distanceFromRightEdge = currentEvent.min - rightEdge;
- if (distanceFromRightEdge < mergeThreshold) {
- rightEdge = Math.max(rightEdge, currentEvent.max);
- remainingEvents.splice(0, 1);
- currentMergeBuffer.push(currentEvent);
- continue;
- }
-
- // Too big a gap.
- flushCurrentMergeBuffer();
- }
- flushCurrentMergeBuffer();
-
- return mergedEvents;
- }
-
- // Pass in |opt_totalRange| in order to find empty ranges before the first of
- // |inRanges| and after the last of |inRanges|.
- function findEmptyRangesBetweenRanges(inRanges, opt_totalRange) {
- if (opt_totalRange && opt_totalRange.isEmpty)
- opt_totalRange = undefined;
-
- var emptyRanges = [];
- if (!inRanges.length) {
- if (opt_totalRange)
- emptyRanges.push(opt_totalRange);
- return emptyRanges;
- }
-
- inRanges = inRanges.slice();
- inRanges.sort(function(x, y) {
- return x.min - y.min;
- });
- if (opt_totalRange &&
- (opt_totalRange.min < inRanges[0].min)) {
- emptyRanges.push(tr.b.Range.fromExplicitRange(
- opt_totalRange.min, inRanges[0].min));
- }
-
- inRanges.forEach(function(range, index) {
- for (var otherIndex = 0; otherIndex < inRanges.length; ++otherIndex) {
- if (index === otherIndex)
- continue;
- var other = inRanges[otherIndex];
-
- if (other.min > range.max) {
- // |inRanges| is sorted, so |other| is the first range after |range|,
- // and there is an empty range between them.
- emptyRanges.push(tr.b.Range.fromExplicitRange(
- range.max, other.min));
- return;
- }
- // Otherwise, |other| starts before |range| ends, so |other| might
- // possibly contain the end of |range|.
-
- if (other.max > range.max) {
- // |other| does contain the end of |range|, so no empty range starts
- // at the end of this |range|.
- return;
- }
- }
- if (opt_totalRange && (range.max < opt_totalRange.max)) {
- emptyRanges.push(tr.b.Range.fromExplicitRange(
- range.max, opt_totalRange.max));
- }
- });
- return emptyRanges;
- }
-
- return {
- convertEventsToRanges: convertEventsToRanges,
- findEmptyRangesBetweenRanges: findEmptyRangesBetweenRanges,
- mergeRanges: mergeRanges
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/range_utils_test.html b/chromium/third_party/catapult/tracing/tracing/base/range_utils_test.html
deleted file mode 100644
index 13cae71f37d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/range_utils_test.html
+++ /dev/null
@@ -1,133 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range_utils.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function simpleMerger(events) {
- return {
- min: events[0].min,
- max: events[events.length - 1].max
- };
- }
- test('simple', function() {
- var inEvents = [
- {min: 0, max: 100},
- {min: 100, max: 120},
- {min: 200, max: 220}
- ];
-
- var merged = tr.b.mergeRanges(inEvents, 50, simpleMerger);
-
- assert.equal(merged.length, 2);
- assert.deepEqual(merged[0], {min: 0, max: 120});
- assert.deepEqual(merged[1], {min: 200, max: 220});
- });
-
- test('overlapping', function() {
- var inEvents = [
- {min: 0, max: 100},
- {min: 80, max: 120},
- {min: 200, max: 220}
- ];
-
- var merged = tr.b.mergeRanges(inEvents, 50, simpleMerger);
-
- assert.equal(merged.length, 2);
- assert.deepEqual(merged[0], {min: 0, max: 120});
- assert.deepEqual(merged[1], {min: 200, max: 220});
- });
-
- test('middleOneIsSmall', function() {
- var inEvents = [
- {min: 0, max: 100},
- {min: 40, max: 50},
- {min: 100, max: 120}
- ];
-
- var merged = tr.b.mergeRanges(inEvents, 50, simpleMerger);
-
- assert.equal(merged.length, 1);
- assert.deepEqual(merged[0], {min: 0, max: 120});
- });
-
- test('firstEventIsSplitPoint', function() {
- var inEvents = [
- {min: 0, max: 100},
- {min: 150, max: 200}
- ];
-
- var merged = tr.b.mergeRanges(inEvents, 25, simpleMerger);
-
- assert.equal(merged.length, 2);
- assert.deepEqual(merged[0], {min: 0, max: 100});
- assert.deepEqual(merged[1], {min: 150, max: 200});
- });
-
- test('mergeSingleEvent', function() {
- var inEvents = [
- {min: 0, max: 100}
- ];
-
- var mergeCount = 0;
- tr.b.mergeRanges(inEvents, 25, function(events) {
- assert.deepEqual(events, inEvents);
- mergeCount++;
- });
- assert.equal(mergeCount, 1);
- });
-
- test('zeroDurationSplit', function() {
- var inEvents = [0, 10, 20, 50, 60];
- inEvents = inEvents.map(function(event) {
- return tr.b.Range.fromExplicitRange(event, event);
- });
- var timestampMerger = function(timestamps) {
- return {
- min: timestamps[0].min,
- max: timestamps[timestamps.length - 1].max
- };
- };
- var merged = tr.b.mergeRanges(inEvents, 15, timestampMerger);
- assert.equal(merged.length, 2);
- assert.deepEqual(merged[0], {min: 0, max: 20});
- assert.deepEqual(merged[1], {min: 50, max: 60});
- });
-
- test('findEmptyRangesBetweenRanges', function() {
- var events = [
- {min: 2, max: 4},
- {min: 1, max: 3},
- {min: 6, max: 8}
- ];
- var ranges = tr.b.findEmptyRangesBetweenRanges(
- events, {min: 0, max: 10});
- assert.equal(3, ranges.length);
- assert.equal(0, ranges[0].min);
- assert.equal(1, ranges[0].max);
- assert.equal(4, ranges[1].min);
- assert.equal(6, ranges[1].max);
- assert.equal(8, ranges[2].min);
- assert.equal(10, ranges[2].max);
- });
-
- test('findEmptyRangesWithEmptyInput', function() {
- var ranges = tr.b.findEmptyRangesBetweenRanges(
- [], {min: 0, max: 10});
- assert.equal(1, ranges.length);
- assert.equal(0, ranges[0].min);
- assert.equal(10, ranges[0].max);
-
- ranges = tr.b.findEmptyRangesBetweenRanges([]);
- assert.equal(0, ranges.length);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/rect.html b/chromium/third_party/catapult/tracing/tracing/base/rect.html
deleted file mode 100644
index 75fcadf5f65..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/rect.html
+++ /dev/null
@@ -1,162 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/math.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
-
- /**
- * Tracks a 2D bounding box.
- * @constructor
- */
- function Rect() {
- this.x = 0;
- this.y = 0;
- this.width = 0;
- this.height = 0;
- };
- Rect.fromXYWH = function(x, y, w, h) {
- var rect = new Rect();
- rect.x = x;
- rect.y = y;
- rect.width = w;
- rect.height = h;
- return rect;
- }
- Rect.fromArray = function(ary) {
- if (ary.length != 4)
- throw new Error('ary.length must be 4');
- var rect = new Rect();
- rect.x = ary[0];
- rect.y = ary[1];
- rect.width = ary[2];
- rect.height = ary[3];
- return rect;
- }
-
- Rect.prototype = {
- __proto__: Object.prototype,
-
- get left() {
- return this.x;
- },
-
- get top() {
- return this.y;
- },
-
- get right() {
- return this.x + this.width;
- },
-
- get bottom() {
- return this.y + this.height;
- },
-
- toString: function() {
- return 'Rect(' + this.x + ', ' + this.y + ', ' +
- this.width + ', ' + this.height + ')';
- },
-
- toArray: function() {
- return [this.x, this.y, this.width, this.height];
- },
-
- clone: function() {
- var rect = new Rect();
- rect.x = this.x;
- rect.y = this.y;
- rect.width = this.width;
- rect.height = this.height;
- return rect;
- },
-
- enlarge: function(pad) {
- var rect = new Rect();
- this.enlargeFast(rect, pad);
- return rect;
- },
-
- enlargeFast: function(out, pad) {
- out.x = this.x - pad;
- out.y = this.y - pad;
- out.width = this.width + 2 * pad;
- out.height = this.height + 2 * pad;
- return out;
- },
-
- size: function() {
- return {width: this.width, height: this.height};
- },
-
- scale: function(s) {
- var rect = new Rect();
- this.scaleFast(rect, s);
- return rect;
- },
-
- scaleSize: function(s) {
- return Rect.fromXYWH(this.x, this.y, this.width * s, this.height * s);
- },
-
- scaleFast: function(out, s) {
- out.x = this.x * s;
- out.y = this.y * s;
- out.width = this.width * s;
- out.height = this.height * s;
- return out;
- },
-
- translate: function(v) {
- var rect = new Rect();
- this.translateFast(rect, v);
- return rect;
- },
-
- translateFast: function(out, v) {
- out.x = this.x + v[0];
- out.y = this.x + v[1];
- out.width = this.width;
- out.height = this.height;
- return out;
- },
-
- asUVRectInside: function(containingRect) {
- var rect = new Rect();
- rect.x = (this.x - containingRect.x) / containingRect.width;
- rect.y = (this.y - containingRect.y) / containingRect.height;
- rect.width = this.width / containingRect.width;
- rect.height = this.height / containingRect.height;
- return rect;
- },
-
- intersects: function(that) {
- var ok = true;
- ok &= this.x < that.right;
- ok &= this.right > that.x;
- ok &= this.y < that.bottom;
- ok &= this.bottom > that.y;
- return ok;
- },
-
- equalTo: function(rect) {
- return rect &&
- (this.x === rect.x) &&
- (this.y === rect.y) &&
- (this.width === rect.width) &&
- (this.height === rect.height);
- }
- };
-
- return {
- Rect: Rect
- };
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/rect_test.html b/chromium/third_party/catapult/tracing/tracing/base/rect_test.html
deleted file mode 100644
index dc976c36614..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/rect_test.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/rect.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('UVRectBasic', function() {
- function assertRectEquals(a, b, opt_message) {
- var ok = true;
- if (a.x === b.x && a.y === b.y &&
- a.width === b.width && a.height === b.height) {
- return;
- }
- var message = opt_message || 'Expected "' + a.toString() +
- '", got "' + b.toString() + '"';
- throw new tr.b.unittest.TestError(message);
- }
- var container = tr.b.Rect.fromXYWH(0, 0, 10, 10);
- var inner = tr.b.Rect.fromXYWH(1, 1, 8, 8);
- var uv = inner.asUVRectInside(container);
- assertRectEquals(uv, tr.b.Rect.fromXYWH(0.1, 0.1, .8, .8));
- assert.equal(10, container.size().width);
- assert.equal(10, container.size().height);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/running_statistics.html b/chromium/third_party/catapult/tracing/tracing/base/running_statistics.html
deleted file mode 100644
index 9110eb19eb0..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/running_statistics.html
+++ /dev/null
@@ -1,135 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/range.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
-
- /***
- * An object of this class computes basic statistics online in O(1).
- * Usage:
- * 1. Create an instance.
- * 2. Add numbers using the |add| method.
- * 3. Query statistics.
- * 4. Repeat from step 2.
- *
- * @constructor
- */
- function RunningStatistics() {
- this.mean_ = 0;
- this.count_ = 0;
- this.max_ = -Infinity;
- this.min_ = Infinity;
- this.sum_ = 0;
- this.variance_ = 0;
- }
-
- RunningStatistics.prototype = {
- get count() {
- return this.count_;
- },
-
- get mean() {
- if (this.count_ == 0)
- return undefined;
- return this.mean_;
- },
-
- get max() {
- return this.max_;
- },
-
- get min() {
- return this.min_;
- },
-
- get sum() {
- return this.sum_;
- },
-
- get variance() {
- if (this.count_ == 0)
- return undefined;
- if (this.count_ == 1)
- return 0;
- return this.variance_ / (this.count_ - 1);
- },
-
- get stddev() {
- if (this.count_ == 0)
- return undefined;
- return Math.sqrt(this.variance);
- },
-
- add: function(x) {
- this.count_++;
- this.max_ = Math.max(this.max_, x);
- this.min_ = Math.min(this.min_, x);
- this.sum_ += x;
- // The following uses Welford's algorithm for computing running mean
- // and variance. See http://www.johndcook.com/blog/standard_deviation.
- if (this.count_ === 1) {
- this.mean_ = x;
- this.variance_ = 0;
- } else {
- var oldMean = this.mean_;
- var oldVariance = this.variance_;
- this.mean_ = oldMean + (x - oldMean) / this.count_;
- this.variance_ = oldVariance + (x - oldMean) * (x - this.mean_);
- }
- },
-
- merge: function(other) {
- var result = new RunningStatistics();
- result.count_ = this.count_ + other.count_;
- result.sum_ = this.sum_ + other.sum_;
- result.min_ = Math.min(this.min_, other.min_);
- result.max_ = Math.max(this.max_, other.max_);
- if (other.count_ === 0 && this.count_ === 0) {
- result.mean_ = 0;
- result.variance_ = 0;
- } else {
- // Combine the mean and the variance using the formulas from
- // https://goo.gl/ddcAep.
- var mx = this.mean_, my = other.mean_;
- var vx = this.variance_, vy = other.variance_;
- var n = this.count_, m = other.count_;
- result.mean_ = (n * mx + m * my) / (n + m);
- result.variance_ = vx + vy + n * m * (mx - my) * (mx - my) / (n + m);
- }
- return result;
- },
-
- asDict: function() {
- return {
- mean: this.mean_,
- count: this.count_,
- max: this.max_,
- min: this.min_,
- sum: this.sum_,
- variance: this.variance_
- };
- }
- };
-
- RunningStatistics.fromDict = function(d) {
- var result = new RunningStatistics();
- result.mean_ = d.mean;
- result.count_ = d.count;
- result.max_ = d.max;
- result.min_ = d.min;
- result.sum_ = d.sum;
- result.variance_ = d.variance;
- return result;
- };
-
- return {
- RunningStatistics: RunningStatistics
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/running_statistics_test.html b/chromium/third_party/catapult/tracing/tracing/base/running_statistics_test.html
deleted file mode 100644
index 5aba2cf644c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/running_statistics_test.html
+++ /dev/null
@@ -1,155 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/running_statistics.html">
-<link rel="import" href="/tracing/base/statistics.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var RunningStatistics = tr.b.RunningStatistics;
- var Statistics = tr.b.Statistics;
-
- function run(data) {
- var running = new RunningStatistics();
- data.forEach(x => running.add(x));
- return running;
- }
-
- test('sum', function() {
- var data;
- data = [];
- assert.closeTo(Statistics.sum(data), run(data).sum, 1e-6);
- data = [1];
- assert.closeTo(Statistics.sum(data), run(data).sum, 1e-6);
- data = [1, 2, 3];
- assert.closeTo(Statistics.sum(data), run(data).sum, 1e-6);
- data = [2, 4, 4, 2];
- assert.closeTo(Statistics.sum(data), run(data).sum, 1e-6);
- });
-
- test('min', function() {
- var data;
- data = [];
- assert.equal(Statistics.min(data), run(data).min);
- data = [1];
- assert.equal(Statistics.min(data), run(data).min);
- data = [1, 2, 3];
- assert.equal(Statistics.min(data), run(data).min);
- data = [2, 4, 4, 2];
- assert.equal(Statistics.min(data), run(data).min);
- });
-
- test('max', function() {
- var data;
- data = [];
- assert.equal(Statistics.max(data), run(data).max);
- data = [1];
- assert.equal(Statistics.max(data), run(data).max);
- data = [1, 2, 3];
- assert.equal(Statistics.max(data), run(data).max);
- data = [2, 4, 4, 2];
- assert.equal(Statistics.max(data), run(data).max);
- });
-
- test('mean', function() {
- var data;
- data = [];
- assert.equal(Statistics.mean(data), run(data).mean);
- data = [1];
- assert.equal(Statistics.mean(data), run(data).mean);
- data = [1, 2, 3];
- assert.closeTo(Statistics.mean(data), run(data).mean, 1e-6);
- data = [2, 4, 4, 2];
- assert.closeTo(Statistics.mean(data), run(data).mean, 1e-6);
- });
-
- test('variance', function() {
- var data;
- data = [];
- assert.equal(Statistics.variance(data), run(data).variance);
- data = [1];
- assert.equal(Statistics.variance(data), run(data).variance);
- data = [1, 2, 3];
- assert.closeTo(Statistics.variance(data), run(data).variance, 1e-6);
- data = [2, 4, 4, 2];
- assert.closeTo(Statistics.variance(data), run(data).variance, 1e-6);
- });
-
- test('stddev', function() {
- var data;
- data = [];
- assert.equal(Statistics.stddev(data), run(data).stddev);
- data = [1];
- assert.equal(Statistics.stddev(data), run(data).stddev);
- data = [1, 2, 3];
- assert.closeTo(Statistics.stddev(data), run(data).stddev, 1e-6);
- data = [2, 4, 4, 2];
- assert.closeTo(Statistics.stddev(data), run(data).stddev, 1e-6);
- });
-
- test('merge', function() {
- var data1, data2, data, stats;
- data1 = [];
- data2 = [];
- data = data1.concat(data2);
- stats = run(data1).merge(run(data2));
- assert.equal(Statistics.sum(data), stats.sum);
- assert.equal(Statistics.min(data), stats.min);
- assert.equal(Statistics.max(data), stats.max);
- assert.equal(Statistics.mean(data), stats.mean);
- assert.equal(Statistics.variance(data), stats.variance);
- assert.equal(Statistics.stddev(data), stats.stddev);
- data1 = [];
- data2 = [1, 2, 3];
- data = data1.concat(data2);
- stats = run(data1).merge(run(data2));
- assert.equal(Statistics.sum(data), stats.sum);
- assert.equal(Statistics.min(data), stats.min);
- assert.equal(Statistics.max(data), stats.max);
- assert.equal(Statistics.mean(data), stats.mean);
- assert.closeTo(Statistics.variance(data), stats.variance, 1e-6);
- assert.closeTo(Statistics.stddev(data), stats.stddev, 1e-6);
- data1 = [1, 2, 3];
- data2 = [];
- data = data1.concat(data2);
- stats = run(data1).merge(run(data2));
- assert.equal(Statistics.sum(data), stats.sum);
- assert.equal(Statistics.min(data), stats.min);
- assert.equal(Statistics.max(data), stats.max);
- assert.equal(Statistics.mean(data), stats.mean);
- assert.closeTo(Statistics.variance(data), stats.variance, 1e-6);
- assert.closeTo(Statistics.stddev(data), stats.stddev, 1e-6);
- data1 = [1, 2, 3];
- data2 = [10, 20, 100];
- data = data1.concat(data2);
- stats = run(data1).merge(run(data2));
- assert.equal(Statistics.sum(data), stats.sum);
- assert.equal(Statistics.min(data), stats.min);
- assert.equal(Statistics.max(data), stats.max);
- assert.equal(Statistics.mean(data), stats.mean);
- assert.closeTo(Statistics.variance(data), stats.variance, 1e-6);
- assert.closeTo(Statistics.stddev(data), stats.stddev, 1e-6);
- data1 = [1, 1, 1, 1, 1];
- data2 = [10, 20, 10, 40];
- data = data1.concat(data2);
- stats = run(data1).merge(run(data2));
- assert.equal(Statistics.sum(data), stats.sum);
- assert.equal(Statistics.min(data), stats.min);
- assert.equal(Statistics.max(data), stats.max);
- assert.equal(Statistics.mean(data), stats.mean);
- assert.closeTo(Statistics.variance(data), stats.variance, 1e-6);
- assert.closeTo(Statistics.stddev(data), stats.stddev, 1e-6);
- });
-
- test('serialization', function() {
- var data;
- data = [1, 2, 3];
- var stats = run(data);
- assert.deepEqual(stats, RunningStatistics.fromDict(stats.asDict()));
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/settings.html b/chromium/third_party/catapult/tracing/tracing/base/settings.html
deleted file mode 100644
index 2c53956e4e4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/settings.html
+++ /dev/null
@@ -1,204 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the Settings object.
- */
-tr.exportTo('tr.b', function() {
- /**
- * Settings is a simple wrapper around local storage, to make it easier
- * to test classes that have settings.
- *
- * May be called as new tr.b.Settings() or simply tr.b.Settings()
- * @constructor
- */
- function Settings() {
- return Settings;
- };
-
- if (tr.b.unittest && tr.b.unittest.TestRunner) {
- tr.b.unittest.TestRunner.addEventListener(
- 'tr-unittest-will-run',
- function() {
- if (tr.isHeadless)
- Settings.setAlternativeStorageInstance(new HeadlessStorage());
- else
- Settings.setAlternativeStorageInstance(global.sessionStorage);
- });
- }
-
- function SessionSettings() {
- return SessionSettings;
- }
-
- function AddStaticStorageFunctionsToClass_(input_class, storage) {
- input_class.storage_ = storage;
-
- /**
- * Get the setting with the given name.
- *
- * @param {string} key The name of the setting.
- * @param {string=} opt_default The default value to return if not set.
- * @param {string=} opt_namespace If set, the setting name will be prefixed
- * with this namespace, e.g. "categories.settingName". This is useful for
- * a set of related settings.
- */
- input_class.get = function(key, opt_default, opt_namespace) {
- key = input_class.namespace_(key, opt_namespace);
- var rawVal = input_class.storage_.getItem(key);
- if (rawVal === null || rawVal === undefined)
- return opt_default;
-
- // Old settings versions used to stringify objects instead of putting them
- // into JSON. If those are encountered, parse will fail. In that case,
- // "upgrade" the setting to the default value.
- try {
- return JSON.parse(rawVal).value;
- } catch (e) {
- input_class.storage_.removeItem(key);
- return opt_default;
- }
- };
-
- /**
- * Set the setting with the given name to the given value.
- *
- * @param {string} key The name of the setting.
- * @param {string} value The value of the setting.
- * @param {string=} opt_namespace If set, the setting name will be prefixed
- * with this namespace, e.g. "categories.settingName". This is useful for
- * a set of related settings.
- */
- input_class.set = function(key, value, opt_namespace) {
- if (value === undefined)
- throw new Error('Settings.set: value must not be undefined');
- var v = JSON.stringify({value: value});
- input_class.storage_.setItem(
- input_class.namespace_(key, opt_namespace), v);
- };
-
- /**
- * Return a list of all the keys, or all the keys in the given namespace
- * if one is provided.
- *
- * @param {string=} opt_namespace If set, only return settings which
- * begin with this prefix.
- */
- input_class.keys = function(opt_namespace) {
- var result = [];
- opt_namespace = opt_namespace || '';
- for (var i = 0; i < input_class.storage_.length; i++) {
- var key = input_class.storage_.key(i);
- if (input_class.isnamespaced_(key, opt_namespace))
- result.push(input_class.unnamespace_(key, opt_namespace));
- }
- return result;
- };
-
- input_class.isnamespaced_ = function(key, opt_namespace) {
- return key.indexOf(input_class.normalize_(opt_namespace)) == 0;
- };
-
- input_class.namespace_ = function(key, opt_namespace) {
- return input_class.normalize_(opt_namespace) + key;
- };
-
- input_class.unnamespace_ = function(key, opt_namespace) {
- return key.replace(input_class.normalize_(opt_namespace), '');
- };
-
- /**
- * All settings are prefixed with a global namespace to avoid collisions.
- * input_class may also be namespaced with an additional prefix passed into
- * the get, set, and keys methods in order to group related settings.
- * This method makes sure the two namespaces are always set properly.
- */
- input_class.normalize_ = function(opt_namespace) {
- return input_class.NAMESPACE + (opt_namespace ? opt_namespace + '.' : '');
- };
-
- input_class.setAlternativeStorageInstance = function(instance) {
- input_class.storage_ = instance;
- };
-
- input_class.getAlternativeStorageInstance = function() {
- if (!tr.isHeadless && input_class.storage_ === localStorage)
- return undefined;
- return input_class.storage_;
- };
-
- input_class.NAMESPACE = 'trace-viewer';
- };
-
- function HeadlessStorage() {
- this.length = 0;
- this.hasItem_ = {};
- this.items_ = {};
- this.itemsAsArray_ = undefined;
- }
- HeadlessStorage.prototype = {
- key: function(index) {
- return this.itemsAsArray[index];
- },
-
- get itemsAsArray() {
- if (this.itemsAsArray_ !== undefined)
- return this.itemsAsArray_;
- var itemsAsArray = [];
- for (var k in this.items_)
- itemsAsArray.push(k);
- this.itemsAsArray_ = itemsAsArray;
- return this.itemsAsArray_;
- },
-
- getItem: function(key) {
- if (!this.hasItem_[key])
- return null;
- return this.items_[key];
- },
-
- removeItem: function(key) {
- if (!this.hasItem_[key])
- return;
- var value = this.items_[key];
- delete this.hasItem_[key];
- delete this.items_[key];
- this.length--;
- this.itemsAsArray_ = undefined;
- return value;
- },
-
- setItem: function(key, value) {
- if (this.hasItem_[key]) {
- this.items_[key] = value;
- return;
- }
- this.items_[key] = value;
- this.hasItem_[key] = true;
- this.length++;
- this.itemsAsArray_ = undefined;
- return value;
- }
- };
-
- if (tr.isHeadless) {
- AddStaticStorageFunctionsToClass_(Settings, new HeadlessStorage());
- AddStaticStorageFunctionsToClass_(SessionSettings, new HeadlessStorage());
- } else {
- AddStaticStorageFunctionsToClass_(Settings, localStorage);
- AddStaticStorageFunctionsToClass_(SessionSettings, sessionStorage);
- }
-
- return {
- Settings: Settings,
- SessionSettings: SessionSettings
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/settings_test.html b/chromium/third_party/catapult/tracing/tracing/base/settings_test.html
deleted file mode 100644
index 8c9ea50d9b7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/settings_test.html
+++ /dev/null
@@ -1,113 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/settings.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function assertSettingIs(expectedValue, key) {
- assert.equal(tr.b.Settings.get(key), expectedValue);
- }
-
- // Old settings versions used to stringify objects instead of putting them
- // into JSON. This test makes sure that these old settings yield the default
- // value instead of strings.
- test('oldStyleSettingYieldsDefaultValue', function() {
- var storage = tr.b.Settings.getAlternativeStorageInstance();
- storage.setItem(tr.b.Settings.namespace_('key'), 'hello world');
-
- assert.equal(tr.b.Settings.get('key', 'value'), 'value');
- });
-
- test('setGetString', function() {
- var settings = new tr.b.Settings();
- settings.set('my_key', 'my_val');
- assert.equal(settings.get('my_key'), 'my_val');
- // tr.b.Settings() is a singleton
- assert.equal(tr.b.Settings().get('my_key'), 'my_val');
- });
-
- test('setGetNumber', function() {
- var settings = new tr.b.Settings();
- settings.set('my_key', 5);
- assertSettingIs(5, 'my_key');
- });
-
- test('setGetBool', function() {
- var settings = new tr.b.Settings();
- settings.set('my_key', false);
- assertSettingIs(false, 'my_key');
- });
-
- test('setGetObject', function() {
- var settings = new tr.b.Settings();
- settings.set('my_key', {'hello': 5});
- assert.deepEqual(settings.get('my_key'), {'hello': 5});
- });
-
- test('setInvalidObject', function() {
- var settings = new tr.b.Settings();
- var obj = {'hello': undefined};
- obj.hello = obj;
- assert.throws(function() {
- settings.set('my_key', obj);
- });
- });
-
- test('setUndefined', function() {
- var settings = new tr.b.Settings();
- assert.throws(function() {
- settings.set('my_key', undefined);
- });
- });
-
- test('getUnset', function() {
- var settings = new tr.b.Settings();
- // Undefined should be returned if value isn't set.
- assertSettingIs(undefined, 'my_key');
- });
-
- test('getDefault', function() {
- var settings = new tr.b.Settings();
- // default_val should be returned if value isn't set.
- assert.equal(settings.get('my_key', 'default_val'), 'default_val');
- });
-
- test('setGetPrefix', function() {
- var settings = new tr.b.Settings();
- settings.set('key_a', 'foo', 'my_prefix');
- assert.equal(settings.get('key_a', undefined, 'my_prefix'), 'foo');
- assert.equal(settings.get('key_a', 'bar', 'my_prefix'), 'foo');
- assert.isUndefined(settings.get('key_a'));
- assert.equal(settings.get('key_a', 'bar'), 'bar');
- });
-
- test('keys', function() {
- var settings = new tr.b.Settings();
- settings.set('key_a', 'foo');
- settings.set('key_b', 'bar');
- settings.set('key_c', 'baz');
- assert.sameMembers(settings.keys(), ['key_a', 'key_b', 'key_c']);
- });
-
- test('keysPrefix', function() {
- var settings = new tr.b.Settings();
- settings.set('key_a', 'foo', 'prefix1');
- settings.set('key_b', 'bar', 'prefix1');
- settings.set('key_c', 'baz', 'prefix1');
- settings.set('key_a', 'foo', 'prefix2');
- settings.set('key_b', 'bar', 'prefix2');
- settings.set('key_C', 'baz', 'prefix2');
- assert.sameMembers(settings.keys('prefix1'), ['key_a', 'key_b', 'key_c']);
- assert.sameMembers(settings.keys('prefix2'), ['key_C', 'key_a', 'key_b']);
- assert.sameMembers(
- settings.keys(),
- ['prefix1.key_a', 'prefix1.key_b', 'prefix1.key_c',
- 'prefix2.key_C', 'prefix2.key_a', 'prefix2.key_b']);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/sorted_array_utils.html b/chromium/third_party/catapult/tracing/tracing/base/sorted_array_utils.html
deleted file mode 100644
index 44d4c80fff2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/sorted_array_utils.html
+++ /dev/null
@@ -1,334 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-/**
- * @fileoverview Helper functions for doing intersections and iteration
- * over sorted arrays and intervals.
- *
- */
-tr.exportTo('tr.b', function() {
- /**
- * Finds the first index in the array whose value is >= loVal.
- *
- * The key for the search is defined by the mapFn. This array must
- * be prearranged such that ary.map(mapFn) would also be sorted in
- * ascending order.
- *
- * @param {Array} ary An array of arbitrary objects.
- * @param {function():*} mapFn Callback that produces a key value
- * from an element in ary.
- * @param {number} loVal Value for which to search.
- * @return {Number} Offset o into ary where all ary[i] for i <= o
- * are < loVal, or ary.length if loVal is greater than all elements in
- * the array.
- */
- function findLowIndexInSortedArray(ary, mapFn, loVal) {
- if (ary.length == 0)
- return 1;
-
- var low = 0;
- var high = ary.length - 1;
- var i, comparison;
- var hitPos = -1;
- while (low <= high) {
- i = Math.floor((low + high) / 2);
- comparison = mapFn(ary[i]) - loVal;
- if (comparison < 0) {
- low = i + 1; continue;
- } else if (comparison > 0) {
- high = i - 1; continue;
- } else {
- hitPos = i;
- high = i - 1;
- }
- }
- // return where we hit, or failing that the low pos
- return hitPos != -1 ? hitPos : low;
- }
-
- // From devtools/front_end/platform/utilities.js upperBound
- function findHighIndexInSortedArray(ary, mapFn, loVal, hiVal) {
- var lo = loVal || 0;
- var hi = hiVal !== undefined ? hiVal : ary.length;
- while (lo < hi) {
- var mid = (lo + hi) >> 1;
- if (mapFn(ary[mid]) >= 0)
- lo = mid + 1;
- else
- hi = mid;
- }
- return hi;
- }
-
- /**
- * Finds an index in an array of intervals that either intersects
- * the provided loVal, or if no intersection is found, -1 or ary.length.
- *
- * The array of intervals is defined implicitly via two mapping functions
- * over the provided ary. mapLoFn determines the lower value of the interval,
- * mapWidthFn the width. Intersection is lower-inclusive, e.g. [lo,lo+w).
- *
- * The array of intervals formed by this mapping must be non-overlapping and
- * sorted in ascending order by loVal.
- *
- * @param {Array} ary An array of objects that can be converted into sorted
- * nonoverlapping ranges [x,y) using the mapLoFn and mapWidth.
- * @param {function():*} mapLoFn Callback that produces the low value for the
- * interval represented by an element in the array.
- * @param {function():*} mapWidthFn Callback that produces the width for the
- * interval represented by an element in the array.
- * @param {number} loVal The low value for the search.
- * @return {Number} An index in the array that intersects or is first-above
- * loVal, -1 if none found and loVal is below than all the intervals,
- * ary.length if loVal is greater than all the intervals.
- */
- function findIndexInSortedIntervals(ary, mapLoFn, mapWidthFn, loVal) {
- var first = findLowIndexInSortedArray(ary, mapLoFn, loVal);
- if (first == 0) {
- if (loVal >= mapLoFn(ary[0]) &&
- loVal < mapLoFn(ary[0]) + mapWidthFn(ary[0], 0)) {
- return 0;
- } else {
- return -1;
- }
- } else if (first < ary.length) {
- if (loVal >= mapLoFn(ary[first]) &&
- loVal < mapLoFn(ary[first]) + mapWidthFn(ary[first], first)) {
- return first;
- } else if (loVal >= mapLoFn(ary[first - 1]) &&
- loVal < mapLoFn(ary[first - 1]) +
- mapWidthFn(ary[first - 1], first - 1)) {
- return first - 1;
- } else {
- return ary.length;
- }
- } else if (first == ary.length) {
- if (loVal >= mapLoFn(ary[first - 1]) &&
- loVal < mapLoFn(ary[first - 1]) +
- mapWidthFn(ary[first - 1], first - 1)) {
- return first - 1;
- } else {
- return ary.length;
- }
- } else {
- return ary.length;
- }
- }
-
- /**
- * Finds an index in an array of sorted closed intervals that either
- * intersects the provided val, or if no intersection is found, -1 or
- * ary.length.
- *
- * The array of intervals is defined implicitly via two mapping functions
- * over the provided ary. mapLoFn determines the lower value of the interval,
- * mapHiFn the high. Intersection is closed, e.g. [lo,hi], unlike with
- * findIndexInSortedIntervals, which is right-open.
- *
- * The array of intervals formed by this mapping must be non-overlapping, and
- * sorted in ascending order by val.
- *
- * @param {Array} ary An array of objects that can be converted into sorted
- * nonoverlapping ranges [x,y) using the mapLoFn and mapWidth.
- * @param {function():*} mapLoFn Callback that produces the low value for the
- * interval represented by an element in the array.
- * @param {function():*} mapHiFn Callback that produces the high for the
- * interval represented by an element in the array.
- * @param {number} val The value for the search.
- * @return {Number} An index in the array that intersects or is first-above
- * val, -1 if none found and val is below than all the intervals,
- * ary.length if val is greater than all the intervals.
- */
- function findIndexInSortedClosedIntervals(ary, mapLoFn, mapHiFn, val) {
- var i = findLowIndexInSortedArray(ary, mapLoFn, val);
- if (i === 0) {
- if (val >= mapLoFn(ary[0], 0) &&
- val <= mapHiFn(ary[0], 0)) {
- return 0;
- } else {
- return -1;
- }
- } else if (i < ary.length) {
- if (val >= mapLoFn(ary[i - 1], i - 1) &&
- val <= mapHiFn(ary[i - 1], i - 1)) {
- return i - 1;
- } else if (val >= mapLoFn(ary[i], i) &&
- val <= mapHiFn(ary[i], i)) {
- return i;
- } else {
- return ary.length;
- }
- } else if (i == ary.length) {
- if (val >= mapLoFn(ary[i - 1], i - 1) &&
- val <= mapHiFn(ary[i - 1], i - 1)) {
- return i - 1;
- } else {
- return ary.length;
- }
- } else {
- return ary.length;
- }
- }
-
- /**
- * Calls cb for all intervals in the implicit array of intervals
- * defnied by ary, mapLoFn and mapHiFn that intersect the range
- * [loVal,hiVal)
- *
- * This function uses the same scheme as findLowIndexInSortedArray
- * to define the intervals. The same restrictions on sortedness and
- * non-overlappingness apply.
- *
- * @param {Array} ary An array of objects that can be converted into sorted
- * nonoverlapping ranges [x,y) using the mapLoFn and mapWidth.
- * @param {function():*} mapLoFn Callback that produces the low value for the
- * interval represented by an element in the array.
- * @param {function():*} mapWidthFn Callback that produces the width for the
- * interval represented by an element in the array.
- * @param {number} loVal The low value for the search, inclusive.
- * @param {number} hiVal The high value for the search, non inclusive.
- * @param {function():*} cb The function to run for intersecting intervals.
- */
- function iterateOverIntersectingIntervals(ary, mapLoFn, mapWidthFn, loVal,
- hiVal, cb) {
- if (ary.length == 0)
- return;
-
- if (loVal > hiVal) return;
-
- var i = findLowIndexInSortedArray(ary, mapLoFn, loVal);
- if (i == -1) {
- return;
- }
- if (i > 0) {
- var hi = mapLoFn(ary[i - 1]) + mapWidthFn(ary[i - 1], i - 1);
- if (hi >= loVal) {
- cb(ary[i - 1], i - 1);
- }
- }
- if (i == ary.length) {
- return;
- }
-
- for (var n = ary.length; i < n; i++) {
- var lo = mapLoFn(ary[i]);
- if (lo >= hiVal)
- break;
- cb(ary[i], i);
- }
- }
-
- /**
- * Non iterative version of iterateOverIntersectingIntervals.
- *
- * @return {Array} Array of elements in ary that intersect loVal, hiVal.
- */
- function getIntersectingIntervals(ary, mapLoFn, mapWidthFn, loVal, hiVal) {
- var tmp = [];
- iterateOverIntersectingIntervals(ary, mapLoFn, mapWidthFn, loVal, hiVal,
- function(d) {
- tmp.push(d);
- });
- return tmp;
- }
-
- /**
- * Finds the element in the array whose value is closest to |val|.
- *
- * The same restrictions on sortedness as for findLowIndexInSortedArray apply.
- *
- * @param {Array} ary An array of arbitrary objects.
- * @param {function():*} mapFn Callback that produces a key value
- * from an element in ary.
- * @param {number} val Value for which to search.
- * @param {number} maxDiff Maximum allowed difference in value between |val|
- * and an element's value.
- * @return {object} Object in the array whose value is closest to |val|, or
- * null if no object is within range.
- */
- function findClosestElementInSortedArray(ary, mapFn, val, maxDiff) {
- if (ary.length === 0)
- return null;
-
- var aftIdx = findLowIndexInSortedArray(ary, mapFn, val);
- var befIdx = aftIdx > 0 ? aftIdx - 1 : 0;
-
- if (aftIdx === ary.length)
- aftIdx -= 1;
-
- var befDiff = Math.abs(val - mapFn(ary[befIdx]));
- var aftDiff = Math.abs(val - mapFn(ary[aftIdx]));
-
- if (befDiff > maxDiff && aftDiff > maxDiff)
- return null;
-
- var idx = befDiff < aftDiff ? befIdx : aftIdx;
- return ary[idx];
- }
-
- /**
- * Finds the closest interval in the implicit array of intervals
- * defined by ary, mapLoFn and mapHiFn.
- *
- * This function uses the same scheme as findLowIndexInSortedArray
- * to define the intervals. The same restrictions on sortedness and
- * non-overlappingness apply.
- *
- * @param {Array} ary An array of objects that can be converted into sorted
- * nonoverlapping ranges [x,y) using the mapLoFn and mapHiFn.
- * @param {function():*} mapLoFn Callback that produces the low value for the
- * interval represented by an element in the array.
- * @param {function():*} mapHiFn Callback that produces the high for the
- * interval represented by an element in the array.
- * @param {number} val The value for the search.
- * @param {number} maxDiff Maximum allowed difference in value between |val|
- * and an interval's low or high value.
- * @return {interval} Interval in the array whose high or low value is closest
- * to |val|, or null if no interval is within range.
- */
- function findClosestIntervalInSortedIntervals(ary, mapLoFn, mapHiFn, val,
- maxDiff) {
- if (ary.length === 0)
- return null;
-
- var idx = findLowIndexInSortedArray(ary, mapLoFn, val);
- if (idx > 0)
- idx -= 1;
-
- var hiInt = ary[idx];
- var loInt = hiInt;
-
- if (val > mapHiFn(hiInt) && idx + 1 < ary.length)
- loInt = ary[idx + 1];
-
- var loDiff = Math.abs(val - mapLoFn(loInt));
- var hiDiff = Math.abs(val - mapHiFn(hiInt));
-
- if (loDiff > maxDiff && hiDiff > maxDiff)
- return null;
-
- if (loDiff < hiDiff)
- return loInt;
- else
- return hiInt;
- }
-
- return {
- findLowIndexInSortedArray: findLowIndexInSortedArray,
- findHighIndexInSortedArray: findHighIndexInSortedArray,
- findIndexInSortedIntervals: findIndexInSortedIntervals,
- findIndexInSortedClosedIntervals: findIndexInSortedClosedIntervals,
- iterateOverIntersectingIntervals: iterateOverIntersectingIntervals,
- getIntersectingIntervals: getIntersectingIntervals,
- findClosestElementInSortedArray: findClosestElementInSortedArray,
- findClosestIntervalInSortedIntervals: findClosestIntervalInSortedIntervals
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/sorted_array_utils_test.html b/chromium/third_party/catapult/tracing/tracing/base/sorted_array_utils_test.html
deleted file mode 100644
index ef50caa0df1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/sorted_array_utils_test.html
+++ /dev/null
@@ -1,239 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ArrayOfIntervals = function(array) {
- this.array = array;
- }
-
- ArrayOfIntervals.prototype = {
-
- get: function(index) {
- return this.array[index];
- },
-
- findLowElementIndex: function(ts) {
- return tr.b.findLowIndexInSortedArray(
- this.array,
- function(x) { return x.lo; },
- ts);
- },
-
- findIntervalIndex: function(ts) {
- return tr.b.findIndexInSortedIntervals(
- this.array,
- function(x) { return x.lo; },
- function(x) { return x.hi - x.lo; },
- ts);
- },
-
- findIndexInClosedIntervals: function(ts) {
- return tr.b.findIndexInSortedClosedIntervals(
- this.array,
- function(x) { return x.lo; },
- function(x) { return x.hi; },
- ts);
- },
-
- findIntersectingIntervals: function(tsA, tsB) {
- var array = this.array;
- var result = [];
- tr.b.iterateOverIntersectingIntervals(
- this.array,
- function(x) { return x.lo; },
- function(x) { return x.hi - x.lo; },
- tsA,
- tsB,
- function(x) { result.push(array.indexOf(x)); });
- return result;
- },
-
- findClosestElement: function(ts, tsDiff) {
- return tr.b.findClosestElementInSortedArray(
- this.array,
- function(x) { return x.lo; },
- ts,
- tsDiff);
- },
-
- findClosestInterval: function(ts, tsDiff) {
- return tr.b.findClosestIntervalInSortedIntervals(
- this.array,
- function(x) { return x.lo; },
- function(x) { return x.hi; },
- ts,
- tsDiff);
- }
- };
-
- test('findLowElementIndex', function() {
- var array = new ArrayOfIntervals([
- {lo: 10, hi: 15},
- {lo: 20, hi: 30}
- ]);
-
- assert.equal(array.findLowElementIndex(-100), 0);
- assert.equal(array.findLowElementIndex(0), 0);
- assert.equal(array.findLowElementIndex(10), 0);
-
- assert.equal(array.findLowElementIndex(10.1), 1);
- assert.equal(array.findLowElementIndex(15), 1);
- assert.equal(array.findLowElementIndex(20), 1);
-
- assert.equal(array.findLowElementIndex(20.1), 2);
- assert.equal(array.findLowElementIndex(21), 2);
- assert.equal(array.findLowElementIndex(100), 2);
- });
-
- test('findIntervalIndex', function() {
- var array = new ArrayOfIntervals([
- {lo: 10, hi: 15},
- {lo: 20, hi: 30}
- ]);
-
- assert.equal(array.findIntervalIndex(0), -1);
- assert.equal(array.findIntervalIndex(9.9), -1);
-
- assert.equal(array.findIntervalIndex(10), 0);
- assert.equal(array.findIntervalIndex(12), 0);
- assert.equal(array.findIntervalIndex(14.9), 0);
-
- assert.equal(array.findIntervalIndex(20), 1);
- assert.equal(array.findIntervalIndex(21), 1);
- assert.equal(array.findIntervalIndex(29.99), 1);
-
- assert.equal(array.findIntervalIndex(30), 2);
- assert.equal(array.findIntervalIndex(40), 2);
-
-
- // misses, in between the intervals, return array length
- assert.equal(array.findIntervalIndex(15), 2);
- assert.equal(array.findIntervalIndex(19.9), 2);
- });
-
- test('findClosedIntervalIndex', function() {
- var array = new ArrayOfIntervals([
- {lo: 10, hi: 15},
- {lo: 15, hi: 20},
- {lo: 21, hi: 25}
- ]);
-
- assert.equal(array.findIndexInClosedIntervals(0), -1);
- assert.equal(array.findIndexInClosedIntervals(9.999), -1);
- assert.equal(array.findIndexInClosedIntervals(10), 0);
- assert.equal(array.findIndexInClosedIntervals(14), 0);
- assert.equal(array.findIndexInClosedIntervals(15), 0);
- assert.equal(array.findIndexInClosedIntervals(15.00001), 1);
- assert.equal(array.findIndexInClosedIntervals(20.5), 3);
- assert.equal(array.findIndexInClosedIntervals(22), 2);
- assert.equal(array.findIndexInClosedIntervals(25), 2);
- assert.equal(array.findIndexInClosedIntervals(25.00001), 3);
- });
-
- test('findClosedInEmptyArray', function() {
- var array = new ArrayOfIntervals([]);
- assert.equal(array.findIndexInClosedIntervals(0), 0);
- });
-
- test('findIntersectingIntervals', function() {
- var array = new ArrayOfIntervals([
- {lo: 10, hi: 15},
- {lo: 20, hi: 30}
- ]);
-
- assert.deepEqual(array.findIntersectingIntervals(0, 0), []);
- assert.deepEqual(array.findIntersectingIntervals(100, 0), []);
- assert.deepEqual(array.findIntersectingIntervals(0, 10), []);
-
- assert.deepEqual(array.findIntersectingIntervals(0, 10.1), [0]);
- assert.deepEqual(array.findIntersectingIntervals(5, 15), [0]);
- assert.deepEqual(array.findIntersectingIntervals(15, 20), [0]);
-
- assert.deepEqual(array.findIntersectingIntervals(15.1, 20), []);
-
- assert.deepEqual(array.findIntersectingIntervals(15.1, 20.1), [1]);
- assert.deepEqual(array.findIntersectingIntervals(20, 30), [1]);
- assert.deepEqual(array.findIntersectingIntervals(30, 100), [1]);
-
- assert.deepEqual(array.findIntersectingIntervals(0, 100), [0, 1]);
- assert.deepEqual(array.findIntersectingIntervals(15, 20.1), [0, 1]);
- });
-
- test('findClosestElement', function() {
- var array = new ArrayOfIntervals([
- {lo: 10, hi: 15},
- {lo: 20, hi: 30}
- ]);
-
- // Test the helper method first.
- assert.isUndefined(array.get(-1));
- assert.equal(array.get(0), array.array[0]);
- assert.equal(array.get(1), array.array[1]);
- assert.isUndefined(array.get(2));
-
- assert.isNull(array.findClosestElement(0, 0));
- assert.isNull(array.findClosestElement(0, 9.9));
- assert.isNull(array.findClosestElement(10, -10));
-
- assert.equal(array.get(0), array.findClosestElement(0, 10));
- assert.equal(array.get(0), array.findClosestElement(8, 5));
- assert.equal(array.get(0), array.findClosestElement(10, 0));
- assert.equal(array.get(0), array.findClosestElement(12, 2));
-
- assert.isNull(array.findClosestElement(15, 3));
- assert.isNotNull(array.findClosestElement(15, 5));
-
- assert.equal(array.get(1), array.findClosestElement(19, 1));
- assert.equal(array.get(1), array.findClosestElement(20, 0));
- assert.equal(array.get(1), array.findClosestElement(30, 15));
-
- assert.isNull(array.findClosestElement(30, 9.9));
- assert.isNull(array.findClosestElement(100, 50));
- });
-
- test('findClosestInterval', function() {
- var array = new ArrayOfIntervals([
- {lo: 10, hi: 15},
- {lo: 20, hi: 30}
- ]);
-
- assert.isNull(array.findClosestInterval(0, 0));
- assert.isNull(array.findClosestInterval(0, 9.9));
- assert.isNull(array.findClosestInterval(0, -100));
-
- assert.equal(array.get(0), array.findClosestInterval(0, 10));
- assert.equal(array.get(0), array.findClosestInterval(10, 0));
- assert.equal(array.get(0), array.findClosestInterval(12, 3));
- assert.equal(array.get(0), array.findClosestInterval(12, 100));
-
- assert.equal(array.get(0), array.findClosestInterval(13, 3));
- assert.equal(array.get(0), array.findClosestInterval(13, 20));
- assert.equal(array.get(0), array.findClosestInterval(15, 0));
-
- assert.isNull(array.findClosestInterval(17.5, 0));
- assert.isNull(array.findClosestInterval(17.5, 2.4));
- assert.isNotNull(array.findClosestInterval(17.5, 2.5));
- assert.isNotNull(array.findClosestInterval(17.5, 10));
-
- assert.equal(array.get(1), array.findClosestInterval(19, 2));
- assert.equal(array.get(1), array.findClosestInterval(20, 0));
- assert.equal(array.get(1), array.findClosestInterval(24, 100));
- assert.equal(array.get(1), array.findClosestInterval(26, 100));
-
- assert.equal(array.get(1), array.findClosestInterval(30, 0));
- assert.equal(array.get(1), array.findClosestInterval(35, 10));
- assert.equal(array.get(1), array.findClosestInterval(50, 100));
-
- assert.isNull(array.findClosestInterval(50, 19));
- assert.isNull(array.findClosestInterval(100, 50));
- assert.isNull(array.findClosestInterval(50, -100));
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/statistics.html b/chromium/third_party/catapult/tracing/tracing/base/statistics.html
deleted file mode 100644
index 9620de944a4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/statistics.html
+++ /dev/null
@@ -1,768 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/math.html">
-<link rel="import" href="/tracing/base/range.html">
-<script src="/mannwhitneyu/mannwhitneyu.js"></script>
-
-<script>
-'use strict';
-// In node, the script-src for mannwhitneyu above brings in mannwhitneyui
-// into a module, instead of into the global scope. Whereas this file
-// assumes that mannwhitneyu is in the global scope. So, in Node only, we
-// require() it in, and then take all its exports and shove them into the
-// global scope by hand.
-(function(global) {
- if (tr.isNode) {
- var mwuAbsPath = HTMLImportsLoader.hrefToAbsolutePath(
- '/mannwhitneyu.js');
- var mwuModule = require(mwuAbsPath);
- for (var exportName in mwuModule) {
- global[exportName] = mwuModule[exportName];
- }
- }
-})(this);
-</script>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
-
- function identity(d) {
- return d;
- }
-
- function Statistics() {
- }
-
- /* Returns the quotient, or zero if the denominator is zero.*/
- Statistics.divideIfPossibleOrZero = function(numerator, denominator) {
- if (denominator === 0)
- return 0;
- return numerator / denominator;
- };
-
- Statistics.sum = function(ary, opt_func, opt_this) {
- var func = opt_func || identity;
- var ret = 0;
- var i = 0;
- for (var elt of ary)
- ret += func.call(opt_this, elt, i++);
- return ret;
- };
-
- Statistics.mean = function(ary, opt_func, opt_this) {
- if (ary.length == 0)
- return undefined;
- return Statistics.sum(ary, opt_func, opt_this) / ary.length;
- };
-
- // Returns undefined if the sum of the weights is zero.
- Statistics.weightedMean = function(
- ary, weightCallback, opt_valueCallback, opt_this) {
- var valueCallback = opt_valueCallback || identity;
- var numerator = 0;
- var denominator = 0;
- var i = -1;
-
- for (var elt of ary) {
- i++;
- var value = valueCallback.call(opt_this, elt, i);
- if (value === undefined)
- continue;
- var weight = weightCallback.call(opt_this, elt, i, value);
- numerator += weight * value;
- denominator += weight;
- }
-
- if (denominator === 0)
- return undefined;
-
- return numerator / denominator;
- };
-
- Statistics.variance = function(ary, opt_func, opt_this) {
- if (ary.length === 0)
- return undefined;
- if (ary.length === 1)
- return 0;
- var func = opt_func || identity;
- var mean = Statistics.mean(ary, func, opt_this);
- var sumOfSquaredDistances = Statistics.sum(
- ary,
- function(d, i) {
- var v = func.call(this, d, i) - mean;
- return v * v;
- },
- opt_this);
- return sumOfSquaredDistances / (ary.length - 1);
- };
-
- Statistics.stddev = function(ary, opt_func, opt_this) {
- if (ary.length == 0)
- return undefined;
- return Math.sqrt(
- Statistics.variance(ary, opt_func, opt_this));
- };
-
- Statistics.max = function(ary, opt_func, opt_this) {
- var func = opt_func || identity;
- var ret = -Infinity;
- var i = 0;
- for (var elt of ary)
- ret = Math.max(ret, func.call(opt_this, elt, i++));
- return ret;
- };
-
- Statistics.min = function(ary, opt_func, opt_this) {
- var func = opt_func || identity;
- var ret = Infinity;
- var i = 0;
- for (var elt of ary)
- ret = Math.min(ret, func.call(opt_this, elt, i++));
- return ret;
- };
-
- Statistics.range = function(ary, opt_func, opt_this) {
- var func = opt_func || identity;
- var ret = new tr.b.Range();
- var i = 0;
- for (var elt of ary)
- ret.addValue(func.call(opt_this, elt, i++));
- return ret;
- };
-
- Statistics.percentile = function(ary, percent, opt_func, opt_this) {
- if (!(percent >= 0 && percent <= 1))
- throw new Error('percent must be [0,1]');
-
- var func = opt_func || identity;
- var tmp = new Array(ary.length);
- var i = 0;
- for (var elt of ary)
- tmp[i] = func.call(opt_this, elt, i++);
- tmp.sort((a, b) => a - b);
- var idx = Math.floor((ary.length - 1) * percent);
- return tmp[idx];
- };
-
- /* Clamp a value between some low and high value. */
- Statistics.clamp = function(value, opt_low, opt_high) {
- opt_low = opt_low || 0.0;
- opt_high = opt_high || 1.0;
- return Math.min(Math.max(value, opt_low), opt_high);
- };
-
- /**
- * Sorts the samples, and map them linearly to the range [0,1].
- *
- * They're mapped such that for the N samples, the first sample is 0.5/N and
- * the last sample is (N-0.5)/N.
- *
- * Background: The discrepancy of the sample set i/(N-1); i=0, ..., N-1 is
- * 2/N, twice the discrepancy of the sample set (i+1/2)/N; i=0, ..., N-1. In
- * our case we don't want to distinguish between these two cases, as our
- * original domain is not bounded (it is for Monte Carlo integration, where
- * discrepancy was first used).
- **/
- Statistics.normalizeSamples = function(samples) {
- if (samples.length === 0) {
- return {
- normalized_samples: samples,
- scale: 1.0
- };
- }
- // Create a copy to make sure that we don't mutate original |samples| input.
- samples = samples.slice().sort(
- function(a, b) {
- return a - b;
- }
- );
- var low = Math.min.apply(null, samples);
- var high = Math.max.apply(null, samples);
- var new_low = 0.5 / samples.length;
- var new_high = (samples.length - 0.5) / samples.length;
- if (high - low === 0.0) {
- // Samples is an array of 0.5 in this case.
- samples = Array.apply(null, new Array(samples.length)).map(
- function() { return 0.5;});
- return {
- normalized_samples: samples,
- scale: 1.0
- };
- }
- var scale = (new_high - new_low) / (high - low);
- for (var i = 0; i < samples.length; i++) {
- samples[i] = (samples[i] - low) * scale + new_low;
- }
- return {
- normalized_samples: samples,
- scale: scale
- };
- };
-
- /**
- * Computes the discrepancy of a set of 1D samples from the interval [0,1].
- *
- * The samples must be sorted. We define the discrepancy of an empty set
- * of samples to be zero.
- *
- * http://en.wikipedia.org/wiki/Low-discrepancy_sequence
- * http://mathworld.wolfram.com/Discrepancy.html
- */
- Statistics.discrepancy = function(samples, opt_location_count) {
- if (samples.length === 0)
- return 0.0;
-
- var max_local_discrepancy = 0;
- var inv_sample_count = 1.0 / samples.length;
- var locations = [];
- // For each location, stores the number of samples less than that location.
- var count_less = [];
- // For each location, stores the number of samples less than or equal to
- // that location.
- var count_less_equal = [];
-
- if (opt_location_count !== undefined) {
- // Generate list of equally spaced locations.
- var sample_index = 0;
- for (var i = 0; i < opt_location_count; i++) {
- var location = i / (opt_location_count - 1);
- locations.push(location);
- while (sample_index < samples.length &&
- samples[sample_index] < location) {
- sample_index += 1;
- }
- count_less.push(sample_index);
- while (sample_index < samples.length &&
- samples[sample_index] <= location) {
- sample_index += 1;
- }
- count_less_equal.push(sample_index);
- }
- } else {
- // Populate locations with sample positions. Append 0 and 1 if necessary.
- if (samples[0] > 0.0) {
- locations.push(0.0);
- count_less.push(0);
- count_less_equal.push(0);
- }
- for (var i = 0; i < samples.length; i++) {
- locations.push(samples[i]);
- count_less.push(i);
- count_less_equal.push(i + 1);
- }
- if (samples[-1] < 1.0) {
- locations.push(1.0);
- count_less.push(samples.length);
- count_less_equal.push(samples.length);
- }
- }
-
- // Compute discrepancy as max(overshoot, -undershoot), where
- // overshoot = max(count_closed(i, j)/N - length(i, j)) for all i < j,
- // undershoot = min(count_open(i, j)/N - length(i, j)) for all i < j,
- // N = len(samples),
- // count_closed(i, j) is the number of points between i and j
- // including ends,
- // count_open(i, j) is the number of points between i and j excluding ends,
- // length(i, j) is locations[i] - locations[j].
-
- // The following algorithm is modification of Kadane's algorithm,
- // see https://en.wikipedia.org/wiki/Maximum_subarray_problem.
-
- // The maximum of (count_closed(k, i-1)/N - length(k, i-1)) for any k < i-1.
- var max_diff = 0;
- // The minimum of (count_open(k, i-1)/N - length(k, i-1)) for any k < i-1.
- var min_diff = 0;
- for (var i = 1; i < locations.length; i++) {
- var length = locations[i] - locations[i - 1];
- var count_closed = count_less_equal[i] - count_less[i - 1];
- var count_open = count_less[i] - count_less_equal[i - 1];
- // Number of points that are added if we extend a closed range that
- // ends at location (i-1).
- var count_closed_increment =
- count_less_equal[i] - count_less_equal[i - 1];
- // Number of points that are added if we extend an open range that
- // ends at location (i-1).
- var count_open_increment = count_less[i] - count_less[i - 1];
-
- // Either extend the previous optimal range or start a new one.
- max_diff = Math.max(
- count_closed_increment * inv_sample_count - length + max_diff,
- count_closed * inv_sample_count - length);
- min_diff = Math.min(
- count_open_increment * inv_sample_count - length + min_diff,
- count_open * inv_sample_count - length);
-
- max_local_discrepancy = Math.max(
- max_diff, -min_diff, max_local_discrepancy);
- }
- return max_local_discrepancy;
- };
-
- /**
- * A discrepancy based metric for measuring timestamp jank.
- *
- * timestampsDiscrepancy quantifies the largest area of jank observed in a
- * series of timestamps. Note that this is different from metrics based on
- * the max_time_interval. For example, the time stamp series A = [0,1,2,3,5,6]
- * and B = [0,1,2,3,5,7] have the same max_time_interval = 2, but
- * Discrepancy(B) > Discrepancy(A).
- *
- * Two variants of discrepancy can be computed:
- *
- * Relative discrepancy is following the original definition of
- * discrepancy. It characterized the largest area of jank, relative to the
- * duration of the entire time stamp series. We normalize the raw results,
- * because the best case discrepancy for a set of N samples is 1/N (for
- * equally spaced samples), and we want our metric to report 0.0 in that
- * case.
- *
- * Absolute discrepancy also characterizes the largest area of jank, but its
- * value wouldn't change (except for imprecisions due to a low
- * |interval_multiplier|) if additional 'good' intervals were added to an
- * exisiting list of time stamps. Its range is [0,inf] and the unit is
- * milliseconds.
- *
- * The time stamp series C = [0,2,3,4] and D = [0,2,3,4,5] have the same
- * absolute discrepancy, but D has lower relative discrepancy than C.
- *
- * |timestamps| may be a list of lists S = [S_1, S_2, ..., S_N], where each
- * S_i is a time stamp series. In that case, the discrepancy D(S) is:
- * D(S) = max(D(S_1), D(S_2), ..., D(S_N))
- **/
- Statistics.timestampsDiscrepancy = function(timestamps, opt_absolute,
- opt_location_count) {
- if (timestamps.length === 0)
- return 0.0;
-
- if (opt_absolute === undefined)
- opt_absolute = true;
-
- if (Array.isArray(timestamps[0])) {
- var range_discrepancies = timestamps.map(function(r) {
- return Statistics.timestampsDiscrepancy(r);
- });
- return Math.max.apply(null, range_discrepancies);
- }
-
- var s = Statistics.normalizeSamples(timestamps);
- var samples = s.normalized_samples;
- var sample_scale = s.scale;
- var discrepancy = Statistics.discrepancy(samples, opt_location_count);
- var inv_sample_count = 1.0 / samples.length;
- if (opt_absolute === true) {
- // Compute absolute discrepancy
- discrepancy /= sample_scale;
- } else {
- // Compute relative discrepancy
- discrepancy = Statistics.clamp(
- (discrepancy - inv_sample_count) / (1.0 - inv_sample_count));
- }
- return discrepancy;
- };
-
- /**
- * A discrepancy based metric for measuring duration jank.
- *
- * DurationsDiscrepancy computes a jank metric which measures how irregular a
- * given sequence of intervals is. In order to minimize jank, each duration
- * should be equally long. This is similar to how timestamp jank works,
- * and we therefore reuse the timestamp discrepancy function above to compute
- * a similar duration discrepancy number.
- *
- * Because timestamp discrepancy is defined in terms of timestamps, we first
- * convert the list of durations to monotonically increasing timestamps.
- *
- * Args:
- * durations: List of interval lengths in milliseconds.
- * absolute: See TimestampsDiscrepancy.
- * opt_location_count: See TimestampsDiscrepancy.
- **/
- Statistics.durationsDiscrepancy = function(
- durations, opt_absolute, opt_location_count) {
- if (durations.length === 0)
- return 0.0;
-
- var timestamps = durations.reduce(function(prev, curr, index, array) {
- prev.push(prev[prev.length - 1] + curr);
- return prev;
- }, [0]);
- return Statistics.timestampsDiscrepancy(
- timestamps, opt_absolute, opt_location_count);
- };
-
-
- /**
- * A mechanism to uniformly sample elements from an arbitrary long stream.
- *
- * Call this method every time a new element is obtained from the stream,
- * passing always the same |samples| array and the |numSamples| you desire.
- * Also pass in the current |streamLength|, which is the same as the index of
- * |newElement| within that stream.
- *
- * The |samples| array will possibly be updated, replacing one of its element
- * with |newElements|. The length of |samples| will not be more than
- * |numSamples|.
- *
- * This method guarantees that after |streamLength| elements have been
- * processed each one has equal probability of being in |samples|. The order
- * of samples is not preserved though.
- *
- * Args:
- * samples: Array of elements that have already been selected. Start with [].
- * streamLength: The current length of the stream, up to |newElement|.
- * newElement: The element that was just extracted from the stream.
- * numSamples: The total number of samples desired.
- **/
- Statistics.uniformlySampleStream = function(samples, streamLength, newElement,
- numSamples) {
- if (streamLength <= numSamples) {
- if (samples.length >= streamLength)
- samples[streamLength - 1] = newElement;
- else
- samples.push(newElement);
- return;
- }
-
- var probToKeep = numSamples / streamLength;
- if (Math.random() > probToKeep)
- return; // New sample was rejected.
-
- // Keeping it, replace an alement randomly.
- var index = Math.floor(Math.random() * numSamples);
- samples[index] = newElement;
- };
-
- /**
- * A mechanism to merge two arrays of uniformly sampled elements in a way that
- * ensures elements in the final array are still sampled uniformly.
- *
- * This works similarly to sampleStreamUniform. The |samplesA| array will be
- * updated, some of its elements replaced by elements from |samplesB| in a
- * way that ensure that elements will be sampled uniformly.
- *
- * Args:
- * samplesA: Array of uniformly sampled elements, will be updated.
- * streamLengthA: The length of the stream from which |samplesA| was sampled.
- * samplesB: Other array of uniformly sampled elements, will NOT be updated.
- * streamLengthB: The length of the stream from which |samplesB| was sampled.
- * numSamples: The total number of samples desired, both in |samplesA| and
- * |samplesB|.
- **/
- Statistics.mergeSampledStreams = function(
- samplesA, streamLengthA,
- samplesB, streamLengthB, numSamples) {
- if (streamLengthB < numSamples) {
- // samplesB has not reached max capacity so every sample of stream B were
- // chosen with certainty. Add them one by one into samplesA.
- var nbElements = Math.min(streamLengthB, samplesB.length);
- for (var i = 0; i < nbElements; ++i) {
- Statistics.uniformlySampleStream(samplesA, streamLengthA + i + 1,
- samplesB[i], numSamples);
- }
- return;
- }
- if (streamLengthA < numSamples) {
- // samplesA has not reached max capacity so every sample of stream A were
- // chosen with certainty. Add them one by one into samplesB.
- var nbElements = Math.min(streamLengthA, samplesA.length);
- var tempSamples = samplesB.slice();
- for (var i = 0; i < nbElements; ++i) {
- Statistics.uniformlySampleStream(tempSamples, streamLengthB + i + 1,
- samplesA[i], numSamples);
- }
- // Copy that back into the first vector.
- for (var i = 0; i < tempSamples.length; ++i) {
- samplesA[i] = tempSamples[i];
- }
- return;
- }
-
- // Both sample arrays are at max capacity, use the power of maths!
- // Elements in samplesA have been selected with probability
- // numSamples / streamLengthA. Same for samplesB. For each index of the
- // array we keep samplesA[i] with probability
- // P = streamLengthA / (streamLengthA + streamLengthB)
- // and replace it with samplesB[i] with probability 1-P.
- // The total probability of keeping it is therefore
- // numSamples / streamLengthA *
- // streamLengthA / (streamLengthA + streamLengthB)
- // = numSamples / (streamLengthA + streamLengthB)
- // A similar computation shows we have the same probability of keeping any
- // element in samplesB. Magic!
- var nbElements = Math.min(numSamples, samplesB.length);
- var probOfSwapping = streamLengthB / (streamLengthA + streamLengthB);
- for (var i = 0; i < nbElements; ++i) {
- if (Math.random() < probOfSwapping) {
- samplesA[i] = samplesB[i];
- }
- }
- };
-
- /* Continuous distributions are defined by probability density functions.
- *
- * Random variables are referred to by capital letters: X, Y, Z.
- * Particular values from these distributions are referred to by lowercase
- * letters like |x|.
- * The probability that |X| ever exactly equals |x| is P(X==x) = 0.
- *
- * For a discrete probability distribution, aka histogram, see tr.v.Numeric.
- */
- function Distribution() {
- };
-
- Distribution.prototype = {
- /* The probability density of the random variable at value |x| is the
- * relative likelihood for this random variable to take on the given value
- * |x|.
- *
- * @param {number} x A value from the random distribution.
- * @return {number} probability density at x.
- */
- computeDensity: function(x) {
- throw Error('Not implemented');
- },
-
- /* A percentile is the probability that a sample from the distribution is
- * less than the given value |x|. This function is monotonically increasing.
- *
- * @param {number} x A value from the random distribution.
- * @return {number} P(X<x).
- */
- computePercentile: function(x) {
- throw Error('Not implemented');
- },
-
- /* A complementary percentile is the probability that a sample from the
- * distribution is greater than the given value |x|. This function is
- * monotonically decreasing.
- *
- * @param {number} x A value from the random distribution.
- * @return {number} P(X>x).
- */
- computeComplementaryPercentile: function(x) {
- return 1 - this.computePercentile(x);
- },
-
- /* Compute the mean of the probability distribution.
- *
- * @return {number} mean.
- */
- get mean() {
- throw Error('Not implemented');
- },
-
- /* The mode of a distribution is the most likely value.
- * The maximum of the computeDensity() function is at this mode.
- * @return {number} mode.
- */
- get mode() {
- throw Error('Not implemented');
- },
-
- /* The median is the center value of the distribution.
- * computePercentile(median) = computeComplementaryPercentile(median) = 0.5
- *
- * @return {number} median.
- */
- get median() {
- throw Error('Not implemented');
- },
-
- /* The standard deviation is a measure of how dispersed or spread out the
- * distribution is (this statistic has the same units as the values).
- *
- * @return {number} standard deviation.
- */
- get standardDeviation() {
- throw Error('Not implemented');
- },
-
- /* An alternative measure of how spread out the distribution is,
- * the variance is the square of the standard deviation.
- * @return {number} variance.
- */
- get variance() {
- throw Error('Not implemented');
- }
- };
-
- Statistics.UniformDistribution = function(opt_range) {
- if (!opt_range)
- opt_range = tr.b.Range.fromExplicitRange(0, 1);
- this.range = opt_range;
- };
-
- Statistics.UniformDistribution.prototype = {
- __proto__: Distribution.prototype,
-
- computeDensity: function(x) {
- return 1 / this.range.range;
- },
-
- computePercentile: function(x) {
- return tr.b.normalize(x, this.range.min, this.range.max);
- },
-
- get mean() {
- return this.range.center;
- },
-
- get mode() {
- return undefined;
- },
-
- get median() {
- return this.mean;
- },
-
- get standardDeviation() {
- return Math.sqrt(this.variance);
- },
-
- get variance() {
- return Math.pow(this.range.range, 2) / 12;
- }
- };
-
- /* The Normal or Gaussian distribution, or bell curve, is common in complex
- * processes such as are found in many of the natural sciences. If Z is the
- * standard normal distribution with mean = 0 and variance = 1, then the
- * general normal distribution is Y = mean + Z*sqrt(variance).
- * https://www.desmos.com/calculator/tqtbjm4s3z
- */
- Statistics.NormalDistribution = function(opt_mean, opt_variance) {
- this.mean_ = opt_mean || 0;
- this.variance_ = opt_variance || 1;
- this.standardDeviation_ = Math.sqrt(this.variance_);
- };
-
- Statistics.NormalDistribution.prototype = {
- __proto__: Distribution.prototype,
-
- computeDensity: function(x) {
- var scale = (1.0 / (this.standardDeviation * Math.sqrt(2.0 * Math.PI)));
- var exponent = -Math.pow(x - this.mean, 2) / (2.0 * this.variance);
- return scale * Math.exp(exponent);
- },
-
- computePercentile: function(x) {
- var standardizedX = ((x - this.mean) /
- Math.sqrt(2.0 * this.variance));
- return (1.0 + tr.b.erf(standardizedX)) / 2.0;
- },
-
- get mean() {
- return this.mean_;
- },
-
- get median() {
- return this.mean;
- },
-
- get mode() {
- return this.mean;
- },
-
- get standardDeviation() {
- return this.standardDeviation_;
- },
-
- get variance() {
- return this.variance_;
- }
- };
-
- /* The log-normal distribution is a continuous probability distribution of a
- * random variable whose logarithm is normally distributed.
- * If Y is the general normal distribution, then X = exp(Y) is the general
- * log-normal distribution.
- * X will have different parameters from Y,
- * so the mean of Y is called the "location" of X,
- * and the standard deviation of Y is called the "shape" of X.
- * The standard lognormal distribution exp(Z) has location = 0 and shape = 1.
- * https://www.desmos.com/calculator/tqtbjm4s3z
- */
- Statistics.LogNormalDistribution = function(opt_location, opt_shape) {
- this.normalDistribution_ = new Statistics.NormalDistribution(
- opt_location, Math.pow(opt_shape || 1, 2));
- };
-
- Statistics.LogNormalDistribution.prototype = {
- __proto__: Statistics.NormalDistribution.prototype,
-
- computeDensity: function(x) {
- return this.normalDistribution_.computeDensity(Math.log(x)) / x;
- },
-
- computePercentile: function(x) {
- return this.normalDistribution_.computePercentile(Math.log(x));
- },
-
- get mean() {
- return Math.exp(this.normalDistribution_.mean +
- (this.normalDistribution_.variance / 2));
- },
-
- get variance() {
- var nm = this.normalDistribution_.mean;
- var nv = this.normalDistribution_.variance;
- return (Math.exp(2 * (nm + nv)) -
- Math.exp(2 * nm + nv));
- },
-
- get standardDeviation() {
- return Math.sqrt(this.variance);
- },
-
- get median() {
- return Math.exp(this.normalDistribution_.mean);
- },
-
- get mode() {
- return Math.exp(this.normalDistribution_.mean -
- this.normalDistribution_.variance);
- }
- };
-
- /**
- * Instead of describing a LogNormalDistribution in terms of its "location"
- * and "shape", it can also be described in terms of its median
- * and the point at which its complementary cumulative distribution
- * function bends between the linear-ish region in the middle and the
- * exponential-ish region. When the distribution is used to compute
- * percentiles for log-normal random processes such as latency, as the latency
- * improves, it hits a point of diminishing returns, when it becomes
- * relatively difficult to improve the score further. This point of
- * diminishing returns is the first x-intercept of the third derivative of the
- * CDF, which is the second derivative of the PDF.
- *
- * https://www.desmos.com/calculator/cg5rnftabn
- *
- * @param {number} median The median of the distribution.
- * @param {number} diminishingReturns The point of diminishing returns.
- * @return {LogNormalDistribution}
- */
- Statistics.LogNormalDistribution.fromMedianAndDiminishingReturns =
- function(median, diminishingReturns) {
- diminishingReturns = Math.log(diminishingReturns / median);
- var shape = Math.sqrt(1 - 3 * diminishingReturns -
- Math.sqrt(Math.pow(diminishingReturns - 3, 2) - 8)) / 2;
- var location = Math.log(median);
- return new Statistics.LogNormalDistribution(location, shape);
- };
-
- Statistics.mwu = mannwhitneyu;
-
- return {
- Statistics: Statistics
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/statistics_test.html b/chromium/third_party/catapult/tracing/tracing/base/statistics_test.html
deleted file mode 100644
index 83c756c0a1a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/statistics_test.html
+++ /dev/null
@@ -1,541 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/statistics.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Statistics = tr.b.Statistics;
-
- /**
- * Lloyd relaxation in 1D.
- *
- * Keeps the position of the first and last sample.
- **/
- function relax(samples, opt_iterations) {
- opt_iterations = opt_iterations || 10;
- for (var i = 0; i < opt_iterations; i++) {
- var voronoi_boundaries = [];
- for (var j = 1; j < samples.length; j++)
- voronoi_boundaries.push((samples[j] + samples[j - 1]) * 0.5);
-
- var relaxed_samples = [];
- relaxed_samples.push(samples[0]);
- for (var j = 1; j < samples.length - 1; j++) {
- relaxed_samples.push(
- (voronoi_boundaries[j - 1] + voronoi_boundaries[j]) * 0.5);
- }
- relaxed_samples.push(samples[samples.length - 1]);
- samples = relaxed_samples;
- }
- return samples;
- }
-
- function createRandomSamples(num_samples) {
- var samples = [];
- var position = 0.0;
- samples.push(position);
- for (var i = 1; i < num_samples; i++) {
- position += Math.random();
- samples.push(position);
- }
- return samples;
- }
-
- test('normalDistribution', function() {
- for (var mean = -100; mean <= 100; mean += 25) {
- for (var stddev = 0.1; stddev < 2; stddev += 0.2) {
- var dist = new Statistics.NormalDistribution(mean, stddev * stddev);
- assert.closeTo(mean, dist.mean, 1e-6);
- assert.closeTo(stddev, dist.standardDeviation, 1e-6);
- assert.closeTo(0, dist.standardDeviation * dist.computeDensity(
- -1e10), 1e-5);
- assert.closeTo(0.05399, dist.standardDeviation * dist.computeDensity(
- dist.mean - 2 * dist.standardDeviation), 1e-5);
- assert.closeTo(0.24197, dist.standardDeviation * dist.computeDensity(
- dist.mean - dist.standardDeviation), 1e-5);
- assert.closeTo(0.39894, dist.standardDeviation * dist.computeDensity(
- dist.mean), 1e-5);
- assert.closeTo(0.24197, dist.standardDeviation * dist.computeDensity(
- dist.mean + dist.standardDeviation), 1e-5);
- assert.closeTo(0.054, dist.standardDeviation * dist.computeDensity(
- dist.mean + 2 * dist.standardDeviation), 1e-5);
- assert.closeTo(0, dist.standardDeviation * dist.computeDensity(
- 1e10), 1e-5);
-
- assert.closeTo(0, dist.computePercentile(-1e10), 1e-5);
- assert.closeTo(0.02275, dist.computePercentile(
- dist.mean - 2 * dist.standardDeviation), 1e-5);
- assert.closeTo(0.15866, dist.computePercentile(
- dist.mean - dist.standardDeviation), 1e-5);
- assert.closeTo(0.5, dist.computePercentile(dist.mean), 1e-5);
- assert.closeTo(0.841344, dist.computePercentile(
- dist.mean + dist.standardDeviation), 1e-5);
- assert.closeTo(0.97725, dist.computePercentile(
- dist.mean + 2 * dist.standardDeviation), 1e-5);
- assert.closeTo(1, dist.computePercentile(1e10), 1e-5);
- }
- }
- });
-
- test('logNormalDistribution', function() {
- // Unlike the Normal distribution, the LogNormal distribution can look very
- // different depending on its parameters, and it's defined in terms of the
- // Normal distribution anyway, so only test the standard LogNormal
- // distribution.
- var dist = new Statistics.LogNormalDistribution(0, 1);
- assert.closeTo(0.3678, dist.mode, 1e-4);
- assert.closeTo(1, dist.median, 1e-6);
- assert.closeTo(1.6487, dist.mean, 1e-4);
- assert.closeTo(0.65774, dist.computeDensity(dist.mode), 1e-5);
- assert.closeTo(0.39894, dist.computeDensity(dist.median), 1e-5);
- assert.closeTo(0.21354, dist.computeDensity(dist.mean), 1e-5);
- assert.closeTo(0, dist.computePercentile(1e-10), 1e-6);
- assert.closeTo(0.15865, dist.computePercentile(dist.mode), 1e-5);
- assert.closeTo(0.5, dist.computePercentile(dist.median), 1e-6);
- assert.closeTo(0.69146, dist.computePercentile(dist.mean), 1e-5);
- assert.closeTo(1, dist.computePercentile(1e100), 1e-5);
- });
-
- test('divideIfPossibleOrZero', function() {
- assert.equal(Statistics.divideIfPossibleOrZero(1, 2), 0.5);
- assert.equal(Statistics.divideIfPossibleOrZero(0, 2), 0);
- assert.equal(Statistics.divideIfPossibleOrZero(1, 0), 0);
- assert.equal(Statistics.divideIfPossibleOrZero(0, 0), 0);
- });
-
- test('sumBasic', function() {
- assert.equal(Statistics.sum([1, 2, 3]), 6);
- });
-
- test('sumWithFunctor', function() {
- var ctx = {};
- var ary = [1, 2, 3];
- assert.equal(12, Statistics.sum(ary, function(x, i) {
- assert.equal(this, ctx);
- assert.equal(ary[i], x);
- return x * 2;
- }, ctx));
- });
-
- test('minMaxWithFunctor', function() {
- var ctx = {};
- var ary = [1, 2, 3];
- function func(x, i) {
- assert.equal(this, ctx);
- assert.equal(ary[i], x);
- return x;
- }
- assert.equal(Statistics.max(ary, func, ctx), 3);
- assert.equal(Statistics.min(ary, func, ctx), 1);
-
- var range = Statistics.range(ary, func, ctx);
- assert.isFalse(range.isEmpty);
- assert.equal(range.min, 1);
- assert.equal(range.max, 3);
- });
-
- test('maxExtrema', function() {
- assert.equal(Statistics.max([]), -Infinity);
- assert.equal(Statistics.min([]), Infinity);
- });
-
- test('meanBasic', function() {
- assert.equal(Statistics.mean([1, 2, 3]), 2);
- });
-
- test('weightedMean', function() {
- function getWeight(element) {
- return element.weight;
- }
- function getValue(element) {
- return element.value;
- }
-
- var data = [
- {value: 10, weight: 3},
- {value: 20, weight: 1},
- {value: 30, weight: 6}
- ];
- assert.equal(23, Statistics.weightedMean(data, getWeight, getValue));
-
- data = [
- {value: 10, weight: 0},
- {value: 20, weight: 0},
- {value: 30, weight: 0}
- ];
- assert.equal(undefined, Statistics.weightedMean(data, getWeight, getValue));
-
- data = [
- {value: 10, weight: -10},
- {value: 20, weight: 5},
- {value: 30, weight: 5}
- ];
- assert.equal(undefined, Statistics.weightedMean(data, getWeight, getValue));
- });
-
- test('weightedMean_positionDependent', function() {
- function getWeight(element, idx) {
- return idx;
- }
- // 3 has weight of 0, 6 has weight of 1, 9 has weight of 2
- assert.equal(8, Statistics.weightedMean([3, 6, 9], getWeight));
- });
-
- test('max_positionDependent', function() {
- function getValue(element, idx) {
- return element * idx;
- }
- assert.equal(6, Statistics.max([1, 2, 3], getValue));
- });
-
- test('min_positionDependent', function() {
- function getValue(element, idx) {
- return element * idx;
- }
- assert.equal(-6, Statistics.min([1, 2, -3], getValue));
- });
-
- test('varianceBasic', function() {
- // In [2, 4, 4, 2], all items have a deviation of 1.0 from the mean so the
- // population variance is 4.0 / 4 = 1.0, but the sample variance is 4.0 / 3.
- assert.equal(Statistics.variance([2, 4, 4, 2]), 4.0 / 3);
-
- // In [1, 2, 3], the squared deviations are 1.0, 0.0 and 1.0 respectively;
- // population variance 2.0 / 3 but sample variance is 2.0 / 2 = 1.0.
- assert.equal(Statistics.variance([1, 2, 3]), 1.0);
- });
-
- test('varianceWithFunctor', function() {
- var ctx = {};
- var ary = [{x: 2},
- {x: 4},
- {x: 4},
- {x: 2}];
- assert.equal(4.0 / 3, Statistics.variance(ary, function(d) {
- assert.equal(ctx, this);
- return d.x;
- }, ctx));
- });
-
- test('stddevBasic', function() {
- assert.equal(Statistics.stddev([2, 4, 4, 2]), Math.sqrt(4.0 / 3));
- });
-
- test('stddevWithFunctor', function() {
- var ctx = {};
- var ary = [{x: 2},
- {x: 4},
- {x: 4},
- {x: 2}];
- assert.equal(Math.sqrt(4.0 / 3), Statistics.stddev(ary, function(d) {
- assert.equal(ctx, this);
- return d.x;
- }, ctx));
- });
-
- test('percentile', function() {
- var ctx = {};
- var ary = [{x: 0},
- {x: 1},
- {x: 2},
- {x: 3},
- {x: 4},
- {x: 5},
- {x: 6},
- {x: 7},
- {x: 8},
- {x: 9}];
- function func(d, i) {
- assert.equal(ctx, this);
- return d.x;
- }
- assert.equal(Statistics.percentile(ary, 0, func, ctx), 0);
- assert.equal(Statistics.percentile(ary, .5, func, ctx), 4);
- assert.equal(Statistics.percentile(ary, .75, func, ctx), 6);
- assert.equal(Statistics.percentile(ary, 1, func, ctx), 9);
- });
-
- test('percentile_positionDependent', function() {
- var ctx = {};
- var ary = [{x: 0},
- {x: 1},
- {x: 2},
- {x: 3},
- {x: 4},
- {x: 5},
- {x: 6},
- {x: 7},
- {x: 8},
- {x: 9}];
- function func(d, i) {
- assert.equal(ctx, this);
- assert.equal(d.x, i);
- return d.x * i;
- }
- assert.equal(Statistics.percentile(ary, 0, func, ctx), 0);
- assert.equal(Statistics.percentile(ary, .5, func, ctx), 16);
- assert.equal(Statistics.percentile(ary, .75, func, ctx), 36);
- assert.equal(Statistics.percentile(ary, 1, func, ctx), 81);
- });
-
- test('normalizeSamples', function() {
- var samples = [];
- var results = Statistics.normalizeSamples(samples);
- assert.deepEqual(results.normalized_samples, []);
- assert.deepEqual(results.scale, 1.0);
-
- samples = [0.0, 0.0];
- results = Statistics.normalizeSamples(samples);
- assert.deepEqual(results.normalized_samples, [0.5, 0.5]);
- assert.deepEqual(results.scale, 1.0);
-
- samples = [0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0];
- results = Statistics.normalizeSamples(samples);
- assert.deepEqual(results.normalized_samples,
- [1.0 / 8.0, 3.0 / 8.0, 5.0 / 8.0, 7.0 / 8.0]);
- assert.deepEqual(results.scale, 0.75);
-
- samples = [1.0 / 8.0, 3.0 / 8.0, 5.0 / 8.0, 7.0 / 8.0];
- results = Statistics.normalizeSamples(samples);
- assert.deepEqual(results.normalized_samples, samples);
- assert.deepEqual(results.scale, 1.0);
- });
-
- /**
- *Tests NormalizeSamples and Discrepancy with random samples.
- *
- * Generates 10 sets of 10 random samples, computes the discrepancy,
- * relaxes the samples using Llloyd's algorithm in 1D, and computes the
- * discrepancy of the relaxed samples. Discrepancy of the relaxed samples
- * must be less than or equal to the discrepancy of the original samples.
- **/
- test('discrepancy_Random', function() {
- for (var i = 0; i < 10; i++) {
- var samples = createRandomSamples(10);
- var samples = Statistics.normalizeSamples(samples).normalized_samples;
- var d = Statistics.discrepancy(samples);
- var relaxed_samples = relax(samples);
- var d_relaxed = Statistics.discrepancy(relaxed_samples);
- assert.isBelow(d_relaxed, d);
- }
- });
-
-
- /* Computes discrepancy for sample sets with known statistics. */
- test('discrepancy_Analytic', function() {
- var samples = [];
- var d = Statistics.discrepancy(samples);
- assert.equal(d, 0.0);
-
- samples = [0.5];
- d = Statistics.discrepancy(samples);
- assert.equal(d, 0.5);
-
- samples = [0.0, 1.0];
- d = Statistics.discrepancy(samples);
- assert.equal(d, 1.0);
-
- samples = [0.5, 0.5, 0.5];
- d = Statistics.discrepancy(samples);
- assert.equal(d, 1.0);
-
- samples = [1.0 / 8.0, 3.0 / 8.0, 5.0 / 8.0, 7.0 / 8.0];
- d = Statistics.discrepancy(samples);
- assert.equal(d, 0.25);
-
- samples = [1.0 / 8.0, 5.0 / 8.0, 5.0 / 8.0, 7.0 / 8.0];
- d = Statistics.discrepancy(samples);
- assert.equal(d, 0.5);
-
- samples = [1.0 / 8.0, 3.0 / 8.0, 5.0 / 8.0, 5.0 / 8.0, 7.0 / 8.0];
- d = Statistics.discrepancy(samples);
- assert.equal(d, 0.4);
-
- samples = [0.0, 1.0 / 3.0, 2.0 / 3.0, 1.0];
- d = Statistics.discrepancy(samples);
- assert.equal(d, 0.5);
-
- samples = Statistics.normalizeSamples(samples).normalized_samples;
- d = Statistics.discrepancy(samples);
- assert.equal(d, 0.25);
- });
-
- test('timestampsDiscrepancy', function() {
- var time_stamps = [];
- var d_abs = Statistics.timestampsDiscrepancy(time_stamps, true);
- assert.equal(d_abs, 0.0);
-
- time_stamps = [4];
- d_abs = Statistics.timestampsDiscrepancy(time_stamps, true);
- assert.equal(d_abs, 0.5);
-
- var time_stamps_a = [0, 1, 2, 3, 5, 6];
- var time_stamps_b = [0, 1, 2, 3, 5, 7];
- var time_stamps_c = [0, 2, 3, 4];
- var time_stamps_d = [0, 2, 3, 4, 5];
-
-
- var d_abs_a = Statistics.timestampsDiscrepancy(time_stamps_a, true);
- var d_abs_b = Statistics.timestampsDiscrepancy(time_stamps_b, true);
- var d_abs_c = Statistics.timestampsDiscrepancy(time_stamps_c, true);
- var d_abs_d = Statistics.timestampsDiscrepancy(time_stamps_d, true);
- var d_rel_a = Statistics.timestampsDiscrepancy(time_stamps_a, false);
- var d_rel_b = Statistics.timestampsDiscrepancy(time_stamps_b, false);
- var d_rel_c = Statistics.timestampsDiscrepancy(time_stamps_c, false);
- var d_rel_d = Statistics.timestampsDiscrepancy(time_stamps_d, false);
-
-
- assert.isBelow(d_abs_a, d_abs_b);
- assert.isBelow(d_rel_a, d_rel_b);
- assert.isBelow(d_rel_d, d_rel_c);
- assert.closeTo(d_abs_d, d_abs_c, 0.0001);
- });
-
- test('discrepancyMultipleRanges', function() {
- var samples = [[0.0, 1.2, 2.3, 3.3], [6.3, 7.5, 8.4], [4.2, 5.4, 5.9]];
- var d_0 = Statistics.timestampsDiscrepancy(samples[0]);
- var d_1 = Statistics.timestampsDiscrepancy(samples[1]);
- var d_2 = Statistics.timestampsDiscrepancy(samples[2]);
- var d = Statistics.timestampsDiscrepancy(samples);
- assert.equal(d, Math.max(d_0, d_1, d_2));
- });
-
- /**
- * Tests approimate discrepancy implementation by comparing to exact
- * solution.
- **/
- test('approximateDiscrepancy', function() {
- for (var i = 0; i < 5; i++) {
- var samples = createRandomSamples(10);
- samples = Statistics.normalizeSamples(samples).normalized_samples;
- var d = Statistics.discrepancy(samples);
- var d_approx = Statistics.discrepancy(samples, 500);
- assert.closeTo(d, d_approx, 0.01);
- }
- });
-
- test('durationsDiscrepancy', function() {
- var durations = [];
- var d = Statistics.durationsDiscrepancy(durations);
- assert.equal(d, 0.0);
-
- durations = [4];
- d = Statistics.durationsDiscrepancy(durations);
- assert.equal(d, 4.0);
-
- var durations_a = [1, 1, 1, 1, 1];
- var durations_b = [1, 1, 2, 1, 1];
- var durations_c = [1, 2, 1, 2, 1];
-
- var d_a = Statistics.durationsDiscrepancy(durations_a);
- var d_b = Statistics.durationsDiscrepancy(durations_b);
- var d_c = Statistics.durationsDiscrepancy(durations_c);
-
- assert.isBelow(d_a, d_b);
- assert.isBelow(d_b, d_c);
- });
-
- test('uniformlySampleStream', function() {
- var samples = [];
- Statistics.uniformlySampleStream(samples, 1, 'A', 5);
- assert.deepEqual(['A'], samples);
- Statistics.uniformlySampleStream(samples, 2, 'B', 5);
- Statistics.uniformlySampleStream(samples, 3, 'C', 5);
- Statistics.uniformlySampleStream(samples, 4, 'D', 5);
- Statistics.uniformlySampleStream(samples, 5, 'E', 5);
- assert.deepEqual(['A', 'B', 'C', 'D', 'E'], samples);
-
- Statistics.uniformlySampleStream(samples, 6, 'F', 5);
- // Can't really assert anything more than the length since the elements are
- // drawn at random.
- assert.equal(samples.length, 5);
-
- // Try starting with a non-empty array.
- samples = [0, 0, 0];
- Statistics.uniformlySampleStream(samples, 1, 'G', 5);
- assert.deepEqual(['G', 0, 0], samples);
- });
-
- test('mergeSampledStreams', function() {
- var samples = [];
- Statistics.mergeSampledStreams(samples, 0, ['A'], 1, 5);
- assert.deepEqual(['A'], samples);
- Statistics.mergeSampledStreams(samples, 1, ['B', 'C', 'D', 'E'], 4, 5);
- assert.deepEqual(['A', 'B', 'C', 'D', 'E'], samples);
-
- Statistics.mergeSampledStreams(samples, 9, ['F', 'G', 'H', 'I', 'J'], 7, 5);
- // Can't really assert anything more than the length since the elements are
- // drawn at random.
- assert.equal(samples.length, 5);
-
- var samples = ['A', 'B'];
- Statistics.mergeSampledStreams(samples, 2, ['F', 'G', 'H', 'I', 'J'], 7, 5);
- assert.equal(samples.length, 5);
- });
-
- test('mannWhitneyUTestSmokeTest', function() {
- // x < 0.01
- var sampleA = [1, 2, 2.1, 2.2, 2, 1];
- var sampleB = [12, 13, 13.1, 13.2, 13, 12];
- var results = Statistics.mwu.test(sampleA, sampleB);
- assert.isBelow(results.p, 0.1);
-
- // 0.01 < x < 0.1
- sampleA = [1, 2, 2.1, 2.2, 2, 1];
- sampleB = [2, 3, 3.1, 3.2, 3, 2];
- results = Statistics.mwu.test(sampleA, sampleB);
- assert.isBelow(results.p, 0.1);
- assert.isAbove(results.p, 0.01);
-
- // 0.1 < x
- sampleA = [1, 2, 2.1, 2.2, 2, 1];
- sampleB = [1, 2, 2.1, 2.2, 2, 1];
- results = Statistics.mwu.test(sampleA, sampleB);
- assert.isAbove(results.p, 0.1);
- });
-
- test('mannWhitneyUEdgeCases', function() {
- var longRepeatingSample = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
- var emptySample = [];
- var singleLargeValue = [1000000];
- // mean 10, std 2
- var normallyDistributedSample = [
- 8.341540e+0, 7.216640e+0, 8.844310e+0, 9.801980e+0, 1.048760e+1,
- 6.915150e+0, 7.881740e+0, 1.131160e+1, 9.959400e+0, 9.030880e+0
- ];
- // Identical samples should not cause the null to be rejected.
- var results = Statistics.mwu.test(longRepeatingSample, longRepeatingSample);
- assert.isAbove(results.p, 0.05);
- results = Statistics.mwu.test(normallyDistributedSample,
- normallyDistributedSample);
- assert.isAbove(results.p, 0.05);
- results = Statistics.mwu.test(singleLargeValue, singleLargeValue);
-
- // A single value is generally not sufficient to reject the null, no matter
- // how far off it is.
- results = Statistics.mwu.test(normallyDistributedSample, singleLargeValue);
- assert.isAbove(results.p, 0.05);
-
- // A single value way outside the first sample may be enough to reject,
- // if the first sample is large enough.
- results = Statistics.mwu.test(longRepeatingSample, singleLargeValue);
- assert.isBelow(results.p, 0.005);
-
- // Empty samples should not be comparable.
- results = Statistics.mwu.test(emptySample, emptySample);
- assert(isNaN(results.p));
-
- // The result of comparing a sample against an empty sample should not be a
- // valid p value. NOTE: The current implementation returns 0, it is up to
- // the caller to interpret this.
- results = Statistics.mwu.test(normallyDistributedSample, emptySample);
- assert(!results.p);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/task.html b/chromium/third_party/catapult/tracing/tracing/base/task.html
deleted file mode 100644
index 54f8e852d4a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/task.html
+++ /dev/null
@@ -1,186 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/raf.html">
-<link rel="import" href="/tracing/base/timing.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
- var Timing = tr.b.Timing;
- /**
- * A task is a combination of a run callback, a set of subtasks, and an after
- * task.
- *
- * When executed, a task does the following things:
- * 1. Runs its callback
- * 2. Runs its subtasks
- * 3. Runs its after callback.
- *
- * The list of subtasks and after task can be mutated inside step #1 but as
- * soon as the task's callback returns, the subtask list and after task is
- * fixed and cannot be changed again.
- *
- * Use task.after().after().after() to describe the toplevel passes that make
- * up your computation. Then, use subTasks to add detail to each subtask as it
- * runs. For example:
- * var pieces = [];
- * taskA = new Task(function() { pieces = getPieces(); });
- * taskA.after(function(taskA) {
- * pieces.forEach(function(piece) {
- * taskA.subTask(function(taskB) { piece.process(); }, this);
- * });
- * });
- *
- * @constructor
- */
- function Task(runCb, thisArg) {
- if (runCb !== undefined && thisArg === undefined)
- throw new Error('Almost certainly, you meant to pass a thisArg.');
- this.runCb_ = runCb;
- this.thisArg_ = thisArg;
- this.afterTask_ = undefined;
- this.subTasks_ = [];
- }
-
- Task.prototype = {
- get name() {
- return this.runCb_.name;
- },
-
- /*
- * See constructor documentation on semantics of subtasks.
- */
- subTask: function(cb, thisArg) {
- if (cb instanceof Task)
- this.subTasks_.push(cb);
- else
- this.subTasks_.push(new Task(cb, thisArg));
- return this.subTasks_[this.subTasks_.length - 1];
- },
-
- /**
- * Runs the current task and returns the task that should be executed next.
- */
- run: function() {
- if (this.runCb_ !== undefined)
- this.runCb_.call(this.thisArg_, this);
- var subTasks = this.subTasks_;
- this.subTasks_ = undefined; // Prevent more subTasks from being posted.
-
- if (!subTasks.length)
- return this.afterTask_;
-
- // If there are subtasks, then we want to execute all the subtasks and
- // then this task's afterTask. To make this happen, we update the
- // afterTask of all the subtasks so the point upward to each other, e.g.
- // subTask[0].afterTask to subTask[1] and so on. Then, the last subTask's
- // afterTask points at this task's afterTask.
- for (var i = 1; i < subTasks.length; i++)
- subTasks[i - 1].afterTask_ = subTasks[i];
- subTasks[subTasks.length - 1].afterTask_ = this.afterTask_;
- return subTasks[0];
- },
-
- /*
- * See constructor documentation on semantics of after tasks.
- */
- after: function(cb, thisArg) {
- if (this.afterTask_)
- throw new Error('Has an after task already');
- if (cb instanceof Task)
- this.afterTask_ = cb;
- else
- this.afterTask_ = new Task(cb, thisArg);
- return this.afterTask_;
- },
-
- /*
- * See constructor documentation on semantics of after tasks.
- * Note: timedAfter doesn't work when a task throws an exception.
- * This is because task system doesn't support catching currently.
- * At the time of writing, this is considered to be an acceptable tradeoff.
- */
- timedAfter: function(groupName, cb, thisArg, opt_args) {
- if (cb.name === '')
- throw new Error('Anonymous Task is not allowed');
- return this.namedTimedAfter(groupName, cb.name, cb, thisArg, opt_args);
- },
-
- /*
- * See constructor documentation on semantics of after tasks.
- * Note: namedTimedAfter doesn't work when a task throws an exception.
- * This is because task system doesn't support catching currently.
- * At the time of writing, this is considered to be an acceptable tradeoff.
- */
- namedTimedAfter: function(groupName, name, cb, thisArg, opt_args) {
- if (this.afterTask_)
- throw new Error('Has an after task already');
- var realTask;
- if (cb instanceof Task)
- realTask = cb;
- else
- realTask = new Task(cb, thisArg);
- this.afterTask_ = new Task(function(task) {
- var markedTask = Timing.mark(groupName, name, opt_args);
- task.subTask(realTask, thisArg);
- task.subTask(function() {
- markedTask.end();
- }, thisArg);
- }, thisArg);
- return this.afterTask_;
- },
-
- /*
- * Adds a task after the chain of tasks.
- */
- enqueue: function(cb, thisArg) {
- var lastTask = this;
- while (lastTask.afterTask_)
- lastTask = lastTask.afterTask_;
- return lastTask.after(cb, thisArg);
- }
- };
-
- Task.RunSynchronously = function(task) {
- var curTask = task;
- while (curTask)
- curTask = curTask.run();
- }
-
- /**
- * Runs a task using raf.requestIdleCallback, returning
- * a promise for its completion.
- */
- Task.RunWhenIdle = function(task) {
- return new Promise(function(resolve, reject) {
- var curTask = task;
- function runAnother() {
- try {
- curTask = curTask.run();
- } catch (e) {
- reject(e);
- console.error(e.stack);
- return;
- }
-
- if (curTask) {
- tr.b.requestIdleCallback(runAnother);
- return;
- }
-
- resolve();
- }
- tr.b.requestIdleCallback(runAnother);
- });
- }
-
- return {
- Task: Task
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/task_test.html b/chromium/third_party/catapult/tracing/tracing/base/task_test.html
deleted file mode 100644
index 59a6f6936d7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/task_test.html
+++ /dev/null
@@ -1,171 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/task.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Task = tr.b.Task;
-
- test('basicAllStepsPass', function() {
- var results = [];
-
- var startingTask = new Task(function(task) {
- results.push('a');
- task.subTask(function() {
- results.push('a/1');
- }, this);
- task.subTask(function() {
- results.push('a/2');
- }, this);
- }, this);
- startingTask.after(function() {
- results.push('b');
- }, this).after(function() {
- results.push('c');
- }, this);
-
- Task.RunSynchronously(startingTask);
- assert.deepEqual(results, ['a', 'a/1', 'a/2', 'b', 'c']);
- });
-
- test('basicAllStepsPassAsync', function() {
- var results = [];
-
- var startingTask = new Task(function(task) {
- results.push('a');
- task.subTask(function() {
- results.push('a/1');
- }, this);
- task.subTask(function() {
- results.push('a/2');
- }, this);
- }, this);
- startingTask.after(function() {
- results.push('b');
- }, this).after(function() {
- results.push('c');
- }, this);
-
- var promise = Task.RunWhenIdle(startingTask);
- promise.then(function() {
- assert.deepEqual(results, ['a', 'a/1', 'a/2', 'b', 'c']);
- });
- return promise;
- });
-
- test('taskThatThrowsShouldRejectItsPromise', function() {
- var startingTask = new Task(function(task) {
- throw new Error(
- 'IGNORE. This is an expected error to test error handling.');
- }, this);
-
- var taskPromise = Task.RunWhenIdle(startingTask);
-
- return new Promise(function(resolve, reject) {
- taskPromise.then(function() {
- reject(new Error('Should have thrown'));
- }, function(err) {
- resolve();
- });
- });
- });
-
- test('timedAfter', function() {
- if (tr.isHeadless)
- return;
-
- var results = [];
-
- var startingTask = new Task(function(task) {
- results.push('a');
- }, this);
- startingTask.timedAfter('Test', function pushB() {
- results.push('b');
- }, this).after(function() {
- results.push('c');
- }, this);
-
- Task.RunSynchronously(startingTask);
- assert.deepEqual(results, ['a', 'b', 'c']);
- var result = window.performance.getEntriesByName('Test:pushB');
- var duration = parseFloat(result[0].duration);
- assert.isAbove(duration, 0.0);
- });
-
- test('timedAfterWithSubTask', function() {
- if (tr.isHeadless)
- return;
-
- var results = [];
-
- var startingTask = new Task(function(task) {
- results.push('a');
- task.subTask(function(task) {
- results.push('a/1');
- }, this);
- task.subTask(function(task) {
- results.push('a/2');
- }, this);
- }, this);
- startingTask.timedAfter('Test', function pushB() {
- results.push('b');
- }, this).after(function() {
- results.push('c');
- }, this);
-
- Task.RunSynchronously(startingTask);
- assert.deepEqual(results, ['a', 'a/1', 'a/2', 'b', 'c']);
- var result = window.performance.getEntriesByName('Test:pushB');
- var duration = parseFloat(result[0].duration);
- assert.isAbove(duration, 0.0);
- });
-
- test('timedAfterWithAnoymousTask', function() {
- if (tr.isHeadless)
- return;
-
- var results = [];
-
- var startingTask = new Task(function(task) {
- results.push('a');
- }, this);
- assert.throw(function() {
- startingTask.timedAfter('Test', function() {
- results.push('b');
- }, this);
- }, Error, 'Anonymous Task is not allowed');
-
- Task.RunSynchronously(startingTask);
- assert.deepEqual(results, ['a']);
- });
-
- test('namedTimedAfter', function() {
- if (tr.isHeadless)
- return;
-
- var results = [];
-
- var startingTask = new Task(function(task) {
- results.push('a');
- }, this);
- startingTask.namedTimedAfter('Test', 'pushB', function() {
- results.push('b');
- }, this).after(function() {
- results.push('c');
- }, this);
-
- Task.RunSynchronously(startingTask);
- assert.deepEqual(results, ['a', 'b', 'c']);
- var result = window.performance.getEntriesByName('Test:pushB');
- var duration = parseFloat(result[0].duration);
- assert.isAbove(duration, 0.0);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/timing.html b/chromium/third_party/catapult/tracing/tracing/base/timing.html
deleted file mode 100644
index 5a6ee391520..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/timing.html
+++ /dev/null
@@ -1,97 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/base64.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
- var Base64 = tr.b.Base64;
-
- function computeUserTimingMarkName(groupName, functionName, opt_args) {
- if (groupName === undefined)
- throw new Error('getMeasureString should have group name');
- if (functionName === undefined)
- throw new Error('getMeasureString should have function name');
- var userTimingMarkName = groupName + ':' + functionName;
- if (opt_args !== undefined) {
- userTimingMarkName += '/';
- userTimingMarkName += Base64.btoa(JSON.stringify(opt_args));
- }
- return userTimingMarkName;
- }
-
- function Timing() {
- }
-
- Timing.nextMarkNumber = 0;
-
- Timing.mark = function(groupName, functionName, opt_args) {
- if (tr.isHeadless) {
- return {
- end: function() {}
- };
- }
- var userTimingMarkName = computeUserTimingMarkName(
- groupName, functionName, opt_args);
- var markBeginName = 'tvcm.mark' + Timing.nextMarkNumber++;
- var markEndName = 'tvcm.mark' + Timing.nextMarkNumber++;
- window.performance.mark(markBeginName);
- return {
- end: function() {
- window.performance.mark(markEndName);
- window.performance.measure(userTimingMarkName,
- markBeginName,
- markEndName);
- }
- };
- };
-
- Timing.wrap = function(groupName, callback, opt_args) {
- if (groupName === undefined)
- throw new Error('Timing.wrap should have group name');
- if (callback.name === '')
- throw new Error('Anonymous function is not allowed');
- return Timing.wrapNamedFunction(
- groupName, callback.name, callback, opt_args);
- };
-
- Timing.wrapNamedFunction = function(groupName, functionName, callback,
- opt_args) {
- function timedNamedFunction() {
- var markedTime = Timing.mark(groupName, functionName, opt_args);
- try {
- callback.apply(this, arguments);
- } finally {
- markedTime.end();
- }
- }
- return timedNamedFunction;
- };
-
- function TimedNamedPromise(groupName, name, executor, opt_args) {
- var markedTime = Timing.mark(groupName, name, opt_args);
- var promise = new Promise(executor);
- promise.then(function(result) {
- markedTime.end();
- return result;
- }, function(e) {
- markedTime.end();
- throw e;
- });
- return promise;
- }
-
- return {
- _computeUserTimingMarkName: computeUserTimingMarkName, // export for testing
- TimedNamedPromise: TimedNamedPromise,
- Timing: Timing
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/timing_test.html b/chromium/third_party/catapult/tracing/tracing/base/timing_test.html
deleted file mode 100644
index 459bfa1aafa..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/timing_test.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/timing.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Timing = tr.b.Timing;
-
- test('computeUserTimingMarkName', function() {
- if (tr.isHeadless)
- return;
- var name1 = tr.b._computeUserTimingMarkName('Test', 'test1', {'a': 1});
- assert.equal(name1, 'Test:test1/eyJhIjoxfQ==');
- var name2 = tr.b._computeUserTimingMarkName('Test', 'test2');
- assert.equal(name2, 'Test:test2');
- var name3 = tr.b._computeUserTimingMarkName(
- 'Test', 'test1', {'a': 1, 'b': {'c': 2}});
- assert.equal(name3, 'Test:test1/eyJhIjoxLCJiIjp7ImMiOjJ9fQ==');
- });
-
- test('TimingMarkWithoutArgs', function() {
- if (tr.isHeadless)
- return;
- var markedTime = Timing.mark('Test', 'TimingMarkWithoutArgs');
- markedTime.end();
- var result = window.performance.getEntriesByName(
- 'Test:TimingMarkWithoutArgs');
- var duration = parseFloat(result[0].duration);
- assert.isTrue(duration >= 0.0);
- });
-
- test('TimingMarkWithArgs', function() {
- if (tr.isHeadless)
- return;
- var markedTime = Timing.mark('Test', 'TimingMarkWithoutArgs', {'a': 1});
- markedTime.end();
- var result = window.performance.getEntriesByName(
- 'Test:TimingMarkWithoutArgs/eyJhIjoxfQ==');
- var duration = parseFloat(result[0].duration);
- assert.isTrue(duration >= 0.0);
- });
-
- test('TimingWrapWithAnonymousFunction', function() {
- assert.throw(function() {
- Timing.wrap('Test', function() {})();
- }, Error, 'Anonymous function is not allowed');
- });
-
- test('TimingWrap', function(done) {
- if (tr.isHeadless)
- return;
- Timing.wrap('Test', function addTo1000() {
- var x = 0;
- for (var i = 0; i <= 1000; ++i)
- x += i;
- assert.equal(x, 500500);
- })();
- var result = window.performance.getEntriesByName('Test:addTo1000');
- var duration = parseFloat(result[0].duration);
- assert.isTrue(duration >= 0.0);
- });
-
- test('TimingWrapNamedFunction', function() {
- if (tr.isHeadless)
- return;
- Timing.wrapNamedFunction('Test', 'addTo100', function() {
- var x = 0;
- for (var i = 0; i <= 100; ++i)
- x += i;
- assert.equal(x, 5050);
- })();
- var result = window.performance.getEntriesByName('Test:addTo100');
- var duration = parseFloat(result[0].duration);
- assert.isTrue(duration >= 0.0);
- });
-
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/unittest.html b/chromium/third_party/catapult/tracing/tracing/base/unittest.html
deleted file mode 100644
index 8602f1e824c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/unittest.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-
-<script src="/chai/chai.js"></script>
-<script>
- 'use strict';
- /**
- * Alias chai assert to the global assert.
- */
- if (tr.isNode) {
- // In node, chai.js knows to act as a node module, whereas our HTML
- // imports code expects chai to end up in the global scope. So, in Node,
- // copy the chai exports into global.
- var chaiAbsPath = HTMLImportsLoader.hrefToAbsolutePath(
- '/chai/chai.js');
- var chaiModule = require(chaiAbsPath);
- for (var exportName in chaiModule)
- global[exportName] = chaiModule[exportName];
- } else {
- /**
- * Catapult presubmit wanted me to put a jsdoc here. So nduca did.
- */
- global.assert = chai.assert;
- }
-</script>
-
-<link rel="import" href="/tracing/base/unittest/suite_loader.html">
-<link rel="import" href="/tracing/base/unittest/test_case.html">
-<link rel="import" href="/tracing/base/unittest/test_suite.html">
-<link rel="import" href="/tracing/base/unittest/test_runner.html">
-<script>
-'use strict';
-tr.exportTo('tr.b.unittest', function() {
- return {
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/unittest/constants.html b/chromium/third_party/catapult/tracing/tracing/base/unittest/constants.html
deleted file mode 100644
index 6f58a59c135..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/unittest/constants.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b.unittest', function() {
- var TestStatus = {
- PENDING: 'pending-status',
- RUNNING: 'running-status',
- DONE_RUNNING: 'done-running-status'
- };
-
- var TestTypes = {
- UNITTEST: 'unittest-type',
- PERFTEST: 'perftest-type'
- };
-
- return {
- TestStatus: TestStatus,
- TestTypes: TestTypes
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/unittest/html_test_results.html b/chromium/third_party/catapult/tracing/tracing/base/unittest/html_test_results.html
deleted file mode 100644
index fa65a9e88fb..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/unittest/html_test_results.html
+++ /dev/null
@@ -1,480 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/base/unittest/constants.html">
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/base/xhr.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/base/utils.html">
-
-<style>
- x-tr-b-unittest-test-results {
- display: flex;
- flex-direction: column;
- flex: 0 0 auto;
- }
-
- x-tr-b-unittest-test-results > x-html-test-case-result.dark > #summary {
- background-color: #eee;
- }
-
- x-html-test-case-result {
- display: block;
- }
- x-html-test-case-result > #summary > #title,
- x-html-test-case-result > #summary > #status,
- x-html-test-case-result > #details > x-html-test-case-error > #message,
- x-html-test-case-result > #details > x-html-test-case-error > #stack,
- x-html-test-case-result > #details > x-html-test-case-error > #return-value,
- x-html-test-case-result > #details > x-html-test-case-flaky > #message {
- -webkit-user-select: auto;
- }
-
- x-html-test-case-result > #details > x-html-test-case-error,
- x-html-test-case-result > #details > x-html-test-case-flaky {
- display: block;
- border: 1px solid grey;
- border-radius: 5px;
- font-family: monospace;
- margin-bottom: 14px;
- }
-
- x-html-test-case-result > #details > x-html-test-case-error > #message,
- x-html-test-case-result > #details > x-html-test-case-error > #stack,
- x-html-test-case-result > #details > x-html-test-case-flaky > #message {
- white-space: pre;
- }
-
- x-html-test-case-result > #details > x-html-test-case-html-result {
- display: block;
- }
-
- .unittest-pending {
- color: orange;
- }
- .unittest-running {
- color: orange;
- font-weight: bold;
- }
-
- .unittest-passed {
- color: darkgreen;
- }
-
- .unittest-failed {
- color: darkred;
- font-weight: bold;
- }
-
- .unittest-flaky {
- color: darkorange;
- }
-
- .unittest-exception {
- color: red;
- font-weight: bold;
- }
-
- .unittest-failure {
- border: 1px solid grey;
- border-radius: 5px;
- padding: 5px;
- }
-</style>
-<template id="x-html-test-case-result-template">
- <div id="summary">
- <span id="title"></span>&nbsp;
- <span id="status"></span>&nbsp;
- <span id="return-value"></span>
- </div>
- <div id="details"></div>
-</template>
-
-<template id="x-html-test-case-error-template">
- <div id="stack"></div>
-</template>
-
-<template id="x-html-test-case-flaky-template">
- <div id="message"></div>
-</template>
-
-<script>
-'use strict';
-tr.exportTo('tr.b.unittest', function() {
- var THIS_DOC = document.currentScript.ownerDocument;
-
- var TestStatus = tr.b.unittest.TestStatus;
- var TestTypes = tr.b.unittest.TestTypes;
-
- /**
- * @constructor
- */
- var HTMLTestCaseResult = tr.ui.b.define('x-html-test-case-result');
-
- HTMLTestCaseResult.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.appendChild(tr.ui.b.instantiateTemplate(
- '#x-html-test-case-result-template', THIS_DOC));
- this.testCase_ = undefined;
- this.testCaseHRef_ = undefined;
- this.duration_ = undefined;
- this.testStatus_ = TestStatus.PENDING;
- this.testReturnValue_ = undefined;
- this.showHTMLOutput_ = false;
- this.updateColorAndStatus_();
- },
-
- get showHTMLOutput() {
- return this.showHTMLOutput_;
- },
-
- set showHTMLOutput(showHTMLOutput) {
- this.showHTMLOutput_ = showHTMLOutput;
- this.updateHTMLOutputDisplayState_();
- },
-
- get testCase() {
- return this.testCase_;
- },
-
- set testCase(testCase) {
- this.testCase_ = testCase;
- this.updateTitle_();
- },
-
- get testCaseHRef() {
- return this.testCaseHRef_;
- },
-
- set testCaseHRef(href) {
- this.testCaseHRef_ = href;
- this.updateTitle_();
- },
- updateTitle_: function() {
- var titleEl = this.querySelector('#title');
- if (this.testCase_ === undefined) {
- titleEl.textContent = '';
- return;
- }
-
- if (this.testCaseHRef_) {
- titleEl.innerHTML = '<a href="' + this.testCaseHRef_ + '">' +
- this.testCase_.fullyQualifiedName + '</a>';
- } else {
- titleEl.textContent = this.testCase_.fullyQualifiedName;
- }
- },
-
- addError: function(normalizedException) {
- var errorEl = document.createElement('x-html-test-case-error');
- errorEl.appendChild(tr.ui.b.instantiateTemplate(
- '#x-html-test-case-error-template', THIS_DOC));
- errorEl.querySelector('#stack').textContent = normalizedException.stack;
- this.querySelector('#details').appendChild(errorEl);
- this.updateColorAndStatus_();
- },
-
- addFlaky: function() {
- var flakyEl = document.createElement('x-html-test-case-flaky');
- flakyEl.appendChild(tr.ui.b.instantiateTemplate(
- '#x-html-test-case-flaky-template', THIS_DOC));
- flakyEl.querySelector('#message').textContent = 'FLAKY';
- this.querySelector('#details').appendChild(flakyEl);
- this.updateColorAndStatus_();
- },
-
- addHTMLOutput: function(element) {
- var htmlResultEl = document.createElement('x-html-test-case-html-result');
- htmlResultEl.appendChild(element);
- this.querySelector('#details').appendChild(htmlResultEl);
- },
-
- updateHTMLOutputDisplayState_: function() {
- var htmlResults = this.querySelectorAll('x-html-test-case-html-result');
- var display;
- if (this.showHTMLOutput)
- display = '';
- else
- display = (this.testStatus_ == TestStatus.RUNNING) ? '' : 'none';
- for (var i = 0; i < htmlResults.length; i++)
- htmlResults[i].style.display = display;
- },
-
- get hadErrors() {
- return !!this.querySelector('x-html-test-case-error');
- },
-
- get isFlaky() {
- return !!this.querySelector('x-html-test-case-flaky');
- },
-
- get duration() {
- return this.duration_;
- },
-
- set duration(duration) {
- this.duration_ = duration;
- this.updateColorAndStatus_();
- },
-
- get testStatus() {
- return this.testStatus_;
- },
-
- set testStatus(testStatus) {
- this.testStatus_ = testStatus;
- this.updateColorAndStatus_();
- this.updateHTMLOutputDisplayState_();
- },
-
- updateColorAndStatus_: function() {
- var colorCls;
- var status;
- if (this.hadErrors) {
- colorCls = 'unittest-failed';
- status = 'failed';
- } else if (this.isFlaky) {
- colorCls = 'unittest-flaky';
- status = 'flaky';
- } else if (this.testStatus_ == TestStatus.PENDING) {
- colorCls = 'unittest-pending';
- status = 'pending';
- } else if (this.testStatus_ == TestStatus.RUNNING) {
- colorCls = 'unittest-running';
- status = 'running';
- } else { // DONE_RUNNING and no errors
- colorCls = 'unittest-passed';
- status = 'passed';
- }
-
- var statusEl = this.querySelector('#status');
- if (this.duration_)
- statusEl.textContent = status + ' (' +
- this.duration_.toFixed(2) + 'ms)';
- else
- statusEl.textContent = status;
- statusEl.className = colorCls;
- },
-
- get testReturnValue() {
- return this.testReturnValue_;
- },
-
- set testReturnValue(testReturnValue) {
- this.testReturnValue_ = testReturnValue;
- this.querySelector('#return-value').textContent = testReturnValue;
- }
- };
-
-
-
-
- /**
- * @constructor
- */
- var HTMLTestResults = tr.ui.b.define('x-tr-b-unittest-test-results');
-
- HTMLTestResults.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.testCaseResultsByCaseGUID_ = {};
- this.currentTestCaseStartTime_ = undefined;
- this.totalRunTime_ = 0;
- this.numTestsThatPassed_ = 0;
- this.numTestsThatFailed_ = 0;
- this.numFlakyTests_ = 0;
- this.showHTMLOutput_ = false;
- this.showPendingAndPassedTests_ = false;
- this.linkifyCallback_ = undefined;
- this.headless_ = false;
- },
-
- get headless() {
- return this.headless_;
- },
-
- set headless(headless) {
- this.headless_ = headless;
- },
-
- getHRefForTestCase: function(testCase) {
- /* Override this to create custom links */
- return undefined;
- },
-
- get showHTMLOutput() {
- return this.showHTMLOutput_;
- },
-
- set showHTMLOutput(showHTMLOutput) {
- this.showHTMLOutput_ = showHTMLOutput;
- var testCaseResults = this.querySelectorAll('x-html-test-case-result');
- for (var i = 0; i < testCaseResults.length; i++)
- testCaseResults[i].showHTMLOutput = showHTMLOutput;
- },
-
- get showPendingAndPassedTests() {
- return this.showPendingAndPassedTests_;
- },
-
- set showPendingAndPassedTests(showPendingAndPassedTests) {
- this.showPendingAndPassedTests_ = showPendingAndPassedTests;
-
- var testCaseResults = this.querySelectorAll('x-html-test-case-result');
- for (var i = testCaseResults.length - 1; i >= 0; i--)
- this.updateDisplayStateForResult_(testCaseResults[i]);
- },
-
- updateDisplayStateForResult_: function(res) {
- var display;
- if (this.showPendingAndPassedTests_) {
- if (res.testStatus == TestStatus.RUNNING ||
- res.hadErrors) {
- display = '';
- } else {
- display = 'none';
- }
- } else {
- display = '';
- }
- res.style.display = display;
- },
-
- willRunTests: function(testCases) {
- this.timeAtBeginningOfTest_ = window.performance.now();
- testCases.forEach(function(testCase, i) {
- var testCaseResult = new HTMLTestCaseResult();
- testCaseResult.showHTMLOutput = this.showHTMLOutput_;
- testCaseResult.testCase = testCase;
- if ((i % 2) === 0)
- testCaseResult.classList.add('dark');
-
- var href = this.getHRefForTestCase(testCase);
- if (href)
- testCaseResult.testCaseHRef = href;
- testCaseResult.testStatus = TestStatus.PENDING;
- this.testCaseResultsByCaseGUID_[testCase.guid] = testCaseResult;
- this.appendChild(testCaseResult);
- this.updateDisplayStateForResult_(testCaseResult);
- }, this);
- },
-
- willRunTest: function(testCase) {
- this.currentTestCaseResult_ = this.testCaseResultsByCaseGUID_[
- testCase.guid];
- this.currentTestCaseStartTime_ = window.performance.now();
- this.currentTestCaseResult_.testStatus = TestStatus.RUNNING;
- this.updateDisplayStateForResult_(this.currentTestCaseResult_);
- this.log_(testCase.fullyQualifiedName + ': ');
- },
-
- addErrorForCurrentTest: function(error) {
- this.log_('\n');
-
- var normalizedException = tr.b.normalizeException(error);
- this.log_('Exception: ' + normalizedException.message + '\n' +
- normalizedException.stack);
-
- this.currentTestCaseResult_.addError(normalizedException);
- this.updateDisplayStateForResult_(this.currentTestCaseResult_);
- if (this.headless_)
- this.notifyTestResultToDevServer_('EXCEPT', normalizedException.stack);
- },
-
- addHTMLOutputForCurrentTest: function(element) {
- this.currentTestCaseResult_.addHTMLOutput(element);
- this.updateDisplayStateForResult_(this.currentTestCaseResult_);
- },
-
- setCurrentTestFlaky: function() {
- this.currentTestCaseResult_.addFlaky();
- this.updateDisplayStateForResult_(this.currentTestCaseResult_);
- },
-
- setReturnValueFromCurrentTest: function(returnValue) {
- this.currentTestCaseResult_.testReturnValue = returnValue;
- },
-
- didCurrentTestEnd: function() {
- var now = window.performance.now();
- var testCaseResult = this.currentTestCaseResult_;
- var testCaseDuration = now - this.currentTestCaseStartTime_;
- this.currentTestCaseResult_.testStatus = TestStatus.DONE_RUNNING;
- testCaseResult.duration = testCaseDuration;
- this.totalRunTime_ = now - this.timeAtBeginningOfTest_;
- var resultString;
- if (testCaseResult.hadErrors) {
- resultString = 'FAILED';
- this.numTestsThatFailed_ += 1;
- tr.b.dispatchSimpleEvent(this, 'testfailed');
- } else if (testCaseResult.isFlaky) {
- resultString = 'FLAKY';
- this.numFlakyTests_ += 1;
- tr.b.dispatchSimpleEvent(this, 'testflaky');
- } else {
- resultString = 'PASSED';
- this.numTestsThatPassed_ += 1;
- tr.b.dispatchSimpleEvent(this, 'testpassed');
- }
- this.log_('[' + resultString + ']\n');
-
- if (this.headless_)
- this.notifyTestResultToDevServer_(resultString);
-
- this.updateDisplayStateForResult_(this.currentTestCaseResult_);
- this.currentTestCaseResult_ = undefined;
- },
-
- didRunTests: function() {
- this.log_('[DONE]\n');
- if (this.headless_)
- this.notifyTestCompletionToDevServer_();
- },
-
- getStats: function() {
- return {
- numTestsThatPassed: this.numTestsThatPassed_,
- numTestsThatFailed: this.numTestsThatFailed_,
- numFlakyTests: this.numFlakyTests_,
- totalRunTime: this.totalRunTime_
- };
- },
-
- notifyTestResultToDevServer_: function(result, extra_msg) {
- var req = new XMLHttpRequest();
- var testName = this.currentTestCaseResult_.testCase.fullyQualifiedName;
- var data = result + ' ' + testName + ' ' + (extra_msg || '');
- tr.b.postAsync('/tracing/notify_test_result', data);
- },
-
- notifyTestCompletionToDevServer_: function() {
- if (this.numTestsThatPassed_ + this.numTestsThatFailed_ +
- this.numFlakyTests_ == 0) {
- return;
- }
- var data = this.numTestsThatFailed_ == 0 ? 'ALL_PASSED' : 'HAD_FAILURES';
- data += '\nPassed tests: ' + this.numTestsThatPassed_ +
- ' Failed tests: ' + this.numTestsThatFailed_ +
- ' Flaky tests: ' + this.numFlakyTests_;
-
- tr.b.postAsync('/tracing/notify_tests_completed', data);
- },
-
- log_: function(msg) {
- //this.textContent += msg;
- tr.b.dispatchSimpleEvent(this, 'statschange');
- }
- };
-
- return {
- HTMLTestResults: HTMLTestResults
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/unittest/interactive_test_runner.html b/chromium/third_party/catapult/tracing/tracing/base/unittest/interactive_test_runner.html
deleted file mode 100644
index 79a5649275d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/unittest/interactive_test_runner.html
+++ /dev/null
@@ -1,696 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/unittest.html">
-<link rel="import" href="/tracing/base/unittest/suite_loader.html">
-<link rel="import" href="/tracing/base/unittest/test_runner.html">
-<link rel="import" href="/tracing/base/unittest/html_test_results.html">
-<link rel="import" href="/tracing/ui/base/utils.html">
-
-<style>
- x-base-interactive-test-runner {
- display: flex;
- flex-direction: column;
- flex: 0 0 auto;
- }
-
- x-base-interactive-test-runner > * {
- flex: 0 0 auto;
- }
- x-base-interactive-test-runner > #title {
- font-size: 16pt;
- }
-
- x-base-interactive-test-runner {
- font-family: sans-serif;
- }
-
- x-base-interactive-test-runner > h1 {
- margin: 5px 0px 10px 0px;
- }
-
- x-base-interactive-test-runner > #stats {
- }
-
- x-base-interactive-test-runner > #controls {
- display: block;
- margin-bottom: 5px;
- }
-
- x-base-interactive-test-runner > #controls > ul {
- list-style-type: none;
- padding: 0;
- margin: 0;
- }
-
- x-base-interactive-test-runner > #controls > ul > li {
- float: left;
- margin-right: 10px;
- padding-top: 5px;
- padding-bottom: 5px;
- }
-
- x-base-interactive-test-runner > #shortform-results {
- color: green;
- height; 40px;
- word-wrap: break-word;
- }
-
- x-base-interactive-test-runner > #shortform-results > .fail {
- color: darkred;
- font-weight: bold;
- }
-
- x-base-interactive-test-runner > #shortform-results > .flaky {
- color: darkorange;
- }
-
- x-base-interactive-test-runner > #results-container {
- flex: 1 1 auto;
- min-height: 0;
- overflow: auto;
- padding: 0 4px 0 4px;
- }
-
- .unittest-pending {
- color: orange;
- }
- .unittest-running {
- color: orange;
- font-weight: bold;
- }
-
- .unittest-passed {
- color: darkgreen;
- }
-
- .unittest-failed {
- color: darkred;
- font-weight: bold;
- }
-
- .unittest-flaky {
- color: darkorange;
- }
-
- .unittest-exception {
- color: red;
- font-weight: bold;
- }
-
- .unittest-failure {
- border: 1px solid grey;
- border-radius: 5px;
- padding: 5px;
- }
-</style>
-
-<template id="x-base-interactive-test-runner-template">
- <h1 id="title">Tests</h1>
- <div id="stats"></div>
- <div id="controls">
- <ul id="links">
- </ul>
- <div style="clear: both;"></div>
-
- <div>
- <span>
- <label>
- <input type="radio" name="test-type-to-run" value="unit" />
- Run unit tests
- </label>
- </span>
- <span>
- <label>
- <input type="radio" name="test-type-to-run" value="perf" />
- Run perf tests
- </label>
- </span>
- <span>
- <label>
- <input type="radio" name="test-type-to-run" value="all" />
- Run all tests
- </label>
- </span>
- </div>
- <span>
- <label>
- <input type="checkbox" id="short-format" /> Short format</label>
- </span>
- </div>
- <div id="shortform-results">
- </div>
- <div id="results-container">
- </div>
-</template>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.b.unittest', function() {
- var THIS_DOC = document.currentScript.ownerDocument;
- var ALL_TEST_TYPES = 'all';
-
- /**
- * @constructor
- */
- var InteractiveTestRunner = tr.ui.b.define('x-base-interactive-test-runner');
-
- InteractiveTestRunner.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.allTests_ = undefined;
-
- this.suppressStateChange_ = false;
-
- this.testFilterString_ = '';
- this.testTypeToRun_ = tr.b.unittest.TestTypes.UNITTEST;
- this.shortFormat_ = false;
- this.testSuiteName_ = '';
-
- this.rerunPending_ = false;
- this.runner_ = undefined;
- this.results_ = undefined;
- this.headless_ = false;
-
- this.onResultsStatsChanged_ = this.onResultsStatsChanged_.bind(this);
- this.onTestFailed_ = this.onTestFailed_.bind(this);
- this.onTestFlaky_ = this.onTestFlaky_.bind(this);
- this.onTestPassed_ = this.onTestPassed_.bind(this);
-
- this.appendChild(tr.ui.b.instantiateTemplate(
- '#x-base-interactive-test-runner-template', THIS_DOC));
-
- this.querySelector(
- 'input[name=test-type-to-run][value=unit]').checked = true;
- var testTypeToRunEls = tr.b.asArray(this.querySelectorAll(
- 'input[name=test-type-to-run]'));
-
- testTypeToRunEls.forEach(
- function(inputEl) {
- inputEl.addEventListener(
- 'click', this.onTestTypeToRunClick_.bind(this));
- }, this);
-
- var shortFormatEl = this.querySelector('#short-format');
- shortFormatEl.checked = this.shortFormat_;
- shortFormatEl.addEventListener(
- 'click', this.onShortFormatClick_.bind(this));
- this.updateShortFormResultsDisplay_();
-
- // Oh, DOM, how I love you. Title is such a convenient property name and I
- // refuse to change my worldview because of tooltips.
- this.__defineSetter__(
- 'title',
- function(title) {
- this.querySelector('#title').textContent = title;
- });
- },
-
- get allTests() {
- return this.allTests_;
- },
-
- set allTests(allTests) {
- this.allTests_ = allTests;
- this.scheduleRerun_();
- },
-
- get testLinks() {
- return this.testLinks_;
- },
- set testLinks(testLinks) {
- this.testLinks_ = testLinks;
- var linksEl = this.querySelector('#links');
- linksEl.textContent = '';
- this.testLinks_.forEach(function(l) {
- var link = document.createElement('a');
- link.href = l.linkPath;
- link.textContent = l.title;
-
- var li = document.createElement('li');
- li.appendChild(link);
-
- linksEl.appendChild(li);
- }, this);
- },
-
- get testFilterString() {
- return this.testFilterString_;
- },
-
- set testFilterString(testFilterString) {
- this.testFilterString_ = testFilterString;
- this.scheduleRerun_();
- if (!this.suppressStateChange_)
- tr.b.dispatchSimpleEvent(this, 'statechange');
- },
-
- get shortFormat() {
- return this.shortFormat_;
- },
-
- set shortFormat(shortFormat) {
- this.shortFormat_ = shortFormat;
- this.querySelector('#short-format').checked = shortFormat;
- if (this.results_)
- this.results_.shortFormat = shortFormat;
- if (!this.suppressStateChange_)
- tr.b.dispatchSimpleEvent(this, 'statechange');
- },
-
- onShortFormatClick_: function(e) {
- this.shortFormat_ = this.querySelector('#short-format').checked;
- this.updateShortFormResultsDisplay_();
- this.updateResultsGivenShortFormat_();
- if (!this.suppressStateChange_)
- tr.b.dispatchSimpleEvent(this, 'statechange');
- },
-
- updateShortFormResultsDisplay_: function() {
- var display = this.shortFormat_ ? '' : 'none';
- this.querySelector('#shortform-results').style.display = display;
- },
-
- updateResultsGivenShortFormat_: function() {
- if (!this.results_)
- return;
-
- if (this.testFilterString_.length || this.testSuiteName_.length)
- this.results_.showHTMLOutput = true;
- else
- this.results_.showHTMLOutput = false;
- this.results_.showPendingAndPassedTests = this.shortFormat_;
- },
-
- get testTypeToRun() {
- return this.testTypeToRun_;
- },
-
- set testTypeToRun(testTypeToRun) {
- this.testTypeToRun_ = testTypeToRun;
- var sel;
- switch (testTypeToRun) {
- case tr.b.unittest.TestTypes.UNITTEST:
- sel = 'input[name=test-type-to-run][value=unit]';
- break;
- case tr.b.unittest.TestTypes.PERFTEST:
- sel = 'input[name=test-type-to-run][value=perf]';
- break;
- case ALL_TEST_TYPES:
- sel = 'input[name=test-type-to-run][value=all]';
- break;
- default:
- throw new Error('Invalid test type to run: ' + testTypeToRun);
- }
- this.querySelector(sel).checked = true;
- this.scheduleRerun_();
- if (!this.suppressStateChange_)
- tr.b.dispatchSimpleEvent(this, 'statechange');
- },
-
- onTestTypeToRunClick_: function(e) {
- switch (e.target.value) {
- case 'unit':
- this.testTypeToRun_ = tr.b.unittest.TestTypes.UNITTEST;
- break;
- case 'perf':
- this.testTypeToRun_ = tr.b.unittest.TestTypes.PERFTEST;
- break;
- case 'all':
- this.testTypeToRun_ = ALL_TEST_TYPES;
- break;
- default:
- throw new Error('Inalid test type: ' + e.target.value);
- }
-
- this.scheduleRerun_();
- if (!this.suppressStateChange_)
- tr.b.dispatchSimpleEvent(this, 'statechange');
- },
-
- onTestPassed_: function() {
- this.querySelector('#shortform-results').
- appendChild(document.createTextNode('.'));
- },
-
- onTestFailed_: function() {
- var span = document.createElement('span');
- span.classList.add('fail');
- span.appendChild(document.createTextNode('F'));
- this.querySelector('#shortform-results').appendChild(span);
- },
-
- onTestFlaky_: function() {
- var span = document.createElement('span');
- span.classList.add('flaky');
- span.appendChild(document.createTextNode('~'));
- this.querySelector('#shortform-results').appendChild(span);
- },
-
- onResultsStatsChanged_: function() {
- var statsEl = this.querySelector('#stats');
- var stats = this.results_.getStats();
- var numTestsOverall = this.runner_.testCases.length;
- var numTestsThatRan = stats.numTestsThatPassed +
- stats.numTestsThatFailed + stats.numFlakyTests;
- statsEl.innerHTML =
- '<span>' + numTestsThatRan + '/' + numTestsOverall +
- '</span> tests run, ' +
- '<span class="unittest-failed">' + stats.numTestsThatFailed +
- '</span> failures, ' +
- '<span class="unittest-flaky">' + stats.numFlakyTests +
- '</span> flaky, ' +
- ' in ' + stats.totalRunTime.toFixed(2) + 'ms.';
- },
-
- scheduleRerun_: function() {
- if (this.rerunPending_)
- return;
- if (this.runner_) {
- this.rerunPending_ = true;
- this.runner_.beginToStopRunning();
- var doRerun = function() {
- this.rerunPending_ = false;
- this.scheduleRerun_();
- }.bind(this);
- this.runner_.runCompletedPromise.then(
- doRerun, doRerun);
- return;
- }
- this.beginRunning_();
- },
-
- beginRunning_: function() {
- var resultsContainer = this.querySelector('#results-container');
- if (this.results_) {
- this.results_.removeEventListener('testpassed', this.onTestPassed_);
- this.results_.removeEventListener('testfailed', this.onTestFailed_);
- this.results_.removeEventListener('testflaky', this.onTestFlaky_);
- this.results_.removeEventListener('statschange',
- this.onResultsStatsChanged_);
- delete this.results_.getHRefForTestCase;
- resultsContainer.removeChild(this.results_);
- }
-
- this.results_ = new tr.b.unittest.HTMLTestResults();
- this.results_.headless = this.headless_;
- this.results_.getHRefForTestCase = this.getHRefForTestCase.bind(this);
- this.updateResultsGivenShortFormat_();
-
- this.results_.shortFormat = this.shortFormat_;
- this.results_.addEventListener('testpassed', this.onTestPassed_);
- this.results_.addEventListener('testfailed', this.onTestFailed_);
- this.results_.addEventListener('testflaky', this.onTestFlaky_);
- this.results_.addEventListener('statschange',
- this.onResultsStatsChanged_);
- resultsContainer.appendChild(this.results_);
-
- var tests = this.allTests_.filter(function(test) {
- var i = test.fullyQualifiedName.indexOf(this.testFilterString_);
- if (i == -1)
- return false;
- if (this.testTypeToRun_ !== ALL_TEST_TYPES &&
- test.testType !== this.testTypeToRun_)
- return false;
- return true;
- }, this);
-
- this.runner_ = new tr.b.unittest.TestRunner(this.results_, tests);
- this.runner_.beginRunning();
-
- this.runner_.runCompletedPromise.then(
- this.runCompleted_.bind(this),
- this.runCompleted_.bind(this));
- },
-
- setState: function(state, opt_suppressStateChange) {
- this.suppressStateChange_ = true;
- if (state.testFilterString !== undefined)
- this.testFilterString = state.testFilterString;
- else
- this.testFilterString = '';
-
- if (state.shortFormat === undefined)
- this.shortFormat = false;
- else
- this.shortFormat = state.shortFormat;
-
- if (state.testTypeToRun === undefined)
- this.testTypeToRun = tr.b.unittest.TestTypes.UNITTEST;
- else
- this.testTypeToRun = state.testTypeToRun;
-
- this.testSuiteName_ = state.testSuiteName || '';
- this.headless_ = state.headless || false;
-
- if (!opt_suppressStateChange)
- this.suppressStateChange_ = false;
-
- this.onShortFormatClick_();
- this.scheduleRerun_();
- this.suppressStateChange_ = false;
- },
-
- getDefaultState: function() {
- return {
- testFilterString: '',
- testSuiteName: '',
- shortFormat: false,
- testTypeToRun: tr.b.unittest.TestTypes.UNITTEST
- };
- },
-
- getState: function() {
- return {
- testFilterString: this.testFilterString_,
- testSuiteName: this.testSuiteName_,
- shortFormat: this.shortFormat_,
- testTypeToRun: this.testTypeToRun_
- };
- },
-
- getHRefForTestCase: function(testCases) {
- return undefined;
- },
-
- runCompleted_: function() {
- this.runner_ = undefined;
- }
- };
-
- function loadAndRunTests(runnerConfig) {
-
- // The test runner no-ops pushState so keep it around.
- var realWindowHistoryPushState = window.history.pushState.bind(
- window.history);
-
- function stateToSearchString(defaultState, state) {
- var parts = [];
- for (var k in state) {
- if (state[k] === defaultState[k])
- continue;
- var v = state[k];
- var kv;
- if (v === true) {
- kv = k;
- } else if (v === false) {
- kv = k + '=false';
- } else if (v === '') {
- continue;
- } else {
- kv = k + '=' + v;
- }
- parts.push(kv);
- }
- return parts.join('&');
- }
-
- function stateFromSearchString(string) {
- var state = {};
- string.split('&').forEach(function(part) {
- if (part == '')
- return;
- var kv = part.split('=');
- var k, v;
- if (kv.length == 1) {
- k = kv[0];
- v = true;
- } else {
- k = kv[0];
- if (kv[1] == 'false')
- v = false;
- else
- v = kv[1];
- }
- state[k] = v;
- });
- return state;
- }
-
- function getSuiteRelpathsToLoad(state) {
- if (state.testSuiteName) {
- return new Promise(function(resolve) {
- var parts = state.testSuiteName.split('.');
- var testSuiteRelPath = '/' + parts.join('/') + '.html';
-
- var suiteRelpathsToLoad = [testSuiteRelPath];
- resolve(suiteRelpathsToLoad);
- });
- }
- return runnerConfig.getAllSuiteRelPathsAsync();
- }
-
-
- function loadAndRunTestsImpl() {
- var state = stateFromSearchString(
- window.location.search.substring(1));
- updateTitle(state);
-
-
- showLoadingOverlay();
-
- var loader;
- var p = getSuiteRelpathsToLoad(state);
- p = p.then(
- function(suiteRelpathsToLoad) {
- loader = new tr.b.unittest.SuiteLoader(suiteRelpathsToLoad);
- return loader.allSuitesLoadedPromise;
- },
- function(e) {
- hideLoadingOverlay();
- throw e;
- });
- p = p.then(
- function() {
- hideLoadingOverlay();
- Polymer.whenReady(function() {
- runTests(loader, state);
- });
- },
- function(err) {
- hideLoadingOverlay();
- tr.showPanic('Module loading failure', err);
- throw err;
- });
- return p;
- }
-
- function showLoadingOverlay() {
- var overlay = document.createElement('div');
- overlay.id = 'tests-loading-overlay';
- overlay.style.backgroundColor = 'white';
- overlay.style.boxSizing = 'border-box';
- overlay.style.color = 'black';
- overlay.style.display = 'flex';
- overlay.style.height = '100%';
- overlay.style.left = 0;
- overlay.style.padding = '8px';
- overlay.style.position = 'fixed';
- overlay.style.top = 0;
- overlay.style.flexDirection = 'column';
- overlay.style.width = '100%';
-
- var element = document.createElement('div');
- element.style.flex = '1 1 auto';
- element.style.overflow = 'auto';
- overlay.appendChild(element);
-
- element.textContent = 'Loading tests...';
- document.body.appendChild(overlay);
- }
- function hideLoadingOverlay() {
- var overlay = document.body.querySelector('#tests-loading-overlay');
- document.body.removeChild(overlay);
- }
-
- function updateTitle(state) {
- var testFilterString = state.testFilterString || '';
- var testSuiteName = state.testSuiteName || '';
-
- var title;
- if (testSuiteName && testFilterString.length) {
- title = testFilterString + ' in ' + testSuiteName;
- } else if (testSuiteName) {
- title = testSuiteName;
- } else if (testFilterString) {
- title = testFilterString + ' in all tests';
- } else {
- title = runnerConfig.title;
- }
-
- if (state.shortFormat)
- title += '(s)';
- document.title = title;
- var runner = document.querySelector('x-base-interactive-test-runner');
- if (runner)
- runner.title = title;
- }
-
- function runTests(loader, state) {
- var runner = new tr.b.unittest.InteractiveTestRunner();
- runner.style.width = '100%';
- runner.style.height = '100%';
- runner.testLinks = runnerConfig.testLinks;
- runner.allTests = loader.getAllTests();
- document.body.appendChild(runner);
-
- runner.setState(state);
- updateTitle(state);
-
- runner.addEventListener('statechange', function() {
- var state = runner.getState();
- var stateString = stateToSearchString(runner.getDefaultState(),
- state);
- if (window.location.search.substring(1) == stateString)
- return;
-
- updateTitle(state);
- var stateURL;
- if (stateString.length > 0)
- stateURL = window.location.pathname + '?' + stateString;
- else
- stateURL = window.location.pathname;
- realWindowHistoryPushState(state, document.title, stateURL);
- });
-
- window.addEventListener('popstate', function(state) {
- runner.setState(state, true);
- });
-
- runner.getHRefForTestCase = function(testCase) {
- var state = runner.getState();
- if (state.testFilterString === '' &&
- state.testSuiteName === '') {
- state.testSuiteName = testCase.suite.name;
- state.testFilterString = '';
- state.shortFormat = false;
- } else {
- state.testSuiteName = testCase.suite.name;
- state.testFilterString = testCase.name;
- state.shortFormat = false;
- }
- var stateString = stateToSearchString(runner.getDefaultState(),
- state);
- if (stateString.length > 0)
- return window.location.pathname + '?' + stateString;
- else
- return window.location.pathname;
- };
- }
-
- loadAndRunTestsImpl();
- }
-
- return {
- InteractiveTestRunner: InteractiveTestRunner,
- loadAndRunTests: loadAndRunTests
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/unittest/suite_loader.html b/chromium/third_party/catapult/tracing/tracing/base/unittest/suite_loader.html
deleted file mode 100644
index 08fc7dc5ffa..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/unittest/suite_loader.html
+++ /dev/null
@@ -1,244 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/base/event_target.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/unittest/test_suite.html">
-<link rel="import" href="/tracing/base/xhr.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.b.unittest', function() {
- function HTMLImportsModuleLoader() {
- }
- HTMLImportsModuleLoader.prototype = {
- loadModule: function(testRelpath, moduleName) {
- return new Promise(function(resolve, reject) {
- var importEl = document.createElement('link');
- importEl.moduleName = moduleName;
- importEl.setAttribute('rel', 'import');
- importEl.setAttribute('href', testRelpath);
-
- importEl.addEventListener('load', function() {
- resolve({testRelpath: testRelpath,
- moduleName: moduleName});
- });
- importEl.addEventListener('error', function(e) {
- reject('Error loading &#60;link rel="import" href="' +
- testRelpath + '"');
- });
-
- tr.doc.head.appendChild(importEl);
- });
- },
-
- getCurrentlyExecutingModuleName: function() {
- if (!document.currentScript)
- throw new Error('Cannot call testSuite except during load.');
- var linkDoc = document.currentScript.ownerDocument;
- var url = linkDoc.URL;
- var name = this.guessModuleNameFromURL_(url);
- return name;
- },
-
- guessModuleNameFromURL_: function(url) {
- var m = /.+?:\/\/.+?(\/.+)/.exec(url);
- if (!m)
- throw new Error('Guessing module name failed');
- var path = m[1];
- if (path[0] != '/')
- throw new Error('malformed path');
- if (path.substring(path.length - 5) != '.html')
- throw new Error('Cannot define testSuites outside html imports');
- var parts = path.substring(1, path.length - 5).split('/');
- return parts.join('.');
- }
- };
-
- function HeadlessModuleLoader() {
- this.currentlyExecutingModuleInfo_ = undefined;
- }
- HeadlessModuleLoader.prototype = {
- loadModule: function(testRelpath, moduleName) {
- return Promise.resolve().then(function() {
- var moduleInfo = {
- testRelpath: testRelpath,
- moduleName: moduleName
- };
- if (this.currentlyExecutingModuleInfo_ !== undefined)
- throw new Error('WAT');
- this.currentlyExecutingModuleInfo_ = moduleInfo;
-
- try {
- loadHTML(testRelpath);
- } catch (e) {
- e.message = 'While loading ' + moduleName + ', ' + e.message;
- e.stack = 'While loading ' + moduleName + ', ' + e.stack;
- throw e;
- } finally {
- this.currentlyExecutingModuleInfo_ = undefined;
- }
-
- return moduleInfo;
- }.bind(this));
- },
-
- getCurrentlyExecutingModuleName: function() {
- if (this.currentlyExecutingModuleInfo_ === undefined)
- throw new Error('No currently loading module');
- return this.currentlyExecutingModuleInfo_.moduleName;
- }
- };
-
-
- function SuiteLoader(suiteRelpathsToLoad) {
- tr.b.EventTarget.call(this);
-
- this.currentModuleLoader_ = undefined;
- this.testSuites = [];
-
- if (tr.isHeadless) {
- this.currentModuleLoader_ = new HeadlessModuleLoader();
- } else {
- this.currentModuleLoader_ = new HTMLImportsModuleLoader();
- }
-
- this.allSuitesLoadedPromise = this.beginLoadingModules_(
- suiteRelpathsToLoad);
- }
-
- SuiteLoader.prototype = {
- __proto__: tr.b.EventTarget.prototype,
-
- beginLoadingModules_: function(testRelpaths) {
- // Hooks!
- this.bindGlobalHooks_();
-
- // Load the modules.
- var modulePromises = [];
- for (var i = 0; i < testRelpaths.length; i++) {
- var testRelpath = testRelpaths[i];
- var moduleName = testRelpath.split('/').slice(-1)[0];
-
- var p = this.currentModuleLoader_.loadModule(testRelpath, moduleName);
- modulePromises.push(p);
- }
-
- var allModulesLoadedPromise = new Promise(function(resolve, reject) {
- var remaining = modulePromises.length;
- var resolved = false;
- function oneMoreLoaded() {
- if (resolved)
- return;
- remaining--;
- if (remaining > 0)
- return;
- resolved = true;
- resolve();
- }
-
- function oneRejected(e) {
- if (resolved)
- return;
- resolved = true;
- reject(e);
- }
-
- modulePromises.forEach(function(modulePromise) {
- modulePromise.then(oneMoreLoaded, oneRejected);
- });
- });
-
- // Script errors errors abort load;
- var scriptErrorPromise = new Promise(function(xresolve, xreject) {
- this.scriptErrorPromiseResolver_ = {
- resolve: xresolve,
- reject: xreject
- };
- }.bind(this));
- var donePromise = Promise.race([
- allModulesLoadedPromise,
- scriptErrorPromise
- ]);
-
- // Cleanup.
- return donePromise.then(
- function() {
- this.scriptErrorPromiseResolver_ = undefined;
- this.unbindGlobalHooks_();
- }.bind(this),
- function(e) {
- this.scriptErrorPromiseResolver_ = undefined;
- this.unbindGlobalHooks_();
- throw e;
- }.bind(this));
- },
-
- bindGlobalHooks_: function() {
- if (global._currentSuiteLoader !== undefined)
- throw new Error('A suite loader exists already');
- global._currentSuiteLoader = this;
-
- this.oldGlobalOnError_ = global.onerror;
- global.onerror = function(errorMsg, url, lineNumber) {
- this.scriptErrorPromiseResolver_.reject(
- new Error(errorMsg + '\n' + url + ':' + lineNumber));
- if (this.oldGlobalOnError_)
- return this.oldGlobalOnError_(errorMsg, url, lineNumber);
- return false;
- }.bind(this);
- },
-
- unbindGlobalHooks_: function() {
- global._currentSuiteLoader = undefined;
-
- global.onerror = this.oldGlobalOnError_;
- this.oldGlobalOnError_ = undefined;
- },
-
- constructAndRegisterTestSuite: function(suiteConstructor) {
- var name = this.currentModuleLoader_.getCurrentlyExecutingModuleName();
-
- var testSuite = new tr.b.unittest.TestSuite(
- name, suiteConstructor);
-
- this.testSuites.push(testSuite);
-
- var e = new tr.b.Event('suite-loaded');
- e.testSuite = testSuite;
- this.dispatchEvent(e);
- },
-
- getAllTests: function() {
- var tests = [];
- this.testSuites.forEach(function(suite) {
- tests.push.apply(tests, suite.tests);
- });
- return tests;
- },
-
- findTestWithFullyQualifiedName: function(fullyQualifiedName) {
- for (var i = 0; i < this.testSuites.length; i++) {
- var suite = this.testSuites[i];
- for (var j = 0; j < suite.tests.length; j++) {
- var test = suite.tests[j];
- if (test.fullyQualifiedName == fullyQualifiedName)
- return test;
- }
- }
- throw new Error('Test ' + fullyQualifiedName +
- 'not found amongst ' + this.testSuites.length);
- }
- };
-
- return {
- SuiteLoader: SuiteLoader
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/unittest/test_case.html b/chromium/third_party/catapult/tracing/tracing/base/unittest/test_case.html
deleted file mode 100644
index f092f2a9461..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/unittest/test_case.html
+++ /dev/null
@@ -1,140 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/base/unittest/constants.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b.unittest', function() {
- var TestTypes = tr.b.unittest.TestTypes;
-
- function TestCase(name, opt_testFn, opt_options) {
- if (!name)
- throw new Error('Name must be provided');
- this.guid_ = tr.b.GUID.allocateSimple();
- this.suite_ = undefined; // Set by TestSuite.addTest.
- this.name_ = name;
-
- if (opt_options)
- this.options_ = opt_options;
- else
- this.options_ = {};
-
- this.testFn_ = opt_testFn;
- }
-
- TestCase.parseFullyQualifiedName = function(fqn) {
- var i = fqn.lastIndexOf('.');
- if (i == -1)
- throw new Error('FullyQualifiedNames must have a period in them');
- return {
- suiteName: fqn.substr(0, i),
- testCaseName: fqn.substr(i + 1)
- };
- };
-
- TestCase.prototype = {
- __proto__: Object.prototype,
-
- get guid() {
- return this.guid_;
- },
-
- get suite() {
- return this.suite_;
- },
-
- set suite(suite) {
- if (this.suite_ !== undefined)
- throw new Error('Suite can only be assigned once.');
- this.suite_ = suite;
- },
-
- get testType() {
- return TestTypes.UNITTEST;
- },
-
- get name() {
- return this.name_;
- },
-
- get fullyQualifiedName() {
- return this.suite_.name + '.' + this.name_;
- },
-
- get options() {
- return this.options_;
- },
-
- setUp: function() {
- if (this.options_.setUp)
- this.options_.setUp.call(this);
- },
-
- run: function(htmlHook) {
- return this.testFn_();
- },
-
- tearDown: function() {
- if (this.options_.tearDown)
- this.options_.tearDown.call(this);
- },
-
- // TODO(nduca): The routing of this is a bit awkward. Probably better
- // to install a global function.
- addHTMLOutput: function(element) {
- tr.b.unittest.addHTMLOutputForCurrentTest(element);
- }
- };
-
- function PerfTestCase(name, testFn, opt_options) {
- TestCase.call(this, name, testFn, opt_options);
- this.iterations = this.options.iterations || 10;
- }
-
- PerfTestCase.prototype = {
- __proto__: TestCase.prototype,
-
- get testType() {
- return TestTypes.PERFTEST;
- },
-
- run: function() {
- var durations = [];
- var iterations = this.iterations;
- for (var i = 0; i < iterations; ++i) {
- var start = window.performance.now();
- this.runOneIteration();
- var duration = window.performance.now() - start;
- durations.push(duration);
- }
-
- var durationStrings = durations.map(function(d) {
- return d.toFixed(2) + 'ms';
- });
- var average = tr.b.Statistics.mean(durations);
- var min = tr.b.Statistics.min(durations);
-
- var summaryString = ' [';
- summaryString += 'min ' + min.toFixed(2) + 'ms, ';
- summaryString += 'avg ' + average.toFixed(2) + 'ms';
- summaryString += ']';
-
- return durationStrings.join(', ') + summaryString;
- },
-
- runOneIteration: function() {
- this.testFn_();
- }
- };
-
- return {
- TestCase: TestCase,
- PerfTestCase: PerfTestCase
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/unittest/test_case_test.html b/chromium/third_party/catapult/tracing/tracing/base/unittest/test_case_test.html
deleted file mode 100644
index 33f176ad5c5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/unittest/test_case_test.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/unittest/test_case.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('parseFullyQualifiedName', function() {
- var p = tr.b.unittest.TestCase.parseFullyQualifiedName('foo.bar');
- assert.equal(p.suiteName, 'foo');
- assert.equal(p.testCaseName, 'bar');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/unittest/test_runner.html b/chromium/third_party/catapult/tracing/tracing/base/unittest/test_runner.html
deleted file mode 100644
index 683372b2c0d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/unittest/test_runner.html
+++ /dev/null
@@ -1,273 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/raf.html">
-<link rel="import" href="/tracing/base/timing.html">
-<link rel="import" href="/tracing/base/event_target.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b.unittest', function() {
- var realTvOnAnimationFrameError;
- var realGlobalOnError;
- var realGlobalHistoryPushState;
-
- var NUM_TESTS_PER_RIC = 16;
-
- function installGlobalTestHooks(runner) {
- realTvOnAnimationFrameError = tr.b.onAnimationFrameError;
- tr.b.onAnimationFrameError = function(error) {
- runner.results.addErrorForCurrentTest(error);
- };
-
- if (tr.isExported('global.onerror')) {
- realGlobalOnError = global.onerror;
- global.onerror = function(errorMsg, url, lineNumber) {
- runner.results.addErrorForCurrentTest(
- errorMsg + ' at ' + url + ':' + lineNumber);
- if (realGlobalOnError)
- return realGlobalOnError(errorMsg, url, lineNumber);
- return false;
- };
- }
-
- if (tr.isExported('global.history')) {
- realGlobalHistoryPushState = global.history.pushState;
- global.history.pushState = function() {
- };
- }
-
- tr.b.unittest.addHTMLOutputForCurrentTest = function(element) {
- runner.results.addHTMLOutputForCurrentTest(element);
- };
-
- if (tr.isExported('global.sessionStorage')) {
- global.sessionStorage.clear();
- }
-
- var e = new tr.b.Event('tr-unittest-will-run');
- TestRunner.dispatchEvent(e);
- }
-
- function uninstallGlobalTestHooks() {
- if (tr.isExported('global.onerror')) {
- global.onerror = realGlobalOnError;
- realGlobalOnError = undefined;
- }
-
- tr.b.onAnimationFrameError = realTvOnAnimationFrameError;
- realTvOnAnimationFrameError = undefined;
-
- if (tr.isExported('global.history')) {
- global.history.pushState = realGlobalHistoryPushState;
- realGlobalHistoryPushState = undefined;
- }
-
- tr.b.unittest.addHTMLOutputForCurrentTest = undefined;
- }
-
-
- function TestRunner(results, testCases) {
- this.results_ = results;
- this.testCases_ = testCases;
- this.pendingTestCases_ = [];
-
- this.runOneTestCaseScheduled_ = false;
- this.numRunsSinceLastRIC_ = 0;
-
- this.runCompletedPromise = undefined;
- this.runCompletedResolver_ = undefined;
-
- this.currentTestCase_ = undefined;
- }
-
- TestRunner.prototype = {
- __proto__: Object.prototype,
-
- beginRunning: function() {
- if (this.pendingTestCases_.length)
- throw new Error('Tests still running!');
-
- this.runCompletedPromise = new Promise(function(resolve, reject) {
- this.runCompletedResolver_ = {
- resolve: resolve,
- reject: reject
- };
- }.bind(this));
-
- this.pendingTestCases_ = this.testCases_.slice(0);
-
- this.results_.willRunTests(this.pendingTestCases_);
-
- this.scheduleRunOneTestCase_();
-
- return this.runCompletedPromise;
- },
-
- beginToStopRunning: function() {
- if (!this.runCompletedResolver_)
- throw new Error('Still running');
- this.pendingTestCases_ = [];
- return this.runCompletedPromise;
- },
-
- get testCases() {
- return this.testCases_;
- },
-
- get results() {
- return this.results_;
- },
-
- scheduleRunOneTestCase_: function() {
- if (this.runOneTestCaseScheduled_)
- return;
- this.runOneTestCaseScheduled_ = true;
-
- this.numRunsSinceLastRIC_++;
- if (this.numRunsSinceLastRIC_ === NUM_TESTS_PER_RIC) {
- this.numRunsSinceLastRIC_ = 0;
- tr.b.requestIdleCallback(this.runOneTestCase_, this);
- } else {
- Promise.resolve().then(this.runOneTestCase_.bind(this));
- }
- },
-
- runOneTestCase_: function() {
- this.runOneTestCaseScheduled_ = false;
-
- if (this.pendingTestCases_.length == 0) {
- this.didFinishRunningAllTests_();
- return;
- }
-
- this.currentTestCase_ = this.pendingTestCases_.splice(0, 1)[0];
- this.currentMark_ = tr.b.Timing.mark(
- 'TestRunner', 'RunTest', {testName: this.currentTestCase_.name});
- this.results_.willRunTest(this.currentTestCase_);
-
- if (this.isCurrentTestFlaky_()) {
- this.results_.setCurrentTestFlaky();
- this.results_.didCurrentTestEnd();
- this.currentMark_.end();
- this.currentTestCase_ = undefined;
- this.scheduleRunOneTestCase_();
- return;
- }
-
- if (!this.setUpCurrentTestCase_()) {
- this.results_.didCurrentTestEnd();
- this.currentMark_.end();
- this.currentTestCase_ = undefined;
- this.scheduleRunOneTestCase_();
- return;
- }
-
- this.runCurrentTestCase_().then(
- function pass(result) {
- try {
- this.tearDownCurrentTestCase_(true);
- if (result)
- this.results_.setReturnValueFromCurrentTest(result);
- this.results_.didCurrentTestEnd();
- this.currentMark_.end();
- this.currentTestCase_ = undefined;
- this.scheduleRunOneTestCase_();
- } catch (e) {
- this.hadInternalError_(e);
- throw e;
- }
- }.bind(this),
- function fail(error) {
- try {
- this.results_.addErrorForCurrentTest(error);
- this.tearDownCurrentTestCase_(false);
- this.results_.didCurrentTestEnd();
- this.currentMark_.end();
- this.currentTestCase_ = undefined;
- this.scheduleRunOneTestCase_();
- } catch (e) {
- this.hadInternalError_(e);
- throw e;
- }
- }.bind(this));
- },
-
- isCurrentTestFlaky_: function() {
- return !!this.currentTestCase_.options['flaky'];
- },
-
- setUpCurrentTestCase_: function() {
- // Try setting it up. Return true if succeeded.
- installGlobalTestHooks(this);
- try {
- this.currentTestCase_.setUp();
- } catch (error) {
- this.results_.addErrorForCurrentTest(error);
- return false;
- }
- return true;
- },
-
- runCurrentTestCase_: function() {
- return new Promise(function(resolve, reject) {
- try {
- var maybePromise = this.currentTestCase_.run();
- } catch (error) {
- reject(error);
- return;
- }
-
- if (maybePromise !== undefined && maybePromise.then) {
- maybePromise.then(
- function(result) {
- resolve(result);
- },
- function(error) {
- reject(error);
- });
- } else {
- resolve(maybePromise);
- }
- }.bind(this));
- },
-
- hadInternalError_: function(outerE) {
- try {
- this.results.didRunTests();
- } catch (e) {
- console.log('Had another error during hadInternalError_!');
- console.log(e.stack);
- }
-
- this.runCompletedResolver_.reject(outerE);
- this.runCompletedResolver_ = undefined;
- },
-
- tearDownCurrentTestCase_: function() {
- try {
- this.currentTestCase_.tearDown();
- } catch (error) {
- this.results_.addErrorForCurrentTest(error);
- }
-
- uninstallGlobalTestHooks();
- },
-
- didFinishRunningAllTests_: function() {
- this.results.didRunTests();
- this.runCompletedResolver_.resolve();
- this.runCompletedResolver_ = undefined;
- }
- };
-
- tr.b.EventTarget.decorate(TestRunner);
-
- return {
- TestRunner: TestRunner
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/unittest/test_suite.html b/chromium/third_party/catapult/tracing/tracing/base/unittest/test_suite.html
deleted file mode 100644
index 9dbf2ce3358..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/unittest/test_suite.html
+++ /dev/null
@@ -1,135 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/base/unittest/constants.html">
-<link rel="import" href="/tracing/base/unittest/test_case.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.b.unittest', function() {
- var TestCase = tr.b.unittest.TestCase;
- var PerfTestCase = tr.b.unittest.PerfTestCase;
-
- var TestTypes = tr.b.unittest.TestTypes;
-
- function TestSuite(name, suiteConstructor) {
- this.guid = tr.b.GUID.allocateSimple();
- this.name_ = name;
- this.tests_ = [];
- this.testNames_ = {}; // For dupe checking.
-
- global.flakyTest = function(testCaseOrName, opt_testFn, opt_options) {
- if (testCaseOrName instanceof TestCase) {
- testCaseOrName.options['flaky'] = true;
- test(testCaseOrName);
- } else {
- var options = opt_options || {};
- options['flaky'] = true;
- test(testCaseOrName, opt_testFn, options);
- }
- }.bind(this);
-
- global.test = function(testCaseOrName, opt_testFn, opt_options) {
- if (testCaseOrName instanceof TestCase) {
- if (opt_testFn !== undefined)
- throw new Error('opt_testFn cannot be given when giving a TestCase');
- if (opt_options !== undefined)
- throw new Error('opt_options cannot be given when giving a TestCase');
- this.addTest(testCaseOrName);
- return;
- }
-
- var testName = testCaseOrName;
- var testFn = opt_testFn;
- var options = opt_options || {};
- if (testFn == undefined)
- throw new Error('Must provide opt_testFn');
-
- // If the test cares about DPI settings then we first push a test
- // that fakes the DPI as the low or hi Dpi version, depending on what
- // we're current using.
- if (options.dpiAware) {
- var defaultDevicePixelRatio = window.devicePixelRatio;
- var dpi = defaultDevicePixelRatio > 1 ? 1 : 2;
-
- var testWrapper = function() {
- window.devicePixelRatio = dpi;
- try {
- testFn.bind(this).call();
- } finally {
- window.devicePixelRatio = defaultDevicePixelRatio;
- }
- };
-
- var newName = name;
- if (dpi === 1) {
- newName += '_loDPI';
- testName += '_hiDPI';
- } else {
- newName += '_hiDPI';
- testName += '_loDPI';
- }
-
- this.addTest(new TestCase(newName,
- testWrapper, options || {}));
- }
-
- this.addTest(new TestCase(testName,
- testFn, options || {}));
- }.bind(this);
-
- global.timedPerfTest = function(name, testFn, options) {
- if (options === undefined || options.iterations === undefined)
- throw new Error('timedPerfTest must have iteration option provided.');
- this.addTest(new PerfTestCase(name, testFn, options));
- }.bind(this);
-
- try {
- suiteConstructor.call();
- } finally {
- global.test = undefined;
- global.timedPerfTest = undefined;
- }
- }
-
- TestSuite.prototype = {
- __proto__: Object.prototype,
-
- get tests() {
- return this.tests_;
- },
-
- addTest: function(test) {
- if (test.suite !== undefined)
- throw new Error('Test suite is already assigned');
- if (this.testNames_[test.name] !== undefined)
- throw new Error('Test name already used');
- test.suite = this;
- this.testNames_[test.name] = true;
- this.tests_.push(test);
- },
-
- get name() {
- return this.name_;
- }
- };
-
- function testSuite(suiteConstructor) {
- if (!global._currentSuiteLoader)
- throw new Error('testSuites can only be defined during suite loading');
- global._currentSuiteLoader.constructAndRegisterTestSuite(suiteConstructor);
- }
-
- return {
- TestSuite: TestSuite,
- testSuite: testSuite
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/unittest/text_test_results.html b/chromium/third_party/catapult/tracing/tracing/base/unittest/text_test_results.html
deleted file mode 100644
index c1cae626aea..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/unittest/text_test_results.html
+++ /dev/null
@@ -1,117 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/base/unittest/constants.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.b.unittest', function() {
- /**
- * @constructor
- */
- function TextTestResults() {
- this.numTestsThatPassed_ = 0;
- this.numTestsThatFailed_ = 0;
- this.numFlakyTests_ = 0;
- this.currentTestCaseHadErrors_ = false;
- this.currentTestIsFlaky_ = false;
- }
-
- TextTestResults.prototype = {
- get numTestsThatRan() {
- return this.numTestsThatPassed_ + this.numTestsThatFailed_ +
- this.numFlakyTests_;
- },
-
- get numTestsThatFailed() {
- return this.numTestsThatFailed_;
- },
-
- get numTestsThatPassed() {
- return this.numTestsThatPassed_;
- },
-
- get numFlakyTests() {
- return this.numFlakyTests_;
- },
-
- willRunTests: function(testCases) {
- },
-
- willRunTest: function(testCase) {
- this.write_(testCase.name + ' (' + testCase.suite.name + ') ... ');
- this.currentTestCaseHadErrors_ = false;
- this.currentTestIsFlaky_ = false;
- },
-
- addErrorForCurrentTest: function(error) {
- if (!this.currentTestCaseHadErrors_)
- this.write_('FAIL\n');
- var normalizedException = tr.b.normalizeException(error);
- this.write_(normalizedException.stack + '\n');
- this.currentTestCaseHadErrors_ = true;
- },
-
- addHTMLOutputForCurrentTest: function(element) {
- this.curHTMLOutput_.push(element);
- },
-
- setCurrentTestFlaky: function() {
- if (!this.currentTestIsFlaky_)
- this.write_('FLAKY\n');
- this.currentTestIsFlaky_ = true;
- },
-
- setReturnValueFromCurrentTest: function(returnValue) {
- this.write_('[RESULT] ' + JSON.stringify(returnValue) + '\n');
- },
-
- didCurrentTestEnd: function() {
- if (this.currentTestCaseHadErrors_) {
- this.numTestsThatFailed_ += 1;
- } else if (this.currentTestIsFlaky_) {
- this.numFlakyTests_ += 1;
- } else {
- this.numTestsThatPassed_ += 1;
- this.write_('ok\n');
- }
- },
-
- didRunTests: function() {
- this.write_('\n------------------------------------------------------' +
- '----------------\n');
- if (this.numTestsThatRan === 1)
- this.write_('Ran 1 test\n');
- else
- this.write_('Ran ' + this.numTestsThatRan + ' tests\n');
-
- if (this.numTestsThatFailed > 0) {
- var flakyString = this.numFlakyTests == 0 ? '' :
- ' flaky=' + this.numFlakyTests;
- this.write_('\nFAILED (errors=' + this.numTestsThatFailed +
- flakyString + ')');
- } else {
- var flakyString = this.numFlakyTests == 0 ? '' :
- ' (flaky=' + this.numFlakyTests + ')';
- this.write_('\nOK' + flakyString);
- }
- },
-
- write_: function(msg) {
- if (tr.isVinn)
- global.write(msg);
- else
- console.log(msg);
- }
- };
-
- return {
- TextTestResults: TextTestResults
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/unittest_test.html b/chromium/third_party/catapult/tracing/tracing/base/unittest_test.html
deleted file mode 100644
index b3ef6dc7d76..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/unittest_test.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/unittest.html">
-<link rel="import" href="/tracing/base/raf.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
-
- test('promise', function() {
- return new Promise(function(resolve, reject) {
- resolve();
- });
- });
-
- test('async', function() {
- return new Promise(function(resolve) {
- tr.b.requestAnimationFrame(function() {
- resolve();
- });
- });
- });
-
- /* To test failures remove comments
- test('fail', function() {
- assert.equal(true, false);
- });
-
- test('rejected-promise', function() {
- return new Promise(function(resolve, reject){
- reject("Failure by rejection");
- });
- });
-
- test('promise-that-throws-after-resolver', function() {
- return new Promise(function(resolve, rejet){
- throw new Error('blah');
- });
- });
-
- */
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/utils.html b/chromium/third_party/catapult/tracing/tracing/base/utils.html
deleted file mode 100644
index 1a98cab4052..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/utils.html
+++ /dev/null
@@ -1,131 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
- /**
- * Adds a {@code getInstance} static method that always return the same
- * instance object.
- * @param {!Function} ctor The constructor for the class to add the static
- * method to.
- */
- function addSingletonGetter(ctor) {
- ctor.getInstance = function() {
- return ctor.instance_ || (ctor.instance_ = new ctor());
- };
- }
-
- function deepCopy(value) {
- if (!(value instanceof Object)) {
- if (value === undefined || value === null)
- return value;
- if (typeof value == 'string')
- return value.substring();
- if (typeof value == 'boolean')
- return value;
- if (typeof value == 'number')
- return value;
- throw new Error('Unrecognized: ' + typeof value);
- }
-
- var object = value;
- if (object instanceof Array) {
- var res = new Array(object.length);
- for (var i = 0; i < object.length; i++)
- res[i] = deepCopy(object[i]);
- return res;
- }
-
- if (object.__proto__ != Object.prototype)
- throw new Error('Can only clone simple types');
- var res = {};
- for (var key in object) {
- res[key] = deepCopy(object[key]);
- }
- return res;
- }
-
- function normalizeException(e) {
- if (e === undefined || e === null) {
- return {
- typeName: 'UndefinedError',
- message: 'Unknown: null or undefined exception',
- stack: 'Unknown'
- };
- }
-
- if (typeof(e) == 'string') {
- return {
- typeName: 'StringError',
- message: e,
- stack: [e]
- };
- }
-
- var typeName;
- if (e.name) {
- typeName = e.name;
- } else if (e.constructor) {
- if (e.constructor.name) {
- typeName = e.constructor.name;
- } else {
- typeName = 'AnonymousError';
- }
- } else {
- typeName = 'ErrorWithNoConstructor';
- }
-
- var msg = e.message ? e.message : 'Unknown';
- return {
- typeName: typeName,
- message: msg,
- stack: e.stack ? e.stack : [msg]
- };
- }
-
- function stackTraceAsString() {
- return new Error().stack + '';
- }
- function stackTrace() {
- var stack = stackTraceAsString();
- stack = stack.split('\n');
- return stack.slice(2);
- }
-
- function getUsingPath(path, from_dict) {
- var parts = path.split('.');
- var cur = from_dict;
-
- for (var part; parts.length && (part = parts.shift());) {
- if (!parts.length) {
- return cur[part];
- } else if (part in cur) {
- cur = cur[part];
- } else {
- return undefined;
- }
- }
- return undefined;
- }
-
- return {
- addSingletonGetter: addSingletonGetter,
-
- deepCopy: deepCopy,
-
- normalizeException: normalizeException,
- stackTrace: stackTrace,
- stackTraceAsString: stackTraceAsString,
-
- getUsingPath: getUsingPath
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/utils_test.html b/chromium/third_party/catapult/tracing/tracing/base/utils_test.html
deleted file mode 100644
index a08ac33b24e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/utils_test.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('getUsingPath', function() {
- var z = tr.b.getUsingPath('x.y.z', {'x': {'y': {'z': 3}}});
- assert.equal(z, 3);
-
- var w = tr.b.getUsingPath('x.w', {'x': {'y': {'z': 3}}});
- assert.isUndefined(w);
- });
-
- test('testExceptionNaming', function() {
- var err = new Error('asdf');
- err.name = 'MyError';
-
- var ex = tr.b.normalizeException(err);
- assert.equal(ex.typeName, 'MyError');
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/base/xhr.html b/chromium/third_party/catapult/tracing/tracing/base/xhr.html
deleted file mode 100644
index 37ce4c2964f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/base/xhr.html
+++ /dev/null
@@ -1,144 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
- var fs;
- if (tr.isNode)
- fs = require('fs');
-
- function guessBinary(url) {
- return /[.]gz$/.test(url) || /[.]zip$/.test(url);
- }
- function xhr(method, url, async, opt_data, force_binary) {
- var req = new XMLHttpRequest();
- req.overrideMimeType('text/plain; charset=x-user-defined');
- req.open(method, url, async);
-
- var isBinary = force_binary;
-
- if (isBinary === undefined) {
- guessBinary(url);
- if (isBinary && async)
- req.responseType = 'arraybuffer';
- }
-
- var data = opt_data !== undefined ? opt_data : null;
-
- if (!async) {
- req.send(data);
- if (req.status == 200) {
- return req.responseText;
- } else {
- throw new Error('XHR failed with status ' + req.status);
- }
- }
-
- var p = new Promise(function(resolve, reject) {
- req.onreadystatechange = function(aEvt) {
- if (req.readyState == 4) {
- window.setTimeout(function() {
- if (req.status == 200) {
- if (req.responseType === 'arraybuffer')
- return resolve(req.response);
- return resolve(req.responseText);
- } else {
- reject(new Error('XHR failed with status ' + req.status));
- }
- }, 0);
- }
- };
- });
- req.send(data);
- return p;
- }
-
- function getAsync(url) {
- // Browser.
- if (!tr.isHeadless)
- return xhr('GET', url, true);
-
- // Node or vinn prep.
- var filename;
- if (url.startsWith('file:///'))
- filename = url.substring(7);
- else
- filename = global.HTMLImportsLoader.hrefToAbsolutePath(url);
- var isBinary = guessBinary(url);
-
- // Node.
- if (tr.isNode) {
- var encoding = isBinary ? undefined : 'utf8';
- return new Promise(function(resolve, reject) {
- fs.readFile(filename, encoding, function(err, data) {
- if (err) {
- reject(err);
- return;
- }
- resolve(data);
- });
- });
- }
-
- // Vinn.
- return Promise.resolve().then(function() {
- if (isBinary)
- return readbuffer(filename);
- return read(filename);
- });
- }
-
- function getSync(url) {
- // Browser.
- if (!tr.isHeadless)
- return xhr('GET', url, false);
-
- // Node or vinn prep.
- var filename;
- if (url.startsWith('file:///')) // posix
- filename = url.substring(7);
- else if (url.startsWith('file://') && url[8] === ':') // win
- filename = url.substring(7);
- else
- filename = global.HTMLImportsLoader.hrefToAbsolutePath(url);
- var isBinary = guessBinary(url);
-
- // Node.
- if (tr.isNode) {
- var encoding = isBinary ? undefined : 'utf8';
- return fs.readFileSync(filename, encoding);
- }
-
- // Vinn.
- if (isBinary)
- return readbuffer(filename);
- return read(filename);
- }
-
- function postAsync(url, data) {
- if (tr.isHeadless)
- throw new Error('Only supported inside a browser');
- return xhr('POST', url, true, data);
- }
-
- function postTextAsync(url, data) {
- if (tr.isHeadless)
- throw new Error('Only supported inside a browser');
- return xhr('POST', url, true, data, false);
- }
-
- return {
- getAsync: getAsync,
- getSync: getSync,
- postAsync: postAsync
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/core/auditor.html b/chromium/third_party/catapult/tracing/tracing/core/auditor.html
deleted file mode 100644
index 5616073a27b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/core/auditor.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/extension_registry.html">
-<script>
-'use strict';
-
-/**
- * @fileoverview Base class for auditors.
- */
-tr.exportTo('tr.c', function() {
- function Auditor(model) {
- this.model_ = model;
- }
-
- Auditor.prototype = {
- __proto__: Object.prototype,
-
- get model() {
- return this.model_;
- },
-
- /**
- * Called by the Model after baking slices. May modify model.
- */
- runAnnotate: function() {
- },
-
- /**
- * Called by import to install userFriendlyCategoryDriver.
- */
- installUserFriendlyCategoryDriverIfNeeded: function() {
- },
-
- /**
- * Called by the Model after importing. Should not modify model, except
- * for adding interaction ranges and audits.
- */
- runAudit: function() {
- }
- };
-
- var options = new tr.b.ExtensionRegistryOptions(tr.b.BASIC_REGISTRY_MODE);
- options.defaultMetadata = {};
- options.mandatoryBaseClass = Auditor;
- tr.b.decorateExtensionRegistry(Auditor, options);
-
- return {
- Auditor: Auditor
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/core/filter.html b/chromium/third_party/catapult/tracing/tracing/core/filter.html
deleted file mode 100644
index a8466f6a730..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/core/filter.html
+++ /dev/null
@@ -1,131 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.c', function() {
- function makeCaseInsensitiveRegex(pattern) {
- // See https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/
- // Regular_Expressions.
- pattern = pattern.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
- return new RegExp(pattern, 'i');
- }
-
- /**
- * @constructor The generic base class for filtering a Model based on
- * various rules. The base class returns true for everything.
- */
- function Filter() { }
-
- Filter.prototype = {
- __proto__: Object.prototype,
-
- matchCounter: function(counter) {
- return true;
- },
-
- matchCpu: function(cpu) {
- return true;
- },
-
- matchProcess: function(process) {
- return true;
- },
-
- matchSlice: function(slice) {
- return true;
- },
-
- matchThread: function(thread) {
- return true;
- }
- };
-
- /**
- * @constructor A filter that matches objects by their name or category
- * case insensitive.
- * .findAllObjectsMatchingFilter
- */
- function TitleOrCategoryFilter(text) {
- Filter.call(this);
- this.regex_ = makeCaseInsensitiveRegex(text);
-
- if (!text.length)
- throw new Error('Filter text is empty.');
- }
- TitleOrCategoryFilter.prototype = {
- __proto__: Filter.prototype,
-
- matchSlice: function(slice) {
- if (slice.title === undefined && slice.category === undefined)
- return false;
-
- return this.regex_.test(slice.title) ||
- (!!slice.category && this.regex_.test(slice.category));
- }
- };
-
- /**
- * @constructor A filter that matches objects with the exact given title.
- */
- function ExactTitleFilter(text) {
- Filter.call(this);
- this.text_ = text;
-
- if (!text.length)
- throw new Error('Filter text is empty.');
- }
- ExactTitleFilter.prototype = {
- __proto__: Filter.prototype,
-
- matchSlice: function(slice) {
- return slice.title === this.text_;
- }
- };
-
- /**
- * @constructor A filter that matches objects by their full text contents
- * (title, category, args). Note that for performance this filter applies a
- * regex against all the keys of the slice arguments instead of recursing
- * through any embedded sub-objects.
- */
- function FullTextFilter(text) {
- Filter.call(this);
- this.regex_ = makeCaseInsensitiveRegex(text);
- this.titleOrCategoryFilter_ = new TitleOrCategoryFilter(text);
- }
- FullTextFilter.prototype = {
- __proto__: Filter.prototype,
-
- matchObject_: function(obj) {
- for (var key in obj) {
- if (!obj.hasOwnProperty(key))
- continue;
- if (this.regex_.test(key))
- return true;
- if (this.regex_.test(obj[key]))
- return true;
- }
- return false;
- },
-
- matchSlice: function(slice) {
- if (this.titleOrCategoryFilter_.matchSlice(slice))
- return true;
- return this.matchObject_(slice.args);
- }
- };
-
- return {
- Filter: Filter,
- TitleOrCategoryFilter: TitleOrCategoryFilter,
- ExactTitleFilter: ExactTitleFilter,
- FullTextFilter: FullTextFilter
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/core/filter_test.html b/chromium/third_party/catapult/tracing/tracing/core/filter_test.html
deleted file mode 100644
index 6dbdcb10b79..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/core/filter_test.html
+++ /dev/null
@@ -1,107 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/unittest.html">
-<link rel="import" href="/tracing/core/filter.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var TitleOrCategoryFilter = tr.c.TitleOrCategoryFilter;
- var ExactTitleFilter = tr.c.ExactTitleFilter;
- var FullTextFilter = tr.c.FullTextFilter;
-
- test('titleOrCategoryFilter', function() {
- assert.throw(function() {
- new TitleOrCategoryFilter();
- });
- assert.throw(function() {
- new TitleOrCategoryFilter('');
- });
-
- var s0 = tr.c.TestUtils.newSliceEx(
- {cat: 'cat', title: 'a', start: 1, duration: 3});
- assert.isTrue(new TitleOrCategoryFilter('a').matchSlice(s0));
- assert.isTrue(new TitleOrCategoryFilter('cat').matchSlice(s0));
- assert.isTrue(new TitleOrCategoryFilter('at').matchSlice(s0));
- assert.isFalse(new TitleOrCategoryFilter('b').matchSlice(s0));
- assert.isFalse(new TitleOrCategoryFilter('X').matchSlice(s0));
-
- var s1 = tr.c.TestUtils.newSliceEx(
- {cat: 'cat', title: 'abc', start: 1, duration: 3});
- assert.isTrue(new TitleOrCategoryFilter('abc').matchSlice(s1));
- assert.isTrue(new TitleOrCategoryFilter('Abc').matchSlice(s1));
- assert.isTrue(new TitleOrCategoryFilter('cat').matchSlice(s1));
- assert.isTrue(new TitleOrCategoryFilter('Cat').matchSlice(s1));
- assert.isFalse(new TitleOrCategoryFilter('cat1').matchSlice(s1));
- assert.isFalse(new TitleOrCategoryFilter('X').matchSlice(s1));
- });
-
- test('exactTitleFilter', function() {
- assert.throw(function() {
- new ExactTitleFilter();
- });
- assert.throw(function() {
- new ExactTitleFilter('');
- });
-
- var s0 = tr.c.TestUtils.newSliceEx({title: 'a', start: 1, duration: 3});
- assert.isTrue(new ExactTitleFilter('a').matchSlice(s0));
- assert.isFalse(new ExactTitleFilter('b').matchSlice(s0));
- assert.isFalse(new ExactTitleFilter('A').matchSlice(s0));
-
- var s1 = tr.c.TestUtils.newSliceEx({title: 'abc', start: 1, duration: 3});
- assert.isTrue(new ExactTitleFilter('abc').matchSlice(s1));
- assert.isFalse(new ExactTitleFilter('Abc').matchSlice(s1));
- assert.isFalse(new ExactTitleFilter('bc').matchSlice(s1));
- assert.isFalse(new ExactTitleFilter('a').matchSlice(s1));
- });
-
- test('fullTextFilter', function() {
- assert.throw(function() {
- new FullTextFilter();
- });
- assert.throw(function() {
- new FullTextFilter('');
- });
-
- var s0 = tr.c.TestUtils.newSliceEx(
- {cat: 'cat', title: 'a', start: 1, duration: 3});
- s0.args['key'] = 'value';
- s0.args['anotherKey'] = 'anotherValue';
- assert.isTrue(new FullTextFilter('cat').matchSlice(s0));
- assert.isTrue(new FullTextFilter('a').matchSlice(s0));
- assert.isTrue(new FullTextFilter('key').matchSlice(s0));
- assert.isTrue(new FullTextFilter('value').matchSlice(s0));
- assert.isTrue(new FullTextFilter('anotherValue').matchSlice(s0));
- assert.isFalse(new FullTextFilter('not there').matchSlice(s0));
-
- var s1 = tr.c.TestUtils.newSliceEx(
- {cat: 'cat', title: 'a', start: 1, duration: 3});
- s1.args['key'] = 123;
- assert.isTrue(new FullTextFilter('123').matchSlice(s1));
-
- var s2 = tr.c.TestUtils.newSliceEx(
- {cat: 'cat', title: 'a', start: 1, duration: 3});
- s2.args['key'] = ['innerValue1', 'innerValue2'];
- assert.isTrue(new FullTextFilter('innerValue1').matchSlice(s2));
- assert.isTrue(new FullTextFilter('innerValue2').matchSlice(s2));
-
- var s3 = tr.c.TestUtils.newSliceEx(
- {cat: 'cat', title: 'a', start: 1, duration: 3});
- s3.args['key'] = ['one', 'two', 'three'];
- assert.isTrue(new FullTextFilter('two').matchSlice(s3));
-
- var s4 = tr.c.TestUtils.newSliceEx(
- {cat: 'cat', title: 'a', start: 1, duration: 3});
- s4.args['key'] = undefined;
- assert.isFalse(new FullTextFilter('not there').matchSlice(s4));
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/core/scripting_controller.html b/chromium/third_party/catapult/tracing/tracing/core/scripting_controller.html
deleted file mode 100644
index 1b64f92027a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/core/scripting_controller.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/extension_registry.html">
-<link rel="import" href="/tracing/core/scripting_object.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.c', function() {
- function ScriptingController(brushingStateController) {
- this.brushingStateController_ = brushingStateController;
- this.scriptObjectNames_ = [];
- this.scriptObjectValues_ = [];
- this.brushingStateController.addEventListener(
- 'model-changed', this.onModelChanged_.bind(this));
-
- // Register all scripting objects.
- var typeInfos = ScriptingObjectRegistry.getAllRegisteredTypeInfos();
- typeInfos.forEach(function(typeInfo) {
- this.addScriptObject(typeInfo.metadata.name, typeInfo.constructor);
- // Also make the object available to the DevTools inspector.
- global[typeInfo.metadata.name] = typeInfo.constructor;
- }, this);
- }
-
- function ScriptingObjectRegistry() {
- }
- var options = new tr.b.ExtensionRegistryOptions(tr.b.BASIC_REGISTRY_MODE);
- tr.b.decorateExtensionRegistry(ScriptingObjectRegistry, options);
-
- ScriptingController.prototype = {
- get brushingStateController() {
- return this.brushingStateController_;
- },
-
- onModelChanged_: function() {
- this.scriptObjectValues_.forEach(function(v) {
- if (v.onModelChanged)
- v.onModelChanged(this.brushingStateController.model);
- }, this);
- },
-
- addScriptObject: function(name, value) {
- this.scriptObjectNames_.push(name);
- this.scriptObjectValues_.push(value);
- },
-
- executeCommand: function(command) {
- var f = new Function(
- this.scriptObjectNames_, 'return eval(' + command + ')');
- return f.apply(null, this.scriptObjectValues_);
- }
- };
-
- return {
- ScriptingController: ScriptingController,
- ScriptingObjectRegistry: ScriptingObjectRegistry
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/core/scripting_controller_test.html b/chromium/third_party/catapult/tracing/tracing/core/scripting_controller_test.html
deleted file mode 100644
index 18f25a9c350..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/core/scripting_controller_test.html
+++ /dev/null
@@ -1,86 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/event_target.html">
-<link rel="import" href="/tracing/core/scripting_controller.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function FakeBrushingStateController() {
- tr.b.EventTarget.call(this);
-
- this.addAllEventsMatchingFilterToSelectionReturnValue = [];
-
- this.viewport = undefined;
- this.model = undefined;
- this.selection = new tr.model.EventSet();
- this.highlight = new tr.model.EventSet();
- }
- FakeBrushingStateController.prototype = {
- __proto__: tr.b.EventTarget.prototype
- };
-
- test('scriptingControllerBasicArithmetic', function() {
- var brushingStateController = new FakeBrushingStateController();
- var controller = new tr.c.ScriptingController(brushingStateController);
- var result = controller.executeCommand('1 + 1');
- assert.equal(result, 2);
- });
-
- test('scriptingControllerNonLocalContext', function() {
- var brushingStateController = new FakeBrushingStateController();
- var controller = new tr.c.ScriptingController(brushingStateController);
- var x = 1;
- controller.executeCommand('x = 2');
- assert.equal(x, 1);
- });
-
- test('scriptingControllerModifyGlobalContext', function() {
- var brushingStateController = new FakeBrushingStateController();
- var controller = new tr.c.ScriptingController(brushingStateController);
- global._x = 1;
- controller.executeCommand('_x = 2');
- assert.equal(global._x, 2);
- delete global._x;
- });
-
- test('scriptingControllerPersistentContext', function() {
- var brushingStateController = new FakeBrushingStateController();
- var controller = new tr.c.ScriptingController(brushingStateController);
- controller.executeCommand('a = 42');
- var result = controller.executeCommand('a');
- assert.equal(result, 42);
- });
-
- test('scriptingControllerAddScriptObject', function() {
- var brushingStateController = new FakeBrushingStateController();
- var controller = new tr.c.ScriptingController(brushingStateController);
- controller.addScriptObject('z', 123);
- var result = controller.executeCommand('z');
- assert.equal(result, 123);
- });
-
- test('scriptingControllerObjectRegistry', function() {
- var brushingStateController = new FakeBrushingStateController();
-
- tr.c.ScriptingObjectRegistry.register(
- function() { return 123; },
- {
- name: 'testFunctionName'
- }
- );
- var controller = new tr.c.ScriptingController(brushingStateController);
- var result = controller.executeCommand('testFunctionName()');
- assert.equal(result, 123);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/core/scripting_object.html b/chromium/third_party/catapult/tracing/tracing/core/scripting_object.html
deleted file mode 100644
index 377211f45f8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/core/scripting_object.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.c', function() {
- function ScriptingObject() {
- }
-
- ScriptingObject.prototype = {
- onModelChanged: function(model) {
- }
- };
-
- return {
- ScriptingObject: ScriptingObject
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/core/test_utils.html b/chromium/third_party/catapult/tracing/tracing/core/test_utils.html
deleted file mode 100644
index a21fb014904..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/core/test_utils.html
+++ /dev/null
@@ -1,483 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/importer/import.html">
-<link rel="import" href="/tracing/model/counter.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/scoped_id.html">
-<link rel="import" href="/tracing/model/slice.html">
-<link rel="import" href="/tracing/model/slice_group.html">
-<link rel="import" href="/tracing/model/stack_frame.html">
-<link rel="import" href="/tracing/model/thread_time_slice.html">
-<link rel="import" href="/tracing/model/user_model/stub_expectation.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Helper functions for use in tracing tests.
- */
-tr.exportTo('tr.c', function() {
- var ColorScheme = tr.b.ColorScheme;
-
- function _getStartAndCpuDurationFromDict(
- options, required, startFieldName, durationFieldName, endFieldName) {
-
- if (options[startFieldName] === undefined) {
- if (required)
- throw new Error('Too little information.');
- else
- return {start: undefined, duration: undefined};
- }
- if (options[durationFieldName] !== undefined &&
- options[endFieldName] !== undefined) {
- throw new Error('Too much information.');
- }
- if (options[durationFieldName] === undefined &&
- options[endFieldName] === undefined) {
- if (required)
- throw new Error('Too little information.');
- else
- return {start: undefined, duration: undefined};
- }
-
- var duration;
- if (options[durationFieldName] !== undefined) {
- duration = options[durationFieldName];
- } else {
- duration = options[endFieldName] - options[startFieldName];
- }
-
- return {
- start: options[startFieldName],
- duration: duration
- };
- }
-
- function _maybeGetCpuStartAndCpuDurationFromDict(options) {
- return _getStartAndCpuDurationFromDict(
- options, false, 'cpuStart', 'cpuDuration', 'cpuEnd');
- }
-
- function TestUtils() {
- }
-
- TestUtils.getStartAndDurationFromDict = function(options) {
- return _getStartAndCpuDurationFromDict(
- options, true, 'start', 'duration', 'end');
- };
-
- TestUtils.newAsyncSlice = function(start, duration, startThread, endThread) {
- return TestUtils.newAsyncSliceNamed(
- 'a', start, duration, startThread, endThread);
- };
-
- TestUtils.newAsyncSliceNamed = function(
- name, start, duration, startThread, endThread) {
- var asyncSliceConstructor =
- tr.model.AsyncSlice.getConstructor('', name);
-
- var s = new asyncSliceConstructor('', name, 0, start);
- s.duration = duration;
- s.startThread = startThread;
- s.endThread = endThread;
- return s;
- };
-
- function getColorId(colorId) {
- if (colorId) {
- if (colorId === 'random') {
- colorId = Math.floor(
- Math.random() *
- ColorScheme.proprties.numGeneralPurposeColorIds);
- }
- } else {
- colorId = 0;
- }
- return colorId;
- }
-
- TestUtils.newAsyncSliceEx = function(options) {
- var sd = TestUtils.getStartAndDurationFromDict(options);
-
- var cat = options.cat ? options.cat : 'cat';
- var title = options.title ? options.title : 'a';
- var colorId = getColorId(options.colorId);
-
- var isTopLevel;
- if (options.isTopLevel !== undefined)
- isTopLevel = options.isTopLevel;
- else
- isTopLevel = false;
-
- var asyncSliceConstructor =
- tr.model.AsyncSlice.getConstructor(cat, title);
-
- var slice = new asyncSliceConstructor(
- cat,
- title,
- colorId,
- sd.start,
- options.args ? options.args : {},
- sd.duration, isTopLevel);
-
- if (options.id)
- slice.id = options.id;
- else
- slice.id = tr.b.GUID.allocateSimple();
-
- if (options.startStackFrame)
- slice.startStackFrame = options.startStackFrame;
- if (options.endStackFrame)
- slice.endStackFrame = options.endStackFrame;
- if (options.important)
- slice.important = options.important;
- if (options.startThread)
- slice.startThread = options.startThread;
- if (options.endThread)
- slice.endThread = options.endThread;
- return slice;
- };
-
- TestUtils.newCounter = function(parent) {
- return TestUtils.newCounterNamed(parent, 'a');
- };
-
- TestUtils.newCounterNamed = function(parent, name) {
- var s = new tr.model.Counter(parent, name, null, name);
- return s;
- };
-
- TestUtils.newCounterCategory = function(parent, category, name) {
- var s = new tr.model.Counter(parent, name, category, name);
- return s;
- };
-
- TestUtils.newCounterSeries = function() {
- var s = new tr.model.CounterSeries('a', 0);
- return s;
- };
-
- TestUtils.newFlowEventEx = function(options) {
- if (options.start === undefined)
- throw new Error('Too little info');
-
- var title = options.title ? options.title : 'a';
-
- var colorId = options.colorId ? options.colorId : 0;
-
- var sd = TestUtils.getStartAndDurationFromDict(options);
-
- var id;
- if (options.id !== undefined)
- id = options.id;
- else
- id = tr.b.GUID.allocateSimple();
-
- var event = new tr.model.FlowEvent(
- options.cat ? options.cat : 'cat',
- id,
- title,
- colorId,
- sd.start,
- options.args ? options.args : {},
- sd.duration);
-
- if (options.startStackFrame)
- event.startStackFrame = options.startStackFrame;
- if (options.endStackFrame)
- event.endStackFrame = options.endStackFrame;
- if (options.important)
- event.important = options.important;
- if (options.startSlice) {
- event.startSlice = options.startSlice;
- event.startSlice.outFlowEvents.push(event);
- }
- if (options.endSlice) {
- event.endSlice = options.endSlice;
- event.endSlice.inFlowEvents.push(event);
- }
- return event;
- };
-
- TestUtils.newThreadSlice = function(thread, state, start, duration, opt_cpu) {
- var s = new tr.model.ThreadTimeSlice(
- thread, state, 'cat', start, {}, duration);
- if (opt_cpu)
- s.cpuOnWhichThreadWasRunning = opt_cpu;
- return s;
- };
-
- TestUtils.newSampleNamed = function(
- thread, sampleName, category, frameNames, start) {
- var model;
- if (thread.parent)
- model = thread.parent.model;
- else
- model = undefined;
- var sf = TestUtils.newStackTrace(model, frameNames);
- var s = new tr.model.Sample(undefined, thread,
- sampleName, start,
- sf,
- 1);
- return s;
- };
-
- TestUtils.newSliceEx = function(options) {
- var sd = TestUtils.getStartAndDurationFromDict(options);
-
- var title = options.title ? options.title : 'a';
-
- var colorId = options.colorId ? options.colorId : 0;
-
- var cpuSD = _maybeGetCpuStartAndCpuDurationFromDict(options);
-
- var type;
- if (options.type)
- type = options.type;
- else
- type = tr.model.Slice;
-
- var slice = new type(
- options.cat ? options.cat : 'cat',
- title,
- colorId,
- sd.start,
- options.args ? options.args : {},
- sd.duration,
- cpuSD.start, cpuSD.duration);
-
- if (options.isTopLevel)
- slice.isTopLevel = true;
-
- return slice;
- };
-
- TestUtils.newStackTrace = function(model, titles) {
- var frame = undefined;
- titles.forEach(function(title) {
- frame = new tr.model.StackFrame(
- frame, tr.b.GUID.allocateSimple(), title, 7);
- if (model)
- model.addStackFrame(frame);
- });
- return frame;
- };
-
- TestUtils.newSnapshot = function(model, options) {
- return model.getOrCreateProcess(options.pid || 1).objects.addSnapshot(
- new tr.model.ScopedId(options.scope || tr.model.OBJECT_DEFAULT_SCOPE,
- options.id || '0x1'),
- options.category || 'cat',
- options.name || 'A',
- options.ts || 0,
- options.args || {},
- options.baseTypeName);
- };
-
- TestUtils.findSliceNamed = function(slices, name) {
- if (slices instanceof tr.model.SliceGroup)
- slices = slices.slices;
- for (var i = 0; i < slices.length; i++)
- if (slices[i].title == name)
- return slices[i];
- return undefined;
- };
-
- TestUtils.newInteractionRecord = function(parentModel, start, duration) {
- return new tr.model.um.StubExpectation({
- parentModel: parentModel, start: start, duration: duration});
- };
-
- TestUtils.newModel = function(customizeModelCallback) {
- return TestUtils.newModelWithEvents([], {
- shiftWorldToZero: false,
- pruneEmptyContainers: false,
- customizeModelCallback: customizeModelCallback
- });
- };
-
- TestUtils.newModelWithEvents = function(events, opts) {
- if (!(events instanceof Array))
- events = [events];
-
- opts = opts || {};
-
- var io = new tr.importer.ImportOptions();
- io.showImportWarnings = false;
- io.customizeModelCallback = opts.customizeModelCallback;
- io.trackDetailedModelStats = opts.trackDetailedModelStats === undefined ?
- false : opts.trackDetailedModelStats;
- io.shiftWorldToZero = opts.shiftWorldToZero === undefined ?
- true : opts.shiftWorldToZero;
- io.pruneEmptyContainers = opts.pruneEmptyContainers === undefined ?
- true : opts.pruneEmptyContainers;
- io.auditorConstructors = opts.auditorConstructors === undefined ?
- [] : opts.auditorConstructors;
-
- var m = new tr.Model();
- var i = new tr.importer.Import(m, io);
- i.importTraces(events);
- return m;
- };
-
- TestUtils.newModelWithAuditor = function(customizeModelCallback, auditor) {
- return TestUtils.newModelWithEvents([], {
- shiftWorldToZero: false,
- pruneEmptyContainers: false,
- customizeModelCallback: customizeModelCallback,
- auditorConstructors: [auditor]
- });
- };
-
- TestUtils.newFakeThread = function() {
- var process = {model: {}};
- return new tr.model.Thread(process);
- };
-
- /** @constructor */
- TestUtils.SourceGenerator = function() {
- this.sourceList_ = [];
- this.currentLineCommentList_ = [];
- this.currentIndent_ = 0;
- this.currentLineEmpty_ = true;
- };
-
- TestUtils.SourceGenerator.prototype = {
- push: function(/* arguments */) {
- if (this.currentLineEmpty_) {
- this.sourceList_.push(' '.repeat(this.currentIndent_));
- this.currentLineEmpty_ = false;
- }
- this.sourceList_.push.apply(
- this.sourceList_, Array.prototype.slice.call(arguments));
- },
-
- pushComment: function(/* arguments */) {
- this.currentLineCommentList_.push.apply(
- this.currentLineCommentList_, Array.prototype.slice.call(arguments));
- },
-
- build: function() {
- this.finishLine_();
- return this.sourceList_.join('');
- },
-
- breakLine: function() {
- this.finishLine_();
- this.push('\n');
- this.currentLineEmpty_ = true;
- },
-
- finishLine_: function() {
- if (this.currentLineCommentList_.length === 0)
- return;
- this.push(' // ');
- this.push.apply(this, this.currentLineCommentList_);
- this.push('.');
- this.currentLineCommentList_ = [];
- },
-
- indentBlock: function(spaces, breakLine, blockCallback, opt_this) {
- opt_this = opt_this || this;
- this.currentIndent_ += spaces;
- if (breakLine)
- this.breakLine();
- blockCallback.call(opt_this);
- this.currentIndent_ -= spaces;
- },
-
- formatSingleLineList: function(list, itemCallback, opt_this) {
- opt_this = opt_this || this;
- this.push('[');
- tr.b.asArray(list).forEach(function(item, index) {
- if (index > 0)
- this.push(', ');
- itemCallback.call(opt_this, item, index);
- }, this);
- this.push(']');
- },
-
- formatMultiLineList: function(list, itemCallback, opt_this) {
- opt_this = opt_this || this;
- this.push('[');
- this.indentBlock(2, false /* don't break line */, function() {
- tr.b.asArray(list).forEach(function(item, index) {
- if (index > 0)
- this.push(',');
- this.breakLine();
- itemCallback.call(opt_this, item, index);
- }, this);
- }, this);
- if (list.length > 0)
- this.breakLine();
- this.push(']');
- },
-
- formatString: function(string) {
- if (string === undefined)
- this.push('undefined');
- else
- this.push('\'', string, '\'');
- }
- };
-
- TestUtils.addSourceListing = function(test, source) {
- var testSourceEl = document.createElement('pre');
- testSourceEl.style.fontFamily = 'monospace';
- testSourceEl.textContent = source;
-
- var copyButtonEl = document.createElement('button');
- copyButtonEl.textContent = 'Copy into to clipboard';
- copyButtonEl.addEventListener('click', function() {
- var selection = window.getSelection();
-
- // Store the original selection.
- var originalRanges = new Array(selection.rangeCount);
- for (var i = 0; i < originalRanges.length; i++)
- originalRanges[i] = selection.getRangeAt(i);
-
- // Copy the generated test source code into clipboard.
- selection.removeAllRanges();
- var range = document.createRange();
- range.selectNode(testSourceEl);
- selection.addRange(range);
- document.execCommand('copy');
-
- // Restore the original selection.
- selection.removeAllRanges();
- for (var i = 0; i < originalRanges.length; i++)
- selection.addRange(originalRanges[i]);
- });
-
- var outputEl = document.createElement('div');
- outputEl.appendChild(copyButtonEl);
- outputEl.appendChild(testSourceEl);
- test.addHTMLOutput(outputEl);
- };
-
- TestUtils.newInstantEvent = function(options) {
- var title = options.title;
- var start = options.start;
- if ((title === undefined) ||
- (title === '') ||
- (start === undefined))
- throw new Error('too little information');
-
- var category = options.category || 'category';
- var colorId = getColorId(options.colorId);
- var args = options.args || {};
- return new tr.model.InstantEvent(
- category, title, colorId, start, args);
- };
-
- return {
- TestUtils: TestUtils
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/ads/domain_category.html b/chromium/third_party/catapult/tracing/tracing/extras/ads/domain_category.html
deleted file mode 100644
index d41965b99df..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/ads/domain_category.html
+++ /dev/null
@@ -1,86 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.ads', function() {
- function Rule(expr, category) {
- this.expr = expr;
- this.category = category;
- }
-
- var CATEGORY_ADS = 'Ads';
- var CATEGORY_ANALYTICS = 'Analytics';
- var CATEGORY_CONTENT_RECOMMENDATION = 'Content Recommendation';
- var CATEGORY_EXTENSIONS = 'Extensions';
- var CATEGORY_OTHER = 'Other';
- var CATEGORY_SOCIAL = 'Social';
- var CATEGORY_TRACING = 'Tracing';
-
- // Each rule is a tuple of (RegEx, Category). The first match will be used.
- // For now we only assign 1 category to a domain; it may make sense to
- // generalize this later to labeling domains with several categories.
- var CATEGORY_DOMAIN_RULES = [
- new Rule(/\.googleadservices\.com$/, CATEGORY_ADS),
- new Rule(/\.moatads\.com$/, CATEGORY_ANALYTICS),
- // Yahoo-Bing Contextual Ads
- new Rule(/contextual\.media\.net$/, CATEGORY_ADS),
- new Rule(/\.postrelease\.com$/, CATEGORY_CONTENT_RECOMMENDATION),
- new Rule(/\.burt\.io$/, CATEGORY_ANALYTICS),
- // Google DoubleClick, GPT
- new Rule(/\.googletagservices\.com$/, CATEGORY_ADS),
- new Rule(/\.ensighten\.com$/, CATEGORY_ANALYTICS),
- // Amazon CloudFront
- new Rule(/\.cloudfront\.net$/, CATEGORY_ADS),
- new Rule(/\.viafoura\.net$/, CATEGORY_ANALYTICS),
- // Google Content Ads/DoubleClick
- new Rule(/\.googlesyndication\.com$/, CATEGORY_ADS),
- // Google DoubleClick
- new Rule(/\.doubleclick\.net$/, CATEGORY_ADS),
- // Adobe Analytics/TagManager
- new Rule(/\.adobetag\.com$/, CATEGORY_ANALYTICS),
- new Rule(/\.rubiconproject\.com$/, CATEGORY_ADS),
- new Rule(/\.sharethrough\.com$/, CATEGORY_ADS),
- new Rule(/\.facebook\.net$/, CATEGORY_SOCIAL),
- new Rule(/\.facebook\.com$/, CATEGORY_SOCIAL),
- new Rule(/\.outbrain\.com$/, CATEGORY_CONTENT_RECOMMENDATION),
- // Google Content Ads/Others
- new Rule(/\.gstatic\.com$/, CATEGORY_ADS),
- new Rule(/\.newrelic\.com$/, CATEGORY_ANALYTICS),
- new Rule(/\.newsinc\.com$/, CATEGORY_ADS),
- new Rule(/\.spingo\.com$/, CATEGORY_CONTENT_RECOMMENDATION),
- new Rule(/\.visualrevenue\.com$/, CATEGORY_ANALYTICS),
- new Rule(/cdn\.livefyre\.com$/, CATEGORY_SOCIAL),
- new Rule(/\.dynamicyield\.com$/, CATEGORY_ANALYTICS),
- new Rule(/cdn\.krxd\.net$/, CATEGORY_ANALYTICS),
- new Rule(/\.chartbeat\.com$/, CATEGORY_ANALYTICS),
- new Rule(/\.clicktale\.net$/, CATEGORY_ANALYTICS),
- new Rule(/\.gravity\.com$/, CATEGORY_ANALYTICS),
- new Rule(/\.brightcove\.com$/, CATEGORY_ANALYTICS),
- new Rule(/^chrome:\/\//, CATEGORY_TRACING),
- new Rule(/^chrome-extension:\/\//, CATEGORY_EXTENSIONS)
- ];
-
- function DomainCategory() {
- }
-
- DomainCategory.fromDomain = function(domain) {
- for (var i = 0; i < CATEGORY_DOMAIN_RULES.length; i++) {
- if (CATEGORY_DOMAIN_RULES[i].expr.test(domain))
- return CATEGORY_DOMAIN_RULES[i].category;
- }
- return CATEGORY_OTHER;
- };
-
- return {
- DomainCategory: DomainCategory
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/ads/domain_category_test.html b/chromium/third_party/catapult/tracing/tracing/extras/ads/domain_category_test.html
deleted file mode 100644
index 8fa85aaaa4f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/ads/domain_category_test.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/ads/domain_category.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var DomainCategory = tr.e.ads.DomainCategory;
- test('domainCategory', function() {
- assert.equal(
- 'Ads',
- DomainCategory.fromDomain('https://parnter.googleadservices.com'));
- assert.equal(
- 'Analytics',
- DomainCategory.fromDomain('https://x.adobetag.com'));
- assert.equal(
- 'Social',
- DomainCategory.fromDomain('http://x.facebook.net'));
- assert.equal(
- 'Content Recommendation',
- DomainCategory.fromDomain('http://xyz.outbrain.com'));
- assert.equal(
- 'Tracing', DomainCategory.fromDomain('chrome://tracing'));
- assert.equal(
- 'Extensions',
- DomainCategory.fromDomain('chrome-extension://oiuy325oiu'));
- assert.equal(
- 'Other',
- DomainCategory.fromDomain('http://xyz.outbrain.com.au'));
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/android/android_auditor.html b/chromium/third_party/catapult/tracing/tracing/extras/android/android_auditor.html
deleted file mode 100644
index 33a2a6757e3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/android/android_auditor.html
+++ /dev/null
@@ -1,760 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/range_utils.html">
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/core/auditor.html">
-<link rel="import" href="/tracing/model/alert.html">
-<link rel="import" href="/tracing/model/frame.html">
-<link rel="import" href="/tracing/model/helpers/android_model_helper.html">
-<link rel="import" href="/tracing/model/thread_time_slice.html">
-<link rel="import" href="/tracing/model/user_model/response_expectation.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Class for Android-specific Auditing.
- */
-tr.exportTo('tr.e.audits', function() {
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var Auditor = tr.c.Auditor;
- var AndroidModelHelper = tr.model.helpers.AndroidModelHelper;
- var ColorScheme = tr.b.ColorScheme;
- var Statistics = tr.b.Statistics;
- var FRAME_PERF_CLASS = tr.model.FRAME_PERF_CLASS;
- var Alert = tr.model.Alert;
- var EventInfo = tr.model.EventInfo;
- var ScalarNumeric = tr.v.ScalarNumeric;
- var timeDurationInMs = tr.v.Unit.byName.timeDurationInMs;
-
- // TODO: extract from VSYNC, since not all devices have vsync near 60fps
- var EXPECTED_FRAME_TIME_MS = 16.67;
-
- function getStart(e) { return e.start; }
- function getDuration(e) { return e.duration; }
- // used for general UI thread responsiveness alerts, falls back to duration
- function getCpuDuration(e) {
- return (e.cpuDuration !== undefined) ? e.cpuDuration : e.duration;
- }
-
- function frameIsActivityStart(frame) {
- return frame.associatedEvents.any(x => x.title === 'activityStart');
- }
-
- function frameMissedDeadline(frame) {
- return frame.args['deadline'] && frame.args['deadline'] < frame.end;
- }
-
- /** Builder object for EventInfo docLink structures */
- function DocLinkBuilder() {
- this.docLinks = [];
- }
- DocLinkBuilder.prototype = {
- addAppVideo: function(name, videoId) {
- this.docLinks.push({
- label: 'Video Link',
- textContent: ('Android Performance Patterns: ' + name),
- href: 'https://www.youtube.com/watch?list=PLWz5rJ2EKKc9CBxr3BVjPTPoDPLdPIFCE&v=' + videoId // @suppress longLineCheck
- });
- return this;
- },
- addDacRef: function(name, link) {
- this.docLinks.push({
- label: 'Doc Link',
- textContent: (name + ' documentation'),
- href: 'https://developer.android.com/reference/' + link
- });
- return this;
- },
- build: function() {
- return this.docLinks;
- }
- };
-
- /**
- * Auditor for Android-specific traces.
- * @constructor
- */
- function AndroidAuditor(model) {
- Auditor.call(this, model);
-
- var helper = model.getOrCreateHelper(AndroidModelHelper);
- if (helper.apps.length || helper.surfaceFlinger)
- this.helper = helper;
- };
-
- //////////////////////////////////////////////////////////////////////////////
- // Rendering / RenderThread alerts - only available on SDK 22+
- //////////////////////////////////////////////////////////////////////////////
-
- AndroidAuditor.viewAlphaAlertInfo_ = new EventInfo(
- 'Inefficient View alpha usage',
- 'Setting an alpha between 0 and 1 has significant performance costs, if one of the fast alpha paths is not used.', // @suppress longLineCheck
- new DocLinkBuilder()
- .addAppVideo('Hidden Cost of Transparency', 'wIy8g8yNhNk')
- .addDacRef('View#setAlpha()', 'android/view/View.html#setAlpha(float)') // @suppress longLineCheck
- .build());
- AndroidAuditor.saveLayerAlertInfo_ = new EventInfo(
- 'Expensive rendering with Canvas#saveLayer()',
- 'Canvas#saveLayer() incurs extremely high rendering cost. They disrupt the rendering pipeline when drawn, forcing a flush of drawing content. Instead use View hardware layers, or static Bitmaps. This enables the offscreen buffers to be reused in between frames, and avoids the disruptive render target switch.', // @suppress longLineCheck
- new DocLinkBuilder()
- .addAppVideo('Hidden Cost of Transparency', 'wIy8g8yNhNk')
- .addDacRef('Canvas#saveLayerAlpha()', 'android/graphics/Canvas.html#saveLayerAlpha(android.graphics.RectF, int, int)') // @suppress longLineCheck
- .build());
- AndroidAuditor.getSaveLayerAlerts_ = function(frame) {
- var badAlphaRegEx =
- /^(.+) alpha caused (unclipped )?saveLayer (\d+)x(\d+)$/;
- var saveLayerRegEx = /^(unclipped )?saveLayer (\d+)x(\d+)$/;
-
- var ret = [];
- var events = [];
-
- frame.associatedEvents.forEach(function(slice) {
- var match = badAlphaRegEx.exec(slice.title);
- if (match) {
- // due to bug in tracing code on SDK 22, ignore
- // presence of 'unclipped' string in View alpha slices
- var args = { 'view name': match[1],
- width: parseInt(match[3]),
- height: parseInt(match[4]) };
- ret.push(new Alert(AndroidAuditor.viewAlphaAlertInfo_,
- slice.start, [slice], args));
- } else if (saveLayerRegEx.test(slice.title))
- events.push(slice);
- }, this);
-
- if (events.length > ret.length) {
- // more saveLayers than bad alpha can account for - add another alert
-
- var unclippedSeen = Statistics.sum(events, function(slice) {
- return saveLayerRegEx.exec(slice.title)[1] ? 1 : 0;
- });
- var clippedSeen = events.length - unclippedSeen;
- var earliestStart = Statistics.min(events, function(slice) {
- return slice.start;
- });
-
- var args = {
- 'Unclipped saveLayer count (especially bad!)': unclippedSeen,
- 'Clipped saveLayer count': clippedSeen
- };
-
- events.push(frame);
- ret.push(new Alert(AndroidAuditor.saveLayerAlertInfo_,
- earliestStart, events, args));
- }
-
- return ret;
- };
-
-
- AndroidAuditor.pathAlertInfo_ = new EventInfo(
- 'Path texture churn',
- 'Paths are drawn with a mask texture, so when a path is modified / newly drawn, that texture must be generated and uploaded to the GPU. Ensure that you cache paths between frames and do not unnecessarily call Path#reset(). You can cut down on this cost by sharing Path object instances between drawables/views.'); // @suppress longLineCheck
- AndroidAuditor.getPathAlert_ = function(frame) {
- var uploadRegEx = /^Generate Path Texture$/;
-
- var events = frame.associatedEvents.filter(function(event) {
- return event.title == 'Generate Path Texture';
- });
- var start = Statistics.min(events, getStart);
- var duration = Statistics.sum(events, getDuration);
-
- if (duration < 3)
- return undefined;
-
- events.push(frame);
- return new Alert(AndroidAuditor.pathAlertInfo_, start, events,
- { 'Time spent': new ScalarNumeric(timeDurationInMs, duration) });
- };
-
-
- AndroidAuditor.uploadAlertInfo_ = new EventInfo(
- 'Expensive Bitmap uploads',
- 'Bitmaps that have been modified / newly drawn must be uploaded to the GPU. Since this is expensive if the total number of pixels uploaded is large, reduce the amount of Bitmap churn in this animation/context, per frame.'); // @suppress longLineCheck
- AndroidAuditor.getUploadAlert_ = function(frame) {
- var uploadRegEx = /^Upload (\d+)x(\d+) Texture$/;
-
- var events = [];
- var start = Number.POSITIVE_INFINITY;
- var duration = 0;
- var pixelsUploaded = 0;
- frame.associatedEvents.forEach(function(event) {
- var match = uploadRegEx.exec(event.title);
- if (match) {
- events.push(event);
- start = Math.min(start, event.start);
- duration += event.duration;
- pixelsUploaded += parseInt(match[1]) * parseInt(match[2]);
- }
- });
- if (events.length == 0 || duration < 3)
- return undefined;
-
- var mPixels = (pixelsUploaded / 1000000).toFixed(2) + ' million';
- var args = { 'Pixels uploaded': mPixels,
- 'Time spent': new ScalarNumeric(timeDurationInMs, duration) };
- events.push(frame);
- return new Alert(AndroidAuditor.uploadAlertInfo_, start, events, args);
- };
-
- //////////////////////////////////////////////////////////////////////////////
- // UI responsiveness alerts
- //////////////////////////////////////////////////////////////////////////////
-
- AndroidAuditor.ListViewInflateAlertInfo_ = new EventInfo(
- 'Inflation during ListView recycling',
- 'ListView item recycling involved inflating views. Ensure your Adapter#getView() recycles the incoming View, instead of constructing a new one.'); // @suppress longLineCheck
- AndroidAuditor.ListViewBindAlertInfo_ = new EventInfo(
- 'Inefficient ListView recycling/rebinding',
- 'ListView recycling taking too much time per frame. Ensure your Adapter#getView() binds data efficiently.'); // @suppress longLineCheck
- AndroidAuditor.getListViewAlert_ = function(frame) {
- var events = frame.associatedEvents.filter(function(event) {
- return event.title === 'obtainView' || event.title === 'setupListItem';
- });
- var duration = Statistics.sum(events, getCpuDuration);
-
- if (events.length == 0 || duration < 3)
- return undefined;
-
- // simplifying assumption - check for *any* inflation.
- // TODO(ccraik): make 'inflate' slices associated events.
- var hasInflation = false;
- for (var i = 0; i < events.length; i++) {
- if (events[i] instanceof tr.model.Slice &&
- events[i].findDescendentSlice('inflate')) {
- hasInflation = true;
- break;
- }
- }
-
- var start = Statistics.min(events, getStart);
- var args = { 'Time spent': new ScalarNumeric(timeDurationInMs, duration) };
- args['ListView items ' + (hasInflation ? 'inflated' : 'rebound')] =
- events.length / 2;
- var eventInfo = hasInflation ? AndroidAuditor.ListViewInflateAlertInfo_ :
- AndroidAuditor.ListViewBindAlertInfo_;
- events.push(frame);
- return new Alert(eventInfo, start, events, args);
- };
-
-
- AndroidAuditor.measureLayoutAlertInfo_ = new EventInfo(
- 'Expensive measure/layout pass',
- 'Measure/Layout took a significant time, contributing to jank. Avoid triggering layout during animations.', // @suppress longLineCheck
- new DocLinkBuilder()
- .addAppVideo('Invalidations, Layouts, and Performance', 'we6poP0kw6E')
- .build());
- AndroidAuditor.getMeasureLayoutAlert_ = function(frame) {
- var events = frame.associatedEvents.filter(function(event) {
- return event.title === 'measure' || event.title === 'layout';
- });
- var duration = Statistics.sum(events, getCpuDuration);
-
- if (events.length == 0 || duration < 3)
- return undefined;
-
- var start = Statistics.min(events, getStart);
- events.push(frame);
- return new Alert(AndroidAuditor.measureLayoutAlertInfo_, start, events,
- { 'Time spent': new ScalarNumeric(timeDurationInMs, duration) });
- };
-
-
- AndroidAuditor.viewDrawAlertInfo_ = new EventInfo(
- 'Long View#draw()',
- 'Recording the drawing commands of invalidated Views took a long time. Avoid significant work in View or Drawable custom drawing, especially allocations or drawing to Bitmaps.', // @suppress longLineCheck
- new DocLinkBuilder()
- .addAppVideo('Invalidations, Layouts, and Performance', 'we6poP0kw6E')
- .addAppVideo('Avoiding Allocations in onDraw()', 'HAK5acHQ53E')
- .build());
- AndroidAuditor.getViewDrawAlert_ = function(frame) {
- var slice = undefined;
- for (var event of frame.associatedEvents) {
- if (event.title === 'getDisplayList' ||
- event.title === 'Record View#draw()') {
- slice = event;
- break;
- }
- }
-
- if (!slice || getCpuDuration(slice) < 3)
- return undefined;
- return new Alert(AndroidAuditor.viewDrawAlertInfo_, slice.start,
- [slice, frame],
- { 'Time spent': new ScalarNumeric(
- timeDurationInMs, getCpuDuration(slice)) });
- };
-
-
- //////////////////////////////////////////////////////////////////////////////
- // Runtime alerts
- //////////////////////////////////////////////////////////////////////////////
-
- AndroidAuditor.blockingGcAlertInfo_ = new EventInfo(
- 'Blocking Garbage Collection',
- 'Blocking GCs are caused by object churn, and made worse by having large numbers of objects in the heap. Avoid allocating objects during animations/scrolling, and recycle Bitmaps to avoid triggering garbage collection.', // @suppress longLineCheck
- new DocLinkBuilder()
- .addAppVideo('Garbage Collection in Android', 'pzfzz50W5Uo')
- .addAppVideo('Avoiding Allocations in onDraw()', 'HAK5acHQ53E')
- .build());
- AndroidAuditor.getBlockingGcAlert_ = function(frame) {
- var events = frame.associatedEvents.filter(function(event) {
- return event.title == 'DVM Suspend' ||
- event.title == 'GC: Wait For Concurrent';
- });
- var blockedDuration = Statistics.sum(events, getDuration);
- if (blockedDuration < 3)
- return undefined;
-
- var start = Statistics.min(events, getStart);
- events.push(frame);
- return new Alert(AndroidAuditor.blockingGcAlertInfo_, start, events,
- { 'Blocked duration': new ScalarNumeric(
- timeDurationInMs, blockedDuration) });
- };
-
-
- AndroidAuditor.lockContentionAlertInfo_ = new EventInfo(
- 'Lock contention',
- 'UI thread lock contention is caused when another thread holds a lock that the UI thread is trying to use. UI thread progress is blocked until the lock is released. Inspect locking done within the UI thread, and ensure critical sections are short.'); // @suppress longLineCheck
- AndroidAuditor.getLockContentionAlert_ = function(frame) {
- var events = frame.associatedEvents.filter(function(event) {
- return /^Lock Contention on /.test(event.title);
- });
-
- var blockedDuration = Statistics.sum(events, getDuration);
- if (blockedDuration < 1)
- return undefined;
-
- var start = Statistics.min(events, getStart);
- events.push(frame);
- return new Alert(AndroidAuditor.lockContentionAlertInfo_, start, events,
- { 'Blocked duration': new ScalarNumeric(
- timeDurationInMs, blockedDuration) });
- };
-
- AndroidAuditor.schedulingAlertInfo_ = new EventInfo(
- 'Scheduling delay',
- 'Work to produce this frame was descheduled for several milliseconds, contributing to jank. Ensure that code on the UI thread doesn\'t block on work being done on other threads, and that background threads (doing e.g. network or bitmap loading) are running at android.os.Process#THREAD_PRIORITY_BACKGROUND or lower so they are less likely to interrupt the UI thread. These background threads should show up with a priority number of 130 or higher in the scheduling section under the Kernel process.'); // @suppress longLineCheck
- AndroidAuditor.getSchedulingAlert_ = function(frame) {
- var totalDuration = 0;
- var totalStats = {};
- frame.threadTimeRanges.forEach(function(ttr) {
- var stats = ttr.thread.getSchedulingStatsForRange(ttr.start, ttr.end);
- tr.b.iterItems(stats, function(key, value) {
- if (!(key in totalStats))
- totalStats[key] = 0;
- totalStats[key] += value;
- totalDuration += value;
- });
- });
-
- // only alert if frame not running for > 3ms. Note that we expect a frame
- // to never describe intentionally idle time.
- if (!(SCHEDULING_STATE.RUNNING in totalStats) ||
- totalDuration == 0 ||
- totalDuration - totalStats[SCHEDULING_STATE.RUNNING] < 3)
- return;
-
- var args = {};
- tr.b.iterItems(totalStats, function(key, value) {
- if (key === SCHEDULING_STATE.RUNNABLE)
- key = 'Not scheduled, but runnable';
- else if (key === SCHEDULING_STATE.UNINTR_SLEEP)
- key = 'Blocking I/O delay';
- args[key] = new ScalarNumeric(timeDurationInMs, value);
- });
-
- return new Alert(AndroidAuditor.schedulingAlertInfo_, frame.start, [frame],
- args);
- };
-
- AndroidAuditor.prototype = {
- __proto__: Auditor.prototype,
-
- renameAndSort_: function() {
- this.model.kernel.important = false;// auto collapse
- // SurfaceFlinger first, other processes sorted by slice count
- this.model.getAllProcesses().forEach(function(process) {
- if (this.helper.surfaceFlinger &&
- process == this.helper.surfaceFlinger.process) {
- if (!process.name)
- process.name = 'SurfaceFlinger';
- process.sortIndex = Number.NEGATIVE_INFINITY;
- process.important = false; // auto collapse
- return;
- }
-
- var uiThread = process.getThread(process.pid);
- if (!process.name && uiThread && uiThread.name) {
- if (/^ndroid\./.test(uiThread.name))
- uiThread.name = 'a' + uiThread.name;
- process.name = uiThread.name;
-
- uiThread.name = 'UI Thread';
- }
-
- process.sortIndex = 0;
- for (var tid in process.threads) {
- process.sortIndex -= process.threads[tid].sliceGroup.slices.length;
- }
- }, this);
-
- // ensure sequential, relative order for UI/Render/Worker threads
- this.model.getAllThreads().forEach(function(thread) {
- if (thread.tid == thread.parent.pid)
- thread.sortIndex = -3;
- if (thread.name == 'RenderThread')
- thread.sortIndex = -2;
- if (/^hwuiTask/.test(thread.name))
- thread.sortIndex = -1;
- });
- },
-
- pushFramesAndJudgeJank_: function() {
- var badFramesObserved = 0;
- var framesObserved = 0;
- var surfaceFlinger = this.helper.surfaceFlinger;
-
- this.helper.apps.forEach(function(app) {
- // override frame list
- app.process.frames = app.getFrames();
-
- app.process.frames.forEach(function(frame) {
- if (frame.totalDuration > EXPECTED_FRAME_TIME_MS * 2) {
- badFramesObserved += 2;
- frame.perfClass = FRAME_PERF_CLASS.TERRIBLE;
- } else if (frame.totalDuration > EXPECTED_FRAME_TIME_MS ||
- frameMissedDeadline(frame)) {
- badFramesObserved++;
- frame.perfClass = FRAME_PERF_CLASS.BAD;
- } else {
- frame.perfClass = FRAME_PERF_CLASS.GOOD;
- }
- });
- framesObserved += app.process.frames.length;
- });
-
- if (framesObserved) {
- var portionBad = badFramesObserved / framesObserved;
- if (portionBad > 0.3)
- this.model.faviconHue = 'red';
- else if (portionBad > 0.05)
- this.model.faviconHue = 'yellow';
- else
- this.model.faviconHue = 'green';
- }
- },
-
- pushEventInfo_: function() {
- var appAnnotator = new AppAnnotator();
- this.helper.apps.forEach(function(app) {
- if (app.uiThread)
- appAnnotator.applyEventInfos(app.uiThread.sliceGroup);
- if (app.renderThread)
- appAnnotator.applyEventInfos(app.renderThread.sliceGroup);
- });
- },
-
- runAnnotate: function() {
- if (!this.helper)
- return;
-
- this.renameAndSort_();
- this.pushFramesAndJudgeJank_();
- this.pushEventInfo_();
-
- this.helper.iterateImportantSlices(function(slice) {
- slice.important = true;
- });
- },
-
- runAudit: function() {
- if (!this.helper)
- return;
-
- var alerts = this.model.alerts;
- this.helper.apps.forEach(function(app) {
- app.getFrames().forEach(function(frame) {
- alerts.push.apply(alerts, AndroidAuditor.getSaveLayerAlerts_(frame));
-
- // skip most alerts for neutral or good frames
- if (frame.perfClass == FRAME_PERF_CLASS.NEUTRAL ||
- frame.perfClass == FRAME_PERF_CLASS.GOOD)
- return;
-
- var alert = AndroidAuditor.getPathAlert_(frame);
- if (alert)
- alerts.push(alert);
- var alert = AndroidAuditor.getUploadAlert_(frame);
- if (alert)
- alerts.push(alert);
- var alert = AndroidAuditor.getListViewAlert_(frame);
- if (alert)
- alerts.push(alert);
- var alert = AndroidAuditor.getMeasureLayoutAlert_(frame);
- if (alert)
- alerts.push(alert);
- var alert = AndroidAuditor.getViewDrawAlert_(frame);
- if (alert)
- alerts.push(alert);
- var alert = AndroidAuditor.getBlockingGcAlert_(frame);
- if (alert)
- alerts.push(alert);
- var alert = AndroidAuditor.getLockContentionAlert_(frame);
- if (alert)
- alerts.push(alert);
- var alert = AndroidAuditor.getSchedulingAlert_(frame);
- if (alert)
- alerts.push(alert);
- });
- }, this);
-
- this.addRenderingInteractionRecords();
- this.addInputInteractionRecords();
- },
-
- addRenderingInteractionRecords: function() {
- var events = [];
- this.helper.apps.forEach(function(app) {
- events.push.apply(events, app.getAnimationAsyncSlices());
- events.push.apply(events, app.getFrames());
- });
-
- var mergerFunction = function(events) {
- var ir = new tr.model.um.ResponseExpectation(
- this.model, 'Rendering',
- events[0].min,
- events[events.length - 1].max - events[0].min);
- this.model.userModel.expectations.push(ir);
- }.bind(this);
- tr.b.mergeRanges(tr.b.convertEventsToRanges(events), 30, mergerFunction);
- },
-
- addInputInteractionRecords: function() {
- var inputSamples = [];
- this.helper.apps.forEach(function(app) {
- inputSamples.push.apply(inputSamples, app.getInputSamples());
- });
-
- var mergerFunction = function(events) {
- var ir = new tr.model.um.ResponseExpectation(
- this.model, 'Input',
- events[0].min,
- events[events.length - 1].max - events[0].min);
- this.model.userModel.expectations.push(ir);
- }.bind(this);
- var inputRanges = inputSamples.map(function(sample) {
- return tr.b.Range.fromExplicitRange(sample.timestamp, sample.timestamp);
- });
- tr.b.mergeRanges(inputRanges, 30, mergerFunction);
- }
- };
-
- Auditor.register(AndroidAuditor);
-
- function AppAnnotator() {
- this.titleInfoLookup = {};
- this.titleParentLookup = {};
- this.build_();
- }
-
- AppAnnotator.prototype = {
- build_: function() {
- var registerEventInfo = function(dict) {
- this.titleInfoLookup[dict.title] = new EventInfo(
- dict.title, dict.description, dict.docLinks);
- if (dict.parents)
- this.titleParentLookup[dict.title] = dict.parents;
- }.bind(this);
-
- registerEventInfo({
- title: 'inflate',
- description: 'Constructing a View hierarchy from pre-processed XML via LayoutInflater#layout. This includes constructing all of the View objects in the hierarchy, and applying styled attributes.'}); // @suppress longLineCheck
-
- //////////////////////////////////////////////////////////////////////////
- // Adapter view
- //////////////////////////////////////////////////////////////////////////
- registerEventInfo({
- title: 'obtainView',
- description: 'Adapter#getView() called to bind content to a recycled View that is being presented.'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'setupListItem',
- description: 'Attached a newly-bound, recycled View to its parent ListView.'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'setupGridItem',
- description: 'Attached a newly-bound, recycled View to its parent GridView.'}); // @suppress longLineCheck
-
- //////////////////////////////////////////////////////////////////////////
- // Choreographer (tracing enabled on M+)
- //////////////////////////////////////////////////////////////////////////
- var choreographerLinks = new DocLinkBuilder()
- .addDacRef('Choreographer', 'android/view/Choreographer.html') // @suppress longLineCheck
- .build();
- registerEventInfo({
- title: 'Choreographer#doFrame',
- docLinks: choreographerLinks,
- description: 'Choreographer executes frame callbacks for inputs, animations, and rendering traversals. When this work is done, a frame will be presented to the user.'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'input',
- parents: ['Choreographer#doFrame'],
- docLinks: choreographerLinks,
- description: 'Input callbacks are processed. This generally encompasses dispatching input to Views, as well as any work the Views do to process this input/gesture.'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'animation',
- parents: ['Choreographer#doFrame'],
- docLinks: choreographerLinks,
- description: 'Animation callbacks are processed. This is generally minimal work, as animations determine progress for the frame, and push new state to animated objects (such as setting View properties).'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'traversals',
- parents: ['Choreographer#doFrame'],
- docLinks: choreographerLinks,
- description: 'Primary draw traversals. This is the primary traversal of the View hierarchy, including layout and draw passes.'}); // @suppress longLineCheck
-
- //////////////////////////////////////////////////////////////////////////
- // performTraversals + sub methods
- //////////////////////////////////////////////////////////////////////////
- var traversalParents = ['Choreographer#doFrame', 'performTraversals'];
- var layoutLinks = new DocLinkBuilder()
- .addDacRef('View#Layout', 'android/view/View.html#Layout')
- .build();
- registerEventInfo({
- title: 'performTraversals',
- description: 'A drawing traversal of the View hierarchy, comprised of all layout and drawing needed to produce the frame.'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'measure',
- parents: traversalParents,
- docLinks: layoutLinks,
- description: 'First of two phases in view hierarchy layout. Views are asked to size themselves according to constraints supplied by their parent. Some ViewGroups may measure a child more than once to help satisfy their own constraints. Nesting ViewGroups that measure children more than once can lead to excessive and repeated work.'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'layout',
- parents: traversalParents,
- docLinks: layoutLinks,
- description: 'Second of two phases in view hierarchy layout, repositioning content and child Views into their new locations.'}); // @suppress longLineCheck
- var drawString = 'Draw pass over the View hierarchy. Every invalidated View will have its drawing commands recorded. On Android versions prior to Lollipop, this would also include the issuing of draw commands to the GPU. Starting with Lollipop, it only includes the recording of commands, and syncing that information to the RenderThread.'; // @suppress longLineCheck
- registerEventInfo({
- title: 'draw',
- parents: traversalParents,
- description: drawString});
-
- var recordString = 'Every invalidated View\'s drawing commands are recorded. Each will have View#draw() called, and is passed a Canvas that will record and store its drawing commands until it is next invalidated/rerecorded.'; // @suppress longLineCheck
- registerEventInfo({
- title: 'getDisplayList', // Legacy name for compatibility.
- parents: ['draw'],
- description: recordString});
- registerEventInfo({
- title: 'Record View#draw()',
- parents: ['draw'],
- description: recordString});
-
- registerEventInfo({
- title: 'drawDisplayList',
- parents: ['draw'],
- description: 'Execution of recorded draw commands to generate a frame. This represents the actual formation and issuing of drawing commands to the GPU. On Android L and higher devices, this work is done on a dedicated RenderThread, instead of on the UI Thread.'}); // @suppress longLineCheck
-
- //////////////////////////////////////////////////////////////////////////
- // RenderThread
- //////////////////////////////////////////////////////////////////////////
- registerEventInfo({
- title: 'DrawFrame',
- description: 'RenderThread portion of the standard UI/RenderThread split frame. This represents the actual formation and issuing of drawing commands to the GPU.'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'doFrame',
- description: 'RenderThread animation frame. Represents drawing work done by the RenderThread on a frame where the UI thread did not produce new drawing content.'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'syncFrameState',
- description: 'Sync stage between the UI thread and the RenderThread, where the UI thread hands off a frame (including information about modified Views). Time in this method primarily consists of uploading modified Bitmaps to the GPU. After this sync is completed, the UI thread is unblocked, and the RenderThread starts to render the frame.'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'flush drawing commands',
- description: 'Issuing the now complete drawing commands to the GPU.'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'eglSwapBuffers',
- description: 'Complete GPU rendering of the frame.'}); // @suppress longLineCheck
-
- //////////////////////////////////////////////////////////////////////////
- // RecyclerView
- //////////////////////////////////////////////////////////////////////////
- registerEventInfo({
- title: 'RV Scroll',
- description: 'RecyclerView is calculating a scroll. If there are too many of these in Systrace, some Views inside RecyclerView might be causing it. Try to avoid using EditText, focusable views or handle them with care.'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'RV OnLayout',
- description: 'OnLayout has been called by the View system. If this shows up too many times in Systrace, make sure the children of RecyclerView do not update themselves directly. This will cause a full re-layout but when it happens via the Adapter notifyItemChanged, RecyclerView can avoid full layout calculation.'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'RV FullInvalidate',
- description: 'NotifyDataSetChanged or equal has been called. If this is taking a long time, try sending granular notify adapter changes instead of just calling notifyDataSetChanged or setAdapter / swapAdapter. Adding stable ids to your adapter might help.'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'RV PartialInvalidate',
- description: 'RecyclerView is rebinding a View. If this is taking a lot of time, consider optimizing your layout or make sure you are not doing extra operations in onBindViewHolder call.'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'RV OnBindView',
- description: 'RecyclerView is rebinding a View. If this is taking a lot of time, consider optimizing your layout or make sure you are not doing extra operations in onBindViewHolder call.'}); // @suppress longLineCheck
- registerEventInfo({
- title: 'RV CreateView',
- description: 'RecyclerView is creating a new View. If too many of these are present: 1) There might be a problem in Recycling (e.g. custom Animations that set transient state and prevent recycling or ItemAnimator not implementing the contract properly. See Adapter#onFailedToRecycleView(ViewHolder). 2) There may be too many item view types. Try merging them. 3) There might be too many itemChange animations and not enough space in RecyclerPool. Try increasing your pool size and item cache size.'}); // @suppress longLineCheck
-
- //////////////////////////////////////////////////////////////////////////
- // Graphics + Composition
- //////////////////////////////////////////////////////////////////////////
- // TODO(ccraik): SurfaceFlinger work
- registerEventInfo({
- title: 'eglSwapBuffers',
- description: 'The CPU has finished producing drawing commands, and is flushing drawing work to the GPU, and posting that buffer to the consumer (which is often SurfaceFlinger window composition). Once this is completed, the GPU can produce the frame content without any involvement from the CPU.'}); // @suppress longLineCheck
- },
-
- applyEventInfosRecursive_: function(parentNames, slice) {
- var checkExpectedParentNames = function(expectedParentNames) {
- if (!expectedParentNames)
- return true;
- return expectedParentNames.some(function(name) {
- return name in parentNames;
- });
- };
-
-
- // Set EventInfo on the slice if it matches title, and parent.
- if (slice.title in this.titleInfoLookup) {
- if (checkExpectedParentNames(this.titleParentLookup[slice.title]))
- slice.info = this.titleInfoLookup[slice.title];
- }
-
- // Push slice into parentNames, and recurse over subSlices.
- if (slice.subSlices.length > 0) {
- // Increment title in parentName dict.
- if (!(slice.title in parentNames))
- parentNames[slice.title] = 0;
- parentNames[slice.title]++;
-
- // Recurse over subSlices.
- slice.subSlices.forEach(function(subSlice) {
- this.applyEventInfosRecursive_(parentNames, subSlice);
- }, this);
-
- // Decrement title in parentName dict.
- parentNames[slice.title]--;
- if (parentNames[slice.title] == 0)
- delete parentNames[slice.title];
- }
- },
-
- applyEventInfos: function(sliceGroup) {
- sliceGroup.topLevelSlices.forEach(function(slice) {
- this.applyEventInfosRecursive_({}, slice);
- }, this);
- }
- };
-
- return {
- AndroidAuditor: AndroidAuditor
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/android/android_auditor_test.html b/chromium/third_party/catapult/tracing/tracing/extras/android/android_auditor_test.html
deleted file mode 100644
index 9cecad7aa0b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/android/android_auditor_test.html
+++ /dev/null
@@ -1,413 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/android/android_auditor.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-<link rel="import" href="/tracing/model/frame.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
- var FRAME_PERF_CLASS = tr.model.FRAME_PERF_CLASS;
- var newThreadSlice = tr.c.TestUtils.newThreadSlice;
- var ScalarNumeric = tr.v.ScalarNumeric;
- var timeDurationInMs = tr.v.Unit.byName.timeDurationInMs;
-
- test('saveLayerAlert_badAlpha', function() {
- var model = tr.c.TestUtils.newModelWithAuditor(function(model) {
- var renderThread = model.getOrCreateProcess(1).getOrCreateThread(2);
- renderThread.name = 'RenderThread';
- renderThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'doFrame', start: 200, duration: 5}));
- renderThread.sliceGroup.pushSlice(newSliceEx({
- title: 'BadAlphaView alpha caused saveLayer 480x320',
- start: 203,
- duration: 1
- }));
-
- // doesn't create alert, since bad alpha accounts for this savelayer
- renderThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'unclipped saveLayer 480x320', start: 204, duration: 1}));
- }, tr.e.audits.AndroidAuditor);
-
- assert.equal(model.alerts.length, 1);
-
- var alert = model.alerts[0];
- assert.equal(alert.args['view name'], 'BadAlphaView');
- assert.equal(alert.args.width, 480);
- assert.equal(alert.args.height, 320);
- });
-
- test('saveLayerAlert_canvas', function() {
- var model = tr.c.TestUtils.newModelWithAuditor(function(model) {
- var renderThread = model.getOrCreateProcess(1).getOrCreateThread(2);
- renderThread.name = 'RenderThread';
- renderThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'doFrame', start: 200, duration: 5}));
- renderThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'saveLayer 480x320', start: 204, duration: 1}));
- }, tr.e.audits.AndroidAuditor);
-
- assert.equal(model.alerts.length, 1);
-
- var alert = model.alerts[0];
- assert.equal(alert.args['Clipped saveLayer count'], 1);
- assert.equal(alert.associatedEvents.length, 2);
- });
-
- test('generatePathAlert', function() {
- var model = tr.c.TestUtils.newModelWithAuditor(function(model) {
- var renderThread = model.getOrCreateProcess(1).getOrCreateThread(2);
- renderThread.name = 'RenderThread';
- renderThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'doFrame', start: 0, duration: 20}));
- renderThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'Generate Path Texture', start: 0, duration: 3}));
- renderThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'Generate Path Texture', start: 3, duration: 6}));
- }, tr.e.audits.AndroidAuditor);
-
- assert.equal(model.alerts.length, 1);
-
- var alert = model.alerts[0];
- assert.deepEqual(alert.args['Time spent'],
- new ScalarNumeric(timeDurationInMs, 9));
- assert.equal(alert.associatedEvents.length, 3);
- });
-
- test('uploadAlert', function() {
- var model = tr.c.TestUtils.newModelWithAuditor(function(model) {
- var renderThread = model.getOrCreateProcess(1).getOrCreateThread(2);
- renderThread.name = 'RenderThread';
- renderThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'doFrame', start: 0, duration: 20}));
- renderThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'Upload 1000x1000 Texture', start: 0, duration: 15}));
- }, tr.e.audits.AndroidAuditor);
-
- assert.equal(model.alerts.length, 1);
-
- var alert = model.alerts[0];
- assert.equal(alert.args['Pixels uploaded'], '1.00 million');
- assert.deepEqual(alert.args['Time spent'],
- new ScalarNumeric(timeDurationInMs, 15));
- assert.equal(alert.associatedEvents.length, 2);
- });
-
- test('listViewAlert', function() {
- var model = tr.c.TestUtils.newModelWithAuditor(function(model) {
- var uiThread = model.getOrCreateProcess(1).getOrCreateThread(1);
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'obtainView', start: 0, duration: 5}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'setupListItem', start: 5, duration: 5}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'obtainView', start: 10, duration: 5}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'setupListItem', start: 15, duration: 5}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 20, duration: 5}));
-
- // short frame, so no alert should be generated
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'obtainView', start: 50, duration: 5}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'setupListItem', start: 55, duration: 5}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 60, duration: 1}));
-
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'obtainView', start: 100, duration: 10}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'inflate', start: 101, duration: 8}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'setupListItem', start: 110, duration: 10}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 120, duration: 5}));
- }, tr.e.audits.AndroidAuditor);
-
- assert.equal(model.alerts.length, 2);
- var alert = model.alerts[0];
- assert.equal(alert.args['ListView items rebound'], 2);
- assert.deepEqual(alert.args['Time spent'],
- new ScalarNumeric(timeDurationInMs, 20));
- assert.equal(alert.associatedEvents.length, 5);
-
- var alert = model.alerts[1];
- assert.equal(alert.args['ListView items inflated'], 1);
- assert.deepEqual(alert.args['Time spent'],
- new ScalarNumeric(timeDurationInMs, 20));
- assert.equal(alert.associatedEvents.length, 3); // note: inflate not assoc.
- });
-
- test('measureLayoutAlert', function() {
- var model = tr.c.TestUtils.newModelWithAuditor(function(model) {
- var uiThread = model.getOrCreateProcess(1).getOrCreateThread(1);
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 0, duration: 20}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'measure', start: 0, duration: 5}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'layout', start: 10, duration: 5}));
- }, tr.e.audits.AndroidAuditor);
-
- assert.equal(model.alerts.length, 1);
-
- var alert = model.alerts[0];
- assert.deepEqual(alert.args['Time spent'],
- new ScalarNumeric(timeDurationInMs, 10));
- assert.equal(alert.associatedEvents.length, 3);
- });
-
- test('viewDrawAlert', function() {
- var model = tr.c.TestUtils.newModelWithAuditor(function(model) {
- var uiThread = model.getOrCreateProcess(1).getOrCreateThread(1);
- // modern naming
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 0, duration: 20}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'Record View#draw()', start: 0, duration: 10}));
-
- // legacy naming
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 40, duration: 20}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'getDisplayList', start: 40, duration: 10}));
- }, tr.e.audits.AndroidAuditor);
-
- assert.equal(model.alerts.length, 2);
- assert.deepEqual(model.alerts[0].args['Time spent'],
- new ScalarNumeric(timeDurationInMs, 10));
- assert.deepEqual(model.alerts[1].args['Time spent'],
- new ScalarNumeric(timeDurationInMs, 10));
- });
-
- test('blockingGcAlert', function() {
- var model = tr.c.TestUtils.newModelWithAuditor(function(model) {
- var uiThread = model.getOrCreateProcess(1).getOrCreateThread(1);
- var sliceGroup = uiThread.sliceGroup;
- sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 0, duration: 20}));
- sliceGroup.pushSlice(newSliceEx(
- {title: 'DVM Suspend', start: 0, duration: 15}));
-
- sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 50, duration: 20}));
- sliceGroup.pushSlice(newSliceEx(
- {title: 'GC: Wait For Concurrent', start: 50, duration: 15}));
- }, tr.e.audits.AndroidAuditor);
-
- assert.equal(model.alerts.length, 2);
- assert.deepEqual(model.alerts[0].args['Blocked duration'],
- new ScalarNumeric(timeDurationInMs, 15));
- assert.deepEqual(model.alerts[1].args['Blocked duration'],
- new ScalarNumeric(timeDurationInMs, 15));
- });
-
- test('lockContentionAlert', function() {
- var model = tr.c.TestUtils.newModelWithAuditor(function(model) {
- var uiThread = model.getOrCreateProcess(1).getOrCreateThread(1);
- var sliceGroup = uiThread.sliceGroup;
- sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 0, duration: 20}));
- sliceGroup.pushSlice(newSliceEx(
- {title: 'Lock Contention on a lock', start: 0, duration: 15}));
- }, tr.e.audits.AndroidAuditor);
-
- assert.equal(model.alerts.length, 1);
- assert.deepEqual(model.alerts[0].args['Blocked duration'],
- new ScalarNumeric(timeDurationInMs, 15));
- });
-
- test('schedulingAlerts', function() {
- var model = tr.c.TestUtils.newModelWithAuditor(function(model) {
- var uiThread = model.getOrCreateProcess(1).getOrCreateThread(1);
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 0, duration: 20}));
- uiThread.timeSlices = [
- newThreadSlice(uiThread, SCHEDULING_STATE.RUNNING, 0, 6),
- newThreadSlice(uiThread, SCHEDULING_STATE.RUNNABLE, 6, 10),
- newThreadSlice(uiThread, SCHEDULING_STATE.RUNNING, 16, 4)];
- }, tr.e.audits.AndroidAuditor);
- assert.equal(model.alerts.length, 1);
- var alert = model.alerts[0];
- assert.equal(alert.info.title, 'Scheduling delay');
- assert.deepEqual(alert.args['Not scheduled, but runnable'],
- new ScalarNumeric(timeDurationInMs, 10));
-
- model = tr.c.TestUtils.newModelWithAuditor(function(model) {
- var uiThread = model.getOrCreateProcess(1).getOrCreateThread(1);
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 0, duration: 20}));
- uiThread.timeSlices = [
- newThreadSlice(uiThread, SCHEDULING_STATE.RUNNING, 0, 5),
- newThreadSlice(uiThread, SCHEDULING_STATE.UNINTR_SLEEP, 5, 10),
- newThreadSlice(uiThread, SCHEDULING_STATE.RUNNING, 15, 5)];
- }, tr.e.audits.AndroidAuditor);
- assert.equal(model.alerts.length, 1);
- var alert = model.alerts[0];
- assert.equal(alert.info.title, 'Scheduling delay');
- assert.deepEqual(alert.args['Blocking I/O delay'],
- new ScalarNumeric(timeDurationInMs, 10));
- });
-
- test('addFramesToModel', function() {
- var process;
- var model = tr.c.TestUtils.newModelWithAuditor(function(model) {
- process = model.getOrCreateProcess(1);
- var uiThread = process.getOrCreateThread(1);
-
- // High level choreographer frame signal
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'Choreographer#doFrame', start: 0, duration: 8}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'Choreographer#doFrame', start: 16, duration: 20}));
-
- // Old devices only have 'performTraversals'
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 40, duration: 90}));
- }, tr.e.audits.AndroidAuditor);
-
- assert.equal(process.frames.length, 3);
- assert.closeTo(process.frames[0].totalDuration, 8, 1e-5);
- assert.closeTo(process.frames[1].totalDuration, 20, 1e-5);
- assert.closeTo(process.frames[2].totalDuration, 90, 1e-5);
-
- assert.equal(process.frames[0].perfClass,
- FRAME_PERF_CLASS.GOOD);
- assert.equal(process.frames[1].perfClass,
- FRAME_PERF_CLASS.BAD);
- assert.equal(process.frames[2].perfClass,
- FRAME_PERF_CLASS.TERRIBLE);
- });
-
- test('processRenameAndSort', function() {
- var appProcess;
- var sfProcess;
- var model = tr.c.TestUtils.newModelWithAuditor(function(model) {
- appProcess = model.getOrCreateProcess(1);
- var uiThread = appProcess.getOrCreateThread(1);
- uiThread.name = 'ndroid.systemui';
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 0, duration: 8}));
-
- sfProcess = model.getOrCreateProcess(2);
- var sfThread = sfProcess.getOrCreateThread(2);
- sfThread.name = '/system/bin/surfaceflinger';
- sfThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'doComposition', start: 8, duration: 2}));
-
- }, tr.e.audits.AndroidAuditor);
-
- // both processes should be renamed
- assert.equal(appProcess.name, 'android.systemui');
- assert.equal(sfProcess.name, 'SurfaceFlinger');
-
- assert.isTrue(sfProcess.sortIndex < appProcess.sortIndex);
- assert.isTrue(appProcess.important);
- assert.isFalse(sfProcess.important);
- });
-
- test('eventInfo', function() {
- var eventsExpectingInfo = [];
- var eventsNotExpectingInfo = [];
-
- var model = tr.c.TestUtils.newModelWithAuditor(function(model) {
- var appProcess = model.getOrCreateProcess(1);
- var uiThread = appProcess.getOrCreateThread(1);
- uiThread.name = 'ndroid.systemui';
-
- var pushInfoSlice = function(slice) {
- eventsExpectingInfo.push(slice);
- uiThread.sliceGroup.pushSlice(slice);
- };
- var pushNonInfoSlice = function(slice) {
- eventsNotExpectingInfo.push(slice);
- uiThread.sliceGroup.pushSlice(slice);
- };
-
- pushInfoSlice(newSliceEx(
- {title: 'performTraversals', start: 0, duration: 10}));
- pushInfoSlice(newSliceEx({title: 'measure', start: 0, duration: 2}));
- pushInfoSlice(newSliceEx({title: 'layout', start: 2, duration: 1}));
- pushInfoSlice(newSliceEx({title: 'draw', start: 3, duration: 7}));
-
- // Out of place slices should not be tagged.
- pushNonInfoSlice(newSliceEx({title: 'measure', start: 11, duration: 1}));
- pushNonInfoSlice(newSliceEx({title: 'draw', start: 12, duration: 1}));
- }, tr.e.audits.AndroidAuditor);
-
- eventsExpectingInfo.forEach(function(event) {
- assert.notEqual(event.info, undefined);
- });
-
- eventsNotExpectingInfo.forEach(function(event) {
- assert.equal(event.info, undefined);
- });
- });
-
- test('drawingThreadPriorities', function() {
- var uiThread;
- var renderThread;
- var workerThread;
- var otherThread;
- var model = tr.c.TestUtils.newModelWithAuditor(function(model) {
- var appProcess = model.getOrCreateProcess(1);
-
- uiThread = appProcess.getOrCreateThread(1);
- uiThread.name = 'ndroid.systemui';
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 0, duration: 4}));
-
- renderThread = appProcess.getOrCreateThread(2);
- renderThread.name = 'RenderThread';
- renderThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'DrawFrame', start: 3, duration: 4}));
-
- workerThread = appProcess.getOrCreateThread(3);
- workerThread.name = 'hwuiTask1';
- workerThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'work', start: 4, duration: 1}));
-
- otherThread = appProcess.getOrCreateThread(4);
- otherThread.name = 'other';
- otherThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'otherWork', start: 0, duration: 2}));
- }, tr.e.audits.AndroidAuditor);
-
- assert.isTrue(uiThread.sortIndex < renderThread.sortIndex);
- assert.isTrue(renderThread.sortIndex < workerThread.sortIndex);
- assert.isTrue(workerThread.sortIndex < otherThread.sortIndex);
- });
-
- test('favicon', function() {
- var createModelWithJank = function(percentageJank) {
-
- return tr.c.TestUtils.newModelWithAuditor(function(model) {
- var uiThread = model.getOrCreateProcess(1).getOrCreateThread(1);
- for (var i = 0; i < 100; i++) {
- var slice = newSliceEx({
- title: 'performTraversals',
- start: 30 * i,
- duration: i <= percentageJank ? 24 : 8
- });
- uiThread.sliceGroup.pushSlice(slice);
- }
- }, tr.e.audits.AndroidAuditor);
- };
- assert.equal(createModelWithJank(3).faviconHue, 'green');
- assert.equal(createModelWithJank(10).faviconHue, 'yellow');
- assert.equal(createModelWithJank(50).faviconHue, 'red');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/blame_context.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/blame_context.html
deleted file mode 100644
index 18605115cb5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/blame_context.html
+++ /dev/null
@@ -1,74 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/object_instance.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview BlameContext is the Trace Viewer side correspondence of
- * Chrome's class base::trace_event::BlameContext. More specifically,
- *
- * BlameContextSnapshot, which inherits from ObjectSnapshot, is the base class
- * of all snapshots of blame contexts traced in Chrome.
- *
- * BlameContextInstance, which inherits from ObjectInstance, gathers snapshots
- * of the same blame context traced in Chrome.
- *
- * BlameContextSnapshot and BlameContextInstance should never be instantiated
- * directly. Subclasses corresponding to different BlameContexts in Chrome
- * should define their own BlameContextSnapshot and BlameContextInstance
- * specializations for instantiation.
- *
- */
-tr.exportTo('tr.e.chrome', function() {
- var ObjectSnapshot = tr.model.ObjectSnapshot;
- var ObjectInstance = tr.model.ObjectInstance;
-
- function BlameContextSnapshot() {
- ObjectSnapshot.apply(this, arguments);
- }
-
- BlameContextSnapshot.prototype = {
- __proto__: ObjectSnapshot.prototype,
-
- /**
- * Returns the parent in the context tree.
- */
- get parentContext() {
- if (this.args.parent instanceof BlameContextSnapshot)
- return this.args.parent;
- return undefined;
- },
-
- get userFriendlyName() {
- return 'BlameContext';
- }
- };
-
- function BlameContextInstance() {
- ObjectInstance.apply(this, arguments);
- }
-
- BlameContextInstance.prototype = {
- __proto__: ObjectInstance.prototype,
-
- /**
- * Returns the type of the blame context, to be overriden by subclasses.
- */
- get blameContextType() {
- throw new Error('Not implemented');
- }
- };
-
- return {
- BlameContextSnapshot: BlameContextSnapshot,
- BlameContextInstance: BlameContextInstance
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/blame_context_test.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/blame_context_test.html
deleted file mode 100644
index 5b0b9730a84..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/blame_context_test.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/blame_context/blame_context.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var BlameContextSnapshot = tr.e.chrome.BlameContextSnapshot;
- var BlameContextInstance = tr.e.chrome.BlameContextInstance;
-
- function TestBlameContextSnapshot() {
- BlameContextSnapshot.apply(this, arguments);
- }
-
- TestBlameContextSnapshot.prototype = {
- __proto__: BlameContextSnapshot.prototype,
-
- get userFriendlyName() {
- return 'Test';
- }
- };
-
- tr.model.ObjectSnapshot.register(
- TestBlameContextSnapshot,
- {typeName: 'Test'});
-
- function TestBlameContextInstance() {
- BlameContextInstance.apply(this, arguments);
- }
-
- TestBlameContextInstance.prototype = {
- __proto__: BlameContextInstance.prototype,
-
- get blameContextType() {
- return 'Test';
- }
- };
-
- tr.model.ObjectInstance.register(
- TestBlameContextInstance,
- {typeName: 'Test'});
-
- var TestUtils = tr.c.TestUtils;
-
- test('parentContext', function() {
- var parent;
- var child;
- TestUtils.newModel(function(model) {
- parent = TestUtils.newSnapshot(model, {id: '0x1', name: 'Test'});
- child = TestUtils.newSnapshot(model, {id: '0x2', name: 'Test',
- args: {parent: {id_ref: '0x1'}}});
- });
-
- assert.isTrue(child.parentContext === parent);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/frame_blame_context_test.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/frame_blame_context_test.html
deleted file mode 100644
index 8fd3bb2c69e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/frame_blame_context_test.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/blame_context/frame_tree_node.html">
-<link rel="import" href="/tracing/extras/chrome/blame_context/render_frame.html">
-<link rel="import" href="/tracing/extras/chrome/blame_context/top_level.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var TestUtils = tr.c.TestUtils;
-
- test('crossProcessCounterpart', function() {
- var frameTreeNode;
- var renderFrame;
- TestUtils.newModel(function(model) {
- // Add a toplevel to make the context tree consistent with the spec,
- // though its functionality is not tested here.
- TestUtils.newSnapshot(model, {
- pid: 1, name: 'TopLevel', id: '0x1',
- scope: 'PlatformThread', category: 'blink'});
- renderFrame = TestUtils.newSnapshot(
- model, {
- pid: 1, name: 'RenderFrame', id: '0x2', scope: 'RenderFrame',
- category: 'blink', args: {
- parent: {scope: 'PlatformThread', id_ref: '0x1'}}});
- frameTreeNode = TestUtils.newSnapshot(
- model, {
- pid: 2, name: 'FrameTreeNode', id: '0x3', scope: 'FrameTreeNode',
- category: 'navigation', args: {
- renderFrame: {scope: 'RenderFrame', id_ref: '0x2', pid_ref: 1}}});
- });
-
- assert.isTrue(frameTreeNode.renderFrame === renderFrame);
- assert.isTrue(renderFrame.frameTreeNode === frameTreeNode);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/frame_tree_node.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/frame_tree_node.html
deleted file mode 100644
index 7916e3dfe4e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/frame_tree_node.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/blame_context/blame_context.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Trace Viewer side's correspondence of Chrome's
- * content::FrameTreeNode class.
- *
- */
-tr.exportTo('tr.e.chrome', function() {
- var BlameContextSnapshot = tr.e.chrome.BlameContextSnapshot;
- var BlameContextInstance = tr.e.chrome.BlameContextInstance;
-
- function FrameTreeNodeSnapshot() {
- BlameContextSnapshot.apply(this, arguments);
- }
-
- FrameTreeNodeSnapshot.prototype = {
- __proto__: BlameContextSnapshot.prototype,
-
- get renderFrame() {
- if (this.args.renderFrame instanceof tr.e.chrome.RenderFrameSnapshot)
- return this.args.renderFrame;
- return undefined;
- },
-
- get url() {
- return this.args.url;
- },
-
- get userFriendlyName() {
- return 'FrameTreeNode';
- }
- };
-
- tr.model.ObjectSnapshot.register(
- FrameTreeNodeSnapshot,
- {typeName: 'FrameTreeNode'});
-
- function FrameTreeNodeInstance() {
- BlameContextInstance.apply(this, arguments);
- }
-
- FrameTreeNodeInstance.prototype = {
- __proto__: BlameContextInstance.prototype,
-
- get blameContextType() {
- return 'Frame';
- }
- };
-
- tr.model.ObjectInstance.register(
- FrameTreeNodeInstance,
- {typeName: 'FrameTreeNode'});
-
- return {
- FrameTreeNodeSnapshot: FrameTreeNodeSnapshot,
- FrameTreeNodeInstance: FrameTreeNodeInstance
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/render_frame.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/render_frame.html
deleted file mode 100644
index 3bd29e907fe..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/render_frame.html
+++ /dev/null
@@ -1,79 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/blame_context/blame_context.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Trace Viewer side's correspondence of Chrome's
- * content::FrameBlameContext class.
- *
- */
-tr.exportTo('tr.e.chrome', function() {
- var BlameContextSnapshot = tr.e.chrome.BlameContextSnapshot;
- var BlameContextInstance = tr.e.chrome.BlameContextInstance;
-
- function RenderFrameSnapshot() {
- BlameContextSnapshot.apply(this, arguments);
- }
-
- RenderFrameSnapshot.prototype = {
- __proto__: BlameContextSnapshot.prototype,
-
- referencedAt: function(item, object, field) {
- if (item instanceof tr.e.chrome.FrameTreeNodeSnapshot &&
- object === item.args &&
- field === 'renderFrame') {
- this.args.frameTreeNode = item;
- }
- },
-
- get frameTreeNode() {
- if (this.args.frameTreeNode instanceof tr.e.chrome.FrameTreeNodeSnapshot)
- return this.args.frameTreeNode;
- return undefined;
- },
-
- get url() {
- if (this.frameTreeNode)
- return this.frameTreeNode.url;
- return undefined;
- },
-
- get userFriendlyName() {
- return 'RenderFrame';
- }
- };
-
- tr.model.ObjectSnapshot.register(
- RenderFrameSnapshot,
- {typeName: 'RenderFrame'});
-
- function RenderFrameInstance() {
- BlameContextInstance.apply(this, arguments);
- }
-
- RenderFrameInstance.prototype = {
- __proto__: BlameContextInstance.prototype,
-
- get blameContextType() {
- return 'Frame';
- }
- };
-
- tr.model.ObjectInstance.register(
- RenderFrameInstance,
- {typeName: 'RenderFrame'});
-
- return {
- RenderFrameSnapshot: RenderFrameSnapshot,
- RenderFrameInstance: RenderFrameInstance
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/top_level.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/top_level.html
deleted file mode 100644
index cf9e07c05f7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/blame_context/top_level.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/blame_context/blame_context.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Trace Viewer side's correspondence of Chrome's
- * content::TopLevelBlameContext class.
- *
- */
-tr.exportTo('tr.e.chrome', function() {
- var BlameContextSnapshot = tr.e.chrome.BlameContextSnapshot;
- var BlameContextInstance = tr.e.chrome.BlameContextInstance;
-
- function TopLevelSnapshot() {
- BlameContextSnapshot.apply(this, arguments);
- }
-
- TopLevelSnapshot.prototype = {
- __proto__: BlameContextSnapshot.prototype,
-
- get userFriendlyName() {
- return 'TopLevel';
- }
- };
-
- tr.model.ObjectSnapshot.register(
- TopLevelSnapshot,
- {typeName: 'TopLevel'});
-
- function TopLevelInstance() {
- BlameContextInstance.apply(this, arguments);
- }
-
- TopLevelInstance.prototype = {
- __proto__: BlameContextInstance.prototype,
-
- get blameContextType() {
- return 'TopLevel';
- }
- };
-
- tr.model.ObjectInstance.register(
- TopLevelInstance,
- {typeName: 'TopLevel'});
-
- return {
- TopLevelSnapshot: TopLevelSnapshot,
- TopLevelInstance: TopLevelInstance
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/cc.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/cc.html
deleted file mode 100644
index 8ef67b0d21e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/cc.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/cc/display_item_list.html">
-<link rel="import" href="/tracing/extras/chrome/cc/layer_tree_host_impl.html">
-<link rel="import" href="/tracing/extras/chrome/cc/picture.html">
-<link rel="import" href="/tracing/extras/chrome/cc/tile.html">
-<link rel="import" href="/tracing/extras/chrome/cc/input_latency_async_slice.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/constants.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/constants.html
deleted file mode 100644
index c65adca5b59..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/constants.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.e.cc', function() {
- var constants = {};
- constants.ACTIVE_TREE = 0;
- constants.PENDING_TREE = 1;
-
- constants.HIGH_PRIORITY_BIN = 0;
- constants.LOW_PRIORITY_BIN = 1;
-
- constants.SEND_BEGIN_FRAME_EVENT =
- 'ThreadProxy::ScheduledActionSendBeginMainFrame';
- constants.BEGIN_MAIN_FRAME_EVENT = 'ThreadProxy::BeginMainFrame';
-
- return {
- constants: constants
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/debug_colors.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/debug_colors.html
deleted file mode 100644
index 1c5ae61e3f5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/debug_colors.html
+++ /dev/null
@@ -1,77 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-/**
- * @fileoverview Mapping of different tile configuration
- * to border colors and widths.
- */
-tr.exportTo('tr.e.cc', function() {
- var tileTypes = {
- highRes: 'highRes',
- lowRes: 'lowRes',
- extraHighRes: 'extraHighRes',
- extraLowRes: 'extraLowRes',
- missing: 'missing',
- culled: 'culled',
- solidColor: 'solidColor',
- picture: 'picture',
- directPicture: 'directPicture',
- unknown: 'unknown'
- };
-
- var tileBorder = {
- highRes: {
- color: 'rgba(80, 200, 200, 0.7)',
- width: 1
- },
- lowRes: {
- color: 'rgba(212, 83, 192, 0.7)',
- width: 2
- },
- extraHighRes: {
- color: 'rgba(239, 231, 20, 0.7)',
- width: 2
- },
- extraLowRes: {
- color: 'rgba(93, 186, 18, 0.7)',
- width: 2
- },
- missing: {
- color: 'rgba(255, 0, 0, 0.7)',
- width: 1
- },
- culled: {
- color: 'rgba(160, 100, 0, 0.8)',
- width: 1
- },
- solidColor: {
- color: 'rgba(128, 128, 128, 0.7)',
- width: 1
- },
- picture: {
- color: 'rgba(64, 64, 64, 0.7)',
- width: 1
- },
- directPicture: {
- color: 'rgba(127, 255, 0, 1.0)',
- width: 1
- },
- unknown: {
- color: 'rgba(0, 0, 0, 1.0)',
- width: 2
- }
- };
-
- return {
- tileTypes: tileTypes,
- tileBorder: tileBorder
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/display_item_list.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/display_item_list.html
deleted file mode 100644
index f679b56c590..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/display_item_list.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/cc/picture.html">
-<link rel="import" href="/tracing/model/object_instance.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.cc', function() {
- var ObjectSnapshot = tr.model.ObjectSnapshot;
-
- function DisplayItemList(skp64, layerRect) {
- tr.e.cc.Picture.apply(this, arguments);
- }
-
- DisplayItemList.prototype = {
- __proto__: tr.e.cc.Picture.prototype
- };
-
- /**
- * @constructor
- */
- function DisplayItemListSnapshot() {
- tr.e.cc.PictureSnapshot.apply(this, arguments);
- }
-
- DisplayItemListSnapshot.prototype = {
- __proto__: tr.e.cc.PictureSnapshot.prototype,
-
- initialize: function() {
- tr.e.cc.PictureSnapshot.prototype.initialize.call(this);
- this.displayItems_ = this.args.params.items;
- },
-
- get items() {
- return this.displayItems_;
- }
- };
-
- ObjectSnapshot.register(
- DisplayItemListSnapshot,
- {typeNames: ['cc::DisplayItemList']});
-
- return {
- DisplayItemListSnapshot: DisplayItemListSnapshot,
- DisplayItemList: DisplayItemList
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/display_item_list_test.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/display_item_list_test.html
deleted file mode 100644
index 9bbab94fc2d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/display_item_list_test.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/cc/cc.html">
-<link rel="import" href="/tracing/extras/chrome/cc/display_item_list.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script src="/tracing/extras/chrome/cc/layer_tree_host_impl_test_data.js">
-</script>
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('basic', function() {
- var m = tr.c.TestUtils.newModelWithEvents([g_catLTHIEvents]);
- var p = tr.b.dictionaryValues(m.processes)[0];
-
- var instance = p.objects.getAllInstancesNamed('cc::DisplayItemList')[0];
- var snapshot = instance.snapshots[0];
-
- assert.instanceOf(snapshot, tr.e.cc.DisplayItemListSnapshot);
- instance.wasDeleted(150);
- });
-
- test('getItems', function() {
- var m = tr.c.TestUtils.newModelWithEvents([g_catLTHIEvents]);
- var p = tr.b.dictionaryValues(m.processes)[0];
-
- var instance = p.objects.getAllInstancesNamed('cc::DisplayItemList')[0];
- var snapshot = instance.snapshots[0];
-
- var items = snapshot.items;
- assert.equal(items.length, 2);
-
- assert.equal(items[0], 'BeginClipDisplayItem');
- assert.equal(items[1], 'EndClipDisplayItem');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/input_latency_async_slice.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/input_latency_async_slice.html
deleted file mode 100644
index 44871935d2a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/input_latency_async_slice.html
+++ /dev/null
@@ -1,628 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
-<link rel="import" href="/tracing/model/async_slice.html">
-<link rel="import" href="/tracing/model/event_set.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.cc', function() {
- var AsyncSlice = tr.model.AsyncSlice;
- var EventSet = tr.model.EventSet;
-
- var UI_COMP_NAME = 'INPUT_EVENT_LATENCY_UI_COMPONENT';
- var ORIGINAL_COMP_NAME = 'INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT';
- var BEGIN_COMP_NAME = 'INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT';
- var END_COMP_NAME = 'INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT';
-
- var MAIN_RENDERER_THREAD_NAME = 'CrRendererMain';
- var COMPOSITOR_THREAD_NAME = 'Compositor';
-
- var POSTTASK_FLOW_EVENT = 'disabled-by-default-toplevel.flow';
- var IPC_FLOW_EVENT = 'disabled-by-default-ipc.flow';
-
- var INPUT_EVENT_TYPE_NAMES = {
- CHAR: 'Char',
- CLICK: 'GestureClick',
- CONTEXT_MENU: 'ContextMenu',
- FLING_CANCEL: 'GestureFlingCancel',
- FLING_START: 'GestureFlingStart',
- KEY_DOWN: 'KeyDown',
- KEY_DOWN_RAW: 'RawKeyDown',
- KEY_UP: 'KeyUp',
- LATENCY_SCROLL_UPDATE: 'ScrollUpdate',
- MOUSE_DOWN: 'MouseDown',
- MOUSE_ENTER: 'MouseEnter',
- MOUSE_LEAVE: 'MouseLeave',
- MOUSE_MOVE: 'MouseMove',
- MOUSE_UP: 'MouseUp',
- MOUSE_WHEEL: 'MouseWheel',
- PINCH_BEGIN: 'GesturePinchBegin',
- PINCH_END: 'GesturePinchEnd',
- PINCH_UPDATE: 'GesturePinchUpdate',
- SCROLL_BEGIN: 'GestureScrollBegin',
- SCROLL_END: 'GestureScrollEnd',
- SCROLL_UPDATE: 'GestureScrollUpdate',
- SCROLL_UPDATE_RENDERER: 'ScrollUpdate',
- SHOW_PRESS: 'GestureShowPress',
- TAP: 'GestureTap',
- TAP_CANCEL: 'GestureTapCancel',
- TAP_DOWN: 'GestureTapDown',
- TOUCH_CANCEL: 'TouchCancel',
- TOUCH_END: 'TouchEnd',
- TOUCH_MOVE: 'TouchMove',
- TOUCH_START: 'TouchStart',
- UNKNOWN: 'UNKNOWN'
- };
-
- function InputLatencyAsyncSlice() {
- AsyncSlice.apply(this, arguments);
- this.associatedEvents_ = new EventSet();
- this.typeName_ = undefined;
- if (!this.isLegacyEvent)
- this.determineModernTypeName_();
- }
-
- InputLatencyAsyncSlice.prototype = {
- __proto__: AsyncSlice.prototype,
-
- // Legacy InputLatencyAsyncSlices involve a top-level slice titled
- // "InputLatency" containing a subSlice whose title starts with
- // "InputLatency:". Modern InputLatencyAsyncSlices involve a single
- // top-level slice whose title starts with "InputLatency::".
- // Legacy subSlices are not available at construction time, so
- // determineLegacyTypeName_() must be called at get time.
- // So this returns false for the legacy subSlice events titled like
- // "InputLatency:Foo" even though they are technically legacy events.
- get isLegacyEvent() {
- return this.title === 'InputLatency';
- },
-
- get typeName() {
- if (!this.typeName_)
- this.determineLegacyTypeName_();
- return this.typeName_;
- },
-
- checkTypeName_: function() {
- if (!this.typeName_)
- throw 'Unable to determine typeName';
- var found = false;
- for (var type_name in INPUT_EVENT_TYPE_NAMES) {
- if (this.typeName === INPUT_EVENT_TYPE_NAMES[type_name]) {
- found = true;
- break;
- }
- }
- if (!found)
- this.typeName_ = INPUT_EVENT_TYPE_NAMES.UNKNOWN;
- },
-
- determineModernTypeName_: function() {
- // This method works both on modern events titled like
- // "InputLatency::Foo" and also on the legacy subSlices titled like
- // "InputLatency:Foo". Modern events' titles contain 2 colons, whereas the
- // legacy subSlices events contain 1 colon.
-
- var lastColonIndex = this.title.lastIndexOf(':');
- if (lastColonIndex < 0)
- return;
-
- var characterAfterLastColonIndex = lastColonIndex + 1;
- this.typeName_ = this.title.slice(characterAfterLastColonIndex);
-
- // Check that the determined typeName is known.
- this.checkTypeName_();
- },
-
- determineLegacyTypeName_: function() {
- // Iterate over all descendent subSlices.
- this.iterateAllDescendents(function(subSlice) {
-
- // If |subSlice| is not an InputLatencyAsyncSlice, then ignore it.
- var subSliceIsAInputLatencyAsyncSlice = (
- subSlice instanceof InputLatencyAsyncSlice);
- if (!subSliceIsAInputLatencyAsyncSlice)
- return;
-
- // If |subSlice| does not have a typeName, then ignore it.
- if (!subSlice.typeName)
- return;
-
- // If |this| already has a typeName and |subSlice| has a different
- // typeName, then explode!
- if (this.typeName_ && subSlice.typeName_) {
- var subSliceHasDifferentTypeName = (
- this.typeName_ !== subSlice.typeName_);
- if (subSliceHasDifferentTypeName) {
- throw 'InputLatencyAsyncSlice.determineLegacyTypeName_() ' +
- ' found multiple typeNames';
- }
- }
-
- // The typeName of |this| top-level event is whatever the typeName of
- // |subSlice| is. Set |this.typeName_| to the subSlice's typeName.
- this.typeName_ = subSlice.typeName_;
- }, this);
-
- // If typeName could not be determined, then explode!
- if (!this.typeName_)
- throw 'InputLatencyAsyncSlice.determineLegacyTypeName_() failed';
-
- // Check that the determined typeName is known.
- this.checkTypeName_();
- },
-
- getRendererHelper: function(sourceSlices) {
- var traceModel = this.startThread.parent.model;
- var modelHelper = traceModel.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- if (!modelHelper)
- return undefined;
-
- var mainThread = undefined;
- var compositorThread = undefined;
-
- for (var i in sourceSlices) {
- if (sourceSlices[i].parentContainer.name ===
- MAIN_RENDERER_THREAD_NAME)
- mainThread = sourceSlices[i].parentContainer;
- else if (sourceSlices[i].parentContainer.name ===
- COMPOSITOR_THREAD_NAME)
- compositorThread = sourceSlices[i].parentContainer;
-
- if (mainThread && compositorThread)
- break;
- }
-
- var rendererHelpers = modelHelper.rendererHelpers;
-
- var pids = Object.keys(rendererHelpers);
- for (var i = 0; i < pids.length; i++) {
- var pid = pids[i];
- var rendererHelper = rendererHelpers[pid];
- if (rendererHelper.mainThread === mainThread ||
- rendererHelper.compositorThread === compositorThread)
- return rendererHelper;
- }
-
- return undefined;
- },
-
- addEntireSliceHierarchy: function(slice) {
- this.associatedEvents_.push(slice);
- slice.iterateAllSubsequentSlices(function(subsequentSlice) {
- this.associatedEvents_.push(subsequentSlice);
- }, this);
- },
-
- addDirectlyAssociatedEvents: function(flowEvents) {
- var slices = [];
-
- flowEvents.forEach(function(flowEvent) {
- this.associatedEvents_.push(flowEvent);
- var newSource = flowEvent.startSlice.mostTopLevelSlice;
- if (slices.indexOf(newSource) === -1)
- slices.push(newSource);
- }, this);
-
- var lastFlowEvent = flowEvents[flowEvents.length - 1];
- var lastSource = lastFlowEvent.endSlice.mostTopLevelSlice;
- if (slices.indexOf(lastSource) === -1)
- slices.push(lastSource);
-
- return slices;
- },
-
- // Find the Latency::ScrollUpdate slice that corresponds to the
- // InputLatency::GestureScrollUpdate slice.
- // The C++ CL that makes this connection is at:
- // https://codereview.chromium.org/1178963003
- addScrollUpdateEvents: function(rendererHelper) {
- if (!rendererHelper || !rendererHelper.compositorThread)
- return;
-
- var compositorThread = rendererHelper.compositorThread;
- var gestureScrollUpdateStart = this.start;
- var gestureScrollUpdateEnd = this.end;
-
- var allCompositorAsyncSlices =
- compositorThread.asyncSliceGroup.slices;
-
- for (var i in allCompositorAsyncSlices) {
- var slice = allCompositorAsyncSlices[i];
-
- if (slice.title !== 'Latency::ScrollUpdate')
- continue;
-
- var parentId = slice.args.data.
- INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT.
- sequence_number;
-
- if (parentId === undefined) {
- // Old trace, we can only rely on the timestamp to find the slice
- if (slice.start < gestureScrollUpdateStart ||
- slice.start >= gestureScrollUpdateEnd)
- continue;
- } else {
- // New trace, we can definitively find the latency slice by comparing
- // its sequence number with gesture id
- if (parseInt(parentId) !== parseInt(this.id))
- continue;
- }
-
- slice.associatedEvents.forEach(function(event) {
- this.associatedEvents_.push(event);
- }, this);
- break;
- }
- },
-
- // Return true if the slice hierarchy is tracked by LatencyInfo of other
- // input latency events. If the slice hierarchy is tracked by both, this
- // function still returns true.
- belongToOtherInputs: function(slice, flowEvents) {
- var fromOtherInputs = false;
-
- slice.iterateEntireHierarchy(function(subsequentSlice) {
- if (fromOtherInputs)
- return;
-
- subsequentSlice.inFlowEvents.forEach(function(inflow) {
- if (fromOtherInputs)
- return;
-
- if (inflow.category.indexOf('input') > -1) {
- if (flowEvents.indexOf(inflow) === -1)
- fromOtherInputs = true;
- }
- }, this);
- }, this);
-
- return fromOtherInputs;
- },
-
- // Return true if |event| triggers slices of other inputs.
- triggerOtherInputs: function(event, flowEvents) {
- if (event.outFlowEvents === undefined ||
- event.outFlowEvents.length === 0)
- return false;
-
- // Once we fix the bug of flow event binding, there should exist one and
- // only one outgoing flow (PostTask) from ScheduleBeginImplFrameDeadline
- // and PostComposite.
- var flow = event.outFlowEvents[0];
-
- if (flow.category !== POSTTASK_FLOW_EVENT ||
- !flow.endSlice)
- return false;
-
- var endSlice = flow.endSlice;
- if (this.belongToOtherInputs(endSlice.mostTopLevelSlice, flowEvents))
- return true;
-
- return false;
- },
-
- // Follow outgoing flow of subsequentSlices in the current hierarchy.
- // We also handle cases where different inputs interfere with each other.
- followSubsequentSlices: function(event, queue, visited, flowEvents) {
- var stopFollowing = false;
- var inputAck = false;
-
- event.iterateAllSubsequentSlices(function(slice) {
- if (stopFollowing)
- return;
-
- // Do not follow TaskQueueManager::RunTask because it causes
- // many false events to be included.
- if (slice.title === 'TaskQueueManager::RunTask')
- return;
-
- // Do not follow ScheduledActionSendBeginMainFrame because the real
- // main thread BeginMainFrame is already traced by LatencyInfo flow.
- if (slice.title === 'ThreadProxy::ScheduledActionSendBeginMainFrame')
- return;
-
- // Do not follow ScheduleBeginImplFrameDeadline that triggers an
- // OnBeginImplFrameDeadline that is tracked by another LatencyInfo.
- if (slice.title === 'Scheduler::ScheduleBeginImplFrameDeadline') {
- if (this.triggerOtherInputs(slice, flowEvents))
- return;
- }
-
- // Do not follow PostComposite that triggers CompositeImmediately
- // that is tracked by another LatencyInfo.
- if (slice.title === 'CompositorImpl::PostComposite') {
- if (this.triggerOtherInputs(slice, flowEvents))
- return;
- }
-
- // Stop following the rest of the current slice hierarchy if
- // FilterAndSendWebInputEvent occurs after ProcessInputEventAck.
- if (slice.title === 'InputRouterImpl::ProcessInputEventAck')
- inputAck = true;
- if (inputAck &&
- slice.title === 'InputRouterImpl::FilterAndSendWebInputEvent')
- stopFollowing = true;
-
- this.followCurrentSlice(slice, queue, visited);
- }, this);
- },
-
- // Follow outgoing flow events of the current slice.
- followCurrentSlice: function(event, queue, visited) {
- event.outFlowEvents.forEach(function(outflow) {
- if ((outflow.category === POSTTASK_FLOW_EVENT ||
- outflow.category === IPC_FLOW_EVENT) &&
- outflow.endSlice) {
- this.associatedEvents_.push(outflow);
-
- var nextEvent = outflow.endSlice.mostTopLevelSlice;
- if (!visited.contains(nextEvent)) {
- visited.push(nextEvent);
- queue.push(nextEvent);
- }
- }
- }, this);
- },
-
- backtraceFromDraw: function(beginImplFrame, visited) {
- var pendingEventQueue = [];
- pendingEventQueue.push(beginImplFrame.mostTopLevelSlice);
-
- while (pendingEventQueue.length !== 0) {
- var event = pendingEventQueue.pop();
-
- this.addEntireSliceHierarchy(event);
-
- // TODO(yuhao): For now, we backtrace all the way to the source input.
- // But is this really needed? I will have an entry in the design
- // doc to discuss this.
- event.inFlowEvents.forEach(function(inflow) {
- if (inflow.category === POSTTASK_FLOW_EVENT && inflow.startSlice) {
- var nextEvent = inflow.startSlice.mostTopLevelSlice;
- if (!visited.contains(nextEvent)) {
- visited.push(nextEvent);
- pendingEventQueue.push(nextEvent);
- }
- }
- }, this);
- }
- },
-
- sortRasterizerSlices: function(rasterWorkerThreads,
- sortedRasterizerSlices) {
- rasterWorkerThreads.forEach(function(rasterizer) {
- Array.prototype.push.apply(sortedRasterizerSlices,
- rasterizer.sliceGroup.slices);
- }, this);
-
- sortedRasterizerSlices.sort(function(a, b) {
- if (a.start !== b.start)
- return a.start - b.start;
- return a.guid - b.guid;
- });
- },
-
- // Find rasterization slices that have the source_prepare_tiles_id
- // same as the prepare_tiles_id of TileManager::PrepareTiles
- // The C++ CL that makes this connection is at:
- // https://codereview.chromium.org/1208683002/
- addRasterizationEvents: function(prepareTiles, rendererHelper,
- visited, flowEvents, sortedRasterizerSlices) {
- if (!prepareTiles.args.prepare_tiles_id)
- return;
-
- if (!rendererHelper || !rendererHelper.rasterWorkerThreads)
- return;
-
- var rasterWorkerThreads = rendererHelper.rasterWorkerThreads;
- var prepare_tile_id = prepareTiles.args.prepare_tiles_id;
- var pendingEventQueue = [];
-
- // Collect all the rasterizer tasks. Return the cached copy if possible.
- if (sortedRasterizerSlices.length === 0)
- this.sortRasterizerSlices(rasterWorkerThreads, sortedRasterizerSlices);
-
- // TODO(yuhao): Once TaskSetFinishedTaskImpl also get the prepare_tile_id
- // we can simply track by checking id rather than counting.
- var numFinishedTasks = 0;
- var RASTER_TASK_TITLE = 'RasterizerTaskImpl::RunOnWorkerThread';
- var IMAGEDECODE_TASK_TITLE = 'ImageDecodeTaskImpl::RunOnWorkerThread';
- var FINISHED_TASK_TITLE = 'TaskSetFinishedTaskImpl::RunOnWorkerThread';
-
- for (var i = 0; i < sortedRasterizerSlices.length; i++) {
- var task = sortedRasterizerSlices[i];
-
- if (task.title === RASTER_TASK_TITLE ||
- task.title === IMAGEDECODE_TASK_TITLE) {
- if (task.args.source_prepare_tiles_id === prepare_tile_id)
- this.addEntireSliceHierarchy(task.mostTopLevelSlice);
- } else if (task.title === FINISHED_TASK_TITLE) {
- if (task.start > prepareTiles.start) {
- pendingEventQueue.push(task.mostTopLevelSlice);
- if (++numFinishedTasks === 3)
- break;
- }
- }
- }
-
- // Trace PostTask from rasterizer tasks.
- while (pendingEventQueue.length != 0) {
- var event = pendingEventQueue.pop();
-
- this.addEntireSliceHierarchy(event);
- this.followSubsequentSlices(event, pendingEventQueue, visited,
- flowEvents);
- }
- },
-
- addOtherCausallyRelatedEvents: function(rendererHelper, sourceSlices,
- flowEvents, sortedRasterizerSlices) {
- var pendingEventQueue = [];
- // Keep track of visited nodes when traversing a DAG
- var visitedEvents = new EventSet();
- var beginImplFrame = undefined;
- var prepareTiles = undefined;
- var sortedRasterizerSlices = [];
-
- sourceSlices.forEach(function(sourceSlice) {
- if (!visitedEvents.contains(sourceSlice)) {
- visitedEvents.push(sourceSlice);
- pendingEventQueue.push(sourceSlice);
- }
- }, this);
-
- while (pendingEventQueue.length != 0) {
- var event = pendingEventQueue.pop();
-
- // Push the current event chunk into associatedEvents.
- this.addEntireSliceHierarchy(event);
-
- this.followCurrentSlice(event, pendingEventQueue, visitedEvents);
-
- this.followSubsequentSlices(event, pendingEventQueue, visitedEvents,
- flowEvents);
-
- // The rasterization work (CompositorTileWorker thread) and the
- // Compositor tile manager are connect by the prepare_tiles_id
- // instead of flow events.
- var COMPOSITOR_PREPARE_TILES = 'TileManager::PrepareTiles';
- prepareTiles = event.findDescendentSlice(COMPOSITOR_PREPARE_TILES);
- if (prepareTiles)
- this.addRasterizationEvents(prepareTiles, rendererHelper,
- visitedEvents, flowEvents, sortedRasterizerSlices);
-
- // OnBeginImplFrameDeadline could be triggered by other inputs.
- // For now, we backtrace from it.
- // TODO(yuhao): There are more such slices that we need to backtrace
- var COMPOSITOR_ON_BIFD = 'Scheduler::OnBeginImplFrameDeadline';
- beginImplFrame = event.findDescendentSlice(COMPOSITOR_ON_BIFD);
- if (beginImplFrame)
- this.backtraceFromDraw(beginImplFrame, visitedEvents);
- }
-
- // A separate pass on GestureScrollUpdate.
- // Scroll update doesn't go through the main thread, but the compositor
- // may go back to the main thread if there is an onscroll event handler.
- // This is captured by a different flow event, which does not have the
- // same ID as the Input Latency Event, but it is technically causally
- // related to the GestureScrollUpdate input. Add them manually for now.
- var INPUT_GSU = 'InputLatency::GestureScrollUpdate';
- if (this.title === INPUT_GSU)
- this.addScrollUpdateEvents(rendererHelper);
- },
-
- get associatedEvents() {
- if (this.associatedEvents_.length !== 0)
- return this.associatedEvents_;
-
- var modelIndices = this.startThread.parent.model.modelIndices;
- var flowEvents = modelIndices.getFlowEventsWithId(this.id);
-
- if (flowEvents.length === 0)
- return this.associatedEvents_;
-
- // Step 1: Get events that are directly connected by the LatencyInfo
- // flow events. This gives us a small set of events that are guaranteed
- // to be associated with the input, but are almost certain incomplete.
- // We call this set "source" event set.
- // This step returns the "source" event set (sourceSlices), which is then
- // used in the second step.
- var sourceSlices = this.addDirectlyAssociatedEvents(flowEvents);
-
- // Step 2: Start from the previously constructed "source" event set, we
- // follow the toplevel (i.e., PostTask) and IPC flow events. Any slices
- // that are reachable from the "source" event set via PostTasks or IPCs
- // are conservatively considered associated with the input event.
- // We then deal with specific cases where flow events either over include
- // or miss capturing slices.
- var rendererHelper = this.getRendererHelper(sourceSlices);
- this.addOtherCausallyRelatedEvents(rendererHelper, sourceSlices,
- flowEvents);
-
- return this.associatedEvents_;
- },
-
- get inputLatency() {
- if (!('data' in this.args))
- return undefined;
-
- var data = this.args.data;
- if (!(END_COMP_NAME in data))
- return undefined;
-
- var latency = 0;
- var endTime = data[END_COMP_NAME].time;
- if (ORIGINAL_COMP_NAME in data) {
- latency = endTime - data[ORIGINAL_COMP_NAME].time;
- } else if (UI_COMP_NAME in data) {
- latency = endTime - data[UI_COMP_NAME].time;
- } else if (BEGIN_COMP_NAME in data) {
- latency = endTime - data[BEGIN_COMP_NAME].time;
- } else {
- throw new Error('No valid begin latency component');
- }
- return latency;
- }
- };
-
- var eventTypeNames = [
- 'Char',
- 'ContextMenu',
- 'GestureClick',
- 'GestureFlingCancel',
- 'GestureFlingStart',
- 'GestureScrollBegin',
- 'GestureScrollEnd',
- 'GestureScrollUpdate',
- 'GestureShowPress',
- 'GestureTap',
- 'GestureTapCancel',
- 'GestureTapDown',
- 'GesturePinchBegin',
- 'GesturePinchEnd',
- 'GesturePinchUpdate',
- 'KeyDown',
- 'KeyUp',
- 'MouseDown',
- 'MouseEnter',
- 'MouseLeave',
- 'MouseMove',
- 'MouseUp',
- 'MouseWheel',
- 'RawKeyDown',
- 'ScrollUpdate',
- 'TouchCancel',
- 'TouchEnd',
- 'TouchMove',
- 'TouchStart'
- ];
- var allTypeNames = ['InputLatency'];
- eventTypeNames.forEach(function(eventTypeName) {
- // Old style.
- allTypeNames.push('InputLatency:' + eventTypeName);
-
- // New style.
- allTypeNames.push('InputLatency::' + eventTypeName);
- });
-
- AsyncSlice.register(
- InputLatencyAsyncSlice,
- {
- typeNames: allTypeNames,
- categoryParts: ['latencyInfo']
- });
-
- return {
- InputLatencyAsyncSlice: InputLatencyAsyncSlice,
- INPUT_EVENT_TYPE_NAMES: INPUT_EVENT_TYPE_NAMES
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/input_latency_async_slice_test.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/input_latency_async_slice_test.html
deleted file mode 100644
index 7de9a060e0f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/input_latency_async_slice_test.html
+++ /dev/null
@@ -1,689 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/cc/input_latency_async_slice.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/model_indices.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newAsyncSliceEx = tr.c.TestUtils.newAsyncSliceEx;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
- var newFlowEventEx = tr.c.TestUtils.newFlowEventEx;
- var newModel = tr.c.TestUtils.newModel;
- var EventSet = tr.model.EventSet;
-
- test('matchByType_oldStyle', function() {
- var sOuter = newAsyncSliceEx({
- title: 'InputLatency',
- cat: 'benchmark',
- start: 0,
- end: 10,
- id: '0x100',
- isTopLevel: true,
- args: {
- data: {
- INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT: {'time' : 0},
- INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT: {time: 10}
- }
- }
- });
- assert.throws(function() {
- sOuter.typeName;
- });
-
- var sInner = newAsyncSliceEx({
- title: 'InputLatency:GestureScrollUpdate',
- cat: 'benchmark',
- start: 2,
- end: 10,
- id: '0x100',
- args: {
- 'step': 'GestureScrollUpdate'
- }
- });
- sOuter.subSlices.push(sInner);
- assert.isTrue(sOuter instanceof tr.e.cc.InputLatencyAsyncSlice);
- assert.isTrue(sInner instanceof tr.e.cc.InputLatencyAsyncSlice);
- assert.equal(sOuter.inputLatency, 10);
- assert.equal(tr.e.cc.INPUT_EVENT_TYPE_NAMES.SCROLL_UPDATE, sInner.typeName);
- assert.equal(tr.e.cc.INPUT_EVENT_TYPE_NAMES.SCROLL_UPDATE, sOuter.typeName);
- });
-
- test('matchByType_newStyle', function() {
- var sInfo = newAsyncSliceEx({
- title: 'InputLatency::GestureScrollUpdate',
- cat: 'benchmark',
- start: 2,
- end: 10,
- id: '0x100',
- isTopLevel: true,
- args: {
- data: {
- INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT: {'time' : 0},
- INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT: {time: 10}
- }
- }
- });
-
- assert.isTrue(sInfo instanceof tr.e.cc.InputLatencyAsyncSlice);
- assert.equal(sInfo.inputLatency, 10);
- assert.equal(tr.e.cc.INPUT_EVENT_TYPE_NAMES.SCROLL_UPDATE, sInfo.typeName);
- });
-
- test('unknownType', function() {
- var sInfo = newAsyncSliceEx({
- title: 'InputLatency::BadTypeName',
- cat: 'benchmark,latencyInfo',
- start: 2,
- end: 10,
- id: '0x100',
- isTopLevel: true,
- args: {
- data: {
- INPUT_EVENT_LATENCY_BEGIN_RWH_COMPONENT: {'time' : 0},
- INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT: {'time' : 0},
- INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT: {time: 10}
- }
- }
- });
- assert.equal(tr.e.cc.INPUT_EVENT_TYPE_NAMES.UNKNOWN, sInfo.typeName);
- });
-
- test('getAssociatedEventsBypassRendererMain', function() {
- var m = newModel(function(m) {
-
- var pb = m.getOrCreateProcess(1);
- var pr = m.getOrCreateProcess(2);
- var mainBrowserThread = pb.getOrCreateThread(10);
- var mainRendererThread = pr.getOrCreateThread(20);
- var compositorThread = pr.getOrCreateThread(21);
-
- mainBrowserThread.name = 'CrBrowserMain';
- mainRendererThread.name = 'CrRendererMain';
- compositorThread.name = 'Compositor';
-
- // Expectation: None of s2 and s3 should be included
- // CrBrowserMain: [s0] [s1]
- // | /|\
- // CrRendererMain: | [s2] [s3] |
- // \|/ |
- // Compositor: [s4]-------------|
-
- m.s0 = mainBrowserThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's0', start: 0.0, duration: 1.0 }));
- m.s1 = mainBrowserThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's1', start: 6.0, duration: 1.0 }));
- m.s2 = mainRendererThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's2', start: 2.0, duration: 1.0 }));
- m.s3 = mainRendererThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's3', start: 4.0, duration: 1.0 }));
- m.s4 = compositorThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's4', start: 0.5, duration: 1.0 }));
-
- m.f1 = newFlowEventEx({
- title: 'test1',
- start: 0,
- end: 10,
- startSlice: m.s0,
- endSlice: m.s4,
- id: '0x100'
- });
-
- m.f2 = newFlowEventEx({
- title: 'test2',
- start: 20,
- end: 30,
- startSlice: m.s4,
- endSlice: m.s1,
- id: '0x100'
- });
-
- m.flowEvents.push(m.f1);
- m.flowEvents.push(m.f2);
-
- m.as0 = newAsyncSliceEx({
- title: 'test1',
- cat: 'benchmark,latencyInfo',
- start: 2,
- end: 10,
- id: '0x101',
- isTopLevel: true,
- startThread: mainBrowserThread
- });
-
- m.as1 = newAsyncSliceEx({
- title: 'test2',
- cat: 'benchmark,latencyInfo',
- start: 2,
- end: 10,
- id: '0x100',
- isTopLevel: true,
- startThread: compositorThread
- });
-
- });
-
- assert.isTrue(m.as0.associatedEvents.length === 0);
- assert.isTrue(m.as1.associatedEvents.equals(
- new EventSet([m.f1, m.s0, m.f2, m.s4, m.s1])));
- });
-
- test('getAssociatedEventsBypassRendererMainWithOnScroll', function() {
- var m = newModel(function(m) {
-
- var pb = m.getOrCreateProcess(1);
- var pr = m.getOrCreateProcess(2);
- var mainBrowserThread = pb.getOrCreateThread(10);
- var mainRendererThread = pr.getOrCreateThread(20);
- var compositorThread = pr.getOrCreateThread(21);
-
- mainBrowserThread.name = 'CrBrowserMain';
- mainRendererThread.name = 'CrRendererMain';
- compositorThread.name = 'Compositor';
-
- // Expectation: s2 should be included but not s3
- // GestureScrollUpdate: [ as1 ]
- // CrBrowserMain: [s0] [s1]
- // | /|\
- // CrRendererMain: | [s2] [s3] |
- // \|/ /|\ |
- // Compositor: [s4]___|__________|
- // ScrollUpdate: [ as2 ]
-
- m.s0 = mainBrowserThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's0', start: 0.0, duration: 1.0 }));
- m.s1 = mainBrowserThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's1', start: 6.0, duration: 1.0 }));
- m.s2 = mainRendererThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's2', start: 2.0, duration: 1.0 }));
- m.s3 = mainRendererThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's3', start: 4.0, duration: 1.0 }));
- m.s4 = compositorThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's4', start: 0.5, duration: 1.0 }));
-
- m.f1 = newFlowEventEx({
- title: 'f1',
- start: 0,
- end: 10,
- startSlice: m.s0,
- endSlice: m.s4,
- id: '0x100'
- });
-
- m.f2 = newFlowEventEx({
- title: 'f2',
- start: 20,
- end: 30,
- startSlice: m.s4,
- endSlice: m.s1,
- id: '0x100'
- });
-
- m.f3 = newFlowEventEx({
- title: 'f3',
- start: 20,
- end: 30,
- startSlice: m.s4,
- endSlice: m.s2,
- id: '0x800'
- });
-
- m.flowEvents.push(m.f1);
- m.flowEvents.push(m.f2);
- m.flowEvents.push(m.f3);
-
- m.as0 = mainBrowserThread.asyncSliceGroup.push(newAsyncSliceEx({
- title: 'InputLatency::GestureScrollUpdate',
- cat: 'benchmark,latencyInfo',
- args: {
- data: {
- INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT: 100
- }
- },
- start: 2,
- end: 10,
- id: '0x101',
- isTopLevel: true,
- startThread: mainBrowserThread
- }));
- assert.equal(tr.e.cc.INPUT_EVENT_TYPE_NAMES.SCROLL_UPDATE,
- m.as0.typeName);
-
- m.as1 = mainBrowserThread.asyncSliceGroup.push(newAsyncSliceEx({
- title: 'InputLatency::GestureScrollUpdate',
- cat: 'benchmark,latencyInfo',
- args: {
- data: {}
- },
- start: 0,
- end: 10,
- id: '0x100',
- isTopLevel: true,
- startThread: mainBrowserThread
- }));
- assert.equal(tr.e.cc.INPUT_EVENT_TYPE_NAMES.SCROLL_UPDATE,
- m.as1.typeName);
-
- m.as2 = compositorThread.asyncSliceGroup.push(newAsyncSliceEx({
- title: 'Latency::ScrollUpdate',
- cat: 'benchmark,latencyInfo',
- args: {
- data: {
- INPUT_EVENT_LATENCY_FORWARD_SCROLL_UPDATE_TO_MAIN_COMPONENT: 100
- }
- },
- start: 1.5,
- end: 8,
- id: '0x800',
- isTopLevel: true,
- startThread: compositorThread
- }));
- assert.equal(tr.e.cc.INPUT_EVENT_TYPE_NAMES.LATENCY_SCROLL_UPDATE,
- m.as2.typeName);
- });
-
- assert.isTrue(m.as0.associatedEvents.length === 0);
- assert.isTrue(m.as1.associatedEvents.equals(
- new EventSet([m.f1, m.s0, m.f2, m.s4, m.s1, m.f3, m.s2])));
- });
-
- test('getAssociatedEventsWithoutCommit', function() {
- var m = newModel(function(m) {
-
- var pb = m.getOrCreateProcess(1);
- var pr = m.getOrCreateProcess(2);
- var mainBrowserThread = pb.getOrCreateThread(10);
- var mainRendererThread = pr.getOrCreateThread(20);
- var compositorThread = pr.getOrCreateThread(21);
-
- mainBrowserThread.name = 'CrBrowserMain';
- mainRendererThread.name = 'CrRendererMain';
- compositorThread.name = 'Compositor';
-
- // Expectation: none of s3 and s5 should be included
- // CrBrowserMain: [s0] [s1]
- // | /|\
- // | __________|
- // | |
- // CrRendererMain: | [s2] [s3] [s5]
- // \|/ /|\
- // Compositor: [s4]___|
-
- m.s0 = mainBrowserThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's0', start: 0.0, duration: 1.0 }));
- m.s1 = mainBrowserThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's1', start: 6.0, duration: 1.0 }));
- m.s2 = mainRendererThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's2', start: 2.0, duration: 1.0 }));
- m.s3 = mainRendererThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's3', start: 4.0, duration: 1.0 }));
- m.s4 = compositorThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's4', start: 0.5, duration: 1.0 }));
- m.s5 = mainRendererThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's5', start: 100.0, duration: 1.0 }));
-
- m.f1 = newFlowEventEx({
- title: 'f1',
- start: 0,
- end: 10,
- startSlice: m.s0,
- endSlice: m.s4,
- id: '0x100'
- });
-
- m.f2 = newFlowEventEx({
- title: 'f2',
- start: 20,
- end: 30,
- startSlice: m.s4,
- endSlice: m.s2,
- id: '0x100'
- });
-
- m.f3 = newFlowEventEx({
- title: 'f3',
- start: 20,
- end: 30,
- startSlice: m.s2,
- endSlice: m.s1,
- id: '0x100'
- });
-
- m.flowEvents.push(m.f1);
- m.flowEvents.push(m.f2);
- m.flowEvents.push(m.f3);
-
- m.as0 = newAsyncSliceEx({
- title: 'test1',
- cat: 'benchmark,latencyInfo',
- start: 2,
- end: 10,
- id: '0x101',
- isTopLevel: true,
- startThread: mainBrowserThread
- });
-
- m.as1 = newAsyncSliceEx({
- title: 'test2',
- cat: 'benchmark,latencyInfo',
- start: 2,
- end: 10,
- id: '0x100',
- isTopLevel: true,
- startThread: mainBrowserThread
- });
-
- });
-
- assert.isTrue(m.as0.associatedEvents.length === 0);
- assert.isTrue(m.as1.associatedEvents.equals(
- new EventSet([m.f1, m.s0, m.f2, m.s4, m.f3, m.s2, m.s1])));
- });
-
- test('getAssociatedEventsWillCommit', function() {
- var m = newModel(function(m) {
-
- var pb = m.getOrCreateProcess(1);
- var pr = m.getOrCreateProcess(2);
- var mainBrowserThread = pb.getOrCreateThread(10);
- var mainRendererThread = pr.getOrCreateThread(20);
- var compositorThread = pr.getOrCreateThread(21);
-
- mainBrowserThread.name = 'CrBrowserMain';
- mainRendererThread.name = 'CrRendererMain';
- compositorThread.name = 'Compositor';
-
- // Expectation: s3 should be included by getOtherCasuallyRelatedEvents,
- // because there is a PostTask s7 -> s3, but s6 shouldn't be included.
- // CrBrowserMain: [s0] [ s1 ]
- // | /|\
- // | |
- // | [ s2 ]____ |
- // CrRendererMain: | /|\ [s7] | | [s6]
- // | | | | |
- // | | | | |
- // \|/ | \|/ \|/ |
- // Compositor: [s4]__| [s3] [s5]__|
-
- m.s0 = mainBrowserThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's0', start: 0.0, duration: 1.0 }));
- m.s1 = mainBrowserThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's1', start: 6.0, duration: 1.0 }));
- m.s2 = mainRendererThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's2', start: 2.0, duration: 1.0 }));
- m.s3 = compositorThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's3', start: 4.0, duration: 1.0 }));
- m.s4 = compositorThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's4', start: 0.5, duration: 1.0 }));
- m.s5 = compositorThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's5', start: 5.5, duration: 1.0 }));
- m.s6 = mainRendererThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's6', start: 1000.0, duration: 1.0 }));
- m.s7 = mainRendererThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's7', start: 2.5, duration: 0.2 }));
-
- mainBrowserThread.sliceGroup.createSubSlices();
- mainRendererThread.sliceGroup.createSubSlices();
- compositorThread.sliceGroup.createSubSlices();
-
- m.f1 = newFlowEventEx({
- title: 'f1',
- start: 0,
- end: 10,
- startSlice: m.s0,
- endSlice: m.s4,
- id: '0x100'
- });
-
- m.f2 = newFlowEventEx({
- title: 'f2',
- start: 20,
- end: 30,
- startSlice: m.s4,
- endSlice: m.s2,
- id: '0x100'
- });
-
- m.f3 = newFlowEventEx({
- title: 'f3',
- start: 20,
- end: 30,
- startSlice: m.s2,
- endSlice: m.s5,
- id: '0x100'
- });
-
- m.f4 = newFlowEventEx({
- title: 'f4',
- start: 20,
- end: 30,
- startSlice: m.s5,
- endSlice: m.s1,
- id: '0x100'
- });
-
- m.f5 = newFlowEventEx({
- title: 'f5',
- cat: 'disabled-by-default-toplevel.flow',
- start: 20,
- end: 30,
- startSlice: m.s7,
- endSlice: m.s3,
- id: '0xAAA'
- });
-
- m.flowEvents.push(m.f1);
- m.flowEvents.push(m.f2);
- m.flowEvents.push(m.f3);
- m.flowEvents.push(m.f4);
- m.flowEvents.push(m.f5);
-
- m.as0 = newAsyncSliceEx({
- title: 'test1',
- cat: 'benchmark,latencyInfo',
- start: 2,
- end: 10,
- id: '0x101',
- isTopLevel: true,
- startThread: mainBrowserThread
- });
-
- m.as1 = newAsyncSliceEx({
- title: 'test2',
- cat: 'benchmark,latencyInfo',
- start: 2,
- end: 10,
- id: '0x100',
- isTopLevel: true,
- startThread: mainBrowserThread
- });
-
- });
-
- assert.isTrue(m.as0.associatedEvents.length === 0);
- assert.isTrue(m.as1.associatedEvents.equals(new EventSet(
- [m.f1, m.f2, m.f3, m.f4, m.f5,
- m.s0, m.s1, m.s2, m.s3, m.s4, m.s5, m.s7])));
- });
-
- test('getAssociatedEventsExcludeOtherInputs', function() {
- var m = newModel(function(m) {
-
- var pb = m.getOrCreateProcess(1);
- var pr = m.getOrCreateProcess(2);
- var mainBrowserThread = pb.getOrCreateThread(10);
- var mainRendererThread = pr.getOrCreateThread(20);
- var compositorThread = pr.getOrCreateThread(21);
-
- mainBrowserThread.name = 'CrBrowserMain';
- mainRendererThread.name = 'CrRendererMain';
- compositorThread.name = 'Compositor';
-
- // Expectation: s3 should be included by getOtherCasuallyRelatedEvents,
- // because there is a PostTask s7 -> s3. Even though there is also a
- // PostTask from s9 to s6, s6 shouldn't be included because it's tracked
- // by LatencyInfo of another input.
- // CrBrowserMain: [s0] [ s1 ] [s8]
- // | /|\ |
- // | | |
- // | [ s2 ]____ | \|/
- // CrRendererMain: | /|\ [s7] | | [s6]
- // | | | | | /|\
- // | | | | | |
- // \|/ | \|/ \|/ | |
- // Compositor: [s4]__| [s3] [ s5 ]_| |
- // [s9]_________|
-
- m.s0 = mainBrowserThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's0', start: 0.0, duration: 1.0 }));
- m.s1 = mainBrowserThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's1', start: 6.0, duration: 1.0 }));
- m.s2 = mainRendererThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's2', start: 2.0, duration: 1.0 }));
- m.s3 = compositorThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's3', start: 4.0, duration: 1.0 }));
- m.s4 = compositorThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's4', start: 0.5, duration: 1.0 }));
- m.s5 = compositorThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's5', start: 5.5, duration: 1.0 }));
- m.s6 = mainRendererThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's6', start: 10.0, duration: 1.0 }));
- m.s7 = mainRendererThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's7', start: 2.5, duration: 0.2 }));
- m.s8 = mainRendererThread.sliceGroup.pushSlice(newSliceEx(
- { title: 's8', start: 9.5, duration: 1.0 }));
- m.s9 = compositorThread.sliceGroup.pushSlice(newSliceEx(
- { title: 'Scheduler::ScheduleBeginImplFrameDeadline',
- start: 5.7, duration: 0.2 }));
-
- mainBrowserThread.sliceGroup.createSubSlices();
- mainRendererThread.sliceGroup.createSubSlices();
- compositorThread.sliceGroup.createSubSlices();
-
- m.f1 = newFlowEventEx({
- title: 'f1',
- cat: 'input',
- start: 0,
- end: 10,
- startSlice: m.s0,
- endSlice: m.s4,
- id: '0x100'
- });
-
- m.f2 = newFlowEventEx({
- title: 'f2',
- cat: 'input',
- start: 20,
- end: 30,
- startSlice: m.s4,
- endSlice: m.s2,
- id: '0x100'
- });
-
- m.f3 = newFlowEventEx({
- title: 'f3',
- cat: 'input',
- start: 20,
- end: 30,
- startSlice: m.s2,
- endSlice: m.s5,
- id: '0x100'
- });
-
- m.f4 = newFlowEventEx({
- title: 'f4',
- cat: 'input',
- start: 20,
- end: 30,
- startSlice: m.s5,
- endSlice: m.s1,
- id: '0x100'
- });
-
- m.f5 = newFlowEventEx({
- title: 'f5',
- cat: 'disabled-by-default-toplevel.flow',
- start: 20,
- end: 30,
- startSlice: m.s7,
- endSlice: m.s3,
- id: '0xAAA'
- });
-
- m.f6 = newFlowEventEx({
- title: 'f6',
- cat: 'disabled-by-default-toplevel.flow',
- start: 20,
- end: 30,
- startSlice: m.s9,
- endSlice: m.s6,
- id: '0xAAB'
- });
-
- m.f7 = newFlowEventEx({
- title: 'f7',
- cat: 'input',
- start: 20,
- end: 30,
- startSlice: m.s8,
- endSlice: m.s6,
- id: '0x102'
- });
-
- m.flowEvents.push(m.f1);
- m.flowEvents.push(m.f2);
- m.flowEvents.push(m.f3);
- m.flowEvents.push(m.f4);
- m.flowEvents.push(m.f5);
- m.flowEvents.push(m.f6);
- m.flowEvents.push(m.f7);
-
- m.as0 = newAsyncSliceEx({
- title: 'test1',
- cat: 'benchmark,latencyInfo',
- start: 2,
- end: 10,
- id: '0x101',
- isTopLevel: true,
- startThread: mainBrowserThread
- });
-
- m.as1 = newAsyncSliceEx({
- title: 'test2',
- cat: 'benchmark,latencyInfo',
- start: 2,
- end: 10,
- id: '0x100',
- isTopLevel: true,
- startThread: mainBrowserThread
- });
-
- m.as2 = newAsyncSliceEx({
- title: 'test2',
- cat: 'benchmark,latencyInfo',
- start: 2,
- end: 10,
- id: '0x102',
- isTopLevel: true,
- startThread: mainBrowserThread
- });
-
- });
-
- assert.isTrue(m.as0.associatedEvents.length === 0);
- assert.isTrue(m.as1.associatedEvents.equals(new EventSet(
- [m.f1, m.f2, m.f3, m.f4, m.f5,
- m.s0, m.s1, m.s2, m.s3, m.s4, m.s5, m.s7, m.s9])));
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_impl.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_impl.html
deleted file mode 100644
index 500a4edbbf8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_impl.html
+++ /dev/null
@@ -1,208 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/rect.html">
-<link rel="import" href="/tracing/extras/chrome/cc/constants.html">
-<link rel="import" href="/tracing/extras/chrome/cc/region.html">
-<link rel="import" href="/tracing/extras/chrome/cc/tile_coverage_rect.html">
-<link rel="import" href="/tracing/model/object_instance.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.cc', function() {
- var constants = tr.e.cc.constants;
- var ObjectSnapshot = tr.model.ObjectSnapshot;
-
- /**
- * @constructor
- */
- function LayerImplSnapshot() {
- ObjectSnapshot.apply(this, arguments);
- }
-
- LayerImplSnapshot.prototype = {
- __proto__: ObjectSnapshot.prototype,
-
- preInitialize: function() {
- tr.e.cc.preInitializeObject(this);
-
- this.layerTreeImpl_ = undefined;
- this.parentLayer = undefined;
- },
-
- initialize: function() {
- // Defaults.
- this.invalidation = new tr.e.cc.Region();
- this.annotatedInvalidation = new tr.e.cc.Region();
- this.unrecordedRegion = new tr.e.cc.Region();
- this.pictures = [];
-
- // Import & validate this.args
- tr.e.cc.moveRequiredFieldsFromArgsToToplevel(
- this, ['layerId', 'layerQuad']);
- tr.e.cc.moveOptionalFieldsFromArgsToToplevel(
- this, ['children', 'maskLayer', 'replicaLayer',
- 'idealContentsScale', 'geometryContentsScale',
- 'layoutRects', 'usingGpuRasterization']);
-
- // Leave gpu memory usage in both places.
- this.gpuMemoryUsageInBytes = this.args.gpuMemoryUsage;
-
- // Leave bounds in both places.
- this.bounds = tr.b.Rect.fromXYWH(
- 0, 0,
- this.args.bounds.width, this.args.bounds.height);
-
- if (this.args.animationBounds) {
- // AnimationBounds[2] and [5] are the Z-component of the box.
- this.animationBoundsRect = tr.b.Rect.fromXYWH(
- this.args.animationBounds[0], this.args.animationBounds[1],
- this.args.animationBounds[3], this.args.animationBounds[4]);
- }
-
- // After Slimming Paint v2, compositor no longer knows hierarchy
- // information. If the children value is undefined, the tracing
- // data comes from the new version of cc, otherwise we set the
- // parentLayer as we did before SPv2.
- if (this.children) {
- for (var i = 0; i < this.children.length; i++)
- this.children[i].parentLayer = this;
- }
- if (this.maskLayer)
- this.maskLayer.parentLayer = this;
- if (this.replicaLayer)
- this.replicaLayer.parentLayer = this;
- if (!this.geometryContentsScale)
- this.geometryContentsScale = 1.0;
- if (!this.idealContentsScale)
- this.idealContentsScale = 1.0;
-
- this.touchEventHandlerRegion = tr.e.cc.Region.fromArrayOrUndefined(
- this.args.touchEventHandlerRegion);
- this.wheelEventHandlerRegion = tr.e.cc.Region.fromArrayOrUndefined(
- this.args.wheelEventHandlerRegion);
- this.nonFastScrollableRegion = tr.e.cc.Region.fromArrayOrUndefined(
- this.args.nonFastScrollableRegion);
- },
-
- get layerTreeImpl() {
- if (this.layerTreeImpl_)
- return this.layerTreeImpl_;
- if (this.parentLayer)
- return this.parentLayer.layerTreeImpl;
- return undefined;
- },
- set layerTreeImpl(layerTreeImpl) {
- this.layerTreeImpl_ = layerTreeImpl;
- },
-
- get activeLayer() {
- if (this.layerTreeImpl.whichTree == constants.ACTIVE_TREE)
- return this;
- var activeTree = this.layerTreeImpl.layerTreeHostImpl.activeTree;
- return activeTree.findLayerWithId(this.layerId);
- },
-
- get pendingLayer() {
- if (this.layerTreeImpl.whichTree == constants.PENDING_TREE)
- return this;
- var pendingTree = this.layerTreeImpl.layerTreeHostImpl.pendingTree;
- return pendingTree.findLayerWithId(this.layerId);
- }
- };
-
- /**
- * @constructor
- */
- function PictureLayerImplSnapshot() {
- LayerImplSnapshot.apply(this, arguments);
- }
-
- PictureLayerImplSnapshot.prototype = {
- __proto__: LayerImplSnapshot.prototype,
-
- initialize: function() {
- LayerImplSnapshot.prototype.initialize.call(this);
-
- if (this.args.invalidation) {
- this.invalidation = tr.e.cc.Region.fromArray(this.args.invalidation);
- delete this.args.invalidation;
- }
- if (this.args.annotatedInvalidationRects) {
- this.annotatedInvalidation = new tr.e.cc.Region();
- for (var i = 0; i < this.args.annotatedInvalidationRects.length; ++i) {
- var annotatedRect = this.args.annotatedInvalidationRects[i];
- var rect = annotatedRect.geometryRect;
- rect.reason = annotatedRect.reason;
- this.annotatedInvalidation.addRect(rect);
- }
- delete this.args.annotatedInvalidationRects;
- }
- if (this.args.unrecordedRegion) {
- this.unrecordedRegion = tr.e.cc.Region.fromArray(
- this.args.unrecordedRegion);
- delete this.args.unrecordedRegion;
- }
- if (this.args.pictures) {
- this.pictures = this.args.pictures;
-
- // The picture list comes in with an unknown ordering. We resort based
- // on timestamp order so we will draw the base picture first and the
- // various fixes on top of that.
- this.pictures.sort(function(a, b) { return a.ts - b.ts; });
- }
-
- this.tileCoverageRects = [];
- if (this.args.coverageTiles) {
- for (var i = 0; i < this.args.coverageTiles.length; ++i) {
- var rect = this.args.coverageTiles[i].geometryRect.scale(
- this.idealContentsScale);
- var tile = this.args.coverageTiles[i].tile;
- this.tileCoverageRects.push(new tr.e.cc.TileCoverageRect(rect, tile));
- }
- delete this.args.coverageTiles;
- }
- }
- };
-
- ObjectSnapshot.register(
- PictureLayerImplSnapshot,
- {
- typeName: 'cc::PictureLayerImpl'
- });
-
- ObjectSnapshot.register(
- LayerImplSnapshot,
- {
- typeNames: [
- 'cc::LayerImpl',
- 'cc::DelegatedRendererLayerImpl',
- 'cc::HeadsUpDisplayLayerImpl',
- 'cc::IOSurfaceLayerImpl',
- 'cc::NinePatchLayerImpl',
- 'cc::PictureImageLayerImpl',
- 'cc::ScrollbarLayerImpl',
- 'cc::SolidColorLayerImpl',
- 'cc::SolidColorScrollbarLayerImpl',
- 'cc::SurfaceLayerImpl',
- 'cc::TextureLayerImpl',
- 'cc::TiledLayerImpl',
- 'cc::VideoLayerImpl',
- 'cc::PaintedScrollbarLayerImpl',
- 'ClankPatchLayer',
- 'TabBorderLayer',
- 'CounterLayer'
- ]
- });
-
- return {
- LayerImplSnapshot: LayerImplSnapshot,
- PictureLayerImplSnapshot: PictureLayerImplSnapshot
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_host_impl.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_host_impl.html
deleted file mode 100644
index 8d81a4fd99e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_host_impl.html
+++ /dev/null
@@ -1,192 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/cc/constants.html">
-<link rel="import" href="/tracing/extras/chrome/cc/layer_tree_impl.html">
-<link rel="import" href="/tracing/extras/chrome/cc/util.html">
-<link rel="import" href="/tracing/base/bbox2.html">
-<link rel="import" href="/tracing/model/object_instance.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the LayerTreeHostImpl model-level objects.
- */
-tr.exportTo('tr.e.cc', function() {
- var constants = tr.e.cc.constants;
-
- var ObjectSnapshot = tr.model.ObjectSnapshot;
- var ObjectInstance = tr.model.ObjectInstance;
-
- /**
- * @constructor
- */
- function LayerTreeHostImplSnapshot() {
- ObjectSnapshot.apply(this, arguments);
- }
-
- LayerTreeHostImplSnapshot.prototype = {
- __proto__: ObjectSnapshot.prototype,
-
- preInitialize: function() {
- tr.e.cc.preInitializeObject(this);
- },
-
- initialize: function() {
- tr.e.cc.moveRequiredFieldsFromArgsToToplevel(
- this, ['deviceViewportSize',
- 'activeTree']);
- tr.e.cc.moveOptionalFieldsFromArgsToToplevel(
- this, ['pendingTree']);
-
- // Move active_tiles into this.tiles. If that doesn't exist then, then as
- // a backward compatability move tiles into this.tiles.
- if (this.args.activeTiles !== undefined) {
- this.activeTiles = this.args.activeTiles;
- delete this.args.activeTiles;
- } else if (this.args.tiles !== undefined) {
- this.activeTiles = this.args.tiles;
- delete this.args.tiles;
- }
-
- if (!this.activeTiles)
- this.activeTiles = [];
-
- this.activeTree.layerTreeHostImpl = this;
- this.activeTree.whichTree = constants.ACTIVE_TREE;
- if (this.pendingTree) {
- this.pendingTree.layerTreeHostImpl = this;
- this.pendingTree.whichTree = constants.PENDING_TREE;
- }
- },
-
- /**
- * Get all of tile scales and their associated names.
- */
- getContentsScaleNames: function() {
- var scales = {};
- for (var i = 0; i < this.activeTiles.length; ++i) {
- var tile = this.activeTiles[i];
- // Return scale -> scale name mappings.
- // Example:
- // 0.25 -> LOW_RESOLUTION
- // 1.0 -> HIGH_RESOLUTION
- // 0.75 -> NON_IDEAL_RESOLUTION
- scales[tile.contentsScale] = tile.resolution;
- }
- return scales;
- },
-
- getTree: function(whichTree) {
- if (whichTree == constants.ACTIVE_TREE)
- return this.activeTree;
- if (whichTree == constants.PENDING_TREE)
- return this.pendingTree;
- throw new Exception('Unknown tree type + ' + whichTree);
- },
-
- get tilesHaveGpuMemoryUsageInfo() {
- if (this.tilesHaveGpuMemoryUsageInfo_ !== undefined)
- return this.tilesHaveGpuMemoryUsageInfo_;
-
- for (var i = 0; i < this.activeTiles.length; i++) {
- if (this.activeTiles[i].gpuMemoryUsageInBytes === undefined)
- continue;
- this.tilesHaveGpuMemoryUsageInfo_ = true;
- return true;
- }
- this.tilesHaveGpuMemoryUsageInfo_ = false;
- return false;
- },
-
- get gpuMemoryUsageInBytes() {
- if (!this.tilesHaveGpuMemoryUsageInfo)
- return;
-
- var usage = 0;
- for (var i = 0; i < this.activeTiles.length; i++) {
- var u = this.activeTiles[i].gpuMemoryUsageInBytes;
- if (u !== undefined)
- usage += u;
- }
- return usage;
- },
-
- get userFriendlyName() {
- var frameNumber;
- if (!this.activeTree) {
- frameNumber = this.objectInstance.snapshots.indexOf(this);
- } else {
- if (this.activeTree.sourceFrameNumber === undefined)
- frameNumber = this.objectInstance.snapshots.indexOf(this);
- else
- frameNumber = this.activeTree.sourceFrameNumber;
- }
- return 'cc::LayerTreeHostImpl frame ' + frameNumber;
- }
- };
-
- ObjectSnapshot.register(
- LayerTreeHostImplSnapshot,
- {typeName: 'cc::LayerTreeHostImpl'});
-
- /**
- * @constructor
- */
- function LayerTreeHostImplInstance() {
- ObjectInstance.apply(this, arguments);
-
- this.allLayersBBox_ = undefined;
- }
-
- LayerTreeHostImplInstance.prototype = {
- __proto__: ObjectInstance.prototype,
-
- get allContentsScales() {
- if (this.allContentsScales_)
- return this.allContentsScales_;
-
- var scales = {};
- for (var tileID in this.allTileHistories_) {
- var tileHistory = this.allTileHistories_[tileID];
- scales[tileHistory.contentsScale] = true;
- }
- this.allContentsScales_ = tr.b.dictionaryKeys(scales);
- return this.allContentsScales_;
- },
-
- get allLayersBBox() {
- if (this.allLayersBBox_)
- return this.allLayersBBox_;
- var bbox = new tr.b.BBox2();
- function handleTree(tree) {
- tree.renderSurfaceLayerList.forEach(function(layer) {
- bbox.addQuad(layer.layerQuad);
- });
- }
- this.snapshots.forEach(function(lthi) {
- handleTree(lthi.activeTree);
- if (lthi.pendingTree)
- handleTree(lthi.pendingTree);
- });
- this.allLayersBBox_ = bbox;
- return this.allLayersBBox_;
- }
- };
-
- ObjectInstance.register(
- LayerTreeHostImplInstance,
- {typeName: 'cc::LayerTreeHostImpl'});
-
- return {
- LayerTreeHostImplSnapshot: LayerTreeHostImplSnapshot,
- LayerTreeHostImplInstance: LayerTreeHostImplInstance
-
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_host_impl_test.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_host_impl_test.html
deleted file mode 100644
index f9a165a8137..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_host_impl_test.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/cc/layer_tree_host_impl.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script src="/tracing/extras/chrome/cc/layer_tree_host_impl_test_data.js">
-</script>
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('basic', function() {
- var m = tr.c.TestUtils.newModelWithEvents([g_catLTHIEvents]);
- var p = tr.b.dictionaryValues(m.processes)[0];
-
- var instance = p.objects.getAllInstancesNamed('cc::LayerTreeHostImpl')[0];
- var snapshot = instance.snapshots[0];
-
- assert.instanceOf(snapshot, tr.e.cc.LayerTreeHostImplSnapshot);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_host_impl_test_data.js b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_host_impl_test_data.js
deleted file mode 100644
index 7d5036d7310..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_host_impl_test_data.js
+++ /dev/null
@@ -1,330 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-'use strict';
-
-// A single LTHI sort of manually created from a Google search for cats.
-var g_catLTHIEvents = [
- {
- 'name': 'cc::Picture',
- 'args': {
- 'snapshot': {
- 'params': {
- 'opaque_rect': [
- -15,
- -15,
- 0,
- 0
- ],
- 'layer_rect': [
- -15,
- -15,
- 1260,
- 1697
- ]
- },
- 'skp64': 'c2tpYXBpY3QWAAAAOAQAABQDAAADAAAAAWRhZXKoCQAACAAAHgMAAAAIAAAeAwAAAAwAACMAAHBBAABwQRwAAAMAAHDBAABwwQAghUQAQEFEAQAAAKAJAAAYAAAVAQAAAAAAAAAAAAAAAECDRACAPUQIAAAeAwAAABwAAAMAAAAAAAAAAABAg0QAAMhBAQAAAIwAAAAYAAAVAgAAAAAAAAAAAAAAAECDRAAAyEEEAAAcCAAAHgMAAAAcAAADAAAAAAAAyEEAQINEAADQQQEAAADYAAAADAAAIwAAAAAAAMhBGAAAFQIAAAAAAAAAAAAAAABAg0QAAMhBBAAAHBgAABUDAAAAAAAAAAAAyEEAQINEAADQQQgAAB4DAAAACAAAHgMAAAAMAAAjAABwwQAAcMEUAAAGAAAAAAAAAAAAAIhBAACIQQQAABwEAAAcCAAAHgMAAAAcAAADAACAQAAAAEAAAHxCAADAQQEAAABQAQAABAAAHAgAAB4DAAAAHAAAAwAAgEAAAABAAAB8QgAAwEEBAAAAeAEAAAQAABwIAAAeAwAAABwAAAMAAIBAAAAAQAAAfEIAAMBBAQAAAOABAABAAAAUBAAAAAwAAAA1AEgARgBSAFUARwAGAAAAAKDcPwCG4kEAAJBBAAAgQQDSlkEAONVBAEsHQgCxKUIAm0BCBAAAHAgAAB4DAAAAHAAAAwAAgEAAAABAAAB8QgAAwEEBAAAACAIAAAQAABwkAAAUBQAAAAIAAAADAAAAAQAAAAAAYD0AkM1BAACQQQDwhUIIAAAeAwAAAAgAAB4DAAAADAAAIwAAcMEAAHDBFAAABgAAAAABAAAAAACyQgAAsEEEAAAcBAAAHCQAABQFAAAAAgAAAAMAAAABAAAAAABgPQCQzUEAAJBBAJCxQlgAABQGAAAAFAAAADAAUgBRAEwAVwBSAFUATABRAEoACgAAAAAQE0AA3sVBAACQQQCQvUIAkNVCAJDlQgCQ9UIAkPtCAMgBQwDICUMAyA5DAMgRQwDIGUMkAAAUBQAAAAIAAAADAAAAAQAAAAAAYD0AkM1BAACQQQDII0MIAAAeAwAAAAgAAB4DAAAADAAAIwAAcMEAAHDBFAAABgAAAAACAAAAAAA5QwAAiEEEAAAcBAAAHAgAAB4DAAAAHAAAAwAALEMAAABAAIC/QwAAwEEBAAAAZAMAAAQAABwIAAAeAwAAABwAAAMAACxDAAAAQACAv0MAAMBBAQAAAIwDAAAEAAAcCAAAHgMAAAAcAAADAAAsQwAAAEAAgL9DAADAQQEAAAB0BAAAwAAAFAcAAAA2AAAAJgBEAFMAVwBYAFUASAADADAAUgBRAEwAVwBSAFUATABRAEoAAwA2AFEARABTAFYASwBSAFcAAAAbAAAAAKDcPwCG4kEAAJBBAAAyQ8CvO0MAa0NDwDpMQ0B3UUOAJ1pDAOJfQ8CuZ0PAHGxDwCt4Q6BigEPAuoRDwMCGQwBfiUPAq41DAImQQwCPkkMg55ZDgESbQ4B7nUOgQKFDwJilQ2B2qUNA3q1DwG+xQ+DHtUOgFLpDBAAAHAgAAB4DAAAAHAAAAwAALEMAAABAAIC/QwAAwEEBAAAAnAQAAAQAABwkAAAUBQAAAAIAAAADAAAAAQAAAAAAYD0AkM1BAACQQQCYwUMIAAAeAwAAAAgAAB4DAAAADAAAIwAAcMEAAHDBFAAABgAAAAADAAAAAADrQwAAiEEEAAAcBAAAHAgAAB4DAAAAHAAAAwCA5EMAAABAAAD6QwAAwEEBAAAAIAUAAAQAABwIAAAeAwAAABwAAAMAgORDAAAAQAAA+kMAAMBBAQAAAEgFAAAEAAAcCAAAHgMAAAAcAAADAIDkQwAAAEAAAPpDAADAQQEAAACkBQAANAAAFAcAAAAIAAAANgBEAFkASAAEAAAAAKDcPwCG4kEAAJBBAIDnQyBF60PAIu9DQMLyQwQAABwIAAAeAwAAABwAAAMAgORDAAAAQAAA+kMAAMBBAQAAAMwFAAAEAAAcJAAAFAUAAAACAAAAAwAAAAEAAAAAAGA9AJDNQQAAkEEAwvtDCAAAHgMAAAAIAAAeAwAAAAwAACMAAHDBAABwwRQAAAYAAAAABAAAAABAA0QAAIhBBAAAHAQAABwIAAAeAwAAABwAAAMAAABEAAAAQAAAC0QAAMBBAQAAAFAGAAAEAAAcCAAAHgMAAAAcAAADAAAARAAAAEAAAAtEAADAQQEAAAB4BgAABAAAHAgAAB4DAAAAHAAAAwAAAEQAAABAAAALRAAAwEEBAAAA1AYAADQAABQEAAAACAAAAC8AUgBEAEcABAAAAACg3D8AhuJBAACQQQCAAUTAXQNEIIQFRPByB0QEAAAcCAAAHgMAAAAcAAADAAAARAAAAEAAAAtEAADAQQEAAAD8BgAABAAAHDAAABQGAAAABgAAAEEAQgBBAAAAAwAAAACAmD4A3rVBAACAQQCADEQAQA5EAEAQRBgAABUIAAAAAECARAAAAEAAIINEAADAQQwAAA4JAAAAAQAAACQAABQKAAAAAgAAACIAAAABAAAAAICYPgDetUEAAIBBADCBRBgAABUDAAAAAAAAAAAA+kMAQINEAID6QxgAABULAAAAAICARAAA0EEAQINEAAD6QxgAABUMAAAAAICARAAA0EEAoIBEAAD6QxgAABUNAAAAAAAAAAAA/kMAQINEAIA9RBgAABUIAAAAAMBNRAAAAEAAQHhEAACoQQwAAA4JAAAAAgAAACQAABQOAAAAAgAAAJ0DAAABAAAAAIAmwABQ3kEAAIBBAEB4RCQAABQOAAAAAgAAAJ8DAAABAAAAAIAmwABQ3kEAAIBBAEB8RAgAAB4DAAAAHAAAAwDATUQAAEBAAEB4RAAAsEEBAAAAfAgAABAAAB8AAAAADwAAAB8AAAAEAAAcBAAAHAgAAB4DAAAAHAAAAwAAAAAAgPpDAECDRAAA+0MBAAAA1AgAAAwAACMAAAAAAID6QwwAACMAAACAAACAwBgAABUQAAAAAAAAAAAAAAAAQINEAACgQAQAABwIAAAeAwAAABwAAAMAAAAAAAD7QwBAg0QAgP1DAQAAACAJAAAMAAAjAAAAAAAA+0MYAAAVEAAAAAAAAAAAAAAAAECDRAAAoEAEAAAcCAAAHgMAAAAcAAADAAAAAACA/UMAQINEAAD+QwEAAABsCQAADAAAIwAAAAAAgP1DGAAAFRAAAAAAAAAAAAAAAABAg0QAAKBABAAAHBgAABURAAAAAAAAAACA+kMAQINEAAD7QxgAABUSAAAAAAAAAACA/UMAQINEAAD+QwQAABwEAAAcdGNhZiMAAAACAAAADVNrU3JjWGZlcm1vZGUQU2tMaW5lYXJHcmFkaWVudGNmcHQCAAAAAAENTHVjaWRhIEdyYW5kZQQNTHVjaWRhIEdyYW5kZQYMTHVjaWRhR3JhbmRl/v8AAAABCUhlbHZldGljYQQJSGVsdmV0aWNhBglIZWx2ZXRpY2H+/wAAeWFyYcQIAABwbXRiBQAAAD8AAAAWAAAAAAAAAKkAAACJUE5HDQoaCgAAAA1JSERSAAAAPwAAABYIBgAAAHf8RCEAAABwSURBVFiF7ZSxAcQgDMRk8KQMRQdD0lElxf8MueKsCSSMHXPOB1MSYIyh9vicvfcv/t6rdpGQAOcctYeEphZQkgCteb5Bxffe1R4SEiAi1B4SKt7123teuj/Wk6+dd42vnXedfMVXvCEVv9ZSe0h4ASOjDeti06sSAAAAAElFTkSuQmCCAAAAAAAAAAAAAAAMAAAADQAAAAAAAAAPAQAAiVBORw0KGgoAAAANSUhEUgAAAAwAAAANCAYAAACdKY9CAAAA1klEQVQokZWSMWrDQBBF38hrxW5SGJdSkyqtyRXSB3QRnUUXEWzvK+QKwSCxxbIE5CpaZMmFsuBCK/DAr+a9zxQjwBY4AK/AjuX5A67ArwIOVVV9FEXxlmXZcYlu29bVdf1TluW3AO9N03zG4Ecpz/OzAKdpmr7W4DAiohUgwzAwjuMqnCQJgCiAJwQUgPce7/2qkKbpLAY7NMTawz5OxWSgN8a40BKLMcYBfQJ0WuuLtdYppViKtdZprS9AJ8AeODK/xkvkkp75NZwAAmz+IxFhAm7A7Q619kxK1JGuJQAAAABJRU5ErkJgggAAAAAAAAAAANcAAAAWAAAAAAAAAMcAAACJUE5HDQoaCgAAAA1JSERSAAAA1wAAABYIBgAAAFPJCaQAAACOSURBVHic7duxDYQwEETRObSVupJrgpQiiRwS0AIrS9Z7FUzytU78O8/zH+BzlSRjjNU7YCvXdb1xzTlXb4HtVJLc9716B2znWD0AdlVJchwag69VklTV6h2wHZcLmqgKmrhc0ERc0ERc0ERc0ERV0ERc0MSzEJqoCpq4XNBEVdDE5YImqoImlbz//YFvPbqBDWEab+OuAAAAAElFTkSuQmCCAAAAAAAAAAAALwAAABYAAAAAAAAApgAAAIlQTkcNChoKAAAADUlIRFIAAAAvAAAAFggGAAAAUFLFyQAAAG1JREFUWIXt17ENwCAUA9EL8qRMkiVoGZKKMgVZIKSwLPEmOKzfcLXWbkIJoNbq7vis977i55zuli0CGGO4O7YUd8AfAigl8w0CkOTu2BK9fGb1K3r5E+8SHZ9Z/YqOP2fjcpZ3Ocu7CNZ/MNEDHg4NYflXb+0AAAAASUVORK5CYIIAAAAAAAAAAAAAMAAAABYAAAAAAAAArgAAAIlQTkcNChoKAAAADUlIRFIAAAAwAAAAFggGAAAAhvcfrAAAAHVJREFUWIXtk7ERwCAMxGTwpAxFB0PSUSVFMoFT/JmLJpDOfuu9XyTGAVprao8Qc84nYO+tdgnjAGsttUeYohb4igOUkrfjjIBaq9ojjAOYmdojzBkBmV8o73pf0l/gjA1kDjhjA5kv8Aeo+QPUOMAYQ+0R5gZf3A3r3/HMCQAAAABJRU5ErkJgggAAAAAAAAAAAAAgdG5wEgAAAAAAQEEAAIA/AAAAAAAAAAAAAIBA/////wIwAwAAAAAAAAAAAAAAAAABAAAABAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBBAACAPwAAAAAAAAAAAACAQAAAAP8CMAMAAAAAAAAAAAACAAAATAAAAAAAAAAAAAAAAgAAAOXl5f/R0dH/EAAAAAAAAAAK1yM9AAAAAArXI70AAAAAAAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAyEEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQQAAgD8AAAAAAAAAAAAAgECOjo7/ADADAAAAAAAAAGBBAACAPwAAAAAAAAAAAACAQAAAAP8BMIMCAwAAAAEAAAAAAIBBAACAPwAAAAAAAAAAAACAQAAAAP8BMIMCAwAAAAIAAAAAAGBBAACAPwAAAAAAAAAAAACAQAAAAP8BMIMCAwAAAAIAAAAAAGBBAACAPwAAAAAAAAAAAACAQH9/f/8BMIMCAwAAAAEAAAAAAEBBAACAPwAAAAAAAAAAAACAQPj4+P8AMAMAAAAAAAAAQEEAAIA/AAAAAAAAAAAAAIBAAAAAfwAwAwAAAAAAAABgQQAAgD8AAAAAAAAAAAAAgEAAAADMATCDAgMAAAACAAAAAABAQQAAgD8AAAAAAAAAAAAAgEDs7Oz/ADADAAAAAAAAAEBBAACAPwAAAAAAAAAAAACAQAAAAP8AMAMAAAAAAAAAQEEAAIA/AAAAAAAAAAAAAIBA/////wAwAwAAAAAAAACAQQAAgD8AAAAAAAAAAAAAgEAAAAD/ATCDAgMAAAABAAAAAABAQQAAgD8AAAAAAAAAAAAAgEAAAAA/ADAAAAAAAAAAAEBBAACAPwAAAAAAAAAAAACAQAAAAP8CMAMAAAAAAAAAAAACAAAATAAAAAAAAAAAAAAAAgAAAOXl5f/R0dH/EAAAAAAAAADNzEw+AAAAAM3MTL4AAAAAAAAAAAAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAAAAoEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQQAAgD8AAAAAAAAAAAAAgED/////ADACAAAAAAAAAEBBAACAPwAAAAAAAAAAAACAQI6Ojv8AMAIAAAAAACBodHACAAAAAgAAAAABAAABAAACAAAAAAoAAAAIAAAAAAAAAAUBAQEABQEBAQAAQIBEAAAAQAAgg0QAAABAACCDRAAAwEEAQIBEAADAQQBggEQAAEBAAACDRAAAQEAAAINEAAC4QQBggEQAALhBAECARAAAAEAAIINEAADAQQAAAAEAAAEAAAIAAAAACgAAAAgAAAAAAAAABQEBAQAFAQEBAADATUQAAABAAEB4RAAAAEAAQHhEAACoQQDATUQAAKhBAABORAAAQEAAAHhEAABAQAAAeEQAAKBBAABORAAAoEEAwE1EAAAAQABAeEQAAKhBAAAgZm9l' // @suppress longLineCheck
- }
- },
- 'pid': 1,
- 'ts': 100,
- 'cat': 'disabled-by-default-cc.debug',
- 'tid': 1,
- 'ph': 'O',
- 'id': 'PICTURE_1'
- },
- {
- 'name': 'AnalyzeTask',
- 'args': {
- 'data': {
- 'source_frame_number': 107,
- 'tile_id': {
- 'id_ref': 'TILE_1'
- },
- 'resolution': 'HIGH_RESOLUTION',
- 'is_tile_in_pending_tree_now_bin': true
- }
- },
- 'pid': 1,
- 'ts': 101,
- 'cat': 'cc',
- 'tid': 1,
- 'ph': 'B'
- },
- {
- 'name': 'AnalyzeTask',
- 'args': {},
- 'pid': 1,
- 'ts': 105,
- 'cat': 'cc',
- 'tid': 1,
- 'ph': 'E'
- },
- {
- 'name': 'RasterTask',
- 'args': {
- 'data': {
- 'source_frame_number': 107,
- 'tile_id': {
- 'id_ref': 'TILE_1'
- },
- 'resolution': 'HIGH_RESOLUTION',
- 'is_tile_in_pending_tree_now_bin': true
- }
- },
- 'pid': 1,
- 'ts': 110,
- 'cat': 'cc',
- 'tid': 1,
- 'ph': 'B'
- },
- {
- 'name': 'RasterTask',
- 'args': {},
- 'pid': 1,
- 'ts': 150,
- 'cat': 'cc',
- 'tid': 1,
- 'ph': 'E'
- },
- {
- 'name': 'RasterTask',
- 'args': {
- 'data': {
- 'source_frame_number': 107,
- 'tile_id': {
- 'id_ref': 'TILE_2'
- },
- 'resolution': 'HIGH_RESOLUTION',
- 'is_tile_in_pending_tree_now_bin': true
- }
- },
- 'pid': 1,
- 'ts': 170,
- 'cat': 'cc',
- 'tid': 1,
- 'ph': 'B'
- },
- {
- 'name': 'RasterTask',
- 'args': {},
- 'pid': 1,
- 'ts': 180,
- 'cat': 'cc',
- 'tid': 1,
- 'ph': 'E'
- },
- {
- 'name': 'cc::LayerTreeHostImpl',
- 'args': {
- 'snapshot': {
- 'device_viewport_size': {
- 'width': 2460,
- 'height': 1606
- },
- 'active_tree': {
- 'source_frame_number': 7,
- 'root_layer': {
- 'tilings': [
- {
- 'content_scale': 2,
- 'content_bounds': {
- 'width': 2460,
- 'height': 3334
- },
- 'num_tiles': 1
- },
- {
- 'content_scale': 0.25,
- 'content_bounds': {
- 'width': 308,
- 'height': 417
- },
- 'num_tiles': 1
- }
- ],
- 'coverage_tiles': [
- {
- 'geometry_rect': [0, 0, 256, 256],
- 'tile': {
- 'id_ref': 'TILE_1'
- }
- },
- {
- 'geometry_rect': [256, 0, 256, 256]
- },
- {
- 'geometry_rect': [512, 0, 256, 256]
- },
- {
- 'geometry_rect': [0, 256, 256, 512]
- },
- {
- 'geometry_rect': [256, 256, 512, 512]
- }
- ],
- 'gpu_memory_usage': 22069248,
- 'draws_content': 1,
- 'layer_id': 6,
- 'invalidation': [],
- 'bounds': {
- 'width': 1230,
- 'height': 1667
- },
- 'children': [
- {
- 'tilings': [
- {
- 'content_scale': 2,
- 'content_bounds': {
- 'width': 200,
- 'height': 100
- },
- 'num_tiles': 1
- }
- ],
- 'gpu_memory_usage': 128000,
- 'draws_content': 1,
- 'layer_id': 7,
- 'invalidation': [],
- 'bounds': {
- 'width': 100,
- 'height': 50
- },
- 'children': [
- ],
- 'ideal_contents_scale': 2,
- 'layer_quad': [
- 0,
- 0,
- 200,
- 0,
- 200,
- 100,
- 0,
- 100
- ],
- 'pictures': [
- ],
- 'id': 'cc::PictureLayerImpl/LAYER_2'
- }
- ],
- 'ideal_contents_scale': 2,
- 'layer_quad': [
- 0,
- -1022,
- 2460,
- -1022,
- 2460,
- 2312,
- 0,
- 2312
- ],
- 'pictures': [
- {
- 'id_ref': 'PICTURE_1'
- }
- ],
- 'id': 'cc::PictureLayerImpl/LAYER_1'
- },
- 'render_surface_layer_list': [
- {'id_ref': 'LAYER_1'},
- {'id_ref': 'LAYER_2'}
- ],
- 'id': 'cc::LayerTreeImpl/0x7d246ee0'
- },
- 'tiles': [
- {
- 'active_priority': {
- 'time_to_visible_in_seconds': 0,
- 'resolution': 'HIGH_RESOLUTION',
- 'distance_to_visible_in_pixels': 0
- },
- 'pending_priority': {
- 'time_to_visible_in_seconds': 3.4028234663852886e+38,
- 'resolution': 'NON_IDEAL_RESOLUTION',
- 'distance_to_visible_in_pixels': 3.4028234663852886e+38
- },
- 'managed_state': {
- 'resolution': 'HIGH_RESOLUTION',
- 'is_solid_color': false,
- 'is_using_gpu_memory': true,
- 'has_resource': true,
- 'scheduled_priority': 10,
- 'distance_to_visible': 0,
- 'gpu_memory_usage': 1024000
- },
- 'layer_id': '6',
- 'picture_pile': {
- 'id_ref': 'PICTURE_1'
- },
- 'contents_scale': 2,
- 'content_rect': [0, 0, 1024, 1024],
- 'id': 'cc::Tile/TILE_1'
- },
- {
- 'active_priority': {
- 'time_to_visible_in_seconds': 0,
- 'resolution': 'HIGH_RESOLUTION',
- 'distance_to_visible_in_pixels': 0
- },
- 'pending_priority': {
- 'time_to_visible_in_seconds': 3.4028234663852886e+38,
- 'resolution': 'NON_IDEAL_RESOLUTION',
- 'distance_to_visible_in_pixels': 3.4028234663852886e+38
- },
- 'managed_state': {
- 'resolution': 'HIGH_RESOLUTION',
- 'is_solid_color': false,
- 'is_using_gpu_memory': true,
- 'has_resource': true,
- 'scheduled_priority': 12,
- 'distance_to_visible': 0,
- 'gpu_memory_usage': 1024000
- },
- 'layer_id': '6',
- 'picture_pile': {
- 'id_ref': 'PICTURE_1'
- },
- 'contents_scale': 2,
- 'content_rect': [0, 1024, 1024, 1024],
- 'id': 'cc::Tile/TILE_2'
- }
- ]
- }
- },
- 'pid': 1,
- 'ts': 500,
- 'cat': 'disabled-by-default-cc.debug',
- 'tid': 28163,
- 'ph': 'O',
- 'id': 'LTHI_1'
- },
- {
- 'name': 'cc::DisplayItemList',
- 'args': {
- 'snapshot': {
- 'params': {
- 'layer_rect': [
- -15,
- -15,
- 1260,
- 1697
- ],
- 'items': [
- 'BeginClipDisplayItem',
- 'EndClipDisplayItem'
- ]
- },
- 'skp64': '[base 64 encoded skia picture]'
- }
- },
- 'pid': 1,
- 'ts': 300,
- 'cat': 'disabled-by-default-cc.debug',
- 'tid': 1,
- 'ph': 'O',
- 'id': 'PICTURE_3'
- }
-];
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_impl.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_impl.html
deleted file mode 100644
index 752c8ad509f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/layer_tree_impl.html
+++ /dev/null
@@ -1,170 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/cc/constants.html">
-<link rel="import" href="/tracing/extras/chrome/cc/layer_impl.html">
-<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
-<link rel="import" href="/tracing/model/object_instance.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.cc', function() {
-
- var constants = tr.e.cc.constants;
- var ObjectSnapshot = tr.model.ObjectSnapshot;
-
- /**
- * @constructor
- */
- function LayerTreeImplSnapshot() {
- ObjectSnapshot.apply(this, arguments);
- }
-
- LayerTreeImplSnapshot.prototype = {
- __proto__: ObjectSnapshot.prototype,
-
- preInitialize: function() {
- tr.e.cc.preInitializeObject(this);
- this.layerTreeHostImpl = undefined;
- this.whichTree = undefined;
- this.sourceFrameNumber = undefined;
- },
-
- initialize: function() {
- tr.e.cc.moveRequiredFieldsFromArgsToToplevel(
- this, ['renderSurfaceLayerList']);
- tr.e.cc.moveOptionalFieldsFromArgsToToplevel(
- this, ['rootLayer', 'layers']);
- if (this.args.sourceFrameNumber)
- this.sourceFrameNumber = this.args.sourceFrameNumber;
-
- // Slimming Paint v2 removes the tree hierarchy and replace
- // it with a layer list. The tracing data should have either
- // rootLayer or layers available.
- if (this.rootLayer) {
- // The version before SPv2
- this.rootLayer.layerTreeImpl = this;
- } else {
- // The SPv2 version, where the layer list contains all
- // non-mask, non-replica layers.
- for (var i = 0; i < this.layers.length; i++) {
- this.layers[i].layerTreeImpl = this;
- }
- }
-
- if (this.args.swapPromiseTraceIds &&
- this.args.swapPromiseTraceIds.length) {
- this.tracedInputLatencies = [];
-
- var ownProcess = this.objectInstance.parent;
- var modelHelper = ownProcess.model.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- if (modelHelper)
- this._initializeTracedInputLatencies(modelHelper);
- }
- },
-
- _initializeTracedInputLatencies: function(modelHelper) {
- var latencyEvents = modelHelper.browserHelper.getLatencyEventsInRange(
- modelHelper.model.bounds);
-
- // Convert all ids to InputLatency Async objects.
- latencyEvents.forEach(function(event) {
- for (var i = 0; i < this.args.swapPromiseTraceIds.length; i++) {
- if (!event.args.data || !event.args.data.trace_id)
- continue;
- if (parseInt(event.args.data.trace_id) ===
- this.args.swapPromiseTraceIds[i])
- this.tracedInputLatencies.push(event);
- }
- }, this);
- },
-
- get hasSourceFrameBeenDrawnBefore() {
- if (this.whichTree == tr.e.cc.constants.PENDING_TREE)
- return false;
-
- // Old chrome's don't produce sourceFrameNumber.
- if (this.sourceFrameNumber === undefined)
- return;
-
- var thisLTHI = this.layerTreeHostImpl;
- var thisLTHIIndex = thisLTHI.objectInstance.snapshots.indexOf(
- thisLTHI);
- var prevLTHIIndex = thisLTHIIndex - 1;
- if (prevLTHIIndex < 0 ||
- prevLTHIIndex >= thisLTHI.objectInstance.snapshots.length)
- return false;
- var prevLTHI = thisLTHI.objectInstance.snapshots[prevLTHIIndex];
- if (!prevLTHI.activeTree)
- return false;
-
- // Old chrome's don't produce sourceFrameNumber.
- if (prevLTHI.activeTree.sourceFrameNumber === undefined)
- return;
- return prevLTHI.activeTree.sourceFrameNumber == this.sourceFrameNumber;
- },
-
- get otherTree() {
- var other = this.whichTree == constants.ACTIVE_TREE ?
- constants.PENDING_TREE : constants.ACTIVE_TREE;
- return this.layerTreeHostImpl.getTree(other);
- },
-
- get gpuMemoryUsageInBytes() {
- var totalBytes = 0;
- this.iterLayers(function(layer) {
- if (layer.gpuMemoryUsageInBytes !== undefined)
- totalBytes += layer.gpuMemoryUsageInBytes;
- });
- return totalBytes;
- },
-
- iterLayers: function(func, thisArg) {
- var visitedLayers = {};
- function visitLayer(layer, depth, isMask, isReplica) {
- if (visitedLayers[layer.layerId])
- return;
- visitedLayers[layer.layerId] = true;
- func.call(thisArg, layer, depth, isMask, isReplica);
- if (layer.children) {
- for (var i = 0; i < layer.children.length; i++)
- visitLayer(layer.children[i], depth + 1);
- }
- if (layer.maskLayer)
- visitLayer(layer.maskLayer, depth + 1, true, false);
- if (layer.replicaLayer)
- visitLayer(layer.replicaLayer, depth + 1, false, true);
- }
- if (this.rootLayer) {
- visitLayer(this.rootLayer, 0, false, false);
- } else {
- for (var i = 0; i < this.layers.length; i++)
- visitLayer(this.layers[i], 0, false, false);
- }
- },
- findLayerWithId: function(id) {
- var foundLayer = undefined;
- function visitLayer(layer) {
- if (layer.layerId == id)
- foundLayer = layer;
- }
- this.iterLayers(visitLayer);
- return foundLayer;
- }
- };
-
- ObjectSnapshot.register(
- LayerTreeImplSnapshot,
- {typeName: 'cc::LayerTreeImpl'});
-
- return {
- LayerTreeImplSnapshot: LayerTreeImplSnapshot
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/picture.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/picture.html
deleted file mode 100644
index 6cfca65b4b0..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/picture.html
+++ /dev/null
@@ -1,413 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/base/raf.html">
-<link rel="import" href="/tracing/base/rect.html">
-<link rel="import" href="/tracing/extras/chrome/cc/picture_as_image_data.html">
-<link rel="import" href="/tracing/extras/chrome/cc/util.html">
-<link rel="import" href="/tracing/model/object_instance.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.cc', function() {
- var ObjectSnapshot = tr.model.ObjectSnapshot;
-
- // Number of pictures created. Used as an uniqueId because we are immutable.
- var PictureCount = 0;
- var OPS_TIMING_ITERATIONS = 3;
-
- function Picture(skp64, layerRect) {
- this.skp64_ = skp64;
- this.layerRect_ = layerRect;
-
- this.guid_ = tr.b.GUID.allocateSimple();
- }
-
- Picture.prototype = {
- get canSave() {
- return true;
- },
-
- get layerRect() {
- return this.layerRect_;
- },
-
- get guid() {
- return this.guid_;
- },
-
- getBase64SkpData: function() {
- return this.skp64_;
- },
-
- getOps: function() {
- if (!PictureSnapshot.CanGetOps()) {
- console.error(PictureSnapshot.HowToEnablePictureDebugging());
- return undefined;
- }
-
- var ops = window.chrome.skiaBenchmarking.getOps({
- skp64: this.skp64_,
- params: {
- layer_rect: this.layerRect_.toArray()
- }
- });
-
- if (!ops)
- console.error('Failed to get picture ops.');
-
- return ops;
- },
-
- getOpTimings: function() {
- if (!PictureSnapshot.CanGetOpTimings()) {
- console.error(PictureSnapshot.HowToEnablePictureDebugging());
- return undefined;
- }
-
- var opTimings = window.chrome.skiaBenchmarking.getOpTimings({
- skp64: this.skp64_,
- params: {
- layer_rect: this.layerRect_.toArray()
- }
- });
-
- if (!opTimings)
- console.error('Failed to get picture op timings.');
-
- return opTimings;
- },
-
- /**
- * Tag each op with the time it takes to rasterize.
- *
- * FIXME: We should use real statistics to get better numbers here, see
- * https://code.google.com/p/trace-viewer/issues/detail?id=357
- *
- * @param {Array} ops Array of Skia operations.
- * @return {Array} Skia ops where op.cmd_time contains the associated time
- * for a given op.
- */
- tagOpsWithTimings: function(ops) {
- var opTimings = new Array();
- for (var iteration = 0; iteration < OPS_TIMING_ITERATIONS; iteration++) {
- opTimings[iteration] = this.getOpTimings();
- if (!opTimings[iteration] || !opTimings[iteration].cmd_times)
- return ops;
- if (opTimings[iteration].cmd_times.length != ops.length)
- return ops;
- }
-
- for (var opIndex = 0; opIndex < ops.length; opIndex++) {
- var min = Number.MAX_VALUE;
- for (var i = 0; i < OPS_TIMING_ITERATIONS; i++)
- min = Math.min(min, opTimings[i].cmd_times[opIndex]);
- ops[opIndex].cmd_time = min;
- }
-
- return ops;
- },
-
- /**
- * Rasterize the picture.
- *
- * @param {{opt_stopIndex: number, params}} The SkPicture operation to
- * rasterize up to. If not defined, the entire SkPicture is rasterized.
- * @param {{opt_showOverdraw: bool, params}} Defines whether pixel overdraw
- should be visualized in the image.
- * @param {function(tr.e.cc.PictureAsImageData)} The callback function that
- * is called after rasterization is complete or fails.
- */
- rasterize: function(params, rasterCompleteCallback) {
- if (!PictureSnapshot.CanRasterize() || !PictureSnapshot.CanGetOps()) {
- rasterCompleteCallback(new tr.e.cc.PictureAsImageData(
- this, tr.e.cc.PictureSnapshot.HowToEnablePictureDebugging()));
- return;
- }
-
- var raster = window.chrome.skiaBenchmarking.rasterize(
- {
- skp64: this.skp64_,
- params: {
- layer_rect: this.layerRect_.toArray()
- }
- },
- {
- stop: params.stopIndex === undefined ? -1 : params.stopIndex,
- overdraw: !!params.showOverdraw,
- params: { }
- });
-
- if (raster) {
- var canvas = document.createElement('canvas');
- var ctx = canvas.getContext('2d');
- canvas.width = raster.width;
- canvas.height = raster.height;
- var imageData = ctx.createImageData(raster.width, raster.height);
- imageData.data.set(new Uint8ClampedArray(raster.data));
- rasterCompleteCallback(new tr.e.cc.PictureAsImageData(this, imageData));
- } else {
- var error = 'Failed to rasterize picture. ' +
- 'Your recording may be from an old Chrome version. ' +
- 'The SkPicture format is not backward compatible.';
- rasterCompleteCallback(new tr.e.cc.PictureAsImageData(this, error));
- }
- }
- };
-
- function LayeredPicture(pictures) {
- this.guid_ = tr.b.GUID.allocateSimple();
- this.pictures_ = pictures;
- this.layerRect_ = undefined;
- }
-
- LayeredPicture.prototype = {
- __proto__: Picture.prototype,
-
- get canSave() {
- return false;
- },
-
- get typeName() {
- return 'cc::LayeredPicture';
- },
-
- get layerRect() {
- if (this.layerRect_ !== undefined)
- return this.layerRect_;
-
- this.layerRect_ = {
- x: 0,
- y: 0,
- width: 0,
- height: 0
- };
-
- for (var i = 0; i < this.pictures_.length; ++i) {
- var rect = this.pictures_[i].layerRect;
- this.layerRect_.x = Math.min(this.layerRect_.x, rect.x);
- this.layerRect_.y = Math.min(this.layerRect_.y, rect.y);
- this.layerRect_.width =
- Math.max(this.layerRect_.width, rect.x + rect.width);
- this.layerRect_.height =
- Math.max(this.layerRect_.height, rect.y + rect.height);
- }
- return this.layerRect_;
- },
-
- get guid() {
- return this.guid_;
- },
-
- getBase64SkpData: function() {
- throw new Error('Not available with a LayeredPicture.');
- },
-
- getOps: function() {
- var ops = [];
- for (var i = 0; i < this.pictures_.length; ++i)
- ops = ops.concat(this.pictures_[i].getOps());
- return ops;
- },
-
- getOpTimings: function() {
- var opTimings = this.pictures_[0].getOpTimings();
- for (var i = 1; i < this.pictures_.length; ++i) {
- var timings = this.pictures_[i].getOpTimings();
- opTimings.cmd_times = opTimings.cmd_times.concat(timings.cmd_times);
- opTimings.total_time += timings.total_time;
- }
- return opTimings;
- },
-
- tagOpsWithTimings: function(ops) {
- var opTimings = new Array();
- for (var iteration = 0; iteration < OPS_TIMING_ITERATIONS; iteration++) {
- opTimings[iteration] = this.getOpTimings();
- if (!opTimings[iteration] || !opTimings[iteration].cmd_times)
- return ops;
- }
-
- for (var opIndex = 0; opIndex < ops.length; opIndex++) {
- var min = Number.MAX_VALUE;
- for (var i = 0; i < OPS_TIMING_ITERATIONS; i++)
- min = Math.min(min, opTimings[i].cmd_times[opIndex]);
- ops[opIndex].cmd_time = min;
- }
- return ops;
- },
-
- rasterize: function(params, rasterCompleteCallback) {
- this.picturesAsImageData_ = [];
- var rasterCallback = function(pictureAsImageData) {
- this.picturesAsImageData_.push(pictureAsImageData);
- if (this.picturesAsImageData_.length !== this.pictures_.length)
- return;
-
- var canvas = document.createElement('canvas');
- var ctx = canvas.getContext('2d');
- canvas.width = this.layerRect.width;
- canvas.height = this.layerRect.height;
-
- // TODO(dsinclair): Verify these finish in the order started.
- // Do the rasterize calls run sync or asyn? As the imageData
- // going to be in the same order as the pictures_ list?
- for (var i = 0; i < this.picturesAsImageData_.length; ++i) {
- ctx.putImageData(this.picturesAsImageData_[i].imageData,
- this.pictures_[i].layerRect.x,
- this.pictures_[i].layerRect.y);
- }
- this.picturesAsImageData_ = [];
-
- rasterCompleteCallback(new tr.e.cc.PictureAsImageData(this,
- ctx.getImageData(this.layerRect.x, this.layerRect.y,
- this.layerRect.width, this.layerRect.height)));
- }.bind(this);
-
- for (var i = 0; i < this.pictures_.length; ++i)
- this.pictures_[i].rasterize(params, rasterCallback);
- }
- };
-
-
- /**
- * @constructor
- */
- function PictureSnapshot() {
- ObjectSnapshot.apply(this, arguments);
- }
-
- PictureSnapshot.HasSkiaBenchmarking = function() {
- return tr.isExported('chrome.skiaBenchmarking');
- };
-
- PictureSnapshot.CanRasterize = function() {
- if (!PictureSnapshot.HasSkiaBenchmarking())
- return false;
- if (!window.chrome.skiaBenchmarking.rasterize)
- return false;
- return true;
- };
-
- PictureSnapshot.CanGetOps = function() {
- if (!PictureSnapshot.HasSkiaBenchmarking())
- return false;
- if (!window.chrome.skiaBenchmarking.getOps)
- return false;
- return true;
- };
-
- PictureSnapshot.CanGetOpTimings = function() {
- if (!PictureSnapshot.HasSkiaBenchmarking())
- return false;
- if (!window.chrome.skiaBenchmarking.getOpTimings)
- return false;
- return true;
- };
-
- PictureSnapshot.CanGetInfo = function() {
- if (!PictureSnapshot.HasSkiaBenchmarking())
- return false;
- if (!window.chrome.skiaBenchmarking.getInfo)
- return false;
- return true;
- };
-
- PictureSnapshot.HowToEnablePictureDebugging = function() {
- if (tr.isHeadless)
- return 'Pictures only work in chrome';
-
- var usualReason = [
- 'For pictures to show up, you need to have Chrome running with ',
- '--enable-skia-benchmarking. Please restart chrome with this flag ',
- 'and try again.'
- ].join('');
-
- if (!tr.isExported('global.chrome.skiaBenchmarking'))
- return usualReason;
- if (!global.chrome.skiaBenchmarking.rasterize)
- return 'Your chrome is old';
- if (!global.chrome.skiaBenchmarking.getOps)
- return 'Your chrome is old: skiaBenchmarking.getOps not found';
- if (!global.chrome.skiaBenchmarking.getOpTimings)
- return 'Your chrome is old: skiaBenchmarking.getOpTimings not found';
- if (!global.chrome.skiaBenchmarking.getInfo)
- return 'Your chrome is old: skiaBenchmarking.getInfo not found';
- return 'Rasterizing is on';
- };
-
- PictureSnapshot.prototype = {
- __proto__: ObjectSnapshot.prototype,
-
- preInitialize: function() {
- tr.e.cc.preInitializeObject(this);
- this.rasterResult_ = undefined;
- },
-
- initialize: function() {
- // If we have an alias args, that means this picture was represented
- // by an alias, and the real args is in alias.args.
- if (this.args.alias)
- this.args = this.args.alias.args;
-
- if (!this.args.params.layerRect)
- throw new Error('Missing layer rect');
-
- this.layerRect_ = this.args.params.layerRect;
- this.picture_ = new Picture(this.args.skp64, this.args.params.layerRect);
- },
-
- set picture(picture) {
- this.picture_ = picture;
- },
-
- get canSave() {
- return this.picture_.canSave;
- },
-
- get layerRect() {
- return this.layerRect_ ? this.layerRect_ : this.picture_.layerRect;
- },
-
- get guid() {
- return this.picture_.guid;
- },
-
- getBase64SkpData: function() {
- return this.picture_.getBase64SkpData();
- },
-
- getOps: function() {
- return this.picture_.getOps();
- },
-
- getOpTimings: function() {
- return this.picture_.getOpTimings();
- },
-
- tagOpsWithTimings: function(ops) {
- return this.picture_.tagOpsWithTimings(ops);
- },
-
- rasterize: function(params, rasterCompleteCallback) {
- this.picture_.rasterize(params, rasterCompleteCallback);
- }
- };
-
- ObjectSnapshot.register(
- PictureSnapshot,
- {typeNames: ['cc::Picture']});
-
- return {
- PictureSnapshot: PictureSnapshot,
- Picture: Picture,
- LayeredPicture: LayeredPicture
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/picture_as_image_data.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/picture_as_image_data.html
deleted file mode 100644
index e0a5bc9f7fa..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/picture_as_image_data.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.e.cc', function() {
- /**
- * @constructor
- */
- function PictureAsImageData(picture, errorOrImageData) {
- this.picture_ = picture;
- if (errorOrImageData instanceof ImageData) {
- this.error_ = undefined;
- this.imageData_ = errorOrImageData;
- } else {
- this.error_ = errorOrImageData;
- this.imageData_ = undefined;
- }
- };
-
- /**
- * Creates a new pending PictureAsImageData (no image data and no error).
- *
- * @return {PictureAsImageData} a new pending PictureAsImageData.
- */
- PictureAsImageData.Pending = function(picture) {
- return new PictureAsImageData(picture, undefined);
- };
-
- PictureAsImageData.prototype = {
- get picture() {
- return this.picture_;
- },
-
- get error() {
- return this.error_;
- },
-
- get imageData() {
- return this.imageData_;
- },
-
- isPending: function() {
- return this.error_ === undefined && this.imageData_ === undefined;
- },
-
- asCanvas: function() {
- if (!this.imageData_)
- return;
-
- var canvas = document.createElement('canvas');
- var ctx = canvas.getContext('2d');
-
- canvas.width = this.imageData_.width;
- canvas.height = this.imageData_.height;
- ctx.putImageData(this.imageData_, 0, 0);
- return canvas;
- }
- };
-
- return {
- PictureAsImageData: PictureAsImageData
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/picture_test.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/picture_test.html
deleted file mode 100644
index 25fe0544923..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/picture_test.html
+++ /dev/null
@@ -1,49 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/cc/cc.html">
-<link rel="import" href="/tracing/extras/chrome/cc/picture.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script src="/tracing/extras/chrome/cc/layer_tree_host_impl_test_data.js">
-</script>
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('basic', function() {
- var m = tr.c.TestUtils.newModelWithEvents([g_catLTHIEvents]);
- var p = tr.b.dictionaryValues(m.processes)[0];
-
- var instance = p.objects.getAllInstancesNamed('cc::Picture')[0];
- var snapshot = instance.snapshots[0];
-
- assert.instanceOf(snapshot, tr.e.cc.PictureSnapshot);
- instance.wasDeleted(150);
- });
-
- test('getOps', function() {
- var m = tr.c.TestUtils.newModelWithEvents([g_catLTHIEvents]);
- var p = tr.b.dictionaryValues(m.processes)[0];
-
- var instance = p.objects.getAllInstancesNamed('cc::Picture')[0];
- var snapshot = instance.snapshots[0];
-
- var ops = snapshot.getOps();
- if (!ops)
- return;
- assert.equal(ops.length, 142);
-
- var op0 = ops[0];
- assert.equal(op0.cmd_string, 'Save');
- assert.instanceOf(op0.info, Array);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/raster_task.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/raster_task.html
deleted file mode 100644
index 30d0268d6f1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/raster_task.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/extras/chrome/cc/tile.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.cc', function() {
-
- var knownRasterTaskNames = [
- 'TileManager::RunRasterTask',
- 'RasterWorkerPoolTaskImpl::RunRasterOnThread',
- 'RasterWorkerPoolTaskImpl::Raster',
- 'RasterTaskImpl::Raster',
- 'cc::RasterTask',
- 'RasterTask'
- ];
-
- var knownAnalysisTaskNames = [
- 'TileManager::RunAnalyzeTask',
- 'RasterWorkerPoolTaskImpl::RunAnalysisOnThread',
- 'RasterWorkerPoolTaskImpl::Analyze',
- 'RasterTaskImpl::Analyze',
- 'cc::AnalyzeTask',
- 'AnalyzeTask'
- ];
-
- function getTileFromRasterTaskSlice(slice) {
- if (!(isSliceDoingRasterization(slice) || isSliceDoingAnalysis(slice)))
- return undefined;
-
- var tileData;
- if (slice.args.data)
- tileData = slice.args.data;
- else
- tileData = slice.args.tileData;
- if (tileData === undefined)
- return undefined;
- if (tileData.tile_id)
- return tileData.tile_id;
-
- var tile = tileData.tileId;
- if (!(tile instanceof tr.e.cc.TileSnapshot))
- return undefined;
- return tileData.tileId;
- }
-
- function isSliceDoingRasterization(slice) {
- if (knownRasterTaskNames.indexOf(slice.title) !== -1)
- return true;
- return false;
- }
-
- function isSliceDoingAnalysis(slice) {
- if (knownAnalysisTaskNames.indexOf(slice.title) !== -1)
- return true;
- return false;
- }
-
- return {
- getTileFromRasterTaskSlice: getTileFromRasterTaskSlice,
- isSliceDoingRasterization: isSliceDoingRasterization,
- isSliceDoingAnalysis: isSliceDoingAnalysis
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/region.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/region.html
deleted file mode 100644
index b023e80f5cc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/region.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/rect.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.e.cc', function() {
- /**
- * @constructor
- */
- function Region() {
- this.rects = [];
- }
-
- Region.fromArray = function(array) {
- if (array.length % 4 != 0)
- throw new Error('Array must consist be a multiple of 4 in length');
-
- var r = new Region();
- for (var i = 0; i < array.length; i += 4) {
- r.rects.push(tr.b.Rect.fromXYWH(array[i], array[i + 1],
- array[i + 2], array[i + 3]));
- }
- return r;
- }
-
- /**
- * @return {Region} If array is undefined, returns an empty region. Otherwise
- * returns Region.fromArray(array).
- */
- Region.fromArrayOrUndefined = function(array) {
- if (array === undefined)
- return new Region();
- return Region.fromArray(array);
- };
-
- Region.prototype = {
- __proto__: Region.prototype,
-
- rectIntersects: function(r) {
- for (var i = 0; i < this.rects.length; i++) {
- if (this.rects[i].intersects(r))
- return true;
- }
- return false;
- },
-
- addRect: function(r) {
- this.rects.push(r);
- }
- };
-
- return {
- Region: Region
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/render_pass.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/render_pass.html
deleted file mode 100644
index 48f1186525d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/render_pass.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/cc/util.html">
-<link rel="import" href="/tracing/base/rect.html">
-<link rel="import" href="/tracing/model/object_instance.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.cc', function() {
- var ObjectSnapshot = tr.model.ObjectSnapshot;
-
- /**
- * @constructor
- */
- function RenderPassSnapshot() {
- ObjectSnapshot.apply(this, arguments);
- }
-
- RenderPassSnapshot.prototype = {
- __proto__: ObjectSnapshot.prototype,
-
- preInitialize: function() {
- tr.e.cc.preInitializeObject(this);
- },
-
- initialize: function() {
- tr.e.cc.moveRequiredFieldsFromArgsToToplevel(
- this, ['quadList']);
- }
- };
-
- ObjectSnapshot.register(RenderPassSnapshot, {typeName: 'cc::RenderPass'});
-
- return {
- RenderPassSnapshot: RenderPassSnapshot
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/tile.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/tile.html
deleted file mode 100644
index 605c3ef968d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/tile.html
+++ /dev/null
@@ -1,88 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/cc/util.html">
-<link rel="import" href="/tracing/extras/chrome/cc/debug_colors.html">
-<link rel="import" href="/tracing/base/rect.html">
-<link rel="import" href="/tracing/model/object_instance.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.cc', function() {
- var ObjectSnapshot = tr.model.ObjectSnapshot;
-
- /**
- * @constructor
- */
- function TileSnapshot() {
- ObjectSnapshot.apply(this, arguments);
- }
-
- TileSnapshot.prototype = {
- __proto__: ObjectSnapshot.prototype,
-
- preInitialize: function() {
- tr.e.cc.preInitializeObject(this);
- },
-
- initialize: function() {
- tr.e.cc.moveOptionalFieldsFromArgsToToplevel(
- this, ['layerId', 'contentsScale', 'contentRect']);
- if (this.args.managedState) {
- this.resolution = this.args.managedState.resolution;
- this.isSolidColor = this.args.managedState.isSolidColor;
- this.isUsingGpuMemory = this.args.managedState.isUsingGpuMemory;
- this.hasResource = this.args.managedState.hasResource;
- this.scheduledPriority = this.args.scheduledPriority;
- this.gpuMemoryUsageInBytes = this.args.gpuMemoryUsage;
- } else {
- this.resolution = this.args.resolution;
- this.isSolidColor = this.args.drawInfo.isSolidColor;
- this.isUsingGpuMemory = this.args.isUsingGpuMemory;
- this.hasResource = this.args.hasResource;
- this.scheduledPriority = this.args.scheduledPriority;
- this.gpuMemoryUsageInBytes = this.args.gpuMemoryUsage;
- }
-
- // This check is for backward compatability. It can probably
- // be removed once we're confident that most traces contain
- // content_rect.
- if (this.contentRect)
- this.layerRect = this.contentRect.scale(1.0 / this.contentsScale);
-
- if (this.isSolidColor)
- this.type_ = tr.e.cc.tileTypes.solidColor;
- else if (!this.hasResource)
- this.type_ = tr.e.cc.tileTypes.missing;
- else if (this.resolution === 'HIGH_RESOLUTION')
- this.type_ = tr.e.cc.tileTypes.highRes;
- else if (this.resolution === 'LOW_RESOLUTION')
- this.type_ = tr.e.cc.tileTypes.lowRes;
- else
- this.type_ = tr.e.cc.tileTypes.unknown;
- },
-
- getTypeForLayer: function(layer) {
- var type = this.type_;
- if (type == tr.e.cc.tileTypes.unknown) {
- if (this.contentsScale < layer.idealContentsScale)
- type = tr.e.cc.tileTypes.extraLowRes;
- else if (this.contentsScale > layer.idealContentsScale)
- type = tr.e.cc.tileTypes.extraHighRes;
- }
- return type;
- }
- };
-
- ObjectSnapshot.register(TileSnapshot, {typeName: 'cc::Tile'});
-
- return {
- TileSnapshot: TileSnapshot
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/tile_coverage_rect.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/tile_coverage_rect.html
deleted file mode 100644
index 5479593784b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/tile_coverage_rect.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-
-'use strict';
-
-tr.exportTo('tr.e.cc', function() {
- /**
- * This class represents a tile (from impl side) and its final rect on the
- * layer. Note that the rect is determined by what is needed to cover all
- * of the layer without overlap.
- * @constructor
- */
- function TileCoverageRect(rect, tile) {
- this.geometryRect = rect;
- this.tile = tile;
- }
-
- return {
- TileCoverageRect: TileCoverageRect
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/tile_test.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/tile_test.html
deleted file mode 100644
index c29971382e9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/tile_test.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/cc/tile.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script src="/tracing/extras/chrome/cc/layer_tree_host_impl_test_data.js">
-</script>
-
-<script>
-
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('basic', function() {
- var m = tr.c.TestUtils.newModelWithEvents([g_catLTHIEvents]);
- var p = tr.b.dictionaryValues(m.processes)[0];
- var instance = p.objects.getAllInstancesNamed('cc::Tile')[0];
- var snapshot = instance.snapshots[0];
-
- assert.instanceOf(snapshot, tr.e.cc.TileSnapshot);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/util.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/util.html
deleted file mode 100644
index f12c4b8f3fd..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/util.html
+++ /dev/null
@@ -1,153 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/quad.html">
-<link rel="import" href="/tracing/base/rect.html">
-<link rel="import" href="/tracing/model/object_instance.html">
-<script>
-
-'use strict';
-
-tr.exportTo('tr.e.cc', function() {
- var convertedNameCache = {};
- function convertNameToJSConvention(name) {
- if (name in convertedNameCache)
- return convertedNameCache[name];
-
- if (name[0] == '_' ||
- name[name.length - 1] == '_') {
- convertedNameCache[name] = name;
- return name;
- }
-
- var words = name.split('_');
- if (words.length == 1) {
- convertedNameCache[name] = words[0];
- return words[0];
- }
-
- for (var i = 1; i < words.length; i++)
- words[i] = words[i][0].toUpperCase() + words[i].substring(1);
-
- convertedNameCache[name] = words.join('');
- return convertedNameCache[name];
- }
-
- function convertObjectFieldNamesToJSConventions(object) {
- tr.b.iterObjectFieldsRecursively(
- object,
- function(object, fieldName, fieldValue) {
- delete object[fieldName];
- object[newFieldName] = fieldValue;
- return newFieldName;
- });
- }
-
- function convertQuadSuffixedTypesToQuads(object) {
- tr.b.iterObjectFieldsRecursively(
- object,
- function(object, fieldName, fieldValue) {
- });
- }
-
- function convertObject(object) {
- convertObjectFieldNamesToJSConventions(object);
- convertQuadSuffixedTypesToQuads(object);
- }
-
- function moveRequiredFieldsFromArgsToToplevel(object, fields) {
- for (var i = 0; i < fields.length; i++) {
- var key = fields[i];
- if (object.args[key] === undefined)
- throw Error('Expected field ' + key + ' not found in args');
- if (object[key] !== undefined)
- throw Error('Field ' + key + ' already in object');
- object[key] = object.args[key];
- delete object.args[key];
- }
- }
-
- function moveOptionalFieldsFromArgsToToplevel(object, fields) {
- for (var i = 0; i < fields.length; i++) {
- var key = fields[i];
- if (object.args[key] === undefined)
- continue;
- if (object[key] !== undefined)
- throw Error('Field ' + key + ' already in object');
- object[key] = object.args[key];
- delete object.args[key];
- }
- }
-
- function preInitializeObject(object) {
- preInitializeObjectInner(object.args, false);
- }
-
- function preInitializeObjectInner(object, hasRecursed) {
- if (!(object instanceof Object))
- return;
-
- if (object instanceof Array) {
- for (var i = 0; i < object.length; i++)
- preInitializeObjectInner(object[i], true);
- return;
- }
-
- if (hasRecursed &&
- (object instanceof tr.model.ObjectSnapshot ||
- object instanceof tr.model.ObjectInstance))
- return;
-
- for (var key in object) {
- var newKey = convertNameToJSConvention(key);
- if (newKey != key) {
- var value = object[key];
- delete object[key];
- object[newKey] = value;
- key = newKey;
- }
-
- // Convert objects with keys ending with Quad to tr.b.Quad type.
- if (/Quad$/.test(key) && !(object[key] instanceof tr.b.Quad)) {
- var q;
- try {
- q = tr.b.Quad.from8Array(object[key]);
- } catch (e) {
- console.log(e);
- }
- object[key] = q;
- continue;
- }
-
- // Convert objects with keys ending with Rect to tr.b.Rect type.
- if (/Rect$/.test(key) && !(object[key] instanceof tr.b.Rect)) {
- var r;
- try {
- r = tr.b.Rect.fromArray(object[key]);
- } catch (e) {
- console.log(e);
- }
- object[key] = r;
- }
-
- preInitializeObjectInner(object[key], true);
- }
- }
-
- function bytesToRoundedMegabytes(bytes) {
- return Math.round(bytes / 100000.0) / 10.0;
- }
-
- return {
- preInitializeObject: preInitializeObject,
- convertNameToJSConvention: convertNameToJSConvention,
- moveRequiredFieldsFromArgsToToplevel: moveRequiredFieldsFromArgsToToplevel,
- moveOptionalFieldsFromArgsToToplevel: moveOptionalFieldsFromArgsToToplevel,
- bytesToRoundedMegabytes: bytesToRoundedMegabytes
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/util_test.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/util_test.html
deleted file mode 100644
index b29fd6a57a7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/cc/util_test.html
+++ /dev/null
@@ -1,114 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/cc/util.html">
-<link rel="import" href="/tracing/base/quad.html">
-<link rel="import" href="/tracing/base/rect.html">
-
-<script>
-
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('nameConvert', function() {
- assert.equal(tr.e.cc.convertNameToJSConvention('_foo'), '_foo');
- assert.equal(tr.e.cc.convertNameToJSConvention('foo_'), 'foo_');
- assert.equal(tr.e.cc.convertNameToJSConvention('foo'), 'foo');
- assert.equal(tr.e.cc.convertNameToJSConvention('foo_bar'), 'fooBar');
- assert.equal(tr.e.cc.convertNameToJSConvention('foo_bar_baz'),
- 'fooBarBaz');
- });
-
- test('objectConvertNested', function() {
- var object = {
- un_disturbed: true,
- args: {
- foo_bar: {
- a_field: 7
- }
- }
- };
- var expected = {
- un_disturbed: true,
- args: {
- fooBar: {
- aField: 7
- }
- }
- };
- tr.e.cc.preInitializeObject(object);
- assert.deepEqual(object, expected);
- });
-
- test('arrayConvert', function() {
- var object = {
- un_disturbed: true,
- args: [
- {foo_bar: 7},
- {foo_bar: 8}
- ]
- };
- var expected = {
- un_disturbed: true,
- args: [
- {fooBar: 7},
- {fooBar: 8}
- ]
- };
- tr.e.cc.preInitializeObject(object);
- assert.deepEqual(object, expected);
- });
-
- test('quadCoversion', function() {
- var object = {
- args: {
- some_quad: [1, 2, 3, 4, 5, 6, 7, 8]
- }
- };
- tr.e.cc.preInitializeObject(object);
- assert.instanceOf(object.args.someQuad, tr.b.Quad);
- });
-
- test('quadConversionNested', function() {
- var object = {
- args: {
- nested_field: {
- a_quad: [1, 2, 3, 4, 5, 6, 7, 8]
- },
- non_nested_quad: [1, 2, 3, 4, 5, 6, 7, 8]
- }
- };
- tr.e.cc.preInitializeObject(object);
- assert.instanceOf(object.args.nestedField.aQuad, tr.b.Quad);
- assert.instanceOf(object.args.nonNestedQuad, tr.b.Quad);
- });
-
- test('rectCoversion', function() {
- var object = {
- args: {
- some_rect: [1, 2, 3, 4]
- }
- };
- tr.e.cc.preInitializeObject(object);
- assert.instanceOf(object.args.someRect, tr.b.Rect);
- });
-
- test('rectCoversionNested', function() {
- var object = {
- args: {
- nested_field: {
- a_rect: [1, 2, 3, 4]
- },
- non_nested_rect: [1, 2, 3, 4]
- }
- };
- tr.e.cc.preInitializeObject(object);
- assert.instanceOf(object.args.nestedField.aRect, tr.b.Rect);
- assert.instanceOf(object.args.nonNestedRect, tr.b.Rect);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_auditor.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_auditor.html
deleted file mode 100644
index 9be58a54a0c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_auditor.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/range_utils.html">
-<link rel="import" href="/tracing/core/auditor.html">
-<link rel="import"
- href="/tracing/extras/chrome/cc/input_latency_async_slice.html">
-<link rel="import"
- href="/tracing/extras/chrome/chrome_user_friendly_category_driver.html">
-<link rel="import" href="/tracing/model/constants.html">
-<link rel="import" href="/tracing/model/event_info.html">
-<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Base class for trace data Auditors.
- */
-tr.exportTo('tr.e.audits', function() {
- var Auditor = tr.c.Auditor;
-
- /**
- * Auditor for Chrome-specific traces.
- * @constructor
- */
- function ChromeAuditor(model) {
- Auditor.call(this, model);
-
- var modelHelper = this.model.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- if (modelHelper && modelHelper.browserHelper) {
- // Must be a browserHelper in order to do audits.
- this.modelHelper = modelHelper;
- } else {
- this.modelHelper = undefined;
- }
- };
-
- ChromeAuditor.prototype = {
- __proto__: Auditor.prototype,
-
- runAnnotate: function() {
- if (!this.modelHelper)
- return;
-
- for (var pid in this.modelHelper.rendererHelpers) {
- var rendererHelper = this.modelHelper.rendererHelpers[pid];
-
- if (rendererHelper.isChromeTracingUI)
- rendererHelper.process.important = false;
- }
- },
-
- /**
- * Called by import to install userFriendlyCategoryDriver.
- */
- installUserFriendlyCategoryDriverIfNeeded: function() {
- this.model.addUserFriendlyCategoryDriver(
- tr.e.chrome.ChromeUserFriendlyCategoryDriver);
- },
-
- runAudit: function() {
- if (!this.modelHelper)
- return;
-
- this.model.replacePIDRefsInPatchups(
- tr.model.BROWSER_PROCESS_PID_REF,
- this.modelHelper.browserProcess.pid);
- this.model.applyObjectRefPatchups();
- }
- };
-
- Auditor.register(ChromeAuditor);
-
- return {
- ChromeAuditor: ChromeAuditor
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_auditor_test.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_auditor_test.html
deleted file mode 100644
index 9537629a767..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_auditor_test.html
+++ /dev/null
@@ -1,129 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/chrome_auditor.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/scoped_id.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ColorScheme = tr.b.ColorScheme;
-
- function createMainProcesses(m) {
- m.browserProcess = m.getOrCreateProcess(1);
- m.browserMain = m.browserProcess.getOrCreateThread(2);
- m.browserMain.name = 'CrBrowserMain';
-
- m.renderer1 = m.getOrCreateProcess(3);
- m.renderer1Main = m.renderer1.getOrCreateThread(4);
- m.renderer1Main.name = 'CrRendererMain';
-
- m.renderer1Compositor = m.renderer1.getOrCreateThread(4);
- m.renderer1Compositor.name = 'Compositor';
- }
-
- function newInputLatencyEvent(tsStart, tsEnd, opt_args) {
- var e = new tr.model.AsyncSlice(
- 'benchmark', 'InputLatency',
- ColorScheme.getColorIdForGeneralPurposeString('InputLatency'),
- tsStart, opt_args);
- e.duration = tsEnd - tsStart;
- return e;
- }
-
- function newImplRenderingStatsEvent(ts, opt_args) {
- var e = new tr.model.ThreadSlice(
- 'benchmark', 'BenchmarkInstrumentation::ImplThreadRenderingStats',
- ColorScheme.getColorIdForGeneralPurposeString('x'),
- ts, opt_args, 0);
- return e;
- }
-
- test('simple', function() {
- tr.c.TestUtils.newModelWithAuditor(function(m) {
- createMainProcesses(m);
- var bAsyncSlices = m.browserMain.asyncSliceGroup;
- bAsyncSlices.push(newInputLatencyEvent(100, 130));
- bAsyncSlices.push(newInputLatencyEvent(116, 150));
- bAsyncSlices.push(newInputLatencyEvent(133, 166));
- bAsyncSlices.push(newInputLatencyEvent(150, 183));
- bAsyncSlices.push(newInputLatencyEvent(166, 200));
- bAsyncSlices.push(newInputLatencyEvent(183, 216));
-
- var rm1Slices = m.renderer1Compositor.sliceGroup;
- rm1Slices.pushSlice(newImplRenderingStatsEvent(113));
- rm1Slices.pushSlice(newImplRenderingStatsEvent(130));
- rm1Slices.pushSlice(newImplRenderingStatsEvent(147));
- rm1Slices.pushSlice(newImplRenderingStatsEvent(163));
- rm1Slices.pushSlice(newImplRenderingStatsEvent(180));
- rm1Slices.pushSlice(newImplRenderingStatsEvent(197));
- rm1Slices.pushSlice(newImplRenderingStatsEvent(213));
- rm1Slices.pushSlice(newImplRenderingStatsEvent(230));
- rm1Slices.pushSlice(newImplRenderingStatsEvent(247));
- }, tr.e.audits.ChromeAuditor);
- });
-
- test('refsToBrowser', function() {
- var events = [
- // An object created and snapshotted in the browser process.
- {ts: 1000, pid: 1, tid: 2, ph: 'N', cat: 'c', id: '0x1000', name: 'a',
- args: {}},
- {ts: 1100, pid: 1, tid: 2, ph: 'O', cat: 'c', id: '0x1000', name: 'a',
- args: {snapshot: {foo: 12345}}},
- {ts: 1300, pid: 1, tid: 2, ph: 'D', cat: 'c', id: '0x1000', name: 'a',
- args: {}},
-
- // A reference to the object in the browser from the renderer process.
- {ts: 1200, pid: 3, tid: 4, ph: 'X', cat: 'c', name: 'b', dur: 100,
- args: {bar: {pid_ref: -1, id_ref: '0x1000'}}}
- ];
-
- var m = tr.c.TestUtils.newModelWithEvents([events], {
- shiftWorldToZero: false,
- pruneEmptyContainers: false,
- customizeModelCallback: createMainProcesses,
- auditorConstructors: [tr.e.audits.ChromeAuditor]
- });
-
- var browserObject = m.browserProcess.objects.getObjectInstanceAt(
- new tr.model.ScopedId('ptr', '0x1000'), 1.2);
- assert.isDefined(browserObject);
- var foo = browserObject.getSnapshotAt(1.2);
- assert.isDefined(foo);
-
- assert.equal(m.renderer1Main.sliceGroup.slices.length, 1);
- var slice = m.renderer1Main.sliceGroup.slices[0];
- assert.equal(slice.title, 'b');
- assert.equal(slice.args.bar, foo);
- });
-
- test('filterTracingUI', function() {
- var m = tr.c.TestUtils.newModelWithAuditor(function(m) {
- m.browserProcess = m.getOrCreateProcess(1);
- m.browserMain = m.browserProcess.getOrCreateThread(2);
- m.browserMain.name = 'CrBrowserMain';
-
- m.renderer1 = m.getOrCreateProcess(3);
- m.renderer1.labels = ['https://google.com'];
- m.renderer1Main = m.renderer1.getOrCreateThread(4);
- m.renderer1Main.name = 'CrRendererMain';
-
- m.renderer2 = m.getOrCreateProcess(5);
- m.renderer2.labels = ['chrome://tracing'];
- m.renderer2Main = m.renderer2.getOrCreateThread(6);
- m.renderer2Main.name = 'CrRendererMain';
- }, tr.e.audits.ChromeAuditor);
-
- assert.isTrue(m.renderer1.important);
- assert.isFalse(m.renderer2.important);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_test_utils.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_test_utils.html
deleted file mode 100644
index 5ff273daa34..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_test_utils.html
+++ /dev/null
@@ -1,161 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Base class for trace data Auditors.
- */
-tr.exportTo('tr.e.chrome', function() {
- function ChromeTestUtils() {
- }
-
- ChromeTestUtils.newChromeModel = function(customizeModelCallback) {
- return tr.c.TestUtils.newModel(function(model) {
- model.browserProcess = model.getOrCreateProcess(1);
- model.browserMain = model.browserProcess.getOrCreateThread(2);
- model.browserMain.name = 'CrBrowserMain';
-
- model.rendererProcess = model.getOrCreateProcess(2);
- model.rendererMain = model.rendererProcess.getOrCreateThread(3);
- model.rendererMain.name = 'CrRendererMain';
-
- model.rendererCompositor = model.rendererProcess.getOrCreateThread(4);
- model.rendererCompositor.name = 'Compositor';
-
- model.rasterWorker1 = model.rendererProcess.getOrCreateThread(5);
- model.rasterWorker1.name = 'CompositorTileWorker1';
-
- customizeModelCallback(model);
- });
- };
-
- ChromeTestUtils.addEvent = function(thread, dict) {
- var slice = tr.c.TestUtils.newAsyncSliceEx(dict);
- thread.asyncSliceGroup.push(slice);
- return slice;
- };
-
- ChromeTestUtils.addNavigationStartEvent = function(model, dict) {
- dict.title = 'NavigationTiming navigationStart';
- var event = tr.c.TestUtils.newInstantEvent(dict);
- model.instantEvents.push(event);
- return event;
- };
-
- ChromeTestUtils.addFirstContentfulPaintEvent = function(model, dict) {
- dict.title = 'firstContentfulPaint';
- var event = tr.c.TestUtils.newInstantEvent(dict);
- model.instantEvents.push(event);
- return event;
- };
-
- ChromeTestUtils.addInputEvent = function(model, typeName, dict) {
- dict.title = 'InputLatency::' + typeName;
- dict.isTopLevel = (dict.isTopLevel === undefined);
- dict.startThread = model.browserMain;
- var slice = tr.c.TestUtils.newAsyncSliceEx(dict);
- model.browserMain.asyncSliceGroup.push(slice);
- return slice;
- };
-
- ChromeTestUtils.addFlingAnimationEvent = function(model, dict) {
- dict.title = 'InputHandlerProxy::HandleGestureFling::started';
- var slice = tr.c.TestUtils.newAsyncSliceEx(dict);
- model.rendererCompositor.asyncSliceGroup.push(slice);
- return slice;
- };
-
- ChromeTestUtils.addRenderingEvent = function(model, dict) {
- dict.title = dict.title || 'DummyEvent';
- dict.type = tr.model.ThreadSlice;
- var slice = tr.c.TestUtils.newSliceEx(dict);
- model.rendererMain.sliceGroup.pushSlice(slice);
- return slice;
- };
-
- ChromeTestUtils.addFrameEvent = function(model, dict) {
- dict.title = tr.model.helpers.IMPL_RENDERING_STATS;
- dict.type = tr.model.ThreadSlice;
- var slice = tr.c.TestUtils.newSliceEx(dict);
- model.rendererMain.asyncSliceGroup.push(slice);
- return slice;
- };
-
- ChromeTestUtils.addLoadingEvent = function(model, dict) {
- dict.title = 'WebContentsImpl Loading';
- var slice = tr.c.TestUtils.newAsyncSliceEx(dict);
- model.rendererMain.asyncSliceGroup.push(slice);
- return slice;
- };
-
- ChromeTestUtils.addNetworkEvent = function(model, dict) {
- dict.cat = 'netlog';
- dict.title = 'Generic Network event';
- var slice = tr.c.TestUtils.newAsyncSliceEx(dict);
- model.browserMain.asyncSliceGroup.push(slice);
- return slice;
- };
-
- ChromeTestUtils.addCommitLoadEvent = function(model, dict) {
- dict.title = 'RenderFrameImpl::didCommitProvisionalLoad';
- var slice = tr.c.TestUtils.newAsyncSliceEx(dict);
- model.rendererMain.sliceGroup.pushSlice(slice);
- return slice;
- };
-
- ChromeTestUtils.addCreateChildFrameEvent = function(model, dict) {
- dict.title = 'RenderFrameImpl::createChildFrame';
- var slice = tr.c.TestUtils.newAsyncSliceEx(dict);
- model.rendererMain.sliceGroup.pushSlice(slice);
- return slice;
- };
-
- ChromeTestUtils.addStartProvisionalLoadEvent = function(model, dict) {
- dict.title = 'RenderFrameImpl::didStartProvisionalLoad';
- var slice = tr.c.TestUtils.newAsyncSliceEx(dict);
- model.rendererMain.sliceGroup.pushSlice(slice);
- return slice;
- };
-
- ChromeTestUtils.addFailProvisionalLoadEvent = function(model, dict) {
- dict.title = 'RenderFrameImpl::didFailProvisionalLoad';
- var slice = tr.c.TestUtils.newAsyncSliceEx(dict);
- model.rendererMain.sliceGroup.pushSlice(slice);
- return slice;
- };
-
- ChromeTestUtils.addFinishLoadEvent = function(model, dict) {
- dict.title = 'RenderFrameImpl::didFinishLoad';
- var slice = tr.c.TestUtils.newSliceEx(dict);
- model.rendererMain.sliceGroup.pushSlice(slice);
- return slice;
- };
-
- ChromeTestUtils.addLoadFinishedEvent = function(model, dict) {
- dict.title = 'LoadFinished';
- var slice = tr.c.TestUtils.newSliceEx(dict);
- model.rendererMain.sliceGroup.pushSlice(slice);
- return slice;
- };
-
- ChromeTestUtils.addCreateThreadsEvent = function(model, dict) {
- dict.title = 'BrowserMainLoop::CreateThreads';
- var slice = tr.c.TestUtils.newSliceEx(dict);
- model.rendererMain.sliceGroup.pushSlice(slice);
- return slice;
- };
-
- return {
- ChromeTestUtils: ChromeTestUtils
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_user_friendly_category_driver.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_user_friendly_category_driver.html
deleted file mode 100644
index 800f92c7158..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_user_friendly_category_driver.html
+++ /dev/null
@@ -1,208 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.chrome', function() {
- var SAME_AS_PARENT = 'same-as-parent';
-
- var TITLES_FOR_USER_FRIENDLY_CATEGORY = {
- composite: [
- 'CompositingInputsUpdater::update',
- 'ThreadProxy::SetNeedsUpdateLayers',
- 'LayerTreeHost::UpdateLayers::CalcDrawProps',
- 'UpdateLayerTree'
- ],
-
- gc: [
- 'minorGC',
- 'majorGC',
- 'MajorGC',
- 'MinorGC',
- 'V8.GCScavenger',
- 'V8.GCIncrementalMarking',
- 'V8.GCIdleNotification',
- 'V8.GCContext',
- 'V8.GCCompactor',
- 'V8GCController::traceDOMWrappers'
- ],
-
- iframe_creation: [
- 'WebLocalFrameImpl::createChildframe'
- ],
-
- imageDecode: [
- 'Decode Image',
- 'ImageFrameGenerator::decode',
- 'ImageFrameGenerator::decodeAndScale'
- ],
-
- input: [
- 'HitTest',
- 'ScrollableArea::scrollPositionChanged',
- 'EventHandler::handleMouseMoveEvent'
- ],
-
- layout: [
- 'FrameView::invalidateTree',
- 'FrameView::layout',
- 'FrameView::performLayout',
- 'FrameView::performPostLayoutTasks',
- 'FrameView::performPreLayoutTasks',
- 'Layer::updateLayerPositionsAfterLayout',
- 'Layout',
- 'LayoutView::hitTest',
- 'ResourceLoadPriorityOptimizer::updateAllImageResourcePriorities',
- 'WebViewImpl::layout'
- ],
-
- parseHTML: [
- 'ParseHTML',
- 'HTMLDocumentParser::didReceiveParsedChunkFromBackgroundParser',
- 'HTMLDocumentParser::processParsedChunkFromBackgroundParser'
- ],
-
- raster: [
- 'DisplayListRasterSource::PerformSolidColorAnalysis',
- 'Picture::Raster',
- 'RasterBufferImpl::Playback',
- 'RasterTask',
- 'RasterizerTaskImpl::RunOnWorkerThread',
- 'SkCanvas::drawImageRect()',
- 'SkCanvas::drawPicture()',
- 'SkCanvas::drawTextBlob()',
- 'TileTaskWorkerPool::PlaybackToMemory'
- ],
-
- record: [
- 'ContentLayerDelegate::paintContents',
- 'DeprecatedPaintLayerCompositor::updateIfNeededRecursive',
- 'DeprecatedPaintLayerCompositor::updateLayerPositionsAfterLayout',
- 'Paint',
- 'Picture::Record',
- 'PictureLayer::Update',
- 'RenderLayer::updateLayerPositionsAfterLayout'
- ],
-
- script: [
- 'EvaluateScript',
- 'FunctionCall',
- 'ScheduledAction::execute',
- 'Script',
- 'V8.Execute',
- 'v8.run',
- 'v8.callModuleMethod',
- 'v8.callFunction',
- 'WindowProxy::initialize'
- ],
-
- style: [
- 'CSSParserImpl::parseStyleSheet.parse',
- 'CSSParserImpl::parseStyleSheet.tokenize',
- 'Document::updateStyle',
- 'Document::updateStyleInvalidationIfNeeded',
- 'ParseAuthorStyleSheet',
- 'RuleSet::addRulesFromSheet',
- 'StyleElement::processStyleSheet',
- 'StyleEngine::createResolver',
- 'StyleSheetContents::parseAuthorStyleSheet',
- 'UpdateLayoutTree'
- ],
-
- script_parse_and_compile: [
- 'V8.RecompileSynchronous',
- 'V8.RecompileConcurrent',
- 'V8.PreParseMicroSeconds',
- 'v8.parseOnBackground',
- 'V8.ParseMicroSeconds',
- 'V8.ParseLazyMicroSeconds',
- 'V8.CompileScriptMicroSeconds',
- 'V8.CompileMicroSeconds',
- 'V8.CompileFullCode',
- 'V8.CompileEvalMicroSeconds',
- 'v8.compile'
- ],
-
- script_parse: [
- 'V8Test.ParseScript',
- 'V8Test.ParseFunction',
- ],
-
- script_compile: [
- 'V8Test.Compile',
- 'V8Test.CompileFullCode',
- ],
-
- resource_loading: [
- 'ResourceFetcher::requestResource',
- 'ResourceDispatcher::OnReceivedData',
- 'ResourceDispatcher::OnRequestComplete',
- 'ResourceDispatcher::OnReceivedResponse',
- 'Resource::appendData'
- ],
-
- // Where do these go?
- renderer_misc: [
- 'DecodeFont',
- 'ThreadState::completeSweep' // blink_gc
- ],
-
- [SAME_AS_PARENT]: [
- 'SyncChannel::Send'
- ]
- };
-
- var USER_FRIENDLY_CATEGORY_FOR_TITLE = {};
-
- for (var category in TITLES_FOR_USER_FRIENDLY_CATEGORY) {
- TITLES_FOR_USER_FRIENDLY_CATEGORY[category].forEach(function(title) {
- USER_FRIENDLY_CATEGORY_FOR_TITLE[title] = category;
- });
- }
-
- var USER_FRIENDLY_CATEGORY_FOR_EVENT_CATEGORY = {
- netlog: 'net',
- overhead: 'overhead',
- startup: 'startup',
- gpu: 'gpu'
- };
-
- function ChromeUserFriendlyCategoryDriver() {
- }
-
- ChromeUserFriendlyCategoryDriver.fromEvent = function(event) {
- var userFriendlyCategory = USER_FRIENDLY_CATEGORY_FOR_TITLE[event.title];
- if (userFriendlyCategory) {
- if (userFriendlyCategory == SAME_AS_PARENT) {
- if (event.parentSlice)
- return ChromeUserFriendlyCategoryDriver.fromEvent(event.parentSlice);
- } else {
- return userFriendlyCategory;
- }
- }
-
- var eventCategoryParts = tr.b.getCategoryParts(event.category);
- for (var i = 0; i < eventCategoryParts.length; ++i) {
- var eventCategory = eventCategoryParts[i];
- userFriendlyCategory = USER_FRIENDLY_CATEGORY_FOR_EVENT_CATEGORY[
- eventCategory];
- if (userFriendlyCategory)
- return userFriendlyCategory;
- }
-
- return undefined;
- };
-
- return {
- ChromeUserFriendlyCategoryDriver: ChromeUserFriendlyCategoryDriver
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_user_friendly_category_driver_test.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_user_friendly_category_driver_test.html
deleted file mode 100644
index fadf09a6bca..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/chrome_user_friendly_category_driver_test.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import"
- href="/tracing/extras/chrome/chrome_user_friendly_category_driver.html">
-<link rel="import" href="/tracing/model/event_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ufcFromEvent = tr.e.chrome.ChromeUserFriendlyCategoryDriver.fromEvent;
-
- test('userFriendlyCategory', function() {
- assert.equal(ufcFromEvent({
- guid: tr.b.GUID.allocateSimple(),
- title: 'FrameView::layout',
- category: 'cat'
- }), 'layout');
-
- assert.equal(ufcFromEvent({
- guid: tr.b.GUID.allocateSimple(),
- title: 'Script',
- category: 'cat'
- }), 'script');
-
- assert.equal(ufcFromEvent({
- guid: tr.b.GUID.allocateSimple(),
- title: 'Paint',
- category: 'cat'
- }), 'record');
- assert.equal(ufcFromEvent({
- guid: tr.b.GUID.allocateSimple(),
- title: 'Document::updateStyle',
- category: 'cat'
- }), 'style');
- assert.equal(ufcFromEvent({
- guid: tr.b.GUID.allocateSimple(),
- title: 'HTMLDocumentParser::didReceiveParsedChunkFromBackgroundParser',
- category: 'cat'
- }), 'parseHTML');
- });
-
- test('ufcFromTraceCategory', function() {
- assert.equal(ufcFromEvent({
- guid: tr.b.GUID.allocateSimple(),
- title: 'a',
- category: 'netlog'
- }), 'net');
-
- assert.equal(ufcFromEvent({
- guid: tr.b.GUID.allocateSimple(),
- title: 'a',
- category: 'foobar,overhead'
- }), 'overhead');
-
- assert.equal(ufcFromEvent({
- guid: tr.b.GUID.allocateSimple(),
- title: 'a',
- category: 'startup'
- }), 'startup');
- });
-
- test('ufcUndefined', function() {
- assert.isUndefined(ufcFromEvent({
- guid: tr.b.GUID.allocateSimple(),
- title: 'a',
- category: 'other'
- }));
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/gpu_async_slice.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/gpu_async_slice.html
deleted file mode 100644
index 13c4fbece2a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/gpu_async_slice.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/model/async_slice.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.gpu', function() {
- var AsyncSlice = tr.model.AsyncSlice;
-
- function GpuAsyncSlice() {
- AsyncSlice.apply(this, arguments);
- }
-
- GpuAsyncSlice.prototype = {
- __proto__: AsyncSlice.prototype,
-
- get viewSubGroupTitle() {
- if (this.args.channel) {
- if (this.category == 'disabled-by-default-gpu.device')
- return 'Device.' + this.args.channel;
- else
- return 'Service.' + this.args.channel;
- }
- return this.title;
- }
- };
-
- AsyncSlice.register(
- GpuAsyncSlice,
- {
- categoryParts: ['disabled-by-default-gpu.device',
- 'disabled-by-default-gpu.service']
- });
-
- return {
- GpuAsyncSlice: GpuAsyncSlice
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/gpu_async_slice_test.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/gpu_async_slice_test.html
deleted file mode 100644
index 24bd98cc8c6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/gpu_async_slice_test.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/gpu/gpu_async_slice.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var AsyncSlice = tr.model.AsyncSlice;
- var GpuAsyncSlice = tr.e.gpu.GpuAsyncSlice;
-
- test('construct', function() {
- assert.equal(AsyncSlice.getConstructor('disabled-by-default-gpu.device',
- 'gpu1'),
- GpuAsyncSlice);
- assert.equal(AsyncSlice.getConstructor('disabled-by-default-gpu.service',
- 'gpu2'),
- GpuAsyncSlice);
- });
-
- test('subgroup', function() {
- var s_device = new GpuAsyncSlice('disabled-by-default-gpu.device', 'gpu1',
- 7, 0, {'channel': 'test_channel1'});
-
- var s_service = new GpuAsyncSlice('disabled-by-default-gpu.service', 'gpu2',
- 7, 0, {'channel': 'test_channel2'});
-
- assert.equal(s_device.viewSubGroupTitle, 'Device.test_channel1');
- assert.equal(s_service.viewSubGroupTitle, 'Service.test_channel2');
- });
-
- test('import', function() {
- var events = [
- {name: 'trace1', args: {}, pid: 1, ts: 100,
- cat: 'disabled-by-default-gpu.service', tid: 2, ph: 'b', id: 71},
- {name: 'trace1', args: {}, pid: 1, ts: 200,
- cat: 'disabled-by-default-gpu.service', tid: 2, ph: 'e', id: 71},
- {name: 'trace2', args: {'channel': 'test_channel'}, pid: 1, ts: 100,
- cat: 'disabled-by-default-gpu.service', tid: 2, ph: 'b', id: 72},
- {name: 'trace2', args: {'channel': 'test_channel'}, pid: 1, ts: 200,
- cat: 'disabled-by-default-gpu.service', tid: 2, ph: 'e', id: 72},
- {name: 'trace3', args: {'channel': 'test_channel'}, pid: 1, ts: 100,
- cat: 'disabled-by-default-gpu.device', tid: 2, ph: 'b', id: 73},
- {name: 'trace3', args: {'channel': 'test_channel'}, pid: 1, ts: 200,
- cat: 'disabled-by-default-gpu.device', tid: 2, ph: 'e', id: 73}
- ];
- var m = tr.c.TestUtils.newModelWithEvents([events]);
- var t2 = m.getOrCreateProcess(1).getOrCreateThread(2);
- assert.equal(t2.asyncSliceGroup.length, 3);
-
- var slice1 = t2.asyncSliceGroup.slices[0];
- var slice2 = t2.asyncSliceGroup.slices[1];
- var slice3 = t2.asyncSliceGroup.slices[2];
-
- assert.instanceOf(slice1, GpuAsyncSlice);
- assert.instanceOf(slice2, GpuAsyncSlice);
- assert.instanceOf(slice3, GpuAsyncSlice);
-
- assert.equal(slice1.viewSubGroupTitle, 'trace1');
- assert.equal(slice2.viewSubGroupTitle, 'Service.test_channel');
- assert.equal(slice3.viewSubGroupTitle, 'Device.test_channel');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/state.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/state.html
deleted file mode 100644
index b3185f7ef4e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/state.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/model/object_instance.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.gpu', function() {
- var ObjectSnapshot = tr.model.ObjectSnapshot;
-
- /**
- * @constructor
- */
- function StateSnapshot() {
- ObjectSnapshot.apply(this, arguments);
- }
-
- StateSnapshot.prototype = {
- __proto__: ObjectSnapshot.prototype,
-
- preInitialize: function() {
- this.screenshot_ = undefined;
- },
-
- initialize: function() {
- if (this.args.screenshot)
- this.screenshot_ = this.args.screenshot;
- },
-
- /**
- * @return {String} a base64 encoded screenshot if available.
- */
- get screenshot() {
- return this.screenshot_;
- }
- };
-
- ObjectSnapshot.register(
- StateSnapshot,
- {typeName: 'gpu::State'});
-
- return {
- StateSnapshot: StateSnapshot
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/state_test.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/state_test.html
deleted file mode 100644
index 4ddfe1e46ca..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/state_test.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/gpu/state.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script src="/tracing/extras/chrome/gpu/state_test_data.js"></script>
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('basic', function() {
- var m = tr.c.TestUtils.newModelWithEvents([g_gpu_state_trace]);
- var p = tr.b.dictionaryValues(m.processes)[0];
-
- var instance = p.objects.getAllInstancesNamed('gpu::State')[0];
- var snapshot = instance.snapshots[0];
-
- assert.instanceOf(snapshot, tr.e.gpu.StateSnapshot);
- assert.typeOf(snapshot.screenshot, 'string');
- instance.wasDeleted(150);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/state_test_data.js b/chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/state_test_data.js
deleted file mode 100644
index 39af04d95b5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/gpu/state_test_data.js
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (c) 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-'use strict';
-
-var g_gpu_state_trace = [
- {
- 'cat': 'disabled-by-default-gpu.debug',
- 'pid': 23969,
- 'tid': 1799,
- 'ts': 1427012847340,
- 'ph': 'O',
- 'name': 'gpu::State',
- 'args': {
- 'snapshot': {
- 'screenshot': 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB90JCREbHlyxtxQAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAqUlEQVRIx+2WiwrAIAhF/f9vHmywQTMft8w2CJKIoPDozR50fmy0AcsAiMjs9UDOJgG4jwG8SMuUXoMAZcVYBmgPqDYNwLo3JHqcHufbRETZKireOSbDQAA+zgKE7lyiCQDtcQygS6PKYIp3vZ5MvgB0mhmQu8kcgAXE6bYBoZYFmPnhgg5n4En/h0RmvdmX3eKAMYZ3HtGD0+NU3w2BR795dPe/aANuuwDyW5SiCgNBiQAAAABJRU5ErkJggg==' // @suppress longLineCheck
- }
- },
- 'id': '0x7d229bc0'
- }
-];
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/layout_object.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/layout_object.html
deleted file mode 100644
index 1403ff1eec3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/layout_object.html
+++ /dev/null
@@ -1,205 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.chrome', function() {
- var KNOWN_PROPERTIES = {
- absX: 1,
- absY: 1,
- address: 1,
- anonymous: 1,
- childNeeds: 1,
- children: 1,
- classNames: 1,
- col: 1,
- colSpan: 1,
- float: 1,
- height: 1,
- htmlId: 1,
- name: 1,
- posChildNeeds: 1,
- positioned: 1,
- positionedMovement: 1,
- relX: 1,
- relY: 1,
- relativePositioned: 1,
- row: 1,
- rowSpan: 1,
- selfNeeds: 1,
- stickyPositioned: 1,
- tag: 1,
- width: 1
- };
-
- function LayoutObject(snapshot, args) {
- this.snapshot_ = snapshot;
- this.id_ = args.address;
- this.name_ = args.name;
- this.childLayoutObjects_ = [];
- this.otherProperties_ = {};
- this.tag_ = args.tag;
- this.relativeRect_ = tr.b.Rect.fromXYWH(
- args.relX, args.relY, args.width, args.height);
- this.absoluteRect_ = tr.b.Rect.fromXYWH(
- args.absX, args.absY, args.width, args.height);
- this.isFloat_ = args.float;
- this.isStickyPositioned_ = args.stickyPositioned;
- this.isPositioned_ = args.positioned;
- this.isRelativePositioned_ = args.relativePositioned;
- this.isAnonymous_ = args.anonymous;
- this.htmlId_ = args.htmlId;
- this.classNames_ = args.classNames;
- this.needsLayoutReasons_ = [];
- if (args.selfNeeds)
- this.needsLayoutReasons_.push('self');
- if (args.childNeeds)
- this.needsLayoutReasons_.push('child');
- if (args.posChildNeeds)
- this.needsLayoutReasons_.push('positionedChild');
- if (args.positionedMovement)
- this.needsLayoutReasons_.push('positionedMovement');
- this.tableRow_ = args.row;
- this.tableCol_ = args.col;
- this.tableRowSpan_ = args.rowSpan;
- this.tableColSpan_ = args.colSpan;
-
- if (args.children) {
- args.children.forEach(function(child) {
- this.childLayoutObjects_.push(new LayoutObject(snapshot, child));
- }.bind(this));
- }
-
- for (var property in args) {
- if (!KNOWN_PROPERTIES[property])
- this.otherProperties_[property] = args[property];
- }
- }
-
- LayoutObject.prototype = {
- get snapshot() {
- return this.snapshot_;
- },
-
- get id() {
- return this.id_;
- },
-
- get name() {
- return this.name_;
- },
-
- get tag() {
- return this.tag_;
- },
-
- get relativeRect() {
- return this.relativeRect_;
- },
-
- get absoluteRect() {
- return this.absoluteRect_;
- },
-
- get isPositioned() {
- return this.isPositioned_;
- },
-
- get isFloat() {
- return this.isFloat_;
- },
-
- get isStickyPositioned() {
- return this.isStickyPositioned_;
- },
-
- get isRelativePositioned() {
- return this.isRelativePositioned_;
- },
-
- get isAnonymous() {
- return this.isAnonymous_;
- },
-
- get tableRow() {
- return this.tableRow_;
- },
-
- get tableCol() {
- return this.tableCol_;
- },
-
- get tableRowSpan() {
- return this.tableRowSpan_;
- },
-
- get tableColSpan() {
- return this.tableColSpan_;
- },
-
- get htmlId() {
- return this.htmlId_;
- },
-
- get classNames() {
- return this.classNames_;
- },
-
- get needsLayoutReasons() {
- return this.needsLayoutReasons_;
- },
-
- get hasChildLayoutObjects() {
- return this.childLayoutObjects_.length > 0;
- },
-
- get childLayoutObjects() {
- return this.childLayoutObjects_;
- },
-
- traverseTree: function(cb, opt_this) {
- cb.call(opt_this, this);
- if (!this.hasChildLayoutObjects)
- return;
- this.childLayoutObjects.forEach(function(child) {
- child.traverseTree(cb, opt_this);
- });
- },
-
- get otherPropertyNames() {
- var names = [];
- for (var name in this.otherProperties_) {
- names.push(name);
- }
- return names;
- },
-
- getProperty: function(name) {
- return this.otherProperties_[name];
- },
-
- get previousSnapshotLayoutObject() {
- if (!this.snapshot.previousSnapshot)
- return undefined;
- return this.snapshot.previousSnapshot.getLayoutObjectById(this.id);
- },
-
- get nextSnapshotLayoutObject() {
- if (!this.snapshot.nextSnapshot)
- return undefined;
- return this.snapshot.nextSnapshot.getLayoutObjectById(this.id);
- }
- };
-
- return {
- LayoutObject: LayoutObject
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/layout_object_test.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/layout_object_test.html
deleted file mode 100644
index 0d1958f47a1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/layout_object_test.html
+++ /dev/null
@@ -1,77 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/layout_object.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function FakeSnapshot() {
- this.layoutObjectsById = {};
- }
- FakeSnapshot.prototype = {
- getLayoutObjectById: function(id) {
- return this.layoutObjectsById[id];
- }
- };
-
- test('instantiate', function() {
- var snapshot = new FakeSnapshot();
- var layoutObject = new tr.e.chrome.LayoutObject(snapshot, {
- address: 'deadbeef',
- name: 'LayoutView',
- other: 1,
- children: [
- {
- address: 'beef2',
- name: 'LayoutBlockFlow',
- other: 2
- }
- ]
- });
- snapshot.layoutObjectsById[layoutObject.id] = layoutObject;
-
- assert.strictEqual(snapshot, layoutObject.snapshot);
- assert.equal('LayoutView', layoutObject.name);
- assert.equal('deadbeef', layoutObject.id);
- assert.equal(1, layoutObject.otherPropertyNames.length);
- assert.equal(1, layoutObject.getProperty('other'));
- assert.isTrue(layoutObject.hasChildLayoutObjects);
- var child = layoutObject.childLayoutObjects[0];
- assert.equal('LayoutBlockFlow', child.name);
- assert.equal('beef2', child.id);
- assert.equal(1, child.otherPropertyNames.length);
- assert.equal(2, child.getProperty('other'));
-
- assert.isUndefined(layoutObject.previousSnapshotLayoutObject);
- assert.isUndefined(layoutObject.nextSnapshotLayoutObject);
-
- var count = 0;
- layoutObject.traverseTree(function(node) {
- count += 1;
- });
- assert.equal(2, count);
-
- var nextSnapshot = new FakeSnapshot();
- nextSnapshot.previousSnapshot = snapshot;
- snapshot.nextSnapshot = nextSnapshot;
-
- var nextLayoutObject = new tr.e.chrome.LayoutObject(nextSnapshot, {
- address: 'deadbeef',
- name: 'LayoutView'
- });
- nextSnapshot.layoutObjectsById[nextLayoutObject.id] = nextLayoutObject;
-
- assert.strictEqual(layoutObject,
- nextLayoutObject.previousSnapshotLayoutObject);
- assert.strictEqual(nextLayoutObject, layoutObject.nextSnapshotLayoutObject);
- assert.isUndefined(layoutObject.previousSnapshotLayoutObject);
- assert.isUndefined(nextLayoutObject.nextSnapshotLayoutObject);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/layout_tree.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/layout_tree.html
deleted file mode 100644
index 98e8f14e099..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/layout_tree.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_registry.html">
-<link rel="import" href="/tracing/model/object_instance.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.chrome', function() {
- var ObjectSnapshot = tr.model.ObjectSnapshot;
- var ObjectInstance = tr.model.ObjectInstance;
-
- function LayoutTreeInstance() {
- ObjectInstance.apply(this, arguments);
- }
-
- LayoutTreeInstance.prototype = {
- __proto__: ObjectInstance.prototype,
- };
-
- ObjectInstance.register(LayoutTreeInstance, {typeName: 'LayoutTree'});
-
- function LayoutTreeSnapshot() {
- ObjectSnapshot.apply(this, arguments);
- this.rootLayoutObject = new tr.e.chrome.LayoutObject(this, this.args);
- }
-
- LayoutTreeSnapshot.prototype = {
- __proto__: ObjectSnapshot.prototype,
- };
-
- ObjectSnapshot.register(LayoutTreeSnapshot, {typeName: 'LayoutTree'});
-
- tr.model.EventRegistry.register(
- LayoutTreeSnapshot,
- {
- name: 'layoutTree',
- pluralName: 'layoutTrees',
- singleViewElementName: 'tr-ui-a-layout-tree-sub-view',
- multiViewElementName: 'tr-ui-a-layout-tree-sub-view'
- });
-
- return {
- LayoutTreeInstance: LayoutTreeInstance,
- LayoutTreeSnapshot: LayoutTreeSnapshot
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/slice_title_fixer.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/slice_title_fixer.html
deleted file mode 100644
index b1af1e27432..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/slice_title_fixer.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Some generic slice titles appear very frequently in traces,
- * like MessageLoop::RunTask. Some of these slices have arguments that give
- * useful context. This class combine such arguments with the slice title to
- * generate a more useful title.
- */
-tr.exportTo('tr.e.chrome', function() {
- function SliceTitleFixer() {
- }
-
- // AsyncSlice uses virtual functions to accomplish something similar to what
- // we're doing here. If this function ever becomes too complex we may consider
- // using a similar pattern.
- SliceTitleFixer.fromEvent = function(event) {
- if (event.args && event.args['src_func'])
- return event.title + ' <- ' + event.args['src_func'];
- return event.title;
- };
-
- return {
- SliceTitleFixer: SliceTitleFixer
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome/slice_title_fixer_test.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome/slice_title_fixer_test.html
deleted file mode 100644
index 581e3d1886c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome/slice_title_fixer_test.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/slice_title_fixer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var stfFromEvent = tr.e.chrome.SliceTitleFixer.fromEvent;
-
- test('sliceTitleFixer', function() {
- assert.equal(stfFromEvent({
- title: 'SomeDummy:event'
- }), 'SomeDummy:event');
-
- assert.equal(stfFromEvent({
- title: 'EventWith:sourceFunction',
- args: {'src_func': 'theSource'}
- }), 'EventWith:sourceFunction <- theSource');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/chrome_config.html b/chromium/third_party/catapult/tracing/tracing/extras/chrome_config.html
deleted file mode 100644
index b90a2cd8ddd..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/chrome_config.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<!--
-The chrome config is heavily used:
- - chrome://tracing,
- - trace2html, which in turn implies
- - adb_profile_chrome
- - telemetry
--->
-
-<link rel="import" href="/tracing/extras/android/android_auditor.html">
-<link rel="import" href="/tracing/extras/chrome/blame_context/blame_context.html">
-<link rel="import" href="/tracing/extras/chrome/blame_context/frame_tree_node.html">
-<link rel="import" href="/tracing/extras/chrome/blame_context/render_frame.html">
-<link rel="import" href="/tracing/extras/chrome/blame_context/top_level.html">
-<link rel="import" href="/tracing/extras/chrome/chrome_auditor.html">
-<link rel="import" href="/tracing/extras/chrome/layout_object.html">
-<link rel="import" href="/tracing/extras/chrome/layout_tree.html">
-<link rel="import" href="/tracing/extras/importer/etw/etw_importer.html">
-<link rel="import" href="/tracing/extras/importer/gzip_importer.html">
-<link rel="import" href="/tracing/extras/importer/trace2html_importer.html">
-<link rel="import" href="/tracing/extras/importer/v8/v8_log_importer.html">
-<link rel="import" href="/tracing/extras/importer/zip_importer.html">
-<link rel="import" href="/tracing/extras/lean_config.html">
-<link rel="import" href="/tracing/extras/measure/measure.html">
-<link rel="import" href="/tracing/extras/net/net.html">
-<link rel="import" href="/tracing/extras/systrace_config.html">
-<link rel="import" href="/tracing/extras/vsync/vsync_auditor.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/full_config.html b/chromium/third_party/catapult/tracing/tracing/extras/full_config.html
deleted file mode 100644
index 2f157189922..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/full_config.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<!-- The full config is all the configs slammed together. -->
-<link rel="import" href="/tracing/extras/chrome_config.html">
-<link rel="import" href="/tracing/extras/importer/gcloud_trace/gcloud_trace_importer.html">
-<link rel="import" href="/tracing/extras/lean_config.html">
-<link rel="import" href="/tracing/extras/systrace_config.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/android/event_log_importer.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/android/event_log_importer.html
deleted file mode 100644
index ff2e22e16a2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/android/event_log_importer.html
+++ /dev/null
@@ -1,321 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/importer/importer.html">
-<link rel="import" href="/tracing/importer/simple_line_reader.html">
-<link rel="import" href="/tracing/model/activity.html">
-<link rel="import" href="/tracing/model/model.html">
-
-
-<script>
-/**
- * @fileoverview Imports android event log data into the trace model.
- * Android event log data contains information about activities that
- * are launched/paused, processes that are started, memory usage, etc.
- *
- * The current implementation only parses activity events, with the goal of
- * determining which Activity is running in the foreground for a process.
- *
- * This importer assumes the events arrive as a string. The unit tests provide
- * examples of the trace format.
- */
-'use strict';
-
-tr.exportTo('tr.e.importer.android', function() {
- var Importer = tr.importer.Importer;
-
- var ACTIVITY_STATE = {
- NONE: 'none',
- CREATED: 'created',
- STARTED: 'started',
- RESUMED: 'resumed',
- PAUSED: 'paused',
- STOPPED: 'stopped',
- DESTROYED: 'destroyed'
- };
-
- var activityMap = {};
-
- /**
- * Imports android event log data (adb logcat -b events)
- * @constructor
- */
- function EventLogImporter(model, events) {
- this.model_ = model;
- this.events_ = events;
- this.importPriority = 3;
- }
-
- // Generic format of event log entries.
- // Sample event log entry that this matches (split over 2 lines):
- // 08-11 13:12:31.405 880 2645 I am_focused_activity: [0,com.google.android.googlequicksearchbox/com.google.android.launcher.GEL] // @suppress longLineCheck
- var eventLogActivityRE = new RegExp(
- '(\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}.\\d+)' +
- '\\s+(\\d+)\\s+(\\d+)\\s+([A-Z])\\s*' +
- '(am_\\w+)\\s*:(.*)');
-
- // 08-28 03:58:21.834 888 3177 I am_create_activity: [0,5972200,30,com.nxp.taginfolite/.activities.MainView,android.intent.action.MAIN,NULL,NULL,270532608] // @suppress longLineCheck
- // Store the name of the created activity only
- var amCreateRE = new RegExp('\s*\\[.*,.*,.*,(.*),.*,.*,.*,.*\\]');
-
- // 07-22 12:22:19.504 920 2504 I am_focused_activity: [0,com.android.systemui/.recents.RecentsActivity] // @suppress longLineCheck
- //Store the name of the focused activity only
- var amFocusedRE = new RegExp('\s*\\[\\d+,(.*)\\]');
-
- // 07-21 19:56:12.315 920 2261 I am_proc_start: [0,19942,10062,com.google.android.talk,broadcast,com.google.android.talk/com.google.android.apps.hangouts.realtimechat.RealTimeChatService$AlarmReceiver] // @suppress longLineCheck
- // We care about proc starts on behalf of activities, and store the activity
- var amProcStartRE = new RegExp('\s*\\[\\d+,\\d+,\\d+,.*,activity,(.*)\\]');
-
- // 07-22 12:21:43.490 2893 2893 I am_on_resume_called: [0,com.google.android.launcher.GEL] // @suppress longLineCheck
- // Store the activity name only
- var amOnResumeRE = new RegExp('\s*\\[\\d+,(.*)\\]');
-
- // 07-22 12:22:19.545 2893 2893 I am_on_paused_called: [0,com.google.android.launcher.GEL] // @suppress longLineCheck
- // Store the activity name only
- var amOnPauseRE = new RegExp('\s*\\[\\d+,(.*)\\]');
-
- // 08-28 03:51:54.456 888 907 I am_activity_launch_time: [0,185307115,com.google.android.googlequicksearchbox/com.google.android.launcher.GEL,1174,1174] // @suppress longLineCheck
- // Store the activity name and launch times
- var amLaunchTimeRE = new RegExp('\s*\\[\\d+,\\d+,(.*),(\\d+),(\\d+)');
-
- // 08-28 03:58:15.854 888 902 I am_destroy_activity: [0,203516597,29,com.android.chrome/com.google.android.apps.chrome.Main,finish-idle] // @suppress longLineCheck
- // Store the activity name only
- var amDestroyRE = new RegExp('\s*\\[\\d+,\\d+,\\d+,(.*)\\]');
-
- /**
- * @return {boolean} True when events is an android event log array.
- */
- EventLogImporter.canImport = function(events) {
- if (!(typeof(events) === 'string' || events instanceof String))
- return false;
-
- // Prevent the importer from matching this file in vulcanized traces.
- if (/^<!DOCTYPE html>/.test(events))
- return false;
-
- return eventLogActivityRE.test(events);
- };
-
- EventLogImporter.prototype = {
- __proto__: Importer.prototype,
-
- get importerName() {
- return 'EventLogImporter';
- },
-
- get model() {
- return this.model_;
- },
-
- /**
- * @return {string} the full activity name (including package) from
- * a component
- */
- getFullActivityName: function(component) {
- var componentSplit = component.split('/');
- if (componentSplit[1].startsWith('.'))
- return componentSplit[0] + componentSplit[1];
-
- return componentSplit[1];
- },
-
- /**
- * @return {string} the process name of a component
- */
- getProcName: function(component) {
- var componentSplit = component.split('/');
- return componentSplit[0];
- },
-
- findOrCreateActivity: function(activityName) {
- if (activityName in activityMap)
- return activityMap[activityName];
- var activity = {
- state: ACTIVITY_STATE.NONE,
- name: activityName
- };
- activityMap[activityName] = activity;
- return activity;
- },
-
- deleteActivity: function(activityName) {
- delete activityMap[activityName];
- },
-
- handleCreateActivity: function(ts, activityName) {
- var activity = this.findOrCreateActivity(activityName);
- activity.state = ACTIVITY_STATE.CREATED;
- activity.createdTs = ts;
- },
-
- handleFocusActivity: function(ts, procName, activityName) {
- var activity = this.findOrCreateActivity(activityName);
- activity.lastFocusedTs = ts;
- },
-
- handleProcStartForActivity: function(ts, activityName) {
- var activity = this.findOrCreateActivity(activityName);
- activity.procStartTs = ts;
- },
-
- handleOnResumeCalled: function(ts, pid, activityName) {
- var activity = this.findOrCreateActivity(activityName);
- activity.state = ACTIVITY_STATE.RESUMED;
- activity.lastResumeTs = ts;
- // on_resume_called shows the actual PID; use this
- // to link the activity up with a process later
- activity.pid = pid;
- },
-
- handleOnPauseCalled: function(ts, activityName) {
- var activity = this.findOrCreateActivity(activityName);
- activity.state = ACTIVITY_STATE.PAUSED;
- activity.lastPauseTs = ts;
- // Create a new AndroidActivity representing the foreground state,
- // but only if the pause happened within the model bounds
- if (ts > this.model_.bounds.min && ts < this.model_.bounds.max)
- this.addActivityToProcess(activity);
- },
-
- handleLaunchTime: function(ts, activityName, launchTime) {
- var activity = this.findOrCreateActivity(activityName);
- activity.launchTime = launchTime;
- },
-
- handleDestroyActivity: function(ts, activityName) {
- this.deleteActivity(activityName);
- },
-
- addActivityToProcess: function(activity) {
- if (activity.pid === undefined)
- return;
- var process = this.model_.getOrCreateProcess(activity.pid);
- // The range of the activity is the time from resume to time
- // of pause; limit the start time to the beginning of the model
- var range = tr.b.Range.fromExplicitRange(
- Math.max(this.model_.bounds.min, activity.lastResumeTs),
- activity.lastPauseTs);
- var newActivity = new tr.model.Activity(activity.name,
- 'Android Activity', range,
- {created: activity.createdTs,
- procstart: activity.procStartTs,
- lastfocus: activity.lastFocusedTs});
- process.activities.push(newActivity);
- },
-
- parseAmLine_: function(line) {
- var match = eventLogActivityRE.exec(line);
- if (!match)
- return;
-
- // Possible activity life-cycles:
- // 1) Launch from scratch:
- // - am_create_activity
- // - am_focused_activity
- // - am_proc_start
- // - am_proc_bound
- // - am_restart_activity
- // - am_on_resume_called
- // 2) Re-open existing activity
- // - am_focused_activity
- // - am_on_resume_called
-
- // HACK: event log date format is "MM-DD" and doesn't contain the year;
- // to figure out the year, take the min bound of the model, convert
- // to real-time and use that as the year.
- // The Android event log will eventually contain the year once this
- // CL is in a release:
- // https://android-review.googlesource.com/#/c/168900
- var first_realtime_ts = this.model_.bounds.min -
- this.model_.realtime_to_monotonic_offset_ms;
- var year = new Date(first_realtime_ts).getFullYear();
- var ts = match[1].substring(0, 5) + '-' + year + ' ' +
- match[1].substring(5, match[1].length);
-
- var monotonic_ts = Date.parse(ts) +
- this.model_.realtime_to_monotonic_offset_ms;
-
- var pid = match[2];
- var action = match[5];
- var data = match[6];
-
- if (action === 'am_create_activity') {
- match = amCreateRE.exec(data);
- if (match && match.length >= 2) {
- this.handleCreateActivity(monotonic_ts,
- this.getFullActivityName(match[1]));
- }
- } else if (action === 'am_focused_activity') {
- match = amFocusedRE.exec(data);
- if (match && match.length >= 2) {
- this.handleFocusActivity(monotonic_ts,
- this.getProcName(match[1]), this.getFullActivityName(match[1]));
- }
- } else if (action === 'am_proc_start') {
- match = amProcStartRE.exec(data);
- if (match && match.length >= 2) {
- this.handleProcStartForActivity(monotonic_ts,
- this.getFullActivityName(match[1]));
- }
- } else if (action === 'am_on_resume_called') {
- match = amOnResumeRE.exec(data);
- if (match && match.length >= 2)
- this.handleOnResumeCalled(monotonic_ts, pid, match[1]);
- } else if (action === 'am_on_paused_called') {
- match = amOnPauseRE.exec(data);
- if (match && match.length >= 2)
- this.handleOnPauseCalled(monotonic_ts, match[1]);
- } else if (action === 'am_activity_launch_time') {
- match = amLaunchTimeRE.exec(data);
- this.handleLaunchTime(monotonic_ts,
- this.getFullActivityName(match[1]), match[2]);
- } else if (action === 'am_destroy_activity') {
- match = amDestroyRE.exec(data);
- if (match && match.length == 2) {
- this.handleDestroyActivity(monotonic_ts,
- this.getFullActivityName(match[1]));
- }
- }
- },
-
- importEvents: function() {
- // Check if we have a mapping from real-time to CLOCK_MONOTONIC
- if (isNaN(this.model_.realtime_to_monotonic_offset_ms)) {
- this.model_.importWarning({
- type: 'eveng_log_clock_sync',
- message: 'Need a trace_event_clock_sync to map realtime to import.'
- });
- return;
- }
- // Since the event log typically spans a much larger timeframe
- // than the ftrace data, we want to calculate the bounds of the existing
- // model, and dump all event log data outside of those bounds
- this.model_.updateBounds();
-
- var lines = this.events_.split('\n');
- lines.forEach(this.parseAmLine_, this);
-
- // Iterate over all created activities that are not destroyed yet
- for (var activityName in activityMap) {
- var activity = activityMap[activityName];
- // If we're still in the foreground, store the activity anyway
- if (activity.state == ACTIVITY_STATE.RESUMED) {
- // Set the pause timestamp to the end of the model bounds
- activity.lastPauseTs = this.model_.bounds.max;
- this.addActivityToProcess(activity);
- }
- }
- }
- };
-
- Importer.register(EventLogImporter);
-
- return {
- EventLogImporter: EventLogImporter
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/battor_importer.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/battor_importer.html
deleted file mode 100644
index 381bf0f8687..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/battor_importer.html
+++ /dev/null
@@ -1,181 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/importer/importer.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/power_series.html">
-
-<script>
-/**
- * @fileoverview Imports text files in the BattOr format into the
- * Model. This format is output by the battor_agent executable and library.
- *
- * This importer assumes the events arrive as a string. The unit tests provide
- * examples of the trace format.
- */
-'use strict';
-
-tr.exportTo('tr.e.importer.battor', function() {
- /**
- * Imports a BattOr power trace into a specified model.
- * @constructor
- */
- function BattorImporter(model, events) {
- this.importPriority = 3; // runs after the linux_perf importer
- this.model_ = model;
- this.samples_ = this.linesToSamples_(events.split('\n'));
- }
-
- var battorDataLineRE = new RegExp(
- '^(-?\\d+\\.\\d+)\\s+(-?\\d+\\.\\d+)\\s+(-?\\d+\\.\\d+)' +
- '(?:\\s+<(\\S+)>)?$'
- );
- var battorHeaderLineRE = /^# BattOr/;
-
- /**
- * Guesses whether the provided events is a BattOr string.
- * Looks for the magic string "# BattOr" at the start of the file,
- *
- * @return {boolean} True when events is a BattOr array.
- */
- BattorImporter.canImport = function(events) {
- if (!(typeof(events) === 'string' || events instanceof String))
- return false;
-
- return battorHeaderLineRE.test(events);
- };
-
- BattorImporter.prototype = {
- __proto__: tr.importer.Importer.prototype,
-
- get importerName() {
- return 'BattorImporter';
- },
-
- get model() {
- return this.model_;
- },
-
- /**
- * Imports clock sync markers in this.events_ into model_.
- */
- importClockSyncMarkers: function() {
- for (var i = 0; i < this.samples_.length; i++) {
- var sample = this.samples_[i];
- if (sample.syncId) {
- this.model_.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.BATTOR, sample.syncId, sample.ts);
- }
- }
- },
-
- /**
- * Imports the data in this.events_ into model_.
- */
- importEvents: function() {
- if (this.model_.device.powerSeries) {
- this.model_.importWarning({
- type: 'import_error',
- message: 'Power counter exists, can not import BattOr power trace.'
- });
- return;
- }
-
- var modelTimeTransformer =
- this.model_.clockSyncManager.getModelTimeTransformer(
- tr.model.ClockDomainId.BATTOR);
-
- var powerSeries = this.model_.device.powerSeries =
- new tr.model.PowerSeries(this.model_.device);
- for (var i = 0; i < this.samples_.length; i++) {
- var sample = this.samples_[i];
- powerSeries.addPowerSample(
- modelTimeTransformer(sample.ts), sample.power);
- }
- },
-
- /**
- * Given an array of strings that make up the lines of a BattOr trace,
- * returns an array of samples contained within those lines.
- */
- linesToSamples_: function(lines) {
- var samples = [];
-
- for (var i = 0; i < lines.length; i++) {
- var line = lines[i];
- line = line.trim();
-
- if (line.length === 0)
- continue;
-
- if (line.startsWith('#'))
- continue;
-
- // Parse power sample.
- var groups = battorDataLineRE.exec(line);
- if (!groups) {
- this.model_.importWarning({
- type: 'parse_error',
- message: 'Unrecognized line in BattOr trace: ' + line
- });
- continue;
- }
-
- var ts = parseFloat(groups[1]);
- var voltage = parseFloat(groups[2]) / 1000;
- var current = parseFloat(groups[3]) / 1000;
- var syncId = groups[4];
-
- if (voltage < 0 || current < 0) {
- this.model_.importWarning({
- type: 'parse_error',
- message: 'The following line in the BattOr trace has a negative ' +
- 'voltage or current, neither of which are allowed: ' + line +
- '. A common cause of this is that the device is charging ' +
- 'while the trace is being recorded.'
- });
- continue;
- }
-
- samples.push(new Sample(ts, voltage, current, syncId));
- }
-
- return samples;
- }
- };
-
- /**
- * A sample recorded by a BattOr.
- *
- * @param {number} ts The timestamp (in milliseconds) of the sample.
- * @param {number} voltage The voltage (in volts) at the specified time.
- * @param {number} current The current (in amps) at the specified time.
- * @param {string=} opt_syncId The sync ID of the sync that happened at this
- * sample.
- *
- * @constructor
- */
- function Sample(ts, voltage, current, opt_syncId) {
- this.ts = ts;
- this.voltage = voltage;
- this.current = current;
- this.syncId = opt_syncId;
- }
-
- Sample.prototype = {
- /** Returns the instantaneous power consumption (in Watts). */
- get power() { return this.voltage * this.current; }
- };
-
- tr.importer.Importer.register(BattorImporter);
-
- return {
- BattorImporter: BattorImporter,
- };
-});
-
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/battor_importer_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/battor_importer_test.html
deleted file mode 100644
index ac8c125dbc6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/battor_importer_test.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/battor_importer.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- var CHROMIUM_EVENTS = [
- {
- name: 'a', args: {}, pid: 52, ts: 0,
- cat: 'foo', tid: 53, ph: 'B'
- },
- {
- pid: 94936, tid: 5643, ts: 15000,
- ph: 'c', cat: '__metadata', name: 'clock_sync',
- args: {sync_id: 'ABCDEF-01234-5678-0A1B2C3D', issue_ts: 10000},
- tts: 16496444
- }
- ];
-
- var BATTOR_LINES = [
- '# BattOr',
- '# voltage_range [0.0, 6144.0] mV',
- '# current_range [0.0, 2275.5] mA',
- '# sample_rate 2000 Hz, gain 5.0x',
- '0.000000 0.000000 4000.000000',
- '0.500000 0.000000 4000.000000',
- '1.000000 0.000000 4000.000000',
- '1.500000 0.000000 4000.000000',
- '2.000000 1.000000 4000.000000'
- ];
-
- test('canImport', function() {
- assert.isFalse(tr.e.importer.battor.BattorImporter.canImport('string'));
- assert.isFalse(tr.e.importer.battor.BattorImporter.canImport([]));
- assert.isTrue(tr.e.importer.battor.BattorImporter.canImport(
- BATTOR_LINES.join('\n')));
- });
-
- test('importExplicitClockSync', function() {
- // Add a BattOr sample with an explicit clock sync.
- var battorLinesWithExplicitSync = BATTOR_LINES.slice();
- battorLinesWithExplicitSync.push(
- '2.500000 1.000000 4000.000000 <ABCDEF-01234-5678-0A1B2C3D>');
-
- var m = tr.c.TestUtils.newModelWithEvents(
- [CHROMIUM_EVENTS, battorLinesWithExplicitSync.join('\n')]);
-
- // Check to see if power samples were imported successfully.
- assert.isDefined(m.device.powerSeries);
-
- assert.strictEqual(m.device.powerSeries.samples[0].start, 7.5);
- assert.strictEqual(m.device.powerSeries.samples[5].start, 10.0);
- });
-
- test('explicitClockSyncWithoutSyncMarkers', function() {
- // Create an empty model.
- var m = new tr.Model();
- var io = new tr.importer.ImportOptions();
- io.showImportWarnings = false;
- m.importOptions = io;
-
- // Add a BattOr sample with an explicit clock sync.
- var battorLinesWithExplicitSync = BATTOR_LINES.slice();
- battorLinesWithExplicitSync.push(
- '2.500000 1.000000 4000.000000 <ABCDEF-01234-5678-0A1B2C3D>');
-
- var m = tr.c.TestUtils.newModelWithEvents(
- [battorLinesWithExplicitSync.join('\n')]);
-
- assert.strictEqual(m.device.powerSeries.samples[0].start, 0);
- assert.strictEqual(m.device.powerSeries.samples[5].start, 2.5);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/ddms_importer.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/ddms_importer.html
deleted file mode 100644
index fd760c7c7f4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/ddms_importer.html
+++ /dev/null
@@ -1,221 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/jszip.html">
-<link rel="import" href="/tracing/importer/importer.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-/**
- * @fileoverview Blah.
- */
-'use strict';
-
-tr.exportTo('tr.e.importer.ddms', function() {
- var kPid = 0;
- var kCategory = 'java';
- var kMethodLutEndMarker = '\n*end\n';
- var kThreadsStart = '\n*threads\n';
- var kMethodsStart = '\n*methods\n';
-
- var kTraceMethodEnter = 0x00; // method entry
- var kTraceMethodExit = 0x01; // method exit
- var kTraceUnroll = 0x02; // method exited by exception unrolling
- // 0x03 currently unused
- var kTraceMethodActionMask = 0x03; // two bits
-
- var kTraceHeaderLength = 32;
- var kTraceMagicValue = 0x574f4c53;
- var kTraceVersionSingleClock = 2;
- var kTraceVersionDualClock = 3;
- var kTraceRecordSizeSingleClock = 10; // using v2
- var kTraceRecordSizeDualClock = 14; // using v3 with two timestamps
-
- function Reader(string_payload) {
- this.position_ = 0;
- this.data_ = JSZip.utils.transformTo('uint8array', string_payload);
- }
-
- Reader.prototype = {
- __proto__: Object.prototype,
-
- uint8: function() {
- var result = this.data_[this.position_];
- this.position_ += 1;
- return result;
- },
-
- uint16: function() {
- var result = 0;
- result += this.uint8();
- result += this.uint8() << 8;
- return result;
- },
-
- uint32: function() {
- var result = 0;
- result += this.uint8();
- result += this.uint8() << 8;
- result += this.uint8() << 16;
- result += this.uint8() << 24;
- return result;
- },
-
- uint64: function() {
- // Javascript isn't able to manage 64-bit numeric values.
- var low = this.uint32();
- var high = this.uint32();
- var low_str = ('0000000' + low.toString(16)).substr(-8);
- var high_str = ('0000000' + high.toString(16)).substr(-8);
- var result = high_str + low_str;
- return result;
- },
-
- seekTo: function(position) {
- this.position_ = position;
- },
-
- hasMore: function() {
- return this.position_ < this.data_.length;
- }
- };
-
- /**
- * Imports DDMS method tracing events into a specified model.
- * @constructor
- */
- function DdmsImporter(model, data) {
- this.importPriority = 3;
- this.model_ = model;
- this.data_ = data;
- }
-
- /**
- * Guesses whether the provided events is from a DDMS method trace.
- * @return {boolean} True when events is a DDMS method trace.
- */
- DdmsImporter.canImport = function(data) {
- if (typeof(data) === 'string' || data instanceof String) {
- var header = data.slice(0, 1000);
- return header.startsWith('*version\n') &&
- header.indexOf('\nvm=') >= 0 &&
- header.indexOf(kThreadsStart) >= 0;
- }
- /* key bit */
- return false;
- };
-
- DdmsImporter.prototype = {
- __proto__: tr.importer.Importer.prototype,
-
- get importerName() {
- return 'DdmsImporter';
- },
-
- get model() {
- return this.model_;
- },
-
- /**
- * Imports the data in this.data_ into this.model_.
- */
- importEvents: function() {
- var divider = this.data_.indexOf(kMethodLutEndMarker) +
- kMethodLutEndMarker.length;
- this.metadata_ = this.data_.slice(0, divider);
- this.methods_ = {};
- this.parseThreads();
- this.parseMethods();
-
- var traceReader = new Reader(this.data_.slice(divider));
- var magic = traceReader.uint32();
- if (magic != kTraceMagicValue) {
- throw Error('Failed to match magic value');
- }
- this.version_ = traceReader.uint16();
- if (this.version_ != kTraceVersionDualClock) {
- throw Error('Unknown version');
- }
- var dataOffest = traceReader.uint16();
- var startDateTime = traceReader.uint64();
- var recordSize = traceReader.uint16();
-
- traceReader.seekTo(dataOffest);
-
- while (traceReader.hasMore()) {
- this.parseTraceEntry(traceReader);
- }
- },
-
- parseTraceEntry: function(reader) {
- var tid = reader.uint16();
- var methodPacked = reader.uint32();
- var cpuSinceStart = reader.uint32();
- var wallClockSinceStart = reader.uint32();
- var method = methodPacked & ~kTraceMethodActionMask;
- var action = methodPacked & kTraceMethodActionMask;
- var thread = this.getTid(tid);
- method = this.getMethodName(method);
- if (action == kTraceMethodEnter) {
- thread.sliceGroup.beginSlice(kCategory, method, wallClockSinceStart,
- undefined, cpuSinceStart);
- } else if (thread.sliceGroup.openSliceCount) {
- thread.sliceGroup.endSlice(wallClockSinceStart, cpuSinceStart);
- }
- },
-
- parseThreads: function() {
- var threads = this.metadata_.slice(this.metadata_.indexOf(kThreadsStart) +
- kThreadsStart.length);
- threads = threads.slice(0, threads.indexOf('\n*'));
- threads = threads.split('\n');
- threads.forEach(this.parseThread.bind(this));
- },
-
- parseThread: function(thread_line) {
- var tid = thread_line.slice(0, thread_line.indexOf('\t'));
- var thread = this.getTid(parseInt(tid));
- thread.name = thread_line.slice(thread_line.indexOf('\t') + 1);
- },
-
- getTid: function(tid) {
- return this.model_.getOrCreateProcess(kPid)
- .getOrCreateThread(tid);
- },
-
- parseMethods: function() {
- var methods = this.metadata_.slice(this.metadata_.indexOf(kMethodsStart) +
- kMethodsStart.length);
- methods = methods.slice(0, methods.indexOf('\n*'));
- methods = methods.split('\n');
- methods.forEach(this.parseMethod.bind(this));
- },
-
- parseMethod: function(method_line) {
- var data = method_line.split('\t');
- var methodId = parseInt(data[0]);
- var methodName = data[1] + '.' + data[2] + data[3];
- this.addMethod(methodId, methodName);
- },
-
- addMethod: function(methodId, methodName) {
- this.methods_[methodId] = methodName;
- },
-
- getMethodName: function(methodId) {
- return this.methods_[methodId];
- }
- };
-
- // Register the DdmsImporter to the Importer.
- tr.importer.Importer.register(DdmsImporter);
-
- return {
- DdmsImporter: DdmsImporter
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/ddms_importer_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/ddms_importer_test.html
deleted file mode 100644
index 997556b7273..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/ddms_importer_test.html
+++ /dev/null
@@ -1,188 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base64.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/ddms_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Base64 = tr.b.Base64;
-
- test('canImport', function() {
- assert.isFalse(tr.e.importer.ddms.DdmsImporter.canImport('string'));
- assert.isFalse(tr.e.importer.ddms.DdmsImporter.canImport([]));
- assert.isTrue(tr.e.importer.ddms.DdmsImporter.canImport(TEST_DATA));
- });
-
- test('parseThreads', function() {
- var m = tr.c.TestUtils.newModelWithEvents(TEST_DATA, {
- shiftWorldToZero: false
- });
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 2);
- threads = m.findAllThreadsNamed('main');
- assert.equal(threads.length, 1);
- var thread = threads[0];
- assert.equal(thread.tid, 2703);
- });
-
- test('parseMethods', function() {
- var m = tr.c.TestUtils.newModelWithEvents(TEST_DATA, {
- shiftWorldToZero: false
- });
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.findAllThreadsNamed('Binder_1');
- assert.equal(threads.length, 1);
- var thread = threads[0];
- assert.equal(thread.sliceGroup.length, 22);
- assert.equal('android.os.Binder.execTransact(IJJI)Z',
- thread.sliceGroup.slices[0].title);
- });
-
- var TEST_DATA = Base64.atob(
- 'KnZlcnNpb24KMwpkYXRhLWZpbGUtb3ZlcmZsb3c9ZmFsc2UKY2' +
- 'xvY2s9ZHVhbAplbGFwc2VkLXRpbWUtdXNlYz02MzMwNzc5Cm51' +
- 'bS1tZXRob2QtY2FsbHM9NzYKY2xvY2stY2FsbC1vdmVyaGVhZC' +
- '1uc2VjPTMzNDMKdm09YXJ0Cip0aHJlYWRzCjI3MDMJbWFpbgoy' +
- 'NzEwCUhlYXAgdGhyZWFkIHBvb2wgd29ya2VyIHRocmVhZCAxCj' +
- 'I3MDkJSGVhcCB0aHJlYWQgcG9vbCB3b3JrZXIgdGhyZWFkIDAK' +
- 'MjcxMQlIZWFwIHRocmVhZCBwb29sIHdvcmtlciB0aHJlYWQgMg' +
- 'oyNzEyCVNpZ25hbCBDYXRjaGVyCjI3MTMJSkRXUAoyNzE0CVJl' +
- 'ZmVyZW5jZVF1ZXVlRGFlbW9uCjI3MTUJRmluYWxpemVyRGFlbW' +
- '9uCjI3MTYJRmluYWxpemVyV2F0Y2hkb2dEYWVtb24KMjcxNwlI' +
- 'ZWFwVHJpbW1lckRhZW1vbgoyNzE4CUdDRGFlbW9uCjI3MTkJQm' +
- 'luZGVyXzEKMjcyMAlCaW5kZXJfMgoyNzI3CVJlbmRlclRocmVh' +
- 'ZAoyNzI4CUFzeW5jVGFzayAjMQoyNzI5CUFzeW5jVGFzayAjMg' +
- 'oyNzMwCUJpbmRlcl8zCjExNTk4CWh3dWlUYXNrMQoxMTU5OQlo' +
- 'd3VpVGFzazIKMTE2MDAJQXN5bmNUYXNrICMzCjExNjAxCUFzeW' +
- '5jVGFzayAjNAoxMTY3MwlBc3luY1Rhc2sgIzUKKm1ldGhvZHMK' +
- 'MHg3MGZiNzc1OAlkYWx2aWsuc3lzdGVtLkNsb3NlR3VhcmQJY2' +
- 'xvc2UJKClWCUNsb3NlR3VhcmQuamF2YQoweDcwZmI4NDE4CWRh' +
- 'bHZpay5zeXN0ZW0uVk1EZWJ1ZwlzdGFydE1ldGhvZFRyYWNpbm' +
- 'cJKExqYXZhL2xhbmcvU3RyaW5nO0xqYXZhL2lvL0ZpbGVEZXNj' +
- 'cmlwdG9yO0lJWkkpVglWTURlYnVnLmphdmEKMHg3MGZlYTcyOA' +
- 'lqYXZhLnV0aWwuQXJyYXlMaXN0CXNpemUJKClJCUFycmF5TGlz' +
- 'dC5qYXZhCjB4NzEwMTNmYTgJbGliY29yZS5pby5CbG9ja0d1YX' +
- 'JkT3MJY2xvc2UJKExqYXZhL2lvL0ZpbGVEZXNjcmlwdG9yOylW' +
- 'CUJsb2NrR3VhcmRPcy5qYXZhCjB4NzEwNTc3NDgJYW5kcm9pZC' +
- '5vcy5CaW5kZXIJZXhlY1RyYW5zYWN0CShJSkpJKVoJQmluZGVy' +
- 'LmphdmEKMHg3MTA3MTdlOAlhbmRyb2lkLmFwcC5BY3Rpdml0eV' +
- 'RocmVhZCRBcHBsaWNhdGlvblRocmVhZAlwcm9maWxlckNvbnRy' +
- 'b2wJKFpMYW5kcm9pZC9hcHAvUHJvZmlsZXJJbmZvO0kpVglBY3' +
- 'Rpdml0eVRocmVhZC5qYXZhCjB4NzEwNzJhNDgJYW5kcm9pZC5h' +
- 'cHAuQXBwbGljYXRpb25UaHJlYWROYXRpdmUJb25UcmFuc2FjdA' +
- 'koSUxhbmRyb2lkL29zL1BhcmNlbDtMYW5kcm9pZC9vcy9QYXJj' +
- 'ZWw7SSlaCUFwcGxpY2F0aW9uVGhyZWFkTmF0aXZlLmphdmEKMH' +
- 'g3MTA3MmYyOAlhbmRyb2lkLm9zLkhhbmRsZXIJZW5xdWV1ZU1l' +
- 'c3NhZ2UJKExhbmRyb2lkL29zL01lc3NhZ2VRdWV1ZTtMYW5kcm' +
- '9pZC9vcy9NZXNzYWdlO0opWglIYW5kbGVyLmphdmEKMHg3MTA3' +
- 'MmZlOAlhbmRyb2lkLm9zLkhhbmRsZXIJZGlzcGF0Y2hNZXNzYW' +
- 'dlCShMYW5kcm9pZC9vcy9NZXNzYWdlOylWCUhhbmRsZXIuamF2' +
- 'YQoweDcxMDczNTI4CWFuZHJvaWQub3MuSGFuZGxlcglzZW5kTW' +
- 'Vzc2FnZQkoTGFuZHJvaWQvb3MvTWVzc2FnZTspWglIYW5kbGVy' +
- 'LmphdmEKMHg3MTA3MzU4OAlhbmRyb2lkLm9zLkhhbmRsZXIJc2' +
- 'VuZE1lc3NhZ2VBdFRpbWUJKExhbmRyb2lkL29zL01lc3NhZ2U7' +
- 'SilaCUhhbmRsZXIuamF2YQoweDcxMDczNWI4CWFuZHJvaWQub3' +
- 'MuSGFuZGxlcglzZW5kTWVzc2FnZURlbGF5ZWQJKExhbmRyb2lk' +
- 'L29zL01lc3NhZ2U7SilaCUhhbmRsZXIuamF2YQoweDcxMDczNj' +
- 'Q4CWFuZHJvaWQuYXBwLkFjdGl2aXR5VGhyZWFkJEgJaGFuZGxl' +
- 'TWVzc2FnZQkoTGFuZHJvaWQvb3MvTWVzc2FnZTspVglBY3Rpdm' +
- 'l0eVRocmVhZC5qYXZhCjB4NzEwNzM3NjgJYW5kcm9pZC5hcHAu' +
- 'QWN0aXZpdHlUaHJlYWQkUHJvZmlsZXIJc3RhcnRQcm9maWxpbm' +
- 'cJKClWCUFjdGl2aXR5VGhyZWFkLmphdmEKMHg3MTA3Mzc5OAlh' +
- 'bmRyb2lkLmFwcC5BY3Rpdml0eVRocmVhZCRQcm9maWxlcglzdG' +
- '9wUHJvZmlsaW5nCSgpVglBY3Rpdml0eVRocmVhZC5qYXZhCjB4' +
- 'NzEwYzQ2ZDgJYW5kcm9pZC5vcy5NZXNzYWdlCW9idGFpbgkoKU' +
- 'xhbmRyb2lkL29zL01lc3NhZ2U7CU1lc3NhZ2UuamF2YQoweDcx' +
- 'MGM0YTM4CWFuZHJvaWQub3MuTWVzc2FnZQlpc0luVXNlCSgpWg' +
- 'lNZXNzYWdlLmphdmEKMHg3MTBjNGE2OAlhbmRyb2lkLm9zLk1l' +
- 'c3NhZ2UJbWFya0luVXNlCSgpVglNZXNzYWdlLmphdmEKMHg3MT' +
- 'BjNGFmOAlhbmRyb2lkLm9zLk1lc3NhZ2UJcmVjeWNsZVVuY2hl' +
- 'Y2tlZAkoKVYJTWVzc2FnZS5qYXZhCjB4NzEwYzRmMTgJYW5kcm' +
- '9pZC5vcy5QYXJjZWwJaW5pdAkoSilWCVBhcmNlbC5qYXZhCjB4' +
- 'NzEwYzRmYTgJYW5kcm9pZC5vcy5QYXJjZWwJb2J0YWluCShKKU' +
- 'xhbmRyb2lkL29zL1BhcmNlbDsJUGFyY2VsLmphdmEKMHg3MTBj' +
- 'NTQyOAlhbmRyb2lkLm9zLlBhcmNlbAllbmZvcmNlSW50ZXJmYW' +
- 'NlCShMamF2YS9sYW5nL1N0cmluZzspVglQYXJjZWwuamF2YQow' +
- 'eDcxMGM1OWY4CWFuZHJvaWQub3MuUGFyY2VsCXJlYWRJbnQJKC' +
- 'lJCVBhcmNlbC5qYXZhCjB4NzEwYzZhNDgJYW5kcm9pZC5vcy5Q' +
- 'YXJjZWxGaWxlRGVzY3JpcHRvcgljbG9zZVdpdGhTdGF0dXMJKE' +
- 'lMamF2YS9sYW5nL1N0cmluZzspVglQYXJjZWxGaWxlRGVzY3Jp' +
- 'cHRvci5qYXZhCjB4NzEwYzZkNzgJYW5kcm9pZC5vcy5QYXJjZW' +
- 'xGaWxlRGVzY3JpcHRvcgl3cml0ZUNvbW1TdGF0dXNBbmRDbG9z' +
- 'ZQkoSUxqYXZhL2xhbmcvU3RyaW5nOylWCVBhcmNlbEZpbGVEZX' +
- 'NjcmlwdG9yLmphdmEKMHg3MTBjNmUwOAlhbmRyb2lkLm9zLlBh' +
- 'cmNlbEZpbGVEZXNjcmlwdG9yCWNsb3NlCSgpVglQYXJjZWxGaW' +
- 'xlRGVzY3JpcHRvci5qYXZhCjB4NzEwYzZmZTgJYW5kcm9pZC5v' +
- 'cy5QYXJjZWxGaWxlRGVzY3JpcHRvcglyZWxlYXNlUmVzb3VyY2' +
- 'VzCSgpVglQYXJjZWxGaWxlRGVzY3JpcHRvci5qYXZhCjB4NzEx' +
- 'NWIwZjgJYW5kcm9pZC5vcy5NZXNzYWdlUXVldWUJZW5xdWV1ZU' +
- '1lc3NhZ2UJKExhbmRyb2lkL29zL01lc3NhZ2U7SilaCU1lc3Nh' +
- 'Z2VRdWV1ZS5qYXZhCjB4NzExNWIyMTgJYW5kcm9pZC5vcy5NZX' +
- 'NzYWdlUXVldWUJbmV4dAkoKUxhbmRyb2lkL29zL01lc3NhZ2U7' +
- 'CU1lc3NhZ2VRdWV1ZS5qYXZhCjB4NzE3ZTM2MzAJZGFsdmlrLn' +
- 'N5c3RlbS5WTURlYnVnCXN0YXJ0TWV0aG9kVHJhY2luZ0ZkCShM' +
- 'amF2YS9sYW5nL1N0cmluZztMamF2YS9pby9GaWxlRGVzY3JpcH' +
- 'RvcjtJSVpJKVYJVk1EZWJ1Zy5qYXZhCjB4NzE4MTBhMjAJamF2' +
- 'YS5pby5GaWxlRGVzY3JpcHRvcglpc1NvY2tldAkoKVoJRmlsZU' +
- 'Rlc2NyaXB0b3IuamF2YQoweDcxODEwYWUwCWphdmEuaW8uRmls' +
- 'ZURlc2NyaXB0b3IJdmFsaWQJKClaCUZpbGVEZXNjcmlwdG9yLm' +
- 'phdmEKMHg3MTgxYmI4MAlsaWJjb3JlLmlvLklvVXRpbHMJY2xv' +
- 'c2UJKExqYXZhL2lvL0ZpbGVEZXNjcmlwdG9yOylWCUlvVXRpbH' +
- 'MuamF2YQoweDcxODFiYmIwCWxpYmNvcmUuaW8uSW9VdGlscwlj' +
- 'bG9zZVF1aWV0bHkJKExqYXZhL2lvL0ZpbGVEZXNjcmlwdG9yOy' +
- 'lWCUlvVXRpbHMuamF2YQoweDcxODIxZWUwCWFuZHJvaWQuYXBw' +
- 'LkFjdGl2aXR5VGhyZWFkCWFjY2VzcyQzMDAJKExhbmRyb2lkL2' +
- 'FwcC9BY3Rpdml0eVRocmVhZDtJTGphdmEvbGFuZy9PYmplY3Q7' +
- 'SUkpVglBY3Rpdml0eVRocmVhZC5qYXZhCjB4NzE4MjJhZTAJYW' +
- '5kcm9pZC5hcHAuQWN0aXZpdHlUaHJlYWQJc2VuZE1lc3NhZ2UJ' +
- 'KElMamF2YS9sYW5nL09iamVjdDtJSSlWCUFjdGl2aXR5VGhyZW' +
- 'FkLmphdmEKMHg3MTgyMmIxMAlhbmRyb2lkLmFwcC5BY3Rpdml0' +
- 'eVRocmVhZAlzZW5kTWVzc2FnZQkoSUxqYXZhL2xhbmcvT2JqZW' +
- 'N0O0lJWilWCUFjdGl2aXR5VGhyZWFkLmphdmEKMHg3MTgyMzIz' +
- 'MAlhbmRyb2lkLmFwcC5BY3Rpdml0eVRocmVhZAloYW5kbGVQcm' +
- '9maWxlckNvbnRyb2wJKFpMYW5kcm9pZC9hcHAvUHJvZmlsZXJJ' +
- 'bmZvO0kpVglBY3Rpdml0eVRocmVhZC5qYXZhCjB4NzE4MzY3MD' +
- 'AJYW5kcm9pZC5vcy5EZWJ1ZwlzdG9wTWV0aG9kVHJhY2luZwko' +
- 'KVYJRGVidWcuamF2YQoqZW5kClNMT1cDACAASxycoWkAAAAOAA' +
- 'AAAAAAAAAAAAAAAAAAjwoxNn5xxtotAKISAgCPChmE+3CT4y0A' +
- '/hsCAI8KaTcHcbbkLQAtNQIAjwoIbgxx0eQtAEc1AgCPCkhqDH' +
- 'Hk5C0AWjUCAI8KWHf7cPLkLQBoNQIAjwpZd/tw/eQtAHM1AgCP' +
- 'CnhtDHED5S0AeTUCAI8KeW0McQjlLQB+NQIAjwqwu4FxFOUtAI' +
- 'o1AgCPCoC7gXEa5S0AkDUCAI8K4AqBcSPlLQCaNQIAjwrhCoFx' +
- 'KuUtAKE1AgCPCqg/AXE65S0AsTUCAI8KIAqBcUDlLQC2NQIAjw' +
- 'ohCoFxTuUtAMU1AgCPCqk/AXFn5S0A3jUCAI8KgbuBcWzlLQDi' +
- 'NQIAjwqxu4Fxb+UtAOU1AgCPCuhvDHF15S0A6zUCAI8K6W8McX' +
- 'nlLQDvNQIAjwpJagxxfOUtAPI1AgCPCgluDHGB5S0A9zUCAI8K' +
- 'MTKCcYXlLQD6NQIAjwpJNgdxjOUtAAM2AgCPCukvB3GS5S0ACT' +
- 'YCAI8K+EoMcaTlLQAbNgIAjwr5SgxxwOUtADY2AgCPChiyFXHH' +
- '5S0APTYCAI8KKKf+cPHlLQBnNgIAjwopp/5w++UtAHE2AgCfCk' +
- 'h3BXHy2wAAu5RgAJ8KqE8McSvcAADwlGAAnwoYTwxxaNwAACyV' +
- 'YACfChlPDHGD3AAARpVgAJ8KqU8McZbcAABZlWAAnwqoTwxxrN' +
- 'wAAG6VYACfChhPDHHL3AAAjpVgAJ8KGU8MceDcAACjlWAAnwqp' +
- 'Twxx8twAALSVYACfCkgqB3Ea3QAA3ZVgAJ8KKFQMcUHdAAAFlm' +
- 'AAnwopVAxxjN0AAFGWYACfCvhZDHHD3QAAiJZgAJ8K+VkMcejd' +
- 'AACslmAAnwr4WQxxAN4AAMOWYACfCvlZDHEa3gAA3ZZgAJ8K+F' +
- 'kMcS/eAADylmAAnwr5WQxxR94AAAqXYACfCugXB3Fv3gAAM5dg' +
- 'AJ8K4B6CcYveAABPl2AAnwrgKoJxrN4AAHCXYACfChArgnHQ3g' +
- 'AAkpdgAJ8K2EYMceTeAACml2AAnwrZRgxxDd8AANCXYACfCig1' +
- 'B3Er3wAA7pdgAJ8KuDUHcT7fAAAAmGAAnwqINQdxa98AAC+YYA' +
- 'CfCigvB3GD3wAASJhgAJ8K+LAVcaDfAABjmGAAnwo4Sgxxtt8A' +
- 'AHiYYACfCjlKDHHL3wAAkJhgAJ8KaEoMce3fAACxmGAAnwppSg' +
- 'xxAuAAAMWYYACfCvmwFXFz4AAAOJlgAI8KGbIVcU3mLQBAmWAA' +
- 'jwroLwdxVuYtAEmZYACfCikvB3GG4AAASZlgAI8KSDYHcVzmLQ' +
- 'BPmWAAjwowMoJxZuYtAFmZYACfCok1B3GW4AAAWJlgAI8KmDcH' +
- 'cXTmLQBnmWAAnwq5NQdxr+AAAHGZYACPCgBng3GC5i0AdplgAJ' +
- '8KKTUHcb3gAAB/mWAAnwoRK4JxzOAAAI6ZYAA=');
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/etw_importer.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/etw_importer.html
deleted file mode 100644
index 799e2a13b95..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/etw_importer.html
+++ /dev/null
@@ -1,477 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base64.html">
-<link rel="import" href="/tracing/extras/importer/etw/eventtrace_parser.html">
-<link rel="import" href="/tracing/extras/importer/etw/process_parser.html">
-<link rel="import" href="/tracing/extras/importer/etw/thread_parser.html">
-<link rel="import" href="/tracing/importer/importer.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-/**
- * @fileoverview Imports JSON file with the raw payloads from a Windows event
- * trace into the Model. This format is outputted by Chrome running
- * on a Windows system.
- *
- * This importer assumes the events arrived as a JSON file and the payloads are
- * undecoded sequence of bytes in hex format string. The unit tests provide
- * examples of the trace format.
- *
- * The format of the system trace is
- * {
- * name: 'ETW',
- * content: [ <events> ]
- * }
- *
- * where the <events> are dictionary values with fields.
- *
- * {
- * guid: "1234-...", // The unique GUID for the event.
- * op: 12, // The opcode of the event.
- * ver: 1, // The encoding version of the event.
- * cpu: 0, // The cpu id on which the event was captured.
- * ts: 1092, // The thread id on which the event was captured.
- * payload: "aaaa" // A base64 encoded string of the raw payload.
- * }
- *
- * The payload is an undecoded version of the raw event sent by ETW.
- * This importer uses specific parsers to decode recognized events.
- * A parser need to register the recognized event by calling
- * registerEventHandler(guid, opcode, handler). The parser is responsible to
- * decode the payload and update the Model.
- *
- * The payload formats are described there:
- * http://msdn.microsoft.com/en-us/library/windows/desktop/aa364085(v=vs.85).aspx
- *
- */
-'use strict';
-
-tr.exportTo('tr.e.importer.etw', function() {
- // GUID and opcode of a Thread DCStart event, as defined at the link above.
- var kThreadGuid = '3D6FA8D1-FE05-11D0-9DDA-00C04FD7BA7C';
- var kThreadDCStartOpcode = 3;
-
- /**
- * Represents the raw bytes payload decoder.
- * @constructor
- */
- function Decoder() {
- this.payload_ = new DataView(new ArrayBuffer(256));
- };
-
- Decoder.prototype = {
- __proto__: Object.prototype,
-
- reset: function(base64_payload) {
- var decoded_size = tr.b.Base64.getDecodedBufferLength(base64_payload);
- if (decoded_size > this.payload_.byteLength)
- this.payload_ = new DataView(new ArrayBuffer(decoded_size));
-
- tr.b.Base64.DecodeToTypedArray(base64_payload, this.payload_);
- this.position_ = 0;
- },
-
- skip: function(length) {
- this.position_ += length;
- },
-
- decodeUInt8: function() {
- var result = this.payload_.getUint8(this.position_, true);
- this.position_ += 1;
- return result;
- },
-
- decodeUInt16: function() {
- var result = this.payload_.getUint16(this.position_, true);
- this.position_ += 2;
- return result;
- },
-
- decodeUInt32: function() {
- var result = this.payload_.getUint32(this.position_, true);
- this.position_ += 4;
- return result;
- },
-
- decodeUInt64ToString: function() {
- // Javascript isn't able to manage 64-bit numeric values.
- var low = this.decodeUInt32();
- var high = this.decodeUInt32();
- var low_str = ('0000000' + low.toString(16)).substr(-8);
- var high_str = ('0000000' + high.toString(16)).substr(-8);
- var result = high_str + low_str;
- return result;
- },
-
- decodeInt8: function() {
- var result = this.payload_.getInt8(this.position_, true);
- this.position_ += 1;
- return result;
- },
-
- decodeInt16: function() {
- var result = this.payload_.getInt16(this.position_, true);
- this.position_ += 2;
- return result;
- },
-
- decodeInt32: function() {
- var result = this.payload_.getInt32(this.position_, true);
- this.position_ += 4;
- return result;
- },
-
- decodeInt64ToString: function() {
- // Javascript isn't able to manage 64-bit numeric values.
- // Fallback to unsigned 64-bit hexa value.
- return this.decodeUInt64ToString();
- },
-
- decodeUInteger: function(is64) {
- if (is64)
- return this.decodeUInt64ToString();
- return this.decodeUInt32();
- },
-
- decodeString: function() {
- var str = '';
- while (true) {
- var c = this.decodeUInt8();
- if (!c)
- return str;
- str = str + String.fromCharCode(c);
- }
- },
-
- decodeW16String: function() {
- var str = '';
- while (true) {
- var c = this.decodeUInt16();
- if (!c)
- return str;
- str = str + String.fromCharCode(c);
- }
- },
-
- decodeFixedW16String: function(length) {
- var old_position = this.position_;
- var str = '';
- for (var i = 0; i < length; i++) {
- var c = this.decodeUInt16();
- if (!c)
- break;
- str = str + String.fromCharCode(c);
- }
-
- // Move the position after the fixed buffer (i.e. wchar[length]).
- this.position_ = old_position + 2 * length;
- return str;
- },
-
- decodeBytes: function(length) {
- var bytes = [];
- for (var i = 0; i < length; ++i) {
- var c = this.decodeUInt8();
- bytes.push(c);
- }
- return bytes;
- },
-
- decodeSID: function(is64) {
- // Decode the TOKEN_USER structure.
- var pSid = this.decodeUInteger(is64);
- var attributes = this.decodeUInt32();
-
- // Skip padding.
- if (is64)
- this.decodeUInt32();
-
- // Decode the SID structure.
- var revision = this.decodeUInt8();
- var subAuthorityCount = this.decodeUInt8();
- this.decodeUInt16();
- this.decodeUInt32();
-
- if (revision != 1)
- throw 'Invalid SID revision: could not decode the SID structure.';
-
- var sid = this.decodeBytes(4 * subAuthorityCount);
-
- return {
- pSid: pSid,
- attributes: attributes,
- sid: sid
- };
- },
-
- decodeSystemTime: function() {
- // Decode the SystemTime structure.
- var wYear = this.decodeInt16();
- var wMonth = this.decodeInt16();
- var wDayOfWeek = this.decodeInt16();
- var wDay = this.decodeInt16();
- var wHour = this.decodeInt16();
- var wMinute = this.decodeInt16();
- var wSecond = this.decodeInt16();
- var wMilliseconds = this.decodeInt16();
- return {
- wYear: wYear,
- wMonth: wMonth,
- wDayOfWeek: wDayOfWeek,
- wDay: wDay,
- wHour: wHour,
- wMinute: wMinute,
- wSecond: wSecond,
- wMilliseconds: wMilliseconds
- };
- },
-
- decodeTimeZoneInformation: function() {
- // Decode the TimeZoneInformation structure.
- var bias = this.decodeUInt32();
- var standardName = this.decodeFixedW16String(32);
- var standardDate = this.decodeSystemTime();
- var standardBias = this.decodeUInt32();
- var daylightName = this.decodeFixedW16String(32);
- var daylightDate = this.decodeSystemTime();
- var daylightBias = this.decodeUInt32();
- return {
- bias: bias,
- standardName: standardName,
- standardDate: standardDate,
- standardBias: standardBias,
- daylightName: daylightName,
- daylightDate: daylightDate,
- daylightBias: daylightBias
- };
- }
-
- };
-
- /**
- * Imports Windows ETW kernel events into a specified model.
- * @constructor
- */
- function EtwImporter(model, events) {
- this.importPriority = 3;
- this.model_ = model;
- this.events_ = events;
- this.handlers_ = {};
- this.decoder_ = new Decoder();
- this.walltime_ = undefined;
- this.ticks_ = undefined;
- this.is64bit_ = undefined;
-
- // A map of tids to their process pid. On Windows, the tid is global to
- // the system and doesn't need to belong to a process. As many events
- // only provide tid, this map allows to retrieve the parent process.
- this.tidsToPid_ = {};
-
- // Instantiate the parsers; this will register handlers for known events.
- var allTypeInfos = tr.e.importer.etw.Parser.getAllRegisteredTypeInfos();
- this.parsers_ = allTypeInfos.map(
- function(typeInfo) {
- return new typeInfo.constructor(this);
- }, this);
- }
-
- /**
- * Guesses whether the provided events is from a Windows ETW trace.
- * The object must has a property named 'name' with the value 'ETW' and
- * a property 'content' with all the undecoded events.
- *
- * @return {boolean} True when events is a Windows ETW array.
- */
- EtwImporter.canImport = function(events) {
- if (!events.hasOwnProperty('name') ||
- !events.hasOwnProperty('content') ||
- events.name !== 'ETW') {
- return false;
- }
-
- return true;
- };
-
- EtwImporter.prototype = {
- __proto__: tr.importer.Importer.prototype,
-
- get importerName() {
- return 'EtwImporter';
- },
-
- get model() {
- return this.model_;
- },
-
- createThreadIfNeeded: function(pid, tid) {
- this.tidsToPid_[tid] = pid;
- },
-
- removeThreadIfPresent: function(tid) {
- this.tidsToPid_[tid] = undefined;
- },
-
- getPidFromWindowsTid: function(tid) {
- if (tid == 0)
- return 0;
- var pid = this.tidsToPid_[tid];
- if (pid == undefined) {
- // Kernel threads are not defined.
- return 0;
- }
- return pid;
- },
-
- getThreadFromWindowsTid: function(tid) {
- var pid = this.getPidFromWindowsTid(tid);
- var process = this.model_.getProcess(pid);
- if (!process)
- return undefined;
- return process.getThread(tid);
- },
-
- /*
- * Retrieve the Cpu for a given cpuNumber.
- * @return {Cpu} A Cpu corresponding to the given cpuNumber.
- */
- getOrCreateCpu: function(cpuNumber) {
- var cpu = this.model_.kernel.getOrCreateCpu(cpuNumber);
- return cpu;
- },
-
- /**
- * Imports the data in this.events_ into this.model_.
- */
- importEvents: function() {
- this.events_.content.forEach(this.parseInfo.bind(this));
-
- if (this.walltime_ == undefined || this.ticks_ == undefined)
- throw Error('Cannot find clock sync information in the system trace.');
-
- if (this.is64bit_ == undefined)
- throw Error('Cannot determine pointer size of the system trace.');
-
- this.events_.content.forEach(this.parseEvent.bind(this));
- },
-
- importTimestamp: function(timestamp) {
- var ts = parseInt(timestamp, 16);
- return (ts - this.walltime_ + this.ticks_) / 1000.;
- },
-
- parseInfo: function(event) {
- // Retrieve clock sync information.
- if (event.hasOwnProperty('guid') &&
- event.hasOwnProperty('walltime') &&
- event.hasOwnProperty('tick') &&
- event.guid === 'ClockSync') {
- this.walltime_ = parseInt(event.walltime, 16);
- this.ticks_ = parseInt(event.tick, 16);
- }
-
- // Retrieve pointer size information from a Thread.DCStart event.
- if (this.is64bit_ == undefined &&
- event.hasOwnProperty('guid') &&
- event.hasOwnProperty('op') &&
- event.hasOwnProperty('ver') &&
- event.hasOwnProperty('payload') &&
- event.guid === kThreadGuid &&
- event.op == kThreadDCStartOpcode) {
- var decoded_size = tr.b.Base64.getDecodedBufferLength(event.payload);
-
- if (event.ver == 1) {
- if (decoded_size >= 52)
- this.is64bit_ = true;
- else
- this.is64bit_ = false;
- } else if (event.ver == 2) {
- if (decoded_size >= 64)
- this.is64bit_ = true;
- else
- this.is64bit_ = false;
- } else if (event.ver == 3) {
- if (decoded_size >= 60)
- this.is64bit_ = true;
- else
- this.is64bit_ = false;
- }
- }
-
- return true;
- },
-
- parseEvent: function(event) {
- if (!event.hasOwnProperty('guid') ||
- !event.hasOwnProperty('op') ||
- !event.hasOwnProperty('ver') ||
- !event.hasOwnProperty('cpu') ||
- !event.hasOwnProperty('ts') ||
- !event.hasOwnProperty('payload')) {
- return false;
- }
-
- var timestamp = this.importTimestamp(event.ts);
-
- // Create the event header.
- var header = {
- guid: event.guid,
- opcode: event.op,
- version: event.ver,
- cpu: event.cpu,
- timestamp: timestamp,
- is64: this.is64bit_
- };
-
- // Set the payload to decode.
- var decoder = this.decoder_;
- decoder.reset(event.payload);
-
- // Retrieve the handler to decode the payload.
- var handler = this.getEventHandler(header.guid, header.opcode);
- if (!handler)
- return false;
-
- if (!handler(header, decoder)) {
- this.model_.importWarning({
- type: 'parse_error',
- message: 'Malformed ' + header.guid + ' event (' + event.payload + ')'
- });
- return false;
- }
-
- return true;
- },
-
- /**
- * Registers a windows ETW event handler used by parseEvent().
- */
- registerEventHandler: function(guid, opcode, handler) {
- if (this.handlers_[guid] == undefined)
- this.handlers_[guid] = [];
- this.handlers_[guid][opcode] = handler;
- },
-
- /**
- * Retrieves a registered event handler.
- */
- getEventHandler: function(guid, opcode) {
- if (this.handlers_[guid] == undefined)
- return undefined;
- return this.handlers_[guid][opcode];
- }
-
- };
-
- // Register the EtwImporter to the Importer.
- tr.importer.Importer.register(EtwImporter);
-
- return {
- EtwImporter: EtwImporter
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/etw_importer_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/etw_importer_test.html
deleted file mode 100644
index 91a94d6c015..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/etw_importer_test.html
+++ /dev/null
@@ -1,291 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base64.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/etw/etw_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Base64 = tr.b.Base64;
-
- test('canImport', function() {
- assert.isFalse(tr.e.importer.etw.EtwImporter.canImport('string'));
- assert.isFalse(tr.e.importer.etw.EtwImporter.canImport([]));
-
- // Must not parse an invalid name.
- var dummy = { name: 'dummy', content: [] };
- assert.isFalse(tr.e.importer.etw.EtwImporter.canImport(dummy));
-
- // Must parse an empty valid trace.
- var valid = { name: 'ETW', content: [] };
- assert.isTrue(tr.e.importer.etw.EtwImporter.canImport(valid));
- });
-
- test('getModel', function() {
- var model = 'dummy';
- var events = [];
- var importer = new tr.e.importer.etw.EtwImporter(model, events);
- assert.strictEqual(importer.model, model);
- });
-
- test('registerEventHandler', function() {
- // Create a dummy EtwImporter.
- var model = 'dummy';
- var events = ['events'];
- var importer = new tr.e.importer.etw.EtwImporter(model, events);
- var dummy_handler = function() {};
-
- // The handler must not exists.
- assert.isUndefined(importer.getEventHandler('ABCDEF', 2));
-
- // Register an event handler for guid: ABCDEF and opcode: 2.
- importer.registerEventHandler('ABCDEF', 2, dummy_handler);
-
- // The handler exists now, must find it.
- assert.isDefined(importer.getEventHandler('ABCDEF', 2));
-
- // Must be able to manage an invalid handler.
- assert.isUndefined(importer.getEventHandler('zzzzzz', 2));
- });
-
- test('parseEvent', function() {
- var model = 'dummy';
- var events = [];
- var importer = new tr.e.importer.etw.EtwImporter(model, events);
- var handler_called = false;
- var dummy_handler = function() { handler_called = true; return true; };
-
- // Register a valid handler.
- importer.registerEventHandler('aaaa', 42, dummy_handler);
-
- // Try to parse an invalid event with missing fields.
- var incomplet_event = { guid: 'aaaa', 'op': 42, 'ver': 0 };
- assert.isFalse(importer.parseEvent(incomplet_event));
- assert.isFalse(handler_called);
-
- // Try to parse a valid event.
- var valid_event = {
- guid: 'aaaa', 'op': 42, 'ver': 0, 'cpu': 0, 'ts': 0,
- 'payload': Base64.btoa('0')
- };
- assert.isTrue(importer.parseEvent(valid_event));
- assert.isTrue(handler_called);
- });
-
- test('resetTooSmall', function() {
- var importer = new tr.e.importer.etw.EtwImporter('dummy', []);
- var decoder = importer.decoder_;
-
- var oldByteLength = decoder.payload_.byteLength;
- // Decode a payload too big for the actual buffer.
- decoder.reset('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==');
- var newByteLength = decoder.payload_.byteLength;
-
- // Validate the buffer has been resized.
- assert.isBelow(oldByteLength, newByteLength);
- });
-
- test('decode', function() {
- var model = 'dummy';
- var events = [];
- var importer = new tr.e.importer.etw.EtwImporter(model, events);
-
- var decoder = importer.decoder_;
-
- decoder.reset('YQBiYw==');
- assert.equal(decoder.decodeInt32(), 0x63620061);
-
- // Decode unsigned numbers.
- decoder.reset('AQ==');
- assert.equal(decoder.decodeUInt8(), 0x01);
-
- decoder.reset('AQI=');
- assert.equal(decoder.decodeUInt16(), 0x0201);
-
- decoder.reset('AQIDBA==');
- assert.equal(decoder.decodeUInt32(), 0x04030201);
-
- decoder.reset('AQIDBAUGBwg=');
- assert.strictEqual(decoder.decodeUInt64ToString(), '0807060504030201');
-
- // Decode signed numbers.
- decoder.reset('AQ==');
- assert.equal(decoder.decodeInt8(), 0x01);
-
- decoder.reset('AQI=');
- assert.equal(decoder.decodeInt16(), 0x0201);
-
- decoder.reset('AQIDBA==');
- assert.equal(decoder.decodeInt32(), 0x04030201);
-
- decoder.reset('AQIDBAUGBwg=');
- assert.strictEqual(decoder.decodeInt64ToString(), '0807060504030201');
-
- // Last value before being a signed number.
- decoder.reset('fw==');
- assert.equal(decoder.decodeInt8(), 127);
-
- // Decode negative numbers.
- decoder.reset('1g==');
- assert.equal(decoder.decodeInt8(), -42);
-
- decoder.reset('gA==');
- assert.equal(decoder.decodeInt8(), -128);
-
- decoder.reset('hYI=');
- assert.equal(decoder.decodeInt16(), -32123);
-
- decoder.reset('hYL//w==');
- assert.equal(decoder.decodeInt32(), -32123);
-
- decoder.reset('Lv1ptv////8=');
- assert.equal(decoder.decodeInt32(), -1234567890);
-
- // Decode number with zero (nul) in the middle of the string.
- decoder.reset('YQBiYw==');
- assert.equal(decoder.decodeInt32(), 0x63620061);
- });
-
- test('decodeUInteger', function() {
- var importer = new tr.e.importer.etw.EtwImporter('dummy', []);
- var decoder = importer.decoder_;
-
- decoder.reset('AQIDBAUGBwg=');
- assert.equal(decoder.decodeUInteger(false), 0x04030201);
-
- decoder.reset('AQIDBAUGBwg=');
- assert.strictEqual(decoder.decodeUInteger(true), '0807060504030201');
- });
-
- test('decodeString', function() {
- var importer = new tr.e.importer.etw.EtwImporter('dummy', []);
- var decoder = importer.decoder_;
-
- decoder.reset('dGVzdAA=');
- assert.strictEqual(decoder.decodeString(), 'test');
-
- decoder.reset('VGhpcyBpcyBhIHRlc3Qu');
- assert.strictEqual(decoder.decodeString(), 'This is a test.');
- });
-
- test('decodeW16String', function() {
- var importer = new tr.e.importer.etw.EtwImporter('dummy', []);
- var decoder = importer.decoder_;
- decoder.reset('dABlAHMAdAAAAA==');
- assert.strictEqual(decoder.decodeW16String(), 'test');
- });
-
- test('decodeFixedW16String', function() {
- var importer = new tr.e.importer.etw.EtwImporter('dummy', []);
- var decoder = importer.decoder_;
- decoder.reset('dABlAHMAdAAAAA==');
- assert.strictEqual(decoder.decodeFixedW16String(32), 'test');
- assert.equal(decoder.position_, 64);
-
- decoder.reset('dABlAHMAdAAAAA==');
- assert.strictEqual(decoder.decodeFixedW16String(1), 't');
- assert.equal(decoder.position_, 2);
- });
-
- test('decodeBytes', function() {
- var importer = new tr.e.importer.etw.EtwImporter('dummy', []);
- var decoder = importer.decoder_;
- decoder.reset('AAECAwQFBgc=');
- var bytes = decoder.decodeBytes(8);
- for (var i = 0; i < bytes.length; ++i)
- assert.equal(bytes[i], i);
- });
-
- test('decodeSID', function() {
- var importer = new tr.e.importer.etw.EtwImporter('dummy', []);
- var decoder = importer.decoder_;
-
- // Decode a SID structure with 64-bit pointer.
- decoder.reset(
- 'AQIDBAECAwQFBAMCAAAAAAEFAAAAAAAFFQAAAAECAwQFBgcICQoLDA0DAAA=');
- var sid = decoder.decodeSID(true);
-
- assert.strictEqual(sid.pSid, '0403020104030201');
- assert.equal(sid.attributes, 0x02030405);
- assert.equal(sid.sid.length, 20);
- });
-
- test('decodeSystemTime', function() {
- var importer = new tr.e.importer.etw.EtwImporter('dummy', []);
- var decoder = importer.decoder_;
-
- // Decode a SystemTime structure.
- decoder.reset('AQACAAMABAAFAAYABwAIAA==');
- var time = decoder.decodeSystemTime();
- assert.equal(time.wYear, 1);
- assert.equal(time.wMonth, 2);
- assert.equal(time.wDayOfWeek, 3);
- assert.equal(time.wDay, 4);
- assert.equal(time.wHour, 5);
- assert.equal(time.wMinute, 6);
- assert.equal(time.wSecond, 7);
- assert.equal(time.wMilliseconds, 8);
- });
-
- test('decodeTimeZoneInformation', function() {
- var importer = new tr.e.importer.etw.EtwImporter('dummy', []);
- var decoder = importer.decoder_;
-
- // Decode a TimeZoneInformation structure.
- decoder.reset('AQIDBGEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAIAAwAEAAUABgAHAAgABA' +
- 'MCAWIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAIAAwAEAAUABgAHAAgACAgI' +
- 'CA==');
- var time = decoder.decodeTimeZoneInformation();
-
- assert.equal(time.bias, 0x04030201);
- assert.equal(time.standardBias, 0x01020304);
- assert.equal(time.daylightBias, 0x08080808);
- assert.strictEqual(time.standardName, 'a');
- assert.strictEqual(time.daylightName, 'b');
- });
-
- test('manageThreads', function() {
- var events = [];
- var model = 'dummy';
- var importer = new tr.e.importer.etw.EtwImporter(model, events);
-
- // After initialisation, no threads must exists.
- assert.equal(Object.getOwnPropertyNames(importer.tidsToPid_).length, 0);
-
- // Add some threads.
- var thread10 = importer.createThreadIfNeeded(1, 10);
- var thread11 = importer.createThreadIfNeeded(1, 11);
- var thread20 = importer.createThreadIfNeeded(2, 20);
-
- assert.equal(Object.getOwnPropertyNames(importer.tidsToPid_).length, 3);
- assert.isTrue(importer.tidsToPid_.hasOwnProperty(10));
- assert.isTrue(importer.tidsToPid_.hasOwnProperty(11));
- assert.isTrue(importer.tidsToPid_.hasOwnProperty(20));
-
- // Retrieve existing threads and processes.
- var pid10 = importer.getPidFromWindowsTid(10);
- var pid11 = importer.getPidFromWindowsTid(11);
- var pid20 = importer.getPidFromWindowsTid(20);
-
- assert.equal(pid10, 1);
- assert.equal(pid11, 1);
- assert.equal(pid20, 2);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/eventtrace_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/eventtrace_parser.html
deleted file mode 100644
index 14c1dcf5c1b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/eventtrace_parser.html
+++ /dev/null
@@ -1,110 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/etw/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses EventTrace events in the Windows event trace format.
- */
-
-tr.exportTo('tr.e.importer.etw', function() {
- var Parser = tr.e.importer.etw.Parser;
-
- // Constants for EventTrace events.
- var guid = '68FDD900-4A3E-11D1-84F4-0000F80464E3';
- var kEventTraceHeaderOpcode = 0;
-
- /**
- * Parses Windows EventTrace trace events.
- * @constructor
- */
- function EventTraceParser(importer) {
- Parser.call(this, importer);
-
- // Register handlers.
- importer.registerEventHandler(guid, kEventTraceHeaderOpcode,
- EventTraceParser.prototype.decodeHeader.bind(this));
- }
-
- EventTraceParser.prototype = {
- __proto__: Parser.prototype,
-
- decodeFields: function(header, decoder) {
- if (header.version != 2)
- throw new Error('Incompatible EventTrace event version.');
-
- var bufferSize = decoder.decodeUInt32();
- var version = decoder.decodeUInt32();
- var providerVersion = decoder.decodeUInt32();
- var numberOfProcessors = decoder.decodeUInt32();
- var endTime = decoder.decodeUInt64ToString();
- var timerResolution = decoder.decodeUInt32();
- var maxFileSize = decoder.decodeUInt32();
- var logFileMode = decoder.decodeUInt32();
- var buffersWritten = decoder.decodeUInt32();
- var startBuffers = decoder.decodeUInt32();
- var pointerSize = decoder.decodeUInt32();
- var eventsLost = decoder.decodeUInt32();
- var cpuSpeed = decoder.decodeUInt32();
- var loggerName = decoder.decodeUInteger(header.is64);
- var logFileName = decoder.decodeUInteger(header.is64);
- var timeZoneInformation = decoder.decodeTimeZoneInformation();
- var padding = decoder.decodeUInt32();
- var bootTime = decoder.decodeUInt64ToString();
- var perfFreq = decoder.decodeUInt64ToString();
- var startTime = decoder.decodeUInt64ToString();
- var reservedFlags = decoder.decodeUInt32();
- var buffersLost = decoder.decodeUInt32();
- var sessionNameString = decoder.decodeW16String();
- var logFileNameString = decoder.decodeW16String();
-
- return {
- bufferSize: bufferSize,
- version: version,
- providerVersion: providerVersion,
- numberOfProcessors: numberOfProcessors,
- endTime: endTime,
- timerResolution: timerResolution,
- maxFileSize: maxFileSize,
- logFileMode: logFileMode,
- buffersWritten: buffersWritten,
- startBuffers: startBuffers,
- pointerSize: pointerSize,
- eventsLost: eventsLost,
- cpuSpeed: cpuSpeed,
- loggerName: loggerName,
- logFileName: logFileName,
- timeZoneInformation: timeZoneInformation,
- bootTime: bootTime,
- perfFreq: perfFreq,
- startTime: startTime,
- reservedFlags: reservedFlags,
- buffersLost: buffersLost,
- sessionNameString: sessionNameString,
- logFileNameString: logFileNameString
- };
- },
-
- decodeHeader: function(header, decoder) {
- var fields = this.decodeFields(header, decoder);
- // TODO(etienneb): Update the Model with |fields|.
- return true;
- }
-
- };
-
- Parser.register(EventTraceParser);
-
- return {
- EventTraceParser: EventTraceParser
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/eventtrace_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/eventtrace_parser_test.html
deleted file mode 100644
index 840eb5ef06a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/eventtrace_parser_test.html
+++ /dev/null
@@ -1,120 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/etw/etw_importer.html">
-<link rel="import" href="/tracing/extras/importer/etw/eventtrace_parser.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- // Constants for EventTrace events.
- var guid = '68FDD900-4A3E-11D1-84F4-0000F80464E3';
- var kEventTraceHeaderOpcode = 0;
-
- var kEventTraceHeaderPayload32bitV2 =
- 'AAABAAYBAQWwHQAAEAAAABEs1WHICMwBYWECAGQAAAABAAAAAwAAAAEAAAAEAAAAAAAAA' +
- 'FoJAAAFAAAABgAAACwBAABAAHQAegByAGUAcwAuAGQAbABsACwALQAxADEAMgAAAAAAAA' +
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALAAAAAQACAAAAAAAAAAAAAABAAHQ' +
- 'AegByAGUAcwAuAGQAbABsACwALQAxADEAMQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' +
- 'AAAAAAAAAAAAAAADAAAAAgACAAAAAAAAAMT///8AAAAAf0Ob368FzAGdrCMAAAAAACw0o' +
- '2DICMwBAQAAAAAAAABNAGEAawBlACAAVABlAHMAdAAgAEQAYQB0AGEAIABTAGUAcwBzAG' +
- 'kAbwBuAAAAYwA6AFwAcwByAGMAXABzAGEAdwBiAHUAYwBrAFwAdAByAHUAbgBrAFwAcwB' +
- 'yAGMAXABzAGEAdwBiAHUAYwBrAFwAbABvAGcAXwBsAGkAYgBcAHQAZQBzAHQAXwBkAGEA' +
- 'dABhAFwAaQBtAGEAZwBlAF8AZABhAHQAYQBfADMAMgBfAHYAMAAuAGUAdABsAAAA';
-
- var kEventTraceHeaderPayload64bitV2 =
- 'AAABAAYBAQWxHQAABAAAADsuzRRYLM8BYWECAAAAAAABAAEAtgEAAAEAAAAIAAAAHwAAA' +
- 'KAGAAAAAAAAAAAAAAAAAAAAAAAALAEAAEAAdAB6AHIAZQBzAC4AZABsAGwALAAtADEAMQ' +
- 'AyAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAAAABAAIAAAAAAAA' +
- 'AAAAAAEAAdAB6AHIAZQBzAC4AZABsAGwALAAtADEAMQAxAAAAAAAAAAAAAAAAAAAAAAAA' +
- 'AAAAAAAAAAAAAAAAAAAAAAAAAAMAAAACAAIAAAAAAAAAxP///wAAAABZQyWiwCvPAX1GG' +
- 'QAAAAAALWSZBFgszwEBAAAAAAAAAFIAZQBsAG8AZwBnAGUAcgAAAEMAOgBcAGsAZQByAG' +
- '4AZQBsAC4AZQB0AGwAAAA=';
-
- test('DecodeFields', function() {
-
- var importer = new tr.e.importer.etw.EtwImporter('dummy', []);
- var decoder = importer.decoder_;
- var parser = new tr.e.importer.etw.EventTraceParser(importer);
- var header;
- var fields;
-
- // Validate a version 2 32-bit payload.
- header = {
- guid: guid, opcode: kEventTraceHeaderOpcode, version: 2, is64: 0
- };
- decoder.reset(kEventTraceHeaderPayload32bitV2);
- fields = parser.decodeFields(header, decoder);
-
- assert.equal(fields.bufferSize, 65536);
- assert.equal(fields.version, 83951878);
- assert.equal(fields.providerVersion, 7600);
- assert.equal(fields.numberOfProcessors, 16);
- assert.strictEqual(fields.endTime, '01cc08c861d52c11');
- assert.equal(fields.timerResolution, 156001);
- assert.equal(fields.maxFileSize, 100);
- assert.equal(fields.logFileMode, 1);
- assert.equal(fields.buffersWritten, 3);
- assert.equal(fields.startBuffers, 1);
- assert.equal(fields.pointerSize, 4);
- assert.equal(fields.eventsLost, 0);
- assert.equal(fields.cpuSpeed, 2394);
- assert.equal(fields.loggerName, 5);
- assert.equal(fields.logFileName, 6);
- assert.strictEqual(fields.timeZoneInformation.standardName,
- '@tzres.dll,-112');
- assert.strictEqual(fields.timeZoneInformation.daylightName,
- '@tzres.dll,-111');
- assert.strictEqual(fields.bootTime, '01cc05afdf9b437f');
- assert.strictEqual(fields.perfFreq, '000000000023ac9d');
- assert.strictEqual(fields.startTime, '01cc08c860a3342c');
- assert.equal(fields.reservedFlags, 1);
- assert.equal(fields.buffersLost, 0);
- assert.strictEqual(fields.sessionNameString, 'Make Test Data Session');
- assert.strictEqual(fields.logFileNameString,
- 'c:\\src\\sawbuck\\trunk\\src\\sawbuck\\log_lib\\' +
- 'test_data\\image_data_32_v0.etl');
-
- // Validate a version 2 64-bit payload.
- header = {
- guid: guid, opcode: kEventTraceHeaderOpcode, version: 2, is64: 1
- };
- decoder.reset(kEventTraceHeaderPayload64bitV2);
- fields = parser.decodeFields(header, decoder);
-
- assert.equal(fields.bufferSize, 65536);
- assert.equal(fields.version, 83951878);
- assert.equal(fields.providerVersion, 7601);
- assert.equal(fields.numberOfProcessors, 4);
- assert.strictEqual(fields.endTime, '01cf2c5814cd2e3b');
- assert.equal(fields.timerResolution, 156001);
- assert.equal(fields.maxFileSize, 0);
- assert.equal(fields.logFileMode, 0x10001);
- assert.equal(fields.buffersWritten, 438);
- assert.equal(fields.startBuffers, 1);
- assert.equal(fields.pointerSize, 8);
- assert.equal(fields.eventsLost, 31);
- assert.equal(fields.cpuSpeed, 1696);
- assert.equal(fields.loggerName, 0);
- assert.equal(fields.logFileName, 0);
- assert.strictEqual(fields.timeZoneInformation.standardName,
- '@tzres.dll,-112');
- assert.strictEqual(fields.timeZoneInformation.daylightName,
- '@tzres.dll,-111');
- assert.strictEqual(fields.bootTime, '01cf2bc0a2254359');
- assert.strictEqual(fields.perfFreq, '000000000019467d');
- assert.strictEqual(fields.startTime, '01cf2c580499642d');
- assert.equal(fields.reservedFlags, 1);
- assert.equal(fields.buffersLost, 0);
- assert.strictEqual(fields.sessionNameString, 'Relogger');
- assert.strictEqual(fields.logFileNameString, 'C:\\kernel.etl');
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/parser.html
deleted file mode 100644
index 414defe510b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/parser.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/extension_registry.html">
-<script>
-'use strict';
-
-/**
- * @fileoverview Base class for Windows ETW event parsers.
- *
- * The ETW trace event importer depends on subclasses of
- * Parser to parse event data. Each subclass corresponds
- * to a group of trace events; e.g. Thread and Process implements
- * decoding of scheduling events. Parser subclasses must
- * call Parser.register to arrange to be instantiated
- * and their constructor must register their event handlers with the
- * importer. For example,
- *
- * var Parser = tr.e.importer.etw.Parser;
- *
- * function ThreadParser(importer) {
- * Parser.call(this, importer);
- *
- * importer.registerEventHandler(guid, kThreadStartOpcode,
- * ThreadParser.prototype.decodeStart.bind(this));
- * importer.registerEventHandler(guid, kThreadEndOpcode,
- * ThreadParser.prototype.decodeEnd.bind(this));
- * }
- *
- * Parser.register(ThreadParser);
- *
- * When a registered event is found, the associated event handler is invoked:
- *
- * decodeStart: function(header, decoder) {
- * [...]
- * return true;
- * },
- *
- * If the routine returns false the caller will generate an import error
- * saying there was a problem parsing it. Handlers can also emit import
- * messages using this.importer.model.importWarning. If this is done in lieu of
- * the generic import error it may be desirable for the handler to return
- * true.
- *
- */
-tr.exportTo('tr.e.importer.etw', function() {
- /**
- * Parses Windows ETW events.
- * @constructor
- */
- function Parser(importer) {
- this.importer = importer;
- this.model = importer.model;
- }
-
- Parser.prototype = {
- __proto__: Object.prototype
- };
-
- var options = new tr.b.ExtensionRegistryOptions(tr.b.BASIC_REGISTRY_MODE);
- options.mandatoryBaseClass = Parser;
- tr.b.decorateExtensionRegistry(Parser, options);
-
-
- return {
- Parser: Parser
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/process_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/process_parser.html
deleted file mode 100644
index 51f1e9b51aa..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/process_parser.html
+++ /dev/null
@@ -1,181 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/etw/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses processes events in the Windows event trace format.
- *
- * The Windows process events are:
- *
- * - DCStart: Describes a process that was already running when the trace
- * started. ETW automatically generates these events for all running
- * processes at the beginning of the trace.
- * - Start: Describes a process launched during the tracing session.
- * - End: Describes a process that ended during the tracing session.
- * - DCEnd: Describes a process that was still running when the trace ended.
- *
- * See http://msdn.microsoft.com/library/windows/desktop/aa364092.aspx
- */
-tr.exportTo('tr.e.importer.etw', function() {
- var Parser = tr.e.importer.etw.Parser;
-
- // Constants for Process events.
- var guid = '3D6FA8D0-FE05-11D0-9DDA-00C04FD7BA7C';
- var kProcessStartOpcode = 1;
- var kProcessEndOpcode = 2;
- var kProcessDCStartOpcode = 3;
- var kProcessDCEndOpcode = 4;
- var kProcessDefunctOpcode = 39;
-
- /**
- * Parses Windows process trace events.
- * @constructor
- */
- function ProcessParser(importer) {
- Parser.call(this, importer);
-
- // Register handlers.
- importer.registerEventHandler(guid, kProcessStartOpcode,
- ProcessParser.prototype.decodeStart.bind(this));
- importer.registerEventHandler(guid, kProcessEndOpcode,
- ProcessParser.prototype.decodeEnd.bind(this));
- importer.registerEventHandler(guid, kProcessDCStartOpcode,
- ProcessParser.prototype.decodeDCStart.bind(this));
- importer.registerEventHandler(guid, kProcessDCEndOpcode,
- ProcessParser.prototype.decodeDCEnd.bind(this));
- importer.registerEventHandler(guid, kProcessDefunctOpcode,
- ProcessParser.prototype.decodeDefunct.bind(this));
- }
-
- ProcessParser.prototype = {
- __proto__: Parser.prototype,
-
- decodeFields: function(header, decoder) {
- if (header.version > 5)
- throw new Error('Incompatible Process event version.');
-
- var pageDirectoryBase;
- if (header.version == 1)
- pageDirectoryBase = decoder.decodeUInteger(header.is64);
-
- var uniqueProcessKey;
- if (header.version >= 2)
- uniqueProcessKey = decoder.decodeUInteger(header.is64);
-
- var processId = decoder.decodeUInt32();
- var parentId = decoder.decodeUInt32();
-
- var sessionId;
- var exitStatus;
- if (header.version >= 1) {
- sessionId = decoder.decodeUInt32();
- exitStatus = decoder.decodeInt32();
- }
-
- var directoryTableBase;
- if (header.version >= 3)
- directoryTableBase = decoder.decodeUInteger(header.is64);
-
- var flags;
- if (header.version >= 4)
- flags = decoder.decodeUInt32();
-
- var userSID = decoder.decodeSID(header.is64);
-
- var imageFileName;
- if (header.version >= 1)
- imageFileName = decoder.decodeString();
-
- var commandLine;
- if (header.version >= 2)
- commandLine = decoder.decodeW16String();
-
- var packageFullName;
- var applicationId;
- if (header.version >= 4) {
- packageFullName = decoder.decodeW16String();
- applicationId = decoder.decodeW16String();
- }
-
- var exitTime;
- if (header.version == 5 && header.opcode == kProcessDefunctOpcode)
- exitTime = decoder.decodeUInt64ToString();
-
- return {
- pageDirectoryBase: pageDirectoryBase,
- uniqueProcessKey: uniqueProcessKey,
- processId: processId,
- parentId: parentId,
- sessionId: sessionId,
- exitStatus: exitStatus,
- directoryTableBase: directoryTableBase,
- flags: flags,
- userSID: userSID,
- imageFileName: imageFileName,
- commandLine: commandLine,
- packageFullName: packageFullName,
- applicationId: applicationId,
- exitTime: exitTime
- };
- },
-
- decodeStart: function(header, decoder) {
- var fields = this.decodeFields(header, decoder);
- var process = this.model.getOrCreateProcess(fields.processId);
- if (process.hasOwnProperty('has_ended')) {
- // On Windows, a process ID used by a process could be reused as soon as
- // the process ends (there is no pid cycling like on Linux). However, in
- // a short trace, this is unlikely to happen.
- throw new Error('Process clash detected.');
- }
- process.name = fields.imageFileName;
- return true;
- },
-
- decodeEnd: function(header, decoder) {
- var fields = this.decodeFields(header, decoder);
- var process = this.model.getOrCreateProcess(fields.processId);
- process.has_ended = true;
- return true;
- },
-
- decodeDCStart: function(header, decoder) {
- var fields = this.decodeFields(header, decoder);
- var process = this.model.getOrCreateProcess(fields.processId);
- if (process.hasOwnProperty('has_ended'))
- throw new Error('Process clash detected.');
- process.name = fields.imageFileName;
- return true;
- },
-
- decodeDCEnd: function(header, decoder) {
- var fields = this.decodeFields(header, decoder);
- var process = this.model.getOrCreateProcess(fields.processId);
- process.has_ended = true;
- return true;
- },
-
- decodeDefunct: function(header, decoder) {
- var fields = this.decodeFields(header, decoder);
- // TODO(etienneb): Update the Model with |fields|.
- return true;
- }
-
- };
-
- Parser.register(ProcessParser);
-
- return {
- ProcessParser: ProcessParser
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/process_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/process_parser_test.html
deleted file mode 100644
index 3f98e83c08a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/process_parser_test.html
+++ /dev/null
@@ -1,150 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/etw/etw_importer.html">
-<link rel="import" href="/tracing/extras/importer/etw/process_parser.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- // Constants for Process events.
- var guid = '3D6FA8D0-FE05-11D0-9DDA-00C04FD7BA7C';
- var kProcessStartOpcode = 1;
- var kProcessDefunctOpcode = 39;
-
- var kProcessStartPayload32bitV1 =
- 'AAAAAPAGAADcAwAAAQAAAAMBAAAAAAAAAAAAAAEFAAAAAAAFFQAAAJYs7Cxo/TEG8dyk0' +
- '+gDAABub3RlcGFkLmV4ZQA=';
-
- var kProcessStartPayload32bitV2 =
- 'AAAAAPAGAADcAwAAAQAAAAMBAAAAAAAAAAAAAAEFAAAAAAAFFQAAAJYs7Cxo/TEG8dyk0' +
- '+gDAABub3RlcGFkLmV4ZQAiAEMAOgBcAFcAaQBuAGQAbwB3AHMAXABzAHkAcwB0AGUAbQ' +
- 'AzADIAXABuAG8AdABlAHAAYQBkAC4AZQB4AGUAIgAgAAAA';
-
- var kProcessStartPayload32bitV3 =
- 'AAAAAPAGAADcAwAAAQAAAAMBAAAAAAAAAAAAAAAAAAABBQAAAAAABRUAAACWLOwsaP0xB' +
- 'vHcpNPoAwAAbm90ZXBhZC5leGUAIgBDADoAXABXAGkAbgBkAG8AdwBzAFwAcwB5AHMAdA' +
- 'BlAG0AMwAyAFwAbgBvAHQAZQBwAGEAZAAuAGUAeABlACIAIAAAAA==';
-
- var kProcessStartPayload64bitV3 =
- 'YIBiD4D6//8AGgAAoBwAAAEAAAADAQAAAPBDHQEAAAAwVlMVoPj//wAAAACg+P//AQUAA' +
- 'AAAAAUVAAAAAgMBAgMEBQYHCAkKCwwAAHhwZXJmLmV4ZQB4AHAAZQByAGYAIAAgAC0AZA' +
- 'AgAG8AdQB0AC4AZQB0AGwAAAA=';
-
- var kProcessStartPayload64bitV4 =
- 'gED8GgDg//+MCgAACBcAAAUAAAADAQAAALCiowAAAAAAAAAAkPBXBADA//8AAAAAAAAAA' +
- 'AEFAAAAAAAFFQAAAAECAwQFBgcICQoLBukDAAB4cGVyZi5leGUAeABwAGUAcgBmACAAIA' +
- 'AtAHMAdABvAHAAAAAAAAAA';
-
- var kProcessDefunctPayload64bitV5 =
- 'wMXyBgDg//9IGQAAEAgAAAEAAAAAAAAAAGDLTwAAAAAAAAAA8OU7AwDA//8AAAAAAAAMA' +
- 'AEFAAAAAAAFFQAAAMDBwsPExcbH0NHS09QDAABjaHJvbWUuZXhlAAAAAAAAAI1Jovns+s' +
- '4B';
-
- test('DecodeFields', function() {
-
- var importer = new tr.e.importer.etw.EtwImporter('dummy', []);
- var decoder = importer.decoder_;
- var parser = new tr.e.importer.etw.ProcessParser(importer);
- var header;
- var fields;
-
- // Validate a version 1 32-bit payload.
- header = { guid: guid, opcode: kProcessStartOpcode, version: 1, is64: 0 };
- decoder.reset(kProcessStartPayload32bitV1);
- fields = parser.decodeFields(header, decoder);
-
- assert.equal(fields.pageDirectoryBase, 0);
- assert.equal(fields.processId, 1776);
- assert.equal(fields.parentId, 988);
- assert.equal(fields.sessionId, 1);
- assert.equal(fields.exitStatus, 259);
- assert.strictEqual(fields.imageFileName, 'notepad.exe');
-
- // Validate a version 2 32-bit payload.
- header = { guid: guid, opcode: kProcessStartOpcode, version: 2, is64: 0 };
- decoder.reset(kProcessStartPayload32bitV2);
- fields = parser.decodeFields(header, decoder);
-
- assert.equal(fields.uniqueProcessKey, 0);
- assert.equal(fields.processId, 1776);
- assert.equal(fields.parentId, 988);
- assert.equal(fields.sessionId, 1);
- assert.equal(fields.exitStatus, 259);
- assert.strictEqual(fields.imageFileName, 'notepad.exe');
- assert.strictEqual(fields.commandLine,
- '\"C:\\Windows\\system32\\notepad.exe\" ');
-
- // Validate a version 3 32-bit payload.
- header = { guid: guid, opcode: kProcessStartOpcode, version: 3, is64: 0 };
- decoder.reset(kProcessStartPayload32bitV3);
- fields = parser.decodeFields(header, decoder);
-
- assert.equal(fields.uniqueProcessKey, 0);
- assert.equal(fields.processId, 1776);
- assert.equal(fields.parentId, 988);
- assert.equal(fields.sessionId, 1);
- assert.equal(fields.exitStatus, 259);
- assert.equal(fields.directoryTableBase, 0);
- assert.strictEqual(fields.imageFileName, 'notepad.exe');
- assert.strictEqual(fields.commandLine,
- '\"C:\\Windows\\system32\\notepad.exe\" ');
-
- // Validate a version 3 64-bit payload.
- header = { guid: guid, opcode: kProcessStartOpcode, version: 3, is64: 1 };
- decoder.reset(kProcessStartPayload64bitV3);
- fields = parser.decodeFields(header, decoder);
-
- assert.strictEqual(fields.uniqueProcessKey, 'fffffa800f628060');
- assert.equal(fields.processId, 6656);
- assert.equal(fields.parentId, 7328);
- assert.equal(fields.sessionId, 1);
- assert.equal(fields.exitStatus, 259);
- assert.strictEqual(fields.directoryTableBase, '000000011d43f000');
- assert.strictEqual(fields.imageFileName, 'xperf.exe');
- assert.strictEqual(fields.commandLine, 'xperf -d out.etl');
-
- // Validate a version 4 64-bit payload.
- header = { guid: guid, opcode: kProcessStartOpcode, version: 4, is64: 1 };
- decoder.reset(kProcessStartPayload64bitV4);
- fields = parser.decodeFields(header, decoder);
-
- assert.equal(fields.uniqueProcessKey, 'ffffe0001afc4080');
- assert.equal(fields.processId, 2700);
- assert.equal(fields.parentId, 5896);
- assert.equal(fields.sessionId, 5);
- assert.equal(fields.exitStatus, 259);
- assert.equal(fields.directoryTableBase, '00000000a3a2b000');
- assert.equal(fields.flags, 0);
- assert.strictEqual(fields.imageFileName, 'xperf.exe');
- assert.strictEqual(fields.commandLine, 'xperf -stop');
- assert.strictEqual(fields.packageFullName, '');
- assert.strictEqual(fields.applicationId, '');
-
- // Validate a version 5 64-bit payload.
- header = { guid: guid, opcode: kProcessDefunctOpcode, version: 5, is64: 1 };
- decoder.reset(kProcessDefunctPayload64bitV5);
- fields = parser.decodeFields(header, decoder);
-
- assert.strictEqual(fields.uniqueProcessKey, 'ffffe00006f2c5c0');
- assert.equal(fields.processId, 6472);
- assert.equal(fields.parentId, 2064);
- assert.equal(fields.sessionId, 1);
- assert.equal(fields.exitStatus, 0);
- assert.strictEqual(fields.directoryTableBase, '000000004fcb6000');
- assert.equal(fields.flags, 0);
- assert.strictEqual(fields.imageFileName, 'chrome.exe');
- assert.strictEqual(fields.commandLine, '');
- assert.strictEqual(fields.packageFullName, '');
- assert.strictEqual(fields.applicationId, '');
- assert.strictEqual(fields.exitTime, '01cefaecf9a2498d');
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/thread_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/thread_parser.html
deleted file mode 100644
index d4f75d1e4e5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/thread_parser.html
+++ /dev/null
@@ -1,243 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/etw/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses threads events in the Windows event trace format.
- *
- * The Windows thread events are:
- *
- * - DCStart: Describes a thread that was already running when the trace
- * started. ETW automatically generates these events for all running
- * threads at the beginning of the trace.
- * - Start: Describes a thread that started during the tracing session.
- * - End: Describes a thread that ended during the tracing session.
- * - DCEnd: Describes a thread that was still alive when the trace ended.
- *
- * See http://msdn.microsoft.com/library/windows/desktop/aa364132.aspx
- */
-tr.exportTo('tr.e.importer.etw', function() {
- var Parser = tr.e.importer.etw.Parser;
-
- // Constants for Thread events.
- var guid = '3D6FA8D1-FE05-11D0-9DDA-00C04FD7BA7C';
- var kThreadStartOpcode = 1;
- var kThreadEndOpcode = 2;
- var kThreadDCStartOpcode = 3;
- var kThreadDCEndOpcode = 4;
- var kThreadCSwitchOpcode = 36;
-
- /**
- * Parses Windows threads trace events.
- * @constructor
- */
- function ThreadParser(importer) {
- Parser.call(this, importer);
-
- // Register handlers.
- importer.registerEventHandler(guid, kThreadStartOpcode,
- ThreadParser.prototype.decodeStart.bind(this));
- importer.registerEventHandler(guid, kThreadEndOpcode,
- ThreadParser.prototype.decodeEnd.bind(this));
- importer.registerEventHandler(guid, kThreadDCStartOpcode,
- ThreadParser.prototype.decodeDCStart.bind(this));
- importer.registerEventHandler(guid, kThreadDCEndOpcode,
- ThreadParser.prototype.decodeDCEnd.bind(this));
- importer.registerEventHandler(guid, kThreadCSwitchOpcode,
- ThreadParser.prototype.decodeCSwitch.bind(this));
- }
-
- ThreadParser.prototype = {
- __proto__: Parser.prototype,
-
- decodeFields: function(header, decoder) {
- if (header.version > 3)
- throw new Error('Incompatible Thread event version.');
-
- // Common fields to all Thread events.
- var processId = decoder.decodeUInt32();
- var threadId = decoder.decodeUInt32();
-
- // Extended fields.
- var stackBase;
- var stackLimit;
- var userStackBase;
- var userStackLimit;
- var affinity;
- var startAddr;
- var win32StartAddr;
- var tebBase;
- var subProcessTag;
- var basePriority;
- var pagePriority;
- var ioPriority;
- var threadFlags;
- var waitMode;
-
- if (header.version == 1) {
- // On version 1, only start events have extended information.
- if (header.opcode == kThreadStartOpcode ||
- header.opcode == kThreadDCStartOpcode) {
- stackBase = decoder.decodeUInteger(header.is64);
- stackLimit = decoder.decodeUInteger(header.is64);
- userStackBase = decoder.decodeUInteger(header.is64);
- userStackLimit = decoder.decodeUInteger(header.is64);
- startAddr = decoder.decodeUInteger(header.is64);
- win32StartAddr = decoder.decodeUInteger(header.is64);
- waitMode = decoder.decodeInt8();
- decoder.skip(3);
- }
- } else {
- stackBase = decoder.decodeUInteger(header.is64);
- stackLimit = decoder.decodeUInteger(header.is64);
- userStackBase = decoder.decodeUInteger(header.is64);
- userStackLimit = decoder.decodeUInteger(header.is64);
-
- // Version 2 produces a field named 'startAddr'.
- if (header.version == 2)
- startAddr = decoder.decodeUInteger(header.is64);
- else
- affinity = decoder.decodeUInteger(header.is64);
-
- win32StartAddr = decoder.decodeUInteger(header.is64);
- tebBase = decoder.decodeUInteger(header.is64);
- subProcessTag = decoder.decodeUInt32();
-
- if (header.version == 3) {
- basePriority = decoder.decodeUInt8();
- pagePriority = decoder.decodeUInt8();
- ioPriority = decoder.decodeUInt8();
- threadFlags = decoder.decodeUInt8();
- }
- }
-
- return {
- processId: processId,
- threadId: threadId,
- stackBase: stackBase,
- stackLimit: stackLimit,
- userStackBase: userStackBase,
- userStackLimit: userStackLimit,
- affinity: affinity,
- startAddr: startAddr,
- win32StartAddr: win32StartAddr,
- tebBase: tebBase,
- subProcessTag: subProcessTag,
- waitMode: waitMode,
- basePriority: basePriority,
- pagePriority: pagePriority,
- ioPriority: ioPriority,
- threadFlags: threadFlags
- };
- },
-
- decodeCSwitchFields: function(header, decoder) {
- if (header.version != 2)
- throw new Error('Incompatible Thread event version.');
-
- // Decode CSwitch payload.
- var newThreadId = decoder.decodeUInt32();
- var oldThreadId = decoder.decodeUInt32();
- var newThreadPriority = decoder.decodeInt8();
- var oldThreadPriority = decoder.decodeInt8();
- var previousCState = decoder.decodeUInt8();
- var spareByte = decoder.decodeInt8();
- var oldThreadWaitReason = decoder.decodeInt8();
- var oldThreadWaitMode = decoder.decodeInt8();
- var oldThreadState = decoder.decodeInt8();
- var oldThreadWaitIdealProcessor = decoder.decodeInt8();
- var newThreadWaitTime = decoder.decodeUInt32();
- var reserved = decoder.decodeUInt32();
-
- return {
- newThreadId: newThreadId,
- oldThreadId: oldThreadId,
- newThreadPriority: newThreadPriority,
- oldThreadPriority: oldThreadPriority,
- previousCState: previousCState,
- spareByte: spareByte,
- oldThreadWaitReason: oldThreadWaitReason,
- oldThreadWaitMode: oldThreadWaitMode,
- oldThreadState: oldThreadState,
- oldThreadWaitIdealProcessor: oldThreadWaitIdealProcessor,
- newThreadWaitTime: newThreadWaitTime,
- reserved: reserved
- };
- },
-
- decodeStart: function(header, decoder) {
- var fields = this.decodeFields(header, decoder);
- this.importer.createThreadIfNeeded(fields.processId, fields.threadId);
- return true;
- },
-
- decodeEnd: function(header, decoder) {
- var fields = this.decodeFields(header, decoder);
- this.importer.removeThreadIfPresent(fields.threadId);
- return true;
- },
-
- decodeDCStart: function(header, decoder) {
- var fields = this.decodeFields(header, decoder);
- this.importer.createThreadIfNeeded(fields.processId, fields.threadId);
- return true;
- },
-
- decodeDCEnd: function(header, decoder) {
- var fields = this.decodeFields(header, decoder);
- this.importer.removeThreadIfPresent(fields.threadId);
- return true;
- },
-
- decodeCSwitch: function(header, decoder) {
- var fields = this.decodeCSwitchFields(header, decoder);
- var cpu = this.importer.getOrCreateCpu(header.cpu);
- var new_thread =
- this.importer.getThreadFromWindowsTid(fields.newThreadId);
-
- // Generate the new thread name. If some events were lost, it's possible
- // that information about the new thread or process is not available.
- var new_thread_name;
- if (new_thread && new_thread.userFriendlyName) {
- new_thread_name = new_thread.userFriendlyName;
- } else {
- var new_process_id = this.importer.getPidFromWindowsTid(
- fields.newThreadId);
- var new_process = this.model.getProcess(new_process_id);
- var new_process_name;
- if (new_process)
- new_process_name = new_process.name;
- else
- new_process_name = 'Unknown process';
-
- new_thread_name =
- new_process_name + ' (tid ' + fields.newThreadId + ')';
- }
-
- cpu.switchActiveThread(
- header.timestamp,
- {},
- fields.newThreadId,
- new_thread_name,
- fields);
- return true;
- }
-
- };
-
- Parser.register(ThreadParser);
-
- return {
- ThreadParser: ThreadParser
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/thread_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/thread_parser_test.html
deleted file mode 100644
index 56031c6381f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/etw/thread_parser_test.html
+++ /dev/null
@@ -1,179 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/etw/etw_importer.html">
-<link rel="import" href="/tracing/extras/importer/etw/thread_parser.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- // Constants for Thread events.
- var guid = '3D6FA8D1-FE05-11D0-9DDA-00C04FD7BA7C';
- var kThreadStartOpcode = 1;
- var kThreadEndOpcode = 2;
- var kThreadDCStartOpcode = 3;
- var kThreadCSwitchOpcode = 36;
-
- var kThreadStartPayload32bitV1 =
- 'BAAAAEwHAAAAYLfzADC38wAAAAAAAAAAhdse9wAAAAD/AAAA';
-
- var kThreadEndPayload32bitV1 = 'BAAAALQAAAA=';
-
-
- var kThreadDCStartPayload64bitV2 =
- 'AAAAAAAAAAAAYPUCAPj//wAA9QIA+P//AAAAAAAAAAAAAAAAAAAAAIAlxwEA+P//gCXHA' +
- 'QD4//8AAAAAAAAAAAAAAAA=';
-
- var kThreadStartPayload32bitV3 =
- 'LAIAACwTAAAAUJixACCYsQAA1QAAwNQAAwAAAOkDq3cA4P1/AAAAAAkFAgA=';
-
- var kThreadStartPayload64bitV3 =
- 'eCEAAJQUAAAAMA4nAND//wDQDScA0P//MP0LBgAAAAAAgAsGAAAAAP8AAAAAAAAALP1YX' +
- 'AAAAAAAwBL/AAAAAAAAAAAIBQIA';
-
- var kThreadCSwitchPayload32bitV2 = 'AAAAACwRAAAACQAAFwABABIAAAAmSAAA';
- var kThreadCSwitchPayload64bitV2 = 'zAgAAAAAAAAIAAEAAAACBAEAAACHbYg0';
-
- test('DecodeFields', function() {
-
- var importer = new tr.e.importer.etw.EtwImporter('dummy', []);
- var decoder = importer.decoder_;
- var parser = new tr.e.importer.etw.ThreadParser(importer);
- var header;
- var fields;
-
- // Validate a version 1 32-bit payload.
- header = { guid: guid, opcode: kThreadStartOpcode, version: 1, is64: 0 };
- decoder.reset(kThreadStartPayload32bitV1);
- fields = parser.decodeFields(header, decoder);
-
- assert.equal(fields.processId, 4);
- assert.equal(fields.threadId, 1868);
- assert.equal(fields.stackBase, 4088881152);
- assert.equal(fields.stackLimit, 4088868864);
- assert.equal(fields.userStackBase, 0);
- assert.equal(fields.userStackLimit, 0);
- assert.equal(fields.startAddr, 4145994629);
- assert.equal(fields.win32StartAddr, 0);
- assert.equal(fields.waitMode, -1);
-
- // Validate an End version 1 32-bit payload.
- header = { guid: guid, opcode: kThreadEndOpcode, version: 1, is64: 0 };
- decoder.reset(kThreadStartPayload32bitV1);
- fields = parser.decodeFields(header, decoder);
-
- assert.equal(fields.processId, 4);
- assert.equal(fields.threadId, 1868);
-
- // Validate a version 2 64-bit payload.
- header = { guid: guid, opcode: kThreadDCStartOpcode, version: 2, is64: 1 };
- decoder.reset(kThreadDCStartPayload64bitV2);
- fields = parser.decodeFields(header, decoder);
-
- assert.equal(fields.processId, 0);
- assert.equal(fields.threadId, 0);
- assert.strictEqual(fields.stackBase, 'fffff80002f56000');
- assert.equal(fields.stackLimit, 'fffff80002f50000');
- assert.strictEqual(fields.userStackBase, '0000000000000000');
- assert.strictEqual(fields.userStackLimit, '0000000000000000');
- assert.strictEqual(fields.startAddr, 'fffff80001c72580');
- assert.strictEqual(fields.win32StartAddr, 'fffff80001c72580');
- assert.strictEqual(fields.tebBase, '0000000000000000');
- assert.equal(fields.subProcessTag, 0);
-
- // Validate a version 3 32-bit payload.
- header = { guid: guid, opcode: kThreadStartOpcode, version: 3, is64: 0 };
- decoder.reset(kThreadStartPayload32bitV3);
- fields = parser.decodeFields(header, decoder);
-
- assert.equal(fields.processId, 556);
- assert.equal(fields.threadId, 4908);
- assert.equal(fields.stackBase, 2979549184);
- assert.equal(fields.stackLimit, 2979536896);
- assert.equal(fields.userStackBase, 13959168);
- assert.equal(fields.userStackLimit, 13942784);
- assert.equal(fields.affinity, 3);
- assert.equal(fields.win32StartAddr, 2007696361);
- assert.equal(fields.tebBase, 2147344384);
- assert.equal(fields.subProcessTag, 0);
- assert.equal(fields.basePriority, 9);
- assert.equal(fields.pagePriority, 5);
- assert.equal(fields.ioPriority, 2);
- assert.equal(fields.threadFlags, 0);
-
- // Validate a version 3 64-bit payload.
- header = { guid: guid, opcode: kThreadStartOpcode, version: 3, is64: 1 };
- decoder.reset(kThreadStartPayload64bitV3);
- fields = parser.decodeFields(header, decoder);
-
- assert.equal(fields.processId, 8568);
- assert.equal(fields.threadId, 5268);
- assert.strictEqual(fields.stackBase, 'ffffd000270e3000');
- assert.strictEqual(fields.stackLimit, 'ffffd000270dd000');
- assert.strictEqual(fields.userStackBase, '00000000060bfd30');
- assert.strictEqual(fields.userStackLimit, '00000000060b8000');
- assert.strictEqual(fields.affinity, '00000000000000ff');
- assert.strictEqual(fields.win32StartAddr, '000000005c58fd2c');
- assert.strictEqual(fields.tebBase, '00000000ff12c000');
- assert.equal(fields.subProcessTag, 0);
- assert.equal(fields.basePriority, 8);
- assert.equal(fields.pagePriority, 5);
- assert.equal(fields.ioPriority, 2);
- assert.equal(fields.threadFlags, 0);
- });
-
- test('DecodeCSwitchFields', function() {
- var importer = new tr.e.importer.etw.EtwImporter('dummy', []);
- var decoder = importer.decoder_;
- var parser = new tr.e.importer.etw.ThreadParser(importer);
- var header;
- var fields;
-
-
- // Validate a version 2 CSwitch 32-bit payload.
- header = { guid: guid, opcode: kThreadCSwitchOpcode, version: 2, is64: 0 };
- decoder.reset(kThreadCSwitchPayload32bitV2);
- fields = parser.decodeCSwitchFields(header, decoder);
-
- assert.equal(fields.newThreadId, 0);
- assert.equal(fields.oldThreadId, 4396);
- assert.equal(fields.newThreadPriority, 0);
- assert.equal(fields.oldThreadPriority, 9);
- assert.equal(fields.previousCState, 0);
- assert.equal(fields.spareByte, 0);
- assert.equal(fields.oldThreadWaitReason, 23);
- assert.equal(fields.oldThreadWaitMode, 0);
- assert.equal(fields.oldThreadState, 1);
- assert.equal(fields.oldThreadWaitIdealProcessor, 0);
- assert.equal(fields.newThreadWaitTime, 18);
- assert.equal(fields.reserved, 18470);
-
- // Validate a version 2 CSwitch 64-bit payload.
- header = { guid: guid, opcode: kThreadCSwitchOpcode, version: 2, is64: 1 };
- decoder.reset(kThreadCSwitchPayload64bitV2);
- fields = parser.decodeCSwitchFields(header, decoder);
-
- assert.equal(fields.newThreadId, 2252);
- assert.equal(fields.oldThreadId, 0);
- assert.equal(fields.newThreadPriority, 8);
- assert.equal(fields.oldThreadPriority, 0);
- assert.equal(fields.previousCState, 1);
- assert.equal(fields.spareByte, 0);
- assert.equal(fields.oldThreadWaitReason, 0);
- assert.equal(fields.oldThreadWaitMode, 0);
- assert.equal(fields.oldThreadState, 2);
- assert.equal(fields.oldThreadWaitIdealProcessor, 4);
- assert.equal(fields.newThreadWaitTime, 1);
- assert.equal(fields.reserved, 881356167);
-
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/gcloud_trace/gcloud_trace_importer.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/gcloud_trace/gcloud_trace_importer.html
deleted file mode 100644
index b110a7e6c82..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/gcloud_trace/gcloud_trace_importer.html
+++ /dev/null
@@ -1,99 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/importer/importer.html">
-
-<script>
-
-'use strict';
-
-/**
- * @fileoverview GcloudTraceImporter imports JSON data from Google Cloud Trace.
- */
-tr.exportTo('tr.e.importer.gcloud_trace', function() {
- function GcloudTraceImporter(model, eventData) {
- this.importPriority = 2;
- this.eventData_ = eventData;
- }
-
- /**
- * @return {boolean} Whether obj looks like the JSON output from Cloud Trace.
- */
- GcloudTraceImporter.canImport = function(eventData) {
- if (typeof(eventData) !== 'string' && !(eventData instanceof String))
- return false;
-
- // Slice the data so we don't potentially do a replace on a gigantic string.
- var normalizedEventData = eventData.slice(0, 20).replace(/\s/g, '');
- if (normalizedEventData.length < 14)
- return false;
-
- return normalizedEventData.slice(0, 14) == '{"projectId":"';
- };
-
- GcloudTraceImporter.prototype = {
-
- __proto__: tr.importer.Importer.prototype,
-
- get importerName() {
- return 'GcloudTraceImporter';
- },
-
- /**
- * Called by the Model to extract subtraces from the event data. The
- * subtraces are passed on to other importers that can recognize them.
- */
- extractSubtraces: function() {
- var traceEvents = this.createEventsForTrace();
- return traceEvents ? [traceEvents] : [];
- },
-
- createEventsForTrace: function() {
- var events = [];
- var trace = JSON.parse(this.eventData_);
- var spanLength = trace.spans.length;
- for (var i = 0; i < spanLength; i++) {
- events.push(this.createEventForSpan(trace.traceId, trace.spans[i]));
- }
- return {
- 'traceEvents': events
- };
- },
-
- createEventForSpan: function(traceId, span) {
- var newArgs = {};
- if (span.labels) {
- newArgs = JSON.parse(JSON.stringify(span.labels));
- }
- newArgs['Span ID'] = span.spanId;
- newArgs['Start Time'] = span.startTime;
- newArgs['End Time'] = span.endTime;
- if (span.parentSpanId) {
- newArgs['Parent Span ID'] = span.parentSpanId;
- }
- // The timestamps are ISO-standard strings, which are parsed to millis,
- // then converted to the micros that the trace viewer expects.
- return {
- name: span.name,
- args: newArgs,
- pid: traceId,
- ts: Date.parse(span.startTime) * 1000,
- dur: (Date.parse(span.endTime) - Date.parse(span.startTime)) * 1000,
- cat: 'tracespan',
- tid: traceId,
- ph: 'X'
- };
- }
- };
-
- tr.importer.Importer.register(GcloudTraceImporter);
-
- return {
- GcloudTraceImporter: GcloudTraceImporter
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/gcloud_trace/gcloud_trace_importer_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/gcloud_trace/gcloud_trace_importer_test.html
deleted file mode 100644
index 2c229ffc31c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/gcloud_trace/gcloud_trace_importer_test.html
+++ /dev/null
@@ -1,99 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/extras/importer/gcloud_trace/gcloud_trace_importer.html">
-
-<script>
-
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var GcloudTraceImporter = tr.e.importer.gcloud_trace.GcloudTraceImporter;
-
- test('noSpans', function() {
- var trace = {projectId: 'My Project', traceId: '123', spans: []};
-
- var model = new tr.Model();
- var importer = new tr.e.importer.gcloud_trace.GcloudTraceImporter(model,
- JSON.stringify(trace));
- var subtraces = importer.extractSubtraces();
- assert.equal(1, subtraces.length);
- // Note there are, in fact, use cases for traces with no events (spans).
- assert.deepEqual([], subtraces[0].traceEvents);
- });
-
- test('typicalTrace', function() {
- var span1 = {
- 'spanId': '1',
- 'kind': 'RPC_CLIENT',
- 'name': '/first',
- 'startTime': '2015-09-03T16:40:00.841654024Z',
- 'endTime': '2015-09-03T16:40:00.856599389Z',
- 'labels': {
- 'key1': 'value1',
- 'key2': 'value2'
- }
- };
- var span2 = {
- 'spanId': '2',
- 'kind': 'RPC_SERVER',
- 'name': '/second',
- 'startTime': '2015-09-03T16:40:00.842880028Z',
- 'endTime': '2015-09-03T16:40:00.851729538Z',
- 'parentSpanId': '1',
- 'labels': {
- 'key1': 'value3',
- 'key2': 'value4'
- }
- };
- var trace = {projectId: 'My Project', traceId: '123',
- spans: [span1, span2]};
-
- var model = new tr.Model();
- var importer = new tr.e.importer.gcloud_trace.GcloudTraceImporter(model,
- JSON.stringify(trace));
- var subtraces = importer.extractSubtraces();
- assert.equal(1, subtraces.length);
- assert.equal(2, subtraces[0].traceEvents.length);
-
- var span1Event = subtraces[0].traceEvents[0];
- assert.equal('tracespan', span1Event.cat);
- assert.equal('/first', span1Event.name);
- assert.equal(1441298400841000, span1Event.ts);
- assert.equal(15000, span1Event.dur);
- assert.equal('123', span1Event.pid);
- assert.equal('123', span1Event.tid);
- assert.equal('2015-09-03T16:40:00.856599389Z', span1Event.args['End Time']);
- assert.equal('1', span1Event.args['Span ID']);
- assert.equal('value1', span1Event.args['key1']);
- assert.equal('value2', span1Event.args['key2']);
- assert.equal('2015-09-03T16:40:00.856599389Z', span1Event.args['End Time']);
-
- var span2Event = subtraces[0].traceEvents[1];
- assert.equal('tracespan', span2Event.cat);
- assert.equal('/second', span2Event.name);
- assert.equal(1441298400842000, span2Event.ts);
- assert.equal(9000, span2Event.dur);
- assert.equal('123', span2Event.pid);
- assert.equal('123', span2Event.tid);
- });
-
- test('canImport', function() {
- assert.isTrue(GcloudTraceImporter.canImport(
- JSON.stringify({projectId: 'My Project'})));
- assert.isTrue(GcloudTraceImporter.canImport(
- JSON.stringify({projectId: '56', traceId: '34'})));
- assert.isFalse(GcloudTraceImporter.canImport(
- JSON.stringify({wrongjson: '33'})));
- assert.isFalse(GcloudTraceImporter.canImport(''));
- assert.isFalse(GcloudTraceImporter.canImport([]));
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/gzip_importer.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/gzip_importer.html
deleted file mode 100644
index 8dfd2f199d2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/gzip_importer.html
+++ /dev/null
@@ -1,188 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/jszip.html">
-<link rel="import" href="/tracing/importer/importer.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview GzipImporter inflates gzip compressed data and passes it along
- * to an actual importer.
- */
-tr.exportTo('tr.e.importer', function() {
- var GZIP_MEMBER_HEADER_ID_SIZE = 3;
-
- var GZIP_HEADER_ID1 = 0x1f;
- var GZIP_HEADER_ID2 = 0x8b;
- var GZIP_DEFLATE_COMPRESSION = 8;
-
- function GzipImporter(model, eventData) {
- // Normalize the data into an Uint8Array.
- if (typeof(eventData) === 'string' || eventData instanceof String) {
- eventData = JSZip.utils.transformTo('uint8array', eventData);
- } else if (eventData instanceof ArrayBuffer) {
- eventData = new Uint8Array(eventData);
- } else
- throw new Error('Unknown gzip data format');
- this.model_ = model;
- this.gzipData_ = eventData;
- }
-
- /**
- * @param {eventData} Possibly gzip compressed data as a string or an
- * ArrayBuffer.
- * @return {boolean} Whether obj looks like gzip compressed data.
- */
- GzipImporter.canImport = function(eventData) {
- var header;
- if (eventData instanceof ArrayBuffer)
- header = new Uint8Array(eventData.slice(0, GZIP_MEMBER_HEADER_ID_SIZE));
- else if (typeof(eventData) === 'string' || eventData instanceof String) {
- header = eventData.substring(0, GZIP_MEMBER_HEADER_ID_SIZE);
- // Convert the string to a byteArray for correct value comparison.
- header = JSZip.utils.transformTo('uint8array', header);
- } else
- return false;
- return header[0] == GZIP_HEADER_ID1 &&
- header[1] == GZIP_HEADER_ID2 &&
- header[2] == GZIP_DEFLATE_COMPRESSION;
- };
-
- /**
- * Inflates (decompresses) the data stored in the given gzip bitstream.
- * @return {string} Inflated data.
- */
- GzipImporter.inflateGzipData_ = function(data) {
- var position = 0;
-
- function getByte() {
- if (position >= data.length)
- throw new Error('Unexpected end of gzip data');
- return data[position++];
- }
-
- function getWord() {
- var low = getByte();
- var high = getByte();
- return (high << 8) + low;
- }
-
- function skipBytes(amount) {
- position += amount;
- }
-
- function skipZeroTerminatedString() {
- while (getByte() != 0) {}
- }
-
- var id1 = getByte();
- var id2 = getByte();
- if (id1 !== GZIP_HEADER_ID1 || id2 !== GZIP_HEADER_ID2)
- throw new Error('Not gzip data');
- var compression_method = getByte();
- if (compression_method !== GZIP_DEFLATE_COMPRESSION)
- throw new Error('Unsupported compression method: ' + compression_method);
- var flags = getByte();
- var have_header_crc = flags & (1 << 1);
- var have_extra_fields = flags & (1 << 2);
- var have_file_name = flags & (1 << 3);
- var have_comment = flags & (1 << 4);
-
- // Skip modification time, extra flags and OS.
- skipBytes(4 + 1 + 1);
-
- // Skip remaining fields before compressed data.
- if (have_extra_fields) {
- var bytes_to_skip = getWord();
- skipBytes(bytes_to_skip);
- }
- if (have_file_name)
- skipZeroTerminatedString();
- if (have_comment)
- skipZeroTerminatedString();
- if (have_header_crc)
- getWord();
-
- // Inflate the data using jszip.
- var inflated_data =
- JSZip.compressions['DEFLATE'].uncompress(data.subarray(position));
- var string = GzipImporter.transformToString(inflated_data);
-
- if (inflated_data.length > 0 && string.length === 0) {
- throw new RangeError('Inflated gzip data too long to fit into a string' +
- ' (' + inflated_data.length + ').');
- }
-
- return string;
- };
-
- /**
- * Transforms an array-like object to a string.
- *
- * Note that the following two expressions yield identical results:
- *
- * GzipImporter.transformToString_(data)
- * JSZip.utils.transformTo('string', data)
- *
- * We use a custom static method because it is faster and, more importantly,
- * avoids OOMing on large traces. See
- * https://github.com/catapult-project/catapult/issues/2051.
- */
- GzipImporter.transformToString = function(data) {
- if (typeof TextDecoder === 'undefined') {
- // Fall back to jszip if TextDecoder is not available.
- return JSZip.utils.transformTo('string', data);
- }
-
- var type = JSZip.utils.getTypeOf(data);
- if (type === 'string')
- return data; // We already have a string.
-
- if (type === 'array') {
- // TextDecoder requires an ArrayBuffer or an ArrayBufferView.
- data = new Uint8Array(data);
- }
-
- var decoder = new TextDecoder('utf-8');
- return decoder.decode(data);
- };
-
- GzipImporter.prototype = {
- __proto__: tr.importer.Importer.prototype,
-
- get importerName() {
- return 'GzipImporter';
- },
-
- /**
- * Called by the Model to check whether the importer just encapsulates
- * the actual trace data which needs to be imported by another importer.
- */
- isTraceDataContainer: function() {
- return true;
- },
-
- /**
- * Called by the Model to extract subtraces from the event data. The
- * subtraces are passed on to other importers that can recognize them.
- */
- extractSubtraces: function() {
- var eventData = GzipImporter.inflateGzipData_(this.gzipData_);
- return eventData ? [eventData] : [];
- }
- };
-
- tr.importer.Importer.register(GzipImporter);
-
- return {
- GzipImporter: GzipImporter
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/gzip_importer_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/gzip_importer_test.html
deleted file mode 100644
index f226aae6813..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/gzip_importer_test.html
+++ /dev/null
@@ -1,105 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base64.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/gzip_importer.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Base64 = tr.b.Base64;
- var findSliceNamed = tr.c.TestUtils.findSliceNamed;
- var original_data =
- '[{"name":"a","args":{},"pid":52,"ts":520,"cat":"foo","tid":53,' +
- '"ph":"B"},{"name":"a","args":{},"pid":52,"ts":520,"cat":"foo",' +
- '"tid":53,"ph":"E"}]\n';
- var gzip_data_base64 =
- 'H4sICHr4HVIAA3RyYWNlAIuuVspLzE1VslJKVNJRSixKL1ayqq7VUSrITFGy' +
- 'MjXSUSopBtEGOkrJiSVAVWn5+UB1JWBZY6CyDKCYk1KtDhWMcVWqjeUCALak' +
- 'EH+QAAAA';
-
- test('failImportEmpty', function() {
- assert.isFalse(tr.e.importer.GzipImporter.canImport([]));
- assert.isFalse(tr.e.importer.GzipImporter.canImport(''));
- });
-
- test('inflateString', function() {
- // Test inflating the data from a string.
- var gzip_data = Base64.atob(gzip_data_base64);
- var importer = new tr.e.importer.GzipImporter(null, gzip_data);
- assert.isTrue(tr.e.importer.GzipImporter.canImport(gzip_data));
- assert.equal(importer.extractSubtraces()[0], original_data);
- });
-
- test('inflateArrayBuffer', function() {
- // Test inflating the data from an ArrayBuffer.
- var gzip_data = Base64.atob(gzip_data_base64);
- var buffer = new ArrayBuffer(gzip_data.length);
- var view = new Uint8Array(buffer);
- for (var i = 0; i < gzip_data.length; i++)
- view[i] = gzip_data.charCodeAt(i);
- var importer = new tr.e.importer.GzipImporter(null, buffer);
- assert.isTrue(tr.e.importer.GzipImporter.canImport(buffer));
- assert.equal(importer.extractSubtraces()[0], original_data);
- });
-
- test('import', function() {
- var gzip_data = Base64.atob(gzip_data_base64);
- assert.isTrue(tr.e.importer.GzipImporter.canImport(gzip_data));
-
- var model = tr.c.TestUtils.newModelWithEvents(gzip_data);
- var threads = model.getAllThreads();
- assert.equal(threads.length, 1);
-
- var slice = findSliceNamed(threads[0].sliceGroup, 'a');
- assert.equal(slice.category, 'foo');
- });
-
- test('transformToString', function() {
- function checkTransform(data, expectedString) {
- assert.strictEqual(tr.e.importer.GzipImporter.transformToString(data),
- expectedString);
- }
-
- function createArrayBuffer(values) {
- var buffer = new ArrayBuffer(values.length);
- var view = new Uint8Array(buffer);
- view.set(values);
- return buffer;
- }
-
- // If the browser supports TextDecoder, this will test our custom
- // implementation. Otherwise, the jszip fallback will be tested.
- checkTransform('abc012', 'abc012');
- checkTransform([100, 101, 102, 51, 52, 53], 'def345');
- checkTransform(createArrayBuffer([103, 104, 105, 54, 55, 56]), 'ghi678');
- checkTransform(new Uint8Array([106, 107, 108, 57, 58, 59]), 'jkl9:;');
-
- if (typeof TextDecoder === 'undefined') {
- // The browser doesn't support TextDecoder, so we have already checked
- // the jszip fallback.
- return;
- }
-
- // The browser supports TextDecoder, so we now check the jszip fallback.
- var oldTextDecoder = TextDecoder;
- TextDecoder = undefined;
- try {
- checkTransform('abc012', 'abc012');
- checkTransform([100, 101, 102, 51, 52, 53], 'def345');
- checkTransform(createArrayBuffer([103, 104, 105, 54, 55, 56]), 'ghi678');
- checkTransform(new Uint8Array([106, 107, 108, 57, 58, 59]), 'jkl9:;');
- } finally {
- TextDecoder = oldTextDecoder;
- }
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/jszip.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/jszip.html
deleted file mode 100644
index 0840c06ff74..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/jszip.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-// Vinn workaround for JSzip requiring window.
-if (tr.isVinn) {
- /**
- * Hack.
- */
- global.window = {};
-}
-</script>
-<script src="/jszip.min.js"></script>
-<script>
-'use strict';
-// Vinn workaround for JSzip requiring window.
-if (tr.isVinn) {
- /**
- * Hack.
- */
- global.JSZip = global.window.JSZip;
- global.window = undefined;
-} else if (tr.isNode) {
- var jsZipAbsPath = HTMLImportsLoader.hrefToAbsolutePath(
- '/jszip.min.js');
- var jsZipModule = require(jsZipAbsPath);
- global.JSZip = jsZipModule;
-}
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/android_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/android_parser.html
deleted file mode 100644
index 5e9dda90f42..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/android_parser.html
+++ /dev/null
@@ -1,240 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-<link rel="import" href="/tracing/model/counter_series.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses trace_marker events that were inserted in the trace by
- * userland.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
- var ColorScheme = tr.b.ColorScheme;
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses linux trace mark events that were inserted in the trace by userland.
- * @constructor
- */
- function AndroidParser(importer) {
- Parser.call(this, importer);
-
- importer.registerEventHandler('tracing_mark_write:android',
- AndroidParser.prototype.traceMarkWriteAndroidEvent.bind(this));
- importer.registerEventHandler('0:android',
- AndroidParser.prototype.traceMarkWriteAndroidEvent.bind(this));
-
- this.model_ = importer.model_;
- this.ppids_ = {};
- }
-
- function parseArgs(argsString) {
- var args = {};
- if (argsString) {
- var argsArray = argsString.split(';');
- for (var i = 0; i < argsArray.length; ++i) {
- var parts = argsArray[i].split('=');
- if (parts[0])
- args[parts.shift()] = parts.join('=');
- }
- }
- return args;
- }
-
- AndroidParser.prototype = {
- __proto__: Parser.prototype,
-
- openAsyncSlice: function(thread, category, name, cookie, ts, args) {
- var asyncSliceConstructor =
- tr.model.AsyncSlice.getConstructor(
- category, name);
- var slice = new asyncSliceConstructor(
- category, name,
- ColorScheme.getColorIdForGeneralPurposeString(name), ts, args);
- var key = category + ':' + name + ':' + cookie;
- slice.id = cookie;
- slice.startThread = thread;
-
- if (!this.openAsyncSlices) {
- this.openAsyncSlices = { };
- }
- this.openAsyncSlices[key] = slice;
- },
-
- closeAsyncSlice: function(thread, category, name, cookie, ts, args) {
- if (!this.openAsyncSlices) {
- // No async slices have been started.
- return;
- }
-
- var key = category + ':' + name + ':' + cookie;
- var slice = this.openAsyncSlices[key];
- if (!slice) {
- // No async slices w/ this key have been started.
- return;
- }
-
- for (var arg in args) {
- if (slice.args[arg] !== undefined) {
- this.model_.importWarning({
- type: 'parse_error',
- message: 'Both the S and F events of ' + slice.title +
- ' provided values for argument ' + arg + '.' +
- ' The value of the F event will be used.'
- });
- }
- slice.args[arg] = args[arg];
- }
-
- slice.endThread = thread;
- slice.duration = ts - slice.start;
- slice.startThread.asyncSliceGroup.push(slice);
- slice.subSlices = [new tr.model.AsyncSlice(slice.category,
- slice.title, slice.colorId, slice.start, slice.args, slice.duration)];
- delete this.openAsyncSlices[key];
- },
-
- traceMarkWriteAndroidEvent: function(eventName, cpuNumber, pid, ts,
- eventBase) {
- var eventData = eventBase.details.split('|');
- switch (eventData[0]) {
- case 'B':
- var ppid = parseInt(eventData[1]);
- var title = eventData[2];
- var args = parseArgs(eventData[3]);
- var category = eventData[4];
- if (category === undefined)
- category = 'android';
-
- var thread = this.model_.getOrCreateProcess(ppid)
- .getOrCreateThread(pid);
- thread.name = eventBase.threadName;
- if (!thread.sliceGroup.isTimestampValidForBeginOrEnd(ts)) {
- this.model_.importWarning({
- type: 'parse_error',
- message: 'Timestamps are moving backward.'
- });
- return false;
- }
-
- this.ppids_[pid] = ppid;
- thread.sliceGroup.beginSlice(category, title, ts, args);
-
- break;
-
- case 'E':
- var ppid = this.ppids_[pid];
- if (ppid === undefined) {
- // Silently ignore unmatched E events.
- break;
- }
-
- var thread = this.model_.getOrCreateProcess(ppid)
- .getOrCreateThread(pid);
- if (!thread.sliceGroup.openSliceCount) {
- // Silently ignore unmatched E events.
- break;
- }
-
- var slice = thread.sliceGroup.endSlice(ts);
-
- var args = parseArgs(eventData[3]);
- for (var arg in args) {
- if (slice.args[arg] !== undefined) {
- this.model_.importWarning({
- type: 'parse_error',
- message: 'Both the B and E events of ' + slice.title +
- ' provided values for argument ' + arg + '.' +
- ' The value of the E event will be used.'
- });
- }
- slice.args[arg] = args[arg];
- }
-
- break;
-
- case 'C':
- var ppid = parseInt(eventData[1]);
- var name = eventData[2];
- var value = parseInt(eventData[3]);
- var category = eventData[4];
- if (category === undefined)
- category = 'android';
-
- var ctr = this.model_.getOrCreateProcess(ppid)
- .getOrCreateCounter(category, name);
- // Initialize the counter's series fields if needed.
- if (ctr.numSeries === 0) {
- ctr.addSeries(new tr.model.CounterSeries(value,
- ColorScheme.getColorIdForGeneralPurposeString(
- ctr.name + '.' + 'value')));
- }
-
- ctr.series.forEach(function(series) {
- series.addCounterSample(ts, value);
- });
-
- break;
-
- case 'S':
- var ppid = parseInt(eventData[1]);
- var name = eventData[2];
- var cookie = parseInt(eventData[3]);
- var args = parseArgs(eventData[4]);
- var category = eventData[5];
- if (category === undefined)
- category = 'android';
-
-
- var thread = this.model_.getOrCreateProcess(ppid)
- .getOrCreateThread(pid);
- thread.name = eventBase.threadName;
-
- this.ppids_[pid] = ppid;
- this.openAsyncSlice(thread, category, name, cookie, ts, args);
-
- break;
-
- case 'F':
- // Note: An async slice may end on a different thread from the one
- // that started it so this thread may not have been seen yet.
- var ppid = parseInt(eventData[1]);
-
- var name = eventData[2];
- var cookie = parseInt(eventData[3]);
- var args = parseArgs(eventData[4]);
- var category = eventData[5];
- if (category === undefined)
- category = 'android';
-
- var thread = this.model_.getOrCreateProcess(ppid)
- .getOrCreateThread(pid);
- thread.name = eventBase.threadName;
-
- this.ppids_[pid] = ppid;
- this.closeAsyncSlice(thread, category, name, cookie, ts, args);
-
- break;
-
- default:
- return false;
- }
-
- return true;
- }
- };
-
- Parser.register(AndroidParser);
-
- return {
- AndroidParser: AndroidParser
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/android_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/android_parser_test.html
deleted file mode 100644
index ddc5ba99823..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/android_parser_test.html
+++ /dev/null
@@ -1,230 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function newModel(events) {
- return tr.c.TestUtils.newModelWithEvents([events], {
- shiftWorldToZero: false
- });
- }
-
- test('androidUserlandImport', function() {
- var lines = [
- 'SurfaceFlinger-4831 [001] ...1 80909.598554: tracing_mark_write: B|4829|onMessageReceived', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.598572: tracing_mark_write: B|4829|handleMessageInvalidate', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.598590: tracing_mark_write: B|4829|latchBuffer', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.598604: tracing_mark_write: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.598627: tracing_mark_write: B|4829|latchBuffer', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.598651: tracing_mark_write: B|4829|updateTexImage', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.598675: tracing_mark_write: B|4829|acquireBuffer', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.598695: tracing_mark_write: B|4829|' + // @suppress longLineCheck
- 'com.android.launcher/com.android.launcher2.Launcher: 0',
- 'SurfaceFlinger-4831 [001] ...1 80909.598709: tracing_mark_write: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.598733: tracing_mark_write: C|4829|' + // @suppress longLineCheck
- 'com.android.launcher/com.android.launcher2.Launcher|0',
- 'SurfaceFlinger-4831 [001] ...1 80909.598746: tracing_mark_write: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.598844: tracing_mark_write: B|4829|releaseBuffer', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.598862: tracing_mark_write: B|4829|' + // @suppress longLineCheck
- 'com.android.launcher/com.android.launcher2.Launcher: 2',
- 'SurfaceFlinger-4831 [001] ...1 80909.598876: tracing_mark_write: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.598892: tracing_mark_write: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.598925: tracing_mark_write: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.598955: tracing_mark_write: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.598988: tracing_mark_write: B|4829|latchBuffer', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.599001: tracing_mark_write: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.599021: tracing_mark_write: B|4829|latchBuffer', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.599036: tracing_mark_write: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.599068: tracing_mark_write: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.599087: tracing_mark_write: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.599104: tracing_mark_write: E'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var thread = threads[0];
- assert.equal(thread.parent.pid, 4829);
- assert.equal(thread.tid, 4831);
- assert.equal(thread.name, 'SurfaceFlinger');
- assert.equal(thread.sliceGroup.length, 11);
- });
-
- test('androidUserlandImportWithSpacesInThreadName', function() {
- var lines = [
- 'Surface Flinger -4831 [001] ...1 80909.598590: tracing_mark_write: B|4829|latchBuffer', // @suppress longLineCheck
- 'Surface Flinger -4831 [001] ...1 80909.598604: tracing_mark_write: E' // @suppress longLineCheck
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var thread = threads[0];
- assert.equal(thread.parent.pid, 4829);
- assert.equal(thread.tid, 4831);
- assert.equal(thread.name, 'Surface Flinger ');
- assert.equal(thread.sliceGroup.length, 1);
- });
-
- test('androidAsyncUserlandImport', function() {
- var lines = [
- 'ndroid.launcher-9649 ( 9649) [000] ...1 1990280.663276: ' +
- 'tracing_mark_write: S|9649|animator:childrenOutlineAlpha|' +
- '1113053968',
- 'ndroid.launcher-9649 ( 9649) [000] ...1 1990280.781445: ' +
- 'tracing_mark_write: F|9649|animator:childrenOutlineAlpha|' +
- '1113053968'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var thread = threads[0];
- assert.equal(thread.parent.pid, 9649);
- assert.equal(thread.tid, 9649);
- assert.equal(thread.name, 'ndroid.launcher');
- assert.equal(thread.sliceGroup.length, 0);
- assert.equal(thread.asyncSliceGroup.length, 1);
-
- var slice = thread.asyncSliceGroup.slices[0];
- assert.equal(slice.title, 'animator:childrenOutlineAlpha');
- assert.closeTo(118.169, slice.duration, 1e-5);
- });
-
- test('androidUserlandLegacyKernelImport', function() {
- var lines = [
- 'SurfaceFlinger-4831 [001] ...1 80909.598554: 0: B|4829|onMessageReceived', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.598572: 0: B|4829|handleMessageInvalidate', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.598590: 0: B|4829|latchBuffer',
- 'SurfaceFlinger-4831 [001] ...1 80909.598604: 0: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.598627: 0: B|4829|latchBuffer',
- 'SurfaceFlinger-4831 [001] ...1 80909.598651: 0: B|4829|updateTexImage', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.598675: 0: B|4829|acquireBuffer', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.598695: 0: B|4829|' +
- 'com.android.launcher/com.android.launcher2.Launcher: 0',
- 'SurfaceFlinger-4831 [001] ...1 80909.598709: 0: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.598733: 0: C|4829|' +
- 'com.android.launcher/com.android.launcher2.Launcher|0',
- 'SurfaceFlinger-4831 [001] ...1 80909.598746: 0: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.598844: 0: B|4829|releaseBuffer', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.598862: 0: B|4829|' +
- 'com.android.launcher/com.android.launcher2.Launcher: 2',
- 'SurfaceFlinger-4831 [001] ...1 80909.598876: 0: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.598892: 0: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.598925: 0: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.598955: 0: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.598988: 0: B|4829|latchBuffer', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.599001: 0: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.599021: 0: B|4829|latchBuffer', // @suppress longLineCheck
- 'SurfaceFlinger-4831 [001] ...1 80909.599036: 0: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.599068: 0: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.599087: 0: E',
- 'SurfaceFlinger-4831 [001] ...1 80909.599104: 0: E'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var thread = threads[0];
- assert.equal(thread.parent.pid, 4829);
- assert.equal(thread.tid, 4831);
- assert.equal(thread.name, 'SurfaceFlinger');
- assert.equal(thread.sliceGroup.length, 11);
- });
-
- test('androidUserlandChromiumImport', function() {
- var lines = [
- 'SandboxedProces-2894 [001] ...1 253.780659: tracing_mark_write: B|2867|DoWorkLoop|arg1=1|cat1', // @suppress longLineCheck
- 'SandboxedProces-2894 [001] ...1 253.780671: tracing_mark_write: B|2867|DeferOrRunPendingTask|source=test=test;task=xyz|cat2', // @suppress longLineCheck
- 'SandboxedProces-2894 [001] ...1 253.780671: tracing_mark_write: E|2867|DeferOrRunPendingTask||cat1', // @suppress longLineCheck
- 'SandboxedProces-2894 [001] ...1 253.780686: tracing_mark_write: B|2867|MessageLoop::RunTask|source=ipc/ipc_sync_message_filter.cc:Send|cat2', // @suppress longLineCheck
- 'SandboxedProces-2894 [001] ...1 253.780700: tracing_mark_write: E|2867|MessageLoop::RunTask||cat1', // @suppress longLineCheck
- 'SandboxedProces-2894 [001] ...1 253.780750: tracing_mark_write: C|2867|counter1|10|cat1', // @suppress longLineCheck
- 'SandboxedProces-2894 [001] ...1 253.780859: tracing_mark_write: E|2867|DoWorkLoop|arg2=2|cat2', // @suppress longLineCheck
- 'SandboxedProces-2894 [000] ...1 255.663276: tracing_mark_write: S|2867|async|1113053968|arg1=1;arg2=2|cat1', // @suppress longLineCheck
- 'SandboxedProces-2894 [000] ...1 255.663276: tracing_mark_write: F|2867|async|1113053968|arg3=3|cat1', // @suppress longLineCheck
- 'SandboxedProces-2894 [000] ...1 255.663276: tracing_mark_write: trace_event_clock_sync: parent_ts=128' // @suppress longLineCheck
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var thread = threads[0];
- assert.equal(thread.parent.pid, 2867);
- assert.equal(thread.tid, 2894);
- assert.equal(thread.name, 'SandboxedProces');
- assert.equal(thread.sliceGroup.length, 3);
-
- assert.equal(thread.sliceGroup.slices[0].args['arg1'], '1');
- assert.equal(thread.sliceGroup.slices[0].args['arg2'], '2');
-
- assert.equal(thread.sliceGroup.slices[1].args['source'], 'test=test');
- assert.equal(thread.sliceGroup.slices[1].category, 'cat2');
- assert.equal('DeferOrRunPendingTask',
- thread.sliceGroup.slices[1].title);
- assert.equal(thread.sliceGroup.slices[1].args['task'], 'xyz');
-
- assert.equal('ipc/ipc_sync_message_filter.cc:Send',
- thread.sliceGroup.slices[2].args['source']);
-
- assert.equal(thread.asyncSliceGroup.length, 1);
- assert.equal(thread.asyncSliceGroup.slices[0].args['arg1'], '1');
- assert.equal(thread.asyncSliceGroup.slices[0].args['arg2'], '2');
- assert.equal(thread.asyncSliceGroup.slices[0].args['arg3'], '3');
-
- var counters = m.getAllCounters();
- assert.equal(counters.length, 1);
- assert.equal(counters[0].category, 'cat1');
- assert.equal(counters[0].name, 'counter1');
-
- assert.equal(counters[0].numSamples, 1);
- assert.equal(counters[0].getSeries(0).getSample(0).value, 10);
-
- assert.equal(Math.round((253.780659 - (255.663276 - 128)) * 1000),
- Math.round(thread.sliceGroup.slices[0].start));
- });
-
- test('androidNeedReschedImport', function() {
- var lines = [
- 'RenderThread-3894 [001] ...1 253.780659: tracing_mark_write: B|3586|DrawFrame', // @suppress longLineCheck
- 'RenderThread-3894 [001] ...1 253.780671: tracing_mark_write: B|3586|waitForTask', // @suppress longLineCheck
- 'RenderThread-3894 [001] .N.1 253.780671: tracing_mark_write: E', // @suppress longLineCheck
- 'RenderThread-3894 [001] ...1 253.780671: tracing_mark_write: B|3586|waitForTask', // @suppress longLineCheck
- 'RenderThread-3894 [001] .n.1 253.780671: tracing_mark_write: E', // @suppress longLineCheck
- 'RenderThread-3894 [001] ...1 253.780671: tracing_mark_write: B|3586|waitForTask', // @suppress longLineCheck
- 'RenderThread-3894 [001] .p.1 253.780671: tracing_mark_write: E', // @suppress longLineCheck
- 'RenderThread-3894 [001] ...1 253.780686: tracing_mark_write: E' // @suppress longLineCheck
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings, 'hasImportWarnings');
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var thread = threads[0];
- assert.equal(thread.parent.pid, 3586);
- assert.equal(thread.tid, 3894);
- assert.equal(thread.name, 'RenderThread');
- assert.equal(thread.sliceGroup.length, 4);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/binder_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/binder_parser.html
deleted file mode 100644
index 4cebf557bdf..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/binder_parser.html
+++ /dev/null
@@ -1,694 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses Binder events
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
- var ColorScheme = tr.b.ColorScheme;
- var Parser = tr.e.importer.linux_perf.Parser;
-
- // Matches binder transactions:
- // transaction=%d dest_node=%d dest_proc=%d dest_thread=%d reply=%d flags=0x%x
- // code=0x%x
- var binderTransRE = new RegExp('transaction=(\\d+) dest_node=(\\d+) ' +
- 'dest_proc=(\\d+) dest_thread=(\\d+) ' +
- 'reply=(\\d+) flags=(0x[0-9a-fA-F]+) ' +
- 'code=(0x[0-9a-fA-F]+)');
-
- var binderTransReceivedRE = /transaction=(\d+)/;
-
- function isBinderThread(name) {
- return (name.indexOf('Binder') > -1);
- }
-
- // Taken from kernel source: include/uapi/linux/android/binder.h.
- var TF_ONE_WAY = 0x01;
- var TF_ROOT_OBJECT = 0x04;
- var TF_STATUS_CODE = 0x08;
- var TF_ACCEPT_FDS = 0x10;
- var NO_FLAGS = 0;
-
- function binderFlagsToHuman(num) {
- var flag = parseInt(num, 16);
- var str = '';
-
- if (flag & TF_ONE_WAY)
- str += 'this is a one-way call: async, no return; ';
- if (flag & TF_ROOT_OBJECT)
- str += 'contents are the components root object; ';
- if (flag & TF_STATUS_CODE)
- str += 'contents are a 32-bit status code; ';
- if (flag & TF_ACCEPT_FDS)
- str += 'allow replies with file descriptors; ';
- if (flag === NO_FLAGS)
- str += 'No Flags Set';
-
- return str;
- }
-
- function isReplyToOrigin(calling, called) {
- return (called.dest_proc === calling.calling_pid ||
- called.dest_thread === calling.calling_pid);
- }
-
- function binderCodeToHuman(code) {
- return 'Java Layer Dependent';
- }
-
- function doInternalSlice(trans, slice, ts) {
- if (slice.subSlices.length !== 0) {
- /* We want to make sure we keep moving the small slice to the end of
- the big slice or else the arrows will not point to the end.
- */
- slice.subSlices[0].start = ts;
- return slice.subSlices[0];
- }
- var kthread = trans.calling_kthread.thread;
- var internal_slice = kthread.sliceGroup.pushCompleteSlice('binder',
- slice.title,
- ts, .001, 0, 0,
- slice.args);
-
- internal_slice.title = slice.title;
- internal_slice.id = slice.id;
- internal_slice.colorId = slice.colorId;
- slice.subSlices.push(internal_slice);
- return internal_slice;
- }
-
- function generateBinderArgsForSlice(trans, c_threadName) {
- return {
- 'Transaction Id': trans.transaction_key,
- 'Destination Node': trans.dest_node,
- 'Destination Process': trans.dest_proc,
- 'Destination Thread': trans.dest_thread,
- 'Destination Name': c_threadName,
- 'Reply transaction?': trans.is_reply_transaction,
- 'Flags': trans.flags + ' ' +
- binderFlagsToHuman(trans.flags),
-
- 'Code': trans.code + ' ' +
- binderCodeToHuman(trans.code),
-
- 'Calling PID': trans.calling_pid,
- 'Calling tgid': trans.calling_kthread.thread.parent.pid
- };
- }
-
- /** @constructor */
- function BinderTransaction(events, calling_pid, calling_ts, calling_kthread) {
- this.transaction_key = parseInt(events[1]);
- this.dest_node = parseInt(events[2]);
- this.dest_proc = parseInt(events[3]);
- this.dest_thread = parseInt(events[4]);
- this.is_reply_transaction = parseInt(events[5]) === 1 ? true : false;
- this.expect_reply = ((this.is_reply_transaction === false) &&
- (parseInt(events[6], 16) & TF_ONE_WAY) === 0);
-
- this.flags = events[6];
- this.code = events[7];
- this.calling_pid = calling_pid;
- this.calling_ts = calling_ts;
- this.calling_kthread = calling_kthread;
- }
-
-
- /** @constructor */
- function BinderParser(importer) {
- Parser.call(this, importer);
- importer.registerEventHandler('binder_locked',
- BinderParser.prototype.
- binderLocked.bind(this));
- importer.registerEventHandler('binder_unlock',
- BinderParser.prototype.
- binderUnlock.bind(this));
- importer.registerEventHandler('binder_lock',
- BinderParser.prototype.binderLock.bind(this));
- importer.registerEventHandler('binder_transaction',
- BinderParser.prototype.
- binderTransaction.bind(this));
- importer.registerEventHandler('binder_transaction_received',
- BinderParser.prototype.
- binderTransactionReceived.bind(this));
-
- this.model_ = importer.model;
- this.kthreadlookup = {};
- this.importer_ = importer;
- this.transWaitingRecv = {};
- this.syncTransWaitingCompletion = {};
- this.recursiveSyncTransWaitingCompletion_ByPID = {};
- this.receivedTransWaitingConversion = {};
- }
-
- BinderParser.prototype = {
- __proto__: Parser.prototype,
-
- binderLock: function(eventName, cpuNumber, pid, ts, eventBase) {
- var tgid = parseInt(eventBase.tgid);
- this.doNameMappings(pid, tgid, eventName.threadName);
-
- var kthread = this.importer_.
- getOrCreateBinderKernelThread(eventBase.threadName, tgid, pid);
-
- kthread.binderAttemptLockTS = ts;
- kthread.binderOpenTsA = ts;
- return true;
- },
-
- binderLocked: function(eventName, cpuNumber, pid, ts, eventBase) {
- var binder_thread = isBinderThread(eventBase.threadName);
- var tgid, name;
- var as_slice;
- var need_push = false;
- var kthread, rthread;
-
- tgid = parseInt(eventBase.tgid);
- name = eventBase.threadName;
-
- kthread = this.importer_.
- getOrCreateBinderKernelThread(eventBase.threadName, tgid, pid);
-
- this.doNameMappings(pid, tgid, name);
-
- rthread = kthread.thread;
- kthread.binderLockAquiredTS = ts;
-
- if (kthread.binderAttemptLockTS === undefined)
- return false;
-
- var args = this.generateArgsForSlice(tgid, pid, name, kthread);
- rthread.sliceGroup.pushCompleteSlice('binder', 'binder lock waiting',
- kthread.binderAttemptLockTS,
- ts - kthread.binderAttemptLockTS,
- 0, 0, args);
-
- kthread.binderAttemptLockTS = undefined;
- return true;
- },
-
- binderUnlock: function(eventName, cpuNumber, pid, ts, eventBase) {
- var tgid = parseInt(eventBase.tgid);
- var kthread = this.importer_.
- getOrCreateBinderKernelThread(
- eventBase.threadName, tgid, pid);
-
- if (kthread.binderLockAquiredTS === undefined)
- return false;
-
- var args = this.generateArgsForSlice(tgid, pid, eventBase.threadName,
- kthread);
- kthread.thread.sliceGroup.pushCompleteSlice(
- 'binder',
- 'binder lock held',
- kthread.binderLockAquiredTS,
- ts - kthread.binderLockAquiredTS,
- 0, 0, args);
-
- kthread.binderLockAquiredTS = undefined;
- return true;
- },
-
- /** There are a few transaction status changes that signify
- * progress through a binder transaction:
- *
- * Case One: Sync transaction.
- * Thread A calls a blocking function on Thread B. We receive a
- * binder_transaction msg From thread A stating that it is going to Call
- * thread B. We create a slice and a binder object for this transaction and
- * add it to addTransactionWaitingForRecv(transaction key, binder object)
- * This notifies thread B and passes the slice, binder object and time
- * stamp.
- *
- * Case Two: Async transaction.
- * Thread A calls an async function on Thread B. Like above we receive a
- * binder_transaction message, but the flags differ from above. The
- * TF_ONEWAY flags are set so we know that when Thread B gets the
- * binder_transaction_received with the same transaciton key the total
- * transaction is complete.
- *
- * Case Three: 'Prior_receive'
- * Prior_receive occurs when the thread being called (think A calls B),
- * receives a binder_transaction_received message, but cannot correlate it
- * to any current outstanding recursive transactions. That means the
- * message it just received is the start of some communication, not some
- * ongoing communication.
- * Once the execution flow has been passed to thread B, from A:
- * Thread B enters binder_transaction_received() we see that Thread A
- * had notified us that it sent us a message by calling
- * getTransactionWaitingForRecv(transaction key);
- * What can happen now is either this was a simple Call reply,
- * or this is a call -> recursion -> reply. We call modelPriorReceive()
- * which sets up the slices accordingly.
- * If this is a call -> recursion -> reply
- * we will go to case 4 by calling addRecursiveSyncTransNeedingCompletion()
- * The function takes B's PID, the binder object from A and the current
- * binder object from B. This function adds outstanding non-complete
- * transactions to a stack on thread B.
- *
- * Case Four: 'recursive_trans'
- * This case follows Like above:
- * A sent binder_transaction
- * B got binder_transaction_received
- * B instead of replying to A can Call C or call 'into' A, ie recursion
- * Case four also deals with setting up a large slice to 'contain'
- * all the recursive transactions that happen until B finally replies to
- * A.
- *
- *
- * An example: A-> B-> C-> B-> A
- *
- * (1) A starts a synchronous transaction to B.
- * (2) A enters binderTransaction() event handler, hits the else statement
- * (3) A calls addTransactionWaitingForRecv(trans key, object) to notify
- * Thread B.
- * (4) B Enters binderTransactionReceived().
- * (5) B hits the second if after calling
- * getTransactionWaitingForRecv(trans key)
- * This function returns us the object set up in step (3).
- * (6) This is not an async transaction, B calls
- * setCurrentReceiveOnPID(B's PID, [ts for (4), object from (3)]).
- *
- * (7) B enters binderTransaction() event handler, first if triggers after
- * calling getPriorReceiveOnPID(B's PID) the tuple from (6) is returned.
- *
- * (8) Execution enters modelPriorReceive().
- * (8a) A slice is setup for this binder transaction in B's timeline.
- * (9) This is not a reply to thread A, B is going to call Thread C.
- * (10) else statement is hit.
- * (11) We set the tile from (8a) to be binder_reply this is the
- * 'containg slice' for the recursion
- * (12) We create a new slice 'binder_transaction' this slice is the
- * recursive slice that will have arrows to Thread C's slice.
- * (13) addRecursiveSyncTransNeedingCompletion(B's PID,
- * [obj from (3), obj from 7])
- * this sets up notification that B's pid has outstanding recursive
- * transactions that need to be completed.
- * (14) B notifies C that a transaction is waiting for it by calling
- * addTransactionWaitingForRecv like in step (3).
- * (15) C enters binderTransactionReceived() step 5 6 7 8 8a happen, but in
- * the context of Thread C.
- * (16) C is in modelPriorReceive(), it hits the first if statement,
- * this transaction _IS_ a reply, and it is a reply to B.
- * (17) C calls addSyncTransNeedingCompletion(trans key,
- * [object from(3), object from 15-5])
- * (18) B enters binderTransactionReceived() hits the first if after calling
- * getSyncTransNeedingCompletion(trans key from (17)) the tuple from
- * (17) gets returned.
- *
- * (19) B scales up the slice created in (12) and sets up flows from 15-8a
- * slice.
- * (20) B enters BinderTransaction() event handler and the second if is hit
- * after calling getRecursiveTransactionNeedingCompletion(B's pid).
- * (21) modelRecursiveTransactions() gets called, first if executes.
- * (22) slice durations are fixed up.
- * (23) B notifies A via
- * addSyncTransNeedingCompletion(trans key, binder obj from 8a).
- * (24) B deletes the outstanding asynctrans via
- ( removeRecursiveTransaction(B's pid).
- * (25) A enters binderTransactionReceived() event handler and finishes up
- * some flows, and slices.
- */
- binderTransaction: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = binderTransRE.exec(eventBase.details);
- if (event === undefined)
- return false;
-
- var tgid = parseInt(eventBase.tgid);
-
- this.doNameMappings(pid, tgid, eventBase.threadName);
-
- var kthread;
- kthread = this.importer_.
- getOrCreateBinderKernelThread(eventBase.threadName, tgid, pid);
-
- var trans = new BinderTransaction(event, pid, ts, kthread);
- var args = generateBinderArgsForSlice(trans, eventBase.threadName);
- /**
- * This thread previously ack'd the transaction with a
- * transaction_received. That means someone sent us a message we processed
- * it and are now sending a transaction.
- * The transaction could be a response, or it could be recursive.
- */
- var prior_receive = this.getPriorReceiveOnPID(pid);
-
- if (prior_receive !== false) {
- return this.modelPriorReceive(prior_receive, ts, pid, tgid, kthread,
- trans, args, event);
- }
- /**
- * This Thread has an already established recursive slice. We will now
- * either complete the entire transaction, OR do more recursive calls.
- */
- var recursive_trans = this.getRecursiveTransactionNeedingCompletion(pid);
-
- if (recursive_trans !== false)
- return this.modelRecursiveTransactions(recursive_trans, ts, pid,
- kthread, trans, args);
-
- /**
- * Start of a Transaction. This thread is the initiator of either a call
- * response, an async call -> ack, or a call -> recursion -> response.
- * Note, we put a fake duration into this slice and patch it up later.
- */
- var slice = kthread.thread.sliceGroup.pushCompleteSlice('binder',
- '', ts, .03, 0, 0, args);
-
- slice.colorId = ColorScheme.getColorIdForGeneralPurposeString(
- ts.toString());
- trans.slice = slice;
-
- if (trans.expect_reply)
- slice.title = 'binder transaction';
- else
- slice.title = 'binder transaction async';
-
- this.addTransactionWaitingForRecv(trans.transaction_key, trans);
-
- return true;
- },
-
- binderTransactionReceived: function(eventName, cpuNumber, pid, ts,
- eventBase) {
- var event = binderTransReceivedRE.exec(eventBase.details);
-
- if (event === undefined)
- return false;
-
- var transactionkey = parseInt(event[1]);
- var tgid = parseInt(eventBase.tgid);
- var kthread;
- kthread = this.importer_.
- getOrCreateBinderKernelThread(eventBase.threadName, tgid, pid);
-
- var syncComplete = this.getSyncTransNeedsCompletion(transactionkey);
-
- if (syncComplete !== false) {
- /* This recv is the completion of a synchronous transaction.
- * We need to scale the slice up to the current ts and finish
- * creating some flows.
- */
- var sync_trans = syncComplete[0];
- var sync_slice = sync_trans.slice;
- var response_trans = syncComplete[1];
- var response_slice = response_trans.slice;
-
- sync_slice.duration = ts - sync_slice.start;
- /** These calls are a little hack that places a very small slice at
- * the end of the sync slice and the response slice. This allows us
- * to hook flow events (arrows) from the start to the end of the
- * slices.
- */
- var sync_internal = doInternalSlice(sync_trans, sync_slice, ts);
- var response_ts = response_slice.start + response_slice.duration;
- var response_internal = doInternalSlice(response_trans,
- response_slice, response_ts);
-
- if (response_slice.outFlowEvents.length === 0 ||
- sync_slice.inFlowEvents.length === 0) {
- var flow = this.generateFlow(response_internal, sync_internal,
- response_trans, sync_trans);
-
- sync_slice.inFlowEvents.push(flow);
- response_slice.outFlowEvents.push(flow);
- this.model_.flowEvents.push(flow);
- }
- // Move flow arrows -- but not the first one.
- for (var i = 1; i < sync_slice.inFlowEvents.length; i++) {
- sync_slice.inFlowEvents[i].duration =
- ts - sync_slice.inFlowEvents[i].start;
- }
- return true;
- }
-
- var tr_for_recv = this.getTransactionWaitingForRecv(transactionkey);
-
- if (tr_for_recv !== false) {
- if (!tr_for_recv.expect_reply) {
- // This is an async call place an Async slice.
- var args = generateBinderArgsForSlice(tr_for_recv,
- eventBase.threadName);
- var slice = kthread.thread.sliceGroup.
- pushCompleteSlice('binder',
- 'binder Async recv',
- ts, .03, 0, 0,
- args);
-
- var fake_event = [0, 0, 0, 0, 0, 0, 0];
- var fake_trans = new BinderTransaction(fake_event, pid, ts, kthread);
- var flow = this.generateFlow(tr_for_recv.slice, slice,
- tr_for_recv, fake_trans);
-
- this.model_.flowEvents.push(flow);
- tr_for_recv.slice.title = 'binder transaction async';
- tr_for_recv.slice.duration = .03;
- return true;
- }
- // Setup prior receive.
- tr_for_recv.slice.title = 'binder transaction';
- this.setCurrentReceiveOnPID(pid, [ts, tr_for_recv]);
- return true;
- }
- /** This case is when we received an ack for a transaction we have
- * never seen before. This usually happens at the start of a trace.
- * We will get incomplete transactions that started before started
- * tracing. Just discard them.
- */
- return false;
- },
-
- // helper functions
- modelRecursiveTransactions: function(recursive_trans, ts, pid, kthread,
- trans, args) {
-
- var recursive_slice = recursive_trans[1].slice;
- var orig_slice = recursive_trans[0].slice;
- recursive_slice.duration = ts - recursive_slice.start;
- trans.slice = recursive_slice;
-
- if (trans.is_reply_transaction) {
- /* Case one:
- * This transaction is finally the reply of the recursion.
- */
- orig_slice.duration = ts - orig_slice.start;
- this.addSyncTransNeedingCompletion(trans.transaction_key,
- recursive_trans);
-
- if (isReplyToOrigin(recursive_trans[0], trans))
- this.removeRecursiveTransaction(pid);
- } else {
- /**
- * Case two:
- * This transaction is more recursive calls.
- * This is a nested call within an already started transaction,
- * it can either be a async or a normal sync transaction.
- */
- var slice = kthread.thread.sliceGroup.pushCompleteSlice('binder',
- '' , ts, .03, 0,
- 0, args);
-
- trans.slice = slice;
- this.addTransactionWaitingForRecv(trans.transaction_key, trans);
- }
- return true;
- },
-
- modelPriorReceive: function(prior_receive, ts, pid, tgid, kthread, trans,
- args, event) {
- var callee_slice = prior_receive[1].slice;
- var callee_trans = prior_receive[1];
- var recv_ts = prior_receive[0];
- var slice = kthread.thread.sliceGroup.pushCompleteSlice('binder',
- '', recv_ts, ts - recv_ts, 0, 0, args);
-
- var flow = this.generateFlow(callee_slice, slice, callee_trans, trans);
- this.model_.flowEvents.push(flow);
- trans.slice = slice;
-
- if (trans.is_reply_transaction) {
- /* This is a response to a synchronous or a recursive sync
- * transaction.
- */
- slice.title = 'binder reply';
- /* Notify this transaction key that when it recv's it is completing
- * a sync transaction.
- */
- this.addSyncTransNeedingCompletion(trans.transaction_key,
- [callee_trans, trans]);
- } else {
- /**
- * Recursive calls and or calls around, either way it's not
- * going to complete a transaction.
- */
- slice.title = 'binder reply';
- /* Since this is a recursive transaction we want to create the main
- * large slice which will contain all these recursive transactions.
- * For that we created the main slice above and this is a recursive
- * transaction that will be placed right below it. Note, that this
- * is only for the first recursive transaction. If more come they will
- * be handled below in the getRecursiveTransactionNeedingCompletion
- */
- var trans1 = new BinderTransaction(event, pid, ts, kthread);
-
- slice = kthread.thread.sliceGroup.
- pushCompleteSlice('binder',
- 'binder transaction',
- recv_ts,
- (ts - recv_ts), 0,
- 0, args);
-
- /* could be a async trans if so set the length to be a small one */
- if (!trans.expect_reply) {
- slice.title = 'binder transaction async';
- slice.duration = .03;
- } else {
- /* stupid hack to stop merging of AIDL slices and
- * this slice. This is currently disabled, if AIDL tracing is on we
- * will see merging of this slice and the AIDL slice. Once upstream
- * has a solution for flow events to be placed in the middle of
- * slices this part can be fixed.
- *
- * This is commented out because AIDL tracing doesn't exit yet.
- */
- //slice.start += .15;
- }
- trans1.slice = slice;
- this.addRecursiveSyncTransNeedingCompletion(pid,
- [callee_trans, trans]);
- this.addTransactionWaitingForRecv(trans.transaction_key, trans1);
- }
- return true;
- },
-
- getRecursiveTransactionNeedingCompletion: function(pid) {
- if (this.recursiveSyncTransWaitingCompletion_ByPID[pid] === undefined)
- return false;
-
- var len = this.recursiveSyncTransWaitingCompletion_ByPID[pid].length;
- if (len === 0)
- return false;
-
- return this.recursiveSyncTransWaitingCompletion_ByPID[pid][len - 1];
- },
-
- addRecursiveSyncTransNeedingCompletion: function(pid, tuple) {
- if (this.recursiveSyncTransWaitingCompletion_ByPID[pid] === undefined)
- this.recursiveSyncTransWaitingCompletion_ByPID[pid] = [];
-
- this.recursiveSyncTransWaitingCompletion_ByPID[pid].push(tuple);
- },
-
- removeRecursiveTransaction: function(pid) {
- var len = this.recursiveSyncTransWaitingCompletion_ByPID[pid].length;
- if (len === 0) {
- delete this.recursiveSyncTransWaitingCompletion_ByPID[pid];
- return;
- }
-
- this.recursiveSyncTransWaitingCompletion_ByPID[pid].splice(len - 1, 1);
- },
-
- setCurrentReceiveOnPID: function(pid, tuple) {
- if (this.receivedTransWaitingConversion[pid] === undefined) {
- this.receivedTransWaitingConversion[pid] = [];
- }
- this.receivedTransWaitingConversion[pid].push(tuple);
- },
-
- getPriorReceiveOnPID: function(pid) {
- if (this.receivedTransWaitingConversion[pid] === undefined)
- return false;
-
- var len = this.receivedTransWaitingConversion[pid].length;
- if (len === 0)
- return false;
-
- return this.receivedTransWaitingConversion[pid].splice(len - 1, 1)[0];
- },
-
- addSyncTransNeedingCompletion: function(transactionkey, tuple) {
- var dict = this.syncTransWaitingCompletion;
- dict[transactionkey] = tuple;
- },
-
- getSyncTransNeedsCompletion: function(transactionkey) {
- var ret = this.syncTransWaitingCompletion[transactionkey];
- if (ret === undefined)
- return false;
-
- delete this.syncTransWaitingCompletion[transactionkey];
- return ret;
- },
-
- getTransactionWaitingForRecv: function(transactionkey) {
- var ret = this.transWaitingRecv[transactionkey];
- if (ret === undefined)
- return false;
-
- delete this.transWaitingRecv[transactionkey];
- return ret;
- },
-
- addTransactionWaitingForRecv: function(transactionkey, transaction) {
- this.transWaitingRecv[transactionkey] = transaction;
- },
-
- generateFlow: function(from, to, from_trans, to_trans) {
- var title = 'Transaction from : ' +
- this.pid2name(from_trans.calling_pid) +
- ' From PID: ' + from_trans.calling_pid + ' to pid: ' +
- to_trans.calling_pid +
- ' Thread Name: ' + this.pid2name(to_trans.calling_pid);
-
- var ts = from.start;
- var flow = new tr.model.FlowEvent('binder', 'binder',
- title, 1, ts, []);
- flow.startSlice = from;
- flow.endSlice = to;
- flow.start = from.start;
- flow.duration = to.start - ts;
-
- from.outFlowEvents.push(flow);
- to.inFlowEvents.push(flow);
-
- return flow;
- },
-
- generateArgsForSlice: function(tgid, pid, name, kthread) {
- return {
- 'Thread Name': name,
- 'pid': pid,
- 'gid': tgid
- };
- },
-
- pid2name: function(pid) {
- return this.kthreadlookup[pid];
- },
-
- doNameMappings: function(pid, tgid, name) {
- this.registerPidName(pid, name);
- this.registerPidName(tgid, name);
- },
-
- registerPidName: function(pid, name) {
- if (this.pid2name(pid) === undefined)
- this.kthreadlookup[pid] = name;
- }
- };
-
- Parser.register(BinderParser);
- return {
- BinderParser: BinderParser
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/binder_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/binder_parser_test.html
deleted file mode 100644
index 513279adbea..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/binder_parser_test.html
+++ /dev/null
@@ -1,225 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('binderParserImport', function() {
- var lines = [
- 'binderLibTest-10619 (10619) [001] ...1 25191.335749: binder_transaction' +
- ': transaction=489053 dest_node=489048 dest_proc=10670 dest_thread=0 ' +
- 'reply=0 flags=0x10 code=0xd',
- 'binderLibTest-10670 (10670) [000] ...1 25191.335996:' +
- ' binder_transaction_received: transaction=489053',
- 'binderLibTest-10670 (10670) [000] ...1 25191.336167:' +
- ' binder_transaction: transaction=489056 dest_node=161277 ' +
- 'dest_proc=3454 dest_thread=0 reply=0 flags=0x10 code=0x2',
- '/system/bin/servicemanager-3454 ( 3454) [000] ...1 25191.336199:' +
- ' binder_transaction_received: transaction=489056',
- '/system/bin/servicemanager-3454 ( 3454) [000] ...1 25191.336302:' +
- ' binder_transaction: transaction=489057 dest_node=0 dest_proc=10670' +
- ' dest_thread=10670 reply=1 flags=0x0 code=0x0',
- 'binderLibTest-10670 (10670) [000] ...1 25191.336334:' +
- ' binder_transaction_received: transaction=489057',
- 'binderLibTest-10670 (10670) [000] ...1 25191.336655:' +
- ' binder_transaction: transaction=489059 dest_node=488755' +
- ' dest_proc=10622 dest_thread=0 reply=0 flags=0x10 code=0x1',
- 'Binder_4-10645 (10622) [001] ...1 25191.336693:' +
- ' binder_transaction_received: transaction=489059',
- 'Binder_4-10645 (10622) [001] ...1 25191.336754: binder_transaction:' +
- ' transaction=489060 dest_node=0 dest_proc=10670 dest_thread=10670' +
- ' reply=1 flags=0x0 code=0x0',
- 'binderLibTest-10670 (10670) [000] ...1 25191.337003:' +
- ' binder_transaction_received: transaction=489060',
- 'binderLibTest-10670 (10670) [000] ...1 25191.337052:' +
- ' binder_transaction: transaction=489061 dest_node=0 dest_proc=10619' +
- ' dest_thread=10619 reply=1 flags=0x8 code=0x0',
- 'binderLibTest-10619 (10619) [001] ...1 25191.337085:' +
- ' binder_transaction_received: transaction=489061',
- 'atrace-10618 (10618) [000] ...1 25196.059954: tracing_mark_write:' +
- ' trace_event_clock_sync: parent_ts=25196.050781'
- ];
-
- var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shfitWorldToZero: false
- });
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 4);
-
- });
-
- test('binderRecursiveTest', function() {
- var lines = [
- 'binderLibTest-10619 (10619) [001] ...1 25191.335749: binder_transaction' +
- ': transaction=489053 dest_node=489048 dest_proc=10670 dest_thread=0 ' +
- 'reply=0 flags=0x10 code=0xd',
- 'binderLibTest-10670 (10670) [000] ...1 25191.335996:' +
- ' binder_transaction_received: transaction=489053',
- 'binderLibTest-10670 (10670) [000] ...1 25191.336167:' +
- ' binder_transaction: transaction=489056 dest_node=161277 ' +
- 'dest_proc=3454 dest_thread=0 reply=0 flags=0x10 code=0x2',
- '/system/bin/servicemanager-3454 ( 3454) [000] ...1 25191.336199:' +
- ' binder_transaction_received: transaction=489056',
- '/system/bin/servicemanager-3454 ( 3454) [000] ...1 25191.336302:' +
- ' binder_transaction: transaction=489057 dest_node=0 dest_proc=10670' +
- ' dest_thread=10670 reply=1 flags=0x0 code=0x0',
- 'binderLibTest-10670 (10670) [000] ...1 25191.336334:' +
- ' binder_transaction_received: transaction=489057',
- 'binderLibTest-10670 (10670) [000] ...1 25191.336655:' +
- ' binder_transaction: transaction=489059 dest_node=488755' +
- ' dest_proc=10622 dest_thread=0 reply=0 flags=0x10 code=0x1',
- 'Binder_4-10645 (10622) [001] ...1 25191.336693:' +
- ' binder_transaction_received: transaction=489059',
- 'Binder_4-10645 (10622) [001] ...1 25191.336754: binder_transaction:' +
- ' transaction=489060 dest_node=0 dest_proc=10670 dest_thread=10670' +
- ' reply=1 flags=0x0 code=0x0',
- 'binderLibTest-10670 (10670) [000] ...1 25191.337003:' +
- ' binder_transaction_received: transaction=489060',
- 'binderLibTest-10670 (10670) [000] ...1 25191.337052:' +
- ' binder_transaction: transaction=489061 dest_node=0 dest_proc=10619' +
- ' dest_thread=10619 reply=1 flags=0x8 code=0x0',
- 'binderLibTest-10619 (10619) [001] ...1 25191.337085:' +
- ' binder_transaction_received: transaction=489061',
- 'atrace-10618 (10618) [000] ...1 25196.059954: tracing_mark_write:' +
- ' trace_event_clock_sync: parent_ts=25196.050781'
- ];
-
- var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shfitWorldToZero: false
- });
- var threads = m.getAllThreads();
-
- var thread = threads[0];
- assert.equal(thread.parent.pid, 3454);
- assert.equal(thread.tid, 3454);
- assert.equal(thread.name, '/system/bin/servicemanager');
- /* one main slice and one 'internal slice' for the end flow event' */
- assert.equal(thread.sliceGroup.length, 2);
-
- /* check flow events for service manager */
- var main_slice = thread.sliceGroup.slices[0];
- assert.equal(main_slice.inFlowEvents.length, 1);
- assert.equal(main_slice.outFlowEvents.length, 1);
- var internal_slice = thread.sliceGroup.slices[1];
- assert.equal(internal_slice.outFlowEvents.length, 1);
-
- /* check name of slice */
- assert.equal(main_slice.title, 'binder reply');
-
- /* check binderLibTest */
- thread = threads[1];
- assert.equal(thread.parent.pid, 10619);
- assert.equal(thread.tid, 10619);
- assert.equal(thread.name, 'binderLibTest');
-
- assert.equal(2, thread.sliceGroup.length);
-
- main_slice = thread.sliceGroup.slices[0];
- assert.equal(main_slice.inFlowEvents.length, 1);
- assert.equal(main_slice.outFlowEvents.length, 1);
- internal_slice = thread.sliceGroup.slices[1];
- assert.equal(internal_slice.inFlowEvents.length, 1);
-
- assert.equal(main_slice.title, 'binder transaction');
-
- /* check Binder_4 */
- thread = threads[2];
- assert.equal(thread.parent.pid, 10622);
- assert.equal(thread.tid, 10645);
- assert.equal(thread.name, 'Binder_4');
- assert.equal(2, thread.sliceGroup.length);
-
- main_slice = thread.sliceGroup.slices[0];
- assert.equal(main_slice.inFlowEvents.length, 1);
- assert.equal(main_slice.outFlowEvents.length, 1);
- internal_slice = thread.sliceGroup.slices[1];
- assert.equal(internal_slice.outFlowEvents.length, 1);
-
- assert.equal(main_slice.title, 'binder reply');
-
- /* check last binderLibTest with recursive slices */
- thread = threads[3];
- assert.equal(thread.parent.pid, 10670);
- assert.equal(thread.tid, 10670);
- assert.equal(thread.name, 'binderLibTest');
- assert.equal(6, thread.sliceGroup.length);
-
- main_slice = thread.sliceGroup.slices[0];
- assert.equal(main_slice.inFlowEvents.length, 1);
- assert.equal(main_slice.outFlowEvents.length, 1);
- internal_slice = thread.sliceGroup.slices[5];
- assert.equal(internal_slice.outFlowEvents.length, 1);
-
- assert.equal(main_slice.title, 'binder reply');
-
- var recursive = thread.sliceGroup.slices[1];
- var recursive_internal = thread.sliceGroup.slices[2];
- assert.equal(recursive.inFlowEvents.length, 1);
- assert.equal(recursive.outFlowEvents.length, 1);
- assert.equal(recursive_internal.inFlowEvents.length, 1);
-
- assert.equal(recursive.title, 'binder transaction');
-
- /* check second recursive slice and internal */
-
- var recursive = thread.sliceGroup.slices[3];
- var recursive_internal = thread.sliceGroup.slices[4];
- assert.equal(recursive.inFlowEvents.length, 1);
- assert.equal(recursive.outFlowEvents.length, 1);
- assert.equal(recursive_internal.inFlowEvents.length, 1);
-
- assert.equal(recursive.title, 'binder transaction');
- });
-
- test('binderSimpleAsync', function() {
- var lines = [
- '/system/bin/surfaceflinger-3462 ( 3462) [000] ...1 108286.109437:' +
- ' binder_transaction: transaction=923419 dest_node=175950' +
- ' dest_proc=4044 dest_thread=0 reply=0 flags=0x11 code=0x1',
- 'Binder_5-12869 ( 4044) [000] ...1 108286.109835:' +
- ' binder_transaction_received: transaction=923419'
- ];
-
- var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shfitWorldToZero: false
- });
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads(0);
- assert.equal(threads.length, 2);
-
- var thread = threads[0];
- assert.equal(thread.tid, 3462);
- assert.equal(thread.name, '/system/bin/surfaceflinger');
- assert.equal(thread.sliceGroup.length, 1);
-
- var slice = thread.sliceGroup.slices[0];
- assert.equal(slice.outFlowEvents.length, 1);
- assert.equal(slice.inFlowEvents.length, 0);
- assert.equal(slice.title, 'binder transaction async');
-
- thread = threads[1];
- assert.equal(thread.tid, 12869);
- assert.equal(thread.name, 'Binder_5');
- assert.equal(thread.sliceGroup.length, 1);
-
- slice = thread.sliceGroup.slices[0];
- assert.equal(slice.inFlowEvents.length, 1);
- assert.equal(slice.outFlowEvents.length, 0);
- assert.equal(slice.title, 'binder Async recv');
-
- });
-});
-
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/bus_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/bus_parser.html
deleted file mode 100644
index 55d80730405..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/bus_parser.html
+++ /dev/null
@@ -1,90 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-<link rel="import" href="/tracing/model/counter_series.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses trace_marker events that were inserted in the trace by
- * userland.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
- var ColorScheme = tr.b.ColorScheme;
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses linux trace mark events that were inserted in the trace by userland.
- * @constructor
- */
- function BusParser(importer) {
- Parser.call(this, importer);
-
- importer.registerEventHandler('memory_bus_usage',
- BusParser.prototype.traceMarkWriteBusEvent.bind(this));
-
- this.model_ = importer.model_;
- this.ppids_ = {};
- }
-
- BusParser.prototype = {
- __proto__: Parser.prototype,
-
- traceMarkWriteBusEvent: function(eventName, cpuNumber, pid, ts,
- eventBase, threadName) {
- var re = new RegExp('bus=(\\S+) rw_bytes=(\\d+) r_bytes=(\\d+) ' +
- 'w_bytes=(\\d+) cycles=(\\d+) ns=(\\d+)');
- var event = re.exec(eventBase.details);
-
- var name = event[1];
- var rw_bytes = parseInt(event[2]);
- var r_bytes = parseInt(event[3]);
- var w_bytes = parseInt(event[4]);
- var cycles = parseInt(event[5]);
- var ns = parseInt(event[6]);
-
- // BW in MB/s
- var r_bw = r_bytes * 1000000000 / ns;
- r_bw /= 1024 * 1024;
- var w_bw = w_bytes * 1000000000 / ns;
- w_bw /= 1024 * 1024;
-
- var ctr = this.model_.kernel
- .getOrCreateCounter(null, 'bus ' + name + ' read');
- if (ctr.numSeries === 0) {
- ctr.addSeries(new tr.model.CounterSeries('value',
- ColorScheme.getColorIdForGeneralPurposeString(
- ctr.name + '.' + 'value')));
- }
- ctr.series.forEach(function(series) {
- series.addCounterSample(ts, r_bw);
- });
-
- ctr = this.model_.kernel
- .getOrCreateCounter(null, 'bus ' + name + ' write');
- if (ctr.numSeries === 0) {
- ctr.addSeries(new tr.model.CounterSeries('value',
- ColorScheme.getColorIdForGeneralPurposeString(
- ctr.name + '.' + 'value')));
- }
- ctr.series.forEach(function(series) {
- series.addCounterSample(ts, r_bw);
- });
-
- return true;
- }
- };
-
- Parser.register(BusParser);
-
- return {
- BusParser: BusParser
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/bus_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/bus_parser_test.html
deleted file mode 100644
index 6222067d64c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/bus_parser_test.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('exynos5Bus', function() {
- var lines = [
- 's3c-fb-vsync-85 [001] d..2 8116.730115: memory_bus_usage: ' +
- 'bus=RIGHT rw_bytes=0 r_bytes=0 w_bytes=0 cycles=2681746 ns=16760792',
-
- 's3c-fb-vsync-85 [001] d..2 8116.730118: memory_bus_usage: ' +
- 'bus=CPU rw_bytes=2756608 r_bytes=2267328 w_bytes=491328 ' +
- 'cycles=6705198 ns=16763375',
-
- 's3c-fb-vsync-85 [001] d..2 8116.746788: memory_bus_usage: ' +
- 'bus=DDR_C rw_bytes=2736128 r_bytes=2260864 w_bytes=479248 ' +
- 'cycles=6670677 ns=16676375',
-
- 's3c-fb-vsync-85 [001] d..2 8116.746790: memory_bus_usage: ' +
- 'bus=DDR_R1 rw_bytes=31457280 r_bytes=31460912 w_bytes=0 ' +
- 'cycles=6670521 ns=16676500',
-
- 's3c-fb-vsync-85 [001] d..2 8116.746792: memory_bus_usage: ' +
- 'bus=DDR_L rw_bytes=16953344 r_bytes=16731088 w_bytes=223664 ' +
- 'cycles=6669885 ns=16674833',
-
- 's3c-fb-vsync-85 [001] d..2 8116.746793: memory_bus_usage: ' +
- 'bus=RIGHT rw_bytes=0 r_bytes=0 w_bytes=0 cycles=2667378 ns=16671250',
-
- 's3c-fb-vsync-85 [001] d..2 8116.746798: memory_bus_usage: ' +
- 'bus=CPU rw_bytes=2797568 r_bytes=2309424 w_bytes=491968 ' +
- 'cycles=6672156 ns=16680458',
-
- 's3c-fb-vsync-85 [001] d..2 8116.763521: memory_bus_usage: ' +
- 'bus=DDR_C rw_bytes=2408448 r_bytes=1968448 w_bytes=441456 ' +
- 'cycles=6689562 ns=16723458',
-
- 's3c-fb-vsync-85 [001] d..2 8116.763523: memory_bus_usage: ' +
- 'bus=DDR_R1 rw_bytes=31490048 r_bytes=31493360 w_bytes=0 ' +
- 'cycles=6690012 ns=16725083',
-
- 's3c-fb-vsync-85 [001] d..2 8116.763525: memory_bus_usage: ' +
- 'bus=DDR_L rw_bytes=16941056 r_bytes=16719136 w_bytes=223472 ' +
- 'cycles=6690156 ns=16725375'
-
- ];
- var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shiftWorldToZero: false
- });
- assert.isFalse(m.hasImportWarnings);
-
- var counters = m.getAllCounters();
- assert.equal(counters.length, 10);
-
- assert.equal(counters[0].series[0].samples.length, 2);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/clock_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/clock_parser.html
deleted file mode 100644
index 41c12d7f0c3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/clock_parser.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-<link rel="import" href="/tracing/model/counter_series.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses trace_marker events that were inserted in the trace by
- * userland.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
-
- var ColorScheme = tr.b.ColorScheme;
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses linux trace mark events that were inserted in the trace by userland.
- * @constructor
- */
- function ClockParser(importer) {
- Parser.call(this, importer);
-
- importer.registerEventHandler('clock_set_rate',
- ClockParser.prototype.traceMarkWriteClockEvent.bind(this));
-
- this.model_ = importer.model_;
- this.ppids_ = {};
- }
-
- ClockParser.prototype = {
- __proto__: Parser.prototype,
-
- traceMarkWriteClockEvent: function(eventName, cpuNumber, pid, ts,
- eventBase, threadName) {
- var event = /(\S+) state=(\d+) cpu_id=(\d+)/.exec(eventBase.details);
-
-
- var name = event[1];
- var rate = parseInt(event[2]);
-
- var ctr = this.model_.kernel
- .getOrCreateCounter(null, name);
- // Initialize the counter's series fields if needed.
- if (ctr.numSeries === 0) {
- ctr.addSeries(new tr.model.CounterSeries('value',
- ColorScheme.getColorIdForGeneralPurposeString(
- ctr.name + '.' + 'value')));
- }
- ctr.series.forEach(function(series) {
- series.addCounterSample(ts, rate);
- });
-
- return true;
- }
- };
-
- Parser.register(ClockParser);
-
- return {
- ClockParser: ClockParser
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/clock_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/clock_parser_test.html
deleted file mode 100644
index a348fe07cbc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/clock_parser_test.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('clock', function() {
- var lines = [
- 'cfinteractive-23 [000] d..2 8113.233768: clock_set_rate: ' +
- 'fout_apll state=500000000 cpu_id=0',
-
- 'cfinteractive-23 [000] d..2 8113.249509: clock_set_rate: ' +
- 'fout_apll state=300000000 cpu_id=0',
-
- 'cfinteractive-23 [000] d..2 8113.289796: clock_set_rate: ' +
- 'fout_apll state=400000000 cpu_id=0',
-
- 'cfinteractive-23 [000] d..2 8113.294568: clock_set_rate: ' +
- 'fout_apll state=500000000 cpu_id=0',
-
- 'cfinteractive-23 [000] d..2 8113.309509: clock_set_rate: ' +
- 'fout_apll state=800000000 cpu_id=0',
-
- 'cfinteractive-23 [000] d..2 8113.388732: clock_set_rate: ' +
- 'fout_apll state=200000000 cpu_id=0',
-
- 'cfinteractive-23 [000] d..2 8113.410182: clock_set_rate: ' +
- 'fout_apll state=300000000 cpu_id=0',
-
- 'cfinteractive-23 [000] d..2 8113.414872: clock_set_rate: ' +
- 'fout_apll state=600000000 cpu_id=0',
-
- 'cfinteractive-23 [000] d..2 8113.494455: clock_set_rate: ' +
- 'fout_apll state=200000000 cpu_id=0',
-
- 'cfinteractive-23 [000] d..2 8113.515254: clock_set_rate: ' +
- 'fout_apll state=500000000 cpu_id=0'
- ];
-
- var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shiftWorldToZero: false
- });
- assert.isFalse(m.hasImportWarnings);
-
- var counters = m.getAllCounters();
- assert.equal(counters.length, 1);
-
- assert.equal(counters[0].series[0].samples.length, 10);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/cpufreq_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/cpufreq_parser.html
deleted file mode 100644
index cd7f357c8e5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/cpufreq_parser.html
+++ /dev/null
@@ -1,115 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses cpufreq events in the Linux event trace format.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
-
- var ColorScheme = tr.b.ColorScheme;
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses linux cpufreq trace events.
- * @constructor
- */
- function CpufreqParser(importer) {
- Parser.call(this, importer);
-
- importer.registerEventHandler('cpufreq_interactive_up',
- CpufreqParser.prototype.cpufreqUpDownEvent.bind(this));
- importer.registerEventHandler('cpufreq_interactive_down',
- CpufreqParser.prototype.cpufreqUpDownEvent.bind(this));
- importer.registerEventHandler('cpufreq_interactive_already',
- CpufreqParser.prototype.cpufreqTargetEvent.bind(this));
- importer.registerEventHandler('cpufreq_interactive_notyet',
- CpufreqParser.prototype.cpufreqTargetEvent.bind(this));
- importer.registerEventHandler('cpufreq_interactive_setspeed',
- CpufreqParser.prototype.cpufreqTargetEvent.bind(this));
- importer.registerEventHandler('cpufreq_interactive_target',
- CpufreqParser.prototype.cpufreqTargetEvent.bind(this));
- importer.registerEventHandler('cpufreq_interactive_boost',
- CpufreqParser.prototype.cpufreqBoostUnboostEvent.bind(this));
- importer.registerEventHandler('cpufreq_interactive_unboost',
- CpufreqParser.prototype.cpufreqBoostUnboostEvent.bind(this));
- }
-
- function splitData(input) {
- // TODO(sleffler) split by cpu
- var data = {};
- var args = input.split(/\s+/);
- var len = args.length;
- for (var i = 0; i < len; i++) {
- var item = args[i].split('=');
- data[item[0]] = parseInt(item[1]);
- }
- return data;
- }
-
- CpufreqParser.prototype = {
- __proto__: Parser.prototype,
-
- cpufreqSlice: function(ts, eventName, cpu, args) {
- // TODO(sleffler) should be per-cpu
- var kthread = this.importer.getOrCreatePseudoThread('cpufreq');
- kthread.openSlice = eventName;
- var slice = new tr.model.Slice('', kthread.openSlice,
- ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice),
- ts, args, 0);
-
- kthread.thread.sliceGroup.pushSlice(slice);
- },
-
- cpufreqBoostSlice: function(ts, eventName, args) {
- var kthread = this.importer.getOrCreatePseudoThread('cpufreq_boost');
- kthread.openSlice = eventName;
- var slice = new tr.model.Slice('', kthread.openSlice,
- ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice),
- ts, args, 0);
-
- kthread.thread.sliceGroup.pushSlice(slice);
- },
-
- /**
- * Parses cpufreq events and sets up state in the importer.
- */
- cpufreqUpDownEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var data = splitData(eventBase.details);
- this.cpufreqSlice(ts, eventName, data.cpu, data);
- return true;
- },
-
- cpufreqTargetEvent: function(eventName, cpuNumber, pid, ts,
- eventBase) {
- var data = splitData(eventBase.details);
- this.cpufreqSlice(ts, eventName, data.cpu, data);
- return true;
- },
-
- cpufreqBoostUnboostEvent: function(eventName, cpuNumber, pid, ts,
- eventBase) {
- this.cpufreqBoostSlice(ts, eventName,
- {
- type: eventBase.details
- });
- return true;
- }
- };
-
- Parser.register(CpufreqParser);
-
- return {
- CpufreqParser: CpufreqParser
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/cpufreq_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/cpufreq_parser_test.html
deleted file mode 100644
index 114b8aa4c1a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/cpufreq_parser_test.html
+++ /dev/null
@@ -1,173 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function newModel(events) {
- return tr.c.TestUtils.newModelWithEvents([events], {
- shiftWorldToZero: false
- });
- }
-
- test('cpuFreqTargetImport', function() {
- var lines = [
- '<idle>-0 [000] ..s3 1043.718825: cpufreq_interactive_target: ' +
- 'cpu=0 load=2 cur=2000000 targ=300000\n',
- '<idle>-0 [000] ..s3 1043.718825: cpufreq_interactive_target: ' +
- 'cpu=0 load=12 cur=1000000 actual=1000000 targ=200000\n'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var thread = threads[0];
- assert.equal(thread.sliceGroup.slices[0].args['cpu'], 0);
- assert.equal(thread.sliceGroup.slices[0].args['load'], 2);
- assert.equal(thread.sliceGroup.slices[0].args['cur'], 2000000);
- assert.equal(thread.sliceGroup.slices[0].args['targ'], 300000);
-
- assert.equal(thread.sliceGroup.slices[1].args['cpu'], 0);
- assert.equal(thread.sliceGroup.slices[1].args['load'], 12);
- assert.equal(thread.sliceGroup.slices[1].args['cur'], 1000000);
- assert.equal(thread.sliceGroup.slices[1].args['actual'], 1000000);
- assert.equal(thread.sliceGroup.slices[1].args['targ'], 200000);
- });
-
- test('cpuFreqNotYetImport', function() {
- var lines = [
- '<idle>-0 [001] ..s3 1043.718832: cpufreq_interactive_notyet: ' +
- 'cpu=1 load=10 cur=700000 targ=200000\n',
- '<idle>-0 [001] ..s3 1043.718832: cpufreq_interactive_notyet: ' +
- 'cpu=1 load=10 cur=700000 actual=1000000 targ=200000\n'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var thread = threads[0];
- assert.equal(thread.sliceGroup.slices[0].args['cpu'], 1);
- assert.equal(thread.sliceGroup.slices[0].args['load'], 10);
- assert.equal(thread.sliceGroup.slices[0].args['cur'], 700000);
- assert.equal(thread.sliceGroup.slices[0].args['targ'], 200000);
-
- assert.equal(thread.sliceGroup.slices[1].args['cpu'], 1);
- assert.equal(thread.sliceGroup.slices[1].args['load'], 10);
- assert.equal(thread.sliceGroup.slices[1].args['cur'], 700000);
- assert.equal(thread.sliceGroup.slices[1].args['actual'], 1000000);
- assert.equal(thread.sliceGroup.slices[1].args['targ'], 200000);
- });
-
- test('cpuFreqSetSpeedImport', function() {
- var lines = [
- 'cfinteractive-23 [001] ...1 1043.719688: ' +
- 'cpufreq_interactive_setspeed: cpu=0 targ=200000 actual=700000\n'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var thread = threads[0];
- assert.equal(thread.sliceGroup.slices[0].args['cpu'], 0);
- assert.equal(thread.sliceGroup.slices[0].args['targ'], 200000);
- assert.equal(thread.sliceGroup.slices[0].args['actual'], 700000);
- });
-
- test('cpuFreqAlreadyImport', function() {
- var lines = [
- '<idle>-0 [000] ..s3 1043.738822: cpufreq_interactive_already: cpu=0 load=18 cur=200000 actual=700000 targ=200000\n' // @suppress longLineCheck
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var thread = threads[0];
- assert.equal(thread.sliceGroup.slices[0].args['cpu'], 0);
- assert.equal(thread.sliceGroup.slices[0].args['load'], 18);
- assert.equal(thread.sliceGroup.slices[0].args['cur'], 200000);
- assert.equal(thread.sliceGroup.slices[0].args['actual'], 700000);
- assert.equal(thread.sliceGroup.slices[0].args['targ'], 200000);
- });
-
- test('cpuFreqBoostImport', function() {
- var lines = [
- 'InputDispatcher-465 [001] ...1 1044.213948: ' +
- 'cpufreq_interactive_boost: pulse\n'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var thread = threads[0];
- assert.equal(thread.sliceGroup.slices[0].args['type'], 'pulse');
- });
-
- test('cpuFreqUnBoostImport', function() {
- var lines = [
- 'InputDispatcher-465 [001] ...1 1044.213948: ' +
- 'cpufreq_interactive_unboost: pulse\n'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var thread = threads[0];
- assert.equal(thread.sliceGroup.slices[0].args['type'], 'pulse');
- });
-
- test('cpuFreqUpImport', function() {
- var lines = [
- 'kinteractive-69 [003] .... 414324.164432: ' +
- 'cpufreq_interactive_up: cpu=1 targ=1400000 actual=800000'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var thread = threads[0];
- assert.equal(thread.sliceGroup.slices[0].args['cpu'], 1);
- assert.equal(thread.sliceGroup.slices[0].args['targ'], 1400000);
- assert.equal(thread.sliceGroup.slices[0].args['actual'], 800000);
- });
-
- test('cpuFreqDownImport', function() {
- var lines = [
- 'kinteractive-69 [003] .... 414365.834193: ' +
- 'cpufreq_interactive_down: cpu=3 targ=800000 actual=1000000'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var thread = threads[0];
- assert.equal(thread.sliceGroup.slices[0].args['cpu'], 3);
- assert.equal(thread.sliceGroup.slices[0].args['targ'], 800000);
- assert.equal(thread.sliceGroup.slices[0].args['actual'], 1000000);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/disk_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/disk_parser.html
deleted file mode 100644
index bbbeae733f3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/disk_parser.html
+++ /dev/null
@@ -1,313 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses filesystem and block device events in the Linux event
- * trace format.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
-
- var ColorScheme = tr.b.ColorScheme;
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses linux filesystem and block device trace events.
- * @constructor
- */
- function DiskParser(importer) {
- Parser.call(this, importer);
-
- importer.registerEventHandler('f2fs_write_begin',
- DiskParser.prototype.f2fsWriteBeginEvent.bind(this));
- importer.registerEventHandler('f2fs_write_end',
- DiskParser.prototype.f2fsWriteEndEvent.bind(this));
- importer.registerEventHandler('f2fs_sync_file_enter',
- DiskParser.prototype.f2fsSyncFileEnterEvent.bind(this));
- importer.registerEventHandler('f2fs_sync_file_exit',
- DiskParser.prototype.f2fsSyncFileExitEvent.bind(this));
- importer.registerEventHandler('ext4_sync_file_enter',
- DiskParser.prototype.ext4SyncFileEnterEvent.bind(this));
- importer.registerEventHandler('ext4_sync_file_exit',
- DiskParser.prototype.ext4SyncFileExitEvent.bind(this));
- importer.registerEventHandler('ext4_da_write_begin',
- DiskParser.prototype.ext4WriteBeginEvent.bind(this));
- importer.registerEventHandler('ext4_da_write_end',
- DiskParser.prototype.ext4WriteEndEvent.bind(this));
- importer.registerEventHandler('block_rq_issue',
- DiskParser.prototype.blockRqIssueEvent.bind(this));
- importer.registerEventHandler('block_rq_complete',
- DiskParser.prototype.blockRqCompleteEvent.bind(this));
- }
-
- DiskParser.prototype = {
- __proto__: Parser.prototype,
-
- openAsyncSlice: function(ts, category, threadName, pid, key, name) {
- var kthread = this.importer.getOrCreateKernelThread(
- category + ':' + threadName, pid);
- var asyncSliceConstructor =
- tr.model.AsyncSlice.getConstructor(
- category, name);
- var slice = new asyncSliceConstructor(
- category, name,
- ColorScheme.getColorIdForGeneralPurposeString(name),
- ts);
- slice.startThread = kthread.thread;
-
- if (!kthread.openAsyncSlices) {
- kthread.openAsyncSlices = { };
- }
- kthread.openAsyncSlices[key] = slice;
- },
-
- closeAsyncSlice: function(ts, category, threadName, pid, key, args) {
- var kthread = this.importer.getOrCreateKernelThread(
- category + ':' + threadName, pid);
- if (kthread.openAsyncSlices) {
- var slice = kthread.openAsyncSlices[key];
- if (slice) {
- slice.duration = ts - slice.start;
- slice.args = args;
- slice.endThread = kthread.thread;
- slice.subSlices = [
- new tr.model.AsyncSlice(category, slice.title,
- slice.colorId, slice.start, slice.args, slice.duration)
- ];
- kthread.thread.asyncSliceGroup.push(slice);
- delete kthread.openAsyncSlices[key];
- }
- }
- },
-
- /**
- * Parses events and sets up state in the importer.
- */
- f2fsWriteBeginEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /dev = \((\d+,\d+)\), ino = (\d+), pos = (\d+), len = (\d+), flags = (\d+)/. // @suppress longLineCheck
- exec(eventBase.details);
- if (!event)
- return false;
- var device = event[1];
- var inode = parseInt(event[2]);
- var pos = parseInt(event[3]);
- var len = parseInt(event[4]);
- var key = device + '-' + inode + '-' + pos + '-' + len;
- this.openAsyncSlice(ts, 'f2fs', eventBase.threadName, eventBase.pid,
- key, 'f2fs_write');
- return true;
- },
-
- f2fsWriteEndEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /dev = \((\d+,\d+)\), ino = (\d+), pos = (\d+), len = (\d+), copied = (\d+)/. // @suppress longLineCheck
- exec(eventBase.details);
- if (!event)
- return false;
-
- var device = event[1];
- var inode = parseInt(event[2]);
- var pos = parseInt(event[3]);
- var len = parseInt(event[4]);
- var error = parseInt(event[5]) !== len;
- var key = device + '-' + inode + '-' + pos + '-' + len;
- this.closeAsyncSlice(ts, 'f2fs', eventBase.threadName, eventBase.pid,
- key, {
- device: device,
- inode: inode,
- error: error
- });
- return true;
- },
-
- ext4WriteBeginEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /dev (\d+,\d+) ino (\d+) pos (\d+) len (\d+) flags (\d+)/.
- exec(eventBase.details);
- if (!event)
- return false;
- var device = event[1];
- var inode = parseInt(event[2]);
- var pos = parseInt(event[3]);
- var len = parseInt(event[4]);
- var key = device + '-' + inode + '-' + pos + '-' + len;
- this.openAsyncSlice(ts, 'ext4', eventBase.threadName, eventBase.pid,
- key, 'ext4_write');
- return true;
- },
-
- ext4WriteEndEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /dev (\d+,\d+) ino (\d+) pos (\d+) len (\d+) copied (\d+)/.
- exec(eventBase.details);
- if (!event)
- return false;
-
- var device = event[1];
- var inode = parseInt(event[2]);
- var pos = parseInt(event[3]);
- var len = parseInt(event[4]);
- var error = parseInt(event[5]) !== len;
- var key = device + '-' + inode + '-' + pos + '-' + len;
- this.closeAsyncSlice(ts, 'ext4', eventBase.threadName, eventBase.pid,
- key, {
- device: device,
- inode: inode,
- error: error
- });
- return true;
- },
-
- f2fsSyncFileEnterEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = new RegExp(
- 'dev = \\((\\d+,\\d+)\\), ino = (\\d+), pino = (\\d+), i_mode = (\\S+), ' + // @suppress longLineCheck
- 'i_size = (\\d+), i_nlink = (\\d+), i_blocks = (\\d+), i_advise = (\\d+)'). // @suppress longLineCheck
- exec(eventBase.details);
- if (!event)
- return false;
-
- var device = event[1];
- var inode = parseInt(event[2]);
- var key = device + '-' + inode;
- this.openAsyncSlice(ts, 'f2fs', eventBase.threadName, eventBase.pid,
- key, 'fsync');
- return true;
- },
-
- f2fsSyncFileExitEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = new RegExp('dev = \\((\\d+,\\d+)\\), ino = (\\d+), checkpoint is (\\S+), ' + // @suppress longLineCheck
- 'datasync = (\\d+), ret = (\\d+)').
- exec(eventBase.details.replace('not needed', 'not_needed'));
- if (!event)
- return false;
-
- var device = event[1];
- var inode = parseInt(event[2]);
- var error = parseInt(event[5]);
- var key = device + '-' + inode;
- this.closeAsyncSlice(ts, 'f2fs', eventBase.threadName, eventBase.pid,
- key, {
- device: device,
- inode: inode,
- error: error
- });
- return true;
- },
-
- ext4SyncFileEnterEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /dev (\d+,\d+) ino (\d+) parent (\d+) datasync (\d+)/.
- exec(eventBase.details);
- if (!event)
- return false;
-
- var device = event[1];
- var inode = parseInt(event[2]);
- var datasync = event[4] == 1;
- var key = device + '-' + inode;
- var action = datasync ? 'fdatasync' : 'fsync';
- this.openAsyncSlice(ts, 'ext4', eventBase.threadName, eventBase.pid,
- key, action);
- return true;
- },
-
- ext4SyncFileExitEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /dev (\d+,\d+) ino (\d+) ret (\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var device = event[1];
- var inode = parseInt(event[2]);
- var error = parseInt(event[3]);
- var key = device + '-' + inode;
- this.closeAsyncSlice(ts, 'ext4', eventBase.threadName, eventBase.pid,
- key, {
- device: device,
- inode: inode,
- error: error
- });
- return true;
- },
-
- blockRqIssueEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = new RegExp('(\\d+,\\d+) (F)?([DWRN])(F)?(A)?(S)?(M)? ' +
- '\\d+ \\(.*\\) (\\d+) \\+ (\\d+) \\[.*\\]').exec(eventBase.details);
- if (!event)
- return false;
-
- var action;
- switch (event[3]) {
- case 'D':
- action = 'discard';
- break;
- case 'W':
- action = 'write';
- break;
- case 'R':
- action = 'read';
- break;
- case 'N':
- action = 'none';
- break;
- default:
- action = 'unknown';
- break;
- }
-
- if (event[2]) {
- action += ' flush';
- }
- if (event[4] == 'F') {
- action += ' fua';
- }
- if (event[5] == 'A') {
- action += ' ahead';
- }
- if (event[6] == 'S') {
- action += ' sync';
- }
- if (event[7] == 'M') {
- action += ' meta';
- }
- var device = event[1];
- var sector = parseInt(event[8]);
- var numSectors = parseInt(event[9]);
- var key = device + '-' + sector + '-' + numSectors;
- this.openAsyncSlice(ts, 'block', eventBase.threadName, eventBase.pid,
- key, action);
- return true;
- },
-
- blockRqCompleteEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = new RegExp('(\\d+,\\d+) (F)?([DWRN])(F)?(A)?(S)?(M)? ' +
- '\\(.*\\) (\\d+) \\+ (\\d+) \\[(.*)\\]').exec(eventBase.details);
- if (!event)
- return false;
-
- var device = event[1];
- var sector = parseInt(event[8]);
- var numSectors = parseInt(event[9]);
- var error = parseInt(event[10]);
- var key = device + '-' + sector + '-' + numSectors;
- this.closeAsyncSlice(ts, 'block', eventBase.threadName, eventBase.pid,
- key, {
- device: device,
- sector: sector,
- numSectors: numSectors,
- error: error
- });
- return true;
- }
- };
-
- Parser.register(DiskParser);
-
- return {
- DiskParser: DiskParser
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/disk_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/disk_parser_test.html
deleted file mode 100644
index c2e9a14deab..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/disk_parser_test.html
+++ /dev/null
@@ -1,119 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('diskImport', function() {
- var lines = [
- // NB: spliced from different traces; mismatched timestamps don't matter
- 'AsyncTask #2-18830 [000] ...1 154578.668286: ext4_sync_file_enter: ' +
- 'dev 259,1 ino 81993 parent 81906 datasync 1',
- 'Binder_A-3179 [001] ...1 1354.510088: f2fs_sync_file_enter: ' +
- 'dev = (259,14), ino = 4882, pino = 313, i_mode = 0x81b0, i_size = ' +
- '25136, i_nlink = 1, i_blocks = 8, i_advise = 0x0',
- 'Binder_A-3179 [001] ...1 1354.514013: f2fs_sync_file_exit: ' +
- 'dev = (259,14), ino = 4882, checkpoint is not needed, datasync = 1, ret = 0', // @suppress longLineCheck
- 'mmcqd/0-81 [000] d..2 154578.668390: block_rq_issue: ' +
- '179,0 WS 0 () 3427120 + 16 [mmcqd/0]',
- 'mmcqd/0-81 [000] d..2 154578.669181: block_rq_complete: ' +
- '179,0 WS () 3427120 + 16 [0]',
- 'mmcqd/0-81 [001] d..2 154578.670853: block_rq_issue: ' +
- '179,0 FWS 0 () 18446744073709551615 + 0 [mmcqd/0]',
- 'mmcqd/0-81 [001] d..2 154578.670869: block_rq_complete: ' +
- '179,0 FWS () 18446744073709551615 + 0 [0]',
- 'AsyncTask #2-18830 [001] ...1 154578.670901: ext4_sync_file_exit: ' +
- 'dev 259,1 ino 81993 ret 0',
- 'mmcqd/0-81 [001] d..2 154578.877038: block_rq_issue: ' +
- '179,0 R 0 () 3255256 + 8 [mmcqd/0]',
- 'mmcqd/0-81 [001] d..2 154578.877110: block_rq_issue: ' +
- '179,0 R 0 () 3255288 + 8 [mmcqd/0]',
- 'mmcqd/0-81 [000] d..2 154578.877345: block_rq_complete: ' +
- '179,0 R () 3255256 + 8 [0]',
- 'mmcqd/0-81 [000] d..2 154578.877466: block_rq_complete: ' +
- '179,0 R () 3255288 + 8 [0]',
- 'ContactsProvide-1184 [000] ...1 66.613719: f2fs_write_begin: ' +
- 'dev = (253,2), ino = 3342, pos = 0, len = 75, flags = 0',
- 'ContactsProvide-1184 [000] ...1 66.613733: f2fs_write_end: ' +
- 'dev = (253,2), ino = 3342, pos = 0, len = 75, copied = 75'
- ];
- var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shiftWorldToZero: false
- });
- assert.isFalse(m.hasImportWarnings);
-
- var blockThread = undefined;
- var ext4Thread = undefined;
- var f2fsSyncThread = undefined;
- var f2fsWriteThread = undefined;
-
- m.getAllThreads().forEach(function(t) {
- switch (t.name) {
- case 'block:mmcqd/0':
- blockThread = t;
- break;
- case 'ext4:AsyncTask #2':
- ext4Thread = t;
- break;
- case 'f2fs:Binder_A':
- f2fsSyncThread = t;
- break;
- case 'f2fs:ContactsProvide':
- f2fsWriteThread = t;
- break;
- default:
- throw new unittest.TestError('Unexpected thread named ' + t.name);
- }
- });
- assert.isDefined(blockThread);
- assert.isDefined(ext4Thread);
- assert.isDefined(f2fsSyncThread);
- assert.isDefined(f2fsWriteThread);
-
- assert.equal(blockThread.asyncSliceGroup.length, 4);
-
- var slice = blockThread.asyncSliceGroup.slices[0];
- assert.equal(slice.category, 'block');
- assert.equal(slice.title, 'write sync');
- assert.equal(slice.args.device, '179,0');
- assert.equal(slice.args.error, 0);
- assert.equal(slice.args.numSectors, 16);
- assert.equal(slice.args.sector, 3427120);
-
- assert.equal(ext4Thread.asyncSliceGroup.length, 1);
-
- slice = ext4Thread.asyncSliceGroup.slices[0];
- assert.equal(slice.category, 'ext4');
- assert.equal(slice.title, 'fdatasync');
- assert.equal(slice.args.device, '259,1');
- assert.equal(slice.args.error, 0);
- assert.equal(slice.args.inode, 81993);
-
- assert.equal(f2fsSyncThread.asyncSliceGroup.length, 1);
-
- slice = f2fsSyncThread.asyncSliceGroup.slices[0];
- assert.equal(slice.category, 'f2fs');
- assert.equal(slice.title, 'fsync');
- assert.equal(slice.args.device, '259,14');
- assert.equal(slice.args.error, 0);
- assert.equal(slice.args.inode, 4882);
-
- assert.equal(f2fsWriteThread.asyncSliceGroup.length, 1);
-
- slice = f2fsWriteThread.asyncSliceGroup.slices[0];
- assert.equal(slice.category, 'f2fs');
- assert.equal(slice.title, 'f2fs_write');
- assert.equal(slice.args.device, '253,2');
- assert.equal(slice.args.inode, 3342);
- assert.equal(slice.args.error, false);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/drm_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/drm_parser.html
deleted file mode 100644
index 78dd9515f25..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/drm_parser.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses drm driver events in the Linux event trace format.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
-
- var ColorScheme = tr.b.ColorScheme;
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses linux drm trace events.
- * @constructor
- */
- function DrmParser(importer) {
- Parser.call(this, importer);
-
- importer.registerEventHandler('drm_vblank_event',
- DrmParser.prototype.vblankEvent.bind(this));
- }
-
- DrmParser.prototype = {
- __proto__: Parser.prototype,
-
- drmVblankSlice: function(ts, eventName, args) {
- var kthread = this.importer.getOrCreatePseudoThread('drm_vblank');
- kthread.openSlice = eventName;
- var slice = new tr.model.Slice('', kthread.openSlice,
- ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice),
- ts, args, 0);
-
- kthread.thread.sliceGroup.pushSlice(slice);
- },
-
- /**
- * Parses drm driver events and sets up state in the importer.
- */
- vblankEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /crtc=(\d+), seq=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var crtc = parseInt(event[1]);
- var seq = parseInt(event[2]);
- this.drmVblankSlice(ts, 'vblank:' + crtc,
- {
- crtc: crtc,
- seq: seq
- });
- return true;
- }
- };
-
- Parser.register(DrmParser);
-
- return {
- DrmParser: DrmParser
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/drm_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/drm_parser_test.html
deleted file mode 100644
index cdb214fb2de..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/drm_parser_test.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('drmImport', function() {
- var lines = [
- ' chrome-2465 [000] 71.653157: drm_vblank_event: crtc=0, seq=4233',
- ' <idle>-0 [000] 71.669851: drm_vblank_event: crtc=0, seq=4234'
- ];
- var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shiftWorldToZero: false
- });
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var vblankThread = threads[0];
- assert.equal(vblankThread.name, 'drm_vblank');
- assert.equal(vblankThread.sliceGroup.length, 2);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/exynos_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/exynos_parser.html
deleted file mode 100644
index e573b8d25a1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/exynos_parser.html
+++ /dev/null
@@ -1,128 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses exynos events in the Linux event trace format.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
-
- var ColorScheme = tr.b.ColorScheme;
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses linux exynos trace events.
- * @constructor
- */
- function ExynosParser(importer) {
- Parser.call(this, importer);
-
- importer.registerEventHandler('exynos_busfreq_target_int',
- ExynosParser.prototype.busfreqTargetIntEvent.bind(this));
- importer.registerEventHandler('exynos_busfreq_target_mif',
- ExynosParser.prototype.busfreqTargetMifEvent.bind(this));
-
- importer.registerEventHandler('exynos_page_flip_state',
- ExynosParser.prototype.pageFlipStateEvent.bind(this));
- }
-
- ExynosParser.prototype = {
- __proto__: Parser.prototype,
-
- exynosBusfreqSample: function(name, ts, frequency) {
- var targetCpu = this.importer.getOrCreateCpu(0);
- var counter = targetCpu.getOrCreateCounter('', name);
- if (counter.numSeries === 0) {
- counter.addSeries(new tr.model.CounterSeries('frequency',
- ColorScheme.getColorIdForGeneralPurposeString(
- counter.name + '.' + 'frequency')));
- }
- counter.series.forEach(function(series) {
- series.addCounterSample(ts, frequency);
- });
- },
-
- /**
- * Parses exynos_busfreq_target_int events and sets up state.
- */
- busfreqTargetIntEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /frequency=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- this.exynosBusfreqSample('INT Frequency', ts, parseInt(event[1]));
- return true;
- },
-
- /**
- * Parses exynos_busfreq_target_mif events and sets up state.
- */
- busfreqTargetMifEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /frequency=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- this.exynosBusfreqSample('MIF Frequency', ts, parseInt(event[1]));
- return true;
- },
-
- exynosPageFlipStateOpenSlice: function(ts, pipe, fb, state) {
- var kthread = this.importer.getOrCreatePseudoThread(
- 'exynos_flip_state (pipe:' + pipe + ', fb:' + fb + ')');
- kthread.openSliceTS = ts;
- kthread.openSlice = state;
- },
-
- exynosPageFlipStateCloseSlice: function(ts, pipe, fb, args) {
- var kthread = this.importer.getOrCreatePseudoThread(
- 'exynos_flip_state (pipe:' + pipe + ', fb:' + fb + ')');
- if (kthread.openSlice) {
- var slice = new tr.model.Slice('', kthread.openSlice,
- ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice),
- kthread.openSliceTS,
- args,
- ts - kthread.openSliceTS);
- kthread.thread.sliceGroup.pushSlice(slice);
- }
- kthread.openSlice = undefined;
- },
-
- /**
- * Parses page_flip_state events and sets up state in the importer.
- */
- pageFlipStateEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /pipe=(\d+), fb=(\d+), state=(.*)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var pipe = parseInt(event[1]);
- var fb = parseInt(event[2]);
- var state = event[3];
-
- this.exynosPageFlipStateCloseSlice(ts, pipe, fb,
- {
- pipe: pipe,
- fb: fb
- });
- if (state !== 'flipped')
- this.exynosPageFlipStateOpenSlice(ts, pipe, fb, state);
- return true;
- }
- };
-
- Parser.register(ExynosParser);
-
- return {
- ExynosParser: ExynosParser
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/exynos_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/exynos_parser_test.html
deleted file mode 100644
index c27e7c65a93..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/exynos_parser_test.html
+++ /dev/null
@@ -1,128 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function newModel(events) {
- return tr.c.TestUtils.newModelWithEvents([events], {
- shiftWorldToZero: false
- });
- }
-
- test('exynosBusfreqImport', function() {
- var lines = [
- ' kworker/1:0-4177 [001] .... 2803.129806: ' +
- 'exynos_busfreq_target_int: frequency=200000',
- ' kworker/1:0-4177 [001] .... 2803.229207: ' +
- 'exynos_busfreq_target_int: frequency=267000',
- ' kworker/1:0-4177 [001] .... 2803.329031: ' +
- 'exynos_busfreq_target_int: frequency=160000',
- ' kworker/1:0-4177 [001] .... 2805.729039: ' +
- 'exynos_busfreq_target_mif: frequency=200000'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var c0 = m.kernel.cpus[0];
- assert.equal(c0.slices.length, 0);
- assert.equal(c0.counters['.INT Frequency'].series[0].samples.length, 3);
- assert.equal(c0.counters['.MIF Frequency'].series[0].samples.length, 1);
- });
-
- test('exynosPageFlipSlowRequestImport', function() {
- var lines = [
- ' <idle>-0 [000] d.h. 1000.000000: ' +
- 'exynos_page_flip_state: pipe=0, fb=26, state=wait_kds',
- ' Chrome_IOThread-21603 [000] d.h. 1000.000001: ' +
- 'exynos_page_flip_state: pipe=0, fb=26, state=wait_apply',
- ' kworker/0:1-25931 [000] .... 1000.000002: ' +
- 'exynos_page_flip_state: pipe=0, fb=26, state=wait_flip',
- ' kworker/0:1-25931 [000] .... 1000.000003: ' +
- 'exynos_page_flip_state: pipe=0, fb=26, state=flipped',
- ' <idle>-0 [000] d.h. 1000.000004: ' +
- 'exynos_page_flip_state: pipe=0, fb=25, state=wait_kds',
- ' Chrome_IOThread-21603 [000] d.h. 1000.000005: ' +
- 'exynos_page_flip_state: pipe=0, fb=25, state=wait_apply',
- ' kworker/0:1-25931 [000] .... 1000.000006: ' +
- 'exynos_page_flip_state: pipe=0, fb=25, state=wait_flip',
- ' kworker/0:1-25931 [000] .... 1000.000007: ' +
- 'exynos_page_flip_state: pipe=0, fb=25, state=flipped'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- // there are 2 threads:
- // (1) "exynos_flip_state (pipe:0, fb:25)"
- // (2) "exynos_flip_state (pipe:0, fb:26)"
- assert.equal(threads.length, 2);
-
- // in the test data, event of fb=26 occurs first, so it's thread[0]
- var gfxFbId26Thread = threads[0]; // thread where fb == 26
- var gfxFbId25Thread = threads[1]; // thread where fb == 25
- assert.equal(gfxFbId25Thread.name, 'exynos_flip_state (pipe:0, fb:25)');
- assert.equal(gfxFbId26Thread.name, 'exynos_flip_state (pipe:0, fb:26)');
- // Every state (except for 'flipped') will start a new slice.
- // The last event will not be closed, so it's not a slice
- assert.equal(gfxFbId25Thread.sliceGroup.length, 3);
- assert.equal(gfxFbId26Thread.sliceGroup.length, 3);
- });
-
- test('exynosPageFlipFastRequestImport', function() {
- var lines = [
- ' <idle>-0 [000] d.h. 1000.000000: ' +
- 'exynos_page_flip_state: pipe=0, fb=26, state=wait_kds',
- ' Chrome_IOThread-21603 [000] d.h. 1000.000001: ' +
- 'exynos_page_flip_state: pipe=0, fb=25, state=wait_kds',
- ' X-21385 [000] .... 1000.000002: ' +
- 'exynos_page_flip_state: pipe=0, fb=26, state=wait_apply',
- ' kworker/0:1-25931 [000] .... 1000.000003: ' +
- 'exynos_page_flip_state: pipe=0, fb=26, state=wait_flip',
- ' X-21385 [001] .... 1000.000004: ' +
- 'exynos_page_flip_state: pipe=0, fb=25, state=wait_apply',
- ' kworker/0:1-25931 [000] .... 1000.000005: ' +
- 'exynos_page_flip_state: pipe=0, fb=26, state=flipped',
- ' <idle>-0 [000] d.h. 1000.000006: ' +
- 'exynos_page_flip_state: pipe=0, fb=26, state=wait_kds',
- ' X-21385 [000] .... 1000.000007: ' +
- 'exynos_page_flip_state: pipe=0, fb=25, state=wait_flip',
- ' kworker/0:1-25931 [000] .... 1000.000008: ' +
- 'exynos_page_flip_state: pipe=0, fb=25, state=flipped',
- ' kworker/0:1-25931 [000] .... 1000.000009: ' +
- 'exynos_page_flip_state: pipe=0, fb=25, state=wait_kds',
- ' Chrome_IOThread-21603 [000] d.h. 1000.000010: ' +
- 'exynos_page_flip_state: pipe=0, fb=25, state=wait_apply',
- ' <idle>-0 [000] d.h. 1000.000011: ' +
- 'exynos_page_flip_state: pipe=0, fb=26, state=wait_apply'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- // there are 2 threads:
- // (1) "exynos_flip_state (pipe:0, fb:25)"
- // (2) "exynos_flip_state (pipe:0, fb:26)"
- assert.equal(threads.length, 2);
-
- // in the test data, event of fb=26 occurs first, so it's thread[0]
- var gfxFbId26Thread = threads[0]; // thread where fb == 26
- var gfxFbId25Thread = threads[1]; // thread where fb == 25
- assert.equal(gfxFbId25Thread.name, 'exynos_flip_state (pipe:0, fb:25)');
- assert.equal(gfxFbId26Thread.name, 'exynos_flip_state (pipe:0, fb:26)');
- // Every state (except for 'flipped') will start a new slice.
- // The last event will not be closed, so it's not a slice
- assert.equal(gfxFbId25Thread.sliceGroup.length, 4);
- assert.equal(gfxFbId26Thread.sliceGroup.length, 4);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer.html
deleted file mode 100644
index 477223b1640..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer.html
+++ /dev/null
@@ -1,920 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/android_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/binder_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/bus_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/clock_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/cpufreq_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/disk_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/drm_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/exynos_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/gesture_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/i915_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/irq_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/kfunc_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/mali_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/memreclaim_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/power_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/regulator_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/sched_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/sync_parser.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/workqueue_parser.html">
-<link rel="import" href="/tracing/importer/importer.html">
-<link rel="import" href="/tracing/importer/simple_line_reader.html">
-<link rel="import" href="/tracing/model/clock_sync_manager.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-/**
- * @fileoverview Imports text files in the Linux event trace format into the
- * Model. This format is output both by sched_trace and by Linux's perf tool.
- *
- * This importer assumes the events arrive as a string. The unit tests provide
- * examples of the trace format.
- *
- * Linux scheduler traces use a definition for 'pid' that is different than
- * tracing uses. Whereas tracing uses pid to identify a specific process, a pid
- * in a linux trace refers to a specific thread within a process. Within this
- * file, we the definition used in Linux traces, as it improves the importing
- * code's readability.
- */
-'use strict';
-
-tr.exportTo('tr.e.importer.linux_perf', function() {
- var MONOTONIC_TO_FTRACE_GLOBAL_SYNC_ID =
- 'linux_clock_monotonic_to_ftrace_global';
-
- /**
- * Imports linux perf events into a specified model.
- * @constructor
- */
- function FTraceImporter(model, events) {
- this.importPriority = 2;
- this.model_ = model;
- this.events_ = events;
- this.wakeups_ = [];
- this.blocked_reasons_ = [];
- this.kernelThreadStates_ = {};
- this.buildMapFromLinuxPidsToThreads_();
- this.lines_ = [];
- this.pseudoThreadCounter = 1;
- this.parsers_ = [];
- this.eventHandlers_ = {};
- this.haveClockSyncedMonotonicToGlobal_ = false;
- }
-
- var TestExports = {};
-
- // Matches the trace record in 3.2 and later with the print-tgid option:
- // <idle>-0 0 [001] d... 1.23: sched_switch
- //
- // A TGID (Thread Group ID) is basically what the Linux kernel calls what
- // userland refers to as a process ID (as opposed to a Linux pid, which is
- // what userland calls a thread ID).
- var lineREWithTGID = new RegExp(
- '^\\s*(.+)-(\\d+)\\s+\\(\\s*(\\d+|-+)\\)\\s\\[(\\d+)\\]' +
- '\\s+[dX.][Nnp.][Hhs.][0-9a-f.]' +
- '\\s+(\\d+\\.\\d+):\\s+(\\S+):\\s(.*)$');
- var lineParserWithTGID = function(line) {
- var groups = lineREWithTGID.exec(line);
- if (!groups) {
- return groups;
- }
-
- var tgid = groups[3];
- if (tgid[0] === '-')
- tgid = undefined;
-
- return {
- threadName: groups[1],
- pid: groups[2],
- tgid: tgid,
- cpuNumber: groups[4],
- timestamp: groups[5],
- eventName: groups[6],
- details: groups[7]
- };
- };
- TestExports.lineParserWithTGID = lineParserWithTGID;
-
- // Matches the default trace record in 3.2 and later (includes irq-info):
- // <idle>-0 [001] d... 1.23: sched_switch
- var lineREWithIRQInfo = new RegExp(
- '^\\s*(.+)-(\\d+)\\s+\\[(\\d+)\\]' +
- '\\s+[dX.][Nnp.][Hhs.][0-9a-f.]' +
- '\\s+(\\d+\\.\\d+):\\s+(\\S+):\\s(.*)$');
- var lineParserWithIRQInfo = function(line) {
- var groups = lineREWithIRQInfo.exec(line);
- if (!groups) {
- return groups;
- }
- return {
- threadName: groups[1],
- pid: groups[2],
- cpuNumber: groups[3],
- timestamp: groups[4],
- eventName: groups[5],
- details: groups[6]
- };
- };
- TestExports.lineParserWithIRQInfo = lineParserWithIRQInfo;
-
- // Matches the default trace record pre-3.2:
- // <idle>-0 [001] 1.23: sched_switch
- var lineREWithLegacyFmt =
- /^\s*(.+)-(\d+)\s+\[(\d+)\]\s*(\d+\.\d+):\s+(\S+):\s(.*)$/;
- var lineParserWithLegacyFmt = function(line) {
- var groups = lineREWithLegacyFmt.exec(line);
- if (!groups) {
- return groups;
- }
- return {
- threadName: groups[1],
- pid: groups[2],
- cpuNumber: groups[3],
- timestamp: groups[4],
- eventName: groups[5],
- details: groups[6]
- };
- };
- TestExports.lineParserWithLegacyFmt = lineParserWithLegacyFmt;
-
- // Matches the trace_event_clock_sync marker:
- // 0: trace_event_clock_sync: parent_ts=19581477508
- var traceEventClockSyncRE = /trace_event_clock_sync: parent_ts=(\d+\.?\d*)/;
- TestExports.traceEventClockSyncRE = traceEventClockSyncRE;
-
- var realTimeClockSyncRE = /trace_event_clock_sync: realtime_ts=(\d+)/;
- var genericClockSyncRE = /trace_event_clock_sync: name=(\w+)/;
-
- // Some kernel trace events are manually classified in slices and
- // hand-assigned a pseudo PID.
- var pseudoKernelPID = 0;
-
- /**
- * Deduce the format of trace data. Linux kernels prior to 3.3 used one
- * format (by default); 3.4 and later used another. Additionally, newer
- * kernels can optionally trace the TGID.
- *
- * @return {function} the function for parsing data when the format is
- * recognized; otherwise undefined.
- */
- function autoDetectLineParser(line) {
- if (line[0] == '{')
- return false;
- if (lineREWithTGID.test(line))
- return lineParserWithTGID;
- if (lineREWithIRQInfo.test(line))
- return lineParserWithIRQInfo;
- if (lineREWithLegacyFmt.test(line))
- return lineParserWithLegacyFmt;
- return undefined;
- };
- TestExports.autoDetectLineParser = autoDetectLineParser;
-
- /**
- * Guesses whether the provided events is a Linux perf string.
- * Looks for the magic string "# tracer" at the start of the file,
- * or the typical task-pid-cpu-timestamp-function sequence of a typical
- * trace's body.
- *
- * @return {boolean} True when events is a linux perf array.
- */
- FTraceImporter.canImport = function(events) {
- if (!(typeof(events) === 'string' || events instanceof String))
- return false;
-
- if (FTraceImporter._extractEventsFromSystraceHTML(events, false).ok)
- return true;
-
- if (FTraceImporter._extractEventsFromSystraceMultiHTML(events, false).ok)
- return true;
-
- if (/^# tracer:/.test(events))
- return true;
-
- var lineBreakIndex = events.indexOf('\n');
- if (lineBreakIndex > -1)
- events = events.substring(0, lineBreakIndex);
-
- if (autoDetectLineParser(events))
- return true;
-
- return false;
- };
-
- FTraceImporter._extractEventsFromSystraceHTML = function(
- incoming_events, produce_result) {
- var failure = {ok: false};
- if (produce_result === undefined)
- produce_result = true;
-
- if (/^<!DOCTYPE html>/.test(incoming_events) == false)
- return failure;
- var r = new tr.importer.SimpleLineReader(incoming_events);
-
- // Try to find the data...
- if (!r.advanceToLineMatching(/^ <script>$/))
- return failure;
- if (!r.advanceToLineMatching(/^ var linuxPerfData = "\\$/))
- return failure;
-
- var events_begin_at_line = r.curLineNumber + 1;
- r.beginSavingLines();
- if (!r.advanceToLineMatching(/^ <\/script>$/))
- return failure;
-
- var raw_events = r.endSavingLinesAndGetResult();
-
- // Drop off first and last event as it contains the tag.
- raw_events = raw_events.slice(1, raw_events.length - 1);
-
- if (!r.advanceToLineMatching(/^<\/body>$/))
- return failure;
- if (!r.advanceToLineMatching(/^<\/html>$/))
- return failure;
-
- function endsWith(str, suffix) {
- return str.indexOf(suffix, str.length - suffix.length) !== -1;
- }
- function stripSuffix(str, suffix) {
- if (!endsWith(str, suffix))
- return str;
- return str.substring(str, str.length - suffix.length);
- }
-
- // Strip off escaping in the file needed to preserve linebreaks.
- var events = [];
- if (produce_result) {
- for (var i = 0; i < raw_events.length; i++) {
- var event = raw_events[i];
- event = stripSuffix(event, '\\n\\');
- events.push(event);
- }
- } else {
- events = [raw_events[raw_events.length - 1]];
- }
-
- // Last event ends differently. Strip that off too,
- // treating absence of that trailing string as a failure.
- var oldLastEvent = events[events.length - 1];
- var newLastEvent = stripSuffix(oldLastEvent, '\\n";');
- if (newLastEvent == oldLastEvent)
- return failure;
- events[events.length - 1] = newLastEvent;
-
- return {ok: true,
- lines: produce_result ? events : undefined,
- events_begin_at_line: events_begin_at_line};
- };
-
- FTraceImporter._extractEventsFromSystraceMultiHTML = function(
- incoming_events, produce_result) {
- var failure = {ok: false};
- if (produce_result === undefined)
- produce_result = true;
-
- if (new RegExp('^<!DOCTYPE HTML>', 'i').test(incoming_events) == false)
- return failure;
-
- var r = new tr.importer.SimpleLineReader(incoming_events);
-
- // Try to find the Linux perf trace in any of the trace-data tags
- var events = [];
- while (!/^# tracer:/.test(events)) {
- if (!r.advanceToLineMatching(
- /^ <script class="trace-data" type="application\/text">$/))
- return failure;
-
- var events_begin_at_line = r.curLineNumber + 1;
-
- r.beginSavingLines();
- if (!r.advanceToLineMatching(/^ <\/script>$/))
- return failure;
-
- events = r.endSavingLinesAndGetResult();
-
- // Drop off first and last event as it contains the tag.
- events = events.slice(1, events.length - 1);
- }
-
- if (!r.advanceToLineMatching(/^<\/body>$/))
- return failure;
- if (!r.advanceToLineMatching(/^<\/html>$/))
- return failure;
-
- return {ok: true,
- lines: produce_result ? events : undefined,
- events_begin_at_line: events_begin_at_line};
- };
-
- FTraceImporter.prototype = {
- __proto__: tr.importer.Importer.prototype,
-
- get importerName() {
- return 'FTraceImporter';
- },
-
- get model() {
- return this.model_;
- },
-
- /**
- * Imports clock sync markers into model_.
- */
- importClockSyncMarkers: function() {
- this.lazyInit_();
-
- this.forEachLine_(function(text, eventBase, cpuNumber, pid, ts) {
- var eventName = eventBase.eventName;
- if (eventName !== 'tracing_mark_write' && eventName !== '0')
- return;
-
- if (traceEventClockSyncRE.exec(eventBase.details) ||
- genericClockSyncRE.exec(eventBase.details)) {
- this.traceClockSyncEvent_(eventName, cpuNumber, pid, ts, eventBase);
- } else if (realTimeClockSyncRE.exec(eventBase.details)) {
- // TODO(charliea): Migrate this sync to ClockSyncManager.
- // This entry syncs CLOCK_REALTIME with CLOCK_MONOTONIC. Store the
- // offset between the two in the model so that importers parsing files
- // with CLOCK_REALTIME timestamps can map back to CLOCK_MONOTONIC.
- var match = realTimeClockSyncRE.exec(eventBase.details);
- this.model_.realtime_to_monotonic_offset_ms = ts - match[1];
- }
- }.bind(this));
- },
-
- /**
- * Imports the data in this.events_ into model_.
- */
- importEvents: function() {
- var modelTimeTransformer =
- this.model_.clockSyncManager.getModelTimeTransformer(
- tr.model.ClockDomainId.LINUX_FTRACE_GLOBAL);
-
- this.importCpuData_(modelTimeTransformer);
- this.buildMapFromLinuxPidsToThreads_();
- this.buildPerThreadCpuSlicesFromCpuState_();
- },
-
- /**
- * Registers a linux perf event parser used by importCpuData_.
- */
- registerEventHandler: function(eventName, handler) {
- // TODO(sleffler) how to handle conflicts?
- this.eventHandlers_[eventName] = handler;
- },
-
- /**
- * @return {Cpu} A Cpu corresponding to the given cpuNumber.
- */
- getOrCreateCpu: function(cpuNumber) {
- return this.model_.kernel.getOrCreateCpu(cpuNumber);
- },
-
- /**
- * @return {TimelineThread} A thread corresponding to the kernelThreadName.
- */
- getOrCreateKernelThread: function(kernelThreadName, pid, tid) {
- if (!this.kernelThreadStates_[kernelThreadName]) {
- var thread = this.model_.getOrCreateProcess(pid).getOrCreateThread(tid);
- thread.name = kernelThreadName;
- this.kernelThreadStates_[kernelThreadName] = {
- pid: pid,
- thread: thread,
- openSlice: undefined,
- openSliceTS: undefined
- };
- this.threadsByLinuxPid[pid] = thread;
- }
- return this.kernelThreadStates_[kernelThreadName];
- },
-
- /**
- * Processes can have multiple binder threads.
- * Binder thread names are not unique across processes we therefore need to
- * keep more information in order to return the correct threads.
- */
- getOrCreateBinderKernelThread: function(kernelThreadName, pid, tid) {
- var key = kernelThreadName + pid + tid;
- if (!this.kernelThreadStates_[key]) {
- var thread = this.model_.getOrCreateProcess(pid).getOrCreateThread(tid);
- thread.name = kernelThreadName;
- this.kernelThreadStates_[key] = {
- pid: pid,
- thread: thread,
- openSlice: undefined,
- openSliceTS: undefined
- };
- this.threadsByLinuxPid[pid] = thread;
- }
- return this.kernelThreadStates_[key];
- },
-
- /**
- * @return {TimelineThread} A pseudo thread corresponding to the
- * threadName. Pseudo threads are for events that we want to break
- * out to a separate timeline but would not otherwise happen.
- * These threads are assigned to pseudoKernelPID and given a
- * unique (incrementing) TID.
- */
- getOrCreatePseudoThread: function(threadName) {
- var thread = this.kernelThreadStates_[threadName];
- if (!thread) {
- thread = this.getOrCreateKernelThread(threadName, pseudoKernelPID,
- this.pseudoThreadCounter);
- this.pseudoThreadCounter++;
- }
- return thread;
- },
-
- /**
- * Records the fact that a pid has become runnable. This data will
- * eventually get used to derive each thread's timeSlices array.
- */
- markPidRunnable: function(ts, pid, comm, prio, fromPid) {
- // The the pids that get passed in to this function are Linux kernel
- // pids, which identify threads. The rest of trace-viewer refers to
- // these as tids, so the change of nomenclature happens in the following
- // construction of the wakeup object.
- this.wakeups_.push({ts: ts, tid: pid, fromTid: fromPid});
- },
-
- /**
- * Records the reason why a pid has gone into uninterruptible sleep.
- */
- addPidBlockedReason: function(ts, pid, iowait, caller) {
- // The the pids that get passed in to this function are Linux kernel
- // pids, which identify threads. The rest of trace-viewer refers to
- // these as tids, so the change of nomenclature happens in the following
- // construction of the wakeup object.
- this.blocked_reasons_.push({ts: ts, tid: pid, iowait: iowait,
- caller: caller});
- },
-
- /**
- * Precomputes a lookup table from linux pids back to existing
- * Threads. This is used during importing to add information to each
- * thread about whether it was running, descheduled, sleeping, et
- * cetera.
- */
- buildMapFromLinuxPidsToThreads_: function() {
- this.threadsByLinuxPid = {};
- this.model_.getAllThreads().forEach(
- function(thread) {
- this.threadsByLinuxPid[thread.tid] = thread;
- }.bind(this));
- },
-
- /**
- * Builds the timeSlices array on each thread based on our knowledge of what
- * each Cpu is doing. This is done only for Threads that are
- * already in the model, on the assumption that not having any traced data
- * on a thread means that it is not of interest to the user.
- */
- buildPerThreadCpuSlicesFromCpuState_: function() {
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
-
- // Push the cpu slices to the threads that they run on.
- for (var cpuNumber in this.model_.kernel.cpus) {
- var cpu = this.model_.kernel.cpus[cpuNumber];
-
- for (var i = 0; i < cpu.slices.length; i++) {
- var cpuSlice = cpu.slices[i];
-
- var thread = this.threadsByLinuxPid[cpuSlice.args.tid];
- if (!thread)
- continue;
-
- cpuSlice.threadThatWasRunning = thread;
-
- if (!thread.tempCpuSlices)
- thread.tempCpuSlices = [];
- thread.tempCpuSlices.push(cpuSlice);
- }
- }
-
- for (var i in this.wakeups_) {
- var wakeup = this.wakeups_[i];
- var thread = this.threadsByLinuxPid[wakeup.tid];
- if (!thread)
- continue;
- thread.tempWakeups = thread.tempWakeups || [];
- thread.tempWakeups.push(wakeup);
- }
- for (var i in this.blocked_reasons_) {
- var reason = this.blocked_reasons_[i];
- var thread = this.threadsByLinuxPid[reason.tid];
- if (!thread)
- continue;
- thread.tempBlockedReasons = thread.tempBlockedReasons || [];
- thread.tempBlockedReasons.push(reason);
- }
-
- // Create slices for when the thread is not running.
- this.model_.getAllThreads().forEach(function(thread) {
- if (thread.tempCpuSlices === undefined)
- return;
- var origSlices = thread.tempCpuSlices;
- delete thread.tempCpuSlices;
-
- origSlices.sort(function(x, y) {
- return x.start - y.start;
- });
-
- var wakeups = thread.tempWakeups || [];
- delete thread.tempWakeups;
- wakeups.sort(function(x, y) {
- return x.ts - y.ts;
- });
-
- var reasons = thread.tempBlockedReasons || [];
- delete thread.tempBlockedReasons;
- reasons.sort(function(x, y) {
- return x.ts - y.ts;
- });
-
- // Walk the slice list and put slices between each original slice to
- // show when the thread isn't running.
- var slices = [];
-
- if (origSlices.length) {
- var slice = origSlices[0];
-
- if (wakeups.length && wakeups[0].ts < slice.start) {
- var wakeup = wakeups.shift();
- var wakeupDuration = slice.start - wakeup.ts;
- var args = {'wakeup from tid': wakeup.fromTid};
- slices.push(new tr.model.ThreadTimeSlice(
- thread, SCHEDULING_STATE.RUNNABLE, '',
- wakeup.ts, args, wakeupDuration));
- }
-
- var runningSlice = new tr.model.ThreadTimeSlice(
- thread, SCHEDULING_STATE.RUNNING, '',
- slice.start, {}, slice.duration);
- runningSlice.cpuOnWhichThreadWasRunning = slice.cpu;
- slices.push(runningSlice);
- }
-
- var wakeup = undefined;
- for (var i = 1; i < origSlices.length; i++) {
- var prevSlice = origSlices[i - 1];
- var nextSlice = origSlices[i];
- var midDuration = nextSlice.start - prevSlice.end;
- while (wakeups.length && wakeups[0].ts < nextSlice.start) {
- var w = wakeups.shift();
- if (wakeup === undefined && w.ts > prevSlice.end) {
- wakeup = w;
- }
- }
- var blocked_reason = undefined;
- while (reasons.length && reasons[0].ts < prevSlice.end) {
- var r = reasons.shift();
- }
- if (wakeup !== undefined &&
- reasons.length &&
- reasons[0].ts < wakeup.ts) {
- blocked_reason = reasons.shift();
- }
-
- // Push a sleep slice onto the slices list, interrupting it with a
- // wakeup if appropriate.
- var pushSleep = function(state) {
- if (wakeup !== undefined) {
- midDuration = wakeup.ts - prevSlice.end;
- }
-
- if (blocked_reason !== undefined) {
- var args = {
- 'kernel callsite when blocked:' : blocked_reason.caller
- };
- if (blocked_reason.iowait) {
- switch (state) {
- case SCHEDULING_STATE.UNINTR_SLEEP:
- state = SCHEDULING_STATE.UNINTR_SLEEP_IO;
- break;
- case SCHEDULING_STATE.UNINTR_SLEEP_WAKE_KILL:
- state = SCHEDULING_STATE.UNINTR_SLEEP_WAKE_KILL_IO;
- break;
- case SCHEDULING_STATE.UNINTR_SLEEP_WAKING:
- state = SCHEDULING_STATE.UNINTR_SLEEP_WAKE_KILL_IO;
- break;
- default:
- }
- }
- slices.push(new tr.model.ThreadTimeSlice(
- thread,
- state, '', prevSlice.end, args, midDuration));
- } else {
- slices.push(new tr.model.ThreadTimeSlice(
- thread,
- state, '', prevSlice.end, {}, midDuration));
- }
- if (wakeup !== undefined) {
- var wakeupDuration = nextSlice.start - wakeup.ts;
- var args = {'wakeup from tid': wakeup.fromTid};
- slices.push(new tr.model.ThreadTimeSlice(
- thread, SCHEDULING_STATE.RUNNABLE, '',
- wakeup.ts, args, wakeupDuration));
- wakeup = undefined;
- }
- };
-
- if (prevSlice.args.stateWhenDescheduled == 'S') {
- pushSleep(SCHEDULING_STATE.SLEEPING);
- } else if (prevSlice.args.stateWhenDescheduled == 'R' ||
- prevSlice.args.stateWhenDescheduled == 'R+') {
- slices.push(new tr.model.ThreadTimeSlice(
- thread, SCHEDULING_STATE.RUNNABLE, '',
- prevSlice.end, {}, midDuration));
- } else if (prevSlice.args.stateWhenDescheduled == 'D') {
- pushSleep(SCHEDULING_STATE.UNINTR_SLEEP);
- } else if (prevSlice.args.stateWhenDescheduled == 'T') {
- slices.push(new tr.model.ThreadTimeSlice(
- thread, SCHEDULING_STATE.STOPPED, '',
- prevSlice.end, {}, midDuration));
- } else if (prevSlice.args.stateWhenDescheduled == 't') {
- slices.push(new tr.model.ThreadTimeSlice(
- thread, SCHEDULING_STATE.DEBUG, '',
- prevSlice.end, {}, midDuration));
- } else if (prevSlice.args.stateWhenDescheduled == 'Z') {
- slices.push(new tr.model.ThreadTimeSlice(
- thread, SCHEDULING_STATE.ZOMBIE, '',
- prevSlice.end, {}, midDuration));
- } else if (prevSlice.args.stateWhenDescheduled == 'X') {
- slices.push(new tr.model.ThreadTimeSlice(
- thread, SCHEDULING_STATE.EXIT_DEAD, '',
- prevSlice.end, {}, midDuration));
- } else if (prevSlice.args.stateWhenDescheduled == 'x') {
- slices.push(new tr.model.ThreadTimeSlice(
- thread, SCHEDULING_STATE.TASK_DEAD, '',
- prevSlice.end, {}, midDuration));
- } else if (prevSlice.args.stateWhenDescheduled == 'K') {
- slices.push(new tr.model.ThreadTimeSlice(
- thread, SCHEDULING_STATE.WAKE_KILL, '',
- prevSlice.end, {}, midDuration));
- } else if (prevSlice.args.stateWhenDescheduled == 'W') {
- slices.push(new tr.model.ThreadTimeSlice(
- thread, SCHEDULING_STATE.WAKING, '',
- prevSlice.end, {}, midDuration));
- } else if (prevSlice.args.stateWhenDescheduled == 'D|K') {
- pushSleep(SCHEDULING_STATE.UNINTR_SLEEP_WAKE_KILL);
- } else if (prevSlice.args.stateWhenDescheduled == 'D|W') {
- pushSleep(SCHEDULING_STATE.UNINTR_SLEEP_WAKING);
- } else {
- slices.push(new tr.model.ThreadTimeSlice(
- thread, SCHEDULING_STATE.UNKNOWN, '',
- prevSlice.end, {}, midDuration));
- this.model_.importWarning({
- type: 'parse_error',
- message: 'Unrecognized sleep state: ' +
- prevSlice.args.stateWhenDescheduled
- });
- }
-
- var runningSlice = new tr.model.ThreadTimeSlice(
- thread, SCHEDULING_STATE.RUNNING, '',
- nextSlice.start, {}, nextSlice.duration);
- runningSlice.cpuOnWhichThreadWasRunning = prevSlice.cpu;
- slices.push(runningSlice);
- }
- thread.timeSlices = slices;
- }, this);
- },
-
- /**
- * Creates an instance of each registered linux perf event parser.
- * This allows the parsers to register handlers for the events they
- * understand. We also register our own special handlers (for the
- * timestamp synchronization markers).
- */
- createParsers_: function() {
- // Instantiate the parsers; this will register handlers for known events
- var allTypeInfos = tr.e.importer.linux_perf.
- Parser.getAllRegisteredTypeInfos();
- var parsers = allTypeInfos.map(
- function(typeInfo) {
- return new typeInfo.constructor(this);
- }, this);
-
- return parsers;
- },
-
- registerDefaultHandlers_: function() {
- this.registerEventHandler('tracing_mark_write',
- FTraceImporter.prototype.traceMarkingWriteEvent_.bind(this));
- // NB: old-style trace markers; deprecated
- this.registerEventHandler('0',
- FTraceImporter.prototype.traceMarkingWriteEvent_.bind(this));
- // Register dummy clock sync handlers to avoid warnings in the log.
- this.registerEventHandler('tracing_mark_write:trace_event_clock_sync',
- function() { return true; });
- this.registerEventHandler('0:trace_event_clock_sync',
- function() { return true; });
- },
-
- /**
- * Processes a trace_event_clock_sync event.
- */
- traceClockSyncEvent_: function(eventName, cpuNumber, pid, ts, eventBase) {
- // Check to see if we have a normal clock sync marker that contains a
- // sync ID and the current time according to the "ftrace global" clock.
- var event = /name=(\w+?)\s(.+)/.exec(eventBase.details);
- if (event) {
- var name = event[1];
- var pieces = event[2].split(' ');
- var args = {
- perfTs: ts
- };
- for (var i = 0; i < pieces.length; i++) {
- var parts = pieces[i].split('=');
- if (parts.length != 2)
- throw new Error('omgbbq');
- args[parts[0]] = parts[1];
- }
-
- this.model_.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.LINUX_FTRACE_GLOBAL, name, ts);
- return true;
- }
-
- // Check to see if we have a special clock sync marker that contains both
- // the current "ftrace global" time and the current CLOCK_MONOTONIC time.
- event = /parent_ts=(\d+\.?\d*)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var monotonicTs = event[1] * 1000;
- // A monotonic timestamp of zero is used as a sentinel value to indicate
- // that CLOCK_MONOTONIC and the ftrace global clock are identical.
- if (monotonicTs === 0)
- monotonicTs = ts;
-
- if (this.haveClockSyncedMonotonicToGlobal_)
- // ftrace sometimes includes multiple clock syncs between the monotonic
- // and global clocks within a single trace. We protect against this by
- // only taking the first one into account.
- return true;
-
- // We have a clock sync event that contains two timestamps: a timestamp
- // according to the ftrace 'global' clock, and that same timestamp
- // according to clock_gettime(CLOCK_MONOTONIC).
- this.model_.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.LINUX_FTRACE_GLOBAL,
- MONOTONIC_TO_FTRACE_GLOBAL_SYNC_ID, ts);
- this.model_.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.LINUX_CLOCK_MONOTONIC,
- MONOTONIC_TO_FTRACE_GLOBAL_SYNC_ID, monotonicTs);
-
- this.haveClockSyncedMonotonicToGlobal_ = true;
- return true;
- },
-
- /**
- * Processes a trace_marking_write event.
- */
- traceMarkingWriteEvent_: function(eventName, cpuNumber, pid, ts, eventBase,
- threadName) {
-
- // Some profiles end up with a \n\ on the end of each line. Strip it
- // before we do the comparisons.
- eventBase.details = eventBase.details.replace(/\\n.*$/, '');
-
- var event = /^\s*(\w+):\s*(.*)$/.exec(eventBase.details);
- if (!event) {
- // Check if the event matches events traced by the Android framework
- var tag = eventBase.details.substring(0, 2);
- if (tag == 'B|' || tag == 'E' || tag == 'E|' || tag == 'X|' ||
- tag == 'C|' || tag == 'S|' || tag == 'F|') {
- eventBase.subEventName = 'android';
- } else {
- return false;
- }
- } else {
- eventBase.subEventName = event[1];
- eventBase.details = event[2];
- }
-
- var writeEventName = eventName + ':' + eventBase.subEventName;
- var handler = this.eventHandlers_[writeEventName];
- if (!handler) {
- this.model_.importWarning({
- type: 'parse_error',
- message: 'Unknown trace_marking_write event ' + writeEventName
- });
- return true;
- }
- return handler(writeEventName, cpuNumber, pid, ts, eventBase, threadName);
- },
-
- /**
- * Walks the this.events_ structure and creates Cpu objects.
- */
- importCpuData_: function(modelTimeTransformer) {
- this.forEachLine_(function(text, eventBase, cpuNumber, pid, ts) {
- var eventName = eventBase.eventName;
- var handler = this.eventHandlers_[eventName];
- if (!handler) {
- this.model_.importWarning({
- type: 'parse_error',
- message: 'Unknown event ' + eventName + ' (' + text + ')'
- });
- return;
- }
- ts = modelTimeTransformer(ts);
- if (!handler(eventName, cpuNumber, pid, ts, eventBase)) {
- this.model_.importWarning({
- type: 'parse_error',
- message: 'Malformed ' + eventName + ' event (' + text + ')'
- });
- }
- }.bind(this));
- },
-
- /**
- * Walks the this.events_ structure and populates this.lines_.
- */
- parseLines_: function() {
- var lines = [];
- var extractResult = FTraceImporter._extractEventsFromSystraceHTML(
- this.events_, true);
- if (!extractResult.ok)
- extractResult = FTraceImporter._extractEventsFromSystraceMultiHTML(
- this.events_, true);
- var lines = extractResult.ok ?
- extractResult.lines : this.events_.split('\n');
-
- var lineParser = undefined;
- for (var lineNumber = 0; lineNumber < lines.length; ++lineNumber) {
- var line = lines[lineNumber].trim();
- if (line.length == 0 || /^#/.test(line))
- continue;
-
- if (!lineParser) {
- lineParser = autoDetectLineParser(line);
- if (!lineParser) {
- this.model_.importWarning({
- type: 'parse_error',
- message: 'Cannot parse line: ' + line
- });
- continue;
- }
- }
-
- var eventBase = lineParser(line);
- if (!eventBase) {
- this.model_.importWarning({
- type: 'parse_error',
- message: 'Unrecognized line: ' + line
- });
- continue;
- }
-
- this.lines_.push([
- line,
- eventBase,
- parseInt(eventBase.cpuNumber),
- parseInt(eventBase.pid),
- parseFloat(eventBase.timestamp) * 1000
- ]);
- }
- },
-
- /**
- * Calls |handler| for every parsed line.
- */
- forEachLine_: function(handler) {
- for (var i = 0; i < this.lines_.length; ++i) {
- var line = this.lines_[i];
- handler.apply(this, line);
- }
- },
-
- /**
- * Initializes the ftrace importer. This initialization can't be done in the
- * constructor because all trace event handlers may not have been registered
- * by that point.
- */
- lazyInit_: function() {
- this.parsers_ = this.createParsers_();
- this.registerDefaultHandlers_();
- this.parseLines_();
- }
- };
-
- tr.importer.Importer.register(FTraceImporter);
-
- return {
- FTraceImporter: FTraceImporter,
- _FTraceImporterTestExports: TestExports
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer_test.html
deleted file mode 100644
index 244e3e28a13..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/ftrace_importer_test.html
+++ /dev/null
@@ -1,530 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-<link rel="import" href="/tracing/importer/import.html">
-<link rel="import" href="/tracing/model/clock_sync_manager.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ClockDomainId = tr.model.ClockDomainId;
- var FTraceImporter = tr.e.importer.linux_perf.FTraceImporter;
- var FTraceImporterTestExports =
- tr.e.importer.linux_perf._FTraceImporterTestExports;
-
- function newModel(events) {
- return tr.c.TestUtils.newModelWithEvents([events], {
- shiftWorldToZero: false
- });
- }
-
- test('lineParserWithLegacyFmt', function() {
- var p = FTraceImporterTestExports.lineParserWithLegacyFmt;
- var x = p(' <idle>-0 [001] 4467.843475: sched_switch: ' +
- 'prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> ' +
- 'next_comm=SurfaceFlinger next_pid=178 next_prio=112');
- assert.isNotNull(x);
- assert.equal(x.threadName, '<idle>');
- assert.equal(x.pid, '0');
- assert.equal(x.cpuNumber, '001');
- assert.equal(x.timestamp, '4467.843475');
- assert.equal(x.eventName, 'sched_switch');
- assert.equal('prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R' +
- ' ==> next_comm=SurfaceFlinger next_pid=178 next_prio=112', x.details);
-
- var x = p('Binder-Thread #-647 [001] 260.464294: sched_switch: ' +
- 'prev_comm=Binder Thread # prev_pid=647 prev_prio=120 prev_state=D ' +
- ' ==> next_comm=.android.chrome next_pid=1562 next_prio=120');
- assert.isNotNull(x);
- assert.equal(x.threadName, 'Binder-Thread #');
- assert.equal(x.pid, '647');
- });
-
- test('lineParserWithIRQInfo', function() {
- var p = FTraceImporterTestExports.lineParserWithIRQInfo;
- var x = p(' systrace.sh-5441 [001] d... 1031.091570: ' +
- 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000');
- assert.isNotNull(x);
- assert.equal(x.threadName, 'systrace.sh');
- assert.equal(x.pid, '5441');
- assert.equal(x.cpuNumber, '001');
- assert.equal(x.timestamp, '1031.091570');
- assert.equal(x.eventName, 'sched_wakeup');
- assert.equal(x.details, 'comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); // @suppress longLineCheck
- });
-
- test('lineParserWithIRQInfoNeedResched', function() {
- var p = FTraceImporterTestExports.lineParserWithIRQInfo;
- var x = p(' systrace.sh-5441 [001] .N.. 1031.091570: ' +
- 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000');
- assert.isNotNull(x);
- assert.equal(x.threadName, 'systrace.sh');
- assert.equal(x.pid, '5441');
- assert.equal(x.cpuNumber, '001');
- assert.equal(x.timestamp, '1031.091570');
- assert.equal(x.eventName, 'sched_wakeup');
- assert.equal(x.details, 'comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); // @suppress longLineCheck
-
- var x = p(' systrace.sh-5441 [001] .n.. 1031.091570: ' +
- 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000');
- assert.isNotNull(x);
- assert.equal(x.threadName, 'systrace.sh');
-
- var x = p(' systrace.sh-5441 [001] .p.. 1031.091570: ' +
- 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000');
- assert.isNotNull(x);
- assert.equal(x.threadName, 'systrace.sh');
- });
-
- test('lineParserWithTGID', function() {
- var p = FTraceImporterTestExports.lineParserWithTGID;
- var x = p(' systrace.sh-5441 (54321) [001] d... 1031.091570: ' +
- 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000');
- assert.isNotNull(x);
- assert.equal(x.threadName, 'systrace.sh');
- assert.equal(x.pid, '5441');
- assert.equal(x.tgid, '54321');
- assert.equal(x.cpuNumber, '001');
- assert.equal(x.timestamp, '1031.091570');
- assert.equal(x.eventName, 'sched_wakeup');
- assert.equal(x.details, 'comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); // @suppress longLineCheck
-
- var x = p(' systrace.sh-5441 ( 321) [001] d... 1031.091570: ' +
- 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000');
- assert.isNotNull(x);
- assert.equal(x.tgid, '321');
-
- var x = p(' systrace.sh-5441 (-----) [001] d... 1031.091570: ' +
- 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000');
- assert.isNotNull(x);
- assert.isUndefined(x.tgid);
- });
-
- test('lineParserWithTGIDNeedResched', function() {
- var p = FTraceImporterTestExports.lineParserWithTGID;
- var x = p(' systrace.sh-5441 (54321) [001] .N.. 1031.091570: ' +
- 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000');
- assert.isNotNull(x);
- assert.equal(x.threadName, 'systrace.sh');
- assert.equal(x.pid, '5441');
- assert.equal(x.tgid, '54321');
- assert.equal(x.cpuNumber, '001');
- assert.equal(x.timestamp, '1031.091570');
- assert.equal(x.eventName, 'sched_wakeup');
- assert.equal(x.details, 'comm=debugd pid=4978 prio=120 success=1 target_cpu=000'); // @suppress longLineCheck
-
- var x = p(' systrace.sh-5441 ( 321) [001] .n.. 1031.091570: ' +
- 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000');
- assert.isNotNull(x);
- assert.equal(x.tgid, '321');
-
- var x = p(' systrace.sh-5441 (-----) [001] .p.. 1031.091570: ' +
- 'sched_wakeup: comm=debugd pid=4978 prio=120 success=1 target_cpu=000');
- assert.isNotNull(x);
- assert.isUndefined(x.tgid);
- });
-
- test('autodetectLineCornerCases', function() {
- var detectParser = FTraceImporterTestExports.autoDetectLineParser;
- var lineParserWithLegacyFmt =
- FTraceImporterTestExports.lineParserWithLegacyFmt;
- var lineParserWithIRQInfo = FTraceImporterTestExports.lineParserWithIRQInfo;
- var lineParserWithTGID = FTraceImporterTestExports.lineParserWithTGID;
-
- var lineWithLegacyFmt =
- 'systrace.sh-8170 [001] 15180.978813: sched_switch: ' +
- 'prev_comm=systrace.sh prev_pid=8170 prev_prio=120 ' +
- 'prev_state=x ==> next_comm=kworker/1:0 next_pid=7873 ' +
- 'next_prio=120';
- var detected = detectParser(lineWithLegacyFmt);
- assert.equal(lineParserWithLegacyFmt, detected);
-
- var lineWithIRQInfo =
- 'systrace.sh-8170 [001] d... 15180.978813: sched_switch: ' +
- 'prev_comm=systrace.sh prev_pid=8170 prev_prio=120 ' +
- 'prev_state=x ==> next_comm=kworker/1:0 next_pid=7873 ' +
- 'next_prio=120';
- var detected = detectParser(lineWithIRQInfo);
- assert.equal(lineParserWithIRQInfo, detected);
-
- var lineWithTGID =
- 'systrace.sh-8170 (54321) [001] d... 15180.978813: sched_switch: ' +
- 'prev_comm=systrace.sh prev_pid=8170 prev_prio=120 ' +
- 'prev_state=x ==> next_comm=kworker/1:0 next_pid=7873 ' +
- 'next_prio=120';
- var detected = detectParser(lineWithTGID);
- assert.equal(lineParserWithTGID, detected);
- });
-
- test('traceEventClockSyncRE', function() {
- var re = FTraceImporterTestExports.traceEventClockSyncRE;
- var x = re.exec('trace_event_clock_sync: parent_ts=19581477508');
- assert.isNotNull(x);
- assert.equal(x[1], '19581477508');
-
- var x = re.exec('trace_event_clock_sync: parent_ts=123.456');
- assert.isNotNull(x);
- assert.equal(x[1], '123.456');
- });
-
- test('genericClockSync', function() {
- var lines = [
- '# tracer: nop',
- '#',
- '# TASK-PID CPU# TIMESTAMP FUNCTION',
- '# | | | | |',
- 'sh-26121 [000] ...1 15.050: tracing_mark_write: trace_event_clock_sync: name=battor regulator=8941_smbb_boost' // @suppress longLineCheck
- ];
-
- var io = new tr.importer.ImportOptions();
- var m = new tr.Model();
- var i = new tr.importer.Import(m, io);
-
- m.clockSyncManager.addClockSyncMarker(ClockDomainId.BATTOR, 'battor', 50);
-
- i.importTraces([lines.join('\n')]);
-
- assert.isFalse(m.hasImportWarnings);
- // The clock sync happened at 15050 in the ftrace global domain and at 50
- // in the BattOr domain. This means the ftrace global timestamps need 15000
- // subtracted from them in order to be on the BattOr timeline.
- assert.strictEqual(
- m.clockSyncManager.getModelTimeTransformer(ClockDomainId.BATTOR)(3),
- 3);
- assert.strictEqual(
- m.clockSyncManager.getModelTimeTransformer(
- ClockDomainId.LINUX_FTRACE_GLOBAL)(15003),
- 3);
- });
-
- test('canImport', function() {
- var lines = [
- '# tracer: nop',
- '#',
- '# TASK-PID CPU# TIMESTAMP FUNCTION',
- '# | | | | |',
- ' <idle>-0 [001] 4467.843475: sched_switch: ' +
- 'prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> ' +
- 'next_comm=SurfaceFlinger next_pid=178 next_prio=112',
-
- ' SurfaceFlinger-178 [001] 4467.843536: sched_switch: ' +
- 'prev_comm=SurfaceFlinger prev_pid=178 prev_prio=112 prev_state=S ' +
- '==> next_comm=kworker/u:2 next_pid=2844 next_prio=120',
-
- ' kworker/u:2-2844 [001] 4467.843567: sched_switch: ' +
- 'prev_comm=kworker/u:2 prev_pid=2844 prev_prio=120 prev_state=S ' +
- '==> next_comm=swapper next_pid=0 next_prio=120',
-
- ' <idle>-0 [001] 4467.844208: sched_switch: ' +
- 'prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> ' +
- 'next_comm=kworker/u:2 next_pid=2844 next_prio=120'
- ];
- assert.isTrue(FTraceImporter.canImport(lines.join('\n')));
-
- var lines = [
- ' <idle>-0 [001] 4467.843475: sched_switch: ' +
- 'prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> ' +
- 'next_comm=SurfaceFlinger next_pid=178 next_prio=112'
- ];
- assert.isTrue(FTraceImporter.canImport(lines.join('\n')));
-
- var lines = [
- ' <idle>-0 [001] 4467.843475: sched_switch: ' +
- 'prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> ' +
- 'next_comm=SurfaceFlinger next_pid=178 next_prio=112',
-
- ' SurfaceFlinger-178 [001] 4467.843536: sched_switch: ' +
- 'prev_comm=SurfaceFlinger prev_pid=178 prev_prio=112 ' +
- 'prev_state=S ==> next_comm=kworker/u:2 next_pid=2844 ' +
- 'next_prio=120'
- ];
- assert.isTrue(FTraceImporter.canImport(lines.join('\n')));
-
- var lines = [
- 'SomeRandomText',
- 'More random text'
- ];
- assert.isFalse(FTraceImporter.canImport(lines.join('\n')));
- });
-
- test('canImport34AndLater', function() {
- var lines = [
- '# tracer: nop',
- '#',
- '# entries-in-buffer/entries-written: 55191/55191 #P:2',
- '#',
- '# _-----=> irqs-off',
- '# / _----=> need-resched',
- '# | / _---=> hardirq/softirq',
- '# || / _--=> preempt-depth',
- '# ||| / delay',
- '# TASK-PID CPU# |||| TIMESTAMP FUNCTION',
- '# | | | |||| | |',
- ' systrace.sh-5441 [001] d... 1031.091570: sched_wakeup: ' +
- 'comm=debugd pid=4978 prio=120 success=1 target_cpu=000',
- ' systrace.sh-5441 [001] d... 1031.091584: sched_switch: ' +
- 'prev_comm=systrace.sh prev_pid=5441 prev_prio=120 prev_state=x ' +
- '==> next_comm=chrome next_pid=5418 next_prio=120'
- ];
- assert.isTrue(FTraceImporter.canImport(lines.join('\n')));
-
- var lines = [
- ' systrace.sh-5441 [001] d... 1031.091570: sched_wakeup: ' +
- 'comm=debugd pid=4978 prio=120 success=1 target_cpu=000',
- ' systrace.sh-5441 [001] d... 1031.091584: sched_switch: ' +
- 'prev_comm=systrace.sh prev_pid=5441 prev_prio=120 prev_state=x ' +
- '==> next_comm=chrome next_pid=5418 next_prio=120'
- ];
- assert.isTrue(FTraceImporter.canImport(lines.join('\n')));
- });
-
- test('importOneSequence', function() {
- var lines = [
- ' <idle>-0 [001] 4467.843475: sched_switch: ' +
- 'prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> ' +
- 'next_comm=SurfaceFlinger next_pid=178 next_prio=112',
-
- ' SurfaceFlinger-178 [001] 4467.843536: sched_switch: ' +
- 'prev_comm=SurfaceFlinger prev_pid=178 prev_prio=112 ' +
- 'prev_state=S ==> next_comm=kworker/u:2 next_pid=2844 ' +
- 'next_prio=120',
-
- ' kworker/u:2-2844 [001] 4467.843567: sched_switch: ' +
- 'prev_comm=kworker/u:2 prev_pid=2844 prev_prio=120 ' +
- 'prev_state=S ==> next_comm=swapper next_pid=0 next_prio=120'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var c = m.kernel.cpus[1];
- assert.equal(c.slices.length, 2);
-
- assert.equal(c.slices[0].title, 'SurfaceFlinger');
- assert.equal(c.slices[0].start, 4467843.475);
- assert.closeTo(.536 - .475, c.slices[0].duration, 1e-5);
- });
-
- test('importOneSequenceWithSpacyThreadName', function() {
- var lines = [
- ' <idle>-0 [001] 4467.843475: sched_switch: ' +
- 'prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ==> ' +
- 'next_comm=Surface Flinger next_pid=178 next_prio=112',
-
- 'Surface Flinger -178 [001] 4467.843536: sched_switch: ' +
- 'prev_comm=Surface Flinger prev_pid=178 prev_prio=112 ' +
- 'prev_state=S ==> next_comm=kworker/u:2 next_pid=2844 ' +
- 'next_prio=120',
-
- ' kworker/u:2-2844 [001] 4467.843567: sched_switch: ' +
- 'prev_comm=kworker/u:2 prev_pid=2844 prev_prio=120 ' +
- 'prev_state=S ==> next_comm=swapper next_pid=0 next_prio=120'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var c = m.kernel.cpus[1];
- assert.equal(c.slices.length, 2);
-
- assert.equal(c.slices[0].title, 'Surface Flinger ');
- assert.equal(c.slices[0].start, 4467843.475);
- assert.closeTo(.536 - .475, c.slices[0].duration, 1e-5);
- });
-
- test('importWithNewline', function() {
- var lines = [
- ''
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
- });
-
- test('importSystraceHtml', function() {
- var p = tr.b.getAsync(
- '/test_data/trivial_systrace.html');
- return p.then(function(data) {
- var m = newModel(data);
- assert.isFalse(m.hasImportWarnings);
-
- assert.isDefined(m.processes[124]);
- assert.isDefined(m.processes[360]);
-
- assert.isDefined(m.processes[124].counters['android.StatusBar']);
- assert.equal(m.processes[124].counters['android.StatusBar'].numSamples,
- 1);
- assert.isDefined(m.processes[124].counters['android.VSYNC']);
- assert.equal(2, m.processes[124].counters['android.VSYNC'].numSamples);
- assert.isDefined(m.processes[360].counters['android.iq']);
- assert.equal(1, m.processes[360].counters['android.iq'].numSamples);
- }, function(err) {
- throw err;
- });
- });
-
- test('importMultiTraceHtml', function() {
- var lines = [
- '<!DoCTYPE hTml>', // check must be case insensitive
- '<body>',
- ' <div class="view">',
- ' <\/div>',
- ' <script class="trace-data" type="application/text">',
- 'test1',
- 'test2',
- ' <\/script>',
- ' <script class="trace-data" type="application/text">',
- '# tracer: nop',
- '#',
- '# TASK-PID CPU# TIMESTAMP FUNCTION',
- '# | | | | |',
- ' hwc_eventmon-336 [000] 50260.929925: 0: C|124|VSYNC|1',
- ' Binder_1-340 [000] 50260.935656: 0: C|124|StatusBar|1',
- ' hwc_eventmon-336 [000] 50260.946573: 0: C|124|VSYNC|0',
- ' InputReader-419 [000] 50262.538578: 0: C|360|iq|1',
- ' <\/script>',
- '<\/body>',
- '<\/html>'
- ];
-
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- assert.isDefined(m.processes[124]);
- assert.isDefined(m.processes[360]);
-
- assert.isDefined(m.processes[124].counters['android.StatusBar']);
- assert.equal(m.processes[124].counters['android.StatusBar'].numSamples,
- 1);
- assert.isDefined(m.processes[124].counters['android.VSYNC']);
- assert.equal(2, m.processes[124].counters['android.VSYNC'].numSamples);
- assert.isDefined(m.processes[360].counters['android.iq']);
- assert.equal(1, m.processes[360].counters['android.iq'].numSamples);
- });
-
- test('clockSync', function() {
- var lines = [
- ' <idle>-0 [001] 4467.843475: sched_switch: ' +
- 'prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ' +
- '==> next_comm=SurfaceFlinger next_pid=178 next_prio=112',
- ' SurfaceFlinger-178 [001] 4467.843536: sched_switch: ' +
- 'prev_comm=SurfaceFlinger prev_pid=178 prev_prio=112 ' +
- 'prev_state=S ==> next_comm=kworker/u:2 next_pid=2844 ' +
- 'next_prio=120',
- ' kworker/u:2-2844 [001] 4467.843567: sched_switch: ' +
- 'prev_comm=kworker/u:2 prev_pid=2844 prev_prio=120 ' +
- 'prev_state=S ==> next_comm=swapper next_pid=0 ' +
- 'next_prio=120',
- ' kworker/u:2-2844 [001] 4467.843000: 0: ' +
- 'trace_event_clock_sync: parent_ts=0.1'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var c = m.kernel.cpus[1];
- assert.equal(c.slices.length, 2);
-
- assert.closeTo(
- (467.843475 - (467.843 - 0.1)) * 1000,
- c.slices[0].start,
- 1e-5);
- });
-
- test('clockSyncMarkWrite', function() {
- var lines = [
- 'systrace.sh-8170 [001] 15180.978813: sched_switch: ' +
- 'prev_comm=systrace.sh prev_pid=8170 prev_prio=120 ' +
- 'prev_state=x ==> next_comm=kworker/1:0 next_pid=7873 ' +
- 'next_prio=120',
- ' kworker/1:0-7873 [001] 15180.978836: sched_switch: ' +
- 'prev_comm=kworker/1:0 prev_pid=7873 prev_prio=120 ' +
- 'prev_state=S ==> next_comm=debugd next_pid=4404 next_prio=120',
- ' debugd-4404 [001] 15180.979010: sched_switch: prev_comm=debugd ' +
- 'prev_pid=4404 prev_prio=120 prev_state=S ==> ' +
- 'next_comm=dbus-daemon next_pid=510 next_prio=120',
- 'systrace.sh-8182 [000] 15186.203900: tracing_mark_write: ' +
- 'trace_event_clock_sync: parent_ts=0'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var c = m.kernel.cpus[1];
- assert.equal(c.slices.length, 2);
-
- assert.closeTo((15180.978813 - 0) * 1000, c.slices[0].start, 1e-5);
-
- assert.strictEqual(
- m.clockSyncManager.getModelTimeTransformer(
- tr.model.ClockDomainId.LINUX_FTRACE_GLOBAL)(100),
- 100);
- assert.strictEqual(
- m.clockSyncManager.getModelTimeTransformer(
- tr.model.ClockDomainId.LINUX_CLOCK_MONOTONIC)(100),
- 100);
- });
-
- test('clockSyncMarkWriteSecondIgnored', function() {
- var lines = [
- 'systrace.sh-8182 [000] 15186.203900: tracing_mark_write: ' +
- 'trace_event_clock_sync: parent_ts=0',
- 'systrace.sh-8182 [000] 15187.203900: tracing_mark_write: ' +
- 'trace_event_clock_sync: parent_ts=0'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- assert.strictEqual(
- m.clockSyncManager.getModelTimeTransformer(
- tr.model.ClockDomainId.LINUX_FTRACE_GLOBAL)(100),
- 100);
- assert.strictEqual(
- m.clockSyncManager.getModelTimeTransformer(
- tr.model.ClockDomainId.LINUX_CLOCK_MONOTONIC)(100),
- 100);
- });
-
- test('tracingMarkWriteEOLCleanup', function() {
- var lines = [
- 'systrace.sh-8182 [001] ...1 2068001.677892: tracing_mark_write: ' +
- 'B|9304|test\\n\\',
- 'systrace.sh-8182 [002] ...1 2068991.686415: tracing_mark_write: E\\n\\'
- ];
-
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var c = m.processes[9304].threads[8182].sliceGroup;
- assert.equal(c.slices.length, 1);
-
- assert.closeTo((2068001.677892 - 0) * 1000, c.slices[0].start, 1e-5);
- assert.closeTo(
- (2068991.686415 - 2068001.677892) * 1000,
- c.slices[0].duration,
- 1e-5);
- });
-
- test('cpuCount', function() {
- var lines = [
- 'systrace.sh-8170 [001] 15180.978813: sched_switch: ' +
- 'prev_comm=systrace.sh prev_pid=8170 prev_prio=120 ' +
- 'prev_state=x ==> next_comm=kworker/1:0 next_pid=7873 ' +
- 'next_prio=120',
- ' kworker/1:0-7873 [001] 15180.978836: sched_switch: ' +
- 'prev_comm=kworker/1:0 prev_pid=7873 prev_prio=120 ' +
- 'prev_state=S ==> next_comm=debugd next_pid=4404 next_prio=120',
- ' debugd-4404 [000] 15180.979010: sched_switch: prev_comm=debugd ' +
- 'prev_pid=4404 prev_prio=120 prev_state=S ==> ' +
- 'next_comm=dbus-daemon next_pid=510 next_prio=120'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- assert.equal(tr.b.dictionaryLength(m.kernel.cpus), 2);
- assert.equal(m.kernel.bestGuessAtCpuCount, 2);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/gesture_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/gesture_parser.html
deleted file mode 100644
index f2c3924867b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/gesture_parser.html
+++ /dev/null
@@ -1,144 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses gesture events in the Linux event trace format.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
-
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses trace events generated by gesture library for touchpad.
- * @constructor
- */
- function GestureParser(importer) {
- Parser.call(this, importer);
- importer.registerEventHandler('tracing_mark_write:log',
- GestureParser.prototype.logEvent.bind(this));
- importer.registerEventHandler('tracing_mark_write:SyncInterpret',
- GestureParser.prototype.syncEvent.bind(this));
- importer.registerEventHandler('tracing_mark_write:HandleTimer',
- GestureParser.prototype.timerEvent.bind(this));
- }
-
- GestureParser.prototype = {
- __proto__: Parser.prototype,
-
- /**
- * Parse events generate by gesture library.
- * gestureOpenSlice and gestureCloseSlice are two common
- * functions to store the begin time and end time for all
- * events in gesture library
- */
- gestureOpenSlice: function(title, ts, opt_args) {
- var thread = this.importer.getOrCreatePseudoThread('gesture').thread;
- thread.sliceGroup.beginSlice(
- 'touchpad_gesture', title, ts, opt_args);
- },
-
- gestureCloseSlice: function(title, ts) {
- var thread = this.importer.getOrCreatePseudoThread('gesture').thread;
- if (thread.sliceGroup.openSliceCount) {
- var slice = thread.sliceGroup.mostRecentlyOpenedPartialSlice;
- if (slice.title != title) {
- this.importer.model.importWarning({
- type: 'title_match_error',
- message: 'Titles do not match. Title is ' +
- slice.title + ' in openSlice, and is ' +
- title + ' in endSlice'
- });
- } else {
- thread.sliceGroup.endSlice(ts);
- }
- }
- },
-
- /**
- * For log events, events will come in pairs with a tag log:
- * like this:
- * tracing_mark_write: log: start: TimerLogOutputs
- * tracing_mark_write: log: end: TimerLogOutputs
- * which represent the start and the end time of certain log behavior
- * Take these logs above for example, they are the start and end time
- * of logging Output for HandleTimer function
- */
- logEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var innerEvent =
- /^\s*(\w+):\s*(\w+)$/.exec(eventBase.details);
- switch (innerEvent[1]) {
- case 'start':
- this.gestureOpenSlice('GestureLog', ts, {name: innerEvent[2]});
- break;
- case 'end':
- this.gestureCloseSlice('GestureLog', ts);
- }
- return true;
- },
-
- /**
- * For SyncInterpret events, events will come in pairs with
- * a tag SyncInterpret:
- * like this:
- * tracing_mark_write: SyncInterpret: start: ClickWiggleFilterInterpreter
- * tracing_mark_write: SyncInterpret: end: ClickWiggleFilterInterpreter
- * which represent the start and the end time of SyncInterpret function
- * inside the certain interpreter in the gesture library.
- * Take the logs above for example, they are the start and end time
- * of the SyncInterpret function inside ClickWiggleFilterInterpreter
- */
- syncEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var innerEvent = /^\s*(\w+):\s*(\w+)$/.exec(eventBase.details);
- switch (innerEvent[1]) {
- case 'start':
- this.gestureOpenSlice('SyncInterpret', ts,
- {interpreter: innerEvent[2]});
- break;
- case 'end':
- this.gestureCloseSlice('SyncInterpret', ts);
- }
- return true;
- },
-
- /**
- * For HandleTimer events, events will come in pairs with
- * a tag HandleTimer:
- * like this:
- * tracing_mark_write: HandleTimer: start: LookaheadFilterInterpreter
- * tracing_mark_write: HandleTimer: end: LookaheadFilterInterpreter
- * which represent the start and the end time of HandleTimer function
- * inside the certain interpreter in the gesture library.
- * Take the logs above for example, they are the start and end time
- * of the HandleTimer function inside LookaheadFilterInterpreter
- */
- timerEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var innerEvent = /^\s*(\w+):\s*(\w+)$/.exec(eventBase.details);
- switch (innerEvent[1]) {
- case 'start':
- this.gestureOpenSlice('HandleTimer', ts,
- {interpreter: innerEvent[2]});
- break;
- case 'end':
- this.gestureCloseSlice('HandleTimer', ts);
- }
- return true;
- }
- };
-
- Parser.register(GestureParser);
-
- return {
- GestureParser: GestureParser
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/gesture_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/gesture_parser_test.html
deleted file mode 100644
index 002844dcd2e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/gesture_parser_test.html
+++ /dev/null
@@ -1,213 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function newModel(events) {
- return tr.c.TestUtils.newModelWithEvents([events], {
- shiftWorldToZero: false
- });
- }
-
- test('gestureImport', function() {
- var lines = [
- '<...>-1837 [000] ...1 875292.741648: tracing_mark_write: ' +
- 'log: start: TimerLogOutputs', // 0
- '<...>-1837 [000] ...1 875292.741651: tracing_mark_write: ' +
- 'log: end: TimerLogOutputs',
- '<...>-1837 [000] ...1 875292.742796: tracing_mark_write: ' +
- 'log: start: LogTimerCallback',
- '<...>-1837 [000] ...1 875292.742802: tracing_mark_write: ' +
- 'log: end: LogTimerCallback',
- '<...>-1837 [000] ...1 875292.742805: tracing_mark_write: ' +
- 'HandleTimer: start: LoggingFilterInterpreter', // 2
- '<...>-1837 [000] ...1 875292.742809: tracing_mark_write: ' +
- 'HandleTimer: start: AppleTrackpadFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742814: tracing_mark_write: ' +
- 'HandleTimer: start: Cr48ProfileSensorFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742818: tracing_mark_write: ' +
- 'HandleTimer: start: T5R2CorrectingFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742822: tracing_mark_write: ' +
- 'HandleTimer: start: StuckButtonInhibitorFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742825: tracing_mark_write: ' +
- 'HandleTimer: start: IntegralGestureFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742829: tracing_mark_write: ' +
- 'HandleTimer: start: ScalingFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742833: tracing_mark_write: ' +
- 'HandleTimer: start: SplitCorrectingFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742836: tracing_mark_write: ' +
- 'HandleTimer: start: AccelFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742840: tracing_mark_write: ' +
- 'HandleTimer: start: SensorJumpFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742843: tracing_mark_write: ' +
- 'HandleTimer: start: BoxFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742846: tracing_mark_write: ' +
- 'HandleTimer: start: LookaheadFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742853: tracing_mark_write: ' +
- 'SyncInterpret: start: IirFilterInterpreter', // 14
- '<...>-1837 [000] ...1 875292.742861: tracing_mark_write: ' +
- 'SyncInterpret: start: PalmClassifyingFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742872: tracing_mark_write: ' +
- 'SyncInterpret: start: ClickWiggleFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742881: tracing_mark_write: ' +
- 'SyncInterpret: start: FlingStopFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742887: tracing_mark_write: ' +
- 'SyncInterpret: start: ImmediateInterpreter',
- '<...>-1837 [000] ...1 875292.742906: tracing_mark_write: ' +
- 'SyncInterpret: end: ImmediateInterpreter',
- '<...>-1837 [000] ...1 875292.742910: tracing_mark_write: ' +
- 'SyncInterpret: end: FlingStopFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742914: tracing_mark_write: ' +
- 'SyncInterpret: end: ClickWiggleFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742917: tracing_mark_write: ' +
- 'SyncInterpret: end: PalmClassifyingFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742921: tracing_mark_write: ' +
- 'SyncInterpret: end: IirFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742926: tracing_mark_write: ' +
- 'HandleTimer: end: LookaheadFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742929: tracing_mark_write: ' +
- 'HandleTimer: end: BoxFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742932: tracing_mark_write: ' +
- 'HandleTimer: end: SensorJumpFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742937: tracing_mark_write: ' +
- 'HandleTimer: end: AccelFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742940: tracing_mark_write: ' +
- 'HandleTimer: end: SplitCorrectingFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742944: tracing_mark_write: ' +
- 'HandleTimer: end: ScalingFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742949: tracing_mark_write: ' +
- 'HandleTimer: end: IntegralGestureFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742952: tracing_mark_write: ' +
- 'HandleTimer: end: StuckButtonInhibitorFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742956: tracing_mark_write: ' +
- 'HandleTimer: end: T5R2CorrectingFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742959: tracing_mark_write: ' +
- 'HandleTimer: end: Cr48ProfileSensorFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742962: tracing_mark_write: ' +
- 'HandleTimer: end: AppleTrackpadFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742966: tracing_mark_write: ' +
- 'HandleTimer: end: LoggingFilterInterpreter',
- '<...>-1837 [000] ...1 875292.742969: tracing_mark_write: ' +
- 'log: start: TimerLogOutputs',
- '<...>-1837 [000] ...1 875292.742973: tracing_mark_write: ' +
- 'log: end: TimerLogOutputs',
- '<...>-1837 [000] ...1 875292.795219: tracing_mark_write: ' +
- 'log: start: LogHardwareState',
- '<...>-1837 [000] ...1 875292.795231: tracing_mark_write: ' +
- 'log: end: LogHardwareState'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var gestureThread = threads[0];
- assert.equal(gestureThread.name, 'gesture');
- assert.equal(gestureThread.sliceGroup.length, 21);
- assert.equal('touchpad_gesture',
- gestureThread.sliceGroup.slices[0].category);
- assert.equal('GestureLog',
- gestureThread.sliceGroup.slices[0].title);
- assert.equal('touchpad_gesture',
- gestureThread.sliceGroup.slices[2].category);
- assert.equal('HandleTimer',
- gestureThread.sliceGroup.slices[2].title);
- assert.equal('touchpad_gesture',
- gestureThread.sliceGroup.slices[14].category);
- assert.equal('SyncInterpret',
- gestureThread.sliceGroup.slices[14].title);
- });
-
- test('unusualStart', function() {
- var lines = [
- 'X-30368 [000] ...1 1819362.481867: tracing_mark_write: ' +
- 'SyncInterpret: start: IirFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481881: tracing_mark_write: ' +
- 'SyncInterpret: start: PalmClassifyingFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481894: tracing_mark_write: ' +
- 'SyncInterpret: start: ClickWiggleFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481905: tracing_mark_write: ' +
- 'SyncInterpret: start: FlingStopFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481912: tracing_mark_write: ' +
- 'SyncInterpret: start: ImmediateInterpreter',
- 'X-30368 [000] ...1 1819362.481933: tracing_mark_write: ' +
- 'SyncInterpret: end: ImmediateInterpreter',
- 'X-30368 [000] ...1 1819362.481938: tracing_mark_write: ' +
- 'SyncInterpret: end: FlingStopFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481943: tracing_mark_write: ' +
- 'SyncInterpret: end: ClickWiggleFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481947: tracing_mark_write: ' +
- 'SyncInterpret: end: PalmClassifyingFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481952: tracing_mark_write: ' +
- 'SyncInterpret: end: IirFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481958: tracing_mark_write: ' +
- 'HandleTimer: end: LookaheadFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481962: tracing_mark_write: ' +
- 'HandleTimer: end: BoxFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481967: tracing_mark_write: ' +
- 'HandleTimer: end: SensorJumpFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481973: tracing_mark_write: ' +
- 'HandleTimer: end: AccelFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481977: tracing_mark_write: ' +
- 'HandleTimer: end: SplitCorrectingFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481982: tracing_mark_write: ' +
- 'HandleTimer: end: ScalingFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481988: tracing_mark_write: ' +
- 'HandleTimer: end: IntegralGestureFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481993: tracing_mark_write: ' +
- 'HandleTimer: end: StuckButtonInhibitorFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481998: tracing_mark_write: ' +
- 'HandleTimer: end: T5R2CorrectingFilterInterpreter',
- 'X-30368 [000] ...1 1819362.482033: tracing_mark_write: ' +
- 'HandleTimer: end: Cr48ProfileSensorFilterInterpreter',
- 'X-30368 [000] ...1 1819362.482038: tracing_mark_write: ' +
- 'HandleTimer: end: AppleTrackpadFilterInterpreter',
- 'X-30368 [000] ...1 1819362.482043: tracing_mark_write: ' +
- 'HandleTimer: end: LoggingFilterInterpreter',
- 'X-30368 [000] ...1 1819362.482047: tracing_mark_write: ' +
- 'log: start: TimerLogOutputs',
- 'X-30368 [000] ...1 1819362.482053: tracing_mark_write: ' +
- 'log: end: TimerLogOutputs'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
- });
-
- test('importError', function() {
- var lines = [
- 'X-30368 [000] ...1 1819362.481912: tracing_mark_write: ' +
- 'SyncInterpret: start: ImmediateInterpreter',
- 'X-30368 [000] ...1 1819362.481958: tracing_mark_write: ' +
- 'HandleTimer: end: LookaheadFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481962: tracing_mark_write: ' +
- 'HandleTimer: end: BoxFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481967: tracing_mark_write: ' +
- 'HandleTimer: end: SensorJumpFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481973: tracing_mark_write: ' +
- 'HandleTimer: end: AccelFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481977: tracing_mark_write: ' +
- 'HandleTimer: end: SplitCorrectingFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481982: tracing_mark_write: ' +
- 'HandleTimer: end: ScalingFilterInterpreter',
- 'X-30368 [000] ...1 1819362.481988: tracing_mark_write: ' +
- 'HandleTimer: end: IntegralGestureFilterInterpreter'
- ];
- var m = newModel(lines.join('\n'));
-
- assert.isTrue(m.hasImportWarnings);
- assert.equal(m.importWarnings.length, 7);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/i915_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/i915_parser.html
deleted file mode 100644
index 91c733a0e11..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/i915_parser.html
+++ /dev/null
@@ -1,371 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses i915 driver events in the Linux event trace format.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
- var ColorScheme = tr.b.ColorScheme;
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses linux i915 trace events.
- * @constructor
- */
- function I915Parser(importer) {
- Parser.call(this, importer);
-
- importer.registerEventHandler('i915_gem_object_create',
- I915Parser.prototype.gemObjectCreateEvent.bind(this));
- importer.registerEventHandler('i915_gem_object_bind',
- I915Parser.prototype.gemObjectBindEvent.bind(this));
- importer.registerEventHandler('i915_gem_object_unbind',
- I915Parser.prototype.gemObjectBindEvent.bind(this));
- importer.registerEventHandler('i915_gem_object_change_domain',
- I915Parser.prototype.gemObjectChangeDomainEvent.bind(this));
- importer.registerEventHandler('i915_gem_object_pread',
- I915Parser.prototype.gemObjectPreadWriteEvent.bind(this));
- importer.registerEventHandler('i915_gem_object_pwrite',
- I915Parser.prototype.gemObjectPreadWriteEvent.bind(this));
- importer.registerEventHandler('i915_gem_object_fault',
- I915Parser.prototype.gemObjectFaultEvent.bind(this));
- importer.registerEventHandler('i915_gem_object_clflush',
- // NB: reuse destroy handler
- I915Parser.prototype.gemObjectDestroyEvent.bind(this));
- importer.registerEventHandler('i915_gem_object_destroy',
- I915Parser.prototype.gemObjectDestroyEvent.bind(this));
- importer.registerEventHandler('i915_gem_ring_dispatch',
- I915Parser.prototype.gemRingDispatchEvent.bind(this));
- importer.registerEventHandler('i915_gem_ring_flush',
- I915Parser.prototype.gemRingFlushEvent.bind(this));
- importer.registerEventHandler('i915_gem_request',
- I915Parser.prototype.gemRequestEvent.bind(this));
- importer.registerEventHandler('i915_gem_request_add',
- I915Parser.prototype.gemRequestEvent.bind(this));
- importer.registerEventHandler('i915_gem_request_complete',
- I915Parser.prototype.gemRequestEvent.bind(this));
- importer.registerEventHandler('i915_gem_request_retire',
- I915Parser.prototype.gemRequestEvent.bind(this));
- importer.registerEventHandler('i915_gem_request_wait_begin',
- I915Parser.prototype.gemRequestEvent.bind(this));
- importer.registerEventHandler('i915_gem_request_wait_end',
- I915Parser.prototype.gemRequestEvent.bind(this));
- importer.registerEventHandler('i915_gem_ring_wait_begin',
- I915Parser.prototype.gemRingWaitEvent.bind(this));
- importer.registerEventHandler('i915_gem_ring_wait_end',
- I915Parser.prototype.gemRingWaitEvent.bind(this));
- importer.registerEventHandler('i915_reg_rw',
- I915Parser.prototype.regRWEvent.bind(this));
- importer.registerEventHandler('i915_flip_request',
- I915Parser.prototype.flipEvent.bind(this));
- importer.registerEventHandler('i915_flip_complete',
- I915Parser.prototype.flipEvent.bind(this));
- importer.registerEventHandler('intel_gpu_freq_change',
- I915Parser.prototype.gpuFrequency.bind(this));
- }
-
- I915Parser.prototype = {
- __proto__: Parser.prototype,
-
- i915FlipOpenSlice: function(ts, obj, plane) {
- // use i915_flip_obj_plane?
- var kthread = this.importer.getOrCreatePseudoThread('i915_flip');
- kthread.openSliceTS = ts;
- kthread.openSlice = 'flip:' + obj + '/' + plane;
- },
-
- i915FlipCloseSlice: function(ts, args) {
- var kthread = this.importer.getOrCreatePseudoThread('i915_flip');
- if (kthread.openSlice) {
- var slice = new tr.model.Slice('', kthread.openSlice,
- ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice),
- kthread.openSliceTS,
- args,
- ts - kthread.openSliceTS);
-
- kthread.thread.sliceGroup.pushSlice(slice);
- }
- kthread.openSlice = undefined;
- },
-
- i915GemObjectSlice: function(ts, eventName, obj, args) {
- var kthread = this.importer.getOrCreatePseudoThread('i915_gem');
- kthread.openSlice = eventName + ':' + obj;
- var slice = new tr.model.Slice('', kthread.openSlice,
- ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice),
- ts, args, 0);
-
- kthread.thread.sliceGroup.pushSlice(slice);
- },
-
- i915GemRingSlice: function(ts, eventName, dev, ring, args) {
- var kthread = this.importer.getOrCreatePseudoThread('i915_gem_ring');
- kthread.openSlice = eventName + ':' + dev + '.' + ring;
- var slice = new tr.model.Slice('', kthread.openSlice,
- ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice),
- ts, args, 0);
-
- kthread.thread.sliceGroup.pushSlice(slice);
- },
-
- i915RegSlice: function(ts, eventName, reg, args) {
- var kthread = this.importer.getOrCreatePseudoThread('i915_reg');
- kthread.openSlice = eventName + ':' + reg;
- var slice = new tr.model.Slice('', kthread.openSlice,
- ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice),
- ts, args, 0);
-
- kthread.thread.sliceGroup.pushSlice(slice);
- },
-
- i915FreqChangeSlice: function(ts, eventName, args) {
- var kthread = this.importer.getOrCreatePseudoThread('i915_gpu_freq');
- kthread.openSlice = eventName;
- var slice = new tr.model.Slice('', kthread.openSlice,
- ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice),
- ts, args, 0);
-
- kthread.thread.sliceGroup.pushSlice(slice);
- },
-
- /**
- * Parses i915 driver events and sets up state in the importer.
- */
- gemObjectCreateEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /obj=(\w+), size=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var obj = event[1];
- var size = parseInt(event[2]);
- this.i915GemObjectSlice(ts, eventName, obj,
- {
- obj: obj,
- size: size
- });
- return true;
- },
-
- gemObjectBindEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- // TODO(sleffler) mappable
- var event = /obj=(\w+), offset=(\w+), size=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var obj = event[1];
- var offset = event[2];
- var size = parseInt(event[3]);
- this.i915ObjectGemSlice(ts, eventName + ':' + obj,
- {
- obj: obj,
- offset: offset,
- size: size
- });
- return true;
- },
-
- gemObjectChangeDomainEvent: function(eventName, cpuNumber, pid, ts,
- eventBase) {
- var event = /obj=(\w+), read=(\w+=>\w+), write=(\w+=>\w+)/
- .exec(eventBase.details);
- if (!event)
- return false;
-
- var obj = event[1];
- var read = event[2];
- var write = event[3];
- this.i915GemObjectSlice(ts, eventName, obj,
- {
- obj: obj,
- read: read,
- write: write
- });
- return true;
- },
-
- gemObjectPreadWriteEvent: function(eventName, cpuNumber, pid, ts,
- eventBase) {
- var event = /obj=(\w+), offset=(\d+), len=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var obj = event[1];
- var offset = parseInt(event[2]);
- var len = parseInt(event[3]);
- this.i915GemObjectSlice(ts, eventName, obj,
- {
- obj: obj,
- offset: offset,
- len: len
- });
- return true;
- },
-
- gemObjectFaultEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- // TODO(sleffler) writable
- var event = /obj=(\w+), (\w+) index=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var obj = event[1];
- var type = event[2];
- var index = parseInt(event[3]);
- this.i915GemObjectSlice(ts, eventName, obj,
- {
- obj: obj,
- type: type,
- index: index
- });
- return true;
- },
-
- gemObjectDestroyEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /obj=(\w+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var obj = event[1];
- this.i915GemObjectSlice(ts, eventName, obj,
- {
- obj: obj
- });
- return true;
- },
-
- gemRingDispatchEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var dev = parseInt(event[1]);
- var ring = parseInt(event[2]);
- var seqno = parseInt(event[3]);
- this.i915GemRingSlice(ts, eventName, dev, ring,
- {
- dev: dev,
- ring: ring,
- seqno: seqno
- });
- return true;
- },
-
- gemRingFlushEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /dev=(\d+), ring=(\w+), invalidate=(\w+), flush=(\w+)/
- .exec(eventBase.details);
- if (!event)
- return false;
-
- var dev = parseInt(event[1]);
- var ring = parseInt(event[2]);
- var invalidate = event[3];
- var flush = event[4];
- this.i915GemRingSlice(ts, eventName, dev, ring,
- {
- dev: dev,
- ring: ring,
- invalidate: invalidate,
- flush: flush
- });
- return true;
- },
-
- gemRequestEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /dev=(\d+), ring=(\d+), seqno=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var dev = parseInt(event[1]);
- var ring = parseInt(event[2]);
- var seqno = parseInt(event[3]);
- this.i915GemRingSlice(ts, eventName, dev, ring,
- {
- dev: dev,
- ring: ring,
- seqno: seqno
- });
- return true;
- },
-
- gemRingWaitEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /dev=(\d+), ring=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var dev = parseInt(event[1]);
- var ring = parseInt(event[2]);
- this.i915GemRingSlice(ts, eventName, dev, ring,
- {
- dev: dev,
- ring: ring
- });
- return true;
- },
-
- regRWEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /(\w+) reg=(\w+), len=(\d+), val=(\(\w+, \w+\))/
- .exec(eventBase.details);
- if (!event)
- return false;
-
- var rw = event[1];
- var reg = event[2];
- var len = event[3];
- var data = event[3];
- this.i915RegSlice(ts, rw, reg,
- {
- rw: rw,
- reg: reg,
- len: len,
- data: data
- });
- return true;
- },
-
- flipEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /plane=(\d+), obj=(\w+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var plane = parseInt(event[1]);
- var obj = event[2];
- if (eventName == 'i915_flip_request')
- this.i915FlipOpenSlice(ts, obj, plane);
- else
- this.i915FlipCloseSlice(ts,
- {
- obj: obj,
- plane: plane
- });
- return true;
- },
-
- gpuFrequency: function(eventName, cpuNumver, pid, ts, eventBase) {
- var event = /new_freq=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
- var freq = parseInt(event[1]);
-
- this.i915FreqChangeSlice(ts, eventName, {
- freq: freq
- });
- return true;
- }
- };
-
- Parser.register(I915Parser);
-
- return {
- I915Parser: I915Parser
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/i915_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/i915_parser_test.html
deleted file mode 100644
index cc62910919f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/i915_parser_test.html
+++ /dev/null
@@ -1,105 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('i915Import', function() {
- var lines = [
- // NB: spliced from different traces; mismatched timestamps don't matter
- ' chrome-1223 [000] 2784.773556: i915_gem_object_pwrite: ' +
- 'obj=ffff88013f13fc00, offset=0, len=2984',
- ' chrome-1539 [000] 18420.677750: ' +
- 'i915_gem_object_change_domain: ' +
- 'obj=ffff8800a88d1400, read=44=>40, write=00=>40',
- ' chrome-1539 [000] 18420.677759: i915_gem_object_fault: ' +
- 'obj=ffff8800a88d1400, GTT index=0 , writable',
- ' X-964 [000] 2784.774864: i915_flip_request: ' +
- 'plane=0, obj=ffff88013f0b9a00',
- ' <idle>-0 [000] 2784.788644: i915_flip_complete: ' +
- 'plane=0, obj=ffff88013f0b9a00',
- ' chrome-1539 [001] 18420.681687: i915_gem_request_retire: ' +
- 'dev=0, ring=1, seqno=1178152',
- ' chrome-1539 [000] 18422.955688: i915_gem_request_add: ' +
- 'dev=0, ring=1, seqno=1178364',
- ' cat-21833 [000] 18422.956832: i915_gem_request_complete: ' +
- 'dev=0, ring=1, seqno=1178364',
- ' X-1012 [001] 18420.682511: i915_gem_request_wait_begin: ' +
- 'dev=0, ring=4, seqno=1178156',
- ' X-1012 [000] 18422.765707: i915_gem_request_wait_end: ' +
- 'dev=0, ring=4, seqno=1178359',
- ' chrome-1539 [000] 18422.955655: i915_gem_ring_flush: ' +
- 'dev=0, ring=1, invalidate=001e, flush=0040',
- ' chrome-1539 [000] 18422.955660: i915_gem_ring_dispatch: ' +
- 'dev=0, ring=1, seqno=1178364',
- ' chrome-1539 [000] 18420.677772: i915_reg_rw: ' +
- 'write reg=0x100030, len=8, val=(0xfca9001, 0xfce8007)',
- ' kworker/u16:2-13998 [005] 1577664.436065: ' +
- 'intel_gpu_freq_change: new_freq=350'
-
- ];
- var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shiftWorldToZero: false
- });
- assert.isFalse(m.hasImportWarnings);
-
- var i915GemThread = undefined;
- var i915FlipThread = undefined;
- var i915GemRingThread = undefined;
- var i915RegThread = undefined;
- var i915GpuFreqThread = undefined;
- m.getAllThreads().forEach(function(t) {
- switch (t.name) {
- case 'i915_gem':
- i915GemThread = t;
- break;
- case 'i915_flip':
- i915FlipThread = t;
- break;
- case 'i915_gem_ring':
- i915GemRingThread = t;
- break;
- case 'i915_reg':
- i915RegThread = t;
- break;
- case 'i915_gpu_freq':
- i915GpuFreqThread = t;
- break;
- default:
- throw new unittest.TestError('Unexpected thread named ' + t.name);
- }
- });
- assert.isDefined(i915GemThread);
- assert.isDefined(i915FlipThread);
- assert.isDefined(i915GemRingThread);
- assert.isDefined(i915RegThread);
- assert.isDefined(i915GpuFreqThread);
-
- assert.equal(i915GemThread.sliceGroup.length, 3);
-
- assert.equal(i915FlipThread.sliceGroup.length, 1);
-
- assert.closeTo(
- 2784.774864 * 1000.0,
- i915FlipThread.sliceGroup.slices[0].start,
- 1e-5);
- assert.closeTo(
- (2784.788644 - 2784.774864) * 1000.0,
- i915FlipThread.sliceGroup.slices[0].duration,
- 1e-5);
-
- assert.equal(i915GemRingThread.sliceGroup.length, 7);
- assert.equal(i915RegThread.sliceGroup.length, 1);
- assert.equal(i915GpuFreqThread.sliceGroup.length, 1);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/irq_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/irq_parser.html
deleted file mode 100644
index 24903ae3133..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/irq_parser.html
+++ /dev/null
@@ -1,184 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses drm driver events in the Linux event trace format.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
-
- var ColorScheme = tr.b.ColorScheme;
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses linux irq trace events.
- * @constructor
- */
- function IrqParser(importer) {
- Parser.call(this, importer);
-
- importer.registerEventHandler('irq_handler_entry',
- IrqParser.prototype.irqHandlerEntryEvent.bind(this));
- importer.registerEventHandler('irq_handler_exit',
- IrqParser.prototype.irqHandlerExitEvent.bind(this));
- importer.registerEventHandler('softirq_raise',
- IrqParser.prototype.softirqRaiseEvent.bind(this));
- importer.registerEventHandler('softirq_entry',
- IrqParser.prototype.softirqEntryEvent.bind(this));
- importer.registerEventHandler('softirq_exit',
- IrqParser.prototype.softirqExitEvent.bind(this));
- importer.registerEventHandler('ipi_entry',
- IrqParser.prototype.ipiEntryEvent.bind(this));
- importer.registerEventHandler('ipi_exit',
- IrqParser.prototype.ipiExitEvent.bind(this));
- }
-
- // Matches the irq_handler_entry record
- var irqHandlerEntryRE = /irq=(\d+) name=(.+)/;
-
- // Matches the irq_handler_exit record
- var irqHandlerExitRE = /irq=(\d+) ret=(.+)/;
-
- // Matches the softirq_raise record
- var softirqRE = /vec=(\d+) \[action=(.+)\]/;
-
- // Matches the ipi_exit_
- var ipiHandlerExitRE = /\((.+)\)/;
-
- IrqParser.prototype = {
- __proto__: Parser.prototype,
-
- /**
- * Parses irq events and sets up state in the mporter.
- */
- irqHandlerEntryEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = irqHandlerEntryRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var irq = parseInt(event[1]);
- var name = event[2];
-
- var thread = this.importer.getOrCreatePseudoThread(
- 'irqs cpu ' + cpuNumber);
- thread.lastEntryTs = ts;
- thread.irqName = name;
-
- return true;
- },
-
- irqHandlerExitEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = irqHandlerExitRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var irq = parseInt(event[1]);
- var ret = event[2];
- var thread = this.importer.getOrCreatePseudoThread(
- 'irqs cpu ' + cpuNumber);
-
- if (thread.lastEntryTs !== undefined) {
- var duration = ts - thread.lastEntryTs;
- var slice = new tr.model.Slice(
- '',
- 'IRQ (' + thread.irqName + ')',
- ColorScheme.getColorIdForGeneralPurposeString(event[1]),
- thread.lastEntryTs, { ret: ret },
- duration);
- thread.thread.sliceGroup.pushSlice(slice);
- }
- thread.lastEntryTs = undefined;
- thread.irqName = undefined;
- return true;
- },
-
- softirqRaiseEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- return true;
- },
-
- softirqEntryEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = softirqRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var action = event[2];
- var thread = this.importer.getOrCreatePseudoThread(
- 'softirq cpu ' + cpuNumber);
- thread.lastEntryTs = ts;
-
- return true;
- },
-
- softirqExitEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = softirqRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var vec = parseInt(event[1]);
- var action = event[2];
- var thread = this.importer.getOrCreatePseudoThread(
- 'softirq cpu ' + cpuNumber);
-
- if (thread.lastEntryTs !== undefined) {
- var duration = ts - thread.lastEntryTs;
- var slice = new tr.model.Slice(
- '', action,
- ColorScheme.getColorIdForGeneralPurposeString(event[1]),
- thread.lastEntryTs, { vec: vec },
- duration);
- thread.thread.sliceGroup.pushSlice(slice);
- }
- thread.lastEntryTs = undefined;
- return true;
- },
- /**
- * Parses ipi events and sets up state in the mporter.
- */
- ipiEntryEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var thread = this.importer.getOrCreatePseudoThread(
- 'irqs cpu ' + cpuNumber);
- thread.lastEntryTs = ts;
-
- return true;
- },
-
- ipiExitEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = ipiHandlerExitRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var ipiName = event[1];
- var thread = this.importer.getOrCreatePseudoThread(
- 'irqs cpu ' + cpuNumber);
-
- if (thread.lastEntryTs !== undefined) {
- var duration = ts - thread.lastEntryTs;
- var slice = new tr.model.Slice(
- '',
- 'IPI (' + ipiName + ')',
- ColorScheme.getColorIdForGeneralPurposeString(ipiName),
- thread.lastEntryTs,
- {},
- duration);
- thread.thread.sliceGroup.pushSlice(slice);
- }
- thread.lastEntryTs = undefined;
- return true;
- }
- };
-
- Parser.register(IrqParser);
-
- return {
- IrqParser: IrqParser
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/irq_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/irq_parser_test.html
deleted file mode 100644
index 647bd821e73..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/irq_parser_test.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('irqImport', function() {
- var lines = [
- ' kworker/u4:1-31907 (31907) [001] d.h3 14063.748288: ' +
- 'irq_handler_entry: irq=27 name=arch_timer',
- ' kworker/u4:1-31907 (31907) [001] dNh3 14063.748384: ' +
- 'irq_handler_exit: irq=27 ret=handled',
- ' kworker/u4:2-31908 (31908) [000] ..s3 14063.477231: ' +
- 'softirq_entry: vec=9 [action=RCU]',
- ' kworker/u4:2-31908 (31908) [000] ..s3 14063.477246: ' +
- 'softirq_exit: vec=9 [action=RCU]',
- ' RenderThread-2978 ( 2794) [002] dN.1 62828.421805: ' +
- 'ipi_entry: (Rescheduling interrupts)',
- ' RenderThread-2978 ( 2794) [002] dN.1 62828.421809: ' +
- 'ipi_exit: (Rescheduling interrupts)'
- ];
- var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shiftWorldToZero: false
- });
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 3);
-
- var threads = m.findAllThreadsNamed('irqs cpu 1');
- assert.equal(threads.length, 1);
- assert.equal(threads[0].sliceGroup.length, 1);
-
- var threads = m.findAllThreadsNamed('softirq cpu 0');
- assert.equal(threads.length, 1);
- assert.equal(threads[0].sliceGroup.length, 1);
-
- var threads = m.findAllThreadsNamed('irqs cpu 2');
- assert.equal(threads.length, 1);
- assert.equal(threads[0].sliceGroup.length, 1);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/kfunc_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/kfunc_parser.html
deleted file mode 100644
index 72dbc71e512..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/kfunc_parser.html
+++ /dev/null
@@ -1,113 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses graph_ent and graph_ret events that were inserted by
- * the Linux kernel's function graph trace.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
-
- var LinuxPerfParser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses graph_ent and graph_ret events that were inserted by the Linux
- * kernel's function graph trace.
- * @constructor
- */
- function KernelFuncParser(importer) {
- LinuxPerfParser.call(this, importer);
-
- importer.registerEventHandler('graph_ent',
- KernelFuncParser.prototype.traceKernelFuncEnterEvent.
- bind(this));
- importer.registerEventHandler('graph_ret',
- KernelFuncParser.prototype.traceKernelFuncReturnEvent.
- bind(this));
-
- this.model_ = importer.model_;
- this.ppids_ = {};
- }
-
- var TestExports = {};
-
- var funcEnterRE = new RegExp('func=(.+)');
- TestExports.funcEnterRE = funcEnterRE;
-
- KernelFuncParser.prototype = {
- __proto__: LinuxPerfParser.prototype,
-
- traceKernelFuncEnterEvent: function(eventName, cpuNumber, pid, ts,
- eventBase) {
- var eventData = funcEnterRE.exec(eventBase.details);
- if (!eventData)
- return false;
-
- if (eventBase.tgid === undefined) {
- return false;
- }
-
- var tgid = parseInt(eventBase.tgid);
- var name = eventData[1];
- var thread = this.model_.getOrCreateProcess(tgid)
- .getOrCreateThread(pid);
- thread.name = eventBase.threadName;
-
- var slices = thread.kernelSliceGroup;
- if (!slices.isTimestampValidForBeginOrEnd(ts)) {
- this.model_.importWarning({
- type: 'parse_error',
- message: 'Timestamps are moving backward.'
- });
- return false;
- }
-
- var slice = slices.beginSlice(null, name, ts, {});
-
- return true;
- },
-
- traceKernelFuncReturnEvent: function(eventName, cpuNumber, pid, ts,
- eventBase) {
- if (eventBase.tgid === undefined) {
- return false;
- }
-
- var tgid = parseInt(eventBase.tgid);
- var thread = this.model_.getOrCreateProcess(tgid)
- .getOrCreateThread(pid);
- thread.name = eventBase.threadName;
-
- var slices = thread.kernelSliceGroup;
- if (!slices.isTimestampValidForBeginOrEnd(ts)) {
- this.model_.importWarning({
- type: 'parse_error',
- message: 'Timestamps are moving backward.'
- });
- return false;
- }
-
- if (slices.openSliceCount > 0) {
- slices.endSlice(ts);
- }
-
- return true;
- }
- };
-
- LinuxPerfParser.register(KernelFuncParser);
-
- return {
- KernelFuncParser: KernelFuncParser
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/kfunc_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/kfunc_parser_test.html
deleted file mode 100644
index 5d7dfd67526..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/kfunc_parser_test.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('kernelFunctionParser', function() {
- var lines = [
- 'Binder_2-127 ( 127) [001] .... 3431.906759: graph_ent: func=sys_write',
- 'Binder_2-127 ( 127) [001] .... 3431.906769: graph_ret: func=sys_write',
- 'Binder_2-127 ( 127) [001] .... 3431.906785: graph_ent: func=sys_write',
- 'Binder_2-127 ( 127) [001] ...1 3431.906798: tracing_mark_write: B|' +
- '127|dequeueBuffer',
- 'Binder_2-127 ( 127) [001] .... 3431.906802: graph_ret: func=sys_write',
- 'Binder_2-127 ( 127) [001] .... 3431.906842: graph_ent: func=sys_write',
- 'Binder_2-127 ( 127) [001] ...1 3431.906849: tracing_mark_write: E',
- 'Binder_2-127 ( 127) [001] .... 3431.906853: graph_ret: func=sys_write',
- 'Binder_2-127 ( 127) [001] .... 3431.906896: graph_ent: func=sys_write',
- 'Binder_2-127 ( 127) [001] .... 3431.906906: graph_ret: func=sys_write'
- ];
- var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shiftWorldToZero: false
- });
- assert.isFalse(m.hasImportWarnings);
-
- var process = m.processes[127];
- assert.isDefined(process);
-
- var thread = process.threads[127];
- assert.isDefined(thread);
-
- var slices = thread.sliceGroup.slices;
- assert.equal(thread.sliceGroup.length, 7);
-
- // Slice 0 is an un-split sys_write
- assert.equal(slices[0].title, 'sys_write');
-
- // Slices 1 & 3 are a split sys_write
- assert.equal(slices[1].title, 'sys_write');
- assert.equal(slices[2].title, 'dequeueBuffer');
- assert.equal(slices[3].title, 'sys_write (cont.)');
-
- // Slices 4 & 5 are a split sys_write with the dequeueBuffer in between
- assert.equal(slices[4].title, 'sys_write');
- assert.equal(slices[5].title, 'sys_write (cont.)');
-
- // Slice 6 is another un-split sys_write
- assert.equal(slices[6].title, 'sys_write');
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/mali_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/mali_parser.html
deleted file mode 100644
index 0516805f740..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/mali_parser.html
+++ /dev/null
@@ -1,568 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses Mali DDK/kernel events in the Linux event trace format.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
-
- var ColorScheme = tr.b.ColorScheme;
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses Mali DDK/kernel trace events.
- * @constructor
- */
- function MaliParser(importer) {
- Parser.call(this, importer);
-
- // kernel DVFS events
- importer.registerEventHandler('mali_dvfs_event',
- MaliParser.prototype.dvfsEventEvent.bind(this));
- importer.registerEventHandler('mali_dvfs_set_clock',
- MaliParser.prototype.dvfsSetClockEvent.bind(this));
- importer.registerEventHandler('mali_dvfs_set_voltage',
- MaliParser.prototype.dvfsSetVoltageEvent.bind(this));
-
- // kernel Mali hw counter events
- this.addJMCounter('mali_hwc_MESSAGES_SENT', 'Messages Sent');
- this.addJMCounter('mali_hwc_MESSAGES_RECEIVED', 'Messages Received');
- this.addJMCycles('mali_hwc_GPU_ACTIVE', 'GPU Active');
- this.addJMCycles('mali_hwc_IRQ_ACTIVE', 'IRQ Active');
-
- for (var i = 0; i < 7; i++) {
- var jobStr = 'JS' + i;
- var jobHWCStr = 'mali_hwc_' + jobStr;
- this.addJMCounter(jobHWCStr + '_JOBS', jobStr + ' Jobs');
- this.addJMCounter(jobHWCStr + '_TASKS', jobStr + ' Tasks');
- this.addJMCycles(jobHWCStr + '_ACTIVE', jobStr + ' Active');
- this.addJMCycles(jobHWCStr + '_WAIT_READ', jobStr + ' Wait Read');
- this.addJMCycles(jobHWCStr + '_WAIT_ISSUE', jobStr + ' Wait Issue');
- this.addJMCycles(jobHWCStr + '_WAIT_DEPEND', jobStr + ' Wait Depend');
- this.addJMCycles(jobHWCStr + '_WAIT_FINISH', jobStr + ' Wait Finish');
- }
-
- this.addTilerCounter('mali_hwc_TRIANGLES', 'Triangles');
- this.addTilerCounter('mali_hwc_QUADS', 'Quads');
- this.addTilerCounter('mali_hwc_POLYGONS', 'Polygons');
- this.addTilerCounter('mali_hwc_POINTS', 'Points');
- this.addTilerCounter('mali_hwc_LINES', 'Lines');
- this.addTilerCounter('mali_hwc_VCACHE_HIT', 'VCache Hit');
- this.addTilerCounter('mali_hwc_VCACHE_MISS', 'VCache Miss');
- this.addTilerCounter('mali_hwc_FRONT_FACING', 'Front Facing');
- this.addTilerCounter('mali_hwc_BACK_FACING', 'Back Facing');
- this.addTilerCounter('mali_hwc_PRIM_VISIBLE', 'Prim Visible');
- this.addTilerCounter('mali_hwc_PRIM_CULLED', 'Prim Culled');
- this.addTilerCounter('mali_hwc_PRIM_CLIPPED', 'Prim Clipped');
-
- this.addTilerCounter('mali_hwc_WRBUF_HIT', 'Wrbuf Hit');
- this.addTilerCounter('mali_hwc_WRBUF_MISS', 'Wrbuf Miss');
- this.addTilerCounter('mali_hwc_WRBUF_LINE', 'Wrbuf Line');
- this.addTilerCounter('mali_hwc_WRBUF_PARTIAL', 'Wrbuf Partial');
- this.addTilerCounter('mali_hwc_WRBUF_STALL', 'Wrbuf Stall');
-
- this.addTilerCycles('mali_hwc_ACTIVE', 'Tiler Active');
- this.addTilerCycles('mali_hwc_INDEX_WAIT', 'Index Wait');
- this.addTilerCycles('mali_hwc_INDEX_RANGE_WAIT', 'Index Range Wait');
- this.addTilerCycles('mali_hwc_VERTEX_WAIT', 'Vertex Wait');
- this.addTilerCycles('mali_hwc_PCACHE_WAIT', 'Pcache Wait');
- this.addTilerCycles('mali_hwc_WRBUF_WAIT', 'Wrbuf Wait');
- this.addTilerCycles('mali_hwc_BUS_READ', 'Bus Read');
- this.addTilerCycles('mali_hwc_BUS_WRITE', 'Bus Write');
-
- this.addTilerCycles('mali_hwc_TILER_UTLB_STALL', 'Tiler UTLB Stall');
- this.addTilerCycles('mali_hwc_TILER_UTLB_HIT', 'Tiler UTLB Hit');
-
- this.addFragCycles('mali_hwc_FRAG_ACTIVE', 'Active');
- /* NB: don't propagate spelling mistakes to labels */
- this.addFragCounter('mali_hwc_FRAG_PRIMATIVES', 'Primitives');
- this.addFragCounter('mali_hwc_FRAG_PRIMATIVES_DROPPED',
- 'Primitives Dropped');
- this.addFragCycles('mali_hwc_FRAG_CYCLE_DESC', 'Descriptor Processing');
- this.addFragCycles('mali_hwc_FRAG_CYCLES_PLR', 'PLR Processing??');
- this.addFragCycles('mali_hwc_FRAG_CYCLES_VERT', 'Vertex Processing');
- this.addFragCycles('mali_hwc_FRAG_CYCLES_TRISETUP', 'Triangle Setup');
- this.addFragCycles('mali_hwc_FRAG_CYCLES_RAST', 'Rasterization???');
- this.addFragCounter('mali_hwc_FRAG_THREADS', 'Threads');
- this.addFragCounter('mali_hwc_FRAG_DUMMY_THREADS', 'Dummy Threads');
- this.addFragCounter('mali_hwc_FRAG_QUADS_RAST', 'Quads Rast');
- this.addFragCounter('mali_hwc_FRAG_QUADS_EZS_TEST', 'Quads EZS Test');
- this.addFragCounter('mali_hwc_FRAG_QUADS_EZS_KILLED', 'Quads EZS Killed');
- this.addFragCounter('mali_hwc_FRAG_QUADS_LZS_TEST', 'Quads LZS Test');
- this.addFragCounter('mali_hwc_FRAG_QUADS_LZS_KILLED', 'Quads LZS Killed');
- this.addFragCycles('mali_hwc_FRAG_CYCLE_NO_TILE', 'No Tiles');
- this.addFragCounter('mali_hwc_FRAG_NUM_TILES', 'Tiles');
- this.addFragCounter('mali_hwc_FRAG_TRANS_ELIM', 'Transactions Eliminated');
-
- this.addComputeCycles('mali_hwc_COMPUTE_ACTIVE', 'Active');
- this.addComputeCounter('mali_hwc_COMPUTE_TASKS', 'Tasks');
- this.addComputeCounter('mali_hwc_COMPUTE_THREADS', 'Threads Started');
- this.addComputeCycles('mali_hwc_COMPUTE_CYCLES_DESC',
- 'Waiting for Descriptors');
-
- this.addTripipeCycles('mali_hwc_TRIPIPE_ACTIVE', 'Active');
-
- this.addArithCounter('mali_hwc_ARITH_WORDS', 'Instructions (/Pipes)');
- this.addArithCycles('mali_hwc_ARITH_CYCLES_REG',
- 'Reg scheduling stalls (/Pipes)');
- this.addArithCycles('mali_hwc_ARITH_CYCLES_L0',
- 'L0 cache miss stalls (/Pipes)');
- this.addArithCounter('mali_hwc_ARITH_FRAG_DEPEND',
- 'Frag dep check failures (/Pipes)');
-
- this.addLSCounter('mali_hwc_LS_WORDS', 'Instruction Words Completed');
- this.addLSCounter('mali_hwc_LS_ISSUES', 'Full Pipeline Issues');
- this.addLSCounter('mali_hwc_LS_RESTARTS', 'Restarts (unpairable insts)');
- this.addLSCounter('mali_hwc_LS_REISSUES_MISS',
- 'Pipeline reissue (cache miss/uTLB)');
- this.addLSCounter('mali_hwc_LS_REISSUES_VD',
- 'Pipeline reissue (varying data)');
- /* TODO(sleffler) fix kernel event typo */
- this.addLSCounter('mali_hwc_LS_REISSUE_ATTRIB_MISS',
- 'Pipeline reissue (attribute cache miss)');
- this.addLSCounter('mali_hwc_LS_REISSUE_NO_WB', 'Writeback not used');
-
- this.addTexCounter('mali_hwc_TEX_WORDS', 'Words');
- this.addTexCounter('mali_hwc_TEX_BUBBLES', 'Bubbles');
- this.addTexCounter('mali_hwc_TEX_WORDS_L0', 'Words L0');
- this.addTexCounter('mali_hwc_TEX_WORDS_DESC', 'Words Desc');
- this.addTexCounter('mali_hwc_TEX_THREADS', 'Threads');
- this.addTexCounter('mali_hwc_TEX_RECIRC_FMISS', 'Recirc due to Full Miss');
- this.addTexCounter('mali_hwc_TEX_RECIRC_DESC', 'Recirc due to Desc Miss');
- this.addTexCounter('mali_hwc_TEX_RECIRC_MULTI', 'Recirc due to Multipass');
- this.addTexCounter('mali_hwc_TEX_RECIRC_PMISS',
- 'Recirc due to Partial Cache Miss');
- this.addTexCounter('mali_hwc_TEX_RECIRC_CONF',
- 'Recirc due to Cache Conflict');
-
- this.addLSCCounter('mali_hwc_LSC_READ_HITS', 'Read Hits');
- this.addLSCCounter('mali_hwc_LSC_READ_MISSES', 'Read Misses');
- this.addLSCCounter('mali_hwc_LSC_WRITE_HITS', 'Write Hits');
- this.addLSCCounter('mali_hwc_LSC_WRITE_MISSES', 'Write Misses');
- this.addLSCCounter('mali_hwc_LSC_ATOMIC_HITS', 'Atomic Hits');
- this.addLSCCounter('mali_hwc_LSC_ATOMIC_MISSES', 'Atomic Misses');
- this.addLSCCounter('mali_hwc_LSC_LINE_FETCHES', 'Line Fetches');
- this.addLSCCounter('mali_hwc_LSC_DIRTY_LINE', 'Dirty Lines');
- this.addLSCCounter('mali_hwc_LSC_SNOOPS', 'Snoops');
-
- this.addAXICounter('mali_hwc_AXI_TLB_STALL', 'Address channel stall');
- this.addAXICounter('mali_hwc_AXI_TLB_MISS', 'Cache Miss');
- this.addAXICounter('mali_hwc_AXI_TLB_TRANSACTION', 'Transactions');
- this.addAXICounter('mali_hwc_LS_TLB_MISS', 'LS Cache Miss');
- this.addAXICounter('mali_hwc_LS_TLB_HIT', 'LS Cache Hit');
- this.addAXICounter('mali_hwc_AXI_BEATS_READ', 'Read Beats');
- this.addAXICounter('mali_hwc_AXI_BEATS_WRITE', 'Write Beats');
-
- this.addMMUCounter('mali_hwc_MMU_TABLE_WALK', 'Page Table Walks');
- this.addMMUCounter('mali_hwc_MMU_REPLAY_MISS',
- 'Cache Miss from Replay Buffer');
- this.addMMUCounter('mali_hwc_MMU_REPLAY_FULL', 'Replay Buffer Full');
- this.addMMUCounter('mali_hwc_MMU_NEW_MISS', 'Cache Miss on New Request');
- this.addMMUCounter('mali_hwc_MMU_HIT', 'Cache Hit');
-
- this.addMMUCycles('mali_hwc_UTLB_STALL', 'UTLB Stalled');
- this.addMMUCycles('mali_hwc_UTLB_REPLAY_MISS', 'UTLB Replay Miss');
- this.addMMUCycles('mali_hwc_UTLB_REPLAY_FULL', 'UTLB Replay Full');
- this.addMMUCycles('mali_hwc_UTLB_NEW_MISS', 'UTLB New Miss');
- this.addMMUCycles('mali_hwc_UTLB_HIT', 'UTLB Hit');
-
- this.addL2Counter('mali_hwc_L2_READ_BEATS', 'Read Beats');
- this.addL2Counter('mali_hwc_L2_WRITE_BEATS', 'Write Beats');
- this.addL2Counter('mali_hwc_L2_ANY_LOOKUP', 'Any Lookup');
- this.addL2Counter('mali_hwc_L2_READ_LOOKUP', 'Read Lookup');
- this.addL2Counter('mali_hwc_L2_SREAD_LOOKUP', 'Shareable Read Lookup');
- this.addL2Counter('mali_hwc_L2_READ_REPLAY', 'Read Replayed');
- this.addL2Counter('mali_hwc_L2_READ_SNOOP', 'Read Snoop');
- this.addL2Counter('mali_hwc_L2_READ_HIT', 'Read Cache Hit');
- this.addL2Counter('mali_hwc_L2_CLEAN_MISS', 'CleanUnique Miss');
- this.addL2Counter('mali_hwc_L2_WRITE_LOOKUP', 'Write Lookup');
- this.addL2Counter('mali_hwc_L2_SWRITE_LOOKUP', 'Shareable Write Lookup');
- this.addL2Counter('mali_hwc_L2_WRITE_REPLAY', 'Write Replayed');
- this.addL2Counter('mali_hwc_L2_WRITE_SNOOP', 'Write Snoop');
- this.addL2Counter('mali_hwc_L2_WRITE_HIT', 'Write Cache Hit');
- this.addL2Counter('mali_hwc_L2_EXT_READ_FULL', 'ExtRD with BIU Full');
- this.addL2Counter('mali_hwc_L2_EXT_READ_HALF', 'ExtRD with BIU >1/2 Full');
- this.addL2Counter('mali_hwc_L2_EXT_WRITE_FULL', 'ExtWR with BIU Full');
- this.addL2Counter('mali_hwc_L2_EXT_WRITE_HALF', 'ExtWR with BIU >1/2 Full');
-
- this.addL2Counter('mali_hwc_L2_EXT_READ', 'External Read (ExtRD)');
- this.addL2Counter('mali_hwc_L2_EXT_READ_LINE', 'ExtRD (linefill)');
- this.addL2Counter('mali_hwc_L2_EXT_WRITE', 'External Write (ExtWR)');
- this.addL2Counter('mali_hwc_L2_EXT_WRITE_LINE', 'ExtWR (linefill)');
- this.addL2Counter('mali_hwc_L2_EXT_WRITE_SMALL', 'ExtWR (burst size <64B)');
- this.addL2Counter('mali_hwc_L2_EXT_BARRIER', 'External Barrier');
- this.addL2Counter('mali_hwc_L2_EXT_AR_STALL', 'Address Read stalls');
- this.addL2Counter('mali_hwc_L2_EXT_R_BUF_FULL',
- 'Response Buffer full stalls');
- this.addL2Counter('mali_hwc_L2_EXT_RD_BUF_FULL',
- 'Read Data Buffer full stalls');
- this.addL2Counter('mali_hwc_L2_EXT_R_RAW', 'RAW hazard stalls');
- this.addL2Counter('mali_hwc_L2_EXT_W_STALL', 'Write Data stalls');
- this.addL2Counter('mali_hwc_L2_EXT_W_BUF_FULL', 'Write Data Buffer full');
- this.addL2Counter('mali_hwc_L2_EXT_R_W_HAZARD', 'WAW or WAR hazard stalls');
- this.addL2Counter('mali_hwc_L2_TAG_HAZARD', 'Tag hazard replays');
- this.addL2Cycles('mali_hwc_L2_SNOOP_FULL', 'Snoop buffer full');
- this.addL2Cycles('mali_hwc_L2_REPLAY_FULL', 'Replay buffer full');
-
- // DDK events (from X server)
- importer.registerEventHandler('tracing_mark_write:mali_driver',
- MaliParser.prototype.maliDDKEvent.bind(this));
-
- this.model_ = importer.model_;
- }
-
- MaliParser.prototype = {
- __proto__: Parser.prototype,
-
- maliDDKOpenSlice: function(pid, tid, ts, func, blockinfo) {
- var thread = this.importer.model_.getOrCreateProcess(pid)
- .getOrCreateThread(tid);
- var funcArgs = /^([\w\d_]*)(?:\(\))?:?\s*(.*)$/.exec(func);
- thread.sliceGroup.beginSlice('gpu-driver', funcArgs[1], ts,
- { 'args': funcArgs[2],
- 'blockinfo': blockinfo });
- },
-
- maliDDKCloseSlice: function(pid, tid, ts, args, blockinfo) {
- var thread = this.importer.model_.getOrCreateProcess(pid)
- .getOrCreateThread(tid);
- if (!thread.sliceGroup.openSliceCount) {
- // Discard unmatched ends.
- return;
- }
- thread.sliceGroup.endSlice(ts);
- },
-
- /**
- * Deduce the format of Mali perf events.
- *
- * @return {RegExp} the regular expression for parsing data when the format
- * is recognized; otherwise null.
- */
- autoDetectLineRE: function(line) {
- // Matches Mali perf events with thread info
- var lineREWithThread =
- /^\s*\(([\w\-]*)\)\s*(\w+):\s*([\w\\\/\.\-]*@\d*):?\s*(.*)$/;
- if (lineREWithThread.test(line))
- return lineREWithThread;
-
- // Matches old-style Mali perf events
- var lineRENoThread = /^s*()(\w+):\s*([\w\\\/.\-]*):?\s*(.*)$/;
- if (lineRENoThread.test(line))
- return lineRENoThread;
- return null;
- },
-
- lineRE: null,
-
- /**
- * Parses maliDDK events and sets up state in the importer.
- * events will come in pairs with a cros_trace_print_enter
- * like this (line broken here for formatting):
- *
- * tracing_mark_write: mali_driver: (mali-012345) cros_trace_print_enter: \
- * gles/src/texture/mali_gles_texture_slave.c@1505: gles2_texturep_upload
- *
- * and a cros_trace_print_exit like this:
- *
- * tracing_mark_write: mali_driver: (mali-012345) cros_trace_print_exit: \
- * gles/src/texture/mali_gles_texture_slave.c@1505:
- */
- maliDDKEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- if (this.lineRE == null) {
- this.lineRE = this.autoDetectLineRE(eventBase.details);
- if (this.lineRE == null)
- return false;
- }
- var maliEvent = this.lineRE.exec(eventBase.details);
- // Old-style Mali perf events have no thread id, so make one.
- var tid = (maliEvent[1] === '' ? 'mali' : maliEvent[1]);
- switch (maliEvent[2]) {
- case 'cros_trace_print_enter':
- this.maliDDKOpenSlice(pid, tid, ts, maliEvent[4],
- maliEvent[3]);
- break;
- case 'cros_trace_print_exit':
- this.maliDDKCloseSlice(pid, tid, ts, [], maliEvent[3]);
- }
- return true;
- },
-
- /*
- * Kernel event support.
- */
-
- dvfsSample: function(counterName, seriesName, ts, s) {
- var value = parseInt(s);
- var counter = this.model_.kernel.
- getOrCreateCounter('DVFS', counterName);
- if (counter.numSeries === 0) {
- counter.addSeries(new tr.model.CounterSeries(seriesName,
- ColorScheme.getColorIdForGeneralPurposeString(counter.name)));
- }
- counter.series.forEach(function(series) {
- series.addCounterSample(ts, value);
- });
- },
-
- dvfsEventEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /utilization=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- this.dvfsSample('DVFS Utilization', 'utilization', ts, event[1]);
- return true;
- },
-
- dvfsSetClockEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /frequency=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- this.dvfsSample('DVFS Frequency', 'frequency', ts, event[1]);
- return true;
- },
-
- dvfsSetVoltageEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /voltage=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- this.dvfsSample('DVFS Voltage', 'voltage', ts, event[1]);
- return true;
- },
-
- hwcSample: function(cat, counterName, seriesName, ts, eventBase) {
- var event = /val=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
- var value = parseInt(event[1]);
-
- var counter = this.model_.kernel.
- getOrCreateCounter(cat, counterName);
- if (counter.numSeries === 0) {
- counter.addSeries(new tr.model.CounterSeries(seriesName,
- ColorScheme.getColorIdForGeneralPurposeString(counter.name)));
- }
- counter.series.forEach(function(series) {
- series.addCounterSample(ts, value);
- });
- return true;
- },
-
- /*
- * Job Manager block counters.
- */
- jmSample: function(ctrName, seriesName, ts, eventBase) {
- return this.hwcSample('mali:jm', 'JM: ' + ctrName, seriesName, ts,
- eventBase);
- },
- addJMCounter: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.jmSample(hwcTitle, 'count', ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
- addJMCycles: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.jmSample(hwcTitle, 'cycles', ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
-
- /*
- * Tiler block counters.
- */
- tilerSample: function(ctrName, seriesName, ts, eventBase) {
- return this.hwcSample('mali:tiler', 'Tiler: ' + ctrName, seriesName,
- ts, eventBase);
- },
- addTilerCounter: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.tilerSample(hwcTitle, 'count', ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
- addTilerCycles: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.tilerSample(hwcTitle, 'cycles', ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
-
- /*
- * Fragment counters.
- */
- fragSample: function(ctrName, seriesName, ts, eventBase) {
- return this.hwcSample('mali:fragment', 'Fragment: ' + ctrName,
- seriesName, ts, eventBase);
- },
- addFragCounter: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.fragSample(hwcTitle, 'count', ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
- addFragCycles: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.fragSample(hwcTitle, 'cycles', ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
-
- /*
- * Compute counters.
- */
- computeSample: function(ctrName, seriesName, ts, eventBase) {
- return this.hwcSample('mali:compute', 'Compute: ' + ctrName,
- seriesName, ts, eventBase);
- },
- addComputeCounter: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.computeSample(hwcTitle, 'count', ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
- addComputeCycles: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.computeSample(hwcTitle, 'cycles', ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
-
- /*
- * Tripipe counters.
- */
- addTripipeCycles: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.hwcSample('mali:shader', 'Tripipe: ' + hwcTitle, 'cycles',
- ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
-
- /*
- * Arith counters.
- */
- arithSample: function(ctrName, seriesName, ts, eventBase) {
- return this.hwcSample('mali:arith', 'Arith: ' + ctrName, seriesName, ts,
- eventBase);
- },
- addArithCounter: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.arithSample(hwcTitle, 'count', ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
- addArithCycles: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.arithSample(hwcTitle, 'cycles', ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
-
- /*
- * Load/Store counters.
- */
- addLSCounter: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.hwcSample('mali:ls', 'LS: ' + hwcTitle, 'count', ts,
- eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
-
- /*
- * Texture counters.
- */
- textureSample: function(ctrName, seriesName, ts, eventBase) {
- return this.hwcSample('mali:texture', 'Texture: ' + ctrName,
- seriesName, ts, eventBase);
- },
- addTexCounter: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.textureSample(hwcTitle, 'count', ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
-
- /*
- * LSC counters.
- */
- addLSCCounter: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.hwcSample('mali:lsc', 'LSC: ' + hwcTitle, 'count', ts,
- eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
-
- /*
- * TLB counters.
- */
- addAXICounter: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.hwcSample('mali:axi', 'AXI: ' + hwcTitle, 'count', ts,
- eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
-
- /*
- * MMU counters.
- */
- mmuSample: function(ctrName, seriesName, ts, eventBase) {
- return this.hwcSample('mali:mmu', 'MMU: ' + ctrName, seriesName, ts,
- eventBase);
- },
- addMMUCounter: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.mmuSample(hwcTitle, 'count', ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
- addMMUCycles: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.mmuSample(hwcTitle, 'cycles', ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
-
- /*
- * L2 counters.
- */
- l2Sample: function(ctrName, seriesName, ts, eventBase) {
- return this.hwcSample('mali:l2', 'L2: ' + ctrName, seriesName, ts,
- eventBase);
- },
- addL2Counter: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.l2Sample(hwcTitle, 'count', ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- },
- addL2Cycles: function(hwcEventName, hwcTitle) {
- function handler(eventName, cpuNumber, pid, ts, eventBase) {
- return this.l2Sample(hwcTitle, 'cycles', ts, eventBase);
- }
- this.importer.registerEventHandler(hwcEventName, handler.bind(this));
- }
- };
-
- Parser.register(MaliParser);
-
- return {
- MaliParser: MaliParser
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/mali_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/mali_parser_test.html
deleted file mode 100644
index be19c73896f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/mali_parser_test.html
+++ /dev/null
@@ -1,485 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function newModel(events) {
- return tr.c.TestUtils.newModelWithEvents([events], {
- shiftWorldToZero: false
- });
- }
-
- test('maliDDKImport', function() {
- var linesNoThread = [
- // Row 1 open
- ' chrome-1780 [001] ...1 28.562633: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_enter: ' +
- 'gles/src/dispatch/mali_gles_dispatch_entrypoints.c992: ' +
- 'glTexSubImage2D',
- // Row 2 open
- ' chrome-1780 [001] ...1 28.562655: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_enter: ' +
- 'gles/src/texture/mali_gles_texture_api.c996: ' +
- 'gles_texture_tex_sub_image_2d',
- // Row 3 open
- ' chrome-1780 [001] ...1 28.562671: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_enter: ' +
- 'gles/src/texture/mali_gles_texture_slave.c295: ' +
- 'gles_texturep_slave_map_master',
- // Row 3 close
- ' chrome-1780 [001] ...1 28.562684: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_exit: ' +
- 'gles/src/texture/mali_gles_texture_slave.c295: ',
- // Row 3 open
- ' chrome-1780 [001] ...1 28.562700: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_enter: ' +
- 'gles/src/texture/mali_gles_texture_slave.c1505: ' +
- 'gles2_texturep_upload_2d',
- // Row 4 open
- ' chrome-1780 [001] ...1 28.562726: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_enter: ' +
- 'gles/src/texture/mali_gles_texture_slave.c1612: ' +
- 'gles2_texturep_upload_2d: pixel array: wait for dependencies',
- // Row 5 open
- ' chrome-1780 [001] ...1 28.562742: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_enter: ' +
- 'cobj/src/mali_cobj_surface_operations.c1693: ' +
- 'cobj_convert_pixels_to_surface',
- // Row 6 open
- ' chrome-1780 [001] ...1 28.562776: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_enter: ' +
- 'cobj/src/mali_cobj_surface_operations.c1461: ' +
- 'cobj_convert_pixels',
- // Row 7 open
- ' chrome-1780 [001] ...1 28.562791: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_enter: ' +
- 'cobj/src/mali_cobj_surface_operations.c1505: ' +
- 'cobj_convert_pixels: fast-path linear copy',
- // Row 8 open
- ' chrome-1780 [001] ...1 28.562808: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_enter: ' +
- 'cobj/src/mali_cobj_surface_operations.c1511: ' +
- 'cobj_convert_pixels: reorder-only',
- // Row 8 close
- ' chrome-1780 [001] ...1 28.563383: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_exit: ' +
- 'cobj/src/mali_cobj_surface_operations.c1511',
- // Row 7 close
- ' chrome-1780 [001] ...1 28.563397: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_exit: ' +
- 'cobj/src/mali_cobj_surface_operations.c1505',
- // Row 6 close
- ' chrome-1780 [001] ...1 28.563409: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_exit: ' +
- 'cobj/src/mali_cobj_surface_operations.c1461',
- // Row 5 close
- ' chrome-1780 [001] ...1 28.563438: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_exit: ' +
- 'cobj/src/mali_cobj_surface_operations.c1693',
- // Row 4 close
- ' chrome-1780 [001] ...1 28.563451: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_exit: ' +
- 'gles/src/texture/mali_gles_texture_slave.c1612',
- // Row 3 close
- ' chrome-1780 [001] ...1 28.563462: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_exit: ' +
- 'gles/src/texture/mali_gles_texture_slave.c1505',
- // Row 2 close
- ' chrome-1780 [001] ...1 28.563475: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_exit: ' +
- 'gles/src/texture/mali_gles_texture_api.c996',
- // Row 1 close
- ' chrome-1780 [001] ...1 28.563486: tracing_mark_write: ' +
- 'mali_driver: cros_trace_print_exit: ' +
- 'gles/src/dispatch/mali_gles_dispatch_entrypoints.c992'
- ];
-
- var linesWithThread = [
- // Row 1 open
- ' chrome-1780 [001] ...1 28.562633: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' +
- 'gles/src/dispatch/mali_gles_dispatch_entrypoints.c@992: ' +
- 'glTexSubImage2D',
- // Row 2 open
- ' chrome-1780 [001] ...1 28.562655: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' +
- 'gles/src/texture/mali_gles_texture_api.c@996: ' +
- 'gles_texture_tex_sub_image_2d',
- // Row 3 open
- ' chrome-1780 [001] ...1 28.562671: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' +
- 'gles/src/texture/mali_gles_texture_slave.c@295: ' +
- 'gles_texturep_slave_map_master',
- // Row 3 close
- ' chrome-1780 [001] ...1 28.562684: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' +
- 'gles/src/texture/mali_gles_texture_slave.c@295: ',
- // Row 3 open
- ' chrome-1780 [001] ...1 28.562700: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' +
- 'gles/src/texture/mali_gles_texture_slave.c@1505: ' +
- 'gles2_texturep_upload_2d',
- // Row 4 open
- ' chrome-1780 [001] ...1 28.562726: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' +
- 'gles/src/texture/mali_gles_texture_slave.c@1612: ' +
- 'gles2_texturep_upload_2d: pixel array: wait for dependencies',
- // Row 5 open
- ' chrome-1780 [001] ...1 28.562742: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' +
- 'cobj/src/mali_cobj_surface_operations.c@1693: ' +
- 'cobj_convert_pixels_to_surface',
- // Row 6 open
- ' chrome-1780 [001] ...1 28.562776: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' +
- 'cobj/src/mali_cobj_surface_operations.c@1461: ' +
- 'cobj_convert_pixels',
- // Row 7 open
- ' chrome-1780 [001] ...1 28.562791: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' +
- 'cobj/src/mali_cobj_surface_operations.c@1505: ' +
- 'cobj_convert_pixels: fast-path linear copy',
- // Row 8 open
- ' chrome-1780 [001] ...1 28.562808: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_enter: ' +
- 'cobj/src/mali_cobj_surface_operations.c@1511: ' +
- 'cobj_convert_pixels: reorder-only',
- // Row 8 close
- ' chrome-1780 [001] ...1 28.563383: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' +
- 'cobj/src/mali_cobj_surface_operations.c@1511',
- // Row 7 close
- ' chrome-1780 [001] ...1 28.563397: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' +
- 'cobj/src/mali_cobj_surface_operations.c@1505',
- // Row 6 close
- ' chrome-1780 [001] ...1 28.563409: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' +
- 'cobj/src/mali_cobj_surface_operations.c@1461',
- // Row 5 close
- ' chrome-1780 [001] ...1 28.563438: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' +
- 'cobj/src/mali_cobj_surface_operations.c@1693',
- // Row 4 close
- ' chrome-1780 [001] ...1 28.563451: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' +
- 'gles/src/texture/mali_gles_texture_slave.c@1612',
- // Row 3 close
- ' chrome-1780 [001] ...1 28.563462: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' +
- 'gles/src/texture/mali_gles_texture_slave.c@1505',
- // Row 2 close
- ' chrome-1780 [001] ...1 28.563475: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' +
- 'gles/src/texture/mali_gles_texture_api.c@996',
- // Row 1 close
- ' chrome-1780 [001] ...1 28.563486: tracing_mark_write: ' +
- 'mali_driver: (mali-1878934320) cros_trace_print_exit: ' +
- 'gles/src/dispatch/mali_gles_dispatch_entrypoints.c@992'
- ];
- var traceNoThread = newModel(linesNoThread.join('\n'));
- var traceWithThread = newModel(linesWithThread.join('\n'));
- assert.isFalse(traceNoThread.hasImportWarnings);
- assert.isFalse(traceWithThread.hasImportWarnings);
-
- var threadsNoThread = traceNoThread.getAllThreads();
- var threadsWithThread = traceWithThread.getAllThreads();
- assert.equal(threadsNoThread.length, 1);
- assert.equal(threadsWithThread.length, 1);
-
- var maliThreadNoThread = threadsNoThread[0];
- var maliThreadWithThread = threadsWithThread[0];
- assert.equal(maliThreadNoThread.tid, 'mali');
- assert.equal(maliThreadWithThread.tid, 'mali-1878934320');
- assert.equal(maliThreadNoThread.sliceGroup.length, 9);
- assert.equal(maliThreadWithThread.sliceGroup.length, 9);
- });
-
- test('DVFSFrequencyImport', function() {
- var lines = [
- ' kworker/u:0-5 [001] .... 1174.839552: mali_dvfs_set_clock: ' +
- 'frequency=266',
- ' kworker/u:0-5 [000] .... 1183.840486: mali_dvfs_set_clock: ' +
- 'frequency=400'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var counters = m.getAllCounters();
- assert.equal(counters.length, 1);
-
- var c0 = counters[0];
- assert.equal(c0.name, 'DVFS Frequency');
- assert.equal(c0.series[0].samples.length, 2);
- });
-
- test('DVFSVoltageImport', function() {
- var lines = [
- ' kworker/u:0-5 [001] .... 1174.839562: mali_dvfs_set_voltage: ' +
- 'voltage=937500',
- ' kworker/u:0-5 [000] .... 1183.840009: mali_dvfs_set_voltage: ' +
- 'voltage=1100000'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var counters = m.getAllCounters();
- assert.equal(counters.length, 1);
-
- var c0 = counters[0];
- assert.equal(c0.name, 'DVFS Voltage');
- assert.equal(c0.series[0].samples.length, 2);
- });
-
- test('DVFSUtilizationImport', function() {
- var lines = [
- ' kworker/u:0-5 [001] .... 1174.839552: mali_dvfs_event: ' +
- 'utilization=7',
- ' kworker/u:0-5 [000] .... 1183.840486: mali_dvfs_event: ' +
- 'utilization=37'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var counters = m.getAllCounters();
- assert.equal(counters.length, 1);
-
- var c0 = counters[0];
- assert.equal(c0.name, 'DVFS Utilization');
- assert.equal(c0.series[0].samples.length, 2);
- });
-
- test('maliHWCImport', function() {
- var lines = [
- ' kworker/u:0-5 [000] .... 78.896588: ' +
- 'mali_hwc_ACTIVE: val=238',
- ' kworker/u:0-5 [000] .... 79.046889: ' +
- 'mali_hwc_ARITH_CYCLES_L0: val=1967',
- ' kworker/u:0-5 [000] .... 79.046888: ' +
- 'mali_hwc_ARITH_CYCLES_REG: val=136',
- ' kworker/u:0-5 [000] .... 79.046890: ' +
- 'mali_hwc_ARITH_FRAG_DEPEND: val=19676',
- ' kworker/u:0-5 [000] .... 79.046886: ' +
- 'mali_hwc_ARITH_WORDS: val=255543',
- ' kworker/u:0-5 [000] .... 79.046920: ' +
- 'mali_hwc_AXI_BEATS_READ: val=257053',
- ' kworker/u:0-5 [000] .... 78.896594: ' +
- 'mali_hwc_AXI_TLB_STALL: val=1',
- ' kworker/u:0-5 [000] .... 78.946646: ' +
- 'mali_hwc_AXI_TLB_TRANSACTION: val=4',
- ' kworker/u:0-5 [000] .... 79.046853: ' +
- 'mali_hwc_BACK_FACING: val=104',
- ' kworker/u:0-5 [000] .... 79.046880: ' +
- 'mali_hwc_COMPUTE_ACTIVE: val=17462',
- ' kworker/u:0-5 [000] .... 79.046884: ' +
- 'mali_hwc_COMPUTE_CYCLES_DESC: val=3933',
- ' kworker/u:0-5 [000] .... 79.046881: ' +
- 'mali_hwc_COMPUTE_TASKS: val=15',
- ' kworker/u:0-5 [000] .... 79.046883: ' +
- 'mali_hwc_COMPUTE_THREADS: val=60',
- ' kworker/u:0-5 [000] .... 79.046860: ' +
- 'mali_hwc_FRAG_ACTIVE: val=690986',
- ' kworker/u:0-5 [000] .... 79.046864: ' +
- 'mali_hwc_FRAG_CYCLE_DESC: val=13980',
- ' kworker/u:0-5 [000] .... 79.046876: ' +
- 'mali_hwc_FRAG_CYCLE_NO_TILE: val=3539',
- ' kworker/u:0-5 [000] .... 79.046865: ' +
- 'mali_hwc_FRAG_CYCLES_PLR: val=1499',
- ' kworker/u:0-5 [000] .... 79.046869: ' +
- 'mali_hwc_FRAG_CYCLES_RAST: val=1999',
- ' kworker/u:0-5 [000] .... 79.046868: ' +
- 'mali_hwc_FRAG_CYCLES_TRISETUP: val=22353',
- ' kworker/u:0-5 [000] .... 79.046867: ' +
- 'mali_hwc_FRAG_CYCLES_VERT: val=20763',
- ' kworker/u:0-5 [000] .... 79.046872: ' +
- 'mali_hwc_FRAG_DUMMY_THREADS: val=1968',
- ' kworker/u:0-5 [000] .... 79.046877: ' +
- 'mali_hwc_FRAG_NUM_TILES: val=1840',
- ' kworker/u:0-5 [000] .... 79.046862: ' +
- 'mali_hwc_FRAG_PRIMATIVES: val=3752',
- ' kworker/u:0-5 [000] .... 79.046863: ' +
- 'mali_hwc_FRAG_PRIMATIVES_DROPPED: val=18',
- ' kworker/u:0-5 [000] .... 79.046874: ' +
- 'mali_hwc_FRAG_QUADS_EZS_TEST: val=117925',
- ' kworker/u:0-5 [000] .... 79.046873: ' +
- 'mali_hwc_FRAG_QUADS_RAST: val=117889',
- ' kworker/u:0-5 [000] .... 79.046870: ' +
- 'mali_hwc_FRAG_THREADS: val=471507',
- ' kworker/u:0-5 [000] .... 79.046879: ' +
- 'mali_hwc_FRAG_TRANS_ELIM: val=687',
- ' kworker/u:0-5 [000] .... 80.315162: ' +
- 'mali_hwc_FRONT_FACING: val=56',
- ' kworker/u:0-5 [000] .... 78.896582: ' +
- 'mali_hwc_GPU_ACTIVE: val=1316',
- ' kworker/u:0-5 [000] .... 78.896584: ' +
- 'mali_hwc_IRQ_ACTIVE: val=17',
- ' kworker/u:0-5 [000] .... 79.046834: ' +
- 'mali_hwc_JS0_ACTIVE: val=709444',
- ' kworker/u:0-5 [000] .... 79.046831: ' +
- 'mali_hwc_JS0_JOBS: val=2',
- ' kworker/u:0-5 [000] .... 79.046832: ' +
- 'mali_hwc_JS0_TASKS: val=7263',
- ' kworker/u:0-5 [000] .... 79.046836: ' +
- 'mali_hwc_JS0_WAIT_DEPEND: val=665876',
- ' kworker/u:0-5 [000] .... 79.046835: ' +
- 'mali_hwc_JS0_WAIT_ISSUE: val=910',
- ' kworker/u:0-5 [000] .... 79.046840: ' +
- 'mali_hwc_JS1_ACTIVE: val=153980',
- ' kworker/u:0-5 [000] .... 79.046838: ' +
- 'mali_hwc_JS1_JOBS: val=133',
- ' kworker/u:0-5 [000] .... 79.046839: ' +
- 'mali_hwc_JS1_TASKS: val=128',
- ' kworker/u:0-5 [000] .... 79.046843: ' +
- 'mali_hwc_JS1_WAIT_FINISH: val=74404',
- ' kworker/u:0-5 [000] .... 79.046842: ' +
- 'mali_hwc_JS1_WAIT_ISSUE: val=10146',
- ' kworker/u:0-5 [000] .... 78.896603: ' +
- 'mali_hwc_L2_ANY_LOOKUP: val=22',
- ' kworker/u:0-5 [000] .... 79.046942: ' +
- 'mali_hwc_L2_CLEAN_MISS: val=116',
- ' kworker/u:0-5 [000] .... 79.063515: ' +
- 'mali_hwc_L2_EXT_AR_STALL: val=9',
- ' kworker/u:0-5 [000] .... 78.963384: ' +
- 'mali_hwc_L2_EXT_BARRIER: val=1',
- ' kworker/u:0-5 [000] .... 79.063516: ' +
- 'mali_hwc_L2_EXT_R_BUF_FULL: val=43',
- ' kworker/u:0-5 [000] .... 78.896611: ' +
- 'mali_hwc_L2_EXT_READ: val=4',
- ' kworker/u:0-5 [000] .... 78.896612: ' +
- 'mali_hwc_L2_EXT_READ_LINE: val=4',
- ' kworker/u:0-5 [000] .... 79.046956: ' +
- 'mali_hwc_L2_EXT_R_RAW: val=1',
- ' kworker/u:0-5 [000] .... 79.063518: ' +
- 'mali_hwc_L2_EXT_R_W_HAZARD: val=15',
- ' kworker/u:0-5 [000] .... 78.963381: ' +
- 'mali_hwc_L2_EXT_WRITE: val=25',
- ' kworker/u:0-5 [000] .... 79.046952: ' +
- 'mali_hwc_L2_EXT_WRITE_LINE: val=63278',
- ' kworker/u:0-5 [000] .... 78.963382: ' +
- 'mali_hwc_L2_EXT_WRITE_SMALL: val=1',
- ' kworker/u:0-5 [000] .... 79.814532: ' +
- 'mali_hwc_L2_EXT_W_STALL: val=9',
- ' kworker/u:0-5 [000] .... 78.896602: ' +
- 'mali_hwc_L2_READ_BEATS: val=16',
- ' kworker/u:0-5 [000] .... 78.896607: ' +
- 'mali_hwc_L2_READ_HIT: val=11',
- ' kworker/u:0-5 [000] .... 78.896604: ' +
- 'mali_hwc_L2_READ_LOOKUP: val=19',
- ' kworker/u:0-5 [000] .... 78.896606: ' +
- 'mali_hwc_L2_READ_REPLAY: val=2',
- ' kworker/u:0-5 [000] .... 79.046940: ' +
- 'mali_hwc_L2_READ_SNOOP: val=24',
- ' kworker/u:0-5 [000] .... 79.046959: ' +
- 'mali_hwc_L2_REPLAY_FULL: val=6629',
- ' kworker/u:0-5 [000] .N.. 80.565684: ' +
- 'mali_hwc_L2_SNOOP_FULL: val=5',
- ' kworker/u:0-5 [000] .... 79.046937: ' +
- 'mali_hwc_L2_SREAD_LOOKUP: val=241',
- ' kworker/u:0-5 [000] .... 79.046944: ' +
- 'mali_hwc_L2_SWRITE_LOOKUP: val=133',
- ' kworker/u:0-5 [000] .... 78.896614: ' +
- 'mali_hwc_L2_TAG_HAZARD: val=4',
- ' kworker/u:0-5 [000] .... 78.963368: ' +
- 'mali_hwc_L2_WRITE_BEATS: val=96',
- ' kworker/u:0-5 [000] .... 79.046947: ' +
- 'mali_hwc_L2_WRITE_HIT: val=78265',
- ' kworker/u:0-5 [000] .... 78.896608: ' +
- 'mali_hwc_L2_WRITE_LOOKUP: val=3',
- ' kworker/u:0-5 [000] .... 79.046946: ' +
- 'mali_hwc_L2_WRITE_REPLAY: val=15879',
- ' kworker/u:0-5 [000] .... 79.046912: ' +
- 'mali_hwc_LSC_LINE_FETCHES: val=15',
- ' kworker/u:0-5 [000] .... 79.046909: ' +
- 'mali_hwc_LSC_READ_HITS: val=2961',
- ' kworker/u:0-5 [000] .... 79.046911: ' +
- 'mali_hwc_LSC_READ_MISSES: val=22',
- ' kworker/u:0-5 [000] .... 79.046914: ' +
- 'mali_hwc_LSC_SNOOPS: val=10',
- ' kworker/u:0-5 [000] .... 79.046893: ' +
- 'mali_hwc_LS_ISSUES: val=524219',
- ' kworker/u:0-5 [000] .... 79.046894: ' +
- 'mali_hwc_LS_REISSUES_MISS: val=439',
- ' kworker/u:0-5 [000] .... 79.046895: ' +
- 'mali_hwc_LS_REISSUES_VD: val=52007',
- ' kworker/u:0-5 [000] .... 79.046919: ' +
- 'mali_hwc_LS_TLB_HIT: val=3043',
- ' kworker/u:0-5 [000] .... 79.046918: ' +
- 'mali_hwc_LS_TLB_MISS: val=5',
- ' kworker/u:0-5 [000] .... 79.046891: ' +
- 'mali_hwc_LS_WORDS: val=471514',
- ' kworker/u:0-5 [000] .... 79.046925: ' +
- 'mali_hwc_MMU_HIT: val=771',
- ' kworker/u:0-5 [000] .... 79.046924: ' +
- 'mali_hwc_MMU_NEW_MISS: val=494',
- ' kworker/u:0-5 [000] .... 79.046922: ' +
- 'mali_hwc_MMU_REPLAY_MISS: val=841',
- ' kworker/u:0-5 [000] .... 79.046921: ' +
- 'mali_hwc_MMU_TABLE_WALK: val=3119',
- ' kworker/u:0-5 [000] .... 79.046848: ' +
- 'mali_hwc_POINTS: val=5',
- ' kworker/u:0-5 [000] .... 79.046856: ' +
- 'mali_hwc_PRIM_CLIPPED: val=70',
- ' kworker/u:0-5 [000] .... 79.046855: ' +
- 'mali_hwc_PRIM_CULLED: val=26',
- ' kworker/u:0-5 [000] .... 79.046854: ' +
- 'mali_hwc_PRIM_VISIBLE: val=109',
- ' kworker/u:0-5 [000] .... 79.046898: ' +
- 'mali_hwc_TEX_BUBBLES: val=24874',
- ' kworker/u:0-5 [000] .... 79.046905: ' +
- 'mali_hwc_TEX_RECIRC_DESC: val=5937',
- ' kworker/u:0-5 [000] .... 79.046904: ' +
- 'mali_hwc_TEX_RECIRC_FMISS: val=209450',
- ' kworker/u:0-5 [000] .... 78.896592: ' +
- 'mali_hwc_TEX_RECIRC_MULTI: val=238',
- ' kworker/u:0-5 [000] .... 79.046908: ' +
- 'mali_hwc_TEX_RECIRC_PMISS: val=9672',
- ' kworker/u:0-5 [000] .... 79.046903: ' +
- 'mali_hwc_TEX_THREADS: val=660900',
- ' kworker/u:0-5 [000] .... 79.046897: ' +
- 'mali_hwc_TEX_WORDS: val=471193',
- ' kworker/u:0-5 [000] .... 79.046901: ' +
- 'mali_hwc_TEX_WORDS_DESC: val=707',
- ' kworker/u:0-5 [000] .... 79.046900: ' +
- 'mali_hwc_TEX_WORDS_L0: val=32',
- ' kworker/u:0-5 [000] .... 79.046846: ' +
- 'mali_hwc_TRIANGLES: val=130',
- ' kworker/u:0-5 [000] .... 79.046885: ' +
- 'mali_hwc_TRIPIPE_ACTIVE: val=691001',
- ' kworker/u:0-5 [000] .... 78.896600: ' +
- 'mali_hwc_UTLB_NEW_MISS: val=6',
- ' kworker/u:0-5 [000] .... 78.896599: ' +
- 'mali_hwc_UTLB_REPLAY_FULL: val=248',
- ' kworker/u:0-5 [000] .... 78.896597: ' +
- 'mali_hwc_UTLB_REPLAY_MISS: val=1',
- ' kworker/u:0-5 [000] .... 78.896596: ' +
- 'mali_hwc_UTLB_STALL: val=1',
- ' kworker/u:0-5 [000] .... 79.046850: ' +
- 'mali_hwc_VCACHE_HIT: val=311',
- ' kworker/u:0-5 [000] .... 79.046851: ' +
- 'mali_hwc_VCACHE_MISS: val=70'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var counters = m.getAllCounters();
- assert.equal(counters.length, 103);
-
- // all counters should have 1 sample
- for (var tI = 0; tI < counters.length; tI++) {
- var counter = counters[tI];
- assert.equal(counter.series[0].samples.length, 1);
- }
- // TODO(sleffler) verify counter names? (not sure if it's worth the effort)
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/memreclaim_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/memreclaim_parser.html
deleted file mode 100644
index c4b7f57f844..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/memreclaim_parser.html
+++ /dev/null
@@ -1,155 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses drm driver events in the Linux event trace format.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses linux vmscan trace events.
- * @constructor
- */
- function MemReclaimParser(importer) {
- Parser.call(this, importer);
-
- importer.registerEventHandler('mm_vmscan_kswapd_wake',
- MemReclaimParser.prototype.kswapdWake.bind(this));
- importer.registerEventHandler('mm_vmscan_kswapd_sleep',
- MemReclaimParser.prototype.kswapdSleep.bind(this));
- importer.registerEventHandler('mm_vmscan_direct_reclaim_begin',
- MemReclaimParser.prototype.reclaimBegin.bind(this));
- importer.registerEventHandler('mm_vmscan_direct_reclaim_end',
- MemReclaimParser.prototype.reclaimEnd.bind(this));
- }
-
- // Matches the mm_vmscan_kswapd_wake record
- // mm_vmscan_kswapd_wake: nid=%d order=%d
- var kswapdWakeRE = /nid=(\d+) order=(\d+)/;
-
- // Matches the mm_vmscan_kswapd_sleep record
- // mm_vmscan_kswapd_sleep: order=%d
- var kswapdSleepRE = /nid=(\d+)/;
-
- // Matches the mm_vmscan_direct_reclaim_begin record
- // mm_vmscan_direct_reclaim_begin: order=%d may_writepage=%d gfp_flags=%s
- var reclaimBeginRE = /order=(\d+) may_writepage=\d+ gfp_flags=(.+)/;
-
- // Matches the mm_vmscan_direct_reclaim_end record
- // mm_vmscan_direct_reclaim_end: nr_reclaimed=%lu
- var reclaimEndRE = /nr_reclaimed=(\d+)/;
-
- MemReclaimParser.prototype = {
- __proto__: Parser.prototype,
-
- /**
- * Parses memreclaim events and sets up state in the importer.
- */
- kswapdWake: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = kswapdWakeRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var tgid = parseInt(eventBase.tgid);
-
- var nid = parseInt(event[1]);
- var order = parseInt(event[2]);
-
- var kthread = this.importer.getOrCreateKernelThread(
- eventBase.threadName, tgid, pid);
-
- if (kthread.openSliceTS) {
- if (order > kthread.order) {
- kthread.order = order;
- }
- } else {
- kthread.openSliceTS = ts;
- kthread.order = order;
- }
- return true;
- },
-
- kswapdSleep: function(eventName, cpuNumber, pid, ts, eventBase) {
- var tgid = parseInt(eventBase.tgid);
-
- var kthread = this.importer.getOrCreateKernelThread(
- eventBase.threadName, tgid, pid);
-
- if (kthread.openSliceTS) {
-
- kthread.thread.sliceGroup.pushCompleteSlice(
- 'memreclaim', eventBase.threadName, kthread.openSliceTS,
- ts - kthread.openSliceTS, 0, 0,
- {
- order: kthread.order
- });
- }
- kthread.openSliceTS = undefined;
- kthread.order = undefined;
- return true;
- },
-
- reclaimBegin: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = reclaimBeginRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var order = parseInt(event[1]);
- var gfp = event[2];
- var tgid = parseInt(eventBase.tgid);
-
- var kthread = this.importer.getOrCreateKernelThread(
- eventBase.threadName, tgid, pid);
-
- kthread.openSliceTS = ts;
- kthread.order = order;
- kthread.gfp = gfp;
- return true;
- },
-
- reclaimEnd: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = reclaimEndRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var nr_reclaimed = parseInt(event[1]);
- var tgid = parseInt(eventBase.tgid);
-
- var kthread = this.importer.getOrCreateKernelThread(
- eventBase.threadName, tgid, pid);
-
- if (kthread.openSliceTS !== undefined) {
- kthread.thread.sliceGroup.pushCompleteSlice('memreclaim',
- 'direct reclaim', kthread.openSliceTS, ts - kthread.openSliceTS,
- 0, 0,
- {
- order: kthread.order,
- gfp: kthread.gfp,
- nr_reclaimed: nr_reclaimed
- });
- }
- kthread.openSliceTS = undefined;
- kthread.order = undefined;
- kthread.gfp = undefined;
- return true;
- }
-
- };
-
- Parser.register(MemReclaimParser);
-
- return {
- MemReclaimParser: MemReclaimParser
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/memreclaim_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/memreclaim_parser_test.html
deleted file mode 100644
index f6a10ecf47e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/memreclaim_parser_test.html
+++ /dev/null
@@ -1,170 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function newModel(events) {
- return tr.c.TestUtils.newModelWithEvents([events], {
- shiftWorldToZero: false
- });
- }
-
- test('memreclaimImport', function() {
- var lines = [
- ' surfaceflinger-1155 ( 1155) [001] ...1 12839.528756: mm_vmscan_direct_reclaim_begin: order=0 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|GFP_ZERO|0x2', // @suppress longLineCheck
- ' surfaceflinger-1155 ( 1155) [001] ...1 12839.531950: mm_vmscan_direct_reclaim_end: nr_reclaimed=66', // @suppress longLineCheck
- ' kswapd0-33 ( 33) [001] ...1 12838.491407: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- ' kswapd0-33 ( 33) [001] ...1 12838.529770: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck
- ' kswapd0-33 ( 33) [001] ...1 12840.545737: mm_vmscan_kswapd_sleep: nid=0'// @suppress longLineCheck
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- assert.equal(m.processes['1155'].threads['1155'].sliceGroup.length, 1);
- assert.equal(m.processes['33'].threads['33'].sliceGroup.length, 1);
- });
-
- test('memreclaimDirectReclaim', function() {
- var lines = [
- 'RenderThread-9844 ( 9786) [001] ...1 1734.106078: mm_vmscan_direct_reclaim_begin: order=5 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|0x2', // @suppress longLineCheck
- 'RenderThread-9844 ( 9786) [001] ...1 1734.107619: mm_vmscan_direct_reclaim_end: nr_reclaimed=72', // @suppress longLineCheck
- 'RenderThread-9844 ( 9786) [001] ...1 1734.107738: mm_vmscan_direct_reclaim_begin: order=4 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|0x2', // @suppress longLineCheck
- 'RenderThread-9844 ( 9786) [001] ...1 1734.107844: mm_vmscan_direct_reclaim_end: nr_reclaimed=35', // @suppress longLineCheck
- 'RenderThread-9844 ( 9786) [001] ...1 1734.107891: mm_vmscan_direct_reclaim_begin: order=4 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|0x2', // @suppress longLineCheck
- 'RenderThread-9844 ( 9786) [001] ...1 1734.107945: mm_vmscan_direct_reclaim_end: nr_reclaimed=35', // @suppress longLineCheck
- 'RenderThread-9844 ( 9786) [001] ...1 1734.107990: mm_vmscan_direct_reclaim_begin: order=4 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|0x2', // @suppress longLineCheck
- 'RenderThread-9844 ( 9786) [001] ...1 1734.108062: mm_vmscan_direct_reclaim_end: nr_reclaimed=34', // @suppress longLineCheck
- 'Binder_8-1735 ( 1022) [001] ...1 1735.472240: mm_vmscan_direct_reclaim_begin: order=3 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|0x2', // @suppress longLineCheck
- 'Binder_8-1735 ( 1022) [001] ...1 1735.472849: mm_vmscan_direct_reclaim_end: nr_reclaimed=47', // @suppress longLineCheck
- 'Binder_8-1735 ( 1022) [001] ...1 1735.473002: mm_vmscan_direct_reclaim_begin: order=3 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|0x2', // @suppress longLineCheck
- 'Binder_8-1735 ( 1022) [001] ...1 1735.474859: mm_vmscan_direct_reclaim_end: nr_reclaimed=48', // @suppress longLineCheck
- 'touch_fusion-88 ( 88) [000] ...1 1736.510656: mm_vmscan_direct_reclaim_begin: order=2 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|GFP_COMP|GFP_NOMEMALLOC|GFP_KMEMCG', // @suppress longLineCheck
- 'touch_fusion-88 ( 88) [000] ...1 1736.517616: mm_vmscan_direct_reclaim_end: nr_reclaimed=34', // @suppress longLineCheck
- 'touch_fusion-88 ( 88) [000] ...1 1736.527061: mm_vmscan_direct_reclaim_begin: order=2 may_writepage=1 gfp_flags=GFP_KERNEL|GFP_NOWARN|GFP_COMP|GFP_NOMEMALLOC|GFP_KMEMCG', // @suppress longLineCheck
- 'touch_fusion-88 ( 88) [000] ...1 1736.530857: mm_vmscan_direct_reclaim_end: nr_reclaimed=39'// @suppress longLineCheck
- ];
-
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
-
- assert.equal(threads.length, 3);
-
- var Binder_8 = threads[0];
- var touch_fusion = threads[1];
- var RenderThread = threads[2];
-
- /* make sure there are the expected amount of slices per thread */
- assert.equal(Binder_8.sliceGroup.length, 2);
- assert.equal(touch_fusion.sliceGroup.length, 2);
- assert.equal(RenderThread.sliceGroup.length, 4);
-
- /* make sure the slices have information to display to the
- * user when selected
- */
-
- var iterate_me = [Binder_8, touch_fusion, RenderThread];
- iterate_me.forEach(function(thread) {
- for (var i = 0; i < thread.sliceGroup.length; i++) {
- assert.equal(thread.sliceGroup.slices[i].args !== undefined, true);
- }
- });
- });
-
- test('memreclaimKswapd', function() {
- var lines = [
- 'kswapd0-48 ( 48) [001] ...1 1734.210437: mm_vmscan_kswapd_wake: nid=0 order=5', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1734.227291: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1734.237585: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1734.258698: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1734.269642: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1734.319484: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1734.344839: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1734.428425: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1734.429593: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1734.599419: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1734.696606: mm_vmscan_kswapd_sleep: nid=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1735.465745: mm_vmscan_kswapd_wake: nid=0 order=3', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1735.563917: mm_vmscan_kswapd_wake: nid=0 order=5', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1735.570555: mm_vmscan_kswapd_wake: nid=0 order=4', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1735.666658: mm_vmscan_kswapd_sleep: nid=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1736.508069: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1736.529293: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1736.696725: mm_vmscan_kswapd_sleep: nid=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1737.945426: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1737.988642: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1738.057237: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1738.144630: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1738.207546: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1738.221963: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1738.316889: mm_vmscan_kswapd_sleep: nid=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1738.712804: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1738.751103: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1738.773175: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1738.785068: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1738.789545: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1738.873675: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1738.899117: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1738.939214: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1738.990366: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1739.028269: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1739.036765: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1739.077631: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.094731: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.096757: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.160536: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.256638: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.264972: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1739.360137: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.368759: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.387082: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.455657: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.489058: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.507561: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.570247: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [001] ...1 1739.582975: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.678148: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.762025: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.799245: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.821950: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.894130: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1739.919775: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1740.026933: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1740.126608: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1740.150819: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1740.156101: mm_vmscan_kswapd_wake: nid=0 order=1', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1740.246626: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1740.357055: mm_vmscan_kswapd_sleep: nid=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1740.762705: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1740.772367: mm_vmscan_kswapd_wake: nid=0 order=2', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1740.783509: mm_vmscan_kswapd_wake: nid=0 order=0', // @suppress longLineCheck
- 'kswapd0-48 ( 48) [000] ...1 1740.876601: mm_vmscan_kswapd_sleep: nid=0'// @suppress longLineCheck
- ];
-
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 1);
-
- var thread = threads[0];
-
- assert.equal(thread.sliceGroup.length, 6);
-
- thread.sliceGroup.slices.forEach(function(slice) {
- assert.equal(slice.args !== undefined, true);
- });
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/parser.html
deleted file mode 100644
index dd64d06b69d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/parser.html
+++ /dev/null
@@ -1,90 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/extension_registry.html">
-<script>
-'use strict';
-
-/**
- * @fileoverview Base class for linux perf event parsers.
- *
- * The linux perf trace event importer depends on subclasses of
- * Parser to parse event data. Each subclass corresponds
- * to a group of trace events; e.g. SchedParser implements
- * parsing of sched:* kernel trace events. Parser subclasses must
- * call Parser.register to arrange to be instantiated
- * and their constructor must register their event handlers with the
- * importer. For example,
- *
- * var Parser = tr.e.importer.linux_perf.Parser;
- *
- * function WorkqueueParser(importer) {
- * Parser.call(this, importer);
- *
- * importer.registerEventHandler('workqueue_execute_start',
- * WorkqueueParser.prototype.executeStartEvent.bind(this));
- * importer.registerEventHandler('workqueue_execute_end',
- * WorkqueueParser.prototype.executeEndEvent.bind(this));
- * }
- *
- * Parser.register(WorkqueueParser);
- *
- * When a registered event name is found in the data stream the associated
- * event handler is invoked:
- *
- * executeStartEvent: function(eventName, cpuNumber, ts, eventBase)
- *
- * If the routine returns false the caller will generate an import error
- * saying there was a problem parsing it. Handlers can also emit import
- * messages using this.importer.model.importWarning. If this is done in lieu of
- * the generic import error it may be desirable for the handler to return
- * true.
- *
- * Trace events generated by writing to the trace_marker file are expected
- * to have a leading text marker followed by a ':'; e.g. the trace clock
- * synchronization event is:
- *
- * tracing_mark_write: trace_event_clock_sync: parent_ts=0
- *
- * To register an event handler for these events, prepend the marker with
- * 'tracing_mark_write:'; e.g.
- *
- * this.registerEventHandler('tracing_mark_write:trace_event_clock_sync',
- *
- * All subclasses should depend on importer.linux_perf.parser, e.g.
- *
- * tr.defineModule('importer.linux_perf.workqueue_parser')
- * .dependsOn('importer.linux_perf.parser')
- * .exportsTo('tracing', function()
- *
- * and be listed in the dependsOn of FTraceImporter. Beware that after adding a
- * new subclass you must run build/generate_about_tracing_contents.py to
- * regenerate tr.ui.e.about_tracing.*.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
- /**
- * Parses linux perf events.
- * @constructor
- */
- function Parser(importer) {
- this.importer = importer;
- this.model = importer.model;
- }
-
- Parser.prototype = {
- __proto__: Object.prototype
- };
-
- var options = new tr.b.ExtensionRegistryOptions(tr.b.BASIC_REGISTRY_MODE);
- options.mandatoryBaseClass = Parser;
- tr.b.decorateExtensionRegistry(Parser, options);
-
- return {
- Parser: Parser
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/power_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/power_parser.html
deleted file mode 100644
index c6d01a26d05..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/power_parser.html
+++ /dev/null
@@ -1,183 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-<link rel="import" href="/tracing/model/counter_series.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses power events in the Linux event trace format.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
-
- var ColorScheme = tr.b.ColorScheme;
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses linux power trace events.
- * @constructor
- */
- function PowerParser(importer) {
- Parser.call(this, importer);
-
- // NB: old-style power events, deprecated
- importer.registerEventHandler('power_start',
- PowerParser.prototype.powerStartEvent.bind(this));
- importer.registerEventHandler('power_frequency',
- PowerParser.prototype.powerFrequencyEvent.bind(this));
-
- importer.registerEventHandler('cpu_frequency',
- PowerParser.prototype.cpuFrequencyEvent.bind(this));
- importer.registerEventHandler('cpu_frequency_limits',
- PowerParser.prototype.cpuFrequencyLimitsEvent.bind(this));
- importer.registerEventHandler('cpu_idle',
- PowerParser.prototype.cpuIdleEvent.bind(this));
- }
-
- PowerParser.prototype = {
- __proto__: Parser.prototype,
-
- cpuStateSlice: function(ts, targetCpuNumber, eventType, cpuState) {
- var targetCpu = this.importer.getOrCreateCpu(targetCpuNumber);
- var powerCounter;
- if (eventType != '1') {
- this.importer.model.importWarning({
- type: 'parse_error',
- message: 'Don\'t understand power_start events of ' +
- 'type ' + eventType
- });
- return;
- }
- powerCounter = targetCpu.getOrCreateCounter('', 'C-State');
- if (powerCounter.numSeries === 0) {
- powerCounter.addSeries(new tr.model.CounterSeries('state',
- ColorScheme.getColorIdForGeneralPurposeString(
- powerCounter.name + '.' + 'state')));
- }
- powerCounter.series.forEach(function(series) {
- series.addCounterSample(ts, cpuState);
- });
- },
-
- cpuIdleSlice: function(ts, targetCpuNumber, cpuState) {
- var targetCpu = this.importer.getOrCreateCpu(targetCpuNumber);
- var powerCounter = targetCpu.getOrCreateCounter('', 'C-State');
- if (powerCounter.numSeries === 0) {
- powerCounter.addSeries(new tr.model.CounterSeries('state',
- ColorScheme.getColorIdForGeneralPurposeString(powerCounter.name)));
- }
- // NB: 4294967295/-1 means an exit from the current state
- var val = (cpuState != 4294967295 ? cpuState + 1 : 0);
- powerCounter.series.forEach(function(series) {
- series.addCounterSample(ts, val);
- });
- },
-
- cpuFrequencySlice: function(ts, targetCpuNumber, powerState) {
- var targetCpu = this.importer.getOrCreateCpu(targetCpuNumber);
- var powerCounter =
- targetCpu.getOrCreateCounter('', 'Clock Frequency');
- if (powerCounter.numSeries === 0) {
- powerCounter.addSeries(new tr.model.CounterSeries('state',
- ColorScheme.getColorIdForGeneralPurposeString(
- powerCounter.name + '.' + 'state')));
- }
- powerCounter.series.forEach(function(series) {
- series.addCounterSample(ts, powerState);
- });
- },
-
- cpuFrequencyLimitsSlice: function(ts, targetCpuNumber, minFreq, maxFreq) {
- var targetCpu = this.importer.getOrCreateCpu(targetCpuNumber);
- var powerCounter =
- targetCpu.getOrCreateCounter('', 'Clock Frequency Limits');
- if (powerCounter.numSeries === 0) {
- powerCounter.addSeries(new tr.model.CounterSeries('Min Frequency',
- ColorScheme.getColorIdForGeneralPurposeString(
- powerCounter.name + '.' + 'Min Frequency')));
- powerCounter.addSeries(new tr.model.CounterSeries('Max Frequency',
- ColorScheme.getColorIdForGeneralPurposeString(
- powerCounter.name + '.' + 'Max Frequency')));
- }
- powerCounter.series.forEach(function(series) {
- if (series.name == 'Min Frequency')
- series.addCounterSample(ts, minFreq);
- if (series.name == 'Max Frequency')
- series.addCounterSample(ts, maxFreq);
- });
- },
-
- /**
- * Parses power events and sets up state in the importer.
- */
- powerStartEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /type=(\d+) state=(\d) cpu_id=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var targetCpuNumber = parseInt(event[3]);
- var cpuState = parseInt(event[2]);
- this.cpuStateSlice(ts, targetCpuNumber, event[1], cpuState);
- return true;
- },
-
- powerFrequencyEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /type=(\d+) state=(\d+) cpu_id=(\d+)/
- .exec(eventBase.details);
- if (!event)
- return false;
-
- var targetCpuNumber = parseInt(event[3]);
- var powerState = parseInt(event[2]);
- this.cpuFrequencySlice(ts, targetCpuNumber, powerState);
- return true;
- },
-
- cpuFrequencyEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /state=(\d+) cpu_id=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var targetCpuNumber = parseInt(event[2]);
- var powerState = parseInt(event[1]);
- this.cpuFrequencySlice(ts, targetCpuNumber, powerState);
- return true;
- },
-
- cpuFrequencyLimitsEvent: function(eventName, cpu, pid, ts, eventBase) {
- var event = /min=(\d+) max=(\d+) cpu_id=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var targetCpuNumber = parseInt(event[3]);
- var minFreq = parseInt(event[1]);
- var maxFreq = parseInt(event[2]);
- this.cpuFrequencyLimitsSlice(ts, targetCpuNumber, minFreq, maxFreq);
- return true;
- },
-
- cpuIdleEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /state=(\d+) cpu_id=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var targetCpuNumber = parseInt(event[2]);
- var cpuState = parseInt(event[1]);
- this.cpuIdleSlice(ts, targetCpuNumber, cpuState);
- return true;
- }
- };
-
- Parser.register(PowerParser);
-
- return {
- PowerParser: PowerParser
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/power_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/power_parser_test.html
deleted file mode 100644
index 9dae21dcc9d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/power_parser_test.html
+++ /dev/null
@@ -1,93 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function newModel(events) {
- return tr.c.TestUtils.newModelWithEvents([events], {
- shiftWorldToZero: false
- });
- }
-
- test('powerFrequencyImport', function() {
- var lines = [
- ' kworker/0:3-6880 [000] 2784.783015: power_frequency: ' +
- 'type=2 state=1000000 cpu_id=0',
- ' kworker/1:2-7269 [001] 2784.788993: power_frequency: ' +
- 'type=2 state=800000 cpu_id=1',
- ' kworker/1:2-7269 [001] 2784.993120: power_frequency: ' +
- 'type=2 state=1300000 cpu_id=1'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var c0 = m.kernel.cpus[0];
- assert.equal(c0.slices.length, 0);
- assert.equal(c0.counters['.Clock Frequency'].series[0].samples.length, 1);
-
- var c1 = m.kernel.cpus[1];
- assert.equal(c1.slices.length, 0);
- assert.equal(c1.counters['.Clock Frequency'].series[0].samples.length, 2);
- });
-
- test('cpuFrequencyImport', function() {
- var lines = [
- ' kworker/1:0-9665 [001] 15051.007301: cpu_frequency: ' +
- 'state=800000 cpu_id=1',
- ' kworker/1:0-9665 [001] 15051.010278: cpu_frequency: ' +
- 'state=1300000 cpu_id=1',
- ' kworker/0:2-7972 [000] 15051.010278: cpu_frequency: ' +
- 'state=1000000 cpu_id=0',
- ' kworker/0:2-7972 [000] 15051.020304: cpu_frequency: ' +
- 'state=800000 cpu_id=0'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var c0 = m.kernel.cpus[0];
- assert.equal(c0.slices.length, 0);
- assert.equal(c0.counters['.Clock Frequency'].series[0].samples.length, 2);
-
- var c1 = m.kernel.cpus[1];
- assert.equal(c1.slices.length, 0);
- assert.equal(c1.counters['.Clock Frequency'].series[0].samples.length, 2);
- });
-
- test('cpuIdleImport', function() {
- var lines = [
- ' <idle>-0 [000] 15050.992883: cpu_idle: ' +
- 'state=1 cpu_id=0',
- ' <idle>-0 [000] 15050.993027: cpu_idle: ' +
- 'state=4294967295 cpu_id=0',
- ' <idle>-0 [001] 15050.993132: cpu_idle: ' +
- 'state=1 cpu_id=1',
- ' <idle>-0 [001] 15050.993276: cpu_idle: ' +
- 'state=4294967295 cpu_id=1',
- ' <idle>-0 [001] 15050.993279: cpu_idle: ' +
- 'state=3 cpu_id=1',
- ' <idle>-0 [001] 15050.993457: cpu_idle: ' +
- 'state=4294967295 cpu_id=1'
- ];
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var c0 = m.kernel.cpus[0];
- assert.equal(c0.slices.length, 0);
- assert.equal(c0.counters['.C-State'].series[0].samples.length, 2);
-
- var c1 = m.kernel.cpus[1];
- assert.equal(c1.slices.length, 0);
- assert.equal(c1.counters['.C-State'].series[0].samples.length, 4);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/regulator_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/regulator_parser.html
deleted file mode 100644
index 0c56720f51c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/regulator_parser.html
+++ /dev/null
@@ -1,143 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses regulator events in the Linux event trace format.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
-
- var ColorScheme = tr.b.ColorScheme;
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses linux regulator trace events.
- * @constructor
- */
- function RegulatorParser(importer) {
- Parser.call(this, importer);
-
- importer.registerEventHandler('regulator_enable',
- RegulatorParser.prototype.regulatorEnableEvent.bind(this));
- importer.registerEventHandler('regulator_enable_delay',
- RegulatorParser.prototype.regulatorEnableDelayEvent.bind(this));
- importer.registerEventHandler('regulator_enable_complete',
- RegulatorParser.prototype.regulatorEnableCompleteEvent.bind(this));
- importer.registerEventHandler('regulator_disable',
- RegulatorParser.prototype.regulatorDisableEvent.bind(this));
- importer.registerEventHandler('regulator_disable_complete',
- RegulatorParser.prototype.regulatorDisableCompleteEvent.bind(this));
- importer.registerEventHandler('regulator_set_voltage',
- RegulatorParser.prototype.regulatorSetVoltageEvent.bind(this));
- importer.registerEventHandler('regulator_set_voltage_complete',
- RegulatorParser.prototype.regulatorSetVoltageCompleteEvent.bind(this));
-
- this.model_ = importer.model_;
- }
-
- // Matches the regulator_enable record
- var regulatorEnableRE = /name=(.+)/;
-
- // Matches the regulator_disable record
- var regulatorDisableRE = /name=(.+)/;
-
- // Matches the regulator_set_voltage_complete record
- var regulatorSetVoltageCompleteRE = /name=(\S+), val=(\d+)/;
-
- RegulatorParser.prototype = {
- __proto__: Parser.prototype,
-
- /**
- * Get or create a counter with one series.
- */
- getCtr_: function(ctrName, valueName) {
- var ctr = this.model_.kernel
- .getOrCreateCounter(null, 'vreg ' + ctrName + ' ' + valueName);
- // Initialize the counter's series fields if needed.
- if (ctr.series[0] === undefined) {
- ctr.addSeries(new tr.model.CounterSeries(valueName,
- ColorScheme.getColorIdForGeneralPurposeString(
- ctrName + '.' + valueName)));
- }
- return ctr;
- },
-
- /**
- * Parses regulator events and sets up state in the importer.
- */
- regulatorEnableEvent: function(eventName, cpuNum, pid, ts, eventBase) {
- var event = regulatorEnableRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var name = event[1];
-
- var ctr = this.getCtr_(name, 'enabled');
- ctr.series[0].addCounterSample(ts, 1);
-
- return true;
- },
-
- regulatorEnableDelayEvent: function(eventName, cpuNum, pid, ts, eventBase) {
- return true;
- },
-
- regulatorEnableCompleteEvent: function(eventName, cpuNum, pid, ts,
- eventBase) {
- return true;
- },
-
- regulatorDisableEvent: function(eventName, cpuNum, pid, ts, eventBase) {
- var event = regulatorDisableRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var name = event[1];
-
- var ctr = this.getCtr_(name, 'enabled');
- ctr.series[0].addCounterSample(ts, 0);
-
- return true;
- },
-
- regulatorDisableCompleteEvent: function(eventName, cpuNum, pid, ts,
- eventBase) {
- return true;
- },
-
- regulatorSetVoltageEvent: function(eventName, cpuNum, pid, ts, eventBase) {
- return true;
- },
-
- regulatorSetVoltageCompleteEvent: function(eventName, cpuNum, pid, ts,
- eventBase) {
- var event = regulatorSetVoltageCompleteRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var name = event[1];
- var voltage = parseInt(event[2]);
-
- var ctr = this.getCtr_(name, 'voltage');
- ctr.series[0].addCounterSample(ts, voltage);
-
- return true;
- }
-
- };
-
- Parser.register(RegulatorParser);
-
- return {
- RegulatorParser: RegulatorParser
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/regulator_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/regulator_parser_test.html
deleted file mode 100644
index 328bf7c3161..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/regulator_parser_test.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('regulatorImport', function() {
- var lines = [
- ' kworker/0:2H-14312 [000] ...1 143713.787749: ' +
- 'regulator_set_voltage: name=krait0 (810000-1100000)',
- ' kworker/0:2H-14312 [000] ...1 143713.787778: ' +
- 'regulator_set_voltage_complete: name=krait0, val=810000',
- ' kworker/0:2H-14312 [000] ...1 143714.037871: ' +
- 'regulator_set_voltage: name=krait0 (800000-1100000)',
- ' kworker/0:2H-14312 [000] ...1 143714.037895: ' +
- 'regulator_set_voltage_complete: name=krait0, val=800000',
- 'kworker/0:1-30321 [000] ...1 144568.624596: ' +
- 'regulator_enable: name=8941_smbb_boost',
- 'kworker/0:1-30321 [000] ...1 144568.624715: ' +
- 'regulator_enable_delay: name=8941_smbb_boost',
- 'kworker/0:1-30321 [000] ...1 144568.624723: ' +
- 'regulator_enable_complete: name=8941_smbb_boost',
- 'kworker/0:1-30321 [000] ...1 144568.653546: ' +
- 'regulator_disable: name=8941_smbb_boost',
- 'kworker/0:1-30321 [000] ...1 144568.654785: ' +
- 'regulator_disable_complete: name=8941_smbb_boost'
- ];
- var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shiftWorldToZero: false
- });
- assert.isFalse(m.hasImportWarnings);
-
- assert.property(m.kernel.counters, 'null.vreg krait0 voltage');
- assert.property(m.kernel.counters, 'null.vreg 8941_smbb_boost enabled');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sched_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sched_parser.html
deleted file mode 100644
index 08ad46aed4b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sched_parser.html
+++ /dev/null
@@ -1,150 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-<link rel="import" href="/tracing/model/counter.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses scheduler events in the Linux event trace format.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
-
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses linux sched trace events.
- * @constructor
- */
- function SchedParser(importer) {
- Parser.call(this, importer);
-
- importer.registerEventHandler('sched_switch',
- SchedParser.prototype.schedSwitchEvent.bind(this));
- importer.registerEventHandler('sched_wakeup',
- SchedParser.prototype.schedWakeupEvent.bind(this));
- importer.registerEventHandler('sched_blocked_reason',
- SchedParser.prototype.schedBlockedEvent.bind(this));
- importer.registerEventHandler('sched_cpu_hotplug',
- SchedParser.prototype.schedCpuHotplugEvent.bind(this));
- }
-
- var TestExports = {};
-
- // Matches the sched_switch record
- var schedSwitchRE = new RegExp(
- 'prev_comm=(.+) prev_pid=(\\d+) prev_prio=(\\d+) ' +
- 'prev_state=(\\S\\+?|\\S\\|\\S) ==> ' +
- 'next_comm=(.+) next_pid=(\\d+) next_prio=(\\d+)');
-
- // Matches sched_blocked_reason record
- var schedBlockedRE = new RegExp('pid=(\\d+) iowait=(\\d) caller=(.+)');
- TestExports.schedSwitchRE = schedSwitchRE;
-
- // Matches the sched_wakeup record
- var schedWakeupRE =
- /comm=(.+) pid=(\d+) prio=(\d+) success=(\d+) target_cpu=(\d+)/;
- TestExports.schedWakeupRE = schedWakeupRE;
-
- SchedParser.prototype = {
- __proto__: Parser.prototype,
-
- /**
- * Parses scheduler events and sets up state in the CPUs of the importer.
- */
- schedSwitchEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = schedSwitchRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var prevState = event[4];
- var nextComm = event[5];
- var nextPid = parseInt(event[6]);
- var nextPrio = parseInt(event[7]);
-
- var nextThread = this.importer.threadsByLinuxPid[nextPid];
- var nextName;
- if (nextThread)
- nextName = nextThread.userFriendlyName;
- else
- nextName = nextComm;
-
- var cpu = this.importer.getOrCreateCpu(cpuNumber);
- cpu.switchActiveThread(
- ts,
- {stateWhenDescheduled: prevState},
- nextPid,
- nextName,
- {
- comm: nextComm,
- tid: nextPid,
- prio: nextPrio
- });
-
- return true;
- },
-
- schedWakeupEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = schedWakeupRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var fromPid = pid;
- var comm = event[1];
- var pid = parseInt(event[2]);
- var prio = parseInt(event[3]);
- this.importer.markPidRunnable(ts, pid, comm, prio, fromPid);
- return true;
- },
-
- schedCpuHotplugEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = /cpu (\d+) (.+) error=(\d+)/.exec(eventBase.details);
- if (!event)
- return false;
-
- var cpuNumber = event[1];
- var state = event[2];
- var targetCpu = this.importer.getOrCreateCpu(cpuNumber);
-
- var powerCounter = targetCpu.getOrCreateCounter('', 'Cpu Hotplug');
- if (powerCounter.numSeries === 0) {
- powerCounter.addSeries(new tr.model.CounterSeries('State',
- tr.b.ColorScheme.getColorIdForGeneralPurposeString(
- powerCounter.name + '.' + 'State')));
- }
- powerCounter.series.forEach(function(series) {
- if (series.name == 'State')
- series.addCounterSample(ts, state.localeCompare('offline') ? 0 : 1);
- });
- return true;
- },
-
- schedBlockedEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = schedBlockedRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var pid = parseInt(event[1]);
- var iowait = parseInt(event[2]);
- var caller = event[3];
-
- this.importer.addPidBlockedReason(ts, pid, iowait, caller);
- return true;
- }
- };
-
- Parser.register(SchedParser);
-
- return {
- SchedParser: SchedParser,
- _SchedParserTestExports: TestExports
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sched_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sched_parser_test.html
deleted file mode 100644
index 435463e5b43..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sched_parser_test.html
+++ /dev/null
@@ -1,222 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function newModel(events) {
- return tr.c.TestUtils.newModelWithEvents([events], {
- shiftWorldToZero: false
- });
- }
-
- test('schedSwitchRE', function() {
- var re = tr.e.importer.linux_perf._SchedParserTestExports.schedSwitchRE;
- var x = re.exec('prev_comm=swapper prev_pid=0 prev_prio=120 prev_state=R ' +
- '==> next_comm=SurfaceFlinger next_pid=178 next_prio=112');
- assert.isNotNull(x);
- assert.equal(x[1], 'swapper');
- assert.equal(x[2], '0');
- assert.equal(x[3], '120');
- assert.equal(x[4], 'R');
- assert.equal(x[5], 'SurfaceFlinger');
- assert.equal(x[6], '178');
- assert.equal(x[7], '112');
-
- var x = re.exec('prev_comm=.android.chrome prev_pid=1562 prev_prio=120 prev_state=R ==> next_comm=Binder Thread # next_pid=195 next_prio=120'); // @suppress longLineCheck
- assert.isNotNull(x);
- assert.equal(x[1], '.android.chrome');
- assert.equal(x[5], 'Binder Thread #');
-
- var x = re.exec('prev_comm=Binder Thread # prev_pid=1562 prev_prio=120 prev_state=R ==> next_comm=.android.chrome next_pid=195 next_prio=120'); // @suppress longLineCheck
- assert.isNotNull(x);
- assert.equal(x[1], 'Binder Thread #');
- assert.equal(x[5], '.android.chrome');
-
- // explicit test for prev_state of D|W
- var x = re.exec('prev_comm=.android.chrome prev_pid=1562 prev_prio=120 ' +
- 'prev_state=D|W ==> next_comm=Binder Thread # next_pid=195 ' +
- 'next_prio=120');
- assert.isNotNull(x);
- assert.equal(x[4], 'D|W');
- });
-
- test('schedWakeupRE', function() {
- var re = tr.e.importer.linux_perf._SchedParserTestExports.schedWakeupRE;
- var x = re.exec(
- 'comm=SensorService pid=207 prio=112 success=1 target_cpu=000');
- assert.isNotNull(x);
- assert.equal(x[1], 'SensorService');
- assert.equal(x[2], '207');
- assert.equal(x[3], '112');
- assert.equal(x[4], '1');
- assert.equal(x[5], '000');
- });
-
- test('importOneSequenceWithSchedWakeUp', function() {
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var lines = [
- 'ndroid.launcher-584 [001] d..3 12622.506890: sched_switch: prev_comm=ndroid.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck
- ' Binder_1-217 [001] d..3 12622.506918: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=D ==> next_comm=ndroid.launcher next_pid=584 next_prio=120', // @suppress longLineCheck
- 'ndroid.launcher-584 [001] d..4 12622.506936: sched_wakeup: comm=Binder_1 pid=217 prio=120 success=1 target_cpu=001', // @suppress longLineCheck
- 'ndroid.launcher-584 [001] d..3 12622.506950: sched_switch: prev_comm=ndroid.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck
- ' Binder_1-217 [001] ...1 12622.507057: tracing_mark_write: B|128|queueBuffer', // @suppress longLineCheck
- ' Binder_1-217 [001] ...1 12622.507175: tracing_mark_write: E',
- ' Binder_1-217 [001] d..3 12622.507253: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=S ==> next_comm=ndroid.launcher next_pid=584 next_prio=120' // @suppress longLineCheck
- ];
-
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var thread = m.findAllThreadsNamed('Binder_1')[0];
- var timeSlices = thread.timeSlices;
- assert.equal(timeSlices.length, 4);
-
- var runningSlice = timeSlices[0];
- assert.equal(runningSlice.schedulingState, SCHEDULING_STATE.RUNNING);
- assert.closeTo(12622506.890, runningSlice.start, 1e-5);
- assert.closeTo(.918 - .890, runningSlice.duration, 1e-5);
-
- var sleepSlice = timeSlices[1];
- assert.equal(sleepSlice.schedulingState, SCHEDULING_STATE.UNINTR_SLEEP);
- assert.closeTo(12622506.918, sleepSlice.start, 1e-5);
- assert.closeTo(.936 - .918, sleepSlice.duration, 1e-5);
-
- var wakeupSlice = timeSlices[2];
- assert.equal(wakeupSlice.schedulingState, SCHEDULING_STATE.RUNNABLE);
- assert.closeTo(12622506.936, wakeupSlice.start, 1e-5);
- assert.closeTo(.950 - .936, wakeupSlice.duration, 1e-5);
- assert.equal(wakeupSlice.args['wakeup from tid'], 584);
-
- var runningSlice2 = timeSlices[3];
- assert.equal(runningSlice2.schedulingState, SCHEDULING_STATE.RUNNING);
- assert.closeTo(12622506.950, runningSlice2.start, 1e-5);
- assert.closeTo(7.253 - 6.950, runningSlice2.duration, 1e-5);
- });
-
- test('importWithUnknownSleepState', function() {
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var lines = [
- 'ndroid.launcher-584 [001] d..3 12622.506890: sched_switch: prev_comm=ndroid.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck
- ' Binder_1-217 [001] d..3 12622.506918: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=F|O ==> next_comm=ndroid.launcher next_pid=584 next_prio=120', // @suppress longLineCheck
- 'ndroid.launcher-584 [001] d..4 12622.506936: sched_wakeup: comm=Binder_1 pid=217 prio=120 success=1 target_cpu=001', // @suppress longLineCheck
- 'ndroid.launcher-584 [001] d..3 12622.506950: sched_switch: prev_comm=ndroid.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck
- ' Binder_1-217 [001] ...1 12622.507057: tracing_mark_write: B|128|queueBuffer', // @suppress longLineCheck
- ' Binder_1-217 [001] ...1 12622.507175: tracing_mark_write: E',
- ' Binder_1-217 [001] d..3 12622.507253: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=F|O ==> next_comm=ndroid.launcher next_pid=584 next_prio=120' // @suppress longLineCheck
- ];
-
- var m;
- assert.doesNotThrow(function() {
- m = newModel(lines.join('\n'));
- });
- assert.isTrue(m.hasImportWarnings);
- assert.equal(m.importWarnings[0].message, 'Unrecognized sleep state: F|O');
-
- var thread = m.findAllThreadsNamed('Binder_1')[0];
- var timeSlices = thread.timeSlices;
-
- assert.equal(timeSlices[1].schedulingState, SCHEDULING_STATE.UNKNOWN);
- });
-
- test('importWithUninterruptibleSleep', function() {
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var lines = [
- 'ndroid.launcher-584 [001] d..3 12622.506890: sched_switch: ' +
- 'prev_comm=ndroid.launcher prev_pid=584 ' +
- 'prev_prio=120 prev_state=R+ ' +
- '==> next_comm=Binder_1 next_pid=217 next_prio=120',
-
- ' Binder_1-217 [001] d..3 12622.506918: sched_switch: ' +
- 'prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=D|K ' +
- '==> next_comm=ndroid.launcher next_pid=584 next_prio=120',
-
- 'ndroid.launcher-584 [001] d..4 12622.506936: sched_wakeup: ' +
- 'comm=Binder_1 pid=217 prio=120 success=1 target_cpu=001',
-
- 'ndroid.launcher-584 [001] d..3 12622.506950: sched_switch: ' +
- 'prev_comm=ndroid.launcher prev_pid=584 ' +
- 'prev_prio=120 prev_state=R+ ' +
- '==> next_comm=Binder_1 next_pid=217 next_prio=120',
-
- ' Binder_1-217 [001] ...1 12622.507057: tracing_mark_write: ' +
- 'B|128|queueBuffer',
-
- ' Binder_1-217 [001] ...1 12622.507175: tracing_mark_write: E',
-
- ' Binder_1-217 [001] d..3 12622.507253: sched_switch: ' +
- 'prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=S ' +
- '==> next_comm=ndroid.launcher next_pid=584 next_prio=120'
- ];
-
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var thread = m.findAllThreadsNamed('Binder_1')[0];
- var timeSlices = thread.timeSlices;
- assert.equal(timeSlices.length, 4);
-
- var wakeKillSlice = timeSlices[1];
- assert.equal(wakeKillSlice.schedulingState,
- SCHEDULING_STATE.UNINTR_SLEEP_WAKE_KILL);
- assert.closeTo(12622506.918, wakeKillSlice.start, 1e-5);
- assert.closeTo(.936 - .918, wakeKillSlice.duration, 1e-5);
- });
-
- test('importWithUninterruptibleSleepAndBlockedReason', function() {
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var lines = [
- 'ndroid.launcher-584 [001] d..3 12622.506890: sched_switch: ' +
- 'prev_comm=ndroid.launcher prev_pid=584 ' +
- 'prev_prio=120 prev_state=R+ ' +
- '==> next_comm=Binder_1 next_pid=217 next_prio=120',
-
- ' Binder_1-217 [001] d..3 12622.506918: sched_switch: ' +
- 'prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=D|K ' +
- '==> next_comm=ndroid.launcher next_pid=584 next_prio=120',
-
- ' Binder_1-217 [001] d..3 12622.506930: sched_blocked_reason: ' +
- 'pid=217 iowait=1 caller=sleep_on_page_killable+0x10/0x4c',
-
- 'ndroid.launcher-584 [001] d..4 12622.506936: sched_wakeup: ' +
- 'comm=Binder_1 pid=217 prio=120 success=1 target_cpu=001',
-
- 'ndroid.launcher-584 [001] d..3 12622.506950: sched_switch: ' +
- 'prev_comm=ndroid.launcher prev_pid=584 ' +
- 'prev_prio=120 prev_state=R+ ' +
- '==> next_comm=Binder_1 next_pid=217 next_prio=120',
-
- ' Binder_1-217 [001] ...1 12622.507057: tracing_mark_write: ' +
- 'B|128|queueBuffer',
-
- ' Binder_1-217 [001] ...1 12622.507175: tracing_mark_write: E',
-
- ' Binder_1-217 [001] d..3 12622.507253: sched_switch: ' +
- 'prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=S ' +
- '==> next_comm=ndroid.launcher next_pid=584 next_prio=120'
- ];
-
- var m = newModel(lines.join('\n'));
- assert.isFalse(m.hasImportWarnings);
-
- var thread = m.findAllThreadsNamed('Binder_1')[0];
- var timeSlices = thread.timeSlices;
- assert.equal(timeSlices.length, 4);
-
- var wakeKillSlice = timeSlices[1];
- assert.equal(wakeKillSlice.schedulingState,
- SCHEDULING_STATE.UNINTR_SLEEP_WAKE_KILL_IO);
- assert.closeTo(12622506.918, wakeKillSlice.start, 1e-5);
- assert.closeTo(.936 - .918, wakeKillSlice.duration, 1e-5);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sync_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sync_parser.html
deleted file mode 100644
index ce6afe7179a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sync_parser.html
+++ /dev/null
@@ -1,135 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses sync events in the Linux event trace format.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
-
- var ColorScheme = tr.b.ColorScheme;
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses linux sync trace events.
- * @constructor
- */
- function SyncParser(importer) {
- Parser.call(this, importer);
-
- importer.registerEventHandler(
- 'sync_timeline',
- SyncParser.prototype.timelineEvent.bind(this));
- importer.registerEventHandler(
- 'sync_wait',
- SyncParser.prototype.syncWaitEvent.bind(this));
- importer.registerEventHandler(
- 'sync_pt',
- SyncParser.prototype.syncPtEvent.bind(this));
- this.model_ = importer.model_;
- }
-
- var syncTimelineRE = /name=(\S+) value=(\S*)/;
- var syncWaitRE = /(\S+) name=(\S+) state=(\d+)/;
- var syncPtRE = /name=(\S+) value=(\S*)/;
-
- SyncParser.prototype = {
- __proto__: Parser.prototype,
-
- /**
- * Parses sync events and sets up state in the importer.
- */
- timelineEvent: function(eventName, cpuNumber, pid,
- ts, eventBase) {
- var event = syncTimelineRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var thread = this.importer.getOrCreatePseudoThread(event[1]);
-
- if (thread.lastActiveTs !== undefined) {
- var duration = ts - thread.lastActiveTs;
- var value = thread.lastActiveValue;
- if (value == undefined)
- value = ' ';
- var slice = new tr.model.Slice(
- '', value,
- ColorScheme.getColorIdForGeneralPurposeString(value),
- thread.lastActiveTs, {},
- duration);
- thread.thread.sliceGroup.pushSlice(slice);
- }
- thread.lastActiveTs = ts;
- thread.lastActiveValue = event[2];
- return true;
- },
-
- syncWaitEvent: function(eventName, cpuNumber, pid, ts,
- eventBase) {
- var event = syncWaitRE.exec(eventBase.details);
- if (!event)
- return false;
-
- if (eventBase.tgid === undefined) {
- return false;
- }
-
- var tgid = parseInt(eventBase.tgid);
- var thread = this.model_.getOrCreateProcess(tgid)
- .getOrCreateThread(pid);
- thread.name = eventBase.threadName;
- var slices = thread.kernelSliceGroup;
- if (!slices.isTimestampValidForBeginOrEnd(ts)) {
- this.model_.importWarning({
- type: 'parse_error',
- message: 'Timestamps are moving backward.'
- });
- return false;
- }
-
- var name = 'fence_wait("' + event[2] + '")';
- if (event[1] == 'begin') {
- var slice = slices.beginSlice(null, name, ts, {
- 'Start state': event[3]
- });
- } else if (event[1] == 'end') {
- if (slices.openSliceCount > 0) {
- slices.endSlice(ts);
- }
- } else {
- return false;
- }
-
- return true;
- },
-
- syncPtEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = syncPtRE.exec(eventBase.details);
- if (!event)
- return false;
-
- return true;
-
- var thread = this.importer.getOrCreateKernelThread(
- eventBase[1]).thread;
- thread.syncWaitSyncPts[event[1]] = event[2];
- return true;
- }
- };
-
- Parser.register(SyncParser);
-
- return {
- SyncParser: SyncParser
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sync_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sync_parser_test.html
deleted file mode 100644
index c56e2576f3a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/sync_parser_test.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('syncEventImport', function() {
- var lines = [
- 's3c-fb-92 ( 0) [000] ...1 7206.550061: sync_timeline: name=s3c-fb value=7094', // @suppress longLineCheck
- 'TimedEventQueue-2700 ( 0) [001] ...1 7206.569027: sync_wait: begin name=SurfaceView:6 state=1', // @suppress longLineCheck
- 'TimedEventQueue-2700 ( 0) [001] ...1 7206.569038: sync_pt: name=malitl_124_0x40b6406c value=7289', // @suppress longLineCheck
- 'TimedEventQueue-2700 ( 0) [001] ...1 7206.569056: sync_pt: name=exynos-gsc.0-src value=25', // @suppress longLineCheck
- 'TimedEventQueue-2700 ( 0) [001] ...1 7206.569068: sync_wait: end name=SurfaceView:6 state=1', // @suppress longLineCheck
- 'irq/128-s5p-mfc-62 ( 0) [000] d..3 7206.572402: sync_timeline: name=vb2 value=37', // @suppress longLineCheck
- 'irq/128-s5p-mfc-62 ( 0) [000] d..3 7206.572475: sync_timeline: name=vb2 value=33', // @suppress longLineCheck
- 'SurfaceFlinger-225 ( 0) [001] ...1 7206.584769: sync_timeline: name=malitl_124_0x40b6406c value=7290', // @suppress longLineCheck
- 'kworker/u:5-2269 ( 0) [000] ...1 7206.586745: sync_wait: begin name=display state=1', // @suppress longLineCheck
- 'kworker/u:5-2269 ( 0) [000] ...1 7206.586750: sync_pt: name=s3c-fb value=7093', // @suppress longLineCheck
- 'kworker/u:5-2269 ( 0) [000] ...1 7206.586760: sync_wait: end name=display state=1', // @suppress longLineCheck
- 's3c-fb-92 ( 0) [000] ...1 7206.587193: sync_wait: begin name=vb2 state=0', // @suppress longLineCheck
- 's3c-fb-92 ( 0) [000] ...1 7206.587198: sync_pt: name=exynos-gsc.0-dst value=27', // @suppress longLineCheck
- '<idle>-0 ( 0) [000] d.h4 7206.591133: sync_timeline: name=exynos-gsc.0-src value=27', // @suppress longLineCheck
- '<idle>-0 ( 0) [000] d.h4 7206.591152: sync_timeline: name=exynos-gsc.0-dst value=27', // @suppress longLineCheck
- 's3c-fb-92 ( 0) [000] ...1 7206.591244: sync_wait: end name=vb2 state=1' // @suppress longLineCheck
- ];
-
- var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shiftWorldToZero: false
- });
- assert.isFalse(m.hasImportWarnings);
-
- var threads = m.getAllThreads();
- assert.equal(threads.length, 4);
-
- var threads = m.findAllThreadsNamed('s3c-fb');
- assert.equal(threads.length, 1);
- assert.equal(threads[0].sliceGroup.length, 1);
-
- var threads = m.findAllThreadsNamed('kworker/u:5');
- assert.equal(threads.length, 1);
- assert.equal(threads[0].sliceGroup.length, 1);
- assert.equal('fence_wait("display")',
- threads[0].sliceGroup.slices[0].title);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/workqueue_parser.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/workqueue_parser.html
deleted file mode 100644
index ab71565b6b4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/workqueue_parser.html
+++ /dev/null
@@ -1,103 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/linux_perf/parser.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Parses workqueue events in the Linux event trace format.
- */
-tr.exportTo('tr.e.importer.linux_perf', function() {
-
- var ColorScheme = tr.b.ColorScheme;
- var Parser = tr.e.importer.linux_perf.Parser;
-
- /**
- * Parses linux workqueue trace events.
- * @constructor
- */
- function WorkqueueParser(importer) {
- Parser.call(this, importer);
-
- importer.registerEventHandler('workqueue_execute_start',
- WorkqueueParser.prototype.executeStartEvent.bind(this));
- importer.registerEventHandler('workqueue_execute_end',
- WorkqueueParser.prototype.executeEndEvent.bind(this));
- importer.registerEventHandler('workqueue_queue_work',
- WorkqueueParser.prototype.executeQueueWork.bind(this));
- importer.registerEventHandler('workqueue_activate_work',
- WorkqueueParser.prototype.executeActivateWork.bind(this));
- }
-
- // Matches the workqueue_execute_start record
- // workqueue_execute_start: work struct c7a8a89c: function MISRWrapper
- var workqueueExecuteStartRE = /work struct (.+): function (\S+)/;
-
- // Matches the workqueue_execute_start record
- // workqueue_execute_end: work struct c7a8a89c
- var workqueueExecuteEndRE = /work struct (.+)/;
-
- WorkqueueParser.prototype = {
- __proto__: Parser.prototype,
-
- /**
- * Parses workqueue events and sets up state in the importer.
- */
- executeStartEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = workqueueExecuteStartRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var kthread = this.importer.getOrCreateKernelThread(eventBase.threadName,
- pid, pid);
- kthread.openSliceTS = ts;
- kthread.openSlice = event[2];
- return true;
- },
-
- executeEndEvent: function(eventName, cpuNumber, pid, ts, eventBase) {
- var event = workqueueExecuteEndRE.exec(eventBase.details);
- if (!event)
- return false;
-
- var kthread = this.importer.getOrCreateKernelThread(eventBase.threadName,
- pid, pid);
- if (kthread.openSlice) {
- var slice = new tr.model.Slice('', kthread.openSlice,
- ColorScheme.getColorIdForGeneralPurposeString(kthread.openSlice),
- kthread.openSliceTS,
- {},
- ts - kthread.openSliceTS);
-
- kthread.thread.sliceGroup.pushSlice(slice);
- }
- kthread.openSlice = undefined;
- return true;
- },
-
- executeQueueWork: function(eventName, cpuNumber, pid, ts, eventBase) {
- // TODO: Do something with this event?
- return true;
- },
-
- executeActivateWork: function(eventName, cpuNumber, pid, ts, eventBase) {
- // TODO: Do something with this event?
- return true;
- }
-
- };
-
- Parser.register(WorkqueueParser);
-
- return {
- WorkqueueParser: WorkqueueParser
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/workqueue_parser_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/workqueue_parser_test.html
deleted file mode 100644
index dc3057b6a9b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/linux_perf/workqueue_parser_test.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('workQueueImport', function() {
- var lines = [
- ' kworker/0:3-6880 [000] 2784.771958: workqueue_execute_start: ' +
- 'work struct ffff8800a5083a20: function intel_unpin_work_fn',
- ' kworker/0:3-6880 [000] 2784.771966: workqueue_execute_end: ' +
- 'work struct ffff8800a5083a20',
- ' kworker/1:2-7269 [001] 2784.805966: workqueue_execute_start: ' +
- 'work struct ffff88014fb0f158: function do_dbs_timer',
- ' kworker/1:2-7269 [001] 2784.805975: workqueue_execute_end: ' +
- 'work struct ffff88014fb0f158'
- ];
- var m = tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shiftWorldToZero: false
- });
- assert.isFalse(m.hasImportWarnings);
-
- assert.equal(m.processes['6880'].threads['6880'].sliceGroup.length, 1);
- assert.equal(m.processes['7269'].threads['7269'].sliceGroup.length, 1);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace2html_importer.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/trace2html_importer.html
deleted file mode 100644
index 14854745eb4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace2html_importer.html
+++ /dev/null
@@ -1,95 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base64.html">
-<link rel="import" href="/tracing/importer/importer.html">
-<link rel="import" href="/tracing/importer/simple_line_reader.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.importer', function() {
-
- function Trace2HTMLImporter(model, events) {
- this.importPriority = 0;
- }
-
- Trace2HTMLImporter.subtraces_ = [];
-
- function _extractEventsFromHTML(text) {
- // Clear the array before pushing data to it.
- Trace2HTMLImporter.subtraces_ = [];
-
- var r = new tr.importer.SimpleLineReader(text);
-
- // Try to find viewer-data...
- while (true) {
- if (!r.advanceToLineMatching(
- new RegExp('^<\s*script id="viewer-data" ' +
- 'type="(application\/json|text\/plain)">$')))
- break;
-
- r.beginSavingLines();
- if (!r.advanceToLineMatching(/^<\/\s*script>$/))
- return;
-
- var raw_events = r.endSavingLinesAndGetResult();
-
- // Drop off first and last event as it contains the end script tag.
- raw_events = raw_events.slice(1, raw_events.length - 1);
- var data64 = raw_events.join('\n');
- var buffer = new ArrayBuffer(
- tr.b.Base64.getDecodedBufferLength(data64));
- var len = tr.b.Base64.DecodeToTypedArray(data64, new DataView(buffer));
- Trace2HTMLImporter.subtraces_.push(buffer.slice(0, len));
- }
- }
-
- function _canImportFromHTML(text) {
- if (/^<!DOCTYPE html>/.test(text) === false)
- return false;
-
- // Try to find viewer-data...
- _extractEventsFromHTML(text);
- if (Trace2HTMLImporter.subtraces_.length === 0)
- return false;
- return true;
- }
-
- Trace2HTMLImporter.canImport = function(events) {
- return _canImportFromHTML(events);
- };
-
- Trace2HTMLImporter.prototype = {
- __proto__: tr.importer.Importer.prototype,
-
- get importerName() {
- return 'Trace2HTMLImporter';
- },
-
- isTraceDataContainer: function() {
- return true;
- },
-
- extractSubtraces: function() {
- return Trace2HTMLImporter.subtraces_;
- },
-
- importEvents: function() {
- }
- };
-
-
- tr.importer.Importer.register(Trace2HTMLImporter);
-
-
- return {
- Trace2HTMLImporter: Trace2HTMLImporter
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace2html_importer_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/trace2html_importer_test.html
deleted file mode 100644
index 8d91c1494a7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace2html_importer_test.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="improt" href="/tracing/base/base64.html">
-<link rel="import" href="/tracing/extras/importer/trace2html_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Base64 = tr.b.Base64;
-
- test('simple', function() {
- var html_lines = [
- '<!DOCTYPE html>',
- '<script id="viewer-data" type="application/json">',
- Base64.btoa('hello'),
- '<\/script>',
- '<script id="viewer-data" type="text/plain">',
- Base64.btoa('world'),
- '<\/script>',
- '</html>'
- ];
- var html_text = html_lines.join('\n');
- assert.isTrue(tr.e.importer.Trace2HTMLImporter.canImport(html_text));
-
- var m = new tr.Model();
- var imp = new tr.e.importer.Trace2HTMLImporter(m, html_text);
- var subTracesAsBuffers = imp.extractSubtraces();
- var subTracesAsStrings = subTracesAsBuffers.map(function(buffer) {
- var str = '';
- var ary = new Uint8Array(buffer);
- for (var i = 0; i < ary.length; i++)
- str += String.fromCharCode(ary[i]);
- return str;
- });
- assert.deepEqual(subTracesAsStrings, ['hello', 'world']);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_code_entry.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_code_entry.html
deleted file mode 100644
index 8216b613c16..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_code_entry.html
+++ /dev/null
@@ -1,129 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/source_info/js_source_info.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview TraceCodeEntry is a wrapper around the V8 CodeEntry that
- * extracts extra context information for each item. This includes things like
- * the source file, line and if the function is a native method or not.
- */
-tr.exportTo('tr.e.importer', function() {
- function TraceCodeEntry(address, size, name, scriptId) {
- this.id_ = tr.b.GUID.allocateSimple();
- this.address_ = address;
- this.size_ = size;
-
- // Stolen from DevTools TimelineJSProfileProcessor._buildCallFrame
- // Code states:
- // (empty) -> compiled
- // ~ -> optimizable
- // * -> optimized
- var rePrefix = /^(\w*:)?([*~]?)(.*)$/m;
- var tokens = rePrefix.exec(name);
- var prefix = tokens[1];
- var state = tokens[2];
- var body = tokens[3];
-
- if (state === '*') {
- state = tr.model.source_info.JSSourceState.OPTIMIZED;
- } else if (state === '~') {
- state = tr.model.source_info.JSSourceState.OPTIMIZABLE;
- } else if (state === '') {
- state = tr.model.source_info.JSSourceState.COMPILED;
- } else {
- console.warning('Unknown v8 code state ' + state);
- state = tr.model.source_info.JSSourceState.UNKNOWN;
- }
-
- var rawName;
- var rawUrl;
- if (prefix === 'Script:') {
- rawName = '';
- rawUrl = body;
- } else {
- var spacePos = body.lastIndexOf(' ');
- rawName = spacePos !== -1 ? body.substr(0, spacePos) : body;
- rawUrl = spacePos !== -1 ? body.substr(spacePos + 1) : '';
- }
-
- function splitLineAndColumn(url) {
- var lineColumnRegEx = /(?::(\d+))?(?::(\d+))?$/;
- var lineColumnMatch = lineColumnRegEx.exec(url);
- var lineNumber;
- var columnNumber;
-
- if (typeof(lineColumnMatch[1]) === 'string') {
- lineNumber = parseInt(lineColumnMatch[1], 10);
- // Immediately convert line and column to 0-based numbers.
- lineNumber = isNaN(lineNumber) ? undefined : lineNumber - 1;
- }
- if (typeof(lineColumnMatch[2]) === 'string') {
- columnNumber = parseInt(lineColumnMatch[2], 10);
- columnNumber = isNaN(columnNumber) ? undefined : columnNumber - 1;
- }
-
- return {
- url: url.substring(0, url.length - lineColumnMatch[0].length),
- lineNumber: lineNumber,
- columnNumber: columnNumber
- };
- }
-
- var nativeSuffix = ' native';
- var isNative = rawName.endsWith(nativeSuffix);
- this.name_ =
- isNative ? rawName.slice(0, -nativeSuffix.length) : rawName;
-
- var urlData = splitLineAndColumn(rawUrl);
- var url = urlData.url || '';
- var line = urlData.lineNumber || 0;
- var column = urlData.columnNumber || 0;
-
- this.sourceInfo_ = new tr.model.source_info.JSSourceInfo(
- url, line, column, isNative, scriptId, state);
- };
-
- TraceCodeEntry.prototype = {
- get id() {
- return this.id_;
- },
-
- get sourceInfo() {
- return this.sourceInfo_;
- },
-
- get name() {
- return this.name_;
- },
-
- set address(address) {
- this.address_ = address;
- },
-
- get address() {
- return this.address_;
- },
-
- set size(size) {
- this.size_ = size;
- },
-
- get size() {
- return this.size_;
- }
- };
-
- return {
- TraceCodeEntry: TraceCodeEntry
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_code_entry_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_code_entry_test.html
deleted file mode 100644
index 917081c7fb7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_code_entry_test.html
+++ /dev/null
@@ -1,124 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/trace_code_entry.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('lazy_compile_method', function() {
- var tce = new tr.e.importer.TraceCodeEntry(
- '0x123', 10, 'Handler:timeStamp', 12);
- assert.equal(tce.size, 10);
- assert.equal(tce.name, 'timeStamp');
- assert.equal(tce.sourceInfo.isNative, false);
- assert.equal(tce.sourceInfo.file, '');
- assert.equal(tce.sourceInfo.line, -1);
- assert.equal(tce.sourceInfo.scriptId, 12);
- });
-
- test('non_lazy_compile_method', function() {
- var tce = new tr.e.importer.TraceCodeEntry(
- '0x123', 10, 'Handler:timeStamp', 12);
- assert.equal(tce.size, 10);
- assert.equal(tce.name, 'timeStamp');
- assert.equal(tce.sourceInfo.state, 'compiled');
- assert.equal(tce.sourceInfo.isNative, false);
- assert.equal(tce.sourceInfo.file, '');
- assert.equal(tce.sourceInfo.line, -1);
- assert.equal(tce.sourceInfo.scriptId, 12);
- });
-
- test('native_matching', function() {
- var tce = new tr.e.importer.TraceCodeEntry('0x123', 10,
- 'LazyCompile:~IsAccessorDescriptor native v8natives.js:183', 12);
- assert.equal(tce.size, 10);
- assert.equal(tce.name, 'IsAccessorDescriptor');
- assert.equal(tce.sourceInfo.isNative, true);
- assert.equal(tce.sourceInfo.state, 'optimizable');
- assert.equal(tce.sourceInfo.file, 'v8natives.js');
- assert.equal(tce.sourceInfo.line, 182);
- assert.equal(tce.sourceInfo.scriptId, 12);
- });
-
- test('strips_*_from_name', function() {
- var tce = new tr.e.importer.TraceCodeEntry('0x123', 10,
- 'LazyCompile:*IsAccessorDescriptor native v8natives.js:183', 12);
- assert.equal(tce.size, 10);
- assert.equal(tce.name, 'IsAccessorDescriptor');
- assert.equal(tce.sourceInfo.isNative, true);
- assert.equal(tce.sourceInfo.state, 'optimized');
- assert.equal(tce.sourceInfo.file, 'v8natives.js');
- assert.equal(tce.sourceInfo.line, 182);
- assert.equal(tce.sourceInfo.scriptId, 12);
- });
-
- test('non_native_matching', function() {
- var tce = new tr.e.importer.TraceCodeEntry('0x123', 10,
- 'LazyCompile:~IsAccessorDescriptor v8natives.js:183', 12);
- assert.equal(tce.size, 10);
- assert.equal(tce.name, 'IsAccessorDescriptor');
- assert.equal(tce.sourceInfo.isNative, false);
- assert.equal(tce.sourceInfo.file, 'v8natives.js');
- assert.equal(tce.sourceInfo.line, 182);
- assert.equal(tce.sourceInfo.scriptId, 12);
- });
-
- test('lazy_compile_without_script', function() {
- var tce = new tr.e.importer.TraceCodeEntry(
- '0x123', 10, 'LazyCompile:~Object', 12);
- assert.equal(tce.size, 10);
- assert.equal(tce.name, 'Object');
- assert.equal(tce.sourceInfo.isNative, false);
- assert.equal(tce.sourceInfo.file, '');
- assert.equal(tce.sourceInfo.line, -1);
- assert.equal(tce.sourceInfo.scriptId, 12);
- });
-
- test('line_matching_without_script', function() {
- var tce = new tr.e.importer.TraceCodeEntry('0x123', 10,
- 'LazyCompile:~Object :220', 12);
- assert.equal(tce.size, 10);
- assert.equal(tce.name, 'Object');
- assert.equal(tce.sourceInfo.isNative, false);
- assert.equal(tce.sourceInfo.file, '');
- assert.equal(tce.sourceInfo.line, 219);
- assert.equal(tce.sourceInfo.scriptId, 12);
- });
-
- test('unknown_method_name', function() {
- var tce = new tr.e.importer.TraceCodeEntry('0x123', 10, 'LazyCompile:', 12);
- assert.equal(tce.size, 10);
- assert.equal(tce.name, '');
- assert.equal(tce.sourceInfo.isNative, false);
- assert.equal(tce.sourceInfo.file, '');
- assert.equal(tce.sourceInfo.line, -1);
- assert.equal(tce.sourceInfo.scriptId, 12);
-
- var tce = new tr.e.importer.TraceCodeEntry(
- '0x123', 10, 'LazyCompile:~ :37', 12);
- assert.equal(tce.size, 10);
- assert.equal(tce.name, '');
- assert.equal(tce.sourceInfo.isNative, false);
- assert.equal(tce.sourceInfo.file, '');
- assert.equal(tce.sourceInfo.line, 36);
- assert.equal(tce.sourceInfo.scriptId, 12);
-
- var tce = new tr.e.importer.TraceCodeEntry('0x123', 10,
- 'LazyCompile:~ native liveedit.js:37:10', 12);
- assert.equal(tce.size, 10);
- assert.equal(tce.name, '');
- assert.equal(tce.sourceInfo.isNative, true);
- assert.equal(tce.sourceInfo.file, 'liveedit.js');
- assert.equal(tce.sourceInfo.line, 36);
- assert.equal(tce.sourceInfo.column, 9);
- assert.equal(tce.sourceInfo.scriptId, 12);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_code_map.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_code_map.html
deleted file mode 100644
index dbdfecbd3e4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_code_map.html
+++ /dev/null
@@ -1,127 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel='import' href='/tracing/extras/importer/trace_code_entry.html'>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.importer', function() {
- // This code is a tracification of:
- // devtools/front_end/timeline/TimelineJSProfile.js
- function TraceCodeMap() {
- this.banks_ = new Map();
- }
-
- TraceCodeMap.prototype = {
- addEntry: function(addressHex, size, name, scriptId) {
- var entry = new tr.e.importer.TraceCodeEntry(
- this.getAddress_(addressHex), size, name, scriptId);
-
- this.addEntry_(addressHex, entry);
- },
-
- moveEntry: function(oldAddressHex, newAddressHex, size) {
- var entry = this.getBank_(oldAddressHex)
- .removeEntry(this.getAddress_(oldAddressHex));
- if (!entry)
- return;
-
- entry.address = this.getAddress_(newAddressHex);
- entry.size = size;
- this.addEntry_(newAddressHex, entry);
- },
-
- lookupEntry: function(addressHex) {
- return this.getBank_(addressHex)
- .lookupEntry(this.getAddress_(addressHex));
- },
-
- addEntry_: function(addressHex, entry) {
- // FIXME: Handle bank spanning addresses ...
- this.getBank_(addressHex).addEntry(entry);
- },
-
- getAddress_: function(addressHex) {
- // 13 hex digits == 52 bits, double mantissa fits 53 bits.
- var bankSizeHexDigits = 13;
- addressHex = addressHex.slice(2); // cut 0x prefix.
- return parseInt(addressHex.slice(-bankSizeHexDigits), 16);
- },
-
- getBank_: function(addressHex) {
- addressHex = addressHex.slice(2); // cut 0x prefix.
-
- // 13 hex digits == 52 bits, double mantissa fits 53 bits.
- var bankSizeHexDigits = 13;
- var maxHexDigits = 16;
- var bankName = addressHex.slice(-maxHexDigits, -bankSizeHexDigits);
- var bank = this.banks_.get(bankName);
- if (!bank) {
- bank = new TraceCodeBank();
- this.banks_.set(bankName, bank);
- }
- return bank;
- }
- };
-
- function TraceCodeBank() {
- this.entries_ = [];
- }
-
- TraceCodeBank.prototype = {
- removeEntry: function(address) {
- // findLowIndexInSortedArray returns 1 for empty. Just handle the
- // empty list and bail early.
- if (this.entries_.length === 0)
- return undefined;
-
- var index = tr.b.findLowIndexInSortedArray(
- this.entries_, function(entry) { return entry.address; }, address);
- var entry = this.entries_[index];
- if (!entry || entry.address !== address)
- return undefined;
-
- this.entries_.splice(index, 1);
- return entry;
- },
-
- lookupEntry: function(address) {
- var index = tr.b.findHighIndexInSortedArray(
- this.entries_, function(e) { return address - e.address; }) - 1;
- var entry = this.entries_[index];
- return entry &&
- address < entry.address + entry.size ? entry : undefined;
- },
-
- addEntry: function(newEntry) {
- // findLowIndexInSortedArray returns 1 for empty list. Just push the
- // new address as it's the only item.
- if (this.entries_.length === 0)
- this.entries_.push(newEntry);
-
- var endAddress = newEntry.address + newEntry.size;
- var lastIndex = tr.b.findLowIndexInSortedArray(
- this.entries_, function(entry) { return entry.address; }, endAddress);
- var index;
- for (index = lastIndex - 1; index >= 0; --index) {
- var entry = this.entries_[index];
- var entryEndAddress = entry.address + entry.size;
- if (entryEndAddress <= newEntry.address)
- break;
- }
- ++index;
- this.entries_.splice(index, lastIndex - index, newEntry);
- }
- };
-
- return {
- TraceCodeMap: TraceCodeMap
- };
-});
-
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer.html
deleted file mode 100644
index b7cf2badef2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer.html
+++ /dev/null
@@ -1,2989 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base64.html">
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_code_entry.html">
-<link rel="import" href="/tracing/extras/importer/trace_code_map.html">
-<link rel="import" href="/tracing/extras/importer/v8/codemap.html">
-<link rel="import" href="/tracing/importer/context_processor.html">
-<link rel="import" href="/tracing/importer/importer.html">
-<link rel="import" href="/tracing/model/comment_box_annotation.html">
-<link rel="import" href="/tracing/model/constants.html">
-<link rel="import" href="/tracing/model/container_memory_dump.html">
-<link rel="import" href="/tracing/model/counter_series.html">
-<link rel="import" href="/tracing/model/flow_event.html">
-<link rel="import" href="/tracing/model/global_memory_dump.html">
-<link rel="import" href="/tracing/model/heap_dump.html">
-<link rel="import" href="/tracing/model/instant_event.html">
-<link rel="import" href="/tracing/model/memory_allocator_dump.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/process_memory_dump.html">
-<link rel="import" href="/tracing/model/rect_annotation.html">
-<link rel="import" href="/tracing/model/scoped_id.html">
-<link rel="import" href="/tracing/model/slice_group.html">
-<link rel="import" href="/tracing/model/vm_region.html">
-<link rel="import" href="/tracing/model/x_marker_annotation.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview TraceEventImporter imports TraceEvent-formatted data
- * into the provided model.
- */
-tr.exportTo('tr.e.importer', function() {
- var Base64 = tr.b.Base64;
- var deepCopy = tr.b.deepCopy;
- var ColorScheme = tr.b.ColorScheme;
-
- function getEventColor(event, opt_customName) {
- if (event.cname)
- return ColorScheme.getColorIdForReservedName(event.cname);
- else if (opt_customName || event.name) {
- return ColorScheme.getColorIdForGeneralPurposeString(
- opt_customName || event.name);
- }
- }
-
- var timestampFromUs = tr.v.Unit.timestampFromUs;
- var maybeTimestampFromUs = tr.v.Unit.maybeTimestampFromUs;
-
- var PRODUCER = 'producer';
- var CONSUMER = 'consumer';
- var STEP = 'step';
-
- var LIGHT = tr.model.ContainerMemoryDump.LevelOfDetail.LIGHT;
- var DETAILED = tr.model.ContainerMemoryDump.LevelOfDetail.DETAILED;
- var MEMORY_DUMP_LEVEL_OF_DETAIL_ORDER = [undefined, LIGHT, DETAILED];
-
- var GLOBAL_MEMORY_ALLOCATOR_DUMP_PREFIX = 'global/';
-
- // Map from raw memory dump byte stat names to model byte stat names. See
- // //base/trace_event/process_memory_maps.cc in Chromium.
- var BYTE_STAT_NAME_MAP = {
- 'pc': 'privateCleanResident',
- 'pd': 'privateDirtyResident',
- 'sc': 'sharedCleanResident',
- 'sd': 'sharedDirtyResident',
- 'pss': 'proportionalResident',
- 'sw': 'swapped'
- };
-
- // See tr.model.MemoryAllocatorDump 'weak' field and
- // base::trace_event::MemoryAllocatorDump::Flags::WEAK in the Chromium
- // codebase.
- var WEAK_MEMORY_ALLOCATOR_DUMP_FLAG = 1 << 0;
-
- // Object type name patterns for various compilers.
- var OBJECT_TYPE_NAME_PATTERNS = [
- {
- // Clang.
- prefix: 'const char *WTF::getStringWithTypeName() [T = ',
- suffix: ']'
- },
- {
- // GCC.
- prefix: 'const char* WTF::getStringWithTypeName() [with T = ',
- suffix: ']'
- },
- {
- // Microsoft Visual C++
- prefix: 'const char *__cdecl WTF::getStringWithTypeName<',
- suffix: '>(void)'
- }
- ];
-
- // The list of fields on the trace that are known to contain subtraces.
- var SUBTRACE_FIELDS = new Set([
- 'powerTraceAsString',
- 'systemTraceEvents',
- ]);
-
- // The complete list of fields on the trace that should not be treated as
- // trace metadata.
- var NON_METADATA_FIELDS = new Set([
- 'samples',
- 'stackFrames',
- 'traceAnnotations',
- 'traceEvents'
- ]);
- // TODO(charliea): Replace this with the spread (...) operator in literal
- // above once v8 is updated to a sufficiently recent version (>M45).
- for (var subtraceField in SUBTRACE_FIELDS)
- NON_METADATA_FIELDS.add(subtraceField);
-
- function TraceEventImporter(model, eventData) {
- this.importPriority = 1;
- this.model_ = model;
- this.events_ = undefined;
- this.sampleEvents_ = undefined;
- this.stackFrameEvents_ = undefined;
- this.subtraces_ = [];
- this.eventsWereFromString_ = false;
- this.softwareMeasuredCpuCount_ = undefined;
-
- this.allAsyncEvents_ = [];
- this.allFlowEvents_ = [];
- this.allObjectEvents_ = [];
-
- this.contextProcessorPerThread = {};
-
- this.traceEventSampleStackFramesByName_ = {};
-
- this.v8ProcessCodeMaps_ = {};
- this.v8ProcessRootStackFrame_ = {};
- this.v8SamplingData_ = [];
-
- // Dump ID -> PID -> [process memory dump events].
- this.allMemoryDumpEvents_ = {};
-
- // PID -> Object type ID -> Object type name.
- this.objectTypeNameMap_ = {};
-
- // For old Chrome traces with no clock domain metadata, just use a
- // placeholder clock domain.
- this.clockDomainId_ = tr.model.ClockDomainId.UNKNOWN_CHROME_LEGACY;
-
- if (typeof(eventData) === 'string' || eventData instanceof String) {
- eventData = eventData.trim();
- // If the event data begins with a [, then we know it should end with a ].
- // The reason we check for this is because some tracing implementations
- // cannot guarantee that a ']' gets written to the trace file. So, we are
- // forgiving and if this is obviously the case, we fix it up before
- // throwing the string at JSON.parse.
- if (eventData[0] === '[') {
- eventData = eventData.replace(/\s*,\s*$/, '');
- if (eventData[eventData.length - 1] !== ']')
- eventData = eventData + ']';
- }
-
- this.events_ = JSON.parse(eventData);
- this.eventsWereFromString_ = true;
- } else {
- this.events_ = eventData;
- }
-
- this.traceAnnotations_ = this.events_.traceAnnotations;
-
- // Some trace_event implementations put the actual trace events
- // inside a container. E.g { ... , traceEvents: [ ] }
- // If we see that, just pull out the trace events.
- if (this.events_.traceEvents) {
- var container = this.events_;
- this.events_ = this.events_.traceEvents;
-
- // Some trace authors store subtraces as specific properties of the trace.
- for (var subtraceField of SUBTRACE_FIELDS)
- if (container[subtraceField])
- this.subtraces_.push(container[subtraceField]);
-
- // Sampling data.
- this.sampleEvents_ = container.samples;
- this.stackFrameEvents_ = container.stackFrames;
-
- // Some implementations specify displayTimeUnit
- if (container.displayTimeUnit) {
- var unitName = container.displayTimeUnit;
- var unit = tr.v.TimeDisplayModes[unitName];
- if (unit === undefined) {
- throw new Error('Unit ' + unitName + ' is not supported.');
- }
- this.model_.intrinsicTimeUnit = unit;
- }
-
- // Any other fields in the container should be treated as metadata.
- for (var fieldName in container) {
- if (NON_METADATA_FIELDS.has(fieldName))
- continue;
-
- this.model_.metadata.push(
- { name: fieldName, value: container[fieldName] });
-
- if (fieldName === 'metadata') {
- var metadata = container[fieldName];
- if (metadata['highres-ticks'])
- this.model_.isTimeHighResolution = metadata['highres-ticks'];
- if (metadata['clock-domain'])
- this.clockDomainId_ = metadata['clock-domain'];
- }
- }
- }
- }
-
- /**
- * @return {boolean} Whether obj is a TraceEvent array.
- */
- TraceEventImporter.canImport = function(eventData) {
- // May be encoded JSON. But we dont want to parse it fully yet.
- // Use a simple heuristic:
- // - eventData that starts with [ are probably trace_event
- // - eventData that starts with { are probably trace_event
- // May be encoded JSON. Treat files that start with { as importable by us.
- if (typeof(eventData) === 'string' || eventData instanceof String) {
- eventData = eventData.trim();
- return eventData[0] === '{' || eventData[0] === '[';
- }
-
- // Might just be an array of events
- if (eventData instanceof Array && eventData.length && eventData[0].ph)
- return true;
-
- // Might be an object with a traceEvents field in it.
- if (eventData.traceEvents) {
- if (eventData.traceEvents instanceof Array) {
- if (eventData.traceEvents.length && eventData.traceEvents[0].ph)
- return true;
- if (eventData.samples.length && eventData.stackFrames !== undefined)
- return true;
- }
- }
-
- return false;
- };
-
- TraceEventImporter.prototype = {
- __proto__: tr.importer.Importer.prototype,
-
- get importerName() {
- return 'TraceEventImporter';
- },
-
- extractSubtraces: function() {
- // Because subtraces can be quite large, we need to make sure that we
- // don't hold a reference to the memory.
- var subtraces = this.subtraces_;
- this.subtraces_ = [];
- return subtraces;
- },
-
- /**
- * Deep copying is only needed if the trace was given to us as events.
- */
- deepCopyIfNeeded_: function(obj) {
- if (obj === undefined)
- obj = {};
- if (this.eventsWereFromString_)
- return obj;
- return deepCopy(obj);
- },
-
- /**
- * Always perform deep copying.
- */
- deepCopyAlways_: function(obj) {
- if (obj === undefined)
- obj = {};
- return deepCopy(obj);
- },
-
- /**
- * Helper to process an async event.
- */
- processAsyncEvent: function(event) {
- var thread = this.model_.getOrCreateProcess(event.pid).
- getOrCreateThread(event.tid);
- this.allAsyncEvents_.push({
- sequenceNumber: this.allAsyncEvents_.length,
- event: event,
- thread: thread
- });
- },
-
- /**
- * Helper to process a flow event.
- */
- processFlowEvent: function(event, opt_slice) {
- var thread = this.model_.getOrCreateProcess(event.pid).
- getOrCreateThread(event.tid);
- this.allFlowEvents_.push({
- refGuid: tr.b.GUID.getLastSimpleGuid(),
- sequenceNumber: this.allFlowEvents_.length,
- event: event,
- slice: opt_slice, // slice for events that have flow info
- thread: thread
- });
- },
-
- /**
- * Helper that creates and adds samples to a Counter object based on
- * 'C' phase events.
- */
- processCounterEvent: function(event) {
- var ctr_name;
- if (event.id !== undefined)
- ctr_name = event.name + '[' + event.id + ']';
- else
- ctr_name = event.name;
-
- var ctr = this.model_.getOrCreateProcess(event.pid)
- .getOrCreateCounter(event.cat, ctr_name);
- var reservedColorId = event.cname ? getEventColor(event) : undefined;
-
- // Initialize the counter's series fields if needed.
- if (ctr.numSeries === 0) {
- for (var seriesName in event.args) {
- var colorId = reservedColorId ||
- getEventColor(event, ctr.name + '.' + seriesName);
- ctr.addSeries(new tr.model.CounterSeries(seriesName, colorId));
- }
-
- if (ctr.numSeries === 0) {
- this.model_.importWarning({
- type: 'counter_parse_error',
- message: 'Expected counter ' + event.name +
- ' to have at least one argument to use as a value.'
- });
-
- // Drop the counter.
- delete ctr.parent.counters[ctr.name];
- return;
- }
- }
-
- var ts = timestampFromUs(event.ts);
- ctr.series.forEach(function(series) {
- var val = event.args[series.name] ? event.args[series.name] : 0;
- series.addCounterSample(ts, val);
- });
- },
-
- scopedIdForEvent_: function(event) {
- return new tr.model.ScopedId(
- event.scope || tr.model.OBJECT_DEFAULT_SCOPE, event.id);
- },
-
- processObjectEvent: function(event) {
- var thread = this.model_.getOrCreateProcess(event.pid).
- getOrCreateThread(event.tid);
- this.allObjectEvents_.push({
- sequenceNumber: this.allObjectEvents_.length,
- event: event,
- thread: thread});
- if (thread.guid in this.contextProcessorPerThread) {
- var processor = this.contextProcessorPerThread[thread.guid];
- var scopedId = this.scopedIdForEvent_(event);
- if (event.ph === 'D')
- processor.destroyContext(scopedId);
- // The context processor maintains a cache of unique context objects and
- // active context sets to reduce memory usage. If an object is modified,
- // we should invalidate this cache, because otherwise context sets from
- // before and after the modification may erroneously point to the same
- // context snapshot (as both are the same set/object instances).
- processor.invalidateContextCacheForSnapshot(scopedId);
- }
- },
-
- processContextEvent: function(event) {
- var thread = this.model_.getOrCreateProcess(event.pid).
- getOrCreateThread(event.tid);
- if (!(thread.guid in this.contextProcessorPerThread)) {
- this.contextProcessorPerThread[thread.guid] =
- new tr.importer.ContextProcessor(this.model_);
- }
- var scopedId = this.scopedIdForEvent_(event);
- var contextType = event.name;
- var processor = this.contextProcessorPerThread[thread.guid];
- if (event.ph === '(') {
- processor.enterContext(contextType, scopedId);
- } else if (event.ph === ')') {
- processor.leaveContext(contextType, scopedId);
- } else {
- this.model_.importWarning({
- type: 'unknown_context_phase',
- message: 'Unknown context event phase: ' + event.ph + '.'
- });
- }
- },
-
- setContextsFromThread_: function(thread, slice) {
- if (thread.guid in this.contextProcessorPerThread) {
- slice.contexts =
- this.contextProcessorPerThread[thread.guid].activeContexts;
- }
- },
-
- processDurationEvent: function(event) {
- var thread = this.model_.getOrCreateProcess(event.pid)
- .getOrCreateThread(event.tid);
- var ts = timestampFromUs(event.ts);
- if (!thread.sliceGroup.isTimestampValidForBeginOrEnd(ts)) {
- this.model_.importWarning({
- type: 'duration_parse_error',
- message: 'Timestamps are moving backward.'
- });
- return;
- }
-
- if (event.ph === 'B') {
- var slice = thread.sliceGroup.beginSlice(
- event.cat, event.name, timestampFromUs(event.ts),
- this.deepCopyIfNeeded_(event.args),
- timestampFromUs(event.tts), event.argsStripped,
- getEventColor(event));
- slice.startStackFrame = this.getStackFrameForEvent_(event);
- this.setContextsFromThread_(thread, slice);
- } else if (event.ph === 'I' || event.ph === 'i' || event.ph === 'R') {
- if (event.s !== undefined && event.s !== 't')
- throw new Error('This should never happen');
-
- thread.sliceGroup.beginSlice(event.cat, event.name,
- timestampFromUs(event.ts),
- this.deepCopyIfNeeded_(event.args),
- timestampFromUs(event.tts),
- event.argsStripped,
- getEventColor(event));
- var slice = thread.sliceGroup.endSlice(timestampFromUs(event.ts),
- timestampFromUs(event.tts));
- slice.startStackFrame = this.getStackFrameForEvent_(event);
- slice.endStackFrame = undefined;
- } else {
- if (!thread.sliceGroup.openSliceCount) {
- this.model_.importWarning({
- type: 'duration_parse_error',
- message: 'E phase event without a matching B phase event.'
- });
- return;
- }
-
- var slice = thread.sliceGroup.endSlice(timestampFromUs(event.ts),
- timestampFromUs(event.tts),
- getEventColor(event));
- if (event.name && slice.title != event.name) {
- this.model_.importWarning({
- type: 'title_match_error',
- message: 'Titles do not match. Title is ' +
- slice.title + ' in openSlice, and is ' +
- event.name + ' in endSlice'
- });
- }
- slice.endStackFrame = this.getStackFrameForEvent_(event);
-
- this.mergeArgsInto_(slice.args, event.args, slice.title);
- }
- },
-
- mergeArgsInto_: function(dstArgs, srcArgs, eventName) {
- for (var arg in srcArgs) {
- if (dstArgs[arg] !== undefined) {
- this.model_.importWarning({
- type: 'arg_merge_error',
- message: 'Different phases of ' + eventName +
- ' provided values for argument ' + arg + '.' +
- ' The last provided value will be used.'
- });
- }
- dstArgs[arg] = this.deepCopyIfNeeded_(srcArgs[arg]);
- }
- },
-
- processCompleteEvent: function(event) {
- // Preventing the overhead slices from making it into the model. This
- // only applies to legacy traces, as the overhead traces have been
- // removed from the chromium code.
- if (event.cat !== undefined &&
- event.cat.indexOf('trace_event_overhead') > -1)
- return undefined;
-
- var thread = this.model_.getOrCreateProcess(event.pid)
- .getOrCreateThread(event.tid);
-
- if (event.flow_out) {
- if (event.flow_in)
- event.flowPhase = STEP;
- else
- event.flowPhase = PRODUCER;
- } else if (event.flow_in) {
- event.flowPhase = CONSUMER;
- }
-
- var slice = thread.sliceGroup.pushCompleteSlice(event.cat, event.name,
- timestampFromUs(event.ts),
- maybeTimestampFromUs(event.dur),
- maybeTimestampFromUs(event.tts),
- maybeTimestampFromUs(event.tdur),
- this.deepCopyIfNeeded_(event.args),
- event.argsStripped,
- getEventColor(event),
- event.bind_id);
- slice.startStackFrame = this.getStackFrameForEvent_(event);
- slice.endStackFrame = this.getStackFrameForEvent_(event, true);
- this.setContextsFromThread_(thread, slice);
-
- return slice;
- },
-
- processJitCodeEvent: function(event) {
- if (this.v8ProcessCodeMaps_[event.pid] === undefined)
- this.v8ProcessCodeMaps_[event.pid] = new tr.e.importer.TraceCodeMap();
- var map = this.v8ProcessCodeMaps_[event.pid];
-
- var data = event.args.data;
- // TODO(dsinclair): There are _a lot_ of JitCode events so I'm skipping
- // the display for now. Can revisit later if we want to show them.
- // Handle JitCodeMoved and JitCodeAdded event.
- if (event.name === 'JitCodeMoved')
- map.moveEntry(data.code_start, data.new_code_start, data.code_len);
- else // event.name === 'JitCodeAdded'
- map.addEntry(data.code_start, data.code_len, data.name, data.script_id);
- },
-
- processMetadataEvent: function(event) {
- // V8 JIT events are currently logged as phase 'M' so we need to
- // separate them out and handle specially.
- if (event.name === 'JitCodeAdded' || event.name === 'JitCodeMoved') {
- this.v8SamplingData_.push(event);
- return;
- }
-
- // The metadata events aren't useful without args.
- if (event.argsStripped)
- return;
-
- if (event.name === 'process_name') {
- var process = this.model_.getOrCreateProcess(event.pid);
- process.name = event.args.name;
- } else if (event.name === 'process_labels') {
- var process = this.model_.getOrCreateProcess(event.pid);
- var labels = event.args.labels.split(',');
- for (var i = 0; i < labels.length; i++)
- process.addLabelIfNeeded(labels[i]);
- } else if (event.name === 'process_sort_index') {
- var process = this.model_.getOrCreateProcess(event.pid);
- process.sortIndex = event.args.sort_index;
- } else if (event.name === 'thread_name') {
- var thread = this.model_.getOrCreateProcess(event.pid).
- getOrCreateThread(event.tid);
- thread.name = event.args.name;
- } else if (event.name === 'thread_sort_index') {
- var thread = this.model_.getOrCreateProcess(event.pid).
- getOrCreateThread(event.tid);
- thread.sortIndex = event.args.sort_index;
- } else if (event.name === 'num_cpus') {
- var n = event.args.number;
- // Not all render processes agree on the cpu count in trace_event. Some
- // processes will report 1, while others will report the actual cpu
- // count. To deal with this, take the max of what is reported.
- if (this.softwareMeasuredCpuCount_ !== undefined)
- n = Math.max(n, this.softwareMeasuredCpuCount_);
- this.softwareMeasuredCpuCount_ = n;
- } else if (event.name === 'stackFrames') {
- var stackFrames = event.args.stackFrames;
- if (stackFrames === undefined) {
- this.model_.importWarning({
- type: 'metadata_parse_error',
- message: 'No stack frames found in a \'' + event.name +
- '\' metadata event'
- });
- } else {
- this.importStackFrames_(stackFrames, 'p' + event.pid + ':');
- }
- } else if (event.name === 'typeNames') {
- var objectTypeNameMap = event.args.typeNames;
- if (objectTypeNameMap === undefined) {
- this.model_.importWarning({
- type: 'metadata_parse_error',
- message: 'No mapping from object type IDs to names found in a \'' +
- event.name + '\' metadata event'
- });
- } else {
- this.importObjectTypeNameMap_(objectTypeNameMap, event.pid);
- }
- } else if (event.name === 'TraceConfig') {
- this.model_.metadata.push(
- {name: 'TraceConfig', value: event.args.value});
- } else {
- this.model_.importWarning({
- type: 'metadata_parse_error',
- message: 'Unrecognized metadata name: ' + event.name
- });
- }
- },
-
- processInstantEvent: function(event) {
- // V8 JIT events were logged as phase 'I' in the old format,
- // so we need to separate them out and handle specially.
- if (event.name === 'JitCodeAdded' || event.name === 'JitCodeMoved') {
- this.v8SamplingData_.push(event);
- return;
- }
-
- // Thread-level instant events are treated as zero-duration slices.
- if (event.s === 't' || event.s === undefined) {
- this.processDurationEvent(event);
- return;
- }
-
- var constructor;
- switch (event.s) {
- case 'g':
- constructor = tr.model.GlobalInstantEvent;
- break;
- case 'p':
- constructor = tr.model.ProcessInstantEvent;
- break;
- default:
- this.model_.importWarning({
- type: 'instant_parse_error',
- message: 'I phase event with unknown "s" field value.'
- });
- return;
- }
-
- var instantEvent = new constructor(event.cat, event.name,
- getEventColor(event), timestampFromUs(event.ts),
- this.deepCopyIfNeeded_(event.args));
-
- switch (instantEvent.type) {
- case tr.model.InstantEventType.GLOBAL:
- this.model_.instantEvents.push(instantEvent);
- break;
-
- case tr.model.InstantEventType.PROCESS:
- var process = this.model_.getOrCreateProcess(event.pid);
- process.instantEvents.push(instantEvent);
- break;
-
- default:
- throw new Error('Unknown instant event type: ' + event.s);
- }
- },
-
- processV8Sample: function(event) {
- var data = event.args.data;
-
- // As-per DevTools, the backend sometimes creates bogus samples. Skip it.
- if (data.vm_state === 'js' && !data.stack.length)
- return;
-
- var rootStackFrame = this.v8ProcessRootStackFrame_[event.pid];
- if (!rootStackFrame) {
- rootStackFrame = new tr.model.StackFrame(
- undefined /* parent */, 'v8-root-stack-frame' /* id */,
- 'v8-root-stack-frame' /* title */, 0 /* colorId */);
- this.v8ProcessRootStackFrame_[event.pid] = rootStackFrame;
- }
-
- function findChildWithEntryID(stackFrame, entryID) {
- return tr.b.findFirstInArray(stackFrame.children, function(child) {
- return child.entryID === entryID;
- });
- }
-
- var model = this.model_;
- function addStackFrame(lastStackFrame, entry) {
- var childFrame = findChildWithEntryID(lastStackFrame, entry.id);
- if (childFrame)
- return childFrame;
-
- var frame = new tr.model.StackFrame(
- lastStackFrame, tr.b.GUID.allocateSimple(), entry.name,
- ColorScheme.getColorIdForGeneralPurposeString(entry.name),
- entry.sourceInfo);
-
- frame.entryID = entry.id;
- model.addStackFrame(frame);
- return frame;
- }
-
- var lastStackFrame = rootStackFrame;
-
- // There are several types of v8 sample events, gc, native, compiler, etc.
- // Some of these types have stacks and some don't, we handle those two
- // cases differently. For types that don't have any stack frames attached
- // we synthesize one based on the type of thing that's happening so when
- // we view all the samples we'll see something like 'external' or 'gc'
- // as a fraction of the time spent.
- if (data.stack.length > 0 && this.v8ProcessCodeMaps_[event.pid]) {
- var map = this.v8ProcessCodeMaps_[event.pid];
-
- // Stacks have the leaf node first, flip them around so the root
- // comes first.
- data.stack.reverse();
-
- for (var i = 0; i < data.stack.length; i++) {
- var entry = map.lookupEntry(data.stack[i]);
- if (entry === undefined) {
- entry = {
- id: 'unknown',
- name: 'unknown',
- sourceInfo: undefined
- };
- }
-
- lastStackFrame = addStackFrame(lastStackFrame, entry);
- }
- } else {
- var entry = {
- id: data.vm_state,
- name: data.vm_state,
- sourceInfo: undefined
- };
- lastStackFrame = addStackFrame(lastStackFrame, entry);
- }
-
- var thread = this.model_.getOrCreateProcess(event.pid)
- .getOrCreateThread(event.tid);
-
- var sample = new tr.model.Sample(
- undefined /* cpu */, thread, 'V8 Sample',
- timestampFromUs(event.ts), lastStackFrame, 1 /* weight */,
- this.deepCopyIfNeeded_(event.args));
- this.model_.samples.push(sample);
- },
-
- processTraceSampleEvent: function(event) {
- if (event.name === 'V8Sample') {
- this.v8SamplingData_.push(event);
- return;
- }
-
- var stackFrame = this.getStackFrameForEvent_(event);
- if (stackFrame === undefined) {
- stackFrame = this.traceEventSampleStackFramesByName_[
- event.name];
- }
- if (stackFrame === undefined) {
- var id = 'te-' + tr.b.GUID.allocateSimple();
- stackFrame = new tr.model.StackFrame(
- undefined, id, event.name,
- ColorScheme.getColorIdForGeneralPurposeString(event.name));
- this.model_.addStackFrame(stackFrame);
- this.traceEventSampleStackFramesByName_[event.name] = stackFrame;
- }
-
- var thread = this.model_.getOrCreateProcess(event.pid)
- .getOrCreateThread(event.tid);
-
- var sample = new tr.model.Sample(
- undefined, thread, 'Trace Event Sample',
- timestampFromUs(event.ts), stackFrame, 1,
- this.deepCopyIfNeeded_(event.args));
- this.setContextsFromThread_(thread, sample);
- this.model_.samples.push(sample);
- },
-
- processMemoryDumpEvent: function(event) {
- if (event.ph !== 'v')
- throw new Error('Invalid memory dump event phase "' + event.ph + '".');
-
- var dumpId = event.id;
- if (dumpId === undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Memory dump event (phase \'' + event.ph +
- '\') without a dump ID.'
- });
- return;
- }
-
- var pid = event.pid;
- if (pid === undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Memory dump event (phase\'' + event.ph + '\', dump ID \'' +
- dumpId + '\') without a PID.'
- });
- return;
- }
-
- // Dump ID -> PID -> [process memory dump events].
- var allEvents = this.allMemoryDumpEvents_;
-
- // PID -> [process memory dump events].
- var dumpIdEvents = allEvents[dumpId];
- if (dumpIdEvents === undefined)
- allEvents[dumpId] = dumpIdEvents = {};
-
- // [process memory dump events].
- var processEvents = dumpIdEvents[pid];
- if (processEvents === undefined)
- dumpIdEvents[pid] = processEvents = [];
-
- processEvents.push(event);
- },
-
- processClockSyncEvent: function(event) {
- if (event.ph !== 'c')
- throw new Error('Invalid clock sync event phase "' + event.ph + '".');
-
- var syncId = event.args.sync_id;
- if (syncId === undefined) {
- this.model_.importWarning({
- type: 'clock_sync_parse_error',
- message: 'Clock sync at time ' + event.ts + ' without an ID.'
- });
- return;
- }
-
- if (event.args && event.args.issue_ts !== undefined) {
- // When Chrome is the tracing controller and is the requester of the
- // clock sync, the clock sync event looks like:
- //
- // {
- // "args": {
- // "sync_id": "abc123",
- // "issue_ts": 12340
- // }
- // "ph": "c"
- // "ts": 12345
- // ...
- // }
- this.model_.clockSyncManager.addClockSyncMarker(
- this.clockDomainId_, syncId, timestampFromUs(event.args.issue_ts),
- timestampFromUs(event.ts));
- } else {
- // When Chrome is a tracing agent and is the recipient of the clock
- // sync request, the clock sync event looks like:
- //
- // {
- // "args": { "sync_id": "abc123" }
- // "ph": "c"
- // "ts": 12345
- // ...
- // }
- this.model_.clockSyncManager.addClockSyncMarker(
- this.clockDomainId_, syncId, timestampFromUs(event.ts));
- }
- },
-
- // Because the order of Jit code events and V8 samples are not guaranteed,
- // We store them in an array, sort by timestamp, and then process them.
- processV8Events: function() {
- this.v8SamplingData_.sort(function(a, b) {
- if (a.ts !== b.ts)
- return a.ts - b.ts;
- if (a.ph === 'M' || a.ph === 'I')
- return -1;
- else if (b.ph === 'M' || b.ph === 'I')
- return 1;
- return 0;
- });
- var length = this.v8SamplingData_.length;
- for (var i = 0; i < length; ++i) {
- var event = this.v8SamplingData_[i];
- if (event.ph === 'M' || event.ph === 'I') {
- this.processJitCodeEvent(event);
- } else if (event.ph === 'P') {
- this.processV8Sample(event);
- }
- }
- },
-
- importClockSyncMarkers: function() {
- for (var i = 0; i < this.events_.length; i++) {
- var event = this.events_[i];
-
- if (event.ph !== 'c')
- continue;
-
- var eventSizeInBytes =
- this.model_.importOptions.trackDetailedModelStats ?
- JSON.stringify(event).length : undefined;
-
- this.model_.stats.willProcessBasicTraceEvent(
- 'clock_sync', event.cat, event.name, event.ts, eventSizeInBytes);
- this.processClockSyncEvent(event);
- }
- },
-
- /**
- * Walks through the events_ list and outputs the structures discovered to
- * model_.
- */
- importEvents: function() {
- if (this.stackFrameEvents_)
- this.importStackFrames_(this.stackFrameEvents_, 'g');
-
- if (this.traceAnnotations_)
- this.importAnnotations_();
-
- var importOptions = this.model_.importOptions;
- var trackDetailedModelStats = importOptions.trackDetailedModelStats;
-
- var modelStats = this.model_.stats;
-
- var events = this.events_;
- for (var eI = 0; eI < events.length; eI++) {
- var event = events[eI];
-
- if (event.args === '__stripped__') {
- event.argsStripped = true;
- event.args = undefined;
- }
-
- var eventSizeInBytes;
- if (trackDetailedModelStats)
- eventSizeInBytes = JSON.stringify(event).length;
- else
- eventSizeInBytes = undefined;
-
- if (event.ph === 'B' || event.ph === 'E') {
- modelStats.willProcessBasicTraceEvent(
- 'begin_end (non-compact)', event.cat, event.name, event.ts,
- eventSizeInBytes);
- this.processDurationEvent(event);
-
- } else if (event.ph === 'X') {
- modelStats.willProcessBasicTraceEvent(
- 'begin_end (compact)', event.cat, event.name, event.ts,
- eventSizeInBytes);
- var slice = this.processCompleteEvent(event);
- // TODO(yuhaoz): If Chrome supports creating other events with flow,
- // we will need to call processFlowEvent for them also.
- // https://github.com/catapult-project/catapult/issues/1259
- if (slice !== undefined && event.bind_id !== undefined)
- this.processFlowEvent(event, slice);
-
- } else if (event.ph === 'b' || event.ph === 'e' || event.ph === 'n' ||
- event.ph === 'S' || event.ph === 'F' || event.ph === 'T' ||
- event.ph === 'p') {
- modelStats.willProcessBasicTraceEvent(
- 'async', event.cat, event.name, event.ts, eventSizeInBytes);
- this.processAsyncEvent(event);
-
- // Note, I is historic. The instant event marker got changed, but we
- // want to support loading old trace files so we have both I and i.
- } else if (event.ph === 'I' || event.ph === 'i' || event.ph === 'R') {
- modelStats.willProcessBasicTraceEvent(
- 'instant', event.cat, event.name, event.ts, eventSizeInBytes);
- this.processInstantEvent(event);
-
- } else if (event.ph === 'P') {
- modelStats.willProcessBasicTraceEvent(
- 'samples', event.cat, event.name, event.ts, eventSizeInBytes);
- this.processTraceSampleEvent(event);
- } else if (event.ph === 'C') {
- modelStats.willProcessBasicTraceEvent(
- 'counters', event.cat, event.name, event.ts, eventSizeInBytes);
- this.processCounterEvent(event);
- } else if (event.ph === 'M') {
- modelStats.willProcessBasicTraceEvent(
- 'metadata', event.cat, event.name, event.ts, eventSizeInBytes);
- this.processMetadataEvent(event);
-
- } else if (event.ph === 'N' || event.ph === 'D' || event.ph === 'O') {
- modelStats.willProcessBasicTraceEvent(
- 'objects', event.cat, event.name, event.ts, eventSizeInBytes);
- this.processObjectEvent(event);
-
- } else if (event.ph === 's' || event.ph === 't' || event.ph === 'f') {
- modelStats.willProcessBasicTraceEvent(
- 'flows', event.cat, event.name, event.ts, eventSizeInBytes);
- this.processFlowEvent(event);
-
- } else if (event.ph === 'v') {
- modelStats.willProcessBasicTraceEvent(
- 'memory_dumps', event.cat, event.name, event.ts,
- eventSizeInBytes);
- this.processMemoryDumpEvent(event);
-
- } else if (event.ph === '(' || event.ph === ')') {
- this.processContextEvent(event);
- } else if (event.ph === 'c') {
- // No-op. Clock sync events have already been processed in
- // importClockSyncMarkers().
- } else {
- modelStats.willProcessBasicTraceEvent(
- 'unknown', event.cat, event.name, event.ts, eventSizeInBytes);
- this.model_.importWarning({
- type: 'parse_error',
- message: 'Unrecognized event phase: ' +
- event.ph + ' (' + event.name + ')'
- });
- }
- }
- this.processV8Events();
-
- // Remove all the root stack frame children as they should
- // already be added.
- tr.b.iterItems(this.v8ProcessRootStackFrame_, function(name, frame) {
- frame.removeAllChildren();
- });
- },
-
- importStackFrames_: function(rawStackFrames, idPrefix) {
- var model = this.model_;
-
- for (var id in rawStackFrames) {
- var rawStackFrame = rawStackFrames[id];
- var fullId = idPrefix + id;
- var textForColor = rawStackFrame.category ?
- rawStackFrame.category : rawStackFrame.name;
- var stackFrame = new tr.model.StackFrame(
- undefined /* parentFrame */, fullId, rawStackFrame.name,
- ColorScheme.getColorIdForGeneralPurposeString(textForColor));
- model.addStackFrame(stackFrame);
- }
-
- for (var id in rawStackFrames) {
- var fullId = idPrefix + id;
- var stackFrame = model.stackFrames[fullId];
- if (stackFrame === undefined)
- throw new Error('Internal error');
-
- var rawStackFrame = rawStackFrames[id];
- var parentId = rawStackFrame.parent;
- var parentStackFrame;
- if (parentId === undefined) {
- parentStackFrame = undefined;
- } else {
- var parentFullId = idPrefix + parentId;
- parentStackFrame = model.stackFrames[parentFullId];
- if (parentStackFrame === undefined) {
- this.model_.importWarning({
- type: 'metadata_parse_error',
- message: 'Missing parent frame with ID ' + parentFullId +
- ' for stack frame \'' + stackFrame.name + '\' (ID ' + fullId +
- ').'
- });
- }
- }
- stackFrame.parentFrame = parentStackFrame;
- }
- },
-
- importObjectTypeNameMap_: function(rawObjectTypeNameMap, pid) {
- if (pid in this.objectTypeNameMap_) {
- this.model_.importWarning({
- type: 'metadata_parse_error',
- message: 'Mapping from object type IDs to names provided for pid=' +
- pid + ' multiple times.'
- });
- return;
- }
-
- var objectTypeNamePrefix = undefined;
- var objectTypeNameSuffix = undefined;
- var objectTypeNameMap = {};
- for (var objectTypeId in rawObjectTypeNameMap) {
- var rawObjectTypeName = rawObjectTypeNameMap[objectTypeId];
-
- // If we haven't figured out yet which compiler the object type names
- // come from, we try to do it now.
- if (objectTypeNamePrefix === undefined) {
- for (var i = 0; i < OBJECT_TYPE_NAME_PATTERNS.length; i++) {
- var pattern = OBJECT_TYPE_NAME_PATTERNS[i];
- if (rawObjectTypeName.startsWith(pattern.prefix) &&
- rawObjectTypeName.endsWith(pattern.suffix)) {
- objectTypeNamePrefix = pattern.prefix;
- objectTypeNameSuffix = pattern.suffix;
- break;
- }
- }
- }
-
- if (objectTypeNamePrefix !== undefined &&
- rawObjectTypeName.startsWith(objectTypeNamePrefix) &&
- rawObjectTypeName.endsWith(objectTypeNameSuffix)) {
- // With compiler-specific prefix and suffix (automatically annotated
- // object types).
- objectTypeNameMap[objectTypeId] = rawObjectTypeName.substring(
- objectTypeNamePrefix.length,
- rawObjectTypeName.length - objectTypeNameSuffix.length);
- } else {
- // Without compiler-specific prefix and suffix (manually annotated
- // object types and '[unknown]').
- objectTypeNameMap[objectTypeId] = rawObjectTypeName;
- }
- }
-
- this.objectTypeNameMap_[pid] = objectTypeNameMap;
- },
-
- importAnnotations_: function() {
- for (var id in this.traceAnnotations_) {
- var annotation = tr.model.Annotation.fromDictIfPossible(
- this.traceAnnotations_[id]);
- if (!annotation) {
- this.model_.importWarning({
- type: 'annotation_warning',
- message: 'Unrecognized traceAnnotation typeName \"' +
- this.traceAnnotations_[id].typeName + '\"'
- });
- continue;
- }
- this.model_.addAnnotation(annotation);
- }
- },
-
- /**
- * Called by the Model after all other importers have imported their
- * events.
- */
- finalizeImport: function() {
- if (this.softwareMeasuredCpuCount_ !== undefined) {
- this.model_.kernel.softwareMeasuredCpuCount =
- this.softwareMeasuredCpuCount_;
- }
- this.createAsyncSlices_();
- this.createFlowSlices_();
- this.createExplicitObjects_();
- this.createImplicitObjects_();
- this.createMemoryDumps_();
- },
-
- /* Events can have one or more stack frames associated with them, but
- * that frame might be encoded either as a stack trace of program counters,
- * or as a direct stack frame reference. This handles either case and
- * if found, returns the stackframe.
- */
- getStackFrameForEvent_: function(event, opt_lookForEndEvent) {
- var sf;
- var stack;
- if (opt_lookForEndEvent) {
- sf = event.esf;
- stack = event.estack;
- } else {
- sf = event.sf;
- stack = event.stack;
- }
- if (stack !== undefined && sf !== undefined) {
- this.model_.importWarning({
- type: 'stack_frame_and_stack_error',
- message: 'Event at ' + event.ts +
- ' cannot have both a stack and a stackframe.'
- });
- return undefined;
- }
-
- if (stack !== undefined)
- return this.model_.resolveStackToStackFrame_(event.pid, stack);
- if (sf === undefined)
- return undefined;
-
- var stackFrame = this.model_.stackFrames['g' + sf];
- if (stackFrame === undefined) {
- this.model_.importWarning({
- type: 'sample_import_error',
- message: 'No frame for ' + sf
- });
- return;
- }
- return stackFrame;
- },
-
- resolveStackToStackFrame_: function(pid, stack) {
- // TODO(alph,fmeawad): Add codemap resolution code here.
- return undefined;
- },
-
- importSampleData: function() {
- if (!this.sampleEvents_)
- return;
- var m = this.model_;
-
- // If this is the only importer, then fake-create the threads.
- var events = this.sampleEvents_;
- if (this.events_.length === 0) {
- for (var i = 0; i < events.length; i++) {
- var event = events[i];
- m.getOrCreateProcess(event.tid).getOrCreateThread(event.tid);
- }
- }
-
- var threadsByTid = {};
- m.getAllThreads().forEach(function(t) {
- threadsByTid[t.tid] = t;
- });
-
- for (var i = 0; i < events.length; i++) {
- var event = events[i];
- var thread = threadsByTid[event.tid];
- if (thread === undefined) {
- m.importWarning({
- type: 'sample_import_error',
- message: 'Thread ' + events.tid + 'not found'
- });
- continue;
- }
-
- var cpu;
- if (event.cpu !== undefined)
- cpu = m.kernel.getOrCreateCpu(event.cpu);
-
- var stackFrame = this.getStackFrameForEvent_(event);
-
- var sample = new tr.model.Sample(
- cpu, thread,
- event.name,
- timestampFromUs(event.ts),
- stackFrame,
- event.weight);
- m.samples.push(sample);
- }
- },
-
- createAsyncSlices_: function() {
- if (this.allAsyncEvents_.length === 0)
- return;
-
- this.allAsyncEvents_.sort(function(x, y) {
- var d = x.event.ts - y.event.ts;
- if (d !== 0)
- return d;
- return x.sequenceNumber - y.sequenceNumber;
- });
-
- var legacyEvents = [];
- // Group nestable async events by ID. Events with the same ID should
- // belong to the same parent async event.
- var nestableAsyncEventsByKey = {};
- var nestableMeasureAsyncEventsByKey = {};
- for (var i = 0; i < this.allAsyncEvents_.length; i++) {
- var asyncEventState = this.allAsyncEvents_[i];
- var event = asyncEventState.event;
- if (event.ph === 'S' || event.ph === 'F' || event.ph === 'T' ||
- event.ph === 'p') {
- legacyEvents.push(asyncEventState);
- continue;
- }
- if (event.cat === undefined) {
- this.model_.importWarning({
- type: 'async_slice_parse_error',
- message: 'Nestable async events (ph: b, e, or n) require a ' +
- 'cat parameter.'
- });
- continue;
- }
-
- if (event.name === undefined) {
- this.model_.importWarning({
- type: 'async_slice_parse_error',
- message: 'Nestable async events (ph: b, e, or n) require a ' +
- 'name parameter.'
- });
- continue;
- }
-
- if (event.id === undefined) {
- this.model_.importWarning({
- type: 'async_slice_parse_error',
- message: 'Nestable async events (ph: b, e, or n) require an ' +
- 'id parameter.'
- });
- continue;
- }
-
- if (event.cat === 'blink.user_timing') {
- var matched = /([^\/:]+):([^\/:]+)\/?(.*)/.exec(event.name);
- if (matched !== null) {
- var key = matched[1] + ':' + event.cat;
- event.args = JSON.parse(Base64.atob(matched[3]) || '{}');
- if (nestableMeasureAsyncEventsByKey[key] === undefined)
- nestableMeasureAsyncEventsByKey[key] = [];
- nestableMeasureAsyncEventsByKey[key].push(asyncEventState);
- continue;
- }
- }
-
- var key = event.cat + ':' + event.id;
- if (nestableAsyncEventsByKey[key] === undefined)
- nestableAsyncEventsByKey[key] = [];
- nestableAsyncEventsByKey[key].push(asyncEventState);
- }
- // Handle legacy async events.
- this.createLegacyAsyncSlices_(legacyEvents);
-
- // Parse nestable measure async events into AsyncSlices.
- this.createNestableAsyncSlices_(nestableMeasureAsyncEventsByKey);
-
- // Parse nestable async events into AsyncSlices.
- this.createNestableAsyncSlices_(nestableAsyncEventsByKey);
- },
-
- createLegacyAsyncSlices_: function(legacyEvents) {
- if (legacyEvents.length === 0)
- return;
-
- legacyEvents.sort(function(x, y) {
- var d = x.event.ts - y.event.ts;
- if (d != 0)
- return d;
- return x.sequenceNumber - y.sequenceNumber;
- });
-
- var asyncEventStatesByNameThenID = {};
-
- for (var i = 0; i < legacyEvents.length; i++) {
- var asyncEventState = legacyEvents[i];
-
- var event = asyncEventState.event;
- var name = event.name;
- if (name === undefined) {
- this.model_.importWarning({
- type: 'async_slice_parse_error',
- message: 'Async events (ph: S, T, p, or F) require a name ' +
- ' parameter.'
- });
- continue;
- }
-
- var id = event.id;
- if (id === undefined) {
- this.model_.importWarning({
- type: 'async_slice_parse_error',
- message: 'Async events (ph: S, T, p, or F) require an id parameter.'
- });
- continue;
- }
-
- // TODO(simonjam): Add a synchronous tick on the appropriate thread.
-
- if (event.ph === 'S') {
- if (asyncEventStatesByNameThenID[name] === undefined)
- asyncEventStatesByNameThenID[name] = {};
- if (asyncEventStatesByNameThenID[name][id]) {
- this.model_.importWarning({
- type: 'async_slice_parse_error',
- message: 'At ' + event.ts + ', a slice of the same id ' + id +
- ' was alrady open.'
- });
- continue;
- }
- asyncEventStatesByNameThenID[name][id] = [];
- asyncEventStatesByNameThenID[name][id].push(asyncEventState);
- } else {
- if (asyncEventStatesByNameThenID[name] === undefined) {
- this.model_.importWarning({
- type: 'async_slice_parse_error',
- message: 'At ' + event.ts + ', no slice named ' + name +
- ' was open.'
- });
- continue;
- }
- if (asyncEventStatesByNameThenID[name][id] === undefined) {
- this.model_.importWarning({
- type: 'async_slice_parse_error',
- message: 'At ' + event.ts + ', no slice named ' + name +
- ' with id=' + id + ' was open.'
- });
- continue;
- }
- var events = asyncEventStatesByNameThenID[name][id];
- events.push(asyncEventState);
-
- if (event.ph === 'F') {
- // Create a slice from start to end.
- var asyncSliceConstructor =
- tr.model.AsyncSlice.getConstructor(
- events[0].event.cat,
- name);
- var slice = new asyncSliceConstructor(
- events[0].event.cat,
- name,
- getEventColor(events[0].event),
- timestampFromUs(events[0].event.ts),
- tr.b.concatenateObjects(events[0].event.args,
- events[events.length - 1].event.args),
- timestampFromUs(event.ts - events[0].event.ts),
- true, undefined, undefined, events[0].event.argsStripped);
- slice.startThread = events[0].thread;
- slice.endThread = asyncEventState.thread;
- slice.id = id;
-
- var stepType = events[1].event.ph;
- var isValid = true;
-
- // Create subSlices for each step. Skip the start and finish events,
- // which are always first and last respectively.
- for (var j = 1; j < events.length - 1; ++j) {
- if (events[j].event.ph === 'T' || events[j].event.ph === 'p') {
- isValid = this.assertStepTypeMatches_(stepType, events[j]);
- if (!isValid)
- break;
- }
-
- if (events[j].event.ph === 'S') {
- this.model_.importWarning({
- type: 'async_slice_parse_error',
- message: 'At ' + event.event.ts + ', a slice named ' +
- event.event.name + ' with id=' + event.event.id +
- ' had a step before the start event.'
- });
- continue;
- }
-
- if (events[j].event.ph === 'F') {
- this.model_.importWarning({
- type: 'async_slice_parse_error',
- message: 'At ' + event.event.ts + ', a slice named ' +
- event.event.name + ' with id=' + event.event.id +
- ' had a step after the finish event.'
- });
- continue;
- }
-
- var startIndex = j + (stepType === 'T' ? 0 : -1);
- var endIndex = startIndex + 1;
-
- var subName = events[j].event.name;
- if (!events[j].event.argsStripped &&
- (events[j].event.ph === 'T' || events[j].event.ph === 'p'))
- subName = subName + ':' + events[j].event.args.step;
-
- var asyncSliceConstructor =
- tr.model.AsyncSlice.getConstructor(
- events[0].event.cat,
- subName);
- var subSlice = new asyncSliceConstructor(
- events[0].event.cat,
- subName,
- getEventColor(event, subName + j),
- timestampFromUs(events[startIndex].event.ts),
- this.deepCopyIfNeeded_(events[j].event.args),
- timestampFromUs(
- events[endIndex].event.ts - events[startIndex].event.ts),
- undefined, undefined,
- events[startIndex].event.argsStripped);
- subSlice.startThread = events[startIndex].thread;
- subSlice.endThread = events[endIndex].thread;
- subSlice.id = id;
-
- slice.subSlices.push(subSlice);
- }
-
- if (isValid) {
- // Add |slice| to the start-thread's asyncSlices.
- slice.startThread.asyncSliceGroup.push(slice);
- }
-
- delete asyncEventStatesByNameThenID[name][id];
- }
- }
- }
- },
-
- createNestableAsyncSlices_: function(nestableEventsByKey) {
- for (var key in nestableEventsByKey) {
- var eventStateEntries = nestableEventsByKey[key];
- // Stack of enclosing BEGIN events.
- var parentStack = [];
- for (var i = 0; i < eventStateEntries.length; ++i) {
- var eventStateEntry = eventStateEntries[i];
- // If this is the end of an event, match it to the start.
- if (eventStateEntry.event.ph === 'e') {
- // Walk up the parent stack to find the corresponding BEGIN for
- // this END.
- var parentIndex = -1;
- for (var k = parentStack.length - 1; k >= 0; --k) {
- if (parentStack[k].event.name === eventStateEntry.event.name) {
- parentIndex = k;
- break;
- }
- }
- if (parentIndex === -1) {
- // Unmatched end.
- eventStateEntry.finished = false;
- } else {
- parentStack[parentIndex].end = eventStateEntry;
- // Pop off all enclosing unmatched BEGINs util parentIndex.
- while (parentIndex < parentStack.length) {
- parentStack.pop();
- }
- }
- }
- // Inherit the current parent.
- if (parentStack.length > 0)
- eventStateEntry.parentEntry = parentStack[parentStack.length - 1];
- if (eventStateEntry.event.ph === 'b') {
- parentStack.push(eventStateEntry);
- }
- }
- var topLevelSlices = [];
- for (var i = 0; i < eventStateEntries.length; ++i) {
- var eventStateEntry = eventStateEntries[i];
- // Skip matched END, as its slice will be created when we
- // encounter its corresponding BEGIN.
- if (eventStateEntry.event.ph === 'e' &&
- eventStateEntry.finished === undefined) {
- continue;
- }
- var startState = undefined;
- var endState = undefined;
- var sliceArgs = eventStateEntry.event.args || {};
- var sliceError = undefined;
- if (eventStateEntry.event.ph === 'n') {
- startState = eventStateEntry;
- endState = eventStateEntry;
- } else if (eventStateEntry.event.ph === 'b') {
- if (eventStateEntry.end === undefined) {
- // Unmatched BEGIN. End it when last event with this ID ends.
- eventStateEntry.end =
- eventStateEntries[eventStateEntries.length - 1];
- sliceError =
- 'Slice has no matching END. End time has been adjusted.';
- this.model_.importWarning({
- type: 'async_slice_parse_error',
- message: 'Nestable async BEGIN event at ' +
- eventStateEntry.event.ts + ' with name=' +
- eventStateEntry.event.name +
- ' and id=' + eventStateEntry.event.id + ' was unmatched.'
- });
- } else {
- // Include args for both END and BEGIN for a matched pair.
- function concatenateArguments(args1, args2) {
- if (args1.params === undefined || args2.params === undefined)
- return tr.b.concatenateObjects(args1, args2);
- // Make an argument object to hold the combined params.
- var args3 = {};
- args3.params = tr.b.concatenateObjects(args1.params,
- args2.params);
- return tr.b.concatenateObjects(args1, args2, args3);
- }
- var endArgs = eventStateEntry.end.event.args || {};
- sliceArgs = concatenateArguments(sliceArgs, endArgs);
- }
- startState = eventStateEntry;
- endState = eventStateEntry.end;
- } else {
- // Unmatched END. Start it at the first event with this ID starts.
- sliceError =
- 'Slice has no matching BEGIN. Start time has been adjusted.';
- this.model_.importWarning({
- type: 'async_slice_parse_error',
- message: 'Nestable async END event at ' +
- eventStateEntry.event.ts + ' with name=' +
- eventStateEntry.event.name +
- ' and id=' + eventStateEntry.event.id + ' was unmatched.'
- });
- startState = eventStateEntries[0];
- endState = eventStateEntry;
- }
-
- var isTopLevel = (eventStateEntry.parentEntry === undefined);
- var asyncSliceConstructor =
- tr.model.AsyncSlice.getConstructor(
- eventStateEntry.event.cat,
- eventStateEntry.event.name);
-
- var thread_start = undefined;
- var thread_duration = undefined;
- if (startState.event.tts && startState.event.use_async_tts) {
- thread_start = timestampFromUs(startState.event.tts);
- if (endState.event.tts) {
- var thread_end = timestampFromUs(endState.event.tts);
- thread_duration = thread_end - thread_start;
- }
- }
-
- var slice = new asyncSliceConstructor(
- eventStateEntry.event.cat,
- eventStateEntry.event.name,
- getEventColor(endState.event),
- timestampFromUs(startState.event.ts),
- sliceArgs,
- timestampFromUs(endState.event.ts - startState.event.ts),
- isTopLevel,
- thread_start,
- thread_duration,
- startState.event.argsStripped);
-
- slice.startThread = startState.thread;
- slice.endThread = endState.thread;
-
- slice.startStackFrame = this.getStackFrameForEvent_(startState.event);
- slice.endStackFrame = this.getStackFrameForEvent_(endState.event);
-
- slice.id = key;
- if (sliceError !== undefined)
- slice.error = sliceError;
- eventStateEntry.slice = slice;
- // Add the slice to the topLevelSlices array if there is no parent.
- // Otherwise, add the slice to the subSlices of its parent.
- if (isTopLevel) {
- topLevelSlices.push(slice);
- } else if (eventStateEntry.parentEntry.slice !== undefined) {
- eventStateEntry.parentEntry.slice.subSlices.push(slice);
- }
- }
- for (var si = 0; si < topLevelSlices.length; si++) {
- topLevelSlices[si].startThread.asyncSliceGroup.push(
- topLevelSlices[si]);
- }
- }
- },
-
- assertStepTypeMatches_: function(stepType, event) {
- if (stepType != event.event.ph) {
- this.model_.importWarning({
- type: 'async_slice_parse_error',
- message: 'At ' + event.event.ts + ', a slice named ' +
- event.event.name + ' with id=' + event.event.id +
- ' had both begin and end steps, which is not allowed.'
- });
- return false;
- }
- return true;
- },
-
- createFlowSlices_: function() {
- if (this.allFlowEvents_.length === 0)
- return;
-
- var that = this;
-
- function validateFlowEvent() {
- if (event.name === undefined) {
- that.model_.importWarning({
- type: 'flow_slice_parse_error',
- message: 'Flow events (ph: s, t or f) require a name parameter.'
- });
- return false;
- }
-
- // Support Flow API v1.
- if (event.ph === 's' || event.ph === 'f' || event.ph === 't') {
- if (event.id === undefined) {
- that.model_.importWarning({
- type: 'flow_slice_parse_error',
- message: 'Flow events (ph: s, t or f) require an id parameter.'
- });
- return false;
- }
- return true;
- }
-
- // Support Flow API v2.
- if (event.bind_id) {
- if (event.flow_in === undefined && event.flow_out === undefined) {
- that.model_.importWarning({
- type: 'flow_slice_parse_error',
- message: 'Flow producer or consumer require flow_in or flow_out.'
- });
- return false;
- }
- return true;
- }
-
- return false;
- }
-
- function createFlowEvent(thread, event, opt_slice) {
- var startSlice, flowId, flowStartTs;
-
- if (event.bind_id) {
- // Support Flow API v2.
- startSlice = opt_slice;
- flowId = event.bind_id;
- flowStartTs = timestampFromUs(event.ts + event.dur);
- } else {
- // Support Flow API v1.
- var ts = timestampFromUs(event.ts);
- startSlice = thread.sliceGroup.findSliceAtTs(ts);
- if (startSlice === undefined)
- return undefined;
- flowId = event.id;
- flowStartTs = ts;
- }
-
- var flowEvent = new tr.model.FlowEvent(
- event.cat,
- flowId,
- event.name,
- getEventColor(event),
- flowStartTs,
- that.deepCopyAlways_(event.args));
- flowEvent.startSlice = startSlice;
- flowEvent.startStackFrame = that.getStackFrameForEvent_(event);
- flowEvent.endStackFrame = undefined;
- startSlice.outFlowEvents.push(flowEvent);
- return flowEvent;
- }
-
- function finishFlowEventWith(flowEvent, thread, event,
- refGuid, bindToParent, opt_slice) {
- var endSlice;
-
- if (event.bind_id) {
- // Support Flow API v2.
- endSlice = opt_slice;
- } else {
- // Support Flow API v1.
- var ts = timestampFromUs(event.ts);
- if (bindToParent) {
- endSlice = thread.sliceGroup.findSliceAtTs(ts);
- } else {
- endSlice = thread.sliceGroup.findNextSliceAfter(ts, refGuid);
- }
- if (endSlice === undefined)
- return false;
- }
-
- endSlice.inFlowEvents.push(flowEvent);
- flowEvent.endSlice = endSlice;
- flowEvent.duration = timestampFromUs(event.ts) - flowEvent.start;
- flowEvent.endStackFrame = that.getStackFrameForEvent_(event);
- that.mergeArgsInto_(flowEvent.args, event.args, flowEvent.title);
- return true;
- }
-
- function processFlowConsumer(flowIdToEvent, sliceGuidToEvent, event,
- slice) {
- var flowEvent = flowIdToEvent[event.bind_id];
- if (flowEvent === undefined) {
- that.model_.importWarning({
- type: 'flow_slice_ordering_error',
- message: 'Flow consumer ' + event.bind_id + ' does not have ' +
- 'a flow producer'});
- return false;
- } else if (flowEvent.endSlice) {
- // One flow producer can have more than one flow consumers.
- // In this case, create a new flow event using the flow producer.
- var flowProducer = flowEvent.startSlice;
- flowEvent = createFlowEvent(undefined,
- sliceGuidToEvent[flowProducer.guid], flowProducer);
- }
-
- var ok = finishFlowEventWith(flowEvent, undefined, event,
- refGuid, undefined, slice);
- if (ok) {
- that.model_.flowEvents.push(flowEvent);
- } else {
- that.model_.importWarning({
- type: 'flow_slice_end_error',
- message: 'Flow consumer ' + event.bind_id + ' does not end ' +
- 'at an actual slice, so cannot be created.'});
- return false;
- }
-
- return true;
- }
-
- function processFlowProducer(flowIdToEvent, flowStatus, event, slice) {
- if (flowIdToEvent[event.bind_id] &&
- flowStatus[event.bind_id]) {
- // Can't open the same flow again while it's still open.
- // This is essentially the multi-producer case which we don't support
- that.model_.importWarning({
- type: 'flow_slice_start_error',
- message: 'Flow producer ' + event.bind_id + ' already seen'});
- return false;
- }
-
- var flowEvent = createFlowEvent(undefined, event, slice);
- if (!flowEvent) {
- that.model_.importWarning({
- type: 'flow_slice_start_error',
- message: 'Flow producer ' + event.bind_id + ' does not start' +
- 'a flow'});
- return false;
- }
- flowIdToEvent[event.bind_id] = flowEvent;
-
- return;
- }
-
- // Actual import.
- this.allFlowEvents_.sort(function(x, y) {
- var d = x.event.ts - y.event.ts;
- if (d != 0)
- return d;
- return x.sequenceNumber - y.sequenceNumber;
- });
-
- var flowIdToEvent = {};
- var sliceGuidToEvent = {};
- var flowStatus = {}; // true: open; false: closed.
- for (var i = 0; i < this.allFlowEvents_.length; ++i) {
- var data = this.allFlowEvents_[i];
- var refGuid = data.refGuid;
- var event = data.event;
- var thread = data.thread;
- if (!validateFlowEvent(event))
- continue;
-
- // Support for Flow API v2.
- if (event.bind_id) {
- var slice = data.slice;
- sliceGuidToEvent[slice.guid] = event;
-
- if (event.flowPhase === PRODUCER) {
- if (!processFlowProducer(flowIdToEvent, flowStatus, event, slice))
- continue;
- flowStatus[event.bind_id] = true; // open the flow.
- }
- else {
- if (!processFlowConsumer(flowIdToEvent, sliceGuidToEvent,
- event, slice))
- continue;
- flowStatus[event.bind_id] = false; // close the flow.
-
- if (event.flowPhase === STEP) {
- if (!processFlowProducer(flowIdToEvent, flowStatus,
- event, slice))
- continue;
- flowStatus[event.bind_id] = true; // open the flow again.
- }
- }
- continue;
- }
-
- // Support for Flow API v1.
- var flowEvent;
- if (event.ph === 's') {
- if (flowIdToEvent[event.id]) {
- this.model_.importWarning({
- type: 'flow_slice_start_error',
- message: 'event id ' + event.id + ' already seen when ' +
- 'encountering start of flow event.'});
- continue;
- }
- flowEvent = createFlowEvent(thread, event);
- if (!flowEvent) {
- this.model_.importWarning({
- type: 'flow_slice_start_error',
- message: 'event id ' + event.id + ' does not start ' +
- 'at an actual slice, so cannot be created.'});
- continue;
- }
- flowIdToEvent[event.id] = flowEvent;
-
- } else if (event.ph === 't' || event.ph === 'f') {
- flowEvent = flowIdToEvent[event.id];
- if (flowEvent === undefined) {
- this.model_.importWarning({
- type: 'flow_slice_ordering_error',
- message: 'Found flow phase ' + event.ph + ' for id: ' + event.id +
- ' but no flow start found.'
- });
- continue;
- }
-
- var bindToParent = event.ph === 't';
-
- if (event.ph === 'f') {
- if (event.bp === undefined) {
- // TODO(yuhaoz): In flow V2, there is no notion of binding point.
- // Removal of binding point is tracked in
- // https://github.com/google/trace-viewer/issues/991.
- if (event.cat.indexOf('input') > -1)
- bindToParent = true;
- else if (event.cat.indexOf('ipc.flow') > -1)
- bindToParent = true;
- } else {
- if (event.bp !== 'e') {
- this.model_.importWarning({
- type: 'flow_slice_bind_point_error',
- message: 'Flow event with invalid binding point (event.bp).'
- });
- continue;
- }
- bindToParent = true;
- }
- }
-
- var ok = finishFlowEventWith(flowEvent, thread, event,
- refGuid, bindToParent);
- if (ok) {
- that.model_.flowEvents.push(flowEvent);
- } else {
- this.model_.importWarning({
- type: 'flow_slice_end_error',
- message: 'event id ' + event.id + ' does not end ' +
- 'at an actual slice, so cannot be created.'});
- }
- flowIdToEvent[event.id] = undefined;
-
- // If this is a step, then create another flow event.
- if (ok && event.ph === 't') {
- flowEvent = createFlowEvent(thread, event);
- flowIdToEvent[event.id] = flowEvent;
- }
- }
- }
- },
-
- /**
- * This function creates objects described via the N, D, and O phase
- * events.
- */
- createExplicitObjects_: function() {
- if (this.allObjectEvents_.length === 0)
- return;
-
- function processEvent(objectEventState) {
- var event = objectEventState.event;
- var scopedId = this.scopedIdForEvent_(event);
- var thread = objectEventState.thread;
- if (event.name === undefined) {
- this.model_.importWarning({
- type: 'object_parse_error',
- message: 'While processing ' + JSON.stringify(event) + ': ' +
- 'Object events require an name parameter.'
- });
- }
-
- if (scopedId.id === undefined) {
- this.model_.importWarning({
- type: 'object_parse_error',
- message: 'While processing ' + JSON.stringify(event) + ': ' +
- 'Object events require an id parameter.'
- });
- }
- var process = thread.parent;
- var ts = timestampFromUs(event.ts);
- var instance;
- if (event.ph === 'N') {
- try {
- instance = process.objects.idWasCreated(
- scopedId, event.cat, event.name, ts);
- } catch (e) {
- this.model_.importWarning({
- type: 'object_parse_error',
- message: 'While processing create of ' +
- scopedId + ' at ts=' + ts + ': ' + e
- });
- return;
- }
- } else if (event.ph === 'O') {
- if (event.args.snapshot === undefined) {
- this.model_.importWarning({
- type: 'object_parse_error',
- message: 'While processing ' + scopedId + ' at ts=' + ts + ': ' +
- 'Snapshots must have args: {snapshot: ...}'
- });
- return;
- }
- var snapshot;
- try {
- var args = this.deepCopyIfNeeded_(event.args.snapshot);
- var cat;
- if (args.cat) {
- cat = args.cat;
- delete args.cat;
- } else {
- cat = event.cat;
- }
-
- var baseTypename;
- if (args.base_type) {
- baseTypename = args.base_type;
- delete args.base_type;
- } else {
- baseTypename = undefined;
- }
- snapshot = process.objects.addSnapshot(
- scopedId, cat, event.name, ts, args, baseTypename);
- snapshot.snapshottedOnThread = thread;
- } catch (e) {
- this.model_.importWarning({
- type: 'object_parse_error',
- message: 'While processing snapshot of ' +
- scopedId + ' at ts=' + ts + ': ' + e
- });
- return;
- }
- instance = snapshot.objectInstance;
- } else if (event.ph === 'D') {
- try {
- process.objects.idWasDeleted(scopedId, event.cat, event.name, ts);
- var instanceMap = process.objects.getOrCreateInstanceMap_(scopedId);
- instance = instanceMap.lastInstance;
- } catch (e) {
- this.model_.importWarning({
- type: 'object_parse_error',
- message: 'While processing delete of ' +
- scopedId + ' at ts=' + ts + ': ' + e
- });
- return;
- }
- }
-
- if (instance)
- instance.colorId = getEventColor(event, instance.typeName);
- }
-
- this.allObjectEvents_.sort(function(x, y) {
- var d = x.event.ts - y.event.ts;
- if (d != 0)
- return d;
- return x.sequenceNumber - y.sequenceNumber;
- });
-
- var allObjectEvents = this.allObjectEvents_;
- for (var i = 0; i < allObjectEvents.length; i++) {
- var objectEventState = allObjectEvents[i];
- try {
- processEvent.call(this, objectEventState);
- } catch (e) {
- this.model_.importWarning({
- type: 'object_parse_error',
- message: e.message
- });
- }
- }
- },
-
- createImplicitObjects_: function() {
- tr.b.iterItems(this.model_.processes, function(pid, process) {
- this.createImplicitObjectsForProcess_(process);
- }, this);
- },
-
- // Here, we collect all the snapshots that internally contain a
- // Javascript-level object inside their args list that has an "id" field,
- // and turn that into a snapshot of the instance referred to by id.
- createImplicitObjectsForProcess_: function(process) {
-
- function processField(referencingObject,
- referencingObjectFieldName,
- referencingObjectFieldValue,
- containingSnapshot) {
- if (!referencingObjectFieldValue)
- return;
-
- if (referencingObjectFieldValue instanceof
- tr.model.ObjectSnapshot)
- return null;
- if (referencingObjectFieldValue.id === undefined)
- return;
-
- var implicitSnapshot = referencingObjectFieldValue;
-
- var rawId = implicitSnapshot.id;
- var m = /(.+)\/(.+)/.exec(rawId);
- if (!m)
- throw new Error('Implicit snapshots must have names.');
- delete implicitSnapshot.id;
- var name = m[1];
- var id = m[2];
- var res;
-
- var cat;
- if (implicitSnapshot.cat !== undefined)
- cat = implicitSnapshot.cat;
- else
- cat = containingSnapshot.objectInstance.category;
-
- var baseTypename;
- if (implicitSnapshot.base_type)
- baseTypename = implicitSnapshot.base_type;
- else
- baseTypename = undefined;
-
- var scope = containingSnapshot.objectInstance.scopedId.scope;
-
- try {
- res = process.objects.addSnapshot(
- new tr.model.ScopedId(scope, id), cat,
- name, containingSnapshot.ts,
- implicitSnapshot, baseTypename);
- } catch (e) {
- this.model_.importWarning({
- type: 'object_snapshot_parse_error',
- message: 'While processing implicit snapshot of ' +
- rawId + ' at ts=' + containingSnapshot.ts + ': ' + e
- });
- return;
- }
- res.objectInstance.hasImplicitSnapshots = true;
- res.containingSnapshot = containingSnapshot;
- res.snapshottedOnThread = containingSnapshot.snapshottedOnThread;
- referencingObject[referencingObjectFieldName] = res;
- if (!(res instanceof tr.model.ObjectSnapshot))
- throw new Error('Created object must be instanceof snapshot');
- return res.args;
- }
-
- /**
- * Iterates over the fields in the object, calling func for every
- * field/value found.
- *
- * @return {object} If the function does not want the field's value to be
- * iterated, return null. If iteration of the field value is desired, then
- * return either undefined (if the field value did not change) or the new
- * field value if it was changed.
- */
- function iterObject(object, func, containingSnapshot, thisArg) {
- if (!(object instanceof Object))
- return;
-
- if (object instanceof Array) {
- for (var i = 0; i < object.length; i++) {
- var res = func.call(thisArg, object, i, object[i],
- containingSnapshot);
- if (res === null)
- continue;
- if (res)
- iterObject(res, func, containingSnapshot, thisArg);
- else
- iterObject(object[i], func, containingSnapshot, thisArg);
- }
- return;
- }
-
- for (var key in object) {
- var res = func.call(thisArg, object, key, object[key],
- containingSnapshot);
- if (res === null)
- continue;
- if (res)
- iterObject(res, func, containingSnapshot, thisArg);
- else
- iterObject(object[key], func, containingSnapshot, thisArg);
- }
- }
-
- // TODO(nduca): We may need to iterate the instances in sorted order by
- // creationTs.
- process.objects.iterObjectInstances(function(instance) {
- instance.snapshots.forEach(function(snapshot) {
- if (snapshot.args.id !== undefined)
- throw new Error('args cannot have an id field inside it');
- iterObject(snapshot.args, processField, snapshot, this);
- }, this);
- }, this);
- },
-
- createMemoryDumps_: function() {
- for (var dumpId in this.allMemoryDumpEvents_)
- this.createGlobalMemoryDump_(this.allMemoryDumpEvents_[dumpId], dumpId);
- },
-
- createGlobalMemoryDump_: function(dumpIdEvents, dumpId) {
- // 1. Create a GlobalMemoryDump for the provided process memory dump
- // the events, all of which have the same dump ID.
-
- // Calculate the range of the global memory dump.
- var globalRange = new tr.b.Range();
- for (var pid in dumpIdEvents) {
- var processEvents = dumpIdEvents[pid];
- for (var i = 0; i < processEvents.length; i++)
- globalRange.addValue(timestampFromUs(processEvents[i].ts));
- }
- if (globalRange.isEmpty)
- throw new Error('Internal error: Global memory dump without events');
-
- // Create the global memory dump.
- var globalMemoryDump = new tr.model.GlobalMemoryDump(
- this.model_, globalRange.min);
- globalMemoryDump.duration = globalRange.range;
- this.model_.globalMemoryDumps.push(globalMemoryDump);
-
- var globalMemoryAllocatorDumpsByFullName = {};
- var levelsOfDetail = {};
- var allMemoryAllocatorDumpsByGuid = {};
-
- // 2. Create a ProcessMemoryDump for each PID in the provided process
- // memory dump events. Everything except for edges between memory
- // allocator dumps is parsed from the process memory dump trace events at
- // this step.
- for (var pid in dumpIdEvents) {
- this.createProcessMemoryDump_(globalMemoryDump,
- globalMemoryAllocatorDumpsByFullName, levelsOfDetail,
- allMemoryAllocatorDumpsByGuid, dumpIdEvents[pid], pid, dumpId);
- }
-
- // 3. Set the level of detail and memory allocator dumps of the
- // GlobalMemoryDump, which come from the process memory dump trace
- // events parsed in the prebvious step.
- globalMemoryDump.levelOfDetail = levelsOfDetail.global;
-
- // Find the root allocator dumps and establish the parent links of
- // the global memory dump.
- globalMemoryDump.memoryAllocatorDumps =
- this.inferMemoryAllocatorDumpTree_(
- globalMemoryAllocatorDumpsByFullName);
-
- // 4. Finally, parse the edges between all memory allocator dumps within
- // the GlobalMemoryDump. This can only be done once all memory allocator
- // dumps have been parsed (i.e. it is necessary to iterate over the
- // process memory dump trace events once more).
- this.parseMemoryDumpAllocatorEdges_(allMemoryAllocatorDumpsByGuid,
- dumpIdEvents, dumpId);
- },
-
- createProcessMemoryDump_: function(globalMemoryDump,
- globalMemoryAllocatorDumpsByFullName, levelsOfDetail,
- allMemoryAllocatorDumpsByGuid, processEvents, pid, dumpId) {
- // Calculate the range of the process memory dump.
- var processRange = new tr.b.Range();
- for (var i = 0; i < processEvents.length; i++)
- processRange.addValue(timestampFromUs(processEvents[i].ts));
- if (processRange.isEmpty)
- throw new Error('Internal error: Process memory dump without events');
-
- // Create the process memory dump.
- var process = this.model_.getOrCreateProcess(pid);
- var processMemoryDump = new tr.model.ProcessMemoryDump(
- globalMemoryDump, process, processRange.min);
- processMemoryDump.duration = processRange.range;
- process.memoryDumps.push(processMemoryDump);
- globalMemoryDump.processMemoryDumps[pid] = processMemoryDump;
-
- var processMemoryAllocatorDumpsByFullName = {};
-
- // Parse all process memory dump trace events for the newly created
- // ProcessMemoryDump.
- for (var i = 0; i < processEvents.length; i++) {
- var processEvent = processEvents[i];
-
- var dumps = processEvent.args.dumps;
- if (dumps === undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: '\'dumps\' field not found in a process memory dump' +
- ' event for PID=' + pid + ' and dump ID=' + dumpId + '.'
- });
- continue;
- }
-
- // Totals, VM regions, and heap dumps for the newly created
- // ProcessMemoryDump should be present in at most one event, so they
- // can be added to the ProcessMemoryDump immediately.
- this.parseMemoryDumpTotals_(processMemoryDump, dumps, pid, dumpId);
- this.parseMemoryDumpVmRegions_(processMemoryDump, dumps, pid, dumpId);
- this.parseMemoryDumpHeapDumps_(processMemoryDump, dumps, pid, dumpId);
-
- // All process memory dump trace events for the newly created
- // ProcessMemoryDump must be processed before level of detail and
- // allocator dumps can be added to it.
- this.parseMemoryDumpLevelOfDetail_(levelsOfDetail, dumps, pid,
- dumpId);
- this.parseMemoryDumpAllocatorDumps_(processMemoryDump, globalMemoryDump,
- processMemoryAllocatorDumpsByFullName,
- globalMemoryAllocatorDumpsByFullName,
- allMemoryAllocatorDumpsByGuid, dumps, pid, dumpId);
- }
-
- if (levelsOfDetail.process === undefined) {
- // Infer level of detail from the presence of VM regions in legacy
- // traces (where raw process memory dump events don't contain the
- // level_of_detail field).
- levelsOfDetail.process = processMemoryDump.vmRegions ? DETAILED : LIGHT;
- }
- if (!this.updateMemoryDumpLevelOfDetail_(
- levelsOfDetail, 'global', levelsOfDetail.process)) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'diffent levels of detail provided for global memory' +
- ' dump (dump ID=' + dumpId + ').'
- });
- }
- processMemoryDump.levelOfDetail = levelsOfDetail.process;
- delete levelsOfDetail.process; // Reused for all process dumps.
-
- // Find the root allocator dumps and establish the parent links of
- // the process memory dump.
- processMemoryDump.memoryAllocatorDumps =
- this.inferMemoryAllocatorDumpTree_(
- processMemoryAllocatorDumpsByFullName);
- },
-
- parseMemoryDumpTotals_: function(processMemoryDump, dumps, pid, dumpId) {
- var rawTotals = dumps.process_totals;
- if (rawTotals === undefined)
- return;
-
- if (processMemoryDump.totals !== undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Process totals provided multiple times for' +
- ' process memory dump for PID=' + pid +
- ' and dump ID=' + dumpId + '.'
- });
- return;
- }
-
- var totals = {};
- var platformSpecificTotals = undefined;
-
- for (var rawTotalName in rawTotals) {
- var rawTotalValue = rawTotals[rawTotalName];
- if (rawTotalValue === undefined)
- continue;
-
- // Total resident bytes.
- if (rawTotalName === 'resident_set_bytes') {
- totals.residentBytes = parseInt(rawTotalValue, 16);
- continue;
- }
-
- // Peak resident bytes.
- if (rawTotalName === 'peak_resident_set_bytes') {
- totals.peakResidentBytes = parseInt(rawTotalValue, 16);
- continue;
- }
- if (rawTotalName === 'is_peak_rss_resetable') {
- totals.arePeakResidentBytesResettable = !!rawTotalValue;
- continue;
- }
-
- // OS-specific totals (e.g. private resident on Mac).
- if (platformSpecificTotals === undefined) {
- platformSpecificTotals = {};
- totals.platformSpecific = platformSpecificTotals;
- }
- platformSpecificTotals[rawTotalName] = parseInt(rawTotalValue, 16);
- }
-
- // Either both peak_resident_set_bytes and is_peak_rss_resetable should
- // be present in the trace, or neither.
- if (totals.peakResidentBytes === undefined &&
- totals.arePeakResidentBytesResettable !== undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Optional field peak_resident_set_bytes found' +
- ' but is_peak_rss_resetable not found in' +
- ' process memory dump for PID=' + pid +
- ' and dump ID=' + dumpId + '.'
- });
- }
- if (totals.arePeakResidentBytesResettable !== undefined &&
- totals.peakResidentBytes === undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Optional field is_peak_rss_resetable found' +
- ' but peak_resident_set_bytes not found in' +
- ' process memory dump for PID=' + pid +
- ' and dump ID=' + dumpId + '.'
- });
- }
-
- processMemoryDump.totals = totals;
- },
-
- parseMemoryDumpVmRegions_: function(processMemoryDump, dumps, pid, dumpId) {
- var rawProcessMmaps = dumps.process_mmaps;
- if (rawProcessMmaps === undefined)
- return;
-
- var rawVmRegions = rawProcessMmaps.vm_regions;
- if (rawVmRegions === undefined)
- return;
-
- if (processMemoryDump.vmRegions !== undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'VM regions provided multiple times for' +
- ' process memory dump for PID=' + pid +
- ' and dump ID=' + dumpId + '.'
- });
- return;
- }
-
- // See //base/trace_event/process_memory_maps.cc in Chromium.
- var vmRegions = new Array(rawVmRegions.length);
- for (var i = 0; i < rawVmRegions.length; i++) {
- var rawVmRegion = rawVmRegions[i];
-
- var byteStats = {};
- var rawByteStats = rawVmRegion.bs;
- for (var rawByteStatName in rawByteStats) {
- var rawByteStatValue = rawByteStats[rawByteStatName];
- if (rawByteStatValue === undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Byte stat \'' + rawByteStatName + '\' of VM region ' +
- i + ' (' + rawVmRegion.mf + ') in process memory dump for ' +
- 'PID=' + pid + ' and dump ID=' + dumpId +
- ' does not have a value.'
- });
- continue;
- }
- var byteStatName = BYTE_STAT_NAME_MAP[rawByteStatName];
- if (byteStatName === undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Unknown byte stat name \'' + rawByteStatName + '\' (' +
- rawByteStatValue + ') of VM region ' + i + ' (' +
- rawVmRegion.mf + ') in process memory dump for PID=' + pid +
- ' and dump ID=' + dumpId + '.'
- });
- continue;
- }
- byteStats[byteStatName] = parseInt(rawByteStatValue, 16);
- }
-
- vmRegions[i] = new tr.model.VMRegion(
- parseInt(rawVmRegion.sa, 16), // startAddress
- parseInt(rawVmRegion.sz, 16), // sizeInBytes
- rawVmRegion.pf, // protectionFlags
- rawVmRegion.mf, // mappedFile
- byteStats);
- }
-
- processMemoryDump.vmRegions =
- tr.model.VMRegionClassificationNode.fromRegions(vmRegions);
- },
-
- parseMemoryDumpHeapDumps_: function(processMemoryDump, dumps, pid, dumpId) {
- var rawHeapDumps = dumps.heaps;
- if (rawHeapDumps === undefined)
- return;
-
- if (processMemoryDump.heapDumps !== undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Heap dumps provided multiple times for' +
- ' process memory dump for PID=' + pid +
- ' and dump ID=' + dumpId + '.'
- });
- return;
- }
-
- var model = this.model_;
- var idPrefix = 'p' + pid + ':';
- var heapDumps = {};
-
- var objectTypeNameMap = this.objectTypeNameMap_[pid];
- if (objectTypeNameMap === undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Missing mapping from object type IDs to names.'
- });
- }
-
- for (var allocatorName in rawHeapDumps) {
- var entries = rawHeapDumps[allocatorName].entries;
- if (entries === undefined || entries.length === 0) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'No heap entries in a ' + allocatorName +
- ' heap dump for PID=' + pid + ' and dump ID=' + dumpId + '.'
- });
- continue;
- }
-
- // The old format always starts with a {size: <total>} entry.
- // See https://goo.gl/WYStil
- // TODO(petrcermak): Remove support for the old format once the new
- // format has been around long enough.
- var isOldFormat = entries[0].bt === undefined;
- if (!isOldFormat && objectTypeNameMap === undefined) {
- // Mapping from object type IDs to names must be provided in the new
- // format.
- continue;
- }
-
- var heapDump = new tr.model.HeapDump(processMemoryDump, allocatorName);
-
- for (var i = 0; i < entries.length; i++) {
- var entry = entries[i];
- var leafStackFrameIndex = entry.bt;
- var leafStackFrame;
-
- // There are two possible mappings from leaf stack frame indices
- // (provided in the trace) to the corresponding stack frames
- // depending on the format.
- if (isOldFormat) {
- // Old format:
- // Undefined index -> / (root)
- // Defined index for /A/B -> /A/B/<self>
- if (leafStackFrameIndex === undefined) {
- leafStackFrame = undefined /* root */;
- } else {
- // Get the leaf stack frame corresponding to the provided index.
- var leafStackFrameId = idPrefix + leafStackFrameIndex;
- if (leafStackFrameIndex === '') {
- leafStackFrame = undefined /* root */;
- } else {
- leafStackFrame = model.stackFrames[leafStackFrameId];
- if (leafStackFrame === undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Missing leaf stack frame (ID ' +
- leafStackFrameId + ') of heap entry ' + i + ' (size ' +
- size + ') in a ' + allocatorName +
- ' heap dump for PID=' + pid + '.'
- });
- continue;
- }
- }
-
- // Inject an artificial <self> leaf stack frame.
- leafStackFrameId += ':self';
- if (model.stackFrames[leafStackFrameId] !== undefined) {
- // The frame might already exist if there are multiple process
- // memory dumps (for the same process) in the trace.
- leafStackFrame = model.stackFrames[leafStackFrameId];
- } else {
- leafStackFrame = new tr.model.StackFrame(
- leafStackFrame, leafStackFrameId, '<self>',
- undefined /* colorId */);
- model.addStackFrame(leafStackFrame);
- }
- }
- } else {
- // New format:
- // Undefined index -> (invalid value)
- // Defined index for /A/B -> /A/B
- if (leafStackFrameIndex === undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Missing stack frame ID of heap entry ' + i +
- ' (size ' + size + ') in a ' + allocatorName +
- ' heap dump for PID=' + pid + '.'
- });
- continue;
- }
-
- // Get the leaf stack frame corresponding to the provided index.
- var leafStackFrameId = idPrefix + leafStackFrameIndex;
- if (leafStackFrameIndex === '') {
- leafStackFrame = undefined /* root */;
- } else {
- leafStackFrame = model.stackFrames[leafStackFrameId];
- if (leafStackFrame === undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Missing leaf stack frame (ID ' + leafStackFrameId +
- ') of heap entry ' + i + ' (size ' + size + ') in a ' +
- allocatorName + ' heap dump for PID=' + pid + '.'
- });
- continue;
- }
- }
- }
-
- var objectTypeId = entry.type;
- var objectTypeName;
- if (objectTypeId === undefined) {
- objectTypeName = undefined /* total over all types */;
- } else if (objectTypeNameMap === undefined) {
- // This can only happen when the old format is used.
- continue;
- } else {
- objectTypeName = objectTypeNameMap[objectTypeId];
- if (objectTypeName === undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Missing object type name (ID ' + objectTypeId +
- ') of heap entry ' + i + ' (size ' + size + ') in a ' +
- allocatorName + ' heap dump for pid=' + pid + '.'
- });
- continue;
- }
- }
-
- var size = parseInt(entry.size, 16);
- var count = entry.count === undefined ? undefined :
- parseInt(entry.count, 16);
- heapDump.addEntry(leafStackFrame, objectTypeName, size, count);
- }
-
- // Throw away heap dumps with no entries. This can happen if all raw
- // entries in the trace are skipped for some reason (e.g. invalid leaf
- // stack frame ID).
- if (heapDump.entries.length > 0)
- heapDumps[allocatorName] = heapDump;
- }
-
- if (Object.keys(heapDumps).length > 0)
- processMemoryDump.heapDumps = heapDumps;
- },
-
- parseMemoryDumpLevelOfDetail_: function(levelsOfDetail, dumps, pid,
- dumpId) {
- var rawLevelOfDetail = dumps.level_of_detail;
- var level;
- switch (rawLevelOfDetail) {
- case 'light':
- level = LIGHT;
- break;
- case 'detailed':
- level = DETAILED;
- break;
- case undefined:
- level = undefined;
- break;
- default:
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'unknown raw level of detail \'' + rawLevelOfDetail +
- '\' of process memory dump for PID=' + pid +
- ' and dump ID=' + dumpId + '.'
- });
- return;
- }
-
- if (!this.updateMemoryDumpLevelOfDetail_(
- levelsOfDetail, 'process', level)) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'diffent levels of detail provided for process memory' +
- ' dump for PID=' + pid + ' (dump ID=' + dumpId + ').'
- });
- }
- },
-
- updateMemoryDumpLevelOfDetail_: function(levelsOfDetail, scope, level) {
- // If all process memory dump events have the same level of detail (for
- // the particular 'process' or 'global' scope), return true.
- if (!(scope in levelsOfDetail) || level === levelsOfDetail[scope]) {
- levelsOfDetail[scope] = level;
- return true;
- }
-
- // If the process memory dump events have different levels of detail (for
- // the particular 'process' or 'global' scope), use the highest level and
- // return false.
- if (MEMORY_DUMP_LEVEL_OF_DETAIL_ORDER.indexOf(level) >
- MEMORY_DUMP_LEVEL_OF_DETAIL_ORDER.indexOf(levelsOfDetail[scope])) {
- levelsOfDetail[scope] = level;
- }
- return false;
- },
-
- parseMemoryDumpAllocatorDumps_: function(processMemoryDump,
- globalMemoryDump, processMemoryAllocatorDumpsByFullName,
- globalMemoryAllocatorDumpsByFullName, allMemoryAllocatorDumpsByGuid,
- dumps, pid, dumpId) {
- var rawAllocatorDumps = dumps.allocators;
- if (rawAllocatorDumps === undefined)
- return;
-
- // Construct the MemoryAllocatorDump objects without parent links
- // and add them to the processMemoryAllocatorDumpsByName and
- // globalMemoryAllocatorDumpsByName indices appropriately.
- for (var fullName in rawAllocatorDumps) {
- var rawAllocatorDump = rawAllocatorDumps[fullName];
-
- // Every memory allocator dump should have a GUID. If not, then
- // it cannot be associated with any edges.
- var guid = rawAllocatorDump.guid;
- if (guid === undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Memory allocator dump ' + fullName + ' for PID=' + pid +
- ' and dump ID=' + dumpId + ' does not have a GUID.'
- });
- }
-
- // A memory allocator dump can have optional flags.
- var flags = rawAllocatorDump.flags || 0;
- var isWeakDump = !!(flags & WEAK_MEMORY_ALLOCATOR_DUMP_FLAG);
-
- // Determine if this is a global memory allocator dump (check if
- // it's prefixed with 'global/').
- var containerMemoryDump;
- var dstIndex;
- if (fullName.startsWith(GLOBAL_MEMORY_ALLOCATOR_DUMP_PREFIX)) {
- // Global memory allocator dump.
- fullName = fullName.substring(
- GLOBAL_MEMORY_ALLOCATOR_DUMP_PREFIX.length);
- containerMemoryDump = globalMemoryDump;
- dstIndex = globalMemoryAllocatorDumpsByFullName;
- } else {
- // Process memory allocator dump.
- containerMemoryDump = processMemoryDump;
- dstIndex = processMemoryAllocatorDumpsByFullName;
- }
-
- // Construct or retrieve a memory allocator dump with the provided
- // GUID.
- var allocatorDump = allMemoryAllocatorDumpsByGuid[guid];
- if (allocatorDump === undefined) {
- if (fullName in dstIndex) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Multiple GUIDs provided for' +
- ' memory allocator dump ' + fullName + ': ' +
- dstIndex[fullName].guid + ', ' + guid + ' (ignored) for' +
- ' PID=' + pid + ' and dump ID=' + dumpId + '.'
- });
- continue;
- }
- allocatorDump = new tr.model.MemoryAllocatorDump(
- containerMemoryDump, fullName, guid);
- allocatorDump.weak = isWeakDump;
- dstIndex[fullName] = allocatorDump;
- if (guid !== undefined)
- allMemoryAllocatorDumpsByGuid[guid] = allocatorDump;
- } else {
- // A memory allocator dump with this GUID has already been
- // dumped (so we will only add new attributes). Check that it
- // belonged to the same process or was also global.
- if (allocatorDump.containerMemoryDump !== containerMemoryDump) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Memory allocator dump ' + fullName +
- ' (GUID=' + guid + ') for PID=' + pid + ' and dump ID=' +
- dumpId + ' dumped in different contexts.'
- });
- continue;
- }
- // Check that the names of the memory allocator dumps match.
- if (allocatorDump.fullName !== fullName) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Memory allocator dump with GUID=' + guid + ' for PID=' +
- pid + ' and dump ID=' + dumpId + ' has multiple names: ' +
- allocatorDump.fullName + ', ' + fullName + ' (ignored).'
- });
- continue;
- }
- if (!isWeakDump) {
- // A MemoryAllocatorDump is non-weak if at least one process dumped
- // it without WEAK_MEMORY_ALLOCATOR_DUMP_FLAG.
- allocatorDump.weak = false;
- }
- }
-
- // Add all new attributes to the memory allocator dump.
- var attributes = rawAllocatorDump.attrs;
- if (attributes === undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Memory allocator dump ' + fullName + ' (GUID=' + guid +
- ') for PID=' + pid + ' and dump ID=' + dumpId +
- ' does not have attributes.'
- });
- attributes = {};
- }
-
- for (var attrName in attributes) {
- var attrArgs = attributes[attrName];
- var attrType = attrArgs.type;
- var attrValue = attrArgs.value;
-
- switch (attrType) {
- case 'scalar':
- if (attrName in allocatorDump.numerics) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Multiple values provided for scalar attribute ' +
- attrName + ' of memory allocator dump ' + fullName +
- ' (GUID=' + guid + ') for PID=' + pid + ' and dump ID=' +
- dumpId + '.'
- });
- break;
- }
- var unit = attrArgs.units === 'bytes' ?
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter :
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter;
- var value = parseInt(attrValue, 16);
- allocatorDump.addNumeric(attrName,
- new tr.v.ScalarNumeric(unit, value));
- break;
-
- case 'string':
- if (attrName in allocatorDump.diagnostics) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Multiple values provided for string attribute ' +
- attrName + ' of memory allocator dump ' + fullName +
- ' (GUID=' + guid + ') for PID=' + pid + ' and dump ID=' +
- dumpId + '.'
- });
- break;
- }
- allocatorDump.addDiagnostic(attrName, attrValue);
- break;
-
- default:
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Unknown type provided for attribute ' + attrName +
- ' of memory allocator dump ' + fullName + ' (GUID=' + guid +
- ') for PID=' + pid + ' and dump ID=' + dumpId + ': ' +
- attrType
- });
- break;
- }
- }
- }
- },
-
- inferMemoryAllocatorDumpTree_: function(memoryAllocatorDumpsByFullName) {
- var rootAllocatorDumps = [];
-
- var fullNames = Object.keys(memoryAllocatorDumpsByFullName);
- fullNames.sort();
- for (var i = 0; i < fullNames.length; i++) {
- var fullName = fullNames[i];
- var allocatorDump = memoryAllocatorDumpsByFullName[fullName];
-
- // This is a loop because we might need to build implicit
- // ancestors in case they were not present in the trace.
- while (true) {
- var lastSlashIndex = fullName.lastIndexOf('/');
- if (lastSlashIndex === -1) {
- // If the dump is a root, add it to the top-level
- // rootAllocatorDumps list.
- rootAllocatorDumps.push(allocatorDump);
- break;
- }
-
- // If the dump is not a root, find its parent.
- var parentFullName = fullName.substring(0, lastSlashIndex);
- var parentAllocatorDump =
- memoryAllocatorDumpsByFullName[parentFullName];
-
- // If the parent dump does not exist yet, we build an implicit
- // one and continue up the ancestor chain.
- var parentAlreadyExisted = true;
- if (parentAllocatorDump === undefined) {
- parentAlreadyExisted = false;
- parentAllocatorDump = new tr.model.MemoryAllocatorDump(
- allocatorDump.containerMemoryDump, parentFullName);
- if (allocatorDump.weak !== false) {
- // If we are inferring a parent dump (e.g. 'root/parent') of a
- // current dump (e.g. 'root/parent/current') which is weak (or
- // was also inferred and we don't know yet whether it's weak or
- // not), then we clear the weak flag on the parent dump because
- // we don't know yet whether it should be weak or non-weak:
- //
- // * We can't mark the parent as non-weak straightaway because
- // the parent might have no non-weak descendants (in which
- // case we want the inferred parent to be weak, so that it
- // would be later removed like the current dump).
- // * We can't mark the parent as weak immediately either. If we
- // did and later encounter a non-weak child of the parent
- // (e.g. 'root/parent/another_child'), then we couldn't
- // retroactively mark the inferred parent dump as non-weak
- // because we couldn't tell whether the parent dump was
- // dumped in the trace as weak (in which case it should stay
- // weak and be subsequently removed) or whether it was
- // inferred as weak (in which case it should be changed to
- // non-weak).
- //
- // Therefore, we defer marking the inferred parent as
- // weak/non-weak. If an inferred parent dump does not have any
- // non-weak child, it will be marked as weak at the end of this
- // method.
- //
- // Note that this should not be confused with the recursive
- // propagation of the weak flag from parent dumps to their
- // children and from owned dumps to their owners, which is
- // performed in GlobalMemoryDump.prototype.removeWeakDumps().
- parentAllocatorDump.weak = undefined;
- }
- memoryAllocatorDumpsByFullName[parentFullName] =
- parentAllocatorDump;
- }
-
- // Setup the parent <-> children relationships
- allocatorDump.parent = parentAllocatorDump;
- parentAllocatorDump.children.push(allocatorDump);
-
- // If the parent already existed, then its ancestors were/will be
- // constructed in another iteration of the forEach loop.
- if (parentAlreadyExisted) {
- if (!allocatorDump.weak) {
- // If the current dump is non-weak, then we must ensure that all
- // its inferred ancestors are also non-weak.
- while (parentAllocatorDump !== undefined &&
- parentAllocatorDump.weak === undefined) {
- parentAllocatorDump.weak = false;
- parentAllocatorDump = parentAllocatorDump.parent;
- }
- }
- break;
- }
-
- fullName = parentFullName;
- allocatorDump = parentAllocatorDump;
- }
- }
-
- // All inferred ancestor dumps that have a non-weak child have already
- // been marked as non-weak. We now mark the rest as weak.
- for (var fullName in memoryAllocatorDumpsByFullName) {
- var allocatorDump = memoryAllocatorDumpsByFullName[fullName];
- if (allocatorDump.weak === undefined)
- allocatorDump.weak = true;
- }
-
- return rootAllocatorDumps;
- },
-
- parseMemoryDumpAllocatorEdges_: function(allMemoryAllocatorDumpsByGuid,
- dumpIdEvents, dumpId) {
- for (var pid in dumpIdEvents) {
- var processEvents = dumpIdEvents[pid];
-
- for (var i = 0; i < processEvents.length; i++) {
- var processEvent = processEvents[i];
-
- var dumps = processEvent.args.dumps;
- if (dumps === undefined)
- continue;
-
- var rawEdges = dumps.allocators_graph;
- if (rawEdges === undefined)
- continue;
-
- for (var j = 0; j < rawEdges.length; j++) {
- var rawEdge = rawEdges[j];
-
- var sourceGuid = rawEdge.source;
- var sourceDump = allMemoryAllocatorDumpsByGuid[sourceGuid];
- if (sourceDump === undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Edge for PID=' + pid + ' and dump ID=' + dumpId +
- ' is missing source memory allocator dump (GUID=' +
- sourceGuid + ').'
- });
- continue;
- }
-
- var targetGuid = rawEdge.target;
- var targetDump = allMemoryAllocatorDumpsByGuid[targetGuid];
- if (targetDump === undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Edge for PID=' + pid + ' and dump ID=' + dumpId +
- ' is missing target memory allocator dump (GUID=' +
- targetGuid + ').'
- });
- continue;
- }
-
- var importance = rawEdge.importance;
- var edge = new tr.model.MemoryAllocatorDumpLink(
- sourceDump, targetDump, importance);
-
- switch (rawEdge.type) {
- case 'ownership':
- if (sourceDump.owns !== undefined) {
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Memory allocator dump ' + sourceDump.fullName +
- ' (GUID=' + sourceGuid + ') already owns a memory' +
- ' allocator dump (' +
- sourceDump.owns.target.fullName + ').'
- });
- } else {
- sourceDump.owns = edge;
- targetDump.ownedBy.push(edge);
- }
- break;
-
- case 'retention':
- sourceDump.retains.push(edge);
- targetDump.retainedBy.push(edge);
- break;
-
- default:
- this.model_.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Invalid edge type: ' + rawEdge.type +
- ' (PID=' + pid + ', dump ID=' + dumpId +
- ', source=' + sourceGuid + ', target=' + targetGuid +
- ', importance=' + importance + ').'
- });
- }
- }
- }
- }
- }
- };
-
- tr.importer.Importer.register(TraceEventImporter);
-
- return {
- TraceEventImporter: TraceEventImporter
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer_perf_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer_perf_test.html
deleted file mode 100644
index b7a7c57b3ae..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer_perf_test.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/xhr.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var eventStrings = {};
-
- // @const
- var TEST_NAMES = ['simple_trace', 'lthi_cats'];
- // @const
- var TEST_FILES_PATHS = ['/test_data/simple_trace.json',
- '/test_data/lthi_cats.json.gz'];
-
- function getEvents(url) {
- if (url in eventStrings)
- return eventStrings[url];
- eventStrings[url] = tr.b.getSync(url);
- return eventStrings[url];
- }
-
- function timedPerfTestWithEvents(name, testFn, initialOptions) {
- if (initialOptions.setUp)
- throw new Error(
- 'Per-test setUp not supported. Trivial to fix if needed.');
-
- var options = {};
- for (var k in initialOptions)
- options[k] = initialOptions[k];
- options.setUp = function() {
- TEST_FILES_PATHS.forEach(
- function warmup(url) {
- getEvents(url);
- });
- };
- timedPerfTest(name, testFn, options);
- }
-
- var n110100 = [1, 10, 100];
- n110100.forEach(function(val) {
- timedPerfTestWithEvents(TEST_NAMES[0] + '_' + val, function() {
- var events = getEvents(TEST_FILES_PATHS[0]);
- var m = tr.c.TestUtils.newModelWithEvents([events], {
- shiftWorldToZero: false,
- pruneContainers: false
- });
- }, {iterations: val});
- });
-
- timedPerfTestWithEvents(TEST_NAMES[1] + '_1', function() {
- var events = getEvents(TEST_FILES_PATHS[1]);
- var m = tr.c.TestUtils.newModelWithEvents([events], {
- shiftWorldToZero: false,
- pruneContainers: false
- });
- }, {iterations: 1});
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer_test.html
deleted file mode 100644
index 9270fd150ee..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/trace_event_importer_test.html
+++ /dev/null
@@ -1,5754 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/extras/measure/measure.html">
-<link rel="import" href="/tracing/importer/import.html">
-<link rel="import" href="/tracing/model/container_memory_dump.html">
-<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
-<link rel="import" href="/tracing/model/scoped_id.html">
-<link rel="import" href="/tracing/model/vm_region.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/time_display_mode.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var findSliceNamed = tr.c.TestUtils.findSliceNamed;
- var ClockDomainId = tr.model.ClockDomainId;
- var ColorScheme = tr.b.ColorScheme;
- var MeasureAsyncSlice = tr.e.measure.MeasureAsyncSlice;
- var ScopedId = tr.model.ScopedId;
- var VMRegion = tr.model.VMRegion;
- var ScalarNumeric = tr.v.ScalarNumeric;
- var unitlessNumber_smallerIsBetter =
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter;
- var checkDumpNumericsAndDiagnostics =
- tr.model.MemoryDumpTestUtils.checkDumpNumericsAndDiagnostics;
- var checkVMRegions = tr.model.MemoryDumpTestUtils.checkVMRegions;
- var LIGHT = tr.model.ContainerMemoryDump.LevelOfDetail.LIGHT;
- var DETAILED = tr.model.ContainerMemoryDump.LevelOfDetail.DETAILED;
-
- function makeModel(events, opt_shift, opt_prune) {
- return tr.c.TestUtils.newModelWithEvents([events], {
- shiftWorldToZero: opt_shift,
- pruneEmptyContainers: opt_prune
- });
- }
-
- function makeUnshiftedModel(events) {
- return makeModel(events, false);
- }
-
- function checkHeapEntry(entry, expectedDump, expectedSize, expectedTitles,
- expectedObjectTypeName, expectedCount) {
- assert.strictEqual(entry.heapDump, expectedDump);
- assert.strictEqual(entry.size, expectedSize);
- assert.strictEqual(entry.objectTypeName, expectedObjectTypeName);
- assert.strictEqual(entry.count, expectedCount);
- if (expectedTitles === undefined) {
- assert.isUndefined(entry.leafStackFrame);
- } else {
- assert.deepEqual(
- entry.leafStackFrame.getUserFriendlyStackTrace(), expectedTitles);
- }
- }
-
- function getFrame(heapEntry, distance) {
- var frame = heapEntry.leafStackFrame;
- for (; distance > 0; distance--)
- frame = frame.parentFrame;
- return frame;
- }
-
- test('canImportEmpty', function() {
- assert.isFalse(tr.e.importer.TraceEventImporter.canImport([]));
- assert.isFalse(tr.e.importer.TraceEventImporter.canImport(''));
- });
-
- test('basicSingleThreadNonnestedParsing', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 520, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'},
- {name: 'b', args: {}, pid: 52, ts: 629, cat: 'bar', tid: 53, ph: 'B'},
- {name: 'b', args: {}, pid: 52, ts: 631, cat: 'bar', tid: 53, ph: 'E'}
- ];
-
- var m = makeModel(events);
- assert.equal(m.numProcesses, 1);
- var p = m.processes[52];
- assert.isDefined(p);
-
- assert.equal(p.numThreads, 1);
- var t = p.threads[53];
- assert.isDefined(t);
- assert.equal(t.sliceGroup.length, 2);
- assert.equal(t.tid, 53);
- var slice = t.sliceGroup.slices[0];
- assert.equal(slice.title, 'a');
- assert.equal(slice.category, 'foo');
- assert.equal(slice.start, 0);
- assert.closeTo((560 - 520) / 1000, slice.duration, 1e-5);
- assert.equal(slice.subSlices.length, 0);
-
- slice = t.sliceGroup.slices[1];
- assert.equal(slice.title, 'b');
- assert.equal(slice.category, 'bar');
- assert.closeTo((629 - 520) / 1000, slice.start, 1e-5);
- assert.closeTo((631 - 629) / 1000, slice.duration, 1e-5);
- assert.equal(slice.subSlices.length, 0);
- });
-
- test('basicSingleThreadNonnestedParsingWithCpuDuration', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 520, cat: 'foo', tid: 53, ph: 'B', tts: 221}, // @suppress longLineCheck
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E', tts: 259}, // @suppress longLineCheck
- {name: 'b', args: {}, pid: 52, ts: 629, cat: 'bar', tid: 53, ph: 'B', tts: 329}, // @suppress longLineCheck
- {name: 'b', args: {}, pid: 52, ts: 631, cat: 'bar', tid: 53, ph: 'E', tts: 331} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- assert.equal(m.numProcesses, 1);
- var p = m.processes[52];
- assert.isDefined(p);
-
- assert.equal(p.numThreads, 1);
- var t = p.threads[53];
- assert.isDefined(t);
- assert.equal(t.sliceGroup.length, 2);
- assert.equal(t.tid, 53);
- var slice = t.sliceGroup.slices[0];
- assert.equal(slice.title, 'a');
- assert.equal(slice.category, 'foo');
- assert.equal(slice.start, 0);
- assert.closeTo((560 - 520) / 1000, slice.duration, 1e-5);
- assert.closeTo((259 - 221) / 1000, slice.cpuDuration, 1e-5);
- assert.equal(slice.subSlices.length, 0);
-
- slice = t.sliceGroup.slices[1];
- assert.equal(slice.title, 'b');
- assert.equal(slice.category, 'bar');
- assert.closeTo((629 - 520) / 1000, slice.start, 1e-5);
- assert.closeTo((631 - 629) / 1000, slice.duration, 1e-5);
- assert.closeTo((331 - 329) / 1000, slice.cpuDuration, 1e-5);
- assert.equal(slice.subSlices.length, 0);
- });
-
- test('argumentDupeCreatesNonFailingImportError', function() {
- var events = [
- {name: 'a',
- args: {'x': 1},
- pid: 1,
- ts: 520,
- cat: 'foo',
- tid: 1,
- ph: 'B'},
- {name: 'a',
- args: {'x': 2},
- pid: 1,
- ts: 560,
- cat: 'foo',
- tid: 1,
- ph: 'E'}
- ];
-
- var m = makeModel(events);
- var t = m.processes[1].threads[1];
- var sA = findSliceNamed(t.sliceGroup, 'a');
-
- assert.equal(sA.args.x, 2);
- assert.isTrue(m.hasImportWarnings);
- assert.equal(1, m.importWarnings.length);
- });
-
- test('importMissingArgs', function() {
- var events = [
- {name: 'a', pid: 52, ts: 520, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'},
- {name: 'b', pid: 52, ts: 629, cat: 'bar', tid: 53, ph: 'I'}
- ];
-
- // This should not throw an exception.
- makeModel(events);
- });
-
- test('importDoesNotChokeOnNulls', function() {
- var events = [
- {name: 'a', args: { foo: null }, pid: 52, ts: 520, cat: 'foo', tid: 53, ph: 'B'}, // @suppress longLineCheck
- {name: 'a', pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'}
- ];
-
- // This should not throw an exception.
- makeModel(events);
- });
-
- test('categoryBeginEndMismatchPrefersBegin', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 520, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'bar', tid: 53, ph: 'E'}
- ];
-
- var m = makeModel(events);
- assert.equal(m.numProcesses, 1);
- var p = m.processes[52];
- assert.isDefined(p);
-
- assert.equal(p.numThreads, 1);
- var t = p.threads[53];
- assert.isDefined(t);
- assert.equal(t.sliceGroup.length, 1);
- assert.equal(t.tid, 53);
- var slice = t.sliceGroup.slices[0];
- assert.equal(slice.title, 'a');
- assert.equal(slice.category, 'foo');
- });
-
- test('beginEndNameMismatch', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 520, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'b', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'}
- ];
-
- var m = makeModel(events);
- assert.isTrue(m.hasImportWarnings);
- assert.equal(m.importWarnings.length, 1);
- });
-
- test('nestedParsing', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, tts: 1, cat: 'foo', tid: 1, ph: 'B'},
- {name: 'b', args: {}, pid: 1, ts: 2, tts: 2, cat: 'bar', tid: 1, ph: 'B'},
- {name: 'b', args: {}, pid: 1, ts: 3, tts: 3, cat: 'bar', tid: 1, ph: 'E'},
- {name: 'a', args: {}, pid: 1, ts: 4, tts: 3, cat: 'foo', tid: 1, ph: 'E'}
- ];
- var m = makeModel(events, false);
- var t = m.processes[1].threads[1];
-
- var sA = findSliceNamed(t.sliceGroup, 'a');
- var sB = findSliceNamed(t.sliceGroup, 'b');
-
- assert.equal(sA.title, 'a');
- assert.equal(sA.category, 'foo');
- assert.equal(sA.start, 0.001);
- assert.equal(sA.duration, 0.003);
- assert.equal(sA.selfTime, 0.002);
- assert.equal(sA.cpuSelfTime, 0.001);
-
- assert.equal(sB.title, 'b');
- assert.equal(sB.category, 'bar');
- assert.equal(sB.start, 0.002);
- assert.equal(sB.duration, 0.001);
-
- assert.equal(1, sA.subSlices.length);
- assert.equal(sB, sA.subSlices[0]);
- assert.equal(sA, sB.parentSlice);
- });
-
- test('nestedParsingWithTwoSubSlices', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, tts: 1, cat: 'foo', tid: 1, ph: 'B'},
- {name: 'b', args: {}, pid: 1, ts: 2, tts: 2, cat: 'bar', tid: 1, ph: 'B'},
- {name: 'b', args: {}, pid: 1, ts: 3, tts: 3, cat: 'bar', tid: 1, ph: 'E'},
- {name: 'c', args: {}, pid: 1, ts: 5, tts: 5, cat: 'baz', tid: 1, ph: 'B'},
- {name: 'c', args: {}, pid: 1, ts: 7, tts: 6, cat: 'baz', tid: 1, ph: 'E'},
- {name: 'a', args: {}, pid: 1, ts: 8, tts: 8, cat: 'foo', tid: 1, ph: 'E'}
- ];
- var m = makeModel(events, false);
- var t = m.processes[1].threads[1];
-
- var sA = findSliceNamed(t.sliceGroup, 'a');
- var sB = findSliceNamed(t.sliceGroup, 'b');
- var sC = findSliceNamed(t.sliceGroup, 'c');
-
- assert.equal(sA.title, 'a');
- assert.equal(sA.category, 'foo');
- assert.equal(sA.start, 0.001);
- assert.equal(sA.duration, 0.007);
- assert.equal(sA.selfTime, 0.004);
- assert.equal(sA.cpuSelfTime, 0.005);
-
- assert.equal(sB.title, 'b');
- assert.equal(sB.category, 'bar');
- assert.equal(sB.start, 0.002);
- assert.equal(sB.duration, 0.001);
-
- assert.equal(sC.title, 'c');
- assert.equal(sC.category, 'baz');
- assert.equal(sC.start, 0.005);
- assert.equal(sC.duration, 0.002);
-
- assert.equal(sA.subSlices.length, 2);
- assert.equal(sA.subSlices[0], sB);
- assert.equal(sA.subSlices[1], sC);
- assert.equal(sB.parentSlice, sA);
- assert.equal(sC.parentSlice, sA);
- });
-
- test('nestedParsingWithDoubleNesting', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'B'},
- {name: 'b', args: {}, pid: 1, ts: 2, cat: 'bar', tid: 1, ph: 'B'},
- {name: 'c', args: {}, pid: 1, ts: 3, cat: 'baz', tid: 1, ph: 'B'},
- {name: 'c', args: {}, pid: 1, ts: 5, cat: 'baz', tid: 1, ph: 'E'},
- {name: 'b', args: {}, pid: 1, ts: 7, cat: 'bar', tid: 1, ph: 'E'},
- {name: 'a', args: {}, pid: 1, ts: 8, cat: 'foo', tid: 1, ph: 'E'}
- ];
- var m = makeModel(events, false);
- var t = m.processes[1].threads[1];
-
- var sA = findSliceNamed(t.sliceGroup, 'a');
- var sB = findSliceNamed(t.sliceGroup, 'b');
- var sC = findSliceNamed(t.sliceGroup, 'c');
-
- assert.equal(sA.title, 'a');
- assert.equal(sA.category, 'foo');
- assert.equal(sA.start, 0.001);
- assert.equal(sA.duration, 0.007);
- assert.equal(sA.selfTime, 0.002);
-
- assert.equal(sB.title, 'b');
- assert.equal(sB.category, 'bar');
- assert.equal(sB.start, 0.002);
- assert.equal(sB.duration, 0.005);
- assert.equal(sA.selfTime, 0.002);
-
- assert.equal(sC.title, 'c');
- assert.equal(sC.category, 'baz');
- assert.equal(sC.start, 0.003);
- assert.equal(sC.duration, 0.002);
-
- assert.equal(sA.subSlices.length, 1);
- assert.equal(sA.subSlices[0], sB);
- assert.equal(sB.parentSlice, sA);
-
- assert.equal(sB.subSlices.length, 1);
- assert.equal(sB.subSlices[0], sC);
- assert.equal(sC.parentSlice, sB);
- });
-
-
- test('autoclosing', function() {
- var events = [
- // Slice that doesn't finish.
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'B'},
-
- // Slice that does finish to give an 'end time' to make autoclosing work.
- {name: 'b', args: {}, pid: 1, ts: 1, cat: 'bar', tid: 2, ph: 'B'},
- {name: 'b', args: {}, pid: 1, ts: 2, cat: 'bar', tid: 2, ph: 'E'}
- ];
- var m = makeUnshiftedModel(events);
- var p = m.processes[1];
- var t1 = p.threads[1];
- var t2 = p.threads[2];
- assert.isTrue(t1.sliceGroup.slices[0].didNotFinish);
- assert.equal(t1.sliceGroup.slices[0].end, 0.001);
- });
-
- test('autoclosingLoneBegin', function() {
- var events = [
- // Slice that doesn't finish.
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'B'}
- ];
- var m = makeModel(events);
- var p = m.processes[1];
- var t = p.threads[1];
- var slice = t.sliceGroup.slices[0];
- assert.equal(slice.title, 'a');
- assert.equal(slice.category, 'foo');
- assert.isTrue(slice.didNotFinish);
- assert.equal(slice.start, 0);
- assert.equal(slice.duration, 0);
- });
-
- test('autoclosingWithSubTasks', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'B'},
- {name: 'b1', args: {}, pid: 1, ts: 2, cat: 'foo', tid: 1, ph: 'B'},
- {name: 'b1', args: {}, pid: 1, ts: 3, cat: 'foo', tid: 1, ph: 'E'},
- {name: 'b2', args: {}, pid: 1, ts: 3, cat: 'foo', tid: 1, ph: 'B'}
- ];
- var m = makeModel(events, false);
- var t = m.processes[1].threads[1];
-
- var sA = findSliceNamed(t.sliceGroup, 'a');
- var sB1 = findSliceNamed(t.sliceGroup, 'b1');
- var sB2 = findSliceNamed(t.sliceGroup, 'b2');
-
- assert.equal(sA.end, 0.003);
- assert.equal(sB1.end, 0.003);
- assert.equal(sB2.end, 0.003);
- });
-
- test('autoclosingWithEventsOutsideBounds', function() {
- var events = [
- // Slice that begins before min and ends after max of the other threads.
- {name: 'a', args: {}, pid: 1, ts: 0, cat: 'foo', tid: 1, ph: 'B'},
- {name: 'b', args: {}, pid: 1, ts: 3, cat: 'foo', tid: 1, ph: 'B'},
-
- // Slice that does finish to give an 'end time' to establish a basis
- {name: 'c', args: {}, pid: 1, ts: 1, cat: 'bar', tid: 2, ph: 'B'},
- {name: 'c', args: {}, pid: 1, ts: 2, cat: 'bar', tid: 2, ph: 'E'}
- ];
- var m = makeModel(events);
- var p = m.processes[1];
- var t = p.threads[1];
- assert.equal(t.sliceGroup.length, 2);
-
- var slice = findSliceNamed(t.sliceGroup, 'a');
- assert.equal(slice.title, 'a');
- assert.equal(slice.category, 'foo');
- assert.equal(slice.start, 0);
- assert.equal(slice.duration, 0.003);
-
- var t2 = p.threads[2];
- var slice2 = findSliceNamed(t2.sliceGroup, 'c');
- assert.equal(slice2.title, 'c');
- assert.equal(slice2.category, 'bar');
- assert.equal(slice2.start, 0.001);
- assert.equal(slice2.duration, 0.001);
-
- assert.equal(m.bounds.min, 0.000);
- assert.equal(m.bounds.max, 0.003);
- });
-
- test('nestedAutoclosing', function() {
- var events = [
- // Tasks that don't finish.
- {name: 'a1', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'B'},
- {name: 'a2', args: {}, pid: 1, ts: 1.5, cat: 'foo', tid: 1, ph: 'B'},
-
- // Slice that does finish to give an 'end time' to make autoclosing work.
- {name: 'b', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 2, ph: 'B'},
- {name: 'b', args: {}, pid: 1, ts: 2, cat: 'foo', tid: 2, ph: 'E'}
- ];
- var m = makeUnshiftedModel(events, false);
- var t1 = m.processes[1].threads[1];
- var t2 = m.processes[1].threads[2];
-
- var sA1 = findSliceNamed(t1.sliceGroup, 'a1');
- var sA2 = findSliceNamed(t1.sliceGroup, 'a2');
- var sB = findSliceNamed(t2.sliceGroup, 'b');
-
- assert.equal(sA1.end, 0.0015);
- assert.equal(sA2.end, 0.0015);
- });
-
- test('taskColoring', function() {
- // The test below depends on hashing of 'a' != 'b'. Fail early if that
- // assumption is incorrect.
- assert.notEqual(ColorScheme.getStringHash('a'),
- ColorScheme.getStringHash('b'));
-
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'B'},
- {name: 'a', args: {}, pid: 1, ts: 2, cat: 'foo', tid: 1, ph: 'E'},
- {name: 'b', args: {}, pid: 1, ts: 3, cat: 'bar', tid: 1, ph: 'B'},
- {name: 'b', args: {}, pid: 1, ts: 4, cat: 'bar', tid: 1, ph: 'E'},
- {name: 'a', args: {}, pid: 1, ts: 5, cat: 'baz', tid: 1, ph: 'B'},
- {name: 'a', args: {}, pid: 1, ts: 6, cat: 'baz', tid: 1, ph: 'E'}
- ];
- var m = makeModel(events);
- var p = m.processes[1];
- var t = p.threads[1];
- var a1 = t.sliceGroup.slices[0];
- assert.equal(a1.title, 'a');
- assert.equal(a1.category, 'foo');
- var b = t.sliceGroup.slices[1];
- assert.equal(b.title, 'b');
- assert.equal(b.category, 'bar');
- assert.notEqual(b.colorId, a1.colorId);
- var a2 = t.sliceGroup.slices[2];
- assert.equal(a2.title, 'a');
- assert.equal(a2.category, 'baz');
- assert.equal(a1.colorId, a2.colorId);
- });
-
- test('durationColorArgument', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'B', cname: 'thread_state_unknown'}, // @suppress longLineCheck
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'E', cname: 'thread_state_unknown'} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- var p = m.processes[1];
- var t = p.threads[1];
- assert.equal(t.sliceGroup.slices[0].colorId,
- ColorScheme.getColorIdForReservedName('thread_state_unknown'));
- });
-
- test('durationColorEnd', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'B', cname: 'thread_state_sleeping'}, // @suppress longLineCheck
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'E', cname: 'thread_state_unknown'} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- var p = m.processes[1];
- var t = p.threads[1];
- assert.equal(t.sliceGroup.slices[0].colorId,
- ColorScheme.getColorIdForReservedName('thread_state_unknown'));
- });
-
- test('completeColorArgument', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, dur: 1, cat: 'foo', tid: 1, ph: 'X', cname: 'generic_work'} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- var p = m.processes[1];
- var t = p.threads[1];
- assert.equal(t.sliceGroup.slices[0].colorId,
- ColorScheme.getColorIdForReservedName('generic_work'));
- });
-
- test('asyncColorArgument', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'b', id: 1, cname: 'generic_work'}, // @suppress longLineCheck
- {name: 'a', args: {}, pid: 1, ts: 2, cat: 'foo', tid: 1, ph: 'e', id: 1, cname: 'generic_work'} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- var p = m.processes[1];
- var t = p.threads[1];
- assert.equal(t.asyncSliceGroup.slices[0].colorId,
- ColorScheme.getColorIdForReservedName('generic_work'));
- });
-
- test('asyncColorEnd', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'b', id: 1, cname: 'thread_state_unknown'}, // @suppress longLineCheck
- {name: 'a', args: {}, pid: 1, ts: 2, cat: 'foo', tid: 1, ph: 'e', id: 1, cname: 'generic_work'} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- var p = m.processes[1];
- var t = p.threads[1];
- assert.equal(t.asyncSliceGroup.slices[0].colorId,
- ColorScheme.getColorIdForReservedName('generic_work'));
- });
-
- test('instantThreadColorArgument', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'I', id: 1, cname: 'generic_work'} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- var p = m.processes[1];
- var t = p.threads[1];
- assert.equal(t.sliceGroup.slices[0].colorId,
- ColorScheme.getColorIdForReservedName('generic_work'));
- });
-
- test('instantProcessColorArgument', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'I', id: 1, s: 'p', cname: 'generic_work'} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- var p = m.processes[1];
- assert.equal(p.instantEvents[0].colorId,
- ColorScheme.getColorIdForReservedName('generic_work'));
- });
-
- test('counterColorArgument', function() {
- var events = [
- {name: 'a', args: {'cats': 10}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'C', id: 1, cname: 'generic_work'} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- var p = m.processes[1];
- assert.equal(p.counters['foo.a[1]'].series[0].color,
- ColorScheme.getColorIdForReservedName('generic_work'));
- assert.equal(p.counters['foo.a[1]'].series.length, 1);
- });
-
- test('objectColorArgument', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'N', id: 1, cname: 'generic_work'}, // @suppress longLineCheck
- {name: 'a', args: {}, pid: 1, ts: 2, cat: 'foo', tid: 1, ph: 'O', id: 1, cname: 'generic_work'}, // @suppress longLineCheck
- {name: 'a', args: {}, pid: 1, ts: 3, cat: 'foo', tid: 1, ph: 'D', id: 1, cname: 'generic_work'} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- var p = m.processes[1];
- var i = p.objects.instanceMapsByScopedId_['ptr'][1].instances[0];
- assert.equal(i.colorId,
- ColorScheme.getColorIdForReservedName('generic_work'));
- });
-
- test('objectColorEnd', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'N', id: 1, cname: 'thread_state_sleeping'}, // @suppress longLineCheck
- {name: 'a', args: {}, pid: 1, ts: 2, cat: 'foo', tid: 1, ph: 'O', id: 1, cname: 'thread_state_unknown'}, // @suppress longLineCheck
- {name: 'a', args: {}, pid: 1, ts: 3, cat: 'foo', tid: 1, ph: 'D', id: 1, cname: 'generic_work'} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- var p = m.processes[1];
- var i = p.objects.instanceMapsByScopedId_['ptr'][1].instances[0];
- assert.equal(i.colorId,
- ColorScheme.getColorIdForReservedName('generic_work'));
- });
-
- test('multipleThreadParsing', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'B'},
- {name: 'a', args: {}, pid: 1, ts: 2, cat: 'foo', tid: 1, ph: 'E'},
- {name: 'b', args: {}, pid: 1, ts: 3, cat: 'bar', tid: 2, ph: 'B'},
- {name: 'b', args: {}, pid: 1, ts: 4, cat: 'bar', tid: 2, ph: 'E'}
- ];
- var m = makeModel(events);
- assert.equal(m.numProcesses, 1);
- var p = m.processes[1];
- assert.isDefined(p);
-
- assert.equal(p.numThreads, 2);
-
- // Check thread 1.
- var t = p.threads[1];
- assert.isDefined(t);
- assert.equal(t.sliceGroup.length, 1);
- assert.equal(t.tid, 1);
-
- var slice = t.sliceGroup.slices[0];
- assert.equal(slice.title, 'a');
- assert.equal(slice.category, 'foo');
- assert.equal(slice.start, 0);
- assert.equal(slice.duration, (2 - 1) / 1000);
- assert.equal(slice.subSlices.length, 0);
-
- // Check thread 2.
- var t = p.threads[2];
- assert.isDefined(t);
- assert.equal(t.sliceGroup.length, 1);
- assert.equal(t.tid, 2);
-
- slice = t.sliceGroup.slices[0];
- assert.equal(slice.title, 'b');
- assert.equal(slice.category, 'bar');
- assert.equal(slice.start, (3 - 1) / 1000);
- assert.equal(slice.duration, (4 - 3) / 1000);
- assert.equal(slice.subSlices.length, 0);
- });
-
- test('multiplePidParsing', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'B'},
- {name: 'a', args: {}, pid: 1, ts: 2, cat: 'foo', tid: 1, ph: 'E'},
- {name: 'b', args: {}, pid: 2, ts: 3, cat: 'bar', tid: 2, ph: 'B'},
- {name: 'b', args: {}, pid: 2, ts: 4, cat: 'bar', tid: 2, ph: 'E'}
- ];
- var m = makeModel(events);
- assert.equal(m.numProcesses, 2);
- var p = m.processes[1];
- assert.isDefined(p);
-
- assert.equal(p.numThreads, 1);
-
- // Check process 1 thread 1.
- var t = p.threads[1];
- assert.isDefined(t);
- assert.equal(t.sliceGroup.length, 1);
- assert.equal(t.tid, 1);
-
- var slice = t.sliceGroup.slices[0];
- assert.equal(slice.title, 'a');
- assert.equal(slice.category, 'foo');
- assert.equal(slice.start, 0);
- assert.equal(slice.duration, (2 - 1) / 1000);
- assert.equal(slice.subSlices.length, 0);
-
- // Check process 2 thread 2.
- var p = m.processes[2];
- assert.isDefined(p);
- assert.equal(p.numThreads, 1);
- var t = p.threads[2];
- assert.isDefined(t);
- assert.equal(t.sliceGroup.length, 1);
- assert.equal(t.tid, 2);
-
- slice = t.sliceGroup.slices[0];
- assert.equal(slice.title, 'b');
- assert.equal(slice.category, 'bar');
- assert.equal(slice.start, (3 - 1) / 1000);
- assert.equal(slice.duration, (4 - 3) / 1000);
- assert.equal(slice.subSlices.length, 0);
-
- // Check getAllThreads.
- assert.deepEqual(m.getAllThreads(),
- [m.processes[1].threads[1], m.processes[2].threads[2]]);
- });
-
- // Process names.
- test('processNames', function() {
- var events = [
- {name: 'process_name', args: {name: 'SomeProcessName'},
- pid: 1, ts: 0, tid: 1, ph: 'M'},
- {name: 'process_name', args: {name: 'SomeProcessName'},
- pid: 2, ts: 0, tid: 1, ph: 'M'}
- ];
- var m = makeModel(events);
- assert.equal(m.processes[1].name, 'SomeProcessName');
- });
-
- // Process labels.
- test('processLabels', function() {
- var events = [
- {name: 'process_labels', args: {labels: 'foo,bar,bar,foo,baz'},
- pid: 1, ts: 0, tid: 1, ph: 'M'},
- {name: 'process_labels', args: {labels: 'baz'},
- pid: 2, ts: 0, tid: 1, ph: 'M'}
- ];
- var m = makeModel(events);
- assert.deepEqual(m.processes[1].labels, ['foo', 'bar', 'baz']);
- assert.deepEqual(m.processes[2].labels, ['baz']);
- });
-
- // Process sort index.
- test('processSortIndex', function() {
- var events = [
- {name: 'process_name', args: {name: 'First'},
- pid: 2, ts: 0, tid: 1, ph: 'M'},
- {name: 'process_name', args: {name: 'Second'},
- pid: 2, ts: 0, tid: 1, ph: 'M'},
- {name: 'process_sort_index', args: {sort_index: 1},
- pid: 1, ts: 0, tid: 1, ph: 'M'}
- ];
- var m = makeModel(events);
-
- // By name, p1 is before p2. But, its sort index overrides that.
- assert.isAbove(m.processes[1].compareTo(m.processes[2]), 0);
- });
-
- // Thread names.
- test('threadNames', function() {
- var events = [
- {name: 'thread_name', args: {name: 'Thread 1'},
- pid: 1, ts: 0, tid: 1, ph: 'M'},
- {name: 'thread_name', args: {name: 'Thread 2'},
- pid: 2, ts: 0, tid: 2, ph: 'M'}
- ];
- var m = makeModel(events, false, false);
- assert.equal(m.processes[1].threads[1].name, 'Thread 1');
- assert.equal(m.processes[2].threads[2].name, 'Thread 2');
- });
-
- // Thread sort index.
- test('threadSortIndex', function() {
- var events = [
- {name: 'thread_name', args: {name: 'Thread 1'},
- pid: 1, ts: 0, tid: 1, ph: 'M'},
- {name: 'thread_name', args: {name: 'Thread 2'},
- pid: 1, ts: 0, tid: 2, ph: 'M'},
- {name: 'thread_sort_index', args: {sort_index: 1},
- pid: 1, ts: 0, tid: 1, ph: 'M'}
- ];
- var m = makeModel(events, false, false);
-
- // By name, t1 is before t2. But, its sort index overrides that.
- var t1 = m.processes[1].threads[1];
- var t2 = m.processes[1].threads[2];
- assert.isAbove(t1.compareTo(t2), 0);
- });
-
- // CPU counts.
- test('cpuCounts', function() {
- var events = [
- {name: 'num_cpus', args: {number: 4},
- pid: 7, ts: 0, tid: 0, ph: 'M'},
- {name: 'num_cpus', args: {number: 4},
- pid: 14, ts: 0, tid: 0, ph: 'M'}
- ];
- var m = makeModel(events);
- assert.equal(m.kernel.softwareMeasuredCpuCount, 4);
- assert.equal(m.kernel.bestGuessAtCpuCount, 4);
- });
-
- test('cpuCountsWithSandboxBeingConfused', function() {
- var events = [
- {name: 'num_cpus', args: {number: 4},
- pid: 7, ts: 0, tid: 0, ph: 'M'},
- {name: 'num_cpus', args: {number: 1},
- pid: 14, ts: 0, tid: 0, ph: 'M'}
- ];
- var m = makeModel(events);
- assert.equal(m.kernel.softwareMeasuredCpuCount, 4);
- assert.equal(m.kernel.bestGuessAtCpuCount, 4);
- });
-
- test('parsingWhenEndComesFirst', function() {
- var events = [
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'E'},
- {name: 'a', args: {}, pid: 1, ts: 4, cat: 'foo', tid: 1, ph: 'B'},
- {name: 'a', args: {}, pid: 1, ts: 5, cat: 'foo', tid: 1, ph: 'E'}
- ];
- var m = makeModel(events, false);
- var p = m.processes[1];
- var t = p.threads[1];
- assert.equal(t.sliceGroup.length, 1);
- assert.equal(t.sliceGroup.slices[0].title, 'a');
- assert.equal(t.sliceGroup.slices[0].category, 'foo');
- assert.equal(t.sliceGroup.slices[0].start, 0.004);
- assert.equal(t.sliceGroup.slices[0].duration, 0.001);
- assert.isTrue(m.hasImportWarnings);
- assert.equal(m.importWarnings.length, 1);
- });
-
- test('immediateParsing', function() {
- var events = [
- // Need to include immediates inside a task so the timeline
- // recentering/zeroing doesn't clobber their timestamp.
- {name: 'a', args: {}, pid: 1, ts: 1, cat: 'foo', tid: 1, ph: 'B'},
- {name: 'immediate', args: {}, pid: 1, ts: 2, cat: 'bar', tid: 1, ph: 'I'},
- {name: 'slower', args: {}, pid: 1, ts: 4, cat: 'baz', tid: 1, ph: 'i'},
- {name: 'a', args: {}, pid: 1, ts: 4, cat: 'foo', tid: 1, ph: 'E'}
- ];
- var m = makeModel(events, false);
- var p = m.processes[1];
- var t = p.threads[1];
-
- assert.equal(t.sliceGroup.length, 3);
- assert.equal(t.sliceGroup.slices[0].start, 0.001);
- assert.equal(t.sliceGroup.slices[0].duration, 0.003);
- assert.equal(t.sliceGroup.slices[1].start, 0.002);
- assert.equal(t.sliceGroup.slices[1].duration, 0);
- assert.equal(t.sliceGroup.slices[2].start, 0.004);
-
- var slice = findSliceNamed(t.sliceGroup, 'a');
- assert.equal(slice.title, 'a');
- assert.equal(slice.category, 'foo');
- assert.equal(slice.duration, 0.003);
-
- var immed = findSliceNamed(t.sliceGroup, 'immediate');
- assert.equal(immed.title, 'immediate');
- assert.equal(immed.category, 'bar');
- assert.equal(immed.start, 0.002);
- assert.equal(immed.duration, 0);
-
- var slower = findSliceNamed(t.sliceGroup, 'slower');
- assert.equal(slower.title, 'slower');
- assert.equal(slower.category, 'baz');
- assert.equal(slower.start, 0.004);
- assert.equal(slower.duration, 0);
- });
-
- test('simpleCounter', function() {
- var events = [
- {name: 'ctr', args: {'value': 0}, pid: 1, ts: 0, cat: 'foo', tid: 1,
- ph: 'C'},
- {name: 'ctr', args: {'value': 10}, pid: 1, ts: 10, cat: 'foo', tid: 1,
- ph: 'C'},
- {name: 'ctr', args: {'value': 0}, pid: 1, ts: 20, cat: 'foo', tid: 1,
- ph: 'C'}
-
- ];
- var m = makeModel(events);
- var p = m.processes[1];
- var ctr = m.processes[1].counters['foo.ctr'];
-
- assert.equal(ctr.name, 'ctr');
- assert.equal(ctr.category, 'foo');
- assert.equal(ctr.numSamples, 3);
- assert.equal(ctr.numSeries, 1);
-
- assert.equal(ctr.series[0].name, 'value');
- assert.equal(ctr.series[0].color,
- ColorScheme.getColorIdForGeneralPurposeString('ctr.value'));
-
- assert.deepEqual(ctr.timestamps, [0, 0.01, 0.02]);
-
- var samples = [];
- ctr.series[0].samples.forEach(function(sample) {
- samples.push(sample.value);
- });
- assert.deepEqual(samples, [0, 10, 0]);
-
- assert.deepEqual(ctr.totals, [0, 10, 0]);
- assert.equal(ctr.maxTotal, 10);
- });
-
- test('instanceCounter', function() {
- var events = [
- {name: 'ctr', args: {'value': 0}, pid: 1, ts: 0, cat: 'foo', tid: 1,
- ph: 'C', id: 0},
- {name: 'ctr', args: {'value': 10}, pid: 1, ts: 10, cat: 'foo', tid: 1,
- ph: 'C', id: 0},
- {name: 'ctr', args: {'value': 10}, pid: 1, ts: 10, cat: 'foo', tid: 1,
- ph: 'C', id: 1},
- {name: 'ctr', args: {'value': 20}, pid: 1, ts: 15, cat: 'foo', tid: 1,
- ph: 'C', id: 1},
- {name: 'ctr', args: {'value': 30}, pid: 1, ts: 18, cat: 'foo', tid: 1,
- ph: 'C', id: 1},
- {name: 'ctr', args: {'value': 40}, pid: 1, ts: 20, cat: 'bar', tid: 1,
- ph: 'C', id: 2}
- ];
- var m = makeModel(events);
- var p = m.processes[1];
- var ctr = m.processes[1].counters['foo.ctr[0]'];
- assert.equal(ctr.name, 'ctr[0]');
- assert.equal(ctr.category, 'foo');
- assert.equal(ctr.numSamples, 2);
- assert.equal(ctr.numSeries, 1);
-
- assert.deepEqual(ctr.timestamps, [0, 0.01]);
- var samples = [];
- ctr.series[0].samples.forEach(function(sample) {
- samples.push(sample.value);
- });
- assert.deepEqual(samples, [0, 10]);
-
- ctr = m.processes[1].counters['foo.ctr[1]'];
- assert.equal(ctr.name, 'ctr[1]');
- assert.equal(ctr.category, 'foo');
- assert.equal(ctr.numSamples, 3);
- assert.equal(ctr.numSeries, 1);
- assert.deepEqual(ctr.timestamps, [0.01, 0.015, 0.018]);
-
- samples = [];
- ctr.series[0].samples.forEach(function(sample) {
- samples.push(sample.value);
- });
- assert.deepEqual(samples, [10, 20, 30]);
-
- ctr = m.processes[1].counters['bar.ctr[2]'];
- assert.equal(ctr.name, 'ctr[2]');
- assert.equal(ctr.category, 'bar');
- assert.equal(ctr.numSamples, 1);
- assert.equal(ctr.numSeries, 1);
- assert.deepEqual(ctr.timestamps, [0.02]);
- var samples = [];
- ctr.series[0].samples.forEach(function(sample) {
- samples.push(sample.value);
- });
- assert.deepEqual(samples, [40]);
- });
-
- test('multiCounterUpdateBounds', function() {
- var ctr = new tr.model.Counter(undefined, 'testBasicCounter',
- '', 'testBasicCounter');
- var value1Series = new tr.model.CounterSeries(
- 'value1', 'testBasicCounter.value1');
- var value2Series = new tr.model.CounterSeries(
- 'value2', 'testBasicCounter.value2');
- ctr.addSeries(value1Series);
- ctr.addSeries(value2Series);
-
- value1Series.addCounterSample(0, 0);
- value1Series.addCounterSample(1, 1);
- value1Series.addCounterSample(2, 1);
- value1Series.addCounterSample(3, 2);
- value1Series.addCounterSample(4, 3);
- value1Series.addCounterSample(5, 1);
- value1Series.addCounterSample(6, 3);
- value1Series.addCounterSample(7, 3.1);
-
- value2Series.addCounterSample(0, 0);
- value2Series.addCounterSample(1, 0);
- value2Series.addCounterSample(2, 1);
- value2Series.addCounterSample(3, 1.1);
- value2Series.addCounterSample(4, 0);
- value2Series.addCounterSample(5, 7);
- value2Series.addCounterSample(6, 0);
- value2Series.addCounterSample(7, 0.5);
-
- ctr.updateBounds();
-
- assert.equal(ctr.bounds.min, 0);
- assert.equal(ctr.bounds.max, 7);
- assert.equal(ctr.maxTotal, 8);
- assert.deepEqual([0, 0,
- 1, 1,
- 1, 2,
- 2, 3.1,
- 3, 3,
- 1, 8,
- 3, 3,
- 3.1, 3.6], ctr.totals);
- });
-
- test('multiCounter', function() {
- var events = [
- {name: 'ctr', args: {'value1': 0, 'value2': 7}, pid: 1, ts: 0, cat: 'foo', tid: 1, ph: 'C'}, // @suppress longLineCheck
- {name: 'ctr', args: {'value1': 10, 'value2': 4}, pid: 1, ts: 10, cat: 'foo', tid: 1, ph: 'C'}, // @suppress longLineCheck
- {name: 'ctr', args: {'value1': 0, 'value2': 1 }, pid: 1, ts: 20, cat: 'foo', tid: 1, ph: 'C'} // @suppress longLineCheck
- ];
- var m = makeModel(events);
- var p = m.processes[1];
- var ctr = m.processes[1].counters['foo.ctr'];
- assert.equal(ctr.name, 'ctr');
-
- assert.equal(ctr.name, 'ctr');
- assert.equal(ctr.category, 'foo');
- assert.equal(ctr.numSamples, 3);
- assert.equal(ctr.numSeries, 2);
-
- assert.equal(ctr.series[0].name, 'value1');
- assert.equal(ctr.series[1].name, 'value2');
- assert.equal(ctr.series[0].color,
- ColorScheme.getColorIdForGeneralPurposeString('ctr.value1'));
- assert.equal(ctr.series[1].color,
- ColorScheme.getColorIdForGeneralPurposeString('ctr.value2'));
-
- assert.deepEqual(ctr.timestamps, [0, 0.01, 0.02]);
- var samples = [];
- ctr.series[0].samples.forEach(function(sample) {
- samples.push(sample.value);
- });
- assert.deepEqual(samples, [0, 10, 0]);
-
- var samples1 = [];
- ctr.series[1].samples.forEach(function(sample) {
- samples1.push(sample.value);
- });
- assert.deepEqual(samples1, [7, 4, 1]);
- assert.deepEqual([0, 7,
- 10, 14,
- 0, 1], ctr.totals);
- assert.equal(ctr.maxTotal, 14);
- });
-
- test('importObjectInsteadOfArray', function() {
- var events = { traceEvents: [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'}
- ] };
-
- var m = makeModel(events);
- assert.equal(m.numProcesses, 1);
- });
-
- test('importString', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'}
- ];
-
- var m = makeModel(JSON.stringify(events));
- assert.equal(m.numProcesses, 1);
- });
-
- test('importStringWithLeadingSpaces', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'}
- ];
-
- var m = makeModel(' ' + JSON.stringify(events));
- assert.equal(m.numProcesses, 1);
- });
-
- test('importStringWithTrailingNewLine', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'}
- ];
-
- var m = makeModel(JSON.stringify(events) + '\n');
- assert.equal(m.numProcesses, 1);
- });
-
- test('importStringWithMissingCloseSquareBracket', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'}
- ];
-
- var tmp = JSON.stringify(events);
- assert.equal(tmp[tmp.length - 1], ']');
-
- // Drop off the trailing ]
- var dropped = tmp.substring(0, tmp.length - 1);
- var m = makeModel(dropped);
- assert.equal(m.numProcesses, 1);
- });
-
- test('importStringWithEndingCommaButMissingCloseSquareBracket', function() {
- var lines = [
- '[',
- '{"name": "a", "args": {}, "pid": 52, "ts": 524, "cat": "foo", "tid": 53, "ph": "B"},', // @suppress longLineCheck
- '{"name": "a", "args": {}, "pid": 52, "ts": 560, "cat": "foo", "tid": 53, "ph": "E"},' // @suppress longLineCheck
- ];
- var text = lines.join('\n');
-
- var m = makeModel(text);
- assert.equal(m.numProcesses, 1);
- assert.equal(m.processes[52].threads[53].sliceGroup.length, 1);
- });
-
- test('importStringWithMissingCloseSquareBracketAndNewline', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'}
- ];
-
- var tmp = JSON.stringify(events);
- assert.equal(tmp[tmp.length - 1], ']');
-
- // Drop off the trailing ] and add a newline
- var dropped = tmp.substring(0, tmp.length - 1);
- var m = makeModel(dropped + '\n');
- assert.equal(m.numProcesses, 1);
- });
-
- test('ImportStringEndingCommaButMissingCloseSquareBracketCRLF', function() {
- var lines = [
- '[',
- '{"name": "a", "args": {}, "pid": 52, "ts": 524, "cat": "foo", "tid": 53, "ph": "B"},', // @suppress longLineCheck
- '{"name": "a", "args": {}, "pid": 52, "ts": 560, "cat": "foo", "tid": 53, "ph": "E"},' // @suppress longLineCheck
- ];
- var text = lines.join('\r\n');
-
- var m = makeModel(text);
- assert.equal(m.numProcesses, 1);
- assert.equal(m.processes[52].threads[53].sliceGroup.length, 1);
- });
-
- test('importOldFormat', function() {
- var lines = [
- '[',
- '{"cat":"a","pid":9,"tid":8,"ts":194,"ph":"E","name":"I","args":{}},',
- '{"cat":"b","pid":9,"tid":8,"ts":194,"ph":"B","name":"I","args":{}}',
- ']'
- ];
- var text = lines.join('\n');
- var m = makeModel(text);
- assert.equal(m.numProcesses, 1);
- assert.equal(m.processes[9].threads[8].sliceGroup.length, 1);
- });
-
- test('startFinishOneSliceOneThread', function() {
- var events = [
- // Time is intentionally out of order.
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'cat', tid: 53,
- ph: 'F', id: 72},
- {name: 'a', pid: 52, ts: 524, cat: 'cat', tid: 53,
- ph: 'S', id: 72, args: {'foo': 'bar'}}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- assert.equal(t.asyncSliceGroup.slices.length, 1);
- assert.equal(t.asyncSliceGroup.slices[0].title, 'a');
- assert.equal(t.asyncSliceGroup.slices[0].category, 'cat');
- assert.isTrue(t.asyncSliceGroup.slices[0].isTopLevel);
- assert.equal(t.asyncSliceGroup.slices[0].id, 72);
- assert.equal(t.asyncSliceGroup.slices[0].args.foo, 'bar');
- assert.equal(t.asyncSliceGroup.slices[0].start, 0);
- assert.closeTo(
- (60 - 24) / 1000, t.asyncSliceGroup.slices[0].duration, 1e-5);
- assert.equal(t.asyncSliceGroup.slices[0].startThread, t);
- assert.equal(t.asyncSliceGroup.slices[0].endThread, t);
- });
-
- test('endArgsAddedToSlice', function() {
- var events = [
- {name: 'a', args: {x: 1}, pid: 52, ts: 520, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {y: 2}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'}
- ];
-
- var m = makeModel(events);
- assert.equal(m.numProcesses, 1);
- var p = m.processes[52];
- assert.isDefined(p);
-
- assert.equal(p.numThreads, 1);
- var t = p.threads[53];
- assert.isDefined(t);
- assert.equal(t.sliceGroup.length, 1);
- assert.equal(t.tid, 53);
- var slice = t.sliceGroup.slices[0];
- assert.equal(slice.title, 'a');
- assert.equal(slice.category, 'foo');
- assert.equal(slice.start, 0);
- assert.equal(slice.subSlices.length, 0);
- assert.equal(slice.args['x'], 1);
- assert.equal(slice.args['y'], 2);
- });
-
- test('endArgOverrwritesOriginalArgValueIfDuplicated', function() {
- var events = [
- {name: 'b', args: {z: 3}, pid: 52, ts: 629, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'b', args: {z: 4}, pid: 52, ts: 631, cat: 'foo', tid: 53, ph: 'E'}
- ];
-
- var m = makeModel(events);
- assert.equal(m.numProcesses, 1);
- var p = m.processes[52];
- assert.isDefined(p);
-
- assert.equal(p.numThreads, 1);
- var t = p.threads[53];
- assert.isDefined(t);
- var slice = t.sliceGroup.slices[0];
- assert.equal(slice.title, 'b');
- assert.equal(slice.category, 'foo');
- assert.equal(slice.start, 0);
- assert.equal(slice.subSlices.length, 0);
- assert.equal(slice.args['z'], 4);
- });
-
- test('asyncEndArgsAddedToSlice', function() {
- var events = [
- // Time is intentionally out of order.
- {name: 'c', args: {y: 2}, pid: 52, ts: 560, cat: 'foo', tid: 53,
- ph: 'F', id: 72},
- {name: 'c', args: {x: 1}, pid: 52, ts: 524, cat: 'foo', tid: 53,
- ph: 'S', id: 72}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- assert.equal(t.asyncSliceGroup.slices.length, 1);
- var parentSlice = t.asyncSliceGroup.slices[0];
- assert.equal(parentSlice.title, 'c');
- assert.equal(parentSlice.category, 'foo');
- assert.isTrue(parentSlice.isTopLevel);
- assert.equal(parentSlice.args['x'], 1);
- assert.equal(parentSlice.args['y'], 2);
-
- assert.isDefined(parentSlice.subSlices);
- assert.equal(parentSlice.subSlices.length, 0);
- });
-
- test('asyncEndArgOverwritesOriginalArgValueIfDuplicated', function() {
- var events = [
- // Time is intentionally out of order.
- {name: 'd', args: {z: 4}, pid: 52, ts: 560, cat: 'foo', tid: 53,
- ph: 'F', id: 72},
- {name: 'd', args: {z: 3}, pid: 52, ts: 524, cat: 'foo', tid: 53,
- ph: 'S', id: 72}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- assert.equal(t.asyncSliceGroup.slices.length, 1);
- var parentSlice = t.asyncSliceGroup.slices[0];
- assert.equal(parentSlice.title, 'd');
- assert.equal(parentSlice.category, 'foo');
- assert.isTrue(parentSlice.isTopLevel);
- assert.equal(parentSlice.args['z'], 4);
-
- assert.isDefined(parentSlice.subSlices);
- assert.equal(parentSlice.subSlices.length, 0);
- });
-
- test('asyncStepsInOneThread', function() {
- var events = [
- // Time is intentionally out of order.
- {name: 'a', args: {z: 3}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'F', id: 72}, // @suppress longLineCheck
- {name: 'a', args: {step: 's1', y: 2}, pid: 52, ts: 548, cat: 'foo', tid: 53, ph: 'T', id: 72}, // @suppress longLineCheck
- {name: 'a', args: {x: 1}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'S', id: 72} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- assert.equal(t.asyncSliceGroup.slices.length, 1);
- var parentSlice = t.asyncSliceGroup.slices[0];
- assert.equal(parentSlice.title, 'a');
- assert.equal(parentSlice.category, 'foo');
- assert.isTrue(parentSlice.isTopLevel);
- assert.equal(parentSlice.start, 0);
- assert.equal(parentSlice.args['x'], 1);
- assert.isUndefined(parentSlice.args['y']);
- assert.equal(parentSlice.args['z'], 3);
-
- assert.isDefined(parentSlice.subSlices);
- assert.equal(parentSlice.subSlices.length, 1);
-
- var subSlice = parentSlice.subSlices[0];
- assert.equal(subSlice.title, 'a:s1');
- assert.equal(subSlice.category, 'foo');
- assert.isFalse(subSlice.isTopLevel);
- assert.closeTo((548 - 524) / 1000, subSlice.start, 1e-5);
- assert.closeTo((560 - 548) / 1000, subSlice.duration, 1e-5);
- assert.isUndefined(subSlice.args['x']);
- assert.equal(subSlice.args['y'], 2);
- assert.isUndefined(subSlice.args['z']);
- });
-
- test('asyncStepsMissingStart', function() {
- var events = [
- // Time is intentionally out of order.
- {name: 'a', args: {z: 3}, pid: 52, ts: 560, cat: 'foo', tid: 53,
- ph: 'F', id: 72},
- {name: 'a', args: {step: 's1', y: 2}, pid: 52, ts: 548, cat: 'foo',
- tid: 53, ph: 'T', id: 72}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isUndefined(t);
- });
-
- test('asyncStepsMissingFinish', function() {
- var events = [
- // Time is intentionally out of order.
- {name: 'a', args: {step: 's1', y: 2}, pid: 52, ts: 548, cat: 'foo',
- tid: 53, ph: 'T', id: 72},
- {name: 'a', args: {z: 3}, pid: 52, ts: 560, cat: 'foo', tid: 53,
- ph: 'S', id: 72}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isUndefined(t);
- });
-
- test('asyncStepEndEvent', function() {
- var events = [
- // Time is intentionally out of order.
- {name: 'a', args: {z: 3}, pid: 52, ts: 560, cat: 'foo', tid: 53,
- ph: 'F', id: 72},
- {name: 'a', args: {step: 's1', y: 2}, pid: 52, ts: 548, cat: 'foo',
- tid: 53, ph: 'p', id: 72},
- {name: 'a', args: {x: 1}, pid: 52, ts: 524, cat: 'foo', tid: 53,
- ph: 'S', id: 72}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- assert.equal(t.asyncSliceGroup.slices.length, 1);
- var parentSlice = t.asyncSliceGroup.slices[0];
- assert.equal(parentSlice.title, 'a');
- assert.equal(parentSlice.category, 'foo');
- assert.isTrue(parentSlice.isTopLevel);
- assert.equal(parentSlice.start, 0);
- assert.equal(parentSlice.args['x'], 1);
- assert.isUndefined(parentSlice.args['y']);
- assert.equal(parentSlice.args['z'], 3);
-
- assert.isDefined(parentSlice.subSlices);
- assert.equal(parentSlice.subSlices.length, 1);
- var subSlice = parentSlice.subSlices[0];
- assert.equal(subSlice.title, 'a:s1');
- assert.equal(subSlice.category, 'foo');
- assert.isFalse(subSlice.isTopLevel);
- assert.equal(subSlice.start, 0);
- assert.closeTo((548 - 524) / 1000, subSlice.duration, 1e-5);
- assert.isUndefined(subSlice.args['x']);
- assert.equal(subSlice.args['y'], 2);
- assert.isUndefined(subSlice.args['z']);
- });
-
- test('asyncStepMismatch', function() {
- var events = [
- // Time is intentionally out of order.
- {name: 'a', args: {z: 3}, pid: 52, ts: 560, cat: 'foo', tid: 53,
- ph: 'F', id: 72},
- {name: 'a', args: {step: 's2'}, pid: 52, ts: 548, cat: 'foo', tid: 53,
- ph: 'T', id: 72},
- {name: 'a', args: {step: 's1'}, pid: 52, ts: 548, cat: 'foo', tid: 53,
- ph: 'p', id: 72},
- {name: 'a', args: {x: 1}, pid: 52, ts: 524, cat: 'foo', tid: 53,
- ph: 'S', id: 72}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isUndefined(t);
- assert.isTrue(m.hasImportWarnings);
- });
-
- test('asyncSliceWithoutCPUDuration', function() {
- var events = [
- // Async slice without tts field.
- {name: 'a', args: {params: ''}, pid: 52, ts: 10, cat: 'foo', tid: 53,
- id: 72, ph: 'b'},
- {name: 'a', args: {params: ''}, pid: 52, ts: 20, cat: 'foo', tid: 53,
- id: 72, ph: 'e'},
- // Async slice with tts field but without use_async_tts marker field.
- {name: 'b', args: {params: ''}, pid: 52, ts: 30, cat: 'foo', tid: 53,
- id: 72, ph: 'b', tts: 30000},
- {name: 'b', args: {params: ''}, pid: 52, ts: 40, cat: 'foo', tid: 53,
- id: 72, ph: 'e', tts: 40000},
- // Async slice with tts field but with use_async_tts marker set to 0.
- {name: 'c', args: {params: ''}, pid: 52, ts: 50000, cat: 'foo', tid: 53,
- id: 72, ph: 'b', tts: 50000, use_async_tts: 0},
- {name: 'c', args: {params: ''}, pid: 52, ts: 60000, cat: 'foo', tid: 53,
- id: 72, ph: 'e', tts: 60000, use_async_tts: 0}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- assert.equal(t.asyncSliceGroup.slices.length, 3);
-
- var noTTSNoField = t.asyncSliceGroup.slices[0];
- assert.isUndefined(noTTSNoField.cpuStart);
- assert.isUndefined(noTTSNoField.cpuDuration);
-
- var TTSNoField = t.asyncSliceGroup.slices[1];
- assert.isUndefined(TTSNoField.cpuStart);
- assert.isUndefined(TTSNoField.cpuDuration);
-
- var TTSZeroField = t.asyncSliceGroup.slices[2];
- assert.isUndefined(TTSZeroField.cpuStart);
- assert.isUndefined(TTSZeroField.cpuDuration);
- });
-
- test('asyncSliceWithCPUDuration', function() {
- var events = [
- {name: 'a', args: {params: ''}, pid: 52, ts: 50000, cat: 'foo', tid: 53,
- id: 72, ph: 'b', tts: 100000, use_async_tts: 1},
- {name: 'a', args: {params: ''}, pid: 52, ts: 60000, cat: 'foo', tid: 53,
- id: 72, ph: 'e', tts: 105000, use_async_tts: 1}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- assert.equal(t.asyncSliceGroup.slices.length, 1);
-
- var asyncSlice = t.asyncSliceGroup.slices[0];
- assert.isDefined(asyncSlice);
- assert.equal(asyncSlice.duration, 10);
- assert.equal(asyncSlice.cpuStart, 100);
- assert.equal(asyncSlice.cpuDuration, 5);
- });
-
- test('nestableAsyncBasic', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'b', args: {x: 1}, pid: 52, ts: 525, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'b', args: {y: 2}, pid: 52, ts: 560, cat: 'foo', tid: 53,
- ph: 'e', id: 72},
- {name: 'a', args: {}, pid: 52, ts: 565, cat: 'foo', tid: 53,
- ph: 'e', id: 72}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- assert.equal(t.asyncSliceGroup.slices.length, 1);
- var parentSlice = t.asyncSliceGroup.slices[0];
- assert.equal(parentSlice.title, 'a');
- assert.equal(parentSlice.category, 'foo');
- assert.isTrue(parentSlice.isTopLevel);
-
- assert.isDefined(parentSlice.subSlices);
- assert.equal(parentSlice.subSlices.length, 1);
- var subSlice = parentSlice.subSlices[0];
- assert.isFalse(subSlice.isTopLevel);
- // Arguments should include both BEGIN and END event.
- assert.equal(subSlice.args['x'], 1);
- assert.equal(subSlice.args['y'], 2);
- assert.sameMembers(subSlice.subSlices, []);
- });
-
-
- test('nestableAsyncNoArgs', function() {
- var events = [
- {name: 'name', pid: 52, ts: 525, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'name', pid: 52, ts: 560, cat: 'foo', tid: 53,
- ph: 'e', id: 72}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- assert.equal(t.asyncSliceGroup.slices.length, 1);
- var slice = t.asyncSliceGroup.slices[0];
- assert.equal(slice.title, 'name');
- assert.equal(slice.category, 'foo');
- assert.isTrue(slice.isTopLevel);
-
- assert.isDefined(slice.subSlices);
- assert.equal(slice.subSlices.length, 0);
-
- assert.deepEqual(slice.args, {});
- });
-
- test('nestableAsyncCombinedParams', function() {
- var events = [
- {name: 'a', args: {x: 1, params: {p1: 'hello', p2: 123}},
- pid: 52, ts: 525, cat: 'foo', tid: 53, ph: 'b', id: 72},
- {name: 'a', args: {y: 2, params: {p3: 'hi'}}, pid: 52, ts: 560,
- cat: 'foo', tid: 53, ph: 'e', id: 72},
- {name: 'b', args: {params: {p4: 'foo'}},
- pid: 52, ts: 525, cat: 'foo', tid: 53, ph: 'b', id: 73},
- {name: 'b', args: {params: ''}, pid: 52, ts: 560,
- cat: 'foo', tid: 53, ph: 'e', id: 73},
- {name: 'c', args: {params: {p5: 'bar'}},
- pid: 52, ts: 525, cat: 'foo', tid: 53, ph: 'b', id: 74},
- {name: 'c', args: {}, pid: 52, ts: 560,
- cat: 'foo', tid: 53, ph: 'e', id: 74}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- assert.equal(t.asyncSliceGroup.slices.length, 3);
-
- var sliceA = t.asyncSliceGroup.slices[0];
- // Arguments should include both BEGIN and END event.
- assert.equal(sliceA.args['x'], 1);
- assert.equal(sliceA.args['y'], 2);
- var paramsA = sliceA.args['params'];
- assert.isDefined(paramsA);
- assert.equal(paramsA.p1, 'hello');
- assert.equal(paramsA.p2, 123);
- assert.equal(paramsA.p3, 'hi');
- assert.isTrue(sliceA.isTopLevel);
-
- var sliceB = t.asyncSliceGroup.slices[1];
- // Arguments should include both BEGIN and END event.
- var paramsB = sliceB.args['params'];
- assert.isDefined(paramsB);
- assert.equal(paramsB.p4, 'foo');
- assert.isTrue(sliceB.isTopLevel);
-
- var sliceC = t.asyncSliceGroup.slices[2];
- // Arguments should include both BEGIN and END event.
- var paramsC = sliceC.args['params'];
- assert.isDefined(paramsC);
- assert.equal(paramsC.p5, 'bar');
- assert.isTrue(sliceC.isTopLevel);
- });
-
- test('nestableAsyncManyLevels', function() {
- // There are 5 nested levels.
- var events = [
- {name: 'l1', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'l2', args: {}, pid: 52, ts: 525, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'l3', args: {}, pid: 52, ts: 526, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'l4', args: {}, pid: 52, ts: 527, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'l5', args: {}, pid: 52, ts: 528, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'l5', args: {}, pid: 52, ts: 529, cat: 'foo', tid: 53,
- ph: 'e', id: 72},
- {name: 'l4', args: {}, pid: 52, ts: 530, cat: 'foo', tid: 53,
- ph: 'e', id: 72},
- {name: 'l3', args: {}, pid: 52, ts: 531, cat: 'foo', tid: 53,
- ph: 'e', id: 72},
- {name: 'l2', args: {}, pid: 52, ts: 532, cat: 'foo', tid: 53,
- ph: 'e', id: 72},
- {name: 'l1', args: {}, pid: 52, ts: 533, cat: 'foo', tid: 53,
- ph: 'e', id: 72}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- // Perfectly matched events should not produce a warning.
- assert.isFalse(m.hasImportWarnings);
- assert.equal(t.asyncSliceGroup.slices.length, 1);
-
- var l1Slice = t.asyncSliceGroup.slices[0];
- assert.equal(l1Slice.title, 'l1');
- assert.closeTo(0, l1Slice.start, 1e-5);
- assert.closeTo(9 / 1000, l1Slice.duration, 1e-5);
- assert.isTrue(l1Slice.isTopLevel);
-
- assert.isDefined(l1Slice.subSlices);
- assert.equal(l1Slice.subSlices.length, 1);
- var l2Slice = l1Slice.subSlices[0];
- assert.equal(l2Slice.title, 'l2');
- assert.closeTo(1 / 1000, l2Slice.start, 1e-5);
- assert.closeTo(7 / 1000, l2Slice.duration, 1e-5);
- assert.isFalse(l2Slice.isTopLevel);
-
- assert.isDefined(l2Slice.subSlices);
- assert.equal(l2Slice.subSlices.length, 1);
- var l3Slice = l2Slice.subSlices[0];
- assert.equal(l3Slice.title, 'l3');
- assert.closeTo(2 / 1000, l3Slice.start, 1e-5);
- assert.closeTo(5 / 1000, l3Slice.duration, 1e-5);
- assert.isFalse(l3Slice.isTopLevel);
-
- assert.isDefined(l3Slice.subSlices);
- assert.equal(l3Slice.subSlices.length, 1);
- var l4Slice = l3Slice.subSlices[0];
- assert.equal(l4Slice.title, 'l4');
- assert.closeTo(3 / 1000, l4Slice.start, 1e-5);
- assert.closeTo(3 / 1000, l4Slice.duration, 1e-5);
- assert.isFalse(l4Slice.isTopLevel);
-
- assert.isDefined(l4Slice.subSlices);
- assert.equal(l4Slice.subSlices.length, 1);
- var l5Slice = l4Slice.subSlices[0];
- assert.equal(l5Slice.title, 'l5');
- assert.closeTo(4 / 1000, l5Slice.start, 1e-5);
- assert.closeTo(1 / 1000, l5Slice.duration, 1e-5);
- assert.isFalse(l5Slice.isTopLevel);
- });
-
- test('nestableAsyncInstantEvent', function() {
- var events = [
- {name: 'c', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53,
- ph: 'n', id: 71},
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'd', args: {}, pid: 52, ts: 525, cat: 'foo', tid: 53,
- ph: 'n', id: 72},
- {name: 'a', args: {}, pid: 52, ts: 565, cat: 'foo', tid: 53,
- ph: 'e', id: 72}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- assert.equal(t.asyncSliceGroup.slices.length, 2);
- var instantSlice = t.asyncSliceGroup.slices[0];
- assert.equal(instantSlice.title, 'c');
- assert.closeTo(0, instantSlice.start, 1e-5);
- assert.closeTo(0, instantSlice.duration, 1e-5);
- assert.sameMembers(instantSlice.subSlices, []);
- assert.isTrue(instantSlice.isTopLevel);
-
- var nestedSlice = t.asyncSliceGroup.slices[1];
- assert.equal(nestedSlice.title, 'a');
- assert.closeTo(0, nestedSlice.start, 1e-5);
- assert.closeTo((565 - 524) / 1000, nestedSlice.duration, 1e-5);
- assert.isTrue(nestedSlice.isTopLevel);
- assert.isDefined(nestedSlice.subSlices);
- assert.equal(nestedSlice.subSlices.length, 1);
- var nestedInstantSlice = nestedSlice.subSlices[0];
- assert.sameMembers(nestedInstantSlice.subSlices, []);
- assert.equal(nestedInstantSlice.title, 'd');
- assert.isFalse(nestedInstantSlice.isTopLevel);
- });
-
- test('nestableAsyncUnmatchedOuterBeginEvent', function() {
- var events = [
- {name: 'a', args: {x: 1}, pid: 52, ts: 524, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'b', args: {}, pid: 52, ts: 525, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'b', args: {y: 2}, pid: 52, ts: 560, cat: 'foo', tid: 53,
- ph: 'e', id: 72}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- // Unmatched BEGIN should produce a warning.
- assert.isTrue(m.hasImportWarnings);
- assert.equal(t.asyncSliceGroup.slices.length, 1);
- var parentSlice = t.asyncSliceGroup.slices[0];
- assert.equal(parentSlice.title, 'a');
- assert.equal(parentSlice.category, 'foo');
- assert.isTrue(parentSlice.isTopLevel);
- assert.closeTo(0, parentSlice.start, 0.0001);
- // Unmatched BEGIN event ends at the last event of that ID.
- assert.closeTo(36 / 1000, parentSlice.duration, 0.0001);
- // Arguments should include only include its arguments.
- assert.isUndefined(parentSlice.args['y']);
- assert.equal(parentSlice.args['x'], 1);
- assert.isDefined(parentSlice.error);
-
- assert.isDefined(parentSlice.subSlices);
- assert.equal(parentSlice.subSlices.length, 1);
- var subSlice = parentSlice.subSlices[0];
- assert.isFalse(subSlice.isTopLevel);
- assert.closeTo(1 / 1000, subSlice.start, 1e-5);
- assert.closeTo(35 / 1000, subSlice.duration, 1e-5);
- assert.sameMembers(subSlice.subSlices, []);
- // Arguments should include those of the END event.
- assert.equal(subSlice.args['y'], 2);
- assert.sameMembers(subSlice.subSlices, []);
- });
-
- test('nestableAsyncUnmatchedInnerBeginEvent', function() {
- var events = [
- {name: 'a', args: {z: 3}, pid: 52, ts: 524, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'c', args: {}, pid: 52, ts: 525, cat: 'foo', tid: 53,
- ph: 'n', id: 72},
- {name: 'b', args: {x: 1}, pid: 52, ts: 525, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'a', args: {y: 2}, pid: 52, ts: 565, cat: 'foo', tid: 53,
- ph: 'e', id: 72}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- // Unmatched BEGIN should produce a warning.
- assert.isTrue(m.hasImportWarnings);
- assert.equal(t.asyncSliceGroup.slices.length, 1);
- var parentSlice = t.asyncSliceGroup.slices[0];
- assert.equal(parentSlice.title, 'a');
- assert.equal(parentSlice.category, 'foo');
- assert.isTrue(parentSlice.isTopLevel);
- assert.closeTo(0, parentSlice.start, 1e-5);
- assert.closeTo(41 / 1000, parentSlice.duration, 1e-5);
- // Arguments should include both BEGIN and END event.
- assert.equal(parentSlice.args['y'], 2);
- assert.equal(parentSlice.args['z'], 3);
- assert.isUndefined(parentSlice.args['x']);
-
- assert.isDefined(parentSlice.subSlices);
- assert.equal(parentSlice.subSlices.length, 2);
- var subSliceInstant = parentSlice.subSlices[0];
- var subSliceUnmatched = parentSlice.subSlices[1];
- assert.equal(subSliceInstant.title, 'c');
- assert.isFalse(subSliceInstant.isTopLevel);
- assert.equal(subSliceUnmatched.title, 'b');
- assert.isFalse(subSliceUnmatched.isTopLevel);
- // Unmatched BEGIN ends at the last event of that ID.
- assert.closeTo(1 / 1000, subSliceUnmatched.start, 1e-5);
- assert.closeTo(40 / 1000, subSliceUnmatched.duration, 1e-5);
- assert.sameMembers(subSliceUnmatched.subSlices, []);
- assert.equal(subSliceUnmatched.args['x'], 1);
- assert.isUndefined(subSliceUnmatched['y']);
- assert.isDefined(subSliceUnmatched.error);
- assert.closeTo(1 / 1000, subSliceInstant.start, 1e-5);
- assert.closeTo(0, subSliceInstant.duration, 1e-5);
- assert.sameMembers(subSliceInstant.subSlices, []);
- });
-
- test('nestableAsyncUnmatchedOuterEndEvent', function() {
- // Events are intentionally out-of-order.
- var events = [
- {name: 'b', args: {x: 1}, pid: 52, ts: 525, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'b', args: {y: 2}, pid: 52, ts: 560, cat: 'foo', tid: 53,
- ph: 'e', id: 72},
- {name: 'a', args: {z: 3}, pid: 52, ts: 524, cat: 'foo', tid: 53,
- ph: 'e', id: 72}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- // Unmatched END should produce a warning.
- assert.isTrue(m.hasImportWarnings);
- assert.equal(t.asyncSliceGroup.slices.length, 2);
- var unmatchedSlice = t.asyncSliceGroup.slices[0];
- var slice = t.asyncSliceGroup.slices[1];
- assert.equal(unmatchedSlice.title, 'a');
- assert.closeTo(0, unmatchedSlice.start, 1e-5);
- assert.isTrue(unmatchedSlice.isTopLevel);
- // Unmatched END event begins at the first event of that ID. In this
- // case, the first event happens to be the same unmatched event.
- assert.closeTo(0 / 1000, unmatchedSlice.duration, 1e-5);
- assert.isUndefined(unmatchedSlice.args['x']);
- assert.isUndefined(unmatchedSlice.args['y']);
- assert.equal(unmatchedSlice.args['z'], 3);
- assert.isDefined(unmatchedSlice.error);
- assert.sameMembers(unmatchedSlice.subSlices, []);
-
- assert.equal(slice.title, 'b');
- assert.isTrue(slice.isTopLevel);
- assert.closeTo(1 / 1000, slice.start, 1e-5);
- assert.closeTo(35 / 1000, slice.duration, 1e-5);
- // Arguments should include both BEGIN and END event.
- assert.equal(slice.args['x'], 1);
- assert.equal(slice.args['y'], 2);
- assert.sameMembers(slice.subSlices, []);
- });
-
- test('nestableAsyncUnmatchedInnerEndEvent', function() {
- var events = [
- {name: 'a', args: {x: 1}, pid: 52, ts: 524, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'c', args: {}, pid: 52, ts: 525, cat: 'foo', tid: 53,
- ph: 'n', id: 72},
- {name: 'b', args: {z: 3}, pid: 52, ts: 525, cat: 'foo', tid: 53,
- ph: 'e', id: 72},
- {name: 'a', args: {y: 2}, pid: 52, ts: 565, cat: 'foo', tid: 53,
- ph: 'e', id: 72}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- // Unmatched END should produce a warning.
- assert.isTrue(m.hasImportWarnings);
- assert.equal(t.asyncSliceGroup.slices.length, 1);
- var parentSlice = t.asyncSliceGroup.slices[0];
- assert.equal(parentSlice.title, 'a');
- assert.isTrue(parentSlice.isTopLevel);
- assert.closeTo(0, parentSlice.start, 1e-5);
- assert.closeTo(41 / 1000, parentSlice.duration, 1e-5);
- // Arguments should include both BEGIN and END event.
- assert.equal(parentSlice.args['x'], 1);
- assert.equal(parentSlice.args['y'], 2);
-
- assert.isDefined(parentSlice.subSlices);
- assert.equal(parentSlice.subSlices.length, 2);
- var subSliceInstant = parentSlice.subSlices[0];
- var subSliceUnmatched = parentSlice.subSlices[1];
- assert.equal(subSliceInstant.title, 'c');
- assert.isFalse(subSliceInstant.isTopLevel);
- assert.equal(subSliceUnmatched.title, 'b');
- assert.isFalse(subSliceUnmatched.isTopLevel);
- // Unmatched END begins at the first event of that ID.
- assert.closeTo(0 / 1000, subSliceUnmatched.start, 1e-5);
- assert.closeTo(1 / 1000, subSliceUnmatched.duration, 1e-5);
- // Arguments should include both BEGIN and END event.
- assert.isUndefined(subSliceUnmatched.args['x']);
- assert.isUndefined(subSliceUnmatched.args['y']);
- assert.equal(subSliceUnmatched.args['z'], 3);
- assert.isDefined(subSliceUnmatched.error);
-
- assert.sameMembers(subSliceUnmatched.subSlices, []);
- assert.closeTo(1 / 1000, subSliceInstant.start, 1e-5);
- assert.closeTo(0, subSliceInstant.duration, 1e-5);
- assert.sameMembers(subSliceInstant.subSlices, []);
- });
-
- test('nestableAsyncSameIDDifferentCategory', function() {
- // Events with the same ID, but different categories should not be
- // considered as nested.
- var events = [
- {name: 'EVENT_A', args: {}, pid: 52, ts: 500, cat: 'foo', tid: 53,
- ph: 'b', id: 72},
- {name: 'EVENT_B', args: {y: 2}, pid: 52, ts: 550, cat: 'bar', tid: 53,
- ph: 'b', id: 72},
- {name: 'EVENT_B', args: {}, pid: 52, ts: 600, cat: 'bar', tid: 53,
- ph: 'e', id: 72},
- {name: 'EVENT_A', args: {x: 1}, pid: 52, ts: 650, cat: 'foo', tid: 53,
- ph: 'e', id: 72}
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- assert.equal(t.asyncSliceGroup.slices.length, 2);
- var eventASlice = t.asyncSliceGroup.slices[0];
- assert.equal(eventASlice.title, 'EVENT_A');
- assert.equal(eventASlice.category, 'foo');
- assert.equal(eventASlice.id, 'foo:72');
- assert.isTrue(eventASlice.isTopLevel);
- assert.equal(eventASlice.args['x'], 1);
- assert.sameMembers(eventASlice.subSlices, []);
-
- var eventBSlice = t.asyncSliceGroup.slices[1];
- assert.equal(eventBSlice.title, 'EVENT_B');
- assert.equal(eventBSlice.category, 'bar');
- assert.equal(eventBSlice.id, 'bar:72');
- assert.isTrue(eventBSlice.isTopLevel);
- assert.equal(eventBSlice.args['y'], 2);
- assert.sameMembers(eventBSlice.subSlices, []);
- });
-
- test('nestableAsyncStackFrame', function() {
- var events = {
- traceEvents: [
- {name: 'name', pid: 52, ts: 525, cat: 'foo', tid: 53,
- ph: 'b', id: 72, sf: 1},
- {name: 'name', pid: 52, ts: 560, cat: 'foo', tid: 53,
- ph: 'e', id: 72, sf: 7}
- ],
- stackFrames: {
- '1': {
- category: 'm1',
- name: 'main'
- },
- '7': {
- category: 'm2',
- name: 'frame7',
- parent: '1'
- }
- }
- };
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
- assert.isDefined(t);
- assert.equal(t.asyncSliceGroup.slices.length, 1);
- var slice = t.asyncSliceGroup.slices[0];
-
- assert.equal(slice.startStackFrame.title, 'main');
- assert.equal(slice.endStackFrame.title, 'frame7');
- });
-
- test('importSamples', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 548, cat: 'test', tid: 53, ph: 'P'},
- {name: 'b', args: {}, pid: 52, ts: 548, cat: 'test', tid: 53, ph: 'P'},
- {name: 'c', args: {}, pid: 52, ts: 558, cat: 'test', tid: 53, ph: 'P'},
- {name: 'a', args: {}, pid: 52, ts: 568, cat: 'test', tid: 53, ph: 'P'}
- ];
- var m = makeModel(events);
- var p = m.processes[52];
- assert.isDefined(p);
- var t = p.threads[53];
- assert.isDefined(t);
- assert.equal(t.samples_.length, 4);
- assert.equal(t.samples_[0].start, 0.0);
- assert.equal(t.samples_[1].start, 0.0);
- assert.closeTo(0.01, t.samples_[2].start, 1e-5);
- assert.equal(t.samples_[0].leafStackFrame.title, 'a');
- assert.equal(t.samples_[1].leafStackFrame.title, 'b');
- assert.equal(t.samples_[2].leafStackFrame.title, 'c');
- assert.equal(t.samples_[3].leafStackFrame, t.samples[0].leafStackFrame);
- assert.isFalse(m.hasImportWarnings);
- });
-
- test('importSamplesWithStackFrames', function() {
- var eventData = {
- traceEvents: [
- { name: 'a', args: {}, pid: 1, ts: 0, cat: 'test', tid: 2, ph: 'P', sf: 7 } // @suppress longLineCheck
- ],
- stackFrames: {
- '1': {
- category: 'm1',
- name: 'main'
- },
- '7': {
- category: 'm2',
- name: 'frame7',
- parent: '1'
- }
- }
- };
-
- var m = makeModel(eventData);
-
- var p = m.processes[1];
- var t = p.threads[2];
-
- assert.equal(t.samples.length, 1);
- assert.equal(t.samples_[0].start, 0.0);
- assert.equal(t.samples_[0].leafStackFrame.title, 'frame7');
- assert.isFalse(m.hasImportWarnings);
- });
-
- test('importSamplesMissingArgs', function() {
- var events = [
- {name: 'a', pid: 52, ts: 548, cat: 'test', tid: 53, ph: 'P'},
- {name: 'b', pid: 52, ts: 548, cat: 'test', tid: 53, ph: 'P'},
- {name: 'c', pid: 52, ts: 549, cat: 'test', tid: 53, ph: 'P'}
- ];
- var m = makeModel(events);
- var p = m.processes[52];
- assert.isDefined(p);
- var t = p.threads[53];
- assert.isDefined(t);
- assert.isDefined(t);
- assert.equal(t.samples_.length, 3);
- assert.isFalse(m.hasImportWarnings);
- });
-
- test('importV8Samples', function() {
- var eventData = {
- traceEvents: [
- { name: 'V8Sample', args: {data: {stack: ['0x2a574306061', '0x2a574306224'], vm_state: 'js'}}, pid: 1, ts: 4, cat: 'test', tid: 2, ph: 'P' }, // @suppress longLineCheck
- { name: 'V8Sample', args: {data: {stack: [], vm_state: 'gc'}}, pid: 1, ts: 6, cat: 'test', tid: 2, ph: 'P' }, // @suppress longLineCheck
- { name: 'JitCodeAdded', args: {data: {code_len: 2, name: 'LazyCompile:~foo http://example.com/bar.js:23', code_start: '0x2a574306060'}}, pid: 1, ts: 1, cat: 'test', tid: 2, ph: 'M' }, // @suppress longLineCheck
- { name: 'JitCodeAdded', args: {data: {code_len: 20, name: 'bar', code_start: '0x2a574306220'}}, pid: 1, ts: 2, cat: 'test', tid: 2, ph: 'M' }, // @suppress longLineCheck
- { name: 'JitCodeMoved', args: {data: {code_len: 2, old_code_start: '0x2a574306220', code_start: '0x2a574306222'}}, pid: 1, ts: 3, cat: 'test', tid: 2, ph: 'M' }, // @suppress longLineCheck
- { name: 'JitCodeAdded', args: {data: {code_len: 20, name: 'baz', code_start: '0xffffffff9f90a1a0'}}, pid: 1, ts: 4, cat: 'test', tid: 2, ph: 'M' } // @suppress longLineCheck
- ]
- };
-
- var m = makeModel(eventData);
- var p = m.processes[1];
- var t = p.threads[2];
-
- assert.isFalse(m.hasImportWarnings);
- assert.equal(t.samples.length, 2);
-
- var sample = t.samples_[0];
- assert.equal(sample.leafStackFrame.title,
- 'foo http://example.com/bar.js:22');
- assert.equal(sample.leafStackFrame.parentFrame.title, 'bar');
-
- var sample = t.samples_[1];
- assert.equal(sample.leafStackFrame.title, 'gc');
- });
-
- test('importOldFormatV8Samples', function() {
- var eventData = {
- traceEvents: [
- { name: 'JitCodeAdded', args: {data: {code_len: 2, name: 'LazyCompile:~foo http://example.com/bar.js:23', code_start: '0x2a574306060'}}, pid: 1, ts: 0, cat: 'test', tid: 2, ph: 'I' }, // @suppress longLineCheck
- { name: 'JitCodeAdded', args: {data: {code_len: 20, name: 'bar', code_start: '0x2a574306220'}}, pid: 1, ts: 0, cat: 'test', tid: 2, ph: 'I' }, // @suppress longLineCheck
- { name: 'JitCodeMoved', args: {data: {code_len: 2, old_code_start: '0x2a574306220', code_start: '0x2a574306222'}}, pid: 1, ts: 0, cat: 'test', tid: 2, ph: 'I' }, // @suppress longLineCheck
- { name: 'JitCodeAdded', args: {data: {code_len: 20, name: 'baz', code_start: '0xffffffff9f90a1a0'}}, pid: 1, ts: 0, cat: 'test', tid: 2, ph: 'I' }, // @suppress longLineCheck
- { name: 'V8Sample', args: {data: {stack: ['0x2a574306061', '0x2a574306224']}}, pid: 1, ts: 0, cat: 'test', tid: 2, ph: 'P' }, // @suppress longLineCheck
- { name: 'V8Sample', args: {data: {stack: [], vm_state: 'gc'}}, pid: 1, ts: 10, cat: 'test', tid: 2, ph: 'P' } // @suppress longLineCheck
- ]
- };
-
- var m = makeModel(eventData);
- var p = m.processes[1];
- var t = p.threads[2];
-
- assert.isFalse(m.hasImportWarnings);
- assert.equal(t.samples.length, 2);
-
- var sample = t.samples_[0];
- assert.equal(sample.leafStackFrame.title,
- 'foo http://example.com/bar.js:22');
- assert.equal(sample.leafStackFrame.parentFrame.title, 'bar');
-
- var sample = t.samples_[1];
- assert.equal(sample.leafStackFrame.title, 'gc');
- });
-
- test('importSimpleObject', function() {
- var events = [
- {ts: 10000, pid: 1, tid: 1, ph: 'N', cat: 'c', id: '0x1000', name: 'a', args: {}}, // @suppress longLineCheck
- {ts: 15000, pid: 1, tid: 1, ph: 'O', cat: 'c', id: '0x1000', name: 'a', args: {snapshot: 15}}, // @suppress longLineCheck
- {ts: 20000, pid: 1, tid: 1, ph: 'O', cat: 'c', id: '0x1000', name: 'a', args: {snapshot: 20}}, // @suppress longLineCheck
- {ts: 50000, pid: 1, tid: 1, ph: 'D', cat: 'c', id: '0x1000', name: 'a', args: {}} // @suppress longLineCheck
- ];
- var m = makeModel(events, false);
- assert.equal(m.bounds.min, 10);
- assert.equal(m.bounds.max, 50);
- assert.isFalse(m.hasImportWarnings);
-
- var p = m.processes[1];
- assert.isDefined(p);
-
- var i10 = p.objects.getObjectInstanceAt(new ScopedId('ptr', '0x1000'), 10);
- assert.equal(i10.category, 'c');
- assert.equal(i10.creationTs, 10);
- assert.equal(i10.deletionTs, 50);
- assert.equal(i10.snapshots.length, 2);
-
- var s15 = i10.snapshots[0];
- assert.equal(s15.ts, 15);
- assert.equal(s15.args, 15);
-
- var s20 = i10.snapshots[1];
- assert.equal(s20.ts, 20);
- assert.equal(s20.args, 20);
- });
-
- test('importImplicitObjects', function() {
- var events = [
- {ts: 10000, pid: 1, tid: 1, ph: 'N', cat: 'c', id: '0x1000', name: 'a', args: {}}, // @suppress longLineCheck
- {ts: 15000, pid: 1, tid: 1, ph: 'O', cat: 'c', id: '0x1000', name: 'a',
- args: { snapshot: [
- { id: 'subObject/0x1',
- foo: 1
- }
- ]}},
- {ts: 20000, pid: 1, tid: 1, ph: 'O', cat: 'c', id: '0x1000', name: 'a',
- args: { snapshot: [
- { id: 'subObject/0x1',
- foo: 2
- },
- { id: 'subObject/0x2',
- foo: 1
- }
- ]}}
- ];
-
- var m = makeModel(events, false);
- var p1 = m.processes[1];
-
- var iA = p1.objects.getObjectInstanceAt(new ScopedId('ptr', '0x1000'), 10);
- var subObjectInstances = p1.objects.getAllInstancesByTypeName()[
- 'subObject'];
-
- assert.equal(subObjectInstances.length, 2);
- var subObject1 = p1.objects.getObjectInstanceAt(
- new ScopedId('ptr', '0x1'), 15);
- assert.equal(subObject1.name, 'subObject');
- assert.equal(subObject1.creationTs, 15);
-
- assert.equal(subObject1.snapshots.length, 2);
- assert.equal(subObject1.snapshots[0].ts, 15);
- assert.equal(subObject1.snapshots[0].args.foo, 1);
- assert.equal(subObject1.snapshots[1].ts, 20);
- assert.equal(subObject1.snapshots[1].args.foo, 2);
-
- var subObject2 = p1.objects.getObjectInstanceAt(
- new ScopedId('ptr', '0x2'), 20);
- assert.equal(subObject2.name, 'subObject');
- assert.equal(subObject2.creationTs, 20);
- assert.equal(subObject2.snapshots.length, 1);
- assert.equal(subObject2.snapshots[0].ts, 20);
- });
-
- test('importImplicitObjectWithCategoryOverride', function() {
- var events = [
- {ts: 10000, pid: 1, tid: 1, ph: 'N', cat: 'cat', id: '0x1000', name: 'a', args: {}}, // @suppress longLineCheck
- {ts: 15000, pid: 1, tid: 1, ph: 'O', cat: 'otherCat', id: '0x1000', name: 'a', // @suppress longLineCheck
- args: { snapshot: [
- { id: 'subObject/0x1',
- cat: 'cat',
- foo: 1
- }
- ]}}
- ];
-
- var m = makeModel(events);
- var p1 = m.processes[1];
-
- var iA = p1.objects.getObjectInstanceAt(new ScopedId('ptr', '0x1000'), 10);
- var subObjectInstances = p1.objects.getAllInstancesByTypeName()[
- 'subObject'];
-
- assert.equal(subObjectInstances.length, 1);
- });
-
- test('importImplicitObjectWithBaseTypeOverride', function() {
- var events = [
- {ts: 10000, pid: 1, tid: 1, ph: 'O', cat: 'c', id: '0x1000', name: 'PictureLayerImpl', args: { // @suppress longLineCheck
- snapshot: {
- base_type: 'LayerImpl'
- }
- }},
- {ts: 50000, pid: 1, tid: 1, ph: 'D', cat: 'c', id: '0x1000', name: 'LayerImpl', args: {}} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- var p1 = m.processes[1];
- assert.equal(m.importWarnings.length, 0);
-
- var iA = p1.objects.getObjectInstanceAt(new ScopedId('ptr', '0x1000'), 10);
- assert.equal(iA.snapshots.length, 1);
- });
-
- test('importIDRefs', function() {
- var events = [
- // An object with two snapshots.
- {ts: 10000, pid: 1, tid: 1, ph: 'N', cat: 'c', id: '0x1000', name: 'a', args: {}}, // @suppress longLineCheck
- {ts: 15000, pid: 1, tid: 1, ph: 'O', cat: 'c', id: '0x1000', name: 'a', args: {snapshot: 15}}, // @suppress longLineCheck
- {ts: 20000, pid: 1, tid: 1, ph: 'O', cat: 'c', id: '0x1000', name: 'a', args: {snapshot: 20}}, // @suppress longLineCheck
- {ts: 50000, pid: 1, tid: 1, ph: 'D', cat: 'c', id: '0x1000', name: 'a', args: {}}, // @suppress longLineCheck
-
- // A slice that references the object.
- {ts: 17000, pid: 1, tid: 1, ph: 'B', cat: 'c', name: 'taskSlice', args: {my_object: {id_ref: '0x1000'}}}, // @suppress longLineCheck
- {ts: 17500, pid: 1, tid: 1, ph: 'E', cat: 'c', name: 'taskSlice', args: {}} // @suppress longLineCheck
- ];
-
- var m = makeModel(events, false);
- var p1 = m.processes[1];
-
- var iA = p1.objects.getObjectInstanceAt(new ScopedId('ptr', '0x1000'), 10);
- var s15 = iA.getSnapshotAt(15);
-
- var taskSlice = p1.threads[1].sliceGroup.slices[0];
- assert.equal(taskSlice.args.my_object, s15);
- });
-
- test('importIDRefsThatPointAtEachOther', function() {
- var events = [
- // An object.
- {ts: 10000, pid: 1, tid: 1, ph: 'N', cat: 'c', id: '0x1000', name: 'a', args: {}}, // @suppress longLineCheck
- {ts: 15000, pid: 1, tid: 1, ph: 'O', cat: 'c', id: '0x1000', name: 'a', args: { // @suppress longLineCheck
- snapshot: { x: {
- id: 'foo/0x1001',
- value: 'bar'
- }}}},
- {ts: 50000, pid: 1, tid: 1, ph: 'D', cat: 'c', id: '0x1000', name: 'a', args: {}}, // @suppress longLineCheck
-
- // A slice that references the object.
- {ts: 17000, pid: 1, tid: 1, ph: 'B', cat: 'c', name: 'taskSlice', args: {my_object: {id_ref: '0x1001'}}}, // @suppress longLineCheck
- {ts: 17500, pid: 1, tid: 1, ph: 'E', cat: 'c', name: 'taskSlice', args: {}} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- var p1 = m.processes[1];
-
- var iA = p1.objects.getObjectInstanceAt(new ScopedId('ptr', '0x1000'), 15);
- var iFoo = p1.objects.getObjectInstanceAt(
- new ScopedId('ptr', '0x1001'), 15);
- assert.isDefined(iA);
- assert.isDefined(iFoo);
-
- var a15 = iA.getSnapshotAt(15);
- var foo15 = iFoo.getSnapshotAt(15);
-
- var taskSlice = p1.threads[1].sliceGroup.slices[0];
- assert.equal(taskSlice.args.my_object, foo15);
- });
-
- test('importArrayWithIDs', function() {
- var events = [
- {ts: 15000, pid: 1, tid: 1, ph: 'O', cat: 'c', id: '0x1000', name: 'a', args: { // @suppress longLineCheck
- snapshot: { x: [
- {id: 'foo/0x1001', value: 'bar1'},
- {id: 'foo/0x1002', value: 'bar2'},
- {id: 'foo/0x1003', value: 'bar3'}
- ]}}}
- ];
-
- var m = makeModel(events, false);
- var p1 = m.processes[1];
-
- var sA = p1.objects.getSnapshotAt(new ScopedId('ptr', '0x1000'), 15);
- assert.isTrue(sA.args.x instanceof Array);
- assert.equal(sA.args.x.length, 3);
- assert.isTrue(sA.args.x[0] instanceof tr.model.ObjectSnapshot);
- assert.isTrue(sA.args.x[1] instanceof tr.model.ObjectSnapshot);
- assert.isTrue(sA.args.x[2] instanceof tr.model.ObjectSnapshot);
- });
-
- test('importDoesNotMutateEventList', function() {
- var events = [
- // An object.
- {ts: 10000, pid: 1, tid: 1, ph: 'N', cat: 'c', id: '0x1000', name: 'a', args: {}}, // @suppress longLineCheck
- {ts: 15000, pid: 1, tid: 1, ph: 'O', cat: 'c', id: '0x1000', name: 'a', args: { // @suppress longLineCheck
- snapshot: {foo: 15}}},
- {ts: 50000, pid: 1, tid: 1, ph: 'D', cat: 'c', id: '0x1000', name: 'a', args: {}}, // @suppress longLineCheck
-
- // A slice that references the object.
- {ts: 17000, pid: 1, tid: 1, ph: 'B', cat: 'c', name: 'taskSlice', args: {
- my_object: {id_ref: '0x1000'}}
- },
- {ts: 17500, pid: 1, tid: 1, ph: 'E', cat: 'c', name: 'taskSlice', args: {}} // @suppress longLineCheck
- ];
-
- // The A type family exists to mutate the args list provided to
- // snapshots.
- function ASnapshot() {
- tr.model.ObjectSnapshot.apply(this, arguments);
- this.args.foo = 7;
- }
- ASnapshot.prototype = {
- __proto__: tr.model.ObjectSnapshot.prototype
- };
-
- // Import event while the A types are registered, causing the
- // arguments of the snapshots to be mutated.
- var m;
- try {
- tr.model.ObjectSnapshot.register(ASnapshot, {typeName: 'a'});
- m = makeModel(events);
- } finally {
- tr.model.ObjectSnapshot.unregister(ASnapshot);
- }
- assert.isFalse(m.hasImportWarnings);
-
- // Verify that the events array wasn't modified.
- assert.deepEqual(
- events[1].args,
- {snapshot: {foo: 15}});
- assert.deepEqual(
- events[3].args,
- {my_object: {id_ref: '0x1000'}});
- });
-
- test('importFlowEvent', function() {
- var events = [
- { name: 'aSlice', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 547, ph: 'B', args: {} }, // @suppress longLineCheck
- { name: 'a', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 548, ph: 's', args: {} }, // @suppress longLineCheck
- { id: 72, pid: 52, tid: 53, ts: 549, ph: 'E', args: {} }, // @suppress longLineCheck
-
- { name: 'bSlice', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 559, ph: 'B', args: {} }, // @suppress longLineCheck
- { name: 'a', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 560, ph: 't', args: {} }, // @suppress longLineCheck
- { id: 72, pid: 52, tid: 53, ts: 561, ph: 'E', args: {} }, // @suppress longLineCheck
-
- { name: 'a', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 580, ph: 'f', args: {} }, // @suppress longLineCheck
- { name: 'cSlice', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 581, ph: 'B', args: {} }, // @suppress longLineCheck
- { id: 72, pid: 52, tid: 53, ts: 582, ph: 'E', args: {} } // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
-
- assert.isDefined(t);
- assert.equal(m.flowEvents.length, 2);
- assert.equal(m.flowIntervalTree.size, 2);
-
- var f0 = m.flowEvents[0];
- assert.equal(f0.title, 'a');
- assert.equal(f0.category, 'foo');
- assert.equal(f0.id, 72);
- assert.closeTo(f0.start, 0.001, 1e-5);
- assert.closeTo(12 / 1000, f0.duration, 1e-5);
- assert.equal(f0.startSlice.title, 'aSlice');
- assert.equal(f0.endSlice.title, 'bSlice');
-
- // TODO(nduca): Replace this assertion with something better when
- // flow events don't create synthetic slices on their own.
- assert.isDefined(f0.startSlice);
- assert.isDefined(f0.endSlice);
-
- var f1 = m.flowEvents[1];
- assert.equal(f1.title, f0.title);
- assert.equal(f1.category, f0.category);
- assert.equal(f1.id, f0.id);
- assert.closeTo(20 / 1000, f1.duration, 1e-5);
-
- assert.equal(f1.startSlice.title, 'bSlice');
- assert.equal(f1.endSlice.title, 'cSlice');
-
- assert.deepEqual(f0.startSlice.outFlowEvents, [f0]);
- assert.deepEqual(f0.endSlice.inFlowEvents, [f0]);
- assert.deepEqual(f1.startSlice.outFlowEvents, [f1]);
- assert.deepEqual(f1.endSlice.inFlowEvents, [f1]);
- });
-
- test('importOldFlowEventBindtoNext', function() {
- // Old trace format without event.bp, and event.cat doesn't contain input
- var events = [
- { name: 'slice1', cat: 'foo', pid: 52, tid: 53, ts: 547, ph: 'X', 'dur': 100}, // @suppress longLineCheck
- { name: 'flow', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 548, ph: 's', args: {}}, // @suppress longLineCheck
-
- { name: 'flow', cat: 'foo', id: 72, pid: 70, tid: 71, ts: 580, ph: 'f', args: {}}, // @suppress longLineCheck
- { name: 'slice2', cat: 'foo', pid: 70, tid: 71, ts: 570, ph: 'X', args: {}, 'dur': 100}, // @suppress longLineCheck
- { name: 'slice3', cat: 'foo', pid: 70, tid: 71, ts: 770, ph: 'X', args: {}, 'dur': 1000} // @suppress longLineCheck
-
- ];
-
- var m = makeModel(events, false, false);
- assert.equal(m.flowEvents.length, 1);
-
- var f0 = m.flowEvents[0];
-
- assert.equal(f0.title, 'flow');
- assert.equal(f0.category, 'foo');
- assert.equal(f0.id, 72);
- assert.equal(f0.start, .548);
- assert.closeTo(32 / 1000, f0.duration, 1e-5);
- assert.equal(f0.startSlice.title, 'slice1');
- assert.deepEqual(f0.startSlice.outFlowEvents, [f0]);
- assert.equal(f0.endSlice.title, 'slice3');
- assert.deepEqual(f0.endSlice.inFlowEvents, [f0]);
- });
-
- test('importOldInputFlowEventBindtoParent', function() {
- // Old trace format without event.bp, but event.cat contains input
- var events = [
- { name: 'slice1', cat: 'foo', pid: 52, tid: 53, ts: 547, ph: 'X', 'dur': 100}, // @suppress longLineCheck
- { name: 'flow', cat: 'input', id: 72, pid: 52, tid: 53, ts: 548, ph: 's', args: {}}, // @suppress longLineCheck
-
- { name: 'flow', cat: 'input', id: 72, pid: 70, tid: 71, ts: 580, ph: 'f', args: {}}, // @suppress longLineCheck
- { name: 'slice2', cat: 'foo', pid: 70, tid: 71, ts: 570, ph: 'X', args: {}, 'dur': 100}, // @suppress longLineCheck
- { name: 'slice3', cat: 'foo', pid: 70, tid: 71, ts: 770, ph: 'X', args: {}, 'dur': 1000} // @suppress longLineCheck
-
- ];
-
- var m = makeModel(events, false, false);
- assert.equal(m.flowEvents.length, 1);
-
- var f0 = m.flowEvents[0];
-
- assert.equal(f0.title, 'flow');
- assert.equal(f0.category, 'input');
- assert.equal(f0.id, 72);
- assert.equal(f0.start, .548);
- assert.closeTo(32 / 1000, f0.duration, 1e-5);
- assert.equal(f0.startSlice.title, 'slice1');
- assert.deepEqual(f0.startSlice.outFlowEvents, [f0]);
- assert.equal(f0.endSlice.title, 'slice2');
- assert.deepEqual(f0.endSlice.inFlowEvents, [f0]);
- });
-
- test('importOldIPCFlowEventBindtoParent', function() {
- // Old trace format without event.bp, but event.cat contains ipc.flow
- var events = [
- { name: 'slice1', cat: 'foo', pid: 52, tid: 53, ts: 547, ph: 'X', 'dur': 100}, // @suppress longLineCheck
- { name: 'flow', cat: 'disabled-by-default-ipc.flow', id: 72, pid: 52, tid: 53, ts: 548, ph: 's', args: {}}, // @suppress longLineCheck
-
- { name: 'flow', cat: 'disabled-by-default-ipc.flow', id: 72, pid: 70, tid: 71, ts: 580, ph: 'f', args: {}}, // @suppress longLineCheck
- { name: 'slice2', cat: 'foo', pid: 70, tid: 71, ts: 570, ph: 'X', args: {}, 'dur': 100}, // @suppress longLineCheck
- { name: 'slice3', cat: 'foo', pid: 70, tid: 71, ts: 770, ph: 'X', args: {}, 'dur': 1000} // @suppress longLineCheck
-
- ];
-
- var m = makeModel(events, false, false);
- assert.equal(m.flowEvents.length, 1);
-
- var f0 = m.flowEvents[0];
-
- assert.equal(f0.title, 'flow');
- assert.equal(f0.category, 'disabled-by-default-ipc.flow');
- assert.equal(f0.id, 72);
- assert.equal(f0.start, .548);
- assert.closeTo(32 / 1000, f0.duration, 1e-5);
- assert.equal(f0.startSlice.title, 'slice1');
- assert.deepEqual(f0.startSlice.outFlowEvents, [f0]);
- assert.equal(f0.endSlice.title, 'slice2');
- assert.deepEqual(f0.endSlice.inFlowEvents, [f0]);
- });
-
- test('importNewFlowEventBindtoParent', function() {
- // New trace format with event.bp
- var events = [
- { name: 'slice1', cat: 'foo', pid: 52, tid: 53, ts: 547, ph: 'X', 'dur': 100}, // @suppress longLineCheck
- { name: 'flow', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 548, ph: 's', bp: 'e', args: {}}, // @suppress longLineCheck
-
- { name: 'flow', cat: 'foo', id: 72, pid: 70, tid: 71, ts: 580, ph: 'f', bp: 'e', args: {}}, // @suppress longLineCheck
- { name: 'slice2', cat: 'foo', pid: 70, tid: 71, ts: 570, ph: 'X', args: {}, 'dur': 100}, // @suppress longLineCheck
- { name: 'slice3', cat: 'foo', pid: 70, tid: 71, ts: 770, ph: 'X', args: {}, 'dur': 1000} // @suppress longLineCheck
-
- ];
-
- var m = makeModel(events, false, false);
- assert.equal(m.flowEvents.length, 1);
-
- var f0 = m.flowEvents[0];
-
- assert.equal(f0.title, 'flow');
- assert.equal(f0.category, 'foo');
- assert.equal(f0.id, 72);
- assert.equal(f0.start, .548);
- assert.closeTo(32 / 1000, f0.duration, 1e-5);
- assert.equal(f0.startSlice.title, 'slice1');
- assert.deepEqual(f0.startSlice.outFlowEvents, [f0]);
- assert.equal(f0.endSlice.title, 'slice2');
- assert.deepEqual(f0.endSlice.inFlowEvents, [f0]);
- });
-
- test('importNewFlowEventWithInvalidBindingPoint', function() {
- // New trace format with event.bp, which however !== 'e'
- var events = [
- { name: 'slice1', cat: 'foo', pid: 52, tid: 53, ts: 547, ph: 'X', 'dur': 100}, // @suppress longLineCheck
- { name: 'flow', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 548, ph: 's', bp: 'z', args: {}}, // @suppress longLineCheck
-
- { name: 'flow', cat: 'foo', id: 72, pid: 70, tid: 71, ts: 580, ph: 'f', bp: 'z', args: {}}, // @suppress longLineCheck
- { name: 'slice2', cat: 'foo', pid: 70, tid: 71, ts: 570, ph: 'X', args: {}, 'dur': 100}, // @suppress longLineCheck
- { name: 'slice3', cat: 'foo', pid: 70, tid: 71, ts: 770, ph: 'X', args: {}, 'dur': 1000} // @suppress longLineCheck
-
- ];
-
- var m = makeModel(events);
-
- assert.equal(m.flowEvents.length, 0);
- });
-
- test('importFlowV2OnePair', function() {
- // Flow V2: one flow producer one flow consumer
- var events = [
- { name: 'producer', cat: 'foo', pid: 52, tid: 53, ts: 547, ph: 'X', 'dur': 100, bind_id: '0xaaa', flow_out: true}, // @suppress longLineCheck
- { name: 'consumer', cat: 'foo', pid: 70, tid: 71, ts: 770, ph: 'X', 'dur': 1000, bind_id: '0xaaa', flow_in: true} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
-
- assert.equal(m.flowEvents.length, 1);
-
- var f0 = m.flowEvents[0];
-
- assert.equal(f0.startSlice.title, 'producer');
- assert.deepEqual(f0.startSlice.outFlowEvents, [f0]);
- assert.equal(f0.endSlice.title, 'consumer');
- assert.deepEqual(f0.endSlice.inFlowEvents, [f0]);
- });
-
- test('importFlowV2OneFlowStep', function() {
- // Flow V2: one flow producer one flow consumer
- var events = [
- { name: 'producer', cat: 'foo', pid: 52, tid: 53, ts: 547, ph: 'X', 'dur': 100, bind_id: '0xaaa', flow_out: true}, // @suppress longLineCheck
- { name: 'step', cat: 'foo', pid: 62, tid: 63, ts: 647, ph: 'X', 'dur': 100, bind_id: '0xaaa', flow_out: true, flow_in: true}, // @suppress longLineCheck
- { name: 'consumer', cat: 'foo', pid: 70, tid: 71, ts: 770, ph: 'X', 'dur': 1000, bind_id: '0xaaa', args: { 'queue_duration': 0}, flow_in: true} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
-
- assert.equal(m.flowEvents.length, 2);
-
- var f0 = m.flowEvents[0];
- var f1 = m.flowEvents[1];
-
- assert.equal(f0.startSlice.title, 'producer');
- assert.deepEqual(f0.startSlice.outFlowEvents, [f0]);
- assert.equal(f0.endSlice.title, 'step');
- assert.deepEqual(f0.endSlice.inFlowEvents, [f0]);
-
- assert.equal(f1.startSlice.title, 'step');
- assert.deepEqual(f1.startSlice.outFlowEvents, [f1]);
- assert.equal(f1.endSlice.title, 'consumer');
- assert.deepEqual(f1.endSlice.inFlowEvents, [f1]);
- });
-
- test('importFlowV2MultipleConsumers', function() {
- // Flow V2: one flow producer multiple flow consumers
- var events = [
- { name: 'producer', cat: 'foo', pid: 52, tid: 53, ts: 547, ph: 'X', 'dur': 100, bind_id: '0xaaa', flow_out: true}, // @suppress longLineCheck
- { name: 'consumer1', cat: 'foo', pid: 70, tid: 71, ts: 770, ph: 'X', 'dur': 1000, bind_id: '0xaaa', flow_in: true}, // @suppress longLineCheck
- { name: 'consumer2', cat: 'foo', pid: 70, tid: 72, ts: 870, ph: 'X', 'dur': 1000, bind_id: '0xaaa', flow_in: true} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
-
- assert.equal(m.flowEvents.length, 2);
-
- var f0 = m.flowEvents[0];
- var f1 = m.flowEvents[1];
-
- assert.equal(f0.startSlice.title, 'producer');
- assert.equal(f1.startSlice.title, 'producer');
-
- assert.equal(f0.startSlice.outFlowEvents.length, 2);
- assert.deepEqual(f0.startSlice.outFlowEvents, [f0, f1]);
- assert.deepEqual(f1.startSlice.outFlowEvents, [f0, f1]);
-
- assert.equal(f0.endSlice.title, 'consumer1');
- assert.equal(f1.endSlice.title, 'consumer2');
- assert.deepEqual(f0.endSlice.inFlowEvents, [f0]);
- assert.deepEqual(f1.endSlice.inFlowEvents, [f1]);
- });
-
- test('importFlowV2MultipleProducers', function() {
- // Flow V2: multiple flow producers, which is not allowed
- var events = [
- { name: 'producer1', cat: 'foo', pid: 52, tid: 53, ts: 547, ph: 'X', 'dur': 100, bind_id: '0xaaa', flow_out: true}, // @suppress longLineCheck
- { name: 'producer2', cat: 'foo', pid: 52, tid: 54, ts: 567, ph: 'X', 'dur': 100, bind_id: '0xaaa', flow_out: true}, // @suppress longLineCheck
- { name: 'consumer', cat: 'foo', pid: 70, tid: 71, ts: 770, ph: 'X', 'dur': 1000, bind_id: '0xaaa', flow_in: true} // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
-
- assert.equal(m.flowEvents.length, 1);
- });
-
- // This test creates a flow event that stops on the same timestamp that
- // the 'X' event which it triggers begins.
- test('importFlowEventOverlaps', function() {
- var events = [
- { name: 'SomeTask', cat: 'foo', pid: 52, tid: 53, ts: 547, ph: 'X', 'dur': 100}, // @suppress longLineCheck
- { name: 'PostTask', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 548, ph: 's', args: {}}, // @suppress longLineCheck
-
- { name: 'PostTask', cat: 'foo', id: 72, pid: 70, tid: 71, ts: 580, ph: 'f', args: { 'queue_duration': 0}}, // @suppress longLineCheck
- // Note that RunTask has the same time-stamp as PostTask 'f'
- { name: 'RunTask', cat: 'foo', pid: 70, tid: 71, ts: 580, ph: 'X', args: {'src_func': 'PostRunTask'}, 'dur': 1000} // @suppress longLineCheck
- ];
-
- var m = makeModel(events, false);
- var startT = m.processes[52].threads[53];
- var endT = m.processes[70].threads[71];
-
- assert.isDefined(startT);
- assert.equal(startT.sliceGroup.slices.length, 1);
-
- assert.isDefined(endT);
- assert.equal(endT.sliceGroup.slices.length, 1);
-
- assert.equal(m.flowEvents.length, 1);
-
- // f0 represents 's' to 'f'
- var f0 = m.flowEvents[0];
-
- assert.equal(f0.title, 'PostTask');
- assert.equal(f0.category, 'foo');
- assert.equal(f0.id, 72);
- assert.equal(f0.start, .548);
- assert.closeTo(32 / 1000, f0.duration, 1e-5);
- assert.equal(f0.startSlice.title, 'SomeTask');
- assert.deepEqual(f0.startSlice.outFlowEvents, [f0]);
- assert.equal(f0.endSlice.title, 'RunTask');
- assert.deepEqual(f0.endSlice.inFlowEvents, [f0]);
-
- // TODO(nduca): Add assertions about the flow slices, esp that they were
- // found correctly.
- });
-
- test('importOutOfOrderFlowEvent', function() {
- var events = [
- { name: 'SomeTask', cat: 'foo', pid: 52, tid: 53, ts: 548, ph: 'X', 'dur': 10}, // @suppress longLineCheck
- { name: 'a', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 548, ph: 's', args: {} }, // @suppress longLineCheck
-
- { name: 'SomeTask', cat: 'foo', pid: 52, tid: 53, ts: 148, ph: 'X', 'dur': 10}, // @suppress longLineCheck
- { name: 'b', cat: 'foo', id: 73, pid: 52, tid: 53, ts: 148, ph: 's', args: {} }, // @suppress longLineCheck
-
- { name: 'b', cat: 'foo', id: 73, pid: 52, tid: 53, ts: 570, ph: 'f', args: {} }, // @suppress longLineCheck
- { name: 'SomeTask', cat: 'foo', pid: 52, tid: 53, ts: 571, ph: 'X', 'dur': 10}, // @suppress longLineCheck
-
- { name: 'SomeTask', cat: 'foo', pid: 52, tid: 53, ts: 560, ph: 'X', 'dur': 10}, // @suppress longLineCheck
- { name: 'a', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 560, ph: 't', args: {} }, // @suppress longLineCheck
-
- { name: 'a', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 580, ph: 'f', args: {} }, // @suppress longLineCheck
- { name: 'SomeTask', cat: 'foo', pid: 52, tid: 53, ts: 581, ph: 'X', 'dur': 10} // @suppress longLineCheck
- ];
-
- var expected = [0.4, 0.0, 0.412];
- var m = makeModel(events);
- assert.equal(m.flowIntervalTree.size, 3);
-
- var order = m.flowEvents.map(function(x) { return x.start });
- for (var i = 0; i < expected.length; ++i)
- assert.closeTo(expected[i], order[i], 1e-5);
- });
-
- test('importCompleteEvent', function() {
- var events = [
- { name: 'a', args: {}, pid: 52, ts: 629, dur: 1, cat: 'baz', tid: 53, ph: 'X' }, // @suppress longLineCheck
- { name: 'b', args: {}, pid: 52, ts: 730, dur: 20, cat: 'foo', tid: 53, ph: 'X' }, // @suppress longLineCheck
- { name: 'c', args: {}, pid: 52, ts: 740, cat: 'baz', tid: 53, ph: 'X' }
- ];
-
- var m = makeModel(events);
- assert.equal(m.numProcesses, 1);
- var p = m.processes[52];
- assert.isDefined(p);
-
- assert.equal(p.numThreads, 1);
- var t = p.threads[53];
- assert.isDefined(t);
- assert.equal(t.sliceGroup.slices.length, 3);
- assert.equal(t.tid, 53);
-
- var slice = t.sliceGroup.slices[0];
- assert.equal(slice.title, 'a');
- assert.equal(slice.category, 'baz');
- assert.closeTo(0, slice.start, 1e-5);
- assert.closeTo(1 / 1000, slice.duration, 1e-5);
- assert.equal(slice.subSlices.length, 0);
-
- slice = t.sliceGroup.slices[1];
- assert.equal(slice.title, 'b');
- assert.equal(slice.category, 'foo');
- assert.closeTo((730 - 629) / 1000, slice.start, 1e-5);
- assert.closeTo(20 / 1000, slice.duration, 1e-5);
- assert.equal(slice.subSlices.length, 1);
-
- slice = t.sliceGroup.slices[2];
- assert.equal(slice.title, 'c');
- assert.isTrue(slice.didNotFinish);
- assert.closeTo(10 / 1000, slice.duration, 1e-5);
- });
-
- test('importFlowEventsWithStackFrame', function() {
- var eventData = {
- traceEvents: [
- { name: 'aSlice', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 547, ph: 'B', args: {} }, // @suppress longLineCheck
- { name: 'a', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 548, ph: 's', args: {}, sf: 1 }, // @suppress longLineCheck
- { id: 72, pid: 52, tid: 53, ts: 549, ph: 'E', args: {} }, // @suppress longLineCheck
-
- { name: 'bSlice', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 559, ph: 'B', args: {} }, // @suppress longLineCheck
- { name: 'a', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 560, ph: 't', args: {}, sf: 2 }, // @suppress longLineCheck
- { id: 72, pid: 52, tid: 53, ts: 561, ph: 'E', args: {} }, // @suppress longLineCheck
-
- { name: 'a', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 580, ph: 'f', args: {}, sf: 3 }, // @suppress longLineCheck
- { name: 'cSlice', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 581, ph: 'B', args: {} }, // @suppress longLineCheck
- { id: 72, pid: 52, tid: 53, ts: 582, ph: 'E', args: {} } // @suppress longLineCheck
- ],
- stackFrames: {
- '1': {
- category: 'm1',
- name: 'fn1'
- },
- '2': {
- category: 'm2',
- name: 'fn2'
- },
- '3': {
- category: 'm3',
- name: 'fn3'
- }
- }
- };
-
- var m = makeModel(eventData);
-
- assert.equal(m.flowEvents.length, 2);
-
- var f0 = m.flowEvents[0];
- assert.equal(f0.startStackFrame.title, 'fn1');
- assert.equal(f0.endStackFrame.title, 'fn2');
-
- var f1 = m.flowEvents[1];
- assert.equal(f1.startStackFrame.title, 'fn2');
- assert.equal(f1.endStackFrame.title, 'fn3');
- });
-
- test('importCompleteEventWithCpuDuration', function() {
- var events = [
- { name: 'a', args: {}, pid: 52, ts: 629, dur: 1, cat: 'baz', tid: 53, ph: 'X', tts: 12, tdur: 1 }, // @suppress longLineCheck
- { name: 'b', args: {}, pid: 52, ts: 730, dur: 20, cat: 'foo', tid: 53, ph: 'X', tts: 110, tdur: 16 }, // @suppress longLineCheck
- { name: 'c', args: {}, pid: 52, ts: 740, cat: 'baz', tid: 53, ph: 'X', tts: 115 } // @suppress longLineCheck
- ];
-
- var m = makeModel(events);
- assert.equal(m.numProcesses, 1);
- var p = m.processes[52];
- assert.isDefined(p);
-
- assert.equal(p.numThreads, 1);
- var t = p.threads[53];
- assert.isDefined(t);
- assert.equal(t.sliceGroup.slices.length, 3);
- assert.equal(t.tid, 53);
-
- var slice = t.sliceGroup.slices[0];
- assert.equal(slice.title, 'a');
- assert.equal(slice.category, 'baz');
- assert.closeTo(0, slice.start, 1e-5);
- assert.closeTo(1 / 1000, slice.duration, 1e-5);
- assert.closeTo(12 / 1000, slice.cpuStart, 1e-5);
- assert.closeTo(1 / 1000, slice.cpuDuration, 1e-5);
- assert.equal(slice.subSlices.length, 0);
-
- slice = t.sliceGroup.slices[1];
- assert.equal(slice.title, 'b');
- assert.equal(slice.category, 'foo');
- assert.closeTo((730 - 629) / 1000, slice.start, 1e-5);
- assert.closeTo(20 / 1000, slice.duration, 1e-5);
- assert.closeTo(110 / 1000, slice.cpuStart, 1e-5);
- assert.closeTo(16 / 1000, slice.cpuDuration, 1e-5);
- assert.equal(slice.subSlices.length, 1);
-
- slice = t.sliceGroup.slices[2];
- assert.equal(slice.title, 'c');
- assert.isTrue(slice.didNotFinish);
- assert.closeTo(10 / 1000, slice.duration, 1e-5);
- });
-
- test('importNestedCompleteEventWithTightBounds', function() {
- var events = [
- { name: 'a', args: {}, pid: 52, ts: 244654227065, dur: 36075, cat: 'baz', tid: 53, ph: 'X' }, // @suppress longLineCheck
- { name: 'b', args: {}, pid: 52, ts: 244654227095, dur: 36045, cat: 'foo', tid: 53, ph: 'X' } // @suppress longLineCheck
- ];
-
- var m = makeModel(events, false);
- var t = m.processes[52].threads[53];
-
- var sA = findSliceNamed(t.sliceGroup, 'a');
- var sB = findSliceNamed(t.sliceGroup, 'b');
-
- assert.equal(sA.title, 'a');
- assert.equal(sA.category, 'baz');
- assert.equal(sA.start, 244654227.065);
- assert.equal(sA.duration, 36.075);
- assert.closeTo(0.03, sA.selfTime, 1e-5);
-
- assert.equal(sB.title, 'b');
- assert.equal(sB.category, 'foo');
- assert.equal(sB.start, 244654227.095);
- assert.equal(sB.duration, 36.045);
-
- assert.equal(sA.subSlices.length, 1);
- assert.equal(sA.subSlices[0], sB);
- assert.equal(sB.parentSlice, sA);
- });
-
-
- test('importCompleteEventWithStackFrame', function() {
- var eventData = {
- traceEvents: [
- { name: 'a', args: {}, pid: 1, ts: 0, dur: 1, cat: 'baz', tid: 2, ph: 'X', sf: 7 }, // @suppress longLineCheck
- { name: 'b', args: {}, pid: 1, ts: 5, dur: 1, cat: 'baz', tid: 2, ph: 'X', sf: 8, esf: 9 } // @suppress longLineCheck
- ],
- stackFrames: {
- '1': {
- category: 'm1',
- name: 'main'
- },
- '7': {
- category: 'm2',
- name: 'frame7',
- parent: '1'
- },
- '8': {
- category: 'm2',
- name: 'frame8',
- parent: '1'
- },
- '9': {
- category: 'm2',
- name: 'frame9',
- parent: '1'
- }
- }
- };
-
- var m = makeModel(eventData);
-
- var p = m.processes[1];
- var t = p.threads[2];
- assert.isDefined(t);
- assert.equal(t.sliceGroup.slices.length, 2);
-
- var s0 = t.sliceGroup.slices[0];
- assert.equal(s0.startStackFrame.title, 'frame7');
- assert.isUndefined(s0.endStackFrame);
-
- var s1 = t.sliceGroup.slices[1];
- assert.equal(s1.startStackFrame.title, 'frame8');
- assert.equal(s1.endStackFrame.title, 'frame9');
- });
-
- test('importAsyncEventWithSameTimestamp', function() {
- var events = [];
- // Events are added with ts 0, 1, 1, 2, 2, 3, 3 ...500, 500, 1000
- // and use 'seq' to track the order of when the event is recorded.
- events.push({name: 'a', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 0, ph: 'S', args: {'seq': 0}}); // @suppress longLineCheck
-
- for (var i = 1; i <= 1000; i++)
- events.push({name: 'a', cat: 'foo', id: 72, pid: 52, tid: 53, ts: Math.round(i / 2) , ph: 'T', args: {'seq': i}}); // @suppress longLineCheck
-
- events.push({name: 'a', cat: 'foo', id: 72, pid: 52, tid: 53, ts: 1000, ph: 'F', args: {'seq': 1001}}); // @suppress longLineCheck
-
- var m = makeModel(events);
- var t = m.processes[52].threads[53];
-
- assert.equal(t.asyncSliceGroup.slices.length, 1);
- var parentSlice = t.asyncSliceGroup.slices[0];
- assert.equal(parentSlice.title, 'a');
- assert.equal(parentSlice.category, 'foo');
- assert.isTrue(parentSlice.isTopLevel);
-
- assert.isDefined(parentSlice.subSlices);
- var subSlices = parentSlice.subSlices;
- assert.equal(subSlices.length, 1000);
- // Slices should be sorted according to 'ts'. And if 'ts' is the same,
- // slices should keep the order that they were recorded.
- for (var i = 0; i < 1000; i++) {
- assert.equal(i + 1, subSlices[i].args['seq']);
- assert.isFalse(subSlices[i].isTopLevel);
- }
- });
-
- test('sampleDataSimple', function() {
- var events = {
- 'traceEvents': [],
- 'stackFrames': {
- '1': {
- 'category': 'mod',
- 'name': 'main'
- },
- '2': {
- 'category': 'mod',
- 'name': 'a',
- 'parent': 1
- },
- '3': {
- 'category': 'mod',
- 'name': 'a_sub',
- 'parent': 2
- },
- '4': {
- 'category': 'mod',
- 'name': 'b',
- 'parent': 1
- }
- },
- 'samples': [
- {
- 'cpu': 0, 'tid': 1, 'ts': 1000.0,
- 'name': 'cycles:HG', 'sf': 3, 'weight': 1
- },
- {
- 'cpu': 0, 'tid': 1, 'ts': 2000.0,
- 'name': 'cycles:HG', 'sf': 2, 'weight': 1
- },
- {
- 'cpu': 1, 'tid': 1, 'ts': 3000.0,
- 'name': 'cycles:HG', 'sf': 3, 'weight': 1
- }
- ]
- };
- var m = makeModel(events, false);
- assert.isDefined(m.kernel.cpus[0]);
- assert.equal(m.getAllThreads().length, 1);
-
- assert.equal(tr.b.dictionaryKeys(m.stackFrames).length, 4);
- assert.equal(m.samples.length, 3);
-
- var t1 = m.processes[1].threads[1];
- assert.equal(t1.samples.length, 3);
-
- var c0 = m.kernel.cpus[0];
- var c1 = m.kernel.cpus[1];
- assert.equal(c0.samples.length, 2);
- assert.equal(c1.samples.length, 1);
-
- assert.equal(m.samples[0].cpu, c0);
- assert.equal(m.samples[0].thread, t1);
- assert.equal(m.samples[0].title, 'cycles:HG');
- assert.equal(m.samples[0].start, 1);
- assert.deepEqual(
- ['a_sub', 'a', 'main'],
- m.samples[0].stackTrace.map(function(x) { return x.title; }));
- assert.equal(m.samples[0].weight, 1);
- });
-
- test('importMemoryDumps_verifyProcessAndGlobalMemoryDumpLinks', function() {
- var events = [
- // 2 process memory dump events.
- {
- name: 'a',
- pid: 42,
- ts: 10000,
- cat: 'test',
- tid: 53,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- process_totals: {
- resident_set_bytes: '100'
- }
- }
- }
- },
- {
- name: 'b',
- pid: 43,
- ts: 11000,
- cat: 'test',
- tid: 54,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- process_totals: {
- resident_set_bytes: '200'
- }
- }
- }
- },
- // 1 process memory dump event.
- {
- name: 'd',
- pid: 42,
- ts: 13000,
- cat: 'test',
- tid: 56,
- ph: 'v',
- id: '0xfffffff12345678',
- args: {
- dumps: {
- process_totals: {
- resident_set_bytes: '300'
- }
- }
- }
- }
- ];
- var m = makeModel(events, false);
- var p1 = m.getProcess(42);
- var p2 = m.getProcess(43);
- assert.isDefined(p1);
- assert.isDefined(p2);
-
- // Check that Model and Process objects contain the right dumps.
- assert.equal(m.globalMemoryDumps.length, 2);
- assert.equal(p1.memoryDumps.length, 2);
- assert.equal(p2.memoryDumps.length, 1);
-
- assert.equal(m.globalMemoryDumps[0].start, 10);
- assert.equal(p1.memoryDumps[0].start, 10);
- assert.equal(p2.memoryDumps[0].start, 11);
- assert.equal(m.globalMemoryDumps[0].duration, 1);
- assert.equal(p1.memoryDumps[0].duration, 0);
- assert.equal(p2.memoryDumps[0].duration, 0);
-
- assert.equal(m.globalMemoryDumps[1].start, 13);
- assert.equal(p1.memoryDumps[1].start, 13);
- assert.equal(m.globalMemoryDumps[1].duration, 0);
- assert.equal(p1.memoryDumps[1].duration, 0);
-
- // Check that GlobalMemoryDump and ProcessMemoryDump objects are
- // interconnected correctly.
- assert.equal(p1.memoryDumps[0],
- m.globalMemoryDumps[0].processMemoryDumps[42]);
- assert.equal(p2.memoryDumps[0],
- m.globalMemoryDumps[0].processMemoryDumps[43]);
- assert.equal(p1.memoryDumps[0].globalMemoryDump, m.globalMemoryDumps[0]);
- assert.equal(p2.memoryDumps[0].globalMemoryDump, m.globalMemoryDumps[0]);
-
- assert.equal(p1.memoryDumps[1],
- m.globalMemoryDumps[1].processMemoryDumps[42]);
- assert.equal(p1.memoryDumps[1].globalMemoryDump, m.globalMemoryDumps[1]);
- });
-
- test('importMemoryDumps_totalResidentBytesOnly', function() {
- var events = [
- {
- pid: 42,
- ts: 10,
- ph: 'v',
- id: '0x01',
- args: {
- dumps: {
- process_totals: {
- resident_set_bytes: '1fffffffffffff'
- }
- }
- }
- }
- ];
- var m = makeModel(events);
- var p = m.getProcess(42);
- var d = p.memoryDumps[0];
-
- assert.equal(d.totals.residentBytes, 9007199254740991);
- assert.isUndefined(d.totals.peakResidentBytes);
- assert.isUndefined(d.totals.arePeakResidentBytesResettable);
- assert.isUndefined(d.totals.platformSpecific);
- assert.isUndefined(d.mostRecentVmRegions);
- assert.lengthOf(d.memoryAllocatorDumps, 0);
- });
-
- test('importMemoryDumps_withPeakResidentBytes', function() {
- var events = [
- {
- pid: 42,
- ts: 10,
- ph: 'v',
- id: '0x01',
- args: {
- dumps: {
- process_totals: {
- resident_set_bytes: '1fffffffffffff',
- peak_resident_set_bytes: '2fffffffffffff',
- is_peak_rss_resetable: true
- }
- }
- }
- }
- ];
- var m = makeModel(events);
- var p = m.getProcess(42);
- var d = p.memoryDumps[0];
-
- assert.equal(d.totals.residentBytes, 9007199254740991);
- assert.equal(d.totals.peakResidentBytes, 13510798882111488);
- assert.isTrue(d.totals.arePeakResidentBytesResettable);
- assert.isUndefined(d.totals.platformSpecific);
- assert.isUndefined(d.mostRecentVmRegions);
- assert.lengthOf(d.memoryAllocatorDumps, 0);
- });
-
- test('importMemoryDumps_platformSpecificTotals', function() {
- var events = [
- {
- pid: 42,
- ts: 10,
- ph: 'v',
- id: '0x01',
- args: {
- dumps: {
- process_totals: {
- resident_set_bytes: '1fffffffffffff',
- private_bytes: 'fffffffffffff',
- shared_bytes: '10000000000000'
- }
- }
- }
- }
- ];
- var m = makeModel(events);
- var p = m.getProcess(42);
- var d = p.memoryDumps[0];
-
- assert.equal(d.totals.residentBytes, 9007199254740991);
- assert.isUndefined(d.totals.peakResidentBytes);
- assert.isUndefined(d.totals.arePeakResidentBytesResettable);
- assert.deepEqual(d.totals.platformSpecific,
- {private_bytes: 4503599627370495, shared_bytes: 4503599627370496});
- assert.isUndefined(d.mostRecentVmRegions);
- assert.lengthOf(d.memoryAllocatorDumps, 0);
- });
-
- test('importMemoryDumps_vmRegions', function() {
- var events = [
- {
- name: 'some_dump_name',
- pid: 42,
- ts: 10,
- cat: 'test',
- tid: 53,
- ph: 'v',
- id: '000',
- args: {
- dumps: {
- process_totals: {
- resident_set_bytes: '0'
- },
- process_mmaps: {
- vm_regions: [
- {
- sa: 'f0',
- sz: '150',
- pf: 6,
- mf: '[stack:20310]',
- bs: {
- pss: '9e',
- pc: '40',
- pd: '20',
- sc: '100',
- sd: '0',
- sw: '50'
- }
- },
- {
- sa: '350',
- sz: '250',
- pf: 5,
- mf: '/dev/ashmem/dalvik',
- bs: {
- pss: 'cd',
- pd: 'cd',
- sc: undefined,
- sw: '0'
- }
- },
- {
- sa: '7ff10ff4b000',
- sz: '40000',
- pf: 134,
- mf: '/run/shm/.org.chromium.Chromium.sqqN11 (deleted)',
- bs: {
- pss: '40000',
- pc: '0',
- pd: '40000',
- sc: '0',
- sd: '0',
- sw: '0'
- }
- }
- ]
- }
- }
- }
- }
- ];
- var m = makeModel(events);
- var p = m.getProcess(42);
- var d = p.memoryDumps[0];
-
- checkVMRegions(d.vmRegions, [
- {
- startAddress: 240,
- sizeInBytes: 336,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_WRITE,
- mappedFile: '[stack:20310]',
- byteStats: {
- privateCleanResident: 64,
- privateDirtyResident: 32,
- sharedCleanResident: 256,
- sharedDirtyResident: 0,
- proportionalResident: 158,
- swapped: 80
- }
- },
- {
- startAddress: 848,
- sizeInBytes: 592,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_EXECUTE,
- mappedFile: '/dev/ashmem/dalvik',
- byteStats: {
- proportionalResident: 205,
- privateDirtyResident: 205,
- swapped: 0
- }
- },
- {
- startAddress: 140673331539968,
- sizeInBytes: 262144,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_WRITE | VMRegion.PROTECTION_FLAG_MAYSHARE,
- mappedFile: '/run/shm/.org.chromium.Chromium.sqqN11 (deleted)',
- byteStats: {
- privateCleanResident: 0,
- privateDirtyResident: 262144,
- sharedCleanResident: 0,
- sharedDirtyResident: 0,
- proportionalResident: 262144,
- swapped: 0
- }
- }
- ]);
-
- assert.equal(d.totals.residentBytes, 0);
- assert.isUndefined(d.totals.peakResidentBytes);
- assert.isUndefined(d.totals.arePeakResidentBytesResettable);
- assert.isUndefined(d.totals.platformSpecific);
- assert.lengthOf(d.memoryAllocatorDumps, 0);
- });
-
- test('importMemoryDumps_explicitMemoryAllocatorDumps', function() {
- var events = [
- {
- name: 'a',
- pid: 42,
- ts: 10,
- cat: 'test',
- tid: 53,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- process_totals: {
- resident_set_bytes: '100'
- },
- allocators: {
- 'oilpan': {
- guid: '1a',
- attrs: {
- objects_count: {
- type: 'scalar', units: 'objects', value: '2f'
- },
- inner_size: {type: 'scalar', units: 'bytes', value: '1000'},
- size: {type: 'scalar', units: 'bytes', value: '8000'}
- }
- },
- 'oilpan/heap1': {
- guid: '2b',
- attrs: {
- objects_count: {
- type: 'scalar', units: 'objects', value: '3f'
- },
- inner_size: {type: 'scalar', units: 'bytes', value: '3000'},
- size: {type: 'scalar', units: 'bytes', value: '4000'}
- }
- },
- 'oilpan/heap2': {
- guid: '3c',
- attrs: {
- objects_count: {
- type: 'scalar', units: 'objects', value: '4f'
- },
- inner_size: {type: 'scalar', units: 'bytes', value: '4000'},
- size: {type: 'scalar', units: 'bytes', value: '4000'}
- }
- },
- 'oilpan/heap2/bucket1': {
- // Deliberately missing GUID (to check that the importer does
- // not skip memory allocator dump without GUID).
- attrs: {
- objects_count: {
- type: 'scalar', units: 'objects', value: '1f'
- },
- inner_size: {type: 'scalar', units: 'bytes', value: '2000'},
- size: {type: 'scalar', units: 'bytes', value: '2000'}
- }
- },
- 'v8': {
- guid: '5e',
- attrs: {
- objects_count: {
- type: 'scalar', units: 'objects', value: '5f'
- },
- inner_size: {type: 'scalar', units: 'bytes', value: '5000'},
- size: {type: 'scalar', units: 'bytes', value: '6000'}
- }
- }
- }
- }
- }
- }
- ];
- var m = makeModel(events);
- var p = m.getProcess(42);
- var d = p.memoryDumps[0];
-
- assert.equal(d.memoryAllocatorDumps.length, 2);
-
- var oilpanRoot = d.getMemoryAllocatorDumpByFullName('oilpan');
- var v8Root = d.getMemoryAllocatorDumpByFullName('v8');
- assert.isDefined(oilpanRoot);
- assert.isDefined(v8Root);
- assert.include(d.memoryAllocatorDumps, oilpanRoot);
- assert.include(d.memoryAllocatorDumps, v8Root);
-
- checkDumpNumericsAndDiagnostics(oilpanRoot, {
- 'objects_count': new ScalarNumeric(unitlessNumber_smallerIsBetter, 47),
- 'size': 32768,
- 'effective_size': 32768,
- 'inner_size': 4096
- }, {});
- assert.equal(oilpanRoot.children.length, 2);
-
- var oilpanBucket1 = d.getMemoryAllocatorDumpByFullName(
- 'oilpan/heap2/bucket1');
- assert.isDefined(oilpanBucket1);
- assert.equal(oilpanBucket1.fullName, 'oilpan/heap2/bucket1');
- assert.equal(oilpanBucket1.name, 'bucket1');
- checkDumpNumericsAndDiagnostics(oilpanBucket1, {
- 'objects_count': new ScalarNumeric(unitlessNumber_smallerIsBetter, 31),
- 'size': 8192,
- 'effective_size': 8192,
- 'inner_size': 8192
- }, {});
- assert.equal(oilpanBucket1.children.length, 0);
-
- assert.isDefined(oilpanBucket1.parent);
- assert.equal(oilpanBucket1.parent.fullName, 'oilpan/heap2');
- assert.equal(oilpanBucket1.parent.name, 'heap2');
- assert.include(oilpanBucket1.parent.children, oilpanBucket1);
-
- assert.isDefined(oilpanBucket1.parent.parent);
- assert.strictEqual(oilpanBucket1.parent.parent, oilpanRoot);
-
- assert.equal(d.totals.residentBytes, 256);
- assert.isUndefined(d.totals.peakResidentBytes);
- assert.isUndefined(d.totals.arePeakResidentBytesResettable);
- assert.isUndefined(d.totals.platformSpecific);
- assert.isUndefined(d.mostRecentVmRegions);
- });
-
- test('importMemoryDumps_implicitMemoryAllocatorDumps', function() {
- var events = [
- {
- name: 'a',
- pid: 42,
- ts: 10,
- cat: 'test',
- tid: 53,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- process_totals: {
- resident_set_bytes: '100'
- },
- allocators: {
- 'oilpan/heap1': {
- guid: '999',
- attrs: {
- objects_count: {
- type: 'scalar', units: 'objects', value: '3f'
- },
- inner_size: {type: 'scalar', units: 'bytes', value: '3000'},
- size: {type: 'scalar', units: 'bytes', value: '4000'}
- }
- },
- 'oilpan/heap2/bucket1': {
- guid: '888',
- attrs: {
- objects_count: {
- type: 'scalar', units: 'objects', value: '1f'
- },
- inner_size: {type: 'scalar', units: 'bytes', value: '2000'},
- size: {type: 'scalar', units: 'bytes', value: '2000'}
- }
- },
- 'v8': {
- guid: '777',
- attrs: {
- objects_count: {
- type: 'scalar', units: 'objects', value: '5f'
- },
- inner_size: {type: 'scalar', units: 'bytes', value: '5000'},
- size: {type: 'scalar', units: 'bytes', value: '6000'}
- }
- }
- }
- }
- }
- }
- ];
- var m = makeModel(events);
- var p = m.getProcess(42);
- var d = p.memoryDumps[0];
-
- assert.equal(d.memoryAllocatorDumps.length, 2);
-
- var oilpanRoot = d.getMemoryAllocatorDumpByFullName('oilpan');
- var v8Root = d.getMemoryAllocatorDumpByFullName('v8');
- assert.isDefined(oilpanRoot);
- assert.isDefined(v8Root);
- assert.include(d.memoryAllocatorDumps, oilpanRoot);
- assert.include(d.memoryAllocatorDumps, v8Root);
-
- checkDumpNumericsAndDiagnostics(oilpanRoot, {
- 'objects_count': new ScalarNumeric(unitlessNumber_smallerIsBetter, 94),
- 'size': 24576,
- 'effective_size': 24576,
- 'inner_size': 20480
- }, {});
- assert.equal(oilpanRoot.children.length, 2);
-
- var oilpanBucket1 = d.getMemoryAllocatorDumpByFullName(
- 'oilpan/heap2/bucket1');
- assert.isDefined(oilpanBucket1);
- assert.equal(oilpanBucket1.fullName, 'oilpan/heap2/bucket1');
- assert.equal(oilpanBucket1.name, 'bucket1');
- checkDumpNumericsAndDiagnostics(oilpanBucket1, {
- 'objects_count': new ScalarNumeric(unitlessNumber_smallerIsBetter, 31),
- 'size': 8192,
- 'effective_size': 8192,
- 'inner_size': 8192
- }, {});
- assert.equal(oilpanBucket1.children.length, 0);
-
- assert.isDefined(oilpanBucket1.parent);
- assert.equal(oilpanBucket1.parent.fullName, 'oilpan/heap2');
- assert.equal(oilpanBucket1.parent.name, 'heap2');
- assert.include(oilpanBucket1.parent.children, oilpanBucket1);
-
- assert.isDefined(oilpanBucket1.parent.parent);
- assert.strictEqual(oilpanBucket1.parent.parent, oilpanRoot);
-
- assert.equal(d.totals.residentBytes, 256);
- assert.isUndefined(d.totals.peakResidentBytes);
- assert.isUndefined(d.totals.arePeakResidentBytesResettable);
- assert.isUndefined(d.totals.platformSpecific);
- assert.isUndefined(d.mostRecentVmRegions);
- });
-
- test('importMemoryDumps_globalMemoryAllocatorDumps', function() {
- var events = [
- {
- name: 'a',
- pid: 42,
- ts: 10,
- cat: 'test',
- tid: 53,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- process_totals: {
- resident_set_bytes: '100'
- },
- allocators: {
- 'tile_manager/tile1': {
- guid: '21',
- attrs: {
- objects_count: {
- type: 'scalar', units: 'objects', value: '3f'
- },
- inner_size: {type: 'scalar', units: 'bytes', value: '3000'},
- size: {type: 'scalar', units: 'bytes', value: '4000'},
- weather: {type: 'string', units: '', value: 'rainy'}
- }
- },
- 'global/shared_bitmap_manager/bitmap2': {
- guid: '42',
- attrs: {
- objects_count: {
- type: 'scalar', units: 'objects', value: '1f'
- },
- inner_size: {type: 'scalar', units: 'bytes', value: '2000'},
- size: {type: 'scalar', units: 'bytes', value: '2000'},
- weather: {type: 'string', units: '', value: 'sunny'}
- }
- }
- }
- }
- }
- }
- ];
- var m = makeModel(events);
- var p = m.getProcess(42);
- var gmd = m.globalMemoryDumps[0];
- var pmd = p.memoryDumps[0];
-
- assert.isUndefined(gmd.totals);
- assert.equal(pmd.totals.residentBytes, 256);
- assert.isUndefined(pmd.totals.peakResidentBytes);
- assert.isUndefined(pmd.totals.arePeakResidentBytesResettable);
- assert.isUndefined(pmd.totals.platformSpecific);
-
- assert.isUndefined(gmd.mostRecentVmRegions);
- assert.isUndefined(pmd.mostRecentVmRegions);
-
- assert.equal(gmd.memoryAllocatorDumps.length, 1);
- assert.equal(pmd.memoryAllocatorDumps.length, 1);
-
- // Global memory allocator dumps.
- var sharedBitmapManager = gmd.getMemoryAllocatorDumpByFullName(
- 'shared_bitmap_manager');
- assert.isDefined(sharedBitmapManager);
- assert.include(gmd.memoryAllocatorDumps, sharedBitmapManager);
-
- checkDumpNumericsAndDiagnostics(sharedBitmapManager, {
- 'objects_count': new ScalarNumeric(unitlessNumber_smallerIsBetter, 31),
- 'size': 8192,
- 'effective_size': 8192,
- 'inner_size': 8192
- }, {});
- assert.lengthOf(sharedBitmapManager.children, 1);
-
- var bitmap2 = gmd.getMemoryAllocatorDumpByFullName(
- 'shared_bitmap_manager/bitmap2');
- assert.isDefined(bitmap2);
- assert.include(sharedBitmapManager.children, bitmap2);
- assert.strictEqual(bitmap2.parent, sharedBitmapManager);
-
- checkDumpNumericsAndDiagnostics(bitmap2, {
- 'objects_count': new ScalarNumeric(unitlessNumber_smallerIsBetter, 31),
- 'size': 8192,
- 'effective_size': 8192,
- 'inner_size': 8192
- }, { 'weather': 'sunny' });
- assert.lengthOf(bitmap2.children, 0);
-
- assert.isUndefined(gmd.getMemoryAllocatorDumpByFullName('tile_manager'));
- assert.isUndefined(
- gmd.getMemoryAllocatorDumpByFullName('tile_manager/tile1'));
-
- // Process memory allocator dumps.
- var tileManagerRoot = pmd.getMemoryAllocatorDumpByFullName('tile_manager');
- assert.isDefined(tileManagerRoot);
- assert.include(pmd.memoryAllocatorDumps, tileManagerRoot);
- assert.isUndefined(tileManagerRoot.parent);
-
- checkDumpNumericsAndDiagnostics(tileManagerRoot, {
- 'objects_count': new ScalarNumeric(unitlessNumber_smallerIsBetter, 63),
- 'size': 16384,
- 'effective_size': 16384,
- 'inner_size': 12288
- }, {});
- assert.lengthOf(tileManagerRoot.children, 1);
-
- var tile1 = pmd.getMemoryAllocatorDumpByFullName(
- 'tile_manager/tile1');
- assert.isDefined(tile1);
- assert.include(tileManagerRoot.children, tile1);
- assert.strictEqual(tile1.parent, tileManagerRoot);
-
- checkDumpNumericsAndDiagnostics(tile1, {
- 'objects_count': new ScalarNumeric(unitlessNumber_smallerIsBetter, 63),
- 'size': 16384,
- 'effective_size': 16384,
- 'inner_size': 12288
- }, { 'weather': 'rainy' });
- assert.lengthOf(tile1.children, 0);
-
- assert.isUndefined(
- pmd.getMemoryAllocatorDumpByFullName('shared_bitmap_manager'));
- assert.isUndefined(
- pmd.getMemoryAllocatorDumpByFullName('shared_bitmap_manager/bitmap2'));
- });
-
- test('importMemoryDumps_memoryAllocatorDumpEdges', function() {
- var events = [
- {
- name: 'browser',
- pid: 42,
- ts: 10,
- cat: 'test',
- tid: 53,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- process_totals: {
- resident_set_bytes: '100'
- },
- allocators: {
- 'local': {
- guid: '3',
- attrs: {
- mood: {type: 'string', units: '', value: 'very good'}
- }
- },
- 'global/shared': {
- guid: '7',
- attrs: {
- color: {type: 'string', units: '', value: 'blue'}
- }
- }
- },
- allocators_graph: [
- {
- source: '3',
- target: '7',
- type: 'ownership',
- importance: 0
- }
- ]
- }
- }
- },
- {
- name: 'renderer',
- pid: 43,
- ts: 11,
- cat: 'test',
- tid: 53,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- process_totals: {
- resident_set_bytes: '200'
- },
- allocators: {
- 'local': {
- guid: '4',
- attrs: {
- length: {type: 'scalar', units: 'bytes', value: '3'}
- }
- },
- 'global/shared': {
- guid: '7',
- attrs: {
- area: {type: 'scalar', units: 'sq ft', value: '9'}
- }
- }
- },
- allocators_graph: [
- {
- source: '4',
- target: '7',
- type: 'ownership',
- importance: 1
- }
- ]
- }
- }
- },
- {
- name: 'gpu',
- pid: 44,
- ts: 10.5,
- cat: 'test',
- tid: 53,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- process_totals: {
- resident_set_bytes: '300'
- },
- allocators: {
- 'local1': {
- guid: '5',
- attrs: {
- state: {type: 'string', units: '', value: 'ON'}
- }
- },
- 'local2': {
- guid: '6',
- attrs: {
- temperature: {type: 'scalar', units: 'C', value: '64'}
- }
- }
- },
- allocators_graph: [
- {
- source: '5',
- target: '7',
- type: 'ownership',
- importance: -1
- },
- {
- source: '6',
- target: '5',
- type: 'ownership',
- importance: 1
- },
- {
- source: '5',
- target: '4',
- type: 'retention'
- }
- ]
- }
- }
- }
- ];
- var model = makeModel(events);
- var browserProcess = model.getProcess(42);
- var rendererProcess = model.getProcess(43);
- var gpuProcess = model.getProcess(44);
-
- assert.lengthOf(model.globalMemoryDumps, 1);
- assert.lengthOf(browserProcess.memoryDumps, 1);
- assert.lengthOf(rendererProcess.memoryDumps, 1);
- assert.lengthOf(gpuProcess.memoryDumps, 1);
-
- var globalDump = model.globalMemoryDumps[0];
- var browserDump = browserProcess.memoryDumps[0];
- var rendererDump = rendererProcess.memoryDumps[0];
- var gpuDump = gpuProcess.memoryDumps[0];
-
- // Global memory allocator dump.
- assert.lengthOf(globalDump.memoryAllocatorDumps, 1);
-
- var globalDumpShared = globalDump.getMemoryAllocatorDumpByFullName(
- 'shared');
- assert.isDefined(globalDumpShared);
- assert.include(globalDump.memoryAllocatorDumps, globalDumpShared);
- checkDumpNumericsAndDiagnostics(globalDumpShared, {
- 'area': new ScalarNumeric(unitlessNumber_smallerIsBetter, 9)
- }, { 'color': 'blue' });
- assert.lengthOf(globalDumpShared.children, 0);
- assert.isUndefined(globalDumpShared.parent);
-
- assert.isUndefined(globalDumpShared.owns);
- assert.lengthOf(globalDumpShared.ownedBy, 3);
- assert.lengthOf(globalDumpShared.retains, 0);
- assert.lengthOf(globalDumpShared.retainedBy, 0);
-
- // Browser memory allocator dump.
- assert.lengthOf(browserDump.memoryAllocatorDumps, 1);
-
- var browserDumpLocal = browserDump.getMemoryAllocatorDumpByFullName(
- 'local');
- assert.isDefined(browserDumpLocal);
- assert.include(browserDump.memoryAllocatorDumps, browserDumpLocal);
- checkDumpNumericsAndDiagnostics(browserDumpLocal, {
- 'area': new ScalarNumeric(unitlessNumber_smallerIsBetter, 9)
- }, { 'color': 'blue', 'mood': 'very good' });
- assert.lengthOf(browserDumpLocal.children, 0);
- assert.isUndefined(browserDumpLocal.parent);
-
- assert.isDefined(browserDumpLocal.owns);
- assert.lengthOf(browserDumpLocal.ownedBy, 0);
- assert.lengthOf(browserDumpLocal.retains, 0);
- assert.lengthOf(browserDumpLocal.retainedBy, 0);
-
- var browserDumpLocalOwnsLink = browserDumpLocal.owns;
- assert.include(globalDumpShared.ownedBy, browserDumpLocalOwnsLink);
- assert.strictEqual(browserDumpLocalOwnsLink.source, browserDumpLocal);
- assert.strictEqual(browserDumpLocalOwnsLink.target, globalDumpShared);
- assert.equal(browserDumpLocalOwnsLink.importance, 0);
-
- // Renderer memory allocator dump.
- assert.lengthOf(rendererDump.memoryAllocatorDumps, 1);
-
- var rendererDumpLocal = rendererDump.getMemoryAllocatorDumpByFullName(
- 'local');
- assert.isDefined(rendererDumpLocal);
- assert.include(rendererDump.memoryAllocatorDumps, rendererDumpLocal);
- checkDumpNumericsAndDiagnostics(rendererDumpLocal, {
- 'area': new ScalarNumeric(unitlessNumber_smallerIsBetter, 9),
- 'length': 3
- }, { 'color': 'blue' });
- assert.lengthOf(rendererDumpLocal.children, 0);
- assert.isUndefined(rendererDumpLocal.parent);
-
- assert.isDefined(rendererDumpLocal.owns);
- assert.lengthOf(rendererDumpLocal.ownedBy, 0);
- assert.lengthOf(rendererDumpLocal.retains, 0);
- assert.lengthOf(rendererDumpLocal.retainedBy, 1);
-
- var rendererDumpLocalOwnsLink = rendererDumpLocal.owns;
- assert.include(globalDumpShared.ownedBy, rendererDumpLocalOwnsLink);
- assert.strictEqual(rendererDumpLocalOwnsLink.source, rendererDumpLocal);
- assert.strictEqual(rendererDumpLocalOwnsLink.target, globalDumpShared);
- assert.equal(rendererDumpLocalOwnsLink.importance, 1);
-
- // GPU memory allocator dumps.
- assert.lengthOf(gpuDump.memoryAllocatorDumps, 2);
-
- var gpuDumpLocal1 = gpuDump.getMemoryAllocatorDumpByFullName('local1');
- assert.isDefined(gpuDumpLocal1);
- assert.include(gpuDump.memoryAllocatorDumps, gpuDumpLocal1);
- checkDumpNumericsAndDiagnostics(gpuDumpLocal1, {
- 'area': new ScalarNumeric(unitlessNumber_smallerIsBetter, 9)
- }, { 'state': 'ON', 'color': 'blue' });
- assert.lengthOf(gpuDumpLocal1.children, 0);
- assert.isUndefined(gpuDumpLocal1.parent);
-
- assert.isDefined(gpuDumpLocal1.owns);
- assert.lengthOf(gpuDumpLocal1.ownedBy, 1);
- assert.lengthOf(gpuDumpLocal1.retains, 1);
- assert.lengthOf(gpuDumpLocal1.retainedBy, 0);
-
- var gpuDumpLocal1OwnsLink = gpuDumpLocal1.owns;
- assert.include(globalDumpShared.ownedBy, gpuDumpLocal1OwnsLink);
- assert.strictEqual(gpuDumpLocal1OwnsLink.source, gpuDumpLocal1);
- assert.strictEqual(gpuDumpLocal1OwnsLink.target, globalDumpShared);
- assert.equal(gpuDumpLocal1OwnsLink.importance, -1);
-
- var gpuDumpLocal1RetainsLink = gpuDumpLocal1.retains[0];
- assert.include(rendererDumpLocal.retainedBy, gpuDumpLocal1RetainsLink);
- assert.strictEqual(gpuDumpLocal1RetainsLink.source, gpuDumpLocal1);
- assert.strictEqual(gpuDumpLocal1RetainsLink.target, rendererDumpLocal);
- assert.isUndefined(gpuDumpLocal1RetainsLink.importance);
-
- var gpuDumpLocal2 = gpuDump.getMemoryAllocatorDumpByFullName('local2');
- assert.isDefined(gpuDumpLocal2);
- assert.include(gpuDump.memoryAllocatorDumps, gpuDumpLocal2);
- checkDumpNumericsAndDiagnostics(gpuDumpLocal2, {
- 'temperature': new ScalarNumeric(unitlessNumber_smallerIsBetter, 100)
- }, {});
- assert.lengthOf(gpuDumpLocal2.children, 0);
- assert.isUndefined(gpuDumpLocal2.parent);
-
- assert.isDefined(gpuDumpLocal2.owns);
- assert.lengthOf(gpuDumpLocal2.ownedBy, 0);
- assert.lengthOf(gpuDumpLocal2.retains, 0);
- assert.lengthOf(gpuDumpLocal2.retainedBy, 0);
-
- var gpuDumpLocal2OwnsLink = gpuDumpLocal2.owns;
- assert.include(gpuDumpLocal1.ownedBy, gpuDumpLocal2OwnsLink);
- assert.strictEqual(gpuDumpLocal2OwnsLink.source, gpuDumpLocal2);
- assert.strictEqual(gpuDumpLocal2OwnsLink.target, gpuDumpLocal1);
- assert.equal(gpuDumpLocal2OwnsLink.importance, 1);
- });
-
- test('importMemoryDumps_memoryAllocatorDumpsMissingFields', function() {
- var events = [
- {
- name: 'a',
- pid: 42,
- ts: 10,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- allocators: {
- 'no_crash': {
- /* Missing GUID and attributes. */
- }
- }
- }
- }
- }
- ];
- var m = makeModel(events);
- var p = m.getProcess(42);
- var d = p.memoryDumps[0];
-
- assert.equal(d.memoryAllocatorDumps.length, 1);
- var noCrashRoot = d.getMemoryAllocatorDumpByFullName('no_crash');
- assert.lengthOf(noCrashRoot.children, 0);
- checkDumpNumericsAndDiagnostics(noCrashRoot, {}, {});
- assert.isUndefined(noCrashRoot.parent);
- assert.isUndefined(noCrashRoot.guid);
- });
-
- test('importMemoryDumps_weakMemoryAllocatorDumps', function() {
- var events = [
- {
- pid: 42,
- ts: 10,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- allocators: {
- // Sinks for ownership edges (to check that the correct ownership
- // edges are removed).
- 'root_sink': { guid: '100', attrs: {} },
- 'root_sink/child_sink': { guid: '200', attrs: {} },
- 'root_sink/child_sink/descendant_sink': {
- guid: '300', attrs: {}
- },
-
- // Note: 'removed' in the name of a dump means that the dump will
- // be removed despite being non-weak (strong), e.g. due to one of
- // its ancestors being weak.
-
- // All descendants of a weak root dump should be removed.
- 'weak_root': { guid: '1', attrs: {}, flags: 1 },
- 'weak_root/removed_child': { guid: '2', attrs: {} },
- 'weak_root/inferred_removed_child/removed_descendant': {
- guid: '3', attrs: {}, flags: 0
- },
-
- // A strong root should be kept even if all its descendants are
- // weak.
- 'strong_root': { guid: '4', attrs: {}, flags: 0 },
- 'strong_root/weak_child': { guid: '5', attrs: {}, flags: 1 },
- 'strong_root/inferred_weak_child/weak_descendant': {
- guid: '6', attrs: {}, flags: 1
- },
-
- // All inferred ancestors of a weak descendant should be marked
- // weak and, consequently, removed (provided that they don't have
- // any non-weak descendants).
- 'inferred_weak_root/inferred_weak_child/weak_descendant': {
- guid: '7', attrs: {}, flags: 1
- },
-
- // An inferred dump should be marked non-weak if it has at least
- // one strong descendant.
- 'inferred_strong_root/child1_weak': {
- guid: '8', attrs: {}, flags: 1
- },
- 'inferred_strong_root/child2_strong': {
- guid: '9', attrs: {}
- },
- 'inferred_strong_root/child3_weak': {
- guid: '10', attrs: {}, flags: 1
- },
- 'inferred_strong_root2/inferred_strong_child/desc1_strong': {
- guid: '11', attrs: {}
- },
- 'inferred_strong_root2/inferred_strong_child/desc2_weak': {
- guid: '12', attrs: {}, flags: 1
- },
- 'inferred_strong_root2/inferred_strong_child/desc3_strong': {
- guid: '13', attrs: {}
- },
- 'inferred_strong_root2/weak_child': {
- guid: '14', attrs: {}, flags: 1
- },
-
- // A desdendant dump should be removed if it has a weak ancestor.
- 'strong_root2': { guid: '15', attrs: {} },
- 'strong_root2/weak_child': { guid: '16', attrs: {}, flags: 1 },
- 'strong_root2/weak_child/removed_descendant': {
- guid: '17', attrs: {}
- },
-
- // Check that "weakness" also propagates across ownership edges.
- 'removed_root': { guid: '18', attrs: {} },
- 'removed_root/removed_child': {
- guid: '19', attrs: {}
- },
- 'inferred_strong_root3/removed_child': {
- guid: '20', attrs: {}
- },
- },
- allocators_graph: [
- { source: '1', target: '100', type: 'ownership' },
- { source: '2', target: '200', type: 'ownership' },
- { source: '3', target: '300', type: 'ownership' },
-
- { source: '4', target: '100', type: 'ownership' }, // Kept.
- { source: '5', target: '200', type: 'ownership' },
- { source: '6', target: '300', type: 'ownership' },
-
- { source: '7', target: '300', type: 'ownership' },
-
- { source: '8', target: '200', type: 'ownership' },
- { source: '9', target: '200', type: 'ownership' }, // Kept.
- { source: '10', target: '200', type: 'ownership' },
- { source: '11', target: '300', type: 'ownership' }, // Kept.
- { source: '12', target: '300', type: 'ownership' },
- { source: '13', target: '300', type: 'ownership' }, // Kept.
- { source: '14', target: '200', type: 'ownership' },
-
- { source: '15', target: '100', type: 'ownership' }, // Kept.
- { source: '16', target: '200', type: 'ownership' },
- { source: '17', target: '300', type: 'ownership' },
-
- { source: '18', target: '3' /* not a sink */, type: 'ownership' },
- { source: '19', target: '200', type: 'ownership' },
- { source: '20', target: '19' /* not a sink */, type: 'ownership' }
- ]
- }
- }
- }
- ];
- var m = makeModel(events);
- var p = m.getProcess(42);
- var d = p.memoryDumps[0];
- var memoryAllocatorDumps = d.memoryAllocatorDumps;
- assert.lengthOf(memoryAllocatorDumps, 6);
-
- function checkDump(dump, expectedFullName, expectedGuid, expectedParent,
- expectedChildCount, expectedOwnsLink, expectedOwnedByLinkCount) {
- assert.strictEqual(dump.fullName, expectedFullName);
- assert.strictEqual(dump.guid, expectedGuid);
- assert.strictEqual(dump.parent, expectedParent);
- assert.lengthOf(dump.children, expectedChildCount);
- assert.strictEqual(dump.owns, expectedOwnsLink);
- assert.lengthOf(dump.ownedBy, expectedOwnedByLinkCount);
- assert.strictEqual(
- d.getMemoryAllocatorDumpByFullName(expectedFullName), dump);
- }
-
- function checkOwnsLink(ownerDump, expectedTarget) {
- assert.strictEqual(ownerDump.owns.source, ownerDump);
- assert.strictEqual(ownerDump.owns.target, expectedTarget);
- }
-
- // Check root_sink/* dumps.
- var rootSink = d.memoryAllocatorDumps[3];
- checkDump(rootSink, 'root_sink', '100', undefined, 1, undefined, 2);
- var childSink = rootSink.children[0];
- checkDump(childSink, 'root_sink/child_sink', '200', rootSink, 1, undefined,
- 1);
- var descendantSink = childSink.children[0];
- checkDump(descendantSink, 'root_sink/child_sink/descendant_sink', '300',
- childSink, 0, undefined, 2);
-
- // Check strong_root/* dumps.
- var strongRoot = d.memoryAllocatorDumps[4];
- checkDump(strongRoot, 'strong_root', '4', undefined, 0, rootSink.ownedBy[0],
- 0);
-
- // Check inferred_strong_root/* dumps.
- var inferredStrongRoot = d.memoryAllocatorDumps[0];
- checkDump(inferredStrongRoot, 'inferred_strong_root', undefined, undefined,
- 1, undefined, 0);
- var child2Strong = inferredStrongRoot.children[0];
- checkDump(child2Strong, 'inferred_strong_root/child2_strong', '9',
- inferredStrongRoot, 0, childSink.ownedBy[0], 0);
-
- // Check inferred_strong_root2/* dumps.
- var inferredStrongRoot2 = d.memoryAllocatorDumps[1];
- checkDump(inferredStrongRoot2, 'inferred_strong_root2', undefined,
- undefined, 1, undefined, 0);
- var inferredStrongChild = inferredStrongRoot2.children[0];
- checkDump(inferredStrongChild,
- 'inferred_strong_root2/inferred_strong_child', undefined,
- inferredStrongRoot2, 2, undefined, 0);
- var desc1Strong = inferredStrongChild.children[0];
- checkDump(desc1Strong,
- 'inferred_strong_root2/inferred_strong_child/desc1_strong', '11',
- inferredStrongChild, 0, descendantSink.ownedBy[0], 0);
- var desc3Strong = inferredStrongChild.children[1];
- checkDump(desc3Strong,
- 'inferred_strong_root2/inferred_strong_child/desc3_strong', '13',
- inferredStrongChild, 0, descendantSink.ownedBy[1], 0);
-
- // Check strong_root2/* dumps.
- var strongRoot2 = d.memoryAllocatorDumps[5];
- checkDump(strongRoot2, 'strong_root2', '15', undefined, 0,
- rootSink.ownedBy[1], 0);
-
- // Check inferred_strong_root3/* dumps.
- var inferredStrongRoot3 = d.memoryAllocatorDumps[2];
- checkDump(inferredStrongRoot3, 'inferred_strong_root3', undefined,
- undefined, 0, undefined, 0);
-
- // Check the links.
- checkOwnsLink(strongRoot, rootSink);
- checkOwnsLink(child2Strong, childSink);
- checkOwnsLink(desc1Strong, descendantSink);
- checkOwnsLink(desc3Strong, descendantSink);
- checkOwnsLink(strongRoot2, rootSink);
-
- // Check that the removed weak dumps are not indexed.
- [
- 'weak_root',
- 'weak_root/removed_child',
- 'weak_root/inferred_removed_child',
- 'weak_root/inferred_removed_child/removed_descendant',
- 'strong_root/weak_child',
- 'strong_root/inferred_weak_child/weak_descendant',
- 'inferred_weak_root',
- 'inferred_weak_root/inferred_weak_child',
- 'inferred_weak_root/inferred_weak_child/weak_descendant',
- 'inferred_strong_root/child1_weak',
- 'inferred_strong_root/child3_weak',
- 'inferred_strong_root2/inferred_strong_child/desc2_weak',
- 'inferred_strong_root2/weak_child',
- 'strong_root2/weak_child',
- 'strong_root2/removed_descendant',
- 'removed_root',
- 'removed_root/removed_child',
- 'inferred_strong_root3/removed_child'
- ].forEach(function(fullName) {
- assert.isUndefined(d.getMemoryAllocatorDumpByFullName(fullName));
- });
- });
-
- test('importMemoryDumps_levelsOfDetail', function() {
- function checkLevelsOfDetail(pmdSpecifications, expectedGlobalLevelOfDetail,
- expectedProcessLevelsOfDetail, expectedHasWarnings) {
- var events = [];
- pmdSpecifications.forEach(function(singlePmdSpecifications, pid) {
- singlePmdSpecifications.forEach(function(singlePmdSpecification) {
- var dumps = {};
- if (singlePmdSpecification.levelOfDetail !== undefined)
- dumps.level_of_detail = singlePmdSpecification.levelOfDetail;
- if (singlePmdSpecification.vmRegions) {
- dumps.process_mmaps = {
- vm_regions: [
- { sa: 'f0', sz: '150', pf: 6, mf: '[stack]', bs: { pss: 'ff'} }
- ]
- };
- }
- events.push({
- name: 'process_' + pid,
- pid: pid,
- ts: 10,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: dumps
- }
- });
- });
- });
- var model = makeModel(events);
-
- // Check GlobalMemoryDump level of detail.
- assert.lengthOf(model.globalMemoryDumps, 1);
- assert.strictEqual(model.globalMemoryDumps[0].levelOfDetail,
- expectedGlobalLevelOfDetail);
-
- // Check ProcessMemoryDumps levels of detail.
- assert.lengthOf(Object.keys(model.processes),
- expectedProcessLevelsOfDetail.length);
- for (var i = 0; i < expectedProcessLevelsOfDetail.length; i++) {
- var process = model.getProcess(i);
- assert.lengthOf(process.memoryDumps, 1);
- assert.strictEqual(process.memoryDumps[0].levelOfDetail,
- expectedProcessLevelsOfDetail[i]);
- }
-
- assert.strictEqual(model.hasImportWarnings, expectedHasWarnings);
- }
-
- // Legacy trace events (without levels of detail).
- checkLevelsOfDetail([[{}]], LIGHT, [LIGHT], false);
- checkLevelsOfDetail([[{ vmRegions: true }]], DETAILED, [DETAILED], false);
- checkLevelsOfDetail(
- [
- [{}] /* raw composable PMD1 events */,
- [{}, {}] /* raw composable PMD2 events */
- ],
- LIGHT /* expected GMD level of detail */,
- [LIGHT, LIGHT] /* expected PMD levels of detail */,
- false /* no warnings expected */);
- checkLevelsOfDetail(
- [
- [{}, { vmRegions: true }, {}],
- [{ vmRegions: true }, {}]
- ],
- DETAILED, [DETAILED, DETAILED], false);
-
- // Well-formed traces events (VM regions should be irrelevant).
- checkLevelsOfDetail(
- [
- [{ levelOfDetail: 'light'}],
- [{ levelOfDetail: 'light', vmRegions: true }]
- ],
- LIGHT, [LIGHT, LIGHT], false);
- checkLevelsOfDetail(
- [
- [
- { levelOfDetail: 'detailed' }, { levelOfDetail: 'detailed' }
- ],
- [
- { levelOfDetail: 'detailed', vmRegions: true }
- ],
- [
- { levelOfDetail: 'detailed' },
- { levelOfDetail: 'detailed', vmRegions: true },
- { levelOfDetail: 'detailed' }
- ]
- ],
- DETAILED, [DETAILED, DETAILED, DETAILED], false);
-
- // Not so well-formed trace events.
- checkLevelsOfDetail(
- [
- [{}, { levelOfDetail: 'detailed'}, {}]
- ],
- DETAILED, [DETAILED], true);
- checkLevelsOfDetail(
- [
- [{ levelOfDetail: 'light' }],
- [{}],
- [{ levelOfDetail: 'detailed' }],
- [{ levelOfDetail: 'light' }]],
- DETAILED, [LIGHT, LIGHT, DETAILED, LIGHT], true);
- checkLevelsOfDetail(
- [
- [{ levelOfDetail: 'light' }, { levelOfDetail: 'detailed' }],
- [{}],
- [{ levelOfDetail: 'light' }, {}]],
- DETAILED, [DETAILED, LIGHT, LIGHT], true);
- checkLevelsOfDetail(
- [
- [{ levelOfDetail: 'invalid' }, { levelOfDetail: 'light' }],
- [{ levelOfDetail: 'invalid' }]],
- LIGHT, [LIGHT, LIGHT], true);
- });
-
- test('importMemoryDumps_heapDumps_oldFormat', function() {
- var events = [ // Intentionally shuffled.
- {
- pid: 21,
- ts: 9,
- ph: 'v',
- id: '0123',
- args: {
- dumps: {
- heaps: {
- partition_alloc: {
- entries: [
- { size: '1000' },
- { bt: '0', size: 'abc' }
- ]
- }
- }
- }
- }
- },
- {
- pid: 42,
- ph: 'M',
- name: 'stackFrames',
- args: {
- stackFrames: {
- '0': { name: 'MessageLoop::RunTask' },
- '1': { name: 'TimerBase::run', parent: '0' },
- 'TWO': { name: 'ScheduledAction::execute', 'parent': '1' },
- '3': { name: 'FunctionCall', parent: 'TWO' },
- '4': { name: 'UpdateLayoutTree', parent: '1' },
- '5': { name: 'MessageLoop::JogTask' }
- }
- }
- },
- {
- pid: 42,
- ph: 'M',
- name: 'typeNames',
- args: {
- typeNames: {
- // GCC.
- '22': '[unknown]',
- '23': 'testing::ManuallyAnnotatedMockClass',
- '24': 'const char* WTF::getStringWithTypeName() [with T = ' +
- 'blink::Event]',
- '25': 'blink::ContextLifecycleObserver*',
- '26': 'const char* WTF::getStringWithTypeName() [with T = ' +
- 'blink::WebFrame*]'
- }
- }
- },
- {
- pid: 42,
- ts: 10,
- ph: 'v',
- id: '0123',
- args: {
- dumps: {
- process_totals: {
- resident_set_bytes: '0'
- },
- heaps: {
- partition_alloc: {
- entries: [
- { type: '24', size: '2e6fc8' },
- { size: '5cdf91' },
- { type: '25', size: '1737e4' },
- { bt: '', size: '5b6cd6' },
- { bt: '4', size: '18f0' },
- { bt: '3', size: 'e3a8' }
- ]
- },
- malloc: {
- entries: [
- { size: '789' },
- { bt: '0', size: '123' },
- { bt: '5', size: '456' },
- { type: '25', size: 'cd' }
- ]
- }
- }
- }
- }
- },
- {
- pid: 21,
- ph: 'M',
- name: 'stackFrames',
- args: {
- stackFrames: {
- // Intentionally in reverse order.
- '0': { name: 'FrameView::layout', parent: '1' },
- '1': { name: 'MessageLoop::RunTask' }
- }
- }
- },
- {
- pid: 21,
- ts: 12,
- ph: 'v',
- id: '0987',
- args: {
- dumps: {
- heaps: {
- partition_alloc: {
- entries: [
- { size: '2000' },
- { bt: '0', size: 'def' }
- ]
- }
- }
- }
- }
- }
- ];
- var m = makeModel(events);
- var p1 = m.getProcess(21);
- var p2 = m.getProcess(42);
- assert.lengthOf(m.globalMemoryDumps, 2);
- assert.lengthOf(p1.memoryDumps, 2);
- assert.lengthOf(p2.memoryDumps, 1);
-
- // Stack frames.
- assert.deepEqual(
- tr.b.mapItems(m.stackFrames, function(id, f) { return f.title }),
- {
- 'p21:0': 'FrameView::layout',
- 'p21:0:self': '<self>',
- 'p21:1': 'MessageLoop::RunTask',
- 'p42::self': '<self>',
- 'p42:0': 'MessageLoop::RunTask',
- 'p42:0:self': '<self>',
- 'p42:1': 'TimerBase::run',
- 'p42:TWO': 'ScheduledAction::execute',
- 'p42:3': 'FunctionCall',
- 'p42:3:self': '<self>',
- 'p42:4': 'UpdateLayoutTree',
- 'p42:4:self': '<self>',
- 'p42:5': 'MessageLoop::JogTask',
- 'p42:5:self': '<self>'
- });
-
- // 1. Process 21, first dump.
- var pmd1 = p1.memoryDumps[0];
- var hds1 = pmd1.heapDumps;
- assert.sameMembers(Object.keys(hds1), ['partition_alloc']);
-
- var partitionAllocDump1 = hds1['partition_alloc'];
- assert.strictEqual(partitionAllocDump1.processMemoryDump, pmd1);
- assert.equal(partitionAllocDump1.allocatorName, 'partition_alloc');
- var partitionAllocEntries1 = partitionAllocDump1.entries;
- assert.lengthOf(partitionAllocEntries1, 2);
- checkHeapEntry(partitionAllocEntries1[0], partitionAllocDump1, 4096,
- undefined /* root */, undefined /* sum over all types */);
- checkHeapEntry(partitionAllocEntries1[1], partitionAllocDump1, 2748,
- ['<self>', 'FrameView::layout', 'MessageLoop::RunTask']);
-
- // 2. Process 21, second dump.
- var pmd2 = p1.memoryDumps[1];
- var hds2 = pmd2.heapDumps;
- assert.sameMembers(Object.keys(hds2), ['partition_alloc']);
-
- var partitionAllocDump2 = hds2['partition_alloc'];
- assert.strictEqual(partitionAllocDump2.processMemoryDump, pmd2);
- assert.equal(partitionAllocDump2.allocatorName, 'partition_alloc');
- var partitionAllocEntries2 = partitionAllocDump2.entries;
- assert.lengthOf(partitionAllocEntries2, 2);
- checkHeapEntry(partitionAllocEntries2[0], partitionAllocDump2, 8192,
- undefined /* root */, undefined /* sum over all types */);
- checkHeapEntry(partitionAllocEntries2[1], partitionAllocDump2, 3567,
- ['<self>', 'FrameView::layout', 'MessageLoop::RunTask'],
- undefined /* sum over all types */);
-
- // All heap dumps in Process 21 should use the same stack frames.
- assert.strictEqual(
- getFrame(partitionAllocEntries1[1], 0),
- getFrame(partitionAllocEntries2[1], 0));
-
- // 3. Process 42.
- var pmd3 = p2.memoryDumps[0];
- var hds3 = pmd3.heapDumps;
- assert.sameMembers(Object.keys(hds3), ['partition_alloc', 'malloc']);
-
- var partitionAllocDump3 = hds3['partition_alloc'];
- assert.strictEqual(partitionAllocDump3.processMemoryDump, pmd3);
- assert.equal(partitionAllocDump3.allocatorName, 'partition_alloc');
- var partitionAllocEntries3 = partitionAllocDump3.entries;
- assert.lengthOf(partitionAllocEntries3, 6);
- checkHeapEntry(partitionAllocEntries3[0], partitionAllocDump3, 3043272,
- undefined /* root */, 'blink::Event');
- checkHeapEntry(partitionAllocEntries3[1], partitionAllocDump3, 6086545,
- undefined /* root */, undefined /* sum over all types */);
- checkHeapEntry(partitionAllocEntries3[2], partitionAllocDump3, 1521636,
- undefined /* root */, 'blink::ContextLifecycleObserver*');
- checkHeapEntry(partitionAllocEntries3[3], partitionAllocDump3, 5991638,
- ['<self>'], undefined /* sum over all types */);
- checkHeapEntry(partitionAllocEntries3[4], partitionAllocDump3, 6384,
- ['<self>', 'UpdateLayoutTree', 'TimerBase::run',
- 'MessageLoop::RunTask'], undefined /* sum over all types */);
- checkHeapEntry(partitionAllocEntries3[5], partitionAllocDump3, 58280,
- ['<self>', 'FunctionCall', 'ScheduledAction::execute', 'TimerBase::run',
- 'MessageLoop::RunTask'], undefined /* sum over all types */);
-
- var mallocDump3 = hds3['malloc'];
- assert.strictEqual(mallocDump3.processMemoryDump, pmd3);
- assert.equal(mallocDump3.allocatorName, 'malloc');
- var mallocEntries3 = mallocDump3.entries;
- assert.lengthOf(mallocEntries3, 4);
- checkHeapEntry(mallocEntries3[0], mallocDump3, 1929, undefined /* root */,
- undefined /* sum over all types */);
- checkHeapEntry(mallocEntries3[1], mallocDump3, 291,
- ['<self>', 'MessageLoop::RunTask'], undefined /* sum over all types */);
- checkHeapEntry(mallocEntries3[2], mallocDump3, 1110,
- ['<self>', 'MessageLoop::JogTask'], undefined /* sum over all types */);
- checkHeapEntry(mallocEntries3[3], mallocDump3, 205, undefined /* root */,
- 'blink::ContextLifecycleObserver*');
-
- // All heap dumps in Process 42 should use the same stack frames.
- assert.strictEqual(
- getFrame(partitionAllocEntries3[5], 3),
- getFrame(partitionAllocEntries3[4], 2));
- assert.strictEqual(
- getFrame(mallocEntries3[1], 1),
- getFrame(partitionAllocEntries3[4], 3));
- });
-
- test('importMemoryDumps_heapDumps_newFormat', function() {
- var events = [ // Intentionally shuffled.
- {
- pid: 21,
- ts: 9,
- ph: 'v',
- id: '0123',
- args: {
- dumps: {
- heaps: {
- partition_alloc: {
- entries: [
- { bt: '', type: '25', size: '1000' },
- { bt: 'A', size: 'abc' }
- ]
- }
- }
- }
- }
- },
- {
- pid: 42,
- ph: 'M',
- name: 'stackFrames',
- args: {
- stackFrames: {
- '-1': { name: '<self>' },
- '0': { name: 'MessageLoop::RunTask' },
- '0.5': { name: '<self>', parent: '0' },
- '1': { name: 'TimerBase::run', parent: '0' },
- 'TWO': { name: 'ScheduledAction::execute', 'parent': '1' },
- '2.72': { name: '<self>', 'parent': 'TWO' },
- '3': { name: 'FunctionCall', parent: 'TWO' },
- '\u03C0': { name: '<self>', parent: '3' },
- '4': { name: 'UpdateLayoutTree', parent: '1' },
- 'FOUR-AND-A-BIT': { name: '<self>', parent: '4' },
- '5': { name: 'MessageLoop::JogTask' },
- 'NaN': { name: '<self>', parent: '5' }
- }
- }
- },
- {
- pid: 42,
- ph: 'M',
- name: 'typeNames',
- args: {
- typeNames: {
- // Clang.
- '22': '[unknown]',
- '23': 'testing::ManuallyAnnotatedMockClass',
- '24': 'const char *WTF::getStringWithTypeName() [T = ' +
- 'blink::Event]',
- '25': 'blink::ContextLifecycleObserver *',
- '26': 'const char *WTF::getStringWithTypeName() [T = ' +
- 'blink::WebFrame *]'
- }
- }
- },
- {
- pid: 42,
- ts: 10,
- ph: 'v',
- id: '0123',
- args: {
- dumps: {
- process_totals: {
- resident_set_bytes: '0'
- },
- heaps: {
- partition_alloc: {
- entries: [
- { bt: '' /* root */, size: '5cdf91' },
- { bt: '' /* root */, type: '24', size: '2e6fc8' },
- { bt: '' /* root */, type: '25', size: '1737e4' },
- { bt: '-1', type: '22', size: '5b6cd6' },
- { bt: 'FOUR-AND-A-BIT', size: '18f0', count: '100' },
- { bt: 'FOUR-AND-A-BIT', type: '26', size: 'c78' },
- { bt: '\u03C0', size: 'e3a8' }
- ]
- },
- malloc: {
- entries: [
- { bt: '', size: '789', count: '50' },
- { bt: '0.5', size: '123', count: '60' },
- { bt: 'NaN', size: '456', count: '70' },
- { bt: '3', type: '25', size: 'cd', count: '80' }
- ]
- }
- }
- }
- }
- },
- {
- pid: 21,
- ph: 'M',
- name: 'stackFrames',
- args: {
- stackFrames: {
- // Intentionally in reverse order.
- 'A': { name: '<self>', parent: '0' },
- '0': { name: 'FrameView::layout', parent: '1' },
- '1': { name: 'MessageLoop::RunTask' }
- }
- }
- },
- {
- pid: 21,
- ts: 12,
- ph: 'v',
- id: '0987',
- args: {
- dumps: {
- heaps: {
- winheap: {
- entries: [] // Intentionally empty.
- },
- partition_alloc: {
- entries: [
- { bt: '', size: '2000' },
- { bt: 'A', type: '25', size: 'def' },
- { bt: '3' /* invalid */, size: 'aaa' },
- { bt: 'A', type: '24' /* invalid */, size: 'bbb' },
- { bt: '0', size: 'fff' }
- ]
- }
- }
- }
- }
- },
- {
- pid: 21,
- ph: 'M',
- name: 'typeNames',
- args: {
- typeNames: {
- // Microsoft Visual C++.
- '25': 'const char *__cdecl WTF::getStringWithTypeName<class ' +
- 'v8::FunctionCallbackInfo<class v8::Value>>(void)'
- }
- }
- },
- {
- pid: 63,
- ph: 'M',
- name: 'stackFrames',
- args: {
- stackFrames: {} // Intentionally empty.
- }
- },
- {
- pid: 63,
- ph: 'M',
- name: 'typeNames',
- args: {
- typeNames: {} // Intentionally empty.
- }
- },
- {
- pid: 63,
- ts: 13,
- ph: 'v',
- id: '0987',
- args: {
- dumps: {
- heaps: {
- winheap: {
- entries: [
- { bt: '', size: '10000' }
- ]
- }
- }
- }
- }
- },
- {
- pid: 84,
- ph: 'M',
- name: 'stackFrames',
- args: {
- stackFrames: {
- '5': { name: 'MessageLoop::WalkTask' }
- }
- }
- },
- {
- pid: 84,
- ph: 'M',
- name: 'typeNames',
- args: {
- typeNames: {
- '0': '[unknown]',
- '1': 'base::All',
- '3': 'content::Manually',
- '4': 'net::Annotated'
- }
- }
- },
- {
- pid: 84,
- ts: 14,
- ph: 'v',
- id: '0987',
- args: {
- dumps: {
- heaps: {
- malloc: {
- entries: [
- { bt: '5', type: '3', size: 'abcd' }
- ]
- }
- }
- }
- }
- }
- ];
- var m = makeModel(events);
- var p1 = m.getProcess(21);
- var p2 = m.getProcess(42);
- var p3 = m.getProcess(63);
- var p4 = m.getProcess(84);
- assert.lengthOf(m.globalMemoryDumps, 2);
- assert.lengthOf(p1.memoryDumps, 2);
- assert.lengthOf(p2.memoryDumps, 1);
- assert.lengthOf(p3.memoryDumps, 1);
- assert.lengthOf(p4.memoryDumps, 1);
-
- // Stack frames.
- assert.deepEqual(
- tr.b.mapItems(m.stackFrames, function(id, f) { return f.title }),
- {
- 'p21:0': 'FrameView::layout',
- 'p21:A': '<self>',
- 'p21:1': 'MessageLoop::RunTask',
- 'p42:-1': '<self>',
- 'p42:0': 'MessageLoop::RunTask',
- 'p42:0.5': '<self>',
- 'p42:1': 'TimerBase::run',
- 'p42:TWO': 'ScheduledAction::execute',
- 'p42:2.72': '<self>',
- 'p42:3': 'FunctionCall',
- 'p42:\u03C0': '<self>',
- 'p42:4': 'UpdateLayoutTree',
- 'p42:FOUR-AND-A-BIT': '<self>',
- 'p42:5': 'MessageLoop::JogTask',
- 'p42:NaN': '<self>',
- 'p84:5': 'MessageLoop::WalkTask'
- });
-
- // 1. Process 21, first dump.
- var pmd1 = p1.memoryDumps[0];
- var hds1 = pmd1.heapDumps;
- assert.sameMembers(Object.keys(hds1), ['partition_alloc']);
-
- var partitionAllocDump1 = hds1['partition_alloc'];
- assert.strictEqual(partitionAllocDump1.processMemoryDump, pmd1);
- assert.equal(partitionAllocDump1.allocatorName, 'partition_alloc');
- var partitionAllocEntries1 = partitionAllocDump1.entries;
- assert.lengthOf(partitionAllocEntries1, 2);
- checkHeapEntry(partitionAllocEntries1[0], partitionAllocDump1, 4096,
- undefined /* root */,
- 'class v8::FunctionCallbackInfo<class v8::Value>');
- checkHeapEntry(partitionAllocEntries1[1], partitionAllocDump1, 2748,
- ['<self>', 'FrameView::layout', 'MessageLoop::RunTask'],
- undefined /* sum over all types */);
-
- // 2. Process 21, second dump.
- var pmd2 = p1.memoryDumps[1];
- var hds2 = pmd2.heapDumps;
- assert.sameMembers(Object.keys(hds2), ['partition_alloc']);
-
- var partitionAllocDump2 = hds2['partition_alloc'];
- assert.strictEqual(partitionAllocDump2.processMemoryDump, pmd2);
- assert.equal(partitionAllocDump2.allocatorName, 'partition_alloc');
- var partitionAllocEntries2 = partitionAllocDump2.entries;
- assert.lengthOf(partitionAllocEntries2, 3);
- checkHeapEntry(partitionAllocEntries2[0], partitionAllocDump2, 8192,
- undefined /* root */, undefined /* sum over all types */);
- checkHeapEntry(partitionAllocEntries2[1], partitionAllocDump2, 3567,
- ['<self>', 'FrameView::layout', 'MessageLoop::RunTask'],
- 'class v8::FunctionCallbackInfo<class v8::Value>');
- checkHeapEntry(partitionAllocEntries2[2], partitionAllocDump2, 4095,
- ['FrameView::layout', 'MessageLoop::RunTask'],
- undefined /* sum over all types */);
-
- // All heap dumps in Process 21 should use the same stack frames.
- assert.strictEqual(
- getFrame(partitionAllocEntries1[1], 0),
- getFrame(partitionAllocEntries2[1], 0));
- assert.strictEqual(
- getFrame(partitionAllocEntries2[2], 0),
- getFrame(partitionAllocEntries2[1], 1));
-
- // 3. Process 42.
- var pmd3 = p2.memoryDumps[0];
- var hds3 = pmd3.heapDumps;
- assert.sameMembers(Object.keys(hds3), ['partition_alloc', 'malloc']);
-
- var partitionAllocDump3 = hds3['partition_alloc'];
- assert.strictEqual(partitionAllocDump3.processMemoryDump, pmd3);
- assert.equal(partitionAllocDump3.allocatorName, 'partition_alloc');
- var partitionAllocEntries3 = partitionAllocDump3.entries;
- assert.lengthOf(partitionAllocEntries3, 7);
- checkHeapEntry(partitionAllocEntries3[0], partitionAllocDump3, 6086545,
- undefined /* root */, undefined /* sum over all types */);
- checkHeapEntry(partitionAllocEntries3[1], partitionAllocDump3, 3043272,
- undefined /* root */, 'blink::Event');
- checkHeapEntry(partitionAllocEntries3[2], partitionAllocDump3, 1521636,
- undefined /* root */, 'blink::ContextLifecycleObserver *');
- checkHeapEntry(partitionAllocEntries3[3], partitionAllocDump3, 5991638,
- ['<self>'], '[unknown]');
- checkHeapEntry(partitionAllocEntries3[4], partitionAllocDump3, 6384,
- ['<self>', 'UpdateLayoutTree', 'TimerBase::run',
- 'MessageLoop::RunTask'], undefined /* sum over all types */, 256);
- checkHeapEntry(partitionAllocEntries3[5], partitionAllocDump3, 3192,
- ['<self>', 'UpdateLayoutTree', 'TimerBase::run',
- 'MessageLoop::RunTask'], 'blink::WebFrame *');
- checkHeapEntry(partitionAllocEntries3[6], partitionAllocDump3, 58280,
- ['<self>', 'FunctionCall', 'ScheduledAction::execute', 'TimerBase::run',
- 'MessageLoop::RunTask'], undefined /* sum over all types */);
-
- var mallocDump3 = hds3['malloc'];
- assert.strictEqual(mallocDump3.processMemoryDump, pmd3);
- assert.equal(mallocDump3.allocatorName, 'malloc');
- var mallocEntries3 = mallocDump3.entries;
- assert.lengthOf(mallocEntries3, 4);
- checkHeapEntry(mallocEntries3[0], mallocDump3, 1929, undefined /* root */,
- undefined /* sum over all types */, 80);
- checkHeapEntry(mallocEntries3[1], mallocDump3, 291,
- ['<self>', 'MessageLoop::RunTask'], undefined /* sum over all types */,
- 96);
- checkHeapEntry(mallocEntries3[2], mallocDump3, 1110,
- ['<self>', 'MessageLoop::JogTask'], undefined /* sum over all types */,
- 112);
- checkHeapEntry(mallocEntries3[3], mallocDump3, 205,
- ['FunctionCall', 'ScheduledAction::execute', 'TimerBase::run',
- 'MessageLoop::RunTask'], 'blink::ContextLifecycleObserver *', 128);
-
- // All heap dumps in Process 42 should use the same stack frames.
- assert.strictEqual(
- getFrame(partitionAllocEntries3[5], 0),
- getFrame(partitionAllocEntries3[4], 0));
- assert.strictEqual(
- getFrame(partitionAllocEntries3[6], 3),
- getFrame(partitionAllocEntries3[4], 2));
- assert.strictEqual(
- getFrame(mallocEntries3[1], 1),
- getFrame(partitionAllocEntries3[4], 3));
- assert.strictEqual(
- getFrame(mallocEntries3[3], 0),
- getFrame(partitionAllocEntries3[6], 1));
-
- // 4. Process 63.
- var pmd4 = p3.memoryDumps[0];
- var hds4 = pmd4.heapDumps;
- assert.sameMembers(Object.keys(hds4), ['winheap']);
-
- var winheapDump = hds4['winheap'];
- assert.strictEqual(winheapDump.processMemoryDump, pmd4);
- assert.equal(winheapDump.allocatorName, 'winheap');
- var winheapEntries = winheapDump.entries;
- assert.lengthOf(winheapEntries, 1);
- checkHeapEntry(winheapEntries[0], winheapDump, 65536,
- undefined /* root */, undefined /* sum over all types */);
-
- // 5. Process 84.
- var pmd5 = p4.memoryDumps[0];
- var hds5 = pmd5.heapDumps;
- assert.sameMembers(Object.keys(hds5), ['malloc']);
-
- var mallocDump4 = hds5['malloc'];
- assert.strictEqual(mallocDump4.processMemoryDump, pmd5);
- assert.equal(mallocDump4.allocatorName, 'malloc');
- var mallocEntries4 = mallocDump4.entries;
- assert.lengthOf(mallocEntries4, 1);
- checkHeapEntry(mallocEntries4[0], mallocDump4, 43981,
- ['MessageLoop::WalkTask'], 'content::Manually');
- });
-
- test('importMemoryDumps_composableDumps', function() {
- // Split PMD1 over multiple PMD trace events, all of which should be merged
- // by the importer. Also inject some PMD trace events with different PIDs
- // or dump IDs, which should *not* be merged with the rest.
- var events = [
- { // Heap dumps.
- pid: 42,
- ts: 10000,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- level_of_detail: 'light',
- heaps: {
- partition_alloc: {
- entries: [
- { bt: '99', type: '888', size: '500' }
- ]
- }
- }
- }
- }
- },
- { // PMD2 with a different dump id (should not be merged).
- pid: 42,
- ts: 10003, // Same PID, so it will end up in the same process.
- ph: 'v',
- id: '0x0002',
- args: {
- dumps: {
- level_of_detail: 'detailed',
- allocators: {
- 'local1': {
- guid: '3',
- attrs: {
- A: {type: 'scalar', units: 'bytes', value: '0xBAD'}
- }
- },
- 'global/shared1': {
- guid: '4',
- attrs: {
- A: {type: 'string', units: '', value: 'brown'}
- }
- }
- },
- allocators_graph: [
- {
- source: '4',
- target: '3',
- type: 'ownership'
- }
- ]
- }
- }
- },
- { // Stack frames (required for heap dumps).
- pid: 42,
- ph: 'M',
- name: 'stackFrames',
- args: {
- stackFrames: {
- '99': { name: 'MessageLoop::RunTask' }
- }
- }
- },
- { // Allocator dumps.
- pid: 42,
- ts: 10001,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- level_of_detail: 'light',
- allocators: {
- 'local1': {
- guid: '3',
- attrs: {
- A: {type: 'string', units: '', value: 'blue'}
- }
- },
- 'global/shared1': {
- guid: '7',
- attrs: {
- A: {type: 'string', units: '', value: 'purple'}
- }
- },
- 'global/shared2': {
- guid: '8',
- attrs: {
- A: {type: 'string', units: '', value: 'cyan'}
- }
- }
- }
- }
- }
- },
- { // PMD3 with a different PID (should not be merged).
- pid: 68,
- ts: 9999,
- ph: 'v',
- id: '0x0001', // Same dump ID, so it will end up in the same GMD.
- args: {
- dumps: {
- process_mmaps: {
- vm_regions: [
- {
- sa: '350',
- sz: '250',
- pf: 5,
- mf: '/dev/ashmem/dalvik',
- bs: {
- pd: 'cd'
- }
- }
- ]
- }
- }
- }
- },
- { // VM regions.
- pid: 42,
- ts: 10005,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- level_of_detail: 'light',
- process_mmaps: {
- vm_regions: [
- {
- sa: 'f0',
- sz: '150',
- pf: 6,
- mf: '[stack:20310]',
- bs: {
- pss: '9e'
- }
- }
- ]
- }
- }
- }
- },
- { // Totals.
- pid: 42,
- ts: 10003,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- level_of_detail: 'light',
- process_totals: {
- resident_set_bytes: '100',
- private_bytes: '80' // OS-specific total.
- }
- }
- }
- },
- { // Allocator dump edges.
- pid: 42,
- ts: 10004,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- level_of_detail: 'light',
- allocators_graph: [
- {
- source: '4',
- target: '8',
- type: 'retention'
- }
- ]
- }
- }
- },
- { // Object type names (required for heap dumps).
- pid: 42,
- ph: 'M',
- name: 'typeNames',
- args: {
- typeNames: {
- // GCC.
- '888': 'const char* WTF::getStringWithTypeName() [with T = ' +
- 'cc::SurfaceFactory]'
- }
- }
- },
- { // Allocator dumps and dump edges (should be merged).
- pid: 42,
- ts: 10002,
- ph: 'v',
- id: '0x0001',
- args: {
- dumps: {
- level_of_detail: 'light',
- allocators: {
- 'local1': {
- guid: '3',
- attrs: {
- B: {type: 'string', units: '', value: 'red'}
- }
- },
- 'local2': {
- guid: '4',
- attrs: {
- B: {type: 'string', units: '', value: 'yellow'}
- }
- },
- 'global/shared1': {
- guid: '7',
- attrs: {
- B: {type: 'string', units: '', value: 'green'}
- }
- }
- },
- allocators_graph: [
- {
- source: '3',
- target: '7',
- type: 'ownership',
- importance: 1
- }
- ]
- }
- }
- }
- ];
- var m = makeModel(events, false);
-
- function checkDumpTime(dump, expectedStart, expectedDuration) {
- assert.closeTo(dump.start, expectedStart / 1000, 1e-5);
- assert.closeTo(dump.duration, expectedDuration / 1000, 1e-5);
- }
-
- function checkLinkCounts(allocatorDump, expectedHasOwns,
- expectedOwnedByCount, expectedRetainsCount, expectedRetainedByCount) {
- assert.strictEqual(allocatorDump.owns !== undefined, expectedHasOwns);
- assert.lengthOf(allocatorDump.ownedBy, expectedOwnedByCount);
- assert.lengthOf(allocatorDump.retains, expectedRetainsCount);
- assert.lengthOf(allocatorDump.retainedBy, expectedRetainedByCount);
- }
-
- // Check the overall structure of the model and memory dumps.
- assert.sameMembers(Object.keys(m.processes), ['42', '68']);
- assert.lengthOf(m.globalMemoryDumps, 2);
- var gmd1 = m.globalMemoryDumps[0];
- assert.strictEqual(gmd1.model, m);
- checkDumpTime(gmd1, 9999, 6);
- var gmd2 = m.globalMemoryDumps[1];
- assert.strictEqual(gmd2.model, m);
- checkDumpTime(gmd2, 10003, 0);
-
- var p1 = m.getProcess(42);
- assert.lengthOf(p1.memoryDumps, 2);
- var pmd1 = p1.memoryDumps[0];
- checkDumpTime(pmd1, 10000, 5);
- assert.strictEqual(pmd1.globalMemoryDump, gmd1);
- assert.strictEqual(pmd1.process, p1);
- var pmd2 = p1.memoryDumps[1];
- checkDumpTime(pmd2, 10003, 0);
- assert.strictEqual(pmd2.globalMemoryDump, gmd2);
- assert.strictEqual(pmd2.process, p1);
-
- var p2 = m.getProcess(68);
- assert.lengthOf(p2.memoryDumps, 1);
- var pmd3 = p2.memoryDumps[0];
- checkDumpTime(pmd3, 9999, 0);
- assert.strictEqual(pmd3.globalMemoryDump, gmd1);
- assert.strictEqual(pmd3.process, p2);
-
- assert.deepEqual(gmd1.processMemoryDumps, {42: pmd1, 68: pmd3});
- assert.deepEqual(gmd2.processMemoryDumps, {42: pmd2});
-
- // Check the composed dump.
- assert.strictEqual(pmd1.levelOfDetail, LIGHT);
-
- var totals = pmd1.totals;
- assert.strictEqual(totals.residentBytes, 256);
- assert.isUndefined(totals.peakResidentBytes);
- assert.isUndefined(totals.arePeakResidentBytesResettable);
- assert.deepEqual(totals.platformSpecific, {private_bytes: 128});
-
- var vmRegions = pmd1.vmRegions;
- checkVMRegions(vmRegions, [
- {
- mappedFile: '[stack:20310]',
- startAddress: 240,
- sizeInBytes: 336,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_WRITE,
- byteStats: {
- proportionalResident: 158
- }
- }
- ]);
-
- var memoryAllocatorDumps = pmd1.memoryAllocatorDumps;
- assert.lengthOf(memoryAllocatorDumps, 2);
-
- var local1Dump = pmd1.getMemoryAllocatorDumpByFullName('local1');
- assert.strictEqual(memoryAllocatorDumps[0], local1Dump);
- assert.strictEqual(local1Dump.fullName, 'local1');
- assert.isUndefined(local1Dump.parent);
- assert.lengthOf(local1Dump.children, 0);
- checkDumpNumericsAndDiagnostics(local1Dump, {},
- { 'A': 'blue', 'B': 'red' });
- checkLinkCounts(local1Dump, true /* owns */, 0 /* owned by */,
- 0 /* retains */, 0 /* retained by */);
-
- var local2Dump = pmd1.getMemoryAllocatorDumpByFullName('local2');
- assert.strictEqual(memoryAllocatorDumps[1], local2Dump);
- assert.strictEqual(local2Dump.fullName, 'local2');
- assert.isUndefined(local2Dump.parent);
- assert.lengthOf(local2Dump.children, 0);
- checkDumpNumericsAndDiagnostics(local2Dump, {}, { 'B': 'yellow' });
- checkLinkCounts(local2Dump, false /* owns */, 0 /* owned by */,
- 1 /* retains */, 0 /* retained by */);
-
- var heapDumps = pmd1.heapDumps;
- assert.sameMembers(Object.keys(heapDumps), ['partition_alloc']);
- var heapDump = heapDumps['partition_alloc'];
- assert.strictEqual(heapDump.processMemoryDump, pmd1);
- assert.strictEqual(heapDump.allocatorName, 'partition_alloc');
- var entries = heapDump.entries;
- assert.lengthOf(entries, 1);
- assert.strictEqual(entries[0].heapDump, heapDump);
- assert.strictEqual(entries[0].leafStackFrame.title, 'MessageLoop::RunTask');
- assert.strictEqual(entries[0].objectTypeName, 'cc::SurfaceFactory');
- assert.strictEqual(entries[0].size, 1280);
-
- // Check the other dumps.
- assert.strictEqual(pmd2.levelOfDetail, DETAILED);
- assert.isUndefined(pmd2.vmRegions);
- assert.lengthOf(pmd2.memoryAllocatorDumps, 1);
- var otherLocal1Dump = pmd2.getMemoryAllocatorDumpByFullName('local1');
- assert.strictEqual(otherLocal1Dump, pmd2.memoryAllocatorDumps[0]);
- assert.strictEqual(otherLocal1Dump.fullName, 'local1');
- assert.isUndefined(otherLocal1Dump.parent);
- checkDumpNumericsAndDiagnostics(otherLocal1Dump, { 'A': 2989 }, {});
- assert.isUndefined(pmd2.heapDumps);
- checkLinkCounts(otherLocal1Dump, false /* owns */, 1 /* owned by */,
- 0 /* retains */, 0 /* retained by */);
-
- assert.strictEqual(pmd3.levelOfDetail, DETAILED);
- var otherVmRegions = pmd3.vmRegions;
- checkVMRegions(otherVmRegions, [
- {
- mappedFile: '/dev/ashmem/dalvik',
- startAddress: 848,
- sizeInBytes: 592,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_EXECUTE,
- byteStats: {
- privateDirtyResident: 205
- }
- }
- ]);
- assert.lengthOf(pmd3.memoryAllocatorDumps, 0);
- assert.isUndefined(pmd3.heapDumps);
-
- // Check the global dumps.
- assert.lengthOf(gmd1.memoryAllocatorDumps, 2);
- var shared1Dump = gmd1.getMemoryAllocatorDumpByFullName('shared1');
- assert.strictEqual(shared1Dump, gmd1.memoryAllocatorDumps[0]);
- assert.strictEqual(shared1Dump.fullName, 'shared1');
- assert.isUndefined(shared1Dump.parent);
- checkDumpNumericsAndDiagnostics(shared1Dump, {},
- { 'A': 'purple', 'B': 'green' });
- checkLinkCounts(shared1Dump, false /* owns */, 1 /* owned by */,
- 0 /* retains */, 0 /* retained by */);
- var shared2Dump = gmd1.getMemoryAllocatorDumpByFullName('shared2');
- assert.strictEqual(shared2Dump, gmd1.memoryAllocatorDumps[1]);
- assert.strictEqual(shared2Dump.fullName, 'shared2');
- assert.isUndefined(shared2Dump.parent);
- checkDumpNumericsAndDiagnostics(shared2Dump, {}, { 'A': 'cyan' });
- checkLinkCounts(shared2Dump, false /* owns */, 0 /* owned by */,
- 0 /* retains */, 1 /* retained by */);
-
- assert.lengthOf(gmd2.memoryAllocatorDumps, 1);
- var otherShared1Dump = gmd2.getMemoryAllocatorDumpByFullName('shared1');
- assert.strictEqual(otherShared1Dump, gmd2.memoryAllocatorDumps[0]);
- assert.strictEqual(otherShared1Dump.fullName, 'shared1');
- assert.isUndefined(otherShared1Dump.parent);
- checkDumpNumericsAndDiagnostics(otherShared1Dump, {}, { 'A': 'brown' });
- checkLinkCounts(otherShared1Dump, true /* owns */, 0 /* owned by */,
- 0 /* retains */, 0 /* retained by */);
-
- // Check the edges.
- var ownershipLink = local1Dump.owns;
- assert.strictEqual(shared1Dump.ownedBy[0], ownershipLink);
- assert.strictEqual(ownershipLink.source, local1Dump);
- assert.strictEqual(ownershipLink.target, shared1Dump);
- assert.strictEqual(ownershipLink.importance, 1);
-
- var retentionLink = local2Dump.retains[0];
- assert.strictEqual(shared2Dump.retainedBy[0], retentionLink);
- assert.strictEqual(retentionLink.source, local2Dump);
- assert.strictEqual(retentionLink.target, shared2Dump);
- assert.isUndefined(retentionLink.importance);
-
- var otherOwnershipLink = otherShared1Dump.owns;
- assert.strictEqual(otherLocal1Dump.ownedBy[0], otherOwnershipLink);
- assert.strictEqual(otherOwnershipLink.source, otherShared1Dump);
- assert.strictEqual(otherOwnershipLink.target, otherLocal1Dump);
- assert.isUndefined(otherOwnershipLink.importance);
- });
-
- test('importThreadInstantSliceWithStackFrame', function() {
- var eventData = {
- traceEvents: [
- { name: 'a', args: {}, pid: 1, ts: 0, cat: 'baz', tid: 2, ph: 'I', s: 't', sf: 7 } // @suppress longLineCheck
- ],
- stackFrames: {
- '1': {
- category: 'm1',
- name: 'main'
- },
- '7': {
- category: 'm2',
- name: 'frame7',
- parent: '1'
- }
- }
- };
-
- var m = makeModel(eventData);
-
- var p = m.processes[1];
- var t = p.threads[2];
- assert.isDefined(t);
- assert.equal(t.sliceGroup.slices.length, 1);
-
- var s0 = t.sliceGroup.slices[0];
- assert.equal(s0.startStackFrame.title, 'frame7');
- assert.isUndefined(s0.endStackFrame);
- });
-
- test('importDurationEventsWithStackFrames', function() {
- var eventData = {
- traceEvents: [
- { name: 'a', args: {}, pid: 1, ts: 0, cat: 'baz', tid: 2, ph: 'B', sf: 7 }, // @suppress longLineCheck
- { name: 'b', args: {}, pid: 1, ts: 5, cat: 'baz', tid: 2, ph: 'E', sf: 8 } // @suppress longLineCheck
- ],
- stackFrames: {
- '1': {
- category: 'm1',
- name: 'main'
- },
- '7': {
- category: 'm2',
- name: 'frame7',
- parent: '1'
- },
- '8': {
- category: 'm2',
- name: 'frame8',
- parent: '1'
- }
- }
- };
-
- var m = makeModel(eventData);
-
- var p = m.processes[1];
- var t = p.threads[2];
- assert.isDefined(t);
- assert.equal(t.sliceGroup.slices.length, 1);
-
- var s0 = t.sliceGroup.slices[0];
- assert.equal(s0.startStackFrame.title, 'frame7');
- assert.equal(s0.endStackFrame.title, 'frame8');
- });
-
- test('annotationParsing', function() {
- var yComponents1 = [{stableId: '52.53', yPercentOffset: 0.5},
- {stableId: '52', yPercentOffset: 0.3}];
- var yComponents2 = [{stableId: '52.53', yPercentOffset: 0.7},
- {stableId: '52', yPercentOffset: 0.4}];
- var location1 = new tr.model.Location(0.1, yComponents1);
- var location2 = new tr.model.Location(0.2, yComponents2);
-
- var eventData = { traceEvents: [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'B'}],
- traceAnnotations: [
- {typeName: 'xmarker', args: {timestamp: 12}},
- {typeName: 'rect', args: {
- start: location1.toDict(), end: location2.toDict()}},
- {typeName: 'comment_box', args: {text: 'test',
- location: location1.toDict()}}
- ]};
-
- var m = makeModel(eventData);
- var annotations = m.getAllAnnotations();
- assert.equal(annotations.length, 3);
-
- assert.isTrue(annotations[0] instanceof tr.model.XMarkerAnnotation);
- assert.equal(annotations[0].timestamp, 12);
-
- assert.isTrue(annotations[1] instanceof tr.model.RectAnnotation);
- assert.deepEqual(annotations[1].startLocation, location1);
- assert.deepEqual(annotations[1].endLocation, location2);
-
- assert.isTrue(
- annotations[2] instanceof tr.model.CommentBoxAnnotation);
- assert.equal(annotations[2].text, 'test');
- assert.deepEqual(annotations[2].location, location1);
- });
-
- test('importDisplayTimeUnit', function() {
- var eventData = {
- traceEvents: [],
- displayTimeUnit: 'ns'
- };
- var m = makeModel(JSON.stringify(eventData));
- assert.equal(m.intrinsicTimeUnit, tr.v.TimeDisplayModes.ns);
- });
-
- test('extractBattorSubTraces', function() {
- var battorLog = '# BattOr\n# voltage range [0.000000, 7196.484161] mV\n' +
- '#current range [11.898481, 2110.900916] mA\n' +
- '# sample_rate=10000Hz, gain=30.257143x\n' +
- '# filpot_pos=3, amppot_pos=35, timer_ovf=399, timer_div=4 ovs_bits=0\n' + // @suppress longLineCheck
- '0.0 1040.3 3984.2\n' +
- '0.1 1081.3 3987.8\n' +
- '0.2 1092.6 3987.8\n' +
- '0.3 1070.0 3987.8\n' +
- '0.4 1017.7 3994.8\n';
-
- var eventData = {
- traceEvents: [
- { name: 'a', args: {}, pid: 1, ts: 0, cat: 'baz', tid: 2, ph: 'B', sf: 7 }, // @suppress longLineCheck
- { name: 'b', args: {}, pid: 1, ts: 5, cat: 'baz', tid: 2, ph: 'E', sf: 8 } // @suppress longLineCheck
- ],
- powerTraceAsString: battorLog
- };
-
- var m = makeModel(eventData);
- var importer = new tr.e.importer.TraceEventImporter(m, eventData);
- var subTraces = importer.extractSubtraces();
- assert.isTrue(subTraces instanceof Array);
- assert.equal(subTraces.length, 1);
- assert.equal(subTraces[0], battorLog);
- });
-
- test('metadataParsing', function() {
- var metadataValue = {value: {}};
- var eventData = {
- traceEvents: [
- { name: 'a', args: {}, pid: 1, ts: 0, cat: 'baz', tid: 2, ph: 'B', sf: 7 }, // @suppress longLineCheck
- { name: 'b', args: {}, pid: 1, ts: 5, cat: 'baz', tid: 2, ph: 'E', sf: 8 } // @suppress longLineCheck
- ],
- metadata: metadataValue
- };
-
- var m = makeModel(eventData);
- assert.isTrue(m.metadata instanceof Array);
- assert.equal(m.metadata.length, 1);
- assert.equal(m.metadata[0].name, 'metadata');
- assert.equal(m.metadata[0].value, metadataValue);
- });
-
- test('importTraceConfigAsMetadata', function() {
- var traceConfigData = {
- enable_argument_filter: false,
- enable_sampling: false,
- enable_systrace: false,
- record_mode: 'record-until-full'
- };
-
- var eventData = {
- traceEvents: [
- { name: 'TraceConfig', args: { value: traceConfigData },
- pid: 2, ts: 0, tid: 1, ph: 'M', cat: '__metadata' },
- ],
- };
-
- var m = makeModel(eventData);
- assert.isTrue(m.metadata instanceof Array);
- assert.equal(m.metadata.length, 1);
- assert.equal(m.metadata[0].name, 'TraceConfig');
- assert.equal(m.metadata[0].value, traceConfigData);
- });
-
- test('importMarks', function() {
- var eventData = {
- traceEvents: [
- { name: 'mark1', args: {}, pid: 1, tid: 2, ts: 0, tts: 0, cat: 'blink.user_timing', ph: 'R' }, // @suppress longLineCheck
- { name: 'mark2', args: {}, pid: 1, tid: 2, ts: 10, tts: 10, cat: 'blink.user_timing', ph: 'R' } // @suppress longLineCheck
- ]
- };
-
- var m = makeModel(eventData);
-
- var p = m.processes[1];
- var t = p.threads[2];
- assert.lengthOf(t.sliceGroup.slices, 2);
-
- var s0 = t.sliceGroup.slices[0];
- assert.equal(s0.title, 'mark1');
- assert.equal(s0.start, 0);
-
- var s1 = t.sliceGroup.slices[1];
- assert.equal(s1.title, 'mark2');
- assert.equal(s1.start, .01);
- });
-
- test('createNestableAsyncSlicesForUserTimingWithoutArgs', function() {
- /**
- * Structure of this async slices
- *
- * Group A:
- *
- * |__________|
- * a1
- *
- * Group B:
- *
- * |______________________________|
- * b1
- * |__________||_|
- * b2 b4
- * |_|
- * b3
- **/
- var events = [
- {
- name: 'A:a1',
- args: {params: ''},
- pid: 1,
- ts: 100,
- cat: 'blink.user_timing',
- tid: 2,
- id: 3,
- ph: 'b'
- },
- {
- name: 'A:a1',
- args: {params: ''},
- pid: 1,
- ts: 110,
- cat: 'blink.user_timing',
- tid: 2,
- id: 3,
- ph: 'e'
- },
- {
- name: 'B:b1',
- args: {params: ''},
- pid: 1,
- ts: 120,
- cat: 'blink.user_timing',
- tid: 2,
- id: 4,
- ph: 'b'
- },
- {
- name: 'B:b2',
- args: {params: ''},
- pid: 1,
- ts: 130,
- cat: 'blink.user_timing',
- tid: 2,
- id: 5,
- ph: 'b'
- },
- {
- name: 'B:b3',
- args: {params: ''},
- pid: 1,
- ts: 131,
- cat: 'blink.user_timing',
- tid: 2,
- id: 5,
- ph: 'b'
- },
- {
- name: 'B:b3',
- args: {params: ''},
- pid: 1,
- ts: 132,
- cat: 'blink.user_timing',
- tid: 2,
- id: 5,
- ph: 'e'
- },
- {
- name: 'B:b2',
- args: {params: ''},
- pid: 1,
- ts: 140,
- cat: 'blink.user_timing',
- tid: 2,
- id: 5,
- ph: 'e'
- },
- {
- name: 'B:b4',
- args: {params: ''},
- pid: 1,
- ts: 141,
- cat: 'blink.user_timing',
- tid: 2,
- id: 5,
- ph: 'b'
- },
- {
- name: 'B:b4',
- args: {params: ''},
- pid: 1,
- ts: 142,
- cat: 'blink.user_timing',
- tid: 2,
- id: 5,
- ph: 'e'
- },
- {
- name: 'B:b1',
- args: {params: ''},
- pid: 1,
- ts: 150,
- cat: 'blink.user_timing',
- tid: 2,
- id: 4,
- ph: 'e'
- }
- ];
-
- var m = makeModel(events);
- assert(m.numProcesses, 1);
- var p = m.processes[1];
- assert.isDefined(p);
- assert.equal(p.numThreads, 1);
- var t = p.threads[2];
- var asyncSliceGroup = t.asyncSliceGroup;
- assert.equal(asyncSliceGroup.length, 2);
- for (var i = 0; i < asyncSliceGroup.length; ++i) {
- assert.isTrue(asyncSliceGroup.slices[i] instanceof MeasureAsyncSlice);
- }
-
- var groupA = asyncSliceGroup.slices[0];
- assert.equal(groupA.viewSubGroupTitle, 'A');
- assert.equal(groupA.title, 'a1');
- assert.equal(groupA.subSlices.length, 0);
- var groupB = asyncSliceGroup.slices[1];
- assert.equal(groupB.viewSubGroupTitle, 'B');
- assert.equal(groupB.title, 'b1');
- assert.equal(groupB.subSlices.length, 2);
- var groupBSubSlice1 = groupB.subSlices[0];
- assert.equal(groupBSubSlice1.viewSubGroupTitle, 'B');
- assert.equal(groupBSubSlice1.title, 'b2');
- assert.equal(groupBSubSlice1.subSlices.length, 1);
- assert.equal(groupBSubSlice1.subSlices[0].viewSubGroupTitle, 'B');
- assert.equal(groupBSubSlice1.subSlices[0].title, 'b3');
- assert.equal(groupBSubSlice1.subSlices[0].subSlices.length, 0);
- var groupBSubSlice2 = groupB.subSlices[1];
- assert.equal(groupBSubSlice2.viewSubGroupTitle, 'B');
- assert.equal(groupBSubSlice2.title, 'b4');
- assert.equal(groupBSubSlice2.subSlices.length, 0);
- });
-
- test('createNestableAsyncSlicesForUserTimingWithArgs', function() {
- /**
- * Structure of this async slices
- *
- * Group A:
- *
- * |__________| |__________|
- * a1 a2
- *
- * a1.args = {a: 1}
- * a2.args = {a: 2, b: 2}
- **/
- var events = [
- {
- name: 'A:a1/eyJhIjoxfQ==',
- args: {params: ''},
- pid: 1,
- ts: 100,
- cat: 'blink.user_timing',
- tid: 2,
- id: 3,
- ph: 'b'
- },
- {
- name: 'A:a1/eyJhIjoxfQ==',
- args: {params: ''},
- pid: 1,
- ts: 110,
- cat: 'blink.user_timing',
- tid: 2,
- id: 3,
- ph: 'e'
- },
- {
- name: 'A:a2/eyJhIjoyLCJiIjoyfQ==',
- args: {params: ''},
- pid: 1,
- ts: 120,
- cat: 'blink.user_timing',
- tid: 2,
- id: 4,
- ph: 'b'
- },
- {
- name: 'A:a2/eyJhIjoyLCJiIjoyfQ==',
- args: {params: ''},
- pid: 1,
- ts: 130,
- cat: 'blink.user_timing',
- tid: 2,
- id: 4,
- ph: 'e'
- }
- ];
-
- var m = makeModel(events);
- assert(m.numProcesses, 1);
- var p = m.processes[1];
- assert.isDefined(p);
- assert.equal(p.numThreads, 1);
- var t = p.threads[2];
- var asyncSliceGroup = t.asyncSliceGroup;
- assert.equal(asyncSliceGroup.length, 2);
- for (var i = 0; i < asyncSliceGroup.length; ++i) {
- assert.isTrue(asyncSliceGroup.slices[i] instanceof MeasureAsyncSlice);
- }
-
- var a1 = asyncSliceGroup.slices[0];
- assert.equal(a1.viewSubGroupTitle, 'A');
- assert.equal(a1.title, 'a1');
- assert.equal(a1.subSlices.length, 0);
- assert.deepEqual(a1.args, {a: 1});
- var a2 = asyncSliceGroup.slices[1];
- assert.equal(a2.viewSubGroupTitle, 'A');
- assert.equal(a2.title, 'a2');
- assert.equal(a2.subSlices.length, 0);
- assert.deepEqual(a2.args, {a: 2, b: 2});
- });
-
- test('UserTimingAsyncSlicesWithNormalAsyncSlices', function() {
- /**
- * Structure of user timing async slices
- *
- * Group A:
- *
- * |__________|
- * a1
- * |__|
- * a2
- *
- * B
- * |__|
- * B
- * C
- * |_|
- * C
- **/
- var events = [
- {
- name: 'A:a1', args: {params: ''}, pid: 1, ts: 1,
- cat: 'blink.user_timing', tid: 2, id: 3, ph: 'b'
- },
- {
- name: 'A:a1', args: {params: ''}, pid: 1, ts: 11,
- cat: 'blink.user_timing', tid: 2, id: 3, ph: 'e'
- },
- {
- name: 'A:a2', args: {params: ''}, pid: 1, ts: 2,
- cat: 'blink.user_timing', tid: 2, id: 4, ph: 'b'
- },
- {
- name: 'A:a2', args: {params: ''}, pid: 1, ts: 4,
- cat: 'blink.user_timing', tid: 2, id: 4, ph: 'e'
- },
- {
- name: 'B', args: {}, pid: 1, ts: 9, cat: 'foo',
- tid: 2, ph: 'b', id: 5
- },
- {
- name: 'B', args: {}, pid: 1, ts: 11, cat: 'foo',
- tid: 2, ph: 'e', id: 5
- },
- {
- name: 'C', args: {}, pid: 1, ts: 12, cat: 'foo',
- tid: 2, ph: 'b', id: 6
- },
- {
- name: 'C', args: {}, pid: 1, ts: 13, cat: 'foo',
- tid: 2, ph: 'e', id: 6
- }
- ];
-
- var m = makeModel(events);
- assert(m.numProcesses, 1);
- var p = m.processes[1];
- assert.isDefined(p);
- assert.equal(p.numThreads, 1);
- var t = p.threads[2];
- var asyncSliceGroup = t.asyncSliceGroup;
- assert.equal(asyncSliceGroup.length, 3);
- assert.isTrue(asyncSliceGroup.slices[0] instanceof MeasureAsyncSlice);
- assert.isFalse(asyncSliceGroup.slices[1] instanceof MeasureAsyncSlice);
- assert.isFalse(asyncSliceGroup.slices[2] instanceof MeasureAsyncSlice);
-
- var a1 = asyncSliceGroup.slices[0];
- assert.equal(a1.viewSubGroupTitle, 'A');
- assert.equal(a1.title, 'a1');
- assert.equal(a1.subSlices.length, 1);
- var a2 = a1.subSlices[0];
- assert.equal(a2.viewSubGroupTitle, 'A');
- assert.equal(a2.title, 'a2');
- assert.equal(a2.subSlices.length, 0);
- var B = asyncSliceGroup.slices[1];
- assert.equal(B.viewSubGroupTitle, 'B');
- assert.equal(B.title, 'B');
- assert.equal(B.subSlices.length, 0);
- var C = asyncSliceGroup.slices[2];
- assert.equal(C.viewSubGroupTitle, 'C');
- assert.equal(C.title, 'C');
- assert.equal(C.subSlices.length, 0);
- });
-
- test('clockSync_requesterWithoutMetadata', function() {
- var events = [{
- name: 'clock_sync', args: {sync_id: 'abc', issue_ts: 5000},
- pid: 1, ts: 15000, cat: '__metadata', tid: 2, ph: 'c'
- }];
-
- var io = new tr.importer.ImportOptions();
- var m = new tr.Model();
- var i = new tr.importer.Import(m, io);
-
- m.clockSyncManager.addClockSyncMarker(
- ClockDomainId.LINUX_FTRACE_GLOBAL, 'abc', 15);
-
- i.importTraces([events]);
-
- // The clock sync happened in UNKNOWN_CHROME_LEGACY at 10ms and in
- // LINUX_FTRACE_GLOBAL at 15ms. The transformer should shift the ftrace
- // timestamps back by 5ms.
- assert.strictEqual(
- m.clockSyncManager.getModelTimeTransformer(
- ClockDomainId.UNKNOWN_CHROME_LEGACY)(5),
- 5);
- assert.strictEqual(
- m.clockSyncManager.getModelTimeTransformer(
- ClockDomainId.LINUX_FTRACE_GLOBAL)(15),
- 10);
- assert.isFalse(m.hasImportWarnings);
- });
-
- test('clockSync_requesterWithMetadata', function() {
- var events = {
- traceEvents: [{
- name: 'clock_sync', args: {sync_id: 'abc', issue_ts: 5},
- pid: 1, ts: 15, cat: '__metadata', tid: 2, ph: 'c'
- }],
- metadata: {
- 'clock-domain': ClockDomainId.BATTOR
- }
- };
-
- var m = makeModel(events);
-
- // Make sure that our clock domain was chosen as the model.
- assert.equal(
- m.clockSyncManager.getModelTimeTransformer(ClockDomainId.BATTOR)(.005),
- .005);
- assert.isFalse(m.hasImportWarnings);
- });
-
- test('clockSync_recipient', function() {
- var events = {
- traceEvents: [{
- name: 'clock_sync', args: {sync_id: 'abc'}, pid: 1, ts: 15000,
- cat: '__metadata', tid: 2, ph: 'c'
- }],
- metadata: {
- 'clock-domain': ClockDomainId.TELEMETRY
- }
- };
-
- var m = makeModel(events);
-
- m.clockSyncManager.addClockSyncMarker(
- ClockDomainId.LINUX_CLOCK_MONOTONIC, 'abc', 10);
-
- assert.equal(
- m.clockSyncManager.getModelTimeTransformer(
- ClockDomainId.TELEMETRY)(15),
- 10);
- assert.equal(
- m.clockSyncManager.getModelTimeTransformer(
- ClockDomainId.LINUX_CLOCK_MONOTONIC)(10),
- 10);
- });
-
- test('clockSync_missingSyncId', function() {
- var events = [{
- name: 'clock_sync', args: {issue_ts: 5},
- pid: 1, ts: 15, cat: '__metadata', tid: 2, ph: 'c'
- }];
-
- var m = makeModel(events);
-
- assert.isTrue(m.hasImportWarnings);
- });
-
- // TODO(nduca): one slice, two threads
- // TODO(nduca): one slice, two pids
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/codemap.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/codemap.html
deleted file mode 100644
index b7d80554373..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/codemap.html
+++ /dev/null
@@ -1,382 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/v8/splaytree.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Map addresses to dynamically created functions.
- */
-tr.exportTo('tr.e.importer.v8', function() {
- /**
- * Constructs a mapper that maps addresses into code entries.
- *
- * @constructor
- */
- function CodeMap() {
- /**
- * Dynamic code entries. Used for JIT compiled code.
- */
- this.dynamics_ = new tr.e.importer.v8.SplayTree();
-
- /**
- * Name generator for entries having duplicate names.
- */
- this.dynamicsNameGen_ = new tr.e.importer.v8.CodeMap.NameGenerator();
-
- /**
- * Static code entries. Used for statically compiled code.
- */
- this.statics_ = new tr.e.importer.v8.SplayTree();
-
- /**
- * Libraries entries. Used for the whole static code libraries.
- */
- this.libraries_ = new tr.e.importer.v8.SplayTree();
-
- /**
- * Map of memory pages occupied with static code.
- */
- this.pages_ = [];
- };
-
- /**
- * The number of alignment bits in a page address.
- */
- CodeMap.PAGE_ALIGNMENT = 12;
-
- /**
- * Page size in bytes.
- */
- CodeMap.PAGE_SIZE = 1 << CodeMap.PAGE_ALIGNMENT;
-
- /**
- * Adds a dynamic (i.e. moveable and discardable) code entry.
- *
- * @param {number} start The starting address.
- * @param {CodeMap.CodeEntry} codeEntry Code entry object.
- */
- CodeMap.prototype.addCode = function(start, codeEntry) {
- this.deleteAllCoveredNodes_(this.dynamics_, start, start + codeEntry.size);
- this.dynamics_.insert(start, codeEntry);
- };
-
- /**
- * Moves a dynamic code entry. Throws an exception if there is no dynamic
- * code entry with the specified starting address.
- *
- * @param {number} from The starting address of the entry being moved.
- * @param {number} to The destination address.
- */
- CodeMap.prototype.moveCode = function(from, to) {
- var removedNode = this.dynamics_.remove(from);
- this.deleteAllCoveredNodes_(this.dynamics_, to,
- to + removedNode.value.size);
- this.dynamics_.insert(to, removedNode.value);
- };
-
- /**
- * Discards a dynamic code entry. Throws an exception if there is no dynamic
- * code entry with the specified starting address.
- *
- * @param {number} start The starting address of the entry being deleted.
- */
- CodeMap.prototype.deleteCode = function(start) {
- var removedNode = this.dynamics_.remove(start);
- };
-
- /**
- * Adds a library entry.
- *
- * @param {number} start The starting address.
- * @param {CodeMap.CodeEntry} codeEntry Code entry object.
- */
- CodeMap.prototype.addLibrary = function(
- start, codeEntry) {
- this.markPages_(start, start + codeEntry.size);
- this.libraries_.insert(start, codeEntry);
- };
-
- /**
- * Adds a static code entry.
- *
- * @param {number} start The starting address.
- * @param {CodeMap.CodeEntry} codeEntry Code entry object.
- */
- CodeMap.prototype.addStaticCode = function(
- start, codeEntry) {
- this.statics_.insert(start, codeEntry);
- };
-
- /**
- * @private
- */
- CodeMap.prototype.markPages_ = function(start, end) {
- for (var addr = start; addr <= end;
- addr += CodeMap.PAGE_SIZE) {
- this.pages_[addr >>> CodeMap.PAGE_ALIGNMENT] = 1;
- }
- };
-
- /**
- * @private
- */
- CodeMap.prototype.deleteAllCoveredNodes_ = function(tree, start, end) {
- var to_delete = [];
- var addr = end - 1;
- while (addr >= start) {
- var node = tree.findGreatestLessThan(addr);
- if (!node) break;
- var start2 = node.key, end2 = start2 + node.value.size;
- if (start2 < end && start < end2) to_delete.push(start2);
- addr = start2 - 1;
- }
- for (var i = 0, l = to_delete.length; i < l; ++i) tree.remove(to_delete[i]);
- };
-
- /**
- * @private
- */
- CodeMap.prototype.isAddressBelongsTo_ = function(addr, node) {
- return addr >= node.key && addr < (node.key + node.value.size);
- };
-
- /**
- * @private
- */
- CodeMap.prototype.findInTree_ = function(tree, addr) {
- var node = tree.findGreatestLessThan(addr);
- return node && this.isAddressBelongsTo_(addr, node) ? node.value : null;
- };
-
- /**
- * Finds a code entry that contains the specified address in static libraries.
- *
- * @param {number} addr Address.
- */
- CodeMap.prototype.findEntryInLibraries = function(addr) {
- var pageAddr = addr >>> CodeMap.PAGE_ALIGNMENT;
- if (pageAddr in this.pages_)
- return this.findInTree_(this.libraries_, addr);
- return undefined;
- };
-
- /**
- * Finds a code entry that contains the specified address. Both static and
- * dynamic code entries are considered.
- *
- * @param {number} addr Address.
- */
- CodeMap.prototype.findEntry = function(addr) {
- var pageAddr = addr >>> CodeMap.PAGE_ALIGNMENT;
- if (pageAddr in this.pages_) {
- // Static code entries can contain "holes" of unnamed code.
- // In this case, the whole library is assigned to this address.
- return this.findInTree_(this.statics_, addr) ||
- this.findInTree_(this.libraries_, addr);
- }
- var min = this.dynamics_.findMin();
- var max = this.dynamics_.findMax();
- if (max != null && addr < (max.key + max.value.size) && addr >= min.key) {
- var dynaEntry = this.findInTree_(this.dynamics_, addr);
- if (dynaEntry == null) return null;
- // Dedupe entry name.
- if (!dynaEntry.nameUpdated_) {
- dynaEntry.name = this.dynamicsNameGen_.getName(dynaEntry.name);
- dynaEntry.nameUpdated_ = true;
- }
- return dynaEntry;
- }
- return null;
- };
-
- /**
- * Returns a dynamic code entry using its starting address.
- *
- * @param {number} addr Address.
- */
- CodeMap.prototype.findDynamicEntryByStartAddress =
- function(addr) {
- var node = this.dynamics_.find(addr);
- return node ? node.value : null;
- };
-
- /**
- * Returns an array of all dynamic code entries.
- */
- CodeMap.prototype.getAllDynamicEntries = function() {
- return this.dynamics_.exportValues();
- };
-
- /**
- * Returns an array of pairs of all dynamic code entries and their addresses.
- */
- CodeMap.prototype.getAllDynamicEntriesWithAddresses = function() {
- return this.dynamics_.exportKeysAndValues();
- };
-
- /**
- * Returns an array of all static code entries.
- */
- CodeMap.prototype.getAllStaticEntries = function() {
- return this.statics_.exportValues();
- };
-
- /**
- * Returns an array of all libraries entries.
- */
- CodeMap.prototype.getAllLibrariesEntries = function() {
- return this.libraries_.exportValues();
- };
-
- /**
- * Enum for code state regarding its dynamic optimization.
- *
- * @enum {number}
- */
- CodeMap.CodeState = {
- COMPILED: 0,
- OPTIMIZABLE: 1,
- OPTIMIZED: 2
- };
-
- /**
- * Creates a code entry object.
- *
- * @param {number} size Code entry size in bytes.
- * @param {string=} opt_name Code entry name.
- * @constructor
- */
- CodeMap.CodeEntry = function(size, opt_name, opt_type) {
- this.id = tr.b.GUID.allocateSimple();
- this.size = size;
- this.name_ = opt_name || '';
- this.type = opt_type || '';
- this.nameUpdated_ = false;
- };
-
- CodeMap.CodeEntry.prototype = {
- __proto__: Object.prototype,
-
- get name() {
- return this.name_;
- },
-
- set name(value) {
- this.name_ = value;
- },
-
- toString: function() {
- this.name_ + ': ' + this.size.toString(16);
- }
- };
-
- CodeMap.CodeEntry.TYPE = {
- SHARED_LIB: 'SHARED_LIB',
- CPP: 'CPP'
- };
-
- /**
- * Creates a dynamic code entry.
- *
- * @param {number} size Code size.
- * @param {string} type Code type.
- * @param {CodeMap.FunctionEntry} func Shared function entry.
- * @param {CodeMap.CodeState} state Code optimization state.
- * @constructor
- */
- CodeMap.DynamicFuncCodeEntry = function(size, type, func, state) {
- CodeMap.CodeEntry.call(this, size, '', type);
- this.func = func;
- this.state = state;
- };
-
- CodeMap.DynamicFuncCodeEntry.STATE_PREFIX = ['', '~', '*'];
-
- CodeMap.DynamicFuncCodeEntry.prototype = {
- __proto__: CodeMap.CodeEntry.prototype,
-
- /**
- * Returns node name.
- */
- get name() {
- return CodeMap.DynamicFuncCodeEntry.STATE_PREFIX[this.state] +
- this.func.name;
- },
-
- set name(value) {
- this.name_ = value;
- },
-
- /**
- * Returns raw node name (without type decoration).
- */
- getRawName: function() {
- return this.func.getName();
- },
-
- isJSFunction: function() {
- return true;
- },
-
- toString: function() {
- return this.type + ': ' + this.name + ': ' + this.size.toString(16);
- }
- };
-
- /**
- * Creates a shared function object entry.
- *
- * @param {string} name Function name.
- * @constructor
- */
- CodeMap.FunctionEntry = function(name) {
- CodeMap.CodeEntry.call(this, 0, name);
- };
-
- CodeMap.FunctionEntry.prototype = {
- __proto__: CodeMap.CodeEntry.prototype,
-
- /**
- * Returns node name.
- */
- get name() {
- var name = this.name_;
- if (name.length == 0) {
- name = '<anonymous>';
- } else if (name.charAt(0) == ' ') {
- // An anonymous function with location: " aaa.js:10".
- name = '<anonymous>' + name;
- }
- return name;
- },
-
- set name(value) {
- this.name_ = value;
- }
- };
-
- CodeMap.NameGenerator = function() {
- this.knownNames_ = {};
- };
-
- CodeMap.NameGenerator.prototype.getName = function(name) {
- if (!(name in this.knownNames_)) {
- this.knownNames_[name] = 0;
- return name;
- }
- var count = ++this.knownNames_[name];
- return name + ' {' + count + '}';
- };
- return {
- CodeMap: CodeMap
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/log_reader.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/log_reader.html
deleted file mode 100644
index 9b10ab69b96..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/log_reader.html
+++ /dev/null
@@ -1,213 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-/**
- * @fileoverview Log Reader is used to process log file produced by V8.
- */
-tr.exportTo('tr.e.importer.v8', function() {
- /**
- * Creates a CSV lines parser.
- */
- function CsvParser() { };
-
- /**
- * A regex for matching a CSV field.
- * @private
- */
- CsvParser.CSV_FIELD_RE_ = /^"((?:[^"]|"")*)"|([^,]*)/;
-
- /**
- * A regex for matching a double quote.
- * @private
- */
- CsvParser.DOUBLE_QUOTE_RE_ = /""/g;
-
- /**
- * Parses a line of CSV-encoded values. Returns an array of fields.
- *
- * @param {string} line Input line.
- */
- CsvParser.prototype.parseLine = function(line) {
- var fieldRe = CsvParser.CSV_FIELD_RE_;
- var doubleQuoteRe = CsvParser.DOUBLE_QUOTE_RE_;
- var pos = 0;
- var endPos = line.length;
- var fields = [];
- if (endPos > 0) {
- do {
- var fieldMatch = fieldRe.exec(line.substr(pos));
- if (typeof fieldMatch[1] === 'string') {
- var field = fieldMatch[1];
- pos += field.length + 3; // Skip comma and quotes.
- fields.push(field.replace(doubleQuoteRe, '"'));
- } else {
- // The second field pattern will match anything, thus
- // in the worst case the match will be an empty string.
- var field = fieldMatch[2];
- pos += field.length + 1; // Skip comma.
- fields.push(field);
- }
- } while (pos <= endPos);
- }
- return fields;
- };
-
- /**
- * Base class for processing log files.
- *
- * @param {Array.<Object>} dispatchTable A table used for parsing and
- * processing log records.
- *
- * @constructor
- */
- function LogReader(dispatchTable) {
- /**
- * @type {Array.<Object>}
- */
- this.dispatchTable_ = dispatchTable;
-
- /**
- * Current line.
- * @type {number}
- */
- this.lineNum_ = 0;
-
- /**
- * CSV lines parser.
- * @type {CsvParser}
- */
- this.csvParser_ = new CsvParser();
- };
-
- /**
- * Used for printing error messages.
- *
- * @param {string} str Error message.
- */
- LogReader.prototype.printError = function(str) {
- // Do nothing.
- };
-
- /**
- * Processes a portion of V8 profiler event log.
- *
- * @param {string} chunk A portion of log.
- */
- LogReader.prototype.processLogChunk = function(chunk) {
- this.processLog_(chunk.split('\n'));
- };
-
- /**
- * Processes a line of V8 profiler event log.
- *
- * @param {string} line A line of log.
- */
- LogReader.prototype.processLogLine = function(line) {
- this.processLog_([line]);
- };
-
- /**
- * Processes stack record.
- *
- * @param {number} pc Program counter.
- * @param {number} func JS Function.
- * @param {Array.<string>} stack String representation of a stack.
- * @return {Array.<number>} Processed stack.
- */
- LogReader.prototype.processStack = function(pc, func, stack) {
- var fullStack = func ? [pc, func] : [pc];
- var prevFrame = pc;
- for (var i = 0, n = stack.length; i < n; ++i) {
- var frame = stack[i];
- var firstChar = frame.charAt(0);
- if (firstChar == '+' || firstChar == '-') {
- // An offset from the previous frame.
- prevFrame += parseInt(frame, 16);
- fullStack.push(prevFrame);
- // Filter out possible 'overflow' string.
- } else if (firstChar != 'o') {
- fullStack.push(parseInt(frame, 16));
- }
- }
- return fullStack;
- };
-
- /**
- * Returns whether a particular dispatch must be skipped.
- *
- * @param {!Object} dispatch Dispatch record.
- * @return {boolean} True if dispatch must be skipped.
- */
- LogReader.prototype.skipDispatch = function(dispatch) {
- return false;
- };
-
- /**
- * Does a dispatch of a log record.
- *
- * @param {Array.<string>} fields Log record.
- * @private
- */
- LogReader.prototype.dispatchLogRow_ = function(fields) {
- // Obtain the dispatch.
- var command = fields[0];
- if (!(command in this.dispatchTable_)) return;
-
- var dispatch = this.dispatchTable_[command];
-
- if (dispatch === null || this.skipDispatch(dispatch)) {
- return;
- }
-
- // Parse fields.
- var parsedFields = [];
- for (var i = 0; i < dispatch.parsers.length; ++i) {
- var parser = dispatch.parsers[i];
- if (parser === null) {
- parsedFields.push(fields[1 + i]);
- } else if (typeof parser == 'function') {
- parsedFields.push(parser(fields[1 + i]));
- } else {
- // var-args
- parsedFields.push(fields.slice(1 + i));
- break;
- }
- }
-
- // Run the processor.
- dispatch.processor.apply(this, parsedFields);
- };
-
- /**
- * Processes log lines.
- *
- * @param {Array.<string>} lines Log lines.
- * @private
- */
- LogReader.prototype.processLog_ = function(lines) {
- for (var i = 0, n = lines.length; i < n; ++i, ++this.lineNum_) {
- var line = lines[i];
- if (!line) {
- continue;
- }
- try {
- var fields = this.csvParser_.parseLine(line);
- this.dispatchLogRow_(fields);
- } catch (e) {
- this.printError('line ' + (this.lineNum_ + 1) + ': ' +
- (e.message || e));
- }
- }
- };
- return {
- LogReader: LogReader
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/splaytree.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/splaytree.html
deleted file mode 100644
index 05f803765db..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/splaytree.html
+++ /dev/null
@@ -1,306 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-/**
- * @fileoverview Splay tree used by CodeMap.
- */
-tr.exportTo('tr.e.importer.v8', function() {
- /**
- * Constructs a Splay tree. A splay tree is a self-balancing binary
- * search tree with the additional property that recently accessed
- * elements are quick to access again. It performs basic operations
- * such as insertion, look-up and removal in O(log(n)) amortized time.
- *
- * @constructor
- */
- function SplayTree() { };
-
- /**
- * Pointer to the root node of the tree.
- *
- * @type {SplayTree.Node}
- * @private
- */
- SplayTree.prototype.root_ = null;
-
- /**
- * @return {boolean} Whether the tree is empty.
- */
- SplayTree.prototype.isEmpty = function() {
- return !this.root_;
- };
-
- /**
- * Inserts a node into the tree with the specified key and value if
- * the tree does not already contain a node with the specified key. If
- * the value is inserted, it becomes the root of the tree.
- *
- * @param {number} key Key to insert into the tree.
- * @param {*} value Value to insert into the tree.
- */
- SplayTree.prototype.insert = function(key, value) {
- if (this.isEmpty()) {
- this.root_ = new SplayTree.Node(key, value);
- return;
- }
- // Splay on the key to move the last node on the search path for
- // the key to the root of the tree.
- this.splay_(key);
- if (this.root_.key == key) {
- return;
- }
- var node = new SplayTree.Node(key, value);
- if (key > this.root_.key) {
- node.left = this.root_;
- node.right = this.root_.right;
- this.root_.right = null;
- } else {
- node.right = this.root_;
- node.left = this.root_.left;
- this.root_.left = null;
- }
- this.root_ = node;
- };
-
-
- /**
- * Removes a node with the specified key from the tree if the tree
- * contains a node with this key. The removed node is returned. If the
- * key is not found, an exception is thrown.
- *
- * @param {number} key Key to find and remove from the tree.
- * @return {SplayTree.Node} The removed node.
- */
- SplayTree.prototype.remove = function(key) {
- if (this.isEmpty()) {
- throw Error('Key not found: ' + key);
- }
- this.splay_(key);
- if (this.root_.key != key) {
- throw Error('Key not found: ' + key);
- }
- var removed = this.root_;
- if (!this.root_.left) {
- this.root_ = this.root_.right;
- } else {
- var right = this.root_.right;
- this.root_ = this.root_.left;
- // Splay to make sure that the new root has an empty right child.
- this.splay_(key);
- // Insert the original right child as the right child of the new
- // root.
- this.root_.right = right;
- }
- return removed;
- };
-
-
- /**
- * Returns the node having the specified key or null if the tree doesn't
- * contain a node with the specified key.
- *
- *
- * @param {number} key Key to find in the tree.
- * @return {SplayTree.Node} Node having the specified key.
- */
- SplayTree.prototype.find = function(key) {
- if (this.isEmpty()) {
- return null;
- }
- this.splay_(key);
- return this.root_.key == key ? this.root_ : null;
- };
-
- /**
- * @return {SplayTree.Node} Node having the minimum key value.
- */
- SplayTree.prototype.findMin = function() {
- if (this.isEmpty()) {
- return null;
- }
- var current = this.root_;
- while (current.left) {
- current = current.left;
- }
- return current;
- };
-
- /**
- * @return {SplayTree.Node} Node having the maximum key value.
- */
- SplayTree.prototype.findMax = function(opt_startNode) {
- if (this.isEmpty()) {
- return null;
- }
- var current = opt_startNode || this.root_;
- while (current.right) {
- current = current.right;
- }
- return current;
- };
-
- /**
- * @return {SplayTree.Node} Node having the maximum key value that
- * is less or equal to the specified key value.
- */
- SplayTree.prototype.findGreatestLessThan = function(key) {
- if (this.isEmpty()) {
- return null;
- }
- // Splay on the key to move the node with the given key or the last
- // node on the search path to the top of the tree.
- this.splay_(key);
- // Now the result is either the root node or the greatest node in
- // the left subtree.
- if (this.root_.key <= key) {
- return this.root_;
- } else if (this.root_.left) {
- return this.findMax(this.root_.left);
- } else {
- return null;
- }
- };
-
- /**
- * @return {Array<*>} An array containing all the values of tree's nodes
- * paired with keys.
- *
- */
- SplayTree.prototype.exportKeysAndValues = function() {
- var result = [];
- this.traverse_(function(node) { result.push([node.key, node.value]); });
- return result;
- };
-
- /**
- * @return {Array<*>} An array containing all the values of tree's nodes.
- */
- SplayTree.prototype.exportValues = function() {
- var result = [];
- this.traverse_(function(node) { result.push(node.value); });
- return result;
- };
-
- /**
- * Perform the splay operation for the given key. Moves the node with
- * the given key to the top of the tree. If no node has the given
- * key, the last node on the search path is moved to the top of the
- * tree. This is the simplified top-down splaying algorithm from:
- * "Self-adjusting Binary Search Trees" by Sleator and Tarjan
- *
- * @param {number} key Key to splay the tree on.
- * @private
- */
- SplayTree.prototype.splay_ = function(key) {
- if (this.isEmpty()) {
- return;
- }
- // Create a dummy node. The use of the dummy node is a bit
- // counter-intuitive: The right child of the dummy node will hold
- // the L tree of the algorithm. The left child of the dummy node
- // will hold the R tree of the algorithm. Using a dummy node, left
- // and right will always be nodes and we avoid special cases.
- var dummy, left, right;
- dummy = left = right = new SplayTree.Node(null, null);
- var current = this.root_;
- while (true) {
- if (key < current.key) {
- if (!current.left) {
- break;
- }
- if (key < current.left.key) {
- // Rotate right.
- var tmp = current.left;
- current.left = tmp.right;
- tmp.right = current;
- current = tmp;
- if (!current.left) {
- break;
- }
- }
- // Link right.
- right.left = current;
- right = current;
- current = current.left;
- } else if (key > current.key) {
- if (!current.right) {
- break;
- }
- if (key > current.right.key) {
- // Rotate left.
- var tmp = current.right;
- current.right = tmp.left;
- tmp.left = current;
- current = tmp;
- if (!current.right) {
- break;
- }
- }
- // Link left.
- left.right = current;
- left = current;
- current = current.right;
- } else {
- break;
- }
- }
- // Assemble.
- left.right = current.left;
- right.left = current.right;
- current.left = dummy.right;
- current.right = dummy.left;
- this.root_ = current;
- };
-
- /**
- * Performs a preorder traversal of the tree.
- *
- * @param {function(SplayTree.Node)} f Visitor function.
- * @private
- */
- SplayTree.prototype.traverse_ = function(f) {
- var nodesToVisit = [this.root_];
- while (nodesToVisit.length > 0) {
- var node = nodesToVisit.shift();
- if (node == null) {
- continue;
- }
- f(node);
- nodesToVisit.push(node.left);
- nodesToVisit.push(node.right);
- }
- };
-
- /**
- * Constructs a Splay tree node.
- *
- * @param {number} key Key.
- * @param {*} value Value.
- */
- SplayTree.Node = function(key, value) {
- this.key = key;
- this.value = value;
- };
-
- /**
- * @type {SplayTree.Node}
- */
- SplayTree.Node.prototype.left = null;
-
- /**
- * @type {SplayTree.Node}
- */
- SplayTree.Node.prototype.right = null;
-
- return {
- SplayTree: SplayTree
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/v8_log_importer.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/v8_log_importer.html
deleted file mode 100644
index 0fa1a9992c2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/v8_log_importer.html
+++ /dev/null
@@ -1,375 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/extras/importer/v8/codemap.html">
-<link rel="import" href="/tracing/extras/importer/v8/log_reader.html">
-<link rel="import" href="/tracing/importer/importer.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/slice.html">
-
-<script>
-
-'use strict';
-
-/**
- * @fileoverview V8LogImporter imports v8.log files into the provided model.
- */
-tr.exportTo('tr.e.importer.v8', function() {
- var CodeEntry = tr.e.importer.v8.CodeMap.CodeEntry;
- var CodeMap = tr.e.importer.v8.CodeMap;
- var ColorScheme = tr.b.ColorScheme;
- var DynamicFuncCodeEntry = tr.e.importer.v8.CodeMap.DynamicFuncCodeEntry;
- var FunctionEntry = tr.e.importer.v8.CodeMap.FunctionEntry;
-
- function V8LogImporter(model, eventData) {
- this.importPriority = 3;
- this.model_ = model;
-
- this.logData_ = eventData;
-
- this.code_map_ = new CodeMap();
- this.v8_timer_thread_ = undefined;
- this.v8_thread_ = undefined;
-
- this.root_stack_frame_ = new tr.model.StackFrame(
- undefined, 'v8-root-stack-frame', 'v8-root-stack-frame', 0);
-
- // We reconstruct the stack timeline from ticks.
- this.v8_stack_timeline_ = new Array();
- }
-
- var kV8BinarySuffixes = ['/d8', '/libv8.so'];
-
-
- var TimerEventDefaultArgs = {
- 'V8.Execute': { pause: false, no_execution: false},
- 'V8.External': { pause: false, no_execution: true},
- 'V8.CompileFullCode': { pause: true, no_execution: true},
- 'V8.RecompileSynchronous': { pause: true, no_execution: true},
- 'V8.RecompileParallel': { pause: false, no_execution: false},
- 'V8.CompileEval': { pause: true, no_execution: true},
- 'V8.Parse': { pause: true, no_execution: true},
- 'V8.PreParse': { pause: true, no_execution: true},
- 'V8.ParseLazy': { pause: true, no_execution: true},
- 'V8.GCScavenger': { pause: true, no_execution: true},
- 'V8.GCCompactor': { pause: true, no_execution: true},
- 'V8.GCContext': { pause: true, no_execution: true}
- };
-
- /**
- * @return {boolean} Whether obj is a V8 log string.
- */
- V8LogImporter.canImport = function(eventData) {
- if (typeof(eventData) !== 'string' && !(eventData instanceof String))
- return false;
-
- return eventData.substring(0, 11) == 'v8-version,' ||
- eventData.substring(0, 12) == 'timer-event,' ||
- eventData.substring(0, 5) == 'tick,' ||
- eventData.substring(0, 15) == 'shared-library,' ||
- eventData.substring(0, 9) == 'profiler,' ||
- eventData.substring(0, 14) == 'code-creation,';
- };
-
- V8LogImporter.prototype = {
-
- __proto__: tr.importer.Importer.prototype,
-
- get importerName() {
- return 'V8LogImporter';
- },
-
- processTimerEvent_: function(name, start, length) {
- var args = TimerEventDefaultArgs[name];
- if (args === undefined) return;
- start /= 1000; // Convert to milliseconds.
- length /= 1000;
- var colorId = ColorScheme.getColorIdForGeneralPurposeString(name);
- var slice = new tr.model.Slice('v8', name, colorId, start,
- args, length);
- this.v8_timer_thread_.sliceGroup.pushSlice(slice);
- },
-
- processTimerEventStart_: function(name, start) {
- var args = TimerEventDefaultArgs[name];
- if (args === undefined) return;
- start /= 1000; // Convert to milliseconds.
- this.v8_timer_thread_.sliceGroup.beginSlice('v8', name, start, args);
- },
-
- processTimerEventEnd_: function(name, end) {
- end /= 1000; // Convert to milliseconds.
- this.v8_timer_thread_.sliceGroup.endSlice(end);
- },
-
- processCodeCreateEvent_: function(type, kind, address, size, name,
- maybe_func) {
- function parseState(s) {
- switch (s) {
- case '': return CodeMap.CodeState.COMPILED;
- case '~': return CodeMap.CodeState.OPTIMIZABLE;
- case '*': return CodeMap.CodeState.OPTIMIZED;
- }
- throw new Error('unknown code state: ' + s);
- }
-
- if (maybe_func.length) {
- var funcAddr = parseInt(maybe_func[0]);
- var state = parseState(maybe_func[1]);
- var func = this.code_map_.findDynamicEntryByStartAddress(funcAddr);
- if (!func) {
- func = new FunctionEntry(name);
- func.kind = kind;
- this.code_map_.addCode(funcAddr, func);
- } else if (func.name !== name) {
- // Function object has been overwritten with a new one.
- func.name = name;
- }
- var entry = this.code_map_.findDynamicEntryByStartAddress(address);
- if (entry) {
- if (entry.size === size && entry.func === func) {
- // Entry state has changed.
- entry.state = state;
- }
- } else {
- entry = new DynamicFuncCodeEntry(size, type, func, state);
- entry.kind = kind;
- this.code_map_.addCode(address, entry);
- }
- } else {
- var code_entry = new CodeEntry(size, name);
- code_entry.kind = kind;
- this.code_map_.addCode(address, code_entry);
- }
- },
-
- processCodeMoveEvent_: function(from, to) {
- this.code_map_.moveCode(from, to);
- },
-
- processCodeDeleteEvent_: function(address) {
- this.code_map_.deleteCode(address);
- },
-
- processSharedLibrary_: function(name, start, end) {
- var code_entry = new CodeEntry(end - start, name,
- CodeEntry.TYPE.SHARED_LIB);
- code_entry.kind = -3; // External code kind.
- for (var i = 0; i < kV8BinarySuffixes.length; i++) {
- var suffix = kV8BinarySuffixes[i];
- if (name.indexOf(suffix, name.length - suffix.length) >= 0) {
- code_entry.kind = -1; // V8 runtime code kind.
- break;
- }
- }
- this.code_map_.addLibrary(start, code_entry);
- },
-
- processCppSymbol_: function(address, size, name) {
- var code_entry = new CodeEntry(size, name, CodeEntry.TYPE.CPP);
- code_entry.kind = -1;
- this.code_map_.addStaticCode(address, code_entry);
- },
-
- processTickEvent_: function(pc, start, is_external_callback,
- tos_or_external_callback, vmstate, stack) {
- start /= 1000;
-
- function findChildWithEntryID(stackFrame, entryID) {
- for (var i = 0; i < stackFrame.children.length; i++) {
- if (stackFrame.children[i].entryID == entryID)
- return stackFrame.children[i];
- }
- return undefined;
- }
-
- function processStack(pc, func, stack) {
- var fullStack = func ? [pc, func] : [pc];
- var prevFrame = pc;
- for (var i = 0, n = stack.length; i < n; ++i) {
- var frame = stack[i];
- var firstChar = frame.charAt(0);
- if (firstChar === '+' || firstChar === '-') {
- // An offset from the previous frame.
- prevFrame += parseInt(frame, 16);
- fullStack.push(prevFrame);
- // Filter out possible 'overflow' string.
- } else if (firstChar !== 'o') {
- fullStack.push(parseInt(frame, 16));
- }
- // Otherwise, they will be skipped.
- }
- return fullStack;
- }
-
- if (is_external_callback) {
- // Don't use PC when in external callback code, as it can point
- // inside callback's code, and we will erroneously report
- // that a callback calls itself. Instead use tos_or_external_callback,
- // as simply resetting PC will produce unaccounted ticks.
- pc = tos_or_external_callback;
- tos_or_external_callback = 0;
- } else if (tos_or_external_callback) {
- // Find out, if top of stack was pointing inside a JS function
- // meaning that we have encountered a frameless invocation.
- var funcEntry = this.code_map_.findEntry(tos_or_external_callback);
- if (!funcEntry || !funcEntry.isJSFunction || !funcEntry.isJSFunction())
- tos_or_external_callback = 0;
- }
-
- var processedStack = processStack(pc, tos_or_external_callback, stack);
- var lastStackFrame = this.root_stack_frame_;
- // v8 log stacks are inverted, leaf first and the root at the end.
- processedStack = processedStack.reverse();
- for (var i = 0, n = processedStack.length; i < n; i++) {
- var frame = processedStack[i];
- if (!frame)
- break;
- var entry = this.code_map_.findEntry(frame);
-
- if (!entry && i !== 0) {
- continue;
- }
-
- var sourceInfo = undefined;
- if (entry && entry.type === CodeEntry.TYPE.CPP) {
- var libEntry = this.code_map_.findEntryInLibraries(frame);
- if (libEntry)
- sourceInfo = libEntry.name;
- }
-
- var entryID = entry ? entry.id : 'Unknown';
- var childFrame = findChildWithEntryID(lastStackFrame, entryID);
- if (childFrame === undefined) {
- var entryName = entry ? entry.name : 'Unknown';
- lastStackFrame = new tr.model.StackFrame(
- lastStackFrame, 'v8sf-' + tr.b.GUID.allocateSimple(), entryName,
- ColorScheme.getColorIdForGeneralPurposeString(entryName),
- sourceInfo);
- lastStackFrame.entryID = entryID;
- this.model_.addStackFrame(lastStackFrame);
- } else {
- lastStackFrame = childFrame;
- }
- }
-
- if (lastStackFrame !== this.root_stack_frame_) {
- var sample = new tr.model.Sample(
- undefined, this.v8_thread_, 'V8 PC',
- start, lastStackFrame, 1);
- this.model_.samples.push(sample);
- }
- },
-
- processDistortion_: function(distortion_in_picoseconds) {
- // Do nothing.
- },
-
- processPlotRange_: function(start, end) {
- // Do nothing.
- },
-
- processV8Version_: function(major, minor, build, patch, candidate) {
- // Do nothing.
- },
-
- /**
- * Walks through the events_ list and outputs the structures discovered to
- * model_.
- */
- importEvents: function() {
- var logreader = new tr.e.importer.v8.LogReader(
- { 'timer-event' : {
- parsers: [null, parseInt, parseInt],
- processor: this.processTimerEvent_.bind(this)
- },
- 'shared-library': {
- parsers: [null, parseInt, parseInt],
- processor: this.processSharedLibrary_.bind(this)
- },
- 'timer-event-start' : {
- parsers: [null, parseInt],
- processor: this.processTimerEventStart_.bind(this)
- },
- 'timer-event-end' : {
- parsers: [null, parseInt],
- processor: this.processTimerEventEnd_.bind(this)
- },
- 'code-creation': {
- parsers: [null, parseInt, parseInt, parseInt, null, 'var-args'],
- processor: this.processCodeCreateEvent_.bind(this)
- },
- 'code-move': {
- parsers: [parseInt, parseInt],
- processor: this.processCodeMoveEvent_.bind(this)
- },
- 'code-delete': {
- parsers: [parseInt],
- processor: this.processCodeDeleteEvent_.bind(this)
- },
- 'cpp': {
- parsers: [parseInt, parseInt, null],
- processor: this.processCppSymbol_.bind(this)
- },
- 'tick': {
- parsers: [parseInt, parseInt, parseInt, parseInt, parseInt,
- 'var-args'],
- processor: this.processTickEvent_.bind(this)
- },
- 'distortion': {
- parsers: [parseInt],
- processor: this.processDistortion_.bind(this)
- },
- 'plot-range': {
- parsers: [parseInt, parseInt],
- processor: this.processPlotRange_.bind(this)
- },
- 'v8-version': {
- parsers: [parseInt, parseInt, parseInt, parseInt, parseInt],
- processor: this.processV8Version_.bind(this)
- }
- });
-
- this.v8_timer_thread_ =
- this.model_.getOrCreateProcess(-32).getOrCreateThread(1);
- this.v8_timer_thread_.name = 'V8 Timers';
- this.v8_thread_ =
- this.model_.getOrCreateProcess(-32).getOrCreateThread(2);
- this.v8_thread_.name = 'V8';
-
- var lines = this.logData_.split('\n');
- for (var i = 0; i < lines.length; i++) {
- logreader.processLogLine(lines[i]);
- }
-
- // The processing of samples adds all the root stack frame to
- // this.root_stack_frame_. But, we don't want that stack frame in the real
- // model. So get rid of it.
- this.root_stack_frame_.removeAllChildren();
-
- function addSlices(slices, thread) {
- for (var i = 0; i < slices.length; i++) {
- var duration = slices[i].end - slices[i].start;
- var slice = new tr.model.Slice('v8', slices[i].name,
- ColorScheme.getColorIdForGeneralPurposeString(slices[i].name),
- slices[i].start, {}, duration);
- thread.sliceGroup.pushSlice(slice);
- addSlices(slices[i].children, thread);
- }
- }
- addSlices(this.v8_stack_timeline_, this.v8_thread_);
- }
- };
-
- tr.importer.Importer.register(V8LogImporter);
-
- return {
- V8LogImporter: V8LogImporter
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/v8_log_importer_test.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/v8_log_importer_test.html
deleted file mode 100644
index fdbe447ca60..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/v8/v8_log_importer_test.html
+++ /dev/null
@@ -1,305 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/v8/v8_log_importer.html">
-
-<script>
-
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var V8LogImporter = tr.e.importer.v8.V8LogImporter;
-
- function newModel(events) {
- return tr.c.TestUtils.newModelWithEvents([events], {
- shiftWorldToZero: false
- });
- }
-
- test('tickEventInSharedLibrary', function() {
- var lines = [
- 'shared-library,"/usr/lib/libc++.1.dylib",0x99d8aae0,0x99dce729',
- 'tick,0x99d8aae4,12158,0,0x0,5'];
- var m = newModel(lines.join('\n'));
- var p = m.processes[-32];
- var t = p.findAllThreadsNamed('V8')[0];
- assert.equal(t.samples.length, 1);
- assert.equal(t.samples[0].title, 'V8 PC');
- assert.equal(t.samples[0].start, 12158 / 1000);
- assert.equal(t.samples[0].leafStackFrame.title, '/usr/lib/libc++.1.dylib');
- });
-
- test('tickEventInGeneratedCode', function() {
- var lines = [
- 'shared-library,"/usr/lib/libc++.1.dylib",0x99d8aae0,0x99dce729',
- 'code-creation,Stub,2,0x5b60ce80,1259,"StringAddStub"',
- 'tick,0x5b60ce84,12158,0,0x0,5'];
- var m = newModel(lines.join('\n'));
- var p = m.processes[-32];
- var threads = p.findAllThreadsNamed('V8');
- var t = threads[0];
- assert.equal(t.samples.length, 1);
- assert.equal(t.samples[0].leafStackFrame.title, 'StringAddStub');
- });
-
- test('tickEventInUknownCode', function() {
- var lines = [
- 'shared-library,"/usr/lib/libc++.1.dylib",0x99d8aae0,0x99dce729',
- 'code-creation,Stub,2,0x5b60ce80,1259,"StringAddStub"',
- 'tick,0x4,0xbff02f08,12158,0,0x0,5'];
- var m = newModel(lines.join('\n'));
- var p = m.processes[-32];
- var threads = p.findAllThreadsNamed('V8');
- var t = threads[0];
- assert.equal(t.samples.length, 1);
- assert.equal(t.samples[0].leafStackFrame.title, 'Unknown');
- });
-
- test('tickEventWithStack', function() {
- var lines = [
- 'code-creation,LazyCompile,0,0x2905d0c0,1800,"InstantiateFunction native apinatives.js:26:29",0x56b19124,', // @suppress longLineCheck
- 'tick,0x7fc6fe34,528674,0,0x3,0,0x2905d304'];
- var m = newModel(lines.join('\n'));
- var p = m.processes[-32];
- var t = p.findAllThreadsNamed('V8')[0];
- assert.equal(t.samples.length, 1);
- assert.deepEqual(
- ['InstantiateFunction native apinatives.js:26:29'],
- t.samples[0].getUserFriendlyStackTrace());
- });
-
- test('twoTickEventsWithStack', function() {
- var lines = [
- 'code-creation,LazyCompile,0,0x2905d0c0,1800,"InstantiateFunction native apinatives.js:26:29",0x56b19124,', // @suppress longLineCheck
- 'tick,0x7fc6fe34,528674,0,0x3,0,0x2905d304',
- 'tick,0x7fd2a534,536213,0,0x81d8d080,0,0x2905d304'];
- var m = newModel(lines.join('\n'));
- var p = m.processes[-32];
- var t = p.findAllThreadsNamed('V8')[0];
- assert.equal(t.samples.length, 2);
- assert.equal(t.samples[0].start, 528674 / 1000);
- assert.equal(t.samples[1].start, 536213 / 1000);
- assert.deepEqual(
- ['InstantiateFunction native apinatives.js:26:29'],
- t.samples[0].getUserFriendlyStackTrace());
- assert.deepEqual(
- ['InstantiateFunction native apinatives.js:26:29'],
- t.samples[1].getUserFriendlyStackTrace());
- assert.equal(t.samples[0].leafStackFrame,
- t.samples[1].leafStackFrame);
- });
-
- test('twoTickEventsWithTwoStackFrames', function() {
- var lines = [
- 'code-creation,LazyCompile,0,0x2904d560,876,"Instantiate native apinatives.js:9:21",0x56b190c8,~', // @suppress longLineCheck
- 'code-creation,LazyCompile,0,0x2905d0c0,1800,"InstantiateFunction native apinatives.js:26:29",0x56b19124,', // @suppress longLineCheck
- 'tick,0x7fc6fe34,528674,0,0x3,0,0x2905d304,0x2904d6e8',
- 'tick,0x7fd2a534,536213,0,0x81d8d080,0,0x2905d304,0x2904d6e8'];
- var m = newModel(lines.join('\n'));
- var p = m.processes[-32];
- var t = p.findAllThreadsNamed('V8')[0];
- assert.equal(t.samples.length, 2);
-
- assert.equal(t.samples[0].start, 528674 / 1000);
- assert.equal(t.samples[1].start, 536213 / 1000);
- assert.deepEqual(
- ['InstantiateFunction native apinatives.js:26:29',
- '~Instantiate native apinatives.js:9:21'],
- t.samples[0].getUserFriendlyStackTrace());
- assert.deepEqual(
- ['InstantiateFunction native apinatives.js:26:29',
- '~Instantiate native apinatives.js:9:21'],
- t.samples[1].getUserFriendlyStackTrace());
-
- var childStackFrame = t.samples[0].leafStackFrame;
- assert.equal(childStackFrame, t.samples[1].leafStackFrame);
- assert.equal(childStackFrame.children.length, 0);
-
- var parentStackFrame = childStackFrame.parentFrame;
- assert.equal(parentStackFrame.children.length, 1);
- assert.equal(childStackFrame, parentStackFrame.children[0]);
-
- });
-
- test('threeTickEventsWithTwoStackFrames', function() {
- var lines = [
- 'code-creation,LazyCompile,0,0x2904d560,876,"Instantiate native apinatives.js:9:21",0x56b190c8,~', // @suppress longLineCheck
- 'code-creation,LazyCompile,0,0x2905d0c0,1800,"InstantiateFunction native apinatives.js:26:29",0x56b19124,', // @suppress longLineCheck
- 'tick,0x7fd7f75c,518328,0,0x81d86da8,2,0x2904d6e8',
- 'tick,0x7fc6fe34,528674,0,0x3,0,0x2905d304,0x2904d6e8',
- 'tick,0x7fd2a534,536213,0,0x81d8d080,0,0x2905d304,0x2904d6e8'];
- var m = newModel(lines.join('\n'));
- var p = m.processes[-32];
- var threads = p.findAllThreadsNamed('V8');
-
- var t = threads[0];
- assert.equal(t.samples.length, 3);
- assert.equal(t.samples[0].start, 518328 / 1000);
- assert.equal(t.samples[1].start, 528674 / 1000);
- assert.equal(t.samples[2].start, 536213 / 1000);
- assert.deepEqual(
- ['~Instantiate native apinatives.js:9:21'],
- t.samples[0].getUserFriendlyStackTrace());
- assert.deepEqual(
- ['InstantiateFunction native apinatives.js:26:29',
- '~Instantiate native apinatives.js:9:21'],
- t.samples[1].getUserFriendlyStackTrace());
- assert.deepEqual(
- ['InstantiateFunction native apinatives.js:26:29',
- '~Instantiate native apinatives.js:9:21'],
- t.samples[2].getUserFriendlyStackTrace());
-
- var topLevelStackFrame = t.samples[0].leafStackFrame;
- var childStackFrame = t.samples[1].leafStackFrame;
- assert.equal(t.samples[2].leafStackFrame, childStackFrame);
- assert.equal(topLevelStackFrame, childStackFrame.parentFrame);
- assert.equal(topLevelStackFrame.children.length, 1);
- assert.equal(childStackFrame.children.length, 0);
- assert.equal(childStackFrame, topLevelStackFrame.children[0]);
- });
-
- test('twoSubStacks', function() {
- var lines = [
- 'code-creation,LazyCompile,0,0x2904d560,876,"Instantiate native apinatives.js:9:21",0x56b190c8,~', // @suppress longLineCheck
- 'code-creation,LazyCompile,0,0x2905d0c0,1800,"InstantiateFunction native apinatives.js:26:29",0x56b19124,', // @suppress longLineCheck
- 'tick,0x7fd7f75c,518328,0,0x81d86da8,2,0x2904d6e8',
- 'tick,0x7fc6fe34,528674,0,0x3,0,0x2905d304,0x2904d6e8',
- 'tick,0x7fd2a534,536213,0,0x81d8d080,0,0x2905d304,0x2904d6e8',
- 'code-creation,Script,0,0x2906a7c0,792,"http://www.google.com/",0x5b12fe50,~', // @suppress longLineCheck
- 'tick,0xb6f51d30,794049,0,0xb6f7b368,2,0x2906a914',
- 'tick,0xb6f51d30,799146,0,0xb6f7b368,0,0x2906a914'
- ];
- var m = newModel(lines.join('\n'));
- var p = m.processes[-32];
- var threads = p.findAllThreadsNamed('V8');
- var t = threads[0];
- assert.equal(t.samples.length, 5);
-
- assert.equal(t.samples[0].start, 518328 / 1000);
- assert.equal(t.samples[1].start, 528674 / 1000);
- assert.equal(t.samples[2].start, 536213 / 1000);
- assert.equal(t.samples[3].start, 794049 / 1000);
- assert.equal(t.samples[4].start, 799146 / 1000);
-
- assert.deepEqual(
- ['~Instantiate native apinatives.js:9:21'],
- t.samples[0].getUserFriendlyStackTrace());
- assert.deepEqual(
- ['InstantiateFunction native apinatives.js:26:29',
- '~Instantiate native apinatives.js:9:21'],
- t.samples[1].getUserFriendlyStackTrace());
- assert.deepEqual(
- ['InstantiateFunction native apinatives.js:26:29',
- '~Instantiate native apinatives.js:9:21'],
- t.samples[2].getUserFriendlyStackTrace());
- assert.deepEqual(['~http://www.google.com/'],
- t.samples[3].getUserFriendlyStackTrace());
- assert.deepEqual(['~http://www.google.com/'],
- t.samples[4].getUserFriendlyStackTrace());
-
- var firsStackTopLevelStackFrame = t.samples[0].leafStackFrame;
- var firsStackChildStackFrame = t.samples[1].leafStackFrame;
- assert.equal(firsStackChildStackFrame, t.samples[2].leafStackFrame);
- assert.equal(firsStackTopLevelStackFrame,
- firsStackChildStackFrame.parentFrame);
- assert.equal(firsStackTopLevelStackFrame.children.length, 1);
- assert.equal(firsStackChildStackFrame.children.length, 0);
- assert.equal(firsStackChildStackFrame,
- firsStackTopLevelStackFrame.children[0]);
-
- var secondStackStackFrame = t.samples[3].leafStackFrame;
- assert.equal(secondStackStackFrame, t.samples[4].leafStackFrame);
- assert.equal(secondStackStackFrame.children.length, 0);
- assert.isUndefined(secondStackStackFrame.parentFrame);
- });
-
- test('timerEventSliceCreation', function() {
- var lines = ['timer-event,"V8.External",38189483,3'];
- var m = newModel(lines.join('\n'));
- var p = m.processes[-32];
- var threads = p.findAllThreadsNamed('V8 Timers');
- assert.isDefined(threads);
- assert.equal(threads.length, 1);
- var t = threads[0];
- assert.equal(t.sliceGroup.length, 1);
- });
-
- test('processThreadCreation', function() {
- var lines = ['timer-event,"V8.External",38189483,3'];
- var m = newModel(lines.join('\n'));
- assert.isDefined(m);
- var p = m.processes[-32];
- assert.isDefined(p);
- var threads = p.findAllThreadsNamed('V8 Timers');
- assert.isDefined(threads);
- assert.equal(1, threads.length);
- var t = threads[0];
- assert.equal('V8 Timers', t.name);
- });
-
- test('canImport', function() {
- assert.isTrue(V8LogImporter.canImport(
- 'timer-event,"V8.External",38189483,3'));
- assert.isTrue(V8LogImporter.canImport('v8-version,4,3,66,0,0'));
- assert.isFalse(V8LogImporter.canImport(''));
- assert.isFalse(V8LogImporter.canImport([]));
- });
-
- test('CppSymbolsProcess', function() {
- var lines = [
- 'shared-library,"/usr/loca/v8/out/native/d8",0x00400000, 0x01860000',
- 'cpp,0x00600000,100,"v8::internal::Heap::AllocateByteArray"',
- 'cpp,0x00700000,100,"v8::internal::Utf8StringKey::AsHandle"',
- 'tick,0x00600010,121,0,0x0,5',
- 'tick,0x00700010,122,0,0x0,5',
- 'tick,0x00800010,123,0,0x0,5'];
- var m = newModel(lines.join('\n'));
- var p = m.processes[-32];
- var t = p.findAllThreadsNamed('V8')[0];
- assert.equal(t.samples.length, 3);
- assert.equal(t.samples[0].leafStackFrame.title,
- 'v8::internal::Heap::AllocateByteArray /usr/loca/v8/out/native/d8'); // @suppress longLineCheck
- assert.equal(t.samples[1].leafStackFrame.title,
- 'v8::internal::Utf8StringKey::AsHandle /usr/loca/v8/out/native/d8'); // @suppress longLineCheck
- assert.equal(t.samples[2].leafStackFrame.title,
- '/usr/loca/v8/out/native/d8');
- });
-
- test('CppSymbolsWithJsStack', function() {
- var lines = [
- 'shared-library,"/usr/loca/v8/out/native/d8",0x00400000, 0x01860000',
- 'cpp,0x00600000,100,"v8::internal::Heap::AllocateByteArray"',
- 'cpp,0x00700000,100,"v8::internal::Utf8StringKey::AsHandle"',
- 'code-creation,LazyCompile,0,0x2905d0c0,1800,"InstantiateFunction native apinatives.js:26:29",0x56b19124,', // @suppress longLineCheck
- 'tick,0x00700010,1,0,0x3,0,0x2905d304',
- 'tick,0x00600010,3,0,0x3,0,0x2905d306',
- 'tick,0x00800010,5,0,0x3,0,0x2905d306',
- 'tick,0x01860010,5,0,0x3,0,0x2905d306'];
- var m = newModel(lines.join('\n'));
- var p = m.processes[-32];
- var t = p.findAllThreadsNamed('V8')[0];
- assert.equal(t.samples.length, 4);
- assert.deepEqual(t.samples[0].stackTrace.map(r => r.title), [
- 'v8::internal::Utf8StringKey::AsHandle /usr/loca/v8/out/native/d8',
- 'InstantiateFunction native apinatives.js:26:29'
- ]);
- assert.deepEqual(t.samples[1].stackTrace.map(r => r.title), [
- 'v8::internal::Heap::AllocateByteArray /usr/loca/v8/out/native/d8',
- 'InstantiateFunction native apinatives.js:26:29'
- ]);
- assert.deepEqual(t.samples[2].stackTrace.map(r => r.title), [
- '/usr/loca/v8/out/native/d8',
- 'InstantiateFunction native apinatives.js:26:29'
- ]);
- assert.deepEqual(t.samples[3].stackTrace.map(r => r.title), [
- 'InstantiateFunction native apinatives.js:26:29'
- ]);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/importer/zip_importer.html b/chromium/third_party/catapult/tracing/tracing/extras/importer/zip_importer.html
deleted file mode 100644
index 9f1a2aa95b0..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/importer/zip_importer.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/importer/jszip.html">
-<link rel="import" href="/tracing/extras/importer/gzip_importer.html">
-<link rel="import" href="/tracing/importer/importer.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview ZipImporter inflates zip compressed data and passes it along
- * to an actual importer.
- */
-tr.exportTo('tr.e.importer', function() {
- function ZipImporter(model, eventData) {
- if (eventData instanceof ArrayBuffer)
- eventData = new Uint8Array(eventData);
- this.model_ = model;
- this.eventData_ = eventData;
- }
-
- /**
- * @param {eventData} string Possibly zip compressed data.
- * @return {boolean} Whether eventData looks like zip compressed data.
- */
- ZipImporter.canImport = function(eventData) {
- var header;
- if (eventData instanceof ArrayBuffer)
- header = new Uint8Array(eventData.slice(0, 2));
- else if (typeof(eventData) === 'string' || eventData instanceof String)
- header = [eventData.charCodeAt(0), eventData.charCodeAt(1)];
- else
- return false;
- return header[0] === 'P'.charCodeAt(0) && header[1] === 'K'.charCodeAt(0);
- };
-
- ZipImporter.prototype = {
- __proto__: tr.importer.Importer.prototype,
-
- get importerName() {
- return 'ZipImporter';
- },
-
- isTraceDataContainer: function() {
- return true;
- },
-
- extractSubtraces: function() {
- var zip = new JSZip(this.eventData_);
- var subtraces = [];
- for (var idx in zip.files)
- subtraces.push(zip.files[idx].asBinary());
- return subtraces;
- }
- };
-
- tr.importer.Importer.register(ZipImporter);
-
- return {
- ZipImporter: ZipImporter
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/lean_config.html b/chromium/third_party/catapult/tracing/tracing/extras/lean_config.html
deleted file mode 100644
index b39e51073d9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/lean_config.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<!--
-The lean config is just enough to import uncompressed, trace-event-formatted
-json blobs.
--->
-
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/model.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/measure/measure.html b/chromium/third_party/catapult/tracing/tracing/extras/measure/measure.html
deleted file mode 100644
index 05836554eda..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/measure/measure.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/measure/measure_async_slice.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/measure/measure_async_slice.html b/chromium/third_party/catapult/tracing/tracing/extras/measure/measure_async_slice.html
deleted file mode 100644
index 427a401bf7b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/measure/measure_async_slice.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/model/async_slice.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.measure', function() {
- var AsyncSlice = tr.model.AsyncSlice;
-
- function MeasureAsyncSlice() {
- this.groupTitle_ = 'Ungrouped Measure';
- var matched = /([^\/:]+):([^\/:]+)\/?(.*)/.exec(arguments[1]);
- if (matched !== null) {
- arguments[1] = matched[2];
- this.groupTitle_ = matched[1];
- }
- AsyncSlice.apply(this, arguments);
- }
-
- MeasureAsyncSlice.prototype = {
- __proto__: AsyncSlice.prototype,
-
- get viewSubGroupTitle() {
- return this.groupTitle_;
- },
-
- get title() {
- return this.title_;
- },
-
- set title(title) {
- this.title_ = title;
- }
- };
-
- AsyncSlice.register(
- MeasureAsyncSlice,
- {
- categoryParts: ['blink.user_timing']
- });
-
- return {
- MeasureAsyncSlice: MeasureAsyncSlice
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/measure/measure_async_slice_test.html b/chromium/third_party/catapult/tracing/tracing/extras/measure/measure_async_slice_test.html
deleted file mode 100644
index d175d4e8928..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/measure/measure_async_slice_test.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/measure/measure.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var AsyncSlice = tr.model.AsyncSlice;
- var MeasureAsyncSlice = tr.e.measure.MeasureAsyncSlice;
-
- test('basic', function() {
- var s = new MeasureAsyncSlice(
- 'blink.user_timing', 'createImports', 7, 0, {});
- s.duration = 100;
-
- assert.equal(AsyncSlice.getConstructor(
- 'blink.user_timing', 'createImports'),
- MeasureAsyncSlice);
- assert.equal(s.viewSubGroupTitle, 'Ungrouped Measure');
- });
-
- test('import', function() {
- var events = [
- {name: 'createImports', args: {}, pid: 1, ts: 100,
- cat: 'blink.user_timing', tid: 2, ph: 'b', id: 71},
- {name: 'createImports', args: {}, pid: 1, ts: 200,
- cat: 'blink.user_timing', tid: 2, ph: 'e', id: 71}
- ];
- var m = tr.c.TestUtils.newModelWithEvents([events]);
- var t2 = m.getOrCreateProcess(1).getOrCreateThread(2);
- assert.equal(t2.asyncSliceGroup.length, 1);
- assert.instanceOf(t2.asyncSliceGroup.slices[0], MeasureAsyncSlice);
- });
-
- test('groupMeasureAsyncSlice', function() {
- var events = [
- {name: 'createImports', args: {}, pid: 1, ts: 100,
- cat: 'blink.user_timing', tid: 2, ph: 'b', id: 71},
- {name: 'createImports', args: {}, pid: 1, ts: 200,
- cat: 'blink.user_timing', tid: 2, ph: 'e', id: 71},
- {name: 'runAutoClosers', args: {}, pid: 1, ts: 210,
- cat: 'blink.user_timing', tid: 2, ph: 'b', id: 72},
- {name: 'runAutoClosers', args: {}, pid: 1, ts: 310,
- cat: 'blink.user_timing', tid: 2, ph: 'e', id: 72}
- ];
- var m = tr.c.TestUtils.newModelWithEvents([events]);
- var t2 = m.getOrCreateProcess(1).getOrCreateThread(2);
- assert.equal(t2.asyncSliceGroup.length, 2);
- assert.equal(t2.asyncSliceGroup.slices[0].title, 'createImports');
- assert.equal(t2.asyncSliceGroup.slices[1].title, 'runAutoClosers');
- assert.instanceOf(t2.asyncSliceGroup.slices[0], MeasureAsyncSlice);
- assert.instanceOf(t2.asyncSliceGroup.slices[1], MeasureAsyncSlice);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/net/net.html b/chromium/third_party/catapult/tracing/tracing/extras/net/net.html
deleted file mode 100644
index 3a246c930c0..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/net/net.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/net/net_async_slice.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/net/net_async_slice.html b/chromium/third_party/catapult/tracing/tracing/extras/net/net_async_slice.html
deleted file mode 100644
index 21d52d4cc25..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/net/net_async_slice.html
+++ /dev/null
@@ -1,99 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/model/async_slice.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.net', function() {
- var AsyncSlice = tr.model.AsyncSlice;
-
- function NetAsyncSlice() {
- AsyncSlice.apply(this, arguments);
- this.url_ = undefined;
- this.byteCount_ = undefined;
- // Boolean variables indicating whether we have computed corresponding
- // fields. Computing these fields needs iteration through all sub-slices and
- // so recomputation will be costly.
- this.isTitleComputed_ = false;
- this.isUrlComputed_ = false;
- }
-
- NetAsyncSlice.prototype = {
- __proto__: AsyncSlice.prototype,
-
- get viewSubGroupTitle() {
- return 'NetLog';
- },
-
- get title() {
- if (this.isTitleComputed_ || !this.isTopLevel)
- return this.title_;
-
- if (this.url !== undefined && this.url.length > 0) {
- // Set the title so we do not have to recompute when it is redrawn.
- this.title_ = this.url;
- } else if (this.args !== undefined &&
- this.args.source_type !== undefined) {
- // We do not have a URL, use the source type as the title.
- this.title_ = this.args.source_type;
- }
- this.isTitleComputed_ = true;
- return this.title_;
- },
-
- set title(title) {
- this.title_ = title;
- },
-
- // A recursive helper function that gets the url param of a slice or its
- // nested subslices if there is one.
- get url() {
- if (this.isUrlComputed_)
- return this.url_;
- if (this.args !== undefined && this.args.params !== undefined &&
- this.args.params.url !== undefined) {
- this.url_ = this.args.params.url;
- } else if (this.subSlices !== undefined && this.subSlices.length > 0) {
- for (var i = 0; i < this.subSlices.length && ! this.url_; i++) {
- if (this.subSlices[i].url !== undefined)
- this.url_ = this.subSlices[i].url;
- }
- }
- this.isUrlComputed_ = true;
- return this.url_;
- },
-
- get byteCount() {
- if (this.byteCount_ !== undefined)
- return this.byteCount_;
-
- this.byteCount_ = 0;
- if ((this.originalTitle === 'URL_REQUEST_JOB_FILTERED_BYTES_READ' ||
- this.originalTitle === 'URL_REQUEST_JOB_BYTES_READ') &&
- this.args !== undefined && this.args.params !== undefined &&
- this.args.params.byte_count !== undefined) {
- this.byteCount_ = this.args.params.byte_count;
- }
- for (var i = 0; i < this.subSlices.length; i++) {
- this.byteCount_ += this.subSlices[i].byteCount;
- }
- return this.byteCount_;
- }
- };
-
- AsyncSlice.register(
- NetAsyncSlice,
- {
- categoryParts: ['netlog', 'disabled-by-default-netlog']
- });
-
- return {
- NetAsyncSlice: NetAsyncSlice
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/net/net_async_slice_test.html b/chromium/third_party/catapult/tracing/tracing/extras/net/net_async_slice_test.html
deleted file mode 100644
index 96c623dbf83..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/net/net_async_slice_test.html
+++ /dev/null
@@ -1,193 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/net/net.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var AsyncSlice = tr.model.AsyncSlice;
- var NetAsyncSlice = tr.e.net.NetAsyncSlice;
-
- test('basic', function() {
- var s = new NetAsyncSlice('netlog', 'HTTP_STREAM_JOB', 7, 0, {});
- s.duration = 100;
-
- assert.equal(AsyncSlice.getConstructor('netlog', 'HTTP_STREAM_JOB'),
- NetAsyncSlice);
- assert.equal(s.viewSubGroupTitle, 'NetLog');
- });
-
- test('import', function() {
- var events = [
- {name: 'HTTP_STREAM_JOB', args: {}, pid: 1, ts: 100, cat: 'netlog', tid: 2, ph: 'b', id: 71}, // @suppress longLineCheck
- {name: 'HTTP_STREAM_JOB', args: {}, pid: 1, ts: 200, cat: 'netlog', tid: 2, ph: 'e', id: 71} // @suppress longLineCheck
- ];
- var m = tr.c.TestUtils.newModelWithEvents([events]);
- var t2 = m.getOrCreateProcess(1).getOrCreateThread(2);
- assert.equal(t2.asyncSliceGroup.length, 1);
- assert.instanceOf(t2.asyncSliceGroup.slices[0], NetAsyncSlice);
- });
-
- test('ExposeURLBasic', function() {
- var slice = new NetAsyncSlice('', 'a', 0, 1,
- {params: {url: 'https://google.com'},
- source_type: 'b'}, 0, true);
- // Make sure isTopLevel is populated in the constructor.
- assert.isTrue(slice.isTopLevel);
- // URL is exposed as the title of the parent slice.
- assert.equal(slice.title, 'https://google.com');
- assert.equal(slice.url, 'https://google.com');
- });
-
- test('ExposeURLNested', function() {
- var slice = new NetAsyncSlice(
- '', 'a', 0, 1, {params: {}, source_type: 'HELLO'}, 1, true);
- var childSlice = new NetAsyncSlice('', 'b', 0, 1,
- {params: {url: 'http://test.url'}});
- slice.subSlices = [childSlice];
- // Make sure isTopLevel is populated in the constructor.
- assert.isTrue(slice.isTopLevel);
- assert.isFalse(childSlice.isTopLevel);
- // URL is exposed as the title of the parent slice.
- assert.equal(slice.title, 'http://test.url');
- assert.equal(slice.title, 'http://test.url');
- assert.equal(childSlice.title, 'b');
- assert.equal(childSlice.url, 'http://test.url');
- });
-
- test('ExposeURLNestedNoURL', function() {
- var slice = new NetAsyncSlice('', 'a', 0, 1, {params: {}}, 1, true);
- var childSlice = new NetAsyncSlice('', 'b', 0, 1, {params: {}});
- slice.subSlices = [childSlice];
- // Make sure isTopLevel is populated in the constructor.
- assert.isTrue(slice.isTopLevel);
- assert.isFalse(childSlice.isTopLevel);
- // URL is exposed as the title of the parent slice.
- assert.equal(slice.title, 'a');
- assert.equal(slice.url, undefined);
- assert.equal(childSlice.title, 'b');
- assert.equal(childSlice.url, undefined);
- });
-
- test('ExposeURLNestedBothChildrenHaveURL', function() {
- var slice = new NetAsyncSlice('', 'a', 0, 1, {params: {}}, 1, true);
- var childSlice1 = new NetAsyncSlice('', 'b', 0, 1,
- {params: {url: 'http://test.url.net'}});
- var childSlice2 = new NetAsyncSlice('', 'c', 0, 1,
- {params: {url: 'http://test.url.com'}});
- slice.subSlices = [childSlice1, childSlice2];
- // Make sure isTopLevel is populated in the constructor.
- assert.isTrue(slice.isTopLevel);
- assert.isFalse(childSlice1.isTopLevel);
- assert.isFalse(childSlice2.isTopLevel);
- // Parent should take the first url param that it finds.
- assert.equal(slice.title, 'http://test.url.net');
- assert.equal(childSlice1.title, 'b');
- assert.equal(childSlice2.title, 'c');
- });
-
- test('ExposeURLNestedBothParentAndChildHaveURL', function() {
- var slice = new NetAsyncSlice('', 'a', 0, 1,
- {params: {url: 'parent123.url.com'}}, 1,
- true);
- var childSlice1 = new NetAsyncSlice('', 'b', 0, 1,
- {params: {url: 'http://test.url.net'}});
- var childSlice2 = new NetAsyncSlice('', 'c', 0, 1);
-
- slice.subSlices = [childSlice1, childSlice2];
- // Make sure isTopLevel is populated in the constructor.
- assert.isTrue(slice.isTopLevel);
- assert.isFalse(childSlice1.isTopLevel);
- assert.isFalse(childSlice2.isTopLevel);
- // Parent should take its own url param if there is one.
- assert.equal(slice.title, 'parent123.url.com');
- assert.equal(childSlice1.title, 'b');
- assert.equal(childSlice2.title, 'c');
- });
-
- test('ExposeURLDoNotComputeUrlTwice', function() {
- var slice = new NetAsyncSlice('', 'a', 0, 1, {params: {}}, 1, true);
- var childSlice1 = new NetAsyncSlice('', 'b', 0, 1,
- {params: {url: 'http://test.url.net'}});
- var childSlice2 = new NetAsyncSlice('', 'c', 0, 1);
-
- slice.subSlices = [childSlice1, childSlice2];
- // Make sure isTopLevel is populated in the constructor.
- assert.isTrue(slice.isTopLevel);
- assert.isFalse(childSlice1.isTopLevel);
- assert.isFalse(childSlice2.isTopLevel);
- // Parent should take its child's url param.
- assert.equal(slice.title, 'http://test.url.net');
- assert.equal(childSlice1.title, 'b');
- assert.equal(childSlice2.title, 'c');
- // Now if we change the url param of the child, the parent's title should
- // remain the same. We do not recompute.
- childSlice1.args.params.url = 'example.com';
- assert.equal(slice.title, 'http://test.url.net');
- assert.equal(childSlice1.title, 'b');
- assert.equal(childSlice2.title, 'c');
- });
-
- test('ExposeSourceTypeAsTitle', function() {
- var slice = new NetAsyncSlice('', 'a', 0, 1,
- {params: {}, source_type: 'UDP_SOCKET'}, 1,
- true);
- var childSlice1 = new NetAsyncSlice('', 'b', 0, 1,
- {params: {}, source_type: 'SOCKET'});
- var childSlice2 = new NetAsyncSlice('', 'c', 0, 1);
-
- slice.subSlices = [childSlice1, childSlice2];
- // Make sure isTopLevel is populated in the constructor.
- assert.isTrue(slice.isTopLevel);
- assert.isFalse(childSlice1.isTopLevel);
- assert.isFalse(childSlice2.isTopLevel);
- // Parent should take its own source_type.
- assert.equal(slice.title, 'UDP_SOCKET');
- assert.equal(childSlice1.title, 'b');
- assert.equal(childSlice2.title, 'c');
- });
-
- test('ByteCountBasic', function() {
- var slice = new NetAsyncSlice('', 'URL_REQUEST_JOB_BYTES_READ', 0, 1,
- {params: {byte_count: 12}}, 0, true);
- assert.equal(slice.byteCount, 12);
- });
-
- test('NoByteCount', function() {
- var slice = new NetAsyncSlice('', 'a', 0, 1, {}, 0, true);
- assert.equal(slice.byteCount, 0);
- });
-
- test('ByteCountNested', function() {
- var slice = new NetAsyncSlice('', 'URL_REQUEST_JOB_FILTERED_BYTES_READ',
- 0, 1, {params: {byte_count: 12}}, 0, true);
- var childSlice = new NetAsyncSlice('', 'URL_REQUEST_JOB_BYTES_READ', 0, 1,
- {params: {byte_count: 50}});
- slice.subSlices = [childSlice];
- assert.equal(slice.byteCount, 62);
- assert.equal(childSlice.byteCount, 50);
- });
-
- test('ByteCountTwoChildren', function() {
- var slice = new NetAsyncSlice('', 'URL_REQUEST_JOB_FILTERED_BYTES_READ',
- 0, 1, {params: {byte_count: 12}}, 0, true);
- var childSlice1 = new NetAsyncSlice('', 'URL_REQUEST_JOB_BYTES_READ', 0, 1,
- {params: {byte_count: 50}});
- var childSlice2 = new NetAsyncSlice('', 'URL_REQUEST_JOB_BYTES_READ', 0, 1,
- {params: {byte_count: 20}});
- slice.subSlices = [childSlice1, childSlice2];
- assert.equal(slice.byteCount, 82);
- assert.equal(childSlice1.byteCount, 50);
- assert.equal(childSlice2.byteCount, 20);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/system_stats/system_stats_snapshot.html b/chromium/third_party/catapult/tracing/tracing/extras/system_stats/system_stats_snapshot.html
deleted file mode 100644
index 2dbcc986dee..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/system_stats/system_stats_snapshot.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/cc/util.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.system_stats', function() {
- var ObjectSnapshot = tr.model.ObjectSnapshot;
-
- /**
- * @constructor
- */
- function SystemStatsSnapshot(objectInstance, ts, args) {
- ObjectSnapshot.apply(this, arguments);
- this.objectInstance = objectInstance;
- this.ts = ts;
- this.args = args;
- this.stats = args;
- }
-
- SystemStatsSnapshot.prototype = {
- __proto__: ObjectSnapshot.prototype,
-
- initialize: function() {
- if (this.args.length == 0)
- throw new Error('No system stats snapshot data.');
- this.stats_ = this.args;
- },
-
- getStats: function() {
- return this.stats_;
- },
-
- setStats: function(stats) {
- this.stats_ = stats;
- }
- };
-
- ObjectSnapshot.register(
- SystemStatsSnapshot,
- {typeName: 'base::TraceEventSystemStatsMonitor::SystemStats'});
-
- return {
- SystemStatsSnapshot: SystemStatsSnapshot
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/systrace_config.html b/chromium/third_party/catapult/tracing/tracing/extras/systrace_config.html
deleted file mode 100644
index aac08d55927..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/systrace_config.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/android/android_auditor.html">
-<link rel="import" href="/tracing/extras/importer/android/event_log_importer.html">
-<link rel="import" href="/tracing/extras/importer/battor_importer.html">
-<link rel="import" href="/tracing/extras/importer/ddms_importer.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-<link rel="import" href="/tracing/extras/vsync/vsync_auditor.html">
-<link rel="import" href="/tracing/importer/import.html">
-<link rel="import" href="/tracing/model/model.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/tquery/context.html b/chromium/third_party/catapult/tracing/tracing/extras/tquery/context.html
deleted file mode 100644
index 69334576c59..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/tquery/context.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/utils.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.tquery', function() {
- function Context() {
- this.event = undefined;
- this.ancestors = [];
- }
-
- Context.prototype = {
- push: function(event) {
- var ctx = new Context();
- ctx.ancestors = this.ancestors.slice();
- ctx.ancestors.push(event);
- return ctx;
- },
-
- pop: function(event) {
- var ctx = new Context();
- ctx.event = this.ancestors[this.ancestors.length - 1];
- ctx.ancestors = this.ancestors.slice(0, this.ancestors.length - 1);
- return ctx;
- }
- };
-
- return {
- Context: Context
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter.html b/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter.html
deleted file mode 100644
index 99532e4dd75..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/scripting_object.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.tquery', function() {
- function Filter() {
- tr.c.ScriptingObject.call(this);
- }
-
- Filter.normalizeFilterExpression = function(filterExpression) {
- // Shortcut: naked strings and regexps can be used to match against slice
- // titles.
- if (filterExpression instanceof String ||
- typeof(filterExpression) == 'string' ||
- filterExpression instanceof RegExp) {
- var filter = new tr.e.tquery.FilterHasTitle(filterExpression);
- return filter;
- }
- return filterExpression;
- };
-
- Filter.prototype = {
- __proto__: tr.c.ScriptingObject.prototype,
-
- evaluate: function(context) {
- throw new Error('Not implemented');
- },
-
- matchValue_: function(value, expected) {
- if (expected instanceof RegExp)
- return expected.test(value);
- else if (expected instanceof Function)
- return expected(value);
- return value === expected;
- }
- };
-
- return {
- Filter: Filter
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_all_of.html b/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_all_of.html
deleted file mode 100644
index 07341d5b349..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_all_of.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/scripting_controller.html">
-<link rel="import" href="/tracing/extras/tquery/filter.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.tquery', function() {
- function FilterAllOf(opt_subExpressions) {
- tr.e.tquery.Filter.call(this);
- this.subExpressions = opt_subExpressions || [];
- }
-
- FilterAllOf.prototype = {
- __proto__: tr.e.tquery.Filter.prototype,
-
- set subExpressions(exprs) {
- this.subExpressions_ = [];
- for (var i = 0; i < exprs.length; i++) {
- this.subExpressions_.push(
- tr.e.tquery.Filter.normalizeFilterExpression(exprs[i]));
- }
- },
-
- get subExpressions() {
- return this.subExpressions_;
- },
-
- evaluate: function(context) {
- if (!this.subExpressions.length)
- return true;
- for (var i = 0; i < this.subExpressions.length; i++) {
- if (!this.subExpressions[i].evaluate(context))
- return false;
- }
- return true;
- }
- };
- tr.c.ScriptingObjectRegistry.register(
- function() {
- var exprs = [];
- for (var i = 0; i < arguments.length; i++) {
- exprs.push(arguments[i]);
- }
- return new FilterAllOf(exprs);
- },
- {
- name: 'allOf'
- }
- );
- return {
- FilterAllOf: FilterAllOf
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_any_of.html b/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_any_of.html
deleted file mode 100644
index 4118d40e3e5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_any_of.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/scripting_controller.html">
-<link rel="import" href="/tracing/extras/tquery/filter.html">
-<link rel="import" href="/tracing/extras/tquery/filter_not.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.tquery', function() {
- function FilterAnyOf(opt_subExpressions) {
- tr.e.tquery.Filter.call(this);
- this.subExpressions = opt_subExpressions || [];
- };
-
- FilterAnyOf.prototype = {
- __proto__: tr.e.tquery.Filter.prototype,
-
- set subExpressions(exprs) {
- this.subExpressions_ = [];
- for (var i = 0; i < exprs.length; i++) {
- this.subExpressions_.push(
- tr.e.tquery.Filter.normalizeFilterExpression(exprs[i]));
- }
- },
-
- get subExpressions() {
- return this.subExpressions_;
- },
-
- evaluate: function(context) {
- if (!this.subExpressions.length)
- return true;
- for (var i = 0; i < this.subExpressions.length; i++) {
- if (this.subExpressions[i].evaluate(context))
- return true;
- }
- return false;
- }
- };
- tr.c.ScriptingObjectRegistry.register(
- function() {
- var exprs = Array.prototype.slice.call(arguments);
- return new FilterAnyOf(exprs);
- },
- {
- name: 'anyOf'
- }
- );
- tr.c.ScriptingObjectRegistry.register(
- function() {
- var exprs = Array.prototype.slice.call(arguments);
- return new tr.e.tquery.FilterNot(new FilterAnyOf(exprs));
- },
- {
- name: 'noneOf'
- }
- );
- return {
- FilterAnyOf: FilterAnyOf
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_ancestor.html b/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_ancestor.html
deleted file mode 100644
index c8501c00123..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_ancestor.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/scripting_controller.html">
-<link rel="import" href="/tracing/extras/tquery/filter.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.tquery', function() {
- function FilterHasAncestor(opt_subExpression) {
- this.subExpression = opt_subExpression;
- };
-
- FilterHasAncestor.prototype = {
- __proto__: tr.e.tquery.Filter.prototype,
-
- set subExpression(expr) {
- this.subExpression_ = tr.e.tquery.Filter.normalizeFilterExpression(expr);
- },
-
- get subExpression() {
- return this.subExpression_;
- },
-
- evaluate: function(context) {
- if (!this.subExpression)
- return context.ancestors.length > 0;
- while (context.ancestors.length) {
- context = context.pop();
- if (this.subExpression.evaluate(context))
- return true;
- }
- return false;
- }
- };
- tr.c.ScriptingObjectRegistry.register(
- function(subExpression) {
- return new FilterHasAncestor(subExpression);
- },
- {
- name: 'hasAncestor'
- }
- );
- return {
- FilterHasAncestor: FilterHasAncestor
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_duration.html b/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_duration.html
deleted file mode 100644
index dd9b3ad4d5b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_duration.html
+++ /dev/null
@@ -1,49 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/scripting_controller.html">
-<link rel="import" href="/tracing/extras/tquery/filter.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.tquery', function() {
- function FilterHasDuration(minValueOrExpected, opt_maxValue) {
- if (minValueOrExpected !== undefined && opt_maxValue !== undefined) {
- this.minValue = minValueOrExpected;
- this.maxValue = opt_maxValue;
- } else {
- this.expected = minValueOrExpected;
- }
- };
-
- FilterHasDuration.prototype = {
- __proto__: tr.e.tquery.Filter.prototype,
-
- evaluate: function(context) {
- if (context.event.duration === undefined)
- return false;
- if (this.minValue !== undefined && this.maxValue !== undefined) {
- return context.event.duration >= this.minValue &&
- context.event.duration <= this.maxValue;
- }
- return this.matchValue_(context.event.duration, this.expected);
- }
- };
- tr.c.ScriptingObjectRegistry.register(
- function(minValueOrExpected, opt_maxValue) {
- return new FilterHasDuration(minValueOrExpected, opt_maxValue);
- },
- {
- name: 'hasDuration'
- }
- );
- return {
- FilterHasDuration: FilterHasDuration
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_title.html b/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_title.html
deleted file mode 100644
index b636da17726..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_has_title.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/scripting_controller.html">
-<link rel="import" href="/tracing/extras/tquery/filter.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.tquery', function() {
- function FilterHasTitle(expected) {
- tr.e.tquery.Filter.call(this);
- this.expected = expected;
- }
-
- FilterHasTitle.prototype = {
- __proto__: tr.e.tquery.Filter.prototype,
-
- evaluate: function(context) {
- return this.matchValue_(context.event.title, this.expected);
- }
- };
- tr.c.ScriptingObjectRegistry.register(
- function(expected) {
- var filter = new tr.e.tquery.FilterHasTitle(expected);
- return filter;
- },
- {
- name: 'hasTitle'
- }
- );
-
- return {
- FilterHasTitle: FilterHasTitle
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_is_top_level.html b/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_is_top_level.html
deleted file mode 100644
index 44c04e68edf..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_is_top_level.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/scripting_controller.html">
-<link rel="import" href="/tracing/extras/tquery/filter.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.tquery', function() {
- function FilterIsTopLevel(opt_subExpression) {
- this.subExpression = opt_subExpression;
- }
-
- FilterIsTopLevel.prototype = {
- __proto__: tr.e.tquery.Filter.prototype,
-
- set subExpression(expr) {
- this.subExpression_ = tr.e.tquery.Filter.normalizeFilterExpression(expr);
- },
-
- get subExpression() {
- return this.subExpression_;
- },
-
- evaluate: function(context) {
- if (context.ancestors.length > 0)
- return false;
- if (!this.subExpression)
- return true;
- return this.subExpression.evaluate(context);
- }
- };
- tr.c.ScriptingObjectRegistry.register(
- function(subExpression) {
- return new FilterIsTopLevel(subExpression);
- },
- {
- name: 'isTopLevel'
- }
- );
- return {
- FilterIsTopLevel: FilterIsTopLevel
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_not.html b/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_not.html
deleted file mode 100644
index 64a4be9bb53..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/tquery/filter_not.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/scripting_controller.html">
-<link rel="import" href="/tracing/extras/tquery/filter.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.tquery', function() {
- function FilterNot(subExpression) {
- tr.e.tquery.Filter.call(this);
- this.subExpression = subExpression;
- }
-
- FilterNot.prototype = {
- __proto__: tr.e.tquery.Filter.prototype,
-
- set subExpression(expr) {
- this.subExpression_ = tr.e.tquery.Filter.normalizeFilterExpression(expr);
- },
-
- get subExpression() {
- return this.subExpression_;
- },
-
- evaluate: function(context) {
- return !this.subExpression.evaluate(context);
- }
- };
- tr.c.ScriptingObjectRegistry.register(
- function() {
- var exprs = Array.prototype.slice.call(arguments);
- if (exprs.length !== 1)
- throw new Error('not() must have exactly one subexpression');
- return new FilterNot(exprs[0]);
- },
- {
- name: 'not'
- }
- );
- return {
- FilterNot: FilterNot
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/tquery/tquery.html b/chromium/third_party/catapult/tracing/tracing/extras/tquery/tquery.html
deleted file mode 100644
index 5ea95d9a22f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/tquery/tquery.html
+++ /dev/null
@@ -1,190 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/task.html">
-<link rel="import" href="/tracing/core/filter.html">
-<link rel="import" href="/tracing/core/scripting_object.html">
-<link rel="import" href="/tracing/extras/tquery/context.html">
-<link rel="import" href="/tracing/extras/tquery/filter_all_of.html">
-<link rel="import" href="/tracing/extras/tquery/filter_any_of.html">
-<link rel="import" href="/tracing/extras/tquery/filter_has_ancestor.html">
-<link rel="import" href="/tracing/extras/tquery/filter_has_duration.html">
-<link rel="import" href="/tracing/extras/tquery/filter_has_title.html">
-<link rel="import" href="/tracing/extras/tquery/filter_is_top_level.html">
-<link rel="import" href="/tracing/extras/tquery/filter_not.html">
-<link rel="import" href="/tracing/model/event_set.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.e.tquery', function() {
- function addEventTreeToSelection(selection, event) {
- selection.push(event);
- if (!event.subSlices)
- return;
- event.subSlices.forEach(
- addEventTreeToSelection.bind(undefined, selection));
- }
-
- function TQuery(model) {
- tr.c.ScriptingObject.call(this);
-
- this.model_ = model;
- this.parent_ = undefined;
- this.filterExpression_ = undefined;
- // Memoized filtering result.
- this.selection_ = undefined;
- };
-
- TQuery.prototype = {
- __proto__: tr.c.ScriptingObject.prototype,
-
- onModelChanged: function(model) {
- this.model_ = model;
- this.selection_ = undefined;
- },
-
- get brushingStateController() {
- return this.brushingStateController_;
- },
-
- // Append a new filter expression to this query and return a query node
- // that represents the result.
- filter: function(filterExpression) {
- var result = new TQuery(this.model_);
- result.parent_ = this;
- result.filterExpression_ =
- tr.e.tquery.Filter.normalizeFilterExpression(filterExpression);
- return result;
- },
-
- // Creates a graph of {Task} objects which will compute the selections for
- // this filter object and all of its parents. The return value is an object
- // with the following fields:
- // - rootTask: {Task} which should be executed to kick off processing for
- // the entire task graph.
- // - lastTask: The final {Task} of the graph. Can be used by the caller to
- // enqueue additional processing at the end.
- // - lastNode: The last filter object in the task. It's selection property
- // will contain the filtering result once |finalTask|
- // completes.
- createFilterTaskGraph_: function() {
- // List of nodes in order from the current one to the root.
- var nodes = [];
- var node = this;
- while (node !== undefined) {
- nodes.push(node);
- node = node.parent_;
- }
-
- var rootTask = new tr.b.Task();
- var lastTask = rootTask;
- for (var i = nodes.length - 1; i >= 0; i--) {
- var node = nodes[i];
- // Reuse any memoized result.
- if (node.selection_ !== undefined)
- continue;
- node.selection_ = new tr.model.EventSet();
- if (node.parent_ === undefined) {
- // If this is the root, start by collecting all objects from the
- // model.
- lastTask = lastTask.after(
- this.selectEverythingAsTask_(node.selection_));
- } else {
- // Otherwise execute the filter expression for this node and fill
- // in its selection.
- var prevNode = nodes[i + 1];
- lastTask = this.createFilterTaskForNode_(lastTask, node, prevNode);
- }
- }
- return {rootTask: rootTask, lastTask: lastTask, lastNode: node};
- },
-
- createFilterTaskForNode_: function(lastTask, node, prevNode) {
- return lastTask.after(function() {
- // TODO(skyostil): Break into subtasks.
- node.evaluateFilterExpression_(
- prevNode.selection_, node.selection_);
- }, this);
- },
-
- // Applies the result of a filter expression for a given event and all
- // of its subslices and adds the matching events to an output selection.
- evaluateFilterExpression_: function(inputSelection, outputSelection) {
- var seenEvents = {};
- inputSelection.forEach(function(event) {
- var context = new tr.e.tquery.Context();
- context.event = event;
- this.evaluateFilterExpressionForEvent_(
- context, inputSelection, outputSelection, seenEvents);
- }.bind(this));
- },
-
- evaluateFilterExpressionForEvent_: function(
- context, inputSelection, outputSelection, seenEvents) {
- var event = context.event;
- if (inputSelection.contains(event) && !seenEvents[event.guid]) {
- seenEvents[event.guid] = true;
- if (!this.filterExpression_ ||
- this.filterExpression_.evaluate(context))
- outputSelection.push(event);
- }
- if (!event.subSlices)
- return;
- context = context.push(event);
- for (var i = 0; i < event.subSlices.length; i++) {
- context.event = event.subSlices[i];
- this.evaluateFilterExpressionForEvent_(
- context, inputSelection, outputSelection, seenEvents);
- }
- },
-
- // Returns a task that fills the given selection with everything in the
- // model.
- selectEverythingAsTask_: function(selection) {
- var filterTask = new tr.b.Task();
- for (var container of this.model_.getDescendantEventContainers()) {
- filterTask.subTask(() => {
- for (var event of container.childEvents())
- addEventTreeToSelection(selection, event);
- }, this);
- }
- return filterTask;
- },
-
- // Returns a promise which will resolve into a {EventSet} representing the
- // result of this query.
- ready: function() {
- return new Promise(function(resolve, reject) {
- var graph = this.createFilterTaskGraph_();
- graph.lastTask = graph.lastTask.after(function() {
- resolve(this.selection_);
- }, this);
- tr.b.Task.RunWhenIdle(graph.rootTask);
- }.bind(this));
- },
-
- get selection() {
- if (this.selection_ === undefined) {
- var graph = this.createFilterTaskGraph_();
- tr.b.Task.RunSynchronously(graph.rootTask);
- }
- return this.selection_;
- }
- };
- tr.c.ScriptingObjectRegistry.register(
- new TQuery(),
- {
- name: '$t'
- }
- );
-
- return {
- TQuery: TQuery
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/tquery/tquery_test.html b/chromium/third_party/catapult/tracing/tracing/extras/tquery/tquery_test.html
deleted file mode 100644
index a9bd4733009..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/tquery/tquery_test.html
+++ /dev/null
@@ -1,243 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/core/scripting_controller.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/tquery/tquery.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function createTestModel(sliceCount) {
- var slices = [];
- for (var i = 0; i < sliceCount; i++)
- slices.push(tr.c.TestUtils.newSliceEx({start: 1, duration: 2}));
- return createTestModelWithSlices(slices);
- }
-
- function createTestModelWithSlices(slices) {
- var model = new tr.Model();
- var cpu = model.kernel.getOrCreateCpu(1);
- for (var i = 0; i < slices.length; i++)
- cpu.slices.push(slices[i]);
- return model;
- }
-
- function getScriptObject(name) {
- var typeInfos = tr.c.ScriptingObjectRegistry.getAllRegisteredTypeInfos();
- for (var i = 0; i < typeInfos.length; i++) {
- if (typeInfos[i].metadata.name === name) {
- return typeInfos[i].constructor;
- }
- }
- }
-
- test('tqueryAsyncSelection', function() {
- var model = createTestModel(3);
- var tquery = new tr.e.tquery.TQuery(model);
-
- return tquery.ready().then(function(selection) {
- assert.equal(selection.length, 3);
- });
- });
-
- test('tquerySyncSelection', function() {
- var model = createTestModel(3);
- var tquery = new tr.e.tquery.TQuery(model);
-
- assert.equal(tquery.selection.length, 3);
-
- // Selection should get reset when the model changes.
- var model = createTestModel(5);
- tquery.onModelChanged(model);
- assert.equal(tquery.selection.length, 5);
- });
-
- test('tqueryPassThroughFiltering', function() {
- var model = new createTestModel(3);
- var tquery = new tr.e.tquery.TQuery(model);
-
- var result = tquery.filter().filter().selection;
- assert.equal(result.length, 3);
- });
-
- test('tqueryFilterHasTitle', function() {
- var hasTitle = getScriptObject('hasTitle');
- var model = createTestModelWithSlices([
- {guid: 1, title: 'a'},
- {guid: 2, title: 'b'},
- {guid: 3, title: 'c'}
- ]);
- var tquery = new tr.e.tquery.TQuery(model);
-
- var result = tquery.filter(hasTitle('a')).selection;
- assert.equal(result.length, 1);
- assert.equal(tr.b.getOnlyElement(result).guid, 1);
-
- var result = tquery.filter('b').selection;
- assert.equal(result.length, 1);
- assert.equal(tr.b.getOnlyElement(result).guid, 2);
-
- var result = tquery.filter(/^c$/).selection;
- assert.equal(result.length, 1);
- assert.equal(tr.b.getOnlyElement(result).guid, 3);
- });
-
- test('tqueryFilterHasAncestor', function() {
- var hasAncestor = getScriptObject('hasAncestor');
- var model = createTestModelWithSlices([
- {guid: 1, title: 'a'},
- {guid: 2, title: 'b', subSlices: [{guid: 4}]},
- {guid: 3, title: 'c'}
- ]);
- var tquery = new tr.e.tquery.TQuery(model);
-
- var result = tquery.filter(hasAncestor('b')).selection;
- assert.equal(result.length, 1);
- assert.equal(tr.b.getOnlyElement(result).guid, 4);
-
- var result = tquery.filter(hasAncestor()).selection;
- assert.equal(result.length, 1);
- assert.equal(tr.b.getOnlyElement(result).guid, 4);
-
- var result = tquery.filter(hasAncestor('a')).selection;
- assert.equal(result.length, 0);
- });
-
- test('tqueryFilterAllOf', function() {
- var allOf = getScriptObject('allOf');
- var model = createTestModelWithSlices([
- {guid: 1, title: 'a1'},
- {guid: 2, title: 'b1'},
- {guid: 3, title: 'c1'}
- ]);
- var tquery = new tr.e.tquery.TQuery(model);
-
- var result = tquery.filter(allOf('a1')).selection;
- assert.equal(result.length, 1);
- assert.equal(tr.b.getOnlyElement(result).guid, 1);
-
- var result = tquery.filter(allOf('a1', /1/)).selection;
- assert.equal(result.length, 1);
- assert.equal(tr.b.getOnlyElement(result).guid, 1);
-
- var result = tquery.filter(allOf()).selection;
- assert.equal(result.length, 3);
- });
-
- test('tqueryFilterAnyOf', function() {
- var anyOf = getScriptObject('anyOf');
- var model = createTestModelWithSlices([
- {guid: 1, title: 'a'},
- {guid: 2, title: 'b'},
- {guid: 3, title: 'c'}
- ]);
- var tquery = new tr.e.tquery.TQuery(model);
-
- var result = tquery.filter(anyOf('a', 'b')).selection;
- assert.equal(result.length, 2);
- var nextGuid = 1;
- for (var event of result)
- assert.equal(event.guid, nextGuid++);
-
- var result = tquery.filter(anyOf('not there', 'a')).selection;
- assert.equal(result.length, 1);
- assert.equal(tr.b.getOnlyElement(result).guid, 1);
-
- var result = tquery.filter(anyOf()).selection;
- assert.equal(result.length, 3);
- });
-
- test('tqueryFilterIsTopLevel', function() {
- var isTopLevel = getScriptObject('isTopLevel');
- var model = createTestModelWithSlices([
- {guid: 1, title: 'a'},
- {guid: 2, title: 'b', subSlices: [{guid: 4}]},
- {guid: 3, title: 'c'}
- ]);
- var tquery = new tr.e.tquery.TQuery(model);
-
- var result = tquery.filter(isTopLevel()).selection;
- assert.equal(result.length, 3);
- var nextGuid = 1;
- for (var event of result)
- assert.equal(event.guid, nextGuid++);
-
- var result = tquery.filter(isTopLevel('a')).selection;
- assert.equal(result.length, 1);
- assert.equal(tr.b.getOnlyElement(result).guid, 1);
- });
-
- test('tqueryFilterHasDuration', function() {
- var hasDuration = getScriptObject('hasDuration');
- var model = createTestModelWithSlices([
- {guid: 1, title: 'a', duration: 1},
- {guid: 2, title: 'b', duration: 2},
- {guid: 3, title: 'c', duration: 3},
- {guid: 4, title: 'no duration'}
- ]);
- var tquery = new tr.e.tquery.TQuery(model);
-
- var result = tquery.filter(hasDuration(1.5, 2.5)).selection;
- assert.equal(result.length, 1);
- assert.equal(tr.b.getOnlyElement(result).guid, 2);
-
- var result = tquery.filter(hasDuration(3, Infinity)).selection;
- assert.equal(result.length, 1);
- assert.equal(tr.b.getOnlyElement(result).guid, 3);
-
- var result = tquery.filter(hasDuration(-1, 0)).selection;
- assert.equal(result.length, 0);
-
- var result = tquery.filter(hasDuration(function(d) {
- return d > 2;
- })).selection;
- assert.equal(result.length, 1);
- assert.equal(tr.b.getOnlyElement(result).guid, 3);
- });
-
- test('tqueryFilterNot', function() {
- var not = getScriptObject('not');
- var model = createTestModelWithSlices([
- {guid: 1, title: 'a'},
- {guid: 2, title: 'b'},
- {guid: 3, title: 'c'}
- ]);
- var tquery = new tr.e.tquery.TQuery(model);
-
- var result = tquery.filter(not(/a/)).selection;
- assert.equal(result.length, 2);
- var nextGuid = 2;
- for (var event of result) {
- assert.equal(event.guid, nextGuid++);
- }
-
- // Test a not() without any subexpressions.
- assert.throws(function() { not(); });
-
- // Test a not() with too many subexpressions.
- assert.throws(function() { not(/a/, /b/); });
- });
-
- test('tqueryFilterNoneOf', function() {
- var noneOf = getScriptObject('noneOf');
- var model = createTestModelWithSlices([
- {guid: 1, title: 'a'},
- {guid: 2, title: 'b'},
- {guid: 3, title: 'c'}
- ]);
- var tquery = new tr.e.tquery.TQuery(model);
-
- var result = tquery.filter(noneOf(/a/, /b/)).selection;
- assert.equal(result.length, 1);
- assert.equal(tr.b.getOnlyElement(result).guid, 3);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/vsync/vsync_auditor.html b/chromium/third_party/catapult/tracing/tracing/extras/vsync/vsync_auditor.html
deleted file mode 100644
index 2d450a953cc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/vsync/vsync_auditor.html
+++ /dev/null
@@ -1,140 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/auditor.html">
-
-<script>
-'use strict';
-
-function filterDuplicateTimestamps(timestamps) {
- var dedupedTimestamps = [];
- var lastTs = 0;
- for (var ts of timestamps) {
- if (ts - lastTs >= 1) {
- dedupedTimestamps.push(ts);
- lastTs = ts;
- }
- }
- return dedupedTimestamps;
-}
-
-tr.exportTo('tr.e.audits', function() {
-
- var VSYNC_COUNTER_PRECISIONS = {
- // Android. Some versions have VSYNC split out into VSYNC-app and VSYNC-sf.
- // Requires "gfx" systrace category to be enabled.
- 'android.VSYNC-app': 15,
- 'android.VSYNC': 15
- };
-
- var VSYNC_SLICE_PRECISIONS = {
- // Android.
- 'RenderWidgetHostViewAndroid::OnVSync': 5,
- // Android. Very precise. Requires "gfx" systrace category to be enabled.
- 'VSYNC': 10,
- // Linux. Very precise. Requires "gpu" tracing category to be enabled.
- 'vblank': 10,
- // Mac. Derived from a Mac callback (CVDisplayLinkSetOutputCallback).
- 'DisplayLinkMac::GetVSyncParameters': 5
- };
-
- var BEGIN_FRAME_SLICE_PRECISION = {
- 'DisplayScheduler::BeginFrame': 10
- };
-
- /**
- * Auditor that analyzes the model and, if possible, adds data to it
- * indicating when vertical sync events took place.
- *
- * @constructor
- * @extends {tr.c.Auditor}
- */
- function VSyncAuditor(model) {
- tr.c.Auditor.call(this, model);
- };
-
- VSyncAuditor.prototype = {
- __proto__: tr.c.Auditor.prototype,
-
- runAnnotate: function() {
- this.model.device.vSyncTimestamps = this.findVSyncTimestamps(this.model);
- },
-
- /**
- * Returns an array of the most accurate VSync times available in the model.
- */
- findVSyncTimestamps: function(model) {
- var times = [];
-
- // Only keep the most precise VSync data.
- var maxPrecision = Number.NEGATIVE_INFINITY;
- var maxTitle = undefined;
-
- function useInstead(title, precisions) {
- var precision = precisions[title];
- if (precision === undefined)
- return false;
-
- if (title === maxTitle)
- return true;
-
- if (precision <= maxPrecision) {
- if (precision === maxPrecision) {
- console.warn('Encountered two different VSync events (' +
- maxTitle + ', ' + title + ') with the same precision, ' +
- 'ignoring the newer one (' + title + ')');
- }
- return false;
- }
- maxPrecision = precision;
- maxTitle = title;
- times = [];
-
- return true;
- }
-
- for (var pid in model.processes) {
- var process = model.processes[pid];
- // Traverse process counters.
- for (var cid in process.counters) {
- if (useInstead(cid, VSYNC_COUNTER_PRECISIONS)) {
- var counter = process.counters[cid];
- for (var i = 0; i < counter.series.length; i++) {
- var series = counter.series[i];
- Array.prototype.push.apply(times, series.timestamps);
- }
- }
- }
-
- // Traverse thread slices.
- for (var tid in process.threads) {
- var thread = process.threads[tid];
- for (var i = 0; i < thread.sliceGroup.slices.length; i++) {
- var slice = thread.sliceGroup.slices[i];
- if (useInstead(slice.title, VSYNC_SLICE_PRECISIONS))
- times.push(slice.start);
- // We need to check not only that we have a Scheduler::BeginFrame
- // event, but also that we have one that has a frame time associated
- // with it. Older versions of Scheduler::BeginFrame don't have one.
- else if (useInstead(slice.title, BEGIN_FRAME_SLICE_PRECISION) &&
- slice.args.args && slice.args.args.frame_time_us)
- times.push(slice.args.args.frame_time_us / 1000.0);
- }
- }
- }
- times.sort(function(x, y) { return x - y; });
- return filterDuplicateTimestamps(times);
- }
- };
-
- tr.c.Auditor.register(VSyncAuditor);
-
- return {
- VSyncAuditor: VSyncAuditor
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/extras/vsync/vsync_auditor_test.html b/chromium/third_party/catapult/tracing/tracing/extras/vsync/vsync_auditor_test.html
deleted file mode 100644
index 4672fe353eb..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/extras/vsync/vsync_auditor_test.html
+++ /dev/null
@@ -1,139 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/vsync/vsync_auditor.html">
-<link rel="import" href="/tracing/model/counter_series.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/thread_slice.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- var CounterSeries = tr.model.CounterSeries;
- var Model = tr.Model;
- var ThreadSlice = tr.model.ThreadSlice;
- var VSyncAuditor = tr.e.audits.VSyncAuditor;
-
- function testFindVSyncTimestamps(slices, counters, expectedTimes) {
- var model = buildModel(slices, counters);
- var auditor = new VSyncAuditor(model);
- assert.deepEqual(auditor.findVSyncTimestamps(model), expectedTimes);
- }
-
- function buildModel(slices, counters) {
- var model = new Model();
- var process = model.getOrCreateProcess(1);
- for (var i = 0; i < slices.length; i++) {
- var thread = process.getOrCreateThread(i);
- for (var j = 0; j < slices[i].length; j++)
- thread.sliceGroup.pushSlice(slices[i][j]);
- }
- for (var i = 0; i < counters.length; i++) {
- var counter = process.getOrCreateCounter(
- counters[i].category,
- counters[i].name);
- counter.addSeries(counters[i].series);
- }
- return model;
- }
-
- function buildSlice(title, time) {
- return new ThreadSlice('', title, 0, time, {});
- }
-
- function buildCounterSeries(name, timestamps) {
- var series = new CounterSeries(name, '');
- for (var i = 0; i < timestamps.length; i++)
- series.addCounterSample(timestamps[i], 1);
- return series;
- }
-
- test('findEmpty', function() {
- testFindVSyncTimestamps([], [], []);
- });
-
- test('findNoVsync', function() {
- testFindVSyncTimestamps([
- [buildSlice('MessageLoop::RunTask', 10),
- buildSlice('MessageLoop::RunTask', 20)],
- [buildSlice('MessageLoop::RunTask', 15)]
- ], [], []);
- });
-
- test('findOneVsync', function() {
- testFindVSyncTimestamps([[buildSlice('vblank', 42)]], [], [42]);
- });
-
- test('findMultipleVsyncs', function() {
- testFindVSyncTimestamps([
- [buildSlice('VSYNC', 1), buildSlice('MessageLoop::RunTask', 2)],
- [buildSlice('MessageLoop::RunTask', 3)],
- [buildSlice('MessageLoop::RunTask', 4), buildSlice('VSYNC', 5)],
- [buildSlice('VSYNC', 6), buildSlice('VSYNC', 7)]
- ], [], [1, 5, 6, 7]);
- });
-
- test('filterNearDuplicates', function() {
- testFindVSyncTimestamps([
- [buildSlice('VSYNC', 1), buildSlice('VSYNC', 1)],
- [buildSlice('VSYNC', 2), buildSlice('VSYNC', 2.1)],
- [buildSlice('VSYNC', 3), buildSlice('VSYNC', 4)],
- ], [], [1, 2, 3, 4]);
- });
-
- test('findMultipleAndroidVsyncs', function() {
- testFindVSyncTimestamps([
- [buildSlice('MessageLoop::RunTask', 2)],
- [buildSlice('MessageLoop::RunTask', 3)],
- [buildSlice('MessageLoop::RunTask', 4)]
- ],
- [
- {
- category: 'android',
- name: 'VSYNC-app',
- series: buildCounterSeries('VSYNC-app', [1, 5, 6, 7])
- }
- ], [1, 5, 6, 7]);
- });
-
- test('findUnsorted', function() {
- testFindVSyncTimestamps([
- [buildSlice('RenderWidgetHostViewAndroid::OnVSync', 4),
- buildSlice('MessageLoop::RunTask', 2)],
- [buildSlice('RenderWidgetHostViewAndroid::OnVSync', 1),
- buildSlice('RenderWidgetHostViewAndroid::OnVSync', 3)]
- ], [], [1, 3, 4]);
- });
-
- test('findDifferentPrecisions', function() {
- // vblank has higher precision than RenderWidgetHostViewAndroid::OnVSync.
- testFindVSyncTimestamps([
- [buildSlice('RenderWidgetHostViewAndroid::OnVSync', 1),
- buildSlice('vblank', 2),
- buildSlice('RenderWidgetHostViewAndroid::OnVSync', 3)]
- ], [], [2]);
- });
-
- test('findBeginFrame', function() {
- var title = 'DisplayScheduler::BeginFrame';
- testFindVSyncTimestamps([[
- new ThreadSlice('', title, 0, 2, { args: { frame_time_us: 1000 } }),
- new ThreadSlice('', title, 0, 4, { args: { frame_time_us: 3000 } })
- ]], [], [1, 3]);
- });
-
- test('findBeginFrame_noFrameTime', function() {
- var title = 'DisplayScheduler::BeginFrame';
- testFindVSyncTimestamps([[
- new ThreadSlice('', title, 0, 2, {}),
- new ThreadSlice('', title, 0, 4, { args: {} })
- ]], [], []);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/importer/clock_sync_test.html b/chromium/third_party/catapult/tracing/tracing/importer/clock_sync_test.html
deleted file mode 100644
index 81fa36087e0..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/importer/clock_sync_test.html
+++ /dev/null
@@ -1,123 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/battor_importer.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/clock_sync_manager.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview This file contains end-to-end clock sync tests that ensure
- * clock sync behavior works as expected across traces. There are too many
- * possible combinations of trace types to test all of them, but we aim to test
- * many of the important ones in this file.
- */
-tr.b.unittest.testSuite(function() {
- test('import_noClockDomains', function() {
- var m = tr.c.TestUtils.newModelWithEvents([]);
-
- assert.isFalse(m.hasImportWarnings);
- });
-
- test('import_traceEvent', function() {
- var trace = JSON.stringify({
- traceEvents: [
- {ts: 0, pid: 0, tid: 0, ph: 'i', cat: 'c', name: 'taskA', args: {}},
- {ts: 1000, pid: 0, tid: 0, ph: 'c', cat: 'metadata',
- args: { issue_ts: 500, sync_id: 'abc' }},
- {ts: 2000, pid: 0, tid: 0, ph: 'i', cat: 'c', name: 'taskA', args: {}}
- ]});
- var m = tr.c.TestUtils.newModelWithEvents([trace]);
-
- assert.isFalse(m.hasImportWarnings);
-
- assert.equal(m.processes[0].threads[0].sliceGroup.slices[0].start, 0);
- assert.equal(m.processes[0].threads[0].sliceGroup.slices[1].start, 2);
- });
-
-
- test('import_ftrace', function() {
- var ftrace =
- 'SurfaceFlinger-0 [001] ...1 0.001: 0: B|1|taskA\n' +
- ' chrome-3 [001] ...1 0.010: 0: trace_event_clock_sync: ' +
- 'parent_ts=0.020\n';
-
- var m = tr.c.TestUtils.newModelWithEvents([ftrace]);
-
- assert.isFalse(m.hasImportWarnings);
- assert.equal(m.processes[1].threads[0].sliceGroup.slices[0].start, 0);
- });
-
- test('import_traceEventWithNoClockDomainAndFtrace', function() {
- // Include a clock sync marker that indicates the LINUX_CLOCK_MONOTONIC time
- // of 20ms is equal to the LINUX_FTRACE_GLOBAL time of 10ms, effectively
- // shifting all ftrace timestamps forward by 10ms.
- var ftrace =
- 'SurfaceFlinger-0 [001] ...1 0.001: 0: B|1|taskA\n' +
- ' chrome-3 [001] ...1 0.010: 0: trace_event_clock_sync: ' +
- 'parent_ts=0.020\n';
-
- var trace = JSON.stringify({
- traceEvents: [
- {ts: 0, pid: 0, tid: 0, ph: 'i', cat: 'c', name: 'taskA', args: {}},
- {ts: 1000, pid: 0, tid: 0, ph: 'c', cat: 'metadata',
- args: { issue_ts: 500, sync_id: 'abc' }},
- {ts: 2000, pid: 0, tid: 0, ph: 'i', cat: 'c', name: 'taskA', args: {}}
- ],
- systemTraceEvents: ftrace
- });
- var m = tr.c.TestUtils.newModelWithEvents([trace]);
-
- assert.isFalse(m.hasImportWarnings);
-
- // Chrome events shouldn't be shifted.
- assert.equal(m.processes[0].threads[0].sliceGroup.slices[0].start, 0);
- assert.equal(m.processes[0].threads[0].sliceGroup.slices[1].start, 2);
-
- // Ftrace events should be shifted forward by 10ms.
- assert.equal(m.processes[1].threads[0].sliceGroup.slices[0].start, 11);
- });
-
- test('import_traceEventWithClockDomainAndFtrace', function() {
- // Include a clock sync marker that indicates the LINUX_CLOCK_MONOTONIC time
- // of 20ms is equal to the LINUX_FTRACE_GLOBAL time of 10ms, effectively
- // shifting all ftrace timestamps forward by 10ms.
- var ftrace =
- 'SurfaceFlinger-0 [001] ...1 0.001: 0: B|1|taskA\n' +
- ' chrome-3 [001] ...1 0.010: 0: trace_event_clock_sync: ' +
- 'parent_ts=0.020\n';
-
- var trace = JSON.stringify({
- traceEvents: [
- {ts: 0, pid: 0, tid: 0, ph: 'i', cat: 'c', name: 'taskA', args: {}},
- {ts: 1000, pid: 0, tid: 0, ph: 'c', cat: 'metadata',
- args: { issue_ts: 500, sync_id: 'abc' }},
- {ts: 2000, pid: 0, tid: 0, ph: 'i', cat: 'c', name: 'taskA', args: {}}
- ],
- metadata: {
- 'clock-domain': 'LINUX_CLOCK_MONOTONIC'
- },
- systemTraceEvents: ftrace
- });
- var m = tr.c.TestUtils.newModelWithEvents([trace]);
-
- assert.isFalse(m.hasImportWarnings);
-
- // Chrome events shouldn't be shifted.
- assert.equal(m.processes[0].threads[0].sliceGroup.slices[0].start, 0);
- assert.equal(m.processes[0].threads[0].sliceGroup.slices[1].start, 2);
-
- // Ftrace events should be shifted forward by 10ms.
- assert.equal(m.processes[1].threads[0].sliceGroup.slices[0].start, 11);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/importer/context_processor.html b/chromium/third_party/catapult/tracing/tracing/importer/context_processor.html
deleted file mode 100644
index d7df00f3923..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/importer/context_processor.html
+++ /dev/null
@@ -1,196 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.importer', function() {
- /**
- * The context processor consumes context events and maintains a set of
- * active contexts for a single thread.
- *
- * @constructor
- */
- function ContextProcessor(model) {
- this.model_ = model;
- this.activeContexts_ = [];
- this.stackPerType_ = {};
- // Cache of unique context objects.
- this.contextCache_ = {};
- // Cache of unique context object sets.
- this.contextSetCache_ = {};
- this.cachedEntryForActiveContexts_ = undefined;
- // All seen context object snapshots.
- this.seenSnapshots_ = {};
- };
-
- ContextProcessor.prototype = {
- enterContext: function(contextType, scopedId) {
- var newActiveContexts = [this.getOrCreateContext_(contextType, scopedId)];
- for (var oldContext of this.activeContexts_) {
- if (oldContext.type === contextType) {
- // If a previous context of the same type is active, it is removed
- // and pushed onto the stack for this type.
- this.pushContext_(oldContext);
- } else {
- // Otherwise the old context is it is still active.
- newActiveContexts.push(oldContext);
- }
- }
- this.activeContexts_ = newActiveContexts;
- this.cachedEntryForActiveContexts_ = undefined;
- },
-
- leaveContext: function(contextType, scopedId) {
- this.leaveContextImpl_(context =>
- context.type === contextType &&
- context.snapshot.scope === scopedId.scope &&
- context.snapshot.idRef === scopedId.id);
- },
-
- destroyContext: function(scopedId) {
- // Remove all matching contexts from stacks.
- tr.b.iterItems(this.stackPerType_, function(contextType, stack) {
- // Perform in-place filtering instead of Array.prototype.filter to
- // prevent creating a new array.
- var newLength = 0;
- for (var i = 0; i < stack.length; ++i) {
- if (stack[i].snapshot.scope !== scopedId.scope ||
- stack[i].snapshot.idRef !== scopedId.id) {
- stack[newLength++] = stack[i];
- }
- }
- stack.length = newLength;
- });
-
- // Remove all matching contexts from active context set.
- this.leaveContextImpl_(context =>
- context.snapshot.scope === scopedId.scope &&
- context.snapshot.idRef === scopedId.id);
- },
-
- leaveContextImpl_: function(predicate) {
- var newActiveContexts = [];
- for (var oldContext of this.activeContexts_) {
- if (predicate(oldContext)) {
- // If we left this context, remove it from the active set and
- // restore any previous context of the same type.
- var previousContext = this.popContext_(oldContext.type);
- if (previousContext)
- newActiveContexts.push(previousContext);
- } else {
- newActiveContexts.push(oldContext);
- }
- }
- this.activeContexts_ = newActiveContexts;
- this.cachedEntryForActiveContexts_ = undefined;
- },
-
- getOrCreateContext_: function(contextType, scopedId) {
- var context = {
- type: contextType,
- snapshot: {
- scope: scopedId.scope,
- idRef: scopedId.id
- }
- };
- var key = this.getContextKey_(context);
- if (key in this.contextCache_)
- return this.contextCache_[key];
- this.contextCache_[key] = context;
- var snapshotKey = this.getSnapshotKey_(scopedId);
- this.seenSnapshots_[snapshotKey] = true;
- return context;
- },
-
- pushContext_: function(context) {
- if (!(context.type in this.stackPerType_))
- this.stackPerType_[context.type] = [];
- this.stackPerType_[context.type].push(context);
- },
-
- popContext_: function(contextType) {
- if (!(contextType in this.stackPerType_))
- return undefined;
- return this.stackPerType_[contextType].pop();
- },
-
- getContextKey_: function(context) {
- return [
- context.type,
- context.snapshot.scope,
- context.snapshot.idRef
- ].join('\x00');
- },
-
- getSnapshotKey_: function(scopedId) {
- return [
- scopedId.scope,
- scopedId.idRef
- ].join('\x00');
- },
-
- get activeContexts() {
- // Keep a single instance for each unique set of active contexts to
- // reduce memory usage.
- if (this.cachedEntryForActiveContexts_ === undefined) {
- var key = [];
- for (var context of this.activeContexts_)
- key.push(this.getContextKey_(context));
- key.sort();
- key = key.join('\x00');
- if (key in this.contextSetCache_) {
- this.cachedEntryForActiveContexts_ = this.contextSetCache_[key];
- } else {
- this.activeContexts_.sort(function(a, b) {
- var keyA = this.getContextKey_(a);
- var keyB = this.getContextKey_(b);
- if (keyA < keyB)
- return -1;
- if (keyA > keyB)
- return 1;
- return 0;
- }.bind(this));
- this.contextSetCache_[key] = Object.freeze(this.activeContexts_);
- this.cachedEntryForActiveContexts_ = this.contextSetCache_[key];
- }
- }
- return this.cachedEntryForActiveContexts_;
- },
-
- invalidateContextCacheForSnapshot: function(scopedId) {
- var snapshotKey = this.getSnapshotKey_(scopedId);
- if (!(snapshotKey in this.seenSnapshots_))
- return;
- this.contextCache_ = {};
- this.contextSetCache_ = {};
- this.cachedEntryForActiveContexts_ = undefined;
- this.activeContexts_ = this.activeContexts_.map(function(context) {
- // Do not alter unrelated contexts.
- if (context.snapshot.scope !== scopedId.scope ||
- context.snapshot.idRef !== scopedId.id)
- return context;
- // Replace the invalidated context by a deep copy.
- return {
- type: context.type,
- snapshot: {
- scope: context.snapshot.scope,
- idRef: context.snapshot.idRef
- }
- };
- });
- this.seenSnapshots_ = {};
- },
- };
-
- return {
- ContextProcessor: ContextProcessor
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/importer/context_processor_test.html b/chromium/third_party/catapult/tracing/tracing/importer/context_processor_test.html
deleted file mode 100644
index 29a78114bd4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/importer/context_processor_test.html
+++ /dev/null
@@ -1,273 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/importer/context_processor.html">
-<link rel="import" href="/tracing/model/scoped_id.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ContextProcessor = tr.importer.ContextProcessor;
-
- test('empty', function() {
- var processor = new ContextProcessor();
- assert.deepEqual(processor.activeContexts, []);
- });
-
- test('enterAndLeave', function() {
- var processor = new ContextProcessor();
- var id = new tr.model.ScopedId('ptr', 123);
- var expectedContext = {type: 'type', snapshot: {scope: 'ptr', idRef: 123}};
- processor.enterContext('type', id);
- assert.deepEqual(processor.activeContexts, [expectedContext]);
- processor.leaveContext('type', id);
- assert.deepEqual(processor.activeContexts, []);
- });
-
- test('parallelContexts', function() {
- var processor = new ContextProcessor();
- var idA = new tr.model.ScopedId('ptr', 123);
- var idB = new tr.model.ScopedId('idx', 456);
- var expectedContextA = {type: 'A', snapshot: {scope: 'ptr', idRef: 123}};
- var expectedContextB = {type: 'B', snapshot: {scope: 'idx', idRef: 456}};
-
- // Entering and leaving in order.
- processor.enterContext('A', idA);
- assert.deepEqual(processor.activeContexts, [expectedContextA]);
- processor.enterContext('B', idB);
- assert.deepEqual(processor.activeContexts, [expectedContextA,
- expectedContextB]);
- processor.leaveContext('B', idB);
- assert.deepEqual(processor.activeContexts, [expectedContextA]);
- processor.leaveContext('A', idA);
- assert.deepEqual(processor.activeContexts, []);
-
- // Entering and leaving out of order.
- processor.enterContext('B', idB);
- assert.deepEqual(processor.activeContexts, [expectedContextB]);
- processor.enterContext('A', idA);
- assert.deepEqual(processor.activeContexts, [expectedContextA,
- expectedContextB]);
- processor.leaveContext('B', idB);
- assert.deepEqual(processor.activeContexts, [expectedContextA]);
- processor.leaveContext('A', idA);
- assert.deepEqual(processor.activeContexts, []);
- });
-
- test('contextStack', function() {
- var processor = new ContextProcessor();
- var idA = new tr.model.ScopedId('ptr', 123);
- var idB = new tr.model.ScopedId('idx', 456);
- var expectedContextA = {
- type: 'type', snapshot: {scope: 'ptr', idRef: 123}};
- var expectedContextB = {
- type: 'type', snapshot: {scope: 'idx', idRef: 456}};
-
- // Entering and leaving the same context type.
- processor.enterContext('type', idA);
- assert.deepEqual(processor.activeContexts, [expectedContextA]);
- processor.enterContext('type', idB);
- assert.deepEqual(processor.activeContexts, [expectedContextB]);
- processor.leaveContext('type', idB);
- assert.deepEqual(processor.activeContexts, [expectedContextA]);
- processor.leaveContext('type', idA);
- assert.deepEqual(processor.activeContexts, []);
- });
-
- test('contextCached', function() {
- var processor = new ContextProcessor();
- var idA = new tr.model.ScopedId('ptr', 123);
- var idB = new tr.model.ScopedId('idx', 456);
- var expectedContextA = {
- type: 'A', snapshot: {scope: 'ptr', idRef: 123}};
- var expectedContextB = {
- type: 'B', snapshot: {scope: 'idx', idRef: 456}};
-
- processor.enterContext('A', idA);
- var firstSet = processor.activeContexts;
- processor.enterContext('B', idB);
- var secondSet = processor.activeContexts;
- processor.leaveContext('B', idB);
- processor.leaveContext('A', idA);
-
- assert.deepEqual(firstSet, [expectedContextA]);
- assert.deepEqual(secondSet, [expectedContextA, expectedContextB]);
-
- // Identical context objects should be the same instance.
- assert(Object.is(firstSet[0], secondSet[0]));
- });
-
- test('contextSetCached', function() {
- var processor = new ContextProcessor();
- var id = new tr.model.ScopedId('ptr', 123);
- var expectedContext = {type: 'type', snapshot: {scope: 'ptr', idRef: 123}};
-
- processor.enterContext('type', id);
- var firstSet = processor.activeContexts;
- processor.leaveContext('type', id);
-
- processor.enterContext('type', id);
- var secondSet = processor.activeContexts;
- processor.leaveContext('type', id);
-
- assert.deepEqual(firstSet, [expectedContext]);
- assert(Object.is(firstSet, secondSet));
- });
-
- test('contextSetIsOrdered', function() {
- var processor = new ContextProcessor();
- var idA = new tr.model.ScopedId('ptr', 123);
- var idB = new tr.model.ScopedId('idx', 456);
- var expectedContextA = {type: 'A', snapshot: {scope: 'ptr', idRef: 123}};
- var expectedContextB = {type: 'B', snapshot: {scope: 'idx', idRef: 456}};
-
- processor.enterContext('A', idA);
- processor.enterContext('B', idB);
- var firstSet = processor.activeContexts;
- processor.leaveContext('B', idB);
- processor.leaveContext('A', idA);
-
- processor.enterContext('B', idB);
- processor.enterContext('A', idA);
- var secondSet = processor.activeContexts;
- processor.leaveContext('A', idA);
- processor.leaveContext('B', idB);
-
- assert.deepEqual(firstSet, [expectedContextA, expectedContextB]);
- assert(Object.is(firstSet, secondSet));
- });
-
- test('contextSetIsFrozen', function() {
- var processor = new ContextProcessor();
- var id = new tr.model.ScopedId('ptr', 123);
- assert(Object.isFrozen(processor.activeContexts));
- processor.enterContext('type', id);
- assert(Object.isFrozen(processor.activeContexts));
- processor.leaveContext('type', id);
- assert(Object.isFrozen(processor.activeContexts));
- });
-
- test('cacheInvalidation', function() {
- var processor = new ContextProcessor();
- var id = new tr.model.ScopedId('ptr', 123);
- var expectedContext = {type: 'type', snapshot: {scope: 'ptr', idRef: 123}};
-
- processor.enterContext('type', id);
- var firstSet = processor.activeContexts;
- processor.leaveContext('type', id);
-
- processor.invalidateContextCacheForSnapshot(id);
-
- processor.enterContext('type', id);
- var secondSet = processor.activeContexts;
- processor.leaveContext('type', id);
-
- assert.deepEqual(firstSet, [expectedContext]);
- assert.deepEqual(secondSet, [expectedContext]);
- assert(!Object.is(firstSet, secondSet));
- assert(!Object.is(firstSet[0], secondSet[0]));
- assert(!Object.is(firstSet[0].snapshot, secondSet[0].snapshot));
- });
-
- test('cacheInvalidationOfAnActiveContext', function() {
- var processor = new ContextProcessor();
- var id = new tr.model.ScopedId('ptr', 123);
- var expectedContext = {type: 'type', snapshot: {scope: 'ptr', idRef: 123}};
-
- processor.enterContext('type', id);
- var firstSet = processor.activeContexts;
-
- processor.invalidateContextCacheForSnapshot(id);
-
- var secondSet = processor.activeContexts;
- processor.leaveContext('type', id);
-
- assert.deepEqual(firstSet, [expectedContext]);
- assert.deepEqual(secondSet, [expectedContext]);
- assert(!Object.is(firstSet, secondSet));
- assert(!Object.is(firstSet[0], secondSet[0]));
- assert(!Object.is(firstSet[0].snapshot, secondSet[0].snapshot));
- });
-
- test('cacheInvalidationForUnrelatedSnapshot', function() {
- var processor = new ContextProcessor();
- var id = new tr.model.ScopedId('ptr', 123);
- var unrelatedId = new tr.model.ScopedId('ofs', 789);
- var expectedContext = {type: 'type', snapshot: {scope: 'ptr', idRef: 123}};
-
- processor.enterContext('type', id);
- var firstSet = processor.activeContexts;
- processor.leaveContext('type', id);
-
- processor.invalidateContextCacheForSnapshot(unrelatedId);
-
- processor.enterContext('type', id);
- var secondSet = processor.activeContexts;
- processor.leaveContext('type', id);
-
- assert.deepEqual(firstSet, [expectedContext]);
- assert.deepEqual(secondSet, [expectedContext]);
- assert(Object.is(firstSet, secondSet));
- });
-
- test('destroyBasic', function() {
- var processor = new ContextProcessor();
- var id = new tr.model.ScopedId('ptr', 123);
- var expectedContext = {type: 'type', snapshot: {scope: 'ptr', idRef: 123}};
- processor.enterContext('type', id);
- assert.deepEqual(processor.activeContexts, [expectedContext]);
- processor.destroyContext(id);
- assert.deepEqual(processor.activeContexts, []);
- });
-
- test('destroyActiveContextWithNonEmptyStack', function() {
- var processor = new ContextProcessor();
- var idA = new tr.model.ScopedId('ptr', 123);
- var idB = new tr.model.ScopedId('idx', 456);
- var expectedContext = {type: 'type', snapshot: {scope: 'ptr', idRef: 123}};
- processor.enterContext('type', idA);
- processor.enterContext('type', idB);
- processor.destroyContext(idB);
- assert.deepEqual(processor.activeContexts, [expectedContext]);
- processor.leaveContext('type', idA);
- assert.deepEqual(processor.activeContexts, []);
- });
-
- test('destroyInactiveContextInStack', function() {
- var processor = new ContextProcessor();
- var idA = new tr.model.ScopedId('ptr', 123);
- var idB = new tr.model.ScopedId('idx', 456);
- var expectedContext = {type: 'type', snapshot: {scope: 'idx', idRef: 456}};
- processor.enterContext('type', idA);
- processor.enterContext('type', idB);
- processor.destroyContext(idA);
- assert.deepEqual(processor.activeContexts, [expectedContext]);
- processor.leaveContext('type', idB);
- assert.deepEqual(processor.activeContexts, []);
- });
-
- test('destroyContextEnteredWithMultipleTypes', function() {
- var processor = new ContextProcessor();
- var id = new tr.model.ScopedId('ptr', 123);
- processor.enterContext('A', id);
- processor.enterContext('B', id);
- processor.destroyContext(id);
- assert.deepEqual(processor.activeContexts, []);
- });
-
- test('destroyReenteredContext', function() {
- var processor = new ContextProcessor();
- var id = new tr.model.ScopedId('ptr', 123);
- processor.enterContext('type', id);
- processor.enterContext('type', id);
- processor.destroyContext(id);
- assert.deepEqual(processor.activeContexts, []);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/importer/empty_importer.html b/chromium/third_party/catapult/tracing/tracing/importer/empty_importer.html
deleted file mode 100644
index dc5f867b3ff..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/importer/empty_importer.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/importer/importer.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Base class for trace data importers.
- */
-tr.exportTo('tr.importer', function() {
- /**
- * Importer for empty strings and arrays.
- * @constructor
- */
- function EmptyImporter(events) {
- this.importPriority = 0;
- };
-
- EmptyImporter.canImport = function(eventData) {
- if (eventData instanceof Array && eventData.length == 0)
- return true;
- if (typeof(eventData) === 'string' || eventData instanceof String) {
- return eventData.length == 0;
- }
- return false;
- };
-
- EmptyImporter.prototype = {
- __proto__: tr.importer.Importer.prototype,
-
- get importerName() {
- return 'EmptyImporter';
- }
- };
-
- tr.importer.Importer.register(EmptyImporter);
-
- return {
- EmptyImporter: EmptyImporter
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/importer/find_input_expectations.html b/chromium/third_party/catapult/tracing/tracing/importer/find_input_expectations.html
deleted file mode 100644
index 36e77d32ba5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/importer/find_input_expectations.html
+++ /dev/null
@@ -1,1084 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range_utils.html">
-<link rel="import" href="/tracing/extras/chrome/cc/input_latency_async_slice.html">
-<link rel="import" href="/tracing/importer/proto_expectation.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.importer', function() {
- var ProtoExpectation = tr.importer.ProtoExpectation;
-
- var INPUT_TYPE = tr.e.cc.INPUT_EVENT_TYPE_NAMES;
-
- var KEYBOARD_TYPE_NAMES = [
- INPUT_TYPE.CHAR,
- INPUT_TYPE.KEY_DOWN_RAW,
- INPUT_TYPE.KEY_DOWN,
- INPUT_TYPE.KEY_UP
- ];
- var MOUSE_RESPONSE_TYPE_NAMES = [
- INPUT_TYPE.CLICK,
- INPUT_TYPE.CONTEXT_MENU
- ];
- var MOUSE_WHEEL_TYPE_NAMES = [
- INPUT_TYPE.MOUSE_WHEEL
- ];
- var MOUSE_DRAG_TYPE_NAMES = [
- INPUT_TYPE.MOUSE_DOWN,
- INPUT_TYPE.MOUSE_MOVE,
- INPUT_TYPE.MOUSE_UP
- ];
- var TAP_TYPE_NAMES = [
- INPUT_TYPE.TAP,
- INPUT_TYPE.TAP_CANCEL,
- INPUT_TYPE.TAP_DOWN
- ];
- var PINCH_TYPE_NAMES = [
- INPUT_TYPE.PINCH_BEGIN,
- INPUT_TYPE.PINCH_END,
- INPUT_TYPE.PINCH_UPDATE
- ];
- var FLING_TYPE_NAMES = [
- INPUT_TYPE.FLING_CANCEL,
- INPUT_TYPE.FLING_START
- ];
- var TOUCH_TYPE_NAMES = [
- INPUT_TYPE.TOUCH_END,
- INPUT_TYPE.TOUCH_MOVE,
- INPUT_TYPE.TOUCH_START
- ];
- var SCROLL_TYPE_NAMES = [
- INPUT_TYPE.SCROLL_BEGIN,
- INPUT_TYPE.SCROLL_END,
- INPUT_TYPE.SCROLL_UPDATE
- ];
- var ALL_HANDLED_TYPE_NAMES = [].concat(
- KEYBOARD_TYPE_NAMES,
- MOUSE_RESPONSE_TYPE_NAMES,
- MOUSE_WHEEL_TYPE_NAMES,
- MOUSE_DRAG_TYPE_NAMES,
- PINCH_TYPE_NAMES,
- TAP_TYPE_NAMES,
- FLING_TYPE_NAMES,
- TOUCH_TYPE_NAMES,
- SCROLL_TYPE_NAMES
- );
-
- var RENDERER_FLING_TITLE = 'InputHandlerProxy::HandleGestureFling::started';
-
- // TODO(benjhayden) share with rail_ir_finder
- var CSS_ANIMATION_TITLE = 'Animation';
-
- // If there's less than this much time between the end of one event and the
- // start of the next, then they might be merged.
- // There was not enough thought given to this value, so if you have any slight
- // reason to change it, then please do so. It might also be good to split this
- // into multiple values.
- var INPUT_MERGE_THRESHOLD_MS = 200;
- var ANIMATION_MERGE_THRESHOLD_MS = 32; // 2x 60FPS frames
-
- // If two MouseWheel events begin this close together, then they're an
- // Animation, not two responses.
- var MOUSE_WHEEL_THRESHOLD_MS = 40;
-
- // If two MouseMoves are more than this far apart, then they're two Responses,
- // not Animation.
- var MOUSE_MOVE_THRESHOLD_MS = 40;
-
- // Strings used to name IRs.
- var KEYBOARD_IR_NAME = 'Keyboard';
- var MOUSE_IR_NAME = 'Mouse';
- var MOUSEWHEEL_IR_NAME = 'MouseWheel';
- var TAP_IR_NAME = 'Tap';
- var PINCH_IR_NAME = 'Pinch';
- var FLING_IR_NAME = 'Fling';
- var TOUCH_IR_NAME = 'Touch';
- var SCROLL_IR_NAME = 'Scroll';
- var CSS_IR_NAME = 'CSS';
-
- // TODO(benjhayden) Find a better home for this.
- function compareEvents(x, y) {
- if (x.start !== y.start)
- return x.start - y.start;
- if (x.end !== y.end)
- return x.end - y.end;
- if (x.guid && y.guid)
- return x.guid - y.guid;
- return 0;
- }
-
- function forEventTypesIn(events, typeNames, cb, opt_this) {
- events.forEach(function(event) {
- if (typeNames.indexOf(event.typeName) >= 0) {
- cb.call(opt_this, event);
- }
- });
- }
-
- function causedFrame(event) {
- return event.associatedEvents.some(
- x => x.title === tr.model.helpers.IMPL_RENDERING_STATS);
- }
-
- function getSortedInputEvents(modelHelper) {
- var inputEvents = [];
-
- var browserProcess = modelHelper.browserHelper.process;
- var mainThread = browserProcess.findAtMostOneThreadNamed(
- 'CrBrowserMain');
- for (var slice of mainThread.asyncSliceGroup.getDescendantEvents()) {
- if (!slice.isTopLevel)
- continue;
-
- if (!(slice instanceof tr.e.cc.InputLatencyAsyncSlice))
- continue;
-
- // TODO(beaudoin): This should never happen but it does. Investigate
- // the trace linked at in #1567 and remove that when it's fixed.
- if (isNaN(slice.start) ||
- isNaN(slice.duration) ||
- isNaN(slice.end))
- continue;
-
- inputEvents.push(slice);
- }
-
- return inputEvents.sort(compareEvents);
- }
-
- function findProtoExpectations(modelHelper, sortedInputEvents) {
- var protoExpectations = [];
- // This order is not important. Handlers are independent.
- var handlers = [
- handleKeyboardEvents,
- handleMouseResponseEvents,
- handleMouseWheelEvents,
- handleMouseDragEvents,
- handleTapResponseEvents,
- handlePinchEvents,
- handleFlingEvents,
- handleTouchEvents,
- handleScrollEvents,
- handleCSSAnimations
- ];
- handlers.forEach(function(handler) {
- protoExpectations.push.apply(protoExpectations, handler(
- modelHelper, sortedInputEvents));
- });
- protoExpectations.sort(compareEvents);
- return protoExpectations;
- }
-
- // Every keyboard event is a Response.
- function handleKeyboardEvents(modelHelper, sortedInputEvents) {
- var protoExpectations = [];
- forEventTypesIn(sortedInputEvents, KEYBOARD_TYPE_NAMES, function(event) {
- var pe = new ProtoExpectation(
- ProtoExpectation.RESPONSE_TYPE, KEYBOARD_IR_NAME);
- pe.pushEvent(event);
- protoExpectations.push(pe);
- });
- return protoExpectations;
- }
-
- // Some mouse events can be translated directly into Responses.
- function handleMouseResponseEvents(modelHelper, sortedInputEvents) {
- var protoExpectations = [];
- forEventTypesIn(
- sortedInputEvents, MOUSE_RESPONSE_TYPE_NAMES, function(event) {
- var pe = new ProtoExpectation(
- ProtoExpectation.RESPONSE_TYPE, MOUSE_IR_NAME);
- pe.pushEvent(event);
- protoExpectations.push(pe);
- });
- return protoExpectations;
- }
-
- // MouseWheel events are caused either by a physical wheel on a physical
- // mouse, or by a touch-drag gesture on a track-pad. The physical wheel
- // causes MouseWheel events that are much more spaced out, and have no
- // chance of hitting 60fps, so they are each turned into separate Response
- // IRs. The track-pad causes MouseWheel events that are much closer
- // together, and are expected to be 60fps, so the first event in a sequence
- // is turned into a Response, and the rest are merged into an Animation.
- // NB this threshold uses the two events' start times, unlike
- // ProtoExpectation.isNear, which compares the end time of the previous event
- // with the start time of the next.
- function handleMouseWheelEvents(modelHelper, sortedInputEvents) {
- var protoExpectations = [];
- var currentPE = undefined;
- var prevEvent_ = undefined;
- forEventTypesIn(
- sortedInputEvents, MOUSE_WHEEL_TYPE_NAMES, function(event) {
- // Switch prevEvent in one place so that we can early-return later.
- var prevEvent = prevEvent_;
- prevEvent_ = event;
-
- if (currentPE &&
- (prevEvent.start + MOUSE_WHEEL_THRESHOLD_MS) >= event.start) {
- if (currentPE.irType === ProtoExpectation.ANIMATION_TYPE) {
- currentPE.pushEvent(event);
- } else {
- currentPE = new ProtoExpectation(ProtoExpectation.ANIMATION_TYPE,
- MOUSEWHEEL_IR_NAME);
- currentPE.pushEvent(event);
- protoExpectations.push(currentPE);
- }
- return;
- }
- currentPE = new ProtoExpectation(
- ProtoExpectation.RESPONSE_TYPE, MOUSEWHEEL_IR_NAME);
- currentPE.pushEvent(event);
- protoExpectations.push(currentPE);
- });
- return protoExpectations;
- }
-
- // Down events followed closely by Up events are click Responses, but the
- // Response doesn't start until the Up event.
- //
- // RRR
- // DDD UUU
- //
- // If there are any Move events in between a Down and an Up, then the Down
- // and the first Move are a Response, then the rest of the Moves are an
- // Animation:
- //
- // RRRRRRRAAAAAAAAAAAAAAAAAAAA
- // DDD MMM MMM MMM MMM MMM UUU
- //
- function handleMouseDragEvents(modelHelper, sortedInputEvents) {
- var protoExpectations = [];
- var currentPE = undefined;
- var mouseDownEvent = undefined;
- forEventTypesIn(
- sortedInputEvents, MOUSE_DRAG_TYPE_NAMES, function(event) {
- switch (event.typeName) {
- case INPUT_TYPE.MOUSE_DOWN:
- if (causedFrame(event)) {
- var pe = new ProtoExpectation(
- ProtoExpectation.RESPONSE_TYPE, MOUSE_IR_NAME);
- pe.pushEvent(event);
- protoExpectations.push(pe);
- } else {
- // Responses typically don't start until the mouse up event.
- // Add this MouseDown to the Response that starts at the MouseUp.
- mouseDownEvent = event;
- }
- break;
- // There may be more than 100ms between the start of the mouse down
- // and the start of the mouse up. Chrome and the web don't start to
- // respond until the mouse up. ResponseIRs start deducting comfort
- // at 100ms duration. If more than that 100ms duration is burned
- // through while waiting for the user to release the
- // mouse button, then ResponseIR will unfairly start deducting
- // comfort before Chrome even has a mouse up to respond to.
- // It is technically possible for a site to afford one response on
- // mouse down and another on mouse up, but that is an edge case. The
- // vast majority of mouse downs are not responses.
-
- case INPUT_TYPE.MOUSE_MOVE:
- if (!causedFrame(event)) {
- // Ignore MouseMoves that do not affect the screen. They are not
- // part of an interaction record by definition.
- var pe = new ProtoExpectation(ProtoExpectation.IGNORED_TYPE);
- pe.pushEvent(event);
- protoExpectations.push(pe);
- } else if (!currentPE ||
- !currentPE.isNear(event, MOUSE_MOVE_THRESHOLD_MS)) {
- // The first MouseMove after a MouseDown or after a while is a
- // Response.
- currentPE = new ProtoExpectation(
- ProtoExpectation.RESPONSE_TYPE, MOUSE_IR_NAME);
- currentPE.pushEvent(event);
- if (mouseDownEvent) {
- currentPE.associatedEvents.push(mouseDownEvent);
- mouseDownEvent = undefined;
- }
- protoExpectations.push(currentPE);
- } else {
- // Merge this event into an Animation.
- if (currentPE.irType === ProtoExpectation.ANIMATION_TYPE) {
- currentPE.pushEvent(event);
- } else {
- currentPE = new ProtoExpectation(
- ProtoExpectation.ANIMATION_TYPE, MOUSE_IR_NAME);
- currentPE.pushEvent(event);
- protoExpectations.push(currentPE);
- }
- }
- break;
-
- case INPUT_TYPE.MOUSE_UP:
- if (!mouseDownEvent) {
- var pe = new ProtoExpectation(
- causedFrame(event) ? ProtoExpectation.RESPONSE_TYPE :
- ProtoExpectation.IGNORED_TYPE,
- MOUSE_IR_NAME);
- pe.pushEvent(event);
- protoExpectations.push(pe);
- break;
- }
-
- if (currentPE) {
- currentPE.pushEvent(event);
- } else {
- currentPE = new ProtoExpectation(
- ProtoExpectation.RESPONSE_TYPE, MOUSE_IR_NAME);
- if (mouseDownEvent)
- currentPE.associatedEvents.push(mouseDownEvent);
- currentPE.pushEvent(event);
- protoExpectations.push(currentPE);
- }
- mouseDownEvent = undefined;
- currentPE = undefined;
- break;
- }
- });
- if (mouseDownEvent) {
- currentPE = new ProtoExpectation(ProtoExpectation.IGNORED_TYPE);
- currentPE.pushEvent(mouseDownEvent);
- protoExpectations.push(currentPE);
- }
- return protoExpectations;
- }
-
- // Solitary Tap events are simple Responses:
- //
- // RRR
- // TTT
- //
- // TapDowns are part of Responses.
- //
- // RRRRRRR
- // DDD TTT
- //
- // TapCancels are part of Responses, which seems strange. They always go
- // with scrolls, so they'll probably be merged with scroll Responses.
- // TapCancels can take a significant amount of time and account for a
- // significant amount of work, which should be grouped with the scroll IRs
- // if possible.
- //
- // RRRRRRR
- // DDD CCC
- //
- function handleTapResponseEvents(modelHelper, sortedInputEvents) {
- var protoExpectations = [];
- var currentPE = undefined;
- forEventTypesIn(sortedInputEvents, TAP_TYPE_NAMES, function(event) {
- switch (event.typeName) {
- case INPUT_TYPE.TAP_DOWN:
- currentPE = new ProtoExpectation(
- ProtoExpectation.RESPONSE_TYPE, TAP_IR_NAME);
- currentPE.pushEvent(event);
- protoExpectations.push(currentPE);
- break;
-
- case INPUT_TYPE.TAP:
- if (currentPE) {
- currentPE.pushEvent(event);
- } else {
- // Sometimes we get Tap events with no TapDown, sometimes we get
- // TapDown events. Handle both.
- currentPE = new ProtoExpectation(
- ProtoExpectation.RESPONSE_TYPE, TAP_IR_NAME);
- currentPE.pushEvent(event);
- protoExpectations.push(currentPE);
- }
- currentPE = undefined;
- break;
-
- case INPUT_TYPE.TAP_CANCEL:
- if (!currentPE) {
- var pe = new ProtoExpectation(ProtoExpectation.IGNORED_TYPE);
- pe.pushEvent(event);
- protoExpectations.push(pe);
- break;
- }
-
- if (currentPE.isNear(event, INPUT_MERGE_THRESHOLD_MS)) {
- currentPE.pushEvent(event);
- } else {
- currentPE = new ProtoExpectation(
- ProtoExpectation.RESPONSE_TYPE, TAP_IR_NAME);
- currentPE.pushEvent(event);
- protoExpectations.push(currentPE);
- }
- currentPE = undefined;
- break;
- }
- });
- return protoExpectations;
- }
-
- // The PinchBegin and the first PinchUpdate comprise a Response, then the
- // rest of the PinchUpdates comprise an Animation.
- //
- // RRRRRRRAAAAAAAAAAAAAAAAAAAA
- // BBB UUU UUU UUU UUU UUU EEE
- //
- function handlePinchEvents(modelHelper, sortedInputEvents) {
- var protoExpectations = [];
- var currentPE = undefined;
- var sawFirstUpdate = false;
- var modelBounds = modelHelper.model.bounds;
- forEventTypesIn(sortedInputEvents, PINCH_TYPE_NAMES, function(event) {
- switch (event.typeName) {
- case INPUT_TYPE.PINCH_BEGIN:
- if (currentPE &&
- currentPE.isNear(event, INPUT_MERGE_THRESHOLD_MS)) {
- currentPE.pushEvent(event);
- break;
- }
- currentPE = new ProtoExpectation(
- ProtoExpectation.RESPONSE_TYPE, PINCH_IR_NAME);
- currentPE.pushEvent(event);
- currentPE.isAnimationBegin = true;
- protoExpectations.push(currentPE);
- sawFirstUpdate = false;
- break;
-
- case INPUT_TYPE.PINCH_UPDATE:
- // Like ScrollUpdates, the Begin and the first Update constitute a
- // Response, then the rest of the Updates constitute an Animation
- // that begins when the Response ends. If the user pauses in the
- // middle of an extended pinch gesture, then multiple Animations
- // will be created.
- if (!currentPE ||
- ((currentPE.irType === ProtoExpectation.RESPONSE_TYPE) &&
- sawFirstUpdate) ||
- !currentPE.isNear(event, INPUT_MERGE_THRESHOLD_MS)) {
- currentPE = new ProtoExpectation(
- ProtoExpectation.ANIMATION_TYPE, PINCH_IR_NAME);
- currentPE.pushEvent(event);
- protoExpectations.push(currentPE);
- } else {
- currentPE.pushEvent(event);
- sawFirstUpdate = true;
- }
- break;
-
- case INPUT_TYPE.PINCH_END:
- if (currentPE) {
- currentPE.pushEvent(event);
- } else {
- var pe = new ProtoExpectation(ProtoExpectation.IGNORED_TYPE);
- pe.pushEvent(event);
- protoExpectations.push(pe);
- }
- currentPE = undefined;
- break;
- }
- });
- return protoExpectations;
- }
-
- // Flings are defined by 3 types of events: FlingStart, FlingCancel, and the
- // renderer fling event. Flings do not begin with a Response. Flings end
- // either at the beginning of a FlingCancel, or at the end of the renderer
- // fling event.
- //
- // AAAAAAAAAAAAAAAAAAAAAAAAAA
- // SSS
- // RRRRRRRRRRRRRRRRRRRRRR
- //
- //
- // AAAAAAAAAAA
- // SSS CCC
- //
- function handleFlingEvents(modelHelper, sortedInputEvents) {
- var protoExpectations = [];
- var currentPE = undefined;
-
- function isRendererFling(event) {
- return event.title === RENDERER_FLING_TITLE;
- }
- var browserHelper = modelHelper.browserHelper;
- var flingEvents = browserHelper.getAllAsyncSlicesMatching(
- isRendererFling);
-
- forEventTypesIn(sortedInputEvents, FLING_TYPE_NAMES, function(event) {
- flingEvents.push(event);
- });
- flingEvents.sort(compareEvents);
-
- flingEvents.forEach(function(event) {
- if (event.title === RENDERER_FLING_TITLE) {
- if (currentPE) {
- currentPE.pushEvent(event);
- } else {
- currentPE = new ProtoExpectation(
- ProtoExpectation.ANIMATION_TYPE, FLING_IR_NAME);
- currentPE.pushEvent(event);
- protoExpectations.push(currentPE);
- }
- return;
- }
-
- switch (event.typeName) {
- case INPUT_TYPE.FLING_START:
- if (currentPE) {
- console.error('Another FlingStart? File a bug with this trace!');
- currentPE.pushEvent(event);
- } else {
- currentPE = new ProtoExpectation(
- ProtoExpectation.ANIMATION_TYPE, FLING_IR_NAME);
- currentPE.pushEvent(event);
- // Set end to an invalid value so that it can be noticed and fixed
- // later.
- currentPE.end = 0;
- protoExpectations.push(currentPE);
- }
- break;
-
- case INPUT_TYPE.FLING_CANCEL:
- if (currentPE) {
- currentPE.pushEvent(event);
- // FlingCancel events start when TouchStart events start, which is
- // typically when a Response starts. FlingCancel events end when
- // chrome acknowledges them, not when they update the screen. So
- // there might be one more frame during the FlingCancel, after
- // this Animation ends. That won't affect the scoring algorithms,
- // and it will make the IRs look more correct if they don't
- // overlap unnecessarily.
- currentPE.end = event.start;
- currentPE = undefined;
- } else {
- var pe = new ProtoExpectation(ProtoExpectation.IGNORED_TYPE);
- pe.pushEvent(event);
- protoExpectations.push(pe);
- }
- break;
- }
- });
- // If there was neither a FLING_CANCEL nor a renderer fling after the
- // FLING_START, then assume that it ends at the end of the model, so set
- // the end of currentPE to the end of the model.
- if (currentPE && !currentPE.end)
- currentPE.end = modelHelper.model.bounds.max;
- return protoExpectations;
- }
-
- // The TouchStart and the first TouchMove comprise a Response, then the
- // rest of the TouchMoves comprise an Animation.
- //
- // RRRRRRRAAAAAAAAAAAAAAAAAAAA
- // SSS MMM MMM MMM MMM MMM EEE
- //
- // If there are no TouchMove events in between a TouchStart and a TouchEnd,
- // then it's just a Response.
- //
- // RRRRRRR
- // SSS EEE
- //
- function handleTouchEvents(modelHelper, sortedInputEvents) {
- var protoExpectations = [];
- var currentPE = undefined;
- var sawFirstMove = false;
- forEventTypesIn(sortedInputEvents, TOUCH_TYPE_NAMES, function(event) {
- switch (event.typeName) {
- case INPUT_TYPE.TOUCH_START:
- if (currentPE) {
- // NB: currentPE will probably be merged with something from
- // handlePinchEvents(). Multiple TouchStart events without an
- // intervening TouchEnd logically implies that multiple fingers
- // are on the screen, so this is probably a pinch gesture.
- currentPE.pushEvent(event);
- } else {
- currentPE = new ProtoExpectation(
- ProtoExpectation.RESPONSE_TYPE, TOUCH_IR_NAME);
- currentPE.pushEvent(event);
- currentPE.isAnimationBegin = true;
- protoExpectations.push(currentPE);
- sawFirstMove = false;
- }
- break;
-
- case INPUT_TYPE.TOUCH_MOVE:
- if (!currentPE) {
- currentPE = new ProtoExpectation(
- ProtoExpectation.ANIMATION_TYPE, TOUCH_IR_NAME);
- currentPE.pushEvent(event);
- protoExpectations.push(currentPE);
- break;
- }
-
- // Like Scrolls and Pinches, the Response is defined to be the
- // TouchStart plus the first TouchMove, then the rest of the
- // TouchMoves constitute an Animation.
- if ((sawFirstMove &&
- (currentPE.irType === ProtoExpectation.RESPONSE_TYPE)) ||
- !currentPE.isNear(event, INPUT_MERGE_THRESHOLD_MS)) {
- // If there's already a touchmove in the currentPE or it's not
- // near event, then finish it and start a new animation.
- var prevEnd = currentPE.end;
- currentPE = new ProtoExpectation(
- ProtoExpectation.ANIMATION_TYPE, TOUCH_IR_NAME);
- currentPE.pushEvent(event);
- // It's possible for there to be a gap between TouchMoves, but
- // that doesn't mean that there should be an Idle IR there.
- currentPE.start = prevEnd;
- protoExpectations.push(currentPE);
- } else {
- currentPE.pushEvent(event);
- sawFirstMove = true;
- }
- break;
-
- case INPUT_TYPE.TOUCH_END:
- if (!currentPE) {
- var pe = new ProtoExpectation(ProtoExpectation.IGNORED_TYPE);
- pe.pushEvent(event);
- protoExpectations.push(pe);
- break;
- }
- if (currentPE.isNear(event, INPUT_MERGE_THRESHOLD_MS)) {
- currentPE.pushEvent(event);
- } else {
- var pe = new ProtoExpectation(ProtoExpectation.IGNORED_TYPE);
- pe.pushEvent(event);
- protoExpectations.push(pe);
- }
- currentPE = undefined;
- break;
- }
- });
- return protoExpectations;
- }
-
- // The first ScrollBegin and the first ScrollUpdate comprise a Response,
- // then the rest comprise an Animation.
- //
- // RRRRRRRAAAAAAAAAAAAAAAAAAAA
- // BBB UUU UUU UUU UUU UUU EEE
- //
- function handleScrollEvents(modelHelper, sortedInputEvents) {
- var protoExpectations = [];
- var currentPE = undefined;
- var sawFirstUpdate = false;
- forEventTypesIn(sortedInputEvents, SCROLL_TYPE_NAMES, function(event) {
- switch (event.typeName) {
- case INPUT_TYPE.SCROLL_BEGIN:
- // Always begin a new PE even if there already is one, unlike
- // PinchBegin.
- currentPE = new ProtoExpectation(
- ProtoExpectation.RESPONSE_TYPE, SCROLL_IR_NAME);
- currentPE.pushEvent(event);
- currentPE.isAnimationBegin = true;
- protoExpectations.push(currentPE);
- sawFirstUpdate = false;
- break;
-
- case INPUT_TYPE.SCROLL_UPDATE:
- if (currentPE) {
- if (currentPE.isNear(event, INPUT_MERGE_THRESHOLD_MS) &&
- ((currentPE.irType === ProtoExpectation.ANIMATION_TYPE) ||
- !sawFirstUpdate)) {
- currentPE.pushEvent(event);
- sawFirstUpdate = true;
- } else {
- currentPE = new ProtoExpectation(ProtoExpectation.ANIMATION_TYPE,
- SCROLL_IR_NAME);
- currentPE.pushEvent(event);
- protoExpectations.push(currentPE);
- }
- } else {
- // ScrollUpdate without ScrollBegin.
- currentPE = new ProtoExpectation(
- ProtoExpectation.ANIMATION_TYPE, SCROLL_IR_NAME);
- currentPE.pushEvent(event);
- protoExpectations.push(currentPE);
- }
- break;
-
- case INPUT_TYPE.SCROLL_END:
- if (!currentPE) {
- console.error('ScrollEnd without ScrollUpdate? ' +
- 'File a bug with this trace!');
- var pe = new ProtoExpectation(ProtoExpectation.IGNORED_TYPE);
- pe.pushEvent(event);
- protoExpectations.push(pe);
- break;
- }
- currentPE.pushEvent(event);
- break;
- }
- });
- return protoExpectations;
- }
-
- // CSS Animations are merged into AnimationExpectations when they intersect.
- function handleCSSAnimations(modelHelper, sortedInputEvents) {
- // First find all the top-level CSS Animation async events.
- var animationEvents = modelHelper.browserHelper.
- getAllAsyncSlicesMatching(function(event) {
- return ((event.title === CSS_ANIMATION_TITLE) &&
- event.isTopLevel &&
- (event.duration > 0));
- });
-
- // Memoize the frame events per process.
- // There may be many Animation events for each process. We can save a
- // significant amount of processing time by avoiding re-computing them for
- // each animation.
- var framesForProcess = {};
-
- function getFramesForAnimationProcess(animation) {
- var frames = framesForProcess[animation.parentContainer.parent.guid];
- if (frames === undefined) {
- var rendererHelper = new tr.model.helpers.ChromeRendererHelper(
- modelHelper, animation.parentContainer.parent);
- // Collect all the frame events in the same renderer process as the css
- // animation, and memoize them.
- frames = rendererHelper.getFrameEventsInRange(
- tr.model.helpers.IMPL_FRAMETIME_TYPE, modelHelper.model.bounds);
- framesForProcess[animation.parentContainer.parent.guid] = frames;
- }
- return frames;
- }
-
- // Time ranges where animations are actually running will be collected here.
- // Each element will contain {min, max, animation, frames}.
- var animationRanges = [];
-
- // This helper function will be called when a time range is found
- // during which the animation is actually running.
- // This helper function collects the frames that happened during the time
- // range, and pushes it all to |animationRanges|.
- function pushAnimationRange(start, end, animation) {
- var range = tr.b.Range.fromExplicitRange(start, end);
- range.animation = animation;
-
- // Collect the frames that happened while the animation was running.
- // A more general way to find these frames would be to collect all of
- // the trace events caused by this animation, but that will require
- // adding flow events to chrome:
- // https://github.com/catapult-project/catapult/issues/1433
- range.frames = range.filterArray(
- getFramesForAnimationProcess(animation),
- function(frameEvent) { return frameEvent.start; });
-
- // If a tree falls in a forest...
- // If there were not actually any frames while the animation was
- // running, then it wasn't really an animation, now, was it?
- // Philosophy aside, the system_health Animation metrics fail hard if
- // there are no frames in an AnimationExpectation.
- if (range.frames.length === 0)
- return;
-
- animationRanges.push(range);
- }
-
- animationEvents.forEach(function(animation) {
- if (animation.subSlices.length === 0) {
- pushAnimationRange(animation.start, animation.end, animation);
- } else {
- // Now run a state machine over the animation's subSlices, which
- // indicate the animations running/paused/finished states, in order to
- // find ranges where the animation was actually running.
- var start = undefined;
- animation.subSlices.forEach(function(sub) {
- if ((sub.args.state === 'running') &&
- (start === undefined)) {
- // It's possible for the state to alternate between running and
- // pending, but the animation is still running in that case,
- // so only set start if the state is changing from one of the halted
- // states.
- start = sub.start;
- } else if ((sub.args.state === 'paused') ||
- (sub.args.state === 'idle') ||
- (sub.args.state === 'finished')) {
- if (start === undefined) {
- // An animation was already running when the trace started.
- // (Actually, it's possible that the animation was in the 'idle'
- // state when tracing started, but that should be rare, and will
- // be fixed when async events are buffered.)
- // http://crbug.com/565627
- start = modelHelper.model.bounds.min;
- }
-
- pushAnimationRange(start, sub.start, animation);
- start = undefined;
- }
- });
-
- // An animation was still running when the trace ended.
- if (start !== undefined)
- pushAnimationRange(start, modelHelper.model.bounds.max, animation);
- }
- });
-
- // Now we have a set of time ranges when css animations were actually
- // running, along with their frames.
- // Now all that's left for this function is to merge over-lapping ranges
- // into ProtoExpectations.
-
- function merge(ranges) {
- var protoExpectation = new ProtoExpectation(
- ProtoExpectation.ANIMATION_TYPE, CSS_IR_NAME);
- ranges.forEach(function(range) {
- protoExpectation.start = Math.min(protoExpectation.start, range.min);
- protoExpectation.end = Math.max(protoExpectation.end, range.max);
- protoExpectation.associatedEvents.push(range.animation);
- protoExpectation.associatedEvents.addEventSet(range.frames);
- });
- return protoExpectation;
- }
-
- return tr.b.mergeRanges(animationRanges,
- ANIMATION_MERGE_THRESHOLD_MS,
- merge);
- }
-
- function postProcessProtoExpectations(protoExpectations) {
- // protoExpectations is input only. Returns a modified set of
- // ProtoExpectations. The order is important.
- protoExpectations = mergeIntersectingResponses(protoExpectations);
- protoExpectations = mergeIntersectingAnimations(protoExpectations);
- protoExpectations = fixResponseAnimationStarts(protoExpectations);
- protoExpectations = fixTapResponseTouchAnimations(protoExpectations);
- return protoExpectations;
- }
-
- // TouchStarts happen at the same time as ScrollBegins.
- // It's easier to let multiple handlers create multiple overlapping
- // Responses and then merge them, rather than make the handlers aware of the
- // other handlers' PEs.
- //
- // For example:
- // RR
- // RRR -> RRRRR
- // RR
- //
- // protoExpectations is input only.
- // Returns a modified set of ProtoExpectations.
- function mergeIntersectingResponses(protoExpectations) {
- var newPEs = [];
- while (protoExpectations.length) {
- var pe = protoExpectations.shift();
- newPEs.push(pe);
-
- // Only consider Responses for now.
- if (pe.irType !== ProtoExpectation.RESPONSE_TYPE)
- continue;
-
- for (var i = 0; i < protoExpectations.length; ++i) {
- var otherPE = protoExpectations[i];
-
- if (otherPE.irType !== pe.irType)
- continue;
-
- if (!otherPE.intersects(pe))
- continue;
-
- // Don't merge together Responses of the same type.
- // If handleTouchEvents wanted two of its Responses to be merged, then
- // it would have made them that way to begin with.
- var typeNames = pe.associatedEvents.map(function(event) {
- return event.typeName;
- });
- if (otherPE.containsTypeNames(typeNames))
- continue;
-
- pe.merge(otherPE);
- protoExpectations.splice(i, 1);
- // Don't skip the next otherPE!
- --i;
- }
- }
- return newPEs;
- }
-
- // An animation is simply an expectation of 60fps between start and end.
- // If two animations overlap, then merge them.
- //
- // For example:
- // AA
- // AAA -> AAAAA
- // AA
- //
- // protoExpectations is input only.
- // Returns a modified set of ProtoExpectations.
- function mergeIntersectingAnimations(protoExpectations) {
- var newPEs = [];
- while (protoExpectations.length) {
- var pe = protoExpectations.shift();
- newPEs.push(pe);
-
- // Only consider Animations for now.
- if (pe.irType !== ProtoExpectation.ANIMATION_TYPE)
- continue;
-
- var isCSS = pe.containsSliceTitle(CSS_ANIMATION_TITLE);
- var isFling = pe.containsTypeNames([INPUT_TYPE.FLING_START]);
-
- for (var i = 0; i < protoExpectations.length; ++i) {
- var otherPE = protoExpectations[i];
-
- if (otherPE.irType !== pe.irType)
- continue;
-
- // Don't merge CSS Animations with any other types.
- if (isCSS != otherPE.containsSliceTitle(CSS_ANIMATION_TITLE))
- continue;
-
- if (!otherPE.intersects(pe))
- continue;
-
- // Don't merge Fling Animations with any other types.
- if (isFling != otherPE.containsTypeNames([INPUT_TYPE.FLING_START]))
- continue;
-
- pe.merge(otherPE);
- protoExpectations.splice(i, 1);
- // Don't skip the next otherPE!
- --i;
- }
- }
- return newPEs;
- }
-
- // The ends of responses frequently overlap the starts of animations.
- // Fix the animations to reflect the fact that the user can only start to
- // expect 60fps after the response.
- //
- // For example:
- // RRR -> RRRAA
- // AAAA
- //
- // protoExpectations is input only.
- // Returns a modified set of ProtoExpectations.
- function fixResponseAnimationStarts(protoExpectations) {
- protoExpectations.forEach(function(ape) {
- // Only consider animations for now.
- if (ape.irType !== ProtoExpectation.ANIMATION_TYPE)
- return;
-
- protoExpectations.forEach(function(rpe) {
- // Only consider responses for now.
- if (rpe.irType !== ProtoExpectation.RESPONSE_TYPE)
- return;
-
- // Only consider responses that end during the animation.
- if (!ape.containsTimestampInclusive(rpe.end))
- return;
-
- // Ignore Responses that are entirely contained by the animation.
- if (ape.containsTimestampInclusive(rpe.start))
- return;
-
- // Move the animation start to the response end.
- ape.start = rpe.end;
- });
- });
- return protoExpectations;
- }
-
- // Merge Tap Responses that overlap Touch-only Animations.
- // https://github.com/catapult-project/catapult/issues/1431
- function fixTapResponseTouchAnimations(protoExpectations) {
- function isTapResponse(pe) {
- return (pe.irType === ProtoExpectation.RESPONSE_TYPE) &&
- pe.containsTypeNames([INPUT_TYPE.TAP]);
- }
- function isTouchAnimation(pe) {
- return (pe.irType === ProtoExpectation.ANIMATION_TYPE) &&
- pe.containsTypeNames([INPUT_TYPE.TOUCH_MOVE]) &&
- !pe.containsTypeNames([
- INPUT_TYPE.SCROLL_UPDATE, INPUT_TYPE.PINCH_UPDATE]);
- }
- var newPEs = [];
- while (protoExpectations.length) {
- var pe = protoExpectations.shift();
- newPEs.push(pe);
-
- // protoExpectations are sorted by start time, and we don't know whether
- // the Tap Response or the Touch Animation will be first
- var peIsTapResponse = isTapResponse(pe);
- var peIsTouchAnimation = isTouchAnimation(pe);
- if (!peIsTapResponse && !peIsTouchAnimation)
- continue;
-
- for (var i = 0; i < protoExpectations.length; ++i) {
- var otherPE = protoExpectations[i];
-
- if (!otherPE.intersects(pe))
- continue;
-
- if (peIsTapResponse && !isTouchAnimation(otherPE))
- continue;
-
- if (peIsTouchAnimation && !isTapResponse(otherPE))
- continue;
-
- // pe might be the Touch Animation, but the merged ProtoExpectation
- // should be a Response.
- pe.irType = ProtoExpectation.RESPONSE_TYPE;
-
- pe.merge(otherPE);
- protoExpectations.splice(i, 1);
- // Don't skip the next otherPE!
- --i;
- }
- }
- return newPEs;
- }
-
- // Check that none of the handlers accidentally ignored an input event.
- function checkAllInputEventsHandled(sortedInputEvents, protoExpectations) {
- var handledEvents = [];
- protoExpectations.forEach(function(protoExpectation) {
- protoExpectation.associatedEvents.forEach(function(event) {
- // Ignore CSS Animations that might have multiple active ranges.
- if ((event.title === CSS_ANIMATION_TITLE) &&
- (event.subSlices.length > 0))
- return;
-
- if (handledEvents.indexOf(event) >= 0) {
- console.error('double-handled event', event.typeName,
- parseInt(event.start), parseInt(event.end), protoExpectation);
- return;
- }
- handledEvents.push(event);
- });
- });
-
- sortedInputEvents.forEach(function(event) {
- if (handledEvents.indexOf(event) < 0) {
- console.error('UNHANDLED INPUT EVENT!',
- event.typeName, parseInt(event.start), parseInt(event.end));
- }
- });
- }
-
- // Find ProtoExpectations, post-process them, convert them to real IRs.
- function findInputExpectations(modelHelper) {
- var sortedInputEvents = getSortedInputEvents(modelHelper);
- var protoExpectations = findProtoExpectations(
- modelHelper, sortedInputEvents);
- protoExpectations = postProcessProtoExpectations(protoExpectations);
- checkAllInputEventsHandled(sortedInputEvents, protoExpectations);
-
- var irs = [];
- protoExpectations.forEach(function(protoExpectation) {
- var ir = protoExpectation.createInteractionRecord(modelHelper.model);
- if (ir)
- irs.push(ir);
- });
- return irs;
- }
-
- return {
- findInputExpectations: findInputExpectations,
- compareEvents: compareEvents,
- CSS_ANIMATION_TITLE: CSS_ANIMATION_TITLE
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/importer/find_load_expectations.html b/chromium/third_party/catapult/tracing/tracing/importer/find_load_expectations.html
deleted file mode 100644
index c9135599c8c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/importer/find_load_expectations.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/user_model/load_expectation.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.importer', function() {
- // This global instant event marks the start of a navigation.
- var NAVIGATION_START = 'NavigationTiming navigationStart';
-
- // This render-process instant event marks the first contentful paint in a
- // main frame.
- var FIRST_CONTENTFUL_PAINT_TITLE = 'firstContentfulPaint';
-
- function findLoadExpectations(modelHelper) {
- var events = [];
- for (var event of modelHelper.model.getDescendantEvents()) {
- if ((event.title === NAVIGATION_START) ||
- (event.title === FIRST_CONTENTFUL_PAINT_TITLE))
- events.push(event);
- }
- events.sort(tr.importer.compareEvents);
-
- var loads = [];
- var startEvent = undefined;
- // TODO(alexandermont): What's supposed to happen if there are two
- // NAVIGATION_STARTs with no FIRST_CONTENTFUL_PAINT_TITLE between
- // them? Are you supposed to just "lose" the first NAVIGATION_START,
- // like what's happening now?
- for (var event of events) {
- if (event.title === NAVIGATION_START) {
- startEvent = event;
- } else if (event.title === FIRST_CONTENTFUL_PAINT_TITLE) {
- if (startEvent) {
- loads.push(new tr.model.um.LoadExpectation(
- modelHelper.model, tr.model.um.LOAD_SUBTYPE_NAMES.SUCCESSFUL,
- startEvent.start, event.start - startEvent.start));
- startEvent = undefined;
- }
- }
- }
-
- // If the trace ended between navigation start and first contentful paint,
- // then make a LoadExpectation that ends at the end of the trace.
- if (startEvent) {
- loads.push(new tr.model.um.LoadExpectation(
- modelHelper.model, tr.model.um.LOAD_SUBTYPE_NAMES.SUCCESSFUL,
- startEvent.start, modelHelper.model.bounds.max - startEvent.start));
- }
-
- return loads;
- }
-
- return {
- findLoadExpectations: findLoadExpectations
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/importer/find_startup_expectations.html b/chromium/third_party/catapult/tracing/tracing/importer/find_startup_expectations.html
deleted file mode 100644
index 01fc9d7153e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/importer/find_startup_expectations.html
+++ /dev/null
@@ -1,89 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/user_model/startup_expectation.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.importer', function() {
- function getAllFrameEvents(modelHelper) {
- var frameEvents = [];
- frameEvents.push.apply(frameEvents,
- modelHelper.browserHelper.getFrameEventsInRange(
- tr.model.helpers.IMPL_FRAMETIME_TYPE, modelHelper.model.bounds));
-
- tr.b.iterItems(modelHelper.rendererHelpers, function(pid, renderer) {
- frameEvents.push.apply(frameEvents, renderer.getFrameEventsInRange(
- tr.model.helpers.IMPL_FRAMETIME_TYPE, modelHelper.model.bounds));
- });
- return frameEvents.sort(tr.importer.compareEvents);
- }
-
- // If a thread contains a typical initialization slice, then the first event
- // on that thread is a startup event.
- function getStartupEvents(modelHelper) {
- function isStartupSlice(slice) {
- return slice.title === 'BrowserMainLoop::CreateThreads';
- }
- var events = modelHelper.browserHelper.getAllAsyncSlicesMatching(
- isStartupSlice);
- var deduper = new tr.model.EventSet();
- events.forEach(function(event) {
- var sliceGroup = event.parentContainer.sliceGroup;
- var slice = sliceGroup && sliceGroup.findFirstSlice();
- if (slice)
- deduper.push(slice);
- });
- return deduper.toArray();
- }
-
- // Match every event in |openingEvents| to the first following event from
- // |closingEvents| and return an array containing a load interaction record
- // for each pair.
- function findStartupExpectations(modelHelper) {
- var openingEvents = getStartupEvents(modelHelper);
- var closingEvents = getAllFrameEvents(modelHelper);
- var startups = [];
- openingEvents.forEach(function(openingEvent) {
- closingEvents.forEach(function(closingEvent) {
- // Ignore opening event that already have a closing event.
- if (openingEvent.closingEvent)
- return;
-
- // Ignore closing events that already belong to an opening event.
- if (closingEvent.openingEvent)
- return;
-
- // Ignore closing events before |openingEvent|.
- if (closingEvent.start <= openingEvent.start)
- return;
-
- // Ignore events from different threads.
- if (openingEvent.parentContainer.parent.pid !==
- closingEvent.parentContainer.parent.pid)
- return;
-
- // This is the first closing event for this opening event, record it.
- openingEvent.closingEvent = closingEvent;
- closingEvent.openingEvent = openingEvent;
- var se = new tr.model.um.StartupExpectation(
- modelHelper.model, openingEvent.start,
- closingEvent.end - openingEvent.start);
- se.associatedEvents.push(openingEvent);
- se.associatedEvents.push(closingEvent);
- startups.push(se);
- });
- });
- return startups;
- }
-
- return {
- findStartupExpectations: findStartupExpectations
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/importer/import.html b/chromium/third_party/catapult/tracing/tracing/importer/import.html
deleted file mode 100644
index 8fe21637c8c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/importer/import.html
+++ /dev/null
@@ -1,395 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel='import' href='/tracing/base/base.html'>
-<link rel='import' href='/tracing/base/timing.html'>
-<link rel="import" href="/tracing/importer/empty_importer.html">
-<link rel="import" href="/tracing/importer/importer.html">
-<link rel="import" href="/tracing/importer/user_model_builder.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.importer', function() {
- var Timing = tr.b.Timing;
-
- function ImportOptions() {
- this.shiftWorldToZero = true;
- this.pruneEmptyContainers = true;
- this.showImportWarnings = true;
- this.trackDetailedModelStats = false;
-
- // Callback called after
- // importers run in which more data can be added to the model, before it is
- // finalized.
- this.customizeModelCallback = undefined;
-
- var auditorTypes = tr.c.Auditor.getAllRegisteredTypeInfos();
- this.auditorConstructors = auditorTypes.map(function(typeInfo) {
- return typeInfo.constructor;
- });
- }
-
- function Import(model, opt_options) {
- if (model === undefined)
- throw new Error('Must provide model to import into.');
-
- // TODO(dsinclair): Check the model is empty.
-
- this.importing_ = false;
- this.importOptions_ = opt_options || new ImportOptions();
-
- this.model_ = model;
- this.model_.importOptions = this.importOptions_;
- }
-
- Import.prototype = {
- __proto__: Object.prototype,
-
- /**
- * Imports the provided traces into the model. The eventData type
- * is undefined and will be passed to all the importers registered
- * via Importer.register. The first importer that returns true
- * for canImport(events) will be used to import the events.
- *
- * The primary trace is provided via the eventData variable. If multiple
- * traces are to be imported, specify the first one as events, and the
- * remainder in the opt_additionalEventData array.
- *
- * @param {Array} traces An array of eventData to be imported. Each
- * eventData should correspond to a single trace file and will be handled by
- * a separate importer.
- */
- importTraces: function(traces) {
- var progressMeter = {
- update: function(msg) {}
- };
-
- tr.b.Task.RunSynchronously(
- this.createImportTracesTask(progressMeter, traces));
- },
-
- /**
- * Imports a trace with the usual options from importTraces, but
- * does so using idle callbacks, putting up an import dialog
- * during the import process.
- */
- importTracesWithProgressDialog: function(traces) {
- if (tr.isHeadless)
- throw new Error('Cannot use this method in headless mode.');
-
- var overlay = tr.ui.b.Overlay();
- overlay.title = 'Importing...';
- overlay.userCanClose = false;
- overlay.msgEl = document.createElement('div');
- overlay.appendChild(overlay.msgEl);
- overlay.msgEl.style.margin = '20px';
- overlay.update = function(msg) {
- this.msgEl.textContent = msg;
- };
- overlay.visible = true;
-
- var promise =
- tr.b.Task.RunWhenIdle(this.createImportTracesTask(overlay, traces));
- promise.then(
- function() { overlay.visible = false; },
- function(err) { overlay.visible = false; }
- );
- return promise;
- },
-
- /**
- * Creates a task that will import the provided traces into the model,
- * updating the progressMeter as it goes. Parameters are as defined in
- * importTraces.
- */
- createImportTracesTask: function(progressMeter, traces) {
- if (this.importing_)
- throw new Error('Already importing.');
- this.importing_ = true;
-
- // Just some simple setup. It is useful to have a no-op first
- // task so that we can set up the lastTask = lastTask.after()
- // pattern that follows.
- var importTask = new tr.b.Task(function prepareImport() {
- progressMeter.update('I will now import your traces for you...');
- }, this);
- var lastTask = importTask;
-
- var importers = [];
-
- lastTask = lastTask.timedAfter('TraceImport', function createImports() {
- // Copy the traces array, we may mutate it.
- traces = traces.slice(0);
- progressMeter.update('Creating importers...');
- // Figure out which importers to use.
- for (var i = 0; i < traces.length; ++i)
- importers.push(this.createImporter_(traces[i]));
-
- // Some traces have other traces inside them. Before doing the full
- // import, ask the importer if it has any subtraces, and if so, create
- // importers for them, also.
- for (var i = 0; i < importers.length; i++) {
- var subtraces = importers[i].extractSubtraces();
- for (var j = 0; j < subtraces.length; j++) {
- try {
- traces.push(subtraces[j]);
- importers.push(this.createImporter_(subtraces[j]));
- } catch (error) {
- // TODO(kphanee): Log the subtrace file which has failed.
- console.warn(error.name + ': ' + error.message);
- continue;
- }
- }
- }
-
- if (traces.length && !this.hasEventDataDecoder_(importers)) {
- throw new Error(
- 'Could not find an importer for the provided eventData.');
- }
-
- // Sort them on priority. This ensures importing happens in a
- // predictable order, e.g. ftrace_importer before
- // trace_event_importer.
- importers.sort(function(x, y) {
- return x.importPriority - y.importPriority;
- });
- }, this);
-
- // We import clock sync markers before all other events. This is necessary
- // because we need the clock sync markers in order to know by how much we
- // need to shift the timestamps of other events.
- lastTask = lastTask.timedAfter('TraceImport',
- function importClockSyncMarkers(task) {
- importers.forEach(function(importer, index) {
- task.subTask(Timing.wrapNamedFunction(
- 'TraceImport', importer.importerName,
- function runImportClockSyncMarkersOnOneImporter() {
- progressMeter.update(
- 'Importing clock sync markers ' + (index + 1) + ' of ' +
- importers.length);
- importer.importClockSyncMarkers();
- }), this);
- }, this);
- }, this);
-
- // Run the import.
- lastTask = lastTask.timedAfter('TraceImport', function runImport(task) {
- importers.forEach(function(importer, index) {
- task.subTask(Timing.wrapNamedFunction(
- 'TraceImport', importer.importerName,
- function runImportEventsOnOneImporter() {
- progressMeter.update(
- 'Importing ' + (index + 1) + ' of ' + importers.length);
- importer.importEvents();
- }), this);
- }, this);
- }, this);
-
- // Run the cusomizeModelCallback if needed.
- if (this.importOptions_.customizeModelCallback) {
- lastTask = lastTask.timedAfter('TraceImport',
- function runCustomizeCallbacks(task) {
- this.importOptions_.customizeModelCallback(this.model_);
- }, this);
- }
-
- // Import sample data.
- lastTask = lastTask.timedAfter('TraceImport',
- function importSampleData(task) {
- importers.forEach(function(importer, index) {
- progressMeter.update(
- 'Importing sample data ' + (index + 1) + '/' + importers.length);
- importer.importSampleData();
- }, this);
- }, this);
-
- // Autoclose open slices and create subSlices.
- lastTask = lastTask.timedAfter('TraceImport', function runAutoclosers() {
- progressMeter.update('Autoclosing open slices...');
- this.model_.autoCloseOpenSlices();
- this.model_.createSubSlices();
- }, this);
-
- // Finalize import.
- lastTask = lastTask.timedAfter('TraceImport',
- function finalizeImport(task) {
- importers.forEach(function(importer, index) {
- progressMeter.update(
- 'Finalizing import ' + (index + 1) + '/' + importers.length);
- importer.finalizeImport();
- }, this);
- }, this);
-
- // Run preinit.
- lastTask = lastTask.timedAfter('TraceImport', function runPreinits() {
- progressMeter.update('Initializing objects (step 1/2)...');
- this.model_.preInitializeObjects();
- }, this);
-
- // Prune empty containers.
- if (this.importOptions_.pruneEmptyContainers) {
- lastTask = lastTask.timedAfter('TraceImport',
- function runPruneEmptyContainers() {
- progressMeter.update('Pruning empty containers...');
- this.model_.pruneEmptyContainers();
- }, this);
- }
-
- // Merge kernel and userland slices on each thread.
- lastTask = lastTask.timedAfter('TraceImport',
- function runMergeKernelWithuserland() {
- progressMeter.update('Merging kernel with userland...');
- this.model_.mergeKernelWithUserland();
- }, this);
-
- // Create auditors
- var auditors = [];
- lastTask = lastTask.timedAfter('TraceImport',
- function createAuditorsAndRunAnnotate() {
- progressMeter.update('Adding arbitrary data to model...');
- auditors = this.importOptions_.auditorConstructors.map(
- function(auditorConstructor) {
- return new auditorConstructor(this.model_);
- }, this);
- auditors.forEach(function(auditor) {
- auditor.runAnnotate();
- auditor.installUserFriendlyCategoryDriverIfNeeded();
- });
- }, this);
-
- lastTask = lastTask.timedAfter('TraceImport',
- function computeWorldBounds() {
- progressMeter.update('Computing final world bounds...');
- this.model_.computeWorldBounds(this.importOptions_.shiftWorldToZero);
- }, this);
-
- // Build the flow event interval tree.
- lastTask = lastTask.timedAfter('TraceImport',
- function buildFlowEventIntervalTree() {
- progressMeter.update('Building flow event map...');
- this.model_.buildFlowEventIntervalTree();
- }, this);
-
- // Join refs.
- lastTask = lastTask.timedAfter('TraceImport', function joinRefs() {
- progressMeter.update('Joining object refs...');
- this.model_.joinRefs();
- }, this);
-
- // Delete any undeleted objects.
- lastTask = lastTask.timedAfter('TraceImport',
- function cleanupUndeletedObjects() {
- progressMeter.update('Cleaning up undeleted objects...');
- this.model_.cleanupUndeletedObjects();
- }, this);
-
- // Sort global and process memory dumps.
- lastTask = lastTask.timedAfter('TraceImport', function sortMemoryDumps() {
- progressMeter.update('Sorting memory dumps...');
- this.model_.sortMemoryDumps();
- }, this);
-
- // Finalize memory dump graphs.
- lastTask = lastTask.timedAfter('TraceImport',
- function finalizeMemoryGraphs() {
- progressMeter.update('Finalizing memory dump graphs...');
- this.model_.finalizeMemoryGraphs();
- }, this);
-
- // Run initializers.
- lastTask = lastTask.timedAfter('TraceImport',
- function initializeObjects() {
- progressMeter.update('Initializing objects (step 2/2)...');
- this.model_.initializeObjects();
- }, this);
-
- // Build event indices mapping from an event id to all flow events.
- lastTask = lastTask.timedAfter('TraceImport',
- function buildEventIndices() {
- progressMeter.update('Building event indices...');
- this.model_.buildEventIndices();
- }, this);
-
- // Build the UserModel.
- lastTask = lastTask.timedAfter('TraceImport', function buildUserModel() {
- progressMeter.update('Building UserModel...');
- var userModelBuilder = new tr.importer.UserModelBuilder(this.model_);
- userModelBuilder.buildUserModel();
- }, this);
-
- // Sort Expectations.
- lastTask = lastTask.timedAfter('TraceImport',
- function sortExpectations() {
- progressMeter.update('Sorting user expectations...');
- this.model_.userModel.sortExpectations();
- }, this);
-
- // Run audits.
- lastTask = lastTask.timedAfter('TraceImport', function runAudits() {
- progressMeter.update('Running auditors...');
- auditors.forEach(function(auditor) {
- auditor.runAudit();
- });
- }, this);
-
- lastTask = lastTask.timedAfter('TraceImport', function sortAlerts() {
- progressMeter.update('Updating alerts...');
- this.model_.sortAlerts();
- }, this);
-
- lastTask = lastTask.timedAfter('TraceImport',
- function lastUpdateBounds() {
- progressMeter.update('Update bounds...');
- this.model_.updateBounds();
- }, this);
-
- lastTask = lastTask.timedAfter('TraceImport',
- function addModelWarnings() {
- progressMeter.update('Looking for warnings...');
- // Log an import warning if the clock is low resolution.
- if (!this.model_.isTimeHighResolution) {
- this.model_.importWarning({
- type: 'low_resolution_timer',
- message: 'Trace time is low resolution, trace may be unusable.',
- showToUser: true
- });
- }
- }, this);
-
- // Cleanup.
- lastTask.after(function() {
- this.importing_ = false;
- }, this);
- return importTask;
- },
-
- createImporter_: function(eventData) {
- var importerConstructor = tr.importer.Importer.findImporterFor(eventData);
- if (!importerConstructor) {
- throw new Error('Couldn\'t create an importer for the provided ' +
- 'eventData.');
- }
- return new importerConstructor(this.model_, eventData);
- },
-
- hasEventDataDecoder_: function(importers) {
- for (var i = 0; i < importers.length; ++i) {
- if (!importers[i].isTraceDataContainer())
- return true;
- }
-
- return false;
- }
- };
-
- return {
- ImportOptions: ImportOptions,
- Import: Import
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/importer/import_test.html b/chromium/third_party/catapult/tracing/tracing/importer/import_test.html
deleted file mode 100644
index a6e11b73241..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/importer/import_test.html
+++ /dev/null
@@ -1,216 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base64.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/extras/importer/zip_importer.html">
-<link rel="import" href="/tracing/extras/importer/v8/v8_log_importer.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Base64 = tr.b.Base64;
-
- test('canImportEmpty', function() {
- var m = tr.c.TestUtils.newModelWithEvents([]);
- assert.isDefined(m.modelIndices);
- m = new tr.Model('');
- });
-
- test('canImportSubtraces', function() {
- var systraceLines = [
- 'SurfaceFlinger-2 [001] ...1 1000.0: 0: B|1|taskA',
- 'SurfaceFlinger-2 [001] ...1 2000.0: 0: E',
- ' chrome-3 [001] ...1 2000.0: 0: trace_event_clock_sync: ' +
- 'parent_ts=0'
- ];
- var traceEvents = [
- {ts: 1000, pid: 1, tid: 3, ph: 'B', cat: 'c', name: 'taskB', args: {
- my_object: {id_ref: '0x1000'}
- }},
- {ts: 2000, pid: 1, tid: 3, ph: 'E', cat: 'c', name: 'taskB', args: {}}
- ];
-
- var combined = JSON.stringify({
- traceEvents: traceEvents,
- systemTraceEvents: systraceLines.join('\n')
- });
-
- var m = tr.c.TestUtils.newModelWithEvents([combined]);
- assert.equal(tr.b.dictionaryValues(m.processes).length, 1);
-
- var p1 = m.processes[1];
- assert.isDefined(p1);
-
- var t2 = p1.threads[2];
- var t3 = p1.threads[3];
- assert.isDefined(t2);
- assert.isDefined(t3);
-
- assert.equal(1, 1, t2.sliceGroup.length);
- assert.equal(t2.sliceGroup.slices[0].title, 'taskA');
-
- assert.equal(t3.sliceGroup.length, 1);
- assert.equal(t3.sliceGroup.slices[0].title, 'taskB');
- });
-
- test('canImportCompressedSingleSubtrace', function() {
- var compressedTrace = Base64.atob(
- 'H4sIACKfFVUC/wsuLUpLTE51y8nMS08t0jVSUIg2MDCMV' +
- 'dDT0zNUMDQwMNAzsFIAIqcaw5qSxOJsR65gfDqMEDpcATiC61ZbAAAA');
- var m = tr.c.TestUtils.newModelWithEvents([compressedTrace]);
- assert.equal(1, tr.b.dictionaryValues(m.processes).length);
-
- var p1 = m.processes[1];
- assert.isDefined(p1);
-
- var t2 = p1.threads[2];
- assert.isDefined(t2);
-
- assert.equal(1, t2.sliceGroup.length, 1);
- assert.equal('taskA', t2.sliceGroup.slices[0].title);
- });
-
- test('canImportSubtracesRecursively', function() {
- var systraceLines = [
- 'SurfaceFlinger-2 [001] ...1 1000.0: 0: B|1|taskA',
- 'SurfaceFlinger-2 [001] ...1 2000.0: 0: E',
- ' chrome-3 [001] ...1 2000.0: 0: trace_event_clock_sync: ' +
- 'parent_ts=0'
- ];
- var outerTraceEvents = [
- {ts: 1000, pid: 1, tid: 3, ph: 'B', cat: 'c', name: 'taskB', args: {
- my_object: {id_ref: '0x1000'}
- }}
- ];
-
- var innerTraceEvents = [
- {ts: 2000, pid: 1, tid: 3, ph: 'E', cat: 'c', name: 'taskB', args: {}}
- ];
-
- var innerTrace = JSON.stringify({
- traceEvents: innerTraceEvents,
- systemTraceEvents: systraceLines.join('\n')
- });
-
- var outerTrace = JSON.stringify({
- traceEvents: outerTraceEvents,
- systemTraceEvents: innerTrace
- });
-
- var m = tr.c.TestUtils.newModelWithEvents([outerTrace]);
- assert.equal(tr.b.dictionaryValues(m.processes).length, 1);
-
- var p1 = m.processes[1];
- assert.isDefined(p1);
-
- var t2 = p1.threads[2];
- var t3 = p1.threads[3];
- assert.isDefined(t2);
- assert.isDefined(t3);
-
- assert.equal(1, 1, t2.sliceGroup.length);
- assert.equal(t2.sliceGroup.slices[0].title, 'taskA');
-
- assert.equal(t3.sliceGroup.length, 1);
- assert.equal(t3.sliceGroup.slices[0].title, 'taskB');
- });
-
- test('withImportFailure', function() {
- assert.throw(function() {
- tr.c.TestUtils.newModelWithEvents([malformed]);
- });
- });
-
- test('customizeCallback', function() {
- var m = tr.c.TestUtils.newModelWithEvents([], {
- shiftWorldToZero: false,
- pruneContainers: false,
- customizeModelCallback: function(m) {
- var browserProcess = m.getOrCreateProcess(1);
- var browserMain = browserProcess.getOrCreateThread(2);
- browserMain.sliceGroup.beginSlice('cat', 'Task', 0);
- browserMain.sliceGroup.beginSlice('cat', 'SubTask', 1);
- browserMain.sliceGroup.endSlice(9);
- browserMain.sliceGroup.endSlice(10);
- browserMain.sliceGroup.beginSlice('cat', 'Task', 20);
- browserMain.sliceGroup.endSlice(30);
- }
- });
- var t2 = m.processes[1].threads[2];
- assert.equal(t2.sliceGroup.length, 3);
- assert.equal(t2.sliceGroup.topLevelSlices.length, 2);
- });
-
- test('sortsSamples', function() {
- // The 184, 0 and 185 are the tick-times
- // and irrespective of the order
- // in which the lines appear in the trace,
- // the samples should always be sorted by sampling time.
- var m = tr.c.TestUtils.newModelWithEvents([
- 'tick,0x9a,184,0,0x0,5',
- 'tick,0x9b,0,0,0x0,5',
- 'tick,0x9c,185,0,0x0,5']);
- assert.equal(m.samples[0].start, 0);
- assert.equal(m.samples[1].start, 0.184);
- assert.equal(m.samples[2].start, 0.185);
- });
-
- test('sortsGlobalMemoryDumps', function() {
- var m = tr.c.TestUtils.newModelWithEvents([], {
- pruneContainers: false,
- customizeModelCallback: function(m) {
- m.globalMemoryDumps.push(new tr.model.GlobalMemoryDump(m, 1));
- m.globalMemoryDumps.push(new tr.model.GlobalMemoryDump(m, 5));
- m.globalMemoryDumps.push(new tr.model.GlobalMemoryDump(m, 3));
- }
- });
- assert.equal(m.globalMemoryDumps[0].start, 0);
- assert.equal(m.globalMemoryDumps[1].start, 2);
- assert.equal(m.globalMemoryDumps[2].start, 4);
- });
-
- test('finalizesProcessMemoryDumps', function() {
- var p;
- var m = tr.c.TestUtils.newModelWithEvents([], {
- pruneContainers: false,
- customizeModelCallback: function(m) {
- p = m.getOrCreateProcess(1);
-
- var g = new tr.model.GlobalMemoryDump(m, -1);
- m.globalMemoryDumps.push(g);
-
- var pmd1 = new tr.model.ProcessMemoryDump(g, p, 1);
- p.memoryDumps.push(pmd1);
-
- var pmd2 = new tr.model.ProcessMemoryDump(g, p, 5);
- p.memoryDumps.push(pmd2);
-
- var pmd3 = new tr.model.ProcessMemoryDump(g, p, 3);
- p.memoryDumps.push(pmd3);
- pmd3.vmRegions = [];
- }
- });
-
- // Check the sort order.
- assert.equal(p.memoryDumps[0].start, 2);
- assert.equal(p.memoryDumps[1].start, 4);
- assert.equal(p.memoryDumps[2].start, 6);
-
- // Check that the most recent VM regions are linked correctly.
- assert.isUndefined(p.memoryDumps[0].mostRecentVmRegions);
- assert.lengthOf(p.memoryDumps[1].mostRecentVmRegions, 0);
- assert.strictEqual(
- p.memoryDumps[1].mostRecentVmRegions,
- p.memoryDumps[2].mostRecentVmRegions);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/importer/importer.html b/chromium/third_party/catapult/tracing/tracing/importer/importer.html
deleted file mode 100644
index b981c1be8bd..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/importer/importer.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/extension_registry.html">
-<script>
-'use strict';
-
-/**
- * @fileoverview Base class for trace data importers.
- */
-tr.exportTo('tr.importer', function() {
- function Importer() { }
-
- Importer.prototype = {
- __proto__: Object.prototype,
-
- get importerName() {
- return 'Importer';
- },
-
- /**
- * Called by the Model to check whether the importer type stores the actual
- * trace data or just holds it as container for further extraction.
- */
- isTraceDataContainer: function() {
- return false;
- },
-
- /**
- * Called by the Model to extract one or more subtraces from the event data.
- */
- extractSubtraces: function() {
- return [];
- },
-
- /**
- * Called to import clock sync markers into the Model.
- */
- importClockSyncMarkers: function() {
- },
-
- /**
- * Called to import events into the Model.
- */
- importEvents: function() {
- },
-
- /**
- * Called to import sample data into the Model.
- */
- importSampleData: function() {
- },
-
- /**
- * Called by the Model after all other importers have imported their
- * events.
- */
- finalizeImport: function() {
- }
- };
-
-
- var options = new tr.b.ExtensionRegistryOptions(tr.b.BASIC_REGISTRY_MODE);
- options.defaultMetadata = {};
- options.mandatoryBaseClass = Importer;
- tr.b.decorateExtensionRegistry(Importer, options);
-
- Importer.findImporterFor = function(eventData) {
- var typeInfo = Importer.findTypeInfoMatching(function(ti) {
- return ti.constructor.canImport(eventData);
- });
- if (typeInfo)
- return typeInfo.constructor;
- return undefined;
- };
-
- return {
- Importer: Importer
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/importer/proto_expectation.html b/chromium/third_party/catapult/tracing/tracing/importer/proto_expectation.html
deleted file mode 100644
index c3b655c00e6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/importer/proto_expectation.html
+++ /dev/null
@@ -1,165 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/range_utils.html">
-<link rel="import" href="/tracing/core/auditor.html">
-<link rel="import" href="/tracing/model/event_info.html">
-<link rel="import" href="/tracing/model/user_model/animation_expectation.html">
-<link rel="import" href="/tracing/model/user_model/response_expectation.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.importer', function() {
- // This is an intermediate data format between InputLatencyAsyncSlices and
- // Response and Animation IRs.
- function ProtoExpectation(irType, name) {
- this.irType = irType;
- this.names = new Set(name ? [name] : undefined);
- this.start = Infinity;
- this.end = -Infinity;
- this.associatedEvents = new tr.model.EventSet();
- this.isAnimationBegin = false;
- }
-
- ProtoExpectation.RESPONSE_TYPE = 'r';
- ProtoExpectation.ANIMATION_TYPE = 'a';
-
- // Explicitly ignore some input events to allow
- // UserModelBuilder.checkAllInputEventsHandled() to determine which events
- // were unintentionally ignored due to a bug.
- ProtoExpectation.IGNORED_TYPE = 'ignored';
-
- ProtoExpectation.prototype = {
- get isValid() {
- return this.end > this.start;
- },
-
- // Return true if any associatedEvent's typeName is in typeNames.
- containsTypeNames: function(typeNames) {
- return this.associatedEvents.some(
- x => typeNames.indexOf(x.typeName) >= 0);
- },
-
- containsSliceTitle: function(title) {
- return this.associatedEvents.some(x => title === x.title);
- },
-
- createInteractionRecord: function(model) {
- if (!this.isValid) {
- console.error('Invalid ProtoExpectation: ' + this.debug() +
- ' File a bug with this trace!');
- return undefined;
- }
-
- var initiatorTitles = [];
- this.names.forEach(function(name) {
- initiatorTitles.push(name);
- });
- initiatorTitles = initiatorTitles.sort().join(',');
-
- var duration = this.end - this.start;
-
- var ir = undefined;
- switch (this.irType) {
- case ProtoExpectation.RESPONSE_TYPE:
- ir = new tr.model.um.ResponseExpectation(
- model, initiatorTitles, this.start, duration,
- this.isAnimationBegin);
- break;
- case ProtoExpectation.ANIMATION_TYPE:
- ir = new tr.model.um.AnimationExpectation(
- model, initiatorTitles, this.start, duration);
- break;
- }
- if (!ir)
- return undefined;
-
- ir.sourceEvents.addEventSet(this.associatedEvents);
-
- function pushAssociatedEvents(event) {
- ir.associatedEvents.push(event);
-
- // |event| is either an InputLatencyAsyncSlice (which collects all of
- // its associated events transitively) or a CSS Animation (which doesn't
- // have any associated events). So this does not need to recurse.
- if (event.associatedEvents)
- ir.associatedEvents.addEventSet(event.associatedEvents);
- }
-
- this.associatedEvents.forEach(function(event) {
- pushAssociatedEvents(event);
-
- // Old-style InputLatencyAsyncSlices have subSlices.
- if (event.subSlices)
- event.subSlices.forEach(pushAssociatedEvents);
- });
-
- return ir;
- },
-
- // Merge the other ProtoExpectation into this one.
- // The irTypes need not match: ignored ProtoExpectations might be merged
- // into overlapping ProtoExpectations, and Touch-only Animations are merged
- // into Tap Responses.
- merge: function(other) {
- other.names.forEach(function(name) { this.names.add(name); }.bind(this));
-
- // Don't use pushEvent(), which would lose special start, end.
- this.associatedEvents.addEventSet(other.associatedEvents);
- this.start = Math.min(this.start, other.start);
- this.end = Math.max(this.end, other.end);
- if (other.isAnimationBegin)
- this.isAnimationBegin = true;
- },
-
- // Include |event| in this ProtoExpectation, expanding start/end to include
- // it.
- pushEvent: function(event) {
- // Usually, this method will be called while iterating over a list of
- // events sorted by start time, so this method won't usually change
- // this.start. However, this will sometimes be called for
- // ProtoExpectations created by previous handlers, in which case
- // event.start could possibly be before this.start.
- this.start = Math.min(this.start, event.start);
- this.end = Math.max(this.end, event.end);
- this.associatedEvents.push(event);
- },
-
- // Returns true if timestamp is contained in this ProtoExpectation.
- containsTimestampInclusive: function(timestamp) {
- return (this.start <= timestamp) && (timestamp <= this.end);
- },
-
- // Return true if the other event intersects this ProtoExpectation.
- intersects: function(other) {
- // http://stackoverflow.com/questions/325933
- return (other.start < this.end) && (other.end > this.start);
- },
-
- isNear: function(event, threshold) {
- return (this.end + threshold) > event.start;
- },
-
- // Return a string describing this ProtoExpectation for debugging.
- debug: function() {
- var debugString = this.irType + '(';
- debugString += parseInt(this.start) + ' ';
- debugString += parseInt(this.end);
- this.associatedEvents.forEach(function(event) {
- debugString += ' ' + event.typeName;
- });
- return debugString + ')';
- }
- };
-
- return {
- ProtoExpectation: ProtoExpectation
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/importer/simple_line_reader.html b/chromium/third_party/catapult/tracing/tracing/importer/simple_line_reader.html
deleted file mode 100644
index cff446e2419..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/importer/simple_line_reader.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.importer', function() {
- /**
- * @constructor
- */
- function SimpleLineReader(text) {
- this.lines_ = text.split('\n');
- this.curLine_ = 0;
-
- this.savedLines_ = undefined;
- }
-
- SimpleLineReader.prototype = {
- advanceToLineMatching: function(regex) {
- for (; this.curLine_ < this.lines_.length; this.curLine_++) {
- var line = this.lines_[this.curLine_];
- if (this.savedLines_ !== undefined)
- this.savedLines_.push(line);
- if (regex.test(line))
- return true;
- }
- return false;
- },
-
- get curLineNumber() {
- return this.curLine_;
- },
-
- beginSavingLines: function() {
- this.savedLines_ = [];
- },
-
- endSavingLinesAndGetResult: function() {
- var tmp = this.savedLines_;
- this.savedLines_ = undefined;
- return tmp;
- }
- };
-
- return {
- SimpleLineReader: SimpleLineReader
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/importer/user_expectation_verifier.html b/chromium/third_party/catapult/tracing/tracing/importer/user_expectation_verifier.html
deleted file mode 100644
index 18c080d4424..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/importer/user_expectation_verifier.html
+++ /dev/null
@@ -1,77 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/chrome_test_utils.html">
-<link rel="import" href="/tracing/importer/user_model_builder.html">
-
-<script>
-'use strict';
-tr.exportTo('tr.importer', function() {
- function compareEvents(x, y) {
- if (x.start !== y.start)
- return x.start - y.start;
- return x.guid - y.guid;
- }
-
- function UserExpectationVerifier() {
- this.customizeModelCallback_ = undefined;
- this.expectedIRs_ = undefined;
- }
-
- UserExpectationVerifier.prototype = {
- set customizeModelCallback(cmc) {
- this.customizeModelCallback_ = cmc;
- },
-
- // |irs| must be sorted by start time.
- set expectedIRs(irs) {
- this.expectedIRs_ = irs;
- },
-
- verify: function() {
- var model = tr.e.chrome.ChromeTestUtils.newChromeModel(
- this.customizeModelCallback_);
-
- var failure = undefined;
- try {
- var i = 0;
- assert.lengthOf(model.userModel.expectations,
- this.expectedIRs_.length);
- var actualUE_iterator = model.userModel.expectations[Symbol.iterator]();
- for (var expectedIR of this.expectedIRs_) {
- var actualUE = actualUE_iterator.next();
- assert.equal(false, actualUE.done);
- var at = 'IRs[' + (i++) + '].';
- assert.equal(expectedIR.title, actualUE.value.title, at + 'title');
- if (expectedIR.name !== undefined)
- assert.equal(expectedIR.name, actualUE.value.name, at + 'name');
- assert.equal(expectedIR.start, actualUE.value.start, at + 'start');
- assert.equal(expectedIR.end, actualUE.value.end, at + 'end');
- assert.equal(expectedIR.eventCount,
- actualUE.value.associatedEvents.length, at + 'eventCount');
- if (actualUE instanceof tr.model.um.ResponseExpectation) {
- assert.equal(expectedIR.isAnimationBegin || false,
- actualUEs.isAnimationBegin, at + 'isAnimationBegin');
- }
- }
- } catch (caught) {
- failure = caught;
- }
-
- var debug = !tr.isHeadless && (
- location.search.split('&').indexOf('debug') >= 0);
- if (!failure && !debug)
- return;
-
- if (failure)
- throw failure;
- }
- };
-
- return {UserExpectationVerifier: UserExpectationVerifier};
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/importer/user_model_builder.html b/chromium/third_party/catapult/tracing/tracing/importer/user_model_builder.html
deleted file mode 100644
index 2ee0e452bf7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/importer/user_model_builder.html
+++ /dev/null
@@ -1,231 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/range_utils.html">
-<link rel="import" href="/tracing/core/auditor.html">
-<link rel="import" href="/tracing/extras/chrome/cc/input_latency_async_slice.html">
-<link rel="import" href="/tracing/importer/find_input_expectations.html">
-<link rel="import" href="/tracing/importer/find_load_expectations.html">
-<link rel="import" href="/tracing/importer/find_startup_expectations.html">
-<link rel="import" href="/tracing/model/event_info.html">
-<link rel="import" href="/tracing/model/ir_coverage.html">
-<link rel="import" href="/tracing/model/user_model/idle_expectation.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.importer', function() {
- var INSIGNIFICANT_MS = 1;
-
- function UserModelBuilder(model) {
- this.model = model;
- this.modelHelper = model.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- };
-
- UserModelBuilder.supportsModelHelper = function(modelHelper) {
- return modelHelper.browserHelper !== undefined;
- };
-
- UserModelBuilder.prototype = {
- buildUserModel: function() {
- if (!this.modelHelper || !this.modelHelper.browserHelper)
- return;
-
- var expectations = undefined;
- try {
- expectations = this.findUserExpectations();
- // There are not currently any known cases when this could throw.
- } catch (error) {
- this.model.importWarning({
- type: 'UserModelBuilder',
- message: error,
- showToUser: true
- });
- return;
- }
- expectations.forEach(function(expectation) {
- this.model.userModel.expectations.push(expectation);
- }, this);
-
- // TODO(benjhayden) Find Gestures here.
- },
-
- findUserExpectations: function() {
- var expectations = [];
- expectations.push.apply(expectations, tr.importer.findStartupExpectations(
- this.modelHelper));
- expectations.push.apply(expectations, tr.importer.findLoadExpectations(
- this.modelHelper));
- expectations.push.apply(expectations, tr.importer.findInputExpectations(
- this.modelHelper));
- // findIdleExpectations must be called last!
- expectations.push.apply(
- expectations, this.findIdleExpectations(expectations));
- this.collectUnassociatedEvents_(expectations);
- return expectations;
- },
-
- // Find all unassociated top-level ThreadSlices. If they start during an
- // Idle or Load IR, then add their entire hierarchy to that IR.
- collectUnassociatedEvents_: function(rirs) {
- var vacuumIRs = [];
- rirs.forEach(function(ir) {
- if (ir instanceof tr.model.um.IdleExpectation ||
- ir instanceof tr.model.um.LoadExpectation ||
- ir instanceof tr.model.um.StartupExpectation)
- vacuumIRs.push(ir);
- });
- if (vacuumIRs.length === 0)
- return;
-
- var allAssociatedEvents = tr.model.getAssociatedEvents(rirs);
- var unassociatedEvents = tr.model.getUnassociatedEvents(
- this.model, allAssociatedEvents);
-
- unassociatedEvents.forEach(function(event) {
- if (!(event instanceof tr.model.ThreadSlice))
- return;
-
- if (!event.isTopLevel)
- return;
-
- for (var iri = 0; iri < vacuumIRs.length; ++iri) {
- var ir = vacuumIRs[iri];
-
- if ((event.start >= ir.start) &&
- (event.start < ir.end)) {
- ir.associatedEvents.addEventSet(event.entireHierarchy);
- return;
- }
- }
- });
- },
-
- // Fill in the empty space between IRs with IdleIRs.
- findIdleExpectations: function(otherIRs) {
- if (this.model.bounds.isEmpty)
- return;
- var emptyRanges = tr.b.findEmptyRangesBetweenRanges(
- tr.b.convertEventsToRanges(otherIRs),
- this.model.bounds);
- var irs = [];
- var model = this.model;
- emptyRanges.forEach(function(range) {
- // Ignore insignificantly tiny idle ranges.
- if (range.max < (range.min + INSIGNIFICANT_MS))
- return;
- irs.push(new tr.model.um.IdleExpectation(
- model, range.min, range.max - range.min));
- });
- return irs;
- }
- };
-
- function createCustomizeModelLinesFromModel(model) {
- var modelLines = [];
- modelLines.push(' audits.addEvent(model.browserMain,');
- modelLines.push(' {title: \'model start\', start: 0, end: 1});');
-
- var typeNames = {};
- for (var typeName in tr.e.cc.INPUT_EVENT_TYPE_NAMES) {
- typeNames[tr.e.cc.INPUT_EVENT_TYPE_NAMES[typeName]] = typeName;
- }
-
- var modelEvents = new tr.model.EventSet();
- model.userModel.expectations.forEach(function(ir, index) {
- modelEvents.addEventSet(ir.sourceEvents);
- });
- modelEvents = modelEvents.toArray();
- modelEvents.sort(tr.importer.compareEvents);
-
- modelEvents.forEach(function(event) {
- var startAndEnd = 'start: ' + parseInt(event.start) + ', ' +
- 'end: ' + parseInt(event.end) + '});';
- if (event instanceof tr.e.cc.InputLatencyAsyncSlice) {
- modelLines.push(' audits.addInputEvent(model, INPUT_TYPE.' +
- typeNames[event.typeName] + ',');
- } else if (event.title === 'RenderFrameImpl::didCommitProvisionalLoad') {
- modelLines.push(' audits.addCommitLoadEvent(model,');
- } else if (event.title ===
- 'InputHandlerProxy::HandleGestureFling::started') {
- modelLines.push(' audits.addFlingAnimationEvent(model,');
- } else if (event.title === tr.model.helpers.IMPL_RENDERING_STATS) {
- modelLines.push(' audits.addFrameEvent(model,');
- } else if (event.title === tr.importer.CSS_ANIMATION_TITLE) {
- modelLines.push(' audits.addEvent(model.rendererMain, {');
- modelLines.push(' title: \'Animation\', ' + startAndEnd);
- return;
- } else {
- throw ('You must extend createCustomizeModelLinesFromModel()' +
- 'to support this event:\n' + event.title + '\n');
- }
- modelLines.push(' {' + startAndEnd);
- });
-
- modelLines.push(' audits.addEvent(model.browserMain,');
- modelLines.push(' {' +
- 'title: \'model end\', ' +
- 'start: ' + (parseInt(model.bounds.max) - 1) + ', ' +
- 'end: ' + parseInt(model.bounds.max) + '});');
- return modelLines;
- }
-
- function createExpectedIRLinesFromModel(model) {
- var expectedLines = [];
- var irCount = model.userModel.expectations.length;
- model.userModel.expectations.forEach(function(ir, index) {
- var irString = ' {';
- irString += 'title: \'' + ir.title + '\', ';
- irString += 'start: ' + parseInt(ir.start) + ', ';
- irString += 'end: ' + parseInt(ir.end) + ', ';
- irString += 'eventCount: ' + ir.sourceEvents.length;
- irString += '}';
- if (index < (irCount - 1))
- irString += ',';
- expectedLines.push(irString);
- });
- return expectedLines;
- }
-
- function createIRFinderTestCaseStringFromModel(model) {
- var filename = window.location.hash.substr(1);
- var testName = filename.substr(filename.lastIndexOf('/') + 1);
- testName = testName.substr(0, testName.indexOf('.'));
-
- // createCustomizeModelLinesFromModel() throws an error if there's an
- // unsupported event.
- try {
- var testLines = [];
- testLines.push(' /*');
- testLines.push(' This test was generated from');
- testLines.push(' ' + filename + '');
- testLines.push(' */');
- testLines.push(' test(\'' + testName + '\', function() {');
- testLines.push(' var verifier = new UserExpectationVerifier();');
- testLines.push(' verifier.customizeModelCallback = function(model) {');
- testLines.push.apply(testLines,
- createCustomizeModelLinesFromModel(model));
- testLines.push(' };');
- testLines.push(' verifier.expectedIRs = [');
- testLines.push.apply(testLines, createExpectedIRLinesFromModel(model));
- testLines.push(' ];');
- testLines.push(' verifier.verify();');
- testLines.push(' });');
- return testLines.join('\n');
- } catch (error) {
- return error;
- }
- }
-
- return {
- UserModelBuilder: UserModelBuilder,
- createIRFinderTestCaseStringFromModel: createIRFinderTestCaseStringFromModel
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/importer/user_model_builder_test.html b/chromium/third_party/catapult/tracing/tracing/importer/user_model_builder_test.html
deleted file mode 100644
index 9938675bc42..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/importer/user_model_builder_test.html
+++ /dev/null
@@ -1,883 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/cc/input_latency_async_slice.html">
-<link rel="import" href="/tracing/extras/chrome/chrome_test_utils.html">
-<link rel="import" href="/tracing/importer/user_expectation_verifier.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var INPUT_TYPE = tr.e.cc.INPUT_EVENT_TYPE_NAMES;
- var chrome_test_utils = tr.e.chrome.ChromeTestUtils;
- var UserExpectationVerifier = tr.importer.UserExpectationVerifier;
-
- function addFrameEventForInput(model, event) {
- var frame = chrome_test_utils.addFrameEvent(model,
- {start: event.start, end: event.end, isTopLevel: true});
- model.flowEvents.push(tr.c.TestUtils.newFlowEventEx({
- id: event.id,
- start: event.start,
- end: event.end,
- startSlice: frame,
- endSlice: frame
- }));
- }
-
- test('empty', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- };
- verifier.expectedIRs = [
- ];
- verifier.verify();
- });
-
- test('slowMouseMoveResponses', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(
- model, INPUT_TYPE.MOUSE_DOWN, {start: 0, end: 10});
- var mouseMove = chrome_test_utils.addInputEvent(
- model, INPUT_TYPE.MOUSE_MOVE, {start: 10, end: 20, id: '0x100'});
- addFrameEventForInput(model, mouseMove);
-
- mouseMove = chrome_test_utils.addInputEvent(
- model, INPUT_TYPE.MOUSE_MOVE, {start: 70, end: 80, id: '0x101'});
- addFrameEventForInput(model, mouseMove);
-
- mouseMove = chrome_test_utils.addInputEvent(
- model, INPUT_TYPE.MOUSE_MOVE, {start: 130, end: 140, id: '0x102'});
- addFrameEventForInput(model, mouseMove);
- };
- verifier.expectedIRs = [
- {title: 'Idle', start: 0, end: 10, eventCount: 0},
- {title: 'Mouse Response', start: 10, end: 20, eventCount: 4},
- {title: 'Idle', start: 20, end: 70, eventCount: 0},
- {title: 'Mouse Response', start: 70, end: 80, eventCount: 3},
- {title: 'Idle', start: 80, end: 130, eventCount: 0},
- {title: 'Mouse Response', start: 130, end: 140, eventCount: 3}
- ];
- verifier.verify();
- });
-
- test('mouseEventResponses', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- var mouseDown = chrome_test_utils.addInputEvent(
- model, INPUT_TYPE.MOUSE_DOWN, {start: 0, end: 50, id: '0x100'});
- addFrameEventForInput(model, mouseDown);
-
- var mouseUp = chrome_test_utils.addInputEvent(model, INPUT_TYPE.MOUSE_UP,
- {start: 50, end: 100, id: '0x101'});
- addFrameEventForInput(model, mouseUp);
-
- var mouseMove = chrome_test_utils.addInputEvent(
- model, INPUT_TYPE.MOUSE_MOVE, {start: 200, end: 250, id: '0x102'});
- addFrameEventForInput(model, mouseMove);
- };
- verifier.expectedIRs = [
- {title: 'Mouse Response', start: 0, end: 50, eventCount: 3},
- {title: 'Mouse Response', start: 50, end: 100, eventCount: 3},
- {title: 'Idle', start: 100, end: 200, eventCount: 0},
- {title: 'Mouse Response', start: 200, end: 250, eventCount: 3}
- ];
- verifier.verify();
- });
-
- test('mouseEventsIgnored', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.MOUSE_MOVE,
- {start: 0, end: 50});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.MOUSE_DOWN,
- {start: 50, end: 100});
- };
- verifier.expectedIRs = [
- {title: 'Idle', start: 0, end: 100, eventCount: 0}
- ];
- verifier.verify();
- });
-
- test('unassociatedEvents', function() {
- // Unassociated ThreadSlices that start during an Idle should be associated
- // with it. Expect the Idle IR to have 2 associated events: both of the
- // ThreadSlices in the model.
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- var start = tr.c.TestUtils.newSliceEx(
- {title: 'model start', start: 0, end: 1, type: tr.model.ThreadSlice});
- start.isTopLevel = true;
- model.browserMain.sliceGroup.pushSlice(start);
-
- var end = tr.c.TestUtils.newSliceEx(
- {title: 'model end', start: 9, end: 10, type: tr.model.ThreadSlice});
- end.isTopLevel = true;
- model.browserMain.sliceGroup.pushSlice(end);
- };
- verifier.expectedIRs = [
- {title: 'Idle', start: 0, end: 10, eventCount: 2}
- ];
- verifier.verify();
- });
-
- test('stillLoading', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addFrameEvent(model, {start: 0, end: 10});
- chrome_test_utils.addNavigationStartEvent(model, {start: 10});
- chrome_test_utils.addFrameEvent(model, {start: 19, end: 20});
- };
- verifier.expectedIRs = [
- {title: 'Idle', start: 0, end: 10, eventCount: 0},
- {title: 'Successful Load', start: 10, end: 20, eventCount: 0}
- ];
- verifier.verify();
- });
-
- test('overlappingIdleAndLoadCollectUnassociatedEvents', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addFrameEvent(model, {start: 0, end: 10});
- chrome_test_utils.addNavigationStartEvent(model, {start: 10});
- chrome_test_utils.addFirstContentfulPaintEvent(model, {start: 30});
- chrome_test_utils.addFrameEvent(model, {start: 35, end: 40});
- // 3 Idle events.
- chrome_test_utils.addRenderingEvent(model, {start: 5, end: 15});
- chrome_test_utils.addRenderingEvent(model, {start: 11, end: 15});
- chrome_test_utils.addRenderingEvent(model, {start: 13, end: 15});
- // 1 Idle event.
- chrome_test_utils.addRenderingEvent(model, {start: 35, end: 36});
- };
- verifier.expectedIRs = [
- {title: 'Idle', start: 0, end: 10, eventCount: 3},
- {title: 'Successful Load', start: 10, end: 30, eventCount: 0},
- {title: 'Idle', start: 30, end: 40, eventCount: 1}
- ];
- verifier.verify();
- });
-
- test('flingFlingFling', function() {
- // This trace gave me so many different kinds of trouble that I'm just going
- // to copy it straight in here, without trying to clarify it at all.
- // measurmt-traces/mobile/cnet_fling_up_fling_down_motox_2013.json
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addFrameEvent(model, {start: 0, end: 10});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_START,
- {start: 919, end: 998});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.FLING_CANCEL,
- {start: 919, end: 1001});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TAP_DOWN,
- {start: 919, end: 1001});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TAP_CANCEL,
- {start: 974, end: 1020});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_BEGIN,
- {start: 974, end: 1020});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 974, end: 1040});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 974, end: 1054});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 990, end: 1021});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 990, end: 1052});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 1006, end: 1021});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 1022, end: 1036});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 1022, end: 1052});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 1038, end: 1049});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 1038, end: 1068});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_END,
- {start: 1046, end: 1050});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.FLING_START,
- {start: 1046, end: 1077});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_START,
- {start: 1432, end: 2238});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.FLING_CANCEL,
- {start: 1432, end: 2241});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 1516, end: 2605});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_BEGIN,
- {start: 1532, end: 2274});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 1532, end: 2294});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 1549, end: 2310});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_END,
- {start: 1627, end: 2275});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.FLING_START,
- {start: 1627, end: 2310});
- chrome_test_utils.addFrameEvent(model, {start: 2990, end: 3000});
- };
- verifier.expectedIRs = [
- {title: 'Idle', start: 0, end: 919, eventCount: 0},
- {title: 'Scroll,Tap,Touch Response', start: 919, end: 1054,
- eventCount: 6, isAnimationBegin: true},
- {title: 'Scroll,Touch Animation', start: 1054, end: 1068,
- eventCount: 8},
- {title: 'Fling Animation', start: 1054, end: 1432,
- eventCount: 2},
- {title: 'Scroll,Touch Response', start: 1432, end: 2605,
- eventCount: 5, isAnimationBegin: true},
- {title: 'Scroll Animation', start: 1549, end: 2310,
- eventCount: 1},
- {title: 'Fling Animation', start: 2605, end: 3000,
- eventCount: 1}
- ];
- verifier.verify();
- });
-
- test('keyboardEvents', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.KEY_DOWN_RAW,
- {start: 0, end: 45});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.CHAR,
- {start: 10, end: 50});
- };
- verifier.expectedIRs = [
- {title: 'Keyboard Response', start: 0, end: 50, eventCount: 2}
- ];
- verifier.verify();
- });
-
- test('mouseResponses', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.CLICK,
- {start: 0, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.CONTEXT_MENU,
- {start: 200, end: 300});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.MOUSE_WHEEL,
- {start: 400, end: 500});
- };
- verifier.expectedIRs = [
- {title: 'Mouse Response', start: 0, end: 100, eventCount: 1},
- {title: 'Idle', start: 100, end: 200, eventCount: 0},
- {title: 'Mouse Response', start: 200, end: 300, eventCount: 1},
- {title: 'Idle', start: 300, end: 400, eventCount: 0},
- {title: 'MouseWheel Response', start: 400, end: 500,
- eventCount: 1}
- ];
- verifier.verify();
- });
-
- test('mouseWheelAnimation', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.MOUSE_WHEEL,
- {start: 0, end: 20});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.MOUSE_WHEEL,
- {start: 16, end: 36});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.MOUSE_WHEEL,
- {start: 55, end: 75});
-
- // This threshold uses both events' start times, not end...start.
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.MOUSE_WHEEL,
- {start: 100, end: 150});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.MOUSE_WHEEL,
- {start: 141, end: 191});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.MOUSE_WHEEL,
- {start: 182, end: 200});
- };
- verifier.expectedIRs = [
- {title: 'MouseWheel Response', start: 0, end: 20, eventCount: 1},
- {title: 'MouseWheel Animation', start: 20, end: 75,
- eventCount: 2},
- {title: 'Idle', start: 75, end: 100, eventCount: 0},
- {title: 'MouseWheel Response', start: 100, end: 150,
- eventCount: 1},
- {title: 'MouseWheel Response', start: 141, end: 191,
- eventCount: 1},
- {title: 'MouseWheel Response', start: 182, end: 200,
- eventCount: 1}
- ];
- verifier.verify();
- });
-
- test('mouseDownUpResponse', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.MOUSE_DOWN,
- {start: 0, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.MOUSE_UP,
- {start: 200, end: 210});
- };
- verifier.expectedIRs = [
- {title: 'Idle', start: 0, end: 200, eventCount: 0},
- {title: 'Mouse Response', start: 200, end: 210, eventCount: 2}
- ];
- verifier.verify();
- });
-
- test('ignoreLoneMouseMoves', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.MOUSE_MOVE,
- {start: 0, end: 100});
- };
- verifier.expectedIRs = [
- {title: 'Idle', start: 0, end: 100, eventCount: 0}
- ];
- verifier.verify();
- });
-
- test('mouseDrags', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(
- model, INPUT_TYPE.MOUSE_DOWN, {start: 0, end: 100});
- var mouseMove = chrome_test_utils.addInputEvent(
- model, INPUT_TYPE.MOUSE_MOVE, {start: 200, end: 215});
- addFrameEventForInput(model, mouseMove);
- mouseMove = chrome_test_utils.addInputEvent(
- model, INPUT_TYPE.MOUSE_MOVE, {start: 210, end: 220});
- addFrameEventForInput(model, mouseMove);
- mouseMove = chrome_test_utils.addInputEvent(
- model, INPUT_TYPE.MOUSE_MOVE, {start: 221, end: 240});
- addFrameEventForInput(model, mouseMove);
- };
- verifier.expectedIRs = [
- {title: 'Idle', start: 0, end: 200, eventCount: 0},
- {title: 'Mouse Response', start: 200, end: 215, eventCount: 4},
- {title: 'Mouse Animation', start: 215, end: 240, eventCount: 6}
- ];
- verifier.verify();
- });
-
- test('twoScrollsNoFling', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_BEGIN,
- {start: 0, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 20, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 40, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 60, end: 150});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 70, end: 150});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_END,
- {start: 80, end: 150});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_BEGIN,
- {start: 300, end: 400});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 320, end: 400});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 330, end: 450});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 340, end: 450});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 350, end: 500});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_END,
- {start: 360, end: 500});
- };
- verifier.expectedIRs = [
- {title: 'Scroll Response', start: 0, end: 100, eventCount: 2,
- isAnimationBegin: true},
- {title: 'Scroll Animation', start: 100, end: 150, eventCount: 4},
- {title: 'Idle', start: 150, end: 300, eventCount: 0},
- {title: 'Scroll Response', start: 300, end: 400, eventCount: 2,
- isAnimationBegin: true},
- {title: 'Scroll Animation', start: 400, end: 500, eventCount: 4}
- ];
- verifier.verify();
- });
-
- test('cssAnimations', function() {
- // CSS Animations happen on the renderer process, not the browser process.
- // They are merged if they overlap.
- // They are merged with other kinds of animations.
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addEvent(model.rendererMain, {
- title: 'Animation', start: 0, end: 100, isTopLevel: true});
- chrome_test_utils.addFrameEvent(model, {start: 10, end: 20});
- chrome_test_utils.addEvent(model.rendererMain, {
- title: 'Animation', start: 131, end: 200, isTopLevel: true});
- chrome_test_utils.addFrameEvent(model, {start: 150, end: 160});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.FLING_START,
- {start: 150, end: 180});
- chrome_test_utils.addFrameEvent(model, {start: 290, end: 300});
- };
- verifier.expectedIRs = [
- {title: 'CSS Animation', start: 0, end: 200, eventCount: 4},
- {title: 'Fling Animation', start: 150, end: 300, eventCount: 1}
- ];
- verifier.verify();
- });
-
- test('cssAnimationStates', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- // If a top-level Animation async slice does not have state-change instant
- // subSlices, then assume that the animation was running throughout the
- // async slice.
- chrome_test_utils.addEvent(model.rendererMain, {
- title: 'Animation', start: 181, end: 250, isTopLevel: true});
- chrome_test_utils.addFrameEvent(model, {start: 200, end: 240});
-
- // Animation ranges should be merged if there is less than 32ms dead time
- // between them.
-
- // If a top-level Animation async slice has state-change instant events,
- // then run a state machine to find the time ranges when the animation was
- // actually running.
-
- // This animation was running from 10-40 and 50-60.
- var animationA = tr.c.TestUtils.newAsyncSliceEx(
- {title: 'Animation', start: 50, end: 500, isTopLevel: true});
- animationA.subSlices.push(tr.c.TestUtils.newInstantEvent(
- {title: 'Animation', start: 71, args: {state: 'running'}}));
- animationA.subSlices.push(tr.c.TestUtils.newInstantEvent(
- {title: 'Animation', start: 104, args: {state: 'pending'}}));
- animationA.subSlices.push(tr.c.TestUtils.newInstantEvent(
- {title: 'Animation', start: 137, args: {state: 'running'}}));
- animationA.subSlices.push(tr.c.TestUtils.newInstantEvent(
- {title: 'Animation', start: 150, args: {state: 'paused'}}));
- animationA.subSlices.push(tr.c.TestUtils.newInstantEvent(
- {title: 'Animation', start: 281, args: {state: 'running'}}));
- animationA.subSlices.push(tr.c.TestUtils.newInstantEvent(
- {title: 'Animation', start: 350, args: {state: 'idle'}}));
- model.rendererMain.asyncSliceGroup.push(animationA);
- chrome_test_utils.addFrameEvent(model, {start: 80, end: 90});
- chrome_test_utils.addFrameEvent(model, {start: 290, end: 300});
-
- // An animation without a frame event isn't really an animation.
- chrome_test_utils.addEvent(model.rendererMain, {
- title: 'Animation', start: 350, end: 382, isTopLevel: true});
-
- // This animation was running from model.bounds.min-50 and
- // 70-model.bounds.max.
- var animationB = tr.c.TestUtils.newAsyncSliceEx(
- {title: 'Animation', start: 0, end: 500, isTopLevel: true});
- animationB.subSlices.push(tr.c.TestUtils.newInstantEvent(
- {title: 'Animation', start: 40, args: {state: 'finished'}}));
- animationB.subSlices.push(tr.c.TestUtils.newInstantEvent(
- {title: 'Animation', start: 382, args: {state: 'running'}}));
- model.rendererMain.asyncSliceGroup.push(animationB);
- chrome_test_utils.addFrameEvent(model, {start: 10, end: 20});
- chrome_test_utils.addFrameEvent(model, {start: 390, end: 400});
- };
- verifier.expectedIRs = [
- {title: 'CSS Animation', start: 0, end: 350, eventCount: 15},
- {title: 'Idle', start: 350, end: 382, eventCount: 0},
- {title: 'CSS Animation', start: 382, end: 500, eventCount: 4},
- ];
- verifier.verify();
- });
-
- test('flingThatIsntstopped', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.FLING_START,
- {start: 32, end: 100});
- chrome_test_utils.addFlingAnimationEvent(model, {start: 38, end: 200});
- chrome_test_utils.addFrameEvent(model, {start: 290, end: 300});
- };
- verifier.expectedIRs = [
- {title: 'Fling Animation', start: 32, end: 200, eventCount: 2},
- {title: 'Idle', start: 200, end: 300, eventCount: 0}
- ];
- verifier.verify();
- });
-
- test('flingThatIsStopped', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.FLING_START,
- {start: 32, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.FLING_CANCEL,
- {start: 105, end: 150});
- };
- verifier.expectedIRs = [
- {title: 'Fling Animation', start: 32, end: 105, eventCount: 2},
- {title: 'Idle', start: 105, end: 150, eventCount: 0}
- ];
- verifier.verify();
- });
-
- test('flingFling', function() {
- // measurmt-traces/mobile/facebook_obama_scroll_dialog_box.html
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.FLING_START,
- {start: 0, end: 30});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_START,
- {start: 100, end: 130});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.FLING_CANCEL,
- {start: 100, end: 130});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 110, end: 140});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 170, end: 180});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_END,
- {start: 200, end: 210});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.FLING_START,
- {start: 200, end: 220});
- chrome_test_utils.addFrameEvent(model, {start: 230, end: 240});
- };
- verifier.expectedIRs = [
- {title: 'Fling Animation', start: 0, end: 100, eventCount: 2},
- {title: 'Touch Response', start: 100, end: 140, eventCount: 2,
- isAnimationBegin: true},
- {title: 'Touch Animation', start: 140, end: 210, eventCount: 2},
- {title: 'Fling Animation', start: 200, end: 240, eventCount: 1}
- ];
- verifier.verify();
- });
-
- test('load', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addNavigationStartEvent(model, {start: 0});
- chrome_test_utils.addFirstContentfulPaintEvent(model, {start: 20});
- };
- verifier.expectedIRs = [
- {title: 'Successful Load', start: 0, end: 20, eventCount: 0}
- ];
- verifier.verify();
- });
-
- test('loadStartup', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addRenderingEvent(model, {start: 2, end: 3});
- chrome_test_utils.addCreateThreadsEvent(model, {start: 5, end: 10});
- // Throw an second one in there, just to try to confuse the algo.
- chrome_test_utils.addCreateThreadsEvent(model, {start: 25, end: 30});
- chrome_test_utils.addFrameEvent(model, {start: 11, end: 20});
- };
- verifier.expectedIRs = [
- {title: 'Startup', start: 2, end: 20, eventCount: 2},
- {title: 'Idle', start: 20, end: 30, eventCount: 0}
- ];
- verifier.verify();
- });
-
- test('totalIdle', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addFrameEvent(model, {start: 0, end: 10});
- };
- verifier.expectedIRs = [
- {title: 'Idle', start: 0, end: 10, eventCount: 0}
- ];
- verifier.verify();
- });
-
- test('multipleIdles', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addFrameEvent(model, {start: 0, end: 1});
- chrome_test_utils.addNavigationStartEvent(model, {start: 1});
- chrome_test_utils.addFirstContentfulPaintEvent(model, {start: 4});
- chrome_test_utils.addFrameEvent(model, {start: 12, end: 13});
- };
- verifier.expectedIRs = [
- {title: 'Idle', start: 0, end: 1, eventCount: 0},
- {title: 'Successful Load', start: 1, end: 4, eventCount: 0},
- {title: 'Idle', start: 4, end: 13, eventCount: 0}
- ];
- verifier.verify();
- });
-
- test('touchStartTouchEndTap', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_START,
- {start: 0, end: 10});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_END,
- {start: 200, end: 210});
- };
- verifier.expectedIRs = [
- {title: 'Touch Response', start: 0, end: 210, eventCount: 2,
- isAnimationBegin: true}
- ];
- verifier.verify();
- });
-
- test('touchMoveResponseAnimation', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_START,
- {start: 0, end: 10});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 50, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 70, end: 150});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_END,
- {start: 200, end: 300});
- };
- verifier.expectedIRs = [
- {title: 'Touch Response', start: 0, end: 100, eventCount: 2,
- isAnimationBegin: true},
- {title: 'Touch Animation', start: 100, end: 300, eventCount: 2}
- ];
- verifier.verify();
- });
-
- test('tapEvents', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TAP,
- {start: 0, end: 50});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TAP_DOWN,
- {start: 300, end: 310});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TAP,
- {start: 320, end: 350});
- };
- verifier.expectedIRs = [
- {title: 'Tap Response', start: 0, end: 50, eventCount: 1},
- {title: 'Idle', start: 50, end: 300, eventCount: 0},
- {title: 'Tap Response', start: 300, end: 350, eventCount: 2}
- ];
- verifier.verify();
- });
-
- test('tapAndTapCancelResponses', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TAP_DOWN,
- {start: 0, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TAP_CANCEL,
- {start: 300, end: 350});
- };
- verifier.expectedIRs = [
- {title: 'Tap Response', start: 0, end: 100, eventCount: 1},
- {title: 'Idle', start: 100, end: 300, eventCount: 0},
- {title: 'Tap Response', start: 300, end: 350, eventCount: 1}
- ];
- verifier.verify();
- });
-
- test('tapCancelResponse', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TAP_DOWN,
- {start: 0, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TAP_CANCEL,
- {start: 150, end: 200});
- };
- verifier.expectedIRs = [
- {title: 'Tap Response', start: 0, end: 200, eventCount: 2}
- ];
- verifier.verify();
- });
-
- test('pinchResponseAnimation', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addFrameEvent(model, {start: 0, end: 10});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.PINCH_BEGIN,
- {start: 100, end: 150});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.PINCH_UPDATE,
- {start: 130, end: 160});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.PINCH_UPDATE,
- {start: 140, end: 200});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.PINCH_UPDATE,
- {start: 150, end: 205});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.PINCH_UPDATE,
- {start: 210, end: 220});
- // pause > 200ms
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.PINCH_UPDATE,
- {start: 421, end: 470});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.PINCH_END,
- {start: 460, end: 500});
- };
- verifier.expectedIRs = [
- {title: 'Idle', start: 0, end: 100, eventCount: 0},
- {title: 'Pinch Response', start: 100, end: 160, eventCount: 2,
- isAnimationBegin: true},
- {title: 'Pinch Animation', start: 160, end: 220, eventCount: 3},
- {title: 'Idle', start: 220, end: 421, eventCount: 0},
- {title: 'Pinch Animation', start: 421, end: 500, eventCount: 2}
- ];
- verifier.verify();
- });
-
- test('tapThenScroll', function() {
- // measurmt-traces/mobile/google_io_instrument_strumming.json
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_START,
- {start: 0, end: 20});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_END,
- {start: 40, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_START,
- {start: 50, end: 120});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 80, end: 150});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 180, end: 200});
- };
- verifier.expectedIRs = [
- {title: 'Touch Response', start: 0, end: 100, eventCount: 2,
- isAnimationBegin: true},
- {title: 'Touch Response', start: 50, end: 150, eventCount: 2,
- isAnimationBegin: true},
- {title: 'Touch Animation', start: 150, end: 200, eventCount: 1}
- ];
- verifier.verify();
- });
-
- test('pinchFlingTapTouchEventsOverlap', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addFrameEvent(model, {start: 0, end: 10});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_START,
- {start: 20, end: 50});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TAP_DOWN,
- {start: 20, end: 30});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.FLING_CANCEL,
- {start: 20, end: 50});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 60, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_START,
- {start: 60, end: 110});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.PINCH_BEGIN,
- {start: 60, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TAP_CANCEL,
- {start: 65, end: 75});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 70, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.PINCH_UPDATE,
- {start: 70, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 75, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 80, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 85, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_BEGIN,
- {start: 75, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 150, end: 200});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 150, end: 200});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.FLING_START,
- {start: 180, end: 210});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_END,
- {start: 190, end: 210});
- chrome_test_utils.addFrameEvent(model, {start: 215, end: 220});
- };
- verifier.expectedIRs = [
- {title: 'Idle', start: 0, end: 20, eventCount: 0},
- {title: 'Pinch,Scroll,Tap,Touch Response', start: 20, end: 110,
- eventCount: 9, isAnimationBegin: true},
- {title: 'Scroll,Touch Animation', start: 110, end: 210,
- eventCount: 6},
- {title: 'Fling Animation', start: 180, end: 220, eventCount: 1}
- ];
- verifier.verify();
- });
-
- test('scrollThenFling', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 0, end: 40});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 50, end: 100});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.FLING_START,
- {start: 80, end: 100});
- chrome_test_utils.addFrameEvent(model, {start: 190, end: 200});
- };
- verifier.expectedIRs = [
- {title: 'Scroll Animation', start: 0, end: 100, eventCount: 2},
- {title: 'Fling Animation', start: 80, end: 200, eventCount: 1}
- ];
- verifier.verify();
- });
-
- /*
- This test was generated from
- /test_data/measurmt-traces/mobile/fling_HN_to_rest.json
- */
- test('flingHNToRest', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addEvent(model.browserMain,
- {title: 'model start', start: 0, end: 1});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_START,
- {start: 1274, end: 1297});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TAP_DOWN,
- {start: 1274, end: 1305});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 1343, end: 1350});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 1359, end: 1366});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TAP_CANCEL,
- {start: 1359, end: 1366});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_BEGIN,
- {start: 1359, end: 1367});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 1359, end: 1387});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 1375, end: 1385});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 1375, end: 1416});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 1389, end: 1404});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 1389, end: 1429});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 1405, end: 1418});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 1405, end: 1449});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 1419, end: 1432});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.SCROLL_UPDATE,
- {start: 1419, end: 1474});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_END,
- {start: 1427, end: 1435});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.FLING_START,
- {start: 1427, end: 1474});
- chrome_test_utils.addFlingAnimationEvent(model, {start: 1440, end: 2300});
- chrome_test_utils.addEvent(model.browserMain,
- {title: 'model end', start: 3184, end: 3185});
- };
- verifier.expectedIRs = [
- {title: 'Idle', start: 0, end: 1274, eventCount: 0},
- {title: 'Scroll,Tap,Touch Response', start: 1274, end: 1387,
- eventCount: 6, isAnimationBegin: true},
- {title: 'Scroll,Touch Animation', start: 1387, end: 1474,
- eventCount: 10},
- {title: 'Fling Animation', start: 1427, end: 2300,
- eventCount: 2},
- {title: 'Idle', start: 2300, end: 3185, eventCount: 0}
- ];
- verifier.verify();
- });
-
- test('TapResponseOverlappingTouchAnimation', function() {
- var verifier = new UserExpectationVerifier();
- verifier.customizeModelCallback = function(model) {
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 0, end: 10});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 5, end: 15});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TOUCH_MOVE,
- {start: 10, end: 20});
- chrome_test_utils.addInputEvent(model, INPUT_TYPE.TAP,
- {start: 15, end: 100});
- };
- verifier.expectedIRs = [
- {title: 'Tap,Touch Response', start: 0, end: 100,
- eventCount: 4}
- ];
- verifier.verify();
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/index.js b/chromium/third_party/catapult/tracing/tracing/index.js
deleted file mode 100644
index e4f346ae140..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/index.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2016 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-'use strict';
-
-var fs = require('fs');
-var path = require('path');
-
-var catapultPath = fs.realpathSync(path.join(__dirname, '..', '..'));
-var catapultBuildPath = path.join(catapultPath, 'catapult_build');
-
-var node_bootstrap = require(path.join(catapultBuildPath, 'node_bootstrap.js'));
-
-HTMLImportsLoader.addArrayToSourcePath(
- node_bootstrap.getSourcePathsForProject('tracing'));
-
-// Go!
-HTMLImportsLoader.loadHTML('/tracing/importer/import.html');
-HTMLImportsLoader.loadHTML('/tracing/model/model.html');
-HTMLImportsLoader.loadHTML('/tracing/extras/full_config.html');
-
-// Make the tracing namespace the main tracing export.
-module.exports = global.tr;
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/__init__.py b/chromium/third_party/catapult/tracing/tracing/metrics/__init__.py
deleted file mode 100644
index cffcee63c42..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/__init__.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-import sys
-
-
-_CATAPULT_DIR = os.path.abspath(os.path.join(
- os.path.dirname(os.path.abspath(__file__)), '..', '..', '..'))
-
-_PI_PATH = os.path.join(_CATAPULT_DIR, 'perf_insights')
-
-if _PI_PATH not in sys.path:
- sys.path.insert(1, _PI_PATH)
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html b/chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html
deleted file mode 100644
index 16a0591b9f4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/all_metrics.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/metrics/sample_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/clock_sync_latency_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/efficiency_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/first_paint_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/hazard_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/memory_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/power_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/responsiveness_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/system_health_metrics.html">
-<link rel="import" href="/tracing/metrics/system_health/webview_startup_metric.html">
-<link rel="import" href="/tracing/metrics/tracing_metric.html">
-<link rel="import" href="/tracing/metrics/v8/execution_metric.html">
-<link rel="import" href="/tracing/metrics/v8/gc_metric.html">
-<link rel="import" href="/tracing/metrics/v8/v8_metrics.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/discover.py b/chromium/third_party/catapult/tracing/tracing/metrics/discover.py
deleted file mode 100644
index ef532c6d0df..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/discover.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import json
-import os
-
-import tracing_project
-import vinn
-
-
-_DISCOVER_CMD_LINE = os.path.join(
- os.path.dirname(__file__), 'discover_cmdline.html')
-
-
-def DiscoverMetrics(modules_to_load):
- """ Returns a list of registered metrics.
-
- Args:
- modules_to_load: a list of modules (string) to be loaded before discovering
- the registered metrics.
- """
- assert isinstance(modules_to_load, list)
- project = tracing_project.TracingProject()
- all_source_paths = list(project.source_paths)
-
- res = vinn.RunFile(
- _DISCOVER_CMD_LINE, source_paths=all_source_paths,
- js_args=modules_to_load)
-
- if res.returncode != 0:
- raise RuntimeError('Error running metrics_discover_cmdline: ' + res.stdout)
- else:
- return [str(m) for m in json.loads(res.stdout)]
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/discover_cmdline.html b/chromium/third_party/catapult/tracing/tracing/metrics/discover_cmdline.html
deleted file mode 100644
index 8cf7f307aee..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/discover_cmdline.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-
-<script>
-'use strict';
-
-function discoverMetrics(args) {
- for (var i = 0; i < args.length; i++) {
- var filename = args[i];
- HTMLImportsLoader.loadHTML(filename);
- }
-
- var metrics = tr.metrics.MetricRegistry.getAllRegisteredTypeInfos();
- var discovered_metric_names = [];
- for (var i = 0; i < metrics.length; i++) {
- discovered_metric_names.push(metrics[i].constructor.name);
- }
- console.log(JSON.stringify(discovered_metric_names));
- return 0;
-}
-
-if (tr.isHeadless)
- quit(discoverMetrics(sys.argv.slice(1)));
-
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/discover_unittest.py b/chromium/third_party/catapult/tracing/tracing/metrics/discover_unittest.py
deleted file mode 100644
index f81417df2c8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/discover_unittest.py
+++ /dev/null
@@ -1,22 +0,0 @@
-# Copyright (c) 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import unittest
-
-from tracing.metrics import discover
-
-class MetricsDiscoverUnittest(unittest.TestCase):
- def testMetricsDiscoverEmpty(self):
- self.assertFalse(discover.DiscoverMetrics([]))
-
- def testMetricsDiscoverNonEmpty(self):
- self.assertEquals(
- ['sampleMetric'],
- discover.DiscoverMetrics(
- ['/tracing/metrics/sample_metric.html']))
-
- def testMetricsDiscoverMultipleMetrics(self):
- self.assertGreater(
- len(discover.DiscoverMetrics(
- ['/tracing/metrics/all_metrics.html'])), 1)
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function.html b/chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function.html
deleted file mode 100644
index bbfa316d771..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function.html
+++ /dev/null
@@ -1,58 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/perf_insights/mre/function_handle.html">
-<link rel="import" href="/tracing/metrics/all_metrics.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics', function() {
- /**
- * @param {!pi.mre.MreResult} result
- * @param {!tr.model.Model} model
- * @param {!Object} options
- */
- function metricMapFunction(result, model, options) {
- if (options === undefined)
- throw new Error('Expected an options dict.');
-
- var metricName = options.metric;
- if (metricName === undefined)
- throw new Error('A metric name should be specified.');
-
- var values = new tr.v.ValueSet();
-
- var metric = tr.metrics.MetricRegistry.findTypeInfoWithName(metricName);
- if (metric === undefined)
- throw new Error('"' + metricName + '" is not a registered metric.');
- metric.constructor(values, model);
-
- for (var metadata of model.metadata) {
- if (!metadata.value || !metadata.value['iteration-info'])
- continue;
- var iteration = new tr.v.d.IterationInfo(
- metadata.value['iteration-info']);
- // Values can be separated from their ValueSet and mixed into ValueSets
- // with Values from other iterations, so add IterationInfo to each Value.
- values.map(function(value) {
- value.diagnostics.add(tr.v.ITERATION_INFO_DIAGNOSTIC_NAME, iteration);
- });
- }
-
- result.addPair('values', values.valueDicts);
- }
-
- pi.FunctionRegistry.register(metricMapFunction);
-
- return {
- metricMapFunction: metricMapFunction
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function_test.html
deleted file mode 100644
index f66ed23949c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/metric_map_function_test.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/perf_insights/mre/mre_result.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/metrics/metric_map_function.html">
-<link rel="import" href="/tracing/metrics/sample_metric.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var test_utils = tr.c.TestUtils;
- var ThreadSlice = tr.model.ThreadSlice;
-
- test('metricMapTest', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'E'}
- ];
- var m = test_utils.newModelWithEvents(JSON.stringify(events), {
- shiftWorldToZero: false,
- pruneEmptyContainers: false,
- trackDetailedModelStats: true,
- customizeModelCallback: function(m) {
- var p1 = m.getOrCreateProcess(1);
- var t2 = p1.getOrCreateThread(2);
- var t2_s1 = t2.sliceGroup.pushSlice(test_utils.newSliceEx({
- type: ThreadSlice,
- name: 'some_slice',
- start: 0, end: 10
- }));
- var t2_s2 = t2.sliceGroup.pushSlice(test_utils.newSliceEx({
- type: ThreadSlice,
- name: 'some_slice',
- start: 20, end: 30
- }));
- }
- });
-
- assert.throw(function() {
- var result = new pi.mre.MreResult();
- tr.metrics.metricMapFunction(result, m, {});
- }, Error, 'A metric name should be specified.');
-
- assert.throw(function() {
- var result = new pi.mre.MreResult();
- tr.metrics.metricMapFunction(result, m, {'metric': 'wrongMetric'});
- }, Error, '"wrongMetric" is not a registered metric.');
-
- var result = new pi.mre.MreResult();
- tr.metrics.metricMapFunction(result, m, {'metric': 'sampleMetric'});
- assert.property(result.pairs, 'values');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/metric_registry.html b/chromium/third_party/catapult/tracing/tracing/metrics/metric_registry.html
deleted file mode 100644
index d0f52ef71fc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/metric_registry.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/extension_registry.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics', function() {
-
- function MetricRegistry() {}
-
- var options = new tr.b.ExtensionRegistryOptions(tr.b.BASIC_REGISTRY_MODE);
- options.defaultMetadata = {};
- tr.b.decorateExtensionRegistry(MetricRegistry, options);
-
- MetricRegistry.addEventListener('will-register', function(e) {
- var metric = e.typeInfo.constructor;
- if (!(metric instanceof Function))
- throw new Error('Metrics must be functions');
-
- if (metric.length < 2) {
- throw new Error('Metrics take a ValueSet and a Model and ' +
- 'optionally an options dictionary');
- }
- });
-
- return {
- MetricRegistry: MetricRegistry
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/metric_registry_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/metric_registry_test.html
deleted file mode 100644
index 21a3584a3ab..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/metric_registry_test.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var test_utils = tr.c.TestUtils;
- var ThreadSlice = tr.model.ThreadSlice;
-
- test('FindMetricByName', function() {
- function sampleMetricA(values, model) {
- var unit = tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
- var n1 = new tr.v.ScalarNumeric(unit, 1);
- values.addValue(new tr.v.NumericValue('foo', n1));
- }
- tr.metrics.MetricRegistry.register(sampleMetricA);
-
- function sampleMetricB(values, model) {
- var unit = tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
- var n1 = new tr.v.ScalarNumeric(unit, 1);
- var n2 = new tr.v.ScalarNumeric(unit, 2);
- values.addValue(new tr.v.NumericValue('foo', n1));
- values.addValue(new tr.v.NumericValue('bar', n2));
- }
- tr.metrics.MetricRegistry.register(sampleMetricB);
-
- function sampleMetricC(values, model) {
- var unit = tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
- var n1 = new tr.v.ScalarNumeric(unit, 1);
- var n2 = new tr.v.ScalarNumeric(unit, 2);
- var n3 = new tr.v.ScalarNumeric(unit, 3);
- values.addValue(new tr.v.NumericValue('foo', n1));
- values.addValue(new tr.v.NumericValue('bar', n2));
- values.addValue(new tr.v.NumericValue('baz', n3));
- }
- tr.metrics.MetricRegistry.register(sampleMetricC);
-
- assert.isTrue(tr.metrics.MetricRegistry.findTypeInfoWithName('sampleMetricB').constructor === sampleMetricB); // @suppress longLineCheck
- });
-
- test('registerNonFunctionThrows', function() {
- assert.throws(function() {
- tr.metrics.MetricRegistry.register('not a function');
- });
-
- assert.throws(function() {
- tr.metrics.MetricRegistry.register(function() {});
- });
-
- assert.throws(function() {
- tr.metrics.MetricRegistry.register(function(a) {});
- });
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/metric_runner.py b/chromium/third_party/catapult/tracing/tracing/metrics/metric_runner.py
deleted file mode 100644
index 62ac454ed42..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/metric_runner.py
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-import os
-
-from perf_insights.mre import function_handle
-from perf_insights.mre import map_runner
-from perf_insights.mre import progress_reporter
-from perf_insights.mre import file_handle
-from perf_insights.mre import job as job_module
-
-_METRIC_MAP_FUNCTION_FILENAME = 'metric_map_function.html'
-
-_METRIC_MAP_FUNCTION_NAME = 'metricMapFunction'
-
-def _GetMetricsDir():
- return os.path.dirname(os.path.abspath(__file__))
-
-def _GetMetricRunnerHandle(metric):
- assert isinstance(metric, basestring)
- metrics_dir = _GetMetricsDir()
- metric_mapper_path = os.path.join(metrics_dir, _METRIC_MAP_FUNCTION_FILENAME)
-
- modules_to_load = [function_handle.ModuleToLoad(filename=metric_mapper_path)]
- options = {'metric': metric}
- map_function_handle = function_handle.FunctionHandle(
- modules_to_load, _METRIC_MAP_FUNCTION_NAME, options)
-
- return job_module.Job(map_function_handle, None)
-
-def RunMetric(filename, metric, extra_import_options=None):
- result = RunMetricOnTraces([filename], metric, extra_import_options)
- return result[filename]
-
-def RunMetricOnTraces(filenames, metric,
- extra_import_options=None):
- trace_handles = [
- file_handle.URLFileHandle(f, 'file://%s' % f) for f in filenames]
- job = _GetMetricRunnerHandle(metric)
- runner = map_runner.MapRunner(
- trace_handles, job,
- extra_import_options=extra_import_options,
- progress_reporter=progress_reporter.ProgressReporter())
- map_results = runner.RunMapper()
- return map_results
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/sample_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/sample_metric.html
deleted file mode 100644
index 43ae5dae567..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/sample_metric.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics', function() {
- var sizeInBytes_smallerIsBetter =
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
-
- var SIZE_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- sizeInBytes_smallerIsBetter, tr.b.Range.fromExplicitRange(1, 100), 100);
-
- function sampleMetric(values, model) {
- var n1 = new tr.v.ScalarNumeric(sizeInBytes_smallerIsBetter, 1);
- var n2 = new tr.v.ScalarNumeric(sizeInBytes_smallerIsBetter, 2);
- var n3 = SIZE_NUMERIC_BUILDER.build();
- n3.add(1);
- values.addValue(new tr.v.NumericValue('foo', n1));
- values.addValue(new tr.v.NumericValue('bar', n2));
- values.addValue(new tr.v.NumericValue('baz', n3));
- }
-
- tr.metrics.MetricRegistry.register(sampleMetric);
-
- return {
- sampleMetric: sampleMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric.html
deleted file mode 100644
index c30d0790d8c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
-
- function syncIsComplete(markers) {
- return markers.length === 2;
- }
-
- function syncInvolvesTelemetry(markers) {
- for (var marker of markers)
- if (marker.domainId === tr.model.ClockDomainId.TELEMETRY)
- return true;
-
- return false;
- }
-
- function clockSyncLatencyMetric(values, model) {
- for (var markers of model.clockSyncManager.markersBySyncId.values()) {
- var latency = undefined;
- var targetDomain = undefined;
- if (!syncIsComplete(markers) || !syncInvolvesTelemetry(markers))
- continue;
- for (var marker of markers) {
- var domain = marker.domainId;
- if (domain === tr.model.ClockDomainId.TELEMETRY)
- latency = (marker.endTs - marker.startTs);
- else
- targetDomain = domain;
- }
- values.addValue(new tr.v.NumericValue(
- 'clock_sync_latency_' + targetDomain,
- new tr.v.ScalarNumeric(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- latency),
- { description: 'Clock sync latency for domain ' + targetDomain }));
- }
- };
-
- tr.metrics.MetricRegistry.register(clockSyncLatencyMetric);
-
- return {
- clockSyncLatencyMetric: clockSyncLatencyMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric_test.html
deleted file mode 100644
index fe6a37d4819..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/clock_sync_latency_metric_test.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/metrics/system_health/clock_sync_latency_metric.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('clockSyncLatencyMetric', function() {
- var model = new tr.Model();
- model.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.TELEMETRY, 'ID01', 1.0, 4.0);
- model.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.TELEMETRY, 'ID02', 2.0, 8.0);
- model.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.BATTOR, 'ID01', 2.5);
- model.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.WIN_QPC, 'ID02', 5.0);
-
- var battorName = 'clock_sync_latency_' + tr.model.ClockDomainId.BATTOR;
- var winQpcName = 'clock_sync_latency_' + tr.model.ClockDomainId.WIN_QPC;
-
- var valueSet = new tr.v.ValueSet();
- tr.metrics.sh.clockSyncLatencyMetric(valueSet, model);
-
- var battorEntry = tr.b.getOnlyElement(
- valueSet.valueDicts.filter(
- (dict) => dict.name === battorName));
-
- var winQpcEntry = tr.b.getOnlyElement(
- valueSet.valueDicts.filter(
- (dict) => dict.name === winQpcName));
-
- assert.equal(battorEntry.numeric.value, 3.0);
- assert.equal(winQpcEntry.numeric.value, 6.0);
- });
-
- test('clockSyncLatencyMetric_noTelemetry', function() {
- var model = new tr.Model();
- model.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.TELEMETRY, 'ID01', 1.0, 4.0);
- model.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.BATTOR, 'ID02', 2.5);
- model.clockSyncManager.addClockSyncMarker(
- tr.model.ClockDomainId.WIN_QPC, 'ID02', 5.0);
-
- var valueSet = new tr.v.ValueSet();
- tr.metrics.sh.clockSyncLatencyMetric(valueSet, model);
-
- assert.lengthOf(valueSet.valueDicts, 0);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric.html
deleted file mode 100644
index 6274def9412..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/utils.html">
-<link rel="import" href="/tracing/model/user_model/animation_expectation.html">
-<link rel="import" href="/tracing/model/user_model/idle_expectation.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- var UNIT = tr.v.Unit.byName.normalizedPercentage_biggerIsBetter;
-
- var DESCRIPTION = 'Normalized CPU budget consumption';
-
- function efficiencyMetric(values, model) {
- var scores = [];
-
- model.userModel.expectations.forEach(function(ue) {
- var options = {};
- options.description = DESCRIPTION;
-
- var score = undefined;
-
- if ((ue.totalCpuMs === undefined) ||
- (ue.totalCpuMs == 0))
- return;
-
- var cpuFractionBudget = tr.b.Range.fromExplicitRange(0.5, 1.5);
-
- if (ue instanceof tr.model.um.IdleExpectation) {
- cpuFractionBudget = tr.b.Range.fromExplicitRange(0.1, 1);
- } else if (ue instanceof tr.model.um.AnimationExpectation) {
- cpuFractionBudget = tr.b.Range.fromExplicitRange(1, 2);
- }
-
- var cpuMsBudget = tr.b.Range.fromExplicitRange(
- ue.duration * cpuFractionBudget.min,
- ue.duration * cpuFractionBudget.max);
- var normalizedCpu = tr.b.normalize(
- ue.totalCpuMs, cpuMsBudget.min, cpuMsBudget.max);
- score = 1 - tr.b.clamp(normalizedCpu, 0, 1);
-
- scores.push(score);
-
- values.addValue(new tr.v.NumericValue(
- 'efficiency', new tr.v.ScalarNumeric(UNIT, score), options));
- });
-
- // Manually reduce scores.
- // https://github.com/catapult-project/catapult/issues/2036
-
- var options = {};
- options.description = DESCRIPTION;
- var overallScore = tr.b.Statistics.weightedMean(
- scores, tr.metrics.sh.perceptualBlend);
- if (overallScore === undefined)
- return;
-
- values.addValue(new tr.v.NumericValue(
- 'efficiency', new tr.v.ScalarNumeric(UNIT, overallScore), options));
- }
-
- tr.metrics.MetricRegistry.register(efficiencyMetric);
-
- return {
- efficiencyMetric: efficiencyMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric_test.html
deleted file mode 100644
index 5fe0f1a4561..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/efficiency_metric_test.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import"
- href="/tracing/metrics/system_health/efficiency_metric.html">
-<link rel="import" href="/tracing/model/user_model/idle_expectation.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function createModel() {
- return tr.c.TestUtils.newModel(function(model) {
- model.p1 = model.getOrCreateProcess(1);
- model.t2 = model.p1.getOrCreateThread(2);
-
- var slice = tr.c.TestUtils.newSliceEx({
- title: 'foo',
- start: 0,
- end: 100,
- type: tr.model.ThreadSlice
- });
- slice.isTopLevel = true;
-
- var idle = new tr.model.um.IdleExpectation(model, 0, 100);
- idle.associatedEvents.push(slice);
- model.userModel.expectations.push(idle);
- });
- }
-
- test('optimalEfficiency', function() {
- var model = createModel();
- var exp = model.userModel.expectations[0];
- tr.b.getOnlyElement(exp.associatedEvents).cpuSelfTime = 10;
- var values = new tr.v.ValueSet();
- tr.metrics.sh.efficiencyMetric(values, model);
- assert.equal(1, values.valueDicts[0].numeric.value);
- });
-
- test('pessimalEfficiency', function() {
- var model = createModel();
- var exp = model.userModel.expectations[0];
- tr.b.getOnlyElement(exp.associatedEvents).cpuSelfTime = 100;
- var values = new tr.v.ValueSet();
- tr.metrics.sh.efficiencyMetric(values, model);
- assert.equal(0, values.valueDicts[0].numeric.value);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric.html
deleted file mode 100644
index bc1aa3828ca..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric.html
+++ /dev/null
@@ -1,423 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/utils.html">
-<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
-<link rel="import" href="/tracing/model/timed_event.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- var timeDurationInMs_smallerIsBetter =
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter;
-
- function findTargetRendererHelper(chromeHelper) {
- var largestPid = -1;
- for (var pid in chromeHelper.rendererHelpers) {
- var rendererHelper = chromeHelper.rendererHelpers[pid];
- if (rendererHelper.isChromeTracingUI)
- continue;
- if (pid > largestPid)
- largestPid = pid;
- }
-
- if (largestPid === -1)
- return undefined;
-
- return chromeHelper.rendererHelpers[largestPid];
- }
-
- /**
- * A utility class for finding navigationStart event for given frame and
- * timestamp.
- * @constructor
- */
- function NavigationStartFinder(rendererHelper) {
- this.navigationStartsForFrameId_ = {};
- for (var ev of rendererHelper.mainThread.sliceGroup.childEvents()) {
- if (ev.category !== 'blink.user_timing' ||
- ev.title !== 'navigationStart')
- continue;
- var frameIdRef = ev.args['frame'];
- var list = this.navigationStartsForFrameId_[frameIdRef];
- if (list === undefined)
- this.navigationStartsForFrameId_[frameIdRef] = list = [];
- list.unshift(ev);
- }
- }
-
- NavigationStartFinder.prototype = {
- findNavigationStartEventForFrameBeforeTimestamp: function(frameIdRef, ts) {
- var list = this.navigationStartsForFrameId_[frameIdRef];
- if (list === undefined) {
- console.warn('No navigationStartEvent found for frame id "' +
- frameIdRef + '"');
- return undefined;
- }
- var eventBeforeTimestamp;
- for (var ev of list) {
- if (ev.start > ts)
- continue;
- if (eventBeforeTimestamp === undefined)
- eventBeforeTimestamp = ev;
- }
- if (eventBeforeTimestamp === undefined) {
- console.warn('Failed to find navigationStartEvent.');
- return undefined;
- }
- return eventBeforeTimestamp;
- }
- };
-
- /**
- * A utility class for finding Paint event for given frame and timestamp.
- * @constructor
- */
- function PaintFinder(rendererHelper) {
- this.paintsForFrameId_ = {};
- for (var ev of rendererHelper.mainThread.sliceGroup.childEvents()) {
- if (ev.category !== 'devtools.timeline' || ev.title !== 'Paint')
- continue;
- var frameIdRef = ev.args['data']['frame'];
- var list = this.paintsForFrameId_[frameIdRef];
- if (list === undefined)
- this.paintsForFrameId_[frameIdRef] = list = [];
- list.push(ev);
- }
- }
-
- PaintFinder.prototype = {
- findPaintEventForFrameAfterTimestamp: function(frameIdRef, ts) {
- var list = this.paintsForFrameId_[frameIdRef];
- if (list === undefined)
- return undefined;
-
- var eventAfterTimestamp;
- for (var ev of list) {
- if (ev.start < ts)
- continue;
- if (eventAfterTimestamp === undefined)
- eventAfterTimestamp = ev;
- }
- return eventAfterTimestamp;
- }
- };
-
- var FIRST_PAINT_NUMERIC_BUILDER =
- new tr.v.NumericBuilder(timeDurationInMs_smallerIsBetter, 0)
- .addLinearBins(1000, 20) // 50ms step to 1s
- .addLinearBins(3000, 20) // 100ms step to 3s
- .addExponentialBins(20000, 20);
- function createHistogram() {
- var histogram = FIRST_PAINT_NUMERIC_BUILDER.build();
- histogram.customizeSummaryOptions({
- avg: true,
- count: false,
- max: true,
- min: true,
- std: true,
- sum: false,
- percentile: [0.90, 0.95, 0.99],
- });
- return histogram;
- }
-
- function findFrameLoaderSnapshotAt(rendererHelper, frameIdRef, ts) {
- var snapshot;
-
- var objects = rendererHelper.process.objects;
- var frameLoaderInstances = objects.instancesByTypeName_['FrameLoader'];
- if (frameLoaderInstances === undefined) {
- console.warn('Failed to find FrameLoader for frameId "' + frameIdRef +
- '" at ts ' + ts + ', the trace maybe incomplete or from an old' +
- 'Chrome.');
- return undefined;
- }
-
- var snapshot;
- for (var instance of frameLoaderInstances) {
- if (!instance.isAliveAt(ts))
- continue;
- var maybeSnapshot = instance.getSnapshotAt(ts);
- if (frameIdRef !== maybeSnapshot.args['frame']['id_ref'])
- continue;
- snapshot = maybeSnapshot;
- }
-
- return snapshot;
- }
-
- function findAllUserTimingEvents(rendererHelper, title) {
- var targetEvents = [];
-
- for (var ev of rendererHelper.process.getDescendantEvents()) {
- if (ev.category !== 'blink.user_timing' || ev.title !== title)
- continue;
- targetEvents.push(ev);
- }
-
- return targetEvents;
- }
-
- function findAllLayoutEvents(rendererHelper) {
- var isTelemetryInternalEvent =
- prepareTelemetryInternalEventPredicate(rendererHelper);
- var layoutsForFrameId = {};
- for (var ev of rendererHelper.process.getDescendantEvents()) {
- if (ev.category !==
- 'blink,benchmark,disabled-by-default-blink.debug.layout' ||
- ev.title !== 'FrameView::performLayout')
- continue;
- if (isTelemetryInternalEvent(ev))
- continue;
- if (ev.args.counters === undefined) {
- console.warn('Ignoring FrameView::performLayout event with no ' +
- 'counters arg (END event is missing).');
- continue;
- }
- var frameIdRef = ev.args.counters['frame'];
- if (frameIdRef === undefined)
- continue;
- var list = layoutsForFrameId[frameIdRef];
- if (list === undefined)
- layoutsForFrameId[frameIdRef] = list = [];
- list.push(ev);
- }
- return layoutsForFrameId;
- }
-
- function prepareTelemetryInternalEventPredicate(rendererHelper) {
- var ignoreRegions = [];
-
- var internalRegionStart;
- for (var slice of
- rendererHelper.mainThread.asyncSliceGroup.getDescendantEvents()) {
- if (!!slice.title.match(/^telemetry\.internal\.[^.]*\.start$/))
- internalRegionStart = slice.start;
- if (!!slice.title.match(/^telemetry\.internal\.[^.]*\.end$/)) {
- var timedEvent = new tr.model.TimedEvent(internalRegionStart);
- timedEvent.duration = slice.end - internalRegionStart;
- ignoreRegions.push(timedEvent);
- }
- }
-
- return function isTelemetryInternalEvent(slice) {
- for (var region of ignoreRegions)
- if (region.bounds(slice))
- return true;
- return false;
- }
- }
-
- var URL_BLACKLIST = [
- 'about:blank',
- // Chrome on Android creates main frames with the below URL for plugins.
- 'data:text/html,pluginplaceholderdata'
- ];
- function shouldIgnoreURL(url) {
- return URL_BLACKLIST.indexOf(url) >= 0;
- }
-
- var METRICS = [
- {
- valueName: 'firstContentfulPaint',
- title: 'firstContentfulPaint',
- description: 'time to first contentful paint'
- },
- {
- valueName: 'timeToOnload',
- title: 'loadEventStart',
- description: 'time to onload. ' +
- 'This is temporary metric used for PCv1/v2 sanity checking'
- }];
-
- function firstContentfulPaintMetric(values, model) {
- var chromeHelper = model.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- var rendererHelper = findTargetRendererHelper(chromeHelper);
- var isTelemetryInternalEvent =
- prepareTelemetryInternalEventPredicate(rendererHelper);
- var navigationStartFinder = new NavigationStartFinder(rendererHelper);
-
- for (var metric of METRICS) {
- var histogram = createHistogram();
- var targetEvents = findAllUserTimingEvents(rendererHelper, metric.title);
- for (var ev of targetEvents) {
- if (isTelemetryInternalEvent(ev))
- continue;
- var frameIdRef = ev.args['frame'];
- var snapshot =
- findFrameLoaderSnapshotAt(rendererHelper, frameIdRef, ev.start);
- if (snapshot === undefined || !snapshot.args.isLoadingMainFrame)
- continue;
- var url = snapshot.args.documentLoaderURL;
- if (shouldIgnoreURL(url))
- continue;
- var navigationStartEvent = navigationStartFinder.
- findNavigationStartEventForFrameBeforeTimestamp(frameIdRef, ev.start);
- // Ignore layout w/o preceding navigationStart, as they are not
- // attributed to any time-to-X metric.
- if (navigationStartEvent === undefined)
- continue;
-
- var timeToEvent = ev.start - navigationStartEvent.start;
- histogram.add(timeToEvent, {url: url});
- }
- values.addValue(new tr.v.NumericValue(
- metric.valueName, histogram,
- { description: metric.description }));
- }
- }
-
- /**
- * Compute significance of given layout event.
- *
- * Significance of a layout is the number of layout objects newly added to the
- * layout tree, weighted by page height (before and after the layout).
- */
- function layoutSignificance(event) {
- var newObjects = event.args.counters['LayoutObjectsThatHadNeverHadLayout'];
- var visibleHeight = event.args['counters']['visibleHeight'];
- if (!newObjects || !visibleHeight)
- return 0;
-
- var heightBefore = event.args['contentsHeightBeforeLayout'];
- var heightAfter = event.args['counters']['contentsHeightAfterLayout'];
- var ratioBefore = Math.max(1, heightBefore / visibleHeight);
- var ratioAfter = Math.max(1, heightAfter / visibleHeight);
- return newObjects / ((ratioBefore + ratioAfter) / 2);
- }
-
- /**
- * If there are loading fonts when layout happened, the layout change
- * accounting is postponed until the font is displayed. However, icon fonts
- * shouldn't block first meaningful paint. We use a threshold that only web
- * fonts that laid out more than 200 characters should block first meaningful
- * paint.
- */
- function hasTooManyBlankCharactersToBeMeaningful(event) {
- var BLOCK_FIRST_MEANINGFUL_PAINT_IF_BLANK_CHARACTERS_MORE_THAN = 200;
- return event.args['counters']['approximateBlankCharacterCount'] >
- BLOCK_FIRST_MEANINGFUL_PAINT_IF_BLANK_CHARACTERS_MORE_THAN;
- }
-
- /**
- * Computes Time to first meaningful paint (TTFMP) from |model| and add it to
- * |value|.
- *
- * TTFMP is computed from three types of events: NavigationStart, Layout, and
- * Paint. Each Layout event has associated "significance" value, indicating
- * how the layout was visually significant.
- *
- * TTFMP is the time between NavigationStart and Paint that follows the Layout
- * with biggest significance value.
- *
- * Design doc: https://goo.gl/vpaxv6
- */
- function firstMeaningfulPaintMetric(values, model) {
- var chromeHelper = model.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- var rendererHelper = findTargetRendererHelper(chromeHelper);
- var navigationStartFinder = new NavigationStartFinder(rendererHelper);
- var paintFinder = new PaintFinder(rendererHelper);
- var firstMeaningfulPaintHistogram = createHistogram();
-
- function addFirstMeaningfulPaintSampleToHistogram(
- frameIdRef, navigationStart, mostSignificantLayout) {
- var snapshot = findFrameLoaderSnapshotAt(
- rendererHelper, frameIdRef, mostSignificantLayout.start);
- if (snapshot === undefined || !snapshot.args.isLoadingMainFrame)
- return;
- var url = snapshot.args.documentLoaderURL;
- if (shouldIgnoreURL(url))
- return;
- var paintEvent = paintFinder.findPaintEventForFrameAfterTimestamp(
- frameIdRef, mostSignificantLayout.start);
- if (paintEvent === undefined) {
- console.warn('Failed to find paint event after the most significant ' +
- 'layout for frameId "' + frameIdRef + '".');
- return;
- }
- var timeToFirstMeaningfulPaint = paintEvent.start - navigationStart.start;
- firstMeaningfulPaintHistogram.add(timeToFirstMeaningfulPaint, {url: url});
- }
-
- var layoutsForFrameId = findAllLayoutEvents(rendererHelper);
-
- for (var frameIdRef in layoutsForFrameId) {
- var navigationStart;
- var mostSignificantLayout;
- var maxSignificanceSoFar = 0;
- var accumulatedSignificanceWhileHavingBlankText = 0;
-
- // Iterate over the layout events, remembering one with largest
- // significance.
- for (var ev of layoutsForFrameId[frameIdRef]) {
- var navigationStartForThisLayout = navigationStartFinder.
- findNavigationStartEventForFrameBeforeTimestamp(frameIdRef, ev.start);
- // Ignore layout w/o preceding navigationStart, as they are not
- // attributed to any TTFMP.
- if (navigationStartForThisLayout === undefined)
- continue;
-
- if (navigationStart !== navigationStartForThisLayout) {
- // New navigation is found. Compute TTFMP for current navigation, and
- // reset the state variables.
- if (navigationStart !== undefined &&
- mostSignificantLayout !== undefined)
- addFirstMeaningfulPaintSampleToHistogram(
- frameIdRef, navigationStart, mostSignificantLayout);
- navigationStart = navigationStartForThisLayout;
- mostSignificantLayout = undefined;
- maxSignificanceSoFar = 0;
- accumulatedSignificanceWhileHavingBlankText = 0;
- }
-
- // Check if |ev| has the largest significance. If the page has many
- // blank characters, the significance value is accumulated until
- // the text become visible.
- var significance = layoutSignificance(ev);
- if (hasTooManyBlankCharactersToBeMeaningful(ev)) {
- accumulatedSignificanceWhileHavingBlankText += significance;
- } else {
- significance += accumulatedSignificanceWhileHavingBlankText;
- accumulatedSignificanceWhileHavingBlankText = 0;
- if (significance > maxSignificanceSoFar) {
- maxSignificanceSoFar = significance;
- mostSignificantLayout = ev;
- }
- }
- }
-
- // Emit TTFMP for the last navigation.
- if (mostSignificantLayout !== undefined)
- addFirstMeaningfulPaintSampleToHistogram(
- frameIdRef, navigationStart, mostSignificantLayout);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'firstMeaningfulPaint', firstMeaningfulPaintHistogram,
- { description: 'time to first meaningful paint' }));
- }
-
- function firstPaintMetric(values, model) {
- firstContentfulPaintMetric(values, model);
- firstMeaningfulPaintMetric(values, model);
- }
-
- tr.metrics.MetricRegistry.register(firstPaintMetric);
-
- return {
- firstPaintMetric: firstPaintMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric_test.html
deleted file mode 100644
index be318aa3600..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/first_paint_metric_test.html
+++ /dev/null
@@ -1,235 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import"
- href="/tracing/metrics/system_health/first_paint_metric.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('firstContentfulPaint', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var rendererProcess = model.getOrCreateProcess(1);
- var mainThread = rendererProcess.getOrCreateThread(2);
- mainThread.name = 'CrRendererMain';
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'navigationStart',
- start: 200,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- rendererProcess.objects.addSnapshot('ptr', 'loading', 'FrameLoader', 300,
- {isLoadingMainFrame: true, frame: {id_ref: '0xdeadbeef'},
- documentLoaderURL: 'http://example.com'});
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'firstContentfulPaint',
- start: 1000,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- });
- var values = new tr.v.ValueSet();
- tr.metrics.sh.firstPaintMetric(values, model);
- var numeric = values.valueDicts[0].numeric;
- assert.equal(1, numeric.running.count);
- assert.equal(800, numeric.running.mean);
- });
-
- test('firstContentfulPaintIgnoringWarmCache', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var rendererProcess = model.getOrCreateProcess(1);
- var mainThread = rendererProcess.getOrCreateThread(2);
- mainThread.name = 'CrRendererMain';
-
- // warm cache navigation
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'navigationStart',
- start: 200,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- mainThread.asyncSliceGroup.push(tr.c.TestUtils.newAsyncSliceEx({
- cat: 'blink.console',
- title: 'telemetry.internal.warmCache.start',
- start: 250,
- duration: 0.0
- }));
- rendererProcess.objects.addSnapshot('ptr', 'loading', 'FrameLoader', 300,
- {isLoadingMainFrame: true, frame: {id_ref: '0xdeadbeef'},
- documentLoaderURL: 'http://example.com'});
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'firstContentfulPaint',
- start: 1000,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- mainThread.asyncSliceGroup.push(tr.c.TestUtils.newAsyncSliceEx({
- cat: 'blink.console',
- title: 'telemetry.internal.warmCache.end',
- start: 1250,
- duration: 0.0
- }));
-
- // measurement navigation
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'navigationStart',
- start: 2000,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- rendererProcess.objects.addSnapshot('ptr', 'loading', 'FrameLoader', 2100,
- {isLoadingMainFrame: true, frame: {id_ref: '0xdeadbeef'},
- documentLoaderURL: 'http://example.com'});
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'firstContentfulPaint',
- start: 2400,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- });
- var values = new tr.v.ValueSet();
- tr.metrics.sh.firstPaintMetric(values, model);
- var numeric = values.valueDicts[0].numeric;
- assert.equal(1, numeric.running.count);
- assert.equal(400, numeric.running.mean);
- });
-
- test('firstMeaningfulPaint', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var rendererProcess = model.getOrCreateProcess(1);
- var mainThread = rendererProcess.getOrCreateThread(2);
- mainThread.name = 'CrRendererMain';
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'navigationStart',
- start: 200,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- rendererProcess.objects.addSnapshot('ptr', 'loading', 'FrameLoader', 300,
- {isLoadingMainFrame: true, frame: {id_ref: '0xdeadbeef'},
- documentLoaderURL: 'http://example.com'});
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink,benchmark,disabled-by-default-blink.debug.layout',
- title: 'FrameView::performLayout',
- start: 500,
- duration: 10.0,
- args: {
- counters: {
- frame: '0xdeadbeef',
- LayoutObjectsThatHadNeverHadLayout: 10,
- contentsHeightAfterLayout: 800,
- visibleHeight: 1000,
- },
- contentsHeightBeforeLayout: 0
- }
- }));
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'devtools.timeline',
- title: 'Paint',
- start: 600,
- duration: 1.0,
- args: {data: {frame: '0xdeadbeef'}}
- }));
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink,benchmark,disabled-by-default-blink.debug.layout',
- title: 'FrameView::performLayout',
- start: 800,
- duration: 10.0,
- args: {
- counters: {
- frame: '0xdeadbeef',
- LayoutObjectsThatHadNeverHadLayout: 100,
- contentsHeightAfterLayout: 800,
- visibleHeight: 1000
- },
- contentsHeightBeforeLayout: 800
- }
- }));
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'devtools.timeline',
- title: 'Paint',
- start: 1000,
- duration: 1.0,
- args: {data: {frame: '0xdeadbeef'}}
- }));
- });
- var values = new tr.v.ValueSet();
- tr.metrics.sh.firstPaintMetric(values, model);
- var fmpEntries = values.valueDicts.filter(
- (dict) => dict.name === 'firstMeaningfulPaint');
- var numeric = fmpEntries[0].numeric;
- assert.equal(1, numeric.running.count);
- assert.equal(800, numeric.running.mean);
- });
-
- test('firstMeaningfulPaintWithInvalidLayoutCounters', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var rendererProcess = model.getOrCreateProcess(1);
- var mainThread = rendererProcess.getOrCreateThread(2);
- mainThread.name = 'CrRendererMain';
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink.user_timing',
- title: 'navigationStart',
- start: 200,
- duration: 0.0,
- args: {frame: '0xdeadbeef'}
- }));
- rendererProcess.objects.addSnapshot('ptr', 'loading', 'FrameLoader', 300,
- {isLoadingMainFrame: true, frame: {id_ref: '0xdeadbeef'},
- documentLoaderURL: 'http://example.com'});
-
- // FrameView::performLayout trace event does not have frame ID
- // if blink.debug.layout category is not enabled.
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink,benchmark,disabled-by-default-blink.debug.layout',
- title: 'FrameView::performLayout',
- start: 500,
- duration: 10.0,
- args: {
- counters: {},
- contentsHeightBeforeLayout: 0
- }
- }));
-
- // Incomplete slice: counters argument is missing.
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'blink,benchmark,disabled-by-default-blink.debug.layout',
- title: 'FrameView::performLayout',
- start: 550,
- duration: 10.0,
- args: {
- contentsHeightBeforeLayout: 0
- }
- }));
-
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'devtools.timeline',
- title: 'Paint',
- start: 600,
- duration: 1.0,
- args: {data: {frame: '0xdeadbeef'}}
- }));
- });
- var values = new tr.v.ValueSet();
- tr.metrics.sh.firstPaintMetric(values, model);
- var fmpEntries = values.valueDicts.filter(
- (dict) => dict.name === 'firstMeaningfulPaint');
- var numeric = fmpEntries[0].numeric;
- assert.equal(0, numeric.running.count);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric.html
deleted file mode 100644
index 96961779782..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric.html
+++ /dev/null
@@ -1,145 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/long_tasks_metric.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- var normalizedPercentage_smallerIsBetter =
- tr.v.Unit.byName.normalizedPercentage_smallerIsBetter;
-
- // The following math is easier if the units are seconds rather than ms,
- // so durations will be converted from ms to s.
- var MS_PER_S = 1000;
-
- // https://www.desmos.com/calculator/ysabhcc42g
- var RESPONSE_RISK =
- tr.b.Statistics.LogNormalDistribution.fromMedianAndDiminishingReturns(
- 100 / MS_PER_S, 50 / MS_PER_S);
-
- /**
- * This helper function computes the risk that a task of the given duration
- * would impact the responsiveness of a speculative input.
- *
- * @param {number} durationMs
- * @return {number} task hazard
- */
- function computeResponsivenessRisk(durationMs) {
- // Returns 0 when the risk of impacting responsiveness is minimal.
- // Returns 1 when it is maximal.
- // durationMs is the duration of a long task.
- // It is at least LONG_TASK_MS.
- // The FAST_RESPONSE_HISTOGRAM was designed to permit both a 50ms task
- // when a Scroll Response begins, plus 16ms latency between the task
- // and the first frame of the scroll, without impacting the responsiveness
- // score.
- // Add 16ms to durationMs to simulate the standard (maximum ideal) scroll
- // response latency, and use the FAST_RESPONSE_HISTOGRAM to punish every ms
- // that the long task exceeds LONG_TASK_MS.
-
- durationMs += 16;
-
- // This returns a normalized percentage that
- // represents the fraction of users that would be satisfied with a
- // Scroll Response that takes durationMs to respond.
- // The risk of impacting responsiveness is approximated as the long task's
- // impact on a hypothetical Scroll Response that starts when the long task
- // starts, and then takes the standard 16ms to respond after the long task
- // finishes.
- // We imagine a Scroll Response instead of a Load or another type of
- // Response because the Scroll Response carries the strictest expectation.
- // The risk of impacting responsiveness is framed as the fraction of users
- // that would be *un*satisifed with the responsiveness of that hypothetical
- // Scroll Response. The fraction of users who are unsatisfied with something
- // is equal to 1 - the fraction of users who are satisfied with it.
- return RESPONSE_RISK.computePercentile(durationMs / MS_PER_S);
- }
-
- /**
- * This weighting function is similar to tr.metrics.sh.perceptualBlend,
- * but this version is appropriate for SmallerIsBetter metrics, whereas
- * that version is for BiggerIsBetter metrics.
- * (This would not be necessary if hazard were reframed as a BiggerIsBetter
- * metric such as "input readiness".)
- * Also, that version assumes that the 'ary' will be UserExpectations, whereas
- * this version assumes that the 'ary' will be scores.
- *
- * @param {number} hazardScore
- * @return {number} weight
- */
- function perceptualBlendSmallerIsBetter(hazardScore) {
- return Math.exp(hazardScore);
- }
-
- /**
- * Compute and return the normalized score for the risk that a speculative
- * input's responsiveness would have been impacted by long tasks on the given
- * thread in the given range.
- *
- * @param {tr.model.Thread} thread
- * @param {tr.b.Range=} opt_range
- * @return {number} hazard
- */
- function computeHazardForLongTasksInRangeOnThread(thread, opt_range) {
- var taskHazardScores = [];
- tr.metrics.sh.iterateLongTopLevelTasksOnThreadInRange(
- thread, opt_range, function(task) {
- taskHazardScores.push(computeResponsivenessRisk(task.duration));
- });
- return tr.b.Statistics.weightedMean(
- taskHazardScores, perceptualBlendSmallerIsBetter);
- }
-
- /**
- * Compute and return the normalized score for the risk that a speculative
- * input's responsiveness would have been impacted by long tasks.
- *
- * @param {tr.model.Model} model The model.
- * @return {number} hazard
- */
- function computeHazardForLongTasks(model) {
- var threadHazardScores = [];
- tr.metrics.sh.iterateRendererMainThreads(model, function(thread) {
- threadHazardScores.push(computeHazardForLongTasksInRangeOnThread(
- thread));
- });
- return tr.b.Statistics.weightedMean(
- threadHazardScores, perceptualBlendSmallerIsBetter);
- }
-
- /**
- * This EXPERIMENTAL metric computes a scalar normalized score that
- * represents the risk that a speculative input's responsiveness would have
- * been impacted by long tasks.
- * This metric requires only the 'toplevel' tracing category.
- */
- function hazardMetric(values, model) {
- var overallHazard = computeHazardForLongTasks(model);
- if (overallHazard === undefined)
- overallHazard = 0;
-
- values.addValue(new tr.v.NumericValue(
- 'hazard', new tr.v.ScalarNumeric(
- normalizedPercentage_smallerIsBetter, overallHazard)));
- }
-
- tr.metrics.MetricRegistry.register(hazardMetric);
-
- return {
- hazardMetric: hazardMetric,
- computeHazardForLongTasksInRangeOnThread:
- computeHazardForLongTasksInRangeOnThread,
- computeHazardForLongTasks: computeHazardForLongTasks,
- computeResponsivenessRisk: computeResponsivenessRisk
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric_test.html
deleted file mode 100644
index 629f608e942..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/hazard_metric_test.html
+++ /dev/null
@@ -1,88 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import"
- href="/tracing/metrics/system_health/hazard_metric.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function computeHazardValue(customizeModelCallback) {
- var model = tr.c.TestUtils.newModel(function(model) {
- model.rendererProcess = model.getOrCreateProcess(2);
- model.rendererMain = model.rendererProcess.getOrCreateThread(3);
- model.rendererMain.name = 'CrRendererMain';
-
- customizeModelCallback(model);
- });
- var values = new tr.v.ValueSet();
- tr.metrics.sh.hazardMetric(values, model);
- var valueDicts = values.valueDicts;
- assert.equal(1, valueDicts.length);
- return valueDicts[0];
- }
-
- test('minimalHazard', function() {
- var duration = 50 + 1e-4;
- var value = computeHazardValue(function(model) {
- model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- type: tr.model.ThreadSlice,
- isTopLevel: true,
- start: 0,
- duration: duration
- }));
- });
- assert.notEqual(0, value.numeric.value);
- assert.closeTo(value.numeric.value, 0.1611, 1e-5);
- });
-
- test('maximalHazard', function() {
- var value = computeHazardValue(function(model) {
- model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- type: tr.model.ThreadSlice,
- isTopLevel: true,
- start: 0,
- duration: 2200
- }));
- });
- assert.closeTo(value.numeric.value, 1, 1e-5);
- });
-
- test('blendedHazards', function() {
- var value = computeHazardValue(function(model) {
- model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- type: tr.model.ThreadSlice,
- isTopLevel: true,
- start: 0,
- duration: 100
- }));
- model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- type: tr.model.ThreadSlice,
- isTopLevel: true,
- start: 0,
- duration: 200
- }));
- model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- type: tr.model.ThreadSlice,
- isTopLevel: true,
- start: 0,
- duration: 300
- }));
- model.rendererMain.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- type: tr.model.ThreadSlice,
- isTopLevel: true,
- start: 0,
- duration: 400
- }));
- });
- assert.closeTo(0.92144, value.numeric.value, 1e-4);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/long_tasks_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/long_tasks_metric.html
deleted file mode 100644
index 1e2fea97a19..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/long_tasks_metric.html
+++ /dev/null
@@ -1,107 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- var LONG_TASK_MS = 50;
-
- // Anything longer than this should be so rare that its length beyond this is
- // uninteresting.
- var LONGEST_TASK_MS = 1000;
-
- var timeDurationInMs_smallerIsBetter =
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter;
-
- /**
- * This helper function calls |cb| for each of the top-level tasks on the
- * given thread in the given range whose duration is longer than LONG_TASK_MS.
- *
- * @param {tr.model.Thread} thread
- * @param {tr.b.Range=} opt_range
- * @param {function()} cb
- * @param {Object=} opt_this
- */
- function iterateLongTopLevelTasksOnThreadInRange(
- thread, opt_range, cb, opt_this) {
- thread.sliceGroup.topLevelSlices.forEach(function(slice) {
- if (opt_range &&
- !opt_range.intersectsExplicitRangeExclusive(slice.start, slice.end))
- return;
-
- if (slice.duration < LONG_TASK_MS)
- return;
-
- cb.call(opt_this, slice);
- });
- }
-
- /**
- * This helper function calls |cb| for each of the main renderer threads in
- * the model.
- *
- * @param {tr.model.Model} model The model.
- * @param {function()} cb Callback.
- * @param {Object=} opt_this Context object.
- */
- function iterateRendererMainThreads(model, cb, opt_this) {
- var modelHelper = model.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- tr.b.dictionaryValues(modelHelper.rendererHelpers).forEach(
- function(rendererHelper) {
- if (!rendererHelper.mainThread)
- return;
- cb.call(opt_this, rendererHelper.mainThread);
- });
- }
-
- var LONG_TASK_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- tr.b.Range.fromExplicitRange(LONG_TASK_MS, LONGEST_TASK_MS), 50);
-
- /**
- * This metric directly measures long tasks on renderer main threads.
- * This metric requires only the 'toplevel' tracing category.
- *
- * @param {!tr.v.ValueSet} values
- * @param {!tr.model.Model} model
- * @param {!Object=} opt_options
- */
- function longTasksMetric(values, model, opt_options) {
- var rangeOfInterest = opt_options ? opt_options.rangeOfInterest : undefined;
- var longTaskNumeric = LONG_TASK_NUMERIC_BUILDER.build();
- iterateRendererMainThreads(model, function(thread) {
- iterateLongTopLevelTasksOnThreadInRange(
- thread, rangeOfInterest, function(task) {
- longTaskNumeric.add(task.duration, task.stableId);
- });
- });
- var options = {description: 'durations of long tasks'};
- values.addValue(new tr.v.NumericValue(
- 'long tasks', longTaskNumeric, options));
- }
-
- tr.metrics.MetricRegistry.register(longTasksMetric, {
- supportsRangeOfInterest: true
- });
-
- return {
- longTasksMetric: longTasksMetric,
- iterateLongTopLevelTasksOnThreadInRange:
- iterateLongTopLevelTasksOnThreadInRange,
- iterateRendererMainThreads: iterateRendererMainThreads,
- LONG_TASK_MS: LONG_TASK_MS,
- LONGEST_TASK_MS: LONGEST_TASK_MS
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric.html
deleted file mode 100644
index 1aa81e05b2b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric.html
+++ /dev/null
@@ -1,1023 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/multi_dimensional_view.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/model/container_memory_dump.html">
-<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
-<link rel="import" href="/tracing/model/memory_allocator_dump.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- var LIGHT = tr.model.ContainerMemoryDump.LevelOfDetail.LIGHT;
- var DETAILED = tr.model.ContainerMemoryDump.LevelOfDetail.DETAILED;
- var ScalarNumeric = tr.v.ScalarNumeric;
- var sizeInBytes_smallerIsBetter =
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
- var unitlessNumber_smallerIsBetter =
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter;
- var DISPLAYED_SIZE_NUMERIC_NAME =
- tr.model.MemoryAllocatorDump.DISPLAYED_SIZE_NUMERIC_NAME;
-
- var LEVEL_OF_DETAIL_NAMES = new Map();
- LEVEL_OF_DETAIL_NAMES.set(LIGHT, 'light');
- LEVEL_OF_DETAIL_NAMES.set(DETAILED, 'detailed');
-
- var MEMORY_NUMERIC_BUILDER_MAP = new WeakMap();
- // For unitless numerics (process counts), we use 20 linearly scaled bins
- // from 0 to 20.
- MEMORY_NUMERIC_BUILDER_MAP.set(unitlessNumber_smallerIsBetter,
- tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter,
- tr.b.Range.fromExplicitRange(0, 20), 20));
- // For size numerics (subsystem and vm stats), we use 1 bin from 0 B to
- // 1 KiB and 4*24 exponentially scaled bins from 1 KiB to 16 GiB (=2^24 KiB).
- MEMORY_NUMERIC_BUILDER_MAP.set(sizeInBytes_smallerIsBetter,
- new tr.v.NumericBuilder(sizeInBytes_smallerIsBetter, 0)
- .addBinBoundary(1024 /* 1 KiB */)
- .addExponentialBins(16 * 1024 * 1024 * 1024 /* 16 GiB */, 4 * 24));
-
- function memoryMetric(values, model) {
- var browserNameToGlobalDumps = splitGlobalDumpsByBrowserName(model);
- addGeneralMemoryDumpValues(browserNameToGlobalDumps, values);
- addDetailedMemoryDumpValues(browserNameToGlobalDumps, values);
- addMemoryDumpCountValues(browserNameToGlobalDumps, values);
- }
-
- /**
- * Splits the global memory dumps in |model| by browser name.
- *
- * @param {!tr.Model} model The trace model from which the global dumps
- * should be extracted.
- * @return {!Map<string, !Array<!tr.model.GlobalMemoryDump>} A map from
- * browser names to the associated global memory dumps.
- */
- function splitGlobalDumpsByBrowserName(model) {
- var chromeModelHelper =
- model.getOrCreateHelper(tr.model.helpers.ChromeModelHelper);
- var browserNameToGlobalDumps = new Map();
- var globalDumpToBrowserHelper = new WeakMap();
-
- // 1. For each browser process in the model, add its global memory dumps to
- // |browserNameToGlobalDumps|. |chromeModelHelper| can be undefined if
- // it fails to find any browser, renderer or GPU process (see
- // tr.model.helpers.ChromeModelHelper.supportsModel).
- if (chromeModelHelper) {
- chromeModelHelper.browserHelpers.forEach(function(helper) {
- // Retrieve the associated global memory dumps and check that they
- // haven't been classified as belonging to another browser process.
- var globalDumps = helper.process.memoryDumps.map(
- d => d.globalMemoryDump);
- globalDumps.forEach(function(globalDump) {
- var existingHelper = globalDumpToBrowserHelper.get(globalDump);
- if (existingHelper !== undefined) {
- throw new Error('Memory dump ID clash across multiple browsers ' +
- 'with PIDs: ' + existingHelper.pid + ' and ' + helper.pid);
- }
- globalDumpToBrowserHelper.set(globalDump, helper);
- });
-
- makeKeyUniqueAndSet(browserNameToGlobalDumps,
- canonicalizeName(helper.browserName), globalDumps);
- });
- }
-
- // 2. If any global memory dump does not have any associated browser
- // process for some reason, associate it with an 'unknown_browser' browser
- // so that we don't lose the data.
- var unclassifiedGlobalDumps =
- model.globalMemoryDumps.filter(g => !globalDumpToBrowserHelper.has(g));
- if (unclassifiedGlobalDumps.length > 0) {
- makeKeyUniqueAndSet(
- browserNameToGlobalDumps, 'unknown_browser', unclassifiedGlobalDumps);
- }
-
- return browserNameToGlobalDumps;
- }
-
- function canonicalizeName(name) {
- return name.toLowerCase().replace(' ', '_');
- };
-
- var USER_FRIENDLY_BROWSER_NAMES = {
- 'chrome': 'Chrome',
- 'webview': 'WebView',
- 'unknown_browser': 'an unknown browser'
- };
-
- /**
- * Convert a canonical browser name used in value names to a user-friendly
- * name used in value descriptions.
- *
- * Examples:
- *
- * CANONICAL BROWSER NAME -> USER-FRIENDLY NAME
- * chrome -> Chrome
- * unknown_browser -> an unknown browser
- * webview2 -> WebView(2)
- * unexpected -> 'unexpected' browser
- */
- function convertBrowserNameToUserFriendlyName(browserName) {
- for (var baseName in USER_FRIENDLY_BROWSER_NAMES) {
- if (!browserName.startsWith(baseName))
- continue;
- var userFriendlyBaseName = USER_FRIENDLY_BROWSER_NAMES[baseName];
- var suffix = browserName.substring(baseName.length);
- if (suffix.length === 0)
- return userFriendlyBaseName;
- else if (/^\d+$/.test(suffix))
- return userFriendlyBaseName + '(' + suffix + ')';
- }
- return '\'' + browserName + '\' browser';
- }
-
- function canonicalizeProcessName(rawProcessName) {
- if (!rawProcessName)
- return 'unknown_processes';
- var baseCanonicalName = canonicalizeName(rawProcessName);
- switch (baseCanonicalName) {
- case 'renderer':
- return 'renderer_processes'; // Intentionally plural.
- case 'browser':
- return 'browser_process';
- default:
- return baseCanonicalName;
- }
- }
-
- /**
- * Convert a canonical process name used in value names to a user-friendly
- * name used in value descriptions.
- */
- function convertProcessNameToUserFriendlyName(processName,
- opt_requirePlural) {
- switch (processName) {
- case 'browser_process':
- return opt_requirePlural ? 'browser processes' : 'the browser process';
- case 'renderer_processes':
- return 'renderer processes';
- case 'gpu_process':
- return opt_requirePlural ? 'GPU processes' : 'the GPU process';
- case 'ppapi_process':
- return opt_requirePlural ? 'PPAPI processes' : 'the PPAPI process';
- case 'all_processes':
- return 'all processes';
- case 'unknown_processes':
- return 'unknown processes';
- default:
- return '\'' + processName + '\' processes';
- }
- }
-
- /**
- * Function for adding entries with duplicate keys to a map without
- * overriding existing entries.
- *
- * This is achieved by appending numeric indices (2, 3, 4, ...) to duplicate
- * keys. Example:
- *
- * var map = new Map();
- * // map = Map {}.
- *
- * makeKeyUniqueAndSet(map, 'key', 'a');
- * // map = Map {"key" => "a"}.
- *
- * makeKeyUniqueAndSet(map, 'key', 'b');
- * // map = Map {"key" => "a", "key2" => "b"}.
- * ^^^^
- * makeKeyUniqueAndSet(map, 'key', 'c');
- * // map = Map {"key" => "a", "key2" => "b", "key3" => "c"}.
- * ^^^^ ^^^^
- */
- function makeKeyUniqueAndSet(map, key, value) {
- var uniqueKey = key;
- var nextIndex = 2;
- while (map.has(uniqueKey)) {
- uniqueKey = key + nextIndex;
- nextIndex++;
- }
- map.set(uniqueKey, value);
- }
-
- /**
- * Add general memory dump values calculated from all global memory dumps to
- * |values|. In particular, this function adds the following values:
- *
- * * PROCESS COUNTS
- * memory:{chrome, webview}:
- * {browser_process, renderer_processes, ..., all_processes}:
- * process_count
- * type: tr.v.Numeric (histogram over all matching global memory dumps)
- * unit: unitlessNumber_smallerIsBetter
- *
- * * MEMORY USAGE REPORTED BY CHROME
- * memory:{chrome, webview}:
- * {browser_process, renderer_processes, ..., all_processes}:
- * reported_by_chrome[:{v8, malloc, ...}]:
- * {effective_size, allocated_objects_size, locked_size}
- * type: tr.v.Numeric (histogram over all matching global memory dumps)
- * unit: sizeInBytes_smallerIsBetter
- */
- function addGeneralMemoryDumpValues(browserNameToGlobalDumps, values) {
- addMemoryDumpValues(browserNameToGlobalDumps,
- gmd => true /* process all global memory dumps */,
- function(processDump, addProcessScalar) {
- // Increment memory:<browser-name>:<process-name>:process_count value.
- addProcessScalar({
- source: 'process_count',
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- descriptionPrefixBuilder: buildProcessCountDescriptionPrefix
- });
-
- // Add memory:<browser-name>:<process-name>:reported_by_chrome:...
- // values.
- if (processDump.memoryAllocatorDumps === undefined)
- return;
- processDump.memoryAllocatorDumps.forEach(function(rootAllocatorDump) {
- CHROME_VALUE_PROPERTIES.forEach(function(spec) {
- addProcessScalar({
- source: 'reported_by_chrome',
- component: [rootAllocatorDump.name],
- property: spec.propertyName,
- value: rootAllocatorDump.numerics[spec.propertyName],
- descriptionPrefixBuilder: spec.descriptionPrefixBuilder
- });
- });
- });
- },
- function(componentTree) {
- // Subtract memory:<browser-name>:<process-name>:reported_by_chrome:
- // tracing:<size-property> from memory:<browser-name>:<process-name>:
- // reported_by_chrome:<size-property> if applicable.
- var tracingNode = componentTree.children[1].get('tracing');
- if (tracingNode === undefined)
- return;
- for (var i = 0; i < componentTree.values.length; i++)
- componentTree.values[i].total -= tracingNode.values[i].total;
- }, values);
- }
-
- /**
- * Build a description prefix for a memory:<browser-name>:<process-name>:
- * process_count value.
- *
- * @param {!Array<string>} componentPath The underlying component path (must
- * be empty).
- * @param {string} processName The canonical name of the process.
- * @return {string} Prefix for the value's description (always
- * 'total number of renderer processes').
- */
- function buildProcessCountDescriptionPrefix(componentPath, processName) {
- if (componentPath.length > 0) {
- throw new Error('Unexpected process count non-empty component path: ' +
- componentPath.join(':'));
- }
- return 'total number of ' + convertProcessNameToUserFriendlyName(
- processName, true /* opt_requirePlural */);
- }
-
- /**
- * Build a description prefix for a memory:<browser-name>:<process-name>:
- * reported_by_chrome:... value.
- *
- * @param {{
- * userFriendlyPropertyName: string,
- * userFriendlyPropertyNamePrefix: (string|undefined),
- * totalUserFriendlyPropertyName: (string|undefined),
- * componentPreposition: (string|undefined) }}
- * formatSpec Specification of how the property should be formatted.
- * @param {!Array<string>} componentPath The underlying component path (e.g.
- * ['malloc']).
- * @param {string} processName The canonical name of the process.
- * @return {string} Prefix for the value's description (e.g.
- * 'effective size of malloc in the browser process').
- */
- function buildChromeValueDescriptionPrefix(
- formatSpec, componentPath, processName) {
- var nameParts = [];
- if (componentPath.length === 0) {
- nameParts.push('total');
- if (formatSpec.totalUserFriendlyPropertyName) {
- nameParts.push(formatSpec.totalUserFriendlyPropertyName);
- } else {
- if (formatSpec.userFriendlyPropertyNamePrefix)
- nameParts.push(formatSpec.userFriendlyPropertyNamePrefix);
- nameParts.push(formatSpec.userFriendlyPropertyName);
- }
- nameParts.push('reported by Chrome for');
- } else {
- if (formatSpec.componentPreposition === undefined) {
- // Use component name as an adjective
- // (e.g. 'size of V8 code and metadata').
- if (formatSpec.userFriendlyPropertyNamePrefix)
- nameParts.push(formatSpec.userFriendlyPropertyNamePrefix);
- nameParts.push(componentPath.join(':'));
- nameParts.push(formatSpec.userFriendlyPropertyName);
- } else {
- // Use component name as a noun with a preposition
- // (e.g. 'size of all objects allocated BY MALLOC').
- if (formatSpec.userFriendlyPropertyNamePrefix)
- nameParts.push(formatSpec.userFriendlyPropertyNamePrefix);
- nameParts.push(formatSpec.userFriendlyPropertyName);
- nameParts.push(formatSpec.componentPreposition);
- nameParts.push(componentPath.join(':'));
- }
- nameParts.push('in');
- }
- nameParts.push(convertProcessNameToUserFriendlyName(processName));
- return nameParts.join(' ');
- }
-
- // Specifications of properties reported by Chrome.
- var CHROME_VALUE_PROPERTIES = [
- {
- propertyName: 'effective_size',
- descriptionPrefixBuilder: buildChromeValueDescriptionPrefix.bind(
- undefined, {
- userFriendlyPropertyName: 'effective size',
- componentPreposition: 'of'
- })
- },
- {
- propertyName: 'allocated_objects_size',
- descriptionPrefixBuilder: buildChromeValueDescriptionPrefix.bind(
- undefined, {
- userFriendlyPropertyName: 'size of all objects allocated',
- totalUserFriendlyPropertyName: 'size of all allocated objects',
- componentPreposition: 'by'
- })
- },
- {
- propertyName: 'locked_size',
- descriptionPrefixBuilder: buildChromeValueDescriptionPrefix.bind(
- undefined, {
- userFriendlyPropertyName: 'locked (pinned) size',
- componentPreposition: 'of'
- })
- }
- ];
-
- /**
- * Add heavy memory dump values calculated from heavy global memory dumps to
- * |values|. In particular, this function adds the following values:
- *
- * * MEMORY USAGE REPORTED BY THE OS
- * memory:{chrome, webview}:
- * {browser_process, renderer_processes, ..., all_processes}:
- * reported_by_os:system_memory:[{ashmem, native_heap, java_heap}:]
- * {proportional_resident_size, private_dirty_size}
- * memory:{chrome, webview}:
- * {browser_process, renderer_processes, ..., all_processes}:
- * reported_by_os:gpu_memory:[{gl, graphics, ...}:]
- * proportional_resident_size
- * type: tr.v.Numeric (histogram over matching heavy global memory dumps)
- * unit: sizeInBytes_smallerIsBetter
- *
- * * MEMORY USAGE REPORTED BY CHROME
- * memory:{chrome, webview}:
- * {browser_process, renderer_processes, ..., all_processes}:
- * reported_by_chrome:v8:code_and_metadata_size
- * type: tr.v.Numeric (histogram over matching heavy global memory dumps)
- * unit: sizeInBytes_smallerIsBetter
- */
- function addDetailedMemoryDumpValues(browserNameToGlobalDumps, values) {
- addMemoryDumpValues(browserNameToGlobalDumps,
- g => g.levelOfDetail === DETAILED,
- function(processDump, addProcessScalar) {
- // Add memory:<browser-name>:<process-name>:reported_by_os:
- // system_memory:... values.
- tr.b.iterItems(
- SYSTEM_VALUE_COMPONENTS,
- function(componentName, componentSpec) {
- tr.b.iterItems(
- SYSTEM_VALUE_PROPERTIES,
- function(propertyName, propertySpec) {
- var node = getDescendantVmRegionClassificationNode(
- processDump.vmRegions,
- componentSpec.classificationPath);
- var componentPath = ['system_memory'];
- if (componentName)
- componentPath.push(componentName);
- addProcessScalar({
- source: 'reported_by_os',
- component: componentPath,
- property: propertyName,
- value: node === undefined ?
- 0 : (node.byteStats[propertySpec.byteStat] || 0),
- unit: sizeInBytes_smallerIsBetter,
- descriptionPrefixBuilder:
- propertySpec.descriptionPrefixBuilder
- });
- });
- });
-
- // Add memory:<browser-name>:<process-name>:reported_by_os:
- // gpu_memory:... values.
- var memtrackDump = processDump.getMemoryAllocatorDumpByFullName(
- 'gpu/android_memtrack');
- if (memtrackDump !== undefined) {
- var descriptionPrefixBuilder = SYSTEM_VALUE_PROPERTIES[
- 'proportional_resident_size'].descriptionPrefixBuilder;
- memtrackDump.children.forEach(function(memtrackChildDump) {
- var childName = memtrackChildDump.name;
- addProcessScalar({
- source: 'reported_by_os',
- component: ['gpu_memory', childName],
- property: 'proportional_resident_size',
- value: memtrackChildDump.numerics['memtrack_pss'],
- descriptionPrefixBuilder: descriptionPrefixBuilder
- });
- });
- }
-
- // Add memory:<browser-name>:<process-name>:reported_by_chrome:v8:
- // code_and_metadata_size when available.
- var v8Dump = processDump.getMemoryAllocatorDumpByFullName('v8');
- if (v8Dump !== undefined) {
- // V8 generates bytecode when interpreting and code objects when
- // compiling the javascript. Total code size includes the size
- // of code and bytecode objects.
- addProcessScalar({
- source: 'reported_by_chrome',
- component: ['v8'],
- property: 'code_and_metadata_size',
- value: v8Dump.numerics['code_and_metadata_size'],
- descriptionPrefixBuilder:
- buildCodeAndMetadataSizeValueDescriptionPrefix
- });
- addProcessScalar({
- source: 'reported_by_chrome',
- component: ['v8'],
- property: 'code_and_metadata_size',
- value: v8Dump.numerics['bytecode_and_metadata_size'],
- descriptionPrefixBuilder:
- buildCodeAndMetadataSizeValueDescriptionPrefix
- });
- }
- }, function(componentTree) {}, values);
- }
-
- // Specifications of components reported by the system.
- var SYSTEM_VALUE_COMPONENTS = {
- '': {
- classificationPath: [],
- },
- 'java_heap': {
- classificationPath: ['Android', 'Java runtime', 'Spaces'],
- userFriendlyName: 'the Java heap'
- },
- 'ashmem': {
- classificationPath: ['Android', 'Ashmem'],
- userFriendlyName: 'ashmem'
- },
- 'native_heap': {
- classificationPath: ['Native heap'],
- userFriendlyName: 'the native heap'
- }
- };
-
- // Specifications of properties reported by the system.
- var SYSTEM_VALUE_PROPERTIES = {
- 'proportional_resident_size': {
- byteStat: 'proportionalResident',
- descriptionPrefixBuilder: buildOsValueDescriptionPrefix.bind(
- undefined, 'proportional resident size (PSS)')
- },
- 'private_dirty_size': {
- byteStat: 'privateDirtyResident',
- descriptionPrefixBuilder: buildOsValueDescriptionPrefix.bind(
- undefined, 'private dirty size')
- }
- };
-
- /**
- * Build a description prefix for a memory:<browser-name>:<process-name>:
- * reported_by_os:... value.
- *
- * @param {string} userFriendlyPropertyName User-friendly name of the
- * underlying property (e.g. 'private dirty size').
- * @param {!Array<string>} componentPath The underlying component path (e.g.
- * ['system', 'java_heap']).
- * @param {string} processName The canonical name of the process.
- * @return {string} Prefix for the value's description (e.g.
- * 'total private dirty size of the Java heal in the GPU process').
- */
- function buildOsValueDescriptionPrefix(
- userFriendlyPropertyName, componentPath, processName) {
- if (componentPath.length > 2) {
- throw new Error('OS value component path for \'' +
- userFriendlyPropertyName + '\' too long: ' + componentPath.join(':'));
- }
-
- var nameParts = [];
- if (componentPath.length < 2)
- nameParts.push('total');
-
- nameParts.push(userFriendlyPropertyName);
-
- if (componentPath.length > 0) {
- switch (componentPath[0]) {
- case 'system_memory':
- if (componentPath.length > 1) {
- var userFriendlyComponentName =
- SYSTEM_VALUE_COMPONENTS[componentPath[1]].userFriendlyName;
- if (userFriendlyComponentName === undefined) {
- throw new Error('System value sub-component for \'' +
- userFriendlyPropertyName + '\' unknown: ' +
- componentPath.join(':'));
- }
- nameParts.push('of', userFriendlyComponentName, 'in');
- } else {
- nameParts.push('of system memory (RAM) used by');
- }
- break;
-
- case 'gpu_memory':
- if (componentPath.length > 1) {
- nameParts.push('of the', componentPath[1]);
- nameParts.push('Android memtrack component in');
- } else {
- nameParts.push('of GPU memory (Android memtrack) used by');
- }
- break;
-
- default:
- throw new Error('OS value component for \'' +
- userFriendlyPropertyName + '\' unknown: ' +
- componentPath.join(':'));
- }
- } else {
- nameParts.push('reported by the OS for');
- }
-
- nameParts.push(convertProcessNameToUserFriendlyName(processName));
- return nameParts.join(' ');
- }
-
- /**
- * Build a description prefix for a memory:<browser-name>:<process-name>:
- * reported_by_chrome:...:code_and_metadata_size value.
- *
- * @param {!Array<string>} componentPath The underlying component path (e.g.
- * ['v8']).
- * @param {string} processName The canonical name of the process.
- * @return {string} Prefix for the value's description (e.g.
- * 'size of v8 code and metadata in').
- */
- function buildCodeAndMetadataSizeValueDescriptionPrefix(
- componentPath, processName) {
- return buildChromeValueDescriptionPrefix({
- userFriendlyPropertyNamePrefix: 'size of',
- userFriendlyPropertyName: 'code and metadata'
- }, componentPath, processName);
- }
-
- /**
- * Get the descendant of a VM region classification |node| specified by the
- * given |path| of child node titles. If |node| is undefined or such a
- * descendant does not exist, this function returns undefined.
- */
- function getDescendantVmRegionClassificationNode(node, path) {
- for (var i = 0; i < path.length; i++) {
- if (node === undefined)
- break;
- node = tr.b.findFirstInArray(node.children, c => c.title === path[i]);
- }
- return node;
- }
-
- /**
- * Add global memory dump counts to |values|. In particular, this function
- * adds the following values:
- *
- * * DUMP COUNTS
- * memory:{chrome, webview}:all_processes:dump_count[:{light, detailed}]
- * type: tr.v.ScalarNumeric (scalar over the whole trace)
- * unit: unitlessNumber_smallerIsBetter
- *
- * Note that unlike all other values generated by the memory metric, the
- * global memory dump counts are NOT instances of tr.v.Numeric (histogram)
- * because it doesn't make sense to aggregate them (they are already counts
- * over all global dumps associated with the relevant browser).
- */
- function addMemoryDumpCountValues(browserNameToGlobalDumps, values) {
- browserNameToGlobalDumps.forEach(function(globalDumps, browserName) {
- var totalDumpCount = 0;
- var levelOfDetailNameToDumpCount = {};
- LEVEL_OF_DETAIL_NAMES.forEach(function(levelOfDetailName) {
- levelOfDetailNameToDumpCount[levelOfDetailName] = 0;
- });
-
- globalDumps.forEach(function(globalDump) {
- totalDumpCount++;
-
- // Increment the level-of-detail-specific dump count (if possible).
- var levelOfDetailName =
- LEVEL_OF_DETAIL_NAMES.get(globalDump.levelOfDetail);
- if (!(levelOfDetailName in levelOfDetailNameToDumpCount))
- return; // Unknown level of detail.
- levelOfDetailNameToDumpCount[levelOfDetailName]++;
- });
-
- // Add memory:<browser-name>:all_processes:dump_count[:<level>] values.
- reportMemoryDumpCountAsValue(browserName, undefined /* total */,
- totalDumpCount, values);
- tr.b.iterItems(levelOfDetailNameToDumpCount,
- function(levelOfDetailName, levelOfDetailDumpCount) {
- reportMemoryDumpCountAsValue(browserName, levelOfDetailName,
- levelOfDetailDumpCount, values);
- });
- });
- }
-
- /**
- * Add a tr.v.ScalarNumeric value to |values| reporting that the number of
- * |levelOfDetailName| memory dumps added by |browserName| was
- * |levelOfDetailCount|.
- */
- function reportMemoryDumpCountAsValue(
- browserName, levelOfDetailName, levelOfDetailDumpCount, values) {
- // Construct the name of the memory value.
- var nameParts = ['memory', browserName, 'all_processes', 'dump_count'];
- if (levelOfDetailName !== undefined)
- nameParts.push(levelOfDetailName);
- var name = nameParts.join(':');
-
- // Build the underlying numeric for the memory value.
- var numeric = new ScalarNumeric(
- unitlessNumber_smallerIsBetter, levelOfDetailDumpCount);
-
- // Build the options for the memory value.
- var description = [
- 'total number of',
- levelOfDetailName || 'all',
- 'memory dumps added by',
- convertBrowserNameToUserFriendlyName(browserName),
- 'to the trace'
- ].join(' ');
- var options = { description: description };
-
- // Report the memory value.
- values.addValue(new tr.v.NumericValue(name, numeric, options));
- }
-
- /**
- * Add generic values extracted from process memory dumps and aggregated by
- * process name and component path into |values|.
- *
- * For each browser and set of global dumps in |browserNameToGlobalDumps|,
- * |customProcessDumpValueExtractor| is applied to every process memory dump
- * associated with the global memory dump. The second argument provided to the
- * callback is a function for adding extracted values:
- *
- * function sampleProcessDumpCallback(processDump, addProcessValue) {
- * ...
- * addProcessScalar({
- * source: 'reported_by_chrome',
- * component: ['system', 'native_heap'],
- * property: 'proportional_resident_size',
- * value: pssExtractedFromProcessDump2,
- * descriptionPrefixBuilder: function(componentPath) {
- * return 'PSS of ' + componentPath.join('/') + ' in';
- * }
- * });
- * ...
- * }
- *
- * For each global memory dump, the extracted values are summed by process
- * name (browser_process, renderer_processes, ..., all_processes) and
- * component path (e.g. gpu is a sum of gpu:gl, gpu:graphics, ...). The sums
- * are then aggregated over all global memory dumps associated with the given
- * browser. For example, assuming that |customProcessDumpValueExtractor|
- * extracts 'proportional_resident_size' values for component paths
- * ['X', 'A'], ['X', 'B'] and ['Y'] under the same 'source' from each process
- * memory dump, the following values will be reported (for Chrome):
- *
- * memory:chrome:browser_process:source:X:A:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:A in all 'browser' process dumps in global dump 1,
- * ...
- * sum of X:A in all 'browser' process dumps in global dump N
- * ]
- *
- * memory:chrome:browser_process:source:X:B:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:B in all 'browser' process dumps in global dump 1,
- * ...
- * sum of X:B in all 'browser' process dumps in global dump N
- * ]
- *
- * memory:chrome:browser_process:source:X:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:A+X:B in all 'browser' process dumps in global dump 1,
- * ...
- * sum of X:A+X:B in all 'browser' process dumps in global dump N
- * ]
- *
- * memory:chrome:browser_process:source:Y:proportional_resident_size :
- * Numeric aggregated over [
- * sum of Y in all 'browser' process dumps in global dump 1,
- * ...
- * sum of Y in all 'browser' process dumps in global dump N
- * ]
- *
- * memory:chrome:browser_process:source:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:A+X:B+Y in all 'browser' process dumps in global dump 1,
- * ...
- * sum of X:A+X:B+Y in all 'browser' process dumps in global dump N
- * ]
- *
- * ...
- *
- * memory:chrome:all_processes:source:X:A:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:A in all process dumps in global dump 1,
- * ...
- * sum of X:A in all process dumps in global dump N,
- * ]
- *
- * memory:chrome:all_processes:source:X:B:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:B in all process dumps in global dump 1,
- * ...
- * sum of X:B in all process dumps in global dump N,
- * ]
- *
- * memory:chrome:all_processes:source:X:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:A+X:B in all process dumps in global dump 1,
- * ...
- * sum of X:A+X:B in all process dumps in global dump N,
- * ]
- *
- * memory:chrome:all_processes:source:Y:proportional_resident_size :
- * Numeric aggregated over [
- * sum of Y in all process dumps in global dump 1,
- * ...
- * sum of Y in all process dumps in global dump N
- * ]
- *
- * memory:chrome:all_processes:source:proportional_resident_size :
- * Numeric aggregated over [
- * sum of X:A+X:B+Y in all process dumps in global dump 1,
- * ...
- * sum of X:A+X:B+Y in all process dumps in global dump N
- * ]
- *
- * where global dumps 1 to N are the global dumps associated with the given
- * browser.
- *
- * @param {!Map<string, !Array<!tr.model.GlobalMemoryDump>}
- * browserNameToGlobalDumps Map from browser names to arrays of global
- * memory dumps. The generic values will be extracted from the associated
- * process memory dumps.
- * @param {!function(!tr.model.GlobalMemoryDump): boolean}
- * customGlobalDumpFilter Predicate for filtering global memory dumps.
- * @param {!function(
- * !tr.model.ProcessMemoryDump,
- * !function(!{
- * source: string,
- * componentPath: (!Array<string>|undefined),
- * propertyName: (string|undefined),
- * value: (!tr.v.ScalarNumeric|number|undefined),
- * unit: (!tr.v.Unit|undefined),
- * descriptionPrefixBuilder: (!function(!Array<string>): string)
- * }))}
- * customProcessDumpValueExtractor Callback for extracting values from a
- * process memory dump.
- * @param {!function(!tr.b.MultiDimensionalViewNode)}
- * customComponentTreeModifier Callback applied to every component tree
- * wrt each process name.
- * @param {!tr.v.ValueSet} values List of values to which the
- * resulting aggregated values are added.
- */
- function addMemoryDumpValues(browserNameToGlobalDumps, customGlobalDumpFilter,
- customProcessDumpValueExtractor, customComponentTreeModifier,
- values) {
- browserNameToGlobalDumps.forEach(function(globalDumps, browserName) {
- var filteredGlobalDumps = globalDumps.filter(customGlobalDumpFilter);
- var sourceToPropertyToData = extractDataFromGlobalDumps(
- filteredGlobalDumps, customProcessDumpValueExtractor);
- reportDataAsValues(sourceToPropertyToData, browserName,
- customComponentTreeModifier, values);
- });
- }
-
- /**
- * For each global memory dump in |globalDumps|, calculate per-process-name
- * sums of values extracted by |customProcessDumpValueExtractor| from the
- * associated process memory dumps.
- *
- * This function returns the following nested map structure:
- *
- * Source name (Map key, e.g. 'reported_by_os')
- * -> Property name (Map key, e.g. 'proportional_resident_size')
- * -> {unit, descriptionPrefixBuilder, processAndComponentTreeBuilder}
- *
- * where |processAndComponentTreeBuilder| is a
- * tr.b.MultiDimensionalViewBuilder:
- *
- * Browser name (0th dimension key, e.g. 'webview') x
- * -> Component path (1st dimension keys, e.g. ['system', 'native_heap'])
- * -> Sum of value over the processes (number).
- *
- * See addMemoryDumpValues for more details.
- */
- function extractDataFromGlobalDumps(
- globalDumps, customProcessDumpValueExtractor) {
- var sourceToPropertyToData = new Map();
- var dumpCount = globalDumps.length;
- globalDumps.forEach(function(globalDump, dumpIndex) {
- tr.b.iterItems(globalDump.processMemoryDumps, function(_, processDump) {
- extractDataFromProcessDump(
- processDump, sourceToPropertyToData, dumpIndex, dumpCount,
- customProcessDumpValueExtractor);
- });
- });
- return sourceToPropertyToData;
- }
-
- function extractDataFromProcessDump(processDump, sourceToPropertyToData,
- dumpIndex, dumpCount, customProcessDumpValueExtractor) {
- // Process name is typically 'browser', 'renderer', etc.
- var rawProcessName = processDump.process.name;
- var processNamePath = [canonicalizeProcessName(rawProcessName)];
-
- customProcessDumpValueExtractor(
- processDump,
- function addProcessScalar(spec) {
- if (spec.value === undefined)
- return;
-
- var component = spec.component || [];
- function createDetailsForErrorMessage() {
- var propertyUserFriendlyName =
- spec.property === undefined ? '(undefined)' : spec.property;
- var componentUserFriendlyName =
- component.length === 0 ? '(empty)' : component.join(':');
- return ['source=', spec.source, ', property=',
- propertyUserFriendlyName, ', component=',
- componentUserFriendlyName, ' in ',
- processDump.process.userFriendlyName].join('');
- }
-
- var value, unit;
- if (spec.value instanceof ScalarNumeric) {
- value = spec.value.value;
- unit = spec.value.unit;
- if (spec.unit !== undefined) {
- throw new Error('ScalarNumeric value for ' +
- createDetailsForErrorMessage() + ' already specifies a unit');
- }
- } else {
- value = spec.value;
- unit = spec.unit;
- }
-
- var propertyToData = sourceToPropertyToData.get(spec.source);
- if (propertyToData === undefined) {
- propertyToData = new Map();
- sourceToPropertyToData.set(spec.source, propertyToData);
- }
-
- var data = propertyToData.get(spec.property);
- if (data === undefined) {
- data = {
- processAndComponentTreeBuilder:
- new tr.b.MultiDimensionalViewBuilder(
- 2 /* dimensions (process name and component path) */,
- dumpCount /* valueCount */),
- unit: unit,
- descriptionPrefixBuilder: spec.descriptionPrefixBuilder
- };
- propertyToData.set(spec.property, data);
- } else if (data.unit !== unit) {
- throw new Error('Multiple units provided for ' +
- createDetailsForErrorMessage() + ':' +
- data.unit.unitName + ' and ' + unit.unitName);
- } else if (data.descriptionPrefixBuilder !==
- spec.descriptionPrefixBuilder) {
- throw new Error(
- 'Multiple description prefix builders provided for' +
- createDetailsForErrorMessage());
- }
-
- var values = new Array(dumpCount);
- values[dumpIndex] = value;
-
- data.processAndComponentTreeBuilder.addPath(
- [processNamePath, component] /* path */, values,
- tr.b.MultiDimensionalViewBuilder.ValueKind.TOTAL /* valueKind */);
- });
- }
-
- function reportDataAsValues(sourceToPropertyToData, browserName,
- customComponentTreeModifier, values) {
- // For each source name (e.g. 'reported_by_os')...
- sourceToPropertyToData.forEach(function(propertyToData, sourceName) {
- // For each property name (e.g. 'effective_size')...
- propertyToData.forEach(function(data, propertyName) {
- var tree = data.processAndComponentTreeBuilder.buildTopDownTreeView();
- var unit = data.unit;
- var descriptionPrefixBuilder = data.descriptionPrefixBuilder;
-
- // Total over 'all' processes...
- customComponentTreeModifier(tree);
- reportComponentDataAsValues(browserName, sourceName,
- propertyName, 'all_processes', [] /* componentPath */, tree,
- unit, descriptionPrefixBuilder, values);
-
- // For each process name (e.g. 'renderer')...
- tree.children[0].forEach(function(processTree, processName) {
- if (processTree.children[0].size > 0) {
- throw new Error('Multi-dimensional view node for source=' +
- sourceName + ', property=' +
- (propertyName === undefined ? '(undefined)' : propertyName) +
- ', process=' + processName +
- ' has children wrt the process name dimension');
- }
- customComponentTreeModifier(processTree);
- reportComponentDataAsValues(browserName, sourceName,
- propertyName, processName, [] /* componentPath */, processTree,
- unit, descriptionPrefixBuilder, values);
- });
- });
- });
- }
-
- /**
- * For the given |browserName| (e.g. 'chrome'), |processName|
- * (e.g. 'gpu_process'), |propertyName| (e.g. 'effective_size'),
- * |componentPath| (e.g. ['v8']), add a tr.v.Numeric with |unit| aggregating
- * the total values of the associated |componentNode| across all timestamps
- * (corresponding to global memory dumps associated with the given browser)
- * to |values|.
- *
- * See addMemoryDumpValues for more details.
- */
- function reportComponentDataAsValues(
- browserName, sourceName, propertyName, processName, componentPath,
- componentNode, unit, descriptionPrefixBuilder, values) {
- // Construct the name of the memory value.
- var nameParts = ['memory', browserName, processName, sourceName].concat(
- componentPath);
- if (propertyName !== undefined)
- nameParts.push(propertyName);
- var name = nameParts.join(':');
-
- // Build the underlying numeric for the memory value.
- var numeric = buildMemoryNumericFromNode(componentNode, unit);
-
- // Build the options for the memory value.
- var description = [
- descriptionPrefixBuilder(componentPath, processName),
- 'in',
- convertBrowserNameToUserFriendlyName(browserName)
- ].join(' ');
- var options = { description: description };
-
- // Report the memory value.
- values.addValue(new tr.v.NumericValue(name, numeric, options));
-
- // Recursively report memory values for sub-components.
- var depth = componentPath.length;
- componentPath.push(undefined);
- componentNode.children[1].forEach(function(childNode, childName) {
- componentPath[depth] = childName;
- reportComponentDataAsValues(
- browserName, sourceName, propertyName, processName, componentPath,
- childNode, unit, descriptionPrefixBuilder, values);
- });
- componentPath.pop();
- }
-
- /**
- * Create a memory tr.v.Numeric (histogram) with |unit| and add all total
- * values in |node| to it.
- */
- function buildMemoryNumericFromNode(node, unit) {
- var numeric = MEMORY_NUMERIC_BUILDER_MAP.get(unit).build();
- node.values.forEach(v => numeric.add(v.total));
- return numeric;
- }
-
- tr.metrics.MetricRegistry.register(memoryMetric);
-
- return {
- memoryMetric: memoryMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric_test.html
deleted file mode 100644
index 500333d61f9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/memory_metric_test.html
+++ /dev/null
@@ -1,2473 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/metrics/system_health/memory_metric.html">
-<link rel="import" href="/tracing/model/container_memory_dump.html">
-<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
-<link rel="import" href="/tracing/model/vm_region.html">
-<link rel="import" href="/tracing/value/value.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var VMRegion = tr.model.VMRegion;
- var VMRegionClassificationNode = tr.model.VMRegionClassificationNode;
- var LIGHT = tr.model.ContainerMemoryDump.LevelOfDetail.LIGHT;
- var DETAILED = tr.model.ContainerMemoryDump.LevelOfDetail.DETAILED;
- var SIZE_DELTA = tr.model.MemoryDumpTestUtils.SIZE_DELTA;
- var addProcessMemoryDump = tr.model.MemoryDumpTestUtils.addProcessMemoryDump;
- var addGlobalMemoryDump = tr.model.MemoryDumpTestUtils.addGlobalMemoryDump;
- var newAllocatorDump = tr.model.MemoryDumpTestUtils.newAllocatorDump;
- var addChildDump = tr.model.MemoryDumpTestUtils.addChildDump;
- var addOwnershipLink = tr.model.MemoryDumpTestUtils.addOwnershipLink;
- var unitlessNumber_smallerIsBetter =
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter;
- var sizeInBytes_smallerIsBetter =
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
-
- function memoryMetricTest(name, modelCallback, expectedNumerics) {
- test(name, function() {
- // Create a model and a fake value list.
- var model = tr.c.TestUtils.newModel(modelCallback);
- var valueNameToValues = {};
- var fakeValueList = {
- addValue: function(value) {
- var values = valueNameToValues[value.name];
- if (values === undefined)
- valueNameToValues[value.name] = values = [];
- values.push(value);
- }
- };
-
- // Run the memory metric on the model.
- tr.metrics.sh.memoryMetric(fakeValueList, model);
-
- // Check that the names of the added values match expectations.
- var actualValueNames = Object.keys(valueNameToValues).sort();
- var expectedValueNames = Object.keys(expectedNumerics).sort();
- assert.deepEqual(actualValueNames, expectedValueNames, {
- // Build the long error message lazily.
- toString: function() {
- var errorMessageParts = [];
- function addValueNamesToError(type, valueNames, otherValueNames) {
- var otherValueNamesSet = new Set(otherValueNames);
- errorMessageParts.push(type, ' value names:');
- if (valueNames.length === 0) {
- errorMessageParts.push('\n(empty)');
- } else {
- valueNames.forEach(function(valueName) {
- errorMessageParts.push('\n');
- if (!otherValueNamesSet.has(valueName))
- errorMessageParts.push('+++');
- errorMessageParts.push(valueName);
- });
- }
- }
- addValueNamesToError('Expected', expectedValueNames,
- actualValueNames);
- errorMessageParts.push('\n');
- addValueNamesToError('Actual', actualValueNames, expectedValueNames);
- return errorMessageParts.join('');
- }
- });
-
- // Check that the numeric values of the added values match expectations.
- tr.b.iterItems(valueNameToValues, function(valueName, actualValues) {
- assert.lengthOf(actualValues, 1,
- 'Multiple \'' + valueName + '\' values');
- var actualValue = actualValues[0];
- assert.instanceOf(actualValue, tr.v.NumericValue);
-
- var actualNumeric = actualValue.numeric;
- var expectedNumeric = expectedNumerics[valueName];
- assert.strictEqual(actualNumeric.unit, expectedNumeric.unit,
- 'Invalid \'' + valueName + '\' unit (expected: ' +
- expectedNumeric.unit.unitName, + ', actual: ' +
- actualNumeric.unit.unitName + ')');
-
- if (typeof expectedNumeric.value === 'number') {
- // Scalar.
- assert.instanceOf(actualNumeric, tr.v.ScalarNumeric,
- 'Invalid \'' + valueName + '\' class');
- assert.closeTo(actualNumeric.value, expectedNumeric.value,
- SIZE_DELTA, 'Invalid \'' + valueName + '\' numeric value');
- } else if (expectedNumeric.value instanceof Array) {
- // Histogram.
- assert.instanceOf(actualNumeric, tr.v.Numeric,
- 'Invalid \'' + valueName + '\' class');
- assert.strictEqual(actualNumeric.numValues,
- expectedNumeric.value.length,
- 'Invalid \'' + valueName + '\' Numeric numValues');
- assert.closeTo(actualNumeric.sum,
- expectedNumeric.value.reduce((a, b) => a + b, 0), SIZE_DELTA,
- 'Invalid \'' + valueName + '\' Numeric sum');
-
- // Check that the bin counts match.
- var binToCount = new Map();
- expectedNumeric.value.forEach(function(value) {
- var bin = actualNumeric.getBinForValue(value);
- binToCount.set(bin, (binToCount.get(bin) || 0) + 1);
- });
- actualNumeric.allBins.forEach(function(bin) {
- binToCount.set(bin, (binToCount.get(bin) || 0) - bin.count);
- });
- binToCount.forEach(function(count, bin) {
- assert.strictEqual(count, 0, 'Invalid \'' + valueName +
- '\' bin count for range ' + bin.min + '-' + bin.max);
- });
- } else {
- assert.fail(
- 'Test sanity check: expected value must be a number or an array');
- }
-
- // Check that the description matches expectations.
- //if (expectedNumeric.description !== '')
- assert.strictEqual(
- actualValue.description, expectedNumeric.description,
- 'Invalid \'' + valueName + '\' description');
- });
- });
- }
-
- function createProcessWithName(model, name) {
- var uniquePid =
- Math.max.apply(null, Object.keys(model.processes).concat([0])) + 1;
- var process = model.getOrCreateProcess(uniquePid);
- process.name = name;
- return process;
- }
-
- function createChromeBrowserProcess(model) {
- var process = createProcessWithName(model, 'Browser');
- process.getOrCreateThread(1).name = 'CrBrowserMain';
- return process;
- }
-
- function createWebViewProcess(model) {
- var process = createChromeBrowserProcess(model);
- process.getOrCreateThread(2).name = 'Chrome_InProcRendererThread';
- return process;
- }
-
- memoryMetricTest('noDumps_noBrowser', function(model) {
- createProcessWithName(model, 'Non-browser');
- }, {
- /* no values */
- });
-
- memoryMetricTest('noDumps_chrome', function(model) {
- createChromeBrowserProcess(model);
- }, {
- 'memory:chrome:all_processes:dump_count:detailed': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count:light': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by Chrome to the ' +
- 'trace'
- }
- });
-
- memoryMetricTest('noDumps_multipleBrowsers', function(model) {
- createChromeBrowserProcess(model);
- createWebViewProcess(model);
- createProcessWithName(model, 'Non-browser');
- createChromeBrowserProcess(model);
- }, {
- 'memory:chrome2:all_processes:dump_count:detailed': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by Chrome(2) ' +
- 'to the trace'
- },
- 'memory:chrome2:all_processes:dump_count:light': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by Chrome(2) to ' +
- 'the trace'
- },
- 'memory:chrome2:all_processes:dump_count': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by Chrome(2) to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count:detailed': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count:light': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by Chrome to the ' +
- 'trace'
- },
- 'memory:webview:all_processes:dump_count:detailed': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by WebView ' +
- 'to the trace'
- },
- 'memory:webview:all_processes:dump_count:light': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by WebView to ' +
- 'the trace'
- },
- 'memory:webview:all_processes:dump_count': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by WebView to the ' +
- 'trace'
- }
- });
-
- memoryMetricTest('dumpCountsOnly_unknownBrowser', function(model) {
- addGlobalMemoryDump(model, 45, DETAILED);
- addGlobalMemoryDump(model, 68, LIGHT);
- addGlobalMemoryDump(model, 89, DETAILED);
- }, {
- 'memory:unknown_browser:all_processes:dump_count:detailed': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by an ' +
- 'unknown browser to the trace'
- },
- 'memory:unknown_browser:all_processes:dump_count:light': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by an unknown ' +
- 'browser to the trace'
- },
- 'memory:unknown_browser:all_processes:dump_count': {
- value: 3,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by an unknown ' +
- 'browser to the trace'
- }
- });
-
- memoryMetricTest('dumpCountsOnly_webview', function(model) {
- var p = createWebViewProcess(model);
- addProcessMemoryDump(addGlobalMemoryDump(model, 45, LIGHT), p, 45);
- addProcessMemoryDump(addGlobalMemoryDump(model, 68, LIGHT), p, 68);
- }, {
- 'memory:webview:all_processes:dump_count:detailed': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by WebView ' +
- 'to the trace'
- },
- 'memory:webview:all_processes:dump_count:light': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by WebView to ' +
- 'the trace'
- },
- 'memory:webview:all_processes:dump_count': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by WebView to the ' +
- 'trace'
- },
- 'memory:webview:all_processes:process_count': {
- value: [1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in WebView'
- },
- 'memory:webview:browser_process:process_count': {
- value: [1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in WebView'
- }
- });
-
- memoryMetricTest('generalValues_chrome', function(model) {
- var pBrowser = createChromeBrowserProcess(model);
- var pRendererA = createProcessWithName(model, 'Renderer');
- var pRendererB = createProcessWithName(model, 'Renderer');
- var pPpapi = createProcessWithName(model, 'PPAPI Process');
- var pUnknown = createProcessWithName(model, undefined);
-
- // Timestamp 1.
- var gmd1 = addGlobalMemoryDump(model, 20);
- var pmdBrowser1 = addProcessMemoryDump(gmd1, pBrowser, 19);
- pmdBrowser1.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser1, 'malloc', {
- 'size': 8,
- 'allocated_objects_size': 4
- })
- ];
- var pmdRendererA1 = addProcessMemoryDump(gmd1, pRendererA, 20);
- pmdRendererA1.memoryAllocatorDumps = (function() {
- var mallocDump =
- newAllocatorDump(pmdRendererA1, 'malloc', { 'size': 16 });
- var partitionAllocDump =
- newAllocatorDump(pmdRendererA1, 'partition_alloc');
- addOwnershipLink(
- addChildDump(partitionAllocDump, 'allocated_objects', { 'size': 32 }),
- addChildDump(partitionAllocDump, 'partitions', { 'size': 24 }));
- return [mallocDump, partitionAllocDump];
- })();
- var pmdGpu1 = addProcessMemoryDump(gmd1, pPpapi, 21);
- pmdGpu1.memoryAllocatorDumps = [
- newAllocatorDump(pmdGpu1, 'gpu', {
- 'size': 30,
- 'allocated_objects_size': 25
- })
- ];
-
- // Timestamp 2.
- var gmd2 = addGlobalMemoryDump(model, 40);
- var pmdBrowser2 = addProcessMemoryDump(gmd2, pBrowser, 41);
- pmdBrowser2.memoryAllocatorDumps = (function() {
- var mallocDump = newAllocatorDump(pmdBrowser2, 'malloc', { 'size': 120 });
- var tracingDump =
- newAllocatorDump(pmdBrowser2, 'tracing', { 'size': 40 });
- return [mallocDump, tracingDump];
- })();
- var pmdRendererA2 = addProcessMemoryDump(gmd2, pRendererA, 39);
- pmdRendererA2.memoryAllocatorDumps = (function() {
- var partitionAllocDump =
- newAllocatorDump(pmdRendererA2, 'partition_alloc');
- addOwnershipLink(
- addChildDump(partitionAllocDump, 'allocated_objects',
- { 'size': 320 }),
- addChildDump(partitionAllocDump, 'partitions', { 'size': 240 }));
- var v8Dump = newAllocatorDump(pmdRendererA2, 'v8', { 'size': 650 });
- return [partitionAllocDump, v8Dump];
- })();
- var pmdRendererB2 = addProcessMemoryDump(gmd2, pRendererB, 40);
- pmdRendererB2.memoryAllocatorDumps = [
- newAllocatorDump(pmdRendererB2, 'v8', {
- 'size': 970,
- 'allocated_objects_size': 860
- }),
- newAllocatorDump(pmdRendererB2, 'malloc', {
- 'allocated_objects_size': 750
- })
- ];
- var pmdUnknown = addProcessMemoryDump(gmd2, pUnknown, 42);
- pmdUnknown.memoryAllocatorDumps = [
- newAllocatorDump(pmdRendererB2, 'v8', {
- 'size': 111
- })
- ];
-
- // Timestamp 3.
- var gmd3 = addGlobalMemoryDump(model, 60);
- var pmdBrowser3 = addProcessMemoryDump(gmd3, pBrowser, 60);
- pmdBrowser3.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser3, 'malloc', {
- 'size': 8000,
- 'allocated_objects_size': 4000
- })
- ];
- var pmdRendererB3 = addProcessMemoryDump(gmd3, pRendererB, 61);
- // Intentionally pmdRendererB3.memoryAllocatorDumps undefined.
- var pmdGpu3 = addProcessMemoryDump(gmd3, pPpapi, 59);
- pmdGpu3.memoryAllocatorDumps = [
- newAllocatorDump(pmdGpu3, 'gpu', { 'size': 300 })
- ];
-
- // Timestamp 4.
- var gmd4 = addGlobalMemoryDump(model, 80);
- var pmdBrowser4 = addProcessMemoryDump(gmd4, pBrowser, 81);
- pmdBrowser4.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser4, 'malloc', { 'size': 80000 })
- ];
- var pmdRendererB4 = addProcessMemoryDump(gmd4, pRendererB, 79);
- pmdRendererB4.memoryAllocatorDumps = (function() {
- var v8Dump = newAllocatorDump(pmdRendererB4, 'v8', { 'size': 9e5 });
- var partitionAllocDump = newAllocatorDump(pmdRendererB4,
- 'partition_alloc', { 'size': 5e5 });
- addOwnershipLink(partitionAllocDump, v8Dump);
- return [v8Dump, partitionAllocDump];
- })();
- var pmdGpu4 = addProcessMemoryDump(gmd4, pPpapi, 80);
- pmdGpu4.memoryAllocatorDumps = [
- newAllocatorDump(pmdGpu4, 'gpu', { 'memtrack_pss': 666 /* ignored */ })
- ];
- }, {
- 'memory:chrome:all_processes:dump_count:detailed': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count:light': {
- value: 4,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count': {
- value: 4,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by Chrome to the ' +
- 'trace'
- },
- 'memory:chrome:all_processes:process_count': {
- value: [3, 4, 3, 3],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:effective_size': {
- value: [30 + (8 + 16) + 32, (120 - 40) + 320 + (650 + 970) + 111,
- 300 + 8000, 80000 + 5e5 + 4e5],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:allocated_objects_size': {
- value: [25 + 4, 750 + 860, 4000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of all allocated objects reported by Chrome ' +
- 'for all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:gpu:effective_size': {
- value: [30, 0, 300, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of gpu in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:gpu:allocated_objects_size':
- {
- value: [25, 0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by gpu in all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:malloc:effective_size': {
- value: [8 + 16, 120 - 40, 8000, 80000],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:malloc:allocated_objects_size':
- {
- value: [4, 750, 4000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by malloc in all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:partition_alloc:effective_size':
- {
- value: [32, 320, 0, 5e5],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of partition_alloc in all processes ' +
- 'in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:tracing:effective_size': {
- value: [0, 40, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of tracing in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:v8:effective_size': {
- value: [0, 650 + 970 + 111, 0, 4e5],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of v8 in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:v8:allocated_objects_size':
- {
- value: [0, 860, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by v8 in all processes ' +
- 'in Chrome'
- },
- 'memory:chrome:browser_process:process_count': {
- value: [1, 1, 1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:effective_size': {
- value: [8, (120 - 40), 8000, 80000],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the browser ' +
- 'process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:allocated_objects_size': {
- value: [4, 0, 4000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of all allocated objects reported by Chrome ' +
- 'for the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:malloc:effective_size': {
- value: [8, 120 - 40, 8000, 80000],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:malloc:allocated_objects_size':
- {
- value: [4, 0, 4000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by malloc in the ' +
- 'browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:tracing:effective_size': {
- value: [0, 40, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of tracing in the browser process in Chrome'
- },
- 'memory:chrome:ppapi_process:process_count': {
- value: [1, 0, 1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of PPAPI processes in Chrome'
- },
- 'memory:chrome:ppapi_process:reported_by_chrome:effective_size': {
- value: [30, 0, 300, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the PPAPI ' +
- 'process in Chrome'
- },
- 'memory:chrome:ppapi_process:reported_by_chrome:allocated_objects_size': {
- value: [25, 0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of all allocated objects reported by Chrome ' +
- 'for the PPAPI process in Chrome'
- },
- 'memory:chrome:ppapi_process:reported_by_chrome:gpu:effective_size': {
- value: [30, 0, 300, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of gpu in the PPAPI process in Chrome'
- },
- 'memory:chrome:ppapi_process:reported_by_chrome:gpu:allocated_objects_size':
- {
- value: [25, 0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by gpu in the PPAPI ' +
- 'process in Chrome'
- },
- 'memory:chrome:renderer_processes:process_count': {
- value: [1, 2, 1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:effective_size': {
- value: [16 + 32, 320 + 650 + 970, 0, 5e5 + 4e5],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:allocated_objects_size':
- {
- value: [0, 750 + 860, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of all allocated objects reported by ' +
- 'Chrome for renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:malloc:effective_size':
- {
- value: [16, 0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in renderer processes in ' +
- 'Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:malloc:allocated_objects_size':
- {
- value: [0, 750, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by malloc in renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:partition_alloc:effective_size':
- {
- value: [32, 320, 0, 5e5],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of partition_alloc in renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:v8:effective_size': {
- value: [0, 650 + 970, 0, 4e5],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of v8 in renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:v8:allocated_objects_size':
- {
- value: [0, 860, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by v8 in renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:unknown_processes:process_count': {
- value: [0, 1, 0, 0],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of unknown processes in Chrome'
- },
- 'memory:chrome:unknown_processes:reported_by_chrome:effective_size': {
- value: [0, 111, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for unknown ' +
- 'processes in Chrome'
- },
- 'memory:chrome:unknown_processes:reported_by_chrome:v8:effective_size': {
- value: [0, 111, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of v8 in unknown processes in Chrome'
- },
- });
-
- memoryMetricTest('detailedValues_unknownBrowser', function(model) {
- var pBrowser = createProcessWithName(model, 'Browser');
- var pRendererA = createProcessWithName(model, 'Renderer');
- var pRendererB = createProcessWithName(model, 'Renderer');
- var pRendererC = createProcessWithName(model, 'Renderer');
- var pGpu = createProcessWithName(model, 'GPU Process');
-
- // Timestamp 1.
- var gmd1 = addGlobalMemoryDump(model, 10, DETAILED);
- var pmdBrowser1 = addProcessMemoryDump(gmd1, pBrowser, 9);
- pmdBrowser1.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 128, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 8 })
- ]);
- var pmdRendererA1 = addProcessMemoryDump(gmd1, pRendererA, 10);
- pmdRendererA1.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xEF01, 256, 0, '[anon:libc_malloc]',
- { 'privateDirtyResident': 17 })
- ]);
- var pmdRendererB1 = addProcessMemoryDump(gmd1, pRendererB, 11);
- pmdRendererB1.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0x2345, 512, 0, '[heap]',
- { 'proportionalResident': 67, 'privateDirtyResident': 34 })
- ]);
- pmdRendererB1.memoryAllocatorDumps = [
- newAllocatorDump(pmdRendererA4, 'v8', { 'code_and_metadata_size': 16 })
- ];
- var pmdGpu1 = addProcessMemoryDump(gmd1, pGpu, 10);
- pmdGpu1.memoryAllocatorDumps = (function() {
- var gpuDump = newAllocatorDump(pmdGpu1, 'gpu');
- var memtrackDump = addChildDump(gpuDump, 'android_memtrack');
- addChildDump(memtrackDump, 'gl', { 'memtrack_pss': 100 });
- addChildDump(memtrackDump, 'graphics', { 'memtrack_pss': 200 });
- return [gpuDump];
- })();
-
- // Timestamp 2 (light global memory dump, so it should be skipped for
- // mmaps_* values).
- var gmd2 = addGlobalMemoryDump(model, 20, LIGHT);
- var pmdBrowser2 = addProcessMemoryDump(gmd2, pBrowser, 18);
- pmdBrowser2.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0x999, 999, 999, '/dev/ashmem/dalvik-main space',
- { 'proportionalResident': 999 })
- ]);
- var pmdRendererA2 = addProcessMemoryDump(gmd2, pRendererA, 19);
- pmdRendererA2.memoryAllocatorDumps = [
- newAllocatorDump(pmdRendererA4, 'v8', {
- 'bytecode_and_metadata_size': 678
- })
- ];
- var pmdRendererB2 = addProcessMemoryDump(gmd2, pRendererB, 21);
- var pmdRendererC2 = addProcessMemoryDump(gmd2, pRendererC, 22);
- var pmdGpu2 = addProcessMemoryDump(gmd2, pGpu, 20);
- pmdGpu2.memoryAllocatorDumps = (function() {
- var gpuDump = newAllocatorDump(pmdGpu2, 'gpu');
- var memtrackDump = addChildDump(gpuDump, 'android_memtrack');
- addChildDump(memtrackDump, 'gl', { 'memtrack_pss': 12345 });
- return [gpuDump];
- })();
-
- // Timestamp 3.
- var gmd3 = addGlobalMemoryDump(model, 30, DETAILED);
- var pmdBrowser3 = addProcessMemoryDump(gmd3, pBrowser, 30);
- pmdBrowser3.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 1024, 0, '/dev/ashmem/dalvik-non moving space',
- { 'proportionalResident': 3, 'privateDirtyResident': 80 })
- ]);
- var pmdRendererA3 = addProcessMemoryDump(gmd3, pRendererA, 29);
- // Intentionally pmdRendererA3.vmRegions undefined.
- var pmdRendererC3 = addProcessMemoryDump(gmd3, pRendererC, 31);
- pmdRendererC3.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0x2345, 2048, 0, '/no/matching/category',
- { 'proportionalResident': 200 }),
- new VMRegion(0x2345, 2048, 0, '/dev/ashmem',
- { 'proportionalResident': 500 }),
- ]);
- var pmdGpu3 = addProcessMemoryDump(gmd3, pGpu, 30);
- pmdGpu3.memoryAllocatorDumps = (function() {
- var gpuDump = newAllocatorDump(pmdGpu3, 'gpu',
- { 'memtrack_pss': 6000 /* ignored */ });
- var memtrackDump = addChildDump(gpuDump, 'android_memtrack',
- { 'memtrack_pss': 5000 /* ignored */ });
- addChildDump(memtrackDump, 'gl', { 'memtrack_pss': 3000 });
- addChildDump(memtrackDump, 'graphics', { 'ignored': 2000 });
- addChildDump(memtrackDump, 'gfx', { 'memtrack_pss': 1000 });
- return [gpuDump];
- })();
- pmdGpu3.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xCDCD, 4096, 0, '/dev/ashmem/dalvik-zygote space',
- { 'proportionalResident': 150, 'privateDirtyResident': 90 })
- ]);
-
- // Timestamp 4.
- var gmd4 = addGlobalMemoryDump(model, 40, DETAILED);
- var pmdBrowser4 = addProcessMemoryDump(gmd4, pBrowser, 40);
- var pmdRendererA4 = addProcessMemoryDump(gmd4, pRendererA, 40);
- pmdRendererA4.memoryAllocatorDumps = [
- newAllocatorDump(pmdRendererA4, 'v8', {
- 'code_and_metadata_size': 21,
- 'bytecode_and_metadata_size': 35
- })
- ];
- }, {
- 'memory:unknown_browser:all_processes:dump_count:detailed': {
- value: 3,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by an ' +
- 'unknown browser to the trace'
- },
- 'memory:unknown_browser:all_processes:dump_count:light': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by an unknown ' +
- 'browser to the trace'
- },
- 'memory:unknown_browser:all_processes:dump_count': {
- value: 4,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by an unknown ' +
- 'browser to the trace'
- },
- 'memory:unknown_browser:all_processes:process_count': {
- value: [4, 5, 4, 2],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_chrome:code_and_metadata_size':
- {
- value: [16, 0, 21 + 35],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of code and metadata reported by Chrome ' +
- 'for all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_chrome:v8:code_and_metadata_size':
- {
- value: [16, 0, 21 + 35],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of v8 code and metadata in all processes in an ' +
- 'unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:gpu_memory:proportional_resident_size':
- {
- value: [100 + 200, 3000 + 1000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of GPU memory ' +
- '(Android memtrack) used by all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:gpu_memory:gfx:proportional_resident_size':
- {
- value: [0, 1000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the gfx Android ' +
- 'memtrack component in all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:gpu_memory:gl:proportional_resident_size':
- {
- value: [100, 3000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the gl Android ' +
- 'memtrack component in all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:gpu_memory:graphics:proportional_resident_size':
- {
- value: [200, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the graphics ' +
- 'Android memtrack component in all processes in an unknown ' +
- 'browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:private_dirty_size': {
- value: [17 + 34 + 8, 80 + 90, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for all ' +
- 'processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:proportional_resident_size':
- {
- value: [67 + 100 + 200, 700 + 3 + 1000 + 150 + 3000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by ' +
- 'the OS for all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:private_dirty_size':
- {
- value: [17 + 34 + 8, 80 + 90, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [67, 700 + 3 + 150, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in all processes in an ' +
- 'unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 500, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in all ' +
- 'processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [8, 80 + 90, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in all processes ' +
- 'in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 3 + 150, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [17 + 34, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in all ' +
- 'processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [67, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in all processes in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:process_count': {
- value: [1, 1, 1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:private_dirty_size':
- {
- value: [8, 80, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for the ' +
- 'browser process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:proportional_resident_size':
- {
- value: [0, 3, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by ' +
- 'the OS for the browser process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:private_dirty_size':
- {
- value: [8, 80, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by the browser process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 3, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by the browser process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in the browser process ' +
- 'in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in the ' +
- 'browser process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [8, 80, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in the browser ' +
- 'process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 3, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'the browser process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in the browser ' +
- 'process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in the browser process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:process_count': {
- value: [1, 1, 1, 0],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of GPU processes in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:proportional_resident_size':
- {
- value: [100 + 200, 3000 + 1000 + 150, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by ' +
- 'the OS for the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:private_dirty_size': {
- value: [0, 90, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for the GPU ' +
- 'process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:gpu_memory:proportional_resident_size':
- {
- value: [100 + 200, 3000 + 1000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of GPU memory ' +
- '(Android memtrack) used by the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:gpu_memory:gfx:proportional_resident_size':
- {
- value: [0, 1000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the gfx Android ' +
- 'memtrack component in the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:gpu_memory:gl:proportional_resident_size':
- {
- value: [100, 3000, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the gl Android ' +
- 'memtrack component in the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:gpu_memory:graphics:proportional_resident_size':
- {
- value: [200, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the graphics ' +
- 'Android memtrack component in the GPU process in an unknown ' +
- 'browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:private_dirty_size':
- {
- value: [0, 90, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 150, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in the GPU process in ' +
- 'an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in the ' +
- 'GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [0, 90, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in the GPU ' +
- 'process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 150, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in the GPU ' +
- 'process in an unknown browser'
- },
- 'memory:unknown_browser:gpu_process:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in the GPU process in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:process_count': {
- value: [2, 3, 2, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_chrome:code_and_metadata_size':
- {
- value: [16, 0, 21 + 35],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of code and metadata reported by Chrome ' +
- 'for renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_chrome:v8:code_and_metadata_size':
- {
- value: [16, 0, 21 + 35],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of v8 code and metadata in renderer processes ' +
- 'in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:private_dirty_size':
- {
- value: [17 + 34, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for ' +
- 'renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:proportional_resident_size':
- {
- value: [67, 700, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by ' +
- 'the OS for renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:private_dirty_size':
- {
- value: [17 + 34, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [67, 700, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in renderer processes ' +
- 'in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 500, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in ' +
- 'renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in renderer ' +
- 'processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'renderer processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [17 + 34, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in renderer ' +
- 'processes in an unknown browser'
- },
- 'memory:unknown_browser:renderer_processes:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [67, 0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in renderer processes in an unknown browser'
- }
- });
-
- memoryMetricTest('combined_chrome', function(model) {
- var pBrowser = createChromeBrowserProcess(model);
-
- // Timestamp 1.
- var gmd1 = addGlobalMemoryDump(model, 10, DETAILED);
- var pmdBrowser1 = addProcessMemoryDump(gmd1, pBrowser, 10);
- pmdBrowser1.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 128, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 100 })
- ]);
-
- // Timestamp 2 (light global memory dump, so it should be skipped for
- // mmaps_* values).
- var gmd2 = addGlobalMemoryDump(model, 20, LIGHT);
- var pmdBrowser2 = addProcessMemoryDump(gmd2, pBrowser, 20);
- pmdBrowser2.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser2, 'malloc', { size: 32 })
- ];
-
- // Timestamp 3.
- var gmd3 = addGlobalMemoryDump(model, 30, DETAILED);
- var pmdBrowser3 = addProcessMemoryDump(gmd3, pBrowser, 30);
- pmdBrowser3.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser3, 'malloc', { size: 48 })
- ];
- pmdBrowser3.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 1024, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 150 })
- ]);
- }, {
- 'memory:chrome:all_processes:dump_count:detailed': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count:light': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count': {
- value: 3,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by Chrome to the ' +
- 'trace'
- },
- 'memory:chrome:all_processes:process_count': {
- value: [1, 1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:effective_size': {
- value: [0, 32, 48],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:malloc:effective_size': {
- value: [0, 32, 48],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:private_dirty_size': {
- value: [100, 150],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:proportional_resident_size': {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by the ' +
- 'OS for all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [100, 150],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in all processes ' +
- 'in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:private_dirty_size':
- {
- value: [100, 150],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by all processes in Chrome'
- },
- 'memory:chrome:browser_process:process_count': {
- value: [1, 1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:effective_size': {
- value: [0, 32, 48],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the browser ' +
- 'process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:malloc:effective_size': {
- value: [0, 32, 48],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:private_dirty_size': {
- value: [100, 150],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for the ' +
- 'browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:proportional_resident_size': {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by the ' +
- 'OS for the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in the browser process ' +
- 'in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in the ' +
- 'browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [100, 150],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in the browser ' +
- 'process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in the browser ' +
- 'process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:private_dirty_size':
- {
- value: [100, 150],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by the browser process in Chrome'
- }
- });
-
- memoryMetricTest('combined_multipleBrowsers', function(model) {
- var pWebView = createWebViewProcess(model);
- var pChrome1 = createChromeBrowserProcess(model);
- var pRenderer1 = createProcessWithName(model, 'Renderer');
- var pGpu1 = createProcessWithName(model, 'GPU Process');
- var pUnknownBrowser = createProcessWithName(model, 'Browser');
- var pChrome2 = createChromeBrowserProcess(model);
- var pRenderer2 = createProcessWithName(model, 'Renderer');
-
- // Timestamp 1 (WebView).
- var gmd1 = addGlobalMemoryDump(model, 0, LIGHT);
- var pmdBrowser1 = addProcessMemoryDump(gmd1, pWebView, 0);
- pmdBrowser1.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser1, 'malloc', { size: 2 }),
- newAllocatorDump(pmdBrowser1, 'v8', { size: 4 })
- ];
-
- // Timestamp 2 (Chrome 1 + Renderer + GPU Process).
- var gmd2 = addGlobalMemoryDump(model, 10, DETAILED);
- var pmdBrowser2 = addProcessMemoryDump(gmd2, pChrome1, 12);
- pmdBrowser2.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 9999, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 8 })
- ]);
- var pmdGpu2 = addProcessMemoryDump(gmd2, pGpu1, 8);
- pmdGpu2.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 9999, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 16 })
- ]);
- var pmdRenderer2 = addProcessMemoryDump(gmd2, pRenderer1, 8);
- pmdRenderer2.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser2, 'malloc', { size: 32 })
- ];
-
- // Timestamp 3 (Chrome 2).
- var gmd3 = addGlobalMemoryDump(model, 20, DETAILED);
- var pmdBrowser3 = addProcessMemoryDump(gmd3, pChrome2, 20);
- pmdBrowser3.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser3, 'malloc', { size: 64 }),
- newAllocatorDump(pmdBrowser3, 'sqlite', { size: 128 }),
- newAllocatorDump(pmdBrowser3, 'discardable', {
- size: 8388608,
- locked_size: 4194304
- })
- ];
- pmdBrowser3.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 99, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 256 })
- ]);
-
- // Timestamp 4 (Chrome 2 + Renderer).
- var gmd4 = addGlobalMemoryDump(model, 30, LIGHT);
- var pmdBrowser4 = addProcessMemoryDump(gmd4, pChrome2, 28);
- pmdBrowser4.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser4, 'malloc', { size: 512 }),
- newAllocatorDump(pmdBrowser3, 'discardable', { size: 16777216 })
- ];
- var pmdRenderer4 = addProcessMemoryDump(gmd4, pRenderer2, 32);
- pmdRenderer4.memoryAllocatorDumps = [
- newAllocatorDump(pmdRenderer4, 'malloc', { size: 1024 }),
- newAllocatorDump(pmdRenderer4, 'v8', { size: 2048 })
- ];
-
- // Timestamp 5 (Unknown browser).
- var gmd5 = addGlobalMemoryDump(model, 40, LIGHT);
- var pmdBrowser5 = addProcessMemoryDump(gmd5, pUnknownBrowser, 40);
- pmdBrowser5.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser5, 'malloc', { size: 4096 }),
- newAllocatorDump(pmdBrowser5, 'sqlite', { size: 8192 }),
- ];
-
- // Timestamp 6 (WebView).
- var gmd6 = addGlobalMemoryDump(model, 50, DETAILED);
- var pmdBrowser6 = addProcessMemoryDump(gmd6, pWebView, 50);
- pmdBrowser6.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser6, 'malloc', { size: 16384 }),
- newAllocatorDump(pmdBrowser6, 'v8', {
- 'allocated_objects_size': 32768,
- 'code_and_metadata_size': 33554432,
- 'size': 67108864
- })
- ];
- pmdBrowser6.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 99999, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 65536 })
- ]);
-
- // Timestamp 7 (Chrome 1 + GPU Process).
- var gmd7 = addGlobalMemoryDump(model, 60, DETAILED);
- var pmdBrowser7 = addProcessMemoryDump(gmd7, pChrome1, 63);
- pmdBrowser7.memoryAllocatorDumps = [
- newAllocatorDump(pmdBrowser4, 'malloc', { size: 131072 }),
- newAllocatorDump(pmdBrowser4, 'sqlite', { size: 262144 })
- ];
- pmdBrowser7.vmRegions = VMRegionClassificationNode.fromRegions([
- new VMRegion(0xABCD, 999999, 0, '/dev/ashmem/dalvik-non moving space',
- { 'privateDirtyResident': 524288 })
- ]);
- var pmdGpu7 = addProcessMemoryDump(gmd7, pGpu1, 57);
- pmdGpu7.memoryAllocatorDumps = (function() {
- var gpuDump = newAllocatorDump(pmdGpu7, 'gpu', { 'size': 1048576 });
- var memtrackDump = addChildDump(gpuDump, 'android_memtrack');
- addChildDump(memtrackDump, 'gl', { 'memtrack_pss': 2097152 });
- return [gpuDump];
- })();
- }, {
- // WebView (GMD1, GMD6).
- 'memory:webview:all_processes:dump_count:detailed': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by WebView ' +
- 'to the trace'
- },
- 'memory:webview:all_processes:dump_count:light': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by WebView to ' +
- 'the trace'
- },
- 'memory:webview:all_processes:dump_count': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by WebView to the ' +
- 'trace'
- },
- 'memory:webview:all_processes:process_count': {
- value: [1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_chrome:effective_size': {
- value: [4 + 2, 16384 + 67108864],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for all ' +
- 'processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_chrome:code_and_metadata_size': {
- value: [33554432],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of code and metadata reported by Chrome for ' +
- 'all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_chrome:allocated_objects_size': {
- value: [0, 32768],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of all allocated objects reported by Chrome ' +
- 'for all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_chrome:malloc:effective_size': {
- value: [2, 16384],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_chrome:v8:effective_size': {
- value: [4, 67108864],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of v8 in all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_chrome:v8:code_and_metadata_size':
- {
- value: [33554432],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of v8 code and metadata in all processes in ' +
- 'WebView'
- },
- 'memory:webview:all_processes:reported_by_chrome:v8:allocated_objects_size':
- {
- value: [0, 32768],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by v8 in all processes ' +
- 'in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:private_dirty_size': {
- value: [65536],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for all ' +
- 'processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:proportional_resident_size': {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by the ' +
- 'OS for all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in all processes in ' +
- 'WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in all ' +
- 'processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [65536],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in all processes ' +
- 'in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in all ' +
- 'processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:private_dirty_size':
- {
- value: [65536],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by all processes in WebView'
- },
- 'memory:webview:all_processes:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by all processes in WebView'
- },
- 'memory:webview:browser_process:process_count': {
- value: [1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in WebView'
- },
- 'memory:webview:browser_process:reported_by_chrome:effective_size': {
- value: [4 + 2, 16384 + 67108864],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the browser ' +
- 'process in WebView'
- },
- 'memory:webview:browser_process:reported_by_chrome:allocated_objects_size':
- {
- value: [0, 32768],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of all allocated objects reported by ' +
- 'Chrome for the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_chrome:code_and_metadata_size':
- {
- value: [33554432],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total size of code and metadata reported by Chrome ' +
- 'for the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_chrome:malloc:effective_size': {
- value: [2, 16384],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_chrome:v8:effective_size': {
- value: [4, 67108864],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of v8 in the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_chrome:v8:allocated_objects_size':
- {
- value: [0, 32768],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of all objects allocated by v8 in the browser ' +
- 'process in WebView'
- },
- 'memory:webview:browser_process:reported_by_chrome:v8:code_and_metadata_size':
- {
- value: [33554432],
- unit: sizeInBytes_smallerIsBetter,
- description: 'size of v8 code and metadata in the browser process ' +
- 'in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:private_dirty_size': {
- value: [65536],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for the ' +
- 'browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by ' +
- 'the OS for the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in the browser process ' +
- 'in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in the ' +
- 'browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [65536],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in the browser ' +
- 'process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in the browser ' +
- 'process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:private_dirty_size':
- {
- value: [65536],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by the browser process in WebView'
- },
- 'memory:webview:browser_process:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by the browser process in WebView'
- },
-
- // Chrome 1 (GMD3, GMD4).
- 'memory:chrome:all_processes:reported_by_os:gpu_memory:gl:proportional_resident_size':
- {
- value: [0, 2097152],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the gl Android ' +
- 'memtrack component in all processes in Chrome'
- },
- 'memory:chrome:all_processes:dump_count:detailed': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count:light': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by Chrome to ' +
- 'the trace'
- },
- 'memory:chrome:all_processes:dump_count': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by Chrome to the ' +
- 'trace'
- },
- 'memory:chrome:all_processes:process_count': {
- value: [3, 2],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:effective_size': {
- value: [32, 1048576 + 131072 + 262144],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:gpu:effective_size': {
- value: [0, 1048576],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of gpu in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:malloc:effective_size': {
- value: [32, 131072],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_chrome:sqlite:effective_size': {
- value: [0, 262144],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of sqlite in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:private_dirty_size': {
- value: [8 + 16, 524288],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:proportional_resident_size': {
- value: [0, 2097152],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by the ' +
- 'OS for all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:gpu_memory:proportional_resident_size':
- {
- value: [0, 2097152],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of GPU memory ' +
- '(Android memtrack) used by all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [8 + 16, 524288],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in all processes ' +
- 'in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in all ' +
- 'processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:private_dirty_size':
- {
- value: [8 + 16, 524288],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by all processes in Chrome'
- },
- 'memory:chrome:all_processes:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by all processes in Chrome'
- },
- 'memory:chrome:browser_process:process_count': {
- value: [1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:effective_size': {
- value: [0, 131072 + 262144],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the browser ' +
- 'process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:malloc:effective_size': {
- value: [0, 131072],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_chrome:sqlite:effective_size': {
- value: [0, 262144],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of sqlite in the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:private_dirty_size': {
- value: [8, 524288],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for the ' +
- 'browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:proportional_resident_size': {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by the ' +
- 'OS for the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in the browser process ' +
- 'in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in the ' +
- 'browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [8, 524288],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in the browser ' +
- 'process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in the browser ' +
- 'process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:private_dirty_size':
- {
- value: [8, 524288],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by the browser process in Chrome'
- },
- 'memory:chrome:browser_process:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by the browser process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_chrome:effective_size': {
- value: [0, 1048576],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the GPU ' +
- 'process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:gpu_memory:proportional_resident_size':
- {
- value: [0, 2097152],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of GPU memory ' +
- '(Android memtrack) used by the GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:gpu_memory:gl:proportional_resident_size':
- {
- value: [0, 2097152],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the gl Android ' +
- 'memtrack component in the GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:process_count': {
- value: [1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of GPU processes in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_chrome:gpu:effective_size': {
- value: [0, 1048576],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of gpu in the GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:private_dirty_size': {
- value: [16, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for the GPU ' +
- 'process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:proportional_resident_size': {
- value: [0, 2097152],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by the ' +
- 'OS for the GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in the GPU process in ' +
- 'Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in the ' +
- 'GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [16, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in the GPU ' +
- 'process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'the GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in the GPU ' +
- 'process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in the GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:private_dirty_size':
- {
- value: [16, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by the GPU process in Chrome'
- },
- 'memory:chrome:gpu_process:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by the GPU process in Chrome'
- },
- 'memory:chrome:renderer_processes:process_count': {
- value: [1, 0],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:effective_size': {
- value: [32, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_chrome:malloc:effective_size':
- {
- value: [32, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in renderer processes in ' +
- 'Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:private_dirty_size': {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by ' +
- 'the OS for renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in renderer processes ' +
- 'in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in ' +
- 'renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in renderer ' +
- 'processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:private_dirty_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by renderer processes in Chrome'
- },
- 'memory:chrome:renderer_processes:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by renderer processes in Chrome'
- },
-
- // Chrome 2 (GMD2, GMD7).
- 'memory:chrome2:all_processes:dump_count:detailed': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by Chrome(2) ' +
- 'to the trace'
- },
- 'memory:chrome2:all_processes:dump_count:light': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by Chrome(2) to ' +
- 'the trace'
- },
- 'memory:chrome2:all_processes:dump_count': {
- value: 2,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by Chrome(2) to ' +
- 'the trace'
- },
- 'memory:chrome2:all_processes:process_count': {
- value: [1, 2],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_chrome:discardable:effective_size':
- {
- value: [8388608, 16777216],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of discardable in all processes in ' +
- 'Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_chrome:locked_size': {
- value: [4194304, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total locked (pinned) size reported by Chrome for all ' +
- 'processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_chrome:discardable:locked_size': {
- value: [4194304, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'locked (pinned) size of discardable in all processes in ' +
- 'Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_chrome:effective_size': {
- value: [64 + 8388608 + 128, 512 + 1024 + 2048 + 16777216],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for all ' +
- 'processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_chrome:malloc:effective_size': {
- value: [64, 512 + 1024],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_chrome:sqlite:effective_size': {
- value: [128, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of sqlite in all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_chrome:v8:effective_size': {
- value: [0, 2048],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of v8 in all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:private_dirty_size': {
- value: [256],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for all ' +
- 'processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:proportional_resident_size': {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by the ' +
- 'OS for all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in all processes in ' +
- 'Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in all ' +
- 'processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [256],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in all processes ' +
- 'in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in all ' +
- 'processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:private_dirty_size':
- {
- value: [256],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by all processes in Chrome(2)'
- },
- 'memory:chrome2:all_processes:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by all processes in Chrome(2)'
- },
- 'memory:chrome2:browser_process:process_count': {
- value: [1, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_chrome:effective_size': {
- value: [64 + 8388608 + 128, 512 + 16777216],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the browser ' +
- 'process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_chrome:locked_size': {
- value: [4194304, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total locked (pinned) size reported by Chrome for the ' +
- 'browser process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_chrome:malloc:effective_size': {
- value: [64, 512],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in the browser process in ' +
- 'Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_chrome:discardable:effective_size':
- {
- value: [8388608, 16777216],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of discardable in the browser process ' +
- 'in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_chrome:discardable:locked_size':
- {
- value: [4194304, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'locked (pinned) size of discardable in the browser ' +
- 'process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_chrome:sqlite:effective_size': {
- value: [128, 0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of sqlite in the browser process in ' +
- 'Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:private_dirty_size': {
- value: [256],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size reported by the OS for the ' +
- 'browser process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) reported by ' +
- 'the OS for the browser process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:ashmem:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of ashmem in the browser process ' +
- 'in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:ashmem:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of ashmem in the ' +
- 'browser process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:java_heap:private_dirty_size':
- {
- value: [256],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the Java heap in the browser ' +
- 'process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:java_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the Java heap in ' +
- 'the browser process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:native_heap:private_dirty_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'private dirty size of the native heap in the browser ' +
- 'process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:native_heap:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'proportional resident size (PSS) of the native heap ' +
- 'in the browser process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:private_dirty_size':
- {
- value: [256],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total private dirty size of system memory (RAM) used ' +
- 'by the browser process in Chrome(2)'
- },
- 'memory:chrome2:browser_process:reported_by_os:system_memory:proportional_resident_size':
- {
- value: [0],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total proportional resident size (PSS) of system ' +
- 'memory (RAM) used by the browser process in Chrome(2)'
- },
- 'memory:chrome2:renderer_processes:process_count': {
- value: [0, 1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of renderer processes in Chrome(2)'
- },
- 'memory:chrome2:renderer_processes:reported_by_chrome:effective_size': {
- value: [0, 1024 + 2048],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for renderer ' +
- 'processes in Chrome(2)'
- },
- 'memory:chrome2:renderer_processes:reported_by_chrome:malloc:effective_size':
- {
- value: [0, 1024],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in renderer processes in ' +
- 'Chrome(2)'
- },
- 'memory:chrome2:renderer_processes:reported_by_chrome:v8:effective_size': {
- value: [0, 2048],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of v8 in renderer processes in Chrome(2)'
- },
-
- // Unknown browser (GMD5).
- 'memory:unknown_browser:all_processes:dump_count:detailed': {
- value: 0,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of detailed memory dumps added by an ' +
- 'unknown browser to the trace'
- },
- 'memory:unknown_browser:all_processes:dump_count:light': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of light memory dumps added by an unknown ' +
- 'browser to the trace'
- },
- 'memory:unknown_browser:all_processes:dump_count': {
- value: 1,
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all memory dumps added by an unknown ' +
- 'browser to the trace'
- },
- 'memory:unknown_browser:all_processes:process_count': {
- value: [1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of all processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_chrome:effective_size': {
- value: [4096 + 8192],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for all ' +
- 'processes in an unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_chrome:malloc:effective_size':
- {
- value: [4096],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in all processes in an ' +
- 'unknown browser'
- },
- 'memory:unknown_browser:all_processes:reported_by_chrome:sqlite:effective_size':
- {
- value: [8192],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of sqlite in all processes in an ' +
- 'unknown browser'
- },
- 'memory:unknown_browser:browser_process:process_count': {
- value: [1],
- unit: unitlessNumber_smallerIsBetter,
- description: 'total number of browser processes in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_chrome:effective_size':
- {
- value: [4096 + 8192],
- unit: sizeInBytes_smallerIsBetter,
- description: 'total effective size reported by Chrome for the ' +
- 'browser process in an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_chrome:malloc:effective_size':
- {
- value: [4096],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of malloc in the browser process in ' +
- 'an unknown browser'
- },
- 'memory:unknown_browser:browser_process:reported_by_chrome:sqlite:effective_size':
- {
- value: [8192],
- unit: sizeInBytes_smallerIsBetter,
- description: 'effective size of sqlite in the browser process in ' +
- 'an unknown browser'
- }
- });
-
- test('dumpIdBrowserClashThrows', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var pWebView = createWebViewProcess(model);
- var pChrome = createChromeBrowserProcess(model);
-
- var gmd = addGlobalMemoryDump(model, 10);
- addProcessMemoryDump(gmd, pWebView, 9);
- addProcessMemoryDump(gmd, pChrome, 11);
- });
- var values = new tr.v.ValueSet();
-
- assert.throws(function() {
- tr.metrics.sh.memoryMetric(values, model);
- }, 'Memory dump ID clash across multiple browsers with PIDs: 1 and 2');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric.html
deleted file mode 100644
index eec9635a5a5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/clock_sync_latency_metric.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
-
- var IDEAL_FRAME_RATE = 60;
- var IDEAL_FRAME_DURATION = 1000 / IDEAL_FRAME_RATE;
-
- function energyConsumedPerFrame(valueList, model) {
- var frameEnergyConsumed = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.energyInJoules_smallerIsBetter,
- tr.b.Range.fromExplicitRange(0, .5), 20).build();
- var frameStartTs = parseFloat(model.device.powerSeries.samples[0].start);
- while (model.device.powerSeries.getSamplesWithinRange(
- frameStartTs, frameStartTs + IDEAL_FRAME_DURATION).length) {
- var currentFrameEnergy = model.device.powerSeries.getEnergyConsumed(
- frameStartTs, frameStartTs + IDEAL_FRAME_DURATION);
- frameStartTs += IDEAL_FRAME_DURATION;
- frameEnergyConsumed.add(currentFrameEnergy);
- }
-
- valueList.addValue(new tr.v.NumericValue(
- 'energy_consumed_per_frame', frameEnergyConsumed,
- {description: 'Energy consumption per frame in joules'}));
- }
-
- function powerMetric(valueList, model) {
- // TODO(alexandermont): Once it's possible to specify multiple metrics
- // in a Telemetry benchmark, separate out this metric from the power
- // metric and have the benchmark use both.
- // (See: https://github.com/catapult-project/catapult/issues/2430.)
- tr.metrics.sh.clockSyncLatencyMetric(valueList, model);
- if (!model.device.powerSeries)
- return;
- energyConsumedPerFrame(valueList, model);
- }
-
- tr.metrics.MetricRegistry.register(powerMetric);
-
- return {
- powerMetric: powerMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric_test.html
deleted file mode 100644
index bdc034e63a7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/power_metric_test.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/metrics/system_health/power_metric.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('powerMetric_multipleFrames', function() {
- var model = new tr.Model();
- var valueSet = new tr.v.ValueSet();
- model.device.powerSeries = new tr.model.PowerSeries(model.device);
- // We want values in different frames, so they must go up by more than 16.66
- // milliseconds.
- model.device.powerSeries.addPowerSample('1', '.1');
- model.device.powerSeries.addPowerSample('2', '.1');
- model.device.powerSeries.addPowerSample('18', '.2');
- model.device.powerSeries.addPowerSample('36', '.3');
- model.device.powerSeries.addPowerSample('53', '.4');
- model.device.powerSeries.addPowerSample('70', '.5');
- tr.metrics.sh.powerMetric(valueSet, model);
- var powerEntries = valueSet.valueDicts.filter(
- (dict) => dict.name === 'energy_consumed_per_frame');
- var powerEntry = tr.b.getOnlyElement(powerEntries);
- assert.equal(powerEntry.numeric.centralBins[0].count, 5);
- assert.closeTo(powerEntry.numeric.running.sum, 0.0172, 1e-4);
- });
-
- test('powerMetric_oneFrame', function() {
- var model = new tr.Model();
- var valueSet = new tr.v.ValueSet();
- model.device.powerSeries = new tr.model.PowerSeries(model.device);
- // We want values in the same frame, so they must go up by less than 16.66
- // milliseconds.
- model.device.powerSeries.addPowerSample('1', '.1');
- model.device.powerSeries.addPowerSample('2', '.1');
- model.device.powerSeries.addPowerSample('3', '.2');
- model.device.powerSeries.addPowerSample('4', '.3');
- model.device.powerSeries.addPowerSample('5', '.4');
- model.device.powerSeries.addPowerSample('6', '.5');
- tr.metrics.sh.powerMetric(valueSet, model);
- var powerEntries = valueSet.valueDicts.filter(
- (dict) => dict.name === 'energy_consumed_per_frame');
- var powerEntry = tr.b.getOnlyElement(powerEntries);
- assert.equal(powerEntry.numeric.centralBins[0].count, 1);
- assert.closeTo(powerEntry.numeric.running.sum, 0.0011, 1e-4);
- });
-
- test('powerMetric_noPowerSeries', function() {
- var model = new tr.Model();
- var valueSet = new tr.v.ValueSet();
- tr.metrics.sh.powerMetric(valueSet, model);
- var powerEntries = valueSet.valueDicts.filter(
- (dict) => dict.name === 'energy_consumed_per_frame');
- assert.lengthOf(powerEntries, 0);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/responsiveness_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/responsiveness_metric.html
deleted file mode 100644
index 5098c535277..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/responsiveness_metric.html
+++ /dev/null
@@ -1,158 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/utils.html">
-<link rel="import" href="/tracing/model/user_model/animation_expectation.html">
-<link rel="import" href="/tracing/model/user_model/load_expectation.html">
-<link rel="import" href="/tracing/model/user_model/response_expectation.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- // In the case of Response, Load, and DiscreteAnimation IRs, Responsiveness is
- // derived from the time between when the user thinks they begin an interation
- // (expectedStart) and the time when the screen first changes to reflect the
- // interaction (actualEnd). There may be a delay between expectedStart and
- // when chrome first starts processing the interaction (actualStart) if the
- // main thread is busy. The user doesn't know when actualStart is, they only
- // know when expectedStart is. User responsiveness, by definition, considers
- // only what the user experiences, so "duration" is defined as actualEnd -
- // expectedStart.
-
- function computeAnimationThroughput(animationExpectation) {
- if (animationExpectation.frameEvents === undefined ||
- animationExpectation.frameEvents.length === 0)
- throw new Error('Animation missing frameEvents ' +
- animationExpectation.stableId);
-
- var durationSeconds = animationExpectation.duration / 1000;
- return animationExpectation.frameEvents.length / durationSeconds;
- }
-
- function computeAnimationframeTimeDiscrepancy(animationExpectation) {
- if (animationExpectation.frameEvents === undefined ||
- animationExpectation.frameEvents.length === 0)
- throw new Error('Animation missing frameEvents ' +
- animationExpectation.stableId);
-
- var frameTimestamps = animationExpectation.frameEvents;
- frameTimestamps = frameTimestamps.toArray().map(function(event) {
- return event.start;
- });
-
- var absolute = false;
- return tr.b.Statistics.timestampsDiscrepancy(frameTimestamps, absolute);
- }
-
- var RESPONSE_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- tr.b.Range.fromExplicitRange(100, 1000), 90);
-
- var THROUGHPUT_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.unitlessNumber_biggerIsBetter,
- tr.b.Range.fromExplicitRange(10, 60), 10);
-
- var DISCREPANCY_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter,
- tr.b.Range.fromExplicitRange(0, 1), 50);
-
- var LATENCY_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- tr.b.Range.fromExplicitRange(0, 300), 60);
-
- /**
- * @param {!tr.v.ValueSet} values
- * @param {!tr.model.Model} model
- * @param {!Object=} opt_options
- */
- function responsivenessMetric(values, model, opt_options) {
- // TODO(benjhayden): Add categories to benchmark to support:
- // tr.metrics.sh.firstPaintMetric(values, model);
-
- var responseNumeric = RESPONSE_NUMERIC_BUILDER.build();
- var throughputNumeric = THROUGHPUT_NUMERIC_BUILDER.build();
- var frameTimeDiscrepancyNumeric = DISCREPANCY_NUMERIC_BUILDER.build();
- var latencyNumeric = LATENCY_NUMERIC_BUILDER.build();
-
- model.userModel.expectations.forEach(function(ue) {
- if (opt_options && opt_options.rangeOfInterest &&
- !opt_options.rangeOfInterest.intersectsExplicitRangeExclusive(
- ue.start, ue.end))
- return;
-
- var sourceInfo = {userExpectationId: ue.stableId};
-
- // Responsiveness is not defined for Idle.
- if (ue instanceof tr.model.um.IdleExpectation) {
- return;
- } else if (ue instanceof tr.model.um.LoadExpectation) {
- // This is already covered by firstPaintMetric.
- } else if (ue instanceof tr.model.um.ResponseExpectation) {
- responseNumeric.add(ue.duration, sourceInfo);
- } else if (ue instanceof tr.model.um.AnimationExpectation) {
- var throughput = computeAnimationThroughput(ue);
- if (throughput === undefined)
- throw new Error('Missing throughput for ' +
- ue.stableId);
-
- throughputNumeric.add(throughput, sourceInfo);
-
- var frameTimeDiscrepancy = computeAnimationframeTimeDiscrepancy(ue);
- if (frameTimeDiscrepancy === undefined)
- throw new Error('Missing frameTimeDiscrepancy for ' +
- ue.stableId);
-
- frameTimeDiscrepancyNumeric.add(frameTimeDiscrepancy, sourceInfo);
-
- ue.associatedEvents.forEach(function(event) {
- if (!(event instanceof tr.e.cc.InputLatencyAsyncSlice))
- return;
-
- latencyNumeric.add(event.duration, sourceInfo);
- });
- } else {
- throw new Error('Unrecognized stage for ' + ue.stableId);
- }
- });
-
- [
- responseNumeric, throughputNumeric, frameTimeDiscrepancyNumeric,
- latencyNumeric
- ].forEach(function(numeric) {
- numeric.customizeSummaryOptions({
- avg: true,
- max: true,
- min: true,
- std: true
- });
- });
-
- values.addValue(new tr.v.NumericValue(
- 'response latency', responseNumeric));
- values.addValue(new tr.v.NumericValue(
- 'animation throughput', throughputNumeric));
- values.addValue(new tr.v.NumericValue(
- 'animation frameTimeDiscrepancy',
- frameTimeDiscrepancyNumeric));
- values.addValue(new tr.v.NumericValue(
- 'animation latency', latencyNumeric));
- }
-
- tr.metrics.MetricRegistry.register(responsivenessMetric, {
- supportsRangeOfInterest: true
- });
-
- return {
- responsivenessMetric: responsivenessMetric,
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/system_health_metrics.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/system_health_metrics.html
deleted file mode 100644
index 723e526b554..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/system_health_metrics.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/metrics/system_health/efficiency_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/hazard_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/long_tasks_metric.html">
-<link rel="import" href="/tracing/metrics/system_health/power_metric.html"
-<link rel="import"
- href="/tracing/metrics/system_health/responsiveness_metric.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- function systemHealthMetrics(values, model) {
- tr.metrics.sh.responsivenessMetric(values, model);
- tr.metrics.sh.efficiencyMetric(values, model);
- tr.metrics.sh.longTasksMetric(values, model);
- tr.metrics.sh.hazardMetric(values, model);
- tr.metrics.sh.powerMetric(values, model);
- }
-
- tr.metrics.MetricRegistry.register(systemHealthMetrics);
-
- return {
- systemHealthMetrics: systemHealthMetrics
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/utils.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/utils.html
deleted file mode 100644
index 9e0d09bd32f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/utils.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/model/user_model/user_expectation.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- // Returns a weight for this score.
- // score should be a number between 0 and 1 inclusive.
- // This function is expected to be passed to tr.b.Statistics.weightedMean as
- // its weightCallback.
- function perceptualBlend(ir, index, score) {
- // Lower scores are exponentially more important than higher scores
- // due to the Peak-end rule.
- // Other than that general rule, there is no specific reasoning behind this
- // specific formula -- it is fairly arbitrary.
- return Math.exp(1 - score);
- }
-
- function filterExpectationsByRange(irs, opt_range) {
- var filteredExpectations = [];
- irs.forEach(function(ir) {
- if (!(ir instanceof tr.model.um.UserExpectation))
- return;
-
- if (!opt_range ||
- opt_range.intersectsExplicitRangeExclusive(ir.start, ir.end))
- filteredExpectations.push(ir);
- });
- return filteredExpectations;
- }
-
- return {
- perceptualBlend: perceptualBlend,
- filterExpectationsByRange: filterExpectationsByRange
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric.html
deleted file mode 100644
index 10e873b97f5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/utils.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.sh', function() {
- function webviewStartupMetric(values, model) {
- for (var slice of model.getDescendantEvents()) {
- // WebViewStartupInterval is the title of the section of code that is
- // entered (via android.os.Trace.beginSection) when WebView is started
- // up. This value is defined in TelemetryActivity.java.
- if (!(slice instanceof tr.model.Slice))
- return;
- if (slice.title === 'WebViewStartupInterval') {
- values.addValue(new tr.v.NumericValue(
- 'webview_startup_wall_time',
- new tr.v.ScalarNumeric(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- slice.duration),
- { description: 'WebView startup wall time' }));
- values.addValue(new tr.v.NumericValue(
- 'webview_startup_cpu_time',
- new tr.v.ScalarNumeric(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- slice.cpuDuration),
- { description: 'WebView startup CPU time' }));
- }
- // WebViewBlankUrlLoadInterval is the title of the section of code
- // that is entered (via android.os.Trace.beginSection) when WebView
- // is started up. This value is defined in TelemetryActivity.java.
- if (slice.title === 'WebViewBlankUrlLoadInterval') {
- values.addValue(new tr.v.NumericValue(
- 'webview_url_load_wall_time',
- new tr.v.ScalarNumeric(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- slice.duration),
- { description: 'WebView blank URL load wall time' }));
- values.addValue(new tr.v.NumericValue(
- 'webview_url_load_cpu_time',
- new tr.v.ScalarNumeric(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- slice.cpuDuration),
- { description: 'WebView blank URL load CPU time' }));
- }
- }
- };
-
- tr.metrics.MetricRegistry.register(webviewStartupMetric);
-
- return {
- webviewStartupMetric: webviewStartupMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric_test.html
deleted file mode 100644
index fa4da093afc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/system_health/webview_startup_metric_test.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/metrics/system_health/webview_startup_metric.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-function makeTestModel() {
- return tr.c.TestUtils.newModel(function(model) {
- var mainThread = model.getOrCreateProcess(1).getOrCreateThread(2);
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'webview',
- title: 'WebViewStartupInterval',
- start: 200,
- duration: 42.0,
- cpuStart: 150,
- cpuDuration: 32.0
- }));
- mainThread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({
- cat: 'webview',
- title: 'WebViewBlankUrlLoadInterval',
- start: 250,
- duration: 27.0,
- cpuStart: 190,
- cpuDuration: 17.0
- }));
- });
-}
-
-tr.b.unittest.testSuite(function() {
- test('webviewStartupMetric_allIntervals', function() {
- var values = new tr.v.ValueSet();
- tr.metrics.sh.webviewStartupMetric(values, makeTestModel());
- assert.lengthOf(values.valueDicts, 4);
- });
-
- test('webviewStartupMetric_startupWallInterval', function() {
- var values = new tr.v.ValueSet();
- tr.metrics.sh.webviewStartupMetric(values, makeTestModel());
- assert.equal(values.valueDicts[0].numeric.value, 42);
- });
-
- test('webviewStartupMetric_startupCpuInterval', function() {
- var values = new tr.v.ValueSet();
- tr.metrics.sh.webviewStartupMetric(values, makeTestModel());
- assert.equal(values.valueDicts[1].numeric.value, 32);
- });
-
- test('webviewStartupMetric_urlLoadWallInterval', function() {
- var values = new tr.v.ValueSet();
- tr.metrics.sh.webviewStartupMetric(values, makeTestModel());
- assert.equal(values.valueDicts[2].numeric.value, 27);
- });
-
- test('webviewStartupMetric_urlLoadCpuInterval', function() {
- var values = new tr.v.ValueSet();
- tr.metrics.sh.webviewStartupMetric(values, makeTestModel());
- assert.equal(values.valueDicts[3].numeric.value, 17);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric.html
deleted file mode 100644
index f47020e25b7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric.html
+++ /dev/null
@@ -1,189 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics', function() {
- var MEMORY_INFRA_TRACING_CATEGORY = 'disabled-by-default-memory-infra';
-
- function addTimeDurationValue(valueName, duration, allValues) {
- var scalarNumericValue = new tr.v.ScalarNumeric(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter, duration);
- var numericValue = new tr.v.NumericValue(valueName, scalarNumericValue);
- allValues.addValue(numericValue);
- }
-
- // Adds values specific to memory-infra dumps.
- function addMemoryInfraValues(values, model, categoryNamesToTotalEventSizes) {
- var memoryDumpCount = model.globalMemoryDumps.length;
- if (memoryDumpCount === 0)
- return;
-
- var totalOverhead = 0;
- var nonMemoryInfraThreadOverhead = 0;
- var overheadByProvider = {};
- tr.b.iterItems(model.processes, function(pid, process) {
- tr.b.iterItems(process.threads, function(tid, thread) {
- tr.b.iterItems(thread.sliceGroup.slices, function(slice_id, slice) {
- if (slice.category !== MEMORY_INFRA_TRACING_CATEGORY)
- return;
- totalOverhead += slice.duration;
- if (thread.name !== 'MemoryInfra')
- nonMemoryInfraThreadOverhead += slice.duration;
- if (slice.args && slice.args['dump_provider.name']) {
- var providerName = slice.args['dump_provider.name'];
- overheadByProvider[providerName] =
- (overheadByProvider[providerName] || 0) + slice.duration;
- }
- });
- });
- });
-
- addTimeDurationValue(
- 'Average CPU overhead on all threads per memory-infra dump',
- totalOverhead / memoryDumpCount, values);
- addTimeDurationValue(
- 'Average CPU overhead on non-memory-infra threads per memory-infra ' +
- 'dump',
- nonMemoryInfraThreadOverhead / memoryDumpCount, values);
- tr.b.iterItems(overheadByProvider, function(providerName, overhead) {
- addTimeDurationValue(
- 'Average CPU overhead of ' + providerName + ' per memory-infra dump',
- overhead / memoryDumpCount, values);
- });
-
- var memoryInfraEventsSize =
- categoryNamesToTotalEventSizes.get(MEMORY_INFRA_TRACING_CATEGORY);
- var memoryInfraTraceBytesValue = new tr.v.ScalarNumeric(
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter, memoryInfraEventsSize);
- values.addValue(new tr.v.NumericValue(
- 'Total trace size of memory-infra dumps in bytes',
- memoryInfraTraceBytesValue));
-
- var traceBytesPerDumpValue = new tr.v.ScalarNumeric(
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter,
- memoryInfraEventsSize / memoryDumpCount);
- values.addValue(new tr.v.NumericValue(
- 'Average trace size of memory-infra dumps in bytes',
- traceBytesPerDumpValue));
- }
-
- function tracingMetric(values, model) {
- if (!model.stats.hasEventSizesinBytes) {
- throw new Error('Model stats does not have event size information. ' +
- 'Please enable ImportOptions.trackDetailedModelStats.');
- }
-
- var eventStats = model.stats.allTraceEventStatsInTimeIntervals;
- eventStats.sort(function(a, b) {
- return a.timeInterval - b.timeInterval;
- });
-
- var totalTraceBytes = eventStats.reduce((a, b) =>
- (a + b.totalEventSizeinBytes), 0);
-
- // We maintain a sliding window of records [start ... end-1] where end
- // increments each time through the loop, and we move start just far enough
- // to keep the window less than 1 second wide. Note that we need to compute
- // the number of time intervals (i.e. units that timeInterval is given in)
- // in one second to know how wide the sliding window should be.
- var maxEventCountPerSec = 0;
- var maxEventBytesPerSec = 0;
- var INTERVALS_PER_SEC = Math.floor(
- 1000 / model.stats.TIME_INTERVAL_SIZE_IN_MS);
-
- var runningEventNumPerSec = 0;
- var runningEventBytesPerSec = 0;
- var start = 0;
- var end = 0;
-
- while (end < eventStats.length) {
- // Slide the end marker forward. Moving the end marker from N
- // to N+1 adds eventStats[N] to the sliding window.
- runningEventNumPerSec += eventStats[end].numEvents;
- runningEventBytesPerSec += eventStats[end].totalEventSizeinBytes;
- end++;
-
- // Slide the start marker forward so that the time interval covered
- // by the window is less than 1 second wide.
- while ((eventStats[end - 1].timeInterval -
- eventStats[start].timeInterval) >= INTERVALS_PER_SEC) {
- runningEventNumPerSec -= eventStats[start].numEvents;
- runningEventBytesPerSec -= eventStats[start].totalEventSizeinBytes;
- start++;
- }
-
- // Update maximum values.
- maxEventCountPerSec = Math.max(maxEventCountPerSec,
- runningEventNumPerSec);
- maxEventBytesPerSec = Math.max(maxEventBytesPerSec,
- runningEventBytesPerSec);
-
- }
-
- var stats = model.stats.allTraceEventStats;
- var categoryNamesToTotalEventSizes = (
- stats.reduce((map, stat) => (
- map.set(stat.category,
- ((map.get(stat.category) || 0) +
- stat.totalEventSizeinBytes))), new Map()));
-
- // Determine the category with the highest total event size.
- var maxCatNameAndBytes = Array.from(
- categoryNamesToTotalEventSizes.entries()).reduce(
- (a, b) => (b[1] >= a[1]) ? b : a);
- var maxEventBytesPerCategory = maxCatNameAndBytes[1];
- var categoryWithMaxEventBytes = maxCatNameAndBytes[0];
-
- var maxEventCountPerSecValue = new tr.v.ScalarNumeric(
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter, maxEventCountPerSec);
- var maxEventBytesPerSecValue = new tr.v.ScalarNumeric(
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter, maxEventBytesPerSec);
- var totalTraceBytesValue = new tr.v.ScalarNumeric(
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter, totalTraceBytes);
-
- var biggestCategory = {
- name: categoryWithMaxEventBytes,
- size_in_bytes: maxEventBytesPerCategory
- };
-
- var totalBytes = new tr.v.NumericValue(
- 'Total trace size in bytes', totalTraceBytesValue);
- totalBytes.diagnostics.add(
- 'category_with_max_event_size', new tr.v.d.Generic(biggestCategory));
- values.addValue(totalBytes);
-
- var peakEvents = new tr.v.NumericValue(
- 'Max number of events per second', maxEventCountPerSecValue);
- peakEvents.diagnostics.add(
- 'category_with_max_event_size', new tr.v.d.Generic(biggestCategory));
- values.addValue(peakEvents);
-
- var peakBytes = new tr.v.NumericValue(
- 'Max event size in bytes per second', maxEventBytesPerSecValue);
- peakBytes.diagnostics.add(
- 'category_with_max_event_size', new tr.v.d.Generic(biggestCategory));
- values.addValue(peakBytes);
-
- addMemoryInfraValues(values, model, categoryNamesToTotalEventSizes);
- }
-
- tr.metrics.MetricRegistry.register(tracingMetric);
-
- return {
- tracingMetric: tracingMetric,
- // For testing only:
- MEMORY_INFRA_TRACING_CATEGORY: MEMORY_INFRA_TRACING_CATEGORY
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric_test.html
deleted file mode 100644
index 97a158f384a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/tracing_metric_test.html
+++ /dev/null
@@ -1,172 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/metrics/tracing_metric.html">
-<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- function makeModel(events, opt_track) {
- return tr.c.TestUtils.newModelWithEvents([events], {
- trackDetailedModelStats: opt_track
- });
- }
-
- function getEventStringSize(events, indices) {
- return indices.reduce(function(sum, index) {
- return sum + JSON.stringify(events[index]).length;
- }, 0);
- }
-
- function checkDurationValue(allValues, metricName, expected) {
- var values = allValues.getValuesWithName(metricName);
- assert.lengthOf(values, 1);
- assert.closeTo(1000 * values[0].numeric.value, expected, 0.1);
- }
-
- test('hasEventSizesInBytes', function() {
- var allValues = new tr.v.ValueSet();
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'B'}
- ];
-
- var model = makeModel(JSON.stringify(events), false);
- assert.isFalse(model.importOptions.trackDetailedModelStats);
- assert.throws(function() {
- tr.metrics.tracingMetric(allValues, model);
- }, 'Please enable ImportOptions.trackDetailedModelStats.');
-
- model = makeModel(JSON.stringify(events), true);
- assert.isTrue(model.importOptions.trackDetailedModelStats);
- tr.metrics.tracingMetric(allValues, model);
- });
-
- test('totalTraceSize', function() {
- var allValues = new tr.v.ValueSet();
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'B'}
- ];
- var model = makeModel(JSON.stringify(events), true);
- tr.metrics.tracingMetric(allValues, model);
-
- var eventStringSize = getEventStringSize(events, [0, 1]);
- var values = allValues.getValuesWithName('Total trace size in bytes');
- assert.strictEqual(values.length, 1);
- assert.strictEqual(values[0].numeric.value, eventStringSize);
- });
-
- test('maxValuePerSec', function() {
- var ONE_SEC_IN_US = 1000000;
- var events = [
- {name: 'a', pid: 52, ts: 1, cat: 'foo', ph: 'B'},
- {name: 'a', pid: 52, ts: ONE_SEC_IN_US + 1, cat: 'foo', ph: 'B'},
- {name: 'a', pid: 52, ts: 2 * ONE_SEC_IN_US + 1, cat: 'foo', ph: 'B'},
- {name: 'a', pid: 52, ts: 2 * ONE_SEC_IN_US + 3, cat: 'foo', ph: 'B'},
- {name: 'a', pid: 52, ts: ONE_SEC_IN_US + 2, cat: 'foo', ph: 'B'},
- {name: 'a', pid: 52, ts: 2 * ONE_SEC_IN_US + 2, cat: 'foo', ph: 'B'}
- ];
- var model = makeModel(JSON.stringify(events), true);
- var allValues = new tr.v.ValueSet();
- tr.metrics.tracingMetric(allValues, model);
-
- var maxEventCountPerSec = 3;
- var values = allValues.getValuesWithName('Max number of events per second');
- assert.strictEqual(values.length, 1);
- assert.strictEqual(values[0].numeric.value, maxEventCountPerSec);
-
- var maxEventBytesPerSec = getEventStringSize(events, [2, 3, 5]);
- var values = allValues.getValuesWithName(
- 'Max event size in bytes per second');
- assert.strictEqual(values.length, 1);
- assert.strictEqual(values[0].numeric.value, maxEventBytesPerSec);
- });
-
- test('diagnostics', function() {
- var allValues = new tr.v.ValueSet();
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 524, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 535, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'bb', args: {}, pid: 52, ts: 546, cat: 'bar', tid: 53, ph: 'E'},
- {name: 'a', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'bb', args: {}, pid: 52, ts: 578, cat: 'bar', tid: 53, ph: 'E'}
- ];
- var model = makeModel(JSON.stringify(events), true);
- tr.metrics.tracingMetric(allValues, model);
-
- for (var i = 0; i < allValues.length; i++) {
- assert.strictEqual(
- values[i].diagnostics.category_with_max_event_size.name,
- 'foo');
- assert.strictEqual(
- values[i].diagnostics.category_with_max_event_size.size_in_bytes,
- getEventStringSize(events, [0, 1, 3]));
- }
- });
-
- test('testMemoryInfraTracingMetrics', function() {
- var MEMORY_INFRA_TRACING_CATEGORY =
- tr.metrics.MEMORY_INFRA_TRACING_CATEGORY;
- var allValues = new tr.v.ValueSet();
- var events = [
- {name: 'OnMemoryDump', pid: 1, ts: 510, tid: 1, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp1'}, dur: 4}, // @suppress longLineCheck
- {name: 'OnMemoryDump', pid: 1, ts: 520, tid: 7, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp2'}, dur: 15}, // @suppress longLineCheck
- {name: 'OnMemoryDump', pid: 1, ts: 530, tid: 7, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp3'}, dur: 5}, // @suppress longLineCheck
- {name: 'OnMemoryDump', pid: 2, ts: 510, tid: 2, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp1'}, dur: 9}, // @suppress longLineCheck
- {name: 'OnMemoryDump', pid: 2, ts: 520, tid: 8, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp2'}, dur: 17}, // @suppress longLineCheck
- {name: 'OnMemoryDump', pid: 2, ts: 530, tid: 8, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp3'}, dur: 7}, // @suppress longLineCheck
- {name: 'OnMemoryDump', pid: 2, ts: 540, tid: 3, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {'dump_provider.name': 'mdp4'}, dur: 8}, // @suppress longLineCheck
- {name: 'ProcessDumps', pid: 1, ts: 550, tid: 1, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {guid: 4}, dur: 8}, // @suppress longLineCheck
- {name: 'ProcessDumps', pid: 2, ts: 540, tid: 2, ph: 'X', cat: MEMORY_INFRA_TRACING_CATEGORY, args: {guid: 4}, dur: 18}, // @suppress longLineCheck
- {name: 'thread_name', pid: 1, ts: 0, tid: 1, ph: 'M', cat: '__metadata', args: {name: 'CrBrowsermain'}}, // @suppress longLineCheck
- {name: 'thread_name', pid: 1, ts: 0, tid: 7, ph: 'M', cat: '__metadata', args: {name: 'MemoryInfra'}}, // @suppress longLineCheck
- {name: 'thread_name', pid: 2, ts: 0, tid: 2, ph: 'M', cat: '__metadata', args: {name: 'CrRendererMain'}}, // @suppress longLineCheck
- {name: 'thread_name', pid: 2, ts: 0, tid: 8, ph: 'M', cat: '__metadata', args: {name: 'MemoryInfra'}}, // @suppress longLineCheck
- {name: 'thread_name', pid: 2, ts: 0, tid: 3, ph: 'M', cat: '__metadata', args: {name: 'Compositor'}} // @suppress longLineCheck
- ];
-
- var model = makeModel(JSON.stringify(events), true);
- tr.model.MemoryDumpTestUtils.addGlobalMemoryDump(model, 550);
- tr.metrics.tracingMetric(allValues, model);
-
- var memoryCategorySize = events.filter(
- slice => slice['cat'] === MEMORY_INFRA_TRACING_CATEGORY).reduce(
- (acc, slice) => acc + JSON.stringify(slice).length, 0);
- var totalSizeValue = allValues.getValuesWithName(
- 'Total trace size of memory-infra dumps in bytes');
- assert.lengthOf(totalSizeValue, 1);
- assert.strictEqual(totalSizeValue[0].numeric.value, memoryCategorySize);
- var sizePerDumpValue = allValues.getValuesWithName(
- 'Average trace size of memory-infra dumps in bytes');
- assert.lengthOf(sizePerDumpValue, 1);
- assert.strictEqual(sizePerDumpValue[0].numeric.value, memoryCategorySize);
-
- checkDurationValue(allValues,
- 'Average CPU overhead of mdp1 per memory-infra dump', 13);
- checkDurationValue(allValues,
- 'Average CPU overhead of mdp2 per memory-infra dump', 32);
- checkDurationValue(allValues,
- 'Average CPU overhead of mdp3 per memory-infra dump', 12);
- checkDurationValue(allValues,
- 'Average CPU overhead of mdp4 per memory-infra dump', 8);
- checkDurationValue(allValues,
- 'Average CPU overhead on non-memory-infra threads per memory-infra ' +
- 'dump',
- 47);
- checkDurationValue(allValues,
- 'Average CPU overhead on all threads per memory-infra dump', 91);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric.html
deleted file mode 100644
index 3c5565b9c46..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric.html
+++ /dev/null
@@ -1,219 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.v8', function() {
- var DURATION_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- tr.b.Range.fromExplicitRange(4, 200), 100);
-
- function computeExecuteMetrics(values, model) {
- var cpuTotalExecution = DURATION_NUMERIC_BUILDER.build();
- var wallTotalExecution = DURATION_NUMERIC_BUILDER.build();
- var cpuSelfExecution = DURATION_NUMERIC_BUILDER.build();
- var wallSelfExecution = DURATION_NUMERIC_BUILDER.build();
-
- for (var e of model.findTopmostSlicesNamed('V8.Execute')) {
- cpuTotalExecution.add(e.cpuDuration);
- wallTotalExecution.add(e.duration);
- cpuSelfExecution.add(e.cpuSelfTime);
- wallSelfExecution.add(e.selfTime);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_execution_cpu_total', cpuTotalExecution,
- { description: 'cpu total time spent in script execution' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_execution_wall_total', wallTotalExecution,
- { description: 'wall total time spent in script execution' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_execution_cpu_self', cpuSelfExecution,
- { description: 'cpu self time spent in script execution' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_execution_wall_self', wallSelfExecution,
- { description: 'wall self time spent in script execution' }));
- }
-
- function computeParseLazyMetrics(values, model) {
- var cpuSelfParseLazy = DURATION_NUMERIC_BUILDER.build();
- var wallSelfParseLazy = DURATION_NUMERIC_BUILDER.build();
-
- for (var e of model.findTopmostSlicesNamed('V8.ParseLazyMicroSeconds')) {
- cpuSelfParseLazy.add(e.cpuSelfTime);
- wallSelfParseLazy.add(e.selfTime);
- }
- for (var e of model.findTopmostSlicesNamed('V8.ParseLazy')) {
- cpuSelfParseLazy.add(e.cpuSelfTime);
- wallSelfParseLazy.add(e.selfTime);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_parse_lazy_cpu_self', cpuSelfParseLazy,
- { description: 'cpu self time spent performing lazy parsing' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_parse_lazy_wall_self', wallSelfParseLazy,
- { description: 'wall self time spent performing lazy parsing' }));
- }
-
- function computeCompileFullCodeMetrics(values, model) {
- var cpuSelfCompileFullCode = DURATION_NUMERIC_BUILDER.build();
- var wallSelfCompileFullCode = DURATION_NUMERIC_BUILDER.build();
-
- for (var e of model.findTopmostSlicesNamed('V8.CompileFullCode')) {
- cpuSelfCompileFullCode.add(e.cpuSelfTime);
- wallSelfCompileFullCode.add(e.selfTime);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_compile_full_code_cpu_self',
- cpuSelfCompileFullCode,
- { description: 'cpu self time spent performing compiling full code' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_compile_full_code_wall_self',
- wallSelfCompileFullCode, {
- description: 'wall self time spent performing compiling full code'
- }));
- }
-
- function computeCompileIgnitionMetrics(values, model) {
- var cpuSelfCompileIgnition = DURATION_NUMERIC_BUILDER.build();
- var wallSelfCompileIgnition = DURATION_NUMERIC_BUILDER.build();
-
- for (var e of model.findTopmostSlicesNamed('V8.CompileIgnition')) {
- cpuSelfCompileIgnition.add(e.cpuSelfTime);
- wallSelfCompileIgnition.add(e.selfTime);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_compile_ignition_cpu_self',
- cpuSelfCompileIgnition,
- { description: 'cpu self time spent in compile ignition' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_compile_ignition_wall_self',
- wallSelfCompileIgnition, {
- description: 'wall self time spent in compile ignition'
- }));
- }
-
- function computeRecompileMetrics(values, model) {
- var cpuTotalRecompileSynchronous = DURATION_NUMERIC_BUILDER.build();
- var wallTotalRecompileSynchronous = DURATION_NUMERIC_BUILDER.build();
- var cpuTotalRecompileConcurrent = DURATION_NUMERIC_BUILDER.build();
- var wallTotalRecompileConcurrent = DURATION_NUMERIC_BUILDER.build();
- // TODO(eakuefner): Stop computing overall values once dash v2 is ready.
- // https://github.com/catapult-project/catapult/issues/2180
- var cpuTotalRecompileOverall = DURATION_NUMERIC_BUILDER.build();
- var wallTotalRecompileOverall = DURATION_NUMERIC_BUILDER.build();
-
- for (var e of model.findTopmostSlicesNamed('V8.RecompileSynchronous')) {
- cpuTotalRecompileSynchronous.add(e.cpuDuration);
- wallTotalRecompileSynchronous.add(e.duration);
- cpuTotalRecompileOverall.add(e.cpuDuration);
- wallTotalRecompileOverall.add(e.duration);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_recompile_synchronous_cpu_total',
- cpuTotalRecompileSynchronous,
- { description: 'cpu total time spent in synchronous recompilation' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_recompile_synchronous_wall_total',
- wallTotalRecompileSynchronous,
- { description: 'wall total time spent in synchronous recompilation' }));
-
-
- for (var e of model.findTopmostSlicesNamed('V8.RecompileConcurrent')) {
- cpuTotalRecompileConcurrent.add(e.cpuDuration);
- wallTotalRecompileConcurrent.add(e.duration);
- cpuTotalRecompileOverall.add(e.cpuDuration);
- wallTotalRecompileOverall.add(e.duration);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_recompile_concurrent_cpu_total',
- cpuTotalRecompileConcurrent,
- { description: 'cpu total time spent in concurrent recompilation' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_recompile_concurrent_wall_total',
- wallTotalRecompileConcurrent,
- { description: 'wall total time spent in concurrent recompilation' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_recompile_overall_cpu_total',
- cpuTotalRecompileOverall, {
- description:
- 'cpu total time spent in synchronous or concurrent recompilation'
- }));
- values.addValue(new tr.v.NumericValue(
- 'v8_recompile_overall_wall_total',
- wallTotalRecompileOverall, {
- description:
- 'wall total time spent in synchronous or concurrent recompilation'
- }));
- }
-
- function computeOptimizeCodeMetrics(values, model) {
- var cpuTotalOptimizeCode = DURATION_NUMERIC_BUILDER.build();
- var wallTotalOptimizeCode = DURATION_NUMERIC_BUILDER.build();
-
- for (var e of model.findTopmostSlicesNamed('V8.OptimizeCode')) {
- cpuTotalOptimizeCode.add(e.cpuDuration);
- wallTotalOptimizeCode.add(e.duration);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_optimize_code_cpu_total',
- cpuTotalOptimizeCode,
- { description: 'cpu total time spent in code optimization' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_optimize_code_wall_total',
- wallTotalOptimizeCode,
- { description: 'wall total time spent in code optimization' }));
- }
-
- function computeDeoptimizeCodeMetrics(values, model) {
- var cpuTotalDeoptimizeCode = DURATION_NUMERIC_BUILDER.build();
- var wallTotalDeoptimizeCode = DURATION_NUMERIC_BUILDER.build();
-
- for (var e of model.findTopmostSlicesNamed('V8.DeoptimizeCode')) {
- cpuTotalDeoptimizeCode.add(e.cpuDuration);
- wallTotalDeoptimizeCode.add(e.duration);
- }
-
- values.addValue(new tr.v.NumericValue(
- 'v8_deoptimize_code_cpu_total',
- cpuTotalDeoptimizeCode,
- { description: 'cpu total time spent in code deoptimization' }));
- values.addValue(new tr.v.NumericValue(
- 'v8_deoptimize_code_wall_total',
- wallTotalDeoptimizeCode,
- { description: 'wall total time spent in code deoptimization' }));
- }
-
- function executionMetric(values, model) {
- computeExecuteMetrics(values, model);
- computeParseLazyMetrics(values, model);
- computeCompileIgnitionMetrics(values, model);
- computeCompileFullCodeMetrics(values, model);
- computeRecompileMetrics(values, model);
- computeOptimizeCodeMetrics(values, model);
- computeDeoptimizeCodeMetrics(values, model);
- }
-
- tr.metrics.MetricRegistry.register(executionMetric);
-
- return {
- executionMetric: executionMetric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric_test.html
deleted file mode 100644
index 9cb7099796c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/v8/execution_metric_test.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/metrics/v8/execution_metric.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('executionMetricBasic', function() {
- var model = tr.c.TestUtils.newModel();
- var values = new tr.v.ValueSet();
-
- tr.metrics.v8.executionMetric(values, model);
-
- [
- 'v8_execution_cpu_total',
- 'v8_execution_wall_total',
- 'v8_execution_cpu_self',
- 'v8_execution_wall_self',
- 'v8_parse_lazy_cpu_self',
- 'v8_parse_lazy_wall_self',
- 'v8_compile_full_code_cpu_self',
- 'v8_compile_full_code_wall_self',
- 'v8_compile_ignition_cpu_self',
- 'v8_compile_ignition_wall_self',
- 'v8_recompile_synchronous_cpu_total',
- 'v8_recompile_synchronous_wall_total',
- 'v8_recompile_concurrent_cpu_total',
- 'v8_recompile_concurrent_wall_total',
- 'v8_recompile_overall_cpu_total',
- 'v8_recompile_overall_wall_total',
- 'v8_optimize_code_cpu_total',
- 'v8_optimize_code_wall_total',
- 'v8_deoptimize_code_cpu_total',
- 'v8_deoptimize_code_wall_total',
- ].forEach(function(name) {
- assert.isAbove(values.getValuesWithName(name).length, 0);
- });
- });
-
- test('noDoubleCounting', function() {
- var events = [
- {name: 'V8.Execute', args: {}, pid: 52, ts: 0, cat: 'foo', tid: 53,
- ph: 'B'},
- {name: 'V8.Execute', args: {}, pid: 52, ts: 100, cat: 'foo', tid: 53,
- ph: 'E'},
- {name: 'V8.Execute', args: {}, pid: 52, ts: 20, cat: 'foo', tid: 53,
- ph: 'B'},
- {name: 'V8.Execute', args: {}, pid: 52, ts: 40, cat: 'foo', tid: 53,
- ph: 'E'}
- ];
-
- var model = tr.c.TestUtils.newModelWithEvents(JSON.stringify(events), {
- shiftWorldToZero: false
- });
- var values = new tr.v.ValueSet();
-
- tr.metrics.v8.executionMetric(values, model);
-
- var value = values.getValuesWithName('v8_execution_wall_total_sum')[0];
-
- assert.closeTo(value.numeric.value, 0.1, 1e-5);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric.html b/chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric.html
deleted file mode 100644
index d842445ab16..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric.html
+++ /dev/null
@@ -1,299 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/v8/utils.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.v8', function() {
- // The time window size for mutator utilization computation.
- // It is equal to the duration of one frame corresponding to 60 FPS rendering.
- var TARGET_FPS = 60;
- var MS_PER_SECOND = 1000;
- var WINDOW_SIZE_MS = MS_PER_SECOND / TARGET_FPS;
-
- function gcMetric(values, model) {
- addDurationOfTopEvents(values, model);
- addTotalDurationOfTopEvents(values, model);
- addDurationOfSubEvents(values, model);
- addIdleTimesOfTopEvents(values, model);
- addTotalIdleTimesOfTopEvents(values, model);
- addV8ExecuteMutatorUtilization(values, model);
- }
-
- tr.metrics.MetricRegistry.register(gcMetric);
-
- var timeDurationInMs_smallerIsBetter =
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter;
- var percentage_biggerIsBetter =
- tr.v.Unit.byName.normalizedPercentage_biggerIsBetter;
-
- var numericBuilder = new tr.v.NumericBuilder(
- timeDurationInMs_smallerIsBetter, 0);
- // 0.1 steps from 0 to 20 since it is the most common range.
- numericBuilder.addLinearBins(20, 200);
- // Exponentially increasing steps from 20 to 200.
- numericBuilder.addExponentialBins(200, 100);
-
- function createNumericForTopEventTime() {
- var n = numericBuilder.build();
- n.customizeSummaryOptions({
- avg: true,
- count: true,
- max: true,
- min: false,
- std: true,
- sum: true,
- percentile: [0.90]});
- return n;
- }
-
- function createNumericForSubEventTime() {
- var n = numericBuilder.build();
- n.customizeSummaryOptions({
- avg: true,
- count: false,
- max: true,
- min: false,
- std: false,
- sum: false,
- percentile: [0.90]
- });
- return n;
- }
-
- function createNumericForIdleTime() {
- var n = numericBuilder.build();
- n.customizeSummaryOptions({
- avg: true,
- count: false,
- max: true,
- min: false,
- std: false,
- sum: true,
- percentile: []
- });
- return n;
- }
-
- function createPercentage(numerator, denominator) {
- var percentage = denominator === 0 ? 0 : numerator / denominator * 100;
- return new tr.v.ScalarNumeric(percentage_biggerIsBetter, percentage);
- }
-
- /**
- * Example output:
- * - Animation-v8_gc_full_mark_compactor.
- */
- function addDurationOfTopEvents(values, model) {
- groupAndProcessEvents(model,
- tr.metrics.v8.utils.isTopGarbageCollectionEvent,
- tr.metrics.v8.utils.topGarbageCollectionEventName,
- function(stageTitle, name, events) {
- var cpuDuration = createNumericForTopEventTime();
- events.forEach(function(event) {
- cpuDuration.add(event.cpuDuration);
- });
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-' + name, cpuDuration));
- }
- );
- }
-
- /**
- * Example output:
- * - Animation:v8_gc_total
- */
- function addTotalDurationOfTopEvents(values, model) {
- groupAndProcessEvents(model,
- tr.metrics.v8.utils.isTopGarbageCollectionEvent,
- event => 'v8-gc-total',
- function(stageTitle, name, events) {
- var cpuDuration = createNumericForTopEventTime();
- events.forEach(function(event) {
- cpuDuration.add(event.cpuDuration);
- });
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-' + name, cpuDuration));
- }
- );
- }
-
- /**
- * Example output:
- * - Animation-v8-gc-full-mark-compactor-evacuate.
- */
- function addDurationOfSubEvents(values, model) {
- groupAndProcessEvents(model,
- tr.metrics.v8.utils.isSubGarbageCollectionEvent,
- tr.metrics.v8.utils.subGarbageCollectionEventName,
- function(stageTitle, name, events) {
- var cpuDuration = createNumericForSubEventTime();
- events.forEach(function(event) {
- cpuDuration.add(event.cpuDuration);
- });
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-' + name, cpuDuration));
- }
- );
- }
-
- /**
- * Example output:
- * - Animation-v8-gc-full-mark-compactor_idle_deadline_overrun,
- * - Animation-v8-gc-full-mark-compactor_outside_idle,
- * - Animation-v8-gc-full-mark-compactor_percentage_idle.
- */
- function addIdleTimesOfTopEvents(values, model) {
- groupAndProcessEvents(model,
- tr.metrics.v8.utils.isTopGarbageCollectionEvent,
- tr.metrics.v8.utils.topGarbageCollectionEventName,
- function(stageTitle, name, events) {
- addIdleTimes(values, model, stageTitle, name, events);
- }
- );
- }
-
- /**
- * Example output:
- * - Animation-v8-gc-total_idle_deadline_overrun,
- * - Animation-v8-gc-total_outside_idle,
- * - Animation-v8-gc-total_percentage_idle.
- */
- function addTotalIdleTimesOfTopEvents(values, model) {
- groupAndProcessEvents(model,
- tr.metrics.v8.utils.isTopGarbageCollectionEvent,
- event => 'v8-gc-total',
- function(stageTitle, name, events) {
- addIdleTimes(values, model, stageTitle, name, events);
- }
- );
- }
-
- function addIdleTimes(values, model, stageTitle, name, events) {
- var cpuDuration = createNumericForIdleTime();
- var insideIdle = createNumericForIdleTime();
- var outsideIdle = createNumericForIdleTime();
- var idleDeadlineOverrun = createNumericForIdleTime();
- events.forEach(function(event) {
- var idleTask = tr.metrics.v8.utils.findParent(
- event, tr.metrics.v8.utils.isIdleTask);
- var inside = 0;
- var overrun = 0;
- if (idleTask) {
- var allottedTime = idleTask['args']['allotted_time_ms'];
- if (event.duration > allottedTime) {
- overrun = event.duration - allottedTime;
- // Don't count time over the deadline as being inside idle time.
- // Since the deadline should be relative to wall clock we
- // compare allotted_time_ms with wall duration instead of thread
- // duration, and then assume the thread duration was inside idle
- // for the same percentage of time.
- inside = event.cpuDuration * allottedTime / event.duration;
- } else {
- inside = event.cpuDuration;
- }
- }
- cpuDuration.add(event.cpuDuration);
- insideIdle.add(inside);
- outsideIdle.add(event.cpuDuration - inside);
- idleDeadlineOverrun.add(overrun);
- });
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-' + name + '_idle_deadline_overrun',
- idleDeadlineOverrun));
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-' + name + '_outside_idle', outsideIdle));
- var percentage = createPercentage(insideIdle.sum,
- cpuDuration.sum);
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-' + name + '_percentage_idle', percentage));
- }
-
- function addV8ExecuteMutatorUtilization(values, model) {
- groupAndProcessEvents(model,
- tr.metrics.v8.utils.isTopV8ExecuteEvent,
- event => 'v8-execute',
- function(stageTitle, name, events) {
- events.sort((a, b) => a.start - b.start);
- var time = 0;
- var pauses = [];
- // Glue together the v8.execute events and adjust the GC pause
- // times accordingly.
- events.forEach(function(topEvent) {
- topEvent.iterateAllDescendents(function(e) {
- if (tr.metrics.v8.utils.isTopGarbageCollectionEvent(e)) {
- pauses.push({ start: e.start - topEvent.start + time,
- end: e.end - topEvent.start + time });
- }
- });
- time += topEvent.duration;
- });
- // Now we have one big v8.execute interval from 0 to |time| and
- // a list of GC pauses.
- var mutatorUtilization = tr.metrics.v8.utils.mutatorUtilization(
- 0, time, WINDOW_SIZE_MS, pauses);
- [0.90, 0.95, 0.99].forEach(function(percent) {
- var value = new tr.v.ScalarNumeric(percentage_biggerIsBetter,
- mutatorUtilization.percentile(1.0 - percent) * 100);
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-v8-execute-mutator-utilization_pct_0' +
- percent * 100,
- value));
- });
- var value = new tr.v.ScalarNumeric(percentage_biggerIsBetter,
- mutatorUtilization.min);
- values.addValue(new tr.v.NumericValue(
- stageTitle + '-v8-execute-mutator-utilization_min', value));
- }
- );
- }
-
- /**
- * Filters events using the |filterCallback|, then groups events by the user
- * expectation stage title and the name computed using the |nameCallback|,
- * and then invokes the |processCallback| with the grouped events.
- * @param {Function} filterCallback Takes an event and returns a boolean.
- * @param {Function} nameCallback Takes event and returns a string.
- * @param {Function} processCallback Takes a stage title, a name, and
- * an array of events.
- */
- function groupAndProcessEvents(model, filterCallback,
- nameCallback, processCallback) {
- // Two level map: stageTitle -> name -> [events].
- var stageTitleToNameToEvents = {};
- model.userModel.expectations.forEach(function(ue) {
- stageTitleToNameToEvents[ue.stageTitle] =
- stageTitleToNameToEvents[ue.stageTitle] || {};
- var nameToEvents = stageTitleToNameToEvents[ue.stageTitle];
- ue.associatedEvents.forEach(function(event) {
- if (!filterCallback(event)) return;
- var name = nameCallback(event);
- nameToEvents[name] = nameToEvents[name] || [];
- nameToEvents[name].push(event);
- });
- });
- tr.b.iterItems(stageTitleToNameToEvents,
- function(stageTitle, nameToEvents) {
- tr.b.iterItems(nameToEvents, function(name, events) {
- processCallback(stageTitle, name, events);
- });
- }
- );
- }
-
- return {
- gcMetric: gcMetric,
- WINDOW_SIZE_MS: WINDOW_SIZE_MS // For testing purposes only.
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric_test.html
deleted file mode 100644
index a0e32cfdbb5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/v8/gc_metric_test.html
+++ /dev/null
@@ -1,252 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/metrics/v8/gc_metric.html">
-<link rel="import" href="/tracing/model/slice_group.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- function createModel(start, end, slices) {
- var opts = {
- customizeModelCallback: function(model) {
- var group = new tr.model.SliceGroup(tr.c.TestUtils.newFakeThread());
- var ue = new tr.model.um.AnimationExpectation(
- model, 'test', start, end);
- slices.forEach(function(slice) {
- group.pushSlice(tr.c.TestUtils.newSliceEx(slice));
- });
- group.createSubSlices();
- group.slices.forEach(function(slice) {
- ue.associatedEvents.push(slice);
- });
- model.userModel.expectations.push(ue);
- }
- };
- var model = tr.c.TestUtils.newModelWithEvents([], opts);
- return model;
- }
-
- function constructName(name, suffix) {
- return 'Animation-' + name + '_' + suffix;
- }
-
- function run(slices) {
- var values = new tr.v.ValueSet();
- var startTime = slices.reduce((acc, slice) => (Math.min(acc, slice.start)));
- var endTime = slices.reduce((acc, slice) => (Math.max(acc, slice.end)));
- var model = createModel(startTime - 1, endTime + 1, slices);
- tr.metrics.v8.gcMetric(values, model);
- var result = {};
- values.valueDicts.forEach(function(value) {
- result[value.name] = value.numeric.value;
- });
- return result;
- }
-
- test('topEvents', function() {
- var events = {
- 'V8.GCCompactor': 'v8-gc-full-mark-compactor',
- 'V8.GCFinalizeMC': 'v8-gc-latency-mark-compactor',
- 'V8.GCFinalizeMCReduceMemory': 'v8-gc-memory-mark-compactor',
- 'V8.GCIncrementalMarking': 'v8-gc-incremental-step',
- 'V8.GCIncrementalMarkingFinalize': 'v8-gc-incremental-finalize',
- 'V8.GCIncrementalMarkingStart': 'v8-gc-incremental-start',
- 'V8.GCPhantomHandleProcessingCallback' : 'v8-gc-phantom-handle-callback',
- 'V8.GCScavenger': 'v8-gc-scavenger'
- };
- tr.b.iterItems(events, function(timelineName, telemetryName) {
- var slices = [
- {
- title: timelineName, args: {}, start: 100, end: 200,
- cpuStart: 100, cpuEnd: 200
- }
- ];
- var actual = run(slices);
- var expected = {
- sum: 100,
- count: 1,
- avg: 100,
- max: 100,
- idle_deadline_overrun_sum: 0,
- idle_deadline_overrun_avg: 0,
- idle_deadline_overrun_max: 0,
- outside_idle_sum: 100,
- outside_idle_avg: 100,
- outside_idle_max: 100,
- percentage_idle: 0
- };
- tr.b.iterItems(expected, function(key, value) {
- var name = constructName(telemetryName, key);
- assert.equal(name + ':' + actual[name], name + ':' + value);
- });
- assert.closeTo(actual[constructName(telemetryName, 'pct_090')], 100, 1);
- });
- });
-
- test('idleTimes', function() {
- var values = new tr.v.ValueSet();
- var slices = [
- {
- title: 'SingleThreadIdleTaskRunner::RunTask',
- args: {'allotted_time_ms' : 100}, start: 100, end: 200,
- cpuStart: 100, cpuEnd: 200
- },
- {
- title: 'V8.GCFinalizeMC', args: {}, start: 110, end: 190,
- cpuStart: 110, cpuEnd: 190
- }
- ];
- var actual = run(slices);
- var expected = {
- sum: 80,
- count: 1,
- avg: 80,
- max: 80,
- idle_deadline_overrun_sum: 0,
- idle_deadline_overrun_avg: 0,
- idle_deadline_overrun_max: 0,
- outside_idle_sum: 0,
- outside_idle_avg: 0,
- outside_idle_max: 0,
- percentage_idle: 100
- };
- tr.b.iterItems(expected, function(key, value) {
- var name = constructName('v8-gc-latency-mark-compactor', key);
- assert.equal(name + ':' + actual[name], name + ':' + value);
- });
- });
-
- test('idleTimeOverrun', function() {
- var values = new tr.v.ValueSet();
- var slices = [
- {
- title: 'SingleThreadIdleTaskRunner::RunTask',
- args: {'allotted_time_ms' : 10}, start: 100, end: 200,
- cpuStart: 100, cpuEnd: 200
- },
- {
- title: 'V8.GCFinalizeMC', args: {}, start: 110, end: 190,
- cpuStart: 110, cpuEnd: 190
- }
- ];
- var actual = run(slices);
- var expected = {
- sum: 80,
- count: 1,
- avg: 80,
- max: 80,
- idle_deadline_overrun_sum: 70,
- idle_deadline_overrun_avg: 70,
- idle_deadline_overrun_max: 70,
- outside_idle_sum: 70,
- outside_idle_avg: 70,
- outside_idle_max: 70,
- percentage_idle: 100 / 8
- };
- tr.b.iterItems(expected, function(key, value) {
- var name = constructName('v8-gc-latency-mark-compactor', key);
- assert.equal(name + ':' + actual[name], name + ':' + value);
- });
- });
-
- test('subEvents', function() {
- var values = new tr.v.ValueSet();
- var slices = [
- {
- title: 'V8.GCFinalizeMC', args: {}, start: 100, end: 200,
- cpuStart: 100, cpuEnd: 200
- },
- {
- title: 'V8.GC_MC_MARK', args: {}, start: 110, end: 190,
- cpuStart: 110, cpuEnd: 190
- },
- ];
- var actual = run(slices);
- var expected = {
- avg: 80,
- max: 80,
- };
- var telemetryName = 'v8-gc-latency-mark-compactor-mark';
- tr.b.iterItems(expected, function(key, value) {
- var name = constructName(telemetryName, key);
- assert.equal(name + ':' + actual[name], name + ':' + value);
- });
- assert.closeTo(actual[constructName(telemetryName, 'pct_090')], 80, 1);
- });
-
- test('total', function() {
- var values = new tr.v.ValueSet();
- var slices = [
- {
- title: 'V8.GCFinalizeMC', args: {}, start: 100, end: 200,
- cpuStart: 100, cpuEnd: 200
- },
- {
- title: 'V8.GCIncrementalMarking', args: {}, start: 210, end: 290,
- cpuStart: 210, cpuEnd: 290
- }
- ];
- var actual = run(slices);
- var expected = {
- sum: 180,
- count: 2,
- avg: 90,
- max: 100,
- idle_deadline_overrun_sum: 0,
- idle_deadline_overrun_avg: 0,
- idle_deadline_overrun_max: 0,
- outside_idle_sum: 180,
- outside_idle_avg: 90,
- outside_idle_max: 100,
- percentage_idle: 0
- };
- tr.b.iterItems(expected, function(key, value) {
- var name = constructName('v8-gc-total', key);
- assert.equal(name + ':' + actual[name], name + ':' + value);
- });
- });
-
- test('mutatorUtilization', function() {
- var values = new tr.v.ValueSet();
- var slices = [
- {
- title: 'V8.Execute', args: {}, start: 100, end: 200,
- cpuStart: 100, cpuEnd: 200
- },
- {
- title: 'V8.GCFinalizeMC', args: {}, start: 150, end: 160,
- cpuStart: 150, cpuEnd: 160
- },
- {
- title: 'V8.Execute', args: {}, start: 1000, end: 1200,
- cpuStart: 1000, cpuEnd: 1200
- },
- {
- title: 'V8.GCIncrementalMarking', args: {}, start: 1010, end: 1020,
- cpuStart: 1010, cpuEnd: 1020
- }
- ];
- var mutatorUtilization = tr.metrics.v8.utils.mutatorUtilization(
- 0, 300, tr.metrics.v8.WINDOW_SIZE_MS,
- [{start: 50, end: 60}, {start: 110, end: 120}]);
- var actual = run(slices);
- assert.strictEqual(
- actual['Animation-v8-execute-mutator-utilization_pct_095'],
- mutatorUtilization.percentile(1 - 0.95) * 100);
- assert.strictEqual(
- actual['Animation-v8-execute-mutator-utilization_pct_099'],
- mutatorUtilization.percentile(1 - 0.99) * 100);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/v8/utils.html b/chromium/third_party/catapult/tracing/tracing/metrics/v8/utils.html
deleted file mode 100644
index 1d561d0811f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/v8/utils.html
+++ /dev/null
@@ -1,256 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/piecewise_linear_function.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/base/range_utils.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.v8.utils', function() {
- // The title of the idle task event.
- var IDLE_TASK_EVENT = 'SingleThreadIdleTaskRunner::RunTask';
-
- // V8 execution event.
- var V8_EXECUTE = 'V8.Execute';
-
- // GC events start with this prefix.
- var GC_EVENT_PREFIX = 'V8.GC';
-
- // Special handling is required for full GCs inside low memory notification.
- var FULL_GC_EVENT = 'V8.GCCompactor';
-
- var LOW_MEMORY_EVENT = 'V8.GCLowMemoryNotification';
-
- // Maps the top-level GC events in timeline to telemetry friendly names.
- var TOP_GC_EVENTS = {
- 'V8.GCCompactor': 'v8-gc-full-mark-compactor',
- 'V8.GCFinalizeMC': 'v8-gc-latency-mark-compactor',
- 'V8.GCFinalizeMCReduceMemory': 'v8-gc-memory-mark-compactor',
- 'V8.GCIncrementalMarking': 'v8-gc-incremental-step',
- 'V8.GCIncrementalMarkingFinalize': 'v8-gc-incremental-finalize',
- 'V8.GCIncrementalMarkingStart': 'v8-gc-incremental-start',
- 'V8.GCLowMemoryNotification': 'v8-gc-low-memory-mark-compactor',
- 'V8.GCPhantomHandleProcessingCallback' : 'v8-gc-phantom-handle-callback',
- 'V8.GCScavenger': 'v8-gc-scavenger'
- };
-
- /**
- * Finds the first parent of the |event| for which the |predicate| holds.
- */
- function findParent(event, predicate) {
- var parent = event.parentSlice;
- while (parent) {
- if (predicate(parent)) {
- return parent;
- }
- parent = parent.parentSlice;
- }
- return null;
- }
-
- function isIdleTask(event) {
- return event.title === IDLE_TASK_EVENT;
- }
-
- function isLowMemoryEvent(event) {
- return event.title === LOW_MEMORY_EVENT;
- }
-
- function isV8ExecuteEvent(event) {
- return event.title === V8_EXECUTE;
- }
-
- function isTopV8ExecuteEvent(event) {
- return isV8ExecuteEvent(event) && findParent(isV8ExecuteEvent) === null;
- }
-
- function isGarbageCollectionEvent(event) {
- // Low memory notification is handled specially because it contains
- // several full mark compact events.
- return event.title && event.title.startsWith(GC_EVENT_PREFIX) &&
- event.title != LOW_MEMORY_EVENT;
- }
-
- function isTopGarbageCollectionEvent(event) {
- return event.title in TOP_GC_EVENTS;
- }
-
- function isSubGarbageCollectionEvent(event) {
- return isGarbageCollectionEvent(event) &&
- !isTopGarbageCollectionEvent(event);
- }
-
- function topGarbageCollectionEventName(event) {
- if (event.title === FULL_GC_EVENT) {
- // Full mark compact events inside a low memory notification
- // are counted as low memory mark compacts.
- if (findParent(event, isLowMemoryEvent)) {
- return TOP_GC_EVENTS[LOW_MEMORY_EVENT];
- }
- }
- return TOP_GC_EVENTS[event.title];
- }
-
- function subGarbageCollectionEventName(event) {
- var topEvent = findParent(event, isTopGarbageCollectionEvent);
- var prefix = topEvent ? topGarbageCollectionEventName(topEvent) : 'unknown';
- // Remove redundant prefixes and convert to lower case.
- var name = event.title.replace('V8.GC_MC_', '')
- .replace('V8.GC_SCAVENGER_', '')
- .replace('V8.GC_', '')
- .replace(/_/g, '-').toLowerCase();
- return prefix + '-' + name;
- }
-
- /**
- * Given a list of intervals, returns a new list with all overalapping
- * intervals merged into a single interval.
- */
- function unionOfIntervals(intervals) {
- if (intervals.length === 0)
- return [];
- return tr.b.mergeRanges(
- intervals.map(x => ({min: x.start, max: x.end})), 1e-6,
- function(ranges) {
- return {
- start: ranges.reduce((acc, x) => Math.min(acc, x.min), ranges[0].min),
- end: ranges.reduce((acc, x) => Math.max(acc, x.max), ranges[0].max)
- };
- }
- );
- }
-
- /**
- * An end-point of a window that is sliding from left to right
- * over |points| starting from time |start|.
- * It is intended to be used only by the |mutatorUtilization| function.
- * @constructor
- */
- function WindowEndpoint(start, points) {
- this.points = points;
- // The index of the last passed point.
- this.lastIndex = -1;
- // The position of the end-point in the time line.
- this.position = start;
- // The distance until the next point.
- this.distanceUntilNextPoint = points[0].position - start;
- // The cumulative duration of GC pauses until this position.
- this.cummulativePause = 0;
- // The number of entered GC intervals.
- this.stackDepth = 0;
- }
-
- WindowEndpoint.prototype = {
- // Advance the end-point by the given |delta|.
- advance: function(delta) {
- var points = this.points;
- if (delta < this.distanceUntilNextPoint) {
- this.position += delta;
- this.cummulativePause += this.stackDepth > 0 ? delta : 0;
- this.distanceUntilNextPoint =
- points[this.lastIndex + 1].position - this.position;
- } else {
- this.position += this.distanceUntilNextPoint;
- this.cummulativePause +=
- this.stackDepth > 0 ? this.distanceUntilNextPoint : 0;
- this.distanceUntilNextPoint = 0;
- this.lastIndex++;
- if (this.lastIndex < points.length) {
- this.stackDepth += points[this.lastIndex].delta;
- if (this.lastIndex + 1 < points.length)
- this.distanceUntilNextPoint =
- points[this.lastIndex + 1].position - this.position;
- }
- }
- }
- };
-
- /**
- * Returns mutator utilization as a piecewise linear function.
- * Mutator utilization for a window size w is a function of time mu_w(t)
- * that shows how much time in [t, t+w] is left for the mutator relative
- * to the time window size.
- * More formally:
- * mu_w(t) = (w - total_time_spent_in_gc_in(t, t + w)) / w.
- * The range of mu_w(t) is [0..1].
- * See "A Parallel, Real-Time Garbage Collector" by Cheng et. al. for
- * more info [https://www.cs.cmu.edu/~guyb/papers/gc2001.pdf].
- *
- * All parameters must use the same time unit.
- * @param {number} start The start time of execution.
- * @param {number} end The end time of execution.
- * @param {number} timeWindow The size of the time window.
- * @param {!Array<!{start: number, end: number}>} intervals The list of
- * GC pauses.
- */
- function mutatorUtilization(start, end, timeWindow, intervals) {
- var mu = new tr.b.PiecewiseLinearFunction();
- // If the interval is smaller than the time window, then the function is
- // empty.
- if (end - start <= timeWindow)
- return mu;
- // If there are GC pauses then the mutator utilization is 1.0.
- if (intervals.length === 0) {
- mu.push(start, 1.0, end - timeWindow, 1.0);
- return mu;
- }
- intervals = unionOfIntervals(intervals);
- // Create a point for the start and the end of each interval.
- var points = [];
- intervals.forEach(function(interval) {
- points.push({position: interval.start, delta: 1});
- points.push({position: interval.end, delta: -1});
- });
- points.sort((a, b) => a.position - b.position);
- points.push({position: end, delta: 0});
- // The left and the right limit of the sliding window.
- var left = new WindowEndpoint(start, points);
- var right = new WindowEndpoint(start, points);
- // Advance the right end-point until we get the correct window size.
- while (right.position - left.position < timeWindow)
- right.advance(timeWindow - (right.position - left.position));
- while (right.lastIndex < points.length) {
- // Advance the window end-points by the largest possible amount
- // without jumping over a point.
- var distanceUntilNextPoint =
- Math.min(left.distanceUntilNextPoint, right.distanceUntilNextPoint);
- var position1 = left.position;
- var value1 = right.cummulativePause - left.cummulativePause;
- left.advance(distanceUntilNextPoint);
- right.advance(distanceUntilNextPoint);
- // Add a new mutator utilization segment only if it is non-trivial.
- if (distanceUntilNextPoint > 0) {
- var position2 = left.position;
- var value2 = right.cummulativePause - left.cummulativePause;
- mu.push(position1, 1.0 - value1 / timeWindow,
- position2, 1.0 - value2 / timeWindow);
- }
- }
- return mu;
- }
-
- return {
- findParent: findParent,
- isIdleTask: isIdleTask,
- isLowMemoryEvent: isLowMemoryEvent,
- isV8ExecuteEvent: isV8ExecuteEvent,
- isTopV8ExecuteEvent: isTopV8ExecuteEvent,
- isGarbageCollectionEvent: isGarbageCollectionEvent,
- isTopGarbageCollectionEvent: isTopGarbageCollectionEvent,
- isSubGarbageCollectionEvent: isSubGarbageCollectionEvent,
- topGarbageCollectionEventName: topGarbageCollectionEventName,
- subGarbageCollectionEventName: subGarbageCollectionEventName,
- unionOfIntervals: unionOfIntervals,
- mutatorUtilization: mutatorUtilization
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/v8/utils_test.html b/chromium/third_party/catapult/tracing/tracing/metrics/v8/utils_test.html
deleted file mode 100644
index d5068a16c52..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/v8/utils_test.html
+++ /dev/null
@@ -1,145 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/metrics/v8/utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- var unionOfIntervals = tr.metrics.v8.utils.unionOfIntervals;
-
- function interval(start, end) {
- return {start: start, end: end};
- }
-
- /**
- * Brute force computation of the mutator utilization.
- * The function steps from the start to the end and for each step
- * computes the mutator utilization.
- */
- function mutatorUtilizationSlow(start, end, timeWindow, intervals) {
- var STEP = 0.001;
- function timeToIndex(time) {
- return Math.floor((time - start) / STEP);
- };
- var N = timeToIndex(end) + 1;
- // bitmap[i] === true means that GC is active at time i.
- var bitmap = new Array(N);
- for (var i = 0; i < N; i++)
- bitmap[i] = false;
- intervals.forEach(function(interval) {
- var start = timeToIndex(interval.start);
- var end = timeToIndex(interval.end);
- for (var i = start; i < end; i++)
- bitmap[i] = true;
- });
- var pause = new Array(N);
- for (var i = 0; i < N; i++)
- pause[i] = (i > 0 ? pause[i - 1] : 0) + (bitmap[i] ? 1 : 0);
- var windowWidth = timeToIndex(timeWindow);
- var mu = new Array(Math.max(N - windowWidth, 0));
- for (var i = 0; i < mu.length; i++) {
- var value = pause[i + windowWidth] - pause[i];
- mu[i] = 1.0 - value / windowWidth;
- }
- mu.sort((a, b) => a - b);
- return {
- average: mu.reduce((acc, x) => (acc + x), 0) / mu.length,
- min: mu.reduce((acc, x) => Math.min(acc, x), 0),
- max: mu.reduce((acc, x) => Math.max(acc, x), 0),
- percentile: function(percent) {
- return mu[Math.floor(percent * (mu.length - 1))];
- }
- };
- }
-
- /**
- * Constructs PiecewiseLinearFunction from pieces.
- * @param {!Array<!{x1: number, y1: number, x2: number, y2: number}>} pieces
- * The list of pieces ordered by the x coordinate.
- */
- function createExpectedFunction(pieces) {
- var f = new tr.b.PiecewiseLinearFunction();
- pieces.forEach(function(p) {
- f.push(p.x1, p.y1, p.x2, p.y2);
- });
- return f;
- }
-
- test('unionOfIntervals', function() {
- var list, union;
- assert.deepEqual(unionOfIntervals([]), []);
- assert.deepEqual(unionOfIntervals([interval(1, 1)]), [interval(1, 1)]);
- assert.deepEqual(
- unionOfIntervals([interval(0, 1), interval(1, 2), interval(2, 3)]),
- [interval(0, 3)]);
- assert.deepEqual(
- unionOfIntervals([interval(0, 1), interval(1, 2), interval(3, 3)]),
- [interval(0, 2), interval(3, 3)]);
- assert.deepEqual(
- unionOfIntervals([interval(0, 10), interval(1, 2), interval(3, 3)]),
- [interval(0, 10)]);
- assert.deepEqual(
- unionOfIntervals([interval(0, 10), interval(1, 2), interval(3, 11)]),
- [interval(0, 11)]);
- assert.deepEqual(
- unionOfIntervals([interval(3, 10), interval(1, 2), interval(11, 11)]),
- [interval(1, 2), interval(3, 10), interval(11, 11)]);
- });
-
- test('basicMutatorUtilization', function() {
- assert.deepEqual(
- tr.metrics.v8.utils.mutatorUtilization(0, 40, 10, [interval(10, 20)]),
- createExpectedFunction([
- { x1: 0, y1: 1.0, x2: 10, y2: 0.0 },
- { x1: 10, y1: 0.0, x2: 20, y2: 1.0 },
- { x1: 20, y1: 1.0, x2: 30, y2: 1.0 }])
- );
- assert.deepEqual(
- tr.metrics.v8.utils.mutatorUtilization(0, 40, 10, [interval(10, 15)]),
- createExpectedFunction([
- { x1: 0, y1: 1.0, x2: 5, y2: 0.5 },
- { x1: 5, y1: 0.5, x2: 10, y2: 0.5 },
- { x1: 10, y1: 0.5, x2: 15, y2: 1.0 },
- { x1: 15, y1: 1.0, x2: 30, y2: 1.0 }])
- );
- assert.deepEqual(
- tr.metrics.v8.utils.mutatorUtilization(0, 60, 20,
- [interval(30, 35), interval(40, 45)]),
- createExpectedFunction([
- { x1: 0, y1: 1.0, x2: 10, y2: 1.0 },
- { x1: 10, y1: 1.0, x2: 15, y2: 0.75 },
- { x1: 15, y1: 0.75, x2: 20, y2: 0.75 },
- { x1: 20, y1: 0.75, x2: 25, y2: 0.5 },
- { x1: 25, y1: 0.5, x2: 30, y2: 0.5 },
- { x1: 30, y1: 0.5, x2: 35, y2: 0.75 },
- { x1: 35, y1: 0.75, x2: 40, y2: 0.75 }])
- );
- });
-
- test('mutatorUtilization', function() {
- var pauses, actual, expected;
- pauses = [interval(10, 20),
- interval(15, 23),
- interval(30, 31),
- interval(33, 34),
- interval(60, 61),
- interval(61, 63),
- interval(80, 88)];
- actual = tr.metrics.v8.utils.mutatorUtilization(0, 100, 7, pauses);
- expected = mutatorUtilizationSlow(0, 100, 7, pauses);
- assert.closeTo(expected.average, actual.average, 1e-3);
- assert.closeTo(expected.max, actual.max, 1e-3);
- assert.closeTo(expected.min, actual.min, 1e-3);
- assert.closeTo(expected.percentile(0.5), actual.percentile(0.5), 1e-3);
- assert.closeTo(expected.percentile(0.9), actual.percentile(0.9), 1e-3);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/metrics/v8/v8_metrics.html b/chromium/third_party/catapult/tracing/tracing/metrics/v8/v8_metrics.html
deleted file mode 100644
index 1fa69344494..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/metrics/v8/v8_metrics.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/metrics/system_health/memory_metric.html">
-<link rel="import" href="/tracing/metrics/v8/execution_metric.html">
-<link rel="import" href="/tracing/metrics/v8/gc_metric.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.metrics.v8', function() {
- function v8AndMemoryMetrics(values, model) {
- tr.metrics.v8.executionMetric(values, model);
- tr.metrics.v8.gcMetric(values, model);
- tr.metrics.sh.memoryMetric(values, model);
- }
-
- tr.metrics.MetricRegistry.register(v8AndMemoryMetrics);
-
- return {
- v8AndMemoryMetrics: v8AndMemoryMetrics
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/activity.html b/chromium/third_party/catapult/tracing/tracing/model/activity.html
deleted file mode 100644
index c86edab2ea1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/activity.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/color_scheme.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Class representing a user activity that is running
- * in the process.
- * On the Android platform, activities are mapped to Android Activities
- * running in the foreground of the process.
- * On Windows/OS X this could for example represent
- * the currently active window of the process.
- */
-tr.exportTo('tr.model', function() {
- var ColorScheme = tr.b.ColorScheme;
-
- /**
- * @constructor
- * @param {String} name Name of the activity
- * @param {String} category Category of the activities
- * @param {String} range The time range where the activity was running
- * @param {String} args Additional arguments
- */
- function Activity(name, category, range, args) {
- tr.model.TimedEvent.call(this, range.min);
- this.title = name;
- this.category = category;
- this.colorId = ColorScheme.getColorIdForGeneralPurposeString(name);
- this.duration = range.duration;
- this.args = args;
- this.name = name;
- };
-
- Activity.prototype = {
- __proto__: tr.model.TimedEvent.prototype,
-
- shiftTimestampsForward: function(amount) {
- this.start += amount;
- },
-
- addBoundsToRange: function(range) {
- range.addValue(this.start);
- range.addValue(this.end);
- }
- };
- return {
- Activity: Activity
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/alert.html b/chromium/third_party/catapult/tracing/tracing/model/alert.html
deleted file mode 100644
index 53a2fa74217..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/alert.html
+++ /dev/null
@@ -1,58 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_info.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/timed_event.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
-
- function Alert(info, start, opt_associatedEvents, opt_args) {
- tr.model.TimedEvent.call(this, start);
- this.info = info;
- this.args = opt_args || {};
- this.associatedEvents = new tr.model.EventSet(opt_associatedEvents);
- this.associatedEvents.forEach(function(event) {
- event.addAssociatedAlert(this);
- }, this);
- }
-
- Alert.prototype = {
- __proto__: tr.model.TimedEvent.prototype,
-
- get title() {
- return this.info.title;
- },
-
- get colorId() {
- return this.info.colorId;
- },
-
- get userFriendlyName() {
- return 'Alert ' + this.title + ' at ' +
- tr.v.Unit.byName.timeStampInMs.format(this.start);
- }
- };
-
- tr.model.EventRegistry.register(
- Alert,
- {
- name: 'alert',
- pluralName: 'alerts',
- singleViewElementName: 'tr-ui-a-alert-sub-view',
- multiViewElementName: 'tr-ui-a-alert-sub-view'
- });
-
- return {
- Alert: Alert
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/annotation.html b/chromium/third_party/catapult/tracing/tracing/model/annotation.html
deleted file mode 100644
index cea718342cb..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/annotation.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/extension_registry.html">
-<link rel="import" href="/tracing/base/guid.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
- /**
- * Annotation is a base class that represents all annotation objects that
- * can be drawn on the timeline.
- *
- * @constructor
- */
- function Annotation() {
- this.guid_ = tr.b.GUID.allocateSimple();
- this.view_ = undefined;
- };
-
- Annotation.fromDictIfPossible = function(args) {
- if (args.typeName === undefined)
- throw new Error('Missing typeName argument');
-
- var typeInfo = Annotation.findTypeInfoMatching(function(typeInfo) {
- return typeInfo.metadata.typeName === args.typeName;
- });
-
- if (typeInfo === undefined)
- return undefined;
-
- return typeInfo.constructor.fromDict(args);
- };
-
- Annotation.fromDict = function() {
- throw new Error('Not implemented');
- };
-
- Annotation.prototype = {
- get guid() {
- return this.guid_;
- },
-
- // Invoked by trace model when this annotation is removed.
- onRemove: function() {
- },
-
- toDict: function() {
- throw new Error('Not implemented');
- },
-
- getOrCreateView: function(viewport) {
- if (!this.view_)
- this.view_ = this.createView_(viewport);
- return this.view_;
- },
-
- createView_: function() {
- throw new Error('Not implemented');
- }
- };
-
- var options = new tr.b.ExtensionRegistryOptions(tr.b. BASIC_REGISTRY_MODE);
- tr.b.decorateExtensionRegistry(Annotation, options);
-
- Annotation.addEventListener('will-register', function(e) {
- if (!e.typeInfo.constructor.hasOwnProperty('fromDict'))
- throw new Error('Must have fromDict method');
-
- if (!e.typeInfo.metadata.typeName)
- throw new Error('Registered Annotations must provide typeName');
- });
-
- return {
- Annotation: Annotation
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/annotation_test.html b/chromium/third_party/catapult/tracing/tracing/model/annotation_test.html
deleted file mode 100644
index a5b6c3e6fea..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/annotation_test.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/location.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/comment_box_annotation.html">
-<link rel="import" href="/tracing/model/rect_annotation.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/x_marker_annotation.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- test('rectAnnotation', function() {
- var fakeYComponents1 = [{stableId: '1.2', yPercentOffset: 0.3}];
- var fakeYComponents2 = [{stableId: '1.2', yPercentOffset: 0.9}];
- var start = new tr.model.Location(50, fakeYComponents1);
- var end = new tr.model.Location(100, fakeYComponents2);
- var rectAnnotation = new tr.model.RectAnnotation(start, end);
- assert.equal(rectAnnotation.startLocation, start);
- assert.equal(rectAnnotation.endLocation, end);
- });
-
- test('xMarkerAnnotation', function() {
- var xMarkerAnnotation = new tr.model.XMarkerAnnotation(90);
- assert.equal(xMarkerAnnotation.timestamp, 90);
- });
-
- test('commentBoxAnnotation', function() {
- var fakeYComponents = [{stableId: '1.2', yPercentOffset: 0.5}];
- var location = new tr.model.Location(120, fakeYComponents);
- var text = 'abc';
- var commentBoxAnnotation =
- new tr.model.CommentBoxAnnotation(location, text);
- assert.equal(commentBoxAnnotation.location, location);
- assert.equal(commentBoxAnnotation.text, text);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/async_slice.html b/chromium/third_party/catapult/tracing/tracing/model/async_slice.html
deleted file mode 100644
index 325ef09d0a8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/async_slice.html
+++ /dev/null
@@ -1,160 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/extension_registry.html">
-<link rel="import" href="/tracing/model/timed_event.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the AsyncSlice class.
- */
-tr.exportTo('tr.model', function() {
- /**
- * A AsyncSlice represents an interval of time during which an
- * asynchronous operation is in progress. An AsyncSlice consumes no CPU time
- * itself and so is only associated with Threads at its start and end point.
- *
- * @constructor
- */
- function AsyncSlice(category, title, colorId, start, args, duration,
- opt_isTopLevel, opt_cpuStart, opt_cpuDuration,
- opt_argsStripped) {
- tr.model.TimedEvent.call(this, start);
-
- this.category = category || '';
- // We keep the original title from the trace file in originalTitle since
- // some sub-classes, e.g. NetAsyncSlice, change the title field.
- this.originalTitle = title;
- this.title = title;
- this.colorId = colorId;
- this.args = args;
- this.startStackFrame = undefined;
- this.endStackFrame = undefined;
- this.didNotFinish = false;
- this.important = false;
- this.subSlices = [];
- this.parentContainer_ = undefined;
-
- this.id = undefined;
- this.startThread = undefined;
- this.endThread = undefined;
- this.cpuStart = undefined;
- this.cpuDuration = undefined;
- this.argsStripped = false;
-
- this.startStackFrame = undefined;
- this.endStackFrame = undefined;
-
- this.duration = duration;
-
- // isTopLevel is set at import because only NESTABLE_ASYNC events might not
- // be topLevel. All legacy async events are toplevel by definition.
- this.isTopLevel = (opt_isTopLevel === true);
-
- if (opt_cpuStart !== undefined)
- this.cpuStart = opt_cpuStart;
-
- if (opt_cpuDuration !== undefined)
- this.cpuDuration = opt_cpuDuration;
-
- if (opt_argsStripped !== undefined)
- this.argsStripped = opt_argsStripped;
- };
-
- AsyncSlice.prototype = {
- __proto__: tr.model.TimedEvent.prototype,
-
- get analysisTypeName() {
- return this.title;
- },
-
- get parentContainer() {
- return this.parentContainer_;
- },
-
- set parentContainer(parentContainer) {
- this.parentContainer_ = parentContainer;
- for (var i = 0; i < this.subSlices.length; i++) {
- var subSlice = this.subSlices[i];
- if (subSlice.parentContainer === undefined)
- subSlice.parentContainer = parentContainer;
- }
- },
-
- get viewSubGroupTitle() {
- return this.title;
- },
-
- get userFriendlyName() {
- return 'Async slice ' + this.title + ' at ' +
- tr.v.Unit.byName.timeStampInMs.format(this.start);
- },
-
- get stableId() {
- var parentAsyncSliceGroup = this.parentContainer.asyncSliceGroup;
- return parentAsyncSliceGroup.stableId + '.' +
- parentAsyncSliceGroup.slices.indexOf(this);
- },
-
- findTopmostSlicesRelativeToThisSlice: function*(eventPredicate, opt_this) {
- if (eventPredicate(this)) {
- yield this;
- return;
- }
- for (var s of this.subSlices)
- yield * s.findTopmostSlicesRelativeToThisSlice(eventPredicate);
- },
-
- findDescendentSlice: function(targetTitle) {
- if (!this.subSlices)
- return undefined;
-
- for (var i = 0; i < this.subSlices.length; i++) {
- if (this.subSlices[i].title == targetTitle)
- return this.subSlices[i];
- var slice = this.subSlices[i].findDescendentSlice(targetTitle);
- if (slice) return slice;
- }
- return undefined;
- },
-
- iterateAllDescendents: function(callback, opt_this) {
- this.subSlices.forEach(callback, opt_this);
- this.subSlices.forEach(function(subSlice) {
- subSlice.iterateAllDescendents(callback, opt_this);
- }, opt_this);
- },
-
- compareTo: function(that) {
- return this.title.localeCompare(that.title);
- }
- };
-
- tr.model.EventRegistry.register(
- AsyncSlice,
- {
- name: 'asyncSlice',
- pluralName: 'asyncSlices',
- singleViewElementName: 'tr-ui-a-single-async-slice-sub-view',
- multiViewElementName: 'tr-ui-a-multi-async-slice-sub-view'
- });
-
-
- var options = new tr.b.ExtensionRegistryOptions(
- tr.b.TYPE_BASED_REGISTRY_MODE);
- options.mandatoryBaseClass = AsyncSlice;
- options.defaultConstructor = AsyncSlice;
- tr.b.decorateExtensionRegistry(AsyncSlice, options);
-
- return {
- AsyncSlice: AsyncSlice
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/async_slice_group.html b/chromium/third_party/catapult/tracing/tracing/model/async_slice_group.html
deleted file mode 100644
index 926864103c0..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/async_slice_group.html
+++ /dev/null
@@ -1,166 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/model/async_slice.html">
-<link rel="import" href="/tracing/model/event_container.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the AsyncSliceGroup class.
- */
-tr.exportTo('tr.model', function() {
- /**
- * A group of AsyncSlices associated with a thread.
- * @constructor
- * @extends {tr.model.EventContainer}
- */
- function AsyncSliceGroup(parentContainer, opt_name) {
- tr.model.EventContainer.call(this);
- this.parentContainer_ = parentContainer;
- this.slices = [];
- this.name_ = opt_name;
- this.viewSubGroups_ = undefined;
- }
-
- AsyncSliceGroup.prototype = {
- __proto__: tr.model.EventContainer.prototype,
-
- get parentContainer() {
- return this.parentContainer_;
- },
-
- get model() {
- return this.parentContainer_.parent.model;
- },
-
- get stableId() {
- return this.parentContainer_.stableId + '.AsyncSliceGroup';
- },
-
- getSettingsKey: function() {
- if (!this.name_)
- return undefined;
- var parentKey = this.parentContainer_.getSettingsKey();
- if (!parentKey)
- return undefined;
- return parentKey + '.' + this.name_;
- },
-
- /**
- * Helper function that pushes the provided slice onto the slices array.
- */
- push: function(slice) {
- slice.parentContainer = this.parentContainer;
- this.slices.push(slice);
- return slice;
- },
-
- /**
- * @return {Number} The number of slices in this group.
- */
- get length() {
- return this.slices.length;
- },
-
- /**
- * Shifts all the timestamps inside this group forward by the amount
- * specified, including all nested subSlices if there are any.
- */
- shiftTimestampsForward: function(amount) {
- for (var sI = 0; sI < this.slices.length; sI++) {
- var slice = this.slices[sI];
- slice.start = (slice.start + amount);
- // Shift all nested subSlices recursively.
- var shiftSubSlices = function(subSlices) {
- if (subSlices === undefined || subSlices.length === 0)
- return;
- for (var sJ = 0; sJ < subSlices.length; sJ++) {
- subSlices[sJ].start += amount;
- shiftSubSlices(subSlices[sJ].subSlices);
- }
- };
- shiftSubSlices(slice.subSlices);
- }
- },
-
- /**
- * Updates the bounds for this group based on the slices it contains.
- */
- updateBounds: function() {
- this.bounds.reset();
- for (var i = 0; i < this.slices.length; i++) {
- this.bounds.addValue(this.slices[i].start);
- this.bounds.addValue(this.slices[i].end);
- }
- },
-
- /**
- * Gets the sub-groups in this A-S-G defined by the group titles.
- *
- * @return {Array} An array of AsyncSliceGroups where each group has
- * slices that started on the same thread.
- */
- get viewSubGroups() {
- if (this.viewSubGroups_ === undefined) {
- var prefix = '';
- if (this.name !== undefined)
- prefix = this.name + '.';
- else
- prefix = '';
-
- var subGroupsByTitle = {};
- for (var i = 0; i < this.slices.length; ++i) {
- var slice = this.slices[i];
- var subGroupTitle = slice.viewSubGroupTitle;
- if (!subGroupsByTitle[subGroupTitle]) {
- subGroupsByTitle[subGroupTitle] = new AsyncSliceGroup(
- this.parentContainer_, prefix + subGroupTitle);
- }
- subGroupsByTitle[subGroupTitle].push(slice);
- }
- this.viewSubGroups_ = tr.b.dictionaryValues(subGroupsByTitle);
- this.viewSubGroups_.sort(function(a, b) {
- return a.slices[0].compareTo(b.slices[0]);
- });
- }
- return this.viewSubGroups_;
- },
-
- findTopmostSlicesInThisContainer: function*(eventPredicate, opt_this) {
- for (var slice of this.slices) {
- if (slice.isTopLevel) {
- yield * slice.findTopmostSlicesRelativeToThisSlice(
- eventPredicate, opt_this);
- }
- }
- },
-
- childEvents: function*() {
- // Async slices normally don't have sub-slices, and when they do,
- // the sub-slice is specific to the type of async slice. Thus,
- // it is not expected for sub-slices to themselves have sub-sub-slices,
- // which is why we don't recurse into the sub-slices here.
- for (var slice of this.slices) {
- yield slice;
- if (slice.subSlices)
- yield * slice.subSlices;
- }
- },
-
- childEventContainers: function*() {
- }
- };
-
- return {
- AsyncSliceGroup: AsyncSliceGroup
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/async_slice_group_test.html b/chromium/third_party/catapult/tracing/tracing/model/async_slice_group_test.html
deleted file mode 100644
index 7306ca8a1bc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/async_slice_group_test.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Process = tr.model.Process;
- var Thread = tr.model.Thread;
- var AsyncSlice = tr.model.AsyncSlice;
- var AsyncSliceGroup = tr.model.AsyncSliceGroup;
- var newAsyncSlice = tr.c.TestUtils.newAsyncSlice;
- var newAsyncSliceEx = tr.c.TestUtils.newAsyncSliceEx;
- var newModel = tr.c.TestUtils.newModel;
-
- test('asyncSliceGroupBounds_Empty', function() {
- var thread = {};
- var g = new AsyncSliceGroup(thread);
- g.updateBounds();
- assert.isTrue(g.bounds.isEmpty);
- });
-
- test('asyncSliceGroupBounds_Basic', function() {
- var model = new tr.Model();
- var p1 = new Process(model, 1);
- var t1 = new Thread(p1, 1);
- var g = new AsyncSliceGroup(t1);
- g.push(newAsyncSlice(0, 1, t1, t1));
- g.push(newAsyncSlice(1, 1.5, t1, t1));
- assert.equal(g.length, 2);
- g.updateBounds();
- assert.equal(g.bounds.min, 0);
- assert.equal(g.bounds.max, 2.5);
- });
-
- test('asyncSliceGroupStableId', function() {
- var model = new tr.Model();
- var process = model.getOrCreateProcess(123);
- var thread = process.getOrCreateThread(456);
- var group = new AsyncSliceGroup(thread);
-
- assert.equal(process.stableId, 123);
- assert.equal(thread.stableId, '123.456');
- assert.equal(group.stableId, '123.456.AsyncSliceGroup');
- });
-
- test('asyncSliceParentContainerSetAtPush', function() {
- var m = newModel(function(m) {
- m.process = m.getOrCreateProcess(123);
- m.thread = m.process.getOrCreateThread(456);
- m.group = new AsyncSliceGroup(m.thread);
-
- m.sA = m.group.push(newAsyncSliceEx(
- { title: 'sA', start: 0.0, duration: 10.0 }));
- });
-
- assert.deepEqual(m.sA.parentContainer, m.thread);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/async_slice_test.html b/chromium/third_party/catapult/tracing/tracing/model/async_slice_test.html
deleted file mode 100644
index 3fadbcb0844..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/async_slice_test.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var AsyncSlice = tr.model.AsyncSlice;
- var Process = tr.model.Process;
- var Thread = tr.model.Thread;
- var newAsyncSlice = tr.c.TestUtils.newAsyncSlice;
- var newAsyncSliceEx = tr.c.TestUtils.newAsyncSliceEx;
- var newFakeThread = tr.c.TestUtils.newFakeThread;
-
- test('stableId', function() {
- var thread = newFakeThread();
- var group = thread.asyncSliceGroup;
-
- var sA = group.push(newAsyncSliceEx(
- { title: 'sA', start: 0.0, duration: 10.0 }));
- var sB = group.push(newAsyncSliceEx(
- { title: 'sB', start: 10.0, duration: 20.0 }));
- var sC = group.push(newAsyncSliceEx(
- { title: 'sC', start: 20.0, duration: 30.0 }));
-
- assert.equal(group.stableId + '.0', sA.stableId);
- assert.equal(group.stableId + '.1', sB.stableId);
- assert.equal(group.stableId + '.2', sC.stableId);
- });
-
- test('setParentContainerForSubSlices', function() {
- var model = new tr.Model();
- var p1 = new Process(model, 1);
- var t1 = new Thread(p1, 1);
- var asyncSlice = newAsyncSlice(0, 10, t1, t1);
- var subSlice1 = newAsyncSlice(1, 5, t1, t1);
- var subSlice2 = newAsyncSlice(6, 9, t1, t1);
- var subSlice3 = newAsyncSlice(2, 3, t1, t1);
- subSlice1.subSlices.push(subSlice3);
- asyncSlice.subSlices.push(subSlice1);
- asyncSlice.subSlices.push(subSlice2);
- asyncSlice.parentContainer = t1;
- assert.equal(asyncSlice.subSlices.length, 2);
- assert.equal(subSlice1.subSlices.length, 1);
- assert.deepEqual(asyncSlice.parentContainer, t1);
- assert.deepEqual(subSlice1.parentContainer, t1);
- assert.deepEqual(subSlice2.parentContainer, t1);
- assert.deepEqual(subSlice3.parentContainer, t1);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/clock_sync_manager.html b/chromium/third_party/catapult/tracing/tracing/model/clock_sync_manager.html
deleted file mode 100644
index 37e10a2cff9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/clock_sync_manager.html
+++ /dev/null
@@ -1,380 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
- var ClockDomainId = {
- BATTOR: 'BATTOR',
-
- // NOTE: Exists for backwards compatibility with old Chrome traces which
- // didn't explicitly specify the clock being used.
- UNKNOWN_CHROME_LEGACY: 'UNKNOWN_CHROME_LEGACY',
-
- LINUX_CLOCK_MONOTONIC: 'LINUX_CLOCK_MONOTONIC',
- LINUX_FTRACE_GLOBAL: 'LINUX_FTRACE_GLOBAL',
- MAC_MACH_ABSOLUTE_TIME: 'MAC_MACH_ABSOLUTE_TIME',
- WIN_ROLLOVER_PROTECTED_TIME_GET_TIME:
- 'WIN_ROLLOVER_PROTECTED_TIME_GET_TIME',
- WIN_QPC: 'WIN_QPC',
-
- // "Telemetry" isn't really a clock domain because Telemetry actually
- // can use one of several clock domains, just like Chrome. However,
- // because there's a chance that Telemetry is running off of the same
- // clock as Chrome (e.g. LINUX_CLOCK_MONOTONIC) but on a separate device
- // (i.e. on a host computer with Chrome running on an attached phone),
- // there's a chance that Chrome and Telemetry will erroneously get put into
- // the same clock domain. The solution for this is that clock domains should
- // actually be some (unique_device_id, clock_id) tuple. For now, though,
- // we'll hack around this by putting Telemetry into its own clock domain.
- TELEMETRY: 'TELEMETRY'
- };
-
- var POSSIBLE_CHROME_CLOCK_DOMAINS = new Set([
- ClockDomainId.UNKNOWN_CHROME_LEGACY,
- ClockDomainId.LINUX_CLOCK_MONOTONIC,
- ClockDomainId.MAC_MACH_ABSOLUTE_TIME,
- ClockDomainId.WIN_ROLLOVER_PROTECTED_TIME_GET_TIME,
- ClockDomainId.WIN_QPC
- ]);
-
- // The number of milliseconds above which the BattOr sync is no longer
- // considered "fast", and it's more accurate to use the sync start timestamp
- // instead of the normal sync timestamp due to a bug in the Chrome serial code
- // making serial reads too slow.
- var BATTOR_FAST_SYNC_THRESHOLD_MS = 3;
-
- /**
- * Returns a function that, given a timestamp in |fromMarker|'s domain,
- * returns a timestamp in |toMarker|'s domain.
- */
- function createTransformer(fromMarker, toMarker) {
- var fromTs = fromMarker.ts, toTs = toMarker.ts;
-
- // TODO(charliea): Usually, we estimate that the clock sync marker is
- // issued by the agent exactly in the middle of the controller's start and
- // end timestamps. However, there's currently a bug in the Chrome serial
- // code that's making the clock sync ack for BattOr take much longer to
- // read than it should (by about 8ms). This is causing the above estimate
- // of the controller's sync timestamp to be off by a substantial enough
- // amount that it makes traces hard to read. For now, make an exception
- // for BattOr and just use the controller's start timestamp as the sync
- // time. In the medium term, we should fix the Chrome serial code in order
- // to remove this special logic and get an even more accurate estimate.
- if (fromMarker.domainId === ClockDomainId.BATTOR &&
- toMarker.duration > BATTOR_FAST_SYNC_THRESHOLD_MS) {
- toTs = toMarker.startTs;
- } else if (toMarker.domainId === ClockDomainId.BATTOR &&
- fromMarker.duration > BATTOR_FAST_SYNC_THRESHOLD_MS) {
- fromTs = fromMarker.startTs;
- }
-
- var tsShift = toTs - fromTs;
- return function(ts) { return ts + tsShift; };
- }
-
- /**
- * Given two transformers, creates a third that's a composition of the two.
- *
- * @param {function(Number): Number} aToB A function capable of converting a
- * timestamp from domain A to domain B.
- * @param {function(Number): Number} bToC A function capable of converting a
- * timestamp from domain B to domain C.
- *
- * @return {function(Number): Number} A function capable of converting a
- * timestamp from domain A to domain C.
- */
- function composeTransformers(aToB, bToC) {
- return function(ts) {
- return bToC(aToB(ts));
- };
- }
-
- /**
- * A ClockSyncManager holds clock sync markers and uses them to shift
- * timestamps from agents' clock domains onto the model's clock domain.
- *
- * In this context, a "clock domain" is a single perspective on the passage
- * of time. A single computer can have multiple clock domains because it
- * can have multiple methods of retrieving a timestamp (e.g.
- * clock_gettime(CLOCK_MONOTONIC) and clock_gettime(CLOCK_REALTIME) on Linux).
- * Another common reason for multiple clock domains within a single trace
- * is that traces can span devices (e.g. a laptop collecting a Chrome trace
- * can have its power consumption recorded by a second device and the two
- * traces can be viewed alongside each other).
- *
- * For more information on how to synchronize multiple time domains using this
- * method, see: http://bit.ly/1OVkqju.
- *
- * @constructor
- */
- function ClockSyncManager() {
- // A set of all domains seen by the ClockSyncManager.
- this.domainsSeen_ = new Set();
- this.markersBySyncId_ = new Map();
- // transformerMapByDomainId_[fromDomainId][toDomainId] returns the function
- // that converts timestamps in the "from" domain to timestamps in the "to"
- // domain.
- this.transformerMapByDomainId_ = {};
- }
-
- ClockSyncManager.prototype = {
- /**
- * Adds a clock sync marker to the list of known markers.
- *
- * @param {string} domainId The clock domain that the marker is in.
- * @param {string} syncId The identifier shared by both sides of the clock
- * sync marker.
- * @param {number} startTs The time (in ms) at which the sync started.
- * @param {number=} opt_endTs The time (in ms) at which the sync ended. If
- * unspecified, it's assumed to be the same as the start,
- * indicating an instantaneous sync.
- */
- addClockSyncMarker: function(domainId, syncId, startTs, opt_endTs) {
- this.onDomainSeen_(domainId);
-
- if (tr.b.dictionaryValues(ClockDomainId).indexOf(domainId) < 0) {
- throw new Error('"' + domainId + '" is not in the list of known ' +
- 'clock domain IDs.');
- }
-
- if (this.modelDomainId_) {
- throw new Error('Cannot add new clock sync markers after getting ' +
- 'a model time transformer.');
- }
-
- var marker = new ClockSyncMarker(domainId, startTs, opt_endTs);
-
- if (!this.markersBySyncId_.has(syncId)) {
- this.markersBySyncId_.set(syncId, [marker]);
- return;
- }
-
- var markers = this.markersBySyncId_.get(syncId);
-
- if (markers.length === 2) {
- throw new Error('Clock sync with ID "' + syncId + '" is already ' +
- 'complete - cannot add a third clock sync marker to it.');
- }
-
- if (markers[0].domainId === domainId)
- throw new Error('A clock domain cannot sync with itself.');
-
- // TODO(charliea): Allow multiple paths between clock domains by selecting
- // the path with the least potential error.
- if (this.getTransformerBetween_(markers[0].domainId, domainId)) {
- throw new Error('The current code cannot handle multiple paths ' +
- 'between the same clock domains. However, this is a valid ' +
- 'operation.');
- }
-
- markers.push(marker);
-
- this.getOrCreateTransformerMap_(markers[0].domainId)[domainId] =
- createTransformer(markers[0], marker);
- this.getOrCreateTransformerMap_(domainId)[markers[0].domainId] =
- createTransformer(marker, markers[0]);
- },
-
- get markersBySyncId() {
- return this.markersBySyncId_;
- },
-
- /**
- * Returns a function that, given a timestamp in the domain with |domainId|,
- * returns a timestamp in the model's clock domain.
- *
- * NOTE: All clock sync markers should be added before calling this function
- * for the first time. This is because the first time that this function is
- * called, a model clock domain is selected. This clock domain must have
- * syncs connecting it with all other clock domains. If multiple clock
- * domains are viable candidates, the one with the clock domain ID that is
- * the first alphabetically is selected.
- */
- getModelTimeTransformer: function(domainId) {
- this.onDomainSeen_(domainId);
-
- if (!this.modelDomainId_)
- this.selectModelDomainId_();
-
- var transformer =
- this.getTransformerBetween_(domainId, this.modelDomainId_);
- if (!transformer) {
- throw new Error('No clock sync markers exist pairing clock domain "' +
- domainId + '" ' + 'with model clock domain "' +
- this.modelDomainId_ + '".');
- }
-
- return transformer;
- },
-
- /**
- * Returns a function that, given a timestamp in the "from" domain, returns
- * a timestamp in the "to" domain.
- */
- getTransformerBetween_: function(fromDomainId, toDomainId) {
- // Do a breadth-first search from the "from" domain until we reach the
- // "to" domain.
- var visitedDomainIds = new Set();
- // Keep a queue of nodes to visit, starting with the "from" domain.
- var queue = [];
- queue.push({ domainId: fromDomainId, transformer: tr.b.identity });
-
- while (queue.length > 0) {
- var current = queue.shift();
-
- if (current.domainId === toDomainId)
- return current.transformer;
-
- if (visitedDomainIds.has(current.domainId))
- continue;
- visitedDomainIds.add(current.domainId);
-
- var outgoingTransformers =
- this.transformerMapByDomainId_[current.domainId];
-
- if (!outgoingTransformers)
- continue;
-
- // Add all nodes that are directly connected to this one to the queue.
- for (var outgoingDomainId in outgoingTransformers) {
- // We have two transformers: one to get us from the "from" domain to
- // the current domain, and another to get us from the current domain
- // to the next domain. By composing those two transformers, we can
- // create one that gets us from the "from" domain to the next domain.
- var toNextDomainTransformer = outgoingTransformers[outgoingDomainId];
- var toCurrentDomainTransformer = current.transformer;
-
- queue.push({
- domainId: outgoingDomainId,
- transformer: composeTransformers(
- toNextDomainTransformer, toCurrentDomainTransformer)
- });
- }
- }
-
- return undefined;
- },
-
- /**
- * Selects the domain to use as the model domain from among the domains
- * with registered markers.
- *
- * This is necessary because some common domain must be chosen before all
- * timestamps can be shifted onto the same domain.
- *
- * For the time being, preference is given to Chrome clock domains. If no
- * Chrome clock domain is present, the first clock domain alphabetically
- * is selected.
- */
- selectModelDomainId_: function() {
- this.ensureAllDomainsAreConnected_();
-
- // While we're migrating to the new clock sync system, we have to make
- // sure to prefer the Chrome clock domain because legacy clock sync
- // mechanisms assume that's the case.
- for (var chromeDomainId of POSSIBLE_CHROME_CLOCK_DOMAINS) {
- if (this.domainsSeen_.has(chromeDomainId)) {
- this.modelDomainId_ = chromeDomainId;
- return;
- }
- }
-
- var domainsSeenArray = Array.from(this.domainsSeen_);
- domainsSeenArray.sort();
- this.modelDomainId_ = domainsSeenArray[0];
- },
-
- /** Throws an error if all domains are not connected. */
- ensureAllDomainsAreConnected_: function() {
- // NOTE: this is a ridiculously inefficient way to do this. Given how few
- // clock domains we're likely to have, this shouldn't be a problem.
- var firstDomainId = undefined;
- for (var domainId of this.domainsSeen_) {
- if (!firstDomainId) {
- firstDomainId = domainId;
- continue;
- }
-
- if (!this.getTransformerBetween_(firstDomainId, domainId)) {
- throw new Error('Unable to select a master clock domain because no ' +
- 'path can be found from "' + firstDomainId + '" to "' + domainId +
- '".');
- }
- }
-
- return true;
- },
-
- /** Observer called each time that a clock domain is seen. */
- onDomainSeen_: function(domainId) {
- if (domainId === ClockDomainId.UNKNOWN_CHROME_LEGACY &&
- !this.domainsSeen_.has(ClockDomainId.UNKNOWN_CHROME_LEGACY)) {
- // UNKNOWN_CHROME_LEGACY was just seen for the first time: collapse it
- // and the other Chrome clock domains into one.
- //
- // This makes sure that we don't have two separate clock sync graphs:
- // one attached to UNKNOWN_CHROME_LEGACY and the other attached to the
- // real Chrome clock domain.
- for (var chromeDomainId of POSSIBLE_CHROME_CLOCK_DOMAINS) {
- if (chromeDomainId === ClockDomainId.UNKNOWN_CHROME_LEGACY)
- continue;
-
- this.collapseDomains_(
- ClockDomainId.UNKNOWN_CHROME_LEGACY, chromeDomainId);
- }
- }
-
- this.domainsSeen_.add(domainId);
- },
-
- /** Makes timestamps in the two clock domains interchangeable. */
- collapseDomains_: function(domain1Id, domain2Id) {
- this.getOrCreateTransformerMap_(domain1Id)[domain2Id] =
- this.getOrCreateTransformerMap_(domain2Id)[domain1Id] = tr.b.identity;
- },
-
- /**
- * Returns (and creates if it doesn't exist) the transformer map describing
- * how to transform timestamps between directly connected clock domains.
- */
- getOrCreateTransformerMap_: function(domainId) {
- if (!this.transformerMapByDomainId_[domainId])
- this.transformerMapByDomainId_[domainId] = {};
-
- return this.transformerMapByDomainId_[domainId];
- }
- };
-
- /**
- * A ClockSyncMarker is an internal entity that represents a marker in a
- * trace log indicating that a clock sync happened at a specified time.
- *
- * If no end timestamp argument is specified in the constructor, it's assumed
- * that the end timestamp is the same as the start (i.e. the clock sync
- * was instantaneous).
- */
- function ClockSyncMarker(domainId, startTs, opt_endTs) {
- this.domainId = domainId;
- this.startTs = startTs;
- this.endTs = opt_endTs === undefined ? startTs : opt_endTs;
- }
-
- ClockSyncMarker.prototype = {
- get duration() { return this.endTs - this.startTs; },
- get ts() { return this.startTs + this.duration / 2; }
- };
-
- return {
- ClockDomainId: ClockDomainId,
- ClockSyncManager: ClockSyncManager
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/clock_sync_manager_test.html b/chromium/third_party/catapult/tracing/tracing/model/clock_sync_manager_test.html
deleted file mode 100644
index 6caad9b7d46..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/clock_sync_manager_test.html
+++ /dev/null
@@ -1,363 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/clock_sync_manager.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- var ClockDomainId = tr.model.ClockDomainId;
- var ClockSyncManager = tr.model.ClockSyncManager;
-
- var testOptions = {
- setUp: function() {
- // Add a few testing clock domains to the list of permissible domains.
- ClockDomainId.DOMAIN_1 = 'DOMAIN1';
- ClockDomainId.DOMAIN_2 = 'DOMAIN2';
- ClockDomainId.DOMAIN_3 = 'DOMAIN3';
- ClockDomainId.DOMAIN_4 = 'DOMAIN4';
- ClockDomainId.DOMAIN_5 = 'DOMAIN5';
- },
-
- tearDown: function() {
- delete ClockDomainId.DOMAIN_1;
- delete ClockDomainId.DOMAIN_2;
- delete ClockDomainId.DOMAIN_3;
- delete ClockDomainId.DOMAIN_4;
- delete ClockDomainId.DOMAIN_5;
- }
- };
-
- test('addClockSyncMarker_throwsWithUnknownDomain', function() {
- var mgr = new ClockSyncManager();
-
- assert.throws(function() {
- mgr.addClockSyncMarker('unknown', 'sync1', 100, 200);
- }, '"unknown" is not in the list of known clock domain IDs.');
- }, testOptions);
-
-
- test('addClockSyncMarker_throwsWhenSelfSyncing', function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100, 200);
-
- assert.throws(function() {
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 200, 300);
- }, 'A clock domain cannot sync with itself.');
- }, testOptions);
-
- test('addClockSyncMarker_throwsWhenAddingThirdSyncMarkerToSync', function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_2, 'sync1', 100);
-
- assert.throws(function() {
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_3, 'sync1', 100);
- }, 'Clock sync with ID "sync1" is already complete - cannot add a third ' +
- 'clock sync marker to it.');
- }, testOptions);
-
- test('addClockSyncMarker_throwsWhenAddingDuplicatePaths', function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_2, 'sync1', 100);
-
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync2', 100);
-
- assert.throws(function() {
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_2, 'sync2', 100);
- }, 'The current code cannot handle multiple paths between the same clock ' +
- 'domains. However, this is a valid operation.');
- }, testOptions);
-
- test('addClockSyncMarker_throwsAfterGetModelTimeTransformer', function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_2, 'sync1', 100);
-
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1);
-
- assert.throws(function() {
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_2, 'sync2', 100);
- }, 'Cannot add new clock sync markers after getting a model time ' +
- 'transformer.');
- }, testOptions);
-
- test('getModelTimeTransformer_noMarkers', function() {
- var mgr = new ClockSyncManager();
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1)(100), 100);
- }, testOptions);
-
- test('getModelTimeTransformer_noMarkersSecondDomainThrows', function() {
- var mgr = new ClockSyncManager();
-
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1);
-
- assert.throws(function() {
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_2);
- }, 'No clock sync markers exist pairing clock domain "DOMAIN2" with model' +
- ' clock domain "DOMAIN1".');
- }, testOptions);
-
- test('getModelTimeTransformer_noMarkersChromeLegacyFirst', function() {
- var mgr = new ClockSyncManager();
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.UNKNOWN_CHROME_LEGACY)(100),
- 100);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.LINUX_CLOCK_MONOTONIC)(100),
- 100);
- }, testOptions);
-
- test('getModelTimeTransformer_noMarkersChromeLegacySecond', function() {
- var mgr = new ClockSyncManager();
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.LINUX_CLOCK_MONOTONIC)(100),
- 100);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.UNKNOWN_CHROME_LEGACY)(100),
- 100);
- }, testOptions);
-
- test('getModelTimeTransformer_oneMarker', function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100);
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1)(100), 100);
- }, testOptions);
-
- test('getModelTimeTransformer_oneCompleteSync', function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_2, 'sync1', 350);
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_2)(350), 100);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1)(100), 100);
- }, testOptions);
-
- test('getModelTimeTransformer_oneCompleteSyncWithChromeLegacyBefore',
- function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100);
- mgr.addClockSyncMarker(ClockDomainId.UNKNOWN_CHROME_LEGACY, 'sync1', 350);
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.UNKNOWN_CHROME_LEGACY)(350),
- 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1)(100), 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.LINUX_CLOCK_MONOTONIC)(350),
- 350);
- }, testOptions);
-
- test('getModelTimeTransformer_oneCompleteSyncWithChromeLegacyAfter',
- function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100);
- mgr.addClockSyncMarker(ClockDomainId.LINUX_CLOCK_MONOTONIC, 'sync1', 350);
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.UNKNOWN_CHROME_LEGACY)(350),
- 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1)(100), 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.LINUX_CLOCK_MONOTONIC)(350),
- 350);
- }, testOptions);
-
- test('getModelTimeTransformer_twoCompleteSyncs', function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_2, 'sync1', 350);
-
- var tx = mgr.getTransformerBetween_('DOMAIN1', 'DOMAIN3');
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync2', 200);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_3, 'sync2', 250);
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_2)(350), 100);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1)(100), 100);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_3)(250), 200);
- }, testOptions);
-
- test('getModelTimeTransformer_twoSyncMarkersWithEndTs', function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100, 200);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_2, 'sync1', 350);
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_2)(350), 150);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1)(150), 150);
- }, testOptions);
-
- test('getModelTimeTransformer_indirectlyConnectedGraph',
- function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_2, 'sync1', 200);
-
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_2, 'sync2', 200);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_3, 'sync2', 300);
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1)(100), 100);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_3)(300), 100);
- }, testOptions);
-
- test('getModelTimeTransformer_battorSyncUsesNormalTimestampWhenFast',
- function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100, 102);
- mgr.addClockSyncMarker(ClockDomainId.BATTOR, 'sync1', 350);
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1)(101),
- 350);
- }, testOptions);
-
- test('getModelTimeTransformer_battorSyncUsesChromeLegacyStartTsWhenTooSlow',
- function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100, 200);
- mgr.addClockSyncMarker(ClockDomainId.BATTOR, 'sync1', 350);
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1)(100),
- 350);
- }, testOptions);
-
- test('getModelTimeTransformer_prefersChromeLegacyDomain', function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100);
- mgr.addClockSyncMarker(ClockDomainId.UNKNOWN_CHROME_LEGACY, 'sync1', 350);
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1)(100),
- 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.UNKNOWN_CHROME_LEGACY)(350),
- 350);
- }, testOptions);
-
- test('getModelTimeTransformer_collapsesUnknownChromeLegacyDomainLinux',
- function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100);
- mgr.addClockSyncMarker(ClockDomainId.UNKNOWN_CHROME_LEGACY, 'sync1', 350);
-
- mgr.addClockSyncMarker(ClockDomainId.LINUX_CLOCK_MONOTONIC, 'sync2', 350);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_2, 'sync2', 450);
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1)(100), 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_2)(450), 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.LINUX_CLOCK_MONOTONIC)(350),
- 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.UNKNOWN_CHROME_LEGACY)(350),
- 350);
- }, testOptions);
-
- test('getModelTimeTransformer_collapsesUnknownChromeLegacyDomainMac',
- function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100);
- mgr.addClockSyncMarker(ClockDomainId.UNKNOWN_CHROME_LEGACY, 'sync1', 350);
-
- mgr.addClockSyncMarker(ClockDomainId.MAC_MACH_ABSOLUTE_TIME, 'sync2', 350);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_2, 'sync2', 450);
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1)(100), 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_2)(450), 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.MAC_MACH_ABSOLUTE_TIME)(350),
- 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.UNKNOWN_CHROME_LEGACY)(350),
- 350);
- }, testOptions);
-
- test('getModelTimeTransformer_collapsesUnknownChromeLegacyDomainWinLoRes',
- function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100);
- mgr.addClockSyncMarker(ClockDomainId.UNKNOWN_CHROME_LEGACY, 'sync1', 350);
-
- mgr.addClockSyncMarker(
- ClockDomainId.WIN_ROLLOVER_PROTECTED_TIME_GET_TIME, 'sync2', 350);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_2, 'sync2', 450);
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1)(100), 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_2)(450), 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(
- ClockDomainId.WIN_ROLLOVER_PROTECTED_TIME_GET_TIME)(350),
- 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.UNKNOWN_CHROME_LEGACY)(350),
- 350);
- }, testOptions);
-
- test('getModelTimeTransformer_collapsesChromeLegacyDomainWinHiRes',
- function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100);
- mgr.addClockSyncMarker(ClockDomainId.UNKNOWN_CHROME_LEGACY, 'sync1', 350);
-
- mgr.addClockSyncMarker(ClockDomainId.WIN_QPC, 'sync2', 350);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_2, 'sync2', 450);
-
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_1)(100), 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_2)(450), 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.WIN_QPC)(350), 350);
- assert.strictEqual(
- mgr.getModelTimeTransformer(ClockDomainId.UNKNOWN_CHROME_LEGACY)(350),
- 350);
- }, testOptions);
-
- test('getModelTimeTransformer_throwsWithTwoDistinctGraphs', function() {
- var mgr = new ClockSyncManager();
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync1', 100);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_2, 'sync1', 100);
-
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_1, 'sync2', 100);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_3, 'sync2', 100);
-
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_4, 'sync3', 100);
- mgr.addClockSyncMarker(ClockDomainId.DOMAIN_5, 'sync3', 100);
-
- assert.throws(function() {
- mgr.getModelTimeTransformer(ClockDomainId.DOMAIN_5);
- }, 'Unable to select a master clock domain because no path can be found ' +
- 'from "DOMAIN1" to "DOMAIN4"');
- }, testOptions);
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/comment_box_annotation.html b/chromium/third_party/catapult/tracing/tracing/model/comment_box_annotation.html
deleted file mode 100644
index 5c76b8d9fc6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/comment_box_annotation.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/location.html">
-<link rel="import" href="/tracing/model/annotation.html">
-<link rel="import" href="/tracing/model/rect_annotation.html">
-<link rel="import" href="/tracing/ui/annotations/comment_box_annotation_view.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
-
- function CommentBoxAnnotation(location, text) {
- tr.model.Annotation.apply(this, arguments);
-
- this.location = location;
- this.text = text;
- }
-
- CommentBoxAnnotation.fromDict = function(dict) {
- var args = dict.args;
- var location =
- new tr.model.Location(args.location.xWorld, args.location.yComponents);
- return new tr.model.CommentBoxAnnotation(location, args.text);
- };
-
- CommentBoxAnnotation.prototype = {
- __proto__: tr.model.Annotation.prototype,
-
- onRemove: function() {
- this.view_.removeTextArea();
- },
-
- toDict: function() {
- return {
- typeName: 'comment_box',
- args: {
- text: this.text,
- location: this.location.toDict()
- }
- };
- },
-
- createView_: function(viewport) {
- return new tr.ui.annotations.CommentBoxAnnotationView(viewport, this);
- }
- };
-
- tr.model.Annotation.register(
- CommentBoxAnnotation, {typeName: 'comment_box'});
-
- return {
- CommentBoxAnnotation: CommentBoxAnnotation
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/compound_event_selection_state.html b/chromium/third_party/catapult/tracing/tracing/model/compound_event_selection_state.html
deleted file mode 100644
index bf35ab5c131..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/compound_event_selection_state.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
-
- /**
- * Indicates how much of a compound-event is selected [if any].
- *
- * The CompoundEventSelectionState enum is used with events that are
- * directly selectable, but also have associated events, too, that can be
- * selected. In this situation, there are a variety of different
- * selected states other than just "yes, no". This enum encodes those
- * various possible states.
- */
- var CompoundEventSelectionState = {
- // Basic bit states.
- NOT_SELECTED: 0,
- EVENT_SELECTED: 0x1,
- SOME_ASSOCIATED_EVENTS_SELECTED: 0x2,
- ALL_ASSOCIATED_EVENTS_SELECTED: 0x4,
-
- // Common combinations.
- EVENT_AND_SOME_ASSOCIATED_SELECTED: 0x1 | 0x2,
- EVENT_AND_ALL_ASSOCIATED_SELECTED: 0x1 | 0x4
- };
-
- return {
- CompoundEventSelectionState: CompoundEventSelectionState
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/constants.html b/chromium/third_party/catapult/tracing/tracing/model/constants.html
deleted file mode 100644
index 3c1ec4ff24b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/constants.html
+++ /dev/null
@@ -1,25 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
- return {
- // Since the PID of the browser process is not known to the child processes,
- // we let them use "pid_ref = -1" to reference an object created in the
- // browser process.
- BROWSER_PROCESS_PID_REF: -1,
-
- // The default scope of object events, when not explicitly specified.
- OBJECT_DEFAULT_SCOPE: 'ptr'
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/container_memory_dump.html b/chromium/third_party/catapult/tracing/tracing/model/container_memory_dump.html
deleted file mode 100644
index 3abda063566..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/container_memory_dump.html
+++ /dev/null
@@ -1,93 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/timed_event.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the ContainerMemoryDump class.
- */
-tr.exportTo('tr.model', function() {
- /**
- * The ContainerMemoryDump represents an abstract container memory dump.
- * @constructor
- */
- function ContainerMemoryDump(start) {
- tr.model.TimedEvent.call(this, start);
-
- this.levelOfDetail = undefined;
-
- this.memoryAllocatorDumps_ = undefined;
- this.memoryAllocatorDumpsByFullName_ = undefined;
- };
-
- /**
- * Memory dump level of detail. See base::trace_event::MemoryDumpLevelOfDetail
- * in the Chromium repository.
- *
- * @enum
- */
- ContainerMemoryDump.LevelOfDetail = {
- LIGHT: 0,
- DETAILED: 1
- };
-
- ContainerMemoryDump.prototype = {
- __proto__: tr.model.TimedEvent.prototype,
-
- shiftTimestampsForward: function(amount) {
- this.start += amount;
- },
-
- get memoryAllocatorDumps() {
- return this.memoryAllocatorDumps_;
- },
-
- set memoryAllocatorDumps(memoryAllocatorDumps) {
- this.memoryAllocatorDumps_ = memoryAllocatorDumps;
- this.forceRebuildingMemoryAllocatorDumpByFullNameIndex();
- },
-
- getMemoryAllocatorDumpByFullName: function(fullName) {
- if (this.memoryAllocatorDumps_ === undefined)
- return undefined;
-
- // Lazily generate the index if necessary.
- if (this.memoryAllocatorDumpsByFullName_ === undefined) {
- var index = {};
- function addDumpsToIndex(dumps) {
- dumps.forEach(function(dump) {
- index[dump.fullName] = dump;
- addDumpsToIndex(dump.children);
- });
- };
- addDumpsToIndex(this.memoryAllocatorDumps_);
- this.memoryAllocatorDumpsByFullName_ = index;
- }
-
- return this.memoryAllocatorDumpsByFullName_[fullName];
- },
-
- forceRebuildingMemoryAllocatorDumpByFullNameIndex: function() {
- // Clear the index and generate it lazily.
- this.memoryAllocatorDumpsByFullName_ = undefined;
- },
-
- iterateRootAllocatorDumps: function(fn, opt_this) {
- if (this.memoryAllocatorDumps === undefined)
- return;
- this.memoryAllocatorDumps.forEach(fn, opt_this || this);
- }
- };
-
- return {
- ContainerMemoryDump: ContainerMemoryDump
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/container_memory_dump_test.html b/chromium/third_party/catapult/tracing/tracing/model/container_memory_dump_test.html
deleted file mode 100644
index 6c8bc649bf1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/container_memory_dump_test.html
+++ /dev/null
@@ -1,177 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/container_memory_dump.html">
-<link rel="import" href="/tracing/model/memory_allocator_dump.html">
-<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ContainerMemoryDump = tr.model.ContainerMemoryDump;
- var MemoryAllocatorDump = tr.model.MemoryAllocatorDump;
- var ScalarNumeric = tr.v.ScalarNumeric;
- var unitlessNumber_smallerIsBetter =
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter;
- var newAllocatorDump = tr.model.MemoryDumpTestUtils.newAllocatorDump;
- var addChildDump = tr.model.MemoryDumpTestUtils.addChildDump;
-
- test('memoryAllocatorDumps_undefined', function() {
- var md = new ContainerMemoryDump(42);
-
- assert.isUndefined(md.memoryAllocatorDumps);
- assert.isUndefined(md.getMemoryAllocatorDumpByFullName('malloc'));
- });
-
- test('memoryAllocatorDumps_zero', function() {
- var md = new ContainerMemoryDump(42);
- md.memoryAllocatorDumps = [];
-
- assert.lengthOf(md.memoryAllocatorDumps, 0);
- assert.isUndefined(md.getMemoryAllocatorDumpByFullName('malloc'));
- });
-
- test('memoryAllocatorDumps_flat', function() {
- var md = new ContainerMemoryDump(42);
-
- var oilpanDump = newAllocatorDump(md, 'oilpan', {
- size: 1024,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 7),
- inner_size: 768
- });
- var v8Dump = newAllocatorDump(md, 'v8', {
- size: 2048,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 15),
- inner_size: 1999
- });
- md.memoryAllocatorDumps = [oilpanDump, v8Dump];
-
- assert.lengthOf(md.memoryAllocatorDumps, 2);
- assert.equal(md.memoryAllocatorDumps[0], oilpanDump);
- assert.equal(md.memoryAllocatorDumps[1], v8Dump);
-
- assert.equal(md.getMemoryAllocatorDumpByFullName('oilpan'), oilpanDump);
- assert.equal(md.getMemoryAllocatorDumpByFullName('v8'), v8Dump);
- assert.isUndefined(md.getMemoryAllocatorDumpByFullName('malloc'));
- });
-
- test('memoryAllocatorDumps_nested', function() {
- var md = new ContainerMemoryDump(42);
-
- var oilpanDump = newAllocatorDump(md, 'oilpan', {
- size: 1024,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 7),
- inner_size: 768
- });
-
- var oilpanBucket1Dump = addChildDump(oilpanDump, 'bucket1', {
- size: 512,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 3),
- inner_size: 256
- });
-
- var oilpanBucket2Dump = addChildDump(oilpanDump, 'bucket2', {
- size: 512,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 4),
- inner_size: 512
- });
-
- var oilpanBucket2StringsDump = addChildDump(oilpanBucket2Dump, 'strings', {
- size: 512,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 4),
- inner_size: 512
- });
-
- var v8Dump = newAllocatorDump(md, 'v8', {
- size: 2048,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 15),
- inner_size: 1999
- });
-
- md.memoryAllocatorDumps = [oilpanDump, v8Dump];
-
- assert.lengthOf(md.memoryAllocatorDumps, 2);
- assert.equal(md.memoryAllocatorDumps[0], oilpanDump);
- assert.equal(md.memoryAllocatorDumps[1], v8Dump);
-
- assert.equal(md.getMemoryAllocatorDumpByFullName('oilpan'), oilpanDump);
- assert.equal(md.getMemoryAllocatorDumpByFullName('oilpan/bucket1'),
- oilpanBucket1Dump);
- assert.equal(md.getMemoryAllocatorDumpByFullName('oilpan/bucket2'),
- oilpanBucket2Dump);
- assert.equal(md.getMemoryAllocatorDumpByFullName('oilpan/bucket2/strings'),
- oilpanBucket2StringsDump);
- assert.equal(md.getMemoryAllocatorDumpByFullName('v8'), v8Dump);
- assert.isUndefined(md.getMemoryAllocatorDumpByFullName('malloc'));
- });
-
- test('iterateRootAllocatorDumps', function() {
- var containerDump = new ContainerMemoryDump(42);
-
- var oilpanDump = new MemoryAllocatorDump(containerDump, 'oilpan');
- var v8Dump = new MemoryAllocatorDump(containerDump, 'v8');
- addChildDump(v8Dump, 'heaps');
-
- containerDump.memoryAllocatorDumps = [oilpanDump, v8Dump];
-
- var visitedAllocatorDumps = [];
- containerDump.iterateRootAllocatorDumps(
- function(dump) { this.visitedAllocatorDumps.push(dump); },
- { visitedAllocatorDumps: visitedAllocatorDumps });
- assert.sameMembers(visitedAllocatorDumps, [oilpanDump, v8Dump]);
- });
-
- test('forceRebuildingMemoryAllocatorDumpByFullNameIndex', function() {
- var containerDump = new ContainerMemoryDump(42);
-
- var v8Dump = new MemoryAllocatorDump(containerDump, 'v8');
- var v8HeapsDump = addChildDump(v8Dump, 'heaps');
- var v8HeapSmallDump = addChildDump(v8HeapsDump, 'S');
-
- // Setting the memory allocator dumps should update the index properly.
- containerDump.memoryAllocatorDumps = [v8Dump];
- assert.strictEqual(
- containerDump.getMemoryAllocatorDumpByFullName('v8'), v8Dump);
- assert.strictEqual(containerDump.getMemoryAllocatorDumpByFullName(
- 'v8/heaps'), v8HeapsDump);
- assert.strictEqual(containerDump.getMemoryAllocatorDumpByFullName(
- 'v8/heaps/S'), v8HeapSmallDump);
-
- // Add a second grandchild (v8/heaps/L).
- var v8HeapLargeDump = addChildDump(v8HeapsDump, 'L');
-
- // Setting the memory allocator dumps again should update the index
- // properly again.
- containerDump.memoryAllocatorDumps = [v8Dump];
- assert.strictEqual(
- containerDump.getMemoryAllocatorDumpByFullName('v8'), v8Dump);
- assert.strictEqual(containerDump.getMemoryAllocatorDumpByFullName(
- 'v8/heaps'), v8HeapsDump);
- assert.strictEqual(containerDump.getMemoryAllocatorDumpByFullName(
- 'v8/heaps/S'), v8HeapSmallDump);
- assert.strictEqual(containerDump.getMemoryAllocatorDumpByFullName(
- 'v8/heaps/L'), v8HeapLargeDump);
-
- // Remove the first grandchild (v8/heaps/S).
- v8HeapsDump.children.splice(0, 1);
-
- // Force rebuilding the index and check that it was updated properly.
- containerDump.forceRebuildingMemoryAllocatorDumpByFullNameIndex();
- assert.strictEqual(
- containerDump.getMemoryAllocatorDumpByFullName('v8'), v8Dump);
- assert.strictEqual(containerDump.getMemoryAllocatorDumpByFullName(
- 'v8/heaps'), v8HeapsDump);
- assert.isUndefined(containerDump.getMemoryAllocatorDumpByFullName(
- 'v8/heaps/S'));
- assert.strictEqual(containerDump.getMemoryAllocatorDumpByFullName(
- 'v8/heaps/L'), v8HeapLargeDump);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/counter.html b/chromium/third_party/catapult/tracing/tracing/model/counter.html
deleted file mode 100644
index 74c0991c91f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/counter.html
+++ /dev/null
@@ -1,195 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/model/counter_series.html">
-<link rel="import" href="/tracing/model/event_container.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
-
- /**
- * A container holding all series of a given type of measurement.
- *
- * As an example, if we're measuring the throughput of data sent over several
- * USB connections, the throughput of each cable might be added as a separate
- * series to a single counter.
- *
- * @constructor
- * @extends {EventContainer}
- */
- function Counter(parent, id, category, name) {
- tr.model.EventContainer.call(this);
-
- this.parent_ = parent;
- this.id_ = id;
- this.category_ = category || '';
- this.name_ = name;
-
- this.series_ = [];
- this.totals = [];
- }
-
- Counter.prototype = {
- __proto__: tr.model.EventContainer.prototype,
-
- get parent() {
- return this.parent_;
- },
-
- get id() {
- return this.id_;
- },
-
- get category() {
- return this.category_;
- },
-
- get name() {
- return this.name_;
- },
-
- childEvents: function*() {
- },
-
- childEventContainers: function*() {
- yield * this.series;
- },
-
- set timestamps(arg) {
- throw new Error('Bad counter API. No cookie.');
- },
-
- set seriesNames(arg) {
- throw new Error('Bad counter API. No cookie.');
- },
-
- set seriesColors(arg) {
- throw new Error('Bad counter API. No cookie.');
- },
-
- set samples(arg) {
- throw new Error('Bad counter API. No cookie.');
- },
-
- addSeries: function(series) {
- series.counter = this;
- series.seriesIndex = this.series_.length;
- this.series_.push(series);
- return series;
- },
-
- getSeries: function(idx) {
- return this.series_[idx];
- },
-
- get series() {
- return this.series_;
- },
-
- get numSeries() {
- return this.series_.length;
- },
-
- get numSamples() {
- if (this.series_.length === 0)
- return 0;
- return this.series_[0].length;
- },
-
- get timestamps() {
- if (this.series_.length === 0)
- return [];
- return this.series_[0].timestamps;
- },
-
- /**
- * Obtains min, max, avg, values, start, and end for different series for
- * a given counter
- * getSampleStatistics([0,1])
- * The statistics objects that this returns are an array of objects, one
- * object for each series for the counter in the form:
- * {min: minVal, max: maxVal, avg: avgVal, start: startVal, end: endVal}
- *
- * @param {Array.<Number>} Indices to summarize.
- * @return {Object} An array of statistics. Each element in the array
- * has data for one of the series in the selected counter.
- */
- getSampleStatistics: function(sampleIndices) {
- sampleIndices.sort();
-
- var ret = [];
- this.series_.forEach(function(series) {
- ret.push(series.getStatistics(sampleIndices));
- });
- return ret;
- },
-
- /**
- * Shifts all the timestamps inside this counter forward by the amount
- * specified.
- */
- shiftTimestampsForward: function(amount) {
- for (var i = 0; i < this.series_.length; ++i)
- this.series_[i].shiftTimestampsForward(amount);
- },
-
- /**
- * Updates the bounds for this counter based on the samples it contains.
- */
- updateBounds: function() {
- this.totals = [];
- this.maxTotal = 0;
- this.bounds.reset();
-
- if (this.series_.length === 0)
- return;
-
- var firstSeries = this.series_[0];
- var lastSeries = this.series_[this.series_.length - 1];
-
- this.bounds.addValue(firstSeries.getTimestamp(0));
- this.bounds.addValue(lastSeries.getTimestamp(lastSeries.length - 1));
-
- var numSeries = this.numSeries;
- this.maxTotal = -Infinity;
-
- // Sum the samples at each timestamp.
- // Note, this assumes that all series have all timestamps.
- for (var i = 0; i < firstSeries.length; ++i) {
- var total = 0;
- this.series_.forEach(function(series) {
- total += series.getSample(i).value;
- this.totals.push(total);
- }.bind(this));
-
- this.maxTotal = Math.max(total, this.maxTotal);
- }
- }
- };
-
- /**
- * Comparison between counters that orders by parent.compareTo, then name.
- */
- Counter.compare = function(x, y) {
- var tmp = x.parent.compareTo(y);
- if (tmp != 0)
- return tmp;
- var tmp = x.name.localeCompare(y.name);
- if (tmp == 0)
- return x.tid - y.tid;
- return tmp;
- };
-
- return {
- Counter: Counter
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/counter_sample.html b/chromium/third_party/catapult/tracing/tracing/model/counter_sample.html
deleted file mode 100644
index f188afcc845..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/counter_sample.html
+++ /dev/null
@@ -1,105 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/model/event.html">
-<link rel="import" href="/tracing/model/event_registry.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
-
- /**
- * The value of a given measurement at a given time.
- *
- * As an example, if we're measuring the throughput of data sent over a USB
- * connection, each counter sample might represent the instantaneous
- * throughput of the connection at a given time.
- *
- * @constructor
- * @extends {Event}
- */
- function CounterSample(series, timestamp, value) {
- tr.model.Event.call(this);
- this.series_ = series;
- this.timestamp_ = timestamp;
- this.value_ = value;
- }
-
- CounterSample.groupByTimestamp = function(samples) {
- var samplesByTimestamp = tr.b.group(samples, function(sample) {
- return sample.timestamp;
- });
-
- var timestamps = tr.b.dictionaryKeys(samplesByTimestamp);
- timestamps.sort();
- var groups = [];
- for (var i = 0; i < timestamps.length; i++) {
- var ts = timestamps[i];
- var group = samplesByTimestamp[ts];
- group.sort(function(x, y) {
- return x.series.seriesIndex - y.series.seriesIndex;
- });
- groups.push(group);
- }
- return groups;
- };
-
- CounterSample.prototype = {
- __proto__: tr.model.Event.prototype,
-
- get series() {
- return this.series_;
- },
-
- get timestamp() {
- return this.timestamp_;
- },
-
- get value() {
- return this.value_;
- },
-
- set timestamp(timestamp) {
- this.timestamp_ = timestamp;
- },
-
- addBoundsToRange: function(range) {
- range.addValue(this.timestamp);
- },
-
- getSampleIndex: function() {
- return tr.b.findLowIndexInSortedArray(
- this.series.timestamps,
- function(x) { return x; },
- this.timestamp_);
- },
-
- get userFriendlyName() {
- return 'Counter sample from ' + this.series_.title + ' at ' +
- tr.v.Unit.byName.timeStampInMs.format(this.timestamp);
- }
- };
-
-
- tr.model.EventRegistry.register(
- CounterSample,
- {
- name: 'counterSample',
- pluralName: 'counterSamples',
- singleViewElementName: 'tr-ui-a-counter-sample-sub-view',
- multiViewElementName: 'tr-ui-a-counter-sample-sub-view'
- });
-
- return {
- CounterSample: CounterSample
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/counter_sample_test.html b/chromium/third_party/catapult/tracing/tracing/model/counter_sample_test.html
deleted file mode 100644
index 09322c2d8ea..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/counter_sample_test.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/counter.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Counter = tr.model.Counter;
- var CounterSeries = tr.model.CounterSeries;
- var CounterSample = tr.model.CounterSample;
-
- test('groupByTimestamp', function() {
- var counter = new Counter();
- var s0 = counter.addSeries(new CounterSeries('x', 0));
- var s1 = counter.addSeries(new CounterSeries('y', 1));
-
- var s0_0 = s0.addCounterSample(0, 100);
- var s0_1 = s1.addCounterSample(0, 200);
- var s1_0 = s0.addCounterSample(1, 100);
- var s1_1 = s1.addCounterSample(1, 200);
-
- var groups = CounterSample.groupByTimestamp([s0_1, s0_0,
- s1_1, s1_0]);
- assert.equal(groups.length, 2);
- assert.deepEqual(groups[0], [s0_0, s0_1]);
- assert.deepEqual(groups[1], [s1_0, s1_1]);
- });
-
- test('getSampleIndex', function() {
- var ctr = new Counter(null, 0, '', 'myCounter');
- var s0 = new CounterSeries('a', 0);
- ctr.addSeries(s0);
-
- var s0_0 = s0.addCounterSample(0, 0);
- var s0_1 = s0.addCounterSample(1, 100);
- assert.equal(s0_0.getSampleIndex(), 0);
- assert.equal(s0_1.getSampleIndex(), 1);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/counter_series.html b/chromium/third_party/catapult/tracing/tracing/model/counter_series.html
deleted file mode 100644
index ac1463c381a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/counter_series.html
+++ /dev/null
@@ -1,125 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/counter_sample.html">
-<link rel="import" href="/tracing/model/event_container.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
- var CounterSample = tr.model.CounterSample;
-
- /**
- * A container holding all samples of a given measurement over time.
- *
- * As an example, a counter series might measure the throughput of data sent
- * over a USB connection, with each sample representing the instantaneous
- * throughput of the connection.
- *
- * @constructor
- * @extends {EventContainer}
- */
- function CounterSeries(name, color) {
- tr.model.EventContainer.call(this);
-
- this.name_ = name;
- this.color_ = color;
-
- this.timestamps_ = [];
- this.samples_ = [];
-
- // Set by counter.addSeries
- this.counter = undefined;
- this.seriesIndex = undefined;
- }
-
- CounterSeries.prototype = {
- __proto__: tr.model.EventContainer.prototype,
-
- get length() {
- return this.timestamps_.length;
- },
-
- get name() {
- return this.name_;
- },
-
- get color() {
- return this.color_;
- },
-
- get samples() {
- return this.samples_;
- },
-
- get timestamps() {
- return this.timestamps_;
- },
-
- getSample: function(idx) {
- return this.samples_[idx];
- },
-
- getTimestamp: function(idx) {
- return this.timestamps_[idx];
- },
-
- addCounterSample: function(ts, val) {
- var sample = new CounterSample(this, ts, val);
- this.addSample(sample);
- return sample;
- },
-
- addSample: function(sample) {
- this.timestamps_.push(sample.timestamp);
- this.samples_.push(sample);
- },
-
- getStatistics: function(sampleIndices) {
- var sum = 0;
- var min = Number.MAX_VALUE;
- var max = -Number.MAX_VALUE;
-
- for (var i = 0; i < sampleIndices.length; ++i) {
- var sample = this.getSample(sampleIndices[i]).value;
-
- sum += sample;
- min = Math.min(sample, min);
- max = Math.max(sample, max);
- }
-
- return {
- min: min,
- max: max,
- avg: (sum / sampleIndices.length),
- start: this.getSample(sampleIndices[0]).value,
- end: this.getSample(sampleIndices.length - 1).value
- };
- },
-
- shiftTimestampsForward: function(amount) {
- for (var i = 0; i < this.timestamps_.length; ++i) {
- this.timestamps_[i] += amount;
- this.samples_[i].timestamp = this.timestamps_[i];
- }
- },
-
- childEvents: function*() {
- yield * this.samples_;
- },
-
- childEventContainers: function*() {
- }
- };
-
- return {
- CounterSeries: CounterSeries
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/counter_test.html b/chromium/third_party/catapult/tracing/tracing/model/counter_test.html
deleted file mode 100644
index fef6fa76efe..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/counter_test.html
+++ /dev/null
@@ -1,109 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/counter.html">
-<link rel="import" href="/tracing/model/counter_series.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Counter = tr.model.Counter;
- var CounterSeries = tr.model.CounterSeries;
- var CounterSample = tr.model.CounterSample;
-
- var createCounterWithTwoSeries = function() {
- var ctr = new Counter(null, 0, '', 'myCounter');
- var aSeries = new CounterSeries('a', 0);
- var bSeries = new CounterSeries('b', 0);
- ctr.addSeries(aSeries);
- ctr.addSeries(bSeries);
-
- aSeries.addCounterSample(0, 5);
- aSeries.addCounterSample(1, 6);
- aSeries.addCounterSample(2, 5);
- aSeries.addCounterSample(3, 7);
-
- bSeries.addCounterSample(0, 10);
- bSeries.addCounterSample(1, 15);
- bSeries.addCounterSample(2, 12);
- bSeries.addCounterSample(3, 16);
-
- return ctr;
- };
-
- test('getSampleStatisticsWithSingleSelection', function() {
- var ctr = createCounterWithTwoSeries();
- var ret = ctr.getSampleStatistics([0]);
-
- assert.equal(ret[0].min, 5);
- assert.equal(ret[0].max, 5);
- assert.equal(ret[0].avg, 5);
- assert.equal(ret[0].start, 5);
- assert.equal(ret[0].end, 5);
-
- assert.equal(ret[1].min, 10);
- assert.equal(ret[1].max, 10);
- assert.equal(ret[1].avg, 10);
- assert.equal(ret[1].start, 10);
- assert.equal(ret[1].end, 10);
- });
-
- test('getSampleStatisticsWithMultipleSelections', function() {
- var ctr = createCounterWithTwoSeries();
- var ret = ctr.getSampleStatistics([0, 1]);
-
- assert.equal(ret[0].min, 5);
- assert.equal(ret[0].max, 6);
- assert.equal(ret[0].avg, (5 + 6) / 2);
- assert.equal(ret[0].start, 5);
- assert.equal(ret[0].end, 6);
-
- assert.equal(ret[1].min, 10);
- assert.equal(ret[1].max, 15);
- assert.equal(ret[1].avg, (10 + 15) / 2);
- assert.equal(ret[1].start, 10);
- assert.equal(ret[1].end, 15);
- });
-
- test('getSampleStatisticsWithOutofOrderIndices', function() {
- var ctr = createCounterWithTwoSeries();
- var ret = ctr.getSampleStatistics([1, 0]);
-
- assert.equal(ret[0].min, 5);
- assert.equal(ret[0].max, 6);
- assert.equal(ret[0].avg, (5 + 6) / 2);
- assert.equal(ret[0].start, 5);
- assert.equal(ret[0].end, 6);
-
- assert.equal(ret[1].min, 10);
- assert.equal(ret[1].max, 15);
- assert.equal(ret[1].avg, (10 + 15) / 2);
- assert.equal(ret[1].start, 10);
- assert.equal(ret[1].end, 15);
- });
-
- test('getSampleStatisticsWithAllSelections', function() {
- var ctr = createCounterWithTwoSeries();
- var ret = ctr.getSampleStatistics([1, 0, 2, 3]);
-
- assert.equal(ret[0].min, 5);
- assert.equal(ret[0].max, 7);
- assert.equal(ret[0].avg, (5 + 6 + 5 + 7) / 4);
- assert.equal(ret[0].start, 5);
- assert.equal(ret[0].end, 7);
-
- assert.equal(ret[1].min, 10);
- assert.equal(ret[1].max, 16);
- assert.equal(ret[1].avg, (10 + 15 + 12 + 16) / 4);
- assert.equal(ret[1].start, 10);
- assert.equal(ret[1].end, 16);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/cpu.html b/chromium/third_party/catapult/tracing/tracing/model/cpu.html
deleted file mode 100644
index 2194e462185..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/cpu.html
+++ /dev/null
@@ -1,273 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/model/counter.html">
-<link rel="import" href="/tracing/model/cpu_slice.html">
-<link rel="import" href="/tracing/model/process_base.html">
-<link rel="import" href="/tracing/model/thread_time_slice.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the Cpu class.
- */
-tr.exportTo('tr.model', function() {
-
- var ColorScheme = tr.b.ColorScheme;
- var Counter = tr.model.Counter;
- var CpuSlice = tr.model.CpuSlice;
- var Slice = tr.model.Slice;
-
- /**
- * The Cpu represents a Cpu from the kernel's point of view.
- * @constructor
- */
- function Cpu(kernel, number) {
- if (kernel === undefined || number === undefined)
- throw new Error('Missing arguments');
- this.kernel = kernel;
- this.cpuNumber = number;
- this.slices = [];
- this.counters = {};
- this.bounds_ = new tr.b.Range();
- this.samples_ = undefined; // Set during createSubSlices
-
- // Start timestamp of the last active thread.
- this.lastActiveTimestamp_ = undefined;
-
- // Identifier of the last active thread. On Linux, it's a pid while on
- // Windows it's a thread id.
- this.lastActiveThread_ = undefined;
-
- // Name and arguments of the last active thread.
- this.lastActiveName_ = undefined;
- this.lastActiveArgs_ = undefined;
- };
-
- Cpu.prototype = {
- __proto__: tr.model.EventContainer.prototype,
-
- get samples() {
- return this.samples_;
- },
-
- get userFriendlyName() {
- return 'CPU ' + this.cpuNumber;
- },
-
- findTopmostSlicesInThisContainer: function*(eventPredicate, opt_this) {
- // All CpuSlices are toplevel since CpuSlices do not nest.
- for (var s of slices) {
- yield * s.findTopmostSlicesRelativeToThisSlice(
- eventPredicate, opt_this);
- }
- },
-
- childEvents: function*() {
- yield * this.slices;
-
- if (this.samples_)
- yield * this.samples_;
- },
-
- childEventContainers: function*() {
- yield * tr.b.dictionaryValues(this.counters);
- },
-
- /**
- * @return {Counter} The counter on this CPU with the given category/name
- * combination, creating it if it doesn't exist.
- */
- getOrCreateCounter: function(cat, name) {
- var id = cat + '.' + name;
- if (!this.counters[id])
- this.counters[id] = new Counter(this, id, cat, name);
- return this.counters[id];
- },
-
- /**
- * @return {Counter} the counter on this CPU with the given category/name
- * combination, or undefined if it doesn't exist.
- */
- getCounter: function(cat, name) {
- var id = cat + '.' + name;
- if (!this.counters[id])
- return undefined;
- return this.counters[id];
- },
-
- /**
- * Shifts all the timestamps inside this CPU forward by the amount
- * specified.
- */
- shiftTimestampsForward: function(amount) {
- for (var sI = 0; sI < this.slices.length; sI++)
- this.slices[sI].start = (this.slices[sI].start + amount);
- for (var id in this.counters)
- this.counters[id].shiftTimestampsForward(amount);
- },
-
- /**
- * Updates the range based on the current slices attached to the cpu.
- */
- updateBounds: function() {
- this.bounds_.reset();
- if (this.slices.length) {
- this.bounds_.addValue(this.slices[0].start);
- this.bounds_.addValue(this.slices[this.slices.length - 1].end);
- }
- for (var id in this.counters) {
- this.counters[id].updateBounds();
- this.bounds_.addRange(this.counters[id].bounds);
- }
- if (this.samples_ && this.samples_.length) {
- this.bounds_.addValue(this.samples_[0].start);
- this.bounds_.addValue(
- this.samples_[this.samples_.length - 1].end);
- }
- },
-
- createSubSlices: function() {
- this.samples_ = this.kernel.model.samples.filter(function(sample) {
- return sample.cpu == this;
- }, this);
- },
-
- addCategoriesToDict: function(categoriesDict) {
- for (var i = 0; i < this.slices.length; i++)
- categoriesDict[this.slices[i].category] = true;
- for (var id in this.counters)
- categoriesDict[this.counters[id].category] = true;
- for (var i = 0; i < this.samples_.length; i++)
- categoriesDict[this.samples_[i].category] = true;
- },
-
-
-
- /*
- * Returns the index of the slice in the CPU's slices, or undefined.
- */
- indexOf: function(cpuSlice) {
- var i = tr.b.findLowIndexInSortedArray(
- this.slices,
- function(slice) { return slice.start; },
- cpuSlice.start);
- if (this.slices[i] !== cpuSlice)
- return undefined;
- return i;
- },
-
- /**
- * Closes the thread running on the CPU. |end_timestamp| is the timestamp
- * at which the thread was unscheduled. |args| is merged with the arguments
- * specified when the thread was initially scheduled.
- */
- closeActiveThread: function(end_timestamp, args) {
- // Don't generate a slice if the last active thread is the idle task.
- if (this.lastActiveThread_ == undefined || this.lastActiveThread_ == 0)
- return;
-
- if (end_timestamp < this.lastActiveTimestamp_) {
- throw new Error('The end timestamp of a thread running on CPU ' +
- this.cpuNumber + ' is before its start timestamp.');
- }
-
- // Merge |args| with |this.lastActiveArgs_|. If a key is in both
- // dictionaries, the value from |args| is used.
- for (var key in args) {
- this.lastActiveArgs_[key] = args[key];
- }
-
- var duration = end_timestamp - this.lastActiveTimestamp_;
- var slice = new tr.model.CpuSlice(
- '', this.lastActiveName_,
- ColorScheme.getColorIdForGeneralPurposeString(this.lastActiveName_),
- this.lastActiveTimestamp_,
- this.lastActiveArgs_,
- duration);
- slice.cpu = this;
- this.slices.push(slice);
-
- // Clear the last state.
- this.lastActiveTimestamp_ = undefined;
- this.lastActiveThread_ = undefined;
- this.lastActiveName_ = undefined;
- this.lastActiveArgs_ = undefined;
- },
-
- switchActiveThread: function(timestamp, old_thread_args, new_thread_id,
- new_thread_name, new_thread_args) {
- // Close the previous active thread and generate a slice.
- this.closeActiveThread(timestamp, old_thread_args);
-
- // Keep track of the new thread.
- this.lastActiveTimestamp_ = timestamp;
- this.lastActiveThread_ = new_thread_id;
- this.lastActiveName_ = new_thread_name;
- this.lastActiveArgs_ = new_thread_args;
- },
-
- /**
- * Returns the frequency statistics for this CPU;
- * the returned object contains the frequencies as keys,
- * and the duration at this frequency in milliseconds as the value,
- * for the range that was specified.
- */
- getFreqStatsForRange: function(range) {
- var stats = {};
-
- function addStatsForFreq(freqSample, index) {
- // Counters don't have an explicit end or duration;
- // calculate the end by looking at the starting point
- // of the next value in the series, or if that doesn't
- // exist, assume this frequency is held until the end.
- var freqEnd = (index < freqSample.series_.length - 1) ?
- freqSample.series_.samples_[index + 1].timestamp : range.max;
-
- var freqRange = tr.b.Range.fromExplicitRange(freqSample.timestamp,
- freqEnd);
- var intersection = freqRange.findIntersection(range);
- if (!(freqSample.value in stats))
- stats[freqSample.value] = 0;
- stats[freqSample.value] += intersection.duration;
- }
-
- var freqCounter = this.getCounter('', 'Clock Frequency');
- if (freqCounter !== undefined) {
- var freqSeries = freqCounter.getSeries(0);
- if (!freqSeries)
- return;
-
- tr.b.iterateOverIntersectingIntervals(freqSeries.samples_,
- function(x) { return x.timestamp; },
- function(x, index) { return index < freqSeries.length - 1 ?
- freqSeries.samples_[index + 1].timestamp :
- range.max; },
- range.min,
- range.max,
- addStatsForFreq);
- }
-
- return stats;
- }
- };
-
- /**
- * Comparison between processes that orders by cpuNumber.
- */
- Cpu.compare = function(x, y) {
- return x.cpuNumber - y.cpuNumber;
- };
-
-
- return {
- Cpu: Cpu
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/cpu_slice.html b/chromium/third_party/catapult/tracing/tracing/model/cpu_slice.html
deleted file mode 100644
index b646a3db0f9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/cpu_slice.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/model/thread_time_slice.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the CpuSlice class.
- */
-tr.exportTo('tr.model', function() {
-
- var Slice = tr.model.Slice;
-
- /**
- * A CpuSlice represents a slice of time on a CPU.
- *
- * @constructor
- */
- function CpuSlice(cat, title, colorId, start, args, opt_duration) {
- Slice.apply(this, arguments);
- this.threadThatWasRunning = undefined;
- this.cpu = undefined;
- }
-
- CpuSlice.prototype = {
- __proto__: Slice.prototype,
-
- get analysisTypeName() {
- return 'tr.ui.analysis.CpuSlice';
- },
-
- getAssociatedTimeslice: function() {
- if (!this.threadThatWasRunning)
- return undefined;
- var timeSlices = this.threadThatWasRunning.timeSlices;
- for (var i = 0; i < timeSlices.length; i++) {
- var timeSlice = timeSlices[i];
- if (timeSlice.start !== this.start)
- continue;
- if (timeSlice.duration !== this.duration)
- continue;
- return timeSlice;
- }
- return undefined;
- }
- };
-
- tr.model.EventRegistry.register(
- CpuSlice,
- {
- name: 'cpuSlice',
- pluralName: 'cpuSlices',
- singleViewElementName: 'tr-ui-a-single-cpu-slice-sub-view',
- multiViewElementName: 'tr-ui-a-multi-cpu-slice-sub-view'
- });
-
- return {
- CpuSlice: CpuSlice
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/cpu_test.html b/chromium/third_party/catapult/tracing/tracing/model/cpu_test.html
deleted file mode 100644
index 2ac7338e089..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/cpu_test.html
+++ /dev/null
@@ -1,202 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ColorScheme = tr.b.ColorScheme;
- var Cpu = tr.model.Cpu;
- var newThreadSlice = tr.c.TestUtils.newThreadSlice;
-
- test('cpuBounds_Empty', function() {
- var cpu = new Cpu({}, 1);
- cpu.updateBounds();
- assert.isUndefined(cpu.bounds.min);
- assert.isUndefined(cpu.bounds.max);
- });
-
- test('cpuBounds_OneSlice', function() {
- var cpu = new Cpu({}, 1);
- cpu.slices.push(tr.c.TestUtils.newSliceEx({start: 1, duration: 3}));
- cpu.updateBounds();
- assert.equal(cpu.bounds.min, 1);
- assert.equal(cpu.bounds.max, 4);
- });
-
- test('getOrCreateCounter', function() {
- var cpu = new Cpu({}, 1);
- var ctrBar = cpu.getOrCreateCounter('foo', 'bar');
- var ctrBar2 = cpu.getOrCreateCounter('foo', 'bar');
- assert.equal(ctrBar, ctrBar2);
- });
-
- test('shiftTimestampsForward', function() {
- var cpu = new Cpu({}, 1);
- var ctr = cpu.getOrCreateCounter('foo', 'bar');
- cpu.slices.push(tr.c.TestUtils.newSliceEx({start: 1, duration: 3}));
- var shiftCount = 0;
- ctr.shiftTimestampsForward = function(ts) {
- if (ts == 0.32)
- shiftCount++;
- };
- cpu.slices.push(tr.c.TestUtils.newSliceEx({start: 1, duration: 3}));
- cpu.shiftTimestampsForward(0.32);
- assert.equal(1, shiftCount);
- assert.equal(cpu.slices[0].start, 1.32);
- });
-
-
- function newCpuSliceNamed(cpu, name, start, duration, opt_thread) {
- var s = new tr.model.CpuSlice(
- 'cat', name, 0, start, {}, duration);
- s.cpu = cpu;
- if (opt_thread)
- s.threadThatWasRunning = opt_thread;
- return s;
- }
-
- test('getTimesliceForCpuSlice', function() {
- var m = new tr.Model();
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var cpu = m.kernel.getOrCreateCpu(1);
- var t2 = m.getOrCreateProcess(1).getOrCreateThread(2);
- t2.timeSlices = [newThreadSlice(t2, SCHEDULING_STATE.RUNNING, 0, 10, cpu),
- newThreadSlice(t2, SCHEDULING_STATE.SLEEPING, 10, 10),
- newThreadSlice(t2, SCHEDULING_STATE.RUNNING, 20, 10, cpu)];
- cpu.slices = [newCpuSliceNamed(cpu, 'x', 0, 10, t2),
- newCpuSliceNamed(cpu, 'x', 20, 10, t2)];
- assert.equal(cpu.slices[0].getAssociatedTimeslice(), t2.timeSlices[0]);
- assert.equal(cpu.slices[1].getAssociatedTimeslice(), t2.timeSlices[2]);
-
- assert.equal(t2.timeSlices[0].getAssociatedCpuSlice(), cpu.slices[0]);
- assert.isUndefined(t2.timeSlices[1].getAssociatedCpuSlice());
- assert.equal(t2.timeSlices[2].getAssociatedCpuSlice(), cpu.slices[1]);
-
- assert.equal(cpu.indexOf(cpu.slices[0]), 0);
- assert.equal(cpu.indexOf(cpu.slices[1]), 1);
-
- assert.equal(t2.indexOfTimeSlice(t2.timeSlices[0]), 0);
- assert.equal(t2.indexOfTimeSlice(t2.timeSlices[1]), 1);
- assert.equal(t2.indexOfTimeSlice(t2.timeSlices[2]), 2);
- });
-
- test('putToSleepFor', function() {
- var m = new tr.Model();
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var cpu = m.kernel.getOrCreateCpu(1);
-
- var t2 = m.getOrCreateProcess(1).getOrCreateThread(2);
- var t3 = m.getOrCreateProcess(1).getOrCreateThread(3);
- t2.timeSlices = [newThreadSlice(t2, SCHEDULING_STATE.RUNNING, 0, 10, cpu),
- newThreadSlice(t2, SCHEDULING_STATE.SLEEPING, 10, 10),
- newThreadSlice(t2, SCHEDULING_STATE.RUNNING, 20, 10, cpu)];
- t3.timeSlices = [newThreadSlice(t3, SCHEDULING_STATE.RUNNING, 10, 5, cpu)];
- cpu.slices = [newCpuSliceNamed(cpu, 'x', 0, 10, t2),
- newCpuSliceNamed(cpu, 'x', 10, 5, t3),
- newCpuSliceNamed(cpu, 'x', 20, 10, t2)];
-
- // At timeslice 0, the thread is running.
- assert.isUndefined(t2.timeSlices[0].getCpuSliceThatTookCpu());
-
- // t2 lost the cpu to t3 at t=10
- assert.equal(
- cpu.slices[1],
- t2.timeSlices[1].getCpuSliceThatTookCpu());
- });
-
- test('putToSleepForNothing', function() {
- var m = new tr.Model();
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var cpu = m.kernel.getOrCreateCpu(1);
-
- var t2 = m.getOrCreateProcess(1).getOrCreateThread(2);
- var t3 = m.getOrCreateProcess(1).getOrCreateThread(3);
- t2.timeSlices = [newThreadSlice(t2, SCHEDULING_STATE.RUNNING, 0, 10, cpu),
- newThreadSlice(t2, SCHEDULING_STATE.SLEEPING, 10, 10),
- newThreadSlice(t2, SCHEDULING_STATE.RUNNING, 20, 10, cpu)];
- t3.timeSlices = [newThreadSlice(t3, SCHEDULING_STATE.RUNNING, 15, 5, cpu)];
- cpu.slices = [newCpuSliceNamed(cpu, 'x', 0, 10, t2),
- newCpuSliceNamed(cpu, 'x', 15, 5, t3),
- newCpuSliceNamed(cpu, 'x', 20, 10, t2)];
- assert.isUndefined(t2.timeSlices[1].getCpuSliceThatTookCpu());
- });
-
- test('switchActiveThread', function() {
- var m = new tr.Model();
- var cpu = m.kernel.getOrCreateCpu(1);
-
- cpu.switchActiveThread(5, {}, 0, 'idle thread', {});
- cpu.switchActiveThread(10, {}, 1, 'thread one', {a: 1});
- cpu.switchActiveThread(15, {b: 2}, 2, 'thread two', {c: 3});
- cpu.switchActiveThread(30, {c: 4, d: 5}, 3, 'thread three', {e: 6});
- cpu.closeActiveThread(40, {f: 7});
- cpu.switchActiveThread(50, {}, 4, 'thread four', {g: 8});
- cpu.switchActiveThread(60, {}, 1, 'thread one', {});
- cpu.closeActiveThread(70, {});
-
- assert.equal(cpu.slices.length, 5);
-
- assert.equal(cpu.slices[0].title, 'thread one');
- assert.equal(cpu.slices[0].start, 10);
- assert.equal(cpu.slices[0].duration, 5);
- assert.equal(Object.keys(cpu.slices[0].args).length, 2);
- assert.equal(cpu.slices[0].args.a, 1);
- assert.equal(cpu.slices[0].args.b, 2);
-
- assert.equal(cpu.slices[1].title, 'thread two');
- assert.equal(cpu.slices[1].start, 15);
- assert.equal(cpu.slices[1].duration, 15);
- assert.equal(Object.keys(cpu.slices[1].args).length, 2);
- assert.equal(cpu.slices[1].args.c, 4);
- assert.equal(cpu.slices[1].args.d, 5);
-
- assert.equal(cpu.slices[2].title, 'thread three');
- assert.equal(cpu.slices[2].start, 30);
- assert.equal(cpu.slices[2].duration, 10);
- assert.equal(Object.keys(cpu.slices[2].args).length, 2);
- assert.equal(cpu.slices[2].args.e, 6);
- assert.equal(cpu.slices[2].args.f, 7);
-
- assert.equal(cpu.slices[3].title, 'thread four');
- assert.equal(cpu.slices[3].start, 50);
- assert.equal(cpu.slices[3].duration, 10);
- assert.equal(Object.keys(cpu.slices[3].args).length, 1);
- assert.equal(cpu.slices[3].args.g, 8);
-
- assert.equal(cpu.slices[4].title, 'thread one');
- assert.equal(cpu.slices[4].start, 60);
- assert.equal(cpu.slices[4].duration, 10);
- assert.equal(Object.keys(cpu.slices[4].args).length, 0);
- });
-
- test('getFrequencyStats', function() {
- var m = new tr.Model();
- var cpu = m.kernel.getOrCreateCpu(1);
- var powerCounter = cpu.getOrCreateCounter('', 'Clock Frequency');
- var series = powerCounter.addSeries(new tr.model.CounterSeries('state',
- ColorScheme.getColorIdForGeneralPurposeString('test')));
-
- series.addCounterSample(0, 100000);
- series.addCounterSample(20, 300000);
- series.addCounterSample(30, 100000);
- series.addCounterSample(80, 500000);
- series.addCounterSample(100, 300000);
-
- var range = tr.b.Range.fromExplicitRange(10, 90);
- var stats = cpu.getFreqStatsForRange(range);
- assert.equal(stats[100000], 60);
- assert.equal(stats[300000], 10);
- assert.equal(stats[500000], 10);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/device.html b/chromium/third_party/catapult/tracing/tracing/model/device.html
deleted file mode 100644
index cbb1b2aa91a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/device.html
+++ /dev/null
@@ -1,109 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/model/event_container.html">
-<link rel="import" href="/tracing/model/power_series.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the Device class.
- */
-tr.exportTo('tr.model', function() {
-
- /**
- * Device represents the device-level objects in the model.
- * @constructor
- * @extends {tr.model.EventContainer}
- */
- function Device(model) {
- if (!model)
- throw new Error('Must provide a model.');
-
- tr.model.EventContainer.call(this);
-
- this.powerSeries_ = undefined;
- this.vSyncTimestamps_ = [];
- };
-
- Device.compare = function(x, y) {
- return x.guid - y.guid;
- };
-
- Device.prototype = {
- __proto__: tr.model.EventContainer.prototype,
-
- compareTo: function(that) {
- return Device.compare(this, that);
- },
-
- get userFriendlyName() {
- return 'Device';
- },
-
- get userFriendlyDetails() {
- return 'Device';
- },
-
- get stableId() {
- return 'Device';
- },
-
- getSettingsKey: function() {
- return 'device';
- },
-
- get powerSeries() {
- return this.powerSeries_;
- },
-
- set powerSeries(powerSeries) {
- this.powerSeries_ = powerSeries;
- },
-
- get vSyncTimestamps() {
- return this.vSyncTimestamps_;
- },
-
- set vSyncTimestamps(value) {
- this.vSyncTimestamps_ = value;
- },
-
- updateBounds: function() {
- this.bounds.reset();
- for (var child of this.childEventContainers()) {
- child.updateBounds();
- this.bounds.addRange(child.bounds);
- }
- },
-
- shiftTimestampsForward: function(amount) {
- for (var child of this.childEventContainers()) {
- child.shiftTimestampsForward(amount);
- }
-
- for (var i = 0; i < this.vSyncTimestamps_.length; i++)
- this.vSyncTimestamps_[i] += amount;
- },
-
- addCategoriesToDict: function(categoriesDict) {
- },
-
- childEventContainers: function*() {
- if (this.powerSeries_)
- yield this.powerSeries_;
- }
- };
-
- return {
- Device: Device
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/device_test.html b/chromium/third_party/catapult/tracing/tracing/model/device_test.html
deleted file mode 100644
index 5457e65a1ff..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/device_test.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/device.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/power_series.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- var Device = tr.model.Device;
- var Model = tr.Model;
- var PowerSeries = tr.model.PowerSeries;
-
- test('updateBounds', function() {
- var device = new Device(new Model());
- device.powerSeries = new PowerSeries(device);
-
- // Verify that the bounds match the lowest and highest timestamps.
- device.powerSeries.addPowerSample(100, 5);
- device.powerSeries.addPowerSample(200, 5);
- device.updateBounds();
-
- assert.equal(device.bounds.min, 100);
- assert.equal(device.bounds.max, 200);
-
- // Add a new sample and verify that the bounds change.
- device.powerSeries.addPowerSample(700, 5);
- device.updateBounds();
-
- assert.equal(device.bounds.min, 100);
- assert.equal(device.bounds.max, 700);
- });
-
- test('shiftTimestampsForward', function() {
- var device = new Device(new Model());
- device.powerSeries = new PowerSeries(device);
-
- device.powerSeries.addPowerSample(100, 2);
- device.powerSeries.addPowerSample(200, 2);
- device.shiftTimestampsForward(2);
-
- assert.equal(device.powerSeries.samples[0].start, 102);
- assert.equal(device.powerSeries.samples[1].start, 202);
- });
-
- test('childEventContainers_noPowerSeries', function() {
- var device = new Device(new Model());
- var childEventContainers = [];
- for (var container of device.childEventContainers())
- childEventContainers.push(container);
- assert.deepEqual(childEventContainers, []);
- });
-
- test('childEventContainers_powerSeries', function() {
- var device = new Device(new Model());
- device.powerSeries = new PowerSeries(device);
- var childEventContainers = [];
- for (var container of device.childEventContainers())
- childEventContainers.push(container);
- assert.deepEqual(childEventContainers, [device.powerSeries]);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/event.html b/chromium/third_party/catapult/tracing/tracing/model/event.html
deleted file mode 100644
index 10ab2f3c22b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/event.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/selectable_item.html">
-<link rel="import" href="/tracing/model/selection_state.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the Event class.
- */
-tr.exportTo('tr.model', function() {
- var SelectableItem = tr.model.SelectableItem;
- var SelectionState = tr.model.SelectionState;
- var IMMUTABLE_EMPTY_SET = tr.model.EventSet.IMMUTABLE_EMPTY_SET;
-
- /**
- * An Event is the base type for any non-container, selectable piece
- * of data in the trace model.
- *
- * @constructor
- * @extends {SelectableItem}
- */
- function Event() {
- SelectableItem.call(this, this /* modelItem */);
- this.guid_ = tr.b.GUID.allocateSimple();
- this.selectionState = SelectionState.NONE;
- this.info = undefined;
- }
-
- Event.prototype = {
- __proto__: SelectableItem.prototype,
-
- get guid() {
- return this.guid_;
- },
-
- get stableId() {
- return undefined;
- },
-
- // Empty by default. Lazily initialized on an instance in
- // addAssociatedAlert(). See #1930.
- associatedAlerts: IMMUTABLE_EMPTY_SET,
-
- addAssociatedAlert: function(alert) {
- if (this.associatedAlerts === IMMUTABLE_EMPTY_SET)
- this.associatedAlerts = new tr.model.EventSet();
- this.associatedAlerts.push(alert);
- },
-
- /** Adds the range of timestamps for this event to the specified range. */
- addBoundsToRange: function(range) {
- throw new Error('Not implemented');
- }
- };
-
- return {
- Event: Event
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/event_container.html b/chromium/third_party/catapult/tracing/tracing/model/event_container.html
deleted file mode 100644
index 48b5d943d37..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/event_container.html
+++ /dev/null
@@ -1,141 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/base/range.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
-
- /**
- * EventContainer is a base class for any class in the trace model that
- * contains child events or child EventContainers.
- *
- * For all EventContainers, updateBounds() must be called after modifying the
- * container's events if an up-to-date bounds is expected.
- *
- * @constructor
- */
- function EventContainer() {
- this.guid_ = tr.b.GUID.allocateSimple();
- this.important = true;
- this.bounds_ = new tr.b.Range();
- }
-
- EventContainer.prototype = {
- get guid() {
- return this.guid_;
- },
-
- /**
- * @return {String} A stable and unique identifier that describes this
- * container's position in the event tree relative to the root. If an event
- * container 'B' is a child to another event container 'A', then container
- * B's stable ID would be 'A.B'.
- */
- get stableId() {
- throw new Error('Not implemented');
- },
-
- /**
- * Returns the bounds of the event container, which describe the range
- * of timestamps for all ancestor events.
- */
- get bounds() {
- return this.bounds_;
- },
-
- // TODO(charliea): A default implementation of this method could likely be
- // provided that iterates throuch getDescendantEvents.
- /**
- * Updates the bounds of the event container. After updating, this.bounds
- * will describe the range of timestamps of all ancestor events.
- */
- updateBounds: function() {
- throw new Error('Not implemented');
- },
-
- // TODO(charliea): A default implementation of this method could likely be
- // provided that iterates through getDescendantEvents.
- /**
- * Shifts the timestamps for ancestor events by 'amount' milliseconds.
- */
- shiftTimestampsForward: function(amount) {
- throw new Error('Not implemented');
- },
-
-
- /**
- * Returns an iterable of all child events.
- */
- childEvents: function*() {
- },
-
- /**
- * Returns an iterable of all events in this and descendant
- * event containers.
- */
- getDescendantEvents: function*() {
- yield * this.childEvents();
- for (var container of this.childEventContainers())
- yield * container.getDescendantEvents();
- },
-
- /**
- * Returns an iterable of all child event containers.
- */
- childEventContainers: function*() {
- },
-
- /**
- * Returns an iterable containing this and all descendant event containers.
- */
- getDescendantEventContainers: function*() {
- yield this;
- for (var container of this.childEventContainers())
- yield * container.getDescendantEventContainers();
- },
-
- /**
- * Finds topmost slices in this container (see docstring for
- * findTopmostSlices).
- */
- findTopmostSlicesInThisContainer: function*(eventPredicate, opt_this) {
- },
-
- /**
- * The findTopmostSlices* series of helpers find all topmost slices
- * satisfying the given predicates.
- *
- * As an example, suppose we are trying to find slices named 'C', with the
- * following thread:
- *
- * -> |---C---| |-----D-----|
- * |-C-| |---C---| <-
- *
- * findTopmostSlices would locate the pointed-to Cs, because the bottom C on
- * the left is not the topmost C, and the right one is, even though it is
- * not itself a top-level slice.
- */
- findTopmostSlices: function*(eventPredicate) {
- for (var ec of this.getDescendantEventContainers())
- yield * ec.findTopmostSlicesInThisContainer(eventPredicate);
- },
-
- findTopmostSlicesNamed: function*(name) {
- yield * this.findTopmostSlices(e => e.title === name);
- }
- };
-
- return {
- EventContainer: EventContainer
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/event_info.html b/chromium/third_party/catapult/tracing/tracing/model/event_info.html
deleted file mode 100644
index 5c3ff53c813..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/event_info.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/color_scheme.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
- var ColorScheme = tr.b.ColorScheme;
-
- /**
- * EventInfo is an annotation added to Events in order to document
- * what they represent, and override their title/colorId values.
- *
- * TODO(ccraik): eventually support more complex structure/paragraphs.
- *
- * @param {string} title A user-visible title for the event.
- * @param {string} description A user-visible description of the event.
- * @param {Array} docLinks A list of Objects, each of the form
- * {label: str, textContent: str, href: str}
- *
- * @constructor
- */
- function EventInfo(title, description, docLinks) {
- this.title = title;
- this.description = description;
- this.docLinks = docLinks;
- this.colorId = ColorScheme.getColorIdForGeneralPurposeString(title);
- }
-
- return {
- EventInfo: EventInfo
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/event_registry.html b/chromium/third_party/catapult/tracing/tracing/model/event_registry.html
deleted file mode 100644
index ec2c1ebe3a8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/event_registry.html
+++ /dev/null
@@ -1,87 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/extension_registry.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the EventRegistry class.
- */
-tr.exportTo('tr.model', function() {
- // Create the type registry.
- function EventRegistry() {
- }
-
- var options = new tr.b.ExtensionRegistryOptions(tr.b.BASIC_REGISTRY_MODE);
- tr.b.decorateExtensionRegistry(EventRegistry, options);
-
- // Enforce all options objects have the right fields.
- EventRegistry.addEventListener('will-register', function(e) {
- var metadata = e.typeInfo.metadata;
-
- if (metadata.name === undefined)
- throw new Error('Registered events must provide name metadata');
- var i = tr.b.findFirstInArray(
- EventRegistry.getAllRegisteredTypeInfos(),
- function(x) { return x.metadata.name === metadata.name; });
- if (i !== undefined)
- throw new Error('Event type with that name already registered');
-
- if (metadata.pluralName === undefined)
- throw new Error('Registered events must provide pluralName metadata');
- if (metadata.singleViewElementName === undefined) {
- throw new Error('Registered events must provide ' +
- 'singleViewElementName metadata');
- }
- if (metadata.multiViewElementName === undefined) {
- throw new Error('Registered events must provide ' +
- 'multiViewElementName metadata');
- }
- });
-
- // Helper: lookup Events indexed by type name.
- var eventsByTypeName = undefined;
- EventRegistry.getEventTypeInfoByTypeName = function(typeName) {
- if (eventsByTypeName === undefined) {
- eventsByTypeName = {};
- EventRegistry.getAllRegisteredTypeInfos().forEach(function(typeInfo) {
- eventsByTypeName[typeInfo.metadata.name] = typeInfo;
- });
- }
- return eventsByTypeName[typeName];
- }
-
- // Ensure eventsByTypeName stays current.
- EventRegistry.addEventListener('registry-changed', function() {
- eventsByTypeName = undefined;
- });
-
- function convertCamelCaseToTitleCase(name) {
- var result = name.replace(/[A-Z]/g, ' $&');
- result = result.charAt(0).toUpperCase() + result.slice(1);
- return result;
- }
-
- EventRegistry.getUserFriendlySingularName = function(typeName) {
- var typeInfo = EventRegistry.getEventTypeInfoByTypeName(typeName);
- var str = typeInfo.metadata.name;
- return convertCamelCaseToTitleCase(str);
- };
-
- EventRegistry.getUserFriendlyPluralName = function(typeName) {
- var typeInfo = EventRegistry.getEventTypeInfoByTypeName(typeName);
- var str = typeInfo.metadata.pluralName;
- return convertCamelCaseToTitleCase(str);
- };
-
- return {
- EventRegistry: EventRegistry
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/event_set.html b/chromium/third_party/catapult/tracing/tracing/model/event_set.html
deleted file mode 100644
index c79ddc85302..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/event_set.html
+++ /dev/null
@@ -1,309 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/model/event_registry.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
-
- var EventRegistry = tr.model.EventRegistry;
-
- var RequestSelectionChangeEvent = tr.b.Event.bind(
- undefined, 'requestSelectionChange', true, false);
-
- /**
- * Represents a event set within a and its associated set of tracks.
- * @constructor
- */
- function EventSet(opt_events) {
- this.bounds_dirty_ = true;
- this.bounds_ = new tr.b.Range();
- this.length_ = 0;
- this.guid_ = tr.b.GUID.allocateSimple();
- this.pushed_guids_ = {};
-
- if (opt_events) {
- if (opt_events instanceof Array) {
- for (var i = 0; i < opt_events.length; i++)
- this.push(opt_events[i]);
- } else if (opt_events instanceof EventSet) {
- this.addEventSet(opt_events);
- } else {
- this.push(opt_events);
- }
- }
- }
- EventSet.prototype = {
- __proto__: Object.prototype,
-
- get bounds() {
- if (this.bounds_dirty_)
- this.resolveBounds_();
- return this.bounds_;
- },
-
- get duration() {
- if (this.bounds_.isEmpty)
- return 0;
- return this.bounds_.max - this.bounds_.min;
- },
-
- get length() {
- return this.length_;
- },
-
- get guid() {
- return this.guid_;
- },
-
- *[Symbol.iterator]() {
- for (var i = 0; i < this.length_; ++i)
- yield this[i];
- },
-
- clear: function() {
- for (var i = 0; i < this.length_; ++i)
- delete this[i];
- this.length_ = 0;
- this.bounds_dirty_ = true;
- },
-
- resolveBounds_: function() {
- this.bounds_.reset();
- for (var i = 0; i < this.length_; i++)
- this[i].addBoundsToRange(this.bounds_);
- this.bounds_dirty_ = false;
- },
-
- // push pushes only unique events.
- // If an event has been already pushed, do nothing.
- push: function(event) {
- if (event.guid == undefined)
- throw new Error('Event must have a GUID');
-
- if (this.contains(event))
- return event;
-
- this.pushed_guids_[event.guid] = true;
- this[this.length_++] = event;
- this.bounds_dirty_ = true;
- return event;
- },
-
- contains: function(event) {
- return this.pushed_guids_[event.guid];
- },
-
- indexOf: function(event) {
- for (var i = 0; i < this.length; i++) {
- if (this[i].guid === event.guid)
- return i;
- }
- return -1;
- },
-
- addEventSet: function(eventSet) {
- for (var i = 0; i < eventSet.length; i++)
- this.push(eventSet[i]);
- },
-
- subEventSet: function(index, count) {
- count = count || 1;
-
- var eventSet = new EventSet();
- eventSet.bounds_dirty_ = true;
- if (index < 0 || index + count > this.length_)
- throw new Error('Index out of bounds');
-
- for (var i = index; i < index + count; i++)
- eventSet.push(this[i]);
-
- return eventSet;
- },
-
- intersectionIsEmpty: function(otherEventSet) {
- return !this.some(function(event) {
- return otherEventSet.contains(event);
- });
- },
-
- equals: function(that) {
- if (this.length !== that.length)
- return false;
- for (var i = 0; i < this.length; i++) {
- var event = this[i];
- if (that.pushed_guids_[event.guid] === undefined)
- return false;
- }
- return true;
- },
-
- getEventsOrganizedByBaseType: function(opt_pruneEmpty) {
- var allTypeInfos = EventRegistry.getAllRegisteredTypeInfos();
-
- var events = this.getEventsOrganizedByCallback(function(event) {
- var maxEventIndex = -1;
- var maxEventTypeInfo = undefined;
-
- allTypeInfos.forEach(function(eventTypeInfo, eventIndex) {
- if (!(event instanceof eventTypeInfo.constructor))
- return;
- if (eventIndex > maxEventIndex) {
- maxEventIndex = eventIndex;
- maxEventTypeInfo = eventTypeInfo;
- }
- });
-
- if (maxEventIndex == -1) {
- console.log(event);
- throw new Error('Unrecognized event type');
- }
-
- return maxEventTypeInfo.metadata.name;
- });
-
- if (!opt_pruneEmpty) {
- allTypeInfos.forEach(function(eventTypeInfo) {
- if (events[eventTypeInfo.metadata.name] === undefined)
- events[eventTypeInfo.metadata.name] = new EventSet();
- });
- }
-
- return events;
- },
-
- getEventsOrganizedByTitle: function() {
- return this.getEventsOrganizedByCallback(function(event) {
- if (event.title === undefined)
- throw new Error('An event didn\'t have a title!');
- return event.title;
- });
- },
-
- getEventsOrganizedByCallback: function(cb) {
- var eventsByCallback = {};
- for (var i = 0; i < this.length; i++) {
- var event = this[i];
- var key = cb(event);
-
- if (key === undefined)
- throw new Error('An event could not be organized');
-
- if (eventsByCallback[key] === undefined)
- eventsByCallback[key] = new EventSet();
-
- eventsByCallback[key].push(event);
- }
- return eventsByCallback;
- },
-
- enumEventsOfType: function(type, func) {
- for (var i = 0; i < this.length_; i++)
- if (this[i] instanceof type)
- func(this[i]);
- },
-
- get userFriendlyName() {
- if (this.length === 0) {
- throw new Error('Empty event set');
- }
-
- var eventsByBaseType = this.getEventsOrganizedByBaseType(true);
- var eventTypeName = tr.b.dictionaryKeys(eventsByBaseType)[0];
-
- if (this.length === 1) {
- var tmp = EventRegistry.getUserFriendlySingularName(eventTypeName);
- return this[0].userFriendlyName;
- }
-
- var numEventTypes = tr.b.dictionaryLength(eventsByBaseType);
- if (numEventTypes !== 1) {
- return this.length + ' events of various types';
- }
-
- var tmp = EventRegistry.getUserFriendlyPluralName(eventTypeName);
- return this.length + ' ' + tmp;
- },
-
- filter: function(fn, opt_this) {
- var res = new EventSet();
-
- this.forEach(function(slice) {
- if (fn.call(this, slice))
- res.push(slice);
- }, opt_this);
-
- return res;
- },
-
- toArray: function() {
- var ary = [];
- for (var i = 0; i < this.length; i++)
- ary.push(this[i]);
- return ary;
- },
-
- forEach: function(fn, opt_this) {
- for (var i = 0; i < this.length; i++)
- fn.call(opt_this, this[i], i);
- },
-
- map: function(fn, opt_this) {
- var res = [];
- for (var i = 0; i < this.length; i++)
- res.push(fn.call(opt_this, this[i], i));
- return res;
- },
-
- every: function(fn, opt_this) {
- for (var i = 0; i < this.length; i++)
- if (!fn.call(opt_this, this[i], i))
- return false;
- return true;
- },
-
- some: function(fn, opt_this) {
- for (var i = 0; i < this.length; i++)
- if (fn.call(opt_this, this[i], i))
- return true;
- return false;
- },
-
- asDict: function() {
- var stable_ids = [];
- this.forEach(function(event) {
- stable_ids.push(event.stableId);
- });
- return {'events': stable_ids};
- }
- };
-
- EventSet.IMMUTABLE_EMPTY_SET = (function() {
- var s = new EventSet();
- s.resolveBounds_();
- s.push = function() {
- throw new Error('Cannot push to an immutable event set');
- };
- s.addEventSet = function() {
- throw new Error('Cannot add to an immutable event set');
- };
- Object.freeze(s);
- return s;
- })();
-
- return {
- EventSet: EventSet,
- RequestSelectionChangeEvent: RequestSelectionChangeEvent
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/event_set_test.html b/chromium/third_party/catapult/tracing/tracing/model/event_set_test.html
deleted file mode 100644
index 9fbfd995059..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/event_set_test.html
+++ /dev/null
@@ -1,326 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newModel = tr.c.TestUtils.newModel;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
-
- test('eventSetObject', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 1, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 5, {}, 1));
-
- var eventSet = new tr.model.EventSet();
- eventSet.push(t1.sliceGroup.slices[0]);
-
- assert.equal(eventSet.bounds.min, 1);
- assert.equal(eventSet.bounds.max, 4);
- assert.equal(eventSet[0], t1.sliceGroup.slices[0]);
-
- eventSet.push(t1.sliceGroup.slices[1]);
- assert.equal(eventSet.bounds.min, 1);
- assert.equal(eventSet.bounds.max, 6);
- assert.equal(eventSet[1], t1.sliceGroup.slices[1]);
-
- eventSet.clear();
- assert.equal(eventSet.length, 0);
- });
-
- test('iteration', function() {
- var eventSet = new tr.model.EventSet([{guid: 1}, {guid: 2}, {guid: 3}]);
-
- var expectedId = 1;
- for (var event of eventSet)
- assert.equal(event.guid, expectedId++);
- });
-
- test('uniqueContents', function() {
- var sample1 = {guid: 1};
- var sample2 = {guid: 2};
-
- var eventSet = new tr.model.EventSet();
-
- eventSet.push(sample1);
- eventSet.push(sample2);
- assert.equal(eventSet.length, 2);
-
- eventSet.push(sample1);
- assert.equal(eventSet.length, 2);
- });
-
- test('userFriendlyNameSingular', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 1, {}, 3));
- var selection = new tr.model.EventSet(t1.sliceGroup.slices[0]);
- assert.isDefined(selection.userFriendlyName);
- });
-
- test('userFriendlyNamePlural', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 1, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 2, {}, 3));
- var eventSet = new tr.model.EventSet([
- t1.sliceGroup.slices[0],
- t1.sliceGroup.slices[1]
- ]);
- assert.isDefined(eventSet.userFriendlyName);
- });
-
- test('userFriendlyNameMixedPlural', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 1, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 2, {}, 3));
-
- var i10 = new tr.model.ObjectInstance(
- {}, '0x1000', 'cat', 'name', 10);
- var s10 = i10.addSnapshot(10, {foo: 1});
-
- var eventSet = new tr.model.EventSet([
- t1.sliceGroup.slices[0],
- s10
- ]);
- assert.isDefined(eventSet.userFriendlyName);
- });
-
- test('groupEventsByTitle', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 1, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 2, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'b', 0, 3, {}, 3));
- var eventSet = new tr.model.EventSet([
- t1.sliceGroup.slices[0],
- t1.sliceGroup.slices[1],
- t1.sliceGroup.slices[2]
- ]);
-
- var eventsByTitle = eventSet.getEventsOrganizedByTitle();
- assert.equal(2, tr.b.dictionaryLength(eventsByTitle));
- assert.sameMembers(eventsByTitle['a'].toArray(),
- [t1.sliceGroup.slices[0], t1.sliceGroup.slices[1]]);
- assert.sameMembers(eventsByTitle['b'].toArray(),
- [t1.sliceGroup.slices[2]]);
- });
-
- test('groupEventsByCallback', function() {
- var a1 = new tr.model.ThreadSlice('', 'a', 0, 1, {}, 3);
- var a2 = new tr.model.ThreadSlice('', 'a', 0, 2, {}, 3);
- var b1 = new tr.model.ThreadSlice('', 'b', 0, 1, {}, 3);
- var eventSet = new tr.model.EventSet([a1, a2, b1]);
- function getEventKey(event) {
- return 's' + event.start;
- }
- var eventsByCallback = eventSet.getEventsOrganizedByCallback(getEventKey);
- assert.equal(2, tr.b.dictionaryLength(eventsByCallback));
- assert.sameMembers(eventsByCallback.s1.toArray(), [a1, b1]);
- assert.sameMembers(eventsByCallback.s2.toArray(), [a2]);
- });
-
- test('groupEventsByBaseType', function() {
- var a = new tr.model.ThreadSlice('', 'a', 0, 1, {}, 3);
- var b = new tr.model.ThreadSlice('', 'b', 0, 1, {}, 3);
- var c = new tr.model.AsyncSlice('', 'c', 0, 1, {}, 3);
- var eventSet = new tr.model.EventSet([a, b, c]);
- var eventsByBaseType = eventSet.getEventsOrganizedByBaseType(true);
- assert.equal(2, tr.b.dictionaryLength(eventsByBaseType));
- assert.sameMembers(eventsByBaseType.slice.toArray(), [a, b]);
- assert.sameMembers(eventsByBaseType.asyncSlice.toArray(), [c]);
-
- var eventsByBaseType = eventSet.getEventsOrganizedByBaseType(false);
- assert.isTrue(2 < tr.b.dictionaryLength(eventsByBaseType));
- assert.sameMembers(eventsByBaseType.slice.toArray(), [a, b]);
- assert.sameMembers(eventsByBaseType.asyncSlice.toArray(), [c]);
- for (var baseType in eventsByBaseType) {
- if (baseType !== 'slice' && baseType !== 'asyncSlice')
- assert.equal(0, eventsByBaseType[baseType].length);
- }
- });
-
- test('intersectionIsEmpty1', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 1, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 2, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'b', 0, 3, {}, 3));
-
- var set1 = new tr.model.EventSet([
- t1.sliceGroup.slices[0],
- t1.sliceGroup.slices[1],
- t1.sliceGroup.slices[2]
- ]);
- var set2 = new tr.model.EventSet([
- t1.sliceGroup.slices[2]
- ]);
- assert.isFalse(set1.intersectionIsEmpty(set2));
- });
-
- test('intersectionIsNonEmpty2', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 1, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 2, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'b', 0, 3, {}, 3));
-
- var set1 = new tr.model.EventSet([
- t1.sliceGroup.slices[0],
- t1.sliceGroup.slices[1]
- ]);
- var set2 = new tr.model.EventSet([
- t1.sliceGroup.slices[2]
- ]);
- assert.isTrue(set1.intersectionIsEmpty(set2));
- });
-
- test('equals', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 1, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'b', 0, 2, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'c', 0, 3, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'd', 0, 4, {}, 5));
-
- var eventSet1 = new tr.model.EventSet([
- t1.sliceGroup.slices[0],
- t1.sliceGroup.slices[1],
- t1.sliceGroup.slices[2]
- ]);
- var eventSet2 = new tr.model.EventSet([
- t1.sliceGroup.slices[1],
- t1.sliceGroup.slices[0],
- t1.sliceGroup.slices[2]
- ]);
- var eventSet3 = new tr.model.EventSet([
- t1.sliceGroup.slices[1],
- t1.sliceGroup.slices[0],
- t1.sliceGroup.slices[3]
- ]);
- var eventSet4 = new tr.model.EventSet([
- t1.sliceGroup.slices[1],
- t1.sliceGroup.slices[0]
- ]);
- assert.isTrue(eventSet1.equals(eventSet2));
- assert.isFalse(eventSet1.equals(eventSet3));
- assert.isFalse(eventSet1.equals(eventSet4));
- });
-
- test('filter', function() {
- var m = newModel(function(m) {
-
- var p = m.getOrCreateProcess(1);
- var t = p.getOrCreateThread(1);
-
- m.s0 = t.sliceGroup.pushSlice(newSliceEx(
- { title: 's0', start: 0.0, duration: 1.0 }));
- m.s1 = t.sliceGroup.pushSlice(newSliceEx(
- { title: 's1', start: 0.0, duration: 1.0 }));
- m.s2 = t.sliceGroup.pushSlice(newSliceEx(
- { title: 's2', start: 0.0, duration: 1.0 }));
-
- m.eventSet = new tr.model.EventSet([m.s0, m.s1, m.s2]);
- });
-
- var res = m.eventSet.filter(function(slice) {
- return slice.title === 's0';
- });
-
- assert.isTrue(res.equals(new tr.model.EventSet([m.s0])));
- });
-
- test('toArray', function() {
- var samples = [
- {guid: 1},
- {guid: 2}
- ];
- var eventSet = new tr.model.EventSet(samples);
-
- assert.deepEqual(eventSet.toArray(), samples);
- });
-
- test('asDict', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 1, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'b', 0, 2, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'c', 0, 3, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'd', 0, 4, {}, 5));
-
- var eventSet = new tr.model.EventSet([
- t1.sliceGroup.slices[0],
- t1.sliceGroup.slices[1],
- t1.sliceGroup.slices[2]
- ]);
-
- assert.deepEqual(
- {'events':
- ['1.1.SliceGroup.0', '1.1.SliceGroup.1', '1.1.SliceGroup.2']},
- eventSet.asDict());
- });
-
- test('immutableEmptySet', function() {
- var s = tr.model.EventSet.IMMUTABLE_EMPTY_SET;
- assert.lengthOf(s, 0);
- assert.isTrue(s.bounds.isEmpty);
-
- // Check that the iteration methods still work correctly.
- function throwOnCall() {
- throw new Error('This function should never be called!!!');
- }
- assert.deepEqual(s.map(throwOnCall), []);
- s.forEach(throwOnCall);
-
- // Check that the set is indeed immutable.
- assert.throws(function() { s[0] = b; });
- assert.throws(function() { s.push(b); });
- assert.throws(function() { s.addEventSet(new tr.model.EventSet()); });
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/event_test.html b/chromium/third_party/catapult/tracing/tracing/model/event_test.html
deleted file mode 100644
index 0d0deca55af..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/event_test.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/alert.html">
-<link rel="import" href="/tracing/model/event.html">
-<link rel="import" href="/tracing/model/event_info.html">
-<link rel="import" href="/tracing/model/event_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Alert = tr.model.Alert;
- var Event = tr.model.Event;
- var EventInfo = tr.model.EventInfo;
- var EventSet = tr.model.EventSet;
- var ImmutableEventSet = tr.model.ImmutableEventSet;
-
- test('checkModelItem', function() {
- var event = new Event;
- assert.equal(event.modelItem, event);
- });
-
- test('checkAssociatedAlerts', function() {
- var event = new Event();
- assert.strictEqual(event.associatedAlerts, EventSet.IMMUTABLE_EMPTY_SET);
- assert.sameMembers(event.associatedAlerts.toArray(), []);
-
- var info1 = new EventInfo('Critical', 'Critical alert!!!', []);
- var alert1 = new Alert(info1, 7);
- event.addAssociatedAlert(alert1);
- assert.instanceOf(event.associatedAlerts, EventSet);
- assert.sameMembers(event.associatedAlerts.toArray(), [alert1]);
-
- var info2 = new EventInfo('Warning', 'Warning alert???', []);
- var alert2 = new Alert(info2, 42);
- event.addAssociatedAlert(alert2);
- assert.instanceOf(event.associatedAlerts, EventSet);
- assert.sameMembers(event.associatedAlerts.toArray(), [alert1, alert2]);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/flow_event.html b/chromium/third_party/catapult/tracing/tracing/model/flow_event.html
deleted file mode 100644
index bffb8661a7d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/flow_event.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/timed_event.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the Flow class.
- */
-tr.exportTo('tr.model', function() {
- /**
- * A Flow represents an interval of time plus parameters associated
- * with that interval.
- *
- * @constructor
- */
- function FlowEvent(category, id, title, colorId, start, args, opt_duration) {
- tr.model.TimedEvent.call(this, start);
-
- this.category = category || '';
- this.title = title;
- this.colorId = colorId;
- this.start = start;
- this.args = args;
-
- this.id = id;
-
- this.startSlice = undefined;
- this.endSlice = undefined;
-
- this.startStackFrame = undefined;
- this.endStackFrame = undefined;
-
- if (opt_duration !== undefined)
- this.duration = opt_duration;
- }
-
- FlowEvent.prototype = {
- __proto__: tr.model.TimedEvent.prototype,
-
- get userFriendlyName() {
- return 'Flow event named ' + this.title + ' at ' +
- tr.v.Unit.byName.timeStampInMs.format(this.timestamp);
- }
- };
-
- tr.model.EventRegistry.register(
- FlowEvent,
- {
- name: 'flowEvent',
- pluralName: 'flowEvents',
- singleViewElementName: 'tr-ui-a-single-flow-event-sub-view',
- multiViewElementName: 'tr-ui-a-multi-flow-event-sub-view'
- });
-
- return {
- FlowEvent: FlowEvent
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/frame.html b/chromium/third_party/catapult/tracing/tracing/model/frame.html
deleted file mode 100644
index d6bc6195bf2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/frame.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/model/event.html">
-<link rel="import" href="/tracing/model/event_set.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Class describing rendered frames.
- *
- * Because a frame is produced by multiple threads, it does not inherit from
- * TimedEvent, and has no duration.
- */
-tr.exportTo('tr.model', function() {
- var ColorScheme = tr.b.ColorScheme;
- var Statistics = tr.b.Statistics;
-
- var FRAME_PERF_CLASS = {
- GOOD: 'good',
- BAD: 'bad',
- TERRIBLE: 'terrible',
- NEUTRAL: 'generic_work'
- };
-
- /**
- * @constructor
- * @param {Array} associatedEvents Selection of events composing the frame.
- * @param {Array} threadTimeRanges Array of {thread, start, end}
- * for each thread, describing the critical path of the frame.
- */
- function Frame(associatedEvents, threadTimeRanges, opt_args) {
- tr.model.Event.call(this);
-
- this.threadTimeRanges = threadTimeRanges;
- this.associatedEvents = new tr.model.EventSet(associatedEvents);
- this.args = opt_args || {};
-
- this.title = 'Frame';
- this.start = Statistics.min(
- threadTimeRanges, function(x) { return x.start; });
- this.end = Statistics.max(
- threadTimeRanges, function(x) { return x.end; });
- this.totalDuration = Statistics.sum(
- threadTimeRanges, function(x) { return x.end - x.start; });
-
- this.perfClass = FRAME_PERF_CLASS.NEUTRAL;
- };
-
- Frame.prototype = {
- __proto__: tr.model.Event.prototype,
-
- set perfClass(perfClass) {
- this.colorId = ColorScheme.getColorIdForReservedName(perfClass);
- this.perfClass_ = perfClass;
- },
-
- get perfClass() {
- return this.perfClass_;
- },
-
- shiftTimestampsForward: function(amount) {
- this.start += amount;
- this.end += amount;
-
- for (var i = 0; i < this.threadTimeRanges.length; i++) {
- this.threadTimeRanges[i].start += amount;
- this.threadTimeRanges[i].end += amount;
- }
- },
-
- addBoundsToRange: function(range) {
- range.addValue(this.start);
- range.addValue(this.end);
- }
- };
-
- tr.model.EventRegistry.register(
- Frame,
- {
- name: 'frame',
- pluralName: 'frames',
- singleViewElementName: 'tr-ui-a-single-frame-sub-view',
- multiViewElementName: 'tr-ui-a-multi-frame-sub-view'
- });
-
- return {
- Frame: Frame,
- FRAME_PERF_CLASS: FRAME_PERF_CLASS
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/global_memory_dump.html b/chromium/third_party/catapult/tracing/tracing/model/global_memory_dump.html
deleted file mode 100644
index 80bb03ff361..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/global_memory_dump.html
+++ /dev/null
@@ -1,870 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/container_memory_dump.html">
-<link rel="import" href="/tracing/model/event_registry.html">
-<link rel="import" href="/tracing/model/memory_allocator_dump.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the GlobalMemoryDump class.
- */
-tr.exportTo('tr.model', function() {
- /**
- * The GlobalMemoryDump represents a simultaneous memory dump of all
- * processes.
- * @constructor
- */
- function GlobalMemoryDump(model, start) {
- tr.model.ContainerMemoryDump.call(this, start);
- this.model = model;
- this.processMemoryDumps = {};
- }
-
- // Size numeric names.
- var SIZE_NUMERIC_NAME = tr.model.MemoryAllocatorDump.SIZE_NUMERIC_NAME;
- var EFFECTIVE_SIZE_NUMERIC_NAME =
- tr.model.MemoryAllocatorDump.EFFECTIVE_SIZE_NUMERIC_NAME;
-
- // Size numeric info types.
- var MemoryAllocatorDumpInfoType = tr.model.MemoryAllocatorDumpInfoType;
- var PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN =
- MemoryAllocatorDumpInfoType.PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN;
- var PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER =
- MemoryAllocatorDumpInfoType.PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER;
-
- // TODO(petrcermak): Move this to tracing/base/iteration_helpers.html.
- function inPlaceFilter(array, predicate, opt_this) {
- opt_this = opt_this || this;
- var nextPosition = 0;
- for (var i = 0; i < array.length; i++) {
- if (!predicate.call(opt_this, array[i], i))
- continue;
- if (nextPosition < i)
- array[nextPosition] = array[i]; // Move elements only if necessary.
- nextPosition++;
- }
-
- if (nextPosition < array.length)
- array.length = nextPosition; // Truncate the array only if necessary.
- }
-
- function getSize(dump) {
- var numeric = dump.numerics[SIZE_NUMERIC_NAME];
- if (numeric === undefined)
- return 0;
- return numeric.value;
- }
-
- function hasSize(dump) {
- return dump.numerics[SIZE_NUMERIC_NAME] !== undefined;
- }
-
- function optional(value, defaultValue) {
- if (value === undefined)
- return defaultValue;
- return value;
- }
-
- GlobalMemoryDump.prototype = {
- __proto__: tr.model.ContainerMemoryDump.prototype,
-
- get userFriendlyName() {
- return 'Global memory dump at ' +
- tr.v.Unit.byName.timeStampInMs.format(this.start);
- },
-
- get containerName() {
- return 'global space';
- },
-
- finalizeGraph: function() {
- // 1. Transitively remove weak memory allocator dumps and all their
- // owners and descendants from the model. This must be performed before
- // any other steps.
- this.removeWeakDumps();
-
- // 2. Add ownership links from tracing MADs to descendants of malloc or
- // winheap MADs so that tracing would be automatically discounted from
- // them later (step 3).
- this.setUpTracingOverheadOwnership();
-
- // 3. Aggregate all other numerics of all MADs (*excluding* sizes and
- // effective sizes) and propagate numerics from global MADs to their
- // owners (*including* sizes and effective sizes). This step must be
- // carried out before the sizes of all MADs are calculated (step 3).
- // Otherwise, the propagated sizes of all MADs would not be aggregated.
- this.aggregateNumerics();
-
- // 4. Calculate the sizes of all memory allocator dumps (MADs). This step
- // requires that the memory allocator dump graph has been finalized (step
- // 1) and numerics were propagated from global MADs (step 2). Subsequent
- // modifications of the graph will most likely break the calculation
- // invariants.
- this.calculateSizes();
-
- // 5. Calculate the effective sizes of all MADs. This step requires that
- // the sizes of all MADs have already been calculated (step 3).
- this.calculateEffectiveSizes();
-
- // 6. Discount tracing from VM regions stats. This steps requires that
- // resident sizes (step 2) and sizes (step 3) of the tracing MADs have
- // already been calculated.
- this.discountTracingOverheadFromVmRegions();
-
- // 7. The above steps (especially steps 1 and 3) can create new memory
- // allocator dumps, so we force rebuilding the memory allocator dump
- // indices of all container memory dumps.
- this.forceRebuildingMemoryAllocatorDumpByFullNameIndices();
- },
-
- removeWeakDumps: function() {
- // Mark all transitive owners and children of weak memory allocator dumps
- // as weak.
- this.traverseAllocatorDumpsInDepthFirstPreOrder(function(dump) {
- if (dump.weak)
- return;
- if ((dump.owns !== undefined && dump.owns.target.weak) ||
- (dump.parent !== undefined && dump.parent.weak)) {
- dump.weak = true;
- }
- });
-
- function removeWeakDumpsFromListRecursively(dumps) {
- inPlaceFilter(dumps, function(dump) {
- if (dump.weak) {
- // The dump is weak, so remove it. This will implicitly remove all
- // its descendants, which are also weak due to the initial marking
- // step.
- return false;
- }
-
- // This dump is non-weak, so keep it. Recursively remove its weak
- // descendants and ownership links from weak dumps instead.
- removeWeakDumpsFromListRecursively(dump.children);
- inPlaceFilter(dump.ownedBy, function(ownershipLink) {
- return !ownershipLink.source.weak;
- });
-
- return true;
- });
- }
-
- this.iterateContainerDumps(function(containerDump) {
- var memoryAllocatorDumps = containerDump.memoryAllocatorDumps;
- if (memoryAllocatorDumps !== undefined)
- removeWeakDumpsFromListRecursively(memoryAllocatorDumps);
- });
- },
-
- /**
- * Calculate the size of all memory allocator dumps in the dump graph.
- *
- * The size refers to the allocated size of a (sub)component. It is a
- * natural extension of the optional size numeric provided by
- * MemoryAllocatorDump(s):
- *
- * - If a MAD provides a size numeric, then its size is assumed to be
- * equal to it.
- * - If a MAD does not provide a size numeric, then its size is assumed
- * to be the maximum of (1) the size of the largest owner of the MAD
- * and (2) the aggregated size of the MAD's children.
- *
- * Metric motivation: "How big is a (sub)system?"
- *
- * Please refer to the Memory Dump Graph Metric Calculation design document
- * for more details (https://goo.gl/fKg0dt).
- */
- calculateSizes: function() {
- this.traverseAllocatorDumpsInDepthFirstPostOrder(
- this.calculateMemoryAllocatorDumpSize_.bind(this));
- },
-
- /**
- * Calculate the size of the given MemoryAllocatorDump. This method assumes
- * that the size of both the children and owners of the dump has already
- * been calculated.
- */
- calculateMemoryAllocatorDumpSize_: function(dump) {
- // This flag becomes true if the size numeric of the current dump should
- // be defined, i.e. if (1) the current dump's size numeric is defined,
- // (2) the size of at least one of its children is defined or (3) the
- // size of at least one of its owners is defined.
- var shouldDefineSize = false;
-
- // This helper function returns the value of the size numeric of the
- // given dependent memory allocator dump. If the numeric is defined, the
- // shouldDefineSize flag above is also set to true (because condition
- // (2) or (3) is satisfied). Otherwise, zero is returned (and the flag is
- // left unchanged).
- function getDependencySize(dependencyDump) {
- var numeric = dependencyDump.numerics[SIZE_NUMERIC_NAME];
- if (numeric === undefined)
- return 0;
- shouldDefineSize = true;
- return numeric.value;
- }
-
- // 1. Get the size provided by the dump. If present, define a function
- // for checking dependent size consistency (a dump must always be bigger
- // than all its children aggregated together and/or its largest owner).
- var sizeNumeric = dump.numerics[SIZE_NUMERIC_NAME];
- var size = 0;
- var checkDependencySizeIsConsistent = function() { /* no-op */ };
- if (sizeNumeric !== undefined) {
- size = sizeNumeric.value;
- shouldDefineSize = true;
- if (sizeNumeric.unit !== tr.v.Unit.byName.sizeInBytes_smallerIsBetter) {
- this.model.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Invalid unit of \'size\' numeric of memory allocator ' +
- 'dump ' + dump.quantifiedName + ': ' +
- sizeNumeric.unit.unitName + '.'
- });
- }
- checkDependencySizeIsConsistent = function(
- dependencySize, dependencyInfoType, dependencyName) {
- if (size >= dependencySize)
- return;
- this.model.importWarning({
- type: 'memory_dump_parse_error',
- message: 'Size provided by memory allocator dump \'' +
- dump.fullName + '\'' +
- tr.v.Unit.byName.sizeInBytes.format(size) +
- ') is less than ' + dependencyName + ' (' +
- tr.v.Unit.byName.sizeInBytes.format(dependencySize) + ').'
- });
- dump.infos.push({
- type: dependencyInfoType,
- providedSize: size,
- dependencySize: dependencySize
- });
- }.bind(this);
- }
-
- // 2. Aggregate size of children. The recursive function traverses all
- // descendants and ensures that double-counting due to ownership within a
- // subsystem is avoided.
- var aggregatedChildrenSize = 0;
- // Owned child dump name -> (Owner child dump name -> overlapping size).
- var allOverlaps = {};
- dump.children.forEach(function(childDump) {
- function aggregateDescendantDump(descendantDump) {
- // Don't count this descendant dump if it owns another descendant of
- // the current dump (would cause double-counting).
- var ownedDumpLink = descendantDump.owns;
- if (ownedDumpLink !== undefined &&
- ownedDumpLink.target.isDescendantOf(dump)) {
- // If the target owned dump is a descendant of a *different* child
- // of the the current dump (i.e. not childDump), then we remember
- // the ownership so that we could explain why the size of the
- // current dump is not equal to the sum of its children.
- var ownedChildDump = ownedDumpLink.target;
- while (ownedChildDump.parent !== dump)
- ownedChildDump = ownedChildDump.parent;
- if (childDump !== ownedChildDump) {
- var ownedBySiblingSize = getDependencySize(descendantDump);
- if (ownedBySiblingSize > 0) {
- var previousTotalOwnedBySiblingSize =
- ownedChildDump.ownedBySiblingSizes.get(childDump) || 0;
- var updatedTotalOwnedBySiblingSize =
- previousTotalOwnedBySiblingSize + ownedBySiblingSize;
- ownedChildDump.ownedBySiblingSizes.set(
- childDump, updatedTotalOwnedBySiblingSize);
- }
- }
- return;
- }
-
- // If this descendant dump is a leaf node, add its size to the
- // aggregated size.
- if (descendantDump.children.length === 0) {
- aggregatedChildrenSize += getDependencySize(descendantDump);
- return;
- }
-
- // If this descendant dump is an intermediate node, recurse down into
- // its children. Note that the dump's size is NOT added because it is
- // an aggregate of its children (would cause double-counting).
- descendantDump.children.forEach(aggregateDescendantDump);
- }
- aggregateDescendantDump(childDump);
- });
- checkDependencySizeIsConsistent(
- aggregatedChildrenSize,
- PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN,
- 'the aggregated size of its children');
-
- // 3. Calculate the largest owner size.
- var largestOwnerSize = 0;
- dump.ownedBy.forEach(function(ownershipLink) {
- var owner = ownershipLink.source;
- var ownerSize = getDependencySize(owner);
- largestOwnerSize = Math.max(largestOwnerSize, ownerSize);
- });
- checkDependencySizeIsConsistent(
- largestOwnerSize,
- PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER,
- 'the size of its largest owner');
-
- // If neither the dump nor any of its dependencies (children and owners)
- // provide a size, do NOT add a zero size numeric.
- if (!shouldDefineSize) {
- // The rest of the pipeline relies on size being either a valid
- // ScalarNumeric, or undefined.
- delete dump.numerics[SIZE_NUMERIC_NAME];
- return;
- }
-
- // A dump must always be bigger than all its children aggregated
- // together and/or its largest owner.
- size = Math.max(size, aggregatedChildrenSize, largestOwnerSize);
-
- dump.numerics[SIZE_NUMERIC_NAME] = new tr.v.ScalarNumeric(
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter, size);
-
- // Add a virtual child to make up for extra size of the dump with
- // respect to its children (if applicable).
- if (aggregatedChildrenSize < size &&
- dump.children !== undefined && dump.children.length > 0) {
- var virtualChild = new tr.model.MemoryAllocatorDump(
- dump.containerMemoryDump, dump.fullName + '/<unspecified>');
- virtualChild.parent = dump;
- dump.children.unshift(virtualChild);
- virtualChild.numerics[SIZE_NUMERIC_NAME] = new tr.v.ScalarNumeric(
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter,
- size - aggregatedChildrenSize);
- }
- },
-
- /**
- * Calculate the effective size of all memory allocator dumps in the dump
- * graph.
- *
- * The effective size refers to the amount of memory a particular component
- * is using/consuming. In other words, every (reported) byte of used memory
- * is uniquely attributed to exactly one component. Consequently, unlike
- * size, effective size is cumulative, i.e. the sum of the effective sizes
- * of (top-level) components is equal to the total amount of (reported)
- * used memory.
- *
- * Metric motivation: "How much memory does a (sub)system use?" or "For how
- * much memory should a (sub)system be 'charged'?"
- *
- * Please refer to the Memory Dump Graph Metric Calculation design document
- * for more details (https://goo.gl/fKg0dt).
- *
- * This method assumes that the size of all contained memory allocator
- * dumps has already been calculated [see calculateSizes()].
- */
- calculateEffectiveSizes: function() {
- // 1. Calculate not-owned and not-owning sub-sizes of all MADs
- // (depth-first post-order traversal).
- this.traverseAllocatorDumpsInDepthFirstPostOrder(
- this.calculateDumpSubSizes_.bind(this));
-
- // 2. Calculate owned and owning coefficients of owned and owner MADs
- // respectively (arbitrary traversal).
- this.traverseAllocatorDumpsInDepthFirstPostOrder(
- this.calculateDumpOwnershipCoefficient_.bind(this));
-
- // 3. Calculate cumulative owned and owning coefficients of all MADs
- // (depth-first pre-order traversal).
- this.traverseAllocatorDumpsInDepthFirstPreOrder(
- this.calculateDumpCumulativeOwnershipCoefficient_.bind(this));
-
- // 4. Calculate the effective sizes of all MADs (depth-first post-order
- // traversal).
- this.traverseAllocatorDumpsInDepthFirstPostOrder(
- this.calculateDumpEffectiveSize_.bind(this));
- },
-
- /**
- * Calculate not-owned and not-owning sub-sizes of a memory allocator dump
- * from its children's (sub-)sizes.
- *
- * Not-owned sub-size refers to the aggregated memory of all children which
- * is not owned by other MADs. Conversely, not-owning sub-size is the
- * aggregated memory of all children which do not own another MAD. The
- * diagram below illustrates these two concepts:
- *
- * ROOT 1 ROOT 2
- * size: 4 size: 5
- * not-owned sub-size: 4 not-owned sub-size: 1 (!)
- * not-owning sub-size: 0 (!) not-owning sub-size: 5
- *
- * ^ ^
- * | |
- *
- * PARENT 1 ===== owns =====> PARENT 2
- * size: 4 size: 5
- * not-owned sub-size: 4 not-owned sub-size: 5
- * not-owning sub-size: 4 not-owning sub-size: 5
- *
- * ^ ^
- * | |
- *
- * CHILD 1 CHILD 2
- * size [given]: 4 size [given]: 5
- * not-owned sub-size: 4 not-owned sub-size: 5
- * not-owning sub-size: 4 not-owning sub-size: 5
- *
- * This method assumes that (1) the size of the dump, its children, and its
- * owners [see calculateSizes()] and (2) the not-owned and not-owning
- * sub-sizes of both the children and owners of the dump have already been
- * calculated [depth-first post-order traversal].
- */
- calculateDumpSubSizes_: function(dump) {
- // Completely skip dumps with undefined size.
- if (!hasSize(dump))
- return;
-
- // If the dump is a leaf node, then both sub-sizes are equal to the size.
- if (dump.children === undefined || dump.children.length === 0) {
- var size = getSize(dump);
- dump.notOwningSubSize_ = size;
- dump.notOwnedSubSize_ = size;
- return;
- }
-
- // Calculate this dump's not-owning sub-size by summing up the not-owning
- // sub-sizes of children MADs which do not own another MAD.
- var notOwningSubSize = 0;
- dump.children.forEach(function(childDump) {
- if (childDump.owns !== undefined)
- return;
- notOwningSubSize += optional(childDump.notOwningSubSize_, 0);
- });
- dump.notOwningSubSize_ = notOwningSubSize;
-
- // Calculate this dump's not-owned sub-size.
- var notOwnedSubSize = 0;
- dump.children.forEach(function(childDump) {
- // If the child dump is not owned, then add its not-owned sub-size.
- if (childDump.ownedBy.length === 0) {
- notOwnedSubSize += optional(childDump.notOwnedSubSize_, 0);
- return;
- }
- // If the child dump is owned, then add the difference between its size
- // and the largest owner.
- var largestChildOwnerSize = 0;
- childDump.ownedBy.forEach(function(ownershipLink) {
- largestChildOwnerSize = Math.max(
- largestChildOwnerSize, getSize(ownershipLink.source));
- });
- notOwnedSubSize += getSize(childDump) - largestChildOwnerSize;
- });
- dump.notOwnedSubSize_ = notOwnedSubSize;
- },
-
- /**
- * Calculate owned and owning coefficients of a memory allocator dump and
- * its owners.
- *
- * The owning coefficient refers to the proportion of a dump's not-owning
- * sub-size which is attributed to the dump (only relevant to owning MADs).
- * Conversely, the owned coefficient is the proportion of a dump's
- * not-owned sub-size, which is attributed to it (only relevant to owned
- * MADs).
- *
- * The not-owned size of the owned dump is split among its owners in the
- * order of the ownership importance as demonstrated by the following
- * example:
- *
- * memory allocator dumps
- * OWNED OWNER1 OWNER2 OWNER3 OWNER4
- * not-owned sub-size [given] 10 - - - -
- * not-owning sub-size [given] - 6 7 5 8
- * importance [given] - 2 2 1 0
- * attributed not-owned sub-size 2 - - - -
- * attributed not-owning sub-size - 3 4 0 1
- * owned coefficient 2/10 - - - -
- * owning coefficient - 3/6 4/7 0/5 1/8
- *
- * Explanation: Firstly, 6 bytes are split equally among OWNER1 and OWNER2
- * (highest importance). OWNER2 owns one more byte, so its attributed
- * not-owning sub-size is 6/2 + 1 = 4 bytes. OWNER3 is attributed no size
- * because it is smaller than the owners with higher priority. However,
- * OWNER4 is larger, so it's attributed the difference 8 - 7 = 1 byte.
- * Finally, 2 bytes remain unattributed and are hence kept in the OWNED
- * dump as attributed not-owned sub-size. The coefficients are then
- * directly calculated as fractions of the sub-sizes and corresponding
- * attributed sub-sizes.
- *
- * Note that we always assume that all ownerships of a dump overlap (e.g.
- * OWNER3 is subsumed by both OWNER1 and OWNER2). Hence, the table could
- * be alternatively represented as follows:
- *
- * owned memory range
- * 0 1 2 3 4 5 6 7 8 9 10
- * Priority 2 | OWNER1 + OWNER2 (split) | OWNER2 |
- * Priority 1 | (already attributed) |
- * Priority 0 | - - - (already attributed) - - - | OWNER4 |
- * Remainder | - - - - - (already attributed) - - - - - - | OWNED |
- *
- * This method assumes that (1) the size of the dump [see calculateSizes()]
- * and (2) the not-owned size of the dump and not-owning sub-sizes of its
- * owners [see the first step of calculateEffectiveSizes()] have already
- * been calculated. Note that the method doesn't make any assumptions about
- * the order in which dumps are visited.
- */
- calculateDumpOwnershipCoefficient_: function(dump) {
- // Completely skip dumps with undefined size.
- if (!hasSize(dump))
- return;
-
- // We only need to consider owned dumps.
- if (dump.ownedBy.length === 0)
- return;
-
- // Sort the owners in decreasing order of ownership importance and
- // increasing order of not-owning sub-size (in case of equal importance).
- var owners = dump.ownedBy.map(function(ownershipLink) {
- return {
- dump: ownershipLink.source,
- importance: optional(ownershipLink.importance, 0),
- notOwningSubSize: optional(ownershipLink.source.notOwningSubSize_, 0)
- };
- });
- owners.sort(function(a, b) {
- if (a.importance === b.importance)
- return a.notOwningSubSize - b.notOwningSubSize;
- return b.importance - a.importance;
- });
-
- // Loop over the list of owners and distribute the owned dump's not-owned
- // sub-size among them according to their ownership importance and
- // not-owning sub-size.
- var currentImportanceStartPos = 0;
- var alreadyAttributedSubSize = 0;
- while (currentImportanceStartPos < owners.length) {
- var currentImportance = owners[currentImportanceStartPos].importance;
-
- // Find the position of the first owner with lower priority.
- var nextImportanceStartPos = currentImportanceStartPos + 1;
- while (nextImportanceStartPos < owners.length &&
- owners[nextImportanceStartPos].importance ===
- currentImportance) {
- nextImportanceStartPos++;
- }
-
- // Visit the owners with the same importance in increasing order of
- // not-owned sub-size, split the owned memory among them appropriately,
- // and calculate their owning coefficients.
- var attributedNotOwningSubSize = 0;
- for (var pos = currentImportanceStartPos; pos < nextImportanceStartPos;
- pos++) {
- var owner = owners[pos];
- var notOwningSubSize = owner.notOwningSubSize;
- if (notOwningSubSize > alreadyAttributedSubSize) {
- attributedNotOwningSubSize +=
- (notOwningSubSize - alreadyAttributedSubSize) /
- (nextImportanceStartPos - pos);
- alreadyAttributedSubSize = notOwningSubSize;
- }
-
- var owningCoefficient = 0;
- if (notOwningSubSize !== 0)
- owningCoefficient = attributedNotOwningSubSize / notOwningSubSize;
- owner.dump.owningCoefficient_ = owningCoefficient;
- }
-
- currentImportanceStartPos = nextImportanceStartPos;
- }
-
- // Attribute the remainder of the owned dump's not-owned sub-size to
- // the dump itself and calculate its owned coefficient.
- var notOwnedSubSize = optional(dump.notOwnedSubSize_, 0);
- var remainderSubSize = notOwnedSubSize - alreadyAttributedSubSize;
- var ownedCoefficient = 0;
- if (notOwnedSubSize !== 0)
- ownedCoefficient = remainderSubSize / notOwnedSubSize;
- dump.ownedCoefficient_ = ownedCoefficient;
- },
-
- /**
- * Calculate cumulative owned and owning coefficients of a memory allocator
- * dump from its (non-cumulative) owned and owning coefficients and the
- * cumulative coefficients of its parent and/or owned dump.
- *
- * The cumulative coefficients represent the total effect of all
- * (non-strict) ancestor ownerships on a memory allocator dump. The
- * cumulative owned coefficient of a MAD can be calculated simply as:
- *
- * cumulativeOwnedC(M) = ownedC(M) * cumulativeOwnedC(parent(M))
- *
- * This reflects the assumption that if a parent of a child MAD is
- * (partially) owned, then the parent's owner also indirectly owns (a part
- * of) the child MAD.
- *
- * The cumulative owning coefficient of a MAD depends on whether the MAD
- * owns another dump:
- *
- * [if M doesn't own another MAD]
- * / cumulativeOwningC(parent(M))
- * cumulativeOwningC(M) =
- * \ [if M owns another MAD]
- * owningC(M) * cumulativeOwningC(owned(M))
- *
- * The reasoning behind the first case is similar to the one for cumulative
- * owned coefficient above. The only difference is that we don't need to
- * include the dump's (non-cumulative) owning coefficient because it is
- * implicitly 1.
- *
- * The formula for the second case is derived as follows: Since the MAD
- * owns another dump, its memory is not included in its parent's not-owning
- * sub-size and hence shouldn't be affected by the parent's corresponding
- * cumulative coefficient. Instead, the MAD indirectly owns everything
- * owned by its owned dump (and so it should be affected by the
- * corresponding coefficient).
- *
- * Note that undefined coefficients (and coefficients of non-existent
- * dumps) are implicitly assumed to be 1.
- *
- * This method assumes that (1) the size of the dump [see calculateSizes()],
- * (2) the (non-cumulative) owned and owning coefficients of the dump [see
- * the second step of calculateEffectiveSizes()], and (3) the cumulative
- * coefficients of the dump's parent and owned MADs (if present)
- * [depth-first pre-order traversal] have already been calculated.
- */
- calculateDumpCumulativeOwnershipCoefficient_: function(dump) {
- // Completely skip dumps with undefined size.
- if (!hasSize(dump))
- return;
-
- var cumulativeOwnedCoefficient = optional(dump.ownedCoefficient_, 1);
- var parent = dump.parent;
- if (dump.parent !== undefined)
- cumulativeOwnedCoefficient *= dump.parent.cumulativeOwnedCoefficient_;
- dump.cumulativeOwnedCoefficient_ = cumulativeOwnedCoefficient;
-
- var cumulativeOwningCoefficient;
- if (dump.owns !== undefined) {
- cumulativeOwningCoefficient = dump.owningCoefficient_ *
- dump.owns.target.cumulativeOwningCoefficient_;
- } else if (dump.parent !== undefined) {
- cumulativeOwningCoefficient = dump.parent.cumulativeOwningCoefficient_;
- } else {
- cumulativeOwningCoefficient = 1;
- }
- dump.cumulativeOwningCoefficient_ = cumulativeOwningCoefficient;
- },
-
- /**
- * Calculate the effective size of a memory allocator dump.
- *
- * In order to simplify the (already complex) calculation, we use the fact
- * that effective size is cumulative (unlike regular size), i.e. the
- * effective size of a non-leaf node is equal to the sum of effective sizes
- * of its children. The effective size of a leaf MAD is calculated as:
- *
- * effectiveSize(M) = size(M) * cumulativeOwningC(M) * cumulativeOwnedC(M)
- *
- * This method assumes that (1) the size of the dump and its children [see
- * calculateSizes()] and (2) the cumulative owning and owned coefficients
- * of the dump (if it's a leaf node) [see the third step of
- * calculateEffectiveSizes()] or the effective sizes of its children (if
- * it's a non-leaf node) [depth-first post-order traversal] have already
- * been calculated.
- */
- calculateDumpEffectiveSize_: function(dump) {
- // Completely skip dumps with undefined size. As a result, each dump will
- // have defined effective size if and only if it has defined size.
- if (!hasSize(dump)) {
- // The rest of the pipeline relies on effective size being either a
- // valid ScalarNumeric, or undefined.
- delete dump.numerics[EFFECTIVE_SIZE_NUMERIC_NAME];
- return;
- }
-
- var effectiveSize;
- if (dump.children === undefined || dump.children.length === 0) {
- // Leaf dump.
- effectiveSize = getSize(dump) * dump.cumulativeOwningCoefficient_ *
- dump.cumulativeOwnedCoefficient_;
- } else {
- // Non-leaf dump.
- effectiveSize = 0;
- dump.children.forEach(function(childDump) {
- if (!hasSize(childDump))
- return;
- effectiveSize +=
- childDump.numerics[EFFECTIVE_SIZE_NUMERIC_NAME].value;
- });
- }
- dump.numerics[EFFECTIVE_SIZE_NUMERIC_NAME] = new tr.v.ScalarNumeric(
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter, effectiveSize);
- },
-
- aggregateNumerics: function() {
- // 1. Aggregate numerics in this global memory dump.
- this.iterateRootAllocatorDumps(function(dump) {
- dump.aggregateNumericsRecursively(this.model);
- });
-
- // 2. Propagate numerics and diagnostics from global memory allocator
- // dumps to their owners.
- this.iterateRootAllocatorDumps(
- this.propagateNumericsAndDiagnosticsRecursively);
-
- // 3. Aggregate numerics in the associated process memory dumps.
- tr.b.iterItems(this.processMemoryDumps, function(pid, processMemoryDump) {
- processMemoryDump.iterateRootAllocatorDumps(function(dump) {
- dump.aggregateNumericsRecursively(this.model);
- }, this);
- }, this);
- },
-
- propagateNumericsAndDiagnosticsRecursively: function(globalAllocatorDump) {
- ['numerics', 'diagnostics'].forEach(function(field) {
- tr.b.iterItems(globalAllocatorDump[field], function(name, value) {
- globalAllocatorDump.ownedBy.forEach(function(ownershipLink) {
- var processAllocatorDump = ownershipLink.source;
- if (processAllocatorDump[field][name] !== undefined) {
- // Numerics and diagnostics provided by process memory allocator
- // dumps themselves have precedence over numerics and diagnostics
- // propagated from global memory allocator dumps.
- return;
- }
- processAllocatorDump[field][name] = value;
- });
- });
- });
-
- // Recursively propagate numerics from all child memory allocator dumps.
- globalAllocatorDump.children.forEach(
- this.propagateNumericsAndDiagnosticsRecursively, this);
- },
-
- setUpTracingOverheadOwnership: function() {
- tr.b.iterItems(this.processMemoryDumps, function(pid, dump) {
- dump.setUpTracingOverheadOwnership(this.model);
- }, this);
- },
-
- discountTracingOverheadFromVmRegions: function() {
- // TODO(petrcermak): Consider factoring out all the finalization code and
- // constants to a single file.
- tr.b.iterItems(this.processMemoryDumps, function(pid, dump) {
- dump.discountTracingOverheadFromVmRegions(this.model);
- }, this);
- },
-
- forceRebuildingMemoryAllocatorDumpByFullNameIndices: function() {
- this.iterateContainerDumps(function(containerDump) {
- containerDump.forceRebuildingMemoryAllocatorDumpByFullNameIndex();
- });
- },
-
- iterateContainerDumps: function(fn) {
- fn.call(this, this);
- tr.b.iterItems(this.processMemoryDumps, function(pid, processDump) {
- fn.call(this, processDump);
- }, this);
- },
-
- iterateAllRootAllocatorDumps: function(fn) {
- this.iterateContainerDumps(function(containerDump) {
- containerDump.iterateRootAllocatorDumps(fn, this);
- });
- },
-
- /**
- * Traverse the memory dump graph in a depth first post-order, i.e.
- * children and owners of a memory allocator dump are visited before the
- * dump itself. This method will throw an exception if the graph contains
- * a cycle.
- */
- traverseAllocatorDumpsInDepthFirstPostOrder: function(fn) {
- var visitedDumps = new WeakSet();
- var openDumps = new WeakSet();
-
- function visit(dump) {
- if (visitedDumps.has(dump))
- return;
-
- if (openDumps.has(dump))
- throw new Error(dump.userFriendlyName + ' contains a cycle');
- openDumps.add(dump);
-
- // Visit owners before the dumps they own.
- dump.ownedBy.forEach(function(ownershipLink) {
- visit.call(this, ownershipLink.source);
- }, this);
-
- // Visit children before parents.
- dump.children.forEach(visit, this);
-
- // Actually visit the current memory allocator dump.
- fn.call(this, dump);
- visitedDumps.add(dump);
-
- openDumps.delete(dump);
- }
-
- this.iterateAllRootAllocatorDumps(visit);
- },
-
- /**
- * Traverse the memory dump graph in a depth first pre-order, i.e.
- * children and owners of a memory allocator dump are visited after the
- * dump itself. This method will not visit some dumps if the graph contains
- * a cycle.
- */
- traverseAllocatorDumpsInDepthFirstPreOrder: function(fn) {
- var visitedDumps = new WeakSet();
-
- function visit(dump) {
- if (visitedDumps.has(dump))
- return;
-
- // If this dumps owns another dump which hasn't been visited yet, then
- // wait for this dump to be visited later.
- if (dump.owns !== undefined && !visitedDumps.has(dump.owns.target))
- return;
-
- // If this dump's parent hasn't been visited yet, then wait for this
- // dump to be visited later.
- if (dump.parent !== undefined && !visitedDumps.has(dump.parent))
- return;
-
- // Actually visit the current memory allocator dump.
- fn.call(this, dump);
- visitedDumps.add(dump);
-
- // Visit owners after the dumps they own.
- dump.ownedBy.forEach(function(ownershipLink) {
- visit.call(this, ownershipLink.source);
- }, this);
-
- // Visit children after parents.
- dump.children.forEach(visit, this);
- }
-
- this.iterateAllRootAllocatorDumps(visit);
- }
- };
-
- tr.model.EventRegistry.register(
- GlobalMemoryDump,
- {
- name: 'globalMemoryDump',
- pluralName: 'globalMemoryDumps',
- singleViewElementName: 'tr-ui-a-container-memory-dump-sub-view',
- multiViewElementName: 'tr-ui-a-container-memory-dump-sub-view'
- });
-
- return {
- GlobalMemoryDump: GlobalMemoryDump
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/global_memory_dump_test.html b/chromium/third_party/catapult/tracing/tracing/model/global_memory_dump_test.html
deleted file mode 100644
index dbc472209d9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/global_memory_dump_test.html
+++ /dev/null
@@ -1,3944 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/importer/import.html">
-<link rel="import" href="/tracing/model/global_memory_dump.html">
-<link rel="import" href="/tracing/model/memory_allocator_dump.html">
-<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/process_memory_dump.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Model = tr.Model;
- var GlobalMemoryDump = tr.model.GlobalMemoryDump;
- var ProcessMemoryDump = tr.model.ProcessMemoryDump;
- var MemoryAllocatorDump = tr.model.MemoryAllocatorDump;
- var MemoryAllocatorDumpLink = tr.model.MemoryAllocatorDumpLink;
- var ScalarNumeric = tr.v.ScalarNumeric;
- var sizeInBytes_smallerIsBetter =
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
- var newAllocatorDump = tr.model.MemoryDumpTestUtils.newAllocatorDump;
- var addChildDump = tr.model.MemoryDumpTestUtils.addChildDump;
- var addOwnershipLink = tr.model.MemoryDumpTestUtils.addOwnershipLink;
- var checkDumpNumericsAndDiagnostics =
- tr.model.MemoryDumpTestUtils.checkDumpNumericsAndDiagnostics;
- var SIZE_DELTA = tr.model.MemoryDumpTestUtils.SIZE_DELTA;
- var MemoryAllocatorDumpInfoType = tr.model.MemoryAllocatorDumpInfoType;
- var PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN =
- MemoryAllocatorDumpInfoType.PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN;
- var PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER =
- MemoryAllocatorDumpInfoType.PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER;
-
- function buildArgPusher(array) {
- return function(arg) { array.push(arg); };
- }
-
- function assertEqualUniqueMembers(actualArray, expectedArray) {
- assert.lengthOf(actualArray, expectedArray.length);
- assert.sameMembers(actualArray, expectedArray);
- }
-
- function assertUndefinedNumeric(dump, numericName) {
- var numeric = dump.numerics[numericName];
- assert.isUndefined(numeric, 'expected numeric \'' + numericName +
- '\' of memory allocator dump \'' + dump.fullName + '\' in ' +
- dump.containerMemoryDump.userFriendlyName + ' to be undefined');
- }
-
- function assertDefinedNumeric(dump, numericName, expectedUnit, expectedValue,
- opt_delta) {
- var numeric = dump.numerics[numericName];
- var errorMessagePrefix = 'expected numeric \'' + numericName +
- '\' of memory allocator dump \'' + dump.fullName + '\' in ' +
- dump.containerMemoryDump.userFriendlyName + ' to ';
-
- assert.instanceOf(numeric, ScalarNumeric,
- errorMessagePrefix + 'be an instance of ScalarNumeric');
- assert.equal(numeric.unit, expectedUnit,
- errorMessagePrefix + 'have unit \'' + expectedUnit.unitName +
- '\' but got \'' + numeric.unit.unitName + '\' instead');
-
- var valueErrorMessage = errorMessagePrefix + 'have value \'' +
- expectedValue + '\' but got \'' + numeric.value + '\'';
- if (opt_delta !== undefined) {
- assert.closeTo(
- numeric.value, expectedValue, opt_delta, valueErrorMessage);
- } else {
- assert.equal(numeric.value, expectedValue, valueErrorMessage);
- }
- }
-
- function assertSizeNumeric(dump, sizeName, expectedValue) {
- if (expectedValue === undefined) {
- assertUndefinedNumeric(dump, sizeName);
- } else {
- assertDefinedNumeric(dump, sizeName, sizeInBytes_smallerIsBetter,
- expectedValue, SIZE_DELTA);
- }
- }
-
- function assertDumpSizes(dump, expectedSize, expectedEffectiveSize,
- opt_expectedInfos, opt_expectedOwnedBySiblingSizes) {
- // Check the 'size' numeric.
- assertSizeNumeric(dump, 'size', expectedSize);
-
- // Check the 'effective_size' numeric.
- assertSizeNumeric(dump, 'effective_size', expectedEffectiveSize);
-
- // Check the 'infos' list.
- var expectedInfos = opt_expectedInfos || [];
- var actualInfos = dump.infos;
- assert.lengthOf(actualInfos, expectedInfos.length,
- 'expected memory allocator dump \'' + dump.fullName + '\' in ' +
- dump.containerMemoryDump.userFriendlyName + ' to have ' +
- expectedInfos.length + ' infos but got ' + actualInfos.length);
- for (var k = 0; k < actualInfos.length; k++) {
- assert.deepEqual(actualInfos[k], expectedInfos[k],
- 'info ' + k + ' of memory allocator dump \'' + dump.fullName +
- '\' in ' + dump.containerMemoryDump.userFriendlyName +
- ' doesn\'t match the expected info');
- }
-
- // Checked the 'ownedBySiblingSizes' map.
- var expectedOwnedBySiblingSizes = opt_expectedOwnedBySiblingSizes || {};
- var actualOwnedBySiblingSizes = {};
- for (var siblingDump of dump.ownedBySiblingSizes.keys()) {
- assert.strictEqual(siblingDump.parent, dump.parent);
- actualOwnedBySiblingSizes[siblingDump.name] =
- dump.ownedBySiblingSizes.get(siblingDump);
- }
- assert.deepEqual(actualOwnedBySiblingSizes, expectedOwnedBySiblingSizes,
- 'ownedBySiblingSizes of memory allocator dump \'' + dump.fullName +
- '\' in ' + dump.containerMemoryDump.userFriendlyName +
- ' doesn\'t contain the expected values');
- }
-
- function createContainerDumps(processMemoryDumpCount, opt_model) {
- var model = opt_model;
- if (model === undefined)
- model = new Model();
-
- var gmd = new GlobalMemoryDump(model, 0);
- model.globalMemoryDumps.push(gmd);
-
- var pmds = [];
- for (var i = 0; i < processMemoryDumpCount; i++) {
- var process = model.getOrCreateProcess(i);
- var pmd = new ProcessMemoryDump(gmd, process, 0);
- gmd.processMemoryDumps[i] = pmd;
- process.memoryDumps.push(pmd);
- pmds.push(pmd);
- }
-
- return [gmd].concat(pmds);
- }
-
- /**
- * Build container memory dumps from tree recipes. This function returns
- * a list containing a global memory dump and zero or more process memory
- * dumps constructed from the provided function argument as follows:
- *
- * allTreeRecipes (argument):
- *
- * [
- * [tree recipe GA, tree recipe GB, ...],
- * [tree recipe P1A, tree recipe P1B, ...],
- * [tree recipe P2A, tree recipe P2B ...],
- * ...
- * ]
- *
- * return value:
- *
- * [
- * GlobalMemoryDump with root MemoryAllocatorDump(s) [GA, GB, ...],
- * ProcessMemoryDump with root MemoryAllocatorDump(s) [P1A, P1B, ...],
- * ProcessMemoryDump with root MemoryAllocatorDump(s) [P2A, P2B, ...],
- * ...
- * ]
- *
- * where a tree recipe is an object (a recursive data structure) with the
- * following fields:
- *
- * name: Name of the resulting MAD.
- * guid: GUID of the resulting MAD (can be undefined).
- * owns: GUID of another MAD owned by the resulting MAD (no owned MAD if
- * undefined).
- * importance: Importance of the above ownership (can be undefined).
- * size: Value of the 'size' numeric of the resulting MAD (no 'size'
- * numeric if undefined).
- * numerics: Extra numerics of the resulting MAD (dictionary).
- * diagnostics: Extra diagnostics of the resulting MAD (dictionary).
- * weak: Whether the resulting MAD should be weak (undefined implies
- * non-weak).
- * children: List of tree recipes for child MADs (no children if undefined).
- * skip_build: If this optional property is set to true, this function will
- * skip the corresponding tree recipe node and will not create a MAD
- * for it (not allowed in root recipes).
- *
- * Other fields (most importantly 'expected_size') of a tree recipe are
- * ignored by this function.
- */
- function buildDumpTrees(allTreeRecipes, opt_model) {
- assert.isAbove(allTreeRecipes.length, 0);
-
- var ownerDumps = {}; // owned GUID -> {dump: owner, importance: optional}.
- var ownableDumps = {}; // ownable GUID -> ownable dump.
-
- function buildAndAddDumpTrees(containerDump, treeRecipes) {
- if (treeRecipes === undefined)
- return;
-
- function buildDumpTreeRecursively(treeRecipe, namePrefix) {
- var skipBuild = treeRecipe['skip_build'];
- var name = treeRecipe['name'];
- var guid = treeRecipe['guid'];
- var owns = treeRecipe['owns'];
- var size = treeRecipe['size'];
- var numerics = treeRecipe['numerics'];
- var diagnostics = treeRecipe['diagnostics'];
- var importance = treeRecipe['importance'];
- var weak = treeRecipe['weak'];
-
- assert.notStrictEqual(skipBuild, true);
- assert.isDefined(name);
-
- var fullName = namePrefix + name;
- var dump = new MemoryAllocatorDump(containerDump, fullName, guid);
-
- if (size !== undefined) {
- dump.addNumeric(
- 'size', new ScalarNumeric(sizeInBytes_smallerIsBetter, size));
- }
- if (guid !== undefined) {
- assert.notProperty(guid, ownableDumps);
- ownableDumps[guid] = dump;
- }
- if (owns !== undefined) {
- if (!(owns in ownerDumps))
- ownerDumps[owns] = [];
- ownerDumps[owns].push({dump: dump, importance: importance});
- } else {
- assert.isUndefined(importance); // Test sanity check.
- }
-
- if (treeRecipe.children !== undefined) {
- treeRecipe.children.forEach(function(childTreeRecipe) {
- // Virtual children are added during size calculation.
- if (childTreeRecipe['skip_build'] === true)
- return;
- var childDump =
- buildDumpTreeRecursively(childTreeRecipe, fullName + '/');
- childDump.parent = dump;
- dump.children.push(childDump);
- });
- }
-
- if (numerics !== undefined)
- tr.b.iterItems(numerics, dump.addNumeric, dump);
- if (diagnostics !== undefined)
- tr.b.iterItems(diagnostics, dump.addDiagnostic, dump);
-
- if (weak)
- dump.weak = true;
-
- return dump;
- }
-
- var memoryAllocatorDumps = treeRecipes.map(function(treeRecipe) {
- return buildDumpTreeRecursively(treeRecipe, '');
- });
- containerDump.memoryAllocatorDumps = memoryAllocatorDumps;
- }
-
- // Recursively build memory allocator dump trees for all container dumps.
- var containerDumps = createContainerDumps(
- allTreeRecipes.length - 1, opt_model);
- for (var i = 0; i < allTreeRecipes.length; i++)
- buildAndAddDumpTrees(containerDumps[i], allTreeRecipes[i]);
-
- // Hook up ownership links.
- tr.b.iterItems(ownerDumps, function(ownedGuid, ownershipInfos) {
- var ownedDump = ownableDumps[ownedGuid];
- assert.isDefined(ownedDump, 'Tree recipes don\'t contain a memory ' +
- 'allocator dump with guid \'' + ownedGuid + '\'');
-
- ownershipInfos.forEach(function(ownershipInfo) {
- addOwnershipLink(
- ownershipInfo.dump, ownedDump, ownershipInfo.importance);
- });
- });
-
- return containerDumps;
- }
-
- // Check that the buildDumpTrees testing helper method above builds a
- // hierarchy of container and memory allocator dumps from tree recipes
- // correctly.
- test('testSanityCheck_buildDumpTrees', function() {
- var containerDumps = buildDumpTrees([
- [ // GMD.
- {
- 'name': 'globalSharedDump1',
- 'size': 123
- },
- {
- 'name': 'globalSharedDump2',
- 'subsystem_size': 999,
- 'owns': 7,
- 'importance': -1
- }
- ],
- undefined, // PMD1.
- [ // PMD2.
- {
- 'name': 'v8',
- 'children': [
- {
- 'name': 'isolate1',
- 'guid': 7,
- 'weak': true
- },
- {
- 'name': 'isolate2',
- 'skip_build': true
- },
- {
- 'name': 'isolate3',
- 'size': 54,
- 'guid': 60,
- 'children': [
- {
- 'name': 'obj1',
- 'size': 89,
- 'guid': 3
- },
- {
- 'name': 'obj2',
- 'owns': 3,
- 'weak': true
- },
- {
- 'name': 'obj3',
- 'owns': 3,
- 'importance': 2
- }
- ]
- }
- ]
- }
- ]
- ]);
- assert.lengthOf(containerDumps, 3);
- var gmd = containerDumps[0];
- var pmd1 = containerDumps[1];
- var pmd2 = containerDumps[2];
-
- function checkDump(dump, expectedGuid, expectedFullName, expectedParent,
- expectedChildrenCount, expectedSize, expectedIsOwner,
- expectedOwnersCount, expectedContainerDump, opt_expectedWeak) {
- assert.isDefined(dump);
- assert.instanceOf(dump, MemoryAllocatorDump);
- assert.strictEqual(dump.guid, expectedGuid);
- assert.strictEqual(dump.fullName, expectedFullName);
- assert.strictEqual(dump.parent, expectedParent);
- assert.lengthOf(dump.children, expectedChildrenCount);
-
- assertSizeNumeric(dump, 'size', expectedSize);
- assertSizeNumeric(dump, 'subsystem_size', undefined);
-
- if (expectedIsOwner)
- assert.isDefined(dump.owns);
- else
- assert.isUndefined(dump.owns);
- assert.lengthOf(dump.ownedBy, expectedOwnersCount);
-
- assert.strictEqual(dump.containerMemoryDump, expectedContainerDump);
- assert.strictEqual(expectedContainerDump.getMemoryAllocatorDumpByFullName(
- expectedFullName), dump);
- assert.strictEqual(dump.weak, !!opt_expectedWeak);
- }
-
- function checkOwnershipLink(expectedSourceDump, expectedTargetDump,
- expectedImportance) {
- var link = expectedSourceDump.owns;
- assert.isDefined(link);
- assert.instanceOf(link, MemoryAllocatorDumpLink);
- assert.strictEqual(link.source, expectedSourceDump);
- assert.strictEqual(link.target, expectedTargetDump);
- assert.strictEqual(link.importance, expectedImportance);
- assert.include(expectedTargetDump.ownedBy, link);
- }
-
- // GMD memory allocator dumps.
- assert.lengthOf(gmd.memoryAllocatorDumps, 2);
- var globalSharedDump1 = gmd.memoryAllocatorDumps[0];
- checkDump(globalSharedDump1, undefined, 'globalSharedDump1', undefined, 0,
- 123, false, 0, gmd);
- var globalSharedDump2 = gmd.memoryAllocatorDumps[1];
- checkDump(globalSharedDump2, undefined, 'globalSharedDump2', undefined, 0,
- undefined, true, 0, gmd);
-
- // PMD1 memory allocator dumps.
- assert.isUndefined(pmd1.memoryAllocatorDumps);
-
- // PMD2 memory allocator dumps.
- assert.lengthOf(pmd2.memoryAllocatorDumps, 1);
- var v8Dump = pmd2.memoryAllocatorDumps[0];
- checkDump(v8Dump, undefined, 'v8', undefined, 2, undefined, false, 0,
- pmd2);
- var isolate1Dump = v8Dump.children[0];
- checkDump(isolate1Dump, 7, 'v8/isolate1', v8Dump, 0, undefined, false, 1,
- pmd2, true /* weak dump */);
- var isolate3Dump = v8Dump.children[1];
- checkDump(isolate3Dump, 60, 'v8/isolate3', v8Dump, 3, 54, false, 0, pmd2);
- var obj1Dump = isolate3Dump.children[0];
- checkDump(obj1Dump, 3, 'v8/isolate3/obj1', isolate3Dump, 0, 89, false, 2,
- pmd2);
- var obj2Dump = isolate3Dump.children[1];
- checkDump(obj2Dump, undefined, 'v8/isolate3/obj2', isolate3Dump, 0,
- undefined, true, 0, pmd2, true /* weak dump */);
- var obj3Dump = isolate3Dump.children[2];
- checkDump(obj3Dump, undefined, 'v8/isolate3/obj3', isolate3Dump, 0,
- undefined, true, 0, pmd2);
-
- // Ownership links.
- checkOwnershipLink(globalSharedDump2, isolate1Dump, -1);
- checkOwnershipLink(obj2Dump, obj1Dump, undefined);
- checkOwnershipLink(obj3Dump, obj1Dump, 2);
- });
-
- /**
- * Check that container memory dumps have the expected structure with sizes
- * as described by tree recipes. The fields of a tree recipe are used by this
- * function to check the properties of a MemoryAllocatorDump as follows (see
- * the buildDumpTrees documentation for more details about the structure of
- * tree recipes):
- *
- * name: Expected name of the MAD.
- * expected_removed: If provided and true, it is expected that there is no
- * dump for the recipe.
- * expected_size: Expected value of the 'size' numeric of the MAD (no
- * 'size' numeric expected if undefined).
- * expected_effective_size: Expected value of the 'effective_size'
- * numeric of the MAD (no 'effective_size' numeric expected if
- * undefined).
- * expected_infos: List of expected MAD infos (zero infos expected if
- * undefined).
- * weak: Whether the MAD is expected to be weak (non-weak if undefined).
- * owns: Expected GUID of the dump owned by the MAD.
- * importance: Expected importance of the owhership from this MAD.
- * expected_owned_by_links_count: Expected number of 'ownedBy' links of the
- * MAD.
- * children: List of tree recipes for child MADs (no children expected if
- * undefined).
- *
- * Other fields of a tree recipe (including 'skip_build') are ignored by this
- * function.
- */
- function checkDumpTrees(containerDumps, allTreeRecipes) {
- assert.lengthOf(containerDumps, allTreeRecipes.length);
-
- for (var i = 0; i < containerDumps.length; i++) {
- var containerDump = containerDumps[i];
- var treeRecipes = allTreeRecipes[i];
-
- var memoryAllocatorDumps = containerDump.memoryAllocatorDumps;
- if (treeRecipes === undefined) {
- assert.isUndefined(memoryAllocatorDumps,
- 'expected undefined memory allocator dumps in ' +
- containerDump.userFriendlyName);
- continue;
- }
-
- var expectedTreeRecipes = treeRecipes.filter(function(treeRecipe) {
- return !treeRecipe['expected_removed'];
- });
-
- assert.isDefined(memoryAllocatorDumps,
- 'expected defined memory allocator dumps in ' +
- containerDump.userFriendlyName);
- assert.lengthOf(memoryAllocatorDumps, expectedTreeRecipes.length,
- 'expected ' + expectedTreeRecipes.length + ' root memory allocator ' +
- 'dumps but got ' + memoryAllocatorDumps.length + ' in ' +
- containerDump.userFriendlyName);
-
- function checkDumpTree(dump, treeRecipe, expectedParent, namePrefix) {
- // Test sanity check.
- assert.isFalse(!!treeRecipe['expected_removed']);
-
- // Check full name, parent, and container dump.
- var expectedFullName = namePrefix + treeRecipe['name'];
- var quantifiedName = dump.quantifiedName;
- assert.equal(dump.fullName, expectedFullName,
- quantifiedName + ' has invalid full name');
- assert.strictEqual(dump.parent, expectedParent,
- quantifiedName + ' has invalid parent');
- assert.strictEqual(dump.containerMemoryDump, containerDump,
- quantifiedName + ' has invalid container memory dump');
- assert.strictEqual(containerDump.getMemoryAllocatorDumpByFullName(
- expectedFullName), dump, quantifiedName +
- 'is not indexed in its container memory dump');
-
- // Check the guid of the dump.
- assert.strictEqual(dump.guid, treeRecipe['guid'],
- quantifiedName + ' has invalid guid');
-
- // Check that the 'weak' flag is correct.
- assert.strictEqual(dump.weak, !!treeRecipe['weak'],
- quantifiedName + ' has invalid weak flag');
-
- // Check that sizes were calculated correctly.
- assertDumpSizes(dump,
- treeRecipe['expected_size'],
- treeRecipe['expected_effective_size'],
- treeRecipe['expected_infos'],
- treeRecipe['expected_owned_by_sibling_sizes']);
-
- // Check that the 'owns' link is correct.
- if (treeRecipe['owns'] === undefined) {
- assert.isUndefined(dump.owns,
- quantifiedName + ' was expected not to own another dump');
- } else {
- var ownershipLink = dump.owns;
- assert.isDefined(dump.owns, quantifiedName +
- ' was expected to have an \'owns\' link');
- assert.strictEqual(ownershipLink.source, dump,
- 'the \'owns\' link of ' + quantifiedName + ' has invalid source');
- var expectedImportance = treeRecipe['importance'];
- assert.strictEqual(ownershipLink.importance, expectedImportance,
- 'expected the importance of the \'owns\' link of ' +
- quantifiedName + ' to be ' + expectedImportance +
- ' but got ' + ownershipLink.importance);
- var ownedDump = ownershipLink.target;
- assert.strictEqual(ownedDump.guid, treeRecipe['owns'],
- 'the \'owns\' link of ' + quantifiedName +
- ' has an invalid target');
- assert.include(ownedDump.ownedBy, ownershipLink,
- 'the target of the \'owns\' link of ' + quantifiedName +
- ' doesn\'t have the link in its \'ownedBy\' list');
- }
-
- // Check that the number of 'ownedBy' links is correct.
- var expectedOwnedByLinksCount =
- treeRecipe['expected_owned_by_links_count'];
- if (expectedOwnedByLinksCount !== undefined) {
- assert.lengthOf(dump.ownedBy, expectedOwnedByLinksCount,
- 'expected ' + quantifiedName + ' to have ' +
- expectedOwnedByLinksCount + ' \'ownedBy\' links but got ' +
- dump.ownedBy.length);
- }
-
- // Check children recursively.
- var actualChildren = dump.children;
- var expectedChildren = (treeRecipe.children || []).filter(
- function(childRecipe) {
- return !childRecipe['expected_removed'];
- });
- assert.lengthOf(actualChildren, expectedChildren.length,
- 'expected ' + quantifiedName + ' to have ' +
- expectedChildren.length + ' children but got ' +
- actualChildren.length);
- for (var k = 0; k < actualChildren.length; k++) {
- checkDumpTree(actualChildren[k], expectedChildren[k], dump,
- expectedFullName + '/');
- }
- }
-
- for (var j = 0; j < memoryAllocatorDumps.length; j++) {
- checkDumpTree(
- memoryAllocatorDumps[j], expectedTreeRecipes[j], undefined, '');
- }
- }
- }
-
- // Check that the checkDumpTrees testing helper method above actually
- // performs the expected checks. Since it will be used heavily throughout
- // this file (where it is expected to pass), we only need to verify that it
- // does indeed fail in several cases where it should.
- test('testSanityCheck_checkDumpTrees_invalidName', function() {
- var containerDumps = createContainerDumps(0);
- var gmd = containerDumps[0];
- var v8Dump = new MemoryAllocatorDump(gmd, 'v8');
- var heapsDump =
- new MemoryAllocatorDump(gmd, 'heaps'); // Should be 'v8/heaps'.
- v8Dump.children.push(heapsDump);
- heapsDump.parent = v8Dump;
- gmd.memoryAllocatorDumps = [v8Dump];
-
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'v8',
- 'children': [
- {
- 'name': 'heaps'
- }
- ]
- }
- ]
- ]);
- }, /'heaps'.*invalid full name/);
- });
-
- test('testSanityCheck_checkDumpTrees_invalidGuid', function() {
- var containerDumps = createContainerDumps(0);
- var gmd = containerDumps[0];
- gmd.memoryAllocatorDumps = [new MemoryAllocatorDump(gmd, 'v8', 42)];
-
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'v8',
- 'guid': 43 // This should be 42.
- }
- ]
- ]);
- }, /'v8'.*\binvalid guid\b/);
- });
-
- test('testSanityCheck_checkDumpTrees_invalidStructure', function() {
- var containerDumps = createContainerDumps(0);
- var gmd = containerDumps[0];
- var rootDump = new MemoryAllocatorDump(gmd, 'root');
- addChildDump(rootDump, 'child1');
- gmd.memoryAllocatorDumps = [rootDump];
-
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'root',
- 'children': [
- {
- 'name': 'child1'
- },
- {
- // This child is not present in the dump.
- 'name': 'child2',
- 'skip_build': true
- }
- ]
- }
- ]
- ]);
- }, /expected.*\b2\b.*children.*got.*\b1\b/);
- });
-
- test('testSanityCheck_checkDumpTrees_invalidParentLink', function() {
- var containerDumps = createContainerDumps(0);
- var gmd = containerDumps[0];
- var rootDump = new MemoryAllocatorDump(gmd, 'root');
- var parentDump = addChildDump(rootDump, 'parent');
- var childDump = addChildDump(parentDump, 'child');
- childDump.parent = rootDump; // This should correctly be parentDump.
- gmd.memoryAllocatorDumps = [rootDump];
-
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'root',
- 'children': [
- {
- 'name': 'parent',
- 'children': [
- {
- 'name': 'child'
- }
- ]
- }
- ]
- }
- ]
- ]);
- }, 'invalid parent');
- });
-
- test('testSanityCheck_checkDumpTrees_invalidSize', function() {
- var containerDumps = createContainerDumps(1);
- var gmd = containerDumps[0];
- var pmd = containerDumps[1];
- var rootDump = newAllocatorDump(pmd, 'root', { size: 100 });
- addChildDump(rootDump, 'parent', { size: 49 });
- pmd.memoryAllocatorDumps = [rootDump];
-
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- undefined,
- [
- {
- 'name': 'root',
- 'expected_size': 100,
- 'children': [
- {
- 'name': 'parent',
- 'expected_size': 50 // This should be 49.
- }
- ]
- }
- ]
- ]);
- }, /expected.*'size'.*value.*\b50\b.*got.*\b49\b/);
- });
-
- test('testSanityCheck_checkDumpTrees_invalidEffectiveSize', function() {
- var containerDumps = createContainerDumps(1);
- var gmd = containerDumps[0];
- var pmd = containerDumps[1];
- var rootDump = newAllocatorDump(pmd, 'root', { effective_size: 99 });
- addChildDump(rootDump, 'parent', { effective_size: 50 });
- pmd.memoryAllocatorDumps = [rootDump];
-
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- undefined,
- [
- {
- 'name': 'root',
- 'expected_effective_size': 100, // This should be 99.
- 'children': [
- {
- 'name': 'parent',
- 'expected_effective_size': 50
- }
- ]
- }
- ]
- ]);
- }, /expected.*'effective_size'.*value.*\b100\b.*got.*\b99\b/);
- });
-
- test('testSanityCheck_checkDumpTrees_invalidInfoCount', function() {
- var containerDumps = createContainerDumps(0);
- var gmd = containerDumps[0];
- gmd.memoryAllocatorDumps = [
- newAllocatorDump(gmd, 'v8', {
- size: 50
- })
- ];
-
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'v8',
- 'expected_size': 50,
- 'expected_infos': [
- {
- type: PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN,
- providedSize: 50,
- dependencySize: 60
- }
- ]
- }
- ]
- ]);
- }, /expected.*'v8'.*\b1 infos\b.*\bgot\b.*\b0\b/);
- });
-
- test('testSanityCheck_checkDumpTrees_invalidInfo', function() {
- var containerDumps = createContainerDumps(0);
- var gmd = containerDumps[0];
- var v8Dump = newAllocatorDump(gmd, 'v8', { size: 50 });
- v8Dump.infos.push({
- type: PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN,
- providedSize: 40,
- dependencySize: 50
- });
- gmd.memoryAllocatorDumps = [v8Dump];
-
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'v8',
- 'expected_size': 50,
- 'expected_infos': [
- {
- // Should be PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN below.
- type: PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER,
- providedSize: 40,
- dependencySize: 50
- }
- ]
- }
- ]
- ]);
- }, /\binfo 0\b.*'v8'.*\bexpected\b/);
- });
-
- test('testSanityCheck_checkDumpTrees_invalidOwnedBySiblingSizes', function() {
- var containerDumps = createContainerDumps(0);
- var gmd = containerDumps[0];
- var v8Dump = new MemoryAllocatorDump(gmd, 'v8');
- addChildDump(v8Dump, 'child1', {}, 42 /* guid */);
- addChildDump(v8Dump, 'child2');
- gmd.memoryAllocatorDumps = [v8Dump];
-
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'v8',
- 'children': [
- {
- 'name': 'child1',
- 'guid': 42
- },
- {
- 'name': 'child2',
- 'expected_owned_by_sibling_sizes': {
- 'child1': 40 // This should be 30.
- }
- }
- ]
- }
- ]
- ]);
- }, /\bownedBySiblingSizes\b.*'v8\/child2'.*\bexpected\b/);
- });
-
- test('testSanityCheck_checkDumpTrees_invalidWeakFlag',
- function() {
- var containerDumps = createContainerDumps(0);
- var gmd = containerDumps[0];
- var parentDump = new MemoryAllocatorDump(gmd, 'parent');
- var childDump = addChildDump(parentDump, 'child');
- childDump.weak = true;
- gmd.memoryAllocatorDumps = [parentDump];
-
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'parent',
- 'children': [
- {
- 'name': 'child',
- // Missing "'weak': true".
- }
- ]
- }
- ]
- ]);
- }, /'parent\/child'.*\binvalid weak flag\b/);
-
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'parent',
- 'weak': true, // This should be false (or not provided).
- 'children': [
- {
- 'name': 'child',
- 'weak': true
- }
- ]
- }
- ]
- ]);
- }, /'parent'.*\binvalid weak flag\b/);
- });
-
- test('testSanityCheck_checkDumpTrees_dumpNotRemoved', function() {
- var containerDumps = createContainerDumps(0);
- var gmd = containerDumps[0];
- var parentDump = new MemoryAllocatorDump(gmd, 'parent');
- for (var i = 1; i <= 3; i++)
- addChildDump(parentDump, 'child' + i);
- var otherDump = new MemoryAllocatorDump(gmd, 'other');
- gmd.memoryAllocatorDumps = [parentDump, otherDump];
-
- // Child MAD not removed.
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'parent',
- 'children': [
- {
- 'name': 'child1',
- },
- {
- 'name': 'child2',
- 'expected_removed': true
- },
- {
- 'name': 'child3',
- }
- ]
- },
- {
- 'name': 'other'
- }
- ]
- ]);
- }, /\bexpected\b.*'parent'.*\b2 children\b.*\bgot 3\b/);
-
- // Root MAD not removed.
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'parent',
- 'children': [
- {
- 'name': 'child1',
- },
- {
- 'name': 'child2'
- },
- {
- 'name': 'child3',
- }
- ]
- },
- {
- 'name': 'other',
- 'expected_removed': true
- }
- ]
- ]);
- }, /\bexpected\b.*\b1 root memory allocator dumps\b.*\bgot 2\b/);
- });
-
- test('testSanityCheck_checkDumpTrees_invalidOwnership', function() {
- var containerDumps = createContainerDumps(1);
- var gmd = containerDumps[0];
- var pmd1 = containerDumps[1];
- var ownedDump = new MemoryAllocatorDump(gmd, 'owned', 42);
- var ownerDump1 = new MemoryAllocatorDump(pmd1, 'owner1');
- var link1 = addOwnershipLink(ownerDump1, ownedDump);
- var ownerDump2 = new MemoryAllocatorDump(pmd1, 'owner2');
- var link2 = addOwnershipLink(ownerDump2, ownedDump, 3);
- var nonOwnerDump = new MemoryAllocatorDump(pmd1, 'non-owner', 90);
- gmd.memoryAllocatorDumps = [ownedDump];
- pmd1.memoryAllocatorDumps = [ownerDump1, ownerDump2, nonOwnerDump];
-
- // Missing 'owns' link.
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'owned',
- 'guid': 42
- }
- ],
- [
- {
- 'name': 'owner1',
- 'owns': 42
- },
- {
- 'name': 'owner2',
- 'importance': 3,
- 'owns': 42
- },
- {
- 'name': 'non-owner',
- 'guid': 90,
- 'owns': 42 // This should not be here.
- }
- ]
- ]);
- }, /'non-owner'.*\bwas expected to have\b.*'owns' link\b/);
-
- // Extra 'owns' link.
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'owned',
- 'guid': 42
- }
- ],
- [
- {
- 'name': 'owner1'
- // Missing: "'owns': 42".
- },
- {
- 'name': 'owner2',
- 'importance': 3,
- 'owns': 42
- },
- {
- 'name': 'non-owner',
- 'guid': 90
- }
- ]
- ]);
- }, /'owner1'.*\bwas expected not to own\b/);
-
- // Invalid ownership importance.
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'owned',
- 'guid': 42
- }
- ],
- [
- {
- 'name': 'owner1',
- 'owns': 42
- },
- {
- 'name': 'owner2',
- 'importance': 2, // This should be 3.
- 'owns': 42
- },
- {
- 'name': 'non-owner',
- 'guid': 90
- }
- ]
- ]);
- }, /\bexpected\b.*\bimportance\b.*'owner2'.*\b2 but got 3\b/);
-
- // Invalid ownership target.
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'owned',
- 'guid': 42
- }
- ],
- [
- {
- 'name': 'owner1',
- 'owns': 90 // This should be 42.
- },
- {
- 'name': 'owner2',
- 'importance': 3,
- 'owns': 42
- },
- {
- 'name': 'non-owner',
- 'guid': 90
- }
- ]
- ]);
- }, /'owner1'.*\binvalid target\b/);
-
- // Invalid 'ownedBy' ownership links count.
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'owned',
- 'guid': 42,
- 'expected_owned_by_links_count': 3 // This should be 2.
- }
- ],
- [
- {
- 'name': 'owner1',
- 'owns': 42
- },
- {
- 'name': 'owner2',
- 'importance': 3,
- 'owns': 42
- },
- {
- 'name': 'non-owner',
- 'guid': 90
- }
- ]
- ]);
- }, /'owned'.*\bhave 3 'ownedBy' links\b.*\bgot 2\b/);
-
- // Invalid ownership source.
- link1.source = ownerDump2;
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'owned',
- 'guid': 42
- }
- ],
- [
- {
- 'name': 'owner1',
- 'owns': 42
- },
- {
- 'name': 'owner2',
- 'importance': 3,
- 'owns': 42
- },
- {
- 'name': 'non-owner',
- 'guid': 90
- }
- ]
- ]);
- }, /'owns' link\b.*'owner1'.*\binvalid source\b/);
- link1.source = ownerDump1;
-
- // Ownership link not in target's 'ownedBy' list.
- ownedDump.ownedBy.pop();
- assert.throws(function() {
- checkDumpTrees(containerDumps, [
- [
- {
- 'name': 'owned',
- 'guid': 42
- }
- ],
- [
- {
- 'name': 'owner1',
- 'owns': 42
- },
- {
- 'name': 'owner2',
- 'importance': 3,
- 'owns': 42
- },
- {
- 'name': 'non-owner',
- 'guid': 90
- }
- ]
- ]);
- }, /\btarget of\b.*'owner2'.*'ownedBy' list\b/);
- ownedDump.ownedBy.push(link2);
- });
-
- /**
- * Build container memory dumps from tree recipes, let the resulting
- * GlobalMemoryDump calculate sizes and effective sizes, and then check that
- * the augmented container memory dumps have the expected structure with
- * correct sizes and effective sizes (as described by the same tree recipes).
- *
- * See the documentation for buildDumpTrees and checkDumpTrees for more
- * details about the structure of tree recipes.
- */
- function testSizesCalculation(allTreeRecipes) {
- var m = new Model();
- var io = new tr.importer.ImportOptions();
- io.showImportWarnings = false;
- m.importOptions = io;
-
- var containerDumps = buildDumpTrees(allTreeRecipes, m);
- var gmd = containerDumps[0];
- gmd.calculateSizes();
- gmd.calculateEffectiveSizes();
- gmd.forceRebuildingMemoryAllocatorDumpByFullNameIndices();
- checkDumpTrees(containerDumps, allTreeRecipes);
- }
-
- // Check that the testSizesCalculation testing helper method above
- // actually performs the expected checks. Since it will be used heavily
- // throughout this file (where it is expected to pass), we only need to
- // verify that it does indeed fail when it should.
- test('testSanityCheck_testSizesCalculation', function() {
- assert.throws(function() {
- testSizesCalculation([
- [],
- undefined,
- [
- {
- 'name': 'winheap'
- },
- {
- 'name': 'malloc',
- 'expected_size': 100,
- 'children': [
- {
- 'name': 'allocated_objects',
- 'size': 100,
- 'expected_size': 100
- },
- {
- 'name': 'extra',
- 'size': 20,
- 'expected_size': 20
- }
- ]
- }
- ]
- ]);
- }, /expected.*'size'.*value.*\b100\b.*got.*\b120\b/);
- });
-
- function calculationTest(caseName, treeRecipes) {
- test('calculateSizes_' + caseName, function() {
- testSizesCalculation(treeRecipes);
- });
- }
-
- /**
- * Build container memory dumps from tree recipes, let the resulting
- * GlobalMemoryDump remove weak memory dumps, and then check that the updated
- * container memory dumps have the expected structure (as described by the
- * same tree recipes).
- *
- * See the documentation for buildDumpTrees and checkDumpTrees for more
- * details about the structure of tree recipes.
- */
- function testWeakDumpRemoval(allTreeRecipes) {
- var m = new tr.Model();
- var io = new tr.importer.ImportOptions();
- io.showImportWarnings = false;
- m.importOptions = io;
-
- var containerDumps = buildDumpTrees(allTreeRecipes, m);
- var gmd = containerDumps[0];
- gmd.removeWeakDumps();
- gmd.forceRebuildingMemoryAllocatorDumpByFullNameIndices();
- checkDumpTrees(containerDumps, allTreeRecipes);
- }
-
- // Similarly to testSanityCheck_testSizesCalculation, check that the
- // testWeakDumpRemoval testing helper method above actually performs the
- // expected checks.
- test('testSanityCheck_testWeakDumpRemoval', function() {
- assert.throws(function() {
- testWeakDumpRemoval([
- [],
- undefined,
- [
- {
- 'name': 'winheap'
- },
- {
- 'name': 'malloc',
- 'children': [
- {
- 'name': 'allocated_objects'
- },
- {
- 'name': 'directly_weak',
- 'guid': 42,
- 'weak': true,
- 'expected_removed': true
- },
- {
- 'name': 'indirectly_weak',
- 'owns': 42
- // Missing: "'expected_removed': true".
- }
- ]
- }
- ]
- ]);
- }, /expected.*'malloc'.*\b2 children\b.*\bgot 1\b/);
- });
-
- function weakDumpRemovalTest(caseName, treeRecipes) {
- test('removeWeakDumps_' + caseName, function() {
- testWeakDumpRemoval(treeRecipes);
- });
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // Actual tests begin here.
- /////////////////////////////////////////////////////////////////////////////
-
- test('iterateContainerDumps_withoutProcessMemoryDumps', function() {
- var containerDumps = createContainerDumps(0);
- var gmd = containerDumps[0];
-
- var visitedContainerDumps = [];
- gmd.iterateContainerDumps(buildArgPusher(visitedContainerDumps));
- assertEqualUniqueMembers(visitedContainerDumps, containerDumps);
- });
-
- test('iterateContainerDumps_withProcessMemoryDumps', function() {
- var containerDumps = createContainerDumps(2);
- var gmd = containerDumps[0];
-
- var visitedContainerDumps = [];
- gmd.iterateContainerDumps(buildArgPusher(visitedContainerDumps));
- assertEqualUniqueMembers(visitedContainerDumps, containerDumps);
- });
-
- test('iterateAllRootAllocatorDumps', function() {
- var containerDumps = buildDumpTrees([
- [ // GMD.
- {
- 'name': 'globalSharedDump1'
- },
- {
- 'name': 'globalSharedDump2'
- }
- ],
- [ // PMD.
- {
- 'name': 'v8',
- 'children': [
- {
- 'name': 'isolate'
- }
- ]
- }
- ]
- ]);
- var gmd = containerDumps[0];
- var pmd = containerDumps[1];
-
- var visitedAllocatorDumps = [];
- gmd.iterateAllRootAllocatorDumps(buildArgPusher(visitedAllocatorDumps));
- assertEqualUniqueMembers(visitedAllocatorDumps, [
- gmd.getMemoryAllocatorDumpByFullName('globalSharedDump1'),
- gmd.getMemoryAllocatorDumpByFullName('globalSharedDump2'),
- pmd.getMemoryAllocatorDumpByFullName('v8')
- ]);
- });
-
- test('traverseAllocatorDumpsInDepthFirstOrder_oneTreeWithoutOwners',
- function() {
- var containerDumps = buildDumpTrees([
- [ // GMD.
- {
- 'name': 'root',
- 'children': [
- {
- 'name': 'parent',
- 'children': [
- {
- 'name': 'child1'
- },
- {
- 'name': 'child2'
- }
- ]
- }
- ]
- }
- ]
- ]);
- var gmd = containerDumps[0];
-
- // Post-order.
- var visitedAllocatorDumps = [];
- gmd.traverseAllocatorDumpsInDepthFirstPostOrder(
- buildArgPusher(visitedAllocatorDumps));
- assert.deepEqual(visitedAllocatorDumps, [
- gmd.getMemoryAllocatorDumpByFullName('root/parent/child1'),
- gmd.getMemoryAllocatorDumpByFullName('root/parent/child2'),
- gmd.getMemoryAllocatorDumpByFullName('root/parent'),
- gmd.getMemoryAllocatorDumpByFullName('root')
- ]);
-
- // Pre-order.
- var visitedAllocatorDumps = [];
- gmd.traverseAllocatorDumpsInDepthFirstPreOrder(
- buildArgPusher(visitedAllocatorDumps));
- assert.deepEqual(visitedAllocatorDumps, [
- gmd.getMemoryAllocatorDumpByFullName('root'),
- gmd.getMemoryAllocatorDumpByFullName('root/parent'),
- gmd.getMemoryAllocatorDumpByFullName('root/parent/child1'),
- gmd.getMemoryAllocatorDumpByFullName('root/parent/child2')
- ]);
- });
-
- test('traverseAllocatorDumpsInDepthFirstOrder_oneTreeWithOwners',
- function() {
- var containerDumps = buildDumpTrees([
- [], // GMD.
- [ // PMD.
- {
- 'name': 'root',
- 'children': [
- {
- 'name': 'parent',
- 'children': [
- {
- 'name': 'child1',
- 'owns': 0
- },
- {
- 'name': 'child2',
- 'guid': 0
- },
- {
- 'name': 'child3',
- 'owns': 0
- }
- ]
- }
- ]
- }
- ]
- ]);
- var gmd = containerDumps[0];
- var pmd = containerDumps[1];
-
- // Post-order.
- var visitedAllocatorDumps = [];
- gmd.traverseAllocatorDumpsInDepthFirstPostOrder(
- buildArgPusher(visitedAllocatorDumps));
- assert.deepEqual(visitedAllocatorDumps, [
- pmd.getMemoryAllocatorDumpByFullName('root/parent/child1'),
- pmd.getMemoryAllocatorDumpByFullName('root/parent/child3'),
- pmd.getMemoryAllocatorDumpByFullName('root/parent/child2'),
- pmd.getMemoryAllocatorDumpByFullName('root/parent'),
- pmd.getMemoryAllocatorDumpByFullName('root')
- ]);
-
- // Pre-order.
- var visitedAllocatorDumps = [];
- gmd.traverseAllocatorDumpsInDepthFirstPreOrder(
- buildArgPusher(visitedAllocatorDumps));
- assert.deepEqual(visitedAllocatorDumps, [
- pmd.getMemoryAllocatorDumpByFullName('root'),
- pmd.getMemoryAllocatorDumpByFullName('root/parent'),
- pmd.getMemoryAllocatorDumpByFullName('root/parent/child2'),
- pmd.getMemoryAllocatorDumpByFullName('root/parent/child1'),
- pmd.getMemoryAllocatorDumpByFullName('root/parent/child3')
- ]);
- });
-
- test('traverseAllocatorDumpsInDepthFirstOrder_multipleTrees', function() {
- var containerDumps = buildDumpTrees([
- [ // GMD.
- {
- 'name': 'shared',
- 'children': [
- {
- 'name': 'pool1',
- 'guid': 1
- },
- {
- 'name': 'pool2',
- 'owns': 3
- }
- ]
- }
- ],
- [ // PMD.
- {
- 'name': 'oilpan',
- 'children': [
- {
- 'name': 'objects'
- },
- {
- 'name': 'heaps',
- 'owns': 1,
- 'children': [
- {
- 'name': 'small',
- 'guid': 2
- },
- {
- 'name': 'large'
- }
- ]
- }
- ]
- },
- {
- 'name': 'v8',
- 'children': [
- {
- 'name': 'isolate1',
- 'owns': 2
- },
- {
- 'name': 'isolate2',
- 'guid': 3
- }
- ]
- }
- ]
- ]);
- var gmd = containerDumps[0];
- var pmd = containerDumps[1];
-
- // Post-order.
- var visitedAllocatorDumps = [];
- gmd.traverseAllocatorDumpsInDepthFirstPostOrder(
- buildArgPusher(visitedAllocatorDumps));
- assert.deepEqual(visitedAllocatorDumps, [
- pmd.getMemoryAllocatorDumpByFullName('v8/isolate1'),
- pmd.getMemoryAllocatorDumpByFullName('oilpan/heaps/small'),
- pmd.getMemoryAllocatorDumpByFullName('oilpan/heaps/large'),
- pmd.getMemoryAllocatorDumpByFullName('oilpan/heaps'),
- gmd.getMemoryAllocatorDumpByFullName('shared/pool1'),
- gmd.getMemoryAllocatorDumpByFullName('shared/pool2'),
- gmd.getMemoryAllocatorDumpByFullName('shared'),
- pmd.getMemoryAllocatorDumpByFullName('oilpan/objects'),
- pmd.getMemoryAllocatorDumpByFullName('oilpan'),
- pmd.getMemoryAllocatorDumpByFullName('v8/isolate2'),
- pmd.getMemoryAllocatorDumpByFullName('v8')
- ]);
-
- // Pre-order.
- var visitedAllocatorDumps = [];
- gmd.traverseAllocatorDumpsInDepthFirstPreOrder(
- buildArgPusher(visitedAllocatorDumps));
- assert.deepEqual(visitedAllocatorDumps, [
- gmd.getMemoryAllocatorDumpByFullName('shared'),
- gmd.getMemoryAllocatorDumpByFullName('shared/pool1'),
- pmd.getMemoryAllocatorDumpByFullName('oilpan'),
- pmd.getMemoryAllocatorDumpByFullName('oilpan/objects'),
- pmd.getMemoryAllocatorDumpByFullName('oilpan/heaps'),
- pmd.getMemoryAllocatorDumpByFullName('oilpan/heaps/small'),
- pmd.getMemoryAllocatorDumpByFullName('oilpan/heaps/large'),
- pmd.getMemoryAllocatorDumpByFullName('v8'),
- pmd.getMemoryAllocatorDumpByFullName('v8/isolate1'),
- pmd.getMemoryAllocatorDumpByFullName('v8/isolate2'),
- gmd.getMemoryAllocatorDumpByFullName('shared/pool2')
- ]);
- });
-
- test('traverseAllocatorDumpsInDepthFirstPostOrder_cycle', function() {
- var containerDumps = buildDumpTrees([
- [ // GMD.
- {
- 'name': 'shared',
- 'owns': 2,
- 'children': [
- {
- 'name': 'pool',
- 'guid': 1
- }
- ]
- }
- ],
- [ // PMD.
- {
- 'name': 'oilpan',
- 'owns': 1,
- 'children': [
- {
- 'name': 'objects',
- 'guid': 2
- }
- ]
- }
- ]
- ]);
- var gmd = containerDumps[0];
-
- // Post-order.
- assert.throws(function() {
- gmd.traverseAllocatorDumpsInDepthFirstPostOrder(function() {});
- }, /contains.*cycle/);
-
- // Pre-order.
- var visitedAllocatorDumps = [];
- gmd.traverseAllocatorDumpsInDepthFirstPreOrder(
- buildArgPusher(visitedAllocatorDumps));
- assert.deepEqual(visitedAllocatorDumps, []);
- });
-
- // Just check that the method doesn't crash upon encountering empty and/or
- // undefined memory allocator dumps.
- calculationTest('noDumps', [
- undefined, // GMD.
- [], // PMD1.
- undefined // PMD2.
- ]);
-
- calculationTest('flatDumps', [
- [ // GMD.
- {
- 'name': 'shared',
- 'size': 1024,
- 'expected_size': 1024,
- 'expected_effective_size': 1024
- }
- ],
- [ // PMD.
- {
- 'name': 'gpu'
- }
- ]
- ]);
-
- calculationTest('zeroSizes', [
- [ // GMD.
- {
- 'name': 'shared',
- 'size': 0,
- 'expected_size': 0,
- 'expected_effective_size': 0
- }
- ],
- [ // PMD1.
- {
- 'name': 'gpu',
- 'expected_size': 0,
- 'expected_effective_size': 0,
- 'children': [
- {
- 'name': 'zero',
- 'size': 0,
- 'expected_size': 0,
- 'expected_effective_size': 0
- }
- ]
- }
- ],
- [ // PMD2.
- {
- 'name': 'gpu',
- 'expected_size': 0,
- 'expected_effective_size': 0,
- 'children': [
- {
- 'name': 'zero',
- 'size': 0,
- 'expected_size': 0,
- 'expected_effective_size': 0
- },
- {
- 'name': 'undefined'
- }
- ]
- }
- ]
- ]);
-
- calculationTest('children_allSizesUndefined', [
- [
- {
- 'name': 'parent',
- 'children': [
- {
- 'name': 'child1'
- },
- {
- 'name': 'child2'
- }
- ]
- }
- ]
- ]);
-
- calculationTest('children_parentSizeUndefined', [
- [
- {
- 'name': 'parent',
- 'expected_size': 384,
- 'expected_effective_size': 384,
- 'children': [
- {
- 'name': 'child1',
- 'size': 128,
- 'expected_size': 128,
- 'expected_effective_size': 128
- },
- {
- 'name': 'child2',
- 'size': 256,
- 'expected_size': 256,
- 'expected_effective_size': 256
- }
- ]
- }
- ]
- ]);
-
- calculationTest('children_parentSizeDefined_childrenAddUp', [
- [
- {
- 'name': 'parent',
- 'size': 0,
- 'expected_size': 0,
- 'expected_effective_size': 0,
- 'children': [
- {
- 'name': 'child1'
- },
- {
- 'name': 'child2'
- }
- ]
- }
- ]
- ]);
-
- calculationTest('children_parentSizeDefined_childrenDontAddUp', [
- [
- {
- 'name': 'parent',
- 'size': 2048,
- 'expected_size': 2048,
- 'expected_effective_size': 2048,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 2048,
- 'expected_effective_size': 2048
- },
- {
- 'name': 'child1'
- },
- {
- 'name': 'child2'
- }
- ]
- }
- ]
- ]);
-
- calculationTest('children_oneChildSizeUndefined_childrenAddUp', [
- [
- {
- 'name': 'parent',
- 'size': 4096,
- 'expected_size': 4096,
- 'expected_effective_size': 4096,
- 'children': [
- {
- 'name': 'child1'
- },
- {
- 'name': 'child2',
- 'size': 4096,
- 'expected_size': 4096,
- 'expected_effective_size': 4096
- }
- ]
- }
- ]
- ]);
-
- calculationTest('children_oneChildSizeUndefined_childrenDontAddUp', [
- [
- {
- 'name': 'parent',
- 'size': 6144,
- 'expected_size': 6144,
- 'expected_effective_size': 6144,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 2048,
- 'expected_effective_size': 2048
- },
- {
- 'name': 'child1'
- },
- {
- 'name': 'child2',
- 'size': 4096,
- 'expected_size': 4096,
- 'expected_effective_size': 4096
- }
- ]
- }
- ]
- ]);
-
- calculationTest('children_allSizesDefined_childrenAddUp', [
- [
- {
- 'name': 'parent',
- 'size': 100,
- 'expected_size': 100,
- 'expected_effective_size': 100,
- 'children': [
- {
- 'name': 'child1',
- 'size': 70,
- 'expected_size': 70,
- 'expected_effective_size': 70
- },
- {
- 'name': 'child2',
- 'size': 30,
- 'expected_size': 30,
- 'expected_effective_size': 30
- }
- ]
- }
- ]
- ]);
-
- calculationTest('children_allSizesDefined_childrenDontUp', [
- [
- {
- 'name': 'parent',
- 'size': 150,
- 'expected_size': 150,
- 'expected_effective_size': 150,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 50,
- 'expected_effective_size': 50
- },
- {
- 'name': 'child1',
- 'size': 70,
- 'expected_size': 70,
- 'expected_effective_size': 70
- },
- {
- 'name': 'child2',
- 'size': 30,
- 'expected_size': 30,
- 'expected_effective_size': 30
- }
- ]
- }
- ]
- ]);
-
- calculationTest('children_oneChildSizeDefined', [
- [
- {
- 'name': 'parent',
- 'expected_size': 49,
- 'expected_effective_size': 49,
- 'children': [
- {
- 'name': 'child1',
- 'size': 49,
- 'expected_size': 49,
- 'expected_effective_size': 49
- },
- {
- 'name': 'child2'
- }
- ]
- }
- ]
- ]);
-
- calculationTest('children_multipleLevels', [
- [], // GMD.
- [ // PMD.
- {
- 'name': 'v8',
- 'expected_size': 36,
- 'expected_effective_size': 36,
- 'children': [
- {
- 'name': 'isolate1',
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 10,
- 'children': [
- {
- 'skip_build': true,
- 'name': '<unspecified>',
- 'expected_size': 3,
- 'expected_effective_size': 3
- },
- {
- 'name': 'objects',
- 'size': 3,
- 'expected_size': 3,
- 'expected_effective_size': 3
- },
- {
- 'name': 'heaps',
- 'size': 4,
- 'expected_size': 4,
- 'expected_effective_size': 4
- }
- ]
- },
- {
- 'name': 'isolate2',
- 'size': 12,
- 'expected_size': 12,
- 'expected_effective_size': 12,
- 'children': [
- {
- 'name': 'objects',
- 'size': 5,
- 'expected_size': 5,
- 'expected_effective_size': 5
- },
- {
- 'name': 'heaps',
- 'size': 7,
- 'expected_size': 7,
- 'expected_effective_size': 7
- }
- ]
- },
- {
- 'name': 'isolate3',
- 'expected_size': 14,
- 'expected_effective_size': 14,
- 'children': [
- {
- 'name': 'objects',
- 'size': 14,
- 'expected_size': 14,
- 'expected_effective_size': 14
- },
- {
- 'name': 'heaps'
- }
- ]
- }
- ]
- }
- ]
- ]);
-
- calculationTest('owners_allSizesUndefined', [
- [ // GMD.
- {
- 'name': 'bitmap',
- 'guid': 7
- }
- ],
- [ // PMD1.
- {
- 'name': 'tile',
- 'owns': 7,
- 'importance': 1
- }
- ],
- [ // PMD2.
- {
- 'name': 'chunk',
- 'owns': 7
- }
- ]
- ]);
-
- calculationTest('owners_ownedSizeDefined', [
- [ // GMD.
- {
- 'name': 'bitmap',
- 'size': 15,
- 'expected_size': 15,
- 'expected_effective_size': 15,
- 'guid': 7
- }
- ],
- [ // PMD1.
- {
- 'name': 'tile',
- 'owns': 7
- }
- ],
- [ // PMD2.
- {
- 'name': 'chunk',
- 'owns': 7
- }
- ]
- ]);
-
- calculationTest('owners_ownedSizeUndefined', [
- [ // GMD.
- {
- 'name': 'bitmap',
- 'expected_size': 9,
- 'expected_effective_size': 0,
- 'guid': 7
- }
- ],
- [ // PMD1.
- {
- 'name': 'tile',
- 'size': 5,
- 'expected_size': 5,
- 'expected_effective_size': 2.5,
- 'owns': 7
- }
- ],
- [ // PMD2.
- {
- 'name': 'chunk',
- 'size': 9,
- 'expected_size': 9,
- 'expected_effective_size': 6.5,
- 'owns': 7
- }
- ]
- ]);
-
- calculationTest('owners_oneOwnerSizeDefined', [
- [ // GMD.
- {
- 'name': 'bitmap',
- 'expected_size': 16,
- 'expected_effective_size': 0,
- 'guid': 7
- }
- ],
- [ // PMD1.
- {
- 'name': 'tile',
- 'size': 16,
- 'expected_size': 16,
- 'expected_effective_size': 16,
- 'owns': 7
- }
- ],
- [ // PMD2.
- {
- 'name': 'chunk',
- 'owns': 7
- }
- ]
- ]);
-
- calculationTest('owners_oneOwnerSizeUndefined', [
- [ // GMD.
- {
- 'name': 'bitmap',
- 'size': 20,
- 'expected_size': 20,
- 'expected_effective_size': 2,
- 'guid': 7
- }
- ],
- [ // PMD1.
- {
- 'name': 'tile',
- 'owns': 7
- }
- ],
- [ // PMD2.
- {
- 'name': 'chunk',
- 'size': 18,
- 'expected_size': 18,
- 'expected_effective_size': 18,
- 'owns': 7
- }
- ]
- ]);
-
- calculationTest('owners_allSizesDefined', [
- [ // GMD.
- {
- 'name': 'bitmap',
- 'size': 60,
- 'expected_size': 60,
- 'expected_effective_size': 31,
- 'guid': 7
- }
- ],
- [ // PMD1.
- {
- 'name': 'tile',
- 'size': 29,
- 'expected_size': 29,
- 'expected_effective_size': 19.5,
- 'owns': 7
- }
- ],
- [ // PMD2.
- {
- 'name': 'chunk',
- 'size': 19,
- 'expected_size': 19,
- 'expected_effective_size': 9.5,
- 'owns': 7
- }
- ]
- ]);
-
- calculationTest('owners_hierarchy', [
- [ // GMD.
- {
- 'name': 'bitmap',
- 'expected_size': 50,
- 'expected_effective_size': 0,
- 'guid': 7
- }
- ],
- [ // PMD1.
- {
- 'name': 'tile',
- 'expected_size': 50,
- 'expected_effective_size': 0,
- 'owns': 7,
- 'guid': 0
- },
- {
- 'name': 'object1',
- 'size': 30,
- 'owns': 0,
- 'expected_size': 30,
- 'expected_effective_size': 9
- },
- {
- 'name': 'object2',
- 'owns': 0
- },
- {
- 'name': 'object3',
- 'size': 50,
- 'owns': 0,
- 'expected_size': 50,
- 'expected_effective_size': 21
- }
- ],
- [ // PMD2.
- {
- 'name': 'chunk',
- 'size': 40,
- 'expected_size': 40,
- 'expected_effective_size': 20,
- 'owns': 7
- }
- ]
- ]);
-
- calculationTest('owners_withChildren', [
- [ // GMD.
- {
- 'name': 'bitmap',
- 'guid': 7,
- 'expected_size': 48,
- 'expected_effective_size': 17,
- 'children': [
- {
- 'name': 'subbitmap1',
- 'size': 32,
- 'expected_size': 32,
- 'expected_effective_size': 17 * (32 / 48)
- },
- {
- 'name': 'subbitmap2',
- 'size': 16,
- 'expected_size': 16,
- 'expected_effective_size': 17 * (16 / 48)
- }
- ]
- }
- ],
- [ // PMD.
- {
- 'name': 'tile',
- 'expected_size': 31,
- 'expected_effective_size': 0,
- 'guid': 8,
- 'owns': 7,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 7,
- 'expected_effective_size': 0
- },
- {
- 'name': 'subtile',
- 'size': 24,
- 'expected_size': 24,
- 'expected_effective_size': 0
- }
- ]
- },
- {
- 'name': 'cc',
- 'owns': 8,
- 'size': 31,
- 'expected_size': 31,
- 'expected_effective_size': 31
- }
- ]
- ]);
-
- calculationTest('owners_withParents', [
- [ // GMD.
- {
- 'name': 'bitmap',
- 'size': 96,
- 'expected_size': 96,
- 'expected_effective_size': 32,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 32,
- 'expected_effective_size': 32
- },
- {
- 'name': 'subbitmap',
- 'guid': 2,
- 'expected_size': 64,
- 'expected_effective_size': 0
- }
- ]
- }
- ],
- [ // PMD.
- {
- 'name': 'tile',
- 'expected_size': 64,
- 'expected_effective_size': 0,
- 'children': [
- {
- 'name': 'subtile',
- 'guid': 1,
- 'owns': 2,
- 'expected_size': 64,
- 'expected_effective_size': 0
- }
- ]
- },
- {
- 'name': 'cc',
- 'owns': 1,
- 'size': 64,
- 'expected_size': 64,
- 'expected_effective_size': 64
- }
- ]
- ]);
-
- calculationTest('owners_multipleLevels', [
- [ // GMD.
- {
- 'name': 'bitmap',
- 'size': 96,
- 'expected_size': 96,
- 'expected_effective_size': 32,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 32,
- 'expected_effective_size': 32
- },
- {
- 'name': 'subbitmap',
- 'guid': 2,
- 'expected_size': 64,
- 'expected_effective_size': 0
- }
- ]
- }
- ],
- [ // PMD.
- {
- 'name': 'tile',
- 'expected_size': 64,
- 'expected_effective_size': 0,
- 'owns': 2,
- 'children': [
- {
- 'name': 'subtile',
- 'guid': 1,
- 'expected_size': 64,
- 'expected_effective_size': 0
- }
- ]
- },
- {
- 'name': 'cc',
- 'owns': 1,
- 'size': 64,
- 'expected_size': 64,
- 'expected_effective_size': 64
- }
- ]
- ]);
-
- calculationTest('views_allSizesUndefined', [
- [
- {
- 'name': 'v8',
- 'children': [
- {
- 'name': 'v8/heaps',
- 'guid': 1
- },
- {
- 'name': 'v8/objects',
- 'owns': 1
- }
- ]
- }
- ]
- ]);
-
- calculationTest('views_ownedSizeDefined', [
- [
- {
- 'name': 'v8',
- 'expected_size': 10,
- 'expected_effective_size': 10,
- 'children': [
- {
- 'name': 'heaps',
- 'guid': 1,
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 10
- },
- {
- 'name': 'objects',
- 'owns': 1
- }
- ]
- }
- ]
- ]);
-
- calculationTest('views_ownerSizeDefined', [
- [
- {
- 'name': 'v8',
- 'expected_size': 20,
- 'expected_effective_size': 20,
- 'children': [
- {
- 'name': 'heaps',
- 'guid': 1,
- 'expected_size': 20,
- 'expected_effective_size': 0,
- 'expected_owned_by_sibling_sizes': {
- 'objects': 20
- }
- },
- {
- 'name': 'objects',
- 'owns': 1,
- 'size': 20,
- 'expected_size': 20,
- 'expected_effective_size': 20
- }
- ]
- }
- ]
- ]);
-
- calculationTest('views_parentSizeUndefined', [
- [
- {
- 'name': 'v8',
- 'expected_size': 30,
- 'expected_effective_size': 30,
- 'children': [
- {
- 'name': 'heaps',
- 'guid': 1,
- 'size': 30,
- 'expected_size': 30,
- 'expected_effective_size': 10,
- 'expected_owned_by_sibling_sizes': {
- 'objects': 20
- }
- },
- {
- 'name': 'objects',
- 'owns': 1,
- 'size': 20,
- 'expected_size': 20,
- 'expected_effective_size': 20
- }
- ]
- }
- ]
- ]);
-
- calculationTest('views_ownerSizeUndefined_childrenAddUp', [
- [
- {
- 'name': 'v8',
- 'size': 30,
- 'expected_size': 30,
- 'expected_effective_size': 30,
- 'children': [
- {
- 'name': 'heaps',
- 'guid': 1,
- 'size': 30,
- 'expected_size': 30,
- 'expected_effective_size': 30
- },
- {
- 'name': 'objects',
- 'owns': 1
- }
- ]
- }
- ]
- ]);
-
- calculationTest('views_ownerSizeUndefined_childrenDontAddUp', [
- [
- {
- 'name': 'v8',
- 'size': 40,
- 'expected_size': 40,
- 'expected_effective_size': 40,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 10,
- 'expected_effective_size': 10
- },
- {
- 'name': 'heaps',
- 'guid': 1,
- 'size': 30,
- 'expected_size': 30,
- 'expected_effective_size': 30
- },
- {
- 'name': 'objects',
- 'owns': 1
- }
- ]
- }
- ]
- ]);
-
- calculationTest('views_ownedSizeUndefined_childrenAddUp', [
- [
- {
- 'name': 'v8',
- 'size': 30,
- 'expected_size': 30,
- 'expected_effective_size': 30,
- 'children': [
- {
- 'name': 'heaps',
- 'guid': 1,
- 'expected_size': 30,
- 'expected_effective_size': 0,
- 'expected_owned_by_sibling_sizes': {
- 'objects': 30
- }
- },
- {
- 'name': 'objects',
- 'owns': 1,
- 'size': 30,
- 'expected_size': 30,
- 'expected_effective_size': 30
- }
- ]
- }
- ]
- ]);
-
- calculationTest('views_ownedSizeUndefined_childrenDontAddUp', [
- [
- {
- 'name': 'v8',
- 'size': 40,
- 'expected_size': 40,
- 'expected_effective_size': 40,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 10,
- 'expected_effective_size': 10
- },
- {
- 'name': 'heaps',
- 'guid': 1,
- 'expected_size': 30,
- 'expected_effective_size': 0,
- 'expected_owned_by_sibling_sizes': {
- 'objects': 30
- }
- },
- {
- 'name': 'objects',
- 'owns': 1,
- 'size': 30,
- 'expected_size': 30,
- 'expected_effective_size': 30
- }
- ]
- }
- ]
- ]);
-
- calculationTest('views_allSizesDefined_childrenAddUp', [
- [
- {
- 'name': 'v8',
- 'size': 30,
- 'expected_size': 30,
- 'expected_effective_size': 30,
- 'children': [
- {
- 'name': 'heaps',
- 'guid': 1,
- 'size': 30,
- 'expected_size': 30,
- 'expected_effective_size': 16,
- 'expected_owned_by_sibling_sizes': {
- 'objects': 14
- }
- },
- {
- 'name': 'objects',
- 'owns': 1,
- 'size': 14,
- 'expected_size': 14,
- 'expected_effective_size': 14
- }
- ]
- }
- ]
- ]);
-
- calculationTest('views_allSizesDefined_childrenDontAddUp', [
- [
- {
- 'name': 'v8',
- 'size': 35,
- 'expected_size': 35,
- 'expected_effective_size': 35,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 5,
- 'expected_effective_size': 5
- },
- {
- 'name': 'heaps',
- 'guid': 1,
- 'size': 30,
- 'expected_size': 30,
- 'expected_effective_size': 16,
- 'expected_owned_by_sibling_sizes': {
- 'objects': 14
- }
- },
- {
- 'name': 'objects',
- 'owns': 1,
- 'size': 14,
- 'expected_size': 14,
- 'expected_effective_size': 14
- }
- ]
- }
- ]
- ]);
-
- calculationTest('views_deep', [
- [
- {
- 'name': 'root',
- 'expected_size': 17,
- 'expected_effective_size': 17,
- 'children': [
- {
- 'name': 'parent1',
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 5,
- 'expected_owned_by_sibling_sizes': {
- 'parent2': 5
- },
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 2,
- 'expected_effective_size': 2
- },
- {
- 'name': 'child',
- 'guid': 1,
- 'size': 8,
- 'expected_size': 8,
- 'expected_effective_size': 3
- }
- ]
- },
- {
- 'name': 'parent2',
- 'size': 8,
- 'expected_size': 8,
- 'expected_effective_size': 5,
- 'expected_owned_by_sibling_sizes': {
- 'parent3': 3
- },
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 3,
- 'expected_effective_size': 3
- },
- {
- 'name': 'child',
- 'guid': 2,
- 'owns': 1,
- 'size': 5,
- 'expected_size': 5,
- 'expected_effective_size': 2
- }
- ]
- },
- {
- 'name': 'parent3',
- 'size': 7,
- 'expected_size': 7,
- 'expected_effective_size': 7,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 4,
- 'expected_effective_size': 4
- },
- {
- 'name': 'child',
- 'owns': 2,
- 'size': 3,
- 'expected_size': 3,
- 'expected_effective_size': 3
- }
- ]
- }
- ]
- }
- ]
- ]);
-
- calculationTest('views_nested', [
- [
- {
- 'name': 'system',
- 'expected_size': 7,
- 'expected_effective_size': 7,
- 'children': [
- {
- 'name': 'subsystem-A',
- 'owns': 15,
- 'expected_size': 5,
- 'expected_effective_size': 5,
- 'children': [
- {
- 'name': 'objects',
- 'owns': 30,
- 'size': 3,
- 'expected_size': 3,
- 'expected_effective_size': 3
- },
- {
- 'name': 'heaps',
- 'guid': 30,
- 'size': 5,
- 'expected_size': 5,
- 'expected_effective_size': 2,
- 'expected_owned_by_sibling_sizes': {
- 'objects': 3
- }
- }
- ]
- },
- {
- 'name': 'subsystem-B',
- 'guid': 15,
- 'expected_size': 7,
- 'expected_effective_size': 2,
- 'expected_owned_by_sibling_sizes': {
- 'subsystem-A': 5
- },
- 'children': [
- {
- 'name': 'objects',
- 'owns': 40,
- 'size': 7,
- 'expected_size': 7,
- 'expected_effective_size': 2
- },
- {
- 'name': 'heaps',
- 'guid': 40,
- 'expected_size': 7,
- 'expected_effective_size': 0,
- 'expected_owned_by_sibling_sizes': {
- 'objects': 7
- }
- }
- ]
- }
- ]
- }
- ]
- ]);
-
- calculationTest('importance_equal', [
- [ // GMD (both importances undefined and equal sizes).
- {
- 'name': 'owned',
- 'guid': 1,
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 4
- },
- {
- 'name': 'owner1',
- 'owns': 1,
- 'size': 6,
- 'expected_size': 6,
- 'expected_effective_size': 3
- },
- {
- 'name': 'owner2',
- 'owns': 1,
- 'size': 6,
- 'expected_size': 6,
- 'expected_effective_size': 3
- }
- ],
- [ // PMD1 (only one importance defined and different sizes).
- {
- 'name': 'owned',
- 'guid': 2,
- 'size': 20,
- 'expected_size': 20,
- 'expected_effective_size': 5
- },
- {
- 'name': 'owner1',
- 'owns': 2,
- 'importance': 0,
- 'size': 15,
- 'expected_size': 15,
- 'expected_effective_size': 10 / 2 + 5
- },
- {
- 'name': 'owner2',
- 'owns': 2,
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 10 / 2
- }
- ],
- [ // PMD2 (all importances defined and different sizes).
- {
- 'name': 'owned',
- 'guid': 3,
- 'size': 15,
- 'expected_size': 15,
- 'expected_effective_size': 5
- },
- {
- 'name': 'owner1',
- 'owns': 3,
- 'importance': 3,
- 'size': 8,
- 'expected_size': 8,
- 'expected_effective_size': 8 / 3
- },
- {
- 'name': 'owner2',
- 'owns': 3,
- 'importance': 3,
- 'size': 9,
- 'expected_size': 9,
- 'expected_effective_size': 8 / 3 + 1 / 2
- },
- {
- 'name': 'owner3',
- 'owns': 3,
- 'importance': 3,
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 8 / 3 + 1 / 2 + 1
- }
- ]
- ]);
-
- calculationTest('importance_notEqual', [
- [ // GMD (one importance undefined and equal sizes).
- {
- 'name': 'owned',
- 'guid': 1,
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 4
- },
- {
- 'name': 'owner1',
- 'owns': 1,
- 'size': 6,
- 'expected_size': 6,
- 'expected_effective_size': 0
- },
- {
- 'name': 'owner2',
- 'owns': 1,
- 'importance': 1,
- 'size': 6,
- 'expected_size': 6,
- 'expected_effective_size': 6
- }
- ],
- [ // PMD1 (one importance undefined and different sizes).
- {
- 'name': 'owned',
- 'guid': 2,
- 'size': 20,
- 'expected_size': 20,
- 'expected_effective_size': 4
- },
- {
- 'name': 'owner1',
- 'owns': 2,
- 'importance': -1,
- 'size': 16,
- 'expected_size': 16,
- 'expected_effective_size': 6
- },
- {
- 'name': 'owner2',
- 'owns': 2,
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 10
- }
- ],
- [ // PMD2 (all importances defined and different sizes).
- {
- 'name': 'owned',
- 'guid': 3,
- 'size': 15,
- 'expected_size': 15,
- 'expected_effective_size': 5
- },
- {
- 'name': 'owner1',
- 'owns': 3,
- 'importance': 4,
- 'size': 8,
- 'expected_size': 8,
- 'expected_effective_size': 8
- },
- {
- 'name': 'owner2',
- 'owns': 3,
- 'importance': 3,
- 'size': 6,
- 'expected_size': 6,
- 'expected_effective_size': 0
- },
- {
- 'name': 'owner3',
- 'owns': 3,
- 'importance': 2,
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 2
- }
- ]
- ]);
-
- // Example taken from GlobalMemoryDump.calculateDumpOwnershipCoefficient_()
- // documentation.
- calculationTest('importance_manyOwners', [
- [ // GMD.
- {
- 'name': 'owned',
- 'guid': 4,
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 2
- }
- ],
- [ // PMD1.
- {
- 'name': 'owner1',
- 'owns': 4,
- 'importance': 2,
- 'size': 6,
- 'expected_size': 6,
- 'expected_effective_size': 6 / 2
- }
- ],
- [ // PMD2.
- {
- 'name': 'some_parent',
- 'expected_size': 7,
- 'expected_effective_size': 6 / 2 + 1,
- 'children': [
- {
- 'name': 'owner2',
- 'owns': 4,
- 'importance': 2,
- 'size': 7,
- 'expected_size': 7,
- 'expected_effective_size': 6 / 2 + 1
- }
- ]
- }
- ],
- [ // PMD3.
- {
- 'name': 'owner3',
- 'owns': 4,
- 'importance': 1,
- 'size': 5,
- 'expected_size': 5,
- 'expected_effective_size': 0
- },
- {
- 'name': 'owner4',
- 'owns': 4,
- 'importance': 0,
- 'size': 8,
- 'expected_size': 8,
- 'expected_effective_size': 1
- }
- ]
- ]);
-
- calculationTest('importance_chainOwnerships', [
- [ // GMD.
- {
- 'name': 'owned',
- 'guid': 5,
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 2
- }
- ],
- [ // PMD1.
- {
- 'name': 'owner1',
- 'owns': 5,
- 'importance': 2,
- 'guid': 6,
- 'size': 6,
- 'expected_size': 6,
- 'expected_effective_size': 2
- },
- {
- 'name': 'subowner1',
- 'owns': 6,
- 'size': 4,
- 'expected_size': 4,
- 'expected_effective_size': 4
- }
- ],
- [ // PMD2.
- {
- 'name': 'owner2',
- 'owns': 5,
- 'importance': 1,
- 'guid': 8,
- 'size': 8,
- 'expected_size': 8,
- 'expected_effective_size': 2 - 2 / 4
- },
- {
- 'name': 'subowner2',
- 'owns': 8,
- 'size': 2,
- 'expected_size': 2,
- 'expected_effective_size': 2 / 4
- }
- ]
- ]);
-
- calculationTest('importance_nested', [
- [
- {
- 'name': 'grey',
- 'guid': 15,
- 'size': 20,
- 'expected_size': 20,
- 'expected_effective_size': 6
- },
- {
- 'name': 'blue',
- 'guid': 18,
- 'owns': 15,
- 'importance': 1,
- 'size': 14,
- 'expected_size': 14,
- 'expected_effective_size': 1
- },
- {
- 'name': 'purple',
- 'owns': 15,
- 'importance': 2,
- 'size': 7,
- 'expected_size': 7,
- 'expected_effective_size': 7
- },
- {
- 'name': 'yellow',
- 'owns': 21,
- 'importance': 3,
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 3
- },
- {
- 'name': 'red',
- 'guid': 21,
- 'owns': 18,
- 'size': 12,
- 'expected_size': 12,
- 'expected_effective_size': 1
- },
- {
- 'name': 'green',
- 'owns': 21,
- 'importance': 3,
- 'size': 8,
- 'expected_size': 8,
- 'expected_effective_size': 2
- }
- ]
- ]);
-
- calculationTest('importance_singleRefinement', [
- [
- {
- 'name': 'v8',
- 'expected_size': 13,
- 'expected_effective_size': 13,
- 'children': [
- {
- 'name': 'objects',
- 'owns': 1,
- 'size': 11,
- 'expected_size': 11,
- 'expected_effective_size': 11,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 4,
- 'expected_effective_size': 4
- },
- {
- 'name': 'object1',
- 'owns': 2,
- 'size': 7,
- 'expected_size': 7,
- 'expected_effective_size': 7
- }
- ]
- },
- {
- 'name': 'heaps',
- 'guid': 1,
- 'size': 13,
- 'expected_size': 13,
- 'expected_effective_size': 2,
- 'expected_owned_by_sibling_sizes': {
- 'objects': 11
- },
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 3,
- 'expected_effective_size': 1
- },
- {
- 'name': 'heap1',
- 'guid': 2,
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 1,
- }
- ]
- }
- ]
- }
- ]
- ]);
-
- calculationTest('importance_sharedRefinement', [
- [ // GMD.
- {
- 'name': 'shared_bitmap',
- 'guid': 0,
- 'size': 23,
- 'expected_size': 23,
- 'expected_effective_size': 5,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 13,
- 'expected_effective_size': 13 * 5 / (13 + 3)
- },
- {
- 'name': 'bitmap0x7',
- 'guid': 999,
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 3 * 5 / (13 + 3),
- }
- ]
- }
- ],
- [ // PMD1.
- {
- 'name': 'tile_manager',
- 'owns': 0,
- 'importance': 2,
- 'size': 12,
- 'expected_size': 12,
- 'expected_effective_size': 5 + 2,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 5,
- 'expected_effective_size': 5
- },
- {
- 'name': 'tile42',
- 'owns': 999,
- 'importance': 1,
- 'size': 7,
- 'expected_size': 7,
- 'expected_effective_size': 2,
- }
- ]
- }
- ],
- [ // PMD2.
- {
- 'name': 'gpu',
- 'owns': 0,
- 'importance': 1,
- 'size': 16,
- 'expected_size': 16,
- 'expected_effective_size': 6 + 5,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 11,
- 'expected_effective_size': 6
- },
- {
- 'name': 'chunk-3.14',
- 'owns': 999,
- 'importance': 2,
- 'size': 5,
- 'expected_size': 5,
- 'expected_effective_size': 5,
- }
- ]
- }
- ]
- ]);
-
- // Example taken from https://goo.gl/fKg0dt.
- calculationTest('documentationExample', [
- [ // GMD, Global (shared) memory.
- {
- 'name': 'unknown',
- 'guid': 2,
- 'expected_size': 16,
- 'expected_effective_size': 0,
- }
- ],
- [ // PMD1, Browser process.
- {
- 'name': 'sharedbitmap',
- 'size': 17,
- 'expected_size': 17,
- 'expected_effective_size': 9,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 1,
- 'expected_effective_size': 1
- },
- {
- 'name': '0x7',
- 'size': 16,
- 'expected_size': 16,
- 'expected_effective_size': 8,
- 'owns': 2,
- 'importance': 1,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 16,
- 'expected_effective_size': 8
- },
- {
- 'name': 'y'
- }
- ]
- }
- ]
- }
- ],
- [ // PMD2, Renderer process.
- {
- 'name': 'v8',
- 'expected_size': 13,
- 'expected_effective_size': 13,
- 'children': [
- {
- 'name': 'heaps',
- 'guid': 100,
- 'expected_size': 12,
- 'expected_effective_size': 3,
- 'expected_owned_by_sibling_sizes': {
- 'objects': 9
- },
- 'children': [
- {
- 'name': '1',
- 'size': 8,
- 'expected_size': 8,
- 'expected_effective_size': 2,
- 'owns': 2,
- 'importance': 2
- },
- {
- 'name': '2',
- 'expected_size': 4,
- 'expected_effective_size': 1,
- 'size': 4
- }
- ]
- },
- {
- 'name': 'objects',
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 10,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 1,
- 'expected_effective_size': 1
- },
- {
- 'name': 'strings',
- 'size': 9,
- 'expected_size': 9,
- 'expected_effective_size': 9,
- 'owns': 100
- }
- ]
- }
- ]
- }
- ]
- ]);
-
- // This should never happen. Nevertheless, this test checks that we can
- // handle invalid sizes (parent dump being smaller than its aggregated
- // children and owned dump being smaller than its largest owner) gracefully.
- calculationTest('invalidSizes', [
- [
- {
- 'name': 'root1',
- 'size': 24,
- 'expected_size': 24,
- 'expected_effective_size': 4,
- 'children': [
- {
- 'name': '<unspecified>',
- 'skip_build': true,
- 'expected_size': 4,
- 'expected_effective_size': 4
- },
- {
- 'name': 'parent',
- 'guid': 2,
- 'size': 17, // Invalid: child has larger size.
- 'expected_size': 20,
- 'expected_infos': [
- {
- type: PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN,
- providedSize: 17,
- dependencySize: 20
- },
- {
- type: PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER,
- providedSize: 17,
- dependencySize: 18
- }
- ],
- 'expected_effective_size': 0,
- 'children': [
- {
- 'name': 'child',
- 'guid': 1,
- 'size': 10, // Invalid: owner has larger size.
- 'expected_size': 20,
- 'expected_infos': [
- {
- type: PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER,
- providedSize: 10,
- dependencySize: 20
- }
- ],
- 'expected_effective_size': 0,
- }
- ]
- }
- ]
- },
- {
- 'name': 'root2',
- 'owns': 1,
- 'size': 20,
- 'expected_size': 20,
- 'expected_effective_size': 20
- },
- {
- 'name': 'root3',
- 'owns': 2,
- 'importance': -1,
- 'size': 18,
- 'expected_size': 18,
- 'expected_effective_size': 18
- }
- ]
- ]);
-
- calculationTest('multipleInfos', [
- [
- {
- 'name': 'root',
- 'expected_size': 10,
- 'expected_effective_size': 10,
- 'children': [
- {
- 'name': 'parent1',
- 'size': 5,
- 'expected_size': 10,
- 'expected_infos': [
- {
- type: PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN,
- providedSize: 5,
- dependencySize: 10
- }
- ],
- 'expected_effective_size': 1,
- 'expected_owned_by_sibling_sizes': {
- 'parent2': 17,
- 'parent3': 7
- },
- 'children': [
- {
- 'name': 'child',
- 'guid': 3,
- 'size': 10,
- 'expected_size': 10,
- 'expected_effective_size': 1,
- }
- ]
- },
- {
- 'name': 'parent2',
- // NOTE(petrcermak): The expected size here is a little strange
- // because the children both own the same dump (namely
- // root/parent1/child). It would, therefore, probably make more
- // sense for the calculated size to be 9. Since this is an unlikely
- // case and would complicate the (already complex) size
- // calculation, we will now keep the algorithm as is.
- 'expected_size': 17,
- 'expected_effective_size': 14 / 3 + 2,
- 'children': [
- {
- 'name': 'child1',
- 'owns': 3,
- 'size': 9,
- 'expected_size': 9,
- 'expected_effective_size': 7 / 3 + 1 / 2 + 1,
- },
- {
- 'name': 'child2',
- 'owns': 3,
- 'size': 8,
- 'expected_size': 8,
- 'expected_effective_size': 7 / 3 + 1 / 2,
- }
- ]
- },
- {
- 'name': 'parent3',
- 'size': 7,
- 'expected_size': 7,
- 'expected_effective_size': 7 / 3,
- 'owns': 3
- }
- ]
- }
- ]
- ]);
-
- // Check that size calculation is NOT preceded by numeric aggregation, which
- // would recursively sum up size numerics.
- test('finalizeGraph_aggregation', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- buildDumpTrees([
- undefined, // GMD.
- [ // PMD.
- {
- 'name': 'root',
- 'children': [
- {
- 'name': 'owner_child',
- 'owns': 9,
- 'size': 7
- },
- {
- 'name': 'owned_child',
- 'guid': 9,
- 'size': 20
- }
- ]
- }
- ]
- ], model);
- });
- var pmd = model.getProcess(0).memoryDumps[0];
-
- var rootDump = pmd.getMemoryAllocatorDumpByFullName('root');
- assertDumpSizes(rootDump, 20, 20);
-
- var ownerChildDump = pmd.getMemoryAllocatorDumpByFullName(
- 'root/owner_child');
- assertDumpSizes(ownerChildDump, 7, 7);
-
- var ownedChildDump = pmd.getMemoryAllocatorDumpByFullName(
- 'root/owned_child');
- assertDumpSizes(ownedChildDump, 20, 13, [] /* expectedInfos */,
- { owner_child: 7 } /* expectedOwnedBySiblingSizes */);
- });
-
- // Check that numeric and diagnostics propagation and aggregation are
- // performed in the correct order.
- test('finalizeGraph_propagation', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- buildDumpTrees([
- [ // GMD.
- {
- 'name': 'owned_root',
- 'guid': 1,
- 'size': 10,
- 'diagnostics': {
- 'url': 'https://hello.world.com:42'
- },
- 'children': [
- {
- 'name': 'owned_child1',
- 'numerics': {
- 'summed': new ScalarNumeric(sizeInBytes_smallerIsBetter, 12)
- },
- 'diagnostics': {
- 'url2': 'http://not.aggregated.to/owned/parent/dump'
- }
- },
- {
- 'name': 'owned_child2',
- 'numerics': {
- 'summed': new ScalarNumeric(sizeInBytes_smallerIsBetter, 15)
- }
- }
- ]
- }
- ],
- [ // PMD.
- {
- 'name': 'direct_owner',
- 'owns': 1,
- 'guid': 2,
- 'diagnostics': {
- 'url': 'file://not_overriden.html'
- }
- },
- {
- 'name': 'parent_owner',
- 'children': [
- {
- 'name': 'child_owner',
- 'owns': 1
- },
- {
- 'name': 'sibling',
- 'size': 5,
- 'numerics': {
- 'summed': new ScalarNumeric(sizeInBytes_smallerIsBetter, 13)
- }
- }
- ]
- },
- {
- 'name': 'precedent_owner',
- 'owns': 1,
- 'numerics': {
- 'summed': new ScalarNumeric(sizeInBytes_smallerIsBetter, 0)
- }
- },
- {
- 'name': 'indirect_owner',
- 'owns': 2
- }
- ]
- ], model);
- });
- var pmd = model.getProcess(0).memoryDumps[0];
-
- checkDumpNumericsAndDiagnostics(
- pmd.getMemoryAllocatorDumpByFullName('direct_owner'),
- {
- 'size': 10,
- 'effective_size': 3.3333,
- 'summed': 27
- },
- {
- 'url': 'file://not_overriden.html'
- });
- checkDumpNumericsAndDiagnostics(
- pmd.getMemoryAllocatorDumpByFullName('parent_owner/child_owner'),
- {
- 'size': 10,
- 'effective_size': 3.3333,
- 'summed': 27
- },
- {
- 'url': 'https://hello.world.com:42'
- });
- checkDumpNumericsAndDiagnostics(
- pmd.getMemoryAllocatorDumpByFullName('parent_owner'),
- {
- 'size': 15,
- 'effective_size': 8.3333,
- 'summed': 40
- }, {});
- checkDumpNumericsAndDiagnostics(
- pmd.getMemoryAllocatorDumpByFullName('precedent_owner'),
- {
- 'size': 10,
- 'effective_size': 3.3333,
- 'summed': 0
- },
- {
- 'url': 'https://hello.world.com:42'
- });
- checkDumpNumericsAndDiagnostics(
- pmd.getMemoryAllocatorDumpByFullName('indirect_owner'), {}, {});
- });
-
- // Check that weak dumps are removed before size size calculation.
- test('finalizeGraph_weakDumpRemoval', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- buildDumpTrees([
- undefined, // GMD.
- [ // PMD.
- {
- 'name': 'root',
- 'children': [
- {
- 'name': 'directly_weak_child',
- 'weak': true,
- 'guid': 5,
- 'owns': 10,
- 'size': 100
- },
- {
- 'name': 'strong_child',
- 'guid': 10,
- 'size': 120
- },
- {
- 'name': 'indirectly_weak_child',
- 'owns': 5,
- 'size': 70
- },
- {
- 'name': 'separate_weak_child',
- 'weak': true,
- 'size': 300
- }
- ]
- }
- ]
- ], model);
- });
- var pmd = model.getProcess(0).memoryDumps[0];
-
- var rootDump = pmd.getMemoryAllocatorDumpByFullName('root');
- assertDumpSizes(rootDump, 120, 120);
- assert.lengthOf(rootDump.children, 1);
-
- var strongChildDump = pmd.getMemoryAllocatorDumpByFullName(
- 'root/strong_child');
- assertDumpSizes(strongChildDump, 120, 120);
- assert.lengthOf(strongChildDump.ownedBy, 0);
-
- assert.isUndefined(pmd.getMemoryAllocatorDumpByFullName(
- 'root/directly_weak_child'));
- assert.isUndefined(pmd.getMemoryAllocatorDumpByFullName(
- 'root/indirectly_weak_child'));
- assert.isUndefined(pmd.getMemoryAllocatorDumpByFullName(
- 'root/separate_weak_child'));
- });
-
- test('indicesUpdatedCorrectly', function() {
- var gmd, rootDump, childDump;
- var model = tr.c.TestUtils.newModel(function(model) {
- gmd = new GlobalMemoryDump(model, 10);
- model.globalMemoryDumps.push(gmd);
-
- rootDump = newAllocatorDump(gmd, 'root', { size: 64 });
- childDump = addChildDump(rootDump, 'child', { size: 48 });
-
- gmd.memoryAllocatorDumps = [rootDump];
-
- // Before model is finalized.
- assert.strictEqual(
- gmd.getMemoryAllocatorDumpByFullName('root'), rootDump);
- assert.strictEqual(
- gmd.getMemoryAllocatorDumpByFullName('root/child'), childDump);
- assert.isUndefined(
- gmd.getMemoryAllocatorDumpByFullName('root/<unspecified>'));
- });
-
- // Test sanity check.
- assert.isDefined(gmd);
- assert.isDefined(rootDump);
- assert.isDefined(childDump);
-
- // After model is finalized.
- assert.strictEqual(gmd.getMemoryAllocatorDumpByFullName('root'), rootDump);
- assert.strictEqual(
- gmd.getMemoryAllocatorDumpByFullName('root/child'), childDump);
- var unspecifiedDump =
- gmd.getMemoryAllocatorDumpByFullName('root/<unspecified>');
- assert.strictEqual(unspecifiedDump.fullName, 'root/<unspecified>');
- assert.strictEqual(unspecifiedDump.parent, rootDump);
- assert.strictEqual(rootDump.children[0], unspecifiedDump);
- });
-
- weakDumpRemovalTest('allDumpsNonWeak', [
- [ // GMD.
- {
- 'name': 'malloc',
- 'children': [
- {
- 'name': 'allocated_objects',
- 'children': [
- {
- 'name': 'obj42',
- 'guid': 5,
- 'expected_owned_by_links_count': 2
- }
- ]
- }
- ]
- }
- ],
- undefined, // PMD1.
- [ // PMD2.
- {
- 'name': 'oilpan'
- },
- {
- 'name': 'v8',
- 'children': [
- {
- 'name': 'heaps',
- 'children': [
- {
- 'name': 'S',
- 'owns': 5
- },
- {
- 'name': 'L',
- 'owns': 5
- }
- ]
- }
- ]
- }
- ]
- ]);
-
- weakDumpRemovalTest('weakRootDump', [
- [], // GMD.
- [ // PMD1.
- {
- 'name': 'strong1'
- },
- {
- 'name': 'weak',
- 'weak': true,
- 'expected_removed': true
- },
- {
- 'name': 'strong2'
- }
- ]
- ]);
-
- weakDumpRemovalTest('weakChildDump', [
- [ // GMD.
- {
- 'name': 'root',
- 'children': [
- {
- 'name': 'parent',
- 'children': [
- {
- 'name': 'strong1'
- },
- {
- 'name': 'weak',
- 'weak': true,
- 'expected_removed': true,
- 'children': [
- {
- 'name': 'implicitly-removed'
- }
- ]
- },
- {
- 'name': 'strong2'
- }
- ]
- }
- ]
- }
- ]
- ]);
-
- weakDumpRemovalTest('transitiveOwnerRemoval', [
- [ // GMD.
- {
- 'name': 'not-removed-strong-dump',
- 'guid': 0,
- 'expected_owned_by_links_count': 1
- },
- {
- 'name': 'weak-owned-dump',
- 'guid': 1,
- 'owns': 0,
- 'weak': true,
- 'expected_removed': true
- }
- ],
- [ // PMD1.
- {
- 'name': 'direct-owner-dump',
- 'guid': 2,
- 'owns': 1,
- 'expected_removed': true
- },
- {
- 'name': 'also-not-removed-strong-dump',
- 'owns': 0
- }
- ],
- [ // PMD2.
- {
- 'name': 'indirect-owner-dump',
- 'owns': 2,
- 'expected_removed': true
- }
- ]
- ]);
-
- weakDumpRemovalTest('transitiveDescendantRemoval', [
- [ // GMD.
- {
- 'name': 'A',
- 'owns': 10,
- // A =owns=> B -child-of-> C -> D => E -> F -> G (weak).
- 'expected_removed': true
- },
- {
- 'name': 'D',
- 'owns': 5,
- 'expected_removed': true, // D =owns=> E -child-of-> F -> G (weak).
- 'children': [
- {
- 'name': 'C',
- 'children': [
- {
- 'name': 'B',
- 'guid': 10
- }
- ]
- }
- ]
- }
- ],
- undefined, // PMD1.
- [ // PMD2.
- {
- 'name': 'first-retained-dump',
- 'children': [
- {
- 'name': 'G',
- 'weak': true,
- 'expected_removed': true,
- 'children': [
- {
- 'name': 'F',
- 'children': [
- {
- 'name': 'E',
- 'guid': 5
- }
- ]
- },
- {
- 'name': 'H',
- 'children': [
- {
- 'name': 'I',
- 'children': [
- {
- 'name': 'J',
- 'owns': 2
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ],
- [ // PMD3.
- {
- 'name': 'second-retained-dump',
- 'guid': 2,
- // The only owner (J) is removed because J -child-of-> I -> H ->
- // G (weak).
- 'expected_owned_by_links_count': 0
- }
- ]
- ]);
-
- weakDumpRemovalTest('subownerships', [
- [ // GMD.
- {
- 'name': 'root1',
- 'owns': 20,
- 'expected_removed': true, // root1 =owns=> root2 (weak).
- 'children': [
- {
- 'name': 'child1',
- 'owns': 2
- }
- ]
- },
- {
- 'name': 'root2',
- 'guid': 20,
- 'owns': 30,
- 'weak': true,
- 'expected_removed': true,
- 'children': [
- {
- 'name': 'child2',
- 'guid': 2,
- 'owns': 3
- }
- ]
- },
- {
- 'name': 'root3',
- 'guid': 30,
- 'owns': 40,
- 'expected_owned_by_links_count': 0,
- 'children': [
- {
- 'name': 'child3',
- 'guid': 3,
- 'owns': 4,
- 'weak': true,
- 'expected_removed': true
- }
- ]
- }
- ],
- [ // PMD1.
- {
- 'name': 'root4',
- 'guid': 40,
- 'expected_owned_by_links_count': 1,
- 'children': [
- {
- 'name': 'child4',
- 'guid': 4,
- 'expected_owned_by_links_count': 0
- }
- ]
- }
- ],
- [ // PMD2.
- {
- 'name': 'root5',
- 'owns': 60,
- 'expected_removed': true, // root5 =owns=> root6 => root7 (weak).
- 'children': [
- {
- 'name': 'child5',
- 'owns': 6
- }
- ]
- },
- {
- 'name': 'root6',
- 'guid': 60,
- 'owns': 70,
- 'expected_removed': true, // root6 =owns=> root7 (weak).
- 'children': [
- {
- 'name': 'child6',
- 'guid': 6,
- 'owns': 7
- }
- ]
- },
- {
- 'name': 'root7',
- 'guid': 70,
- 'owns': 40,
- 'weak': true,
- 'expected_removed': true,
- 'children': [
- {
- 'name': 'child7',
- 'guid': 7,
- 'owns': 4
- }
- ]
- }
- ]
- ]);
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/heap_dump.html b/chromium/third_party/catapult/tracing/tracing/model/heap_dump.html
deleted file mode 100644
index d3f4a29dbef..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/heap_dump.html
+++ /dev/null
@@ -1,67 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
-
- /**
- * HeapEntry represents a single value describing the state of the heap of an
- * allocator in a single process.
- *
- * An entry specifies how much space (e.g. 19 MiB) was allocated in a
- * particular context, which consists of a codepath (e.g. drawQuad <- draw <-
- * MessageLoop::RunTask) and an object type (e.g. HTMLImportLoader).
- *
- * @{constructor}
- */
- function HeapEntry(heapDump, leafStackFrame, objectTypeName, size, count) {
- this.heapDump = heapDump;
-
- // The leaf stack frame of the associated backtrace (e.g. drawQuad for the
- // drawQuad <- draw <- MessageLoop::RunTask backtrace). If undefined, the
- // backtrace is empty.
- this.leafStackFrame = leafStackFrame;
-
- // The name of the allocated object type (e.g. 'HTMLImportLoader'). If
- // undefined, the entry represents the sum over all object types.
- this.objectTypeName = objectTypeName;
-
- this.size = size;
- this.count = count;
- }
-
- /**
- * HeapDump represents a dump of the heap of an allocator in a single process
- * at a particular timestamp.
- *
- * @{constructor}
- */
- function HeapDump(processMemoryDump, allocatorName) {
- this.processMemoryDump = processMemoryDump;
- this.allocatorName = allocatorName;
- this.entries = [];
- }
-
- HeapDump.prototype = {
- addEntry: function(leafStackFrame, objectTypeName, size, count) {
- var entry = new HeapEntry(
- this, leafStackFrame, objectTypeName, size, count);
- this.entries.push(entry);
- return entry;
- }
- };
-
- return {
- HeapEntry: HeapEntry,
- HeapDump: HeapDump
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/heap_dump_test.html b/chromium/third_party/catapult/tracing/tracing/model/heap_dump_test.html
deleted file mode 100644
index cb3170ad85e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/heap_dump_test.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/global_memory_dump.html">
-<link rel="import" href="/tracing/model/heap_dump.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/process_memory_dump.html">
-<link rel="import" href="/tracing/model/stack_frame.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Model = tr.Model;
- var GlobalMemoryDump = tr.model.GlobalMemoryDump;
- var ProcessMemoryDump = tr.model.ProcessMemoryDump;
- var StackFrame = tr.model.StackFrame;
- var HeapEntry = tr.model.HeapEntry;
- var HeapDump = tr.model.HeapDump;
-
- test('heapDumps', function() {
- var model = new tr.Model();
- var process = model.getOrCreateProcess(89);
- var gmd = new GlobalMemoryDump(model, 42);
- model.globalMemoryDumps.push(gmd);
- var pmd = new ProcessMemoryDump(gmd, process, 42);
- process.memoryDumps.push(pmd);
-
- var rootFrame = new StackFrame(
- undefined, tr.b.GUID.allocateSimple(), undefined);
- var childFrame = new StackFrame(
- rootFrame, tr.b.GUID.allocateSimple(), 'draw');
- rootFrame.addChild(childFrame);
-
- var dump = new HeapDump(pmd);
- assert.strictEqual(dump.processMemoryDump, pmd);
- assert.lengthOf(dump.entries, 0);
-
- var entry1 = dump.addEntry(childFrame, 'HTMLImportLoader', 1024, undefined);
- assert.strictEqual(entry1.heapDump, dump);
- assert.strictEqual(entry1.leafStackFrame, childFrame);
- assert.strictEqual(entry1.objectTypeName, 'HTMLImportLoader');
- assert.strictEqual(entry1.size, 1024);
- assert.isUndefined(entry1.count);
-
- var entry2 = dump.addEntry(undefined, undefined, 1048576, 42);
- assert.strictEqual(entry2.heapDump, dump);
- assert.isUndefined(entry2.leafStackFrame);
- assert.isUndefined(entry2.objectTypeName);
- assert.strictEqual(entry2.size, 1048576);
- assert.strictEqual(entry2.count, 42);
-
- assert.deepEqual(dump.entries, [entry1, entry2]);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/helpers/android_app.html b/chromium/third_party/catapult/tracing/tracing/model/helpers/android_app.html
deleted file mode 100644
index 8504a34c98e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/helpers/android_app.html
+++ /dev/null
@@ -1,310 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/range_utils.html">
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/model/frame.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Class for managing android-specific model meta data,
- * such as rendering apps, and frames rendered.
- */
-tr.exportTo('tr.model.helpers', function() {
- var Frame = tr.model.Frame;
- var Statistics = tr.b.Statistics;
-
- var UI_DRAW_TYPE = {
- NONE: 'none',
- LEGACY: 'legacy',
- MARSHMALLOW: 'marshmallow'
- };
-
- var UI_THREAD_DRAW_NAMES = {
- 'performTraversals': UI_DRAW_TYPE.LEGACY,
- 'Choreographer#doFrame': UI_DRAW_TYPE.MARSHMALLOW
- };
-
- var RENDER_THREAD_DRAW_NAME = 'DrawFrame';
- var RENDER_THREAD_INDEP_DRAW_NAME = 'doFrame';
- var THREAD_SYNC_NAME = 'syncFrameState';
-
- function getSlicesForThreadTimeRanges(threadTimeRanges) {
- var ret = [];
- threadTimeRanges.forEach(function(threadTimeRange) {
- var slices = [];
-
- threadTimeRange.thread.sliceGroup.iterSlicesInTimeRange(
- function(slice) { slices.push(slice); },
- threadTimeRange.start, threadTimeRange.end);
- ret.push.apply(ret, slices);
- });
- return ret;
- }
-
- function makeFrame(threadTimeRanges, surfaceFlinger) {
- var args = {};
- if (surfaceFlinger && surfaceFlinger.hasVsyncs) {
- var start = Statistics.min(threadTimeRanges,
- function(threadTimeRanges) { return threadTimeRanges.start; });
- args['deadline'] = surfaceFlinger.getFrameDeadline(start);
- args['frameKickoff'] = surfaceFlinger.getFrameKickoff(start);
- }
- var events = getSlicesForThreadTimeRanges(threadTimeRanges);
- return new Frame(events, threadTimeRanges, args);
- }
-
- function findOverlappingDrawFrame(renderThread, time) {
- if (!renderThread)
- return undefined;
-
- var slices = renderThread.sliceGroup.slices;
- for (var i = 0; i < slices.length; i++) {
- var slice = slices[i];
- if (slice.title == RENDER_THREAD_DRAW_NAME &&
- slice.start <= time &&
- time <= slice.end) {
- return slice;
- }
- }
- return undefined;
- }
-
- /**
- * Builds an array of {start, end} ranges grouping common work of a frame
- * that occurs just before performTraversals().
- *
- * Only necessary before Choreographer#doFrame tracing existed.
- */
- function getPreTraversalWorkRanges(uiThread) {
- if (!uiThread)
- return [];
-
- // gather all frame work that occurs outside of performTraversals
- var preFrameEvents = [];
- uiThread.sliceGroup.slices.forEach(function(slice) {
- if (slice.title == 'obtainView' ||
- slice.title == 'setupListItem' ||
- slice.title == 'deliverInputEvent' ||
- slice.title == 'RV Scroll')
- preFrameEvents.push(slice);
- });
- uiThread.asyncSliceGroup.slices.forEach(function(slice) {
- if (slice.title == 'deliverInputEvent')
- preFrameEvents.push(slice);
- });
-
- return tr.b.mergeRanges(
- tr.b.convertEventsToRanges(preFrameEvents),
- 3,
- function(events) {
- return {
- start: events[0].min,
- end: events[events.length - 1].max
- };
- });
- }
-
- function getFrameStartTime(traversalStart, preTraversalWorkRanges) {
- var preTraversalWorkRange = tr.b.findClosestIntervalInSortedIntervals(
- preTraversalWorkRanges,
- function(range) { return range.start },
- function(range) { return range.end },
- traversalStart,
- 3);
-
- if (preTraversalWorkRange)
- return preTraversalWorkRange.start;
- return traversalStart;
- }
-
- function getUiThreadDrivenFrames(app) {
- if (!app.uiThread)
- return [];
-
- var preTraversalWorkRanges = [];
- if (app.uiDrawType == UI_DRAW_TYPE.LEGACY)
- preTraversalWorkRanges = getPreTraversalWorkRanges(app.uiThread);
-
- var frames = [];
- app.uiThread.sliceGroup.slices.forEach(function(slice) {
- if (!(slice.title in UI_THREAD_DRAW_NAMES)) {
- return;
- }
-
- var threadTimeRanges = [];
- var uiThreadTimeRange = {
- thread: app.uiThread,
- start: getFrameStartTime(slice.start, preTraversalWorkRanges),
- end: slice.end
- };
- threadTimeRanges.push(uiThreadTimeRange);
-
- // on SDK 21+ devices with RenderThread,
- // account for time taken on RenderThread
- var rtDrawSlice = findOverlappingDrawFrame(
- app.renderThread, slice.end);
- if (rtDrawSlice) {
- var rtSyncSlice = rtDrawSlice.findDescendentSlice(THREAD_SYNC_NAME);
- if (rtSyncSlice) {
- // Generally, the UI thread is only on the critical path
- // until the start of sync.
- uiThreadTimeRange.end = Math.min(uiThreadTimeRange.end,
- rtSyncSlice.start);
- }
-
- threadTimeRanges.push({
- thread: app.renderThread,
- start: rtDrawSlice.start,
- end: rtDrawSlice.end
- });
- }
- frames.push(makeFrame(threadTimeRanges, app.surfaceFlinger));
- });
- return frames;
- }
-
- function getRenderThreadDrivenFrames(app) {
- if (!app.renderThread)
- return [];
-
- var frames = [];
- app.renderThread.sliceGroup.getSlicesOfName(RENDER_THREAD_INDEP_DRAW_NAME)
- .forEach(function(slice) {
- var threadTimeRanges = [{
- thread: app.renderThread,
- start: slice.start,
- end: slice.end
- }];
- frames.push(makeFrame(threadTimeRanges, app.surfaceFlinger));
- });
- return frames;
- }
-
- function getUiDrawType(uiThread) {
- if (!uiThread)
- return UI_DRAW_TYPE.NONE;
-
- var slices = uiThread.sliceGroup.slices;
- for (var i = 0; i < slices.length; i++) {
- if (slices[i].title in UI_THREAD_DRAW_NAMES) {
- return UI_THREAD_DRAW_NAMES[slices[i].title];
- }
- }
- return UI_DRAW_TYPE.NONE;
- }
-
- function getInputSamples(process) {
- var samples = undefined;
- for (var counterName in process.counters) {
- if (/^android\.aq\:pending/.test(counterName) &&
- process.counters[counterName].numSeries == 1) {
- samples = process.counters[counterName].series[0].samples;
- break;
- }
- }
-
- if (!samples)
- return [];
-
- // output rising edges only, since those are user inputs
- var inputSamples = [];
- var lastValue = 0;
- samples.forEach(function(sample) {
- if (sample.value > lastValue) {
- inputSamples.push(sample);
- }
- lastValue = sample.value;
- });
- return inputSamples;
- }
-
- function getAnimationAsyncSlices(uiThread) {
- if (!uiThread)
- return [];
-
- var slices = [];
- for (var slice of uiThread.asyncSliceGroup.getDescendantEvents()) {
- if (/^animator\:/.test(slice.title))
- slices.push(slice);
- }
- return slices;
- }
-
- /**
- * Model for Android App specific data.
- * @constructor
- */
- function AndroidApp(process, uiThread, renderThread, surfaceFlinger,
- uiDrawType) {
- this.process = process;
- this.uiThread = uiThread;
- this.renderThread = renderThread;
- this.surfaceFlinger = surfaceFlinger;
- this.uiDrawType = uiDrawType;
-
- this.frames_ = undefined;
- this.inputs_ = undefined;
- };
-
- AndroidApp.createForProcessIfPossible = function(process, surfaceFlinger) {
- var uiThread = process.getThread(process.pid);
- var uiDrawType = getUiDrawType(uiThread);
- if (uiDrawType == UI_DRAW_TYPE.NONE) {
- uiThread = undefined;
- }
- var renderThreads = process.findAllThreadsNamed('RenderThread');
- var renderThread = renderThreads.length == 1 ? renderThreads[0] : undefined;
-
- if (uiThread || renderThread) {
- return new AndroidApp(process, uiThread, renderThread, surfaceFlinger,
- uiDrawType);
- }
- };
-
- AndroidApp.prototype = {
- /**
- * Returns a list of all frames in the trace for the app,
- * constructed on first query.
- */
- getFrames: function() {
- if (!this.frames_) {
- var uiFrames = getUiThreadDrivenFrames(this);
- var rtFrames = getRenderThreadDrivenFrames(this);
- this.frames_ = uiFrames.concat(rtFrames);
-
- // merge frames by sorting by end timestamp
- this.frames_.sort(function(a, b) { a.end - b.end });
- }
- return this.frames_;
- },
-
- /**
- * Returns list of CounterSamples for each input event enqueued to the app.
- */
- getInputSamples: function() {
- if (!this.inputs_) {
- this.inputs_ = getInputSamples(this.process);
- }
- return this.inputs_;
- },
-
- getAnimationAsyncSlices: function() {
- if (!this.animations_) {
- this.animations_ = getAnimationAsyncSlices(this.uiThread);
- }
- return this.animations_;
- }
- };
-
- return {
- AndroidApp: AndroidApp
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/helpers/android_model_helper.html b/chromium/third_party/catapult/tracing/tracing/model/helpers/android_model_helper.html
deleted file mode 100644
index c0b3d5ce5bb..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/helpers/android_model_helper.html
+++ /dev/null
@@ -1,104 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/base/range_utils.html">
-<link rel="import" href="/tracing/core/auditor.html">
-<link rel="import" href="/tracing/model/helpers/android_app.html">
-<link rel="import" href="/tracing/model/helpers/android_surface_flinger.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Class for managing android-specific model meta data,
- * such as rendering apps, frames rendered, and SurfaceFlinger.
- */
-tr.exportTo('tr.model.helpers', function() {
- var AndroidApp = tr.model.helpers.AndroidApp;
- var AndroidSurfaceFlinger = tr.model.helpers.AndroidSurfaceFlinger;
-
- var IMPORTANT_SURFACE_FLINGER_SLICES = {
- 'doComposition' : true,
- 'updateTexImage' : true,
- 'postFramebuffer' : true
- };
- var IMPORTANT_UI_THREAD_SLICES = {
- 'Choreographer#doFrame' : true,
- 'performTraversals' : true,
- 'deliverInputEvent' : true
- };
- var IMPORTANT_RENDER_THREAD_SLICES = {
- 'doFrame' : true
- };
-
- function iterateImportantThreadSlices(thread, important, callback) {
- if (!thread)
- return;
-
- thread.sliceGroup.slices.forEach(function(slice) {
- if (slice.title in important)
- callback(slice);
- });
- }
-
- /**
- * Model for Android-specific data.
- * @constructor
- */
- function AndroidModelHelper(model) {
- this.model = model;
- this.apps = [];
- this.surfaceFlinger = undefined;
-
- var processes = model.getAllProcesses();
- for (var i = 0; i < processes.length && !this.surfaceFlinger; i++) {
- this.surfaceFlinger =
- AndroidSurfaceFlinger.createForProcessIfPossible(processes[i]);
- }
-
- model.getAllProcesses().forEach(function(process) {
- var app = AndroidApp.createForProcessIfPossible(
- process, this.surfaceFlinger);
- if (app)
- this.apps.push(app);
- }, this);
- };
-
- AndroidModelHelper.guid = tr.b.GUID.allocateSimple();
-
- AndroidModelHelper.supportsModel = function(model) {
- return true;
- };
-
- AndroidModelHelper.prototype = {
- iterateImportantSlices: function(callback) {
- if (this.surfaceFlinger) {
- iterateImportantThreadSlices(
- this.surfaceFlinger.thread,
- IMPORTANT_SURFACE_FLINGER_SLICES,
- callback);
- }
-
- this.apps.forEach(function(app) {
- iterateImportantThreadSlices(
- app.uiThread,
- IMPORTANT_UI_THREAD_SLICES,
- callback);
- iterateImportantThreadSlices(
- app.renderThread,
- IMPORTANT_RENDER_THREAD_SLICES,
- callback);
- });
- }
- };
-
- return {
- AndroidModelHelper: AndroidModelHelper
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/helpers/android_model_helper_test.html b/chromium/third_party/catapult/tracing/tracing/model/helpers/android_model_helper_test.html
deleted file mode 100644
index 114bd5a8a10..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/helpers/android_model_helper_test.html
+++ /dev/null
@@ -1,227 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/android/android_auditor.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var AndroidModelHelper = tr.model.helpers.AndroidModelHelper;
- var newAsyncSliceNamed = tr.c.TestUtils.newAsyncSliceNamed;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
- var newCounterNamed = tr.c.TestUtils.newCounterNamed;
- var newCounterSeries = tr.c.TestUtils.newCounterSeries;
-
- function createSurfaceFlingerWithVsyncs(model) {
- if (model.getProcess(2))
- throw new Error('process already exists');
-
- var sfProcess = model.getOrCreateProcess(2);
- var sfThread = sfProcess.getOrCreateThread(2); // main thread, tid = pid
- sfThread.name = '/system/bin/surfaceflinger';
-
- // ensure slicegroup has data
- sfThread.sliceGroup.pushSlice(newSliceEx({
- title: 'doComposition',
- start: 8,
- duration: 2
- }));
-
- var counter = sfProcess.getOrCreateCounter('android', 'VSYNC');
- var series = newCounterSeries();
- for (var i = 0; i <= 10; i++) {
- series.addCounterSample(i * 10, i % 2);
- }
- counter.addSeries(series);
- }
-
- /*
- * List of customizeModelCallbacks which produce different 80ms frames,
- * each starting at 10ms, and with a single important slice
- */
- var SINGLE_FRAME_CUSTOM_MODELS = [
- function(model) {
- // UI thread only
- var uiThread = model.getOrCreateProcess(120).getOrCreateThread(120);
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 10, duration: 80}));
-
- model.uiThread = uiThread;
- },
-
- function(model) {
- // RenderThread only
- var renderThread = model.getOrCreateProcess(120).getOrCreateThread(200);
- renderThread.name = 'RenderThread';
- renderThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'doFrame', start: 10, duration: 80}));
-
- model.renderThread = renderThread;
- },
-
- function(model) {
- var uiThread = model.getOrCreateProcess(120).getOrCreateThread(120);
-
- // UI thread time - 19 (from 10 to 29)
- uiThread.asyncSliceGroup.push(
- newAsyncSliceNamed('deliverInputEvent', 10, 9, uiThread, uiThread));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 20, duration: 10}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'draw', start: 20, duration: 8}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'Record View#draw()', start: 20, duration: 8}));
-
- // RenderThread time - 61 (from 29 to 90)
- var renderThread = model.getOrCreateProcess(120).getOrCreateThread(200);
- renderThread.name = 'RenderThread';
- renderThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'DrawFrame', start: 29, duration: 61}));
- renderThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'syncFrameState', start: 29, duration: 1}));
-
- model.uiThread = uiThread;
- model.renderThread = renderThread;
- }
- ];
-
- test('getThreads', function() {
- SINGLE_FRAME_CUSTOM_MODELS.forEach(function(customizeModelCallback) {
- var model = tr.c.TestUtils.newModel(customizeModelCallback);
- var helper = model.getOrCreateHelper(AndroidModelHelper);
- assert.equal(helper.apps[0].uiThread, model.uiThread);
- assert.equal(helper.apps[0].renderThread, model.renderThread);
- });
- });
-
- test('iterateImportantSlices', function() {
- SINGLE_FRAME_CUSTOM_MODELS.forEach(function(customizeModelCallback) {
- var model = tr.c.TestUtils.newModel(customizeModelCallback);
- var helper = model.getOrCreateHelper(AndroidModelHelper);
-
- var seen = 0;
- helper.iterateImportantSlices(function(importantSlice) {
- assert.isTrue(importantSlice instanceof tr.model.Slice);
- seen++;
- });
- assert.equal(seen, 1);
- });
- });
-
- test('getFrames', function() {
- SINGLE_FRAME_CUSTOM_MODELS.forEach(function(customizeModelCallback) {
- var model = tr.c.TestUtils.newModel(customizeModelCallback);
- var helper = model.getOrCreateHelper(AndroidModelHelper);
- assert.equal(helper.apps.length, 1);
-
- var frames = helper.apps[0].getFrames();
- assert.equal(frames.length, 1);
- assert.closeTo(frames[0].totalDuration, 80, 1e-5);
-
- assert.closeTo(frames[0].start, 10, 1e-5);
- assert.closeTo(frames[0].end, 90, 1e-5);
- });
- });
-
- test('surfaceFlingerVsyncs', function() {
- var model = tr.c.TestUtils.newModel(createSurfaceFlingerWithVsyncs);
- var helper = model.getOrCreateHelper(AndroidModelHelper);
- assert.isTrue(helper.surfaceFlinger.hasVsyncs);
-
- // test querying the vsyncs
- assert.closeTo(helper.surfaceFlinger.getFrameKickoff(5), 0, 1e-5);
- assert.closeTo(helper.surfaceFlinger.getFrameDeadline(95), 100, 1e-5);
-
- assert.closeTo(helper.surfaceFlinger.getFrameKickoff(10), 10, 1e-5);
- assert.closeTo(helper.surfaceFlinger.getFrameDeadline(90), 100, 1e-5);
-
- // test undefined behavior outside of vsyncs.
- assert.isUndefined(helper.surfaceFlinger.getFrameKickoff(-5));
- assert.isUndefined(helper.surfaceFlinger.getFrameDeadline(105));
- });
-
- test('frameVsyncInterop', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- // app - 3 good, 3 bad frames
- var uiThread = model.getOrCreateProcess(1).getOrCreateThread(1);
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 1, duration: 8}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 10, duration: 8}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 20, duration: 8}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 31, duration: 11}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 45, duration: 6}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 60, duration: 20}));
-
- // surface flinger - vsync every 10ms
- createSurfaceFlingerWithVsyncs(model);
- });
- var helper = model.getOrCreateHelper(AndroidModelHelper);
-
- var frames = helper.apps[0].getFrames();
- assert.equal(frames.length, 6);
- for (var i = 0; i < 6; i++) {
- var shouldMissDeadline = i >= 3;
- var missedDeadline = frames[i].args['deadline'] < frames[i].end;
- assert.equal(shouldMissDeadline, missedDeadline);
- }
- });
-
- test('appInputs', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var process = model.getOrCreateProcess(120);
- var uiThread = process.getOrCreateThread(120);
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 20, duration: 4}));
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 40, duration: 4}));
-
- var counter = process.getOrCreateCounter('android', 'aq:pending:foo');
- var series = newCounterSeries();
- series.addCounterSample(10, 1);
- series.addCounterSample(20, 0);
- series.addCounterSample(30, 1);
- series.addCounterSample(40, 2);
- series.addCounterSample(50, 0);
- counter.addSeries(series);
- });
- var helper = model.getOrCreateHelper(AndroidModelHelper);
- assert.equal(helper.apps.length, 1);
-
- var inputSamples = helper.apps[0].getInputSamples();
- assert.equal(inputSamples.length, 3);
- assert.equal(inputSamples[0].timestamp, 10);
- assert.equal(inputSamples[1].timestamp, 30);
- assert.equal(inputSamples[2].timestamp, 40);
- });
-
- test('appAnimations', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var process = model.getOrCreateProcess(120);
- var uiThread = process.getOrCreateThread(120);
- uiThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'performTraversals', start: 10, duration: 10}));
- uiThread.asyncSliceGroup.push(newAsyncSliceNamed('animator:foo', 0, 10,
- uiThread, uiThread));
- });
- var helper = model.getOrCreateHelper(AndroidModelHelper);
- assert.equal(helper.apps.length, 1);
-
- var animations = helper.apps[0].getAnimationAsyncSlices();
- assert.equal(animations.length, 1);
- assert.equal(animations[0].start, 0);
- assert.equal(animations[0].end, 10);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/helpers/android_surface_flinger.html b/chromium/third_party/catapult/tracing/tracing/model/helpers/android_surface_flinger.html
deleted file mode 100644
index 0ecc05f1054..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/helpers/android_surface_flinger.html
+++ /dev/null
@@ -1,105 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Class for representing SurfaceFlinger process and its Vsyncs.
- */
-tr.exportTo('tr.model.helpers', function() {
- var findLowIndexInSortedArray = tr.b.findLowIndexInSortedArray;
-
- var VSYNC_SF_NAME = 'android.VSYNC-sf';
- var VSYNC_APP_NAME = 'android.VSYNC-app';
- var VSYNC_FALLBACK_NAME = 'android.VSYNC';
-
- // when sampling vsync, push samples back by this much to ensure
- // frame start samples *between* vsyncs
- var TIMESTAMP_FUDGE_MS = 0.01;
-
- function getVsyncTimestamps(process, counterName) {
-
- var vsync = process.counters[counterName];
- if (!vsync)
- vsync = process.counters[VSYNC_FALLBACK_NAME];
-
- if (vsync && vsync.numSeries == 1 && vsync.numSamples > 1)
- return vsync.series[0].timestamps;
- return undefined;
- }
-
- /**
- * Model for SurfaceFlinger specific data.
- * @constructor
- */
- function AndroidSurfaceFlinger(process, thread) {
- this.process = process;
- this.thread = thread;
-
- this.appVsync_ = undefined;
- this.sfVsync_ = undefined;
-
- this.appVsyncTimestamps_ = getVsyncTimestamps(process, VSYNC_APP_NAME);
- this.sfVsyncTimestamps_ = getVsyncTimestamps(process, VSYNC_SF_NAME);
- };
-
- AndroidSurfaceFlinger.createForProcessIfPossible = function(process) {
- var mainThread = process.getThread(process.pid);
-
- // newer versions - main thread, lowercase name, preceeding forward slash
- if (mainThread && mainThread.name &&
- /surfaceflinger/.test(mainThread.name))
- return new AndroidSurfaceFlinger(process, mainThread);
-
- // older versions - another thread is named SurfaceFlinger
- var primaryThreads = process.findAllThreadsNamed('SurfaceFlinger');
- if (primaryThreads.length == 1)
- return new AndroidSurfaceFlinger(process, primaryThreads[0]);
- return undefined;
- };
-
- AndroidSurfaceFlinger.prototype = {
- get hasVsyncs() {
- return !!this.appVsyncTimestamps_ && !!this.sfVsyncTimestamps_;
- },
-
- getFrameKickoff: function(timestamp) {
- if (!this.hasVsyncs)
- throw new Error('cannot query vsync info without vsyncs');
-
- var firstGreaterIndex =
- findLowIndexInSortedArray(this.appVsyncTimestamps_,
- function(x) { return x; },
- timestamp + TIMESTAMP_FUDGE_MS);
-
- if (firstGreaterIndex < 1)
- return undefined;
- return this.appVsyncTimestamps_[firstGreaterIndex - 1];
- },
-
- getFrameDeadline: function(timestamp) {
- if (!this.hasVsyncs)
- throw new Error('cannot query vsync info without vsyncs');
-
- var firstGreaterIndex =
- findLowIndexInSortedArray(this.sfVsyncTimestamps_,
- function(x) { return x; },
- timestamp + TIMESTAMP_FUDGE_MS);
- if (firstGreaterIndex >= this.sfVsyncTimestamps_.length)
- return undefined;
- return this.sfVsyncTimestamps_[firstGreaterIndex];
- }
- };
-
- return {
- AndroidSurfaceFlinger: AndroidSurfaceFlinger
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_browser_helper.html b/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_browser_helper.html
deleted file mode 100644
index f1f0a438e15..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_browser_helper.html
+++ /dev/null
@@ -1,129 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/helpers/chrome_process_helper.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Utilities for accessing trace data about the Chrome browser.
- */
-tr.exportTo('tr.model.helpers', function() {
- function ChromeBrowserHelper(modelHelper, process) {
- tr.model.helpers.ChromeProcessHelper.call(this, modelHelper, process);
- this.mainThread_ = process.findAtMostOneThreadNamed('CrBrowserMain');
- }
-
- ChromeBrowserHelper.isBrowserProcess = function(process) {
- return !!process.findAtMostOneThreadNamed('CrBrowserMain');
- };
-
- ChromeBrowserHelper.prototype = {
- __proto__: tr.model.helpers.ChromeProcessHelper.prototype,
-
- // TODO(petrcermak): Pass browser name in a metadata event (see
- // crbug.com/605088).
- get browserName() {
- var hasInProcessRendererThread = this.process.findAllThreadsNamed(
- 'Chrome_InProcRendererThread').length > 0;
- return hasInProcessRendererThread ? 'webview' : 'chrome';
- },
-
- get rendererHelpers() {
- return this.modelHelper.rendererHelpers;
- },
-
- getLoadingEventsInRange: function(rangeOfInterest) {
- return this.getAllAsyncSlicesMatching(function(slice) {
- return slice.title.indexOf('WebContentsImpl Loading') === 0 &&
- rangeOfInterest.intersectsExplicitRangeInclusive(
- slice.start, slice.end);
- });
- },
-
- getCommitProvisionalLoadEventsInRange: function(rangeOfInterest) {
- return this.getAllAsyncSlicesMatching(function(slice) {
- return slice.title === 'RenderFrameImpl::didCommitProvisionalLoad' &&
- rangeOfInterest.intersectsExplicitRangeInclusive(
- slice.start, slice.end);
- });
- },
-
- get hasLatencyEvents() {
- var hasLatency = false;
- for (var thread of this.modelHelper.model.getAllThreads())
- for (var event of thread.getDescendantEvents()) {
- if (!event.isTopLevel)
- continue;
- if (!(event instanceof tr.e.cc.InputLatencyAsyncSlice))
- continue;
- hasLatency = true;
- }
- return hasLatency;
- },
-
- getLatencyEventsInRange: function(rangeOfInterest) {
- return this.getAllAsyncSlicesMatching(function(slice) {
- return (slice.title.indexOf('InputLatency') === 0) &&
- rangeOfInterest.intersectsExplicitRangeInclusive(
- slice.start, slice.end);
- });
- },
-
- getAllAsyncSlicesMatching: function(pred, opt_this) {
- var events = [];
- this.iterAllThreads(function(thread) {
- for (var slice of thread.getDescendantEvents())
- if (pred.call(opt_this, slice))
- events.push(slice);
- });
- return events;
- },
-
- getAllNetworkEventsInRange: function(rangeOfInterest) {
- var networkEvents = [];
- this.modelHelper.model.getAllThreads().forEach(function(thread) {
- thread.asyncSliceGroup.slices.forEach(function(slice) {
- var match = false;
- if (slice.category == 'net' || // old-style URLRequest/Resource
- slice.category == 'disabled-by-default-netlog' ||
- slice.category == 'netlog') {
- match = true;
- }
-
- if (!match)
- return;
-
- if (rangeOfInterest.intersectsExplicitRangeInclusive(
- slice.start, slice.end))
- networkEvents.push(slice);
- });
- });
- return networkEvents;
- },
-
- iterAllThreads: function(func, opt_this) {
- tr.b.iterItems(this.process.threads, function(tid, thread) {
- func.call(opt_this, thread);
- });
-
- tr.b.iterItems(this.rendererHelpers, function(pid, rendererHelper) {
- var rendererProcess = rendererHelper.process;
- tr.b.iterItems(rendererProcess.threads, function(tid, thread) {
- func.call(opt_this, thread);
- });
- }, this);
- }
- };
-
- return {
- ChromeBrowserHelper: ChromeBrowserHelper
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_browser_helper_test.html b/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_browser_helper_test.html
deleted file mode 100644
index eba20ad50af..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_browser_helper_test.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/cc/input_latency_async_slice.html">
-<link rel="import" href="/tracing/extras/chrome/chrome_test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/helpers/chrome_browser_helper.html">
-<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var INPUT_TYPE = tr.e.cc.INPUT_EVENT_TYPE_NAMES;
-
- function getRange(min, max) {
- var range = new tr.b.Range();
- range.min = min;
- range.max = max;
- return range;
- }
-
- test('LoadingEvent', function() {
- var model = tr.e.chrome.ChromeTestUtils.newChromeModel(function() { });
- var modelHelper = model.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- tr.e.chrome.ChromeTestUtils.addLoadingEvent(model, {start: 1, end: 10});
- assert.equal(1, modelHelper.browserHelper.getLoadingEventsInRange(
- getRange(0, 100)).length);
- });
-
- test('ProvisionalLoadEvent', function() {
- var model = tr.e.chrome.ChromeTestUtils.newChromeModel(function() { });
- var modelHelper = model.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- tr.e.chrome.ChromeTestUtils.addCommitLoadEvent(model, {start: 1, end: 10});
- assert.equal(1,
- modelHelper.browserHelper.getCommitProvisionalLoadEventsInRange(
- getRange(0, 100)).length);
- });
-
- test('LatencyEvent', function() {
- var model = tr.e.chrome.ChromeTestUtils.newChromeModel(function() { });
- var modelHelper = model.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- tr.e.chrome.ChromeTestUtils.addInputEvent(
- model, INPUT_TYPE.UNKNOWN, {start: 1, end: 10});
- assert.equal(1, modelHelper.browserHelper.getLatencyEventsInRange(
- getRange(0, 100)).length);
- });
-
- test('NetworkEvent', function() {
- var model = tr.e.chrome.ChromeTestUtils.newChromeModel(function() { });
- var modelHelper = model.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- tr.e.chrome.ChromeTestUtils.addNetworkEvent(model, {start: 1, end: 10});
- assert.equal(1, modelHelper.browserHelper.getAllNetworkEventsInRange(
- getRange(0, 100)).length);
- });
-
- test('browserName_chrome', function() {
- var model = tr.e.chrome.ChromeTestUtils.newChromeModel(function() { });
- var modelHelper = model.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- assert.strictEqual(modelHelper.browserHelper.browserName, 'chrome');
- });
-
- test('browserName_webview', function() {
- var model = tr.e.chrome.ChromeTestUtils.newChromeModel(function() { });
- model.browserProcess.getOrCreateThread(42).name =
- 'Chrome_InProcRendererThread';
- var modelHelper = model.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- assert.strictEqual(modelHelper.browserHelper.browserName, 'webview');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_gpu_helper.html b/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_gpu_helper.html
deleted file mode 100644
index fe3cb49e108..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_gpu_helper.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/model/helpers/chrome_process_helper.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Utilities for accessing the Chrome GPU Process.
- */
-tr.exportTo('tr.model.helpers', function() {
- function ChromeGpuHelper(modelHelper, process) {
- tr.model.helpers.ChromeProcessHelper.call(this, modelHelper, process);
- this.mainThread_ = process.findAtMostOneThreadNamed('CrGpuMain');
- };
-
- ChromeGpuHelper.isGpuProcess = function(process) {
- // In some android builds the GPU thread is not in a separate process.
- if (process.findAtMostOneThreadNamed('CrBrowserMain') ||
- process.findAtMostOneThreadNamed('CrRendererMain'))
- return false;
- return process.findAtMostOneThreadNamed('CrGpuMain');
- };
-
- ChromeGpuHelper.prototype = {
- __proto__: tr.model.helpers.ChromeProcessHelper.prototype,
-
- get mainThread() {
- return this.mainThread_;
- }
- };
-
- return {
- ChromeGpuHelper: ChromeGpuHelper
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_model_helper.html b/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_model_helper.html
deleted file mode 100644
index 51b762abb3c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_model_helper.html
+++ /dev/null
@@ -1,124 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/helpers/chrome_browser_helper.html">
-<link rel="import" href="/tracing/model/helpers/chrome_gpu_helper.html">
-<link rel="import" href="/tracing/model/helpers/chrome_renderer_helper.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Utilities for accessing trace data about the Chrome browser.
- */
-tr.exportTo('tr.model.helpers', function() {
- function findChromeBrowserProcesses(model) {
- return model.getAllProcesses(
- tr.model.helpers.ChromeBrowserHelper.isBrowserProcess);
- }
-
- function findChromeRenderProcesses(model) {
- return model.getAllProcesses(
- tr.model.helpers.ChromeRendererHelper.isRenderProcess);
- }
-
- function findChromeGpuProcess(model) {
- var gpuProcesses = model.getAllProcesses(
- tr.model.helpers.ChromeGpuHelper.isGpuProcess);
- if (gpuProcesses.length !== 1)
- return undefined;
- return gpuProcesses[0];
- }
-
- /**
- * @constructor
- */
- function ChromeModelHelper(model) {
- this.model_ = model;
-
- // Find browserHelpers.
- var browserProcesses = findChromeBrowserProcesses(model);
- this.browserHelpers_ = browserProcesses.map(
- p => new tr.model.helpers.ChromeBrowserHelper(this, p));
-
- // Find gpuHelper.
- var gpuProcess = findChromeGpuProcess(model);
- if (gpuProcess) {
- this.gpuHelper_ = new tr.model.helpers.ChromeGpuHelper(
- this, gpuProcess);
- } else {
- this.gpuHelper_ = undefined;
- }
-
- // Find rendererHelpers.
- var rendererProcesses_ = findChromeRenderProcesses(model);
-
- this.rendererHelpers_ = {};
- rendererProcesses_.forEach(function(renderProcess) {
- var rendererHelper = new tr.model.helpers.ChromeRendererHelper(
- this, renderProcess);
- this.rendererHelpers_[rendererHelper.pid] = rendererHelper;
- }, this);
- }
-
- ChromeModelHelper.guid = tr.b.GUID.allocateSimple();
-
- ChromeModelHelper.supportsModel = function(model) {
- if (findChromeBrowserProcesses(model).length)
- return true;
- if (findChromeRenderProcesses(model).length)
- return true;
- return false;
- };
-
- ChromeModelHelper.prototype = {
- get pid() {
- throw new Error('woah');
- },
-
- get process() {
- throw new Error('woah');
- },
-
- get model() {
- return this.model_;
- },
-
- // TODO: Make all users of ChromeModelHelper support multiple browsers and
- // remove this getter (see #2119).
- get browserProcess() {
- if (this.browserHelper === undefined)
- return undefined;
- return this.browserHelper.process;
- },
-
- // TODO: Make all users of ChromeModelHelper support multiple browsers and
- // remove this getter (see #2119).
- get browserHelper() {
- return this.browserHelpers_[0];
- },
-
- get browserHelpers() {
- return this.browserHelpers_;
- },
-
- get gpuHelper() {
- return this.gpuHelper_;
- },
-
- get rendererHelpers() {
- return this.rendererHelpers_;
- }
- };
-
- return {
- ChromeModelHelper: ChromeModelHelper
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_model_helper_test.html b/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_model_helper_test.html
deleted file mode 100644
index f9664840ade..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_model_helper_test.html
+++ /dev/null
@@ -1,167 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/chrome_test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/helpers/chrome_browser_helper.html">
-<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newAsyncSliceEx = tr.c.TestUtils.newAsyncSliceEx;
-
- test('getLatencyData', function() {
- var m = tr.e.chrome.ChromeTestUtils.newChromeModel(function(m) {
- m.browserMain.asyncSliceGroup.push(newAsyncSliceEx({
- title: 'InputLatency::GestureScrollUpdate',
- cat: 'benchmark',
- start: 0,
- end: 10,
- id: '0x100',
- isTopLevel: true,
- args: {
- data: {
- INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT: {'time' : 0},
- INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT: {time: 10}
- }
- }
- }));
- });
-
- var modelHelper = m.getOrCreateHelper(tr.model.helpers.ChromeModelHelper);
- var latencyEvents = modelHelper.browserHelper.getLatencyEventsInRange(
- m.bounds);
- assert.equal(latencyEvents.length, 1);
- });
-
- test('getFrametime', function() {
- var frame_ts;
- var events = [];
- // Browser process 3507
- events.push({'cat' : '__metadata', 'pid' : 3507, 'tid' : 3507, 'ts' : 0, 'ph' : 'M', 'name' : 'thread_name', 'args' : {'name' : 'CrBrowserMain'}}); // @suppress longLineCheck
-
- // Renderer process 3508
- events.push({'cat' : '__metadata', 'pid' : 3508, 'tid' : 3508, 'ts' : 0, 'ph' : 'M', 'name' : 'thread_name', 'args' : {'name' : 'CrRendererMain'}}); // @suppress longLineCheck
- // Compositor thread 3510
- events.push({'cat' : '__metadata', 'pid' : 3508, 'tid' : 3510, 'ts' : 0, 'ph' : 'M', 'name' : 'thread_name', 'args' : {'name' : 'Compositor'}}); // @suppress longLineCheck
-
- // Renderer process 3509
- events.push({'cat' : '__metadata', 'pid' : 3509, 'tid' : 3509, 'ts' : 0, 'ph' : 'M', 'name' : 'thread_name', 'args' : {'name' : 'CrRendererMain'}}); // @suppress longLineCheck
-
- // Compositor thread 3511
- events.push({'cat' : '__metadata', 'pid' : 3509, 'tid' : 3511, 'ts' : 0, 'ph' : 'M', 'name' : 'thread_name', 'args' : {'name' : 'Compositor'}}); // @suppress longLineCheck
-
- frame_ts = 0;
- // Add impl rendering stats for browser process 3507
- for (var i = 0; i < 10; i++) {
- events.push({'cat' : 'benchmark', 'pid' : 3507, 'tid' : 3507, 'ts' : frame_ts, 'ph' : 'i', 'name' : 'BenchmarkInstrumentation::ImplThreadRenderingStats', 's' : 't'}); // @suppress longLineCheck
- frame_ts += 16000 + 1000 * (i % 2);
- }
-
- frame_ts = 0;
- // Add main rendering stats for renderer process 3508
- for (var i = 0; i < 10; i++) {
- events.push({'cat' : 'benchmark', 'pid' : 3508, 'tid' : 3508, 'ts' : frame_ts, 'ph' : 'i', 'name' : 'BenchmarkInstrumentation::MainThreadRenderingStats', 's' : 't'}); // @suppress longLineCheck
- frame_ts += 16000 + 1000 * (i % 2);
- }
- events.push({'cat' : 'benchmark', 'pid' : 3508, 'tid' : 3510, 'ts' : 1600, 'ph' : 'i', 'name' : 'KeepAlive', 's' : 't'}); // @suppress longLineCheck
-
- frame_ts = 0;
- // Add impl and main rendering stats for renderer process 3509
- for (var i = 0; i < 10; i++) {
- events.push({'cat' : 'benchmark', 'pid' : 3509, 'tid' : 3511, 'ts' : frame_ts, 'ph' : 'i', 'name' : 'BenchmarkInstrumentation::ImplThreadRenderingStats', 's' : 't'}); // @suppress longLineCheck
- events.push({'cat' : 'benchmark', 'pid' : 3509, 'tid' : 3509, 'ts' : frame_ts, 'ph' : 'i', 'name' : 'BenchmarkInstrumentation::MainThreadRenderingStats', 's' : 't'}); // @suppress longLineCheck
- frame_ts += 16000 + 1000 * (i % 2);
- }
-
- var m = tr.c.TestUtils.newModelWithEvents([events]);
- var modelHelper = m.getOrCreateHelper(tr.model.helpers.ChromeModelHelper);
-
- // Testing browser impl and main rendering stats.
- var frameEvents = modelHelper.browserHelper.getFrameEventsInRange(
- tr.model.helpers.IMPL_FRAMETIME_TYPE, m.bounds);
- var frametimeData = tr.model.helpers.getFrametimeDataFromEvents(
- frameEvents);
- assert.equal(frametimeData.length, 9);
- for (var i = 0; i < frametimeData.length; i++) {
- assert.equal(frametimeData[i].frametime, 16 + i % 2);
- }
- // No main rendering stats.
- frameEvents = modelHelper.browserHelper.getFrameEventsInRange(
- tr.model.helpers.MAIN_FRAMETIME_TYPE, m.bounds);
- assert.equal(frameEvents.length, 0);
-
-
- // Testing renderer 3508 impl and main rendering stats.
- frameEvents = modelHelper.rendererHelpers[3508].getFrameEventsInRange(
- tr.model.helpers.MAIN_FRAMETIME_TYPE, m.bounds);
- frametimeData = tr.model.helpers.getFrametimeDataFromEvents(frameEvents);
- assert.equal(frametimeData.length, 9);
- for (var i = 0; i < frametimeData.length; i++) {
- assert.equal(frametimeData[i].frametime, 16 + i % 2);
- }
-
- // No impl rendering stats.
- frameEvents = modelHelper.rendererHelpers[3508].getFrameEventsInRange(
- tr.model.helpers.IMPL_FRAMETIME_TYPE, m.bounds);
- assert.equal(frameEvents.length, 0);
-
-
- // Testing renderer 3509 impl and main rendering stats.
- frameEvents = modelHelper.rendererHelpers[3509].getFrameEventsInRange(
- tr.model.helpers.IMPL_FRAMETIME_TYPE, m.bounds);
- frametimeData = tr.model.helpers.getFrametimeDataFromEvents(frameEvents);
- assert.equal(frametimeData.length, 9);
- for (var i = 0; i < frametimeData.length; i++) {
- assert.equal(frametimeData[i].frametime, 16 + i % 2);
- }
-
- frameEvents = modelHelper.rendererHelpers[3509].getFrameEventsInRange(
- tr.model.helpers.MAIN_FRAMETIME_TYPE, m.bounds);
- frametimeData = tr.model.helpers.getFrametimeDataFromEvents(frameEvents);
- assert.equal(frametimeData.length, 9);
- for (var i = 0; i < frametimeData.length; i++) {
- assert.equal(frametimeData[i].frametime, 16 + i % 2);
- }
-
- });
-
- test('multipleBrowsers', function() {
- var m = tr.c.TestUtils.newModel(function(model) {
- var browserProcess1 = model.getOrCreateProcess(1);
- browserProcess1.getOrCreateThread(2).name = 'CrBrowserMain';
-
- var browserProcess2 = model.getOrCreateProcess(3);
- browserProcess2.getOrCreateThread(4);
- browserProcess2.getOrCreateThread(5).name = 'CrBrowserMain';
-
- var nonBrowserProcess = model.getOrCreateProcess(6);
- nonBrowserProcess.getOrCreateThread(7);
-
- var browserProcess3 = model.getOrCreateProcess(8);
- browserProcess3.getOrCreateThread(9).name = 'CrBrowserMain';
- browserProcess3.getOrCreateThread(10);
- });
-
- var modelHelper = m.getOrCreateHelper(tr.model.helpers.ChromeModelHelper);
- var browserHelpers = modelHelper.browserHelpers;
-
- // Check that the correct processes were marked as Chrome browser processes.
- assert.sameMembers(browserHelpers.map(h => h.process.pid), [1, 3, 8]);
-
- // Check that the browser helpers have the correct structure.
- browserHelpers.forEach(function(helper) {
- assert.instanceOf(helper, tr.model.helpers.ChromeBrowserHelper);
- assert.strictEqual(helper.modelHelper, modelHelper);
- });
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_process_helper.html b/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_process_helper.html
deleted file mode 100644
index 7c31f100451..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_process_helper.html
+++ /dev/null
@@ -1,86 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Utilities for accessing trace data about the Chrome browser.
- */
-tr.exportTo('tr.model.helpers', function() {
- var MAIN_FRAMETIME_TYPE = 'main_frametime_type';
- var IMPL_FRAMETIME_TYPE = 'impl_frametime_type';
-
- var MAIN_RENDERING_STATS =
- 'BenchmarkInstrumentation::MainThreadRenderingStats';
- var IMPL_RENDERING_STATS =
- 'BenchmarkInstrumentation::ImplThreadRenderingStats';
-
-
- function getSlicesIntersectingRange(rangeOfInterest, slices) {
- var slicesInFilterRange = [];
- for (var i = 0; i < slices.length; i++) {
- var slice = slices[i];
- if (rangeOfInterest.intersectsExplicitRangeInclusive(
- slice.start, slice.end))
- slicesInFilterRange.push(slice);
- }
- return slicesInFilterRange;
- }
-
-
- function ChromeProcessHelper(modelHelper, process) {
- this.modelHelper = modelHelper;
- this.process = process;
- }
-
- ChromeProcessHelper.prototype = {
- get pid() {
- return this.process.pid;
- },
-
- getFrameEventsInRange: function(frametimeType, range) {
- var titleToGet = (frametimeType === MAIN_FRAMETIME_TYPE ?
- MAIN_RENDERING_STATS : IMPL_RENDERING_STATS);
-
- var frameEvents = [];
- for (var event of this.process.getDescendantEvents())
- if (event.title === titleToGet)
- if (range.intersectsExplicitRangeInclusive(event.start, event.end))
- frameEvents.push(event);
-
- frameEvents.sort(function(a, b) {return a.start - b.start});
- return frameEvents;
- }
- };
-
- function getFrametimeDataFromEvents(frameEvents) {
- var frametimeData = [];
- for (var i = 1; i < frameEvents.length; i++) {
- var diff = frameEvents[i].start - frameEvents[i - 1].start;
- frametimeData.push({
- 'x': frameEvents[i].start,
- 'frametime': diff
- });
- }
- return frametimeData;
- }
-
- return {
- ChromeProcessHelper: ChromeProcessHelper,
-
- MAIN_FRAMETIME_TYPE: MAIN_FRAMETIME_TYPE,
- IMPL_FRAMETIME_TYPE: IMPL_FRAMETIME_TYPE,
- MAIN_RENDERING_STATS: MAIN_RENDERING_STATS,
- IMPL_RENDERING_STATS: IMPL_RENDERING_STATS,
-
- getSlicesIntersectingRange: getSlicesIntersectingRange,
- getFrametimeDataFromEvents: getFrametimeDataFromEvents
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_renderer_helper.html b/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_renderer_helper.html
deleted file mode 100644
index a75906feb1c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/helpers/chrome_renderer_helper.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/model/helpers/chrome_process_helper.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model.helpers', function() {
- function ChromeRendererHelper(modelHelper, process) {
- tr.model.helpers.ChromeProcessHelper.call(this, modelHelper, process);
- this.mainThread_ = process.findAtMostOneThreadNamed('CrRendererMain');
- this.compositorThread_ = process.findAtMostOneThreadNamed('Compositor');
- this.rasterWorkerThreads_ = process.findAllThreadsMatching(function(t) {
- if (t.name === undefined)
- return false;
- if (t.name.indexOf('CompositorTileWorker') === 0)
- return true;
- if (t.name.indexOf('CompositorRasterWorker') === 0)
- return true;
- return false;
- });
-
- this.isChromeTracingUI_ =
- process.labels !== undefined &&
- process.labels.length === 1 &&
- process.labels[0] === 'chrome://tracing';
- };
-
- // Returns true if there is either a main thread or a compositor thread.
- ChromeRendererHelper.isRenderProcess = function(process) {
- if (process.findAtMostOneThreadNamed('CrRendererMain'))
- return true;
- if (process.findAtMostOneThreadNamed('Compositor'))
- return true;
- return false;
- };
-
- ChromeRendererHelper.prototype = {
- __proto__: tr.model.helpers.ChromeProcessHelper.prototype,
-
- // May be undefined.
- get mainThread() {
- return this.mainThread_;
- },
-
- // May be undefined.
- get compositorThread() {
- return this.compositorThread_;
- },
-
- // May be empty.
- get rasterWorkerThreads() {
- return this.rasterWorkerThreads_;
- },
-
- get isChromeTracingUI() {
- return this.isChromeTracingUI_;
- }
- };
-
- return {
- ChromeRendererHelper: ChromeRendererHelper
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/instant_event.html b/chromium/third_party/catapult/tracing/tracing/model/instant_event.html
deleted file mode 100644
index 5c50132116c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/instant_event.html
+++ /dev/null
@@ -1,102 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/timed_event.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
- var InstantEventType = {
- GLOBAL: 1,
- PROCESS: 2
- };
-
- /**
- * An InstantEvent is a zero-duration event.
- *
- * @constructor
- */
- function InstantEvent(category, title, colorId, start, args) {
- tr.model.TimedEvent.call(this, start);
-
- this.category = category || '';
- this.title = title;
- this.colorId = colorId;
- this.args = args;
-
- this.type = undefined;
- };
-
- InstantEvent.prototype = {
- __proto__: tr.model.TimedEvent.prototype
- };
-
- /**
- * A GlobalInstantEvent is a zero-duration event that's not tied to any
- * particular process.
- *
- * An example is a trace event that's issued when a new USB device is plugged
- * into the machine.
- *
- * @constructor
- */
- function GlobalInstantEvent(category, title, colorId, start, args) {
- InstantEvent.apply(this, arguments);
- this.type = InstantEventType.GLOBAL;
- };
-
- GlobalInstantEvent.prototype = {
- __proto__: InstantEvent.prototype,
- get userFriendlyName() {
- return 'Global instant event ' + this.title + ' @ ' +
- tr.v.Unit.byName.timeStampInMs.format(start);
- }
- };
-
- /**
- * A ProcessInstantEvent is a zero-duration event that's tied to a
- * particular process.
- *
- * An example is a trace event that's issued when a kill signal is received.
- *
- * @constructor
- */
- function ProcessInstantEvent(category, title, colorId, start, args) {
- InstantEvent.apply(this, arguments);
- this.type = InstantEventType.PROCESS;
- };
-
- ProcessInstantEvent.prototype = {
- __proto__: InstantEvent.prototype,
-
- get userFriendlyName() {
- return 'Process-level instant event ' + this.title + ' @ ' +
- tr.v.Unit.byName.timeStampInMs.format(start);
- }
- };
-
- tr.model.EventRegistry.register(
- InstantEvent,
- {
- name: 'instantEvent',
- pluralName: 'instantEvents',
- singleViewElementName: 'tr-ui-a-single-instant-event-sub-view',
- multiViewElementName: 'tr-ui-a-multi-instant-event-sub-view'
- });
-
- return {
- GlobalInstantEvent: GlobalInstantEvent,
- ProcessInstantEvent: ProcessInstantEvent,
-
- InstantEventType: InstantEventType,
- InstantEvent: InstantEvent
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/interaction_record_test.html b/chromium/third_party/catapult/tracing/tracing/model/interaction_record_test.html
deleted file mode 100644
index 1302f6517b6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/interaction_record_test.html
+++ /dev/null
@@ -1,117 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/user_model/stub_expectation.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var TestUtils = tr.c.TestUtils;
- var CompoundEventSelectionState = tr.model.CompoundEventSelectionState;
-
- function createModel(opt_customizeModelCallback) {
- return TestUtils.newModel(function(model) {
- model.p1 = model.getOrCreateProcess(1);
- model.t2 = model.p1.getOrCreateThread(2);
-
- model.s1 = model.t2.sliceGroup.pushSlice(TestUtils.newSliceEx({
- title: 'a', start: 10, end: 20
- }));
- model.s2 = model.t2.sliceGroup.pushSlice(TestUtils.newSliceEx({
- title: 'b', start: 20, end: 30
- }));
-
- model.ir1 = new tr.model.um.StubExpectation({
- parentModel: model,
- start: 100, end: 200,
- typeName: 'Response',
- normalizedEfficiency: 1.,
- normalizedUserComfort: 0.0
- });
- model.userModel.expectations.push(model.ir1);
- model.ir1.associatedEvents.push(model.s1);
- model.ir1.associatedEvents.push(model.s2);
-
- if (opt_customizeModelCallback)
- opt_customizeModelCallback(model);
- });
- }
- test('notSelected', function() {
- var model = createModel();
-
- var sel = new tr.model.EventSet();
-
- assert.equal(CompoundEventSelectionState.NOT_SELECTED,
- model.ir1.computeCompoundEvenSelectionState(sel));
- });
-
- test('directSelected', function() {
- var model = createModel();
-
- var sel = new tr.model.EventSet();
- sel.push(model.ir1);
-
- assert.equal(CompoundEventSelectionState.EVENT_SELECTED,
- model.ir1.computeCompoundEvenSelectionState(sel));
- });
-
- test('directAndSomeAssociatedSelected', function() {
- var model = createModel();
-
- var sel = new tr.model.EventSet();
- sel.push(model.ir1);
- sel.push(model.s1);
-
- assert.equal(
- CompoundEventSelectionState.EVENT_AND_SOME_ASSOCIATED_SELECTED,
- model.ir1.computeCompoundEvenSelectionState(sel));
-
- });
-
- test('allAssociatedEventsSelected', function() {
- var model = createModel();
-
- var sel = new tr.model.EventSet();
- sel.push(model.s1);
- sel.push(model.s2);
-
- assert.equal(CompoundEventSelectionState.ALL_ASSOCIATED_EVENTS_SELECTED,
- model.ir1.computeCompoundEvenSelectionState(sel));
- });
-
- test('directAndAllAssociated', function() {
- var model = createModel();
-
- var sel = new tr.model.EventSet();
- sel.push(model.ir1);
- sel.push(model.s1);
- sel.push(model.s2);
-
- assert.equal(CompoundEventSelectionState.EVENT_AND_ALL_ASSOCIATED_SELECTED,
- model.ir1.computeCompoundEvenSelectionState(sel));
- });
-
- test('stableId', function() {
- var model = TestUtils.newModel();
-
- var ir1 = model.userModel.expectations.push(
- TestUtils.newInteractionRecord(model, 0, 10));
- var ir2 = model.userModel.expectations.push(
- TestUtils.newInteractionRecord(model, 10, 10));
- var ir3 = model.userModel.expectations.push(
- TestUtils.newInteractionRecord(model, 20, 10));
-
- assert.equal('UserExpectation.' + ir1.guid, ir1.stableId);
- assert.equal('UserExpectation.' + ir2.guid, ir2.stableId);
- assert.equal('UserExpectation.' + ir3.guid, ir3.stableId);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/ir_coverage.html b/chromium/third_party/catapult/tracing/tracing/model/ir_coverage.html
deleted file mode 100644
index 80cdd387a3c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/ir_coverage.html
+++ /dev/null
@@ -1,87 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/event_set.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
- function getAssociatedEvents(irs) {
- var allAssociatedEvents = new tr.model.EventSet();
- irs.forEach(function(ir) {
- ir.associatedEvents.forEach(function(event) {
- // FlowEvents don't have parentContainers or cpuDurations, and it's
- // annoying to highlight them.
- if (event instanceof tr.model.FlowEvent)
- return;
- allAssociatedEvents.push(event);
- });
- });
- return allAssociatedEvents;
- }
-
- function getUnassociatedEvents(model, associatedEvents) {
- var unassociatedEvents = new tr.model.EventSet();
- // The set of unassociated events contains only events that are not in
- // the set of associated events.
- // Only add event to the set of unassociated events if it is not in
- // the set of associated events.
- for (var proc of model.getAllProcesses())
- for (var thread of tr.b.dictionaryValues(proc.threads))
- for (var event of thread.sliceGroup.getDescendantEvents())
- if (!associatedEvents.contains(event))
- unassociatedEvents.push(event);
- return unassociatedEvents;
- }
-
- function getTotalCpuDuration(events) {
- var cpuMs = 0;
- events.forEach(function(event) {
- // Add up events' cpu self time if they have any.
- if (event.cpuSelfTime)
- cpuMs += event.cpuSelfTime;
- });
- return cpuMs;
- }
-
- function getIRCoverageFromModel(model) {
- var associatedEvents = getAssociatedEvents(model.userModel.expectations);
-
- if (!associatedEvents.length)
- return undefined;
-
- var unassociatedEvents = getUnassociatedEvents(
- model, associatedEvents);
-
- var associatedCpuMs = getTotalCpuDuration(associatedEvents);
- var unassociatedCpuMs = getTotalCpuDuration(unassociatedEvents);
-
- var totalEventCount = associatedEvents.length + unassociatedEvents.length;
- var totalCpuMs = associatedCpuMs + unassociatedCpuMs;
- var coveredEventsCpuTimeRatio = undefined;
- if (totalCpuMs !== 0)
- coveredEventsCpuTimeRatio = associatedCpuMs / totalCpuMs;
-
- return {
- associatedEventsCount: associatedEvents.length,
- unassociatedEventsCount: unassociatedEvents.length,
- associatedEventsCpuTimeMs: associatedCpuMs,
- unassociatedEventsCpuTimeMs: unassociatedCpuMs,
- coveredEventsCountRatio: associatedEvents.length / totalEventCount,
- coveredEventsCpuTimeRatio: coveredEventsCpuTimeRatio
- };
- }
-
- return {
- getIRCoverageFromModel: getIRCoverageFromModel,
- getAssociatedEvents: getAssociatedEvents,
- getUnassociatedEvents: getUnassociatedEvents
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/ir_coverage_test.html b/chromium/third_party/catapult/tracing/tracing/model/ir_coverage_test.html
deleted file mode 100644
index e8a1637e60d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/ir_coverage_test.html
+++ /dev/null
@@ -1,90 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/ir_coverage.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newSliceEx = tr.c.TestUtils.newSliceEx;
-
- function createModel() {
- return tr.c.TestUtils.newModel(function(model) {
- var process = model.getOrCreateProcess(1);
- var thread = process.getOrCreateThread(2);
- var s0 = thread.sliceGroup.pushSlice(newSliceEx(
- {title: 's0', start: 0.0, duration: 1.0}));
- s0.isTopLevel = true;
- var unassociatedEvent = thread.sliceGroup.pushSlice(newSliceEx(
- {title: 's1', start: 6.0, duration: 1.0}));
- unassociatedEvent.isTopLevel = true;
- var s2 = thread.sliceGroup.pushSlice(newSliceEx(
- {title: 's2', start: 2.0, duration: 1.0}));
- s2.isTopLevel = true;
- var f0 = tr.c.TestUtils.newFlowEventEx({
- title: 'test1',
- start: 0,
- end: 10,
- startSlice: s0,
- endSlice: s2,
- id: '0x100'
- });
- model.flowEvents.push(f0);
- var as1 = tr.c.TestUtils.newAsyncSliceEx({
- title: 'InputLatency::GestureTap',
- cat: 'benchmark,latencyInfo',
- start: 2,
- end: 10,
- id: '0x100',
- isTopLevel: true,
- startThread: thread
- });
- thread.asyncSliceGroup.push(as1);
- var ir = new tr.model.um.StubExpectation(
- {parentModel: model, start: 0, duration: 7});
- ir.associatedEvents.push(as1);
- ir.associatedEvents.push(s0);
- ir.associatedEvents.push(s2);
- ir.associatedEvents.push(f0);
- model.userModel.expectations.push(ir);
- });
- }
-
- test('computeCoverage', function() {
- var model = createModel();
- for (var event of model.getDescendantEvents()) {
- if (event.title === 's0' || event.title === 's2') {
- event.cpuSelfTime = 0.4;
- } else if (event.title === 's1') {
- event.cpuSelfTime = 0.8;
- }
- }
-
- var coverage = tr.model.getIRCoverageFromModel(model);
- assert.equal(3, coverage.associatedEventsCount);
- assert.equal(1, coverage.unassociatedEventsCount);
- assert.closeTo(0.75, coverage.coveredEventsCountRatio, 1e-3);
- assert.closeTo(0.8, coverage.associatedEventsCpuTimeMs, 1e-3);
- assert.closeTo(0.8, coverage.unassociatedEventsCpuTimeMs, 1e-3);
- assert.closeTo(0.5, coverage.coveredEventsCpuTimeRatio, 1e-3);
- });
-
- test('zeroCPU', function() {
- var model = createModel();
- var coverage = tr.model.getIRCoverageFromModel(model);
- assert.equal(3, coverage.associatedEventsCount);
- assert.equal(1, coverage.unassociatedEventsCount);
- assert.closeTo(0.75, coverage.coveredEventsCountRatio, 1e-3);
- assert.closeTo(0.0, coverage.associatedEventsCpuTimeMs, 1e-3);
- assert.closeTo(0.0, coverage.unassociatedEventsCpuTimeMs, 1e-3);
- assert.equal(undefined, coverage.coveredEventsCpuTimeRatio, 1e-3);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/kernel.html b/chromium/third_party/catapult/tracing/tracing/model/kernel.html
deleted file mode 100644
index bf8aed5916e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/kernel.html
+++ /dev/null
@@ -1,134 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/cpu.html">
-<link rel="import" href="/tracing/model/process_base.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the Process class.
- */
-tr.exportTo('tr.model', function() {
- var Cpu = tr.model.Cpu;
- var ProcessBase = tr.model.ProcessBase;
-
- /**
- * The Kernel represents kernel-level objects in the model.
- * @constructor
- */
- function Kernel(model) {
- ProcessBase.call(this, model);
-
- this.cpus = {};
- this.softwareMeasuredCpuCount_ = undefined;
- };
-
- /**
- * Comparison between kernels is pretty meaningless.
- */
- Kernel.compare = function(x, y) {
- return 0;
- };
-
- Kernel.prototype = {
- __proto__: ProcessBase.prototype,
-
- compareTo: function(that) {
- return Kernel.compare(this, that);
- },
-
- get userFriendlyName() {
- return 'Kernel';
- },
-
- get userFriendlyDetails() {
- return 'Kernel';
- },
-
- get stableId() {
- return 'Kernel';
- },
-
- /**
- * @return {Cpu} Gets a specific Cpu or creates one if
- * it does not exist.
- */
- getOrCreateCpu: function(cpuNumber) {
- if (!this.cpus[cpuNumber])
- this.cpus[cpuNumber] = new Cpu(this, cpuNumber);
- return this.cpus[cpuNumber];
- },
-
- get softwareMeasuredCpuCount() {
- return this.softwareMeasuredCpuCount_;
- },
-
- set softwareMeasuredCpuCount(softwareMeasuredCpuCount) {
- if (this.softwareMeasuredCpuCount_ !== undefined &&
- this.softwareMeasuredCpuCount_ !== softwareMeasuredCpuCount) {
- throw new Error(
- 'Cannot change the softwareMeasuredCpuCount once it is set');
- }
-
- this.softwareMeasuredCpuCount_ = softwareMeasuredCpuCount;
- },
-
- /**
- * Estimates how many cpus are in the system, for use in system load
- * estimation.
- *
- * If kernel trace was provided, uses that data. Otherwise, uses the
- * software measured cpu count.
- */
- get bestGuessAtCpuCount() {
- var realCpuCount = tr.b.dictionaryLength(this.cpus);
- if (realCpuCount !== 0)
- return realCpuCount;
- return this.softwareMeasuredCpuCount;
- },
-
- updateBounds: function() {
- ProcessBase.prototype.updateBounds.call(this);
- for (var cpuNumber in this.cpus) {
- var cpu = this.cpus[cpuNumber];
- cpu.updateBounds();
- this.bounds.addRange(cpu.bounds);
- }
- },
-
- createSubSlices: function() {
- ProcessBase.prototype.createSubSlices.call(this);
- for (var cpuNumber in this.cpus) {
- var cpu = this.cpus[cpuNumber];
- cpu.createSubSlices();
- }
- },
-
- addCategoriesToDict: function(categoriesDict) {
- ProcessBase.prototype.addCategoriesToDict.call(this, categoriesDict);
- for (var cpuNumber in this.cpus)
- this.cpus[cpuNumber].addCategoriesToDict(categoriesDict);
- },
-
- getSettingsKey: function() {
- return 'kernel';
- },
-
- childEventContainers: function*() {
- yield * ProcessBase.prototype.childEventContainers.call(this);
- yield * tr.b.dictionaryValues(this.cpus);
- },
- };
-
- return {
- Kernel: Kernel
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/kernel_test.html b/chromium/third_party/catapult/tracing/tracing/model/kernel_test.html
deleted file mode 100644
index c4ca0ca8e72..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/kernel_test.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/kernel.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function newModel(events, callback) {
- return tr.c.TestUtils.newModelWithEvents([events], {
- shiftWorldToZero: false,
- pruneContainers: false,
- customizeModelCallback: callback
- });
- }
-
- test('bestGuessAtCpuCountWithNoData', function() {
- var m = newModel([]);
- assert.isUndefined(m.kernel.bestGuessAtCpuCount);
- });
-
- test('bestGuessAtCpuCountWithCpuData', function() {
- var m = newModel([], function(m) {
- var c1 = m.kernel.getOrCreateCpu(1);
- var c2 = m.kernel.getOrCreateCpu(2);
- });
- assert.equal(m.kernel.bestGuessAtCpuCount, 2);
- });
-
- test('bestGuessAtCpuCountWithSoftwareCpuCount', function() {
- var m = newModel([], function(m) {
- m.kernel.softwareMeasuredCpuCount = 2;
- });
- assert.equal(m.kernel.bestGuessAtCpuCount, 2);
- });
-
- test('kernelStableId', function() {
- var model = newModel([]);
- assert.equal(model.kernel.stableId, 'Kernel');
- });
-
- test('kernelTimeShifting', function() {
- var m = newModel([]);
- var ctr1 = m.kernel.getOrCreateCounter('cat', 'ctr1');
- var series1 = new tr.model.CounterSeries('a', 0);
- series1.addCounterSample(100, 5);
- series1.addCounterSample(200, 5);
- ctr1.addSeries(series1);
-
- var ctr2 = m.kernel.getOrCreateCpu(1).getOrCreateCounter('cat', 'ctr2');
- var series2 = new tr.model.CounterSeries('b', 0);
- series2.addCounterSample(300, 5);
- series2.addCounterSample(400, 5);
- ctr2.addSeries(series2);
-
- m.kernel.shiftTimestampsForward(2);
-
- assert.equal(ctr1.series[0].samples[0].timestamp, 102);
- assert.equal(ctr1.series[0].samples[1].timestamp, 202);
-
- assert.equal(ctr2.series[0].samples[0].timestamp, 302);
- assert.equal(ctr2.series[0].samples[1].timestamp, 402);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/location.html b/chromium/third_party/catapult/tracing/tracing/model/location.html
deleted file mode 100644
index 11d31eef7e4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/location.html
+++ /dev/null
@@ -1,162 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
- /**
- * YComponent is a class that handles storing the stableId and the percentage
- * offset in the y direction of all tracks within a specific viewX and viewY
- * coordinate.
- * @constructor
- */
- function YComponent(stableId, yPercentOffset) {
- this.stableId = stableId;
- this.yPercentOffset = yPercentOffset;
- }
-
- YComponent.prototype = {
- toDict: function() {
- return {
- stableId: this.stableId,
- yPercentOffset: this.yPercentOffset
- };
- }
- };
-
- /**
- * Location is a class that represents a spatial location on the timeline
- * that is specified by percent offsets within tracks rather than specific
- * points.
- *
- * @constructor
- */
- function Location(xWorld, yComponents) {
- this.xWorld_ = xWorld;
- this.yComponents_ = yComponents;
- };
-
- /**
- * Returns a new Location given by x and y coordinates with respect to
- * the timeline's drawing canvas.
- */
- Location.fromViewCoordinates = function(viewport, viewX, viewY) {
- var dt = viewport.currentDisplayTransform;
- var xWorld = dt.xViewToWorld(viewX);
- var yComponents = [];
-
- // Since we're given coordinates within the timeline canvas, we need to
- // convert them to document coordinates to get the element.
- var elem = document.elementFromPoint(
- viewX + viewport.modelTrackContainer.canvas.offsetLeft,
- viewY + viewport.modelTrackContainer.canvas.offsetTop);
- // Build yComponents by calculating percentage offset with respect to
- // each parent track.
- while (elem instanceof tr.ui.tracks.Track) {
- if (elem.eventContainer) {
- var boundRect = elem.getBoundingClientRect();
- var yPercentOffset = (viewY - boundRect.top) / boundRect.height;
- yComponents.push(
- new YComponent(elem.eventContainer.stableId, yPercentOffset));
- }
- elem = elem.parentElement;
- }
-
- if (yComponents.length == 0)
- return;
- return new Location(xWorld, yComponents);
- }
-
- Location.fromStableIdAndTimestamp = function(viewport, stableId, ts) {
- var xWorld = ts;
- var yComponents = [];
-
- // The y components' percentage offsets will be calculated with respect to
- // the boundingRect's top of containing track.
- var containerToTrack = viewport.containerToTrackMap;
- var elem = containerToTrack.getTrackByStableId(stableId);
- if (!elem)
- return;
-
- var firstY = elem.getBoundingClientRect().top;
- while (elem instanceof tr.ui.tracks.Track) {
- if (elem.eventContainer) {
- var boundRect = elem.getBoundingClientRect();
- var yPercentOffset = (firstY - boundRect.top) / boundRect.height;
- yComponents.push(
- new YComponent(elem.eventContainer.stableId, yPercentOffset));
- }
- elem = elem.parentElement;
- }
-
- if (yComponents.length == 0)
- return;
- return new Location(xWorld, yComponents);
- }
-
- Location.prototype = {
-
- get xWorld() {
- return this.xWorld_;
- },
-
- /**
- * Returns the first valid containing track based on the
- * internal yComponents.
- */
- getContainingTrack: function(viewport) {
- var containerToTrack = viewport.containerToTrackMap;
- for (var i in this.yComponents_) {
- var yComponent = this.yComponents_[i];
- var track = containerToTrack.getTrackByStableId(yComponent.stableId);
- if (track !== undefined)
- return track;
- }
- },
-
- /**
- * Calculates and returns x and y coordinates of the current location with
- * respect to the timeline's canvas.
- */
- toViewCoordinates: function(viewport) {
- var dt = viewport.currentDisplayTransform;
- var containerToTrack = viewport.containerToTrackMap;
- var viewX = dt.xWorldToView(this.xWorld_);
-
- var viewY = -1;
- for (var index in this.yComponents_) {
- var yComponent = this.yComponents_[index];
- var track = containerToTrack.getTrackByStableId(yComponent.stableId);
- if (track !== undefined) {
- var boundRect = track.getBoundingClientRect();
- viewY = yComponent.yPercentOffset * boundRect.height + boundRect.top;
- break;
- }
- }
-
- return {
- viewX: viewX,
- viewY: viewY
- };
- },
-
- toDict: function() {
- return {
- xWorld: this.xWorld_,
- yComponents: this.yComponents_
- };
- }
- };
-
- return {
- Location: Location
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/memory_allocator_dump.html b/chromium/third_party/catapult/tracing/tracing/model/memory_allocator_dump.html
deleted file mode 100644
index 5e83a75e362..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/memory_allocator_dump.html
+++ /dev/null
@@ -1,221 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the MemoryAllocatorDump class.
- */
-tr.exportTo('tr.model', function() {
- /**
- * @constructor
- */
- function MemoryAllocatorDump(containerMemoryDump, fullName, opt_guid) {
- this.fullName = fullName;
- this.parent = undefined;
- this.children = [];
-
- // String -> ScalarNumeric.
- this.numerics = {};
-
- // String -> string.
- this.diagnostics = {};
-
- // The associated container memory dump.
- this.containerMemoryDump = containerMemoryDump;
-
- // Ownership relationship between memory allocator dumps.
- this.owns = undefined;
- this.ownedBy = [];
-
- // Map from sibling dumps (other children of this dump's parent) to the
- // proportion of this dump's size which they (or their descendants) own.
- this.ownedBySiblingSizes = new Map();
-
- // Retention relationship between memory allocator dumps.
- this.retains = [];
- this.retainedBy = [];
-
- // Weak memory allocator dumps are removed from the model after import in
- // tr.model.GlobalMemoryDump.removeWeakDumps(). See
- // base::trace_event::MemoryAllocatorDump::Flags::WEAK in the Chromium
- // codebase.
- this.weak = false;
-
- // A list of information about the memory allocator dump (e.g. about how
- // its fields were calculated). Each item should be an object with
- // a mandatory 'type' property and type-specific extra arguments (see
- // MemoryAllocatorDumpInfoType).
- this.infos = [];
-
- // For debugging purposes.
- this.guid = opt_guid;
- };
-
- /**
- * Size numeric names. Please refer to the Memory Dump Graph Metric
- * Calculation design document for more details (https://goo.gl/fKg0dt).
- */
- MemoryAllocatorDump.SIZE_NUMERIC_NAME = 'size';
- MemoryAllocatorDump.EFFECTIVE_SIZE_NUMERIC_NAME = 'effective_size';
- MemoryAllocatorDump.RESIDENT_SIZE_NUMERIC_NAME = 'resident_size';
- MemoryAllocatorDump.DISPLAYED_SIZE_NUMERIC_NAME =
- MemoryAllocatorDump.EFFECTIVE_SIZE_NUMERIC_NAME;
-
- MemoryAllocatorDump.prototype = {
- get name() {
- return this.fullName.substring(this.fullName.lastIndexOf('/') + 1);
- },
-
- get quantifiedName() {
- return '\'' + this.fullName + '\' in ' +
- this.containerMemoryDump.containerName;
- },
-
- getDescendantDumpByFullName: function(fullName) {
- return this.containerMemoryDump.getMemoryAllocatorDumpByFullName(
- this.fullName + '/' + fullName);
- },
-
- isDescendantOf: function(otherDump) {
- var dump = this;
- while (dump !== undefined) {
- if (dump === otherDump)
- return true;
- dump = dump.parent;
- }
- return false;
- },
-
- addNumeric: function(name, numeric) {
- if (!(numeric instanceof tr.v.ScalarNumeric))
- throw new Error('Numeric value must be an instance of ScalarNumeric.');
- if (name in this.numerics)
- throw new Error('Duplicate numeric name: ' + name + '.');
- this.numerics[name] = numeric;
- },
-
- addDiagnostic: function(name, text) {
- if (typeof text !== 'string')
- throw new Error('Diagnostic text must be a string.');
- if (name in this.diagnostics)
- throw new Error('Duplicate diagnostic name: ' + name + '.');
- this.diagnostics[name] = text;
- },
-
- aggregateNumericsRecursively: function(opt_model) {
- var numericNames = new Set();
-
- // Aggregate descendants's numerics recursively and gather children's
- // numeric names.
- this.children.forEach(function(child) {
- child.aggregateNumericsRecursively(opt_model);
- tr.b.iterItems(child.numerics, numericNames.add, numericNames);
- }, this);
-
- // Aggregate children's numerics.
- numericNames.forEach(function(numericName) {
- if (numericName === MemoryAllocatorDump.SIZE_NUMERIC_NAME ||
- numericName === MemoryAllocatorDump.EFFECTIVE_SIZE_NUMERIC_NAME ||
- this.numerics[numericName] !== undefined) {
- // Don't aggregate size and effective size numerics. These are
- // calculated in GlobalMemoryDump.prototype.calculateSizes() and
- // GlobalMemoryDump.prototype.calculateEffectiveSizes respectively.
- // Also don't aggregate numerics that the parent already has.
- return;
- }
-
- this.numerics[numericName] = MemoryAllocatorDump.aggregateNumerics(
- this.children.map(function(child) {
- return child.numerics[numericName];
- }), opt_model);
- }, this);
- }
- };
-
- // TODO(petrcermak): Consider moving this to tr.v.Numeric.
- MemoryAllocatorDump.aggregateNumerics = function(numerics, opt_model) {
- var shouldLogWarning = !!opt_model;
- var aggregatedUnit = undefined;
- var aggregatedValue = 0;
-
- // Aggregate the units and sum up the values of the numerics.
- numerics.forEach(function(numeric) {
- if (numeric === undefined)
- return;
-
- var unit = numeric.unit;
- if (aggregatedUnit === undefined) {
- aggregatedUnit = unit;
- } else if (aggregatedUnit !== unit) {
- if (shouldLogWarning) {
- opt_model.importWarning({
- type: 'numeric_parse_error',
- message: 'Multiple units provided for numeric: \'' +
- aggregatedUnit.unitName + '\' and \'' + unit.unitName + '\'.'
- });
- shouldLogWarning = false; // Don't log multiple warnings.
- }
- // Use the most generic unit when the numerics don't agree (best
- // effort).
- aggregatedUnit = tr.v.Unit.byName.unitlessNumber_smallerIsBetter;
- }
-
- aggregatedValue += numeric.value;
- }, this);
-
- if (aggregatedUnit === undefined)
- return undefined;
-
- return new tr.v.ScalarNumeric(aggregatedUnit, aggregatedValue);
- };
-
- /**
- * @constructor
- */
- function MemoryAllocatorDumpLink(source, target, opt_importance) {
- this.source = source;
- this.target = target;
- this.importance = opt_importance;
- this.size = undefined;
- }
-
- /**
- * Types of size numeric information.
- *
- * @enum
- */
- var MemoryAllocatorDumpInfoType = {
- // The provided size of a MemoryAllocatorDump was less than the aggregated
- // size of its children.
- //
- // Mandatory extra args:
- // * providedSize: The inconsistent provided size.
- // * dependencySize: The aggregated size of the children.
- PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN: 0,
-
- // The provided size of a MemoryAllocatorDump was less than the size of its
- // largest owner.
- //
- // Mandatory extra args:
- // * providedSize: The inconsistent provided size.
- // * dependencySize: The size of the largest owner.
- PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER: 1
- };
-
- return {
- MemoryAllocatorDump: MemoryAllocatorDump,
- MemoryAllocatorDumpLink: MemoryAllocatorDumpLink,
- MemoryAllocatorDumpInfoType: MemoryAllocatorDumpInfoType
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/memory_allocator_dump_test.html b/chromium/third_party/catapult/tracing/tracing/model/memory_allocator_dump_test.html
deleted file mode 100644
index 440dc5ffcd1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/memory_allocator_dump_test.html
+++ /dev/null
@@ -1,218 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/container_memory_dump.html">
-<link rel="import" href="/tracing/model/memory_allocator_dump.html">
-<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ContainerMemoryDump = tr.model.ContainerMemoryDump;
- var MemoryAllocatorDump = tr.model.MemoryAllocatorDump;
- var MemoryAllocatorDumpLink = tr.model.MemoryAllocatorDumpLink;
- var ScalarNumeric = tr.v.ScalarNumeric;
- var unitlessNumber_smallerIsBetter =
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter;
- var sizeInBytes = tr.v.Unit.byName.sizeInBytes;
- var powerInWatts = tr.v.Unit.byName.powerInWatts;
- var newAllocatorDump = tr.model.MemoryDumpTestUtils.newAllocatorDump;
- var addChildDump = tr.model.MemoryDumpTestUtils.addChildDump;
- var checkDumpNumericsAndDiagnostics =
- tr.model.MemoryDumpTestUtils.checkDumpNumericsAndDiagnostics;
-
- test('memoryAllocatorDump_instantiate', function() {
- var containerDump = new ContainerMemoryDump(42);
- containerDump.containerName = 'super dump';
- var dump = new MemoryAllocatorDump(containerDump, 'v8/objects/object7');
-
- assert.equal(dump.name, 'object7');
- assert.equal(dump.fullName, 'v8/objects/object7');
- assert.strictEqual(dump.containerMemoryDump, containerDump);
- assert.equal(dump.quantifiedName, '\'v8/objects/object7\' in super dump');
- });
-
- test('memoryAllocatorDumps_aggregateNumericsRecursively', function() {
- var md = new ContainerMemoryDump(42);
-
- var oilpanDump = newAllocatorDump(md, 'oilpan', {
- 'objects_count': new ScalarNumeric(unitlessNumber_smallerIsBetter, 7)
- });
-
- addChildDump(oilpanDump, 'bucket1', {
- size: 512,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 3),
- inner_size: 256,
- outer_size: 1024
- });
-
- var oilpanBucket2Dump = addChildDump(oilpanDump, 'bucket2');
-
- var oilpanBucket2StringsDump = addChildDump(oilpanBucket2Dump, 'strings', {
- size: 512,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 4),
- inner_size: 512,
- outer_size: 2048
- });
-
- oilpanDump.aggregateNumericsRecursively();
-
- // oilpan has *some* numerics aggregated.
- checkDumpNumericsAndDiagnostics(oilpanDump, {
- 'objects_count': new ScalarNumeric(unitlessNumber_smallerIsBetter, 7),
- 'inner_size': 768,
- 'outer_size': 3072
- }, {});
-
- // oilpan/bucket2 has *all* numerics aggregated (except for size).
- checkDumpNumericsAndDiagnostics(oilpanBucket2Dump, {
- 'objects_count': new ScalarNumeric(unitlessNumber_smallerIsBetter, 4),
- 'inner_size': 512,
- 'outer_size': 2048
- }, {});
-
- // oilpan/bucket2/strings has *no* numerics aggregated.
- checkDumpNumericsAndDiagnostics(oilpanBucket2StringsDump, {
- 'size': 512,
- 'objects_count': new ScalarNumeric(unitlessNumber_smallerIsBetter, 4),
- 'inner_size': 512,
- 'outer_size': 2048
- }, {});
- });
-
- test('memoryAllocatorDump_aggregateNumerics', function() {
- function checkAggregateNumerics(numerics, expectedValue, expectedUnit,
- opt_expectedWarningCount) {
- function checkResult(result) {
- if (expectedValue === undefined) {
- assert.isUndefined(result);
- assert.isUndefined(expectedUnit); // Test sanity check.
- } else {
- assert.instanceOf(result, ScalarNumeric);
- assert.strictEqual(result.value, expectedValue);
- assert.strictEqual(result.unit, expectedUnit);
- }
- }
-
- // Without model parameter.
- var result1 = MemoryAllocatorDump.aggregateNumerics(numerics);
- checkResult(result1);
-
- // With model parameter.
- var mockModel = {
- warnings: [],
- importWarning: function(warning) {
- this.warnings.push(warning);
- }
- };
- var result2 = MemoryAllocatorDump.aggregateNumerics(numerics, mockModel);
- checkResult(result2);
- assert.lengthOf(mockModel.warnings, opt_expectedWarningCount || 0);
- }
-
- // No defined numerics.
- checkAggregateNumerics([], undefined);
- checkAggregateNumerics([undefined], undefined);
- checkAggregateNumerics([undefined, undefined], undefined);
-
- // Consistent units.
- checkAggregateNumerics(
- [new ScalarNumeric(unitlessNumber_smallerIsBetter, 10)],
- 10, unitlessNumber_smallerIsBetter);
- checkAggregateNumerics(
- [new ScalarNumeric(sizeInBytes, 10),
- new ScalarNumeric(sizeInBytes, 20),
- new ScalarNumeric(sizeInBytes, 40)],
- 70, sizeInBytes);
- checkAggregateNumerics(
- [undefined,
- new ScalarNumeric(sizeInBytes, 16),
- undefined,
- new ScalarNumeric(sizeInBytes, 32),
- undefined],
- 48, sizeInBytes);
-
- // Inconsistent units.
- checkAggregateNumerics(
- [new ScalarNumeric(sizeInBytes, 10),
- new ScalarNumeric(powerInWatts, 20)],
- 30, unitlessNumber_smallerIsBetter, 1 /* opt_expectedWarningCount */);
- checkAggregateNumerics(
- [undefined,
- new ScalarNumeric(powerInWatts, 16),
- undefined,
- new ScalarNumeric(unitlessNumber_smallerIsBetter, 32),
- undefined,
- new ScalarNumeric(sizeInBytes, 64),
- undefined],
- 112, unitlessNumber_smallerIsBetter, 1 /* opt_expectedWarningCount */);
- });
-
- test('memoryAllocatorDumps_isDescendantOf', function() {
- var md = new ContainerMemoryDump(42);
-
- var v8Dump = new MemoryAllocatorDump(md, 'v8');
- var v8HeapsDump = addChildDump(v8Dump, 'heaps');
- var v8ObjectsDump = addChildDump(v8Dump, 'objects');
- var v8Object1Dump = addChildDump(v8ObjectsDump, 'obj1');
- var v8Object2Dump = addChildDump(v8ObjectsDump, 'obj2');
-
- var oilpanDump = new MemoryAllocatorDump(md, 'oilpan');
-
- assert.isTrue(v8Dump.isDescendantOf(v8Dump));
- assert.isTrue(v8HeapsDump.isDescendantOf(v8Dump));
- assert.isTrue(v8ObjectsDump.isDescendantOf(v8Dump));
- assert.isTrue(v8Object1Dump.isDescendantOf(v8Dump));
- assert.isTrue(v8Object2Dump.isDescendantOf(v8Dump));
- assert.isTrue(v8ObjectsDump.isDescendantOf(v8ObjectsDump));
- assert.isTrue(v8Object1Dump.isDescendantOf(v8ObjectsDump));
- assert.isTrue(v8Object2Dump.isDescendantOf(v8ObjectsDump));
- assert.isTrue(oilpanDump.isDescendantOf(oilpanDump));
-
- assert.isFalse(v8Dump.isDescendantOf(oilpanDump));
- assert.isFalse(v8Dump.isDescendantOf(v8HeapsDump));
- assert.isFalse(v8Dump.isDescendantOf(v8ObjectsDump));
- assert.isFalse(v8Dump.isDescendantOf(v8Object1Dump));
- assert.isFalse(v8Dump.isDescendantOf(v8Object2Dump));
- assert.isFalse(v8Object1Dump.isDescendantOf(v8Object2Dump));
- assert.isFalse(v8Object2Dump.isDescendantOf(v8Object1Dump));
- });
-
- test('memoryAllocatorDumps_getDescendantDumpByFullName', function() {
- var containerDump = new ContainerMemoryDump(42);
-
- var gpuDump = new MemoryAllocatorDump(containerDump, 'gpu');
- containerDump.memoryAllocatorDumps = [gpuDump];
-
- var memtrackDump = addChildDump(gpuDump, 'android_memtrack');
- var glDump = addChildDump(memtrackDump, 'gl');
- var gfxDump = addChildDump(memtrackDump, 'gfx');
- var tileDump = addChildDump(gfxDump, 'tile');
-
- assert.strictEqual(gpuDump.getDescendantDumpByFullName(
- 'android_memtrack'), memtrackDump);
- assert.strictEqual(gpuDump.getDescendantDumpByFullName(
- 'android_memtrack/gfx/tile'), tileDump);
- assert.strictEqual(memtrackDump.getDescendantDumpByFullName('gl'), glDump);
- assert.strictEqual(memtrackDump.getDescendantDumpByFullName(
- 'gfx/tile'), tileDump);
- });
-
- test('memoryAllocatorDumpLink_instantiate', function() {
- var d1 = new MemoryAllocatorDump('v8/isolate1');
- var d2 = new MemoryAllocatorDump('oilpan/document1');
- var link = new MemoryAllocatorDumpLink(d1, d2, 3);
-
- assert.strictEqual(link.source, d1);
- assert.strictEqual(link.target, d2);
- assert.strictEqual(link.importance, 3);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/memory_dump_test_utils.html b/chromium/third_party/catapult/tracing/tracing/model/memory_dump_test_utils.html
deleted file mode 100644
index 55a499192bf..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/memory_dump_test_utils.html
+++ /dev/null
@@ -1,151 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/container_memory_dump.html">
-<link rel="import" href="/tracing/model/global_memory_dump.html">
-<link rel="import" href="/tracing/model/memory_allocator_dump.html">
-<link rel="import" href="/tracing/model/process_memory_dump.html">
-<link rel="import" href="/tracing/model/vm_region.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Helper functions for tests involving memory dumps.
- */
-tr.exportTo('tr.model', function() {
- var GlobalMemoryDump = tr.model.GlobalMemoryDump;
- var ProcessMemoryDump = tr.model.ProcessMemoryDump;
- var MemoryAllocatorDump = tr.model.MemoryAllocatorDump;
- var MemoryAllocatorDumpLink = tr.model.MemoryAllocatorDumpLink;
- var VMRegion = tr.model.VMRegion;
- var VMRegionClassificationNode = tr.model.VMRegionClassificationNode;
- var ScalarNumeric = tr.v.ScalarNumeric;
- var sizeInBytes_smallerIsBetter =
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
- var LIGHT = tr.model.ContainerMemoryDump.LevelOfDetail.LIGHT;
-
- function castToScalarNumeric(value) {
- if (typeof value === 'number')
- return new ScalarNumeric(sizeInBytes_smallerIsBetter, value);
- assert.instanceOf(value, ScalarNumeric);
- return value;
- }
-
- function MemoryDumpTestUtils() {
- throw new Error('Static class');
- }
-
- MemoryDumpTestUtils.SIZE_DELTA = 0.0001;
-
- MemoryDumpTestUtils.addGlobalMemoryDump = function(
- model, timestamp, opt_levelOfDetail) {
- var gmd = new GlobalMemoryDump(model, timestamp);
- gmd.levelOfDetail = opt_levelOfDetail === undefined ?
- LIGHT : opt_levelOfDetail;
- model.globalMemoryDumps.push(gmd);
- return gmd;
- };
-
- MemoryDumpTestUtils.addProcessMemoryDump = function(gmd, process, timestamp) {
- var pmd = new ProcessMemoryDump(gmd, process, timestamp);
- process.memoryDumps.push(pmd);
- if (process.pid in gmd.processMemoryDumps) {
- // Test sanity check.
- throw new Error('Process memory dump for process with pid=' +
- process.pid + ' has already been provided');
- }
- gmd.processMemoryDumps[process.pid] = pmd;
- return pmd;
- };
-
- MemoryDumpTestUtils.newAllocatorDump = function(
- containerDump, fullName, opt_numerics, opt_guid) {
- var dump = new MemoryAllocatorDump(containerDump, fullName, opt_guid);
- if (opt_numerics !== undefined) {
- tr.b.iterItems(opt_numerics, function(numericName, value) {
- dump.addNumeric(numericName, castToScalarNumeric(value));
- });
- }
- return dump;
- };
-
- MemoryDumpTestUtils.addChildDump =
- function(parentDump, name, opt_numerics, opt_guid) {
- var childDump = MemoryDumpTestUtils.newAllocatorDump(
- parentDump.containerMemoryDump, parentDump.fullName + '/' + name,
- opt_numerics, opt_guid);
- childDump.parent = parentDump;
- parentDump.children.push(childDump);
- return childDump;
- };
-
- MemoryDumpTestUtils.addOwnershipLink = function(
- ownerDump, ownedDump, opt_importance) {
- assert.isUndefined(ownerDump.owns); // Sanity check.
- var ownershipLink =
- new MemoryAllocatorDumpLink(ownerDump, ownedDump, opt_importance);
- ownerDump.owns = ownershipLink;
- ownedDump.ownedBy.push(ownershipLink);
- return ownershipLink;
- };
-
- MemoryDumpTestUtils.checkDumpNumericsAndDiagnostics =
- function(dump, expectedNumerics, expectedDiagnostics) {
- var actualNumerics = dump.numerics;
- assert.sameMembers(
- Object.keys(actualNumerics), Object.keys(expectedNumerics));
- for (var numericName in actualNumerics) {
- var actualNumeric = actualNumerics[numericName];
- var expectedNumeric = castToScalarNumeric(expectedNumerics[numericName]);
- assert.instanceOf(actualNumeric, tr.v.ScalarNumeric);
- assert.strictEqual(actualNumeric.unit, expectedNumeric.unit);
- assert.closeTo(actualNumeric.value, expectedNumeric.value,
- MemoryDumpTestUtils.SIZE_DELTA);
- }
-
- assert.deepEqual(dump.diagnostics, expectedDiagnostics);
- };
-
- MemoryDumpTestUtils.checkVMRegions = function(vmRegions, expectedRegions) {
- if (vmRegions instanceof VMRegionClassificationNode)
- vmRegions = vmRegions.allRegionsForTesting;
-
- var expectedRegionsMap = new Map();
- expectedRegions.forEach(function(region) {
- if (!(region instanceof VMRegion))
- region = VMRegion.fromDict(region);
- expectedRegionsMap.set(region.uniqueIdWithinProcess, region);
- });
- var actualRegionsMap = new Map();
- vmRegions.forEach(function(region) {
- actualRegionsMap.set(region.uniqueIdWithinProcess, region);
- });
-
- assert.strictEqual(actualRegionsMap.size, expectedRegionsMap.size);
- for (var id of expectedRegionsMap.keys()) {
- var expectedRegion = expectedRegionsMap.get(id);
- var actualRegion = actualRegionsMap.get(id);
-
- assert.instanceOf(actualRegion, VMRegion);
- assert.strictEqual(actualRegion.startAddress,
- expectedRegion.startAddress);
- assert.strictEqual(actualRegion.sizeInBytes, expectedRegion.sizeInBytes);
- assert.strictEqual(actualRegion.protectionFlags,
- expectedRegion.protectionFlags);
- assert.strictEqual(actualRegion.mappedFile, expectedRegion.mappedFile);
- assert.deepEqual(actualRegion.byteStats, expectedRegion.byteStats);
- }
- };
-
- return {
- MemoryDumpTestUtils: MemoryDumpTestUtils
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/model.html b/chromium/third_party/catapult/tracing/tracing/model/model.html
deleted file mode 100644
index b1164f7ebf7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/model.html
+++ /dev/null
@@ -1,650 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/base/interval_tree.html">
-<link rel="import" href="/tracing/base/quad.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/base/task.html">
-<link rel="import" href="/tracing/core/auditor.html">
-<link rel="import" href="/tracing/core/filter.html">
-<link rel="import" href="/tracing/model/alert.html">
-<link rel="import" href="/tracing/model/clock_sync_manager.html">
-<link rel="import" href="/tracing/model/constants.html">
-<link rel="import" href="/tracing/model/device.html">
-<link rel="import" href="/tracing/model/flow_event.html">
-<link rel="import" href="/tracing/model/frame.html">
-<link rel="import" href="/tracing/model/global_memory_dump.html">
-<link rel="import" href="/tracing/model/instant_event.html">
-<link rel="import" href="/tracing/model/kernel.html">
-<link rel="import" href="/tracing/model/model_indices.html">
-<link rel="import" href="/tracing/model/model_stats.html">
-<link rel="import" href="/tracing/model/object_snapshot.html">
-<link rel="import" href="/tracing/model/process.html">
-<link rel="import" href="/tracing/model/process_memory_dump.html">
-<link rel="import" href="/tracing/model/sample.html">
-<link rel="import" href="/tracing/model/stack_frame.html">
-<link rel="import" href="/tracing/model/user_model/user_expectation.html">
-<link rel="import" href="/tracing/model/user_model/user_model.html">
-<link rel="import" href="/tracing/ui/base/overlay.html">
-<link rel="import" href="/tracing/value/time_display_mode.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Model is a parsed representation of the
- * TraceEvents obtained from base/trace_event in which the begin-end
- * tokens are converted into a hierarchy of processes, threads,
- * subrows, and slices.
- *
- * The building block of the model is a slice. A slice is roughly
- * equivalent to function call executing on a specific thread. As a
- * result, slices may have one or more subslices.
- *
- * A thread contains one or more subrows of slices. Row 0 corresponds to
- * the "root" slices, e.g. the topmost slices. Row 1 contains slices that
- * are nested 1 deep in the stack, and so on. We use these subrows to draw
- * nesting tasks.
- *
- */
-tr.exportTo('tr', function() {
- var Process = tr.model.Process;
- var Device = tr.model.Device;
- var Kernel = tr.model.Kernel;
- var GlobalMemoryDump = tr.model.GlobalMemoryDump;
- var GlobalInstantEvent = tr.model.GlobalInstantEvent;
- var FlowEvent = tr.model.FlowEvent;
- var Alert = tr.model.Alert;
- var Sample = tr.model.Sample;
-
- /**
- * @constructor
- */
- function Model() {
- tr.model.EventContainer.call(this);
- tr.b.EventTarget.decorate(this);
-
- this.timestampShiftToZeroAmount_ = 0;
-
- this.faviconHue = 'blue'; // Should be a key from favicons.html
-
- this.device = new Device(this);
- this.kernel = new Kernel(this);
- this.processes = {};
- this.metadata = [];
- this.categories = [];
- this.instantEvents = [];
- this.flowEvents = [];
- this.clockSyncManager = new tr.model.ClockSyncManager();
- this.intrinsicTimeUnit_ = undefined;
-
- this.stackFrames = {};
- this.samples = [];
-
- this.alerts = [];
- this.userModel = new tr.model.um.UserModel(this);
-
- this.flowIntervalTree = new tr.b.IntervalTree((f) => f.start, (f) => f.end);
- this.globalMemoryDumps = [];
-
- this.userFriendlyCategoryDrivers_ = [];
-
- this.annotationsByGuid_ = {};
- this.modelIndices = undefined;
-
- this.stats = new tr.model.ModelStats();
-
- this.importWarnings_ = [];
- this.reportedImportWarnings_ = {};
-
- this.isTimeHighResolution_ = true;
-
- this.patchupsToApply_ = [];
-
- this.doesHelperGUIDSupportThisModel_ = {};
- this.helpersByConstructorGUID_ = {};
- this.eventsByStableId_ = undefined;
- }
-
- Model.prototype = {
- __proto__: tr.model.EventContainer.prototype,
-
- getEventByStableId: function(stableId) {
- if (this.eventsByStableId_ === undefined) {
- this.eventsByStableId_ = {};
- for (var event of this.getDescendantEvents()) {
- this.eventsByStableId_[event.stableId] = event;
- }
- }
- return this.eventsByStableId_[stableId];
- },
-
- getOrCreateHelper: function(constructor) {
- if (!constructor.guid)
- throw new Error('Helper constructors must have GUIDs');
-
- if (this.helpersByConstructorGUID_[constructor.guid] === undefined) {
- if (this.doesHelperGUIDSupportThisModel_[constructor.guid] ===
- undefined) {
- this.doesHelperGUIDSupportThisModel_[constructor.guid] =
- constructor.supportsModel(this);
- }
-
- if (!this.doesHelperGUIDSupportThisModel_[constructor.guid])
- return undefined;
-
- this.helpersByConstructorGUID_[constructor.guid] = new constructor(
- this);
- }
- return this.helpersByConstructorGUID_[constructor.guid];
- },
-
- childEvents: function*() {
- yield * this.globalMemoryDumps;
- yield * this.instantEvents;
- yield * this.flowEvents;
- yield * this.alerts;
- yield * this.samples;
- },
-
- childEventContainers: function*() {
- yield this.userModel;
- yield this.device;
- yield this.kernel;
- yield * tr.b.dictionaryValues(this.processes);
- },
-
- /**
- * Some objects in the model can persist their state in ModelSettings.
- *
- * This iterates through them.
- */
- iterateAllPersistableObjects: function(callback) {
- this.kernel.iterateAllPersistableObjects(callback);
- for (var pid in this.processes)
- this.processes[pid].iterateAllPersistableObjects(callback);
- },
-
- updateBounds: function() {
- this.bounds.reset();
- var bounds = this.bounds;
- for (var ec of this.childEventContainers()) {
- ec.updateBounds();
- bounds.addRange(ec.bounds);
- }
- for (var event of this.childEvents())
- event.addBoundsToRange(bounds);
- },
-
- shiftWorldToZero: function() {
- var shiftAmount = -this.bounds.min;
- this.timestampShiftToZeroAmount_ = shiftAmount;
- for (var ec of this.childEventContainers())
- ec.shiftTimestampsForward(shiftAmount);
-
- for (var event of this.childEvents())
- event.start += shiftAmount;
- this.updateBounds();
- },
-
- convertTimestampToModelTime: function(sourceClockDomainName, ts) {
- if (sourceClockDomainName !== 'traceEventClock')
- throw new Error('Only traceEventClock is supported.');
- return tr.v.Unit.timestampFromUs(ts) +
- this.timestampShiftToZeroAmount_;
- },
-
- get numProcesses() {
- var n = 0;
- for (var p in this.processes)
- n++;
- return n;
- },
-
- /**
- * @return {Process} Gets a TimelineProcess for a specified pid. Returns
- * undefined if the process doesn't exist.
- */
- getProcess: function(pid) {
- return this.processes[pid];
- },
-
- /**
- * @return {Process} Gets a TimelineProcess for a specified pid or
- * creates one if it does not exist.
- */
- getOrCreateProcess: function(pid) {
- if (!this.processes[pid])
- this.processes[pid] = new Process(this, pid);
- return this.processes[pid];
- },
-
- addStackFrame: function(stackFrame) {
- if (this.stackFrames[stackFrame.id])
- throw new Error('Stack frame already exists');
- this.stackFrames[stackFrame.id] = stackFrame;
- return stackFrame;
- },
-
- /**
- * Generates the set of categories from the slices and counters.
- */
- updateCategories_: function() {
- var categoriesDict = {};
- this.userModel.addCategoriesToDict(categoriesDict);
- this.device.addCategoriesToDict(categoriesDict);
- this.kernel.addCategoriesToDict(categoriesDict);
- for (var pid in this.processes)
- this.processes[pid].addCategoriesToDict(categoriesDict);
-
- this.categories = [];
- for (var category in categoriesDict)
- if (category != '')
- this.categories.push(category);
- },
-
- getAllThreads: function() {
- var threads = [];
- for (var tid in this.kernel.threads) {
- threads.push(process.threads[tid]);
- }
- for (var pid in this.processes) {
- var process = this.processes[pid];
- for (var tid in process.threads) {
- threads.push(process.threads[tid]);
- }
- }
- return threads;
- },
-
- /**
- * @param {(!function(!tr.model.Process): boolean)=} opt_predicate Optional
- * predicate for filtering the returned processes. If undefined, all
- * process in the model will be returned.
- * @return {!Array<!tr.model.Process>} An array of processes in the model.
- */
- getAllProcesses: function(opt_predicate) {
- var processes = [];
- for (var pid in this.processes) {
- var process = this.processes[pid];
- if (opt_predicate === undefined || opt_predicate(process))
- processes.push(process);
- }
- return processes;
- },
-
- /**
- * @return {Array} An array of all the counters in the model.
- */
- getAllCounters: function() {
- var counters = [];
- counters.push.apply(
- counters, tr.b.dictionaryValues(this.device.counters));
- counters.push.apply(
- counters, tr.b.dictionaryValues(this.kernel.counters));
- for (var pid in this.processes) {
- var process = this.processes[pid];
- for (var tid in process.counters) {
- counters.push(process.counters[tid]);
- }
- }
- return counters;
- },
-
- getAnnotationByGUID: function(guid) {
- return this.annotationsByGuid_[guid];
- },
-
- addAnnotation: function(annotation) {
- if (!annotation.guid)
- throw new Error('Annotation with undefined guid given');
-
- this.annotationsByGuid_[annotation.guid] = annotation;
- tr.b.dispatchSimpleEvent(this, 'annotationChange');
- },
-
- removeAnnotation: function(annotation) {
- this.annotationsByGuid_[annotation.guid].onRemove();
- delete this.annotationsByGuid_[annotation.guid];
- tr.b.dispatchSimpleEvent(this, 'annotationChange');
- },
-
- getAllAnnotations: function() {
- return tr.b.dictionaryValues(this.annotationsByGuid_);
- },
-
- addUserFriendlyCategoryDriver: function(ufcd) {
- this.userFriendlyCategoryDrivers_.push(ufcd);
- },
-
- /**
- * Gets the user friendly category string from an event.
- *
- * Returns undefined if none is known.
- */
- getUserFriendlyCategoryFromEvent: function(event) {
- for (var i = 0; i < this.userFriendlyCategoryDrivers_.length; i++) {
- var ufc = this.userFriendlyCategoryDrivers_[i].fromEvent(event);
- if (ufc !== undefined)
- return ufc;
- }
- return undefined;
- },
-
- /**
- * @param {String} The name of the thread to find.
- * @return {Array} An array of all the matched threads.
- */
- findAllThreadsNamed: function(name) {
- var namedThreads = [];
- namedThreads.push.apply(
- namedThreads,
- this.kernel.findAllThreadsNamed(name));
- for (var pid in this.processes) {
- namedThreads.push.apply(
- namedThreads,
- this.processes[pid].findAllThreadsNamed(name));
- }
- return namedThreads;
- },
-
- get importOptions() {
- return this.importOptions_;
- },
-
- set importOptions(options) {
- this.importOptions_ = options;
- },
-
- /**
- * Returns a time unit that is used to format values and determines the
- * precision of the timestamp values.
- */
- get intrinsicTimeUnit() {
- if (this.intrinsicTimeUnit_ === undefined)
- return tr.v.TimeDisplayModes.ms;
- return this.intrinsicTimeUnit_;
- },
-
- set intrinsicTimeUnit(value) {
- if (this.intrinsicTimeUnit_ === value)
- return;
- if (this.intrinsicTimeUnit_ !== undefined)
- throw new Error('Intrinsic time unit already set');
- this.intrinsicTimeUnit_ = value;
- },
-
- get isTimeHighResolution() {
- return this.isTimeHighResolution_;
- },
-
- set isTimeHighResolution(value) {
- this.isTimeHighResolution_ = value;
- },
-
- /**
- * Returns a link to a trace data file that this model was imported from.
- * This is NOT the URL of a site being traced, but instead an indicator of
- * where the data is stored.
- */
- get canonicalUrl() {
- return this.canonicalUrl_;
- },
-
- set canonicalUrl(value) {
- if (this.canonicalUrl_ === value)
- return;
- if (this.canonicalUrl_ !== undefined)
- throw new Error('canonicalUrl already set');
- this.canonicalUrl_ = value;
- },
-
- /**
- * Saves a warning that happened during import.
- *
- * Warnings are typically logged to the console, and optionally, the
- * more critical ones are shown to the user.
- *
- * @param {Object} data The import warning data. Data must provide two
- * accessors: type, message. The types are used to determine if we
- * should output the message, we'll only output one message of each type.
- * The message is the actual warning content.
- */
- importWarning: function(data) {
- data.showToUser = !!data.showToUser;
-
- this.importWarnings_.push(data);
-
- // Only log each warning type once. We may want to add some kind of
- // flag to allow reporting all importer warnings.
- if (this.reportedImportWarnings_[data.type] === true)
- return;
-
- if (this.importOptions_.showImportWarnings)
- console.warn(data.message);
-
- this.reportedImportWarnings_[data.type] = true;
- },
-
- get hasImportWarnings() {
- return (this.importWarnings_.length > 0);
- },
-
- get importWarnings() {
- return this.importWarnings_;
- },
-
- get importWarningsThatShouldBeShownToUser() {
- return this.importWarnings_.filter(function(warning) {
- return warning.showToUser;
- });
- },
-
- autoCloseOpenSlices: function() {
- // Sort the samples.
- this.samples.sort(function(x, y) {
- return x.start - y.start;
- });
-
- this.updateBounds();
- this.kernel.autoCloseOpenSlices();
- for (var pid in this.processes)
- this.processes[pid].autoCloseOpenSlices();
- },
-
- createSubSlices: function() {
- this.kernel.createSubSlices();
- for (var pid in this.processes)
- this.processes[pid].createSubSlices();
- },
-
- preInitializeObjects: function() {
- for (var pid in this.processes)
- this.processes[pid].preInitializeObjects();
- },
-
- initializeObjects: function() {
- for (var pid in this.processes)
- this.processes[pid].initializeObjects();
- },
-
- pruneEmptyContainers: function() {
- this.kernel.pruneEmptyContainers();
- for (var pid in this.processes)
- this.processes[pid].pruneEmptyContainers();
- },
-
- mergeKernelWithUserland: function() {
- for (var pid in this.processes)
- this.processes[pid].mergeKernelWithUserland();
- },
-
- computeWorldBounds: function(shiftWorldToZero) {
- this.updateBounds();
- this.updateCategories_();
-
- if (shiftWorldToZero)
- this.shiftWorldToZero();
- },
-
- buildFlowEventIntervalTree: function() {
- for (var i = 0; i < this.flowEvents.length; ++i) {
- var flowEvent = this.flowEvents[i];
- this.flowIntervalTree.insert(flowEvent);
- }
- this.flowIntervalTree.updateHighValues();
- },
-
- cleanupUndeletedObjects: function() {
- for (var pid in this.processes)
- this.processes[pid].autoDeleteObjects(this.bounds.max);
- },
-
- sortMemoryDumps: function() {
- this.globalMemoryDumps.sort(function(x, y) {
- return x.start - y.start;
- });
-
- for (var pid in this.processes)
- this.processes[pid].sortMemoryDumps();
- },
-
- finalizeMemoryGraphs: function() {
- this.globalMemoryDumps.forEach(function(dump) {
- dump.finalizeGraph();
- });
- },
-
- buildEventIndices: function() {
- this.modelIndices = new tr.model.ModelIndices(this);
- },
-
- sortAlerts: function() {
- this.alerts.sort(function(x, y) {
- return x.start - y.start;
- });
- },
-
- applyObjectRefPatchups: function() {
- // Change all the fields pointing at id_refs to their real values.
- var unresolved = [];
- this.patchupsToApply_.forEach(function(patchup) {
- if (patchup.pidRef in this.processes) {
- var snapshot = this.processes[patchup.pidRef].objects.getSnapshotAt(
- patchup.scopedId, patchup.ts);
- if (snapshot) {
- patchup.object[patchup.field] = snapshot;
- snapshot.referencedAt(patchup.item, patchup.object, patchup.field);
- return;
- }
- }
- unresolved.push(patchup);
- }, this);
- this.patchupsToApply_ = unresolved;
- },
-
- replacePIDRefsInPatchups: function(old_pid_ref, new_pid_ref) {
- this.patchupsToApply_.forEach(function(patchup) {
- if (patchup.pidRef === old_pid_ref)
- patchup.pidRef = new_pid_ref;
- });
- },
-
- /**
- * Called by the model to join references between objects, after final model
- * bounds have been computed.
- */
- joinRefs: function() {
- this.joinObjectRefs_();
- this.applyObjectRefPatchups();
- },
-
- joinObjectRefs_: function() {
- tr.b.iterItems(this.processes, function(pid, process) {
- this.joinObjectRefsForProcess_(pid, process);
- }, this);
- },
-
- joinObjectRefsForProcess_: function(pid, process) {
- // Iterate the world, looking for id_refs
- tr.b.iterItems(process.threads, function(tid, thread) {
- thread.asyncSliceGroup.slices.forEach(function(item) {
- this.searchItemForIDRefs_(pid, 'start', item);
- }, this);
- thread.sliceGroup.slices.forEach(function(item) {
- this.searchItemForIDRefs_(pid, 'start', item);
- }, this);
- }, this);
- process.objects.iterObjectInstances(function(instance) {
- instance.snapshots.forEach(function(item) {
- this.searchItemForIDRefs_(pid, 'ts', item);
- }, this);
- }, this);
- },
-
- searchItemForIDRefs_: function(pid, itemTimestampField, item) {
- if (!item.args && !item.contexts)
- return;
- var patchupsToApply = this.patchupsToApply_;
-
- function handleField(object, fieldName, fieldValue) {
- if (!fieldValue || (!fieldValue.id_ref && !fieldValue.idRef))
- return;
-
- var scope = fieldValue.scope || tr.model.OBJECT_DEFAULT_SCOPE;
- var idRef = fieldValue.id_ref || fieldValue.idRef;
- var scopedId = new tr.model.ScopedId(scope, idRef);
- var pidRef = fieldValue.pid_ref || fieldValue.pidRef || pid;
- var ts = item[itemTimestampField];
- // We have to delay the actual change to the new value until after all
- // refs have been located. Otherwise, we could end up recursing in
- // ways we definitely didn't intend.
- patchupsToApply.push({
- item: item,
- object: object,
- field: fieldName,
- pidRef: pidRef,
- scopedId: scopedId,
- ts: ts});
- }
- function iterObjectFieldsRecursively(object) {
- if (!(object instanceof Object))
- return;
-
- if ((object instanceof tr.model.ObjectSnapshot) ||
- (object instanceof Float32Array) ||
- (object instanceof tr.b.Quad))
- return;
-
- if (object instanceof Array) {
- for (var i = 0; i < object.length; i++) {
- handleField(object, i, object[i]);
- iterObjectFieldsRecursively(object[i]);
- }
- return;
- }
-
- for (var key in object) {
- var value = object[key];
- handleField(object, key, value);
- iterObjectFieldsRecursively(value);
- }
- }
-
- iterObjectFieldsRecursively(item.args);
- iterObjectFieldsRecursively(item.contexts);
- }
- };
-
- return {
- Model: Model
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/model_indices.html b/chromium/third_party/catapult/tracing/tracing/model/model_indices.html
deleted file mode 100644
index 5a132f8fecf..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/model_indices.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the Event Index class.
- */
-tr.exportTo('tr.model', function() {
- /**
- * A Event Index maps an id to all the events that have that particular id
- *
- * @constructor
- */
- function ModelIndices(model) {
- // For now the only indices we construct are for flowEvents
- this.flowEventsById_ = {};
- model.flowEvents.forEach(function(fe) {
- if (fe.id !== undefined) {
- if (!this.flowEventsById_.hasOwnProperty(fe.id)) {
- this.flowEventsById_[fe.id] = new Array();
- }
- this.flowEventsById_[fe.id].push(fe);
- }
- }, this);
- }
-
- ModelIndices.prototype = {
- addEventWithId: function(id, event) {
- if (!this.flowEventsById_.hasOwnProperty(id)) {
- this.flowEventsById_[id] = new Array();
- }
- this.flowEventsById_[id].push(event);
- },
-
- getFlowEventsWithId: function(id) {
- if (!this.flowEventsById_.hasOwnProperty(id))
- return [];
- return this.flowEventsById_[id];
- }
- };
-
- return {
- ModelIndices: ModelIndices
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/model_indices_test.html b/chromium/third_party/catapult/tracing/tracing/model/model_indices_test.html
deleted file mode 100644
index 750e0b02390..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/model_indices_test.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newFlowEventEx = tr.c.TestUtils.newFlowEventEx;
- var newModel = tr.c.TestUtils.newModel;
-
- test('getCorrectModelIndices', function() {
- var m = newModel(function(m) {
- m.f1 = newFlowEventEx({
- 'title': 'test1',
- start: 0,
- end: 10,
- id: '0x100'
- });
-
- m.f2 = newFlowEventEx({
- 'title': 'test2',
- start: 0,
- end: 10,
- id: '0x100'
- });
-
- m.flowEvents.push(m.f1);
- m.flowEvents.push(m.f2);
- });
-
- assert.isDefined(m.modelIndices);
- var modelIndices = m.modelIndices;
- assert.equal(modelIndices.getFlowEventsWithId('0x100').length, 2);
- assert.equal(modelIndices.getFlowEventsWithId('0x100')[0].id, '0x100');
- assert.equal(modelIndices.getFlowEventsWithId('0x101').length, 0);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/model_settings.html b/chromium/third_party/catapult/tracing/tracing/model/model_settings.html
deleted file mode 100644
index fbe69d60b66..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/model_settings.html
+++ /dev/null
@@ -1,140 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/settings.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
- var Settings = tr.b.Settings;
-
- /**
- * A way to persist settings specific to parts of a trace model.
- *
- * This object should not be persisted because it builds up internal data
- * structures that map model objects to settings keys. It should thus be
- * created for the duration of whatever interaction(s) you're going to do with
- * model settings, and then discarded.
- *
- * This system works on a notion of an object key: for an object's key, it
- * considers all the other keys in the model. If it is unique, then the key is
- * persisted to tr.b.Settings. However, if it is not unique, then the
- * setting is stored on the object itself. Thus, objects with unique keys will
- * be persisted across page reloads, whereas objects with nonunique keys will
- * not.
- */
- function ModelSettings(model) {
- this.model = model;
- this.objectsByKey_ = [];
- this.nonuniqueKeys_ = [];
- this.buildObjectsByKeyMap_();
- this.removeNonuniqueKeysFromSettings_();
- this.ephemeralSettingsByGUID_ = {};
- }
-
- ModelSettings.prototype = {
- buildObjectsByKeyMap_: function() {
- var objects = [];
- this.model.iterateAllPersistableObjects(function(o) {
- objects.push(o);
- });
-
- var objectsByKey = {};
- var NONUNIQUE_KEY = 'nonuniqueKey';
- for (var i = 0; i < objects.length; i++) {
- var object = objects[i];
- var objectKey = object.getSettingsKey();
- if (!objectKey)
- continue;
- if (objectsByKey[objectKey] === undefined) {
- objectsByKey[objectKey] = object;
- continue;
- }
- objectsByKey[objectKey] = NONUNIQUE_KEY;
- }
-
- var nonuniqueKeys = {};
- tr.b.dictionaryKeys(objectsByKey).forEach(function(objectKey) {
- if (objectsByKey[objectKey] !== NONUNIQUE_KEY)
- return;
- delete objectsByKey[objectKey];
- nonuniqueKeys[objectKey] = true;
- });
-
- this.nonuniqueKeys = nonuniqueKeys;
- this.objectsByKey_ = objectsByKey;
- },
-
- removeNonuniqueKeysFromSettings_: function() {
- var settings = Settings.get('trace_model_settings', {});
- var settingsChanged = false;
- tr.b.dictionaryKeys(settings).forEach(function(objectKey) {
- if (!this.nonuniqueKeys[objectKey])
- return;
- settingsChanged = true;
- delete settings[objectKey];
- }, this);
- if (settingsChanged)
- Settings.set('trace_model_settings', settings);
- },
-
- hasUniqueSettingKey: function(object) {
- var objectKey = object.getSettingsKey();
- if (!objectKey)
- return false;
- return this.objectsByKey_[objectKey] !== undefined;
- },
-
- getSettingFor: function(object, objectLevelKey, defaultValue) {
- var objectKey = object.getSettingsKey();
- if (!objectKey || !this.objectsByKey_[objectKey]) {
- var settings = this.getEphemeralSettingsFor_(object);
- var ephemeralValue = settings[objectLevelKey];
- if (ephemeralValue !== undefined)
- return ephemeralValue;
- return defaultValue;
- }
-
- var settings = Settings.get('trace_model_settings', {});
- if (!settings[objectKey])
- settings[objectKey] = {};
- var value = settings[objectKey][objectLevelKey];
- if (value !== undefined)
- return value;
- return defaultValue;
- },
-
- setSettingFor: function(object, objectLevelKey, value) {
- var objectKey = object.getSettingsKey();
- if (!objectKey || !this.objectsByKey_[objectKey]) {
- this.getEphemeralSettingsFor_(object)[objectLevelKey] = value;
- return;
- }
-
- var settings = Settings.get('trace_model_settings', {});
- if (!settings[objectKey])
- settings[objectKey] = {};
- if (settings[objectKey][objectLevelKey] === value)
- return;
- settings[objectKey][objectLevelKey] = value;
- Settings.set('trace_model_settings', settings);
- },
-
- getEphemeralSettingsFor_: function(object) {
- if (object.guid === undefined)
- throw new Error('Only objects with GUIDs can be persisted');
- if (this.ephemeralSettingsByGUID_[object.guid] === undefined)
- this.ephemeralSettingsByGUID_[object.guid] = {};
- return this.ephemeralSettingsByGUID_[object.guid];
- }
- };
-
- return {
- ModelSettings: ModelSettings
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/model_settings_test.html b/chromium/third_party/catapult/tracing/tracing/model/model_settings_test.html
deleted file mode 100644
index 3b7b58ee107..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/model_settings_test.html
+++ /dev/null
@@ -1,178 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/model_settings.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('process_name_uniqueness_0', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var settings = new tr.model.ModelSettings(model);
- assert.isFalse(settings.hasUniqueSettingKey(p1));
- });
-
- test('process_name_uniqueness_1', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- p1.name = 'Browser';
- var settings = new tr.model.ModelSettings(model);
- assert.isTrue(settings.hasUniqueSettingKey(p1));
- });
-
- test('process_name_uniqueness_2', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var p2 = model.getOrCreateProcess(2);
- p1.name = 'Renderer';
- p2.name = 'Renderer';
- var settings = new tr.model.ModelSettings(model);
- assert.isFalse(settings.hasUniqueSettingKey(p1));
- assert.isFalse(settings.hasUniqueSettingKey(p2));
- });
-
- test('process_name_uniqueness_3', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var p2 = model.getOrCreateProcess(2);
- p1.name = 'Renderer';
- p1.labels.push('Google Search');
- p2.name = 'Renderer';
- var settings = new tr.model.ModelSettings(model);
- assert.isTrue(settings.hasUniqueSettingKey(p1));
- assert.isTrue(settings.hasUniqueSettingKey(p2));
- });
-
- test('thread_name_uniqueness_0', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var p2 = model.getOrCreateProcess(2);
- var t1 = p1.getOrCreateThread(1);
- var t2 = p2.getOrCreateThread(2);
- p1.name = 'Browser';
- p2.name = 'Renderer';
- t1.name = 'Main';
- t2.name = 'Main';
- var settings = new tr.model.ModelSettings(model);
- assert.isTrue(settings.hasUniqueSettingKey(t1));
- assert.isTrue(settings.hasUniqueSettingKey(t2));
- });
-
- test('thread_name_uniqueness_1', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var p2 = model.getOrCreateProcess(2);
- var t1 = p1.getOrCreateThread(1);
- var t2 = p2.getOrCreateThread(2);
- p1.name = 'Renderer';
- p2.name = 'Renderer';
- t1.name = 'Main';
- t2.name = 'Main';
- var settings = new tr.model.ModelSettings(model);
- assert.isFalse(settings.hasUniqueSettingKey(t1));
- assert.isFalse(settings.hasUniqueSettingKey(t2));
- });
-
- test('process_persistence_when_not_unique', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var settings = new tr.model.ModelSettings(model);
- assert.isTrue(settings.getSettingFor(p1, 'true_by_default', true));
-
- settings.setSettingFor(p1, 'true_by_default', false);
- assert.isFalse(settings.getSettingFor(p1, 'true_by_default', true));
-
- // Now, clobber the model, and verify that it didn't persist.
- model = new tr.Model();
- p1 = model.getOrCreateProcess(1);
- settings = new tr.model.ModelSettings(model);
- assert.isTrue(settings.getSettingFor(p1, 'true_by_default', true));
- });
-
- test('process_persistence_when_not_unique_with_name', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- p1.name = 'Browser';
- var settings = new tr.model.ModelSettings(model);
- assert.isTrue(settings.getSettingFor(p1, 'true_by_default', true));
-
- settings.setSettingFor(p1, 'true_by_default', false);
- assert.isFalse(settings.getSettingFor(p1, 'true_by_default', true));
-
- // Now, clobber the model, and verify that it persisted.
- model = new tr.Model();
- p1 = model.getOrCreateProcess(1);
- p1.name = 'Browser';
- settings = new tr.model.ModelSettings(model);
- assert.isFalse(settings.getSettingFor(p1, 'true_by_default', true));
- });
-
- test('thread_persistence_when_not_unique', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var p2 = model.getOrCreateProcess(2);
- var t1 = p1.getOrCreateThread(1);
- var t2 = p2.getOrCreateThread(2);
- p1.name = 'Renderer';
- p2.name = 'Renderer';
- t1.name = 'Main';
- t2.name = 'Main';
- var settings = new tr.model.ModelSettings(model);
- assert.isTrue(settings.getSettingFor(t1, 'true_by_default', true));
-
- settings.setSettingFor(t1, 'true_by_default', false);
- assert.isFalse(settings.getSettingFor(t1, 'true_by_default', true));
-
- // Now, clobber the model, and verify that it persisted.
- model = new tr.Model();
- p1 = model.getOrCreateProcess(1);
- p2 = model.getOrCreateProcess(2);
- t1 = p1.getOrCreateThread(1);
- t2 = p2.getOrCreateThread(2);
- p1.name = 'Renderer';
- p2.name = 'Renderer';
- t1.name = 'Main';
- t2.name = 'Main';
- settings = new tr.model.ModelSettings(model);
- assert.isTrue(settings.getSettingFor(t1, 'true_by_default', true));
- });
-
- test('thread_persistence_when_unique', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var p2 = model.getOrCreateProcess(2);
- var t1 = p1.getOrCreateThread(1);
- var t2 = p2.getOrCreateThread(2);
- p1.name = 'Browser';
- p2.name = 'Renderer';
- t1.name = 'Main';
- t2.name = 'Main';
- var settings = new tr.model.ModelSettings(model);
- assert.isTrue(settings.getSettingFor(t1, 'true_by_default', true));
-
- settings.setSettingFor(t1, 'true_by_default', false);
- assert.isFalse(settings.getSettingFor(t1, 'true_by_default', true));
-
- // Now, clobber the model, and verify that it persisted.
- model = new tr.Model();
- p1 = model.getOrCreateProcess(1);
- p2 = model.getOrCreateProcess(2);
- t1 = p1.getOrCreateThread(1);
- t2 = p2.getOrCreateThread(2);
- p1.name = 'Browser';
- p2.name = 'Renderer';
- t1.name = 'Main';
- t2.name = 'Main';
- settings = new tr.model.ModelSettings(model);
- assert.isFalse(settings.getSettingFor(t1, 'true_by_default', true));
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/model_stats.html b/chromium/third_party/catapult/tracing/tracing/model/model_stats.html
deleted file mode 100644
index fd5bf957dc8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/model_stats.html
+++ /dev/null
@@ -1,89 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
-
- /**
- * @constructor
- */
- function ModelStats() {
- this.traceEventCountsByKey_ = new Map();
- this.allTraceEventStats_ = [];
-
- this.traceEventStatsInTimeIntervals_ = new Map();
- this.allTraceEventStatsInTimeIntervals_ = [];
-
- this.hasEventSizesinBytes_ = false;
- }
-
- ModelStats.prototype = {
- TIME_INTERVAL_SIZE_IN_MS: 100,
-
- willProcessBasicTraceEvent: function(phase, category, title, ts,
- opt_eventSizeinBytes) {
- var key = phase + '/' + category + '/' + title;
- var eventStats = this.traceEventCountsByKey_.get(key);
- if (eventStats === undefined) {
- eventStats = {
- phase: phase,
- category: category,
- title: title,
- numEvents: 0,
- totalEventSizeinBytes: 0
- };
- this.traceEventCountsByKey_.set(key, eventStats);
- this.allTraceEventStats_.push(eventStats);
- }
- eventStats.numEvents++;
-
- var timeIntervalKey = Math.floor(
- tr.v.Unit.timestampFromUs(ts) / this.TIME_INTERVAL_SIZE_IN_MS);
- var eventStatsByTimeInverval =
- this.traceEventStatsInTimeIntervals_.get(timeIntervalKey);
- if (eventStatsByTimeInverval === undefined) {
- eventStatsByTimeInverval = {
- timeInterval: timeIntervalKey,
- numEvents: 0,
- totalEventSizeinBytes: 0
- };
- this.traceEventStatsInTimeIntervals_.set(timeIntervalKey,
- eventStatsByTimeInverval);
- this.allTraceEventStatsInTimeIntervals_.push(eventStatsByTimeInverval);
- }
- eventStatsByTimeInverval.numEvents++;
-
- if (opt_eventSizeinBytes !== undefined) {
- this.hasEventSizesinBytes_ = true;
- eventStats.totalEventSizeinBytes += opt_eventSizeinBytes;
- eventStatsByTimeInverval.totalEventSizeinBytes += opt_eventSizeinBytes;
- }
- },
-
- get allTraceEventStats() {
- return this.allTraceEventStats_;
- },
-
- get allTraceEventStatsInTimeIntervals() {
- return this.allTraceEventStatsInTimeIntervals_;
- },
-
- get hasEventSizesinBytes() {
- return this.hasEventSizesinBytes_;
- }
- };
-
- return {
- ModelStats: ModelStats
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/model_stats_test.html b/chromium/third_party/catapult/tracing/tracing/model/model_stats_test.html
deleted file mode 100644
index 2a5631820b1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/model_stats_test.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/model/model_stats.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ModelStats = tr.model.ModelStats;
-
- test('getTraceEventStatsByCategory', function() {
- var modelStats = new ModelStats();
- modelStats.willProcessBasicTraceEvent('X', 'cat1', 'title1');
- modelStats.willProcessBasicTraceEvent('X', 'cat1', 'title1');
- modelStats.willProcessBasicTraceEvent('X', 'cat2', 'title3');
-
- assert.equal(modelStats.allTraceEventStats.length, 2);
- assert.equal(
- modelStats.traceEventCountsByKey_.get('X/cat1/title1').numEvents,
- 2);
- assert.equal(
- modelStats.traceEventCountsByKey_.get('X/cat2/title3').numEvents,
- 1);
- });
-
- test('getTraceEventStatsInTimeIntervals', function() {
- var modelStats = new ModelStats();
- var timeIntervalSizeInUs = modelStats.TIME_INTERVAL_SIZE_IN_MS * 1000;
- modelStats.willProcessBasicTraceEvent('X', 'cat1', 'title1', 1, 1);
- modelStats.willProcessBasicTraceEvent(
- 'X', 'cat1', 'title1', timeIntervalSizeInUs + 1, 2);
- modelStats.willProcessBasicTraceEvent(
- 'X', 'cat1', 'title1', 2 * timeIntervalSizeInUs + 1, 3);
- modelStats.willProcessBasicTraceEvent(
- 'X', 'cat2', 'title3', 2 * timeIntervalSizeInUs + 2, 4);
-
- assert.strictEqual(modelStats.allTraceEventStatsInTimeIntervals.length, 3);
- assert.strictEqual(
- modelStats.traceEventStatsInTimeIntervals_.get(0).numEvents, 1);
- assert.strictEqual(
- modelStats.traceEventStatsInTimeIntervals_.get(1).numEvents, 1);
- assert.strictEqual(
- modelStats.traceEventStatsInTimeIntervals_.get(2).numEvents, 2);
-
- assert.isTrue(modelStats.hasEventSizesinBytes);
- assert.strictEqual(
- modelStats.traceEventStatsInTimeIntervals_.get(0).totalEventSizeinBytes,
- 1);
- assert.strictEqual(
- modelStats.traceEventStatsInTimeIntervals_.get(1).totalEventSizeinBytes,
- 2);
- assert.strictEqual(
- modelStats.traceEventStatsInTimeIntervals_.get(2).totalEventSizeinBytes,
- 7);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/model_test.html b/chromium/third_party/catapult/tracing/tracing/model/model_test.html
deleted file mode 100644
index 75c1f9d5155..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/model_test.html
+++ /dev/null
@@ -1,341 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/importer/import.html">
-<link rel="import" href="/tracing/model/annotation.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/value/time_display_mode.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ThreadSlice = tr.model.ThreadSlice;
- var TitleOrCategoryFilter = tr.c.TitleOrCategoryFilter;
- var Frame = tr.model.Frame;
-
- var createModelWithOneOfEverything = function() {
- var m = new tr.Model();
- var cpu = m.kernel.getOrCreateCpu(1);
- cpu.slices.push(tr.c.TestUtils.newSliceEx({start: 1, duration: 3}));
-
- var p = m.getOrCreateProcess(1);
- var t = p.getOrCreateThread(1);
- var slice = new ThreadSlice('', 'a', 0, 1, {}, 4);
- t.sliceGroup.pushSlice(slice);
- t.asyncSliceGroup.push(tr.c.TestUtils.newAsyncSlice(0, 1, t, t));
-
- var c = p.getOrCreateCounter('', 'ProcessCounter');
- var aSeries = new tr.model.CounterSeries('a', 0);
- var bSeries = new tr.model.CounterSeries('b', 0);
- c.addSeries(aSeries);
- c.addSeries(bSeries);
-
- aSeries.addCounterSample(0, 5);
- aSeries.addCounterSample(1, 6);
- aSeries.addCounterSample(2, 5);
- aSeries.addCounterSample(3, 7);
-
- bSeries.addCounterSample(0, 10);
- bSeries.addCounterSample(1, 15);
- bSeries.addCounterSample(2, 12);
- bSeries.addCounterSample(3, 16);
-
- var c1 = cpu.getOrCreateCounter('', 'CpuCounter');
- var aSeries = new tr.model.CounterSeries('a', 0);
- var bSeries = new tr.model.CounterSeries('b', 0);
- c1.addSeries(aSeries);
- c1.addSeries(bSeries);
-
- aSeries.addCounterSample(0, 5);
- aSeries.addCounterSample(1, 6);
- aSeries.addCounterSample(2, 5);
- aSeries.addCounterSample(3, 7);
-
- bSeries.addCounterSample(0, 10);
- bSeries.addCounterSample(1, 15);
- bSeries.addCounterSample(2, 12);
- bSeries.addCounterSample(3, 16);
-
- var frame1 = new Frame([slice], [{thread: t, start: 1, end: 5}]);
- p.frames.push.apply(p.frames, frame1);
-
- var gd = new tr.model.GlobalMemoryDump(m, 2);
- var pd = new tr.model.ProcessMemoryDump(gd, p, 2);
- gd.processMemoryDumps[1] = pd;
- m.globalMemoryDumps.push(gd);
- p.memoryDumps.push(pd);
-
- m.updateBounds();
-
- return m;
- };
-
- test('helper', function() {
- function Helper(model) {
- this.model = model;
- }
- Helper.guid = tr.b.GUID.allocateSimple();
- Helper.supportsModel = function(model) {
- return true;
- };
-
- var m = new tr.Model();
- var h = m.getOrCreateHelper(Helper);
- assert.isTrue(h instanceof Helper);
- assert.isTrue(h === m.getOrCreateHelper(Helper));
-
- function UnsupportedHelper(model) {
- this.model = model;
- }
- UnsupportedHelper.guid = tr.b.GUID.allocateSimple();
- UnsupportedHelper.supportsModel = function(model) {
- return false;
- };
-
- assert.isUndefined(m.getOrCreateHelper(UnsupportedHelper));
- // Try again to test doesHelperGUIDSupportThisModel_ .
- assert.isUndefined(m.getOrCreateHelper(UnsupportedHelper));
- });
-
- test('modelBounds_EmptyModel', function() {
- var m = new tr.Model();
- m.updateBounds();
- assert.isUndefined(m.bounds.min);
- assert.isUndefined(m.bounds.max);
- });
-
- test('modelBounds_OneEmptyThread', function() {
- var m = new tr.Model();
- var t = m.getOrCreateProcess(1).getOrCreateThread(1);
- m.updateBounds();
- assert.isUndefined(m.bounds.min);
- assert.isUndefined(m.bounds.max);
- });
-
- test('modelBounds_OneThread', function() {
- var m = new tr.Model();
- var t = m.getOrCreateProcess(1).getOrCreateThread(1);
- t.sliceGroup.pushSlice(new ThreadSlice('', 'a', 0, 1, {}, 3));
- m.updateBounds();
- assert.equal(m.bounds.min, 1);
- assert.equal(m.bounds.max, 4);
- });
-
- test('modelBounds_OneThreadAndOneEmptyThread', function() {
- var m = new tr.Model();
- var t1 = m.getOrCreateProcess(1).getOrCreateThread(1);
- t1.sliceGroup.pushSlice(new ThreadSlice('', 'a', 0, 1, {}, 3));
- var t2 = m.getOrCreateProcess(1).getOrCreateThread(1);
- m.updateBounds();
- assert.equal(m.bounds.min, 1);
- assert.equal(m.bounds.max, 4);
- });
-
- test('modelBounds_OneCpu', function() {
- var m = new tr.Model();
- var cpu = m.kernel.getOrCreateCpu(1);
- cpu.slices.push(tr.c.TestUtils.newSliceEx({start: 1, duration: 3}));
- m.updateBounds();
- assert.equal(m.bounds.min, 1);
- assert.equal(m.bounds.max, 4);
- });
-
- test('modelBounds_OneCpuOneThread', function() {
- var m = new tr.Model();
- var cpu = m.kernel.getOrCreateCpu(1);
- cpu.slices.push(tr.c.TestUtils.newSliceEx({start: 1, duration: 3}));
-
- var t = m.getOrCreateProcess(1).getOrCreateThread(1);
- t.sliceGroup.pushSlice(new ThreadSlice('', 'a', 0, 1, {}, 4));
-
- m.updateBounds();
- assert.equal(m.bounds.min, 1);
- assert.equal(m.bounds.max, 5);
- });
-
- test('modelBounds_GlobalMemoryDumps', function() {
- var m = new tr.Model();
- m.globalMemoryDumps.push(new tr.model.GlobalMemoryDump(m, 1));
- m.globalMemoryDumps.push(new tr.model.GlobalMemoryDump(m, 3));
- m.globalMemoryDumps.push(new tr.model.GlobalMemoryDump(m, 5));
-
- m.updateBounds();
- assert.equal(m.bounds.min, 1);
- assert.equal(m.bounds.max, 5);
- });
-
- test('modelBounds_ProcessMemoryDumps', function() {
- var m = new tr.Model();
- var p = m.getOrCreateProcess(1);
- var gd = new tr.model.GlobalMemoryDump(m, -1);
- p.memoryDumps.push(new tr.model.ProcessMemoryDump(gd, m, 1));
- p.memoryDumps.push(new tr.model.ProcessMemoryDump(gd, m, 3));
- p.memoryDumps.push(new tr.model.ProcessMemoryDump(gd, m, 5));
-
- m.updateBounds();
- assert.equal(m.bounds.min, 1);
- assert.equal(m.bounds.max, 5);
- });
-
-
- test('modelConvertsTimestampToModelTime', function() {
- var m = new tr.Model();
- var traceEvents = [
- {ts: 1000, pid: 1, tid: 1, ph: 'B', cat: 'a', name: 'taskA', args: {}},
- {ts: 2000, pid: 1, tid: 1, ph: 'E', cat: 'a', name: 'taskA', args: {}}
- ];
- var i = new tr.importer.Import(m);
- i.importTraces([traceEvents]);
- assert.equal(m.convertTimestampToModelTime('traceEventClock', 1000), 0);
- assert.equal(m.convertTimestampToModelTime('traceEventClock', 2000), 1);
- });
-
- test('TitleOrCategoryFilter', function() {
- var s0 = tr.c.TestUtils.newSliceEx({start: 1, duration: 3});
- assert.isTrue(new TitleOrCategoryFilter('a').matchSlice(s0));
- assert.isFalse(new TitleOrCategoryFilter('x').matchSlice(s0));
-
- var s1 = tr.c.TestUtils.newSliceEx({title: 'ba', start: 1, duration: 3});
- assert.isTrue(new TitleOrCategoryFilter('a').matchSlice(s1));
- assert.isTrue(new TitleOrCategoryFilter('ba').matchSlice(s1));
- assert.isFalse(new TitleOrCategoryFilter('x').matchSlice(s1));
- });
-
- test('model_findAllThreadsNamed', function() {
- var m = new tr.Model();
- var t = m.getOrCreateProcess(1).getOrCreateThread(1);
- t.name = 'CrBrowserMain';
-
- m.updateBounds();
- var f = m.findAllThreadsNamed('CrBrowserMain');
- assert.deepEqual([t], f);
- f = m.findAllThreadsNamed('NoSuchThread');
- assert.equal(f.length, 0);
- });
-
- test('model_updateCategories', function() {
- var m = new tr.Model();
- var t = m.getOrCreateProcess(1).getOrCreateThread(1);
- t.sliceGroup.pushSlice(new ThreadSlice('categoryA', 'a', 0, 1, {}, 3));
- t.sliceGroup.pushSlice(new ThreadSlice('categoryA', 'a', 0, 1, {}, 3));
- t.sliceGroup.pushSlice(new ThreadSlice('categoryB', 'a', 0, 1, {}, 3));
- t.sliceGroup.pushSlice(new ThreadSlice('categoryA', 'a', 0, 1, {}, 3));
- t.sliceGroup.pushSlice(new ThreadSlice('', 'a', 0, 1, {}, 3));
- m.updateCategories_();
- assert.deepEqual(['categoryA', 'categoryB'], m.categories);
- });
-
- test('getEventByStableId', function() {
- var m = new tr.Model();
- var p = m.getOrCreateProcess(0);
- var t = p.getOrCreateThread(1);
- var slice = tr.c.TestUtils.newSliceEx({start: 0, duration: 10});
- t.sliceGroup.pushSlice(slice);
- var ue = tr.c.TestUtils.newInteractionRecord(m, 0, 10);
- m.userModel.expectations.push(ue);
- var gie = tr.c.TestUtils.newInstantEvent({
- title: 'gie',
- start: 0,
- colorId: 0
- });
- m.instantEvents.push(gie);
-
- assert.strictEqual(slice, m.getEventByStableId(slice.stableId));
- assert.strictEqual(ue, m.getEventByStableId(ue.stableId));
- assert.strictEqual(gie, m.getEventByStableId(gie.stableId));
- });
-
- test('model_annotationAddRemove', function() {
- var m = new tr.Model();
- var a1 = new tr.model.Annotation();
- var a2 = new tr.model.Annotation();
-
- assert.equal(m.getAllAnnotations().length, 0);
- m.addAnnotation(a1);
- assert.equal(m.getAllAnnotations().length, 1);
- m.addAnnotation(a2);
- assert.equal(m.getAllAnnotations().length, 2);
-
- assert.equal(m.getAnnotationByGUID(a1.guid), a1);
- assert.equal(m.getAnnotationByGUID(a2.guid), a2);
-
- m.removeAnnotation(a1);
- assert.isUndefined(m.getAnnotationByGUID(a1.guid));
- assert.equal(m.getAnnotationByGUID(a2.guid), a2);
- assert.equal(m.getAllAnnotations().length, 1);
- });
-
- test('model_intrinsicTimeUnit', function() {
- var unit = tr.v.TimeDisplayModes;
- var m = new tr.Model();
-
- // by default it should be milliseconds
- assert.equal(m.intrinsicTimeUnit, unit.ms);
-
- m.intrinsicTimeUnit = unit.ns;
- assert.equal(m.intrinsicTimeUnit, unit.ns);
- // should be able to set to the same
- m.intrinsicTimeUnit = unit.ns;
- assert.equal(m.intrinsicTimeUnit, unit.ns);
- // should not be able to change it after fixing it
- assert.throw(function() { m.intrinsicTimeUnit = unit.ms; });
- assert.equal(m.intrinsicTimeUnit, unit.ns);
- });
-
- test('model_getAllProcesses', function() {
- var m = new tr.Model();
- var p1 = m.getOrCreateProcess(1);
- var p2 = m.getOrCreateProcess(2);
- var p3 = m.getOrCreateProcess(3);
- var p4 = m.getOrCreateProcess(4);
- var p5 = m.getOrCreateProcess(5);
-
- assert.sameMembers(m.getAllProcesses(), [p1, p2, p3, p4, p5]);
- assert.sameMembers(m.getAllProcesses(p => true), [p1, p2, p3, p4, p5]);
- assert.sameMembers(m.getAllProcesses(p => false), []);
- assert.sameMembers(m.getAllProcesses(p => p.pid % 2 === 0), [p2, p4]);
- });
-
- test('model_joinRefs', function() {
- function RefCountingSnapshot() {
- tr.model.ObjectSnapshot.apply(this, arguments);
- this.refCount = 0;
- }
-
- RefCountingSnapshot.prototype = {
- __proto__: tr.model.ObjectSnapshot.prototype,
-
- referencedAt: function() {
- ++this.refCount;
- }
- };
-
- var typeName = 'RefCountingSnapshot';
- tr.model.ObjectSnapshot.register(
- RefCountingSnapshot,
- {typeName: typeName});
-
- var m = new tr.Model();
- var p = m.getOrCreateProcess(1);
- var s1 = p.objects.addSnapshot(new tr.model.ScopedId(typeName, '0x1'),
- 'cat', typeName, 1000, {});
- var s2 = p.objects.addSnapshot(new tr.model.ScopedId(typeName, '0x2'),
- 'cat', typeName, 2000, {
- myRef: {
- scope: typeName,
- id_ref: '0x1'
- }
- });
- m.joinRefs();
- assert.equal(s1.refCount, 1);
- assert.equal(s2.refCount, 0);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/object_collection.html b/chromium/third_party/catapult/tracing/tracing/model/object_collection.html
deleted file mode 100644
index 93122c8d4f5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/object_collection.html
+++ /dev/null
@@ -1,233 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/model/event_container.html">
-<link rel="import" href="/tracing/model/object_instance.html">
-<link rel="import" href="/tracing/model/time_to_object_instance_map.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the ObjectCollection class.
- */
-tr.exportTo('tr.model', function() {
- var ObjectInstance = tr.model.ObjectInstance;
- var ObjectSnapshot = tr.model.ObjectSnapshot;
-
- /**
- * A collection of object instances and their snapshots, accessible by id and
- * time, or by object name.
- *
- * @constructor
- */
- function ObjectCollection(parent) {
- tr.model.EventContainer.call(this);
- this.parent = parent;
- // scope -> {id -> TimeToObjectInstanceMap}
- this.instanceMapsByScopedId_ = {};
- this.instancesByTypeName_ = {};
- this.createObjectInstance_ = this.createObjectInstance_.bind(this);
- }
-
- ObjectCollection.prototype = {
- __proto__: tr.model.EventContainer.prototype,
-
- childEvents: function*() {
- for (var instance of this.getAllObjectInstances()) {
- yield instance;
- yield * instance.snapshots;
- }
- },
-
- createObjectInstance_: function(
- parent, scopedId, category, name, creationTs, opt_baseTypeName) {
- var constructor = tr.model.ObjectInstance.getConstructor(
- category, name);
- var instance = new constructor(
- parent, scopedId, category, name, creationTs, opt_baseTypeName);
- var typeName = instance.typeName;
- var instancesOfTypeName = this.instancesByTypeName_[typeName];
- if (!instancesOfTypeName) {
- instancesOfTypeName = [];
- this.instancesByTypeName_[typeName] = instancesOfTypeName;
- }
- instancesOfTypeName.push(instance);
- return instance;
- },
-
- getOrCreateInstanceMap_: function(scopedId) {
- var dict;
- if (scopedId.scope in this.instanceMapsByScopedId_) {
- dict = this.instanceMapsByScopedId_[scopedId.scope];
- } else {
- dict = {};
- this.instanceMapsByScopedId_[scopedId.scope] = dict;
- }
- var instanceMap = dict[scopedId.id];
- if (instanceMap)
- return instanceMap;
- instanceMap = new tr.model.TimeToObjectInstanceMap(
- this.createObjectInstance_, this.parent, scopedId);
- dict[scopedId.id] = instanceMap;
- return instanceMap;
- },
-
- idWasCreated: function(scopedId, category, name, ts) {
- var instanceMap = this.getOrCreateInstanceMap_(scopedId);
- return instanceMap.idWasCreated(category, name, ts);
- },
-
- addSnapshot: function(
- scopedId, category, name, ts, args, opt_baseTypeName) {
- var instanceMap = this.getOrCreateInstanceMap_(scopedId);
- var snapshot = instanceMap.addSnapshot(
- category, name, ts, args, opt_baseTypeName);
- if (snapshot.objectInstance.category != category) {
- var msg = 'Added snapshot name=' + name + ' with cat=' + category +
- ' impossible. It instance was created/snapshotted with cat=' +
- snapshot.objectInstance.category + ' name=' +
- snapshot.objectInstance.name;
- throw new Error(msg);
- }
- if (opt_baseTypeName &&
- snapshot.objectInstance.baseTypeName != opt_baseTypeName) {
- throw new Error('Could not add snapshot with baseTypeName=' +
- opt_baseTypeName + '. It ' +
- 'was previously created with name=' +
- snapshot.objectInstance.baseTypeName);
- }
- if (snapshot.objectInstance.name != name) {
- throw new Error('Could not add snapshot with name=' + name + '. It ' +
- 'was previously created with name=' +
- snapshot.objectInstance.name);
- }
- return snapshot;
- },
-
- idWasDeleted: function(scopedId, category, name, ts) {
- var instanceMap = this.getOrCreateInstanceMap_(scopedId);
- var deletedInstance = instanceMap.idWasDeleted(category, name, ts);
- if (!deletedInstance)
- return;
- if (deletedInstance.category != category) {
- var msg = 'Deleting object ' + deletedInstance.name +
- ' with a different category ' +
- 'than when it was created. It previous had cat=' +
- deletedInstance.category + ' but the delete command ' +
- 'had cat=' + category;
- throw new Error(msg);
- }
- if (deletedInstance.baseTypeName != name) {
- throw new Error('Deletion requested for name=' +
- name + ' could not proceed: ' +
- 'An existing object with baseTypeName=' +
- deletedInstance.baseTypeName + ' existed.');
- }
- },
-
- autoDeleteObjects: function(maxTimestamp) {
- tr.b.iterItems(this.instanceMapsByScopedId_, function(scope, imapById) {
- tr.b.iterItems(imapById, function(id, i2imap) {
- var lastInstance = i2imap.lastInstance;
- if (lastInstance.deletionTs != Number.MAX_VALUE)
- return;
- i2imap.idWasDeleted(
- lastInstance.category, lastInstance.name, maxTimestamp);
- // idWasDeleted will cause lastInstance.deletionTsWasExplicit to be
- // set to true. Unset it here.
- lastInstance.deletionTsWasExplicit = false;
- });
- });
- },
-
- getObjectInstanceAt: function(scopedId, ts) {
- var instanceMap;
- if (scopedId.scope in this.instanceMapsByScopedId_)
- instanceMap = this.instanceMapsByScopedId_[scopedId.scope][scopedId.id];
- if (!instanceMap)
- return undefined;
- return instanceMap.getInstanceAt(ts);
- },
-
- getSnapshotAt: function(scopedId, ts) {
- var instance = this.getObjectInstanceAt(scopedId, ts);
- if (!instance)
- return undefined;
- return instance.getSnapshotAt(ts);
- },
-
- iterObjectInstances: function(iter, opt_this) {
- opt_this = opt_this || this;
- tr.b.iterItems(this.instanceMapsByScopedId_, function(scope, imapById) {
- tr.b.iterItems(imapById, function(id, i2imap) {
- i2imap.instances.forEach(iter, opt_this);
- });
- });
- },
-
- getAllObjectInstances: function() {
- var instances = [];
- this.iterObjectInstances(function(i) { instances.push(i); });
- return instances;
- },
-
- getAllInstancesNamed: function(name) {
- return this.instancesByTypeName_[name];
- },
-
- getAllInstancesByTypeName: function() {
- return this.instancesByTypeName_;
- },
-
- preInitializeAllObjects: function() {
- this.iterObjectInstances(function(instance) {
- instance.preInitialize();
- });
- },
-
- initializeAllObjects: function() {
- this.iterObjectInstances(function(instance) {
- instance.initialize();
- });
- },
-
- initializeInstances: function() {
- this.iterObjectInstances(function(instance) {
- instance.initialize();
- });
- },
-
- updateBounds: function() {
- this.bounds.reset();
- this.iterObjectInstances(function(instance) {
- instance.updateBounds();
- this.bounds.addRange(instance.bounds);
- }, this);
- },
-
- shiftTimestampsForward: function(amount) {
- this.iterObjectInstances(function(instance) {
- instance.shiftTimestampsForward(amount);
- });
- },
-
- addCategoriesToDict: function(categoriesDict) {
- this.iterObjectInstances(function(instance) {
- categoriesDict[instance.category] = true;
- });
- }
- };
-
- return {
- ObjectCollection: ObjectCollection
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/object_collection_test.html b/chromium/third_party/catapult/tracing/tracing/model/object_collection_test.html
deleted file mode 100644
index 7137f89b201..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/object_collection_test.html
+++ /dev/null
@@ -1,231 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/object_collection.html">
-<link rel="import" href="/tracing/model/scoped_id.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var TestObjectInstance = function(
- parent, scopedId, category, name, creationTs) {
- tr.model.ObjectInstance.call(
- this, parent, scopedId, category, name, creationTs);
- };
-
- TestObjectInstance.prototype = {
- __proto__: tr.model.ObjectInstance.prototype
- };
-
- test('objectInstanceSubtype', function() {
- // Register that TestObjects are bound to TestObjectInstance.
- tr.model.ObjectInstance.register(
- TestObjectInstance,
- {typeName: 'TestObject'});
-
- try {
- var collection = new tr.model.ObjectCollection({ });
- var scopedId = new tr.model.ScopedId('ptr', '0x1000');
- collection.idWasCreated(
- scopedId, 'tr.e.cc', 'Frame', 10);
- collection.idWasDeleted(
- scopedId, 'tr.e.cc', 'Frame', 15);
- collection.idWasCreated(
- scopedId, 'skia', 'TestObject', 20);
- collection.idWasDeleted(
- scopedId, 'skia', 'TestObject', 25);
-
- var testFrame = collection.getObjectInstanceAt(scopedId, 10);
- assert.instanceOf(testFrame, tr.model.ObjectInstance);
- assert.notInstanceOf(testFrame, TestObjectInstance);
-
- var testObject = collection.getObjectInstanceAt(scopedId, 20);
- assert.instanceOf(testObject, tr.model.ObjectInstance);
- assert.instanceOf(testObject, TestObjectInstance);
- } finally {
- tr.model.ObjectInstance.unregister(TestObjectInstance);
- }
- });
-
- test('twoSnapshots', function() {
- var collection = new tr.model.ObjectCollection({});
- var scopedId = new tr.model.ScopedId('ptr', '0x1000');
- collection.idWasCreated(
- scopedId, 'cat', 'Frame', 10);
- collection.addSnapshot(
- scopedId, 'cat', 'Frame', 10, {foo: 1});
- collection.addSnapshot(
- scopedId, 'cat', 'Frame', 20, {foo: 2});
-
- collection.updateBounds();
- assert.equal(collection.bounds.min, 10);
- assert.equal(collection.bounds.max, 20);
-
- var s0 = collection.getSnapshotAt(scopedId, 1);
- assert.isUndefined(s0);
-
- var s1 = collection.getSnapshotAt(scopedId, 10);
- assert.equal(s1.args.foo, 1);
-
- var s2 = collection.getSnapshotAt(scopedId, 15);
- assert.equal(s2.args.foo, 1);
- assert.equal(s1, s2);
-
- var s3 = collection.getSnapshotAt(scopedId, 20);
- assert.equal(s3.args.foo, 2);
- assert.equal(s1.object, s3.object);
-
- var s4 = collection.getSnapshotAt(scopedId, 25);
- assert.equal(s4, s3);
- });
-
- test('twoObjectsSharingOneID', function() {
- var collection = new tr.model.ObjectCollection({});
- var scopedId = new tr.model.ScopedId('ptr', '0x1000');
- collection.idWasCreated(
- scopedId, 'tr.e.cc', 'Frame', 10);
- collection.idWasDeleted(
- scopedId, 'tr.e.cc', 'Frame', 15);
- collection.idWasCreated(
- scopedId, 'skia', 'Picture', 20);
- collection.idWasDeleted(
- scopedId, 'skia', 'Picture', 25);
-
- var frame = collection.getObjectInstanceAt(scopedId, 10);
- assert.equal(frame.category, 'tr.e.cc');
- assert.equal(frame.name, 'Frame');
-
- var picture = collection.getObjectInstanceAt(scopedId, 20);
- assert.equal(picture.category, 'skia');
- assert.equal(picture.name, 'Picture');
-
- var typeNames = tr.b.dictionaryKeys(collection.getAllInstancesByTypeName());
- typeNames.sort();
- assert.deepEqual(
- ['Frame', 'Picture'],
- typeNames);
- assert.deepEqual(
- [frame],
- collection.getAllInstancesByTypeName()['Frame']);
- assert.deepEqual(
- [picture],
- collection.getAllInstancesByTypeName()['Picture']);
- });
-
- test('createSnapDelete', function() {
- var collection = new tr.model.ObjectCollection({});
- var scopedId = new tr.model.ScopedId('ptr', '0x1000');
- collection.idWasCreated(
- scopedId, 'cat', 'Frame', 10);
- collection.addSnapshot(
- scopedId, 'cat', 'Frame', 10, {foo: 1});
- collection.idWasDeleted(
- scopedId, 'cat', 'Frame', 15);
-
- collection.updateBounds();
- assert.equal(collection.bounds.min, 10);
- assert.equal(collection.bounds.max, 15);
-
- var s10 = collection.getSnapshotAt(scopedId, 10);
- var i10 = s10.objectInstance;
- assert.equal(i10.creationTs, 10);
- assert.equal(i10.deletionTs, 15);
- });
-
- test('boundsOnUndeletedObject', function() {
- var collection = new tr.model.ObjectCollection({});
- var scopedId = new tr.model.ScopedId('ptr', '0x1000');
- collection.idWasCreated(
- scopedId, 'cat', 'Frame', 10);
- collection.addSnapshot(
- scopedId, 'cat', 'Frame', 15, {foo: 1});
-
- collection.updateBounds();
- assert.equal(10, collection.bounds.min);
- assert.equal(15, collection.bounds.max);
- });
-
- test('snapshotWithCustomBaseTypeThenDelete', function() {
- var collection = new tr.model.ObjectCollection({});
- var scopedId = new tr.model.ScopedId('ptr', '0x1000');
- var s10 = collection.addSnapshot(
- scopedId, 'cat', 'cc::PictureLayerImpl', 10, {}, 'cc::LayerImpl');
- collection.idWasDeleted(
- scopedId, 'cat', 'cc::LayerImpl', 15);
- collection.updateBounds();
- assert.equal(10, collection.bounds.min);
- assert.equal(15, collection.bounds.max);
- assert.equal(s10.objectInstance.name, 'cc::PictureLayerImpl');
- assert.equal(s10.objectInstance.baseTypeName, 'cc::LayerImpl');
- });
-
- test('newWithSnapshotThatChangesBaseType', function() {
- var collection = new tr.model.ObjectCollection({});
- var scopedId = new tr.model.ScopedId('ptr', '0x1000');
- var i10 = collection.idWasCreated(
- scopedId, 'cat', 'cc::LayerImpl', 10);
- var s15 = collection.addSnapshot(
- scopedId, 'cat', 'cc::PictureLayerImpl', 15, {}, 'cc::LayerImpl');
- collection.updateBounds();
- assert.equal(10, collection.bounds.min);
- assert.equal(15, collection.bounds.max);
- assert.equal(s15.objectInstance, i10);
- assert.equal(i10.name, 'cc::PictureLayerImpl');
- assert.equal(i10.baseTypeName, 'cc::LayerImpl');
- });
-
- test('deleteThenSnapshotWithCustomBase', function() {
- var collection = new tr.model.ObjectCollection({});
- var scopedId = new tr.model.ScopedId('ptr', '0x1000');
- collection.idWasDeleted(
- scopedId, 'cat', 'cc::LayerImpl', 10);
- var s15 = collection.addSnapshot(
- scopedId, 'cat', 'cc::PictureLayerImpl', 15, {}, 'cc::LayerImpl');
- collection.updateBounds();
- assert.equal(10, collection.bounds.min);
- assert.equal(15, collection.bounds.max);
- assert.equal(s15.objectInstance.name, 'cc::PictureLayerImpl');
- });
-
- test('autoDelete', function() {
- var collection = new tr.model.ObjectCollection({});
- var scopedId = new tr.model.ScopedId('ptr', '0x1000');
- collection.idWasCreated(
- scopedId, 'cat', 'Frame', 10);
- collection.addSnapshot(
- scopedId, 'cat', 'Frame', 10, {foo: 1});
- collection.autoDeleteObjects(15);
-
- var s10 = collection.getSnapshotAt(scopedId, 10);
- var i10 = s10.objectInstance;
- assert.equal(15, i10.deletionTs);
- });
-
- test('differentScopes', function() {
- var collection = new tr.model.ObjectCollection({});
- var scopedId1 = new tr.model.ScopedId('ptr', '0x1000');
- var scopedId2 = new tr.model.ScopedId('cc', '0x1000');
- collection.idWasCreated(
- scopedId1, 'cat', 'ptr::object', 10);
- collection.idWasDeleted(
- scopedId1, 'cat', 'ptr::object', 15);
- collection.idWasCreated(
- scopedId2, 'cat', 'cc::object', 10);
- collection.idWasDeleted(
- scopedId2, 'cat', 'cc::object', 15);
-
- var instance = collection.getObjectInstanceAt(scopedId1, 10);
- assert.equal(instance.name, 'ptr::object');
-
- var instance = collection.getObjectInstanceAt(scopedId2, 10);
- assert.equal(instance.name, 'cc::object');
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/object_instance.html b/chromium/third_party/catapult/tracing/tracing/model/object_instance.html
deleted file mode 100644
index 37337712073..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/object_instance.html
+++ /dev/null
@@ -1,206 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/extension_registry.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/model/event.html">
-<link rel="import" href="/tracing/model/object_snapshot.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the ObjectSnapshot and ObjectHistory classes.
- */
-tr.exportTo('tr.model', function() {
- var ObjectSnapshot = tr.model.ObjectSnapshot;
-
- /**
- * An object with a specific id, whose state has been snapshotted several
- * times.
- *
- * @constructor
- */
- function ObjectInstance(
- parent, scopedId, category, name, creationTs, opt_baseTypeName) {
- tr.model.Event.call(this);
- this.parent = parent;
- this.scopedId = scopedId;
- this.category = category;
- this.baseTypeName = opt_baseTypeName ? opt_baseTypeName : name;
- this.name = name;
- this.creationTs = creationTs;
- this.creationTsWasExplicit = false;
- this.deletionTs = Number.MAX_VALUE;
- this.deletionTsWasExplicit = false;
- this.colorId = 0;
- this.bounds = new tr.b.Range();
- this.snapshots = [];
- this.hasImplicitSnapshots = false;
- }
-
- ObjectInstance.prototype = {
- __proto__: tr.model.Event.prototype,
-
- get typeName() {
- return this.name;
- },
-
- addBoundsToRange: function(range) {
- range.addRange(this.bounds);
- },
-
- addSnapshot: function(ts, args, opt_name, opt_baseTypeName) {
- if (ts < this.creationTs)
- throw new Error('Snapshots must be >= instance.creationTs');
- if (ts >= this.deletionTs)
- throw new Error('Snapshots cannot be added after ' +
- 'an objects deletion timestamp.');
-
- var lastSnapshot;
- if (this.snapshots.length > 0) {
- lastSnapshot = this.snapshots[this.snapshots.length - 1];
- if (lastSnapshot.ts == ts)
- throw new Error('Snapshots already exists at this time!');
- if (ts < lastSnapshot.ts) {
- throw new Error(
- 'Snapshots must be added in increasing timestamp order');
- }
- }
-
- // Update baseTypeName if needed.
- if (opt_name &&
- (this.name != opt_name)) {
- if (!opt_baseTypeName)
- throw new Error('Must provide base type name for name update');
- if (this.baseTypeName != opt_baseTypeName)
- throw new Error('Cannot update type name: base types dont match');
- this.name = opt_name;
- }
-
- var snapshotConstructor =
- tr.model.ObjectSnapshot.getConstructor(
- this.category, this.name);
- var snapshot = new snapshotConstructor(this, ts, args);
- this.snapshots.push(snapshot);
- return snapshot;
- },
-
- wasDeleted: function(ts) {
- var lastSnapshot;
- if (this.snapshots.length > 0) {
- lastSnapshot = this.snapshots[this.snapshots.length - 1];
- if (lastSnapshot.ts > ts)
- throw new Error(
- 'Instance cannot be deleted at ts=' +
- ts + '. A snapshot exists that is older.');
- }
- this.deletionTs = ts;
- this.deletionTsWasExplicit = true;
- },
-
- /**
- * See ObjectSnapshot constructor notes on object initialization.
- */
- preInitialize: function() {
- for (var i = 0; i < this.snapshots.length; i++)
- this.snapshots[i].preInitialize();
- },
-
- /**
- * See ObjectSnapshot constructor notes on object initialization.
- */
- initialize: function() {
- for (var i = 0; i < this.snapshots.length; i++)
- this.snapshots[i].initialize();
- },
-
- isAliveAt: function(ts) {
- if (ts < this.creationTs && this.creationTsWasExplicit)
- return false;
- if (ts > this.deletionTs)
- return false;
-
- return true;
- },
-
- getSnapshotAt: function(ts) {
- if (ts < this.creationTs) {
- if (this.creationTsWasExplicit)
- throw new Error('ts must be within lifetime of this instance');
- return this.snapshots[0];
- }
- if (ts > this.deletionTs)
- throw new Error('ts must be within lifetime of this instance');
-
- var snapshots = this.snapshots;
- var i = tr.b.findIndexInSortedIntervals(
- snapshots,
- function(snapshot) { return snapshot.ts; },
- function(snapshot, i) {
- if (i == snapshots.length - 1)
- return snapshots[i].objectInstance.deletionTs;
- return snapshots[i + 1].ts - snapshots[i].ts;
- },
- ts);
- if (i < 0) {
- // Note, this is a little bit sketchy: this lets early ts point at the
- // first snapshot, even before it is taken. We do this because raster
- // tasks usually post before their tile snapshots are dumped. This may
- // be a good line of code to re-visit if we start seeing strange and
- // confusing object references showing up in the traces.
- return this.snapshots[0];
- }
- if (i >= this.snapshots.length)
- return this.snapshots[this.snapshots.length - 1];
- return this.snapshots[i];
- },
-
- updateBounds: function() {
- this.bounds.reset();
- this.bounds.addValue(this.creationTs);
- if (this.deletionTs != Number.MAX_VALUE)
- this.bounds.addValue(this.deletionTs);
- else if (this.snapshots.length > 0)
- this.bounds.addValue(this.snapshots[this.snapshots.length - 1].ts);
- },
-
- shiftTimestampsForward: function(amount) {
- this.creationTs += amount;
- if (this.deletionTs != Number.MAX_VALUE)
- this.deletionTs += amount;
- this.snapshots.forEach(function(snapshot) {
- snapshot.ts += amount;
- });
- },
-
- get userFriendlyName() {
- return this.typeName + ' object ' + this.scopedId;
- }
- };
-
- tr.model.EventRegistry.register(
- ObjectInstance,
- {
- name: 'objectInstance',
- pluralName: 'objectInstances',
- singleViewElementName: 'tr-ui-a-single-object-instance-sub-view',
- multiViewElementName: 'tr-ui-a-multi-object-sub-view'
- });
-
- var options = new tr.b.ExtensionRegistryOptions(
- tr.b.TYPE_BASED_REGISTRY_MODE);
- options.mandatoryBaseClass = ObjectInstance;
- options.defaultConstructor = ObjectInstance;
- tr.b.decorateExtensionRegistry(ObjectInstance, options);
-
- return {
- ObjectInstance: ObjectInstance
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/object_instance_test.html b/chromium/third_party/catapult/tracing/tracing/model/object_instance_test.html
deleted file mode 100644
index fa02cff3945..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/object_instance_test.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/object_instance.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('getSnapshotAtWithImplicitCreation', function() {
- var instance = new tr.model.ObjectInstance(
- {}, '0x1000', 'cat', 'n', 10);
- var s10 = instance.addSnapshot(10, 'a');
- instance.addSnapshot(40, 'b');
- instance.wasDeleted(60);
-
- var s1 = instance.getSnapshotAt(1);
- assert.equal(s1, s10);
-
- var s10 = instance.getSnapshotAt(10);
- assert.equal(s10.args, 'a');
- assert.equal(instance.getSnapshotAt(15), s10);
-
- var s40 = instance.getSnapshotAt(40);
- assert.equal(s40.args, 'b');
- assert.equal(instance.getSnapshotAt(50), s40);
- assert.equal(instance.getSnapshotAt(59.9), s40);
- });
-
- test('getSnapshotAtWithExplicitCreation', function() {
- var instance = new tr.model.ObjectInstance(
- {}, '0x1000', 'cat', 'n', 10);
- instance.creationTsWasExplicit = true;
- instance.addSnapshot(10, 'a');
- instance.wasDeleted(60);
-
- assert.throws(function() {
- instance.getSnapshotAt(1);
- });
-
- var s10 = instance.getSnapshotAt(10);
- assert.equal(s10.args, 'a');
- assert.equal(instance.getSnapshotAt(15), s10);
- });
-
- test('getSnapshotBeforeFirstSnapshot', function() {
- var instance = new tr.model.ObjectInstance(
- {}, '0x1000', 'cat', 'n', 10);
- var s15 = instance.addSnapshot(15, 'a');
- instance.wasDeleted(40);
-
- assert.equal(instance.getSnapshotAt(10), s15);
- });
-
- test('getSnapshotAfterLastSnapshot', function() {
- var instance = new tr.model.ObjectInstance(
- {}, '0x1000', 'cat', 'n', 10);
- var s15 = instance.addSnapshot(15, 'a');
- instance.wasDeleted(40);
-
- assert.equal(instance.getSnapshotAt(20), s15);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/object_snapshot.html b/chromium/third_party/catapult/tracing/tracing/model/object_snapshot.html
deleted file mode 100644
index eb9ca657db3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/object_snapshot.html
+++ /dev/null
@@ -1,101 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/extension_registry.html">
-<link rel="import" href="/tracing/model/event.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
- /**
- * A snapshot of an object instance, at a given moment in time.
- *
- * Initialization of snapshots and instances is three phased:
- *
- * 1. Instances and snapshots are constructed. This happens during event
- * importing. Little should be done here, because the object's data
- * are still being used by the importer to reconstruct object references.
- *
- * 2. Instances and snapshtos are preinitialized. This happens after implicit
- * objects have been found, but before any references have been found and
- * switched to direct references. Thus, every snapshot stands on its own.
- * This is a good time to do global field renaming and type conversion,
- * e.g. recognizing domain-specific types and converting from C++ naming
- * convention to JS.
- *
- * 3. Instances and snapshtos are initialized. At this point, {id_ref:
- * '0x1000'} fields have been converted to snapshot references. This is a
- * good time to generic initialization steps and argument verification.
- *
- * @constructor
- */
- function ObjectSnapshot(objectInstance, ts, args) {
- tr.model.Event.call(this);
- this.objectInstance = objectInstance;
- this.ts = ts;
- this.args = args;
- }
-
- ObjectSnapshot.prototype = {
- __proto__: tr.model.Event.prototype,
-
- /**
- * See ObjectSnapshot constructor notes on object initialization.
- */
- preInitialize: function() {
- },
-
- /**
- * See ObjectSnapshot constructor notes on object initialization.
- */
- initialize: function() {
- },
-
- /**
- * Called when an object reference is resolved as this ObjectSnapshot.
- * @param {Object} item The event (async slice, slice or object) containing
- * the resolved reference.
- * @param {Object} object The object directly containing the reference.
- * @param {String} field The field name of the reference in |object|.
- */
- referencedAt: function(item, object, field) {
- },
-
- addBoundsToRange: function(range) {
- range.addValue(this.ts);
- },
-
- get userFriendlyName() {
- return 'Snapshot of ' +
- this.objectInstance.typeName + ' ' +
- this.objectInstance.id + ' @ ' +
- tr.v.Unit.byName.timeStampInMs.format(this.ts);
- }
- };
-
- tr.model.EventRegistry.register(
- ObjectSnapshot,
- {
- name: 'objectSnapshot',
- pluralName: 'objectSnapshots',
- singleViewElementName: 'tr-ui-a-single-object-snapshot-sub-view',
- multiViewElementName: 'tr-ui-a-multi-object-sub-view'
- });
-
- var options = new tr.b.ExtensionRegistryOptions(
- tr.b.TYPE_BASED_REGISTRY_MODE);
- options.mandatoryBaseClass = ObjectSnapshot;
- options.defaultConstructor = ObjectSnapshot;
- tr.b.decorateExtensionRegistry(ObjectSnapshot, options);
-
- return {
- ObjectSnapshot: ObjectSnapshot
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/object_snapshot_test.html b/chromium/third_party/catapult/tracing/tracing/model/object_snapshot_test.html
deleted file mode 100644
index 67c510248c7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/object_snapshot_test.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/object_instance.html">
-<link rel="import" href="/tracing/model/object_snapshot.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('snapshotTypeRegistry', function() {
- function MySnapshot() {
- tr.model.ObjectSnapshot.apply(this, arguments);
- this.myFoo = this.args.foo;
- }
-
- MySnapshot.prototype = {
- __proto__: tr.model.ObjectSnapshot.prototype
- };
-
- var instance = new tr.model.ObjectInstance(
- {}, '0x1000', 'cat', 'MySnapshot', 10);
- try {
- tr.model.ObjectSnapshot.register(
- MySnapshot,
- {typeName: 'MySnapshot'});
- var snapshot = instance.addSnapshot(15, {foo: 'bar'});
- assert.instanceOf(snapshot, MySnapshot);
- assert.equal(snapshot.myFoo, 'bar');
- } finally {
- tr.model.ObjectSnapshot.unregister(MySnapshot);
- }
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/power_sample.html b/chromium/third_party/catapult/tracing/tracing/model/power_sample.html
deleted file mode 100644
index 62de34ab591..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/power_sample.html
+++ /dev/null
@@ -1,74 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event.html">
-<link rel="import" href="/tracing/model/event_registry.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
-
- var Event = tr.model.Event;
- var EventRegistry = tr.model.EventRegistry;
-
- /**
- * A sample that contains a power measurement (in mW).
- *
- * @constructor
- * @extends {Event}
- */
- function PowerSample(series, start, power) {
- Event.call(this);
-
- this.series_ = series;
- this.start_ = start;
- this.power_ = power;
- }
-
- PowerSample.prototype = {
- __proto__: Event.prototype,
-
- get series() {
- return this.series_;
- },
-
- get start() {
- return this.start_;
- },
-
- set start(value) {
- this.start_ = value;
- },
-
- get power() {
- return this.power_;
- },
-
- set power(value) {
- this.power_ = value;
- },
-
- addBoundsToRange: function(range) {
- range.addValue(this.start);
- }
- };
-
- EventRegistry.register(
- PowerSample,
- {
- name: 'powerSample',
- pluralName: 'powerSamples',
- singleViewElementName: 'tr-ui-a-single-power-sample-sub-view',
- multiViewElementName: 'tr-ui-a-multi-power-sample-sub-view'
- });
-
- return {
- PowerSample: PowerSample
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/power_sample_test.html b/chromium/third_party/catapult/tracing/tracing/model/power_sample_test.html
deleted file mode 100644
index 6625ed4ed59..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/power_sample_test.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/power_sample.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- var PowerSample = tr.model.PowerSample;
-
- test('powerSample', function() {
- var series = new tr.model.PowerSeries(new tr.Model().device);
-
- var sample1 = new PowerSample(series, 0.0, 1000.0);
- var sample2 = new PowerSample(series, 1.0, 2000.0);
-
- assert.equal(sample1.series, series);
- assert.equal(sample1.start, 0.0);
- assert.equal(sample1.power, 1000.0);
-
- assert.equal(sample2.series, series);
- assert.equal(sample2.start, 1.0);
- assert.equal(sample2.power, 2000.0);
- });
-
- test('addBoundsToRange', function() {
- var series = new tr.model.PowerSeries(new tr.Model().device);
-
- var sample1 = new PowerSample(series, 0.0, 1000.0);
- var sample2 = new PowerSample(series, 1.0, 2000.0);
-
- var range = new tr.b.Range();
- sample1.addBoundsToRange(range);
-
- assert.equal(range.min, 0);
- assert.equal(range.max, 0);
-
- sample2.addBoundsToRange(range);
-
- assert.equal(range.min, 0);
- assert.equal(range.max, 1);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/power_series.html b/chromium/third_party/catapult/tracing/tracing/model/power_series.html
deleted file mode 100644
index f3a873bab50..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/power_series.html
+++ /dev/null
@@ -1,126 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/model/event_container.html">
-<link rel="import" href="/tracing/model/power_sample.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
-
- var PowerSample = tr.model.PowerSample;
-
- /**
- * A container holding a time series of power samples.
- *
- * @constructor
- * @extends {EventContainer}
- */
- function PowerSeries(device) {
- tr.model.EventContainer.call(this);
-
- this.device_ = device;
- this.samples_ = [];
- }
-
- PowerSeries.prototype = {
- __proto__: tr.model.EventContainer.prototype,
-
- get device() {
- return this.device_;
- },
-
- get samples() {
- return this.samples_;
- },
-
- get stableId() {
- return this.device_.stableId + '.PowerSeries';
- },
-
- /**
- * Adds a power sample to the series and returns it.
- *
- * Note: Samples must be added in chronological order.
- */
- addPowerSample: function(ts, val) {
- var sample = new PowerSample(this, ts, val);
- this.samples_.push(sample);
- return sample;
- },
-
- /**
- * Returns the total energy (in Joules) consumed between the specified
- * start and end timestamps (in milliseconds).
- */
- getEnergyConsumed: function(start, end) {
- var measurementRange = tr.b.Range.fromExplicitRange(start, end);
-
- var energyConsumed = 0;
- var startIndex = tr.b.findLowIndexInSortedArray(
- this.samples, x => x.start, start) - 1;
- var endIndex = tr.b.findLowIndexInSortedArray(
- this.samples, x => x.start, end);
-
- if (startIndex < 0)
- startIndex = 0;
-
- for (var i = startIndex; i < endIndex; i++) {
- var sample = this.samples[i];
- var nextSample = this.samples[i + 1];
-
- var sampleRange = new tr.b.Range();
- sampleRange.addValue(sample.start);
- sampleRange.addValue(nextSample ? nextSample.start : sample.start);
-
- var timeIntersection = measurementRange.findIntersection(sampleRange);
-
- // Divide by 1000 to convert milliseconds to seconds.
- var durationInSeconds = timeIntersection.duration / 1000;
-
- energyConsumed += durationInSeconds * sample.power;
- }
-
- return energyConsumed;
- },
-
- getSamplesWithinRange: function(start, end) {
- var startIndex = tr.b.findLowIndexInSortedArray(
- this.samples, x => x.start, start);
- var endIndex = tr.b.findLowIndexInSortedArray(
- this.samples, x => x.start, end);
- return this.samples.slice(startIndex, endIndex);
- },
-
- shiftTimestampsForward: function(amount) {
- for (var i = 0; i < this.samples_.length; ++i)
- this.samples_[i].start += amount;
- },
-
- updateBounds: function() {
- this.bounds.reset();
-
- if (this.samples_.length === 0)
- return;
-
- this.bounds.addValue(this.samples_[0].start);
- this.bounds.addValue(this.samples_[this.samples_.length - 1].start);
- },
-
- childEvents: function*() {
- yield * this.samples_;
- },
- };
-
- return {
- PowerSeries: PowerSeries
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/power_series_test.html b/chromium/third_party/catapult/tracing/tracing/model/power_series_test.html
deleted file mode 100644
index 034cae8b786..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/power_series_test.html
+++ /dev/null
@@ -1,150 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/device.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/power_series.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- var Model = tr.Model;
- var PowerSeries = tr.model.PowerSeries;
-
- test('stableId', function() {
- var device = { stableId: 'test' };
- var series = new PowerSeries(device);
-
- assert.equal(series.stableId, 'test.PowerSeries');
- });
-
- test('device', function() {
- var device = new tr.model.Device(new Model());
- var series = new PowerSeries(device);
-
- assert.equal(series.device, device);
- });
-
- test('addPowerSample', function() {
- var series = new PowerSeries(new Model().device);
-
- assert.equal(series.samples.length, 0);
-
- var sample1 = series.addPowerSample(0, 1);
- var sample2 = series.addPowerSample(1, 2);
-
- assert.deepEqual(series.samples, [sample1, sample2]);
- });
-
- test('getEnergyConsumed_oneInterval', function() {
- var series = new PowerSeries(new Model().device);
- series.addPowerSample(0, 1);
- series.addPowerSample(1000, 2);
-
- assert.equal(series.getEnergyConsumed(0, 1000), 1);
- });
-
- test('getEnergyConsumed_twoIntervals', function() {
- var series = new PowerSeries(new Model().device);
- series.addPowerSample(0, 1);
- series.addPowerSample(1000, 2);
- series.addPowerSample(2000, 2);
-
- assert.equal(series.getEnergyConsumed(0, 2000), 3);
- });
-
- test('getEnergyConsumed_oneSample', function() {
- var series = new PowerSeries(new Model().device);
- series.addPowerSample(1000, 1);
-
- assert.equal(series.getEnergyConsumed(0, 2000), 0);
- });
-
- test('getEnergyConsumed_samplesAfterStart', function() {
- var series = new PowerSeries(new Model().device);
- series.addPowerSample(1000, 1);
- series.addPowerSample(2000, 2);
-
- assert.equal(series.getEnergyConsumed(0, 2000), 1);
- });
-
- test('getEnergyConsumed_extraSamplesBeforeStart', function() {
- var series = new PowerSeries(new Model().device);
- series.addPowerSample(0, 10);
- series.addPowerSample(1000, 1);
- series.addPowerSample(2000, 1);
- series.addPowerSample(3000, 1);
-
- assert.equal(series.getEnergyConsumed(2000, 4000), 1);
- });
-
- test('getEnergyConsumed_extraSamplesAfterEnd', function() {
- var series = new PowerSeries(new Model().device);
- series.addPowerSample(0, 1);
- series.addPowerSample(1000, 1);
- series.addPowerSample(2000, 1);
- series.addPowerSample(3000, 10);
-
- assert.equal(series.getEnergyConsumed(0, 2000), 2);
- });
-
- test('shiftTimestampsForward', function() {
- var series = new PowerSeries(new Model().device);
-
- series.addPowerSample(0, 1);
- series.addPowerSample(1, 2);
-
- series.shiftTimestampsForward(2);
-
- assert.equal(series.samples[0].start, 2);
- assert.equal(series.samples[1].start, 3);
-
- series.shiftTimestampsForward(-4);
-
- assert.equal(series.samples[0].start, -2);
- assert.equal(series.samples[1].start, -1);
- });
-
-
- test('updateBounds', function() {
- var series = new PowerSeries(new Model().device);
-
- series.addPowerSample(0, 1);
- series.addPowerSample(1, 2);
- series.updateBounds();
-
- assert.equal(series.bounds.min, 0);
- assert.equal(series.bounds.max, 1);
-
- series.addPowerSample(4, 3);
- series.updateBounds();
-
- assert.equal(series.bounds.min, 0);
- assert.equal(series.bounds.max, 4);
- });
-
- test('childEvents_empty', function() {
- var series = new PowerSeries(new Model().device);
- var eventsInSeries = [];
- for (var event of series.childEvents())
- eventsInSeries.push(event);
- assert.deepEqual(eventsInSeries, []);
- });
-
- test('childEvents_nonempty', function() {
- var series = new PowerSeries(new Model().device);
- var sample1 = series.addPowerSample(0, 1);
- var sample2 = series.addPowerSample(1, 2);
- var eventsInSeries = [];
- for (var event of series.childEvents())
- eventsInSeries.push(event);
- assert.deepEqual(eventsInSeries, [sample1, sample2]);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/process.html b/chromium/third_party/catapult/tracing/tracing/model/process.html
deleted file mode 100644
index 47ed4100427..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/process.html
+++ /dev/null
@@ -1,160 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/process_base.html">
-<link rel="import" href="/tracing/model/process_memory_dump.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the Process class.
- */
-tr.exportTo('tr.model', function() {
- var ProcessBase = tr.model.ProcessBase;
- var ProcessInstantEvent = tr.model.ProcessInstantEvent;
- var Frame = tr.model.Frame;
- var ProcessMemoryDump = tr.model.ProcessMemoryDump;
-
- /**
- * The Process represents a single userland process in the
- * trace.
- * @constructor
- */
- function Process(model, pid) {
- if (model === undefined)
- throw new Error('model must be provided');
- if (pid === undefined)
- throw new Error('pid must be provided');
- tr.model.ProcessBase.call(this, model);
- this.pid = pid;
- this.name = undefined;
- this.labels = [];
- this.instantEvents = [];
- this.memoryDumps = [];
- this.frames = [];
- this.activities = [];
- };
-
- /**
- * Comparison between processes that orders by pid.
- */
- Process.compare = function(x, y) {
- var tmp = tr.model.ProcessBase.compare(x, y);
- if (tmp)
- return tmp;
-
- tmp = tr.b.comparePossiblyUndefinedValues(
- x.name, y.name,
- function(x, y) { return x.localeCompare(y); });
- if (tmp)
- return tmp;
-
- tmp = tr.b.compareArrays(x.labels, y.labels,
- function(x, y) { return x.localeCompare(y); });
- if (tmp)
- return tmp;
-
- return x.pid - y.pid;
- };
-
- Process.prototype = {
- __proto__: tr.model.ProcessBase.prototype,
-
- get stableId() {
- return this.pid;
- },
-
- compareTo: function(that) {
- return Process.compare(this, that);
- },
-
- childEvents: function*() {
- yield * ProcessBase.prototype.childEvents.call(this);
- yield * this.instantEvents;
- yield * this.frames;
- yield * this.memoryDumps;
- },
-
- addLabelIfNeeded: function(labelName) {
- for (var i = 0; i < this.labels.length; i++) {
- if (this.labels[i] === labelName)
- return;
- }
- this.labels.push(labelName);
- },
-
- get userFriendlyName() {
- var res;
- if (this.name)
- res = this.name + ' (pid ' + this.pid + ')';
- else
- res = 'Process ' + this.pid;
- if (this.labels.length)
- res += ': ' + this.labels.join(', ');
- return res;
- },
-
- get userFriendlyDetails() {
- if (this.name)
- return this.name + ' (pid ' + this.pid + ')';
- return 'pid: ' + this.pid;
- },
-
- getSettingsKey: function() {
- if (!this.name)
- return undefined;
- if (!this.labels.length)
- return 'processes.' + this.name;
- return 'processes.' + this.name + '.' + this.labels.join('.');
- },
-
- shiftTimestampsForward: function(amount) {
- for (var i = 0; i < this.instantEvents.length; i++)
- this.instantEvents[i].start += amount;
-
- for (var i = 0; i < this.frames.length; i++)
- this.frames[i].shiftTimestampsForward(amount);
-
- for (var i = 0; i < this.memoryDumps.length; i++)
- this.memoryDumps[i].shiftTimestampsForward(amount);
-
- for (var i = 0; i < this.activities.length; i++)
- this.activities[i].shiftTimestampsForward(amount);
-
- tr.model.ProcessBase.prototype
- .shiftTimestampsForward.apply(this, arguments);
- },
-
- updateBounds: function() {
- tr.model.ProcessBase.prototype.updateBounds.apply(this);
-
- for (var i = 0; i < this.frames.length; i++)
- this.frames[i].addBoundsToRange(this.bounds);
-
- for (var i = 0; i < this.memoryDumps.length; i++)
- this.memoryDumps[i].addBoundsToRange(this.bounds);
-
- for (var i = 0; i < this.activities.length; i++)
- this.activities[i].addBoundsToRange(this.bounds);
- },
-
- sortMemoryDumps: function() {
- this.memoryDumps.sort(function(x, y) {
- return x.start - y.start;
- });
- tr.model.ProcessMemoryDump.hookUpMostRecentVmRegionsLinks(
- this.memoryDumps);
- }
- };
-
- return {
- Process: Process
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/process_base.html b/chromium/third_party/catapult/tracing/tracing/model/process_base.html
deleted file mode 100644
index 92aa673090f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/process_base.html
+++ /dev/null
@@ -1,236 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/model/counter.html">
-<link rel="import" href="/tracing/model/event_container.html">
-<link rel="import" href="/tracing/model/object_collection.html">
-<link rel="import" href="/tracing/model/thread.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the ProcessBase class.
- */
-tr.exportTo('tr.model', function() {
-
- var Thread = tr.model.Thread;
- var Counter = tr.model.Counter;
-
- /**
- * The ProcessBase is a partial base class, upon which Kernel
- * and Process are built.
- *
- * @constructor
- * @extends {tr.model.EventContainer}
- */
- function ProcessBase(model) {
- if (!model)
- throw new Error('Must provide a model');
- tr.model.EventContainer.call(this);
- this.model = model;
- this.threads = {};
- this.counters = {};
- this.objects = new tr.model.ObjectCollection(this);
- this.sortIndex = 0;
- };
-
- ProcessBase.compare = function(x, y) {
- return x.sortIndex - y.sortIndex;
- };
-
- ProcessBase.prototype = {
- __proto__: tr.model.EventContainer.prototype,
-
- get stableId() {
- throw new Error('Not implemented');
- },
-
- childEventContainers: function*() {
- yield * tr.b.dictionaryValues(this.threads);
- yield * tr.b.dictionaryValues(this.counters);
- yield this.objects;
- },
-
- iterateAllPersistableObjects: function(cb) {
- cb(this);
- for (var tid in this.threads)
- this.threads[tid].iterateAllPersistableObjects(cb);
- },
-
- /**
- * Gets the number of threads in this process.
- */
- get numThreads() {
- var n = 0;
- for (var p in this.threads) {
- n++;
- }
- return n;
- },
-
- /**
- * Shifts all the timestamps inside this process forward by the amount
- * specified.
- */
- shiftTimestampsForward: function(amount) {
- for (var child of this.childEventContainers())
- child.shiftTimestampsForward(amount);
- },
-
- /**
- * Closes any open slices.
- */
- autoCloseOpenSlices: function() {
- for (var tid in this.threads) {
- var thread = this.threads[tid];
- thread.autoCloseOpenSlices();
- }
- },
-
- autoDeleteObjects: function(maxTimestamp) {
- this.objects.autoDeleteObjects(maxTimestamp);
- },
-
- /**
- * Called by the model after finalizing imports,
- * but before joining refs.
- */
- preInitializeObjects: function() {
- this.objects.preInitializeAllObjects();
- },
-
- /**
- * Called by the model after joining refs.
- */
- initializeObjects: function() {
- this.objects.initializeAllObjects();
- },
-
- /**
- * Merge slices from the kernel with those from userland for each thread.
- */
- mergeKernelWithUserland: function() {
- for (var tid in this.threads) {
- var thread = this.threads[tid];
- thread.mergeKernelWithUserland();
- }
- },
-
- updateBounds: function() {
- this.bounds.reset();
- for (var tid in this.threads) {
- this.threads[tid].updateBounds();
- this.bounds.addRange(this.threads[tid].bounds);
- }
- for (var id in this.counters) {
- this.counters[id].updateBounds();
- this.bounds.addRange(this.counters[id].bounds);
- }
- this.objects.updateBounds();
- this.bounds.addRange(this.objects.bounds);
- },
-
- addCategoriesToDict: function(categoriesDict) {
- for (var tid in this.threads)
- this.threads[tid].addCategoriesToDict(categoriesDict);
- for (var id in this.counters)
- categoriesDict[this.counters[id].category] = true;
- this.objects.addCategoriesToDict(categoriesDict);
- },
-
- findAllThreadsMatching: function(predicate, opt_this) {
- var threads = [];
- for (var tid in this.threads) {
- var thread = this.threads[tid];
- if (predicate.call(opt_this, thread))
- threads.push(thread);
- }
- return threads;
- },
-
- /**
- * @param {String} The name of the thread to find.
- * @return {Array} An array of all the matched threads.
- */
- findAllThreadsNamed: function(name) {
- var threads = this.findAllThreadsMatching(function(thread) {
- if (!thread.name)
- return false;
- return thread.name === name;
- });
- return threads;
- },
-
- findAtMostOneThreadNamed: function(name) {
- var threads = this.findAllThreadsNamed(name);
- if (threads.length === 0)
- return undefined;
- if (threads.length > 1)
- throw new Error('Expected no more than one ' + name);
- return threads[0];
- },
-
- /**
- * Removes threads from the process that are fully empty.
- */
- pruneEmptyContainers: function() {
- var threadsToKeep = {};
- for (var tid in this.threads) {
- var thread = this.threads[tid];
- if (!thread.isEmpty)
- threadsToKeep[tid] = thread;
- }
- this.threads = threadsToKeep;
- },
-
- /**
- * @return {TimelineThread} The thread identified by tid on this process,
- * or undefined if it doesn't exist.
- */
- getThread: function(tid) {
- return this.threads[tid];
- },
-
- /**
- * @return {TimelineThread} The thread identified by tid on this process,
- * creating it if it doesn't exist.
- */
- getOrCreateThread: function(tid) {
- if (!this.threads[tid])
- this.threads[tid] = new Thread(this, tid);
- return this.threads[tid];
- },
-
- /**
- * @return {Counter} The counter on this process with the given
- * category/name combination, creating it if it doesn't exist.
- */
- getOrCreateCounter: function(cat, name) {
- var id = cat + '.' + name;
- if (!this.counters[id])
- this.counters[id] = new Counter(this, id, cat, name);
- return this.counters[id];
- },
-
- getSettingsKey: function() {
- throw new Error('Not implemented');
- },
-
- createSubSlices: function() {
- for (var tid in this.threads)
- this.threads[tid].createSubSlices();
- }
- };
-
- return {
- ProcessBase: ProcessBase
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/process_memory_dump.html b/chromium/third_party/catapult/tracing/tracing/model/process_memory_dump.html
deleted file mode 100644
index c9d60715703..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/process_memory_dump.html
+++ /dev/null
@@ -1,246 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/container_memory_dump.html">
-<link rel="import" href="/tracing/model/memory_allocator_dump.html">
-<link rel="import" href="/tracing/model/vm_region.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the ProcessMemoryDump class.
- */
-tr.exportTo('tr.model', function() {
-
- // Names of MemoryAllocatorDump(s) from which tracing overhead should be
- // discounted.
- var DISCOUNTED_ALLOCATOR_NAMES = ['winheap', 'malloc'];
-
- // The path to where the tracing overhead dump should be added to the
- // winheap/malloc allocator dump tree.
- var TRACING_OVERHEAD_PATH = ['allocated_objects', 'tracing_overhead'];
-
- var SIZE_NUMERIC_NAME = tr.model.MemoryAllocatorDump.SIZE_NUMERIC_NAME;
- var RESIDENT_SIZE_NUMERIC_NAME =
- tr.model.MemoryAllocatorDump.RESIDENT_SIZE_NUMERIC_NAME;
-
- function getSizeNumericValue(dump, sizeNumericName) {
- var sizeNumeric = dump.numerics[sizeNumericName];
- if (sizeNumeric === undefined)
- return 0;
- return sizeNumeric.value;
- }
-
- /**
- * The ProcessMemoryDump represents a memory dump of a single process.
- * @constructor
- */
- function ProcessMemoryDump(globalMemoryDump, process, start) {
- tr.model.ContainerMemoryDump.call(this, start);
- this.process = process;
- this.globalMemoryDump = globalMemoryDump;
-
- // Process memory totals (optional object) with the following fields (also
- // optional):
- // - residentBytes: Total resident bytes (number)
- // - peakResidentBytes: Peak resident bytes (number)
- // - arePeakResidentBytesResettable: Flag whether peak resident bytes are
- // resettable (boolean)
- // - platformSpecific: Map from OS-specific total names (string) to sizes
- // (number)
- this.totals = undefined;
-
- this.vmRegions = undefined;
-
- // Map from allocator names to heap dumps.
- this.heapDumps = undefined;
-
- this.tracingOverheadOwnershipSetUp_ = false;
- this.tracingOverheadDiscountedFromVmRegions_ = false;
- };
-
- ProcessMemoryDump.prototype = {
- __proto__: tr.model.ContainerMemoryDump.prototype,
-
- get userFriendlyName() {
- return 'Process memory dump at ' +
- tr.v.Unit.byName.timeStampInMs.format(this.start);
- },
-
- get containerName() {
- return this.process.userFriendlyName;
- },
-
- get processMemoryDumps() {
- var dumps = {};
- dumps[this.process.pid] = this;
- return dumps;
- },
-
- get hasOwnVmRegions() {
- return this.vmRegions !== undefined;
- },
-
- setUpTracingOverheadOwnership: function(opt_model) {
- // Make sure that calling this method twice won't lead to
- // 'double-discounting'.
- if (this.tracingOverheadOwnershipSetUp_)
- return;
- this.tracingOverheadOwnershipSetUp_ = true;
-
- var tracingDump = this.getMemoryAllocatorDumpByFullName('tracing');
- if (tracingDump === undefined || tracingDump.owns !== undefined) {
- // The tracing dump either doesn't exist, or it already owns another
- // dump.
- return;
- }
-
- if (tracingDump.owns !== undefined)
- return;
-
- // Add an ownership link from tracing to
- // malloc/allocated_objects/tracing_overhead or
- // winheap/allocated_objects/tracing_overhead.
- var hasDiscountedFromAllocatorDumps = DISCOUNTED_ALLOCATOR_NAMES.some(
- function(allocatorName) {
- // First check if the allocator root exists.
- var allocatorDump = this.getMemoryAllocatorDumpByFullName(
- allocatorName);
- if (allocatorDump === undefined)
- return false; // Allocator doesn't exist, try another one.
-
- var nextPathIndex = 0;
- var currentDump = allocatorDump;
- var currentFullName = allocatorName;
-
- // Descend from the root towards tracing_overhead as long as the dumps
- // on the path exist.
- for (; nextPathIndex < TRACING_OVERHEAD_PATH.length; nextPathIndex++) {
- var childFullName = currentFullName + '/' +
- TRACING_OVERHEAD_PATH[nextPathIndex];
- var childDump = this.getMemoryAllocatorDumpByFullName(
- childFullName);
- if (childDump === undefined)
- break;
-
- currentDump = childDump;
- currentFullName = childFullName;
- }
-
- // Create the missing descendant dumps on the path from the root
- // towards tracing_overhead.
- for (; nextPathIndex < TRACING_OVERHEAD_PATH.length; nextPathIndex++) {
- var childFullName = currentFullName + '/' +
- TRACING_OVERHEAD_PATH[nextPathIndex];
- var childDump = new tr.model.MemoryAllocatorDump(
- currentDump.containerMemoryDump, childFullName);
- childDump.parent = currentDump;
- currentDump.children.push(childDump);
-
- currentFullName = childFullName;
- currentDump = childDump;
- }
-
- // Add the ownership link.
- var ownershipLink =
- new tr.model.MemoryAllocatorDumpLink(tracingDump, currentDump);
- tracingDump.owns = ownershipLink;
- currentDump.ownedBy.push(ownershipLink);
- return true;
- }, this);
-
- // Force rebuilding the memory allocator dump index (if we've just added
- // a new memory allocator dump).
- if (hasDiscountedFromAllocatorDumps)
- this.forceRebuildingMemoryAllocatorDumpByFullNameIndex();
- },
-
- discountTracingOverheadFromVmRegions: function(opt_model) {
- // Make sure that calling this method twice won't lead to
- // 'double-discounting'.
- if (this.tracingOverheadDiscountedFromVmRegions_)
- return;
- this.tracingOverheadDiscountedFromVmRegions_ = true;
-
- var tracingDump = this.getMemoryAllocatorDumpByFullName('tracing');
- if (tracingDump === undefined)
- return;
-
- var discountedSize =
- getSizeNumericValue(tracingDump, SIZE_NUMERIC_NAME);
- var discountedResidentSize =
- getSizeNumericValue(tracingDump, RESIDENT_SIZE_NUMERIC_NAME);
-
- if (discountedSize <= 0 && discountedResidentSize <= 0)
- return;
-
- // Subtract the tracing size from the totals.
- if (this.totals !== undefined) {
- if (this.totals.residentBytes !== undefined)
- this.totals.residentBytes -= discountedResidentSize;
- if (this.totals.peakResidentBytes !== undefined)
- this.totals.peakResidentBytes -= discountedResidentSize;
- }
-
- // Subtract the tracing size from VM regions. More precisely, subtract
- // tracing resident_size from byte stats (private dirty and PSS) and
- // tracing size from virtual size by injecting a fake VM region with
- // negative values.
- if (this.vmRegions !== undefined) {
- var hasSizeInBytes = this.vmRegions.sizeInBytes !== undefined;
- var hasPrivateDirtyResident =
- this.vmRegions.byteStats.privateDirtyResident !== undefined;
- var hasProportionalResident =
- this.vmRegions.byteStats.proportionalResident !== undefined;
-
- if ((hasSizeInBytes && discountedSize > 0) ||
- ((hasPrivateDirtyResident || hasProportionalResident) &&
- discountedResidentSize > 0)) {
- var byteStats = {};
- if (hasPrivateDirtyResident)
- byteStats.privateDirtyResident = -discountedResidentSize;
- if (hasProportionalResident)
- byteStats.proportionalResident = -discountedResidentSize;
- this.vmRegions.addRegion(tr.model.VMRegion.fromDict({
- mappedFile: '[discounted tracing overhead]',
- sizeInBytes: hasSizeInBytes ? -discountedSize : undefined,
- byteStats: byteStats
- }));
- }
- }
- }
- };
-
- ProcessMemoryDump.hookUpMostRecentVmRegionsLinks = function(processDumps) {
- var mostRecentVmRegions = undefined;
-
- processDumps.forEach(function(processDump) {
- // Update the most recent VM regions from the current dump.
- if (processDump.vmRegions !== undefined)
- mostRecentVmRegions = processDump.vmRegions;
-
- // Set the most recent VM regions of the current dump.
- processDump.mostRecentVmRegions = mostRecentVmRegions;
- });
- };
-
- tr.model.EventRegistry.register(
- ProcessMemoryDump,
- {
- name: 'processMemoryDump',
- pluralName: 'processMemoryDumps',
- singleViewElementName: 'tr-ui-a-container-memory-dump-sub-view',
- multiViewElementName: 'tr-ui-a-container-memory-dump-sub-view'
- });
-
- return {
- ProcessMemoryDump: ProcessMemoryDump
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/process_memory_dump_test.html b/chromium/third_party/catapult/tracing/tracing/model/process_memory_dump_test.html
deleted file mode 100644
index 4b1c2a32c71..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/process_memory_dump_test.html
+++ /dev/null
@@ -1,553 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/global_memory_dump.html">
-<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/process_memory_dump.html">
-<link rel="import" href="/tracing/model/vm_region.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var GlobalMemoryDump = tr.model.GlobalMemoryDump;
- var ProcessMemoryDump = tr.model.ProcessMemoryDump;
- var VMRegion = tr.model.VMRegion;
- var VMRegionClassificationNode = tr.model.VMRegionClassificationNode;
- var ScalarNumeric = tr.v.ScalarNumeric;
- var unitlessNumber_smallerIsBetter =
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter;
- var newAllocatorDump = tr.model.MemoryDumpTestUtils.newAllocatorDump;
- var addChildDump = tr.model.MemoryDumpTestUtils.addChildDump;
- var addOwnershipLink = tr.model.MemoryDumpTestUtils.addOwnershipLink;
- var checkDumpNumericsAndDiagnostics =
- tr.model.MemoryDumpTestUtils.checkDumpNumericsAndDiagnostics;
- var checkVMRegions = tr.model.MemoryDumpTestUtils.checkVMRegions;
-
- function createClassificationNode(opt_sizeInBytes, opt_byteStats) {
- var node = new VMRegionClassificationNode();
- if (opt_sizeInBytes !== undefined || opt_byteStats !== undefined) {
- node.addRegion(VMRegion.fromDict({
- mappedFile: 'mock.so',
- sizeInBytes: opt_sizeInBytes,
- byteStats: opt_byteStats
- }));
- }
- return node;
- }
-
- function createProcessMemoryDump(timestamp, model) {
- var gmd = new GlobalMemoryDump(model, timestamp);
- model.globalMemoryDumps.push(gmd);
- var p = model.getOrCreateProcess(123);
- var pmd = new ProcessMemoryDump(gmd, p, timestamp + 1);
- gmd.processMemoryDumps[123] = pmd;
- p.memoryDumps.push(pmd);
- return pmd;
- }
-
- function createFinalizedProcessMemoryDump(timestamp, opt_createdCallback) {
- return createFinalizedProcessMemoryDumps([timestamp], function(pmds) {
- if (opt_createdCallback !== undefined)
- opt_createdCallback(pmds[0]);
- })[0];
- }
-
- function createFinalizedProcessMemoryDumps(timestamps, createdCallback) {
- var model = tr.c.TestUtils.newModel(function(model) {
- var pmds = timestamps.map(function(timestamp) {
- return createProcessMemoryDump(timestamp, model);
- });
- createdCallback(pmds);
- });
- var pmds = model.getProcess(123).memoryDumps;
- assert.lengthOf(pmds, timestamps.length);
- return pmds;
- }
-
- test('processMemoryDumps', function() {
- var pmd = createFinalizedProcessMemoryDump(42);
- var pmds = pmd.processMemoryDumps;
- assert.lengthOf(Object.keys(pmds), 1);
- assert.strictEqual(pmds[123], pmd);
- });
-
- test('hookUpMostRecentVmRegionsLinks_emptyArray', function() {
- var dumps = [];
- ProcessMemoryDump.hookUpMostRecentVmRegionsLinks(dumps);
- assert.lengthOf(dumps, 0);
- });
-
- test('hookUpMostRecentVmRegionsLinks_nonEmptyArray', function() {
- var m = new tr.Model();
-
- // A dump with no VM regions or allocator dumps.
- var dump1 = createProcessMemoryDump(1, m);
-
- // A dump with VM regions and malloc and Oilpan allocator dumps.
- var dump2 = createProcessMemoryDump(2, m);
- dump2.vmRegions = createClassificationNode();
- dump2.memoryAllocatorDumps = [
- newAllocatorDump(dump2, 'oilpan', {
- size: 1024,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 7),
- inner_size: 768
- }),
- newAllocatorDump(dump2, 'v8', {
- size: 2048,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 15),
- inner_size: 1999
- })
- ];
-
- // A dump with malloc and V8 allocator dumps.
- var dump3 = createProcessMemoryDump(3, m);
- dump3.memoryAllocatorDumps = [
- newAllocatorDump(dump3, 'malloc', {
- size: 1024,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 7),
- inner_size: 768
- }),
- newAllocatorDump(dump3, 'v8', {
- size: 2048,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 15),
- inner_size: 1999
- })
- ];
-
- // A dump with VM regions.
- var dump4 = createProcessMemoryDump(4, m);
- dump4.vmRegions = createClassificationNode();
-
- var dumps = [dump1, dump2, dump3, dump4];
- ProcessMemoryDump.hookUpMostRecentVmRegionsLinks(dumps);
-
- assert.lengthOf(dumps, 4);
-
- assert.equal(dumps[0], dump1);
- assert.isUndefined(dump1.mostRecentVmRegions);
-
- assert.equal(dumps[1], dump2);
- assert.equal(dump2.mostRecentVmRegions, dump2.vmRegions);
-
- assert.equal(dumps[2], dump3);
- assert.equal(dump3.mostRecentVmRegions, dump2.vmRegions);
-
- assert.equal(dumps[3], dump4);
- assert.equal(dump4.mostRecentVmRegions, dump4.vmRegions);
- });
-
- test('checkDiscountTracingOverhead_undefinedFields', function() {
- var pmd = createFinalizedProcessMemoryDump(42, function(pmd) {
- pmd.memoryAllocatorDumps = [
- newAllocatorDump(pmd, 'v8', { size: 2048 }),
- newAllocatorDump(pmd, 'tracing', { size: 1024 })
- ];
- });
-
- assert.isUndefined(pmd.totals);
- assert.isUndefined(pmd.vmRegions);
-
- var v8Dump = pmd.getMemoryAllocatorDumpByFullName('v8');
- checkDumpNumericsAndDiagnostics(v8Dump, {
- 'size': 2048,
- 'effective_size': 2048
- }, {});
-
- var tracingDump = pmd.getMemoryAllocatorDumpByFullName('tracing');
- checkDumpNumericsAndDiagnostics(tracingDump, {
- 'size': 1024,
- 'effective_size': 1024
- }, {});
- });
-
- test('checkDiscountTracingOverhead_definedFields', function() {
- var pmd = createFinalizedProcessMemoryDump(42, function(pmd) {
- pmd.totals = { residentBytes: 10240 };
- pmd.vmRegions = createClassificationNode(6000, {
- privateDirtyResident: 4096,
- proportionalResident: 5120,
- swapped: 1536
- });
-
- var mallocDump = newAllocatorDump(pmd, 'malloc', { size: 3072 });
- addChildDump(mallocDump, 'allocated_objects', { size: 2560 });
-
- var tracingDump = newAllocatorDump(
- pmd, 'tracing', { size: 1024, resident_size: 1000 });
-
- pmd.memoryAllocatorDumps = [mallocDump, tracingDump];
- });
-
- assert.equal(pmd.totals.residentBytes, 9240);
- assert.isUndefined(pmd.totals.peakResidentBytes);
-
- var vmRegions = pmd.vmRegions;
- assert.strictEqual(vmRegions.sizeInBytes, 4976);
- assert.deepEqual(vmRegions.byteStats, {
- privateDirtyResident: 3096,
- proportionalResident: 4120,
- swapped: 1536
- });
-
- checkVMRegions(vmRegions, [
- {
- mappedFile: 'mock.so',
- sizeInBytes: 6000,
- byteStats: {
- privateDirtyResident: 4096,
- proportionalResident: 5120,
- swapped: 1536
- }
- },
- {
- mappedFile: '[discounted tracing overhead]',
- sizeInBytes: -1024,
- byteStats: {
- privateDirtyResident: -1000,
- proportionalResident: -1000
- }
- }
- ]);
-
- var mallocDump = pmd.getMemoryAllocatorDumpByFullName('malloc');
- checkDumpNumericsAndDiagnostics(mallocDump, {
- 'size': 3072,
- 'effective_size': 2048
- }, {});
- assert.lengthOf(
- mallocDump.children, 2 /* 'allocated_objects' and '<unspecified>' */);
-
- var allocatedObjectsDump = pmd.getMemoryAllocatorDumpByFullName(
- 'malloc/allocated_objects');
- checkDumpNumericsAndDiagnostics(allocatedObjectsDump, {
- 'size': 2560,
- 'effective_size': 1536
- }, {});
- assert.lengthOf(
- allocatedObjectsDump.children,
- 2 /* 'tracing_overhead' and '<unspecified>' */);
-
- var discountDump = pmd.getMemoryAllocatorDumpByFullName(
- 'malloc/allocated_objects/tracing_overhead');
- assert.strictEqual(discountDump.parent, allocatedObjectsDump);
- assert.include(allocatedObjectsDump.children, discountDump);
- checkDumpNumericsAndDiagnostics(discountDump, {
- 'size': 1024,
- 'effective_size': 0
- }, {});
-
- var tracingDump = pmd.getMemoryAllocatorDumpByFullName('tracing');
- checkDumpNumericsAndDiagnostics(tracingDump, {
- 'size': 1024,
- 'effective_size': 1024,
- 'resident_size': 1000
- }, {});
- assert.strictEqual(tracingDump.owns.target, discountDump);
- });
-
- test('checkDiscountTracingOverhead_winheap', function() {
- var pmd = createFinalizedProcessMemoryDump(42, function(pmd) {
- pmd.memoryAllocatorDumps = [
- newAllocatorDump(pmd, 'tracing', { size: 2048 }),
- newAllocatorDump(pmd, 'winheap', { size: 5120 })
- ];
- });
-
- assert.isUndefined(pmd.totals);
- assert.isUndefined(pmd.vmRegions);
-
- var winheapDump = pmd.getMemoryAllocatorDumpByFullName('winheap');
- checkDumpNumericsAndDiagnostics(winheapDump, {
- 'size': 5120,
- 'effective_size': 3072
- }, {});
- assert.lengthOf(winheapDump.children,
- 2 /* 'allocated_objects' and '<unspecified>' */);
-
- var allocatedObjectsDump = pmd.getMemoryAllocatorDumpByFullName(
- 'winheap/allocated_objects');
- checkDumpNumericsAndDiagnostics(allocatedObjectsDump, {
- 'size': 2048,
- 'effective_size': 0
- }, {});
- assert.lengthOf(
- allocatedObjectsDump.children, 1 /* 'tracing_overhead' */);
-
- var discountDump = pmd.getMemoryAllocatorDumpByFullName(
- 'winheap/allocated_objects/tracing_overhead');
- assert.strictEqual(discountDump.parent, allocatedObjectsDump);
- assert.include(allocatedObjectsDump.children, discountDump);
- checkDumpNumericsAndDiagnostics(discountDump, {
- 'size': 2048,
- 'effective_size': 0
- }, {});
-
- var tracingDump = pmd.getMemoryAllocatorDumpByFullName('tracing');
- checkDumpNumericsAndDiagnostics(tracingDump, {
- 'size': 2048,
- 'effective_size': 2048
- }, {});
- assert.strictEqual(tracingDump.owns.target, discountDump);
- });
-
- test('checkDiscountTracingOverhead_withMostRecentVmRegionsLinks', function() {
- var pmds = createFinalizedProcessMemoryDumps([42, 90], function(pmds) {
- pmds[0].totals = { residentBytes: 1000, peakResidentBytes: 2000 };
- pmds[0].vmRegions = createClassificationNode(6000, {
- privateDirtyResident: 4096
- });
- pmds[0].memoryAllocatorDumps = [
- newAllocatorDump(pmds[0], 'tracing', { size: 300, resident_size: 100 })
- ];
-
- pmds[1].totals = { peakResidentBytes: 3000 };
- pmds[1].memoryAllocatorDumps = [
- newAllocatorDump(pmds[0], 'tracing', { resident_size: 200 })
- ];
- });
-
- // First PMD: Both total resident and private dirty resident size should be
- // reduced by 100. Virtual size should be reduced by 300.
- assert.strictEqual(pmds[0].totals.residentBytes, 900);
- assert.strictEqual(pmds[0].totals.peakResidentBytes, 1900);
- assert.strictEqual(pmds[0].vmRegions.sizeInBytes, 5700);
- assert.deepEqual(pmds[0].vmRegions.byteStats, {
- privateDirtyResident: 3996
- });
- checkVMRegions(pmds[0].vmRegions, [
- {
- mappedFile: 'mock.so',
- sizeInBytes: 6000,
- byteStats: {
- privateDirtyResident: 4096,
- }
- },
- {
- mappedFile: '[discounted tracing overhead]',
- sizeInBytes: -300,
- byteStats: {
- privateDirtyResident: -100
- }
- }
- ]);
- assert.strictEqual(pmds[0].mostRecentVmRegions, pmds[0].vmRegions);
-
- // Second PMD: Total resident size should be reduced by 200, whereas private
- // dirty resident size should be reduced by 100 (because it comes from
- // the VM regions in the first dump). Similarly, virtual size should be
- // reduced by 300.
- assert.isUndefined(pmds[1].totals.residentBytes);
- assert.equal(pmds[1].totals.peakResidentBytes, 2800);
- assert.isUndefined(pmds[1].vmRegions);
- assert.strictEqual(pmds[1].mostRecentVmRegions, pmds[0].vmRegions);
- });
-
- test('checkDiscountTracingOverhead_allDiscountedVmRegionFields', function() {
- var pmd = createFinalizedProcessMemoryDump(42, function(pmd) {
- pmd.vmRegions = createClassificationNode(10000, {
- privateDirtyResident: 4096,
- proportionalResident: 8192,
- swapped: 1536
- });
- pmd.memoryAllocatorDumps = [
- newAllocatorDump(pmd, 'tracing', { size: 1000, resident_size: 1024 })
- ];
- });
-
- var vmRegions = pmd.vmRegions;
- assert.strictEqual(vmRegions.sizeInBytes, 9000);
- assert.deepEqual(vmRegions.byteStats, {
- privateDirtyResident: 3072,
- proportionalResident: 7168,
- swapped: 1536
- });
- checkVMRegions(vmRegions, [
- {
- mappedFile: 'mock.so',
- sizeInBytes: 10000,
- byteStats: {
- privateDirtyResident: 4096,
- proportionalResident: 8192,
- swapped: 1536
- }
- },
- {
- mappedFile: '[discounted tracing overhead]',
- sizeInBytes: -1000,
- byteStats: {
- privateDirtyResident: -1024,
- proportionalResident: -1024
- }
- }
- ]);
- });
-
- test('checkDiscountTracingOverhead_twoDiscountedVmRegionField', function() {
- var pmd = createFinalizedProcessMemoryDump(42, function(pmd) {
- pmd.vmRegions = createClassificationNode(10000, {
- privateDirtyResident: 4096,
- swapped: 1536
- });
- pmd.memoryAllocatorDumps = [
- newAllocatorDump(pmd, 'tracing', { size: 1000, resident_size: 1024 })
- ];
- });
-
- var vmRegions = pmd.vmRegions;
- assert.strictEqual(vmRegions.sizeInBytes, 9000);
- assert.deepEqual(vmRegions.byteStats, {
- privateDirtyResident: 3072,
- swapped: 1536
- });
- checkVMRegions(vmRegions, [
- {
- mappedFile: 'mock.so',
- sizeInBytes: 10000,
- byteStats: {
- privateDirtyResident: 4096,
- swapped: 1536
- }
- },
- {
- mappedFile: '[discounted tracing overhead]',
- sizeInBytes: -1000,
- byteStats: {
- privateDirtyResident: -1024
- }
- }
- ]);
- });
-
- test('checkDiscountTracingOverhead_oneDiscountedVmRegionField', function() {
- var pmd = createFinalizedProcessMemoryDump(42, function(pmd) {
- pmd.vmRegions = createClassificationNode(10000);
- pmd.memoryAllocatorDumps = [
- newAllocatorDump(pmd, 'tracing', { size: 1000, resident_size: 1024 })
- ];
- });
-
- var vmRegions = pmd.vmRegions;
- assert.strictEqual(vmRegions.sizeInBytes, 9000);
- assert.deepEqual(vmRegions.byteStats, {});
- checkVMRegions(vmRegions, [
- {
- mappedFile: 'mock.so',
- sizeInBytes: 10000
- },
- {
- mappedFile: '[discounted tracing overhead]',
- sizeInBytes: -1000
- }
- ]);
- });
-
- test('checkDiscountTracingOverhead_noDiscountedVmRegionFields', function() {
- var pmd = createFinalizedProcessMemoryDump(42, function(pmd) {
- pmd.vmRegions = createClassificationNode(undefined, {
- swapped: 1536
- });
- pmd.memoryAllocatorDumps = [
- newAllocatorDump(pmd, 'tracing', { size: 1000, resident_size: 1024 })
- ];
- });
-
- var vmRegions = pmd.vmRegions;
- assert.isUndefined(vmRegions.sizeInBytes);
- assert.deepEqual(vmRegions.byteStats, {
- swapped: 1536
- });
- checkVMRegions(vmRegions, [
- {
- mappedFile: 'mock.so',
- byteStats: {
- swapped: 1536
- }
- }
- ]);
- });
-
- test('checkDiscountTracingOverhead_existingLink', function() {
- var pmd = createFinalizedProcessMemoryDump(42, function(pmd) {
- pmd.totals = { residentBytes: 10240 };
-
- pmd.vmRegions = createClassificationNode(6000, {
- privateDirtyResident: 4096,
- swapped: 1536,
- proportionalResident: 5120
- });
-
- var mallocDump = newAllocatorDump(pmd, 'malloc', { size: 3072 });
- var tracingDump = newAllocatorDump(pmd, 'tracing',
- { size: 1024, resident_size: 1000 });
- var ownedDump = newAllocatorDump(pmd, 'owned');
-
- // The code for discounting tracing overhead should *not* override an
- // existing ownership.
- addOwnershipLink(tracingDump, ownedDump);
-
- pmd.memoryAllocatorDumps = [mallocDump, tracingDump, ownedDump];
- });
-
- assert.strictEqual(pmd.totals.residentBytes, 9240);
- assert.isUndefined(pmd.totals.peakResidentBytes);
-
- var vmRegions = pmd.vmRegions;
- assert.strictEqual(vmRegions.sizeInBytes, 4976);
- assert.deepEqual(vmRegions.byteStats, {
- privateDirtyResident: 3096,
- proportionalResident: 4120,
- swapped: 1536
- });
- checkVMRegions(vmRegions, [
- {
- mappedFile: 'mock.so',
- sizeInBytes: 6000,
- byteStats: {
- privateDirtyResident: 4096,
- proportionalResident: 5120,
- swapped: 1536
- }
- },
- {
- mappedFile: '[discounted tracing overhead]',
- sizeInBytes: -1024,
- byteStats: {
- privateDirtyResident: -1000,
- proportionalResident: -1000
- }
- }
- ]);
-
- var mallocDump = pmd.getMemoryAllocatorDumpByFullName('malloc');
- checkDumpNumericsAndDiagnostics(mallocDump, {
- 'size': 3072,
- 'effective_size': 3072
- }, {});
- assert.lengthOf(mallocDump.children, 0);
-
- var ownedDump = pmd.getMemoryAllocatorDumpByFullName('owned');
- checkDumpNumericsAndDiagnostics(ownedDump, {
- 'size': 1024,
- 'effective_size': 0
- }, {});
- assert.lengthOf(ownedDump.children, 0);
-
- var tracingDump = pmd.getMemoryAllocatorDumpByFullName('tracing');
- checkDumpNumericsAndDiagnostics(tracingDump, {
- 'size': 1024,
- 'effective_size': 1024,
- 'resident_size': 1000
- }, {});
- assert.strictEqual(tracingDump.owns.target, ownedDump);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/process_test.html b/chromium/third_party/catapult/tracing/tracing/model/process_test.html
deleted file mode 100644
index 46c2ca802a3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/process_test.html
+++ /dev/null
@@ -1,112 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/frame.html">
-<link rel="import" href="/tracing/model/global_memory_dump.html">
-<link rel="import" href="/tracing/model/instant_event.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/process.html">
-<link rel="import" href="/tracing/model/thread_slice.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('getOrCreateCounter', function() {
- var model = new tr.Model();
- var process = new tr.model.Process(model, 7);
- var ctrBar = process.getOrCreateCounter('foo', 'bar');
- var ctrBar2 = process.getOrCreateCounter('foo', 'bar');
- assert.equal(ctrBar2, ctrBar);
- });
-
- test('shiftTimestampsForward', function() {
- var model = new tr.Model();
- var process = new tr.model.Process(model, 7);
- var ctr = process.getOrCreateCounter('foo', 'bar');
- var thread = process.getOrCreateThread(1);
-
- var instantEvent = new tr.model.InstantEvent('cat', 'event1', 1, 100);
- process.instantEvents.push(instantEvent);
-
- var slice = new tr.model.ThreadSlice('', 'a', 0, 1, {}, 4);
- var frame =
- new tr.model.Frame([slice], [{thread: thread, start: 100, end: 200}]);
- process.frames.push(frame);
-
- var memoryDump = new tr.model.GlobalMemoryDump(model, 100);
- process.memoryDumps.push(memoryDump);
-
- var shiftCount = 0;
- thread.shiftTimestampsForward = function(ts) {
- if (ts == 0.32)
- shiftCount++;
- };
- ctr.shiftTimestampsForward = function(ts) {
- if (ts == 0.32)
- shiftCount++;
- };
-
- process.shiftTimestampsForward(0.32);
- assert.equal(shiftCount, 2);
- assert.equal(instantEvent.start, 100.32);
- assert.equal(frame.start, 100.32);
- assert.equal(frame.end, 200.32);
- assert.equal(memoryDump.start, 100.32);
- });
-
- test('compareOnPID', function() {
- var model = new tr.Model();
- var p1 = new tr.model.Process(model, 1);
- p1.name = 'Renderer';
-
- var model = new tr.Model();
- var p2 = new tr.model.Process(model, 2);
- p2.name = 'Renderer';
-
- assert.isBelow(p1.compareTo(p2), 0);
- });
-
- test('compareOnSortIndex', function() {
- var model = new tr.Model();
- var p1 = new tr.model.Process(model, 1);
- p1.name = 'Renderer';
- p1.sortIndex = 1;
-
- var p2 = new tr.model.Process(model, 2);
- p2.name = 'Renderer';
-
- assert.isAbove(p1.compareTo(p2), 0);
- });
-
- test('compareOnName', function() {
- var model = new tr.Model();
- var p1 = new tr.model.Process(model, 1);
- p1.name = 'Browser';
-
- var p2 = new tr.model.Process(model, 2);
- p2.name = 'Renderer';
-
- assert.isBelow(p1.compareTo(p2), 0);
- });
-
- test('compareOnLabels', function() {
- var model = new tr.Model();
- var p1 = new tr.model.Process(model, 1);
- p1.name = 'Renderer';
- p1.labels = ['a'];
-
- var p2 = new tr.model.Process(model, 2);
- p2.name = 'Renderer';
- p2.labels = ['b'];
-
- assert.isBelow(p1.compareTo(p2), 0);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/proxy_selectable_item.html b/chromium/third_party/catapult/tracing/tracing/model/proxy_selectable_item.html
deleted file mode 100644
index e9f3d92cfa4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/proxy_selectable_item.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/selectable_item.html">
-<link rel="import" href="/tracing/model/selection_state.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
- var SelectableItem = tr.model.SelectableItem;
- var SelectionState = tr.model.SelectionState;
-
- /**
- * A ProxySelectableItem is a selectable item which is not a model item itself
- * but instead acts as a proxy for a model item.
- *
- * @constructor
- * @extends {SelectableItem}
- */
- function ProxySelectableItem(modelItem) {
- SelectableItem.call(this, modelItem);
- };
-
- ProxySelectableItem.prototype = {
- __proto__: SelectableItem.prototype,
-
- get selectionState() {
- var modelItem = this.modelItem_;
- if (modelItem === undefined)
- return SelectionState.NONE;
- return modelItem.selectionState;
- }
- };
-
- return {
- ProxySelectableItem: ProxySelectableItem
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/proxy_selectable_item_test.html b/chromium/third_party/catapult/tracing/tracing/model/proxy_selectable_item_test.html
deleted file mode 100644
index 8b5710b2d72..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/proxy_selectable_item_test.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/proxy_selectable_item.html">
-<link rel="import" href="/tracing/model/selection_state.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ProxySelectableItem = tr.model.ProxySelectableItem;
- var SelectionState = tr.model.SelectionState;
-
- test('checkSelectionState_undefinedModelItem', function() {
- var proxyItem = new ProxySelectableItem(undefined);
- assert.isFalse(proxyItem.selected);
- assert.equal(proxyItem.selectionState, SelectionState.NONE);
- });
-
- test('checkSelectionState_definedModelItem', function() {
- // Start with a selected model event.
- var modelItem = {selectionState: SelectionState.SELECTED};
- var proxyItem = new ProxySelectableItem(modelItem);
- assert.isTrue(proxyItem.selected);
- assert.equal(proxyItem.selectionState, SelectionState.SELECTED);
-
- // Change the selection state of the model event to highlighted.
- modelItem.selectionState = SelectionState.HIGHLIGHTED;
- assert.isFalse(proxyItem.selected);
- assert.equal(proxyItem.selectionState, SelectionState.HIGHLIGHTED);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/rect_annotation.html b/chromium/third_party/catapult/tracing/tracing/model/rect_annotation.html
deleted file mode 100644
index a87f7667ee1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/rect_annotation.html
+++ /dev/null
@@ -1,66 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/location.html">
-<link rel="import" href="/tracing/model/annotation.html">
-<link rel="import" href="/tracing/ui/annotations/rect_annotation_view.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
-
- function RectAnnotation(start, end) {
- tr.model.Annotation.apply(this, arguments);
-
- this.startLocation_ = start; // Location of top-left corner.
- this.endLocation_ = end; // Location of bottom-right corner.
- this.fillStyle = 'rgba(255, 180, 0, 0.3)';
- }
-
- RectAnnotation.fromDict = function(dict) {
- var args = dict.args;
- var startLoc =
- new tr.model.Location(args.start.xWorld, args.start.yComponents);
- var endLoc =
- new tr.model.Location(args.end.xWorld, args.end.yComponents);
- return new tr.model.RectAnnotation(startLoc, endLoc);
- }
-
- RectAnnotation.prototype = {
- __proto__: tr.model.Annotation.prototype,
-
- get startLocation() {
- return this.startLocation_;
- },
-
- get endLocation() {
- return this.endLocation_;
- },
-
- toDict: function() {
- return {
- typeName: 'rect',
- args: {
- start: this.startLocation.toDict(),
- end: this.endLocation.toDict()
- }
- };
- },
-
- createView_: function(viewport) {
- return new tr.ui.annotations.RectAnnotationView(viewport, this);
- }
- };
-
- tr.model.Annotation.register(RectAnnotation, {typeName: 'rect'});
-
- return {
- RectAnnotation: RectAnnotation
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/sample.html b/chromium/third_party/catapult/tracing/tracing/model/sample.html
deleted file mode 100644
index a0936a3a8ed..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/sample.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/timed_event.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the Sample class.
- */
-tr.exportTo('tr.model', function() {
- /**
- * A Sample represents a sample taken at an instant in time, plus its stack
- * frame and parameters associated with that sample.
- *
- * @constructor
- */
- function Sample(cpu, thread, title, start, leafStackFrame,
- opt_weight, opt_args) {
- tr.model.TimedEvent.call(this, start);
-
- this.title = title;
- this.cpu = cpu;
- this.thread = thread;
- this.leafStackFrame = leafStackFrame;
- this.weight = opt_weight;
- this.args = opt_args || {};
- }
-
- Sample.prototype = {
- __proto__: tr.model.TimedEvent.prototype,
-
- get colorId() {
- return this.leafStackFrame.colorId;
- },
-
- get stackTrace() {
- return this.leafStackFrame.stackTrace;
- },
-
- getUserFriendlyStackTrace: function() {
- return this.leafStackFrame.getUserFriendlyStackTrace();
- },
-
- get userFriendlyName() {
- return 'Sample at ' + tr.v.Unit.byName.timeStampInMs.format(this.start);
- }
- };
-
- tr.model.EventRegistry.register(
- Sample,
- {
- name: 'sample',
- pluralName: 'samples',
- singleViewElementName: 'tr-ui-a-single-sample-sub-view',
- multiViewElementName: 'tr-ui-a-multi-sample-sub-view'
- });
-
- return {
- Sample: Sample
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/sample_test.html b/chromium/third_party/catapult/tracing/tracing/model/sample_test.html
deleted file mode 100644
index 392b55b8475..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/sample_test.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Sample = tr.model.Sample;
- var StackFrame = tr.model.StackFrame;
- var Thread = tr.model.Thread;
-
- test('sampleStackTrace', function() {
- var thread = tr.c.TestUtils.newFakeThread();
-
- var model = new tr.Model();
- var fABC = tr.c.TestUtils.newStackTrace(model, ['a', 'b', 'c']);
-
- var s = new Sample(undefined, thread, 'instructions_retired',
- 10, fABC, 10);
- var stackTrace = s.stackTrace;
- var stackTraceNames = stackTrace.map(function(f) { return f.title; });
- assert.deepEqual(
- stackTraceNames,
- ['c', 'b', 'a']);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/scoped_id.html b/chromium/third_party/catapult/tracing/tracing/model/scoped_id.html
deleted file mode 100644
index 652d6f0a7d3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/scoped_id.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/model/constants.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
- function ScopedId(scope, id) {
- if (scope === undefined) {
- throw new Error('Scope should be defined. Use \'' +
- tr.model.OBJECT_DEFAULT_SCOPE +
- '\' as the default scope.');
- }
- this.scope = scope;
- this.id = id;
- }
-
- ScopedId.prototype = {
- toString: function() {
- return '{scope: ' + this.scope + ', id: ' + this.id + '}';
- }
- };
-
- return {
- ScopedId: ScopedId
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/selectable_item.html b/chromium/third_party/catapult/tracing/tracing/model/selectable_item.html
deleted file mode 100644
index 25ee56dd2d5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/selectable_item.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/selection_state.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the SelectableItem class.
- */
-tr.exportTo('tr.model', function() {
- var SelectionState = tr.model.SelectionState;
-
- /**
- * A SelectableItem is the abstract base class for any non-container data that
- * has an associated model item in the trace model (possibly itself).
- *
- * Subclasses must provide a selectionState property (or getter).
- *
- * @constructor
- */
- function SelectableItem(modelItem) {
- this.modelItem_ = modelItem;
- }
-
- SelectableItem.prototype = {
- get modelItem() {
- return this.modelItem_;
- },
-
- get selected() {
- return this.selectionState === SelectionState.SELECTED;
- },
-
- addToSelection: function(selection) {
- var modelItem = this.modelItem_;
- if (!modelItem)
- return;
- selection.push(modelItem);
- },
-
- addToTrackMap: function(eventToTrackMap, track) {
- var modelItem = this.modelItem_;
- if (!modelItem)
- return;
- eventToTrackMap.addEvent(modelItem, track);
- }
- };
-
- return {
- SelectableItem: SelectableItem
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/selectable_item_test.html b/chromium/third_party/catapult/tracing/tracing/model/selectable_item_test.html
deleted file mode 100644
index c808f3bee23..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/selectable_item_test.html
+++ /dev/null
@@ -1,80 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event.html">
-<link rel="import" href="/tracing/model/selectable_item.html">
-<link rel="import" href="/tracing/model/selection_state.html">
-<link rel="import" href="/tracing/ui/tracks/event_to_track_map.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Event = tr.model.Event;
- var EventToTrackMap = tr.ui.tracks.EventToTrackMap;
- var SelectableItem = tr.model.SelectableItem;
- var SelectionState = tr.model.SelectionState;
-
- test('checkModelItem', function() {
- var selectableItem1 = new SelectableItem(undefined);
- assert.isUndefined(selectableItem1.modelItem);
-
- var event = new Event();
- var selectableItem2 = new SelectableItem(event);
- assert.equal(selectableItem2.modelItem, event);
- });
-
- test('checkSelected', function() {
- var selectableItem = new SelectableItem(undefined);
-
- selectableItem.selectionState = SelectionState.NONE;
- assert.isFalse(selectableItem.selected);
-
- selectableItem.selectionState = SelectionState.SELECTED;
- assert.isTrue(selectableItem.selected);
-
- selectableItem.selectionState = SelectionState.HIGHLIGHTED;
- assert.isFalse(selectableItem.selected);
- });
-
- test('checkAddToSelection_undefinedModelItem', function() {
- var selectableItem = new SelectableItem(undefined);
- var selection = [];
- selectableItem.addToSelection(selection);
- assert.lengthOf(selection, 0);
- });
-
- test('checkAddToSelection_definedModelItem', function() {
- var event = new Event();
- var selectableItem = new SelectableItem(event);
- var selection = [];
- selectableItem.addToSelection(selection);
- assert.lengthOf(selection, 1);
- assert.equal(selection[0], event);
- });
-
- test('checkAddToTrackMap_undefinedModelItem', function() {
- var selectableItem = new SelectableItem(undefined);
- var eventToTrackMap = new EventToTrackMap();
- var track = {};
- selectableItem.addToTrackMap(eventToTrackMap, track);
- assert.lengthOf(Object.keys(eventToTrackMap), 0);
- });
-
- test('checkAddToTrackMap_definedModelItem', function() {
- var event = new Event();
- var selectableItem = new SelectableItem(event);
- var eventToTrackMap = new EventToTrackMap();
- var track = {};
- selectableItem.addToTrackMap(eventToTrackMap, track);
- assert.lengthOf(Object.keys(eventToTrackMap), 1);
- assert.equal(eventToTrackMap[event.guid], track);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/selection_state.html b/chromium/third_party/catapult/tracing/tracing/model/selection_state.html
deleted file mode 100644
index c49abfde4a5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/selection_state.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/color_scheme.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the SelectionState class.
- */
-tr.exportTo('tr.model', function() {
- var ColorScheme = tr.b.ColorScheme;
-
- /**
- * Describes the level of visual highlighting to apply to an event when shown.
- *
- * color_scheme.html defines N variations off of a base color palette,
- * one for each selection state, all concatenated into one flat array. To
- * pick the final colorId for a given variations, the SelectionState is
- * multiplied by the number of base colors.
- *
- * Thus, the values here must be kept in sync with color_scheme's palette
- * layout.
- */
- var SelectionState = {
- NONE: 0,
-
- // Legacy names.
- SELECTED: ColorScheme.properties.brightenedOffsets[0],
- HIGHLIGHTED: ColorScheme.properties.brightenedOffsets[1],
- DIMMED: ColorScheme.properties.dimmedOffsets[0],
-
- // Modern names.
- BRIGHTENED0: ColorScheme.properties.brightenedOffsets[0],
- BRIGHTENED1: ColorScheme.properties.brightenedOffsets[1],
- BRIGHTENED2: ColorScheme.properties.brightenedOffsets[2],
-
- DIMMED0: ColorScheme.properties.dimmedOffsets[0],
- DIMMED1: ColorScheme.properties.dimmedOffsets[1],
- DIMMED2: ColorScheme.properties.dimmedOffsets[2]
- };
-
- var brighteningLevels = [
- SelectionState.NONE,
- SelectionState.BRIGHTENED0,
- SelectionState.BRIGHTENED1,
- SelectionState.BRIGHTENED2
- ];
- SelectionState.getFromBrighteningLevel = function(level) {
- return brighteningLevels[level];
- }
-
- var dimmingLevels = [
- SelectionState.DIMMED0,
- SelectionState.DIMMED1,
- SelectionState.DIMMED2
- ];
- SelectionState.getFromDimmingLevel = function(level) {
- return dimmingLevels[level];
- }
-
- return {
- SelectionState: SelectionState
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/slice.html b/chromium/third_party/catapult/tracing/tracing/model/slice.html
deleted file mode 100644
index 7c53deb305d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/slice.html
+++ /dev/null
@@ -1,297 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/timed_event.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the Slice class.
- */
-tr.exportTo('tr.model', function() {
- /**
- * A Slice represents an interval of time plus parameters associated
- * with that interval.
- *
- * @constructor
- */
- function Slice(category, title, colorId, start, args, opt_duration,
- opt_cpuStart, opt_cpuDuration, opt_argsStripped,
- opt_bind_id) {
- tr.model.TimedEvent.call(this, start);
-
- this.category = category || '';
- this.title = title;
- this.colorId = colorId;
- this.args = args;
- this.startStackFrame = undefined;
- this.endStackFrame = undefined;
- this.didNotFinish = false;
- this.inFlowEvents = [];
- this.outFlowEvents = [];
- this.subSlices = [];
- this.selfTime = undefined;
- this.cpuSelfTime = undefined;
- this.important = false;
- this.parentContainer = undefined;
- this.argsStripped = false;
-
- this.bind_id_ = opt_bind_id;
-
- // parentSlice and isTopLevel will be set by SliceGroup.
- this.parentSlice = undefined;
- this.isTopLevel = false;
- // After SliceGroup processes Slices, isTopLevel should be equivalent to
- // !parentSlice.
-
- if (opt_duration !== undefined)
- this.duration = opt_duration;
-
- if (opt_cpuStart !== undefined)
- this.cpuStart = opt_cpuStart;
-
- if (opt_cpuDuration !== undefined)
- this.cpuDuration = opt_cpuDuration;
-
- if (opt_argsStripped !== undefined)
- this.argsStripped = true;
- }
-
- Slice.prototype = {
- __proto__: tr.model.TimedEvent.prototype,
-
-
- get analysisTypeName() {
- return this.title;
- },
-
- get userFriendlyName() {
- return 'Slice ' + this.title + ' at ' +
- tr.v.Unit.byName.timeStampInMs.format(this.start);
- },
-
- get stableId() {
- var parentSliceGroup = this.parentContainer.sliceGroup;
- return parentSliceGroup.stableId + '.' +
- parentSliceGroup.slices.indexOf(this);
- },
-
- findDescendentSlice: function(targetTitle) {
- if (!this.subSlices)
- return undefined;
-
- for (var i = 0; i < this.subSlices.length; i++) {
- if (this.subSlices[i].title == targetTitle)
- return this.subSlices[i];
- var slice = this.subSlices[i].findDescendentSlice(targetTitle);
- if (slice) return slice;
- }
- return undefined;
- },
-
- get mostTopLevelSlice() {
- var curSlice = this;
- while (curSlice.parentSlice)
- curSlice = curSlice.parentSlice;
-
- return curSlice;
- },
-
- getProcess: function() {
- var thread = this.parentContainer;
- if (thread && thread.getProcess)
- return thread.getProcess();
- return undefined;
- },
-
- get model() {
- var process = this.getProcess();
- if (process !== undefined)
- return this.getProcess().model;
- return undefined;
- },
-
- /**
- * Finds all topmost slices relative to this slice.
- *
- * Slices may have multiple direct descendants which satisfy
- * |eventPredicate|, and in this case, all of them are topmost as long as
- * this slice does not satisfy the predicate.
- *
- * For instance, suppose we are passing a predicate that checks whether
- * events titles begin with 'C'.
- * C1.findTopmostSlicesRelativeToThisSlice() returns C1 in this example:
- * [ C1 ]
- * [ C2 ]
- *
- * and D.findTopmostSlicesRelativeToThisSlice() returns C1 and C2 in this
- * example:
- * [ D ]
- * [C1] [C2]
- */
- findTopmostSlicesRelativeToThisSlice: function*(eventPredicate) {
- if (eventPredicate(this)) {
- yield this;
- return;
- }
- for (var s of this.subSlices)
- yield * s.findTopmostSlicesRelativeToThisSlice(eventPredicate);
- },
-
- /**
- * Obtains all subsequent slices of this slice.
- *
- * Subsequent slices are slices that get executed after a particular
- * slice, i.e., all the functions that are called after the current one.
- *
- * For instance, E.iterateAllSubsequentSlices() in the following example:
- * [ A ]
- * [ B][ D ][ G ]
- * [C] [E][F] [H]
- * will pass F, G, then H to the provided callback.
- *
- * The reason we need subsequent slices of a particular slice is that
- * when there is flow event goes into, e.g., E, we only want to highlight
- * E's subsequent slices to indicate the execution order.
- *
- * The idea to calculate the subsequent slices of slice E is to view
- * the slice group as a tree where the top-level slice A is the root node.
- * The preorder depth-first-search (DFS) order is naturally equivalent
- * to the function call order. We just need to perform a DFS, and start
- * recording the slices after we see the occurance of E.
- */
- iterateAllSubsequentSlices: function(callback, opt_this) {
- var parentStack = [];
- var started = false;
-
- // get the root node and push it to the DFS stack
- var topmostSlice = this.mostTopLevelSlice;
- parentStack.push(topmostSlice);
-
- // Using the stack to perform DFS
- while (parentStack.length !== 0) {
- var curSlice = parentStack.pop();
-
- if (started)
- callback.call(opt_this, curSlice);
- else
- started = (curSlice.guid === this.guid);
-
- for (var i = curSlice.subSlices.length - 1; i >= 0; i--) {
- parentStack.push(curSlice.subSlices[i]);
- }
- }
- },
-
- get subsequentSlices() {
- var res = [];
-
- this.iterateAllSubsequentSlices(function(subseqSlice) {
- res.push(subseqSlice);
- });
-
- return res;
- },
-
- /**
- * Obtains the parents of a slice, from the most immediate to the root.
- *
- * For instance, E.iterateAllAncestors() in the following example:
- * [ A ]
- * [ B][ D ][ G ]
- * [C] [E][F] [H]
- * will pass D, then A to the provided callback, in the order from the
- * leaves to the root.
- */
- iterateAllAncestors: function(callback, opt_this) {
- var curSlice = this;
-
- while (curSlice.parentSlice) {
- curSlice = curSlice.parentSlice;
- callback.call(opt_this, curSlice);
- }
- },
-
- get ancestorSlices() {
- var res = [];
-
- this.iterateAllAncestors(function(ancestor) {
- res.push(ancestor);
- });
-
- return res;
- },
-
- iterateEntireHierarchy: function(callback, opt_this) {
- var mostTopLevelSlice = this.mostTopLevelSlice;
- callback.call(opt_this, mostTopLevelSlice);
- mostTopLevelSlice.iterateAllSubsequentSlices(callback, opt_this);
- },
-
- get entireHierarchy() {
- var res = [];
-
- this.iterateEntireHierarchy(function(slice) {
- res.push(slice);
- });
-
- return res;
- },
-
- /**
- * Returns this slice, and its ancestor and subsequent slices.
- *
- * For instance, E.ancestorAndSubsequentSlices in the following example:
- * [ A ]
- * [ B][ D ][ G ]
- * [C] [E][F] [H]
- * will return E, D, A, F, G, and H, where E is itself, D and A are
- * E's ancestors, and F, G, and H are subsequent slices of E
- */
- get ancestorAndSubsequentSlices() {
- var res = [];
-
- res.push(this);
-
- this.iterateAllAncestors(function(aSlice) {
- res.push(aSlice);
- });
-
- this.iterateAllSubsequentSlices(function(sSlice) {
- res.push(sSlice);
- });
-
- return res;
- },
-
- iterateAllDescendents: function(callback, opt_this) {
- this.subSlices.forEach(callback, opt_this);
- this.subSlices.forEach(function(subSlice) {
- subSlice.iterateAllDescendents(callback, opt_this);
- }, opt_this);
- },
-
- get descendentSlices() {
- var res = [];
-
- this.iterateAllDescendents(function(des) {
- res.push(des);
- });
-
- return res;
- }
-
- };
-
- return {
- Slice: Slice
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/slice_group.html b/chromium/third_party/catapult/tracing/tracing/model/slice_group.html
deleted file mode 100644
index 9c14e8bf54e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/slice_group.html
+++ /dev/null
@@ -1,662 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/core/filter.html">
-<link rel="import" href="/tracing/model/event_container.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the SliceGroup class.
- */
-tr.exportTo('tr.model', function() {
- var ColorScheme = tr.b.ColorScheme;
- var Slice = tr.model.Slice;
-
- function getSliceLo(s) {
- return s.start;
- }
-
- function getSliceHi(s) {
- return s.end;
- }
-
- /**
- * A group of Slices, plus code to create them from B/E events, as
- * well as arrange them into subRows.
- *
- * Do not mutate the slices array directly. Modify it only by
- * SliceGroup mutation methods.
- *
- * @constructor
- * @param {function(new:Slice, category, title, colorId, start, args)=}
- * opt_sliceConstructor The constructor to use when creating slices.
- * @extends {tr.model.EventContainer}
- */
- function SliceGroup(parentContainer, opt_sliceConstructor, opt_name) {
- tr.model.EventContainer.call(this);
-
- this.parentContainer_ = parentContainer;
-
- var sliceConstructor = opt_sliceConstructor || Slice;
- this.sliceConstructor = sliceConstructor;
-
- this.openPartialSlices_ = [];
-
- this.slices = [];
- this.topLevelSlices = [];
- this.haveTopLevelSlicesBeenBuilt = false;
- this.name_ = opt_name;
-
- if (this.model === undefined)
- throw new Error('SliceGroup must have model defined.');
- }
-
- SliceGroup.prototype = {
- __proto__: tr.model.EventContainer.prototype,
-
- get parentContainer() {
- return this.parentContainer_;
- },
-
- get model() {
- return this.parentContainer_.model;
- },
-
- get stableId() {
- return this.parentContainer_.stableId + '.SliceGroup';
- },
-
- getSettingsKey: function() {
- if (!this.name_)
- return undefined;
- var parentKey = this.parentContainer_.getSettingsKey();
- if (!parentKey)
- return undefined;
- return parentKey + '.' + this.name;
- },
-
- /**
- * @return {Number} The number of slices in this group.
- */
- get length() {
- return this.slices.length;
- },
-
- /**
- * Helper function that pushes the provided slice onto the slices array.
- * @param {Slice} slice The slice to be added to the slices array.
- */
- pushSlice: function(slice) {
- this.haveTopLevelSlicesBeenBuilt = false;
- slice.parentContainer = this.parentContainer_;
- this.slices.push(slice);
- return slice;
- },
-
- /**
- * Helper function that pushes the provided slices onto the slices array.
- * @param {Array.<Slice>} slices An array of slices to be added.
- */
- pushSlices: function(slices) {
- this.haveTopLevelSlicesBeenBuilt = false;
- slices.forEach(function(slice) {
- slice.parentContainer = this.parentContainer_;
- this.slices.push(slice);
- }, this);
- },
-
- /**
- * Opens a new slice in the group's slices.
- *
- * Calls to beginSlice and
- * endSlice must be made with non-monotonically-decreasing timestamps.
- *
- * @param {String} category Category name of the slice to add.
- * @param {String} title Title of the slice to add.
- * @param {Number} ts The timetsamp of the slice, in milliseconds.
- * @param {Object.<string, Object>=} opt_args Arguments associated with
- * the slice.
- * @param {Number=} opt_colorId The color of the slice, defined by
- * its palette id (see base/color_scheme.html).
- */
- beginSlice: function(category, title, ts, opt_args, opt_tts,
- opt_argsStripped, opt_colorId) {
- if (this.openPartialSlices_.length) {
- var prevSlice = this.openPartialSlices_[
- this.openPartialSlices_.length - 1];
- if (ts < prevSlice.start)
- throw new Error('Slices must be added in increasing timestamp order');
- }
-
- var colorId = opt_colorId ||
- ColorScheme.getColorIdForGeneralPurposeString(title);
- var slice = new this.sliceConstructor(category, title, colorId, ts,
- opt_args ? opt_args : {}, null,
- opt_tts, undefined,
- opt_argsStripped);
- this.openPartialSlices_.push(slice);
- slice.didNotFinish = true;
- this.pushSlice(slice);
-
- return slice;
- },
-
- isTimestampValidForBeginOrEnd: function(ts) {
- if (!this.openPartialSlices_.length)
- return true;
- var top = this.openPartialSlices_[this.openPartialSlices_.length - 1];
- return ts >= top.start;
- },
-
- /**
- * @return {Number} The number of beginSlices for which an endSlice has not
- * been issued.
- */
- get openSliceCount() {
- return this.openPartialSlices_.length;
- },
-
- get mostRecentlyOpenedPartialSlice() {
- if (!this.openPartialSlices_.length)
- return undefined;
- return this.openPartialSlices_[this.openPartialSlices_.length - 1];
- },
-
- /**
- * Ends the last begun slice in this group and pushes it onto the slice
- * array.
- *
- * @param {Number} ts Timestamp when the slice ended
- * @param {Number=} opt_colorId The color of the slice, defined by
- * its palette id (see base/color_scheme.html).
- * @return {Slice} slice.
- */
- endSlice: function(ts, opt_tts, opt_colorId) {
- if (!this.openSliceCount)
- throw new Error('endSlice called without an open slice');
-
- var slice = this.openPartialSlices_[this.openSliceCount - 1];
- this.openPartialSlices_.splice(this.openSliceCount - 1, 1);
- if (ts < slice.start)
- throw new Error('Slice ' + slice.title +
- ' end time is before its start.');
-
- slice.duration = ts - slice.start;
- slice.didNotFinish = false;
- slice.colorId = opt_colorId || slice.colorId;
-
- if (opt_tts && slice.cpuStart !== undefined)
- slice.cpuDuration = opt_tts - slice.cpuStart;
-
- return slice;
- },
-
- /**
- * Push a complete event as a Slice into the slice list.
- * The timestamp can be in any order.
- *
- * @param {String} category Category name of the slice to add.
- * @param {String} title Title of the slice to add.
- * @param {Number} ts The timetsamp of the slice, in milliseconds.
- * @param {Number} duration The duration of the slice, in milliseconds.
- * @param {Object.<string, Object>=} opt_args Arguments associated with
- * the slice.
- * @param {Number=} opt_colorId The color of the slice, as defined by
- * its palette id (see base/color_scheme.html).
- */
- pushCompleteSlice: function(category, title, ts, duration, tts,
- cpuDuration, opt_args, opt_argsStripped,
- opt_colorId, opt_bind_id) {
- var colorId = opt_colorId ||
- ColorScheme.getColorIdForGeneralPurposeString(title);
- var slice = new this.sliceConstructor(category, title, colorId, ts,
- opt_args ? opt_args : {},
- duration, tts, cpuDuration,
- opt_argsStripped, opt_bind_id);
- if (duration === undefined)
- slice.didNotFinish = true;
- this.pushSlice(slice);
- return slice;
- },
-
- /**
- * Closes any open slices.
- * @param {Number=} opt_maxTimestamp The end time to use for the closed
- * slices. If not provided,
- * the max timestamp for this slice is provided.
- */
- autoCloseOpenSlices: function() {
- this.updateBounds();
- var maxTimestamp = this.bounds.max;
- for (var sI = 0; sI < this.slices.length; sI++) {
- var slice = this.slices[sI];
- if (slice.didNotFinish)
- slice.duration = maxTimestamp - slice.start;
- }
- this.openPartialSlices_ = [];
- },
-
- /**
- * Shifts all the timestamps inside this group forward by the amount
- * specified.
- */
- shiftTimestampsForward: function(amount) {
- for (var sI = 0; sI < this.slices.length; sI++) {
- var slice = this.slices[sI];
- slice.start = (slice.start + amount);
- }
- },
-
- /**
- * Updates the bounds for this group based on the slices it contains.
- */
- updateBounds: function() {
- this.bounds.reset();
- for (var i = 0; i < this.slices.length; i++) {
- this.bounds.addValue(this.slices[i].start);
- this.bounds.addValue(this.slices[i].end);
- }
- },
-
- copySlice: function(slice) {
- var newSlice = new this.sliceConstructor(slice.category, slice.title,
- slice.colorId, slice.start,
- slice.args, slice.duration, slice.cpuStart, slice.cpuDuration);
- newSlice.didNotFinish = slice.didNotFinish;
- return newSlice;
- },
-
- findTopmostSlicesInThisContainer: function*(eventPredicate, opt_this) {
- if (!this.haveTopLevelSlicesBeenBuilt)
- throw new Error('Nope');
-
- for (var s of this.topLevelSlices)
- yield * s.findTopmostSlicesRelativeToThisSlice(eventPredicate);
- },
-
- childEvents: function*() {
- yield * this.slices;
- },
-
- childEventContainers: function*() {
- },
-
- getSlicesOfName: function(title) {
- var slices = [];
- for (var i = 0; i < this.slices.length; i++) {
- if (this.slices[i].title == title) {
- slices.push(this.slices[i]);
- }
- }
- return slices;
- },
-
- iterSlicesInTimeRange: function(callback, start, end) {
- var ret = [];
- tr.b.iterateOverIntersectingIntervals(
- this.topLevelSlices,
- function(s) { return s.start; },
- function(s) { return s.duration; },
- start,
- end,
- function(topLevelSlice) {
- callback(topLevelSlice);
- topLevelSlice.iterateAllDescendents(callback);
- });
- return ret;
- },
-
- findFirstSlice: function() {
- if (!this.haveTopLevelSlicesBeenBuilt)
- throw new Error('Nope');
- if (0 === this.slices.length)
- return undefined;
- return this.slices[0];
- },
-
- findSliceAtTs: function(ts) {
- if (!this.haveTopLevelSlicesBeenBuilt)
- throw new Error('Nope');
- var i = tr.b.findIndexInSortedClosedIntervals(
- this.topLevelSlices,
- getSliceLo, getSliceHi,
- ts);
- if (i == -1 || i == this.topLevelSlices.length)
- return undefined;
-
- var curSlice = this.topLevelSlices[i];
-
- // Now recurse on slice looking for subSlice of given ts.
- while (true) {
- var i = tr.b.findIndexInSortedClosedIntervals(
- curSlice.subSlices,
- getSliceLo, getSliceHi,
- ts);
- if (i == -1 || i == curSlice.subSlices.length)
- return curSlice;
- curSlice = curSlice.subSlices[i];
- }
- },
-
- findNextSliceAfter: function(ts, refGuid) {
- var i = tr.b.findLowIndexInSortedArray(
- this.slices, getSliceLo, ts);
- if (i === this.slices.length)
- return undefined;
- for (; i < this.slices.length; i++) {
- var slice = this.slices[i];
- if (slice.start > ts)
- return slice;
- if (slice.guid <= refGuid)
- continue;
- return slice;
- }
- return undefined;
- },
-
- /**
- * Construct subSlices for this group.
- * Populate the group topLevelSlices, parent slices get a subSlices[],
- * a selfThreadTime and a selfTime, child slices get a parentSlice
- * reference.
- */
- createSubSlices: function() {
- this.haveTopLevelSlicesBeenBuilt = true;
- this.createSubSlicesImpl_();
- if (this.parentContainer.timeSlices)
- this.addCpuTimeToSubslices_(this.parentContainer.timeSlices);
- this.slices.forEach(function(slice) {
- var selfTime = slice.duration;
- for (var i = 0; i < slice.subSlices.length; i++)
- selfTime -= slice.subSlices[i].duration;
- slice.selfTime = selfTime;
-
- if (slice.cpuDuration === undefined)
- return;
-
- var cpuSelfTime = slice.cpuDuration;
- for (var i = 0; i < slice.subSlices.length; i++) {
- if (slice.subSlices[i].cpuDuration !== undefined)
- cpuSelfTime -= slice.subSlices[i].cpuDuration;
- }
- slice.cpuSelfTime = cpuSelfTime;
- });
- },
- createSubSlicesImpl_: function() {
- var precisionUnit = this.model.intrinsicTimeUnit;
-
- function addSliceIfBounds(root, child) {
- // Because we know that the start time of child is >= the start time
- // of all other slices seen so far, we can just check the last slice
- // of each row for bounding.
- if (root.bounds(child, precisionUnit)) {
- if (root.subSlices && root.subSlices.length > 0) {
- if (addSliceIfBounds(root.subSlices[root.subSlices.length - 1],
- child))
- return true;
- }
- child.parentSlice = root;
- if (root.subSlices === undefined)
- root.subSlices = [];
- root.subSlices.push(child);
- return true;
- }
- return false;
- }
-
- if (!this.slices.length)
- return;
-
- var ops = [];
- for (var i = 0; i < this.slices.length; i++) {
- if (this.slices[i].subSlices)
- this.slices[i].subSlices.splice(0,
- this.slices[i].subSlices.length);
- ops.push(i);
- }
-
- var originalSlices = this.slices;
- ops.sort(function(ix, iy) {
- var x = originalSlices[ix];
- var y = originalSlices[iy];
- if (x.start != y.start)
- return x.start - y.start;
-
- // Elements get inserted into the slices array in order of when the
- // slices start. Because slices must be properly nested, we break
- // start-time ties by assuming that the elements appearing earlier
- // in the slices array (and thus ending earlier) start earlier.
- return ix - iy;
- });
-
- var slices = new Array(this.slices.length);
- for (var i = 0; i < ops.length; i++) {
- slices[i] = originalSlices[ops[i]];
- }
-
- // Actually build the subrows.
- var rootSlice = slices[0];
- this.topLevelSlices = [];
- this.topLevelSlices.push(rootSlice);
- rootSlice.isTopLevel = true;
- for (var i = 1; i < slices.length; i++) {
- var slice = slices[i];
- if (!addSliceIfBounds(rootSlice, slice)) {
- rootSlice = slice;
- rootSlice.isTopLevel = true;
- this.topLevelSlices.push(rootSlice);
- }
- }
-
- // Keep the slices in sorted form.
- this.slices = slices;
- },
- addCpuTimeToSubslices_: function(timeSlices) {
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var sliceIdx = 0;
- timeSlices.forEach(function(timeSlice) {
- if (timeSlice.schedulingState == SCHEDULING_STATE.RUNNING) {
- while (sliceIdx < this.topLevelSlices.length) {
- if (this.addCpuTimeToSubslice_(this.topLevelSlices[sliceIdx],
- timeSlice)) {
- // The current top-level slice and children are fully
- // accounted for, proceed to next top-level slice.
- sliceIdx++;
- } else {
- // The current top-level runs beyond the time slice, break out
- // so we can potentially add more time slices to it
- break;
- }
- }
- }
- }, this);
- },
- /* Add run-time of this timeSlice to the passed in slice
- * and all of it's children (recursively).
- * Returns whether the slice ends before or at the end of the
- * time slice, signaling we are done with this slice.
- */
- addCpuTimeToSubslice_: function(slice, timeSlice) {
- // Make sure they overlap
- if (slice.start > timeSlice.end || slice.end < timeSlice.start)
- return slice.end <= timeSlice.end;
-
- // Compute actual overlap
- var duration = timeSlice.duration;
- if (slice.start > timeSlice.start)
- duration -= slice.start - timeSlice.start;
- if (timeSlice.end > slice.end)
- duration -= timeSlice.end - slice.end;
-
- if (slice.cpuDuration) {
- slice.cpuDuration += duration;
- } else {
- slice.cpuDuration = duration;
- }
-
- for (var i = 0; i < slice.subSlices.length; i++) {
- this.addCpuTimeToSubslice_(slice.subSlices[i], timeSlice);
- }
-
- return slice.end <= timeSlice.end;
- }
- };
-
- /**
- * Merge two slice groups.
- *
- * If the two groups do not nest properly some of the slices of groupB will
- * be split to accomodate the improper nesting. This is done to accomodate
- * combined kernel and userland call stacks on Android. Because userland
- * tracing is done by writing to the trace_marker file, the kernel calls
- * that get invoked as part of that write may not be properly nested with
- * the userland call trace. For example the following sequence may occur:
- *
- * kernel enter sys_write (the write to trace_marker)
- * user enter some_function
- * kernel exit sys_write
- * ...
- * kernel enter sys_write (the write to trace_marker)
- * user exit some_function
- * kernel exit sys_write
- *
- * This is handled by splitting the sys_write call into two slices as
- * follows:
- *
- * | sys_write | some_function | sys_write (cont.) |
- * | sys_write (cont.) | | sys_write |
- *
- * The colorId of both parts of the split slices are kept the same, and the
- * " (cont.)" suffix is appended to the later parts of a split slice.
- *
- * The two input SliceGroups are not modified by this, and the merged
- * SliceGroup will contain a copy of each of the input groups' slices (those
- * copies may be split).
- */
- SliceGroup.merge = function(groupA, groupB) {
- // This is implemented by traversing the two slice groups in reverse
- // order. The slices in each group are sorted by ascending end-time, so
- // we must do the traversal from back to front in order to maintain the
- // sorting.
- //
- // We traverse the two groups simultaneously, merging as we go. At each
- // iteration we choose the group from which to take the next slice based
- // on which group's next slice has the greater end-time. During this
- // traversal we maintain a stack of currently "open" slices for each input
- // group. A slice is considered "open" from the time it gets reached in
- // our input group traversal to the time we reach an slice in this
- // traversal with an end-time before the start time of the "open" slice.
- //
- // Each time a slice from groupA is opened or closed (events corresponding
- // to the end-time and start-time of the input slice, respectively) we
- // split all of the currently open slices from groupB.
-
- if (groupA.openPartialSlices_.length > 0)
- throw new Error('groupA has open partial slices');
-
- if (groupB.openPartialSlices_.length > 0)
- throw new Error('groupB has open partial slices');
-
- if (groupA.parentContainer != groupB.parentContainer)
- throw new Error('Different parent threads. Cannot merge');
-
- if (groupA.sliceConstructor != groupB.sliceConstructor)
- throw new Error('Different slice constructors. Cannot merge');
-
- var result = new SliceGroup(groupA.parentContainer,
- groupA.sliceConstructor,
- groupA.name_);
-
- var slicesA = groupA.slices;
- var slicesB = groupB.slices;
- var idxA = 0;
- var idxB = 0;
- var openA = [];
- var openB = [];
-
- var splitOpenSlices = function(when) {
- for (var i = 0; i < openB.length; i++) {
- var oldSlice = openB[i];
- var oldEnd = oldSlice.end;
- if (when < oldSlice.start || oldEnd < when) {
- throw new Error('slice should not be split');
- }
-
- var newSlice = result.copySlice(oldSlice);
- newSlice.start = when;
- newSlice.duration = oldEnd - when;
- if (newSlice.title.indexOf(' (cont.)') == -1)
- newSlice.title += ' (cont.)';
- oldSlice.duration = when - oldSlice.start;
- openB[i] = newSlice;
- result.pushSlice(newSlice);
- }
- };
-
- var closeOpenSlices = function(upTo) {
- while (openA.length > 0 || openB.length > 0) {
- var nextA = openA[openA.length - 1];
- var nextB = openB[openB.length - 1];
- var endA = nextA && nextA.end;
- var endB = nextB && nextB.end;
-
- if ((endA === undefined || endA > upTo) &&
- (endB === undefined || endB > upTo)) {
- return;
- }
-
- if (endB === undefined || endA < endB) {
- splitOpenSlices(endA);
- openA.pop();
- } else {
- openB.pop();
- }
- }
- };
-
- while (idxA < slicesA.length || idxB < slicesB.length) {
- var sA = slicesA[idxA];
- var sB = slicesB[idxB];
- var nextSlice, isFromB;
-
- if (sA === undefined || (sB !== undefined && sA.start > sB.start)) {
- nextSlice = result.copySlice(sB);
- isFromB = true;
- idxB++;
- } else {
- nextSlice = result.copySlice(sA);
- isFromB = false;
- idxA++;
- }
-
- closeOpenSlices(nextSlice.start);
-
- result.pushSlice(nextSlice);
-
- if (isFromB) {
- openB.push(nextSlice);
- } else {
- splitOpenSlices(nextSlice.start);
- openA.push(nextSlice);
- }
- }
-
- closeOpenSlices();
-
- return result;
- };
-
- return {
- SliceGroup: SliceGroup
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/slice_group_test.html b/chromium/third_party/catapult/tracing/tracing/model/slice_group_test.html
deleted file mode 100644
index 8ae66bc41d1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/slice_group_test.html
+++ /dev/null
@@ -1,881 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/slice_group.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Slice = tr.model.Slice;
- var SliceGroup = tr.model.SliceGroup;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
- var newThreadSlice = tr.c.TestUtils.newThreadSlice;
- var newModel = tr.c.TestUtils.newModel;
- var newFakeThread = tr.c.TestUtils.newFakeThread;
-
- test('basicBeginEnd', function() {
- var group = new SliceGroup(newFakeThread());
- assert.equal(group.openSliceCount, 0);
- var sliceA = group.beginSlice('', 'a', 1, {a: 1});
- assert.equal(group.openSliceCount, 1);
- assert.equal(sliceA.title, 'a');
- assert.equal(sliceA.start, 1);
- assert.equal(sliceA.args.a, 1);
-
- var sliceB = group.endSlice(3);
- assert.equal(sliceA, sliceB);
- assert.equal(sliceB.duration, 2);
- });
-
- test('subSlicesBuilderBasic', function() {
- var group = new SliceGroup(newFakeThread());
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 2}));
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 3, duration: 1}));
-
- group.createSubSlices();
-
- assert.equal(group.topLevelSlices.length, 2);
- assert.deepEqual(group.topLevelSlices, [sA, sB]);
- assert.equal(group.findSliceAtTs(0), undefined);
- assert.equal(group.findSliceAtTs(1), sA);
- assert.equal(group.findSliceAtTs(3), sA);
- assert.equal(group.findSliceAtTs(3.1), sB);
- assert.equal(group.findSliceAtTs(4), sB);
- assert.equal(group.findSliceAtTs(5), undefined);
- });
-
- test('subSlicesBuilderBasic2', function() {
- var group = new SliceGroup(newFakeThread());
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 4}));
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 3, duration: 1}));
-
- group.createSubSlices();
-
- assert.equal(group.topLevelSlices.length, 1);
- assert.deepEqual(group.topLevelSlices, [sA]);
-
- assert.equal(sA.subSlices.length, 1);
- assert.deepEqual(sA.subSlices, [sB]);
- assert.equal(sA.selfTime, 3);
-
- assert.equal(sA, sB.parentSlice);
- assert.isTrue(sA.isTopLevel);
- assert.isFalse(sB.isTopLevel);
- });
-
- test('subSlicesBuilderNestedExactly', function() {
- var group = new SliceGroup(newFakeThread());
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 1, duration: 4}));
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 4}));
-
- group.createSubSlices();
-
- assert.equal(group.topLevelSlices.length, 1);
- assert.deepEqual(group.topLevelSlices, [sB]);
-
- assert.equal(sB.subSlices.length, 1);
- assert.deepEqual(sB.subSlices, [sA]);
- assert.equal(sB.selfTime, 0);
-
- assert.equal(sB, sA.parentSlice);
- assert.isTrue(sB.isTopLevel);
- assert.isFalse(sA.isTopLevel);
-
- assert.equal(group.findSliceAtTs(0), undefined);
- assert.equal(group.findSliceAtTs(1), sA);
- assert.equal(group.findSliceAtTs(2), sA);
- assert.equal(group.findSliceAtTs(5), sA);
- assert.equal(group.findSliceAtTs(6), undefined);
- });
-
- test('subSlicesBuilderInstantEvents', function() {
- var group = new SliceGroup(newFakeThread());
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 0}));
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 2, duration: 0}));
-
- group.createSubSlices();
-
- assert.equal(group.topLevelSlices.length, 2);
- assert.deepEqual(group.topLevelSlices, [sA, sB]);
- assert.equal(group.findSliceAtTs(1), sA);
- assert.equal(group.findSliceAtTs(1.5), undefined);
- assert.equal(group.findSliceAtTs(2), sB);
- });
-
- test('subSlicesBuilderTwoInstantEvents', function() {
- var group = new SliceGroup(newFakeThread());
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 0}));
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 1, duration: 0}));
-
- group.createSubSlices();
-
- assert.equal(group.topLevelSlices.length, 1);
- assert.deepEqual(group.topLevelSlices, [sA]);
-
- assert.equal(sA.subSlices.length, 1);
- assert.deepEqual(sA.subSlices, [sB]);
- assert.equal(sA.selfTime, 0);
-
- assert.equal(sA, sB.parentSlice);
- assert.isTrue(sA.isTopLevel);
- assert.isFalse(sB.isTopLevel);
- assert.equal(group.findSliceAtTs(1), sB);
- assert.equal(group.findSliceAtTs(1.0001), undefined);
- });
-
- test('subSlicesBuilderOutOfOrderAddition', function() {
- var group = new SliceGroup(newFakeThread());
-
- // Pattern being tested:
- // [ a ][ b ]
- // Where insertion is done backward.
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 3, duration: 1}));
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 2}));
-
- group.createSubSlices();
-
- assert.equal(group.topLevelSlices.length, 2);
- assert.deepEqual(group.topLevelSlices, [sA, sB]);
- assert.equal(group.findSliceAtTs(3), sA);
- });
-
- test('subRowBuilderOutOfOrderAddition2', function() {
- var group = new SliceGroup(newFakeThread());
-
- // Pattern being tested:
- // [ a ]
- // [ b ]
- // Where insertion is done backward.
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 3, duration: 1}));
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 5}));
-
- group.createSubSlices();
-
- assert.equal(group.topLevelSlices.length, 1);
- assert.deepEqual(group.topLevelSlices, [sA]);
-
- assert.equal(sA.subSlices.length, 1);
- assert.deepEqual(sA.subSlices, [sB]);
- assert.equal(sA.selfTime, 4);
-
- assert.equal(sA, sB.parentSlice);
- assert.isTrue(sA.isTopLevel);
- assert.isFalse(sB.isTopLevel);
- assert.equal(group.findSliceAtTs(1.5), sA);
- assert.equal(group.findSliceAtTs(3), sB);
- assert.equal(group.findSliceAtTs(3.5), sB);
- assert.equal(group.findSliceAtTs(4), sB);
- assert.equal(group.findSliceAtTs(4.5), sA);
- });
-
- test('subSlicesBuilderOnNestedZeroLength', function() {
- var group = new SliceGroup(newFakeThread());
-
- // Pattern being tested:
- // [ a ]
- // [ b1 ] []<- b2 where b2.duration = 0 and b2.end == a.end.
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 3}));
- var sB1 = group.pushSlice(newSliceEx({title: 'b1', start: 1, duration: 2}));
- var sB2 = group.pushSlice(newSliceEx({title: 'b2', start: 4, duration: 0}));
-
- group.createSubSlices();
-
- assert.equal(group.topLevelSlices.length, 1);
- assert.deepEqual(group.topLevelSlices, [sA]);
-
- assert.equal(sA.subSlices.length, 2);
- assert.deepEqual(sA.subSlices, [sB1, sB2]);
- assert.equal(sA.selfTime, 1);
-
- assert.equal(sA, sB1.parentSlice);
- assert.equal(sA, sB2.parentSlice);
- assert.equal(group.findSliceAtTs(1), sB1);
- assert.equal(group.findSliceAtTs(4), sB2);
- });
-
- test('subSlicesBuilderOnGroup1', function() {
- var group = new SliceGroup(newFakeThread());
-
- // Pattern being tested:
- // [ a ] [ c ]
- // [ b ]
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 3}));
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 1.5, duration: 1}));
- var sC = group.pushSlice(newSliceEx({title: 'c', start: 5, duration: 0}));
-
- group.createSubSlices();
-
- assert.equal(group.topLevelSlices.length, 2);
- assert.deepEqual(group.topLevelSlices, [sA, sC]);
-
- assert.equal(sA.subSlices.length, 1);
- assert.deepEqual(sA.subSlices, [sB]);
- assert.equal(sA.selfTime, 2);
-
- assert.equal(sA, sB.parentSlice);
- assert.equal(group.findSliceAtTs(1), sA);
- assert.equal(group.findSliceAtTs(2), sB);
- assert.equal(group.findSliceAtTs(3), sA);
- assert.equal(group.findSliceAtTs(4.5), undefined);
- assert.equal(group.findSliceAtTs(5), sC);
- });
-
- test('subSlicesBuilderOnGroup2', function() {
- var group = new SliceGroup(newFakeThread());
-
- // Pattern being tested:
- // [ a ] [ d ]
- // [ b ]
- // [ c ]
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 3}));
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 1.5, duration: 1}));
- var sC = group.pushSlice(newSliceEx(
- {title: 'c', start: 1.75, duration: 0.5}));
- var sD = group.pushSlice(newSliceEx(
- {title: 'd', start: 5, duration: 0.25}));
-
- group.createSubSlices();
-
- assert.equal(group.topLevelSlices.length, 2);
- assert.deepEqual(group.topLevelSlices, [sA, sD]);
-
- assert.equal(sA.subSlices.length, 1);
- assert.deepEqual(sA.subSlices, [sB]);
- assert.equal(sA.selfTime, 2);
-
- assert.equal(sA, sB.parentSlice);
- assert.equal(sB.subSlices.length, 1);
- assert.deepEqual(sB.subSlices, [sC]);
- assert.equal(sB.selfTime, 0.5);
-
- assert.equal(sB, sC.parentSlice);
- assert.equal(group.findSliceAtTs(2), sC);
- });
-
- test('findFirstSlice', function() {
- var group = new SliceGroup(newFakeThread());
- // Pattern being tested:
- // [ a ] [ d ]
- // [b] [ c ] where b is dur=0
- var sC = group.pushSlice(newSliceEx({title: 'c', start: 2, end: 3}));
- var sD = group.pushSlice(newSliceEx({title: 'd', start: 5, end: 6}));
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, end: 4}));
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 1, end: 1}));
-
- assert.throws(group.findFirstSlice);
-
- group.createSubSlices();
-
- assert.equal(group.findFirstSlice(), sA);
- });
-
- test('findNextSliceAfterBasic', function() {
- var group = new SliceGroup(newFakeThread());
- // Pattern being tested:
- // [ a ] [ d ]
- // [b] [ c ] where b is dur=0
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, end: 4}));
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 1, end: 1}));
- var sC = group.pushSlice(newSliceEx({title: 'c', start: 2, end: 3}));
- var sD = group.pushSlice(newSliceEx({title: 'd', start: 5, end: 6}));
-
- group.createSubSlices();
-
- assert.equal(group.findNextSliceAfter(0, 0), sA);
- assert.equal(group.findNextSliceAfter(1, sA.guid), sB);
- assert.equal(group.findNextSliceAfter(1, sB.guid), sC);
- assert.equal(group.findNextSliceAfter(2, sC.guid), sD);
- assert.equal(group.findNextSliceAfter(6, 0), undefined);
- });
-
- test('subSlicesBuilderTolerateFPInaccuracy', function() {
- var group = new SliceGroup(newFakeThread());
-
- // Pattern being tested:
- // [ a ]
- // [ b ] where b.end contains a tiny FP calculation error.
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 3}));
- var sB = group.pushSlice(newSliceEx(
- {title: 'b', start: 1, duration: 3.0000000001}));
-
- group.createSubSlices();
-
- assert.equal(group.topLevelSlices.length, 1);
- assert.deepEqual(group.topLevelSlices, [sA]);
-
- assert.equal(sA.subSlices.length, 1);
- assert.deepEqual(sA.subSlices, [sB]);
- assert.equal(sA, sB.parentSlice);
- assert.equal(group.findSliceAtTs(1), sB);
- assert.equal(group.findSliceAtTs(3), sB);
- });
-
- test('basicMerge', function() {
- function TestSlice(
- cat, title, colorId, start, args, opt_duration,
- opt_cpuStart, opt_cpuDuration) {
- Slice.call(this, cat, title, colorId, start, args, opt_duration,
- opt_cpuStart, opt_cpuDuration);
- }
- TestSlice.prototype = {
- __proto__: Slice.prototype
- };
-
- var thread = newFakeThread();
- var a = new SliceGroup(thread, TestSlice);
- var b = new SliceGroup(thread, TestSlice);
- a.beginSlice('', 'one', 1);
- a.endSlice(2);
- b.beginSlice('', 'two', 3);
- b.endSlice(5);
-
- var m = SliceGroup.merge(a, b);
- assert.equal(m.slices.length, 2);
-
- assert.equal(m.slices[0].title, 'one');
- assert.equal(m.slices[0].start, 1);
- assert.equal(m.slices[0].duration, 1);
-
- assert.equal(m.slices[1].title, 'two');
- assert.equal(m.slices[1].start, 3);
- assert.equal(m.slices[1].duration, 2);
-
- // ensure constructor merged correctly
- assert.equal(m.sliceConstructor, TestSlice);
- });
-
- test('nestedMerge', function() {
- var thread = newFakeThread();
- var a = new SliceGroup(thread);
- var b = new SliceGroup(thread);
- a.beginSlice('', 'one', 1);
- a.endSlice(4);
- b.beginSlice('', 'two', 2);
- b.endSlice(3);
-
- var m = SliceGroup.merge(a, b);
- assert.equal(m.slices.length, 2);
-
- assert.equal(m.slices[0].title, 'one');
- assert.equal(m.slices[0].start, 1);
- assert.equal(m.slices[0].duration, 3);
-
- assert.equal(m.slices[1].title, 'two');
- assert.equal(m.slices[1].start, 2);
- assert.equal(m.slices[1].duration, 1);
- });
-
- test('startSplitMerge', function() {
- var thread = newFakeThread();
- var a = new SliceGroup(thread);
- var b = new SliceGroup(thread);
- a.beginSlice('', 'one', 2);
- a.endSlice(4);
- b.beginSlice('', 'two', 1);
- b.endSlice(3);
-
- var m = SliceGroup.merge(a, b);
- assert.equal(m.slices.length, 3);
-
- assert.equal(m.slices[0].title, 'two');
- assert.equal(m.slices[0].start, 1);
- assert.equal(m.slices[0].duration, 1);
-
- assert.equal(m.slices[1].title, 'one');
- assert.equal(m.slices[1].start, 2);
- assert.equal(m.slices[1].duration, 2);
-
- assert.equal(m.slices[2].title, 'two (cont.)');
- assert.equal(m.slices[2].start, 2);
- assert.equal(m.slices[2].duration, 1);
- });
-
- test('startSplitTwoMerge', function() {
- var thread = newFakeThread();
- var a = new SliceGroup(thread);
- var b = new SliceGroup(thread);
- a.beginSlice('', 'one', 3);
- a.endSlice(6);
- b.beginSlice('', 'two', 1);
- b.beginSlice('', 'three', 2);
- b.endSlice(4);
- b.endSlice(5);
-
- var m = SliceGroup.merge(a, b);
- assert.equal(m.slices.length, 5);
-
- assert.equal(m.slices[0].title, 'two');
- assert.equal(m.slices[0].start, 1);
- assert.equal(m.slices[0].duration, 2);
-
- assert.equal(m.slices[1].title, 'three');
- assert.equal(m.slices[1].start, 2);
- assert.equal(m.slices[1].duration, 1);
-
- assert.equal(m.slices[2].title, 'one');
- assert.equal(m.slices[2].start, 3);
- assert.equal(m.slices[2].duration, 3);
-
- assert.equal(m.slices[3].title, 'two (cont.)');
- assert.equal(m.slices[3].start, 3);
- assert.equal(m.slices[3].duration, 2);
-
- assert.equal(m.slices[4].title, 'three (cont.)');
- assert.equal(m.slices[4].start, 3);
- assert.equal(m.slices[4].duration, 1);
- });
-
- test('startSplitTwiceMerge', function() {
- var thread = newFakeThread();
- var a = new SliceGroup(thread);
- var b = new SliceGroup(thread);
- a.beginSlice('', 'one', 2);
- a.beginSlice('', 'two', 3);
- a.endSlice(5);
- a.endSlice(6);
- b.beginSlice('', 'three', 1);
- b.endSlice(4);
-
- var m = SliceGroup.merge(a, b);
- assert.equal(m.slices.length, 5);
-
- assert.equal(m.slices[0].title, 'three');
- assert.equal(m.slices[0].start, 1);
- assert.equal(m.slices[0].duration, 1);
-
- assert.equal(m.slices[1].title, 'one');
- assert.equal(m.slices[1].start, 2);
- assert.equal(m.slices[1].duration, 4);
-
- assert.equal(m.slices[2].title, 'three (cont.)');
- assert.equal(m.slices[2].start, 2);
- assert.equal(m.slices[2].duration, 1);
-
- assert.equal(m.slices[3].title, 'two');
- assert.equal(m.slices[3].start, 3);
- assert.equal(m.slices[3].duration, 2);
-
- assert.equal(m.slices[4].title, 'three (cont.)');
- assert.equal(m.slices[4].start, 3);
- assert.equal(m.slices[4].duration, 1);
- });
-
- test('endSplitMerge', function() {
- var thread = newFakeThread();
- var a = new SliceGroup(thread);
- var b = new SliceGroup(thread);
- a.beginSlice('', 'one', 1);
- a.endSlice(3);
- b.beginSlice('', 'two', 2);
- b.endSlice(4);
-
- var m = SliceGroup.merge(a, b);
- assert.equal(m.slices.length, 3);
-
- assert.equal(m.slices[0].title, 'one');
- assert.equal(m.slices[0].start, 1);
- assert.equal(m.slices[0].duration, 2);
-
- assert.equal(m.slices[1].title, 'two');
- assert.equal(m.slices[1].start, 2);
- assert.equal(m.slices[1].duration, 1);
-
- assert.equal(m.slices[2].title, 'two (cont.)');
- assert.equal(m.slices[2].start, 3);
- assert.equal(m.slices[2].duration, 1);
- });
-
- test('endSplitTwoMerge', function() {
- var thread = newFakeThread();
- var a = new SliceGroup(thread);
- var b = new SliceGroup(thread);
- a.beginSlice('', 'one', 1);
- a.endSlice(4);
- b.beginSlice('', 'two', 2);
- b.beginSlice('', 'three', 3);
- b.endSlice(5);
- b.endSlice(6);
-
- var m = SliceGroup.merge(a, b);
- assert.equal(m.slices.length, 5);
-
- assert.equal(m.slices[0].title, 'one');
- assert.equal(m.slices[0].start, 1);
- assert.equal(m.slices[0].duration, 3);
-
- assert.equal(m.slices[1].title, 'two');
- assert.equal(m.slices[1].start, 2);
- assert.equal(m.slices[1].duration, 2);
-
- assert.equal(m.slices[2].title, 'three');
- assert.equal(m.slices[2].start, 3);
- assert.equal(m.slices[2].duration, 1);
-
- assert.equal(m.slices[3].title, 'two (cont.)');
- assert.equal(m.slices[3].start, 4);
- assert.equal(m.slices[3].duration, 2);
-
- assert.equal(m.slices[4].title, 'three (cont.)');
- assert.equal(m.slices[4].start, 4);
- assert.equal(m.slices[4].duration, 1);
- });
-
- test('endSplitTwiceMerge', function() {
- var thread = newFakeThread();
- var a = new SliceGroup(thread);
- var b = new SliceGroup(thread);
- a.beginSlice('', 'one', 1);
- a.beginSlice('', 'two', 2);
- a.endSlice(4);
- a.endSlice(5);
- b.beginSlice('', 'three', 3);
- b.endSlice(6);
-
- var m = SliceGroup.merge(a, b);
- assert.equal(m.slices.length, 5);
-
- assert.equal(m.slices[0].title, 'one');
- assert.equal(m.slices[0].start, 1);
- assert.equal(m.slices[0].duration, 4);
-
- assert.equal(m.slices[1].title, 'two');
- assert.equal(m.slices[1].start, 2);
- assert.equal(m.slices[1].duration, 2);
-
- assert.equal(m.slices[2].title, 'three');
- assert.equal(m.slices[2].start, 3);
- assert.equal(m.slices[2].duration, 1);
-
- assert.equal(m.slices[3].title, 'three (cont.)');
- assert.equal(m.slices[3].start, 4);
- assert.equal(m.slices[3].duration, 1);
-
- assert.equal(m.slices[4].title, 'three (cont.)');
- assert.equal(m.slices[4].start, 5);
- assert.equal(m.slices[4].duration, 1);
- });
-
- // Input:
- // A: | one | | two |
- //
- // B: | three |
- //
- // Output:
- // | one | three | two |
- // | three | | three |
- test('splitTwiceMerge', function() {
- var thread = newFakeThread();
- var a = new SliceGroup(thread);
- var b = new SliceGroup(thread);
- a.beginSlice('', 'one', 1);
- a.endSlice(3);
- a.beginSlice('', 'two', 4);
- a.endSlice(6);
- b.beginSlice('', 'three', 2);
- b.endSlice(5);
-
- var m = SliceGroup.merge(a, b);
- assert.equal(m.slices.length, 5);
-
- assert.equal(m.slices[0].title, 'one');
- assert.equal(m.slices[0].start, 1);
- assert.equal(m.slices[0].duration, 2);
-
- assert.equal(m.slices[1].title, 'three');
- assert.equal(m.slices[1].start, 2);
- assert.equal(m.slices[1].duration, 1);
-
- assert.equal(m.slices[2].title, 'three (cont.)');
- assert.equal(m.slices[2].start, 3);
- assert.equal(m.slices[2].duration, 1);
-
- assert.equal(m.slices[3].title, 'two');
- assert.equal(m.slices[3].start, 4);
- assert.equal(m.slices[3].duration, 2);
-
- assert.equal(m.slices[4].title, 'three (cont.)');
- assert.equal(m.slices[4].start, 4);
- assert.equal(m.slices[4].duration, 1);
- });
-
- test('bounds', function() {
- var group = new SliceGroup(newFakeThread());
- group.updateBounds();
- assert.isUndefined(group.bounds.min);
- assert.isUndefined(group.bounds.max);
-
- group.pushSlice(newSliceEx({start: 1, duration: 3}));
- group.pushSlice(newSliceEx({start: 7, duration: 2}));
- group.updateBounds();
- assert.equal(group.bounds.min, 1);
- assert.equal(group.bounds.max, 9);
- });
-
- test('boundsWithPartial', function() {
- var group = new SliceGroup(newFakeThread());
- group.beginSlice('', 'a', 7);
- group.updateBounds();
- assert.equal(group.bounds.min, 7);
- assert.equal(group.bounds.max, 7);
- });
-
- test('boundsWithTwoPartials', function() {
- var group = new SliceGroup(newFakeThread());
- group.beginSlice('', 'a', 0);
- group.beginSlice('', 'a', 1);
- group.updateBounds();
- assert.equal(group.bounds.min, 0);
- assert.equal(group.bounds.max, 1);
- });
-
- test('boundsWithBothPartialAndRegular', function() {
- var group = new SliceGroup(newFakeThread());
- group.updateBounds();
- assert.isUndefined(group.bounds.min);
- assert.isUndefined(group.bounds.max);
-
- group.pushSlice(newSliceEx({start: 1, duration: 3}));
- group.beginSlice('', 'a', 7);
- group.updateBounds();
- assert.equal(group.bounds.min, 1);
- assert.equal(group.bounds.max, 7);
- });
-
- test('autocloserBasic', function() {
- var group = new SliceGroup(newFakeThread());
- assert.equal(0, group.openSliceCount);
-
- group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 0.5}));
-
- group.beginSlice('', 'b', 2);
- group.beginSlice('', 'c', 2.5);
- group.endSlice(3);
-
- group.autoCloseOpenSlices();
- group.updateBounds();
-
- assert.equal(group.bounds.min, 1);
- assert.equal(group.bounds.max, 3);
- assert.equal(group.slices.length, 3);
-
- assert.equal(group.slices[0].title, 'a');
- assert.isFalse(group.slices[0].didNotFinish);
-
- assert.equal(group.slices[1].title, 'b');
- assert.isTrue(group.slices[1].didNotFinish);
- assert.equal(group.slices[1].duration, 1);
-
- assert.equal(group.slices[2].title, 'c');
- assert.isFalse(group.slices[2].didNotFinish);
- });
-
- test('autocloserWithSubTasks', function() {
- var group = new SliceGroup(newFakeThread());
- assert.equal(0, group.openSliceCount);
-
- group.beginSlice('', 'a', 1);
- group.beginSlice('', 'b1', 2);
- group.endSlice(3);
- group.beginSlice('', 'b2', 3);
-
- group.autoCloseOpenSlices();
- assert.equal(group.slices.length, 3);
-
- assert.equal(group.slices[0].title, 'a');
- assert.isTrue(group.slices[0].didNotFinish);
- assert.equal(group.slices[0].duration, 2);
-
- assert.equal(group.slices[1].title, 'b1');
- assert.isFalse(group.slices[1].didNotFinish);
- assert.equal(group.slices[1].duration, 1);
-
- assert.equal(group.slices[2].title, 'b2');
- assert.isTrue(group.slices[2].didNotFinish);
- assert.equal(group.slices[2].duration, 0);
- });
-
- test('autocloseCompleteSlice', function() {
- var group = new SliceGroup(newFakeThread());
-
- group.pushCompleteSlice('', 'a', 1, undefined);
- group.pushCompleteSlice('', 'b', 2, 3);
-
- group.autoCloseOpenSlices();
- assert.equal(group.slices.length, 2);
-
- assert.equal(group.slices[0].title, 'a');
- assert.isTrue(group.slices[0].didNotFinish);
- assert.equal(group.slices[0].duration, 4);
-
- assert.equal(group.slices[1].title, 'b');
- assert.isFalse(group.slices[1].didNotFinish);
- assert.equal(group.slices[1].duration, 3);
- });
-
- test('sliceGroupStableId', function() {
- var model = new tr.Model();
- var process = model.getOrCreateProcess(123);
- var thread = process.getOrCreateThread(456);
- var group = new SliceGroup(thread);
-
- assert.equal(process.stableId, 123);
- assert.equal(thread.stableId, '123.456');
- assert.equal(group.stableId, '123.456.SliceGroup');
- });
-
- test('getSlicesOfName', function() {
- var group = new SliceGroup(newFakeThread());
- var expected = [];
-
- for (var i = 0; i < 10; i++) {
- var aSlice = newSliceEx({title: 'a', start: i, duration: i + 1});
- group.pushSlice(aSlice);
- group.pushSlice(newSliceEx({title: 'b', start: i + 1, duration: i + 2}));
- expected.push(aSlice);
- }
-
- assert.deepEqual(group.getSlicesOfName('a'), expected);
- });
-
- test('iterSlicesInTimeRange', function() {
- var group = new SliceGroup(newFakeThread());
- var expected = [];
-
- for (var i = 0; i < 10; i++) {
- var slice = newSliceEx({title: 'a', start: i, duration: 1});
- group.pushSlice(slice);
- if (4 <= i && i <= 7)
- expected.push(slice);
- }
- group.createSubSlices();
-
- var observed = [];
- group.iterSlicesInTimeRange(function(slice) { observed.push(slice); },
- 4.5, 7.5);
- assert.deepEqual(observed, expected);
- });
-
- test('computeCpuDurationNoOverlap', function() {
- var model = new tr.Model();
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var process = model.getOrCreateProcess(123);
- var t = process.getOrCreateThread(456);
- t.timeSlices = [newThreadSlice(t, SCHEDULING_STATE.RUNNING, 20, 20),
- newThreadSlice(t, SCHEDULING_STATE.SLEEPING, 40, 10),
- newThreadSlice(t, SCHEDULING_STATE.RUNNING, 50, 10)];
- var group = new SliceGroup(t);
- group.pushSlice(newSliceEx({title: 'draw', start: 0, duration: 20}));
- group.pushSlice(newSliceEx({title: 'render', start: 60, duration: 20}));
- group.createSubSlices();
- assert.equal(group.slices[0].cpuDuration, 0);
- assert.equal(group.slices[1].cpuDuration, 0);
- });
-
- test('computeCpuDurationPartialOverlap', function() {
- var model = new tr.Model();
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var process = model.getOrCreateProcess(123);
- var t = process.getOrCreateThread(456);
- t.timeSlices = [newThreadSlice(t, SCHEDULING_STATE.RUNNING, 20, 20),
- newThreadSlice(t, SCHEDULING_STATE.SLEEPING, 40, 10),
- newThreadSlice(t, SCHEDULING_STATE.RUNNING, 50, 10)];
- var group = new SliceGroup(t);
- group.pushSlice(newSliceEx({title: 'draw', start: 10, duration: 30}));
- group.pushSlice(newSliceEx({title: 'render', start: 50, duration: 20}));
- group.createSubSlices();
- assert.equal(group.slices[0].cpuDuration, 20);
- assert.equal(group.slices[1].cpuDuration, 10);
- });
-
- test('computeCpuDurationFullOverlap', function() {
- var model = new tr.Model();
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var process = model.getOrCreateProcess(123);
- var t = process.getOrCreateThread(456);
- t.timeSlices = [newThreadSlice(t, SCHEDULING_STATE.RUNNING, 20, 20),
- newThreadSlice(t, SCHEDULING_STATE.SLEEPING, 40, 10),
- newThreadSlice(t, SCHEDULING_STATE.RUNNING, 50, 20)];
- var group = new SliceGroup(t);
- group.pushSlice(newSliceEx({title: 'draw', start: 20, duration: 30}));
- group.pushSlice(newSliceEx({title: 'render', start: 50, duration: 20}));
- group.createSubSlices();
- assert.equal(group.slices[0].cpuDuration, 20);
- assert.equal(group.slices[1].cpuDuration, 20);
- });
-
- test('computeCpuSelfDurationWithSubslices', function() {
- var model = new tr.Model();
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var process = model.getOrCreateProcess(123);
- var t = process.getOrCreateThread(456);
- t.timeSlices = [newThreadSlice(t, SCHEDULING_STATE.RUNNING, 20, 20),
- newThreadSlice(t, SCHEDULING_STATE.SLEEPING, 40, 10),
- newThreadSlice(t, SCHEDULING_STATE.RUNNING, 50, 20)];
- var group = new SliceGroup(t);
- group.pushSlice(newSliceEx({title: 'draw', start: 20, duration: 30}));
- group.pushSlice(newSliceEx({title: 'render', start: 21, duration: 8}));
- group.pushSlice(newSliceEx({title: 'flush', start: 29, duration: 11}));
- group.createSubSlices();
- assert.equal(group.slices[0].cpuDuration, 20);
- assert.equal(group.slices[0].cpuSelfTime, 1);
- assert.equal(group.slices[1].cpuDuration, 8);
- assert.equal(group.slices[1].cpuSelfTime, 8);
- assert.equal(group.slices[2].cpuDuration, 11);
- assert.equal(group.slices[2].cpuSelfTime, 11);
- });
-
- test('computeCpuDurationSmallTimeslices', function() {
- var model = new tr.Model();
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var process = model.getOrCreateProcess(123);
- var t = process.getOrCreateThread(456);
- t.timeSlices = [newThreadSlice(t, SCHEDULING_STATE.RUNNING, 20, 1),
- newThreadSlice(t, SCHEDULING_STATE.SLEEPING, 21, 1),
- newThreadSlice(t, SCHEDULING_STATE.RUNNING, 22, 1),
- newThreadSlice(t, SCHEDULING_STATE.SLEEPING, 23, 1),
- newThreadSlice(t, SCHEDULING_STATE.RUNNING, 24, 1),
- newThreadSlice(t, SCHEDULING_STATE.SLEEPING, 25, 1),
- newThreadSlice(t, SCHEDULING_STATE.RUNNING, 26, 1),
- newThreadSlice(t, SCHEDULING_STATE.SLEEPING, 27, 1),
- newThreadSlice(t, SCHEDULING_STATE.RUNNING, 28, 1),
- newThreadSlice(t, SCHEDULING_STATE.SLEEPING, 29, 1),
- newThreadSlice(t, SCHEDULING_STATE.RUNNING, 30, 1)];
- var group = new SliceGroup(t);
- group.pushSlice(newSliceEx(
- {title: 'draw', start: 20, duration: 11})); // 20,[22,24,26,28],30
- group.pushSlice(newSliceEx(
- {title: 'render', start: 22, duration: 8})); // 22,[24, 26, 28]
- group.pushSlice(newSliceEx(
- {title: 'flush', start: 24, duration: 6})); // 24, 26, 28
- group.createSubSlices();
- assert.equal(group.slices[0].cpuDuration, 6);
- assert.equal(group.slices[0].cpuSelfTime, 2);
- assert.equal(group.slices[1].cpuDuration, 4);
- assert.equal(group.slices[1].cpuSelfTime, 1);
- assert.equal(group.slices[2].cpuDuration, 3);
- assert.equal(group.slices[2].cpuSelfTime, 3);
- });
-
- test('sliceParentContainerSetAtPush', function() {
- var m = newModel(function(m) {
- m.process = m.getOrCreateProcess(123);
- m.thread = m.process.getOrCreateThread(456);
- m.group = new SliceGroup(m.thread);
-
- m.sA = m.group.pushSlice(newSliceEx(
- { title: 'sA', start: 0.0, duration: 10.0 }));
-
- m.group.createSubSlices();
- });
-
- assert.deepEqual(m.sA.parentContainer, m.thread);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/slice_test.html b/chromium/third_party/catapult/tracing/tracing/model/slice_test.html
deleted file mode 100644
index a80c080b7e0..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/slice_test.html
+++ /dev/null
@@ -1,219 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/slice_group.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Slice = tr.model.Slice;
- var SliceGroup = tr.model.SliceGroup;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
- var newFakeThread = tr.c.TestUtils.newFakeThread;
-
- test('findDescendentSlice', function() {
- var group = new SliceGroup(newFakeThread());
-
- var sA = group.pushSlice(newSliceEx(
- { title: 'sA', start: 0.0, duration: 10.0 }));
- var sB = group.pushSlice(newSliceEx(
- { title: 'sB', start: 0.0, duration: 4.0 }));
- var sC = group.pushSlice(newSliceEx(
- { title: 'sC', start: 0.0, duration: 2.0 }));
-
- group.createSubSlices();
-
- assert.deepEqual(sB, sA.findDescendentSlice('sB'));
- assert.deepEqual(sC, sA.findDescendentSlice('sC'));
- assert.isUndefined(sA.findDescendentSlice('sD'));
- });
-
- test('findTopmostSlicesRelativeToThisSliceBaseCase', function() {
- var PREDICATE = slice => slice.title.startsWith('sC');
-
- var group = new SliceGroup(newFakeThread());
-
- var sC1 = group.pushSlice(newSliceEx(
- { title: 'sC1', start: 0.0, duration: 10.0 }));
- var sC2 = group.pushSlice(newSliceEx(
- { title: 'sC2', start: 0.0, duration: 4.0 }));
-
- group.createSubSlices();
-
- var foundSlices = [];
- for (var slice of sC1.findTopmostSlicesRelativeToThisSlice(PREDICATE))
- foundSlices.push(slice);
-
- assert.deepEqual([sC1], foundSlices);
- });
-
- test('findTopmostSlicesRelativeToThisSliceRecursive', function() {
- var PREDICATE = slice => slice.title.startsWith('sC');
-
- var group = new SliceGroup(newFakeThread());
-
- var sD = group.pushSlice(newSliceEx(
- { title: 'sD', start: 0.0, duration: 10.0 }));
- var sC1 = group.pushSlice(newSliceEx(
- { title: 'sC1', start: 0.0, duration: 4.0 }));
- var sC2 = group.pushSlice(newSliceEx(
- { title: 'sC2', start: 6.0, duration: 3.0 }));
-
- group.createSubSlices();
-
- var foundSlices = [];
- for (var slice of sD.findTopmostSlicesRelativeToThisSlice(PREDICATE))
- foundSlices.push(slice);
- assert.deepEqual([sC1, sC2], foundSlices);
- });
-
- test('iterateAllDescendents', function() {
- var group = new SliceGroup(newFakeThread());
-
- var sA = group.pushSlice(newSliceEx(
- { title: 'sA', start: 0.0, duration: 10.0 }));
- var sB = group.pushSlice(newSliceEx(
- { title: 'sB', start: 0.0, duration: 4.0 }));
- var sC = group.pushSlice(newSliceEx(
- { title: 'sC', start: 0.0, duration: 2.0 }));
-
- group.createSubSlices();
-
- assert.deepEqual(sA.descendentSlices, [sB, sC]);
- assert.deepEqual(sC.descendentSlices, []);
- });
-
- test('mostTopLevelSlice', function() {
- var group = new SliceGroup(newFakeThread());
-
- var sA = group.pushSlice(newSliceEx(
- { title: 'sA', start: 0.0, duration: 10.0 }));
- var sB = group.pushSlice(newSliceEx(
- { title: 'sB', start: 0.0, duration: 4.0 }));
- var sC = group.pushSlice(newSliceEx(
- { title: 'sC', start: 0.0, duration: 2.0 }));
-
- group.createSubSlices();
-
- assert.equal(sA.mostTopLevelSlice, sA);
- assert.equal(sB.mostTopLevelSlice, sA);
- assert.equal(sC.mostTopLevelSlice, sA);
- });
-
- test('iterateAllAncestors', function() {
- var group = new SliceGroup(newFakeThread());
-
- var sA = group.pushSlice(newSliceEx(
- { title: 'sA', start: 0.0, duration: 10.0 }));
- var sB = group.pushSlice(newSliceEx(
- { title: 'sB', start: 0.0, duration: 4.0 }));
- var sC = group.pushSlice(newSliceEx(
- { title: 'sC', start: 0.0, duration: 2.0 }));
-
- group.createSubSlices();
-
- // Note that we iterate ancestors from the leaves to the root
- assert.deepEqual(sC.ancestorSlices, [sB, sA]);
- assert.deepEqual(sA.ancestorSlices, []);
- });
-
- test('iterateAllSubsequentSlices', function() {
- var group = new SliceGroup(newFakeThread());
-
- // [ A ]
- // [ B ][ D ][F]
- // [C] [E]
-
- var sA = group.pushSlice(newSliceEx(
- { title: 'sA', start: 0.0, duration: 10.0 }));
- var sB = group.pushSlice(newSliceEx(
- { title: 'sB', start: 0.0, duration: 4.0 }));
- var sC = group.pushSlice(newSliceEx(
- { title: 'sC', start: 0.0, duration: 2.0 }));
- var sD = group.pushSlice(newSliceEx(
- { title: 'sD', start: 5.0, duration: 2.0 }));
- var sE = group.pushSlice(newSliceEx(
- { title: 'sE', start: 5.0, duration: 1.0 }));
- var sF = group.pushSlice(newSliceEx(
- { title: 'sF', start: 8.0, duration: 2.0 }));
-
- group.createSubSlices();
-
- assert.deepEqual(sA.subsequentSlices, [sB, sC, sD, sE, sF]);
- assert.deepEqual(sD.subsequentSlices, [sE, sF]);
- assert.deepEqual(sF.subsequentSlices, []);
- });
-
- test('ancestorAndSubsequentSlices', function() {
- var group = new SliceGroup(newFakeThread());
-
- // [ A ]
- // [ B ][ D ][F]
- // [C] [E]
-
- var sA = group.pushSlice(newSliceEx(
- { title: 'sA', start: 0.0, duration: 10.0 }));
- var sB = group.pushSlice(newSliceEx(
- { title: 'sB', start: 0.0, duration: 4.0 }));
- var sC = group.pushSlice(newSliceEx(
- { title: 'sC', start: 0.0, duration: 2.0 }));
- var sD = group.pushSlice(newSliceEx(
- { title: 'sD', start: 5.0, duration: 2.0 }));
- var sE = group.pushSlice(newSliceEx(
- { title: 'sE', start: 5.0, duration: 1.0 }));
- var sF = group.pushSlice(newSliceEx(
- { title: 'sF', start: 8.0, duration: 2.0 }));
-
- group.createSubSlices();
-
- assert.deepEqual(sD.ancestorAndSubsequentSlices, [sD, sA, sE, sF]);
- });
-
- test('entireHierarchy', function() {
- var group = new SliceGroup(newFakeThread());
-
- // [ A ]
- // [ B ][ D ][F]
- // [C] [E]
-
- var sA = group.pushSlice(newSliceEx(
- { title: 'sA', start: 0.0, duration: 10.0 }));
- var sB = group.pushSlice(newSliceEx(
- { title: 'sB', start: 0.0, duration: 4.0 }));
- var sC = group.pushSlice(newSliceEx(
- { title: 'sC', start: 0.0, duration: 2.0 }));
- var sD = group.pushSlice(newSliceEx(
- { title: 'sD', start: 5.0, duration: 2.0 }));
- var sE = group.pushSlice(newSliceEx(
- { title: 'sE', start: 5.0, duration: 1.0 }));
- var sF = group.pushSlice(newSliceEx(
- { title: 'sF', start: 8.0, duration: 2.0 }));
-
- group.createSubSlices();
-
- assert.deepEqual(sD.entireHierarchy, [sA, sB, sC, sD, sE, sF]);
- });
-
- test('stableId', function() {
- var thread = newFakeThread();
- var group = thread.sliceGroup;
-
- var sA = group.pushSlice(newSliceEx(
- { title: 'sA', start: 0.0, duration: 10.0 }));
- var sB = group.pushSlice(newSliceEx(
- { title: 'sB', start: 10.0, duration: 20.0 }));
- var sC = group.pushSlice(newSliceEx(
- { title: 'sC', start: 20.0, duration: 30.0 }));
-
- assert.equal(group.stableId + '.0', sA.stableId);
- assert.equal(group.stableId + '.1', sB.stableId);
- assert.equal(group.stableId + '.2', sC.stableId);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/source_info/js_source_info.html b/chromium/third_party/catapult/tracing/tracing/model/source_info/js_source_info.html
deleted file mode 100644
index bb4370e2c63..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/source_info/js_source_info.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/source_info/source_info.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model.source_info', function() {
- function JSSourceInfo(file, line, column, isNative, scriptId, state) {
- tr.model.source_info.SourceInfo.call(this, file, line, column);
-
- this.isNative_ = isNative;
- this.scriptId_ = scriptId;
- this.state_ = state;
- }
-
- JSSourceInfo.prototype = {
- __proto__: tr.model.source_info.SourceInfo.prototype,
-
- get state() {
- return this.state_;
- },
-
- get isNative() {
- return this.isNative_;
- },
-
- get scriptId() {
- return this.scriptId_;
- },
-
- toString: function() {
- var str = this.isNative_ ? '[native v8] ' : '';
- return str +
- tr.model.source_info.SourceInfo.prototype.toString.call(this);
- }
- };
-
- return {
- JSSourceInfo: JSSourceInfo,
- JSSourceState: {
- COMPILED: 'compiled',
- OPTIMIZABLE: 'optimizable',
- OPTIMIZED: 'optimized',
- UNKNOWN: 'unknown'
- }
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/source_info/source_info.html b/chromium/third_party/catapult/tracing/tracing/model/source_info/source_info.html
deleted file mode 100644
index 19e36dfc1d8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/source_info/source_info.html
+++ /dev/null
@@ -1,58 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model.source_info', function() {
- function SourceInfo(file, opt_line, opt_column) {
- this.file_ = file;
- this.line_ = opt_line || -1;
- this.column_ = opt_column || -1;
- }
-
- SourceInfo.prototype = {
- get file() {
- return this.file_;
- },
-
- get line() {
- return this.line_;
- },
-
- get column() {
- return this.column_;
- },
-
- get domain() {
- if (!this.file_)
- return undefined;
- var domain = this.file_.match(/(.*:\/\/[^:\/]*)/i);
- return domain ? domain[1] : undefined;
- },
-
- toString: function() {
- var str = '';
-
- if (this.file_)
- str += this.file_;
- if (this.line_ > 0)
- str += ':' + this.line_;
- if (this.column_ > 0)
- str += ':' + this.column_;
- return str;
- }
- };
-
- return {
- SourceInfo: SourceInfo
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/source_info/source_info_test.html b/chromium/third_party/catapult/tracing/tracing/model/source_info/source_info_test.html
deleted file mode 100644
index 344dba0fb54..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/source_info/source_info_test.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/source_info/source_info.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('domain', function() {
- var urlDomains = {
- 'http://www.google.com': 'http://www.google.com',
- 'http://www.google.com/bla': 'http://www.google.com',
- 'http://www.google.com:1234': 'http://www.google.com',
- 'bad url': undefined
- };
- for (var url in urlDomains) {
- var sourceInfo = new tr.model.source_info.SourceInfo(url);
- assert.equal(urlDomains[url], sourceInfo.domain);
- }
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/stack_frame.html b/chromium/third_party/catapult/tracing/tracing/model/stack_frame.html
deleted file mode 100644
index 50f3126a1e5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/stack_frame.html
+++ /dev/null
@@ -1,103 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
- function StackFrame(parentFrame, id, title, colorId, opt_sourceInfo) {
- if (id === undefined)
- throw new Error('id must be given');
- this.parentFrame_ = parentFrame;
- this.id = id;
- this.title_ = title;
- this.colorId = colorId;
- this.children = [];
- this.sourceInfo_ = opt_sourceInfo;
-
- if (this.parentFrame_)
- this.parentFrame_.addChild(this);
- }
-
- StackFrame.prototype = {
- get parentFrame() {
- return this.parentFrame_;
- },
-
- get title() {
- if (this.sourceInfo_) {
- var src = this.sourceInfo_.toString();
- return this.title_ + (src === '' ? '' : ' ' + src);
- }
- return this.title_;
- },
-
- /**
- * Attempts to find the domain of the origin of the script either from this
- * stack trace or from its ancestors.
- */
- get domain() {
- var result = 'unknown';
- if (this.sourceInfo_ && this.sourceInfo_.domain)
- result = this.sourceInfo_.domain;
- if (result === 'unknown' && this.parentFrame)
- result = this.parentFrame.domain;
- return result;
- },
-
- get sourceInfo() {
- return this.sourceInfo_;
- },
-
- set parentFrame(parentFrame) {
- if (this.parentFrame_)
- this.parentFrame_.removeChild(this);
- this.parentFrame_ = parentFrame;
- if (this.parentFrame_)
- this.parentFrame_.addChild(this);
- },
-
- addChild: function(child) {
- this.children.push(child);
- },
-
- removeChild: function(child) {
- var i = this.children.indexOf(child.id);
- if (i == -1)
- throw new Error('omg');
- this.children.splice(i, 1);
- },
-
- removeAllChildren: function() {
- for (var i = 0; i < this.children.length; i++)
- this.children[i].parentFrame_ = undefined;
- this.children.splice(0, this.children.length);
- },
-
- /**
- * Returns stackFrames where the most specific frame is first.
- */
- get stackTrace() {
- var stack = [];
- var cur = this;
- while (cur) {
- stack.push(cur);
- cur = cur.parentFrame;
- }
- return stack;
- },
-
- getUserFriendlyStackTrace: function() {
- return this.stackTrace.map(function(x) { return x.title; });
- }
- };
-
- return {
- StackFrame: StackFrame
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/stack_frame_test.html b/chromium/third_party/catapult/tracing/tracing/model/stack_frame_test.html
deleted file mode 100644
index 1fee75ace26..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/stack_frame_test.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/source_info/source_info.html">
-<link rel="import" href="/tracing/model/stack_frame.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('domain', function() {
- var stackFrame1 = new tr.model.StackFrame(undefined, 1, '1', 1);
- assert.equal('unknown', stackFrame1.domain);
-
- var sourceInfo = new tr.model.source_info.SourceInfo(
- 'http://www.google.com:1234');
- var stackFrame2 = new tr.model.StackFrame(
- stackFrame1, 2, '2', 2, sourceInfo);
- assert.equal('http://www.google.com', stackFrame2.domain);
-
- var stackFrame3 = new tr.model.StackFrame(stackFrame2, 3, '3', 3);
- assert.equal('http://www.google.com', stackFrame3.domain);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/thread.html b/chromium/third_party/catapult/tracing/tracing/model/thread.html
deleted file mode 100644
index c11aeb13d1d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/thread.html
+++ /dev/null
@@ -1,334 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/model/async_slice_group.html">
-<link rel="import" href="/tracing/model/event_container.html">
-<link rel="import" href="/tracing/model/slice_group.html">
-<link rel="import" href="/tracing/model/thread_slice.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the Thread class.
- */
-tr.exportTo('tr.model', function() {
- var AsyncSlice = tr.model.AsyncSlice;
- var AsyncSliceGroup = tr.model.AsyncSliceGroup;
- var Slice = tr.model.Slice;
- var SliceGroup = tr.model.SliceGroup;
- var ThreadSlice = tr.model.ThreadSlice;
- var ThreadTimeSlice = tr.model.ThreadTimeSlice;
-
- /**
- * A Thread stores all the trace events collected for a particular
- * thread. We organize the synchronous slices on a thread by "subrows," where
- * subrow 0 has all the root slices, subrow 1 those nested 1 deep, and so on.
- * The asynchronous slices are stored in an AsyncSliceGroup object.
- *
- * The slices stored on a Thread should be instances of
- * ThreadSlice.
- *
- * @constructor
- * @extends {tr.model.EventContainer}
- */
- function Thread(parent, tid) {
- if (!parent)
- throw new Error('Parent must be provided.');
-
- tr.model.EventContainer.call(this);
- this.parent = parent;
- this.sortIndex = 0;
- this.tid = tid;
- this.name = undefined;
- this.samples_ = undefined; // Set during createSubSlices
-
- var that = this;
-
- this.sliceGroup = new SliceGroup(this, ThreadSlice, 'slices');
- this.timeSlices = undefined;
- this.kernelSliceGroup = new SliceGroup(
- this, ThreadSlice, 'kernel-slices');
- this.asyncSliceGroup = new AsyncSliceGroup(this, 'async-slices');
- }
-
- Thread.prototype = {
- __proto__: tr.model.EventContainer.prototype,
-
- get model() {
- return this.parent.model;
- },
-
- get stableId() {
- return this.parent.stableId + '.' + this.tid;
- },
-
- compareTo: function(that) {
- return Thread.compare(this, that);
- },
-
- childEventContainers: function*() {
- if (this.sliceGroup.length)
- yield this.sliceGroup;
- if (this.kernelSliceGroup.length)
- yield this.kernelSliceGroup;
- if (this.asyncSliceGroup.length)
- yield this.asyncSliceGroup;
- },
-
- childEvents: function*() {
- if (this.timeSlices)
- yield * this.timeSlices;
- },
-
- iterateAllPersistableObjects: function(cb) {
- cb(this);
- if (this.sliceGroup.length)
- cb(this.sliceGroup);
- this.asyncSliceGroup.viewSubGroups.forEach(cb);
- },
-
- /**
- * Shifts all the timestamps inside this thread forward by the amount
- * specified.
- */
- shiftTimestampsForward: function(amount) {
- this.sliceGroup.shiftTimestampsForward(amount);
-
- if (this.timeSlices) {
- for (var i = 0; i < this.timeSlices.length; i++) {
- var slice = this.timeSlices[i];
- slice.start += amount;
- }
- }
-
- this.kernelSliceGroup.shiftTimestampsForward(amount);
- this.asyncSliceGroup.shiftTimestampsForward(amount);
- },
-
- /**
- * Determines whether this thread is empty. If true, it usually implies
- * that it should be pruned from the model.
- */
- get isEmpty() {
- if (this.sliceGroup.length)
- return false;
- if (this.sliceGroup.openSliceCount)
- return false;
- if (this.timeSlices && this.timeSlices.length)
- return false;
- if (this.kernelSliceGroup.length)
- return false;
- if (this.asyncSliceGroup.length)
- return false;
- if (this.samples_.length)
- return false;
- return true;
- },
-
- /**
- * Updates the bounds based on the
- * current objects associated with the thread.
- */
- updateBounds: function() {
- this.bounds.reset();
-
- this.sliceGroup.updateBounds();
- this.bounds.addRange(this.sliceGroup.bounds);
-
- this.kernelSliceGroup.updateBounds();
- this.bounds.addRange(this.kernelSliceGroup.bounds);
-
- this.asyncSliceGroup.updateBounds();
- this.bounds.addRange(this.asyncSliceGroup.bounds);
-
- if (this.timeSlices && this.timeSlices.length) {
- this.bounds.addValue(this.timeSlices[0].start);
- this.bounds.addValue(
- this.timeSlices[this.timeSlices.length - 1].end);
- }
-
- if (this.samples_ && this.samples_.length) {
- this.bounds.addValue(this.samples_[0].start);
- this.bounds.addValue(
- this.samples_[this.samples_.length - 1].end);
- }
- },
-
- addCategoriesToDict: function(categoriesDict) {
- for (var i = 0; i < this.sliceGroup.length; i++)
- categoriesDict[this.sliceGroup.slices[i].category] = true;
- for (var i = 0; i < this.kernelSliceGroup.length; i++)
- categoriesDict[this.kernelSliceGroup.slices[i].category] = true;
- for (var i = 0; i < this.asyncSliceGroup.length; i++)
- categoriesDict[this.asyncSliceGroup.slices[i].category] = true;
- if (this.samples_) {
- for (var i = 0; i < this.samples_.length; i++)
- categoriesDict[this.samples_[i].category] = true;
- }
- },
-
- autoCloseOpenSlices: function() {
- this.sliceGroup.autoCloseOpenSlices();
- this.kernelSliceGroup.autoCloseOpenSlices();
- },
-
- mergeKernelWithUserland: function() {
- if (this.kernelSliceGroup.length > 0) {
- var newSlices = SliceGroup.merge(
- this.sliceGroup, this.kernelSliceGroup);
- this.sliceGroup.slices = newSlices.slices;
- this.kernelSliceGroup = new SliceGroup(this);
- this.updateBounds();
- }
- },
-
- createSubSlices: function() {
- this.sliceGroup.createSubSlices();
- this.samples_ = this.parent.model.samples.filter(function(sample) {
- return sample.thread == this;
- }, this);
- },
-
- /**
- * @return {String} A user-friendly name for this thread.
- */
- get userFriendlyName() {
- return this.name || this.tid;
- },
-
- /**
- * @return {String} User friendly details about this thread.
- */
- get userFriendlyDetails() {
- return 'tid: ' + this.tid +
- (this.name ? ', name: ' + this.name : '');
- },
-
- getSettingsKey: function() {
- if (!this.name)
- return undefined;
- var parentKey = this.parent.getSettingsKey();
- if (!parentKey)
- return undefined;
- return parentKey + '.' + this.name;
- },
-
- getProcess: function() {
- return this.parent;
- },
-
- /*
- * Returns the index of the slice in the timeSlices array, or undefined.
- */
- indexOfTimeSlice: function(timeSlice) {
- var i = tr.b.findLowIndexInSortedArray(
- this.timeSlices,
- function(slice) { return slice.start; },
- timeSlice.start);
- if (this.timeSlices[i] !== timeSlice)
- return undefined;
- return i;
- },
-
- /*
- * Returns an object with the CPU number used as keys,
- * and the value of each key object is the amount of milliseconds spent
- * running on this CPU.
- * Additionally, stats.total contains the total time
- * spent running on all CPUs.
- */
- getCpuStatsForRange: function(range) {
- var stats = {};
- stats.total = 0;
-
- if (!this.timeSlices)
- return stats;
-
- function addStatsForSlice(threadTimeSlice) {
- var freqRange = tr.b.Range.fromExplicitRange(threadTimeSlice.start,
- threadTimeSlice.end);
- var intersection = freqRange.findIntersection(range);
-
- if (threadTimeSlice.schedulingState ==
- tr.model.SCHEDULING_STATE.RUNNING) {
- var cpu = threadTimeSlice.cpuOnWhichThreadWasRunning;
- if (!(cpu.cpuNumber in stats))
- stats[cpu.cpuNumber] = 0;
-
- stats[cpu.cpuNumber] += intersection.duration;
- stats.total += intersection.duration;
- }
- }
-
- tr.b.iterateOverIntersectingIntervals(this.timeSlices,
- function(x) { return x.start; },
- function(x) { return x.end; },
- range.min,
- range.max,
- addStatsForSlice);
- return stats;
- },
-
- getSchedulingStatsForRange: function(start, end) {
- var stats = {};
-
- if (!this.timeSlices) return stats;
-
- function addStatsForSlice(threadTimeSlice) {
- var overlapStart = Math.max(threadTimeSlice.start, start);
- var overlapEnd = Math.min(threadTimeSlice.end, end);
- var schedulingState = threadTimeSlice.schedulingState;
-
- if (!(schedulingState in stats))
- stats[schedulingState] = 0;
- stats[schedulingState] += overlapEnd - overlapStart;
- }
-
- tr.b.iterateOverIntersectingIntervals(this.timeSlices,
- function(x) { return x.start; },
- function(x) { return x.end; },
- start,
- end,
- addStatsForSlice);
- return stats;
- },
-
- get samples() {
- return this.samples_;
- }
- };
-
- /**
- * Comparison between threads that orders first by parent.compareTo,
- * then by names, then by tid.
- */
- Thread.compare = function(x, y) {
- var tmp = x.parent.compareTo(y.parent);
- if (tmp)
- return tmp;
-
- tmp = x.sortIndex - y.sortIndex;
- if (tmp)
- return tmp;
-
- tmp = tr.b.comparePossiblyUndefinedValues(
- x.name, y.name,
- function(x, y) { return x.localeCompare(y); });
- if (tmp)
- return tmp;
-
- return x.tid - y.tid;
- };
-
- return {
- Thread: Thread
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/thread_slice.html b/chromium/third_party/catapult/tracing/tracing/model/thread_slice.html
deleted file mode 100644
index d1c8edcb313..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/thread_slice.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/slice.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the Thread class.
- */
-tr.exportTo('tr.model', function() {
- var Slice = tr.model.Slice;
-
- /**
- * A ThreadSlice represents an interval of time on a thread resource
- * with associated nesting slice information.
- *
- * ThreadSlices are typically associated with a specific trace event pair on a
- * specific thread.
- * For example,
- * TRACE_EVENT_BEGIN1("x","myArg", 7) at time=0.1ms
- * TRACE_EVENT_END0() at time=0.3ms
- * This results in a single slice from 0.1 with duration 0.2 on a
- * specific thread.
- *
- * @constructor
- */
- function ThreadSlice(cat, title, colorId, start, args, opt_duration,
- opt_cpuStart, opt_cpuDuration, opt_argsStripped,
- opt_bind_id) {
- Slice.call(this, cat, title, colorId, start, args, opt_duration,
- opt_cpuStart, opt_cpuDuration, opt_argsStripped, opt_bind_id);
- // Do not modify this directly.
- // subSlices is configured by SliceGroup.rebuildSubRows_.
- this.subSlices = [];
- }
-
- ThreadSlice.prototype = {
- __proto__: Slice.prototype,
-
- get overlappingSamples() {
- var samples = new tr.model.EventSet();
- if (!this.parentContainer || !this.parentContainer.samples)
- return samples;
- this.parentContainer.samples.forEach(function(sample) {
- if (this.start <= sample.start && sample.start <= this.end)
- samples.push(sample);
- }, this);
- return samples;
- }
- };
-
- tr.model.EventRegistry.register(
- ThreadSlice,
- {
- name: 'slice',
- pluralName: 'slices',
- singleViewElementName: 'tr-ui-a-single-thread-slice-sub-view',
- multiViewElementName: 'tr-ui-a-multi-thread-slice-sub-view'
- });
-
- return {
- ThreadSlice: ThreadSlice
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/thread_slice_test.html b/chromium/third_party/catapult/tracing/tracing/model/thread_slice_test.html
deleted file mode 100644
index d621859a4ee..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/thread_slice_test.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/thread_slice.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ThreadSlice = tr.model.ThreadSlice;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
- var newFakeThread = tr.c.TestUtils.newFakeThread;
-
- test('getOverlappingSamples', function() {
- var model = tr.c.TestUtils.newModel(function(m) {
- m.p1 = m.getOrCreateProcess(1);
- m.t2 = m.p1.getOrCreateThread(2);
- m.samples.push(
- new tr.model.Sample(null, m.t1, 'a_1', 1),
- new tr.model.Sample(null, m.t1, 'a_2', 2),
- new tr.model.Sample(null, m.t1, 'a_3', 3),
- new tr.model.Sample(null, m.t1, 'b', 5)
- );
- });
- var threadSlice = newSliceEx({title: 'a', start: 0, end: 4,
- type: tr.model.ThreadSlice});
- threadSlice.parentContainer = model;
- var samplesIter = threadSlice.overlappingSamples[Symbol.iterator]();
- assert.equal(samplesIter.next().value.title, 'a_1');
- assert.equal(samplesIter.next().value.title, 'a_2');
- assert.equal(samplesIter.next().value.title, 'a_3');
- assert.equal(samplesIter.next().done, true);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/thread_test.html b/chromium/third_party/catapult/tracing/tracing/model/thread_test.html
deleted file mode 100644
index fc88dda7501..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/thread_test.html
+++ /dev/null
@@ -1,183 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ThreadSlice = tr.model.ThreadSlice;
- var Process = tr.model.Process;
- var Thread = tr.model.Thread;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
- var newAsyncSlice = tr.c.TestUtils.newAsyncSlice;
- var newThreadSlice = tr.c.TestUtils.newThreadSlice;
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
-
- test('threadBounds_Empty', function() {
- var model = new tr.Model();
- var t = new Thread(new Process(model, 7), 1);
- t.updateBounds();
- assert.isUndefined(t.bounds.min);
- assert.isUndefined(t.bounds.max);
- });
-
- test('threadBounds_SubRow', function() {
- var model = new tr.Model();
- var t = new Thread(new Process(model, 7), 1);
- t.sliceGroup.pushSlice(new ThreadSlice('', 'a', 0, 1, {}, 3));
- t.updateBounds();
- assert.equal(t.bounds.min, 1);
- assert.equal(t.bounds.max, 4);
- });
-
- test('threadBounds_AsyncSliceGroup', function() {
- var model = new tr.Model();
- var t = new Thread(new Process(model, 7), 1);
- t.sliceGroup.pushSlice(new ThreadSlice('', 'a', 0, 1, {}, 3));
- t.asyncSliceGroup.push(newAsyncSlice(0.1, 5, t, t));
- t.updateBounds();
- assert.equal(t.bounds.min, 0.1);
- assert.equal(t.bounds.max, 5.1);
- });
-
- test('threadBounds_Cpu', function() {
- var model = new tr.Model();
- var t = new Thread(new Process(model, 7), 1);
- t.timeSlices = [newSliceEx({title: 'x', start: 0, duration: 1})];
- t.updateBounds();
- assert.equal(t.bounds.min, 0);
- assert.equal(t.bounds.max, 1);
- });
-
- test('shiftTimestampsForwardWithCpu', function() {
- var model = new tr.Model();
- var t = new Thread(new Process(model, 7), 1);
- t.sliceGroup.pushSlice(new ThreadSlice('', 'a', 0, 0, {}, 3));
- t.asyncSliceGroup.push(newAsyncSlice(0, 5, t, t));
- t.timeSlices = [newSliceEx({title: 'x', start: 0, duration: 1})];
-
- var shiftCount = 0;
- t.asyncSliceGroup.shiftTimestampsForward = function(ts) {
- if (ts == 0.32)
- shiftCount++;
- };
-
- t.shiftTimestampsForward(0.32);
-
- assert.equal(shiftCount, 1);
- assert.equal(t.sliceGroup.slices[0].start, 0.32);
- assert.equal(t.timeSlices[0].start, 0.32);
- });
-
- test('shiftTimestampsForwardWithoutCpu', function() {
- var model = new tr.Model();
- var t = new Thread(new Process(model, 7), 1);
- t.sliceGroup.pushSlice(new ThreadSlice('', 'a', 0, 0, {}, 3));
- t.asyncSliceGroup.push(newAsyncSlice(0, 5, t, t));
-
- var shiftCount = 0;
- t.asyncSliceGroup.shiftTimestampsForward = function(ts) {
- if (ts == 0.32)
- shiftCount++;
- };
-
- t.shiftTimestampsForward(0.32);
-
- assert.equal(shiftCount, 1);
- assert.equal(t.sliceGroup.slices[0].start, 0.32);
- });
-
- test('getSchedulingStatsForRange', function() {
- var scheduledThread = undefined;
- var unscheduledThread = undefined;
- var model = tr.c.TestUtils.newModel(function(model) {
- unscheduledThread = model.getOrCreateProcess(1).getOrCreateThread(1);
- unscheduledThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'work', start: 0, duration: 20}));
-
- scheduledThread = model.getOrCreateProcess(2).getOrCreateThread(2);
- scheduledThread.sliceGroup.pushSlice(newSliceEx(
- {title: 'work', start: 0, duration: 20}));
- scheduledThread.timeSlices = [
- newThreadSlice(scheduledThread, SCHEDULING_STATE.RUNNING, 0, 3),
- newThreadSlice(scheduledThread, SCHEDULING_STATE.RUNNABLE, 3, 5),
- newThreadSlice(scheduledThread, SCHEDULING_STATE.RUNNING, 8, 2),
- newThreadSlice(scheduledThread, SCHEDULING_STATE.SLEEPING, 10, 10)
- ];
- });
-
- // thread without scheduling states
- var stats = unscheduledThread.getSchedulingStatsForRange(0, 20);
- assert.deepEqual(stats, {});
-
- // no scheduling info
- var stats = scheduledThread.getSchedulingStatsForRange(50, 100);
- assert.deepEqual(stats, {});
-
- // simple query
- var stats = scheduledThread.getSchedulingStatsForRange(0, 3);
- var expected = {};
- expected[SCHEDULING_STATE.RUNNING] = 3;
- assert.deepEqual(stats, expected);
-
- // aggregation
- var stats = scheduledThread.getSchedulingStatsForRange(0, 20);
- var expected = {};
- expected[SCHEDULING_STATE.RUNNING] = 5;
- expected[SCHEDULING_STATE.RUNNABLE] = 5;
- expected[SCHEDULING_STATE.SLEEPING] = 10;
- assert.deepEqual(stats, expected);
- });
-
- test('getCpuStatsForRange', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var cpu0 = model.kernel.getOrCreateCpu(0);
- var cpu1 = model.kernel.getOrCreateCpu(1);
- var thread = model.getOrCreateProcess(1).getOrCreateThread(1);
- thread.timeSlices = [
- newThreadSlice(thread, SCHEDULING_STATE.RUNNING, 0, 3, cpu0),
- newThreadSlice(thread, SCHEDULING_STATE.RUNNING, 8, 2, cpu1),
- newThreadSlice(thread, SCHEDULING_STATE.RUNNING, 20, 5, cpu1)
- ];
- var range = tr.b.Range.fromExplicitRange(1, 22);
- var stats = thread.getCpuStatsForRange(range);
- assert.deepEqual(stats, {
- 0: 2,
- 1: 4,
- total: 6
- });
- });
- });
-
- test('getCpuStatsForRange_excludesNotRunningThreads', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var cpu0 = model.kernel.getOrCreateCpu(0);
- var cpu1 = model.kernel.getOrCreateCpu(1);
- var thread = model.getOrCreateProcess(1).getOrCreateThread(1);
- thread.timeSlices = [
- newThreadSlice(thread, SCHEDULING_STATE.RUNNING, 0, 8, cpu0),
- newThreadSlice(thread, SCHEDULING_STATE.RUNNABLE, 8, 3),
- newThreadSlice(thread, SCHEDULING_STATE.RUNNING, 11, 4, cpu1),
- newThreadSlice(thread, SCHEDULING_STATE.SLEEPING, 15, 10),
- newThreadSlice(thread, SCHEDULING_STATE.RUNNING, 25, 10, cpu1)
- ];
- var range = tr.b.Range.fromExplicitRange(1, 26);
- var stats = thread.getCpuStatsForRange(range);
- assert.deepEqual(stats, {
- 0: 7,
- 1: 5,
- total: 12
- });
- });
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/thread_time_slice.html b/chromium/third_party/catapult/tracing/tracing/model/thread_time_slice.html
deleted file mode 100644
index e63a136d05d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/thread_time_slice.html
+++ /dev/null
@@ -1,161 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/model/slice.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
- var Slice = tr.model.Slice;
-
-
- var SCHEDULING_STATE = {
- DEBUG: 'Debug',
- EXIT_DEAD: 'Exit Dead',
- RUNNABLE: 'Runnable',
- RUNNING: 'Running',
- SLEEPING: 'Sleeping',
- STOPPED: 'Stopped',
- TASK_DEAD: 'Task Dead',
- UNINTR_SLEEP: 'Uninterruptible Sleep',
- UNINTR_SLEEP_WAKE_KILL: 'Uninterruptible Sleep | WakeKill',
- UNINTR_SLEEP_WAKING: 'Uninterruptible Sleep | Waking',
- UNINTR_SLEEP_IO: 'Uninterruptible Sleep - Block I/O',
- UNINTR_SLEEP_WAKE_KILL_IO: 'Uninterruptible Sleep | WakeKill - Block I/O',
- UNINTR_SLEEP_WAKING_IO: 'Uninterruptible Sleep | Waking - Block I/O',
- UNKNOWN: 'UNKNOWN',
- WAKE_KILL: 'Wakekill',
- WAKING: 'Waking',
- ZOMBIE: 'Zombie'
- };
-
- /**
- * A ThreadTimeSlice is a slice of time on a specific thread where that thread
- * was running on a specific CPU, or in a specific sleep state.
- *
- * As a thread switches moves through its life, it sometimes goes to sleep and
- * can't run. Other times, its runnable but isn't actually assigned to a CPU.
- * Finally, sometimes it gets put on a CPU to actually execute. Each of these
- * states is represented by a ThreadTimeSlice:
- *
- * Sleeping or runnable: cpuOnWhichThreadWasRunning is undefined
- * Running: cpuOnWhichThreadWasRunning is set.
- *
- * @constructor
- */
- function ThreadTimeSlice(thread, schedulingState, cat,
- start, args, opt_duration) {
- Slice.call(this, cat, schedulingState,
- this.getColorForState_(schedulingState),
- start, args, opt_duration);
- this.thread = thread;
- this.schedulingState = schedulingState;
- this.cpuOnWhichThreadWasRunning = undefined;
- }
-
- ThreadTimeSlice.prototype = {
- __proto__: Slice.prototype,
-
- getColorForState_: function(state) {
- var getColorIdForReservedName =
- tr.b.ColorScheme.getColorIdForReservedName;
-
- switch (state) {
- case SCHEDULING_STATE.RUNNABLE:
- return getColorIdForReservedName('thread_state_runnable');
- case SCHEDULING_STATE.RUNNING:
- return getColorIdForReservedName('thread_state_running');
- case SCHEDULING_STATE.SLEEPING:
- return getColorIdForReservedName('thread_state_sleeping');
- case SCHEDULING_STATE.DEBUG:
- case SCHEDULING_STATE.EXIT_DEAD:
- case SCHEDULING_STATE.STOPPED:
- case SCHEDULING_STATE.TASK_DEAD:
- case SCHEDULING_STATE.UNINTR_SLEEP:
- case SCHEDULING_STATE.UNINTR_SLEEP_WAKE_KILL:
- case SCHEDULING_STATE.UNINTR_SLEEP_WAKING:
- case SCHEDULING_STATE.UNKNOWN:
- case SCHEDULING_STATE.WAKE_KILL:
- case SCHEDULING_STATE.WAKING:
- case SCHEDULING_STATE.ZOMBIE:
- return getColorIdForReservedName('thread_state_uninterruptible');
- case SCHEDULING_STATE.UNINTR_SLEEP_IO:
- case SCHEDULING_STATE.UNINTR_SLEEP_WAKE_KILL_IO:
- case SCHEDULING_STATE.UNINTR_SLEEP_WAKING_IO:
- return getColorIdForReservedName('thread_state_iowait');
- default:
- return getColorIdForReservedName('thread_state_unknown');
- }
- },
-
- get analysisTypeName() {
- return 'tr.ui.analysis.ThreadTimeSlice';
- },
-
- getAssociatedCpuSlice: function() {
- if (!this.cpuOnWhichThreadWasRunning)
- return undefined;
- var cpuSlices = this.cpuOnWhichThreadWasRunning.slices;
- for (var i = 0; i < cpuSlices.length; i++) {
- var cpuSlice = cpuSlices[i];
- if (cpuSlice.start !== this.start)
- continue;
- if (cpuSlice.duration !== this.duration)
- continue;
- return cpuSlice;
- }
- return undefined;
- },
-
- getCpuSliceThatTookCpu: function() {
- if (this.cpuOnWhichThreadWasRunning)
- return undefined;
- var curIndex = this.thread.indexOfTimeSlice(this);
- var cpuSliceWhenLastRunning;
- while (curIndex >= 0) {
- var curSlice = this.thread.timeSlices[curIndex];
- if (!curSlice.cpuOnWhichThreadWasRunning) {
- curIndex--;
- continue;
- }
- cpuSliceWhenLastRunning = curSlice.getAssociatedCpuSlice();
- break;
- }
- if (!cpuSliceWhenLastRunning)
- return undefined;
-
- var cpu = cpuSliceWhenLastRunning.cpu;
- var indexOfSliceOnCpuWhenLastRunning =
- cpu.indexOf(cpuSliceWhenLastRunning);
- var nextRunningSlice = cpu.slices[indexOfSliceOnCpuWhenLastRunning + 1];
- if (!nextRunningSlice)
- return undefined;
- if (Math.abs(nextRunningSlice.start - cpuSliceWhenLastRunning.end) <
- 0.00001)
- return nextRunningSlice;
- return undefined;
- }
- };
-
- tr.model.EventRegistry.register(
- ThreadTimeSlice,
- {
- name: 'threadTimeSlice',
- pluralName: 'threadTimeSlices',
- singleViewElementName: 'tr-ui-a-single-thread-time-slice-sub-view',
- multiViewElementName: 'tr-ui-a-multi-thread-time-slice-sub-view'
- });
-
-
- return {
- ThreadTimeSlice: ThreadTimeSlice,
- SCHEDULING_STATE: SCHEDULING_STATE
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/time_to_object_instance_map.html b/chromium/third_party/catapult/tracing/tracing/model/time_to_object_instance_map.html
deleted file mode 100644
index bd30fc102bc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/time_to_object_instance_map.html
+++ /dev/null
@@ -1,193 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the TimeToObjectInstanceMap class.
- */
-tr.exportTo('tr.model', function() {
- /**
- * Tracks all the instances associated with a given ID over its lifetime.
- *
- * A scoped id can be used multiple times throughout a trace, referring to
- * different objects at different times. This data structure does the
- * bookkeeping to figure out what ObjectInstance is referred to at a given
- * timestamp.
- *
- * @constructor
- */
- function TimeToObjectInstanceMap(
- createObjectInstanceFunction, parent, scopedId) {
- this.createObjectInstanceFunction_ = createObjectInstanceFunction;
- this.parent = parent;
- this.scopedId = scopedId;
- this.instances = [];
- }
-
- TimeToObjectInstanceMap.prototype = {
- idWasCreated: function(category, name, ts) {
- if (this.instances.length == 0) {
- this.instances.push(this.createObjectInstanceFunction_(
- this.parent, this.scopedId, category, name, ts));
- this.instances[0].creationTsWasExplicit = true;
- return this.instances[0];
- }
-
- var lastInstance = this.instances[this.instances.length - 1];
- if (ts < lastInstance.deletionTs) {
- throw new Error('Mutation of the TimeToObjectInstanceMap must be ' +
- 'done in ascending timestamp order.');
- }
- lastInstance = this.createObjectInstanceFunction_(
- this.parent, this.scopedId, category, name, ts);
- lastInstance.creationTsWasExplicit = true;
- this.instances.push(lastInstance);
- return lastInstance;
- },
-
- addSnapshot: function(category, name, ts, args, opt_baseTypeName) {
- if (this.instances.length == 0) {
- this.instances.push(this.createObjectInstanceFunction_(
- this.parent, this.scopedId, category, name, ts, opt_baseTypeName));
- }
-
- var i = tr.b.findIndexInSortedIntervals(
- this.instances,
- function(inst) { return inst.creationTs; },
- function(inst) { return inst.deletionTs - inst.creationTs; },
- ts);
-
- var instance;
- if (i < 0) {
- instance = this.instances[0];
- if (ts > instance.deletionTs ||
- instance.creationTsWasExplicit) {
- throw new Error(
- 'At the provided timestamp, no instance was still alive');
- }
-
- if (instance.snapshots.length != 0) {
- throw new Error(
- 'Cannot shift creationTs forward, ' +
- 'snapshots have been added. First snap was at ts=' +
- instance.snapshots[0].ts + ' and creationTs was ' +
- instance.creationTs);
- }
- instance.creationTs = ts;
- } else if (i >= this.instances.length) {
- instance = this.instances[this.instances.length - 1];
- if (ts >= instance.deletionTs) {
- // The snap is added after our oldest and deleted instance. This means
- // that this is a new implicit instance.
- instance = this.createObjectInstanceFunction_(
- this.parent, this.scopedId, category, name, ts, opt_baseTypeName);
- this.instances.push(instance);
- } else {
- // If the ts is before the last objects deletion time, then the caller
- // is trying to add a snapshot when there may have been an instance
- // alive. In that case, try to move an instance's creationTs to
- // include this ts, provided that it has an implicit creationTs.
-
- // Search backward from the right for an instance that was definitely
- // deleted before this ts. Any time an instance is found that has a
- // moveable creationTs
- var lastValidIndex;
- for (var i = this.instances.length - 1; i >= 0; i--) {
- var tmp = this.instances[i];
- if (ts >= tmp.deletionTs)
- break;
- if (tmp.creationTsWasExplicit == false && tmp.snapshots.length == 0)
- lastValidIndex = i;
- }
- if (lastValidIndex === undefined) {
- throw new Error(
- 'Cannot add snapshot. No instance was alive that was mutable.');
- }
- instance = this.instances[lastValidIndex];
- instance.creationTs = ts;
- }
- } else {
- instance = this.instances[i];
- }
-
- return instance.addSnapshot(ts, args, name, opt_baseTypeName);
- },
-
- get lastInstance() {
- if (this.instances.length == 0)
- return undefined;
- return this.instances[this.instances.length - 1];
- },
-
- idWasDeleted: function(category, name, ts) {
- if (this.instances.length == 0) {
- this.instances.push(this.createObjectInstanceFunction_(
- this.parent, this.scopedId, category, name, ts));
- }
- var lastInstance = this.instances[this.instances.length - 1];
- if (ts < lastInstance.creationTs)
- throw new Error('Cannot delete an id before it was created');
- if (lastInstance.deletionTs == Number.MAX_VALUE) {
- lastInstance.wasDeleted(ts);
- return lastInstance;
- }
-
- if (ts < lastInstance.deletionTs)
- throw new Error('id was already deleted earlier.');
-
- // A new instance was deleted with no snapshots in-between.
- // Create an instance then kill it.
- lastInstance = this.createObjectInstanceFunction_(
- this.parent, this.scopedId, category, name, ts);
- this.instances.push(lastInstance);
- lastInstance.wasDeleted(ts);
- return lastInstance;
- },
-
- getInstanceAt: function(ts) {
- var i = tr.b.findIndexInSortedIntervals(
- this.instances,
- function(inst) { return inst.creationTs; },
- function(inst) { return inst.deletionTs - inst.creationTs; },
- ts);
- if (i < 0) {
- if (this.instances[0].creationTsWasExplicit)
- return undefined;
- return this.instances[0];
- } else if (i >= this.instances.length) {
- return undefined;
- }
- return this.instances[i];
- },
-
- logToConsole: function() {
- for (var i = 0; i < this.instances.length; i++) {
- var instance = this.instances[i];
- var cEF = '';
- var dEF = '';
- if (instance.creationTsWasExplicit)
- cEF = '(explicitC)';
- if (instance.deletionTsWasExplicit)
- dEF = '(explicit)';
- console.log(instance.creationTs, cEF,
- instance.deletionTs, dEF,
- instance.category,
- instance.name,
- instance.snapshots.length + ' snapshots');
- }
- }
- };
-
- return {
- TimeToObjectInstanceMap: TimeToObjectInstanceMap
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/time_to_object_instance_map_test.html b/chromium/third_party/catapult/tracing/tracing/model/time_to_object_instance_map_test.html
deleted file mode 100644
index bcda0a2ea3b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/time_to_object_instance_map_test.html
+++ /dev/null
@@ -1,163 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/time_to_object_instance_map.html">
-<link rel="import" href="/tracing/model/object_instance.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var createObjectInstance = function(parent, id, category, name, creationTs) {
- return new tr.model.ObjectInstance(
- parent, id, category, name, creationTs);
- };
-
- test('timeToObjectInstanceMap', function() {
- var m = new tr.model.TimeToObjectInstanceMap(
- createObjectInstance, {}, 7);
- m.addSnapshot('cat', 'name', 10, 'a1');
- m.addSnapshot('cat', 'name', 20, 'a2');
- m.idWasDeleted('cat', 'name', 30);
- m.addSnapshot('cat', 'name', 40, 'b');
-
- assert.equal(m.instances.length, 2);
-
- var i0 = m.getInstanceAt(0);
- var i10 = m.getInstanceAt(10);
- assert.equal(i0, i10);
-
- assert.isDefined(i10);
- assert.equal(i10.snapshots.length, 2);
- assert.equal(i10.snapshots[0].args, 'a1');
- assert.equal(i10.snapshots[1].args, 'a2');
-
- assert.equal(i10.deletionTs, 30);
-
- var i15 = m.getInstanceAt(15);
- assert.equal(i15, i10);
-
- var i20 = m.getInstanceAt(20);
- assert.equal(i20, i10);
-
- var i30 = m.getInstanceAt(30);
- assert.isUndefined(i30);
-
- var i35 = m.getInstanceAt(35);
- assert.isUndefined(i35);
-
- var i40 = m.getInstanceAt(40);
- assert.isDefined(i40);
- assert.notEqual(i40, i10);
- assert.equal(i40.snapshots.length, 1);
- assert.equal(i40.creationTs, 40);
- assert.equal(i40.deletionTs, Number.MAX_VALUE);
-
- var i41 = m.getInstanceAt(41);
- assert.equal(i40, i41);
- });
-
- test('timeToObjectInstanceMapsBoundsLogic', function() {
- var m = new tr.model.TimeToObjectInstanceMap(
- createObjectInstance, {}, 7);
- m.addSnapshot('cat', 'name', 10, 'a1');
- m.addSnapshot('cat', 'name', 20, 'a2');
- m.idWasDeleted('cat', 'name', 30);
- m.addSnapshot('cat', 'name', 40, 'b');
- m.addSnapshot('cat', 'name', 41, 'b');
-
- m.instances.forEach(function(i) { i.updateBounds(); });
-
- var iA = m.getInstanceAt(10);
- assert.equal(iA.bounds.min, 10);
- assert.equal(iA.bounds.max, 30);
-
- var iB = m.getInstanceAt(40);
- assert.equal(iB.bounds.min, 40);
- assert.equal(iB.bounds.max, 41);
- });
-
- test('earlySnapshot', function() {
- var m = new tr.model.TimeToObjectInstanceMap(
- createObjectInstance, {}, 7);
- var i10 = m.idWasCreated('cat', 'name', 10, 'a1');
- m.idWasDeleted('cat', 'name', 20);
-
- assert.throws(function() {
- m.addSnapshot('cat', 'name', 5, 'a1');
- });
- assert.equal(i10.creationTs, 10);
- assert.equal(i10.deletionTs, 20);
- });
-
- test('earlySnapshotWithImplicitCreate', function() {
- var m = new tr.model.TimeToObjectInstanceMap(
- createObjectInstance, {}, 7);
- var i10 = m.idWasDeleted('cat', 'name', 20);
- m.addSnapshot('cat', 'name', 5, 'a1');
- assert.equal(i10.creationTs, 5);
- assert.equal(i10.deletionTs, 20);
- });
-
- test('getInstanceBeforeCreationImplicitCreate', function() {
- var m = new tr.model.TimeToObjectInstanceMap(
- createObjectInstance, {}, 7);
- var i10 = m.idWasCreated('cat', 'name', 10, 'a1');
- m.idWasDeleted('cat', 'name', 20);
- assert.isUndefined(m.getInstanceAt(5));
- });
-
- test('getInstanceBeforeCreationImplicitCreateWithSnapshot', function() {
- var m = new tr.model.TimeToObjectInstanceMap(
- createObjectInstance, {}, 7);
- var s5 = m.addSnapshot('cat', 'name', 5, 'a1');
- var i10 = m.idWasDeleted('cat', 'name', 20);
- assert.equal(m.getInstanceAt(5), i10);
- });
-
- test('successiveDeletions', function() {
- var m = new tr.model.TimeToObjectInstanceMap(
- createObjectInstance, {}, 7);
- var i20 = m.idWasDeleted('cat', 'name', 20);
- var i30 = m.idWasDeleted('cat', 'name', 30);
- var i40 = m.idWasDeleted('cat', 'name', 40);
- assert.equal(i20.creationTs, 20);
- assert.isFalse(i20.creationTsWasExplicit);
- assert.equal(i20.deletionTs, 20);
- assert.isTrue(i20.deletionTsWasExplicit);
-
- assert.equal(i30.creationTs, 30);
- assert.isFalse(i30.creationTsWasExplicit);
- assert.equal(i30.deletionTs, 30);
- assert.isTrue(i30.deletionTsWasExplicit);
-
-
- assert.equal(i40.creationTs, 40);
- assert.isFalse(i40.creationTsWasExplicit);
- assert.equal(i40.deletionTs, 40);
- assert.isTrue(i40.deletionTsWasExplicit);
- });
-
- test('snapshotAfterDeletion', function() {
- var m = new tr.model.TimeToObjectInstanceMap(
- createObjectInstance, {}, 7);
- var i10 = m.idWasCreated('cat', 'name', 10, 'a1');
- m.idWasDeleted('cat', 'name', 20);
-
- var s25 = m.addSnapshot('cat', 'name', 25, 'a1');
- var i25 = s25.objectInstance;
-
- assert.equal(i10.creationTs, 10);
- assert.equal(i10.deletionTs, 20);
- assert.notEqual(i25, i10);
- assert.equal(i25.creationTs, 25);
- assert.equal(i25.deletionTs, Number.MAX_VALUE);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/timed_event.html b/chromium/third_party/catapult/tracing/tracing/model/timed_event.html
deleted file mode 100644
index 381a8a2f455..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/timed_event.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/model/event.html">
-<link rel="import" href="/tracing/value/time_display_mode.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
- /**
- * TimedEvent is a base type for any entity in the trace model with a specific
- * start and duration.
- *
- * @constructor
- */
- function TimedEvent(start) {
- tr.model.Event.call(this);
- this.start = start;
- this.duration = 0;
- this.cpuStart = undefined;
- this.cpuDuration = undefined;
- // The set of contexts this event belongs to (order is unimportant). This
- // array should never be modified.
- this.contexts = Object.freeze([]);
- }
-
- TimedEvent.prototype = {
- __proto__: tr.model.Event.prototype,
-
- get end() {
- return this.start + this.duration;
- },
-
- addBoundsToRange: function(range) {
- range.addValue(this.start);
- range.addValue(this.end);
- },
-
- // Returns true if 'that' TimedEvent is fully contained within 'this' timed
- // event.
- bounds: function(that, opt_precisionUnit) {
- if (opt_precisionUnit === undefined)
- opt_precisionUnit = tr.v.TimeDisplayModes.ms;
-
- var startsBefore = opt_precisionUnit.roundedLess(that.start, this.start);
- var endsAfter = opt_precisionUnit.roundedLess(this.end, that.end);
- return !startsBefore && !endsAfter;
- }
- };
-
- return {
- TimedEvent: TimedEvent
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/timed_event_test.html b/chromium/third_party/catapult/tracing/tracing/model/timed_event_test.html
deleted file mode 100644
index 4beba912298..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/timed_event_test.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/timed_event.html">
-<link rel="import" href="/tracing/value/time_display_mode.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('bounds_startPrecision', function() {
- var unit = tr.v.TimeDisplayModes;
-
- var outer = new tr.model.TimedEvent(10.0001);
- outer.duration = 0.9999;
- var inner = new tr.model.TimedEvent(10.0000);
- inner.duration = 1.0000;
-
- assert.isTrue(outer.bounds(inner));
- assert.isTrue(outer.bounds(inner, unit.ms));
-
- assert.isFalse(outer.bounds(inner, unit.ns));
- });
-
- test('bounds_endPrecision', function() {
- var unit = tr.v.TimeDisplayModes;
-
- var outer = new tr.model.TimedEvent(10.0000);
- outer.duration = 0.9999;
- var inner = new tr.model.TimedEvent(10.0000);
- inner.duration = 1.0000;
-
- assert.isTrue(outer.bounds(inner));
- assert.isTrue(outer.bounds(inner, unit.ms));
-
- assert.isFalse(outer.bounds(inner, unit.ns));
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/user_model/animation_expectation.html b/chromium/third_party/catapult/tracing/tracing/model/user_model/animation_expectation.html
deleted file mode 100644
index 9d73f060d92..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/user_model/animation_expectation.html
+++ /dev/null
@@ -1,49 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/user_model/user_expectation.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model.um', function() {
- function AnimationExpectation(
- parentModel, initiatorTitle, start, duration) {
- tr.model.um.UserExpectation.call(
- this, parentModel, initiatorTitle, start, duration);
- this.frameEvents_ = undefined;
- }
-
- AnimationExpectation.prototype = {
- __proto__: tr.model.um.UserExpectation.prototype,
- constructor: AnimationExpectation,
-
- get frameEvents() {
- if (this.frameEvents_)
- return this.frameEvents_;
-
- this.frameEvents_ = new tr.model.EventSet();
-
- this.associatedEvents.forEach(function(event) {
- if (event.title === tr.model.helpers.IMPL_RENDERING_STATS)
- this.frameEvents_.push(event);
- }, this);
-
- return this.frameEvents_;
- }
- };
-
- tr.model.um.UserExpectation.register(AnimationExpectation, {
- stageTitle: 'Animation',
- colorId: tr.b.ColorScheme.getColorIdForReservedName('rail_animation')
- });
-
- return {
- AnimationExpectation: AnimationExpectation
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/user_model/idle_expectation.html b/chromium/third_party/catapult/tracing/tracing/model/user_model/idle_expectation.html
deleted file mode 100644
index 80c22c0483b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/user_model/idle_expectation.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/user_model/user_expectation.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model.um', function() {
- function IdleExpectation(parentModel, start, duration) {
- var initiatorTitle = '';
- tr.model.um.UserExpectation.call(
- this, parentModel, initiatorTitle, start, duration);
- }
-
- IdleExpectation.prototype = {
- __proto__: tr.model.um.UserExpectation.prototype,
- constructor: IdleExpectation
- };
-
- tr.model.um.UserExpectation.register(IdleExpectation, {
- stageTitle: 'Idle',
- colorId: tr.b.ColorScheme.getColorIdForReservedName('rail_idle')
- });
-
- return {
- IdleExpectation: IdleExpectation
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/user_model/load_expectation.html b/chromium/third_party/catapult/tracing/tracing/model/user_model/load_expectation.html
deleted file mode 100644
index a4ec0113fab..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/user_model/load_expectation.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/user_model/user_expectation.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model.um', function() {
- var LOAD_SUBTYPE_NAMES = {
- SUCCESSFUL: 'Successful',
- FAILED: 'Failed',
- };
-
- var DOES_LOAD_SUBTYPE_NAME_EXIST = {};
- for (var key in LOAD_SUBTYPE_NAMES) {
- DOES_LOAD_SUBTYPE_NAME_EXIST[LOAD_SUBTYPE_NAMES[key]] = true;;
- }
-
- function LoadExpectation(parentModel, initiatorTitle, start, duration) {
- if (!DOES_LOAD_SUBTYPE_NAME_EXIST[initiatorTitle])
- throw new Error(initiatorTitle + ' is not in LOAD_SUBTYPE_NAMES');
-
- tr.model.um.UserExpectation.call(
- this, parentModel, initiatorTitle, start, duration);
-
- // |renderProcess| is the renderer process that contains the loading
- // RenderFrame.
- this.renderProcess = undefined;
-
- // |renderMainThread| is the CrRendererMain thread in the |renderProcess|
- // that contains the loading RenderFrame.
- this.renderMainThread = undefined;
-
- // |routingId| identifies the loading RenderFrame within the renderer
- // process.
- this.routingId = undefined;
-
- // |parentRoutingId| identifies the RenderFrame that created and contains
- // the loading RenderFrame.
- this.parentRoutingId = undefined;
-
- // |loadFinishedEvent|, if present, signals that this is a main frame.
- this.loadFinishedEvent = undefined;
-
- // Startup LoadIRs do not have renderProcess, routingId, or
- // parentRoutingId. Maybe RenderLoadIR should be a separate class?
- }
-
- LoadExpectation.prototype = {
- __proto__: tr.model.um.UserExpectation.prototype,
- constructor: LoadExpectation
- };
-
- tr.model.um.UserExpectation.register(LoadExpectation, {
- stageTitle: 'Load',
- colorId: tr.b.ColorScheme.getColorIdForReservedName('rail_load')
- });
-
- return {
- LOAD_SUBTYPE_NAMES: LOAD_SUBTYPE_NAMES,
- LoadExpectation: LoadExpectation
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/user_model/response_expectation.html b/chromium/third_party/catapult/tracing/tracing/model/user_model/response_expectation.html
deleted file mode 100644
index 9608467cfa4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/user_model/response_expectation.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/user_model/user_expectation.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model.um', function() {
- function ResponseExpectation(
- parentModel, initiatorTitle, start, duration, opt_isAnimationBegin) {
- tr.model.um.UserExpectation.call(
- this, parentModel, initiatorTitle, start, duration);
- this.isAnimationBegin = opt_isAnimationBegin || false;
- }
-
- ResponseExpectation.prototype = {
- __proto__: tr.model.um.UserExpectation.prototype,
- constructor: ResponseExpectation
- };
-
- tr.model.um.UserExpectation.register(ResponseExpectation, {
- stageTitle: 'Response',
- colorId: tr.b.ColorScheme.getColorIdForReservedName('rail_response')
- });
-
- return {
- ResponseExpectation: ResponseExpectation
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/user_model/startup_expectation.html b/chromium/third_party/catapult/tracing/tracing/model/user_model/startup_expectation.html
deleted file mode 100644
index 630c79c2cb5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/user_model/startup_expectation.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/user_model/user_expectation.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model.um', function() {
- function StartupExpectation(parentModel, start, duration) {
- tr.model.um.UserExpectation.call(
- this, parentModel, '', start, duration);
- }
-
- StartupExpectation.prototype = {
- __proto__: tr.model.um.UserExpectation.prototype,
- constructor: StartupExpectation
- };
-
- tr.model.um.UserExpectation.register(StartupExpectation, {
- stageTitle: 'Startup',
- colorId: tr.b.ColorScheme.getColorIdForReservedName('startup')
- });
-
- return {
- StartupExpectation: StartupExpectation
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/user_model/stub_expectation.html b/chromium/third_party/catapult/tracing/tracing/model/user_model/stub_expectation.html
deleted file mode 100644
index d5445817e18..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/user_model/stub_expectation.html
+++ /dev/null
@@ -1,74 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/user_model/user_expectation.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Stub version of UserExpectation for testing.
- */
-tr.exportTo('tr.model.um', function() {
- function StubExpectation(args) {
- this.stageTitle_ = args.stageTitle || 'Idle';
- this.initiatorTitle_ = args.initiatorTitle || '';
-
- this.title_ = args.title;
- if (!this.title_) {
- var defaultTitle = [];
- if (this.initiatorTitle_)
- defaultTitle.push(this.initiatorTitle_);
- if (this.stageTitle_)
- defaultTitle.push(this.stageTitle_);
- this.title_ = defaultTitle.join(' ') || 'title';
- }
-
- this.normalizedUserComfort_ = args.normalizedUserComfort || 0;
- this.normalizedEfficiency_ = args.normalizedEfficiency || 0;
-
- var sd = tr.c.TestUtils.getStartAndDurationFromDict(args);
-
- tr.model.um.UserExpectation.call(
- this, args.parentModel, this.initiatorTitle, sd.start, sd.duration);
-
- // Must be set after base class call.
- this.colorId_ = args.colorId || 0;
-
- if (args.associatedEvents) {
- args.associatedEvents.forEach(function(event) {
- this.associatedEvents.push(event);
- }, this);
- }
- }
-
- StubExpectation.prototype = {
- __proto__: tr.model.um.UserExpectation.prototype,
-
- get colorId() {
- return this.colorId_;
- },
-
- get title() {
- return this.title_;
- },
-
- get stageTitle() {
- return this.stageTitle_;
- },
-
- get initiatorTitle() {
- return this.initiatorTitle_;
- }
- };
-
- return {
- StubExpectation: StubExpectation
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/user_model/user_expectation.html b/chromium/third_party/catapult/tracing/tracing/model/user_model/user_expectation.html
deleted file mode 100644
index 43e8888740c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/user_model/user_expectation.html
+++ /dev/null
@@ -1,151 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range_utils.html">
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/model/compound_event_selection_state.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/timed_event.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model.um', function() {
- var CompoundEventSelectionState = tr.model.CompoundEventSelectionState;
-
- function UserExpectation(parentModel, initiatorTitle, start, duration) {
- tr.model.TimedEvent.call(this, start);
- this.associatedEvents = new tr.model.EventSet();
- this.duration = duration;
- this.initiatorTitle_ = initiatorTitle;
- this.parentModel = parentModel;
- this.typeInfo_ = undefined;
-
- // sourceEvents are the ones that caused the UserModelBuilder to create this
- // UserExpectation.
- this.sourceEvents = new tr.model.EventSet();
- }
-
- UserExpectation.prototype = {
- __proto__: tr.model.TimedEvent.prototype,
-
- computeCompoundEvenSelectionState: function(selection) {
- var cess = CompoundEventSelectionState.NOT_SELECTED;
- if (selection.contains(this))
- cess |= CompoundEventSelectionState.EVENT_SELECTED;
-
- if (this.associatedEvents.intersectionIsEmpty(selection))
- return cess;
-
- var allContained = this.associatedEvents.every(function(event) {
- return selection.contains(event);
- });
-
- if (allContained)
- cess |= CompoundEventSelectionState.ALL_ASSOCIATED_EVENTS_SELECTED;
- else
- cess |= CompoundEventSelectionState.SOME_ASSOCIATED_EVENTS_SELECTED;
- return cess;
- },
-
- // Returns samples which are overlapping with V8.Execute
- get associatedSamples() {
- var samples = new tr.model.EventSet();
- this.associatedEvents.forEach(function(event) {
- if (event instanceof tr.model.ThreadSlice)
- samples.addEventSet(event.overlappingSamples);
- });
- return samples;
- },
-
- get userFriendlyName() {
- return this.title + ' User Expectation at ' +
- tr.v.Unit.byName.timeStampInMs.format(this.start);
- },
-
- get stableId() {
- return ('UserExpectation.' + this.guid);
- },
-
- get typeInfo() {
- if (!this.typeInfo_)
- this.typeInfo_ = UserExpectation.findTypeInfo(this.constructor);
-
- // If you set Subclass.prototype = {}, then you must explicitly specify
- // constructor in that prototype object!
- // http://javascript.info/tutorial/constructor
-
- if (!this.typeInfo_)
- throw new Error('Unregistered UserExpectation');
-
- return this.typeInfo_;
- },
-
- get colorId() {
- return this.typeInfo.metadata.colorId;
- },
-
- get stageTitle() {
- return this.typeInfo.metadata.stageTitle;
- },
-
- get initiatorTitle() {
- return this.initiatorTitle_;
- },
-
- get title() {
- if (!this.initiatorTitle)
- return this.stageTitle;
-
- return this.initiatorTitle + ' ' + this.stageTitle;
- },
-
- /**
- * Returns the sum of the number of CPU ms spent by this UserExpectation.
- */
- get totalCpuMs() {
- var cpuMs = 0;
- this.associatedEvents.forEach(function(event) {
- if (event.cpuSelfTime)
- cpuMs += event.cpuSelfTime;
- });
- return cpuMs;
- }
- };
-
- var options = new tr.b.ExtensionRegistryOptions(tr.b.BASIC_REGISTRY_MODE);
- tr.b.decorateExtensionRegistry(UserExpectation, options);
-
- UserExpectation.addEventListener('will-register', function(e) {
- var metadata = e.typeInfo.metadata;
-
- if (metadata.stageTitle === undefined) {
- throw new Error('Registered UserExpectations must provide ' +
- 'stageTitle');
- }
-
- if (metadata.colorId === undefined) {
- throw new Error('Registered UserExpectations must provide ' +
- 'colorId');
- }
- });
-
- tr.model.EventRegistry.register(
- UserExpectation,
- {
- name: 'user-expectation',
- pluralName: 'user-expectations',
- singleViewElementName: 'tr-ui-a-single-user-expectation-sub-view',
- multiViewElementName: 'tr-ui-a-multi-user-expectation-sub-view'
- });
-
- return {
- UserExpectation: UserExpectation
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/user_model/user_model.html b/chromium/third_party/catapult/tracing/tracing/model/user_model/user_model.html
deleted file mode 100644
index fd30d6a610b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/user_model/user_model.html
+++ /dev/null
@@ -1,67 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_container.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model.um', function() {
- function UserModel(parentModel) {
- tr.model.EventContainer.call(this);
- this.parentModel_ = parentModel;
- this.expectations_ = new tr.model.EventSet();
- }
-
- UserModel.prototype = {
- __proto__: tr.model.EventContainer.prototype,
-
- get stableId() {
- return 'UserModel';
- },
-
- get parentModel() {
- return this.parentModel_;
- },
-
- sortExpectations: function() {
- Array.prototype.sort.call(this.expectations_, function(x, y) {
- return x.start - y.start;
- });
- },
-
- get expectations() {
- return this.expectations_;
- },
-
- shiftTimestampsForward: function(amount) {
- },
-
- addCategoriesToDict: function(categoriesDict) {
- },
-
- childEvents: function*() {
- yield * this.expectations;
- },
-
- childEventContainers: function*() {
- },
-
- updateBounds: function() {
- this.bounds.reset();
- this.expectations.forEach(function(expectation) {
- expectation.addBoundsToRange(this.bounds);
- }, this);
- }
- };
-
- return {
- UserModel: UserModel
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/model/vm_region.html b/chromium/third_party/catapult/tracing/tracing/model/vm_region.html
deleted file mode 100644
index 45ce7f37206..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/vm_region.html
+++ /dev/null
@@ -1,389 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides classes for representing and classifying VM regions.
- *
- * See https://goo.gl/5SSPv0 for more details.
- */
-tr.exportTo('tr.model', function() {
-
- /**
- * A single virtual memory region (also called a memory map).
- *
- * @constructor
- */
- function VMRegion(startAddress, sizeInBytes, protectionFlags,
- mappedFile, byteStats) {
- this.startAddress = startAddress;
- this.sizeInBytes = sizeInBytes;
- this.protectionFlags = protectionFlags;
- this.mappedFile = mappedFile || '';
- this.byteStats = byteStats || {};
- };
-
- VMRegion.PROTECTION_FLAG_READ = 4;
- VMRegion.PROTECTION_FLAG_WRITE = 2;
- VMRegion.PROTECTION_FLAG_EXECUTE = 1;
- VMRegion.PROTECTION_FLAG_MAYSHARE = 128;
-
- VMRegion.prototype = {
- get uniqueIdWithinProcess() {
- // This value is assumed to be unique within a process.
- return this.mappedFile + '#' + this.startAddress;
- },
-
- get protectionFlagsToString() {
- if (this.protectionFlags === undefined)
- return undefined;
- return (
- (this.protectionFlags & VMRegion.PROTECTION_FLAG_READ ? 'r' : '-') +
- (this.protectionFlags & VMRegion.PROTECTION_FLAG_WRITE ? 'w' : '-') +
- (this.protectionFlags & VMRegion.PROTECTION_FLAG_EXECUTE ?
- 'x' : '-') +
- (this.protectionFlags & VMRegion.PROTECTION_FLAG_MAYSHARE ? 's' : 'p')
- );
- }
- };
-
- VMRegion.fromDict = function(dict) {
- return new VMRegion(
- dict.startAddress,
- dict.sizeInBytes,
- dict.protectionFlags,
- dict.mappedFile,
- dict.byteStats);
- };
-
- /**
- * Node in a VM region classification tree.
- *
- * Note: Most users of this class should use the
- * VMRegionClassificationNode.fromRegions static method instead of this
- * constructor because it leads to better performance due to fewer memory
- * allocations.
- *
- * @constructor
- */
- function VMRegionClassificationNode(opt_rule) {
- this.rule_ = opt_rule || VMRegionClassificationNode.CLASSIFICATION_RULES;
-
- // True iff this node or any of its descendant classification nodes has at
- // least one classified VM region.
- this.hasRegions = false;
-
- // Total virtual size and byte stats of all regions matching this node's
- // rule (including its sub-rules).
- this.sizeInBytes = undefined;
- this.byteStats = {};
-
- // Array of child classification nodes if this is an intermediate node.
- this.children_ = undefined;
-
- // Array of VM regions. If this is an intermediate node, then the regions
- // are cached for lazy tree construction (i.e. its child classification
- // nodes yet have to be built).
- this.regions_ = [];
- }
-
- /**
- * Rules for classifying memory maps.
- *
- * These rules are derived from core/jni/android_os_Debug.cpp in Android.
- */
- VMRegionClassificationNode.CLASSIFICATION_RULES = {
- name: 'Total',
- children: [
- {
- name: 'Android',
- file: /^\/dev\/ashmem(?!\/libc malloc)/,
- children: [
- {
- name: 'Java runtime',
- file: /^\/dev\/ashmem\/dalvik-/,
- children: [
- {
- name: 'Spaces',
- file: /\/dalvik-(alloc|main|large object|non moving|zygote) space/, // @suppress longLineCheck
- children: [
- {
- name: 'Normal',
- file: /\/dalvik-(alloc|main)/
- },
- {
- name: 'Large',
- file: /\/dalvik-large object/
- },
- {
- name: 'Zygote',
- file: /\/dalvik-zygote/
- },
- {
- name: 'Non-moving',
- file: /\/dalvik-non moving/
- }
- ]
- },
- {
- name: 'Linear Alloc',
- file: /\/dalvik-LinearAlloc/
- },
- {
- name: 'Indirect Reference Table',
- file: /\/dalvik-indirect.ref/
- },
- {
- name: 'Cache',
- file: /\/dalvik-jit-code-cache/
- },
- {
- name: 'Accounting'
- }
- ]
- },
- {
- name: 'Cursor',
- file: /\/CursorWindow/
- },
- {
- name: 'Ashmem'
- }
- ]
- },
- {
- name: 'Native heap',
- file: /^((\[heap\])|(\[anon:)|(\/dev\/ashmem\/libc malloc)|(\[discounted tracing overhead\])|$)/ // @suppress longLineCheck
- },
- {
- name: 'Stack',
- file: /^\[stack/
- },
- {
- name: 'Files',
- file: /\.((((jar)|(apk)|(ttf)|(odex)|(oat)|(art))$)|(dex)|(so))/,
- children: [
- {
- name: 'so',
- file: /\.so/
- },
- {
- name: 'jar',
- file: /\.jar$/
- },
- {
- name: 'apk',
- file: /\.apk$/
- },
- {
- name: 'ttf',
- file: /\.ttf$/
- },
- {
- name: 'dex',
- file: /\.((dex)|(odex$))/
- },
- {
- name: 'oat',
- file: /\.oat$/
- },
- {
- name: 'art',
- file: /\.art$/
- }
- ]
- },
- {
- name: 'Devices',
- file: /(^\/dev\/)|(anon_inode:dmabuf)/,
- children: [
- {
- name: 'GPU',
- file: /\/((nv)|(mali)|(kgsl))/
- },
- {
- name: 'DMA',
- file: /anon_inode:dmabuf/
- }
- ]
- }
- ]
- };
- VMRegionClassificationNode.OTHER_RULE = { name: 'Other' };
-
- VMRegionClassificationNode.fromRegions = function(regions, opt_rules) {
- var tree = new VMRegionClassificationNode(opt_rules);
- tree.regions_ = regions;
- for (var i = 0; i < regions.length; i++)
- tree.addStatsFromRegion_(regions[i]);
- return tree;
- };
-
- VMRegionClassificationNode.prototype = {
- get title() {
- return this.rule_.name;
- },
-
- get children() {
- if (this.isLeafNode)
- return undefined; // Leaf nodes don't have children (by definition).
- if (this.children_ === undefined)
- this.buildTree_(); // Lazily classify VM regions.
- return this.children_;
- },
-
- get regions() {
- if (!this.isLeafNode) {
- // Intermediate nodes only temporarily cache VM regions for lazy tree
- // construction.
- return undefined;
- }
- return this.regions_;
- },
-
- get allRegionsForTesting() {
- if (this.regions_ !== undefined) {
- if (this.children_ !== undefined) {
- throw new Error('Internal error: a VM region classification node ' +
- 'cannot have both regions and children');
- }
- // Leaf node (or caching internal node).
- return this.regions_;
- }
-
- // Intermediate node.
- var regions = [];
- this.children_.forEach(function(childNode) {
- regions = regions.concat(childNode.allRegionsForTesting);
- });
- return regions;
- },
-
- get isLeafNode() {
- var children = this.rule_.children;
- return children === undefined || children.length === 0;
- },
-
- addRegion: function(region) {
- this.addRegionRecursively_(region, true /* addStatsToThisNode */);
- },
-
- someRegion: function(fn, opt_this) {
- if (this.regions_ !== undefined) {
- // Leaf node (or caching internal node).
- return this.regions_.some(fn, opt_this);
- }
-
- // Intermediate node.
- return this.children_.some(function(childNode) {
- return childNode.someRegion(fn, opt_this);
- });
- },
-
- addRegionRecursively_: function(region, addStatsToThisNode) {
- if (addStatsToThisNode)
- this.addStatsFromRegion_(region);
-
- if (this.regions_ !== undefined) {
- if (this.children_ !== undefined) {
- throw new Error('Internal error: a VM region classification node ' +
- 'cannot have both regions and children');
- }
- // Leaf node or an intermediate node caching VM regions (add the
- // region to this node and don't classify further).
- this.regions_.push(region);
- return;
- }
-
- // Non-leaf rule (classify region row further down the tree).
- function regionRowMatchesChildNide(child) {
- var fileRegExp = child.rule_.file;
- if (fileRegExp === undefined)
- return true;
- return fileRegExp.test(region.mappedFile);
- }
-
- var matchedChild = tr.b.findFirstInArray(
- this.children_, regionRowMatchesChildNide);
- if (matchedChild === undefined) {
- // Region belongs to the 'Other' node (created lazily).
- if (this.children_.length !== this.rule_.children.length)
- throw new Error('Internal error');
- matchedChild = new VMRegionClassificationNode(
- VMRegionClassificationNode.OTHER_RULE);
- this.children_.push(matchedChild);
- }
-
- matchedChild.addRegionRecursively_(region, true);
- },
-
- buildTree_: function() {
- var cachedRegions = this.regions_;
- this.regions_ = undefined;
-
- this.buildChildNodesRecursively_();
- for (var i = 0; i < cachedRegions.length; i++) {
- // Note that we don't add the VM region's stats to this node because
- // they have already been added to it.
- this.addRegionRecursively_(
- cachedRegions[i], false /* addStatsToThisNode */);
- }
- },
-
- buildChildNodesRecursively_: function() {
- if (this.children_ !== undefined) {
- throw new Error(
- 'Internal error: Classification node already has children');
- }
- if (this.regions_ !== undefined && this.regions_.length !== 0) {
- throw new Error(
- 'Internal error: Classification node should have no regions');
- }
-
- if (this.isLeafNode)
- return; // Leaf node: Nothing to do.
-
- // Intermediate node: Clear regions and build children recursively.
- this.regions_ = undefined;
- this.children_ = this.rule_.children.map(function(childRule) {
- var child = new VMRegionClassificationNode(childRule);
- child.buildChildNodesRecursively_();
- return child;
- });
- },
-
- addStatsFromRegion_: function(region) {
- this.hasRegions = true;
-
- // Aggregate virtual size.
- var regionSizeInBytes = region.sizeInBytes;
- if (regionSizeInBytes !== undefined)
- this.sizeInBytes = (this.sizeInBytes || 0) + regionSizeInBytes;
-
- // Aggregate byte stats.
- var thisByteStats = this.byteStats;
- var regionByteStats = region.byteStats;
- for (var byteStatName in regionByteStats) {
- var regionByteStatValue = regionByteStats[byteStatName];
- if (regionByteStatValue === undefined)
- continue;
- thisByteStats[byteStatName] =
- (thisByteStats[byteStatName] || 0) + regionByteStatValue;
- }
- }
- };
-
- return {
- VMRegion: VMRegion,
- VMRegionClassificationNode: VMRegionClassificationNode
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/vm_region_test.html b/chromium/third_party/catapult/tracing/tracing/model/vm_region_test.html
deleted file mode 100644
index a57c0e9d039..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/vm_region_test.html
+++ /dev/null
@@ -1,1071 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var VMRegion = tr.model.VMRegion;
- var VMRegionClassificationNode = tr.model.VMRegionClassificationNode;
- var checkVMRegions = tr.model.MemoryDumpTestUtils.checkVMRegions;
-
- function checkProtectionFlagsToString(protectionFlags, expectedString) {
- var vmRegion = VMRegion.fromDict({
- startAddress: 256,
- sizeInBytes: 336,
- protectionFlags: protectionFlags,
- mappedFile: '[stack:20310]',
- byteStats: {
- privateDirtyResident: 96,
- swapped: 144,
- proportionalResident: 158
- }
- });
- assert.strictEqual(vmRegion.protectionFlagsToString, expectedString);
- }
-
- var TEST_RULES = {
- name: 'Root',
- children: [
- {
- name: 'Words',
- file: /^[a-zA-Z]/,
- children: [
- {
- name: 'A-D',
- file: /^[a-dA-D]/
- },
- {
- name: 'E-H',
- file: /^[e-hE-H]/
- }
- ]
- },
- {
- name: 'Digits',
- file: /\d$/,
- children: []
- }
- ]
- };
-
- // Constant representing the expectation that the children of a
- // VMRegionClassificationNode have not been built yet.
- var CHILDREN_NOT_BUILT_YET = {};
-
- function checkTree(node, expectedStructure) {
- assert.strictEqual(node.title, expectedStructure.title);
- assert.strictEqual(node.hasRegions, expectedStructure.hasRegions);
- assert.strictEqual(node.sizeInBytes, expectedStructure.sizeInBytes);
- assert.deepEqual(node.byteStats, expectedStructure.byteStats || {});
- assert.strictEqual(node.isLeafNode, expectedStructure.isLeafNode);
-
- var actualRegions = node.regions;
- var expectedRegions = expectedStructure.regions;
- if (expectedRegions === undefined) {
- assert.isUndefined(actualRegions);
- } else {
- assert.instanceOf(actualRegions, Array);
- checkVMRegions(actualRegions, expectedRegions);
- }
-
- var expectedChildren = expectedStructure.children;
- if (expectedChildren === CHILDREN_NOT_BUILT_YET) {
- assert.isUndefined(node.children_);
- } else if (expectedChildren === undefined) {
- assert.isUndefined(node.children);
- } else {
- var actualChildrenMap = new Map();
- node.children.forEach(function(childNode) {
- actualChildrenMap.set(childNode.title, childNode);
- });
- var expectedChildrenMap = new Map();
- expectedChildren.forEach(function(childNode) {
- expectedChildrenMap.set(childNode.title, childNode);
- });
- assert.strictEqual(actualChildrenMap.size, expectedChildrenMap.size);
- for (var title of expectedChildrenMap.keys()) {
- checkTree(actualChildrenMap.get(title),
- expectedChildrenMap.get(title));
- }
- }
- }
-
- function checkClassificationRules(mappedFile, expectedPath) {
- var region = VMRegion.fromDict({
- mappedFile: mappedFile,
- sizeInBytes: 16,
- byteStats: {
- privateDirtyResident: 7
- }
- });
- var node = VMRegionClassificationNode.fromRegions([region]);
- expectedPath.forEach(function(title) {
- node = tr.b.findFirstInArray(node.children, function(childNode) {
- return childNode.title === title;
- });
- });
- assert.deepEqual(node.regions, [region]);
- }
-
- test('vmRegion_protectionFlagsToString', function() {
- checkProtectionFlagsToString(undefined, undefined);
- checkProtectionFlagsToString(0, '---p');
- checkProtectionFlagsToString(VMRegion.PROTECTION_FLAG_READ, 'r--p');
- checkProtectionFlagsToString(
- VMRegion.PROTECTION_FLAG_READ | VMRegion.PROTECTION_FLAG_MAYSHARE,
- 'r--s');
- checkProtectionFlagsToString(
- VMRegion.PROTECTION_FLAG_READ | VMRegion.PROTECTION_FLAG_EXECUTE,
- 'r-xp');
- checkProtectionFlagsToString(
- VMRegion.PROTECTION_FLAG_READ | VMRegion.PROTECTION_FLAG_WRITE,
- 'rw-p');
- checkProtectionFlagsToString(
- VMRegion.PROTECTION_FLAG_READ | VMRegion.PROTECTION_FLAG_WRITE |
- VMRegion.PROTECTION_FLAG_EXECUTE,
- 'rwxp');
- checkProtectionFlagsToString(
- VMRegion.PROTECTION_FLAG_READ | VMRegion.PROTECTION_FLAG_WRITE |
- VMRegion.PROTECTION_FLAG_MAYSHARE,
- 'rw-s');
- checkProtectionFlagsToString(
- VMRegion.PROTECTION_FLAG_READ | VMRegion.PROTECTION_FLAG_EXECUTE |
- VMRegion.PROTECTION_FLAG_MAYSHARE,
- 'r-xs');
- checkProtectionFlagsToString(
- VMRegion.PROTECTION_FLAG_READ | VMRegion.PROTECTION_FLAG_WRITE |
- VMRegion.PROTECTION_FLAG_EXECUTE |
- VMRegion.PROTECTION_FLAG_MAYSHARE,
- 'rwxs');
- });
-
- // The add(After|Before)Build tests below check that the classification tree
- // has the correct structure regardless of the ordering of adding regions and
- // the lazy construction.
-
- test('vmRegionClassificationNode_constructor_addAfterBuild', function() {
- var rootNode = new VMRegionClassificationNode(TEST_RULES);
-
- // Check the root node and verify that the full tree structure has *not*
- // been constructed yet.
- checkTree(rootNode, {
- title: 'Root',
- hasRegions: false,
- isLeafNode: false,
- children: CHILDREN_NOT_BUILT_YET
- });
-
- // Reading the children of the root node *should* trigger building the
- // full tree.
- checkTree(rootNode, {
- title: 'Root',
- hasRegions: false,
- isLeafNode: false,
- children: [
- {
- title: 'Words',
- hasRegions: false,
- isLeafNode: false,
- children: [
- {
- title: 'A-D',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- },
- {
- title: 'E-H',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- }
- ]
- },
- {
- title: 'Digits',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- }
- ]
- });
-
- // Add VM regions to the tree *after* it has been fully built.
- rootNode.addRegion(VMRegion.fromDict({
- mappedFile: 'W2', // Root/Words/Other.
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- }
- }));
- rootNode.addRegion(VMRegion.fromDict({
- mappedFile: '__42', // Root/Digits.
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77
- }
- }));
- checkTree(rootNode, {
- title: 'Root',
- hasRegions: true,
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32 + 33,
- privateDirtyResident: 77,
- swapped: 64
- },
- isLeafNode: false,
- children: [
- {
- title: 'Words',
- hasRegions: true,
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- },
- isLeafNode: false,
- children: [
- {
- title: 'A-D',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- },
- {
- title: 'E-H',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- },
- {
- title: 'Other',
- hasRegions: true,
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- },
- isLeafNode: true,
- regions: [
- {
- mappedFile: 'W2',
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- }
- }
- ]
- }
- ]
- },
- {
- title: 'Digits',
- hasRegions: true,
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77
- },
- isLeafNode: true,
- regions: [
- {
- mappedFile: '__42',
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77
- }
- }
- ]
- }
- ]
- });
- });
-
- test('vmRegionClassificationNode_constructor_addBeforeBuild', function() {
- var rootNode = new VMRegionClassificationNode(TEST_RULES);
-
- // Add regions to the tree *before* it has been fully built. This should
- // *not* trigger building the full tree (but the total sizeInBytes and
- // byteStats should be updated accordingly).
- rootNode.addRegion(VMRegion.fromDict({
- mappedFile: '__42', // Root/Digits.
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77
- }
- }));
- rootNode.addRegion(VMRegion.fromDict({
- mappedFile: 'W2', // Root/Words/Other.
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- }
- }));
- checkTree(rootNode, {
- title: 'Root',
- hasRegions: true,
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32 + 33,
- privateDirtyResident: 77,
- swapped: 64
- },
- isLeafNode: false,
- children: CHILDREN_NOT_BUILT_YET
- });
-
- // Reading the children of the root node should trigger building the full
- // tree.
- checkTree(rootNode, {
- title: 'Root',
- hasRegions: true,
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32 + 33,
- privateDirtyResident: 77,
- swapped: 64
- },
- isLeafNode: false,
- children: [
- {
- title: 'Words',
- hasRegions: true,
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- },
- isLeafNode: false,
- children: [
- {
- title: 'A-D',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- },
- {
- title: 'E-H',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- },
- {
- title: 'Other',
- hasRegions: true,
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- },
- isLeafNode: true,
- regions: [
- {
- mappedFile: 'W2',
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- }
- }
- ]
- }
- ]
- },
- {
- title: 'Digits',
- hasRegions: true,
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77
- },
- isLeafNode: true,
- regions: [
- {
- mappedFile: '__42',
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77
- }
- }
- ]
- }
- ]
- });
-
- // Add more VM regions *after* the tree has been fully built.
- rootNode.addRegion(VMRegion.fromDict({
- mappedFile: '%invalid%', // Root/Other.
- sizeInBytes: 123
- }));
- rootNode.addRegion(VMRegion.fromDict({
- mappedFile: '__43', // Root/Digits.
- byteStats: {
- swapped: 19
- }
- }));
- rootNode.addRegion(VMRegion.fromDict({
- mappedFile: 'free', // Root/Words/E-H.
- sizeInBytes: undefined
- }));
- checkTree(rootNode, {
- title: 'Root',
- hasRegions: true,
- sizeInBytes: 16 + 123,
- byteStats: {
- proportionalResident: 32 + 33,
- privateDirtyResident: 77,
- swapped: 64 + 19,
- },
- isLeafNode: false,
- children: [
- {
- title: 'Words',
- hasRegions: true,
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- },
- isLeafNode: false,
- children: [
- {
- title: 'A-D',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- },
- {
- title: 'E-H',
- hasRegions: true,
- isLeafNode: true,
- regions: [
- {
- mappedFile: 'free'
- }
- ]
- },
- {
- title: 'Other',
- hasRegions: true,
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- },
- isLeafNode: true,
- regions: [
- {
- mappedFile: 'W2',
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- }
- }
- ]
- }
- ]
- },
- {
- title: 'Digits',
- hasRegions: true,
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77,
- swapped: 19
- },
- isLeafNode: true,
- regions: [
- {
- mappedFile: '__42',
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77
- }
- },
- {
- mappedFile: '__43',
- byteStats: {
- swapped: 19
- }
- }
- ]
- },
- {
- title: 'Other',
- hasRegions: true,
- sizeInBytes: 123,
- isLeafNode: true,
- regions: [
- {
- mappedFile: '%invalid%',
- sizeInBytes: 123
- }
- ]
- }
- ]
- });
- });
-
- test('vmRegionClassificationNode_fromRegions_addAfterBuild', function() {
- // Construct the root node from a list of regions. This should *not*
- // trigger building the full tree (but the total sizeInBytes and byteStats
- // should be updated accordingly).
- var rootNode = VMRegionClassificationNode.fromRegions([
- VMRegion.fromDict({
- mappedFile: '__42', // Root/Digits.
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77
- }
- }),
- VMRegion.fromDict({
- mappedFile: '__43', // Root/Digits.
- byteStats: {
- swapped: 19
- }
- })
- ], TEST_RULES);
- checkTree(rootNode, {
- title: 'Root',
- hasRegions: true,
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77,
- swapped: 19
- },
- isLeafNode: false,
- children: CHILDREN_NOT_BUILT_YET
- });
-
- // Reading the children of the root node should trigger building the full
- // tree.
- checkTree(rootNode, {
- title: 'Root',
- hasRegions: true,
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77,
- swapped: 19
- },
- isLeafNode: false,
- children: [
- {
- title: 'Words',
- hasRegions: false,
- isLeafNode: false,
- children: [
- {
- title: 'A-D',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- },
- {
- title: 'E-H',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- }
- ]
- },
- {
- title: 'Digits',
- hasRegions: true,
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77,
- swapped: 19
- },
- isLeafNode: true,
- regions: [
- {
- mappedFile: '__42',
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77
- }
- },
- {
- mappedFile: '__43',
- byteStats: {
- swapped: 19
- }
- }
- ]
- }
- ]
- });
-
- // Add more VM regions *after* the tree has been fully built.
- rootNode.addRegion(VMRegion.fromDict({
- mappedFile: 'W2', // Root/Words/Other.
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- }
- }));
- checkTree(rootNode, {
- title: 'Root',
- hasRegions: true,
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32 + 33,
- privateDirtyResident: 77,
- swapped: 19 + 64,
- },
- isLeafNode: false,
- children: [
- {
- title: 'Words',
- hasRegions: true,
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- },
- isLeafNode: false,
- children: [
- {
- title: 'A-D',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- },
- {
- title: 'E-H',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- },
- {
- title: 'Other',
- hasRegions: true,
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- },
- isLeafNode: true,
- regions: [
- {
- mappedFile: 'W2',
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- }
- }
- ]
- }
- ]
- },
- {
- title: 'Digits',
- hasRegions: true,
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77,
- swapped: 19
- },
- isLeafNode: true,
- regions: [
- {
- mappedFile: '__42',
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77
- }
- },
- {
- mappedFile: '__43',
- byteStats: {
- swapped: 19
- }
- }
- ]
- }
- ]
- });
- });
-
- test('vmRegionClassificationNode_fromRegions_addBeforeBuild', function() {
- // Construct the root node from a list of regions and then add another
- // region. This should *not* trigger building the full tree (but the total
- // sizeInBytes and byteStats should be updated accordingly).
- var rootNode = VMRegionClassificationNode.fromRegions([
- VMRegion.fromDict({
- mappedFile: '__42', // Root/Digits.
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77
- }
- }),
- VMRegion.fromDict({
- mappedFile: '__43', // Root/Digits.
- byteStats: {
- swapped: 19
- }
- })
- ], TEST_RULES);
- rootNode.addRegion(VMRegion.fromDict({
- mappedFile: '__42', // Root/Digits.
- startAddress: 2048, // Necessary to distinguish from the first region.
- sizeInBytes: 1000,
- byteStats: {
- privateDirtyResident: 500
- }
- }));
- checkTree(rootNode, {
- title: 'Root',
- hasRegions: true,
- sizeInBytes: 1000,
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77 + 500,
- swapped: 19
- },
- isLeafNode: false,
- children: CHILDREN_NOT_BUILT_YET
- });
-
- // Reading the children of the root node should trigger building the full
- // tree.
- checkTree(rootNode, {
- title: 'Root',
- hasRegions: true,
- sizeInBytes: 1000,
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77 + 500,
- swapped: 19
- },
- isLeafNode: false,
- children: [
- {
- title: 'Words',
- hasRegions: false,
- isLeafNode: false,
- children: [
- {
- title: 'A-D',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- },
- {
- title: 'E-H',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- }
- ]
- },
- {
- title: 'Digits',
- hasRegions: true,
- sizeInBytes: 1000,
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77 + 500,
- swapped: 19
- },
- isLeafNode: true,
- regions: [
- {
- mappedFile: '__42',
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77
- }
- },
- {
- mappedFile: '__43',
- byteStats: {
- swapped: 19
- }
- },
- {
- mappedFile: '__42',
- startAddress: 2048,
- sizeInBytes: 1000,
- byteStats: {
- privateDirtyResident: 500
- }
- }
- ]
- }
- ]
- });
-
- // Add more VM regions *after* the tree has been fully built.
- rootNode.addRegion(VMRegion.fromDict({
- mappedFile: 'W2', // Root/Words/Other.
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- }
- }));
- checkTree(rootNode, {
- title: 'Root',
- hasRegions: true,
- sizeInBytes: 1000 + 16,
- byteStats: {
- proportionalResident: 32 + 33,
- privateDirtyResident: 500 + 77,
- swapped: 19 + 64,
- },
- isLeafNode: false,
- children: [
- {
- title: 'Words',
- hasRegions: true,
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- },
- isLeafNode: false,
- children: [
- {
- title: 'A-D',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- },
- {
- title: 'E-H',
- hasRegions: false,
- isLeafNode: true,
- regions: []
- },
- {
- title: 'Other',
- hasRegions: true,
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- },
- isLeafNode: true,
- regions: [
- {
- mappedFile: 'W2',
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- }
- }
- ]
- }
- ]
- },
- {
- title: 'Digits',
- hasRegions: true,
- sizeInBytes: 1000,
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 500 + 77,
- swapped: 19
- },
- isLeafNode: true,
- regions: [
- {
- mappedFile: '__42',
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77
- }
- },
- {
- mappedFile: '__43',
- byteStats: {
- swapped: 19
- }
- },
- {
- mappedFile: '__42',
- startAddress: 2048,
- sizeInBytes: 1000,
- byteStats: {
- privateDirtyResident: 500
- }
- }
- ]
- }
- ]
- });
- });
-
- test('vmRegionClassificationNode_someRegion', function() {
- var rootNode = new VMRegionClassificationNode(TEST_RULES);
-
- // There are no regions in the tree, so the method should always return
- // false.
- assert.isFalse(rootNode.someRegion(function(region) {
- throw new Error('There are no regions in the tree!!!');
- }));
-
- rootNode.addRegion(VMRegion.fromDict({
- mappedFile: 'W2', // Root/Words/Other.
- sizeInBytes: 16,
- byteStats: {
- proportionalResident: 32,
- swapped: 64
- }
- }));
- rootNode.addRegion(VMRegion.fromDict({
- mappedFile: '__42', // Root/Digits.
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77
- }
- }));
- rootNode.addRegion(VMRegion.fromDict({
- mappedFile: '__43', // Root/Digits.
- byteStats: {
- proportionalResident: 33,
- privateDirtyResident: 77
- }
- }));
-
- function checkSomeRegion() {
- // Find the order in which the regions are traversed and checked that all
- // regions were visited.
- var visitedRegionMappedFiles = [];
- assert.isFalse(rootNode.someRegion(function(region) {
- visitedRegionMappedFiles.push(region.mappedFile);
- return false;
- }));
- assert.lengthOf(visitedRegionMappedFiles, 3);
- assert.sameMembers(visitedRegionMappedFiles, ['W2', '__42', '__43']);
-
- // Assuming the traversal order is deterministic, we check that once the
- // callback returns true, no further regions are visited.
- visitedRegionMappedFiles.forEach(
- function(mappedFileToMatch, index) {
- var visitedRegionMappedFiles2 = [];
- assert.isTrue(rootNode.someRegion(function(region) {
- this.files.push(region.mappedFile);
- return region.mappedFile === mappedFileToMatch;
- }, { files: visitedRegionMappedFiles2 } /* opt_this */));
- assert.deepEqual(visitedRegionMappedFiles2,
- visitedRegionMappedFiles.slice(0, index + 1));
- });
- }
-
- // Before lazy construction (single node with a flat list of regions).
- checkSomeRegion();
- assert.isUndefined(rootNode.children_);
-
- // After lazy construction (tree of nodes with lists of regions).
- assert.isDefined(rootNode.children); // Force building the tree.
- assert.isDefined(rootNode.children_);
- checkSomeRegion();
- });
-
- test('classificationRules', function() {
- checkClassificationRules('/dev/ashmem/dalvik-main space (deleted)',
- ['Android', 'Java runtime', 'Spaces', 'Normal']);
- checkClassificationRules('/dev/ashmem/dalvik-non moving space',
- ['Android', 'Java runtime', 'Spaces', 'Non-moving']);
- checkClassificationRules('/dev/ashmem/dalvik-zygote space (deleted)',
- ['Android', 'Java runtime', 'Spaces', 'Zygote']);
- checkClassificationRules('/dev/ashmem/dalvik-allocation stack (deleted)',
- ['Android', 'Java runtime', 'Accounting']);
- checkClassificationRules(
- '/dev/ashmem/dalvik-allocspace main rosalloc space 1 live-bitmap 2',
- ['Android', 'Java runtime', 'Accounting']);
- checkClassificationRules(
- '/dev/ashmem/dalvik-allocspace non moving space live-bitmap 4',
- ['Android', 'Java runtime', 'Accounting']);
- checkClassificationRules('/dev/ashmem/dalvik-allocspace zygote / ' +
- 'non moving space live-bitmap 0 (deleted)',
- ['Android', 'Java runtime', 'Accounting']);
- checkClassificationRules('/dev/ashmem/dalvik-card table (deleted)',
- ['Android', 'Java runtime', 'Accounting']);
- checkClassificationRules('/dev/ashmem/dalvik-large live objects (deleted)',
- ['Android', 'Java runtime', 'Accounting']);
- checkClassificationRules('/dev/ashmem/dalvik-live stack (deleted)',
- ['Android', 'Java runtime', 'Accounting']);
- checkClassificationRules(
- '/dev/ashmem/dalvik-mark sweep sweep array free buffer (deleted)',
- ['Android', 'Java runtime', 'Accounting']);
- checkClassificationRules('/dev/ashmem/dalvik-rosalloc page map (deleted)',
- ['Android', 'Java runtime', 'Accounting']);
- checkClassificationRules('/dev/ashmem/dalvik-indirect ref table (deleted)',
- ['Android', 'Java runtime', 'Indirect Reference Table']);
- checkClassificationRules('/dev/ashmem/dalvik-LinearAlloc (deleted)',
- ['Android', 'Java runtime', 'Linear Alloc']);
- checkClassificationRules('/dev/ashmem/dalvik-jit-code-cache (deleted)',
- ['Android', 'Java runtime', 'Cache']);
- checkClassificationRules('/dev/ashmem/CursorWindow (deleted)',
- ['Android', 'Cursor']);
- checkClassificationRules('/dev/ashmem (deleted)', ['Android', 'Ashmem']);
- checkClassificationRules('/dev/ashmem/GFXStats-10082',
- ['Android', 'Ashmem']);
-
- checkClassificationRules('[stack:23164]', ['Stack']);
- checkClassificationRules('[stack]', ['Stack']);
-
- checkClassificationRules('[discounted tracing overhead]', ['Native heap']);
- checkClassificationRules('', ['Native heap']);
- checkClassificationRules('[heap]', ['Native heap']);
- checkClassificationRules('[anon:libc_malloc]', ['Native heap']);
- checkClassificationRules('[anon:thread signal stack]', ['Native heap']);
- checkClassificationRules('/dev/ashmem/libc malloc (deleted)',
- ['Native heap']);
-
- checkClassificationRules('/usr/lib/nvidia-340/libGL.so.331.79',
- ['Files', 'so']);
- checkClassificationRules('/usr/lib/x86_64-linux-gnu/libibus-1.0.so.5.0.505',
- ['Files', 'so']);
- checkClassificationRules('/data/data/com.google.android.apps.chrome/' +
- 'app_chrome/RELRO:libchrome.so (deleted)', ['Files', 'so']);
- checkClassificationRules(
- '/usr/share/fonts/truetype/msttcorefonts/Times_New_Roman.ttf',
- ['Files', 'ttf']);
- checkClassificationRules(
- '/data/app/com.google.android.apps.chrome-2/base.apk',
- ['Files', 'apk']);
- checkClassificationRules(
- '/data/app/com.google.android.apps.chrome-2/lib/arm/libchrome.so',
- ['Files', 'so']);
- checkClassificationRules(
- '/data/app/com.google.android.apps.chrome-2/oat/arm/base.odex',
- ['Files', 'dex']);
- checkClassificationRules(
- '/data/dalvik-cache/arm/system@framework@boot.art', ['Files', 'art']);
- checkClassificationRules(
- '/data/dalvik-cache/arm/system@framework@boot.oat', ['Files', 'oat']);
-
- checkClassificationRules('/dev/nvidia0', ['Devices', 'GPU']);
- checkClassificationRules('/dev/kgsl-3d0', ['Devices', 'GPU']);
- checkClassificationRules('anon_inode:dmabuf', ['Devices', 'DMA']);
- checkClassificationRules('/dev/binder', ['Devices', 'Other']);
-
- checkClassificationRules('/src/out/Release/chrome', ['Other']);
- checkClassificationRules('/tmp/gluY4SVp (deleted)', ['Other']);
- checkClassificationRules('/src/out/Release/resources.pak', ['Other']);
- checkClassificationRules('[vdso]', ['Other']);
- checkClassificationRules('[vsyscall]', ['Other']);
- checkClassificationRules('[vectors]', ['Other']);
- checkClassificationRules('[vvar]', ['Other']);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/model/x_marker_annotation.html b/chromium/third_party/catapult/tracing/tracing/model/x_marker_annotation.html
deleted file mode 100644
index a5bd1e346e2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/model/x_marker_annotation.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/annotation.html">
-<link rel="import" href="/tracing/ui/annotations/x_marker_annotation_view.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.model', function() {
-
- function XMarkerAnnotation(timestamp) {
- tr.model.Annotation.apply(this, arguments);
-
- this.timestamp = timestamp;
- this.strokeStyle = 'rgba(0, 0, 255, 0.5)';
- }
-
- XMarkerAnnotation.fromDict = function(dict) {
- return new XMarkerAnnotation(dict.args.timestamp);
- }
-
- XMarkerAnnotation.prototype = {
- __proto__: tr.model.Annotation.prototype,
-
- toDict: function() {
- return {
- typeName: 'xmarker',
- args: {
- timestamp: this.timestamp
- }
- };
- },
-
- createView_: function(viewport) {
- return new tr.ui.annotations.XMarkerAnnotationView(viewport, this);
- }
- };
-
- tr.model.Annotation.register(
- XMarkerAnnotation, {typeName: 'xmarker'});
-
- return {
- XMarkerAnnotation: XMarkerAnnotation
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/results2_template.html b/chromium/third_party/catapult/tracing/tracing/results2_template.html
deleted file mode 100644
index be556f742f8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/results2_template.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/ui/value_set_table.html">
-<link rel="import" href="/tracing/value/ui/value_set_view.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<style>
-#value-set-json {
- display: none;
-}
-</style>
-
-<script>
-'use strict';
-document.addEventListener('DOMContentLoaded', function() {
- var valueSetJson = document.getElementById('value-set-json');
- var values = new tr.v.ValueSet();
- values.addValuesFromDicts(JSON.parse(valueSetJson.textContent));
- valueSetJson.parentNode.removeChild(valueSetJson);
- document.getElementById('values').values = values;
-});
-</script>
-
-<tr-v-ui-value-set-view id="values"></tr-v-ui-value-set-view>
-
-<div id="value-set-json"></div>
diff --git a/chromium/third_party/catapult/tracing/tracing/tests.html b/chromium/third_party/catapult/tracing/tracing/tests.html
deleted file mode 100644
index 11291418f0d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/tests.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<head>
- <title>Trace-Viewer Tests: loading...</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-
- <link rel="shortcut icon" href="data:image/x-icon;base64,"
- type="image/x-icon">
-
- <script src="/components/webcomponentsjs/webcomponents.js"></script>
-
- <link rel="import" href="/components/polymer/polymer.html">
- <link rel="import" href="/tracing/base/unittest/interactive_test_runner.html">
- <style>
- html, body {
- box-sizing: border-box;
- width: 100%;
- height: 100%;
- overflow: hidden;
- margin: 0px;
- }
- </style>
-</head>
-<body>
- <script>
- 'use strict';
-
-
- window.addEventListener('load', function() {
- tr.b.unittest.loadAndRunTests({
- title: 'All Trace-Viewer Tests',
- getAllSuiteRelPathsAsync: function() {
- return tr.b.getAsync('/tracing/tests').then(function(json) {
- return JSON.parse(json).test_relpaths;
- }).catch (function(e) {
- throw e;
- });
- },
- testLinks: [
- {linkPath: '/tracing_examples/skia_debugger.html',
- title: 'Skia Debugger'},
- {linkPath: '/tracing_examples/trace_viewer.html',
- title: 'Trace File Viewer'}
- ]
- });
- });
-
- </script>
-</body>
-</html>
diff --git a/chromium/third_party/catapult/tracing/tracing/trace2html.html b/chromium/third_party/catapult/tracing/tracing/trace2html.html
deleted file mode 100644
index 05790b5e676..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/trace2html.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base64.html">
-<link rel="import" href="/tracing/ui/timeline_view.html">
-<script>
-'use strict';
-
-var g_timelineViewEl;
-
-(function() {
- var styleEl = document.createElement('style');
- var lines = [
- 'html, body {',
- ' box-sizing: border-box;',
- ' overflow: hidden;',
- ' margin: 0px;',
- ' padding: 0;',
- ' width: 100%;',
- ' height: 100%;',
- '}',
- 'tr-ui-timeline-view {',
- ' width: 100%;',
- ' height: 100%;',
- '}',
- 'tr-ui-timeline-view:focus {',
- ' outline: none;',
- '}'
- ];
- styleEl.textContent = lines.join('\n');
- document.head.appendChild(styleEl);
-})();
-
-document.addEventListener('DOMContentLoaded', function() {
- var container = document.createElement('track-view-container');
- container.id = 'track_view_container';
-
- g_timelineViewEl = document.createElement('tr-ui-timeline-view');
- g_timelineViewEl.appendChild(container);
-
- document.body.appendChild(g_timelineViewEl);
-
- var traces = [];
- var viewerDataScripts = document.querySelectorAll('#viewer-data');
- for (var i = 0; i < viewerDataScripts.length; i++) {
- var text = viewerDataScripts[i].textContent;
- // Trim leading newlines off the text. They happen during writing.
- while (text[0] == '\n')
- text = text.substring(1);
- traces.push(tr.b.Base64.atob(text));
- }
-
- var m = new tr.Model();
- var i = new tr.importer.Import(m);
- var p = i.importTracesWithProgressDialog(traces);
- p.then(
- function() {
- g_timelineViewEl.model = m;
- g_timelineViewEl.updateDocumentFavicon();
- g_timelineViewEl.globalMode = true;
- g_timelineViewEl.viewTitle = document.title;
- },
- function(err) {
- var overlay = new tr.ui.b.Overlay();
- overlay.textContent = tr.b.normalizeException(err).message;
- overlay.title = 'Import error';
- overlay.visible = true;
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/alert_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/alert_sub_view.html
deleted file mode 100644
index 67ff160cea9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/alert_sub_view.html
+++ /dev/null
@@ -1,161 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<polymer-element name="tr-ui-a-alert-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
- #table {
- flex: 1 1 auto;
- align-self: stretch;
- }
- </style>
- <tr-ui-b-table id="table">
- </tr-ui-b-table>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.currentSelection_ = undefined;
- this.$.table.tableColumns = [
- {
- title: 'Label',
- value: function(row) { return row.name; },
- width: '150px'
- },
- {
- title: 'Value',
- width: '100%',
- value: function(row) { return row.value; }
- }
- ];
- this.$.table.showHeader = false;
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- set selection(selection) {
- this.currentSelection_ = selection;
- this.updateContents_();
- },
-
- getRowsForSingleAlert_: function(alert) {
- var rows = [];
-
- // Arguments
- for (var argName in alert.args) {
- var argView =
- document.createElement('tr-ui-a-generic-object-view');
- argView.object = alert.args[argName];
- rows.push({ name: argName, value: argView });
- }
-
- // Associated events
- if (alert.associatedEvents.length) {
- alert.associatedEvents.forEach(function(event, i) {
- var linkEl = document.createElement('tr-ui-a-analysis-link');
- linkEl.setSelectionAndContent(function() {
- return event;
- }, event.title);
-
- var valueString = '';
- if (event instanceof tr.model.TimedEvent)
- valueString = 'took ' + event.duration.toFixed(2) + 'ms';
-
- rows.push({
- name: linkEl,
- value: valueString
- });
- });
- }
-
- // Description
- var descriptionEl = tr.ui.b.createDiv({
- textContent: alert.info.description,
- maxWidth: '300px'
- });
- rows.push({
- name: 'Description',
- value: descriptionEl
- });
-
- // Additional Reading Links
- if (alert.info.docLinks) {
- alert.info.docLinks.forEach(function(linkObject) {
- var linkEl = document.createElement('a');
- linkEl.target = '_blank';
- linkEl.href = linkObject.href;
- linkEl.textContent = linkObject.textContent;
- rows.push({
- name: linkObject.label,
- value: linkEl
- });
- });
- }
- return rows;
- },
-
- getRowsForAlerts_: function(alerts) {
- if (alerts.length == 1) {
- var rows = [{
- name: 'Alert',
- value: tr.b.getOnlyElement(alerts).title
- }];
- var detailRows = this.getRowsForSingleAlert_(alerts[0]);
- rows.push.apply(rows, detailRows);
- return rows;
- } else {
- return alerts.map(function(alert) {
- return {
- name: 'Alert',
- value: alert.title,
- isExpanded: alerts.size < 10, // This is somewhat arbitrary for now.
- subRows: this.getRowsForSingleAlert_(alert)
- };
- }, this);
- }
- },
-
- updateContents_: function() {
- if (this.currentSelection_ === undefined) {
- this.$.table.rows = [];
- this.$.table.rebuild();
- return;
- }
-
- var alerts = this.currentSelection_;
- this.$.table.tableRows = this.getRowsForAlerts_(alerts);
- this.$.table.rebuild();
- },
-
- get relatedEventsToHighlight() {
- if (!this.currentSelection_)
- return undefined;
- var result = new tr.model.EventSet();
- for (var event of this.currentSelection_)
- result.addEventSet(event.associatedEvents);
- return result;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/alert_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/alert_sub_view_test.html
deleted file mode 100644
index cc2a1b668ae..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/alert_sub_view_test.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_view.html">
-<link rel="import" href="/tracing/ui/base/deep_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newSliceEx = tr.c.TestUtils.newSliceEx;
-
- test('instantiate', function() {
- var slice = newSliceEx({title: 'b', start: 0, duration: 0.002});
-
- var alertInfo = new tr.model.EventInfo(
- 'alertInfo', 'Critical alert',
- [{
- label: 'Project Page',
- textContent: 'Trace-Viewer Github Project',
- href: 'https://github.com/google/trace-viewer/'
- }]);
-
- var alert = new tr.model.Alert(alertInfo, 5, [slice]);
- assert.equal(1, alert.associatedEvents.length);
-
- var subView = document.createElement('tr-ui-a-alert-sub-view');
- subView.selection = new tr.model.EventSet(alert);
- assert.isTrue(
- subView.relatedEventsToHighlight.equals(alert.associatedEvents));
- this.addHTMLOutput(subView);
-
- var table = tr.b.findDeepElementMatching(
- subView, 'tr-ui-b-table');
-
- var rows = table.tableRows;
- var columns = table.tableColumns;
- assert.lengthOf(rows, 4);
- assert.lengthOf(columns, 2);
- });
-
- test('instantiate_twoAlertsWithRelatedEvents', function() {
- var slice1 = newSliceEx({title: 'b', start: 0, duration: 0.002});
- var slice2 = newSliceEx({title: 'b', start: 1, duration: 0.002});
-
- var alertInfo1 = new tr.model.EventInfo(
- 'alertInfo1', 'Critical alert',
- [{
- label: 'Project Page',
- textContent: 'Trace-Viewer Github Project',
- href: 'https://github.com/google/trace-viewer/'
- }]);
-
- var alertInfo2 = new tr.model.EventInfo(
- 'alertInfo2', 'Critical alert',
- [{
- label: 'Google Homepage',
- textContent: 'Google Search Page',
- href: 'http://www.google.com'
- }]);
-
- var alert1 = new tr.model.Alert(alertInfo1, 5, [slice1]);
- var alert2 = new tr.model.Alert(alertInfo2, 5, [slice2]);
-
- var subView = document.createElement('tr-ui-a-alert-sub-view');
- subView.selection = new tr.model.EventSet([alert1, alert2]);
- assert.isTrue(subView.relatedEventsToHighlight.equals(
- new tr.model.EventSet([
- tr.b.getOnlyElement(alert1.associatedEvents),
- tr.b.getOnlyElement(alert2.associatedEvents)
- ])));
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_link.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_link.html
deleted file mode 100644
index 3619e4a9b40..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_link.html
+++ /dev/null
@@ -1,124 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/brushing_state_controller.html">
-
-<polymer-element name="tr-ui-a-analysis-link" is="a"
- on-click="{{onClicked_}}"
- on-mouseenter="{{onMouseEnter_}}"
- on-mouseleave="{{onMouseLeave_}}">
- <template>
- <style>
- :host {
- display: inline;
- color: -webkit-link;
- cursor: pointer;
- text-decoration: underline;
- cursor: pointer;
- }
- </style>
- <content></content>
- </template>
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.selection_ = undefined;
- },
-
- attached: function() {
- // Save an instance of the controller since it's going to be used in
- // detached() where it can no longer be obtained.
- this.controller_ =
- tr.c.BrushingStateController.getControllerForElement(this);
- },
-
- detached: function() {
- // Reset highlights.
- this.clearHighlight_();
- this.controller_ = undefined;
- },
-
- /**
- * @return {*|function():*}
- */
- get selection() {
- return this.selection_;
- },
-
- /**
- * |selection| can be anything except a function, or else a function that
- * can return anything.
- *
- * In the context of trace_viewer, |selection| is typically an EventSet,
- * whose events will be highlighted by trace_viewer when this link is
- * clicked or mouse-entered.
- *
- * If |selection| is not a function, then it will be dispatched to this
- * link's embedder via a RequestSelectionChangeEvent when this link is
- * clicked or mouse-entered.
- *
- * If |selection| is a function, then it will be called when this link is
- * clicked or mouse-entered, and its result will be dispatched to this
- * link's embedder via a RequestSelectionChangeEvent.
- *
- * @param {*|function():*} selection
- */
- set selection(selection) {
- this.selection_ = selection;
- this.textContent = selection.userFriendlyName;
- },
-
- setSelectionAndContent: function(selection, opt_textContent) {
- this.selection_ = selection;
- if (opt_textContent)
- this.textContent = opt_textContent;
- },
-
- /**
- * If |selection| is a function, call it and return the result.
- * Otherwise return |selection| directly.
- *
- * @return {*}
- */
- getCurrentSelection_: function() {
- // Gets the current selection, invoking the selection function if needed.
- if (typeof this.selection_ === 'function')
- return this.selection_();
- return this.selection_;
- },
-
- setHighlight_: function(opt_eventSet) {
- if (this.controller_)
- this.controller_.changeAnalysisLinkHoveredEvents(opt_eventSet);
- },
-
- clearHighlight_: function(opt_eventSet) {
- this.setHighlight_();
- },
-
- onClicked_: function() {
- if (!this.selection_)
- return;
-
- var event = new tr.model.RequestSelectionChangeEvent();
- event.selection = this.getCurrentSelection_();
- this.dispatchEvent(event);
- },
-
- onMouseEnter_: function() {
- this.setHighlight_(this.getCurrentSelection_());
- },
-
- onMouseLeave_: function() {
- this.clearHighlight_();
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_link_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_link_test.html
deleted file mode 100644
index 9245acb3ee9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_link_test.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('testBasic', function() {
- var link = document.createElement('tr-ui-a-analysis-link');
-
- var i10 = new tr.model.ObjectInstance(
- {}, '0x1000', 'cat', 'name', 10);
- var s10 = i10.addSnapshot(10, {foo: 1});
-
- link.selection = new tr.model.EventSet(s10);
- this.addHTMLOutput(link);
-
- var didRSC = false;
- link.addEventListener('requestSelectionChange', function(e) {
- didRSC = true;
- assert.isTrue(e.selection.equals(new tr.model.EventSet(s10)));
- });
- link.click();
- assert.isTrue(didRSC);
- });
-
- test('testGeneratorVersion', function() {
- var link = document.createElement('tr-ui-a-analysis-link');
-
- var i10 = new tr.model.ObjectInstance(
- {}, '0x1000', 'cat', 'name', 10);
- var s10 = i10.addSnapshot(10, {foo: 1});
-
- function selectionGenerator() {
- return new tr.model.EventSet(s10);
- }
- selectionGenerator.userFriendlyName = 'hello world';
- link.selection = selectionGenerator;
- this.addHTMLOutput(link);
-
- var didRSC = false;
- link.addEventListener('requestSelectionChange', function(e) {
- assert.isTrue(e.selection.equals(new tr.model.EventSet(s10)));
- didRSC = true;
- });
- link.click();
- assert.isTrue(didRSC);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_sub_view.html
deleted file mode 100644
index 203eed642df..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_sub_view.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<!--
-@fileoverview Polymer element for various analysis sub-views.
--->
-<polymer-element name="tr-ui-a-sub-view">
- <script>
- 'use strict';
- Polymer({
- set tabLabel(label) {
- return this.setAttribute('tab-label', label);
- },
-
- get tabLabel() {
- return this.getAttribute('tab-label');
- },
-
- get requiresTallView() {
- return false;
- },
-
- get relatedEventsToHighlight() {
- return undefined;
- },
-
- /**
- * Each element extending this one must implement
- * a 'selection' property.
- */
- set selection(selection) {
- throw new Error('Not implemented!');
- },
-
- get selection() {
- throw new Error('Not implemented!');
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_sub_view_test.html
deleted file mode 100644
index dfe8e30d96c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_sub_view_test.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('subViewThrowsNotImplementedErrors', function() {
- var subView = document.createElement('tr-ui-a-sub-view');
-
- assert.throw(function() {
- subView.selection = new tr.model.EventSet();
- }, 'Not implemented!');
-
- assert.throw(function() {
- var viewSelection = subView.selection;
- }, 'Not implemented!');
-
- subView.tabLabel = 'Tab Label';
- assert.equal(subView.getAttribute('tab-label'), 'Tab Label');
- assert.equal(subView.tabLabel, 'Tab Label');
-
- subView.tabLabel = 'New Label';
- assert.equal(subView.getAttribute('tab-label'), 'New Label');
- assert.equal(subView.tabLabel, 'New Label');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_view.html
deleted file mode 100644
index b5961acda7d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_view.html
+++ /dev/null
@@ -1,258 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/alert_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import"
- href="/tracing/ui/analysis/container_memory_dump_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/counter_sample_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/layout_tree_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_async_slice_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_cpu_slice_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_flow_event_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_frame_sub_view.html">
-<link rel="import"
- href="/tracing/ui/analysis/multi_instant_event_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_object_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_power_sample_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_sample_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_thread_slice_sub_view.html">
-<link rel="import"
- href="/tracing/ui/analysis/multi_thread_time_slice_sub_view.html">
-<link rel="import"
- href="/tracing/ui/analysis/multi_user_expectation_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/single_async_slice_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/single_cpu_slice_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/single_flow_event_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/single_frame_sub_view.html">
-<link rel="import"
- href="/tracing/ui/analysis/single_instant_event_sub_view.html">
-<link rel="import"
- href="/tracing/ui/analysis/single_object_instance_sub_view.html">
-<link rel="import"
- href="/tracing/ui/analysis/single_object_snapshot_sub_view.html">
-<link rel="import"
- href="/tracing/ui/analysis/single_power_sample_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/single_sample_sub_view.html">
-<link rel="import"
- href="/tracing/ui/analysis/single_thread_slice_sub_view.html">
-<link rel="import"
- href="/tracing/ui/analysis/single_thread_time_slice_sub_view.html">
-<link rel="import"
- href="/tracing/ui/analysis/single_user_expectation_sub_view.html">
-<link rel="import" href="/tracing/ui/base/polymer_utils.html">
-<link rel="import" href="/tracing/ui/base/tab_view.html">
-
-<!--
-@fileoverview A component used to display an analysis of a selection,
-using custom elements specialized for different event types.
--->
-<polymer-element name="tr-ui-a-analysis-view">
- <template>
- <style>
- :host {
- background-color: white;
- display: flex;
- flex-direction: column;
- height: 275px;
- overflow: auto;
- }
-
- :host(.tall-mode) {
- height: 525px;
- }
-
- ::content > * {
- flex: 1 0 auto;
- }
- </style>
- <content></content>
- </template>
- <script>
- 'use strict';
- (function() {
- var EventRegistry = tr.model.EventRegistry;
-
- Polymer({
- ready: function() {
- this.tabView_ = document.createElement('tr-ui-a-tab-view');
- this.tabView_.style.flex = '1 1 auto';
- this.appendChild(this.tabView_);
- this.brushingStateController_ = undefined;
- this.onSelectedTabChange_ = this.onSelectedTabChange_.bind(this);
- this.onSelectionChanged_ = this.onSelectionChanged_.bind(this);
-
- this.lastSeenSelection_ = new tr.model.EventSet();
- },
-
- set tallMode(value) {
- if (value)
- this.classList.add('tall-mode');
- else
- this.classList.remove('tall-mode');
- },
-
- get tallMode() {
- return this.classList.contains('tall-mode');
- },
-
- get tabView() {
- return this.tabView_;
- },
-
- get brushingStateController() {
- return this.brushingStateController_;
- },
-
- set brushingStateController(brushingStateController) {
- if (this.brushingStateController) {
- this.brushingStateController_.removeEventListener(
- 'change', this.onSelectionChanged_);
- }
- this.brushingStateController_ = brushingStateController;
- if (this.brushingStateController) {
- this.brushingStateController_.addEventListener(
- 'change', this.onSelectionChanged_);
- }
- this.onSelectionChanged_();
- },
-
- get selection() {
- return this.brushingStateController_.selection;
- },
-
- onSelectionChanged_: function(e) {
- var selection = this.brushingStateController_.selection;
-
- var selectionHasSameValue = this.lastSeenSelection_.equals(selection);
- this.lastSeenSelection_ = selection;
- if (selectionHasSameValue)
- return;
-
- var lastSelectedTabTagName;
- var lastSelectedTabTypeName;
- if (this.tabView_.selectedTab) {
- lastSelectedTabTagName = this.tabView_.selectedTab.tagName;
- lastSelectedTabTypeName = this.tabView_.selectedTab._eventTypeName;
- }
-
- this.tallMode = false;
-
- var previouslySelectedTab = this.tabView_.selectedTab;
- this.tabView_.removeEventListener(
- 'selected-tab-change', this.onSelectedTabChange_);
-
- var previousSubViews = {};
- for (var i = 0; i < this.tabView_.children.length; i++) {
- var previousSubView = this.tabView_.children[i];
- previousSubViews[previousSubView._eventTypeName] = previousSubView;
- }
-
- this.tabView_.saveTabStates();
- this.tabView_.textContent = '';
- if (selection.length == 0) {
- this.tabView_.tabStripHeadingText = 'Nothing selected. Tap stuff.';
- } else if (selection.length == 1) {
- this.tabView_.tabStripHeadingText = '1 item selected: ';
- } else {
- this.tabView_.tabStripHeadingText = selection.length +
- ' items selected: ';
- }
-
- var eventsByBaseTypeName = selection.getEventsOrganizedByBaseType(true);
-
- var numBaseTypesToAnalyze = tr.b.dictionaryLength(eventsByBaseTypeName);
- for (var eventTypeName in eventsByBaseTypeName) {
- var subSelection = eventsByBaseTypeName[eventTypeName];
- var subView = this.createSubViewForSelection_(
- eventTypeName, subSelection, previousSubViews[eventTypeName]);
- // Store the eventTypeName for future tab restoration.
- subView._eventTypeName = eventTypeName;
- this.tabView_.appendChild(subView);
-
- subView.selection = subSelection;
- }
-
- // Restore the tab type that was previously selected. First try by tag
- // name.
- var tab;
- if (lastSelectedTabTagName)
- tab = this.tabView_.querySelector(lastSelectedTabTagName);
-
- // If that fails, look for a tab with that typeName.
- if (!tab && lastSelectedTabTypeName) {
- var tab = tr.b.findFirstInArray(
- this.tabView_.children, function(tab) {
- return tab._eventTypeName === lastSelectedTabTypeName;
- });
- }
- // If all else fails, pick the first tab.
- if (!tab)
- tab = this.tabView_.firstChild;
-
- this.tabView_.selectedTab = tab;
- this.onSelectedTabChange_();
-
- this.tabView_.addEventListener(
- 'selected-tab-change', this.onSelectedTabChange_);
- },
-
- createSubViewForSelection_: function(eventTypeName, subSelection,
- previousSubView) {
- // Find.
- var eventTypeInfo = EventRegistry.getEventTypeInfoByTypeName(
- eventTypeName);
- var singleMode = subSelection.length == 1;
- var tagName;
- if (subSelection.length === 1)
- tagName = eventTypeInfo.metadata.singleViewElementName;
- else
- tagName = eventTypeInfo.metadata.multiViewElementName;
-
- if (!tr.ui.b.getPolymerElementNamed(tagName))
- throw new Error('Element not registered: ' + tagName);
-
- // Create if necessary.
- var subView;
- if (previousSubView &&
- previousSubView.tagName === tagName.toUpperCase())
- subView = previousSubView;
- else
- subView = document.createElement(tagName);
-
- // Set label.
- var camelLabel;
- if (subSelection.length === 1)
- camelLabel = EventRegistry.getUserFriendlySingularName(eventTypeName);
- else
- camelLabel = EventRegistry.getUserFriendlyPluralName(eventTypeName);
- subView.tabLabel = camelLabel + ' (' + subSelection.length + ')';
-
- return subView;
- },
-
- onSelectedTabChange_: function() {
- var brushingStateController = this.brushingStateController_;
- if (this.tabView_.selectedTab) {
- var selectedTab = this.tabView_.selectedTab;
- this.tallMode = selectedTab.requiresTallView;
- if (brushingStateController) {
- var rlth = selectedTab.relatedEventsToHighlight;
- brushingStateController.changeAnalysisViewRelatedEvents(rlth);
- }
- } else {
- this.tallMode = false;
- if (brushingStateController)
- brushingStateController.changeAnalysisViewRelatedEvents(undefined);
- }
- }
- });
- })();
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_view_test.html
deleted file mode 100644
index 37776f819bd..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/analysis_view_test.html
+++ /dev/null
@@ -1,145 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/counter.html">
-<link rel="import" href="/tracing/model/counter_sample.html">
-<link rel="import" href="/tracing/model/counter_series.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/user_model/stub_expectation.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_view.html">
-<link rel="import" href="/tracing/ui/brushing_state_controller.html">
-<link rel="import" href="/tracing/ui/extras/full_config.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var EventSet = tr.model.EventSet;
- var BrushingStateController = tr.c.BrushingStateController;
- var Model = tr.Model;
- var Counter = tr.model.Counter;
- var CounterSeries = tr.model.CounterSeries;
- var CounterSample = tr.model.CounterSample;
- var newThreadSlice = tr.c.TestUtils.newThreadSlice;
- var SCHEDULING_STATE = tr.model.SCHEDULING_STATE;
- var StubExpectation = tr.model.um.StubExpectation;
-
- function assertEventSet(actualEventSet, expectedEvents) {
- var expectedEventSet = new EventSet(expectedEvents);
- assert.isTrue(actualEventSet.equals(expectedEventSet),
- 'EventSet objects are not equal');
- }
-
- function checkTab(tab, expectedTagName, expectedSelectionEvents) {
- assert.equal(tab.tagName, expectedTagName.toUpperCase());
- assertEventSet(tab.selection, expectedSelectionEvents);
- }
-
- test('selectedTabChange', function() {
- // Set up the model.
- var model = new Model();
- var process = model.getOrCreateProcess(1);
-
- var counter = process.getOrCreateCounter('universe', 'planets');
- var series = counter.addSeries(new CounterSeries('x', 0));
- var sample1 = series.addCounterSample(0, 100);
- var sample2 = series.addCounterSample(1, 90);
- var sample3 = series.addCounterSample(2, 80);
-
- var thread = process.getOrCreateThread(2);
- var slice1 = newThreadSlice(thread, SCHEDULING_STATE.RUNNING, 0, 1);
- var slice2 = newThreadSlice(thread, SCHEDULING_STATE.SLEEPING, 1, 2.718);
- thread.timeSlices = [slice1, slice2];
-
- var record1 = new StubExpectation(
- {parentModel: model, initiatorTitle: 'r1', start: 200, duration: 300});
- record1.associatedEvents.push(sample1);
- record1.associatedEvents.push(slice1);
- var record2 = new StubExpectation(
- {parentModel: model, initiatorTitle: 'r2', start: 600, duration: 100});
- record2.associatedEvents.push(sample2);
- record2.associatedEvents.push(sample3);
- record2.associatedEvents.push(slice1);
-
- // Set up the analysis views and brushing state controller.
- var analysisView = document.createElement('tr-ui-a-analysis-view');
- this.addHTMLOutput(analysisView);
- var tabView = analysisView.tabView;
- var controller = new BrushingStateController(undefined);
- analysisView.brushingStateController = controller;
-
- function checkSelectedTab(expectedSelectedTab, expectedRelatedEvents) {
- assert.strictEqual(tabView.selectedTab, expectedSelectedTab);
- assertEventSet(controller.currentBrushingState.analysisViewRelatedEvents,
- expectedRelatedEvents);
- }
-
- // 1. Empty selection (implicit).
- assert.lengthOf(tabView.tabs, 0);
- checkSelectedTab(undefined, []);
-
- // 2. Event selection: two samples and one thread slice.
- controller.changeSelectionFromRequestSelectionChangeEvent(
- new EventSet([sample1, slice1, sample2]));
- assert.lengthOf(tabView.tabs, 2);
- var sampleTab2 = tabView.tabs[0];
- checkTab(sampleTab2,
- 'tr-ui-a-counter-sample-sub-view',
- [sample1, sample2]);
- var singleThreadSliceTab2 = tabView.tabs[1];
- checkTab(singleThreadSliceTab2,
- 'tr-ui-a-single-thread-time-slice-sub-view',
- [slice1]);
- // First tab should be selected.
- checkSelectedTab(sampleTab2, []);
-
- // 3. Tab selection: single thread slice tab.
- tabView.selectedTab = singleThreadSliceTab2;
- checkSelectedTab(singleThreadSliceTab2, []);
-
- // 4. Event selection: one sample, two thread slices, and one
- // user expectation.
- controller.changeSelectionFromRequestSelectionChangeEvent(
- new EventSet([slice1, slice2, sample3, record1]));
- assert.lengthOf(tabView.tabs, 3);
- var sampleTab4 = tabView.tabs[1];
- checkTab(sampleTab4,
- 'tr-ui-a-counter-sample-sub-view',
- [sample3]);
- // Reuse tab (same event type and sub-view tag name).
- assert.strictEqual(sampleTab4, sampleTab2);
- var singleRecordTab4 = tabView.tabs[2];
- checkTab(singleRecordTab4,
- 'tr-ui-a-single-user-expectation-sub-view',
- [record1]);
- var multiThreadSliceTab4 = tabView.tabs[0];
- checkTab(multiThreadSliceTab4,
- 'tr-ui-a-multi-thread-time-slice-sub-view',
- [slice1, slice2]);
- // Remember selected tab (even though the tab was destroyed).
- checkSelectedTab(multiThreadSliceTab4, []);
-
- // 5. Tab selection: single user expectation tab.
- tabView.selectedTab = singleRecordTab4;
- checkSelectedTab(singleRecordTab4, [sample1, slice1]);
-
- // 6. Event selection: one user expectation.
- controller.changeSelectionFromRequestSelectionChangeEvent(
- new EventSet([record2]));
- assert.lengthOf(tabView.tabs, 1);
- var singleRecordTab6 = tabView.tabs[0];
- checkTab(singleRecordTab6,
- 'tr-ui-a-single-user-expectation-sub-view',
- [record2]);
- // Reuse tab (same event type and sub-view tag name).
- assert.strictEqual(singleRecordTab6, singleRecordTab4);
- // Remember selected tab.
- checkSelectedTab(singleRecordTab6, [sample2, sample3, slice1]);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/container_memory_dump_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/container_memory_dump_sub_view.html
deleted file mode 100644
index d6a437e775a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/container_memory_dump_sub_view.html
+++ /dev/null
@@ -1,165 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/container_memory_dump.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/memory_dump_header_pane.html">
-<link rel="import" href="/tracing/ui/analysis/stacked_pane_view.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-a-container-memory-dump-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <div id="content"></div>
- </template>
-</polymer-element>
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.analysis', function() {
-
- Polymer('tr-ui-a-container-memory-dump-sub-view', {
- set selection(selection) {
- if (selection === undefined) {
- this.currentSelection_ = undefined;
- this.dumpsByContainerName_ = undefined;
- this.updateContents_();
- return;
- }
-
- // Check that the selection contains only container memory dumps.
- selection.forEach(function(event) {
- if (!(event instanceof tr.model.ContainerMemoryDump)) {
- throw new Error(
- 'Memory dump sub-view only supports container memory dumps');
- }
- });
- this.currentSelection_ = selection;
-
- // Group the selected memory dumps by container name and sort them
- // chronologically.
- this.dumpsByContainerName_ = tr.b.group(this.currentSelection_.toArray(),
- function(dump) {
- return dump.containerName;
- });
- tr.b.iterItems(this.dumpsByContainerName_,
- function(containerName, dumps) {
- dumps.sort(function(a, b) { return a.start - b.start; });
- });
-
- this.updateContents_();
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- get requiresTallView() {
- return true;
- },
-
- updateContents_: function() {
- this.$.content.textContent = '';
-
- if (this.dumpsByContainerName_ === undefined)
- return;
-
- var containerNames = Object.keys(this.dumpsByContainerName_);
- if (containerNames.length === 0)
- return;
-
- if (containerNames.length > 1)
- this.buildViewForMultipleContainerNames_();
- else
- this.buildViewForSingleContainerName_();
- },
-
- buildViewForSingleContainerName_: function() {
- var containerMemoryDumps =
- tr.b.dictionaryValues(this.dumpsByContainerName_)[0];
- var dumpView = this.ownerDocument.createElement(
- 'tr-ui-a-stacked-pane-view');
- this.$.content.appendChild(dumpView);
- dumpView.setPaneBuilder(function() {
- var headerPane = document.createElement(
- 'tr-ui-a-memory-dump-header-pane');
- headerPane.containerMemoryDumps = containerMemoryDumps;
- return headerPane;
- });
- },
-
- buildViewForMultipleContainerNames_: function() {
- // TODO(petrcermak): Provide a more sophisticated view for this case.
- var ownerDocument = this.ownerDocument;
-
- var rows = tr.b.dictionaryValues(tr.b.mapItems(this.dumpsByContainerName_,
- function(containerName, dumps) {
- return {
- containerName: containerName,
- subRows: dumps,
- isExpanded: true
- };
- }));
- rows.sort(function(a, b) {
- return a.containerName.localeCompare(b.containerName);
- });
-
- var columns = [
- {
- title: 'Dump',
-
- value: function(row) {
- if (row.subRows === undefined)
- return this.singleDumpValue_(row);
- else
- return this.groupedDumpValue_(row);
- },
-
- singleDumpValue_: function(row) {
- var linkEl = ownerDocument.createElement('tr-ui-a-analysis-link');
- linkEl.setSelectionAndContent(new tr.model.EventSet([row]));
- linkEl.appendChild(tr.v.ui.createScalarSpan(row.start, {
- unit: tr.v.Unit.byName.timeStampInMs,
- ownerDocument: ownerDocument
- }));
- return linkEl;
- },
-
- groupedDumpValue_: function(row) {
- var linkEl = ownerDocument.createElement('tr-ui-a-analysis-link');
- linkEl.setSelectionAndContent(new tr.model.EventSet(row.subRows));
- linkEl.appendChild(tr.ui.b.createSpan({
- ownerDocument: ownerDocument,
- textContent: row.subRows.length + ' memory dump' +
- (row.subRows.length === 1 ? '' : 's') + ' in '
- }));
- linkEl.appendChild(tr.ui.b.createSpan({
- ownerDocument: ownerDocument,
- textContent: row.containerName,
- bold: true
- }));
- return linkEl;
- }
- }
- ];
-
- var table = this.ownerDocument.createElement('tr-ui-b-table');
- table.tableColumns = columns;
- table.tableRows = rows;
- table.showHeader = false;
- table.rebuild();
- this.$.content.appendChild(table);
- }
- });
-
- return {};
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/container_memory_dump_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/container_memory_dump_sub_view_test.html
deleted file mode 100644
index 0619106cd1f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/container_memory_dump_sub_view_test.html
+++ /dev/null
@@ -1,349 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import"
- href="/tracing/ui/analysis/container_memory_dump_sub_view.html">
-<link rel="import"
- href="/tracing/ui/analysis/memory_dump_sub_view_test_utils.html">
-<link rel="import" href="/tracing/ui/base/deep_utils.html">
-<link rel="import" href="/tracing/ui/brushing_state_controller.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var EventSet = tr.model.EventSet;
- var extractVmRegions = tr.ui.analysis.extractVmRegions;
- var extractMemoryAllocatorDumps = tr.ui.analysis.extractMemoryAllocatorDumps;
- var extractHeapDumps = tr.ui.analysis.extractHeapDumps;
-
- function createViewWithSelection(selection, opt_parentElement) {
- var viewEl = document.createElement(
- 'tr-ui-a-container-memory-dump-sub-view');
- if (opt_parentElement)
- opt_parentElement.appendChild(viewEl);
- if (selection === undefined) {
- viewEl.selection = undefined;
- } else {
- // Rotate the list of selected dumps to check that the sub-view sorts
- // them properly.
- var length = selection.length;
- viewEl.selection = new tr.model.EventSet(
- selection.slice(length / 2, length).concat(
- selection.slice(0, length / 2)));
- }
- return viewEl;
- }
-
- function createAndCheckContainerMemoryDumpView(
- test, containerMemoryDumps, detailsCheckCallback, opt_parentElement) {
- var viewEl =
- createViewWithSelection(containerMemoryDumps, opt_parentElement);
- if (!opt_parentElement)
- test.addHTMLOutput(viewEl);
-
- // The view should contain a stacked pane view with memory dump header and
- // overview panes.
- var stackedPaneViewEl = tr.b.findDeepElementMatching(
- viewEl, 'tr-ui-a-stacked-pane-view');
- var headerPaneEl = tr.b.findDeepElementMatching(
- stackedPaneViewEl, 'tr-ui-a-memory-dump-header-pane');
- var overviewPaneEl = tr.b.findDeepElementMatching(
- stackedPaneViewEl, 'tr-ui-a-memory-dump-overview-pane');
-
- // Check that the header pane and overview pane are correctly set up.
- var processMemoryDumps = containerMemoryDumps.map(function(containerDump) {
- return containerDump.processMemoryDumps;
- });
- assert.deepEqual(
- tr.b.asArray(headerPaneEl.containerMemoryDumps), containerMemoryDumps);
- assert.deepEqual(overviewPaneEl.processMemoryDumps, processMemoryDumps);
- assert.strictEqual(
- overviewPaneEl.aggregationMode, headerPaneEl.aggregationMode);
-
- // Get the overview pane table to drive the details pane checks.
- var overviewTableEl = tr.b.findDeepElementMatching(
- overviewPaneEl, 'tr-ui-b-table');
-
- function checkVmRegionsPane(pid) {
- var detailsPaneEl = tr.b.findDeepElementMatching(
- stackedPaneViewEl, 'tr-ui-a-memory-dump-vm-regions-details-pane');
- if (pid === undefined) {
- assert.isUndefined(detailsPaneEl);
- } else {
- assert.deepEqual(tr.b.asArray(detailsPaneEl.vmRegions),
- extractVmRegions(processMemoryDumps, pid));
- assert.strictEqual(
- detailsPaneEl.aggregationMode, headerPaneEl.aggregationMode);
- }
- }
-
- function checkAllocatorPane(pid, allocatorName, withHeapDetailsPane) {
- var allocatorDetailsPaneEl = tr.b.findDeepElementMatching(
- stackedPaneViewEl, 'tr-ui-a-memory-dump-allocator-details-pane');
- if (pid === undefined) {
- assert.isUndefined(allocatorDetailsPaneEl);
- assert.isUndefined(allocatorName); // Test sanity check.
- assert.isUndefined(withHeapDetailsPane); // Test sanity check.
- return;
- }
-
- assert.deepEqual(
- tr.b.asArray(allocatorDetailsPaneEl.memoryAllocatorDumps),
- extractMemoryAllocatorDumps(processMemoryDumps, pid, allocatorName));
- assert.strictEqual(
- allocatorDetailsPaneEl.aggregationMode, headerPaneEl.aggregationMode);
-
- var heapDetailsPaneEl = tr.b.findDeepElementMatching(
- stackedPaneViewEl, 'tr-ui-a-memory-dump-heap-details-pane');
- if (!withHeapDetailsPane) {
- assert.isUndefined(heapDetailsPaneEl);
- return;
- }
-
- assert.deepEqual(tr.b.asArray(heapDetailsPaneEl.heapDumps),
- extractHeapDumps(processMemoryDumps, pid, allocatorName));
- assert.strictEqual(
- heapDetailsPaneEl.aggregationMode, headerPaneEl.aggregationMode);
- }
-
- detailsCheckCallback(
- overviewTableEl, checkVmRegionsPane, checkAllocatorPane);
- }
-
- test('instantiate_empty', function() {
- // All these views should be completely empty.
- var unsetViewEl = document.createElement(
- 'tr-ui-a-container-memory-dump-sub-view');
- this.addHTMLOutput(unsetViewEl);
- assert.equal(unsetViewEl.getBoundingClientRect().width, 0);
- assert.equal(unsetViewEl.getBoundingClientRect().height, 0);
-
- var undefinedViewEl = createViewWithSelection(undefined);
- this.addHTMLOutput(undefinedViewEl);
- assert.equal(undefinedViewEl.getBoundingClientRect().width, 0);
- assert.equal(undefinedViewEl.getBoundingClientRect().height, 0);
-
- var emptyViewEl = createViewWithSelection([]);
- this.addHTMLOutput(emptyViewEl);
- assert.equal(emptyViewEl.getBoundingClientRect().width, 0);
- assert.equal(emptyViewEl.getBoundingClientRect().height, 0);
- });
-
- test('instantiate_singleGlobalMemoryDump', function() {
- createAndCheckContainerMemoryDumpView(this,
- [tr.ui.analysis.createSingleTestGlobalMemoryDump()],
- function(overviewTableEl, checkVmRegionsPane, checkAllocatorPane) {
- // Nothing should be selected initially.
- assert.isUndefined(overviewTableEl.selectedTableRow);
- assert.isUndefined(overviewTableEl.selectedColumnIndex);
- checkVmRegionsPane(undefined);
- checkAllocatorPane(undefined);
-
- // Total resident of Process 1.
- overviewTableEl.selectedTableRow = overviewTableEl.tableRows[0];
- overviewTableEl.selectedColumnIndex = 1;
- checkVmRegionsPane(1 /* PID */);
- checkAllocatorPane(undefined);
-
- // PSS of process 4.
- overviewTableEl.selectedColumnIndex = 3;
- overviewTableEl.selectedTableRow = overviewTableEl.tableRows[2];
- checkVmRegionsPane(undefined);
- checkAllocatorPane(undefined);
-
- // Malloc of process 2.
- overviewTableEl.selectedTableRow = overviewTableEl.tableRows[1];
- overviewTableEl.selectedColumnIndex = 9;
- checkVmRegionsPane(undefined);
- checkAllocatorPane(2 /* PID */, 'malloc',
- false /* no heap details pane */);
- });
- });
-
- test('instantiate_multipleGlobalMemoryDumps', function() {
- createAndCheckContainerMemoryDumpView(this,
- tr.ui.analysis.createMultipleTestGlobalMemoryDumps(),
- function(overviewTableEl, checkVmRegionsPane, checkAllocatorPane) {
- // Nothing should be selected initially.
- assert.isUndefined(overviewTableEl.selectedTableRow);
- assert.isUndefined(overviewTableEl.selectedColumnIndex);
- checkVmRegionsPane(undefined);
- checkAllocatorPane(undefined);
-
- // Blink of Process 1.
- overviewTableEl.selectedTableRow = overviewTableEl.tableRows[0];
- overviewTableEl.selectedColumnIndex = 7;
- checkVmRegionsPane(undefined);
- checkAllocatorPane(undefined);
-
- // Peak total resident of Process 4.
- overviewTableEl.selectedTableRow = overviewTableEl.tableRows[3];
- overviewTableEl.selectedColumnIndex = 2;
- checkVmRegionsPane(undefined);
- checkAllocatorPane(undefined);
-
- // V8 of Process 3.
- overviewTableEl.selectedTableRow = overviewTableEl.tableRows[2];
- overviewTableEl.selectedColumnIndex = 11;
- checkVmRegionsPane(undefined);
- checkAllocatorPane(3 /* PID */, 'v8', true /* heap details pane */);
- });
- });
-
- test('instantiate_singleProcessMemoryDump', function() {
- createAndCheckContainerMemoryDumpView(this,
- [tr.ui.analysis.createSingleTestProcessMemoryDump()],
- function(overviewTableEl, checkVmRegionsPane, checkAllocatorPane) {
- // Nothing should be selected initially.
- assert.isUndefined(overviewTableEl.selectedTableRow);
- assert.isUndefined(overviewTableEl.selectedColumnIndex);
- checkVmRegionsPane(undefined);
- checkAllocatorPane(undefined);
-
- // Tracing of Process 2.
- overviewTableEl.selectedTableRow = overviewTableEl.tableRows[0];
- overviewTableEl.selectedColumnIndex = 12;
- checkVmRegionsPane(undefined);
- checkAllocatorPane(2 /* PID */, 'tracing',
- false /* no heap details pane */);
-
- // Blink of Process 2.
- overviewTableEl.selectedColumnIndex = 7;
- checkVmRegionsPane(undefined);
- checkAllocatorPane(2 /* PID */, 'blink',
- false /* no heap details pane */);
-
- // Total resident of Process 2.
- overviewTableEl.selectedColumnIndex = 1;
- checkVmRegionsPane(2 /* PID */);
- checkAllocatorPane(undefined);
- });
- });
-
- test('instantiate_multipleProcessMemoryDumps', function() {
- createAndCheckContainerMemoryDumpView(this,
- tr.ui.analysis.createMultipleTestProcessMemoryDumps(),
- function(overviewTableEl, checkVmRegionsPane, checkAllocatorPane) {
- // Nothing should be selected initially.
- assert.isUndefined(overviewTableEl.selectedTableRow);
- assert.isUndefined(overviewTableEl.selectedColumnIndex);
- checkVmRegionsPane(undefined);
- checkAllocatorPane(undefined);
-
- // Tracing of Process 2.
- overviewTableEl.selectedTableRow = overviewTableEl.tableRows[0];
- overviewTableEl.selectedColumnIndex = 12;
- checkVmRegionsPane(undefined);
- checkAllocatorPane(2 /* PID */, 'tracing',
- false /* no heap details pane */);
-
- // V8 of Process 2.
- overviewTableEl.selectedColumnIndex = 11;
- checkVmRegionsPane(undefined);
- checkAllocatorPane(2 /* PID */, 'v8',
- false /* no heap details pane */);
-
- // PSS of Process 2.
- overviewTableEl.selectedColumnIndex = 3;
- checkVmRegionsPane(2 /* PID */);
- checkAllocatorPane(undefined);
- });
- });
-
- test('memory', function() {
- var containerEl = document.createElement('div');
- containerEl.brushingStateController =
- new tr.c.BrushingStateController(undefined);
-
- // Create the first container memory view.
- createAndCheckContainerMemoryDumpView(this,
- [tr.ui.analysis.createSingleTestProcessMemoryDump()],
- function(overviewTableEl, checkVmRegionsPane, checkAllocatorPane) {
- // Nothing should be selected initially.
- assert.isUndefined(overviewTableEl.selectedTableRow);
- assert.isUndefined(overviewTableEl.selectedColumnIndex);
- checkVmRegionsPane(undefined);
- checkAllocatorPane(undefined);
-
- // Select V8 of Process 2.
- overviewTableEl.selectedTableRow = overviewTableEl.tableRows[0];
- overviewTableEl.selectedColumnIndex = 11;
- checkVmRegionsPane(undefined);
- checkAllocatorPane(2 /* PID */, 'v8',
- false /* no heap details pane */);
- }, containerEl);
-
- // Destroy the first container memory view.
- containerEl.textContent = '';
-
- // Create the second container memory view.
- createAndCheckContainerMemoryDumpView(this,
- tr.ui.analysis.createMultipleTestGlobalMemoryDumps(),
- function(overviewTableEl, checkVmRegionsPane, checkAllocatorPane) {
- // V8 of Process 2 should still be selected (even though the selection
- // changed).
- assert.strictEqual(
- overviewTableEl.selectedTableRow, overviewTableEl.tableRows[1]);
- assert.equal(overviewTableEl.selectedColumnIndex, 11);
- checkVmRegionsPane(undefined);
- checkAllocatorPane(2 /* PID */, 'v8',
- false /* no heap details pane */);
- }, containerEl);
- });
-
- test('instantiate_differentProcessMemoryDumps', function() {
- var globalMemoryDumps =
- tr.ui.analysis.createMultipleTestGlobalMemoryDumps();
- // 2 dumps in Process 1, 3 dumps in Process 2, and 1 dump in Process 4
- // (intentionally shuffled to check sorting).
- var differentProcessDumps = [
- globalMemoryDumps[1].processMemoryDumps[2],
- globalMemoryDumps[0].processMemoryDumps[1],
- globalMemoryDumps[0].processMemoryDumps[2],
- globalMemoryDumps[1].processMemoryDumps[4],
- globalMemoryDumps[1].processMemoryDumps[1],
- globalMemoryDumps[2].processMemoryDumps[2]
- ];
-
- var viewEl = createViewWithSelection(differentProcessDumps);
- this.addHTMLOutput(viewEl);
-
- var tableEl = tr.b.findDeepElementMatching(viewEl, 'tr-ui-b-table');
- assert.lengthOf(tableEl.tableRows, 3);
- assert.lengthOf(tableEl.tableColumns, 1);
- var rows = tableEl.tableRows;
- var col = tableEl.tableColumns[0];
-
- assert.equal(col.value(rows[0]).textContent,
- '2 memory dumps in Process 1');
- assert.equal(col.value(rows[1]).textContent,
- '3 memory dumps in Process 2');
- assert.equal(col.value(rows[2]).textContent,
- '1 memory dump in Process 4');
-
- // Check that the analysis link is associated with the right dumps.
- assert.isTrue(col.value(rows[1]).selection.equals(new tr.model.EventSet([
- globalMemoryDumps[0].processMemoryDumps[2],
- globalMemoryDumps[1].processMemoryDumps[2],
- globalMemoryDumps[2].processMemoryDumps[2]
- ])));
-
- assert.lengthOf(rows[1].subRows, 3);
- var subRow = rows[1].subRows[0];
-
- // Check the timestamp.
- assert.equal(col.value(subRow).children[0].value, 42);
-
- // Check that the analysis link is associated with the right dump.
- assert.isTrue(col.value(subRow).selection.equals(
- new tr.model.EventSet(globalMemoryDumps[0].processMemoryDumps[2])));
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/counter_sample_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/counter_sample_sub_view.html
deleted file mode 100644
index 40ae156078c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/counter_sample_sub_view.html
+++ /dev/null
@@ -1,120 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-
-<polymer-element name='tr-ui-a-counter-sample-sub-view'
- extends='tr-ui-a-sub-view'>
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
- </style>
- <tr-ui-b-table id='table'></tr-ui-b-table>
- </template>
-</polymer-element>
-
-<script>
-'use strict';
-(function() {
- var COUNTER_SAMPLE_TABLE_COLUMNS = [
- {
- title: 'Counter',
- width: '150px',
- value: function(row) { return row.counter; }
- },
- {
- title: 'Series',
- width: '150px',
- value: function(row) { return row.series; }
- },
- {
- title: 'Time',
- width: '150px',
- value: function(row) { return row.start; }
- },
- {
- title: 'Value',
- width: '100%',
- value: function(row) { return row.value; }
- }
- ];
-
- Polymer('tr-ui-a-counter-sample-sub-view', {
- ready: function() {
- this.currentSelection_ = undefined;
- this.$.table.tableColumns = COUNTER_SAMPLE_TABLE_COLUMNS;
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- set selection(selection) {
- this.currentSelection_ = selection;
- this.updateContents_();
- },
-
- updateContents_: function() {
- this.$.table.tableRows =
- this.selection ? this.getRows_(this.selection.toArray()) : [];
- this.$.table.rebuild();
- },
-
- /**
- * Returns the table rows for the specified samples.
- *
- * We print each counter/series combination the first time that it
- * appears. For subsequent samples in each series, we omit the counter
- * and series name. This makes it easy to scan to find the next series.
- *
- * Each series can be collapsed. In the expanded state, all samples
- * are shown. In the collapsed state, only the first sample is displayed.
- */
- getRows_: function(samples) {
- var samplesByCounter = tr.b.group(samples, function(sample) {
- return sample.series.counter.guid;
- });
-
- var rows = [];
- tr.b.iterItems(samplesByCounter, function(unused, counterSamples) {
- var samplesBySeries = tr.b.group(counterSamples, function(sample) {
- return sample.series.guid;
- });
-
- tr.b.iterItems(samplesBySeries, function(unused, seriesSamples) {
- var seriesRows = this.getRowsForSamples_(seriesSamples);
- seriesRows[0].counter = seriesSamples[0].series.counter.name;
- seriesRows[0].series = seriesSamples[0].series.name;
-
- if (seriesRows.length > 1) {
- seriesRows[0].subRows = seriesRows.slice(1);
- seriesRows[0].isExpanded = true;
- }
-
- rows.push(seriesRows[0]);
- }, this);
- }, this);
-
- return rows;
- },
-
- getRowsForSamples_: function(samples) {
- return samples.map(function(sample) {
- return {
- start: sample.timestamp,
- value: sample.value
- };
- });
- }
- });
-})();
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/counter_sample_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/counter_sample_sub_view_test.html
deleted file mode 100644
index 4edec830945..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/counter_sample_sub_view_test.html
+++ /dev/null
@@ -1,172 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/counter.html">
-<link rel="import" href="/tracing/model/counter_series.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/counter_sample_sub_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- var Counter = tr.model.Counter;
- var CounterSeries = tr.model.CounterSeries;
- var EventSet = tr.model.EventSet;
-
- test('instantiate_undefinedSelection', function() {
- var analysisEl = document.createElement('tr-ui-a-counter-sample-sub-view');
- analysisEl.selection = new EventSet(undefined);
-
- assert.lengthOf(analysisEl.$.table.tableRows, 0);
- });
-
- test('instantiate_oneCounterOneSeries', function() {
- var series = new CounterSeries('series1', 0);
- series.addCounterSample(0, 0);
- series.addCounterSample(1, 10);
-
- var counter = new Counter(null, 0, 'cat', 'ctr1');
- counter.addSeries(series);
-
- var analysisEl = document.createElement('tr-ui-a-counter-sample-sub-view');
- analysisEl.selection = new EventSet(series.samples);
- this.addHTMLOutput(analysisEl);
-
- // The first sample should be listed as a collapsible header row for the
- // series.
- var rows = analysisEl.$.table.tableRows;
- assert.lengthOf(rows, 1);
- assert.isTrue(rows[0].isExpanded);
- assert.equal(rows[0].counter, 'ctr1');
- assert.equal(rows[0].series, 'series1');
- assert.equal(rows[0].start, 0);
- assert.equal(rows[0].value, 0);
-
- // The second sample should be listed as a subrow of the first.
- var subRows = rows[0].subRows;
- assert.lengthOf(subRows, 1);
- assert.isUndefined(subRows[0].counter);
- assert.isUndefined(subRows[0].series);
- assert.equal(subRows[0].start, 1);
- assert.equal(subRows[0].value, 10);
- });
-
- test('instantiate_singleSampleDoesntHaveSubrows', function() {
- var series = new CounterSeries('series1', 0);
- series.addCounterSample(0, 0);
-
- var counter = new Counter(null, 0, 'cat', 'ctr1');
- counter.addSeries(series);
-
- var analysisEl = document.createElement('tr-ui-a-counter-sample-sub-view');
- analysisEl.selection = new EventSet(series.samples);
- this.addHTMLOutput(analysisEl);
-
- // The first sample should be listed as a collapsible header row for the
- // series.
- var rows = analysisEl.$.table.tableRows;
- assert.lengthOf(rows, 1);
- assert.equal(rows[0].counter, 'ctr1');
- assert.equal(rows[0].series, 'series1');
- assert.equal(rows[0].start, 0);
- assert.equal(rows[0].value, 0);
- assert.isUndefined(rows[0].subRows);
- });
-
- test('instantiate_oneCounterTwoSeries', function() {
- var series1 = new CounterSeries('series1', 0);
- series1.addCounterSample(1, 10);
- series1.addCounterSample(2, 20);
-
- var series2 = new CounterSeries('series2', 0);
- series2.addCounterSample(3, 30);
-
- var counter = new Counter(null, 0, 'cat', 'ctr1');
- counter.addSeries(series1);
- counter.addSeries(series2);
-
- var analysisEl = document.createElement('tr-ui-a-counter-sample-sub-view');
- analysisEl.selection =
- new EventSet(series1.samples.concat(series2.samples));
- this.addHTMLOutput(analysisEl);
-
- // The first samples should be listed as collapsible header rows for the
- // series.
- var rows = analysisEl.$.table.tableRows;
- assert.lengthOf(rows, 2);
- assert.equal(rows[0].counter, 'ctr1');
- assert.equal(rows[0].series, 'series1');
- assert.equal(rows[0].start, 1);
- assert.equal(rows[0].value, 10);
-
- assert.equal(rows[1].counter, 'ctr1');
- assert.equal(rows[1].series, 'series2');
- assert.equal(rows[1].start, 3);
- assert.equal(rows[1].value, 30);
-
- // The subsequent samples should be listed as subrows of the first.
- var subRows1 = rows[0].subRows;
- assert.lengthOf(subRows1, 1);
- assert.isUndefined(subRows1[0].counter);
- assert.isUndefined(subRows1[0].series);
- assert.equal(subRows1[0].start, 2);
- assert.equal(subRows1[0].value, 20);
-
- assert.isUndefined(rows[1].subRows);
- });
-
- test('instantiate_twoCountersTwoSeries', function() {
- var series1 = new CounterSeries('series1', 0);
- series1.addCounterSample(1, 10);
-
- var series2 = new CounterSeries('series2', 0);
- series2.addCounterSample(2, 20);
-
- var counter1 = new Counter(null, 0, 'cat', 'ctr1');
- var counter2 = new Counter(null, 0, 'cat', 'ctr2');
- counter1.addSeries(series1);
- counter2.addSeries(series2);
-
- var analysisEl = document.createElement('tr-ui-a-counter-sample-sub-view');
- analysisEl.selection =
- new EventSet(series1.samples.concat(series2.samples));
- this.addHTMLOutput(analysisEl);
-
- // Each sample should be a header row with no subrows.
- var rows = analysisEl.$.table.tableRows;
- assert.lengthOf(rows, 2);
- assert.equal(rows[0].counter, 'ctr1');
- assert.equal(rows[0].series, 'series1');
- assert.equal(rows[0].start, 1);
- assert.equal(rows[0].value, 10);
- assert.isUndefined(rows[0].subRows);
-
- assert.equal(rows[1].counter, 'ctr2');
- assert.equal(rows[1].series, 'series2');
- assert.equal(rows[1].start, 2);
- assert.equal(rows[1].value, 20);
- assert.isUndefined(rows[1].subRows);
- });
-
- test('instantiate_contentsClearedEachSelection', function() {
- var series = new CounterSeries('series1', 0);
- series.addCounterSample(0, 0);
-
- var counter = new Counter(null, 0, 'cat', 'ctr1');
- counter.addSeries(series);
-
- var analysisEl = document.createElement('tr-ui-a-counter-sample-sub-view');
- analysisEl.selection = new EventSet(series.samples);
- analysisEl.selection = new EventSet(series.samples);
- this.addHTMLOutput(analysisEl);
-
- assert.lengthOf(analysisEl.$.table.tableRows, 1);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/flow_classifier.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/flow_classifier.html
deleted file mode 100644
index 3895af57ea1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/flow_classifier.html
+++ /dev/null
@@ -1,89 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.analysis', function() {
- var FLOW_IN = 0x1;
- var FLOW_OUT = 0x2;
- var FLOW_IN_OUT = FLOW_IN | FLOW_OUT;
-
- function FlowClassifier() {
- this.numEvents_ = 0;
- this.eventsByGUID_ = {};
- }
-
- FlowClassifier.prototype = {
- getFS_: function(event) {
- var fs = this.eventsByGUID_[event.guid];
- if (fs === undefined) {
- this.numEvents_++;
- fs = {
- state: 0,
- event: event
- };
- this.eventsByGUID_[event.guid] = fs;
- }
- return fs;
- },
-
- addInFlow: function(event) {
- var fs = this.getFS_(event);
- fs.state |= FLOW_IN;
- return event;
- },
-
- addOutFlow: function(event) {
- var fs = this.getFS_(event);
- fs.state |= FLOW_OUT;
- return event;
- },
-
- hasEvents: function() {
- return this.numEvents_ > 0;
- },
-
- get inFlowEvents() {
- var selection = new tr.model.EventSet();
- for (var guid in this.eventsByGUID_) {
- var fs = this.eventsByGUID_[guid];
- if (fs.state === FLOW_IN)
- selection.push(fs.event);
- }
- return selection;
- },
-
- get outFlowEvents() {
- var selection = new tr.model.EventSet();
- for (var guid in this.eventsByGUID_) {
- var fs = this.eventsByGUID_[guid];
- if (fs.state === FLOW_OUT)
- selection.push(fs.event);
- }
- return selection;
- },
-
- get internalFlowEvents() {
- var selection = new tr.model.EventSet();
- for (var guid in this.eventsByGUID_) {
- var fs = this.eventsByGUID_[guid];
- if (fs.state === FLOW_IN_OUT)
- selection.push(fs.event);
- }
- return selection;
- }
- };
-
- return {
- FlowClassifier: FlowClassifier
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/flow_classifier_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/flow_classifier_test.html
deleted file mode 100644
index 63ea528e2e0..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/flow_classifier_test.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/ui/analysis/flow_classifier.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newFlowEventEx = tr.c.TestUtils.newFlowEventEx;
-
- test('basic', function() {
- var a = newFlowEventEx({
- 'title': 'a', start: 0, end: 10 });
- var b = newFlowEventEx({
- 'title': 'b', start: 10, end: 20 });
- var c = newFlowEventEx({
- 'title': 'c', start: 20, end: 25 });
- var d = newFlowEventEx({
- 'title': 'd', start: 30, end: 35 });
-
- var fc = new tr.ui.analysis.FlowClassifier();
- fc.addInFlow(a);
-
- fc.addInFlow(b);
- fc.addOutFlow(b);
-
- fc.addInFlow(c);
- fc.addOutFlow(c);
-
- fc.addOutFlow(d);
-
- function asSortedArray(selection) {
- var events = tr.b.asArray(selection);
- events.sort(function(a, b) {
- return a.guid - b.guid;
- });
- return events;
- }
-
- assert.deepEqual(tr.b.asArray(fc.inFlowEvents), [a]);
- assert.deepEqual(tr.b.asArray(fc.outFlowEvents), [d]);
- assert.deepEqual(tr.b.asArray(fc.internalFlowEvents), [b, c]);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/frame_power_usage_chart.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/frame_power_usage_chart.html
deleted file mode 100644
index 87162a4e023..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/frame_power_usage_chart.html
+++ /dev/null
@@ -1,139 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/base/line_chart.html">
-
-<!--
-@fileoverview A line chart showing milliseconds since the start of the frame on
-the x-axis and power consumption on the y-axis. Each frame is shown as a
-separate line in the chart. Vertical sync events are used as the start of each
-frame.
-
-This chart aims to help users understand the shape of the power consumption
-curve over the course of a frame or set of frames.
--->
-<polymer-element name="tr-ui-a-frame-power-usage-chart">
- <template>
- <div id="content"></div>
- </template>
-</polymer-element>
-
-<script>
-'use strict';
-
-var EventSet = tr.model.EventSet;
-
-var CHART_TITLE = 'Power (W) by ms since vertical sync';
-// TODO(charliea): Find out how to make this specifiable via CSS.
-var CHART_WIDTH_FRACTION_OF_BODY = 0.5;
-
-Polymer('tr-ui-a-frame-power-usage-chart', {
- ready: function() {
- this.chart_ = undefined;
- this.samples_ = new EventSet();
- this.vSyncTimestamps_ = [];
- },
-
- get chart() {
- return this.chart_;
- },
-
- get samples() {
- return this.samples_;
- },
-
- get vSyncTimestamps() {
- return this.vSyncTimestamps_;
- },
-
- /**
- * Sets the data that powers the chart. Vsync timestamps must be in
- * chronological order.
- */
- setData: function(samples, vSyncTimestamps) {
- this.samples_ = (samples === undefined) ? new EventSet() : samples;
- this.vSyncTimestamps_ =
- (vSyncTimestamps === undefined) ? [] : vSyncTimestamps;
- this.updateContents_();
- },
-
- updateContents_: function() {
- this.clearChart_();
-
- var data = this.getDataForLineChart_();
-
- if (data.length === 0)
- return;
-
- this.chart_ = this.createChart_(data);
- this.$.content.appendChild(this.chart_);
- },
-
- createChart_: function(data) {
- var chart = new tr.ui.b.LineChart();
- var width = document.body.clientWidth * CHART_WIDTH_FRACTION_OF_BODY;
- chart.setSize({width: width, height: chart.height});
- chart.chartTitle = CHART_TITLE;
- chart.data = data;
-
- return chart;
- },
-
- clearChart_: function() {
- var content = this.$.content;
- while (content.firstChild)
- content.removeChild(content.firstChild);
-
- this.chart_ = undefined;
- },
-
- // TODO(charliea): Limit the ms since vsync to the median frame length. The
- // vertical syncs are not 100% regular and highlighting any sample that's
- // in one of these 'vertical sync lulls' makes the x-axis have a much larger
- // scale than it should, effectively squishing the other samples into the
- // left side of the chart.
- /**
- * Returns an array of data points for the chart. Each element in the array
- * is of the form { x: <ms since vsync>, f<frame#>: <power in mW> }.
- */
- getDataForLineChart_: function() {
- var sortedSamples = this.sortSamplesByTimestampAscending_(this.samples);
- var vSyncTimestamps = this.vSyncTimestamps.slice();
-
- var lastVSyncTimestamp = undefined;
- var points = [];
-
- // For each power sample, find and record the frame number that it belongs
- // to as well as the amount of time elapsed since that frame began.
- var frameNumber = 0;
- sortedSamples.forEach(function(sample) {
- while (vSyncTimestamps.length > 0 && vSyncTimestamps[0] <= sample.start) {
- lastVSyncTimestamp = vSyncTimestamps.shift();
- frameNumber++;
- }
-
- // If no vertical sync occurred before the power sample, don't use the
- // power sample.
- if (lastVSyncTimestamp === undefined)
- return;
-
- var point = { x: sample.start - lastVSyncTimestamp };
- point['f' + frameNumber] = sample.power;
- points.push(point);
- });
-
- return points;
- },
-
- sortSamplesByTimestampAscending_: function(samples) {
- return samples.toArray().sort(function(smpl1, smpl2) {
- return smpl1.start - smpl2.start;
- });
- }
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/frame_power_usage_chart_perf_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/frame_power_usage_chart_perf_test.html
deleted file mode 100644
index bf8e8619ac5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/frame_power_usage_chart_perf_test.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/power_sample.html">
-<link rel="import" href="/tracing/model/power_series.html">
-<link rel="import" href="/tracing/ui/analysis/frame_power_usage_chart.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- function instantiateManyFrames() {
- var model = new tr.Model();
- var numFrames = 200;
- var samplesPerFrame = 200;
-
- // Set up the test data.
- var series = new tr.model.PowerSeries(model.device);
- var vsyncTimestamps = [];
- for (var i = 0; i < numFrames; i++) {
- vsyncTimestamps.push(i * samplesPerFrame);
- for (var j = 0; j < samplesPerFrame; j++)
- series.addPowerSample(vsyncTimestamps[i] + j, j);
- }
- var samples = series.samples;
-
- // Display the chart.
- var chart = document.createElement('tr-ui-a-frame-power-usage-chart');
- chart.setData(new tr.model.EventSet(samples), vsyncTimestamps);
- this.addHTMLOutput(chart);
- }
-
- timedPerfTest('frame_power_usage_chart', instantiateManyFrames, {
- iterations: 1
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/frame_power_usage_chart_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/frame_power_usage_chart_test.html
deleted file mode 100644
index e65a90b2295..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/frame_power_usage_chart_test.html
+++ /dev/null
@@ -1,267 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/power_sample.html">
-<link rel="import" href="/tracing/model/power_series.html">
-<link rel="import" href="/tracing/ui/analysis/frame_power_usage_chart.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate_noSamples', function() {
- var series = new tr.model.PowerSeries(new tr.Model().device);
-
- var chart = document.createElement('tr-ui-a-frame-power-usage-chart');
- chart.setData(undefined, [0]);
-
- assert.isUndefined(chart.chart);
- });
-
- test('instantiate_noVSyncs', function() {
- var series = new tr.model.PowerSeries(new tr.Model().device);
-
- series.addPowerSample(0, 1);
- series.addPowerSample(1, 2);
- series.addPowerSample(2, 3);
- series.addPowerSample(3, 2);
-
- var chart = document.createElement('tr-ui-a-frame-power-usage-chart');
- chart.setData(new tr.model.EventSet(series.samples), []);
-
- assert.isUndefined(chart.chart);
- });
-
- test('instantiate_noSamplesOrVSyncs', function() {
- var series = new tr.model.PowerSeries(new tr.Model().device);
-
- var chart = document.createElement('tr-ui-a-frame-power-usage-chart');
- chart.setData(undefined, []);
-
- assert.isUndefined(chart.chart);
- });
-
- test('instantiate_oneFrame', function() {
- var series = new tr.model.PowerSeries(new tr.Model().device);
-
- var vSyncTimestamps = [0];
- series.addPowerSample(0, 1);
- series.addPowerSample(1, 2);
- series.addPowerSample(2, 3);
- series.addPowerSample(3, 2);
-
- var chart = document.createElement('tr-ui-a-frame-power-usage-chart');
- chart.setData(new tr.model.EventSet(series.samples), vSyncTimestamps);
-
- this.addHTMLOutput(chart);
-
- var expectedChartData = [
- { x: 0, f1: 1 },
- { x: 1, f1: 2 },
- { x: 2, f1: 3 },
- { x: 3, f1: 2 }
- ];
- assert.sameDeepMembers(chart.chart.data, expectedChartData);
- });
-
- test('instantiate_twoFrames', function() {
- var series = new tr.model.PowerSeries(new tr.Model().device);
-
- var vSyncTimestamps = [0, 4];
- series.addPowerSample(0, 1);
- series.addPowerSample(1, 2);
- series.addPowerSample(2, 3);
- series.addPowerSample(3, 2);
- series.addPowerSample(4, 2);
- series.addPowerSample(5, 3);
- series.addPowerSample(6, 4);
- series.addPowerSample(7, 3);
-
- var chart = document.createElement('tr-ui-a-frame-power-usage-chart');
- chart.setData(new tr.model.EventSet(series.samples), vSyncTimestamps);
-
- this.addHTMLOutput(chart);
-
- var expectedChartData = [
- { x: 0, f1: 1 },
- { x: 1, f1: 2 },
- { x: 2, f1: 3 },
- { x: 3, f1: 2 },
- { x: 0, f2: 2 },
- { x: 1, f2: 3 },
- { x: 2, f2: 4 },
- { x: 3, f2: 3 }
- ];
- assert.sameDeepMembers(chart.chart.data, expectedChartData);
- });
-
- test('instantiate_twoFramesDifferentXValues', function() {
- var series = new tr.model.PowerSeries(new tr.Model().device);
-
- // Power samples taken at 0, 1, 2, and 3s after frame start.
- var vSyncTimestamps = [0, 4];
- series.addPowerSample(0, 1);
- series.addPowerSample(1, 2);
- series.addPowerSample(2, 3);
- series.addPowerSample(3, 2);
- // Power samples taken at 0.5, 1.5, 2.5, and 3.5s after frame start.
- series.addPowerSample(4.5, 2);
- series.addPowerSample(5.5, 3);
- series.addPowerSample(6.5, 4);
- series.addPowerSample(7.5, 3);
-
- var chart = document.createElement('tr-ui-a-frame-power-usage-chart');
- chart.setData(new tr.model.EventSet(series.samples), vSyncTimestamps);
-
- this.addHTMLOutput(chart);
-
- var expectedChartData = [
- { x: 0, f1: 1 },
- { x: 1, f1: 2 },
- { x: 2, f1: 3 },
- { x: 3, f1: 2 },
- { x: 0.5, f2: 2 },
- { x: 1.5, f2: 3 },
- { x: 2.5, f2: 4 },
- { x: 3.5, f2: 3 }
- ];
- assert.sameDeepMembers(chart.chart.data, expectedChartData);
- });
-
- test('instantiate_samplesBeforeFirstVSync', function() {
- var series = new tr.model.PowerSeries(new tr.Model().device);
-
- var vSyncTimestamps = [4];
- series.addPowerSample(0, 1);
- series.addPowerSample(1, 2);
- series.addPowerSample(2, 3);
- series.addPowerSample(3, 2);
- series.addPowerSample(4, 2);
- series.addPowerSample(5, 3);
- series.addPowerSample(6, 4);
- series.addPowerSample(7, 3);
-
- var chart = document.createElement('tr-ui-a-frame-power-usage-chart');
- chart.setData(new tr.model.EventSet(series.samples), vSyncTimestamps);
-
- this.addHTMLOutput(chart);
-
- var expectedChartData = [
- { x: 0, f1: 2 },
- { x: 1, f1: 3 },
- { x: 2, f1: 4 },
- { x: 3, f1: 3 }
- ];
- assert.sameDeepMembers(chart.chart.data, expectedChartData);
- });
-
- test('instantiate_allSamplesBeforeFirstVSync', function() {
- var series = new tr.model.PowerSeries(new tr.Model().device);
-
- var vSyncTimestamps = [4];
- series.addPowerSample(0, 1);
- series.addPowerSample(1, 2);
- series.addPowerSample(2, 3);
- series.addPowerSample(3, 2);
-
- var chart = document.createElement('tr-ui-a-frame-power-usage-chart');
- chart.setData(new tr.model.EventSet(series.samples), vSyncTimestamps);
-
- var expectedChartData = [
- { x: 0, f1: 2 },
- { x: 1, f1: 3 },
- { x: 2, f1: 4 },
- { x: 3, f1: 3 }
- ];
- assert.isUndefined(chart.chart);
- });
-
- test('instantiate_vSyncsAfterLastPowerSample', function() {
- var series = new tr.model.PowerSeries(new tr.Model().device);
-
- var vSyncTimestamps = [0, 4, 8, 12];
- series.addPowerSample(0, 1);
- series.addPowerSample(1, 2);
- series.addPowerSample(2, 3);
- series.addPowerSample(3, 2);
- series.addPowerSample(4, 2);
- series.addPowerSample(5, 3);
- series.addPowerSample(6, 4);
- series.addPowerSample(7, 3);
-
- var chart = document.createElement('tr-ui-a-frame-power-usage-chart');
- chart.setData(new tr.model.EventSet(series.samples), vSyncTimestamps);
-
- this.addHTMLOutput(chart);
-
- var expectedChartData = [
- { x: 0, f1: 1 },
- { x: 1, f1: 2 },
- { x: 2, f1: 3 },
- { x: 3, f1: 2 },
- { x: 0, f2: 2 },
- { x: 1, f2: 3 },
- { x: 2, f2: 4 },
- { x: 3, f2: 3 }
- ];
- assert.sameDeepMembers(chart.chart.data, expectedChartData);
- });
-
- test('instantiate_onlyVSyncAfterLastPowerSample', function() {
- var series = new tr.model.PowerSeries(new tr.Model().device);
-
- var vSyncTimestamps = [8];
- series.addPowerSample(0, 1);
- series.addPowerSample(1, 2);
- series.addPowerSample(2, 3);
- series.addPowerSample(3, 2);
- series.addPowerSample(4, 2);
- series.addPowerSample(5, 3);
- series.addPowerSample(6, 4);
- series.addPowerSample(7, 3);
-
- var chart = document.createElement('tr-ui-a-frame-power-usage-chart');
- chart.setData(new tr.model.EventSet(series.samples), vSyncTimestamps);
-
- assert.isUndefined(chart.chart);
- });
-
-
- test('instantiate_samplesNotInChronologicalOrder', function() {
- var series = new tr.model.PowerSeries(new tr.Model().device);
-
- var vSyncTimestamps = [0, 4];
- series.addPowerSample(4, 2);
- series.addPowerSample(5, 3);
- series.addPowerSample(6, 4);
- series.addPowerSample(7, 3);
- series.addPowerSample(0, 1);
- series.addPowerSample(1, 2);
- series.addPowerSample(2, 3);
- series.addPowerSample(3, 2);
-
- var chart = document.createElement('tr-ui-a-frame-power-usage-chart');
- chart.setData(new tr.model.EventSet(series.samples), vSyncTimestamps);
-
- this.addHTMLOutput(chart);
-
- var expectedChartData = [
- { x: 0, f1: 1 },
- { x: 1, f1: 2 },
- { x: 2, f1: 3 },
- { x: 3, f1: 2 },
- { x: 0, f2: 2 },
- { x: 1, f2: 3 },
- { x: 2, f2: 4 },
- { x: 3, f2: 3 }
- ];
- assert.sameDeepMembers(chart.chart.data, expectedChartData);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/generic_object_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/generic_object_view.html
deleted file mode 100644
index 521699ee129..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/generic_object_view.html
+++ /dev/null
@@ -1,339 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/rect.html">
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/object_instance.html">
-<link rel="import" href="/tracing/model/object_snapshot.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-
-<polymer-element name="tr-ui-a-generic-object-view"
- is="HTMLUnknownElement">
- <template>
- <style>
- :host {
- display: block;
- font-family: monospace;
- }
- </style>
- <div id="content">
- </div>
- </template>
-
- <script>
- 'use strict';
-
- function isTable(object) {
- if (!(object instanceof Array) ||
- (object.length < 2)) return false;
- for (var colName in object[0]) {
- if (typeof colName !== 'string') return false;
- }
- for (var i = 0; i < object.length; ++i) {
- if (!(object[i] instanceof Object)) return false;
- for (var colName in object[i]) {
- if (i && (object[0][colName] === undefined)) return false;
- var cellType = typeof object[i][colName];
- if (cellType !== 'string' && cellType != 'number') return false;
- }
- if (i) {
- for (var colName in object[0]) {
- if (object[i][colName] === undefined) return false;
- }
- }
- }
- return true;
- }
-
- Polymer({
- ready: function() {
- this.object_ = undefined;
- },
-
- get object() {
- return this.object_;
- },
-
- set object(object) {
- this.object_ = object;
- this.updateContents_();
- },
-
- updateContents_: function() {
- this.$.content.textContent = '';
- this.appendElementsForType_('', this.object_, 0, 0, 5, '');
- },
-
- appendElementsForType_: function(
- label, object, indent, depth, maxDepth, suffix) {
- if (depth > maxDepth) {
- this.appendSimpleText_(
- label, indent, '<recursion limit reached>', suffix);
- return;
- }
-
- if (object === undefined) {
- this.appendSimpleText_(label, indent, 'undefined', suffix);
- return;
- }
-
- if (object === null) {
- this.appendSimpleText_(label, indent, 'null', suffix);
- return;
- }
-
- if (!(object instanceof Object)) {
- var type = typeof object;
- if (type == 'string') {
- var objectReplaced = false;
- if ((object[0] == '{' && object[object.length - 1] == '}') ||
- (object[0] == '[' && object[object.length - 1] == ']')) {
- try {
- object = JSON.parse(object);
- objectReplaced = true;
- } catch (e) {
- }
- }
- if (!objectReplaced) {
- if (object.indexOf('\n') !== -1) {
- var lines = object.split('\n');
- lines.forEach(function(line, i) {
- var text, ioff, ll, ss;
- if (i == 0) {
- text = '"' + line;
- ioff = 0;
- ll = label;
- ss = '';
- } else if (i < lines.length - 1) {
- text = line;
- ioff = 1;
- ll = '';
- ss = '';
- } else {
- text = line + '"';
- ioff = 1;
- ll = '';
- ss = suffix;
- }
-
- var el = this.appendSimpleText_(
- ll, indent + ioff * label.length + ioff, text, ss);
- el.style.whiteSpace = 'pre';
- return el;
- }, this);
- return;
- } else {
- this.appendSimpleText_(
- label, indent, '"' + object + '"', suffix);
- return;
- }
- }
- else {
- /* Fall through to the flow below */
- }
- } else {
- return this.appendSimpleText_(label, indent, object, suffix);
- }
- }
-
- if (object instanceof tr.model.ObjectSnapshot) {
- var link = document.createElement('tr-ui-a-analysis-link');
- link.selection = new tr.model.EventSet(object);
- this.appendElementWithLabel_(label, indent, link, suffix);
- return;
- }
-
- if (object instanceof tr.model.ObjectInstance) {
- var link = document.createElement('tr-ui-a-analysis-link');
- link.selection = new tr.model.EventSet(object);
- this.appendElementWithLabel_(label, indent, link, suffix);
- return;
- }
-
- if (object instanceof tr.b.Rect) {
- this.appendSimpleText_(label, indent, object.toString(), suffix);
- return;
- }
-
- if (object instanceof tr.v.ScalarNumeric) {
- var el = this.ownerDocument.createElement('tr-v-ui-scalar-span');
- el.value = object;
- this.appendElementWithLabel_(label, indent, el, suffix);
- return;
- }
-
- if (object instanceof Array) {
- this.appendElementsForArray_(
- label, object, indent, depth, maxDepth, suffix);
- return;
- }
-
- this.appendElementsForObject_(
- label, object, indent, depth, maxDepth, suffix);
- },
-
- appendElementsForArray_: function(
- label, object, indent, depth, maxDepth, suffix) {
- if (object.length == 0) {
- this.appendSimpleText_(label, indent, '[]', suffix);
- return;
- }
-
- if (isTable(object)) {
- var table = document.createElement('tr-ui-b-table');
- var columns = [];
- tr.b.iterItems(object[0], function(colName) {
- var allStrings = true;
- var allNumbers = true;
- for (var i = 0; i < object.length; ++i) {
- if (typeof(object[i][colName]) !== 'string')
- allStrings = false;
-
- if (typeof(object[i][colName]) !== 'number')
- allNumbers = false;
-
- if (!allStrings && !allNumbers)
- break;
- }
-
- var column = {title: colName};
- column.value = function(row) {
- return row[colName];
- };
-
- if (allStrings) {
- column.cmp = function(x, y) {
- return x[colName].localeCompare(y[colName]);
- };
- } else if (allNumbers) {
- column.cmp = function(x, y) {
- return x[colName] - y[colName];
- };
- }
- columns.push(column);
- });
- table.tableColumns = columns;
- table.tableRows = object;
- this.appendElementWithLabel_(label, indent, table, suffix);
- table.rebuild();
- return;
- }
-
- this.appendElementsForType_(
- label + '[',
- object[0],
- indent, depth + 1, maxDepth,
- object.length > 1 ? ',' : ']' + suffix);
- for (var i = 1; i < object.length; i++) {
- this.appendElementsForType_(
- '',
- object[i],
- indent + label.length + 1, depth + 1, maxDepth,
- i < object.length - 1 ? ',' : ']' + suffix);
- }
- return;
- },
-
- appendElementsForObject_: function(
- label, object, indent, depth, maxDepth, suffix) {
- var keys = tr.b.dictionaryKeys(object);
- if (keys.length == 0) {
- this.appendSimpleText_(label, indent, '{}', suffix);
- return;
- }
-
- this.appendElementsForType_(
- label + '{' + keys[0] + ': ',
- object[keys[0]],
- indent, depth, maxDepth,
- keys.length > 1 ? ',' : '}' + suffix);
- for (var i = 1; i < keys.length; i++) {
- this.appendElementsForType_(
- keys[i] + ': ',
- object[keys[i]],
- indent + label.length + 1, depth + 1, maxDepth,
- i < keys.length - 1 ? ',' : '}' + suffix);
- }
- },
-
- appendElementWithLabel_: function(label, indent, dataElement, suffix) {
- var row = document.createElement('div');
-
- var indentSpan = document.createElement('span');
- indentSpan.style.whiteSpace = 'pre';
- for (var i = 0; i < indent; i++)
- indentSpan.textContent += ' ';
- row.appendChild(indentSpan);
-
- var labelSpan = document.createElement('span');
- labelSpan.textContent = label;
- row.appendChild(labelSpan);
-
- row.appendChild(dataElement);
- var suffixSpan = document.createElement('span');
- suffixSpan.textContent = suffix;
- row.appendChild(suffixSpan);
-
- row.dataElement = dataElement;
- this.$.content.appendChild(row);
- },
-
- appendSimpleText_: function(label, indent, text, suffix) {
- var el = this.ownerDocument.createElement('span');
- el.textContent = text;
- this.appendElementWithLabel_(label, indent, el, suffix);
- return el;
- }
- });
- </script>
-</polymer-element>
-
-<polymer-element name="tr-ui-a-generic-object-view-with-label"
- is="HTMLUnknownElement">
- <template>
- <style>
- :host {
- display: block;
- }
- </style>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.labelEl_ = document.createElement('div');
- this.genericObjectView_ =
- document.createElement('tr-ui-a-generic-object-view');
- this.shadowRoot.appendChild(this.labelEl_);
- this.shadowRoot.appendChild(this.genericObjectView_);
- },
-
- get label() {
- return this.labelEl_.textContent;
- },
-
- set label(label) {
- this.labelEl_.textContent = label;
- },
-
- get object() {
- return this.genericObjectView_.object;
- },
-
- set object(object) {
- this.genericObjectView_.object = object;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/generic_object_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/generic_object_view_test.html
deleted file mode 100644
index 50997e18622..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/generic_object_view_test.html
+++ /dev/null
@@ -1,206 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/object_instance.html">
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-<link rel="import" href="/tracing/ui/base/deep_utils.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('undefinedValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = undefined;
- assert.equal(view.$.content.textContent, 'undefined');
- });
-
- test('nullValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = null;
- assert.equal(view.$.content.textContent, 'null');
- });
-
- test('stringValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = 'string value';
- assert.equal(view.$.content.textContent, '"string value"');
- });
-
- test('multiLineStringValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = 'i am a\n string value\ni have\n various indents';
- this.addHTMLOutput(view);
- var c = view.$.content;
- });
-
- test('multiLineStringValueInsideObject', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = {key: 'i am a\n string value\ni have\n various indents',
- value: 'simple'};
- this.addHTMLOutput(view);
- var c = view.$.content;
-
- });
-
- test('jsonObjectStringValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = '{"x": 1}';
- assert.equal(view.$.content.children.length, 1);
- assert.equal(view.$.content.children[0].children.length, 4);
- });
-
- test('jsonArrayStringValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = '[1,2,3]';
- assert.equal(view.$.content.children.length, 3);
- });
-
- test('booleanValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = false;
- assert.equal(view.$.content.textContent, 'false');
- });
-
- test('numberValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = 3.14159;
- assert.equal(view.$.content.textContent, '3.14159');
- });
-
- test('objectSnapshotValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
-
- var i10 = new tr.model.ObjectInstance(
- {}, '0x1000', 'cat', 'name', 10);
- var s10 = i10.addSnapshot(10, {foo: 1});
-
- view.object = s10;
- this.addHTMLOutput(view);
- assert.strictEqual(view.$.content.children[0].dataElement.tagName,
- 'TR-UI-A-ANALYSIS-LINK');
- });
-
- test('objectInstanceValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
-
- var i10 = new tr.model.ObjectInstance(
- {}, '0x1000', 'cat', 'name', 10);
- var s10 = i10.addSnapshot(10, {foo: 1});
-
- view.object = i10;
- assert.strictEqual(view.$.content.children[0].dataElement.tagName,
- 'TR-UI-A-ANALYSIS-LINK');
- });
-
- test('instantiate_emptyArrayValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = [];
- this.addHTMLOutput(view);
- });
-
- test('instantiate_twoValueArrayValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = [1, 2];
- this.addHTMLOutput(view);
- });
-
- test('instantiate_twoValueBArrayValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = [1, {x: 1}];
- this.addHTMLOutput(view);
- });
-
- test('instantiate_arrayValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = [1, 2, 'three'];
- this.addHTMLOutput(view);
- });
-
- test('instantiate_arrayWithSimpleObjectValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = [{simple: 'object'}];
- this.addHTMLOutput(view);
- });
-
- test('instantiate_arrayWithComplexObjectValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = [{col0: 'object', col1: 0},
- {col2: 'Object', col3: 1}];
- this.addHTMLOutput(view);
- assert.equal(undefined, tr.b.findDeepElementMatching(
- view.$.content, 'table'));
- });
-
- test('instantiate_arrayWithDeepObjectValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = [{key: {deep: 'object values make isTable() return false'}}];
- this.addHTMLOutput(view);
- assert.equal(undefined, tr.b.findDeepElementMatching(
- view.$.content, 'table'));
- });
-
- test('jsonTableValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = [
- {col0: 'object', col1: 0, col2: 'foo'},
- {col0: 'Object', col1: 1, col2: 42}
- ];
- this.addHTMLOutput(view);
-
- var table = tr.b.findDeepElementMatching(view.$.content, 'tr-ui-b-table');
- assert.equal('col0', table.tableColumns[0].title);
- assert.equal('col1', table.tableColumns[1].title);
- assert.equal('object', table.tableColumns[0].value(table.tableRows[0]));
- assert.equal('Object', table.tableColumns[0].value(table.tableRows[1]));
- assert.equal(0, table.tableColumns[1].value(table.tableRows[0]));
- assert.equal(1, table.tableColumns[1].value(table.tableRows[1]));
- assert.isDefined(table.tableColumns[0].cmp);
- assert.isDefined(table.tableColumns[1].cmp);
- assert.isUndefined(table.tableColumns[2].cmp);
- });
-
- test('instantiate_objectValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = {
- 'entry_one': 'entry_one_value',
- 'entry_two': 2,
- 'entry_three': [3, 4, 5]
- };
- this.addHTMLOutput(view);
- });
-
- test('timeDurationValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object =
- new tr.v.ScalarNumeric(tr.v.Unit.byName.timeDurationInMs, 3);
- assert.isDefined(tr.b.findDeepElementMatching(
- view.$.content, 'tr-v-ui-scalar-span'));
- });
-
- test('timeStampValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object = new tr.v.ScalarNumeric(tr.v.Unit.byName.timeStampInMs, 3);
- assert.isDefined(tr.b.findDeepElementMatching(
- view.$.content, 'tr-v-ui-scalar-span'));
- });
-
- test('scalarValue', function() {
- var view = document.createElement('tr-ui-a-generic-object-view');
- view.object =
- new tr.v.ScalarNumeric(tr.v.Unit.byName.normalizedPercentage, .3);
- var m = tr.b.findDeepElementMatching(
- view.$.content, 'tr-v-ui-scalar-span');
- assert.isDefined(m);
- assert.equal(m.value, .3);
- assert.equal(m.unit, tr.v.Unit.byName.normalizedPercentage);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/layout_tree_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/layout_tree_sub_view.html
deleted file mode 100644
index 75a42c01d42..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/layout_tree_sub_view.html
+++ /dev/null
@@ -1,203 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-
-<polymer-element name="tr-ui-a-layout-tree-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <div id="content"></div>
- </template>
-</polymer-element>
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.analysis', function() {
- Polymer('tr-ui-a-layout-tree-sub-view', {
- set selection(selection) {
- this.currentSelection_ = selection;
- this.updateContents_();
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- updateContents_: function() {
- this.$.content.textContent = '';
- if (!this.currentSelection_)
- return;
-
- var columns = [
- {
- title: 'Tag/Name',
- value: function(layoutObject) {
- return layoutObject.tag || ':' + layoutObject.name;
- }
- },
-
- {
- title: 'htmlId',
- value: function(layoutObject) {
- return layoutObject.htmlId || '';
- }
- },
-
- {
- title: 'classNames',
- value: function(layoutObject) {
- return layoutObject.classNames || '';
- }
- },
-
- {
- title: 'reasons',
- value: function(layoutObject) {
- return layoutObject.needsLayoutReasons.join(', ');
- }
- },
-
- {
- title: 'width',
- value: function(layoutObject) {
- return layoutObject.absoluteRect.width;
- }
- },
-
- {
- title: 'height',
- value: function(layoutObject) {
- return layoutObject.absoluteRect.height;
- }
- },
-
- {
- title: 'absX',
- value: function(layoutObject) {
- return layoutObject.absoluteRect.left;
- }
- },
-
- {
- title: 'absY',
- value: function(layoutObject) {
- return layoutObject.absoluteRect.top;
- }
- },
-
- {
- title: 'relX',
- value: function(layoutObject) {
- return layoutObject.relativeRect.left;
- }
- },
-
- {
- title: 'relY',
- value: function(layoutObject) {
- return layoutObject.relativeRect.top;
- }
- },
-
- {
- title: 'float',
- value: function(layoutObject) {
- return layoutObject.isFloat ? 'float' : '';
- }
- },
-
- {
- title: 'positioned',
- value: function(layoutObject) {
- return layoutObject.isPositioned ? 'positioned' : '';
- }
- },
-
- {
- title: 'relative',
- value: function(layoutObject) {
- return layoutObject.isRelativePositioned ? 'relative' : '';
- }
- },
-
- {
- title: 'sticky',
- value: function(layoutObject) {
- return layoutObject.isStickyPositioned ? 'sticky' : '';
- }
- },
-
- {
- title: 'anonymous',
- value: function(layoutObject) {
- return layoutObject.isAnonymous ? 'anonymous' : '';
- }
- },
-
- {
- title: 'row',
- value: function(layoutObject) {
- if (layoutObject.tableRow === undefined)
- return '';
- return layoutObject.tableRow;
- }
- },
-
- {
- title: 'col',
- value: function(layoutObject) {
- if (layoutObject.tableCol === undefined)
- return '';
- return layoutObject.tableCol;
- }
- },
-
- {
- title: 'rowSpan',
- value: function(layoutObject) {
- if (layoutObject.tableRowSpan === undefined)
- return '';
- return layoutObject.tableRowSpan;
- }
- },
-
- {
- title: 'colSpan',
- value: function(layoutObject) {
- if (layoutObject.tableColSpan === undefined)
- return '';
- return layoutObject.tableColSpan;
- }
- },
-
- {
- title: 'address',
- value: function(layoutObject) {
- return layoutObject.id.toString(16);
- }
- }
- ];
-
- var table = this.ownerDocument.createElement('tr-ui-b-table');
- table.defaultExpansionStateCallback = function(
- layoutObject, parentLayoutObject) {
- return true;
- };
- table.subRowsPropertyName = 'childLayoutObjects';
- table.tableColumns = columns;
- table.tableRows = this.currentSelection_.map(function(snapshot) {
- return snapshot.rootLayoutObject;
- });
- table.rebuild();
- this.$.content.appendChild(table);
- }
- });
-
- return {};
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_allocator_details_pane.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_allocator_details_pane.html
deleted file mode 100644
index df1d38264aa..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_allocator_details_pane.html
+++ /dev/null
@@ -1,854 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/model/memory_allocator_dump.html">
-<link rel="import"
- href="/tracing/ui/analysis/memory_dump_heap_details_pane.html">
-<link rel="import" href="/tracing/ui/analysis/memory_dump_sub_view_util.html">
-<link rel="import" href="/tracing/ui/analysis/stacked_pane.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-a-memory-dump-allocator-details-pane"
- extends="tr-ui-a-stacked-pane">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
-
- #label {
- flex: 0 0 auto;
- padding: 8px;
-
- background-color: #eee;
- border-bottom: 1px solid #8e8e8e;
- border-top: 1px solid white;
-
- font-size: 15px;
- font-weight: bold;
- }
-
- #contents {
- flex: 1 0 auto;
- align-self: stretch;
- font-size: 12px;
- }
-
- #info_text {
- padding: 8px;
- color: #666;
- font-style: italic;
- text-align: center;
- }
-
- #table {
- display: none; /* Hide until memory allocator dumps are set. */
- flex: 1 0 auto;
- align-self: stretch;
- }
- </style>
- <div id="label">Component details</div>
- <div id="contents">
- <div id="info_text">No memory allocator dump selected</div>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </div>
- </template>
-</polymer-element>
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.analysis', function() {
-
- // Constant representing the context in suballocation rows.
- var SUBALLOCATION_CONTEXT = true;
-
- // Size numeric info types.
- var MemoryAllocatorDumpInfoType = tr.model.MemoryAllocatorDumpInfoType;
- var PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN =
- MemoryAllocatorDumpInfoType.PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN;
- var PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER =
- MemoryAllocatorDumpInfoType.PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER;
-
- // Unicode symbols used for memory cell info icons and messages.
- var LEFTWARDS_OPEN_HEADED_ARROW = String.fromCharCode(0x21FD);
- var RIGHTWARDS_OPEN_HEADED_ARROW = String.fromCharCode(0x21FE);
- var EN_DASH = String.fromCharCode(0x2013);
- var CIRCLED_LATIN_SMALL_LETTER_I = String.fromCharCode(0x24D8);
-
- /** @constructor */
- function AllocatorDumpNameColumn() {
- tr.ui.analysis.TitleColumn.call(this, 'Component');
- }
-
- AllocatorDumpNameColumn.prototype = {
- __proto__: tr.ui.analysis.TitleColumn.prototype,
-
- formatTitle: function(row) {
- if (!row.suballocation)
- return row.title;
- return tr.ui.b.createSpan({
- textContent: row.title,
- italic: true,
- tooltip: row.fullNames === undefined ?
- undefined : row.fullNames.join(', ')
- });
- }
- };
-
- /**
- * Retrieve the entry associated with a given name from a map and increment
- * its count.
- *
- * If there is no entry associated with the name, a new entry is created, the
- * creation callback is called, the entry's count is incremented (from 0 to
- * 1) and the newly created entry is returned.
- */
- function getAndUpdateEntry(map, name, createdCallback) {
- var entry = map.get(name);
- if (entry === undefined) {
- entry = {count: 0};
- createdCallback(entry);
- map.set(name, entry);
- }
- entry.count++;
- return entry;
- }
-
- /**
- * Helper class for building size and effective size column info messages.
- *
- * @constructor
- */
- function SizeInfoMessageBuilder() {
- this.parts_ = [];
- this.indent_ = 0;
- }
-
- SizeInfoMessageBuilder.prototype = {
- append: function(/* arguments */) {
- this.parts_.push.apply(
- this.parts_, Array.prototype.slice.apply(arguments));
- },
-
- /**
- * Append the entries of a map to the message according to the following
- * rules:
- *
- * 1. If the map is empty, append emptyText to the message (if provided).
- * Examples:
- *
- * emptyText=undefined
- * Hello, World! ====================> Hello, World!
- *
- * emptyText='empty'
- * The bottle is ====================> The bottle is empty
- *
- * 2. If the map contains a single entry, append a space and call
- * itemCallback on the entry (which is in turn expected to append a
- * message for the entry). Example:
- *
- * Please do not ====================> Please do not [item-message]
- *
- * 3. If the map contains multiple entries, append them as a list
- * with itemCallback called on each entry. If hasPluralSuffix is true,
- * 's' will be appended to the message before the list. Examples:
- *
- * hasPluralSuffix=false
- * I need to buy ====================> I need to buy:
- * - [item1-message]
- * - [item2-message]
- * [...]
- * - [itemN-message]
- *
- * hasPluralSuffix=true
- * Suspected CL ====================> Suspected CLs:
- * - [item1-message]
- * - [item2-message]
- * [...]
- * - [itemN-message]
- */
- appendMap: function(
- map, hasPluralSuffix, emptyText, itemCallback, opt_this) {
- opt_this = opt_this || this;
- if (map.size === 0) {
- if (emptyText)
- this.append(emptyText);
- } else if (map.size === 1) {
- this.parts_.push(' ');
- var key = map.keys().next().value;
- itemCallback.call(opt_this, key, map.get(key));
- } else {
- if (hasPluralSuffix)
- this.parts_.push('s');
- this.parts_.push(':');
- this.indent_++;
- for (var key of map.keys()) {
- this.parts_.push('\n', ' '.repeat(3 * (this.indent_ - 1)), ' - ');
- itemCallback.call(opt_this, key, map.get(key));
- }
- this.indent_--;
- }
- },
-
- appendImportanceRange: function(range) {
- this.append(' (importance: ');
- if (range.min === range.max)
- this.append(range.min);
- else
- this.append(range.min, EN_DASH, range.max);
- this.append(')');
- },
-
- appendSizeIfDefined: function(size) {
- if (size !== undefined)
- this.append(' (', tr.v.Unit.byName.sizeInBytes.format(size), ')');
- },
-
- appendSomeTimestampsQuantifier: function() {
- this.append(
- ' ', tr.ui.analysis.MemoryColumn.SOME_TIMESTAMPS_INFO_QUANTIFIER);
- },
-
- build: function() {
- return this.parts_.join('');
- }
- };
-
- /** @constructor */
- function EffectiveSizeColumn(name, cellPath, aggregationMode) {
- tr.ui.analysis.DetailsNumericMemoryColumn.call(
- this, name, cellPath, aggregationMode);
- }
-
- EffectiveSizeColumn.prototype = {
- __proto__: tr.ui.analysis.DetailsNumericMemoryColumn.prototype,
-
- addInfos: function(numerics, memoryAllocatorDumps, infos) {
- if (memoryAllocatorDumps === undefined)
- return;
-
- // Quantified name of an owner dump (of the given dump) -> {count,
- // importanceRange}.
- var ownerNameToEntry = new Map();
-
- // Quantified name of an owned dump (by the given dump) -> {count,
- // importanceRange, sharerNameToEntry}, where sharerNameToEntry is a map
- // from quantified names of other owners of the owned dump to {count,
- // importanceRange}.
- var ownedNameToEntry = new Map();
-
- for (var i = 0; i < numerics.length; i++) {
- if (numerics[i] === undefined)
- continue;
- var dump = memoryAllocatorDumps[i];
- if (dump === SUBALLOCATION_CONTEXT)
- return; // No ownership of suballocation internal rows.
-
- // Gather owners of this dump.
- dump.ownedBy.forEach(function(ownerLink) {
- var ownerDump = ownerLink.source;
- this.getAndUpdateOwnershipEntry_(
- ownerNameToEntry, ownerDump, ownerLink);
- }, this);
-
- // Gather dumps owned by this dump and other owner dumps sharing them
- // (with this dump).
- var ownedLink = dump.owns;
- if (ownedLink !== undefined) {
- var ownedDump = ownedLink.target;
- var ownedEntry = this.getAndUpdateOwnershipEntry_(ownedNameToEntry,
- ownedDump, ownedLink, true /* opt_withSharerNameToEntry */);
- var sharerNameToEntry = ownedEntry.sharerNameToEntry;
- ownedDump.ownedBy.forEach(function(sharerLink) {
- var sharerDump = sharerLink.source;
- if (sharerDump === dump)
- return;
- this.getAndUpdateOwnershipEntry_(
- sharerNameToEntry, sharerDump, sharerLink);
- }, this);
- }
- }
-
- // Emit a single info listing all owners of this dump.
- if (ownerNameToEntry.size > 0) {
- var messageBuilder = new SizeInfoMessageBuilder();
- messageBuilder.append('shared by');
- messageBuilder.appendMap(
- ownerNameToEntry,
- false /* hasPluralSuffix */,
- undefined /* emptyText */,
- function(ownerName, ownerEntry) {
- messageBuilder.append(ownerName);
- if (ownerEntry.count < numerics.length)
- messageBuilder.appendSomeTimestampsQuantifier();
- messageBuilder.appendImportanceRange(ownerEntry.importanceRange);
- }, this);
- infos.push({
- message: messageBuilder.build(),
- icon: LEFTWARDS_OPEN_HEADED_ARROW,
- color: 'green'
- });
- }
-
- // Emit a single info listing all dumps owned by this dump together
- // with list(s) of other owner dumps sharing them with this dump.
- if (ownedNameToEntry.size > 0) {
- var messageBuilder = new SizeInfoMessageBuilder();
- messageBuilder.append('shares');
- messageBuilder.appendMap(
- ownedNameToEntry,
- false /* hasPluralSuffix */,
- undefined /* emptyText */,
- function(ownedName, ownedEntry) {
- messageBuilder.append(ownedName);
- var ownedCount = ownedEntry.count;
- if (ownedCount < numerics.length)
- messageBuilder.appendSomeTimestampsQuantifier();
- messageBuilder.appendImportanceRange(ownedEntry.importanceRange);
- messageBuilder.append(' with');
- messageBuilder.appendMap(
- ownedEntry.sharerNameToEntry,
- false /* hasPluralSuffix */,
- ' no other dumps',
- function(sharerName, sharerEntry) {
- messageBuilder.append(sharerName);
- if (sharerEntry.count < ownedCount)
- messageBuilder.appendSomeTimestampsQuantifier();
- messageBuilder.appendImportanceRange(
- sharerEntry.importanceRange);
- }, this);
- }, this);
- infos.push({
- message: messageBuilder.build(),
- icon: RIGHTWARDS_OPEN_HEADED_ARROW,
- color: 'green'
- });
- }
- },
-
- getAndUpdateOwnershipEntry_: function(
- map, dump, link, opt_withSharerNameToEntry) {
- var entry = getAndUpdateEntry(map, dump.quantifiedName,
- function(newEntry) {
- newEntry.importanceRange = new tr.b.Range();
- if (opt_withSharerNameToEntry)
- newEntry.sharerNameToEntry = new Map();
- });
- entry.importanceRange.addValue(link.importance || 0);
- return entry;
- }
- };
-
- /** @constructor */
- function SizeColumn(name, cellPath, aggregationMode) {
- tr.ui.analysis.DetailsNumericMemoryColumn.call(
- this, name, cellPath, aggregationMode);
- }
-
- SizeColumn.prototype = {
- __proto__: tr.ui.analysis.DetailsNumericMemoryColumn.prototype,
-
- addInfos: function(numerics, memoryAllocatorDumps, infos) {
- if (memoryAllocatorDumps === undefined)
- return;
- this.addOverlapInfo_(numerics, memoryAllocatorDumps, infos);
- this.addProvidedSizeWarningInfos_(numerics, memoryAllocatorDumps, infos);
- },
-
- addOverlapInfo_: function(numerics, memoryAllocatorDumps, infos) {
- // Sibling allocator dump name -> {count, size}. The latter field (size)
- // is omitted in multi-selection mode.
- var siblingNameToEntry = new Map();
- for (var i = 0; i < numerics.length; i++) {
- if (numerics[i] === undefined)
- continue;
- var dump = memoryAllocatorDumps[i];
- if (dump === SUBALLOCATION_CONTEXT)
- return; // No ownership of suballocation internal rows.
- var ownedBySiblingSizes = dump.ownedBySiblingSizes;
- for (var siblingDump of ownedBySiblingSizes.keys()) {
- var siblingName = siblingDump.name;
- getAndUpdateEntry(siblingNameToEntry, siblingName,
- function(newEntry) {
- if (numerics.length === 1 /* single-selection mode */)
- newEntry.size = ownedBySiblingSizes.get(siblingDump);
- });
- }
- }
-
- // Emit a single info describing all overlaps with siblings (if
- // applicable).
- if (siblingNameToEntry.size > 0) {
- var messageBuilder = new SizeInfoMessageBuilder();
- messageBuilder.append('overlaps with its sibling');
- messageBuilder.appendMap(
- siblingNameToEntry,
- true /* hasPluralSuffix */,
- undefined /* emptyText */,
- function(siblingName, siblingEntry) {
- messageBuilder.append('\'', siblingName, '\'');
- messageBuilder.appendSizeIfDefined(siblingEntry.size);
- if (siblingEntry.count < numerics.length)
- messageBuilder.appendSomeTimestampsQuantifier();
- }, this);
- infos.push({
- message: messageBuilder.build(),
- icon: CIRCLED_LATIN_SMALL_LETTER_I,
- color: 'blue'
- });
- }
- },
-
- addProvidedSizeWarningInfos_: function(numerics, memoryAllocatorDumps,
- infos) {
- // Info type (see MemoryAllocatorDumpInfoType) -> {count, providedSize,
- // dependencySize}. The latter two fields (providedSize and
- // dependencySize) are omitted in multi-selection mode.
- var infoTypeToEntry = new Map();
- for (var i = 0; i < numerics.length; i++) {
- if (numerics[i] === undefined)
- continue;
- var dump = memoryAllocatorDumps[i];
- if (dump === SUBALLOCATION_CONTEXT)
- return; // Suballocation internal rows have no provided size.
- dump.infos.forEach(function(dumpInfo) {
- getAndUpdateEntry(infoTypeToEntry, dumpInfo.type, function(newEntry) {
- if (numerics.length === 1 /* single-selection mode */) {
- newEntry.providedSize = dumpInfo.providedSize;
- newEntry.dependencySize = dumpInfo.dependencySize;
- }
- });
- });
- }
-
- // Emit a warning info for every info type.
- for (var infoType of infoTypeToEntry.keys()) {
- var entry = infoTypeToEntry.get(infoType);
- var messageBuilder = new SizeInfoMessageBuilder();
- messageBuilder.append('provided size');
- messageBuilder.appendSizeIfDefined(entry.providedSize);
- var dependencyName;
- switch (infoType) {
- case PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN:
- dependencyName = 'the aggregated size of the children';
- break;
- case PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER:
- dependencyName = 'the size of the largest owner';
- break;
- default:
- dependencyName = 'an unknown dependency';
- break;
- }
- messageBuilder.append(' was less than ', dependencyName);
- messageBuilder.appendSizeIfDefined(entry.dependencySize);
- if (entry.count < numerics.length)
- messageBuilder.appendSomeTimestampsQuantifier();
- infos.push(tr.ui.analysis.createWarningInfo(messageBuilder.build()));
- }
- }
- };
-
- var NUMERIC_COLUMN_RULES = [
- {
- condition: tr.model.MemoryAllocatorDump.EFFECTIVE_SIZE_NUMERIC_NAME,
- importance: 10,
- columnConstructor: EffectiveSizeColumn
- },
- {
- condition: tr.model.MemoryAllocatorDump.SIZE_NUMERIC_NAME,
- importance: 9,
- columnConstructor: SizeColumn
- },
- {
- condition: 'page_size',
- importance: 0,
- columnConstructor: tr.ui.analysis.DetailsNumericMemoryColumn
- },
- {
- condition: /size/,
- importance: 5,
- columnConstructor: tr.ui.analysis.DetailsNumericMemoryColumn
- },
- {
- // All other columns.
- importance: 0,
- columnConstructor: tr.ui.analysis.DetailsNumericMemoryColumn
- }
- ];
-
- var DIAGNOSTIC_COLUMN_RULES = [
- {
- importance: 0,
- columnConstructor: tr.ui.analysis.StringMemoryColumn
- }
- ];
-
- Polymer('tr-ui-a-memory-dump-allocator-details-pane', {
- created: function() {
- this.memoryAllocatorDumps_ = undefined;
- this.heapDumps_ = undefined;
- this.aggregationMode_ = undefined;
- },
-
- ready: function() {
- this.$.table.selectionMode = tr.ui.b.TableFormat.SelectionMode.ROW;
- },
-
- /**
- * Sets the memory allocator dumps and schedules rebuilding the pane.
- *
- * The provided value should be a chronological list of memory allocator
- * dumps. All dumps are assumed to belong to the same process and have
- * the same full name. Example:
- *
- * [
- * tr.model.MemoryAllocatorDump {}, // MAD at timestamp 1.
- * undefined, // MAD not provided at timestamp 2.
- * tr.model.MemoryAllocatorDump {}, // MAD at timestamp 3.
- * ]
- */
- set memoryAllocatorDumps(memoryAllocatorDumps) {
- this.memoryAllocatorDumps_ = memoryAllocatorDumps;
- this.scheduleRebuildPane_();
- },
-
- get memoryAllocatorDumps() {
- return this.memoryAllocatorDumps_;
- },
-
- // TODO(petrcermak): Don't plumb the heap dumps through the allocator
- // details pane. Maybe add support for multiple child panes to stacked pane
- // (view) instead.
- set heapDumps(heapDumps) {
- this.heapDumps_ = heapDumps;
- this.scheduleRebuildPane_();
- },
-
- set aggregationMode(aggregationMode) {
- this.aggregationMode_ = aggregationMode;
- this.scheduleRebuildPane_();
- },
-
- get aggregationMode() {
- return this.aggregationMode_;
- },
-
- rebuildPane_: function() {
- if (this.memoryAllocatorDumps_ === undefined ||
- this.memoryAllocatorDumps_.length === 0) {
- // Show the info text (hide the table).
- this.$.info_text.style.display = 'block';
- this.$.table.style.display = 'none';
-
- this.$.table.clear();
- this.$.table.rebuild();
-
- // Hide the heap details pane (if applicable).
- this.childPaneBuilder = undefined;
- return;
- }
-
- // Show the table (hide the info text).
- this.$.info_text.style.display = 'none';
- this.$.table.style.display = 'block';
-
- var rows = this.createRows_();
- var columns = this.createColumns_(rows);
- rows.forEach(function(rootRow) {
- tr.ui.analysis.aggregateTableRowCellsRecursively(rootRow, columns,
- function(contexts) {
- // Only aggregate suballocation rows (numerics of regular rows
- // corresponding to MADs have already been aggregated by the
- // model in MemoryAllocatorDump.aggregateNumericsRecursively).
- return contexts !== undefined && contexts.some(function(context) {
- return context === SUBALLOCATION_CONTEXT;
- });
- });
- });
-
- this.$.table.tableRows = rows;
- this.$.table.tableColumns = columns;
- this.$.table.rebuild();
- tr.ui.analysis.expandTableRowsRecursively(this.$.table);
-
- // Show/hide the heap details pane.
- if (this.heapDumps_ === undefined) {
- this.childPaneBuilder = undefined;
- } else {
- this.childPaneBuilder = function() {
- var pane =
- document.createElement('tr-ui-a-memory-dump-heap-details-pane');
- pane.heapDumps = this.heapDumps_;
- pane.aggregationMode = this.aggregationMode_;
- return pane;
- }.bind(this);
- }
- },
-
- createRows_: function() {
- return [
- this.createAllocatorRowRecursively_(this.memoryAllocatorDumps_)
- ];
- },
-
- createAllocatorRowRecursively_: function(dumps) {
- // Get the name of the memory allocator dumps. We can use any defined
- // dump in dumps since they all have the same name.
- var definedDump = tr.b.findFirstInArray(dumps);
- var title = definedDump.name;
- var fullName = definedDump.fullName;
-
- // Transform a chronological list of memory allocator dumps into two
- // dictionaries of cells (where each cell contains a chronological list
- // of the values of one of its numerics or diagnostics).
- var numericCells = tr.ui.analysis.createCells(dumps, function(dump) {
- return dump.numerics;
- });
- var diagnosticCells = tr.ui.analysis.createCells(dumps, function(dump) {
- return dump.diagnostics;
- });
-
- // Determine whether the memory allocator dump is a suballocation. A
- // dump is assumed to be a suballocation if (1) its name starts with
- // two underscores, (2) it has an owner from within the same process at
- // some timestamp, and (3) it is undefined, has no owners, or has the
- // same owner (and no other owners) at all other timestamps.
- var suballocatedBy = undefined;
- if (title.startsWith('__')) {
- for (var i = 0; i < dumps.length; i++) {
- var dump = dumps[i];
- if (dump === undefined || dump.ownedBy.length === 0) {
- // Ignore timestamps where the dump is undefined or doesn't
- // have any owner.
- continue;
- }
- var ownerDump = dump.ownedBy[0].source;
- if (dump.ownedBy.length > 1 ||
- dump.children.length > 0 ||
- ownerDump.containerMemoryDump !== dump.containerMemoryDump) {
- // If the dump has (1) any children, (2) multiple owners, or
- // (3) its owner is in a different process (otherwise, the
- // modified title would be ambiguous), then it's not considered
- // to be a suballocation.
- suballocatedBy = undefined;
- break;
- }
- if (suballocatedBy === undefined) {
- suballocatedBy = ownerDump.fullName;
- } else if (suballocatedBy !== ownerDump.fullName) {
- // The full name of the owner dump changed over time, so this
- // dump is not a suballocation.
- suballocatedBy = undefined;
- break;
- }
- }
- }
-
- var row = {
- title: title,
- fullNames: [fullName],
- contexts: dumps,
- numericCells: numericCells,
- diagnosticCells: diagnosticCells,
- suballocatedBy: suballocatedBy
- };
-
- // Child memory dump name (dict key) -> Timestamp (list index) ->
- // Child dump.
- var childDumpNameToDumps = tr.b.invertArrayOfDicts(dumps,
- function(dump) {
- return tr.b.arrayToDict(dump.children, function(child) {
- return child.name;
- });
- });
-
- // Recursively create sub-rows for children (if applicable).
- var subRows = [];
- var suballocationClassificationRootNode = undefined;
- tr.b.iterItems(childDumpNameToDumps, function(childName, childDumps) {
- var childRow = this.createAllocatorRowRecursively_(childDumps);
- if (childRow.suballocatedBy === undefined) {
- // Not a suballocation row: just append it.
- subRows.push(childRow);
- } else {
- // Suballocation row: classify it in a tree of suballocations.
- suballocationClassificationRootNode =
- this.classifySuballocationRow_(
- childRow, suballocationClassificationRootNode);
- }
- }, this);
-
- // Build the tree of suballocations (if applicable).
- if (suballocationClassificationRootNode !== undefined) {
- var suballocationRow = this.createSuballocationRowRecursively_(
- 'suballocations', suballocationClassificationRootNode);
- subRows.push(suballocationRow);
- }
-
- if (subRows.length > 0)
- row.subRows = subRows;
-
- return row;
- },
-
- classifySuballocationRow_: function(suballocationRow, rootNode) {
- if (rootNode === undefined) {
- rootNode = {
- children: {},
- row: undefined
- };
- }
-
- var suballocationLevels = suballocationRow.suballocatedBy.split('/');
- var currentNode = rootNode;
- for (var i = 0; i < suballocationLevels.length; i++) {
- var suballocationLevel = suballocationLevels[i];
- var nextNode = currentNode.children[suballocationLevel];
- if (nextNode === undefined) {
- currentNode.children[suballocationLevel] = nextNode = {
- children: {},
- row: undefined
- };
- }
- var currentNode = nextNode;
- }
-
- var existingRow = currentNode.row;
- if (existingRow !== undefined) {
- // On rare occasions it can happen that one dump (e.g. sqlite) owns
- // different suballocations at different timestamps (e.g.
- // malloc/allocated_objects/_7d35 and malloc/allocated_objects/_511e).
- // When this happens, we merge the two suballocations into a single row
- // (malloc/allocated_objects/suballocations/sqlite).
- for (var i = 0; i < suballocationRow.contexts.length; i++) {
- var newContext = suballocationRow.contexts[i];
- if (newContext === undefined)
- continue;
-
- if (existingRow.contexts[i] !== undefined)
- throw new Error('Multiple suballocations with the same owner name');
-
- existingRow.contexts[i] = newContext;
- ['numericCells', 'diagnosticCells'].forEach(function(cellKey) {
- var suballocationCells = suballocationRow[cellKey];
- if (suballocationCells === undefined)
- return;
- tr.b.iterItems(suballocationCells, function(cellName, cell) {
- if (cell === undefined)
- return;
- var fields = cell.fields;
- if (fields === undefined)
- return;
- var field = fields[i];
- if (field === undefined)
- return;
- var existingCells = existingRow[cellKey];
- if (existingCells === undefined) {
- existingCells = {};
- existingRow[cellKey] = existingCells;
- }
- var existingCell = existingCells[cellName];
- if (existingCell === undefined) {
- existingCell = new tr.ui.analysis.MemoryCell(
- new Array(fields.length));
- existingCells[cellName] = existingCell;
- }
- existingCell.fields[i] = field;
- });
- });
- }
- existingRow.fullNames.push.apply(
- existingRow.fullNames, suballocationRow.fullNames);
- } else {
- currentNode.row = suballocationRow;
- }
-
- return rootNode;
- },
-
- createSuballocationRowRecursively_: function(name, node) {
- var childCount = Object.keys(node.children).length;
- if (childCount === 0) {
- if (node.row === undefined)
- throw new Error('Suballocation node must have a row or children');
- // Leaf row of the suballocation tree: Change the row's title from
- // '__MEANINGLESSHASH' to the name of the suballocation owner.
- var row = node.row;
- row.title = name;
- row.suballocation = true;
- return row;
- }
-
- // Internal row of the suballocation tree: Recursively create its
- // sub-rows.
- var subRows = tr.b.dictionaryValues(tr.b.mapItems(
- node.children, this.createSuballocationRowRecursively_, this));
-
- if (node.row !== undefined) {
- // Very unlikely case: Both an ancestor (e.g. 'skia') and one of its
- // descendants (e.g. 'skia/sk_glyph_cache') both suballocate from the
- // same MemoryAllocatorDump (e.g. 'malloc/allocated_objects'). In
- // this case, the suballocation from the ancestor must be mapped to
- // 'malloc/allocated_objects/suballocations/skia/<unspecified>' so
- // that 'malloc/allocated_objects/suballocations/skia' could
- // aggregate the numerics of the two suballocations properly.
- var row = node.row;
- row.title = '<unspecified>';
- row.suballocation = true;
- subRows.unshift(row);
- }
-
- // An internal row of the suballocation tree is assumed to be defined
- // at a given timestamp if at least one of its sub-rows is defined at
- // the timestamp.
- var contexts = new Array(subRows[0].contexts.length);
- for (var i = 0; i < subRows.length; i++) {
- subRows[i].contexts.forEach(function(subContext, index) {
- if (subContext !== undefined)
- contexts[index] = SUBALLOCATION_CONTEXT;
- });
- }
-
- return {
- title: name,
- suballocation: true,
- contexts: contexts,
- subRows: subRows
- };
- },
-
- createColumns_: function(rows) {
- var titleColumn = new AllocatorDumpNameColumn();
- titleColumn.width = '200px';
-
- var numericColumns = tr.ui.analysis.MemoryColumn.fromRows(
- rows, 'numericCells', this.aggregationMode_, NUMERIC_COLUMN_RULES);
- var diagnosticColumns = tr.ui.analysis.MemoryColumn.fromRows(
- rows, 'diagnosticCells', this.aggregationMode_,
- DIAGNOSTIC_COLUMN_RULES);
- var fieldColumns = numericColumns.concat(diagnosticColumns);
- tr.ui.analysis.MemoryColumn.spaceEqually(fieldColumns);
-
- var columns = [titleColumn].concat(fieldColumns);
- return columns;
- }
- });
-
- return {
- // All exports are for testing only.
- SUBALLOCATION_CONTEXT: SUBALLOCATION_CONTEXT,
- AllocatorDumpNameColumn: AllocatorDumpNameColumn,
- EffectiveSizeColumn: EffectiveSizeColumn,
- SizeColumn: SizeColumn
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_allocator_details_pane_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_allocator_details_pane_test.html
deleted file mode 100644
index cc0f99ffc81..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_allocator_details_pane_test.html
+++ /dev/null
@@ -1,1214 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/heap_dump.html">
-<link rel="import" href="/tracing/model/memory_allocator_dump.html">
-<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
-<link rel="import"
- href="/tracing/ui/analysis/memory_dump_allocator_details_pane.html">
-<link rel="import"
- href="/tracing/ui/analysis/memory_dump_sub_view_test_utils.html">
-<link rel="import" href="/tracing/ui/analysis/memory_dump_sub_view_util.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var MemoryAllocatorDump = tr.model.MemoryAllocatorDump;
- var ScalarNumeric = tr.v.ScalarNumeric;
- var unitlessNumber_smallerIsBetter =
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter;
- var sizeInBytes_smallerIsBetter =
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
- var HeapDump = tr.model.HeapDump;
- var AggregationMode = tr.ui.analysis.MemoryColumn.AggregationMode;
- var checkNumericFields = tr.ui.analysis.checkNumericFields;
- var checkSizeNumericFields = tr.ui.analysis.checkSizeNumericFields;
- var checkStringFields = tr.ui.analysis.checkStringFields;
- var checkColumnInfosAndColor = tr.ui.analysis.checkColumnInfosAndColor;
- var checkColumns = tr.ui.analysis.checkColumns;
- var isElementDisplayed = tr.ui.analysis.isElementDisplayed;
- var AllocatorDumpNameColumn = tr.ui.analysis.AllocatorDumpNameColumn;
- var EffectiveSizeColumn = tr.ui.analysis.EffectiveSizeColumn;
- var SizeColumn = tr.ui.analysis.SizeColumn;
- var StringMemoryColumn = tr.ui.analysis.StringMemoryColumn;
- var NumericMemoryColumn = tr.ui.analysis.NumericMemoryColumn;
- var addGlobalMemoryDump = tr.model.MemoryDumpTestUtils.addGlobalMemoryDump;
- var addProcessMemoryDump = tr.model.MemoryDumpTestUtils.addProcessMemoryDump;
- var newAllocatorDump = tr.model.MemoryDumpTestUtils.newAllocatorDump;
- var addChildDump = tr.model.MemoryDumpTestUtils.addChildDump;
- var addOwnershipLink = tr.model.MemoryDumpTestUtils.addOwnershipLink;
-
- var SUBALLOCATION_CONTEXT = tr.ui.analysis.SUBALLOCATION_CONTEXT;
- var MemoryAllocatorDumpInfoType = tr.model.MemoryAllocatorDumpInfoType;
- var PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN =
- MemoryAllocatorDumpInfoType.PROVIDED_SIZE_LESS_THAN_AGGREGATED_CHILDREN;
- var PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER =
- MemoryAllocatorDumpInfoType.PROVIDED_SIZE_LESS_THAN_LARGEST_OWNER;
-
- function addRootDumps(containerMemoryDump, rootNames, addedCallback) {
- // Test sanity check.
- assert.isUndefined(containerMemoryDump.memoryAllocatorDumps);
-
- var rootDumps = rootNames.map(function(rootName) {
- return new MemoryAllocatorDump(containerMemoryDump, rootName);
- });
- addedCallback.apply(null, rootDumps);
- containerMemoryDump.memoryAllocatorDumps = rootDumps;
- }
-
- function newSuballocationDump(ownerDump, parentDump, name, size) {
- var suballocationDump = addChildDump(parentDump, name, { size: size });
- if (ownerDump !== undefined)
- addOwnershipLink(ownerDump, suballocationDump);
- return suballocationDump;
- }
-
- function createProcessMemoryDumps() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var process = model.getOrCreateProcess(1);
-
- // First timestamp.
- var gmd1 = addGlobalMemoryDump(model, -10);
- var pmd1 = addProcessMemoryDump(gmd1, process, -11);
- pmd1.memoryAllocatorDumps = (function() {
- var v8Dump = newAllocatorDump(pmd1, 'v8', {
- size: 1073741824 /* 1 GiB */,
- inner_size: 2097152 /* 2 MiB */,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 204)
- });
-
- var v8HeapsDump = addChildDump(v8Dump, 'heaps',
- { size: 805306368 /* 768 MiB */ });
- addChildDump(v8HeapsDump, 'heap42',
- { size: 804782080 /* 767.5 MiB */ });
-
- var v8ObjectsDump = addChildDump(v8Dump, 'objects');
- v8ObjectsDump.addDiagnostic('url', 'http://example.com');
- addChildDump(v8ObjectsDump, 'foo', { size: 1022976 /* 999 KiB */ });
- addChildDump(v8ObjectsDump, 'bar', { size: 1024000 /* 1000 KiB */ });
-
- var oilpanDump = newAllocatorDump(pmd1, 'oilpan',
- { size: 125829120 /* 120 MiB */ });
- newSuballocationDump(
- oilpanDump, v8Dump, '__99BEAD', 150994944 /* 144 MiB */);
-
- var oilpanSubDump = addChildDump(oilpanDump, 'animals');
-
- var oilpanSubDump1 = addChildDump(oilpanSubDump, 'cow',
- { size: 33554432 /* 32 MiB */ });
- newSuballocationDump(
- oilpanSubDump1, v8Dump, '__42BEEF', 67108864 /* 64 MiB */);
-
- var oilpanSubDump2 = addChildDump(oilpanSubDump, 'chicken',
- { size: 16777216 /* 16 MiB */ });
- newSuballocationDump(
- oilpanSubDump2, v8Dump, '__68DEAD', 33554432 /* 32 MiB */);
-
- var skiaDump = newAllocatorDump(pmd1, 'skia',
- { size: 8388608 /* 8 MiB */ });
- var suballocationDump = newSuballocationDump(
- skiaDump, v8Dump, '__15FADE', 16777216 /* 16 MiB */);
-
- var ccDump = newAllocatorDump(pmd1, 'cc',
- { size: 4194304 /* 4 MiB */ });
- newSuballocationDump(
- ccDump, v8Dump, '__12FEED', 5242880 /* 5 MiB */).addDiagnostic(
- 'url', 'localhost:1234');
-
- return [v8Dump, oilpanDump, skiaDump, ccDump];
- })();
-
- // Second timestamp.
- var gmd2 = addGlobalMemoryDump(model, 10);
- var pmd2 = addProcessMemoryDump(gmd2, process, 11);
- pmd2.memoryAllocatorDumps = (function() {
- var v8Dump = newAllocatorDump(pmd2, 'v8', {
- size: 1073741824 /* 1 GiB */,
- inner_size: 2097152 /* 2 MiB */,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 204)
- });
-
- var v8ObjectsDump = addChildDump(v8Dump, 'objects');
- v8ObjectsDump.addDiagnostic('url', 'http://sample.net');
- addChildDump(v8ObjectsDump, 'foo', { size: 1020928 /* 997 KiB */ });
- addChildDump(v8ObjectsDump, 'bar', { size: 1026048 /* 1002 KiB */ });
-
- newSuballocationDump(
- undefined, v8Dump, '__99BEAD', 268435456 /* 256 MiB */);
-
- var ccDump = newAllocatorDump(pmd2, 'cc',
- { size: 7340032 /* 7 MiB */ });
- newSuballocationDump(
- ccDump, v8Dump, '__13DEED', 11534336 /* 11 MiB */).addDiagnostic(
- 'url', 'localhost:5678');
-
- return [v8Dump, ccDump];
- })();
- });
-
- return model.processes[1].memoryDumps;
- }
-
- function createSizeFields(values) {
- return values.map(function(value) {
- if (value === undefined)
- return undefined;
- return new ScalarNumeric(sizeInBytes_smallerIsBetter, value);
- });
- }
-
- var EXPECTED_COLUMNS = [
- { title: 'Component', type: AllocatorDumpNameColumn, noAggregation: true },
- { title: 'effective_size', type: EffectiveSizeColumn },
- { title: 'size', type: SizeColumn },
- { title: 'inner_size', type: NumericMemoryColumn },
- { title: 'objects_count', type: NumericMemoryColumn },
- { title: 'url', type: StringMemoryColumn }
- ];
-
- function checkRow(columns, row, expectations) {
- var formattedTitle = columns[0].formatTitle(row);
- var expectedTitle = expectations.title;
- if (typeof expectedTitle === 'function')
- expectedTitle(formattedTitle);
- else
- assert.equal(formattedTitle, expectedTitle);
-
- checkSizeNumericFields(row, columns[1], expectations.size);
- checkSizeNumericFields(row, columns[2], expectations.effective_size);
- checkSizeNumericFields(row, columns[3], expectations.inner_size);
- checkNumericFields(row, columns[4], expectations.objects_count,
- unitlessNumber_smallerIsBetter);
- checkStringFields(row, columns[5], expectations.url);
-
- var expectedSubRowCount = expectations.sub_row_count;
- if (expectedSubRowCount === undefined)
- assert.isUndefined(row.subRows);
- else
- assert.lengthOf(row.subRows, expectedSubRowCount);
-
- var expectedContexts = expectations.contexts;
- if (expectedContexts === undefined)
- assert.isUndefined(row.contexts);
- else
- assert.deepEqual(tr.b.asArray(row.contexts), expectedContexts);
- }
-
- function buildProcessMemoryDumps(count, preFinalizeDumpsCallback) {
- var pmds = new Array(count);
- tr.c.TestUtils.newModel(function(model) {
- var process = model.getOrCreateProcess(1);
- for (var i = 0; i < count; i++) {
- var timestamp = 10 + i;
- var gmd = addGlobalMemoryDump(model, timestamp);
- pmds[i] = addProcessMemoryDump(gmd, process, timestamp);
- }
- preFinalizeDumpsCallback(pmds);
- });
- return pmds;
- }
-
- function getAllocatorDumps(pmds, fullName) {
- return pmds.map(function(pmd) {
- if (pmd === undefined)
- return undefined;
- return pmd.getMemoryAllocatorDumpByFullName(fullName);
- });
- }
-
- function checkAllocatorPaneColumnInfosAndColor(
- column, dumps, numericName, expectedInfos) {
- var numerics = dumps.map(function(dump) {
- if (dump === undefined)
- return undefined;
- return dump.numerics[numericName];
- });
- checkColumnInfosAndColor(
- column, numerics, dumps, expectedInfos, undefined /* no color */);
- }
-
- test('instantiate_empty', function() {
- tr.ui.analysis.createAndCheckEmptyPanes(this,
- 'tr-ui-a-memory-dump-allocator-details-pane', 'memoryAllocatorDumps',
- function(viewEl) {
- // Check that the info text is shown.
- assert.isTrue(isElementDisplayed(viewEl.$.info_text));
- assert.isFalse(isElementDisplayed(viewEl.$.table));
- });
- });
-
- test('instantiate_single', function() {
- var processMemoryDumps = createProcessMemoryDumps().slice(0, 1);
-
- var viewEl = tr.ui.analysis.createTestPane(
- 'tr-ui-a-memory-dump-allocator-details-pane');
- viewEl.memoryAllocatorDumps = getAllocatorDumps(processMemoryDumps, 'v8');
- viewEl.rebuild();
- assert.deepEqual(viewEl.requestedChildPanes, [undefined]);
- this.addHTMLOutput(viewEl);
-
- // Check that the table is shown.
- assert.isTrue(isElementDisplayed(viewEl.$.table));
- assert.isFalse(isElementDisplayed(viewEl.$.info_text));
-
- var table = viewEl.$.table;
- var columns = table.tableColumns;
- checkColumns(columns, EXPECTED_COLUMNS, undefined /* no aggregation */);
- var rows = table.tableRows;
- assert.lengthOf(rows, 1);
-
- // Check the rows of the table.
- var rootRow = rows[0];
- checkRow(columns, rootRow, {
- title: 'v8',
- size: [942619648],
- effective_size: [1081031680],
- inner_size: [2097152],
- objects_count: [204],
- sub_row_count: 3,
- contexts: getAllocatorDumps(processMemoryDumps, 'v8'),
- });
-
- var heapsSubRow = rootRow.subRows[0];
- checkRow(columns, heapsSubRow, {
- title: 'heaps',
- size: [805306368],
- effective_size: [805306368],
- sub_row_count: 2,
- contexts: getAllocatorDumps(processMemoryDumps, 'v8/heaps'),
- });
-
- var heapsUnspecifiedSubRow = heapsSubRow.subRows[0];
- checkRow(columns, heapsUnspecifiedSubRow, {
- title: '<unspecified>',
- size: [524288],
- effective_size: [524288],
- contexts: getAllocatorDumps(processMemoryDumps, 'v8/heaps/<unspecified>'),
- });
-
- var suballocationsSubRow = rootRow.subRows[2];
- checkRow(columns, suballocationsSubRow, {
- title: function(formattedTitle) {
- assert.equal(formattedTitle.textContent, 'suballocations');
- assert.equal(formattedTitle.title, '');
- },
- size: [135266304],
- effective_size: [273678336],
- sub_row_count: 3,
- contexts: [SUBALLOCATION_CONTEXT],
- });
-
- var oilpanSuballocationSubRow = suballocationsSubRow.subRows[0];
- checkRow(columns, oilpanSuballocationSubRow, {
- title: function(formattedTitle) {
- assert.equal(formattedTitle.textContent, 'oilpan');
- assert.equal(formattedTitle.title, '');
- },
- size: [125829120],
- effective_size: [251658240],
- sub_row_count: 2,
- contexts: [SUBALLOCATION_CONTEXT],
- });
-
- var oilpanUnspecifiedSuballocationSubRow =
- oilpanSuballocationSubRow.subRows[0];
- checkRow(columns, oilpanUnspecifiedSuballocationSubRow, {
- title: function(formattedTitle) {
- assert.equal(formattedTitle.textContent, '<unspecified>');
- assert.equal(formattedTitle.title, 'v8/__99BEAD');
- },
- size: [75497472],
- effective_size: [150994944],
- contexts: getAllocatorDumps(processMemoryDumps, 'v8/__99BEAD'),
- });
-
- var oilpanAnimalsSuballocationSubRow = oilpanSuballocationSubRow.subRows[1];
- checkRow(columns, oilpanAnimalsSuballocationSubRow, {
- title: function(formattedTitle) {
- assert.equal(formattedTitle.textContent, 'animals');
- assert.equal(formattedTitle.title, '');
- },
- size: [50331648],
- effective_size: [100663296],
- sub_row_count: 2,
- contexts: [SUBALLOCATION_CONTEXT],
- });
-
- var oilpanCowSuballocationSubRow =
- oilpanAnimalsSuballocationSubRow.subRows[0];
- checkRow(columns, oilpanCowSuballocationSubRow, {
- title: function(formattedTitle) {
- assert.equal(formattedTitle.textContent, 'cow');
- assert.equal(formattedTitle.title, 'v8/__42BEEF');
- },
- size: [33554432],
- effective_size: [67108864],
- contexts: getAllocatorDumps(processMemoryDumps, 'v8/__42BEEF'),
- });
-
- var skiaSuballocationSubRow = suballocationsSubRow.subRows[1];
- checkRow(columns, skiaSuballocationSubRow, {
- title: function(formattedTitle) {
- assert.equal(formattedTitle.textContent, 'skia');
- assert.equal(formattedTitle.title, 'v8/__15FADE');
- },
- size: [8388608],
- effective_size: [16777216],
- contexts: getAllocatorDumps(processMemoryDumps, 'v8/__15FADE'),
- });
-
- var ccSuballocationSubRow = suballocationsSubRow.subRows[2];
- checkRow(columns, ccSuballocationSubRow, {
- title: function(formattedTitle) {
- assert.equal(formattedTitle.textContent, 'cc');
- assert.equal(formattedTitle.title, 'v8/__12FEED');
- },
- size: [1048576],
- effective_size: [5242880],
- url: ['localhost:1234'],
- contexts: getAllocatorDumps(processMemoryDumps, 'v8/__12FEED')
- });
- });
-
- test('instantiate_multipleDiff', function() {
- var processMemoryDumps = createProcessMemoryDumps();
-
- var viewEl = tr.ui.analysis.createTestPane(
- 'tr-ui-a-memory-dump-allocator-details-pane');
- viewEl.memoryAllocatorDumps = getAllocatorDumps(processMemoryDumps, 'v8');
- viewEl.aggregationMode = AggregationMode.DIFF;
- viewEl.rebuild();
- assert.deepEqual(viewEl.requestedChildPanes, [undefined]);
- this.addHTMLOutput(viewEl);
-
- // Check that the table is shown.
- assert.isTrue(isElementDisplayed(viewEl.$.table));
- assert.isFalse(isElementDisplayed(viewEl.$.info_text));
-
- var table = viewEl.$.table;
- var columns = table.tableColumns;
- checkColumns(columns, EXPECTED_COLUMNS, AggregationMode.DIFF);
- var rows = table.tableRows;
- assert.lengthOf(rows, 1);
-
- // Check the rows of the table.
- var rootRow = rows[0];
- checkRow(columns, rootRow, {
- title: 'v8',
- size: [942619648, 1066401792],
- effective_size: [1081031680, 1073741824],
- inner_size: [2097152, 2097152],
- objects_count: [204, 204],
- sub_row_count: 4,
- contexts: getAllocatorDumps(processMemoryDumps, 'v8'),
- });
-
- var heapsSubRow = rootRow.subRows[0];
- checkRow(columns, heapsSubRow, {
- title: 'heaps',
- size: [805306368, undefined],
- effective_size: [805306368, undefined],
- sub_row_count: 2,
- contexts: getAllocatorDumps(processMemoryDumps, 'v8/heaps'),
- });
-
- var heapsUnspecifiedSubRow = heapsSubRow.subRows[0];
- checkRow(columns, heapsUnspecifiedSubRow, {
- title: '<unspecified>',
- size: [524288, undefined],
- effective_size: [524288, undefined],
- contexts: getAllocatorDumps(processMemoryDumps, 'v8/heaps/<unspecified>'),
- });
-
- var unspecifiedSubRow = rootRow.subRows[2];
- checkRow(columns, unspecifiedSubRow, {
- title: '<unspecified>',
- size: [undefined, 791725056],
- effective_size: [undefined, 791725056],
- contexts: getAllocatorDumps(processMemoryDumps, 'v8/<unspecified>'),
- });
-
- var suballocationsSubRow = rootRow.subRows[3];
- checkRow(columns, suballocationsSubRow, {
- title: function(formattedTitle) {
- assert.equal(formattedTitle.textContent, 'suballocations');
- assert.equal(formattedTitle.title, '');
- },
- size: [135266304, 272629760],
- effective_size: [273678336, 279969792],
- sub_row_count: 3,
- contexts: [SUBALLOCATION_CONTEXT, SUBALLOCATION_CONTEXT],
- });
-
- var oilpanSuballocationSubRow = suballocationsSubRow.subRows[0];
- checkRow(columns, oilpanSuballocationSubRow, {
- title: function(formattedTitle) {
- assert.equal(formattedTitle.textContent, 'oilpan');
- assert.equal(formattedTitle.title, '');
- },
- size: [125829120, 268435456],
- effective_size: [251658240, 268435456],
- sub_row_count: 2,
- contexts: [SUBALLOCATION_CONTEXT, SUBALLOCATION_CONTEXT],
- });
-
- var oilpanUnspecifiedSuballocationSubRow =
- oilpanSuballocationSubRow.subRows[0];
- checkRow(columns, oilpanUnspecifiedSuballocationSubRow, {
- title: function(formattedTitle) {
- assert.equal(formattedTitle.textContent, '<unspecified>');
- assert.equal(formattedTitle.title, 'v8/__99BEAD');
- },
- size: [75497472, 268435456],
- effective_size: [150994944, 268435456],
- contexts: getAllocatorDumps(processMemoryDumps, 'v8/__99BEAD'),
- });
-
- var oilpanAnimalsSuballocationSubRow = oilpanSuballocationSubRow.subRows[1];
- checkRow(columns, oilpanAnimalsSuballocationSubRow, {
- title: function(formattedTitle) {
- assert.equal(formattedTitle.textContent, 'animals');
- assert.equal(formattedTitle.title, '');
- },
- size: [50331648, undefined],
- effective_size: [100663296, undefined],
- sub_row_count: 2,
- contexts: [SUBALLOCATION_CONTEXT, undefined],
- });
-
- var oilpanCowSuballocationSubRow =
- oilpanAnimalsSuballocationSubRow.subRows[0];
- checkRow(columns, oilpanCowSuballocationSubRow, {
- title: function(formattedTitle) {
- assert.equal(formattedTitle.textContent, 'cow');
- assert.equal(formattedTitle.title, 'v8/__42BEEF');
- },
- size: [33554432, undefined],
- effective_size: [67108864, undefined],
- contexts: getAllocatorDumps(processMemoryDumps, 'v8/__42BEEF'),
- });
-
- var skiaSuballocationSubRow = suballocationsSubRow.subRows[1];
- checkRow(columns, skiaSuballocationSubRow, {
- title: function(formattedTitle) {
- assert.equal(formattedTitle.textContent, 'skia');
- assert.equal(formattedTitle.title, 'v8/__15FADE');
- },
- size: [8388608, undefined],
- effective_size: [16777216, undefined],
- contexts: getAllocatorDumps(processMemoryDumps, 'v8/__15FADE'),
- });
-
- var ccSuballocationSubRow = suballocationsSubRow.subRows[2];
- checkRow(columns, ccSuballocationSubRow, {
- title: function(formattedTitle) {
- assert.equal(formattedTitle.textContent, 'cc');
- assert.equal(formattedTitle.title, 'v8/__12FEED, v8/__13DEED');
- },
- size: [1048576, 4194304],
- effective_size: [5242880, 11534336],
- url: ['localhost:1234', 'localhost:5678'],
- contexts: [
- processMemoryDumps[0].getMemoryAllocatorDumpByFullName('v8/__12FEED'),
- processMemoryDumps[1].getMemoryAllocatorDumpByFullName('v8/__13DEED')
- ]
- });
- });
-
- test('instantiate_multipleMax', function() {
- var processMemoryDumps = createProcessMemoryDumps();
-
- var viewEl = tr.ui.analysis.createTestPane(
- 'tr-ui-a-memory-dump-allocator-details-pane');
- viewEl.memoryAllocatorDumps = getAllocatorDumps(processMemoryDumps, 'v8');
- viewEl.aggregationMode = AggregationMode.MAX;
- viewEl.rebuild();
- assert.deepEqual(viewEl.requestedChildPanes, [undefined]);
- this.addHTMLOutput(viewEl);
-
- // Check that the table is shown.
- assert.isTrue(isElementDisplayed(viewEl.$.table));
- assert.isFalse(isElementDisplayed(viewEl.$.info_text));
-
- // Just check that the aggregation mode was propagated to the columns.
- var table = viewEl.$.table;
- var columns = table.tableColumns;
- checkColumns(columns, EXPECTED_COLUMNS, AggregationMode.MAX);
- var rows = table.tableRows;
- assert.lengthOf(rows, 1);
- });
-
- test('instantiate_multipleWithUndefined', function() {
- var processMemoryDumps = createProcessMemoryDumps();
- processMemoryDumps.splice(1, 0, undefined);
-
- var viewEl = tr.ui.analysis.createTestPane(
- 'tr-ui-a-memory-dump-allocator-details-pane');
- viewEl.memoryAllocatorDumps = getAllocatorDumps(processMemoryDumps, 'v8');
- viewEl.aggregationMode = AggregationMode.DIFF;
- viewEl.rebuild();
- assert.deepEqual(viewEl.requestedChildPanes, [undefined]);
- this.addHTMLOutput(viewEl);
-
- // Check that the table is shown.
- assert.isTrue(isElementDisplayed(viewEl.$.table));
- assert.isFalse(isElementDisplayed(viewEl.$.info_text));
-
- var table = viewEl.$.table;
- var columns = table.tableColumns;
- checkColumns(columns, EXPECTED_COLUMNS, AggregationMode.DIFF);
- var rows = table.tableRows;
- assert.lengthOf(rows, 1);
-
- // Check only a few rows of the table.
- var rootRow = rows[0];
- checkRow(columns, rootRow, {
- title: 'v8',
- size: [942619648, undefined, 1066401792],
- effective_size: [1081031680, undefined, 1073741824],
- inner_size: [2097152, undefined, 2097152],
- objects_count: [204, undefined, 204],
- sub_row_count: 4,
- contexts: getAllocatorDumps(processMemoryDumps, 'v8'),
- });
-
- var unspecifiedSubRow = rootRow.subRows[2];
- checkRow(columns, unspecifiedSubRow, {
- title: '<unspecified>',
- size: [undefined, undefined, 791725056],
- effective_size: [undefined, undefined, 791725056],
- contexts: getAllocatorDumps(processMemoryDumps, 'v8/<unspecified>'),
- });
-
- var suballocationsSubRow = rootRow.subRows[3];
- checkRow(columns, suballocationsSubRow, {
- title: function(formattedTitle) {
- assert.equal(formattedTitle.textContent, 'suballocations');
- assert.equal(formattedTitle.title, '');
- },
- size: [135266304, undefined, 272629760],
- effective_size: [273678336, undefined, 279969792],
- sub_row_count: 3,
- contexts: [SUBALLOCATION_CONTEXT, undefined, SUBALLOCATION_CONTEXT],
- });
- });
-
- test('heapDumpsPassThrough', function() {
- var processMemoryDumps = createProcessMemoryDumps();
- var heapDumps = processMemoryDumps.map(function(dump) {
- if (dump === undefined)
- return undefined;
- return new HeapDump(dump, 'v8');
- });
-
- // Start by creating a component details pane without any heap dumps.
- var viewEl = tr.ui.analysis.createTestPane(
- 'tr-ui-a-memory-dump-allocator-details-pane');
- viewEl.memoryAllocatorDumps = getAllocatorDumps(processMemoryDumps, 'v8');
- viewEl.aggregationMode = AggregationMode.MAX;
- viewEl.rebuild();
-
- assert.lengthOf(viewEl.requestedChildPanes, 1);
- assert.isUndefined(viewEl.requestedChildPanes[0]);
-
- // Set the heap dumps. This should trigger creating a heap details pane.
- viewEl.heapDumps = heapDumps;
- viewEl.aggregationMode = AggregationMode.DIFF;
- viewEl.rebuild();
-
- assert.lengthOf(viewEl.requestedChildPanes, 2);
- assert.strictEqual(viewEl.requestedChildPanes[1].tagName,
- 'TR-UI-A-MEMORY-DUMP-HEAP-DETAILS-PANE');
- assert.strictEqual(viewEl.requestedChildPanes[1].heapDumps, heapDumps);
- assert.strictEqual(viewEl.requestedChildPanes[1].aggregationMode,
- AggregationMode.DIFF);
-
- // Unset the heap dumps. This should trigger removing the heap details pane.
- viewEl.heapDumps = undefined;
- viewEl.rebuild();
-
- assert.lengthOf(viewEl.requestedChildPanes, 3);
- assert.isUndefined(viewEl.requestedChildPanes[2]);
- });
-
- test('allocatorDumpNameColumn', function() {
- var c = new AllocatorDumpNameColumn();
-
- // Regular row.
- assert.strictEqual(c.formatTitle({title: 'Regular row'}), 'Regular row');
-
- // Sub-allocation row.
- var row = c.formatTitle({title: 'Suballocation row', suballocation: true});
- assert.strictEqual(row.textContent, 'Suballocation row');
- assert.strictEqual(row.style.fontStyle, 'italic');
- });
-
- test('effectiveSizeColumn_noContext', function() {
- var c = new EffectiveSizeColumn('Effective Size', 'bytes', tr.b.identity,
- AggregationMode.DIFF);
-
- // Single selection.
- checkColumnInfosAndColor(c,
- createSizeFields([128]),
- undefined /* no context */,
- [] /* no infos */,
- undefined /* no color */);
-
- // Multi-selection.
- checkColumnInfosAndColor(c,
- createSizeFields([128, 256, undefined, 64]),
- undefined /* no context */,
- [] /* no infos */,
- undefined /* no color */);
- });
-
- test('effectiveSizeColumn_suballocationContext', function() {
- var c = new EffectiveSizeColumn('Effective Size', 'bytes', tr.b.identity,
- AggregationMode.MAX);
-
- // Single selection.
- checkColumnInfosAndColor(c,
- createSizeFields([128]),
- [SUBALLOCATION_CONTEXT],
- [] /* no infos */,
- undefined /* no color */);
-
- // Multi-selection.
- checkColumnInfosAndColor(c,
- createSizeFields([undefined, 256, undefined, 64]),
- [undefined, SUBALLOCATION_CONTEXT, SUBALLOCATION_CONTEXT,
- SUBALLOCATION_CONTEXT],
- [] /* no infos */,
- undefined /* no color */);
- });
-
- test('effectiveSizeColumn_dumpContext_noOwnership', function() {
- var c = new EffectiveSizeColumn('Effective Size', 'bytes', tr.b.identity,
- AggregationMode.DIFF);
- var pmds = buildProcessMemoryDumps(4 /* count */, function(pmds) {
- addRootDumps(pmds[0], ['v8'], function(v8Dump) {
- addChildDump(v8Dump, 'heaps', { size: 64 });
- });
- addRootDumps(pmds[2], ['v8'], function(v8Dump) {
- addChildDump(v8Dump, 'heaps', { size: 128 });
- });
- addRootDumps(pmds[3], ['v8'], function(v8Dump) {});
- });
- var v8HeapsDumps = getAllocatorDumps(pmds, 'v8/heaps');
-
- // Single selection.
- checkAllocatorPaneColumnInfosAndColor(c,
- [v8HeapsDumps[0]],
- 'effective_size',
- [] /* no infos */);
-
- // Multi-selection, all dumps defined.
- checkAllocatorPaneColumnInfosAndColor(c,
- [v8HeapsDumps[0], v8HeapsDumps[2]],
- 'effective_size',
- [] /* no infos */);
-
- // Multi-selection, some dumps missing.
- checkAllocatorPaneColumnInfosAndColor(c,
- v8HeapsDumps,
- 'effective_size',
- [] /* no infos */);
- });
-
- test('effectiveSizeColumn_dumpContext_singleOwnership', function() {
- var c = new EffectiveSizeColumn('Effective Size', 'bytes', tr.b.identity,
- AggregationMode.MAX);
- var pmds = buildProcessMemoryDumps(5 /* count */, function(pmds) {
- addRootDumps(pmds[0], ['v8', 'oilpan'], function(v8Dump, oilpanDump) {
- var v8HeapsDump = addChildDump(v8Dump, 'heaps', { size: 32 });
- var oilpanObjectsDump =
- addChildDump(oilpanDump, 'objects', { size: 64 });
- addOwnershipLink(v8HeapsDump, oilpanObjectsDump);
- });
- addRootDumps(pmds[1], ['v8'], function(v8Dump) {
- addChildDump(v8Dump, 'heaps', { size: 32 });
- // Missing oilpan/objects dump.
- });
- addRootDumps(pmds[2], ['v8', 'oilpan'], function(v8Dump, oilpanDump) {
- addChildDump(oilpanDump, 'objects', { size: 64 });
- // Missing v8/heaps dump.
- });
- addRootDumps(pmds[3], ['v8', 'oilpan'], function(v8Dump, oilpanDump) {
- addChildDump(v8Dump, 'heaps', { size: 32 });
- addChildDump(oilpanDump, 'objects', { size: 64 });
- // Missing ownership link.
- });
- addRootDumps(pmds[4], ['v8', 'oilpan'], function(v8Dump, oilpanDump) {
- var v8HeapsDump = addChildDump(v8Dump, 'heaps', { size: 32 });
- var oilpanObjectsDump =
- addChildDump(oilpanDump, 'objects', { size: 64 });
- addOwnershipLink(v8HeapsDump, oilpanObjectsDump, 2);
- });
- });
- var v8HeapsDump = getAllocatorDumps(pmds, 'v8/heaps');
- var oilpanObjectsDump = getAllocatorDumps(pmds, 'oilpan/objects');
-
- // Single selection.
- checkAllocatorPaneColumnInfosAndColor(c,
- [v8HeapsDump[0]],
- 'effective_size',
- [
- {
- icon: '\u21FE',
- message: 'shares \'oilpan/objects\' in Process 1 (importance: 0) ' +
- 'with no other dumps',
- color: 'green'
- }
- ]);
- checkAllocatorPaneColumnInfosAndColor(c,
- [oilpanObjectsDump[4]],
- 'effective_size',
- [
- {
- icon: '\u21FD',
- message: 'shared by \'v8/heaps\' in Process 1 (importance: 2)',
- color: 'green'
- }
- ]);
-
- // Multi-selection, all dumps defined.
- checkAllocatorPaneColumnInfosAndColor(c,
- [v8HeapsDump[0], v8HeapsDump[4]],
- 'effective_size',
- [
- {
- icon: '\u21FE',
- message: 'shares \'oilpan/objects\' in Process 1 (importance: ' +
- '0\u20132) with no other dumps',
- color: 'green'
- }
- ]);
- checkAllocatorPaneColumnInfosAndColor(c,
- [oilpanObjectsDump[0], oilpanObjectsDump[4]],
- 'effective_size',
- [
- {
- icon: '\u21FD',
- message: 'shared by \'v8/heaps\' in Process 1 (importance: ' +
- '0\u20132)',
- color: 'green'
- }
- ]);
-
- // Multi-selection, some dumps missing.
- checkAllocatorPaneColumnInfosAndColor(c,
- v8HeapsDump,
- 'effective_size',
- [
- {
- icon: '\u21FE',
- message: 'shares \'oilpan/objects\' in Process 1 at some ' +
- 'selected timestamps (importance: 0\u20132) with no other ' +
- 'dumps',
- color: 'green'
- }
- ]);
- checkAllocatorPaneColumnInfosAndColor(c,
- oilpanObjectsDump,
- 'effective_size',
- [
- {
- icon: '\u21FD',
- message: 'shared by \'v8/heaps\' in Process 1 at some selected ' +
- 'timestamps (importance: 0\u20132)',
- color: 'green'
- }
- ]);
- });
-
- test('effectiveSizeColumn_dumpContext_multipleOwnerships', function() {
- var c = new EffectiveSizeColumn('Effective Size', 'bytes', tr.b.identity,
- AggregationMode.DIFF);
- var pmds = buildProcessMemoryDumps(6 /* count */, function(pmds) {
- addRootDumps(pmds[0], ['v8', 'oilpan'], function(v8Dump, oilpanDump) {
- var v8HeapsDump = addChildDump(v8Dump, 'heaps', { size: 32 });
- var v8QueuesDump = addChildDump(v8Dump, 'queues', { size: 8 });
- var oilpanObjectsDump =
- addChildDump(oilpanDump, 'objects', { size: 64 });
- addOwnershipLink(v8HeapsDump, oilpanObjectsDump);
- addOwnershipLink(v8QueuesDump, oilpanObjectsDump, 1);
- });
- addRootDumps(pmds[1], ['v8'], function(v8Dump) {});
- addRootDumps(pmds[2], ['v8', 'oilpan'], function(v8Dump, oilpanDump) {
- var v8HeapsDump = addChildDump(v8Dump, 'heaps', { size: 32 });
- var v8QueuesDump = addChildDump(v8Dump, 'queues', { size: 8 });
- var v8PilesDump = addChildDump(v8Dump, 'piles', { size: 48 });
- var oilpanObjectsDump =
- addChildDump(oilpanDump, 'objects', { size: 64 });
- addOwnershipLink(v8HeapsDump, oilpanObjectsDump, 2);
- addOwnershipLink(v8QueuesDump, oilpanObjectsDump, 1);
- addOwnershipLink(v8PilesDump, oilpanObjectsDump);
- });
- addRootDumps(pmds[3], ['v8', 'blink'], function(v8Dump, blinkDump) {
- var blinkHandlesDump = addChildDump(blinkDump, 'handles', { size: 32 });
- var v8HeapsDump = addChildDump(v8Dump, 'heaps', { size: 64 });
- var blinkObjectsDump = addChildDump(blinkDump, 'objects', { size: 32 });
- addOwnershipLink(blinkHandlesDump, v8HeapsDump, -273);
- addOwnershipLink(v8HeapsDump, blinkObjectsDump, 3);
- });
- addRootDumps(pmds[4], ['v8', 'gpu'], function(v8Dump, gpuDump) {
- var v8HeapsDump = addChildDump(v8Dump, 'heaps', { size: 64 });
- var gpuTile1Dump = addChildDump(gpuDump, 'tile1', { size: 100 });
- var gpuTile2Dump = addChildDump(gpuDump, 'tile2', { size: 99 });
- addOwnershipLink(v8HeapsDump, gpuTile1Dump, 3);
- addOwnershipLink(gpuTile2Dump, gpuTile1Dump, -1);
- });
- addRootDumps(pmds[5], ['v8', 'oilpan'], function(v8Dump, oilpanDump) {
- var v8HeapsDump = addChildDump(v8Dump, 'heaps', { size: 32 });
- var v8QueuesDump = addChildDump(v8Dump, 'queues', { size: 8 });
- var v8PilesDump = addChildDump(v8Dump, 'piles', { size: 48 });
- var oilpanObjectsDump =
- addChildDump(oilpanDump, 'objects', { size: 64 });
- addOwnershipLink(v8HeapsDump, oilpanObjectsDump, 1);
- addOwnershipLink(v8QueuesDump, oilpanObjectsDump, 1);
- addOwnershipLink(v8PilesDump, oilpanObjectsDump, 7);
- });
- });
- var v8HeapsDump = getAllocatorDumps(pmds, 'v8/heaps');
- var oilpanObjectsDump = getAllocatorDumps(pmds, 'oilpan/objects');
- var gpuTile1Dump = getAllocatorDumps(pmds, 'gpu/tile1');
-
- // Single selection.
- checkAllocatorPaneColumnInfosAndColor(c,
- [v8HeapsDump[4]],
- 'effective_size',
- [
- {
- icon: '\u21FE',
- message: 'shares \'gpu/tile1\' in Process 1 (importance: 3) with ' +
- '\'gpu/tile2\' in Process 1 (importance: -1)',
- color: 'green'
- }
- ]);
- checkAllocatorPaneColumnInfosAndColor(c,
- [gpuTile1Dump[4]],
- 'effective_size',
- [
- {
- icon: '\u21FD',
- message: 'shared by:\n' +
- ' - \'v8/heaps\' in Process 1 (importance: 3)\n' +
- ' - \'gpu/tile2\' in Process 1 (importance: -1)',
- color: 'green'
- }
- ]);
-
- // Multi-selection, all dumps defined.
- checkAllocatorPaneColumnInfosAndColor(c,
- [v8HeapsDump[2], v8HeapsDump[5]],
- 'effective_size',
- [
- {
- icon: '\u21FE',
- message: 'shares \'oilpan/objects\' in Process 1 (importance: ' +
- '1\u20132) with:\n' +
- ' - \'v8/queues\' in Process 1 (importance: 1)\n' +
- ' - \'v8/piles\' in Process 1 (importance: 0\u20137)',
- color: 'green'
- }
- ]);
- checkAllocatorPaneColumnInfosAndColor(c,
- [oilpanObjectsDump[2], oilpanObjectsDump[5]],
- 'effective_size',
- [
- {
- icon: '\u21FD',
- message: 'shared by:\n' +
- ' - \'v8/heaps\' in Process 1 (importance: 1\u20132)\n' +
- ' - \'v8/queues\' in Process 1 (importance: 1)\n' +
- ' - \'v8/piles\' in Process 1 (importance: 0\u20137)',
- color: 'green'
- }
- ]);
-
- // Multi-selection, some dumps missing.
- checkAllocatorPaneColumnInfosAndColor(c,
- v8HeapsDump,
- 'effective_size',
- [ // v8/objects is both owned (first info) and an owner (second info).
- {
- icon: '\u21FD',
- message: 'shared by \'blink/handles\' in Process 1 at some ' +
- 'selected timestamps (importance: -273)',
- color: 'green'
- },
- {
- icon: '\u21FE',
- message: 'shares:\n' +
- ' - \'oilpan/objects\' in Process 1 at some selected ' +
- 'timestamps (importance: 0\u20132) with:\n' +
- ' - \'v8/queues\' in Process 1 (importance: 1)\n' +
- ' - \'v8/piles\' in Process 1 at some selected ' +
- 'timestamps (importance: 0\u20137)\n' +
- ' - \'blink/objects\' in Process 1 at some selected ' +
- 'timestamps (importance: 3) with no other dumps\n' +
- ' - \'gpu/tile1\' in Process 1 at some selected timestamps ' +
- '(importance: 3) with \'gpu/tile2\' in Process 1 ' +
- '(importance: -1)',
- color: 'green'
- }
- ]);
- checkAllocatorPaneColumnInfosAndColor(c,
- oilpanObjectsDump,
- 'effective_size',
- [
- {
- icon: '\u21FD',
- message: 'shared by:\n' +
- ' - \'v8/heaps\' in Process 1 at some selected timestamps ' +
- '(importance: 0\u20132)\n' +
- ' - \'v8/queues\' in Process 1 at some selected timestamps ' +
- '(importance: 1)\n' +
- ' - \'v8/piles\' in Process 1 at some selected timestamps ' +
- '(importance: 0\u20137)',
- color: 'green'
- }
- ]);
- });
-
- test('sizeColumn_noContext', function() {
- var c = new SizeColumn('Size', 'bytes', tr.b.identity,
- AggregationMode.DIFF);
-
- // Single selection.
- checkColumnInfosAndColor(c,
- createSizeFields([128]),
- undefined /* no context */,
- [] /* no infos */,
- undefined /* no color */);
-
- // Multi-selection.
- checkColumnInfosAndColor(c,
- createSizeFields([128, 256, undefined, 64]),
- undefined /* no context */,
- [] /* no infos */,
- undefined /* no color */);
- });
-
- test('sizeColumn_suballocationContext', function() {
- var c = new SizeColumn('Size', 'bytes', tr.b.identity, AggregationMode.MAX);
-
- // Single selection.
- checkColumnInfosAndColor(c,
- createSizeFields([128]),
- [SUBALLOCATION_CONTEXT],
- [] /* no infos */,
- undefined /* no color */);
-
- // Multi-selection.
- checkColumnInfosAndColor(c,
- createSizeFields([undefined, 256, undefined, 64]),
- [undefined, SUBALLOCATION_CONTEXT, undefined, SUBALLOCATION_CONTEXT],
- [] /* no infos */,
- undefined /* no color */);
- });
-
- test('sizeColumn_dumpContext', function() {
- var c = new SizeColumn('Size', 'bytes', tr.b.identity,
- AggregationMode.DIFF);
- var pmds = buildProcessMemoryDumps(7 /* count */, function(pmds) {
- addRootDumps(pmds[0], ['v8'], function(v8Dump) {
- // Single direct overlap (v8/objects -> v8/heaps).
- var v8ObjectsDump = addChildDump(v8Dump, 'objects', { size: 1536 });
- var v8HeapsDump = addChildDump(v8Dump, 'heaps', { size: 2048 });
- addOwnershipLink(v8ObjectsDump, v8HeapsDump);
- });
- // pmd[1] intentionally skipped.
- addRootDumps(pmds[2], ['v8'], function(v8Dump, oilpanDump) {
- // Single direct overlap with inconsistent owned dump size.
- var v8ObjectsDump = addChildDump(v8Dump, 'objects', { size: 3072 });
- var v8HeapsDump = addChildDump(v8Dump, 'heaps', { size: 2048 });
- addOwnershipLink(v8ObjectsDump, v8HeapsDump);
- });
- addRootDumps(pmds[3], ['v8'], function(v8Dump) {
- // Single indirect overlap (v8/objects/X -> v8/heaps/42).
- var v8ObjectsDump = addChildDump(v8Dump, 'objects', { size: 1536 });
- var v8ObjectsXDump = addChildDump(v8ObjectsDump, 'X', { size: 512 });
- var v8HeapsDump = addChildDump(v8Dump, 'heaps', { size: 2048 });
- var v8Heaps42Dump = addChildDump(v8HeapsDump, '42', { size: 1024 });
- addOwnershipLink(v8ObjectsXDump, v8Heaps42Dump);
- });
- addRootDumps(pmds[4], ['v8'], function(v8Dump) {
- // Multiple overlaps.
- var v8ObjectsDump = addChildDump(v8Dump, 'objects', { size: 1024 });
- var v8HeapsDump = addChildDump(v8Dump, 'heaps', { size: 2048 });
-
- var v8ObjectsXDump = addChildDump(v8ObjectsDump, 'X', { size: 512 });
- var v8Heaps42Dump = addChildDump(v8HeapsDump, '42', { size: 1280 });
- addOwnershipLink(v8ObjectsXDump, v8Heaps42Dump);
-
- var v8ObjectsYDump = addChildDump(v8ObjectsDump, 'Y', { size: 128 });
- var v8Heaps90Dump = addChildDump(v8HeapsDump, '90', { size: 256 });
- addOwnershipLink(v8ObjectsYDump, v8Heaps90Dump);
-
- var v8BlocksDump = addChildDump(v8Dump, 'blocks', { size: 768 });
- addOwnershipLink(v8BlocksDump, v8Heaps42Dump);
- });
- addRootDumps(pmds[5], ['v8'], function(v8Dump) {
- // No overlaps, inconsistent parent size.
- var v8HeapsDump = addChildDump(v8Dump, 'heaps', { size: 2048 });
- addChildDump(v8HeapsDump, '42', { size: 1536 });
- addChildDump(v8HeapsDump, '90', { size: 615 });
- });
- addRootDumps(pmds[6], ['v8', 'oilpan'], function(v8Dump, oilpanDump) {
- // No overlaps, inconsistent parent and owned dump size.
- var v8HeapsDump = addChildDump(v8Dump, 'heaps', { size: 2048 });
- addChildDump(v8HeapsDump, '42', { size: 1536 });
- addChildDump(v8HeapsDump, '90', { size: 615 });
- var oilpanObjectsDump =
- addChildDump(oilpanDump, 'objects', { size: 3072 });
- addOwnershipLink(oilpanObjectsDump, v8HeapsDump);
- });
- });
- var v8HeapDumps = getAllocatorDumps(pmds, 'v8/heaps');
-
- // Single selection, single overlap.
- checkAllocatorPaneColumnInfosAndColor(c,
- [v8HeapDumps[0]],
- 'size',
- [
- {
- icon: '\u24D8',
- message: 'overlaps with its sibling \'objects\' (1.5 KiB)',
- color: 'blue'
- }
- ]);
-
- // Single selection, multiple overlaps.
- checkAllocatorPaneColumnInfosAndColor(c,
- [v8HeapDumps[4]],
- 'size',
- [
- {
- icon: '\u24D8',
- message: 'overlaps with its siblings:\n' +
- ' - \'objects\' (640.0 B)\n' +
- ' - \'blocks\' (768.0 B)',
- color: 'blue'
- }
- ]);
-
- // Single selection, warnings with no overlaps.
- checkAllocatorPaneColumnInfosAndColor(c,
- [v8HeapDumps[6]],
- 'size',
- [
- {
- icon: '\u26A0',
- message: 'provided size (2.0 KiB) was less than the aggregated ' +
- 'size of the children (2.1 KiB)',
- color: 'red'
- },
- {
- icon: '\u26A0',
- message: 'provided size (2.0 KiB) was less than the size of the ' +
- 'largest owner (3.0 KiB)',
- color: 'red'
- }
- ]);
-
- // Single selection, single overlap with a warning.
- checkAllocatorPaneColumnInfosAndColor(c,
- [v8HeapDumps[2]],
- 'size',
- [
- {
- icon: '\u24D8',
- message: 'overlaps with its sibling \'objects\' (3.0 KiB)',
- color: 'blue'
- },
- {
- icon: '\u26A0',
- message: 'provided size (2.0 KiB) was less than the size of the ' +
- 'largest owner (3.0 KiB)',
- color: 'red'
- }
- ]);
-
- // Multi-selection, single overlap.
- checkAllocatorPaneColumnInfosAndColor(c,
- [v8HeapDumps[0], v8HeapDumps[3]],
- 'size',
- [
- {
- icon: '\u24D8',
- message: 'overlaps with its sibling \'objects\'',
- color: 'blue'
- }
- ]);
-
- // Multi-selection, multiple overlaps.
- checkAllocatorPaneColumnInfosAndColor(c,
- [v8HeapDumps[0], v8HeapDumps[4]],
- 'size',
- [
- {
- icon: '\u24D8',
- message: 'overlaps with its siblings:\n' +
- ' - \'objects\'\n' +
- ' - \'blocks\' at some selected timestamps',
- color: 'blue'
- }
- ]);
-
- // Multi-selection, warnings with no overlaps.
- checkAllocatorPaneColumnInfosAndColor(c,
- [v8HeapDumps[5], v8HeapDumps[6]],
- 'size',
- [
- {
- icon: '\u26A0',
- message: 'provided size was less than the aggregated ' +
- 'size of the children',
- color: 'red'
- },
- {
- icon: '\u26A0',
- message: 'provided size was less than the size of the largest ' +
- 'owner at some selected timestamps',
- color: 'red'
- }
- ]);
-
- // Multi-selection, multiple overlaps with warnings.
- checkAllocatorPaneColumnInfosAndColor(c,
- v8HeapDumps,
- 'size',
- [
- {
- icon: '\u24D8',
- message: 'overlaps with its siblings:\n' +
- ' - \'objects\' at some selected timestamps\n' +
- ' - \'blocks\' at some selected timestamps',
- color: 'blue'
- },
- {
- icon: '\u26A0',
- message: 'provided size was less than the size of the largest ' +
- 'owner at some selected timestamps',
- color: 'red'
- },
- {
- icon: '\u26A0',
- message: 'provided size was less than the aggregated size of ' +
- 'the children at some selected timestamps',
- color: 'red'
- }
- ]);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_header_pane.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_header_pane.html
deleted file mode 100644
index 7b9ea7ce06e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_header_pane.html
+++ /dev/null
@@ -1,174 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/memory_dump_overview_pane.html">
-<link rel="import" href="/tracing/ui/analysis/memory_dump_sub_view_util.html">
-<link rel="import" href="/tracing/ui/analysis/stacked_pane.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-a-memory-dump-header-pane"
- extends="tr-ui-a-stacked-pane">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: row;
- align-items: center;
-
- background-color: #d0d0d0;
- border-bottom: 1px solid #8e8e8e;
- border-top: 1px solid white;
- }
-
- #label {
- flex: 1 1 auto;
- padding: 6px;
- font-size: 15px;
- }
-
- #aggregation_mode_container {
- display: none;
- flex: 0 0 auto;
- padding: 5px;
- font-size: 15px;
- }
- </style>
- </tr-ui-b-view-specific-brushing-state>
- <div id="label"></div>
- <div id="aggregation_mode_container">
- <span>Metric aggregation:</span>
- <!-- Aggregation mode selector (added in Polymer.ready()) -->
- </div>
- </template>
-</polymer-element>
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.analysis', function() {
-
- Polymer('tr-ui-a-memory-dump-header-pane', {
- created: function() {
- this.containerMemoryDumps_ = undefined;
- },
-
- ready: function() {
- this.$.aggregation_mode_container.appendChild(tr.ui.b.createSelector(
- this, 'aggregationMode', 'memoryDumpHeaderPane.aggregationMode',
- tr.ui.analysis.MemoryColumn.AggregationMode.DIFF,
- [
- {
- label: 'Diff',
- value: tr.ui.analysis.MemoryColumn.AggregationMode.DIFF
- },
- {
- label: 'Max',
- value: tr.ui.analysis.MemoryColumn.AggregationMode.MAX
- }
- ]));
- },
-
- /**
- * Sets the container memory dumps and schedules rebuilding the pane.
- *
- * The provided value should be a chronologically sorted list of
- * ContainerMemoryDump objects. All of the dumps must be associated with
- * the same container (i.e. containerMemoryDumps must be either a list of
- * ProcessMemoryDump(s) belonging to the same process, or a list of
- * GlobalMemoryDump(s)). Example:
- *
- * [
- * tr.model.ProcessMemoryDump {}, // PMD at timestamp 1.
- * tr.model.ProcessMemoryDump {}, // PMD at timestamp 2.
- * tr.model.ProcessMemoryDump {} // PMD at timestamp 3.
- * ]
- */
- set containerMemoryDumps(containerMemoryDumps) {
- this.containerMemoryDumps_ = containerMemoryDumps;
- this.scheduleRebuildPane_();
- },
-
- get containerMemoryDumps() {
- return this.containerMemoryDumps_;
- },
-
- set aggregationMode(aggregationMode) {
- this.aggregationMode_ = aggregationMode;
- this.scheduleRebuildPane_();
- },
-
- get aggregationMode() {
- return this.aggregationMode_;
- },
-
- rebuildPane_: function() {
- this.updateLabel_();
- this.updateAggregationModeSelector_();
- this.changeChildPane_();
- },
-
- updateLabel_: function() {
- this.$.label.textContent = '';
-
- if (this.containerMemoryDumps_ === undefined ||
- this.containerMemoryDumps_.length <= 0) {
- this.$.label.textContent = 'No memory dumps selected';
- return;
- }
-
- var containerDumpCount = this.containerMemoryDumps_.length;
- var isMultiSelection = containerDumpCount > 1;
-
- this.$.label.appendChild(document.createTextNode(
- 'Selected ' + containerDumpCount + ' memory dump' +
- (isMultiSelection ? 's' : '') +
- ' in ' + this.containerMemoryDumps_[0].containerName + ' at '));
- // TODO(petrcermak): Use <tr-v-ui-scalar-span> once it can be displayed
- // inline. See https://github.com/catapult-project/catapult/issues/1371.
- this.$.label.appendChild(document.createTextNode(
- tr.v.Unit.byName.timeStampInMs.format(
- this.containerMemoryDumps_[0].start)));
- if (isMultiSelection) {
- var ELLIPSIS = String.fromCharCode(8230);
- this.$.label.appendChild(document.createTextNode(ELLIPSIS));
- this.$.label.appendChild(document.createTextNode(
- tr.v.Unit.byName.timeStampInMs.format(
- this.containerMemoryDumps_[containerDumpCount - 1].start)));
- }
- },
-
- updateAggregationModeSelector_: function() {
- var displayStyle;
- if (this.containerMemoryDumps_ === undefined ||
- this.containerMemoryDumps_.length <= 1)
- displayStyle = 'none';
- else
- displayStyle = 'initial';
- this.$.aggregation_mode_container.style.display = displayStyle;
- },
-
- changeChildPane_: function() {
- this.childPaneBuilder = function() {
- if (this.containerMemoryDumps_ === undefined ||
- this.containerMemoryDumps_.length <= 0)
- return undefined;
-
- var overviewPane = document.createElement(
- 'tr-ui-a-memory-dump-overview-pane');
- overviewPane.processMemoryDumps = this.containerMemoryDumps_.map(
- function(containerDump) {
- return containerDump.processMemoryDumps;
- });
- overviewPane.aggregationMode = this.aggregationMode;
- return overviewPane;
- }.bind(this);
- }
- });
-
- return {};
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_header_pane_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_header_pane_test.html
deleted file mode 100644
index f3e220605e8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_header_pane_test.html
+++ /dev/null
@@ -1,132 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/memory_dump_header_pane.html">
-<link rel="import"
- href="/tracing/ui/analysis/memory_dump_sub_view_test_utils.html">
-<link rel="import" href="/tracing/ui/analysis/memory_dump_sub_view_util.html">
-<link rel="import" href="/tracing/ui/base/deep_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var AggregationMode = tr.ui.analysis.MemoryColumn.AggregationMode;
- var isElementDisplayed = tr.ui.analysis.isElementDisplayed;
-
- function createAndCheckMemoryDumpHeaderPane(test, containerMemoryDumps,
- expectedLabelText, expectedChildPaneRequested, expectedSelectorVisible) {
- var viewEl =
- tr.ui.analysis.createTestPane('tr-ui-a-memory-dump-header-pane');
- viewEl.containerMemoryDumps = containerMemoryDumps;
- viewEl.rebuild();
- test.addHTMLOutput(viewEl);
- checkMemoryDumpHeaderPane(viewEl, containerMemoryDumps, expectedLabelText,
- expectedChildPaneRequested, expectedSelectorVisible);
- }
-
- function checkMemoryDumpHeaderPane(viewEl, containerMemoryDumps,
- expectedLabelText, expectedChildPaneRequested, expectedSelectorVisible) {
- // The default aggregation mode is DIFF.
- assert.equal(viewEl.aggregationMode, AggregationMode.DIFF);
-
- // Check the text in the label.
- assert.equal(viewEl.$.label.textContent, expectedLabelText);
-
- // Check the visibility of aggregation mode selector.
- var aggregationModeContainerVisible =
- isElementDisplayed(viewEl.$.aggregation_mode_container);
- var childPanes = viewEl.requestedChildPanes;
-
- // Check the requested child panes.
- if (containerMemoryDumps === undefined ||
- containerMemoryDumps.length === 0) {
- assert.isTrue(!expectedSelectorVisible); // Test sanity check.
- assert.isFalse(aggregationModeContainerVisible);
- assert.lengthOf(childPanes, 1);
- assert.isUndefined(childPanes[0]);
- return;
- }
-
- var expectedProcessMemoryDumps = containerMemoryDumps.map(
- function(containerMemoryDump) {
- return containerMemoryDump.processMemoryDumps;
- });
- function checkLastChildPane(expectedChildPaneCount) {
- assert.lengthOf(childPanes, expectedChildPaneCount);
- var lastChildPane = childPanes[expectedChildPaneCount - 1];
- assert.equal(lastChildPane.tagName, 'TR-UI-A-MEMORY-DUMP-OVERVIEW-PANE');
- assert.deepEqual(lastChildPane.processMemoryDumps,
- expectedProcessMemoryDumps);
- assert.equal(lastChildPane.aggregationMode, viewEl.aggregationMode);
- }
-
- checkLastChildPane(1);
-
- // Check the behavior of aggregation mode selector (if visible).
- if (!expectedSelectorVisible) {
- assert.isFalse(aggregationModeContainerVisible);
- return;
- }
-
- assert.isTrue(aggregationModeContainerVisible);
- var selector = tr.b.findDeepElementMatching(viewEl, 'select');
-
- selector.selectedValue = AggregationMode.MAX;
- viewEl.rebuild();
- assert.equal(viewEl.aggregationMode, AggregationMode.MAX);
- checkLastChildPane(2);
-
- selector.selectedValue = AggregationMode.DIFF;
- viewEl.rebuild();
- assert.equal(viewEl.aggregationMode, AggregationMode.DIFF);
- checkLastChildPane(3);
- }
-
- test('instantiate_empty', function() {
- tr.ui.analysis.createAndCheckEmptyPanes(this,
- 'tr-ui-a-memory-dump-header-pane', 'containerMemoryDumps',
- function(viewEl) {
- checkMemoryDumpHeaderPane(viewEl, [], 'No memory dumps selected',
- false /* no child pane requested */,
- false /* aggregation mode selector hidden */);
- });
- });
-
- test('instantiate_singleGlobalMemoryDump', function() {
- createAndCheckMemoryDumpHeaderPane(this,
- [tr.ui.analysis.createSingleTestGlobalMemoryDump()],
- 'Selected 1 memory dump in global space at 68.000 ms',
- true /* child pane requested */,
- false /* aggregation mode selector hidden */);
- });
-
- test('instantiate_multipleGlobalMemoryDumps', function() {
- createAndCheckMemoryDumpHeaderPane(this,
- tr.ui.analysis.createMultipleTestGlobalMemoryDumps(),
- 'Selected 3 memory dumps in global space at 42.000 ms\u2026100.000 ms',
- true /* child pane requested */,
- true /* aggregation selector visible */);
- });
-
- test('instantiate_singleProcessMemoryDump', function() {
- createAndCheckMemoryDumpHeaderPane(this,
- [tr.ui.analysis.createSingleTestProcessMemoryDump()],
- 'Selected 1 memory dump in Process 2 at 69.000 ms',
- true /* child pane requested */,
- false /* aggregation mode selector hidden */);
- });
-
- test('instantiate_multipleProcessMemoryDumps', function() {
- createAndCheckMemoryDumpHeaderPane(this,
- tr.ui.analysis.createMultipleTestProcessMemoryDumps(),
- 'Selected 3 memory dumps in Process 2 at 42.000 ms\u2026102.000 ms',
- true /* child pane requested */,
- true /* aggregation selector visible */);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_heap_details_pane.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_heap_details_pane.html
deleted file mode 100644
index 05d4ad5d689..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_heap_details_pane.html
+++ /dev/null
@@ -1,488 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/multi_dimensional_view.html">
-<link rel="import" href="/tracing/ui/analysis/memory_dump_sub_view_util.html">
-<link rel="import" href="/tracing/ui/analysis/stacked_pane.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel='import' href='/tracing/ui/base/info_bar.html'>
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-a-memory-dump-heap-details-pane"
- extends="tr-ui-a-stacked-pane">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
-
- #header {
- flex: 0 0 auto;
- display: flex;
- flex-direction: row;
- align-items: center;
-
- background-color: #eee;
- border-bottom: 1px solid #8e8e8e;
- border-top: 1px solid white;
- }
-
- #label {
- flex: 1 1 auto;
- padding: 8px;
- font-size: 15px;
- font-weight: bold;
- }
-
- #view_mode_container {
- display: none;
- flex: 0 0 auto;
- padding: 5px;
- font-size: 15px;
- }
-
- #contents {
- flex: 1 0 auto;
- align-self: stretch;
- font-size: 12px;
- }
-
- #info_text {
- padding: 8px;
- color: #666;
- font-style: italic;
- text-align: center;
- }
-
- #table {
- display: none; /* Hide until memory allocator dumps are set. */
- flex: 1 0 auto;
- align-self: stretch;
- }
- </style>
- <div id="header">
- <div id="label">Heap details</div>
- <div id="view_mode_container">
- <span>View mode:</span>
- <!-- View mode selector (added in Polymer.ready()) -->
- </div>
- </div>
- <div id="contents">
- <tr-ui-b-info-bar id="info_bar" class="info-bar-hidden">
- </tr-ui-b-info-bar>
- <div id="info_text">No heap dump selected</div>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </div>
- </template>
-</polymer-element>
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.analysis', function() {
-
- var ScalarNumeric = tr.v.ScalarNumeric;
- var sizeInBytes_smallerIsBetter =
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
- var unitlessNumber_smallerIsBetter =
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter;
- var MultiDimensionalViewBuilder = tr.b.MultiDimensionalViewBuilder;
- var TotalState = tr.b.MultiDimensionalViewNode.TotalState;
-
- /** @{enum} */
- var RowDimension = {
- ROOT: -1,
- STACK_FRAME: 0,
- OBJECT_TYPE: 1
- };
-
- var LATIN_SMALL_LETTER_F_WITH_HOOK = String.fromCharCode(0x0192);
- var CIRCLED_LATIN_CAPITAL_LETTER_T = String.fromCharCode(0x24C9);
-
- /** @{constructor} */
- function HeapDumpNodeTitleColumn(title) {
- tr.ui.analysis.TitleColumn.call(this, title);
- }
-
- HeapDumpNodeTitleColumn.prototype = {
- __proto__: tr.ui.analysis.TitleColumn.prototype,
-
- formatTitle: function(row) {
- var title = row.title;
- var dimension = row.dimension;
- switch (dimension) {
- case RowDimension.ROOT:
- return title;
-
- case RowDimension.STACK_FRAME:
- case RowDimension.OBJECT_TYPE:
- return this.formatSubRow_(title, dimension);
-
- default:
- throw new Error('Invalid row dimension: ' + row.dimension);
- }
- },
-
- cmp: function(rowA, rowB) {
- if (rowA.dimension !== rowB.dimension)
- return rowA.dimension - rowB.dimension;
- return tr.ui.analysis.TitleColumn.prototype.cmp.call(this, rowA, rowB);
- },
-
- formatSubRow_: function(title, dimension) {
- var titleEl = document.createElement('span');
-
- var symbolEl = document.createElement('span');
- var symbolColorName;
- if (dimension === RowDimension.STACK_FRAME) {
- symbolEl.textContent = LATIN_SMALL_LETTER_F_WITH_HOOK;
- symbolEl.title = 'Stack frame';
- symbolColorName = 'heap_dump_stack_frame';
- } else {
- symbolEl.textContent = CIRCLED_LATIN_CAPITAL_LETTER_T;
- symbolEl.title = 'Object type';
- symbolColorName = 'heap_dump_object_type';
- }
- symbolEl.style.color =
- tr.b.ColorScheme.getColorForReservedNameAsString(symbolColorName);
- symbolEl.style.paddingRight = '4px';
- symbolEl.style.cursor = 'help';
- symbolEl.style.weight = 'bold';
- titleEl.appendChild(symbolEl);
-
- titleEl.appendChild(document.createTextNode(title));
-
- return titleEl;
- }
- };
-
- /** @constructor */
- function AllocationCountColumn(name, cellPath, aggregationMode) {
- tr.ui.analysis.DetailsNumericMemoryColumn.call(
- this, name, cellPath, aggregationMode);
- }
-
- AllocationCountColumn.prototype = {
- __proto__: tr.ui.analysis.DetailsNumericMemoryColumn.prototype,
-
- getFormattingContext: function(unit) {
- return { minimumFractionDigits: 0 };
- }
- };
-
- var COLUMN_RULES = [
- {
- condition: 'Size',
- importance: 3,
- columnConstructor: tr.ui.analysis.DetailsNumericMemoryColumn
- },
- {
- condition: 'Count',
- importance: 2,
- columnConstructor: AllocationCountColumn
- },
- {
- condition: 'Average size per allocation',
- importance: 1,
- columnConstructor: tr.ui.analysis.DetailsNumericMemoryColumn
- },
- {
- importance: 0,
- columnConstructor: tr.ui.analysis.DetailsNumericMemoryColumn
- }
- ];
-
- Polymer('tr-ui-a-memory-dump-heap-details-pane', {
- created: function() {
- this.heapDumps_ = undefined;
- this.aggregationMode_ = undefined;
- this.viewMode_ = undefined;
- },
-
- ready: function() {
- this.$.table.selectionMode = tr.ui.b.TableFormat.SelectionMode.ROW;
- this.$.info_bar.message = 'Note: Values displayed in the heavy view ' +
- 'are lower bounds (except for the root).';
-
- this.$.view_mode_container.appendChild(tr.ui.b.createSelector(
- this, 'viewMode', 'memoryDumpHeapDetailsPane.viewMode',
- MultiDimensionalViewBuilder.ViewType.TOP_DOWN_TREE_VIEW,
- [
- {
- label: 'Top-down (Tree)',
- value: MultiDimensionalViewBuilder.ViewType.TOP_DOWN_TREE_VIEW
- },
- {
- label: 'Top-down (Heavy)',
- value: MultiDimensionalViewBuilder.ViewType.TOP_DOWN_HEAVY_VIEW
- },
- {
- label: 'Bottom-up (Heavy)',
- value: MultiDimensionalViewBuilder.ViewType.BOTTOM_UP_HEAVY_VIEW
- }
- ]));
- },
-
- /**
- * Sets the heap dumps and schedules rebuilding the pane.
- *
- * The provided value should be a chronological list of heap dumps. All
- * dumps are assumed to belong to the same process and belong to the same
- * allocator. Example:
- *
- * [
- * tr.model.HeapDump {}, // Heap dump at timestamp 1.
- * undefined, // Heap dump not provided at timestamp 2.
- * tr.model.HeapDump {}, // Heap dump at timestamp 3.
- * ]
- */
- set heapDumps(heapDumps) {
- this.heapDumps_ = heapDumps;
- this.scheduleRebuildPane_();
- },
-
- get heapDumps() {
- return this.heapDumps_;
- },
-
- set aggregationMode(aggregationMode) {
- this.aggregationMode_ = aggregationMode;
- this.scheduleRebuildPane_();
- },
-
- get aggregationMode() {
- return this.aggregationMode_;
- },
-
- set viewMode(viewMode) {
- this.viewMode_ = viewMode;
- this.scheduleRebuildPane_();
- },
-
- get viewMode() {
- return this.viewMode_;
- },
-
- get heavyView() {
- switch (this.viewMode) {
- case MultiDimensionalViewBuilder.ViewType.TOP_DOWN_HEAVY_VIEW:
- case MultiDimensionalViewBuilder.ViewType.BOTTOM_UP_HEAVY_VIEW:
- return true;
- default:
- return false;
- }
- },
-
- rebuildPane_: function() {
- if (this.heapDumps_ === undefined ||
- this.heapDumps_.length === 0) {
- // Show the info text (hide the table and the view mode selector).
- this.$.info_text.style.display = 'block';
- this.$.table.style.display = 'none';
- this.$.view_mode_container.style.display = 'none';
- this.$.info_bar.visible = false;
-
- this.$.table.clear();
- this.$.table.rebuild();
- return;
- }
-
- // Show the table and the view mode selector (hide the info text).
- this.$.info_text.style.display = 'none';
- this.$.table.style.display = 'block';
- this.$.view_mode_container.style.display = 'block';
-
- // Show the info bar if in heavy view mode.
- this.$.info_bar.visible = this.heavyView;
-
- var stackFrameTrees = this.createStackFrameTrees_(this.heapDumps_);
- var rows = this.createRows_(stackFrameTrees);
- var columns = this.createColumns_(rows);
-
- this.$.table.tableRows = rows;
- this.$.table.tableColumns = columns;
- this.$.table.rebuild();
- tr.ui.analysis.expandTableRowsRecursively(this.$.table);
- },
-
- createStackFrameTrees_: function(heapDumps) {
- return heapDumps.map(function(heapDump) {
- if (heapDump === undefined)
- return undefined;
-
- var builder = new MultiDimensionalViewBuilder(
- 2 /* dimensions (stack frames, object type) */,
- 2 /* valueCount (size, count) */);
-
- // Build the heap tree.
- heapDump.entries.forEach(function(entry) {
- var leafStackFrame = entry.leafStackFrame;
- var stackTracePath = leafStackFrame === undefined ?
- [] : leafStackFrame.getUserFriendlyStackTrace().reverse();
-
- var objectTypeName = entry.objectTypeName;
- var objectTypeNamePath = objectTypeName === undefined ?
- [] : [objectTypeName];
-
- builder.addPath([stackTracePath, objectTypeNamePath],
- [entry.size, entry.count],
- MultiDimensionalViewBuilder.ValueKind.TOTAL);
- }, this);
-
- return builder.buildView(this.viewMode);
- }, this);
- },
-
- createRows_: function(stackFrameTrees) {
- var definedHeapDump = tr.b.findFirstInArray(this.heapDumps);
- if (definedHeapDump === undefined)
- return [];
-
- // The title of the root row is the name of the allocator.
- var rootRowTitle = definedHeapDump.allocatorName;
- return [this.createHeapRowRecursively_(
- stackFrameTrees, RowDimension.ROOT, rootRowTitle)];
- },
-
- createHeapRowRecursively_: function(nodes, dimension, title) {
- // Transform a chronological list of stack frame tree nodes into a
- // dictionary of cells (where each cell contains a chronological list
- // of the values of its numeric).
- var cells = tr.ui.analysis.createCells(nodes, function(node) {
- var size = node.values[0].total;
- var row = {
- 'Size': new ScalarNumeric(sizeInBytes_smallerIsBetter, size)
- };
- var countValue = node.values[1];
- if (countValue.totalState >= this.minDisplayedTotalState_) {
- var count = countValue.total;
- row['Count'] = new ScalarNumeric(unitlessNumber_smallerIsBetter,
- count);
- row['Average size per allocation'] = new ScalarNumeric(
- sizeInBytes_smallerIsBetter, count === 0 ? 0 : size / count);
- }
- return row;
- }, this);
-
- var row = {
- dimension: dimension,
- title: title,
- contexts: nodes,
- cells: cells
- };
-
- // Recursively create sub-rows for children (if applicable).
- var stackFrameSubRows = this.createHeapDimensionSubRowsRecursively_(
- nodes, RowDimension.STACK_FRAME);
- var objectTypeSubRows = this.createHeapDimensionSubRowsRecursively_(
- nodes, RowDimension.OBJECT_TYPE);
- var subRows = stackFrameSubRows.concat(objectTypeSubRows);
- if (subRows.length > 0)
- row.subRows = subRows;
-
- return row;
- },
-
- get minDisplayedTotalState_() {
- if (this.heavyView) {
- // Show lower-bound and exact values in heavy views.
- return TotalState.LOWER_BOUND;
- } else {
- // Show only exact values in tree view.
- return TotalState.EXACT;
- }
- },
-
- createHeapDimensionSubRowsRecursively_: function(nodes, dimension) {
- // Sub-row name (list index) -> Timestamp (list index) -> Child
- // MultiDimensionalViewNode.
- var dimensionGroupedChildNodes = tr.b.dictionaryValues(
- tr.b.invertArrayOfDicts(nodes, function(node) {
- var childDict = {};
- var displayedChildrenTotalSize = 0;
- var displayedChildrenTotalCount = 0;
- var hasDisplayedChildren = false;
- var allDisplayedChildrenHaveDisplayedCounts = true;
- for (var child of node.children[dimension].values()) {
- if (child.values[0].totalState < this.minDisplayedTotalState_)
- continue;
- if (child.values[1].totalState < this.minDisplayedTotalState_)
- allDisplayedChildrenHaveDisplayedCounts = false;
- childDict[child.title[dimension]] = child;
- displayedChildrenTotalSize += child.values[0].total;
- displayedChildrenTotalCount += child.values[1].total;
- hasDisplayedChildren = true;
- }
-
- var nodeTotalSize = node.values[0].total;
- var nodeTotalCount = node.values[1].total;
-
- // Add '<other>' node if necessary in tree-view.
- var hasUnclassifiedSizeOrCount =
- displayedChildrenTotalSize < nodeTotalSize ||
- displayedChildrenTotalCount < nodeTotalCount;
- if (!this.heavyView && hasUnclassifiedSizeOrCount &&
- hasDisplayedChildren) {
- var otherTitle = node.title.slice();
- otherTitle[dimension] = '<other>';
- childDict['<other>'] = {
- title: otherTitle,
- values: [
- {
- self: 0,
- total: nodeTotalSize - displayedChildrenTotalSize,
- totalState: this.minDisplayedTotalState_
- },
- {
- self: 0,
- total: nodeTotalCount - displayedChildrenTotalCount,
- // Don't show allocation count of the '<other>' node if
- // there is a displayed child node that did NOT display
- // allocation count.
- totalState: allDisplayedChildrenHaveDisplayedCounts ?
- this.minDisplayedTotalState_ : TotalState.NOT_PROVIDED
- }
- ],
- children: [new Map(), new Map()]
- };
- }
-
- return childDict;
- }, this));
-
- // Sub-row name (list index) -> Sub-row.
- return dimensionGroupedChildNodes.map(function(subRowNodes) {
- var subRowTitle = tr.b.findFirstInArray(subRowNodes).title[dimension];
- return this.createHeapRowRecursively_(
- subRowNodes, dimension, subRowTitle);
- }, this);
- },
-
- createColumns_: function(rows) {
- var titleColumn = new HeapDumpNodeTitleColumn('Stack frame');
- titleColumn.width = '500px';
-
- var numericColumns = tr.ui.analysis.MemoryColumn.fromRows(
- rows, 'cells', this.aggregationMode_, COLUMN_RULES);
- tr.ui.analysis.MemoryColumn.spaceEqually(numericColumns);
-
- var columns = [titleColumn].concat(numericColumns);
- return columns;
- }
- });
-
- return {
- // Exported for testing.
- RowDimension: RowDimension,
- AllocationCountColumn: AllocationCountColumn
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_heap_details_pane_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_heap_details_pane_test.html
deleted file mode 100644
index 1d1425dfb88..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_heap_details_pane_test.html
+++ /dev/null
@@ -1,4091 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel='import' href='/tracing/base/iteration_helpers.html'>
-<link rel='import' href='/tracing/base/multi_dimensional_view.html'>
-<link rel='import' href='/tracing/core/test_utils.html'>
-<link rel='import' href='/tracing/model/heap_dump.html'>
-<link rel='import' href='/tracing/model/memory_dump_test_utils.html'>
-<link rel='import'
- href='/tracing/ui/analysis/memory_dump_heap_details_pane.html'>
-<link rel='import'
- href='/tracing/ui/analysis/memory_dump_sub_view_test_utils.html'>
-<link rel='import' href='/tracing/ui/analysis/memory_dump_sub_view_util.html'>
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ViewType = tr.b.MultiDimensionalViewBuilder.ViewType;
- var TOP_DOWN_TREE_VIEW = ViewType.TOP_DOWN_TREE_VIEW;
- var TOP_DOWN_HEAVY_VIEW = ViewType.TOP_DOWN_HEAVY_VIEW;
- var BOTTOM_UP_HEAVY_VIEW = ViewType.BOTTOM_UP_HEAVY_VIEW;
- var HeapDump = tr.model.HeapDump;
- var RowDimension = tr.ui.analysis.RowDimension;
- var ROOT = RowDimension.ROOT;
- var STACK_FRAME = RowDimension.STACK_FRAME;
- var OBJECT_TYPE = RowDimension.OBJECT_TYPE;
- var TitleColumn = tr.ui.analysis.TitleColumn;
- var NumericMemoryColumn = tr.ui.analysis.NumericMemoryColumn;
- var AllocationCountColumn = tr.ui.analysis.AllocationCountColumn;
- var AggregationMode = tr.ui.analysis.MemoryColumn.AggregationMode;
- var addGlobalMemoryDump = tr.model.MemoryDumpTestUtils.addGlobalMemoryDump;
- var addProcessMemoryDump = tr.model.MemoryDumpTestUtils.addProcessMemoryDump;
- var checkColumns = tr.ui.analysis.checkColumns;
- var checkNumericFields = tr.ui.analysis.checkNumericFields;
- var checkSizeNumericFields = tr.ui.analysis.checkSizeNumericFields;
- var isElementDisplayed = tr.ui.analysis.isElementDisplayed;
- var unitlessNumber_smallerIsBetter =
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter;
-
- function createHeapDumps(withCount) {
- var model = new tr.Model();
- var process = model.getOrCreateProcess(1);
-
- function addHeapEntry(heapDump, stackFrames, objectTypeName, size, count) {
- var leafStackFrame = stackFrames === undefined ? undefined :
- tr.c.TestUtils.newStackTrace(model, stackFrames);
- heapDump.addEntry(leafStackFrame, objectTypeName, size,
- withCount ? count : undefined);
- }
-
- // First timestamp.
- var gmd1 = addGlobalMemoryDump(model, -10);
- var pmd1 = addProcessMemoryDump(gmd1, process, -11);
- var hd1 = new HeapDump(pmd1, 'partition_alloc');
-
- addHeapEntry(hd1, undefined /* sum over all traces */,
- undefined /* sum over all types */, 4194304 /* 4 MiB */, 1000);
- addHeapEntry(hd1, undefined /* sum over all traces */, 'v8::Context',
- 1048576 /* 1 MiB */, 200);
- addHeapEntry(hd1, undefined /* sum over all traces */, 'blink::Node',
- 331776 /* 324 KiB */, 10);
- addHeapEntry(hd1, ['MessageLoop::RunTask'],
- undefined /* sum over all types */, 4194304 /* 4 MiB */, 1000);
- addHeapEntry(hd1, ['MessageLoop::RunTask'], 'v8::Context',
- 1048576 /* 1 MiB */, 200);
-
- addHeapEntry(hd1, ['MessageLoop::RunTask', 'FunctionCall'],
- undefined /* sum over all types */, 1406976 /* 1.3 MiB */, 299);
- addHeapEntry(hd1, ['MessageLoop::RunTask', 'FunctionCall'],
- 'blink::Node', 331776 /* 324 KiB */, 10);
- addHeapEntry(hd1, ['MessageLoop::RunTask', 'FunctionCall'], 'v8::Context',
- 1024000 /* 1000 KiB */, 176);
- addHeapEntry(hd1, ['MessageLoop::RunTask', 'FunctionCall', '<self>'],
- undefined /* sum over all types */, 102400 /* 100 KiB */, 30);
- addHeapEntry(hd1, ['MessageLoop::RunTask', 'FunctionCall', 'V8.Execute'],
- 'v8::Context', 716800 /* 700 KiB */, 100);
- addHeapEntry(hd1, ['MessageLoop::RunTask', 'FunctionCall', 'V8.Execute'],
- undefined /* sum over all types */, 1048576 /* 1 MiB */, 101);
- addHeapEntry(hd1, ['MessageLoop::RunTask', 'FunctionCall', 'FunctionCall'],
- undefined /* sum over all types */,
- 153600 /* 150 KiB, lower than the actual sum (should be ignored) */,
- 25 /* the allocation count should, however, NOT be ignored */);
- addHeapEntry(hd1, ['MessageLoop::RunTask', 'FunctionCall', 'FunctionCall'],
- 'v8::Context', 153600 /* 150 KiB */, 15);
-
- // The following entry should not appear in the tree-view because there is
- // no entry for its parent stack frame.
- addHeapEntry(hd1, ['MessageLoop::RunTask', 'MissingParent', 'FunctionCall'],
- undefined /* sum over all types */, 10 /* 10 B */, 2);
-
- // The following entry should not appear in the tree-view because there is
- // no sum over all types (for the given stack trace). However, it will lead
- // to a visible increase of the (incorrectly provided) sum over all types
- // of MessageLoop::RunTask -> FunctionCall -> FunctionCall by 50 KiB.
- addHeapEntry(hd1,
- ['MessageLoop::RunTask', 'FunctionCall', 'FunctionCall',
- 'FunctionCall'],
- 'MissingSumOverAllTypes', 51200 /* 50 KiB */, 9);
-
- addHeapEntry(hd1, ['MessageLoop::RunTask', 'V8.Execute'],
- undefined /* sum over all types */, 2404352 /* 2.3 MiB */, 399);
- addHeapEntry(hd1, ['MessageLoop::RunTask', 'V8.Execute', 'FunctionCall'],
- undefined /* sum over all types */, 2404352 /* 2.3 MiB */, 399);
- addHeapEntry(hd1, ['MessageLoop::RunTask', 'V8.Execute', 'FunctionCall'],
- 'v8::Context', 20480 /* 20 KiB */, 6);
- addHeapEntry(hd1,
- ['MessageLoop::RunTask', 'V8.Execute', 'FunctionCall', '<self>'],
- 'v8::Context', 15360 /* 15 KiB */, 5);
- addHeapEntry(hd1,
- ['MessageLoop::RunTask', 'V8.Execute', 'FunctionCall', 'V8.Execute'],
- undefined /* sum over all types */, 2097152 /* 2 MiB */, 99);
- addHeapEntry(hd1,
- ['MessageLoop::RunTask', 'V8.Execute', 'FunctionCall', 'V8.Execute',
- 'V8.Execute'],
- undefined /* sum over all types */, 2097152 /* 2 MiB */, 99);
- addHeapEntry(hd1,
- ['MessageLoop::RunTask', 'V8.Execute', 'FunctionCall', '<self>'],
- undefined /* sum over all types */, 307200 /* 300 KiB */, 300);
-
- // Second timestamp.
- var gmd2 = addGlobalMemoryDump(model, 10);
- var pmd2 = addProcessMemoryDump(gmd2, process, 11);
- var hd2 = new HeapDump(pmd2, 'partition_alloc');
-
- addHeapEntry(hd2, undefined /* sum over all traces */,
- undefined /* sum over all types */,
- 3145728 /* 3 MiB, lower than the actual sum (should be ignored) */,
- 900 /* the allocation count should, however, NOT be ignored */);
- addHeapEntry(hd2, undefined /* sum over all traces */,
- 'v8::Context', 1258291 /* 1.2 MiB */, 520);
- addHeapEntry(hd2, undefined /* sum over all traces */,
- 'blink::Node', 1048576 /* 1 MiB */, 5);
- addHeapEntry(hd2, ['<self>'], undefined /* sum over all types */,
- 131072 /* 128 KiB */, 16);
- addHeapEntry(hd2, ['<self>'], 'v8::Context', 131072 /* 128 KiB */, 16);
- addHeapEntry(hd2, ['MessageLoop::RunTask'],
- undefined /* sum over all types */, 4823449 /* 4.6 MiB */, 884);
- addHeapEntry(hd2, ['MessageLoop::RunTask'], 'v8::Context',
- 1127219 /* 1.1 MiB */, 317);
-
- addHeapEntry(hd2, ['MessageLoop::RunTask', 'FunctionCall'],
- undefined /* sum over all types */, 2170880 /* 2.1 MiB */, 600);
- addHeapEntry(hd2, ['MessageLoop::RunTask', 'FunctionCall'], 'v8::Context',
- 1024000 /* 1000 KiB */, 500);
- addHeapEntry(hd2, ['MessageLoop::RunTask', 'FunctionCall'], 'blink::Node',
- 819200 /* 800 KiB */, 4);
- addHeapEntry(hd2, ['MessageLoop::RunTask', 'FunctionCall', 'V8.Execute'],
- undefined /* sum over all types */, 1572864 /* 1.5 MiB */, 270);
- addHeapEntry(hd2, ['MessageLoop::RunTask', 'FunctionCall', 'V8.Execute'],
- 'v8::Context', 614400 /* 600 KiB */, 123);
- addHeapEntry(hd2, ['MessageLoop::RunTask', 'FunctionCall', 'V8.Execute'],
- 'blink::Node', 819200 /* 800 KiB */, 4);
- addHeapEntry(hd2, ['MessageLoop::RunTask', 'FunctionCall', 'FunctionCall'],
- undefined /* sum over all types */, 204800 /* 200 KiB */, 313);
- addHeapEntry(hd2, ['MessageLoop::RunTask', 'FunctionCall', 'FunctionCall'],
- 'v8::Context', 122880 /* 120 KiB */, 270);
- addHeapEntry(hd2,
- ['MessageLoop::RunTask', 'FunctionCall', 'FunctionCall',
- 'FunctionCall'],
- undefined /* sum over all types */, 204800 /* 200 KiB */, 313);
- addHeapEntry(hd2, ['MessageLoop::RunTask', 'FunctionCall', '<self>'],
- undefined /* sum over all types */, 393216 /* 384 KiB */, 17);
-
- addHeapEntry(hd2, ['MessageLoop::RunTask', 'V8.Execute'],
- undefined /* sum over all types */, 2621440 /* 2.5 MiB */, 199);
- addHeapEntry(hd2, ['MessageLoop::RunTask', 'V8.Execute', 'FunctionCall'],
- undefined /* sum over all types */, 2621440 /* 2.5 MiB */, 199);
- addHeapEntry(hd2, ['MessageLoop::RunTask', 'V8.Execute', 'FunctionCall'],
- 'v8::Context', 20480 /* 20 KiB */, 4);
- addHeapEntry(hd2, ['MessageLoop::RunTask', 'V8.Execute', 'FunctionCall'],
- 'WTF::StringImpl', 126362 /* 123.4 KiB */, 56);
- addHeapEntry(hd2,
- ['MessageLoop::RunTask', 'V8.Execute', 'FunctionCall', 'V8.Execute'],
- undefined /* sum over all types */, 2516582 /* 2.4 MiB */, 158);
-
- return [hd1, hd2];
- }
-
- function checkDisplayedElements(viewEl, displayExpectations) {
- assert.strictEqual(isElementDisplayed(viewEl.$.info_text),
- displayExpectations.infoText);
- assert.strictEqual(isElementDisplayed(viewEl.$.info_bar),
- displayExpectations.infoBar);
- assert.strictEqual(isElementDisplayed(viewEl.$.table),
- displayExpectations.tableAndSelector);
- assert.strictEqual(isElementDisplayed(viewEl.$.view_mode_container),
- displayExpectations.tableAndSelector);
- }
-
- var EXPECTED_COLUMNS_WITHOUT_COUNT = [
- { title: 'Stack frame', type: TitleColumn, noAggregation: true },
- { title: 'Size', type: NumericMemoryColumn }
- ];
-
- var EXPECTED_COLUMNS_WITH_COUNT = EXPECTED_COLUMNS_WITHOUT_COUNT.concat([
- { title: 'Count', type: AllocationCountColumn },
- { title: 'Average size per allocation', type: NumericMemoryColumn }
- ]);
-
- function checkRow(columns, row, expectedDimension, expectedTitle,
- expectedSizes, expectedCounts, expectedAverageSizes,
- expectedDefinedValues) {
- var formattedTitle = columns[0].formatTitle(row);
- switch (expectedDimension) {
- case ROOT:
- assert.equal(formattedTitle, expectedTitle);
- break;
-
- case STACK_FRAME:
- case OBJECT_TYPE:
- assert.lengthOf(formattedTitle.childNodes, 2);
- assert.strictEqual(formattedTitle.childNodes[0].textContent,
- expectedDimension === STACK_FRAME ? '\u0192' : '\u24C9');
- assert.strictEqual(
- formattedTitle.childNodes[1].textContent, expectedTitle);
- break;
-
- default:
- throw new Error('Invalid expected dimension: ' + expectedDimension);
- }
-
- checkSizeNumericFields(row, columns[1], expectedSizes);
- if (expectedCounts !== undefined) {
- // Test sanity check.
- assert.lengthOf(expectedCounts, expectedSizes.length);
- assert.lengthOf(expectedAverageSizes, expectedSizes.length);
-
- checkNumericFields(row, columns[2], expectedCounts,
- unitlessNumber_smallerIsBetter);
- checkSizeNumericFields(row, columns[3], expectedAverageSizes);
- } else {
- // Test sanity check.
- assert.lengthOf(columns, EXPECTED_COLUMNS_WITHOUT_COUNT.length);
- assert.isUndefined(expectedAverageSizes);
- }
-
- var actualDefinedValues = new Array(row.contexts.length);
- for (var i = 0; i < row.contexts.length; i++)
- actualDefinedValues[i] = row.contexts[i] !== undefined;
- assert.deepEqual(actualDefinedValues, expectedDefinedValues);
- }
-
- function checkRows(columns, rows, expectedStructure) {
- if (expectedStructure === undefined) {
- assert.isUndefined(rows);
- return;
- }
-
- if (typeof expectedStructure === 'number') {
- assert.lengthOf(rows, expectedStructure);
- return;
- }
-
- assert.lengthOf(rows, expectedStructure.length);
- for (var i = 0; i < expectedStructure.length; i++) {
- var row = rows[i];
- var expectedRowStructure = expectedStructure[i];
- checkRow(columns, row, expectedRowStructure.dimension,
- expectedRowStructure.title, expectedRowStructure.size,
- expectedRowStructure.count, expectedRowStructure.averageSize,
- expectedRowStructure.defined);
- checkRows(columns, row.subRows, expectedRowStructure.children);
- }
- }
-
- function checkTable(viewEl, expectedConfig, expectedStructure) {
- checkDisplayedElements(viewEl, {
- infoText: false,
- tableAndSelector: true,
- infoBar: !!expectedConfig.expectedInfoBarDisplayed
- });
- var table = viewEl.$.table;
- var columns = table.tableColumns;
- var rows = table.tableRows;
- var expectedColumns = expectedConfig.expectedCountColumns ?
- EXPECTED_COLUMNS_WITH_COUNT : EXPECTED_COLUMNS_WITHOUT_COUNT;
- checkColumns(columns, expectedColumns,
- expectedConfig.expectedAggregationMode);
- checkRows(columns, rows, expectedStructure);
- }
-
- function changeView(viewEl, viewType) {
- tr.b.findDeepElementMatching(viewEl, 'select').selectedValue = viewType;
- viewEl.rebuild();
- }
-
- /**
- * Helper function for generating the expected structures of heap details
- * pane tables. Given a table, this function generates its structure.
- *
- * This avoids the need to write such structures manually, which is very
- * tedious. However, the correctness of the generated structures needs to be
- * verified by the developer! Maximum line length must also be enforced
- * manually.
- */
- function printTable(test, viewEl) {
- var generator = new tr.c.TestUtils.SourceGenerator();
-
- function formatRows(rows) {
- generator.formatMultiLineList(rows, function(row) {
- generator.push('{');
- generator.indentBlock(2, true /* break line */, function() {
- generator.push('dimension: ');
- for (var dimensionTitle in RowDimension) {
- if (row.dimension === RowDimension[dimensionTitle]) {
- generator.push(dimensionTitle);
- break;
- }
- }
- generator.push(',');
- generator.breakLine();
-
- generator.push('title: \'', row.title, '\',');
- generator.breakLine();
-
-
- var sizeFields = row.cells['Size'].fields;
- generator.push('size: ');
- generator.formatSingleLineList(sizeFields, function(field) {
- generator.push(
- field === undefined ? 'undefined' : String(field.value));
- });
- generator.push(',');
- generator.breakLine();
-
- if (row.cells['Count'] !== undefined) {
- var countFields = row.cells['Count'].fields;
- generator.push('count: ');
- generator.formatSingleLineList(countFields, function(field) {
- generator.push(
- field === undefined ? 'undefined' : String(field.value));
- });
- generator.push(',');
- generator.breakLine();
-
- generator.push('averageSize: ');
- generator.formatSingleLineList(row.cells['Average size'].fields,
- function(field, index) {
- if (field === undefined) {
- generator.push('undefined');
- } else if (field.value === 0) {
- generator.push('0');
- } else {
- generator.push(String(sizeFields[index].value) + ' / ' +
- String(countFields[index].value));
- }
- });
- generator.push(',');
- generator.breakLine();
- }
-
- generator.push('defined: ');
- generator.formatSingleLineList(sizeFields, function(field) {
- generator.push(String(field !== undefined));
- });
-
- if (row.subRows && row.subRows.length > 0) {
- generator.push(',');
- generator.breakLine();
- generator.push('children: ');
- formatRows(row.subRows);
- }
- });
- generator.breakLine();
- generator.push('}');
- });
- }
-
- generator.indentBlock(8, false /* don't break line */,
- formatRows.bind(null, viewEl.$.table.tableRows));
-
- tr.c.TestUtils.addSourceListing(test, generator.build());
-
- throw new Error('This error is thrown to prevent accidentally ' +
- 'checking in a test which calls this function.');
- }
-
- test('instantiate_empty', function() {
- tr.ui.analysis.createAndCheckEmptyPanes(this,
- 'tr-ui-a-memory-dump-heap-details-pane', 'heapDumps',
- function(viewEl) {
- // Check that the info text is shown.
- checkDisplayedElements(viewEl, {
- infoText: true,
- tableAndSelector: false,
- infoBar: false
- });
- });
- });
-
- test('instantiate_noEntries', function() {
- var heapDumps = createHeapDumps(false).slice(0, 1);
- heapDumps[0].entries = [];
-
- var viewEl = tr.ui.analysis.createTestPane(
- 'tr-ui-a-memory-dump-heap-details-pane');
- viewEl.heapDumps = heapDumps;
- viewEl.rebuild();
- this.addHTMLOutput(viewEl);
-
- // Top-down tree view (default).
- checkTable(viewEl,
- { /* empty expectedConfig */ },
- [
- {
- dimension: ROOT,
- title: 'partition_alloc',
- size: [0],
- defined: [true]
- }
- ]);
-
- changeView(viewEl, TOP_DOWN_HEAVY_VIEW);
- checkTable(viewEl,
- { expectedInfoBarDisplayed: true },
- [
- {
- dimension: ROOT,
- title: 'partition_alloc',
- size: [0],
- defined: [true]
- }
- ]);
-
- changeView(viewEl, BOTTOM_UP_HEAVY_VIEW);
- checkTable(viewEl,
- { expectedInfoBarDisplayed: true },
- [
- {
- dimension: ROOT,
- title: 'partition_alloc',
- size: [0],
- defined: [true]
- }
- ]);
-
- changeView(viewEl, TOP_DOWN_TREE_VIEW);
- });
-
- test('instantiate_single', function() {
- var heapDumps = createHeapDumps(false).slice(0, 1);
-
- var viewEl = tr.ui.analysis.createTestPane(
- 'tr-ui-a-memory-dump-heap-details-pane');
- viewEl.heapDumps = heapDumps;
- viewEl.rebuild();
- this.addHTMLOutput(viewEl);
-
- // Top-down tree view (default).
- checkTable(viewEl,
- { /* empty expectedConfig */ },
- [
- {
- dimension: ROOT,
- title: 'partition_alloc',
- size: [4194304],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [4194304],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1406976],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [102400],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [1048576],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [716800],
- defined: [true],
- },
- {
- dimension: OBJECT_TYPE,
- title: '<other>',
- size: [331776],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600 + 51200],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [153600],
- defined: [true],
- },
- {
- dimension: OBJECT_TYPE,
- title: '<other>',
- size: [51200],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [51200],
- defined: [true],
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776],
- defined: [true],
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1024000],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [153600],
- defined: [true],
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: '<other>',
- size: [51200],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2404352],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [2404352],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [307200],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [15360],
- defined: [true],
- },
- {
- dimension: OBJECT_TYPE,
- title: '<other>',
- size: [291840],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152],
- defined: [true],
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [5120],
- defined: [true],
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: '<other>',
- size: [2383872],
- defined: [true],
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [382976],
- defined: [true],
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1048576],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1024000],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [153600],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [24576],
- defined: [true],
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: '<other>',
- size: [3145728],
- defined: [true],
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1048576],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [1048576],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1024000],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [153600],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [24576],
- defined: [true],
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776],
- defined: [true],
- },
- {
- dimension: OBJECT_TYPE,
- title: '<other>',
- size: [2813952],
- defined: [true],
- }
- ]
- }
- ]);
-
- changeView(viewEl, BOTTOM_UP_HEAVY_VIEW);
- checkTable(viewEl,
- { expectedInfoBarDisplayed: true },
- [
- {
- dimension: ROOT,
- title: 'partition_alloc',
- size: [4194304],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [4194304],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1048576],
- defined: [true]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776],
- defined: [true]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [3811338],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [1406976],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776],
- defined: [true]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1024000],
- defined: [true]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [204800],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [204800],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [153600],
- defined: [true]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [51200],
- defined: [true]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [153600],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [153600],
- defined: [true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [51200],
- defined: [true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [51200],
- defined: [true]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'MissingParent',
- size: [10],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [10],
- defined: [true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2404352],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [2404352],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [20480],
- defined: [true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [20480],
- defined: [true]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [331776],
- defined: [true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1044480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [1024000],
- defined: [true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [153600],
- defined: [true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [20480],
- defined: [true]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [51200],
- defined: [true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [51200],
- defined: [true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [51200],
- defined: [true]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [409600],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [409600],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [102400],
- defined: [true]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [307200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [307200],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [15360],
- defined: [true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [15360],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [15360],
- defined: [true]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [15360],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [15360],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [15360],
- defined: [true]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [15360],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [15360],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [15360],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [15360],
- defined: [true]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [3452928],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [3145728],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [1048576],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [716800],
- defined: [true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [2097152],
- defined: [true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [716800],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [716800],
- defined: [true]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [2404352],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [20480],
- defined: [true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [2097152],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [2097152],
- defined: [true]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [737280],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [716800],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [716800],
- defined: [true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [20480],
- defined: [true]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'MissingParent',
- size: [10],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [10],
- defined: [true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1048576],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [1048576],
- defined: [true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1044480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [1024000],
- defined: [true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [153600],
- defined: [true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [20480],
- defined: [true]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [15360],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [15360],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [15360],
- defined: [true]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [737280],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [716800],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [716800],
- defined: [true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [20480],
- defined: [true]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [331776],
- defined: [true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [331776],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [331776],
- defined: [true]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [51200],
- defined: [true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [51200],
- defined: [true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [51200],
- defined: [true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [51200],
- defined: [true]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]);
-
- changeView(viewEl, TOP_DOWN_HEAVY_VIEW);
- checkTable(viewEl,
- { expectedInfoBarDisplayed: true }, [
- {
- dimension: ROOT,
- title: 'partition_alloc',
- size: [4194304],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [4194304],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1406976],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [102400],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [1048576],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [716800],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600 + 51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true],
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [153600],
- defined: [true],
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776],
- defined: [true],
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1024000],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600],
- defined: [true],
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'MissingParent',
- size: [10],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [10],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2404352],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [2404352],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [307200],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [15360],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152],
- defined: [true],
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360],
- defined: [true],
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360],
- defined: [true],
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1048576],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1024000],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360],
- defined: [true],
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [331776],
- defined: [true],
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1406976 + 10 + 2404352],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [102400 + 307200],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [15360],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [1048576 + 2097152],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152],
- defined: [true],
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [716800],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600 + 51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true],
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [153600],
- defined: [true],
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776],
- defined: [true],
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1024000 + 20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600],
- defined: [true],
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [102400 + 307200],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [15360],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [1048576 + 2404352],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [2404352],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [307200],
- defined: [true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [15360],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152],
- defined: [true],
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360],
- defined: [true],
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152],
- defined: [true],
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [716800 + 20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360],
- defined: [true],
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'MissingParent',
- size: [10],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [10],
- defined: [true],
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1048576],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [1048576],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1024000],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360],
- defined: [true],
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1024000 + 20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360],
- defined: [true],
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800 + 20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [20480],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360],
- defined: [true],
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [331776],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [331776],
- defined: [true],
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [331776],
- defined: [true],
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200],
- defined: [true],
- }
- ]
- }
- ]
- }
- ]
- }
- ]
- }
- ]);
- });
-
- test('instantiate_multipleDiff', function() {
- var heapDumps = createHeapDumps(true /* with allocation counts */);
-
- var viewEl = tr.ui.analysis.createTestPane(
- 'tr-ui-a-memory-dump-heap-details-pane');
- viewEl.heapDumps = heapDumps;
- viewEl.aggregationMode = AggregationMode.DIFF;
- viewEl.rebuild();
- this.addHTMLOutput(viewEl);
-
- changeView(viewEl, TOP_DOWN_HEAVY_VIEW);
- checkTable(viewEl,
- {
- expectedAggregationMode: AggregationMode.DIFF,
- expectedInfoBarDisplayed: true,
- expectedCountColumns: true
- },
- [
- {
- dimension: ROOT,
- title: 'partition_alloc',
- size: [4194304, 4954521],
- count: [1000, 900],
- averageSize: [4194304 / 1000, 4954521 / 900],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [4194304, 4823449],
- count: [1000, 884],
- averageSize: [4194304 / 1000, 4823449 / 884],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1406976, 2170880],
- count: [299, 600],
- averageSize: [1406976 / 299, 2170880 / 600],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [102400, 393216],
- count: [30, 17],
- averageSize: [102400 / 30, 393216 / 17],
- defined: [true, true]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [1048576, 1572864],
- count: [101, 270],
- averageSize: [1048576 / 101, 1572864 / 270],
- defined: [true, true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [716800, 614400],
- count: [100, 123],
- averageSize: [716800 / 100, 614400 / 123],
- defined: [true, true]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [undefined, 819200],
- count: [undefined, 4],
- averageSize: [undefined, 819200 / 4],
- defined: [false, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [204800, 204800],
- count: [25, 313],
- averageSize: [204800 / 25, 204800 / 313],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, 204800],
- count: [9, 313],
- averageSize: [51200 / 9, 204800 / 313],
- defined: [true, true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [153600, 122880],
- count: [15, 270],
- averageSize: [153600 / 15, 122880 / 270],
- defined: [true, true]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776, 819200],
- count: [10, 4],
- averageSize: [331776 / 10, 819200 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [undefined, 819200],
- count: [undefined, 4],
- averageSize: [undefined, 819200 / 4],
- defined: [false, true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1024000, 1024000],
- count: [176, 500],
- averageSize: [1024000 / 176, 1024000 / 500],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800, 614400],
- count: [100, 123],
- averageSize: [716800 / 100, 614400 / 123],
- defined: [true, true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600, 122880],
- count: [15, 270],
- averageSize: [153600 / 15, 122880 / 270],
- defined: [true, true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'MissingParent',
- size: [10, undefined],
- count: [2, undefined],
- averageSize: [10 / 2, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [10, undefined],
- count: [2, undefined],
- averageSize: [10 / 2, undefined],
- defined: [true, false]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2404352, 2621440],
- count: [399, 199],
- averageSize: [2404352 / 399, 2621440 / 199],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [2404352, 2621440],
- count: [399, 199],
- averageSize: [2404352 / 399, 2621440 / 199],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [307200, undefined],
- count: [300, undefined],
- averageSize: [307200 / 300, undefined],
- defined: [true, false],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [15360, undefined],
- count: [5, undefined],
- averageSize: [15360 / 5, undefined],
- defined: [true, false]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152, 2516582],
- count: [99, 158],
- averageSize: [2097152 / 99, 2516582 / 158],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152, undefined],
- count: [99, undefined],
- averageSize: [2097152 / 99, undefined],
- defined: [true, false]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [20480, 20480],
- count: [6, 4],
- averageSize: [20480 / 6, 20480 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360, undefined],
- count: [5, undefined],
- averageSize: [15360 / 5, undefined],
- defined: [true, false]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'WTF::StringImpl',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [20480, 20480],
- count: [6, 4],
- averageSize: [20480 / 6, 20480 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [20480, 20480],
- count: [6, 4],
- averageSize: [20480 / 6, 20480 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360, undefined],
- count: [5, undefined],
- averageSize: [15360 / 5, undefined],
- defined: [true, false]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'WTF::StringImpl',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1048576, 1127219],
- count: [200, 504],
- averageSize: [1048576 / 200, 1127219 / 504],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1024000, 1024000],
- count: [176, 500],
- averageSize: [1024000 / 176, 1024000 / 500],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800, 614400],
- count: [100, 123],
- averageSize: [716800 / 100, 614400 / 123],
- defined: [true, true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600, 122880],
- count: [15, 270],
- averageSize: [153600 / 15, 122880 / 270],
- defined: [true, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [20480, 20480],
- count: [6, 4],
- averageSize: [20480 / 6, 20480 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [20480, 20480],
- count: [6, 4],
- averageSize: [20480 / 6, 20480 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360, undefined],
- count: [5, undefined],
- averageSize: [15360 / 5, undefined],
- defined: [true, false]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776, 819200],
- count: [10, 4],
- averageSize: [331776 / 10, 819200 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [331776, 819200],
- count: [10, 4],
- averageSize: [331776 / 10, 819200 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [undefined, 819200],
- count: [undefined, 4],
- averageSize: [undefined, 819200 / 4],
- defined: [false, true]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'WTF::StringImpl',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [3811338, 4792320],
- count: [700, 799],
- averageSize: [3811338 / 700, 4792320 / 799],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [409600, 393216],
- count: [330, 17],
- averageSize: [409600 / 330, 393216 / 17],
- defined: [true, true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [15360, undefined],
- count: [5, undefined],
- averageSize: [15360 / 5, undefined],
- defined: [true, false]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [3145728, 4089446],
- count: [200, 428],
- averageSize: [3145728 / 200, 4089446 / 428],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152, undefined],
- count: [99, undefined],
- averageSize: [2097152 / 99, undefined],
- defined: [true, false]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [716800, 614400],
- count: [100, 123],
- averageSize: [716800 / 100, 614400 / 123],
- defined: [true, true]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [undefined, 819200],
- count: [undefined, 4],
- averageSize: [undefined, 819200 / 4],
- defined: [false, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [204800, 204800],
- count: [25, 313],
- averageSize: [204800 / 25, 204800 / 313],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, 204800],
- count: [9, 313],
- averageSize: [51200 / 9, 204800 / 313],
- defined: [true, true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [153600, 122880],
- count: [15, 270],
- averageSize: [153600 / 15, 122880 / 270],
- defined: [true, true]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776, 819200],
- count: [10, 4],
- averageSize: [331776 / 10, 819200 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [undefined, 819200],
- count: [undefined, 4],
- averageSize: [undefined, 819200 / 4],
- defined: [false, true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1044480, 1044480],
- count: [182, 504],
- averageSize: [1044480 / 182, 1044480 / 504],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360, undefined],
- count: [5, undefined],
- averageSize: [15360 / 5, undefined],
- defined: [true, false]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800, 614400],
- count: [100, 123],
- averageSize: [716800 / 100, 614400 / 123],
- defined: [true, true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600, 122880],
- count: [15, 270],
- averageSize: [153600 / 15, 122880 / 270],
- defined: [true, true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'WTF::StringImpl',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [409600, 524288],
- count: [330, 33],
- averageSize: [409600 / 330, 524288 / 33],
- defined: [true, true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [15360, 131072],
- count: [5, 16],
- averageSize: [15360 / 5, 131072 / 16],
- defined: [true, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [3452928, 4194304],
- count: [500, 469],
- averageSize: [3452928 / 500, 4194304 / 469],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [2404352, 2621440],
- count: [399, 199],
- averageSize: [2404352 / 399, 2621440 / 199],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [307200, undefined],
- count: [300, undefined],
- averageSize: [307200 / 300, undefined],
- defined: [true, false],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [15360, undefined],
- count: [5, undefined],
- averageSize: [15360 / 5, undefined],
- defined: [true, false]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152, 2516582],
- count: [99, 158],
- averageSize: [2097152 / 99, 2516582 / 158],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152, undefined],
- count: [99, undefined],
- averageSize: [2097152 / 99, undefined],
- defined: [true, false]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [20480, 20480],
- count: [6, 4],
- averageSize: [20480 / 6, 20480 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360, undefined],
- count: [5, undefined],
- averageSize: [15360 / 5, undefined],
- defined: [true, false]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'WTF::StringImpl',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152, undefined],
- count: [99, undefined],
- averageSize: [2097152 / 99, undefined],
- defined: [true, false]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [737280, 634880],
- count: [106, 127],
- averageSize: [737280 / 106, 634880 / 127],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [20480, 20480],
- count: [6, 4],
- averageSize: [20480 / 6, 20480 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360, undefined],
- count: [5, undefined],
- averageSize: [15360 / 5, undefined],
- defined: [true, false]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [undefined, 819200],
- count: [undefined, 4],
- averageSize: [undefined, 819200 / 4],
- defined: [false, true]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'WTF::StringImpl',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'MissingParent',
- size: [10, undefined],
- count: [2, undefined],
- averageSize: [10 / 2, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [10, undefined],
- count: [2, undefined],
- averageSize: [10 / 2, undefined],
- defined: [true, false]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1048576, 1258291],
- count: [200, 520],
- averageSize: [1048576 / 200, 1258291 / 520],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [1048576, 1127219],
- count: [200, 504],
- averageSize: [1048576 / 200, 1127219 / 504],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1024000, 1024000],
- count: [176, 500],
- averageSize: [1024000 / 176, 1024000 / 500],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800, 614400],
- count: [100, 123],
- averageSize: [716800 / 100, 614400 / 123],
- defined: [true, true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600, 122880],
- count: [15, 270],
- averageSize: [153600 / 15, 122880 / 270],
- defined: [true, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [20480, 20480],
- count: [6, 4],
- averageSize: [20480 / 6, 20480 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [20480, 20480],
- count: [6, 4],
- averageSize: [20480 / 6, 20480 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360, undefined],
- count: [5, undefined],
- averageSize: [15360 / 5, undefined],
- defined: [true, false]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1044480, 1044480],
- count: [182, 504],
- averageSize: [1044480 / 182, 1044480 / 504],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360, undefined],
- count: [5, undefined],
- averageSize: [15360 / 5, undefined],
- defined: [true, false]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800, 614400],
- count: [100, 123],
- averageSize: [716800 / 100, 614400 / 123],
- defined: [true, true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600, 122880],
- count: [15, 270],
- averageSize: [153600 / 15, 122880 / 270],
- defined: [true, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360, 131072],
- count: [5, 16],
- averageSize: [15360 / 5, 131072 / 16],
- defined: [true, true]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [737280, 634880],
- count: [106, 127],
- averageSize: [737280 / 106, 634880 / 127],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [20480, 20480],
- count: [6, 4],
- averageSize: [20480 / 6, 20480 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360, undefined],
- count: [5, undefined],
- averageSize: [15360 / 5, undefined],
- defined: [true, false]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776, 1048576],
- count: [10, 5],
- averageSize: [331776 / 10, 1048576 / 5],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [331776, 819200],
- count: [10, 4],
- averageSize: [331776 / 10, 819200 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [331776, 819200],
- count: [10, 4],
- averageSize: [331776 / 10, 819200 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [undefined, 819200],
- count: [undefined, 4],
- averageSize: [undefined, 819200 / 4],
- defined: [false, true]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [331776, 819200],
- count: [10, 4],
- averageSize: [331776 / 10, 819200 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [undefined, 819200],
- count: [undefined, 4],
- averageSize: [undefined, 819200 / 4],
- defined: [false, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [undefined, 819200],
- count: [undefined, 4],
- averageSize: [undefined, 819200 / 4],
- defined: [false, true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'MissingSumOverAllTypes',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [51200, undefined],
- count: [9, undefined],
- averageSize: [51200 / 9, undefined],
- defined: [true, false]
- }
- ]
- }
- ]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'WTF::StringImpl',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true]
- }
- ]
- }
- ]
- }
- ]
- }
- ]);
-
- changeView(viewEl, TOP_DOWN_TREE_VIEW);
- checkTable(viewEl,
- {
- expectedAggregationMode: AggregationMode.DIFF,
- expectedCountColumns: true
- },
- [
- {
- dimension: ROOT,
- title: 'partition_alloc',
- size: [4194304, 4954521],
- count: [1000, 900],
- averageSize: [4194304 / 1000, 4954521 / 900],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [4194304, 4823449],
- count: [1000, 884],
- averageSize: [4194304 / 1000, 4823449 / 884],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1406976, 2170880],
- count: [299, 600],
- averageSize: [1406976 / 299, 2170880 / 600],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [102400, 393216],
- count: [30, 17],
- averageSize: [102400 / 30, 393216 / 17],
- defined: [true, true]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [1048576, 1572864],
- count: [101, 270],
- averageSize: [1048576 / 101, 1572864 / 270],
- defined: [true, true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [716800, 614400],
- count: [100, 123],
- averageSize: [716800 / 100, 614400 / 123],
- defined: [true, true]
- },
- {
- dimension: OBJECT_TYPE,
- title: '<other>',
- size: [331776, 139264],
- count: [1, 143],
- averageSize: [331776 / 1, 139264 / 143],
- defined: [true, true]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [undefined, 819200],
- count: [undefined, 4],
- averageSize: [undefined, 819200 / 4],
- defined: [false, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [204800, 204800],
- count: [25, 313],
- averageSize: [204800 / 25, 204800 / 313],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [undefined, 204800],
- count: [undefined, 313],
- averageSize: [undefined, 204800 / 313],
- defined: [false, true]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [153600, 122880],
- count: [15, 270],
- averageSize: [153600 / 15, 122880 / 270],
- defined: [true, true]
- },
- {
- dimension: OBJECT_TYPE,
- title: '<other>',
- size: [51200, 81920],
- count: [10, 43],
- averageSize: [51200 / 10, 81920 / 43],
- defined: [true, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [51200, undefined],
- count: [143, undefined],
- averageSize: [51200 / 143, undefined],
- defined: [true, false]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776, 819200],
- count: [10, 4],
- averageSize: [331776 / 10, 819200 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [undefined, 819200],
- count: [undefined, 4],
- averageSize: [undefined, 819200 / 4],
- defined: [false, true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1024000, 1024000],
- count: [176, 500],
- averageSize: [1024000 / 176, 1024000 / 500],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800, 614400],
- count: [100, 123],
- averageSize: [716800 / 100, 614400 / 123],
- defined: [true, true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600, 122880],
- count: [15, 270],
- averageSize: [153600 / 15, 122880 / 270],
- defined: [true, true]
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [153600, 286720],
- count: [61, 107],
- averageSize: [153600 / 61, 286720 / 107],
- defined: [true, true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: '<other>',
- size: [51200, 327680],
- count: [113, 96],
- averageSize: [51200 / 113, 327680 / 96],
- defined: [true, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2404352, 2621440],
- count: [399, 199],
- averageSize: [2404352 / 399, 2621440 / 199],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [2404352, 2621440],
- count: [399, 199],
- averageSize: [2404352 / 399, 2621440 / 199],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [307200, undefined],
- count: [300, undefined],
- averageSize: [307200 / 300, undefined],
- defined: [true, false],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [15360, undefined],
- count: [5, undefined],
- averageSize: [15360 / 5, undefined],
- defined: [true, false]
- },
- {
- dimension: OBJECT_TYPE,
- title: '<other>',
- size: [291840, undefined],
- count: [295, undefined],
- averageSize: [291840 / 295, undefined],
- defined: [true, false]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152, 2516582],
- count: [99, 158],
- averageSize: [2097152 / 99, 2516582 / 158],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [2097152, undefined],
- count: [99, undefined],
- averageSize: [2097152 / 99, undefined],
- defined: [true, false]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [undefined, 104858],
- count: [undefined, 41],
- averageSize: [undefined, 104858 / 41],
- defined: [false, true]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [20480, 20480],
- count: [6, 4],
- averageSize: [20480 / 6, 20480 / 4],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [15360, undefined],
- count: [5, undefined],
- averageSize: [15360 / 5, undefined],
- defined: [true, false]
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [5120, undefined],
- count: [1, undefined],
- averageSize: [5120 / 1, undefined],
- defined: [true, false]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: '<other>',
- size: [2383872, 2474598],
- count: [393, 139],
- averageSize: [2383872 / 393, 2474598 / 139],
- defined: [true, true]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'WTF::StringImpl',
- size: [undefined, 126362],
- count: [undefined, 56],
- averageSize: [undefined, 126362 / 56],
- defined: [false, true]
- }
- ]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [382976, 31129],
- count: [302, 85],
- averageSize: [382976 / 302, 31129 / 85],
- defined: [true, true]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1048576, 1127219],
- count: [200, 504],
- averageSize: [1048576 / 200, 1127219 / 504],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1024000, 1024000],
- count: [176, 500],
- averageSize: [1024000 / 176, 1024000 / 500],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800, 614400],
- count: [100, 123],
- averageSize: [716800 / 100, 614400 / 123],
- defined: [true, true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600, 122880],
- count: [15, 270],
- averageSize: [153600 / 15, 122880 / 270],
- defined: [true, true]
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [153600, 286720],
- count: [61, 107],
- averageSize: [153600 / 61, 286720 / 107],
- defined: [true, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [24576, 103219],
- count: [24, 4],
- averageSize: [24576 / 24, 103219 / 4],
- defined: [true, true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: '<other>',
- size: [3145728, 3696230],
- count: [800, 380],
- averageSize: [3145728 / 800, 3696230 / 380],
- defined: [true, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [undefined, 131072],
- count: [undefined, 16],
- averageSize: [undefined, 131072 / 16],
- defined: [false, true],
- children: [
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [undefined, 131072],
- count: [undefined, 16],
- averageSize: [undefined, 131072 / 16],
- defined: [false, true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'v8::Context',
- size: [1048576, 1258291],
- count: [200, 520],
- averageSize: [1048576 / 200, 1258291 / 520],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'MessageLoop::RunTask',
- size: [1048576, 1127219],
- count: [200, 504],
- averageSize: [1048576 / 200, 1127219 / 504],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [1024000, 1024000],
- count: [176, 500],
- averageSize: [1024000 / 176, 1024000 / 500],
- defined: [true, true],
- children: [
- {
- dimension: STACK_FRAME,
- title: 'V8.Execute',
- size: [716800, 614400],
- count: [100, 123],
- averageSize: [716800 / 100, 614400 / 123],
- defined: [true, true]
- },
- {
- dimension: STACK_FRAME,
- title: 'FunctionCall',
- size: [153600, 122880],
- count: [15, 270],
- averageSize: [153600 / 15, 122880 / 270],
- defined: [true, true]
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [153600, 286720],
- count: [61, 107],
- averageSize: [153600 / 61, 286720 / 107],
- defined: [true, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<other>',
- size: [24576, 103219],
- count: [24, 4],
- averageSize: [24576 / 24, 103219 / 4],
- defined: [true, true]
- }
- ]
- },
- {
- dimension: STACK_FRAME,
- title: '<self>',
- size: [undefined, 131072],
- count: [undefined, 16],
- averageSize: [undefined, 131072 / 16],
- defined: [false, true]
- }
- ]
- },
- {
- dimension: OBJECT_TYPE,
- title: 'blink::Node',
- size: [331776, 1048576],
- count: [10, 5],
- averageSize: [331776 / 10, 1048576 / 5],
- defined: [true, true]
- },
- {
- dimension: OBJECT_TYPE,
- title: '<other>',
- size: [2813952, 2647654],
- count: [790, 375],
- averageSize: [2813952 / 790, 2647654 / 375],
- defined: [true, true]
- }
- ]
- }
- ]);
- });
-
- test('instantiate_multipleMax', function() {
- var heapDumps = createHeapDumps(false);
-
- var viewEl = tr.ui.analysis.createTestPane(
- 'tr-ui-a-memory-dump-heap-details-pane');
- viewEl.heapDumps = heapDumps;
- viewEl.aggregationMode = AggregationMode.MAX;
- viewEl.rebuild();
- this.addHTMLOutput(viewEl);
-
- changeView(viewEl, TOP_DOWN_HEAVY_VIEW);
- checkTable(viewEl,
- {
- expectedAggregationMode: AggregationMode.MAX,
- expectedInfoBarDisplayed: true
- },
- [
- {
- dimension: ROOT,
- title: 'partition_alloc',
- size: [4194304, 4954521],
- defined: [true, true],
- children: 9 // No need to check the full structure again.
- }
- ]);
- });
-
- test('instantiate_multipleWithUndefined', function() {
- var heapDumps = createHeapDumps(false);
- heapDumps.splice(1, 0, undefined);
-
- var viewEl = tr.ui.analysis.createTestPane(
- 'tr-ui-a-memory-dump-heap-details-pane');
- viewEl.heapDumps = heapDumps;
- viewEl.aggregationMode = AggregationMode.DIFF;
- viewEl.rebuild();
- this.addHTMLOutput(viewEl);
-
- // Top-down tree view (default).
- checkTable(viewEl,
- { expectedAggregationMode: AggregationMode.DIFF },
- [
- {
- dimension: ROOT,
- title: 'partition_alloc',
- size: [4194304, undefined, 4954521],
- defined: [true, false, true],
- children: 5 // No need to check the full structure again.
- }
- ]);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_overview_pane.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_overview_pane.html
deleted file mode 100644
index 9f2152d1106..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_overview_pane.html
+++ /dev/null
@@ -1,757 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/memory_allocator_dump.html">
-<link rel="import"
- href="/tracing/ui/analysis/memory_dump_allocator_details_pane.html">
-<link rel="import" href="/tracing/ui/analysis/memory_dump_sub_view_util.html">
-<link rel="import"
- href="/tracing/ui/analysis/memory_dump_vm_regions_details_pane.html">
-<link rel="import" href="/tracing/ui/analysis/stacked_pane.html">
-<link rel="import" href="/tracing/ui/base/color_legend.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/ui/view_specific_brushing_state.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/unit_scale.html">
-
-<polymer-element name="tr-ui-a-memory-dump-overview-pane"
- extends="tr-ui-a-stacked-pane">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
-
- #label {
- flex: 0 0 auto;
- padding: 8px;
-
- background-color: #eee;
- border-bottom: 1px solid #8e8e8e;
- border-top: 1px solid white;
-
- font-size: 15px;
- font-weight: bold;
- }
-
- #contents {
- flex: 1 0 auto;
- align-self: stretch;
- font-size: 12px;
- }
-
- #info_text {
- padding: 8px;
- color: #666;
- font-style: italic;
- text-align: center;
- }
-
- #table {
- display: none; /* Hide until memory dumps are set. */
- flex: 1 0 auto;
- align-self: stretch;
- }
- </style>
- <tr-ui-b-view-specific-brushing-state id="state"
- view-id="analysis.memory_dump_overview_pane">
- </tr-ui-b-view-specific-brushing-state>
- <div id="label">Overview</div>
- <div id="contents">
- <div id="info_text">No memory memory dumps selected</div>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </div>
- </template>
-</polymer-element>
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.analysis', function() {
-
- var ColorScheme = tr.b.ColorScheme;
- var ScalarNumeric = tr.v.ScalarNumeric;
- var sizeInBytes_smallerIsBetter =
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
-
- var PLATFORM_SPECIFIC_TOTAL_NAME_SUFFIX = '_bytes';
-
- var DISPLAYED_SIZE_NUMERIC_NAME =
- tr.model.MemoryAllocatorDump.DISPLAYED_SIZE_NUMERIC_NAME;
- var SOME_TIMESTAMPS_INFO_QUANTIFIER =
- tr.ui.analysis.MemoryColumn.SOME_TIMESTAMPS_INFO_QUANTIFIER;
-
- // Unicode symbols used for memory cell info icons and messages.
- var RIGHTWARDS_ARROW_WITH_HOOK = String.fromCharCode(0x21AA);
- var RIGHTWARDS_ARROW_FROM_BAR = String.fromCharCode(0x21A6);
- var GREATER_THAN_OR_EQUAL_TO = String.fromCharCode(0x2265);
- var UNMARRIED_PARTNERSHIP_SYMBOL = String.fromCharCode(0x26AF);
- var TRIGRAM_FOR_HEAVEN = String.fromCharCode(0x2630);
-
- // TODO(petrcermak): Move this to iteration_helpers.html.
- function lazyMap(list, fn, opt_this) {
- opt_this = opt_this || this;
- var result = undefined;
- list.forEach(function(item, index) {
- var value = fn.call(opt_this, item, index);
- if (value === undefined)
- return;
- if (result === undefined)
- result = new Array(list.length);
- result[index] = value;
- });
- return result;
- }
-
- /** @constructor */
- function ProcessNameColumn() {
- tr.ui.analysis.TitleColumn.call(this, 'Process');
- }
-
- ProcessNameColumn.prototype = {
- __proto__: tr.ui.analysis.TitleColumn.prototype,
-
- formatTitle: function(row) {
- if (row.contexts === undefined)
- return row.title; // Total row.
- var titleEl = document.createElement('tr-ui-b-color-legend');
- titleEl.label = row.title;
- return titleEl;
- }
- };
-
- /** @constructor */
- function UsedMemoryColumn(name, cellPath, aggregationMode) {
- tr.ui.analysis.NumericMemoryColumn.call(
- this, name, cellPath, aggregationMode);
- }
-
- UsedMemoryColumn.COLOR =
- ColorScheme.getColorForReservedNameAsString('used_memory_column');
- UsedMemoryColumn.OLDER_COLOR =
- ColorScheme.getColorForReservedNameAsString('older_used_memory_column');
-
- UsedMemoryColumn.prototype = {
- __proto__: tr.ui.analysis.NumericMemoryColumn.prototype,
-
- get title() {
- return tr.ui.b.createSpan({
- textContent: this.name,
- color: UsedMemoryColumn.COLOR
- });
- },
-
- getFormattingContext: function(unit) {
- return { unitPrefix: tr.v.UnitScale.Binary.MEBI };
- },
-
- color: function(numerics, processMemoryDumps) {
- return UsedMemoryColumn.COLOR;
- },
-
- getChildPaneBuilder: function(processMemoryDumps) {
- if (processMemoryDumps === undefined)
- return undefined;
-
- var vmRegions = lazyMap(processMemoryDumps, function(pmd) {
- if (pmd === undefined)
- return undefined;
- return pmd.mostRecentVmRegions;
- });
- if (vmRegions === undefined)
- return undefined;
-
- return function() {
- var pane = document.createElement(
- 'tr-ui-a-memory-dump-vm-regions-details-pane');
- pane.vmRegions = vmRegions;
- pane.aggregationMode = this.aggregationMode;
- return pane;
- }.bind(this);
- }
- };
-
- /** @constructor */
- function PeakMemoryColumn(name, cellPath, aggregationMode) {
- UsedMemoryColumn.call(this, name, cellPath, aggregationMode);
- }
-
- PeakMemoryColumn.prototype = {
- __proto__: UsedMemoryColumn.prototype,
-
- addInfos: function(numerics, processMemoryDumps, infos) {
- if (processMemoryDumps === undefined)
- return; // Total row.
-
- var resettableValueCount = 0;
- var nonResettableValueCount = 0;
- for (var i = 0; i < numerics.length; i++) {
- if (numerics[i] === undefined)
- continue;
- if (processMemoryDumps[i].arePeakResidentBytesResettable)
- resettableValueCount++;
- else
- nonResettableValueCount++;
- }
-
- if (resettableValueCount > 0 && nonResettableValueCount > 0) {
- infos.push(tr.ui.analysis.createWarningInfo('Both resettable and ' +
- 'non-resettable peak RSS values were provided by the process'));
- } else if (resettableValueCount > 0) {
- infos.push({
- icon: RIGHTWARDS_ARROW_WITH_HOOK,
- message: 'Peak RSS since previous memory dump.'
- });
- } else {
- infos.push({
- icon: RIGHTWARDS_ARROW_FROM_BAR,
- message: 'Peak RSS since process startup. Finer grained ' +
- 'peaks require a Linux kernel version ' +
- GREATER_THAN_OR_EQUAL_TO + ' 4.0.'
- });
- }
- }
- };
-
- /** @constructor */
- function ByteStatColumn(name, cellPath, aggregationMode) {
- UsedMemoryColumn.call(this, name, cellPath, aggregationMode);
- }
-
- ByteStatColumn.prototype = {
- __proto__: UsedMemoryColumn.prototype,
-
- color: function(numerics, processMemoryDumps) {
- if (processMemoryDumps === undefined)
- return UsedMemoryColumn.COLOR; // Total row.
-
- var allOlderValues = processMemoryDumps.every(
- function(processMemoryDump) {
- if (processMemoryDump === undefined)
- return true;
- return !processMemoryDump.hasOwnVmRegions;
- });
-
- // Show the cell in lighter blue if all values were older (i.e. none of
- // the defined process memory dumps had own VM regions).
- if (allOlderValues)
- return UsedMemoryColumn.OLDER_COLOR;
- else
- return UsedMemoryColumn.COLOR;
- },
-
- addInfos: function(numerics, processMemoryDumps, infos) {
- if (processMemoryDumps === undefined)
- return; // Total row.
-
- var olderValueCount = 0;
- for (var i = 0; i < numerics.length; i++) {
- var processMemoryDump = processMemoryDumps[i];
- if (processMemoryDump !== undefined &&
- !processMemoryDump.hasOwnVmRegions) {
- olderValueCount++;
- }
- }
-
- if (olderValueCount === 0)
- return; // There are no older values.
-
- var infoQuantifier = olderValueCount < numerics.length ?
- ' ' + SOME_TIMESTAMPS_INFO_QUANTIFIER /* some values are older */ :
- '' /* all values are older */;
-
- // Emit an info if there was at least one older value (i.e. at least one
- // defined process memory dump did not have own VM regions).
- infos.push({
- message: 'Older value' + infoQuantifier +
- ' (only heavy (purple) memory dumps contain memory maps).',
- icon: UNMARRIED_PARTNERSHIP_SYMBOL
- });
- }
- };
-
- // Rules for constructing and sorting used memory columns.
- UsedMemoryColumn.RULES = [
- {
- condition: 'Total resident',
- importance: 10,
- columnConstructor: UsedMemoryColumn
- },
- {
- condition: 'Peak total resident',
- importance: 9,
- columnConstructor: PeakMemoryColumn
- },
- {
- condition: 'PSS',
- importance: 8,
- columnConstructor: ByteStatColumn
- },
- {
- condition: 'Private dirty',
- importance: 7,
- columnConstructor: ByteStatColumn
- },
- {
- condition: 'Swapped',
- importance: 6,
- columnConstructor: ByteStatColumn
- },
- {
- // All other columns.
- importance: 0,
- columnConstructor: UsedMemoryColumn
- }
- ];
-
- // Map from ProcessMemoryDump totals fields to column names.
- UsedMemoryColumn.TOTALS_MAP = {
- 'residentBytes': 'Total resident',
- 'peakResidentBytes': 'Peak total resident'
- };
-
- // Map from VMRegionByteStats field names to column names.
- UsedMemoryColumn.BYTE_STAT_MAP = {
- 'proportionalResident': 'PSS',
- 'privateDirtyResident': 'Private dirty',
- 'swapped': 'Swapped'
- };
-
- /** @constructor */
- function AllocatorColumn(name, cellPath, aggregationMode) {
- tr.ui.analysis.NumericMemoryColumn.call(
- this, name, cellPath, aggregationMode);
- }
-
- AllocatorColumn.prototype = {
- __proto__: tr.ui.analysis.NumericMemoryColumn.prototype,
-
- get title() {
- var titleEl = document.createElement('tr-ui-b-color-legend');
- titleEl.label = this.name;
- return titleEl;
- },
-
- getFormattingContext: function(unit) {
- return { unitPrefix: tr.v.UnitScale.Binary.MEBI };
- },
-
- addInfos: function(numerics, processMemoryDumps, infos) {
- if (processMemoryDumps === undefined)
- return;
-
- var heapDumpCount = 0;
- var missingSizeCount = 0;
-
- for (var i = 0; i < processMemoryDumps.length; i++) {
- var processMemoryDump = processMemoryDumps[i];
- if (processMemoryDump === undefined)
- continue;
-
- var heapDumps = processMemoryDump.heapDumps;
- if (heapDumps !== undefined && heapDumps[this.name] !== undefined)
- heapDumpCount++;
- var allocatorDump =
- processMemoryDump.getMemoryAllocatorDumpByFullName(this.name);
-
- if (allocatorDump !== undefined &&
- allocatorDump.numerics[DISPLAYED_SIZE_NUMERIC_NAME] === undefined) {
- missingSizeCount++;
- }
- }
-
- // Emit a heap dump info if at least one of the process memory dumps has
- // a heap dump associated with this allocator.
- if (heapDumpCount > 0) {
- var infoQuantifier = heapDumpCount < numerics.length ?
- ' ' + SOME_TIMESTAMPS_INFO_QUANTIFIER : '';
- infos.push({
- message: 'Heap dump provided' + infoQuantifier + '.',
- icon: TRIGRAM_FOR_HEAVEN
- });
- }
-
- // Emit a warning if this allocator did not provide size in at least one
- // of the process memory dumps.
- if (missingSizeCount > 0) {
- var infoQuantifier = missingSizeCount < numerics.length ?
- ' ' + SOME_TIMESTAMPS_INFO_QUANTIFIER : '';
- infos.push(tr.ui.analysis.createWarningInfo(
- 'Size was not provided' + infoQuantifier + '.'));
- }
- },
-
- getChildPaneBuilder: function(processMemoryDumps) {
- if (processMemoryDumps === undefined)
- return undefined;
-
- var memoryAllocatorDumps = lazyMap(processMemoryDumps, function(pmd) {
- if (pmd === undefined)
- return undefined;
- return pmd.getMemoryAllocatorDumpByFullName(this.name);
- }, this);
- if (memoryAllocatorDumps === undefined)
- return undefined;
-
- var heapDumps = lazyMap(processMemoryDumps, function(pmd) {
- if (pmd === undefined || pmd.heapDumps === undefined)
- return undefined;
- return pmd.heapDumps[this.name];
- }, this);
-
- return function() {
- var pane = document.createElement(
- 'tr-ui-a-memory-dump-allocator-details-pane');
- pane.memoryAllocatorDumps = memoryAllocatorDumps;
- pane.heapDumps = heapDumps;
- pane.aggregationMode = this.aggregationMode;
- return pane;
- }.bind(this);
- }
- };
-
- /** @constructor */
- function TracingColumn(name, cellPath, aggregationMode) {
- AllocatorColumn.call(this, name, cellPath, aggregationMode);
- }
-
- TracingColumn.COLOR =
- ColorScheme.getColorForReservedNameAsString('tracing_memory_column');
-
- TracingColumn.prototype = {
- __proto__: AllocatorColumn.prototype,
-
- get title() {
- return tr.ui.b.createSpan({
- textContent: this.name,
- color: TracingColumn.COLOR
- });
- },
-
- color: function(numerics, processMemoryDumps) {
- return TracingColumn.COLOR;
- }
- };
-
- // Rules for constructing and sorting allocator columns.
- AllocatorColumn.RULES = [
- {
- condition: 'tracing',
- importance: 0,
- columnConstructor: TracingColumn
- },
- {
- // All other columns.
- importance: 1,
- columnConstructor: AllocatorColumn
- }
- ];
-
- Polymer('tr-ui-a-memory-dump-overview-pane', {
- created: function() {
- this.processMemoryDumps_ = undefined;
- this.aggregationMode_ = undefined;
- },
-
- ready: function() {
- this.$.table.selectionMode = tr.ui.b.TableFormat.SelectionMode.CELL;
- this.$.table.addEventListener('selection-changed',
- function(tableEvent) {
- tableEvent.stopPropagation();
- this.changeChildPane_();
- }.bind(this));
- },
-
- /**
- * Sets the process memory dumps and schedules rebuilding the pane.
- *
- * The provided value should be a chronological list of dictionaries
- * mapping process IDs to process memory dumps. Example:
- *
- * [
- * {
- * // PMDs at timestamp 1.
- * 42: tr.model.ProcessMemoryDump {}
- * },
- * {
- * // PMDs at timestamp 2.
- * 42: tr.model.ProcessMemoryDump {},
- * 89: tr.model.ProcessMemoryDump {}
- * }
- * ]
- */
- set processMemoryDumps(processMemoryDumps) {
- this.processMemoryDumps_ = processMemoryDumps;
- this.scheduleRebuildPane_();
- },
-
- get processMemoryDumps() {
- return this.processMemoryDumps_;
- },
-
- set aggregationMode(aggregationMode) {
- this.aggregationMode_ = aggregationMode;
- this.scheduleRebuildPane_();
- },
-
- get aggregationMode() {
- return this.aggregationMode_;
- },
-
- get selectedMemoryCell() {
- if (this.processMemoryDumps_ === undefined ||
- this.processMemoryDumps_.length === 0) {
- return undefined;
- }
-
- var selectedTableRow = this.$.table.selectedTableRow;
- if (!selectedTableRow)
- return undefined;
-
- var selectedColumnIndex = this.$.table.selectedColumnIndex;
- if (selectedColumnIndex === undefined)
- return undefined;
-
- var selectedColumn = this.$.table.tableColumns[selectedColumnIndex];
- var selectedMemoryCell = selectedColumn.cell(selectedTableRow);
- return selectedMemoryCell;
- },
-
- changeChildPane_: function() {
- this.storeSelection_();
- this.childPaneBuilder = this.determineChildPaneBuilderFromSelection_();
- },
-
- determineChildPaneBuilderFromSelection_: function() {
- if (this.processMemoryDumps_ === undefined ||
- this.processMemoryDumps_.length === 0) {
- return undefined;
- }
-
- var selectedTableRow = this.$.table.selectedTableRow;
- if (!selectedTableRow)
- return undefined;
-
- var selectedColumnIndex = this.$.table.selectedColumnIndex;
- if (selectedColumnIndex === undefined)
- return undefined;
- var selectedColumn = this.$.table.tableColumns[selectedColumnIndex];
-
- return selectedColumn.getChildPaneBuilder(selectedTableRow.contexts);
- },
-
- rebuildPane_: function() {
- if (this.processMemoryDumps_ === undefined ||
- this.processMemoryDumps_.length === 0) {
- // Show the info text (hide the table).
- this.$.info_text.style.display = 'block';
- this.$.table.style.display = 'none';
-
- this.$.table.clear();
- this.$.table.rebuild();
- return;
- }
-
- // Show the table (hide the info text).
- this.$.info_text.style.display = 'none';
- this.$.table.style.display = 'block';
-
- var rows = this.createRows_();
- var columns = this.createColumns_(rows);
- var footerRows = this.createFooterRows_(rows, columns);
-
- this.$.table.tableRows = rows;
- this.$.table.footerRows = footerRows;
- this.$.table.tableColumns = columns;
- this.$.table.rebuild();
-
- this.restoreSelection_();
- },
-
- createRows_: function() {
- // Timestamp (list index) -> Process ID (dict key) -> PMD.
- var timeToPidToProcessMemoryDump = this.processMemoryDumps_;
-
- // Process ID (dict key) -> Timestamp (list index) -> PMD or undefined.
- var pidToTimeToProcessMemoryDump = tr.b.invertArrayOfDicts(
- timeToPidToProcessMemoryDump);
-
- // Process (list index) -> Component (dict key) -> Cell.
- return tr.b.dictionaryValues(tr.b.mapItems(
- pidToTimeToProcessMemoryDump, function(pid, timeToDump) {
- // Get the process associated with the dumps. We can use any defined
- // process memory dump in timeToDump since they all have the same pid.
- var process = tr.b.findFirstInArray(timeToDump).process;
-
- // Used memory (total resident, PSS, ...).
- var usedMemoryCells = tr.ui.analysis.createCells(timeToDump,
- function(dump) {
- var sizes = {};
-
- var totals = dump.totals;
- if (totals !== undefined) {
- // Common totals.
- tr.b.iterItems(UsedMemoryColumn.TOTALS_MAP,
- function(totalName, cellName) {
- var total = totals[totalName];
- if (total === undefined)
- return;
- sizes[cellName] = new ScalarNumeric(
- sizeInBytes_smallerIsBetter, total);
- });
-
- // Platform-specific totals (e.g. private resident on Mac).
- var platformSpecific = totals.platformSpecific;
- if (platformSpecific !== undefined) {
- tr.b.iterItems(platformSpecific, function(name, size) {
- // Change raw OS-specific total name to a user-friendly
- // column title (e.g. 'private_bytes' -> 'Private').
- if (name.endsWith(PLATFORM_SPECIFIC_TOTAL_NAME_SUFFIX)) {
- name = name.substring(0, name.length -
- PLATFORM_SPECIFIC_TOTAL_NAME_SUFFIX.length);
- }
- name = name.replace('_', ' ').trim();
- name = name.charAt(0).toUpperCase() + name.slice(1);
- sizes[name] = new ScalarNumeric(
- sizeInBytes_smallerIsBetter, size);
- });
- }
- }
-
- // VM regions byte stats.
- var vmRegions = dump.mostRecentVmRegions;
- if (vmRegions !== undefined) {
- tr.b.iterItems(UsedMemoryColumn.BYTE_STAT_MAP,
- function(byteStatName, cellName) {
- var byteStat = vmRegions.byteStats[byteStatName];
- if (byteStat === undefined)
- return;
- sizes[cellName] = new ScalarNumeric(
- sizeInBytes_smallerIsBetter, byteStat);
- });
- }
-
- return sizes;
- });
-
- // Allocator memory (v8, oilpan, ...).
- var allocatorCells = tr.ui.analysis.createCells(timeToDump,
- function(dump) {
- var memoryAllocatorDumps = dump.memoryAllocatorDumps;
- if (memoryAllocatorDumps === undefined)
- return undefined;
- var sizes = {};
- memoryAllocatorDumps.forEach(function(allocatorDump) {
- var rootDisplayedSizeNumeric = allocatorDump.numerics[
- DISPLAYED_SIZE_NUMERIC_NAME];
- if (rootDisplayedSizeNumeric === undefined) {
- rootDisplayedSizeNumeric =
- new ScalarNumeric(sizeInBytes_smallerIsBetter, 0);
- }
- sizes[allocatorDump.fullName] = rootDisplayedSizeNumeric;
- });
- return sizes;
- });
-
- return {
- title: process.userFriendlyName,
- contexts: timeToDump,
- usedMemoryCells: usedMemoryCells,
- allocatorCells: allocatorCells
- };
- }));
- },
-
- createFooterRows_: function(rows, columns) {
- // Add a 'Total' row if there are at least two process memory dumps.
- if (rows.length <= 1)
- return [];
-
- var totalRow = {title: 'Total'};
- tr.ui.analysis.aggregateTableRowCells(totalRow, rows, columns);
-
- return [totalRow];
- },
-
- createColumns_: function(rows) {
- var titleColumn = new ProcessNameColumn();
- titleColumn.width = '200px';
-
- var usedMemorySizeColumns = tr.ui.analysis.MemoryColumn.fromRows(
- rows, 'usedMemoryCells', this.aggregationMode_,
- UsedMemoryColumn.RULES);
-
- var allocatorSizeColumns = tr.ui.analysis.MemoryColumn.fromRows(
- rows, 'allocatorCells', this.aggregationMode_,
- AllocatorColumn.RULES);
-
- var sizeColumns = usedMemorySizeColumns.concat(allocatorSizeColumns);
- tr.ui.analysis.MemoryColumn.spaceEqually(sizeColumns);
-
- var columns = [titleColumn].concat(sizeColumns);
- return columns;
- },
-
- storeSelection_: function() {
- var selectedRowTitle;
- var selectedRow = this.$.table.selectedTableRow;
- if (selectedRow !== undefined)
- selectedRowTitle = selectedRow.title;
-
- var selectedColumnName;
- var selectedColumnIndex = this.$.table.selectedColumnIndex;
- if (selectedColumnIndex !== undefined) {
- var selectedColumn = this.$.table.tableColumns[selectedColumnIndex];
- selectedColumnName = selectedColumn.name;
- }
-
- this.$.state.set(
- {rowTitle: selectedRowTitle, columnName: selectedColumnName});
- },
-
- restoreSelection_: function() {
- var settings = this.$.state.get();
- if (settings === undefined || settings.rowTitle === undefined ||
- settings.columnName === undefined)
- return;
-
- var selectedColumnName = settings.columnName;
- var selectedColumnIndex = tr.b.findFirstIndexInArray(
- this.$.table.tableColumns, function(column) {
- return column.name === selectedColumnName;
- });
- if (selectedColumnIndex < 0)
- return;
-
- var selectedRowTitle = settings.rowTitle;
- var selectedRow = tr.b.findFirstInArray(this.$.table.tableRows,
- function(row) {
- return row.title === selectedRowTitle;
- });
- if (selectedRow === undefined)
- return;
-
- this.$.table.selectedTableRow = selectedRow;
- this.$.table.selectedColumnIndex = selectedColumnIndex;
- }
- });
-
- return {
- // All exports are for testing only.
- ProcessNameColumn: ProcessNameColumn,
- UsedMemoryColumn: UsedMemoryColumn,
- PeakMemoryColumn: PeakMemoryColumn,
- ByteStatColumn: ByteStatColumn,
- AllocatorColumn: AllocatorColumn,
- TracingColumn: TracingColumn
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_overview_pane_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_overview_pane_test.html
deleted file mode 100644
index bb377bba241..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_overview_pane_test.html
+++ /dev/null
@@ -1,812 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/heap_dump.html">
-<link rel="import" href="/tracing/model/memory_allocator_dump.html">
-<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
-<link rel="import" href="/tracing/ui/analysis/memory_dump_overview_pane.html">
-<link rel="import"
- href="/tracing/ui/analysis/memory_dump_sub_view_test_utils.html">
-<link rel="import" href="/tracing/ui/analysis/memory_dump_sub_view_util.html">
-<link rel="import" href="/tracing/ui/brushing_state_controller.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ScalarNumeric = tr.v.ScalarNumeric;
- var sizeInBytes_smallerIsBetter =
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
- var MemoryAllocatorDump = tr.model.MemoryAllocatorDump;
- var HeapDump = tr.model.HeapDump;
- var AggregationMode = tr.ui.analysis.MemoryColumn.AggregationMode;
- var checkSizeNumericFields = tr.ui.analysis.checkSizeNumericFields;
- var checkColor = tr.ui.analysis.checkColor;
- var checkColumns = tr.ui.analysis.checkColumns;
- var checkColumnInfosAndColor = tr.ui.analysis.checkColumnInfosAndColor;
- var convertToProcessMemoryDumps = tr.ui.analysis.convertToProcessMemoryDumps;
- var extractProcessMemoryDumps = tr.ui.analysis.extractProcessMemoryDumps;
- var extractVmRegions = tr.ui.analysis.extractVmRegions;
- var extractMemoryAllocatorDumps = tr.ui.analysis.extractMemoryAllocatorDumps;
- var isElementDisplayed = tr.ui.analysis.isElementDisplayed;
- var addProcessMemoryDump = tr.model.MemoryDumpTestUtils.addProcessMemoryDump;
- var addGlobalMemoryDump = tr.model.MemoryDumpTestUtils.addGlobalMemoryDump;
- var ProcessNameColumn = tr.ui.analysis.ProcessNameColumn;
- var UsedMemoryColumn = tr.ui.analysis.UsedMemoryColumn;
- var PeakMemoryColumn = tr.ui.analysis.PeakMemoryColumn;
- var ByteStatColumn = tr.ui.analysis.ByteStatColumn;
- var AllocatorColumn = tr.ui.analysis.AllocatorColumn;
- var TracingColumn = tr.ui.analysis.TracingColumn;
-
- function spanMatcher(expectedTitle) {
- return function(actualTitle) {
- assert.instanceOf(actualTitle, HTMLElement);
- assert.strictEqual(actualTitle.tagName, 'SPAN');
- assert.strictEqual(actualTitle.textContent, expectedTitle);
- };
- }
-
- function colorLegendMatcher(expectedTitle) {
- return function(actualTitle) {
- assert.instanceOf(actualTitle, HTMLElement);
- assert.strictEqual(actualTitle.tagName, 'TR-UI-B-COLOR-LEGEND');
- assert.strictEqual(actualTitle.label, expectedTitle);
- };
- }
-
- var EXPECTED_COLUMNS = [
- { title: 'Process', type: ProcessNameColumn, noAggregation: true },
- { title: spanMatcher('Total resident'), type: UsedMemoryColumn },
- { title: spanMatcher('Peak total resident'), type: PeakMemoryColumn },
- { title: spanMatcher('PSS'), type: ByteStatColumn },
- { title: spanMatcher('Private dirty'), type: ByteStatColumn },
- { title: spanMatcher('Swapped'), type: ByteStatColumn },
- { title: spanMatcher('Private'), type: UsedMemoryColumn },
- { title: colorLegendMatcher('blink'), type: AllocatorColumn },
- { title: colorLegendMatcher('gpu'), type: AllocatorColumn },
- { title: colorLegendMatcher('malloc'), type: AllocatorColumn },
- { title: colorLegendMatcher('oilpan'), type: AllocatorColumn },
- { title: colorLegendMatcher('v8'), type: AllocatorColumn },
- { title: spanMatcher('tracing'), type: TracingColumn }
- ];
-
- function checkRow(columns, row, expectedTitle, expectedSizes,
- expectedContexts) {
- // Check title.
- var formattedTitle = columns[0].formatTitle(row);
- if (typeof expectedTitle === 'function')
- expectedTitle(formattedTitle);
- else
- assert.strictEqual(formattedTitle, expectedTitle);
-
- // Check all sizes. The first assert below is a test sanity check.
- assert.lengthOf(expectedSizes, columns.length - 1 /* all except title */);
- for (var i = 0; i < expectedSizes.length; i++)
- checkSizeNumericFields(row, columns[i + 1], expectedSizes[i]);
-
- // There should be no row nesting on the overview pane.
- assert.isUndefined(row.subRows);
-
- if (expectedContexts)
- assert.deepEqual(tr.b.asArray(row.contexts), expectedContexts);
- else
- assert.isUndefined(row.contexts);
- }
-
- function checkRows(columns, actualRows, expectedRows) {
- if (expectedRows === undefined) {
- assert.isUndefined(actualRows);
- return;
- }
- assert.lengthOf(actualRows, expectedRows.length);
- for (var i = 0; i < expectedRows.length; i++) {
- var actualRow = actualRows[i];
- var expectedRow = expectedRows[i];
- checkRow(columns, actualRow, expectedRow.title, expectedRow.sizes,
- expectedRow.contexts);
- }
- }
-
- function checkSpanWithColor(span, expectedText, expectedColorReservedName) {
- assert.strictEqual(span.tagName, 'SPAN');
- assert.strictEqual(span.textContent, expectedText);
- checkColor(span.style.color, expectedColorReservedName);
- }
-
- function checkColorLegend(legend, expectedLabel) {
- assert.strictEqual(legend.tagName, 'TR-UI-B-COLOR-LEGEND');
- assert.strictEqual(legend.label, expectedLabel);
- }
-
- function createAndCheckMemoryDumpOverviewPane(
- test, processMemoryDumps, expectedRows, expectedFooterRows,
- aggregationMode) {
- var viewEl =
- tr.ui.analysis.createTestPane('tr-ui-a-memory-dump-overview-pane');
- viewEl.processMemoryDumps = processMemoryDumps;
- viewEl.aggregationMode = aggregationMode;
- viewEl.rebuild();
- test.addHTMLOutput(viewEl);
-
- // Check that the table is shown.
- assert.isTrue(isElementDisplayed(viewEl.$.table));
- assert.isFalse(isElementDisplayed(viewEl.$.info_text));
-
- assert.isUndefined(viewEl.createChildPane());
-
- var table = viewEl.$.table;
- var columns = table.tableColumns;
- checkColumns(columns, EXPECTED_COLUMNS, aggregationMode);
- var rows = table.tableRows;
-
- checkRows(columns, table.tableRows, expectedRows);
- checkRows(columns, table.footerRows, expectedFooterRows);
- }
-
- var FIELD = 1 << 0;
- var DUMP = 1 << 1;
-
- function checkOverviewColumnInfosAndColor(column, fieldAndDumpMask,
- dumpCreatedCallback, expectedInfos, expectedColorReservedName) {
- var fields = fieldAndDumpMask.map(function(mask, index) {
- return mask & FIELD ?
- new ScalarNumeric(sizeInBytes_smallerIsBetter, 1024 + 32 * index) :
- undefined;
- });
-
- var contexts;
- if (dumpCreatedCallback === undefined) {
- contexts = undefined;
- } else {
- tr.c.TestUtils.newModel(function(model) {
- var process = model.getOrCreateProcess(1);
- fieldAndDumpMask.forEach(function(mask, i) {
- var timestamp = 10 + i;
- var gmd = addGlobalMemoryDump(model, timestamp);
- if (mask & DUMP) {
- var pmd = addProcessMemoryDump(gmd, process, timestamp);
- dumpCreatedCallback(pmd, mask);
- }
- });
- contexts = model.globalMemoryDumps.map(function(gmd) {
- return gmd.processMemoryDumps[1];
- });
- });
- }
-
- checkColumnInfosAndColor(
- column, fields, contexts, expectedInfos, expectedColorReservedName);
- }
-
- test('instantiate_empty', function() {
- tr.ui.analysis.createAndCheckEmptyPanes(this,
- 'tr-ui-a-memory-dump-overview-pane', 'processMemoryDumps',
- function(viewEl) {
- // Check that the info text is shown.
- assert.isTrue(isElementDisplayed(viewEl.$.info_text));
- assert.isFalse(isElementDisplayed(viewEl.$.table));
- });
- });
-
- test('instantiate_singleGlobalMemoryDump', function() {
- var processMemoryDumps = convertToProcessMemoryDumps(
- [tr.ui.analysis.createSingleTestGlobalMemoryDump()]);
- createAndCheckMemoryDumpOverviewPane(this,
- processMemoryDumps,
- [ // Table rows.
- {
- title: colorLegendMatcher('Process 1'),
- sizes: [[29884416], undefined, [9437184], [5767168], undefined,
- undefined, undefined, undefined, [7340032], undefined,
- undefined, [2097152]],
- contexts: extractProcessMemoryDumps(processMemoryDumps, 1)
- },
- {
- title: colorLegendMatcher('Process 2'),
- sizes: [[17825792], [39845888], [18350080], [0], [32], [8912896],
- [7340032], [0], [1048576], [1], [5242880], [1572864]],
- contexts: extractProcessMemoryDumps(processMemoryDumps, 2)
- },
- {
- title: colorLegendMatcher('Process 4'),
- sizes: [undefined, [17825792], undefined, undefined, undefined,
- undefined, undefined, undefined, undefined, undefined,
- undefined, undefined],
- contexts: extractProcessMemoryDumps(processMemoryDumps, 4)
- }
- ],
- [ // Footer rows.
- {
- title: 'Total',
- sizes: [[47710208], [57671680], [27787264], [5767168], [32],
- [8912896], [7340032], [0], [8388608], [1], [5242880],
- [3670016]],
- contexts: undefined
- }
- ],
- undefined /* no aggregation */);
- });
-
- test('instantiate_multipleGlobalMemoryDumps', function() {
- var processMemoryDumps = convertToProcessMemoryDumps(
- tr.ui.analysis.createMultipleTestGlobalMemoryDumps());
- createAndCheckMemoryDumpOverviewPane(this,
- processMemoryDumps,
- [ // Table rows.
- {
- title: colorLegendMatcher('Process 1'),
- sizes: [[31457280, 29884416, undefined], undefined,
- [10485760, 9437184, undefined], [8388608, 5767168, undefined],
- undefined, undefined, undefined, undefined,
- [undefined, 7340032, undefined], undefined, undefined,
- [undefined, 2097152, undefined]],
- contexts: extractProcessMemoryDumps(processMemoryDumps, 1)
- },
- {
- title: colorLegendMatcher('Process 2'),
- sizes: [[19398656, 17825792, 15728640],
- [40370176, 39845888, 40894464], [18350080, 18350080, 18350080],
- [0, 0, -2621440], [32, 32, 64], [10485760, 8912896, 7340032],
- [undefined, 7340032, 6291456], [undefined, 0, 1048576],
- [2097152, 1048576, 786432], [undefined, 1, undefined],
- [5242880, 5242880, 5767168], [1048576, 1572864, 2097152]],
- contexts: extractProcessMemoryDumps(processMemoryDumps, 2)
- },
- {
- title: colorLegendMatcher('Process 3'),
- sizes: [undefined, undefined, undefined, undefined, undefined,
- undefined, undefined, undefined, undefined,
- [2147483648, undefined, 1073741824],
- [1073741824, undefined, 2147483648], undefined],
- contexts: extractProcessMemoryDumps(processMemoryDumps, 3)
- },
- {
- title: colorLegendMatcher('Process 4'),
- sizes: [undefined, [undefined, 17825792, 17825792], undefined,
- undefined, undefined, undefined, undefined, undefined,
- undefined, undefined, undefined, undefined],
- contexts: extractProcessMemoryDumps(processMemoryDumps, 4)
- }
- ],
- [ // Footer rows.
- {
- title: 'Total',
- sizes: [[50855936, 47710208, 15728640],
- [40370176, 57671680, 58720256], [28835840, 27787264, 18350080],
- [8388608, 5767168, -2621440], [32, 32, 64],
- [10485760, 8912896, 7340032], [undefined, 7340032, 6291456],
- [undefined, 0, 1048576], [2097152, 8388608, 786432],
- [2147483648, 1, 1073741824], [1078984704, 5242880, 2153250816],
- [1048576, 3670016, 2097152]],
- contexts: undefined
- }
- ],
- AggregationMode.DIFF);
- });
-
- test('instantiate_singleProcessMemoryDump', function() {
- var processMemoryDumps = convertToProcessMemoryDumps(
- [tr.ui.analysis.createSingleTestProcessMemoryDump()]);
- createAndCheckMemoryDumpOverviewPane(this,
- processMemoryDumps,
- [ // Table rows.
- {
- title: colorLegendMatcher('Process 2'),
- sizes: [[17825792], [39845888], [18350080], [0], [32], [8912896],
- [7340032], [0], [1048576], [1], [5242880], [1572864]],
- contexts: extractProcessMemoryDumps(processMemoryDumps, 2)
- }
- ],
- [] /* footer rows */,
- undefined /* no aggregation */);
- });
-
- test('instantiate_multipleProcessMemoryDumps', function() {
- var processMemoryDumps = convertToProcessMemoryDumps(
- tr.ui.analysis.createMultipleTestProcessMemoryDumps());
- createAndCheckMemoryDumpOverviewPane(this,
- processMemoryDumps,
- [ // Table rows.
- {
- title: colorLegendMatcher('Process 2'),
- sizes: [[19398656, 17825792, 15728640],
- [40370176, 39845888, 40894464], [18350080, 18350080, 18350080],
- [0, 0, -2621440], [32, 32, 64], [10485760, 8912896, 7340032],
- [undefined, 7340032, 6291456], [undefined, 0, 1048576],
- [2097152, 1048576, 786432], [undefined, 1, undefined],
- [5242880, 5242880, 5767168], [1048576, 1572864, 2097152]],
- contexts: extractProcessMemoryDumps(processMemoryDumps, 2)
- }
- ],
- [] /* footer rows */,
- AggregationMode.MAX);
- });
-
- test('selection', function() {
- var processMemoryDumps = convertToProcessMemoryDumps(
- tr.ui.analysis.createMultipleTestGlobalMemoryDumps());
-
- var viewEl =
- tr.ui.analysis.createTestPane('tr-ui-a-memory-dump-overview-pane');
- viewEl.processMemoryDumps = processMemoryDumps;
- viewEl.aggregationMode = AggregationMode.DIFF;
- viewEl.rebuild();
- this.addHTMLOutput(viewEl);
-
- var table = viewEl.$.table;
-
- // Simulate clicking on the 'malloc' cell of the second process.
- table.selectedTableRow = table.tableRows[1];
- table.selectedColumnIndex = 9;
- assert.lengthOf(viewEl.requestedChildPanes, 2);
- var lastChildPane = viewEl.requestedChildPanes[1];
- assert.equal(
- lastChildPane.tagName, 'TR-UI-A-MEMORY-DUMP-ALLOCATOR-DETAILS-PANE');
- assert.strictEqual(lastChildPane.aggregationMode, AggregationMode.DIFF);
- assert.deepEqual(lastChildPane.memoryAllocatorDumps,
- extractMemoryAllocatorDumps(processMemoryDumps, 2, 'malloc'));
-
- // Simulate clicking on the 'Oilpan' cell of the second process.
- table.selectedColumnIndex = 10;
- assert.lengthOf(viewEl.requestedChildPanes, 3);
- var lastChildPane = viewEl.requestedChildPanes[2];
- assert.isUndefined(viewEl.lastChildPane);
- });
-
- test('memory', function() {
- var processMemoryDumps = convertToProcessMemoryDumps(
- tr.ui.analysis.createMultipleTestGlobalMemoryDumps());
- var containerEl = document.createElement('div');
- containerEl.brushingStateController =
- new tr.c.BrushingStateController(undefined);
-
- function simulateView(pids, aggregationMode,
- expectedSelectedCellFieldValues, expectedSelectedRowTitle,
- expectedSelectedColumnIndex, callback) {
- var viewEl =
- tr.ui.analysis.createTestPane('tr-ui-a-memory-dump-overview-pane');
- var table = viewEl.$.table;
- containerEl.textContent = '';
- containerEl.appendChild(viewEl);
-
- var displayedProcessMemoryDumps = processMemoryDumps.map(
- function(memoryDumps) {
- return tr.b.filterItems(memoryDumps, function(pid, pmd) {
- return pids.indexOf(pmd.process.pid) !== -1;
- });
- });
- viewEl.processMemoryDumps = displayedProcessMemoryDumps;
- viewEl.aggregationMode = aggregationMode;
- viewEl.rebuild();
-
- if (expectedSelectedCellFieldValues === undefined) {
- assert.isUndefined(viewEl.childPaneBuilder);
- } else {
- checkSizeNumericFields(table.selectedTableRow,
- table.tableColumns[table.selectedColumnIndex],
- expectedSelectedCellFieldValues);
- }
-
- assert.strictEqual(
- table.selectedColumnIndex, expectedSelectedColumnIndex);
- if (expectedSelectedRowTitle === undefined)
- assert.isUndefined(table.selectedTableRow);
- else
- assert.equal(table.selectedTableRow.title, expectedSelectedRowTitle);
-
- callback(viewEl, viewEl.$.table);
- }
-
- simulateView(
- [1, 2, 3, 4], // All processes.
- AggregationMode.DIFF,
- undefined, undefined, undefined, // No cell should be selected.
- function(view, table) {
- assert.isUndefined(view.createChildPane());
-
- // Select the 'PSS' column of the second process.
- table.selectedTableRow = table.tableRows[1];
- table.selectedColumnIndex = 3;
- });
-
- simulateView(
- [2, 3],
- AggregationMode.MAX,
- [18350080, 18350080, 18350080], 'Process 2', 3, /* PSS */
- function(view, table) {
- var childPane = view.createChildPane();
- assert.equal(
- childPane.tagName, 'TR-UI-A-MEMORY-DUMP-VM-REGIONS-DETAILS-PANE');
- assert.deepEqual(tr.b.asArray(childPane.vmRegions),
- extractVmRegions(processMemoryDumps, 2));
- assert.strictEqual(childPane.aggregationMode, AggregationMode.MAX);
- });
-
- simulateView(
- [3],
- undefined, /* No aggregation */
- undefined, undefined, undefined, // No cell selected.
- function(view, table) {
- assert.isUndefined(view.createChildPane());
- });
-
- simulateView(
- [1, 2, 3, 4],
- AggregationMode.DIFF,
- [18350080, 18350080, 18350080], 'Process 2', 3, /* PSS */
- function(view, table) {
- var childPane = view.createChildPane();
- assert.equal(
- childPane.tagName, 'TR-UI-A-MEMORY-DUMP-VM-REGIONS-DETAILS-PANE');
- assert.deepEqual(tr.b.asArray(childPane.vmRegions),
- extractVmRegions(processMemoryDumps, 2));
- assert.strictEqual(childPane.aggregationMode, AggregationMode.DIFF);
-
- // Select the 'v8' column of the first process (empty cell).
- table.selectedTableRow = table.tableRows[0];
- table.selectedColumnIndex = 10;
- });
-
- simulateView(
- [1],
- undefined, /* No aggregation */
- undefined, undefined, undefined, // No cell should selected.
- function(view, table) {
- assert.isUndefined(view.createChildPane());
-
- // Select 'Total resident' column of the first process.
- table.selectedTableRow = table.tableRows[0];
- table.selectedColumnIndex = 1;
- });
-
- simulateView(
- [1, 2, 3, 4],
- AggregationMode.MAX,
- [31457280, 29884416, undefined], 'Process 1', 1, /* Total resident */
- function(view, table) {
- var childPane = view.createChildPane();
- assert.equal(
- childPane.tagName, 'TR-UI-A-MEMORY-DUMP-VM-REGIONS-DETAILS-PANE');
- assert.deepEqual(tr.b.asArray(childPane.vmRegions),
- extractVmRegions(processMemoryDumps, 1));
- assert.strictEqual(childPane.aggregationMode, AggregationMode.MAX);
- });
- });
-
- test('processNameColumn_formatTitle', function() {
- var c = new ProcessNameColumn();
-
- // With context (total row).
- assert.strictEqual(c.formatTitle({
- title: 'Total',
- usedMemoryCells: {}
- }), 'Total');
-
- // Without context (process row).
- var title = c.formatTitle({
- title: 'Process 1',
- usedMemoryCells: {},
- contexts: [tr.ui.analysis.createSingleTestProcessMemoryDump()]
- });
- checkColorLegend(title, 'Process 1');
- });
-
- test('usedMemoryColumn', function() {
- var c = new UsedMemoryColumn('Private', 'bytes', tr.b.identity,
- AggregationMode.DIFF);
- checkSpanWithColor(c.title, 'Private',
- 'used_memory_column' /* blue (column title) */);
- checkColor(c.color(undefined /* contexts */),
- 'used_memory_column' /* blue (column cells) */);
- });
-
- test('peakMemoryColumn', function() {
- var c = new PeakMemoryColumn('Peak', 'bytes', tr.b.identity,
- AggregationMode.MAX);
- checkSpanWithColor(c.title, 'Peak',
- 'used_memory_column' /* blue (column title) */);
- checkColor(c.color(undefined) /* contexts */,
- 'used_memory_column' /* blue (column cells) */);
-
- var RESETTABLE_PEAK = 1 << 2;
- var NON_RESETTABLE_PEAK = 1 << 3;
- function checkPeakColumnInfosAndColor(fieldAndDumpMask, expectedInfos) {
- checkOverviewColumnInfosAndColor(c,
- fieldAndDumpMask,
- function(pmd, mask) {
- if (mask & RESETTABLE_PEAK) {
- assert.strictEqual(
- mask & NON_RESETTABLE_PEAK, 0); // Test sanity check.
- pmd.arePeakResidentBytesResettable = true;
- } else if (mask & NON_RESETTABLE_PEAK) {
- pmd.arePeakResidentBytesResettable = false;
- }
- },
- expectedInfos,
- 'used_memory_column');
- }
-
- // No context.
- checkOverviewColumnInfosAndColor(c,
- [FIELD],
- undefined /* no context */,
- [] /* no infos */,
- 'used_memory_column' /* blue color */);
- checkOverviewColumnInfosAndColor(c,
- [FIELD, FIELD, 0, FIELD],
- undefined /* no context */,
- [] /* no infos */,
- 'used_memory_column' /* blue color */);
-
- // All resettable.
- var EXPECTED_RESETTABLE_INFO = {
- icon: '\u21AA',
- message: 'Peak RSS since previous memory dump.'
- };
- checkPeakColumnInfosAndColor([
- FIELD | DUMP | RESETTABLE_PEAK
- ], [EXPECTED_RESETTABLE_INFO]);
- checkPeakColumnInfosAndColor([
- FIELD | DUMP | RESETTABLE_PEAK,
- DUMP /* ignored because there's no field */,
- 0,
- FIELD | DUMP | RESETTABLE_PEAK
- ], [EXPECTED_RESETTABLE_INFO]);
-
- // All non-resettable.
- var EXPECTED_NON_RESETTABLE_INFO = {
- icon: '\u21A6',
- message: 'Peak RSS since process startup. Finer grained peaks require ' +
- 'a Linux kernel version \u2265 4.0.'
- };
- checkPeakColumnInfosAndColor([
- FIELD | DUMP | NON_RESETTABLE_PEAK
- ], [EXPECTED_NON_RESETTABLE_INFO]);
- checkPeakColumnInfosAndColor([
- 0,
- DUMP | RESETTABLE_PEAK /* ignored because there's no field */,
- FIELD | DUMP | NON_RESETTABLE_PEAK,
- FIELD | DUMP | NON_RESETTABLE_PEAK
- ], [EXPECTED_NON_RESETTABLE_INFO]);
-
- // Combination (warning).
- var EXPECTED_COMBINATION_INFO = {
- icon: '\u26A0',
- message: 'Both resettable and non-resettable peak RSS values were ' +
- 'provided by the process',
- color: 'red'
- };
- checkPeakColumnInfosAndColor([
- FIELD | DUMP | NON_RESETTABLE_PEAK,
- 0,
- FIELD | DUMP | RESETTABLE_PEAK,
- 0
- ], [EXPECTED_COMBINATION_INFO]);
- });
-
- test('byteStatColumn', function() {
- var c = new ByteStatColumn('Stat', 'bytes', tr.b.identity,
- AggregationMode.DIFF);
- checkSpanWithColor(c.title, 'Stat',
- 'used_memory_column' /* blue (column title) */);
-
- var HAS_OWN_VM_REGIONS = 1 << 2;
- function checkByteStatColumnInfosAndColor(
- fieldAndDumpMask, expectedInfos, expectedIsOlderColor) {
- checkOverviewColumnInfosAndColor(c,
- fieldAndDumpMask,
- function(pmd, mask) {
- if (mask & HAS_OWN_VM_REGIONS)
- pmd.vmRegions = [];
- },
- expectedInfos,
- expectedIsOlderColor ?
- 'older_used_memory_column' /* light blue */ :
- 'used_memory_column' /* blue color */);
- }
-
- var EXPECTED_ALL_OLDER_VALUES = {
- icon: '\u26AF',
- message: 'Older value (only heavy (purple) memory dumps contain ' +
- 'memory maps).'
- };
- var EXPECTED_SOME_OLDER_VALUES = {
- icon: '\u26AF',
- message: 'Older value at some selected timestamps (only heavy ' +
- '(purple) memory dumps contain memory maps).'
- };
-
- // No context.
- checkOverviewColumnInfosAndColor(c,
- [FIELD],
- undefined /* no context */,
- [] /* no infos */,
- 'used_memory_column' /* blue color */);
- checkOverviewColumnInfosAndColor(c,
- [FIELD, FIELD, 0, FIELD],
- undefined /* no context */,
- [] /* no infos */,
- 'used_memory_column' /* blue color */);
-
- // All process memory dumps have own VM regions.
- checkByteStatColumnInfosAndColor([
- FIELD | DUMP | HAS_OWN_VM_REGIONS
- ], [] /* no infos */, false /* blue color */);
- checkByteStatColumnInfosAndColor([
- FIELD | DUMP | HAS_OWN_VM_REGIONS,
- FIELD | DUMP | HAS_OWN_VM_REGIONS,
- 0,
- FIELD | DUMP | HAS_OWN_VM_REGIONS
- ], [] /* no infos */, false /* blue color */);
-
- // No process memory dumps have own VM regions.
- checkByteStatColumnInfosAndColor([
- FIELD | DUMP
- ], [EXPECTED_ALL_OLDER_VALUES], true /* light blue */);
- checkByteStatColumnInfosAndColor([
- FIELD | DUMP,
- FIELD | DUMP
- ], [EXPECTED_ALL_OLDER_VALUES], true /* light blue */);
-
- // Some process memory dumps don't have own VM regions.
- checkByteStatColumnInfosAndColor([
- FIELD | DUMP,
- 0,
- FIELD | DUMP
- ], [EXPECTED_SOME_OLDER_VALUES], true /* light blue */);
- checkByteStatColumnInfosAndColor([
- FIELD | DUMP | HAS_OWN_VM_REGIONS,
- FIELD | DUMP,
- FIELD | DUMP | HAS_OWN_VM_REGIONS
- ], [EXPECTED_SOME_OLDER_VALUES], false /* blue */);
- });
-
- test('allocatorColumn', function() {
- var c = new AllocatorColumn('Allocator', 'bytes', tr.b.identity,
- AggregationMode.MAX);
- checkColorLegend(c.title, 'Allocator');
- checkColor(c.color(undefined /* contexts */),
- undefined /* no color (column cells) */);
-
- var HAS_HEAP_DUMPS = 1 << 2;
- var HAS_ALLOCATOR_HEAP_DUMP = 1 << 3;
- var MISSING_SIZE = 1 << 4;
- function checkAllocatorColumnInfosAndColor(fieldAndDumpMask,
- expectedInfos) {
- checkOverviewColumnInfosAndColor(c,
- fieldAndDumpMask,
- function(pmd, mask) {
- if (mask & HAS_HEAP_DUMPS)
- pmd.heapDumps = {};
- if (mask & HAS_ALLOCATOR_HEAP_DUMP)
- pmd.heapDumps['Allocator'] = new HeapDump(pmd, 'Allocator');
- var mad = new MemoryAllocatorDump(pmd, 'Allocator');
- if (!(mask & MISSING_SIZE)) {
- mad.addNumeric('size',
- new ScalarNumeric(sizeInBytes_smallerIsBetter, 7));
- }
- pmd.memoryAllocatorDumps = [mad];
- },
- expectedInfos,
- undefined /* no color */);
- }
-
- // No context.
- checkOverviewColumnInfosAndColor(c,
- [FIELD],
- undefined /* no context */,
- [] /* no infos */,
- undefined /* no color */);
- checkOverviewColumnInfosAndColor(c,
- [FIELD, FIELD, 0, FIELD],
- undefined /* no context */,
- [] /* no infos */,
- undefined /* no color */);
-
- // No infos.
- checkAllocatorColumnInfosAndColor([
- FIELD | DUMP
- ], [] /* no infos */);
- checkAllocatorColumnInfosAndColor([
- FIELD | DUMP,
- FIELD | DUMP | HAS_HEAP_DUMPS,
- 0,
- FIELD | DUMP
- ], [] /* infos */);
-
- var EXPECTED_ALL_HAVE_ALLOCATOR_HEAP_DUMP = {
- icon: '\u2630',
- message: 'Heap dump provided.'
- };
- var EXPECTED_SOME_HAVE_ALLOCATOR_HEAP_DUMP = {
- icon: '\u2630',
- message: 'Heap dump provided at some selected timestamps.'
- };
-
- // All process memory dumps have heap dumps.
- checkAllocatorColumnInfosAndColor([
- FIELD | DUMP | HAS_HEAP_DUMPS | HAS_ALLOCATOR_HEAP_DUMP
- ], [EXPECTED_ALL_HAVE_ALLOCATOR_HEAP_DUMP]);
- checkAllocatorColumnInfosAndColor([
- FIELD | DUMP | HAS_HEAP_DUMPS | HAS_ALLOCATOR_HEAP_DUMP,
- FIELD | DUMP | HAS_HEAP_DUMPS | HAS_ALLOCATOR_HEAP_DUMP,
- FIELD | DUMP | HAS_HEAP_DUMPS | HAS_ALLOCATOR_HEAP_DUMP
- ], [EXPECTED_ALL_HAVE_ALLOCATOR_HEAP_DUMP]);
-
- // Some process memory dumps have heap dumps.
- checkAllocatorColumnInfosAndColor([
- 0,
- FIELD | DUMP | HAS_HEAP_DUMPS | HAS_ALLOCATOR_HEAP_DUMP
- ], [EXPECTED_SOME_HAVE_ALLOCATOR_HEAP_DUMP]);
- checkAllocatorColumnInfosAndColor([
- FIELD | DUMP | HAS_HEAP_DUMPS | HAS_ALLOCATOR_HEAP_DUMP,
- FIELD | DUMP | HAS_HEAP_DUMPS,
- FIELD | DUMP | HAS_HEAP_DUMPS | HAS_ALLOCATOR_HEAP_DUMP
- ], [EXPECTED_SOME_HAVE_ALLOCATOR_HEAP_DUMP]);
-
- var EXPECTED_ALL_MISSING_SIZE = {
- icon: '\u26A0',
- message: 'Size was not provided.',
- color: 'red'
- };
- var EXPECTED_SOME_MISSING_SIZE = {
- icon: '\u26A0',
- message: 'Size was not provided at some selected timestamps.',
- color: 'red'
- };
-
- // All process memory dumps are missing allocator size.
- checkAllocatorColumnInfosAndColor([
- FIELD | DUMP | MISSING_SIZE
- ], [EXPECTED_ALL_MISSING_SIZE]);
- checkAllocatorColumnInfosAndColor([
- FIELD | DUMP | MISSING_SIZE,
- FIELD | DUMP | MISSING_SIZE,
- FIELD | DUMP | MISSING_SIZE
- ], [EXPECTED_ALL_MISSING_SIZE]);
-
- // Some process memory dumps use Android memtrack PSS fallback.
- checkAllocatorColumnInfosAndColor([
- 0,
- FIELD | DUMP | MISSING_SIZE
- ], [EXPECTED_SOME_MISSING_SIZE]);
- checkAllocatorColumnInfosAndColor([
- FIELD | DUMP | MISSING_SIZE,
- FIELD | DUMP,
- FIELD | DUMP | MISSING_SIZE
- ], [EXPECTED_SOME_MISSING_SIZE]);
-
- // Combination of heap dump and memtrack fallback infos.
- checkAllocatorColumnInfosAndColor([
- FIELD | DUMP | MISSING_SIZE | HAS_HEAP_DUMPS |
- HAS_ALLOCATOR_HEAP_DUMP
- ], [
- EXPECTED_ALL_HAVE_ALLOCATOR_HEAP_DUMP,
- EXPECTED_ALL_MISSING_SIZE
- ]);
- checkAllocatorColumnInfosAndColor([
- FIELD | DUMP | HAS_HEAP_DUMPS | HAS_ALLOCATOR_HEAP_DUMP,
- FIELD | DUMP,
- FIELD | DUMP | MISSING_SIZE
- ], [
- EXPECTED_SOME_HAVE_ALLOCATOR_HEAP_DUMP,
- EXPECTED_SOME_MISSING_SIZE
- ]);
- });
-
- test('tracingColumn', function() {
- var c = new TracingColumn('Tracing', 'bytes', tr.b.identity,
- AggregationMode.DIFF);
- checkSpanWithColor(c.title, 'Tracing',
- 'tracing_memory_column' /* expected column title gray color */);
- checkColor(c.color(undefined /* contexts */),
- 'tracing_memory_column' /* expected column cells gray color */);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_sub_view_test_utils.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_sub_view_test_utils.html
deleted file mode 100644
index 36235636c56..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_sub_view_test_utils.html
+++ /dev/null
@@ -1,570 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color.html">
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/global_memory_dump.html">
-<link rel="import" href="/tracing/model/heap_dump.html">
-<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
-<link rel="import" href="/tracing/model/process_memory_dump.html">
-<link rel="import" href="/tracing/model/vm_region.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Helper functions for memory dump analysis sub-view tests.
- */
-tr.exportTo('tr.ui.analysis', function() {
- var Color = tr.b.Color;
- var ColorScheme = tr.b.ColorScheme;
- var GlobalMemoryDump = tr.model.GlobalMemoryDump;
- var ProcessMemoryDump = tr.model.ProcessMemoryDump;
- var VMRegion = tr.model.VMRegion;
- var VMRegionClassificationNode = tr.model.VMRegionClassificationNode;
- var ScalarNumeric = tr.v.ScalarNumeric;
- var sizeInBytes_smallerIsBetter =
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
- var unitlessNumber_smallerIsBetter =
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter;
- var HeapDump = tr.model.HeapDump;
- var addGlobalMemoryDump = tr.model.MemoryDumpTestUtils.addGlobalMemoryDump;
- var addProcessMemoryDump = tr.model.MemoryDumpTestUtils.addProcessMemoryDump;
- var newAllocatorDump = tr.model.MemoryDumpTestUtils.newAllocatorDump;
- var addOwnershipLink = tr.model.MemoryDumpTestUtils.addOwnershipLink;
-
- function createMultipleTestGlobalMemoryDumps() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var pA = model.getOrCreateProcess(1);
- var pB = model.getOrCreateProcess(2);
- var pC = model.getOrCreateProcess(3);
- var pD = model.getOrCreateProcess(4);
-
- // ======================================================================
- // First timestamp.
- // ======================================================================
- var gmd1 = addGlobalMemoryDump(model, 42);
-
- // Totals and VM regions.
- var pmd1A = addProcessMemoryDump(gmd1, pA, 41);
- pmd1A.totals = { residentBytes: 31457280 /* 30 MiB */ };
- pmd1A.vmRegions = VMRegionClassificationNode.fromRegions([
- VMRegion.fromDict({
- startAddress: 1024,
- sizeInBytes: 20971520, /* 20 MiB */
- protectionFlags: VMRegion.PROTECTION_FLAG_READ,
- mappedFile: '[stack]',
- byteStats: {
- privateDirtyResident: 8388608, /* 8 MiB */
- sharedCleanResident: 12582912, /* 12 MiB */
- proportionalResident: 10485760 /* 10 MiB */
- }
- })
- ]);
-
- // Everything.
- var pmd1B = addProcessMemoryDump(gmd1, pB, 42);
- pmd1B.totals = {
- residentBytes: 20971520, /* 20 MiB */
- peakResidentBytes: 41943040, /* 40 MiB */
- arePeakResidentBytesResettable: false,
- platformSpecific: {
- private_bytes: 10485760 /* 10 MiB */
- }
- };
- pmd1B.vmRegions = VMRegionClassificationNode.fromRegions([
- VMRegion.fromDict({
- startAddress: 256,
- sizeInBytes: 6000,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_WRITE,
- mappedFile: '[stack:20310]',
- byteStats: {
- proportionalResident: 15728640, /* 15 MiB */
- privateDirtyResident: 1572864, /* 1.5 MiB */
- swapped: 32 /* 32 B */
- }
- }),
- VMRegion.fromDict({
- startAddress: 100000,
- sizeInBytes: 4096,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ,
- mappedFile: '/usr/lib/libwtf.so',
- byteStats: {
- proportionalResident: 4194304, /* 4 MiB */
- privateDirtyResident: 0,
- swapped: 0 /* 32 B */
- }
- })
- ]);
- pmd1B.memoryAllocatorDumps = [
- newAllocatorDump(pmd1B, 'malloc', { size: 3145728 /* 3 MiB */ }),
- newAllocatorDump(pmd1B, 'v8', { size: 5242880 /* 5 MiB */ }),
- newAllocatorDump(pmd1B, 'tracing', {
- size: 1048576 /* 1 MiB */,
- resident_size: 1572864 /* 1.5 MiB */
- })
- ];
-
- // Allocator dumps only.
- var pmd1C = addProcessMemoryDump(gmd1, pC, 43);
- pmd1C.memoryAllocatorDumps = (function() {
- var oilpanDump = newAllocatorDump(pmd1C, 'oilpan', {
- size: 3221225472 /* 3 GiB */,
- inner_size: 5242880 /* 5 MiB */,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 2015)
- });
- var v8Dump = newAllocatorDump(pmd1C, 'v8', {
- size: 1073741824 /* 1 GiB */,
- inner_size: 2097152 /* 2 MiB */,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 204)
- });
-
- addOwnershipLink(v8Dump, oilpanDump);
-
- return [oilpanDump, v8Dump];
- })();
- pmd1C.heapDumps = {
- 'v8': (function() {
- var v8HeapDump = new HeapDump(pmd1C, 'v8');
- v8HeapDump.addEntry(
- tr.c.TestUtils.newStackTrace(model,
- ['V8.Execute', 'UpdateLayoutTree']),
- undefined /* sum over all object types */,
- 536870912 /* 512 MiB */);
- return v8HeapDump;
- })()
- };
-
- // ======================================================================
- // Second timestamp.
- // ======================================================================
- var gmd2 = addGlobalMemoryDump(model, 68);
-
- // Everything.
- var pmd2A = addProcessMemoryDump(gmd2, pA, 67);
- pmd2A.totals = { residentBytes: 32505856 /* 31 MiB */ };
- pmd2A.vmRegions = VMRegionClassificationNode.fromRegions([
- VMRegion.fromDict({
- startAddress: 1024,
- sizeInBytes: 20971520, /* 20 MiB */
- protectionFlags: VMRegion.PROTECTION_FLAG_READ,
- mappedFile: '[stack]',
- byteStats: {
- privateDirtyResident: 8388608, /* 8 MiB */
- sharedCleanResident: 11534336, /* 11 MiB */
- proportionalResident: 11534336 /* 11 MiB */
- }
- }),
- VMRegion.fromDict({
- startAddress: 104857600,
- sizeInBytes: 5242880, /* 5 MiB */
- protectionFlags: VMRegion.PROTECTION_FLAG_EXECUTE,
- mappedFile: '/usr/bin/google-chrome',
- byteStats: {
- privateDirtyResident: 0,
- sharedCleanResident: 4194304, /* 4 MiB */
- proportionalResident: 524288 /* 512 KiB */
- }
- })
- ]);
- pmd2A.memoryAllocatorDumps = [
- newAllocatorDump(pmd2A, 'malloc', { size: 9437184 /* 9 MiB */ }),
- newAllocatorDump(pmd2A, 'tracing', {
- size: 2097152 /* 2 MiB */,
- resident_size: 2621440 /* 2.5 MiB */
- })
- ];
-
- // Totals and allocator dumps only.
- var pmd2B = addProcessMemoryDump(gmd2, pB, 69);
- pmd2B.totals = {
- residentBytes: 19922944, /* 19 MiB */
- peakResidentBytes: 41943040, /* 40 MiB */
- arePeakResidentBytesResettable: false,
- platformSpecific: {
- private_bytes: 8912896 /* 8.5 MiB */
- }
- };
- pmd2B.memoryAllocatorDumps = [
- newAllocatorDump(pmd2B, 'malloc', { size: 2621440 /* 2.5 MiB */ }),
- newAllocatorDump(pmd2B, 'v8', { size: 5242880 /* 5 MiB */ }),
- newAllocatorDump(pmd2B, 'blink', { size: 7340032 /* 7 MiB */ }),
- newAllocatorDump(pmd2B, 'oilpan', { size: 1 }),
- newAllocatorDump(pmd2B, 'tracing', {
- size: 1572864 /* 1.5 MiB */,
- resident_size: 2097152 /* 2 MiB */
- }),
- newAllocatorDump(pmd2B, 'gpu', { memtrack_pss: 524288 /* 512 KiB */ })
- ];
-
- // Resettable peak total size only.
- var pmd2D = addProcessMemoryDump(gmd2, pD, 71);
- pmd2D.totals = {
- peakResidentBytes: 17825792, /* 17 MiB */
- arePeakResidentBytesResettable: true
- };
-
- // ======================================================================
- // Third timestamp.
- // ======================================================================
- var gmd3 = addGlobalMemoryDump(model, 100);
-
- // Everything.
- var pmd3B = addProcessMemoryDump(gmd3, pB, 102);
- pmd3B.totals = {
- residentBytes: 18874368, /* 18 MiB */
- peakResidentBytes: 44040192, /* 42 MiB */
- arePeakResidentBytesResettable: false,
- platformSpecific: {
- private_bytes: 7340032 /* 7 MiB */
- }
- };
- pmd3B.vmRegions = VMRegionClassificationNode.fromRegions([
- VMRegion.fromDict({
- startAddress: 256,
- sizeInBytes: 6000,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_WRITE,
- mappedFile: '[stack:20310]',
- byteStats: {
- proportionalResident: 21495808, /* 20.5 MiB */
- privateDirtyResident: 524288, /* 0.5 MiB */
- swapped: 64 /* 32 B */
- }
- })
- ]);
- pmd3B.memoryAllocatorDumps = [
- newAllocatorDump(pmd3B, 'malloc', {size: 2883584 /* 2.75 MiB */ }),
- newAllocatorDump(pmd3B, 'v8', { size: 5767168 /* 5.5 MiB */ }),
- newAllocatorDump(pmd3B, 'blink', { size: 6291456 /* 7 MiB */ }),
- newAllocatorDump(pmd3B, 'tracing', {
- size: 2097152 /* 2 MiB */,
- resident_size: 3145728 /* 3 MiB */
- }),
- newAllocatorDump(pmd3C, 'gpu', {
- size: 1048576 /* 1 MiB */,
- memtrack_pss: 786432 /* 768 KiB */
- })
- ];
-
- // Allocator dumps only.
- var pmd3C = addProcessMemoryDump(gmd3, pC, 100);
- pmd3C.memoryAllocatorDumps = (function() {
- var oilpanDump = newAllocatorDump(pmd3C, 'oilpan', {
- size: 3221225472 /* 3 GiB */,
- inner_size: 5242880 /* 5 MiB */,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 2015)
- });
- var v8Dump = newAllocatorDump(pmd3C, 'v8', {
- size: 2147483648 /* 2 GiB */,
- inner_size: 2097152 /* 2 MiB */,
- objects_count: new ScalarNumeric(unitlessNumber_smallerIsBetter, 204)
- });
-
- addOwnershipLink(v8Dump, oilpanDump);
-
- return [oilpanDump, v8Dump];
- })();
- pmd3C.heapDumps = {
- 'v8': (function() {
- var v8HeapDump = new HeapDump(pmd1C, 'v8');
- v8HeapDump.addEntry(
- tr.c.TestUtils.newStackTrace(model,
- ['V8.Execute', 'UpdateLayoutTree']),
- undefined /* sum over all object types */,
- 268435456 /* 256 MiB */);
- v8HeapDump.addEntry(
- tr.c.TestUtils.newStackTrace(model,
- ['V8.Execute', 'FrameView::layout']),
- undefined /* sum over all object types */,
- 134217728 /* 128 MiB */);
- return v8HeapDump;
- })()
- };
-
- // Resettable peak total size only.
- var pmd3D = addProcessMemoryDump(gmd3, pD, 99);
- pmd3D.totals = {
- peakResidentBytes: 17825792, /* 17 MiB */
- arePeakResidentBytesResettable: true
- };
- });
-
- return model.globalMemoryDumps;
- }
-
- function createSingleTestGlobalMemoryDump() {
- return createMultipleTestGlobalMemoryDumps()[1];
- }
-
- function createMultipleTestProcessMemoryDumps() {
- return createMultipleTestGlobalMemoryDumps().map(function(gmd) {
- return gmd.processMemoryDumps[2];
- });
- }
-
- function createSingleTestProcessMemoryDump() {
- return createMultipleTestProcessMemoryDumps()[1];
- }
-
- function checkNumericFields(row, column, expectedValues, expectedUnit) {
- var fields;
- if (column === undefined)
- fields = row;
- else
- fields = column.fields(row);
-
- if (expectedValues === undefined) {
- assert.isUndefined(fields);
- return;
- }
-
- assert.lengthOf(fields, expectedValues.length);
- for (var i = 0; i < fields.length; i++) {
- var field = fields[i];
- var expectedValue = expectedValues[i];
- if (expectedValue === undefined) {
- assert.isUndefined(field);
- } else {
- assert.isDefined(expectedUnit); // Test sanity check.
- assert.instanceOf(field, ScalarNumeric);
- assert.equal(field.value, expectedValue);
- assert.equal(field.unit, expectedUnit);
- }
- }
- }
-
- function checkSizeNumericFields(row, column, expectedValues) {
- checkNumericFields(row, column, expectedValues,
- sizeInBytes_smallerIsBetter);
- }
-
- function checkStringFields(row, column, expectedStrings) {
- var fields = column.fields(row);
-
- if (expectedStrings === undefined) {
- assert.isUndefined(fields);
- return;
- }
-
- assert.deepEqual(tr.b.asArray(fields), expectedStrings);
- }
-
- /**
- * Check the titles, types and aggregation modes of a list of columns.
- * expectedColumns is a list of dictionaries with the following fields:
- *
- * - title: Either the expected title (string), or a matcher for it
- * (function that accepts the actual title as its argument).
- * - type: The expected class of the column.
- * - noAggregation: If true, the column is expected to have no aggregation
- * mode (regardless of expectedAggregationMode).
- */
- function checkColumns(columns, expectedColumns, expectedAggregationMode) {
- assert.lengthOf(columns, expectedColumns.length);
- for (var i = 0; i < expectedColumns.length; i++) {
- var actualColumn = columns[i];
- var expectedColumn = expectedColumns[i];
- var expectedTitle = expectedColumn.title;
- if (typeof expectedTitle === 'function')
- expectedTitle(actualColumn.title); // Custom title matcher.
- else
- assert.strictEqual(actualColumn.title, expectedTitle); // String title.
- assert.instanceOf(actualColumn, expectedColumn.type);
- assert.strictEqual(actualColumn.aggregationMode,
- expectedColumn.noAggregation ? undefined : expectedAggregationMode);
- }
- }
-
- function checkColumnInfosAndColor(
- column, fields, contexts, expectedInfos, expectedColorReservedName) {
- // Test sanity checks.
- assert.isDefined(fields);
- if (contexts !== undefined)
- assert.lengthOf(contexts, fields.length);
-
- // Check infos.
- var infos = [];
- column.addInfos(fields, contexts, infos);
- assert.lengthOf(infos, expectedInfos.length);
- for (var i = 0; i < expectedInfos.length; i++)
- assert.deepEqual(infos[i], expectedInfos[i]);
-
- // Check color.
- var actualColor = typeof column.color === 'function' ?
- column.color(fields, contexts) :
- column.color;
- checkColor(actualColor, expectedColorReservedName);
- }
-
- function checkColor(actualColorString, expectedColorReservedName) {
- if (expectedColorReservedName === undefined) {
- assert.isUndefined(actualColorString);
- return;
- }
-
- var actualColor = Color.fromString(actualColorString);
- var expectedColor = ColorScheme.colors[
- ColorScheme.getColorIdForReservedName(expectedColorReservedName)];
- assert.deepEqual(actualColor, expectedColor);
- }
-
- function createAndCheckEmptyPanes(
- test, paneTagName, propertyName, opt_callback) {
- // Unset property.
- var unsetViewEl = createTestPane(paneTagName);
- unsetViewEl.rebuild();
- assert.isUndefined(unsetViewEl.createChildPane());
- test.addHTMLOutput(unsetViewEl);
-
- // Undefined property.
- var undefinedViewEl = createTestPane(paneTagName);
- undefinedViewEl[propertyName] = undefined;
- undefinedViewEl.rebuild();
- assert.isUndefined(undefinedViewEl.createChildPane());
- test.addHTMLOutput(undefinedViewEl);
-
- // Empty property.
- var emptyViewEl = createTestPane(paneTagName);
- emptyViewEl[propertyName] = [];
- emptyViewEl.rebuild();
- assert.isUndefined(undefinedViewEl.createChildPane());
- test.addHTMLOutput(emptyViewEl);
-
- // Check that all the panes have the same dimensions.
- var unsetBounds = unsetViewEl.getBoundingClientRect();
- var undefinedBounds = undefinedViewEl.getBoundingClientRect();
- var emptyBounds = emptyViewEl.getBoundingClientRect();
- assert.equal(undefinedBounds.width, unsetBounds.width);
- assert.equal(emptyBounds.width, unsetBounds.width);
- assert.equal(undefinedBounds.height, unsetBounds.height);
- assert.equal(emptyBounds.height, unsetBounds.height);
-
- // Custom checks (if provided).
- if (opt_callback) {
- opt_callback(unsetViewEl);
- opt_callback(undefinedViewEl);
- opt_callback(emptyViewEl);
- }
- }
-
- function createTestPane(tagName) {
- var paneEl = document.createElement(tagName);
-
- // Store a list of requested child panes (for inspection in tests).
- paneEl.requestedChildPanes = [];
- paneEl.addEventListener('request-child-pane-change', function() {
- paneEl.requestedChildPanes.push(paneEl.createChildPane());
- });
-
- paneEl.createChildPane = function() {
- var childPaneBuilder = this.childPaneBuilder;
- if (childPaneBuilder === undefined)
- return undefined;
- return childPaneBuilder();
- };
-
- return paneEl;
- }
-
- // TODO(petrcermak): Consider moving this to tracing/ui/base/dom_helpers.html.
- function isElementDisplayed(element) {
- var style = getComputedStyle(element);
- var displayed = style['display'];
- if (displayed === undefined)
- return true;
- return displayed.indexOf('none') === -1;
- }
-
- /**
- * Convert a list of ContainerMemoryDump(s) to a list of dictionaries of the
- * underlying ProcessMemoryDump(s).
- */
- function convertToProcessMemoryDumps(containerMemoryDumps) {
- return containerMemoryDumps.map(function(containerMemoryDump) {
- return containerMemoryDump.processMemoryDumps;
- });
- }
-
- /**
- * Extract a chronological list of ProcessMemoryDump(s) (for a given process)
- * from a chronological list of dictionaries of ProcessMemoryDump(s).
- */
- function extractProcessMemoryDumps(processMemoryDumps, pid) {
- return processMemoryDumps.map(function(memoryDumps) {
- return memoryDumps[pid];
- });
- }
-
- /**
- * Extract a chronological list of lists of VMRegion(s) (for a given process)
- * from a chronological list of dictionaries of ProcessMemoryDump(s).
- */
- function extractVmRegions(processMemoryDumps, pid) {
- return processMemoryDumps.map(function(memoryDumps) {
- var processMemoryDump = memoryDumps[pid];
- if (processMemoryDump === undefined)
- return undefined;
- return processMemoryDump.mostRecentVmRegions;
- });
- }
-
- /**
- * Extract a chronological list of MemoryAllocatorDump(s) (for a given
- * process and allocator name) from a chronological list of dictionaries of
- * ProcessMemoryDump(s).
- */
- function extractMemoryAllocatorDumps(processMemoryDumps, pid, allocatorName) {
- return processMemoryDumps.map(function(memoryDumps) {
- var processMemoryDump = memoryDumps[pid];
- if (processMemoryDump === undefined)
- return undefined;
- return processMemoryDump.getMemoryAllocatorDumpByFullName(allocatorName);
- });
- }
-
- /**
- * Extract a chronological list of HeapDump(s) (for a given process and
- * allocator name) from a chronological list of dictionaries of
- * ProcessMemoryDump(s).
- */
- function extractHeapDumps(processMemoryDumps, pid, allocatorName) {
- return processMemoryDumps.map(function(memoryDumps) {
- var processMemoryDump = memoryDumps[pid];
- if (processMemoryDump === undefined ||
- processMemoryDump.heapDumps === undefined)
- return undefined;
- return processMemoryDump.heapDumps[allocatorName];
- });
- }
-
- return {
- createSingleTestGlobalMemoryDump: createSingleTestGlobalMemoryDump,
- createMultipleTestGlobalMemoryDumps: createMultipleTestGlobalMemoryDumps,
- createSingleTestProcessMemoryDump: createSingleTestProcessMemoryDump,
- createMultipleTestProcessMemoryDumps: createMultipleTestProcessMemoryDumps,
- checkNumericFields: checkNumericFields,
- checkSizeNumericFields: checkSizeNumericFields,
- checkStringFields: checkStringFields,
- checkColumns: checkColumns,
- checkColumnInfosAndColor: checkColumnInfosAndColor,
- checkColor: checkColor,
- createAndCheckEmptyPanes: createAndCheckEmptyPanes,
- createTestPane: createTestPane,
- isElementDisplayed: isElementDisplayed,
- convertToProcessMemoryDumps: convertToProcessMemoryDumps,
- extractProcessMemoryDumps: extractProcessMemoryDumps,
- extractVmRegions: extractVmRegions,
- extractMemoryAllocatorDumps: extractMemoryAllocatorDumps,
- extractHeapDumps: extractHeapDumps
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_sub_view_util.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_sub_view_util.html
deleted file mode 100644
index 74a38e81cda..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_sub_view_util.html
+++ /dev/null
@@ -1,889 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Helper code for memory dump sub-views.
- */
-tr.exportTo('tr.ui.analysis', function() {
-
- var NO_BREAK_SPACE = String.fromCharCode(160);
- var RIGHTWARDS_ARROW = String.fromCharCode(8594);
-
- var COLLATOR = new Intl.Collator(undefined, {numeric: true});
-
- /**
- * A table column for displaying memory dump row titles.
- *
- * @constructor
- */
- function TitleColumn(title) {
- this.title = title;
- }
-
- TitleColumn.prototype = {
- supportsCellSelection: false,
-
- /**
- * Get the title associated with a given row.
- *
- * This method will decorate the title with color and '+++'/'---' prefix if
- * appropriate (as determined by the optional row.contexts field).
- * Examples:
- *
- * +----------------------+-----------------+--------+--------+
- * | Contexts provided at | Interpretation | Prefix | Color |
- * +----------------------+-----------------+--------+--------+
- * | 1111111111 | always present | | |
- * | 0000111111 | added | +++ | red |
- * | 1111111000 | deleted | --- | green |
- * | 1100111111* | flaky | | purple |
- * | 0001001111 | added + flaky | +++ | purple |
- * | 1111100010 | deleted + flaky | --- | purple |
- * +----------------------+-----------------+--------+--------+
- *
- * *) This means that, given a selection of 10 memory dumps, a particular
- * row (e.g. a process) was present in the first 2 and last 6 of them
- * (but not in the third and fourth dump).
- *
- * This method should therefore NOT be overriden by subclasses. The
- * formatTitle method should be overriden instead when necessary.
- */
- value: function(row) {
- var formattedTitle = this.formatTitle(row);
-
- var contexts = row.contexts;
- if (contexts === undefined || contexts.length === 0)
- return formattedTitle;
-
- // Determine if the row was provided in the first and last row and how
- // many times it changed between being provided and not provided.
- var firstContext = contexts[0];
- var lastContext = contexts[contexts.length - 1];
- var changeDefinedContextCount = 0;
- for (var i = 1; i < contexts.length; i++) {
- if ((contexts[i] === undefined) !== (contexts[i - 1] === undefined))
- changeDefinedContextCount++;
- }
-
- // Determine the color and prefix of the title.
- var color = undefined;
- var prefix = undefined;
- if (!firstContext && lastContext) {
- // The row was added.
- color = 'red';
- prefix = '+++';
- } else if (firstContext && !lastContext) {
- // The row was removed.
- color = 'green';
- prefix = '---';
- }
- if (changeDefinedContextCount > 1) {
- // The row was flaky (added/removed more than once).
- color = 'purple';
- }
-
- if (color === undefined && prefix === undefined)
- return formattedTitle;
-
- var titleEl = document.createElement('span');
- if (prefix !== undefined) {
- var prefixEl = tr.ui.b.createSpan({textContent: prefix});
- // Enforce same width of '+++' and '---'.
- prefixEl.style.fontFamily = 'monospace';
- titleEl.appendChild(prefixEl);
- titleEl.appendChild(tr.ui.b.asHTMLOrTextNode(NO_BREAK_SPACE));
- }
- if (color !== undefined)
- titleEl.style.color = color;
- titleEl.appendChild(tr.ui.b.asHTMLOrTextNode(formattedTitle));
- return titleEl;
- },
-
- /**
- * Format the title associated with a given row. This method is intended to
- * be overriden by subclasses.
- */
- formatTitle: function(row) {
- return row.title;
- },
-
- cmp: function(rowA, rowB) {
- return COLLATOR.compare(rowA.title, rowB.title);
- }
- };
-
- /**
- * Abstract table column for displaying memory dump data.
- *
- * @constructor
- */
- function MemoryColumn(name, cellPath, aggregationMode) {
- this.name = name;
- this.cellPath = cellPath;
-
- // See MemoryColumn.AggregationMode enum in this file.
- this.aggregationMode = aggregationMode;
- }
-
- /**
- * Construct columns from cells in a hierarchy of rows and a list of rules.
- *
- * The list of rules contains objects with three fields:
- *
- * condition: Optional string or regular expression matched against the
- * name of a cell. If omitted, the rule will match any cell.
- * importance: Mandatory number which determines the final order of the
- * columns. The column with the highest importance will be first in the
- * returned array.
- * columnConstructor: Mandatory memory column constructor.
- *
- * Example:
- *
- * var importanceRules = [
- * {
- * condition: 'page_size',
- * columnConstructor: NumericMemoryColumn,
- * importance: 8
- * },
- * {
- * condition: /size/,
- * columnConstructor: CustomNumericMemoryColumn,
- * importance: 10
- * },
- * {
- * // No condition: matches all columns.
- * columnConstructor: NumericMemoryColumn,
- * importance: 9
- * }
- * ];
- *
- * Given a name of a cell, the corresponding column constructor and
- * importance are determined by the first rule whose condition matches the
- * column's name. For example, given a cell with name 'inner_size', the
- * corresponding column will be constructed using CustomNumericMemoryColumn
- * and its importance (for sorting purposes) will be 10 (second rule).
- *
- * After columns are constructed for all cell names, they are sorted in
- * descending order of importance and the resulting list is returned. In the
- * example above, the constructed columns will be sorted into three groups as
- * follows:
- *
- * [most important, left in the resulting table]
- * 1. columns whose name contains 'size' excluding 'page_size' because it
- * would have already matched the first rule (Note that string matches
- * must be exact so a column named 'page_size2' would not match the
- * first rule and would therefore belong to this group).
- * 2. columns whose name does not contain 'size'.
- * 3. columns whose name is 'page_size'.
- * [least important, right in the resulting table]
- *
- * where columns will be sorted alphabetically within each group.
- */
- MemoryColumn.fromRows = function(rows, cellKey, aggregationMode, rules) {
- // Recursively find the names of all cells of the rows (and their sub-rows).
- var cellNames = new Set();
- function gatherCellNames(rows) {
- rows.forEach(function(row) {
- if (row === undefined)
- return;
- var fieldCells = row[cellKey];
- if (fieldCells !== undefined) {
- tr.b.iterItems(fieldCells, function(fieldName, fieldCell) {
- if (fieldCell === undefined || fieldCell.fields === undefined)
- return;
- cellNames.add(fieldName);
- });
- }
- var subRows = row.subRows;
- if (subRows !== undefined)
- gatherCellNames(subRows);
- });
- }
- gatherCellNames(rows);
-
- // Based on the provided list of rules, construct the columns and calculate
- // their importance.
- var positions = [];
- cellNames.forEach(function(cellName) {
- var cellPath = [cellKey, cellName];
- var matchingRule = MemoryColumn.findMatchingRule(cellName, rules);
- var constructor = matchingRule.columnConstructor;
- var column = new constructor(cellName, cellPath, aggregationMode);
- positions.push({
- importance: matchingRule.importance,
- column: column
- });
- });
-
- positions.sort(function(a, b) {
- // Sort columns with the same importance alphabetically.
- if (a.importance === b.importance)
- return COLLATOR.compare(a.column.name, b.column.name);
-
- // Sort columns in descending order of importance.
- return b.importance - a.importance;
- });
-
- return positions.map(function(position) { return position.column });
- };
-
- MemoryColumn.spaceEqually = function(columns) {
- var columnWidth = (100 / columns.length).toFixed(3) + '%';
- columns.forEach(function(column) {
- column.width = columnWidth;
- });
- };
-
- MemoryColumn.findMatchingRule = function(name, rules) {
- for (var i = 0; i < rules.length; i++) {
- var rule = rules[i];
- if (MemoryColumn.nameMatchesCondition(name, rule.condition))
- return rule;
- }
- return undefined;
- };
-
- MemoryColumn.nameMatchesCondition = function(name, condition) {
- // Rules without conditions match all columns.
- if (condition === undefined)
- return true;
-
- // String conditions must match the column name exactly.
- if (typeof(condition) === 'string')
- return name === condition;
-
- // If the condition is not a string, assume it is a RegExp.
- return condition.test(name);
- };
-
- /** @enum */
- MemoryColumn.AggregationMode = {
- DIFF: 0,
- MAX: 1
- };
-
- MemoryColumn.SOME_TIMESTAMPS_INFO_QUANTIFIER = 'at some selected timestamps';
-
- MemoryColumn.prototype = {
- get title() {
- return this.name;
- },
-
- cell: function(row) {
- var cell = row;
- var cellPath = this.cellPath;
- for (var i = 0; i < cellPath.length; i++) {
- if (cell === undefined)
- return undefined;
- cell = cell[cellPath[i]];
- }
- return cell;
- },
-
- aggregateCells: function(row, subRows) {
- // No generic aggregation.
- },
-
- fields: function(row) {
- var cell = this.cell(row);
- if (cell === undefined)
- return undefined;
- return cell.fields;
- },
-
- /**
- * Format a cell associated with this column from the given row. This
- * method is not intended to be overriden.
- */
- value: function(row) {
- var fields = this.fields(row);
- if (this.hasAllRelevantFieldsUndefined(fields))
- return '';
-
- // Determine the color and infos of the resulting element.
- var contexts = row.contexts;
- var color = this.color(fields, contexts);
- var infos = [];
- this.addInfos(fields, contexts, infos);
-
- // Format the actual fields.
- var formattedFields = this.formatFields(fields);
-
- // If no color is specified and there are no infos, there is no need to
- // wrap the value in a span element.#
- if ((color === undefined || formattedFields === '') && infos.length === 0)
- return formattedFields;
-
- var fieldEl = document.createElement('span');
- fieldEl.style.display = 'flex';
- fieldEl.style.alignItems = 'center';
- fieldEl.style.justifyContent = 'flex-end';
- fieldEl.appendChild(tr.ui.b.asHTMLOrTextNode(formattedFields));
-
- // Add info icons with tooltips.
- infos.forEach(function(info) {
- var infoEl = document.createElement('span');
- infoEl.style.paddingLeft = '4px';
- infoEl.style.cursor = 'help';
- infoEl.style.fontWeight = 'bold';
- infoEl.textContent = info.icon;
- if (info.color !== undefined)
- infoEl.style.color = info.color;
- infoEl.title = info.message;
- fieldEl.appendChild(infoEl);
- }, this);
-
- // Set the color of the element.
- if (color !== undefined)
- fieldEl.style.color = color;
-
- return fieldEl;
- },
-
- /**
- * Returns true iff all fields of a row which are relevant for the current
- * aggregation mode (e.g. first and last field for diff mode) are undefined.
- */
- hasAllRelevantFieldsUndefined: function(fields) {
- if (fields === undefined)
- return true;
-
- switch (this.aggregationMode) {
- case MemoryColumn.AggregationMode.DIFF:
- // Only the first and last field are relevant.
- return fields[0] === undefined &&
- fields[fields.length - 1] === undefined;
-
- case MemoryColumn.AggregationMode.MAX:
- default:
- // All fields are relevant.
- return fields.every(function(field) { return field === undefined; });
- }
- },
-
- /**
- * Get the color of the given fields formatted by this column. At least one
- * field relevant for the current aggregation mode is guaranteed to be
- * defined.
- */
- color: function(fields, contexts) {
- return undefined;
- },
-
- /**
- * Format an arbitrary number of fields. At least one field relevant for
- * the current aggregation mode is guaranteed to be defined.
- */
- formatFields: function(fields) {
- if (fields.length === 1)
- return this.formatSingleField(fields[0]);
- else
- return this.formatMultipleFields(fields);
- },
-
- /**
- * Format a single defined field.
- *
- * This method is intended to be overriden by field type specific columns
- * (e.g. show '1.0 KiB' instead of '1024' for ScalarNumeric(s) representing
- * bytes).
- */
- formatSingleField: function(field) {
- throw new Error('Not implemented');
- },
-
- /**
- * Format multiple fields. At least one field relevant for the current
- * aggregation mode is guaranteed to be defined.
- *
- * The aggregation mode specializations of this method (e.g.
- * formatMultipleFieldsDiff) are intended to be overriden by field type
- * specific columns.
- */
- formatMultipleFields: function(fields) {
- switch (this.aggregationMode) {
- case MemoryColumn.AggregationMode.DIFF:
- return this.formatMultipleFieldsDiff(
- fields[0], fields[fields.length - 1]);
-
- case MemoryColumn.AggregationMode.MAX:
- return this.formatMultipleFieldsMax(fields);
-
- default:
- return tr.ui.b.createSpan({
- textContent: '(unsupported aggregation mode)',
- italic: true
- });
- }
- },
-
- formatMultipleFieldsDiff: function(firstField, lastField) {
- throw new Error('Not implemented');
- },
-
- formatMultipleFieldsMax: function(fields) {
- return this.formatSingleField(this.getMaxField(fields));
- },
-
- cmp: function(rowA, rowB) {
- var fieldsA = this.fields(rowA);
- var fieldsB = this.fields(rowB);
-
- // Sanity check.
- if (fieldsA !== undefined && fieldsB !== undefined &&
- fieldsA.length !== fieldsB.length)
- throw new Error('Different number of fields');
-
- // Handle empty fields.
- var undefinedA = this.hasAllRelevantFieldsUndefined(fieldsA);
- var undefinedB = this.hasAllRelevantFieldsUndefined(fieldsB);
- if (undefinedA && undefinedB)
- return 0;
- if (undefinedA)
- return -1;
- if (undefinedB)
- return 1;
-
- return this.compareFields(fieldsA, fieldsB);
- },
-
- /**
- * Compare a pair of single or multiple fields. At least one field relevant
- * for the current aggregation mode is guaranteed to be defined in each of
- * the two lists.
- */
- compareFields: function(fieldsA, fieldsB) {
- if (fieldsA.length === 1)
- return this.compareSingleFields(fieldsA[0], fieldsB[0]);
- else
- return this.compareMultipleFields(fieldsA, fieldsB);
- },
-
- /**
- * Compare a pair of single defined fields.
- *
- * This method is intended to be overriden by field type specific columns.
- */
- compareSingleFields: function(fieldA, fieldB) {
- throw new Error('Not implemented');
- },
-
- /**
- * Compare a pair of multiple fields. At least one field relevant for the
- * current aggregation mode is guaranteed to be defined in each of the two
- * lists.
- *
- * The aggregation mode specializations of this method (e.g.
- * compareMultipleFieldsDiff) are intended to be overriden by field type
- * specific columns.
- */
- compareMultipleFields: function(fieldsA, fieldsB) {
- switch (this.aggregationMode) {
- case MemoryColumn.AggregationMode.DIFF:
- return this.compareMultipleFieldsDiff(
- fieldsA[0], fieldsA[fieldsA.length - 1],
- fieldsB[0], fieldsB[fieldsB.length - 1]);
-
- case MemoryColumn.AggregationMode.MAX:
- return this.compareMultipleFieldsMax(fieldsA, fieldsB);
-
- default:
- return 0;
- }
- },
-
- compareMultipleFieldsDiff: function(firstFieldA, lastFieldA, firstFieldB,
- lastFieldB) {
- throw new Error('Not implemented');
- },
-
- compareMultipleFieldsMax: function(fieldsA, fieldsB) {
- return this.compareSingleFields(
- this.getMaxField(fieldsA), this.getMaxField(fieldsB));
- },
-
- getMaxField: function(fields) {
- return fields.reduce(function(accumulator, field) {
- if (field === undefined)
- return accumulator;
- if (accumulator === undefined ||
- this.compareSingleFields(field, accumulator) > 0) {
- return field;
- }
- return accumulator;
- }.bind(this), undefined);
- },
-
- addInfos: function(fields, contexts, infos) {
- // No generic infos.
- },
-
- getImportance: function(importanceRules) {
- if (importanceRules.length === 0)
- return 0;
-
- // Find the first matching rule.
- var matchingRule =
- MemoryColumn.findMatchingRule(this.name, importanceRules);
- if (matchingRule !== undefined)
- return matchingRule.importance;
-
- // No matching rule. Return lower importance than all rules.
- var minImportance = importanceRules[0].importance;
- for (var i = 1; i < importanceRules.length; i++)
- minImportance = Math.min(minImportance, importanceRules[i].importance);
- return minImportance - 1;
- }
- };
-
- /**
- * @constructor
- */
- function StringMemoryColumn(name, cellPath, aggregationMode) {
- MemoryColumn.call(this, name, cellPath, aggregationMode);
- }
-
- StringMemoryColumn.prototype = {
- __proto__: MemoryColumn.prototype,
-
- formatSingleField: function(string) {
- return string;
- },
-
- formatMultipleFieldsDiff: function(firstString, lastString) {
- if (firstString === undefined) {
- // String was added ("+NEW_VALUE" in red).
- var spanEl = tr.ui.b.createSpan({color: 'red'});
- spanEl.appendChild(tr.ui.b.asHTMLOrTextNode('+'));
- spanEl.appendChild(tr.ui.b.asHTMLOrTextNode(
- this.formatSingleField(lastString)));
- return spanEl;
- } else if (lastString === undefined) {
- // String was removed ("-OLD_VALUE" in green).
- var spanEl = tr.ui.b.createSpan({color: 'green'});
- spanEl.appendChild(tr.ui.b.asHTMLOrTextNode('-'));
- spanEl.appendChild(tr.ui.b.asHTMLOrTextNode(
- this.formatSingleField(firstString)));
- return spanEl;
- } else if (firstString === lastString) {
- // String didn't change ("VALUE" with unchanged color).
- return this.formatSingleField(firstString);
- } else {
- // String changed ("OLD_VALUE -> NEW_VALUE" in orange).
- var spanEl = tr.ui.b.createSpan({color: 'DarkOrange'});
- spanEl.appendChild(tr.ui.b.asHTMLOrTextNode(
- this.formatSingleField(firstString)));
- spanEl.appendChild(tr.ui.b.asHTMLOrTextNode(
- ' ' + RIGHTWARDS_ARROW + ' '));
- spanEl.appendChild(tr.ui.b.asHTMLOrTextNode(
- this.formatSingleField(lastString)));
- return spanEl;
- }
- },
-
- compareSingleFields: function(stringA, stringB) {
- return COLLATOR.compare(stringA, stringB);
- },
-
- compareMultipleFieldsDiff: function(firstStringA, lastStringA, firstStringB,
- lastStringB) {
- // If one of the strings was added (and the other one wasn't), mark the
- // corresponding diff as greater.
- if (firstStringA === undefined && firstStringB !== undefined)
- return 1;
- if (firstStringA !== undefined && firstStringB === undefined)
- return -1;
-
- // If both strings were added, compare the last values (greater last
- // value implies greater diff).
- if (firstStringA === undefined && firstStringB === undefined)
- return this.compareSingleFields(lastStringA, lastStringB);
-
- // If one of the strings was removed (and the other one wasn't), mark the
- // corresponding diff as lower.
- if (lastStringA === undefined && lastStringB !== undefined)
- return -1;
- if (lastStringA !== undefined && lastStringB === undefined)
- return 1;
-
- // If both strings were removed, compare the first values (greater first
- // value implies smaller (!) diff).
- if (lastStringA === undefined && lastStringB === undefined)
- return this.compareSingleFields(firstStringB, firstStringA);
-
- var areStringsAEqual = firstStringA === lastStringA;
- var areStringsBEqual = firstStringB === lastStringB;
-
- // Consider diffs of strings that did not change to be smaller than diffs
- // of strings that did change.
- if (areStringsAEqual && areStringsBEqual)
- return 0;
- if (areStringsAEqual)
- return -1;
- if (areStringsBEqual)
- return 1;
-
- // Both strings changed. We are unable to determine the ordering of the
- // diffs.
- return 0;
- }
- };
-
- /**
- * @constructor
- */
- function NumericMemoryColumn(name, cellPath, aggregationMode) {
- MemoryColumn.call(this, name, cellPath, aggregationMode);
- }
-
- // Avoid tiny positive/negative diffs (displayed in the UI as '+0.0 B' and
- // '-0.0 B') due to imprecise floating-point arithmetic by treating all diffs
- // within the (-DIFF_EPSILON, DIFF_EPSILON) range as zeros.
- NumericMemoryColumn.DIFF_EPSILON = 0.0001;
-
- NumericMemoryColumn.prototype = {
- __proto__: MemoryColumn.prototype,
-
- align: tr.ui.b.TableFormat.ColumnAlignment.RIGHT,
-
- aggregateCells: function(row, subRows) {
- var subRowCells = subRows.map(this.cell, this);
-
- // Determine if there is at least one defined numeric in the sub-row
- // cells and the timestamp count.
- var hasDefinedSubRowNumeric = false;
- var timestampCount = undefined;
- subRowCells.forEach(function(subRowCell) {
- if (subRowCell === undefined)
- return;
-
- var subRowNumerics = subRowCell.fields;
- if (subRowNumerics === undefined)
- return;
-
- if (timestampCount === undefined)
- timestampCount = subRowNumerics.length;
- else if (timestampCount !== subRowNumerics.length)
- throw new Error('Sub-rows have different numbers of timestamps');
-
- if (hasDefinedSubRowNumeric)
- return; // Avoid unnecessary traversals of the numerics.
- hasDefinedSubRowNumeric = subRowNumerics.some(function(numeric) {
- return numeric !== undefined;
- });
- });
- if (!hasDefinedSubRowNumeric)
- return; // No numeric to aggregate.
-
- // Get or create the row cell.
- var cellPath = this.cellPath;
- var rowCell = row;
- for (var i = 0; i < cellPath.length; i++) {
- var nextStepName = cellPath[i];
- var nextStep = rowCell[nextStepName];
- if (nextStep === undefined) {
- if (i < cellPath.length - 1)
- nextStep = {};
- else
- nextStep = new MemoryCell(undefined);
- rowCell[nextStepName] = nextStep;
- }
- rowCell = nextStep;
- }
- if (rowCell.fields === undefined) {
- rowCell.fields = new Array(timestampCount);
- } else if (rowCell.fields.length !== timestampCount) {
- throw new Error(
- 'Row has a different number of timestamps than sub-rows');
- }
-
- for (var i = 0; i < timestampCount; i++) {
- if (rowCell.fields[i] !== undefined)
- continue;
- rowCell.fields[i] = tr.model.MemoryAllocatorDump.aggregateNumerics(
- subRowCells.map(function(subRowCell) {
- if (subRowCell === undefined || subRowCell.fields === undefined)
- return undefined;
- return subRowCell.fields[i];
- }));
- }
- },
-
- formatSingleField: function(numeric) {
- var formattingContext = this.getFormattingContext(numeric.unit);
- var config = formattingContext !== undefined ?
- { context: formattingContext } : undefined;
- return tr.v.ui.createScalarSpan(numeric, config);
- },
-
- getFormattingContext: function(unit) {
- return undefined;
- },
-
- formatMultipleFieldsDiff: function(firstNumeric, lastNumeric) {
- return this.formatSingleField(
- this.getDiffField_(firstNumeric, lastNumeric));
- },
-
- compareSingleFields: function(numericA, numericB) {
- return numericA.value - numericB.value;
- },
-
- compareMultipleFieldsDiff: function(firstNumericA, lastNumericA,
- firstNumericB, lastNumericB) {
- return this.getDiffFieldValue_(firstNumericA, lastNumericA) -
- this.getDiffFieldValue_(firstNumericB, lastNumericB);
- },
-
- getDiffField_: function(firstNumeric, lastNumeric) {
- var definedNumeric = firstNumeric || lastNumeric;
- return new tr.v.ScalarNumeric(definedNumeric.unit.correspondingDeltaUnit,
- this.getDiffFieldValue_(firstNumeric, lastNumeric));
- },
-
- getDiffFieldValue_: function(firstNumeric, lastNumeric) {
- var firstValue = firstNumeric === undefined ? 0 : firstNumeric.value;
- var lastValue = lastNumeric === undefined ? 0 : lastNumeric.value;
- var diff = lastValue - firstValue;
- return Math.abs(diff) < NumericMemoryColumn.DIFF_EPSILON ? 0 : diff;
- }
- };
-
- /**
- * @constructor
- */
- function MemoryCell(fields) {
- this.fields = fields;
- }
-
- MemoryCell.extractFields = function(cell) {
- if (cell === undefined)
- return undefined;
- return cell.fields;
- };
-
- /** Limit for the number of sub-rows for recursive table row expansion. */
- var RECURSIVE_EXPANSION_MAX_VISIBLE_ROW_COUNT = 10;
-
- function expandTableRowsRecursively(table) {
- var currentLevelRows = table.tableRows;
- var totalVisibleRowCount = currentLevelRows.length;
-
- while (currentLevelRows.length > 0) {
- // Calculate the total number of sub-rows on the current level.
- var nextLevelRowCount = 0;
- currentLevelRows.forEach(function(currentLevelRow) {
- var subRows = currentLevelRow.subRows;
- if (subRows === undefined || subRows.length === 0)
- return;
- nextLevelRowCount += subRows.length;
- });
-
- // Determine whether expanding all rows on the current level would cause
- // the total number of visible rows go over the limit.
- if (totalVisibleRowCount + nextLevelRowCount >
- RECURSIVE_EXPANSION_MAX_VISIBLE_ROW_COUNT) {
- break;
- }
-
- // Expand all rows on the current level and gather their sub-rows.
- var nextLevelRows = new Array(nextLevelRowCount);
- var nextLevelRowIndex = 0;
- currentLevelRows.forEach(function(currentLevelRow) {
- var subRows = currentLevelRow.subRows;
- if (subRows === undefined || subRows.length === 0)
- return;
- table.setExpandedForTableRow(currentLevelRow, true);
- subRows.forEach(function(subRow) {
- nextLevelRows[nextLevelRowIndex++] = subRow;
- });
- });
-
- // Update the total number of visible rows and progress to the next level.
- totalVisibleRowCount += nextLevelRowCount;
- currentLevelRows = nextLevelRows;
- }
- }
-
- function aggregateTableRowCellsRecursively(row, columns, opt_predicate) {
- var subRows = row.subRows;
- if (subRows === undefined || subRows.length === 0)
- return;
-
- subRows.forEach(function(subRow) {
- aggregateTableRowCellsRecursively(subRow, columns, opt_predicate);
- });
-
- if (opt_predicate === undefined || opt_predicate(row.contexts))
- aggregateTableRowCells(row, subRows, columns);
- }
-
- function aggregateTableRowCells(row, subRows, columns) {
- columns.forEach(function(column) {
- if (!(column instanceof MemoryColumn))
- return;
- column.aggregateCells(row, subRows);
- });
- }
-
- function createCells(timeToValues, valueFieldsGetter, opt_this) {
- opt_this = opt_this || this;
- var fieldNameToFields = tr.b.invertArrayOfDicts(
- timeToValues, valueFieldsGetter, opt_this);
- return tr.b.mapItems(fieldNameToFields, function(fieldName, fields) {
- return new tr.ui.analysis.MemoryCell(fields);
- });
- }
-
- function createWarningInfo(message) {
- return {
- message: message,
- icon: String.fromCharCode(9888),
- color: 'red'
- };
- }
-
- // TODO(petrcermak): Use a context manager instead
- // (https://github.com/catapult-project/catapult/issues/2420).
- function DetailsNumericMemoryColumn(name, cellPath, aggregationMode) {
- NumericMemoryColumn.call(this, name, cellPath, aggregationMode);
- }
-
- DetailsNumericMemoryColumn.prototype = {
- __proto__: NumericMemoryColumn.prototype,
-
- getFormattingContext: function(unit) {
- if (unit.baseUnit === tr.v.Unit.byName.sizeInBytes)
- return { unitPrefix: tr.v.UnitScale.Binary.KIBI };
- return undefined;
- }
- };
-
- return {
- TitleColumn: TitleColumn,
- MemoryColumn: MemoryColumn,
- StringMemoryColumn: StringMemoryColumn,
- NumericMemoryColumn: NumericMemoryColumn,
- MemoryCell: MemoryCell,
- expandTableRowsRecursively: expandTableRowsRecursively,
- aggregateTableRowCellsRecursively: aggregateTableRowCellsRecursively,
- aggregateTableRowCells: aggregateTableRowCells,
- createCells: createCells,
- createWarningInfo: createWarningInfo,
- DetailsNumericMemoryColumn: DetailsNumericMemoryColumn
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_sub_view_util_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_sub_view_util_test.html
deleted file mode 100644
index 3a4350ec276..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_sub_view_util_test.html
+++ /dev/null
@@ -1,1218 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import"
- href="/tracing/ui/analysis/memory_dump_sub_view_test_utils.html">
-<link rel="import" href="/tracing/ui/analysis/memory_dump_sub_view_util.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var TitleColumn = tr.ui.analysis.TitleColumn;
- var MemoryColumn = tr.ui.analysis.MemoryColumn;
- var AggregationMode = MemoryColumn.AggregationMode;
- var StringMemoryColumn = tr.ui.analysis.StringMemoryColumn;
- var NumericMemoryColumn = tr.ui.analysis.NumericMemoryColumn;
- var MemoryCell = tr.ui.analysis.MemoryCell;
- var expandTableRowsRecursively = tr.ui.analysis.expandTableRowsRecursively;
- var aggregateTableRowCells = tr.ui.analysis.aggregateTableRowCells;
- var aggregateTableRowCellsRecursively =
- tr.ui.analysis.aggregateTableRowCellsRecursively;
- var ScalarNumeric = tr.v.ScalarNumeric;
- var sizeInBytes_smallerIsBetter =
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
- var checkSizeNumericFields = tr.ui.analysis.checkSizeNumericFields;
- var checkNumericFields = tr.ui.analysis.checkNumericFields;
- var checkStringFields = tr.ui.analysis.checkStringFields;
- var createCells = tr.ui.analysis.createCells;
- var createWarningInfo = tr.ui.analysis.createWarningInfo;
-
- function checkPercent(string, expectedPercent) {
- assert.equal(Number(string.slice(0, -1)), expectedPercent);
- assert.equal(string.slice(-1), '%');
- }
-
- function checkMemoryColumnFieldFormat(test, column, fields,
- expectedTextContent, opt_expectedColor) {
- var value = column.formatMultipleFields(fields);
- if (expectedTextContent === undefined) {
- assert.strictEqual(value, '');
- assert.isUndefined(opt_expectedColor); // Test sanity check.
- return;
- }
-
- var node = tr.ui.b.asHTMLOrTextNode(value);
- var spanEl = document.createElement('span');
- spanEl.appendChild(node);
- test.addHTMLOutput(spanEl);
-
- assert.strictEqual(node.textContent, expectedTextContent);
- if (opt_expectedColor === undefined)
- assert.notInstanceOf(node, HTMLElement);
- else
- assert.strictEqual(node.style.color, opt_expectedColor);
- }
-
- function checkCompareFieldsEqual(column, fieldValuesA, fieldValuesB) {
- assert.strictEqual(column.compareFields(fieldValuesA, fieldValuesB), 0);
- }
-
- function checkCompareFieldsLess(column, fieldValuesA, fieldValuesB) {
- assert.isBelow(column.compareFields(fieldValuesA, fieldValuesB), 0);
- assert.isAbove(column.compareFields(fieldValuesB, fieldValuesA), 0);
- }
-
- function checkNumericMemoryColumnFieldFormat(test, column, fieldValues, unit,
- expectedValue) {
- var value = column.formatMultipleFields(
- buildScalarCell(unit, fieldValues).fields);
- if (expectedValue === undefined) {
- assert.equal(value, '');
- assert.isUndefined(expectedUnits); // Test sanity check.
- return;
- }
-
- test.addHTMLOutput(value);
- assert.equal(value.tagName, 'TR-V-UI-SCALAR-SPAN');
- assert.equal(value.value, expectedValue);
- assert.equal(value.unit, unit);
- }
-
- function buildScalarCell(unit, values) {
- return new MemoryCell(values.map(function(value) {
- if (value === undefined)
- return undefined;
- return new ScalarNumeric(unit, value);
- }));
- }
-
- function buildTestRows() {
- return [
- {
- title: 'Row 1',
- fields: {
- 'cpu_temperature': new MemoryCell(['below zero', 'absolute zero'])
- },
- subRows: [
- {
- title: 'Row 1A',
- fields: {
- 'page_size': buildScalarCell(sizeInBytes_smallerIsBetter,
- [1024, 1025])
- }
- },
- {
- title: 'Row 1B',
- fields: {
- 'page_size': buildScalarCell(sizeInBytes_smallerIsBetter,
- [512, 513]),
- 'mixed': new MemoryCell(['0.01', '0.10']),
- 'mixed2': new MemoryCell([
- new ScalarNumeric(tr.v.Unit.byName.powerInWatts, 2.43e18),
- new ScalarNumeric(tr.v.Unit.byName.powerInWatts, 0.5433)
- ])
- }
- }
- ]
- },
- {
- title: 'Row 2',
- fields: {
- 'cpu_temperature': undefined,
- 'mixed': buildScalarCell(tr.v.Unit.byName.timeDurationInMs,
- [0.99, 0.999])
- }
- }
- ];
- }
-
- function checkMemoryColumn(column, expectedName, expectedTitle,
- expectedAggregationMode, testRow, expectedCell, expectedType) {
- assert.strictEqual(column.name, expectedName);
- if (typeof expectedTitle === 'function')
- expectedTitle(column.title);
- else
- assert.strictEqual(column.title, expectedTitle);
- assert.strictEqual(column.aggregationMode, expectedAggregationMode);
- assert.strictEqual(column.cell(testRow), expectedCell);
- assert.instanceOf(column, expectedType);
- }
-
- function checkCellValue(
- test, value, expectedText, expectedColor, opt_expectedInfos) {
- var expectedInfos = opt_expectedInfos || [];
- assert.lengthOf(value.childNodes, 1 + expectedInfos.length);
- assert.strictEqual(value.style.color, expectedColor);
- if (typeof expectedText === 'string')
- assert.strictEqual(value.childNodes[0].textContent, expectedText);
- else
- expectedText(value.childNodes[0]);
- for (var i = 0; i < expectedInfos.length; i++) {
- var expectedInfo = expectedInfos[i];
- var infoEl = value.childNodes[i + 1];
- assert.strictEqual(infoEl.textContent, expectedInfo.icon);
- assert.strictEqual(infoEl.title, expectedInfo.message);
- assert.strictEqual(infoEl.style.color, expectedInfo.color || '');
- }
- test.addHTMLOutput(value);
- }
-
- function sizeSpanMatcher(
- expectedValue, opt_expectedIsDelta, opt_expectedContext) {
- return function(element) {
- assert.strictEqual(element.tagName, 'TR-V-UI-SCALAR-SPAN');
- assert.strictEqual(element.value, expectedValue);
- assert.strictEqual(element.unit, opt_expectedIsDelta ?
- tr.v.Unit.byName.sizeInBytesDelta_smallerIsBetter :
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter);
- assert.deepEqual(element.context, opt_expectedContext);
- };
- }
-
- test('checkTitleColumn_value', function() {
- var column = new TitleColumn('column_title');
- assert.equal(column.title, 'column_title');
- assert.isFalse(column.supportsCellSelection);
-
- var row = {title: 'undefined', contexts: undefined};
- assert.equal(column.formatTitle(row), 'undefined');
- assert.equal(column.value(row), 'undefined');
-
- var row = {title: 'constant', contexts: [{}, {}, {}, {}]};
- assert.equal(column.formatTitle(row), 'constant');
- assert.equal(column.value(row), 'constant');
-
- var row = {title: 'added', contexts: [undefined, undefined, undefined, {}]};
- assert.equal(column.formatTitle(row), 'added');
- var value = column.value(row);
- assert.equal(value.textContent, '+++\u00A0added');
- assert.equal(value.style.color, 'red');
-
- var row = {title: 'removed', contexts: [true, true, undefined, undefined]};
- assert.equal(column.formatTitle(row), 'removed');
- var value = column.value(row);
- assert.equal(value.textContent, '---\u00A0removed');
- assert.equal(value.style.color, 'green');
-
- var row = {title: 'flaky', contexts: [true, undefined, true, true]};
- assert.equal(column.formatTitle(row), 'flaky');
- var value = column.value(row);
- assert.equal(value.textContent, 'flaky');
- assert.equal(value.style.color, 'purple');
-
- var row =
- {title: 'added-flaky', contexts: [undefined, {}, undefined, true]};
- assert.equal(column.formatTitle(row), 'added-flaky');
- var value = column.value(row);
- assert.equal(value.textContent, '+++\u00A0added-flaky');
- assert.equal(value.style.color, 'purple');
-
- var row =
- {title: 'removed-flaky', contexts: [true, undefined, {}, undefined]};
- assert.equal(column.formatTitle(row), 'removed-flaky');
- var value = column.value(row);
- assert.equal(value.textContent, '---\u00A0removed-flaky');
- assert.equal(value.style.color, 'purple');
- });
-
- test('checkTitleColumn_cmp', function() {
- var column = new TitleColumn('column_title');
-
- assert.isBelow(column.cmp({title: 'a'}, {title: 'b'}), 0);
- assert.equal(column.cmp({title: 'cc'}, {title: 'cc'}), 0);
- assert.isAbove(column.cmp({title: '10'}, {title: '2'}), 0);
- });
-
- test('checkMemoryColumn_fromRows', function() {
- function MockColumn0() {
- MemoryColumn.apply(this, arguments);
- }
- MockColumn0.prototype = {
- __proto__: MemoryColumn.prototype,
- get title() { return 'MockColumn0'; }
- };
-
- function MockColumn1() {
- MemoryColumn.apply(this, arguments);
- }
- MockColumn1.prototype = {
- __proto__: MemoryColumn.prototype,
- get title() { return 'MockColumn1'; }
- };
-
- function MockColumn2() {
- MemoryColumn.apply(this, arguments);
- }
- MockColumn2.prototype = {
- __proto__: MemoryColumn.prototype,
- get title() { return 'MockColumn2'; }
- };
-
- var rules = [
- {
- condition: /size/,
- importance: 10,
- columnConstructor: MockColumn0
- },
- {
- condition: 'cpu_temperature',
- importance: 0,
- columnConstructor: MockColumn1
- },
- {
- condition: 'unmatched',
- importance: -1,
- get columnConstructor() {
- throw new Error('The constructor should never be retrieved');
- }
- },
- {
- importance: 1,
- columnConstructor: MockColumn2
- }
- ];
-
- var rows = buildTestRows();
- var columns = MemoryColumn.fromRows(rows, 'fields', AggregationMode.MAX,
- rules);
- assert.lengthOf(columns, 4);
-
- var pageSizeColumn = columns[0];
- checkMemoryColumn(pageSizeColumn, 'page_size', 'MockColumn0',
- AggregationMode.MAX, {fields: {page_size: 'large'}}, 'large',
- MockColumn0);
-
- var mixedColumn = columns[1];
- checkMemoryColumn(mixedColumn, 'mixed', 'MockColumn2', AggregationMode.MAX,
- {fields: {mixed: 89}}, 89, MockColumn2);
-
- var mixed2Column = columns[2];
- checkMemoryColumn(mixed2Column, 'mixed2', 'MockColumn2',
- AggregationMode.MAX, {fields: {mixed2: 'invalid'}}, 'invalid',
- MemoryColumn);
-
- var cpuTemperatureColumn = columns[3];
- checkMemoryColumn(cpuTemperatureColumn, 'cpu_temperature', 'MockColumn1',
- AggregationMode.MAX, {fields: {cpu_temperature: 42}}, 42, MockColumn1);
- });
-
- test('checkMemoryColumn_spaceEqually', function() {
- // Zero columns.
- var columns = [];
- MemoryColumn.spaceEqually(columns);
-
- // One column.
- var columns = [
- {
- title: 'First Column',
- value: function(row) { return row.firstData; }
- }
- ];
- MemoryColumn.spaceEqually(columns);
- checkPercent(columns[0].width, 100);
-
- // Two columns.
- var columns = [
- {
- title: 'First Column',
- value: function(row) { return row.firstData; }
- },
- {
- title: 'Second Column',
- value: function(row) { return row.firstData; }
- }
- ];
- MemoryColumn.spaceEqually(columns);
- checkPercent(columns[0].width, 50);
- checkPercent(columns[1].width, 50);
- });
-
- test('checkMemoryColumn_instantiate', function() {
- var c = new MemoryColumn('test_column', ['x'], AggregationMode.MAX);
- assert.equal(c.name, 'test_column');
- assert.equal(c.title, 'test_column');
- assert.equal(c.cell({x: 95}), 95);
- assert.isUndefined(c.width);
- assert.isUndefined(c.color());
- });
-
- test('checkMemoryColumn_cell', function() {
- var c = new MemoryColumn('test_column', ['a', 'b'], AggregationMode.MAX);
- var cell = new MemoryCell(undefined);
-
- assert.isUndefined(c.cell(undefined));
- assert.isUndefined(c.cell({b: cell}));
- assert.isUndefined(c.cell({a: {c: cell}}));
- assert.strictEqual(c.cell({a: {b: cell, c: 42}}), cell);
- });
-
- test('checkMemoryColumn_fields', function() {
- var c = new MemoryColumn('test_column', ['x'],
- AggregationMode.MAX);
-
- // Undefined cell or field inside cell.
- assert.isUndefined(c.fields({}));
- assert.isUndefined(c.fields({x: new MemoryCell(undefined)}));
-
- // Defined field(s) inside cell.
- var field1 = new ScalarNumeric(tr.v.Unit.byName.powerInWatts, 1013.25);
- var field2 = new ScalarNumeric(tr.v.Unit.byName.powerInWatts, 1065);
- var row1 = {x: new MemoryCell([field1])};
- var row2 = {x: new MemoryCell([field1, field2])};
- assert.deepEqual(c.fields(row1), [field1]);
- assert.deepEqual(c.fields(row2), [field1, field2]);
- });
-
- test('checkMemoryColumn_hasAllRelevantFieldsUndefined', function() {
- // Single field.
- var c1 = new MemoryColumn('single_column', ['x'],
- undefined /* aggregation mode */);
- assert.isTrue(c1.hasAllRelevantFieldsUndefined([undefined]));
- assert.isFalse(c1.hasAllRelevantFieldsUndefined(
- [new ScalarNumeric(sizeInBytes_smallerIsBetter, 16)]));
-
- // Multiple fields, diff aggregation mode.
- var c2 = new MemoryColumn('diff_column', ['x'],
- AggregationMode.DIFF);
- assert.isTrue(c2.hasAllRelevantFieldsUndefined([undefined, undefined]));
- assert.isTrue(c2.hasAllRelevantFieldsUndefined(
- [undefined, undefined, undefined]));
- assert.isTrue(c2.hasAllRelevantFieldsUndefined(
- [undefined, new ScalarNumeric(sizeInBytes_smallerIsBetter, 16),
- undefined]));
- assert.isFalse(c2.hasAllRelevantFieldsUndefined(
- [undefined, new ScalarNumeric(sizeInBytes_smallerIsBetter, 32)]));
- assert.isFalse(c2.hasAllRelevantFieldsUndefined(
- [new ScalarNumeric(sizeInBytes_smallerIsBetter, 32), undefined,
- undefined]));
- assert.isFalse(c2.hasAllRelevantFieldsUndefined([
- new ScalarNumeric(sizeInBytes_smallerIsBetter, 16),
- undefined,
- new ScalarNumeric(sizeInBytes_smallerIsBetter, 32)]));
-
- // Multiple fields, max aggregation mode.
- var c3 = new MemoryColumn('max_column', ['x'],
- AggregationMode.MAX);
- assert.isTrue(c3.hasAllRelevantFieldsUndefined([undefined, undefined]));
- assert.isTrue(c3.hasAllRelevantFieldsUndefined(
- [undefined, undefined, undefined]));
- assert.isFalse(c3.hasAllRelevantFieldsUndefined(
- [undefined, new ScalarNumeric(sizeInBytes_smallerIsBetter, 16),
- undefined]));
- assert.isFalse(c3.hasAllRelevantFieldsUndefined(
- [undefined, new ScalarNumeric(sizeInBytes_smallerIsBetter, 32)]));
- assert.isFalse(c3.hasAllRelevantFieldsUndefined([
- new ScalarNumeric(sizeInBytes_smallerIsBetter, 32),
- undefined,
- new ScalarNumeric(sizeInBytes_smallerIsBetter, 16)]));
- });
-
- test('checkMemoryColumn_value_allFieldsUndefined', function() {
- var c1 = new MemoryColumn('no_color', ['x'],
- AggregationMode.MAX);
- var c2 = new MemoryColumn('color', ['x'],
- AggregationMode.DIFF);
- Object.defineProperty(c2, 'color', {
- get: function() {
- throw new Error('The color should never be retrieved');
- }
- });
-
- // Infos should be completely ignored.
- c1.addInfos = c2.addInfos = function() {
- throw new Error('This method should never be called');
- };
-
- [c1, c2].forEach(function(c) {
- assert.equal(c.value({}), '');
- assert.equal(c.value({x: new MemoryCell(undefined)}), '');
- assert.equal(c.value({x: new MemoryCell([undefined])}), '');
- assert.equal(c.value({x: new MemoryCell([undefined, undefined])}), '');
- });
-
- // Diff should only take into account the first and last field value.
- assert.equal(c2.value({x: new MemoryCell(
- [undefined, new ScalarNumeric(sizeInBytes_smallerIsBetter, 16),
- undefined])}), '');
- });
-
- test('checkMemoryColumn_getImportance', function() {
- var c = new NumericMemoryColumn('test_column', ['x']);
-
- var rules1 = [];
- assert.equal(c.getImportance(rules1), 0);
-
- var rules2 = [
- {
- condition: 'test',
- importance: 4
- },
- {
- condition: /test$/,
- importance: 2
- }
- ];
- assert.equal(c.getImportance(rules2), 1);
-
- var rules3 = [
- {
- condition: 'test_column',
- importance: 10
- },
- {
- importance: 5
- }
- ];
- assert.equal(c.getImportance(rules3), 10);
-
- var rules4 = [
- {
- condition: 'test_column2',
- importance: 8
- },
- {
- condition: /column/,
- importance: 12
- }
- ];
- assert.equal(c.getImportance(rules4), 12);
- });
-
- test('checkMemoryColumn_nameMatchesCondition', function() {
- var c = new NumericMemoryColumn('test_column', ['x']);
-
- assert.isTrue(MemoryColumn.nameMatchesCondition('test_column', undefined));
-
- assert.isFalse(MemoryColumn.nameMatchesCondition('test_column', 'test'));
- assert.isTrue(
- MemoryColumn.nameMatchesCondition('test_column', 'test_column'));
- assert.isFalse(
- MemoryColumn.nameMatchesCondition('test_column', 'test_column2'));
-
- assert.isTrue(MemoryColumn.nameMatchesCondition('test_column', /test/));
- assert.isTrue(
- MemoryColumn.nameMatchesCondition('test_column', /^[^_]*_[^_]*$/));
- assert.isFalse(MemoryColumn.nameMatchesCondition('test_column', /test$/));
- });
-
- test('checkStringMemoryColumn_value_singleField', function() {
- var c = new StringMemoryColumn('', ['x'], AggregationMode.MAX);
- c.color = function(fields, contexts) {
- if (fields[0] < '0')
- return 'green';
- else if (contexts && contexts[0] % 2 === 0)
- return 'red';
- else
- return undefined;
- };
-
- var infos1 = [{ icon: '\u{1F648}', message: 'Some info', color: 'blue' }];
- var infos2 = [
- { icon: '\u{1F649}', message: 'Start', color: 'cyan' },
- { icon: '\u{1F64A}', message: 'Stop' }
- ];
- c.addInfos = function(fields, contexts, infos) {
- if (fields[0] < '0')
- infos.push.apply(infos, infos1);
- else if (contexts && contexts[0] % 2 === 0)
- infos.push.apply(infos, infos2);
- };
-
- var row = {x: new MemoryCell(['123'])};
- assert.strictEqual(c.value(row), '123');
-
- var row = {x: new MemoryCell(['-123']), contexts: [undefined]};
- checkCellValue(this, c.value(row), '-123', 'green', infos1);
-
- var row = {x: new MemoryCell(['123']), contexts: [42]};
- checkCellValue(this, c.value(row), '123', 'red', infos2);
- });
-
- test('checkStringMemoryColumn_value_multipleFields', function() {
- var c1 = new StringMemoryColumn('test_column1', ['x'],
- undefined /* aggregation mode */);
- var c2 = new StringMemoryColumn('test_column2', ['x'],
- AggregationMode.DIFF);
- c2.color = function(fields, contexts) {
- return '#009999';
- };
- var c3 = new StringMemoryColumn('test_column3', ['x'],
- AggregationMode.MAX);
- c3.color = function(fields, contexts) {
- if (fields[0] < '0')
- return 'green';
- else if (contexts && contexts[contexts.length - 1] % 2 === 0)
- return 'red';
- else
- return undefined;
- };
-
- var infos1 = [{ icon: '\u{1F648}', message: 'Some info', color: 'blue' }];
- var infos2 = [
- { icon: '\u{1F649}', message: 'Start', color: 'cyan' },
- { icon: '\u{1F64A}', message: 'Stop' }
- ];
- c1.addInfos = c2.addInfos = c3.addInfos =
- function(fields, contexts, infos) {
- if (fields[0] < '0')
- infos.push.apply(infos, infos1);
- else if (contexts && contexts[contexts.length - 1] % 2 === 0)
- infos.push.apply(infos, infos2);
- };
-
- var row = {x: new MemoryCell(['123', '456'])};
- checkCellValue(this, c1.value(row), '(unsupported aggregation mode)', '');
- checkCellValue(this, c2.value(row), '123 \u2192 456', 'rgb(0, 153, 153)');
- assert.strictEqual(c3.value(row), '456');
-
- var row = {
- x: new MemoryCell(['-123', undefined, '+123']),
- contexts: [12, 14, undefined]
- };
- checkCellValue(this, c1.value(row), '(unsupported aggregation mode)', '',
- infos1);
- checkCellValue(this, c2.value(row), '-123 \u2192 +123', 'rgb(0, 153, 153)',
- infos1);
- checkCellValue(this, c3.value(row), '+123', 'green', infos1);
-
- var row = {
- x: new MemoryCell(['123', undefined, '456']),
- contexts: [31, 7, -2]
- };
- checkCellValue(this, c1.value(row), '(unsupported aggregation mode)', '',
- infos2);
- checkCellValue(this, c2.value(row), '123 \u2192 456', 'rgb(0, 153, 153)',
- infos2);
- checkCellValue(this, c3.value(row), '456', 'red', infos2);
- });
-
- test('checkStringMemoryColumn_formatSingleField', function() {
- var c = new StringMemoryColumn('test_column', ['x'],
- undefined /* aggregation mode */);
-
- assert.equal(c.formatSingleField('1024'), '1024');
- assert.equal(c.formatSingleField('~10'), '~10');
- });
-
- test('checkStringMemoryColumn_formatMultipleFields_diff', function() {
- var c = new StringMemoryColumn('test_column', ['x'],
- AggregationMode.DIFF);
-
- // Added value.
- checkMemoryColumnFieldFormat(this, c, [undefined, 'few'], '+few', 'red');
- checkMemoryColumnFieldFormat(this, c, [undefined, 64, 32], '+32', 'red');
-
- // Removed value.
- checkMemoryColumnFieldFormat(this, c, ['00', undefined], '-00', 'green');
- checkMemoryColumnFieldFormat(this, c, [1, undefined, 2, undefined], '-1',
- 'green');
-
- // Identical values.
- checkMemoryColumnFieldFormat(this, c, ['Unchanged', 'Unchanged'],
- 'Unchanged', undefined /* unchanged color (not an HTML element) */);
- checkMemoryColumnFieldFormat(this, c, [16, 32, undefined, 64, 16], '16',
- undefined /* unchanged color (not an HTML element) */);
-
- // Different values.
- checkMemoryColumnFieldFormat(this, c, ['A', 'C', undefined, 'C', 'B'],
- 'A \u2192 B', 'darkorange');
- checkMemoryColumnFieldFormat(this, c, [16, undefined, 64], '16 \u2192 64',
- 'darkorange');
- });
-
- test('checkStringMemoryColumn_formatMultipleFields_max', function() {
- var c = new StringMemoryColumn('test_column', ['x'],
- AggregationMode.MAX);
-
- // Different values.
- checkMemoryColumnFieldFormat(this, c, ['A', 'B', 'A'], 'B',
- undefined /* unchanged color (not an HTML element) */);
- checkMemoryColumnFieldFormat(this, c, [16, 16, undefined, 17], '17',
- undefined /* unchanged color (not an HTML element) */);
-
- // Identical values.
- checkMemoryColumnFieldFormat(this, c, ['X', 'X'], 'X',
- undefined /* unchanged color (not an HTML element) */);
- checkMemoryColumnFieldFormat(this, c, [7, undefined, 7, undefined, 7], '7',
- undefined /* unchanged color (not an HTML element) */);
- });
-
- test('checkStringMemoryColumn_compareSingleFields', function() {
- var c = new StringMemoryColumn('test_column', ['x'],
- undefined /* aggregation mode */);
-
- assert.isBelow(c.compareSingleFields(
- new ScalarNumeric(sizeInBytes_smallerIsBetter, 2),
- new ScalarNumeric(sizeInBytes_smallerIsBetter, 10)), 0);
- assert.equal(c.compareSingleFields('equal', 'equal'), 0);
- assert.isAbove(c.compareSingleFields('100', '99'), 0);
- });
-
- test('checkStringMemoryColumn_compareMultipleFields_diff', function() {
- var c = new StringMemoryColumn('test_column', ['x'],
- AggregationMode.DIFF);
-
- // One field was added.
- checkCompareFieldsLess(c, [-10, 10], [undefined, 5]);
- checkCompareFieldsLess(c,
- [-100, undefined, undefined], [undefined, 4, 5]);
- checkCompareFieldsLess(c,
- [1, 2, 3, 4], [undefined, 'x', undefined, 'y']);
-
- // Both fields were added.
- checkCompareFieldsEqual(c,
- [undefined, 'C', undefined, 'A'], [undefined, 'B', 'D', 'A']);
- checkCompareFieldsLess(c, [undefined, 1], [undefined, 2]);
- checkCompareFieldsLess(c, [undefined, 6, 3], [undefined, 5, 4]);
-
- // One field was removed (neither was added).
- checkCompareFieldsLess(c, ['B', undefined], ['A', 'A']);
- checkCompareFieldsLess(c,
- [5, undefined, undefined], [undefined, -5, -10]);
-
- // Both fields were removed (neither was added)
- checkCompareFieldsEqual(c, ['T', 'A', undefined, undefined],
- ['T', 'B', 'C', undefined]);
- checkCompareFieldsLess(c, [5, undefined], [4, undefined]);
-
- // Neither field was added or removed.
- checkCompareFieldsLess(c, ['BB', 'BB'], ['AA', 'CC']);
- checkCompareFieldsEqual(c, [7, 8, 9], [6, 9, 10]);
- checkCompareFieldsEqual(c, [5, undefined, 5], [4, 3, 4]);
- });
-
- test('checkStringMemoryColumn_compareMultipleFields_max', function() {
- var c = new StringMemoryColumn('test_column', ['x'],
- AggregationMode.MAX);
-
- // At least one field has multiple values.
- checkCompareFieldsEqual(c, [0, 1, 3], [1, 3, 2]);
- checkCompareFieldsLess(c, ['4', undefined, '4'], ['3', '4', '5']);
- checkCompareFieldsLess(c, [3, 3, 3], [9, undefined, 10]);
-
- // Both fields have single values.
- checkCompareFieldsEqual(c,
- [undefined, 'ttt', undefined], ['ttt', 'ttt', undefined]);
- checkCompareFieldsLess(c, [undefined, -1, undefined], [-2, -2, -2]);
- checkCompareFieldsLess(c, ['Q', 'Q', undefined], ['X', undefined, 'X']);
- });
-
- test('checkStringMemoryColumn_cmp', function() {
- var c = new StringMemoryColumn('test_column', ['x'],
- AggregationMode.DIFF);
-
- // Cell (or the associated field) undefined in one or both rows.
- assert.equal(c.cmp({}, {y: new MemoryCell([undefined])}), 0);
- assert.equal(c.cmp({x: new MemoryCell(undefined)}, {}), 0);
- assert.equal(c.cmp({x: new MemoryCell([undefined, undefined])}, {}), 0);
- assert.isAbove(c.cmp({x: new MemoryCell(['negative'])}, {}), 0);
- assert.isAbove(c.cmp({x: new MemoryCell(['negative'])},
- {x: new MemoryCell([undefined])}), 0);
- assert.isBelow(c.cmp({}, {x: new MemoryCell(['positive'])}), 0);
- assert.isBelow(c.cmp({x: new MemoryCell(undefined)},
- {x: new MemoryCell(['positive'])}), 0);
-
- // Single field.
- assert.equal(c.cmp({x: new MemoryCell(['equal'])},
- {x: new MemoryCell(['equal'])}), 0);
- assert.isAbove(c.cmp({x: new MemoryCell(['bigger'])},
- {x: new MemoryCell(['BIG'])}), 0);
- assert.isBelow(c.cmp({x: new MemoryCell(['small'])},
- {x: new MemoryCell(['smaLL'])}), 0);
-
- // Multiple fields.
- assert.isBelow(c.cmp(
- {x: new MemoryCell(['MemoryColumn', 'supports*', undefined])},
- {x: new MemoryCell(['comparing', 'multiple', 'values :-)'])}), 0);
- });
-
- test('checkNumericMemoryColumn_value', function() {
- var c = new NumericMemoryColumn('test_column', ['x'],
- AggregationMode.DIFF);
- c.color = function(fields, contexts) {
- return '#009999';
- };
- var infos1 = [createWarningInfo('Attention!')];
- c.addInfos = function(fields, contexts, infos) {
- infos.push.apply(infos, infos1);
- };
-
- // Undefined field values.
- var row = {x: buildScalarCell(sizeInBytes_smallerIsBetter,
- [undefined, 1, undefined])};
- assert.equal(c.value(row), '');
-
- // Single field value.
- var row = {x: buildScalarCell(sizeInBytes_smallerIsBetter,
- [5.4975581e13 /* 50 TiB */])};
- checkCellValue(this, c.value(row), sizeSpanMatcher(5.4975581e13),
- 'rgb(0, 153, 153)', infos1);
-
- // Multiple field values.
- var row = {
- x: buildScalarCell(sizeInBytes_smallerIsBetter,
- [5.4975581e13 /* 50 TiB */, undefined, 2.1990233e13 /* 20 TiB */])
- };
- checkCellValue(this, c.value(row),
- sizeSpanMatcher(-3.2985348e13, true /* opt_expectedIsDelta */),
- 'rgb(0, 153, 153)', infos1);
-
- // With custom formatting context.
- c.getFormattingContext = function(unit) {
- assert.strictEqual(unit,
- tr.v.Unit.byName.sizeInBytesDelta_smallerIsBetter);
- return { minimumFractionDigits: 2 };
- };
- checkCellValue(this, c.value(row),
- sizeSpanMatcher(-3.2985348e13, true /* opt_expectedIsDelta */,
- { minimumFractionDigits: 2 }),
- 'rgb(0, 153, 153)', infos1);
- });
-
- test('checkNumericMemoryColumn_formatSingleField', function() {
- var c = new NumericMemoryColumn('non_bytes_column', ['x'],
- undefined /* aggregation mode */);
- var value = c.formatSingleField(new ScalarNumeric(
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter, 123));
- assert.equal(value.tagName, 'TR-V-UI-SCALAR-SPAN');
- assert.equal(value.value, 123);
- assert.equal(value.unit, tr.v.Unit.byName.unitlessNumber_smallerIsBetter);
- this.addHTMLOutput(value);
-
- var c = new NumericMemoryColumn('bytes_column', ['x'],
- undefined /* aggregation mode */);
- var value = c.formatSingleField(new ScalarNumeric(
- sizeInBytes_smallerIsBetter, 456));
- assert.equal(value.tagName, 'TR-V-UI-SCALAR-SPAN');
- assert.equal(value.value, 456);
- assert.equal(value.unit, tr.v.Unit.byName.sizeInBytes_smallerIsBetter);
- this.addHTMLOutput(value);
- });
-
- test('checkNumericMemoryColumn_formatMultipleFields_diff',
- function() {
- var c = new NumericMemoryColumn('non_bytes_column', ['x'],
- AggregationMode.DIFF);
- checkNumericMemoryColumnFieldFormat(this, c, [1, 2, 3],
- tr.v.Unit.byName.unitlessNumberDelta_smallerIsBetter, 2);
- checkNumericMemoryColumnFieldFormat(this, c, [10, undefined],
- tr.v.Unit.byName.unitlessNumberDelta_smallerIsBetter, -10);
- checkNumericMemoryColumnFieldFormat(this, c, [undefined, 60, 0],
- tr.v.Unit.byName.unitlessNumberDelta_smallerIsBetter, 0);
- checkNumericMemoryColumnFieldFormat(
- this, c, [2.71828, 2.71829] /* diff within epsilon */,
- tr.v.Unit.byName.unitlessNumberDelta_smallerIsBetter, 0);
-
- var c = new NumericMemoryColumn('bytes_column', ['x'],
- AggregationMode.DIFF);
- checkNumericMemoryColumnFieldFormat(this, c, [1, 2, 3],
- tr.v.Unit.byName.sizeInBytesDelta_smallerIsBetter, 2);
- checkNumericMemoryColumnFieldFormat(this, c, [10, undefined],
- tr.v.Unit.byName.sizeInBytesDelta_smallerIsBetter, -10);
- checkNumericMemoryColumnFieldFormat(this, c, [undefined, 60, 0],
- tr.v.Unit.byName.sizeInBytesDelta_smallerIsBetter, 0);
- checkNumericMemoryColumnFieldFormat(
- this, c, [1.41421, 1.41422] /* diff within epsilon */,
- tr.v.Unit.byName.sizeInBytesDelta_smallerIsBetter, 0);
- });
-
- test('checkNumericMemoryColumn_formatMultipleFields_max',
- function() {
- var c = new NumericMemoryColumn('non_bytes_column', ['x'],
- AggregationMode.MAX);
- checkNumericMemoryColumnFieldFormat(this, c, [1, 2, 3],
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter, 3);
- checkNumericMemoryColumnFieldFormat(this, c, [10, undefined],
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter, 10);
- checkNumericMemoryColumnFieldFormat(this, c, [undefined, 60, 0],
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter, 60);
- checkNumericMemoryColumnFieldFormat(this, c, [undefined, 10, 20, undefined],
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter, 20);
-
- var c = new NumericMemoryColumn('bytes_column', ['x'],
- AggregationMode.MAX);
- checkNumericMemoryColumnFieldFormat(this, c, [1, 2, 3],
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter, 3);
- checkNumericMemoryColumnFieldFormat(this, c, [10, undefined],
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter, 10);
- checkNumericMemoryColumnFieldFormat(this, c, [undefined, 60, 0],
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter, 60);
- checkNumericMemoryColumnFieldFormat(this, c, [undefined, 10, 20, undefined],
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter, 20);
- });
-
- test('checkNumericMemoryColumn_cmp', function() {
- var c = new NumericMemoryColumn('test_column', ['x'],
- AggregationMode.DIFF);
-
- // Undefined field values.
- assert.isAbove(c.cmp({x: buildScalarCell(sizeInBytes_smallerIsBetter,
- [-9999999999])},
- {x: undefined}), 0);
- assert.isBelow(c.cmp({x: new MemoryCell(undefined)},
- {x: buildScalarCell(sizeInBytes_smallerIsBetter, [748, 749])}), 0);
- assert.equal(c.cmp({},
- {x: buildScalarCell(sizeInBytes_smallerIsBetter,
- [undefined, undefined])}), 0);
-
- // Single field value.
- assert.isBelow(c.cmp(
- {x: buildScalarCell(sizeInBytes_smallerIsBetter, [16384])},
- {x: buildScalarCell(sizeInBytes_smallerIsBetter, [32768])}), 0);
-
- // Multiple field values.
- assert.equal(c.cmp(
- {x: buildScalarCell(sizeInBytes_smallerIsBetter,
- [999, undefined, 1001])},
- {x: buildScalarCell(sizeInBytes_smallerIsBetter,
- [undefined, 5, 2])}), 0);
- });
-
- test('checkNumericMemoryColumn_compareSingleFields', function() {
- var c = new NumericMemoryColumn('test_column', ['x'],
- undefined /* aggregation mode */);
-
- assert.isBelow(c.compareSingleFields(
- new ScalarNumeric(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter, 99),
- new ScalarNumeric(
- tr.v.Unit.byName.timeDurationInMs_smallerIsBetter, 100)), 0);
- assert.equal(c.compareSingleFields(
- new ScalarNumeric(tr.v.Unit.byName.unitlessNumber, 0xEEE),
- new ScalarNumeric(tr.v.Unit.byName.unitlessNumber, 0xEEE)), 0);
- assert.isAbove(c.compareSingleFields(
- new ScalarNumeric(sizeInBytes_smallerIsBetter, 10),
- new ScalarNumeric(sizeInBytes_smallerIsBetter, 2)), 0);
- });
-
- test('checkNumericMemoryColumn_compareMultipleFields_diff', function() {
- var c = new NumericMemoryColumn('test_column', ['x'],
- AggregationMode.DIFF);
-
- assert.isBelow(c.compareMultipleFields(
- buildScalarCell(sizeInBytes_smallerIsBetter,
- [10000, 10001, 10002] /* diff +2 */).fields,
- buildScalarCell(sizeInBytes_smallerIsBetter,
- [5, 7, 8] /* diff +3 */).fields), 0);
- assert.equal(c.compareMultipleFields(
- buildScalarCell(tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- [4, undefined] /* diff -4 */).fields,
- buildScalarCell(tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- [999, 995] /* diff -4 */).fields), 0);
- assert.isAbove(c.compareMultipleFields(
- buildScalarCell(sizeInBytes_smallerIsBetter,
- [10, undefined, 12] /* diff +2 */).fields,
- buildScalarCell(sizeInBytes_smallerIsBetter,
- [11, 50, 12] /* diff +1 */).fields), 0);
- assert.equal(c.compareMultipleFields(
- buildScalarCell(tr.v.Unit.byName.powerInWatts_smallerIsBetter,
- [17, undefined, 17] /* diff 0 */).fields,
- buildScalarCell(tr.v.Unit.byName.powerInWatts_smallerIsBetter,
- [undefined, 100, undefined] /* diff 0 */).fields), 0);
- assert.equal(c.compareMultipleFields(
- buildScalarCell(sizeInBytes_smallerIsBetter,
- [3.14159, undefined, 3.14160] /* diff within epsilon */).fields,
- buildScalarCell(sizeInBytes_smallerIsBetter,
- [100, 100, 100] /* diff 0 */).fields), 0);
- });
-
- test('checkNumericMemoryColumn_compareMultipleFields_max', function() {
- var c = new NumericMemoryColumn('test_column', ['x'],
- AggregationMode.MAX);
-
- assert.isBelow(c.compareMultipleFields(
- buildScalarCell(sizeInBytes_smallerIsBetter,
- [10, undefined, 12]).fields,
- buildScalarCell(sizeInBytes_smallerIsBetter, [11, 50, 12]).fields), 0);
- assert.equal(c.compareMultipleFields(
- buildScalarCell(tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- [999, undefined, -8888]).fields,
- buildScalarCell(tr.v.Unit.byName.timeDurationInMs_smallerIsBetter,
- [undefined, 999, undefined]).fields), 0);
- assert.isAbove(c.compareMultipleFields(
- buildScalarCell(sizeInBytes_smallerIsBetter,
- [10000, 10001, 10002]).fields,
- buildScalarCell(sizeInBytes_smallerIsBetter, [5, 7, 8]).fields), 0);
- assert.isBelow(c.compareMultipleFields(
- buildScalarCell(tr.v.Unit.byName.powerInWatts_smallerIsBetter,
- [17, undefined, 17]).fields,
- buildScalarCell(tr.v.Unit.byName.powerInWatts_smallerIsBetter,
- [undefined, 100, undefined]).fields), 0);
- });
-
- test('checkNumericMemoryColumn_getDiffFieldValue', function() {
- var c = new NumericMemoryColumn('test_column', ['x'],
- AggregationMode.MAX);
- function checkDiffValue(first, last, expectedDiffValue) {
- var actualDiffValue = c.getDiffFieldValue_(
- first === undefined ? undefined :
- new ScalarNumeric(sizeInBytes_smallerIsBetter, first),
- last === undefined ? undefined :
- new ScalarNumeric(sizeInBytes_smallerIsBetter, last));
- assert.closeTo(actualDiffValue, expectedDiffValue, 1e-8);
- }
-
- // Diff outside epsilon range.
- checkDiffValue(0, 0.0002, 0.0002);
- checkDiffValue(undefined, 0.0003, 0.0003);
- checkDiffValue(0.3334, 0.3332, -0.0002);
- checkDiffValue(0.0005, undefined, -0.0005);
-
- // Diff inside epsilon range.
- checkDiffValue(5, 5.00009, 0);
- checkDiffValue(undefined, 0.0000888, 0);
- checkDiffValue(0.29999, 0.3, 0);
- checkDiffValue(0.00009, undefined, 0);
- checkDiffValue(0.777777, 0.777777, 0);
- checkDiffValue(undefined, undefined, 0);
- });
-
- test('checkExpandTableRowsRecursively', function() {
- var columns = [
- {
- title: 'Single column',
- value: function(row) { return row.data; },
- width: '100px'
- }
- ];
-
- var rows = [
- {
- data: 'allocated',
- subRows: [
- {
- data: 'v8',
- subRows: []
- },
- {
- data: 'oilpan',
- subRows: [
- {
- data: 'still_visible',
- subRows: [
- {
- data: 'not_visible_any_more'
- }
- ]
- },
- {
- data: 'also_visible'
- }
- ]
- }
- ]
- },
- {
- data: 'no_sub_rows'
- },
- {
- data: 'fragmentation',
- subRows: [
- {
- data: 'internal'
- },
- {
- data: 'external',
- subRows: [
- {
- data: 'unexpanded'
- }
- ]
- }
- ]
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = columns;
- table.tableRows = rows;
- table.rebuild();
-
- expandTableRowsRecursively(table);
-
- function isExpanded(row) { return table.getExpandedForTableRow(row); }
-
- // Level 0 (3 rows) should be expanded (except for nodes which have no
- // sub-rows).
- assert.isTrue(isExpanded(rows[0] /* allocated */));
- assert.isFalse(isExpanded(rows[1] /* no_sub_rows */));
- assert.isTrue(isExpanded(rows[2] /* overhead */));
-
- // Level 1 (4 rows) should be expanded (except for nodes which have no
- // sub-rows).
- assert.isFalse(isExpanded(rows[0].subRows[0] /* allocated/v8 */));
- assert.isTrue(isExpanded(rows[0].subRows[1] /* allocated/oilpan */));
- assert.isFalse(isExpanded(rows[2].subRows[0] /* fragmentation/internal */));
- assert.isTrue(isExpanded(rows[2].subRows[1] /* fragmentation/external */));
-
- // Level 2 (3 rows) should not be expanded any more.
- assert.isFalse(isExpanded(
- rows[0].subRows[1].subRows[0] /* allocated/oilpan/still_visible */));
- assert.isFalse(isExpanded(
- rows[0].subRows[1].subRows[1] /* allocated/oilpan/also_visible */));
- assert.isFalse(isExpanded(
- rows[2].subRows[1].subRows[0] /* fragmentation/external/unexpanded */));
- });
-
- test('checkMemoryCell_extractFields', function() {
- assert.isUndefined(MemoryCell.extractFields(undefined));
-
- assert.isUndefined(MemoryCell.extractFields(new MemoryCell(undefined)));
-
- var fields = [new ScalarNumeric(sizeInBytes_smallerIsBetter, 1024)];
- assert.strictEqual(
- MemoryCell.extractFields(new MemoryCell(fields)), fields);
- });
-
- test('checkAggregateTableRowCellsRecursively', function() {
- var row = {
- testCells: {
- a: buildScalarCell(sizeInBytes_smallerIsBetter, [17])
- },
- subRows: [
- {
- // Intentionally no testCells.
- subRows: [
- {
- testCells: {
- b: buildScalarCell(sizeInBytes_smallerIsBetter, [103]),
- c: new MemoryCell(['should-not-propagate-upwards']),
- d: buildScalarCell(sizeInBytes_smallerIsBetter, [-200])
- }
- // Intentionally no subRows.
- },
- {
- testCells: {},
- subRows: []
- }
- ],
- contexts: ['skip-row-when-using-predicate']
- },
- {
- testCells: {
- b: buildScalarCell(sizeInBytes_smallerIsBetter, [20]),
- a: buildScalarCell(sizeInBytes_smallerIsBetter, [13]),
- e: buildScalarCell(sizeInBytes_smallerIsBetter, [-300])
- },
- contexts: ['don\'t-skip']
- }
- ]
- };
-
- // Without a predicate.
- var ca = new NumericMemoryColumn('column_a', ['testCells', 'a']);
- var cb = new NumericMemoryColumn('column_b', ['testCells', 'b']);
- var cc = new StringMemoryColumn('column_c', ['testCells', 'c']);
- aggregateTableRowCellsRecursively(row, [ca, cb, cc]);
- checkSizeNumericFields(row, ca, [17]);
- checkSizeNumericFields(row, cb, [123]);
- checkStringFields(row, cc, undefined);
-
- // With a predicate.
- var cd = new NumericMemoryColumn('column_d', ['testCells', 'd']);
- var ce = new NumericMemoryColumn('column_e', ['testCells', 'e']);
- aggregateTableRowCellsRecursively(row, [cd, ce], function(contexts) {
- return contexts === undefined || !contexts[0].startsWith('skip');
- });
- checkSizeNumericFields(row, cd, undefined);
- checkSizeNumericFields(row, ce, [-300]);
- });
-
- test('checkAggregateTableRowCells', function() {
- var row = {
- // Intentionally no testCells.
- otherCells: {
- a: buildScalarCell(tr.v.Unit.byName.unitlessNumber,
- [5, undefined, undefined])
- }
- };
- var subRows = [
- {
- testCells: {
- a: buildScalarCell(sizeInBytes_smallerIsBetter, [1, 9])
- },
- subRows: [
- {
- testCells: {
- c: buildScalarCell(sizeInBytes_smallerIsBetter, [13])
- }
- }
- ]
- },
- {
- testCells: {
- a: buildScalarCell(sizeInBytes_smallerIsBetter, [2, 17]),
- b: buildScalarCell(sizeInBytes_smallerIsBetter, [5])
- },
- otherCells: {
- a: buildScalarCell(tr.v.Unit.byName.unitlessNumber,
- [153, undefined, 257]),
- b: new MemoryCell(['field-should-not-propagate-upwards', ''])
- }
- }
- ];
-
- var cta = new NumericMemoryColumn('column_test_a', ['testCells', 'a']);
- var ctb = new NumericMemoryColumn('column_test_b', ['testCells', 'b']);
- var ctc = new NumericMemoryColumn('column_test_c', ['testCells', 'c']);
- var coa = new NumericMemoryColumn('column_other_a', ['otherCells', 'a']);
- var cob = new StringMemoryColumn('column_other_b', ['otherCells', 'b']);
-
- aggregateTableRowCells(row, subRows, [cta, ctb, ctc, coa, cob]);
-
- checkSizeNumericFields(row, cta, [3, 26]);
- checkSizeNumericFields(row, ctb, [5]);
- checkSizeNumericFields(row, ctc, undefined);
-
- checkNumericFields(row, coa, [5, undefined, 257],
- tr.v.Unit.byName.unitlessNumber);
- checkStringFields(row, cob, undefined);
- });
-
- test('checkCreateCells', function() {
- var values = [
- {
- a: 9,
- b: 314
- },
- {
- b: 159,
- c: undefined
- },
- undefined,
- {
- b: 265,
- d: 0
- }
- ];
-
- var mockColumn = new MemoryColumn('', [], undefined);
-
- var cells = createCells(values, function(dict) {
- var fields = {};
- tr.b.iterItems(dict, function(key, value) {
- if (value === undefined)
- return;
- fields[key] = new ScalarNumeric(sizeInBytes_smallerIsBetter, value);
- });
- return fields;
- });
- assert.deepEqual(Object.keys(cells), ['a', 'b', 'd']);
- checkSizeNumericFields(
- cells.a, mockColumn, [9, undefined, undefined, undefined]);
- checkSizeNumericFields(cells.b, mockColumn, [314, 159, undefined, 265]);
- checkSizeNumericFields(
- cells.d, mockColumn, [undefined, undefined, undefined, 0]);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_vm_regions_details_pane.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_vm_regions_details_pane.html
deleted file mode 100644
index c16df525127..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_vm_regions_details_pane.html
+++ /dev/null
@@ -1,379 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/ui/analysis/memory_dump_sub_view_util.html">
-<link rel="import" href="/tracing/ui/analysis/stacked_pane.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-a-memory-dump-vm-regions-details-pane"
- extends="tr-ui-a-stacked-pane">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
-
- #label {
- flex: 0 0 auto;
- padding: 8px;
-
- background-color: #eee;
- border-bottom: 1px solid #8e8e8e;
- border-top: 1px solid white;
-
- font-size: 15px;
- font-weight: bold;
- }
-
- #contents {
- flex: 1 0 auto;
- align-self: stretch;
- font-size: 12px;
- }
-
- #info_text {
- padding: 8px;
- color: #666;
- font-style: italic;
- text-align: center;
- }
-
- #table {
- display: none; /* Hide until memory dumps are set. */
- flex: 1 0 auto;
- align-self: stretch;
- }
- </style>
- <div id="label">Memory maps</div>
- <div id="contents">
- <div id="info_text">No memory maps selected</div>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </div>
- </template>
-</polymer-element>
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.analysis', function() {
-
- var ScalarNumeric = tr.v.ScalarNumeric;
- var sizeInBytes_smallerIsBetter =
- tr.v.Unit.byName.sizeInBytes_smallerIsBetter;
-
- var CONSTANT_COLUMN_RULES = [
- {
- condition: 'Start address',
- importance: 0,
- columnConstructor: tr.ui.analysis.StringMemoryColumn
- }
- ];
-
- var VARIABLE_COLUMN_RULES = [
- {
- condition: 'Virtual size',
- importance: 7,
- columnConstructor: tr.ui.analysis.DetailsNumericMemoryColumn
- },
- {
- condition: 'Protection flags',
- importance: 6,
- columnConstructor: tr.ui.analysis.StringMemoryColumn
- },
- {
- condition: 'PSS',
- importance: 5,
- columnConstructor: tr.ui.analysis.DetailsNumericMemoryColumn
- },
- {
- condition: 'Private dirty',
- importance: 4,
- columnConstructor: tr.ui.analysis.DetailsNumericMemoryColumn
- },
- {
- condition: 'Private clean',
- importance: 3,
- columnConstructor: tr.ui.analysis.DetailsNumericMemoryColumn
- },
- {
- condition: 'Shared dirty',
- importance: 2,
- columnConstructor: tr.ui.analysis.DetailsNumericMemoryColumn
- },
- {
- condition: 'Shared clean',
- importance: 1,
- columnConstructor: tr.ui.analysis.DetailsNumericMemoryColumn
- },
- {
- condition: 'Swapped',
- importance: 0,
- columnConstructor: tr.ui.analysis.DetailsNumericMemoryColumn
- }
- ];
-
- var BYTE_STAT_COLUMN_MAP = {
- 'proportionalResident': 'PSS',
- 'privateDirtyResident': 'Private dirty',
- 'privateCleanResident': 'Private clean',
- 'sharedDirtyResident': 'Shared dirty',
- 'sharedCleanResident': 'Shared clean',
- 'swapped': 'Swapped'
- };
-
- function hexString(address, is64BitAddress) {
- if (address === undefined)
- return undefined;
- var hexPadding = is64BitAddress ? '0000000000000000' : '00000000';
- return (hexPadding + address.toString(16)).substr(-hexPadding.length);
- }
-
- function pruneEmptyRuleRows(row) {
- if (row.subRows === undefined || row.subRows.length === 0)
- return;
-
- // Either all sub-rows are rule rows, or all sub-rows are VM region rows.
- if (row.subRows[0].rule === undefined) {
- // VM region rows: Early out to avoid filtering a large array for
- // performance reasons (no sub-rows would be removed, but the whole array
- // would be unnecessarily copied to a new array).
- return;
- }
-
- row.subRows.forEach(pruneEmptyRuleRows);
- row.subRows = row.subRows.filter(function(subRow) {
- return subRow.subRows.length > 0;
- });
- }
-
- Polymer('tr-ui-a-memory-dump-vm-regions-details-pane', {
- created: function() {
- this.vmRegions_ = undefined;
- this.aggregationMode_ = undefined;
- },
-
- ready: function() {
- this.$.table.selectionMode = tr.ui.b.TableFormat.SelectionMode.ROW;
- },
-
- /**
- * Sets the VM regions and schedules rebuilding the pane.
- *
- * The provided value should be a chronological list of lists of VM
- * regions. All VM regions are assumed to belong to the same process.
- * Example:
- *
- * [
- * [
- * // VM regions at timestamp 1.
- * tr.model.VMRegion {},
- * tr.model.VMRegion {},
- * tr.model.VMRegion {}
- * ],
- * undefined, // No VM regions provided at timestamp 2.
- * [
- * // VM regions at timestamp 3.
- * tr.model.VMRegion {},
- * tr.model.VMRegion {}
- * ]
- * ]
- */
- set vmRegions(vmRegions) {
- this.vmRegions_ = vmRegions;
- this.scheduleRebuildPane_();
- },
-
- get vmRegions() {
- return this.vmRegions_;
- },
-
- set aggregationMode(aggregationMode) {
- this.aggregationMode_ = aggregationMode;
- this.scheduleRebuildPane_();
- },
-
- get aggregationMode() {
- return this.aggregationMode_;
- },
-
- rebuildPane_: function() {
- if (this.vmRegions_ === undefined || this.vmRegions_.length === 0) {
- // Show the info text (hide the table).
- this.$.info_text.style.display = 'block';
- this.$.table.style.display = 'none';
-
- this.$.table.clear();
- this.$.table.rebuild();
- return;
- }
-
- // Show the table (hide the info text).
- this.$.info_text.style.display = 'none';
- this.$.table.style.display = 'block';
-
- var rows = this.createRows_(this.vmRegions_);
- var columns = this.createColumns_(rows);
-
- // Note: There is no need to aggregate fields of the VM regions because
- // the classification tree already takes care of that.
-
- this.$.table.tableRows = rows;
- this.$.table.tableColumns = columns;
-
- // TODO(petrcermak): This can be quite slow. Consider doing this somehow
- // asynchronously.
- this.$.table.rebuild();
-
- tr.ui.analysis.expandTableRowsRecursively(this.$.table);
- },
-
- createRows_: function(timeToVmRegionTree) {
- // Determine if any start address is outside the 32-bit range.
- var is64BitAddress = timeToVmRegionTree.some(function(vmRegionTree) {
- if (vmRegionTree === undefined)
- return false;
- return vmRegionTree.someRegion(function(region) {
- if (region.startAddress === undefined)
- return false;
- return region.startAddress >= 4294967296 /* 2^32 */;
- });
- });
-
- return [
- this.createClassificationNodeRow(timeToVmRegionTree, is64BitAddress)
- ];
- },
-
- createClassificationNodeRow: function(timeToNode, is64BitAddress) {
- // Get any defined classification node so that we can extract the
- // properties which don't change over time.
- var definedNode = tr.b.findFirstInArray(timeToNode);
-
- // Child node ID (list index) -> Timestamp (list index) ->
- // VM region classification node.
- var childNodeIdToTimeToNode = tr.b.dictionaryValues(
- tr.b.invertArrayOfDicts(timeToNode, function(node) {
- var children = node.children;
- if (children === undefined)
- return undefined;
- var childMap = {};
- children.forEach(function(childNode) {
- if (!childNode.hasRegions)
- return;
- childMap[childNode.title] = childNode;
- });
- return childMap;
- }));
- var childNodeSubRows = childNodeIdToTimeToNode.map(
- function(timeToChildNode) {
- return this.createClassificationNodeRow(
- timeToChildNode, is64BitAddress);
- }, this);
-
- // Region ID (list index) -> Timestamp (list index) -> VM region.
- var regionIdToTimeToRegion = tr.b.dictionaryValues(
- tr.b.invertArrayOfDicts(timeToNode, function(node) {
- var regions = node.regions;
- if (regions === undefined)
- return undefined;
- return tr.b.arrayToDict(regions, function(region) {
- return region.uniqueIdWithinProcess;
- });
- }));
- var regionSubRows = regionIdToTimeToRegion.map(function(timeToRegion) {
- return this.createRegionRow_(timeToRegion, is64BitAddress);
- }, this);
-
- var subRows = childNodeSubRows.concat(regionSubRows);
-
- return {
- title: definedNode.title,
- contexts: timeToNode,
- variableCells: this.createVariableCells_(timeToNode),
- subRows: subRows
- };
- },
-
- createRegionRow_: function(timeToRegion, is64BitAddress) {
- // Get any defined VM region so that we can extract the properties which
- // don't change over time.
- var definedRegion = tr.b.findFirstInArray(timeToRegion);
-
- return {
- title: definedRegion.mappedFile,
- contexts: timeToRegion,
- constantCells: this.createConstantCells_(definedRegion, is64BitAddress),
- variableCells: this.createVariableCells_(timeToRegion)
- };
- },
-
- /**
- * Create cells for VM region properties which DON'T change over time.
- *
- * Note that there are currently no such properties of classification nodes.
- */
- createConstantCells_: function(definedRegion, is64BitAddress) {
- return tr.ui.analysis.createCells([definedRegion], function(region) {
- var startAddress = region.startAddress;
- if (startAddress === undefined)
- return undefined;
- return { 'Start address': hexString(startAddress, is64BitAddress) };
- });
- },
-
- /**
- * Create cells for VM region (classification node) properties which DO
- * change over time.
- */
- createVariableCells_: function(timeToRegion) {
- return tr.ui.analysis.createCells(timeToRegion, function(region) {
- var fields = {};
-
- var sizeInBytes = region.sizeInBytes;
- if (sizeInBytes !== undefined) {
- fields['Virtual size'] = new ScalarNumeric(
- sizeInBytes_smallerIsBetter, sizeInBytes);
- }
- var protectionFlags = region.protectionFlagsToString;
- if (protectionFlags !== undefined)
- fields['Protection flags'] = protectionFlags;
-
- tr.b.iterItems(BYTE_STAT_COLUMN_MAP,
- function(byteStatName, columnName) {
- var byteStat = region.byteStats[byteStatName];
- if (byteStat === undefined)
- return;
- fields[columnName] = new ScalarNumeric(
- sizeInBytes_smallerIsBetter, byteStat);
- });
-
- return fields;
- });
- },
-
- createColumns_: function(rows) {
- var titleColumn = new tr.ui.analysis.TitleColumn('Mapped file');
- titleColumn.width = '200px';
-
- var constantColumns = tr.ui.analysis.MemoryColumn.fromRows(
- rows, 'constantCells', undefined, CONSTANT_COLUMN_RULES);
- var variableColumns = tr.ui.analysis.MemoryColumn.fromRows(
- rows, 'variableCells', this.aggregationMode_, VARIABLE_COLUMN_RULES);
- var fieldColumns = constantColumns.concat(variableColumns);
- tr.ui.analysis.MemoryColumn.spaceEqually(fieldColumns);
-
- var columns = [titleColumn].concat(fieldColumns);
- return columns;
- }
- });
-
- return {};
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_vm_regions_details_pane_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_vm_regions_details_pane_test.html
deleted file mode 100644
index 9c79c1b5753..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/memory_dump_vm_regions_details_pane_test.html
+++ /dev/null
@@ -1,489 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/container_memory_dump.html">
-<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
-<link rel="import" href="/tracing/model/vm_region.html">
-<link rel="import"
- href="/tracing/ui/analysis/memory_dump_sub_view_test_utils.html">
-<link rel="import" href="/tracing/ui/analysis/memory_dump_sub_view_util.html">
-<link rel="import"
- href="/tracing/ui/analysis/memory_dump_vm_regions_details_pane.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newAllocatorDump = tr.model.MemoryDumpTestUtils.newAllocatorDump;
- var VMRegion = tr.model.VMRegion;
- var VMRegionClassificationNode = tr.model.VMRegionClassificationNode;
- var TitleColumn = tr.ui.analysis.TitleColumn;
- var StringMemoryColumn = tr.ui.analysis.StringMemoryColumn;
- var NumericMemoryColumn = tr.ui.analysis.NumericMemoryColumn;
- var AggregationMode = tr.ui.analysis.MemoryColumn.AggregationMode;
- var addGlobalMemoryDump = tr.model.MemoryDumpTestUtils.addGlobalMemoryDump;
- var addProcessMemoryDump = tr.model.MemoryDumpTestUtils.addProcessMemoryDump;
- var checkSizeNumericFields = tr.ui.analysis.checkSizeNumericFields;
- var checkStringFields = tr.ui.analysis.checkStringFields;
- var checkColumns = tr.ui.analysis.checkColumns;
- var isElementDisplayed = tr.ui.analysis.isElementDisplayed;
- var DETAILED = tr.model.ContainerMemoryDump.LevelOfDetail.DETAILED;
-
- function createVMRegions() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var process = model.getOrCreateProcess(1);
-
- // First timestamp.
- var gmd1 = addGlobalMemoryDump(model, 42, DETAILED);
- var pmd1 = addProcessMemoryDump(gmd1, process, 42);
- pmd1.vmRegions = VMRegionClassificationNode.fromRegions([
- VMRegion.fromDict({
- mappedFile: '/lib/chrome.so',
- startAddress: 65536,
- sizeInBytes: 536870912,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_EXECUTE,
- byteStats: {
- proportionalResident: 8192
- }
- }),
- VMRegion.fromDict({
- mappedFile: '/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0',
- startAddress: 140296983150592,
- sizeInBytes: 2097152,
- protectionFlags: 0,
- byteStats: {
- proportionalResident: 0
- }
- }),
- VMRegion.fromDict({
- startAddress: 10995116277760,
- sizeInBytes: 2147483648,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_WRITE,
- byteStats: {
- privateDirtyResident: 0,
- swapped: 0
- }
- }),
- VMRegion.fromDict({
- startAddress: 12094627905536,
- sizeInBytes: 2147483648,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_WRITE,
- byteStats: {
- privateDirtyResident: 0,
- swapped: 0
- }
- }),
- VMRegion.fromDict({
- mappedFile: '/dev/ashmem/dalvik-zygote space',
- startAddress: 13194139533312,
- sizeInBytes: 100,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_EXECUTE,
- byteStats: {
- proportionalResident: 100,
- privateDirtyResident: 0,
- swapped: 0
- }
- }),
- VMRegion.fromDict({
- mappedFile: '/dev/ashmem/libc malloc',
- startAddress: 14293651161088,
- sizeInBytes: 200,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_EXECUTE,
- byteStats: {
- proportionalResident: 200,
- privateDirtyResident: 96,
- swapped: 0
- }
- })
- ]);
-
- // This is here so that we could test that tracing is discounted from the
- // 'Native heap' category.
- pmd1.memoryAllocatorDumps = [
- newAllocatorDump(pmd1, 'tracing', { size: 500, resident_size: 32 })
- ];
-
- // Second timestamp.
- var gmd2 = addGlobalMemoryDump(model, 42, DETAILED);
- var pmd2 = addProcessMemoryDump(gmd2, process, 42);
- pmd2.vmRegions = VMRegionClassificationNode.fromRegions([
- VMRegion.fromDict({
- mappedFile: '/lib/chrome.so',
- startAddress: 65536,
- sizeInBytes: 536870912,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_EXECUTE,
- byteStats: {
- proportionalResident: 9216
- }
- }),
- VMRegion.fromDict({
- mappedFile: '/lib/chrome.so',
- startAddress: 140296983150592,
- sizeInBytes: 536870912,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_EXECUTE,
- byteStats: {
- proportionalResident: 10240
- }
- }),
- VMRegion.fromDict({
- startAddress: 10995116277760,
- sizeInBytes: 2147483648,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_WRITE,
- byteStats: {
- privateDirtyResident: 0,
- swapped: 32
- }
- }),
- VMRegion.fromDict({
- startAddress: 12094627905536,
- sizeInBytes: 2147483648,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_WRITE,
- byteStats: {
- privateDirtyResident: 0,
- swapped: 0
- }
- }),
- VMRegion.fromDict({
- mappedFile: '/dev/ashmem/dalvik-zygote space',
- startAddress: 13194139533312,
- sizeInBytes: 100,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_EXECUTE,
- byteStats: {
- proportionalResident: 0,
- privateDirtyResident: 100,
- swapped: 0
- }
- }),
- VMRegion.fromDict({
- mappedFile: '/dev/ashmem/libc malloc',
- startAddress: 14293651161088,
- sizeInBytes: 200,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ |
- VMRegion.PROTECTION_FLAG_EXECUTE,
- byteStats: {
- proportionalResident: 100,
- privateDirtyResident: 96,
- swapped: 0
- }
- }),
- VMRegion.fromDict({
- mappedFile: '/usr/share/fonts/DejaVuSansMono.ttf',
- startAddress: 140121259503616,
- sizeInBytes: 335872,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ,
- byteStats: {
- proportionalResident: 22528
- }
- }),
- VMRegion.fromDict({
- mappedFile: 'another-map',
- startAddress: 52583094233905872,
- sizeInBytes: 1,
- byteStats: {
- proportionalResident: 1,
- privateDirtyResident: 1,
- swapped: 1
- }
- })
- ]);
- });
-
- return model.processes[1].memoryDumps.map(function(pmd) {
- return pmd.mostRecentVmRegions;
- });
- }
-
- var EXPECTED_COLUMNS = [
- { title: 'Mapped file', type: TitleColumn, noAggregation: true },
- { title: 'Start address', type: StringMemoryColumn, noAggregation: true },
- { title: 'Virtual size', type: NumericMemoryColumn },
- { title: 'Protection flags', type: StringMemoryColumn },
- { title: 'PSS', type: NumericMemoryColumn },
- { title: 'Private dirty', type: NumericMemoryColumn },
- { title: 'Swapped', type: NumericMemoryColumn }
- ];
-
- function checkRow(columns, row, expectedTitle, expectedStartAddress,
- expectedVirtualSize, expectedProtectionFlags,
- expectedProportionalResidentValues, expectedPrivateDirtyResidentValues,
- expectedSwappedValues, expectedSubRowCount, expectedContexts) {
- assert.equal(columns[0].formatTitle(row), expectedTitle);
- checkStringFields(row, columns[1], expectedStartAddress);
- checkSizeNumericFields(row, columns[2], expectedVirtualSize);
- checkStringFields(row, columns[3], expectedProtectionFlags);
- checkSizeNumericFields(row, columns[4], expectedProportionalResidentValues);
- checkSizeNumericFields(row, columns[5], expectedPrivateDirtyResidentValues);
- checkSizeNumericFields(row, columns[6], expectedSwappedValues);
-
- if (expectedSubRowCount === undefined)
- assert.isUndefined(row.subRows);
- else
- assert.lengthOf(row.subRows, expectedSubRowCount);
-
- if (typeof expectedContexts === 'function')
- expectedContexts(row.contexts);
- else if (expectedContexts !== undefined)
- assert.deepEqual(tr.b.asArray(row.contexts), expectedContexts);
- else
- assert.isUndefined(row.contexts);
- }
-
- function genericMatcher(callback, defined) {
- return function(actualValues) {
- assert.lengthOf(actualValues, defined.length);
- for (var i = 0; i < defined.length; i++) {
- var actualValue = actualValues[i];
- if (defined[i])
- callback(actualValue);
- else
- assert.isUndefined(actualValue);
- }
- }
- }
-
- function vmRegionsMatcher(expectedMappedFile, expectedStartAddress, defined) {
- return genericMatcher(function(actualRegion) {
- assert.instanceOf(actualRegion, VMRegion);
- assert.strictEqual(actualRegion.mappedFile, expectedMappedFile);
- assert.strictEqual(actualRegion.startAddress, expectedStartAddress);
- }, defined);
- }
-
- function classificationNodesMatcher(expectedTitle, defined) {
- return genericMatcher(function(actualNode) {
- assert.instanceOf(actualNode, VMRegionClassificationNode);
- assert.strictEqual(actualNode.title, expectedTitle);
- }, defined);
- }
-
- test('instantiate_empty', function() {
- tr.ui.analysis.createAndCheckEmptyPanes(this,
- 'tr-ui-a-memory-dump-vm-regions-details-pane', 'vmRegions',
- function(viewEl) {
- // Check that the info text is shown.
- assert.isTrue(isElementDisplayed(viewEl.$.info_text));
- assert.isFalse(isElementDisplayed(viewEl.$.table));
- });
- });
-
- test('instantiate_single', function() {
- var vmRegions = createVMRegions().slice(0, 1);
-
- var viewEl = document.createElement(
- 'tr-ui-a-memory-dump-vm-regions-details-pane');
- viewEl.vmRegions = vmRegions;
- viewEl.rebuild();
- this.addHTMLOutput(viewEl);
-
- // Check that the table is shown.
- assert.isTrue(isElementDisplayed(viewEl.$.table));
- assert.isFalse(isElementDisplayed(viewEl.$.info_text));
-
- var table = viewEl.$.table;
- var columns = table.tableColumns;
- checkColumns(columns, EXPECTED_COLUMNS, undefined /* no aggregation */);
- var rows = table.tableRows;
- assert.lengthOf(rows, 1);
-
- // Check the rows of the table.
- var totalRow = rows[0];
- checkRow(columns, totalRow, 'Total', undefined, [4833935160], undefined,
- [8460], [64], [0], 3, vmRegions);
-
- var androidRow = totalRow.subRows[0];
- checkRow(columns, androidRow, 'Android', undefined, [100], undefined,
- [100], [0], [0], 1, classificationNodesMatcher('Android', [true]));
-
- var javaRuntimeRow = androidRow.subRows[0];
- checkRow(columns, javaRuntimeRow, 'Java runtime', undefined, [100],
- undefined, [100], [0], [0], 1,
- classificationNodesMatcher('Java runtime', [true]));
-
- var spacesRow = javaRuntimeRow.subRows[0];
- checkRow(columns, spacesRow, 'Spaces', undefined, [100], undefined, [100],
- [0], [0], 1, classificationNodesMatcher('Spaces', [true]));
-
- var nativeHeapRow = totalRow.subRows[1];
- checkRow(columns, nativeHeapRow, 'Native heap', undefined, [4294966996],
- undefined, [168], [64], [0], 4,
- classificationNodesMatcher('Native heap', [true]));
-
- var discountedTracingOverheadRow = nativeHeapRow.subRows[3];
- checkRow(columns, discountedTracingOverheadRow,
- '[discounted tracing overhead]', undefined, [-500], undefined, [-32],
- [-32], undefined, undefined,
- vmRegionsMatcher('[discounted tracing overhead]', undefined, [true]));
-
- var filesRow = totalRow.subRows[2];
- checkRow(columns, filesRow, 'Files', undefined, [538968064], undefined,
- [8192], undefined, undefined, 1,
- classificationNodesMatcher('Files', [true]));
-
- var soRow = filesRow.subRows[0];
- checkRow(columns, soRow, 'so', undefined, [538968064], undefined,
- [8192], undefined, undefined, 2,
- classificationNodesMatcher('so', [true]));
-
- var mmapChromeRow = soRow.subRows[0];
- checkRow(columns, mmapChromeRow, '/lib/chrome.so', ['0000000000010000'],
- [536870912], ['r-xp'], [8192], undefined, undefined, undefined,
- vmRegionsMatcher('/lib/chrome.so', 65536, [true]));
-
- var mmapLibX11Row = soRow.subRows[1];
- checkRow(columns, mmapLibX11Row,
- '/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0', ['00007f996fd80000'],
- [2097152], ['---p'], [0], undefined, undefined, undefined,
- vmRegionsMatcher('/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0',
- 140296983150592, [true]));
- });
-
- test('instantiate_multipleDiff', function() {
- var vmRegions = createVMRegions();
-
- var viewEl = document.createElement(
- 'tr-ui-a-memory-dump-vm-regions-details-pane');
- viewEl.vmRegions = vmRegions;
- viewEl.aggregationMode = AggregationMode.DIFF;
- viewEl.rebuild();
- this.addHTMLOutput(viewEl);
-
- // Check that the table is shown.
- assert.isTrue(isElementDisplayed(viewEl.$.table));
- assert.isFalse(isElementDisplayed(viewEl.$.info_text));
-
- var table = viewEl.$.table;
- var columns = table.tableColumns;
- checkColumns(columns, EXPECTED_COLUMNS, AggregationMode.DIFF);
- var rows = table.tableRows;
- assert.lengthOf(rows, 1);
-
- // Check the rows of the table.
- var totalRow = rows[0];
- checkRow(columns, totalRow, 'Total', undefined, [4833935160, 5369045293],
- undefined, [8460, 42085], [64, 197], [0, 33], 4, vmRegions);
-
- var androidRow = totalRow.subRows[0];
- checkRow(columns, androidRow, 'Android', undefined, [100, 100], undefined,
- [100, 0], [0, 100], [0, 0], 1,
- classificationNodesMatcher('Android', [true, true]));
-
- var javaRuntimeRow = androidRow.subRows[0];
- checkRow(columns, javaRuntimeRow, 'Java runtime', undefined, [100, 100],
- undefined, [100, 0], [0, 100], [0, 0], 1,
- classificationNodesMatcher('Java runtime', [true, true]));
-
- var spacesRow = javaRuntimeRow.subRows[0];
- checkRow(columns, spacesRow, 'Spaces', undefined, [100, 100], undefined,
- [100, 0], [0, 100], [0, 0], 1,
- classificationNodesMatcher('Spaces', [true, true]));
-
- var nativeHeapRow = totalRow.subRows[1];
- checkRow(columns, nativeHeapRow, 'Native heap', undefined,
- [4294966996, 4294967496], undefined, [168, 100], [64, 96], [0, 32], 4,
- classificationNodesMatcher('Native heap', [true, true]));
-
- var discountedTracingOverheadRow = nativeHeapRow.subRows[3];
- checkRow(columns, discountedTracingOverheadRow,
- '[discounted tracing overhead]', undefined, [-500, undefined],
- undefined, [-32, undefined], [-32, undefined], undefined, undefined,
- vmRegionsMatcher('[discounted tracing overhead]', undefined,
- [true, false]));
-
- var filesRow = totalRow.subRows[2];
- checkRow(columns, filesRow, 'Files', undefined, [538968064, 1074077696],
- undefined, [8192, 41984], undefined, undefined, 2,
- classificationNodesMatcher('Files', [true, true]));
-
- var soRow = filesRow.subRows[0];
- checkRow(columns, soRow, 'so', undefined, [538968064, 1073741824],
- undefined, [8192, 19456], undefined, undefined, 3,
- classificationNodesMatcher('so', [true, true]));
-
- var mmapChromeRow = soRow.subRows[0];
- checkRow(columns, mmapChromeRow, '/lib/chrome.so', ['0000000000010000'],
- [536870912, 536870912], ['r-xp', 'r-xp'], [8192, 9216], undefined,
- undefined, undefined,
- vmRegionsMatcher('/lib/chrome.so', 65536, [true, true]));
-
- var mmapLibX11Row = soRow.subRows[1];
- checkRow(columns, mmapLibX11Row,
- '/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0', ['00007f996fd80000'],
- [2097152, undefined], ['---p', undefined], [0, undefined], undefined,
- undefined, undefined,
- vmRegionsMatcher('/usr/lib/x86_64-linux-gnu/libX11.so.6.3.0',
- 140296983150592, [true, false]));
-
- var otherRow = totalRow.subRows[3];
- checkRow(columns, otherRow, 'Other', undefined, [undefined, 1], undefined,
- [undefined, 1], [undefined, 1], [undefined, 1], 1,
- classificationNodesMatcher('Other', [false, true]));
-
- var anotherMapRow = otherRow.subRows[0];
- checkRow(columns, anotherMapRow, 'another-map', ['00bad00bad00bad0'],
- [undefined, 1], undefined, [undefined, 1], [undefined, 1],
- [undefined, 1], undefined,
- vmRegionsMatcher('another-map', 52583094233905872, [false, true]));
- });
-
- test('instantiate_multipleMax', function() {
- var vmRegions = createVMRegions();
-
- var viewEl = document.createElement(
- 'tr-ui-a-memory-dump-vm-regions-details-pane');
- viewEl.vmRegions = vmRegions;
- viewEl.aggregationMode = AggregationMode.MAX;
- viewEl.rebuild();
- this.addHTMLOutput(viewEl);
-
- // Check that the table is shown.
- assert.isTrue(isElementDisplayed(viewEl.$.table));
- assert.isFalse(isElementDisplayed(viewEl.$.info_text));
-
- // Just check that the aggregation mode was propagated to the columns.
- var table = viewEl.$.table;
- var columns = table.tableColumns;
- checkColumns(columns, EXPECTED_COLUMNS, AggregationMode.MAX);
- var rows = table.tableRows;
- assert.lengthOf(rows, 1);
- });
-
- test('instantiate_multipleWithUndefined', function() {
- var vmRegions = createVMRegions();
- vmRegions.splice(1, 0, undefined);
-
- var viewEl = document.createElement(
- 'tr-ui-a-memory-dump-vm-regions-details-pane');
- viewEl.vmRegions = vmRegions;
- viewEl.aggregationMode = AggregationMode.DIFF;
- viewEl.rebuild();
- this.addHTMLOutput(viewEl);
-
- // Check that the table is shown.
- assert.isTrue(isElementDisplayed(viewEl.$.table));
- assert.isFalse(isElementDisplayed(viewEl.$.info_text));
-
- // Just check that the table has the right shape.
- var table = viewEl.$.table;
- var columns = table.tableColumns;
- checkColumns(columns, EXPECTED_COLUMNS, AggregationMode.DIFF);
- var rows = table.tableRows;
- assert.lengthOf(rows, 1);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_async_slice_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_async_slice_sub_view.html
deleted file mode 100644
index f062aca2336..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_async_slice_sub_view.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/related_events.html">
-
-<polymer-element name="tr-ui-a-multi-async-slice-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- }
- #container {
- display: flex;
- flex: 1 1 auto;
- }
- #events {
- margin-left: 8px;
- flex: 0 1 200px;
- }
- </style>
- <div id="container">
- <tr-ui-a-multi-event-sub-view id="content"></tr-ui-a-multi-event-sub-view>
- <div id="events">
- <tr-ui-a-related-events id="relatedEvents"></tr-ui-a-related-events>
- </div>
- </div>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- get selection() {
- return this.$.content.selection;
- },
-
- set selection(selection) {
- this.$.content.selection = selection;
- this.$.relatedEvents.setRelatedEvents(selection);
- if (this.$.relatedEvents.hasRelatedEvents()) {
- this.$.relatedEvents.style.display = '';
- } else {
- this.$.relatedEvents.style.display = 'none';
- }
- },
-
- get relatedEventsToHighlight() {
- if (!this.$.content.selection)
- return undefined;
- var selection = new tr.model.EventSet();
- this.$.content.selection.forEach(function(asyncEvent) {
- if (!asyncEvent.associatedEvents)
- return;
- asyncEvent.associatedEvents.forEach(function(event) {
- selection.push(event);
- });
- });
- if (selection.length)
- return selection;
- return undefined;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_async_slice_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_async_slice_sub_view_test.html
deleted file mode 100644
index f3db7675156..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_async_slice_sub_view_test.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/multi_async_slice_sub_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newAsyncSliceEx = tr.c.TestUtils.newAsyncSliceEx;
-
- test('instantiate', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
- t1.asyncSliceGroup.push(newAsyncSliceEx({
- title: 'a',
- start: 10,
- end: 20,
- startThread: t1,
- endThread: t1
- }));
- t1.asyncSliceGroup.push(newAsyncSliceEx({
- title: 'b',
- start: 25,
- end: 40,
- startThread: t1,
- endThread: t1
- }));
-
- var selection = new tr.model.EventSet();
- selection.push(t1.asyncSliceGroup.slices[0]);
- selection.push(t1.asyncSliceGroup.slices[1]);
-
- var viewEl = document.createElement('tr-ui-a-multi-async-slice-sub-view');
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_cpu_slice_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_cpu_slice_sub_view.html
deleted file mode 100644
index f4f5215a004..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_cpu_slice_sub_view.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_sub_view.html">
-
-<polymer-element name="tr-ui-a-multi-cpu-slice-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- }
- #content {
- flex: 1 1 auto;
- }
- </style>
- <tr-ui-a-multi-event-sub-view id="content"></tr-ui-a-multi-event-sub-view>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.$.content.eventsHaveSubRows = false;
- },
-
- get selection() {
- return this.$.content.selection;
- },
-
- set selection(selection) {
- this.$.content.setSelectionWithoutErrorChecks(selection);
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_cpu_slice_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_cpu_slice_sub_view_test.html
deleted file mode 100644
index b0f8eb266a2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_cpu_slice_sub_view_test.html
+++ /dev/null
@@ -1,49 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/multi_cpu_slice_sub_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function createBasicModel() {
- var lines = [
- 'Android.launcher-584 [001] d..3 12622.506890: sched_switch: prev_comm=Android.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck
- ' Binder_1-217 [001] d..3 12622.506918: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=D ==> next_comm=Android.launcher next_pid=584 next_prio=120', // @suppress longLineCheck
- 'Android.launcher-584 [001] d..4 12622.506936: sched_wakeup: comm=Binder_1 pid=217 prio=120 success=1 target_cpu=001', // @suppress longLineCheck
- 'Android.launcher-584 [001] d..3 12622.506950: sched_switch: prev_comm=Android.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck
- ' Binder_1-217 [001] ...1 12622.507057: tracing_mark_write: B|128|queueBuffer', // @suppress longLineCheck
- ' Binder_1-217 [001] ...1 12622.507175: tracing_mark_write: E',
- ' Binder_1-217 [001] d..3 12622.507253: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=S ==> next_comm=Android.launcher next_pid=584 next_prio=120' // @suppress longLineCheck
- ];
-
- return tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shiftWorldToZero: false
- });
- }
-
- test('instantiate', function() {
- var m = createBasicModel();
- var cpu = m.kernel.cpus[1];
- assert.isDefined(cpu);
-
- var selection = new tr.model.EventSet();
- selection.push(cpu.slices[0]);
- selection.push(cpu.slices[1]);
-
- var viewEl = document.createElement('tr-ui-a-multi-cpu-slice-sub-view');
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_details_table.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_details_table.html
deleted file mode 100644
index 101137cdcb6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_details_table.html
+++ /dev/null
@@ -1,333 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_summary.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name='tr-ui-a-multi-event-details-table'>
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
- #table {
- flex: 1 1 auto;
- align-self: stretch;
- }
-
- #titletable {
- font-weight: bold;
- }
-
- #title-info {
- font-size: 12px;
- }
- </style>
- <tr-ui-b-table id="titletable">
- </tr-ui-b-table>
- <tr-ui-b-table id="table">
- </tr-ui-b-table>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.selection_ = undefined;
- this.eventsHaveDuration_ = true;
- this.eventsHaveSubRows_ = true;
- },
-
- ready: function() {
- this.initTitleTable_();
- },
-
- get eventsHaveDuration() {
- return this.eventsHaveDuration_;
- },
-
- set eventsHaveDuration(eventsHaveDuration) {
- this.eventsHaveDuration_ = eventsHaveDuration;
- this.updateContents_();
- },
-
- get eventsHaveSubRows() {
- return this.eventsHaveSubRows_;
- },
-
- set eventsHaveSubRows(eventsHaveSubRows) {
- this.eventsHaveSubRows_ = eventsHaveSubRows;
- this.updateContents_();
- },
-
- get selection() {
- return this.selection_;
- },
-
- set selection(selection) {
- this.selection_ = selection;
- this.updateContents_();
- },
-
- updateContents_: function() {
- var selection = this.selection_;
-
- this.updateTitleTable_();
-
- if (this.selection_ === undefined) {
- this.$.table.tableRows = [];
- this.$.table.tableFooterRows = [];
- this.$.table.rebuild();
- return;
- }
-
- var summary = new tr.ui.analysis.MultiEventSummary(
- 'Totals', this.selection_);
- this.updateColumns_(summary);
- this.updateRows_(summary);
- this.$.table.rebuild();
- },
-
- initTitleTable_: function() {
- var table = this.$.titletable;
-
- table.showHeader = false;
- table.tableColumns = [
- {
- title: 'Title',
- value: function(row) { return row.title; },
- width: '350px'
- },
- {
- title: 'Value',
- width: '100%',
- value: function(row) {
- return row.value;
- }
- }
- ];
- },
-
- getSelectionTitle_: function() {
- if (!this.selection || !this.selection.length)
- return '<No selection>';
-
- var firstTitle = tr.b.getFirstElement(this.selection).title;
- if (!tr.b.every(this.selection, (event) => event.title === firstTitle))
- return '<Different titles>';
-
- return firstTitle;
- },
-
- updateTitleTable_: function() {
- this.$.titletable.tableRows = [{
- title: 'Title',
- value: this.getSelectionTitle_()
- }];
- },
-
- updateColumns_: function(summary) {
- var hasCpuData;
- if (summary.cpuDuration !== undefined)
- hasCpuData = true;
- if (summary.cpuSelfTime !== undefined)
- hasCpuData = true;
-
- var colWidthPercentage;
- if (hasCpuData)
- colWidthPercentage = '20%';
- else
- colWidthPercentage = '33.3333%';
-
- var ownerDocument = this.ownerDocument;
- var columns = [];
-
- columns.push({
- title: 'Start',
- value: function(row) {
- if (row.__proto__ === tr.ui.analysis.MultiEventSummary.prototype) {
- return row.title;
- }
-
- var linkEl = document.createElement('tr-ui-a-analysis-link');
- linkEl.setSelectionAndContent(function() {
- return new tr.model.EventSet(row.event);
- });
- linkEl.appendChild(tr.v.ui.createScalarSpan(row.start, {
- unit: tr.v.Unit.byName.timeStampInMs,
- ownerDocument: ownerDocument
- }));
- return linkEl;
- },
- width: '350px',
- cmp: function(rowA, rowB) {
- return rowA.start - rowB.start;
- }
- });
-
- if (this.eventsHaveDuration_) {
- columns.push({
- title: 'Wall Duration (ms)',
- value: function(row) {
- return tr.v.ui.createScalarSpan(row.duration, {
- unit: tr.v.Unit.byName.timeDurationInMs,
- ownerDocument: ownerDocument
- });
- },
- width: '<upated further down>',
- cmp: function(rowA, rowB) {
- return rowA.duration - rowB.duration;
- }
- });
- }
-
- if (this.eventsHaveDuration_ && hasCpuData) {
- columns.push({
- title: 'CPU Duration (ms)',
- value: function(row) {
- return tr.v.ui.createScalarSpan(row.cpuDuration, {
- unit: tr.v.Unit.byName.timeDurationInMs,
- ownerDocument: ownerDocument
- });
- },
- width: '<upated further down>',
- cmp: function(rowA, rowB) {
- return rowA.cpuDuration - rowB.cpuDuration;
- }
- });
- }
-
- if (this.eventsHaveSubRows_ && this.eventsHaveDuration_) {
- columns.push({
- title: 'Self time (ms)',
- value: function(row) {
- return tr.v.ui.createScalarSpan(row.selfTime, {
- unit: tr.v.Unit.byName.timeDurationInMs,
- ownerDocument: ownerDocument
- });
- },
- width: '<upated further down>',
- cmp: function(rowA, rowB) {
- return rowA.selfTime - rowB.selfTime;
- }
- });
- }
-
- if (this.eventsHaveSubRows_ && this.eventsHaveDuration_ && hasCpuData) {
- columns.push({
- title: 'CPU Self Time (ms)',
- value: function(row) {
- return tr.v.ui.createScalarSpan(row.cpuSelfTime, {
- unit: tr.v.Unit.byName.timeDurationInMs,
- ownerDocument: ownerDocument
- });
- },
- width: '<upated further down>',
- cmp: function(rowA, rowB) {
- return rowA.cpuSelfTime - rowB.cpuSelfTime;
- }
- });
- }
-
- var argKeys = tr.b.dictionaryKeys(summary.totalledArgs);
- argKeys.sort();
-
- var otherKeys = summary.untotallableArgs.slice(0);
- otherKeys.sort();
-
- argKeys.push.apply(argKeys, otherKeys);
- var keysWithColumns = argKeys.slice(0, 4);
- var keysInOtherColumn = argKeys.slice(4);
-
- keysWithColumns.forEach(function(argKey) {
-
- var hasTotal = summary.totalledArgs[argKey];
- var colDesc = {
- title: 'Arg: ' + argKey,
- value: function(row) {
- if (row.__proto__ !== tr.ui.analysis.MultiEventSummary.prototype) {
- var argView =
- document.createElement('tr-ui-a-generic-object-view');
- argView.object = row.args[argKey];
- return argView;
- }
- if (hasTotal)
- return row.totalledArgs[argKey];
- return '';
- },
- width: '<upated further down>'
- };
- if (hasTotal) {
- colDesc.cmp = function(rowA, rowB) {
- return rowA.args[argKey] - rowB.args[argKey];
- };
- }
- columns.push(colDesc);
- });
-
- if (keysInOtherColumn.length) {
- columns.push({
- title: 'Other Args',
- value: function(row) {
- if (row.__proto__ === tr.ui.analysis.MultiEventSummary.prototype)
- return '';
- var argView =
- document.createElement('tr-ui-a-generic-object-view');
- var obj = {};
- for (var i = 0; i < keysInOtherColumn.length; i++)
- obj[keysInOtherColumn[i]] = row.args[keysInOtherColumn[i]];
- argView.object = obj;
- return argView;
- },
- width: '<upated further down>'
- });
- }
-
- var colWidthPercentage;
- if (columns.length == 1)
- colWidthPercentage = '100%';
- else
- colWidthPercentage = (100 / (columns.length - 1)).toFixed(3) + '%';
-
- for (var i = 1; i < columns.length; i++)
- columns[i].width = colWidthPercentage;
-
- this.$.table.tableColumns = columns;
- },
-
- updateRows_: function(summary) {
- this.$.table.sortColumnIndex = 0;
- function Row(event) {
- this.event = event;
- }
- Row.prototype = {
- get start() { return this.event.start; },
- get duration() { return this.event.duration; },
- get cpuDuration() { return this.event.cpuDuration; },
- get selfTime() { return this.event.selfTime; },
- get cpuSelfTime() { return this.event.cpuSelfTime; },
- get args() { return this.event.args; }
- };
-
- this.$.table.tableRows = this.selection_.map(function(event) {
- return new Row(event);
- });
- this.$.table.footerRows = [summary];
- }
- });
-</script>
-</polymer-element>
-
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_details_table_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_details_table_test.html
deleted file mode 100644
index 0bf2d13e081..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_details_table_test.html
+++ /dev/null
@@ -1,171 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_details_table.html">
-<link rel="import" href="/tracing/ui/base/deep_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Model = tr.Model;
- var Thread = tr.model.Thread;
- var EventSet = tr.model.EventSet;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
-
- test('sortingOfFirstColumn', function() {
- var model = new Model();
- var thread = model.getOrCreateProcess(1).getOrCreateThread(2);
- var tsg = thread.sliceGroup;
- var sA = tsg.pushSlice(newSliceEx({title: 'a', start: 1, end: 2,
- cpuStart: 1, cpuEnd: 1.75}));
- var sB = tsg.pushSlice(newSliceEx({title: 'a', start: 0, end: 3,
- cpuStart: 0, cpuEnd: 3}));
- var sC = tsg.pushSlice(newSliceEx({title: 'a', start: 4, end: 5,
- cpuStart: 3, cpuEnd: 3.75}));
- tsg.createSubSlices();
-
- var threadTrack = {};
- threadTrack.thread = thread;
-
- var selection = new EventSet(tsg.slices);
-
- var viewEl = document.createElement('tr-ui-a-multi-event-details-table');
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
-
- var table = viewEl.$.table;
- var cmpResult = table.tableColumns[0].cmp(sA, sB);
- assert.equal(cmpResult, 1);
- });
-
- test('withCpuTime', function() {
- var model = new Model();
- var thread = model.getOrCreateProcess(1).getOrCreateThread(2);
- var tsg = thread.sliceGroup;
- tsg.pushSlice(newSliceEx({title: 'a', start: 0, end: 3,
- cpuStart: 0, cpuEnd: 3}));
- tsg.pushSlice(newSliceEx({title: 'a', start: 1, end: 2,
- cpuStart: 1, cpuEnd: 1.75}));
- tsg.pushSlice(newSliceEx({title: 'a', start: 4, end: 5,
- cpuStart: 3, cpuEnd: 3.75}));
- tsg.createSubSlices();
-
- var threadTrack = {};
- threadTrack.thread = thread;
-
- var selection = new EventSet(tsg.slices);
-
- var viewEl = document.createElement('tr-ui-a-multi-event-details-table');
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
- });
-
- test('withoutCpuTime', function() {
- var model = new Model();
- var thread = model.getOrCreateProcess(1).getOrCreateThread(2);
- var tsg = thread.sliceGroup;
- tsg.pushSlice(newSliceEx({title: 'a', start: 0, end: 3}));
- tsg.pushSlice(newSliceEx({title: 'a', start: 1, end: 2}));
- tsg.pushSlice(newSliceEx({title: 'a', start: 4, end: 5}));
- tsg.createSubSlices();
-
- var threadTrack = {};
- threadTrack.thread = thread;
-
- var selection = new EventSet(tsg.slices);
-
- var viewEl = document.createElement('tr-ui-a-multi-event-details-table');
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
- });
-
-
- test('withFewerThanFourArgs', function() {
- var model = new Model();
- var thread = model.getOrCreateProcess(1).getOrCreateThread(2);
- var tsg = thread.sliceGroup;
- tsg.pushSlice(newSliceEx({title: 'a', start: 0, end: 3,
- args: {value1: 3, value2: 'x', value3: 1}}));
- tsg.pushSlice(newSliceEx({title: 'b', start: 1, end: 2,
- args: {value1: 3.1, value2: 'y', value3: 2}}));
- tsg.pushSlice(newSliceEx({title: 'b', start: 4, end: 5,
- args: {value1: 3.2, value2: 'z', value3: 'x'}}));
- tsg.createSubSlices();
-
- var threadTrack = {};
- threadTrack.thread = thread;
-
- var selection = new EventSet(tsg.slices);
-
- var viewEl = document.createElement('tr-ui-a-multi-event-details-table');
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
- });
-
- test('withExtraArgs', function() {
- var model = new Model();
- var thread = model.getOrCreateProcess(1).getOrCreateThread(2);
- var tsg = thread.sliceGroup;
- tsg.pushSlice(newSliceEx({title: 'a', start: 0, end: 3,
- args: {value1: 3, value2: 'x', value3: 1,
- value4: 4, value5: 5, value6: 6}}));
- tsg.pushSlice(newSliceEx({title: 'b', start: 1, end: 2,
- args: {value1: 3.1, value2: 'y', value3: 2,
- value4: 4, value5: 5, value6: 6}}));
- tsg.pushSlice(newSliceEx({title: 'b', start: 4, end: 5,
- args: {value1: 3.2, value2: 'z', value3: 'x',
- value4: 4, value5: 'whoops', value6: 6}}));
- tsg.createSubSlices();
-
- var threadTrack = {};
- threadTrack.thread = thread;
-
- var selection = new EventSet(tsg.slices);
-
- var viewEl = document.createElement('tr-ui-a-multi-event-details-table');
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
- });
-
- test('noDuration', function() {
- var model = new Model();
-
- var fe1 = new tr.model.FlowEvent('cat', 1234, 'title', 7, 10, {});
- var fe2 = new tr.model.FlowEvent('cat', 1234, 'title', 8, 20, {});
-
- // Make reading some properties an explosion, as a way to ensure that they
- // aren't read.
- var failProp = {
- get: function() {
- throw new Error('Should not be called');
- }
- };
- Object.defineProperty(fe1, 'duration', failProp);
- Object.defineProperty(fe2, 'duration', failProp);
-
- Object.defineProperty(fe1, 'subRows', failProp);
- Object.defineProperty(fe2, 'subRows', failProp);
-
- Object.defineProperty(fe1, 'selfTime', failProp);
- Object.defineProperty(fe2, 'selfTime', failProp);
-
- model.flowEvents.push(fe1);
- model.flowEvents.push(fe2);
-
- var selection = new EventSet([fe1, fe2]);
-
- var viewEl = document.createElement('tr-ui-a-multi-event-details-table');
- viewEl.eventsHaveDuration = false;
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_sub_view.html
deleted file mode 100644
index c6333dce9a6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_sub_view.html
+++ /dev/null
@@ -1,128 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/selection_summary_table.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_summary_table.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_details_table.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-
-<polymer-element name="tr-ui-a-multi-event-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- overflow: auto;
- }
- #content {
- display: flex;
- flex-direction: column;
- flex: 0 1 auto;
- align-self: stretch;
- }
- #content > * {
- flex: 0 0 auto;
- align-self: stretch;
- }
- tr-ui-a-multi-event-summary-table {
- border-bottom: 1px solid #aaa;
- }
-
- tr-ui-a-selection-summary-table {
- margin-top: 1.25em;
- border-top: 1px solid #aaa;
- background-color: #eee;
- font-weight: bold;
- margin-bottom: 1.25em;
- border-bottom: 1px solid #aaa;
- }
- </style>
- <div id="content"></div>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.currentSelection_ = undefined;
- this.eventsHaveDuration_ = true;
- this.eventsHaveSubRows_ = true;
- },
-
- set selection(selection) {
- if (selection.length <= 1)
- throw new Error('Only supports multiple items');
- this.setSelectionWithoutErrorChecks(selection);
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- setSelectionWithoutErrorChecks: function(selection) {
- this.currentSelection_ = selection;
- this.updateContents_();
- },
-
- get eventsHaveDuration() {
- return this.eventsHaveDuration_;
- },
-
- set eventsHaveDuration(eventsHaveDuration) {
- this.eventsHaveDuration_ = eventsHaveDuration;
- this.updateContents_();
- },
-
- get eventsHaveSubRows() {
- return this.eventsHaveSubRows_;
- },
-
- set eventsHaveSubRows(eventsHaveSubRows) {
- this.eventsHaveSubRows_ = eventsHaveSubRows;
- this.updateContents_();
- },
-
- updateContents_: function() {
- var selection = this.currentSelection_;
-
- this.$.content.textContent = '';
- if (!selection)
- return;
-
- var eventsByTitle = selection.getEventsOrganizedByTitle();
- var numTitles = tr.b.dictionaryLength(eventsByTitle);
-
- var summaryTableEl = document.createElement(
- 'tr-ui-a-multi-event-summary-table');
- summaryTableEl.configure({
- showTotals: numTitles > 1,
- eventsByTitle: eventsByTitle,
- eventsHaveDuration: this.eventsHaveDuration_,
- eventsHaveSubRows: this.eventsHaveSubRows_
- });
- this.$.content.appendChild(summaryTableEl);
-
- var selectionSummaryTableEl = document.createElement(
- 'tr-ui-a-selection-summary-table');
- selectionSummaryTableEl.selection = this.currentSelection_;
- this.$.content.appendChild(selectionSummaryTableEl);
-
- if (numTitles === 1) {
- var detailsTableEl = document.createElement(
- 'tr-ui-a-multi-event-details-table');
- detailsTableEl.eventsHaveDuration = this.eventsHaveDuration_;
- detailsTableEl.eventsHaveSubRows = this.eventsHaveSubRows_;
- detailsTableEl.selection = selection;
- this.$.content.appendChild(detailsTableEl);
- }
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_sub_view_test.html
deleted file mode 100644
index 5c26a864b78..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_sub_view_test.html
+++ /dev/null
@@ -1,103 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_sub_view.html">
-<link rel="import" href="/tracing/ui/base/deep_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Model = tr.Model;
- var Thread = tr.model.Thread;
- var EventSet = tr.model.EventSet;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
- var Slice = tr.model.Slice;
-
- test('differentTitles', function() {
- var model = new Model();
- var t53 = model.getOrCreateProcess(52).getOrCreateThread(53);
- t53.sliceGroup.pushSlice(newSliceEx(
- {title: 'a', start: 0.0, duration: 0.04}));
- t53.sliceGroup.pushSlice(newSliceEx(
- {title: 'a', start: 0.12, duration: 0.06}));
- t53.sliceGroup.pushSlice(newSliceEx(
- {title: 'aa', start: 0.5, duration: 0.5}));
- t53.sliceGroup.createSubSlices();
-
- var t53track = {};
- t53track.thread = t53;
-
- var selection = new EventSet();
- selection.push(t53.sliceGroup.slices[0]);
- selection.push(t53.sliceGroup.slices[1]);
- selection.push(t53.sliceGroup.slices[2]);
-
- var viewEl = document.createElement('tr-ui-a-multi-event-sub-view');
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
-
- var summaryTableEl = tr.b.findDeepElementMatching(
- viewEl, 'tr-ui-a-multi-event-summary-table');
- assert.isDefined(summaryTableEl);
-
- assert.isTrue(summaryTableEl.showTotals);
- assert.equal(tr.b.dictionaryLength(summaryTableEl.eventsByTitle), 2);
-
- var selectionSummaryTableEl = tr.b.findDeepElementMatching(
- viewEl, 'tr-ui-a-selection-summary-table');
- assert.isDefined(selectionSummaryTableEl);
- assert.equal(selectionSummaryTableEl.selection, selection);
-
- var detailsTableEl = tr.b.findDeepElementMatching(
- viewEl, 'tr-ui-a-multi-event-details-table');
- assert.isUndefined(detailsTableEl);
- });
-
- test('sameTitles', function() {
- var model = new Model();
- var t53 = model.getOrCreateProcess(52).getOrCreateThread(53);
- t53.sliceGroup.pushSlice(newSliceEx(
- {title: 'c', start: 0.0, duration: 0.04}));
- t53.sliceGroup.pushSlice(newSliceEx(
- {title: 'c', start: 0.12, duration: 0.06}));
- t53.sliceGroup.createSubSlices();
-
- var t53track = {};
- t53track.thread = t53;
-
- var selection = new EventSet();
- selection.push(t53.sliceGroup.slices[0]);
- selection.push(t53.sliceGroup.slices[1]);
-
- var viewEl = document.createElement('tr-ui-a-multi-event-sub-view');
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
-
- var summaryTableEl = tr.b.findDeepElementMatching(
- viewEl, 'tr-ui-a-multi-event-summary-table');
- assert.isDefined(summaryTableEl);
-
- assert.isFalse(summaryTableEl.showTotals);
- assert.equal(tr.b.dictionaryLength(summaryTableEl.eventsByTitle), 1);
-
- var selectionSummaryTableEl = tr.b.findDeepElementMatching(
- viewEl, 'tr-ui-a-selection-summary-table');
- assert.isDefined(selectionSummaryTableEl);
- assert.equal(selectionSummaryTableEl.selection, selection);
-
- var detailsTableEl = tr.b.findDeepElementMatching(
- viewEl, 'tr-ui-a-multi-event-details-table');
- assert.isDefined(detailsTableEl);
- assert.equal(detailsTableEl.selection, selection);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary.html
deleted file mode 100644
index 64cd636efcc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary.html
+++ /dev/null
@@ -1,205 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/statistics.html">
-
-<script>
-'use strict';
-tr.exportTo('tr.ui.analysis', function() {
- function MultiEventSummary(title, events) {
- this.title = title;
- this.duration_ = undefined;
- this.selfTime_ = undefined;
- this.events_ = events;
-
- this.cpuTimesComputed_ = false;
- this.cpuSelfTime_ = undefined;
- this.cpuDuration_ = undefined;
-
- this.maxDuration_ = undefined;
- this.maxCpuDuration_ = undefined;
- this.maxSelfTime_ = undefined;
- this.maxCpuSelfTime_ = undefined;
-
- this.untotallableArgs_ = [];
- this.totalledArgs_ = undefined;
- };
- MultiEventSummary.prototype = {
-
- set title(title) {
- if (title == 'Totals')
- this.totalsRow = true;
- this.title_ = title;
- },
-
- get title() {
- return this.title_;
- },
-
- get duration() {
- if (this.duration_ === undefined) {
- this.duration_ = tr.b.Statistics.sum(
- this.events_, function(event) {
- return event.duration;
- });
- }
- return this.duration_;
- },
-
- get cpuSelfTime() {
- this.computeCpuTimesIfNeeded_();
- return this.cpuSelfTime_;
- },
-
- get cpuDuration() {
- this.computeCpuTimesIfNeeded_();
- return this.cpuDuration_;
- },
-
- computeCpuTimesIfNeeded_: function() {
- if (this.cpuTimesComputed_)
- return;
- this.cpuTimesComputed_ = true;
-
- var cpuSelfTime = 0;
- var cpuDuration = 0;
- var hasCpuData = false;
- for (var event of this.events_) {
- if (event.cpuDuration !== undefined) {
- cpuDuration += event.cpuDuration;
- hasCpuData = true;
- }
-
- if (event.cpuSelfTime !== undefined) {
- cpuSelfTime += event.cpuSelfTime;
- hasCpuData = true;
- }
- }
- if (hasCpuData) {
- this.cpuDuration_ = cpuDuration;
- this.cpuSelfTime_ = cpuSelfTime;
- }
- },
-
- get selfTime() {
- if (this.selfTime_ === undefined) {
- this.selfTime_ = 0;
- for (var event of this.events_)
- if (event.selfTime !== undefined)
- this.selfTime_ += event.selfTime;
- }
- return this.selfTime_;
- },
-
- get events() {
- return this.events_;
- },
-
- get numEvents() {
- return this.events_.length;
- },
-
- get numAlerts() {
- if (this.numAlerts_ === undefined) {
- this.numAlerts_ = tr.b.Statistics.sum(this.events_, function(event) {
- return event.associatedAlerts.length;
- });
- }
- return this.numAlerts_;
- },
-
- get untotallableArgs() {
- this.updateArgsIfNeeded_();
- return this.untotallableArgs_;
- },
-
- get totalledArgs() {
- this.updateArgsIfNeeded_();
- return this.totalledArgs_;
- },
-
-
- get maxDuration() {
- if (this.maxDuration_ === undefined) {
- this.maxDuration_ = tr.b.Statistics.max(
- this.events_, function(event) {
- return event.duration;
- });
- }
- return this.maxDuration_;
- },
-
-
- get maxCpuDuration() {
- if (this.maxCpuDuration_ === undefined) {
- this.maxCpuDuration_ = tr.b.Statistics.max(
- this.events_, function(event) {
- return event.cpuDuration;
- });
- }
- return this.maxCpuDuration_;
- },
-
-
- get maxSelfTime() {
- if (this.maxSelfTime_ === undefined) {
- this.maxSelfTime_ = tr.b.Statistics.max(
- this.events_, function(event) {
- return event.selfTime;
- });
- }
- return this.maxSelfTime_;
- },
-
-
- get maxCpuSelfTime() {
- if (this.maxCpuSelfTime_ === undefined) {
- this.maxCpuSelfTime_ = tr.b.Statistics.max(
- this.events_, function(event) {
- return event.cpuSelfTime;
- });
- }
- return this.maxCpuSelfTime_;
- },
-
-
- updateArgsIfNeeded_: function() {
- if (this.totalledArgs_ !== undefined)
- return;
-
- var untotallableArgs = {};
- var totalledArgs = {};
- for (var event of this.events_) {
- for (var argName in event.args) {
- var argVal = event.args[argName];
- var type = typeof argVal;
- if (type !== 'number') {
- untotallableArgs[argName] = true;
- delete totalledArgs[argName];
- continue;
- }
- if (untotallableArgs[argName]) {
- continue;
- }
-
- if (totalledArgs[argName] === undefined)
- totalledArgs[argName] = 0;
- totalledArgs[argName] += argVal;
- }
- }
- this.untotallableArgs_ = tr.b.dictionaryKeys(untotallableArgs);
- this.totalledArgs_ = totalledArgs;
- }
- };
-
- return {
- MultiEventSummary: MultiEventSummary
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary_table.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary_table.html
deleted file mode 100644
index 06ec9cbc17c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary_table.html
+++ /dev/null
@@ -1,316 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_summary.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-</script>
-<polymer-element name='tr-ui-a-multi-event-summary-table'>
- <template>
- <style>
- :host {
- display: flex;
- }
- #table {
- flex: 1 1 auto;
- align-self: stretch;
- }
- </style>
- <tr-ui-b-table id="table">
- </tr-ui-b-table>
- </div>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.showTotals_ = false;
- this.eventsHaveDuration_ = true;
- this.eventsHaveSubRows_ = true;
- this.eventsByTitle_ = undefined;
- },
-
- updateTableColumns_: function(rows, maxValues) {
- var hasCpuData = false;
- var hasAlerts = false;
- rows.forEach(function(row) {
- if (row.cpuDuration !== undefined)
- hasCpuData = true;
- if (row.cpuSelfTime !== undefined)
- hasCpuData = true;
- if (row.numAlerts)
- hasAlerts = true;
- });
-
- var ownerDocument = this.ownerDocument;
-
- var columns = [];
-
- columns.push({
- title: 'Name',
- value: function(row) {
- if (row.title === 'Totals')
- return 'Totals';
-
- var linkEl = document.createElement('tr-ui-a-analysis-link');
- linkEl.setSelectionAndContent(function() {
- return new tr.model.EventSet(row.events);
- }, row.title);
- return linkEl;
- },
- width: '350px',
- cmp: function(rowA, rowB) {
- return rowA.title.localeCompare(rowB.title);
- }
- });
- if (this.eventsHaveDuration_) {
- columns.push({
- title: 'Wall Duration',
- value: function(row) {
- return tr.v.ui.createScalarSpan(row.duration, {
- unit: tr.v.Unit.byName.timeDurationInMs,
- total: row.totalsRow ? undefined : maxValues.duration,
- ownerDocument: ownerDocument,
- rightAlign: true
- });
- },
- width: '<upated further down>',
- cmp: function(rowA, rowB) {
- return rowA.duration - rowB.duration;
- }
- });
- }
-
- if (this.eventsHaveDuration_ && hasCpuData) {
- columns.push({
- title: 'CPU Duration',
- value: function(row) {
- return tr.v.ui.createScalarSpan(row.cpuDuration, {
- unit: tr.v.Unit.byName.timeDurationInMs,
- total: row.totalsRow ? undefined : maxValues.cpuDuration,
- ownerDocument: ownerDocument,
- rightAlign: true
- });
- },
- width: '<upated further down>',
- cmp: function(rowA, rowB) {
- return rowA.cpuDuration - rowB.cpuDuration;
- }
- });
- }
-
- if (this.eventsHaveSubRows_ && this.eventsHaveDuration_) {
- columns.push({
- title: 'Self time',
- value: function(row) {
- return tr.v.ui.createScalarSpan(row.selfTime, {
- unit: tr.v.Unit.byName.timeDurationInMs,
- total: row.totalsRow ? undefined : maxValues.selfTime,
- ownerDocument: ownerDocument,
- rightAlign: true
- });
- },
- width: '<upated further down>',
- cmp: function(rowA, rowB) {
- return rowA.selfTime - rowB.selfTime;
- }
- });
- }
-
- if (this.eventsHaveSubRows_ && this.eventsHaveDuration_ && hasCpuData) {
- columns.push({
- title: 'CPU Self Time',
- value: function(row) {
- return tr.v.ui.createScalarSpan(row.cpuSelfTime, {
- unit: tr.v.Unit.byName.timeDurationInMs,
- total: row.totalsRow ? undefined : maxValues.cpuSelfTime,
- ownerDocument: ownerDocument,
- rightAlign: true
- });
- },
- width: '<upated further down>',
- cmp: function(rowA, rowB) {
- return rowA.cpuSelfTime - rowB.cpuSelfTime;
- }
- });
- }
- columns.push({
- title: 'Occurrences',
- value: function(row) {
- return row.numEvents;
- },
- width: '<upated further down>',
- cmp: function(rowA, rowB) {
- return rowA.numEvents - rowB.numEvents;
- }
- });
-
- var alertsColumnIndex;
- if (hasAlerts) {
- columns.push({
- title: 'Num Alerts',
- value: function(row) {
- return row.numAlerts;
- },
- width: '<upated further down>',
- cmp: function(rowA, rowB) {
- return rowA.numAlerts - rowB.numAlerts;
- }
- });
- alertsColumnIndex = columns.length - 1;
- }
- var colWidthPercentage;
- if (columns.length == 1)
- colWidthPercentage = '100%';
- else
- colWidthPercentage = (100 / (columns.length - 1)).toFixed(3) + '%';
-
- for (var i = 1; i < columns.length; i++)
- columns[i].width = colWidthPercentage;
-
- this.$.table.tableColumns = columns;
-
- if (hasAlerts) {
- this.$.table.sortColumnIndex = alertsColumnIndex;
- this.$.table.sortDescending = true;
- }
- },
-
- configure: function(config) {
- if (config.eventsByTitle === undefined)
- throw new Error('Required: eventsByTitle');
-
- if (config.showTotals !== undefined)
- this.showTotals_ = config.showTotals;
- else
- this.showTotals_ = true;
-
- if (config.eventsHaveDuration !== undefined)
- this.eventsHaveDuration_ = config.eventsHaveDuration;
- else
- this.eventsHaveDuration_ = true;
-
- if (config.eventsHaveSubRows !== undefined)
- this.eventsHaveSubRows_ = config.eventsHaveSubRows;
- else
- this.eventsHaveSubRows_ = true;
-
- this.eventsByTitle_ = config.eventsByTitle;
- this.updateContents_();
- },
-
- get showTotals() {
- return this.showTotals_;
- },
-
- set showTotals(showTotals) {
- this.showTotals_ = showTotals;
- this.updateContents_();
- },
-
- get eventsHaveDuration() {
- return this.eventsHaveDuration_;
- },
-
- set eventsHaveDuration(eventsHaveDuration) {
- this.eventsHaveDuration_ = eventsHaveDuration;
- this.updateContents_();
- },
-
- get eventsHaveSubRows() {
- return this.eventsHaveSubRows_;
- },
-
- set eventsHaveSubRows(eventsHaveSubRows) {
- this.eventsHaveSubRows_ = eventsHaveSubRows;
- this.updateContents_();
- },
-
- get eventsByTitle() {
- return this.eventsByTitle_;
- },
-
- set eventsByTitle(eventsByTitle) {
- this.eventsByTitle_ = eventsByTitle;
- this.updateContents_();
- },
-
- get selectionBounds() {
- return this.selectionBounds_;
- },
-
- set selectionBounds(selectionBounds) {
- this.selectionBounds_ = selectionBounds;
- this.updateContents_();
- },
-
- updateContents_: function() {
- var eventsByTitle;
- if (this.eventsByTitle_ !== undefined)
- eventsByTitle = this.eventsByTitle_;
- else
- eventsByTitle = [];
-
- var allEvents = [];
- var rows = [];
- tr.b.iterItems(
- eventsByTitle,
- function(title, eventsOfSingleTitle) {
- allEvents.push.apply(allEvents, eventsOfSingleTitle);
- var row = new tr.ui.analysis.MultiEventSummary(
- title, eventsOfSingleTitle);
- rows.push(row);
- });
-
- this.updateTableColumns_(rows);
- this.$.table.tableRows = rows;
-
- var maxValues = {
- duration: undefined,
- selfTime: undefined,
- cpuSelfTime: undefined,
- cpuDuration: undefined
- };
-
- if (this.eventsHaveDuration) {
- for (var column in maxValues) {
- maxValues[column] = tr.b.Statistics.max(rows, function(event) {
- return event[column];
- });
- }
- }
-
- var footerRows = [];
-
- if (this.showTotals_) {
- var multiEventSummary = new tr.ui.analysis.MultiEventSummary(
- 'Totals', allEvents);
- footerRows.push(multiEventSummary);
- }
-
-
- this.updateTableColumns_(rows, maxValues);
- this.$.table.tableRows = rows;
-
- // TODO(selection bounds).
-
- // TODO(sorting)
-
- this.$.table.footerRows = footerRows;
- this.$.table.rebuild();
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary_table_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary_table_test.html
deleted file mode 100644
index ebef452ab9e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary_table_test.html
+++ /dev/null
@@ -1,110 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_summary_table.html">
-<link rel="import" href="/tracing/ui/base/deep_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Model = tr.Model;
- var EventSet = tr.model.EventSet;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
-
- test('basicNoCpu', function() {
- var model = new Model();
- var thread = model.getOrCreateProcess(1).getOrCreateThread(2);
- var tsg = thread.sliceGroup;
- tsg.pushSlice(newSliceEx({title: 'a', start: 0, duration: 0.5}));
- tsg.pushSlice(newSliceEx({title: 'b', start: 1, duration: 0.5}));
- tsg.pushSlice(newSliceEx({title: 'b', start: 2, duration: 0.5}));
- tsg.createSubSlices();
-
- var threadTrack = {};
- threadTrack.thread = thread;
-
- var selection = new EventSet(tsg.slices);
-
- var viewEl = document.createElement('tr-ui-a-multi-event-summary-table');
- viewEl.configure({
- showTotals: true,
- eventsHaveDuration: true,
- eventsByTitle: selection.getEventsOrganizedByTitle()
- });
- this.addHTMLOutput(viewEl);
- });
-
- test('basicWithCpu', function() {
- var model = new Model();
- var thread = model.getOrCreateProcess(1).getOrCreateThread(2);
- var tsg = thread.sliceGroup;
- tsg.pushSlice(newSliceEx({title: 'a', start: 0, end: 3,
- cpuStart: 0, cpuEnd: 3}));
- tsg.pushSlice(newSliceEx({title: 'b', start: 1, end: 2,
- cpuStart: 1, cpuEnd: 1.75}));
- tsg.pushSlice(newSliceEx({title: 'b', start: 4, end: 5,
- cpuStart: 3, cpuEnd: 3.75}));
- tsg.createSubSlices();
-
- var threadTrack = {};
- threadTrack.thread = thread;
-
- var selection = new EventSet(tsg.slices);
-
- var viewEl = document.createElement('tr-ui-a-multi-event-summary-table');
- viewEl.configure({
- showTotals: true,
- eventsHaveDuration: true,
- eventsByTitle: selection.getEventsOrganizedByTitle()
- });
- this.addHTMLOutput(viewEl);
- });
-
- test('noDurationNoSubRows', function() {
- var model = new Model();
-
- var fe1 = new tr.model.FlowEvent('cat', 1234, 'title', 7, 10, {});
- var fe2 = new tr.model.FlowEvent('cat', 1234, 'title', 8, 20, {});
-
- // Make reading some properties an explosion, as a way to ensure that they
- // aren't read.
- var failProp = {
- get: function() {
- throw new Error('Should not be called');
- }
- };
- Object.defineProperty(fe1, 'duration', failProp);
- Object.defineProperty(fe2, 'duration', failProp);
-
- Object.defineProperty(fe1, 'subRows', failProp);
- Object.defineProperty(fe2, 'subRows', failProp);
-
- Object.defineProperty(fe1, 'selfTime', failProp);
- Object.defineProperty(fe2, 'selfTime', failProp);
-
- model.flowEvents.push(fe1);
- model.flowEvents.push(fe2);
-
- var selection = new EventSet([fe1, fe2]);
-
- var viewEl = document.createElement('tr-ui-a-multi-event-summary-table');
- viewEl.configure({
- showTotals: true,
- eventsHaveDuration: false,
- eventsHaveSubRows: false,
- eventsByTitle: selection.getEventsOrganizedByTitle()
- });
- this.addHTMLOutput(viewEl);
- });
-
- // TODO(nduca): Tooltippish stuff.
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary_test.html
deleted file mode 100644
index 5f7782b1438..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_event_summary_test.html
+++ /dev/null
@@ -1,112 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_summary.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Model = tr.Model;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
-
- test('summaryRowNoCpu', function() {
- var model = new Model();
- var thread = model.getOrCreateProcess(1).getOrCreateThread(2);
- var tsg = thread.sliceGroup;
-
- tsg.pushSlice(newSliceEx({title: 'a', start: 0, end: 3}));
- tsg.pushSlice(newSliceEx({title: 'bb', start: 1, end: 2}));
- tsg.pushSlice(newSliceEx({title: 'bb', start: 4, end: 5}));
- tsg.createSubSlices();
-
- var row = new tr.ui.analysis.MultiEventSummary('x', tsg.slices.slice(0));
- assert.equal(row.duration, 5);
- assert.equal(row.selfTime, 4);
- assert.isUndefined(row.cpuDuration);
- assert.isUndefined(row.cpuSelfTime);
- });
-
- test('summaryRowWithCpu', function() {
- var model = new Model();
- var thread = model.getOrCreateProcess(1).getOrCreateThread(2);
- var tsg = thread.sliceGroup;
-
- tsg.pushSlice(newSliceEx({title: 'a', start: 0, end: 3,
- cpuStart: 0, cpuEnd: 3}));
- tsg.pushSlice(newSliceEx({title: 'b', start: 1, end: 2,
- cpuStart: 1, cpuEnd: 1.75}));
- tsg.pushSlice(newSliceEx({title: 'b', start: 4, end: 5,
- cpuStart: 3, cpuEnd: 3.75}));
- tsg.createSubSlices();
-
- var row = new tr.ui.analysis.MultiEventSummary('x', tsg.slices.slice(0));
- assert.equal(row.duration, 5);
- assert.equal(row.selfTime, 4);
- assert.equal(row.cpuDuration, 4.5);
- assert.equal(row.cpuSelfTime, 3.75);
- assert.equal(row.maxDuration, 3);
- assert.equal(row.maxSelfTime, 2);
- assert.equal(row.maxCpuDuration, 3);
- assert.equal(row.maxCpuSelfTime, 2.25);
- });
-
- test('summaryRowNonSlice', function() {
- var model = new Model();
- var thread = model.getOrCreateProcess(1).getOrCreateThread(2);
- var tsg = thread.sliceGroup;
-
- var fe1 = new tr.model.FlowEvent('cat', 1234, 'title', 7, 10, {});
- var fe2 = new tr.model.FlowEvent('cat', 1234, 'title', 8, 20, {});
- model.flowEvents.push(fe1);
- model.flowEvents.push(fe2);
-
- var row = new tr.ui.analysis.MultiEventSummary('a', [fe1, fe2]);
- assert.equal(row.duration, 0);
- assert.equal(row.selfTime, 0);
- assert.isUndefined(row.cpuDuration);
- assert.isUndefined(row.cpuSelfTime);
- assert.equal(row.maxDuration, 0);
- });
-
- test('summaryNumAlerts', function() {
- var slice = newSliceEx({title: 'b', start: 0, duration: 0.002});
-
- var ALERT_INFO_1 = new tr.model.EventInfo(
- 'Alert 1', 'Critical alert');
-
- var alert = new tr.model.Alert(ALERT_INFO_1, 5, [slice]);
-
- var row = new tr.ui.analysis.MultiEventSummary('a', [slice]);
- assert.equal(row.numAlerts, 1);
- });
-
- test('argSummary', function() {
- var model = new Model();
- var thread = model.getOrCreateProcess(1).getOrCreateThread(2);
- var tsg = thread.sliceGroup;
-
- tsg.pushSlice(newSliceEx({title: 'a', start: 0, end: 3,
- args: {value1: 3, value2: 'x', value3: 1}}));
- tsg.pushSlice(newSliceEx({title: 'b', start: 1, end: 2,
- args: {value1: 3, value2: 'y', value3: 2}}));
- tsg.pushSlice(newSliceEx({title: 'b', start: 4, end: 5,
- args: {value1: 3, value2: 'z', value3: 'x'}}));
- tsg.createSubSlices();
-
- var row = new tr.ui.analysis.MultiEventSummary('x', tsg.slices.slice(0));
- assert.deepEqual(row.totalledArgs, {value1: 9});
- assert.deepEqual(row.untotallableArgs, ['value2', 'value3']);
- assert.equal(row.maxDuration, 3);
- assert.equal(row.maxSelfTime, 2);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_flow_event_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_flow_event_sub_view.html
deleted file mode 100644
index ec185d1844b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_flow_event_sub_view.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_sub_view.html">
-
-<polymer-element name="tr-ui-a-multi-flow-event-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- }
- </style>
- <tr-ui-a-multi-event-sub-view id="content"></tr-ui-a-multi-event-sub-view>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.$.content.eventsHaveDuration = false;
- this.$.content.eventsHaveSubRows = false;
- },
-
- set selection(selection) {
- this.$.content.selection = selection;
- },
-
- get selection() {
- return this.$.content.selection;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_flow_event_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_flow_event_sub_view_test.html
deleted file mode 100644
index 6a95a25d524..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_flow_event_sub_view_test.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Model = tr.Model;
- var EventSet = tr.model.EventSet;
-
- test('analyzeSelectionWithSingleEvent', function() {
- var model = new Model();
-
- var fe1 = new tr.model.FlowEvent('cat', 1234, 'title', 7, 10, {});
- var fe2 = new tr.model.FlowEvent('cat', 1234, 'title', 8, 20, {});
- model.flowEvents.push(fe1);
- model.flowEvents.push(fe2);
-
- var selection = new EventSet();
- selection.push(fe1);
- selection.push(fe2);
- assert.equal(selection.length, 2);
-
- var subView = document.createElement('tr-ui-a-multi-flow-event-sub-view');
- subView.selection = selection;
-
- this.addHTMLOutput(subView);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_frame_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_frame_sub_view.html
deleted file mode 100644
index 1ecf2d02e35..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_frame_sub_view.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-
-<polymer-element name="tr-ui-a-multi-frame-sub-view"
- extends="tr-ui-a-sub-view">
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.currentSelection_ = undefined;
- },
-
- set selection(selection) {
- this.textContent = '';
- var realView = document.createElement('tr-ui-a-multi-event-sub-view');
- realView.eventsHaveDuration = false;
- realView.eventsHaveSubRows = false;
-
- this.appendChild(realView);
- realView.setSelectionWithoutErrorChecks(selection);
-
- this.currentSelection_ = selection;
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- get relatedEventsToHighlight() {
- if (!this.currentSelection_)
- return undefined;
- var selection = new tr.model.EventSet();
- this.currentSelection_.forEach(function(frameEvent) {
- frameEvent.associatedEvents.forEach(function(event) {
- selection.push(event);
- });
- });
- return selection;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_instant_event_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_instant_event_sub_view.html
deleted file mode 100644
index 7d6adb91c4e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_instant_event_sub_view.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_sub_view.html">
-
-<polymer-element name="tr-ui-a-multi-instant-event-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: block;
- }
- </style>
- <div id='content'></div>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.currentSelection_ = undefined;
- },
-
- set selection(selection) {
- this.$.content.textContent = '';
- var realView = document.createElement('tr-ui-a-multi-event-sub-view');
- realView.eventsHaveDuration = false;
- realView.eventsHaveSubRows = false;
-
- this.$.content.appendChild(realView);
- realView.setSelectionWithoutErrorChecks(selection);
-
- this.currentSelection_ = selection;
- },
-
- get selection() {
- return this.currentSelection_;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_instant_event_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_instant_event_sub_view_test.html
deleted file mode 100644
index ba70217fe79..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_instant_event_sub_view_test.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Model = tr.Model;
- var EventSet = tr.model.EventSet;
-
- test('analyzeSelectionWithSingleEvent', function() {
- var model = new Model();
- var p52 = model.getOrCreateProcess(52);
- var t53 = p52.getOrCreateThread(53);
-
- var ie1 = new tr.model.ProcessInstantEvent('cat', 'title', 7, 10, {});
- var ie2 = new tr.model.ProcessInstantEvent('cat', 'title', 7, 20, {});
- p52.instantEvents.push(ie1);
- p52.instantEvents.push(ie2);
-
-
- var selection = new EventSet();
- selection.push(ie1);
- selection.push(ie2);
- assert.equal(selection.length, 2);
-
- var subView =
- document.createElement('tr-ui-a-multi-instant-event-sub-view');
- subView.selection = selection;
-
- this.addHTMLOutput(subView);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_object_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_object_sub_view.html
deleted file mode 100644
index 8241ab16aa2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_object_sub_view.html
+++ /dev/null
@@ -1,93 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-a-multi-object-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- }
- </style>
- <tr-ui-b-table id="content"></tr-ui-b-table>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.currentSelection_ = undefined;
- },
-
- ready: function() {
- this.$.content.showHeader = false;
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- set selection(selection) {
- this.currentSelection_ = selection;
-
- var objectEvents = tr.b.asArray(selection).sort(
- tr.b.Range.compareByMinTimes);
-
- var timeSpanConfig = {
- unit: tr.v.Unit.byName.timeStampInMs,
- ownerDocument: this.ownerDocument
- };
- var table = this.$.content;
- table.tableColumns = [
- {
- title: 'First',
- value: function(event) {
- if (event instanceof tr.model.ObjectSnapshot)
- return tr.v.ui.createScalarSpan(event.ts, timeSpanConfig);
-
- var spanEl = document.createElement('span');
- spanEl.appendChild(tr.v.ui.createScalarSpan(
- event.creationTs, timeSpanConfig));
- spanEl.appendChild(tr.ui.b.createSpan({
- textContent: '-',
- marginLeft: '4px',
- marginRight: '4px'
- }));
- if (event.deletionTs != Number.MAX_VALUE) {
- spanEl.appendChild(tr.v.ui.createScalarSpan(
- event.deletionTs, timeSpanConfig));
- }
- return spanEl;
- },
- width: '200px'
- },
- {
- title: 'Second',
- value: function(event) {
- var linkEl = document.createElement('tr-ui-a-analysis-link');
- linkEl.setSelectionAndContent(function() {
- return new tr.model.EventSet(event);
- }, event.userFriendlyName);
- return linkEl;
- },
- width: '100%'
- }
- ];
- table.tableRows = objectEvents;
- table.rebuild();
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_object_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_object_sub_view_test.html
deleted file mode 100644
index bcc58afd230..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_object_sub_view_test.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var EventSet = tr.model.EventSet;
- var ObjectInstance = tr.model.ObjectInstance;
-
- test('instantiate_analysisWithObjects', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var objects = p1.objects;
- var i10 = objects.idWasCreated(
- '0x1000', 'tr.e.cc', 'LayerTreeHostImpl', 10);
- var s10 = objects.addSnapshot('0x1000', 'tr.e.cc', 'LayerTreeHostImpl', 10,
- 'snapshot-1');
- var s25 = objects.addSnapshot('0x1000', 'tr.e.cc', 'LayerTreeHostImpl', 25,
- 'snapshot-2');
- var s40 = objects.addSnapshot('0x1000', 'tr.e.cc', 'LayerTreeHostImpl', 40,
- 'snapshot-3');
- objects.idWasDeleted('0x1000', 'tr.e.cc', 'LayerTreeHostImpl', 45);
-
- var track = {};
- var selection = new EventSet();
- selection.push(i10);
- selection.push(s10);
- selection.push(s25);
- selection.push(s40);
-
- var analysisEl = document.createElement('tr-ui-a-multi-object-sub-view');
- analysisEl.selection = selection;
- this.addHTMLOutput(analysisEl);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_power_sample_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_power_sample_sub_view.html
deleted file mode 100644
index 2fc86530efb..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_power_sample_sub_view.html
+++ /dev/null
@@ -1,67 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/frame_power_usage_chart.html">
-<link rel="import" href="/tracing/ui/analysis/power_sample_summary_table.html">
-
-<polymer-element name="tr-ui-a-multi-power-sample-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: row;
- }
- #tables {
- display: flex;
- flex-direction: column;
- width: 50%;
- }
- #chart {
- width: 50%;
- }
- </style>
- <div id="tables">
- <tr-ui-a-power-sample-summary-table id="summaryTable">
- </tr-ui-a-power-sample-summary-table>
- </div>
- <tr-ui-a-frame-power-usage-chart id="chart">
- </tr-ui-a-frame-power-usage-chart>
- </template>
-</polymer-element>
-
-<script>
-'use strict';
-
-// TODO(charliea): Add a dropdown that allows the user to select which type of
-// power sample analysis view they want (e.g. table of samples, graph).
-Polymer('tr-ui-a-multi-power-sample-sub-view', {
- ready: function() {
- this.currentSelection_ = undefined;
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- set selection(selection) {
- this.currentSelection_ = selection;
- this.updateContents_();
- },
-
- updateContents_: function() {
- var samples = this.selection;
- var vSyncTimestamps = (!samples ? [] :
- tr.b.getFirstElement(samples).series.device.vSyncTimestamps);
-
- this.$.summaryTable.samples = samples;
- this.$.chart.setData(this.selection, vSyncTimestamps);
- }
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_power_sample_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_power_sample_sub_view_test.html
deleted file mode 100644
index d22083b29db..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_power_sample_sub_view_test.html
+++ /dev/null
@@ -1,63 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/power_series.html">
-<link rel="import" href="/tracing/ui/analysis/multi_power_sample_sub_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate_noSamplesOrVSyncs', function() {
- var viewEl = document.createElement('tr-ui-a-multi-power-sample-sub-view');
- viewEl.selection = undefined;
- this.addHTMLOutput(viewEl);
- });
-
- test('instantiate_noVSyncs', function() {
- var model = new tr.Model();
- var series = new tr.model.PowerSeries(model.device);
-
- model.device.vSyncTimestamps = [];
- series.addPowerSample(1, 1);
- series.addPowerSample(2, 2);
- series.addPowerSample(3, 3);
- series.addPowerSample(4, 2);
-
- var view = document.createElement('tr-ui-a-multi-power-sample-sub-view');
- var eventSet = new tr.model.EventSet(series.samples);
- view.selection = eventSet;
-
- this.addHTMLOutput(view);
-
- assert.deepEqual(view.$.chart.samples, eventSet);
- assert.sameDeepMembers(view.$.chart.vSyncTimestamps, []);
- });
-
- test('instantiate', function() {
- var model = new tr.Model();
- var series = new tr.model.PowerSeries(model.device);
-
- model.device.vSyncTimestamps = [0];
- series.addPowerSample(1, 1);
- series.addPowerSample(2, 2);
- series.addPowerSample(3, 3);
- series.addPowerSample(4, 2);
-
- var view = document.createElement('tr-ui-a-multi-power-sample-sub-view');
- var eventSet = new tr.model.EventSet(series.samples);
- view.selection = eventSet;
-
- this.addHTMLOutput(view);
-
- assert.deepEqual(view.$.chart.samples, eventSet);
- assert.sameDeepMembers(view.$.chart.vSyncTimestamps, [0]);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_sample_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_sample_sub_view.html
deleted file mode 100644
index ab570d12da7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_sample_sub_view.html
+++ /dev/null
@@ -1,268 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/multi_dimensional_view.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-a-multi-sample-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host { display: block; }
- #control {
- background-color: #e6e6e6;
- background-image: -webkit-gradient(linear, 0 0, 0 100%,
- from(#E5E5E5), to(#D1D1D1));
- flex: 0 0 auto;
- overflow-x: auto;
- }
- #control::-webkit-scrollbar { height: 0px; }
- #control {
- font-size: 12px;
- display: flex;
- flex-direction: row;
- align-items: stretch;
- margin: 1px;
- margin-right: 2px;
- }
- </style>
- <div id="control">
- Sample View Option
- </div>
- <tr-ui-b-table id="table">
- </tr-ui-b-table>
- </template>
-
- <script>
- 'use strict';
-
- (function() {
- var MultiDimensionalViewBuilder = tr.b.MultiDimensionalViewBuilder;
- var SAMPLE_TYPE = {
- COMPILER: 'compiler',
- EXTERNAL: 'external',
- GC: 'gc',
- NATIVEV8: '[native v8]',
- OTHER: 'other',
- UNKNOWN: 'unknown'
- };
-
- Polymer({
- created: function() {
- this.viewOption_ = undefined;
- this.selection_ = undefined;
- },
-
- ready: function() {
- var viewSelector = tr.ui.b.createSelector(
- this, 'viewOption', 'tracing.ui.analysis.multi_sample_sub_view',
- MultiDimensionalViewBuilder.ViewType.TOP_DOWN_TREE_VIEW,
- [
- {
- label: 'Top-down (Tree)',
- value: MultiDimensionalViewBuilder.ViewType.TOP_DOWN_TREE_VIEW
- },
- {
- label: 'Top-down (Heavy)',
- value: MultiDimensionalViewBuilder.ViewType.TOP_DOWN_HEAVY_VIEW
- },
- {
- label: 'Bottom-up (Heavy)',
- value: MultiDimensionalViewBuilder.ViewType.BOTTOM_UP_HEAVY_VIEW
- }
- ]);
- this.$.control.appendChild(viewSelector);
- this.$.table.selectionMode = tr.ui.b.TableFormat.SelectionMode.ROW;
- },
-
- get selection() {
- return this.selection_;
- },
-
- set selection(selection) {
- this.selection_ = selection;
- this.updateContents_();
- },
-
- get viewOption() {
- return this.viewOption_;
- },
-
- set viewOption(viewOption) {
- this.viewOption_ = viewOption;
- this.updateContents_();
- },
-
- createSamplingSummary_: function(selection, viewOption) {
- var builder = new MultiDimensionalViewBuilder(
- 1 /* dimensions */, 1 /* valueCount */);
- var samples = selection.getEventsOrganizedByBaseType().sample;
-
- samples.forEach(function(sample) {
- builder.addPath([sample.getUserFriendlyStackTrace().reverse()],
- [1], MultiDimensionalViewBuilder.ValueKind.SELF);
- });
-
- return builder.buildView(viewOption);
- },
-
- // Constructs function name and file name of sample
- // if it is compiler, external, gc, other, or unknown.
- processTypedSampleRow_: function(row) {
- var title = row.title[0];
- switch (title) {
- case SAMPLE_TYPE.COMPILER:
- case SAMPLE_TYPE.EXTERNAL:
- case SAMPLE_TYPE.GC:
- case SAMPLE_TYPE.OTHER:
- row.functionName = title;
- row.fileName = 'N/A';
- return true;
- case SAMPLE_TYPE.UNKNOWN:
- row.functionName = SAMPLE_TYPE.UNKNOWN;
- row.fileName = SAMPLE_TYPE.UNKNOWN;
- return true;
- default:
- return false;
- }
- },
-
- // Constructs function name and file name of native v8 sample.
- processNativeV8SampleRow_: function(row) {
- var title = row.title[0];
- if (!title.includes(SAMPLE_TYPE.NATIVEV8))
- return false;
- var arr = title.split(SAMPLE_TYPE.NATIVEV8);
- row.functionName = arr[0].trim();
- if (row.functionName === '')
- row.functionName = '(anonymous function)';
- row.fileName = SAMPLE_TYPE.NATIVEV8;
- var fileNameSuffix = arr[1].trim();
- if (fileNameSuffix !== '')
- row.fileName += ' ' + fileNameSuffix;
- return true;
- },
-
- // Constructs function name and file name for sample.
- processGeneralSampleRow_: function(row) {
- var title = row.title[0];
- var idx = title.lastIndexOf(' ');
- if (idx === -1) {
- row.functionName = title;
- row.fileName = 'unknown';
- return;
- }
- var prefix = title.substr(0, idx);
- var suffix = title.substr(idx + 1);
- if (suffix.startsWith('v8/')) {
- row.functionName = suffix;
- row.fileName = 'unknown';
- } else if (suffix === '') {
- row.functionName = prefix;
- row.fileName = 'unknown';
- } else if (prefix === '') {
- row.functionName = '(anonymous function)';
- row.fileName = suffix.substr(suffix.lastIndexOf('/') + 1);
- } else {
- row.functionName = prefix;
- row.fileName = suffix.substr(suffix.lastIndexOf('/') + 1);
- }
- },
-
- processSampleRows_: function(rows) {
- rows.forEach(function(row) {
- if (!this.processTypedSampleRow_(row) &&
- !this.processNativeV8SampleRow_(row))
- this.processGeneralSampleRow_(row);
- this.processSampleRows_(row.subRows);
- }, this);
- },
-
- updateContents_: function() {
- if (this.selection === undefined) {
- this.$.table.tableColumns = [];
- this.$.table.tableRows = [];
- this.$.table.rebuild();
- return;
- }
-
- var samplingData = this.createSamplingSummary_(
- this.selection, this.viewOption);
- var total = samplingData.values[0].total;
- var columns = [
- this.createPercentColumn_('Total', total),
- this.createSamplesColumn_('Total'),
- this.createPercentColumn_('Self', total),
- this.createSamplesColumn_('Self'),
- {
- title: 'Function Name',
- value: function(row) { return row.functionName; },
- width: '150px',
- cmp: function(a, b) {
- return a.functionName.localeCompare(b.functionName);
- },
- showExpandButtons: true
- },
- {
- title: 'Location',
- value: function(row) { return row.fileName; },
- width: '250px',
- cmp: function(a, b) {
- return a.fileName.localeCompare(b.fileName);
- }
- }
- ];
-
- this.processSampleRows_(samplingData.subRows);
- this.$.table.tableColumns = columns;
- this.$.table.sortColumnIndex = 1 /* Total samples */;
- this.$.table.sortDescending = true;
- this.$.table.tableRows = samplingData.subRows;
- this.$.table.rebuild();
- },
-
- createPercentColumn_: function(title, samplingDataTotal) {
- var field = title.toLowerCase();
- return {
- title: title + ' percent',
- value: function(row) {
- var percent = row.values[0][field] / samplingDataTotal;
-
- var span = document.createElement('tr-v-ui-scalar-span');
- span.value = (percent * 100).toFixed(2);
- span.percentage = percent;
- span.unit = tr.v.Unit.byName.unitlessNumber;
- return span;
-
- }.bind(this),
- width: '60px',
- cmp: function(a, b) {
- return a.values[0][field] - b.values[0][field];
- }
- };
- },
-
- createSamplesColumn_: function(title) {
- var field = title.toLowerCase();
- return {
- title: title + ' samples',
- value: function(row) {
- return row.values[0][field];
- },
- width: '60px',
- cmp: function(a, b) {
- return a.values[0][field] - b.values[0][field];
- }
- };
- }
- });
- })();
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_sample_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_sample_sub_view_test.html
deleted file mode 100644
index 4eca3673357..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_sample_sub_view_test.html
+++ /dev/null
@@ -1,118 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/multi_sample_sub_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newSampleNamed = tr.c.TestUtils.newSampleNamed;
-
- function instantiateWithTraces(traces) {
- var t53;
- var m = tr.c.TestUtils.newModelWithEvents([], {
- shiftWorldToZero: false,
- pruneContainers: false,
- customizeModelCallback: function(model) {
- t53 = model.getOrCreateProcess(52).getOrCreateThread(53);
- traces.forEach(function(trace, index) {
- model.samples.push(
- newSampleNamed(t53, 'X', 'cat', trace, index * 0.02));
- });
- }
- });
-
- var t53track = {};
- t53track.thread = t53;
-
- var selection = new tr.model.EventSet();
- for (var i = 0; i < t53.samples.length; i++)
- selection.push(t53.samples[i]);
-
- var view = document.createElement('tr-ui-a-multi-sample-sub-view');
- view.style.height = '500px';
- this.addHTMLOutput(view);
- view.selection = selection;
- return view;
- }
-
- test('instantiate_flat', function() {
- instantiateWithTraces.call(this, [
- ['BBB'],
- ['AAA'],
- ['AAA'],
- ['Sleeping'],
- ['BBB'],
- ['AAA'],
- ['CCC'],
- ['Sleeping']
- ]);
- });
-
- test('instantiate_nested', function() {
- instantiateWithTraces.call(this, [
- ['AAA', 'BBB'],
- ['AAA', 'BBB', 'CCC'],
- ['AAA', 'BBB'],
- ['BBB', 'AAA', 'BBB'],
- ['BBB', 'AAA', 'BBB'],
- ['BBB', 'AAA', 'BBB']
- ]);
- });
-
- test('processSampleRows', function() {
- var view = instantiateWithTraces.call(this, [
- ['gc'],
- ['external'],
- ['compiler'],
- ['other'],
- ['unknown'],
- [' [native v8] promise.js:1'],
- ['dispatch [native v8] promise.js:2'],
- ['onDispatch http://google.com/a.js:1'],
- [' http://google.com/a.js:2'],
- ['f '],
- ['v8/LoadTime'],
- ['f']
- ]);
- var rows = view.$.table.tableRows;
-
- assert.deepEqual(rows.map(r => r.functionName), [
- 'gc',
- 'external',
- 'compiler',
- 'other',
- 'unknown',
- '(anonymous function)',
- 'dispatch',
- 'onDispatch',
- '(anonymous function)',
- 'f',
- 'v8/LoadTime',
- 'f'
- ]);
-
- assert.deepEqual(rows.map(r => r.fileName), [
- 'N/A',
- 'N/A',
- 'N/A',
- 'N/A',
- 'unknown',
- '[native v8] promise.js:1',
- '[native v8] promise.js:2',
- 'a.js:1',
- 'a.js:2',
- 'unknown',
- 'unknown',
- 'unknown'
- ]);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_slice_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_slice_sub_view.html
deleted file mode 100644
index 54c1c324ab2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_slice_sub_view.html
+++ /dev/null
@@ -1,94 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/related_events.html">
-
-<polymer-element name="tr-ui-a-multi-thread-slice-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- }
- #content {
- display: flex;
- flex: 1 1 auto;
- }
- #content > tr-ui-a-related-events {
- margin-left: 8px;
- flex: 0 1 200px;
- }
- </style>
- <div id="content"></div>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.selection_ = undefined;
- },
-
- get selection() {
- return this.selection_;
- },
-
- set selection(selection) {
- this.selection_ = selection;
-
- // TODO(nduca): This is a gross hack for cc Frame Viewer, but its only
- // the frame viewer that needs this feature, so ~shrug~.
- // We check for its presence so that we do not have a hard dependency
- // on frame viewer.
- if (tr.isExported('tr.ui.e.chrome.cc.RasterTaskSelection')) {
- if (tr.ui.e.chrome.cc.RasterTaskSelection.supports(selection)) {
- var ltvSelection = new tr.ui.e.chrome.cc.RasterTaskSelection(
- selection);
-
- var ltv = new tr.ui.e.chrome.cc.LayerTreeHostImplSnapshotView();
- ltv.objectSnapshot = ltvSelection.containingSnapshot;
- ltv.selection = ltvSelection;
- ltv.extraHighlightsByLayerId = ltvSelection.extraHighlightsByLayerId;
-
- this.$.content.textContent = '';
- this.$.content.appendChild(ltv);
-
- this.requiresTallView_ = true;
- return;
- }
- }
-
- this.$.content.textContent = '';
-
- var mesv = document.createElement('tr-ui-a-multi-event-sub-view');
- mesv.selection = selection;
- this.$.content.appendChild(mesv);
-
- var relatedEvents = document.createElement('tr-ui-a-related-events');
- relatedEvents.setRelatedEvents(selection);
-
- if (relatedEvents.hasRelatedEvents()) {
- this.$.content.appendChild(relatedEvents);
- }
- },
-
- get requiresTallView() {
- if (this.$.content.children.length === 0)
- return false;
- var childTagName = this.$.content.children[0].tagName;
- if (childTagName === 'TR-UI-A-MULTI-EVENT-SUB-VIEW')
- return false;
-
- // Using raster task view.
- return true;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_slice_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_slice_sub_view_test.html
deleted file mode 100644
index ce8e070aa3e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_slice_sub_view_test.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/thread_slice.html">
-<link rel="import" href="/tracing/ui/analysis/multi_thread_slice_sub_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newSliceEx = tr.c.TestUtils.newSliceEx;
- var newFlowEventEx = tr.c.TestUtils.newFlowEventEx;
-
- test('instantiate', function() {
- var model = new tr.Model();
- var t53 = model.getOrCreateProcess(52).getOrCreateThread(53);
- t53.sliceGroup.pushSlice(
- newSliceEx({title: 'a', start: 0.0, duration: 0.5,
- type: tr.model.ThreadSlice}));
- t53.sliceGroup.pushSlice(
- newSliceEx({title: 'b', start: 1.0, duration: 2,
- type: tr.model.ThreadSlice}));
- t53.sliceGroup.createSubSlices();
-
- var selection = new tr.model.EventSet();
- selection.push(t53.sliceGroup.slices[0]);
- selection.push(t53.sliceGroup.slices[1]);
-
- var viewEl = document.createElement('tr-ui-a-multi-thread-slice-sub-view');
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
- });
-
- test('withFlows', function() {
- var m = tr.c.TestUtils.newModel(function(m) {
- m.p1 = m.getOrCreateProcess(1);
-
- m.t2 = m.p1.getOrCreateThread(2);
- m.t3 = m.p1.getOrCreateThread(3);
- m.t4 = m.p1.getOrCreateThread(4);
-
- m.sA = m.t2.sliceGroup.pushSlice(
- newSliceEx({title: 'a', start: 0, end: 5,
- type: tr.model.ThreadSlice}));
- m.sB = m.t3.sliceGroup.pushSlice(
- newSliceEx({title: 'b', start: 10, end: 15,
- type: tr.model.ThreadSlice}));
- m.sC = m.t4.sliceGroup.pushSlice(
- newSliceEx({title: 'c', start: 20, end: 20,
- type: tr.model.ThreadSlice}));
-
- m.t2.createSubSlices();
- m.t3.createSubSlices();
- m.t4.createSubSlices();
-
- m.f1 = newFlowEventEx({
- 'title': 'flowish', start: 0, end: 10,
- startSlice: m.sA,
- endSlice: m.sB
- });
- m.f2 = newFlowEventEx({
- 'title': 'flowish', start: 15, end: 21,
- startSlice: m.sB,
- endSlice: m.sC
- });
- });
-
- var selection = new tr.model.EventSet();
- selection.push(m.sA);
- selection.push(m.sB);
- selection.push(m.sC);
-
- var viewEl = document.createElement('tr-ui-a-multi-thread-slice-sub-view');
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_time_slice_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_time_slice_sub_view.html
deleted file mode 100644
index 6fba8d2e857..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_time_slice_sub_view.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_sub_view.html">
-
-<polymer-element name="tr-ui-a-multi-thread-time-slice-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- }
- #content {
- flex: 1 1 auto;
- }
- </style>
- <tr-ui-a-multi-event-sub-view id="content"></tr-ui-a-multi-event-sub-view>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.$.content.eventsHaveSubRows = false;
- },
-
- get selection() {
- return this.$.content.selection;
- },
-
- set selection(selection) {
- this.$.content.setSelectionWithoutErrorChecks(selection);
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_time_slice_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_time_slice_sub_view_test.html
deleted file mode 100644
index a0b88c033c9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_thread_time_slice_sub_view_test.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/multi_thread_time_slice_sub_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function createBasicModel() {
- var lines = [
- 'Android.launcher-584 [001] d..3 12622.506890: sched_switch: prev_comm=Android.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck
- ' Binder_1-217 [001] d..3 12622.506918: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=D ==> next_comm=Android.launcher next_pid=584 next_prio=120', // @suppress longLineCheck
- 'Android.launcher-584 [001] d..4 12622.506936: sched_wakeup: comm=Binder_1 pid=217 prio=120 success=1 target_cpu=001', // @suppress longLineCheck
- 'Android.launcher-584 [001] d..3 12622.506950: sched_switch: prev_comm=Android.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck
- ' Binder_1-217 [001] ...1 12622.507057: tracing_mark_write: B|128|queueBuffer', // @suppress longLineCheck
- ' Binder_1-217 [001] ...1 12622.507175: tracing_mark_write: E',
- ' Binder_1-217 [001] d..3 12622.507253: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=S ==> next_comm=Android.launcher next_pid=584 next_prio=120' // @suppress longLineCheck
- ];
-
- return tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shiftWorldToZero: false
- });
- }
-
- test('instantiate', function() {
- var m = createBasicModel();
-
- var thread = m.findAllThreadsNamed('Binder_1')[0];
-
- var selection = new tr.model.EventSet();
- selection.push(thread.timeSlices[0]);
- selection.push(thread.timeSlices[1]);
-
- var viewEl = document.createElement(
- 'tr-ui-a-multi-thread-time-slice-sub-view');
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_user_expectation_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_user_expectation_sub_view.html
deleted file mode 100644
index 34b70762345..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/multi_user_expectation_sub_view.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/multi_event_sub_view.html">
-<link rel="import"
- href="/tracing/ui/analysis/user_expectation_related_samples_table.html">
-
-<polymer-element name="tr-ui-a-multi-user-expectation-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- flex: 1 1 auto;
- }
- #events {
- margin-left: 8px;
- flex: 0 1 200px;
- }
- </style>
- <tr-ui-a-multi-event-sub-view id="realView"></tr-ui-a-multi-event-sub-view>
- <div id="events">
- <tr-ui-a-user-expectation-related-samples-table id="relatedSamples"></tr-ui-a-user-expectation-related-samples-table>
- </div>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.currentSelection_ = undefined;
- },
-
- set selection(selection) {
- this.currentSelection_ = selection;
- this.$.realView.setSelectionWithoutErrorChecks(selection);
-
- this.currentSelection_ = selection;
-
- this.$.relatedSamples.selection = selection;
- if (this.$.relatedSamples.hasRelatedSamples())
- this.$.events.style.display = '';
- else
- this.$.events.style.display = 'none';
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- get relatedEventsToHighlight() {
- if (!this.currentSelection_)
- return undefined;
- var selection = new tr.model.EventSet();
- this.currentSelection_.forEach(function(ir) {
- ir.associatedEvents.forEach(function(event) {
- selection.push(event);
- });
- });
- return selection;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/object_instance_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/object_instance_view.html
deleted file mode 100644
index f94aa245f6e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/object_instance_view.html
+++ /dev/null
@@ -1,62 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/extension_registry.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.analysis', function() {
- var ObjectInstanceView = tr.ui.b.define('object-instance-view');
-
- ObjectInstanceView.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.objectInstance_ = undefined;
- },
-
- get requiresTallView() {
- return true;
- },
-
- set modelEvent(obj) {
- this.objectInstance = obj;
- },
-
- get modelEvent() {
- return this.objectInstance;
- },
-
- get objectInstance() {
- return this.objectInstance_;
- },
-
- set objectInstance(i) {
- this.objectInstance_ = i;
- this.updateContents();
- },
-
- updateContents: function() {
- throw new Error('Not implemented');
- }
- };
-
- var options = new tr.b.ExtensionRegistryOptions(
- tr.b.TYPE_BASED_REGISTRY_MODE);
- options.mandatoryBaseClass = ObjectInstanceView;
- options.defaultMetadata = {
- showInTrackView: true
- };
- tr.b.decorateExtensionRegistry(ObjectInstanceView, options);
-
- return {
- ObjectInstanceView: ObjectInstanceView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/object_snapshot_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/object_snapshot_view.html
deleted file mode 100644
index a50747beefa..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/object_snapshot_view.html
+++ /dev/null
@@ -1,63 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/extension_registry.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.analysis', function() {
- var ObjectSnapshotView = tr.ui.b.define('object-snapshot-view');
-
- ObjectSnapshotView.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.objectSnapshot_ = undefined;
- },
-
- get requiresTallView() {
- return true;
- },
-
- set modelEvent(obj) {
- this.objectSnapshot = obj;
- },
-
- get modelEvent() {
- return this.objectSnapshot;
- },
-
- get objectSnapshot() {
- return this.objectSnapshot_;
- },
-
- set objectSnapshot(i) {
- this.objectSnapshot_ = i;
- this.updateContents();
- },
-
- updateContents: function() {
- throw new Error('Not implemented');
- }
- };
-
- var options = new tr.b.ExtensionRegistryOptions(
- tr.b.TYPE_BASED_REGISTRY_MODE);
- options.mandatoryBaseClass = ObjectSnapshotView;
- options.defaultMetadata = {
- showInstances: true,
- showInTrackView: true
- };
- tr.b.decorateExtensionRegistry(ObjectSnapshotView, options);
-
- return {
- ObjectSnapshotView: ObjectSnapshotView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/power_sample_summary_table.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/power_sample_summary_table.html
deleted file mode 100644
index ab314e42589..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/power_sample_summary_table.html
+++ /dev/null
@@ -1,129 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-a-power-sample-summary-table">
- <template>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.$.table.tableColumns = [
- {
- title: 'Min power',
- width: '100px',
- value: function(row) {
- return tr.v.Unit.byName.powerInWatts.format(row.min);
- }
- },
- {
- title: 'Max power',
- width: '100px',
- value: function(row) {
- return tr.v.Unit.byName.powerInWatts.format(row.max);
- }
- },
- {
- title: 'Time-weighted average',
- width: '100px',
- value: function(row) {
- return tr.v.Unit.byName.powerInWatts.format(
- row.timeWeightedAverage);
- }
- },
- {
- title: 'Energy consumed',
- width: '100px',
- value: function(row) {
- return tr.v.Unit.byName.energyInJoules.format(row.energyConsumed);
- }
- },
- {
- title: 'Sample count',
- width: '100%',
- value: function(row) { return row.sampleCount; }
- }
- ];
- this.samples = new tr.model.EventSet();
- },
-
- get samples() {
- return this.samples_;
- },
-
- set samples(samples) {
- if (samples === this.samples)
- return;
-
- this.samples_ =
- (samples === undefined) ? new tr.model.EventSet() : samples;
- this.updateContents_();
- },
-
- updateContents_: function() {
- if (this.samples.length === 0) {
- this.$.table.tableRows = [];
- } else {
- this.$.table.tableRows = [{
- min: this.getMin(),
- max: this.getMax(),
- timeWeightedAverage: this.getTimeWeightedAverage(),
- energyConsumed: this.getEnergyConsumed(),
- sampleCount: this.samples.length
- }];
- }
-
- this.$.table.rebuild();
- },
-
- getMin: function() {
- return Math.min.apply(null, this.samples.map(function(sample) {
- return sample.power;
- }));
- },
-
- getMax: function() {
- return Math.max.apply(null, this.samples.map(function(sample) {
- return sample.power;
- }));
- },
-
- /**
- * Returns a time-weighted average of the power consumption (Watts)
- * in between the first sample (inclusive) and last sample (exclusive).
- */
- getTimeWeightedAverage: function() {
- var energyConsumed = this.getEnergyConsumed();
-
- if (energyConsumed === 'N/A')
- return 'N/A';
-
- // Divide by 1000 to convert milliseconds to seconds.
- var durationInSeconds = this.samples.bounds.duration / 1000;
-
- // Convert energy to power in milliwatts by dividing by time in seconds.
- return this.getEnergyConsumed() / durationInSeconds;
- },
-
- getEnergyConsumed: function() {
- if (this.samples.length < 2)
- return 'N/A';
-
- var bounds = this.samples.bounds;
- var series = tr.b.getFirstElement(this.samples).series;
- return series.getEnergyConsumed(bounds.min, bounds.max);
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/power_sample_summary_table_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/power_sample_summary_table_test.html
deleted file mode 100644
index 82cc98dc1fb..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/power_sample_summary_table_test.html
+++ /dev/null
@@ -1,137 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/power_series.html">
-<link rel="import" href="/tracing/ui/analysis/power_sample_summary_table.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- var EventSet = tr.model.EventSet;
- var Model = tr.Model;
- var PowerSeries = tr.model.PowerSeries;
-
- test('instantiate', function() {
- var series = new PowerSeries(new Model().device);
-
- series.addPowerSample(0, 1);
- series.addPowerSample(1000, 2);
- series.addPowerSample(2000, 3);
- series.addPowerSample(3000, 4);
-
- var table = document.createElement('tr-ui-a-power-sample-summary-table');
- table.samples = new EventSet(series.samples);
-
- this.addHTMLOutput(table);
- });
-
- test('setSamples_undefinedPowerSamples', function() {
- var table = document.createElement('tr-ui-a-power-sample-summary-table');
- table.samples = undefined;
-
- assert.lengthOf(table.$.table.tableRows, 0);
- });
-
- test('setSamples_noPowerSamples', function() {
- var table = document.createElement('tr-ui-a-power-sample-summary-table');
- table.samples = new EventSet([]);
-
- assert.lengthOf(table.$.table.tableRows, 0);
- });
-
- test('setSamples_onePowerSample', function() {
- var series = new PowerSeries(new Model().device);
-
- series.addPowerSample(0, 1);
-
- var table = document.createElement('tr-ui-a-power-sample-summary-table');
- table.samples = new EventSet(series.samples);
-
- assert.lengthOf(table.$.table.tableRows, 1);
- assert.equal(table.$.table.tableRows[0].min, 1);
- assert.equal(table.$.table.tableRows[0].max, 1);
- assert.equal(table.$.table.tableRows[0].timeWeightedAverage, 'N/A');
- assert.equal(table.$.table.tableRows[0].energyConsumed, 'N/A');
- assert.equal(table.$.table.tableRows[0].sampleCount, 1);
- });
-
- test('setSamples_twoPowerSamples', function() {
- var series = new PowerSeries(new Model().device);
-
- series.addPowerSample(0, 1);
- series.addPowerSample(1000, 2);
-
- var table = document.createElement('tr-ui-a-power-sample-summary-table');
- table.samples = new EventSet(series.samples);
-
- assert.lengthOf(table.$.table.tableRows, 1);
- assert.equal(table.$.table.tableRows[0].min, 1);
- assert.equal(table.$.table.tableRows[0].max, 2);
- assert.equal(table.$.table.tableRows[0].timeWeightedAverage, 1);
- assert.equal(table.$.table.tableRows[0].energyConsumed, 1);
- assert.equal(table.$.table.tableRows[0].sampleCount, 2);
- });
-
- test('setSamples_threePowerSamples', function() {
- var series = new PowerSeries(new Model().device);
-
- series.addPowerSample(0, 1);
- series.addPowerSample(1000, 2);
- series.addPowerSample(2000, 3);
-
- var table = document.createElement('tr-ui-a-power-sample-summary-table');
- table.samples = new EventSet(series.samples);
-
- assert.lengthOf(table.$.table.tableRows, 1);
- assert.equal(table.$.table.tableRows[0].min, 1);
- assert.equal(table.$.table.tableRows[0].max, 3);
- assert.equal(table.$.table.tableRows[0].timeWeightedAverage, 1.5);
- assert.equal(table.$.table.tableRows[0].energyConsumed, 3);
- assert.equal(table.$.table.tableRows[0].sampleCount, 3);
- });
-
- test('setSamples_columnsInitialized', function() {
- var series = new PowerSeries(new Model().device);
-
- series.addPowerSample(0, 1);
- series.addPowerSample(1000, 2);
- series.addPowerSample(2000, 3);
-
- var table = document.createElement('tr-ui-a-power-sample-summary-table');
- table.samples = new EventSet(series.samples);
-
- var row = table.$.table.tableRows[0];
- var columns = table.$.table.tableColumns;
-
- assert.lengthOf(columns, 5);
-
- assert.equal(columns[0].title, 'Min power');
- assert.equal(columns[0].width, '100px');
- assert.equal(columns[0].value(row), '1.000 W');
-
- assert.equal(columns[1].title, 'Max power');
- assert.equal(columns[1].width, '100px');
- assert.equal(columns[1].value(row), '3.000 W');
-
- assert.equal(columns[2].title, 'Time-weighted average');
- assert.equal(columns[2].width, '100px');
- assert.equal(columns[2].value(row), '1.500 W');
-
- assert.equal(columns[3].title, 'Energy consumed');
- assert.equal(columns[3].width, '100px');
- assert.equal(columns[3].value(row), '3.000 J');
-
- assert.equal(columns[4].title, 'Sample count');
- assert.equal(columns[4].width, '100%');
- assert.equal(columns[4].value(row), 3);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/related_events.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/related_events.html
deleted file mode 100644
index faec4d0471e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/related_events.html
+++ /dev/null
@@ -1,263 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/base/task.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
-<link rel="import" href="/tracing/ui/analysis/flow_classifier.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-
-<polymer-element name="tr-ui-a-related-events">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
- #table {
- flex: 1 1 auto;
- align-self: stretch;
- }
- </style>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.eventGroups_ = [];
- this.cancelFunctions_ = [];
-
- this.$.table.tableColumns = [
- {
- title: 'Event(s)',
- value: function(row) {
- var typeEl = document.createElement('span');
- typeEl.innerText = row.type;
- if (row.tooltip)
- typeEl.title = row.tooltip;
- return typeEl;
- },
- width: '150px'
- },
- {
- title: 'Link',
- width: '100%',
- value: function(row) {
- var linkEl = document.createElement('tr-ui-a-analysis-link');
- if (row.name)
- linkEl.setSelectionAndContent(row.selection, row.name);
- else
- linkEl.selection = row.selection;
- return linkEl;
- }
- }
- ];
- },
-
- hasRelatedEvents: function() {
- return (this.eventGroups_ && this.eventGroups_.length > 0);
- },
-
- setRelatedEvents: function(eventSet) {
- this.cancelAllTasks_();
- this.eventGroups_ = [];
- this.addConnectedFlows_(eventSet);
- this.addConnectedEvents_(eventSet);
- this.addOverlappingSamples_(eventSet);
- this.updateContents_();
- },
-
- addConnectedFlows_: function(eventSet) {
- var classifier = new tr.ui.analysis.FlowClassifier();
- eventSet.forEach(function(slice) {
- if (slice.inFlowEvents) {
- slice.inFlowEvents.forEach(function(flow) {
- classifier.addInFlow(flow);
- });
- }
- if (slice.outFlowEvents) {
- slice.outFlowEvents.forEach(function(flow) {
- classifier.addOutFlow(flow);
- });
- }
- });
- if (!classifier.hasEvents())
- return;
-
- var addToEventGroups = function(type, flowEvent) {
- this.eventGroups_.push({
- type: type,
- selection: new tr.model.EventSet(flowEvent),
- name: flowEvent.title
- });
- };
-
- classifier.inFlowEvents.forEach(
- addToEventGroups.bind(this, 'Incoming flow'));
- classifier.outFlowEvents.forEach(
- addToEventGroups.bind(this, 'Outgoing flow'));
- classifier.internalFlowEvents.forEach(
- addToEventGroups.bind(this, 'Internal flow'));
- },
-
- cancelAllTasks_: function() {
- this.cancelFunctions_.forEach(function(cancelFunction) {
- cancelFunction();
- });
- this.cancelFunctions_ = [];
- },
-
- addConnectedEvents_: function(eventSet) {
- this.cancelFunctions_.push(this.createEventsLinkIfNeeded_(
- 'Preceding events',
- 'Add all events that have led to the selected one(s), connected by ' +
- 'flow arrows or by call stack.',
- eventSet,
- function(event, events) {
- this.addInFlowEvents_(event, events);
- this.addAncestors_(event, events);
- if (event.startSlice)
- events.push(event.startSlice);
- }.bind(this)));
- this.cancelFunctions_.push(this.createEventsLinkIfNeeded_(
- 'Following events',
- 'Add all events that have been caused by the selected one(s), ' +
- 'connected by flow arrows or by call stack.',
- eventSet,
- function(event, events) {
- this.addOutFlowEvents_(event, events);
- this.addDescendents_(event, events);
- if (event.endSlice)
- events.push(event.endSlice);
- }.bind(this)));
- this.cancelFunctions_.push(this.createEventsLinkIfNeeded_(
- 'All connected events',
- 'Add all events connected to the selected one(s) by flow arrows or ' +
- 'by call stack.',
- eventSet,
- function(event, events) {
- this.addInFlowEvents_(event, events);
- this.addOutFlowEvents_(event, events);
- this.addAncestors_(event, events);
- this.addDescendents_(event, events);
- if (event.startSlice)
- events.push(event.startSlice);
- if (event.endSlice)
- events.push(event.endSlice);
- }.bind(this)));
- },
-
- createEventsLinkIfNeeded_: function(title, tooltip, events, addFunction) {
- events = new tr.model.EventSet(events);
- var lengthBefore = events.length;
- var task;
- var isCanceled = false;
- function addEventsUntilTimeout(startingIndex) {
- if (isCanceled)
- return;
- var startingTime = window.performance.now();
- while (startingIndex < events.length) {
- addFunction(events[startingIndex], events);
- startingIndex++;
- // Let's grant ourselves a budget of 8ms.
- if (window.performance.now() - startingTime > 8) {
- var newTask = new tr.b.Task(
- addEventsUntilTimeout.bind(this, startingIndex), this);
- task.after(newTask);
- task = newTask;
- return;
- }
- }
- // Went through all events, add the link.
- if (lengthBefore === events.length)
- return;
- this.eventGroups_.push({
- type: title,
- tooltip: tooltip,
- selection: events
- });
- this.updateContents_();
- };
- function cancelTask() {
- isCanceled = true;
- }
- task = new tr.b.Task(addEventsUntilTimeout.bind(this, 0), this);
- tr.b.Task.RunWhenIdle(task);
- return cancelTask;
- },
-
- addInFlowEvents_: function(event, eventSet) {
- if (!event.inFlowEvents)
- return;
- event.inFlowEvents.forEach(function(e) {
- eventSet.push(e);
- });
- },
-
- addOutFlowEvents_: function(event, eventSet) {
- if (!event.outFlowEvents)
- return;
- event.outFlowEvents.forEach(function(e) {
- eventSet.push(e);
- });
- },
-
- addAncestors_: function(event, eventSet) {
- if (!event.iterateAllAncestors)
- return;
- event.iterateAllAncestors(function(e) {
- eventSet.push(e);
- });
- },
-
- addDescendents_: function(event, eventSet) {
- if (!event.iterateAllDescendents)
- return;
- event.iterateAllDescendents(function(e) {
- eventSet.push(e);
- });
- },
-
- addOverlappingSamples_: function(eventSet) {
- var samples = new tr.model.EventSet;
- eventSet.forEach(function(slice) {
- if (!slice.parentContainer || !slice.parentContainer.samples)
- return;
- var candidates = slice.parentContainer.samples;
- var range = tr.b.Range.fromExplicitRange(
- slice.start, slice.start + slice.duration);
- var filteredSamples = range.filterArray(
- candidates, function(value) {return value.start;});
- filteredSamples.forEach(function(sample) {
- samples.push(sample);
- });
- }.bind(this));
- if (samples.length > 0) {
- this.eventGroups_.push({
- type: 'Overlapping samples',
- tooltip: 'All samples overlapping the selected slice(s).',
- selection: samples
- });
- }
- },
-
- updateContents_: function() {
- var table = this.$.table;
- if (this.eventGroups_ === undefined)
- table.tableRows = [];
- else
- table.tableRows = this.eventGroups_.slice();
- table.rebuild();
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/related_events_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/related_events_test.html
deleted file mode 100644
index d7b0107c145..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/related_events_test.html
+++ /dev/null
@@ -1,217 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/raf.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/sample.html">
-<link rel="import" href="/tracing/model/thread_slice.html">
-<link rel="import" href="/tracing/ui/analysis/related_events.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newSliceEx = tr.c.TestUtils.newSliceEx;
- var newFlowEventEx = tr.c.TestUtils.newFlowEventEx;
-
- function createModel() {
- var m = tr.c.TestUtils.newModel(function(m) {
- m.p1 = m.getOrCreateProcess(1);
-
- m.t2 = m.p1.getOrCreateThread(2);
- m.t3 = m.p1.getOrCreateThread(3);
- m.t4 = m.p1.getOrCreateThread(4);
-
- // Setup samples and slices in this way:
- // 0 5 10 15 20
- // _____________________________
- // t2 *
- // [ a ][ ]aa
- // -----------------------------
- // t3 * * * * *
- // * *
- // [ b ]
- // [bb]
- // []bbb
- // -----------------------------
- // t4 |c
- // -----------------------------
- m.samples.push(
- new tr.model.Sample(null, m.t3, 'b10_1', 10),
- new tr.model.Sample(null, m.t3, 'b7', 7),
- new tr.model.Sample(null, m.t3, 'b12', 12),
- new tr.model.Sample(null, m.t3, 'b20', 20),
- new tr.model.Sample(null, m.t3, 'b10_2', 10),
- new tr.model.Sample(null, m.t3, 'b15_1', 15),
- new tr.model.Sample(null, m.t3, 'b15_2', 15),
- new tr.model.Sample(null, m.t2, 'a12', 12)
- );
-
- m.sA = m.t2.sliceGroup.pushSlice(
- newSliceEx({title: 'a', start: 0, end: 5,
- type: tr.model.ThreadSlice}));
- m.sAA = m.t2.sliceGroup.pushSlice(
- newSliceEx({title: 'aa', start: 6, end: 8,
- type: tr.model.ThreadSlice}));
- m.sB = m.t3.sliceGroup.pushSlice(
- newSliceEx({title: 'b', start: 10, end: 15,
- type: tr.model.ThreadSlice}));
- m.sBB = m.t3.sliceGroup.pushSlice(
- newSliceEx({title: 'bb', start: 11, end: 14,
- type: tr.model.ThreadSlice}));
- m.sBBB = m.t3.sliceGroup.pushSlice(
- newSliceEx({title: 'bbb', start: 12, end: 13,
- type: tr.model.ThreadSlice}));
- m.sC = m.t4.sliceGroup.pushSlice(
- newSliceEx({title: 'c', start: 20, end: 20,
- type: tr.model.ThreadSlice}));
-
- m.t2.createSubSlices();
- m.t3.createSubSlices();
- m.t4.createSubSlices();
-
- // Add flow events.
- m.f0 = newFlowEventEx({
- 'title': 'a_aa', start: 5, end: 6,
- startSlice: m.sA,
- endSlice: m.sAA
- });
- m.f1 = newFlowEventEx({
- 'title': 'a_b', start: 0, end: 10,
- startSlice: m.sA,
- endSlice: m.sB
- });
- m.f2 = newFlowEventEx({
- 'title': 'b_bbb', start: 10, end: 12,
- startSlice: m.sB,
- endSlice: m.sBBB
- });
- m.f3 = newFlowEventEx({
- 'title': 'bbb_c', start: 13, end: 20,
- startSlice: m.sBBB,
- endSlice: m.sC
- });
- });
- return m;
- };
-
- test('instantiate', function() {
- var m = createModel();
-
- var viewEl = document.createElement('tr-ui-a-related-events');
- var selection = new tr.model.EventSet(
- [m.sA, m.f0, m.sAA, m.f1, m.sB, m.f2, m.sBB, m.sBBB, m.f3, m.sC]);
- viewEl.setRelatedEvents(selection);
- this.addHTMLOutput(viewEl);
- tr.b.forceAllPendingTasksToRunForTest();
-
- // Check that the element handles multiple setRelatedEvents calls correctly.
- assert.lengthOf(viewEl.$.table.tableRows, 5);
- viewEl.setRelatedEvents(selection);
- assert.lengthOf(viewEl.$.table.tableRows, 5);
- });
-
- test('validateFlows', function() {
- var m = createModel();
-
- var viewEl = document.createElement('tr-ui-a-related-events');
- viewEl.setRelatedEvents(new tr.model.EventSet([m.sB, m.sBB, m.sBBB]));
- this.addHTMLOutput(viewEl);
- tr.b.forceAllPendingTasksToRunForTest();
-
- var inFlows, outFlows, internalFlows;
- viewEl.$.table.tableRows.forEach(function(row) {
- if (row.type === 'Incoming flow') {
- assert.isUndefined(inFlows);
- inFlows = row.selection;
- }
- if (row.type === 'Outgoing flow') {
- assert.isUndefined(outFlows);
- outFlows = row.selection;
- }
- if (row.type === 'Internal flow') {
- assert.isUndefined(internalFlows);
- internalFlows = row.selection;
- }
- });
- assert.equal(inFlows.length, 1);
- assert.equal(tr.b.getOnlyElement(inFlows).title, 'a_b');
- assert.equal(outFlows.length, 1);
- assert.equal(tr.b.getOnlyElement(outFlows).title, 'bbb_c');
- assert.equal(internalFlows.length, 1);
- assert.equal(tr.b.getOnlyElement(internalFlows).title, 'b_bbb');
- });
-
- test('validateConnectedEvents', function() {
- var m = createModel();
-
- var viewEl = document.createElement('tr-ui-a-related-events');
- viewEl.setRelatedEvents(new tr.model.EventSet([m.sBB]));
- this.addHTMLOutput(viewEl);
- tr.b.forceAllPendingTasksToRunForTest();
-
- var precedingEvents, followingEvents, allEvents;
- viewEl.$.table.tableRows.forEach(function(row) {
- if (row.type === 'Preceding events') {
- assert.isUndefined(precedingEvents);
- precedingEvents = row.selection;
- }
- if (row.type === 'Following events') {
- assert.isUndefined(followingEvents);
- followingEvents = row.selection;
- }
- if (row.type === 'All connected events') {
- assert.isUndefined(allEvents);
- allEvents = row.selection;
- }
- });
-
- var precedingTitles = precedingEvents.map(function(e) {
- return e.title;
- });
- assert.sameMembers(precedingTitles, ['a', 'a_b', 'b', 'bb']);
-
- var followingTitles = followingEvents.map(function(e) {
- return e.title;
- });
- assert.sameMembers(followingTitles, ['bb', 'bbb', 'bbb_c', 'c']);
-
- var allTitles = allEvents.map(function(e) {
- return e.title;
- });
- assert.sameMembers(allTitles,
- ['a', 'a_aa', 'aa', 'a_b', 'b', 'bb', 'bbb', 'b_bbb', 'bbb_c', 'c']);
- });
-
- test('validateOverlappingSamples', function() {
- var m = createModel();
-
- var viewEl = document.createElement('tr-ui-a-related-events');
- viewEl.setRelatedEvents(new tr.model.EventSet([m.sB]));
- this.addHTMLOutput(viewEl);
- tr.b.forceAllPendingTasksToRunForTest();
-
- var overlappingSamples;
- viewEl.$.table.tableRows.forEach(function(row) {
- if (row.type === 'Overlapping samples') {
- assert.isUndefined(overlappingSamples);
- overlappingSamples = row.selection;
- }
- });
-
- var samplesTitles = overlappingSamples.map(function(e) {
- return e.title;
- });
- assert.sameMembers(samplesTitles,
- ['b10_1', 'b10_2', 'b12', 'b15_1', 'b15_2']);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/selection_summary_table.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/selection_summary_table.html
deleted file mode 100644
index cc3c00e410c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/selection_summary_table.html
+++ /dev/null
@@ -1,94 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name='tr-ui-a-selection-summary-table'>
- <template>
- <style>
- :host {
- display: flex;
- }
- #table {
- flex: 1 1 auto;
- align-self: stretch;
- }
- </style>
- <tr-ui-b-table id="table">
- </tr-ui-b-table>
- </div>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.selection_ = new tr.b.Range();
- },
-
- ready: function() {
- this.$.table.showHeader = false;
- this.$.table.tableColumns = [
- {
- title: 'Name',
- value: function(row) { return row.title; },
- width: '350px'
- },
- {
- title: 'Value',
- width: '100%',
- value: function(row) {
- return row.value;
- }
- }
- ];
- },
-
- get selection() {
- return this.selection_;
- },
-
- set selection(selection) {
- this.selection_ = selection;
- this.updateContents_();
- },
-
- updateContents_: function() {
- var selection = this.selection_;
- var rows = [];
- var hasRange;
- if (this.selection_ && (!selection.bounds.isEmpty))
- hasRange = true;
- else
- hasRange = false;
-
- rows.push({
- title: 'Selection start',
- value: hasRange ? tr.v.ui.createScalarSpan(
- selection.bounds.min, {
- unit: tr.v.Unit.byName.timeStampInMs,
- ownerDocument: this.ownerDocument
- }) : '<empty>'
- });
- rows.push({
- title: 'Selection extent',
- value: hasRange ? tr.v.ui.createScalarSpan(
- selection.bounds.range, {
- unit: tr.v.Unit.byName.timeDurationInMs,
- ownerDocument: this.ownerDocument
- }) : '<empty>'
- });
-
- this.$.table.tableRows = rows;
- this.$.table.rebuild();
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/selection_summary_table_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/selection_summary_table_test.html
deleted file mode 100644
index 5c1f1691efd..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/selection_summary_table_test.html
+++ /dev/null
@@ -1,75 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/selection_summary_table.html">
-<link rel="import" href="/tracing/ui/base/deep_utils.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Model = tr.Model;
- var EventSet = tr.model.EventSet;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
-
- test('noSelection', function() {
- var summaryTable =
- document.createElement('tr-ui-a-selection-summary-table');
- summaryTable.selection = undefined;
- this.addHTMLOutput(summaryTable);
-
- var tableEl = tr.b.findDeepElementMatching(
- summaryTable, 'tr-ui-b-table');
- assert.equal(tableEl.tableRows[0].value, '<empty>');
- assert.equal(tableEl.tableRows[1].value, '<empty>');
- });
-
- test('emptySelection', function() {
- var summaryTable =
- document.createElement('tr-ui-a-selection-summary-table');
- var selection = new EventSet();
- summaryTable.selection = selection;
- this.addHTMLOutput(summaryTable);
-
- var tableEl = tr.b.findDeepElementMatching(
- summaryTable, 'tr-ui-b-table');
- assert.equal(tableEl.tableRows[0].value, '<empty>');
- assert.equal(tableEl.tableRows[1].value, '<empty>');
- });
-
- test('selection', function() {
- var model = new Model();
- var thread = model.getOrCreateProcess(1).getOrCreateThread(2);
- var tsg = thread.sliceGroup;
-
- tsg.pushSlice(newSliceEx({title: 'a', start: 0, end: 3}));
- tsg.pushSlice(newSliceEx({title: 'b', start: 1, end: 2}));
-
- var selection = new EventSet();
- selection.push(tsg.slices[0]);
- selection.push(tsg.slices[1]);
-
- var summaryTable =
- document.createElement('tr-ui-a-selection-summary-table');
- summaryTable.selection = selection;
- this.addHTMLOutput(summaryTable);
-
- var tableEl = tr.b.findDeepElementMatching(
- summaryTable, 'tr-ui-b-table');
- assert.equal(tableEl.tableRows[0].value.value, 0);
- assert.strictEqual(tableEl.tableRows[0].value.unit,
- tr.v.Unit.byName.timeStampInMs);
- assert.equal(tableEl.tableRows[1].value.value, 3);
- assert.strictEqual(tableEl.tableRows[1].value.unit,
- tr.v.Unit.byName.timeDurationInMs);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_alert_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_alert_sub_view.html
deleted file mode 100644
index 89d8ade4c5b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_alert_sub_view.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/single_event_sub_view.html">
-
-<polymer-element name="tr-ui-a-single-alert-sub-view"
- extends="tr-ui-a-sub-view">
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.currentSelection_ = undefined;
- },
-
- set selection(selection) {
- this.currentSelection_ = selection;
-
- this.textContent = '';
- var realView = document.createElement('tr-ui-a-single-event-sub-view');
- realView.addExtraRowsCallback = function(rows) {
- // Alert description.
- var alert = this.currentSelection_[0];
-
- var descriptionEl = tr.ui.b.createSpan({
- textContent: alert.info.description
- });
- rows.push({
- name: 'Description',
- value: descriptionEl
- });
-
- // Associated events...
- if (alert.associatedEvents.length) {
- var eventSubRows = [];
- alert.associatedEvents.forEach(function(event, i) {
- var linkEl = document.createElement('tr-ui-a-analysis-link');
- linkEl.setSelectionAndContent(function() {
- return event;
- }, event.userFriendlyName);
- eventSubRows.push({
- name: i,
- value: linkEl
- });
- });
-
- rows.push({
- name: 'Alerts', value: '',
- isExpanded: true, subRows: eventSubRows
- });
- }
- }.bind(this);
-
- this.appendChild(realView);
- realView.setSelectionWithoutErrorChecks(selection);
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_async_slice_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_async_slice_sub_view.html
deleted file mode 100644
index 26a47706165..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_async_slice_sub_view.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/related_events.html">
-<link rel="import" href="/tracing/ui/analysis/single_event_sub_view.html">
-
-<polymer-element name="tr-ui-a-single-async-slice-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: row;
- }
- #events {
- display:flex;
- flex-direction: column;
- }
- </style>
- <tr-ui-a-single-event-sub-view id="content"></tr-ui-a-single-event-sub-view>
- <div id="events">
- <tr-ui-a-related-events id="relatedEvents"></tr-ui-a-related-events>
- </div>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- get selection() {
- return this.$.content.selection;
- },
-
- set selection(selection) {
- if (selection.length !== 1)
- throw new Error('Only supports single slices');
- this.$.content.setSelectionWithoutErrorChecks(selection);
- this.$.relatedEvents.setRelatedEvents(selection);
- if (this.$.relatedEvents.hasRelatedEvents()) {
- this.$.relatedEvents.style.display = '';
- } else {
- this.$.relatedEvents.style.display = 'none';
- }
- },
-
- getEventRows_: function(event) {
- // TODO(nduca): Figure out if there is a cleaner way to do this.
- var rows = this.__proto__.__proto__.getEventRows_(event);
-
- // Put the ID up top.
- rows.splice(0, 0, {
- name: 'ID',
- value: event.id
- });
- return rows;
- },
-
- get relatedEventsToHighlight() {
- if (!this.currentSelection_)
- return undefined;
- return tr.b.getOnlyElement(this.currentSelection_).associatedEvents;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_async_slice_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_async_slice_sub_view_test.html
deleted file mode 100644
index cc83a239bab..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_async_slice_sub_view_test.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/single_async_slice_sub_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newAsyncSliceEx = tr.c.TestUtils.newAsyncSliceEx;
-
- test('instantiate', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
- t1.asyncSliceGroup.push(newAsyncSliceEx({
- id: 31415,
- title: 'a',
- start: 10,
- duration: 20,
- startThread: t1,
- endThread: t1
- }));
-
- var selection = new tr.model.EventSet();
- selection.push(t1.asyncSliceGroup.slices[0]);
-
- var viewEl = document.createElement('tr-ui-a-single-async-slice-sub-view');
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_cpu_slice_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_cpu_slice_sub_view.html
deleted file mode 100644
index 42081c5baf1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_cpu_slice_sub_view.html
+++ /dev/null
@@ -1,139 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-a-single-cpu-slice-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- table {
- border-collapse: collapse;
- border-width: 0;
- margin-bottom: 25px;
- width: 100%;
- }
-
- table tr > td:first-child {
- padding-left: 2px;
- }
-
- table tr > td {
- padding: 2px 4px 2px 4px;
- vertical-align: text-top;
- width: 150px;
- }
-
- table td td {
- padding: 0 0 0 0;
- width: auto;
- }
- tr {
- vertical-align: top;
- }
-
- tr:nth-child(2n+0) {
- background-color: #e2e2e2;
- }
- </style>
- <table>
- <tr>
- <td>Running process:</td><td id="process-name"></td>
- </tr>
- <tr>
- <td>Running thread:</td><td id="thread-name"></td>
- </tr>
- <tr>
- <td>Start:</td>
- <td>
- <tr-v-ui-scalar-span id="start">
- </tr-v-ui-scalar-span>
- </td>
- </tr>
- <tr>
- <td>Duration:</td>
- <td>
- <tr-v-ui-scalar-span id="duration">
- </tr-v-ui-scalar-span>
- </td>
- </tr>
- <tr>
- <td>Active slices:</td><td id="running-thread"></td>
- </tr>
- <tr>
- <td>Args:</td>
- <td>
- <tr-ui-a-generic-object-view id="args">
- </tr-ui-a-generic-object-view>
- </td>
- </tr>
- </table>
- </template>
-
- <script>
- 'use strict';
- Polymer({
- created: function() {
- this.currentSelection_ = undefined;
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- set selection(selection) {
- var cpuSlice = tr.b.getOnlyElement(selection);
- if (!(cpuSlice instanceof tr.model.CpuSlice))
- throw new Error('Only supports thread time slices');
-
- this.currentSelection_ = selection;
-
- var thread = cpuSlice.threadThatWasRunning;
-
- var shadowRoot = this.shadowRoot;
- if (thread) {
- shadowRoot.querySelector('#process-name').textContent =
- thread.parent.userFriendlyName;
- shadowRoot.querySelector('#thread-name').textContent =
- thread.userFriendlyName;
- } else {
- shadowRoot.querySelector('#process-name').parentElement.style.display =
- 'none';
- shadowRoot.querySelector('#thread-name').textContent = cpuSlice.title;
- }
-
- shadowRoot.querySelector('#start').setValueAndUnit(
- cpuSlice.start, tr.v.Unit.byName.timeStampInMs);
- shadowRoot.querySelector('#duration').setValueAndUnit(
- cpuSlice.duration, tr.v.Unit.byName.timeDurationInMs);
-
- var runningThreadEl = shadowRoot.querySelector('#running-thread');
-
- var timeSlice = cpuSlice.getAssociatedTimeslice();
- if (!timeSlice) {
- runningThreadEl.parentElement.style.display = 'none';
- } else {
- var threadLink = document.createElement('tr-ui-a-analysis-link');
- threadLink.selection = new tr.model.EventSet(timeSlice);
- threadLink.textContent = 'Click to select';
- runningThreadEl.parentElement.style.display = '';
- runningThreadEl.textContent = '';
- runningThreadEl.appendChild(threadLink);
- }
-
- shadowRoot.querySelector('#args').object = cpuSlice.args;
-
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_cpu_slice_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_cpu_slice_sub_view_test.html
deleted file mode 100644
index ea75afe6dcf..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_cpu_slice_sub_view_test.html
+++ /dev/null
@@ -1,81 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/single_cpu_slice_sub_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function createBasicModel() {
- var lines = [
- 'Android.launcher-584 [001] d..3 12622.506890: sched_switch: prev_comm=Android.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck
- ' Binder_1-217 [001] d..3 12622.506918: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=D ==> next_comm=Android.launcher next_pid=584 next_prio=120', // @suppress longLineCheck
- 'Android.launcher-584 [001] d..4 12622.506936: sched_wakeup: comm=Binder_1 pid=217 prio=120 success=1 target_cpu=001', // @suppress longLineCheck
- 'Android.launcher-584 [001] d..3 12622.506950: sched_switch: prev_comm=Android.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck
- ' Binder_1-217 [001] ...1 12622.507057: tracing_mark_write: B|128|queueBuffer', // @suppress longLineCheck
- ' Binder_1-217 [001] ...1 12622.507175: tracing_mark_write: E',
- ' Binder_1-217 [001] d..3 12622.507253: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=S ==> next_comm=Android.launcher next_pid=584 next_prio=120' // @suppress longLineCheck
- ];
-
- return tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shiftWorldToZero: false
- });
- }
-
- test('cpuSliceView_withCpuSliceOnExistingThread', function() {
- var m = createBasicModel();
-
- var cpu = m.kernel.cpus[1];
- assert.isDefined(cpu);
- var cpuSlice = cpu.slices[0];
- assert.equal('Binder_1', cpuSlice.title);
-
- var thread = m.findAllThreadsNamed('Binder_1')[0];
- assert.isDefined(thread);
- assert.equal(cpuSlice.threadThatWasRunning, thread);
-
- var view = document.createElement('tr-ui-a-single-cpu-slice-sub-view');
- var selection = new tr.model.EventSet();
- selection.push(cpuSlice);
- view.selection = selection;
- this.addHTMLOutput(view);
-
- // Clicking the analysis link should focus the Binder1's timeslice.
- var didSelectionChangeHappen = false;
- view.addEventListener('requestSelectionChange', function(e) {
- assert.isTrue(e.selection.equals(
- new tr.model.EventSet(thread.timeSlices[0])));
- didSelectionChangeHappen = true;
- });
- view.shadowRoot.querySelector('tr-ui-a-analysis-link').click();
- assert.isTrue(didSelectionChangeHappen);
- });
-
- test('cpuSliceViewWithCpuSliceOnMissingThread', function() {
- var m = createBasicModel();
-
- var cpu = m.kernel.cpus[1];
- assert.isDefined(cpu);
- var cpuSlice = cpu.slices[1];
- assert.equal('Android.launcher', cpuSlice.title);
- assert.isUndefined(cpuSlice.thread);
-
- var selection = new tr.model.EventSet();
- selection.push(cpuSlice);
-
- var view = document.createElement('tr-ui-a-single-cpu-slice-sub-view');
- view.selection = selection;
- this.addHTMLOutput(view);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_event_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_event_sub_view.html
deleted file mode 100644
index 74a82c95348..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_event_sub_view.html
+++ /dev/null
@@ -1,286 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-<link rel="import" href="/tracing/ui/analysis/stack_frame.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-a-single-event-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
- #table {
- flex: 1 1 auto;
- align-self: stretch;
- }
- </style>
- <tr-ui-b-table id="table">
- </tr-ui-b-table>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.currentSelection_ = undefined;
- this.$.table.tableColumns = [
- {
- title: 'Label',
- value: function(row) { return row.name; },
- width: '150px'
- },
- {
- title: 'Value',
- width: '100%',
- value: function(row) { return row.value; }
- }
- ];
- this.$.table.showHeader = false;
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- set selection(selection) {
- if (selection.length !== 1)
- throw new Error('Only supports single slices');
- this.setSelectionWithoutErrorChecks(selection);
- },
-
- setSelectionWithoutErrorChecks: function(selection) {
- this.currentSelection_ = selection;
- this.updateContents_();
- },
-
- getEventRows_: function(event) {
- var rows = [];
-
- if (event.error)
- rows.push({ name: 'Error', value: event.error });
-
- if (event.title)
- rows.push({ name: 'Title', value: event.title });
-
- if (event.category)
- rows.push({ name: 'Category', value: event.category });
-
- if (event.model !== undefined) {
- var ufc = event.model.getUserFriendlyCategoryFromEvent(event);
- if (ufc !== undefined)
- rows.push({ name: 'User Friendly Category', value: ufc });
- }
-
- if (event.name)
- rows.push({ name: 'Name', value: event.name });
-
- rows.push({
- name: 'Start',
- value: tr.v.ui.createScalarSpan(event.start, {
- unit: tr.v.Unit.byName.timeStampInMs
- })
- });
-
- if (event.duration) {
- rows.push({
- name: 'Wall Duration',
- value: tr.v.ui.createScalarSpan(event.duration, {
- unit: tr.v.Unit.byName.timeDurationInMs
- })
- });
- }
-
- if (event.cpuDuration) {
- rows.push({
- name: 'CPU Duration',
- value: tr.v.ui.createScalarSpan(event.cpuDuration, {
- unit: tr.v.Unit.byName.timeDurationInMs
- })
- });
- }
-
- if (event.subSlices !== undefined && event.subSlices.length !== 0) {
- if (event.selfTime) {
- rows.push({
- name: 'Self Time',
- value: tr.v.ui.createScalarSpan(event.selfTime, {
- unit: tr.v.Unit.byName.timeDurationInMs
- })
- });
- }
-
- if (event.cpuSelfTime) {
- var cpuSelfTimeEl = tr.v.ui.createScalarSpan(event.cpuSelfTime, {
- unit: tr.v.Unit.byName.timeDurationInMs
- });
- if (event.cpuSelfTime > event.selfTime) {
- cpuSelfTimeEl.warning =
- ' Note that CPU Self Time is larger than Self Time. ' +
- 'This is a known limitation of this system, which occurs ' +
- 'due to several subslices, rounding issues, and imprecise ' +
- 'time at which we get cpu- and real-time.';
- }
- rows.push({ name: 'CPU Self Time', value: cpuSelfTimeEl });
- }
- }
-
- if (event.durationInUserTime) {
- rows.push({
- name: 'Duration (U)',
- value: tr.v.ui.createScalarSpan(event.durationInUserTime, {
- unit: tr.v.Unit.byName.timeDurationInMs
- })
- });
- }
-
- function createStackFrameEl(sf) {
- var sfEl = document.createElement('tr-ui-a-stack-frame');
- sfEl.stackFrame = sf;
- return sfEl;
- }
- if (event.startStackFrame && event.endStackFrame) {
- if (event.startStackFrame === event.endStackFrame) {
- rows.push({name: 'Start+End Stack Trace',
- value: createStackFrameEl(event.startStackFrame)});
-
- } else {
- rows.push({ name: 'Start Stack Trace',
- value: createStackFrameEl(event.startStackFrame)});
- rows.push({ name: 'End Stack Trace',
- value: createStackFrameEl(event.endStackFrame)});
- }
- } else if (event.startStackFrame) {
- rows.push({ name: 'Start Stack Trace',
- value: createStackFrameEl(event.startStackFrame)});
-
- } else if (event.endStackFrame) {
- rows.push({ name: 'End Stack Trace',
- value: createStackFrameEl(event.endStackFrame)});
- }
-
- if (event.info) {
- var descriptionEl = tr.ui.b.createDiv({
- textContent: event.info.description,
- maxWidth: '300px'
- });
- rows.push({
- name: 'Description',
- value: descriptionEl
- });
-
-
- if (event.info.docLinks) {
- event.info.docLinks.forEach(function(linkObject) {
- var linkEl = document.createElement('a');
- linkEl.target = '_blank';
- linkEl.href = linkObject.href;
- linkEl.textContent = linkObject.textContent;
- rows.push({
- name: linkObject.label,
- value: linkEl
- });
- });
- }
- }
-
- if (event.associatedAlerts.length) {
- var alertSubRows = [];
- event.associatedAlerts.forEach(function(alert) {
- var linkEl = document.createElement('tr-ui-a-analysis-link');
- linkEl.setSelectionAndContent(function() {
- return new tr.model.EventSet(alert);
- }, alert.info.description);
- alertSubRows.push({
- name: alert.title,
- value: linkEl
- });
- });
-
- rows.push({
- name: 'Alerts', value: '',
- isExpanded: true, subRows: alertSubRows
- });
- }
- return rows;
- },
-
- addArgsToRows_: function(rows, args) {
- var n = 0;
- for (var argName in args) {
- n += 1;
- }
- if (n > 0) {
- var subRows = [];
- for (var argName in args) {
- var argView =
- document.createElement('tr-ui-a-generic-object-view');
- argView.object = args[argName];
- subRows.push({name: argName, value: argView});
- }
- rows.push({
- name: 'Args',
- value: '',
- isExpanded: true,
- subRows: subRows
- });
- }
- },
-
- addContextsToRows_: function(rows, contexts) {
- if (contexts.length) {
- var subRows = contexts.map(function(context) {
- var contextView =
- document.createElement('tr-ui-a-generic-object-view');
- contextView.object = context;
- return {name: 'Context', value: contextView};
- });
- rows.push({
- name: 'Contexts',
- value: '',
- isExpanded: true,
- subRows: subRows
- });
- }
- },
-
- updateContents_: function() {
- if (this.currentSelection_ === undefined) {
- this.$.table.rows = [];
- this.$.table.rebuild();
- return;
- }
-
- var event = tr.b.getOnlyElement(this.currentSelection_);
-
- var rows = this.getEventRows_(event);
- if (event.argsStripped)
- rows.push({ name: 'Args', value: 'Stripped' });
- else
- this.addArgsToRows_(rows, event.args);
- this.addContextsToRows_(rows, event.contexts);
-
- var event = new tr.b.Event('customize-rows');
- event.rows = rows;
- this.dispatchEvent(event);
-
- this.$.table.tableRows = rows;
- this.$.table.rebuild();
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_event_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_event_sub_view_test.html
deleted file mode 100644
index b52ebaa16bc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_event_sub_view_test.html
+++ /dev/null
@@ -1,261 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/single_event_sub_view.html">
-<link rel="import" href="/tracing/ui/base/deep_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Model = tr.Model;
- var Thread = tr.model.Thread;
- var EventSet = tr.model.EventSet;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
-
- function createSelection(customizeThreadCallback) {
- var model = tr.c.TestUtils.newModelWithEvents([], {
- customizeModelCallback: function(model) {
- var t53 = model.getOrCreateProcess(52).getOrCreateThread(53);
- customizeThreadCallback(t53, model);
- }
- });
-
- var t53 = model.processes[52].threads[53];
- var t53track = {};
- t53track.thread = t53;
-
- var selection = new EventSet();
- selection.push(t53.sliceGroup.slices[0]);
- assert.equal(selection.length, 1);
-
- return selection;
- }
-
- function createSelectionWithSingleSlice(opt_options) {
- var options = opt_options || {};
- return createSelection(function(t53, model) {
- if (options.withStartStackFrame || options.withEndStackFrame) {
- var fA = tr.c.TestUtils.newStackTrace(model, ['a1', 'a2']);
- var fB = tr.c.TestUtils.newStackTrace(model, ['b1', 'b2']);
- }
-
- var slice = newSliceEx({title: 'b', start: 0, duration: 0.002});
- slice.category = options.withCategory ? 'foo' : '';
-
- if (options.withStartStackFrame)
- slice.startStackFrame = options.withStartStackFrame === 'a' ? fA : fB;
-
- if (options.withEndStackFrame)
- slice.endStackFrame = options.withEndStackFrame === 'a' ? fA : fB;
-
- t53.sliceGroup.pushSlice(slice);
- });
- };
-
- test('instantiate_withSingleSlice', function() {
- var selection = createSelectionWithSingleSlice();
-
- var analysisEl = document.createElement('tr-ui-a-single-event-sub-view');
- analysisEl.selection = selection;
- this.addHTMLOutput(analysisEl);
- });
-
- test('alerts', function() {
- var slice = newSliceEx({title: 'b', start: 0, duration: 0.002});
-
- var ALERT_INFO_1 = new tr.model.EventInfo(
- 'Alert 1', 'Critical alert');
-
- var alert = new tr.model.Alert(ALERT_INFO_1, 5, [slice]);
-
- var selection = new EventSet();
- selection.push(slice);
-
- var analysisEl = document.createElement('tr-ui-a-single-event-sub-view');
- analysisEl.selection = selection;
- this.addHTMLOutput(analysisEl);
- });
-
- test('instantiate_withSingleSliceWithArg', function() {
- var selection = createSelection(function(t53) {
- var slice = newSliceEx({title: 'my_slice', start: 0, duration: 1.0});
- slice.args = {
- 'complex': {
- 'b': '2 as a string',
- 'c': [3, 4, 5]
- }
- };
- t53.sliceGroup.pushSlice(slice);
- });
-
- var subView = document.createElement('tr-ui-a-single-event-sub-view');
- subView.selection = selection;
- this.addHTMLOutput(subView);
-
- var gov = tr.b.findDeepElementMatching(subView,
- 'tr-ui-a-generic-object-view');
- assert.isDefined(gov);
- });
-
-
- test('instantiate_withSingleSliceCategory', function() {
- var selection = createSelectionWithSingleSlice({withCategory: true});
-
- var analysisEl = document.createElement('tr-ui-a-single-event-sub-view');
- analysisEl.selection = selection;
- this.addHTMLOutput(analysisEl);
- });
-
- test('instantiate_withSingleStartStackFrame', function() {
- var selection = createSelectionWithSingleSlice(
- {withStartStackFrame: 'a'});
-
- var analysisEl = document.createElement('tr-ui-a-single-event-sub-view');
- analysisEl.selection = selection;
- this.addHTMLOutput(analysisEl);
-
- var e = tr.b.findDeepElementWithTextContent(
- analysisEl, /Start Stack Trace/);
- assert.isDefined(e);
- assert.isDefined(e.nextSibling.children[0].stackFrame);
- });
-
- test('instantiate_withSingleEndStackFrame', function() {
- var selection = createSelectionWithSingleSlice(
- {withEndStackFrame: 'b'});
-
- var analysisEl = document.createElement('tr-ui-a-single-event-sub-view');
- analysisEl.selection = selection;
- this.addHTMLOutput(analysisEl);
-
- var e = tr.b.findDeepElementWithTextContent(
- analysisEl, /End Stack Trace/);
- assert.isDefined(e);
- assert.isDefined(e.nextSibling.children[0].stackFrame);
- assert.equal(e.nextSibling.children[0].stackFrame.title, 'b2');
- });
-
- test('instantiate_withDifferentStartAndEndStackFrames', function() {
- var selection = createSelectionWithSingleSlice(
- {withStartStackFrame: 'a',
- withEndStackFrame: 'b'});
-
- var analysisEl = document.createElement('tr-ui-a-single-event-sub-view');
- analysisEl.selection = selection;
- this.addHTMLOutput(analysisEl);
-
- var eA = tr.b.findDeepElementWithTextContent(
- analysisEl, /Start Stack Trace/);
- assert.isDefined(eA);
- assert.isDefined(eA.nextSibling.children[0].stackFrame);
- assert.equal(eA.nextSibling.children[0].stackFrame.title, 'a2');
-
- var eB = tr.b.findDeepElementWithTextContent(
- analysisEl, /End Stack Trace/);
- assert.isDefined(eB);
- assert.isDefined(eB.nextSibling.children[0].stackFrame);
- assert.equal(eB.nextSibling.children[0].stackFrame.title, 'b2');
- });
-
- test('instantiate_withSameStartAndEndStackFrames', function() {
- var selection = createSelectionWithSingleSlice(
- {withStartStackFrame: 'a',
- withEndStackFrame: 'a'});
-
- var analysisEl = document.createElement('tr-ui-a-single-event-sub-view');
- analysisEl.selection = selection;
- this.addHTMLOutput(analysisEl);
-
- var e = tr.b.findDeepElementWithTextContent(
- analysisEl, /Start\+End Stack Trace/);
- assert.isDefined(e);
- assert.isDefined(e.nextSibling.children[0].stackFrame);
- assert.equal(e.nextSibling.children[0].stackFrame.title, 'a2');
- });
-
- test('analyzeSelectionWithSingleSlice', function() {
- var selection = createSelectionWithSingleSlice();
- var subView = document.createElement('tr-ui-a-single-event-sub-view');
- subView.selection = selection;
- this.addHTMLOutput(subView);
-
- var table = tr.b.findDeepElementMatching(
- subView, 'tr-ui-b-table');
- assert.equal(table.tableRows.length, 3);
- assert.equal(table.tableRows[0].value, 'b');
- assert.equal(table.tableRows[1].value.value, 0);
- assert.strictEqual(table.tableRows[1].value.unit,
- tr.v.Unit.byName.timeStampInMs);
- assert.equal(table.tableRows[2].value.value, 0.002);
- assert.strictEqual(table.tableRows[2].value.unit,
- tr.v.Unit.byName.timeDurationInMs);
- });
-
- test('analyzeSelectionWithSingleSliceCategory', function() {
- var selection = createSelectionWithSingleSlice({withCategory: true});
-
- var subView = document.createElement('tr-ui-a-single-event-sub-view');
- subView.selection = selection;
- this.addHTMLOutput(subView);
-
- var table = tr.b.findDeepElementMatching(
- subView, 'tr-ui-b-table');
- assert.equal(table.tableRows.length, 4);
- assert.equal(table.tableRows[0].value, 'b');
- assert.equal(table.tableRows[1].value, 'foo');
- assert.equal(table.tableRows[2].value.value, 0);
- assert.strictEqual(table.tableRows[2].value.unit,
- tr.v.Unit.byName.timeStampInMs);
- assert.equal(table.tableRows[3].value.value, 0.002);
- assert.strictEqual(table.tableRows[3].value.unit,
- tr.v.Unit.byName.timeDurationInMs);
- });
-
- test('instantiate_withSingleSliceContainingIDRef', function() {
- var model = new Model();
- var p1 = model.getOrCreateProcess(1);
- var myObjectSlice = p1.objects.addSnapshot(
- '0x1000', 'cat', 'my_object', 0);
-
- var t1 = p1.getOrCreateThread(1);
- t1.sliceGroup.pushSlice(newSliceEx({title: 'b', start: 0, duration: 2}));
- t1.sliceGroup.slices[0].args.my_object = myObjectSlice;
-
- var t1track = {};
- t1track.thread = t1;
-
- var selection = new EventSet();
- selection.push(t1.sliceGroup.slices[0]);
- assert.equal(selection.length, 1);
-
- var subView = document.createElement('tr-ui-a-single-event-sub-view');
- subView.selection = selection;
- this.addHTMLOutput(subView);
-
- var analysisLink = tr.b.findDeepElementMatching(subView,
- 'tr-ui-a-analysis-link');
- assert.isDefined(analysisLink);
- });
-
- test('instantiate_withSingleSliceContainingInfo', function() {
- var slice = newSliceEx({title: 'b', start: 0, duration: 1});
- slice.info = new tr.model.EventInfo(
- 'Info title', 'Description');
-
- var selection = new EventSet();
- selection.push(slice);
-
- var analysisEl = document.createElement('tr-ui-a-single-event-sub-view');
- analysisEl.selection = selection;
- this.addHTMLOutput(analysisEl);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_flow_event_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_flow_event_sub_view.html
deleted file mode 100644
index 899f9f2096e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_flow_event_sub_view.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
-<link rel="import" href="/tracing/ui/analysis/single_event_sub_view.html">
-
-<polymer-element name="tr-ui-a-single-flow-event-sub-view"
- extends="tr-ui-a-single-event-sub-view">
- <script>
- 'use strict';
-
- Polymer({
- getEventRows_: function(event) {
- // TODO(nduca): Figure out if there is a cleaner way to do this.
- var rows = this.__proto__.__proto__.getEventRows_(event);
-
- // Put the ID up top.
- rows.splice(0, 0, {
- name: 'ID',
- value: event.id
- });
-
- function createLinkTo(slice) {
- var linkEl = document.createElement('tr-ui-a-analysis-link');
- linkEl.setSelectionAndContent(function() {
- return new tr.model.EventSet(slice);
- });
- linkEl.textContent = slice.userFriendlyName;
- return linkEl;
- }
-
- rows.push({
- name: 'From',
- value: createLinkTo(event.startSlice)
- });
- rows.push({
- name: 'To',
- value: createLinkTo(event.endSlice)
- });
- return rows;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_flow_event_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_flow_event_sub_view_test.html
deleted file mode 100644
index bbd348a1b20..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_flow_event_sub_view_test.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Model = tr.Model;
- var EventSet = tr.model.EventSet;
- var TestUtils = tr.c.TestUtils;
-
- test('analyzeSelectionWithSingleEvent', function() {
- var model = TestUtils.newModel(function(model) {
- model.p1 = model.getOrCreateProcess(1);
- model.t2 = model.p1.getOrCreateThread(model.p1);
- model.sA = model.t2.sliceGroup.pushSlice(TestUtils.newSliceEx({
- title: 'a', start: 0, end: 2
- }));
- model.sB = model.t2.sliceGroup.pushSlice(TestUtils.newSliceEx({
- title: 'b', start: 9, end: 11
- }));
- model.fe = TestUtils.newFlowEventEx({
- cat: 'cat',
- id: 1234,
- title: 'MyFlow',
- start: 1,
- end: 10,
- startSlice: model.sA,
- endSlice: model.sB
- });
- model.flowEvents.push(model.fe);
- });
-
- var selection = new EventSet();
- selection.push(model.fe);
- assert.equal(selection.length, 1);
-
- var subView = document.createElement('tr-ui-a-single-flow-event-sub-view');
- subView.selection = selection;
- this.addHTMLOutput(subView);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_frame_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_frame_sub_view.html
deleted file mode 100644
index f58168d1c87..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_frame_sub_view.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/ui/analysis/alert_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-
-<polymer-element name="tr-ui-a-single-frame-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
- #asv {
- flex: 0 0 auto;
- align-self: stretch;
- }
- </style>
- <tr-ui-a-alert-sub-view id="asv">
- </tr-ui-a-alert-sub-view>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.currentSelection_ = undefined;
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- set selection(selection) {
- this.currentSelection_ = selection;
- this.$.asv.selection = tr.b.getOnlyElement(selection).associatedAlerts;
- },
-
- get relatedEventsToHighlight() {
- if (!this.currentSelection_)
- return undefined;
- return tr.b.getOnlyElement(this.currentSelection_).associatedEvents;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_instant_event_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_instant_event_sub_view.html
deleted file mode 100644
index c8ab4aa7389..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_instant_event_sub_view.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/single_event_sub_view.html">
-
-<polymer-element name="tr-ui-a-single-instant-event-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: block;
- }
- </style>
- <div id='content'></div>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.currentSelection_ = undefined;
- },
-
- set selection(selection) {
- this.$.content.textContent = '';
- var realView = document.createElement('tr-ui-a-single-event-sub-view');
- realView.setSelectionWithoutErrorChecks(selection);
-
- this.$.content.appendChild(realView);
-
- this.currentSelection_ = selection;
- },
-
- get selection() {
- return this.currentSelection_;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_instant_event_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_instant_event_sub_view_test.html
deleted file mode 100644
index f796164669f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_instant_event_sub_view_test.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Model = tr.Model;
- var Thread = tr.model.Thread;
- var EventSet = tr.model.EventSet;
-
- test('analyzeSelectionWithSingleEvent', function() {
- var model = new Model();
- var p52 = model.getOrCreateProcess(52);
- var t53 = p52.getOrCreateThread(53);
-
- var ie = new tr.model.ProcessInstantEvent('cat', 'title', 7, 10, {});
- ie.duration = 20;
- p52.instantEvents.push(ie);
-
-
- var selection = new EventSet();
- selection.push(ie);
- assert.equal(selection.length, 1);
-
- var subView = document.createElement(
- 'tr-ui-a-single-instant-event-sub-view');
- subView.selection = selection;
-
- this.addHTMLOutput(subView);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_instance_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_instance_sub_view.html
deleted file mode 100644
index ca5cd4a730d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_instance_sub_view.html
+++ /dev/null
@@ -1,116 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-<link rel="import" href="/tracing/ui/analysis/object_instance_view.html">
-<link rel="import" href="/tracing/ui/analysis/single_event_sub_view.html">
-
-<polymer-element name="tr-ui-a-single-object-instance-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: block;
- }
-
- #snapshots > * {
- display: block;
- }
-
- :host {
- overflow: auto;
- display: block;
- }
-
- * {
- -webkit-user-select: text;
- }
-
- .title {
- border-bottom: 1px solid rgb(128, 128, 128);
- font-size: 110%;
- font-weight: bold;
- }
-
- td, th {
- font-family: monospace;
- vertical-align: top;
- }
- </style>
- <div id='content'></div>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.currentSelection_ = undefined;
- },
-
- get requiresTallView() {
- if (this.$.content.children.length === 0)
- return false;
- if (this.$.content.children[0] instanceof
- tr.ui.analysis.ObjectInstanceView)
- return this.$.content.children[0].requiresTallView;
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- set selection(selection) {
- var instance = tr.b.getOnlyElement(selection);
- if (!(instance instanceof tr.model.ObjectInstance))
- throw new Error('Only supports object instances');
-
- this.$.content.textContent = '';
- this.currentSelection_ = selection;
-
- var typeInfo = tr.ui.analysis.ObjectInstanceView.getTypeInfo(
- instance.category, instance.typeName);
- if (typeInfo) {
- var customView = new typeInfo.constructor();
- this.$.content.appendChild(customView);
- customView.modelEvent = instance;
- } else {
- this.appendGenericAnalysis_(instance);
- }
- },
-
- appendGenericAnalysis_: function(instance) {
- var html = '';
- html += '<div class="title">' +
- instance.typeName + ' ' +
- instance.id + '</div>\n';
- html += '<table>';
- html += '<tr>';
- html += '<tr><td>creationTs:</td><td>' +
- instance.creationTs + '</td></tr>\n';
- if (instance.deletionTs != Number.MAX_VALUE) {
- html += '<tr><td>deletionTs:</td><td>' +
- instance.deletionTs + '</td></tr>\n';
- } else {
- html += '<tr><td>deletionTs:</td><td>not deleted</td></tr>\n';
- }
- html += '<tr><td>snapshots:</td><td id="snapshots"></td></tr>\n';
- html += '</table>';
- this.$.content.innerHTML = html;
- var snapshotsEl = this.$.content.querySelector('#snapshots');
- instance.snapshots.forEach(function(snapshot) {
- var snapshotLink = document.createElement('tr-ui-a-analysis-link');
- snapshotLink.selection = new tr.model.EventSet(snapshot);
- snapshotsEl.appendChild(snapshotLink);
- });
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_instance_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_instance_sub_view_test.html
deleted file mode 100644
index 93114f6f98d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_instance_sub_view_test.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/single_object_instance_sub_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ObjectInstance = tr.model.ObjectInstance;
-
- test('analyzeSelectionWithObjectInstanceUnknownType', function() {
- var i10 = new ObjectInstance({}, '0x1000', 'cat', 'someUnhandledName', 10);
- var s10 = i10.addSnapshot(10, {foo: 1});
- var s20 = i10.addSnapshot(20, {foo: 2});
-
- var selection = new tr.model.EventSet();
- selection.push(i10);
-
- var view =
- document.createElement('tr-ui-a-single-object-instance-sub-view');
- view.selection = selection;
- this.addHTMLOutput(view);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_snapshot_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_snapshot_sub_view.html
deleted file mode 100644
index d156203b904..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_snapshot_sub_view.html
+++ /dev/null
@@ -1,128 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-<link rel="import" href="/tracing/ui/analysis/object_instance_view.html">
-<link rel="import" href="/tracing/ui/analysis/object_snapshot_view.html">
-<link rel="import" href="/tracing/ui/analysis/single_event_sub_view.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-a-single-object-snapshot-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- #args {
- white-space: pre;
- }
-
- :host {
- overflow: auto;
- display: flex;
- }
-
- ::content * {
- -webkit-user-select: text;
- }
-
- ::content .title {
- border-bottom: 1px solid rgb(128, 128, 128);
- font-size: 110%;
- font-weight: bold;
- }
-
- ::content td, th {
- font-family: monospace;
- vertical-align: top;
- }
- </style>
- <content></content>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.currentSelection_ = undefined;
- },
-
- get requiresTallView() {
- if (this.children.length === 0)
- return false;
- if (this.children[0] instanceof tr.ui.analysis.ObjectSnapshotView)
- return this.children[0].requiresTallView;
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- set selection(selection) {
- var snapshot = tr.b.getOnlyElement(selection);
- if (!(snapshot instanceof tr.model.ObjectSnapshot))
- throw new Error('Only supports object instances');
-
- this.textContent = '';
- this.currentSelection_ = selection;
-
- var typeInfo = tr.ui.analysis.ObjectSnapshotView.getTypeInfo(
- snapshot.objectInstance.category, snapshot.objectInstance.typeName);
- if (typeInfo) {
- var customView = new typeInfo.constructor();
- this.appendChild(customView);
- customView.modelEvent = snapshot;
- } else {
- this.appendGenericAnalysis_(snapshot);
- }
- },
-
- appendGenericAnalysis_: function(snapshot) {
- var instance = snapshot.objectInstance;
-
- this.textContent = '';
-
- var titleEl = document.createElement('div');
- titleEl.classList.add('title');
- titleEl.appendChild(document.createTextNode('Snapshot of '));
- this.appendChild(titleEl);
-
- var instanceLinkEl = document.createElement('tr-ui-a-analysis-link');
- instanceLinkEl.selection = new tr.model.EventSet(instance);
- titleEl.appendChild(instanceLinkEl);
-
- titleEl.appendChild(document.createTextNode(' @ '));
-
- titleEl.appendChild(tr.v.ui.createScalarSpan(snapshot.ts, {
- unit: tr.v.Unit.byName.timeStampInMs,
- ownerDocument: this.ownerDocument
- }));
-
- var tableEl = document.createElement('table');
- this.appendChild(tableEl);
-
- var rowEl = document.createElement('tr');
- tableEl.appendChild(rowEl);
-
- var labelEl = document.createElement('td');
- labelEl.textContent = 'args:';
- rowEl.appendChild(labelEl);
-
- var argsEl = document.createElement('td');
- argsEl.id = 'args';
- rowEl.appendChild(argsEl);
-
- var objectViewEl = document.createElement('tr-ui-a-generic-object-view');
- objectViewEl.object = snapshot.args;
- argsEl.appendChild(objectViewEl);
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_snapshot_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_snapshot_sub_view_test.html
deleted file mode 100644
index d6e73abbc9a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_object_snapshot_sub_view_test.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/single_object_snapshot_sub_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate_snapshotView', function() {
- var i10 = new tr.model.ObjectInstance(
- {}, '0x1000', 'cat', 'name', 10);
- var s10 = i10.addSnapshot(10, {foo: 1});
- i10.updateBounds();
-
- var selection = new tr.model.EventSet();
- selection.push(s10);
-
- var view =
- document.createElement('tr-ui-a-single-object-snapshot-sub-view');
- view.selection = selection;
- this.addHTMLOutput(view);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_power_sample_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_power_sample_sub_view.html
deleted file mode 100644
index 96043122244..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_power_sample_sub_view.html
+++ /dev/null
@@ -1,107 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-a-power-sample-table">
- <template>
- <style>
- :host {
- display: flex;
- }
- </style>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </template>
-</polymer-element>
-
-<script>
-'use strict';
-
-Polymer('tr-ui-a-power-sample-table', {
- ready: function() {
- this.$.table.tableColumns = [
- {
- title: 'Time',
- width: '100px',
- value: function(row) {
- return tr.v.ui.createScalarSpan(row.start, {
- unit: tr.v.Unit.byName.timeStampInMs
- });
- }
- },
- {
- title: 'Power',
- width: '100%',
- value: function(row) {
- return tr.v.ui.createScalarSpan(row.power, {
- unit: tr.v.Unit.byName.powerInWatts
- });
- }
- }
- ];
- this.sample = undefined;
- },
-
- get sample() {
- return this.sample_;
- },
-
- set sample(sample) {
- this.sample_ = sample;
- this.updateContents_();
- },
-
- updateContents_: function() {
- if (this.sample == undefined)
- this.$.table.tableRows = [];
- else
- this.$.table.tableRows = [this.sample];
- this.$.table.rebuild();
- }
-});
-</script>
-
-<polymer-element name="tr-ui-a-single-power-sample-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host { display: block; }
- </style>
- <tr-ui-a-power-sample-table id="samplesTable">
- </tr-ui-a-power-sample-table>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.currentSelection_ = undefined;
-
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- set selection(selection) {
- this.currentSelection_ = selection;
- this.updateContents_();
- },
-
- updateContents_: function() {
- if (this.selection.length != 1)
- throw 'Cannot pass multiple samples to sample table.';
- this.$.samplesTable.sample = this.selection[0];
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_power_sample_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_power_sample_sub_view_test.html
deleted file mode 100644
index 2b97e613a93..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_power_sample_sub_view_test.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/power_series.html">
-<link rel="import" href="/tracing/ui/analysis/single_power_sample_sub_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var model = new tr.Model();
- var series = new tr.model.PowerSeries(model.device);
- series.addPowerSample(1, 1);
-
- var view = document.createElement('tr-ui-a-single-power-sample-sub-view');
- view.selection = new tr.model.EventSet(series.samples);
-
- this.addHTMLOutput(view);
- });
-
- test('setSelection', function() {
- var model = new tr.Model();
- var series = new tr.model.PowerSeries(model.device);
- series.addPowerSample(1, 1);
-
- var view = document.createElement('tr-ui-a-single-power-sample-sub-view');
- var eventSet = new tr.model.EventSet(series.samples);
- view.selection = eventSet;
-
- assert.deepEqual(view.$.samplesTable.sample,
- tr.b.getOnlyElement(series.samples));
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_sample_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_sample_sub_view.html
deleted file mode 100644
index 29f7b2e064a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_sample_sub_view.html
+++ /dev/null
@@ -1,89 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/stack_frame.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-a-single-sample-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- }
- </style>
- <tr-ui-b-table id="content"></tr-ui-b-table>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.currentSelection_ = undefined;
- },
-
- ready: function() {
- this.$.content.tableColumns = [
- {
- title: 'FirstColumn',
- value: function(row) { return row.title; },
- width: '250px'
- },
- {
- title: 'SecondColumn',
- value: function(row) { return row.value; },
- width: '100%'
- }
- ];
- this.$.content.showHeader = false;
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- set selection(selection) {
- this.currentSelection_ = selection;
-
- if (this.currentSelection_ === undefined) {
- this.$.content.tableRows = [];
- return;
- }
-
- var sample = this.currentSelection_[0];
- var table = this.$.content;
-
- var rows = [];
-
- rows.push({
- title: 'Title',
- value: sample.title
- });
-
- rows.push({
- title: 'Sample time',
- value: tr.v.ui.createScalarSpan(sample.start, {
- unit: tr.v.Unit.byName.timeStampInMs,
- ownerDocument: this.ownerDocument
- })
- });
-
- var sfEl = document.createElement('tr-ui-a-stack-frame');
- sfEl.stackFrame = sample.leafStackFrame;
- rows.push({
- title: 'Stack trace',
- value: sfEl
- });
- table.tableRows = rows;
- table.rebuild();
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_sample_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_sample_sub_view_test.html
deleted file mode 100644
index d31abfaff08..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_sample_sub_view_test.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/single_sample_sub_view.html">
-<link rel="import" href="/tracing/ui/base/deep_utils.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Model = tr.Model;
- var EventSet = tr.model.EventSet;
- var newSampleNamed = tr.c.TestUtils.newSampleNamed;
-
- test('instantiate_withSingleSample', function() {
- var t53;
- var model = tr.c.TestUtils.newModelWithEvents([], {
- shiftWorldToZero: false,
- pruneContainers: false,
- customizeModelCallback: function(model) {
- t53 = model.getOrCreateProcess(52).getOrCreateThread(53);
- model.samples.push(newSampleNamed(t53, 'X', 'my-category',
- ['a', 'b', 'c'], 0.184));
- }
- });
-
- var t53track = {};
- t53track.thread = t53;
-
- var selection = new EventSet();
-
- assert.equal(selection.length, 0);
- selection.push(t53.samples[0]);
- assert.equal(selection.length, 1);
-
- var view = document.createElement('tr-ui-a-single-sample-sub-view');
- view.selection = selection;
- this.addHTMLOutput(view);
-
- var table = tr.b.findDeepElementMatching(
- view, 'tr-ui-b-table');
-
- var rows = table.tableRows;
- assert.equal(rows.length, 3);
-
- assert.equal(rows[0].value, 'X');
- assert.equal(rows[1].value.value, 0.184);
- assert.strictEqual(rows[1].value.unit, tr.v.Unit.byName.timeStampInMs);
- assert.equal(rows[2].value.stackFrame, t53.samples[0].leafStackFrame);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_slice_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_slice_sub_view.html
deleted file mode 100644
index 2eeb8819785..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_slice_sub_view.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/single_event_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/related_events.html">
-
-<polymer-element name="tr-ui-a-single-thread-slice-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: row;
- }
- #events {
- display: flex;
- flex-direction: column;
- }
-
- </style>
- <tr-ui-a-single-event-sub-view id="content"></tr-ui-a-single-event-sub-view>
- <div id="events">
- <tr-ui-a-related-events id="relatedEvents">
- </tr-ui-a-related-events>
- </div>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- get selection() {
- return this.$.content.selection;
- },
-
- set selection(selection) {
- this.$.content.selection = selection;
- this.$.relatedEvents.setRelatedEvents(selection);
- if (this.$.relatedEvents.hasRelatedEvents())
- this.$.relatedEvents.style.display = '';
- else
- this.$.relatedEvents.style.display = 'none';
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_slice_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_slice_sub_view_test.html
deleted file mode 100644
index 7cce4d0d9b8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_slice_sub_view_test.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/thread_slice.html">
-<link rel="import" href="/tracing/ui/analysis/single_thread_slice_sub_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newSliceEx = tr.c.TestUtils.newSliceEx;
- var newFlowEventEx = tr.c.TestUtils.newFlowEventEx;
-
- test('instantiate', function() {
- var model = new tr.Model();
- var t53 = model.getOrCreateProcess(52).getOrCreateThread(53);
- t53.sliceGroup.pushSlice(
- newSliceEx({title: 'a', start: 0.0, duration: 0.5}));
- t53.sliceGroup.createSubSlices();
-
- var selection = new tr.model.EventSet();
- selection.push(t53.sliceGroup.slices[0]);
-
- var viewEl = document.createElement('tr-ui-a-single-thread-slice-sub-view');
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
- });
-
- test('instantiateWithFlowEvent', function() {
- var m = tr.c.TestUtils.newModel(function(m) {
- m.p1 = m.getOrCreateProcess(1);
-
- m.t2 = m.p1.getOrCreateThread(2);
- m.t3 = m.p1.getOrCreateThread(3);
- m.t4 = m.p1.getOrCreateThread(4);
-
- m.sA = m.t2.sliceGroup.pushSlice(
- newSliceEx({title: 'a', start: 0, end: 5,
- type: tr.model.ThreadSlice}));
- m.sB = m.t3.sliceGroup.pushSlice(
- newSliceEx({title: 'b', start: 10, end: 15,
- type: tr.model.ThreadSlice}));
- m.sC = m.t4.sliceGroup.pushSlice(
- newSliceEx({title: 'c', start: 20, end: 20,
- type: tr.model.ThreadSlice}));
-
- m.t2.createSubSlices();
- m.t3.createSubSlices();
- m.t4.createSubSlices();
-
- m.f1 = newFlowEventEx({
- 'title': 'flowish', start: 0, end: 10,
- startSlice: m.sA,
- endSlice: m.sB
- });
- m.f2 = newFlowEventEx({
- 'title': 'flowish', start: 15, end: 21,
- startSlice: m.sB,
- endSlice: m.sC
- });
- });
-
- var selection = new tr.model.EventSet();
- selection.push(m.sA);
-
- var viewEl = document.createElement('tr-ui-a-single-thread-slice-sub-view');
- viewEl.selection = selection;
- this.addHTMLOutput(viewEl);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_time_slice_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_time_slice_sub_view.html
deleted file mode 100644
index 8d82ca6ee04..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_time_slice_sub_view.html
+++ /dev/null
@@ -1,174 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-a-single-thread-time-slice-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- table {
- border-collapse: collapse;
- border-width: 0;
- margin-bottom: 25px;
- width: 100%;
- }
-
- table tr > td:first-child {
- padding-left: 2px;
- }
-
- table tr > td {
- padding: 2px 4px 2px 4px;
- vertical-align: text-top;
- width: 150px;
- }
-
- table td td {
- padding: 0 0 0 0;
- width: auto;
- }
- tr {
- vertical-align: top;
- }
-
- tr:nth-child(2n+0) {
- background-color: #e2e2e2;
- }
- </style>
- <table>
- <tr>
- <td>Running process:</td><td id="process-name"></td>
- </tr>
- <tr>
- <td>Running thread:</td><td id="thread-name"></td>
- </tr>
- <tr>
- <td>State:</td>
- <td><b><span id="state"></span></b></td>
- </tr>
- <tr>
- <td>Start:</td>
- <td>
- <tr-v-ui-scalar-span id="start">
- </tr-v-ui-scalar-span>
- </td>
- </tr>
- <tr>
- <td>Duration:</td>
- <td>
- <tr-v-ui-scalar-span id="duration">
- </tr-v-ui-scalar-span>
- </td>
- </tr>
-
- <tr>
- <td>On CPU:</td><td id="on-cpu"></td>
- </tr>
-
- <tr>
- <td>Running instead:</td><td id="running-instead"></td>
- </tr>
-
- <tr>
- <td>Args:</td><td id="args"></td>
- </tr>
- </table>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.currentSelection_ = undefined;
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- set selection(selection) {
- var timeSlice = tr.b.getOnlyElement(selection);
-
- if (!(timeSlice instanceof tr.model.ThreadTimeSlice))
- throw new Error('Only supports thread time slices');
-
- this.currentSelection_ = selection;
-
- var thread = timeSlice.thread;
-
- var shadowRoot = this.shadowRoot;
- shadowRoot.querySelector('#state').textContent = timeSlice.title;
- var stateColor = tr.b.ColorScheme.colorsAsStrings[timeSlice.colorId];
- shadowRoot.querySelector('#state').style.backgroundColor = stateColor;
-
- shadowRoot.querySelector('#process-name').textContent =
- thread.parent.userFriendlyName;
- shadowRoot.querySelector('#thread-name').textContent =
- thread.userFriendlyName;
-
- shadowRoot.querySelector('#start').setValueAndUnit(
- timeSlice.start, tr.v.Unit.byName.timeStampInMs);
- shadowRoot.querySelector('#duration').setValueAndUnit(
- timeSlice.duration, tr.v.Unit.byName.timeDurationInMs);
-
- var onCpuEl = shadowRoot.querySelector('#on-cpu');
- onCpuEl.textContent = '';
- var runningInsteadEl = shadowRoot.querySelector('#running-instead');
- if (timeSlice.cpuOnWhichThreadWasRunning) {
- runningInsteadEl.parentElement.removeChild(runningInsteadEl);
-
- var cpuLink = document.createElement('tr-ui-a-analysis-link');
- cpuLink.selection = new tr.model.EventSet(
- timeSlice.getAssociatedCpuSlice());
- cpuLink.textContent =
- timeSlice.cpuOnWhichThreadWasRunning.userFriendlyName;
- onCpuEl.appendChild(cpuLink);
- } else {
- onCpuEl.parentElement.removeChild(onCpuEl);
-
- var cpuSliceThatTookCpu = timeSlice.getCpuSliceThatTookCpu();
- if (cpuSliceThatTookCpu) {
- var cpuLink = document.createElement('tr-ui-a-analysis-link');
- cpuLink.selection = new tr.model.EventSet(cpuSliceThatTookCpu);
- if (cpuSliceThatTookCpu.thread)
- cpuLink.textContent = cpuSliceThatTookCpu.thread.userFriendlyName;
- else
- cpuLink.textContent = cpuSliceThatTookCpu.title;
- runningInsteadEl.appendChild(cpuLink);
- } else {
- runningInsteadEl.parentElement.removeChild(runningInsteadEl);
- }
- }
-
- var argsEl = shadowRoot.querySelector('#args');
- if (tr.b.dictionaryKeys(timeSlice.args).length > 0) {
- var argsView =
- document.createElement('tr-ui-a-generic-object-view');
- argsView.object = timeSlice.args;
-
- argsEl.parentElement.style.display = '';
- argsEl.textContent = '';
- argsEl.appendChild(argsView);
- } else {
- argsEl.parentElement.style.display = 'none';
- }
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_time_slice_sub_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_time_slice_sub_view_test.html
deleted file mode 100644
index 5ab48cbe2cf..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_thread_time_slice_sub_view_test.html
+++ /dev/null
@@ -1,92 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/linux_perf/ftrace_importer.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/single_thread_time_slice_sub_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function createBasicModel() {
- var lines = [
- 'Android.launcher-584 [001] d..3 12622.506890: sched_switch: prev_comm=Android.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck
- ' Binder_1-217 [001] d..3 12622.506918: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=D ==> next_comm=Android.launcher next_pid=584 next_prio=120', // @suppress longLineCheck
- 'Android.launcher-584 [001] d..4 12622.506936: sched_wakeup: comm=Binder_1 pid=217 prio=120 success=1 target_cpu=001', // @suppress longLineCheck
- 'Android.launcher-584 [001] d..3 12622.506950: sched_switch: prev_comm=Android.launcher prev_pid=584 prev_prio=120 prev_state=R+ ==> next_comm=Binder_1 next_pid=217 next_prio=120', // @suppress longLineCheck
- ' Binder_1-217 [001] ...1 12622.507057: tracing_mark_write: B|128|queueBuffer', // @suppress longLineCheck
- ' Binder_1-217 [001] ...1 12622.507175: tracing_mark_write: E',
- ' Binder_1-217 [001] d..3 12622.507253: sched_switch: prev_comm=Binder_1 prev_pid=217 prev_prio=120 prev_state=S ==> next_comm=Android.launcher next_pid=584 next_prio=120' // @suppress longLineCheck
- ];
-
- return tr.c.TestUtils.newModelWithEvents([lines.join('\n')], {
- shiftWorldToZero: false
- });
- }
-
- test('runningSlice', function() {
- var m = createBasicModel();
-
- var cpu = m.kernel.cpus[1];
- var binderSlice = cpu.slices[0];
- assert.equal(binderSlice.title, 'Binder_1');
- var launcherSlice = cpu.slices[1];
- assert.equal(launcherSlice.title, 'Android.launcher');
-
-
- var thread = m.findAllThreadsNamed('Binder_1')[0];
-
- var view = document.createElement(
- 'tr-ui-a-single-thread-time-slice-sub-view');
- var selection = new tr.model.EventSet();
- selection.push(thread.timeSlices[0]);
- view.selection = selection;
- this.addHTMLOutput(view);
-
- // Clicking the analysis link should focus the Binder1's timeslice.
- var didSelectionChangeHappen = false;
- view.addEventListener('requestSelectionChange', function(e) {
- assert.isTrue(e.selection.equals(new tr.model.EventSet(binderSlice)));
- didSelectionChangeHappen = true;
- });
- view.shadowRoot.querySelector('tr-ui-a-analysis-link').click();
- assert.isTrue(didSelectionChangeHappen);
- });
-
- test('sleepingSlice', function() {
- var m = createBasicModel();
-
- var cpu = m.kernel.cpus[1];
- var binderSlice = cpu.slices[0];
- assert.equal(binderSlice.title, 'Binder_1');
- var launcherSlice = cpu.slices[1];
- assert.equal(launcherSlice.title, 'Android.launcher');
-
-
- var thread = m.findAllThreadsNamed('Binder_1')[0];
-
- var view = document.createElement(
- 'tr-ui-a-single-thread-time-slice-sub-view');
- var selection = new tr.model.EventSet();
- selection.push(thread.timeSlices[1]);
- view.selection = selection;
- this.addHTMLOutput(view);
-
- // Clicking the analysis link should focus the Android.launcher slice
- var didSelectionChangeHappen = false;
- view.addEventListener('requestSelectionChange', function(e) {
- assert.isTrue(e.selection.equals(new tr.model.EventSet(launcherSlice)));
- didSelectionChangeHappen = true;
- });
- view.shadowRoot.querySelector('tr-ui-a-analysis-link').click();
- assert.isTrue(didSelectionChangeHappen);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_user_expectation_sub_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_user_expectation_sub_view.html
deleted file mode 100644
index 0c2ba50450a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/single_user_expectation_sub_view.html
+++ /dev/null
@@ -1,81 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/analysis/single_event_sub_view.html">
-<link rel="import"
- href="/tracing/ui/analysis/user_expectation_related_samples_table.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<polymer-element name="tr-ui-a-single-user-expectation-sub-view"
- extends="tr-ui-a-sub-view">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: row;
- }
- #events {
- display: flex;
- flex-direction: column;
- }
- </style>
- <tr-ui-a-single-event-sub-view id="realView"></tr-ui-a-single-event-sub-view>
- <div id="events">
- <tr-ui-a-user-expectation-related-samples-table id="relatedSamples"></tr-ui-a-user-expectation-related-samples-table>
- </div>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.currentSelection_ = undefined;
- },
-
- get selection() {
- return this.currentSelection_;
- },
-
- set selection(selection) {
- this.$.realView.addEventListener('customize-rows',
- this.onCustomizeRows_.bind(this));
-
- this.currentSelection_ = selection;
- this.$.realView.setSelectionWithoutErrorChecks(selection);
-
- this.$.relatedSamples.selection = selection;
- if (this.$.relatedSamples.hasRelatedSamples())
- this.$.events.style.display = '';
- else
- this.$.events.style.display = 'none';
- },
-
- get relatedEventsToHighlight() {
- if (!this.currentSelection_)
- return undefined;
- return tr.b.getOnlyElement(this.currentSelection_).associatedEvents;
- },
-
- onCustomizeRows_: function(event) {
- var ue = tr.b.getOnlyElement(this.selection);
-
- if (ue.rawCpuMs) {
- event.rows.push({
- name: 'Total CPU',
- value: tr.v.ui.createScalarSpan(ue.totalCpuMs, {
- unit: tr.v.Unit.byName.timeDurationInMs
- })
- });
- }
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/stack_frame.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/stack_frame.html
deleted file mode 100644
index aeca20ee40d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/stack_frame.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/ui/base/table.html">
-
-<polymer-element name="tr-ui-a-stack-frame">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- </style>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.stackFrame_ = undefined;
- this.$.table.tableColumns = [];
- this.$.table.showHeader = true;
- },
-
- get stackFrame() {
- return this.stackFrame_;
- },
-
- set stackFrame(stackFrame) {
- var table = this.$.table;
-
- this.stackFrame_ = stackFrame;
- if (stackFrame === undefined) {
- table.tableColumns = [];
- table.tableRows = [];
- table.rebuild();
- return;
- }
-
- var hasName = false;
- var hasTitle = false;
-
- table.tableRows = stackFrame.stackTrace;
- table.tableRows.forEach(function(row) {
- hasName |= row.name !== undefined;
- hasTitle |= row.title !== undefined;
- });
-
- var cols = [];
- if (hasName) {
- cols.push({
- title: 'Name',
- value: function(row) { return row.name; }
- });
- }
-
- if (hasTitle) {
- cols.push({
- title: 'Title',
- value: function(row) { return row.title; }
- });
- }
-
- table.tableColumns = cols;
- table.rebuild();
- },
-
- tableForTesting: function() {
- return this.$.table;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/stack_frame_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/stack_frame_test.html
deleted file mode 100644
index 91ee0e3bd57..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/stack_frame_test.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/ui/analysis/stack_frame.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var model = new tr.Model();
- var fA = tr.c.TestUtils.newStackTrace(model, ['a1', 'a2', 'a3']);
-
- var stackFrameView = document.createElement('tr-ui-a-stack-frame');
- stackFrameView.stackFrame = fA;
- this.addHTMLOutput(stackFrameView);
- });
-
- test('clearingStackFrame', function() {
- var model = new tr.Model();
- var fA = tr.c.TestUtils.newStackTrace(model, ['a1', 'a2', 'a3']);
-
- var stackFrameView = document.createElement('tr-ui-a-stack-frame');
- stackFrameView.stackFrame = fA;
- stackFrameView.stackFrame = undefined;
-
- assert.isUndefined(stackFrameView.stackFrame);
- assert.lengthOf(stackFrameView.$.table.$.body.children, 0);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane.html
deleted file mode 100644
index ba5deb30330..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane.html
+++ /dev/null
@@ -1,89 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<!--
-@fileoverview Analysis view stacked pane. See the stacked pane view element
-(tr-ui-a-stacked-pane-view) documentation for more details.
--->
-<polymer-element name="tr-ui-a-stacked-pane">
- <script>
- 'use strict';
-
- Polymer({
- rebuild: function() {
- /**
- * Rebuild the pane if necessary.
- *
- * This method is not intended to be overriden by subclasses. Please
- * override scheduleRebuildPane_() instead.
- */
- if (!this.paneDirty_) {
- // Avoid rebuilding unnecessarily as it breaks things like table
- // selection.
- return;
- }
-
- this.paneDirty_ = false;
- this.rebuildPane_();
- },
-
- /**
- * Mark the UI state of the pane as dirty and schedule a rebuild.
- *
- * This method is intended to be called by subclasses.
- */
- scheduleRebuildPane_: function() {
- if (this.paneDirty_)
- return;
- this.paneDirty_ = true;
- setTimeout(this.rebuild.bind(this), 0);
- },
-
- /**
- * Called when the pane is dirty and a rebuild is triggered.
- *
- * This method is intended to be overriden by subclasses (instead of
- * directly overriding rebuild()).
- */
- rebuildPane_: function() {
- },
-
- /**
- * Request changing the child pane of this pane in the associated stacked
- * pane view. If the assigned builder is undefined, request removing the
- * current child pane.
- *
- * Note that setting this property before appended() is called will have no
- * effect (as there will be no listener attached to the pane).
- *
- * This method is intended to be called by subclasses.
- */
- set childPaneBuilder(childPaneBuilder) {
- this.childPaneBuilder_ = childPaneBuilder;
- this.dispatchEvent(new tr.b.Event('request-child-pane-change'));
- },
-
- get childPaneBuilder() {
- return this.childPaneBuilder_;
- },
-
- /**
- * Called right after the pane is appended to a pane view.
- *
- * This method triggers an immediate rebuild by default (if necessary).
- * Subclasses are free to change this behavior (e.g. if a pane has lots of
- * data to display, it might decide to defer rebuilding in order not to
- * cause jank).
- */
- appended: function() {
- this.rebuild();
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane_test.html
deleted file mode 100644
index f76feea8122..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane_test.html
+++ /dev/null
@@ -1,67 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/stacked_pane.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('rebuild', function() {
- var pane = document.createElement('tr-ui-a-stacked-pane');
- var didFireBuildPane;
- pane.rebuildPane_ = function() {
- didFireBuildPane = true;
- };
-
- function checkRebuild(expectedDidFireBuildPane) {
- didFireBuildPane = false;
- pane.rebuild();
- assert.strictEqual(didFireBuildPane, expectedDidFireBuildPane);
- }
-
- // No rebuilds should occur when not scheduled.
- checkRebuild(false);
- checkRebuild(false);
-
- // Single rebuild should occur when scheduled once.
- pane.scheduleRebuildPane_();
- checkRebuild(true);
- checkRebuild(false);
-
- // Only a single rebuild should occur even when scheduled multiple times.
- pane.scheduleRebuildPane_();
- pane.scheduleRebuildPane_();
- checkRebuild(true);
- checkRebuild(false);
- });
-
- test('changeChildPane', function() {
- var pane = document.createElement('tr-ui-a-stacked-pane');
- var didFireEvent;
- pane.addEventListener('request-child-pane-change', function() {
- didFireEvent = true;
- });
-
- didFireEvent = false;
- pane.childPaneBuilder = undefined;
- assert.isTrue(didFireEvent);
-
- didFireEvent = false;
- pane.childPaneBuilder = function() {
- return undefined;
- };
- assert.isTrue(didFireEvent);
-
- didFireEvent = false;
- pane.childPaneBuilder = function() {
- return document.createElement('tr-ui-a-stacked-pane');
- };
- assert.isTrue(didFireEvent);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane_view.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane_view.html
deleted file mode 100644
index a3c52f780e5..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane_view.html
+++ /dev/null
@@ -1,189 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<!--
-@fileoverview Analysis view container which displays vertically stacked panes.
-The panes represent a hierarchy where a child pane contains the details of the
-current selection in its parent pane. The container provides simple primitives
-for panes to request changing their child pane:
-
- +=<tr-ui-a-stacked-pane-view>=+ +=<tr-ui-a-stacked-pane-view>=+
- |+.<tr-ui-a-stacked-pane>....+| |+.<tr-ui-a-stacked-pane>....+|
- |: Pane 1 +| ===========> |: Pane 1 +|
- |+...........................+| Pane 1 |+...........................+|
- |+.<tr-ui-a-stacked-pane>....+| requests |+.<tr-ui-a-stacked-pane>....+|
- |: Pane 2 (detail of Pane 1) +| child pane |: Pane 4 (detail of Pane 1) +|
- |+...........................+| change (e.g. |+...........................+|
- |+.<tr-ui-a-stacked-pane>....+| selection +=============================+
- |: Pane 3 (detail of Pane 2) +| changed)
- |+...........................+|
- +=============================+
-
-Note that the actual UI provided by tr-ui-a-stacked-pane-view and
-tr-ui-a-stacked-pane is merely a wrapper container with flex box vertical
-stacking. No other visual features (such as pane spacing or borders) is
-provided by either element.
-
-The stacked pane element (tr-ui-a-stacked-pane) is defined in a separate file.
-
-Sample use case:
-
- Create an empty stacked pane view and add it to the DOM:
-
- var paneView = document.createElement('tr-ui-a-stacked-pane-view');
- someParentView.appendChild(paneView);
-
- Define one or more pane subclasses:
-
- <polymer-element name="some-pane-1" extends="tr-ui-a-stacked-pane">
- ...
- </polymer-element>
-
- Set the top-level pane (by providing a builder function):
-
- paneView.setPaneBuilder(function() {
- var topPane = document.createElement('some-pane-1');
- pane.someProperty = someValue;
- return topPane;
- });
-
- Show a child pane with details upon user interaction (these methods should be
- in the definition of the pane subclass Polymer element):
-
- ready: function() {
- this.$.table.addEventListener(
- 'selection-changed', this.changeChildPane_.bind(this));
- }
-
- changeChildPane_: function() {
- this.childPaneBuilder = function() {
- var selectedRow = this.$.table.selectedTableRow;
- var detailsPane = document.createElement('some-pane-2');
- detailsPane.someProperty = selectedRow;
- return detailsPane;
- }.bind(this);
- }
--->
-<polymer-element name="tr-ui-a-stacked-pane-view">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
-
- #pane_container > * {
- flex: 0 0 auto;
- }
- </style>
- <div id="pane_container">
- </div>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- /**
- * Add a pane to the stacked pane view. This method performs two operations:
- *
- * 1. Remove existing descendant panes
- * If the optional parent pane is provided, all its current descendant
- * panes are removed. Otherwise, all panes are removed from the view.
- *
- * 2. Build and add new pane
- * If a pane builder is provided and returns a pane, the new pane is
- * appended to the view (after the provided parent, or at the top).
- */
- setPaneBuilder: function(paneBuilder, opt_parentPane) {
- var paneContainer = this.$.pane_container;
-
- // If the parent pane is provided, it must be an HTML element and a child
- // of the pane container.
- if (opt_parentPane) {
- if (!(opt_parentPane instanceof HTMLElement))
- throw new Error('Parent pane must be an HTML element');
- if (opt_parentPane.parentElement !== paneContainer)
- throw new Error('Parent pane must be a child of the pane container');
- }
-
- // Remove all descendants of the parent pane (or all panes if no parent
- // pane was specified) in reverse order.
- while (paneContainer.lastElementChild !== null &&
- paneContainer.lastElementChild !== opt_parentPane) {
- var removedPane = this.$.pane_container.lastElementChild;
- var listener = this.listeners_.get(removedPane);
- if (listener === undefined)
- throw new Error('No listener associated with pane');
- this.listeners_.delete(removedPane);
- removedPane.removeEventListener(
- 'request-child-pane-change', listener);
- paneContainer.removeChild(removedPane);
- }
-
- if (opt_parentPane && opt_parentPane.parentElement !== paneContainer)
- throw new Error('Parent pane was removed from the pane container');
-
- // This check is performed here (and not at the beginning of the method)
- // because undefined pane builder means that the parent pane requested
- // having no child pane (e.g. when selection is cleared).
- if (!paneBuilder)
- return;
-
- var pane = paneBuilder();
- if (!pane)
- return;
-
- if (!(pane instanceof HTMLElement))
- throw new Error('Pane must be an HTML element');
-
- // Listen for child pane change requests from the newly added pane.
- var listener = function(event) {
- this.setPaneBuilder(pane.childPaneBuilder, pane);
- }.bind(this);
- if (!this.listeners_) {
- // Instead of initializing the listeners map in a created() callback,
- // we do it lazily here so that subclasses could provide their own
- // created() callback (Polymer currently doesn't allow calling overriden
- // superclass methods in strict mode).
- this.listeners_ = new WeakMap();
- }
- this.listeners_.set(pane, listener);
- pane.addEventListener('request-child-pane-change', listener);
-
- paneContainer.appendChild(pane);
- pane.appended();
- },
-
- /**
- * Request rebuilding all panes in the view. The panes are rebuilt from the
- * top to the bottom (so that parent panes could request changing their
- * child panes when they're being rebuilt and the newly constructed child
- * panes would be rebuilt as well).
- */
- rebuild: function() {
- var currentPane = this.$.pane_container.firstElementChild;
- while (currentPane) {
- currentPane.rebuild();
- currentPane = currentPane.nextElementSibling;
- }
- },
-
- // For testing purposes.
- get panesForTesting() {
- var panes = [];
- var currentChild = this.$.pane_container.firstElementChild;
- while (currentChild) {
- panes.push(currentChild);
- currentChild = currentChild.nextElementSibling;
- }
- return panes;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane_view_test.html
deleted file mode 100644
index 5afcd1bd1f0..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/stacked_pane_view_test.html
+++ /dev/null
@@ -1,203 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/stacked_pane.html">
-<link rel="import" href="/tracing/ui/analysis/stacked_pane_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function createPaneView() {
- return document.createElement('tr-ui-a-stacked-pane-view');
- }
-
- function createPane(paneId, opt_rebuildPaneCallback, opt_appendedCallback) {
- var paneEl = document.createElement('tr-ui-a-stacked-pane');
- paneEl.paneId = paneId;
-
- var divEl = document.createElement('div');
- divEl.textContent = 'Pane ' + paneId;
- divEl.style.width = '400px';
- divEl.style.background = '#ccc';
- divEl.style.textAlign = 'center';
- paneEl.appendChild(divEl);
-
- if (opt_rebuildPaneCallback)
- paneEl.rebuildPane_ = opt_rebuildPaneCallback;
-
- if (opt_appendedCallback)
- paneEl.appended = opt_appendedCallback;
-
- return paneEl;
- }
-
- function createPaneBuilder(paneId, opt_rebuildPaneCallback,
- opt_appendedCallback) {
- return createPane.bind(
- undefined, paneId, opt_rebuildPaneCallback, opt_appendedCallback);
- }
-
- function assertPanes(paneView, expectedPaneIds) {
- var actualPaneIds = paneView.panesForTesting.map(function(pane) {
- return pane.paneId;
- });
- assert.deepEqual(actualPaneIds, expectedPaneIds);
- }
-
- test('instantiate_empty', function() {
- var viewEl = createPaneView();
- viewEl.rebuild();
- assertPanes(viewEl, []);
- // Don't add the pane to HTML output because it has zero height.
- });
-
- test('instantiate_singlePane', function() {
- var viewEl = createPaneView();
-
- viewEl.setPaneBuilder(createPaneBuilder(1));
- viewEl.rebuild();
-
- assertPanes(viewEl, [1]);
- this.addHTMLOutput(viewEl);
- });
-
- test('instantiate_multiplePanes', function() {
- var viewEl = createPaneView();
-
- viewEl.setPaneBuilder(createPaneBuilder(1));
- viewEl.setPaneBuilder(createPaneBuilder(2), viewEl.panesForTesting[0]);
- viewEl.setPaneBuilder(createPaneBuilder(3), viewEl.panesForTesting[1]);
-
- assertPanes(viewEl, [1, 2, 3]);
- this.addHTMLOutput(viewEl);
- });
-
- test('changePanes', function() {
- var viewEl = createPaneView();
-
- viewEl.setPaneBuilder(createPaneBuilder(1));
- assertPanes(viewEl, [1]);
-
- viewEl.setPaneBuilder(null);
- assertPanes(viewEl, []);
-
- viewEl.setPaneBuilder(createPaneBuilder(2));
- assertPanes(viewEl, [2]);
-
- viewEl.setPaneBuilder(createPaneBuilder(3), viewEl.panesForTesting[0]);
- assertPanes(viewEl, [2, 3]);
-
- viewEl.setPaneBuilder(createPaneBuilder(4), viewEl.panesForTesting[0]);
- assertPanes(viewEl, [2, 4]);
-
- viewEl.setPaneBuilder(createPaneBuilder(5), viewEl.panesForTesting[1]);
- assertPanes(viewEl, [2, 4, 5]);
-
- viewEl.setPaneBuilder(createPaneBuilder(6), viewEl.panesForTesting[2]);
- assertPanes(viewEl, [2, 4, 5, 6]);
-
- viewEl.setPaneBuilder(createPaneBuilder(7), viewEl.panesForTesting[1]);
- assertPanes(viewEl, [2, 4, 7]);
-
- this.addHTMLOutput(viewEl);
- });
-
- test('childPanes', function() {
- var viewEl = createPaneView();
-
- viewEl.setPaneBuilder(createPaneBuilder(1));
- assertPanes(viewEl, [1]);
-
- // Pane 1 requests a child pane 2.
- var pane1 = viewEl.panesForTesting[0];
- pane1.childPaneBuilder = createPaneBuilder(2);
- assertPanes(viewEl, [1, 2]);
-
- // Pane 2 requests removing its child pane (nothing happens).
- var pane2 = viewEl.panesForTesting[1];
- pane2.childPaneBuilder = undefined;
- assertPanes(viewEl, [1, 2]);
-
- // Pane 2 requests a child pane 3.
- pane2.childPaneBuilder = createPaneBuilder(3);
- assertPanes(viewEl, [1, 2, 3]);
-
- // Pane 2 requests a child pane 4 (its previous child pane 3 is removed).
- pane2.childPaneBuilder = createPaneBuilder(4);
- assertPanes(viewEl, [1, 2, 4]);
-
- // Pane 1 requests removing its child pane (panes 2 and 4 are removed).
- pane1.childPaneBuilder = undefined;
- assertPanes(viewEl, [1]);
-
- // Check that removed panes cannot affect the pane view.
- pane2.childPaneBuilder = createPaneBuilder(5);
- assertPanes(viewEl, [1]);
-
- // Pane 1 requests a child pane 6 (check that everything still works).
- pane1.childPaneBuilder = createPaneBuilder(6);
- assertPanes(viewEl, [1, 6]);
-
- // Change the top pane to pane 7.
- viewEl.setPaneBuilder(createPaneBuilder(7));
- assertPanes(viewEl, [7]);
-
- // Check that removed panes cannot affect the pane view.
- pane1.childPaneBuilder = createPaneBuilder(5);
- assertPanes(viewEl, [7]);
- });
-
- test('rebuild', function() {
- var viewEl = createPaneView();
-
- var rebuiltPaneIds = [];
- var rebuildPaneCallback = function() {
- rebuiltPaneIds.push(this.paneId);
- };
-
- viewEl.setPaneBuilder(createPaneBuilder(1, rebuildPaneCallback));
- viewEl.setPaneBuilder(createPaneBuilder(2, rebuildPaneCallback),
- viewEl.panesForTesting[0]);
- viewEl.setPaneBuilder(createPaneBuilder(3, rebuildPaneCallback),
- viewEl.panesForTesting[1]);
-
- // Rebuild isn't triggered.
- assert.deepEqual(rebuiltPaneIds, []);
-
- // Rebuild is triggered, but it isn't necessary (all panes are clean).
- viewEl.rebuild();
- assert.deepEqual(rebuiltPaneIds, []);
-
- // All panes are now marked as dirty, but rebuild isn't triggered (it was
- // only scheduled).
- viewEl.panesForTesting.forEach(function(pane) {
- pane.scheduleRebuildPane_();
- });
- assert.deepEqual(rebuiltPaneIds, []);
-
- // Finally, rebuild was triggered and the panes are dirty.
- viewEl.rebuild();
- assert.deepEqual(rebuiltPaneIds, [1, 2, 3]);
-
- // Make sure that panes are clean after the previous rebuild.
- viewEl.rebuild();
- assert.deepEqual(rebuiltPaneIds, [1, 2, 3]);
- });
-
- test('appended', function() {
- var viewEl = createPaneView();
- var didFireAppended;
-
- didFireAppended = false;
- viewEl.setPaneBuilder(createPaneBuilder(1, undefined, function() {
- didFireAppended = true;
- }));
- assert.isTrue(didFireAppended);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/stub_analysis_table.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/stub_analysis_table.html
deleted file mode 100644
index c08278c9b44..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/stub_analysis_table.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.analysis', function() {
- function StubAnalysisTable() {
- this.ownerDocument_ = document;
- this.nodes_ = [];
- }
-
- StubAnalysisTable.prototype = {
- __proto__: Object.protoype,
-
- get ownerDocument() {
- return this.ownerDocument_;
- },
-
- appendChild: function(node) {
- if (node.tagName == 'TFOOT' || node.tagName == 'THEAD' ||
- node.tagName == 'TBODY') {
- node.__proto__ = StubAnalysisTable.prototype;
- node.nodes_ = [];
- node.ownerDocument_ = document;
- }
- this.nodes_.push(node);
- },
-
- get lastNode() {
- return this.nodes_.pop();
- },
-
- get nodeCount() {
- return this.nodes_.length;
- }
- };
-
- return {
- StubAnalysisTable: StubAnalysisTable
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/user_expectation_related_samples_table.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/user_expectation_related_samples_table.html
deleted file mode 100644
index fb5b694c17b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/user_expectation_related_samples_table.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-
-<polymer-element name="tr-ui-a-user-expectation-related-samples-table">
- <template>
- <style>
- #table {
- flex: 1 1 auto;
- align-self: stretch;
- }
- </style>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.samples_ = [];
- this.$.table.tableColumns = [
- {
- title: 'Event(s)',
- value: function(row) {
- var typeEl = document.createElement('span');
- typeEl.innerText = row.type;
- if (row.tooltip)
- typeEl.title = row.tooltip;
- return typeEl;
- },
- width: '150px'
- },
- {
- title: 'Link',
- width: '100%',
- value: function(row) {
- var linkEl = document.createElement('tr-ui-a-analysis-link');
- if (row.name)
- linkEl.setSelectionAndContent(row.selection, row.name);
- else
- linkEl.selection = row.selection;
- return linkEl;
- }
- }
- ];
- },
-
- hasRelatedSamples: function() {
- return (this.samples_ && this.samples_.length > 0);
- },
-
- set selection(eventSet) {
- this.samples_ = [];
- var samples = new tr.model.EventSet;
- eventSet.forEach(function(ue) {
- samples.addEventSet(ue.associatedSamples);
- }.bind(this));
-
- if (samples.length > 0) {
- this.samples_.push({
- type: 'Overlapping samples',
- tooltip: 'All samples overlapping the selected user expectation(s).',
- selection: samples
- });
- }
- this.updateContents_();
- },
-
- updateContents_: function() {
- var table = this.$.table;
- if (this.samples_ && this.samples_.length > 0)
- table.tableRows = this.samples_.slice();
- else
- table.tableRows = [];
- table.rebuild();
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/analysis/user_expectation_related_samples_table_test.html b/chromium/third_party/catapult/tracing/tracing/ui/analysis/user_expectation_related_samples_table_test.html
deleted file mode 100644
index eab3be89046..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/analysis/user_expectation_related_samples_table_test.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/sample.html">
-<link rel="import" href="/tracing/model/thread_slice.html">
-<link rel="import"
- href="/tracing/ui/analysis/user_expectation_related_samples_table.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function createModel() {
- var m = tr.c.TestUtils.newModel(function(m) {
- m.p1 = m.getOrCreateProcess(1);
- m.t2 = m.p1.getOrCreateThread(2);
- var s1 = new tr.model.Sample(null, m.t2, 'a_1', 1);
- var s2 = new tr.model.Sample(null, m.t2, 'a_2', 2);
- var s3 = new tr.model.Sample(null, m.t2, 'a_3', 3);
- var s4 = new tr.model.Sample(null, m.t2, 'a_4', 4);
- var s5 = new tr.model.Sample(null, m.t2, 'a_5', 5);
- var s6 = new tr.model.Sample(null, m.t2, 'a_6', 6);
- m.samples.push(s1, s2, s3, s4, s5, s6);
- m.ve = new tr.c.TestUtils.newSliceEx(
- {title: 'V8.Execute', start: 0, end: 4, type: tr.model.ThreadSlice});
- m.t2.sliceGroup.pushSlice(m.ve);
- m.up = new tr.c.TestUtils.newInteractionRecord(m, 0, 4);
- m.up.associatedEvents.push(m.ve);
- m.userModel.expectations.push(m.up);
- });
- return m;
- }
-
- test('overlappingSamples', function() {
- var m = createModel();
-
- var viewEl = document.createElement(
- 'tr-ui-a-user-expectation-related-samples-table');
- viewEl.selection = new tr.model.EventSet([m.up]);
-
- var overlappingSamples;
- viewEl.$.table.tableRows.forEach(function(row) {
- if (row.type === 'Overlapping samples') {
- assert.isUndefined(overlappingSamples);
- overlappingSamples = row.selection;
- }
- });
-
- var samplesTitles = overlappingSamples.map(function(e) {
- return e.title;
- });
- assert.sameMembers(samplesTitles,
- ['a_1', 'a_2', 'a_3', 'a_4']);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/annotations/annotation_view.html b/chromium/third_party/catapult/tracing/tracing/ui/annotations/annotation_view.html
deleted file mode 100644
index 6edaff2e046..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/annotations/annotation_view.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.annotations', function() {
- /**
- * A base class for all annotation views.
- * @constructor
- */
- function AnnotationView(viewport, annotation) {
- }
-
- AnnotationView.prototype = {
- draw: function(ctx) {
- throw new Error('Not implemented');
- }
- };
-
- return {
- AnnotationView: AnnotationView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/annotations/annotation_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/annotations/annotation_view_test.html
deleted file mode 100644
index 5ff3f314655..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/annotations/annotation_view_test.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/comment_box_annotation.html">
-<link rel="import" href="/tracing/model/location.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/rect_annotation.html">
-<link rel="import" href="/tracing/model/x_marker_annotation.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-<link rel="import" href="/tracing/ui/timeline_viewport.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- function createPopulatedTimeline() {
- var model = new tr.Model();
- var process = model.getOrCreateProcess(1);
- var thread = process.getOrCreateThread(2);
- thread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx(
- {title: 'a', start: 80, duration: 50}));
-
- var timeline = document.createElement('tr-ui-timeline-track-view');
- var vp = new tr.ui.TimelineViewport(timeline);
- timeline.model = model;
- timeline.style.maxHeight = '600px';
-
- return timeline;
- }
-
- test('rectAnnotation', function() {
- var fakeYComponents1 = [{stableId: '1.2', yPercentOffset: 0.3}];
- var fakeYComponents2 = [{stableId: '1.2', yPercentOffset: 0.9}];
- var start = new tr.model.Location(50, fakeYComponents1);
- var end = new tr.model.Location(100, fakeYComponents2);
- var rectAnnotation = new tr.model.RectAnnotation(start, end);
-
- var timeline = createPopulatedTimeline();
- timeline.model.addAnnotation(rectAnnotation);
- this.addHTMLOutput(timeline);
- });
-
- test('xMarkerAnnotation', function() {
- var xMarkerAnnotation = new tr.model.XMarkerAnnotation(90);
-
- var timeline = createPopulatedTimeline();
- var model = timeline.model;
- timeline.model.addAnnotation(xMarkerAnnotation);
- this.addHTMLOutput(timeline);
- });
-
- test('commentBoxAnnotation', function() {
- var fakeYComponents = [{stableId: '1.2', yPercentOffset: 0.5}];
- var location = new tr.model.Location(120, fakeYComponents);
- var text = 'abc';
- var commentBoxAnnotation =
- new tr.model.CommentBoxAnnotation(location, text);
-
- var timeline = createPopulatedTimeline();
- timeline.model.addAnnotation(commentBoxAnnotation);
- this.addHTMLOutput(timeline);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/annotations/comment_box_annotation_view.html b/chromium/third_party/catapult/tracing/tracing/ui/annotations/comment_box_annotation_view.html
deleted file mode 100644
index 03eba86146b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/annotations/comment_box_annotation_view.html
+++ /dev/null
@@ -1,88 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/annotations/annotation_view.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.annotations', function() {
- /**
- * A view of a comment box consisting of a textarea and a line to the
- * actual location.
- * @extends {AnnotationView}
- * @constructor
- */
- function CommentBoxAnnotationView(viewport, annotation) {
- this.viewport_ = viewport;
- this.annotation_ = annotation;
- this.textArea_ = undefined;
-
- this.styleWidth = 250;
- this.styleHeight = 50;
- this.fontSize = 10;
- this.rightOffset = 50;
- this.topOffset = 25;
- }
-
- CommentBoxAnnotationView.prototype = {
- __proto__: tr.ui.annotations.AnnotationView.prototype,
-
- removeTextArea: function() {
- this.textArea_.parentNode.removeChild(this.textArea_);
- },
-
- draw: function(ctx) {
- var coords = this.annotation_.location.toViewCoordinates(this.viewport_);
- if (coords.viewX < 0) {
- if (this.textArea_)
- this.textArea_.style.visibility = 'hidden';
- return;
- }
-
- // Set up textarea element.
- if (!this.textArea_) {
- this.textArea_ = document.createElement('textarea');
- this.textArea_.style.position = 'absolute';
- this.textArea_.readOnly = true;
- this.textArea_.value = this.annotation_.text;
- // Set the z-index so that this is shown on top of canvas.
- this.textArea_.style.zIndex = 1;
- ctx.canvas.parentNode.appendChild(this.textArea_);
- }
-
- this.textArea_.style.width = this.styleWidth + 'px';
- this.textArea_.style.height = this.styleHeight + 'px';
- this.textArea_.style.fontSize = this.fontSize + 'px';
- this.textArea_.style.visibility = 'visible';
-
- // Update positions to latest coordinate.
- this.textArea_.style.left =
- coords.viewX + ctx.canvas.getBoundingClientRect().left +
- this.rightOffset + 'px';
- this.textArea_.style.top =
- coords.viewY - ctx.canvas.getBoundingClientRect().top -
- this.topOffset + 'px';
-
- // Draw pointer line from offset to actual location.
- ctx.strokeStyle = 'rgb(0, 0, 0)';
- ctx.lineWidth = 2;
- ctx.beginPath();
- tr.ui.b.drawLine(ctx, coords.viewX,
- coords.viewY - ctx.canvas.getBoundingClientRect().top,
- coords.viewX + this.rightOffset,
- coords.viewY - this.topOffset -
- ctx.canvas.getBoundingClientRect().top);
- ctx.stroke();
- }
- };
-
- return {
- CommentBoxAnnotationView: CommentBoxAnnotationView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/annotations/rect_annotation_view.html b/chromium/third_party/catapult/tracing/tracing/ui/annotations/rect_annotation_view.html
deleted file mode 100644
index 780f0268b3e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/annotations/rect_annotation_view.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/annotations/annotation_view.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.annotations', function() {
- /**
- * A view responsible for drawing a single highlight rectangle box on
- * the timeline.
- * @extends {AnnotationView}
- * @constructor
- */
- function RectAnnotationView(viewport, annotation) {
- this.viewport_ = viewport;
- this.annotation_ = annotation;
- }
-
- RectAnnotationView.prototype = {
- __proto__: tr.ui.annotations.AnnotationView.prototype,
-
- draw: function(ctx) {
- var dt = this.viewport_.currentDisplayTransform;
- var startCoords =
- this.annotation_.startLocation.toViewCoordinates(this.viewport_);
- var endCoords =
- this.annotation_.endLocation.toViewCoordinates(this.viewport_);
-
- // Prevent drawing into the ruler track by clamping the initial Y
- // point and the rect's Y size.
- var startY = startCoords.viewY - ctx.canvas.getBoundingClientRect().top;
- var sizeY = endCoords.viewY - startCoords.viewY;
- if (startY + sizeY < 0) {
- // In this case sizeY is negative. If final Y is negative,
- // overwrite startY so that the rectangle ends at y=0.
- startY = sizeY;
- } else if (startY < 0) {
- startY = 0;
- }
-
- ctx.fillStyle = this.annotation_.fillStyle;
- ctx.fillRect(startCoords.viewX, startY,
- endCoords.viewX - startCoords.viewX, sizeY);
- }
- };
-
- return {
- RectAnnotationView: RectAnnotationView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/annotations/x_marker_annotation_view.html b/chromium/third_party/catapult/tracing/tracing/ui/annotations/x_marker_annotation_view.html
deleted file mode 100644
index ec6a9e1cc21..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/annotations/x_marker_annotation_view.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/annotations/annotation_view.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.annotations', function() {
- /**
- * A view that draws a vertical line on the timeline at a specific timestamp.
- * @extends {AnnotationView}
- * @constructor
- */
- function XMarkerAnnotationView(viewport, annotation) {
- this.viewport_ = viewport;
- this.annotation_ = annotation;
- }
-
- XMarkerAnnotationView.prototype = {
- __proto__: tr.ui.annotations.AnnotationView.prototype,
-
- draw: function(ctx) {
- var dt = this.viewport_.currentDisplayTransform;
- var viewX = dt.xWorldToView(this.annotation_.timestamp);
-
- ctx.beginPath();
- tr.ui.b.drawLine(ctx, viewX, 0, viewX, ctx.canvas.height);
- ctx.strokeStyle = this.annotation_.strokeStyle;
- ctx.stroke();
- }
- };
-
- return {
- XMarkerAnnotationView: XMarkerAnnotationView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/animation.html b/chromium/third_party/catapult/tracing/tracing/ui/base/animation.html
deleted file mode 100644
index e0dce339240..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/animation.html
+++ /dev/null
@@ -1,79 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- /**
- * Represents a procedural animation that can be run by an
- * tr.ui.b.AnimationController.
- *
- * @constructor
- */
- function Animation() {
- }
-
- Animation.prototype = {
-
- /**
- * Called when an animation has been queued after a running animation.
- *
- * @return {boolean} True if the animation can take on the responsibilities
- * of the running animation. If true, takeOverFor will be called on the
- * animation.
- *
- * This can be used to build animations that accelerate as pairs of them are
- * queued.
- */
- canTakeOverFor: function(existingAnimation) {
- throw new Error('Not implemented');
- },
-
- /**
- * Called to take over responsiblities of an existingAnimation.
- *
- * At this point, the existingAnimation has been ticked one last time, then
- * stopped. This animation will be started after this returns and has the
- * job of finishing(or transitioning away from) the effect the existing
- * animation was trying to accomplish.
- */
- takeOverFor: function(existingAnimation, newStartTimestamp, target) {
- throw new Error('Not implemented');
- },
-
- start: function(timestamp, target) {
- throw new Error('Not implemented');
- },
-
- /**
- * Called when an animation is stopped before it finishes. The animation can
- * do what it wants here, usually nothing.
- *
- * @param {Number} timestamp When the animation was stopped.
- * @param {Object} target The object being animated. May be undefined, take
- * care.
- * @param {boolean} willBeTakenOverByAnotherAnimation Whether this animation
- * is going to be handed to another animation's takeOverFor function.
- */
- didStopEarly: function(timestamp, target,
- willBeTakenOverByAnotherAnimation) {
- },
-
- /**
- * @return {boolean} true if the animation is finished.
- */
- tick: function(timestamp, target) {
- throw new Error('Not implemented');
- }
- };
-
- return {
- Animation: Animation
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/animation_controller.html b/chromium/third_party/catapult/tracing/tracing/ui/base/animation_controller.html
deleted file mode 100644
index 4b94bd456e9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/animation_controller.html
+++ /dev/null
@@ -1,140 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/event_target.html">
-<link rel="import" href="/tracing/base/raf.html">
-<link rel="import" href="/tracing/ui/base/animation.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- /**
- * Manages execution, queueing and blending of tr.ui.b.Animations against
- * a single target.
- *
- * Targets must have a cloneAnimationState() method that returns all the
- * animatable states of that target.
- *
- * @constructor
- * @extends {tr.b.EventTarget}
- */
- function AnimationController() {
- tr.b.EventTarget.call(this);
-
- this.target_ = undefined;
-
- this.activeAnimation_ = undefined;
-
- this.tickScheduled_ = false;
- }
-
- AnimationController.prototype = {
- __proto__: tr.b.EventTarget.prototype,
-
- get target() {
- return this.target_;
- },
-
- set target(target) {
- if (this.activeAnimation_)
- throw new Error('Cannot change target while animation is running.');
- if (target.cloneAnimationState === undefined ||
- typeof target.cloneAnimationState !== 'function')
- throw new Error('target must have a cloneAnimationState function');
-
- this.target_ = target;
- },
-
- get activeAnimation() {
- return this.activeAnimation_;
- },
-
- get hasActiveAnimation() {
- return !!this.activeAnimation_;
- },
-
- queueAnimation: function(animation, opt_now) {
- if (this.target_ === undefined)
- throw new Error('Cannot queue animations without a target');
-
- var now;
- if (opt_now !== undefined)
- now = opt_now;
- else
- now = window.performance.now();
-
- if (this.activeAnimation_) {
- // Must tick the animation before stopping it case its about to stop,
- // and to update the target with its final sets of edits up to this
- // point.
- var done = this.activeAnimation_.tick(now, this.target_);
- if (done)
- this.activeAnimation_ = undefined;
- }
-
- if (this.activeAnimation_) {
- if (animation.canTakeOverFor(this.activeAnimation_)) {
- this.activeAnimation_.didStopEarly(now, this.target_, true);
- animation.takeOverFor(this.activeAnimation_, now, this.target_);
- } else {
- this.activeAnimation_.didStopEarly(now, this.target_, false);
- }
- }
- this.activeAnimation_ = animation;
- this.activeAnimation_.start(now, this.target_);
-
- if (this.tickScheduled_)
- return;
- this.tickScheduled_ = true;
- tr.b.requestAnimationFrame(this.tickActiveAnimation_, this);
- },
-
- cancelActiveAnimation: function(opt_now) {
- if (!this.activeAnimation_)
- return;
- var now;
- if (opt_now !== undefined)
- now = opt_now;
- else
- now = window.performance.now();
- this.activeAnimation_.didStopEarly(now, this.target_, false);
- this.activeAnimation_ = undefined;
- },
-
- tickActiveAnimation_: function(frameBeginTime) {
- this.tickScheduled_ = false;
- if (!this.activeAnimation_)
- return;
-
- if (this.target_ === undefined) {
- this.activeAnimation_.didStopEarly(frameBeginTime, this.target_, false);
- return;
- }
-
- var oldTargetState = this.target_.cloneAnimationState();
-
- var done = this.activeAnimation_.tick(frameBeginTime, this.target_);
- if (done)
- this.activeAnimation_ = undefined;
-
- if (this.activeAnimation_) {
- this.tickScheduled_ = true;
- tr.b.requestAnimationFrame(this.tickActiveAnimation_, this);
- }
-
- if (oldTargetState) {
- var e = new tr.b.Event('didtick');
- e.oldTargetState = oldTargetState;
- this.dispatchEvent(e, false, false);
- }
- }
- };
-
- return {
- AnimationController: AnimationController
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/animation_controller_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/animation_controller_test.html
deleted file mode 100644
index a830a5902dd..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/animation_controller_test.html
+++ /dev/null
@@ -1,166 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/ui/base/animation_controller.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function SimpleAnimation(options) {
- this.stopTime = options.stopTime;
-
- this.startCalled = false;
- this.didStopEarlyCalled = false;
- this.wasTakenOver = false;
- this.tickCount = 0;
- }
-
- SimpleAnimation.prototype = {
- __proto__: tr.ui.b.Animation.prototype,
-
- canTakeOverFor: function(existingAnimation) {
- return false;
- },
-
- takeOverFor: function(existingAnimation, newStartTimestamp, target) {
- throw new Error('Not implemented');
- },
-
- start: function(timestamp, target) {
- this.startCalled = true;
- },
-
- didStopEarly: function(timestamp, target, willBeTakenOver) {
- this.didStopEarlyCalled = true;
- this.wasTakenOver = willBeTakenOver;
- },
-
- /**
- * @return {boolean} true if the animation is finished.
- */
- tick: function(timestamp, target) {
- this.tickCount++;
- return timestamp >= this.stopTime;
- }
- };
-
- test('cancel', function() {
- var target = {
- x: 0,
- cloneAnimationState: function() { return {x: this.x}; }
- };
-
- var controller = new tr.ui.b.AnimationController();
- controller.target = target;
-
- var animation = new SimpleAnimation({stopTime: 100});
- controller.queueAnimation(animation);
-
- tr.b.forcePendingRAFTasksToRun(0);
- assert.equal(animation.tickCount, 1);
- controller.cancelActiveAnimation();
- assert.isFalse(controller.hasActiveAnimation);
- assert.isTrue(animation.didStopEarlyCalled);
- });
-
- test('simple', function() {
- var target = {
- x: 0,
- cloneAnimationState: function() { return {x: this.x}; }
- };
-
- var controller = new tr.ui.b.AnimationController();
- controller.target = target;
-
- var animation = new SimpleAnimation({stopTime: 100});
- controller.queueAnimation(animation);
-
- tr.b.forcePendingRAFTasksToRun(0);
- assert.equal(animation.tickCount, 1);
- assert.isTrue(controller.hasActiveAnimation);
-
- tr.b.forcePendingRAFTasksToRun(100);
- assert.equal(animation.tickCount, 2);
- assert.isFalse(controller.hasActiveAnimation);
- });
-
- test('queueTwo', function() {
- // Clear all pending rafs so if something is lingering it will blow up here.
- tr.b.forcePendingRAFTasksToRun(0);
-
- var target = {
- x: 0,
- cloneAnimationState: function() { return {x: this.x}; }
- };
-
- var controller = new tr.ui.b.AnimationController();
- controller.target = target;
-
- var a1 = new SimpleAnimation({stopTime: 100});
- var a2 = new SimpleAnimation({stopTime: 100});
- controller.queueAnimation(a1, 0);
- assert.isTrue(a1.startCalled);
- controller.queueAnimation(a2, 50);
- assert.isTrue(a1.didStopEarlyCalled);
- assert.isTrue(a2.startCalled);
-
- tr.b.forcePendingRAFTasksToRun(150);
- assert.isFalse(controller.hasActiveAnimation);
- assert.isAbove(a2.tickCount, 0);
- });
-
- /**
- * @constructor
- */
- function AnimationThatCanTakeOverForSimpleAnimation() {
- this.takeOverForAnimation = undefined;
- }
-
- AnimationThatCanTakeOverForSimpleAnimation.prototype = {
- __proto__: tr.ui.b.Animation.prototype,
-
-
- canTakeOverFor: function(existingAnimation) {
- return existingAnimation instanceof SimpleAnimation;
- },
-
- takeOverFor: function(existingAnimation, newStartTimestamp, target) {
- this.takeOverForAnimation = existingAnimation;
- },
-
- start: function(timestamp, target) {
- this.startCalled = true;
- }
- };
-
- test('takeOver', function() {
- var target = {
- x: 0,
- cloneAnimationState: function() { return {x: this.x}; }
- };
-
- var controller = new tr.ui.b.AnimationController();
- controller.target = target;
-
- var a1 = new SimpleAnimation({stopTime: 100});
- var a2 = new AnimationThatCanTakeOverForSimpleAnimation();
- controller.queueAnimation(a1, 0);
- assert.isTrue(a1.startCalled);
- assert.equal(a1.tickCount, 0);
- controller.queueAnimation(a2, 10);
- assert.isTrue(a1.didStopEarlyCalled);
- assert.isTrue(a1.wasTakenOver);
- assert.equal(a1.tickCount, 1);
-
- assert.equal(a1, a2.takeOverForAnimation);
- assert.isTrue(a2.startCalled);
-
- controller.cancelActiveAnimation();
- assert.isFalse(controller.hasActiveAnimation);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/bar_chart.html b/chromium/third_party/catapult/tracing/tracing/ui/base/bar_chart.html
deleted file mode 100644
index b2893762db3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/bar_chart.html
+++ /dev/null
@@ -1,178 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/chart_base_2d_brushable_x.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- var ColorScheme = tr.b.ColorScheme;
- var ChartBase2DBrushX = tr.ui.b.ChartBase2DBrushX;
- var getColorOfKey = tr.ui.b.getColorOfKey;
-
- // @constructor
- var BarChart = tr.ui.b.define('bar-chart', ChartBase2DBrushX);
-
- BarChart.prototype = {
- __proto__: ChartBase2DBrushX.prototype,
-
- decorate: function() {
- ChartBase2DBrushX.prototype.decorate.call(this);
- this.classList.add('bar-chart');
- this.xCushion_ = 0;
- this.isStacked_ = false;
- },
-
- set isStacked(stacked) {
- this.isStacked_ = true;
- this.updateContents_();
- },
-
- get isStacked() {
- return this.isStacked_;
- },
-
- isDatumFieldSeries_: function(fieldName) {
- return fieldName != 'x';
- },
-
- getXForDatum_: function(datum, index) {
- return datum.x;
- },
-
- updateScales_: function() {
- if (this.data_.length === 0)
- return;
-
- var xDifferences = 0;
- var currentX = undefined;
- var previousX = undefined;
- var yRange = new tr.b.Range();
- this.data_.forEach(function(datum, index) {
- previousX = currentX;
- currentX = this.getXForDatum_(datum, index);
- if (previousX !== undefined) {
- xDifferences += currentX - previousX;
- }
-
- this.seriesKeys_.forEach(function(key) {
- // Allow for sparse data
- if (datum[key] !== undefined)
- yRange.addValue(datum[key]);
- });
- }, this);
-
- // X.
- // Leave a cushion on the right so that the last rect doesn't
- // exceed the chart boundaries. The last rect's width is set to the
- // average width of the rects, which is chart.width / data.length.
- var width = this.chartAreaSize.width;
- this.xScale_.range([0, width]);
- var domain = d3.extent(this.data_, this.getXForDatum_.bind(this));
- this.xCushion_ = xDifferences / (this.data_.length - 1);
- this.xScale_.domain([domain[0], domain[1] + this.xCushion_]);
-
- // Y.
- this.yScale_.range([this.chartAreaSize.height, 0]);
- this.yScale_.domain(this.getYScaleDomain_(yRange.min, yRange.max));
- },
-
- getYScaleDomain_: function(minValue, maxValue) {
- if (!this.isStacked) {
- return ChartBase2DBrushX.prototype.getYScaleDomain_.call(
- this, minValue, maxValue);
- }
-
- var range = new tr.b.Range();
- range.addValue(0);
- this.data_.forEach(function(datum, index) {
- var sum = 0;
- this.seriesKeys_.forEach(function(key) {
- if (datum[key] === undefined)
- return;
- sum += datum[key];
- }, this);
- range.addValue(sum);
- }, this);
- return [range.min, range.max];
- },
-
- getStackedRectsForDatum_: function(datum, index) {
- var stacks = [];
- var bottom = this.yScale_.range()[0];
- var sum = 0;
- this.seriesKeys_.forEach(function(key) {
- if (datum[key] === undefined)
- return;
- sum += datum[key];
- var heightPx = bottom - this.yScale_(sum);
- bottom -= heightPx;
- stacks.push({
- color: getColorOfKey(key),
- heightPx: heightPx,
- topPx: bottom
- });
- }, this);
- return stacks;
- },
-
- getRectsForDatum_: function(datum, index) {
- if (this.isStacked)
- return this.getStackedRectsForDatum_(datum, index);
-
- var stacks = [];
- this.seriesKeys_.forEach(function(key) {
- if (datum[key] === undefined)
- return;
- var topPx = this.yScale_(Math.max(datum[key], this.getYScaleMin_()));
- stacks.push({
- topPx: topPx,
- heightPx: this.yScale_.range()[0] - topPx,
- color: getColorOfKey(key)
- });
- }, this);
- stacks.sort(function(a, b) {
- return b.topPx - a.topPx;
- });
- return stacks;
- },
-
- updateDataContents_: function(dataSel) {
- dataSel.selectAll('*').remove();
- var rectsSel = dataSel.selectAll('path').data(this.seriesKeys_);
- this.data_.forEach(function(datum, index) {
- var currentX = this.getXForDatum_(datum, index);
- var width = undefined;
- if (index < (this.data_.length - 1)) {
- var nextX = this.getXForDatum_(this.data_[index + 1], index + 1);
- width = nextX - currentX;
- } else {
- width = this.xCushion_;
- }
- this.getRectsForDatum_(datum, index).forEach(function(rect) {
- var leftPx = this.xScale_(currentX);
- var rightPx = this.xScale_(currentX + width);
- var widthPx = rightPx - leftPx;
- rectsSel.enter()
- .append('rect')
- .attr('fill', rect.color)
- .attr('x', leftPx)
- .attr('y', rect.topPx)
- .attr('width', widthPx)
- .attr('height', rect.heightPx);
- }, this);
- }, this);
- rectsSel.exit().remove();
- }
- };
-
- return {
- BarChart: BarChart
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/bar_chart_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/bar_chart_test.html
deleted file mode 100644
index 7d931d5ff1b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/bar_chart_test.html
+++ /dev/null
@@ -1,230 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/bar_chart.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiation_singleSeries', function() {
- var chart = new tr.ui.b.BarChart();
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 10, value: 100},
- {x: 20, value: 110},
- {x: 30, value: 100},
- {x: 40, value: 50}
- ];
- chart.data = data;
- this.addHTMLOutput(chart);
- });
-
- test('instantiation_stacked', function() {
- var chart = new tr.ui.b.BarChart();
- chart.isStacked = true;
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'title';
- var data = [
- {x: 10, foo: 10, bar: 5, qux: 7},
- {x: 20, foo: 11, bar: 6, qux: 3},
- {x: 30, foo: 10, bar: 4, qux: 8},
- {x: 40, foo: 5, bar: 1, qux: 2}
- ];
- chart.data = data;
- this.addHTMLOutput(chart);
- });
-
- test('instantiation_singleSeries_yLogScale', function() {
- var chart = new tr.ui.b.BarChart();
- chart.isYLogScale = true;
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 10, value: 100},
- {x: 20, value: 10},
- {x: 30, value: 1},
- {x: 40, value: 0.1},
- {x: 50, value: 0.01},
- {x: 60, value: 0.001}
- ];
- chart.data = data;
- this.addHTMLOutput(chart);
- });
-
- test('undefined', function() {
- var chart = new tr.ui.b.BarChart();
- assert.throws(function() {
- chart.data = undefined;
- });
- });
-
- test('instantiation_twoSeries', function() {
- var chart = new tr.ui.b.BarChart();
-
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 10, alpha: 100, beta: 50},
- {x: 20, alpha: 110, beta: 75},
- {x: 30, alpha: 100, beta: 125},
- {x: 40, alpha: 50, beta: 125}
- ];
- chart.data = data;
-
- var r = new tr.b.Range();
- r.addValue(20);
- r.addValue(40);
- chart.brushedRange = r;
-
- this.addHTMLOutput(chart);
- });
-
- test('instantiation_twoSeries_yLogScale', function() {
- var chart = new tr.ui.b.BarChart();
- chart.isYLogScale = true;
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 10, alpha: 100, beta: 50},
- {x: 20, alpha: 110, beta: 75},
- {x: 30, alpha: 100, beta: 125},
- {x: 40, alpha: 50, beta: 125}
- ];
- chart.data = data;
-
- var r = new tr.b.Range();
- r.addValue(20);
- r.addValue(40);
- chart.brushedRange = r;
-
- this.addHTMLOutput(chart);
- });
-
- test('instantiation_twoSparseSeriesWithFirstValueSparse', function() {
- var chart = new tr.ui.b.BarChart();
-
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 10, alpha: 20, beta: undefined},
- {x: 20, alpha: undefined, beta: 10},
- {x: 30, alpha: 10, beta: undefined},
- {x: 45, alpha: undefined, beta: 20},
- {x: 50, alpha: 25, beta: 30}
- ];
- chart.data = data;
-
- this.addHTMLOutput(chart);
- });
-
- test('instantiation_twoSparseSeriesWithFirstValueNotSparse', function() {
- var chart = new tr.ui.b.BarChart();
-
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 10, alpha: 20, beta: 40},
- {x: 20, alpha: undefined, beta: 10},
- {x: 30, alpha: 10, beta: undefined},
- {x: 45, alpha: undefined, beta: 20},
- {x: 50, alpha: 30, beta: undefined}
- ];
- chart.data = data;
-
- this.addHTMLOutput(chart);
- });
-
- test('brushRangeFromIndices', function() {
- var chart = new tr.ui.b.BarChart();
- var data = [
- {x: 10, value: 50},
- {x: 30, value: 60},
- {x: 70, value: 70},
- {x: 80, value: 80},
- {x: 120, value: 90}
- ];
- chart.data = data;
- var r = new tr.b.Range();
-
- // Range min should be 10.
- r = chart.computeBrushRangeFromIndices(-2, 1);
- assert.equal(r.min, 10);
-
- // Range max should be 120.
- r = chart.computeBrushRangeFromIndices(3, 10);
- assert.equal(r.max, 120);
-
- // Range should be [10, 120]
- r = chart.computeBrushRangeFromIndices(-2, 10);
- assert.equal(r.min, 10);
- assert.equal(r.max, 120);
-
- // Range should be [20, 100]
- r = chart.computeBrushRangeFromIndices(1, 3);
- assert.equal(r.min, 20);
- assert.equal(r.max, 100);
- });
-
- test('instantiation_interactiveBrushing', function() {
- var chart = new tr.ui.b.BarChart();
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 10, value: 50},
- {x: 20, value: 60},
- {x: 30, value: 80},
- {x: 40, value: 20},
- {x: 50, value: 30},
- {x: 60, value: 20},
- {x: 70, value: 15},
- {x: 80, value: 20}
- ];
- chart.data = data;
-
- var mouseDownX = undefined;
- var curMouseX = undefined;
-
- function updateBrushedRange() {
- if (mouseDownX === undefined || (mouseDownX === curMouseX)) {
- chart.brushedRange = new tr.b.Range();
- return;
- }
- var r = new tr.b.Range();
- r.min = Math.min(mouseDownX, curMouseX);
- r.max = Math.max(mouseDownX, curMouseX);
- chart.brushedRange = r;
- }
-
- chart.addEventListener('item-mousedown', function(e) {
- mouseDownX = e.x;
- curMouseX = e.x;
- updateBrushedRange();
- });
- chart.addEventListener('item-mousemove', function(e) {
- if (e.button == undefined)
- return;
- curMouseX = e.x;
- updateBrushedRange();
- });
- chart.addEventListener('item-mouseup', function(e) {
- curMouseX = e.x;
- updateBrushedRange();
- });
- this.addHTMLOutput(chart);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/camera.html b/chromium/third_party/catapult/tracing/tracing/ui/base/camera.html
deleted file mode 100644
index 2cef0b9f394..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/camera.html
+++ /dev/null
@@ -1,349 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/settings.html">
-<link rel="import" href="/tracing/ui/base/utils.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
-
- var constants = {
- DEFAULT_SCALE: 0.5,
- DEFAULT_EYE_DISTANCE: 10000,
- MINIMUM_DISTANCE: 1000,
- MAXIMUM_DISTANCE: 100000,
- FOV: 15,
- RESCALE_TIMEOUT_MS: 200,
- MAXIMUM_TILT: 80,
- SETTINGS_NAMESPACE: 'tr.ui_camera'
- };
-
-
- var Camera = tr.ui.b.define('camera');
-
- Camera.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function(eventSource) {
- this.eventSource_ = eventSource;
-
- this.eventSource_.addEventListener('beginpan',
- this.onPanBegin_.bind(this));
- this.eventSource_.addEventListener('updatepan',
- this.onPanUpdate_.bind(this));
- this.eventSource_.addEventListener('endpan',
- this.onPanEnd_.bind(this));
-
- this.eventSource_.addEventListener('beginzoom',
- this.onZoomBegin_.bind(this));
- this.eventSource_.addEventListener('updatezoom',
- this.onZoomUpdate_.bind(this));
- this.eventSource_.addEventListener('endzoom',
- this.onZoomEnd_.bind(this));
-
- this.eventSource_.addEventListener('beginrotate',
- this.onRotateBegin_.bind(this));
- this.eventSource_.addEventListener('updaterotate',
- this.onRotateUpdate_.bind(this));
- this.eventSource_.addEventListener('endrotate',
- this.onRotateEnd_.bind(this));
-
- this.eye_ = [0, 0, constants.DEFAULT_EYE_DISTANCE];
- this.gazeTarget_ = [0, 0, 0];
- this.rotation_ = [0, 0];
-
- this.pixelRatio_ = window.devicePixelRatio || 1;
- },
-
-
- get modelViewMatrix() {
- var mvMatrix = mat4.create();
-
- mat4.lookAt(mvMatrix, this.eye_, this.gazeTarget_, [0, 1, 0]);
- return mvMatrix;
- },
-
- get projectionMatrix() {
- var rect =
- tr.ui.b.windowRectForElement(this.canvas_).
- scaleSize(this.pixelRatio_);
-
- var aspectRatio = rect.width / rect.height;
- var matrix = mat4.create();
- mat4.perspective(
- matrix, tr.b.deg2rad(constants.FOV), aspectRatio, 1, 100000);
-
- return matrix;
- },
-
- set canvas(c) {
- this.canvas_ = c;
- },
-
- set deviceRect(rect) {
- this.deviceRect_ = rect;
- },
-
- get stackingDistanceDampening() {
- var gazeVector = [
- this.gazeTarget_[0] - this.eye_[0],
- this.gazeTarget_[1] - this.eye_[1],
- this.gazeTarget_[2] - this.eye_[2]];
- vec3.normalize(gazeVector, gazeVector);
- return 1 + gazeVector[2];
- },
-
- loadCameraFromSettings: function(settings) {
- this.eye_ = settings.get(
- 'eye', this.eye_, constants.SETTINGS_NAMESPACE);
- this.gazeTarget_ = settings.get(
- 'gaze_target', this.gazeTarget_, constants.SETTINGS_NAMESPACE);
- this.rotation_ = settings.get(
- 'rotation', this.rotation_, constants.SETTINGS_NAMESPACE);
-
- this.dispatchRenderEvent_();
- },
-
- saveCameraToSettings: function(settings) {
- settings.set(
- 'eye', this.eye_, constants.SETTINGS_NAMESPACE);
- settings.set(
- 'gaze_target', this.gazeTarget_, constants.SETTINGS_NAMESPACE);
- settings.set(
- 'rotation', this.rotation_, constants.SETTINGS_NAMESPACE);
- },
-
- resetCamera: function() {
- this.eye_ = [0, 0, constants.DEFAULT_EYE_DISTANCE];
- this.gazeTarget_ = [0, 0, 0];
- this.rotation_ = [0, 0];
-
- var settings = tr.b.SessionSettings();
- var keys = settings.keys(constants.SETTINGS_NAMESPACE);
- if (keys.length !== 0) {
- this.loadCameraFromSettings(settings);
- return;
- }
-
- if (this.deviceRect_) {
- var rect = tr.ui.b.windowRectForElement(this.canvas_).
- scaleSize(this.pixelRatio_);
-
- this.eye_[0] = this.deviceRect_.width / 2;
- this.eye_[1] = this.deviceRect_.height / 2;
-
- this.gazeTarget_[0] = this.deviceRect_.width / 2;
- this.gazeTarget_[1] = this.deviceRect_.height / 2;
- }
-
- this.saveCameraToSettings(settings);
- this.dispatchRenderEvent_();
- },
-
- updatePanByDelta: function(delta) {
- var rect =
- tr.ui.b.windowRectForElement(this.canvas_).
- scaleSize(this.pixelRatio_);
-
- // Get the eye vector, since we'll be adjusting gazeTarget.
- var eyeVector = [
- this.eye_[0] - this.gazeTarget_[0],
- this.eye_[1] - this.gazeTarget_[1],
- this.eye_[2] - this.gazeTarget_[2]];
- var length = vec3.length(eyeVector);
- vec3.normalize(eyeVector, eyeVector);
-
- var halfFov = constants.FOV / 2;
- var multiplier =
- 2.0 * length * Math.tan(tr.b.deg2rad(halfFov)) / rect.height;
-
- // Get the up and right vectors.
- var up = [0, 1, 0];
- var rotMatrix = mat4.create();
- mat4.rotate(
- rotMatrix, rotMatrix, tr.b.deg2rad(this.rotation_[1]), [0, 1, 0]);
- mat4.rotate(
- rotMatrix, rotMatrix, tr.b.deg2rad(this.rotation_[0]), [1, 0, 0]);
- vec3.transformMat4(up, up, rotMatrix);
-
- var right = [0, 0, 0];
- vec3.cross(right, eyeVector, up);
- vec3.normalize(right, right);
-
- // Update the gaze target.
- for (var i = 0; i < 3; ++i) {
- this.gazeTarget_[i] +=
- delta[0] * multiplier * right[i] - delta[1] * multiplier * up[i];
-
- this.eye_[i] = this.gazeTarget_[i] + length * eyeVector[i];
- }
-
- // If we have some z offset, we need to reposition gazeTarget
- // to be on the plane z = 0 with normal [0, 0, 1].
- if (Math.abs(this.gazeTarget_[2]) > 1e-6) {
- var gazeVector = [-eyeVector[0], -eyeVector[1], -eyeVector[2]];
- var newLength = tr.b.clamp(
- -this.eye_[2] / gazeVector[2],
- constants.MINIMUM_DISTANCE,
- constants.MAXIMUM_DISTANCE);
-
- for (var i = 0; i < 3; ++i)
- this.gazeTarget_[i] = this.eye_[i] + newLength * gazeVector[i];
- }
-
- this.saveCameraToSettings(tr.b.SessionSettings());
- this.dispatchRenderEvent_();
- },
-
- updateZoomByDelta: function(delta) {
- var deltaY = delta[1];
- deltaY = tr.b.clamp(deltaY, -50, 50);
- var scale = 1.0 - deltaY / 100.0;
-
- var eyeVector = [0, 0, 0];
- vec3.subtract(eyeVector, this.eye_, this.gazeTarget_);
-
- var length = vec3.length(eyeVector);
-
- // Clamp the length to allowed values by changing the scale.
- if (length * scale < constants.MINIMUM_DISTANCE)
- scale = constants.MINIMUM_DISTANCE / length;
- else if (length * scale > constants.MAXIMUM_DISTANCE)
- scale = constants.MAXIMUM_DISTANCE / length;
-
- vec3.scale(eyeVector, eyeVector, scale);
- vec3.add(this.eye_, this.gazeTarget_, eyeVector);
-
- this.saveCameraToSettings(tr.b.SessionSettings());
- this.dispatchRenderEvent_();
- },
-
- updateRotateByDelta: function(delta) {
- delta[0] *= 0.5;
- delta[1] *= 0.5;
-
- if (Math.abs(this.rotation_[0] + delta[1]) > constants.MAXIMUM_TILT)
- return;
- if (Math.abs(this.rotation_[1] - delta[0]) > constants.MAXIMUM_TILT)
- return;
-
- var eyeVector = [0, 0, 0, 0];
- vec3.subtract(eyeVector, this.eye_, this.gazeTarget_);
-
- // Undo the current rotation.
- var rotMatrix = mat4.create();
- mat4.rotate(
- rotMatrix, rotMatrix, -tr.b.deg2rad(this.rotation_[0]), [1, 0, 0]);
- mat4.rotate(
- rotMatrix, rotMatrix, -tr.b.deg2rad(this.rotation_[1]), [0, 1, 0]);
- vec4.transformMat4(eyeVector, eyeVector, rotMatrix);
-
- // Update rotation values.
- this.rotation_[0] += delta[1];
- this.rotation_[1] -= delta[0];
-
- // Redo the new rotation.
- mat4.identity(rotMatrix);
- mat4.rotate(
- rotMatrix, rotMatrix, tr.b.deg2rad(this.rotation_[1]), [0, 1, 0]);
- mat4.rotate(
- rotMatrix, rotMatrix, tr.b.deg2rad(this.rotation_[0]), [1, 0, 0]);
- vec4.transformMat4(eyeVector, eyeVector, rotMatrix);
-
- vec3.add(this.eye_, this.gazeTarget_, eyeVector);
-
- this.saveCameraToSettings(tr.b.SessionSettings());
- this.dispatchRenderEvent_();
- },
-
-
- // Event callbacks.
- onPanBegin_: function(e) {
- this.panning_ = true;
- this.lastMousePosition_ = this.getMousePosition_(e);
- },
-
- onPanUpdate_: function(e) {
- if (!this.panning_)
- return;
-
- var delta = this.getMouseDelta_(e, this.lastMousePosition_);
- this.lastMousePosition_ = this.getMousePosition_(e);
- this.updatePanByDelta(delta);
- },
-
- onPanEnd_: function(e) {
- this.panning_ = false;
- },
-
- onZoomBegin_: function(e) {
- this.zooming_ = true;
-
- var p = this.getMousePosition_(e);
-
- this.lastMousePosition_ = p;
- this.zoomPoint_ = p;
- },
-
- onZoomUpdate_: function(e) {
- if (!this.zooming_)
- return;
-
- var delta = this.getMouseDelta_(e, this.lastMousePosition_);
- this.lastMousePosition_ = this.getMousePosition_(e);
- this.updateZoomByDelta(delta);
- },
-
- onZoomEnd_: function(e) {
- this.zooming_ = false;
- this.zoomPoint_ = undefined;
- },
-
- onRotateBegin_: function(e) {
- this.rotating_ = true;
- this.lastMousePosition_ = this.getMousePosition_(e);
- },
-
- onRotateUpdate_: function(e) {
- if (!this.rotating_)
- return;
-
- var delta = this.getMouseDelta_(e, this.lastMousePosition_);
- this.lastMousePosition_ = this.getMousePosition_(e);
- this.updateRotateByDelta(delta);
- },
-
- onRotateEnd_: function(e) {
- this.rotating_ = false;
- },
-
-
- // Misc helper functions.
- getMousePosition_: function(e) {
- var rect = tr.ui.b.windowRectForElement(this.canvas_);
- return [(e.clientX - rect.x) * this.pixelRatio_,
- (e.clientY - rect.y) * this.pixelRatio_];
- },
-
- getMouseDelta_: function(e, p) {
- var newP = this.getMousePosition_(e);
- return [newP[0] - p[0], newP[1] - p[1]];
- },
-
- dispatchRenderEvent_: function() {
- tr.b.dispatchSimpleEvent(this, 'renderrequired', false, false);
- }
- };
-
- return {
- Camera: Camera
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/camera_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/camera_test.html
deleted file mode 100644
index 8a11663eeda..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/camera_test.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/rect.html">
-<link rel="import" href="/tracing/base/quad.html">
-<link rel="import" href="/tracing/base/bbox2.html">
-<link rel="import" href="/tracing/ui/base/quad_stack_view.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- function createQuads() {
- var quads = [
- tr.b.Quad.fromXYWH(-500, -500, 30, 30), // 4 corners
- tr.b.Quad.fromXYWH(-500, 470, 30, 30),
- tr.b.Quad.fromXYWH(470, -500, 30, 30),
- tr.b.Quad.fromXYWH(470, 470, 30, 30),
- tr.b.Quad.fromXYWH(-250, -250, 250, 250), // crosshairs
- tr.b.Quad.fromXYWH(0, -250, 250, 250), // crosshairs
- tr.b.Quad.fromXYWH(-250, 0, 250, 250), // crosshairs
- tr.b.Quad.fromXYWH(0, 0, 250, 250) // crosshairs
- ];
- quads[0].stackingGroupId = 0;
- quads[1].stackingGroupId = 0;
- quads[2].stackingGroupId = 0;
- quads[3].stackingGroupId = 0;
- quads[4].stackingGroupId = 1;
- quads[5].stackingGroupId = 1;
- quads[6].stackingGroupId = 1;
- quads[7].stackingGroupId = 1;
- return quads;
- }
-
- function createQuadStackView(testFramework) {
- var quads = createQuads();
- var view = new tr.ui.b.QuadStackView();
- // simulate the constraints of the layer-tree-view
- view.style.height = '400px';
- view.style.width = '800px';
- view.deviceRect = tr.b.Rect.fromXYWH(-250, -250, 500, 500);
- view.quads = quads;
-
- testFramework.addHTMLOutput(view);
- return view;
- }
-
- test('initialState', function() {
- var view = createQuadStackView(this);
-
- var viewRect =
- view.getBoundingClientRect();
- assert.equal(viewRect.height, 400);
- assert.equal(viewRect.width, 800);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/chart_base.html b/chromium/third_party/catapult/tracing/tracing/ui/base/chart_base.html
deleted file mode 100644
index 5155376058a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/chart_base.html
+++ /dev/null
@@ -1,277 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/ui/base/d3.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<style>
- * /deep/ .chart-base #title {
- font-size: 16pt;
- }
-
- * /deep/ .chart-base {
- font-size: 12pt;
- -webkit-user-select: none;
- cursor: default;
- }
-
- * /deep/ .chart-base .axis path,
- * /deep/ .chart-base .axis line {
- fill: none;
- shape-rendering: crispEdges;
- stroke: #000;
- }
-</style>
-
-<template id="chart-base-template">
- <svg> <!-- svg tag is dropped by ChartBase.decorate. -->
- <g xmlns="http://www.w3.org/2000/svg" id="chart-area">
- <g class="x axis"></g>
- <g class="y axis"></g>
- <text id="title"></text>
- </g>
- </svg>
-</template>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- var THIS_DOC = document.currentScript.ownerDocument;
-
- var svgNS = 'http://www.w3.org/2000/svg';
- var ColorScheme = tr.b.ColorScheme;
-
- function getColorOfKey(key, selected) {
- var id = ColorScheme.getColorIdForGeneralPurposeString(key);
- if (selected)
- id += ColorScheme.properties.brightenedOffsets[0];
- return ColorScheme.colorsAsStrings[id];
- }
-
- /**
- * A virtual base class for basic charts that provides X and Y axes, if
- * needed, a title, and legend.
- *
- * @constructor
- */
- var ChartBase = tr.ui.b.define('svg', undefined, svgNS);
-
- ChartBase.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.classList.add('chart-base');
- this.chartTitle_ = undefined;
- this.seriesKeys_ = undefined;
- this.width_ = 400;
- this.height_ = 300;
-
- // This should use tr.ui.b.instantiateTemplate. However, creating
- // svg-namespaced elements inside a template isn't possible. Thus, this
- // hack.
- var template = THIS_DOC.querySelector('#chart-base-template');
- var svgEl = template.content.querySelector('svg');
- for (var i = 0; i < svgEl.children.length; i++)
- this.appendChild(svgEl.children[i].cloneNode(true));
-
- // svg likes to take over width & height properties for some reason. This
- // works around it.
- Object.defineProperty(
- this, 'width', {
- get: function() {
- return this.width_;
- },
- set: function(width) {
- this.width_ = width;
- this.updateContents_();
- }
- });
- Object.defineProperty(
- this, 'height', {
- get: function() {
- return this.height_;
- },
- set: function(height) {
- this.height_ = height;
- this.updateContents_();
- }
- });
- },
-
- get chartTitle() {
- return this.chartTitle_;
- },
-
- set chartTitle(chartTitle) {
- this.chartTitle_ = chartTitle;
- this.updateContents_();
- },
-
- get chartAreaElement() {
- return this.querySelector('#chart-area');
- },
-
- setSize: function(size) {
- this.width_ = size.width;
- this.height_ = size.height;
- this.updateContents_();
- },
-
- getMargin_: function() {
- var margin = {top: 20, right: 20, bottom: 30, left: 50};
- if (this.chartTitle_)
- margin.top += 20;
- return margin;
- },
-
- get margin() {
- return this.getMargin_();
- },
-
- get chartAreaSize() {
- var margin = this.margin;
- return {
- width: this.width_ - margin.left - margin.right,
- height: this.height_ - margin.top - margin.bottom
- };
- },
-
- getLegendKeys_: function() {
- throw new Error('Not implemented');
- },
-
- updateScales_: function() {
- throw new Error('Not implemented');
- },
-
- updateContents_: function() {
- var margin = this.margin;
-
- var thisSel = d3.select(this);
- thisSel.attr('width', this.width_);
- thisSel.attr('height', this.height_);
-
- var chartAreaSel = d3.select(this.chartAreaElement);
- chartAreaSel.attr('transform',
- 'translate(' + margin.left + ',' + margin.top + ')');
-
- this.updateScales_();
- this.updateTitle_(chartAreaSel);
- this.updateLegend_();
- },
-
- updateTitle_: function(chartAreaSel) {
- var titleSel = chartAreaSel.select('#title');
- if (!this.chartTitle_) {
- titleSel.style('display', 'none');
- return;
- }
- var width = this.chartAreaSize.width;
- titleSel.attr('transform', 'translate(' + width * 0.5 + ',-5)')
- .style('display', undefined)
- .style('text-anchor', 'middle')
- .attr('class', 'title')
- .attr('width', width)
- .text(this.chartTitle_);
- },
-
- // TODO(charliea): We should change updateLegend_ so that it ellipsizes the
- // series names after a certain point. Otherwise, the series names start
- // dipping below the x-axis and continue on outside of the viewport.
- updateLegend_: function() {
- var keys = this.getLegendKeys_();
- if (keys === undefined)
- return;
-
- var chartAreaSel = d3.select(this.chartAreaElement);
- var chartAreaSize = this.chartAreaSize;
-
- var legendEntriesSel = chartAreaSel.selectAll('.legend')
- .data(keys.slice().reverse());
-
- legendEntriesSel.enter()
- .append('g')
- .attr('class', 'legend')
- .attr('transform', function(d, i) {
- return 'translate(0,' + i * 20 + ')';
- })
- .append('text').text(function(key) {
- return key;
- });
- legendEntriesSel.exit().remove();
-
- legendEntriesSel.attr('x', chartAreaSize.width - 18)
- .attr('width', 18)
- .attr('height', 18)
- .style('fill', function(key) {
- var selected = this.currentHighlightedLegendKey === key;
- return getColorOfKey(key, selected);
- }.bind(this));
-
- legendEntriesSel.selectAll('text')
- .attr('x', chartAreaSize.width - 24)
- .attr('y', 9)
- .attr('dy', '.35em')
- .style('text-anchor', 'end')
- .text(function(d) { return d; });
- },
-
- get highlightedLegendKey() {
- return this.highlightedLegendKey_;
- },
-
- set highlightedLegendKey(highlightedLegendKey) {
- this.highlightedLegendKey_ = highlightedLegendKey;
- this.updateHighlight_();
- },
-
- get currentHighlightedLegendKey() {
- if (this.tempHighlightedLegendKey_)
- return this.tempHighlightedLegendKey_;
- return this.highlightedLegendKey_;
- },
-
- pushTempHighlightedLegendKey: function(key) {
- if (this.tempHighlightedLegendKey_)
- throw new Error('push cannot nest');
- this.tempHighlightedLegendKey_ = key;
- this.updateHighlight_();
- },
-
- popTempHighlightedLegendKey: function(key) {
- if (this.tempHighlightedLegendKey_ != key)
- throw new Error('pop cannot happen');
- this.tempHighlightedLegendKey_ = undefined;
- this.updateHighlight_();
- },
-
- updateHighlight_: function() {
- // Update label colors.
- var chartAreaSel = d3.select(this.chartAreaElement);
- var legendEntriesSel = chartAreaSel.selectAll('.legend');
-
- var that = this;
- legendEntriesSel.each(function(key) {
- var highlighted = key == that.currentHighlightedLegendKey;
- var color = getColorOfKey(key, highlighted);
- this.style.fill = color;
- if (highlighted)
- this.style.fontWeight = 'bold';
- else
- this.style.fontWeight = '';
- });
- }
- };
-
- return {
- getColorOfKey: getColorOfKey,
- ChartBase: ChartBase
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/chart_base_2d.html b/chromium/third_party/catapult/tracing/tracing/ui/base/chart_base_2d.html
deleted file mode 100644
index 84cd5019157..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/chart_base_2d.html
+++ /dev/null
@@ -1,384 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/ui/base/chart_base.html">
-<link rel="import" href="/tracing/ui/base/mouse_tracker.html">
-
-<style>
- * /deep/ .chart-base-2d.updating-brushing-state #brushes > * {
- fill: rgb(103, 199, 165)
- }
-
- * /deep/ .chart-base-2d #brushes {
- fill: rgb(213, 236, 229)
- }
-</style>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- var ChartBase = tr.ui.b.ChartBase;
- var ChartBase2D = tr.ui.b.define('chart-base-2d', ChartBase);
-
- ChartBase2D.prototype = {
- __proto__: ChartBase.prototype,
-
- decorate: function() {
- ChartBase.prototype.decorate.call(this);
- this.classList.add('chart-base-2d');
- this.xScale_ = d3.scale.linear();
- this.yScale_ = d3.scale.linear();
- this.isYLogScale_ = false;
- this.yLogScaleMin_ = undefined;
- this.dataRange_ = new tr.b.Range();
-
- this.data_ = [];
- this.seriesKeys_ = [];
- this.leftMargin_ = 50;
-
- d3.select(this.chartAreaElement)
- .append('g')
- .attr('id', 'brushes');
- d3.select(this.chartAreaElement)
- .append('g')
- .attr('id', 'series');
-
- this.addEventListener('mousedown', this.onMouseDown_.bind(this));
- },
-
- get data() {
- return this.data_;
- },
-
- /**
- * Sets the data array for the object
- *
- * @param {Array} data The data. Each element must be an object, with at
- * least an x property. All other properties become series names in the
- * chart. The data can be sparse (i.e. every x value does not have to
- * contain data for every series).
- */
- set data(data) {
- if (data === undefined)
- throw new Error('data must be an Array');
-
- this.data_ = data;
- this.updateSeriesKeys_();
- this.updateDataRange_();
- this.updateContents_();
- },
-
- set isYLogScale(logScale) {
- if (logScale)
- this.yScale_ = d3.scale.log(10);
- else
- this.yScale_ = d3.scale.linear();
- this.isYLogScale_ = logScale;
- },
-
- getYScaleMin_: function() {
- return this.isYLogScale_ ? this.yLogScaleMin_ : 0;
- },
-
- getYScaleDomain_: function(minValue, maxValue) {
- if (this.isYLogScale_)
- return [this.getYScaleMin_(), maxValue];
- return [Math.min(minValue, this.getYScaleMin_()), maxValue];
- },
-
- getSampleWidth_: function(data, index, leftSide) {
- var leftIndex, rightIndex;
- if (leftSide) {
- leftIndex = Math.max(index - 1, 0);
- rightIndex = index;
- } else {
- leftIndex = index;
- rightIndex = Math.min(index + 1, data.length - 1);
- }
- var leftWidth = this.getXForDatum_(data[index], index) -
- this.getXForDatum_(data[leftIndex], leftIndex);
- var rightWidth = this.getXForDatum_(data[rightIndex], rightIndex) -
- this.getXForDatum_(data[index], index);
- return leftWidth * 0.5 + rightWidth * 0.5;
- },
-
- getLegendKeys_: function() {
- if (this.seriesKeys_ &&
- this.seriesKeys_.length > 1)
- return this.seriesKeys_.slice();
- return [];
- },
-
- updateSeriesKeys_: function() {
- // Accumulate the keys on each data point.
- var keySet = {};
- this.data_.forEach(function(datum) {
- Object.keys(datum).forEach(function(key) {
- if (this.isDatumFieldSeries_(key))
- keySet[key] = true;
- }, this);
- }, this);
- this.seriesKeys_ = Object.keys(keySet);
- },
-
- isDatumFieldSeries_: function(fieldName) {
- throw new Error('Not implemented');
- },
-
- getXForDatum_: function(datum, index) {
- throw new Error('Not implemented');
- },
-
- updateScales_: function() {
- if (this.data_.length === 0)
- return;
-
- var width = this.chartAreaSize.width;
- var height = this.chartAreaSize.height;
-
- // X.
- this.xScale_.range([0, width]);
- this.xScale_.domain(d3.extent(this.data_, this.getXForDatum_.bind(this)));
-
- // Y.
- var yRange = new tr.b.Range();
- var keySet = new Set(this.seriesKeys_);
- for (var i = 0; i < this.data_.length; i++)
- for (var key in this.data_[i])
- if (keySet.has(key))
- yRange.addValue(this.data_[i][key]);
-
- this.yScale_.range([height, 0]);
- this.yScale_.domain([yRange.min, yRange.max]);
- },
-
- updateBrushContents_: function(brushSel) {
- brushSel.selectAll('*').remove();
- },
-
- updateXAxis_: function(xAxis) {
- xAxis.selectAll('*').remove();
- xAxis[0][0].style.opacity = 0;
- xAxis.attr('transform', 'translate(0,' + this.chartAreaSize.height + ')')
- .call(d3.svg.axis()
- .scale(this.xScale_)
- .orient('bottom'));
- window.requestAnimationFrame(function() {
- var previousRight = undefined;
- xAxis.selectAll('.tick')[0].forEach(function(tick) {
- var currentLeft = tick.transform.baseVal[0].matrix.e;
- if ((previousRight === undefined) ||
- (currentLeft > (previousRight + 3))) {
- var currentWidth = tick.getBBox().width;
- previousRight = currentLeft + currentWidth;
- } else {
- tick.style.opacity = 0;
- }
- });
- xAxis[0][0].style.opacity = 1;
- });
- },
-
- getMargin_: function() {
- var margin = ChartBase.prototype.getMargin_.call(this);
- margin.left = this.leftMargin_;
- return margin;
- },
-
- updateDataRange_: function() {
- var dataBySeriesKey = this.getDataBySeriesKey_();
- this.dataRange_.reset();
- tr.b.iterItems(dataBySeriesKey, function(series, values) {
- for (var i = 0; i < values.length; i++) {
- this.dataRange_.addValue(values[i][series]);
- }
- }, this);
-
- // Choose the closest power of 10, rounded down, as the smallest tick
- // to display.
- this.yLogScaleMin_ = undefined;
- if (this.dataRange_.min !== undefined) {
- var minValue = this.dataRange_.min;
- if (minValue == 0)
- minValue = 1;
-
- var onePowerLess = Math.floor(
- Math.log(minValue) / Math.log(10)) - 1;
- this.yLogScaleMin_ = Math.pow(10, onePowerLess);
- }
- },
-
- updateYAxis_: function(yAxis) {
- yAxis.selectAll('*').remove();
- yAxis[0][0].style.opacity = 0;
-
- var axisModifier = d3.svg.axis()
- .scale(this.yScale_)
- .orient('left');
-
- if (this.isYLogScale_) {
- if (this.yLogScaleMin_ === undefined)
- return;
- var minValue = this.dataRange_.min;
- if (minValue == 0)
- minValue = 1;
-
- var largestPower = Math.ceil(
- Math.log(this.dataRange_.max) / Math.log(10)) + 1;
- var smallestPower = Math.floor(
- Math.log(minValue) / Math.log(10));
- var tickValues = [];
- for (var i = smallestPower; i < largestPower; i++) {
- tickValues.push(Math.pow(10, i));
- }
-
- axisModifier = axisModifier
- .tickValues(tickValues)
- .tickFormat(function(d) {
- return d;
- });
- }
-
- yAxis.call(axisModifier);
-
- window.requestAnimationFrame(function() {
- var previousTop = undefined;
- var leftMargin = 0;
- yAxis.selectAll('.tick')[0].forEach(function(tick) {
- var bbox = tick.getBBox();
- leftMargin = Math.max(leftMargin, bbox.width);
- var currentTop = tick.transform.baseVal[0].matrix.f;
- var currentBottom = currentTop + bbox.height;
- if ((previousTop === undefined) ||
- (previousTop > (currentBottom + 3))) {
- previousTop = currentTop;
- } else {
- tick.style.opacity = 0;
- }
- });
- if (leftMargin > this.leftMargin_) {
- this.leftMargin_ = leftMargin;
- this.updateContents_();
- } else {
- yAxis[0][0].style.opacity = 1;
- }
- }.bind(this));
- },
-
- updateContents_: function() {
- ChartBase.prototype.updateContents_.call(this);
- var chartAreaSel = d3.select(this.chartAreaElement);
- this.updateXAxis_(chartAreaSel.select('.x.axis'));
- this.updateYAxis_(chartAreaSel.select('.y.axis'));
- this.updateBrushContents_(chartAreaSel.select('#brushes'));
- this.updateDataContents_(chartAreaSel.select('#series'));
- },
-
- updateDataContents_: function(seriesSel) {
- throw new Error('Not implemented');
- },
-
- /**
- * Returns a map of series key to the data for that series.
- *
- * Example:
- * // returns {y: [{x: 1, y: 1}, {x: 3, y: 3}], z: [{x: 2, z: 2}]}
- * this.data_ = [{x: 1, y: 1}, {x: 2, z: 2}, {x: 3, y: 3}];
- * this.getDataBySeriesKey_();
- * @return {Object} A map of series data by series key.
- */
- getDataBySeriesKey_: function() {
- var dataBySeriesKey = {};
- this.seriesKeys_.forEach(function(seriesKey) {
- dataBySeriesKey[seriesKey] = [];
- });
-
- this.data_.forEach(function(multiSeriesDatum, index) {
- var x = this.getXForDatum_(multiSeriesDatum, index);
-
- d3.keys(multiSeriesDatum).forEach(function(seriesKey) {
- // Skip 'x' - it's not a series
- if (seriesKey === 'x')
- return;
-
- if (multiSeriesDatum[seriesKey] === undefined)
- return;
-
- if (!this.isDatumFieldSeries_(seriesKey))
- return;
-
- var singleSeriesDatum = {x: x};
- singleSeriesDatum[seriesKey] = multiSeriesDatum[seriesKey];
- dataBySeriesKey[seriesKey].push(singleSeriesDatum);
- }, this);
- }, this);
-
- return dataBySeriesKey;
- },
-
- getDataPointAtClientPoint_: function(clientX, clientY) {
- var rect = this.getBoundingClientRect();
- var margin = this.margin;
- var x = clientX - rect.left - margin.left;
- var y = clientY - rect.top - margin.top;
- x = this.xScale_.invert(x);
- y = this.yScale_.invert(y);
- x = tr.b.clamp(x, this.xScale_.domain()[0], this.xScale_.domain()[1]);
- y = tr.b.clamp(y, this.yScale_.domain()[0], this.yScale_.domain()[1]);
- return {x: x, y: y};
- },
-
- prepareDataEvent_: function(mouseEvent, dataEvent) {
- var dataPoint = this.getDataPointAtClientPoint_(
- mouseEvent.clientX, mouseEvent.clientY);
- dataEvent.x = dataPoint.x;
- dataEvent.y = dataPoint.y;
- },
-
- onMouseDown_: function(mouseEvent) {
- tr.ui.b.trackMouseMovesUntilMouseUp(
- this.onMouseMove_.bind(this, mouseEvent.button),
- this.onMouseUp_.bind(this, mouseEvent.button));
- mouseEvent.preventDefault();
- mouseEvent.stopPropagation();
- var dataEvent = new tr.b.Event('item-mousedown');
- dataEvent.button = mouseEvent.button;
- this.classList.add('updating-brushing-state');
- this.prepareDataEvent_(mouseEvent, dataEvent);
- this.dispatchEvent(dataEvent);
- },
-
- onMouseMove_: function(button, mouseEvent) {
- if (mouseEvent.buttons !== undefined) {
- mouseEvent.preventDefault();
- mouseEvent.stopPropagation();
- }
- var dataEvent = new tr.b.Event('item-mousemove');
- dataEvent.button = button;
- this.prepareDataEvent_(mouseEvent, dataEvent);
- this.dispatchEvent(dataEvent);
- },
-
- onMouseUp_: function(button, mouseEvent) {
- mouseEvent.preventDefault();
- mouseEvent.stopPropagation();
- var dataEvent = new tr.b.Event('item-mouseup');
- dataEvent.button = button;
- this.prepareDataEvent_(mouseEvent, dataEvent);
- this.dispatchEvent(dataEvent);
- this.classList.remove('updating-brushing-state');
- }
- };
-
- return {
- ChartBase2D: ChartBase2D
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/chart_base_2d_brushable_x.html b/chromium/third_party/catapult/tracing/tracing/ui/base/chart_base_2d_brushable_x.html
deleted file mode 100644
index 4cde4b58bdd..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/chart_base_2d_brushable_x.html
+++ /dev/null
@@ -1,84 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/chart_base_2d.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- var ChartBase2D = tr.ui.b.ChartBase2D;
- var ChartBase2DBrushX = tr.ui.b.define('chart-base-2d-brush-1d', ChartBase2D);
-
- ChartBase2DBrushX.prototype = {
- __proto__: ChartBase2D.prototype,
-
- decorate: function() {
- ChartBase2D.prototype.decorate.call(this);
- this.brushedRange_ = new tr.b.Range();
- },
-
- // Note: range can only be set, not retrieved. It needs to be immutable
- // or else odd data binding effects will result.
- set brushedRange(range) {
- this.brushedRange_.reset();
- this.brushedRange_.addRange(range);
- this.updateContents_();
- },
-
- computeBrushRangeFromIndices: function(indexA, indexB) {
- indexA = tr.b.clamp(indexA, 0, this.data_.length - 1);
- indexB = tr.b.clamp(indexB, 0, this.data_.length - 1);
- var leftIndex = Math.min(indexA, indexB);
- var rightIndex = Math.max(indexA, indexB);
-
- var r = new tr.b.Range();
- r.addValue(this.getXForDatum_(this.data_[leftIndex], leftIndex) -
- this.getSampleWidth_(this.data_, leftIndex, true));
- r.addValue(this.getXForDatum_(this.data_[rightIndex], rightIndex) +
- this.getSampleWidth_(this.data_, rightIndex, false));
- return r;
- },
-
- getDataIndex_: function(dataX) {
- if (!this.data_)
- return undefined;
- var bisect = d3.bisector(this.getXForDatum_.bind(this)).right;
- return bisect(this.data_, dataX) - 1;
- },
-
- prepareDataEvent_: function(mouseEvent, dataEvent) {
- ChartBase2D.prototype.prepareDataEvent_.call(
- this, mouseEvent, dataEvent);
- dataEvent.index = this.getDataIndex_(dataEvent.x);
- if (dataEvent.index !== undefined)
- dataEvent.data = this.data_[dataEvent.index];
- },
-
- updateBrushContents_: function(brushSel) {
- brushSel.selectAll('*').remove();
- var brushes = this.brushedRange_.isEmpty ? [] : [this.brushedRange_];
- var brushRectsSel = brushSel.selectAll('rect').data(brushes);
- brushRectsSel.enter().append('rect');
- brushRectsSel.exit().remove();
- brushRectsSel
- .attr('x', function(d) {
- return this.xScale_(d.min);
- }.bind(this))
- .attr('y', 0)
- .attr('width', function(d) {
- return this.xScale_(d.max) - this.xScale_(d.min);
- }.bind(this))
- .attr('height', this.chartAreaSize.height);
- }
- };
-
- return {
- ChartBase2DBrushX: ChartBase2DBrushX
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox.html b/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox.html
deleted file mode 100644
index 9de49183853..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox.html
+++ /dev/null
@@ -1,107 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/settings.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<polymer-element name='tr-ui-b-checkbox'>
- <template>
- <style>
- .inline {
- display: inline-block;
- }
- </style>
-
- <input type="checkbox" id="checkbox" class="inline"/>
- <div id="label" class="inline"></div>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.needsInit_ = true;
- this.defaultCheckedValue_ = undefined;
- this.settingsKey_ = undefined;
- this.label_ = undefined;
- this.checked_ = false;
- this.is_ready_ = false;
- },
-
- ready: function() {
- this.is_ready_ = true;
- this.$.checkbox.addEventListener('click', function() {
- this.checked = this.$.checkbox.checked;
- }.bind(this));
- this.maybeUpdateElements_();
- },
-
- maybeUpdateElements_: function() {
- if (!this.is_ready_)
- return;
- this.$.label.innerText = this.label_;
- this.$.checkbox.checked = this.checked_;
- },
-
- get defaultCheckedValue() {
- return this.defaultCheckedValue_;
- },
-
- set defaultCheckedValue(defaultCheckedValue) {
- if (!this.needsInit_)
- throw new Error('Already initialized.');
- this.defaultCheckedValue_ = defaultCheckedValue;
- this.maybeInit_();
- },
-
- get settingsKey() {
- return this.settingsKey_;
- },
-
- set settingsKey(settingsKey) {
- if (!this.needsInit_)
- throw new Error('Already initialized.');
- this.settingsKey_ = settingsKey;
- this.maybeInit_();
- },
-
- maybeInit_: function() {
- if (!this.needsInit_)
- return;
- if (this.settingsKey_ === undefined)
- return;
- if (this.defaultCheckedValue_ === undefined)
- return;
- this.needsInit_ = false;
- this.checked = tr.b.Settings.get(
- this.settingsKey_, this.defaultCheckedValue_);
- },
-
- get label() {
- return this.label_;
- },
-
- set label(label) {
- this.label_ = label;
- this.maybeUpdateElements_();
- },
-
- get checked() {
- return this.checked_;
- },
-
- set checked(checked) {
- this.checked_ = checked;
- this.maybeUpdateElements_();
- tr.b.Settings.set(this.settingsKey_, this.checked_);
- },
-
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_picker.html b/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_picker.html
deleted file mode 100644
index 261b15922bd..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_picker.html
+++ /dev/null
@@ -1,111 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/checkbox.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<polymer-element name='tr-ui-b-checkbox-picker'>
- <template>
- <style>
- #container {
- display: flex;
- flex-direction: column;
- }
- </style>
-
- <div id="container">
- </div>
-
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.needsInit_ = true;
- this.settingsKey_ = undefined;
- this.is_ready_ = false;
- this.checkboxes_ = undefined;
- },
-
- ready: function() {
- this.is_ready_ = true;
- this.maybeInit_();
- this.maybeRenderCheckboxes_();
- },
-
- get settingsKey() {
- return this.settingsKey_;
- },
-
- set settingsKey(settingsKey) {
- if (!this.needsInit_)
- throw new Error('Already initialized.');
- this.settingsKey_ = settingsKey;
- this.maybeInit_();
- },
-
- maybeInit_: function() {
- if (!this.needsInit_)
- return;
- if (this.settingsKey_ === undefined)
- return;
- if (this.checkboxes_ === undefined)
- return;
-
- this.needsInit_ = false;
-
- for (var key in this.checkboxes_) {
- this.checkboxes_[key].defaultCheckedValue = false;
- this.checkboxes_[key].settingsKey = this.settingsKey_ + key;
- }
- },
-
- set items(items) {
- this.checkboxes_ = {};
- items.forEach(function(e) {
- if (e.key in this.checkboxes_)
- throw new Error(e.key + ' already exists');
- var checkboxEl = document.createElement('tr-ui-b-checkbox');
- checkboxEl.label = e.label;
- this.checkboxes_[e.key] = checkboxEl;
- }.bind(this));
- this.maybeInit_();
- this.maybeRenderCheckboxes_();
- },
-
- maybeRenderCheckboxes_: function() {
- if (!this.is_ready_)
- return;
- if (this.checkboxes_ === undefined)
- return;
- for (var key in this.checkboxes_)
- this.$.container.appendChild(this.checkboxes_[key]);
- },
-
- selectCheckbox: function(key) {
- if (!(key in this.checkboxes_))
- throw new Error(key + ' does not exists');
- this.checkboxes_[key].checked = true;
- },
-
- unselectCheckbox: function(key) {
- if (!(key in this.checkboxes_))
- throw new Error(key + ' does not exists');
- this.checkboxes_[key].checked = false;
- },
-
- get checkedKeys() {
- return Object.keys(this.checkboxes_).filter(function(k) {
- return this.checkboxes_[k].checked;
- }.bind(this));
- },
-
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_picker_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_picker_test.html
deleted file mode 100644
index 40d83361fb6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_picker_test.html
+++ /dev/null
@@ -1,139 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/checkbox_picker.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('basicAllCheckboxUnchecked', function() {
- var cp = document.createElement('tr-ui-b-checkbox-picker');
- cp.items = [
- {key: 'Toyota', label: 'I want to drive Toyota'},
- {key: 'Boeing', label: 'I want to fly'}
- ];
- this.addHTMLOutput(cp);
- assert.deepEqual(cp.checkedKeys, []);
- });
-
- test('basicSomeCheckboxChecked', function() {
- var cp = document.createElement('tr-ui-b-checkbox-picker');
- cp.items = [
- {key: 'Toyota', label: 'I want to drive Toyota'},
- {key: 'Honda', label: 'I want to drive Honda'},
- {key: 'Tesla', label: 'I want to drive electric car'},
- ];
-
- cp.selectCheckbox('Toyota');
- cp.selectCheckbox('Tesla');
- this.addHTMLOutput(cp);
- assert.deepEqual(cp.checkedKeys.sort(), ['Tesla', 'Toyota']);
- cp.unselectCheckbox('Toyota');
- assert.deepEqual(cp.checkedKeys, ['Tesla']);
- });
-
- test('duplicateKeys', function() {
- var cp = document.createElement('tr-ui-b-checkbox-picker');
- assert.throws(function() {
- cp.items = [
- {key: 'Toyota', label: 'I want to drive Toyota'},
- {key: 'Honda', label: 'I want to drive Honda'},
- {key: 'Toyota', label: 'I want to drive electric car'},
- ];
- });
- });
-
- test('selectAndUnselectNonExistingKey', function() {
- var cp = document.createElement('tr-ui-b-checkbox-picker');
- cp.items = [
- {key: 'Toyota', label: 'I want to drive Toyota'},
- {key: 'Honda', label: 'I want to drive Honda'},
- ];
- assert.throws(function() {
- cp.selectCheckbox('Lamborghini');
- });
- assert.throws(function() {
- cp.unselectCheckbox('Roll Royce');
- });
- });
-
- test('testPersistentStateOneSetSettingsKeyBeforeSettingItems', function() {
- var container1 = tr.ui.b.createDiv({textContent: 'Checkbox Picker One'});
- container1.style.border = 'solid';
- var cp = document.createElement('tr-ui-b-checkbox-picker');
- cp.settingsKey = 'checkbox-picker-test-one';
- cp.items = [
- {key: 'Toyota', label: 'I want to drive Toyota'},
- {key: 'Honda', label: 'I want to drive Honda'},
- {key: 'Tesla', label: 'I want to drive electric car'},
- ];
- cp.selectCheckbox('Toyota');
- cp.selectCheckbox('Tesla');
- container1.appendChild(cp);
- this.addHTMLOutput(container1);
- cp.unselectCheckbox('Tesla');
- assert.deepEqual(cp.checkedKeys, ['Toyota']);
-
- this.addHTMLOutput(document.createElement('br'));
-
- var container2 = tr.ui.b.createDiv(
- {textContent:
- 'Checkbox Picker Two (Same settingsKey as Checkbox Picker One)'});
- container2.style.border = 'solid #0000FF';
- var cp2 = document.createElement('tr-ui-b-checkbox-picker');
- cp2.settingsKey = 'checkbox-picker-test-one';
- cp2.items = [
- {key: 'Toyota', label: 'I want to drive Toyota'},
- {key: 'Honda', label: 'I want to drive Honda'},
- {key: 'Tesla', label: 'I want to drive electric car'},
- ];
- container2.appendChild(cp2);
- this.addHTMLOutput(container2);
- assert.deepEqual(cp2.checkedKeys, ['Toyota']);
- });
-
- test('testPersistentStateTwoSetSettingsKeyAfterSettingItems', function() {
- var container1 = tr.ui.b.createDiv({textContent: 'Checkbox Picker One'});
- container1.style.border = 'solid';
- var cp = document.createElement('tr-ui-b-checkbox-picker');
- cp.items = [
- {key: 'Toyota', label: 'I want to drive Toyota'},
- {key: 'Honda', label: 'I want to drive Honda'},
- {key: 'Tesla', label: 'I want to drive electric car'},
- ];
- cp.settingsKey = 'checkbox-picker-test-one';
- cp.selectCheckbox('Toyota');
- cp.selectCheckbox('Tesla');
- container1.appendChild(cp);
- this.addHTMLOutput(container1);
- assert.deepEqual(cp.checkedKeys.sort(), ['Tesla', 'Toyota']);
-
- this.addHTMLOutput(document.createElement('br'));
-
- var container2 = tr.ui.b.createDiv(
- {textContent:
- 'Checkbox Picker Two (Same settingsKey as Checkbox Picker One)'});
- container2.style.border = 'solid #0000FF';
- var cp2 = document.createElement('tr-ui-b-checkbox-picker');
- cp2.items = [
- {key: 'Toyota', label: 'I want to drive Toyota'},
- {key: 'Honda', label: 'I want to drive Honda'},
- {key: 'Tesla', label: 'I want to drive electric car'},
- ];
- container2.appendChild(cp2);
- this.addHTMLOutput(container2);
- cp2.settingsKey = 'checkbox-picker-test-one';
- assert.deepEqual(cp2.checkedKeys.sort(), ['Tesla', 'Toyota']);
-
- });
-
-
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_test.html
deleted file mode 100644
index 16f0223110a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/checkbox_test.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/checkbox.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('basicUnchecked', function() {
- var checkbox = document.createElement('tr-ui-b-checkbox');
- checkbox.label = 'Yo like pizza?';
- this.addHTMLOutput(checkbox);
- assert.equal(checkbox.label, 'Yo like pizza?');
- assert.isFalse(checkbox.checked);
- });
-
- test('basicChecked', function() {
- var checkbox = document.createElement('tr-ui-b-checkbox');
- checkbox.label = 'Yo like cookie?';
- checkbox.checked = true;
- this.addHTMLOutput(checkbox);
- assert.equal(checkbox.label, 'Yo like cookie?');
- assert.isTrue(checkbox.checked);
- });
-
- test('testPersistentStateOneSetSettingsKeyBeforeAddToDom', function() {
- var checkbox = document.createElement('tr-ui-b-checkbox');
- checkbox.settingsKey = 'checkbox-basic-test-one';
- checkbox.label = 'I like sushi';
- checkbox.defaultCheckedValue = false;
- this.addHTMLOutput(checkbox);
- assert.isFalse(checkbox.checked);
- checkbox.checked = true;
-
- var checkbox2 = document.createElement('tr-ui-b-checkbox');
- checkbox2.label = 'I like sushi';
- checkbox2.defaultCheckedValue = false;
- checkbox2.settingsKey = 'checkbox-basic-test-one';
- this.addHTMLOutput(checkbox2);
- assert.isTrue(checkbox2.checked);
- });
-
- test('testPersistentStateTwoSetSettingsKeyAfterAddToDom', function() {
- var checkbox = document.createElement('tr-ui-b-checkbox');
- this.addHTMLOutput(checkbox);
- checkbox.label = 'I like Ramen';
- checkbox.settingsKey = 'checkbox-basic-test-two';
- checkbox.defaultCheckedValue = false;
- assert.isFalse(checkbox.checked);
- checkbox.checked = true;
-
- var checkbox2 = document.createElement('tr-ui-b-checkbox');
- this.addHTMLOutput(checkbox2);
- checkbox2.label = 'I like Ramen';
- checkbox2.defaultCheckedValue = false;
- checkbox2.settingsKey = 'checkbox-basic-test-two';
- assert.isTrue(checkbox2.checked);
- });
-
-
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/color_legend.html b/chromium/third_party/catapult/tracing/tracing/ui/base/color_legend.html
deleted file mode 100644
index 3804b4b144c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/color_legend.html
+++ /dev/null
@@ -1,79 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/model/compound_event_selection_state.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-
-<!--
-@fileoverview A component used to display a label and a color square.
-
-The colored square is typically filled with the color associated with
-that label, using the getColorId* methods from base/color_scheme.
--->
-<polymer-element name="tr-ui-b-color-legend">
- <template>
- <style>
- :host {
- display: inline-block;
- }
-
- #square {
- font-size: 150%; /* Make the square bigger. */
- line-height: 0%; /* Prevent the square from increasing legend height. */
- }
- </style>
- <span id="square"></span>
- <span id="label"></span>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- var blackSquareCharCode = 9632;
- this.$.square.innerText = String.fromCharCode(blackSquareCharCode);
- this.label_ = undefined;
-
- this.compoundEventSelectionState_ =
- tr.model.CompoundEventSelectionState.NOT_SELECTED;
- },
-
- set compoundEventSelectionState(compoundEventSelectionState) {
- this.compoundEventSelectionState_ = compoundEventSelectionState;
- // TODO(nduca): Adjust appearance based on associated state.
- },
-
- get label() {
- return this.label_;
- },
-
- set label(label) {
- if (label === undefined) {
- this.setLabelAndColorId(undefined, undefined);
- return;
- }
-
- var colorId = tr.b.ColorScheme.getColorIdForGeneralPurposeString(
- label);
- this.setLabelAndColorId(label, colorId);
- },
-
- setLabelAndColorId: function(label, colorId) {
- this.label_ = label;
-
- this.$.label.textContent = '';
- this.$.label.appendChild(tr.ui.b.asHTMLOrTextNode(label));
-
- if (colorId === undefined)
- this.$.square.style.color = 'initial';
- else
- this.$.square.style.color = tr.b.ColorScheme.colorsAsStrings[colorId];
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/color_legend_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/color_legend_test.html
deleted file mode 100644
index fbe802d6a8f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/color_legend_test.html
+++ /dev/null
@@ -1,122 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/color_legend.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var CompoundEventSelectionState = tr.model.CompoundEventSelectionState;
-
- function checkSquareColor(colorLegend, expectedColor) {
- assert.equal(getComputedStyle(colorLegend.$.square).color, expectedColor);
- }
-
- test('noLabelSet', function() {
- var colorLegend = document.createElement('tr-ui-b-color-legend');
- this.addHTMLOutput(colorLegend);
- checkSquareColor(colorLegend, 'rgb(0, 0, 0)');
- });
-
- test('undefinedLabel', function() {
- var colorLegend = document.createElement('tr-ui-b-color-legend');
- colorLegend.label = undefined;
- this.addHTMLOutput(colorLegend);
- checkSquareColor(colorLegend, 'rgb(0, 0, 0)');
- });
-
- test('emptyLabel', function() {
- var colorLegend = document.createElement('tr-ui-b-color-legend');
- colorLegend.label = '';
- this.addHTMLOutput(colorLegend);
- checkSquareColor(colorLegend, 'rgb(122, 98, 135)');
- });
-
- test('nonEmptyLabel', function() {
- var colorLegend = document.createElement('tr-ui-b-color-legend');
- colorLegend.label = 'Frequency';
- this.addHTMLOutput(colorLegend);
- checkSquareColor(colorLegend, 'rgb(83, 150, 97)');
- });
-
- test('longLabel', function() {
- var colorLegend = document.createElement('tr-ui-b-color-legend');
- colorLegend.label = 'Total memory usage';
- this.addHTMLOutput(colorLegend);
- checkSquareColor(colorLegend, 'rgb(96, 128, 137)');
- });
-
- test('directlySetColorId', function() {
- var colorLegend = document.createElement('tr-ui-b-color-legend');
- colorLegend.setLabelAndColorId('hello_world', 7 /* colorId */);
- this.addHTMLOutput(colorLegend);
- checkSquareColor(colorLegend, 'rgb(111, 145, 88)');
- });
-
- test('directlyProvidedLabelElement', function() {
- var colorLegend = document.createElement('tr-ui-b-color-legend');
- colorLegend.setLabelAndColorId(
- tr.ui.b.createSpan({textContent: 'hello',
- className: 'hello-span'}),
- 7 /* colorId */);
- this.addHTMLOutput(colorLegend);
- checkSquareColor(colorLegend, 'rgb(111, 145, 88)');
- });
-
- test('cessObjectSelected', function() {
- var colorLegend = document.createElement('tr-ui-b-color-legend');
- colorLegend.label = 'Object selected';
- colorLegend.compoundEventSelectionState =
- CompoundEventSelectionState.EVENT_SELECTED;
- this.addHTMLOutput(colorLegend);
- checkSquareColor(colorLegend, 'rgb(143, 72, 161)');
- });
-
- test('cessSomeAssociatedObjectsSelected', function() {
- var colorLegend = document.createElement('tr-ui-b-color-legend');
- colorLegend.label = 'Some associated objects selected';
- colorLegend.compoundEventSelectionState =
- CompoundEventSelectionState.SOME_ASSOCIATED_EVENTS_SELECTED;
-
- this.addHTMLOutput(colorLegend);
- checkSquareColor(colorLegend, 'rgb(159, 74, 86)');
- });
-
- test('cessAllAssociatedObjectsSelected', function() {
- var colorLegend = document.createElement('tr-ui-b-color-legend');
- colorLegend.label = 'All associated objects selected';
- colorLegend.compoundEventSelectionState =
- CompoundEventSelectionState.ALL_ASSOCIATED_EVENTS_SELECTED;
-
- this.addHTMLOutput(colorLegend);
- checkSquareColor(colorLegend, 'rgb(112, 91, 142)');
- });
-
- test('cessObjectAndSomeAssociatedObjectsSelected', function() {
- var colorLegend = document.createElement('tr-ui-b-color-legend');
- colorLegend.label = 'Object and some associated objects selected';
- colorLegend.compoundEventSelectionState =
- CompoundEventSelectionState.EVENT_AND_SOME_ASSOCIATED_SELECTED;
-
- this.addHTMLOutput(colorLegend);
- checkSquareColor(colorLegend, 'rgb(83, 150, 97)');
- });
-
- test('cessObjectAndAllAssociatedObjectsSelected', function() {
- var colorLegend = document.createElement('tr-ui-b-color-legend');
- colorLegend.label = 'Object and all associated objects selected';
- colorLegend.compoundEventSelectionState =
- CompoundEventSelectionState.EVENT_AND_ALL_ASSOCIATED_SELECTED;
-
- this.addHTMLOutput(colorLegend);
- checkSquareColor(colorLegend, 'rgb(87, 109, 147)');
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/constants.html b/chromium/third_party/catapult/tracing/tracing/ui/base/constants.html
deleted file mode 100644
index 1a412656369..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/constants.html
+++ /dev/null
@@ -1,20 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- var constants = {
- HEADING_WIDTH: 250
- };
-
- return {
- constants: constants
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/container_that_decorates_its_children.html b/chromium/third_party/catapult/tracing/tracing/ui/base/container_that_decorates_its_children.html
deleted file mode 100644
index 11ed53a5fda..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/container_that_decorates_its_children.html
+++ /dev/null
@@ -1,107 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Container that decorates its children.
- */
-tr.exportTo('tr.ui.b', function() {
- /**
- * @constructor
- */
- var ContainerThatDecoratesItsChildren = tr.ui.b.define('div');
-
- ContainerThatDecoratesItsChildren.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.observer_ = new WebKitMutationObserver(this.didMutate_.bind(this));
- this.observer_.observe(this, { childList: true });
-
- // textContent is a variable on regular HTMLElements. However, we want to
- // hook and prevent writes to it.
- Object.defineProperty(
- this, 'textContent',
- { get: undefined, set: this.onSetTextContent_});
- },
-
- appendChild: function(x) {
- HTMLUnknownElement.prototype.appendChild.call(this, x);
- this.didMutate_(this.observer_.takeRecords());
- },
-
- insertBefore: function(x, y) {
- HTMLUnknownElement.prototype.insertBefore.call(this, x, y);
- this.didMutate_(this.observer_.takeRecords());
- },
-
- removeChild: function(x) {
- HTMLUnknownElement.prototype.removeChild.call(this, x);
- this.didMutate_(this.observer_.takeRecords());
- },
-
- replaceChild: function(x, y) {
- HTMLUnknownElement.prototype.replaceChild.call(this, x, y);
- this.didMutate_(this.observer_.takeRecords());
- },
-
- onSetTextContent_: function(textContent) {
- if (textContent != '')
- throw new Error('textContent can only be set to \'\'.');
- this.clear();
- },
-
- clear: function() {
- while (this.lastChild)
- HTMLUnknownElement.prototype.removeChild.call(this, this.lastChild);
- this.didMutate_(this.observer_.takeRecords());
- },
-
- didMutate_: function(records) {
- this.beginDecorating_();
- for (var i = 0; i < records.length; i++) {
- var addedNodes = records[i].addedNodes;
- if (addedNodes) {
- for (var j = 0; j < addedNodes.length; j++)
- this.decorateChild_(addedNodes[j]);
- }
- var removedNodes = records[i].removedNodes;
- if (removedNodes) {
- for (var j = 0; j < removedNodes.length; j++) {
- this.undecorateChild_(removedNodes[j]);
- }
- }
- }
- this.doneDecoratingForNow_();
- },
-
- decorateChild_: function(child) {
- throw new Error('Not implemented');
- },
-
- undecorateChild_: function(child) {
- throw new Error('Not implemented');
- },
-
- beginDecorating_: function() {
- },
-
- doneDecoratingForNow_: function() {
- }
- };
-
- return {
- ContainerThatDecoratesItsChildren: ContainerThatDecoratesItsChildren
- };
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/container_that_decorates_its_children_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/container_that_decorates_its_children_test.html
deleted file mode 100644
index 0f7ff710061..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/container_that_decorates_its_children_test.html
+++ /dev/null
@@ -1,97 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/ui/base/container_that_decorates_its_children.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- function createChild() {
- var span = document.createElement('span');
- span.decorated = false;
- return span;
- }
-
- /**
- * @constructor
- */
- var SimpleContainer = tr.ui.b.define(
- 'simple-container', tr.ui.b.ContainerThatDecoratesItsChildren);
-
- SimpleContainer.prototype = {
- __proto__: tr.ui.b.ContainerThatDecoratesItsChildren.prototype,
-
- decorateChild_: function(child) {
- assert.isFalse(child.decorated);
- child.decorated = true;
- },
-
- undecorateChild_: function(child) {
- assert.isTrue(child.decorated);
- child.decorated = false;
- }
- };
-
- test('add', function() {
- var container = new SimpleContainer();
- container.appendChild(createChild());
- container.appendChild(createChild());
- container.appendChild(createChild());
- assert.isTrue(container.children[0].decorated);
- assert.isTrue(container.children[1].decorated);
- assert.isTrue(container.children[2].decorated);
- });
-
- test('clearUsingTextContent', function() {
- var c0 = createChild();
- var container = new SimpleContainer();
- container.appendChild(c0);
- container.textContent = '';
- assert.isFalse(c0.decorated);
- });
-
- test('clear', function() {
- var c0 = createChild();
- var container = new SimpleContainer();
- container.appendChild(c0);
- container.clear();
- assert.isFalse(c0.decorated);
- });
-
- test('insertNewBefore', function() {
- var c0 = createChild();
- var c1 = createChild();
- var container = new SimpleContainer();
- container.appendChild(c1);
- container.insertBefore(c0, c1);
- assert.isTrue(c0.decorated);
- assert.isTrue(c1.decorated);
- });
-
- test('insertExistingBefore', function() {
- var c0 = createChild();
- var c1 = createChild();
- var container = new SimpleContainer();
- container.appendChild(c1);
- container.appendChild(c0);
- container.insertBefore(c0, c1);
- assert.isTrue(c0.decorated);
- assert.isTrue(c1.decorated);
- });
-
- test('testReplace', function() {
- var c0 = createChild();
- var c1 = createChild();
- var container = new SimpleContainer();
- container.appendChild(c0);
- container.replaceChild(c1, c0);
- assert.isFalse(c0.decorated);
- assert.isTrue(c1.decorated);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/d3.html b/chromium/third_party/catapult/tracing/tracing/ui/base/d3.html
deleted file mode 100644
index ed4c962a25e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/d3.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<script src="/d3.min.js"></script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/deep_utils.html b/chromium/third_party/catapult/tracing/tracing/ui/base/deep_utils.html
deleted file mode 100644
index 6476dee1af1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/deep_utils.html
+++ /dev/null
@@ -1,84 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-
-'use strict';
-
-tr.exportTo('tr.b', function() {
- function _iterateElementDeeplyImpl(element, cb, thisArg, includeElement) {
- if (includeElement) {
- if (cb.call(thisArg, element))
- return true;
- }
-
- if (element.shadowRoot) {
- if (_iterateElementDeeplyImpl(element.shadowRoot, cb, thisArg, false))
- return true;
- }
- for (var i = 0; i < element.children.length; i++) {
- if (_iterateElementDeeplyImpl(element.children[i], cb, thisArg, true))
- return true;
- }
- }
- function iterateElementDeeply(element, cb, thisArg) {
- _iterateElementDeeplyImpl(element, cb, thisArg, false);
- }
-
- function findDeepElementMatchingPredicate(element, predicate) {
- var foundElement = undefined;
- function matches(element) {
- var match = predicate(element);
- if (!match)
- return false;
- foundElement = element;
- return true;
- }
- iterateElementDeeply(element, matches);
- return foundElement;
- }
-
- function findDeepElementsMatchingPredicate(element, predicate) {
- var foundElements = [];
- function matches(element) {
- var match = predicate(element);
- if (match) {
- foundElements.push(element);
- }
- return false;
- }
- iterateElementDeeply(element, matches);
- return foundElements;
- }
-
- function findDeepElementMatching(element, selector) {
- return findDeepElementMatchingPredicate(element, function(element) {
- return element.matches(selector);
- });
- }
- function findDeepElementsMatching(element, selector) {
- return findDeepElementsMatchingPredicate(element, function(element) {
- return element.matches(selector);
- });
- }
- function findDeepElementWithTextContent(element, re) {
- return findDeepElementMatchingPredicate(element, function(element) {
- if (element.children.length !== 0)
- return false;
- return re.test(element.textContent);
- });
- }
- return {
- iterateElementDeeply: iterateElementDeeply,
- findDeepElementMatching: findDeepElementMatching,
- findDeepElementsMatching: findDeepElementsMatching,
- findDeepElementMatchingPredicate: findDeepElementMatchingPredicate,
- findDeepElementsMatchingPredicate: findDeepElementsMatchingPredicate,
- findDeepElementWithTextContent: findDeepElementWithTextContent
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/deep_utils_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/deep_utils_test.html
deleted file mode 100644
index fa0d843e106..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/deep_utils_test.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/deep_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function createElement(tagName, opt_class) {
- var el = document.createElement(tagName);
- if (opt_class)
- el.className = opt_class;
- return el;
- }
-
- test('testFindDeepElementMatching', function() {
- var a = createElement('a');
- var a_ = a.createShadowRoot();
-
- var b = createElement('b');
- a_.appendChild(b);
-
- var b_ = b.createShadowRoot();
- b_.appendChild(createElement('c', 'x'));
-
- var m = tr.b.findDeepElementMatching(a, 'c.x');
- assert.equal(m, b_.children[0]);
- });
-
- test('testFindDeepElementsMatching', function() {
- var a = createElement('a');
- var a_ = a.createShadowRoot();
-
- var b = createElement('b');
- a_.appendChild(b);
-
- var b_ = b.createShadowRoot();
- b_.appendChild(createElement('c', 'x'));
- b_.appendChild(createElement('c', 'x'));
-
- var m = tr.b.findDeepElementsMatching(a, 'c.x');
- assert.equal(m[0], b_.children[0]);
- assert.equal(m[1], b_.children[1]);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/dom_helpers.html b/chromium/third_party/catapult/tracing/tracing/ui/base/dom_helpers.html
deleted file mode 100644
index 02af70a52fc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/dom_helpers.html
+++ /dev/null
@@ -1,337 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/settings.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<style>
-* /deep/ .labeled-checkbox {
- display: flex;
- white-space: nowrap;
-}
-</style>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
-
- function createSpan(opt_dictionary) {
- var ownerDocument = document;
- if (opt_dictionary && opt_dictionary.ownerDocument)
- ownerDocument = opt_dictionary.ownerDocument;
- var spanEl = ownerDocument.createElement('span');
- if (opt_dictionary) {
- if (opt_dictionary.className)
- spanEl.className = opt_dictionary.className;
- if (opt_dictionary.textContent)
- spanEl.textContent = opt_dictionary.textContent;
- if (opt_dictionary.tooltip)
- spanEl.title = opt_dictionary.tooltip;
- if (opt_dictionary.parent)
- opt_dictionary.parent.appendChild(spanEl);
- if (opt_dictionary.bold)
- spanEl.style.fontWeight = 'bold';
- if (opt_dictionary.italic)
- spanEl.style.fontStyle = 'italic';
- if (opt_dictionary.marginLeft)
- spanEl.style.marginLeft = opt_dictionary.marginLeft;
- if (opt_dictionary.marginRight)
- spanEl.style.marginRight = opt_dictionary.marginRight;
- if (opt_dictionary.backgroundColor)
- spanEl.style.backgroundColor = opt_dictionary.backgroundColor;
- if (opt_dictionary.color)
- spanEl.style.color = opt_dictionary.color;
- }
- return spanEl;
- };
-
- function createDiv(opt_dictionary) {
- var divEl = document.createElement('div');
- if (opt_dictionary) {
- if (opt_dictionary.className)
- divEl.className = opt_dictionary.className;
- if (opt_dictionary.parent)
- opt_dictionary.parent.appendChild(divEl);
- if (opt_dictionary.textContent)
- divEl.textContent = opt_dictionary.textContent;
- if (opt_dictionary.maxWidth)
- divEl.style.maxWidth = opt_dictionary.maxWidth;
- }
- return divEl;
- };
-
- function createScopedStyle(styleContent) {
- var styleEl = document.createElement('style');
- styleEl.scoped = true;
- styleEl.innerHTML = styleContent;
- return styleEl;
- }
-
- function valuesEqual(a, b) {
- if (a instanceof Array && b instanceof Array)
- return a.length === b.length && JSON.stringify(a) === JSON.stringify(b);
- return a === b;
- }
-
- function createSelector(
- targetEl, targetElProperty,
- settingsKey, defaultValue,
- items, opt_namespace) {
- var defaultValueIndex;
- for (var i = 0; i < items.length; i++) {
- var item = items[i];
- if (valuesEqual(item.value, defaultValue)) {
- defaultValueIndex = i;
- break;
- }
- }
- if (defaultValueIndex === undefined)
- throw new Error('defaultValue must be in the items list');
-
- var selectorEl = document.createElement('select');
- selectorEl.addEventListener('change', onChange);
- for (var i = 0; i < items.length; i++) {
- var item = items[i];
- var optionEl = document.createElement('option');
- optionEl.textContent = item.label;
- optionEl.targetPropertyValue = item.value;
- optionEl.item = item;
- selectorEl.appendChild(optionEl);
- }
- function onChange(e) {
- var value = selectorEl.selectedOptions[0].targetPropertyValue;
- tr.b.Settings.set(settingsKey, value, opt_namespace);
- targetEl[targetElProperty] = value;
- }
- var oldSetter = targetEl.__lookupSetter__('selectedIndex');
- selectorEl.__defineGetter__('selectedValue', function(v) {
- return selectorEl.children[selectorEl.selectedIndex].targetPropertyValue;
- });
- selectorEl.__defineGetter__('selectedItem', function(v) {
- return selectorEl.children[selectorEl.selectedIndex].item;
- });
- selectorEl.__defineSetter__('selectedValue', function(v) {
- for (var i = 0; i < selectorEl.children.length; i++) {
- var value = selectorEl.children[i].targetPropertyValue;
- if (valuesEqual(value, v)) {
- var changed = selectorEl.selectedIndex != i;
- if (changed) {
- selectorEl.selectedIndex = i;
- onChange();
- }
- return;
- }
- }
- throw new Error('Not a valid value');
- });
-
- var initialValue = tr.b.Settings.get(
- settingsKey, defaultValue, opt_namespace);
- var didSet = false;
- for (var i = 0; i < selectorEl.children.length; i++) {
- if (valuesEqual(selectorEl.children[i].targetPropertyValue,
- initialValue)) {
- didSet = true;
- targetEl[targetElProperty] = initialValue;
- selectorEl.selectedIndex = i;
- break;
- }
- }
- if (!didSet) {
- selectorEl.selectedIndex = defaultValueIndex;
- targetEl[targetElProperty] = defaultValue;
- }
-
- return selectorEl;
- }
-
- function createEditCategorySpan(optionGroupEl, targetEl) {
- var spanEl = createSpan({className: 'edit-categories'});
- spanEl.textContent = 'Edit categories';
- spanEl.classList.add('labeled-option');
-
- spanEl.addEventListener('click', function() {
- targetEl.onClickEditCategories();
- });
- return spanEl;
- }
-
- function createOptionGroup(targetEl, targetElProperty,
- settingsKey, defaultValue,
- items) {
- function onChange() {
- var value = [];
- if (this.value.length)
- value = this.value.split(',');
- tr.b.Settings.set(settingsKey, value);
- targetEl[targetElProperty] = value;
- }
-
- var optionGroupEl = createSpan({className: 'labeled-option-group'});
- var initialValue = tr.b.Settings.get(settingsKey, defaultValue);
- for (var i = 0; i < items.length; ++i) {
- var item = items[i];
- var id = 'category-preset-' + item.label.replace(/ /g, '-');
-
- var radioEl = document.createElement('input');
- radioEl.type = 'radio';
- radioEl.setAttribute('id', id);
- radioEl.setAttribute('name', 'category-presets-group');
- radioEl.setAttribute('value', item.value);
- radioEl.addEventListener('change', onChange.bind(radioEl, targetEl,
- targetElProperty,
- settingsKey));
- if (valuesEqual(initialValue, item.value))
- radioEl.checked = true;
-
- var labelEl = document.createElement('label');
- labelEl.textContent = item.label;
- labelEl.setAttribute('for', id);
-
- var spanEl = createSpan({className: 'labeled-option'});
- spanEl.appendChild(radioEl);
- spanEl.appendChild(labelEl);
-
- spanEl.__defineSetter__('checked', function(opt_bool) {
- var changed = radioEl.checked !== (!!opt_bool);
- if (!changed)
- return;
-
- radioEl.checked = !!opt_bool;
- onChange();
- });
- spanEl.__defineGetter__('checked', function() {
- return radioEl.checked;
- });
-
- optionGroupEl.appendChild(spanEl);
- }
- optionGroupEl.appendChild(createEditCategorySpan(optionGroupEl, targetEl));
- // Since this option group element is not yet added to the tree,
- // querySelector will fail during updateEditCategoriesStatus_ call.
- // Hence, creating the element with the 'expanded' classlist category
- // added, if last selected value was 'Manual' selection.
- if (!initialValue.length)
- optionGroupEl.classList.add('categories-expanded');
- targetEl[targetElProperty] = initialValue;
-
- return optionGroupEl;
- }
-
- var nextCheckboxId = 1;
- function createCheckBox(targetEl, targetElProperty,
- settingsKey, defaultValue,
- label, opt_changeCb) {
- var buttonEl = document.createElement('input');
- buttonEl.type = 'checkbox';
-
- var initialValue = tr.b.Settings.get(settingsKey, defaultValue);
- buttonEl.checked = !!initialValue;
- if (targetEl)
- targetEl[targetElProperty] = initialValue;
-
- function onChange() {
- tr.b.Settings.set(settingsKey, buttonEl.checked);
- if (targetEl)
- targetEl[targetElProperty] = buttonEl.checked;
- if (opt_changeCb)
- opt_changeCb.call();
- }
-
- buttonEl.addEventListener('change', onChange);
-
- var id = '#checkbox-' + nextCheckboxId++;
-
- var spanEl = createSpan({className: 'labeled-checkbox'});
- buttonEl.setAttribute('id', id);
-
- var labelEl = document.createElement('label');
- labelEl.textContent = label;
- labelEl.setAttribute('for', id);
- spanEl.appendChild(buttonEl);
- spanEl.appendChild(labelEl);
-
- spanEl.__defineSetter__('checked', function(opt_bool) {
- var changed = buttonEl.checked !== (!!opt_bool);
- if (!changed)
- return;
-
- buttonEl.checked = !!opt_bool;
- onChange();
- });
- spanEl.__defineGetter__('checked', function() {
- return buttonEl.checked;
- });
-
- return spanEl;
- }
-
- /**
- * @param {!string} label
- * @param {function()=} opt_callback
- * @param {*=} opt_this
- */
- function createButton(label, opt_callback, opt_this) {
- var buttonEl = document.createElement('input');
- buttonEl.type = 'button';
- buttonEl.value = label;
-
- function onClick() {
- opt_callback.call(opt_this || buttonEl);
- }
-
- if (opt_callback)
- buttonEl.addEventListener('click', onClick);
-
- return buttonEl;
- }
-
- function createTextInput(
- targetEl, targetElProperty, settingsKey, defaultValue) {
- var initialValue = tr.b.Settings.get(settingsKey, defaultValue);
- var el = document.createElement('input');
- el.type = 'text';
- function onChange(e) {
- tr.b.Settings.set(settingsKey, el.value);
- targetEl[targetElProperty] = el.value;
- }
- el.addEventListener('input', onChange);
- el.value = initialValue;
- targetEl[targetElProperty] = initialValue;
-
- return el;
- }
-
- function isElementAttachedToDocument(el) {
- var cur = el;
- while (cur.parentNode)
- cur = cur.parentNode;
- return (cur === el.ownerDocument || cur.nodeName === '#document-fragment');
- }
-
- function asHTMLOrTextNode(value, opt_ownerDocument) {
- if (value instanceof Node)
- return value;
- var ownerDocument = opt_ownerDocument || document;
- return ownerDocument.createTextNode(value);
- }
-
- return {
- createSpan: createSpan,
- createDiv: createDiv,
- createScopedStyle: createScopedStyle,
- createSelector: createSelector,
- createOptionGroup: createOptionGroup,
- createCheckBox: createCheckBox,
- createButton: createButton,
- createTextInput: createTextInput,
- isElementAttachedToDocument: isElementAttachedToDocument,
- asHTMLOrTextNode: asHTMLOrTextNode
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/dom_helpers_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/dom_helpers_test.html
deleted file mode 100644
index 64ba68ba36f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/dom_helpers_test.html
+++ /dev/null
@@ -1,151 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var THIS_DOC = document._currentScript.ownerDocument;
-
- test('simpleSpanAndDiv', function() {
- var divEl = tr.ui.b.createDiv({
- className: 'a-div-class', parent: document.body
- });
- var testText = 'some span text';
- var spanEl = tr.ui.b.createSpan({
- className: 'a-span-class',
- textContent: testText,
- parent: divEl
- });
- var eltInDocument = document.querySelector('.a-div-class>.a-span-class');
- assert.equal(eltInDocument.textContent, testText);
- eltInDocument.parentElement.removeChild(eltInDocument);
- });
-
- test('createSpan_ownerDocument', function() {
- var spanEl = tr.ui.b.createSpan({
- className: 'a-span-class',
- bold: true,
- ownerDocument: THIS_DOC
- });
- assert.strictEqual(spanEl.ownerDocument, THIS_DOC);
- });
-
- test('checkboxFromDefaults', function() {
- var target = {foo: undefined};
- var cb = tr.ui.b.createCheckBox(target, 'foo', 'myCheckBox', false, 'Foo');
- assert.isFalse(target.foo);
- });
-
- test('checkboxFromSettings', function() {
- tr.b.Settings.set('myCheckBox', true);
- var target = {foo: undefined};
- var cb = tr.ui.b.createCheckBox(target, 'foo', 'myCheckBox', false, 'Foo');
- assert.isTrue(target.foo);
- });
-
- test('checkboxChanged', function() {
- var target = {foo: undefined};
- var cb = tr.ui.b.createCheckBox(target, 'foo', 'myCheckBox', false, 'Foo');
- cb.checked = true;
-
- assert.isTrue(tr.b.Settings.get('myCheckBox', undefined));
- assert.isTrue(target.foo);
- });
-
- test('selectorSettingsAlreaySet', function() {
- tr.b.Settings.set('myScale', 0.25);
-
- var target = {
- scale: 314
- };
- var sel = tr.ui.b.createSelector(
- target, 'scale',
- 'myScale', 0.375,
- [{label: '6.25%', value: 0.0625},
- {label: '12.5%', value: 0.125},
- {label: '25%', value: 0.25},
- {label: '37.5%', value: 0.375},
- {label: '50%', value: 0.5},
- {label: '75%', value: 0.75},
- {label: '100%', value: 1},
- {label: '200%', value: 2}
- ]);
- assert.equal(target.scale, 0.25);
- assert.equal(sel.selectedIndex, 2);
- });
-
- test('selectorSettingsDefault', function() {
- var target = {
- scale: 314
- };
- var sel = tr.ui.b.createSelector(
- target, 'scale',
- 'myScale', 0.375,
- [{label: '6.25%', value: 0.0625},
- {label: '12.5%', value: 0.125},
- {label: '25%', value: 0.25},
- {label: '37.5%', value: 0.375},
- {label: '50%', value: 0.5},
- {label: '75%', value: 0.75},
- {label: '100%', value: 1},
- {label: '200%', value: 2}
- ]);
- assert.equal(target.scale, 0.375);
- assert.equal(sel.selectedIndex, 3);
- });
-
- test('selectorSettingsChanged', function() {
- var target = {
- scale: 314
- };
- var sel = tr.ui.b.createSelector(
- target, 'scale',
- 'myScale', 0.375,
- [{label: '6.25%', value: 0.0625},
- {label: '12.5%', value: 0.125},
- {label: '25%', value: 0.25},
- {label: '37.5%', value: 0.375},
- {label: '50%', value: 0.5},
- {label: '75%', value: 0.75},
- {label: '100%', value: 1},
- {label: '200%', value: 2}
- ]);
- assert.equal(sel.selectedValue, 0.375);
- sel.selectedValue = 0.75;
- assert.equal(target.scale, 0.75);
- assert.equal(sel.selectedValue, 0.75);
- assert.equal(undefined), 0.75, tr.b.Settings.get('myScale');
- });
-
- test('asHTMLOrTextNode_string', function() {
- // Default owner document.
- var node = tr.ui.b.asHTMLOrTextNode('Hello, World!');
- assert.instanceOf(node, Node);
- assert.equal(node.textContent, 'Hello, World!');
- assert.strictEqual(node.ownerDocument, document);
-
- // Custom owner document.
- var node = tr.ui.b.asHTMLOrTextNode('Bye, World!', THIS_DOC);
- assert.instanceOf(node, Node);
- assert.equal(node.textContent, 'Bye, World!');
- assert.strictEqual(node.ownerDocument, THIS_DOC);
- });
-
- test('asHTMLOrTextNode_node', function() {
- // Node object. Owner document should NOT be modified.
- var node = document.createTextNode('Hi', THIS_DOC);
- assert.strictEqual(tr.ui.b.asHTMLOrTextNode(node), node);
- assert.strictEqual(node.ownerDocument, document);
-
- // HTMLElement object. Owner document should NOT be modified.
- var node = THIS_DOC.createElement('div');
- assert.strictEqual(tr.ui.b.asHTMLOrTextNode(node), node);
- assert.strictEqual(node.ownerDocument, THIS_DOC);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/drag_handle.html b/chromium/third_party/catapult/tracing/tracing/ui/base/drag_handle.html
deleted file mode 100644
index d919bbbad93..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/drag_handle.html
+++ /dev/null
@@ -1,184 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<polymer-element name="tr-ui-b-drag-handle">
- <template>
- <style>
- :host {
- -webkit-user-select: none;
- box-sizing: border-box;
- display: block;
- }
-
- :host(.horizontal-drag-handle) {
- background-image: -webkit-gradient(linear,
- 0 0, 0 100%,
- from(#E5E5E5),
- to(#D1D1D1));
- border-bottom: 1px solid #8e8e8e;
- border-top: 1px solid white;
- cursor: ns-resize;
- flex: 0 0 auto;
- height: 7px;
- position: relative;
- }
-
- :host(.vertical-drag-handle) {
- background-image: -webkit-gradient(linear,
- 0 0, 100% 0,
- from(#E5E5E5),
- to(#D1D1D1));
- border-left: 1px solid white;
- border-right: 1px solid #8e8e8e;
- cursor: ew-resize;
- flex: 0 0 auto;
- position: relative;
- width: 7px;
- }
- </style>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- __proto__: HTMLDivElement.prototype,
-
- created: function() {
- this.lastMousePos_ = 0;
- this.onMouseMove_ = this.onMouseMove_.bind(this);
- this.onMouseUp_ = this.onMouseUp_.bind(this);
- this.addEventListener('mousedown', this.onMouseDown_);
- this.target_ = undefined;
- this.horizontal = true;
- this.observer_ = new WebKitMutationObserver(
- this.didTargetMutate_.bind(this));
- this.targetSizesByModeKey_ = {};
- },
-
- get modeKey_() {
- return this.target_.className == '' ? '.' : this.target_.className;
- },
-
- get target() {
- return this.target_;
- },
-
- set target(target) {
- this.observer_.disconnect();
- this.target_ = target;
- if (!this.target_)
- return;
- this.observer_.observe(this.target_, {
- attributes: true,
- attributeFilter: ['class']
- });
- },
-
- get horizontal() {
- return this.horizontal_;
- },
-
- set horizontal(h) {
- this.horizontal_ = h;
- if (this.horizontal_)
- this.className = 'horizontal-drag-handle';
- else
- this.className = 'vertical-drag-handle';
- },
-
- get vertical() {
- return !this.horizontal_;
- },
-
- set vertical(v) {
- this.horizontal = !v;
- },
-
- forceMutationObserverFlush_: function() {
- var records = this.observer_.takeRecords();
- if (records.length)
- this.didTargetMutate_(records);
- },
-
- didTargetMutate_: function(e) {
- var modeSize = this.targetSizesByModeKey_[this.modeKey_];
- if (modeSize !== undefined) {
- this.setTargetSize_(modeSize);
- return;
- }
-
- // If we hadn't previously sized the target, then just remove any manual
- // sizing that we applied.
- this.target_.style[this.targetStyleKey_] = '';
- },
-
- get targetStyleKey_() {
- return this.horizontal_ ? 'height' : 'width';
- },
-
- getTargetSize_: function() {
- // If style is not set, start off with computed height.
- var targetStyleKey = this.targetStyleKey_;
- if (!this.target_.style[targetStyleKey]) {
- this.target_.style[targetStyleKey] =
- window.getComputedStyle(this.target_)[targetStyleKey];
- }
- var size = parseInt(this.target_.style[targetStyleKey]);
- this.targetSizesByModeKey_[this.modeKey_] = size;
- return size;
- },
-
- setTargetSize_: function(s) {
- this.target_.style[this.targetStyleKey_] = s + 'px';
- this.targetSizesByModeKey_[this.modeKey_] = s;
- },
-
- applyDelta_: function(delta) {
- // Apply new size to the container.
- var curSize = this.getTargetSize_();
- var newSize;
- if (this.target_ === this.nextElementSibling) {
- newSize = curSize + delta;
- } else {
- newSize = curSize - delta;
- }
- this.setTargetSize_(newSize);
- },
-
- onMouseMove_: function(e) {
- // Compute the difference in height position.
- var curMousePos = this.horizontal_ ? e.clientY : e.clientX;
- var delta = this.lastMousePos_ - curMousePos;
-
- this.applyDelta_(delta);
-
- this.lastMousePos_ = curMousePos;
- e.preventDefault();
- return true;
- },
-
- onMouseDown_: function(e) {
- if (!this.target_)
- return;
- this.forceMutationObserverFlush_();
- this.lastMousePos_ = this.horizontal_ ? e.clientY : e.clientX;
- document.addEventListener('mousemove', this.onMouseMove_);
- document.addEventListener('mouseup', this.onMouseUp_);
- e.preventDefault();
- return true;
- },
-
- onMouseUp_: function(e) {
- document.removeEventListener('mousemove', this.onMouseMove_);
- document.removeEventListener('mouseup', this.onMouseUp_);
- e.preventDefault();
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/drag_handle_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/drag_handle_test.html
deleted file mode 100644
index bd52880503d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/drag_handle_test.html
+++ /dev/null
@@ -1,94 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/ui/base/drag_handle.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var createDragHandle = function() {
- var el = document.createElement('div');
- el.style.border = '1px solid black';
- el.style.width = '200px';
- el.style.height = '200px';
- el.style.display = 'flex';
- el.style.flexDirection = 'column';
-
- var upperEl = document.createElement('div');
- upperEl.style.flex = '1 1 auto';
- upperEl.style.minHeight = '0';
-
- var lowerEl = document.createElement('div');
- lowerEl.style.height = '100px';
-
- var dragHandle = document.createElement('tr-ui-b-drag-handle');
- dragHandle.target = lowerEl;
-
- el.appendChild(upperEl);
- el.appendChild(dragHandle);
- el.appendChild(lowerEl);
- el.upperEl = upperEl;
- el.dragHandle = dragHandle;
- el.lowerEl = lowerEl;
-
- el.getLowerElHeight = function() {
- return parseInt(getComputedStyle(this.lowerEl).height);
- };
- return el;
- };
-
- test('instantiate', function() {
- this.addHTMLOutput(createDragHandle());
- });
-
- test('applyDelta', function() {
- var el = createDragHandle();
- this.addHTMLOutput(el);
-
- var dragHandle = el.dragHandle;
- var oldHeight = el.getLowerElHeight();
- dragHandle.applyDelta_(10);
- assert.equal(el.getLowerElHeight(), oldHeight + 10);
- });
-
- test('classNameMutation', function() {
- var el = createDragHandle();
-
- var styleEl = document.createElement('style');
- styleEl.textContent =
- '.mode-a { height: 100px; } .mode-b { height: 50px; }';
- document.head.appendChild(styleEl);
-
- this.addHTMLOutput(el);
-
- try {
- var dragHandle = el.dragHandle;
- el.lowerEl.className = 'mode-a';
- assert.equal(el.getLowerElHeight(), 100);
-
- dragHandle.applyDelta_(10);
- assert.equal(el.getLowerElHeight(), 110);
-
- // Change the class, which should restore the layout
- // to the default sizing for mode-b
- el.lowerEl.className = 'mode-b';
- dragHandle.forceMutationObserverFlush_();
- assert.equal(el.getLowerElHeight(), 50);
-
- dragHandle.applyDelta_(10);
- assert.equal(el.getLowerElHeight(), 60);
-
- // Restore the class-a, which should restore the layout
- // to sizing when we were changed.
- el.lowerEl.className = 'mode-a';
- dragHandle.forceMutationObserverFlush_();
- assert.equal(el.getLowerElHeight(), 110);
- } finally {
- document.head.removeChild(styleEl);
- }
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/draw_helpers.html b/chromium/third_party/catapult/tracing/tracing/ui/base/draw_helpers.html
deleted file mode 100644
index 981f16da3e6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/draw_helpers.html
+++ /dev/null
@@ -1,419 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/event_presenter.html">
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/ui/base/elided_cache.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides various helper methods for drawing to a provided
- * canvas.
- */
-tr.exportTo('tr.ui.b', function() {
- var elidedTitleCache = new tr.ui.b.ElidedTitleCache();
- var ColorScheme = tr.b.ColorScheme;
- var colorsAsStrings = ColorScheme.colorsAsStrings;
-
- var EventPresenter = tr.ui.b.EventPresenter;
- var blackColorId = ColorScheme.getColorIdForReservedName('black');
-
- /**
- * This value is used to allow for consistent style UI elements.
- * Thread time visualisation uses a smaller rectangle that has this height.
- * @const
- */
- var THIN_SLICE_HEIGHT = 4;
-
- /**
- * This value is used to for performance considerations when drawing large
- * zoomed out traces that feature cpu time in the slices. If the waiting
- * width is less than the threshold, we only draw the rectangle as a solid.
- * @const
- */
- var SLICE_WAITING_WIDTH_DRAW_THRESHOLD = 3;
-
- /**
- * If the slice has mostly been waiting to be scheduled on the cpu, the
- * wall clock will be far greater than the cpu clock. Draw the slice
- * only as an idle slice, if the active width is not thicker than the
- * threshold.
- * @const
- */
- var SLICE_ACTIVE_WIDTH_DRAW_THRESHOLD = 1;
-
- /**
- * Should we elide text on trace labels?
- * Without eliding, text that is too wide isn't drawn at all.
- * Disable if you feel this causes a performance problem.
- * This is a default value that can be overridden in tracks for testing.
- * @const
- */
- var SHOULD_ELIDE_TEXT = true;
-
- /**
- * Draw the define line into |ctx|.
- *
- * @param {Context} ctx The context to draw into.
- * @param {float} x1 The start x position of the line.
- * @param {float} y1 The start y position of the line.
- * @param {float} x2 The end x position of the line.
- * @param {float} y2 The end y position of the line.
- */
- function drawLine(ctx, x1, y1, x2, y2) {
- ctx.moveTo(x1, y1);
- ctx.lineTo(x2, y2);
- }
-
- /**
- * Draw the defined triangle into |ctx|.
- *
- * @param {Context} ctx The context to draw into.
- * @param {float} x1 The first corner x.
- * @param {float} y1 The first corner y.
- * @param {float} x2 The second corner x.
- * @param {float} y2 The second corner y.
- * @param {float} x3 The third corner x.
- * @param {float} y3 The third corner y.
- */
- function drawTriangle(ctx, x1, y1, x2, y2, x3, y3) {
- ctx.beginPath();
- ctx.moveTo(x1, y1);
- ctx.lineTo(x2, y2);
- ctx.lineTo(x3, y3);
- ctx.closePath();
- }
-
- /**
- * Draw an arrow into |ctx|.
- *
- * @param {Context} ctx The context to draw into.
- * @param {float} x1 The shaft x.
- * @param {float} y1 The shaft y.
- * @param {float} x2 The head x.
- * @param {float} y2 The head y.
- * @param {float} arrowLength The length of the head.
- * @param {float} arrowWidth The width of the head.
- */
- function drawArrow(ctx, x1, y1, x2, y2, arrowLength, arrowWidth) {
- var dx = x2 - x1;
- var dy = y2 - y1;
- var len = Math.sqrt(dx * dx + dy * dy);
- var perc = (len - arrowLength) / len;
- var bx = x1 + perc * dx;
- var by = y1 + perc * dy;
- var ux = dx / len;
- var uy = dy / len;
- var ax = uy * arrowWidth;
- var ay = -ux * arrowWidth;
-
- ctx.beginPath();
- drawLine(ctx, x1, y1, x2, y2);
- ctx.stroke();
-
- drawTriangle(ctx,
- bx + ax, by + ay,
- x2, y2,
- bx - ax, by - ay);
- ctx.fill();
- }
-
- /**
- * Draw the provided slices to the screen.
- *
- * Each of the elements in |slices| must provide the follow methods:
- * * start
- * * duration
- * * colorId
- * * selected
- *
- * @param {Context} ctx The canvas context.
- * @param {TimelineDrawTransform} dt The draw transform.
- * @param {float} viewLWorld The left most point of the world viewport.
- * @param {float} viewRWorld The right most point of the world viewport.
- * @param {float} viewHeight The height of the viewport.
- * @param {Array} slices The slices to draw.
- * @param {bool} async Whether the slices are drawn with async style.
- */
- function drawSlices(ctx, dt, viewLWorld, viewRWorld, viewHeight, slices,
- async) {
- var pixelRatio = window.devicePixelRatio || 1;
- var pixWidth = dt.xViewVectorToWorld(1);
- var height = viewHeight * pixelRatio;
-
- var darkRectHeight = THIN_SLICE_HEIGHT * pixelRatio;
-
- // Not enough space for both colors, use light color only.
- if (height < darkRectHeight)
- darkRectHeight = 0;
-
- var lightRectHeight = height - darkRectHeight;
-
- // Begin rendering in world space.
- ctx.save();
- dt.applyTransformToCanvas(ctx);
-
- var rect = new tr.ui.b.FastRectRenderer(
- ctx, 2 * pixWidth, 2 * pixWidth, colorsAsStrings);
- rect.setYandH(0, height);
-
- var lowSlice = tr.b.findLowIndexInSortedArray(
- slices,
- function(slice) { return slice.start + slice.duration; },
- viewLWorld);
-
- var hadTopLevel = false;
-
- for (var i = lowSlice; i < slices.length; ++i) {
- var slice = slices[i];
- var x = slice.start;
- if (x > viewRWorld)
- break;
-
- var w = pixWidth;
- if (slice.duration > 0) {
- w = Math.max(slice.duration, 0.000001);
- if (w < pixWidth)
- w = pixWidth;
- }
-
- var colorId = EventPresenter.getSliceColorId(slice);
- var alpha = EventPresenter.getSliceAlpha(slice, async);
- var lightAlpha = alpha * 0.70;
-
- if (async && slice.isTopLevel) {
- rect.setYandH(3, height - 3);
- hadTopLevel = true;
- } else {
- rect.setYandH(0, height);
- }
-
- // If cpuDuration is available, draw rectangles proportional to the
- // amount of cpu time taken.
- if (!slice.cpuDuration) {
- // No cpuDuration available, draw using only one alpha.
- rect.fillRect(x, w, colorId, alpha);
- continue;
- }
-
- var activeWidth = w * (slice.cpuDuration / slice.duration);
- var waitingWidth = w - activeWidth;
-
- // Check if we have enough screen space to draw the whole slice, with
- // both color tones.
- //
- // Truncate the activeWidth to 0 if it is less than 'threshold' pixels.
- if (activeWidth < SLICE_ACTIVE_WIDTH_DRAW_THRESHOLD * pixWidth) {
- activeWidth = 0;
- waitingWidth = w;
- }
-
- // Truncate the waitingWidth to 0 if it is less than 'threshold' pixels.
- if (waitingWidth < SLICE_WAITING_WIDTH_DRAW_THRESHOLD * pixWidth) {
- activeWidth = w;
- waitingWidth = 0;
- }
-
- // We now draw the two rectangles making up the event slice.
- // NOTE: The if statements are necessary for performance considerations.
- // We do not want to force draws, if the width of the rectangle is 0.
- //
- // First draw the solid color, representing the 'active' part.
- if (activeWidth > 0) {
- rect.fillRect(x, activeWidth, colorId, alpha);
- }
-
- // Next draw the two toned 'idle' part.
- // NOTE: Substracting pixWidth and drawing one extra pixel is done to
- // prevent drawing artifacts. Without it, the two parts of the slice,
- // ('active' and 'idle') may appear split apart.
- if (waitingWidth > 0) {
- // First draw the light toned top part.
- rect.setYandH(0, lightRectHeight);
- rect.fillRect(x + activeWidth - pixWidth,
- waitingWidth + pixWidth, colorId, lightAlpha);
- // Then the solid bottom half.
- rect.setYandH(lightRectHeight, darkRectHeight);
- rect.fillRect(x + activeWidth - pixWidth,
- waitingWidth + pixWidth, colorId, alpha);
- // Reset for the next slice.
- rect.setYandH(0, height);
- }
- }
- rect.flush();
-
- if (async && hadTopLevel) {
- // Draw a top border over async slices in order to visually separate
- // them from events above it.
- // See https://github.com/google/trace-viewer/issues/725.
- rect.setYandH(2, 1);
- for (var i = lowSlice; i < slices.length; ++i) {
- var slice = slices[i];
- var x = slice.start;
- if (x > viewRWorld)
- break;
-
- if (!slice.isTopLevel)
- continue;
-
- var w = pixWidth;
- if (slice.duration > 0) {
- w = Math.max(slice.duration, 0.000001);
- if (w < pixWidth)
- w = pixWidth;
- }
-
- rect.fillRect(x, w, blackColorId, 0.7);
- }
- rect.flush();
- }
-
- ctx.restore();
- }
-
- /**
- * Draw the provided instant slices as lines to the screen.
- *
- * Each of the elements in |slices| must provide the follow methods:
- * * start
- * * duration with value of 0.
- * * colorId
- * * selected
- *
- * @param {Context} ctx The canvas context.
- * @param {TimelineDrawTransform} dt The draw transform.
- * @param {float} viewLWorld The left most point of the world viewport.
- * @param {float} viewRWorld The right most point of the world viewport.
- * @param {float} viewHeight The height of the viewport.
- * @param {Array} slices The slices to draw.
- * @param {Numer} lineWidthInPixels The width of the lines.
- */
- function drawInstantSlicesAsLines(
- ctx, dt, viewLWorld, viewRWorld, viewHeight, slices, lineWidthInPixels) {
- var pixelRatio = window.devicePixelRatio || 1;
- var height = viewHeight * pixelRatio;
-
- var pixWidth = dt.xViewVectorToWorld(1);
-
- // Begin rendering in world space.
- ctx.save();
- ctx.lineWidth = pixWidth * lineWidthInPixels * pixelRatio;
- dt.applyTransformToCanvas(ctx);
- ctx.beginPath();
-
- var lowSlice = tr.b.findLowIndexInSortedArray(
- slices,
- function(slice) { return slice.start; },
- viewLWorld);
-
- for (var i = lowSlice; i < slices.length; ++i) {
- var slice = slices[i];
- var x = slice.start;
- if (x > viewRWorld)
- break;
-
- ctx.strokeStyle = EventPresenter.getInstantSliceColor(slice);
-
- ctx.beginPath();
- ctx.moveTo(x, 0);
- ctx.lineTo(x, height);
- ctx.stroke();
- }
- ctx.restore();
- }
-
- /**
- * Draws the labels for the given slices.
- *
- * The |slices| array must contain objects with the following API:
- * * start
- * * duration
- * * title
- * * didNotFinish (optional)
- *
- * @param {Context} ctx The graphics context.
- * @param {TimelineDrawTransform} dt The draw transform.
- * @param {float} viewLWorld The left most point of the world viewport.
- * @param {float} viewRWorld The right most point of the world viewport.
- * @param {Array} slices The slices to label.
- * @param {bool} async Whether the slice labels are drawn with async style.
- * @param {float} fontSize The font size.
- * @param {float} yOffset The font offset.
- */
- function drawLabels(ctx, dt, viewLWorld, viewRWorld, slices, async,
- fontSize, yOffset) {
- var pixelRatio = window.devicePixelRatio || 1;
- var pixWidth = dt.xViewVectorToWorld(1);
-
- ctx.save();
-
- ctx.textAlign = 'center';
- ctx.textBaseline = 'top';
- ctx.font = (fontSize * pixelRatio) + 'px sans-serif';
-
- if (async)
- ctx.font = 'italic ' + ctx.font;
-
- var cY = yOffset * pixelRatio;
-
- var lowSlice = tr.b.findLowIndexInSortedArray(
- slices,
- function(slice) { return slice.start + slice.duration; },
- viewLWorld);
-
- // Don't render text until until it is 20px wide
- var quickDiscardThresshold = pixWidth * 20;
- for (var i = lowSlice; i < slices.length; ++i) {
- var slice = slices[i];
- if (slice.start > viewRWorld)
- break;
-
- if (slice.duration <= quickDiscardThresshold)
- continue;
-
- var title = slice.title +
- (slice.didNotFinish ? ' (Did Not Finish)' : '');
-
- var drawnTitle = title;
- var drawnWidth = elidedTitleCache.labelWidth(ctx, drawnTitle);
- var fullLabelWidth = elidedTitleCache.labelWidthWorld(
- ctx, drawnTitle, pixWidth);
- if (SHOULD_ELIDE_TEXT && fullLabelWidth > slice.duration) {
- var elidedValues = elidedTitleCache.get(
- ctx, pixWidth,
- drawnTitle, drawnWidth,
- slice.duration);
- drawnTitle = elidedValues.string;
- drawnWidth = elidedValues.width;
- }
-
- if (drawnWidth * pixWidth < slice.duration) {
- ctx.fillStyle = EventPresenter.getTextColor(slice);
- var cX = dt.xWorldToView(slice.start + 0.5 * slice.duration);
- ctx.fillText(drawnTitle, cX, cY, drawnWidth);
- }
- }
- ctx.restore();
- }
-
- return {
- drawSlices: drawSlices,
- drawInstantSlicesAsLines: drawInstantSlicesAsLines,
- drawLabels: drawLabels,
-
- drawLine: drawLine,
- drawTriangle: drawTriangle,
- drawArrow: drawArrow,
-
- elidedTitleCache_: elidedTitleCache,
-
- THIN_SLICE_HEIGHT: THIN_SLICE_HEIGHT
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/dropdown.html b/chromium/third_party/catapult/tracing/tracing/ui/base/dropdown.html
deleted file mode 100644
index 2d0fe220eef..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/dropdown.html
+++ /dev/null
@@ -1,158 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<polymer-element name="tr-ui-b-dropdown">
- <template>
- <style>
- :host {
- position: relative;
- display: flex;
- }
- #outer {
- display: flex;
- flex: 0 0 auto;
- padding: 1px 4px 1px 4px;
- -webkit-user-select: none;
- cursor: default;
- }
-
- #state {
- display: flex;
- flex: 0 0 auto;
- margin-left: 2px;
- margin-right: 0px;
- flex: 0 0 auto;
- }
-
- #icon {
- display: flex;
- flex: 0 0 auto;
- flex: 0 0 auto;
- }
- dialog {
- position: absolute;
- padding: 0;
- border: 0;
- margin: 0;
- }
- dialog::backdrop {
- background: rgba(0,0,0,.05);
- }
-
- #dialog-frame {
- background-color: #fff;
- display: flex;
- flex-direction: column;
- flex: 1 1 auto;
- padding: 6px;
- border: 1px solid black;
- -webkit-user-select: none;
- cursor: default;
- }
- </style>
- <tr-ui-b-toolbar-button id="outer"
- on-keydown="{{ onOuterKeyDown_ }}"
- on-click="{{ onOuterClick_ }}">
- <div id="icon">&#9881;</div>
- <div id="state">&#9662;</div>
- </tr-ui-b-toolbar-button>
- <dialog id="dialog"
- on-click="{{ onDialogClick_ }}"
- on-cancel="{{ onDialogCancel_ }}">
- <div id="dialog-frame">
- <content></content>
- </div>
- </dialog>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.$.outer.tabIndex = 0;
- },
-
- get iconElement() {
- return this.$.icon;
- },
-
- onOuterKeyDown_: function(e) {
- if (e.keyCode === ' '.charCodeAt(0)) {
- this.toggle_();
- e.preventDefault();
- e.stopPropagation();
- }
- },
-
- onOuterClick_: function(e) {
- var or = this.$.outer.getBoundingClientRect();
- var inside = true;
- inside &= e.clientX >= or.left;
- inside &= e.clientX < or.right;
- inside &= e.clientY >= or.top;
- inside &= e.clientY < or.bottom;
- if (!inside)
- return;
-
- e.preventDefault();
- this.toggle_();
- },
-
- toggle_: function() {
- if (!this.isOpen)
- this.show();
- else
- this.close();
- },
-
- show: function() {
- if (this.isOpen)
- return;
-
- this.$.outer.classList.add('open');
-
- var ddr = this.$.outer.getBoundingClientRect();
- var rW = Math.max(ddr.width, 150);
- this.$.dialog.style.minWidth = rW + 'px';
- this.$.dialog.showModal();
-
- var ddw = this.$.outer.getBoundingClientRect().width;
- var w = this.$.dialog.getBoundingClientRect().width;
- this.$.dialog.style.top = ddr.bottom - 1 + 'px';
- this.$.dialog.style.left = ddr.left + 'px';
- },
-
- onDialogClick_: function(e) {
- if (!this.isOpen)
- return;
- if (e.srcElement !== this.$.dialog)
- return;
- e.preventDefault();
- this.close();
- },
-
- onDialogCancel_: function(e) {
- e.preventDefault();
- this.close();
- },
-
- close: function() {
- if (!this.isOpen)
- return;
- this.$.dialog.close();
- this.$.outer.classList.remove('open');
- this.$.outer.focus();
- },
-
- get isOpen() {
- return this.$.dialog.hasAttribute('open');
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/dropdown_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/dropdown_test.html
deleted file mode 100644
index 8801a927a1f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/dropdown_test.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/dropdown.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('basic', function() {
- var dd = document.createElement('tr-ui-b-dropdown');
- dd.style.marginLeft = '50px';
- dd.style.width = '50px';
- dd.iconElement.textContent = 'Settings ' + String.fromCharCode(0x2699);
-
- dd.appendChild(tr.ui.b.createDiv({textContent: 'item 1'}));
- dd.appendChild(tr.ui.b.createDiv({textContent: 'item 2 longer'}));
- dd.appendChild(tr.ui.b.createDiv({textContent: 'item 3'}));
-
- var container = tr.ui.b.createDiv();
- container.style.height = '100px';
- container.appendChild(dd);
- container.appendChild(tr.ui.b.createDiv({textContent: 'some text'}));
- container.appendChild(tr.ui.b.createDiv({textContent: 'some more text'}));
- container.appendChild(tr.ui.b.createDiv({textContent: 'more text'}));
- this.addHTMLOutput(container);
-
- dd.show();
- dd.close();
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/elided_cache.html b/chromium/third_party/catapult/tracing/tracing/ui/base/elided_cache.html
deleted file mode 100644
index 7019f9807da..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/elided_cache.html
+++ /dev/null
@@ -1,113 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides a caching layer for elided text values.
- */
-tr.exportTo('tr.ui.b', function() {
- /**
- * Cache for elided strings.
- * Moved from the ElidedTitleCache protoype to a "global" for speed
- * (variable reference is 100x faster).
- * key: String we wish to elide.
- * value: Another dict whose key is width
- * and value is an ElidedStringWidthPair.
- */
- var elidedTitleCacheDict = {};
- var elidedTitleCache = new ElidedTitleCache();
-
- /**
- * A cache for elided strings.
- * @constructor
- */
- function ElidedTitleCache() {
- // TODO(jrg): possibly obsoleted with the elided string cache.
- // Consider removing.
- this.textWidthMap = {};
- }
-
- ElidedTitleCache.prototype = {
- /**
- * Return elided text.
- *
- * @param {ctx} Context The graphics context.
- * @param {pixWidth} Pixel width.
- * @param {title} Original title text.
- * @param {width} Drawn width in world coords.
- * @param {sliceDuration} Where the title must fit (in world coords).
- * @return {ElidedStringWidthPair} Elided string and width.
- */
- get: function(ctx, pixWidth, title, width, sliceDuration) {
- var elidedDict = elidedTitleCacheDict[title];
- if (!elidedDict) {
- elidedDict = {};
- elidedTitleCacheDict[title] = elidedDict;
- }
-
- var elidedDictForPixWidth = elidedDict[pixWidth];
- if (!elidedDictForPixWidth) {
- elidedDict[pixWidth] = {};
- elidedDictForPixWidth = elidedDict[pixWidth];
- }
-
- var stringWidthPair = elidedDictForPixWidth[sliceDuration];
- if (stringWidthPair === undefined) {
- var newtitle = title;
- var elided = false;
- while (this.labelWidthWorld(ctx, newtitle, pixWidth) > sliceDuration) {
- if (newtitle.length * 0.75 < 1)
- break;
- newtitle = newtitle.substring(0, newtitle.length * 0.75);
- elided = true;
- }
-
- if (elided && newtitle.length > 3)
- newtitle = newtitle.substring(0, newtitle.length - 3) + '...';
-
- stringWidthPair = new ElidedStringWidthPair(
- newtitle, this.labelWidth(ctx, newtitle));
- elidedDictForPixWidth[sliceDuration] = stringWidthPair;
- }
- return stringWidthPair;
- },
-
- quickMeasureText_: function(ctx, text) {
- var w = this.textWidthMap[text];
- if (!w) {
- w = ctx.measureText(text).width;
- this.textWidthMap[text] = w;
- }
- return w;
- },
-
- labelWidth: function(ctx, title) {
- return this.quickMeasureText_(ctx, title) + 2;
- },
-
- labelWidthWorld: function(ctx, title, pixWidth) {
- return this.labelWidth(ctx, title) * pixWidth;
- }
- };
-
- /**
- * A pair representing an elided string and world-coordinate width
- * to draw it.
- * @constructor
- */
- function ElidedStringWidthPair(string, width) {
- this.string = string;
- this.width = width;
- }
-
- return {
- ElidedTitleCache: ElidedTitleCache
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/event_presenter.html b/chromium/third_party/catapult/tracing/tracing/ui/base/event_presenter.html
deleted file mode 100644
index 68497381687..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/event_presenter.html
+++ /dev/null
@@ -1,93 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/model/selection_state.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides color scheme related functions.
- */
-tr.exportTo('tr.ui.b', function() {
- var ColorScheme = tr.b.ColorScheme;
-
- var colors = ColorScheme.colors;
- var colorsAsStrings = ColorScheme.colorsAsStrings;
- var numColorsPerVariant = ColorScheme.properties.numColorsPerVariant;
-
- var SelectionState = tr.model.SelectionState;
-
- /**
- * Provides methods to get view values for events.
- */
- var EventPresenter = {
- getSelectableItemColorAsString: function(item) {
- var colorId = item.colorId + this.getColorIdOffset_(item);
- return colorsAsStrings[colorId];
- },
-
- getColorIdOffset_: function(event) {
- return event.selectionState;
- },
-
- getTextColor: function(event) {
- if (event.selectionState === SelectionState.DIMMED)
- return 'rgb(60,60,60)';
- return 'rgb(0,0,0)';
- },
-
- getSliceColorId: function(slice) {
- return slice.colorId + this.getColorIdOffset_(slice);
- },
-
- getSliceAlpha: function(slice, async) {
- var alpha = 1;
- if (async)
- alpha *= 0.3;
- return alpha;
- },
-
- getInstantSliceColor: function(instant) {
- var colorId = instant.colorId + this.getColorIdOffset_(instant);
- return colors[colorId].toStringWithAlphaOverride(1.0);
- },
-
- getObjectInstanceColor: function(instance) {
- var colorId = instance.colorId + this.getColorIdOffset_(instance);
- return colors[colorId].toStringWithAlphaOverride(0.25);
- },
-
- getObjectSnapshotColor: function(snapshot) {
- var colorId =
- snapshot.objectInstance.colorId + this.getColorIdOffset_(snapshot);
- return colors[colorId];
- },
-
- getCounterSeriesColor: function(colorId, selectionState,
- opt_alphaMultiplier) {
- var event = {selectionState: selectionState};
- var c = colors[colorId + this.getColorIdOffset_(event)];
- return c.toStringWithAlphaOverride(
- opt_alphaMultiplier !== undefined ? opt_alphaMultiplier : 1.0);
- },
-
- getBarSnapshotColor: function(snapshot, offset) {
- var colorId =
- (snapshot.objectInstance.colorId + offset) %
- numColorsPerVariant;
- colorId += this.getColorIdOffset_(snapshot);
- return colors[colorId].toStringWithAlphaOverride(1.0);
- }
- };
-
- return {
- EventPresenter: EventPresenter
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/fast_rect_renderer.html b/chromium/third_party/catapult/tracing/tracing/ui/base/fast_rect_renderer.html
deleted file mode 100644
index 1729596fc95..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/fast_rect_renderer.html
+++ /dev/null
@@ -1,134 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides a mechanism for drawing massive numbers of
- * colored rectangles into a canvas in an efficient manner, provided
- * they are drawn left to right with fixed y and height throughout.
- *
- * The basic idea used here is to fuse subpixel rectangles together so that
- * we never issue a canvas fillRect for them. It turns out Javascript can
- * do this quite efficiently, compared to asking Canvas2D to do the same.
- *
- * A few extra things are done by this class in the name of speed:
- * - Viewport culling: off-viewport rectangles are discarded.
- *
- * - The actual discarding operation is done in world space,
- * e.g. pre-transform.
- *
- * - Rather than expending compute cycles trying to figure out an average
- * color for fused rectangles from css strings, you instead draw using
- * palletized colors. The fused rect color is choosen from the rectangle with
- * the higher alpha value, if equal the max pallete index encountered.
- *
- * Make sure to flush the trackRenderer before finishing drawing in order
- * to commit any queued drawing operations.
- */
-tr.exportTo('tr.ui.b', function() {
-
- /**
- * Creates a fast rect renderer with a specific set of culling rules
- * and color pallette.
- * @param {GraphicsContext2D} ctx Canvas2D drawing context.
- * @param {number} minRectSize Only rectangles with width < minRectSize are
- * considered for merging.
- * @param {number} maxMergeDist Controls how many successive small rectangles
- * can be merged together before issuing a rectangle.
- * @param {Array} pallette The color pallete for drawing. Pallette slots
- * should map to valid Canvas fillStyle strings.
- *
- * @constructor
- */
- function FastRectRenderer(ctx, minRectSize, maxMergeDist, pallette) {
- this.ctx_ = ctx;
- this.minRectSize_ = minRectSize;
- this.maxMergeDist_ = maxMergeDist;
- this.pallette_ = pallette;
- }
-
- FastRectRenderer.prototype = {
- y_: 0,
- h_: 0,
- merging_: false,
- mergeStartX_: 0,
- mergeCurRight_: 0,
- mergedColorId_: 0,
- mergedAlpha_: 0,
-
- /**
- * Changes the y position and height for subsequent fillRect
- * calls. x and width are specifieid on the fillRect calls.
- */
- setYandH: function(y, h) {
- if (this.y_ === y &&
- this.h_ === h)
- return;
- this.flush();
- this.y_ = y;
- this.h_ = h;
- },
-
- /**
- * Fills rectangle at the specified location, if visible. If the
- * rectangle is subpixel, it will be merged with adjacent rectangles.
- * The drawing operation may not take effect until flush is called.
- * @param {number} colorId The color of this rectangle, as an index
- * in the renderer's color pallete.
- * @param {number} alpha The opacity of the rectangle as 0.0-1.0 number.
- */
- fillRect: function(x, w, colorId, alpha) {
- var r = x + w;
- if (w < this.minRectSize_) {
- if (r - this.mergeStartX_ > this.maxMergeDist_)
- this.flush();
- if (!this.merging_) {
- this.merging_ = true;
- this.mergeStartX_ = x;
- this.mergeCurRight_ = r;
- this.mergedColorId_ = colorId;
- this.mergedAlpha_ = alpha;
- } else {
- this.mergeCurRight_ = r;
-
- if (this.mergedAlpha_ < alpha ||
- (this.mergedAlpha_ === alpha && this.mergedColorId_ < colorId)) {
- this.mergedAlpha_ = alpha;
- this.mergedColorId_ = colorId;
- }
- }
- } else {
- if (this.merging_)
- this.flush();
- this.ctx_.fillStyle = this.pallette_[colorId];
- this.ctx_.globalAlpha = alpha;
- this.ctx_.fillRect(x, this.y_, w, this.h_);
- }
- },
-
- /**
- * Commits any pending fillRect operations to the underlying graphics
- * context.
- */
- flush: function() {
- if (this.merging_) {
- this.ctx_.fillStyle = this.pallette_[this.mergedColorId_];
- this.ctx_.globalAlpha = this.mergedAlpha_;
- this.ctx_.fillRect(this.mergeStartX_, this.y_,
- this.mergeCurRight_ - this.mergeStartX_, this.h_);
- this.merging_ = false;
- }
- }
- };
-
- return {
- FastRectRenderer: FastRectRenderer
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/favicons.html b/chromium/third_party/catapult/tracing/tracing/ui/base/favicons.html
deleted file mode 100644
index 66e74de6f65..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/favicons.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-tr.exportTo('tr.ui.b', function() {
- var FaviconsByHue = {
- blue: 'data:image/vndmicrosofticon;base64,AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAEAAASCwAAEgsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAjj8xAGArIgqOPzE8nUY3dqJJOJeiSTiXnUY3do4/MTxhKyIKjkAxAAAAAAAAAAAAAAAAAAAAAABQJBwAAAAAAZJBMzSoSzqlsU8+6bRQP/21UT//tVE//7RQP/2wTz3ppko6pY9AMjQAAAABTyMbAAAAAAB7e3sAAP//AKFSRE+wTz3dtVE//7VRP/+1UT//tVE//7VRP/+zUD7/sE89/7BOPf+qTDvdl0M0TwAAAABWJx4A+fn5ANjd3TnIiX7ftVA9/7VRP/+1UT//tVE//7VRP/+xTz3/rE08/6xMO/+sTDv/rE08/6dKOt+SQTM5q0w7ALO0tA3v8fGu05uR/7NMOf+0Tzz/tE88/7RPPv+uTT3/p0o7/6ZJOv+mSTr/pkk6/6ZJOv+mSjr/n0Y4rnIwKg3h4eFK9/j48N2zrP/FeGr/xnps/8Z6bP/AaUv/tlw1/7RbNf+1WzX/tFs1/7RbNf+0WzX/tFs1/7NbNPCqWy1K7e3tjPn5+f/49vX/9vLy//by8v/28vH/8bZv/+6RH//ukyP/7pMj/+6SI//ukiP/7pMj/+2SIv/qjyL/34kfjPHx8bL5+fn/+fn5//n5+f/5+fr/+fn5//W7cP/zlB3/85Yh//OWIf/zliH/85Yh//GVIf/rkR//6ZAf/+KLHrLz8/O2+fn5//n5+f/5+fn/+fn5//n5+f/1unD/85Qd//OWIf/zliH/85Yh//CUIP/mjh//44we/+OMHv/diR628vLymfn5+f/5+fn/+fn5//n5+f/5+fn/9bx0//OXI//zmCb/85gm/++VIv/hjB//3Yoe/92KHv/dih7/2IYdmfHx8Vz4+Pj3+fn5//n5+f/5+fn/+fn5//jo0//33bv/9929//bbtf/euDX/06oJ/9OrC//Tqwv/06oM98yfD1zr6+sY9/f3xvn5+f/5+fn/+fn5//n5+f/5+vv/+fv8//n7/f/3+PH/3Ms6/9O8AP/UvQD/1L0A/9K8AMbItAAY////APT09Fb4+Pjy+fn5//n5+f/5+fn/+fn5//n5+f/5+fr/9/bu/9zKOf/TuwD/1LwA/9S8APLQuABW3cQAAOzs7ADm5uYF9vb2ePn5+fT5+fn/+fn5//n5+f/5+fn/+fn6//f27v/cyTn/07sA/9S8APTRugB4w60ABcmyAAAAAAAA8PDwAOzs7Ab29vZd+Pj40vn5+fz5+fn/+fn5//n5+f/49/H/5Ndu/NjEIdLSugBdybIABsy1AAAAAAAAAAAAAAAAAADn5+cAqKioAPT09CH39/dy+Pj4tvj4+NX4+PjV+Pj4tvX063Lt6MMhOQAAAM+/RAAAAAAAAAAAAPAPAADAAwAAwAMAAIABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIABAACAAQAAwAMAAPAPAAAoAAAAIAAAAEAAAAABACAAAAAAAAAQAAASCwAAEgsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABCwUEDDgZExxWJx4tYiwiN2IsIjdWJx4tOBkTHAsFBAwAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAbDAkKZS0jMYs+MWydRjeipko6x6tMO9utTTzjrU0846tMO9umSjrHnUY3oos+MWxlLSMxGwwJCv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgZFAAPBwUHcjMoPJtFNpqsTTzhs1A+/LVRP/+2UT//tVE//7VRP/+1UT//tVE//7ZRP/+1UT//s1A+/KxNPOGbRTaacTInPA8HBQc4GRMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/yp4AUCQcGZVDNICtTjzktVE//7VRP/+1UT//tVE//7VRP/+1UT//tVE//7VRP/+1UT//tVE//7VRP/+0UT//s1A+/7JQPv+rTDvkkkEzgE8jGxn/xZoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAA////AGswJSqiSTivs1A++7VRP/+1UT//tVE//7VRP/+1UT//tVE//7VRP/+1UT//tVE//7VRP/+1UT//tFA+/7FPPf+xTz3/sU89/7FPPf+vTj37nkc3r2guJCr///8AAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwMDAP/DogB/VEwsqE09v7VRP/+1UT//tVE//7VRP/+1UT//tVE//7VRP/+1UT//tVE//7VRP/+1UT//tVE//7NQPv+vTj3/r049/69OPf+vTj3/r049/69OPf+uTjz/oUg4v20xJiz/nnsAAgEBAAAAAAAAAAAAAAAAAAAAAAD19fUAkp2fHdK2sbW5W0r/tVA+/7VRP/+1UT//tVE//7VRP/+1UT//tVE//7VRP/+1UT//tVE//7VRP/+yUD7/rU08/6xNPP+tTTz/rU08/61NPP+tTTz/rU08/61NPP+sTTz/nkY3tWAqIR2pSzsAAAAAAAAAAAAAAAAAeXl5ADY2Ngnd39+O6tbT/blbSv+1UD7/tVE//7VRP/+1UT//tVE//7VRP/+1UT//tVE//7VRP/+1UT//slA+/6xNPP+rTDv/q0w7/6tMO/+rTDv/q0w7/6tMO/+rTDv/q0w7/6tMO/+qTDv9lkM0jiUQDQlSJR0AAAAAAAAAAAD///8AxMTES/X29u3s2NX/uVtK/7VQPv+1UT//tVE//7VRP/+1UT//tVE//7VRP/+1UT//tVE//7FPPv+qTDv/qEs6/6hLOv+oSzr/qEs6/6hLOv+oSzr/qEs6/6hLOv+oSzr/qEs6/6lLOv+lSTnthDsuS/+TcgAAAAAAm5ubAHBwcA/o6Oix+vv8/+zY1P+5W0r/tVA+/7VRP/+1UT//tVE//7VRP/+1UT//tVE//7VRP/+xTz3/qEs6/6ZKOv+mSjr/pko6/6ZKOv+mSjr/pko6/6ZKOv+mSjr/pko6/6ZKOv+mSjr/pko6/6ZKOv+bRTaxSiEaD2cuJAD///8AycnJRfX19fD6+/z/69fU/7hYR/+0Tjv/tE48/7ROPP+0Tjz/tE48/7ROPP+0Tz3/r04+/6VJOv+jSDn/o0g5/6NIOf+jSDn/o0g5/6NIOf+jSDn/o0g5/6NIOf+jSDr/o0g5/6NIOf+jSDn/o0g6/6BHOfCCOS9F0FxKAAAAAALk5OSN+fn5//n6+v/y5+X/05uS/9CTiP/QlIn/0JSJ/9CUif/QlIn/0JSK/8yGb//AaDb/vWc0/71nNf+9ZzT/vWc0/71nNP+9ZjT/vWY0/71mNP+9ZjT/vGY0/7xmNP+8ZjT/vGY0/7xmNP+8ZjT/u2U0/7FiLY0AAAACk5OTFu/v78X5+fn/+fn5//n5+f/5+vr/+fn5//n5+f/5+fn/+fn5//n5+f/5+/3/99iy//KWI//ylSH/8ZUh//GVIf/xlSH/8ZUh//GVIf/xlSH/8ZUh//GVIf/xlSH/8ZUh//GVIf/xlSH/8ZUh//CUIf/vkyD/5Y0fxY1XExbDw8Mz9PT05fn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n7/f/32LL/85cj//OWIf/zliH/85Yh//OWIf/zliH/85Yh//OWIf/zliH/85Yh//OWIf/zliH/85Yh//OWIf/wlCD/7pIg/+6SIP/pjx/lunIZM9XV1VD39/f0+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fv9//fYsv/zlyP/85Yh//OWIf/zliH/85Yh//OWIf/zliH/85Yh//OWIf/zliH/85Yh//OWIf/zliH/75Mg/+uRH//qkB//6pAf/+iPH/TIfBtQ3d3dYfj4+Pn5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+/3/99iy//OXI//zliH/85Yh//OWIf/zliH/85Yh//OWIf/zliH/85Yh//OWIf/zliH/85Yh/+6TIP/ojx//548f/+ePH//njx//5o4f+c1/HGHh4eFl+Pj4+vn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n7/f/32LL/85cj//OWIf/zliH/85Yh//OWIf/zliH/85Yh//OWIf/zliH/85Yh//OWIf/tkiD/5Y0f/+SNH//ljR//5Y0f/+WNH//kjB/6zn8cZeDg4Fr4+Pj3+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fv9//fYsv/zlyP/85Yh//OWIf/zliH/85Yh//OWIf/zliH/85Yh//OWIf/zliH/65Eg/+KMHv/iix7/4ose/+KLHv/iix7/4ose/+CLHvfLfRta3NzcQvf39+/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+/3/99iy//OXI//zliH/85Yh//OWIf/zliH/85Yh//OWIf/zliH/85Yh/+qRIP/gih7/34oe/9+KHv/fih7/34oe/9+KHv/fih7/3Yge78V6GkLS0tIj9fX12fn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n7/f/32LH/85Yg//OVHv/zlR7/85Ue//OVHv/zlR7/85Ue//OVIf/pjyH/3ogf/92HH//dhx//3Ycf/92HH//dhx//3Ycf/92HH//ahh7ZunMZI56engjy8vKu+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fr7//jr2f/2ypL/9smP//bJkP/2yZD/9smQ//bJkP/2yZD/5rNI/9OeFP/SnhX/0p4V/9KeFf/SnhX/0Z0V/9GdFf/RnRX/0Z0V/8yWFq6KVBcI////AO3t7Wr5+fn++fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn6//n6/P/5+vz/+fr8//n6/P/5+vz/+fr8//n6/P/h013/0rsA/9O8AP/TvAD/07wA/9O8AP/TvAD/07wA/9O8AP/SvAD+yLMAav/mAADr6+sA4eHhJPb29tv5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5/+LSW//TuwD/1LwA/9S8AP/UvAD/1LwA/9S8AP/UvAD/1LwA/9K6ANu/qgAkyLEAALu7uwAAAAAA8vLygfn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/4tJb/9O7AP/UvAD/1LwA/9S8AP/UvAD/1LwA/9S8AP/UvAD/zrYAgQAAAACfjQAAAAAAAOzs7ADk5OQe9vb2zPn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/i0lv/07sA/9S8AP/UvAD/1LwA/9S8AP/UvAD/1LwA/9K6AMzCrAAeybIAAAAAAAAAAAAAsLCwAP///wDv7+9O+Pj47Pn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5/+LSW//TuwD/1LwA/9S8AP/UvAD/1LwA/9S8AP/TuwDsy7QATu7UAACXhQAAAAAAAAAAAAAAAAAA1tbWALS0tAPy8vJv+Pj49Pn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/4tJb/9O7AP/UvAD/1LwA/9S8AP/UvAD/07wA9M63AG6ZiQADtqIAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4uLiANfX1wbz8/Nz+Pj48Pn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/i0lv/07sA/9S8AP/UvAD/1LwA/9O8APDPuABzuKMABsGrAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4+PjANjY2ATy8vJZ+Pj42vn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5/+HSW//TugD/1LsA/9S8AP/TuwDazrcAWbejAATBqwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1NTUAB8fHwDw8PAr9vb2nPj4+O35+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/7uas/+bZdv/j1mvt2cYznMu0ACsUFAAAtaEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOvr6wDj4+MG8vLyOvb29pD4+PjS+fn58vn5+f35+fn/+fn5//n5+f/5+fn/+fn5/fn5+fL4+frS9/j8kPT1/Trs8v8G8PP/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADh4eEA1tbWAu/v7xv09PRJ9vb2dvb29pf39/eo9/f3qPb29pf29vZ29PT0Se/v7xvW1tYC4eHhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/gB///gAH//gAAf/wAAD/4AAAf8AAAD+AAAAfAAAADwAAAA4AAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAGAAAABwAAAA8AAAAPgAAAH4AAAB/AAAA/4AAAf/gAAf/8AAP//wAP/', // @suppress longLineCheck
-
- green: 'data:image/vndmicrosofticon;base64,AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAEAAASCwAAEgsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbWJLAEpCMwptYks8eWxTdn1wVpd9cFaXeWxTdm1iSzxKQzMKbWJLAAAAAAAAAAAAAAAAAAAAAAA+OCsAAAAAAXBlTTSBdFmliHpe6Yp8X/2LfWD/i31g/4p8X/2HeV3pf3NYpW5jTDQAAAABPTcqAAAAAAB7e3sAlv//AIB1Xk+HeV3di31g/4t9YP+LfWD/i31g/4t9YP+Je1//h3pd/4d5Xf+DdVrddGhQTwAAAABDPC4A+fn5ANrb3DmupZPfinxf/4t9YP+LfWD/i31g/4t9YP+Iel7/hHdb/4R2W/+Edlv/hHdb/4BzWN9wZU05g3ZaALS0tA3w8PGuu7Sj/4h5W/+Je17/iXte/4t8X/+HeFz/gnNY/4FyWP+Bclj/gXJY/4FyWP+Bclj/fG1Url9NPA3h4eFK9/j48MvFuf+kmoP/ppuF/6abhf+JkHL/c4Rj/3OEY/9zhGP/coNj/3KDY/9yg2P/coNj/3CDYvBgf19K7e3tjPn5+f/39vb/9fTz//X08//09PP/itKw/0m+h/9Mv4n/TL+J/0y/if9Mv4n/TL+J/0y+iP9Lu4b/RrJ/jPHx8bL5+fn/+fn5//n5+f/5+fn/+fn5/4rXtP9Hwon/SsOL/0rDi/9Kw4v/SsOL/0nCiv9HvYb/RruF/0S1gbLz8/O2+fn5//n5+f/5+fn/+fn5//n5+f+K17P/R8KJ/0rDi/9Kw4v/SsOL/0nBif9GuYT/RbaC/0W2gv9Dsn+28vLymfn5+f/5+fn/+fn5//n5+f/5+fn/jdi1/0vDjP9OxI7/TsSO/0rAiv9FtoP/RLKA/0SygP9EsoD/Qq59mfHx8Vz4+Pj3+fn5//n5+f/5+fn/+fn5/9rw5v/H6tn/yOra/8Lp2f9e1b7/O8yz/z3MtP89zLT/Pcuy9zzApVzr6+sY9/f3xvn5+f/5+fn/+fn5//n5+f/7+vr//Pr7//z6+//z+fn/ZuPY/zbczv853c7/Od3O/zjbzcY10sYY////APT09Fb4+Pjy+fn5//n5+f/5+fn/+fn5//n5+f/6+fn/8Pj3/2Xj1/823Mz/OdzN/znczfI42MlWO+XWAOzs7ADm5uYF9vb2ePn5+fT5+fn/+fn5//n5+f/5+fn/+vn5//D49/9j4tf/NdvM/znczfQ42ct4Ncu9BTbRwgAAAAAA8PDwAOzs7Ab29vZd+Pj40vn5+fz5+fn/+fn5//n5+f/z+Pj/jung/FLf0tI42ctdNdHCBjfUxgAAAAAAAAAAAAAAAADn5+cAqKioAPT09CH39/dy+Pj4tvj4+NX4+PjV+Pj4tu329XLO7+whAFQmAGrUygAAAAAAAAAAAPAPAADAAwAAwAMAAIABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIABAACAAQAAwAMAAPAPAAAoAAAAIAAAAEAAAAABACAAAAAAAAAQAAASCwAAEgsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABCQgGDCsmHRxCOy4tS0M0N0tDNDdCOy4tKyYdHAkIBgwAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///wAVEg4KTUU1MWtgSmx5bVOigHNYx4N2W9uFd1zjhXdc44N2W9uAc1jHeW1TomtgSmxNRjUxFRMOCv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACsnHgALCggHWE88PHdrUpqEd1vhiXxf/It9YP+LfWD/i31g/4t9YP+LfWD/i31g/4t9YP+LfWD/iXxf/IR3W+F3a1KaV048PAsKCAcrJx4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///AAPjcqGXJnT4CFeFzki31g/4t9YP+LfWD/i31g/4t9YP+LfWD/i31g/4t9YP+LfWD/i31g/4t9YP+KfWD/iXxf/4l7Xv+DdlrkcGVNgDw2Khn//+sAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////AFJKOSp9cFavinxf+4t9YP+LfWD/i31g/4t9YP+LfWD/i31g/4t9YP+LfWD/i31g/4t9YP+LfWD/inxf/4h6Xv+Iel3/iHpd/4h6Xv+GeV37eW1Ur1BINyr///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwMDAP//3gBsZ1osgnVbv4t9YP+LfWD/i31g/4t9YP+LfWD/i31g/4t9YP+LfWD/i31g/4t9YP+LfWD/i31g/4l8X/+HeV3/hnlc/4Z5XP+GeVz/hnlc/4Z5XP+GeFz/fG9Vv1RLOiz/9LoAAgIBAAAAAAAAAAAAAAAAAAAAAAD19fUAl5ibHcbCurWShGn/i31g/4t9YP+LfWD/i31g/4t9YP+LfWD/i31g/4t9YP+LfWD/i31g/4t9YP+Je1//hXhc/4R3W/+Fd1v/hXdb/4V3W/+Fd1v/hXdb/4V3W/+Ed1v/eW1TtUlCMh2CdVkAAAAAAAAAAAAAAAAAeXl5ADY2Ngne3t+O4t/Z/ZKFaf+LfV//i31g/4t9YP+LfWD/i31g/4t9YP+LfWD/i31g/4t9YP+LfWD/iXte/4R3W/+Ddlr/g3Za/4N2Wv+Ddlr/g3Za/4N2Wv+Ddlr/g3Za/4N2Wv+CdVr9c2dPjhwZEwk/OSsAAAAAAAAAAAD///8AxMTES/X19u3k4dv/koRp/4t9X/+LfWD/i31g/4t9YP+LfWD/i31g/4t9YP+LfWD/i31g/4h6Xv+CdVr/gXRZ/4F0Wf+BdFn/gXRZ/4F0Wf+BdFn/gXRZ/4F0Wf+BdFn/gXRZ/4F0Wf9+clftZVtGS/3jrgAAAAAAm5ubAHBwcA/o6Oix+/v7/+Pg2/+ShGn/i31f/4t9YP+LfWD/i31g/4t9YP+LfWD/i31g/4t9YP+Iel7/gXRZ/4BzWP+Ac1j/gHNY/4BzWP+Ac1j/gHNY/4BzWP+Ac1j/gHNY/4BzWP+Ac1j/gHNY/4BzWP93a1KxOTMnD1BHNwD///8AycnJRfX19fD7+/v/4+Da/5CCZ/+Jel3/iXtd/4l7Xf+Je13/iXtd/4l7Xf+Ke17/iHhd/4BxV/9/cFb/f3BW/39wVv9/cFb/f3BW/39wVv9/cFb/f3BW/39wVv9/cFb/f3BW/39wVv9/cFb/f3BW/31uVPBnWURFo45tAAAAAALk5OSN+fn5//r6+v/t7Oj/vLSk/7aunP+3rp3/t66d/7eunf+3rp3/uK+e/6Gmjv9vkG3/bI5r/2yOa/9sjmv/bI5r/2yOa/9sjmv/bI5r/2yOa/9sjmr/bI1q/2yNav9sjWr/bI1q/2uNav9rjWr/a41q/16GZI0AAAACk5OTFu/v78X5+fn/+fn5//n5+f/5+fr/+fn5//n5+f/5+fn/+fn5//n5+f/8+vv/wOfV/0vCi/9Kwor/SsKK/0rCiv9Kwor/SsKK/0rCiv9Kwor/SsKK/0rCiv9Kwor/SsKK/0rCiv9Kwor/SsKK/0nAif9Jv4j/RreCxStxUBbDw8Mz9PT05fn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//z6+/+/59X/TMSM/0rDi/9Kw4v/SsOL/0rDi/9Kw4v/SsOL/0rDi/9Kw4v/SsOL/0rDi/9Kw4v/SsOL/0rDi/9JwYn/SL6I/0i+iP9GuoXlOJVqM9XV1VD39/f0+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn//Pr7/7/n1f9Mw4z/SsOL/0rDi/9Kw4v/SsOL/0rDi/9Kw4v/SsOL/0rDi/9Kw4v/SsOL/0rDi/9Kw4v/ScCJ/0e8hv9HvIb/R7yG/0a6hfQ9oXJQ3d3dYfj4+Pn5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/8+vv/v+fV/0zDjP9Kw4v/SsOL/0rDi/9Kw4v/SsOL/0rDi/9Kw4v/SsOL/0rDi/9Kw4v/SsOL/0i/iP9GuoX/RrqE/0a6hP9GuoT/RrmD+T6ldWHh4eFl+Pj4+vn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//z6+/+/59X/TMOM/0rDi/9Kw4v/SsOL/0rDi/9Kw4v/SsOL/0rDi/9Kw4v/SsOL/0rDi/9Ivof/RbiD/0W3gv9FuIP/RbiD/0W4g/9Ft4L6PqZ2ZeDg4Fr4+Pj3+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn//Pr7/7/n1f9Mw4z/SsOL/0rDi/9Kw4v/SsOL/0rDi/9Kw4v/SsOL/0rDi/9Kw4v/SL2H/0W2gv9FtYH/RbWB/0W1gf9FtYH/RbWB/0S0gPc+o3Ra3NzcQvf39+/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/8+vv/v+fV/0zDjP9Kw4v/SsOL/0rDi/9Kw4v/SsOL/0rDi/9Kw4v/SsOL/0e8hv9EtID/RLOA/0SzgP9Es4D/RLOA/0SzgP9Es4D/Q7F/7zyecULS0tIj9fX12fn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//z6+/+/59X/SsOL/0jCiv9Iwor/SMKK/0jCiv9Iwor/SMKK/0rCiv9HuoT/RLF+/0Owff9EsH3/RLB9/0Swff9EsH3/RLB9/0Swff9CrnzZOJZrI56engjy8vKu+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+vn6/9/x6f+l38X/o9/D/6Tfw/+k38P/pN/D/6Tfw/+k38T/a9Kz/0DBof9BwKH/QcCh/0HAof9BwKD/QcCg/0G/oP9Bv6D/Qb+g/0C4mK4tbU4I////AO3t7Wr5+fn++fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+vn6//v6+//7+vv/+/r7//v6+//7+vv//Pr7//v6+/+B597/NdvN/znczf853M3/OdzN/znczf853M3/OdzN/znczf85283+NtHDakb/+gDr6+sA4eHhJPb29tv5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5/3/n3f823Mz/OdzN/znczf853M3/OdzN/znczf853M3/OdzN/zjay9s0x7kkNs/BALu7uwAAAAAA8vLygfn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/f+fd/zbbzP853M3/OdzN/znczf853M3/OdzN/znczf853M3/N9XHgQAAAAAspZoAAAAAAOzs7ADk5OQe9vb2zPn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f9/593/NtvM/znczf853M3/OdzN/znczf853M3/OdzN/zjay8w0yrweNtDCAAAAAAAAAAAAsLCwAP///wDv7+9O+Pj47Pn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5/3/n3f8228z/OdzN/znczf853M3/OdzN/znczf8528zsN9PETkD45gAonJEAAAAAAAAAAAAAAAAA1tbWALS0tAPy8vJv+Pj49Pn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/f+fd/zbbzP853M3/OdzN/znczf853M3/OdvM9DjWx24qoJUDMb2wAAAAAAAAAAAAAAAAAAAAAAAAAAAA4uLiANfX1wbz8/Nz+Pj48Pn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f9/593/NtvM/znczf853M3/OdzN/znbzPA418hzMr6xBjTIugAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4+PjANjY2ATy8vJZ+Pj42vn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5/37m3f8z28z/N9zN/znczf8528zaONbIWTK/sgQ0yLsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1NTUAB8fHwDw8PAr9vb2nPj4+O35+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/vfDr/5Tq4v+L6ODtYODUnDTTxSsAGBsAMrywAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOvr6wDj4+MG8vLyOvb29pD4+PjS+fn58vn5+f35+fn/+fn5//n5+f/5+fn/+fn5/fn5+fL6+PjS+vf3kPv09Tr/6u4G/+/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADh4eEA1tbWAu/v7xv09PRJ9vb2dvb29pf39/eo9/f3qPb29pf29vZ29PT0Se/v7xvW1tYC4eHhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/gB///gAH//gAAf/wAAD/4AAAf8AAAD+AAAAfAAAADwAAAA4AAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAGAAAABwAAAA8AAAAPgAAAH4AAAB/AAAA/4AAAf/gAAf/8AAP//wAP/', // @suppress longLineCheck
-
- red: 'data:image/vndmicrosofticon;base64,AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAEAAASCwAAEgsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQxmbAC0RagpDGZs8ShysdkwdspdMHbKXShysdkMZmzwuEWoKQxmcAAAAAAAAAAAAAAAAAAAAAAAmDlgAAAAAAUQanzRPHrilUx/B6VQgxf1VIMb/VSDG/1Qgxf1TH8DpTh22pUMZnDQAAAABJQ5XAAAAAAB7ensA//8AAFUrr09SH8DdVSDG/1Ugxv9VIMb/VSDG/1Ugxv9UH8P/Ux/B/1IfwP9QHrrdRxqlTwAAAAAoD14A+fn5ANzf1zmMatPfVB7G/1Ugxv9VIMb/VSDG/1Ugxv9TH8L/UR68/1AevP9QHrz/UR68/04dt99EGaA5UB67ALS0sw3x8u+unYDd/1AZxP9THcX/Ux3F/1Qexf9THr//Tx23/08ctv9PHbb/Tx22/08dtv9PHbb/SxuurjkSfg3h4eFK+Pj38LWf5P97UtL/fVXS/31V0/9fOcz/SSfC/0knwP9JJ8D/SSfA/0knwP9JJ8D/SSfA/0gnv/A/KLNK7e3tjPn5+f/29fj/8vD3//Px9//y8Pf/fILz/zQ/8P83QvD/N0Lw/zdC8P83QvD/N0Lw/zdB7/82QOz/Mz3gjPHx8bL5+fn/+fn5//n6+f/5+vn/+fn5/36G9v8yQPT/NkP0/zZD9P82Q/T/NkP0/zVC8v80QOz/M0Dq/zI+47Lz8/O2+fn5//n5+f/5+fn/+fn5//n5+f99hvb/MkD0/zZD9P82Q/T/NkP0/zVC8f8zP+f/Mj7k/zI+5P8xPd628vLymfn5+f/5+fn/+fn5//n5+f/5+fn/gYn2/zdE9P87R/T/O0f0/zZF8P8yQOP/MT/e/zE/3v8xP97/Lz3ZmfHx8Vz4+Pj3+fn5//n5+f/5+fn/+fn5/9fZ+P/Bxfj/wsb4/7vD+P87j/X/Dnzx/xF98f8RffH/EXzw9xZv5Vzr6+sY9/f3xvn5+f/5+fn/+fn5//n5+f/7+/n//Pz5//38+f/x+Pn/OrD+/wCY//8Amf//AJn//wCZ/cYAlPMY////APT09Fb4+Pjy+fn5//n5+f/5+fn/+fn5//n5+f/6+fn/7vX5/zmu/v8Al///AJj//wCY/vIAlfpWAJ//AOzs7ADm5uYF9vb2ePn5+fT5+fn/+fn5//n5+f/5+fn/+vn5/+71+f85rf7/AJb//wCY//QAlvx4AIzrBQCQ8gAAAAAA8PDwAOzs7Ab29vZd+Pj40vn5+fz5+fn/+fn5//n5+f/x9vn/bsP8/CGk/tIAlvxdAJDyBgCT9QAAAAAAAAAAAAAAAADn5+cAqKioAPT09CH39/dy+Pj4tvj4+NX4+PjV+Pj4tuvy93LD4fUhAAC7AESo6wAAAAAAAAAAAPAPAADAAwAAwAMAAIABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIABAACAAQAAwAMAAPAPAAAoAAAAIAAAAEAAAAABACAAAAAAAAAQAAASCwAAEgsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBgIMDBoKPRwoD14tLhFrNy4RazcoD14tGgo9HAYCDAwAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP+3/wANBR0KLxJuMUEYmGxKHKyiTh22x1Aeu9tRHr3jUR6941Aeu9tOHbbHShysokEYmGwvEm4xDQUeCv+6/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABoKPgAHAxAHNhR9PEkbqppRHr3hVCDE/FUgxv9VIMf/VSDH/1Ugxv9VIMb/VSDH/1Ugx/9VIMb/VCDE/FEevOFIG6maNRR8PAcDEAcaCj0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADVUP8AJg5YGUYao4BRH77kVSDG/1Ugxv9VIMb/VSDG/1Ugxv9VIMb/VSDG/1Ugxv9VIMb/VSDG/1Ugxv9VIMX/VB/E/1Qfw/9QHrvkRRmggCUOVhnQTv8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEA////ADITdSpMHbKvVCDE+1Ugxv9VIMb/VSDG/1Ugxv9VIMb/VSDG/1Ugxv9VIMb/VSDG/1Ugxv9VIMb/VCDE/1Mfwv9TH8H/Ux/B/1Mfwv9SH7/7ShytrzEScSr///8AAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwMDAMto/wBVPoYsUSC3v1Ugxv9VIMb/VSDG/1Ugxv9VIMb/VSDG/1Ugxv9VIMb/VSDG/1Ugxv9VIMb/VSDG/1QfxP9SHsD/Uh6//1Iev/9SHr//Uh6//1Iev/9SHr//SxywvzMTdyymPf8AAQACAAAAAAAAAAAAAAAAAAAAAAD19fUAnaKQHbep1rVfLcn/VB/G/1Ugxv9VIMb/VSDG/1Ugxv9VIMb/VSDG/1Ugxv9VIMb/VSDG/1Ugxv9UH8P/UR6+/1Eevf9RHr3/UR69/1Eevf9RHr3/UR69/1Eevf9RHr3/ShuttS0RaB1PHrkAAAAAAAAAAAAAAAAAeXl5ADY2Ngnf4NyO18zu/V8tyf9UH8b/VSDG/1Ugxv9VIMb/VSDG/1Ugxv9VIMb/VSDG/1Ugxv9VIMb/VB/D/1EevP9QHrr/UB67/1Aeu/9QHrv/UB67/1Aeu/9QHrv/UB67/1Aeu/9QHrr9RhqkjhEGKAknDloAAAAAAAAAAAD///8AxMTES/b39O3Zzu//Xy3J/1Qfxv9VIMb/VSDG/1Ugxv9VIMb/VSDG/1Ugxv9VIMb/VSDG/1Mfwv9QHbr/Tx24/08duP9PHbj/Tx24/08duP9PHbj/Tx24/08duP9PHbj/Tx24/08duf9NHLTtPheRS5s5/wAAAAAAm5ubAHBwcA/o6Oix+/z6/9jO7/9fLcn/VB/G/1Ugxv9VIMb/VSDG/1Ugxv9VIMb/VSDG/1Ugxv9TH8H/Tx24/04dtv9OHbb/Th22/04dtv9OHbb/Th22/04dtv9OHbb/Th22/04dtv9OHbb/Th22/04dtv9JG6mxIw1RDzAScQD///8AycnJRfX19fD7/Pr/2M3v/1wqyP9SHMX/UhzF/1Icxf9SHMX/UhzF/1Icxf9THcX/Ux7A/04ctf9NHLL/Thyz/04cs/9NHLP/TRyz/00cs/9OHLP/Thyz/04cs/9OHLP/Thyz/04cs/9NHLP/Thyz/0wcsPA/Fo9FYyTkAAAAAALk5OSN+fn5//r6+f/n4vT/noDd/5Z22v+Wdtr/lnba/5Z22v+Wdtr/mHfb/35g1/9KMMr/SC/H/0gvx/9IL8f/SC/H/0gvx/9IL8b/SC/G/0gvxv9HL8b/Ry/G/0cvxv9HL8b/Ry/G/0cvxv9HL8X/Ry7F/z8tuI0AAAACk5OTFu/v78X5+fn/+fn5//n5+f/6+vn/+fr5//n6+f/5+vn/+fr5//n6+f/9/fn/ub73/zhF8v82Q/L/NkPy/zZD8v82Q/L/NkPy/zZD8v82Q/L/NkPy/zZD8v82Q/L/NkPy/zZD8v82Q/L/NkPy/zVC8f81QvD/Mz/mxR8njhbDw8Mz9PT05fn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//z8+f+5vff/OEX0/zZD9P82Q/T/NkP0/zZD9P82Q/T/NkP0/zZD9P82Q/T/NkP0/zZD9P82Q/T/NkP0/zZD9P81QvH/NEHv/zRB7/8zQOrlKTO6M9XV1VD39/f0+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn//Pz5/7m99/84RfT/NkP0/zZD9P82Q/T/NkP0/zZD9P82Q/T/NkP0/zZD9P82Q/T/NkP0/zZD9P82Q/T/NULw/zRA7P80QOv/NEDr/zNA6fQsN8lQ3d3dYfj4+Pn5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/8/Pn/ub33/zhF9P82Q/T/NkP0/zZD9P82Q/T/NkP0/zZD9P82Q/T/NkP0/zZD9P82Q/T/NkP0/zVB7/8zQOn/Mz/o/zM/6P8zQOj/Mz/n+S04zmHh4eFl+Pj4+vn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//z8+f+5vff/OEX0/zZD9P82Q/T/NkP0/zZD9P82Q/T/NkP0/zZD9P82Q/T/NkP0/zZD9P80Qe7/Mz/m/zM/5f8zP+b/Mz/m/zM/5v8yP+X6LjnPZeDg4Fr4+Pj3+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn//Pz5/7m99/84RfT/NkP0/zZD9P82Q/T/NkP0/zZD9P82Q/T/NkP0/zZD9P82Q/T/NEHs/zI+4/8yPuP/Mj7j/zI+4/8yPuP/Mj7j/zI+4fctOMxa3NzcQvf39+/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/8/Pn/ub33/zhF9P82Q/T/NkP0/zZD9P82Q/T/NkP0/zZD9P82Q/T/NkP0/zRA6/8xPeH/MT3g/zE94P8xPeD/MT3g/zE94P8xPeD/MT3e7ys2xkLS0tIj9fX12fn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//z8+f+4vff/NkP0/zNB9P80QfT/NEH0/zRB9P80QfT/NEH0/zZC8/81P+n/Mjze/zI73f8yO93/Mjvd/zI73f8yO93/Mjvd/zI73f8xO9rZKTO7I56engjy8vKu+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+/r5/9ze+P+covf/mqD3/5qg9/+aoPf/mqD3/5qg9/+aoPf/UoLz/x1p5/8eaeb/Hmnm/x5p5v8eaeX/Hmnl/x5p5f8eaOX/Hmjl/yBh3a4jJokI////AO3t7Wr5+fn++fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+vr5//z8+f/8/Pn//Pz5//z8+f/8/Pn//Pz5//z8+f9dvfz/AJf+/wCZ/v8Amf7/AJn+/wCZ/v8Amf7/AJn+/wCZ/v8AmP7+AJLxagC4/wDr6+sA4eHhJPb29tv5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5/1u8/f8Alv//AJj//wCY//8AmP//AJj//wCY//8AmP//AJj//wCW/NsAieckAI/xALu7uwAAAAAA8vLygfn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/W7z9/wCW//8AmP//AJj//wCY//8AmP//AJj//wCY//8AmP//AJP3gQAAAAAAcr8AAAAAAOzs7ADk5OQe9vb2zPn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f9bvP3/AJb//wCY//8AmP//AJj//wCY//8AmP//AJj//wCW/MwAi+oeAJDxAAAAAAAAAAAAsLCwAP///wDv7+9O+Pj47Pn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5/1u8/f8Alv//AJj//wCY//8AmP//AJj//wCY//8Al/7sAJL0TgCr/wAAa7QAAAAAAAAAAAAAAAAA1tbWALS0tAPy8vJv+Pj49Pn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/W7z9/wCW//8AmP//AJj//wCY//8AmP//AJj+9ACU+G4AbrgDAIPaAAAAAAAAAAAAAAAAAAAAAAAAAAAA4uLiANfX1wbz8/Nz+Pj48Pn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f9bvP3/AJb//wCY//8AmP//AJj//wCY/vAAlflzAITcBgCK5wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4+PjANjY2ATy8vJZ+Pj42vn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5/1u7/f8Alf//AJf//wCY//8Al/7aAJT4WQCE3AQAiucAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1NTUAB8fHwDw8PAr9vb2nPj4+O35+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/rNv7/3bG/P9rwfztM6r7nACR9SsAER0AAIPZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOvr6wDj4+MG8vLyOvb29pD4+PjS+fn58vn5+f35+fn/+fn5//n5+f/5+fn/+fn5/fn5+fL6+fjS/Pj2kP338jr/+eIG//fqAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADh4eEA1tbWAu/v7xv09PRJ9vb2dvb29pf39/eo9/f3qPb29pf29vZ29PT0Se/v7xvW1tYC4eHhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/gB///gAH//gAAf/wAAD/4AAAf8AAAD+AAAAfAAAADwAAAA4AAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAGAAAABwAAAA8AAAAPgAAAH4AAAB/AAAA/4AAAf/gAAf/8AAP//wAP/', // @suppress longLineCheck
-
- yellow: 'data:image/vndmicrosofticon;base64,AAABAAIAICAAAAEAIACoEAAAJgAAABAQAAABACAAaAQAAM4QAAAoAAAAIAAAAEAAAAABACAAAAAAAAAQAAASCwAAEgsAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAZKhQAOWAiAEV0KgBFdCoAOWAiABkqFAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8ZAAAChAHAEp8JwBvu10AgNeSAInluACN7c4Aj/DXAI/w1wCN7c4AieW4AIDXkgBvu10ASnwnAAoQBwA8ZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbLgAAAAAFAFmWMwB/1YwAj/DXAJX7+QCY//8AmP//AJj//wCY//8AmP//AJj//wCY//8AmP//AJX7+QCP79cAftWMAFmVMwAAAAUAGy4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7v8AAD1mFQB6zXYAkPLdAJf+/gCY//8AmP//AJj//wCY//8AmP//AJj//wCY//8AmP//AJj//wCY//8AmP7/AJf+/wCV/P4AjvDdAHjKdgA8ZBUA6f8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AABWkCYAh+KoAJb8+QCY//8AmP//AJj//wCY//8AmP//AJj//wCY//8AmP//AJj//wCY//8AmP//AJf+/wCV+v8AlPr/AJT6/wCV+v8Akvf5AIPdqABTjCYA//8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgICABb//wAka5wqAozquwCY/v8AmP//AJj//wCY//8AmP//AJj//wCY//8AmP//AJj//wCY//8AmP//AJj//wCX/f8Ak/j/AJP3/wCT9/8Ak/f/AJP3/wCT9/8Akvb/AIbiuwBZlyoA//8AAAECAAAAAAAAAAAAAAAAAAAAAADz8/MAqJaJHZDD5rQLnP7/AJj//wCY//8AmP//AJj//wCY//8AmP//AJj//wCY//8AmP//AJj//wCY//8Alvz/AJL2/wCR9P8AkfT/AJH0/wCR9P8AkfT/AJH0/wCR9P8AkfT/AITftABQhh0AjO0AAAAAAAAAAAAAAAAAfX19ADw8PAni3tuPuuD5/Quc//8AmP//AJj//wCY//8AmP//AJj//wCY//8AmP//AJj//wCY//8AmP//AJb8/wCQ8/8Aj/H/AI/x/wCP8f8Aj/H/AI/x/wCP8f8Aj/H/AI/x/wCP8f8AjvD9AH7UjwAiOQkASHkAAAAAAAgICAD///8AxcXFT/j19O+94vv/Cpz//wCY//8AmP//AJj//wCY//8AmP//AJj//wCY//8AmP//AJj//wCV+/8Aj/H/AI3u/wCN7v8Aje7/AI3u/wCN7v8Aje7/AI3u/wCN7v8Aje7/AI3u/wCO7v8AiunvAHC8TwD//wAABQgAqKioAHp6ehHp6em3/fv5/7zh+v8KnP//AJj//wCY//8AmP//AJj//wCY//8AmP//AJj//wCY//8Alfr/AI7u/wCM6/8AjOv/AIzr/wCM6/8AjOv/AIzr/wCM6/8AjOv/AIzr/wCM6/8AjOv/AIzr/wCM6/8Ag9y3AERyEQBenQD///8AzMzMTfb29vP9+/n/vOH6/wqb//8Alv//AJb//wCW//8Alv//AJb//wCW//8Al///AJT5/wCL6/8Aiej/AIno/wCJ6P8Aiej/AIno/wCJ6P8Aiej/AIno/wCJ6P8Aiej/AIno/wCJ6P8Aiej/AIno/wCH5fMAb75NAMP/AAAAAAXl5eWX+fn5//v6+f/T6vr/Wbv9/0+3/f9Qt/3/ULf9/1C3/f9Qt/3/Ubj9/zew+/8InO//B5nr/weZ6/8Hmev/B5nq/weZ6v8Hmer/B5nq/weZ6v8Hmer/B5jq/weY6v8HmOn/B5jp/weY6f8HmOn/Bpjp/weP15cBAAAFpKSkHfDw8M/5+fn/+fn5//n5+f/1+Pn/9Pf5//T3+f/09/n/9Pf5//T3+f/4+Pn/o+T6/wq//f8Hv/3/CL/9/wi//f8Iv/3/CL/9/wi//f8Iv/3/CL/8/wi+/P8Ivvz/CL78/wi+/P8Ivvz/CL78/we9+/8HvPr/BrbxzwR9pR3Ly8tA9fX17Pn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//36+f+l5vv/CcL//wfB//8Hwf//B8H//wfB//8Hwf//B8H//wfB//8Hwf//B8H//wfB//8Hwf//B8H//wfB//8Hv/3/Br36/wa9+v8GuvbsBZnLQNra2mD39/f4+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn//fr5/6Xm+/8Jwf//B8H//wfB//8Hwf//B8H//wfB//8Hwf//B8H//wfB//8Hwf//B8H//wfB//8Hwf//B778/wa79/8Guvf/Brr3/wa59fgFo9hg4uLidPj4+P35+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/9+vn/peb7/wnB//8Hwf//B8H//wfB//8Hwf//B8H//wfB//8Hwf//B8H//wfB//8Hwf//B8H//we++/8GufX/Brj0/wa49P8GuPT/Brfz/QWm3XTk5OR6+Pj4/fn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//36+f+l5vv/CcH//wfB//8Hwf//B8H//wfB//8Hwf//B8H//wfB//8Hwf//B8H//wfB//8Hvfr/Brfy/wa28f8GtvH/Brbx/wa28f8GtfD9BafdeuXl5W/4+Pj8+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn//fr5/6Xm+/8Jwf//B8H//wfB//8Hwf//B8H//wfB//8Hwf//B8H//wfB//8Hwf//B7z5/wa17/8GtO7/BrTu/wa07v8GtO7/BrTu/waz7fwFpdtv4eHhVvj4+Pb5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/9+vn/peb7/wnB//8Hwf//B8H//wfB//8Hwf//B8H//wfB//8Hwf//B8H//we7+P8Gsu3/BrHr/wax6/8Gsev/BrHr/wax6/8Gsev/BrDq9gWh1Vba2toz9vb25vn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//36+f+k5fv/BsH//wPA//8DwP//A8D//wPA//8DwP//A8D//wXA//8Guvb/BrDq/wau6P8Gruj/Bq7o/wau6P8Gruj/Bq7o/wau6P8GreXmBZnLM7+/vxH09PTC+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+/r5/83v+v9x2vz/btn9/2/Z/f9v2f3/b9n9/2/Z/f9v2f3/RdL5/yXG7v8mxOz/JsTs/ybE6/8mxOv/JsTr/yXE6/8lw+v/JcPr/yK95cIQirAR////APDw8IH5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+vn5//r5+f/6+fn/+vn5//r5+f/6+fn/+vn5//r5+f+H8Pz/Oer+/zzq/v886v7/POr+/zzq/v886v7/POr+/zzq/v886v3/OuDzgWz//wD09PQA5+fnNPf39+n5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5/4Xw/f846///O+v//zvr//876///O+v//zvr//876///O+v//zvp/ek32+00Ouf6AMrKygCzs7MF8/Pzmvn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/hfD9/zjr//876///O+v//zvr//876///O+v//zvr//876///OuX5miqptwUwv88AAAAAAPPz8wDp6eku9/f33fn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f+F8P3/OOv//zvr//876///O+v//zvr//876///O+v//zvp/d033O8uOuX5AAAAAAAAAAAAvr6+AP///wDx8fFl+Pj49fn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5/4Xw/f846///O+v//zvr//876///O+v//zvr//876v71OeP2ZY7//wAus8IAAAAAAAAAAAAAAAAA4ODgANPT0wj09PSI+fn5+vn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/hfD9/zjr//876///O+v//zvr//876///O+v/+jrm+Ygyx9gINdPlAAAAAAAAAAAAAAAAAAAAAAAAAAAA6enpAOHh4Q309PSM+fn5+Pn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f+F8P3/OOv//zvr//876///O+v//zvr//g65/qMNtXnDTjd7wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA6enpAOLi4gr09PRw+Pj45/n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5/4Pw/f816///Oev//zvr//876v7nOub5cDbW5wo33O4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ODgANHR0QLx8fE89/f3sfn5+fX5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+f/5+fn/t/T7/4Xx/f+A8P31Xez8sTnk9zwuxdUCNtTkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAREREAP///wDo6OgM9PT0Tff396T4+Pjf+fn5+Pn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//n5+fj5+Pjf9vf3pPL09E3m6OgM7/3/APtbOwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACMjIwD19fUA4uLiBvHx8Sn19fVd9vb2jff396739/e99/f3vff396729vaN9fX1XfHx8Snl4uIG9PX1AFEnIgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP/wD///gAH//gAAf/wAAD/4AAAf8AAAD+AAAAfAAAADwAAAA4AAAAGAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAGAAAABgAAAAcAAAAPgAAAH4AAAB/AAAA/4AAAf/AAAP/8AAP//wAP/KAAAABAAAAAgAAAAAQAgAAAAAAAABAAAEgsAABILAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABorgAAS34IAHTDNQCC22wAh+OMAIfjjACC22wAdMQ1AEx/CABorwAAAAAAAAAAAAAAAAAAAAAAAEBrAAAAAAAAecswAIzsngCU+OUAl/37AJj+/wCY/v8Al/37AJP35QCL6Z4Ad8gwAAAAAAA+aQAAAAAAcXd6AP8AAAAOiNtNAJP32gCY//8AmP//AJj//wCY//8AmP//AJb8/wCU+f8Ak/j/AI7w2gB+1E0AAAAAAEd4APn7/ADc2NU5T7P33gCX//8AmP//AJj//wCY//8AmP//AJX6/wCR8/8AkPL/AJDz/wCQ8/8AjOzeAHrOOQCR9AC3t7cO8e/vsGnA/f8Alf//AJf//wCX//8Al///AJP4/wCN7v8AjOz/AIzs/wCM7P8AjOz/AIzt/wCG4rAAY6oO4uLiT/j39/GIzfz/Mav+/zSs/v80rP7/FaH5/wOV7f8DlOv/A5Tr/wOU6/8DlOv/A5Tr/wOU6/8Dk+jxBIvVT+3t7ZT5+fn/8fb5/+vz+f/r9Pn/6vP5/1nR+/8EvPz/B738/we9/P8Hvfz/B738/we9/P8HvPv/B7r4/wax7ZTy8vK7+fn5//n5+f/6+fn/+vn5//n5+f9e1f3/A8D//wfB//8Hwf//B8H//wfB//8HwP3/Brv3/wa59f8GtO678/Pzwfn5+f/5+fn/+fn5//n5+f/4+fn/XtX9/wPA//8Hwf//B8H//wfB//8Hv/z/Brfz/wa17/8Gte//BrHqwfPz86X5+fn/+fn5//n5+f/5+fn/+Pn5/2DW/f8Gwf//CsL//wrC//8Jv/v/CLXu/wix6f8Isen/CLHp/wet5KXy8vJo+fn5+vn5+f/5+fn/+fn5//n5+f/I7vr/quf7/6zn+/+m5/v/Tdz5/yzV9P8u1fT/LtX0/y7U8/ooyOpo7OzsH/f399D5+fn/+fn5//n5+f/5+fn//Pr5//36+f/++vn/9fn5/2rv/v857P//POz//zzs//886/3QOuLzH////wD09PRh+fn59vn5+f/5+fn/+fn5//n5+f/5+fn/+fn5//H4+f9o7v7/OOv//zvr//876//2Ouf6YUH//wDu7u4A6enpB/b29oT5+fn3+fn5//n5+f/5+fn/+fn5//n5+f/x+Pn/Zu7+/zfr//876//3Ouj8hDfc7wc44PMAAAAAAPHx8QDu7u4I9vb2aPj4+Nn5+fn9+fn5//n5+f/5+fn/8/n5/4zx/P1S7P7ZO+n8aDfh9Ag55PcAAAAAAAAAAAAAAAAA6+vrAN/f3wH19fUo9/f3fvj4+MH4+Pje+Pj43vj4+MHq9vh+w/H2KADM5wFk4e8AAAAAAAAAAADwDwAA4AcAAMADAACAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAAgAEAAMADAADgBwAA' // @suppress longLineCheck
- };
-
- return {
- FaviconsByHue: FaviconsByHue
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/file.html b/chromium/third_party/catapult/tracing/tracing/ui/base/file.html
deleted file mode 100644
index c599c5e3ef8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/file.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- function readFile(fileBlob) {
- return new Promise(function(resolve, reject) {
- var reader = new FileReader();
- var filename = fileBlob.name;
- reader.onload = function(data) {
- resolve(data.target.result);
- };
- reader.onerror = function(err) {
- reject(err);
- };
-
- var is_binary = filename.endsWith('.gz') || filename.endsWith('.zip');
- if (is_binary)
- reader.readAsArrayBuffer(fileBlob);
- else
- reader.readAsText(fileBlob);
- });
- }
- return {
- readFile: readFile
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/grouping_table.html b/chromium/third_party/catapult/tracing/tracing/ui/base/grouping_table.html
deleted file mode 100644
index 341574145c6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/grouping_table.html
+++ /dev/null
@@ -1,227 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/table.html">
-
-<polymer-element name="tr-ui-b-grouping-table">
- <template>
- <style>
- :host {
- display: flex;
- }
- #table {
- flex: 1 1 auto;
- }
- </style>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </template>
-</polymer-element>
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
-
- function Row(title, data, groupingKeyFuncs, rowStatsConstructor) {
- this.title = title;
- this.data_ = data;
- if (groupingKeyFuncs === undefined)
- groupingKeyFuncs = [];
- this.groupingKeyFuncs_ = groupingKeyFuncs;
- this.rowStatsConstructor_ = rowStatsConstructor;
-
- this.subRowsBuilt_ = false;
- this.subRows_ = undefined;
-
- this.rowStats_ = undefined;
- }
-
- Row.prototype = {
- getCurrentGroupingKeyFunc_: function() {
- if (this.groupingKeyFuncs_.length === 0)
- return undefined;
- return this.groupingKeyFuncs_[0];
- },
-
- get data() {
- return this.data_;
- },
-
- get rowStats() {
- if (this.rowStats_ === undefined) {
- this.rowStats_ = new this.rowStatsConstructor_(this);
- }
- return this.rowStats_;
- },
-
- rebuildSubRowsIfNeeded_: function() {
- if (this.subRowsBuilt_)
- return;
- this.subRowsBuilt_ = true;
-
- var groupingKeyFunc = this.getCurrentGroupingKeyFunc_();
- if (groupingKeyFunc === undefined) {
- this.subRows_ = undefined;
- return;
- }
-
- var dataByKey = {};
- var hasValues = false;
- this.data_.forEach(function(datum) {
- var key = groupingKeyFunc(datum);
- hasValues = hasValues || (key !== undefined);
- if (dataByKey[key] === undefined)
- dataByKey[key] = [];
- dataByKey[key].push(datum);
- });
- if (!hasValues) {
- this.subRows_ = undefined;
- return;
- }
-
- this.subRows_ = [];
- for (var key in dataByKey) {
- var row = new Row(key,
- dataByKey[key],
- this.groupingKeyFuncs_.slice(1),
- this.rowStatsConstructor_);
- this.subRows_.push(row);
- }
- },
-
- get isExpanded() {
- return (this.subRows &&
- (this.subRows.length > 0) &&
- (this.subRows.length < 5));
- },
-
- get subRows() {
- this.rebuildSubRowsIfNeeded_();
- return this.subRows_;
- }
- };
-
- Polymer('tr-ui-b-grouping-table', {
- created: function() {
- this.dataToGroup_ = undefined;
- this.groupBy_ = undefined;
- this.rowStatsConstructor_ = undefined;
- },
-
- get tableColumns() {
- return this.$.table.tableColumns;
- },
-
- set tableColumns(tableColumns) {
- this.$.table.tableColumns = tableColumns;
- },
-
- get tableRows() {
- return this.$.table.tableRows;
- },
-
- get sortColumnIndex() {
- return this.$.table.sortColumnIndex;
- },
-
- set sortColumnIndex(sortColumnIndex) {
- this.$.table.sortColumnIndex = sortColumnIndex;
- },
-
- get sortDescending() {
- return this.$.table.sortDescending;
- },
-
- set sortDescending(sortDescending) {
- this.$.table.sortDescending = sortDescending;
- },
-
- get selectionMode() {
- return this.$.table.selectionMode;
- },
-
- set selectionMode(selectionMode) {
- this.$.table.selectionMode = selectionMode;
- },
-
- get rowHighlightStyle() {
- return this.$.table.rowHighlightStyle;
- },
-
- set rowHighlightStyle(rowHighlightStyle) {
- this.$.table.rowHighlightStyle = rowHighlightStyle;
- },
-
- get cellHighlightStyle() {
- return this.$.table.cellHighlightStyle;
- },
-
- set cellHighlightStyle(cellHighlightStyle) {
- this.$.table.cellHighlightStyle = cellHighlightStyle;
- },
-
- get selectedColumnIndex() {
- return this.$.table.selectedColumnIndex;
- },
-
- set selectedColumnIndex(selectedColumnIndex) {
- this.$.table.selectedColumnIndex = selectedColumnIndex;
- },
-
- get selectedTableRow() {
- return this.$.table.selectedTableRow;
- },
-
- set selectedTableRow(selectedTableRow) {
- this.$.table.selectedTableRow = selectedTableRow;
- },
-
- get groupBy() {
- return this.groupBy_;
- },
-
- set groupBy(groupBy) {
- this.groupBy_ = groupBy;
- this.updateContents_();
- },
-
- get dataToGroup() {
- return this.dataToGroup_;
- },
-
- set dataToGroup(dataToGroup) {
- this.dataToGroup_ = dataToGroup;
- this.updateContents_();
- },
-
- get rowStatsConstructor() {
- return this.rowStatsConstructor_;
- },
-
- set rowStatsConstructor(rowStatsConstructor) {
- this.rowStatsConstructor_ = rowStatsConstructor;
- this.updateContents_();
- },
-
- rebuild: function() {
- this.$.table.rebuild();
- },
-
- updateContents_: function() {
- var groupBy = this.groupBy_ || [];
- var dataToGroup = this.dataToGroup_ || [];
- var rowStatsConstructor = this.rowStatsConstructor_ || function() {};
-
- var superRow = new Row('', dataToGroup, groupBy,
- rowStatsConstructor);
- this.$.table.tableRows = superRow.subRows || [];
- }
- });
-
- return {
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/grouping_table_groupby_picker.html b/chromium/third_party/catapult/tracing/tracing/ui/base/grouping_table_groupby_picker.html
deleted file mode 100644
index ef12f0450d6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/grouping_table_groupby_picker.html
+++ /dev/null
@@ -1,313 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/settings.html">
-<link rel="import" href="/tracing/ui/base/dropdown.html">
-
-<polymer-element name="tr-ui-b-grouping-table-groupby-picker">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- groups {
- -webkit-user-select: none;
- display: flex;
- flex-direction: row;
- padding-left: 10px;
- }
-
- group, possible-group {
- display: span;
- padding-right: 10px;
- padding-left: 10px;
- }
-
- group {
- border-left: 1px solid rgba(0,0,0,0);
- cursor: move;
- }
-
- group.dragging {
- opacity: 0.2;
- }
-
- group.drop-targeted {
- border-left: 1px solid black;
- }
-
-
- #remove {
- cursor: default;
- }
-
- #remove:not([hovered]) {
- visibility: hidden;
- }
- </style>
- <groups>
- </groups>
- <tr-ui-b-dropdown id="add-group"></tr-ui-b-dropdown>
- </template>
-</polymer-element>
-
-<template id="tr-ui-b-grouping-table-groupby-picker-group-template">
- <span id="key"></span>
- <span id="remove">&times;</span>
-</template>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- var THIS_DOC = document._currentScript.ownerDocument;
-
- Polymer('tr-ui-b-grouping-table-groupby-picker', {
- created: function() {
- this.needsInit_ = true;
- this.defaultGroupKeys_ = undefined;
- this.possibleGroups_ = [];
- this.settingsKey_ = [];
-
- this.currentGroupKeys_ = undefined;
-
- this.dragging_ = false;
- },
-
- get defaultGroupKeys() {
- return this.defaultGroupKeys_;
- },
-
- set defaultGroupKeys(defaultGroupKeys) {
- if (!this.needsInit_)
- throw new Error('Already initialized.');
- this.defaultGroupKeys_ = defaultGroupKeys;
- this.maybeInit_();
- },
-
- get possibleGroups() {
- return this.possibleGroups_;
- },
-
- set possibleGroups(possibleGroups) {
- if (!this.needsInit_)
- throw new Error('Already initialized.');
- this.possibleGroups_ = possibleGroups;
- this.maybeInit_();
- },
-
- get settingsKey() {
- return this.settingsKey_;
- },
-
- set settingsKey(settingsKey) {
- if (!this.needsInit_)
- throw new Error('Already initialized.');
- this.settingsKey_ = settingsKey;
- this.maybeInit_();
- },
-
- maybeInit_: function() {
- if (!this.needsInit_)
- return;
-
- if (this.settingsKey_ === undefined)
- return;
- if (this.defaultGroupKeys_ === undefined)
- return;
- if (this.possibleGroups_ === undefined)
- return;
-
- this.needsInit_ = false;
-
- var addGroupEl = this.shadowRoot.querySelector('#add-group');
- addGroupEl.iconElement.textContent = 'Add another...';
-
- this.currentGroupKeys = tr.b.Settings.get(
- this.settingsKey_, this.defaultGroupKeys_);
- },
-
- get currentGroupKeys() {
- return this.currentGroupKeys_;
- },
-
- get currentGroups() {
- var groupsByKey = {};
- this.possibleGroups_.forEach(function(group) {
- groupsByKey[group.key] = group;
- });
- return this.currentGroupKeys_.map(function(groupKey) {
- return groupsByKey[groupKey];
- });
- },
-
- set currentGroupKeys(currentGroupKeys) {
- if (this.currentGroupKeys_ === currentGroupKeys)
- return;
-
- if (!(currentGroupKeys instanceof Array))
- throw new Error('Must be array');
-
- this.currentGroupKeys_ = currentGroupKeys;
- this.updateGroups_();
-
- tr.b.Settings.set(
- this.settingsKey_, this.currentGroupKeys_);
-
- var e = new tr.b.Event('current-groups-changed');
- this.dispatchEvent(e);
- },
-
- updateGroups_: function() {
- var groupsEl = this.shadowRoot.querySelector('groups');
- var addGroupEl = this.shadowRoot.querySelector('#add-group');
-
- groupsEl.textContent = '';
- addGroupEl.textContent = '';
-
- var unusedGroups = {};
- var groupsByKey = {};
- this.possibleGroups_.forEach(function(group) {
- unusedGroups[group.key] = group;
- groupsByKey[group.key] = group;
- });
-
- this.currentGroupKeys_.forEach(function(key) {
- delete unusedGroups[key];
- });
-
- // Create groups.
- var groupTemplateEl = THIS_DOC.querySelector(
- '#tr-ui-b-grouping-table-groupby-picker-group-template');
- this.currentGroupKeys_.forEach(function(key, index) {
- var group = groupsByKey[key];
- var groupEl = document.createElement('group');
- groupEl.groupKey = key;
- groupEl.appendChild(document.importNode(groupTemplateEl.content, true));
- groupEl.querySelector('#key').textContent = group.label;
- groupsEl.appendChild(groupEl);
-
- this.configureRemoveButtonForGroup_(groupEl);
- this.configureDragAndDropForGroup_(groupEl);
- }, this);
-
- // Adjust dropdown.
- tr.b.iterItems(unusedGroups, function(key, group) {
- var groupEl = document.createElement('possible-group');
- groupEl.textContent = group.label;
- groupEl.addEventListener('click', function() {
- var newKeys = this.currentGroupKeys.slice();
- newKeys.push(key);
- this.currentGroupKeys = newKeys;
- addGroupEl.close();
- }.bind(this));
- addGroupEl.appendChild(groupEl);
- }, this);
-
- // Hide dropdown if needed.
- if (tr.b.dictionaryLength(unusedGroups) == 0) {
- addGroupEl.style.display = 'none';
- } else {
- addGroupEl.style.display = '';
- }
- },
-
- configureRemoveButtonForGroup_: function(groupEl) {
- var removeEl = groupEl.querySelector('#remove');
- removeEl.addEventListener('click', function() {
- var newKeys = this.currentGroupKeys.slice();
- var i = newKeys.indexOf(groupEl.groupKey);
- newKeys.splice(i, 1);
- this.currentGroupKeys = newKeys;
- }.bind(this));
-
- groupEl.addEventListener('mouseenter', function() {
- removeEl.setAttribute('hovered', true);
- });
- groupEl.addEventListener('mouseleave', function() {
- removeEl.removeAttribute('hovered');
- });
- },
-
- configureDragAndDropForGroup_: function(groupEl) {
- var groupsEl = groupEl.parentElement;
-
- groupEl.setAttribute('draggable', true);
-
- groupEl.addEventListener('dragstart', function(e) {
- e.dataTransfer.setData('groupKey', groupEl.groupKey);
- groupEl.querySelector('#remove').removeAttribute('hovered');
- groupEl.classList.add('dragging');
- this.dragging_ = true;
- }.bind(this));
-
- groupEl.addEventListener('dragend', function(e) {
- console.log(e.type, groupEl.groupKey);
- for (var i = 0; i < groupsEl.children.length; i++)
- groupsEl.children[i].classList.remove('drop-targeted');
- groupEl.classList.remove('dragging');
- this.dragging_ = false;
- }.bind(this));
-
- // Drop targeting.
- groupEl.addEventListener('dragenter', function(e) {
- if (!this.dragging_)
- return;
- groupEl.classList.add('drop-targeted');
- if (this.dragging_)
- e.preventDefault();
- }.bind(this));
-
- groupEl.addEventListener('dragleave', function(e) {
- if (!this.dragging_)
- return;
- groupEl.classList.remove('drop-targeted');
- e.preventDefault();
- }.bind(this));
-
-
- // Drop logic.
- groupEl.addEventListener('dragover', function(e) {
- if (!this.dragging_)
- return;
- e.preventDefault();
- groupEl.classList.add('drop-targeted');
- }.bind(this));
-
- groupEl.addEventListener('drop', function(e) {
- if (!this.dragging_)
- return;
-
- var srcKey = e.dataTransfer.getData('groupKey');
- var dstKey = groupEl.groupKey;
-
- if (srcKey === dstKey)
- return;
-
- var newKeys = this.currentGroupKeys_.slice();
-
- var srcIndex = this.currentGroupKeys_.indexOf(srcKey);
- newKeys.splice(srcIndex, 1);
-
- var dstIndex = this.currentGroupKeys_.indexOf(dstKey);
- newKeys.splice(dstIndex, 0, srcKey);
-
- this.currentGroupKeys = newKeys;
-
- e.dataTransfer.clearData();
- e.preventDefault();
- e.stopPropagation();
- }.bind(this));
- }
- });
-
- return {
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/grouping_table_groupby_picker_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/grouping_table_groupby_picker_test.html
deleted file mode 100644
index 1bbbc4f2057..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/grouping_table_groupby_picker_test.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/grouping_table_groupby_picker.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('basic', function() {
- var picker = document.createElement(
- 'tr-ui-b-grouping-table-groupby-picker');
- picker.settingsKey = 'basic-test';
- picker.possibleGroups = [
- {key: 'a', label: 'A'},
- {key: 'b', label: 'B'},
- {key: 'c', label: 'C'},
- {key: 'd', label: 'D'},
- {key: 'e', label: 'E'}
- ];
- picker.defaultGroupKeys = ['a', 'b', 'd'];
- this.addHTMLOutput(picker);
- });
-
- test('allGroupsAdded', function() {
- var picker = document.createElement(
- 'tr-ui-b-grouping-table-groupby-picker');
- picker.settingsKey = 'basic-test';
- picker.possibleGroups = [
- {key: 'a', label: 'A'},
- {key: 'b', label: 'B'},
- {key: 'c', label: 'C'},
- {key: 'd', label: 'D'},
- {key: 'e', label: 'E'}
- ];
- picker.defaultGroupKeys = ['a', 'b', 'c', 'd', 'e'];
- this.addHTMLOutput(picker);
- });
-
- test('noGroupsAdded', function() {
- var picker = document.createElement(
- 'tr-ui-b-grouping-table-groupby-picker');
- picker.settingsKey = 'basic-test';
- picker.possibleGroups = [
- {key: 'a', label: 'A'},
- {key: 'b', label: 'B'},
- {key: 'c', label: 'C'},
- {key: 'd', label: 'D'},
- {key: 'e', label: 'E'}
- ];
- picker.defaultGroupKeys = [];
- this.addHTMLOutput(picker);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/heading.html b/chromium/third_party/catapult/tracing/tracing/ui/base/heading.html
deleted file mode 100644
index 0c884b65a96..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/heading.html
+++ /dev/null
@@ -1,142 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel='import' href='/tracing/ui/base/constants.html'>
-
-<polymer-element name='tr-ui-heading'>
- <template>
- <style>
- :host {
- background-color: rgb(243, 245, 247);
- border-right: 1px solid #8e8e8e;
- display: block;
- height: 100%;
- margin: 0;
- padding: 0 5px 0 0;
- }
-
- heading {
- display: block;
- overflow-x: hidden;
- text-align: left;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- #arrow {
- -webkit-flex: 0 0 auto;
- font-family: sans-serif;
- margin-left: 5px;
- margin-right: 5px;
- width: 8px;
- }
-
- #link, #heading_content {
- display: none;
- }
- </style>
- <heading id='heading' on-click='{{onHeadingDivClicked_}}'>
- <span id='arrow'></span>
- <span id='heading_content'></span>
- <tr-ui-a-analysis-link id='link'></tr-ui-a-analysis-link>
- </heading>
- </template>
-
- <script>
- 'use strict';
- Polymer({
- DOWN_ARROW: String.fromCharCode(0x25BE),
- RIGHT_ARROW: String.fromCharCode(0x25B8),
-
- ready: function(viewport) {
- // Minus 6 == 1px border + 5px padding right.
- this.style.width = (tr.ui.b.constants.HEADING_WIDTH - 6) + 'px';
-
- this.heading_ = '';
- this.expanded_ = true;
- this.arrowVisible_ = false;
- this.selectionGenerator_ = undefined;
-
- this.updateContents_();
- },
-
- get heading() {
- return this.heading_;
- },
-
- set heading(text) {
- if (this.heading_ === text)
- return;
-
- this.heading_ = text;
- this.updateContents_();
- },
-
- set arrowVisible(val) {
- if (this.arrowVisible_ === val)
- return;
-
- this.arrowVisible_ = !!val;
- this.updateContents_();
- },
-
- set tooltip(text) {
- this.$.heading.title = text;
- },
-
- set selectionGenerator(generator) {
- if (this.selectionGenerator_ === generator)
- return;
-
- this.selectionGenerator_ = generator;
- this.updateContents_();
- },
-
- get expanded() {
- return this.expanded_;
- },
-
- set expanded(expanded) {
- if (this.expanded_ === expanded)
- return;
-
- this.expanded_ = !!expanded;
- this.updateContents_();
- },
-
- onHeadingDivClicked_: function() {
- this.dispatchEvent(new tr.b.Event('heading-clicked', {'bubbles': true}));
- },
-
- updateContents_: function() {
- if (this.arrowVisible_) {
- this.$.arrow.style.display = '';
- } else {
- this.$.arrow.style.display = 'none';
- this.$.heading.style.display = this.expanded_ ? '' : 'none';
- }
-
- if (this.arrowVisible_) {
- this.$.arrow.textContent =
- this.expanded_ ? this.DOWN_ARROW : this.RIGHT_ARROW;
- }
-
- this.$.link.style.display = 'none';
- this.$.heading_content.style.display = 'none';
-
- if (this.selectionGenerator_) {
- this.$.link.style.display = 'inline-block';
- this.$.link.selection = this.selectionGenerator_;
- this.$.link.textContent = this.heading_;
- } else {
- this.$.heading_content.style.display = 'inline-block';
- this.$.heading_content.textContent = this.heading_;
- }
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/hot_key.html b/chromium/third_party/catapult/tracing/tracing/ui/base/hot_key.html
deleted file mode 100644
index 699b41a8e0a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/hot_key.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/guid.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- function HotKey(dict) {
- if (dict.eventType === undefined)
- throw new Error('eventType must be given');
- if (dict.keyCode === undefined && dict.keyCodes === undefined)
- throw new Error('keyCode or keyCodes must be given');
- if (dict.keyCode !== undefined && dict.keyCodes !== undefined)
- throw new Error('Only keyCode or keyCodes can be given');
- if (dict.callback === undefined)
- throw new Error('callback must be given');
-
- this.eventType_ = dict.eventType;
- this.keyCodes_ = [];
-
- if (dict.keyCode)
- this.pushKeyCode_(dict.keyCode);
- else if (dict.keyCodes) {
- dict.keyCodes.forEach(this.pushKeyCode_, this);
- }
-
- this.useCapture_ = !!dict.useCapture;
- this.callback_ = dict.callback;
- this.thisArg_ = dict.thisArg !== undefined ? dict.thisArg : undefined;
-
- this.helpText_ = dict.helpText !== undefined ? dict.helpText : undefined;
- }
-
- HotKey.prototype = {
- get eventType() {
- return this.eventType_;
- },
-
- get keyCodes() {
- return this.keyCodes_;
- },
-
- get helpText() {
- return this.helpText_;
- },
-
- call: function(e) {
- this.callback_.call(this.thisArg_, e);
- },
-
- pushKeyCode_: function(keyCode) {
- this.keyCodes_.push(keyCode);
- }
- };
-
- return {
- HotKey: HotKey
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/hotkey_controller.html b/chromium/third_party/catapult/tracing/tracing/ui/base/hotkey_controller.html
deleted file mode 100644
index 892b7e7593a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/hotkey_controller.html
+++ /dev/null
@@ -1,298 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/ui/base/hot_key.html">
-
-<polymer-element name="tv-ui-b-hotkey-controller">
- <script>
- 'use strict';
- Polymer({
- created: function() {
- this.isAttached_ = false;
- this.globalMode_ = false;
- this.slavedToParentController_ = undefined;
- this.curHost_ = undefined;
- this.childControllers_ = [];
-
- this.bubblingKeyDownHotKeys_ = {};
- this.capturingKeyDownHotKeys_ = {};
- this.bubblingKeyPressHotKeys_ = {};
- this.capturingKeyPressHotKeys_ = {};
-
- this.onBubblingKeyDown_ = this.onKey_.bind(this, false);
- this.onCapturingKeyDown_ = this.onKey_.bind(this, true);
- this.onBubblingKeyPress_ = this.onKey_.bind(this, false);
- this.onCapturingKeyPress_ = this.onKey_.bind(this, true);
- },
-
- attached: function() {
- this.isAttached_ = true;
-
- var host = this.findHost_();
- if (host.__hotkeyController)
- throw new Error('Multiple hotkey controllers attached to this host');
-
- host.__hotkeyController = this;
- this.curHost_ = host;
-
- var parentElement;
- if (host.parentElement)
- parentElement = host.parentElement;
- else
- parentElement = host.parentNode.host;
- var parentController = tr.b.getHotkeyControllerForElement(
- parentElement);
-
- if (parentController) {
- this.slavedToParentController_ = parentController;
- parentController.addChildController_(this);
- return;
- }
-
- host.addEventListener('keydown', this.onBubblingKeyDown_, false);
- host.addEventListener('keydown', this.onCapturingKeyDown_, true);
- host.addEventListener('keypress', this.onBubblingKeyPress_, false);
- host.addEventListener('keypress', this.onCapturingKeyPress_, true);
- },
-
- detached: function() {
- this.isAttached_ = false;
-
- var host = this.curHost_;
- if (!host)
- return;
-
- delete host.__hotkeyController;
- this.curHost_ = undefined;
-
- if (this.slavedToParentController_) {
- this.slavedToParentController_.removeChildController_(this);
- this.slavedToParentController_ = undefined;
- return;
- }
-
- host.removeEventListener('keydown', this.onBubblingKeyDown_, false);
- host.removeEventListener('keydown', this.onCapturingKeyDown_, true);
- host.removeEventListener('keypress', this.onBubblingKeyPress_, false);
- host.removeEventListener('keypress', this.onCapturingKeyPress_, true);
- },
-
- addChildController_: function(controller) {
- var i = this.childControllers_.indexOf(controller);
- if (i !== -1)
- throw new Error('Controller already registered');
- this.childControllers_.push(controller);
- },
-
- removeChildController_: function(controller) {
- var i = this.childControllers_.indexOf(controller);
- if (i === -1)
- throw new Error('Controller not registered');
- this.childControllers_.splice(i, 1);
- return controller;
- },
-
- getKeyMapForEventType_: function(eventType, useCapture) {
- if (eventType === 'keydown') {
- if (!useCapture)
- return this.bubblingKeyDownHotKeys_;
- else
- return this.capturingKeyDownHotKeys_;
- } else if (eventType === 'keypress') {
- if (!useCapture)
- return this.bubblingKeyPressHotKeys_;
- else
- return this.capturingKeyPressHotKeys_;
- } else {
- throw new Error('Unsupported key event');
- }
- },
-
- addHotKey: function(hotKey) {
- if (!(hotKey instanceof tr.ui.b.HotKey))
- throw new Error('hotKey must be a tr.ui.b.HotKey');
-
- var keyMap = this.getKeyMapForEventType_(
- hotKey.eventType, hotKey.useCapture);
-
- for (var i = 0; i < hotKey.keyCodes.length; i++) {
- var keyCode = hotKey.keyCodes[i];
- if (keyMap[keyCode])
- throw new Error('Key is already bound for keyCode=' + keyCode);
- }
-
- for (var i = 0; i < hotKey.keyCodes.length; i++) {
- var keyCode = hotKey.keyCodes[i];
- keyMap[keyCode] = hotKey;
- }
- return hotKey;
- },
-
- removeHotKey: function(hotKey) {
- if (!(hotKey instanceof tr.ui.b.HotKey))
- throw new Error('hotKey must be a tr.ui.b.HotKey');
-
- var keyMap = this.getKeyMapForEventType_(
- hotKey.eventType, hotKey.useCapture);
-
- for (var i = 0; i < hotKey.keyCodes.length; i++) {
- var keyCode = hotKey.keyCodes[i];
- if (!keyMap[keyCode])
- throw new Error('Key is not bound for keyCode=' + keyCode);
- keyMap[keyCode] = hotKey;
- }
- for (var i = 0; i < hotKey.keyCodes.length; i++) {
- var keyCode = hotKey.keyCodes[i];
- delete keyMap[keyCode];
- }
- return hotKey;
- },
-
- get globalMode() {
- return this.globalMode_;
- },
-
- set globalMode(globalMode) {
- var wasAttached = this.isAttached_;
- if (wasAttached)
- this.detached();
- this.globalMode_ = !!globalMode;
- if (wasAttached)
- this.attached();
- },
-
- get topmostConroller_() {
- if (this.slavedToParentController_)
- return this.slavedToParentController_.topmostConroller_;
- return this;
- },
-
- childRequestsGeneralFocus: function(child) {
- var topmost = this.topmostConroller_;
- if (topmost.curHost_) {
- if (topmost.curHost_.hasAttribute('tabIndex')) {
- topmost.curHost_.focus();
- } else {
- if (document.activeElement)
- document.activeElement.blur();
- }
- } else {
- if (document.activeElement)
- document.activeElement.blur();
- }
- },
-
- childRequestsBlur: function(child) {
- child.blur();
-
- var topmost = this.topmostConroller_;
- if (topmost.curHost_) {
- topmost.curHost_.focus();
- }
- },
-
- findHost_: function() {
- if (this.globalMode_) {
- return document.body;
- } else {
- if (this.parentElement)
- return this.parentElement;
-
- var node = this;
- while (node.parentNode) {
- node = node.parentNode;
- }
- return node.host;
- }
- },
-
- appendMatchingHotKeysTo_: function(matchedHotKeys,
- useCapture, e) {
- var localKeyMap = this.getKeyMapForEventType_(e.type, useCapture);
- var localHotKey = localKeyMap[e.keyCode];
- if (localHotKey)
- matchedHotKeys.push(localHotKey);
-
- for (var i = 0; i < this.childControllers_.length; i++) {
- var controller = this.childControllers_[i];
- controller.appendMatchingHotKeysTo_(matchedHotKeys,
- useCapture, e);
- }
- },
-
- onKey_: function(useCapture, e) {
- // Keys dispatched to INPUT elements still bubble, even when they're
- // handled. So, skip any events that targeted the input element.
- if (useCapture == false && e.path[0].tagName == 'INPUT')
- return;
-
- var sortedControllers;
-
- var matchedHotKeys = [];
- this.appendMatchingHotKeysTo_(matchedHotKeys, useCapture, e);
-
- if (matchedHotKeys.length === 0)
- return false;
-
- if (matchedHotKeys.length > 1) {
- // TODO(nduca): To do support for coddling hotKeys, we need to
- // sort the listeners by their capturing/bubbling order and then pick
- // the one that would topologically win the tie, per DOM dispatch rules.
- throw new Error('More than one hotKey is currently unsupported');
- }
-
-
- var hotKey = matchedHotKeys[0];
-
- var prevented = 0;
- prevented |= hotKey.call(e);
-
- // We want to return false if preventDefaulted, or one of the handlers
- // return false. But otherwise, we want to return undefiend.
- return !prevented && e.defaultPrevented;
- }
- });
- </script>
-</polymer-element>
-<script>
-'use strict';
-
-tr.exportTo('tr.b', function() {
-
- function getHotkeyControllerForElement(refElement) {
- var curElement = refElement;
- while (curElement) {
- if (curElement.tagName === 'tv-ui-b-hotkey-controller')
- return curElement;
-
- if (curElement.__hotkeyController)
- return curElement.__hotkeyController;
-
- if (curElement.parentElement) {
- curElement = curElement.parentElement;
- continue;
- }
-
- // Probably inside a shadow
- curElement = findHost(curElement);
- }
- return undefined;
- }
-
- function findHost(initialNode) {
- var node = initialNode;
- while (node.parentNode) {
- node = node.parentNode;
- }
- return node.host;
- }
-
- return {
- getHotkeyControllerForElement: getHotkeyControllerForElement
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/hotkey_controller_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/hotkey_controller_test.html
deleted file mode 100644
index 0895e724250..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/hotkey_controller_test.html
+++ /dev/null
@@ -1,138 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/ui/base/hotkey_controller.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var KeyEventManager = tr.b.KeyEventManager;
-
- function newKeyEvent(eventType, dict) {
- var e = new tr.b.Event(eventType, true, true);
- if (dict.keyCode === undefined)
- throw new Error('keyCode required');
- e.keyCode = dict.keyCode;
- return e;
- }
-
- test('simpleHotkeyManager', function() {
- var rootElement = document.createElement('div');
- document.body.appendChild(rootElement);
- try {
- var elementShadow = rootElement.createShadowRoot();
-
- var hkc = document.createElement('tv-ui-b-hotkey-controller');
- elementShadow.appendChild(hkc);
-
- var subElement = document.createElement('div');
- elementShadow.appendChild(subElement);
-
- assert.equal(tr.b.getHotkeyControllerForElement(subElement), hkc);
-
- var didGetCalled = false;
- hkc.addHotKey(new tr.ui.b.HotKey({
- eventType: 'keydown',
- keyCode: 73, useCapture: true,
- callback: function() {
- didGetCalled = true;
- }
- }));
-
- // Ensure it is called when events target the root element.
- var e = newKeyEvent('keydown', {keyCode: 73});
- rootElement.dispatchEvent(e);
- assert.isTrue(didGetCalled);
-
- // Ensure it is still called when we target the sub element.
- didGetCalled = false;
- var e = newKeyEvent('keydown', {keyCode: 73});
- subElement.dispatchEvent(e);
- assert.isTrue(didGetCalled);
-
- } finally {
- document.body.removeChild(rootElement);
- }
- });
-
- test('nestedHotkeyController', function() {
- var rootElement = document.createElement('div');
- document.body.appendChild(rootElement);
- try {
- var elementShadow = rootElement.createShadowRoot();
-
- var hkc = document.createElement('tv-ui-b-hotkey-controller');
- elementShadow.appendChild(hkc);
-
- var subElement = document.createElement('div');
- elementShadow.appendChild(subElement);
- assert.equal(tr.b.getHotkeyControllerForElement(elementShadow), hkc);
-
- var subHKC = document.createElement('tv-ui-b-hotkey-controller');
- subElement.appendChild(subHKC);
-
- assert.equal(tr.b.getHotkeyControllerForElement(subElement), subHKC);
-
- var didGetCalled = false;
- subHKC.addHotKey(new tr.ui.b.HotKey({
- eventType: 'keydown',
- keyCode: 73, useCapture: true,
- callback: function() {
- didGetCalled = true;
- }
- }));
-
- // Ensure it is called when events target the root element.
- var e = newKeyEvent('keydown', {keyCode: 73});
- rootElement.dispatchEvent(e);
- assert.isTrue(didGetCalled);
- } finally {
- document.body.removeChild(rootElement);
- }
- });
-
- test('inputInsideHKC', function() {
- var rootElement = document.createElement('div');
- document.body.appendChild(rootElement);
- try {
- var elementShadow = rootElement.createShadowRoot();
-
- var hkc = document.createElement('tv-ui-b-hotkey-controller');
- elementShadow.appendChild(hkc);
-
- var inputEl = document.createElement('input');
- elementShadow.appendChild(inputEl);
-
- var didGetCalled = false;
- hkc.addHotKey(new tr.ui.b.HotKey({
- eventType: 'keypress',
- keyCode: 'a'.charCodeAt(0), useCapture: false,
- callback: function() {
- didGetCalled = true;
- }
- }));
-
- // Ensure it is called when events target the root element.
- didGetCalled = false;
- var e = newKeyEvent('keypress', {keyCode: 'a'.charCodeAt(0)});
- rootElement.dispatchEvent(e);
- assert.isTrue(didGetCalled);
-
- // Handler should NOT be called when events target the input element.
- didGetCalled = false;
- var e = newKeyEvent('keypress', {keyCode: 'a'.charCodeAt(0)});
- inputEl.dispatchEvent(e);
- assert.isFalse(didGetCalled);
- } finally {
- document.body.removeChild(rootElement);
- }
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/info_bar.html b/chromium/third_party/catapult/tracing/tracing/ui/base/info_bar.html
deleted file mode 100644
index a9b188556d1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/info_bar.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<polymer-element name='tr-ui-b-info-bar' is='HTMLDivElement'>
- <template>
- <style>
- :host {
- align-items: center;
- flex: 0 0 auto;
- background-color: rgb(252, 235, 162);
- border-bottom: 1px solid #A3A3A3;
- border-left: 1px solid white;
- border-right: 1px solid #A3A3A3;
- border-top: 1px solid white;
- display: flex;
- height: 26px;
- padding: 0 3px 0 3px;
- }
-
- :host(.info-bar-hidden) {
- display: none;
- }
-
- #message { flex: 1 1 auto; }
- </style>
-
- <span id='message'></span>
- <span id='buttons'></span>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.messageEl_ = this.$.message;
- this.buttonsEl_ = this.$.buttons;
-
- this.message = '';
- this.visible = false;
- },
-
- get message() {
- return this.messageEl_.textContent;
- },
-
- set message(message) {
- this.messageEl_.textContent = message;
- },
-
- get visible() {
- return !this.classList.contains('info-bar-hidden');
- },
-
- set visible(visible) {
- if (visible)
- this.classList.remove('info-bar-hidden');
- else
- this.classList.add('info-bar-hidden');
- },
-
- removeAllButtons: function() {
- this.buttonsEl_.textContent = '';
- },
-
- addButton: function(text, clickCallback) {
- var button = document.createElement('button');
- button.textContent = text;
- button.addEventListener('click', clickCallback);
- this.buttonsEl_.appendChild(button);
- return button;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/info_bar_group.html b/chromium/third_party/catapult/tracing/tracing/ui/base/info_bar_group.html
deleted file mode 100644
index 4d44a1b1099..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/info_bar_group.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel='import' href='/tracing/ui/base/info_bar.html'>
-
-<polymer-element name='tr-ui-b-info-bar-group' is='HTMLUnknownElement'>
- <template>
- <style>
- :host {
- flex: 0 0 auto;
- flex-direction: column;
- display: flex;
- }
- </style>
- <div id='messages'></div>
- </template>
-
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.messages_ = [];
- },
-
- clearMessages: function() {
- this.messages_ = [];
- this.updateContents_();
- },
-
- addMessage: function(text, opt_buttons) {
- opt_buttons = opt_buttons || [];
- for (var i = 0; i < opt_buttons.length; i++) {
- if (opt_buttons[i].buttonText === undefined)
- throw new Error('buttonText must be provided');
- if (opt_buttons[i].onClick === undefined)
- throw new Error('onClick must be provided');
- }
-
- this.messages_.push({
- text: text,
- buttons: opt_buttons || []
- });
- this.updateContents_();
- },
-
- updateContents_: function() {
- this.$.messages.textContent = '';
- this.messages_.forEach(function(message) {
- var bar = document.createElement('tr-ui-b-info-bar');
- bar.message = message.text;
- bar.visible = true;
-
- message.buttons.forEach(function(button) {
- bar.addButton(button.buttonText, button.onClick);
- }, this);
-
- this.$.messages.appendChild(bar);
- }, this);
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/info_bar_group_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/info_bar_group_test.html
deleted file mode 100644
index 5600d4043a3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/info_bar_group_test.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/ui/base/info_bar_group.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('group-instantiate', function() {
- var infoBarGroup = document.createElement('tr-ui-b-info-bar-group');
- infoBarGroup.addMessage(
- 'Message 1',
- [{buttonText: 'ok', onClick: function() {}}]);
- infoBarGroup.addMessage(
- 'Message 2',
- [{buttonText: 'button 2', onClick: function() {}}]);
- this.addHTMLOutput(infoBarGroup);
- });
-
- test('group-populate-then-clear', function() {
- var infoBarGroup = document.createElement('tr-ui-b-info-bar-group');
- infoBarGroup.addMessage(
- 'Message 1',
- [{buttonText: 'ok', onClick: function() {}}]);
- infoBarGroup.addMessage(
- 'Message 2',
- [{buttonText: 'button 2', onClick: function() {}}]);
- infoBarGroup.clearMessages();
- assert.equal(infoBarGroup.children.length, 0);
- });
-
- test('group-populate-clear-repopulate', function() {
- var infoBarGroup = document.createElement('tr-ui-b-info-bar-group');
- infoBarGroup.addMessage(
- 'Message 1',
- [{buttonText: 'ok', onClick: function() {}}]);
- infoBarGroup.addMessage(
- 'Message 2',
- [{buttonText: 'button 2', onClick: function() {}}]);
- infoBarGroup.clearMessages();
- infoBarGroup.addMessage(
- 'Message 1',
- [{buttonText: 'ok', onClick: function() {}}]);
- this.addHTMLOutput(infoBarGroup);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/info_bar_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/info_bar_test.html
deleted file mode 100644
index fffec0f8d4b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/info_bar_test.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/ui/base/info_bar.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var infoBar = document.createElement('tr-ui-b-info-bar');
- infoBar.message = 'This is an info';
- infoBar.visible = true;
- this.addHTMLOutput(infoBar);
- });
-
- test('buttons', function() {
- var infoBar = document.createElement('tr-ui-b-info-bar');
- infoBar.visible = true;
- infoBar.message = 'This is an info bar with buttons';
- var didClick = false;
- var button = infoBar.addButton('More info...', function() {
- didClick = true;
- });
- button.click();
- assert.isTrue(didClick);
- this.addHTMLOutput(infoBar);
- });
-
- test('hiding', function() {
- var infoBar = document.createElement('tr-ui-b-info-bar');
- infoBar.message = 'This is an info bar';
- infoBar.visible = true;
- this.addHTMLOutput(infoBar);
-
- assert.equal(getComputedStyle(infoBar)['display'], 'flex');
-
- infoBar.visible = false;
- assert.equal(getComputedStyle(infoBar)['display'], 'none');
-
- infoBar.visible = true;
- assert.equal(getComputedStyle(infoBar)['display'], 'flex');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/line_chart.css b/chromium/third_party/catapult/tracing/tracing/ui/base/line_chart.css
deleted file mode 100644
index e2c945b8be3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/line_chart.css
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Copyright 2014 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-* /deep/ .line-chart .line {
- fill: none;
- stroke-width: 1.5px;
-}
-
-* /deep/ .line-chart #brushes > rect {
- fill: rgb(192, 192, 192);
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/line_chart.html b/chromium/third_party/catapult/tracing/tracing/ui/base/line_chart.html
deleted file mode 100644
index ba431695242..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/line_chart.html
+++ /dev/null
@@ -1,63 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/chart_base_2d_brushable_x.html">
-
-<link rel="stylesheet" href="/tracing/ui/base/line_chart.css">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- var ChartBase2DBrushX = tr.ui.b.ChartBase2DBrushX;
-
- /**
- * @constructor
- */
- var LineChart = tr.ui.b.define('line-chart', ChartBase2DBrushX);
-
- LineChart.prototype = {
- __proto__: ChartBase2DBrushX.prototype,
-
- decorate: function() {
- ChartBase2DBrushX.prototype.decorate.call(this);
- this.classList.add('line-chart');
- },
-
- isDatumFieldSeries_: function(fieldName) {
- return fieldName != 'x';
- },
-
- getXForDatum_: function(datum, index) {
- return datum.x;
- },
-
- updateDataContents_: function(dataSel) {
- dataSel.selectAll('*').remove();
- var dataBySeriesKey = this.getDataBySeriesKey_();
- var pathsSel = dataSel.selectAll('path').data(this.seriesKeys_);
- pathsSel.enter()
- .append('path')
- .attr('class', 'line')
- .style('stroke', function(key) {
- return tr.ui.b.getColorOfKey(key);
- })
- .attr('d', function(key) {
- var line = d3.svg.line()
- .x(function(d) { return this.xScale_(d.x); }.bind(this))
- .y(function(d) { return this.yScale_(d[key]); }.bind(this));
- return line(dataBySeriesKey[key]);
- }.bind(this));
- pathsSel.exit().remove();
- }
- };
-
- return {
- LineChart: LineChart
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/line_chart_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/line_chart_test.html
deleted file mode 100644
index 5a6cc13b754..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/line_chart_test.html
+++ /dev/null
@@ -1,163 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/ui/base/line_chart.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiation_singleSeries', function() {
- var chart = new tr.ui.b.LineChart();
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 10, y: 100},
- {x: 20, y: 110},
- {x: 30, y: 100},
- {x: 40, y: 50}
- ];
- chart.data = data;
- this.addHTMLOutput(chart);
- });
-
- test('instantiation_twoSeries', function() {
- var chart = new tr.ui.b.LineChart();
-
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 10, alpha: 100, beta: 50},
- {x: 20, alpha: 110, beta: 75},
- {x: 30, alpha: 100, beta: 125},
- {x: 40, alpha: 50, beta: 125}
- ];
- chart.data = data;
-
- var r = new tr.b.Range();
- r.addValue(20);
- r.addValue(40);
- chart.brushedRange = r;
-
- this.addHTMLOutput(chart);
- });
-
- test('instantiation_twoSparseSeriesWithFirstValueSparse', function() {
- var chart = new tr.ui.b.LineChart();
-
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 10, alpha: 20, beta: undefined},
- {x: 20, alpha: undefined, beta: 10},
- {x: 30, alpha: 10, beta: undefined},
- {x: 45, alpha: undefined, beta: 20},
- {x: 50, alpha: 30, beta: 30}
- ];
- chart.data = data;
-
- this.addHTMLOutput(chart);
- });
-
- test('instantiation_twoSparseSeriesWithFirstValueNotSparse', function() {
- var chart = new tr.ui.b.LineChart();
-
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 10, alpha: 20, beta: 40},
- {x: 20, alpha: undefined, beta: 10},
- {x: 30, alpha: 10, beta: undefined},
- {x: 45, alpha: undefined, beta: 20},
- {x: 50, alpha: 30, beta: undefined}
- ];
- chart.data = data;
-
- this.addHTMLOutput(chart);
- });
-
- test('brushRangeFromIndices', function() {
- var chart = new tr.ui.b.LineChart();
- var data = [
- {x: 10, value: 50},
- {x: 30, value: 60},
- {x: 70, value: 70},
- {x: 80, value: 80},
- {x: 120, value: 90}
- ];
- chart.data = data;
- var r = new tr.b.Range();
-
- // Range min should be 10.
- r = chart.computeBrushRangeFromIndices(-2, 1);
- assert.equal(r.min, 10);
-
- // Range max should be 120.
- r = chart.computeBrushRangeFromIndices(3, 10);
- assert.equal(r.max, 120);
-
- // Range should be [10, 120]
- r = chart.computeBrushRangeFromIndices(-2, 10);
- assert.equal(r.min, 10);
- assert.equal(r.max, 120);
-
- // Range should be [20, 100]
- r = chart.computeBrushRangeFromIndices(1, 3);
- assert.equal(r.min, 20);
- assert.equal(r.max, 100);
- });
-
- test('instantiation_interactiveBrushing', function() {
- var chart = new tr.ui.b.LineChart();
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 10, value: 50},
- {x: 20, value: 60},
- {x: 30, value: 80},
- {x: 40, value: 20},
- {x: 50, value: 30},
- {x: 60, value: 20},
- {x: 70, value: 15},
- {x: 80, value: 20}
- ];
- chart.data = data;
-
- var mouseDownIndex = undefined;
- var curMouseIndex = undefined;
-
- function updateBrushedRange() {
- if (mouseDownIndex === undefined) {
- chart.brushedRange = new tr.b.Range();
- return;
- }
- chart.brushedRange = chart.computeBrushRangeFromIndices(
- mouseDownIndex, curMouseIndex);
- }
-
- chart.addEventListener('item-mousedown', function(e) {
- mouseDownIndex = e.index;
- curMouseIndex = e.index;
- updateBrushedRange();
- });
- chart.addEventListener('item-mousemove', function(e) {
- if (e.button == undefined)
- return;
- curMouseIndex = e.index;
- updateBrushedRange();
- });
- chart.addEventListener('item-mouseup', function(e) {
- curMouseIndex = e.index;
- updateBrushedRange();
- });
- this.addHTMLOutput(chart);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/list_and_associated_view.css b/chromium/third_party/catapult/tracing/tracing/ui/base/list_and_associated_view.css
deleted file mode 100644
index 78319f3d8db..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/list_and_associated_view.css
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-* /deep/ x-list-and-associated-view {
- -webkit-flex-direction: row;
- display: -webkit-flex;
-}
-
-* /deep/ x-list-and-associated-view > .x-list-view {
- min-width: 100px;
-}
-
-* /deep/ x-list-and-associated-view > :nth-child(2) {
- -webkit-flex: 1;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/list_and_associated_view.html b/chromium/third_party/catapult/tracing/tracing/ui/base/list_and_associated_view.html
deleted file mode 100644
index 3d1d8260954..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/list_and_associated_view.html
+++ /dev/null
@@ -1,138 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/base/list_and_associated_view.css">
-
-<link rel="import" href="/tracing/ui/base/list_view.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview A list of things, and a viewer for the currently selected
- * thing.
- */
-tr.exportTo('tr.ui.b', function() {
-
- /**
- * @constructor
- */
- var ListAndAssociatedView = tr.ui.b.define('x-list-and-associated-view');
- ListAndAssociatedView.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.list_ = undefined;
- this.listProperty_ = undefined;
- this.view_ = undefined;
- this.viewProperty_ = undefined;
- this.listView_ = new tr.ui.b.ListView();
- this.listView_.addEventListener('selection-changed',
- this.onSelectionChanged_.bind(this));
- this.placeholder_ = document.createElement('div');
- this.appendChild(this.listView_);
- this.appendChild(this.placeholder_);
- },
-
- get listView() {
- return this.listView_;
- },
-
- get list() {
- return this.list_;
- },
-
- set list(list) {
- this.list_ = list;
- this.updateChildren_();
- },
-
- get listProperty() {
- return this.listProperty_;
- },
-
- set listProperty(listProperty) {
- this.listProperty_ = listProperty;
- this.updateChildren_();
- },
-
- get view() {
- return this.view_;
- },
-
- set view(view) {
- this.view_ = view;
- this.updateChildren_();
- },
-
- get viewProperty() {
- return this.viewProperty_;
- },
-
- set viewProperty(viewProperty) {
- this.viewProperty_ = viewProperty;
- this.updateChildren_();
- },
-
- updateChildren_: function() {
- var complete = this.list_ &&
- this.listProperty_ &&
- this.view_ &&
- this.viewProperty_;
- if (!complete) {
- this.replaceChild(this.placeholder_,
- this.children[1]);
- return;
- }
-
- for (var i = 0; i < this.list_.length; i++) {
- var itemEl;
- if (i >= this.listView_.children.length) {
- itemEl = document.createElement('div');
- this.listView_.appendChild(itemEl);
- } else {
- itemEl = this.listView_.children[i];
- }
- itemEl.item = this.list_[i];
- var getter = this.list_[i].__lookupGetter__(this.listProperty_);
- if (getter)
- itemEl.textContent = getter.call(this.list_[i]);
- else
- itemEl.textContent = this.list_[i][this.listProperty_];
- }
-
- if (this.children[1] == this.placeholder_) {
- this.replaceChild(this.view_,
- this.children[1]);
- }
- if (this.listView_.children.length &&
- !this.listView_.selectedElement)
- this.listView_.selectedElement = this.listView_.children[0];
- },
-
- onSelectionChanged_: function(e) {
- var setter = this.view_.__lookupSetter__(this.viewProperty_);
- if (!setter) {
- var prop = this.viewProperty_;
- setter = function(value) { this[prop] = value; }
- }
- if (this.listView_.selectedElement) {
- setter.call(this.view_,
- this.listView_.selectedElement.item);
- } else {
- setter.call(this.view_,
- undefined);
- }
- }
- };
-
- return {
- ListAndAssociatedView: ListAndAssociatedView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/list_and_associated_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/list_and_associated_view_test.html
deleted file mode 100644
index f35a8b26861..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/list_and_associated_view_test.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/ui/base/list_and_associated_view.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ListAndAssociatedView = tr.ui.b.ListAndAssociatedView;
-
- var SimpleView = tr.ui.b.define('div');
- SimpleView.prototype = {
- __proto__: HTMLDivElement.prototype,
-
- decorate: function() {
- this.item_ = undefined;
- },
-
- set item(item) {
- this.item_ = item;
- },
- get item() {
- return this.item_;
- }
- };
-
- test('listViewNamingWithField', function() {
- var lav = new ListAndAssociatedView();
- var list = [
- {x: '1'},
- {x: '2'},
- {x: '3'}
- ];
- var view = new SimpleView();
-
- lav.list = list;
- lav.listProperty = 'x';
- lav.view = view;
- lav.viewProperty = 'item';
-
- var lavListView = lav.listView;
- assert.equal(lavListView.children.length, 3);
- assert.equal(lavListView.children[0].textContent, '1');
- });
-
- test('listViewNamingWithProperty', function() {
- var lav = new ListAndAssociatedView();
-
- function X(x) {
- this.x = x;
- }
- X.prototype = {
- get title() {
- return this.x;
- }
- };
-
- var list = [
- new X('1'),
- new X('2'),
- new X('3')
- ];
- var view = new SimpleView();
-
- lav.list = list;
- lav.listProperty = 'title';
- lav.view = view;
- lav.viewProperty = 'item';
-
- var lavListView = lav.listView;
- assert.equal(lavListView.children.length, 3);
- assert.equal(lavListView.children[0].textContent, '1');
- });
-
- test('selectionChangesView', function() {
- var lav = new ListAndAssociatedView();
- var list = [
- {x: '1'},
- {x: '2'},
- {x: '3'}
- ];
- var view = new SimpleView();
-
- lav.list = list;
- lav.listProperty = 'x';
- lav.view = view;
- lav.viewProperty = 'item';
- var lavListView = lav.listView;
-
- assert.equal(list[0], view.item);
- lavListView.children[1].selected = true;
- assert.equal(list[1], view.item);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/list_view.css b/chromium/third_party/catapult/tracing/tracing/ui/base/list_view.css
deleted file mode 100644
index 0a9ef18ed67..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/list_view.css
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-* /deep/ .x-list-view {
- -webkit-user-select: none;
- display: block;
-}
-* /deep/ .x-list-view:focus {
- outline: none;
-}
-
-* /deep/ .x-list-view * {
- -webkit-user-select: none;
-}
-
-* /deep/ .x-list-view > .list-item {
- padding: 2px 4px 2px 4px;
-}
-
-* /deep/ .x-list-view:focus > .list-item[selected] {
- background-color: rgb(171, 217, 202);
- outline: 1px dotted rgba(0,0,0,0.1);
- outline-offset: 0;
-}
-
-* /deep/ .x-list-view > .list-item[selected] {
- background-color: rgb(103, 199, 165);
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/list_view.html b/chromium/third_party/catapult/tracing/tracing/ui/base/list_view.html
deleted file mode 100644
index c8279565620..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/list_view.html
+++ /dev/null
@@ -1,167 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/base/list_view.css">
-
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/ui/base/container_that_decorates_its_children.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/base/utils.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Simple list view.
- */
-tr.exportTo('tr.ui.b', function() {
- /**
- * @constructor
- */
- var ListView = tr.ui.b.define(
- 'x-list-view', tr.ui.b.ContainerThatDecoratesItsChildren);
-
- ListView.prototype = {
- __proto__: tr.ui.b.ContainerThatDecoratesItsChildren.prototype,
-
- decorate: function() {
- tr.ui.b.ContainerThatDecoratesItsChildren.prototype.decorate.call(this);
-
- this.classList.add('x-list-view');
- this.onItemClicked_ = this.onItemClicked_.bind(this);
- this.onKeyDown_ = this.onKeyDown_.bind(this);
- this.tabIndex = 0;
- this.addEventListener('keydown', this.onKeyDown_);
-
- this.selectionChanged_ = false;
- },
-
- decorateChild_: function(item) {
- item.classList.add('list-item');
- item.addEventListener('click', this.onItemClicked_, true);
-
- var listView = this;
- Object.defineProperty(
- item,
- 'selected', {
- configurable: true,
- set: function(value) {
- var oldSelection = listView.selectedElement;
- if (oldSelection && oldSelection != this && value)
- listView.selectedElement.removeAttribute('selected');
- if (value)
- this.setAttribute('selected', 'selected');
- else
- this.removeAttribute('selected');
- var newSelection = listView.selectedElement;
- if (newSelection != oldSelection)
- tr.b.dispatchSimpleEvent(listView, 'selection-changed', false);
- },
- get: function() {
- return this.hasAttribute('selected');
- }
- });
- },
-
- undecorateChild_: function(item) {
- this.selectionChanged_ |= item.selected;
-
- item.classList.remove('list-item');
- item.removeEventListener('click', this.onItemClicked_);
- delete item.selected;
- },
-
- beginDecorating_: function() {
- this.selectionChanged_ = false;
- },
-
- doneDecoratingForNow_: function() {
- if (this.selectionChanged_)
- tr.b.dispatchSimpleEvent(this, 'selection-changed', false);
- },
-
- get selectedElement() {
- var el = this.querySelector('.list-item[selected]');
- if (!el)
- return undefined;
- return el;
- },
-
- set selectedElement(el) {
- if (!el) {
- if (this.selectedElement)
- this.selectedElement.selected = false;
- return;
- }
-
- if (el.parentElement != this)
- throw new Error(
- 'Can only select elements that are children of this list view');
- el.selected = true;
- },
-
- getElementByIndex: function(index) {
- return this.querySelector('.list-item:nth-child(' + index + ')');
- },
-
- clear: function() {
- var changed = this.selectedElement !== undefined;
- tr.ui.b.ContainerThatDecoratesItsChildren.prototype.clear.call(this);
- if (changed)
- tr.b.dispatchSimpleEvent(this, 'selection-changed', false);
- },
-
- onItemClicked_: function(e) {
- var currentSelectedElement = this.selectedElement;
- if (currentSelectedElement)
- currentSelectedElement.removeAttribute('selected');
- var element = e.target;
- while (element.parentElement != this)
- element = element.parentElement;
- if (element !== currentSelectedElement)
- element.setAttribute('selected', 'selected');
- tr.b.dispatchSimpleEvent(this, 'selection-changed', false);
- },
-
- onKeyDown_: function(e) {
- if (this.selectedElement === undefined)
- return;
-
- if (e.keyCode == 38) { // Up arrow.
- var prev = this.selectedElement.previousSibling;
- if (prev) {
- prev.selected = true;
- tr.ui.b.scrollIntoViewIfNeeded(prev);
- e.preventDefault();
- return true;
- }
- } else if (e.keyCode == 40) { // Down arrow.
- var next = this.selectedElement.nextSibling;
- if (next) {
- next.selected = true;
- tr.ui.b.scrollIntoViewIfNeeded(next);
- e.preventDefault();
- return true;
- }
- }
- },
-
- addItem: function(textContent) {
- var item = document.createElement('div');
- item.textContent = textContent;
- this.appendChild(item);
- return item;
- }
-
- };
-
- return {
- ListView: ListView
- };
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/list_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/list_view_test.html
deleted file mode 100644
index 4f068437088..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/list_view_test.html
+++ /dev/null
@@ -1,67 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/ui/base/list_view.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ListView = tr.ui.b.ListView;
-
- test('instantiate', function() {
- var view = new ListView();
- var i1 = view.addItem('item 1');
- var i2 = view.addItem('item 2');
- var i3 = view.addItem('item 3');
- this.addHTMLOutput(view);
- });
-
- test('programmaticSelection', function() {
- var view = new ListView();
- var i1 = view.addItem('item 1');
- var i2 = view.addItem('item 2');
- var i3 = view.addItem('item 3');
-
- i2.selected = true;
- assert.isTrue(i2.hasAttribute('selected'));
- i3.selected = true;
- assert.isFalse(i2.hasAttribute('selected'));
- assert.isTrue(i3.hasAttribute('selected'));
- });
-
- test('clickSelection', function() {
- var view = new ListView();
- var didFireSelectionChange = false;
- view.addEventListener('selection-changed', function() {
- didFireSelectionChange = true;
- });
- var i1 = view.addItem('item 1');
- var i2 = view.addItem('item 2');
- var i3 = view.addItem('item 3');
-
- didFireSelectionChange = false;
- i2.click();
- assert.isTrue(didFireSelectionChange);
- assert.equal(view.selectedElement, i2);
-
- didFireSelectionChange = false;
- i3.click();
- assert.isTrue(didFireSelectionChange);
- assert.equal(view.selectedElement, i3);
-
- // Click the same target again.
- didFireSelectionChange = false;
- i3.click();
- assert.isTrue(didFireSelectionChange);
- assert.isUndefined(view.selectedElement);
-
- didFireSelectionChange = false;
- i1.click();
- assert.isTrue(didFireSelectionChange);
- assert.equal(view.selectedElement, i1);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_icon.html b/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_icon.html
deleted file mode 100644
index f31837e5c1b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_icon.html
+++ /dev/null
@@ -1,112 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/ui/base/mouse_modes.html">
-
-<polymer-element name="tr-ui-b-mouse-mode-icon">
- <template>
- <style>
- :host {
- display: block;
- background-image: url(../images/ui-states.png);
- width: 27px;
- height: 30px;
- }
- :host.active {
- cursor: auto;
- }
- </style>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- publish: {
- modeName: {
- value: undefined,
- reflect: true
- }
- },
-
- created: function() {
- this.active_ = false;
- this.acceleratorKey_ = undefined;
- },
-
- ready: function() {
- this.updateContents_();
- },
-
- get mode() {
- return tr.ui.b.MOUSE_SELECTOR_MODE[this.modeName];
- },
-
- set mode(mode) {
- var modeInfo = tr.ui.b.MOUSE_SELECTOR_MODE_INFOS[mode];
- var modeName = tr.b.findFirstKeyInDictMatching(
- tr.ui.b.MOUSE_SELECTOR_MODE,
- function(modeName, candidateMode) {
- return candidateMode === mode;
- });
- if (modeName === undefined)
- throw new Error('Unknown mode');
- this.modeName = modeName;
- },
-
- modeNameChanged: function() {
- this.updateContents_();
- },
-
- get active() {
- return this.active_;
- },
-
- set active(active) {
- this.active_ = !!active;
- if (this.active_)
- this.classList.add('active');
- else
- this.classList.remove('active');
- this.updateContents_();
- },
-
- get acceleratorKey() {
- return this.acceleratorKey_;
- },
-
- set acceleratorKey(acceleratorKey) {
- this.acceleratorKey_ = acceleratorKey;
- this.updateContents_();
- },
-
- updateContents_: function() {
- if (this.modeName === undefined)
- return;
-
- var mode = this.mode;
- if (mode === undefined)
- throw new Error('Invalid mode');
-
- var modeInfo = tr.ui.b.MOUSE_SELECTOR_MODE_INFOS[mode];
- if (!modeInfo)
- throw new Error('Invalid mode');
-
- var title = modeInfo.title;
- if (this.acceleratorKey_)
- title = title + ' (' + this.acceleratorKey_ + ')';
- this.title = title;
-
- var bp;
- if (this.active_)
- bp = modeInfo.activeBackgroundPosition;
- else
- bp = modeInfo.defaultBackgroundPosition;
- this.style.backgroundPosition = bp;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_icon_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_icon_test.html
deleted file mode 100644
index 905a1bbcf0d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_icon_test.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/settings.html">
-<link rel="import" href="/tracing/ui/base/mouse_mode_icon.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var MOUSE_SELECTOR_MODE = tr.ui.b.MOUSE_SELECTOR_MODE;
-
- test('inactive', function() {
- var icon = document.createElement('tr-ui-b-mouse-mode-icon');
- icon.mode = MOUSE_SELECTOR_MODE.SELECTION;
- assert.equal(icon.modeName, 'SELECTION');
- icon.acceleratorKey = 'a';
- this.addHTMLOutput(icon);
- });
-
- test('active', function() {
- var icon = document.createElement('tr-ui-b-mouse-mode-icon');
- icon.mode = MOUSE_SELECTOR_MODE.SELECTION;
- assert.equal(icon.modeName, 'SELECTION');
- icon.active = true;
- this.addHTMLOutput(icon);
- });
-
- test('modeNameSetter', function() {
- var icon = document.createElement('tr-ui-b-mouse-mode-icon');
- icon.setAttribute('modeName', 'SELECTION');
- this.addHTMLOutput(icon);
-
- return Promise.resolve().then(function() {
- assert.equal(icon.mode, 1);
- });
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_selector.html b/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_selector.html
deleted file mode 100644
index a8980d5ee8d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_selector.html
+++ /dev/null
@@ -1,574 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/ui/base/hotkey_controller.html">
-<link rel="import" href="/tracing/ui/base/mouse_tracker.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/base/utils.html">
-<link rel="import" href="/tracing/ui/base/mouse_modes.html">
-<link rel="import" href="/tracing/ui/base/mouse_mode_icon.html">
-
-<polymer-element name="tr-ui-b-mouse-mode-selector">
- <template>
- <style>
- :host {
-
- -webkit-user-drag: element;
- -webkit-user-select: none;
-
- background: #DDD;
- border: 1px solid #BBB;
- border-radius: 4px;
- box-shadow: 0 1px 2px rgba(0,0,0,0.2);
- left: calc(100% - 120px);
- position: absolute;
- top: 100px;
- user-select: none;
- width: 29px;
- z-index: 20;
- }
-
- .drag-handle {
- background: url(../images/ui-states.png) 2px 3px no-repeat;
- background-repeat: no-repeat;
- border-bottom: 1px solid #BCBCBC;
- cursor: move;
- display: block;
- height: 13px;
- width: 27px;
- }
-
- .tool-button {
- background-position: center center;
- background-repeat: no-repeat;
- border-bottom: 1px solid #BCBCBC;
- border-top: 1px solid #F1F1F1;
- cursor: pointer;
- }
-
- .buttons > .tool-button:last-child {
- border-bottom: none;
- }
-
- </style>
- <div class="drag-handle"></div>
- <div class="buttons">
- </div>
- </template>
-</polymer-element>
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- var MOUSE_SELECTOR_MODE = tr.ui.b.MOUSE_SELECTOR_MODE;
- var MOUSE_SELECTOR_MODE_INFOS = tr.ui.b.MOUSE_SELECTOR_MODE_INFOS;
-
-
- var MIN_MOUSE_SELECTION_DISTANCE = 4;
-
- var MODIFIER = {
- SHIFT: 0x1,
- SPACE: 0x2,
- CMD_OR_CTRL: 0x4
- };
-
- function isCmdOrCtrlPressed(event) {
- if (tr.isMac)
- return event.metaKey;
- else
- return event.ctrlKey;
- }
-
- /**
- * Provides a panel for switching the interaction mode of the mouse.
- * It handles the user interaction and dispatches events for the various
- * modes.
- */
- Polymer('tr-ui-b-mouse-mode-selector', {
- __proto__: HTMLDivElement.prototype,
-
- created: function() {
- this.supportedModeMask_ = MOUSE_SELECTOR_MODE.ALL_MODES;
-
- this.initialRelativeMouseDownPos_ = {x: 0, y: 0};
-
- this.defaultMode_ = MOUSE_SELECTOR_MODE.PANSCAN;
- this.settingsKey_ = undefined;
- this.mousePos_ = {x: 0, y: 0};
- this.mouseDownPos_ = {x: 0, y: 0};
-
- this.onMouseDown_ = this.onMouseDown_.bind(this);
- this.onMouseMove_ = this.onMouseMove_.bind(this);
- this.onMouseUp_ = this.onMouseUp_.bind(this);
-
- this.onKeyDown_ = this.onKeyDown_.bind(this);
- this.onKeyUp_ = this.onKeyUp_.bind(this);
-
- this.mode_ = undefined;
- this.modeToKeyCodeMap_ = {};
- this.modifierToModeMap_ = {};
-
- this.targetElement_ = undefined;
- this.modeBeforeAlternativeModeActivated_ = null;
-
- this.isInteracting_ = false;
- this.isClick_ = false;
- },
-
- ready: function() {
- this.buttonsEl_ = this.shadowRoot.querySelector('.buttons');
- this.dragHandleEl_ = this.shadowRoot.querySelector('.drag-handle');
- this.supportedModeMask = MOUSE_SELECTOR_MODE.ALL_MODES;
-
- this.dragHandleEl_.addEventListener('mousedown',
- this.onDragHandleMouseDown_.bind(this));
-
- this.buttonsEl_.addEventListener('mouseup', this.onButtonMouseUp_);
- this.buttonsEl_.addEventListener('mousedown', this.onButtonMouseDown_);
- this.buttonsEl_.addEventListener('click', this.onButtonPress_.bind(this));
- },
-
- attached: function() {
- document.addEventListener('keydown', this.onKeyDown_);
- document.addEventListener('keyup', this.onKeyUp_);
- },
-
- detached: function() {
- document.removeEventListener('keydown', this.onKeyDown_);
- document.removeEventListener('keyup', this.onKeyUp_);
- },
-
- get targetElement() {
- return this.targetElement_;
- },
-
- set targetElement(target) {
- if (this.targetElement_)
- this.targetElement_.removeEventListener('mousedown', this.onMouseDown_);
- this.targetElement_ = target;
- if (this.targetElement_)
- this.targetElement_.addEventListener('mousedown', this.onMouseDown_);
- },
-
- get defaultMode() {
- return this.defaultMode_;
- },
-
- set defaultMode(defaultMode) {
- this.defaultMode_ = defaultMode;
- },
-
- get settingsKey() {
- return this.settingsKey_;
- },
-
- set settingsKey(settingsKey) {
- this.settingsKey_ = settingsKey;
- if (!this.settingsKey_)
- return;
-
- var mode = tr.b.Settings.get(this.settingsKey_ + '.mode', undefined);
- // Modes changed from 1,2,3,4 to 0x1, 0x2, 0x4, 0x8. Fix any stray
- // settings to the best of our abilities.
- if (MOUSE_SELECTOR_MODE_INFOS[mode] === undefined)
- mode = undefined;
-
- // Restoring settings against unsupported modes should just go back to the
- // default mode.
- if ((mode & this.supportedModeMask_) === 0)
- mode = undefined;
-
- if (!mode)
- mode = this.defaultMode_;
- this.mode = mode;
-
- var pos = tr.b.Settings.get(this.settingsKey_ + '.pos', undefined);
- if (pos)
- this.pos = pos;
- },
-
- get supportedModeMask() {
- return this.supportedModeMask_;
- },
-
- /**
- * Sets the supported modes. Should be an OR-ing of MOUSE_SELECTOR_MODE
- * values.
- */
- set supportedModeMask(supportedModeMask) {
- if (this.mode && (supportedModeMask & this.mode) === 0)
- throw new Error('supportedModeMask must include current mode.');
-
- function createButtonForMode(mode) {
- return button;
- }
-
- this.supportedModeMask_ = supportedModeMask;
- this.buttonsEl_.textContent = '';
- for (var modeName in MOUSE_SELECTOR_MODE) {
- if (modeName == 'ALL_MODES')
- continue;
- var mode = MOUSE_SELECTOR_MODE[modeName];
- if ((this.supportedModeMask_ & mode) === 0)
- continue;
-
- var button = document.createElement('tr-ui-b-mouse-mode-icon');
- button.mode = mode;
- button.classList.add('tool-button');
-
- this.buttonsEl_.appendChild(button);
- }
- },
-
- getButtonForMode_: function(mode) {
- for (var i = 0; i < this.buttonsEl_.children.length; i++) {
- var buttonEl = this.buttonsEl_.children[i];
- if (buttonEl.mode === mode)
- return buttonEl;
- }
- return undefined;
- },
-
- get mode() {
- return this.currentMode_;
- },
-
- set mode(newMode) {
- if (newMode !== undefined) {
- if (typeof newMode !== 'number')
- throw new Error('Mode must be a number');
- if ((newMode & this.supportedModeMask_) === 0)
- throw new Error('Cannot switch to this mode, it is not supported');
- if (MOUSE_SELECTOR_MODE_INFOS[newMode] === undefined)
- throw new Error('Unrecognized mode');
- }
-
- var modeInfo;
-
- if (this.currentMode_ === newMode)
- return;
-
- if (this.currentMode_) {
- var buttonEl = this.getButtonForMode_(this.currentMode_);
- if (buttonEl)
- buttonEl.active = false;
-
- // End event.
- if (this.isInteracting_) {
-
- var mouseEvent = this.createEvent_(
- MOUSE_SELECTOR_MODE_INFOS[this.mode].eventNames.end);
- this.dispatchEvent(mouseEvent);
- }
-
- // Exit event.
- modeInfo = MOUSE_SELECTOR_MODE_INFOS[this.currentMode_];
- tr.b.dispatchSimpleEvent(this, modeInfo.eventNames.exit, true);
- }
-
- this.currentMode_ = newMode;
-
- if (this.currentMode_) {
- var buttonEl = this.getButtonForMode_(this.currentMode_);
- if (buttonEl)
- buttonEl.active = true;
-
- // Entering a new mode resets mouse down pos.
- this.mouseDownPos_.x = this.mousePos_.x;
- this.mouseDownPos_.y = this.mousePos_.y;
-
- // Enter event.
- modeInfo = MOUSE_SELECTOR_MODE_INFOS[this.currentMode_];
- if (!this.isInAlternativeMode_)
- tr.b.dispatchSimpleEvent(this, modeInfo.eventNames.enter, true);
-
- // Begin event.
- if (this.isInteracting_) {
- var mouseEvent = this.createEvent_(
- MOUSE_SELECTOR_MODE_INFOS[this.mode].eventNames.begin);
- this.dispatchEvent(mouseEvent);
- }
-
-
- }
-
- if (this.settingsKey_ && !this.isInAlternativeMode_)
- tr.b.Settings.set(this.settingsKey_ + '.mode', this.mode);
- },
-
- setKeyCodeForMode: function(mode, keyCode) {
- if ((mode & this.supportedModeMask_) === 0)
- throw new Error('Mode not supported');
- this.modeToKeyCodeMap_[mode] = keyCode;
-
- if (!this.buttonsEl_)
- return;
-
- var buttonEl = this.getButtonForMode_(mode);
- if (buttonEl)
- buttonEl.acceleratorKey = String.fromCharCode(keyCode);
- },
-
- setCurrentMousePosFromEvent_: function(e) {
- this.mousePos_.x = e.clientX;
- this.mousePos_.y = e.clientY;
- },
-
- createEvent_: function(eventName, sourceEvent) {
- var event = new tr.b.Event(eventName, true);
- event.clientX = this.mousePos_.x;
- event.clientY = this.mousePos_.y;
- event.deltaX = this.mousePos_.x - this.mouseDownPos_.x;
- event.deltaY = this.mousePos_.y - this.mouseDownPos_.y;
- event.mouseDownX = this.mouseDownPos_.x;
- event.mouseDownY = this.mouseDownPos_.y;
- event.didPreventDefault = false;
- event.preventDefault = function() {
- event.didPreventDefault = true;
- if (sourceEvent)
- sourceEvent.preventDefault();
- };
- event.stopPropagation = function() {
- sourceEvent.stopPropagation();
- };
- event.stopImmediatePropagation = function() {
- throw new Error('Not implemented');
- };
- return event;
- },
-
- onMouseDown_: function(e) {
- if (e.button !== 0)
- return;
- this.setCurrentMousePosFromEvent_(e);
- var mouseEvent = this.createEvent_(
- MOUSE_SELECTOR_MODE_INFOS[this.mode].eventNames.begin, e);
- if (this.mode === MOUSE_SELECTOR_MODE.SELECTION)
- mouseEvent.appendSelection = isCmdOrCtrlPressed(e);
- this.dispatchEvent(mouseEvent);
- this.isInteracting_ = true;
- this.isClick_ = true;
- tr.ui.b.trackMouseMovesUntilMouseUp(this.onMouseMove_, this.onMouseUp_);
- },
-
- onMouseMove_: function(e) {
- this.setCurrentMousePosFromEvent_(e);
-
- var mouseEvent = this.createEvent_(
- MOUSE_SELECTOR_MODE_INFOS[this.mode].eventNames.update, e);
- this.dispatchEvent(mouseEvent);
-
- if (this.isInteracting_)
- this.checkIsClick_(e);
- },
-
- onMouseUp_: function(e) {
- if (e.button !== 0)
- return;
-
- var mouseEvent = this.createEvent_(
- MOUSE_SELECTOR_MODE_INFOS[this.mode].eventNames.end, e);
- mouseEvent.isClick = this.isClick_;
- this.dispatchEvent(mouseEvent);
-
- if (this.isClick_ && !mouseEvent.didPreventDefault)
- this.dispatchClickEvents_(e);
-
- this.isInteracting_ = false;
- this.updateAlternativeModeState_(e);
- },
-
- onButtonMouseDown_: function(e) {
- e.preventDefault();
- e.stopImmediatePropagation();
- },
-
- onButtonMouseUp_: function(e) {
- e.preventDefault();
- e.stopImmediatePropagation();
- },
-
- onButtonPress_: function(e) {
- this.modeBeforeAlternativeModeActivated_ = undefined;
- this.mode = e.target.mode;
- e.preventDefault();
- },
-
- onKeyDown_: function(e) {
- // Keys dispatched to INPUT elements still bubble, even when they're
- // handled. So, skip any events that targeted the input element.
- if (e.path[0].tagName == 'INPUT')
- return;
-
- if (e.keyCode === ' '.charCodeAt(0))
- this.spacePressed_ = true;
- this.updateAlternativeModeState_(e);
- },
-
- onKeyUp_: function(e) {
- // Keys dispatched to INPUT elements still bubble, even when they're
- // handled. So, skip any events that targeted the input element.
- if (e.path[0].tagName == 'INPUT')
- return;
-
- if (e.keyCode === ' '.charCodeAt(0))
- this.spacePressed_ = false;
-
- var didHandleKey = false;
- tr.b.iterItems(this.modeToKeyCodeMap_, function(modeStr, keyCode) {
- if (e.keyCode === keyCode) {
- this.modeBeforeAlternativeModeActivated_ = undefined;
- var mode = parseInt(modeStr);
- this.mode = mode;
- didHandleKey = true;
- }
- }, this);
-
- if (didHandleKey) {
- e.preventDefault();
- e.stopPropagation();
- return;
- }
- this.updateAlternativeModeState_(e);
- },
-
- updateAlternativeModeState_: function(e) {
- var shiftPressed = e.shiftKey;
- var spacePressed = this.spacePressed_;
- var cmdOrCtrlPressed = isCmdOrCtrlPressed(e);
-
- // Figure out the new mode
- var smm = this.supportedModeMask_;
- var newMode;
- var isNewModeAnAlternativeMode = false;
- if (shiftPressed &&
- (this.modifierToModeMap_[MODIFIER.SHIFT] & smm) !== 0) {
- newMode = this.modifierToModeMap_[MODIFIER.SHIFT];
- isNewModeAnAlternativeMode = true;
- } else if (spacePressed &&
- (this.modifierToModeMap_[MODIFIER.SPACE] & smm) !== 0) {
- newMode = this.modifierToModeMap_[MODIFIER.SPACE];
- isNewModeAnAlternativeMode = true;
- } else if (cmdOrCtrlPressed &&
- (this.modifierToModeMap_[MODIFIER.CMD_OR_CTRL] & smm) !== 0) {
- newMode = this.modifierToModeMap_[MODIFIER.CMD_OR_CTRL];
- isNewModeAnAlternativeMode = true;
- } else {
- // Go to the old mode, if there is one.
- if (this.isInAlternativeMode_) {
- newMode = this.modeBeforeAlternativeModeActivated_;
- isNewModeAnAlternativeMode = false;
- } else {
- newMode = undefined;
- }
- }
-
- // Maybe a mode change isn't needed.
- if (this.mode === newMode || newMode === undefined)
- return;
-
- // Okay, we're changing.
- if (isNewModeAnAlternativeMode)
- this.modeBeforeAlternativeModeActivated_ = this.mode;
- this.mode = newMode;
- },
-
- get isInAlternativeMode_() {
- return !!this.modeBeforeAlternativeModeActivated_;
- },
-
- setModifierForAlternateMode: function(mode, modifier) {
- this.modifierToModeMap_[modifier] = mode;
- },
-
- get pos() {
- return {
- x: parseInt(this.style.left),
- y: parseInt(this.style.top)
- };
- },
-
- set pos(pos) {
- pos = this.constrainPositionToBounds_(pos);
-
- this.style.left = pos.x + 'px';
- this.style.top = pos.y + 'px';
-
- if (this.settingsKey_)
- tr.b.Settings.set(this.settingsKey_ + '.pos', this.pos);
- },
-
- constrainPositionToBounds_: function(pos) {
- var parent = this.offsetParent || document.body;
- var parentRect = tr.ui.b.windowRectForElement(parent);
-
- var top = 0;
- var bottom = parentRect.height - this.offsetHeight;
- var left = 0;
- var right = parentRect.width - this.offsetWidth;
-
- var res = {};
- res.x = Math.max(pos.x, left);
- res.x = Math.min(res.x, right);
-
- res.y = Math.max(pos.y, top);
- res.y = Math.min(res.y, bottom);
- return res;
- },
-
- onDragHandleMouseDown_: function(e) {
- e.preventDefault();
- e.stopImmediatePropagation();
-
- var mouseDownPos = {
- x: e.clientX - this.offsetLeft,
- y: e.clientY - this.offsetTop
- };
- tr.ui.b.trackMouseMovesUntilMouseUp(function(e) {
- var pos = {};
- pos.x = e.clientX - mouseDownPos.x;
- pos.y = e.clientY - mouseDownPos.y;
- this.pos = pos;
- }.bind(this));
- },
-
- checkIsClick_: function(e) {
- if (!this.isInteracting_ || !this.isClick_)
- return;
-
- var deltaX = this.mousePos_.x - this.mouseDownPos_.x;
- var deltaY = this.mousePos_.y - this.mouseDownPos_.y;
- var minDist = MIN_MOUSE_SELECTION_DISTANCE;
-
- if (deltaX * deltaX + deltaY * deltaY > minDist * minDist)
- this.isClick_ = false;
- },
-
- dispatchClickEvents_: function(e) {
- if (!this.isClick_)
- return;
-
- var modeInfo = MOUSE_SELECTOR_MODE_INFOS[MOUSE_SELECTOR_MODE.SELECTION];
- var eventNames = modeInfo.eventNames;
-
- var mouseEvent = this.createEvent_(eventNames.begin);
- mouseEvent.appendSelection = isCmdOrCtrlPressed(e);
- this.dispatchEvent(mouseEvent);
-
- mouseEvent = this.createEvent_(eventNames.end);
- this.dispatchEvent(mouseEvent);
- }
- });
-
- return {
- MIN_MOUSE_SELECTION_DISTANCE: MIN_MOUSE_SELECTION_DISTANCE,
- MODIFIER: MODIFIER
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_selector_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_selector_test.html
deleted file mode 100644
index 56719d76bd6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_mode_selector_test.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/settings.html">
-<link rel="import" href="/tracing/ui/base/mouse_mode_selector.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var MOUSE_SELECTOR_MODE = tr.ui.b.MOUSE_SELECTOR_MODE;
- test('instantiate', function() {
- var sel = document.createElement('tr-ui-b-mouse-mode-selector');
- sel.supportedModeMask =
- MOUSE_SELECTOR_MODE.SELECTION |
- MOUSE_SELECTOR_MODE.PANSCAN;
- this.addHTMLOutput(sel);
- });
-
- test('changeMaskWithUnsupportedMode', function() {
- var sel = document.createElement('tr-ui-b-mouse-mode-selector');
- sel.mode = MOUSE_SELECTOR_MODE.SELECTION;
- assert.throw(function() {
- sel.supportedModeMask = MOUSE_SELECTOR_MODE.ZOOM;
- });
- });
-
- test('modePersists', function() {
- var sel1 = document.createElement('tr-ui-b-mouse-mode-selector');
- sel1.defaultMode_ = MOUSE_SELECTOR_MODE.ZOOM;
- sel1.settingsKey = 'foo';
- assert.equal(sel1.mode, MOUSE_SELECTOR_MODE.ZOOM);
-
- sel1.mode = MOUSE_SELECTOR_MODE.PANSCAN;
-
- var sel2 = document.createElement('tr-ui-b-mouse-mode-selector');
- sel2.settingsKey = 'foo';
- assert.equal(sel2.mode, MOUSE_SELECTOR_MODE.PANSCAN);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_modes.html b/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_modes.html
deleted file mode 100644
index 9387ef2ce68..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_modes.html
+++ /dev/null
@@ -1,93 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- var MOUSE_SELECTOR_MODE = {};
- MOUSE_SELECTOR_MODE.SELECTION = 0x1;
- MOUSE_SELECTOR_MODE.PANSCAN = 0x2;
- MOUSE_SELECTOR_MODE.ZOOM = 0x4;
- MOUSE_SELECTOR_MODE.TIMING = 0x8;
- MOUSE_SELECTOR_MODE.ROTATE = 0x10;
- MOUSE_SELECTOR_MODE.ALL_MODES = 0x1F;
-
- var MOUSE_SELECTOR_MODE_INFOS = {};
- MOUSE_SELECTOR_MODE_INFOS[MOUSE_SELECTOR_MODE.PANSCAN] = {
- mode: MOUSE_SELECTOR_MODE.PANSCAN,
- title: 'pan',
- eventNames: {
- enter: 'enterpan',
- begin: 'beginpan',
- update: 'updatepan',
- end: 'endpan',
- exit: 'exitpan'
- },
- activeBackgroundPosition: '-30px -10px',
- defaultBackgroundPosition: '0 -10px'
- };
- MOUSE_SELECTOR_MODE_INFOS[MOUSE_SELECTOR_MODE.SELECTION] = {
- mode: MOUSE_SELECTOR_MODE.SELECTION,
- title: 'selection',
- eventNames: {
- enter: 'enterselection',
- begin: 'beginselection',
- update: 'updateselection',
- end: 'endselection',
- exit: 'exitselection'
- },
- activeBackgroundPosition: '-30px -40px',
- defaultBackgroundPosition: '0 -40px'
- };
-
- MOUSE_SELECTOR_MODE_INFOS[MOUSE_SELECTOR_MODE.ZOOM] = {
- mode: MOUSE_SELECTOR_MODE.ZOOM,
- title: 'zoom',
- eventNames: {
- enter: 'enterzoom',
- begin: 'beginzoom',
- update: 'updatezoom',
- end: 'endzoom',
- exit: 'exitzoom'
- },
- activeBackgroundPosition: '-30px -70px',
- defaultBackgroundPosition: '0 -70px'
- };
- MOUSE_SELECTOR_MODE_INFOS[MOUSE_SELECTOR_MODE.TIMING] = {
- mode: MOUSE_SELECTOR_MODE.TIMING,
- title: 'timing',
- eventNames: {
- enter: 'entertiming',
- begin: 'begintiming',
- update: 'updatetiming',
- end: 'endtiming',
- exit: 'exittiming'
- },
- activeBackgroundPosition: '-30px -100px',
- defaultBackgroundPosition: '0 -100px'
- };
- MOUSE_SELECTOR_MODE_INFOS[MOUSE_SELECTOR_MODE.ROTATE] = {
- mode: MOUSE_SELECTOR_MODE.ROTATE,
- title: 'rotate',
- eventNames: {
- enter: 'enterrotate',
- begin: 'beginrotate',
- update: 'updaterotate',
- end: 'endrotate',
- exit: 'exitrotate'
- },
- activeBackgroundPosition: '-30px -130px',
- defaultBackgroundPosition: '0 -130px'
- };
-
- return {
- MOUSE_SELECTOR_MODE_INFOS: MOUSE_SELECTOR_MODE_INFOS,
- MOUSE_SELECTOR_MODE: MOUSE_SELECTOR_MODE
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_tracker.html b/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_tracker.html
deleted file mode 100644
index 3ee8c77b49b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/mouse_tracker.html
+++ /dev/null
@@ -1,114 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-/**
- * @fileoverview A Mouse-event abtraction that waits for
- * mousedown, then watches for subsequent mousemove events
- * until the next mouseup event, then waits again.
- * State changes are signaled with
- * 'mouse-tracker-start' : mousedown and tracking
- * 'mouse-tracker-move' : mouse move
- * 'mouse-tracker-end' : mouseup and not tracking.
- */
-
-tr.exportTo('tr.ui.b', function() {
-
- /**
- * @constructor
- * @param {HTMLElement} targetElement will recv events 'mouse-tracker-start',
- * 'mouse-tracker-move', 'mouse-tracker-end'.
- */
- function MouseTracker(opt_targetElement) {
- this.onMouseDown_ = this.onMouseDown_.bind(this);
- this.onMouseMove_ = this.onMouseMove_.bind(this);
- this.onMouseUp_ = this.onMouseUp_.bind(this);
-
- this.targetElement = opt_targetElement;
- }
-
- MouseTracker.prototype = {
-
- get targetElement() {
- return this.targetElement_;
- },
-
- set targetElement(targetElement) {
- if (this.targetElement_)
- this.targetElement_.removeEventListener('mousedown', this.onMouseDown_);
- this.targetElement_ = targetElement;
- if (this.targetElement_)
- this.targetElement_.addEventListener('mousedown', this.onMouseDown_);
- },
-
- onMouseDown_: function(e) {
- if (e.button !== 0)
- return true;
-
- e = this.remakeEvent_(e, 'mouse-tracker-start');
- this.targetElement_.dispatchEvent(e);
- document.addEventListener('mousemove', this.onMouseMove_);
- document.addEventListener('mouseup', this.onMouseUp_);
- this.targetElement_.addEventListener('blur', this.onMouseUp_);
- this.savePreviousUserSelect_ = document.body.style['-webkit-user-select'];
- document.body.style['-webkit-user-select'] = 'none';
- e.preventDefault();
- return true;
- },
-
- onMouseMove_: function(e) {
- e = this.remakeEvent_(e, 'mouse-tracker-move');
- this.targetElement_.dispatchEvent(e);
- },
-
- onMouseUp_: function(e) {
- document.removeEventListener('mousemove', this.onMouseMove_);
- document.removeEventListener('mouseup', this.onMouseUp_);
- this.targetElement_.removeEventListener('blur', this.onMouseUp_);
- document.body.style['-webkit-user-select'] =
- this.savePreviousUserSelect_;
- e = this.remakeEvent_(e, 'mouse-tracker-end');
- this.targetElement_.dispatchEvent(e);
- },
-
- remakeEvent_: function(e, newType) {
- var remade = new tr.b.Event(newType, true, true);
- remade.x = e.x;
- remade.y = e.y;
- remade.offsetX = e.offsetX;
- remade.offsetY = e.offsetY;
- remade.clientX = e.clientX;
- remade.clientY = e.clientY;
- return remade;
- }
-
- };
-
- function trackMouseMovesUntilMouseUp(mouseMoveHandler,
- opt_mouseUpHandler, opt_keyUpHandler) {
- function cleanupAndDispatchToMouseUp(e) {
- document.removeEventListener('mousemove', mouseMoveHandler);
- if (opt_keyUpHandler)
- document.removeEventListener('keyup', opt_keyUpHandler);
- document.removeEventListener('mouseup', cleanupAndDispatchToMouseUp);
- if (opt_mouseUpHandler)
- opt_mouseUpHandler(e);
- }
- document.addEventListener('mousemove', mouseMoveHandler);
- if (opt_keyUpHandler)
- document.addEventListener('keyup', opt_keyUpHandler);
- document.addEventListener('mouseup', cleanupAndDispatchToMouseUp);
- }
-
- return {
- MouseTracker: MouseTracker,
- trackMouseMovesUntilMouseUp: trackMouseMovesUntilMouseUp
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/name_bar_chart.html b/chromium/third_party/catapult/tracing/tracing/ui/base/name_bar_chart.html
deleted file mode 100644
index dcfdbaa17c6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/name_bar_chart.html
+++ /dev/null
@@ -1,95 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/ui/base/d3.html">
-<link rel="import" href="/tracing/ui/base/bar_chart.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- var BarChart = tr.ui.b.BarChart;
-
- // @constructor
- var NameBarChart = tr.ui.b.define('name-bar-chart', BarChart);
-
- NameBarChart.prototype = {
- __proto__: BarChart.prototype,
-
- decorate: function() {
- BarChart.prototype.decorate.call(this);
- this.classList.remove('bar-chart');
- this.classList.add('name-bar-chart');
- this.bottomMargin_ = 40;
- },
-
- isDatumFieldSeries_: function(fieldName) {
- return fieldName != 'x';
- },
-
- getXForDatum_: function(datum, index) {
- return index;
- },
-
- getMargin_: function() {
- var margin = BarChart.prototype.getMargin_.call(this);
- margin.bottom = this.bottomMargin_;
- return margin;
- },
-
- updateXAxis_: function(xAxis) {
- xAxis.selectAll('*').remove();
- var y = this.chartAreaSize.height + 10;
- var nameTexts = xAxis.selectAll('text')
- .data(this.data_);
- nameTexts
- .enter()
- .append('text')
- .attr('transform', function(d, index) {
- var cx = this.xScale_(index);
- // If you change the angle, then check the Math.cos() below.
- return 'rotate(45 ' + cx + ' ' + y + ')';
- }.bind(this))
- .attr('x', function(d, index) {
- return this.xScale_(index);
- }.bind(this))
- .attr('y', function(d) {
- return y;
- }.bind(this))
- .text(function(d, index) {
- return d.x;
- }.bind(this));
- nameTexts.exit().remove();
-
- // If the nameTexts extend past the bottom of the chart, then increase
- // this.bottomMargin_ and re-render.
- var bottomMargin = this.bottomMargin_;
- window.requestAnimationFrame(function() {
- nameTexts[0].forEach(function(t) {
- var box = t.getBBox();
- // When the text is rotated, its height is the hypotenuse
- // of a small triangle H, and its width is the hypotenuse of a larger
- // triangle W. The bottomMargin must be equal to a side of H plus a
- // side of W.
- var h = Math.cos(Math.PI / 4) * (box.height + box.width);
- bottomMargin = Math.max(this.bottomMargin_, h);
- }, this);
-
- if (Math.round(bottomMargin) !== Math.round(this.bottomMargin_)) {
- this.bottomMargin_ = bottomMargin;
- this.updateContents_();
- }
- }.bind(this));
- }
- };
-
- return {
- NameBarChart: NameBarChart
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/name_bar_chart_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/name_bar_chart_test.html
deleted file mode 100644
index 341a5a8fcb7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/name_bar_chart_test.html
+++ /dev/null
@@ -1,172 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/name_bar_chart.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiation_singleSeries', function() {
- var chart = new tr.ui.b.NameBarChart();
- chart.width = 200;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 'apple', value: 100},
- {x: 'ball', value: 110},
- {x: 'cat', value: 100},
- {x: 'dog', value: 50}
- ];
- chart.data = data;
- this.addHTMLOutput(chart);
- });
-
- test('undefined', function() {
- var chart = new tr.ui.b.NameBarChart();
- assert.throws(function() {
- chart.data = undefined;
- });
- });
-
- test('instantiation_twoSeries', function() {
- var chart = new tr.ui.b.NameBarChart();
-
- chart.width = 200;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 'apple', alpha: 100, beta: 50},
- {x: 'ball', alpha: 110, beta: 75},
- {x: 'cat', alpha: 100, beta: 125},
- {x: 'dog', alpha: 50, beta: 125}
- ];
- chart.data = data;
-
- var r = new tr.b.Range();
- r.addValue(20);
- r.addValue(40);
- chart.brushedRange = r;
-
- this.addHTMLOutput(chart);
- });
-
- test('instantiation_twoSparseSeriesWithFirstValueSparse', function() {
- var chart = new tr.ui.b.NameBarChart();
-
- chart.width = 200;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 'apple', alpha: 20, beta: undefined},
- {x: 'ball', alpha: undefined, beta: 10},
- {x: 'cat', alpha: 10, beta: undefined},
- {x: 'dog', alpha: undefined, beta: 20},
- {x: 'echo', alpha: 30, beta: 30}
- ];
- chart.data = data;
-
- this.addHTMLOutput(chart);
- });
-
- test('instantiation_twoSparseSeriesWithFirstValueNotSparse', function() {
- var chart = new tr.ui.b.NameBarChart();
-
- chart.width = 200;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 'apple', alpha: 20, beta: 40},
- {x: 'ball', alpha: undefined, beta: 10},
- {x: 'cat', alpha: 10, beta: undefined},
- {x: 'dog', alpha: undefined, beta: 20},
- {x: 'echo', alpha: 30, beta: undefined}
- ];
- chart.data = data;
-
- this.addHTMLOutput(chart);
- });
-
- test('brushRangeFromIndices', function() {
- var chart = new tr.ui.b.NameBarChart();
- var data = [
- {x: 'apple', value: 50},
- {x: 'ball', value: 60},
- {x: 'cat', value: 70},
- {x: 'dog', value: 80},
- {x: 'echo', value: 90}
- ];
- chart.data = data;
- var r = new tr.b.Range();
-
- // Range min should be 10.
- r = chart.computeBrushRangeFromIndices(-2, 1);
- assert.equal(r.min, 0);
-
- // Range max should be 120.
- r = chart.computeBrushRangeFromIndices(3, 10);
- assert.equal(r.max, 4);
-
- // Range should be [10, 120]
- r = chart.computeBrushRangeFromIndices(-2, 10);
- assert.equal(r.min, 0);
- assert.equal(r.max, 4);
-
- // Range should be [20, 100]
- r = chart.computeBrushRangeFromIndices(1, 3);
- assert.equal(r.min, 0.5);
- assert.equal(r.max, 3.5);
- });
-
- test('instantiation_interactiveBrushing', function() {
- var chart = new tr.ui.b.NameBarChart();
- chart.width = 300;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 'apple', value: 50},
- {x: 'ball', value: 60},
- {x: 'cat', value: 80},
- {x: 'dog', value: 20},
- {x: 'echo', value: 30},
- {x: 'fortune', value: 20},
- {x: 'gpu', value: 15},
- {x: 'happy', value: 20}
- ];
- chart.data = data;
-
- var mouseDownIndex = undefined;
- var currentMouseIndex = undefined;
-
- function updateBrushedRange() {
- var r = new tr.b.Range();
- r.min = Math.max(0, Math.min(mouseDownIndex, currentMouseIndex));
- r.max = Math.min(data.length, Math.max(mouseDownIndex,
- currentMouseIndex) + 1);
- chart.brushedRange = r;
- }
-
- chart.addEventListener('item-mousedown', function(e) {
- mouseDownIndex = e.index;
- currentMouseIndex = e.index;
- updateBrushedRange();
- });
- chart.addEventListener('item-mousemove', function(e) {
- if (e.button === undefined)
- return;
- currentMouseIndex = e.index;
- updateBrushedRange();
- });
- chart.addEventListener('item-mouseup', function(e) {
- currentMouseIndex = e.index;
- updateBrushedRange();
- });
- this.addHTMLOutput(chart);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/overlay.html b/chromium/third_party/catapult/tracing/tracing/ui/base/overlay.html
deleted file mode 100644
index df8e13ceddf..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/overlay.html
+++ /dev/null
@@ -1,340 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/base/utils.html">
-
-<template id="overlay-template">
- <style>
- overlay-mask {
- left: 0;
- padding: 8px;
- position: absolute;
- top: 0;
- z-index: 1000;
- font-family: sans-serif;
- -webkit-justify-content: center;
- background: rgba(0, 0, 0, 0.8);
- display: -webkit-flex;
- height: 100%;
- left: 0;
- position: fixed;
- top: 0;
- width: 100%;
- }
- overlay-mask:focus {
- outline: none;
- }
- overlay-vertical-centering-container {
- -webkit-justify-content: center;
- -webkit-flex-direction: column;
- display: -webkit-flex;
- }
- overlay-frame {
- z-index: 1100;
- background: rgb(255, 255, 255);
- border: 1px solid #ccc;
- margin: 75px;
- display: -webkit-flex;
- -webkit-flex-direction: column;
- min-height: 0;
- }
- title-bar {
- -webkit-align-items: center;
- -webkit-flex-direction: row;
- border-bottom: 1px solid #ccc;
- background-color: #ddd;
- display: -webkit-flex;
- padding: 5px;
- -webkit-flex: 0 0 auto;
- }
- title {
- display: inline;
- font-weight: bold;
- -webkit-box-flex: 1;
- -webkit-flex: 1 1 auto;
- }
- close-button {
- -webkit-align-self: flex-end;
- border: 1px solid #eee;
- background-color: #999;
- font-size: 10pt;
- font-weight: bold;
- padding: 2px;
- text-align: center;
- width: 16px;
- }
- close-button:hover {
- background-color: #ddd;
- border-color: black;
- cursor: pointer;
- }
- overlay-content {
- display: -webkit-flex;
- -webkit-flex: 1 1 auto;
- -webkit-flex-direction: column;
- overflow-y: auto;
- padding: 10px;
- min-width: 300px;
- min-height: 0;
- }
- button-bar {
- -webkit-align-items: baseline;
- border-top: 1px solid #ccc;
- display: -webkit-flex;
- -webkit-flex: 0 0 auto;
- -webkit-flex-direction: row-reverse;
- padding: 4px;
- }
- </style>
-
- <overlay-mask>
- <overlay-vertical-centering-container>
- <overlay-frame>
- <title-bar>
- <title></title>
- <close-button>&#x2715</close-button>
- </title-bar>
- <overlay-content>
- <content></content>
- </overlay-content>
- <button-bar></button-bar>
- </overlay-frame>
- </overlay-vertical-centering-container>
- </overlay-mask>
-</template>
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Implements an element that is hidden by default, but
- * when shown, dims and (attempts to) disable the main document.
- *
- * You can turn any div into an overlay. Note that while an
- * overlay element is shown, its parent is changed. Hiding the overlay
- * restores its original parentage.
- *
- */
-tr.exportTo('tr.ui.b', function() {
- if (tr.isHeadless)
- return {};
-
- var THIS_DOC = document.currentScript.ownerDocument;
-
- /**
- * Creates a new overlay element. It will not be visible until shown.
- * @constructor
- * @extends {HTMLDivElement}
- */
- var Overlay = tr.ui.b.define('overlay');
-
- Overlay.prototype = {
- __proto__: HTMLDivElement.prototype,
-
- /**
- * Initializes the overlay element.
- */
- decorate: function() {
- this.classList.add('overlay');
-
- this.parentEl_ = this.ownerDocument.body;
-
- this.visible_ = false;
- this.userCanClose_ = true;
-
- this.onKeyDown_ = this.onKeyDown_.bind(this);
- this.onClick_ = this.onClick_.bind(this);
- this.onFocusIn_ = this.onFocusIn_.bind(this);
- this.onDocumentClick_ = this.onDocumentClick_.bind(this);
- this.onClose_ = this.onClose_.bind(this);
-
- this.addEventListener('visible-change',
- tr.ui.b.Overlay.prototype.onVisibleChange_.bind(this), true);
-
- // Setup the shadow root
- var createShadowRoot = this.createShadowRoot ||
- this.webkitCreateShadowRoot;
- this.shadow_ = createShadowRoot.call(this);
- this.shadow_.appendChild(tr.ui.b.instantiateTemplate('#overlay-template',
- THIS_DOC));
-
- this.closeBtn_ = this.shadow_.querySelector('close-button');
- this.closeBtn_.addEventListener('click', this.onClose_);
-
- this.shadow_
- .querySelector('overlay-frame')
- .addEventListener('click', this.onClick_);
-
- this.observer_ = new WebKitMutationObserver(
- this.didButtonBarMutate_.bind(this));
- this.observer_.observe(this.shadow_.querySelector('button-bar'),
- { childList: true });
-
- // title is a variable on regular HTMLElements. However, we want to
- // use it for something more useful.
- Object.defineProperty(
- this, 'title', {
- get: function() {
- return this.shadow_.querySelector('title').textContent;
- },
- set: function(title) {
- this.shadow_.querySelector('title').textContent = title;
- }
- });
- },
-
- set userCanClose(userCanClose) {
- this.userCanClose_ = userCanClose;
- this.closeBtn_.style.display =
- userCanClose ? 'block' : 'none';
- },
-
- get buttons() {
- return this.shadow_.querySelector('button-bar');
- },
-
- get visible() {
- return this.visible_;
- },
-
- set visible(newValue) {
- if (this.visible_ === newValue)
- return;
-
- this.visible_ = newValue;
- var e = new tr.b.Event('visible-change');
- this.dispatchEvent(e);
- },
-
- onVisibleChange_: function() {
- this.visible_ ? this.show_() : this.hide_();
- },
-
- show_: function() {
- this.parentEl_.appendChild(this);
-
- if (this.userCanClose_) {
- this.addEventListener('keydown', this.onKeyDown_.bind(this));
- this.addEventListener('click', this.onDocumentClick_.bind(this));
- }
-
- this.parentEl_.addEventListener('focusin', this.onFocusIn_);
- this.tabIndex = 0;
-
- // Focus the first thing we find that makes sense. (Skip the close button
- // as it doesn't make sense as the first thing to focus.)
- var focusEl = undefined;
- var elList = this.querySelectorAll('button, input, list, select, a');
- if (elList.length > 0) {
- if (elList[0] === this.closeBtn_) {
- if (elList.length > 1)
- focusEl = elList[1];
- } else {
- focusEl = elList[0];
- }
- }
- if (focusEl === undefined)
- focusEl = this;
- focusEl.focus();
- },
-
- hide_: function() {
- this.parentEl_.removeChild(this);
-
- this.parentEl_.removeEventListener('focusin', this.onFocusIn_);
-
- if (this.closeBtn_)
- this.closeBtn_.removeEventListener('click', this.onClose_);
-
- document.removeEventListener('keydown', this.onKeyDown_);
- document.removeEventListener('click', this.onDocumentClick_);
- },
-
- onClose_: function(e) {
- this.visible = false;
- if ((e.type != 'keydown') ||
- (e.type === 'keydown' && e.keyCode === 27))
- e.stopPropagation();
- e.preventDefault();
- tr.b.dispatchSimpleEvent(this, 'closeclick');
- },
-
- onFocusIn_: function(e) {
- if (e.target === this)
- return;
-
- window.setTimeout(function() { this.focus(); }, 0);
- e.preventDefault();
- e.stopPropagation();
- },
-
- didButtonBarMutate_: function(e) {
- var hasButtons = this.buttons.children.length > 0;
- if (hasButtons)
- this.shadow_.querySelector('button-bar').style.display = undefined;
- else
- this.shadow_.querySelector('button-bar').style.display = 'none';
- },
-
- onKeyDown_: function(e) {
- // Disallow shift-tab back to another element.
- if (e.keyCode === 9 && // tab
- e.shiftKey &&
- e.target === this) {
- e.preventDefault();
- return;
- }
-
- if (e.keyCode !== 27) // escape
- return;
-
- this.onClose_(e);
- },
-
- onClick_: function(e) {
- e.stopPropagation();
- },
-
- onDocumentClick_: function(e) {
- if (!this.userCanClose_)
- return;
-
- this.onClose_(e);
- }
- };
-
- Overlay.showError = function(msg, opt_err) {
- var o = new Overlay();
- o.title = 'Error';
- o.textContent = msg;
- if (opt_err) {
- var e = tr.b.normalizeException(opt_err);
-
- var stackDiv = document.createElement('pre');
- stackDiv.textContent = e.stack;
- stackDiv.style.paddingLeft = '8px';
- stackDiv.style.margin = 0;
- o.appendChild(stackDiv);
- }
- var b = document.createElement('button');
- b.textContent = 'OK';
- b.addEventListener('click', function() {
- o.visible = false;
- });
- o.buttons.appendChild(b);
- o.visible = true;
- return o;
- }
-
- return {
- Overlay: Overlay
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/overlay_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/overlay_test.html
deleted file mode 100644
index d1d1b31e8e3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/overlay_test.html
+++ /dev/null
@@ -1,124 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/ui/base/overlay.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function addShowButtonForDialog(dlg) {
- var btn = document.createElement('button');
- btn.textContent = 'Launch Overlay';
- btn.addEventListener('click', function(e) {
- dlg.visible = true;
- e.stopPropagation();
- });
-
- this.addHTMLOutput(btn);
- }
-
- function makeButton(title) {
- var btn = document.createElement('button');
- btn.textContent = title;
- return btn;
- }
-
- function makeCloseButton(dlg) {
- var btn = makeButton('close');
- btn.addEventListener('click', function(e) {
- dlg.onClose_(e);
- });
- return btn;
- }
-
- test('instantiate', function() {
- var dlg = new tr.ui.b.Overlay();
- dlg.classList.add('example-overlay');
- dlg.title = 'ExampleOverlay';
- dlg.innerHTML = 'hello';
- dlg.buttons.appendChild(makeButton('i am a button'));
- dlg.buttons.appendChild(makeCloseButton(dlg));
- dlg.buttons.appendChild(tr.ui.b.createSpan(
- {textContent: 'i am a span'}));
- addShowButtonForDialog.call(this, dlg);
- });
-
- test('instantiate_noButtons', function() {
- var dlg = new tr.ui.b.Overlay();
- dlg.classList.add('example-overlay');
- dlg.title = 'ExampleOverlay';
- dlg.innerHTML = 'hello';
- addShowButtonForDialog.call(this, dlg);
- });
-
- test('instantiate_disableUserClose', function() {
- var dlg = new tr.ui.b.Overlay();
- dlg.classList.add('example-overlay');
- dlg.userCanClose = false;
- dlg.title = 'Unclosable';
- dlg.innerHTML = 'This has no close X button.';
- dlg.buttons.appendChild(makeCloseButton(dlg));
- addShowButtonForDialog.call(this, dlg);
- });
-
- test('instantiateTall', function() {
- var dlg = new tr.ui.b.Overlay();
- dlg.title = 'TallContent';
- var contentEl = document.createElement('div');
- contentEl.style.overflowY = 'auto';
- dlg.appendChild(contentEl);
-
- for (var i = 0; i < 1000; i++) {
- var el = document.createElement('div');
- el.textContent = 'line ' + i;
- contentEl.appendChild(el);
- }
-
-
- dlg.buttons.appendChild(makeButton('i am a button'));
- addShowButtonForDialog.call(this, dlg);
- });
-
- test('instantiateTallWithManyDirectChildren', function() {
- var dlg = new tr.ui.b.Overlay();
- dlg.title = 'TallContent';
- for (var i = 0; i < 100; i++) {
- var el = document.createElement('div');
- el.style.webkitFlex = '1 0 auto';
- el.textContent = 'line ' + i;
- dlg.appendChild(el);
- }
-
- dlg.buttons.appendChild(makeButton('i am a button'));
- addShowButtonForDialog.call(this, dlg);
- });
-
- test('closeclickEvent', function() {
- var dlg = new tr.ui.b.Overlay();
- dlg.title = 'Test closeclick event';
- var closeBtn = makeCloseButton(dlg);
- dlg.buttons.appendChild(closeBtn);
-
- var closeClicked = false;
- dlg.addEventListener('closeclick', function() {
- closeClicked = true;
- });
-
- return new Promise(function(resolve, reject) {
- function pressClose() {
- closeBtn.click();
- if (closeClicked)
- resolve();
- else
- reject(new Error('closeclick event is not dispatched'));
- }
- dlg.visible = true;
- setTimeout(pressClose, 60);
- });
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/pie_chart.css b/chromium/third_party/catapult/tracing/tracing/ui/base/pie_chart.css
deleted file mode 100644
index e6dc135bf12..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/pie_chart.css
+++ /dev/null
@@ -1,16 +0,0 @@
-/* Copyright 2014 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-* /deep/ .pie-chart .arc-text {
- font-size: 8pt;
-}
-
-* /deep/ .pie-chart .label {
- font-size: 10pt;
-}
-
-* /deep/ .pie-chart polyline {
- fill: none;
- stroke: black;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/pie_chart.html b/chromium/third_party/catapult/tracing/tracing/ui/base/pie_chart.html
deleted file mode 100644
index 5edfd795219..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/pie_chart.html
+++ /dev/null
@@ -1,277 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/ui/base/d3.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/chart_base.html">
-<link rel="stylesheet" href="/tracing/ui/base/pie_chart.css">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- var ChartBase = tr.ui.b.ChartBase;
- var getColorOfKey = tr.ui.b.getColorOfKey;
-
- var MIN_RADIUS = 100;
-
- /**
- * @constructor
- */
- var PieChart = tr.ui.b.define('pie-chart', ChartBase);
-
- PieChart.prototype = {
- __proto__: ChartBase.prototype,
-
- decorate: function() {
- ChartBase.prototype.decorate.call(this);
- this.classList.add('pie-chart');
-
- this.data_ = undefined;
- this.seriesKeys_ = undefined;
-
- var chartAreaSel = d3.select(this.chartAreaElement);
- var pieGroupSel = chartAreaSel.append('g')
- .attr('class', 'pie-group');
- this.pieGroup_ = pieGroupSel.node();
-
- this.pathsGroup_ = pieGroupSel.append('g')
- .attr('class', 'paths')
- .node();
- this.labelsGroup_ = pieGroupSel.append('g')
- .attr('class', 'labels')
- .node();
- this.linesGroup_ = pieGroupSel.append('g')
- .attr('class', 'lines')
- .node();
- },
-
- get data() {
- return this.data_;
- },
-
-
- /**
- * @param {Array} data Data for the chart, where each element in the array
- * must be of the form {label: str, value: number}.
- */
- set data(data) {
- if (data !== undefined) {
- // Figure out the label values in the data set. E.g. from
- // [{label: 'a', ...}, {label: 'b', ...}]
- // we would commpute ['a', 'y']. These become the series keys.
- var seriesKeys = [];
- var seenSeriesKeys = {};
- data.forEach(function(d) {
- var k = d.label;
- if (seenSeriesKeys[k])
- throw new Error('Label ' + k + ' has been used already');
- seriesKeys.push(k);
- seenSeriesKeys[k] = true;
- }, this);
- this.seriesKeys_ = seriesKeys;
- } else {
- this.seriesKeys_ = undefined;
- }
- this.data_ = data;
- this.updateContents_();
- },
-
- get margin() {
- var margin = {top: 0, right: 0, bottom: 0, left: 0};
- if (this.chartTitle_)
- margin.top += 40;
- return margin;
- },
-
- getMinSize: function() {
- this.updateContents_();
-
- var labelSel = d3.select(this.labelsGroup_).selectAll('.label');
- var maxLabelWidth = -Number.MAX_VALUE;
- var leftTextHeightSum = 0;
- var rightTextHeightSum = 0;
- labelSel.each(function(l) {
- var r = this.getBoundingClientRect();
- maxLabelWidth = Math.max(maxLabelWidth, r.width + 32);
- if (this.style.textAnchor == 'end') {
- leftTextHeightSum += r.height;
- } else {
- rightTextHeightSum += r.height;
- }
- });
-
- var titleWidth = this.querySelector(
- '#title').getBoundingClientRect().width;
- var margin = this.margin;
- var marginWidth = margin.left + margin.right;
- var marginHeight = margin.top + margin.bottom;
- return {
- width: Math.max(2 * MIN_RADIUS + 2 * maxLabelWidth,
- titleWidth * 1.1) + marginWidth,
- height: marginHeight + Math.max(2 * MIN_RADIUS,
- leftTextHeightSum,
- rightTextHeightSum) * 1.25
- };
- },
-
-
- getLegendKeys_: function() {
- // This class creates its own legend, instead of using ChartBase.
- return undefined;
- },
-
- updateScales_: function(width, height) {
- if (this.data_ === undefined)
- return;
- },
-
- updateContents_: function() {
- ChartBase.prototype.updateContents_.call(this);
- if (!this.data_)
- return;
-
- var width = this.chartAreaSize.width;
- var height = this.chartAreaSize.height;
- var radius = Math.max(MIN_RADIUS, Math.min(width, height * 0.95) / 2);
-
- d3.select(this.pieGroup_).attr(
- 'transform',
- 'translate(' + width / 2 + ',' + height / 2 + ')');
-
- // Bind the pie layout to its data
- var pieLayout = d3.layout.pie()
- .value(function(d) { return d.value; })
- .sort(null);
-
- var piePathsSel = d3.select(this.pathsGroup_)
- .datum(this.data_)
- .selectAll('path')
- .data(pieLayout);
-
- function midAngle(d) {
- return d.startAngle + (d.endAngle - d.startAngle) / 2;
- }
-
- var pathsArc = d3.svg.arc()
- .innerRadius(0)
- .outerRadius(radius - 30);
-
- var valueLabelArc = d3.svg.arc()
- .innerRadius(radius - 100)
- .outerRadius(radius - 30);
-
- var lineBeginArc = d3.svg.arc()
- .innerRadius(radius - 50)
- .outerRadius(radius - 50);
-
- var lineEndArc = d3.svg.arc()
- .innerRadius(radius)
- .outerRadius(radius);
-
- // Paths.
- piePathsSel.enter().append('path')
- .attr('class', 'arc')
- .attr('fill', function(d, i) {
- var origData = this.data_[i];
- var highlighted = (origData.label ===
- this.currentHighlightedLegendKey);
- return getColorOfKey(origData.label, highlighted);
- }.bind(this))
- .attr('d', pathsArc)
- .on('click', function(d, i) {
- var origData = this.data_[i];
- var event = new tr.b.Event('item-click');
- event.data = origData;
- event.index = i;
- this.dispatchEvent(event);
- d3.event.stopPropagation();
- }.bind(this))
- .on('mouseenter', function(d, i) {
- var origData = this.data_[i];
- this.pushTempHighlightedLegendKey(origData.label);
- }.bind(this))
- .on('mouseleave', function(d, i) {
- var origData = this.data_[i];
- this.popTempHighlightedLegendKey(origData.label);
- }.bind(this));
-
- // Value labels.
- piePathsSel.enter().append('text')
- .attr('class', 'arc-text')
- .attr('transform', function(d) {
- return 'translate(' + valueLabelArc.centroid(d) + ')';
- })
- .attr('dy', '.35em')
- .style('text-anchor', 'middle')
- .text(function(d, i) {
- var origData = this.data_[i];
- if (origData.valueText === undefined)
- return '';
-
- if (d.endAngle - d.startAngle < 0.4)
- return '';
- return origData.valueText;
- }.bind(this));
-
- piePathsSel.exit().remove();
-
- // Labels.
- var labelSel = d3.select(this.labelsGroup_).selectAll('.label')
- .data(pieLayout(this.data_));
- labelSel.enter()
- .append('text')
- .attr('class', 'label')
- .attr('dy', '.35em');
-
- labelSel.text(function(d) {
- if (d.data.label.length > 40)
- return d.data.label.substr(0, 40) + '...';
- return d.data.label;
- });
- labelSel.attr('transform', function(d) {
- var pos = lineEndArc.centroid(d);
- pos[0] = radius * (midAngle(d) < Math.PI ? 1 : -1);
- return 'translate(' + pos + ')';
- });
- labelSel.style('text-anchor', function(d) {
- return midAngle(d) < Math.PI ? 'start' : 'end';
- });
-
- // Lines.
- var lineSel = d3.select(this.linesGroup_).selectAll('.line')
- .data(pieLayout(this.data_));
- lineSel.enter()
- .append('polyline')
- .attr('class', 'line')
- .attr('dy', '.35em');
- lineSel.attr('points', function(d) {
- var pos = lineEndArc.centroid(d);
- pos[0] = radius * 0.95 * (midAngle(d) < Math.PI ? 1 : -1);
- return [lineBeginArc.centroid(d), lineEndArc.centroid(d), pos];
- });
- },
-
- updateHighlight_: function() {
- ChartBase.prototype.updateHighlight_.call(this);
- // Update color of pie segments.
- var pathsGroupSel = d3.select(this.pathsGroup_);
- var that = this;
- pathsGroupSel.selectAll('.arc').each(function(d, i) {
- var origData = that.data_[i];
- var highlighted = origData.label == that.currentHighlightedLegendKey;
- var color = getColorOfKey(origData.label, highlighted);
- this.style.fill = color;
- });
- }
- };
-
- return {
- PieChart: PieChart
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/pie_chart_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/pie_chart_test.html
deleted file mode 100644
index 7c0b35f5462..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/pie_chart_test.html
+++ /dev/null
@@ -1,207 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/ui/base/pie_chart.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('simple', function() {
- var chart = new tr.ui.b.PieChart();
- chart.width = 400;
- chart.height = 200;
- assert.equal(chart.getAttribute('width'), '400');
- assert.equal(chart.getAttribute('height'), '200');
- chart.chartTitle = 'Chart title';
- var data = [
- {label: 'a', value: 100},
- {label: 'b', value: 200},
- {label: 'c', value: 300}
- ];
- chart.data = data;
- chart.highlightedLegendKey = 'a';
- chart.pushTempHighlightedLegendKey('b');
- chart.highlightedLegendKey = 'c';
- assert.equal(chart.currentHighlightedLegendKey, 'b');
- chart.popTempHighlightedLegendKey('b');
- assert.equal(chart.highlightedLegendKey, 'c');
- this.addHTMLOutput(chart);
- });
-
- test('withValueText', function() {
- var chart = new tr.ui.b.PieChart();
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {label: 'a', value: 100, valueText: '100ms'},
- {label: 'b', value: 200, valueText: '200ms'},
- {label: 'c', value: 300, valueText: '300ms'}
- ];
- chart.data = data;
- this.addHTMLOutput(chart);
- });
-
- test('clickEvent', function() {
- var chart = new tr.ui.b.PieChart();
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {label: 'a', value: 100, foo: 42},
- {label: 'b', value: 200, foo: 43}
- ];
- chart.data = data;
-
- var didGetClick = false;
- chart.addEventListener('item-click', function(event) {
- assert.equal(event.index, 1);
- assert.equal(event.data.foo, 43);
- didGetClick = true;
- });
-
- var arc0 = chart.querySelectorAll('.paths > path')[1];
- tr.b.dispatchSimpleEvent(arc0, 'click');
- assert.isTrue(didGetClick);
- });
-
- test('lotsOfValues', function() {
- var chart = new tr.ui.b.PieChart();
- chart.chartTitle = 'Chart title';
- var data = [
- {label: 'a', value: 100},
- {label: 'bb', value: 200},
- {label: 'cccc', value: 300},
- {label: 'dd', value: 50},
- {label: 'eeeee', value: 250},
- {label: 'fffffff', value: 120},
- {label: 'ggg', value: 90},
- {label: 'hhhh', value: 175},
- {label: 'toolongiiiiiiiiiiiiiiiiiiiiiiiii', value: 325},
- {label: 'jjjjjj', value: 140},
- {label: 'kkkkkkkkk', value: 170},
- {label: 'lll', value: 220}
- ];
- chart.data = data;
- this.addHTMLOutput(chart);
-
- var minSize = chart.getMinSize();
- chart.setSize(chart.getMinSize());
- });
-
- test('denseValues', function() {
- var chart = new tr.ui.b.PieChart();
- chart.chartTitle = 'Chart title';
- var data = [
- {
- valueText: '2.855ms',
- value: 2.854999999999997,
- label: '156959'
- },
- {
- valueText: '9.949ms',
- value: 9.948999999999998,
- label: '16131'
- },
- {
- valueText: '42.314ms',
- value: 42.314000000000725,
- label: '51511'
- },
- {
- valueText: '31.069ms',
- value: 31.06900000000028,
- label: 'AudioOutputDevice'
- },
- {
- valueText: '1.418ms',
- value: 1.418,
- label: 'BrowserBlockingWorker2/50951'
- },
- {
- valueText: '0.044ms',
- value: 0.044,
- label: 'BrowserBlockingWorker3/50695'
- },
- {
- valueText: '18.526ms',
- value: 18.52599999999993,
- label: 'Chrome_ChildIOThread'
- },
- {
- valueText: '2.888ms',
- value: 2.888,
- label: 'Chrome_FileThread'
- },
- {
- valueText: '0.067ms',
- value: 0.067,
- label: 'Chrome_HistoryThread'
- },
- {
- valueText: '25.421ms',
- value: 25.421000000000046,
- label: 'Chrome_IOThread'
- },
- {
- valueText: '0.019ms',
- value: 0.019,
- label: 'Chrome_ProcessLauncherThread'
- },
- {
- valueText: '643.088ms',
- value: 643.087999999995,
- label: 'Compositor'
- },
- {
- valueText: '4.05ms',
- value: 4.049999999999973,
- label: 'CompositorRasterWorker1/22031'
- },
- {
- valueText: '50.04ms',
- value: 50.040000000000106,
- label: 'CrBrowserMain'
- },
- {
- valueText: '1256.513ms',
- value: 1256.5130000000042,
- label: 'CrGpuMain'
- },
- {
- valueText: '5502.195ms',
- value: 5502.19499999999,
- label: 'CrRendererMain'
- },
- {
- valueText: '15.553ms',
- value: 15.552999999999862,
- label: 'FFmpegDemuxer'
- },
- {
- valueText: '63.706ms',
- value: 63.706000000001524,
- label: 'Media'
- },
- {
- valueText: '2.742ms',
- value: 2.7419999999999987,
- label: 'PowerSaveBlocker'
- },
- {
- valueText: '0.115ms',
- value: 0.11500000000000005,
- label: 'Watchdog'
- }
- ];
- chart.data = data;
- this.addHTMLOutput(chart);
-
- var minSize = chart.getMinSize();
- chart.setSize(chart.getMinSize());
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/polymer_utils.html b/chromium/third_party/catapult/tracing/tracing/ui/base/polymer_utils.html
deleted file mode 100644
index b8c5e9d050d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/polymer_utils.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Helper code for working with Polymer.
- */
-tr.exportTo('tr.ui.b', function() {
-
- function getPolymerElementNamed(tagName) {
- for (var i = 0; i < Polymer.elements.length; i++) {
- if (Polymer.elements[i].name === tagName)
- return Polymer.elements[i];
- }
- }
-
- function getPolymerElementsThatSubclass(tagName) {
- if (Polymer.waitingFor().length) {
- throw new Error('There are unresolved polymer elements. ' +
- 'Wait until Polymer.whenReady');
- }
-
- var baseElement;
- var elementNamesThatExtend = {};
- Polymer.elements.forEach(function(element) {
- if (element.name === tagName)
- baseElement = element;
-
- if (element.extends) {
- if (elementNamesThatExtend[element.extends] === undefined)
- elementNamesThatExtend[element.extends] = [];
- elementNamesThatExtend[element.extends].push(element.name);
- }
- });
-
- if (!baseElement)
- throw new Error(tagName + ' is not a polymer element');
-
- var allFoundSubElementNames = [baseElement.name];
- for (var i = 0; i < allFoundSubElementNames.length; i++) {
- var elementName = allFoundSubElementNames[i];
- allFoundSubElementNames.push.apply(
- allFoundSubElementNames, elementNamesThatExtend[elementName]);
- }
-
- // Remove the base element tag name from the list.
- allFoundSubElementNames.shift();
-
- return allFoundSubElementNames;
- }
-
- return {
- getPolymerElementNamed: getPolymerElementNamed,
- getPolymerElementsThatSubclass: getPolymerElementsThatSubclass
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/polymer_utils_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/polymer_utils_test.html
deleted file mode 100644
index 698ec0cdc17..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/polymer_utils_test.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/polymer_utils.html">
-
-<!--
-The Polymer elements defined in this file form the following class hierarchy:
-
- A (common superclass)
- / \
- B C
- / \
- D E
- / \
- F G
--->
-
-<polymer-element name="polymer-utils-test-element-a" noscript>
-</polymer-element>
-
-<polymer-element name="polymer-utils-test-element-b"
- extends="polymer-utils-test-element-a" noscript>
-</polymer-element>
-
-<polymer-element name="polymer-utils-test-element-c"
- extends="polymer-utils-test-element-a" noscript>
-</polymer-element>
-
-<polymer-element name="polymer-utils-test-element-d"
- extends="polymer-utils-test-element-c" noscript>
-</polymer-element>
-
-<polymer-element name="polymer-utils-test-element-e"
- extends="polymer-utils-test-element-c" noscript>
-</polymer-element>
-
-<polymer-element name="polymer-utils-test-element-f"
- extends="polymer-utils-test-element-d" noscript>
-</polymer-element>
-
-<polymer-element name="polymer-utils-test-element-g"
- extends="polymer-utils-test-element-d" noscript>
-</polymer-element>
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('getPolymerElementsThatSubclass', function() {
- function checkSubclasses(classNameSuffix, subclassNameSuffixes) {
- var className = 'polymer-utils-test-element-' + classNameSuffix;
- var subclassNames = subclassNameSuffixes.map(
- function(subclassNameSuffix) {
- return 'polymer-utils-test-element-' + subclassNameSuffix;
- });
- assert.sameMembers(
- tr.ui.b.getPolymerElementsThatSubclass(className), subclassNames);
- }
-
- checkSubclasses('a', ['b', 'c', 'd', 'e', 'f', 'g']);
- checkSubclasses('b', []);
- checkSubclasses('c', ['d', 'e', 'f', 'g']);
- checkSubclasses('d', ['f', 'g']);
- checkSubclasses('e', []);
- checkSubclasses('f', []);
- checkSubclasses('g', []);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/quad_stack_view.html b/chromium/third_party/catapult/tracing/tracing/ui/base/quad_stack_view.html
deleted file mode 100644
index 7c181a61857..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/quad_stack_view.html
+++ /dev/null
@@ -1,689 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/bbox2.html">
-<link rel="import" href="/tracing/base/math.html">
-<link rel="import" href="/tracing/base/quad.html">
-<link rel="import" href="/tracing/base/raf.html">
-<link rel="import" href="/tracing/base/rect.html">
-<link rel="import" href="/tracing/base/settings.html">
-<link rel="import" href="/tracing/ui/base/camera.html">
-<link rel="import" href="/tracing/ui/base/mouse_mode_selector.html">
-<link rel="import" href="/tracing/ui/base/mouse_tracker.html">
-<link rel="import" href="/tracing/ui/base/utils.html">
-
-<style>
-* /deep/ quad-stack-view {
- display: block;
- float: left;
- height: 100%;
- overflow: hidden;
- position: relative; /* For the absolute positioned mouse-mode-selector */
- width: 100%;
-}
-
-* /deep/ quad-stack-view > #header {
- position: absolute;
- font-size: 70%;
- top: 10px;
- left: 10px;
- width: 800px;
-}
-* /deep/ quad-stack-view > #stacking-distance-slider {
- position: absolute;
- font-size: 70%;
- top: 10px;
- right: 10px;
-}
-
-* /deep/ quad-stack-view > #chrome-left {
- background-image: url('../images/chrome-left.png');
- display: none;
-}
-
-* /deep/ quad-stack-view > #chrome-mid {
- background-image: url('../images/chrome-mid.png');
- display: none;
-}
-
-* /deep/ quad-stack-view > #chrome-right {
- background-image: url('../images/chrome-right.png');
- display: none;
-}
-</style>
-
-<template id='quad-stack-view-template'>
- <div id="header"></div>
- <input id="stacking-distance-slider" type="range" min=1 max=400 step=1>
- </input>
- <canvas id='canvas'></canvas>
- <img id='chrome-left'/>
- <img id='chrome-mid'/>
- <img id='chrome-right'/>
-</template>
-
-<script>
-'use strict';
-
-/**
- * @fileoverview QuadStackView controls the content and viewing angle a
- * QuadStack.
- */
-tr.exportTo('tr.ui.b', function() {
- var THIS_DOC = document.currentScript.ownerDocument;
-
- var constants = {};
- constants.IMAGE_LOAD_RETRY_TIME_MS = 500;
- constants.SUBDIVISION_MINIMUM = 1;
- constants.SUBDIVISION_RECURSION_DEPTH = 3;
- constants.SUBDIVISION_DEPTH_THRESHOLD = 100;
- constants.FAR_PLANE_DISTANCE = 10000;
-
- // Care of bckenney@ via
- // http://extremelysatisfactorytotalitarianism.com/blog/?p=2120
- function drawTexturedTriangle(ctx, img, p0, p1, p2, t0, t1, t2) {
- var tmp_p0 = [p0[0], p0[1]];
- var tmp_p1 = [p1[0], p1[1]];
- var tmp_p2 = [p2[0], p2[1]];
- var tmp_t0 = [t0[0], t0[1]];
- var tmp_t1 = [t1[0], t1[1]];
- var tmp_t2 = [t2[0], t2[1]];
-
- ctx.beginPath();
- ctx.moveTo(tmp_p0[0], tmp_p0[1]);
- ctx.lineTo(tmp_p1[0], tmp_p1[1]);
- ctx.lineTo(tmp_p2[0], tmp_p2[1]);
- ctx.closePath();
-
- tmp_p1[0] -= tmp_p0[0];
- tmp_p1[1] -= tmp_p0[1];
- tmp_p2[0] -= tmp_p0[0];
- tmp_p2[1] -= tmp_p0[1];
-
- tmp_t1[0] -= tmp_t0[0];
- tmp_t1[1] -= tmp_t0[1];
- tmp_t2[0] -= tmp_t0[0];
- tmp_t2[1] -= tmp_t0[1];
-
- var det = 1 / (tmp_t1[0] * tmp_t2[1] - tmp_t2[0] * tmp_t1[1]),
-
- // linear transformation
- a = (tmp_t2[1] * tmp_p1[0] - tmp_t1[1] * tmp_p2[0]) * det,
- b = (tmp_t2[1] * tmp_p1[1] - tmp_t1[1] * tmp_p2[1]) * det,
- c = (tmp_t1[0] * tmp_p2[0] - tmp_t2[0] * tmp_p1[0]) * det,
- d = (tmp_t1[0] * tmp_p2[1] - tmp_t2[0] * tmp_p1[1]) * det,
-
- // translation
- e = tmp_p0[0] - a * tmp_t0[0] - c * tmp_t0[1],
- f = tmp_p0[1] - b * tmp_t0[0] - d * tmp_t0[1];
-
- ctx.save();
- ctx.transform(a, b, c, d, e, f);
- ctx.clip();
- ctx.drawImage(img, 0, 0);
- ctx.restore();
- }
-
- function drawTriangleSub(
- ctx, img, p0, p1, p2, t0, t1, t2, opt_recursion_depth) {
- var depth = opt_recursion_depth || 0;
-
- // We may subdivide if we are not at the limit of recursion.
- var subdivisionIndex = 0;
- if (depth < constants.SUBDIVISION_MINIMUM) {
- subdivisionIndex = 7;
- } else if (depth < constants.SUBDIVISION_RECURSION_DEPTH) {
- if (Math.abs(p0[2] - p1[2]) > constants.SUBDIVISION_DEPTH_THRESHOLD)
- subdivisionIndex += 1;
- if (Math.abs(p0[2] - p2[2]) > constants.SUBDIVISION_DEPTH_THRESHOLD)
- subdivisionIndex += 2;
- if (Math.abs(p1[2] - p2[2]) > constants.SUBDIVISION_DEPTH_THRESHOLD)
- subdivisionIndex += 4;
- }
-
- // These need to be created every time, since temporaries
- // outside of the scope will be rewritten in recursion.
- var p01 = vec4.create();
- var p02 = vec4.create();
- var p12 = vec4.create();
- var t01 = vec2.create();
- var t02 = vec2.create();
- var t12 = vec2.create();
-
- // Calculate the position before w-divide.
- for (var i = 0; i < 2; ++i) {
- p0[i] *= p0[2];
- p1[i] *= p1[2];
- p2[i] *= p2[2];
- }
-
- // Interpolate the 3d position.
- for (var i = 0; i < 4; ++i) {
- p01[i] = (p0[i] + p1[i]) / 2;
- p02[i] = (p0[i] + p2[i]) / 2;
- p12[i] = (p1[i] + p2[i]) / 2;
- }
-
- // Re-apply w-divide to the original points and the interpolated ones.
- for (var i = 0; i < 2; ++i) {
- p0[i] /= p0[2];
- p1[i] /= p1[2];
- p2[i] /= p2[2];
-
- p01[i] /= p01[2];
- p02[i] /= p02[2];
- p12[i] /= p12[2];
- }
-
- // Interpolate the texture coordinates.
- for (var i = 0; i < 2; ++i) {
- t01[i] = (t0[i] + t1[i]) / 2;
- t02[i] = (t0[i] + t2[i]) / 2;
- t12[i] = (t1[i] + t2[i]) / 2;
- }
-
- // Based on the index, we subdivide the triangle differently.
- // Assuming the triangle is p0, p1, p2 and points between i j
- // are represented as pij (that is, a point between p2 and p0
- // is p02, etc), then the new triangles are defined by
- // the 3rd 4th and 5th arguments into the function.
- switch (subdivisionIndex) {
- case 1:
- drawTriangleSub(ctx, img, p0, p01, p2, t0, t01, t2, depth + 1);
- drawTriangleSub(ctx, img, p01, p1, p2, t01, t1, t2, depth + 1);
- break;
- case 2:
- drawTriangleSub(ctx, img, p0, p1, p02, t0, t1, t02, depth + 1);
- drawTriangleSub(ctx, img, p1, p02, p2, t1, t02, t2, depth + 1);
- break;
- case 3:
- drawTriangleSub(ctx, img, p0, p01, p02, t0, t01, t02, depth + 1);
- drawTriangleSub(ctx, img, p02, p01, p2, t02, t01, t2, depth + 1);
- drawTriangleSub(ctx, img, p01, p1, p2, t01, t1, t2, depth + 1);
- break;
- case 4:
- drawTriangleSub(ctx, img, p0, p12, p2, t0, t12, t2, depth + 1);
- drawTriangleSub(ctx, img, p0, p1, p12, t0, t1, t12, depth + 1);
- break;
- case 5:
- drawTriangleSub(ctx, img, p0, p01, p2, t0, t01, t2, depth + 1);
- drawTriangleSub(ctx, img, p2, p01, p12, t2, t01, t12, depth + 1);
- drawTriangleSub(ctx, img, p01, p1, p12, t01, t1, t12, depth + 1);
- break;
- case 6:
- drawTriangleSub(ctx, img, p0, p12, p02, t0, t12, t02, depth + 1);
- drawTriangleSub(ctx, img, p0, p1, p12, t0, t1, t12, depth + 1);
- drawTriangleSub(ctx, img, p02, p12, p2, t02, t12, t2, depth + 1);
- break;
- case 7:
- drawTriangleSub(ctx, img, p0, p01, p02, t0, t01, t02, depth + 1);
- drawTriangleSub(ctx, img, p01, p12, p02, t01, t12, t02, depth + 1);
- drawTriangleSub(ctx, img, p01, p1, p12, t01, t1, t12, depth + 1);
- drawTriangleSub(ctx, img, p02, p12, p2, t02, t12, t2, depth + 1);
- break;
- default:
- // In the 0 case and all other cases, we simply draw the triangle.
- drawTexturedTriangle(ctx, img, p0, p1, p2, t0, t1, t2);
- break;
- }
- }
-
- // Created to avoid creating garbage when doing bulk transforms.
- var tmp_vec4 = vec4.create();
- function transform(transformed, point, matrix, viewport) {
- vec4.set(tmp_vec4, point[0], point[1], 0, 1);
- vec4.transformMat4(tmp_vec4, tmp_vec4, matrix);
-
- var w = tmp_vec4[3];
- if (w < 1e-6) w = 1e-6;
-
- transformed[0] = ((tmp_vec4[0] / w) + 1) * viewport.width / 2;
- transformed[1] = ((tmp_vec4[1] / w) + 1) * viewport.height / 2;
- transformed[2] = w;
- }
-
- function drawProjectedQuadBackgroundToContext(
- quad, p1, p2, p3, p4, ctx, quadCanvas) {
- if (quad.imageData) {
- quadCanvas.width = quad.imageData.width;
- quadCanvas.height = quad.imageData.height;
- quadCanvas.getContext('2d').putImageData(quad.imageData, 0, 0);
- var quadBBox = new tr.b.BBox2();
- quadBBox.addQuad(quad);
- var iw = quadCanvas.width;
- var ih = quadCanvas.height;
- drawTriangleSub(
- ctx, quadCanvas,
- p1, p2, p4,
- [0, 0], [iw, 0], [0, ih]);
- drawTriangleSub(
- ctx, quadCanvas,
- p2, p3, p4,
- [iw, 0], [iw, ih], [0, ih]);
- }
-
- if (quad.backgroundColor) {
- ctx.fillStyle = quad.backgroundColor;
- ctx.beginPath();
- ctx.moveTo(p1[0], p1[1]);
- ctx.lineTo(p2[0], p2[1]);
- ctx.lineTo(p3[0], p3[1]);
- ctx.lineTo(p4[0], p4[1]);
- ctx.closePath();
- ctx.fill();
- }
- }
-
- function drawProjectedQuadOutlineToContext(
- quad, p1, p2, p3, p4, ctx, quadCanvas) {
- ctx.beginPath();
- ctx.moveTo(p1[0], p1[1]);
- ctx.lineTo(p2[0], p2[1]);
- ctx.lineTo(p3[0], p3[1]);
- ctx.lineTo(p4[0], p4[1]);
- ctx.closePath();
- ctx.save();
- if (quad.borderColor)
- ctx.strokeStyle = quad.borderColor;
- else
- ctx.strokeStyle = 'rgb(128,128,128)';
-
- if (quad.shadowOffset) {
- ctx.shadowColor = 'rgb(0, 0, 0)';
- ctx.shadowOffsetX = quad.shadowOffset[0];
- ctx.shadowOffsetY = quad.shadowOffset[1];
- if (quad.shadowBlur)
- ctx.shadowBlur = quad.shadowBlur;
- }
-
- if (quad.borderWidth)
- ctx.lineWidth = quad.borderWidth;
- else
- ctx.lineWidth = 1;
-
- ctx.stroke();
- ctx.restore();
- }
-
- function drawProjectedQuadSelectionOutlineToContext(
- quad, p1, p2, p3, p4, ctx, quadCanvas) {
- if (!quad.upperBorderColor)
- return;
-
- ctx.lineWidth = 8;
- ctx.strokeStyle = quad.upperBorderColor;
-
- ctx.beginPath();
- ctx.moveTo(p1[0], p1[1]);
- ctx.lineTo(p2[0], p2[1]);
- ctx.lineTo(p3[0], p3[1]);
- ctx.lineTo(p4[0], p4[1]);
- ctx.closePath();
- ctx.stroke();
- }
-
- function drawProjectedQuadToContext(
- passNumber, quad, p1, p2, p3, p4, ctx, quadCanvas) {
- if (passNumber === 0) {
- drawProjectedQuadBackgroundToContext(
- quad, p1, p2, p3, p4, ctx, quadCanvas);
- } else if (passNumber === 1) {
- drawProjectedQuadOutlineToContext(
- quad, p1, p2, p3, p4, ctx, quadCanvas);
- } else if (passNumber === 2) {
- drawProjectedQuadSelectionOutlineToContext(
- quad, p1, p2, p3, p4, ctx, quadCanvas);
- } else {
- throw new Error('Invalid pass number');
- }
- }
-
- var tmp_p1 = vec3.create();
- var tmp_p2 = vec3.create();
- var tmp_p3 = vec3.create();
- var tmp_p4 = vec3.create();
- function transformAndProcessQuads(
- matrix, viewport, quads, numPasses, handleQuadFunc, opt_arg1, opt_arg2) {
-
- for (var passNumber = 0; passNumber < numPasses; passNumber++) {
- for (var i = 0; i < quads.length; i++) {
- var quad = quads[i];
- transform(tmp_p1, quad.p1, matrix, viewport);
- transform(tmp_p2, quad.p2, matrix, viewport);
- transform(tmp_p3, quad.p3, matrix, viewport);
- transform(tmp_p4, quad.p4, matrix, viewport);
- handleQuadFunc(passNumber, quad,
- tmp_p1, tmp_p2, tmp_p3, tmp_p4,
- opt_arg1, opt_arg2);
- }
- }
- }
-
- /**
- * @constructor
- */
- var QuadStackView = tr.ui.b.define('quad-stack-view');
-
- QuadStackView.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.className = 'quad-stack-view';
-
- var node = tr.ui.b.instantiateTemplate('#quad-stack-view-template',
- THIS_DOC);
- this.appendChild(node);
- this.updateHeaderVisibility_();
- this.canvas_ = this.querySelector('#canvas');
- this.chromeImages_ = {
- left: this.querySelector('#chrome-left'),
- mid: this.querySelector('#chrome-mid'),
- right: this.querySelector('#chrome-right')
- };
-
- var stackingDistanceSlider = this.querySelector(
- '#stacking-distance-slider');
- stackingDistanceSlider.value = tr.b.Settings.get(
- 'quadStackView.stackingDistance', 45);
- stackingDistanceSlider.addEventListener(
- 'change', this.onStackingDistanceChange_.bind(this));
- stackingDistanceSlider.addEventListener(
- 'input', this.onStackingDistanceChange_.bind(this));
-
- this.trackMouse_();
-
- this.camera_ = new tr.ui.b.Camera(this.mouseModeSelector_);
- this.camera_.addEventListener('renderrequired',
- this.onRenderRequired_.bind(this));
- this.cameraWasReset_ = false;
- this.camera_.canvas = this.canvas_;
-
- this.viewportRect_ = tr.b.Rect.fromXYWH(0, 0, 0, 0);
-
- this.pixelRatio_ = window.devicePixelRatio || 1;
- },
-
- updateHeaderVisibility_: function() {
- if (this.headerText)
- this.querySelector('#header').style.display = '';
- else
- this.querySelector('#header').style.display = 'none';
- },
-
- get headerText() {
- return this.querySelector('#header').textContent;
- },
-
- set headerText(headerText) {
- this.querySelector('#header').textContent = headerText;
- this.updateHeaderVisibility_();
- },
-
- onStackingDistanceChange_: function(e) {
- tr.b.Settings.set('quadStackView.stackingDistance',
- this.stackingDistance);
- this.scheduleRender();
- e.stopPropagation();
- },
-
- get stackingDistance() {
- return this.querySelector('#stacking-distance-slider').value;
- },
-
- get mouseModeSelector() {
- return this.mouseModeSelector_;
- },
-
- get camera() {
- return this.camera_;
- },
-
- set quads(q) {
- this.quads_ = q;
- this.scheduleRender();
- },
-
- set deviceRect(rect) {
- if (!rect || rect.equalTo(this.deviceRect_))
- return;
-
- this.deviceRect_ = rect;
- this.camera_.deviceRect = rect;
- this.chromeQuad_ = undefined;
- },
-
- resize: function() {
- if (!this.offsetParent)
- return true;
-
- var width = parseInt(window.getComputedStyle(this.offsetParent).width);
- var height = parseInt(window.getComputedStyle(this.offsetParent).height);
- var rect = tr.b.Rect.fromXYWH(0, 0, width, height);
-
- if (rect.equalTo(this.viewportRect_))
- return false;
-
- this.viewportRect_ = rect;
- this.style.width = width + 'px';
- this.style.height = height + 'px';
- this.canvas_.style.width = width + 'px';
- this.canvas_.style.height = height + 'px';
- this.canvas_.width = this.pixelRatio_ * width;
- this.canvas_.height = this.pixelRatio_ * height;
- if (!this.cameraWasReset_) {
- this.camera_.resetCamera();
- this.cameraWasReset_ = true;
- }
- return true;
- },
-
- readyToDraw: function() {
- // If src isn't set yet, set it to ensure we can use
- // the image to draw onto a canvas.
- if (!this.chromeImages_.left.src) {
- var leftContent =
- window.getComputedStyle(this.chromeImages_.left).backgroundImage;
- leftContent = tr.ui.b.extractUrlString(leftContent);
-
- var midContent =
- window.getComputedStyle(this.chromeImages_.mid).backgroundImage;
- midContent = tr.ui.b.extractUrlString(midContent);
-
- var rightContent =
- window.getComputedStyle(this.chromeImages_.right).backgroundImage;
- rightContent = tr.ui.b.extractUrlString(rightContent);
-
- this.chromeImages_.left.src = leftContent;
- this.chromeImages_.mid.src = midContent;
- this.chromeImages_.right.src = rightContent;
- }
-
- // If all of the images are loaded (height > 0), then
- // we are ready to draw.
- return (this.chromeImages_.left.height > 0) &&
- (this.chromeImages_.mid.height > 0) &&
- (this.chromeImages_.right.height > 0);
- },
-
- get chromeQuad() {
- if (this.chromeQuad_)
- return this.chromeQuad_;
-
- // Draw the chrome border into a separate canvas.
- var chromeCanvas = document.createElement('canvas');
- var offsetY = this.chromeImages_.left.height;
-
- chromeCanvas.width = this.deviceRect_.width;
- chromeCanvas.height = this.deviceRect_.height + offsetY;
-
- var leftWidth = this.chromeImages_.left.width;
- var midWidth = this.chromeImages_.mid.width;
- var rightWidth = this.chromeImages_.right.width;
-
- var chromeCtx = chromeCanvas.getContext('2d');
- chromeCtx.drawImage(this.chromeImages_.left, 0, 0);
-
- chromeCtx.save();
- chromeCtx.translate(leftWidth, 0);
-
- // Calculate the scale of the mid image.
- var s = (this.deviceRect_.width - leftWidth - rightWidth) / midWidth;
- chromeCtx.scale(s, 1);
-
- chromeCtx.drawImage(this.chromeImages_.mid, 0, 0);
- chromeCtx.restore();
-
- chromeCtx.drawImage(
- this.chromeImages_.right, leftWidth + s * midWidth, 0);
-
- // Construct the quad.
- var chromeRect = tr.b.Rect.fromXYWH(
- this.deviceRect_.x,
- this.deviceRect_.y - offsetY,
- this.deviceRect_.width,
- this.deviceRect_.height + offsetY);
- var chromeQuad = tr.b.Quad.fromRect(chromeRect);
- chromeQuad.stackingGroupId = this.maxStackingGroupId_ + 1;
- chromeQuad.imageData = chromeCtx.getImageData(
- 0, 0, chromeCanvas.width, chromeCanvas.height);
- chromeQuad.shadowOffset = [0, 0];
- chromeQuad.shadowBlur = 5;
- chromeQuad.borderWidth = 3;
- this.chromeQuad_ = chromeQuad;
- return this.chromeQuad_;
- },
-
- scheduleRender: function() {
- if (this.redrawScheduled_)
- return false;
- this.redrawScheduled_ = true;
- tr.b.requestAnimationFrame(this.render, this);
- },
-
- onRenderRequired_: function(e) {
- this.scheduleRender();
- },
-
- stackTransformAndProcessQuads_: function(
- numPasses, handleQuadFunc, includeChromeQuad, opt_arg1, opt_arg2) {
- var mv = this.camera_.modelViewMatrix;
- var p = this.camera_.projectionMatrix;
-
- var viewport = tr.b.Rect.fromXYWH(
- 0, 0, this.canvas_.width, this.canvas_.height);
-
- // Calculate the quad stacks.
- var quadStacks = [];
- for (var i = 0; i < this.quads_.length; ++i) {
- var quad = this.quads_[i];
- var stackingId = quad.stackingGroupId || 0;
- while (stackingId >= quadStacks.length)
- quadStacks.push([]);
-
- quadStacks[stackingId].push(quad);
- }
-
- var mvp = mat4.create();
- this.maxStackingGroupId_ = quadStacks.length;
- var effectiveStackingDistance =
- this.stackingDistance * this.camera_.stackingDistanceDampening;
-
- // Draw the quad stacks, raising each subsequent level.
- mat4.multiply(mvp, p, mv);
- for (var i = 0; i < quadStacks.length; ++i) {
- transformAndProcessQuads(mvp, viewport, quadStacks[i],
- numPasses, handleQuadFunc,
- opt_arg1, opt_arg2);
-
- mat4.translate(mv, mv, [0, 0, effectiveStackingDistance]);
- mat4.multiply(mvp, p, mv);
- }
-
- if (includeChromeQuad && this.deviceRect_) {
- transformAndProcessQuads(mvp, viewport, [this.chromeQuad],
- numPasses, drawProjectedQuadToContext,
- opt_arg1, opt_arg2);
- }
- },
-
- render: function() {
- this.redrawScheduled_ = false;
-
- if (!this.readyToDraw()) {
- setTimeout(this.scheduleRender.bind(this),
- constants.IMAGE_LOAD_RETRY_TIME_MS);
- return;
- }
-
- if (!this.quads_)
- return;
-
- var canvasCtx = this.canvas_.getContext('2d');
- if (!this.resize())
- canvasCtx.clearRect(0, 0, this.canvas_.width, this.canvas_.height);
-
- var quadCanvas = document.createElement('canvas');
- this.stackTransformAndProcessQuads_(
- 3, drawProjectedQuadToContext, true,
- canvasCtx, quadCanvas);
- quadCanvas.width = 0; // Hack: Frees the quadCanvas' resources.
- },
-
- trackMouse_: function() {
- this.mouseModeSelector_ = document.createElement(
- 'tr-ui-b-mouse-mode-selector');
- this.mouseModeSelector_.targetElement = this.canvas_;
- this.mouseModeSelector_.supportedModeMask =
- tr.ui.b.MOUSE_SELECTOR_MODE.SELECTION |
- tr.ui.b.MOUSE_SELECTOR_MODE.PANSCAN |
- tr.ui.b.MOUSE_SELECTOR_MODE.ZOOM |
- tr.ui.b.MOUSE_SELECTOR_MODE.ROTATE;
- this.mouseModeSelector_.mode = tr.ui.b.MOUSE_SELECTOR_MODE.PANSCAN;
- this.mouseModeSelector_.pos = {x: 0, y: 100};
- this.appendChild(this.mouseModeSelector_);
- this.mouseModeSelector_.settingsKey =
- 'quadStackView.mouseModeSelector';
-
- this.mouseModeSelector_.setModifierForAlternateMode(
- tr.ui.b.MOUSE_SELECTOR_MODE.ROTATE, tr.ui.b.MODIFIER.SHIFT);
- this.mouseModeSelector_.setModifierForAlternateMode(
- tr.ui.b.MOUSE_SELECTOR_MODE.PANSCAN, tr.ui.b.MODIFIER.SPACE);
- this.mouseModeSelector_.setModifierForAlternateMode(
- tr.ui.b.MOUSE_SELECTOR_MODE.ZOOM, tr.ui.b.MODIFIER.CMD_OR_CTRL);
-
- this.mouseModeSelector_.addEventListener('updateselection',
- this.onSelectionUpdate_.bind(this));
- this.mouseModeSelector_.addEventListener('endselection',
- this.onSelectionUpdate_.bind(this));
- },
-
- extractRelativeMousePosition_: function(e) {
- var br = this.canvas_.getBoundingClientRect();
- return [
- this.pixelRatio_ * (e.clientX - this.canvas_.offsetLeft - br.left),
- this.pixelRatio_ * (e.clientY - this.canvas_.offsetTop - br.top)
- ];
- },
-
- onSelectionUpdate_: function(e) {
- var mousePos = this.extractRelativeMousePosition_(e);
- var res = [];
- function handleQuad(passNumber, quad, p1, p2, p3, p4) {
- if (tr.b.pointInImplicitQuad(mousePos, p1, p2, p3, p4))
- res.push(quad);
- }
- this.stackTransformAndProcessQuads_(1, handleQuad, false);
- var e = new tr.b.Event('selectionchange');
- e.quads = res;
- this.dispatchEvent(e);
- }
- };
-
- return {
- QuadStackView: QuadStackView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/radio_picker.html b/chromium/third_party/catapult/tracing/tracing/ui/base/radio_picker.html
deleted file mode 100644
index 85d204a9a30..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/radio_picker.html
+++ /dev/null
@@ -1,122 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<polymer-element name='tr-ui-b-radio-picker'>
- <template>
- <style>
- #container {
- display: flex;
- flex-direction: column;
- }
- </style>
-
- <div id="container">
- </div>
-
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.needsInit_ = true;
- this.settingsKey_ = undefined;
- this.is_ready_ = false;
- this.radio_buttons_ = undefined;
- // Keeping track of which key is selected. This member should only be set
- // set inside select() method to make sure that logical state & the UI
- // state is consistent.
- this.selectedKey_ = undefined;
- },
-
- ready: function() {
- this.is_ready_ = true;
- this.maybeInit_();
- this.maybeRenderRadioButtons_();
- },
-
- get settingsKey() {
- return this.settingsKey_;
- },
-
- set settingsKey(settingsKey) {
- if (!this.needsInit_)
- throw new Error('Already initialized.');
- this.settingsKey_ = settingsKey;
- this.maybeInit_();
- },
-
- maybeInit_: function() {
- if (!this.needsInit_)
- return;
- if (this.settingsKey_ === undefined)
- return;
- this.needsInit_ = false;
- this.select(tr.b.Settings.get(this.settingsKey_));
- },
-
- set items(items) {
- this.radio_buttons_ = {};
- items.forEach(function(e) {
- if (e.key in this.radio_buttons_)
- throw new Error(e.key + ' already exists');
- var radio_button = document.createElement('div');
- var input = document.createElement('input');
- var label = document.createElement('div');
- input.type = 'radio';
- input.addEventListener('click', function() {
- this.select(e.key);
- }.bind(this));
- label.innerHTML = e.label;
- label.style.display = 'inline';
- radio_button.appendChild(input);
- radio_button.appendChild(label);
- this.radio_buttons_[e.key] = input;
- }.bind(this));
-
- this.maybeInit_();
- this.maybeRenderRadioButtons_();
- },
-
- maybeRenderRadioButtons_: function() {
- if (!this.is_ready_)
- return;
- if (this.radio_buttons_ === undefined)
- return;
- for (var key in this.radio_buttons_)
- this.$.container.appendChild(this.radio_buttons_[key].parentElement);
- if (this.selectedKey_ !== undefined)
- this.select(this.selectedKey_);
- },
-
- select: function(key) {
- if (key === undefined)
- return;
- if (this.radio_buttons_ == undefined) {
- this.selectedKey_ = key;
- return;
- }
- if (!(key in this.radio_buttons_))
- throw new Error(key + ' does not exists');
- // Unselect the previous radio, update the key & select the new one.
- if (this.selectedKey_ !== undefined)
- this.radio_buttons_[this.selectedKey_].checked = false;
- this.selectedKey_ = key;
- tr.b.Settings.set(this.settingsKey_, this.selectedKey_);
- if (this.selectedKey_ !== undefined)
- this.radio_buttons_[this.selectedKey_].checked = true;
- },
-
- get selectedKey() {
- return this.selectedKey_;
- },
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/radio_picker_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/radio_picker_test.html
deleted file mode 100644
index dea60cdd492..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/radio_picker_test.html
+++ /dev/null
@@ -1,89 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/radio_picker.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('basic', function() {
- var rp = document.createElement('tr-ui-b-radio-picker');
- rp.items = [
- {key: 'Toyota', label: 'I want to drive Toyota'},
- {key: 'Boeing', label: 'I want to fly'},
- {key: 'Submarine', label: 'I want to swim'}
- ];
- this.addHTMLOutput(rp);
- assert.equal(rp.selectedKey, undefined);
- rp.select('Toyota');
- assert.equal(rp.selectedKey, 'Toyota');
- });
-
- test('persistentState_setSelectedKeyAfterSettingItems', function() {
- var items = [
- {key: 'Toyota', label: 'I want to drive Toyota'},
- {key: 'Boeing', label: 'I want to fly'},
- {key: 'Submarine', label: 'I want to swim'}
- ];
- var container1 = tr.ui.b.createDiv({textContent: 'Radio Picker One'});
- container1.style.border = 'solid';
- var rp = document.createElement('tr-ui-b-radio-picker');
- rp.items = items;
- rp.settingsKey = 'radio-picker-test-one';
- container1.appendChild(rp);
- this.addHTMLOutput(container1);
- assert.equal(rp.selectedKey, undefined);
- rp.select('Toyota');
- assert.equal(rp.selectedKey, 'Toyota');
-
- var container2 = tr.ui.b.createDiv({
- textContent: 'Radio Picker Two (same settingKey as Radio Picker One)'});
- container2.style.border = 'solid';
- var rp2 = document.createElement('tr-ui-b-radio-picker');
- rp2.items = items;
- rp2.settingsKey = 'radio-picker-test-one';
- container2.appendChild(rp2);
- this.addHTMLOutput(container2);
-
- assert.equal(rp2.selectedKey, 'Toyota');
- });
-
- test('persistentState_setSelectedKeyBeforeSettingItems', function() {
- var items = [
- {key: 'Toyota', label: 'I want to drive Toyota'},
- {key: 'Boeing', label: 'I want to fly'},
- {key: 'Submarine', label: 'I want to swim'}
- ];
- var container1 = tr.ui.b.createDiv({textContent: 'Radio Picker One'});
- container1.style.border = 'solid';
- var rp = document.createElement('tr-ui-b-radio-picker');
- rp.settingsKey = 'radio-picker-test-two';
- rp.items = items;
- container1.appendChild(rp);
- this.addHTMLOutput(container1);
- assert.equal(rp.selectedKey, undefined);
- rp.select('Boeing');
- assert.equal(rp.selectedKey, 'Boeing');
-
- var container2 = tr.ui.b.createDiv({
- textContent: 'Radio Picker Two (same settingKey as Radio Picker One)'});
- container2.style.border = 'solid';
- var rp2 = document.createElement('tr-ui-b-radio-picker');
- rp2.settingsKey = 'radio-picker-test-two';
- container2.appendChild(rp2);
- this.addHTMLOutput(container2);
- rp2.items = items;
-
- assert.equal(rp2.selectedKey, 'Boeing');
- });
-
-
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/resize_sensor.html b/chromium/third_party/catapult/tracing/tracing/ui/base/resize_sensor.html
deleted file mode 100644
index bbb696062bf..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/resize_sensor.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/utils.html">
-
-<script src="/css-element-queries/src/ResizeSensor.js"></script>
-
-<!--
-@fileoverview A container that senses when its size changes.
--->
-<polymer-element name="tr-ui-b-resize-sensor">
- <template>
- <style>
- :host {
- display: flex;
- flex: 1 1 auto;
- }
- </style>
- <div id="container">
- <content></content>
- </div>
- </template>
-
- <script>
- 'use strict';
- (function() {
- Polymer({
- attached: function() {
- // ResizeSensor only works if it's rooted in a document when it's
- // created, so wait until the tr-ui-b-resize-sensor is attached to the
- // DOM before creating the ResizeSensor.
- this.sensor_ = new ResizeSensor(this.$.container,
- this.onResize_.bind(this));
- // ResizeSensor appends a div to this.$.container. That div must be a
- // direct sibling of <content>.
- // ResizeSensor's first argument must be a Node, so it cannot be
- // this.shadowRoot.
- },
-
- onResize_: function() {
- this.dispatchEvent(new tr.b.Event('resize', false, false));
- }
- });
- })();
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/resize_sensor_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/resize_sensor_test.html
deleted file mode 100644
index fea1f71669b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/resize_sensor_test.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/task.html">
-<link rel="import" href="/tracing/ui/base/resize_sensor.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function forceLayout(element) {
- element.offsetHeight;
- }
-
- test('instantiate', function() {
- var sensor = document.createElement('tr-ui-b-resize-sensor');
- sensor.appendChild(document.createTextNode('hello'));
-
- var resizeCount = 0;
- function onResize(event) {
- resizeCount += 1;
- }
-
- this.addHTMLOutput(sensor);
- forceLayout(sensor);
- sensor.addEventListener('resize', onResize);
-
- // Trigger a resize:
- sensor.style.fontSize = '20pt';
- forceLayout(sensor);
-
- // The event doesn't fire synchronously, so return a Promise that will
- // resolve whenever the test is done.
- return new Promise(function(resolve, reject) {
- // The resize event fires when the sensor is re-laid-out.
- // Use requestAnimationFrame to wait until after the sensor is
- // re-laid-out.
- // This doesn't work if the page becomes invisible.
- window.requestAnimationFrame(function() {
- assert.equal(1, resizeCount);
- sensor.removeEventListener('resize', onResize);
- sensor.style.fontSize = '12pt';
- forceLayout(sensor);
- window.requestAnimationFrame(function() {
- assert.equal(1, resizeCount);
- resolve();
- });
- });
- });
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/scatter_chart.html b/chromium/third_party/catapult/tracing/tracing/ui/base/scatter_chart.html
deleted file mode 100644
index 5dffbe8da02..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/scatter_chart.html
+++ /dev/null
@@ -1,118 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/ui/base/chart_base_2d.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- var ChartBase2D = tr.ui.b.ChartBase2D;
-
- // @constructor
- var ScatterChart = tr.ui.b.define('scatter-chart', ChartBase2D);
-
- // @constructor
- ScatterChart.Dot = function(x, y, radius, color, breadcrumb) {
- this.x = x;
- this.y = y;
- this.radius = radius;
- this.color = color;
- this.breadcrumb = breadcrumb;
- };
-
- ScatterChart.prototype = {
- __proto__: ChartBase2D.prototype,
-
- decorate: function() {
- ChartBase2D.prototype.decorate.call(this);
- this.classList.add('scatter-chart');
-
- this.brushedXRange_ = new tr.b.Range();
- this.brushedYRange_ = new tr.b.Range();
- },
-
- setBrushedRanges: function(xRange, yRange) {
- this.brushedXRange_.reset();
- this.brushedYRange_.reset();
- if (!xRange.isEmpty && !yRange.isEmpty) {
- this.brushedXRange_.addRange(xRange);
- this.brushedYRange_.addRange(yRange);
- }
- this.updateContents_();
- },
-
- updateBrushContents_: function(brushSel) {
- brushSel.selectAll('*').remove();
- var brushes = [];
- if (!this.brushedXRange_.isEmpty && !this.brushedYRange_.isEmpty)
- brushes.push({});
- var brushRectsSel = brushSel.selectAll('rect').data(brushes);
- brushRectsSel.enter().append('rect');
- brushRectsSel.exit().remove();
- brushRectsSel
- .attr('x', function(d) {
- return this.xScale_(this.brushedXRange_.min);
- }.bind(this))
- .attr('y', function(d) {
- return this.yScale_(this.brushedYRange_.max);
- }.bind(this))
- .attr('width', function(d) {
- return this.xScale_(this.brushedXRange_.max) -
- this.xScale_(this.brushedXRange_.min);
- }.bind(this))
- .attr('height', function(d) {
- return this.yScale_(this.brushedYRange_.min) -
- this.yScale_(this.brushedYRange_.max);
- }.bind(this));
- },
-
- setDataFromCallbacks: function(data, getX, getY, getRadius, getColor) {
- this.data = data.map(function(datum) {
- return new ScatterChart.Dot(getX(datum),
- getY(datum),
- getRadius(datum),
- getColor(datum),
- datum);
- });
- },
-
- isDatumFieldSeries_: function(fieldName) {
- return fieldName === 'y';
- },
-
- getXForDatum_: function(datum, index) {
- return datum.x;
- },
-
- updateDataContents_: function(dataSel) {
- dataSel.selectAll('*').remove();
- var dotsSel = dataSel.selectAll('circle')
- .data(this.data_)
- .enter()
- .append('circle');
- dotsSel.attr('cx', function(datum) {
- return this.xScale_(datum.x);
- }.bind(this))
- .attr('cy', function(datum) {
- return this.yScale_(datum.y);
- }.bind(this))
- .attr('r', function(datum) {
- return tr.b.clamp(datum.radius, 2, 10);
- }.bind(this))
- .attr('fill', function(datum) {
- return datum.color;
- }.bind(this));
- }
- };
-
- return {
- ScatterChart: ScatterChart
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/scatter_chart_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/scatter_chart_test.html
deleted file mode 100644
index 6b9243fa02f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/scatter_chart_test.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/scatter_chart.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiation_singleSeries', function() {
- var chart = new tr.ui.b.ScatterChart();
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 10, y: 100, radius: 2, color: 'red'},
- {x: 20, y: 110, radius: 10, color: 'red'},
- {x: 30, y: 100, radius: 10, color: 'red'},
- {x: 40, y: 50, radius: 10, color: 'red'}
- ];
- chart.data = data;
- this.addHTMLOutput(chart);
- });
-
- test('instantiation_interactiveBrushing', function() {
- var chart = new tr.ui.b.ScatterChart();
- chart.width = 400;
- chart.height = 200;
- chart.chartTitle = 'Chart title';
- var data = [
- {x: 10, y: 50, radius: 2, color: 'blue'},
- {x: 20, y: 60, radius: 3, color: 'red'},
- {x: 30, y: 80, radius: 4, color: 'orange'},
- {x: 40, y: 20, radius: 5, color: 'purple'},
- {x: 50, y: 30, radius: 6, color: 'yellow'},
- {x: 60, y: 20, radius: 7, color: 'green'},
- {x: 70, y: 15, radius: 8, color: 'blue'},
- {x: 80, y: 20, radius: 9, color: 'red'}
- ];
- chart.data = data;
-
- var mouseDown = undefined;
-
- function updateBrushedRange(e) {
- var xRange = new tr.b.Range();
- xRange.addValue(mouseDown.x);
- xRange.addValue(e.x);
- var yRange = new tr.b.Range();
- yRange.addValue(mouseDown.y);
- yRange.addValue(e.y);
- chart.setBrushedRanges(xRange, yRange);
- }
-
- chart.addEventListener('item-mousedown', function(e) {
- mouseDown = e;
- });
- chart.addEventListener('item-mousemove', function(e) {
- updateBrushedRange(e);
- });
- chart.addEventListener('item-mouseup', function(e) {
- updateBrushedRange(e);
- mouseDown = undefined;
- });
- this.addHTMLOutput(chart);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/tab_view.html b/chromium/third_party/catapult/tracing/tracing/ui/base/tab_view.html
deleted file mode 100644
index c8ecceb51cd..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/tab_view.html
+++ /dev/null
@@ -1,428 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<polymer-element name="tr-ui-a-tab-view"
- constructor="TracingAnalysisTabView">
- <template>
- <style>
- :host {
- display: flex;
- flex-flow: column nowrap;
- overflow: hidden;
- box-sizing: border-box;
- }
-
- tab-strip[tabs-hidden] {
- display: none;
- }
-
- tab-strip {
- background-color: rgb(236, 236, 236);
- border-bottom: 1px solid #8e8e8e;
- display: flex;
- flex: 0 0 auto;
- flex-flow: row;
- overflow-x: auto;
- padding: 0 10px 0 10px;
- font-size: 12px;
- }
-
- tab-button {
- display: block;
- flex: 0 0 auto;
- padding: 4px 15px 1px 15px;
- margin-top: 2px;
- }
-
- tab-button[selected=true] {
- background-color: white;
- border: 1px solid rgb(163, 163, 163);
- border-bottom: none;
- padding: 3px 14px 1px 14px;
- }
-
- tabs-content-container {
- display: flex;
- flex: 1 1 auto;
- overflow: auto;
- width: 100%;
- }
-
- ::content > * {
- flex: 1 1 auto;
- }
-
- ::content > *:not([selected]) {
- display: none;
- }
-
- button-label {
- display: inline;
- }
-
- tab-strip-heading {
- display: block;
- flex: 0 0 auto;
- padding: 4px 15px 1px 15px;
- margin-top: 2px;
- margin-before: 20px;
- margin-after: 10px;
- }
- #tsh {
- display: inline;
- font-weight: bold;
- }
- </style>
-
- <tab-strip>
- <tab-strip-heading id="tshh">
- <span id="tsh"></span>
- </tab-strip-heading>
- <template repeat="{{tab in tabs_}}">
- <tab-button
- button-id="{{ tab.id }}"
- on-click="{{ tabButtonSelectHandler_ }}"
- selected="{{ selectedTab_.id === tab.id }}">
- <button-label>{{ tab.label ? tab.label : 'No Label'}}</button-label>
- </tab-button>
- </template>
- </tab-strip>
-
- <tabs-content-container id='content-container'>
- <content></content>
- </tabs-content-container>
-
- </template>
-
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.$.tshh.style.display = 'none';
-
- // A tab is represented by the following tuple:
- // (id, label, content, observer, savedScrollTop, savedScrollLeft).
- // The properties are used in the following way:
- // id: Uniquely identifies a tab. It is the same number as the index
- // in the tabs array. Used primarily by the on-click event attached
- // to buttons.
- // label: A string, representing the label printed on the tab button.
- // content: The light-dom child representing the contents of the tab.
- // The content is appended to this tab-view by the user.
- // observers: The observers attached to the content node to watch for
- // attribute changes. The attributes of interest are: 'selected',
- // and 'tab-label'.
- // savedScrollTop/Left: Used to return the scroll position upon switching
- // tabs. The values are generally saved when a tab switch occurs.
- //
- // The order of the tabs is relevant for the tab ordering.
- this.tabs_ = [];
- this.selectedTab_ = undefined;
-
- // Register any already existing children.
- for (var i = 0; i < this.children.length; i++)
- this.processAddedChild_(this.children[i]);
-
- // In case the user decides to add more tabs, make sure we watch for
- // any child mutations.
- this.childrenObserver_ = new MutationObserver(
- this.childrenUpdated_.bind(this));
- this.childrenObserver_.observe(this, { childList: 'true' });
- },
-
- get tabStripHeadingText() {
- return this.$.tsh.textContent;
- },
-
- set tabStripHeadingText(tabStripHeadingText) {
- this.$.tsh.textContent = tabStripHeadingText;
- if (!!tabStripHeadingText)
- this.$.tshh.style.display = '';
- else
- this.$.tshh.style.display = 'none';
- },
-
- get selectedTab() {
- // Make sure we process any pending children additions / removals, before
- // trying to select a tab. Otherwise, we might not find some children.
- this.childrenUpdated_(
- this.childrenObserver_.takeRecords(), this.childrenObserver_);
-
- // Do not give access to the user to the inner data structure.
- // A user should only be able to mutate the added tab content.
- if (this.selectedTab_)
- return this.selectedTab_.content;
- return undefined;
- },
-
- set selectedTab(content) {
- // Make sure we process any pending children additions / removals, before
- // trying to select a tab. Otherwise, we might not find some children.
- this.childrenUpdated_(
- this.childrenObserver_.takeRecords(), this.childrenObserver_);
-
- if (content === undefined || content === null) {
- this.changeSelectedTabById_(undefined);
- return;
- }
-
- // Search for the specific node in our tabs list.
- // If it is not there print a warning.
- var contentTabId = undefined;
- for (var i = 0; i < this.tabs_.length; i++)
- if (this.tabs_[i].content === content) {
- contentTabId = this.tabs_[i].id;
- break;
- }
-
- if (contentTabId === undefined)
- return;
-
- this.changeSelectedTabById_(contentTabId);
- },
-
- get tabsHidden() {
- var ts = this.shadowRoot.querySelector('tab-strip');
- return ts.hasAttribute('tabs-hidden');
- },
-
- set tabsHidden(tabsHidden) {
- tabsHidden = !!tabsHidden;
- var ts = this.shadowRoot.querySelector('tab-strip');
- if (tabsHidden)
- ts.setAttribute('tabs-hidden', true);
- else
- ts.removeAttribute('tabs-hidden');
- },
-
- get tabs() {
- return this.tabs_.map(function(tabObject) {
- return tabObject.content;
- });
- },
-
- /**
- * Function called on light-dom child addition.
- */
- processAddedChild_: function(child) {
- var observerAttributeSelected = new MutationObserver(
- this.childAttributesChanged_.bind(this));
- var observerAttributeTabLabel = new MutationObserver(
- this.childAttributesChanged_.bind(this));
- var tabObject = {
- id: this.tabs_.length,
- content: child,
- label: child.getAttribute('tab-label'),
- observers: {
- forAttributeSelected: observerAttributeSelected,
- forAttributeTabLabel: observerAttributeTabLabel
- }
- };
-
- this.tabs_.push(tabObject);
- if (child.hasAttribute('selected')) {
- // When receiving a child with the selected attribute, if we have no
- // selected tab, mark the child as the selected tab, otherwise keep
- // the previous selection.
- if (this.selectedTab_)
- child.removeAttribute('selected');
- else
- this.setSelectedTabById_(tabObject.id);
- }
-
- // This is required because the user might have set the selected
- // property before we got to process the child.
- var previousSelected = child.selected;
-
- var tabView = this;
-
- Object.defineProperty(
- child,
- 'selected', {
- configurable: true,
- set: function(value) {
- if (value) {
- tabView.changeSelectedTabById_(tabObject.id);
- return;
- }
-
- var wasSelected = tabView.selectedTab_ === tabObject;
- if (wasSelected)
- tabView.changeSelectedTabById_(undefined);
- },
- get: function() {
- return this.hasAttribute('selected');
- }
- });
-
- if (previousSelected)
- child.selected = previousSelected;
-
- observerAttributeSelected.observe(child,
- { attributeFilter: ['selected'] });
- observerAttributeTabLabel.observe(child,
- { attributeFilter: ['tab-label'] });
-
- },
-
- /**
- * Function called on light-dom child removal.
- */
- processRemovedChild_: function(child) {
- for (var i = 0; i < this.tabs_.length; i++) {
- // Make sure ids are the same as the tab position after removal.
- this.tabs_[i].id = i;
- if (this.tabs_[i].content === child) {
- this.tabs_[i].observers.forAttributeSelected.disconnect();
- this.tabs_[i].observers.forAttributeTabLabel.disconnect();
- // The user has removed the currently selected tab.
- if (this.tabs_[i] === this.selectedTab_) {
- this.clearSelectedTab_();
- this.fire('selected-tab-change');
- }
- child.removeAttribute('selected');
- delete child.selected;
- // Remove the observer since we no longer care about this child.
- this.tabs_.splice(i, 1);
- i--;
- }
- }
- },
-
-
- /**
- * This function handles child attribute changes. The only relevant
- * attributes for the tab-view are 'tab-label' and 'selected'.
- */
- childAttributesChanged_: function(mutations, observer) {
- var tabObject = undefined;
- // First figure out which child has been changed.
- for (var i = 0; i < this.tabs_.length; i++) {
- var observers = this.tabs_[i].observers;
- if (observers.forAttributeSelected === observer ||
- observers.forAttributeTabLabel === observer) {
- tabObject = this.tabs_[i];
- break;
- }
- }
-
- // This should not happen, unless the user has messed with our internal
- // data structure.
- if (!tabObject)
- return;
-
- // Next handle the attribute changes.
- for (var i = 0; i < mutations.length; i++) {
- var node = tabObject.content;
- // 'tab-label' attribute has been changed.
- if (mutations[i].attributeName === 'tab-label')
- tabObject.label = node.getAttribute('tab-label');
- // 'selected' attribute has been changed.
- if (mutations[i].attributeName === 'selected') {
- // The attribute has been set.
- var nodeIsSelected = node.hasAttribute('selected');
- if (nodeIsSelected)
- this.changeSelectedTabById_(tabObject.id);
- else
- this.changeSelectedTabById_(undefined);
- }
- }
- },
-
- /**
- * This function handles light-dom additions and removals from the
- * tab-view component.
- */
- childrenUpdated_: function(mutations, observer) {
- mutations.forEach(function(mutation) {
- for (var i = 0; i < mutation.removedNodes.length; i++)
- this.processRemovedChild_(mutation.removedNodes[i]);
- for (var i = 0; i < mutation.addedNodes.length; i++)
- this.processAddedChild_(mutation.addedNodes[i]);
- }, this);
- },
-
- /**
- * Handler called when a click event happens on any of the tab buttons.
- */
- tabButtonSelectHandler_: function(event, detail, sender) {
- this.changeSelectedTabById_(sender.getAttribute('button-id'));
- },
-
- /**
- * This does the actual work. :)
- */
- changeSelectedTabById_: function(id) {
- var newTab = id !== undefined ? this.tabs_[id] : undefined;
- var changed = this.selectedTab_ !== newTab;
- this.saveCurrentTabScrollPosition_();
- this.clearSelectedTab_();
- if (id !== undefined) {
- this.setSelectedTabById_(id);
- this.restoreCurrentTabScrollPosition_();
- }
-
- if (changed)
- this.fire('selected-tab-change');
- },
-
- /**
- * This function updates the currently selected tab based on its internal
- * id. The corresponding light-dom element receives the selected attribute.
- */
- setSelectedTabById_: function(id) {
- this.selectedTab_ = this.tabs_[id];
- // Disconnect observer while we mutate the child.
- this.selectedTab_.observers.forAttributeSelected.disconnect();
- this.selectedTab_.content.setAttribute('selected', 'selected');
- // Reconnect the observer to watch for changes in the future.
- this.selectedTab_.observers.forAttributeSelected.observe(
- this.selectedTab_.content, { attributeFilter: ['selected'] });
-
- },
-
- saveTabStates: function() {
- // Scroll positions of unselected tabs have already been saved.
- this.saveCurrentTabScrollPosition_();
- },
-
- saveCurrentTabScrollPosition_: function() {
- if (this.selectedTab_) {
- this.selectedTab_.content._savedScrollTop =
- this.$['content-container'].scrollTop;
- this.selectedTab_.content._savedScrollLeft =
- this.$['content-container'].scrollLeft;
- }
- },
-
- restoreCurrentTabScrollPosition_: function() {
- if (this.selectedTab_) {
- this.$['content-container'].scrollTop =
- this.selectedTab_.content._savedScrollTop || 0;
- this.$['content-container'].scrollLeft =
- this.selectedTab_.content._savedScrollLeft || 0;
- }
- },
-
- /**
- * This function clears the currently selected tab. This handles removal
- * of the selected attribute from the light-dom element.
- */
- clearSelectedTab_: function() {
- if (this.selectedTab_) {
- // Disconnect observer while we mutate the child.
- this.selectedTab_.observers.forAttributeSelected.disconnect();
- this.selectedTab_.content.removeAttribute('selected');
- // Reconnect the observer to watch for changes in the future.
- this.selectedTab_.observers.forAttributeSelected.observe(
- this.selectedTab_.content, { attributeFilter: ['selected'] });
- this.selectedTab_ = undefined;
- }
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/tab_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/tab_view_test.html
deleted file mode 100644
index 42f16e594ae..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/tab_view_test.html
+++ /dev/null
@@ -1,323 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/tab_view.html">
-
-<template id="tab-view-test-template">
- <tr-ui-a-tab-view>
- <p tab-label="Existing Label"> Tab with label already set </p>
- <p> Tab Content with no label </p>
- <p selected="selected" tab-label="Should be selected">
- Already selected tab
- </p>
- <p selected="selected" tab-label="Should not be selected">
- Second already selected tab
- </p>
- </tr-ui-a-tab-view>
-</template>
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var THIS_DOC = document._currentScript.ownerDocument;
-
- test('instantiate', function() {
-
- var TAB_TEXT = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' +
- ' Cras eleifend elit nec erat tristique pellentesque. Cras placerat ' +
- 'lectus, sed semper tortor ornare quis. Maecenas vitae hendrerit. ' +
- 'Cras mattis interdum nisi, eget egestas dui iaculis ultricies. Proi' +
- 'n magna at nibh fringilla tincidunt id vitae ante. Fusce nec urna n' +
- 'on porttitor tincidunt. Pellentesque habitant morbi tristique senec' +
- 'tus netus et malesuada fames ac turpis egestas. Suspendisse sed vel' +
- 'it mollis ornare sit amet vel augue. Nullam rhoncus in tellus id. ' +
- 'Vestibulum ante ipsum primis in faucibus orci luctus et ultrices ' +
- 'cubilia Curae; Nunc at velit consectetur ipsum tempus tempus. Nunc ' +
- 'mattis sapien, a placerat erat. Vivamus ac enim ultricies, gravida ' +
- 'nulla ut, scelerisque magna. Sed a volutpat enim. Morbi vulputate, ' +
- 'sed egestas mollis, urna nisl varius sem, sed venenatis turpis null' +
- 'a ipsum. Suspendisse potenti.';
-
- var tabViewContainer = document.createElement('div');
- tabViewContainer.style.width = '500px';
- tabViewContainer.style.height = '200px';
-
- var tabView = new TracingAnalysisTabView();
-
- var firstTab = document.createElement('div');
- firstTab.setAttribute('tab-label', 'First Tab Label');
- firstTab.innerHTML = '<p>' + TAB_TEXT + '<p>';
-
- var secondTab = document.createElement('div');
- secondTab.setAttribute('tab-label', 'Second Tab Label');
- secondTab.innerHTML = '<b>' + 'Second Tab Text' + '</b>';
-
- var thirdTab = document.createElement('div');
- thirdTab.setAttribute('tab-label', 'Third Tab Label');
- thirdTab.innerHTML = '<b>' + 'Third Tab Text' + '</b>';
-
- tabView.appendChild(firstTab);
- tabView.appendChild(secondTab);
- tabView.appendChild(thirdTab);
- tabViewContainer.appendChild(tabView);
-
- this.addHTMLOutput(tabViewContainer);
-
- thirdTab.setAttribute('tab-label', 'Something Different');
-
- var button = document.createElement('button');
- button.textContent = 'Change label';
-
- button.addEventListener('click', function() {
- thirdTab.setAttribute('tab-label', 'Label Changed');
- });
-
- tabView.selectedTab = secondTab;
- this.addHTMLOutput(button);
- });
-
-
- test('instantiateWithTabHeading', function() {
- var TAB_TEXT = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' +
- ' Cras eleifend elit nec erat tristique pellentesque. Cras placerat ' +
- 'lectus, sed semper tortor ornare quis. Maecenas vitae hendrerit. ' +
- 'Cras mattis interdum nisi, eget egestas dui iaculis ultricies. Proi' +
- 'n magna at nibh fringilla tincidunt id vitae ante. Fusce nec urna n' +
- 'on porttitor tincidunt. Pellentesque habitant morbi tristique senec' +
- 'tus netus et malesuada fames ac turpis egestas. Suspendisse sed vel' +
- 'it mollis ornare sit amet vel augue. Nullam rhoncus in tellus id. ' +
- 'Vestibulum ante ipsum primis in faucibus orci luctus et ultrices ' +
- 'cubilia Curae; Nunc at velit consectetur ipsum tempus tempus. Nunc ' +
- 'mattis sapien, a placerat erat. Vivamus ac enim ultricies, gravida ' +
- 'nulla ut, scelerisque magna. Sed a volutpat enim. Morbi vulputate, ' +
- 'sed egestas mollis, urna nisl varius sem, sed venenatis turpis null' +
- 'a ipsum. Suspendisse potenti.';
-
- var tabViewContainer = document.createElement('div');
- tabViewContainer.style.width = '500px';
- tabViewContainer.style.height = '200px';
-
- var tabView = new TracingAnalysisTabView();
- tabView.tabStripHeadingText = 'Hello world:';
-
- var firstTab = document.createElement('div');
- firstTab.setAttribute('tab-label', 'First Tab Label');
- firstTab.innerHTML = '<p>' + TAB_TEXT + '<p>';
-
- var secondTab = document.createElement('div');
- secondTab.setAttribute('tab-label', 'Second Tab Label');
- secondTab.innerHTML = '<b>' + 'Second Tab Text' + '</b>';
-
- var thirdTab = document.createElement('div');
- thirdTab.setAttribute('tab-label', 'Third Tab Label');
- thirdTab.innerHTML = '<b>' + 'Third Tab Text' + '</b>';
-
- tabView.appendChild(firstTab);
- tabView.appendChild(secondTab);
- tabView.appendChild(thirdTab);
- tabViewContainer.appendChild(tabView);
-
- this.addHTMLOutput(tabViewContainer);
- tabView.selectedTab = secondTab;
- });
-
- test('instantiateChildrenAlreadyInside', function() {
- var tabViewTemplate = THIS_DOC.querySelector('#tab-view-test-template');
- var tabView = tabViewTemplate.createInstance();
-
- var tabViewContainer = document.createElement('div');
- tabViewContainer.style.width = '400px';
- tabViewContainer.style.height = '200px';
-
- tabViewContainer.appendChild(tabView);
-
- this.addHTMLOutput(tabViewContainer);
-
- });
-
- test('programaticallySetSelectedTab', function() {
- var tabViewContainer = document.createElement('div');
- tabViewContainer.style.width = '500px';
- tabViewContainer.style.height = '200px';
-
- var tabView = new TracingAnalysisTabView();
-
- var t1 = document.createElement('div');
- var t2 = document.createElement('div');
- var t3 = document.createElement('div');
-
- tabView.appendChild(t1);
- tabView.appendChild(t2);
- tabView.appendChild(t3);
-
- assert.isUndefined(tabView.selectedTab);
- tabView.selectedTab = t1;
-
- assert.isTrue(t1.hasAttribute('selected'));
- assert.isFalse(t2.hasAttribute('selected'));
- assert.isFalse(t3.hasAttribute('selected'));
- assert.isTrue(Object.is(t1, tabView.selectedTab));
-
- tabView.selectedTab = t2;
- assert.isFalse(t1.hasAttribute('selected'));
- assert.isTrue(t2.hasAttribute('selected'));
- assert.isFalse(t3.hasAttribute('selected'));
- assert.isTrue(Object.is(t2, tabView.selectedTab));
-
- tabView.selectedTab = t3;
- assert.isFalse(t1.hasAttribute('selected'));
- assert.isFalse(t2.hasAttribute('selected'));
- assert.isTrue(t3.hasAttribute('selected'));
- assert.isTrue(Object.is(t3, tabView.selectedTab));
-
- t1.selected = true;
- assert.isTrue(t1.hasAttribute('selected'));
- assert.isFalse(t2.hasAttribute('selected'));
- assert.isFalse(t3.hasAttribute('selected'));
- assert.isTrue(Object.is(t1, tabView.selectedTab));
-
- // Make sure just randomly setting a tab as not selected does not
- // break the existing selection.
- t2.selected = false;
- t3.selected = false;
- assert.isTrue(t1.hasAttribute('selected'));
- assert.isFalse(t2.hasAttribute('selected'));
- assert.isFalse(t3.hasAttribute('selected'));
- assert.isTrue(Object.is(t1, tabView.selectedTab));
-
- t3.selected = true;
- assert.isFalse(t1.hasAttribute('selected'));
- assert.isFalse(t2.hasAttribute('selected'));
- assert.isTrue(t3.hasAttribute('selected'));
- assert.isTrue(Object.is(t3, tabView.selectedTab));
-
- tabViewContainer.appendChild(tabView);
-
- this.addHTMLOutput(tabViewContainer);
- });
-
- /**
- * This test checks that if an element has a selected property already set,
- * before being attached to the tabView, it still gets selected if the
- * property is true, after it gets attached.
- */
- test('instantiateSetSelectedTabAlreadySet', function() {
- var tabViewContainer = document.createElement('div');
- tabViewContainer.style.width = '500px';
- tabViewContainer.style.height = '200px';
-
- var tabView = new TracingAnalysisTabView();
-
- var t1 = document.createElement('div');
- t1.textContent = 'This text should BE visible.';
- var t2 = document.createElement('div');
- t2.textContent = 'This text should NOT be visible.';
- var t3 = document.createElement('div');
- t3.textContent = 'This text should NOT be visible, also.';
-
- t1.selected = true;
- t2.selected = false;
- t3.selected = false;
-
- tabView.appendChild(t1);
- tabView.appendChild(t2);
- tabView.appendChild(t3);
-
- t1.setAttribute('tab-label', 'This should be selected');
- t2.setAttribute('tab-label', 'Not selected');
- t3.setAttribute('tab-label', 'Not selected');
-
- tabViewContainer.appendChild(tabView);
-
- this.addHTMLOutput(tabViewContainer);
- });
-
- test('selectingInvalidTabWorks', function() {
- var tabView = new TracingAnalysisTabView();
- var t1 = document.createElement('div');
- var t2 = document.createElement('div');
- var t3 = document.createElement('div');
- var invalidChild = document.createElement('div');
-
- tabView.appendChild(t1);
- tabView.appendChild(t2);
- tabView.appendChild(t3);
-
- tabView.selectedTab = t1;
-
- assert.equal(tabView.selectedTab, t1);
-
- // Make sure that selecting an invalid tab does not break the current
- // selection.
- tabView.selectedTab = invalidChild;
- assert.equal(t1, tabView.selectedTab);
-
- // Also make sure the invalidChild does not influence the tab view when
- // it has a selected property set.
- invalidChild.selected = true;
- tabView.selectedTab = invalidChild;
- assert.equal(t1, tabView.selectedTab);
- });
-
- test('changeTabCausesEvent', function() {
- var tabView = new TracingAnalysisTabView();
- var t1 = document.createElement('div');
- var t2 = document.createElement('div');
- var invalidChild = document.createElement('div');
-
- tabView.appendChild(t1);
- tabView.appendChild(t2);
-
- var numChangeEvents = 0;
- tabView.addEventListener('selected-tab-change', function() {
- numChangeEvents++;
- });
- tabView.selectedTab = t1;
- assert.equal(numChangeEvents, 1);
- tabView.selectedTab = t1;
- assert.equal(numChangeEvents, 1);
- tabView.selectedTab = t2;
- assert.equal(numChangeEvents, 2);
- tabView.selectedTab = undefined;
- assert.equal(numChangeEvents, 3);
- });
-
- /**
- * This test makes sure that removing the selected tab does not select
- * any other tab.
- */
- test('instantiateRemovingSelectedTab', function() {
- var tabViewContainer = document.createElement('div');
- tabViewContainer.style.width = '500px';
- tabViewContainer.style.height = '200px';
-
- var tabView = new TracingAnalysisTabView();
-
- var t1 = document.createElement('div');
- t1.textContent = 'This text should BE visible.';
- var t2 = document.createElement('div');
- t2.textContent = 'This text should NOT be visible.';
- var t3 = document.createElement('div');
- t3.textContent = 'This text should NOT be visible, also.';
-
- tabView.appendChild(t1);
- tabView.appendChild(t2);
- tabView.appendChild(t3);
-
- t1.setAttribute('tab-label', 'This should not exist');
- t2.setAttribute('tab-label', 'Not selected');
- t3.setAttribute('tab-label', 'Not selected');
-
- tabView.selectedTab = t1;
- tabView.removeChild(t1);
-
- tabViewContainer.appendChild(tabView);
-
- this.addHTMLOutput(tabViewContainer);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/table.html b/chromium/third_party/catapult/tracing/tracing/ui/base/table.html
deleted file mode 100644
index 1292a3af758..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/table.html
+++ /dev/null
@@ -1,1473 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/utils.html">
-
-<!--
-@fileoverview A container that constructs a table-like container.
--->
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
-
- var TableFormat = {};
-
- TableFormat.SelectionMode = {
- // Selection disabled.
- // Default highlight: none.
- NONE: 0,
-
- // Row selection mode.
- // Default highlight: dark row.
- ROW: 1,
-
- // Cell selection mode.
- // Default highlight: dark cell and light row.
- CELL: 2
- };
-
- TableFormat.HighlightStyle = {
- // Highlight depends on the current selection mode.
- DEFAULT: 0,
-
- // No highlight.
- NONE: 1,
-
- // Light highlight.
- LIGHT: 2,
-
- // Dark highlight.
- DARK: 3
- };
-
- TableFormat.ColumnAlignment = {
- LEFT: 0 /* default */,
- RIGHT: 1
- };
-
- return {
- TableFormat: TableFormat
- };
-});
-</script>
-
-<polymer-element name="tr-ui-b-table">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
-
- table {
- font-size: 12px;
-
- flex: 1 1 auto;
- align-self: stretch;
- border-collapse: separate;
- border-spacing: 0;
- border-width: 0;
- -webkit-user-select: initial;
- }
-
- tr > td {
- padding: 2px 4px 2px 4px;
- vertical-align: text-top;
- }
-
- tr:focus,
- td:focus {
- outline: 1px dotted rgba(0,0,0,0.1);
- outline-offset: 0;
- }
-
- button.toggle-button {
- height: 15px;
- line-height: 60%;
- vertical-align: middle;
- width: 100%;
- }
-
- button > * {
- height: 15px;
- vertical-align: middle;
- }
-
- td.button-column {
- width: 30px;
- }
-
- table > thead > tr > td.sensitive:hover {
- background-color: #fcfcfc;
- }
-
- table > thead > tr > td {
- font-weight: bold;
- text-align: left;
-
- background-color: #eee;
- white-space: nowrap;
- overflow: hidden;
- text-overflow: ellipsis;
-
- border-top: 1px solid #ffffff;
- border-bottom: 1px solid #aaa;
- }
-
- table > tfoot {
- background-color: #eee;
- font-weight: bold;
- }
-
- /* Light row and cell highlight. */
- table > tbody[row-highlight-style="light"] > tr[selected],
- table > tbody[cell-highlight-style="light"] > tr > td[selected] {
- background-color: rgb(213, 236, 229); /* light turquoise */
- }
- table > tbody[row-highlight-style="light"] >
- tr:not(.empty-row):not([selected]):hover,
- table > tbody[cell-highlight-style="light"] >
- tr:not(.empty-row):not([selected]) > td:hover {
- background-color: #f6f6f6; /* light grey */
- }
-
- /* Dark row and cell highlight. */
- table > tbody[row-highlight-style="dark"] > tr[selected],
- table > tbody[cell-highlight-style="dark"] > tr > td[selected] {
- background-color: rgb(103, 199, 165); /* turquoise */
- }
- table > tbody[row-highlight-style="dark"] >
- tr:not(.empty-row):not([selected]):hover,
- table > tbody[cell-highlight-style="dark"] >
- tr:not(.empty-row):not([selected]) > td:hover {
- background-color: #e6e6e6; /* grey */
- }
- table > tbody[row-highlight-style="dark"] > tr:hover[selected],
- table > tbody[cell-highlight-style="dark"] > tr[selected] > td:hover {
- background-color: rgb(171, 217, 202); /* semi-light turquoise */
- }
-
- table > tbody > tr.empty-row > td {
- color: #666;
- font-style: italic;
- text-align: center;
- }
-
- table > tbody.has-footer > tr:last-child > td {
- border-bottom: 1px solid #aaa;
- }
-
- table > tfoot > tr:first-child > td {
- border-top: 1px solid #ffffff;
- }
-
- expand-button {
- -webkit-user-select: none;
- display: inline-block;
- cursor: pointer;
- font-size: 9px;
- min-width: 8px;
- max-width: 8px;
- }
-
- .button-expanded {
- transform: rotate(90deg);
- }
- </style>
- <table>
- <thead id="head">
- </thead>
- <tbody id="body">
- </tbody>
- <tfoot id="foot">
- </tfoot>
- </table>
- </template>
- <script>
- 'use strict';
- (function() {
- var RIGHT_ARROW = String.fromCharCode(0x25b6);
- var UNSORTED_ARROW = String.fromCharCode(0x25BF);
- var ASCENDING_ARROW = String.fromCharCode(0x25B4);
- var DESCENDING_ARROW = String.fromCharCode(0x25BE);
- var BASIC_INDENTATION = 8;
-
- var SelectionMode = tr.ui.b.TableFormat.SelectionMode;
- var HighlightStyle = tr.ui.b.TableFormat.HighlightStyle;
- var ColumnAlignment = tr.ui.b.TableFormat.ColumnAlignment;
-
- Polymer({
- created: function() {
- this.selectionMode_ = SelectionMode.NONE;
- this.rowHighlightStyle_ = HighlightStyle.DEFAULT;
- this.cellHighlightStyle_ = HighlightStyle.DEFAULT;
- this.selectedTableRowInfo_ = undefined;
- this.selectedColumnIndex_ = undefined;
-
- this.tableColumns_ = [];
- this.tableRows_ = [];
- this.tableRowsInfo_ = new WeakMap();
- this.tableFooterRows_ = [];
- this.tableFooterRowsInfo_ = new WeakMap();
- this.sortColumnIndex_ = undefined;
- this.sortDescending_ = false;
- this.columnsWithExpandButtons_ = [];
- this.headerCells_ = [];
- this.showHeader_ = true;
- this.emptyValue_ = undefined;
- this.subRowsPropertyName_ = 'subRows';
- this.customizeTableRowCallback_ = undefined;
- },
-
- ready: function() {
- this.$.body.addEventListener(
- 'keydown', this.onKeyDown_.bind(this), true);
- },
-
- clear: function() {
- this.selectionMode_ = SelectionMode.NONE;
- this.rowHighlightStyle_ = HighlightStyle.DEFAULT;
- this.cellHighlightStyle_ = HighlightStyle.DEFAULT;
- this.selectedTableRowInfo_ = undefined;
- this.selectedColumnIndex_ = undefined;
-
- this.textContent = '';
- this.tableColumns_ = [];
- this.tableRows_ = [];
- this.tableRowsInfo_ = new WeakMap();
- this.tableFooterRows_ = [];
- this.tableFooterRowsInfo_ = new WeakMap();
- this.sortColumnIndex_ = undefined;
- this.sortDescending_ = false;
- this.columnsWithExpandButtons_ = [];
- this.headerCells_ = [];
- this.subRowsPropertyName_ = 'subRows';
- this.defaultExpansionStateCallback_ = undefined;
- },
-
- get showHeader() {
- return this.showHeader_;
- },
-
- set showHeader(showHeader) {
- this.showHeader_ = showHeader;
- this.scheduleRebuildHeaders_();
- },
-
- set subRowsPropertyName(name) {
- this.subRowsPropertyName_ = name;
- },
-
- /**
- * This callback will be called whenever a body row is built
- * for a userRow that has subRows and does not have an explicit
- * isExpanded field.
- * The callback should return true if the row should be expanded,
- * or false if the row should be collapsed.
- * @param {function(userRow, parentUserRow): boolean} cb The callback.
- */
- set defaultExpansionStateCallback(cb) {
- this.defaultExpansionStateCallback_ = cb;
- this.scheduleRebuildBody_();
- },
-
- /**
- * This callback will be called whenever a body row is built.
- * The callback's return value is ignored.
- * @param {function(userRow, trElement)} cb The callback.
- */
- set customizeTableRowCallback(cb) {
- this.customizeTableRowCallback_ = cb;
- this.scheduleRebuildBody_();
- },
-
- get emptyValue() {
- return this.emptyValue_;
- },
-
- set emptyValue(emptyValue) {
- var previousEmptyValue = this.emptyValue_;
- this.emptyValue_ = emptyValue;
- if (this.tableRows_.length === 0 && emptyValue !== previousEmptyValue)
- this.scheduleRebuildBody_();
- },
-
- /**
- * Data objects should have the following fields:
- * mandatory: title, value
- * optional: width {string}, cmp {function}, colSpan {number},
- * showExpandButtons {boolean},
- * align {tr.ui.b.TableFormat.ColumnAlignment}
- *
- * @param {Array} columns An array of data objects.
- */
- set tableColumns(columns) {
- // Figure out the columns with expand buttons...
- var columnsWithExpandButtons = [];
- for (var i = 0; i < columns.length; i++) {
- if (columns[i].showExpandButtons)
- columnsWithExpandButtons.push(i);
- }
- if (columnsWithExpandButtons.length === 0) {
- // First column if none have specified.
- columnsWithExpandButtons = [0];
- }
-
- // Sanity check columns.
- for (var i = 0; i < columns.length; i++) {
- var colInfo = columns[i];
- if (colInfo.width === undefined)
- continue;
-
- var hasExpandButton = columnsWithExpandButtons.indexOf(i) !== -1;
-
- var w = colInfo.width;
- if (w) {
- if (/\d+px/.test(w)) {
- continue;
- } else if (/\d+%/.test(w)) {
- if (hasExpandButton) {
- throw new Error('Columns cannot be %-sized and host ' +
- ' an expand button');
- }
- } else {
- throw new Error('Unrecognized width string');
- }
- }
- }
-
- // Commit the change.
- this.tableColumns_ = columns;
- this.headerCells_ = [];
- this.columnsWithExpandButtons_ = columnsWithExpandButtons;
- this.sortColumnIndex = undefined;
- this.scheduleRebuildHeaders_();
-
- // Blow away the table rows, too.
- this.tableRows = this.tableRows_;
- },
-
- get tableColumns() {
- return this.tableColumns_;
- },
-
- /**
- * @param {Array} rows An array of 'row' objects with the following
- * fields:
- * optional: subRows An array of objects that have the same 'row'
- * structure. Set subRowsPropertyName to use an
- * alternative field name.
- */
- set tableRows(rows) {
- this.selectedTableRowInfo_ = undefined;
- this.selectedColumnIndex_ = undefined;
- this.maybeUpdateSelectedRow_();
- this.tableRows_ = rows;
- this.tableRowsInfo_ = new WeakMap();
- this.scheduleRebuildBody_();
- },
-
- get tableRows() {
- return this.tableRows_;
- },
-
- set footerRows(rows) {
- this.tableFooterRows_ = rows;
- this.tableFooterRowsInfo_ = new WeakMap();
- this.scheduleRebuildFooter_();
- },
-
- get footerRows() {
- return this.tableFooterRows_;
- },
-
- set sortColumnIndex(number) {
- if (number === this.sortColumnIndex_)
- return;
-
- if (number === undefined) {
- this.sortColumnIndex_ = undefined;
- this.updateHeaderArrows_();
- this.dispatchSortingChangedEvent_();
- return;
- }
-
- if (this.tableColumns_.length <= number)
- throw new Error('Column number ' + number + ' is out of bounds.');
- if (!this.tableColumns_[number].cmp)
- throw new Error('Column ' + number + ' does not have a comparator.');
-
- this.sortColumnIndex_ = number;
- this.updateHeaderArrows_();
- this.scheduleRebuildBody_();
- this.dispatchSortingChangedEvent_();
- },
-
- get sortColumnIndex() {
- return this.sortColumnIndex_;
- },
-
- set sortDescending(value) {
- var newValue = !!value;
-
- if (newValue !== this.sortDescending_) {
- this.sortDescending_ = newValue;
- this.updateHeaderArrows_();
- this.scheduleRebuildBody_();
- this.dispatchSortingChangedEvent_();
- }
- },
-
- get sortDescending() {
- return this.sortDescending_;
- },
-
- updateHeaderArrows_: function() {
- for (var i = 0; i < this.headerCells_.length; i++) {
- if (!this.tableColumns_[i].cmp) {
- this.headerCells_[i].sideContent = '';
- continue;
- }
- if (i !== this.sortColumnIndex_) {
- this.headerCells_[i].sideContent = UNSORTED_ARROW;
- continue;
- }
- this.headerCells_[i].sideContent = this.sortDescending_ ?
- DESCENDING_ARROW : ASCENDING_ARROW;
- }
- },
-
- sortRows_: function(rows) {
- rows.sort(function(rowA, rowB) {
- if (this.sortDescending_)
- return this.tableColumns_[this.sortColumnIndex_].cmp(
- rowB.userRow, rowA.userRow);
- return this.tableColumns_[this.sortColumnIndex_].cmp(
- rowA.userRow, rowB.userRow);
- }.bind(this));
- // Sort expanded sub rows recursively.
- for (var i = 0; i < rows.length; i++) {
- if (this.getExpandedForUserRow_(rows[i]))
- this.sortRows_(rows[i][this.subRowsPropertyName_]);
- }
- },
-
- generateHeaderColumns_: function() {
- this.headerCells_ = [];
- this.$.head.textContent = '';
- if (!this.showHeader_)
- return;
-
- var tr = this.appendNewElement_(this.$.head, 'tr');
- for (var i = 0; i < this.tableColumns_.length; i++) {
- var td = this.appendNewElement_(tr, 'td');
-
- var headerCell = document.createElement('tr-ui-b-table-header-cell');
- headerCell.cellTitle = this.tableColumns_[i].title;
- headerCell.align = this.tableColumns_[i].align;
-
- // If the table can be sorted by this column, attach a tap callback
- // to the column.
- if (this.tableColumns_[i].cmp) {
- td.classList.add('sensitive');
- headerCell.tapCallback = this.createSortCallback_(i);
- // Set arrow position, depending on the sortColumnIndex.
- if (this.sortColumnIndex_ === i)
- headerCell.sideContent = this.sortDescending_ ?
- DESCENDING_ARROW : ASCENDING_ARROW;
- else
- headerCell.sideContent = UNSORTED_ARROW;
- }
-
- td.appendChild(headerCell);
- this.headerCells_.push(headerCell);
- }
- },
-
- applySizes_: function() {
- if (this.tableRows_.length === 0 && !this.showHeader)
- return;
- var rowToRemoveSizing;
- var rowToSize;
- if (this.showHeader) {
- rowToSize = this.$.head.children[0];
- rowToRemoveSizing = this.$.body.children[0];
- } else {
- rowToSize = this.$.body.children[0];
- rowToRemoveSizing = this.$.head.children[0];
- }
- for (var i = 0; i < this.tableColumns_.length; i++) {
- if (rowToRemoveSizing && rowToRemoveSizing.children[i]) {
- var tdToRemoveSizing = rowToRemoveSizing.children[i];
- tdToRemoveSizing.style.minWidth = '';
- tdToRemoveSizing.style.width = '';
- }
-
- // Apply sizing.
- var td = rowToSize.children[i];
-
- var delta;
- if (this.columnsWithExpandButtons_.indexOf(i) !== -1) {
- td.style.paddingLeft = BASIC_INDENTATION + 'px';
- delta = BASIC_INDENTATION + 'px';
- } else {
- delta = undefined;
- }
-
- function calc(base, delta) {
- if (delta)
- return 'calc(' + base + ' - ' + delta + ')';
- else
- return base;
- }
-
- var w = this.tableColumns_[i].width;
- if (w) {
- if (/\d+px/.test(w)) {
- td.style.minWidth = calc(w, delta);
- } else if (/\d+%/.test(w)) {
- td.style.width = w;
- } else {
- throw new Error('Unrecognized width string: ' + w);
- }
- }
- }
- },
-
- createSortCallback_: function(columnNumber) {
- return function() {
- var previousIndex = this.sortColumnIndex;
- this.sortColumnIndex = columnNumber;
- if (previousIndex !== columnNumber)
- this.sortDescending = false;
- else
- this.sortDescending = !this.sortDescending;
- }.bind(this);
- },
-
- generateTableRowNodes_: function(tableSection, userRows, rowInfoMap,
- indentation, lastAddedRow,
- parentRowInfo) {
- if (this.sortColumnIndex_ !== undefined &&
- tableSection === this.$.body) {
- userRows = userRows.slice(); // Don't mess with the input data.
- userRows.sort(function(rowA, rowB) {
- var c = this.tableColumns_[this.sortColumnIndex_].cmp(
- rowA, rowB);
- if (this.sortDescending_)
- c = -c;
- return c;
- }.bind(this));
- }
-
- for (var i = 0; i < userRows.length; i++) {
- var userRow = userRows[i];
- var rowInfo = this.getOrCreateRowInfoFor_(rowInfoMap, userRow,
- parentRowInfo);
- var htmlNode = this.getHTMLNodeForRowInfo_(
- tableSection, rowInfo, rowInfoMap, indentation);
-
- if (lastAddedRow === undefined) {
- // Put first into the table.
- tableSection.insertBefore(htmlNode, tableSection.firstChild);
- } else {
- // This is shorthand for insertAfter(htmlNode, lastAdded).
- var nextSiblingOfLastAdded = lastAddedRow.nextSibling;
- tableSection.insertBefore(htmlNode, nextSiblingOfLastAdded);
- }
- this.updateTabIndexForTableRowNode_(htmlNode);
-
- lastAddedRow = htmlNode;
- if (!rowInfo.isExpanded)
- continue;
-
- // Append subrows now.
- lastAddedRow = this.generateTableRowNodes_(
- tableSection, userRow[this.subRowsPropertyName_], rowInfoMap,
- indentation + 1, lastAddedRow, rowInfo);
- }
- return lastAddedRow;
- },
-
- getOrCreateRowInfoFor_: function(rowInfoMap, userRow, parentRowInfo) {
- var rowInfo = undefined;
-
- if (rowInfoMap.has(userRow)) {
- rowInfo = rowInfoMap.get(userRow);
- } else {
- rowInfo = {
- userRow: userRow,
- htmlNode: undefined,
- parentRowInfo: parentRowInfo
- };
- rowInfoMap.set(userRow, rowInfo);
- }
-
- // Recompute isExpanded in case defaultExpansionStateCallback_ has
- // changed.
- rowInfo.isExpanded = this.getExpandedForUserRow_(userRow);
-
- return rowInfo;
- },
-
- customizeTableRow_: function(userRow, trElement) {
- if (!this.customizeTableRowCallback_)
- return;
- this.customizeTableRowCallback_(userRow, trElement);
- },
-
- getHTMLNodeForRowInfo_: function(tableSection, rowInfo,
- rowInfoMap, indentation) {
- if (rowInfo.htmlNode) {
- this.customizeTableRow_(rowInfo.userRow, rowInfo.htmlNode);
- return rowInfo.htmlNode;
- }
-
- var INDENT_SPACE = indentation * 16;
- var INDENT_SPACE_NO_BUTTON = indentation * 16 + BASIC_INDENTATION;
- var trElement = this.ownerDocument.createElement('tr');
- rowInfo.htmlNode = trElement;
- rowInfo.indentation = indentation;
- trElement.rowInfo = rowInfo;
- this.customizeTableRow_(rowInfo.userRow, trElement);
-
- for (var i = 0; i < this.tableColumns_.length;) {
- var td = this.appendNewElement_(trElement, 'td');
- td.columnIndex = i;
-
- var column = this.tableColumns_[i];
- var value = column.value(rowInfo.userRow);
- var colSpan = column.colSpan ? column.colSpan : 1;
- td.style.colSpan = colSpan;
-
- switch (column.align) {
- case undefined:
- case ColumnAlignment.LEFT:
- break;
-
- case ColumnAlignment.RIGHT:
- td.style.textAlign = 'right';
- break;
-
- default:
- throw new Error('Invalid alignment of column at index=' + i +
- ': ' + column.align);
- }
-
- if (this.doesColumnIndexSupportSelection(i))
- td.classList.add('supports-selection');
-
- if (this.columnsWithExpandButtons_.indexOf(i) != -1) {
- if (rowInfo.userRow[this.subRowsPropertyName_] &&
- rowInfo.userRow[this.subRowsPropertyName_].length > 0) {
- td.style.paddingLeft = INDENT_SPACE + 'px';
- var expandButton = this.appendNewElement_(td,
- 'expand-button');
- expandButton.textContent = RIGHT_ARROW;
- if (rowInfo.isExpanded)
- expandButton.classList.add('button-expanded');
- } else {
- td.style.paddingLeft = INDENT_SPACE_NO_BUTTON + 'px';
- }
- }
-
- if (value !== undefined)
- td.appendChild(tr.ui.b.asHTMLOrTextNode(value, this.ownerDocument));
-
- i += colSpan;
- }
-
- var isSelectable = tableSection === this.$.body;
- var isExpandable = rowInfo.userRow[this.subRowsPropertyName_] &&
- rowInfo.userRow[this.subRowsPropertyName_].length;
-
- if (isSelectable || isExpandable) {
- trElement.addEventListener('click', function(e) {
- e.stopPropagation();
- if (e.target.tagName == 'EXPAND-BUTTON') {
- this.setExpandedForUserRow_(
- tableSection, rowInfoMap,
- rowInfo.userRow, !rowInfo.isExpanded);
- return;
- }
-
- function getTD(cur) {
- if (cur === trElement)
- throw new Error('woah');
- if (cur.parentElement === trElement)
- return cur;
- return getTD(cur.parentElement);
- }
-
- // If the row/cell can be selected and it's not selected yet,
- // select it.
- if (isSelectable && this.selectionMode_ !== SelectionMode.NONE) {
- var shouldSelect = false;
- var columnIndex = getTD(e.target).columnIndex;
- switch (this.selectionMode_) {
- case SelectionMode.ROW:
- shouldSelect = this.selectedTableRowInfo_ !== rowInfo;
- break;
-
- case SelectionMode.CELL:
- if (this.doesColumnIndexSupportSelection(columnIndex)) {
- shouldSelect = this.selectedTableRowInfo_ !== rowInfo ||
- this.selectedColumnIndex_ !== columnIndex;
- }
- break;
-
- default:
- throw new Error('Invalid selection mode ' +
- this.selectionMode_);
- }
- if (shouldSelect) {
- this.didTableRowInfoGetClicked_(rowInfo, columnIndex);
- return;
- }
- }
-
- // Otherwise, if the row is expandable, expand/collapse it.
- if (isExpandable) {
- this.setExpandedForUserRow_(tableSection, rowInfoMap,
- rowInfo.userRow, !rowInfo.isExpanded);
- }
- }.bind(this));
- }
-
- return rowInfo.htmlNode;
- },
-
- removeSubNodes_: function(tableSection, rowInfo, rowInfoMap) {
- if (rowInfo.userRow[this.subRowsPropertyName_] === undefined)
- return;
- for (var i = 0;
- i < rowInfo.userRow[this.subRowsPropertyName_].length; i++) {
- var subRow = rowInfo.userRow[this.subRowsPropertyName_][i];
- var subRowInfo = rowInfoMap.get(subRow);
- if (!subRowInfo)
- continue;
-
- var subNode = subRowInfo.htmlNode;
- if (subNode && subNode.parentNode === tableSection) {
- tableSection.removeChild(subNode);
- this.removeSubNodes_(tableSection, subRowInfo, rowInfoMap);
- }
- }
- },
-
- scheduleRebuildHeaders_: function() {
- this.headerDirty_ = true;
- this.scheduleRebuild_();
- },
-
- scheduleRebuildBody_: function() {
- this.bodyDirty_ = true;
- this.scheduleRebuild_();
- },
-
- scheduleRebuildFooter_: function() {
- this.footerDirty_ = true;
- this.scheduleRebuild_();
- },
-
- scheduleRebuild_: function() {
- if (this.rebuildPending_)
- return;
- this.rebuildPending_ = true;
- setTimeout(function() {
- this.rebuildPending_ = false;
- this.rebuild();
- }.bind(this), 0);
- },
-
- rebuildIfNeeded_: function() {
- this.rebuild();
- },
-
- rebuild: function() {
- var wasBodyOrHeaderDirty = this.headerDirty_ || this.bodyDirty_;
-
- if (this.headerDirty_) {
- this.generateHeaderColumns_();
- this.headerDirty_ = false;
- }
- if (this.bodyDirty_) {
- this.$.body.textContent = '';
- this.generateTableRowNodes_(
- this.$.body,
- this.tableRows_, this.tableRowsInfo_, 0,
- undefined, undefined);
- if (this.tableRows_.length === 0 && this.emptyValue_ !== undefined) {
- var trElement = this.ownerDocument.createElement('tr');
- this.$.body.appendChild(trElement);
- trElement.classList.add('empty-row');
- var td = this.ownerDocument.createElement('td');
- trElement.appendChild(td);
- td.colSpan = this.tableColumns_.length;
- var emptyValue = this.emptyValue_;
- td.appendChild(
- tr.ui.b.asHTMLOrTextNode(emptyValue, this.ownerDocument));
- }
- this.bodyDirty_ = false;
- }
-
- if (wasBodyOrHeaderDirty)
- this.applySizes_();
-
- if (this.footerDirty_) {
- this.$.foot.textContent = '';
- this.generateTableRowNodes_(
- this.$.foot,
- this.tableFooterRows_, this.tableFooterRowsInfo_, 0,
- undefined, undefined);
- if (this.tableFooterRowsInfo_.length) {
- this.$.body.classList.add('has-footer');
- } else {
- this.$.body.classList.remove('has-footer');
- }
- this.footerDirty_ = false;
- }
- },
-
- appendNewElement_: function(parent, tagName) {
- var element = parent.ownerDocument.createElement(tagName);
- parent.appendChild(element);
- return element;
- },
-
- getExpandedForTableRow: function(userRow) {
- this.rebuildIfNeeded_();
- var rowInfo = this.tableRowsInfo_.get(userRow);
- if (rowInfo === undefined)
- throw new Error('Row has not been seen, must expand its parents');
- return rowInfo.isExpanded;
- },
-
- getExpandedForUserRow_: function(userRow) {
- if (userRow[this.subRowsPropertyName_] === undefined)
- return false;
- if (userRow[this.subRowsPropertyName_].length === 0)
- return false;
- if (userRow.isExpanded)
- return true;
- if (userRow.isExpanded === false)
- return false;
-
- var rowInfo = this.tableRowsInfo_.get(userRow);
- if (rowInfo && rowInfo.isExpanded)
- return true;
-
- if (this.defaultExpansionStateCallback_ === undefined)
- return false;
-
- var parentUserRow = undefined;
- if (rowInfo && rowInfo.parentRowInfo)
- parentUserRow = rowInfo.parentRowInfo.userRow;
-
- return this.defaultExpansionStateCallback_(
- userRow, parentUserRow);
- },
-
- setExpandedForTableRow: function(userRow, expanded) {
- this.rebuildIfNeeded_();
- var rowInfo = this.tableRowsInfo_.get(userRow);
- if (rowInfo === undefined)
- throw new Error('Row has not been seen, must expand its parents');
- return this.setExpandedForUserRow_(this.$.body, this.tableRowsInfo_,
- userRow, expanded);
- },
-
- setExpandedForUserRow_: function(tableSection, rowInfoMap,
- userRow, expanded) {
- this.rebuildIfNeeded_();
-
- var rowInfo = rowInfoMap.get(userRow);
- if (rowInfo === undefined)
- throw new Error('Row has not been seen, must expand its parents');
-
- rowInfo.isExpanded = !!expanded;
- // If no node, then nothing further needs doing.
- if (rowInfo.htmlNode === undefined)
- return;
-
- // If its detached, then nothing needs doing.
- if (rowInfo.htmlNode.parentElement !== tableSection)
- return;
-
- // Otherwise, rebuild.
- var expandButton = rowInfo.htmlNode.querySelector('expand-button');
- if (rowInfo.isExpanded) {
- expandButton.classList.add('button-expanded');
- var lastAddedRow = rowInfo.htmlNode;
- if (rowInfo.userRow[this.subRowsPropertyName_]) {
- this.generateTableRowNodes_(
- tableSection,
- rowInfo.userRow[this.subRowsPropertyName_], rowInfoMap,
- rowInfo.indentation + 1,
- lastAddedRow, rowInfo);
- }
- } else {
- expandButton.classList.remove('button-expanded');
- this.removeSubNodes_(tableSection, rowInfo, rowInfoMap);
- }
-
- this.maybeUpdateSelectedRow_();
- },
-
- get selectionMode() {
- return this.selectionMode_;
- },
-
- set selectionMode(selectionMode) {
- if (!tr.b.dictionaryContainsValue(SelectionMode, selectionMode))
- throw new Error('Invalid selection mode ' + selectionMode);
- this.rebuildIfNeeded_();
- this.selectionMode_ = selectionMode;
- this.didSelectionStateChange_();
- },
-
- get rowHighlightStyle() {
- return this.rowHighlightStyle_;
- },
-
- set rowHighlightStyle(rowHighlightStyle) {
- if (!tr.b.dictionaryContainsValue(HighlightStyle, rowHighlightStyle))
- throw new Error('Invalid row highlight style ' + rowHighlightStyle);
- this.rebuildIfNeeded_();
- this.rowHighlightStyle_ = rowHighlightStyle;
- this.didSelectionStateChange_();
- },
-
- get resolvedRowHighlightStyle() {
- if (this.rowHighlightStyle_ !== HighlightStyle.DEFAULT)
- return this.rowHighlightStyle_;
- switch (this.selectionMode_) {
- case SelectionMode.NONE:
- return HighlightStyle.NONE;
- case SelectionMode.ROW:
- return HighlightStyle.DARK;
- case SelectionMode.CELL:
- return HighlightStyle.LIGHT;
- default:
- throw new Error('Invalid selection mode ' + selectionMode);
- }
- },
-
- get cellHighlightStyle() {
- return this.cellHighlightStyle_;
- },
-
- set cellHighlightStyle(cellHighlightStyle) {
- if (!tr.b.dictionaryContainsValue(HighlightStyle, cellHighlightStyle))
- throw new Error('Invalid cell highlight style ' + cellHighlightStyle);
- this.rebuildIfNeeded_();
- this.cellHighlightStyle_ = cellHighlightStyle;
- this.didSelectionStateChange_();
- },
-
- get resolvedCellHighlightStyle() {
- if (this.cellHighlightStyle_ !== HighlightStyle.DEFAULT)
- return this.cellHighlightStyle_;
- switch (this.selectionMode_) {
- case SelectionMode.NONE:
- case SelectionMode.ROW:
- return HighlightStyle.NONE;
- case SelectionMode.CELL:
- return HighlightStyle.DARK;
- default:
- throw new Error('Invalid selection mode ' + selectionMode);
- }
- },
-
- setHighlightStyle_: function(highlightAttribute, resolvedHighlightStyle) {
- switch (resolvedHighlightStyle) {
- case HighlightStyle.NONE:
- this.$.body.removeAttribute(highlightAttribute);
- break;
- case HighlightStyle.LIGHT:
- this.$.body.setAttribute(highlightAttribute, 'light');
- break;
- case HighlightStyle.DARK:
- this.$.body.setAttribute(highlightAttribute, 'dark');
- break;
- default:
- throw new Error('Invalid resolved highlight style ' +
- resolvedHighlightStyle);
- }
- },
-
- didSelectionStateChange_: function() {
- this.setHighlightStyle_('row-highlight-style',
- this.resolvedRowHighlightStyle);
- this.setHighlightStyle_('cell-highlight-style',
- this.resolvedCellHighlightStyle);
-
- for (var i = 0; i < this.$.body.children.length; i++)
- this.updateTabIndexForTableRowNode_(this.$.body.children[i]);
- this.maybeUpdateSelectedRow_();
- },
-
- maybeUpdateSelectedRow_: function() {
- if (this.selectedTableRowInfo_ === undefined)
- return;
-
- // Selection may be off.
- if (this.selectionMode_ === SelectionMode.NONE) {
- this.removeSelectedState_();
- this.selectedTableRowInfo_ = undefined;
- return;
- }
-
- // selectedUserRow may not be visible
- function isVisible(rowInfo) {
- if (!rowInfo.htmlNode)
- return false;
- return !!rowInfo.htmlNode.parentElement;
- }
- if (isVisible(this.selectedTableRowInfo_)) {
- this.updateSelectedState_();
- return;
- }
-
- this.removeSelectedState_();
- var curRowInfo = this.selectedTableRowInfo_;
- while (curRowInfo && !isVisible(curRowInfo))
- curRowInfo = curRowInfo.parentRowInfo;
-
- this.selectedTableRowInfo_ = curRowInfo;
- if (this.selectedTableRowInfo_)
- this.updateSelectedState_();
- },
-
- didTableRowInfoGetClicked_: function(rowInfo, columnIndex) {
- switch (this.selectionMode_) {
- case SelectionMode.NONE:
- return;
-
- case SelectionMode.CELL:
- if (!this.doesColumnIndexSupportSelection(columnIndex))
- return;
- if (this.selectedColumnIndex !== columnIndex)
- this.selectedColumnIndex = columnIndex;
- // Fall through.
-
- case SelectionMode.ROW:
- if (this.selectedTableRowInfo_ !== rowInfo)
- this.selectedTableRow = rowInfo.userRow;
- }
- },
-
- get selectedTableRow() {
- if (!this.selectedTableRowInfo_)
- return undefined;
- return this.selectedTableRowInfo_.userRow;
- },
-
- set selectedTableRow(userRow) {
- this.rebuildIfNeeded_();
- if (this.selectionMode_ === SelectionMode.NONE)
- throw new Error('Selection is off.');
-
- var rowInfo;
- if (userRow === undefined) {
- rowInfo = undefined;
- } else {
- rowInfo = this.tableRowsInfo_.get(userRow);
- if (!rowInfo)
- throw new Error('Row has not been seen, must expand its parents.');
- }
-
- var e = this.prepareToChangeSelection_();
- this.selectedTableRowInfo_ = rowInfo;
-
- if (this.selectedTableRowInfo_ === undefined) {
- this.selectedColumnIndex_ = undefined;
- this.removeSelectedState_();
- } else {
- switch (this.selectionMode_) {
- case SelectionMode.ROW:
- this.selectedColumnIndex_ = undefined;
- break;
-
- case SelectionMode.CELL:
- if (this.selectedColumnIndex_ === undefined) {
- var i = this.getFirstSelectableColumnIndex_();
- if (i == -1)
- throw new Error('Cannot find a selectable column.');
- this.selectedColumnIndex_ = i;
- }
- break;
-
- default:
- throw new Error('Invalid selection mode ' + this.selectionMode_);
- }
- this.updateSelectedState_();
- }
-
- this.dispatchEvent(e);
- },
-
- updateTabIndexForTableRowNode_: function(row) {
- if (this.selectionMode_ === SelectionMode.ROW)
- row.tabIndex = 0;
- else
- row.removeAttribute('tabIndex');
-
- var enableCellTab = this.selectionMode_ === SelectionMode.CELL;
- for (var i = 0; i < this.tableColumns_.length; i++) {
- var cell = row.children[i];
- if (enableCellTab && this.doesColumnIndexSupportSelection(i))
- cell.tabIndex = 0;
- else
- cell.removeAttribute('tabIndex');
- }
- },
-
- prepareToChangeSelection_: function() {
- var e = new tr.b.Event('selection-changed');
- var previousSelectedRowInfo = this.selectedTableRowInfo_;
- if (previousSelectedRowInfo)
- e.previousSelectedTableRow = previousSelectedRowInfo.userRow;
- else
- e.previousSelectedTableRow = undefined;
-
- this.removeSelectedState_();
-
- return e;
- },
-
- removeSelectedState_: function() {
- this.setSelectedState_(false);
- },
-
- updateSelectedState_: function() {
- this.setSelectedState_(true);
- },
-
- setSelectedState_: function(select) {
- if (this.selectedTableRowInfo_ === undefined)
- return;
-
- // Row selection.
- var rowNode = this.selectedTableRowInfo_.htmlNode;
- if (select)
- rowNode.setAttribute('selected', true);
- else
- rowNode.removeAttribute('selected');
-
- // Cell selection (if applicable).
- var cellNode = rowNode.children[this.selectedColumnIndex_];
- if (!cellNode)
- return;
- if (select)
- cellNode.setAttribute('selected', true);
- else
- cellNode.removeAttribute('selected');
- },
-
- doesColumnIndexSupportSelection: function(columnIndex) {
- var columnInfo = this.tableColumns_[columnIndex];
- var scs = columnInfo.supportsCellSelection;
- if (scs === false)
- return false;
- return true;
- },
-
- getFirstSelectableColumnIndex_: function() {
- for (var i = 0; i < this.tableColumns_.length; i++) {
- if (this.doesColumnIndexSupportSelection(i))
- return i;
- }
- return -1;
- },
-
- getSelectableNodeGivenTableRowNode_: function(htmlNode) {
- switch (this.selectionMode_) {
- case SelectionMode.ROW:
- return htmlNode;
-
- case SelectionMode.CELL:
- return htmlNode.children[this.selectedColumnIndex_];
-
- default:
- throw new Error('Invalid selection mode ' + this.selectionMode_);
- }
- },
-
- get selectedColumnIndex() {
- if (this.selectionMode_ !== SelectionMode.CELL)
- return undefined;
- return this.selectedColumnIndex_;
- },
-
- set selectedColumnIndex(selectedColumnIndex) {
- this.rebuildIfNeeded_();
- if (this.selectionMode_ === SelectionMode.NONE)
- throw new Error('Selection is off.');
- if (selectedColumnIndex < 0 ||
- selectedColumnIndex >= this.tableColumns_.length)
- throw new Error('Invalid index');
- if (!this.doesColumnIndexSupportSelection(selectedColumnIndex))
- throw new Error('Selection is not supported on this column');
-
- var e = this.prepareToChangeSelection_();
- this.selectedColumnIndex_ = selectedColumnIndex;
- if (this.selectedColumnIndex_ === undefined)
- this.selectedTableRowInfo_ = undefined;
- this.updateSelectedState_();
-
- this.dispatchEvent(e);
- },
-
- onKeyDown_: function(e) {
- if (this.selectionMode_ === SelectionMode.NONE)
- return;
- if (this.selectedTableRowInfo_ === undefined)
- return;
-
- var code_to_command_names = {
- 13: 'ENTER',
- 37: 'ARROW_LEFT',
- 38: 'ARROW_UP',
- 39: 'ARROW_RIGHT',
- 40: 'ARROW_DOWN'
- };
- var cmdName = code_to_command_names[e.keyCode];
- if (cmdName === undefined)
- return;
-
- e.stopPropagation();
- e.preventDefault();
- this.performKeyCommand_(cmdName);
- },
-
- performKeyCommand_: function(cmdName) {
- this.rebuildIfNeeded_();
-
- var rowInfo = this.selectedTableRowInfo_;
- var htmlNode = rowInfo.htmlNode;
- if (cmdName === 'ARROW_UP') {
- var prev = htmlNode.previousElementSibling;
- if (prev) {
- tr.ui.b.scrollIntoViewIfNeeded(prev);
- this.selectedTableRow = prev.rowInfo.userRow;
- this.focusSelected_();
- return;
- }
- return;
- }
-
- if (cmdName === 'ARROW_DOWN') {
- var next = htmlNode.nextElementSibling;
- if (next) {
- tr.ui.b.scrollIntoViewIfNeeded(next);
- this.selectedTableRow = next.rowInfo.userRow;
- this.focusSelected_();
- return;
- }
- return;
- }
-
- if (cmdName === 'ARROW_RIGHT') {
- switch (this.selectionMode_) {
- case SelectionMode.ROW:
- if (rowInfo.userRow[this.subRowsPropertyName_] === undefined)
- return;
- if (rowInfo.userRow[this.subRowsPropertyName_].length === 0)
- return;
-
- if (!rowInfo.isExpanded)
- this.setExpandedForTableRow(rowInfo.userRow, true);
- this.selectedTableRow =
- htmlNode.nextElementSibling.rowInfo.userRow;
- this.focusSelected_();
- return;
-
- case SelectionMode.CELL:
- var newIndex = this.selectedColumnIndex_ + 1;
- if (newIndex >= this.tableColumns_.length)
- return;
- if (!this.doesColumnIndexSupportSelection(newIndex))
- return;
- this.selectedColumnIndex = newIndex;
- this.focusSelected_();
- return;
-
- default:
- throw new Error('Invalid selection mode ' + this.selectionMode_);
- }
- }
-
- if (cmdName === 'ARROW_LEFT') {
- switch (this.selectionMode_) {
- case SelectionMode.ROW:
- if (rowInfo.isExpanded) {
- this.setExpandedForTableRow(rowInfo.userRow, false);
- this.focusSelected_();
- return;
- }
-
- // Not expanded. Select parent...
- var parentRowInfo = rowInfo.parentRowInfo;
- if (parentRowInfo) {
- this.selectedTableRow = parentRowInfo.userRow;
- this.focusSelected_();
- return;
- }
- return;
-
- case SelectionMode.CELL:
- var newIndex = this.selectedColumnIndex_ - 1;
- if (newIndex < 0)
- return;
- if (!this.doesColumnIndexSupportSelection(newIndex))
- return;
- this.selectedColumnIndex = newIndex;
- this.focusSelected_();
- return;
-
- default:
- throw new Error('Invalid selection mode ' + this.selectionMode_);
- }
- }
-
- if (cmdName === 'ENTER') {
- if (rowInfo.userRow[this.subRowsPropertyName_] === undefined)
- return;
- if (rowInfo.userRow[this.subRowsPropertyName_].length === 0)
- return;
- this.setExpandedForTableRow(rowInfo.userRow, !rowInfo.isExpanded);
- this.focusSelected_();
- return;
- }
-
- throw new Error('Unrecognized command ' + cmdName);
- },
-
- focusSelected_: function() {
- if (!this.selectedTableRowInfo_)
- return;
- var node = this.getSelectableNodeGivenTableRowNode_(
- this.selectedTableRowInfo_.htmlNode);
- node.focus();
- },
-
- dispatchSortingChangedEvent_: function() {
- var e = new tr.b.Event('sort-column-changed');
- e.sortColumnIndex = this.sortColumnIndex_;
- e.sortDescending = this.sortDescending_;
- this.dispatchEvent(e);
- }
- });
- })();
- </script>
-</polymer-element>
-<polymer-element name="tr-ui-b-table-header-cell" on-tap="onTap_">
- <template>
- <style>
- :host {
- -webkit-user-select: none;
- display: flex;
- }
-
- span {
- flex: 0 1 auto;
- }
-
- side-element {
- -webkit-user-select: none;
- flex: 0 0 auto;
- padding-left: 4px;
- vertical-align: top;
- font-size: 15px;
- font-family: sans-serif;
- display: inline;
- line-height: 85%;
- }
- </style>
-
- <span id="title"></span><side-element id="side"></side-element>
- </template>
-
- <script>
- 'use strict';
-
- var ColumnAlignment = tr.ui.b.TableFormat.ColumnAlignment;
-
- Polymer({
- created: function() {
- this.tapCallback_ = undefined;
- this.cellTitle_ = '';
- this.align_ = undefined;
- },
-
- set cellTitle(value) {
- this.cellTitle_ = value;
-
- var titleNode = tr.ui.b.asHTMLOrTextNode(
- this.cellTitle_, this.ownerDocument);
-
- this.$.title.innerText = '';
- this.$.title.appendChild(titleNode);
- },
-
- get cellTitle() {
- return this.cellTitle_;
- },
-
- set align(align) {
- switch (align) {
- case undefined:
- case ColumnAlignment.LEFT:
- this.style.justifyContent = '';
- break;
-
- case ColumnAlignment.RIGHT:
- this.style.justifyContent = 'flex-end';
- break;
-
- default:
- throw new Error('Invalid alignment of column (title=\'' +
- this.cellTitle_ + '\'): ' + align);
- }
- this.align_ = align;
- },
-
- get align() {
- return this.align_;
- },
-
- clearSideContent: function() {
- this.$.side.textContent = '';
- },
-
- set sideContent(content) {
- this.$.side.textContent = content;
- },
-
- get sideContent() {
- return this.$.side.textContent;
- },
-
- set tapCallback(callback) {
- this.style.cursor = 'pointer';
- this.tapCallback_ = callback;
- },
-
- get tapCallback() {
- return this.tapCallback_;
- },
-
- onTap_: function() {
- if (this.tapCallback_)
- this.tapCallback_();
- }
- });
-</script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/table_header_cell.html b/chromium/third_party/catapult/tracing/tracing/ui/base/table_header_cell.html
deleted file mode 100644
index f6ba5eb35dd..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/table_header_cell.html
+++ /dev/null
@@ -1,89 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-
-<polymer-element name="tr-ui-b-table-header-cell"
- on-tap="onTap_">
- <template>
- <style>
- :host {
- -webkit-user-select: none;
- display: flex;
- }
-
- span {
- flex: 0 1 auto;
- }
-
- side-element {
- -webkit-user-select: none;
- flex: 1 0 auto;
- padding-left: 4px;
- vertical-align: top;
- font-size: 15px;
- font-family: sans-serif;
- display: inline;
- line-height: 85%;
- }
- </style>
-
- <span id="title"></span><side-element id="side"></side-element>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.tapCallback_ = undefined;
- this.cellTitle_ = '';
- },
-
- set cellTitle(value) {
- this.cellTitle_ = value;
-
- var titleNode =
- tr.ui.b.asHTMLOrTextNode(this.cellTitle_, this.ownerDocument);
-
- this.$.title.innerText = '';
- this.$.title.appendChild(titleNode);
- },
-
- get cellTitle() {
- return this.cellTitle_;
- },
-
- clearSideContent: function() {
- this.$.side.textContent = '';
- },
-
- set sideContent(content) {
- this.$.side.textContent = content;
- },
-
- get sideContent() {
- return this.$.side.textContent;
- },
-
- set tapCallback(callback) {
- this.style.cursor = 'pointer';
- this.tapCallback_ = callback;
- },
-
- get tapCallback() {
- return this.tapCallback_;
- },
-
- onTap_: function() {
- if (this.tapCallback_)
- this.tapCallback_();
- }
- });
-</script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/table_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/table_test.html
deleted file mode 100644
index 0c3504fc318..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/table_test.html
+++ /dev/null
@@ -1,1461 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/deep_utils.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var THIS_DOC = document._currentScript.ownerDocument;
- var SelectionMode = tr.ui.b.TableFormat.SelectionMode;
- var HighlightStyle = tr.ui.b.TableFormat.HighlightStyle;
- var ColumnAlignment = tr.ui.b.TableFormat.ColumnAlignment;
-
- function isSelected(element) {
- if (!element.hasAttribute('selected'))
- return false;
- return element.getAttribute('selected') === 'true';
- }
-
- test('instantiateEmptyTable_withoutEmptyValue', function() {
- var columns = [
- {
- title: 'First Column',
- value: function(row) { return row.firstData; },
- width: '300px'
- },
- {
- title: 'Second Column',
- value: function(row) { return row.secondData; }
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = columns;
- table.tableRows = [];
- table.rebuild();
-
- this.addHTMLOutput(table);
-
- // Check that the width of the first column was set correctly (despite no
- // body rows).
- var firstColumnHeader = table.$.head.children[0].children[0];
- assert.closeTo(firstColumnHeader.offsetWidth, 300, 20);
-
- // Check that the first column has a non-empty header.
- var firstColumnTitle = tr.b.findDeepElementMatchingPredicate(
- firstColumnHeader, function(element) {
- return element.textContent === 'First Column';
- });
- assert.isDefined(firstColumnTitle);
-
- // Check that empty value was not appended.
- assert.lengthOf(table.$.body.children, 0);
- });
-
- test('instantiateEmptyTable_withEmptyValue', function() {
- var columns = [
- {
- title: 'First Column',
- value: function(row) { return row.firstData; },
- width: '300px'
- },
- {
- title: 'Second Column',
- value: function(row) { return row.secondData; }
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = columns;
- table.tableRows = [];
- table.emptyValue = 'This table is left intentionally empty';
- table.rebuild();
-
- this.addHTMLOutput(table);
-
- // Check that the width of the first column was set correctly (despite no
- // body rows).
- var firstColumnHeader = table.$.head.children[0].children[0];
- assert.closeTo(firstColumnHeader.offsetWidth, 300, 20);
-
- // Check that empty value was appended.
- assert.lengthOf(table.$.body.children, 1);
- });
-
- test('instantiateNestedTableNoNests', function() {
- var columns = [
- {
- title: 'First Column',
- value: function(row) { return row.firstData; },
- width: '200px'
- },
- {
- title: 'Second Column',
- value: function(row) { return row.secondData; }
- }
- ];
-
- var rows = [
- {
- firstData: 'A1',
- secondData: 'A2'
- },
- {
- firstData: 'B1',
- secondData: 'B2'
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = columns;
- table.tableRows = rows;
- table.emptyValue = 'THIS SHOULD NOT BE VISIBLE!!!';
- table.rebuild();
-
- this.addHTMLOutput(table);
-
- // Check that empty value was not appended.
- assert.lengthOf(table.$.body.children, 2);
- });
-
- test('sequentialRebuildsBehaveSanely', function() {
- var columns = [
- {
- title: 'First Column',
- value: function(row) { return row.firstData; },
- width: '200px'
- },
- {
- title: 'Second Column',
- value: function(row) { return row.secondData; }
- }
- ];
-
- var rows = [
- {
- firstData: 'A1',
- secondData: 'A2'
- },
- {
- firstData: 'B1',
- secondData: 'B2'
- }
- ];
- var footerRows = [
- {
- firstData: 'A1',
- secondData: 'A2'
- },
- {
- firstData: 'B1',
- secondData: 'B2'
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = columns;
- table.tableRows = rows;
- table.footerRows = footerRows;
- table.rebuild();
- table.rebuild();
- assert.equal(table.$.body.children.length, 2);
- assert.equal(table.$.foot.children.length, 2);
-
- this.addHTMLOutput(table);
- });
-
- test('instantiateNestedTableWithNests', function() {
- var columns = [
- {
- title: 'First Column',
- value: function(row) { return row.firstData; },
- width: '250px'
- },
- {
- title: 'Second Column',
- value: function(row) { return row.secondData; },
- width: '50%'
- }
- ];
-
- var rows = [
- {
- firstData: 'A1',
- secondData: 'A2',
- subRows: [
- {
- firstData: 'Sub1 A1',
- secondData: 'Sub1 A2'
- },
- {
- firstData: 'Sub2 A1',
- secondData: 'Sub2 A2',
- subRows: [
- {
- firstData: 'SubSub1 A1',
- secondData: 'SubSub1 A2'
- },
- {
- firstData: 'SubSub2 A1',
- secondData: 'SubSub2 A2'
- }
- ]
- },
- {
- firstData: 'Sub3 A1',
- secondData: 'Sub3 A2'
- }
- ]
- },
- {
- firstData: 'B1',
- secondData: 'B2'
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = columns;
- table.tableRows = rows;
- table.rebuild();
-
- this.addHTMLOutput(table);
- });
-
- test('instantiateSortingCallbacksWithNests', function() {
- var table = document.createElement('tr-ui-b-table');
-
- var columns = [
- {
- title: 'First Column',
- value: function(row) { return row.firstData; },
- width: '50%'
- },
- {
- title: 'Second Column',
- value: function(row) { return row.secondData; },
- width: '250px',
- cmp: function(rowA, rowB) {
- return rowA.secondData.toString().localeCompare(
- rowB.secondData.toString());
- },
- showExpandButtons: true
- }
- ];
-
- var rows = [
- {
- firstData: 'A1',
- secondData: 'A2',
- subRows: [
- {
- firstData: 'Sub1 A1',
- secondData: 'Sub1 A2'
- },
- {
- firstData: 'Sub2 A1',
- secondData: 'Sub2 A2',
- subRows: [
- {
- firstData: 'SubSub1 A1',
- secondData: 'SubSub1 A2'
- },
- {
- firstData: 'SubSub2 A1',
- secondData: 'SubSub2 A2'
- }
- ]
- },
- {
- firstData: 'Sub3 A1',
- secondData: 'Sub3 A2'
- }
- ]
- },
- {
- firstData: 'B1',
- secondData: 'B2'
- }
- ];
-
- var footerRows = [
- {
- firstData: 'F1',
- secondData: 'F2',
- subRows: [
- {
- firstData: 'Sub1F1',
- secondData: 'Sub1F2'
- },
- {
- firstData: 'Sub2F1',
- secondData: 'Sub2F2',
- subRows: [
- {
- firstData: 'SubSub1F1',
- secondData: 'SubSub1F2'
- },
- {
- firstData: 'SubSub2F1',
- secondData: 'SubSub2F2'
- }
- ]
- },
- {
- firstData: 'Sub3F1',
- secondData: 'Sub3F2'
- }
- ]
- },
- {
- firstData: 'F\'1',
- secondData: 'F\'2'
- }
-
- ];
-
- table.tableColumns = columns;
- table.tableRows = rows;
- table.footerRows = footerRows;
- table.rebuild();
-
- this.addHTMLOutput(table);
-
- var button = THIS_DOC.createElement('button');
- button.textContent = 'Sort By Col 0';
- button.addEventListener('click', function() {
- table.sortDescending = !table.sortDescending;
- table.sortColumnIndex = 0;
- });
- table.rebuild();
-
- this.addHTMLOutput(button);
- });
-
-
- test('instantiateNestedTableAlreadyExpanded', function() {
- var columns = [
- {
- title: 'a',
- value: function(row) { return row.a; },
- width: '150px'
- },
- {
- title: 'a',
- value: function(row) { return row.b; },
- width: '50%'
- }
- ];
-
- var rows = [
- {
- a: 'aToplevel',
- b: 'bToplevel',
- isExpanded: true,
- subRows: [
- {
- a: 'a1',
- b: 'b1'
- }
- ]
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = columns;
- table.tableRows = rows;
- table.rebuild();
- this.addHTMLOutput(table);
-
- var a1El = tr.b.findDeepElementMatchingPredicate(table, function(element) {
- return element.textContent == 'a1';
- });
- assert.isDefined(a1El);
-
- var bToplevelEl = tr.b.findDeepElementMatchingPredicate(
- table,
- function(element) {
- return element.textContent == 'bToplevel';
- });
- assert.isDefined(bToplevelEl);
- var expandButton = bToplevelEl.parentElement.querySelector('expand-button');
- assert.isTrue(expandButton.classList.contains('button-expanded'));
- });
-
-
- test('subRowsThatAreRetrievedOnDemand', function() {
- var columns = [
- {
- title: 'a',
- value: function(row) { return row.a; },
- width: '150px'
- }
- ];
-
- var rows = [
- {
- a: 'row1',
- subRows: [
- {
- b: 'row1.1',
- get subRows() {
- throw new Error('Shold not be called');
- }
- }
- ]
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = columns;
- table.tableRows = rows;
- table.rebuild();
- this.addHTMLOutput(table);
- });
-
-
- test('instantiateTableWithHiddenHeader', function() {
- var columns = [
- {
- title: 'a',
- value: function(row) { return row.a; },
- width: '150px'
- },
- {
- title: 'a',
- value: function(row) { return row.b; },
- width: '50%'
- }
- ];
-
- var rows = [
- {
- a: 'aToplevel',
- b: 'bToplevel'
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.showHeader = false;
- table.tableColumns = columns;
- table.tableRows = rows;
- table.rebuild();
- this.addHTMLOutput(table);
-
- var tHead = table.$.head;
- assert.equal(table.$.head.children.length, 0);
- assert.equal(0, tHead.getBoundingClientRect().height);
-
- table.showHeader = true;
- table.rebuild();
- table.showHeader = false;
- table.rebuild();
- assert.equal(table.$.head.children.length, 0);
- });
-
-
- test('sortColumnsNotPossibleOnPercentSizedColumns', function() {
- var columns = [
- {
- title: 'Title',
- value: function(row) { return row.a; },
- width: '150px'
- },
- {
- title: 'Value',
- value: function(row) { return row.b; },
- width: '100%',
- showExpandButtons: true
- }
- ];
-
- var table1 = document.createElement('tr-ui-b-table');
- table1.showHeader = true;
-
- assert.throws(function() {
- table1.tableColumns = columns;
- });
- });
-
- test('twoTablesFirstColumnMatching', function() {
- var columns = [
- {
- title: 'Title',
- value: function(row) { return row.a; },
- width: '150px'
- },
- {
- title: 'Value',
- value: function(row) { return row.b; },
- width: '100%'
- }
- ];
-
- var table1 = document.createElement('tr-ui-b-table');
- table1.showHeader = true;
- table1.tableColumns = columns;
- table1.tableRows = [
- {
- a: 'first',
- b: 'row'
- }
- ];
- table1.rebuild();
- this.addHTMLOutput(table1);
-
- var table2 = document.createElement('tr-ui-b-table');
- table2.showHeader = false;
- table2.tableColumns = columns;
- table2.tableRows = [
- {
- a: 'second',
- b: 'row'
- }
- ];
- table2.rebuild();
- this.addHTMLOutput(table2);
-
- var h1FirstCol = table1.$.head.children[0].children[0];
- var h2FirstCol = table2.$.body.children[0].children[0];
- assert.equal(h1FirstCol.getBoundingClientRect().width,
- h2FirstCol.getBoundingClientRect().width);
- });
-
- test('programmaticSorting', function() {
- var table = document.createElement('tr-ui-b-table');
-
- var columns = [
- {
- title: 'Column',
- value: function(row) { return row.value; },
- cmp: function(rowA, rowB) {
- return rowA.value.toString().localeCompare(
- rowB.value.toString());
- }
- }
- ];
-
- var rows = [
- {
- value: 'A1',
- subRows: [
- {
- value: 'A1.1'
- },
- {
- value: 'A1.2',
- subRows: [
- {
- value: 'A1.2.1'
- },
- {
- value: 'A1.2.2'
- }
- ]
- },
- {
- value: 'A1.3'
- }
- ]
- },
- {
- value: 'A2'
- }
- ];
-
- table.tableColumns = columns;
- table.tableRows = rows;
- table.rebuild();
-
- this.addHTMLOutput(table);
-
- table.sortDescending = true;
- table.sortColumnIndex = 0;
- table.rebuild();
- var r0 = table.$.body.children[0];
- assert.equal(r0.rowInfo.userRow, rows[1]);
-
- var r1 = table.$.body.children[1];
- assert.equal(r1.rowInfo.userRow, rows[0]);
- });
-
- test('sortDispatchesEvent', function() {
- var table = document.createElement('tr-ui-b-table');
- var columns = [
- {
- title: 'Column 0',
- value: function(row) { return row.value0; },
- cmp: function(rowA, rowB) { return rowA.value0 - rowB.value0; }
- },
- {
- title: 'Column 1',
- value: function(row) { return row.value1; },
- cmp: function(rowA, rowB) { return rowA.value1 - rowB.value1; }
- }
- ];
-
- var sortColumnIndex = undefined;
- var sortDescending = undefined;
- var numListenerCalls = 0;
- table.tableColumns = columns;
- table.addEventListener('sort-column-changed', function(e) {
- sortColumnIndex = e.sortColumnIndex;
- sortDescending = e.sortDescending;
- numListenerCalls++;
- });
- table.rebuild();
-
- table.sortColumnIndex = 0;
- assert.equal(sortColumnIndex, 0);
- assert.equal(numListenerCalls, 1);
-
- table.sortDescending = true;
- assert.equal(sortColumnIndex, 0);
- assert.isTrue(sortDescending);
- assert.equal(numListenerCalls, 2);
-
- table.sortColumnIndex = 1;
- table.sortDescending = false;
- assert.equal(sortColumnIndex, 1);
- assert.isFalse(sortDescending);
- assert.equal(numListenerCalls, 4);
-
- table.sortColumnIndex = undefined;
- assert.equal(sortColumnIndex, undefined);
- assert.equal(numListenerCalls, 5);
- });
-
- test('sortingAfterExpand', function() {
- var table = document.createElement('tr-ui-b-table');
-
- var columns = [
- {
- title: 'Column',
- value: function(row) { return row.value; },
- cmp: function(rowA, rowB) {
- return rowA.value.toString().localeCompare(
- rowB.value.toString());
- }
- }
- ];
-
- var rows = [
- {
- value: 'A1',
- isExpanded: true,
- subRows: [
- {
- value: 'A1.1'
- },
- {
- value: 'A1.2',
- subRows: [
- {
- value: 'A1.2.1'
- },
- {
- value: 'A1.2.2'
- }
- ]
- },
- {
- value: 'A1.3'
- }
- ]
- },
- {
- value: 'A2'
- }
- ];
-
- table.tableColumns = columns;
- table.tableRows = rows;
- table.rebuild();
-
- this.addHTMLOutput(table);
-
- table.sortDescending = true;
- table.sortColumnIndex = 0;
- table.rebuild();
- var r0 = table.$.body.children[0];
- assert.equal(r0.rowInfo.userRow, rows[1]);
-
- var r1 = table.$.body.children[1];
- assert.equal(r1.rowInfo.userRow, rows[0]);
-
- var r2 = table.$.body.children[2];
- assert.equal(r2.rowInfo.userRow, rows[0].subRows[2]);
-
- assert.isFalse(r0.hasAttribute('tabIndex'));
- });
-
- function createSimpleOneColumnNestedTable() {
- var table = document.createElement('tr-ui-b-table');
-
- var columns = [
- {
- title: 'Column',
- value: function(row) { return row.value; },
- cmp: function(rowA, rowB) {
- return rowA.value.toString().localeCompare(
- rowB.value.toString());
- }
- }
- ];
-
- var rows = [
- {
- value: 'A1',
- subRows: [
- {
- value: 'A1.1'
- },
- {
- value: 'A1.2',
- subRows: [
- {
- value: 'A1.2.1'
- },
- {
- value: 'A1.2.2'
- }
- ]
- },
- {
- value: 'A1.3'
- }
- ]
- },
- {
- value: 'A2'
- }
- ];
-
- table.tableColumns = columns;
- table.tableRows = rows;
- return table;
- }
-
- test('expandAfterRebuild', function() {
- var table = createSimpleOneColumnNestedTable();
- table.rebuild();
- var rows = table.tableRows;
-
- this.addHTMLOutput(table);
-
- table.rebuild();
- assert.isFalse(table.getExpandedForTableRow(rows[0]));
- table.setExpandedForTableRow(rows[0], true);
- assert.isTrue(table.getExpandedForTableRow(rows[0]));
-
- var r1 = table.$.body.children[1];
- assert.equal(r1.rowInfo.userRow, rows[0].subRows[0]);
- });
-
- test('tableSelection', function() {
- var table = createSimpleOneColumnNestedTable();
- var rows = table.tableRows;
-
- table.selectionMode = SelectionMode.ROW;
- table.selectedTableRow = rows[0];
-
- table.setExpandedForTableRow(rows[0], true);
- table.selectedTableRow = rows[0].subRows[1];
- assert.equal(table.selectedTableRow, rows[0].subRows[1]);
-
- table.setExpandedForTableRow(rows[0], false);
- assert.equal(table.selectedTableRow, rows[0]);
-
- table.selectionMode = SelectionMode.NONE;
- assert.equal(table.selectedTableRow, undefined);
-
- table.selectionMode = SelectionMode.ROW;
- table.setExpandedForTableRow(rows[0].subRows[1], true);
- this.addHTMLOutput(table);
-
- var r0 = table.$.body.children[0];
- assert.isTrue(r0.hasAttribute('tabIndex'));
- });
-
-
- test('keyMovement', function() {
- var table = createSimpleOneColumnNestedTable();
- table.selectionMode = SelectionMode.ROW;
- this.addHTMLOutput(table);
-
- var rows = table.tableRows;
- table.selectedTableRow = rows[0];
-
- table.performKeyCommand_('ARROW_DOWN');
- assert.equal(table.selectedTableRow, rows[1]);
-
- table.performKeyCommand_('ARROW_UP');
- assert.equal(table.selectedTableRow, rows[0]);
-
- // Enter on collapsed row should expand.
- table.selectedTableRow = rows[0];
- table.performKeyCommand_('ENTER');
- assert.equal(table.selectedTableRow, rows[0]);
- assert.isTrue(table.getExpandedForTableRow(rows[0]));
-
- table.performKeyCommand_('ENTER');
- assert.isFalse(table.getExpandedForTableRow(rows[0]));
-
- // Arrow right on collapsed row should expand.
- table.selectedTableRow = rows[0];
- table.performKeyCommand_('ARROW_RIGHT');
- assert.equal(table.selectedTableRow, rows[0].subRows[0]);
- assert.isTrue(table.getExpandedForTableRow(rows[0]));
-
- table.performKeyCommand_('ARROW_DOWN');
- assert.equal(table.selectedTableRow, rows[0].subRows[1]);
-
- // Arrow left on collapsed item should select parent.
- table.performKeyCommand_('ARROW_LEFT');
- assert.equal(table.selectedTableRow, rows[0]);
- assert.isTrue(table.getExpandedForTableRow(rows[0]));
- // Arrow left on parent should collapse its children.
- table.performKeyCommand_('ARROW_LEFT');
- assert.isFalse(table.getExpandedForTableRow(rows[0]));
-
- // Arrow right on expanded row should select first child.
- table.selectedTableRow = rows[0];
- table.setExpandedForTableRow(rows[0], true);
- table.performKeyCommand_('ARROW_RIGHT');
- assert.equal(table.selectedTableRow, rows[0].subRows[0]);
-
- // Arrow right on a non-expandable row should do nothing.
- table.selectedTableRow = rows[1];
- assert.equal(table.selectedTableRow, rows[1]);
- table.performKeyCommand_('ARROW_RIGHT');
- assert.equal(table.selectedTableRow, rows[1]);
- assert.isFalse(table.getExpandedForTableRow(rows[1]));
- });
-
- test('RightArrowKeyWhenTableSorted', function() {
- var table = createSimpleOneColumnNestedTable();
- table.selectionMode = SelectionMode.ROW;
- this.addHTMLOutput(table);
- table.sortDescending = true;
- table.sortColumnIndex = 0;
- table.rebuild();
- var rows = table.tableRows;
-
- // Arrow right should select the first child showing up on the viewer,
- // rather than first child in sub rows since sorted.
- table.selectedTableRow = rows[0];
- table.performKeyCommand_('ARROW_RIGHT');
- assert.equal(table.selectedTableRow, rows[0].subRows[2]);
- });
-
- test('reduceNumberOfColumnsAfterRebuild', function() {
- // Create a table with two columns.
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = [
- {
- title: 'First Column',
- value: function(row) { return row.firstData; },
- width: '100px'
- },
- {
- title: 'Second Column',
- value: function(row) { return row.secondData; },
- width: '100px'
- }
- ];
-
- // Build the table.
- table.rebuild();
-
- // Check that reducing the number of columns doesn't throw an exception.
- table.tableColumns = [
- {
- title: 'First Column',
- value: function(row) { return row.firstData; },
- width: '200px'
- }
- ];
- });
-
- test('rowHighlightDark', function() {
- var columns = [
- {
- title: 'Title',
- value: function(row) { return row.a; },
- width: '150px',
- supportsCellSelection: false
- },
- {
- title: 'Col1',
- value: function(row) { return row.b; },
- width: '33%'
- },
- {
- title: 'Col2',
- value: function(row) { return row.b * 2; },
- width: '33%'
- },
- {
- title: 'Col3',
- value: function(row) { return row.b * 3; },
- width: '33%'
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.showHeader = true;
- table.rowHighlightStyle = HighlightStyle.DARK;
- table.tableColumns = columns;
- table.tableRows = [
- {
- a: 'first',
- b: '1'
- },
- {
- a: 'second',
- b: '2'
- }
- ];
- table.rebuild();
- this.addHTMLOutput(table);
- });
-
- test('cellHighlightLight', function() {
- var columns = [
- {
- title: 'Title',
- value: function(row) { return row.a; },
- width: '150px',
- supportsCellSelection: false
- },
- {
- title: 'Col1',
- value: function(row) { return row.b; },
- width: '33%'
- },
- {
- title: 'Col2',
- value: function(row) { return row.b * 2; },
- width: '33%'
- },
- {
- title: 'Col3',
- value: function(row) { return row.b * 3; },
- width: '33%'
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.showHeader = true;
- table.cellHighlightStyle = HighlightStyle.LIGHT;
- table.tableColumns = columns;
- table.tableRows = [
- {
- a: 'first',
- b: '1'
- },
- {
- a: 'second',
- b: '2'
- }
- ];
- table.rebuild();
- this.addHTMLOutput(table);
- });
-
- test('cellSelectionBasic', function() {
- var columns = [
- {
- title: 'Title',
- value: function(row) { return row.a; },
- width: '150px',
- supportsCellSelection: false
- },
- {
- title: 'Col1',
- value: function(row) { return row.b; },
- width: '33%'
- },
- {
- title: 'Col2',
- value: function(row) { return row.b * 2; },
- width: '33%'
- },
- {
- title: 'Col3',
- value: function(row) { return row.b * 3; },
- width: '33%'
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.showHeader = true;
- table.selectionMode = SelectionMode.CELL;
- table.rowHighlightStyle = HighlightStyle.NONE;
- table.tableColumns = columns;
- table.tableRows = [
- {
- a: 'first',
- b: '1'
- },
- {
- a: 'second',
- b: '2'
- }
- ];
- table.rebuild();
- this.addHTMLOutput(table);
-
- table.selectedTableRow = table.tableRows[0];
- assert.equal(table.selectedColumnIndex, 1);
-
- table.performKeyCommand_('ARROW_DOWN');
- table.performKeyCommand_('ARROW_RIGHT');
- table.performKeyCommand_('ARROW_RIGHT');
- table.performKeyCommand_('ARROW_LEFT');
- assert.equal(table.selectedTableRow, table.tableRows[1]);
- assert.equal(table.selectedColumnIndex, 2);
-
- table.selectedTableRow = undefined;
- assert.equal(table.selectedTableRow, undefined);
- assert.equal(table.selectedColumnIndex, undefined);
- assert.equal(table.selectedColumnIndex, undefined);
- });
-
- test('cellSelectionNested', function() {
- var columns = [
- {
- title: 'Title',
- value: function(row) { return row.a; },
- width: '150px',
- supportsCellSelection: false
- },
- {
- title: 'Value',
- value: function(row) { return row.b; },
- width: '150px'
- }
- ];
-
- var rows = [
- {
- a: 'parent',
- b: '1',
- subRows: [
- {
- a: 'child',
- b: '2'
- }
- ]
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.showHeader = true;
- table.selectionMode = SelectionMode.CELL;
- table.tableColumns = columns;
- table.tableRows = rows;
- table.rebuild();
- this.addHTMLOutput(table);
-
- // Expand the parent row.
- table.setExpandedForTableRow(rows[0], true);
-
- // Select the second cell in the child row.
- table.selectedTableRow = rows[0].subRows[0];
- assert.isFalse(isSelected(table.$.body.children[0]));
- assert.isFalse(isSelected(table.$.body.children[0].children[1]));
- assert.isTrue(isSelected(table.$.body.children[1]));
- assert.isTrue(isSelected(table.$.body.children[1].children[1]));
-
- // Fold the parent row. The second cell in the parent row should be
- // automatically selected.
- table.setExpandedForTableRow(rows[0], false);
- assert.isTrue(isSelected(table.$.body.children[0]));
- assert.isTrue(isSelected(table.$.body.children[0].children[1]));
-
- // Expand the parent row again. Only the second cell of the parent row
- // should still be selected.
- table.setExpandedForTableRow(rows[0], true);
- assert.isTrue(isSelected(table.$.body.children[0]));
- assert.isTrue(isSelected(table.$.body.children[0].children[1]));
- assert.isFalse(isSelected(table.$.body.children[1]));
- assert.isFalse(isSelected(table.$.body.children[1].children[1]));
- });
-
- test('resolvedHighlightStyle', function() {
- var table = document.createElement('tr-ui-b-table');
-
- // Undefined selection mode.
- assert.strictEqual(table.resolvedRowHighlightStyle, HighlightStyle.NONE);
- assert.strictEqual(table.resolvedCellHighlightStyle, HighlightStyle.NONE);
-
- // Row selection mode.
- table.selectionMode = SelectionMode.ROW;
- assert.strictEqual(table.resolvedRowHighlightStyle, HighlightStyle.DARK);
- assert.strictEqual(table.resolvedCellHighlightStyle, HighlightStyle.NONE);
-
- // Cell selection mode.
- table.selectionMode = SelectionMode.CELL;
- assert.strictEqual(table.resolvedRowHighlightStyle, HighlightStyle.LIGHT);
- assert.strictEqual(table.resolvedCellHighlightStyle, HighlightStyle.DARK);
-
- // Explicit row highlight style.
- table.rowHighlightStyle = HighlightStyle.NONE;
- assert.strictEqual(table.resolvedRowHighlightStyle, HighlightStyle.NONE);
- assert.strictEqual(table.resolvedCellHighlightStyle, HighlightStyle.DARK);
-
- // Explicit row and cell highlight styles.
- table.cellHighlightStyle = HighlightStyle.LIGHT;
- assert.strictEqual(table.resolvedRowHighlightStyle, HighlightStyle.NONE);
- assert.strictEqual(table.resolvedCellHighlightStyle, HighlightStyle.LIGHT);
-
- // Back to default highlight styles.
- table.cellHighlightStyle = HighlightStyle.DEFAULT;
- table.rowHighlightStyle = HighlightStyle.DEFAULT;
- assert.strictEqual(table.resolvedRowHighlightStyle, HighlightStyle.LIGHT);
- assert.strictEqual(table.resolvedCellHighlightStyle, HighlightStyle.DARK);
- });
-
- test('headersWithHtmlElements', function() {
- var firstColumnTitle = document.createTextNode('First Column');
- var secondColumnTitle = document.createElement('span');
- secondColumnTitle.innerText = 'Second Column';
- secondColumnTitle.style.color = 'blue';
-
- var columns = [
- {
- title: firstColumnTitle,
- value: function(row) { return row.firstData; },
- width: '200px'
- },
- {
- title: secondColumnTitle,
- value: function(row) { return row.secondData; }
- }
- ];
-
- var rows = [
- {
- firstData: 'A1',
- secondData: 'A2'
- },
- {
- firstData: 'B1',
- secondData: 'B2'
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = columns;
- table.tableRows = rows;
- table.rebuild();
-
- this.addHTMLOutput(table);
-
- var firstColumnHeader = table.$.head.children[0].children[0].children[0];
- var secondColumnHeader = table.$.head.children[0].children[1].children[0];
- assert.equal(firstColumnHeader.cellTitle.textContent, 'First Column');
- assert.equal(secondColumnHeader.cellTitle.textContent, 'Second Column');
- });
-
- test('align', function() {
- var columns = [
- {
- title: 'a',
- align: ColumnAlignment.RIGHT,
- value: function(row) {
- return row.a;
- }
- }
- ];
- var rows = [{a: 1}, {a: 'long-row-so-that-alignment-would-be-visible'}];
-
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = columns;
- table.tableRows = rows;
- table.rebuild();
-
- this.addHTMLOutput(table);
-
- assert.strictEqual(
- table.$.body.children[0].children[0].style.textAlign, 'right');
- });
-
- test('subRowsPropertyName', function() {
- var columns = [
- {
- title: 'a',
- value: function(row) {
- return row.a;
- }
- }
- ];
- var rows = [
- {
- a: 1,
- isExpanded: true,
- children: [
- {a: 2}
- ]
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.subRowsPropertyName = 'children';
- table.tableColumns = columns;
- table.tableRows = rows;
- table.rebuild();
-
- this.addHTMLOutput(table);
-
- assert.equal(2, table.$.body.children[1].children[0].textContent);
- });
-
- test('shouldNotRenderUndefined', function() {
- var columns = [
- {
- title: 'Column',
- value: function(row) { return row.firstData; }
- }
- ];
-
- var rows = [
- {
- firstData: undefined,
- secondData: 'A2'
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = columns;
- table.tableRows = rows;
- table.rebuild();
-
- this.addHTMLOutput(table);
-
- // check that we don't have 'undefined' anywhere
- assert.isTrue(table.$.body.innerHTML.indexOf('undefined') < 0);
- });
-
- test('customizeTableRowCallback', function() {
- var columns = [
- {
- title: 'Column',
- value: function(row) { return row.data; }
- }
- ];
-
- var rows = [
- {
- data: 'data'
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- var callbackCalled = false;
- table.tableColumns = columns;
- table.tableRows = rows;
- table.customizeTableRowCallback = function(userRow, trElement) {
- callbackCalled = (userRow === rows[0]);
- };
- table.rebuild();
- assert.isTrue(callbackCalled);
-
- this.addHTMLOutput(table);
-
- // The callback can also be set after the table is first built.
- table.customizeTableRowCallback = function(userRow, trElement) {
- callbackCalled = (userRow === rows[0]);
- };
-
- // Setting the customize callback should set the body dirty.
- assert.isTrue(table.bodyDirty_);
-
- callbackCalled = false;
-
- // Don't bother waiting for the timeout.
- table.rebuild();
-
- assert.isTrue(callbackCalled);
- });
-
- test('selectionEdgeCases', function() {
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = [
- {
- title: 'Column',
- value: function(row) { return row.data; },
- supportsCellSelection: false
- }
- ];
- table.tableRows = [{ data: 'body row' }];
- table.footerRows = [{ data: 'footer row' }];
- table.selectionMode = SelectionMode.ROW;
- this.addHTMLOutput(table);
-
- // Clicking on the body row should *not* throw an exception (despite the
- // column not supporting cell selection).
- table.$.body.children[0].children[0].click();
-
- // Clicking on the footer row should *not* throw an exception (despite
- // footer rows not being selectable in general).
- table.$.foot.children[0].children[0].click();
- });
-
- test('defaultExpansionStateCallback', function() {
- var columns = [
- {
- title: 'Name',
- value: function(row) { return row.name; }
- },
- {
- title: 'Value',
- value: function(row) { return row.value; }
- }
- ];
-
- var rows = [
- {
- name: 'A',
- value: 10,
- subRows: [
- {
- name: 'B',
- value: 8,
- subRows: [
- {
- name: 'C',
- value: 4
- },
- {
- name: 'D',
- value: 4
- }
- ]
- },
- {
- name: 'E',
- value: 2,
- subRows: [
- {
- name: 'F',
- value: 1
- },
- {
- name: 'G',
- value: 1
- }
- ]
- }
- ]
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = columns;
- table.tableRows = rows;
- table.rebuild();
-
- this.addHTMLOutput(table);
-
- var cRow = tr.b.findDeepElementMatchingPredicate(
- table, function(element) {
- return element.textContent === 'C';
- });
- assert.equal(cRow, undefined);
-
- var callbackCalled = false;
- table.defaultExpansionStateCallback = function(row, parentRow) {
- callbackCalled = true;
-
- if (parentRow === undefined)
- return true;
-
- if (row.value >= (parentRow.value * 0.8))
- return true;
-
- return false;
- };
-
- // Setting the callback should set the body dirty.
- assert.isTrue(table.bodyDirty_);
- assert.isFalse(callbackCalled);
-
- table.rebuild();
-
- assert.isTrue(callbackCalled);
- cRow = tr.b.findDeepElementMatchingPredicate(table, function(element) {
- return element.textContent === 'C';
- });
- assert.isDefined(cRow);
- });
-
- test('sortExpanded', function() {
- var columns = [
- {
- title: 'Name',
- value: function(row) { return row.name; }
- },
- {
- title: 'Value',
- value: function(row) { return row.value; },
- cmp: function(x, y) { return x.value - y.value; }
- }
- ];
-
- var rows = [
- {
- name: 'A',
- value: 10,
- subRows: [
- {
- name: 'B',
- value: 8
- },
- {
- name: 'C',
- value: 4
- },
- ]
- }
- ];
-
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = columns;
- table.tableRows = rows;
- table.rebuild();
-
- this.addHTMLOutput(table);
-
- function isB(row) {
- return row.textContent === 'B';
- }
-
- // Check that 'A' row is not expanded.
- assert.isUndefined(tr.b.findDeepElementMatchingPredicate(table, isB));
-
- // Expand 'A' row.
- table.setExpandedForTableRow(rows[0], true);
-
- // Check that 'A' is expanded.
- assert.isDefined(tr.b.findDeepElementMatchingPredicate(table, isB));
-
- // Sort by value.
- table.sortColumnIndex = 1;
-
- // Rebuild the table synchronously instead of waiting for scheduleRebuild_'s
- // setTimeout(0).
- table.rebuild();
-
- // Check that 'A' is still expanded.
- assert.isDefined(tr.b.findDeepElementMatchingPredicate(table, isB));
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/timing_tool.html b/chromium/third_party/catapult/tracing/tracing/ui/base/timing_tool.html
deleted file mode 100644
index 5fe8c74e86b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/timing_tool.html
+++ /dev/null
@@ -1,322 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/slice.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the TimingTool class.
- */
-tr.exportTo('tr.ui.b', function() {
-
- /**
- * Tool for taking time measurements in the TimelineTrackView using
- * Viewportmarkers.
- * @constructor
- */
- function TimingTool(viewport, targetElement) {
- this.viewport_ = viewport;
-
- // Prepare the event handlers to be added and removed repeatedly.
- this.onMouseMove_ = this.onMouseMove_.bind(this);
- this.onDblClick_ = this.onDblClick_.bind(this);
- this.targetElement_ = targetElement;
-
- // Valid only during mousedown.
- this.isMovingLeftEdge_ = false;
- };
-
- TimingTool.prototype = {
-
- onEnterTiming: function(e) {
- this.targetElement_.addEventListener('mousemove', this.onMouseMove_);
- this.targetElement_.addEventListener('dblclick', this.onDblClick_);
- },
-
- onBeginTiming: function(e) {
- if (!this.isTouchPointInsideTrackBounds_(e.clientX, e.clientY))
- return;
-
- var pt = this.getSnappedToEventPosition_(e);
- this.mouseDownAt_(pt.x, pt.y);
-
- this.updateSnapIndicators_(pt);
- },
-
- updateSnapIndicators_: function(pt) {
- if (!pt.snapped)
- return;
- var ir = this.viewport_.interestRange;
- if (ir.min === pt.x)
- ir.leftSnapIndicator = new tr.ui.SnapIndicator(pt.y, pt.height);
- if (ir.max === pt.x)
- ir.rightSnapIndicator = new tr.ui.SnapIndicator(pt.y, pt.height);
- },
-
- onUpdateTiming: function(e) {
- var pt = this.getSnappedToEventPosition_(e);
- this.mouseMoveAt_(pt.x, pt.y, true);
- this.updateSnapIndicators_(pt);
- },
-
- onEndTiming: function(e) {
- this.mouseUp_();
- },
-
- onExitTiming: function(e) {
- this.targetElement_.removeEventListener('mousemove', this.onMouseMove_);
- this.targetElement_.removeEventListener('dblclick', this.onDblClick_);
- },
-
- onMouseMove_: function(e) {
- if (e.button)
- return;
- var worldX = this.getWorldXFromEvent_(e);
- this.mouseMoveAt_(worldX, e.clientY, false);
- },
-
- onDblClick_: function(e) {
- // TODO(nduca): Implement dobuleclicking.
- console.error('not implemented');
- },
-
- ////////////////////////////////////////////////////////////////////////////
-
- isTouchPointInsideTrackBounds_: function(clientX, clientY) {
- if (!this.viewport_ ||
- !this.viewport_.modelTrackContainer ||
- !this.viewport_.modelTrackContainer.canvas)
- return false;
-
- var canvas = this.viewport_.modelTrackContainer.canvas;
- var canvasRect = canvas.getBoundingClientRect();
- if (clientX >= canvasRect.left && clientX <= canvasRect.right &&
- clientY >= canvasRect.top && clientY <= canvasRect.bottom)
- return true;
-
- return false;
- },
-
- mouseDownAt_: function(worldX, y) {
- var ir = this.viewport_.interestRange;
- var dt = this.viewport_.currentDisplayTransform;
-
- var pixelRatio = window.devicePixelRatio || 1;
- var nearnessThresholdWorld = dt.xViewVectorToWorld(6 * pixelRatio);
-
- if (ir.isEmpty) {
- ir.setMinAndMax(worldX, worldX);
- ir.rightSelected = true;
- this.isMovingLeftEdge_ = false;
- return;
- }
-
-
- // Left edge test.
- if (Math.abs(worldX - ir.min) < nearnessThresholdWorld) {
- ir.leftSelected = true;
- ir.min = worldX;
- this.isMovingLeftEdge_ = true;
- return;
- }
-
- // Right edge test.
- if (Math.abs(worldX - ir.max) < nearnessThresholdWorld) {
- ir.rightSelected = true;
- ir.max = worldX;
- this.isMovingLeftEdge_ = false;
- return;
- }
-
- ir.setMinAndMax(worldX, worldX);
- ir.rightSelected = true;
- this.isMovingLeftEdge_ = false;
- },
-
- mouseMoveAt_: function(worldX, y, mouseDown) {
- var ir = this.viewport_.interestRange;
-
- if (mouseDown) {
- this.updateMovingEdge_(worldX);
- return;
- }
-
- var ir = this.viewport_.interestRange;
- var dt = this.viewport_.currentDisplayTransform;
-
- var pixelRatio = window.devicePixelRatio || 1;
- var nearnessThresholdWorld = dt.xViewVectorToWorld(6 * pixelRatio);
-
- // Left edge test.
- if (Math.abs(worldX - ir.min) < nearnessThresholdWorld) {
- ir.leftSelected = true;
- ir.rightSelected = false;
- return;
- }
-
- // Right edge test.
- if (Math.abs(worldX - ir.max) < nearnessThresholdWorld) {
- ir.leftSelected = false;
- ir.rightSelected = true;
- return;
- }
-
- ir.leftSelected = false;
- ir.rightSelected = false;
- return;
- },
-
- updateMovingEdge_: function(newWorldX) {
- var ir = this.viewport_.interestRange;
- var a = ir.min;
- var b = ir.max;
- if (this.isMovingLeftEdge_)
- a = newWorldX;
- else
- b = newWorldX;
-
- if (a <= b)
- ir.setMinAndMax(a, b);
- else
- ir.setMinAndMax(b, a);
-
- if (ir.min == newWorldX) {
- this.isMovingLeftEdge_ = true;
- ir.leftSelected = true;
- ir.rightSelected = false;
- } else {
- this.isMovingLeftEdge_ = false;
- ir.leftSelected = false;
- ir.rightSelected = true;
- }
- },
-
- mouseUp_: function() {
- var dt = this.viewport_.currentDisplayTransform;
- var ir = this.viewport_.interestRange;
-
- ir.leftSelected = false;
- ir.rightSelected = false;
-
- var pixelRatio = window.devicePixelRatio || 1;
- var minWidthValue = dt.xViewVectorToWorld(2 * pixelRatio);
- if (ir.range < minWidthValue)
- ir.reset();
- },
-
- getWorldXFromEvent_: function(e) {
- var pixelRatio = window.devicePixelRatio || 1;
- var canvas = this.viewport_.modelTrackContainer.canvas;
- var worldOffset = canvas.getBoundingClientRect().left;
- var viewX = (e.clientX - worldOffset) * pixelRatio;
- return this.viewport_.currentDisplayTransform.xViewToWorld(viewX);
- },
-
-
- /**
- * Get the closest position of an event within a vertical range of the mouse
- * position if possible, otherwise use the position of the mouse pointer.
- * @param {MouseEvent} e Mouse event with the current mouse coordinates.
- * @return {
- * {Number} x, The x coordinate in world space.
- * {Number} y, The y coordinate in world space.
- * {Number} height, The height of the event.
- * {boolean} snapped Whether the coordinates are from a snapped event or
- * the mouse position.
- * }
- */
- getSnappedToEventPosition_: function(e) {
- var pixelRatio = window.devicePixelRatio || 1;
- var EVENT_SNAP_RANGE = 16 * pixelRatio;
-
- var modelTrackContainer = this.viewport_.modelTrackContainer;
- var modelTrackContainerRect = modelTrackContainer.getBoundingClientRect();
-
- var viewport = this.viewport_;
- var dt = viewport.currentDisplayTransform;
- var worldMaxDist = dt.xViewVectorToWorld(EVENT_SNAP_RANGE);
-
- var worldX = this.getWorldXFromEvent_(e);
- var mouseY = e.clientY;
-
- var selection = new tr.model.EventSet();
-
- // Look at the track under mouse position first for better performance.
- modelTrackContainer.addClosestEventToSelection(
- worldX, worldMaxDist, mouseY, mouseY, selection);
-
- // Look at all tracks visible on screen.
- if (!selection.length) {
- modelTrackContainer.addClosestEventToSelection(
- worldX, worldMaxDist,
- modelTrackContainerRect.top, modelTrackContainerRect.bottom,
- selection);
- }
-
- var minDistX = worldMaxDist;
- var minDistY = Infinity;
- var pixWidth = dt.xViewVectorToWorld(1);
-
- // Create result object with the mouse coordinates.
- var result = {
- x: worldX,
- y: mouseY - modelTrackContainerRect.top,
- height: 0,
- snapped: false
- };
-
- var eventBounds = new tr.b.Range();
- for (var event of selection) {
- var track = viewport.trackForEvent(event);
- var trackRect = track.getBoundingClientRect();
-
- eventBounds.reset();
- event.addBoundsToRange(eventBounds);
- var eventX;
- if (Math.abs(eventBounds.min - worldX) <
- Math.abs(eventBounds.max - worldX)) {
- eventX = eventBounds.min;
- } else {
- eventX = eventBounds.max;
- }
-
- var distX = eventX - worldX;
-
- var eventY = trackRect.top;
- var eventHeight = trackRect.height;
- var distY = Math.abs(eventY + eventHeight / 2 - mouseY);
-
- // Prefer events with a closer y position if their x difference is below
- // the width of a pixel.
- if ((distX <= minDistX || Math.abs(distX - minDistX) < pixWidth) &&
- distY < minDistY) {
- minDistX = distX;
- minDistY = distY;
-
- // Retrieve the event position from the hit.
- result.x = eventX;
- result.y = eventY +
- modelTrackContainer.scrollTop - modelTrackContainerRect.top;
- result.height = eventHeight;
- result.snapped = true;
- }
- }
-
- return result;
- }
- };
-
- return {
- TimingTool: TimingTool
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/timing_tool_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/timing_tool_test.html
deleted file mode 100644
index 91e630b945a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/timing_tool_test.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/timeline_viewport.html">
-<link rel="import" href="/tracing/ui/base/timing_tool.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function create100PxWideViewportInto10WideWorld() {
- var vp = new tr.ui.TimelineViewport(document.createElement('div'));
- var tempDisplayTransform = new tr.ui.TimelineDisplayTransform();
- tempDisplayTransform.xSetWorldBounds(0, 10, 100);
- vp.setDisplayTransformImmediately(tempDisplayTransform);
-
- assert.equal(vp.currentDisplayTransform.xViewToWorld(0), 0);
- assert.equal(vp.currentDisplayTransform.xViewToWorld(100), 10);
-
- return vp;
- }
-
- test('dragLeftInterestRegion', function() {
- var vp = create100PxWideViewportInto10WideWorld();
- vp.interestRange.min = 1;
- vp.interestRange.max = 9;
- var tool = new tr.ui.b.TimingTool(vp);
-
- tool.mouseDownAt_(1.1, 0);
- assert.isTrue(vp.interestRange.leftSelected);
- tool.mouseMoveAt_(1.5, 0, true);
- assert.equal(vp.interestRange.min, 1.5);
- tool.mouseUp_();
- assert.equal(vp.interestRange.min, 1.5);
- assert.isFalse(vp.interestRange.leftSelected);
- });
-
- test('dragRightInterestRegion', function() {
- var vp = create100PxWideViewportInto10WideWorld();
- vp.interestRange.min = 1;
- vp.interestRange.max = 9;
- var tool = new tr.ui.b.TimingTool(vp);
-
- tool.mouseDownAt_(9.1, 0);
- assert.isTrue(vp.interestRange.rightSelected);
- tool.mouseMoveAt_(8, 0, true);
- assert.equal(vp.interestRange.max, 8);
- tool.mouseUp_();
- assert.equal(vp.interestRange.max, 8);
- assert.isFalse(vp.interestRange.leftSelected);
- });
-
- test('dragInNewSpace', function() {
- var vp = create100PxWideViewportInto10WideWorld();
- vp.interestRange.min = 1;
- vp.interestRange.max = 9;
- var tool = new tr.ui.b.TimingTool(vp);
-
- tool.mouseDownAt_(5, 0);
- assert.isTrue(vp.interestRange.rightSelected);
- assert.equal(vp.interestRange.min, 5);
- assert.equal(vp.interestRange.max, 5);
- tool.mouseMoveAt_(4, 0, true);
- assert.equal(vp.interestRange.min, 4);
- assert.equal(vp.interestRange.max, 5);
- assert.isTrue(vp.interestRange.leftSelected);
- tool.mouseUp_();
- assert.equal(vp.interestRange.min, 4);
- assert.isFalse(vp.interestRange.leftSelected);
- assert.isFalse(vp.interestRange.rightSelected);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/tool_button.css b/chromium/third_party/catapult/tracing/tracing/ui/base/tool_button.css
deleted file mode 100644
index 1c5ae4170c0..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/tool_button.css
+++ /dev/null
@@ -1,17 +0,0 @@
-/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-* /deep/ .tool-button {
- background-position: center center;
- background-repeat: no-repeat;
- border-bottom: 1px solid #BCBCBC;
- border-top: 1px solid #F1F1F1;
- cursor: pointer;
- height: 30px;
-}
-
-* /deep/ .tool-button.active {
- cursor: auto;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/toolbar_button.html b/chromium/third_party/catapult/tracing/tracing/ui/base/toolbar_button.html
deleted file mode 100644
index 9d2405d8480..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/toolbar_button.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-</script>
-<polymer-element name='tr-ui-b-toolbar-button' noscript>
- <template>
- <style>
- :host {
- display: flex;
- background-color: #f8f8f8;
- border: 1px solid rgba(0, 0, 0, 0.5);
- color: rgba(0,0,0,0.8);
- justify-content: center;
- align-self: stretch;
- min-width: 23px;
- }
-
- :host(:hover) {
- background-color: rgba(255, 255, 255, 1.0);
- border-color: rgba(0, 0, 0, 0.8);
- box-shadow: 0 0 .05em rgba(0, 0, 0, 0.4);
- color: rgba(0, 0, 0, 1);
- }
-
- #aligner {
- display: flex;
- flex: 0 0 auto;
- align-self: center;
- }
- </style>
- <div id="aligner">
- <content></content>
- </div>
- </template>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/toolbar_button_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/toolbar_button_test.html
deleted file mode 100644
index 78f94081163..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/toolbar_button_test.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/ui/base/toolbar_button.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('tallWithTextContent', function() {
- var el = document.createElement('tr-ui-b-toolbar-button');
- el.style.width = '100px';
- el.style.height = '40px';
-
- el.textContent = 'blahblah';
-
- this.addHTMLOutput(el);
- });
-
- test('tallWithInnerSpan', function() {
- var el = document.createElement('tr-ui-b-toolbar-button');
- el.style.width = '100px';
- el.style.height = '40px';
-
- el.appendChild(tr.ui.b.createSpan({textContent: 'blahblah'}));
-
- this.addHTMLOutput(el);
- });
-
- test('puny', function() {
- var el = document.createElement('tr-ui-b-toolbar-button');
- el.textContent = 'M';
- this.addHTMLOutput(el);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/ui.html b/chromium/third_party/catapult/tracing/tracing/ui/base/ui.html
deleted file mode 100644
index 20c1bd4471d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/ui.html
+++ /dev/null
@@ -1,169 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
-
- /**
- * Decorates elements as an instance of a class.
- * @param {string|!Element} source The way to find the element(s) to decorate.
- * If this is a string then {@code querySeletorAll} is used to find the
- * elements to decorate.
- * @param {!Function} constr The constructor to decorate with. The constr
- * needs to have a {@code decorate} function.
- */
- function decorate(source, constr) {
- var elements;
- if (typeof source == 'string')
- elements = tr.doc.querySelectorAll(source);
- else
- elements = [source];
-
- for (var i = 0, el; el = elements[i]; i++) {
- if (!(el instanceof constr))
- constr.decorate(el);
- }
- }
-
- /**
- * Defines a tracing UI component, a function that can be called to construct
- * the component.
- *
- * tr class:
- * var List = tr.ui.b.define('list');
- * List.prototype = {
- * __proto__: HTMLUListElement.prototype,
- * decorate: function() {
- * ...
- * },
- * ...
- * };
- *
- * Derived class:
- * var CustomList = tr.ui.b.define('custom-list', List);
- * CustomList.prototype = {
- * __proto__: List.prototype,
- * decorate: function() {
- * ...
- * },
- * ...
- * };
- *
- * @param {string} className The className of the newly created subtype. If
- * subclassing by passing in opt_parentConstructor, this is used for
- * debugging. If not subclassing, then it is the tag name that will be
- * created by the component.
-
- * @param {function=} opt_parentConstructor The parent class for this new
- * element, if subclassing is desired. If provided, the parent class must
- * be also a function created by tr.ui.b.define.
- *
- * @param {string=} opt_tagNS The namespace in which to create the base
- * element. Has no meaning when opt_parentConstructor is passed and must
- * either be undefined or the same namespace as the parent class.
- *
- * @return {function(Object=):Element} The newly created component
- * constructor.
- */
- function define(className, opt_parentConstructor, opt_tagNS) {
- if (typeof className == 'function') {
- throw new Error('Passing functions as className is deprecated. Please ' +
- 'use (className, opt_parentConstructor) to subclass');
- }
-
- var className = className.toLowerCase();
- if (opt_parentConstructor && !opt_parentConstructor.tagName)
- throw new Error('opt_parentConstructor was not ' +
- 'created by tr.ui.b.define');
-
- // Walk up the parent constructors until we can find the type of tag
- // to create.
- var tagName = className;
- var tagNS = undefined;
- if (opt_parentConstructor) {
- if (opt_tagNS)
- throw new Error('Must not specify tagNS if parentConstructor is given');
- var parent = opt_parentConstructor;
- while (parent && parent.tagName) {
- tagName = parent.tagName;
- tagNS = parent.tagNS;
- parent = parent.parentConstructor;
- }
- } else {
- tagNS = opt_tagNS;
- }
-
- /**
- * Creates a new UI element constructor.
- * Arguments passed to the constuctor are provided to the decorate method.
- * You will need to call the parent elements decorate method from within
- * your decorate method and pass any required parameters.
- * @constructor
- */
- function f() {
- if (opt_parentConstructor &&
- f.prototype.__proto__ != opt_parentConstructor.prototype) {
- throw new Error(
- className + ' prototye\'s __proto__ field is messed up. ' +
- 'It MUST be the prototype of ' + opt_parentConstructor.tagName);
- }
-
- var el;
- if (tagNS === undefined)
- el = tr.doc.createElement(tagName);
- else
- el = tr.doc.createElementNS(tagNS, tagName);
- f.decorate.call(this, el, arguments);
- return el;
- }
-
- /**
- * Decorates an element as a UI element class.
- * @param {!Element} el The element to decorate.
- */
- f.decorate = function(el) {
- el.__proto__ = f.prototype;
- el.decorate.apply(el, arguments[1]);
- el.constructor = f;
- };
-
- f.className = className;
- f.tagName = tagName;
- f.tagNS = tagNS;
- f.parentConstructor = (opt_parentConstructor ? opt_parentConstructor :
- undefined);
- f.toString = function() {
- if (!f.parentConstructor)
- return f.tagName;
- return f.parentConstructor.toString() + '::' + f.className;
- };
-
- return f;
- }
-
- function elementIsChildOf(el, potentialParent) {
- if (el == potentialParent)
- return false;
-
- var cur = el;
- while (cur.parentNode) {
- if (cur == potentialParent)
- return true;
- cur = cur.parentNode;
- }
- return false;
- };
-
- return {
- decorate: decorate,
- define: define,
- elementIsChildOf: elementIsChildOf
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/ui_state.html b/chromium/third_party/catapult/tracing/tracing/ui/base/ui_state.html
deleted file mode 100644
index eb515ddf15c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/ui_state.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/location.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- var Location = tr.model.Location;
-
- /**
- * UIState is a class that represents the current state of the timeline by
- * the Location of the point of interest and the current scaleX of the
- * timeline.
- *
- * @constructor
- */
- function UIState(location, scaleX) {
- this.location_ = location;
- this.scaleX_ = scaleX;
- };
-
- /**
- * Accepts a UIState string in the format of (timestamp)@(stableID)x(scaleX)
- * Returns undefined if string is not in this format, or throws an Error if
- * variables in a syntactically-correct stateString does not produce a valid
- * UIState. Otherwise returns a constructed UIState instance.
- */
- UIState.fromUserFriendlyString = function(model, viewport, stateString) {
- var navByFinderPattern = /^(-?\d+(\.\d+)?)@(.+)x(\d+(\.\d+)?)$/g;
- var match = navByFinderPattern.exec(stateString);
- if (!match)
- return;
-
- var timestamp = parseFloat(match[1]);
- var stableId = match[3];
- var scaleX = parseFloat(match[4]);
-
- if (scaleX <= 0)
- throw new Error('Invalid ScaleX value in UI State string.');
-
- if (!viewport.containerToTrackMap.getTrackByStableId(stableId))
- throw new Error('Invalid StableID given in UI State String.');
-
- var loc = tr.model.Location.fromStableIdAndTimestamp(
- viewport, stableId, timestamp);
- return new UIState(loc, scaleX);
- }
-
- UIState.prototype = {
-
- get location() {
- return this.location_;
- },
-
- get scaleX() {
- return this.scaleX_;
- },
-
- toUserFriendlyString: function(viewport) {
- var timestamp = this.location_.xWorld;
- var stableId =
- this.location_.getContainingTrack(viewport).eventContainer.stableId;
- var scaleX = this.scaleX_;
- return timestamp.toFixed(5) + '@' + stableId + 'x' + scaleX.toFixed(5);
- },
-
- toDict: function() {
- return {
- location: this.location_.toDict(),
- scaleX: this.scaleX_
- };
- }
- };
-
- return {
- UIState: UIState
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/ui_state_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/ui_state_test.html
deleted file mode 100644
index 91ee74eda1a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/ui_state_test.html
+++ /dev/null
@@ -1,99 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/ui/tracks/track.html">
-<link rel="import" href="/tracing/ui/base/ui_state.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var UIState = tr.ui.b.UIState;
-
- function FakeModel() {
- this.processes = { 1: { threads: { 2: { stableId: '1.2' } } } };
- }
-
- // FakeTrack needs to be an instance of tr.ui.tracks.Track because a
- // location is constructed in terms of Track instances.
- function FakeTrack() { }
- FakeTrack.prototype = {
- __proto__: tr.ui.tracks.Track.prototype,
-
- get eventContainer() {
- return { stableId: '1.2' };
- },
-
- getBoundingClientRect: function() {
- return { top: 5, height: 2 };
- },
-
- get parentElement() {
- return null;
- }
- };
-
- function FakeViewPort() {
- this.containerToTrackMap = {
- // "1.2" is the only valid stableId this test function accepts.
- getTrackByStableId: function(stableId) {
- if (stableId === '1.2')
- return new FakeTrack;
- return undefined;
- }
- };
- }
-
- test('invalidStableId', function() {
- var model = new FakeModel;
- var vp = new FakeViewPort;
- assert.throws(function() {
- UIState.fromUserFriendlyString(model, vp, '15@1.3x6');
- });
- assert.throws(function() {
- UIState.fromUserFriendlyString(model, vp, '15@2.2x6');
- });
- assert.throws(function() {
- UIState.fromUserFriendlyString(model, vp, '505@1.x5');
- });
- });
-
- test('invalidScaleX', function() {
- var model = new FakeModel;
- var vp = new FakeViewPort;
- assert.isUndefined(UIState.fromUserFriendlyString(model, vp, '1@1.2x-1'));
- assert.throws(function() {
- UIState.fromUserFriendlyString(model, vp, '1@1.2x0');
- });
- });
-
- test('invalidSyntax', function() {
- var model = new FakeModel;
- var vp = new FakeViewPort;
- assert.isUndefined(UIState.fromUserFriendlyString(model, vp, '5'));
- assert.isUndefined(UIState.fromUserFriendlyString(model, vp, '5@x5'));
- assert.isUndefined(UIState.fromUserFriendlyString(model, vp, 'ab@1.2x5'));
- });
-
- test('validString', function() {
- var model = new FakeModel;
- var vp = new FakeViewPort;
- var str = '-50125.51231@1.2x1.12345';
- var uiState = UIState.fromUserFriendlyString(model, vp, str);
-
- assert.isDefined(uiState);
- assert.equal(uiState.location.xWorld, -50125.51231);
- assert.equal(
- uiState.location.getContainingTrack(vp).eventContainer.stableId,
- '1.2');
- assert.equal(uiState.scaleX, 1.12345);
-
- assert.equal(uiState.toUserFriendlyString(vp), str);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/ui_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/ui_test.html
deleted file mode 100644
index 9db0b9f396f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/ui_test.html
+++ /dev/null
@@ -1,245 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var TestElement = tr.ui.b.define('div');
- TestElement.prototype = {
- __proto__: HTMLDivElement.prototype,
-
- decorate: function() {
- if (!this.decorateCallCount)
- this.decorateCallCount = 0;
- this.decorateCallCount++;
- }
- };
-
- var Base = tr.ui.b.define('div');
- Base.prototype = {
- __proto__: HTMLDivElement.prototype,
- decorate: function() {
- this.decoratedAsBase = true;
- },
- set baseProperty(v) {
- this.basePropertySet = v;
- }
- };
-
- test('decorateOnceViaNew', function() {
- var testElement = new TestElement();
- assert.equal(testElement.decorateCallCount, 1);
- });
-
- test('decorateOnceDirectly', function() {
- var testElement = document.createElement('div');
- tr.ui.b.decorate(testElement, TestElement);
- assert.equal(testElement.decorateCallCount, 1);
- });
-
- test('componentToString', function() {
- assert.equal(Base.toString(), 'div');
-
- var Sub = tr.ui.b.define('Sub', Base);
- assert.equal(Sub.toString(), 'div::sub');
-
- var SubSub = tr.ui.b.define('Marine', Sub);
- assert.equal(SubSub.toString(), 'div::sub::marine');
- });
-
- test('basicDefines', function() {
- var baseInstance = new Base();
- assert.instanceOf(baseInstance, Base);
- assert.isTrue(baseInstance.decoratedAsBase);
-
- assert.equal(baseInstance.constructor, Base);
- assert.equal(baseInstance.constructor.toString(), 'div');
-
- baseInstance.basePropertySet = 7;
- assert.equal(baseInstance.basePropertySet, 7);
- });
-
- test('subclassing', function() {
- var Sub = tr.ui.b.define('sub', Base);
- Sub.prototype = {
- __proto__: Base.prototype,
- decorate: function() {
- this.decoratedAsSub = true;
- }
- };
-
- var subInstance = new Sub();
- assert.instanceOf(subInstance, Sub);
- assert.isTrue(subInstance.decoratedAsSub);
-
- assert.instanceOf(subInstance, Base);
- assert.isUndefined(subInstance.decoratedAsBase);
-
- assert.equal(subInstance.constructor, Sub);
- assert.equal(subInstance.constructor.toString(), 'div::sub');
-
- subInstance.baseProperty = true;
- assert.isTrue(subInstance.basePropertySet);
- });
-
- var NoArgs = tr.ui.b.define('div');
- NoArgs.prototype = {
- __proto__: HTMLDivElement.prototype,
- decorate: function() {
- this.noArgsDecorated_ = true;
- },
- get noArgsDecorated() {
- return this.noArgsDecorated_;
- }
- };
-
- var Args = tr.ui.b.define('args', NoArgs);
- Args.prototype = {
- __proto__: NoArgs.prototype,
- decorate: function(first) {
- this.first_ = first;
- this.argsDecorated_ = true;
- },
- get first() {
- return this.first_;
- },
- get argsDecorated() {
- return this.argsDecorated_;
- }
- };
-
- var ArgsChild = tr.ui.b.define('args-child', Args);
- ArgsChild.prototype = {
- __proto__: Args.prototype,
- decorate: function(_, second) {
- this.second_ = second;
- this.argsChildDecorated_ = true;
- },
- get second() {
- return this.second_;
- },
- get decorated() {
- return this.decorated_;
- },
- get argsChildDecorated() {
- return this.argsChildDecorated_ = true;
- }
- };
-
- var ArgsDecoratingChild = tr.ui.b.define('args-decorating-child', Args);
- ArgsDecoratingChild.prototype = {
- __proto__: Args.prototype,
- decorate: function(first, second) {
- Args.prototype.decorate.call(this, first);
- this.second_ = second;
- this.argsDecoratingChildDecorated_ = true;
- },
- get second() {
- return this.second_;
- },
- get decorated() {
- return this.decorated_;
- },
- get argsDecoratingChildDecorated() {
- return this.argsChildDecorated_ = true;
- }
- };
-
- test('decorate_noArguments', function() {
- var noArgs;
- assert.doesNotThrow(function() {
- noArgs = new NoArgs();
- });
- assert.isTrue(noArgs.noArgsDecorated);
- });
-
- test('decorate_arguments', function() {
- var args = new Args('this is first');
- assert.equal(args.first, 'this is first');
- assert.isTrue(args.argsDecorated);
- assert.isUndefined(args.noArgsDecorated);
- });
-
- test('decorate_subclassArguments', function() {
- var argsChild = new ArgsChild('this is first', 'and second');
- assert.isUndefined(argsChild.first);
- assert.equal(argsChild.second, 'and second');
-
- assert.isTrue(argsChild.argsChildDecorated);
- assert.isUndefined(argsChild.argsDecorated);
- assert.isUndefined(argsChild.noArgsDecorated);
- });
-
- test('decorate_subClassCallsParentDecorate', function() {
- var argsDecoratingChild = new ArgsDecoratingChild(
- 'this is first', 'and second');
- assert.equal(argsDecoratingChild.first, 'this is first');
- assert.equal(argsDecoratingChild.second, 'and second');
- assert.isTrue(argsDecoratingChild.argsDecoratingChildDecorated);
- assert.isTrue(argsDecoratingChild.argsDecorated);
- assert.isUndefined(argsDecoratingChild.noArgsDecorated);
- });
-
- test('defineWithNamespace', function() {
- var svgNS = 'http://www.w3.org/2000/svg';
- var cls = tr.ui.b.define('svg', undefined, svgNS);
- cls.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.setAttribute('width', 200);
- this.setAttribute('height', 200);
- this.setAttribute('viewPort', '0 0 200 200');
- var rectEl = document.createElementNS(svgNS, 'rect');
- rectEl.setAttribute('x', 10);
- rectEl.setAttribute('y', 10);
- rectEl.setAttribute('width', 180);
- rectEl.setAttribute('height', 180);
- this.appendChild(rectEl);
- }
- };
- var el = new cls();
- assert.equal(el.tagName, 'svg');
- assert.equal(el.namespaceURI, svgNS);
- this.addHTMLOutput(el);
- });
-
- test('defineSubclassWithNamespace', function() {
- var svgNS = 'http://www.w3.org/2000/svg';
- var cls = tr.ui.b.define('svg', undefined, svgNS);
- cls.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.setAttribute('width', 200);
- this.setAttribute('height', 200);
- this.setAttribute('viewPort', '0 0 200 200');
- var rectEl = document.createElementNS(svgNS, 'rect');
- rectEl.setAttribute('x', 10);
- rectEl.setAttribute('y', 10);
- rectEl.setAttribute('width', 180);
- rectEl.setAttribute('height', 180);
- this.appendChild(rectEl);
- }
- };
-
- var subCls = tr.ui.b.define('sub', cls);
- subCls.prototype = {
- __proto__: cls.prototype
- };
- assert.equal(subCls.toString(), 'svg::sub');
-
- var el = new subCls();
- this.addHTMLOutput(el);
- assert.equal(el.tagName, 'svg');
- assert.equal(el.namespaceURI, svgNS);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/utils.html b/chromium/third_party/catapult/tracing/tracing/ui/base/utils.html
deleted file mode 100644
index a205d1db1b7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/utils.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/rect.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- function instantiateTemplate(selector, doc) {
- doc = doc || document;
- var el = doc.querySelector(selector);
- if (!el)
- throw new Error('Element not found');
- return el.createInstance();
- }
-
- function windowRectForElement(element) {
- var position = [element.offsetLeft, element.offsetTop];
- var size = [element.offsetWidth, element.offsetHeight];
- var node = element.offsetParent;
- while (node) {
- position[0] += node.offsetLeft;
- position[1] += node.offsetTop;
- node = node.offsetParent;
- }
- return tr.b.Rect.fromXYWH(position[0], position[1], size[0], size[1]);
- }
-
- function scrollIntoViewIfNeeded(el) {
- var pr = el.parentElement.getBoundingClientRect();
- var cr = el.getBoundingClientRect();
- if (cr.top < pr.top) {
- el.scrollIntoView(true);
- } else if (cr.bottom > pr.bottom) {
- el.scrollIntoView(false);
- }
- }
-
- function extractUrlString(url) {
- var extracted = url.replace(/url\((.*)\)/, '$1');
-
- // In newer versions of chrome, the contents of url() will be quoted. Remove
- // these quotes as well. If quotes are not present, match will fail and this
- // becomes a no-op.
- extracted = extracted.replace(/\"(.*)\"/, '$1');
-
- return extracted;
- }
-
- function toThreeDigitLocaleString(value) {
- return value.toLocaleString(
- undefined, {minimumFractionDigits: 3, maximumFractionDigits: 3});
- }
-
- return {
- toThreeDigitLocaleString: toThreeDigitLocaleString,
- instantiateTemplate: instantiateTemplate,
- windowRectForElement: windowRectForElement,
- scrollIntoViewIfNeeded: scrollIntoViewIfNeeded,
- extractUrlString: extractUrlString
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/utils_test.html b/chromium/third_party/catapult/tracing/tracing/ui/base/utils_test.html
deleted file mode 100644
index 7e82132fe8d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/base/utils_test.html
+++ /dev/null
@@ -1,76 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/utils.html">
-
-<polymer-element name="instantiate-template-polymer-element-test">
- <template></template>
- <script>
- 'use strict';
- Polymer({
- testProperty: 'Test'
- });
- </script>
-</polymer-element>
-
-<template id="instantiate-template-polymer-test">
- <instantiate-template-polymer-element-test>
- </instantiate-template-polymer-element-test>
-</template>
-
-<template id="multiple-template-test">
- <template>
- <instantiate-template-polymer-element-test>
- </instantiate-template-polymer-element-test>
- <span test-attribute='TestAttribute'>Foo</span>
- </template>
- <instantiate-template-polymer-element-test>
- </instantiate-template-polymer-element-test>
-</template>
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var THIS_DOC = document._currentScript.ownerDocument;
-
- test('instantiateTemplatePolymer', function() {
- var e = tr.ui.b.instantiateTemplate(
- '#instantiate-template-polymer-test',
- THIS_DOC);
- assert.equal(e.children.length, 1);
- assert.equal(e.children[0].testProperty, 'Test');
- });
-
- test('instantiateTemplateMultipleTemplates', function() {
- var outerElement = tr.ui.b.instantiateTemplate(
- '#multiple-template-test',
- THIS_DOC);
- assert.equal(outerElement.children.length, 2);
- assert.equal(outerElement.children[1].testProperty, 'Test');
-
- // Make sure we can still instantiate inner templates, if we need them.
- var innerElement = outerElement.children[0].createInstance();
- assert.equal(innerElement.children.length, 2);
- assert.equal(innerElement.children[0].testProperty, 'Test');
- assert.equal(
- innerElement.children[1].getAttribute('test-attribute'),
- 'TestAttribute');
- assert.equal(innerElement.children[1].textContent, 'Foo');
- });
-
- test('extractUrlStringAcceptsBothVersions', function() {
- var oldStyleUrl = 'url(content)';
- var newStyleUrl = 'url("content")';
- var expectedResult = 'content';
-
- assert.equal(tr.ui.b.extractUrlString(oldStyleUrl), expectedResult);
- assert.equal(tr.ui.b.extractUrlString(newStyleUrl), expectedResult);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/brushing_state.html b/chromium/third_party/catapult/tracing/tracing/ui/brushing_state.html
deleted file mode 100644
index 9996e4db952..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/brushing_state.html
+++ /dev/null
@@ -1,218 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/selection_state.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.b', function() {
- var EventSet = tr.model.EventSet;
- var SelectionState = tr.model.SelectionState;
-
- function BrushingState() {
- this.guid_ = tr.b.GUID.allocateSimple();
- this.selection_ = new EventSet();
- this.findMatches_ = new EventSet();
- this.analysisViewRelatedEvents_ = new EventSet();
- this.analysisLinkHoveredEvents_ = new EventSet();
- this.appliedToModel_ = undefined;
- this.viewSpecificBrushingStates_ = {};
- }
- BrushingState.prototype = {
- get guid() {
- return this.guid_;
- },
-
- clone: function() {
- var that = new BrushingState();
- that.selection_ = this.selection_;
- that.findMatches_ = this.findMatches_;
- that.analysisViewRelatedEvents_ = this.analysisViewRelatedEvents_;
- that.analysisLinkHoveredEvents_ = this.analysisLinkHoveredEvents_;
- that.viewSpecificBrushingStates_ = this.viewSpecificBrushingStates_;
-
- return that;
- },
-
- equals: function(that) {
- if (!this.selection_.equals(that.selection_))
- return false;
- if (!this.findMatches_.equals(that.findMatches_))
- return false;
- if (!this.analysisViewRelatedEvents_.equals(
- that.analysisViewRelatedEvents_)) {
- return false;
- }
- if (!this.analysisLinkHoveredEvents_.equals(
- that.analysisLinkHoveredEvents_)) {
- return false;
- }
- // We currently do not take the view-specific brushing states into
- // account. If we did, every change of the view-specific brushing state
- // of any view would cause a redraw of the whole UI (see the
- // BrushingStateController.currentBrushingState setter).
- return true;
- },
-
- get selectionOfInterest() {
- if (this.selection_.length)
- return this.selection_;
-
- if (this.highlight_.length)
- return this.highlight_;
-
- if (this.analysisViewRelatedEvents_.length)
- return this.analysisViewRelatedEvents_;
-
- if (this.analysisLinkHoveredEvents_.length)
- return this.analysisLinkHoveredEvents_;
-
- return this.selection_;
- },
-
- get selection() {
- return this.selection_;
- },
-
- set selection(selection) {
- if (this.appliedToModel_)
- throw new Error('Cannot mutate this state right now');
- if (selection === undefined)
- selection = new EventSet();
- this.selection_ = selection;
- },
-
- get findMatches() {
- return this.findMatches_;
- },
-
- set findMatches(findMatches) {
- if (this.appliedToModel_)
- throw new Error('Cannot mutate this state right now');
- if (findMatches === undefined)
- findMatches = new EventSet();
- this.findMatches_ = findMatches;
- },
-
- get analysisViewRelatedEvents() {
- return this.analysisViewRelatedEvents_;
- },
-
- set analysisViewRelatedEvents(analysisViewRelatedEvents) {
- if (this.appliedToModel_)
- throw new Error('Cannot mutate this state right now');
- if (analysisViewRelatedEvents === undefined)
- analysisViewRelatedEvents = new EventSet();
- this.analysisViewRelatedEvents_ = analysisViewRelatedEvents;
- },
-
- get analysisLinkHoveredEvents() {
- return this.analysisLinkHoveredEvents_;
- },
-
- set analysisLinkHoveredEvents(analysisLinkHoveredEvents) {
- if (this.appliedToModel_)
- throw new Error('Cannot mutate this state right now');
- if (analysisLinkHoveredEvents === undefined)
- analysisLinkHoveredEvents = new EventSet();
- this.analysisLinkHoveredEvents_ = analysisLinkHoveredEvents;
- },
-
- get isAppliedToModel() {
- return this.appliedToModel_ !== undefined;
- },
-
- get viewSpecificBrushingStates() {
- return this.viewSpecificBrushingStates_;
- },
-
- set viewSpecificBrushingStates(viewSpecificBrushingStates) {
- this.viewSpecificBrushingStates_ = viewSpecificBrushingStates;
- },
-
- get causesDimming_() {
- return this.findMatches_.length > 0 ||
- this.analysisViewRelatedEvents_.length > 0;
- },
-
- get brightenedEvents_() {
- var brightenedEvents = new EventSet();
- brightenedEvents.addEventSet(this.selection_);
- brightenedEvents.addEventSet(this.analysisLinkHoveredEvents_);
- return brightenedEvents;
- },
-
- applyToModelSelectionState: function(model) {
- this.appliedToModel_ = model;
-
- if (!this.causesDimming_) {
- this.brightenedEvents_.forEach(function(e) {
- var score;
- score = 0;
- if (this.selection_.contains(e))
- score++;
- if (this.analysisLinkHoveredEvents_.contains(e))
- score++;
- e.selectionState = SelectionState.getFromBrighteningLevel(score);
- }, this);
- return;
- }
-
- var brightenedEvents = this.brightenedEvents_;
- for (var e of model.getDescendantEvents()) {
- var score;
- if (brightenedEvents.contains(e)) {
- score = 0;
- if (this.selection_.contains(e))
- score++;
- if (this.analysisLinkHoveredEvents_.contains(e))
- score++;
- e.selectionState = SelectionState.getFromBrighteningLevel(score);
- } else {
- score = 0;
- if (this.findMatches_.contains(e))
- score++;
- if (this.analysisViewRelatedEvents_.contains(e))
- score++;
- e.selectionState = SelectionState.getFromDimmingLevel(score);
- }
- }
- },
-
- transferModelOwnershipToClone: function(that) {
- if (!this.appliedToModel_)
- throw new Error('Not applied');
- // Assumes this.equals(that).
- that.appliedToModel_ = this.appliedToModel_;
- this.appliedToModel_ = undefined;
- },
-
- unapplyFromModelSelectionState: function() {
- if (!this.appliedToModel_)
- throw new Error('Not applied');
- var model = this.appliedToModel_;
- this.appliedToModel_ = undefined;
-
- if (!this.causesDimming_) {
- for (var e of this.brightenedEvents_)
- e.selectionState = SelectionState.NONE;
- return;
- }
-
- for (var e of model.getDescendantEvents())
- e.selectionState = SelectionState.NONE;
- }
- };
-
- return {
- BrushingState: BrushingState
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/brushing_state_controller.html b/chromium/third_party/catapult/tracing/tracing/ui/brushing_state_controller.html
deleted file mode 100644
index c3b9e83952b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/brushing_state_controller.html
+++ /dev/null
@@ -1,305 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/event_target.html">
-<link rel="import" href="/tracing/base/task.html">
-<link rel="import" href="/tracing/ui/brushing_state.html">
-<link rel="import" href="/tracing/ui/timeline_viewport.html">
-<link rel="import" href="/tracing/ui/base/ui_state.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/selection_state.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.c', function() {
- var BrushingState = tr.ui.b.BrushingState;
- var EventSet = tr.model.EventSet;
- var SelectionState = tr.model.SelectionState;
- var Viewport = tr.ui.TimelineViewport;
-
- function BrushingStateController(timelineView) {
- tr.b.EventTarget.call(this);
-
- this.timelineView_ = timelineView;
- this.currentBrushingState_ = new BrushingState();
-
- this.onPopState_ = this.onPopState_.bind(this);
- this.historyEnabled_ = false;
- this.selections_ = {};
- }
-
- BrushingStateController.prototype = {
- __proto__: tr.b.EventTarget.prototype,
-
- dispatchChangeEvent_: function() {
- var e = new tr.b.Event('change', false, false);
- this.dispatchEvent(e);
- },
-
- get model() {
- if (!this.timelineView_)
- return undefined;
- return this.timelineView_.model;
- },
-
- get trackView() {
- if (!this.timelineView_)
- return undefined;
- return this.timelineView_.trackView;
- },
-
- get viewport() {
- if (!this.timelineView_)
- return undefined;
- if (!this.timelineView_.trackView)
- return undefined;
- return this.timelineView_.trackView.viewport;
- },
-
- /* History system */
- get historyEnabled() {
- return this.historyEnabled_;
- },
-
- set historyEnabled(historyEnabled) {
- this.historyEnabled_ = !!historyEnabled;
- if (historyEnabled)
- window.addEventListener('popstate', this.onPopState_);
- else
- window.removeEventListener('popstate', this.onPopState_);
- },
-
- modelWillChange: function() {
- if (this.currentBrushingState_.isAppliedToModel)
- this.currentBrushingState_.unapplyFromModelSelectionState();
- },
-
- modelDidChange: function() {
- this.selections_ = {};
-
- this.currentBrushingState_ = new BrushingState();
- this.currentBrushingState_.applyToModelSelectionState(this.model);
-
- var e = new tr.b.Event('model-changed', false, false);
- this.dispatchEvent(e);
-
- this.dispatchChangeEvent_();
- },
-
- onUserInitiatedSelectionChange_: function() {
- var selection = this.selection;
- if (this.historyEnabled) {
- // Save the selection so that when back button is pressed,
- // it could be retrieved.
- this.selections_[selection.guid] = selection;
- var state = {
- selection_guid: selection.guid
- };
-
- window.history.pushState(state, document.title);
- }
- },
-
- onPopState_: function(e) {
- if (e.state === null)
- return;
-
- var selection = this.selections_[e.state.selection_guid];
- if (selection) {
- var newState = this.currentBrushingState_.clone();
- newState.selection = selection;
- this.currentBrushingState = newState;
- }
- e.stopPropagation();
- },
-
- get selection() {
- return this.currentBrushingState_.selection;
- },
- get findMatches() {
- return this.currentBrushingState_.findMatches;
- },
-
- get selectionOfInterest() {
- return this.currentBrushingState_.selectionOfInterest;
- },
-
- get currentBrushingState() {
- return this.currentBrushingState_;
- },
-
- set currentBrushingState(newBrushingState) {
- if (newBrushingState.isAppliedToModel)
- throw new Error('Cannot apply this state, it is applied');
-
- // This function uses value-equality on the states so that state can
- // changed to a clone of itself without causing a change event, while
- // still having the actual state object change to the new clone.
- var hasValueChanged = !this.currentBrushingState_.equals(
- newBrushingState);
-
- if (newBrushingState !== this.currentBrushingState_ && !hasValueChanged) {
- if (this.currentBrushingState_.isAppliedToModel) {
- this.currentBrushingState_.transferModelOwnershipToClone(
- newBrushingState);
- }
- this.currentBrushingState_ = newBrushingState;
- return;
- }
-
- if (this.currentBrushingState_.isAppliedToModel)
- this.currentBrushingState_.unapplyFromModelSelectionState();
-
- this.currentBrushingState_ = newBrushingState;
-
- if (this.model)
- this.currentBrushingState_.applyToModelSelectionState(this.model);
-
- this.dispatchChangeEvent_();
- },
-
- /**
- * @param {Filter} filter The filter to use for finding matches.
- * @param {Selection} selection The selection to add matches to.
- * @return {Task} which performs the filtering.
- */
- addAllEventsMatchingFilterToSelectionAsTask: function(filter, selection) {
- var timelineView = this.timelineView_.trackView;
- if (!timelineView)
- return new tr.b.Task();
- return timelineView.addAllEventsMatchingFilterToSelectionAsTask(
- filter, selection);
- },
-
- findTextChangedTo: function(allPossibleMatches) {
- var newBrushingState = this.currentBrushingState_.clone();
- newBrushingState.findMatches = allPossibleMatches;
- this.currentBrushingState = newBrushingState;
- },
-
- findFocusChangedTo: function(currentFocus) {
- var newBrushingState = this.currentBrushingState_.clone();
- newBrushingState.selection = currentFocus;
- this.currentBrushingState = newBrushingState;
-
- this.onUserInitiatedSelectionChange_();
- },
-
- findTextCleared: function() {
- if (this.xNavStringMarker_ !== undefined) {
- this.model.removeAnnotation(this.xNavStringMarker_);
- this.xNavStringMarker_ = undefined;
- }
-
- if (this.guideLineAnnotation_ !== undefined) {
- this.model.removeAnnotation(this.guideLineAnnotation_);
- this.guideLineAnnotation_ = undefined;
- }
-
- var newBrushingState = this.currentBrushingState_.clone();
- newBrushingState.selection = new EventSet();
- newBrushingState.findMatches = new EventSet();
- this.currentBrushingState = newBrushingState;
-
- this.onUserInitiatedSelectionChange_();
- },
-
- uiStateFromString: function(string) {
- return tr.ui.b.UIState.fromUserFriendlyString(
- this.model, this.viewport, string);
- },
-
- navToPosition: function(uiState, showNavLine) {
- this.trackView.navToPosition(uiState, showNavLine);
- },
-
- changeSelectionFromTimeline: function(selection) {
- var newBrushingState = this.currentBrushingState_.clone();
- newBrushingState.selection = selection;
- newBrushingState.findMatches = new EventSet();
- this.currentBrushingState = newBrushingState;
-
- this.onUserInitiatedSelectionChange_();
- },
-
- showScriptControlSelection: function(selection) {
- var newBrushingState = this.currentBrushingState_.clone();
- newBrushingState.selection = selection;
- newBrushingState.findMatches = new EventSet();
- this.currentBrushingState = newBrushingState;
- },
-
- changeSelectionFromRequestSelectionChangeEvent: function(selection) {
- var newBrushingState = this.currentBrushingState_.clone();
- newBrushingState.selection = selection;
- newBrushingState.findMatches = new EventSet();
- this.currentBrushingState = newBrushingState;
-
- this.onUserInitiatedSelectionChange_();
- },
-
- changeAnalysisViewRelatedEvents: function(eventSet) {
- var newBrushingState = this.currentBrushingState_.clone();
- newBrushingState.analysisViewRelatedEvents = eventSet;
- this.currentBrushingState = newBrushingState;
- },
-
- changeAnalysisLinkHoveredEvents: function(eventSet) {
- var newBrushingState = this.currentBrushingState_.clone();
- newBrushingState.analysisLinkHoveredEvents = eventSet;
- this.currentBrushingState = newBrushingState;
- },
-
- getViewSpecificBrushingState: function(viewId) {
- return this.currentBrushingState.viewSpecificBrushingStates[viewId];
- },
-
- changeViewSpecificBrushingState: function(viewId, newState) {
- var oldStates = this.currentBrushingState_.viewSpecificBrushingStates;
- var newStates = {};
- for (var id in oldStates)
- newStates[id] = oldStates[id];
- if (newState === undefined)
- delete newStates[viewId];
- else
- newStates[viewId] = newState;
-
- var newBrushingState = this.currentBrushingState_.clone();
- newBrushingState.viewSpecificBrushingStates = newStates;
- this.currentBrushingState = newBrushingState;
- }
- };
-
- BrushingStateController.getControllerForElement = function(element) {
- if (tr.isHeadless)
- throw new Error('Unsupported');
- var currentElement = element;
- while (currentElement) {
- if (currentElement.brushingStateController)
- return currentElement.brushingStateController;
-
- // Walk up the DOM.
- if (currentElement.parentElement) {
- currentElement = currentElement.parentElement;
- continue;
- }
-
- // Possibly inside a shadow DOM.
- var currentNode = currentElement;
- while (currentNode.parentNode)
- currentNode = currentNode.parentNode;
- currentElement = currentNode.host;
- }
- return undefined;
- };
-
- return {
- BrushingStateController: BrushingStateController
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/brushing_state_controller_test.html b/chromium/third_party/catapult/tracing/tracing/ui/brushing_state_controller_test.html
deleted file mode 100644
index 1f44f5962b6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/brushing_state_controller_test.html
+++ /dev/null
@@ -1,204 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/task.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/brushing_state_controller.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newSliceEx = tr.c.TestUtils.newSliceEx;
-
- var EventSet = tr.model.EventSet;
- var SelectionState = tr.model.SelectionState;
- var Task = tr.b.Task;
-
- function newSimpleFakeTimelineView() {
- var m = tr.c.TestUtils.newModel(function(m) {
- m.p1 = m.getOrCreateProcess(1);
- m.t2 = m.p1.getOrCreateThread(2);
-
- m.sA = m.t2.sliceGroup.pushSlice(
- newSliceEx({title: 'a', start: 0, end: 5}));
- m.sB = m.t2.sliceGroup.pushSlice(
- newSliceEx({title: 'b', start: 10, end: 15}));
- m.sC = m.t2.sliceGroup.pushSlice(
- newSliceEx({title: 'c', start: 20, end: 20}));
- });
-
- // Fake timeline view. So fake its ... just wow.
- var timelineView = {
- model: m
- };
- return timelineView;
- }
-
- function doesCauseChangeToFire(brushingStateController, cb, opt_this) {
- var didFire = false;
- function didFireCb() {
- didFire = true;
- };
- brushingStateController.addEventListener('change', didFireCb);
- cb.call(opt_this);
- brushingStateController.removeEventListener('change', didFireCb);
- return didFire;
- }
-
- test('simpleStateChanges', function() {
- var timelineView = newSimpleFakeTimelineView();
- var brushingStateController =
- new tr.c.BrushingStateController(timelineView);
- var m = timelineView.model;
-
- // Setting empty brushing state doesn't cause change event. This behavior
- // is triggered when the user tries to search for something when no trace
- // has been loaded yet in chrome://tracing.
- var bs0 = new tr.ui.b.BrushingState();
- assert.isFalse(doesCauseChangeToFire(
- brushingStateController,
- function() {
- brushingStateController.currentBrushingState = bs0;
- }));
- assert.isFalse(bs0.isAppliedToModel);
- assert.strictEqual(brushingStateController.currentBrushingState, bs0);
-
- // Setting causes change.
- var bs1 = new tr.ui.b.BrushingState();
- bs1.selection = new EventSet([m.sA]);
- assert.isTrue(doesCauseChangeToFire(
- brushingStateController,
- function() {
- brushingStateController.currentBrushingState = bs1;
- }));
- assert.isTrue(bs1.isAppliedToModel);
-
- // Setting value equivalent doesn't cause change event.
- var bs2 = bs1.clone();
- assert.isFalse(doesCauseChangeToFire(
- brushingStateController,
- function() {
- brushingStateController.currentBrushingState = bs2;
- }));
- assert.equal(brushingStateController.currentBrushingState, bs2);
- assert.isTrue(
- brushingStateController.currentBrushingState.isAppliedToModel);
-
- // Setting to something different unapplies the old bs.
- var bs3 = new tr.ui.b.BrushingState();
- bs3.findMatches = new EventSet([m.sA, m.sB]);
- brushingStateController.currentBrushingState = bs3;
- assert.isTrue(bs3.isAppliedToModel);
- assert.isFalse(bs2.isAppliedToModel);
- });
-
- test('modelCausesStateChange', function() {
- var timelineView = newSimpleFakeTimelineView();
- var brushingStateController =
- new tr.c.BrushingStateController(timelineView);
-
- var m1 = timelineView.model;
-
- var bs1 = new tr.ui.b.BrushingState();
- bs1.selection = new EventSet([m1.sA]);
-
- // Change the model.
- var m2 = tr.c.TestUtils.newModel(function(m) {
- m.p1 = m.getOrCreateProcess(1);
- m.t2 = m.p1.getOrCreateThread(2);
-
- m.sA = m.t2.sliceGroup.pushSlice(
- newSliceEx({title: 'a', start: 0, end: 5}));
- });
- assert.isTrue(doesCauseChangeToFire(
- brushingStateController,
- function() {
- brushingStateController.modelWillChange();
- timelineView.model = m2;
- brushingStateController.modelDidChange();
- }));
- assert.equal(
- brushingStateController.currentBrushingState.selection.length, 0);
- });
-
- function addChildDiv(element) {
- var child = element.ownerDocument.createElement('div');
- element.appendChild(child);
- return child;
- }
-
- function addShadowChildDiv(element) {
- var shadowRoot = element.createShadowRoot();
- return addChildDiv(shadowRoot);
- }
-
- if (!tr.isHeadless) {
- test('getControllerForElement_none', function() {
- var element = document.createElement('div');
-
- assert.isUndefined(
- tr.c.BrushingStateController.getControllerForElement(element));
- });
-
- test('getControllerForElement_self', function() {
- var controller = new tr.c.BrushingStateController(undefined);
- var element = document.createElement('div');
- element.brushingStateController = controller;
-
- assert.strictEqual(
- tr.c.BrushingStateController.getControllerForElement(element),
- controller);
- });
-
- test('getControllerForElement_ancestor', function() {
- var controller = new tr.c.BrushingStateController(undefined);
- var ancestor = document.createElement('div');
- ancestor.brushingStateController = controller;
-
- var element = addChildDiv(addChildDiv(addChildDiv(ancestor)));
- assert.strictEqual(
- tr.c.BrushingStateController.getControllerForElement(element),
- controller);
- });
-
- test('getControllerForElement_host', function() {
- var controller = new tr.c.BrushingStateController(undefined);
- var host = document.createElement('div');
- host.brushingStateController = controller;
-
- var element = addShadowChildDiv(host);
- assert.strictEqual(
- tr.c.BrushingStateController.getControllerForElement(element),
- controller);
- });
-
- test('getControllerForElement_hierarchy', function() {
- var controller1 = new tr.c.BrushingStateController(undefined);
- var root = document.createElement('div');
- root.brushingStateController = controller1;
-
- var controller2 = new tr.c.BrushingStateController(undefined);
- var child = addChildDiv(root);
- child.brushingStateController = controller2;
-
- var controller3 = new tr.c.BrushingStateController(undefined);
- var shadowChild = addShadowChildDiv(child);
- shadowChild.brushingStateController = controller3;
-
- var element = addChildDiv(addChildDiv(addShadowChildDiv(
- addChildDiv(addChildDiv(addShadowChildDiv(
- addChildDiv(shadowChild)))))));
- assert.strictEqual(
- tr.c.BrushingStateController.getControllerForElement(element),
- controller3);
- });
- }
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/brushing_state_test.html b/chromium/third_party/catapult/tracing/tracing/ui/brushing_state_test.html
deleted file mode 100644
index d0480738bd7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/brushing_state_test.html
+++ /dev/null
@@ -1,123 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/task.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/timeline_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var newSliceEx = tr.c.TestUtils.newSliceEx;
-
- var EventSet = tr.model.EventSet;
- var SelectionState = tr.model.SelectionState;
-
- function newSimpleModel() {
- return tr.c.TestUtils.newModel(function(m) {
- m.p1 = m.getOrCreateProcess(1);
- m.t2 = m.p1.getOrCreateThread(2);
-
- m.sA = m.t2.sliceGroup.pushSlice(
- newSliceEx({title: 'a', start: 0, end: 5}));
- m.sB = m.t2.sliceGroup.pushSlice(
- newSliceEx({title: 'b', start: 10, end: 15}));
- m.sC = m.t2.sliceGroup.pushSlice(
- newSliceEx({title: 'c', start: 20, end: 20}));
- });
- }
-
- test('brushingStateSimple', function() {
- var m = newSimpleModel();
-
- var bs = new tr.ui.b.BrushingState();
- bs.selection = new EventSet([m.sA]);
-
- bs.applyToModelSelectionState(m);
- assert.equal(m.sA.selectionState, SelectionState.SELECTED);
- bs.unapplyFromModelSelectionState();
- assert.equal(m.sA.selectionState, SelectionState.NONE);
- });
-
-
- test('selectionAndAnalysisHover', function() {
- var m = newSimpleModel();
-
- var bs = new tr.ui.b.BrushingState();
- bs.selection = new EventSet([m.sA]);
- bs.analysisLinkHoveredEvents = new EventSet([m.sA, m.sB]);
-
- bs.applyToModelSelectionState(m);
- assert.equal(m.sA.selectionState, SelectionState.BRIGHTENED1);
- assert.equal(m.sB.selectionState, SelectionState.BRIGHTENED0);
- bs.unapplyFromModelSelectionState();
- assert.equal(m.sA.selectionState, SelectionState.NONE);
- });
-
- test('brushingStateWithFindMatches', function() {
- var m = newSimpleModel();
-
- var bs = new tr.ui.b.BrushingState();
- bs.selection = new EventSet([m.sA]);
- bs.findMatches = new EventSet([m.sA, m.sB]);
-
- bs.applyToModelSelectionState(m);
- assert.equal(m.sA.selectionState, SelectionState.BRIGHTENED0);
- assert.equal(m.sB.selectionState, SelectionState.DIMMED1);
- assert.equal(m.sC.selectionState, SelectionState.DIMMED0);
- bs.unapplyFromModelSelectionState();
- assert.equal(m.sA.selectionState, SelectionState.NONE);
- assert.equal(m.sB.selectionState, SelectionState.NONE);
- assert.equal(m.sC.selectionState, SelectionState.NONE);
- });
-
- test('brushingTransfer', function() {
- var m = newSimpleModel();
-
- var bs = new tr.ui.b.BrushingState();
- bs.selection = new EventSet([m.sA]);
-
- var bs2 = bs.clone();
-
- bs.applyToModelSelectionState(m);
- assert.equal(m.sA.selectionState, SelectionState.SELECTED);
- bs.transferModelOwnershipToClone(bs2);
- assert.isFalse(bs.isAppliedToModel);
- assert.isTrue(bs2.isAppliedToModel);
-
- bs2.unapplyFromModelSelectionState();
- assert.equal(m.sA.selectionState, SelectionState.NONE);
- assert.equal(m.sB.selectionState, SelectionState.NONE);
- assert.equal(m.sC.selectionState, SelectionState.NONE);
- });
-
- test('equality', function() {
- var m = newSimpleModel();
-
- var bs = new tr.ui.b.BrushingState();
- bs.selection = new EventSet([m.sA]);
- bs.findMatches = new EventSet([m.sB]);
- bs.applyToModelSelectionState = new EventSet([m.sC]);
-
- // Clone equality, but with shared refs.
- var bs2 = bs.clone();
- assert.isTrue(bs.equals(bs2));
-
- // Same value, different refs.
- bs2.selection = new EventSet([m.sA]);
- assert.isTrue(bs.equals(bs2));
-
- // Different actual values.
- bs2.selection = new EventSet([m.sB]);
- assert.isFalse(bs.equals(bs2));
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/about_tracing.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/about_tracing.html
deleted file mode 100644
index 1df923b4d42..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/about_tracing.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="stylesheet" href="/tracing/ui/extras/about_tracing/common.css">
-<link rel="import" href="/tracing/ui/extras/about_tracing/profiling_view.html">
-<link rel="import" href="/tracing/ui/extras/full_config.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.about_tracing', function() {
- window.profilingView = undefined; // Made global for debugging purposes only.
-
- document.addEventListener('DOMContentLoaded', function() {
- window.profilingView = new tr.ui.e.about_tracing.ProfilingView();
- profilingView.timelineView.globalMode = true;
- document.body.appendChild(profilingView);
- });
-
- return {};
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/common.css b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/common.css
deleted file mode 100644
index 1ffb5f72e74..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/common.css
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-html,
-body {
- height: 100%;
-}
-
-body {
- -webkit-flex-direction: column;
- display: -webkit-flex;
- margin: 0;
- padding: 0;
-}
-
-body > x-profiling-view {
- -webkit-flex: 1 1 auto;
- min-height: 0;
-}
-
-body > x-profiling-view > x-timeline-view:focus {
- outline: 0
-}
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/inspector_connection.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/inspector_connection.html
deleted file mode 100644
index bc2ba6e472c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/inspector_connection.html
+++ /dev/null
@@ -1,125 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-
-'use strict';
-
-/**
- * Contains connection code that inspector's embedding framework calls on
- * tracing, and that tracing can use to talk to inspector.
- */
-tr.exportTo('tr.ui.e.about_tracing', function() {
- // Interface used by inspector when it hands data to us from the backend.
- window.DevToolsAPI = {
- setToolbarColors: function() { },
- addExtensions: function() { },
- setInspectedPageId: function() { },
-
- dispatchMessage: function(payload) {
- throw new Error('Should have been patched by InspectorConnection');
- }
- };
- // Temporary until inspector backend switches to DevToolsAPI.
- window.InspectorFrontendAPI = window.DevToolsAPI;
-
- /**
- * @constructor
- */
- function InspectorConnection() {
- if (InspectorConnection.instance)
- throw new Error('Singleton');
-
- this.nextRequestId_ = 1;
- this.pendingRequestResolversId_ = {};
-
- this.notificationListenersByMethodName_ = {};
- DevToolsAPI.dispatchMessage = this.dispatchMessage_.bind(this);
- }
-
- InspectorConnection.prototype = {
- req: function(method, params) {
- var id = this.nextRequestId_++;
- var msg = JSON.stringify({
- id: id,
- method: method,
- params: params
- });
- var devtoolsMessageStr = JSON.stringify(
- {'id': id, 'method': 'dispatchProtocolMessage', 'params': [msg]});
- DevToolsHost.sendMessageToEmbedder(devtoolsMessageStr);
-
- return new Promise(function(resolve, reject) {
- this.pendingRequestResolversId_[id] = {
- resolve: resolve,
- reject: reject
- };
- }.bind(this));
- },
-
- setNotificationListener: function(method, listener) {
- this.notificationListenersByMethodName_[method] = listener;
- },
-
- dispatchMessage_: function(payload) {
- var isStringPayload = typeof payload === 'string';
- // Special handling for Tracing.dataCollected because it is high
- // bandwidth.
- var isDataCollectedMessage = isStringPayload ?
- payload.indexOf('"method": "Tracing.dataCollected"') !== -1 :
- payload.method === 'Tracing.dataCollected';
- if (isDataCollectedMessage) {
- var listener = this.notificationListenersByMethodName_[
- 'Tracing.dataCollected'];
- if (listener) {
- // FIXME(loislo): trace viewer should be able to process
- // raw message object because string based version a few times
- // slower on the browser side.
- // see https://codereview.chromium.org/784513002.
- listener(isStringPayload ? payload : JSON.stringify(payload));
- return;
- }
- }
-
- var message = isStringPayload ? JSON.parse(payload) : payload;
- if (message.id) {
- var resolver = this.pendingRequestResolversId_[message.id];
- if (resolver === undefined) {
- console.log('Unrecognized ack', message);
- return;
- }
- if (message.error) {
- resolver.reject(message.error);
- return;
- }
- resolver.resolve(message.result);
- return;
- }
-
- if (message['method']) {
- var listener = this.notificationListenersByMethodName_[message.method];
- if (listener === undefined) {
- console.log('Unhandled ', message.method);
- return;
- }
- listener(message.params);
- return;
- }
- console.log('Unknown dispatchMessage: ', payload);
- }
- };
-
- if (window.DevToolsHost)
- InspectorConnection.instance = new InspectorConnection();
- else
- InspectorConnection.instance = undefined;
-
- return {
- InspectorConnection: InspectorConnection
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/inspector_tracing_controller_client.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/inspector_tracing_controller_client.html
deleted file mode 100644
index 86c3e596054..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/inspector_tracing_controller_client.html
+++ /dev/null
@@ -1,187 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import"
- href="/tracing/ui/extras/about_tracing/tracing_controller_client.html">
-<link rel="import" href="/tracing/ui/extras/about_tracing/inspector_connection.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.about_tracing', function() {
- function createResolvedPromise(data) {
- var promise = new Promise(function(resolve, reject) {
- if (data)
- resolve(data);
- else
- resolve();
- });
- return promise;
- }
-
- function appendTraceChunksTo(chunks, messageString) {
- if (typeof messageString !== 'string')
- throw new Error('Invalid data');
- var re = /"params":\s*\{\s*"value":\s*\[([^]+)\]\s*\}\s*\}/;
- var m = re.exec(messageString);
- if (!m)
- throw new Error('Malformed response');
-
- if (chunks.length > 1)
- chunks.push(',');
- chunks.push(m[1]);
- }
-
- /**
- * Controls tracing using the inspector's FrontendAgentHost APIs.
- *
- * @constructor
- */
- function InspectorTracingControllerClient() {
- this.recording_ = false;
- this.bufferUsage_ = 0;
- this.conn_ = tr.ui.e.about_tracing.InspectorConnection.instance;
- this.currentTraceTextChunks_ = undefined;
- }
-
- InspectorTracingControllerClient.prototype = {
- __proto__: tr.ui.e.about_tracing.TracingControllerClient.prototype,
-
- beginMonitoring: function(monitoringOptions) {
- throw new Error('Not implemented');
- },
-
- endMonitoring: function() {
- throw new Error('Not implemented');
- },
-
- captureMonitoring: function() {
- throw new Error('Not implemented');
- },
-
- getMonitoringStatus: function() {
- return createResolvedPromise({
- isMonitoring: false,
- categoryFilter: '',
- useSystemTracing: false,
- useContinuousTracing: false,
- useSampling: false
- });
- },
-
- getCategories: function() {
- var res = this.conn_.req('Tracing.getCategories', {});
- return res.then(function(result) {
- return result.categories;
- }, function(err) {
- return [];
- });
- },
-
- beginRecording: function(recordingOptions) {
- if (this.recording_)
- throw new Error('Already recording');
- this.recording_ = 'starting';
- var res = this.conn_.req(
- 'Tracing.start',
- {
- categories: recordingOptions.categoryFilter,
- options:
- [recordingOptions.tracingRecordMode,
- (recordingOptions.useSampling ? 'enable-sampling' : '')
- ].join(','),
- bufferUsageReportingInterval: 1000
- });
- res = res.then(
- function ok() {
- this.conn_.setNotificationListener(
- 'Tracing.bufferUsage',
- this.onBufferUsageUpdateFromInspector_.bind(this));
- this.recording_ = true;
- }.bind(this),
- function error() {
- this.recording_ = false;
- }.bind(this));
- return res;
- },
-
- onBufferUsageUpdateFromInspector_: function(params) {
- this.bufferUsage_ = params.value || params.percentFull;
- },
-
- beginGetBufferPercentFull: function() {
- var that = this;
- return new Promise(function(resolve, reject) {
- setTimeout(function() {
- resolve(that.bufferUsage_);
- }, 100);
- });
- },
-
- onDataCollected_: function(messageString) {
- appendTraceChunksTo(this.currentTraceTextChunks_, messageString);
- },
-
- endRecording: function() {
- if (this.recording_ === false)
- return createResolvedPromise();
-
- if (this.recording_ !== true)
- throw new Error('Cannot end');
-
- this.currentTraceTextChunks_ = ['['];
- this.conn_.setNotificationListener(
- 'Tracing.dataCollected', this.onDataCollected_.bind(this));
-
- var clearListeners = function() {
- this.conn_.setNotificationListener(
- 'Tracing.bufferUsage', undefined);
- this.conn_.setNotificationListener(
- 'Tracing.tracingComplete', undefined);
- this.conn_.setNotificationListener(
- 'Tracing.dataCollected', undefined);
- }.bind(this);
-
- this.recording_ = 'stopping';
- return new Promise(function(resolve, reject) {
- function tracingComplete() {
- clearListeners();
- this.recording_ = false;
- this.currentTraceTextChunks_.push(']');
- var traceText = this.currentTraceTextChunks_.join('');
- this.currentTraceTextChunks_ = undefined;
- resolve(traceText);
- }
-
- function tracingFailed(err) {
- clearListeners();
- this.recording_ = false;
- reject(err);
- }
-
- this.conn_.setNotificationListener(
- 'Tracing.tracingComplete', tracingComplete.bind(this));
- this.conn_.req('Tracing.end', {}).then(
- function end() {
- // Nothing happens here. We're really waiting for
- // Tracing.tracingComplete.
- }.bind(this),
- tracingFailed.bind(this));
- }.bind(this));
- },
-
- defaultTraceName: function() {
- return 'trace.json';
- }
- };
-
- return {
- InspectorTracingControllerClient: InspectorTracingControllerClient,
- appendTraceChunksTo: appendTraceChunksTo
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/inspector_tracing_controller_client_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/inspector_tracing_controller_client_test.html
deleted file mode 100644
index bbff78a9855..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/inspector_tracing_controller_client_test.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import"
- href="/tracing/ui/extras/about_tracing/inspector_tracing_controller_client.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('beginRecording_sendCategoriesAndOptions', function() {
- var controller =
- new tr.ui.e.about_tracing.InspectorTracingControllerClient();
- controller.conn_ = new (function() {
- this.req = function(method, params) {
- var msg = JSON.stringify({
- id: 1,
- method: method,
- params: params
- });
- return new (function() {
- this.msg = msg;
- this.then = function(m1, m2) {
- return this;
- };
- })();
- };
- this.setNotificationListener = function(method, listener) {
- };
- })();
-
- var recordingOptions = {
- categoryFilter: JSON.stringify(['a', 'b', 'c']),
- useSystemTracing: false,
- tracingRecordMode: 'test-mode',
- useSampling: true
- };
-
- var result = JSON.parse(controller.beginRecording(recordingOptions).msg);
- assert.equal(result.params.categories, JSON.stringify(['a', 'b', 'c']));
- var options = result.params.options.split(',');
- var tracingRecordTestMode = false;
- var sampleFlag = false;
- for (var s in options) {
- if (options[s] === 'test-mode') tracingRecordTestMode = true;
- else if (options[s] === 'enable-sampling') sampleFlag = true;
- else assert.equal(options[s], '');
- }
- assert.isTrue(tracingRecordTestMode);
- assert.isTrue(sampleFlag);
- });
-
- test('oldFormat', function() {
- var chunks = [];
- tr.ui.e.about_tracing.appendTraceChunksTo(chunks, '"{ "method": "Tracing.dataCollected", "params": { "value": [ {"cat":"__metadata","pid":28871,"tid":0,"ts":0,"ph":"M","name":"num_cpus","args":{"number":4}},{"cat":"__metadata","pid":28871,"tid":28911,"ts":0,"ph":"M","name":"process_sort_index","args":{"sort_index":-5}},{"cat":"__metadata","pid":28871,"tid":28911,"ts":0,"ph":"M","name":"process_name","args":{"name":"Renderer"}},{"cat":"__metadata","pid":28871,"tid":28911,"ts":0,"ph":"M","name":"process_labels","args":{"labels":"JS Bin"}},{"cat":"__metadata","pid":28871,"tid":28908,"ts":0,"ph":"M","name":"thread_sort_index","args":{"sort_index":-1}},{"cat":"__metadata","pid":28871,"tid":28917,"ts":0,"ph":"M","name":"thread_name","args":{"name":"Compositor"}},{"cat":"__metadata","pid":28871,"tid":28911,"ts":0,"ph":"M","name":"thread_name","args":{"name":"Chrome_ChildIOThread"}},{"cat":"__metadata","pid":28871,"tid":28919,"ts":0,"ph":"M","name":"thread_name","args":{"name":"CompositorRasterWorker1/28919"}},{"cat":"__metadata","pid":28871,"tid":28908,"ts":0,"ph":"M","name":"thread_name","args":{"name":"CrRendererMain"}},{"cat":"ipc,toplevel","pid":28871,"tid":28911,"ts":22000084746,"ph":"X","name":"ChannelReader::DispatchInputData","args":{"class":64,"line":25},"tdur":0,"tts":1853064},{"cat":"__metadata","pid":28871,"tid":28911,"ts":0,"ph":"M","name":"overhead","args":{"average_overhead":0.015}} ] } }"'); // @suppress longLineCheck
- assert.equal(chunks.length, 1);
- JSON.parse('[' + chunks.join('') + ']');
- });
-
- test('newFormat', function() {
- var chunks = [];
- tr.ui.e.about_tracing.appendTraceChunksTo(chunks, '"{ "method": "Tracing.dataCollected", "params": { "value": [{"cat":"__metadata","pid":28871,"tid":0,"ts":0,"ph":"M","name":"num_cpus","args":{"number":4}},{"cat":"__metadata","pid":28871,"tid":28911,"ts":0,"ph":"M","name":"process_sort_index","args":{"sort_index":-5}},{"cat":"__metadata","pid":28871,"tid":28911,"ts":0,"ph":"M","name":"process_name","args":{"name":"Renderer"}},{"cat":"__metadata","pid":28871,"tid":28911,"ts":0,"ph":"M","name":"process_labels","args":{"labels":"JS Bin"}},{"cat":"__metadata","pid":28871,"tid":28908,"ts":0,"ph":"M","name":"thread_sort_index","args":{"sort_index":-1}},{"cat":"__metadata","pid":28871,"tid":28917,"ts":0,"ph":"M","name":"thread_name","args":{"name":"Compositor"}},{"cat":"__metadata","pid":28871,"tid":28911,"ts":0,"ph":"M","name":"thread_name","args":{"name":"Chrome_ChildIOThread"}},{"cat":"__metadata","pid":28871,"tid":28919,"ts":0,"ph":"M","name":"thread_name","args":{"name":"CompositorRasterWorker1/28919"}},{"cat":"__metadata","pid":28871,"tid":28908,"ts":0,"ph":"M","name":"thread_name","args":{"name":"CrRendererMain"}},{"cat":"ipc,toplevel","pid":28871,"tid":28911,"ts":22000084746,"ph":"X","name":"ChannelReader::DispatchInputData","args":{"class":64,"line":25},"tdur":0,"tts":1853064},{"cat":"__metadata","pid":28871,"tid":28911,"ts":0,"ph":"M","name":"overhead","args":{"average_overhead":0.015}}] } }"'); // @suppress longLineCheck
- assert.equal(chunks.length, 1);
- JSON.parse('[' + chunks.join('') + ']');
- });
-
- test('stringAndObjectPayload', function() {
- var connection = new tr.ui.e.about_tracing.InspectorConnection();
- connection.setNotificationListener('Tracing.dataCollected',
- function(message) {
- assert.typeOf(message, 'string');
- JSON.parse(message);
- }
- );
- connection.dispatchMessage_('{ "method": "Tracing.dataCollected", "params": { "value": [] } }'); // @suppress longLineCheck
- connection.dispatchMessage_({'method': 'Tracing.dataCollected', 'params': {'value': [] } }); // @suppress longLineCheck
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/mock_tracing_controller_client.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/mock_tracing_controller_client.html
deleted file mode 100644
index a88122ff636..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/mock_tracing_controller_client.html
+++ /dev/null
@@ -1,86 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import"
- href="/tracing/ui/extras/about_tracing/tracing_controller_client.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.about_tracing', function() {
- function MockTracingControllerClient() {
- this.requests = [];
- this.nextRequestIndex = 0;
- this.allowLooping = false;
- }
-
- MockTracingControllerClient.prototype = {
- __proto__: tr.ui.e.about_tracing.TracingControllerClient.prototype,
-
- expectRequest: function(method, generateResponse) {
- var generateResponseCb;
- if (typeof generateResponse === 'function') {
- generateResponseCb = generateResponse;
- } else {
- generateResponseCb = function() {
- return generateResponse;
- };
- }
-
- this.requests.push({
- method: method,
- generateResponseCb: generateResponseCb});
- },
-
- _request: function(method, args) {
- return new Promise(function(resolve) {
- var requestIndex = this.nextRequestIndex;
- if (requestIndex >= this.requests.length)
- throw new Error('Unhandled request');
- if (!this.allowLooping) {
- this.nextRequestIndex++;
- } else {
- this.nextRequestIndex = (this.nextRequestIndex + 1) %
- this.requests.length;
- }
-
- var req = this.requests[requestIndex];
- assert.equal(method, req.method);
- var resp = req.generateResponseCb(args);
- resolve(resp);
- }.bind(this));
- },
-
- assertAllRequestsHandled: function() {
- if (this.allowLooping)
- throw new Error('Incompatible with allowLooping');
- assert.equal(this.requests.length, this.nextRequestIndex);
- },
-
- getCategories: function() {
- return this._request('getCategories');
- },
-
- beginRecording: function(recordingOptions) {
- return this._request('beginRecording', recordingOptions);
- },
-
- beginGetBufferPercentFull: function() {
- return this._request('beginGetBufferPercentFull');
- },
-
- endRecording: function() {
- return this._request('endRecording');
- }
- };
-
- return {
- MockTracingControllerClient: MockTracingControllerClient
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/profiling_view.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/profiling_view.html
deleted file mode 100644
index accff574c54..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/profiling_view.html
+++ /dev/null
@@ -1,369 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base64.html">
-<link rel="import" href="/tracing/importer/import.html">
-<link rel="import" href="/tracing/ui/base/file.html">
-<link rel="import" href="/tracing/ui/base/hotkey_controller.html">
-<link rel="import" href="/tracing/ui/base/info_bar_group.html">
-<link rel="import" href="/tracing/ui/base/overlay.html">
-<link rel="import" href="/tracing/ui/base/utils.html">
-<link rel="import"
- href="/tracing/ui/extras/about_tracing/inspector_tracing_controller_client.html">
-<link rel="import"
- href="/tracing/ui/extras/about_tracing/record_controller.html">
-<link rel="import"
- href="/tracing/ui/extras/about_tracing/xhr_based_tracing_controller_client.html">
-<link rel="import" href="/tracing/ui/timeline_view.html">
-
-<style>
-x-profiling-view {
- -webkit-flex-direction: column;
- display: -webkit-flex;
- padding: 0;
-}
-
-x-profiling-view .controls #save-button {
- margin-left: 64px !important;
-}
-
-x-profiling-view > tr-ui-timeline-view {
- -webkit-flex: 1 1 auto;
- min-height: 0;
-}
-
-.report-id-message {
- -webkit-user-select: text;
-}
-
-x-timeline-view-buttons {
- display: flex;
- align-items: center;
-}
-</style>
-
-<template id="profiling-view-template">
- <tr-ui-b-info-bar-group></tr-ui-b-info-bar-group>
- <x-timeline-view-buttons>
- <button id="record-button">Record</button>
- <button id="save-button">Save</button>
- <button id="load-button">Load</button>
- </x-timeline-view-buttons>
- <tr-ui-timeline-view>
- <track-view-container id='track_view_container'></track-view-container>
- </tr-ui-timeline-view>
-</template>
-
-<script>
-'use strict';
-
-/**
- * @fileoverview ProfilingView glues the View control to
- * TracingController.
- */
-tr.exportTo('tr.ui.e.about_tracing', function() {
- /**
- * ProfilingView
- * @constructor
- * @extends {HTMLUnknownElement}
- */
- var ProfilingView = tr.ui.b.define('x-profiling-view');
- var THIS_DOC = document.currentScript.ownerDocument;
-
- ProfilingView.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function(tracingControllerClient) {
- this.appendChild(tr.ui.b.instantiateTemplate('#profiling-view-template',
- THIS_DOC));
-
- this.timelineView_ = this.querySelector('tr-ui-timeline-view');
- this.infoBarGroup_ = this.querySelector('tr-ui-b-info-bar-group');
-
- // Detach the buttons. We will reattach them to the timeline view.
- // TODO(nduca): Make timeline-view have a content select="x-buttons"
- // that pulls in any buttons.
- this.recordButton_ = this.querySelector('#record-button');
- this.loadButton_ = this.querySelector('#load-button');
- this.saveButton_ = this.querySelector('#save-button');
-
- var buttons = this.querySelector('x-timeline-view-buttons');
- buttons.parentElement.removeChild(buttons);
- this.timelineView_.leftControls.appendChild(buttons);
- this.initButtons_();
-
- this.timelineView_.hotkeyController.addHotKey(new tr.ui.b.HotKey({
- eventType: 'keypress',
- keyCode: 'r'.charCodeAt(0),
- callback: function(e) {
- this.beginRecording();
- event.stopPropagation();
- },
- thisArg: this
- }));
-
- this.initDragAndDrop_();
-
- if (tracingControllerClient) {
- this.tracingControllerClient_ = tracingControllerClient;
- } else if (window.DevToolsHost !== undefined) {
- this.tracingControllerClient_ =
- new tr.ui.e.about_tracing.InspectorTracingControllerClient();
- } else {
- this.tracingControllerClient_ =
- new tr.ui.e.about_tracing.XhrBasedTracingControllerClient();
- }
-
- this.isRecording_ = false;
- this.activeTrace_ = undefined;
-
- this.updateTracingControllerSpecificState_();
- },
-
- // Detach all document event listeners. Without this the tests can get
- // confused as the element may still be listening when the next test runs.
- detach_: function() {
- this.detachDragAndDrop_();
- },
-
- get isRecording() {
- return this.isRecording_;
- },
-
- set tracingControllerClient(tracingControllerClient) {
- this.tracingControllerClient_ = tracingControllerClient;
- this.updateTracingControllerSpecificState_();
- },
-
- updateTracingControllerSpecificState_: function() {
- var isInspector = this.tracingControllerClient_ instanceof
- tr.ui.e.about_tracing.InspectorTracingControllerClient;
-
- if (isInspector) {
- this.infoBarGroup_.addMessage(
- 'This about:tracing is connected to a remote device...',
- [{buttonText: 'Wow!', onClick: function() {}}]);
- }
- },
-
- beginRecording: function() {
- if (this.isRecording_)
- throw new Error('Already recording');
- this.isRecording_ = true;
- var resultPromise = tr.ui.e.about_tracing.beginRecording(
- this.tracingControllerClient_);
- resultPromise.then(
- function(data) {
- this.isRecording_ = false;
- var traceName = tr.ui.e.about_tracing.defaultTraceName(
- this.tracingControllerClient_);
- this.setActiveTrace(traceName, data, false);
- }.bind(this),
- function(err) {
- this.isRecording_ = false;
- if (err instanceof tr.ui.e.about_tracing.UserCancelledError)
- return;
- tr.ui.b.Overlay.showError('Error while recording', err);
- }.bind(this));
- return resultPromise;
- },
-
- get timelineView() {
- return this.timelineView_;
- },
-
- ///////////////////////////////////////////////////////////////////////////
-
- clearActiveTrace: function() {
- this.saveButton_.disabled = true;
- this.activeTrace_ = undefined;
- },
-
- setActiveTrace: function(filename, data) {
- this.activeTrace_ = {
- filename: filename,
- data: data
- };
-
- this.infoBarGroup_.clearMessages();
- this.updateTracingControllerSpecificState_();
- this.saveButton_.disabled = false;
- this.timelineView_.viewTitle = filename;
-
- var m = new tr.Model();
- var i = new tr.importer.Import(m);
- var p = i.importTracesWithProgressDialog([data]);
- p.then(
- function() {
- this.timelineView_.model = m;
- this.timelineView_.updateDocumentFavicon();
- }.bind(this),
- function(err) {
- tr.ui.b.Overlay.showError('While importing: ', err);
- }.bind(this));
- },
-
- ///////////////////////////////////////////////////////////////////////////
-
- initButtons_: function() {
- this.recordButton_.addEventListener(
- 'click', function(event) {
- event.stopPropagation();
- this.beginRecording();
- }.bind(this));
-
- this.loadButton_.addEventListener(
- 'click', function(event) {
- event.stopPropagation();
- this.onLoadClicked_();
- }.bind(this));
-
- this.saveButton_.addEventListener('click',
- this.onSaveClicked_.bind(this));
- this.saveButton_.disabled = true;
- },
-
- requestFilename_: function() {
-
- // unsafe filename patterns:
- var illegalRe = /[\/\?<>\\:\*\|":]/g;
- var controlRe = /[\x00-\x1f\x80-\x9f]/g;
- var reservedRe = /^\.+$/;
-
- var filename;
- var defaultName = this.activeTrace_.filename;
- var fileExtension = '.json';
- var fileRegex = /\.json$/;
- if (/[.]gz$/.test(defaultName)) {
- fileExtension += '.gz';
- fileRegex = /\.json\.gz$/;
- } else if (/[.]zip$/.test(defaultName)) {
- fileExtension = '.zip';
- fileRegex = /\.zip$/;
- }
-
- var custom = prompt('Filename? (' + fileExtension +
- ' appended) Or leave blank:');
- if (custom === null)
- return undefined;
-
- var name;
- if (custom) {
- name = ' ' + custom;
- } else {
- var date = new Date();
- var dateText = ' ' + date.toDateString() +
- ' ' + date.toLocaleTimeString();
- name = dateText;
- }
-
- filename = defaultName.replace(fileRegex, name) + fileExtension;
-
- return filename
- .replace(illegalRe, '.')
- .replace(controlRe, '\u2022')
- .replace(reservedRe, '')
- .replace(/\s+/g, '_');
- },
-
- onSaveClicked_: function() {
- // Create a blob URL from the binary array.
- var blob = new Blob([this.activeTrace_.data],
- {type: 'application/octet-binary'});
- var blobUrl = window.webkitURL.createObjectURL(blob);
-
- // Create a link and click on it. BEST API EVAR!
- var link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
- link.href = blobUrl;
- var filename = this.requestFilename_();
- if (filename) {
- link.download = filename;
- link.click();
- }
- },
-
- onLoadClicked_: function() {
- var inputElement = document.createElement('input');
- inputElement.type = 'file';
- inputElement.multiple = false;
-
- var changeFired = false;
- inputElement.addEventListener(
- 'change',
- function(e) {
- if (changeFired)
- return;
- changeFired = true;
-
- var file = inputElement.files[0];
- tr.ui.b.readFile(file).then(
- function(data) {
- this.setActiveTrace(file.name, data);
- }.bind(this),
- function(err) {
- tr.ui.b.Overlay.showError('Error while loading file: ' + err);
- });
- }.bind(this), false);
- inputElement.click();
- },
-
- ///////////////////////////////////////////////////////////////////////////
-
- initDragAndDrop_: function() {
- this.dropHandler_ = this.dropHandler_.bind(this);
- this.ignoreDragEvent_ = this.ignoreDragEvent_.bind(this);
- document.addEventListener('dragstart', this.ignoreDragEvent_, false);
- document.addEventListener('dragend', this.ignoreDragEvent_, false);
- document.addEventListener('dragenter', this.ignoreDragEvent_, false);
- document.addEventListener('dragleave', this.ignoreDragEvent_, false);
- document.addEventListener('dragover', this.ignoreDragEvent_, false);
- document.addEventListener('drop', this.dropHandler_, false);
- },
-
- detachDragAndDrop_: function() {
- document.removeEventListener('dragstart', this.ignoreDragEvent_);
- document.removeEventListener('dragend', this.ignoreDragEvent_);
- document.removeEventListener('dragenter', this.ignoreDragEvent_);
- document.removeEventListener('dragleave', this.ignoreDragEvent_);
- document.removeEventListener('dragover', this.ignoreDragEvent_);
- document.removeEventListener('drop', this.dropHandler_);
- },
-
- ignoreDragEvent_: function(e) {
- e.preventDefault();
- return false;
- },
-
- dropHandler_: function(e) {
- if (this.isAnyDialogUp_)
- return;
-
- e.stopPropagation();
- e.preventDefault();
-
- var files = e.dataTransfer.files;
- if (files.length !== 1) {
- tr.ui.b.Overlay.showError('1 file supported at a time.');
- return;
- }
-
- tr.ui.b.readFile(files[0]).then(
- function(data) {
- this.setActiveTrace(files[0].name, data);
- }.bind(this),
- function(err) {
- tr.ui.b.Overlay.showError('Error while loading file: ' + err);
- });
- return false;
- }
- };
-
- return {
- ProfilingView: ProfilingView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/profiling_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/profiling_view_test.html
deleted file mode 100644
index 457d074fe24..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/profiling_view_test.html
+++ /dev/null
@@ -1,84 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/base64.html">
-<link rel="import"
- href="/tracing/ui/extras/about_tracing/mock_tracing_controller_client.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/ui/extras/about_tracing/profiling_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Base64 = tr.b.Base64;
- var testData = [
- {name: 'a', args: {}, pid: 52, ts: 15000, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 19000, cat: 'foo', tid: 53, ph: 'E'},
- {name: 'b', args: {}, pid: 52, ts: 32000, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'b', args: {}, pid: 52, ts: 54000, cat: 'foo', tid: 53, ph: 'E'}
- ];
-
- var monitoringOptions = {
- isMonitoring: false,
- categoryFilter: '*',
- useSystemTracing: false,
- useContinuousTracing: false,
- useSampling: false
- };
-
- var ProfilingView = tr.ui.e.about_tracing.ProfilingView;
-
- test('recording', function() {
- var mock = new tr.ui.e.about_tracing.MockTracingControllerClient();
- mock.allowLooping = true;
- mock.expectRequest('endRecording', function() {
- return '';
- });
- mock.expectRequest('getCategories', function() {
- return ['a', 'b', 'c'];
- });
- mock.expectRequest('beginRecording', function(data) {
- return '';
- });
- mock.expectRequest('endRecording', function(data) {
- return JSON.stringify(testData);
- });
-
- var view = new ProfilingView(mock);
- view.style.height = '400px';
- view.style.border = '1px solid black';
- this.addHTMLOutput(view);
-
- return new Promise(function(resolve, reject) {
- var recordingPromise = view.beginRecording();
-
- var didAbort = false;
- function pressRecord() {
- if (didAbort)
- return;
- recordingPromise.selectionDlg.clickRecordButton();
- setTimeout(pressStop, 60);
- }
- function pressStop() {
- recordingPromise.progressDlg.clickStopButton();
- }
- setTimeout(pressRecord, 60);
- recordingPromise.then(
- function() {
- resolve();
- },
- function(err) {
- didAbort = true;
- reject(err);
- });
- });
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_controller.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_controller.html
deleted file mode 100644
index 2284b0fa3e7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_controller.html
+++ /dev/null
@@ -1,181 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/extras/about_tracing/record_selection_dialog.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.about_tracing', function() {
- function beginRecording(tracingControllerClient) {
- var finalPromiseResolver;
- var finalPromise = new Promise(function(resolve, reject) {
- finalPromiseResolver = {
- resolve: resolve,
- reject: reject
- };
- });
- finalPromise.selectionDlg = undefined;
- finalPromise.progressDlg = undefined;
-
- function beginRecordingError(err) {
- finalPromiseResolver.reject(err);
- }
-
- // Step 0: End recording. This is necessary when the user reloads the
- // about:tracing page when we are recording. Window.onbeforeunload is not
- // reliable to end recording on reload.
- endRecording(tracingControllerClient).then(
- getCategories,
- getCategories); // Ignore error.
-
- // But just in case, bind onbeforeunload anyway.
- window.onbeforeunload = function(e) {
- endRecording(tracingControllerClient);
- };
-
- // Step 1: Get categories.
- function getCategories() {
- var p = tracingControllerClient.getCategories().then(
- showTracingDialog,
- beginRecordingError);
- p.catch(function(err) {
- beginRecordingError(err);
- });
- }
-
- // Step 2: Show tracing dialog.
- var selectionDlg;
- function showTracingDialog(categories) {
- selectionDlg = new tr.ui.e.about_tracing.RecordSelectionDialog();
- selectionDlg.categories = categories;
- selectionDlg.settings_key =
- 'tr.ui.e.about_tracing.record_selection_dialog';
- selectionDlg.addEventListener('recordclick', startTracing);
- selectionDlg.addEventListener('closeclick', cancelRecording);
- selectionDlg.visible = true;
-
- finalPromise.selectionDlg = selectionDlg;
- }
-
- function cancelRecording() {
- finalPromise.selectionDlg = undefined;
- finalPromiseResolver.reject(new UserCancelledError());
- }
-
- // Step 2: Do the actual tracing dialog.
- var progressDlg;
- var bufferPercentFullDiv;
- function startTracing() {
- progressDlg = new tr.ui.b.Overlay();
- progressDlg.textContent = 'Recording...';
- progressDlg.userCanClose = false;
-
- bufferPercentFullDiv = document.createElement('div');
- progressDlg.appendChild(bufferPercentFullDiv);
-
- var stopButton = document.createElement('button');
- stopButton.textContent = 'Stop';
- progressDlg.clickStopButton = function() {
- stopButton.click();
- };
- progressDlg.appendChild(stopButton);
-
- var recordingOptions = {
- categoryFilter: selectionDlg.categoryFilter(),
- useSystemTracing: selectionDlg.useSystemTracing,
- tracingRecordMode: selectionDlg.tracingRecordMode,
- useSampling: selectionDlg.useSampling
- };
-
-
- var requestPromise = tracingControllerClient.beginRecording(
- recordingOptions);
- requestPromise.then(
- function() {
- progressDlg.visible = true;
- stopButton.focus();
- updateBufferPercentFull('0');
- },
- recordFailed);
-
- stopButton.addEventListener('click', function() {
- // TODO(chrishenry): Currently, this only dismiss the progress
- // dialog when tracingComplete event is received. When performing
- // remote debugging, the tracingComplete event may be delayed
- // considerable. We should indicate to user that we are waiting
- // for tracingComplete event instead of being unresponsive. (For
- // now, I disable the "stop" button, since clicking on the button
- // again now cause exception.)
- var recordingPromise = endRecording(tracingControllerClient);
- recordingPromise.then(
- recordFinished,
- recordFailed);
- stopButton.disabled = true;
- bufferPercentFullDiv = undefined;
- });
- finalPromise.progressDlg = progressDlg;
- }
-
- function recordFinished(tracedData) {
- progressDlg.visible = false;
- finalPromise.progressDlg = undefined;
- finalPromiseResolver.resolve(tracedData);
- }
-
- function recordFailed(err) {
- progressDlg.visible = false;
- finalPromise.progressDlg = undefined;
- finalPromiseResolver.reject(err);
- }
-
- function getBufferPercentFull() {
- if (!bufferPercentFullDiv)
- return;
-
- tracingControllerClient.beginGetBufferPercentFull().then(
- updateBufferPercentFull);
- }
-
- function updateBufferPercentFull(percent_full) {
- if (!bufferPercentFullDiv)
- return;
-
- percent_full = Math.round(100 * parseFloat(percent_full));
- var newText = 'Buffer usage: ' + percent_full + '%';
- if (bufferPercentFullDiv.textContent != newText)
- bufferPercentFullDiv.textContent = newText;
-
- window.setTimeout(getBufferPercentFull, 500);
- }
-
- // Thats it! We're done.
- return finalPromise;
- };
-
- function endRecording(tracingControllerClient) {
- return tracingControllerClient.endRecording();
- }
-
- function defaultTraceName(tracingControllerClient) {
- return tracingControllerClient.defaultTraceName();
- }
-
- function UserCancelledError() {
- Error.apply(this, arguments);
- }
- UserCancelledError.prototype = {
- __proto__: Error.prototype
- };
-
- return {
- beginRecording: beginRecording,
- UserCancelledError: UserCancelledError,
- defaultTraceName: defaultTraceName
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_controller_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_controller_test.html
deleted file mode 100644
index 69c9cc8173d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_controller_test.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import"
- href="/tracing/ui/extras/about_tracing/mock_tracing_controller_client.html">
-<link rel="import"
- href="/tracing/ui/extras/about_tracing/record_controller.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var testData = [
- {name: 'a', args: {}, pid: 52, ts: 15000, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'a', args: {}, pid: 52, ts: 19000, cat: 'foo', tid: 53, ph: 'E'},
- {name: 'b', args: {}, pid: 52, ts: 32000, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'b', args: {}, pid: 52, ts: 54000, cat: 'foo', tid: 53, ph: 'E'}
- ];
-
- test('fullRecording', function() {
- return new Promise(function(resolve, reject) {
- var mock = new tr.ui.e.about_tracing.MockTracingControllerClient();
- mock.expectRequest('endRecording', function() {
- return '';
- });
- mock.expectRequest('getCategories', function() {
- setTimeout(function() {
- recordingPromise.selectionDlg.clickRecordButton();
- }, 20);
- return ['a', 'b', 'c'];
- });
- mock.expectRequest('beginRecording', function(recordingOptions) {
- assert.typeOf(recordingOptions.categoryFilter, 'string');
- assert.typeOf(recordingOptions.useSystemTracing, 'boolean');
- assert.typeOf(recordingOptions.useSampling, 'boolean');
- assert.typeOf(recordingOptions.tracingRecordMode, 'string');
- setTimeout(function() {
- recordingPromise.progressDlg.clickStopButton();
- }, 10);
- return '';
- });
- mock.expectRequest('endRecording', function(data) {
- return JSON.stringify(testData);
- });
-
- var recordingPromise = tr.ui.e.about_tracing.beginRecording(mock);
-
- return recordingPromise.then(
- function(data) {
- mock.assertAllRequestsHandled();
- var testDataString = JSON.stringify(testData);
- assert.equal(data, testDataString);
- resolve();
- },
- function(error) {
- reject('This should never be reached');
- });
- });
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_selection_dialog.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_selection_dialog.html
deleted file mode 100644
index 79ce154dba8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_selection_dialog.html
+++ /dev/null
@@ -1,672 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/core/filter.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/info_bar_group.html">
-<link rel="import" href="/tracing/ui/base/overlay.html">
-<link rel="import" href="/tracing/ui/base/utils.html">
-
-<template id="record-selection-dialog-template">
- <style>
- .categories-column-view {
- display: -webkit-flex;
- -webkit-flex-direction: column;
- font-family: sans-serif;
- max-width: 640px;
- min-height: 0;
- min-width: 0;
- opacity: 1;
- transition: max-height 1s ease, max-width 1s ease, opacity 1s ease;
- will-change: opacity;
- }
-
- .categories-column-view-hidden {
- max-height: 0;
- max-width: 0;
- opacity: 0;
- overflow: hidden;
- }
-
- .categories-selection {
- display: -webkit-flex;
- -webkit-flex-direction: row;
- }
-
- .category-presets {
- padding: 4px;
- }
-
- .category-description {
- color: #aaa;
- font-size: small;
- max-height: 1em;
- opacity: 1;
- padding-left: 4px;
- padding-right: 4px;
- text-align: right;
- transition: max-height 1s ease, opacity 1s ease;
- will-change: opacity;
- }
-
- .category-description-hidden {
- max-height: 0;
- opacity: 0;
- }
-
- .default-enabled-categories,
- .default-disabled-categories {
- -webkit-flex: 1 1 auto;
- display: -webkit-flex;
- -webkit-flex-direction: column;
- padding: 4px;
- width: 300px;
- }
-
- .default-enabled-categories > div,
- .default-disabled-categories > div {
- padding: 4px;
- }
-
- .tracing-modes {
- -webkit-flex: 1 0 auto;
- display: -webkit-flex;
- -webkit-flex-direction: reverse;
- padding: 4px;
- border-bottom: 2px solid #ddd;
- border-top: 2px solid #ddd;
- }
-
- .default-disabled-categories {
- border-left: 2px solid #ddd;
- }
-
- .warning-default-disabled-categories {
- display: inline-block;
- font-weight: bold;
- text-align: center;
- color: #BD2E2E;
- width: 2.0ex;
- height: 2.0ex;
- border-radius: 2.0ex;
- border: 1px solid #BD2E2E;
- }
-
- .categories {
- font-size: 80%;
- padding: 10px;
- -webkit-flex: 1 1 auto;
- }
-
- .group-selectors {
- font-size: 80%;
- border-bottom: 1px solid #ddd;
- padding-bottom: 6px;
- -webkit-flex: 0 0 auto;
- }
-
- .group-selectors button {
- padding: 1px;
- }
-
- .record-selection-dialog .labeled-option-group {
- -webkit-flex: 0 0 auto;
- -webkit-flex-direction: column;
- display: -webkit-flex;
- }
-
- .record-selection-dialog .labeled-option {
- border-top: 5px solid white;
- border-bottom: 5px solid white;
- }
-
- .record-selection-dialog .edit-categories {
- padding-left: 6px;
- }
-
- .record-selection-dialog .edit-categories:after {
- padding-left: 15px;
- font-size: 125%;
- }
-
- .record-selection-dialog .labeled-option-group:not(.categories-expanded)
- .edit-categories:after {
- content: '\25B8'; /* Right triangle */
- }
-
- .record-selection-dialog .labeled-option-group.categories-expanded
- .edit-categories:after {
- content: '\25BE'; /* Down triangle */
- }
-
- </style>
-
- <div class="record-selection-dialog">
- <tr-ui-b-info-bar-group></tr-ui-b-info-bar-group>
- <div class="category-presets">
- </div>
- <div class="category-description"></div>
- <div class="categories-column-view">
- <div class="tracing-modes"></div>
- <div class="categories-selection">
- <div class="default-enabled-categories">
- <div>Record&nbsp;Categories</div>
- <div class="group-selectors">
- Select
- <button class="all-btn">All</button>
- <button class="none-btn">None</button>
- </div>
- <div class="categories"></div>
- </div>
- <div class="default-disabled-categories">
- <div>Disabled&nbsp;by&nbsp;Default&nbsp;Categories
- <a class="warning-default-disabled-categories">!</a>
- </div>
- <div class="group-selectors">
- Select
- <button class="all-btn">All</button>
- <button class="none-btn">None</button>
- </div>
- <div class="categories"></div>
- </div>
- </div>
- </div>
- </div>
-</template>
-
-<script>
-'use strict';
-
-/**
- * @fileoverview RecordSelectionDialog presents the available categories
- * to be enabled/disabled during tr.c.
- */
-tr.exportTo('tr.ui.e.about_tracing', function() {
- var THIS_DOC = document.currentScript.ownerDocument;
- var RecordSelectionDialog = tr.ui.b.define('div');
-
- var DEFAULT_PRESETS = [
- {title: 'Web developer',
- categoryFilter: ['blink', 'cc', 'netlog', 'renderer.scheduler',
- 'toplevel', 'v8']},
- {title: 'Input latency',
- categoryFilter: ['benchmark', 'input', 'evdev', 'renderer.scheduler',
- 'toplevel']},
- {title: 'Rendering',
- categoryFilter: ['blink', 'cc', 'gpu', 'toplevel']},
- {title: 'Javascript and rendering',
- categoryFilter: ['blink', 'cc', 'gpu', 'renderer.scheduler', 'v8',
- 'toplevel']},
- {title: 'Frame Viewer',
- categoryFilter: ['blink', 'cc', 'gpu', 'renderer.scheduler', 'v8',
- 'toplevel',
- 'disabled-by-default-cc.debug',
- 'disabled-by-default-cc.debug.picture',
- 'disabled-by-default-cc.debug.display_items']},
- {title: 'Manually select settings',
- categoryFilter: []}
- ];
- var RECORDING_MODES = [
- {'label': 'Record until full',
- 'value': 'record-until-full'},
- {'label': 'Record continuously',
- 'value': 'record-continuously'},
- {'label': 'Record as much as possible',
- 'value': 'record-as-much-as-possible'}];
- var DEFAULT_RECORD_MODE = 'record-until-full';
- var DEFAULT_CONTINUOUS_TRACING = true;
- var DEFAULT_SYSTEM_TRACING = true;
- var DEFAULT_SAMPLING_TRACING = false;
-
- RecordSelectionDialog.prototype = {
- __proto__: tr.ui.b.Overlay.prototype,
-
- decorate: function() {
- tr.ui.b.Overlay.prototype.decorate.call(this);
- this.title = 'Record a new trace...';
-
- this.classList.add('record-dialog-overlay');
-
- var node =
- tr.ui.b.instantiateTemplate('#record-selection-dialog-template',
- THIS_DOC);
- this.appendChild(node);
-
- this.recordButtonEl_ = document.createElement('button');
- this.recordButtonEl_.textContent = 'Record';
- this.recordButtonEl_.addEventListener(
- 'click',
- this.onRecordButtonClicked_.bind(this));
- this.recordButtonEl_.style.fontSize = '110%';
- this.buttons.appendChild(this.recordButtonEl_);
-
- this.categoriesView_ = this.querySelector('.categories-column-view');
- this.presetsEl_ = this.querySelector('.category-presets');
- this.presetsEl_.appendChild(tr.ui.b.createOptionGroup(
- this, 'currentlyChosenPreset',
- 'about_tracing.record_selection_dialog_preset',
- DEFAULT_PRESETS[0].categoryFilter,
- DEFAULT_PRESETS.map(function(p) {
- return { label: p.title, value: p.categoryFilter };
- })));
-
- this.tracingRecordModeSltr_ = tr.ui.b.createSelector(
- this, 'tracingRecordMode',
- 'recordSelectionDialog.tracingRecordMode',
- DEFAULT_RECORD_MODE, RECORDING_MODES);
-
- this.systemTracingBn_ = tr.ui.b.createCheckBox(
- undefined, undefined,
- 'recordSelectionDialog.useSystemTracing', DEFAULT_SYSTEM_TRACING,
- 'System tracing');
- this.samplingTracingBn_ = tr.ui.b.createCheckBox(
- undefined, undefined,
- 'recordSelectionDialog.useSampling', DEFAULT_SAMPLING_TRACING,
- 'State sampling');
- this.tracingModesContainerEl_ = this.querySelector('.tracing-modes');
- this.tracingModesContainerEl_.appendChild(this.tracingRecordModeSltr_);
- this.tracingModesContainerEl_.appendChild(this.systemTracingBn_);
- this.tracingModesContainerEl_.appendChild(this.samplingTracingBn_);
-
-
- this.enabledCategoriesContainerEl_ =
- this.querySelector('.default-enabled-categories .categories');
-
- this.disabledCategoriesContainerEl_ =
- this.querySelector('.default-disabled-categories .categories');
-
- this.createGroupSelectButtons_(
- this.querySelector('.default-enabled-categories'));
- this.createGroupSelectButtons_(
- this.querySelector('.default-disabled-categories'));
- this.createDefaultDisabledWarningDialog_(
- this.querySelector('.warning-default-disabled-categories'));
- this.editCategoriesOpened_ = false;
-
- // TODO(chrishenry): When used with tr.ui.b.Overlay (such as in
- // chrome://tracing, this does not yet look quite right due to
- // the 10px overlay content padding (but it's good enough).
- this.infoBarGroup_ = this.querySelector('tr-ui-b-info-bar-group');
-
- this.addEventListener('visible-change', this.onVisibleChange_.bind(this));
- },
-
- set supportsSystemTracing(s) {
- if (s) {
- this.systemTracingBn_.style.display = undefined;
- } else {
- this.systemTracingBn_.style.display = 'none';
- this.useSystemTracing = false;
- }
- },
-
- get tracingRecordMode() {
- return this.tracingRecordModeSltr_.selectedValue;
- },
- set tracingRecordMode(value) {
- this.tracingRecordMode_ = value;
- },
-
- get useSystemTracing() {
- return this.systemTracingBn_.checked;
- },
- set useSystemTracing(value) {
- this.systemTracingBn_.checked = !!value;
- },
-
- get useSampling() {
- return this.samplingTracingBn_.checked;
- },
- set useSampling(value) {
- this.samplingTracingBn_.checked = !!value;
- },
-
- set categories(c) {
- if (!(c instanceof Array))
- throw new Error('categories must be an array');
- this.categories_ = c;
-
- for (var i = 0; i < this.categories_.length; i++) {
- var split = this.categories_[i].split(',');
- this.categories_[i] = split.shift();
- if (split.length > 0)
- this.categories_ = this.categories_.concat(split);
- }
- },
-
- set settings_key(k) {
- this.settings_key_ = k;
- },
-
- set settings(s) {
- throw new Error('Dont use this!');
- },
-
- usingPreset_: function() {
- return this.currentlyChosenPreset_.length > 0;
- },
-
- get currentlyChosenPreset() {
- return this.currentlyChosenPreset_;
- },
-
- set currentlyChosenPreset(preset) {
- if (!(preset instanceof Array))
- throw new Error('RecordSelectionDialog.currentlyChosenPreset:' +
- ' preset must be an array.');
- this.currentlyChosenPreset_ = preset;
-
- if (this.usingPreset_()) {
- this.changeEditCategoriesState_(false);
- } else {
- this.updateCategoryColumnView_(true);
- this.changeEditCategoriesState_(true);
- }
- this.updateManualSelectionView_();
- this.updatePresetDescription_();
- },
-
- updateManualSelectionView_: function() {
- var classList = this.categoriesView_.classList;
- if (!this.usingPreset_()) {
- classList.remove('categories-column-view-hidden');
- } else {
- if (this.editCategoriesOpened_)
- classList.remove('categories-column-view-hidden');
- else
- classList.add('categories-column-view-hidden');
- }
- },
-
- updateCategoryColumnView_: function(shouldReadFromSettings) {
- var categorySet = this.querySelectorAll('.categories');
- for (var i = 0; i < categorySet.length; ++i) {
- var categoryGroup = categorySet[i].children;
- for (var j = 0; j < categoryGroup.length; ++j) {
- var categoryEl = categoryGroup[j].children[0];
- categoryEl.checked = shouldReadFromSettings ?
- tr.b.Settings.get(categoryEl.value, false, this.settings_key_) :
- false;
- }
- }
- },
-
- onClickEditCategories: function() {
- if (!this.usingPreset_())
- return;
-
- if (!this.editCategoriesOpened_) {
- this.updateCategoryColumnView_(false);
- for (var i = 0; i < this.currentlyChosenPreset_.length; ++i) {
- var categoryEl = this.querySelector('#' +
- this.currentlyChosenPreset_[i]);
- if (!categoryEl)
- continue;
- categoryEl.checked = true;
- }
- }
-
- this.changeEditCategoriesState_(!this.editCategoriesOpened_);
- this.updateManualSelectionView_();
- this.recordButtonEl_.focus();
- },
-
- changeEditCategoriesState_: function(editCategoriesState) {
- var presetOptionsGroup = this.querySelector('.labeled-option-group');
- if (!presetOptionsGroup)
- return;
-
- this.editCategoriesOpened_ = editCategoriesState;
- if (this.editCategoriesOpened_)
- presetOptionsGroup.classList.add('categories-expanded');
- else
- presetOptionsGroup.classList.remove('categories-expanded');
- },
-
- updatePresetDescription_: function() {
- var description = this.querySelector('.category-description');
- if (this.usingPreset_()) {
- description.innerText = this.currentlyChosenPreset_;
- description.classList.remove('category-description-hidden');
- } else {
- description.innerText = '';
- if (!description.classList.contains('category-description-hidden'))
- description.classList.add('category-description-hidden');
- }
- },
-
- categoryFilter: function() {
- if (this.usingPreset_()) {
- var categories = [];
- var allCategories = this.allCategories_();
- for (var category in allCategories) {
- var disabled = category.indexOf('disabled-by-default-') == 0;
- if (this.currentlyChosenPreset_.indexOf(category) >= 0) {
- if (disabled)
- categories.push(category);
- } else {
- if (!disabled)
- categories.push('-' + category);
- }
- }
- return categories.join(',');
- }
-
- var categories = this.unselectedCategories_();
- var categories_length = categories.length;
- var negated_categories = [];
- for (var i = 0; i < categories_length; ++i) {
- // Skip any category with a , as it will cause issues when we negate.
- // Both sides should have been added as separate categories, these can
- // only come from settings.
- if (categories[i].match(/,/))
- continue;
- negated_categories.push('-' + categories[i]);
- }
- categories = negated_categories.join(',');
-
- var disabledCategories = this.enabledDisabledByDefaultCategories_();
- disabledCategories = disabledCategories.join(',');
-
- var results = [];
- if (categories !== '')
- results.push(categories);
- if (disabledCategories !== '')
- results.push(disabledCategories);
- return results.join(',');
- },
-
- clickRecordButton: function() {
- this.recordButtonEl_.click();
- },
-
- onRecordButtonClicked_: function() {
- this.visible = false;
- tr.b.dispatchSimpleEvent(this, 'recordclick');
- return false;
- },
-
- collectInputs_: function(inputs, isChecked) {
- var inputs_length = inputs.length;
- var categories = [];
- for (var i = 0; i < inputs_length; ++i) {
- var input = inputs[i];
- if (input.checked === isChecked)
- categories.push(input.value);
- }
- return categories;
- },
-
- unselectedCategories_: function() {
- var inputs =
- this.enabledCategoriesContainerEl_.querySelectorAll('input');
- return this.collectInputs_(inputs, false);
- },
-
- enabledDisabledByDefaultCategories_: function() {
- var inputs =
- this.disabledCategoriesContainerEl_.querySelectorAll('input');
- return this.collectInputs_(inputs, true);
- },
-
- onVisibleChange_: function() {
- if (this.visible)
- this.updateForm_();
- },
-
- buildInputs_: function(inputs, checkedDefault, parent) {
- var inputs_length = inputs.length;
- for (var i = 0; i < inputs_length; i++) {
- var category = inputs[i];
-
- var inputEl = document.createElement('input');
- inputEl.type = 'checkbox';
- inputEl.id = category;
- inputEl.value = category;
-
- inputEl.checked = tr.b.Settings.get(
- category, checkedDefault, this.settings_key_);
- inputEl.onclick = this.updateSetting_.bind(this);
-
- var labelEl = document.createElement('label');
- labelEl.textContent = category.replace('disabled-by-default-', '');
- labelEl.setAttribute('for', category);
-
- var divEl = document.createElement('div');
- divEl.appendChild(inputEl);
- divEl.appendChild(labelEl);
-
- parent.appendChild(divEl);
- }
- },
-
- allCategories_: function() {
- // Dedup the categories. We may have things in settings that are also
- // returned when we query the category list.
- var categorySet = {};
- var allCategories =
- this.categories_.concat(tr.b.Settings.keys(this.settings_key_));
- var allCategoriesLength = allCategories.length;
- for (var i = 0; i < allCategoriesLength; ++i)
- categorySet[allCategories[i]] = true;
- return categorySet;
- },
-
- updateForm_: function() {
- function ignoreCaseCompare(a, b) {
- return a.toLowerCase().localeCompare(b.toLowerCase());
- }
-
- this.enabledCategoriesContainerEl_.innerHTML = ''; // Clear old categories
- this.disabledCategoriesContainerEl_.innerHTML = '';
-
- this.recordButtonEl_.focus();
-
- var allCategories = this.allCategories_();
- var categories = [];
- var disabledCategories = [];
- for (var category in allCategories) {
- if (category.indexOf('disabled-by-default-') == 0)
- disabledCategories.push(category);
- else
- categories.push(category);
- }
- disabledCategories = disabledCategories.sort(ignoreCaseCompare);
- categories = categories.sort(ignoreCaseCompare);
-
- if (this.categories_.length == 0) {
- this.infoBarGroup_.addMessage(
- 'No categories found; recording will use default categories.');
- }
-
- this.buildInputs_(categories, true, this.enabledCategoriesContainerEl_);
-
- if (disabledCategories.length > 0) {
- this.disabledCategoriesContainerEl_.hidden = false;
- this.buildInputs_(disabledCategories, false,
- this.disabledCategoriesContainerEl_);
- }
- },
-
- updateSetting_: function(e) {
- var checkbox = e.target;
- tr.b.Settings.set(checkbox.value, checkbox.checked, this.settings_key_);
-
- // Change the current record mode to 'Manually select settings' from
- // preset mode if and only if currently user is in preset record mode
- // and user selects/deselects any category in 'Edit Categories' mode.
- if (this.usingPreset_()) {
- this.currentlyChosenPreset_ = [] /* manually select settings */;
- var categoryEl = this.querySelector(
- '#category-preset-Manually-select-settings');
- categoryEl.checked = true;
- var description = this.querySelector('.category-description');
- description.innerText = '';
- description.classList.add('category-description-hidden');
- }
- },
-
- createGroupSelectButtons_: function(parent) {
- var flipInputs = function(dir) {
- var inputs = parent.querySelectorAll('input');
- for (var i = 0; i < inputs.length; i++) {
- if (inputs[i].checked === dir)
- continue;
- // click() is used so the settings will be correclty stored. Setting
- // checked does not trigger the onclick (or onchange) callback.
- inputs[i].click();
- }
- };
-
- var allBtn = parent.querySelector('.all-btn');
- allBtn.onclick = function(evt) {
- flipInputs(true);
- evt.preventDefault();
- };
-
- var noneBtn = parent.querySelector('.none-btn');
- noneBtn.onclick = function(evt) {
- flipInputs(false);
- evt.preventDefault();
- };
- },
-
- setWarningDialogOverlayText_: function(messages) {
- var contentDiv = document.createElement('div');
-
- for (var i = 0; i < messages.length; ++i) {
- var messageDiv = document.createElement('div');
- messageDiv.textContent = messages[i];
- contentDiv.appendChild(messageDiv);
- }
- this.warningOverlay_.textContent = '';
- this.warningOverlay_.appendChild(contentDiv);
- },
-
- createDefaultDisabledWarningDialog_: function(warningLink) {
- function onClickHandler(evt) {
- this.warningOverlay_ = tr.ui.b.Overlay();
- this.warningOverlay_.parentEl_ = this;
- this.warningOverlay_.title = 'Warning...';
- this.warningOverlay_.userCanClose = true;
- this.warningOverlay_.visible = true;
-
- this.setWarningDialogOverlayText_([
- 'Enabling the default disabled categories may have',
- 'performance and memory impact while tr.c.'
- ]);
-
- evt.preventDefault();
- }
- warningLink.onclick = onClickHandler.bind(this);
- }
- };
-
- return {
- RecordSelectionDialog: RecordSelectionDialog
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_selection_dialog_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_selection_dialog_test.html
deleted file mode 100644
index 1142f6e6035..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/record_selection_dialog_test.html
+++ /dev/null
@@ -1,386 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/settings.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/ui/extras/about_tracing/record_selection_dialog.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantitate', function() {
- var showButton = document.createElement('button');
- showButton.textContent = 'Show record selection dialog';
- this.addHTMLOutput(showButton);
-
- showButton.addEventListener('click', function(e) {
- e.stopPropagation();
-
- var categories = [];
- for (var i = 0; i < 30; i++)
- categories.push('cat-' + i);
- for (var i = 0; i < 20; i++)
- categories.push('disabled-by-default-cat-' + i);
- categories.push(
- 'really-really-really-really-really-really-very-loong-cat');
- categories.push('first,second,third');
- categories.push('cc,disabled-by-default-cc.debug');
-
- var dlg = new tr.ui.e.about_tracing.RecordSelectionDialog();
- dlg.categories = categories;
- dlg.settings_key = 'key';
- dlg.visible = true;
- });
- });
-
- test('recordSelectionDialog_splitCategories', function() {
- var dlg = new tr.ui.e.about_tracing.RecordSelectionDialog();
- dlg.categories =
- ['cc,disabled-by-default-one,cc.debug', 'two,three', 'three'];
- dlg.settings_key = 'key';
- dlg.currentlyChosenPreset = [];
- dlg.updateForm_();
-
- var expected =
- ['"cc"', '"cc.debug"', '"disabled-by-default-one"', '"three"', '"two"'];
-
- var labels = dlg.querySelectorAll('.categories input');
- var results = [];
- for (var i = 0; i < labels.length; i++) {
- results.push('"' + labels[i].value + '"');
- }
- results = results.sort();
-
- assert.deepEqual(results, expected);
- });
-
- test('recordSelectionDialog_UpdateForm_NoSettings', function() {
- var dlg = new tr.ui.e.about_tracing.RecordSelectionDialog();
- dlg.categories = ['disabled-by-default-one', 'two', 'three'];
- dlg.settings_key = 'key';
- dlg.currentlyChosenPreset = [];
- dlg.updateForm_();
-
- var checkboxes = dlg.querySelectorAll('.categories input');
- assert.equal(checkboxes.length, 3);
- assert.equal(checkboxes[0].id, 'three');
- assert.equal(checkboxes[0].value, 'three');
- assert.isTrue(checkboxes[0].checked);
- assert.equal(checkboxes[1].id, 'two');
- assert.equal(checkboxes[1].value, 'two');
- assert.isTrue(checkboxes[1].checked);
- assert.equal(checkboxes[2].id, 'disabled-by-default-one');
- assert.equal(checkboxes[2].value, 'disabled-by-default-one');
- assert.isFalse(checkboxes[2].checked);
-
- assert.equal(dlg.categoryFilter(), '');
-
- var labels = dlg.querySelectorAll('.categories label');
- assert.equal(labels.length, 3);
- assert.equal(labels[0].textContent, 'three');
- assert.equal(labels[1].textContent, 'two');
- assert.equal(labels[2].textContent, 'one');
- });
-
- test('recordSelectionDialog_UpdateForm_Settings', function() {
- tr.b.Settings.set('two', true, 'categories');
- tr.b.Settings.set('three', false, 'categories');
-
- var dlg = new tr.ui.e.about_tracing.RecordSelectionDialog();
- dlg.categories = ['disabled-by-default-one'];
- dlg.settings_key = 'categories';
- dlg.currentlyChosenPreset = [];
- dlg.updateForm_();
-
- var checkboxes = dlg.querySelectorAll('.categories input');
- assert.equal(checkboxes.length, 3);
- assert.equal(checkboxes[0].id, 'three');
- assert.equal(checkboxes[0].value, 'three');
- assert.isFalse(checkboxes[0].checked);
- assert.equal(checkboxes[1].id, 'two');
- assert.equal(checkboxes[1].value, 'two');
- assert.isTrue(checkboxes[1].checked);
- assert.equal(checkboxes[2].id, 'disabled-by-default-one');
- assert.equal(checkboxes[2].value, 'disabled-by-default-one');
- assert.isFalse(checkboxes[2].checked);
-
- assert.equal(dlg.categoryFilter(), '-three');
-
- var labels = dlg.querySelectorAll('.categories label');
- assert.equal(labels.length, 3);
- assert.equal(labels[0].textContent, 'three');
- assert.equal(labels[1].textContent, 'two');
- assert.equal(labels[2].textContent, 'one');
- });
-
- test('recordSelectionDialog_UpdateForm_DisabledByDefault', function() {
- var dlg = new tr.ui.e.about_tracing.RecordSelectionDialog();
- dlg.categories = ['disabled-by-default-bar', 'baz'];
- dlg.settings_key = 'categories';
- dlg.currentlyChosenPreset = [];
- dlg.updateForm_();
-
- assert.equal(dlg.categoryFilter(), '');
-
- var inputs =
- dlg.querySelector('input#disabled-by-default-bar').click();
-
- assert.equal(dlg.categoryFilter(), 'disabled-by-default-bar');
-
- assert.isFalse(
- tr.b.Settings.get('disabled-by-default-foo', false, 'categories'));
- });
-
- test('selectAll', function() {
- tr.b.Settings.set('two', true, 'categories');
- tr.b.Settings.set('three', false, 'categories');
-
- var dlg = new tr.ui.e.about_tracing.RecordSelectionDialog();
- dlg.categories = ['disabled-by-default-one'];
- dlg.settings_key = 'categories';
- dlg.currentlyChosenPreset = [];
- dlg.updateForm_();
- });
-
- test('selectNone', function() {
- tr.b.Settings.set('two', true, 'categories');
- tr.b.Settings.set('three', false, 'categories');
-
- var dlg = new tr.ui.e.about_tracing.RecordSelectionDialog();
- dlg.categories = ['disabled-by-default-one'];
- dlg.settings_key = 'categories';
- dlg.currentlyChosenPreset = [];
- dlg.updateForm_();
-
- // Enables the three option, two already enabled.
- dlg.querySelector('.default-enabled-categories .all-btn').click();
- assert.equal(dlg.categoryFilter(), '');
- assert.isTrue(tr.b.Settings.get('three', false, 'categories'));
-
- // Disables three and two.
- dlg.querySelector('.default-enabled-categories .none-btn').click();
- assert.equal(dlg.categoryFilter(), '-three,-two');
- assert.isFalse(tr.b.Settings.get('two', false, 'categories'));
- assert.isFalse(tr.b.Settings.get('three', false, 'categories'));
-
- // Turn categories back on so they can be ignored.
- dlg.querySelector('.default-enabled-categories .all-btn').click();
-
- // Enables disabled category.
- dlg.querySelector('.default-disabled-categories .all-btn').click();
- assert.equal(dlg.categoryFilter(), 'disabled-by-default-one');
- assert.isTrue(
- tr.b.Settings.get('disabled-by-default-one', false, 'categories'));
-
- // Turn disabled by default back off.
- dlg.querySelector('.default-disabled-categories .none-btn').click();
- assert.equal(dlg.categoryFilter(), '');
- assert.isFalse(
- tr.b.Settings.get('disabled-by-default-one', false, 'categories'));
- });
-
- test('recordSelectionDialog_noPreset', function() {
- tr.b.Settings.set('about_tracing.record_selection_dialog_preset', []);
- var dlg = new tr.ui.e.about_tracing.RecordSelectionDialog();
- assert.isFalse(dlg.usingPreset_());
- });
-
- test('recordSelectionDialog_defaultPreset', function() {
- tr.b.Settings.set('two', true, 'categories');
- tr.b.Settings.set('three', false, 'categories');
-
- var dlg = new tr.ui.e.about_tracing.RecordSelectionDialog();
- dlg.categories = ['disabled-by-default-one'];
- dlg.settings_key = 'categories';
- // Note: currentlyChosenPreset is not set here, so the default is used.
- dlg.updateForm_();
-
- // Make sure the default filter is returned.
- assert.equal(dlg.categoryFilter(), '-three,-two');
-
- // Make sure the default tracing types are returned.
- assert.equal(dlg.tracingRecordMode, 'record-until-full');
- assert.isTrue(dlg.useSystemTracing);
- assert.isFalse(dlg.useSampling);
-
- // Make sure the manual settings are not visible.
- var classList = dlg.categoriesView_.classList;
- assert.isTrue(classList.contains('categories-column-view-hidden'));
-
- // Verify manual settings do not modify the checkboxes.
- var checkboxes = dlg.querySelectorAll('.categories input');
- assert.equal(checkboxes.length, 3);
- assert.equal(checkboxes[0].id, 'three');
- assert.equal(checkboxes[0].value, 'three');
- assert.isFalse(checkboxes[0].checked);
- assert.equal(checkboxes[1].id, 'two');
- assert.equal(checkboxes[1].value, 'two');
- assert.isTrue(checkboxes[1].checked);
- assert.equal(checkboxes[2].id, 'disabled-by-default-one');
- assert.equal(checkboxes[2].value, 'disabled-by-default-one');
- assert.isFalse(checkboxes[2].checked);
- });
-
- test('recordSelectionDialog_editPreset', function() {
- function createDialog() {
- var dlg = new tr.ui.e.about_tracing.RecordSelectionDialog();
- dlg.categories = ['one', 'two', 'disabled-by-default-three'];
- dlg.settings_key = 'categories';
- // Note: currentlyChosenPreset is not set here, so the default is used.
- dlg.updateForm_();
- return dlg;
- }
-
- // After the dialog is created, it should be using the default preset.
- var dlg = createDialog();
- assert.strictEqual(dlg.categoryFilter(), '-one,-two');
- assert.isTrue(dlg.usingPreset_());
- assert.isFalse(
- dlg.querySelector('#category-preset-Manually-select-settings').checked);
-
- // After clicking on "Edit Categories", the default preset should still be
- // used.
- dlg.onClickEditCategories();
- assert.strictEqual(dlg.categoryFilter(), '-one,-two');
- assert.isTrue(dlg.usingPreset_());
- assert.isFalse(
- dlg.querySelector('#category-preset-Manually-select-settings').checked);
-
- // After clicking on category checkbox(es), the mode should be changed to
- // "Manually select settings".
- Array.prototype.forEach.call(dlg.querySelectorAll('.categories input'),
- checkbox => checkbox.click());
- assert.strictEqual(dlg.categoryFilter(), 'disabled-by-default-three');
- assert.isFalse(dlg.usingPreset_());
- assert.isTrue(
- dlg.querySelector('#category-preset-Manually-select-settings').checked);
-
- // After the dialog is opened again, it should be using the default preset.
- // More importantly, the default preset should NOT be modified.
- dlg = createDialog();
- assert.strictEqual(dlg.categoryFilter(), '-one,-two');
- assert.isTrue(dlg.usingPreset_());
- assert.isFalse(
- dlg.querySelector('#category-preset-Manually-select-settings').checked);
- });
-
- test('recordSelectionDialog_changePresets', function() {
- tr.b.Settings.set('two', true, 'categories');
- tr.b.Settings.set('three', false, 'categories');
- tr.b.Settings.set('disabled-by-default-cc.debug', true, 'categories');
- tr.b.Settings.set('recordSelectionDialog.tracingRecordMode',
- 'record-as-much-as-possible');
- tr.b.Settings.set('recordSelectionDialog.useSystemTracing', true);
- tr.b.Settings.set('recordSelectionDialog.useSampling', false);
-
- var dlg = new tr.ui.e.about_tracing.RecordSelectionDialog();
- dlg.categories = ['disabled-by-default-one'];
- dlg.settings_key = 'categories';
- // Note: currentlyChosenPreset is not set here, so the default is used.
- dlg.updateForm_();
-
- // Preset mode is on.
- assert.isTrue(dlg.usingPreset_());
-
- // Make sure the default filter is returned.
- assert.equal(dlg.categoryFilter(),
- '-three,-two');
-
- // Make sure the default tracing types are returned.
- assert.equal(dlg.tracingRecordMode, 'record-as-much-as-possible');
- assert.isTrue(dlg.useSystemTracing);
- assert.isFalse(dlg.useSampling);
-
- // Make sure the manual settings are not visible.
- var classList = dlg.categoriesView_.classList;
- assert.isTrue(classList.contains('categories-column-view-hidden'));
-
- // Switch to manual settings and verify the default values are not returned.
- dlg.currentlyChosenPreset = [];
-
- // Preset mode is off.
- assert.isFalse(dlg.usingPreset_());
-
- // Make sure the default filter is returned.
- assert.equal(dlg.categoryFilter(), '-three,disabled-by-default-cc.debug');
-
- // Make sure the tracing types set by catalog are returned.
- assert.equal(dlg.tracingRecordMode, 'record-as-much-as-possible');
- assert.isTrue(dlg.useSystemTracing);
- assert.isFalse(dlg.useSampling);
- assert.isFalse(classList.contains('categories-column-view-hidden'));
-
- // Switch to the graphics, rendering, and rasterization preset.
- dlg.currentlyChosenPreset = ['blink', 'cc', 'renderer',
- 'disabled-by-default-cc.debug'];
- assert.equal(dlg.categoryFilter(),
- 'disabled-by-default-cc.debug,-three,-two');
- });
-
- test('recordSelectionDialog_savedPreset', function() {
- tr.b.Settings.set('two', true, 'categories');
- tr.b.Settings.set('three', false, 'categories');
- tr.b.Settings.set('recordSelectionDialog.tracingRecordMode',
- 'record-continuously');
- tr.b.Settings.set('recordSelectionDialog.useSystemTracing', true);
- tr.b.Settings.set('recordSelectionDialog.useSampling', true);
- tr.b.Settings.set('tr.ui.e.about_tracing.record_selection_dialog_preset',
- ['blink', 'cc', 'renderer', 'cc.debug']);
-
- var dlg = new tr.ui.e.about_tracing.RecordSelectionDialog();
- dlg.categories = ['disabled-by-default-one'];
- dlg.settings_key = 'categories';
- dlg.updateForm_();
-
- // Make sure the correct filter is returned.
- assert.equal(dlg.categoryFilter(), '-three,-two');
-
- // Make sure the correct tracing types are returned.
- assert.equal(dlg.tracingRecordMode, 'record-continuously');
- assert.isTrue(dlg.useSystemTracing);
- assert.isTrue(dlg.useSampling);
-
- // Make sure the manual settings are not visible.
- var classList = dlg.categoriesView_.classList;
- assert.isTrue(classList.contains('categories-column-view-hidden'));
-
- // Switch to manual settings and verify the default values are not returned.
- dlg.currentlyChosenPreset = [];
- assert.equal(dlg.categoryFilter(), '-three');
- assert.equal(dlg.tracingRecordMode, 'record-continuously');
- assert.isTrue(dlg.useSystemTracing);
- assert.isTrue(dlg.useSampling);
- assert.isFalse(classList.contains('categories-column-view-hidden'));
- });
-
- test('recordSelectionDialog_categoryFilters', function() {
- tr.b.Settings.set('default1', true, 'categories');
- tr.b.Settings.set('disabled1', false, 'categories');
- tr.b.Settings.set('disabled-by-default-cc.disabled2', false, 'categories');
- tr.b.Settings.set('input', true, 'categories');
- tr.b.Settings.set('blink', true, 'categories');
- tr.b.Settings.set('cc', false, 'categories');
- tr.b.Settings.set('disabled-by-default-cc.debug', true, 'categories');
-
- var dlg = new tr.ui.e.about_tracing.RecordSelectionDialog();
- dlg.settings_key = 'categories';
- dlg.categories = [];
- dlg.currentlyChosenPreset = [];
- dlg.updateForm_();
-
- assert.equal(dlg.categoryFilter(),
- '-cc,-disabled1,disabled-by-default-cc.debug');
-
- // Switch to the graphics, rendering, and rasterization preset.
- dlg.currentlyChosenPreset = ['blink', 'cc', 'renderer',
- 'disabled-by-default-cc.debug'];
- assert.equal(dlg.categoryFilter(),
- '-default1,disabled-by-default-cc.debug,-disabled1,-input');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/tracing_controller_client.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/tracing_controller_client.html
deleted file mode 100644
index 8c34b00e859..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/tracing_controller_client.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.about_tracing', function() {
- /**
- * Communicates with content/browser/tracing_controller_impl.cc
- *
- * @constructor
- */
- function TracingControllerClient() { }
-
- TracingControllerClient.prototype = {
- beginMonitoring: function(monitoringOptions) { },
- endMonitoring: function() { },
- captureMonitoring: function() { },
- getMonitoringStatus: function() { },
- getCategories: function() { },
- beginRecording: function(recordingOptions) { },
- beginGetBufferPercentFull: function() { },
- endRecording: function() { },
- defaultTraceName: function() { }
- };
-
- return {
- TracingControllerClient: TracingControllerClient
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/xhr_based_tracing_controller_client.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/xhr_based_tracing_controller_client.html
deleted file mode 100644
index c7c68cc8483..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/about_tracing/xhr_based_tracing_controller_client.html
+++ /dev/null
@@ -1,113 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base64.html">
-<link rel="import"
- href="/tracing/ui/extras/about_tracing/tracing_controller_client.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.about_tracing', function() {
- var Base64 = tr.b.Base64;
-
- function beginXhr(method, path, data) {
- if (data === undefined)
- data = null;
- return new Promise(function(resolve, reject) {
- var req = new XMLHttpRequest();
- if (method != 'POST' && data !== null)
- throw new Error('Non-POST should have data==null');
- req.open(method, path, true);
- req.onreadystatechange = function(e) {
- if (req.readyState == 4) {
- window.setTimeout(function() {
- if (req.status == 200 && req.responseText != '##ERROR##') {
- resolve(req.responseText);
- } else {
- reject(new Error('Error occured at ' + path));
- }
- }, 0);
- }
- };
- req.send(data);
- });
- }
-
- /**
- * @constructor
- */
- function XhrBasedTracingControllerClient() { }
-
- XhrBasedTracingControllerClient.prototype = {
- __proto__: tr.ui.e.about_tracing.TracingControllerClient.prototype,
-
- beginMonitoring: function(monitoringOptions) {
- var monitoringOptionsB64 = Base64.btoa(JSON.stringify(monitoringOptions));
- return beginXhr('GET', '/json/begin_monitoring?' + monitoringOptionsB64);
- },
-
- endMonitoring: function() {
- return beginXhr('GET', '/json/end_monitoring');
- },
-
- captureMonitoring: function() {
- return beginXhr('GET', '/json/capture_monitoring_compressed').then(
- function(data) {
- var decoded_size = Base64.getDecodedBufferLength(data);
- var buffer = new ArrayBuffer(decoded_size);
- Base64.DecodeToTypedArray(data, new DataView(buffer));
- return buffer;
- }
- );
- },
-
- getMonitoringStatus: function() {
- return beginXhr('GET', '/json/get_monitoring_status').then(
- function(monitoringOptionsB64) {
- return JSON.parse(Base64.atob(monitoringOptionsB64));
- });
- },
-
- getCategories: function() {
- return beginXhr('GET', '/json/categories').then(
- function(json) {
- return JSON.parse(json);
- });
- },
-
- beginRecording: function(recordingOptions) {
- var recordingOptionsB64 = Base64.btoa(JSON.stringify(recordingOptions));
- return beginXhr('GET', '/json/begin_recording?' +
- recordingOptionsB64);
- },
-
- beginGetBufferPercentFull: function() {
- return beginXhr('GET', '/json/get_buffer_percent_full');
- },
-
- endRecording: function() {
- return beginXhr('GET', '/json/end_recording_compressed').then(
- function(data) {
- var decoded_size = Base64.getDecodedBufferLength(data);
- var buffer = new ArrayBuffer(decoded_size);
- Base64.DecodeToTypedArray(data, new DataView(buffer));
- return buffer;
- }
- );
- },
-
- defaultTraceName: function() {
- return 'trace.json.gz';
- }
- };
-
- return {
- XhrBasedTracingControllerClient: XhrBasedTracingControllerClient
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/cc.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/cc.html
deleted file mode 100644
index 79ba7e593c0..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/cc.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/cc/cc.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/display_item_list_view.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/picture_view.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/raster_task_selection.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/raster_task_view.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/tile_view.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_debugger.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_debugger.html
deleted file mode 100644
index 55a028ce4c3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_debugger.html
+++ /dev/null
@@ -1,467 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base64.html">
-<link rel="import" href="/tracing/extras/chrome/cc/picture.html">
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-<link rel="import" href="/tracing/ui/base/drag_handle.html">
-<link rel="import" href="/tracing/ui/base/hotkey_controller.html">
-<link rel="import" href="/tracing/ui/base/info_bar.html">
-<link rel="import" href="/tracing/ui/base/list_view.html">
-<link rel="import" href="/tracing/ui/base/mouse_mode_selector.html">
-<link rel="import" href="/tracing/ui/base/overlay.html">
-<link rel="import" href="/tracing/ui/base/utils.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/display_item_list_item.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/picture_ops_list_view.html">
-
-<template id="tr-ui-e-chrome-cc-display-item-debugger-template">
- <style>
- * /deep/ tr-ui-e-chrome-cc-display-item-debugger {
- -webkit-flex: 1 1 auto;
- display: -webkit-flex;
- }
-
- * /deep/ tr-ui-e-chrome-cc-display-item-debugger > left-panel {
- -webkit-flex-direction: column;
- display: -webkit-flex;
- min-width: 300px;
- overflow-y: auto;
- }
-
- * /deep/ tr-ui-e-chrome-cc-display-item-debugger > left-panel >
- display-item-info {
- -webkit-flex: 1 1 auto;
- padding-top: 2px;
- }
-
- * /deep/ tr-ui-e-chrome-cc-display-item-debugger > left-panel >
- display-item-info .title {
- font-weight: bold;
- margin-left: 5px;
- margin-right: 5px;
- }
-
- * /deep/ tr-ui-e-chrome-cc-display-item-debugger > left-panel >
- display-item-info .export {
- margin: 5px;
- }
-
- * /deep/ tr-ui-e-chrome-cc-display-item-debugger > tr-ui-b-drag-handle {
- -webkit-flex: 0 0 auto;
- }
-
- * /deep/ tr-ui-e-chrome-cc-display-item-debugger > right-panel {
- -webkit-flex: 1 1 auto;
- display: -webkit-flex;
- }
-
- * /deep/ tr-ui-e-chrome-cc-display-item-debugger > left-panel >
- display-item-info > header {
- border-bottom: 1px solid #555;
- }
-
- /*************************************************/
-
- * /deep/ tr-ui-e-chrome-cc-display-item-debugger > right-panel >
- tr-ui-e-chrome-cc-picture-ops-list-view.hasPictureOps {
- display: block;
- }
-
- * /deep/ tr-ui-e-chrome-cc-display-item-debugger > right-panel >
- tr-ui-b-drag-handle.hasPictureOps {
- display: block;
- }
-
- * /deep/ tr-ui-e-chrome-cc-display-item-debugger > right-panel >
- tr-ui-e-chrome-cc-picture-ops-list-view {
- display: none;
- overflow-y: auto;
- }
-
- * /deep/ tr-ui-e-chrome-cc-display-item-debugger > right-panel >
- tr-ui-b-drag-handle {
- display: none;
- }
-
- * /deep/ tr-ui-e-chrome-cc-display-item-debugger raster-area {
- -webkit-flex: 1 1 auto;
- background-color: #ddd;
- min-height: 200px;
- min-width: 200px;
- overflow-y: auto;
- padding-left: 5px;
- }
- </style>
-
- <left-panel>
- <display-item-info>
- <header>
- <span class='title'>Display Item List</span>
- <span class='size'></span>
- <div class='export'>
- <input class='dlfilename' type='text' value='displayitemlist.json' />
- <button class='dlexport'>Export display item list</button>
- </div>
- <div class='export'>
- <input class='skpfilename' type='text' value='skpicture.skp' />
- <button class='skpexport'>Export list as SkPicture</button>
- </div>
- </header>
- </display-item-info>
- </left-panel>
- <right-panel>
- <raster-area><canvas></canvas></raster-area>
- </right-panel>
-</template>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.chrome.cc', function() {
- var THIS_DOC = document.currentScript.ownerDocument;
-
- /**
- * DisplayItemDebugger is a view of a DisplayItemListSnapshot for inspecting
- * a display item list and the pictures within it.
- *
- * @constructor
- */
- var DisplayItemDebugger = tr.ui.b.define(
- 'tr-ui-e-chrome-cc-display-item-debugger');
-
- DisplayItemDebugger.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- var node = tr.ui.b.instantiateTemplate(
- '#tr-ui-e-chrome-cc-display-item-debugger-template', THIS_DOC);
-
- this.appendChild(node);
-
- this.pictureAsImageData_ = undefined;
- this.zoomScaleValue_ = 1;
-
- this.sizeInfo_ = this.querySelector('.size');
- this.rasterArea_ = this.querySelector('raster-area');
- this.rasterCanvas_ = this.rasterArea_.querySelector('canvas');
- this.rasterCtx_ = this.rasterCanvas_.getContext('2d');
-
- this.trackMouse_();
-
- this.displayItemInfo_ = this.querySelector('display-item-info');
- this.displayItemInfo_.addEventListener(
- 'click', this.onDisplayItemInfoClick_.bind(this), false);
-
- this.displayItemListView_ = new tr.ui.b.ListView();
- this.displayItemListView_.addEventListener('selection-changed',
- this.onDisplayItemListSelection_.bind(this));
- this.displayItemInfo_.appendChild(this.displayItemListView_);
-
- this.displayListFilename_ = this.querySelector('.dlfilename');
- this.displayListExportButton_ = this.querySelector('.dlexport');
- this.displayListExportButton_.addEventListener(
- 'click', this.onExportDisplayListClicked_.bind(this));
-
- this.skpFilename_ = this.querySelector('.skpfilename');
- this.skpExportButton_ = this.querySelector('.skpexport');
- this.skpExportButton_.addEventListener(
- 'click', this.onExportSkPictureClicked_.bind(this));
-
- var leftPanel = this.querySelector('left-panel');
-
- var middleDragHandle = document.createElement('tr-ui-b-drag-handle');
- middleDragHandle.horizontal = false;
- middleDragHandle.target = leftPanel;
-
- var rightPanel = this.querySelector('right-panel');
-
- this.infoBar_ = document.createElement('tr-ui-b-info-bar');
- this.rasterArea_.insertBefore(this.infoBar_, this.rasterCanvas_);
-
- this.insertBefore(middleDragHandle, rightPanel);
-
- this.picture_ = undefined;
-
- this.pictureOpsListView_ = new tr.ui.e.chrome.cc.PictureOpsListView();
- rightPanel.insertBefore(this.pictureOpsListView_, this.rasterArea_);
-
- this.pictureOpsListDragHandle_ =
- document.createElement('tr-ui-b-drag-handle');
- this.pictureOpsListDragHandle_.horizontal = false;
- this.pictureOpsListDragHandle_.target = this.pictureOpsListView_;
- rightPanel.insertBefore(this.pictureOpsListDragHandle_, this.rasterArea_);
- },
-
- get picture() {
- return this.picture_;
- },
-
- set displayItemList(displayItemList) {
- this.displayItemList_ = displayItemList;
- this.picture = this.displayItemList_;
-
- this.displayItemListView_.clear();
- this.displayItemList_.items.forEach(function(item) {
- var listItem = document.createElement(
- 'tr-ui-e-chrome-cc-display-item-list-item');
- listItem.data = item;
- this.displayItemListView_.appendChild(listItem);
- }.bind(this));
- },
-
- set picture(picture) {
- this.picture_ = picture;
-
- // Hide the ops list if we are showing the "main" display item list.
- var showOpsList = picture && picture !== this.displayItemList_;
- this.updateDrawOpsList_(showOpsList);
-
- if (picture) {
- var size = this.getRasterCanvasSize_();
- this.rasterCanvas_.width = size.width;
- this.rasterCanvas_.height = size.height;
- }
-
- var bounds = this.rasterArea_.getBoundingClientRect();
- var selectorBounds = this.mouseModeSelector_.getBoundingClientRect();
- this.mouseModeSelector_.pos = {
- x: (bounds.right - selectorBounds.width - 10),
- y: bounds.top
- };
-
- this.rasterize_();
-
- this.scheduleUpdateContents_();
- },
-
- getRasterCanvasSize_: function() {
- var style = window.getComputedStyle(this.rasterArea_);
- var width = parseInt(style.width);
- var height = parseInt(style.height);
- if (this.picture_) {
- width = Math.max(width, this.picture_.layerRect.width);
- height = Math.max(height, this.picture_.layerRect.height);
- }
-
- return {
- width: width,
- height: height
- };
- },
-
- scheduleUpdateContents_: function() {
- if (this.updateContentsPending_)
- return;
- this.updateContentsPending_ = true;
- tr.b.requestAnimationFrameInThisFrameIfPossible(
- this.updateContents_.bind(this)
- );
- },
-
- updateContents_: function() {
- this.updateContentsPending_ = false;
-
- if (this.picture_) {
- this.sizeInfo_.textContent = '(' +
- this.picture_.layerRect.width + ' x ' +
- this.picture_.layerRect.height + ')';
- }
-
- // Return if picture hasn't finished rasterizing.
- if (!this.pictureAsImageData_)
- return;
-
- this.infoBar_.visible = false;
- this.infoBar_.removeAllButtons();
- if (this.pictureAsImageData_.error) {
- this.infoBar_.message = 'Cannot rasterize...';
- this.infoBar_.addButton('More info...', function(e) {
- var overlay = new tr.ui.b.Overlay();
- overlay.textContent = this.pictureAsImageData_.error;
- overlay.visible = true;
- e.stopPropagation();
- return false;
- }.bind(this));
- this.infoBar_.visible = true;
- }
-
- this.drawPicture_();
- },
-
- drawPicture_: function() {
- var size = this.getRasterCanvasSize_();
- if (size.width !== this.rasterCanvas_.width)
- this.rasterCanvas_.width = size.width;
- if (size.height !== this.rasterCanvas_.height)
- this.rasterCanvas_.height = size.height;
-
- this.rasterCtx_.clearRect(0, 0, size.width, size.height);
-
- if (!this.picture_ || !this.pictureAsImageData_.imageData)
- return;
-
- var imgCanvas = this.pictureAsImageData_.asCanvas();
- var w = imgCanvas.width;
- var h = imgCanvas.height;
- this.rasterCtx_.drawImage(imgCanvas, 0, 0, w, h,
- 0, 0, w * this.zoomScaleValue_,
- h * this.zoomScaleValue_);
- },
-
- rasterize_: function() {
- if (this.picture_) {
- this.picture_.rasterize(
- {
- showOverdraw: false
- },
- this.onRasterComplete_.bind(this));
- }
- },
-
- onRasterComplete_: function(pictureAsImageData) {
- this.pictureAsImageData_ = pictureAsImageData;
- this.scheduleUpdateContents_();
- },
-
- onDisplayItemListSelection_: function(e) {
- var selected = this.displayItemListView_.selectedElement;
-
- if (!selected) {
- this.picture = this.displayItemList_;
- return;
- }
-
- var index = Array.prototype.indexOf.call(
- this.displayItemListView_.children, selected);
- var displayItem = this.displayItemList_.items[index];
- if (displayItem && displayItem.skp64)
- this.picture = new tr.e.cc.Picture(
- displayItem.skp64, this.displayItemList_.layerRect);
- else
- this.picture = undefined;
- },
-
- onDisplayItemInfoClick_: function(e) {
- if (e && e.target == this.displayItemInfo_) {
- this.displayItemListView_.selectedElement = undefined;
- }
- },
-
- updateDrawOpsList_: function(showOpsList) {
- if (showOpsList) {
- this.pictureOpsListView_.picture = this.picture_;
- if (this.pictureOpsListView_.numOps > 0) {
- this.pictureOpsListView_.classList.add('hasPictureOps');
- this.pictureOpsListDragHandle_.classList.add('hasPictureOps');
- }
- } else {
- this.pictureOpsListView_.classList.remove('hasPictureOps');
- this.pictureOpsListDragHandle_.classList.remove('hasPictureOps');
- }
- },
-
- trackMouse_: function() {
- this.mouseModeSelector_ = document.createElement(
- 'tr-ui-b-mouse-mode-selector');
- this.mouseModeSelector_.targetElement = this.rasterArea_;
- this.rasterArea_.appendChild(this.mouseModeSelector_);
-
- this.mouseModeSelector_.supportedModeMask =
- tr.ui.b.MOUSE_SELECTOR_MODE.ZOOM;
- this.mouseModeSelector_.mode = tr.ui.b.MOUSE_SELECTOR_MODE.ZOOM;
- this.mouseModeSelector_.defaultMode = tr.ui.b.MOUSE_SELECTOR_MODE.ZOOM;
- this.mouseModeSelector_.settingsKey = 'pictureDebugger.mouseModeSelector';
-
- this.mouseModeSelector_.addEventListener('beginzoom',
- this.onBeginZoom_.bind(this));
- this.mouseModeSelector_.addEventListener('updatezoom',
- this.onUpdateZoom_.bind(this));
- this.mouseModeSelector_.addEventListener('endzoom',
- this.onEndZoom_.bind(this));
- },
-
- onBeginZoom_: function(e) {
- this.isZooming_ = true;
-
- this.lastMouseViewPos_ = this.extractRelativeMousePosition_(e);
-
- e.preventDefault();
- },
-
- onUpdateZoom_: function(e) {
- if (!this.isZooming_)
- return;
-
- var currentMouseViewPos = this.extractRelativeMousePosition_(e);
-
- // Take the distance the mouse has moved and we want to zoom at about
- // 1/1000th of that speed. 0.01 feels jumpy. This could possibly be tuned
- // more if people feel it's too slow.
- this.zoomScaleValue_ +=
- ((this.lastMouseViewPos_.y - currentMouseViewPos.y) * 0.001);
- this.zoomScaleValue_ = Math.max(this.zoomScaleValue_, 0.1);
-
- this.drawPicture_();
-
- this.lastMouseViewPos_ = currentMouseViewPos;
- },
-
- onEndZoom_: function(e) {
- this.lastMouseViewPos_ = undefined;
- this.isZooming_ = false;
- e.preventDefault();
- },
-
- extractRelativeMousePosition_: function(e) {
- return {
- x: e.clientX - this.rasterArea_.offsetLeft,
- y: e.clientY - this.rasterArea_.offsetTop
- };
- },
-
- saveFile_: function(filename, rawData) {
- if (!rawData)
- return;
-
- // Convert this String into an Uint8Array
- var length = rawData.length;
- var arrayBuffer = new ArrayBuffer(length);
- var uint8Array = new Uint8Array(arrayBuffer);
- for (var c = 0; c < length; c++)
- uint8Array[c] = rawData.charCodeAt(c);
-
- // Create a blob URL from the binary array.
- var blob = new Blob([uint8Array], {type: 'application/octet-binary'});
- var blobUrl = window.URL.createObjectURL(blob);
-
- // Create a link and click on it.
- var link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
- link.href = blobUrl;
- link.download = filename;
- var event = document.createEvent('MouseEvents');
- event.initMouseEvent(
- 'click', true, false, window, 0, 0, 0, 0, 0,
- false, false, false, false, 0, null);
- link.dispatchEvent(event);
- },
-
- onExportDisplayListClicked_: function() {
- var rawData = JSON.stringify(this.displayItemList_.items);
- this.saveFile_(this.displayListFilename_.value, rawData);
- },
-
- onExportSkPictureClicked_: function() {
- var rawData = tr.b.Base64.atob(this.picture_.getBase64SkpData());
- this.saveFile_(this.skpFilename_.value, rawData);
- }
- };
-
- return {
- DisplayItemDebugger: DisplayItemDebugger
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_debugger_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_debugger_test.html
deleted file mode 100644
index 91ea9ea4304..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_debugger_test.html
+++ /dev/null
@@ -1,130 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/cc/display_item_list.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/display_item_debugger.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var displayItemList = new tr.e.cc.DisplayItemListSnapshot(
- {id: '31415'},
- 10,
- {
- 'params': {
- 'layer_rect': [-15, -15, 46, 833],
- 'items': [
- 'BeginClipDisplayItem',
- 'EndClipDisplayItem'
- ]
- },
- 'skp64': '[another skia picture in base64]'});
- displayItemList.preInitialize();
- displayItemList.initialize();
-
- var dbg = new tr.ui.e.chrome.cc.DisplayItemDebugger();
- this.addHTMLOutput(dbg);
- assert.isUndefined(dbg.displayItemList_);
- assert.isUndefined(dbg.picture_);
- dbg.displayItemList = displayItemList;
- assert.isDefined(dbg.displayItemList_);
- assert.isDefined(dbg.picture_);
- assert.equal(dbg.displayItemList_.items.length, 2);
- dbg.style.border = '1px solid black';
- });
-
- test('selections', function() {
- var displayItemList = new tr.e.cc.DisplayItemListSnapshot(
- {id: '31415'},
- 10,
- {
- 'params': {
- 'layer_rect': [-15, -15, 46, 833],
- 'items': [
- 'BeginClipDisplayItem',
- 'TransformDisplayItem',
- {'name': 'DrawingDisplayItem', 'skp64': '[skia picture in base64]'},
- 'EndTransformDisplayItem',
- 'EndClipDisplayItem'
- ]
- },
- 'skp64': '[another skia picture in base64]'});
- displayItemList.preInitialize();
- displayItemList.initialize();
-
- var dbg = new tr.ui.e.chrome.cc.DisplayItemDebugger();
- this.addHTMLOutput(dbg);
- dbg.displayItemList = displayItemList;
- assert.isDefined(dbg.displayItemList_);
- assert.isDefined(dbg.picture_);
- assert.equal(dbg.displayItemList_.items.length, 5);
-
- var initialPicture = dbg.picture_;
- assert.isAbove(initialPicture.guid, 0);
-
- // Select the drawing display item and make sure the picture updates.
- var listView = dbg.displayItemListView_;
- listView.selectedElement = listView.getElementByIndex(3);
- var updatedPicture = dbg.picture_;
- assert.isAbove(updatedPicture.guid, 0);
- assert.notEqual(initialPicture.guid, updatedPicture.guid);
-
- // Select the TransformDisplayItem and make sure the picture is blank.
- listView.selectedElement = listView.getElementByIndex(2);
- assert.isUndefined(dbg.picture_);
-
- // Deselect a list item and make sure the picture is reset to the original.
- listView.selectedElement = undefined;
- updatedPicture = dbg.picture_;
- assert.isAbove(updatedPicture.guid, 0);
- assert.equal(initialPicture.guid, updatedPicture.guid);
-
- dbg.style.border = '1px solid black';
- });
-
- test('export', function() {
- var displayItemList = new tr.e.cc.DisplayItemListSnapshot(
- {id: '31415'},
- 10,
- {
- 'params': {
- 'layer_rect': [-15, -15, 46, 833],
- 'items': [
- 'BeginClipDisplayItem',
- 'EndClipDisplayItem'
- ]
- },
- 'skp64': 'c2twaWN0dXJl'});
- displayItemList.preInitialize();
- displayItemList.initialize();
-
- var dbg = new tr.ui.e.chrome.cc.DisplayItemDebugger();
- this.addHTMLOutput(dbg);
- dbg.displayItemList = displayItemList;
-
- var onSaveDisplayListCalled = false;
- dbg.saveFile_ = function(filename, rawData) {
- onSaveDisplayListCalled = true;
- assert.equal(filename, 'displayitemlist.json');
- assert.equal(rawData, '["BeginClipDisplayItem","EndClipDisplayItem"]');
- };
- dbg.onExportDisplayListClicked_();
- assert(onSaveDisplayListCalled);
-
- var onSaveSkPictureCalled = false;
- dbg.saveFile_ = function(filename, rawData) {
- onSaveSkPictureCalled = true;
- assert.equal(filename, 'skpicture.skp');
- assert.equal(rawData, 'skpicture');
- };
- dbg.onExportSkPictureClicked_();
- assert(onSaveSkPictureCalled);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_list_item.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_list_item.html
deleted file mode 100644
index b34495a6b41..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_list_item.html
+++ /dev/null
@@ -1,124 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<!--
-An element displaying basic information about a display item in a list view.
--->
-<polymer-element name="tr-ui-e-chrome-cc-display-item-list-item">
- <template>
- <style>
- :host {
- border-bottom: 1px solid #555;
- display: block;
- font-size: 12px;
- padding: 3px 5px;
- }
-
- :host(:hover) {
- background-color: #f0f0f0;
- cursor: pointer;
- }
-
- .header {
- font-weight: bold;
- margin: 2px 0;
- }
-
- .header > .extra {
- background-color: #777;
- border-radius: 4px;
- color: white;
- margin: 0 6px;
- text-decoration: none;
- padding: 2px 4px;
- }
-
- .raw-details {
- white-space: pre-wrap;
- }
-
- .details > dl {
- margin: 0;
- }
-
- :host(:not([selected])) .details {
- display: none;
- }
- </style>
- <div class="header">
- {{name}}
- <template if="{{richDetails && richDetails.skp64}}">
- <a class="extra"
- href="data:application/octet-stream;base64,{{richDetails.skp64}}"
- download="drawing.skp" on-click="{{stopPropagation}}">SKP</a>
- </template>
- </div>
- <div class="details">
- <template if="{{rawDetails}}">
- <div class="raw-details">{{rawDetails}}</div>
- </template>
- <template if="{{richDetails}}" bind="{{richDetails}}">
- <dl>
- <template if="{{cullRect}}" bind="{{cullRect}}">
- <dt>Cull rect</dt>
- <dd>{{x}},{{y}} {{width}}&times;{{height}}</dd>
- </template>
- <template if="{{visualRect}}" bind="{{visualRect}}">
- <dt>Visual rect</dt>
- <dd>{{x}},{{y}} {{width}}&times;{{height}}</dd>
- </template>
- </dl>
- </template>
- </div>
- </template>
- <script>
- 'use strict';
- (function() {
- // Extracts the "type" and "details" parts of the unstructured (plaintext)
- // display item format, even if the details span multiple lines.
- // For example, given "FooDisplayItem type=hello\nworld", produces
- // "FooDisplayItem" as the first capture and "type=hello\nworld" as the
- // second. Either capture could be the empty string, but this regex will
- // still successfully match.
- var DETAILS_SPLIT_REGEX = /^(\S*)\s*([\S\s]*)$/;
-
- Polymer({
- created: function() {
- this.name = '';
- this.rawDetails = '';
- this.richDetails = undefined;
- this.data_ = undefined;
- },
-
- get data() {
- return this.data_;
- },
-
- set data(data) {
- this.data_ = data;
-
- if (!data) {
- this.name = 'DATA MISSING';
- this.rawDetails = '';
- this.richDetails = undefined;
- } else if (typeof data === 'string') {
- var match = data.match(DETAILS_SPLIT_REGEX);
- this.name = match[1];
- this.rawDetails = match[2];
- this.richDetails = undefined;
- } else {
- this.name = data.name;
- this.rawDetails = '';
- this.richDetails = data;
- }
- },
-
- stopPropagation: function(e) { e.stopPropagation(); }
- });
- })();
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_list_view.css b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_list_view.css
deleted file mode 100644
index 2265f4a1bfc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_list_view.css
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Copyright (c) 2015 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-* /deep/ .tr-ui-e-chrome-cc-display-item-list-view {
- -webkit-flex: 1 1 auto !important;
- display: -webkit-flex;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_list_view.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_list_view.html
deleted file mode 100644
index c66327afc57..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/display_item_list_view.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/extras/chrome/cc/display_item_list_view.css">
-
-<link rel="import" href="/tracing/extras/chrome/cc/display_item_list.html">
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-<link rel="import" href="/tracing/ui/analysis/object_snapshot_view.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/display_item_debugger.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.chrome.cc', function() {
- /*
- * Displays a display item snapshot in a human readable form.
- * @constructor
- */
- var DisplayItemSnapshotView = tr.ui.b.define(
- 'tr-ui-e-chrome-cc-display-item-list-view',
- tr.ui.analysis.ObjectSnapshotView);
-
- DisplayItemSnapshotView.prototype = {
- __proto__: tr.ui.analysis.ObjectSnapshotView.prototype,
-
- decorate: function() {
- this.classList.add('tr-ui-e-chrome-cc-display-item-list-view');
- this.displayItemDebugger_ = new tr.ui.e.chrome.cc.DisplayItemDebugger();
- this.appendChild(this.displayItemDebugger_);
- },
-
- updateContents: function() {
- if (this.objectSnapshot_ && this.displayItemDebugger_)
- this.displayItemDebugger_.displayItemList = this.objectSnapshot_;
- }
- };
-
- tr.ui.analysis.ObjectSnapshotView.register(
- DisplayItemSnapshotView,
- {
- typeNames: ['cc::DisplayItemList'],
- showInstances: false
- });
-
- return {
- DisplayItemSnapshotView: DisplayItemSnapshotView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/images/input-event.png b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/images/input-event.png
deleted file mode 100644
index a2b7710d3c4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/images/input-event.png
+++ /dev/null
Binary files differ
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/images/input-event.svg b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/images/input-event.svg
deleted file mode 100644
index 00531ac68d7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/images/input-event.svg
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="744.09448819"
- height="1052.3622047"
- id="svg2"
- version="1.1"
- inkscape:version="0.48.4 r9939"
- sodipodi:docname="New document 1">
- <defs
- id="defs4">
- <filter
- inkscape:collect="always"
- id="filter3791">
- <feGaussianBlur
- inkscape:collect="always"
- stdDeviation="2.7246316"
- id="feGaussianBlur3793" />
- </filter>
- </defs>
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="2.8"
- inkscape:cx="195.13782"
- inkscape:cy="982.30556"
- inkscape:document-units="px"
- inkscape:current-layer="layer1"
- showgrid="false"
- inkscape:window-width="1215"
- inkscape:window-height="860"
- inkscape:window-x="2219"
- inkscape:window-y="113"
- inkscape:window-maximized="0" />
- <metadata
- id="metadata7">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Layer 1"
- inkscape:groupmode="layer"
- id="layer1">
- <g
- id="g3882"
- style="opacity:0.5"
- inkscape:export-filename="/tmp/input-event.png"
- inkscape:export-xdpi="82.07"
- inkscape:export-ydpi="82.07">
- <path
- transform="matrix(1.0152631,0,0,1.0152631,-0.71357503,0.46150497)"
- sodipodi:type="arc"
- style="opacity:0.50934604000000006;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:5;marker:none;visibility:visible;display:inline;overflow:visible;filter:url(#filter3791);enable-background:accumulate"
- id="path3755"
- sodipodi:cx="177.78685"
- sodipodi:cy="100.79848"
- sodipodi:rx="42.426407"
- sodipodi:ry="42.426407"
- d="m 220.21326,100.79848 a 42.426407,42.426407 0 1 1 -84.85282,0 42.426407,42.426407 0 1 1 84.85282,0 z" />
- <path
- transform="translate(-2,-2)"
- d="m 220.21326,100.79848 a 42.426407,42.426407 0 1 1 -84.85282,0 42.426407,42.426407 0 1 1 84.85282,0 z"
- sodipodi:ry="42.426407"
- sodipodi:rx="42.426407"
- sodipodi:cy="100.79848"
- sodipodi:cx="177.78685"
- id="path2985"
- style="color:#000000;fill:#d4d4d4;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- sodipodi:type="arc" />
- <path
- inkscape:connector-curvature="0"
- id="path3853"
- d="m 175.28125,96.03125 0,8.46875 1,0 0,-8.46875 -1,0 z"
- style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" />
- <path
- inkscape:connector-curvature="0"
- id="path3859"
- d="m 171.53125,99.75 0,1 8.46875,0 0,-1 -8.46875,0 z"
- style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" />
- </g>
- <path
- transform="matrix(1.2923213,0,0,1.2923213,-53.970887,-31.465544)"
- d="m 220.21326,100.79848 a 42.426407,42.426407 0 1 1 -84.85282,0 42.426407,42.426407 0 1 1 84.85282,0 z"
- sodipodi:ry="42.426407"
- sodipodi:rx="42.426407"
- sodipodi:cy="100.79848"
- sodipodi:cx="177.78685"
- id="path3867"
- style="color:#000000;fill:none;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:8;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
- sodipodi:type="arc"
- inkscape:export-filename="/tmp/input-event.png"
- inkscape:export-xdpi="82.07"
- inkscape:export-ydpi="82.07" />
- </g>
-</svg>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_picker.css b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_picker.css
deleted file mode 100644
index 8841b4da953..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_picker.css
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-* /deep/ tr-ui-e-chrome-cc-layer-picker {
- -webkit-flex-direction: column;
- display: -webkit-flex;
-}
-
-* /deep/ tr-ui-e-chrome-cc-layer-picker > top-controls {
- -webkit-flex: 0 0 auto;
- background-image: -webkit-gradient(linear,
- 0 0, 100% 0,
- from(#E5E5E5),
- to(#D1D1D1));
- border-bottom: 1px solid #8e8e8e;
- border-top: 1px solid white;
- display: inline;
- font-size: 14px;
- padding-left: 2px;
-}
-
-* /deep/ tr-ui-e-chrome-cc-layer-picker > top-controls input[type='checkbox'] {
- vertical-align: -2px;
-}
-
-* /deep/ tr-ui-e-chrome-cc-layer-picker > .x-list-view {
- -webkit-flex: 1 1 auto;
- font-family: monospace;
- overflow: auto;
-}
-
-* /deep/ tr-ui-e-chrome-cc-layer-picker > tr-ui-a-generic-object-view {
- -webkit-flex: 0 0 auto;
- height: 200px;
- overflow: auto;
-}
-
-* /deep/ tr-ui-e-chrome-cc-layer-picker > tr-ui-a-generic-object-view * {
- -webkit-user-select: text !important;
- cursor: text;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_picker.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_picker.html
deleted file mode 100644
index 780fe03d86c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_picker.html
+++ /dev/null
@@ -1,322 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/extras/chrome/cc/layer_picker.css">
-
-<link rel="import" href="/tracing/extras/chrome/cc/constants.html">
-<link rel="import" href="/tracing/extras/chrome/cc/layer_tree_host_impl.html">
-<link rel="import" href="/tracing/extras/chrome/cc/util.html">
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-<link rel="import" href="/tracing/model/event.html">
-<link rel="import" href="/tracing/ui/base/drag_handle.html">
-<link rel="import" href="/tracing/ui/base/list_view.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/selection.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.chrome.cc', function() {
- var constants = tr.e.cc.constants;
- var bytesToRoundedMegabytes = tr.e.cc.bytesToRoundedMegabytes;
- var RENDER_PASS_QUADS =
- Math.max(constants.ACTIVE_TREE, constants.PENDING_TREE) + 1;
-
- /**
- * @constructor
- */
- var LayerPicker = tr.ui.b.define('tr-ui-e-chrome-cc-layer-picker');
-
- LayerPicker.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.lthi_ = undefined;
- this.controls_ = document.createElement('top-controls');
- this.renderPassQuads_ = false;
-
-
- this.itemList_ = new tr.ui.b.ListView();
- this.appendChild(this.controls_);
-
- this.appendChild(this.itemList_);
-
- this.itemList_.addEventListener(
- 'selection-changed', this.onItemSelectionChanged_.bind(this));
-
- this.controls_.appendChild(tr.ui.b.createSelector(
- this, 'whichTree',
- 'layerPicker.whichTree', constants.ACTIVE_TREE,
- [{label: 'Active tree', value: constants.ACTIVE_TREE},
- {label: 'Pending tree', value: constants.PENDING_TREE},
- {label: 'Render pass quads', value: RENDER_PASS_QUADS}]));
-
- this.showPureTransformLayers_ = false;
- var showPureTransformLayers = tr.ui.b.createCheckBox(
- this, 'showPureTransformLayers',
- 'layerPicker.showPureTransformLayers', false,
- 'Transform layers');
- showPureTransformLayers.classList.add('show-transform-layers');
- showPureTransformLayers.title =
- 'When checked, pure transform layers are shown';
- this.controls_.appendChild(showPureTransformLayers);
- },
-
- get lthiSnapshot() {
- return this.lthiSnapshot_;
- },
-
- set lthiSnapshot(lthiSnapshot) {
- this.lthiSnapshot_ = lthiSnapshot;
- this.updateContents_();
- },
-
- get whichTree() {
- return this.renderPassQuads_ ? constants.ACTIVE_TREE : this.whichTree_;
- },
-
- set whichTree(whichTree) {
- this.whichTree_ = whichTree;
- this.renderPassQuads_ = (whichTree == RENDER_PASS_QUADS);
- this.updateContents_();
- tr.b.dispatchSimpleEvent(this, 'selection-change', false);
- },
-
- get layerTreeImpl() {
- if (this.lthiSnapshot === undefined)
- return undefined;
- return this.lthiSnapshot.getTree(this.whichTree);
- },
-
- get isRenderPassQuads() {
- return this.renderPassQuads_;
- },
-
- get showPureTransformLayers() {
- return this.showPureTransformLayers_;
- },
-
- set showPureTransformLayers(show) {
- if (this.showPureTransformLayers_ === show)
- return;
- this.showPureTransformLayers_ = show;
- this.updateContents_();
- },
-
- getRenderPassInfos_: function() {
- if (!this.lthiSnapshot_)
- return [];
-
- var renderPassInfo = [];
- if (!this.lthiSnapshot_.args.frame ||
- !this.lthiSnapshot_.args.frame.renderPasses)
- return renderPassInfo;
-
- var renderPasses = this.lthiSnapshot_.args.frame.renderPasses;
- for (var i = 0; i < renderPasses.length; ++i) {
- var info = {renderPass: renderPasses[i],
- depth: 0,
- id: i,
- name: 'cc::RenderPass'};
- renderPassInfo.push(info);
- }
- return renderPassInfo;
- },
-
- getLayerInfos_: function() {
- if (!this.lthiSnapshot_)
- return [];
-
- var tree = this.lthiSnapshot_.getTree(this.whichTree_);
- if (!tree)
- return [];
-
- var layerInfos = [];
-
- var showPureTransformLayers = this.showPureTransformLayers_;
-
- function isPureTransformLayer(layer) {
- if (layer.args.compositingReasons &&
- layer.args.compositingReasons.length != 1 &&
- layer.args.compositingReasons[0] != 'No reasons given')
- return false;
-
- if (layer.args.drawsContent)
- return false;
-
- return true;
- }
- var visitedLayers = {};
- function visitLayer(layer, depth, isMask, isReplica) {
- if (visitedLayers[layer.layerId])
- return;
- visitedLayers[layer.layerId] = true;
- var info = {layer: layer,
- depth: depth};
-
- if (layer.args.drawsContent)
- info.name = layer.objectInstance.name;
- else
- info.name = 'cc::LayerImpl';
-
- if (layer.usingGpuRasterization)
- info.name += ' (G)';
-
- info.isMaskLayer = isMask;
- info.replicaLayer = isReplica;
-
- if (showPureTransformLayers || !isPureTransformLayer(layer))
- layerInfos.push(info);
-
- };
- tree.iterLayers(visitLayer);
- return layerInfos;
- },
-
- updateContents_: function() {
- if (this.renderPassQuads_)
- this.updateRenderPassContents_();
- else
- this.updateLayerContents_();
- },
-
- updateRenderPassContents_: function() {
- this.itemList_.clear();
-
- var selectedRenderPassId;
- if (this.selection_ && this.selection_.associatedRenderPassId)
- selectedRenderPassId = this.selection_.associatedRenderPassId;
-
- var renderPassInfos = this.getRenderPassInfos_();
- renderPassInfos.forEach(function(renderPassInfo) {
- var renderPass = renderPassInfo.renderPass;
- var id = renderPassInfo.id;
-
- var item = this.createElementWithDepth_(renderPassInfo.depth);
- var labelEl = item.appendChild(tr.ui.b.createSpan());
-
- labelEl.textContent = renderPassInfo.name + ' ' + id;
- item.renderPass = renderPass;
- item.renderPassId = id;
- this.itemList_.appendChild(item);
-
- if (id == selectedRenderPassId) {
- renderPass.selectionState =
- tr.model.SelectionState.SELECTED;
- }
- }, this);
- },
-
- updateLayerContents_: function() {
- this.changingItemSelection_ = true;
- try {
- this.itemList_.clear();
-
- var selectedLayerId;
- if (this.selection_ && this.selection_.associatedLayerId)
- selectedLayerId = this.selection_.associatedLayerId;
-
- var layerInfos = this.getLayerInfos_();
- layerInfos.forEach(function(layerInfo) {
- var layer = layerInfo.layer;
- var id = layer.layerId;
-
- var item = this.createElementWithDepth_(layerInfo.depth);
- var labelEl = item.appendChild(tr.ui.b.createSpan());
-
- labelEl.textContent = layerInfo.name + ' ' + id;
-
- var notesEl = item.appendChild(tr.ui.b.createSpan());
- if (layerInfo.isMaskLayer)
- notesEl.textContent += '(mask)';
- if (layerInfo.isReplicaLayer)
- notesEl.textContent += '(replica)';
-
- if (layer.gpuMemoryUsageInBytes !== undefined) {
- var rounded = bytesToRoundedMegabytes(layer.gpuMemoryUsageInBytes);
- if (rounded !== 0)
- notesEl.textContent += ' (' + rounded + ' MB)';
- }
-
- item.layer = layer;
- this.itemList_.appendChild(item);
-
- if (layer.layerId == selectedLayerId) {
- layer.selectionState = tr.model.SelectionState.SELECTED;
- item.selected = true;
- }
- }, this);
- } finally {
- this.changingItemSelection_ = false;
- }
- },
-
- createElementWithDepth_: function(depth) {
- var item = document.createElement('div');
-
- var indentEl = item.appendChild(tr.ui.b.createSpan());
- indentEl.style.whiteSpace = 'pre';
- for (var i = 0; i < depth; i++)
- indentEl.textContent = indentEl.textContent + ' ';
- return item;
- },
-
- onItemSelectionChanged_: function(e) {
- if (this.changingItemSelection_)
- return;
- if (this.renderPassQuads_)
- this.onRenderPassSelected_(e);
- else
- this.onLayerSelected_(e);
- tr.b.dispatchSimpleEvent(this, 'selection-change', false);
- },
-
- onRenderPassSelected_: function(e) {
- var selectedRenderPass;
- var selectedRenderPassId;
- if (this.itemList_.selectedElement) {
- selectedRenderPass = this.itemList_.selectedElement.renderPass;
- selectedRenderPassId =
- this.itemList_.selectedElement.renderPassId;
- }
-
- if (selectedRenderPass) {
- this.selection_ = new tr.ui.e.chrome.cc.RenderPassSelection(
- selectedRenderPass, selectedRenderPassId);
- } else {
- this.selection_ = undefined;
- }
- },
-
- onLayerSelected_: function(e) {
- var selectedLayer;
- if (this.itemList_.selectedElement)
- selectedLayer = this.itemList_.selectedElement.layer;
-
- if (selectedLayer)
- this.selection_ = new tr.ui.e.chrome.cc.LayerSelection(selectedLayer);
- else
- this.selection_ = undefined;
- },
-
- get selection() {
- return this.selection_;
- },
-
- set selection(selection) {
- if (this.selection_ == selection)
- return;
- this.selection_ = selection;
- this.updateContents_();
- }
- };
-
- return {
- LayerPicker: LayerPicker
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view.css b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view.css
deleted file mode 100644
index 3f5069a7cc8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view.css
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-* /deep/ .tr-ui-e-chrome-cc-lthi-s-view {
- -webkit-flex: 1 1 auto !important;
- -webkit-flex-direction: row;
- display: -webkit-flex;
-}
-
-* /deep/ .tr-ui-e-chrome-cc-lthi-s-view > tr-ui-e-chrome-cc-layer-picker {
- -webkit-flex: 1 1 auto;
-}
-
-* /deep/ .tr-ui-e-chrome-cc-lthi-s-view > tr-ui-b-drag-handle {
- -webkit-flex: 0 0 auto;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view.html
deleted file mode 100644
index d808bc5e869..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view.html
+++ /dev/null
@@ -1,127 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet"
- href="/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view.css">
-
-<link rel="import" href="/tracing/extras/chrome/cc/layer_tree_host_impl.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/layer_picker.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/layer_view.html">
-<link rel="import" href="/tracing/extras/chrome/cc/tile.html">
-<link rel="import" href="/tracing/ui/analysis/object_snapshot_view.html">
-<link rel="import" href="/tracing/ui/base/drag_handle.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.chrome.cc', function() {
- /*
- * Displays a LayerTreeHostImpl snapshot in a human readable form.
- * @constructor
- */
- var LayerTreeHostImplSnapshotView = tr.ui.b.define(
- 'tr-ui-e-chrome-cc-layer-tree-host-impl-snapshot-view',
- tr.ui.analysis.ObjectSnapshotView);
-
- LayerTreeHostImplSnapshotView.prototype = {
- __proto__: tr.ui.analysis.ObjectSnapshotView.prototype,
-
- decorate: function() {
- this.classList.add('tr-ui-e-chrome-cc-lthi-s-view');
-
- this.selection_ = undefined;
-
- this.layerPicker_ = new tr.ui.e.chrome.cc.LayerPicker();
- this.layerPicker_.addEventListener(
- 'selection-change',
- this.onLayerPickerSelectionChanged_.bind(this));
-
- this.layerView_ = new tr.ui.e.chrome.cc.LayerView();
- this.layerView_.addEventListener(
- 'selection-change',
- this.onLayerViewSelectionChanged_.bind(this));
- this.dragHandle_ = document.createElement('tr-ui-b-drag-handle');
- this.dragHandle_.horizontal = false;
- this.dragHandle_.target = this.layerView_;
-
- this.appendChild(this.layerPicker_);
- this.appendChild(this.dragHandle_);
- this.appendChild(this.layerView_);
-
- // Make sure we have the current values from layerView_ and layerPicker_,
- // since those might have been created before we added the listener.
- this.onLayerViewSelectionChanged_();
- this.onLayerPickerSelectionChanged_();
-
- },
-
- get objectSnapshot() {
- return this.objectSnapshot_;
- },
-
- set objectSnapshot(objectSnapshot) {
- this.objectSnapshot_ = objectSnapshot;
-
- var lthi = this.objectSnapshot;
- var layerTreeImpl;
- if (lthi)
- layerTreeImpl = lthi.getTree(this.layerPicker_.whichTree);
-
- this.layerPicker_.lthiSnapshot = lthi;
- this.layerView_.layerTreeImpl = layerTreeImpl;
- this.layerView_.regenerateContent();
-
- if (!this.selection_)
- return;
- this.selection = this.selection_.findEquivalent(lthi);
- },
-
- get selection() {
- return this.selection_;
- },
-
- set selection(selection) {
- if (this.selection_ == selection)
- return;
- this.selection_ = selection;
- this.layerPicker_.selection = selection;
- this.layerView_.selection = selection;
- tr.b.dispatchSimpleEvent(this, 'cc-selection-change');
- },
-
- onLayerPickerSelectionChanged_: function() {
- this.selection_ = this.layerPicker_.selection;
- this.layerView_.selection = this.selection;
- this.layerView_.layerTreeImpl = this.layerPicker_.layerTreeImpl;
- this.layerView_.isRenderPassQuads = this.layerPicker_.isRenderPassQuads;
- this.layerView_.regenerateContent();
- tr.b.dispatchSimpleEvent(this, 'cc-selection-change');
- },
-
- onLayerViewSelectionChanged_: function() {
- this.selection_ = this.layerView_.selection;
- this.layerPicker_.selection = this.selection;
- tr.b.dispatchSimpleEvent(this, 'cc-selection-change');
- },
-
- get extraHighlightsByLayerId() {
- return this.layerView_.extraHighlightsByLayerId;
- },
-
- set extraHighlightsByLayerId(extraHighlightsByLayerId) {
- this.layerView_.extraHighlightsByLayerId = extraHighlightsByLayerId;
- }
- };
-
- tr.ui.analysis.ObjectSnapshotView.register(
- LayerTreeHostImplSnapshotView, {typeName: 'cc::LayerTreeHostImpl'});
-
- return {
- LayerTreeHostImplSnapshotView: LayerTreeHostImplSnapshotView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view_test.html
deleted file mode 100644
index b06765aa91d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view_test.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/cc/layer_tree_host_impl.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/extras/chrome/cc/raster_task.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view.html">
-
-<script src="/tracing/extras/chrome/cc/layer_tree_host_impl_test_data.js">
-</script>
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var m = tr.c.TestUtils.newModelWithEvents([g_catLTHIEvents]);
- var p = tr.b.dictionaryValues(m.processes)[0];
-
- var instance = p.objects.getAllInstancesNamed('cc::LayerTreeHostImpl')[0];
- var snapshot = instance.snapshots[0];
-
- var view = new tr.ui.e.chrome.cc.LayerTreeHostImplSnapshotView();
- view.style.width = '900px';
- view.style.height = '400px';
- view.objectSnapshot = snapshot;
-
- this.addHTMLOutput(view);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_quad_stack_view.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_quad_stack_view.html
deleted file mode 100644
index a54deecabfc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_quad_stack_view.html
+++ /dev/null
@@ -1,1192 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color.html">
-<link rel="import" href="/tracing/base/quad.html">
-<link rel="import" href="/tracing/base/raf.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/extras/chrome/cc/debug_colors.html">
-<link rel="import" href="/tracing/extras/chrome/cc/picture.html">
-<link rel="import" href="/tracing/extras/chrome/cc/render_pass.html">
-<link rel="import" href="/tracing/extras/chrome/cc/tile.html">
-<link rel="import" href="/tracing/extras/chrome/cc/util.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/base/info_bar.html">
-<link rel="import" href="/tracing/ui/base/quad_stack_view.html">
-<link rel="import" href="/tracing/ui/base/utils.html">
-
-<style>
-* /deep/ tr-ui-e-chrome-cc-layer-tree-quad-stack-view {
- position: relative;
-}
-
-* /deep/ tr-ui-e-chrome-cc-layer-tree-quad-stack-view > top-controls {
- -webkit-flex: 0 0 auto;
- background-image: -webkit-gradient(linear,
- 0 0, 100% 0,
- from(#E5E5E5),
- to(#D1D1D1));
- border-bottom: 1px solid #8e8e8e;
- border-top: 1px solid white;
- display: flex;
- flex-flow: row wrap;
- flex-direction: row;
- font-size: 14px;
- padding-left: 2px;
- overflow: hidden;
-}
-
-* /deep/ tr-ui-e-chrome-cc-layer-tree-quad-stack-view >
- top-controls input[type='checkbox'] {
- vertical-align: -2px;
-}
-
-* /deep/ tr-ui-e-chrome-cc-layer-tree-quad-stack-view > .what-rasterized {
- color: -webkit-link;
- cursor: pointer;
- text-decoration: underline;
- position: absolute;
- bottom: 10px;
- left: 10px;
-}
-
-* /deep/ tr-ui-e-chrome-cc-layer-tree-quad-stack-view > #input-event {
- background-image: url('./images/input-event.png');
- display: none;
-}
-</style>
-
-<template id='tr-ui-e-chrome-cc-layer-tree-quad-stack-view-template'>
- <img id='input-event'/>
-</template>
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Graphical view of LayerTreeImpl, with controls for
- * type of layer content shown and info bar for content-loading warnings.
- */
-tr.exportTo('tr.ui.e.chrome.cc', function() {
- var ColorScheme = tr.b.ColorScheme;
-
- var THIS_DOC = document.currentScript.ownerDocument;
- var TILE_HEATMAP_TYPE = {};
- TILE_HEATMAP_TYPE.NONE = 'none';
- TILE_HEATMAP_TYPE.SCHEDULED_PRIORITY = 'scheduledPriority';
- TILE_HEATMAP_TYPE.USING_GPU_MEMORY = 'usingGpuMemory';
-
- var cc = tr.ui.e.chrome.cc;
-
- function createTileRectsSelectorBaseOptions() {
- return [{label: 'None', value: 'none'},
- {label: 'Coverage Rects', value: 'coverage'}];
- }
-
- var bytesToRoundedMegabytes = tr.e.cc.bytesToRoundedMegabytes;
-
-
- /**
- * @constructor
- */
- var LayerTreeQuadStackView =
- tr.ui.b.define('tr-ui-e-chrome-cc-layer-tree-quad-stack-view');
-
- LayerTreeQuadStackView.prototype = {
- __proto__: HTMLDivElement.prototype,
-
- decorate: function() {
- this.isRenderPassQuads_ = false;
- this.pictureAsImageData_ = {}; // Maps picture.guid to PictureAsImageData.
- this.messages_ = [];
- this.controls_ = document.createElement('top-controls');
- this.infoBar_ = document.createElement('tr-ui-b-info-bar');
- this.quadStackView_ = new tr.ui.b.QuadStackView();
- this.quadStackView_.addEventListener(
- 'selectionchange', this.onQuadStackViewSelectionChange_.bind(this));
- this.extraHighlightsByLayerId_ = undefined;
- this.inputEventImageData_ = undefined;
-
- var m = tr.ui.b.MOUSE_SELECTOR_MODE;
- var mms = this.quadStackView_.mouseModeSelector;
- mms.settingsKey = 'tr.e.cc.layerTreeQuadStackView.mouseModeSelector';
- mms.setKeyCodeForMode(m.SELECTION, 'Z'.charCodeAt(0));
- mms.setKeyCodeForMode(m.PANSCAN, 'X'.charCodeAt(0));
- mms.setKeyCodeForMode(m.ZOOM, 'C'.charCodeAt(0));
- mms.setKeyCodeForMode(m.ROTATE, 'V'.charCodeAt(0));
-
- var node = tr.ui.b.instantiateTemplate(
- '#tr-ui-e-chrome-cc-layer-tree-quad-stack-view-template', THIS_DOC);
- this.appendChild(node);
- this.appendChild(this.controls_);
- this.appendChild(this.infoBar_);
- this.appendChild(this.quadStackView_);
-
- this.tileRectsSelector_ = tr.ui.b.createSelector(
- this, 'howToShowTiles',
- 'layerView.howToShowTiles', 'none',
- createTileRectsSelectorBaseOptions());
- this.controls_.appendChild(this.tileRectsSelector_);
-
- var tileHeatmapText = tr.ui.b.createSpan({
- textContent: 'Tile heatmap:'
- });
- this.controls_.appendChild(tileHeatmapText);
-
- var tileHeatmapSelector = tr.ui.b.createSelector(
- this, 'tileHeatmapType',
- 'layerView.tileHeatmapType', TILE_HEATMAP_TYPE.NONE,
- [{label: 'None',
- value: TILE_HEATMAP_TYPE.NONE},
- {label: 'Scheduled Priority',
- value: TILE_HEATMAP_TYPE.SCHEDULED_PRIORITY},
- {label: 'Is using GPU memory',
- value: TILE_HEATMAP_TYPE.USING_GPU_MEMORY}
- ]);
- this.controls_.appendChild(tileHeatmapSelector);
-
- var showOtherLayersCheckbox = tr.ui.b.createCheckBox(
- this, 'showOtherLayers',
- 'layerView.showOtherLayers', true,
- 'Other layers/passes');
- showOtherLayersCheckbox.title =
- 'When checked, show all layers, selected or not.';
- this.controls_.appendChild(showOtherLayersCheckbox);
-
- var showInvalidationsCheckbox = tr.ui.b.createCheckBox(
- this, 'showInvalidations',
- 'layerView.showInvalidations', true,
- 'Invalidations');
- showInvalidationsCheckbox.title =
- 'When checked, compositing invalidations are highlighted in red';
- this.controls_.appendChild(showInvalidationsCheckbox);
-
- var showUnrecordedRegionCheckbox = tr.ui.b.createCheckBox(
- this, 'showUnrecordedRegion',
- 'layerView.showUnrecordedRegion', true,
- 'Unrecorded area');
- showUnrecordedRegionCheckbox.title =
- 'When checked, unrecorded areas are highlighted in yellow';
- this.controls_.appendChild(showUnrecordedRegionCheckbox);
-
- var showBottlenecksCheckbox = tr.ui.b.createCheckBox(
- this, 'showBottlenecks',
- 'layerView.showBottlenecks', true,
- 'Bottlenecks');
- showBottlenecksCheckbox.title =
- 'When checked, scroll bottlenecks are highlighted';
- this.controls_.appendChild(showBottlenecksCheckbox);
-
- var showLayoutRectsCheckbox = tr.ui.b.createCheckBox(
- this, 'showLayoutRects',
- 'layerView.showLayoutRects', false,
- 'Layout rects');
- showLayoutRectsCheckbox.title =
- 'When checked, shows rects for regions where layout happened';
- this.controls_.appendChild(showLayoutRectsCheckbox);
-
- var showContentsCheckbox = tr.ui.b.createCheckBox(
- this, 'showContents',
- 'layerView.showContents', true,
- 'Contents');
- showContentsCheckbox.title =
- 'When checked, show the rendered contents inside the layer outlines';
- this.controls_.appendChild(showContentsCheckbox);
-
- var showAnimationBoundsCheckbox = tr.ui.b.createCheckBox(
- this, 'showAnimationBounds',
- 'layerView.showAnimationBounds', false,
- 'Animation Bounds');
- showAnimationBoundsCheckbox.title = 'When checked, show a border around' +
- ' a layer showing the extent of its animation.';
- this.controls_.appendChild(showAnimationBoundsCheckbox);
-
- var showInputEventsCheckbox = tr.ui.b.createCheckBox(
- this, 'showInputEvents',
- 'layerView.showInputEvents', true,
- 'Input events');
- showInputEventsCheckbox.title = 'When checked, input events are ' +
- 'displayed as circles.';
- this.controls_.appendChild(showInputEventsCheckbox);
-
- this.whatRasterizedLink_ = document.createElement('a');
- this.whatRasterizedLink_.classList.add('what-rasterized');
- this.whatRasterizedLink_.textContent = 'What rasterized?';
- this.whatRasterizedLink_.addEventListener(
- 'click', this.onWhatRasterizedLinkClicked_.bind(this));
- this.appendChild(this.whatRasterizedLink_);
- },
-
- get layerTreeImpl() {
- return this.layerTreeImpl_;
- },
-
- set isRenderPassQuads(newValue) {
- this.isRenderPassQuads_ = newValue;
- },
-
- set layerTreeImpl(layerTreeImpl) {
- if (this.layerTreeImpl_ === layerTreeImpl)
- return;
-
- // FIXME(pdr): We may want to clear pictureAsImageData_ here to save
- // memory at the cost of performance. Note that
- // pictureAsImageData_ will be cleared when this is
- // destructed, but this view might live for several
- // layerTreeImpls.
- this.layerTreeImpl_ = layerTreeImpl;
- this.selection = undefined;
- },
-
- get extraHighlightsByLayerId() {
- return this.extraHighlightsByLayerId_;
- },
-
- set extraHighlightsByLayerId(extraHighlightsByLayerId) {
- this.extraHighlightsByLayerId_ = extraHighlightsByLayerId;
- this.scheduleUpdateContents_();
- },
-
- get showOtherLayers() {
- return this.showOtherLayers_;
- },
-
- set showOtherLayers(show) {
- this.showOtherLayers_ = show;
- this.updateContents_();
- },
-
- get showAnimationBounds() {
- return this.showAnimationBounds_;
- },
-
- set showAnimationBounds(show) {
- this.showAnimationBounds_ = show;
- this.updateContents_();
- },
-
- get showInputEvents() {
- return this.showInputEvents_;
- },
-
- set showInputEvents(show) {
- this.showInputEvents_ = show;
- this.updateContents_();
- },
-
- get showContents() {
- return this.showContents_;
- },
-
- set showContents(show) {
- this.showContents_ = show;
- this.updateContents_();
- },
-
- get showInvalidations() {
- return this.showInvalidations_;
- },
-
- set showInvalidations(show) {
- this.showInvalidations_ = show;
- this.updateContents_();
- },
-
- get showUnrecordedRegion() {
- return this.showUnrecordedRegion_;
- },
-
- set showUnrecordedRegion(show) {
- this.showUnrecordedRegion_ = show;
- this.updateContents_();
- },
-
- get showBottlenecks() {
- return this.showBottlenecks_;
- },
-
- set showBottlenecks(show) {
- this.showBottlenecks_ = show;
- this.updateContents_();
- },
-
- get showLayoutRects() {
- return this.showLayoutRects_;
- },
-
- set showLayoutRects(show) {
- this.showLayoutRects_ = show;
- this.updateContents_();
- },
-
- get howToShowTiles() {
- return this.howToShowTiles_;
- },
-
- set howToShowTiles(val) {
- // Make sure val is something we expect.
- console.assert(
- (val === 'none') ||
- (val === 'coverage') ||
- !isNaN(parseFloat(val)));
-
- this.howToShowTiles_ = val;
- this.updateContents_();
- },
-
- get tileHeatmapType() {
- return this.tileHeatmapType_;
- },
-
- set tileHeatmapType(val) {
- this.tileHeatmapType_ = val;
- this.updateContents_();
- },
-
- get selection() {
- return this.selection_;
- },
-
- set selection(selection) {
- if (this.selection === selection)
- return;
- this.selection_ = selection;
- tr.b.dispatchSimpleEvent(this, 'selection-change');
- this.updateContents_();
- },
-
- regenerateContent: function() {
- this.updateTilesSelector_();
- this.updateContents_();
- },
-
- loadDataForImageElement_: function(image, callback) {
- var imageContent = window.getComputedStyle(image).backgroundImage;
- image.src = tr.ui.b.extractUrlString(imageContent);
- image.onload = function() {
- var canvas = document.createElement('canvas');
- var ctx = canvas.getContext('2d');
- canvas.width = image.width;
- canvas.height = image.height;
- ctx.drawImage(image, 0, 0);
- var imageData = ctx.getImageData(
- 0, 0, canvas.width, canvas.height);
- callback(imageData);
- };
- },
-
- onQuadStackViewSelectionChange_: function(e) {
- var selectableQuads = e.quads.filter(function(q) {
- return q.selectionToSetIfClicked !== undefined;
- });
- if (selectableQuads.length == 0) {
- this.selection = undefined;
- return;
- }
-
- // Sort the quads low to high on stackingGroupId.
- selectableQuads.sort(function(x, y) {
- var z = x.stackingGroupId - y.stackingGroupId;
- if (z != 0)
- return z;
- return x.selectionToSetIfClicked.specicifity -
- y.selectionToSetIfClicked.specicifity;
- });
-
- // TODO(nduca): Support selecting N things at once.
- var quadToSelect = selectableQuads[selectableQuads.length - 1];
- this.selection = quadToSelect.selectionToSetIfClicked;
- },
-
- scheduleUpdateContents_: function() {
- if (this.updateContentsPending_)
- return;
- this.updateContentsPending_ = true;
- tr.b.requestAnimationFrameInThisFrameIfPossible(
- this.updateContents_, this);
- },
-
- updateContents_: function() {
- if (!this.layerTreeImpl_) {
- this.quadStackView_.headerText = 'No tree';
- this.quadStackView_.quads = [];
- return;
- }
-
-
- var status = this.computePictureLoadingStatus_();
- if (!status.picturesComplete)
- return;
-
- var lthi = this.layerTreeImpl_.layerTreeHostImpl;
- var lthiInstance = lthi.objectInstance;
- var worldViewportRect = tr.b.Rect.fromXYWH(
- 0, 0,
- lthi.deviceViewportSize.width, lthi.deviceViewportSize.height);
- this.quadStackView_.deviceRect = worldViewportRect;
- if (this.isRenderPassQuads_)
- this.quadStackView_.quads = this.generateRenderPassQuads();
- else
- this.quadStackView_.quads = this.generateLayerQuads();
-
- this.updateWhatRasterizedLinkState_();
-
- var message = '';
- if (lthi.tilesHaveGpuMemoryUsageInfo) {
- var thisTreeUsageInBytes = this.layerTreeImpl_.gpuMemoryUsageInBytes;
- var otherTreeUsageInBytes = lthi.gpuMemoryUsageInBytes -
- thisTreeUsageInBytes;
- message += bytesToRoundedMegabytes(thisTreeUsageInBytes) +
- 'MB on this tree';
- if (otherTreeUsageInBytes) {
- message += ', ' +
- bytesToRoundedMegabytes(otherTreeUsageInBytes) +
- 'MB on the other tree';
- }
- } else {
- if (this.layerTreeImpl_) {
- var thisTreeUsageInBytes = this.layerTreeImpl_.gpuMemoryUsageInBytes;
- message += bytesToRoundedMegabytes(thisTreeUsageInBytes) +
- 'MB on this tree';
-
- if (this.layerTreeImpl_.otherTree) {
- // Older Chromes don't report enough data to know how much memory is
- // being used across both trees. We know the memory consumed by each
- // tree, but there is resource sharing *between the trees* so we
- // can't simply sum up the per-tree costs. We need either the total
- // plus one tree, to guess the unique on the other tree, etc. Newer
- // chromes report memory per tile, which allows LTHI to compute the
- // total tile memory usage, letting us figure things out properly.
- message += ', ???MB on other tree. ';
- }
- }
- }
-
- if (lthi.args.tileManagerBasicState) {
- var tmgs = lthi.args.tileManagerBasicState.globalState;
- message += ' (softMax=' +
- bytesToRoundedMegabytes(tmgs.softMemoryLimitInBytes) +
- 'MB, hardMax=' +
- bytesToRoundedMegabytes(tmgs.hardMemoryLimitInBytes) + 'MB, ' +
- tmgs.memoryLimitPolicy + ')';
-
- } else {
- // Old Chromes do not have a globalState on the LTHI dump.
- // But they do issue a DidManage event wiht the globalstate. Find that
- // event so that we show some global state.
- var thread = lthi.snapshottedOnThread;
- var didManageTilesSlices = thread.sliceGroup.slices.filter(function(s) {
- if (s.category !== 'tr.e.cc')
- return false;
- if (s.title !== 'DidManage')
- return false;
- if (s.end > lthi.ts)
- return false;
- return true;
- });
- didManageTilesSlices.sort(function(x, y) {
- return x.end - y.end;
- });
- if (didManageTilesSlices.length > 0) {
- var newest = didManageTilesSlices[didManageTilesSlices.length - 1];
- var tmgs = newest.args.state.global_state;
- message += ' (softMax=' +
- bytesToRoundedMegabytes(tmgs.soft_memory_limit_in_bytes) +
- 'MB, hardMax=' +
- bytesToRoundedMegabytes(tmgs.hard_memory_limit_in_bytes) + 'MB, ' +
- tmgs.memory_limit_policy + ')';
- }
- }
-
- if (this.layerTreeImpl_.otherTree)
- message += ' (Another tree exists)';
-
-
- if (message.length)
- this.quadStackView_.headerText = message;
- else
- this.quadStackView_.headerText = undefined;
-
- this.updateInfoBar_(status.messages);
- },
-
- updateTilesSelector_: function() {
- var data = createTileRectsSelectorBaseOptions();
-
- if (this.layerTreeImpl_) {
- // First get all of the scales information from LTHI.
- var lthi = this.layerTreeImpl_.layerTreeHostImpl;
- var scaleNames = lthi.getContentsScaleNames();
- for (var scale in scaleNames) {
- data.push({
- label: 'Scale ' + scale + ' (' + scaleNames[scale] + ')',
- value: scale
- });
- }
- }
-
- // Then create a new selector and replace the old one.
- var new_selector = tr.ui.b.createSelector(
- this, 'howToShowTiles',
- 'layerView.howToShowTiles', 'none',
- data);
- this.controls_.replaceChild(new_selector, this.tileRectsSelector_);
- this.tileRectsSelector_ = new_selector;
- },
-
- computePictureLoadingStatus_: function() {
- // Figure out if we can draw the quads yet. While we're at it, figure out
- // if we have any warnings we need to show.
- var layers = this.layers;
- var status = {
- messages: [],
- picturesComplete: true
- };
- if (this.showContents) {
- var hasPendingRasterizeImage = false;
- var firstPictureError = undefined;
- var hasMissingLayerRect = false;
- var hasUnresolvedPictureRef = false;
- for (var i = 0; i < layers.length; i++) {
- var layer = layers[i];
- for (var ir = 0; ir < layer.pictures.length; ++ir) {
- var picture = layer.pictures[ir];
-
- if (picture.idRef) {
- hasUnresolvedPictureRef = true;
- continue;
- }
- if (!picture.layerRect) {
- hasMissingLayerRect = true;
- continue;
- }
-
- var pictureAsImageData = this.pictureAsImageData_[picture.guid];
- if (!pictureAsImageData) {
- hasPendingRasterizeImage = true;
- this.pictureAsImageData_[picture.guid] =
- tr.e.cc.PictureAsImageData.Pending(this);
- picture.rasterize(
- {stopIndex: undefined},
- function(pictureImageData) {
- var picture_ = pictureImageData.picture;
- this.pictureAsImageData_[picture_.guid] = pictureImageData;
- this.scheduleUpdateContents_();
- }.bind(this));
- continue;
- }
- if (pictureAsImageData.isPending()) {
- hasPendingRasterizeImage = true;
- continue;
- }
- if (pictureAsImageData.error) {
- if (!firstPictureError)
- firstPictureError = pictureAsImageData.error;
- break;
- }
- }
- }
- if (hasPendingRasterizeImage) {
- status.picturesComplete = false;
- } else {
- if (hasUnresolvedPictureRef) {
- status.messages.push({
- header: 'Missing picture',
- details: 'Your trace didnt have pictures for every layer. ' +
- 'Old chrome versions had this problem'});
- }
- if (hasMissingLayerRect) {
- status.messages.push({
- header: 'Missing layer rect',
- details: 'Your trace may be corrupt or from a very old ' +
- 'Chrome revision.'});
- }
- if (firstPictureError) {
- status.messages.push({
- header: 'Cannot rasterize',
- details: firstPictureError});
- }
- }
- }
- if (this.showInputEvents && this.layerTreeImpl.tracedInputLatencies &&
- this.inputEventImageData_ === undefined) {
- var image = this.querySelector('#input-event');
- if (!image.src) {
- this.loadDataForImageElement_(image, function(imageData) {
- this.inputEventImageData_ = imageData;
- this.updateContentsPending_ = false;
- this.scheduleUpdateContents_();
- }.bind(this));
- }
- status.picturesComplete = false;
- }
- return status;
- },
-
- get selectedRenderPass() {
- if (this.selection)
- return this.selection.renderPass_;
- },
-
- get selectedLayer() {
- if (this.selection) {
- var selectedLayerId = this.selection.associatedLayerId;
- return this.layerTreeImpl_.findLayerWithId(selectedLayerId);
- }
- },
-
- get renderPasses() {
- var renderPasses =
- this.layerTreeImpl.layerTreeHostImpl.args.frame.renderPasses;
- if (!this.showOtherLayers) {
- var selectedRenderPass = this.selectedRenderPass;
- if (selectedRenderPass)
- renderPasses = [selectedRenderPass];
- }
- return renderPasses;
- },
-
- get layers() {
- var layers = this.layerTreeImpl.renderSurfaceLayerList;
- if (!this.showOtherLayers) {
- var selectedLayer = this.selectedLayer;
- if (selectedLayer)
- layers = [selectedLayer];
- }
- return layers;
- },
-
- appendImageQuads_: function(quads, layer, layerQuad) {
- // Generate image quads for the layer
- for (var ir = 0; ir < layer.pictures.length; ++ir) {
- var picture = layer.pictures[ir];
- if (!picture.layerRect)
- continue;
-
- var unitRect = picture.layerRect.asUVRectInside(layer.bounds);
- var iq = layerQuad.projectUnitRect(unitRect);
-
- var pictureData = this.pictureAsImageData_[picture.guid];
- if (this.showContents && pictureData && pictureData.imageData) {
- iq.imageData = pictureData.imageData;
- iq.borderColor = 'rgba(0,0,0,0)';
- } else {
- iq.imageData = undefined;
- }
-
- iq.stackingGroupId = layerQuad.stackingGroupId;
- quads.push(iq);
- }
- },
-
- appendAnimationQuads_: function(quads, layer, layerQuad) {
- if (!layer.animationBoundsRect)
- return;
-
- var rect = layer.animationBoundsRect;
- var abq = tr.b.Quad.fromRect(rect);
-
- abq.backgroundColor = 'rgba(164,191,48,0.5)';
- abq.borderColor = 'rgba(205,255,0,0.75)';
- abq.borderWidth = 3.0;
- abq.stackingGroupId = layerQuad.stackingGroupId;
- abq.selectionToSetIfClicked = new cc.AnimationRectSelection(
- layer, rect);
- quads.push(abq);
- },
-
- appendInvalidationQuads_: function(quads, layer, layerQuad) {
- if (layer.layerTreeImpl.hasSourceFrameBeenDrawnBefore)
- return;
-
- // Generate the invalidation rect quads.
- for (var ir = 0; ir < layer.annotatedInvalidation.rects.length; ir++) {
- var rect = layer.annotatedInvalidation.rects[ir];
- var unitRect = rect.asUVRectInside(layer.bounds);
- var iq = layerQuad.projectUnitRect(unitRect);
- iq.backgroundColor = 'rgba(0, 255, 0, 0.1)';
- if (rect.reason === 'renderer insertion')
- iq.backgroundColor = 'rgba(0, 255, 128, 0.1)';
- iq.borderColor = 'rgba(0, 255, 0, 1)';
- iq.stackingGroupId = layerQuad.stackingGroupId;
- iq.selectionToSetIfClicked = new cc.LayerRectSelection(
- layer, 'Invalidation rect (' + rect.reason + ')', rect, rect);
- quads.push(iq);
- }
-
- // Show unannotated invalidation rect quads if no annotated rects are
- // available.
- if (layer.annotatedInvalidation.rects.length === 0) {
- for (var ir = 0; ir < layer.invalidation.rects.length; ir++) {
- var rect = layer.invalidation.rects[ir];
- var unitRect = rect.asUVRectInside(layer.bounds);
- var iq = layerQuad.projectUnitRect(unitRect);
- iq.backgroundColor = 'rgba(0, 255, 0, 0.1)';
- iq.borderColor = 'rgba(0, 255, 0, 1)';
- iq.stackingGroupId = layerQuad.stackingGroupId;
- iq.selectionToSetIfClicked = new cc.LayerRectSelection(
- layer, 'Invalidation rect', rect, rect);
- quads.push(iq);
- }
- }
- },
-
- appendUnrecordedRegionQuads_: function(quads, layer, layerQuad) {
- // Generate the unrecorded region quads.
- for (var ir = 0; ir < layer.unrecordedRegion.rects.length; ir++) {
- var rect = layer.unrecordedRegion.rects[ir];
- var unitRect = rect.asUVRectInside(layer.bounds);
- var iq = layerQuad.projectUnitRect(unitRect);
- iq.backgroundColor = 'rgba(240, 230, 140, 0.3)';
- iq.borderColor = 'rgba(240, 230, 140, 1)';
- iq.stackingGroupId = layerQuad.stackingGroupId;
- iq.selectionToSetIfClicked = new cc.LayerRectSelection(
- layer, 'Unrecorded area', rect, rect);
- quads.push(iq);
- }
- },
-
- appendBottleneckQuads_: function(quads, layer, layerQuad, stackingGroupId) {
- function processRegion(region, label, borderColor) {
- var backgroundColor = borderColor.clone();
- backgroundColor.a = 0.4 * (borderColor.a || 1.0);
-
- if (!region || !region.rects)
- return;
-
- for (var ir = 0; ir < region.rects.length; ir++) {
- var rect = region.rects[ir];
- var unitRect = rect.asUVRectInside(layer.bounds);
- var iq = layerQuad.projectUnitRect(unitRect);
- iq.backgroundColor = backgroundColor.toString();
- iq.borderColor = borderColor.toString();
- iq.borderWidth = 4.0;
- iq.stackingGroupId = stackingGroupId;
- iq.selectionToSetIfClicked = new cc.LayerRectSelection(
- layer, label, rect, rect);
- quads.push(iq);
- }
- }
-
- processRegion(layer.touchEventHandlerRegion, 'Touch listener',
- tr.b.Color.fromString('rgb(228, 226, 27)'));
- processRegion(layer.wheelEventHandlerRegion, 'Wheel listener',
- tr.b.Color.fromString('rgb(176, 205, 29)'));
- processRegion(layer.nonFastScrollableRegion, 'Repaints on scroll',
- tr.b.Color.fromString('rgb(213, 134, 32)'));
- },
-
- appendTileCoverageRectQuads_: function(
- quads, layer, layerQuad, heatmapType) {
- if (!layer.tileCoverageRects)
- return;
-
- var tiles = [];
- for (var ct = 0; ct < layer.tileCoverageRects.length; ++ct) {
- var tile = layer.tileCoverageRects[ct].tile;
- if (tile !== undefined)
- tiles.push(tile);
- }
-
- var lthi = this.layerTreeImpl_.layerTreeHostImpl;
- var minMax =
- this.getMinMaxForHeatmap_(lthi.activeTiles, heatmapType);
- var heatmapResult =
- this.computeHeatmapColors_(tiles, minMax, heatmapType);
- var heatIndex = 0;
-
- for (var ct = 0; ct < layer.tileCoverageRects.length; ++ct) {
- var rect = layer.tileCoverageRects[ct].geometryRect;
- rect = rect.scale(1.0 / layer.geometryContentsScale);
-
- var tile = layer.tileCoverageRects[ct].tile;
-
- var unitRect = rect.asUVRectInside(layer.bounds);
- var quad = layerQuad.projectUnitRect(unitRect);
-
- quad.backgroundColor = 'rgba(0, 0, 0, 0)';
- quad.stackingGroupId = layerQuad.stackingGroupId;
- var type = tr.e.cc.tileTypes.missing;
- if (tile) {
- type = tile.getTypeForLayer(layer);
- quad.backgroundColor = heatmapResult[heatIndex].color;
- ++heatIndex;
- }
-
- quad.borderColor = tr.e.cc.tileBorder[type].color;
- quad.borderWidth = tr.e.cc.tileBorder[type].width;
- var label;
- if (tile)
- label = 'coverageRect';
- else
- label = 'checkerboard coverageRect';
- quad.selectionToSetIfClicked = new cc.LayerRectSelection(
- layer, label, rect, layer.tileCoverageRects[ct]);
-
- quads.push(quad);
- }
- },
-
- appendLayoutRectQuads_: function(quads, layer, layerQuad) {
- if (!layer.layoutRects) {
- return;
- }
-
- for (var ct = 0; ct < layer.layoutRects.length; ++ct) {
- var rect = layer.layoutRects[ct].geometryRect;
- rect = rect.scale(1.0 / layer.geometryContentsScale);
-
- var unitRect = rect.asUVRectInside(layer.bounds);
- var quad = layerQuad.projectUnitRect(unitRect);
-
- quad.backgroundColor = 'rgba(0, 0, 0, 0)';
- quad.stackingGroupId = layerQuad.stackingGroupId;
-
- quad.borderColor = 'rgba(0, 0, 200, 0.7)';
- quad.borderWidth = 2;
- var label;
- label = 'Layout rect';
- quad.selectionToSetIfClicked = new cc.LayerRectSelection(
- layer, label, rect);
-
- quads.push(quad);
- }
- },
-
- getValueForHeatmap_: function(tile, heatmapType) {
- if (heatmapType == TILE_HEATMAP_TYPE.SCHEDULED_PRIORITY) {
- return tile.scheduledPriority == 0 ?
- undefined :
- tile.scheduledPriority;
- } else if (heatmapType == TILE_HEATMAP_TYPE.USING_GPU_MEMORY) {
- if (tile.isSolidColor)
- return 0.5;
- return tile.isUsingGpuMemory ? 0 : 1;
- }
- },
-
- getMinMaxForHeatmap_: function(tiles, heatmapType) {
- var range = new tr.b.Range();
- if (heatmapType == TILE_HEATMAP_TYPE.USING_GPU_MEMORY) {
- range.addValue(0);
- range.addValue(1);
- return range;
- }
-
- for (var i = 0; i < tiles.length; ++i) {
- var value = this.getValueForHeatmap_(tiles[i], heatmapType);
- if (value === undefined)
- continue;
- range.addValue(value);
- }
- if (range.range === 0)
- range.addValue(1);
- return range;
- },
-
- computeHeatmapColors_: function(tiles, minMax, heatmapType) {
- var min = minMax.min;
- var max = minMax.max;
-
- var color = function(value) {
- var hue = 120 * (1 - (value - min) / (max - min));
- if (hue < 0)
- hue = 0;
- return 'hsla(' + hue + ', 100%, 50%, 0.5)';
- };
-
- var values = [];
- for (var i = 0; i < tiles.length; ++i) {
- var tile = tiles[i];
- var value = this.getValueForHeatmap_(tile, heatmapType);
- var res = {
- value: value,
- color: value !== undefined ? color(value) : undefined
- };
- values.push(res);
- }
-
- return values;
- },
-
- appendTilesWithScaleQuads_: function(
- quads, layer, layerQuad, scale, heatmapType) {
- var lthi = this.layerTreeImpl_.layerTreeHostImpl;
-
- var tiles = [];
- for (var i = 0; i < lthi.activeTiles.length; ++i) {
- var tile = lthi.activeTiles[i];
-
- if (Math.abs(tile.contentsScale - scale) > 1e-6)
- continue;
-
- // TODO(vmpstr): Make the stiching of tiles and layers a part of
- // tile construction (issue 346)
- if (layer.layerId != tile.layerId)
- continue;
-
- tiles.push(tile);
- }
-
- var minMax =
- this.getMinMaxForHeatmap_(lthi.activeTiles, heatmapType);
- var heatmapResult =
- this.computeHeatmapColors_(tiles, minMax, heatmapType);
-
- for (var i = 0; i < tiles.length; ++i) {
- var tile = tiles[i];
- var rect = tile.layerRect;
- if (!tile.layerRect)
- continue;
- var unitRect = rect.asUVRectInside(layer.bounds);
- var quad = layerQuad.projectUnitRect(unitRect);
-
- quad.backgroundColor = 'rgba(0, 0, 0, 0)';
- quad.stackingGroupId = layerQuad.stackingGroupId;
-
- var type = tile.getTypeForLayer(layer);
- quad.borderColor = tr.e.cc.tileBorder[type].color;
- quad.borderWidth = tr.e.cc.tileBorder[type].width;
-
- quad.backgroundColor = heatmapResult[i].color;
- var data = {
- tileType: type
- };
- if (heatmapType !== TILE_HEATMAP_TYPE.NONE)
- data[heatmapType] = heatmapResult[i].value;
- quad.selectionToSetIfClicked = new cc.TileSelection(tile, data);
- quads.push(quad);
- }
- },
-
- appendHighlightQuadsForLayer_: function(
- quads, layer, layerQuad, highlights) {
- highlights.forEach(function(highlight) {
- var rect = highlight.rect;
-
- var unitRect = rect.asUVRectInside(layer.bounds);
- var quad = layerQuad.projectUnitRect(unitRect);
-
- var colorId = ColorScheme.getColorIdForGeneralPurposeString(
- highlight.colorKey);
- colorId += ColorScheme.properties.brightenedOffsets[0];
-
- var color = ColorScheme.colors[colorId];
-
- var quadForDrawing = quad.clone();
- quadForDrawing.backgroundColor = color.withAlpha(0.5).toString();
- quadForDrawing.borderColor = color.withAlpha(1.0).darken().toString();
- quadForDrawing.stackingGroupId = layerQuad.stackingGroupId;
- quads.push(quadForDrawing);
-
- }, this);
- },
-
- generateRenderPassQuads: function() {
- if (!this.layerTreeImpl.layerTreeHostImpl.args.frame)
- return [];
- var renderPasses = this.renderPasses;
- if (!renderPasses)
- return [];
-
- var quads = [];
- for (var i = 0; i < renderPasses.length; ++i) {
- var quadList = renderPasses[i].quadList;
- for (var j = 0; j < quadList.length; ++j) {
- var drawQuad = quadList[j];
- var quad = drawQuad.rectAsTargetSpaceQuad.clone();
- quad.borderColor = 'rgb(170, 204, 238)';
- quad.borderWidth = 2;
- quad.stackingGroupId = i;
- quads.push(quad);
- }
- }
- return quads;
- },
-
- generateLayerQuads: function() {
- this.updateContentsPending_ = false;
-
- // Generate the quads for the view.
- var layers = this.layers;
- var quads = [];
- var nextStackingGroupId = 0;
- var alreadyVisitedLayerIds = {};
-
-
- var selectionHighlightsByLayerId;
- if (this.selection)
- selectionHighlightsByLayerId = this.selection.highlightsByLayerId;
- else
- selectionHighlightsByLayerId = {};
-
- var extraHighlightsByLayerId = this.extraHighlightsByLayerId || {};
-
- for (var i = 1; i <= layers.length; i++) {
- // Generate quads back-to-front.
- var layer = layers[layers.length - i];
- alreadyVisitedLayerIds[layer.layerId] = true;
- if (layer.objectInstance.name == 'cc::NinePatchLayerImpl')
- continue;
-
- var layerQuad = layer.layerQuad.clone();
- if (layer.usingGpuRasterization) {
- var pixelRatio = window.devicePixelRatio || 1;
- layerQuad.borderWidth = 2.0 * pixelRatio;
- layerQuad.borderColor = 'rgba(154,205,50,0.75)';
- } else {
- layerQuad.borderColor = 'rgba(0,0,0,0.75)';
- }
- layerQuad.stackingGroupId = nextStackingGroupId++;
- layerQuad.selectionToSetIfClicked = new cc.LayerSelection(layer);
- layerQuad.layer = layer;
- if (this.showOtherLayers && this.selectedLayer == layer)
- layerQuad.upperBorderColor = 'rgb(156,189,45)';
-
- if (this.showAnimationBounds)
- this.appendAnimationQuads_(quads, layer, layerQuad);
-
- this.appendImageQuads_(quads, layer, layerQuad);
- quads.push(layerQuad);
-
-
- if (this.showInvalidations)
- this.appendInvalidationQuads_(quads, layer, layerQuad);
- if (this.showUnrecordedRegion)
- this.appendUnrecordedRegionQuads_(quads, layer, layerQuad);
- if (this.showBottlenecks)
- this.appendBottleneckQuads_(quads, layer, layerQuad,
- layerQuad.stackingGroupId);
- if (this.showLayoutRects)
- this.appendLayoutRectQuads_(quads, layer, layerQuad);
-
- if (this.howToShowTiles === 'coverage') {
- this.appendTileCoverageRectQuads_(
- quads, layer, layerQuad, this.tileHeatmapType);
- } else if (this.howToShowTiles !== 'none') {
- this.appendTilesWithScaleQuads_(
- quads, layer, layerQuad,
- this.howToShowTiles, this.tileHeatmapType);
- }
-
- var highlights;
- highlights = extraHighlightsByLayerId[layer.layerId];
- if (highlights) {
- this.appendHighlightQuadsForLayer_(
- quads, layer, layerQuad, highlights);
- }
-
- highlights = selectionHighlightsByLayerId[layer.layerId];
- if (highlights) {
- this.appendHighlightQuadsForLayer_(
- quads, layer, layerQuad, highlights);
- }
- }
-
- this.layerTreeImpl.iterLayers(function(layer, depth, isMask, isReplica) {
- if (!this.showOtherLayers && this.selectedLayer != layer)
- return;
- if (alreadyVisitedLayerIds[layer.layerId])
- return;
- var layerQuad = layer.layerQuad;
- var stackingGroupId = nextStackingGroupId++;
- if (this.showBottlenecks)
- this.appendBottleneckQuads_(quads, layer, layerQuad, stackingGroupId);
- }, this);
-
- var tracedInputLatencies = this.layerTreeImpl.tracedInputLatencies;
- if (this.showInputEvents && tracedInputLatencies) {
- for (var i = 0; i < tracedInputLatencies.length; i++) {
- var coordinatesArray = tracedInputLatencies[i].args.data.coordinates;
- for (var j = 0; j < coordinatesArray.length; j++) {
- var inputQuad = tr.b.Quad.fromXYWH(
- coordinatesArray[j].x - 25,
- coordinatesArray[j].y - 25,
- 50,
- 50);
- inputQuad.borderColor = 'rgba(0, 0, 0, 0)';
- inputQuad.imageData = this.inputEventImageData_;
- quads.push(inputQuad);
- }
- }
- }
-
- return quads;
- },
-
- updateInfoBar_: function(infoBarMessages) {
- if (infoBarMessages.length) {
- this.infoBar_.removeAllButtons();
- this.infoBar_.message = 'Some problems were encountered...';
- this.infoBar_.addButton('More info...', function(e) {
- var overlay = new tr.ui.b.Overlay();
- overlay.textContent = '';
- infoBarMessages.forEach(function(message) {
- var title = document.createElement('h3');
- title.textContent = message.header;
-
- var details = document.createElement('div');
- details.textContent = message.details;
-
- overlay.appendChild(title);
- overlay.appendChild(details);
- });
- overlay.visible = true;
-
- e.stopPropagation();
- return false;
- });
- this.infoBar_.visible = true;
- } else {
- this.infoBar_.removeAllButtons();
- this.infoBar_.message = '';
- this.infoBar_.visible = false;
- }
- },
-
- getWhatRasterized_: function() {
- var lthi = this.layerTreeImpl_.layerTreeHostImpl;
- var renderProcess = lthi.objectInstance.parent;
- var tasks = [];
- for (var event of renderProcess.getDescendantEvents()) {
- if (!(event instanceof tr.model.Slice))
- continue;
-
- var tile = tr.e.cc.getTileFromRasterTaskSlice(event);
- if (tile === undefined)
- continue;
-
- if (tile.containingSnapshot == lthi)
- tasks.push(event);
- }
- return tasks;
- },
-
- updateWhatRasterizedLinkState_: function() {
- var tasks = this.getWhatRasterized_();
- if (tasks.length) {
- this.whatRasterizedLink_.textContent = tasks.length + ' raster tasks';
- this.whatRasterizedLink_.style.display = '';
- } else {
- this.whatRasterizedLink_.textContent = '';
- this.whatRasterizedLink_.style.display = 'none';
- }
- },
-
- onWhatRasterizedLinkClicked_: function() {
- var tasks = this.getWhatRasterized_();
- var event = new tr.model.RequestSelectionChangeEvent();
- event.selection = new tr.model.EventSet(tasks);
- this.dispatchEvent(event);
- }
- };
-
- return {
- LayerTreeQuadStackView: LayerTreeQuadStackView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_quad_stack_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_quad_stack_view_test.html
deleted file mode 100644
index 50c6477c142..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_tree_quad_stack_view_test.html
+++ /dev/null
@@ -1,49 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/cc.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/layer_tree_quad_stack_view.html">
-
-<script src="/tracing/extras/chrome/cc/layer_tree_host_impl_test_data.js">
-</script>
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('tileCoverageRectCount', function() {
- var m = tr.c.TestUtils.newModelWithEvents([g_catLTHIEvents]);
- var p = m.processes[1];
-
- var instance = p.objects.getAllInstancesNamed('cc::LayerTreeHostImpl')[0];
- var lthi = instance.snapshots[0];
- var numLayers = lthi.activeTree.renderSurfaceLayerList.length;
- var layer = lthi.activeTree.renderSurfaceLayerList[numLayers - 1];
-
- var view = new tr.ui.e.chrome.cc.LayerTreeQuadStackView();
- view.layerTreeImpl = lthi.activeTree;
- view.selection = new tr.ui.e.chrome.cc.LayerSelection(layer);
- view.howToShowTiles = 'none';
- view.showInvalidations = false;
- view.showContents = false;
- view.showOtherLAyers = false;
-
- // There should be some quads drawn with all "show" checkboxes off,
- // but that number can change with new features added.
- var aQuads = view.generateLayerQuads();
- view.howToShowTiles = 'coverage';
- var bQuads = view.generateLayerQuads();
- var numCoverageRects = bQuads.length - aQuads.length;
-
- // We know we have 5 coverage rects in lthi cats.
- assert.equal(numCoverageRects, 5);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_view.css b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_view.css
deleted file mode 100644
index 612dbc2eb9a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_view.css
+++ /dev/null
@@ -1,31 +0,0 @@
-/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-* /deep/ tr-ui-e-chrome-cc-layer-view {
- -webkit-flex-direction: column;
- display: -webkit-flex;
- left: 0;
- position: relative;
- top: 0;
-}
-
-* /deep/ tr-ui-e-chrome-cc-layer-view >
- tr-ui-e-chrome-cc-layer-tree-quad-stack-view {
- -webkit-flex: 1 1 100%;
- -webkit-flex-direction: column;
- min-height: 0;
- display: -webkit-flex;
- width: 100%;
-}
-
-* /deep/tr-ui-e-chrome-cc- layer-view > tr-ui-e-chrome-cc-layer-view-analysis {
- height: 150px; /* fixed height given by drag control */
- overflow-y: auto;
-}
-
-* /deep/ tr-ui-e-chrome-cc-layer-view >
- tr-ui-e-chrome-cc-layer-view-analysis * {
- -webkit-user-select: text;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_view.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_view.html
deleted file mode 100644
index ab2a403283b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_view.html
+++ /dev/null
@@ -1,149 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/extras/chrome/cc/layer_view.css">
-
-<link rel="import" href="/tracing/base/raf.html">
-<link rel="import" href="/tracing/base/settings.html">
-<link rel="import" href="/tracing/extras/chrome/cc/constants.html">
-<link rel="import" href="/tracing/extras/chrome/cc/picture.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/base/drag_handle.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/layer_tree_quad_stack_view.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview LayerView coordinates graphical and analysis views of layers.
- */
-
-tr.exportTo('tr.ui.e.chrome.cc', function() {
- var constants = tr.e.cc.constants;
-
- /**
- * @constructor
- */
- var LayerView = tr.ui.b.define('tr-ui-e-chrome-cc-layer-view');
-
- LayerView.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.layerTreeQuadStackView_ =
- new tr.ui.e.chrome.cc.LayerTreeQuadStackView();
- this.dragBar_ = document.createElement('tr-ui-b-drag-handle');
- this.analysisEl_ =
- document.createElement('tr-ui-e-chrome-cc-layer-view-analysis');
- this.analysisEl_.addEventListener('requestSelectionChange',
- this.onRequestSelectionChangeFromAnalysisEl_.bind(this));
-
- this.dragBar_.target = this.analysisEl_;
-
- this.appendChild(this.layerTreeQuadStackView_);
- this.appendChild(this.dragBar_);
- this.appendChild(this.analysisEl_);
-
- this.layerTreeQuadStackView_.addEventListener('selection-change',
- function() {
- this.layerTreeQuadStackViewSelectionChanged_();
- }.bind(this));
- this.layerTreeQuadStackViewSelectionChanged_();
- },
-
- get layerTreeImpl() {
- return this.layerTreeQuadStackView_.layerTreeImpl;
- },
-
- set layerTreeImpl(newValue) {
- return this.layerTreeQuadStackView_.layerTreeImpl = newValue;
- },
-
- set isRenderPassQuads(newValue) {
- return this.layerTreeQuadStackView_.isRenderPassQuads = newValue;
- },
-
- get selection() {
- return this.layerTreeQuadStackView_.selection;
- },
-
- set selection(newValue) {
- this.layerTreeQuadStackView_.selection = newValue;
- },
-
- regenerateContent: function() {
- this.layerTreeQuadStackView_.regenerateContent();
- },
-
- layerTreeQuadStackViewSelectionChanged_: function() {
- var selection = this.layerTreeQuadStackView_.selection;
- if (selection) {
- this.dragBar_.style.display = '';
- this.analysisEl_.style.display = '';
- this.analysisEl_.textContent = '';
-
- var layer = selection.layer;
- if (layer && layer.args && layer.args.pictures) {
- this.analysisEl_.appendChild(
- this.createPictureBtn_(layer.args.pictures));
- }
-
- var analysis = selection.createAnalysis();
- this.analysisEl_.appendChild(analysis);
- } else {
- this.dragBar_.style.display = 'none';
- this.analysisEl_.style.display = 'none';
- var analysis = this.analysisEl_.firstChild;
- if (analysis)
- this.analysisEl_.removeChild(analysis);
- this.layerTreeQuadStackView_.style.height =
- window.getComputedStyle(this).height;
- }
- tr.b.dispatchSimpleEvent(this, 'selection-change');
- },
-
- createPictureBtn_: function(pictures) {
- if (!(pictures instanceof Array))
- pictures = [pictures];
-
- var link = document.createElement('tr-ui-a-analysis-link');
- link.selection = function() {
- var layeredPicture = new tr.e.cc.LayeredPicture(pictures);
- var snapshot = new tr.e.cc.PictureSnapshot(layeredPicture);
- snapshot.picture = layeredPicture;
-
- var selection = new tr.model.EventSet();
- selection.push(snapshot);
- return selection;
- };
- link.textContent = 'View in Picture Debugger';
- return link;
- },
-
- onRequestSelectionChangeFromAnalysisEl_: function(e) {
- if (!(e.selection instanceof tr.ui.e.chrome.cc.Selection))
- return;
-
- e.stopPropagation();
- this.selection = e.selection;
- },
-
- get extraHighlightsByLayerId() {
- return this.layerTreeQuadStackView_.extraHighlightsByLayerId;
- },
-
- set extraHighlightsByLayerId(extraHighlightsByLayerId) {
- this.layerTreeQuadStackView_.extraHighlightsByLayerId =
- extraHighlightsByLayerId;
- }
- };
-
- return {
- LayerView: LayerView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_view_test.html
deleted file mode 100644
index a4bcab78785..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/layer_view_test.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/cc.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/layer_view.html">
-
-<script src="/tracing/extras/chrome/cc/layer_tree_host_impl_test_data.js">
-</script>
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var m = tr.c.TestUtils.newModelWithEvents([g_catLTHIEvents]);
- var p = m.processes[1];
-
- var instance = p.objects.getAllInstancesNamed('cc::LayerTreeHostImpl')[0];
- var lthi = instance.snapshots[0];
- var numLayers = lthi.activeTree.renderSurfaceLayerList.length;
- var layer = lthi.activeTree.renderSurfaceLayerList[numLayers - 1];
-
- var view = new tr.ui.e.chrome.cc.LayerView();
- view.style.height = '500px';
- view.layerTreeImpl = lthi.activeTree;
- view.selection = new tr.ui.e.chrome.cc.LayerSelection(layer);
-
- this.addHTMLOutput(view);
- });
-
- test('instantiate_withTileHighlight', function() {
- var m = tr.c.TestUtils.newModelWithEvents([g_catLTHIEvents]);
- var p = m.processes[1];
-
- var instance = p.objects.getAllInstancesNamed('cc::LayerTreeHostImpl')[0];
- var lthi = instance.snapshots[0];
- var numLayers = lthi.activeTree.renderSurfaceLayerList.length;
- var layer = lthi.activeTree.renderSurfaceLayerList[numLayers - 1];
- var tile = lthi.activeTiles[0];
-
- var view = new tr.ui.e.chrome.cc.LayerView();
- view.style.height = '500px';
- view.layerTreeImpl = lthi.activeTree;
- view.selection = new tr.ui.e.chrome.cc.TileSelection(tile);
- this.addHTMLOutput(view);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_debugger.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_debugger.html
deleted file mode 100644
index 28d51d16d93..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_debugger.html
+++ /dev/null
@@ -1,495 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base64.html">
-<link rel="import" href="/tracing/extras/chrome/cc/picture.html">
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-<link rel="import" href="/tracing/ui/base/drag_handle.html">
-<link rel="import" href="/tracing/ui/base/info_bar.html">
-<link rel="import" href="/tracing/ui/base/hotkey_controller.html">
-<link rel="import" href="/tracing/ui/base/list_view.html">
-<link rel="import" href="/tracing/ui/base/mouse_mode_selector.html">
-<link rel="import" href="/tracing/ui/base/overlay.html">
-<link rel="import" href="/tracing/ui/base/utils.html">
-<link rel="import"
- href="/tracing/ui/extras/chrome/cc/picture_ops_chart_summary_view.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/picture_ops_chart_view.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/picture_ops_list_view.html">
-
-<template id="tr-ui-e-chrome-cc-picture-debugger-template">
- <style>
- * /deep/ tr-ui-e-chrome-cc-picture-debugger {
- -webkit-flex: 1 1 auto;
- -webkit-flex-direction: row;
- display: -webkit-flex;
- }
-
- * /deep/ tr-ui-e-chrome-cc-picture-debugger > tr-ui-a-generic-object-view {
- -webkit-flex-direction: column;
- display: -webkit-flex;
- width: 400px;
- }
-
- * /deep/ tr-ui-e-chrome-cc-picture-debugger > left-panel {
- -webkit-flex-direction: column;
- display: -webkit-flex;
- min-width: 300px;
- }
-
- * /deep/ tr-ui-e-chrome-cc-picture-debugger > left-panel > picture-info {
- -webkit-flex: 0 0 auto;
- padding-top: 2px;
- }
-
- * /deep/ tr-ui-e-chrome-cc-picture-debugger > left-panel >
- picture-info .title {
- font-weight: bold;
- margin-left: 5px;
- margin-right: 5px;
- }
-
- * /deep/ tr-ui-e-chrome-cc-picture-debugger > tr-ui-b-drag-handle {
- -webkit-flex: 0 0 auto;
- }
-
- * /deep/ tr-ui-e-chrome-cc-picture-debugger .filename {
- -webkit-user-select: text;
- margin-left: 5px;
- }
-
- * /deep/ tr-ui-e-chrome-cc-picture-debugger > right-panel {
- -webkit-flex: 1 1 auto;
- -webkit-flex-direction: column;
- display: -webkit-flex;
- }
-
- * /deep/ tr-ui-e-chrome-cc-picture-debugger > right-panel >
- tr-ui-e-chrome-cc-picture-ops-chart-view {
- min-height: 150px;
- min-width : 0;
- overflow-x: auto;
- overflow-y: hidden;
- }
-
- /*************************************************/
-
- * /deep/ tr-ui-e-chrome-cc-picture-debugger raster-area {
- background-color: #ddd;
- min-height: 200px;
- min-width: 200px;
- overflow-y: auto;
- padding-left: 5px;
- }
- </style>
-
- <left-panel>
- <picture-info>
- <div>
- <span class='title'>Skia Picture</span>
- <span class='size'></span>
- </div>
- <div>
- <input class='filename' type='text' value='skpicture.skp' />
- <button class='export'>Export</button>
- </div>
- </picture-info>
- </left-panel>
- <right-panel>
- <tr-ui-e-chrome-cc-picture-ops-chart-view>
- </tr-ui-e-chrome-cc-picture-ops-chart-view>
- <raster-area><canvas></canvas></raster-area>
- </right-panel>
-</template>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.chrome.cc', function() {
- var THIS_DOC = document.currentScript.ownerDocument;
-
- /**
- * PictureDebugger is a view of a PictureSnapshot for inspecting
- * the picture in detail. (e.g., timing information, etc.)
- *
- * @constructor
- */
- var PictureDebugger = tr.ui.b.define('tr-ui-e-chrome-cc-picture-debugger');
-
- PictureDebugger.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- var node = tr.ui.b.instantiateTemplate(
- '#tr-ui-e-chrome-cc-picture-debugger-template', THIS_DOC);
-
- this.appendChild(node);
-
- this.pictureAsImageData_ = undefined;
- this.showOverdraw_ = false;
- this.zoomScaleValue_ = 1;
-
- this.sizeInfo_ = this.querySelector('.size');
- this.rasterArea_ = this.querySelector('raster-area');
- this.rasterCanvas_ = this.rasterArea_.querySelector('canvas');
- this.rasterCtx_ = this.rasterCanvas_.getContext('2d');
-
- this.filename_ = this.querySelector('.filename');
-
- this.drawOpsChartSummaryView_ =
- new tr.ui.e.chrome.cc.PictureOpsChartSummaryView();
- this.drawOpsChartView_ = new tr.ui.e.chrome.cc.PictureOpsChartView();
- this.drawOpsChartView_.addEventListener(
- 'selection-changed', this.onChartBarClicked_.bind(this));
-
- this.exportButton_ = this.querySelector('.export');
- this.exportButton_.addEventListener(
- 'click', this.onSaveAsSkPictureClicked_.bind(this));
-
- this.trackMouse_();
-
- var overdrawCheckbox = tr.ui.b.createCheckBox(
- this, 'showOverdraw',
- 'pictureView.showOverdraw', false,
- 'Show overdraw');
-
- var chartCheckbox = tr.ui.b.createCheckBox(
- this, 'showSummaryChart',
- 'pictureView.showSummaryChart', false,
- 'Show timing summary');
-
- var pictureInfo = this.querySelector('picture-info');
- pictureInfo.appendChild(overdrawCheckbox);
- pictureInfo.appendChild(chartCheckbox);
-
- this.drawOpsView_ = new tr.ui.e.chrome.cc.PictureOpsListView();
- this.drawOpsView_.addEventListener(
- 'selection-changed', this.onChangeDrawOps_.bind(this));
-
- var leftPanel = this.querySelector('left-panel');
- leftPanel.appendChild(this.drawOpsChartSummaryView_);
- leftPanel.appendChild(this.drawOpsView_);
-
- var middleDragHandle = document.createElement('tr-ui-b-drag-handle');
- middleDragHandle.horizontal = false;
- middleDragHandle.target = leftPanel;
-
- var rightPanel = this.querySelector('right-panel');
- rightPanel.replaceChild(
- this.drawOpsChartView_,
- rightPanel.querySelector('tr-ui-e-chrome-cc-picture-ops-chart-view'));
-
- this.infoBar_ = document.createElement('tr-ui-b-info-bar');
- this.rasterArea_.appendChild(this.infoBar_);
-
- this.insertBefore(middleDragHandle, rightPanel);
-
- this.picture_ = undefined;
-
- var hkc = document.createElement('tv-ui-b-hotkey-controller');
- hkc.addHotKey(new tr.ui.b.HotKey({
- eventType: 'keypress',
- thisArg: this,
- keyCode: 'h'.charCodeAt(0),
- callback: function(e) {
- this.moveSelectedOpBy(-1);
- e.stopPropagation();
- }
- }));
- hkc.addHotKey(new tr.ui.b.HotKey({
- eventType: 'keypress',
- thisArg: this,
- keyCode: 'l'.charCodeAt(0),
- callback: function(e) {
- this.moveSelectedOpBy(1);
- e.stopPropagation();
- }
- }));
- this.appendChild(hkc);
-
- // Add a mutation observer so that when the view is resized we can
- // update the chart summary view.
- this.mutationObserver_ = new MutationObserver(
- this.onMutation_.bind(this));
- this.mutationObserver_.observe(leftPanel, { attributes: true });
- },
-
- onMutation_: function(mutations) {
-
- for (var m = 0; m < mutations.length; m++) {
- // A style change would indicate that the element has resized
- // so we should re-render the chart.
- if (mutations[m].attributeName === 'style') {
- this.drawOpsChartSummaryView_.requiresRedraw = true;
- this.drawOpsChartSummaryView_.updateChartContents();
-
- this.drawOpsChartView_.dimensionsHaveChanged = true;
- this.drawOpsChartView_.updateChartContents();
- break;
- }
- }
- },
-
- onSaveAsSkPictureClicked_: function() {
- // Decode base64 data into a String
- var rawData = tr.b.Base64.atob(this.picture_.getBase64SkpData());
-
- // Convert this String into an Uint8Array
- var length = rawData.length;
- var arrayBuffer = new ArrayBuffer(length);
- var uint8Array = new Uint8Array(arrayBuffer);
- for (var c = 0; c < length; c++)
- uint8Array[c] = rawData.charCodeAt(c);
-
- // Create a blob URL from the binary array.
- var blob = new Blob([uint8Array], {type: 'application/octet-binary'});
- var blobUrl = window.webkitURL.createObjectURL(blob);
-
- // Create a link and click on it. BEST API EVAR!
- var link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
- link.href = blobUrl;
- link.download = this.filename_.value;
- var event = document.createEvent('MouseEvents');
- event.initMouseEvent(
- 'click', true, false, window, 0, 0, 0, 0, 0,
- false, false, false, false, 0, null);
- link.dispatchEvent(event);
- },
-
- get picture() {
- return this.picture_;
- },
-
- set picture(picture) {
- this.drawOpsView_.picture = picture;
- this.drawOpsChartView_.picture = picture;
- this.drawOpsChartSummaryView_.picture = picture;
- this.picture_ = picture;
-
- this.exportButton_.disabled = !this.picture_.canSave;
-
- if (picture) {
- var size = this.getRasterCanvasSize_();
- this.rasterCanvas_.width = size.width;
- this.rasterCanvas_.height = size.height;
- }
-
- var bounds = this.rasterArea_.getBoundingClientRect();
- var selectorBounds = this.mouseModeSelector_.getBoundingClientRect();
- this.mouseModeSelector_.pos = {
- x: (bounds.right - selectorBounds.width - 10),
- y: bounds.top
- };
-
- this.rasterize_();
-
- this.scheduleUpdateContents_();
- },
-
- getRasterCanvasSize_: function() {
- var style = window.getComputedStyle(this.rasterArea_);
- var width =
- Math.max(parseInt(style.width), this.picture_.layerRect.width);
- var height =
- Math.max(parseInt(style.height), this.picture_.layerRect.height);
-
- return {
- width: width,
- height: height
- };
- },
-
- scheduleUpdateContents_: function() {
- if (this.updateContentsPending_)
- return;
- this.updateContentsPending_ = true;
- tr.b.requestAnimationFrameInThisFrameIfPossible(
- this.updateContents_.bind(this)
- );
- },
-
- updateContents_: function() {
- this.updateContentsPending_ = false;
-
- if (this.picture_) {
- this.sizeInfo_.textContent = '(' +
- this.picture_.layerRect.width + ' x ' +
- this.picture_.layerRect.height + ')';
- }
-
- this.drawOpsChartView_.updateChartContents();
- this.drawOpsChartView_.scrollSelectedItemIntoViewIfNecessary();
-
- // Return if picture hasn't finished rasterizing.
- if (!this.pictureAsImageData_)
- return;
-
- this.infoBar_.visible = false;
- this.infoBar_.removeAllButtons();
- if (this.pictureAsImageData_.error) {
- this.infoBar_.message = 'Cannot rasterize...';
- this.infoBar_.addButton('More info...', function(e) {
- var overlay = new tr.ui.b.Overlay();
- overlay.textContent = this.pictureAsImageData_.error;
- overlay.visible = true;
- e.stopPropagation();
- return false;
- }.bind(this));
- this.infoBar_.visible = true;
- }
-
- this.drawPicture_();
- },
-
- drawPicture_: function() {
- var size = this.getRasterCanvasSize_();
- if (size.width !== this.rasterCanvas_.width)
- this.rasterCanvas_.width = size.width;
- if (size.height !== this.rasterCanvas_.height)
- this.rasterCanvas_.height = size.height;
-
- this.rasterCtx_.clearRect(0, 0, size.width, size.height);
-
- if (!this.pictureAsImageData_.imageData)
- return;
-
- var imgCanvas = this.pictureAsImageData_.asCanvas();
- var w = imgCanvas.width;
- var h = imgCanvas.height;
- this.rasterCtx_.drawImage(imgCanvas, 0, 0, w, h,
- 0, 0, w * this.zoomScaleValue_,
- h * this.zoomScaleValue_);
- },
-
- rasterize_: function() {
- if (this.picture_) {
- this.picture_.rasterize(
- {
- stopIndex: this.drawOpsView_.selectedOpIndex,
- showOverdraw: this.showOverdraw_
- },
- this.onRasterComplete_.bind(this));
- }
- },
-
- onRasterComplete_: function(pictureAsImageData) {
- this.pictureAsImageData_ = pictureAsImageData;
- this.scheduleUpdateContents_();
- },
-
- moveSelectedOpBy: function(increment) {
- if (this.selectedOpIndex === undefined) {
- this.selectedOpIndex = 0;
- return;
- }
- this.selectedOpIndex = tr.b.clamp(
- this.selectedOpIndex + increment,
- 0, this.numOps);
- },
-
- get numOps() {
- return this.drawOpsView_.numOps;
- },
-
- get selectedOpIndex() {
- return this.drawOpsView_.selectedOpIndex;
- },
-
- set selectedOpIndex(index) {
- this.drawOpsView_.selectedOpIndex = index;
- this.drawOpsChartView_.selectedOpIndex = index;
- },
-
- onChartBarClicked_: function(e) {
- this.drawOpsView_.selectedOpIndex =
- this.drawOpsChartView_.selectedOpIndex;
- },
-
- onChangeDrawOps_: function(e) {
- this.rasterize_();
- this.scheduleUpdateContents_();
-
- this.drawOpsChartView_.selectedOpIndex =
- this.drawOpsView_.selectedOpIndex;
- },
-
- set showOverdraw(v) {
- this.showOverdraw_ = v;
- this.rasterize_();
- },
-
- set showSummaryChart(chartShouldBeVisible) {
- if (chartShouldBeVisible)
- this.drawOpsChartSummaryView_.show();
- else
- this.drawOpsChartSummaryView_.hide();
- },
-
- trackMouse_: function() {
- this.mouseModeSelector_ = document.createElement(
- 'tr-ui-b-mouse-mode-selector');
- this.mouseModeSelector_.targetElement = this.rasterArea_;
- this.rasterArea_.appendChild(this.mouseModeSelector_);
-
- this.mouseModeSelector_.supportedModeMask =
- tr.ui.b.MOUSE_SELECTOR_MODE.ZOOM;
- this.mouseModeSelector_.mode = tr.ui.b.MOUSE_SELECTOR_MODE.ZOOM;
- this.mouseModeSelector_.defaultMode = tr.ui.b.MOUSE_SELECTOR_MODE.ZOOM;
- this.mouseModeSelector_.settingsKey = 'pictureDebugger.mouseModeSelector';
-
- this.mouseModeSelector_.addEventListener('beginzoom',
- this.onBeginZoom_.bind(this));
- this.mouseModeSelector_.addEventListener('updatezoom',
- this.onUpdateZoom_.bind(this));
- this.mouseModeSelector_.addEventListener('endzoom',
- this.onEndZoom_.bind(this));
- },
-
- onBeginZoom_: function(e) {
- this.isZooming_ = true;
-
- this.lastMouseViewPos_ = this.extractRelativeMousePosition_(e);
-
- e.preventDefault();
- },
-
- onUpdateZoom_: function(e) {
- if (!this.isZooming_)
- return;
-
- var currentMouseViewPos = this.extractRelativeMousePosition_(e);
-
- // Take the distance the mouse has moved and we want to zoom at about
- // 1/1000th of that speed. 0.01 feels jumpy. This could possibly be tuned
- // more if people feel it's too slow.
- this.zoomScaleValue_ +=
- ((this.lastMouseViewPos_.y - currentMouseViewPos.y) * 0.001);
- this.zoomScaleValue_ = Math.max(this.zoomScaleValue_, 0.1);
-
- this.drawPicture_();
-
- this.lastMouseViewPos_ = currentMouseViewPos;
- },
-
- onEndZoom_: function(e) {
- this.lastMouseViewPos_ = undefined;
- this.isZooming_ = false;
- e.preventDefault();
- },
-
- extractRelativeMousePosition_: function(e) {
- return {
- x: e.clientX - this.rasterArea_.offsetLeft,
- y: e.clientY - this.rasterArea_.offsetTop
- };
- }
- };
-
- return {
- PictureDebugger: PictureDebugger
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_debugger_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_debugger_test.html
deleted file mode 100644
index 1237fb6a29c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_debugger_test.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/cc/picture.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/picture_debugger.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var picture = new tr.e.cc.PictureSnapshot({id: '31415'}, 10, {
- 'params': {
- 'opaque_rect': [-15, -15, 0, 0],
- 'layer_rect': [-15, -15, 46, 833]
- },
- 'skp64': 'DAAAAHYEAADzAQAABwAAAAFkYWVy8AAAAAgAAB4DAAAADAAAIAAAgD8AAIA/CAAAHgMAAAAcAAADAAAAAAAAAAAAwI5EAID5QwEAAADoAAAACAAAHgMAAAAMAAAjAAAAAAAAAAAMAAAjAAAAAAAAAAAcAAADAAAAAAAAAAAAwI5EAID5QwEAAADkAAAAGAAAFQEAAAAAAAAAAAAAAADAjkQAgPlDGAAAFQIAAAAAAAAAAAAAAADAjkQAgPlDCAAAHgMAAAAcAAADAAAAAAAAAAAAwI5EAID5QwEAAADgAAAAGAAAFQMAAAAAAKBAAACgQAAAgEIAAIBCBAAAHAQAABwEAAAcBAAAHHRjYWYBAAAADVNrU3JjWGZlcm1vZGVjZnB0AAAAAHlhcmGgAAAAIHRucAMAAAAAAEBBAACAPwAAAAAAAIA/AAAAAAAAgEAAAP//ADABAAAAAAAAAEBBAACAPwAAAAAAAIA/AAAAAAAAgED/////AjABAAAAAAAAAAAAAAAAAAEAAAAEAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQEEAAIA/AAAAAAAAgD8AAAAAAACAQP8AAP8AMAEAAAAAACBmb2U=' // @suppress longLineCheck
- });
- picture.preInitialize();
- picture.initialize();
-
- var dbg = new tr.ui.e.chrome.cc.PictureDebugger();
- this.addHTMLOutput(dbg);
- dbg.picture = picture;
- dbg.style.border = '1px solid black';
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_summary_view.css b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_summary_view.css
deleted file mode 100644
index fdc93e54c60..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_summary_view.css
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-* /deep/ tr-ui-e-chrome-cc-picture-ops-chart-summary-view {
- -webkit-flex: 0 0 auto;
- font-size: 0;
- margin: 0;
- min-height: 200px;
- min-width: 200px;
- overflow: hidden;
- padding: 0;
-}
-
-* /deep/ tr-ui-e-chrome-cc-picture-ops-chart-summary-view.hidden {
- display: none;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_summary_view.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_summary_view.html
deleted file mode 100644
index 5ac0efb3d71..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_summary_view.html
+++ /dev/null
@@ -1,472 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet"
- href="/tracing/ui/extras/chrome/cc/picture_ops_chart_summary_view.css">
-
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.chrome.cc', function() {
- var OPS_TIMING_ITERATIONS = 3;
- var CHART_PADDING_LEFT = 65;
- var CHART_PADDING_RIGHT = 40;
- var AXIS_PADDING_LEFT = 60;
- var AXIS_PADDING_RIGHT = 35;
- var AXIS_PADDING_TOP = 25;
- var AXIS_PADDING_BOTTOM = 45;
- var AXIS_LABEL_PADDING = 5;
- var AXIS_TICK_SIZE = 10;
- var LABEL_PADDING = 5;
- var LABEL_INTERLEAVE_OFFSET = 15;
- var BAR_PADDING = 5;
- var VERTICAL_TICKS = 5;
- var HUE_CHAR_CODE_ADJUSTMENT = 5.7;
-
- /**
- * Provides a chart showing the cumulative time spent in Skia operations
- * during picture rasterization.
- *
- * @constructor
- */
- var PictureOpsChartSummaryView = tr.ui.b.define(
- 'tr-ui-e-chrome-cc-picture-ops-chart-summary-view');
-
- PictureOpsChartSummaryView.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.picture_ = undefined;
- this.pictureDataProcessed_ = false;
-
- this.chartScale_ = window.devicePixelRatio;
-
- this.chart_ = document.createElement('canvas');
- this.chartCtx_ = this.chart_.getContext('2d');
- this.appendChild(this.chart_);
-
- this.opsTimingData_ = [];
-
- this.chartWidth_ = 0;
- this.chartHeight_ = 0;
- this.requiresRedraw_ = true;
-
- this.currentBarMouseOverTarget_ = null;
-
- this.chart_.addEventListener('mousemove', this.onMouseMove_.bind(this));
- },
-
- get requiresRedraw() {
- return this.requiresRedraw_;
- },
-
- set requiresRedraw(requiresRedraw) {
- this.requiresRedraw_ = requiresRedraw;
- },
-
- get picture() {
- return this.picture_;
- },
-
- set picture(picture) {
- this.picture_ = picture;
- this.pictureDataProcessed_ = false;
-
- if (this.classList.contains('hidden'))
- return;
-
- this.processPictureData_();
- this.requiresRedraw = true;
- this.updateChartContents();
- },
-
- hide: function() {
- this.classList.add('hidden');
- },
-
- show: function() {
-
- this.classList.remove('hidden');
-
- if (this.pictureDataProcessed_)
- return;
-
- this.processPictureData_();
- this.requiresRedraw = true;
- this.updateChartContents();
-
- },
-
- onMouseMove_: function(e) {
-
- var lastBarMouseOverTarget = this.currentBarMouseOverTarget_;
- this.currentBarMouseOverTarget_ = null;
-
- var x = e.offsetX;
- var y = e.offsetY;
-
- var chartLeft = CHART_PADDING_LEFT;
- var chartRight = this.chartWidth_ - CHART_PADDING_RIGHT;
- var chartTop = AXIS_PADDING_TOP;
- var chartBottom = this.chartHeight_ - AXIS_PADDING_BOTTOM;
- var chartInnerWidth = chartRight - chartLeft;
-
- if (x > chartLeft && x < chartRight && y > chartTop && y < chartBottom) {
-
- this.currentBarMouseOverTarget_ = Math.floor(
- (x - chartLeft) / chartInnerWidth * this.opsTimingData_.length);
-
- this.currentBarMouseOverTarget_ = tr.b.clamp(
- this.currentBarMouseOverTarget_, 0, this.opsTimingData_.length - 1);
-
- }
-
- if (this.currentBarMouseOverTarget_ === lastBarMouseOverTarget)
- return;
-
- this.drawChartContents_();
- },
-
- updateChartContents: function() {
-
- if (this.requiresRedraw)
- this.updateChartDimensions_();
-
- this.drawChartContents_();
- },
-
- updateChartDimensions_: function() {
- this.chartWidth_ = this.offsetWidth;
- this.chartHeight_ = this.offsetHeight;
-
- // Scale up the canvas according to the devicePixelRatio, then reduce it
- // down again via CSS. Finally we apply a scale to the canvas so that
- // things are drawn at the correct size.
- this.chart_.width = this.chartWidth_ * this.chartScale_;
- this.chart_.height = this.chartHeight_ * this.chartScale_;
-
- this.chart_.style.width = this.chartWidth_ + 'px';
- this.chart_.style.height = this.chartHeight_ + 'px';
-
- this.chartCtx_.scale(this.chartScale_, this.chartScale_);
- },
-
- processPictureData_: function() {
-
- this.resetOpsTimingData_();
- this.pictureDataProcessed_ = true;
-
- if (!this.picture_)
- return;
-
- var ops = this.picture_.getOps();
- if (!ops)
- return;
-
- ops = this.picture_.tagOpsWithTimings(ops);
-
- // Check that there are valid times.
- if (ops[0].cmd_time === undefined)
- return;
-
- this.collapseOpsToTimingBuckets_(ops);
- },
-
- drawChartContents_: function() {
-
- this.clearChartContents_();
-
- if (this.opsTimingData_.length === 0) {
- this.showNoTimingDataMessage_();
- return;
- }
-
- this.drawChartAxes_();
- this.drawBars_();
- this.drawLineAtBottomOfChart_();
-
- if (this.currentBarMouseOverTarget_ === null)
- return;
-
- this.drawTooltip_();
- },
-
- drawLineAtBottomOfChart_: function() {
- this.chartCtx_.strokeStyle = '#AAA';
- this.chartCtx_.moveTo(0, this.chartHeight_ - 0.5);
- this.chartCtx_.lineTo(this.chartWidth_, this.chartHeight_ - 0.5);
- this.chartCtx_.stroke();
- },
-
- drawTooltip_: function() {
-
- var tooltipData = this.opsTimingData_[this.currentBarMouseOverTarget_];
- var tooltipTitle = tooltipData.cmd_string;
- var tooltipTime = tooltipData.cmd_time.toFixed(4);
-
- var tooltipWidth = 110;
- var tooltipHeight = 40;
- var chartInnerWidth = this.chartWidth_ - CHART_PADDING_RIGHT -
- CHART_PADDING_LEFT;
- var barWidth = chartInnerWidth / this.opsTimingData_.length;
- var tooltipOffset = Math.round((tooltipWidth - barWidth) * 0.5);
-
- var left = CHART_PADDING_LEFT + this.currentBarMouseOverTarget_ *
- barWidth - tooltipOffset;
- var top = Math.round((this.chartHeight_ - tooltipHeight) * 0.5);
-
- this.chartCtx_.save();
-
- this.chartCtx_.shadowOffsetX = 0;
- this.chartCtx_.shadowOffsetY = 5;
- this.chartCtx_.shadowBlur = 4;
- this.chartCtx_.shadowColor = 'rgba(0,0,0,0.4)';
-
- this.chartCtx_.strokeStyle = '#888';
- this.chartCtx_.fillStyle = '#EEE';
- this.chartCtx_.fillRect(left, top, tooltipWidth, tooltipHeight);
-
- this.chartCtx_.shadowColor = 'transparent';
- this.chartCtx_.translate(0.5, 0.5);
- this.chartCtx_.strokeRect(left, top, tooltipWidth, tooltipHeight);
-
- this.chartCtx_.restore();
-
- this.chartCtx_.fillStyle = '#222';
- this.chartCtx_.textBaseline = 'top';
- this.chartCtx_.font = '800 12px Arial';
- this.chartCtx_.fillText(tooltipTitle, left + 8, top + 8);
-
- this.chartCtx_.fillStyle = '#555';
- this.chartCtx_.textBaseline = 'top';
- this.chartCtx_.font = '400 italic 10px Arial';
- this.chartCtx_.fillText('Total: ' + tooltipTime + 'ms',
- left + 8, top + 22);
- },
-
- drawBars_: function() {
-
- var len = this.opsTimingData_.length;
- var max = this.opsTimingData_[0].cmd_time;
- var min = this.opsTimingData_[len - 1].cmd_time;
-
- var width = this.chartWidth_ - CHART_PADDING_LEFT - CHART_PADDING_RIGHT;
- var height = this.chartHeight_ - AXIS_PADDING_TOP - AXIS_PADDING_BOTTOM;
- var barWidth = Math.floor(width / len);
-
- var opData;
- var opTiming;
- var opHeight;
- var opLabel;
- var barLeft;
-
- for (var b = 0; b < len; b++) {
-
- opData = this.opsTimingData_[b];
- opTiming = opData.cmd_time / max;
-
- opHeight = Math.round(Math.max(1, opTiming * height));
- opLabel = opData.cmd_string;
- barLeft = CHART_PADDING_LEFT + b * barWidth;
-
- this.chartCtx_.fillStyle = this.getOpColor_(opLabel);
-
- this.chartCtx_.fillRect(barLeft + BAR_PADDING, AXIS_PADDING_TOP +
- height - opHeight, barWidth - 2 * BAR_PADDING, opHeight);
- }
-
- },
-
- getOpColor_: function(opName) {
-
- var characters = opName.split('');
- var hue = characters.reduce(this.reduceNameToHue, 0) % 360;
-
- return 'hsl(' + hue + ', 30%, 50%)';
- },
-
- reduceNameToHue: function(previousValue, currentValue, index, array) {
- // Get the char code and apply a magic adjustment value so we get
- // pretty colors from around the rainbow.
- return Math.round(previousValue + currentValue.charCodeAt(0) *
- HUE_CHAR_CODE_ADJUSTMENT);
- },
-
- drawChartAxes_: function() {
-
- var len = this.opsTimingData_.length;
- var max = this.opsTimingData_[0].cmd_time;
- var min = this.opsTimingData_[len - 1].cmd_time;
-
- var width = this.chartWidth_ - AXIS_PADDING_LEFT - AXIS_PADDING_RIGHT;
- var height = this.chartHeight_ - AXIS_PADDING_TOP - AXIS_PADDING_BOTTOM;
-
- var totalBarWidth = this.chartWidth_ - CHART_PADDING_LEFT -
- CHART_PADDING_RIGHT;
- var barWidth = Math.floor(totalBarWidth / len);
- var tickYInterval = height / (VERTICAL_TICKS - 1);
- var tickYPosition = 0;
- var tickValInterval = (max - min) / (VERTICAL_TICKS - 1);
- var tickVal = 0;
-
- this.chartCtx_.fillStyle = '#333';
- this.chartCtx_.strokeStyle = '#777';
- this.chartCtx_.save();
-
- // Translate half a pixel to avoid blurry lines.
- this.chartCtx_.translate(0.5, 0.5);
-
- // Sides.
-
- this.chartCtx_.save();
-
- this.chartCtx_.translate(AXIS_PADDING_LEFT, AXIS_PADDING_TOP);
- this.chartCtx_.moveTo(0, 0);
- this.chartCtx_.lineTo(0, height);
- this.chartCtx_.lineTo(width, height);
-
- // Y-axis ticks.
- this.chartCtx_.font = '10px Arial';
- this.chartCtx_.textAlign = 'right';
- this.chartCtx_.textBaseline = 'middle';
-
- for (var t = 0; t < VERTICAL_TICKS; t++) {
-
- tickYPosition = Math.round(t * tickYInterval);
- tickVal = (max - t * tickValInterval).toFixed(4);
-
- this.chartCtx_.moveTo(0, tickYPosition);
- this.chartCtx_.lineTo(-AXIS_TICK_SIZE, tickYPosition);
- this.chartCtx_.fillText(tickVal,
- -AXIS_TICK_SIZE - AXIS_LABEL_PADDING, tickYPosition);
-
- }
-
- this.chartCtx_.stroke();
-
- this.chartCtx_.restore();
-
-
- // Labels.
-
- this.chartCtx_.save();
-
- this.chartCtx_.translate(CHART_PADDING_LEFT + Math.round(barWidth * 0.5),
- AXIS_PADDING_TOP + height + LABEL_PADDING);
-
- this.chartCtx_.font = '10px Arial';
- this.chartCtx_.textAlign = 'center';
- this.chartCtx_.textBaseline = 'top';
-
- var labelTickLeft;
- var labelTickBottom;
- for (var l = 0; l < len; l++) {
-
- labelTickLeft = Math.round(l * barWidth);
- labelTickBottom = l % 2 * LABEL_INTERLEAVE_OFFSET;
-
- this.chartCtx_.save();
- this.chartCtx_.moveTo(labelTickLeft, -LABEL_PADDING);
- this.chartCtx_.lineTo(labelTickLeft, labelTickBottom);
- this.chartCtx_.stroke();
- this.chartCtx_.restore();
-
- this.chartCtx_.fillText(this.opsTimingData_[l].cmd_string,
- labelTickLeft, labelTickBottom);
- }
-
- this.chartCtx_.restore();
-
- this.chartCtx_.restore();
- },
-
- clearChartContents_: function() {
- this.chartCtx_.clearRect(0, 0, this.chartWidth_, this.chartHeight_);
- },
-
- showNoTimingDataMessage_: function() {
- this.chartCtx_.font = '800 italic 14px Arial';
- this.chartCtx_.fillStyle = '#333';
- this.chartCtx_.textAlign = 'center';
- this.chartCtx_.textBaseline = 'middle';
- this.chartCtx_.fillText('No timing data available.',
- this.chartWidth_ * 0.5, this.chartHeight_ * 0.5);
- },
-
- collapseOpsToTimingBuckets_: function(ops) {
-
- var opsTimingDataIndexHash_ = {};
- var timingData = this.opsTimingData_;
- var op;
- var opIndex;
-
- for (var i = 0; i < ops.length; i++) {
-
- op = ops[i];
-
- if (op.cmd_time === undefined)
- continue;
-
- // Try to locate the entry for the current operation
- // based on its name. If that fails, then create one for it.
- opIndex = opsTimingDataIndexHash_[op.cmd_string] || null;
-
- if (opIndex === null) {
- timingData.push({
- cmd_time: 0,
- cmd_string: op.cmd_string
- });
-
- opIndex = timingData.length - 1;
- opsTimingDataIndexHash_[op.cmd_string] = opIndex;
- }
-
- timingData[opIndex].cmd_time += op.cmd_time;
-
- }
-
- timingData.sort(this.sortTimingBucketsByOpTimeDescending_);
-
- this.collapseTimingBucketsToOther_(4);
- },
-
- collapseTimingBucketsToOther_: function(count) {
-
- var timingData = this.opsTimingData_;
- var otherSource = timingData.splice(count, timingData.length - count);
- var otherDestination = null;
-
- if (!otherSource.length)
- return;
-
- timingData.push({
- cmd_time: 0,
- cmd_string: 'Other'
- });
-
- otherDestination = timingData[timingData.length - 1];
- for (var i = 0; i < otherSource.length; i++) {
- otherDestination.cmd_time += otherSource[i].cmd_time;
- }
- },
-
- sortTimingBucketsByOpTimeDescending_: function(a, b) {
- return b.cmd_time - a.cmd_time;
- },
-
- resetOpsTimingData_: function() {
- this.opsTimingData_.length = 0;
- }
- };
-
- return {
- PictureOpsChartSummaryView: PictureOpsChartSummaryView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_view.css b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_view.css
deleted file mode 100644
index 5f1943e5c79..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_view.css
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-* /deep/ tr-ui-e-chrome-cc-picture-ops-chart-view {
- display: block;
- height: 180px;
- margin: 0;
- padding: 0;
- position: relative;
-}
-
-* /deep/ tr-ui-e-chrome-cc-picture-ops-chart-view > .use-percentile-scale {
- left: 0;
- position: absolute;
- top: 0;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_view.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_view.html
deleted file mode 100644
index a62f128e6b9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_chart_view.html
+++ /dev/null
@@ -1,500 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/extras/chrome/cc/picture_ops_chart_view.css">
-
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.chrome.cc', function() {
- var BAR_PADDING = 1;
- var BAR_WIDTH = 5;
- var CHART_PADDING_LEFT = 65;
- var CHART_PADDING_RIGHT = 30;
- var CHART_PADDING_BOTTOM = 35;
- var CHART_PADDING_TOP = 20;
- var AXIS_PADDING_LEFT = 55;
- var AXIS_PADDING_RIGHT = 30;
- var AXIS_PADDING_BOTTOM = 35;
- var AXIS_PADDING_TOP = 20;
- var AXIS_TICK_SIZE = 5;
- var AXIS_LABEL_PADDING = 5;
- var VERTICAL_TICKS = 5;
- var HUE_CHAR_CODE_ADJUSTMENT = 5.7;
-
- /**
- * Provides a chart showing the cumulative time spent in Skia operations
- * during picture rasterization.
- *
- * @constructor
- */
- var PictureOpsChartView =
- tr.ui.b.define('tr-ui-e-chrome-cc-picture-ops-chart-view');
-
- PictureOpsChartView.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.picture_ = undefined;
- this.pictureOps_ = undefined;
- this.opCosts_ = undefined;
-
- this.chartScale_ = window.devicePixelRatio;
-
- this.chart_ = document.createElement('canvas');
- this.chartCtx_ = this.chart_.getContext('2d');
- this.appendChild(this.chart_);
-
- this.selectedOpIndex_ = undefined;
- this.chartWidth_ = 0;
- this.chartHeight_ = 0;
- this.dimensionsHaveChanged_ = true;
-
- this.currentBarMouseOverTarget_ = undefined;
-
- this.ninetyFifthPercentileCost_ = 0;
- this.totalOpCost_ = 0;
-
- this.chart_.addEventListener('click', this.onClick_.bind(this));
- this.chart_.addEventListener('mousemove', this.onMouseMove_.bind(this));
-
- this.usePercentileScale_ = false;
- this.usePercentileScaleCheckbox_ = tr.ui.b.createCheckBox(
- this, 'usePercentileScale',
- 'PictureOpsChartView.usePercentileScale', false,
- 'Limit to 95%-ile');
- this.usePercentileScaleCheckbox_.classList.add('use-percentile-scale');
- this.appendChild(this.usePercentileScaleCheckbox_);
- },
-
- get dimensionsHaveChanged() {
- return this.dimensionsHaveChanged_;
- },
-
- set dimensionsHaveChanged(dimensionsHaveChanged) {
- this.dimensionsHaveChanged_ = dimensionsHaveChanged;
- },
-
- get usePercentileScale() {
- return this.usePercentileScale_;
- },
-
- set usePercentileScale(usePercentileScale) {
- this.usePercentileScale_ = usePercentileScale;
- this.drawChartContents_();
- },
-
- get numOps() {
- return this.opCosts_.length;
- },
-
- get selectedOpIndex() {
- return this.selectedOpIndex_;
- },
-
- set selectedOpIndex(selectedOpIndex) {
- if (selectedOpIndex < 0) throw new Error('Invalid index');
- if (selectedOpIndex >= this.numOps) throw new Error('Invalid index');
-
- this.selectedOpIndex_ = selectedOpIndex;
- },
-
- get picture() {
- return this.picture_;
- },
-
- set picture(picture) {
- this.picture_ = picture;
- this.pictureOps_ = picture.tagOpsWithTimings(picture.getOps());
- this.currentBarMouseOverTarget_ = undefined;
- this.processPictureData_();
- this.dimensionsHaveChanged = true;
- },
-
- processPictureData_: function() {
- if (this.pictureOps_ === undefined)
- return;
-
- var totalOpCost = 0;
-
- // Take a copy of the picture ops data for sorting.
- this.opCosts_ = this.pictureOps_.map(function(op) {
- totalOpCost += op.cmd_time;
- return op.cmd_time;
- });
- this.opCosts_.sort();
-
- var ninetyFifthPercentileCostIndex = Math.floor(
- this.opCosts_.length * 0.95);
- this.ninetyFifthPercentileCost_ =
- this.opCosts_[ninetyFifthPercentileCostIndex];
- this.maxCost_ = this.opCosts_[this.opCosts_.length - 1];
-
- this.totalOpCost_ = totalOpCost;
- },
-
- extractBarIndex_: function(e) {
-
- var index = undefined;
-
- if (this.pictureOps_ === undefined ||
- this.pictureOps_.length === 0)
- return index;
-
- var x = e.offsetX;
- var y = e.offsetY;
-
- var totalBarWidth = (BAR_WIDTH + BAR_PADDING) * this.pictureOps_.length;
-
- var chartLeft = CHART_PADDING_LEFT;
- var chartTop = 0;
- var chartBottom = this.chartHeight_ - CHART_PADDING_BOTTOM;
- var chartRight = chartLeft + totalBarWidth;
-
- if (x < chartLeft || x > chartRight || y < chartTop || y > chartBottom)
- return index;
-
- index = Math.floor((x - chartLeft) / totalBarWidth *
- this.pictureOps_.length);
-
- index = tr.b.clamp(index, 0, this.pictureOps_.length - 1);
-
- return index;
- },
-
- onClick_: function(e) {
-
- var barClicked = this.extractBarIndex_(e);
-
- if (barClicked === undefined)
- return;
-
- // If we click on the already selected item we should deselect.
- if (barClicked === this.selectedOpIndex)
- this.selectedOpIndex = undefined;
- else
- this.selectedOpIndex = barClicked;
-
- e.preventDefault();
-
- tr.b.dispatchSimpleEvent(this, 'selection-changed', false);
- },
-
- onMouseMove_: function(e) {
-
- var lastBarMouseOverTarget = this.currentBarMouseOverTarget_;
- this.currentBarMouseOverTarget_ = this.extractBarIndex_(e);
-
- if (this.currentBarMouseOverTarget_ === lastBarMouseOverTarget)
- return;
-
- this.drawChartContents_();
- },
-
- scrollSelectedItemIntoViewIfNecessary: function() {
-
- if (this.selectedOpIndex === undefined)
- return;
-
- var width = this.offsetWidth;
- var left = this.scrollLeft;
- var right = left + width;
- var targetLeft = CHART_PADDING_LEFT +
- (BAR_WIDTH + BAR_PADDING) * this.selectedOpIndex;
-
- if (targetLeft > left && targetLeft < right)
- return;
-
- this.scrollLeft = (targetLeft - width * 0.5);
- },
-
- updateChartContents: function() {
-
- if (this.dimensionsHaveChanged)
- this.updateChartDimensions_();
-
- this.drawChartContents_();
- },
-
- updateChartDimensions_: function() {
-
- if (!this.pictureOps_)
- return;
-
- var width = CHART_PADDING_LEFT + CHART_PADDING_RIGHT +
- ((BAR_WIDTH + BAR_PADDING) * this.pictureOps_.length);
-
- if (width < this.offsetWidth)
- width = this.offsetWidth;
-
- // Allow the element to be its natural size as set by flexbox, then lock
- // the width in before we set the width of the canvas.
- this.chartWidth_ = width;
- this.chartHeight_ = this.getBoundingClientRect().height;
-
- // Scale up the canvas according to the devicePixelRatio, then reduce it
- // down again via CSS. Finally we apply a scale to the canvas so that
- // things are drawn at the correct size.
- this.chart_.width = this.chartWidth_ * this.chartScale_;
- this.chart_.height = this.chartHeight_ * this.chartScale_;
-
- this.chart_.style.width = this.chartWidth_ + 'px';
- this.chart_.style.height = this.chartHeight_ + 'px';
-
- this.chartCtx_.scale(this.chartScale_, this.chartScale_);
-
- this.dimensionsHaveChanged = false;
- },
-
- drawChartContents_: function() {
-
- this.clearChartContents_();
-
- if (this.pictureOps_ === undefined ||
- this.pictureOps_.length === 0 ||
- this.pictureOps_[0].cmd_time === undefined) {
-
- this.showNoTimingDataMessage_();
- return;
- }
-
- this.drawSelection_();
- this.drawBars_();
- this.drawChartAxes_();
- this.drawLinesAtTickMarks_();
- this.drawLineAtBottomOfChart_();
-
- if (this.currentBarMouseOverTarget_ === undefined)
- return;
-
- this.drawTooltip_();
- },
-
- drawSelection_: function() {
-
- if (this.selectedOpIndex === undefined)
- return;
-
- var width = (BAR_WIDTH + BAR_PADDING) * this.selectedOpIndex;
- this.chartCtx_.fillStyle = 'rgb(223, 235, 230)';
- this.chartCtx_.fillRect(CHART_PADDING_LEFT, CHART_PADDING_TOP,
- width, this.chartHeight_ - CHART_PADDING_TOP - CHART_PADDING_BOTTOM);
- },
-
- drawChartAxes_: function() {
-
- var min = this.opCosts_[0];
- var max = this.opCosts_[this.opCosts_.length - 1];
- var height = this.chartHeight_ - AXIS_PADDING_TOP - AXIS_PADDING_BOTTOM;
-
- var tickYInterval = height / (VERTICAL_TICKS - 1);
- var tickYPosition = 0;
- var tickValInterval = (max - min) / (VERTICAL_TICKS - 1);
- var tickVal = 0;
-
- this.chartCtx_.fillStyle = '#333';
- this.chartCtx_.strokeStyle = '#777';
- this.chartCtx_.save();
-
- // Translate half a pixel to avoid blurry lines.
- this.chartCtx_.translate(0.5, 0.5);
-
- // Sides.
- this.chartCtx_.beginPath();
- this.chartCtx_.moveTo(AXIS_PADDING_LEFT, AXIS_PADDING_TOP);
- this.chartCtx_.lineTo(AXIS_PADDING_LEFT, this.chartHeight_ -
- AXIS_PADDING_BOTTOM);
- this.chartCtx_.lineTo(this.chartWidth_ - AXIS_PADDING_RIGHT,
- this.chartHeight_ - AXIS_PADDING_BOTTOM);
- this.chartCtx_.stroke();
- this.chartCtx_.closePath();
-
- // Y-axis ticks.
- this.chartCtx_.translate(AXIS_PADDING_LEFT, AXIS_PADDING_TOP);
-
- this.chartCtx_.font = '10px Arial';
- this.chartCtx_.textAlign = 'right';
- this.chartCtx_.textBaseline = 'middle';
-
- this.chartCtx_.beginPath();
- for (var t = 0; t < VERTICAL_TICKS; t++) {
-
- tickYPosition = Math.round(t * tickYInterval);
- tickVal = (max - t * tickValInterval).toFixed(4);
-
- this.chartCtx_.moveTo(0, tickYPosition);
- this.chartCtx_.lineTo(-AXIS_TICK_SIZE, tickYPosition);
- this.chartCtx_.fillText(tickVal,
- -AXIS_TICK_SIZE - AXIS_LABEL_PADDING, tickYPosition);
-
- }
-
- this.chartCtx_.stroke();
- this.chartCtx_.closePath();
-
- this.chartCtx_.restore();
- },
-
- drawLinesAtTickMarks_: function() {
-
- var height = this.chartHeight_ - AXIS_PADDING_TOP - AXIS_PADDING_BOTTOM;
- var width = this.chartWidth_ - AXIS_PADDING_LEFT - AXIS_PADDING_RIGHT;
- var tickYInterval = height / (VERTICAL_TICKS - 1);
- var tickYPosition = 0;
-
- this.chartCtx_.save();
-
- this.chartCtx_.translate(AXIS_PADDING_LEFT + 0.5, AXIS_PADDING_TOP + 0.5);
- this.chartCtx_.beginPath();
- this.chartCtx_.strokeStyle = 'rgba(0,0,0,0.05)';
-
- for (var t = 0; t < VERTICAL_TICKS; t++) {
- tickYPosition = Math.round(t * tickYInterval);
-
- this.chartCtx_.moveTo(0, tickYPosition);
- this.chartCtx_.lineTo(width, tickYPosition);
- this.chartCtx_.stroke();
- }
-
- this.chartCtx_.restore();
- this.chartCtx_.closePath();
- },
-
- drawLineAtBottomOfChart_: function() {
- this.chartCtx_.strokeStyle = '#AAA';
- this.chartCtx_.beginPath();
- this.chartCtx_.moveTo(0, this.chartHeight_ - 0.5);
- this.chartCtx_.lineTo(this.chartWidth_, this.chartHeight_ - 0.5);
- this.chartCtx_.stroke();
- this.chartCtx_.closePath();
- },
-
- drawTooltip_: function() {
-
- var tooltipData = this.pictureOps_[this.currentBarMouseOverTarget_];
- var tooltipTitle = tooltipData.cmd_string;
- var tooltipTime = tooltipData.cmd_time.toFixed(4);
- var toolTipTimePercentage =
- ((tooltipData.cmd_time / this.totalOpCost_) * 100).toFixed(2);
-
- var tooltipWidth = 120;
- var tooltipHeight = 40;
- var chartInnerWidth = this.chartWidth_ - CHART_PADDING_RIGHT -
- CHART_PADDING_LEFT;
- var barWidth = BAR_WIDTH + BAR_PADDING;
- var tooltipOffset = Math.round((tooltipWidth - barWidth) * 0.5);
-
- var left = CHART_PADDING_LEFT + this.currentBarMouseOverTarget_ *
- barWidth - tooltipOffset;
- var top = Math.round((this.chartHeight_ - tooltipHeight) * 0.5);
-
- this.chartCtx_.save();
-
- this.chartCtx_.shadowOffsetX = 0;
- this.chartCtx_.shadowOffsetY = 5;
- this.chartCtx_.shadowBlur = 4;
- this.chartCtx_.shadowColor = 'rgba(0,0,0,0.4)';
-
- this.chartCtx_.strokeStyle = '#888';
- this.chartCtx_.fillStyle = '#EEE';
- this.chartCtx_.fillRect(left, top, tooltipWidth, tooltipHeight);
-
- this.chartCtx_.shadowColor = 'transparent';
- this.chartCtx_.translate(0.5, 0.5);
- this.chartCtx_.strokeRect(left, top, tooltipWidth, tooltipHeight);
-
- this.chartCtx_.restore();
-
- this.chartCtx_.fillStyle = '#222';
- this.chartCtx_.textAlign = 'left';
- this.chartCtx_.textBaseline = 'top';
- this.chartCtx_.font = '800 12px Arial';
- this.chartCtx_.fillText(tooltipTitle, left + 8, top + 8);
-
- this.chartCtx_.fillStyle = '#555';
- this.chartCtx_.font = '400 italic 10px Arial';
- this.chartCtx_.fillText(tooltipTime + 'ms (' +
- toolTipTimePercentage + '%)', left + 8, top + 22);
- },
-
- drawBars_: function() {
-
- var op;
- var opColor = 0;
- var opHeight = 0;
- var opWidth = BAR_WIDTH + BAR_PADDING;
- var opHover = false;
-
- var bottom = this.chartHeight_ - CHART_PADDING_BOTTOM;
- var maxHeight = this.chartHeight_ - CHART_PADDING_BOTTOM -
- CHART_PADDING_TOP;
-
- var maxValue;
- if (this.usePercentileScale)
- maxValue = this.ninetyFifthPercentileCost_;
- else
- maxValue = this.maxCost_;
-
- for (var b = 0; b < this.pictureOps_.length; b++) {
-
- op = this.pictureOps_[b];
- opHeight = Math.round(
- (op.cmd_time / maxValue) * maxHeight);
- opHeight = Math.max(opHeight, 1);
- opHover = (b === this.currentBarMouseOverTarget_);
- opColor = this.getOpColor_(op.cmd_string, opHover);
-
- if (b === this.selectedOpIndex)
- this.chartCtx_.fillStyle = '#FFFF00';
- else
- this.chartCtx_.fillStyle = opColor;
-
- this.chartCtx_.fillRect(CHART_PADDING_LEFT + b * opWidth,
- bottom - opHeight, BAR_WIDTH, opHeight);
- }
-
- },
-
- getOpColor_: function(opName, hover) {
-
- var characters = opName.split('');
-
- var hue = characters.reduce(this.reduceNameToHue, 0) % 360;
- var saturation = 30;
- var lightness = hover ? '75%' : '50%';
-
- return 'hsl(' + hue + ', ' + saturation + '%, ' + lightness + '%)';
- },
-
- reduceNameToHue: function(previousValue, currentValue, index, array) {
- // Get the char code and apply a magic adjustment value so we get
- // pretty colors from around the rainbow.
- return Math.round(previousValue + currentValue.charCodeAt(0) *
- HUE_CHAR_CODE_ADJUSTMENT);
- },
-
- clearChartContents_: function() {
- this.chartCtx_.clearRect(0, 0, this.chartWidth_, this.chartHeight_);
- },
-
- showNoTimingDataMessage_: function() {
- this.chartCtx_.font = '800 italic 14px Arial';
- this.chartCtx_.fillStyle = '#333';
- this.chartCtx_.textAlign = 'center';
- this.chartCtx_.textBaseline = 'middle';
- this.chartCtx_.fillText('No timing data available.',
- this.chartWidth_ * 0.5, this.chartHeight_ * 0.5);
- }
- };
-
- return {
- PictureOpsChartView: PictureOpsChartView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_list_view.css b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_list_view.css
deleted file mode 100644
index bdd77fcd099..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_list_view.css
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-* * /deep/ tr-ui-e-chrome-cc-picture-ops-list-view {
- -webkit-flex-direction: column;
- border-top: 1px solid grey;
- display: -webkit-flex;
-}
-
-* /deep/ tr-ui-e-chrome-cc-picture-ops-list-view > .x-list-view {
- -webkit-flex: 1 1 auto;
- overflow: auto;
-}
-
-* /deep/ tr-ui-e-chrome-cc-picture-ops-list-view > .x-list-view .list-item {
- border-bottom: 1px solid #555;
- font-size: small;
- font-weight: bold;
- padding-bottom: 5px;
- padding-left: 5px;
-}
-
-* /deep/ tr-ui-e-chrome-cc-picture-ops-list-view >
- .x-list-view .list-item:hover {
- background-color: #f0f0f0;
- cursor: pointer;
-}
-
-* /deep/ tr-ui-e-chrome-cc-picture-ops-list-view >
- .x-list-view .list-item > * {
- color: #777;
- font-size: x-small;
- font-weight: normal;
- margin-left: 1em;
- max-width: 300px; /* force long strings to wrap */
-}
-
-* /deep/ tr-ui-e-chrome-cc-picture-ops-list-view >
- .x-list-view .list-item > .elementInfo {
- color: purple;
- font-size: small;
- font-weight: bold;
-}
-
-* /deep/ tr-ui-e-chrome-cc-picture-ops-list-view >
- .x-list-view .list-item > .time {
- color: rgb(136, 0, 0);
-}
-
-* /deep/ tr-ui-e-chrome-cc-picture-ops-list-view .x-list-view:focus >
- .list-item[beforeSelection] {
- background-color: rgb(171, 217, 202);
- outline: 1px dotted rgba(0, 0, 0, 0.1);
- outline-offset: 0;
-}
-
-* /deep/ tr-ui-e-chrome-cc-picture-ops-list-view .x-list-view >
- .list-item[beforeSelection] {
- background-color: rgb(103, 199, 165);
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_list_view.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_list_view.html
deleted file mode 100644
index 1bae14a635f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_list_view.html
+++ /dev/null
@@ -1,238 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/extras/chrome/cc/picture_ops_list_view.css">
-
-<link rel="import" href="/tracing/extras/chrome/cc/constants.html">
-<link rel="import" href="/tracing/ui/base/list_view.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/utils.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/selection.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.chrome.cc', function() {
- var OPS_TIMING_ITERATIONS = 3; // Iterations to average op timing info over.
- var ANNOTATION = 'Comment';
- var BEGIN_ANNOTATION = 'BeginCommentGroup';
- var END_ANNOTATION = 'EndCommentGroup';
- var ANNOTATION_ID = 'ID: ';
- var ANNOTATION_CLASS = 'CLASS: ';
- var ANNOTATION_TAG = 'TAG: ';
-
- var constants = tr.e.cc.constants;
-
- /**
- * @constructor
- */
- var PictureOpsListView =
- tr.ui.b.define('tr-ui-e-chrome-cc-picture-ops-list-view');
-
- PictureOpsListView.prototype = {
- __proto__: HTMLUnknownElement.prototype,
-
- decorate: function() {
- this.opsList_ = new tr.ui.b.ListView();
- this.appendChild(this.opsList_);
-
- this.selectedOp_ = undefined;
- this.selectedOpIndex_ = undefined;
- this.opsList_.addEventListener(
- 'selection-changed', this.onSelectionChanged_.bind(this));
-
- this.picture_ = undefined;
- },
-
- get picture() {
- return this.picture_;
- },
-
- set picture(picture) {
- this.picture_ = picture;
- this.updateContents_();
- },
-
- updateContents_: function() {
- this.opsList_.clear();
-
- if (!this.picture_)
- return;
-
- var ops = this.picture_.getOps();
- if (!ops)
- return;
-
- ops = this.picture_.tagOpsWithTimings(ops);
-
- ops = this.opsTaggedWithAnnotations_(ops);
-
- for (var i = 0; i < ops.length; i++) {
- var op = ops[i];
- var item = document.createElement('div');
- item.opIndex = op.opIndex;
- item.textContent = i + ') ' + op.cmd_string;
-
- // Display the element info associated with the op, if available.
- if (op.elementInfo.tag || op.elementInfo.id || op.elementInfo.class) {
- var elementInfo = document.createElement('span');
- elementInfo.classList.add('elementInfo');
- var tag = op.elementInfo.tag ? op.elementInfo.tag : 'unknown';
- var id = op.elementInfo.id ? 'id=' + op.elementInfo.id : undefined;
- var className = op.elementInfo.class ? 'class=' +
- op.elementInfo.class : undefined;
- elementInfo.textContent =
- '<' + tag + (id ? ' ' : '') +
- (id ? id : '') + (className ? ' ' : '') +
- (className ? className : '') + '>';
- item.appendChild(elementInfo);
- }
-
- // Display the Skia params.
- // FIXME: now that we have structured data, we should format it.
- // (https://github.com/google/trace-viewer/issues/782)
- if (op.info.length > 0) {
- var infoItem = document.createElement('div');
- infoItem.textContent = JSON.stringify(op.info);
- item.appendChild(infoItem);
- }
-
- // Display the op timing, if available.
- if (op.cmd_time && op.cmd_time >= 0.0001) {
- var time = document.createElement('span');
- time.classList.add('time');
- var rounded = op.cmd_time.toFixed(4);
- time.textContent = '(' + rounded + 'ms)';
- item.appendChild(time);
- }
-
- this.opsList_.appendChild(item);
- }
- },
-
- onSelectionChanged_: function(e) {
- var beforeSelectedOp = true;
-
- // Deselect on re-selection.
- if (this.opsList_.selectedElement === this.selectedOp_) {
- this.opsList_.selectedElement = undefined;
- beforeSelectedOp = false;
- this.selectedOpIndex_ = undefined;
- }
-
- this.selectedOp_ = this.opsList_.selectedElement;
-
- // Set selection on all previous ops.
- var ops = this.opsList_.children;
- for (var i = 0; i < ops.length; i++) {
- var op = ops[i];
- if (op === this.selectedOp_) {
- beforeSelectedOp = false;
- this.selectedOpIndex_ = op.opIndex;
- } else if (beforeSelectedOp) {
- op.setAttribute('beforeSelection', 'beforeSelection');
- } else {
- op.removeAttribute('beforeSelection');
- }
- }
-
- tr.b.dispatchSimpleEvent(this, 'selection-changed', false);
- },
-
- get numOps() {
- return this.opsList_.children.length;
- },
-
- get selectedOpIndex() {
- return this.selectedOpIndex_;
- },
-
- set selectedOpIndex(s) {
- this.selectedOpIndex_ = s;
-
- if (s === undefined) {
- this.opsList_.selectedElement = this.selectedOp_;
- this.onSelectionChanged_();
- } else {
- if (s < 0) throw new Error('Invalid index');
- if (s >= this.numOps) throw new Error('Invalid index');
- this.opsList_.selectedElement = this.opsList_.getElementByIndex(s + 1);
- tr.ui.b.scrollIntoViewIfNeeded(this.opsList_.selectedElement);
- }
- },
-
- /**
- * Return Skia operations tagged by annotation.
- *
- * The ops returned from Picture.getOps() contain both Skia ops and
- * annotations threaded together. This function removes all annotations
- * from the list and tags each op with the associated annotations.
- * Additionally, the last {tag, id, class} is stored as elementInfo on
- * each op.
- *
- * @param {Array} ops Array of Skia operations and annotations.
- * @return {Array} Skia ops where op.annotations contains the associated
- * annotations for a given op.
- */
- opsTaggedWithAnnotations_: function(ops) {
- // This algorithm works by walking all the ops and pushing any
- // annotations onto a stack. When a non-annotation op is found, the
- // annotations stack is traversed and stored with the op.
- var annotationGroups = new Array();
- var opsWithoutAnnotations = new Array();
- for (var opIndex = 0; opIndex < ops.length; opIndex++) {
- var op = ops[opIndex];
- op.opIndex = opIndex;
- switch (op.cmd_string) {
- case BEGIN_ANNOTATION:
- annotationGroups.push(new Array());
- break;
- case END_ANNOTATION:
- annotationGroups.pop();
- break;
- case ANNOTATION:
- annotationGroups[annotationGroups.length - 1].push(op);
- break;
- default:
- var annotations = new Array();
- var elementInfo = {};
- annotationGroups.forEach(function(annotationGroup) {
- elementInfo = {};
- annotationGroup.forEach(function(annotation) {
- annotation.info.forEach(function(info) {
- if (info.indexOf(ANNOTATION_TAG) != -1)
- elementInfo.tag = info.substring(
- info.indexOf(ANNOTATION_TAG) +
- ANNOTATION_TAG.length).toLowerCase();
- else if (info.indexOf(ANNOTATION_ID) != -1)
- elementInfo.id = info.substring(
- info.indexOf(ANNOTATION_ID) +
- ANNOTATION_ID.length);
- else if (info.indexOf(ANNOTATION_CLASS) != -1)
- elementInfo.class = info.substring(
- info.indexOf(ANNOTATION_CLASS) +
- ANNOTATION_CLASS.length);
-
- annotations.push(info);
- });
- });
- });
- op.annotations = annotations;
- op.elementInfo = elementInfo;
- opsWithoutAnnotations.push(op);
- }
- }
-
- return opsWithoutAnnotations;
- }
- };
-
- return {
- PictureOpsListView: PictureOpsListView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_list_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_list_view_test.html
deleted file mode 100644
index cd6679f8449..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_ops_list_view_test.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/cc/picture.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/picture_ops_list_view.html">
-
-<script src="/tracing/extras/chrome/cc/layer_tree_host_impl_test_data.js">
-</script>
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var PictureOpsListView = tr.ui.e.chrome.cc.PictureOpsListView;
-
- test('instantiate', function() {
- if (!tr.e.cc.PictureSnapshot.CanRasterize())
- return;
- var m = new tr.Model(g_catLTHIEvents);
- var p = tr.b.dictionaryValues(m.processes)[0];
-
- var instance = p.objects.getAllInstancesNamed('cc::Picture')[0];
- var snapshot = instance.snapshots[0];
-
- var view = new PictureOpsListView();
- view.picture = snapshot;
- assert.equal(view.opsList_.children.length, 142);
- });
-
- test('selection', function() {
- if (!tr.e.cc.PictureSnapshot.CanRasterize())
- return;
- var m = new tr.Model(g_catLTHIEvents);
- var p = tr.b.dictionaryValues(m.processes)[0];
-
- var instance = p.objects.getAllInstancesNamed('cc::Picture')[0];
- var snapshot = instance.snapshots[0];
-
- var view = new PictureOpsListView();
- view.picture = snapshot;
- var didSelectionChange = 0;
- view.addEventListener('selection-changed', function() {
- didSelectionChange = true;
- });
- assert.isFalse(didSelectionChange);
- view.opsList_.selectedElement = view.opsList_.children[3];
- assert.isTrue(didSelectionChange);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_view.css b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_view.css
deleted file mode 100644
index 26893f2c6c9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_view.css
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-* /deep/ .tr-ui-e-chrome-cc-picture-snapshot-view {
- -webkit-flex: 0 1 auto !important;
- display: -webkit-flex;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_view.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_view.html
deleted file mode 100644
index 74acef3e37b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/picture_view.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/extras/chrome/cc/picture_view.css">
-
-<link rel="import" href="/tracing/extras/chrome/cc/picture.html">
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-<link rel="import" href="/tracing/ui/analysis/object_snapshot_view.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/picture_debugger.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.chrome.cc', function() {
- /*
- * Displays a picture snapshot in a human readable form.
- * @constructor
- */
- var PictureSnapshotView = tr.ui.b.define(
- 'tr-ui-e-chrome-cc-picture-snapshot-view',
- tr.ui.analysis.ObjectSnapshotView);
-
- PictureSnapshotView.prototype = {
- __proto__: tr.ui.analysis.ObjectSnapshotView.prototype,
-
- decorate: function() {
- this.classList.add('tr-ui-e-chrome-cc-picture-snapshot-view');
- this.pictureDebugger_ = new tr.ui.e.chrome.cc.PictureDebugger();
- this.appendChild(this.pictureDebugger_);
- },
-
- updateContents: function() {
- if (this.objectSnapshot_ && this.pictureDebugger_)
- this.pictureDebugger_.picture = this.objectSnapshot_;
- }
- };
-
- tr.ui.analysis.ObjectSnapshotView.register(
- PictureSnapshotView,
- {
- typeNames: ['cc::Picture', 'cc::LayeredPicture'],
- showInstances: false
- });
-
- return {
- PictureSnapshotView: PictureSnapshotView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_selection.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_selection.html
deleted file mode 100644
index 2838c5b63ed..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_selection.html
+++ /dev/null
@@ -1,131 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/extras/chrome/cc/raster_task.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/single_event_sub_view.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/raster_task_view.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/selection.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.chrome.cc', function() {
- /**
- * @constructor
- */
- function RasterTaskSelection(selection) {
- tr.ui.e.chrome.cc.Selection.call(this);
- var whySupported = RasterTaskSelection.whySuported(selection);
- if (!whySupported.ok)
- throw new Error('Fail: ' + whySupported.why);
- this.slices_ = tr.b.asArray(selection);
- this.tiles_ = this.slices_.map(function(slice) {
- var tile = tr.e.cc.getTileFromRasterTaskSlice(slice);
- if (tile === undefined)
- throw new Error('This should never happen due to .supports check.');
- return tile;
- });
- }
-
- RasterTaskSelection.whySuported = function(selection) {
- if (!(selection instanceof tr.model.EventSet))
- return {ok: false, why: 'Must be selection'};
-
- if (selection.length === 0)
- return {ok: false, why: 'Selection must be non empty'};
-
- var referenceSnapshot = undefined;
- for (var event of selection) {
- if (!(event instanceof tr.model.Slice))
- return {ok: false, why: 'Not a slice'};
-
- var tile = tr.e.cc.getTileFromRasterTaskSlice(event);
- if (tile === undefined)
- return {ok: false, why: 'No tile found'};
-
- if (!referenceSnapshot) {
- referenceSnapshot = tile.containingSnapshot;
- } else {
- if (tile.containingSnapshot != referenceSnapshot) {
- return {
- ok: false,
- why: 'Raster tasks are from different compositor instances'
- };
- }
- }
- }
- return {ok: true};
- };
-
- RasterTaskSelection.supports = function(selection) {
- return RasterTaskSelection.whySuported(selection).ok;
- };
-
- RasterTaskSelection.prototype = {
- __proto__: tr.ui.e.chrome.cc.Selection.prototype,
-
- get specicifity() {
- return 3;
- },
-
- get associatedLayerId() {
- var tile0 = this.tiles_[0];
- var allSameLayer = this.tiles_.every(function(tile) {
- tile.layerId == tile0.layerId;
- });
- if (allSameLayer)
- return tile0.layerId;
- return undefined;
- },
-
- get extraHighlightsByLayerId() {
- var highlights = {};
- this.tiles_.forEach(function(tile, i) {
- if (highlights[tile.layerId] === undefined)
- highlights[tile.layerId] = [];
- var slice = this.slices_[i];
- highlights[tile.layerId].push({
- colorKey: slice.title,
- rect: tile.layerRect
- });
- }, this);
- return highlights;
- },
-
- createAnalysis: function() {
- var sel = new tr.model.EventSet();
- this.slices_.forEach(function(slice) {
- sel.push(slice);
- });
-
- var analysis;
- if (sel.length == 1)
- analysis = document.createElement('tr-ui-a-single-event-sub-view');
- else
- analysis = document.createElement('tr-ui-e-chrome-cc-raster-task-view');
- analysis.selection = sel;
- return analysis;
- },
-
- findEquivalent: function(lthi) {
- // Raster tasks are only valid in one LTHI.
- return undefined;
- },
-
- // RasterTaskSelection specific stuff follows.
- get containingSnapshot() {
- return this.tiles_[0].containingSnapshot;
- }
- };
-
- return {
- RasterTaskSelection: RasterTaskSelection
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_selection_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_selection_test.html
deleted file mode 100644
index ee8e91c3c77..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_selection_test.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/raster_task_selection.html">
-
-<script src="/tracing/extras/chrome/cc/layer_tree_host_impl_test_data.js">
-</script>
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('basic', function() {
- var m = tr.c.TestUtils.newModelWithEvents([g_catLTHIEvents]);
- var p = m.processes[1];
- var rasterTasks = p.threads[1].sliceGroup.slices.filter(function(slice) {
- return slice.title == 'RasterTask';
- });
-
- var selection = new tr.model.EventSet();
- selection.push(rasterTasks[0]);
- selection.push(rasterTasks[1]);
-
- assert.isTrue(tr.ui.e.chrome.cc.RasterTaskSelection.supports(selection));
- var selection = new tr.ui.e.chrome.cc.RasterTaskSelection(selection);
- var highlights = selection.extraHighlightsByLayerId;
- assert.equal(tr.b.dictionaryLength(highlights), 1);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_view.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_view.html
deleted file mode 100644
index b4020840303..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_view.html
+++ /dev/null
@@ -1,216 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/extras/chrome/cc/raster_task.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_sub_view.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/selection.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-e-chrome-cc-raster-task-view">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
- #heading {
- flex: 0 0 auto;
- }
- </style>
-
- <div id="heading">
- Rasterization costs in
- <tr-ui-a-analysis-link id="link"></tr-ui-a-analysis-link>
- </div>
- <tr-ui-b-table id="content"></tr-ui-b-table>
- </template>
-
- <script>
- 'use strict';
- Polymer({
- created: function() {
- this.selection_ = undefined;
- },
-
- set selection(selection) {
- this.selection_ = selection;
-
- this.updateContents_();
- },
-
- updateColumns_: function(hadCpuDurations) {
- var timeSpanConfig = {
- unit: tr.v.Unit.byName.timeDurationInMs,
- ownerDocument: this.ownerDocument
- };
-
- var columns = [
- {
- title: 'Layer',
- value: function(row) {
- if (row.isTotals)
- return 'Totals';
- if (row.layer) {
- var linkEl = document.createElement('tr-ui-a-analysis-link');
- linkEl.setSelectionAndContent(
- function() {
- return new tr.ui.e.chrome.cc.LayerSelection(costs.layer);
- },
- 'Layer ' + row.layerId);
- return linkEl;
- } else {
- return 'Layer ' + row.layerId;
- }
- },
- width: '250px'
- },
- {
- title: 'Num Tiles',
- value: function(row) { return row.numTiles; },
- cmp: function(a, b) { return a.numTiles - b.numTiles; }
- },
- {
- title: 'Num Analysis Tasks',
- value: function(row) { return row.numAnalysisTasks; },
- cmp: function(a, b) {
- return a.numAnalysisTasks - b.numAnalysisTasks;
- }
- },
- {
- title: 'Num Raster Tasks',
- value: function(row) { return row.numRasterTasks; },
- cmp: function(a, b) { return a.numRasterTasks - b.numRasterTasks; }
- },
- {
- title: 'Wall Duration (ms)',
- value: function(row) {
- return tr.v.ui.createScalarSpan(row.duration, timeSpanConfig);
- },
- cmp: function(a, b) { return a.duration - b.duration; }
- }
- ];
-
- if (hadCpuDurations) {
- columns.push({
- title: 'CPU Duration (ms)',
- value: function(row) {
- return tr.v.ui.createScalarSpan(row.cpuDuration, timeSpanConfig);
- },
- cmp: function(a, b) { return a.cpuDuration - b.cpuDuration; }
- });
- }
-
- var colWidthPercentage;
- if (columns.length == 1)
- colWidthPercentage = '100%';
- else
- colWidthPercentage = (100 / (columns.length - 1)).toFixed(3) + '%';
-
- for (var i = 1; i < columns.length; i++)
- columns[i].width = colWidthPercentage;
-
- this.$.content.tableColumns = columns;
- this.$.content.sortColumnIndex = columns.length - 1;
- },
-
- updateContents_: function() {
- var table = this.$.content;
-
- if (this.selection_.length === 0) {
- this.$.link.setSelectionAndContent(undefined, '');
- table.tableRows = [];
- table.footerRows = [];
- table.rebuild();
- return;
- }
-
- // LTHI link.
- var lthi = tr.e.cc.getTileFromRasterTaskSlice(
- this.selection_[0]).containingSnapshot;
- this.$.link.setSelectionAndContent(function() {
- return new tr.model.EventSet(lthi);
- }, lthi.userFriendlyName);
-
- // Get costs by layer.
- var costsByLayerId = {};
- function getCurrentCostsForLayerId(tile) {
- var layerId = tile.layerId;
- var lthi = tile.containingSnapshot;
- var layer;
- if (lthi.activeTree)
- layer = lthi.activeTree.findLayerWithId(layerId);
- if (layer === undefined && lthi.pendingTree)
- layer = lthi.pendingTree.findLayerWithId(layerId);
- if (costsByLayerId[layerId] === undefined) {
- costsByLayerId[layerId] = {
- layerId: layerId,
- layer: layer,
- numTiles: 0,
- numAnalysisTasks: 0,
- numRasterTasks: 0,
- duration: 0,
- cpuDuration: 0
- };
- }
- return costsByLayerId[layerId];
- }
-
- var totalDuration = 0;
- var totalCpuDuration = 0;
- var totalNumAnalyzeTasks = 0;
- var totalNumRasterizeTasks = 0;
- var hadCpuDurations = false;
-
- var tilesThatWeHaveSeen = {};
-
- this.selection_.forEach(function(slice) {
- var tile = tr.e.cc.getTileFromRasterTaskSlice(slice);
- var curCosts = getCurrentCostsForLayerId(tile);
-
- if (!tilesThatWeHaveSeen[tile.objectInstance.id]) {
- tilesThatWeHaveSeen[tile.objectInstance.id] = true;
- curCosts.numTiles += 1;
- }
-
- if (tr.e.cc.isSliceDoingAnalysis(slice)) {
- curCosts.numAnalysisTasks += 1;
- totalNumAnalyzeTasks += 1;
- } else {
- curCosts.numRasterTasks += 1;
- totalNumRasterizeTasks += 1;
- }
- curCosts.duration += slice.duration;
- totalDuration += slice.duration;
- if (slice.cpuDuration !== undefined) {
- curCosts.cpuDuration += slice.cpuDuration;
- totalCpuDuration += slice.cpuDuration;
- hadCpuDurations = true;
- }
- });
-
- // Apply to the table.
- this.updateColumns_(hadCpuDurations);
- table.tableRows = tr.b.dictionaryValues(costsByLayerId);
- table.rebuild();
-
- // Footer.
- table.footerRows = [
- {
- isTotals: true,
- numTiles: tr.b.dictionaryLength(tilesThatWeHaveSeen),
- numAnalysisTasks: totalNumAnalyzeTasks,
- numRasterTasks: totalNumRasterizeTasks,
- duration: totalDuration,
- cpuDuration: totalCpuDuration
- }
- ];
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_view_test.html
deleted file mode 100644
index be771775cb7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/raster_task_view_test.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/event_target.html">
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_view.html">
-<link rel="import" href="/tracing/ui/base/deep_utils.html">
-<link rel="import" href="/tracing/ui/brushing_state_controller.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/layer_tree_host_impl_view.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/raster_task_selection.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/raster_task_view.html">
-
-<script src="/tracing/extras/chrome/cc/layer_tree_host_impl_test_data.js">
-</script>
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function createSelection() {
- var m = tr.c.TestUtils.newModelWithEvents([g_catLTHIEvents]);
- var p = m.processes[1];
- var rasterTasks = p.threads[1].sliceGroup.slices.filter(function(slice) {
- return slice.title == 'RasterTask' || slice.title == 'AnalyzeTask';
- });
-
- var selection = new tr.model.EventSet();
- selection.model = m;
-
- selection.push(rasterTasks[0]);
- selection.push(rasterTasks[1]);
- return selection;
- }
-
- test('basic', function() {
- var selection = createSelection();
- var view = document.createElement('tr-ui-e-chrome-cc-raster-task-view');
- view.selection = selection;
- this.addHTMLOutput(view);
- });
-
- test('analysisViewIntegration', function() {
- var selection = createSelection();
-
- var timelineView = {model: selection.model};
- var brushingStateController =
- new tr.c.BrushingStateController(timelineView);
-
- var analysisEl = document.createElement('tr-ui-a-analysis-view');
- analysisEl.brushingStateController = brushingStateController;
- brushingStateController.changeSelectionFromTimeline(selection);
-
- assert.isDefined(analysisEl.querySelector(
- 'tr-ui-e-chrome-cc-raster-task-view'));
-
- var sv = tr.b.findDeepElementMatching(
- analysisEl, 'tr-ui-a-multi-thread-slice-sub-view');
- assert.isTrue(sv.requiresTallView);
- this.addHTMLOutput(analysisEl);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/selection.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/selection.html
deleted file mode 100644
index a2f1e2521f4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/selection.html
+++ /dev/null
@@ -1,302 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.chrome.cc', function() {
- function Selection() {
- this.selectionToSetIfClicked = undefined;
- };
- Selection.prototype = {
- /**
- * When two things are picked in the UI, one must occasionally tie-break
- * between them to decide what was really clicked. Things with higher
- * specicifity will win.
- */
- get specicifity() {
- throw new Error('Not implemented');
- },
-
- /**
- * If a selection is related to a specific layer, then this returns the
- * layerId of that layer. If the selection is not related to a layer, for
- * example if the device viewport is selected, then this returns undefined.
- */
- get associatedLayerId() {
- throw new Error('Not implemented');
- },
-
- /**
- * If a selection is related to a specific render pass, then this returns
- * the layerId of that layer. If the selection is not related to a layer,
- * for example if the device viewport is selected, then this returns
- * undefined.
- */
- get associatedRenderPassId() {
- throw new Error('Not implemented');
- },
-
-
- get highlightsByLayerId() {
- return {};
- },
-
- /**
- * Called when the selection is made active in the layer view. Must return
- * an HTMLElement that explains this selection in detail.
- */
- createAnalysis: function() {
- throw new Error('Not implemented');
- },
-
- /**
- * Should try to create the equivalent selection in the provided LTHI,
- * or undefined if it can't be done.
- */
- findEquivalent: function(lthi) {
- throw new Error('Not implemented');
- }
- };
-
- /**
- * @constructor
- */
- function RenderPassSelection(renderPass, renderPassId) {
- if (!renderPass || (renderPassId === undefined))
- throw new Error('Render pass (with id) is required');
- this.renderPass_ = renderPass;
- this.renderPassId_ = renderPassId;
- }
-
- RenderPassSelection.prototype = {
- __proto__: Selection.prototype,
-
- get specicifity() {
- return 1;
- },
-
- get associatedLayerId() {
- return undefined;
- },
-
- get associatedRenderPassId() {
- return this.renderPassId_;
- },
-
- get renderPass() {
- return this.renderPass_;
- },
-
- createAnalysis: function() {
- var dataView = document.createElement(
- 'tr-ui-a-generic-object-view-with-label');
- dataView.label = 'RenderPass ' + this.renderPassId_;
- dataView.object = this.renderPass_.args;
- return dataView;
- },
-
- get title() {
- return this.renderPass_.objectInstance.typeName;
- }
- };
-
- /**
- * @constructor
- */
- function LayerSelection(layer) {
- if (!layer)
- throw new Error('Layer is required');
- this.layer_ = layer;
- }
-
- LayerSelection.prototype = {
- __proto__: Selection.prototype,
-
- get specicifity() {
- return 1;
- },
-
- get associatedLayerId() {
- return this.layer_.layerId;
- },
-
- get associatedRenderPassId() {
- return undefined;
- },
-
- get layer() {
- return this.layer_;
- },
-
- createAnalysis: function() {
- var dataView = document.createElement(
- 'tr-ui-a-generic-object-view-with-label');
- dataView.label = 'Layer ' + this.layer_.layerId;
- if (this.layer_.usingGpuRasterization)
- dataView.label += ' (GPU-rasterized)';
- dataView.object = this.layer_.args;
- return dataView;
- },
-
- get title() {
- return this.layer_.objectInstance.typeName;
- },
-
- findEquivalent: function(lthi) {
- var layer = lthi.activeTree.findLayerWithId(this.layer_.layerId) ||
- lthi.pendingTree.findLayerWithId(this.layer_.layerId);
- if (!layer)
- return undefined;
- return new LayerSelection(layer);
- }
- };
-
- /**
- * @constructor
- */
- function TileSelection(tile, opt_data) {
- this.tile_ = tile;
- this.data_ = opt_data || {};
- }
-
- TileSelection.prototype = {
- __proto__: Selection.prototype,
-
- get specicifity() {
- return 2;
- },
-
- get associatedLayerId() {
- return this.tile_.layerId;
- },
-
- get highlightsByLayerId() {
- var highlights = {};
- highlights[this.tile_.layerId] = [
- {
- colorKey: this.tile_.objectInstance.typeName,
- rect: this.tile_.layerRect
- }
- ];
- return highlights;
- },
-
- createAnalysis: function() {
- var analysis = document.createElement(
- 'tr-ui-a-generic-object-view-with-label');
- analysis.label = 'Tile ' + this.tile_.objectInstance.id + ' on layer ' +
- this.tile_.layerId;
- if (this.data_) {
- analysis.object = {
- moreInfo: this.data_,
- tileArgs: this.tile_.args
- };
- } else {
- analysis.object = this.tile_.args;
- }
- return analysis;
- },
-
- findEquivalent: function(lthi) {
- var tileInstance = this.tile_.tileInstance;
- if (lthi.ts < tileInstance.creationTs ||
- lthi.ts >= tileInstance.deletionTs)
- return undefined;
- var tileSnapshot = tileInstance.getSnapshotAt(lthi.ts);
- if (!tileSnapshot)
- return undefined;
- return new TileSelection(tileSnapshot);
- }
- };
-
- /**
- * @constructor
- */
- function LayerRectSelection(layer, rectType, rect, opt_data) {
- this.layer_ = layer;
- this.rectType_ = rectType;
- this.rect_ = rect;
- this.data_ = opt_data !== undefined ? opt_data : rect;
- }
-
- LayerRectSelection.prototype = {
- __proto__: Selection.prototype,
-
- get specicifity() {
- return 2;
- },
-
- get associatedLayerId() {
- return this.layer_.layerId;
- },
-
-
- get highlightsByLayerId() {
- var highlights = {};
- highlights[this.layer_.layerId] = [
- {
- colorKey: this.rectType_,
- rect: this.rect_
- }
- ];
- return highlights;
- },
-
- createAnalysis: function() {
- var analysis = document.createElement(
- 'tr-ui-a-generic-object-view-with-label');
- analysis.label = this.rectType_ + ' on layer ' + this.layer_.layerId;
- analysis.object = this.data_;
- return analysis;
- },
-
- findEquivalent: function(lthi) {
- return undefined;
- }
- };
-
- /**
- * @constructor
- */
- function AnimationRectSelection(layer, rect) {
- this.layer_ = layer;
- this.rect_ = rect;
- }
-
- AnimationRectSelection.prototype = {
- __proto__: Selection.prototype,
-
- get specicifity() {
- return 0;
- },
-
- get associatedLayerId() {
- return this.layer_.layerId;
- },
-
- createAnalysis: function() {
- var analysis = document.createElement(
- 'tr-ui-a-generic-object-view-with-label');
- analysis.label = 'Animation Bounds of layer ' + this.layer_.layerId;
- analysis.object = this.rect_;
- return analysis;
- }
- };
-
- return {
- Selection: Selection,
- RenderPassSelection: RenderPassSelection,
- LayerSelection: LayerSelection,
- TileSelection: TileSelection,
- LayerRectSelection: LayerRectSelection,
- AnimationRectSelection: AnimationRectSelection
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/tile_view.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/tile_view.html
deleted file mode 100644
index 2c556c67a7b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/cc/tile_view.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/cc/tile.html">
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-<link rel="import" href="/tracing/ui/analysis/object_snapshot_view.html">
-
-<script>
-
-'use strict';
-
-tr.exportTo('tr.ui.e.chrome.cc', function() {
- /*
- * Displays a tile in a human readable form.
- * @constructor
- */
- var TileSnapshotView = tr.ui.b.define(
- 'tr-ui-e-chrome-cc-tile-snapshot-view',
- tr.ui.analysis.ObjectSnapshotView);
-
- TileSnapshotView.prototype = {
- __proto__: tr.ui.analysis.ObjectSnapshotView.prototype,
-
- decorate: function() {
- this.classList.add('tr-ui-e-chrome-cc-tile-snapshot-view');
- this.layerTreeView_ =
- new tr.ui.e.chrome.cc.LayerTreeHostImplSnapshotView();
- this.appendChild(this.layerTreeView_);
- },
-
- updateContents: function() {
- var tile = this.objectSnapshot_;
- var layerTreeHostImpl = tile.containingSnapshot;
- if (!layerTreeHostImpl)
- return;
-
- this.layerTreeView_.objectSnapshot = layerTreeHostImpl;
- this.layerTreeView_.selection = new tr.ui.e.chrome.cc.TileSelection(tile);
- }
- };
-
- tr.ui.analysis.ObjectSnapshotView.register(
- TileSnapshotView,
- {
- typeName: 'cc::Tile',
- showInTrackView: false
- });
-
- return {
- TileSnapshotView: TileSnapshotView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/gpu.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/gpu.html
deleted file mode 100644
index 93811e10bff..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/gpu.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/gpu/state.html">
-<link rel="import" href="/tracing/extras/chrome/gpu/gpu_async_slice.html">
-<link rel="import" href="/tracing/ui/extras/chrome/gpu/state_view.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/images/checkerboard.png b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/images/checkerboard.png
deleted file mode 100644
index 8ea9bc726bb..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/images/checkerboard.png
+++ /dev/null
Binary files differ
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/state_view.css b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/state_view.css
deleted file mode 100644
index 466dbb56585..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/state_view.css
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-.tr-ui-e-chrome-gpu-state-snapshot-view {
- background: url('./images/checkerboard.png');
- display: -webkit-flex;
- overflow: auto;
-}
-
-.tr-ui-e-chrome-gpu-state-snapshot-view img {
- display: block;
- margin: 16px auto 16px auto;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/state_view.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/state_view.html
deleted file mode 100644
index 77bb005fcf3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome/gpu/state_view.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/extras/chrome/gpu/state_view.css">
-
-<link rel="import" href="/tracing/ui/analysis/object_snapshot_view.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.chrome.gpu', function() {
- /*
- * Displays a GPU state snapshot in a human readable form.
- * @constructor
- */
- var StateSnapshotView = tr.ui.b.define(
- 'tr-ui-e-chrome-gpu-state-snapshot-view',
- tr.ui.analysis.ObjectSnapshotView);
-
- StateSnapshotView.prototype = {
- __proto__: tr.ui.analysis.ObjectSnapshotView.prototype,
-
- decorate: function() {
- this.classList.add('tr-ui-e-chrome-gpu-state-snapshot-view');
- this.screenshotImage_ = document.createElement('img');
- this.appendChild(this.screenshotImage_);
- },
-
- updateContents: function() {
- if (this.objectSnapshot_ && this.objectSnapshot_.screenshot) {
- this.screenshotImage_.src = 'data:image/png;base64,' +
- this.objectSnapshot_.screenshot;
- }
- }
- };
- tr.ui.analysis.ObjectSnapshotView.register(
- StateSnapshotView,
- {typeName: 'gpu::State'});
-
- return {
- StateSnapshotView: StateSnapshotView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome_config.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome_config.html
deleted file mode 100644
index cd9fb3f91c4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/chrome_config.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<!--
-The chrome config is heavily used:
- - chrome://tracing,
- - trace2html, which in turn implies
- - adb_profile_chrome
- - telemetry
--->
-
-<link rel="import" href="/tracing/extras/chrome_config.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/extras/chrome/cc/cc.html">
-<link rel="import" href="/tracing/ui/extras/chrome/gpu/gpu.html">
-<link rel="import" href="/tracing/ui/extras/side_panel/frame_data_side_panel.html">
-<link rel="import" href="/tracing/ui/extras/side_panel/input_latency_side_panel.html">
-<link rel="import" href="/tracing/ui/extras/side_panel/time_summary_side_panel.html">
-<link rel="import" href="/tracing/ui/extras/system_stats/system_stats.html">
-<link rel="import" href="/tracing/ui/timeline_view.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/deep_reports/html_results.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/deep_reports/html_results.html
deleted file mode 100644
index a515ac4123f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/deep_reports/html_results.html
+++ /dev/null
@@ -1,117 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/table.html">
-
-<!--
-This class tries to (simply) copy the telemetry Results object, but outputs
-directly to an HTML table. It takes things that look like Telemetry values,
-and updates the table internally.
--->
-<polymer-element name="tr-ui-e-deep-reports-html-results">
- <template>
- <style>
- :host {
- display: flex;
- }
- </style>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.hasColumnNamed_ = {};
- this.pageToRowMap_ = new WeakMap();
- },
-
- ready: function() {
- var table = this.$.table;
- table.tableColumns = [
- {
- title: 'Label',
- value: function(row) { return row.label; },
- width: '350px'
- }
- ];
- this.clear();
- },
-
- clear: function() {
- this.$.table.tableRows = [];
- },
-
- addColumnIfNeeded_: function(columnName) {
- if (this.hasColumnNamed_[columnName])
- return;
- this.hasColumnNamed_[columnName] = true;
-
- var column = {
- title: columnName,
- value: function(row) {
- if (row[columnName] === undefined)
- return '';
- return row[columnName];
- }
- };
-
- var columns = this.$.table.tableColumns;
- columns.push(column);
-
- // Update widths.
- var colWidthPercentage;
- if (columns.length == 1)
- colWidthPercentage = '100%';
- else
- colWidthPercentage = (100 / (columns.length - 1)).toFixed(3) + '%';
-
- for (var i = 1; i < columns.length; i++)
- columns[i].width = colWidthPercentage;
-
- this.$.table.tableColumns = columns;
- },
-
- getRowForPage_: function(page) {
- if (!this.pageToRowMap_.has(page)) {
- var i = page.url.lastIndexOf('/');
- var baseName = page.url.substring(i + 1);
-
- var link = document.createElement('a');
- link.href = 'trace_viewer.html#' + page.url;
- link.textContent = baseName;
-
- var row = {
- label: link,
- value: '',
- subRows: [],
- isExpanded: true
- };
- this.$.table.tableRows.push(row);
- this.pageToRowMap_.set(page, row);
-
- // Kick table rebuild.
- this.$.table.tableRows = this.$.table.tableRows;
- }
- return this.pageToRowMap_.get(page);
- },
-
- addValue: function(value) {
- /* Value is expected to be a scalar telemetry-style Value. */
- if (value.type !== 'scalar')
- throw new Error('wat');
-
- this.addColumnIfNeeded_(value.name);
- var rowForPage = this.getRowForPage_(value.page);
- rowForPage[value.name] = value.value;
-
- // Kick table rebuild.
- this.$.table.tableRows = this.$.table.tableRows;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/deep_reports/main.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/deep_reports/main.html
deleted file mode 100644
index 88af3f292d3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/deep_reports/main.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/xhr.html">
-<link rel="import" href="/tracing/ui/extras/deep_reports/scalar_value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.deep_reports', function() {
- /**
- * Runs deep reports on the provided files, and pushes telemetry-style
- * values to the results object.
- */
- function main(results, filesInDir) {
- var lastP = new Promise(function(resolve) { resolve(); });
-
- filesInDir.forEach(function(filename) {
- // TODO(nduca): Make this like telemetry page.
- var page = {
- url: filename
- };
- lastP = lastP.then(function() {
- return loadModelFromFileAsync(filename);
- });
- lastP = lastP.then(function(model) {
- processModel(results, page, model);
- });
- });
- return lastP;
- }
-
- function loadModelFromFileAsync(filename) {
- return tr.b.getAsync(filename).then(function(trace) {
- var io = new tr.ImportOptions();
- io.shiftWorldToZero = true;
- io.pruneEmptyContainers = false;
-
- var m = new tr.Model();
- try {
- m.importTraces([trace], io);
- } catch (e) {
- throw new Error('While loading ' + filename + ' got: ' + e.toString());
- }
- return m;
- });
- }
-
- function processModel(results, page, model) {
- results.addValue(
- new tr.ui.e.deep_reports.ScalarValue(
- page, 'numRailIRs', 'ms', model.userModel.expectations.length));
- }
-
- return {
- main: main
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/deep_reports/scalar_value.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/deep_reports/scalar_value.html
deleted file mode 100644
index 7dcd2bc36c9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/deep_reports/scalar_value.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.deep_reports', function() {
- function ScalarValue(page, name, units, value,
- opt_important, opt_description) {
- this.type = 'scalar';
- this.page = page;
- this.name = name;
- this.units = units;
- this.value = value;
- this.important = opt_important !== undefined ? opt_important : false;
- this.description = opt_description || '';
- }
- ScalarValue.fromDict = function(page, dict) {
- if (dict.type !== 'scalar')
- throw new Error('wat');
- var v = new ScalarValue(page, dict.name, dict.units, dict.value);
- v.important = dict.important;
- v.description = dict.description;
- v.value = dict.value;
- return v;
- }
-
- ScalarValue.prototype = {
-
- };
-
- return {
- ScalarValue: ScalarValue
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/drive/comment_element.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/drive/comment_element.html
deleted file mode 100644
index 180f2ce97b4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/drive/comment_element.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<polymer-element name="tr-ui-e-drive-comment-element" attributes="comment">
- <template>
- <style>
- :host {
- display: block;
- }
- #comment-area {
- display: flex;
- flex-direction: column;
- border-top: 1px solid #e8e8e8;
- background-color: white;
- padding: 6px;
- margin-bottom: 4px;
- box-shadow: 0 1px 3px rgba(0,0,0,0.3);
- border-radius: 2px;
- font-size: small;
- }
- #comment-header {
- display: flex;
- flex-direction: row;
- align-items: center;
- margin-bottom: 8px;
- }
- #comment-header-text {
- display: flex;
- flex-direction: column;
- padding-left: 10px;
- }
- #comment-img {
- width: 32px;
- height: 32px;
- }
- #comment-text-author {
- padding-bottom: 2px;
- }
- #comment-date {
- color: #777;
- font-size: 11px;
- }
- #comment-content {
- word-wrap: break-word;
- }
- </style>
- <div id="comment-area">
- <div id="comment-header">
- <img id="comment-img" src="{{ comment.author.picture.url }}" />
- <div id="comment-header-text">
- <div id="comment-text-author">{{ comment.author.displayName }}</div>
- <div id="comment-date">{{ createdDate }}</div>
- </div>
- </div>
- <div id="comment-content">{{ comment.anchor ? '&#9875;&nbsp;' : '' }}
- {{ comment.content }}</div>
- </div>
- </template>
- <script>
- 'use strict';
- Polymer({
- commentChanged: function() {
- this.createdDate = new Date(this.comment.createdDate).toLocaleString();
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/drive/comments_side_panel.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/drive/comments_side_panel.html
deleted file mode 100644
index 3728481be17..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/drive/comments_side_panel.html
+++ /dev/null
@@ -1,180 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/extras/drive/comment_element.html">
-
-<polymer-element name='tr-ui-e-drive-comments-side-panel'
- extends='tr-ui-side-panel'>
- <template>
- <style>
- :host {
- flex-direction: column;
- display: flex;
- width: 290px;
- overflow-y: scroll;
- overflow-x: hidden;
- background-color: #eee;
- }
- toolbar {
- flex: 0 0 auto;
- border-bottom: 1px solid black;
- display: flex;
- }
- result-area {
- flex: 1 1 auto;
- display: block;
- min-height: 0;
- padding: 4px;
- }
- #comments-textarea-container {
- display: flex;
- }
- #commentinput {
- width: 100%;
- }
- </style>
-
- <toolbar id='toolbar'></toolbar>
- <result-area id='result_area'>
- <template repeat="{{ comment in comments_ }}">
- <tr-ui-e-drive-comment-element comment="{{comment}}"
- on-click="{{commentClick}}">
- </tr-ui-e-drive-comment-element>
- </template>
- <div id="comments-textarea-container">
- <textarea id="commentinput" on-focus='{{textAreaFocus}}'
- on-blur='{{textAreaBlur}}'
- on-keypress="{{textareaKeypress}}"></textarea>
- </div>
- </result-area>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.rangeOfInterest_ = new tr.b.Range();
- this.selection_ = undefined;
- this.comments_ = [];
- this.annotationFromComment_ = undefined;
- this.textAreaFocused = false;
- },
-
- setCommentProvider: function(commentProvider) {
- this.commentProvider_ = commentProvider;
- },
-
- attached: function() {
- if (this.commentProvider_ === undefined) {
- this.commentProvider_ =
- new tr.ui.e.drive.analysis.DefaultCommentProvider();
- }
- this.commentProvider_.attachToElement(this);
- },
-
- detached: function() {
- this.commentProvider_.detachFromElement();
- },
-
- commentClick: function(event, detail, sender) {
- var anchor = sender.comment.anchor;
- if (anchor === undefined)
- return;
-
- var uiState =
- JSON.parse(anchor).a[0][tr.ui.e.drive.constants.ANCHOR_NAME];
-
- var myEvent = new CustomEvent('navigateToUIState', { detail:
- new tr.ui.b.UIState(new tr.model.Location(uiState.location.xWorld,
- uiState.location.yComponents),
- uiState.scaleX)
- });
- document.dispatchEvent(myEvent);
-
- if (this.annotationFromComment_)
- this.model.removeAnnotation(this.annotationFromComment_);
- var loc = new tr.model.Location(uiState.location.xWorld,
- uiState.location.yComponents);
-
- var text = sender.comment.author.displayName + ': ' +
- sender.comment.content;
- this.annotationFromComment_ =
- new tr.model.CommentBoxAnnotation(loc, text);
- this.model.addAnnotation(this.annotationFromComment_);
- },
-
- textareaKeypress: function(event, detail, sender) {
- // Check for return key.
- if (event.keyCode === 13 && !event.ctrlKey) {
- this.commentProvider_.addComment(this.$.commentinput.value);
- this.$.commentinput.value = '';
- }
- event.stopPropagation();
- return true;
- },
-
- textAreaFocus: function(event) {
- this.textAreaFocused = true;
- },
-
- textAreaBlur: function(event) {
- this.textAreaFocused = false;
- },
-
- get rangeOfInterest() {
- return this.rangeOfInterest_;
- },
-
- set rangeOfInterest(rangeOfInterest) {
- this.rangeOfInterest_ = rangeOfInterest;
- this.updateContents_();
- },
-
- get currentRangeOfInterest() {
- if (this.rangeOfInterest_.isEmpty)
- return this.model_.bounds;
- else
- return this.rangeOfInterest_;
- },
-
- get model() {
- return this.model_;
- },
-
- set model(model) {
- this.model_ = model;
- this.updateContents_();
- },
-
- set selection(selection) {
- this.selection_ = selection;
- },
-
- updateContents_: function() {
- this.commentProvider_.updateComments();
- },
-
- supportsModel: function(m) {
- if (m === undefined) {
- return {
- supported: false,
- reason: 'Unknown tracing model'
- };
- }
- return {
- supported: true
- };
- },
-
- get textLabel() {
- return 'Comments';
- }
- });
-
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/drive/comments_side_panel_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/drive/comments_side_panel_test.html
deleted file mode 100644
index bca061a876d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/drive/comments_side_panel_test.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/extras/drive/comments_side_panel.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function StubCommentProvider() {
- this.addDummyComment('Lorem ipsum dolor sit amet');
- this.addDummyComment('consectetur adipiscing elit');
- this.addDummyComment('sed do eiusmod tempor incididunt ut labore et ' +
- 'dolore magna aliqua. Ut enim ad minim veniam, quis nostrud ' +
- 'exercitation ullamco laboris nisi ut aliquip ex ea commodo ' +
- 'consequat. Duis aute irure dolor in reprehenderit in voluptate ' +
- 'velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint ' +
- 'occaecat cupidatat non proident, sunt in culpa qui officia deserunt ' +
- 'mollit anim id est laborum.');
- }
-
- StubCommentProvider.prototype = {
- comments_: [],
-
- attachToElement: function(attachedElement) {
- this.attachedElement_ = attachedElement;
- this.updateComments();
- },
-
- detachFromElement: function() {
- },
-
- updateComments: function() {
- this.attachedElement_.comments_ = this.comments_;
- },
-
- addDummyComment: function(content) {
- var newComment = {
- author: {
- displayName: 'Casper the Friendly Ghost',
- picture: {
- url: 'https://lh3.googleusercontent.com/-XdUIqdMkCWA/' +
- 'AAAAAAAAAAI/AAAAAAAAAAA/4252rscbv5M/s128/photo.jpg'
- }
- },
- createdDate: Date.now(),
- anchor: (this.comments_.length) % 2 ? 1 : 0,
- content: content
- };
-
- this.comments_.push(newComment);
- },
-
- addComment: function(body) {
- this.addDummyComment(body);
- this.updateComments();
- }
- };
-
- test('instantiate', function() {
- var panel = document.createElement('tr-ui-e-drive-comments-side-panel');
- panel.setCommentProvider(new StubCommentProvider);
- this.addHTMLOutput(panel);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/drive/drive_comment_provider.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/drive/drive_comment_provider.html
deleted file mode 100644
index c55f98a727f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/drive/drive_comment_provider.html
+++ /dev/null
@@ -1,101 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/side_panel/side_panel.html">
-<link rel="import" href="/tracing/model/comment_box_annotation.html">
-
-<link rel="import" href="/tracing/ui/extras/drive/comments_side_panel.html">
-
-<script>
-'use strict';
-
-(function() {
- function addDriveCommentWithUIState_(text, uiState) {
- gapi.client.load('drive', 'v2', function() {
- var request = gapi.client.drive.revisions.get({
- 'fileId': tr.ui.e.drive.getDriveFileId(),
- 'revisionId': 'head'
- });
- request.execute(function(resp) {
- var anchorObject = {};
- anchorObject[tr.ui.e.drive.constants.ANCHOR_NAME] = uiState;
- var anchor = {
- 'r': resp.id,
- 'a': [anchorObject]
- };
- anchor = JSON.stringify(anchor);
- gapi.client.load('drive', 'v2', function() {
- var request = gapi.client.drive.comments.insert({
- 'fileId': tr.ui.e.drive.getDriveFileId(),
- 'resource': {'content': text, 'anchor': anchor}
- });
- request.execute();
- });
- });
- });
- };
-
- function onCommentWithUIState(e) {
- addDriveCommentWithUIState_(e.detail.name, e.detail.location);
- };
-
- document.addEventListener('commentWithUIState',
- onCommentWithUIState.bind(this));
-}());
-
-tr.exportTo('tr.ui.e.drive.analysis', function() {
- function DefaultCommentProvider() { }
-
- DefaultCommentProvider.prototype = {
- attachToElement: function(attachedElement) {
- this.attachedElement_ = attachedElement;
- this.commentsCheckTimer_ = setTimeout(this.checkForComments_.bind(this),
- 5000);
- },
-
- detachFromElement: function() {
- clearTimeout(this.commentsCheckTimer_);
- },
-
- checkForComments_: function() {
- this.updateComments();
- this.commentsCheckTimer_ = setTimeout(this.checkForComments_.bind(this),
- 5000);
- },
-
- updateComments: function() {
- var self = this;
- gapi.client.load('drive', 'v2', function() {
- var request = gapi.client.drive.comments.list({
- 'fileId': tr.ui.e.drive.getDriveFileId()
- });
- request.execute(function(results) {
- self.attachedElement_.comments_ = results.items;
- });
- });
- },
-
- addComment: function(body) {
- var self = this;
- gapi.client.load('drive', 'v2', function() {
- var request = gapi.client.drive.comments.insert({
- 'fileId': tr.ui.e.drive.getDriveFileId(),
- 'resource': {'content': body}
- });
- request.execute(function(resp) {
- self.updateComments();
- });
- });
- }
- };
-
- return {
- DefaultCommentProvider: DefaultCommentProvider
- };
-});
-
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/drive/index.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/drive/index.html
deleted file mode 100644
index 2c44cea24ff..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/drive/index.html
+++ /dev/null
@@ -1,462 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-
- <script type="text/javascript" src="https://apis.google.com/js/api.js"></script>
-
- <link rel="import" href="/components/polymer/polymer.html">
- <link rel="import" href="/tracing/ui/extras/full_config.html">
- <link rel="import" href="/tracing/ui/timeline_view.html">
- <link rel="import" href="/tracing/ui/extras/drive/drive_comment_provider.html">
-
- <style>
- body {
- margin: 0;
- padding: 0;
- width: 100%;
- height: 100%;
- display: -webkit-flex;
- -webkit-flex-direction: column;
- }
- body > x-timeline-view {
- -webkit-flex: 1 1 auto;
- overflow: hidden;
- position: absolute;
- top: 0px;
- bottom: 0;
- left: 0;
- right: 0;
- }
- body > x-timeline-view:focus {
- outline: none;
- }
- nav {
- display: flex;
- flex-direction: row;
- justify-content: flex-end;
- }
- #navbar button {
- height: 24px;
- padding-bottom: 3px;
- vertical-align: middle;
- box-shadow: none;
- background-color: #4d90fe;
- background-image: -webkit-linear-gradient(top,#4d90fe,#4787ed);
- border: 1px solid #3079ed;
- color: #fff;
- border-radius: 2px;
- cursor: default;
- font-size: 11px;
- font-weight: bold;
- text-align: center;
- white-space: nowrap;
- line-height: 27px;
- min-width: 54px;
- outline: 0px;
- padding: 0 8px;
- font: normal 13px arial,sans-serif;
- margin: 5px;
- }
- #collabs {
- display: flex;
- flex-direction: row;
- }
- .collaborator-div {
- display: inline-block;
- vertical-align: middle;
- min-height: 0;
- width: 100px;
- font-size: 11px;
- font-weight: bold;
- font: normal 13px arial,sans-serif;
- margin: 10px;
- }
- .collaborator-img {
- margin: 2px;
- }
- .collaborator-tooltip {
- z-index: 10000;
- transition: visibility 0,opacity .13s ease-in;
- background-color: #2a2a2a;
- border: 1px solid #fff;
- color: #fff;
- cursor: default;
- display: block;
- font-family: arial, sans-serif;
- font-size: 11px;
- font-weight: bold;
- margin-left: -1px;
- opacity: 1;
- padding: 7px 9px;
- word-break: break-word;
- position: absolute;
- }
- .collaborator-tooltip-content {
- color: #fff;
- }
- .collaborator-tooltip-arrow {
- position: absolute;
- top: -6px;
- }
- .collaborator-tooltip-arrow-before {
- border-color: #fff transparent !important;
- left: -6px;
- border: 6px solid;
- border-top-width: 0;
- content: '';
- display: block;
- height: 0;
- position: absolute;
- width: 0;
- }
- .collaborator-tooltip-arrow-after {
- top: 1px;
- border-color: #2a2a2a transparent !important;
- left: -5px;
- border: 5px solid;
- border-top-width: 0;
- content: '';
- display: block;
- height: 0;
- position: absolute;
- width: 0;
- }
-
- </style>
- <title>Trace Viewer</title>
-</head>
-<body>
- <nav id="navbar">
- <div id="collabs"></div>
- <button id="x-drive-save-to-disk">Save to disk</button>
- <button id="x-drive-save-to-drive">Save to Drive</button>
- <button id="x-drive-load-from-drive">Load from Drive</button>
- <button id="x-drive-share">Share</button>
- </nav>
- <x-timeline-view>
- </x-timeline-view>
-
- <script>
- 'use strict';
-
- // Needs to be global as it's passed through the Google API as a
- // GET parameter.
- var onAPIClientLoaded_ = null;
-
- (function() {
-
- tr.exportTo('tr.ui.e.drive', function() {
- var appId = '239864068844';
- var constants = {
- APP_ID: appId,
- ANCHOR_NAME: appId + '.trace_viewer',
- DEVELOPER_KEY: 'AIzaSyDR-6_wL9vHg1_oz4JHk8IQAkv2_Y0Y8-M',
- CLIENT_ID: '239864068844-c7gefbfdcp0j6grltulh2r88tsvl18c1.apps.' +
- 'googleusercontent.com',
- SCOPE: [
- 'https://www.googleapis.com/auth/drive',
- 'https://www.googleapis.com/auth/drive.install',
- 'https://www.googleapis.com/auth/drive.file',
- 'profile'
- ]
- };
-
- return {
- getDriveFileId: function() { return driveFileId_; },
- constants: constants
- };
- });
-
-
- var pickerApiLoaded_ = false;
- var oauthToken_ = null;
-
- var timelineViewEl_ = null;
- var driveDocument_ = null;
- var shareClient_ = null;
- var fileIdToLoad_ = null;
- var driveFileId_ = null;
-
- function parseGETParameter(val) {
- var result = null;
- var tmp = [];
- location.search.substr(1).split('&').forEach(function(item) {
- tmp = item.split('=');
- if (tmp[0] === val)
- result = decodeURIComponent(tmp[1]);
- });
- return result;
- }
-
- // Use the Google API Loader script to load the google.picker script.
- onAPIClientLoaded_ = function() {
- var driveState = parseGETParameter('state');
- if (driveState != null) {
- var driveStateJson = JSON.parse(driveState);
- fileIdToLoad_ = String(driveStateJson.ids);
- }
-
- gapi.load('picker', {'callback': onPickerApiLoad});
- gapi.load('auth', {'callback': function() {
- onAuthApiLoad(true, onAuthResultSuccess);
- setTimeout(function onRepeatAuthApiLoad() {
- onAuthApiLoad(true, function() {});
- setTimeout(onRepeatAuthApiLoad, 30000);
- }, 30000);
- }});
- }
-
- function onAuthApiLoad(tryImmediate, resultCallback) {
- window.gapi.auth.authorize(
- {'client_id': tr.ui.e.drive.constants.CLIENT_ID,
- 'scope': tr.ui.e.drive.constants.SCOPE, 'immediate': tryImmediate},
- function(authResult) {
- handleAuthResult(authResult, tryImmediate, resultCallback);
- });
- }
-
- function onPickerApiLoad() {
- pickerApiLoaded_ = true;
- if (fileIdToLoad_ == null)
- createPicker();
- }
-
- function onAuthResultSuccess() {
- if (fileIdToLoad_ == null)
- createPicker();
- else
- loadFileFromDrive(fileIdToLoad_);
- }
-
- function handleAuthResult(authResult, wasImmediate, resultCallback) {
- if (authResult && !authResult.error) {
- oauthToken_ = authResult.access_token;
- resultCallback();
- } else if (wasImmediate) {
- onAuthApiLoad(false);
- }
- }
-
- function createPicker() {
- if (pickerApiLoaded_ && oauthToken_) {
- var view = new google.picker.View(google.picker.ViewId.DOCS);
- view.setMimeTypes('application/json,application/octet-stream');
- var picker = new google.picker.PickerBuilder()
- .enableFeature(google.picker.Feature.NAV_HIDDEN)
- .enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
- .setAppId(tr.ui.e.drive.constants.APP_ID)
- .setOAuthToken(oauthToken_)
- .addView(view)
- .addView(new google.picker.DocsUploadView())
- .setDeveloperKey(tr.ui.e.drive.constants.DEVELOPER_KEY)
- .setCallback(pickerCallback)
- .build();
- picker.setVisible(true);
- }
- }
-
- function pickerCallback(data) {
- if (data.action == google.picker.Action.PICKED) {
- loadFileFromDrive(data.docs[0].id);
- }
- }
-
- function initShareButton() {
- shareClient_ = new gapi.drive.share.ShareClient(
- tr.ui.e.drive.constants.APP_ID);
- shareClient_.setItemIds([driveFileId_]);
- }
-
- function loadFileFromDrive(fileId) {
- gapi.client.load('drive', 'v2', function() {
- var request = gapi.client.drive.files.get({'fileId': fileId});
- request.execute(function(resp) { downloadFile(resp); });
- driveFileId_ = fileId;
- gapi.load('drive-share', initShareButton);
- });
- }
-
- function downloadFile(file) {
- if (file.downloadUrl) {
- var downloadingOverlay = tr.ui.b.Overlay();
- downloadingOverlay.title = 'Downloading...';
- downloadingOverlay.userCanClose = false;
- downloadingOverlay.msgEl = document.createElement('div');
- downloadingOverlay.appendChild(downloadingOverlay.msgEl);
- downloadingOverlay.msgEl.style.margin = '20px';
- downloadingOverlay.update = function(msg) {
- this.msgEl.textContent = msg;
- }
- downloadingOverlay.visible = true;
-
- var accessToken = gapi.auth.getToken().access_token;
- var xhr = new XMLHttpRequest();
- xhr.open('GET', file.downloadUrl);
- xhr.setRequestHeader('Authorization', 'Bearer ' + accessToken);
- xhr.onload = function() {
- downloadingOverlay.visible = false;
- onDownloaded(file.title, xhr.responseText);
- };
- xhr.onprogress = function(evt) {
- downloadingOverlay.update(
- Math.floor(evt.position * 100 / file.fileSize) + '% complete');
- };
- xhr.onerror = function() { alert('Failed downloading!'); };
- xhr.send();
- } else {
- alert('No URL!');
- }
- }
-
- function displayAllCollaborators() {
- var allCollaborators = driveDocument_.getCollaborators();
- var collaboratorCount = allCollaborators.length;
- var collabspan = document.getElementById('collabs');
- collabspan.innerHTML = '';
- var imageList = [];
- for (var i = 0; i < collaboratorCount; i++) {
- var user = allCollaborators[i];
-
- var img = document.createElement('img');
- img.src = user.photoUrl;
- img.alt = user.displayName;
- img.height = 30;
- img.width = 30;
- img.className = 'collaborator-img';
- collabspan.appendChild(img);
- imageList.push({'image': img, 'name': user.displayName});
- }
- for (i = 0; i < imageList.length; i++) {
- var collabTooltip = tr.ui.b.createDiv({
- className: 'collaborator-tooltip'
- });
- var collabTooltipContent = tr.ui.b.createDiv({
- className: 'collaborator-tooltip-content'
- });
- collabTooltipContent.textContent = imageList[i].name;
- collabTooltip.appendChild(collabTooltipContent);
- collabspan.appendChild(collabTooltip);
- var collabTooltipArrow = tr.ui.b.createDiv({
- className: 'collaborator-tooltip-arrow'});
- collabTooltip.appendChild(collabTooltipArrow);
- var collabTooltipArrowBefore = tr.ui.b.createDiv({
- className: 'collaborator-tooltip-arrow-before'});
- collabTooltipArrow.appendChild(collabTooltipArrowBefore);
- var collabTooltipArrowAfter = tr.ui.b.createDiv({
- className: 'collaborator-tooltip-arrow-after'});
- collabTooltipArrow.appendChild(collabTooltipArrowAfter);
-
- var rect = imageList[i].image.getBoundingClientRect();
- collabTooltip.style.top = (rect.bottom - 6) + 'px';
- collabTooltip.style.left =
- (rect.left + 16 - (collabTooltip.offsetWidth / 2)) + 'px';
- collabTooltipArrow.style.left = (collabTooltip.offsetWidth / 2) + 'px';
- collabTooltip.style.visibility = 'hidden';
- function visibilityDelegate(element, visibility) {
- return function() {
- element.style.visibility = visibility;
- }
- }
- imageList[i].image.addEventListener(
- 'mouseover', visibilityDelegate(collabTooltip, 'visible'));
- imageList[i].image.addEventListener(
- 'mouseout', visibilityDelegate(collabTooltip, 'hidden'));
- }
- }
-
- function onRealtimeFileLoaded(doc) {
- if (driveDocument_)
- driveDocument_.close();
- driveDocument_ = doc;
- doc.addEventListener(gapi.drive.realtime.EventType.COLLABORATOR_JOINED,
- displayAllCollaborators);
- doc.addEventListener(gapi.drive.realtime.EventType.COLLABORATOR_LEFT,
- displayAllCollaborators);
-
- displayAllCollaborators(doc);
- }
-
- function onRealtimeError(e) {
- alert('Error loading realtime: ' + e);
- }
-
- function onDownloaded(filename, content) {
- gapi.load('auth:client,drive-realtime,drive-share', function() {
- gapi.drive.realtime.load(driveFileId_,
- onRealtimeFileLoaded,
- null,
- onRealtimeError);
-
- });
-
- var traces = [];
- var filenames = [];
- filenames.push(filename);
- traces.push(content);
- createViewFromTraces(filenames, traces);
- }
-
- function createViewFromTraces(filenames, traces) {
- var m = new tr.Model();
- var i = new tr.importer.Import(m);
- var p = i.importTracesWithProgressDialog(traces);
- p.then(
- function() {
- timelineViewEl_.model = m;
- timelineViewEl_.updateDocumentFavicon();
- timelineViewEl_.globalMode = true;
- timelineViewEl_.viewTitle = '';
- },
- function(err) {
- var downloadingOverlay = new tr.ui.b.Overlay();
- downloadingOverlay.textContent =
- tr.b.normalizeException(err).message;
- downloadingOverlay.title = 'Import error';
- downloadingOverlay.visible = true;
- });
- }
-
- function onSaveToDiskClicked() {
- throw new Error('Not implemented');
- }
-
- function onSaveToDriveClicked() {
- throw new Error('Not implemented');
- }
-
- function onLoadFromDriveClicked() {
- createPicker();
- }
-
- function onLoad() {
- timelineViewEl_ = document.querySelector('x-timeline-view');
- timelineViewEl_.globalMode = true;
- var navbar = document.getElementById('navbar');
- timelineViewEl_.style.top = navbar.offsetHeight + 'px';
- tr.ui.b.decorate(timelineViewEl_, tr.ui.TimelineView);
- }
-
- window.addEventListener('load', onLoad);
-
- document.getElementById('x-drive-save-to-disk').onclick =
- onSaveToDiskClicked;
- document.getElementById('x-drive-save-to-drive').onclick =
- onSaveToDriveClicked;
- document.getElementById('x-drive-load-from-drive').onclick =
- onLoadFromDriveClicked;
- document.getElementById('x-drive-share').onclick = function() {
- shareClient_.showSettingsDialog();
- };
-
- }());
-
- </script>
- <script type="text/javascript"
- src="https://apis.google.com/js/client.js?onload=onAPIClientLoaded_">
- </script>
-</body>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/full_config.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/full_config.html
deleted file mode 100644
index f27fbafd1ce..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/full_config.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<!-- The full config is all the configs slammed together. -->
-<link rel="import" href="/tracing/extras/importer/gcloud_trace/gcloud_trace_importer.html">
-<link rel="import" href="/tracing/ui/extras/chrome_config.html">
-<link rel="import" href="/tracing/ui/extras/lean_config.html">
-<link rel="import" href="/tracing/ui/extras/systrace_config.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/highlighter/vsync_highlighter.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/highlighter/vsync_highlighter.html
deleted file mode 100644
index b804717a76a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/highlighter/vsync_highlighter.html
+++ /dev/null
@@ -1,122 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/tracks/highlighter.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-<link rel="import" href="/tracing/ui/timeline_viewport.html">
-<link rel="import" href="/tracing/ui/tracks/model_track.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Provides the VSyncHighlighter class.
- */
-tr.exportTo('tr.ui.e.highlighter', function() {
-
- var Highlighter = tr.ui.tracks.Highlighter;
-
- /**
- * Highlights VSync events on the model track (using "zebra" striping).
- * @constructor
- */
- function VSyncHighlighter(viewport) {
- Highlighter.call(this, viewport);
- this.times_ = [];
- }
-
- VSyncHighlighter.VSYNC_HIGHLIGHT_COLOR = new tr.b.Color(0, 0, 255);
- VSyncHighlighter.VSYNC_HIGHLIGHT_ALPHA = 0.1;
-
- VSyncHighlighter.VSYNC_DENSITY_TRANSPARENT = 0.20;
- VSyncHighlighter.VSYNC_DENSITY_OPAQUE = 0.10;
- VSyncHighlighter.VSYNC_DENSITY_RANGE =
- VSyncHighlighter.VSYNC_DENSITY_TRANSPARENT -
- VSyncHighlighter.VSYNC_DENSITY_OPAQUE;
-
- /**
- * Generate a zebra striping from a list of times.
- */
- VSyncHighlighter.generateStripes = function(times, minTime, maxTime) {
- if (times.length === 0)
- return [];
-
- var stripes = [];
-
- // Find the lowest and highest index within the viewport.
- var lowIndex = tr.b.findLowIndexInSortedArray(
- times,
- function(time) { return time; },
- minTime);
- var highIndex = lowIndex - 1;
- while (times[highIndex + 1] <= maxTime) {
- highIndex++;
- }
-
- // Must start at an even index and end at an odd index.
- for (var i = lowIndex - (lowIndex % 2); i <= highIndex; i += 2) {
- var left = i < lowIndex ? minTime : times[i];
- var right = i + 1 > highIndex ? maxTime : times[i + 1];
- stripes.push([left, right]);
- }
-
- return stripes;
- }
-
- VSyncHighlighter.prototype = {
- __proto__: Highlighter.prototype,
-
- processModel: function(model) {
- this.times_ = model.device.vSyncTimestamps;
- },
-
- drawHighlight: function(ctx, dt, viewLWorld, viewRWorld, viewHeight) {
- if (!this.viewport_.highlightVSync) {
- return;
- }
-
- var stripes = VSyncHighlighter.generateStripes(
- this.times_, viewLWorld, viewRWorld);
- if (stripes.length == 0) {
- return;
- }
-
- var stripeRange = stripes[stripes.length - 1][1] - stripes[0][0];
- var stripeDensity = stripes.length / (dt.scaleX * stripeRange);
- var clampedStripeDensity = tr.b.clamp(stripeDensity,
- VSyncHighlighter.VSYNC_DENSITY_OPAQUE,
- VSyncHighlighter.VSYNC_DENSITY_TRANSPARENT);
- var opacity =
- (VSyncHighlighter.VSYNC_DENSITY_TRANSPARENT - clampedStripeDensity) /
- VSyncHighlighter.VSYNC_DENSITY_RANGE;
- if (opacity == 0) {
- return;
- }
-
- var pixelRatio = window.devicePixelRatio || 1;
- var height = viewHeight * pixelRatio;
-
- var c = VSyncHighlighter.VSYNC_HIGHLIGHT_COLOR;
- ctx.fillStyle = c.toStringWithAlphaOverride(
- VSyncHighlighter.VSYNC_HIGHLIGHT_ALPHA * opacity);
-
- for (var i = 0; i < stripes.length; i++) {
- var xLeftView = dt.xWorldToView(stripes[i][0]);
- var xRightView = dt.xWorldToView(stripes[i][1]);
- ctx.fillRect(xLeftView, 0, xRightView - xLeftView, height);
- }
- }
- };
-
- // Register the highlighter.
- tr.ui.tracks.Highlighter.register(VSyncHighlighter);
-
- return {
- VSyncHighlighter: VSyncHighlighter
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/highlighter/vsync_highlighter_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/highlighter/vsync_highlighter_test.html
deleted file mode 100644
index 9e8f1779cbf..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/highlighter/vsync_highlighter_test.html
+++ /dev/null
@@ -1,151 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/thread.html">
-<link rel="import" href="/tracing/ui/extras/highlighter/vsync_highlighter.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- var VSyncHighlighter = tr.ui.e.highlighter.VSyncHighlighter;
-
- var VIEW_L_WORLD = 100;
- var VIEW_R_WORLD = 1000;
-
- function testGenerateStripes(times, expectedRanges) {
- var ranges = VSyncHighlighter.generateStripes(
- times, VIEW_L_WORLD, VIEW_R_WORLD);
-
- assert.sameDeepMembers(ranges, expectedRanges);
- }
-
- test('generateInside', function() {
- testGenerateStripes([], []);
- testGenerateStripes([200, 500], [[200, 500]]);
- testGenerateStripes([200, 500, 800, 900], [[200, 500], [800, 900]]);
- testGenerateStripes(
- [200, 500, 800, 900, 998, 999],
- [[200, 500], [800, 900], [998, 999]]);
- });
-
- test('generateOutside', function() {
- // Far left.
- testGenerateStripes([0, 99], []);
- testGenerateStripes([0, 10, 50, 99], []);
- testGenerateStripes([0, 99, 101, 999], [[101, 999]]);
- testGenerateStripes([0, 10, 50, 99, 101, 999], [[101, 999]]);
-
- // Far right.
- testGenerateStripes([1001, 2000], []);
- testGenerateStripes([1001, 2000, 3000, 4000], []);
- testGenerateStripes([101, 999, 1001, 2000], [[101, 999]]);
- testGenerateStripes([101, 999, 1001, 2000, 3000, 4000], [[101, 999]]);
-
- // Far both.
- testGenerateStripes([0, 99, 1001, 2000], []);
- testGenerateStripes([0, 10, 50, 99, 1001, 2000], []);
- testGenerateStripes([0, 10, 50, 99, 1001, 2000, 3000, 4000], []);
- testGenerateStripes([0, 99, 101, 999, 1001, 2000], [[101, 999]]);
- });
-
- test('generateOverlap', function() {
- // Left overlap.
- testGenerateStripes([0, 101], [[VIEW_L_WORLD, 101]]);
- testGenerateStripes([0, 1, 2, 101], [[VIEW_L_WORLD, 101]]);
- testGenerateStripes(
- [2, 101, 102, 103],
- [[VIEW_L_WORLD, 101], [102, 103]]);
- testGenerateStripes(
- [0, 1, 2, 101, 102, 103],
- [[VIEW_L_WORLD, 101], [102, 103]]);
- testGenerateStripes(
- [0, 1, 2, 101, 102, 103, 1001, 3000],
- [[VIEW_L_WORLD, 101], [102, 103]]);
-
- // Right overlap.
- testGenerateStripes([999, 2000], [[999, VIEW_R_WORLD]]);
- testGenerateStripes([999, 2000, 3000, 4000], [[999, VIEW_R_WORLD]]);
- testGenerateStripes(
- [997, 998, 999, 2000],
- [[997, 998], [999, VIEW_R_WORLD]]);
- testGenerateStripes(
- [997, 998, 999, 2000, 3000, 4000],
- [[997, 998], [999, VIEW_R_WORLD]]);
- testGenerateStripes(
- [0, 10, 997, 998, 999, 2000, 3000, 4000],
- [[997, 998], [999, VIEW_R_WORLD]]);
-
- // Both overlap.
- testGenerateStripes([0, 2000], [[VIEW_L_WORLD, VIEW_R_WORLD]]);
- testGenerateStripes(
- [0, 101, 999, 2000],
- [[VIEW_L_WORLD, 101], [999, VIEW_R_WORLD]]);
- testGenerateStripes(
- [0, 101, 200, 900, 999, 2000],
- [[VIEW_L_WORLD, 101], [200, 900], [999, VIEW_R_WORLD]]);
- testGenerateStripes(
- [0, 10, 90, 101, 999, 2000, 3000, 4000],
- [[VIEW_L_WORLD, 101], [999, VIEW_R_WORLD]]);
- testGenerateStripes(
- [0, 10, 90, 101, 200, 900, 999, 2000, 3000, 4000],
- [[VIEW_L_WORLD, 101], [200, 900], [999, VIEW_R_WORLD]]);
- });
-
- test('generateOdd', function() {
- // One VSync.
- testGenerateStripes([0], [[VIEW_L_WORLD, VIEW_R_WORLD]]);
- testGenerateStripes([500], [[500, VIEW_R_WORLD]]);
- testGenerateStripes([1500], []);
-
- // Multiple VSyncs.
- testGenerateStripes([0, 10, 20], [[VIEW_L_WORLD, VIEW_R_WORLD]]);
- testGenerateStripes([0, 500, 2000], [[VIEW_L_WORLD, 500]]);
- testGenerateStripes([0, 10, 500], [[500, VIEW_R_WORLD]]);
- testGenerateStripes([0, 10, 2000], []);
- testGenerateStripes(
- [0, 200, 500],
- [[VIEW_L_WORLD, 200], [500, VIEW_R_WORLD]]);
- testGenerateStripes(
- [0, 200, 500, 900],
- [[VIEW_L_WORLD, 200], [500, 900]]);
- });
-
- test('generateBorder', function() {
- testGenerateStripes([0, VIEW_L_WORLD], [[VIEW_L_WORLD, VIEW_L_WORLD]]);
- testGenerateStripes(
- [VIEW_L_WORLD, VIEW_L_WORLD],
- [[VIEW_L_WORLD, VIEW_L_WORLD]]);
- testGenerateStripes(
- [VIEW_R_WORLD, 2000],
- [[VIEW_R_WORLD, VIEW_R_WORLD]]);
- testGenerateStripes(
- [VIEW_R_WORLD, VIEW_R_WORLD],
- [[VIEW_R_WORLD, VIEW_R_WORLD]]);
- testGenerateStripes(
- [VIEW_L_WORLD, VIEW_R_WORLD],
- [[VIEW_L_WORLD, VIEW_R_WORLD]]);
- testGenerateStripes(
- [VIEW_L_WORLD, 200, 500, VIEW_R_WORLD],
- [[VIEW_L_WORLD, 200], [500, VIEW_R_WORLD]]);
- testGenerateStripes(
- [0, VIEW_L_WORLD, VIEW_R_WORLD, 2000],
- [[VIEW_L_WORLD, VIEW_L_WORLD], [VIEW_R_WORLD, VIEW_R_WORLD]]);
- testGenerateStripes(
- [0, VIEW_L_WORLD, VIEW_R_WORLD, 2000],
- [[VIEW_L_WORLD, VIEW_L_WORLD], [VIEW_R_WORLD, VIEW_R_WORLD]]);
- testGenerateStripes(
- [0, VIEW_L_WORLD, 200, 500, VIEW_R_WORLD, 2000],
- [[VIEW_L_WORLD, VIEW_L_WORLD], [200, 500],
- [VIEW_R_WORLD, VIEW_R_WORLD]]);
- testGenerateStripes(
- [0, 10, VIEW_L_WORLD, VIEW_R_WORLD, 2000, 3000],
- [[VIEW_L_WORLD, VIEW_R_WORLD]]);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/lean_config.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/lean_config.html
deleted file mode 100644
index 0197474ce45..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/lean_config.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/lean_config.html">
-
-<!--
-The lean config is just enough to import uncompressed, trace-event-formatted
-json blobs.
--->
-<link rel="import" href="/tracing/ui/extras/highlighter/vsync_highlighter.html">
-<link rel="import" href="/tracing/ui/side_panel/file_size_stats_side_panel.html">
-<link rel="import" href="/tracing/ui/side_panel/metrics_side_panel.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/alerts_side_panel.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/alerts_side_panel.html
deleted file mode 100644
index 5cc5b6dc241..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/alerts_side_panel.html
+++ /dev/null
@@ -1,161 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/ui/side_panel/side_panel.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/line_chart.html">
-
-<polymer-element name='tr-ui-e-s-alerts-side-panel'
- extends='tr-ui-side-panel'>
- <template>
- <style>
- :host {
- display: block;
- width: 250px;
- }
- #content {
- flex-direction: column;
- display: flex;
- }
- </style>
-
- <div id='content'>
- <toolbar id='toolbar'></toolbar>
- <result-area id='result_area'></result-area>
- </div>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.rangeOfInterest_ = new tr.b.Range();
- this.selection_ = undefined;
- },
-
- get model() {
- return this.model_;
- },
-
- set model(model) {
- this.model_ = model;
- this.updateContents_();
- },
-
- set selection(selection) {
- },
-
- set rangeOfInterest(rangeOfInterest) {
- },
-
- /**
- * Fires a selection event selecting all alerts of the specified
- * type.
- */
- selectAlertsOfType: function(alertTypeString) {
- var alertsOfType = this.model_.alerts.filter(function(alert) {
- return alert.title === alertTypeString;
- });
-
- var event = new tr.model.RequestSelectionChangeEvent();
- event.selection = new tr.model.EventSet(alertsOfType);
- this.dispatchEvent(event);
- },
-
- /**
- * Returns a map for the specified alerts where each key is the
- * alert type string and each value is a list of alerts with that
- * type.
- */
- alertsByType_: function(alerts) {
- var alertsByType = {};
- alerts.forEach(function(alert) {
- if (!alertsByType[alert.title])
- alertsByType[alert.title] = [];
-
- alertsByType[alert.title].push(alert);
- });
- return alertsByType;
- },
-
- alertsTableRows_: function(alertsByType) {
- return Object.keys(alertsByType).map(function(key) {
- return {
- alertType: key,
- count: alertsByType[key].length
- };
- });
- },
-
- alertsTableColumns_: function() {
- return [
- {
- title: 'Alert type',
- value: function(row) { return row.alertType; },
- width: '180px'
- },
- {
- title: 'Count',
- width: '100%',
- value: function(row) { return row.count; }
- }
- ];
- },
-
- createAlertsTable_: function(alerts) {
- var alertsByType = this.alertsByType_(alerts);
-
- var table = document.createElement('tr-ui-b-table');
- table.tableColumns = this.alertsTableColumns_();
- table.tableRows = this.alertsTableRows_(alertsByType);
- table.selectionMode = tr.ui.b.TableFormat.SelectionMode.ROW;
- table.addEventListener('selection-changed', function(e) {
- var row = table.selectedTableRow;
- if (row)
- this.selectAlertsOfType(row.alertType);
- }.bind(this));
-
- return table;
- },
-
- updateContents_: function() {
- this.$.result_area.textContent = '';
- if (this.model_ === undefined)
- return;
-
- var panel = this.createAlertsTable_(this.model_.alerts);
- this.$.result_area.appendChild(panel);
- },
-
- supportsModel: function(m) {
- if (m == undefined) {
- return {
- supported: false,
- reason: 'Unknown tracing model'
- };
- } else if (m.alerts.length === 0) {
- return {
- supported: false,
- reason: 'No alerts in tracing model'
- };
- }
-
- return {
- supported: true
- };
- },
-
- get textLabel() {
- return 'Alerts';
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/alerts_side_panel_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/alerts_side_panel_test.html
deleted file mode 100644
index 2ca6250b69e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/alerts_side_panel_test.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/extras/side_panel/alerts_side_panel.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ALERT_INFO_1 = new tr.model.EventInfo(
- 'Alert 1', 'Critical alert');
- var ALERT_INFO_2 = new tr.model.EventInfo(
- 'Alert 2', 'Warning alert');
-
- test('instantiate', function() {
- var panel = document.createElement('tr-ui-e-s-alerts-side-panel');
- panel.model = createModelWithAlerts([
- new tr.model.Alert(ALERT_INFO_1, 5),
- new tr.model.Alert(ALERT_INFO_2, 35)
- ]);
- panel.style.height = '100px';
-
- this.addHTMLOutput(panel);
- });
-
- test('selectAlertsOfType', function() {
- var panel = document.createElement('tr-ui-e-s-alerts-side-panel');
- var alerts = [
- new tr.model.Alert(ALERT_INFO_1, 1),
- new tr.model.Alert(ALERT_INFO_1, 2),
- new tr.model.Alert(ALERT_INFO_2, 3)
- ];
-
- var predicted_alerts = new tr.model.EventSet([alerts[0], alerts[1]]);
- panel.model = createModelWithAlerts(alerts);
- panel.style.height = '100px';
- this.addHTMLOutput(panel);
-
- var selectionChanged = false;
- panel.addEventListener('requestSelectionChange', function(e) {
- selectionChanged = true;
- assert.isTrue(e.selection.equals(predicted_alerts));
- });
- panel.selectAlertsOfType(ALERT_INFO_1.title);
-
- assert.isTrue(selectionChanged);
- });
-
- function createModelWithAlerts(alerts) {
- var m = new tr.Model();
- m.alerts = alerts;
- return m;
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/frame_data_side_panel.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/frame_data_side_panel.html
deleted file mode 100644
index ebaff275896..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/frame_data_side_panel.html
+++ /dev/null
@@ -1,243 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/chrome/blame_context/frame_tree_node.html">
-<link rel="import" href="/tracing/extras/chrome/blame_context/render_frame.html">
-<link rel="import" href="/tracing/extras/chrome/blame_context/top_level.html">
-<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/ui/side_panel/side_panel.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name='tr-ui-e-s-frame-data-side-panel'
- extends='tr-ui-side-panel'>
- <template>
- <style>
- :host {
- display: flex;
- width: 600px;
- flex-direction: column;
- }
- table-container {
- display: flex;
- overflow: auto;
- }
- </style>
- <table-container>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </table-container>
- </template>
-</polymer-element>
-
-<script>
-'use strict';
-tr.exportTo('tr.ui.e.s', function() {
- var BlameContextSnapshot = tr.e.chrome.BlameContextSnapshot;
- var FrameTreeNodeSnapshot = tr.e.chrome.FrameTreeNodeSnapshot;
- var RenderFrameSnapshot = tr.e.chrome.RenderFrameSnapshot;
- var TopLevelSnapshot = tr.e.chrome.TopLevelSnapshot;
-
- var BlameContextInstance = tr.e.chrome.BlameContextInstance;
- var FrameTreeNodeInstance = tr.e.chrome.FrameTreeNodeInstance;
- var RenderFrameInstance = tr.e.chrome.RenderFrameInstance;
- var TopLevelInstance = tr.e.chrome.TopLevelInstance;
-
- /**
- * @constructor
- */
- function Row(context) {
- this.type = context.objectInstance.blameContextType;
-
- this.contexts = [context];
- this.renderer = undefined;
- if (context instanceof FrameTreeNodeSnapshot) {
- if (context.renderFrame) {
- this.contexts.push(context.renderFrame);
- this.renderer = context.renderFrame.objectInstance.parent.pid;
- }
- } else if (context instanceof RenderFrameSnapshot) {
- if (context.frameTreeNode)
- this.contexts.push(context.frameTreeNode);
- this.renderer = context.objectInstance.parent.pid;
- } else if (context instanceof TopLevelSnapshot) {
- this.renderer = context.objectInstance.parent.pid;
- } else {
- throw new Error('Unknown context type');
- }
-
- // TODO(xiaochengh): Handle the case where a subframe has a trivial url
- // (e.g., about:blank), but inherits the origin of its parent. This is not
- // needed now, but will be required if we want to group rows by origin.
- this.url = context.url;
-
- // To be computed in batch later for efficiency.
- this.eventsOfInterest = new tr.model.EventSet(this.contexts);
- this.time = 0;
- }
-
- Polymer('tr-ui-e-s-frame-data-side-panel', {
- ready: function() {
- this.model_ = undefined;
- this.rangeOfInterest_ = new tr.b.Range();
-
- // TODO(xiaochengh): Design proper grouping of the rows (by renderer
- // pid, frame tree topology, site, ...) in a follow-up patch.
- this.$.table.showHeader = true;
- this.$.table.selectionMode = tr.ui.b.TableFormat.SelectionMode.ROW;
- this.$.table.tableColumns = this.createFrameDataTableColumns_();
-
- this.$.table.addEventListener('selection-changed', function(e) {
- this.selectEventSet_(this.$.table.selectedTableRow.eventsOfInterest);
- }.bind(this));
- },
-
- selectEventSet_: function(eventSet) {
- var event = new tr.model.RequestSelectionChangeEvent();
- event.selection = eventSet;
- this.dispatchEvent(event);
- },
-
- createFrameDataTableColumns_: function() {
- return [
- {
- title: 'Renderer',
- value: row => row.renderer,
- cmp: (a, b) => a.renderer - b.renderer
- },
- {
- title: 'Type',
- value: row => row.type
- },
- // TODO(xiaochengh): Decide what details to show in the table:
- // - URL seems necessary, but we may also want origin instead/both.
- // - Distinguish between browser time and renderer time?
- // - Distinguish between CPU time and wall clock time?
- // - Memory? Network? ...
- {
- title: 'Time',
- value: row => tr.v.ui.createScalarSpan(row.time, {
- unit: tr.v.Unit.byName.timeStampInMs,
- ownerDocument: this.ownerDocument
- }),
- cmp: (a, b) => a.time - b.time
- },
- {
- title: 'URL',
- value: row => row.url,
- cmp: (a, b) => (a.url || '').localeCompare(b.url || '')
- }
- ];
- },
-
- createFrameDataTableRows_: function() {
- if (!this.model_)
- return [];
-
- // Gather contexts into skeletons of rows.
- var rows = [];
- var rowMap = {};
- tr.b.iterItems(this.model_.processes, function(pid, process) {
- process.objects.iterObjectInstances(function(objectInstance) {
- if (!(objectInstance instanceof BlameContextInstance))
- return;
- objectInstance.snapshots.forEach(function(snapshot) {
- if (rowMap[snapshot.guid])
- return;
- var row = new Row(snapshot);
- row.contexts.forEach(context => rowMap[context.guid] = row);
- rows.push(row);
- }, this);
- }, this);
- }, this);
-
- // Find slices attributed to each row.
- // TODO(xiaochengh): We should implement a getter
- // BlameContextSnapshot.attributedEvents, instead of process the model in
- // a UI component.
- tr.b.iterItems(this.model_.processes, function(pid, process) {
- tr.b.iterItems(process.threads, function(tid, thread) {
- thread.sliceGroup.iterSlicesInTimeRange(function(topLevelSlice) {
- topLevelSlice.contexts.forEach(function(context) {
- if (!context.snapshot.guid || !rowMap[context.snapshot.guid])
- return;
- var row = rowMap[context.snapshot.guid];
- row.eventsOfInterest.push(topLevelSlice);
- row.time += topLevelSlice.selfTime || 0;
- });
- }, this.currentRangeOfInterest.min, this.currentRangeOfInterest.max);
- }, this);
- }, this);
-
- return rows;
- },
-
- updateContents_: function() {
- this.$.table.tableRows = this.createFrameDataTableRows_();
- this.$.table.rebuild();
- },
-
- supportsModel: function(m) {
- if (!m) {
- return {
- supported: false,
- reason: 'No model available.'
- };
- }
-
- var ans = {supported: false};
- tr.b.iterItems(m.processes, function(pid, process) {
- process.objects.iterObjectInstances(function(instance) {
- if (instance instanceof BlameContextInstance)
- ans.supported = true;
- });
- }, this);
-
- if (!ans.supported)
- ans.reason = 'No frame data available';
- return ans;
- },
-
- get currentRangeOfInterest() {
- if (this.rangeOfInterest_.isEmpty)
- return this.model_.bounds;
- else
- return this.rangeOfInterest_;
- },
-
- get rangeOfInterest() {
- return this.rangeOfInterest_;
- },
-
- set rangeOfInterest(rangeOfInterest) {
- this.rangeOfInterest_ = rangeOfInterest;
- this.updateContents_();
- },
-
- get selection() {
- // Not applicable.
- },
-
- set selection(_) {
- // Not applicable.
- },
-
- get textLabel() {
- return 'Frame Data';
- },
-
- get model() {
- return this.model_;
- },
-
- set model(model) {
- this.model_ = model;
- this.updateContents_();
- }
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/frame_data_side_panel_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/frame_data_side_panel_test.html
deleted file mode 100644
index c9ec9ff025b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/frame_data_side_panel_test.html
+++ /dev/null
@@ -1,165 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/blame_context/frame_tree_node.html">
-<link rel="import" href="/tracing/extras/chrome/blame_context/render_frame.html">
-<link rel="import" href="/tracing/extras/chrome/blame_context/top_level.html">
-<link rel="import" href="/tracing/ui/extras/side_panel/frame_data_side_panel.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var TestUtils = tr.c.TestUtils;
-
- function topLevelOptions(pid, id) {
- return {
- pid: pid,
- id: id,
- cat: 'blink',
- scope: 'PlatformThread',
- name: 'TopLevel'
- };
- }
-
- function renderFrameOptions(pid, id, parent) {
- return {
- pid: pid,
- id: id,
- cat: 'blink',
- scope: 'RenderFrame',
- name: 'RenderFrame',
- args: {parent: {
- id_ref: parent.id,
- scope: parent.scope
- }}
- };
- }
-
- function frameTreeNodeOptions(pid, id, opt_renderFrame, opt_parentId) {
- var ans = {
- pid: pid,
- id: id,
- cat: 'navigation',
- scope: 'FrameTreeNode',
- name: 'FrameTreeNode',
- args: {}
- };
- if (opt_renderFrame) {
- ans.args.renderFrame = {
- id_ref: opt_renderFrame.id,
- pid_ref: opt_renderFrame.pid,
- scope: 'RenderFrame'
- };
- }
- if (opt_parentId) {
- ans.args.parent = {
- id_ref: opt_parentId,
- scope: 'FrameTreeNode'
- };
- }
- return ans;
- }
-
- /**
- * Creates some independent contexts. Checks if all are present in the panel.
- */
- test('basic', function() {
- var panel = document.createElement('tr-ui-e-s-frame-data-side-panel');
- panel.model = TestUtils.newModel(function(model) {
- TestUtils.newSnapshot(model, topLevelOptions(1, '0x1'));
- TestUtils.newSnapshot(model, renderFrameOptions(
- 1, '0x2', {id: '0x1', scope: 'PlatformThread'}));
- TestUtils.newSnapshot(model, frameTreeNodeOptions(
- 2, '0x3'));
- });
- assert.lengthOf(panel.$.table.tableRows, 3);
-
- this.addHTMLOutput(panel);
- });
-
- /**
- * Creates a FrameTreeNode in the browser process and a RenderFrame in a
- * renderer process that are the same frame. Checks if they are merged into
- * one row in the panel.
- */
- test('mergeCrossProcessFrameBlameContexts', function() {
- var panel = document.createElement('tr-ui-e-s-frame-data-side-panel');
- panel.model = TestUtils.newModel(function(model) {
- TestUtils.newSnapshot(model, topLevelOptions(1, '0x1'));
- TestUtils.newSnapshot(model, renderFrameOptions(
- 1, '0x2', {id: '0x1', scope: 'PlatformThread'}));
- TestUtils.newSnapshot(model, frameTreeNodeOptions(
- 2, '0x3', {id: '0x2', pid: 1}));
- });
- assert.lengthOf(panel.$.table.tableRows, 2);
-
- this.addHTMLOutput(panel);
- });
-
- function newAttributedSlice(model, pid, start, duration, context) {
- var slice = TestUtils.newSliceEx({start: start, duration: duration});
- slice.contexts = [{type: 'FrameBlameContext', snapshot: context}];
- model.getOrCreateProcess(pid).getOrCreateThread(1).sliceGroup.pushSlice(
- slice);
- return slice;
- }
-
- /**
- * Changes the range of interest. Checks if the panel updates correspondingly.
- */
- test('respondToRangeOfInterest', function() {
- var topLevel;
- var slice1;
- var slice2;
- var panel = document.createElement('tr-ui-e-s-frame-data-side-panel');
- panel.model = TestUtils.newModel(function(model) {
- topLevel = TestUtils.newSnapshot(model, topLevelOptions(1, '0x1'));
- slice1 = newAttributedSlice(model, 1, 1500, 500, topLevel);
- slice2 = newAttributedSlice(model, 1, 2500, 500, topLevel);
- });
-
- // The default range of interest contains both slices.
- assert.isTrue(panel.$.table.tableRows[0].eventsOfInterest.equals(
- new tr.model.EventSet([topLevel, slice1, slice2])));
-
- // The new range of interest contains only slice2.
- panel.rangeOfInterest = tr.b.Range.fromExplicitRange(slice2.start,
- slice2.end);
- assert.isTrue(panel.$.table.tableRows[0].eventsOfInterest.equals(
- new tr.model.EventSet([topLevel, slice2])));
-
- this.addHTMLOutput(panel);
- });
-
- /**
- * Selects a row in the panel. Checks if the context(s) of the row and the
- * slices attributed to the row are selected.
- */
- test('selectAttributedEvents', function() {
- var topLevel;
- var slice;
- var panel = document.createElement('tr-ui-e-s-frame-data-side-panel');
- panel.model = TestUtils.newModel(function(model) {
- topLevel = TestUtils.newSnapshot(model, topLevelOptions(1, '0x1'));
- slice = newAttributedSlice(model, 1, 1500, 500, topLevel);
- });
-
- var selectionChanged = false;
- panel.addEventListener('requestSelectionChange', function(e) {
- selectionChanged = true;
- assert.isTrue(
- e.selection.equals(new tr.model.EventSet([topLevel, slice])));
- });
- panel.$.table.selectedTableRow = panel.$.table.tableRows[0];
- assert.isTrue(selectionChanged);
-
- this.addHTMLOutput(panel);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/input_latency_side_panel.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/input_latency_side_panel.html
deleted file mode 100644
index 4b3a9a5917b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/input_latency_side_panel.html
+++ /dev/null
@@ -1,326 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/helpers/chrome_model_helper.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/line_chart.html">
-<link rel="import" href="/tracing/ui/side_panel/side_panel.html">
-
-<polymer-element name='tr-ui-e-s-input-latency-side-panel'
- extends='tr-ui-side-panel'>
- <template>
- <style>
- :host {
- flex-direction: column;
- display: flex;
- }
- toolbar {
- flex: 0 0 auto;
- border-bottom: 1px solid black;
- display: flex;
- }
- result-area {
- flex: 1 1 auto;
- display: block;
- min-height: 0;
- overflow-y: auto;
- }
- </style>
-
- <toolbar id='toolbar'></toolbar>
- <result-area id='result_area'></result-area>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.rangeOfInterest_ = new tr.b.Range();
- this.frametimeType_ = tr.model.helpers.IMPL_FRAMETIME_TYPE;
- this.latencyChart_ = undefined;
- this.frametimeChart_ = undefined;
- this.selectedProcessId_ = undefined;
- this.mouseDownIndex_ = undefined;
- this.curMouseIndex_ = undefined;
- },
-
- get model() {
- return this.model_;
- },
-
- set model(model) {
- this.model_ = model;
- if (this.model_) {
- this.modelHelper_ = this.model_.getOrCreateHelper(
- tr.model.helpers.ChromeModelHelper);
- } else {
- this.modelHelper_ = undefined;
- }
-
- this.updateToolbar_();
- this.updateContents_();
- },
-
- get frametimeType() {
- return this.frametimeType_;
- },
-
- set frametimeType(type) {
- if (this.frametimeType_ === type)
- return;
- this.frametimeType_ = type;
- this.updateContents_();
- },
-
- get selectedProcessId() {
- return this.selectedProcessId_;
- },
-
- set selectedProcessId(process) {
- if (this.selectedProcessId_ === process)
- return;
- this.selectedProcessId_ = process;
- this.updateContents_();
- },
-
- set selection(selection) {
- if (this.latencyChart_ === undefined)
- return;
- this.latencyChart_.brushedRange = selection.bounds;
- },
-
- // This function is for testing purpose.
- setBrushedIndices: function(mouseDownIndex, curIndex) {
- this.mouseDownIndex_ = mouseDownIndex;
- this.curMouseIndex_ = curIndex;
- this.updateBrushedRange_();
- },
-
- updateBrushedRange_: function() {
- if (this.latencyChart_ === undefined)
- return;
-
- var r = new tr.b.Range();
- if (this.mouseDownIndex_ === undefined) {
- this.latencyChart_.brushedRange = r;
- return;
- }
- r = this.latencyChart_.computeBrushRangeFromIndices(
- this.mouseDownIndex_, this.curMouseIndex_);
- this.latencyChart_.brushedRange = r;
-
- // Based on the brushed range, update the selection of LatencyInfo in
- // the timeline view by sending a selectionChange event.
- var latencySlices = [];
- for (var thread of this.model_.getAllThreads())
- for (var event of thread.getDescendantEvents())
- if (event.title.indexOf('InputLatency:') === 0)
- latencySlices.push(event);
- latencySlices = tr.model.helpers.getSlicesIntersectingRange(
- r, latencySlices);
-
- var event = new tr.model.RequestSelectionChangeEvent();
- event.selection = new tr.model.EventSet(latencySlices);
- this.latencyChart_.dispatchEvent(event);
- },
-
- registerMouseEventForLatencyChart_: function() {
- this.latencyChart_.addEventListener('item-mousedown', function(e) {
- this.mouseDownIndex_ = e.index;
- this.curMouseIndex_ = e.index;
- this.updateBrushedRange_();
- }.bind(this));
-
- this.latencyChart_.addEventListener('item-mousemove', function(e) {
- if (e.button == undefined)
- return;
- this.curMouseIndex_ = e.index;
- this.updateBrushedRange_();
- }.bind(this));
-
- this.latencyChart_.addEventListener('item-mouseup', function(e) {
- this.curMouseIndex = e.index;
- this.updateBrushedRange_();
- }.bind(this));
- },
-
- updateToolbar_: function() {
- var browserProcess = this.modelHelper_.browserProcess;
- var labels = [];
-
- if (browserProcess !== undefined) {
- var label_str = 'Browser: ' + browserProcess.pid;
- labels.push({label: label_str, value: browserProcess.pid});
- }
-
- tr.b.iterItems(this.modelHelper_.rendererHelpers,
- function(pid, rendererHelper) {
- var rendererProcess = rendererHelper.process;
- var label_str = 'Renderer: ' + rendererProcess.userFriendlyName;
- labels.push({label: label_str, value: rendererProcess.userFriendlyName
- });
- }, this);
-
- if (labels.length === 0)
- return;
-
- this.selectedProcessId_ = labels[0].value;
- var toolbarEl = this.$.toolbar;
- toolbarEl.appendChild(tr.ui.b.createSelector(
- this, 'frametimeType',
- 'inputLatencySidePanel.frametimeType', this.frametimeType_,
- [{label: 'Main Thread Frame Times',
- value: tr.model.helpers.MAIN_FRAMETIME_TYPE},
- {label: 'Impl Thread Frame Times',
- value: tr.model.helpers.IMPL_FRAMETIME_TYPE}
- ]));
- toolbarEl.appendChild(tr.ui.b.createSelector(
- this, 'selectedProcessId',
- 'inputLatencySidePanel.selectedProcessId',
- this.selectedProcessId_,
- labels));
- },
-
- get currentRangeOfInterest() {
- if (this.rangeOfInterest_.isEmpty)
- return this.model_.bounds;
- else
- return this.rangeOfInterest_;
- },
-
- createLatencyLineChart: function(data, title) {
- var chart = new tr.ui.b.LineChart();
- var width = 600;
- if (document.body.clientWidth != undefined)
- width = document.body.clientWidth * 0.5;
- chart.setSize({width: width, height: chart.height});
- chart.chartTitle = title;
- chart.data = data;
- return chart;
- },
-
- updateContents_: function() {
- var resultArea = this.$.result_area;
- this.latencyChart_ = undefined;
- this.frametimeChart_ = undefined;
- resultArea.textContent = '';
-
- if (this.modelHelper_ === undefined)
- return;
-
- var rangeOfInterest = this.currentRangeOfInterest;
-
- var chromeProcess;
- if (this.modelHelper_.rendererHelpers[this.selectedProcessId_])
- chromeProcess = this.modelHelper_.rendererHelpers[
- this.selectedProcessId_
- ];
- else
- chromeProcess = this.modelHelper_.browserHelper;
-
- var frameEvents = chromeProcess.getFrameEventsInRange(
- this.frametimeType, rangeOfInterest);
-
- var frametimeData = tr.model.helpers.getFrametimeDataFromEvents(
- frameEvents);
- var averageFrametime = tr.b.Statistics.mean(frametimeData, function(d) {
- return d.frametime;
- });
-
- var latencyEvents = this.modelHelper_.browserHelper.
- getLatencyEventsInRange(
- rangeOfInterest);
-
- var latencyData = [];
- latencyEvents.forEach(function(event) {
- if (event.inputLatency === undefined)
- return;
- latencyData.push({
- x: event.start,
- latency: event.inputLatency / 1000
- });
- });
-
- var averageLatency = tr.b.Statistics.mean(latencyData, function(d) {
- return d.latency;
- });
-
- // Create summary.
- var latencySummaryText = document.createElement('div');
- latencySummaryText.appendChild(tr.ui.b.createSpan({
- textContent: 'Average Latency ' + averageLatency + ' ms',
- bold: true}));
- resultArea.appendChild(latencySummaryText);
-
- var frametimeSummaryText = document.createElement('div');
- frametimeSummaryText.appendChild(tr.ui.b.createSpan({
- textContent: 'Average Frame Time ' + averageFrametime + ' ms',
- bold: true}));
- resultArea.appendChild(frametimeSummaryText);
-
- if (latencyData.length !== 0) {
- this.latencyChart_ = this.createLatencyLineChart(
- latencyData, 'Latency Over Time');
- this.registerMouseEventForLatencyChart_();
- resultArea.appendChild(this.latencyChart_);
- }
-
- if (frametimeData.length != 0) {
- this.frametimeChart_ = this.createLatencyLineChart(
- frametimeData, 'Frame Times');
- resultArea.appendChild(this.frametimeChart_);
- }
- },
-
- get rangeOfInterest() {
- return this.rangeOfInterest_;
- },
-
- set rangeOfInterest(rangeOfInterest) {
- this.rangeOfInterest_ = rangeOfInterest;
- this.updateContents_();
- },
-
- supportsModel: function(m) {
- if (m == undefined) {
- return {
- supported: false,
- reason: 'Unknown tracing model'
- };
- }
-
- if (!tr.model.helpers.ChromeModelHelper.supportsModel(m)) {
- return {
- supported: false,
- reason: 'No Chrome browser or renderer process found'
- };
- }
-
- var modelHelper = m.getOrCreateHelper(tr.model.helpers.ChromeModelHelper);
- if (modelHelper.browserHelper &&
- modelHelper.browserHelper.hasLatencyEvents) {
- return {
- supported: true
- };
- }
-
- return {
- supported: false,
- reason: 'No InputLatency events trace. Consider enabling ' +
- 'benchmark" and "input" category when recording the trace'
- };
- },
-
- get textLabel() {
- return 'Input Latency';
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/input_latency_side_panel_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/input_latency_side_panel_test.html
deleted file mode 100644
index 51021bd4aa3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/input_latency_side_panel_test.html
+++ /dev/null
@@ -1,143 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/chrome/cc/input_latency_async_slice.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/extras/side_panel/input_latency_side_panel.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('basic', function() {
- var latencyData = [
- {
- x: 1000,
- latency: 16
- },
- {
- x: 2000,
- latency: 17
- },
- {
- x: 3000,
- latency: 14
- },
- {
- x: 4000,
- latency: 23
- }
- ];
- var lc = document.createElement('tr-ui-e-s-input-latency-side-panel');
- var latencyChart = lc.createLatencyLineChart(latencyData, 'latency');
- this.addHTMLOutput(latencyChart);
-
- var frametimeData = [
- {
- x: 1000,
- frametime: 16
- },
- {
- x: 2000,
- frametime: 17
- },
- {
- x: 3000,
- frametime: 14
- },
- {
- x: 4000,
- frametime: 23
- }
- ];
- var lc = document.createElement('tr-ui-e-s-input-latency-side-panel');
- var frametimeChart = lc.createLatencyLineChart(frametimeData, 'frametime');
- this.addHTMLOutput(frametimeChart);
- });
-
- test('brushedRangeChange', function() {
- var events = [];
- for (var i = 0; i < 10; i++) {
- var start_ts = i * 10000;
- var end_ts = start_ts + 1000 * (i % 2);
- events.push(
- {
- 'cat': 'benchmark',
- 'pid': 3507,
- 'tid': 3507,
- 'ts': start_ts,
- 'ph': 'S',
- 'name': 'InputLatency',
- 'id': i
- });
- events.push(
- {
- 'cat': 'benchmark',
- 'pid': 3507,
- 'tid': 3507,
- 'ts': end_ts,
- 'ph': 'T',
- 'name': 'InputLatency',
- 'args': {'step': 'GestureScrollUpdate'},
- 'id': i
- });
- events.push(
- {
- 'cat': 'benchmark',
- 'pid': 3507,
- 'tid': 3507,
- 'ts': end_ts,
- 'ph': 'F',
- 'name': 'InputLatency',
- 'args': {
- 'data': {
- 'INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT': {
- 'time': start_ts
- },
- 'INPUT_EVENT_LATENCY_TERMINATED_FRAME_SWAP_COMPONENT': {
- 'time': end_ts
- }
- }
- },
- 'id': i
- });
- }
- events.push({'cat': '__metadata',
- 'pid': 3507,
- 'tid': 3507,
- 'ts': 0,
- 'ph': 'M',
- 'name': 'thread_name',
- 'args': {'name': 'CrBrowserMain'}});
-
- var panel = document.createElement('tr-ui-e-s-input-latency-side-panel');
- this.addHTMLOutput(panel);
-
- var selectionChanged = false;
-
- panel.model = tr.c.TestUtils.newModelWithEvents([events]);
- function listener(e) {
- selectionChanged = true;
- assert.equal(e.selection.length, 3);
- var predictedStarts = [20, 31, 40];
- var i = 0;
- for (var event of e.selection)
- assert.equal(event.start, predictedStarts[i++]);
- }
- panel.ownerDocument.addEventListener('requestSelectionChange', listener);
- try {
- panel.setBrushedIndices(2, 4);
- } finally {
- panel.ownerDocument.removeEventListener(
- 'requestSelectionChange', listener);
- }
- assert.isTrue(selectionChanged);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/time_summary_side_panel.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/time_summary_side_panel.html
deleted file mode 100644
index a0b6d9df6b6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/time_summary_side_panel.html
+++ /dev/null
@@ -1,438 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/pie_chart.html">
-<link rel="import" href="/tracing/ui/side_panel/side_panel.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-ui-e-s-time-summary-side-panel"
- extends="tr-ui-side-panel">
- <template>
- <style>
- :host {
- flex-direction: column;
- display: flex;
- }
- toolbar {
- flex: 0 0 auto;
- border-bottom: 1px solid black;
- display: flex;
- }
- result-area {
- flex: 1 1 auto;
- display: block;
- min-height: 0;
- overflow-y: auto;
- }
- </style>
-
- <toolbar id='toolbar'></toolbar>
- <result-area id='result_area'></result-area>
- </template>
-
- <script>
- 'use strict';
- (function() {
- var GROUP_BY_PROCESS_NAME = 'process';
- var GROUP_BY_THREAD_NAME = 'thread';
-
- var WALL_TIME_GROUPING_UNIT = 'Wall time';
- var CPU_TIME_GROUPING_UNIT = 'CPU time';
-
- /**
- * @constructor
- */
- function ResultsForGroup(model, name) {
- this.model = model;
- this.name = name;
- this.topLevelSlices = [];
- this.allSlices = [];
- }
-
- ResultsForGroup.prototype = {
- get wallTime() {
- var wallSum = tr.b.Statistics.sum(
- this.topLevelSlices, function(x) { return x.duration; });
- return wallSum;
- },
-
- get cpuTime() {
- var cpuDuration = 0;
- for (var i = 0; i < this.topLevelSlices.length; i++) {
- var x = this.topLevelSlices[i];
- // Only report thread-duration if we have it for all events.
- //
- // A thread_duration of 0 is valid, so this only returns 0 if it is
- // None.
- if (x.cpuDuration === undefined) {
- if (x.duration === undefined)
- continue;
- return 0;
- }
- cpuDuration += x.cpuDuration;
- }
- return cpuDuration;
- },
-
- appendGroupContents: function(group) {
- if (group.model != this.model)
- throw new Error('Models must be the same');
-
- group.allSlices.forEach(function(slice) {
- this.allSlices.push(slice);
- }, this);
- group.topLevelSlices.forEach(function(slice) {
- this.topLevelSlices.push(slice);
- }, this);
- },
-
- appendThreadSlices: function(rangeOfInterest, thread) {
- var tmp = this.getSlicesIntersectingRange(
- rangeOfInterest, thread.sliceGroup.slices);
- tmp.forEach(function(slice) {
- this.allSlices.push(slice);
- }, this);
- tmp = this.getSlicesIntersectingRange(
- rangeOfInterest, thread.sliceGroup.topLevelSlices);
- tmp.forEach(function(slice) {
- this.topLevelSlices.push(slice);
- }, this);
- },
-
- getSlicesIntersectingRange: function(rangeOfInterest, slices) {
- var slicesInFilterRange = [];
- for (var i = 0; i < slices.length; i++) {
- var slice = slices[i];
- if (rangeOfInterest.intersectsExplicitRangeInclusive(
- slice.start, slice.end))
- slicesInFilterRange.push(slice);
- }
- return slicesInFilterRange;
- }
- };
-
- Polymer({
- ready: function() {
- this.rangeOfInterest_ = new tr.b.Range();
- this.selection_ = undefined;
- this.groupBy_ = GROUP_BY_PROCESS_NAME;
- this.groupingUnit_ = CPU_TIME_GROUPING_UNIT;
- this.showCpuIdleTime_ = true;
- this.chart_ = undefined;
-
- var toolbarEl = this.$.toolbar;
- this.groupBySelector_ = tr.ui.b.createSelector(
- this, 'groupBy',
- 'timeSummarySidePanel.groupBy', this.groupBy_,
- [{label: 'Group by process', value: GROUP_BY_PROCESS_NAME},
- {label: 'Group by thread', value: GROUP_BY_THREAD_NAME}
- ]);
- toolbarEl.appendChild(this.groupBySelector_);
-
- this.groupingUnitSelector_ = tr.ui.b.createSelector(
- this, 'groupingUnit',
- 'timeSummarySidePanel.groupingUnit', this.groupingUnit_,
- [{label: 'Wall time', value: WALL_TIME_GROUPING_UNIT},
- {label: 'CPU time', value: CPU_TIME_GROUPING_UNIT}
- ]);
- toolbarEl.appendChild(this.groupingUnitSelector_);
-
- this.showCpuIdleTimeCheckbox_ = tr.ui.b.createCheckBox(
- this, 'showCpuIdleTime',
- 'timeSummarySidePanel.showCpuIdleTime', this.showCpuIdleTime_,
- 'Show CPU idle time');
- toolbarEl.appendChild(this.showCpuIdleTimeCheckbox_);
- this.updateShowCpuIdleTimeCheckboxVisibility_();
- },
-
- /**
- * This function takes an array of groups and merges smaller groups into
- * the provided 'Other' group item such that the remaining items are ready
- * for pie-chart consumption. Otherwise, the pie chart gets overwhelmed
- * with tons of little slices.
- */
- trimPieChartData: function(groups, otherGroup, getValue, opt_extraValue) {
- // Copy the array so it can be mutated.
- groups = groups.filter(function(d) {
- return getValue(d) != 0;
- });
-
- // Figure out total array range.
- var sum = tr.b.Statistics.sum(groups, getValue);
- if (opt_extraValue !== undefined)
- sum += opt_extraValue;
-
- // Sort by value.
- function compareByValue(a, b) {
- return getValue(a) - getValue(b);
- }
- groups.sort(compareByValue);
-
- // Now start fusing elements until none are less than threshold in size.
- var thresshold = 0.1 * sum;
- while (groups.length > 1) {
- var group = groups[0];
- if (getValue(group) >= thresshold)
- break;
-
- var v = getValue(group);
- if (v + getValue(otherGroup) > thresshold)
- break;
-
- // Remove the group from the list and add it to the 'Other' group.
- groups.splice(0, 1);
- otherGroup.appendGroupContents(group);
- }
-
- // Final return.
- if (getValue(otherGroup) > 0)
- groups.push(otherGroup);
-
- groups.sort(compareByValue);
-
- return groups;
- },
-
- generateResultsForGroup: function(model, name) {
- return new ResultsForGroup(model, name);
- },
-
- createPieChartFromResultGroups: function(
- groups, title, getValue, opt_extraData) {
- var chart = new tr.ui.b.PieChart();
-
- function pushDataForGroup(data, resultsForGroup, value) {
- data.push({
- label: resultsForGroup.name,
- value: value,
- valueText: tr.v.Unit.byName.timeDurationInMs.format(value),
- resultsForGroup: resultsForGroup
- });
- }
- chart.addEventListener('item-click', function(clickEvent) {
- var resultsForGroup = clickEvent.data.resultsForGroup;
- if (resultsForGroup === undefined)
- return;
-
- var event = new tr.model.RequestSelectionChangeEvent();
- event.selection = new tr.model.EventSet(resultsForGroup.allSlices);
- event.selection.timeSummaryGroupName = resultsForGroup.name;
- chart.dispatchEvent(event);
- });
-
-
- // Build chart data.
- var data = [];
- groups.forEach(function(resultsForGroup) {
- var value = getValue(resultsForGroup);
- if (value === 0)
- return;
- pushDataForGroup(data, resultsForGroup, value);
- });
- if (opt_extraData)
- data.push.apply(data, opt_extraData);
-
- chart.chartTitle = title;
- chart.data = data;
- return chart;
- },
-
- get model() {
- return this.model_;
- },
-
- set model(model) {
- this.model_ = model;
- this.updateContents_();
- },
-
- get groupBy() {
- return groupBy_;
- },
-
- set groupBy(groupBy) {
- this.groupBy_ = groupBy;
- if (this.groupBySelector_)
- this.groupBySelector_.selectedValue = groupBy;
- this.updateContents_();
- },
-
- get groupingUnit() {
- return groupingUnit_;
- },
-
- set groupingUnit(groupingUnit) {
- this.groupingUnit_ = groupingUnit;
- if (this.groupingUnitSelector_)
- this.groupingUnitSelector_.selectedValue = groupingUnit;
- this.updateShowCpuIdleTimeCheckboxVisibility_();
- this.updateContents_();
- },
-
- get showCpuIdleTime() {
- return this.showCpuIdleTime_;
- },
-
- set showCpuIdleTime(showCpuIdleTime) {
- this.showCpuIdleTime_ = showCpuIdleTime;
- if (this.showCpuIdleTimeCheckbox_)
- this.showCpuIdleTimeCheckbox_.checked = showCpuIdleTime;
- this.updateContents_();
- },
-
- updateShowCpuIdleTimeCheckboxVisibility_: function() {
- if (!this.showCpuIdleTimeCheckbox_)
- return;
- var visible = this.groupingUnit_ == CPU_TIME_GROUPING_UNIT;
- if (visible)
- this.showCpuIdleTimeCheckbox_.style.display = '';
- else
- this.showCpuIdleTimeCheckbox_.style.display = 'none';
- },
-
- getGroupNameForThread_: function(thread) {
- if (this.groupBy_ == GROUP_BY_THREAD_NAME)
- return thread.name ? thread.name : thread.userFriendlyName;
-
- if (this.groupBy_ == GROUP_BY_PROCESS_NAME)
- return thread.parent.userFriendlyName;
- },
-
- updateContents_: function() {
- var resultArea = this.$.result_area;
- this.chart_ = undefined;
- resultArea.textContent = '';
-
- if (this.model_ === undefined)
- return;
-
- var rangeOfInterest;
- if (this.rangeOfInterest_.isEmpty)
- rangeOfInterest = this.model_.bounds;
- else
- rangeOfInterest = this.rangeOfInterest_;
-
- var allGroup = this.generateResultsForGroup(this.model_, 'all');
- var resultsByGroupName = {};
- this.model_.getAllThreads().forEach(function(thread) {
- var groupName = this.getGroupNameForThread_(thread);
- if (resultsByGroupName[groupName] === undefined) {
- resultsByGroupName[groupName] = this.generateResultsForGroup(
- this.model_, groupName);
- }
- resultsByGroupName[groupName].appendThreadSlices(
- rangeOfInterest, thread);
-
- allGroup.appendThreadSlices(rangeOfInterest, thread);
- }, this);
-
- // Helper function for working with the produced group.
- var getValueFromGroup = function(group) {
- if (this.groupingUnit_ == WALL_TIME_GROUPING_UNIT)
- return group.wallTime;
- return group.cpuTime;
- }.bind(this);
-
- // Create summary.
- var summaryText = document.createElement('div');
- summaryText.appendChild(tr.ui.b.createSpan({
- textContent: 'Total ' + this.groupingUnit_ + ': ',
- bold: true}));
- summaryText.appendChild(tr.v.ui.createScalarSpan(
- getValueFromGroup(allGroup), {
- unit: tr.v.Unit.byName.timeDurationInMs,
- ownerDocument: this.ownerDocument
- }));
- resultArea.appendChild(summaryText);
-
- // If needed, add in the idle time.
- var extraValue = 0;
- var extraData = [];
- if (this.showCpuIdleTime_ &&
- this.groupingUnit_ === CPU_TIME_GROUPING_UNIT &&
- this.model.kernel.bestGuessAtCpuCount !== undefined) {
- var maxCpuTime = rangeOfInterest.range *
- this.model.kernel.bestGuessAtCpuCount;
- var idleTime = Math.max(0, maxCpuTime - allGroup.cpuTime);
- extraData.push({
- label: 'CPU Idle',
- value: idleTime,
- valueText: tr.v.Unit.byName.timeDurationInMs.format(idleTime)
- });
- extraValue += idleTime;
- }
-
- // Create the actual chart.
- var otherGroup = this.generateResultsForGroup(this.model_, 'Other');
- var groups = this.trimPieChartData(
- tr.b.dictionaryValues(resultsByGroupName),
- otherGroup,
- getValueFromGroup,
- extraValue);
-
- if (groups.length == 0) {
- resultArea.appendChild(tr.ui.b.createSpan({textContent: 'No data'}));
- return undefined;
- }
-
- this.chart_ = this.createPieChartFromResultGroups(
- groups,
- this.groupingUnit_ + ' breakdown by ' + this.groupBy_,
- getValueFromGroup, extraData);
- resultArea.appendChild(this.chart_);
-
- this.chart_.addEventListener('click', function() {
- var event = new tr.model.RequestSelectionChangeEvent();
- event.selection = new tr.c.EventSet([]);
- this.dispatchEvent(event);
- });
- this.chart_.setSize(this.chart_.getMinSize());
- },
-
- get selection() {
- return selection_;
- },
-
- set selection(selection) {
- this.selection_ = selection;
-
- if (this.chart_ === undefined)
- return;
-
- if (selection.timeSummaryGroupName)
- this.chart_.highlightedLegendKey = selection.timeSummaryGroupName;
- else
- this.chart_.highlightedLegendKey = undefined;
- },
-
- get rangeOfInterest() {
- return this.rangeOfInterest_;
- },
-
- set rangeOfInterest(rangeOfInterest) {
- this.rangeOfInterest_ = rangeOfInterest;
- this.updateContents_();
- },
-
- supportsModel: function(model) {
- return {
- supported: false
- };
- },
-
- get textLabel() {
- return 'Time Summary';
- }
- });
- }());
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/time_summary_side_panel_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/time_summary_side_panel_test.html
deleted file mode 100644
index 789093fd9b1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/side_panel/time_summary_side_panel_test.html
+++ /dev/null
@@ -1,206 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/extras/side_panel/time_summary_side_panel.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function createModel(opt_options) {
- var options = opt_options || {};
- var m = tr.c.TestUtils.newModelWithEvents([], {
- shiftWorldToZero: false,
- pruneContainers: false,
- customizeModelCallback: function(m) {
- if (options.provideSoftwareMeasuredCpuCount)
- m.kernel.softwareMeasuredCpuCount = 2;
-
- var browserProcess = m.getOrCreateProcess(1);
- var browserMain = browserProcess.getOrCreateThread(2);
- browserMain.name = 'CrBrowserMain';
- browserMain.sliceGroup.beginSlice('cat', 'Task', 0, undefined, 0);
- browserMain.sliceGroup.endSlice(10, 9);
- browserMain.sliceGroup.beginSlice('cat', 'Task', 20, undefined, 10);
- browserMain.sliceGroup.endSlice(30, 20);
-
- var rendererProcess = m.getOrCreateProcess(4);
- var rendererMain = rendererProcess.getOrCreateThread(5);
- rendererMain.name = 'CrRendererMain';
- rendererMain.sliceGroup.beginSlice('cat', 'Task', 0, undefined, 0);
- rendererMain.sliceGroup.endSlice(30, 25);
- rendererMain.sliceGroup.beginSlice('cat', 'Task', 40, undefined, 40);
- rendererMain.sliceGroup.endSlice(60, 50);
- }
- });
- return m;
- }
-
- test('group', function() {
- var ts = document.createElement('tr-ui-e-s-time-summary-side-panel');
- var m = createModel();
- var group = ts.generateResultsForGroup(m, 'foo');
- group.appendThreadSlices(m.bounds, m.processes[1].threads[2]);
- assert.equal(group.wallTime, 20);
- assert.equal(group.cpuTime, 19);
- });
-
- test('trim', function() {
- var groupData = [
- {
- value: 2.854999999999997,
- label: '156959'
- },
- {
- value: 9.948999999999998,
- label: '16131'
- },
- {
- value: 42.314000000000725,
- label: '51511'
- },
- {
- value: 31.06900000000028,
- label: 'AudioOutputDevice'
- },
- {
- value: 1.418,
- label: 'BrowserBlockingWorker2/50951'
- },
- {
- value: 0.044,
- label: 'BrowserBlockingWorker3/50695'
- },
- {
- value: 18.52599999999993,
- label: 'Chrome_ChildIOThread'
- },
- {
- value: 2.888,
- label: 'Chrome_FileThread'
- },
- {
- value: 0.067,
- label: 'Chrome_HistoryThread'
- },
- {
- value: 25.421000000000046,
- label: 'Chrome_IOThread'
- },
- {
- value: 0.019,
- label: 'Chrome_ProcessLauncherThread'
- },
- {
- value: 643.087999999995,
- label: 'Compositor'
- },
- {
- value: 4.049999999999973,
- label: 'CompositorRasterWorker1/22031'
- },
- {
- value: 50.040000000000106,
- label: 'CrBrowserMain'
- },
- {
- value: 1256.5130000000042,
- label: 'CrGpuMain'
- },
- {
- value: 5502.19499999999,
- label: 'CrRendererMain'
- },
- {
- value: 15.552999999999862,
- label: 'FFmpegDemuxer'
- },
- {
- value: 63.706000000001524,
- label: 'Media'
- },
- {
- value: 2.7419999999999987,
- label: 'PowerSaveBlocker'
- },
- {
- value: 0.11500000000000005,
- label: 'Watchdog'
- }
- ];
-
- var ts = document.createElement('tr-ui-e-s-time-summary-side-panel');
-
- var groups = [];
- var m = tr.c.TestUtils.newModelWithEvents([], {
- shiftWorldToZero: false,
- pruneContainers: false,
- customizeModelCallback: function(m) {
- var start = 0;
- groupData.forEach(function(groupData) {
- var group = ts.generateResultsForGroup(m, groupData.label);
-
- var slice = tr.c.TestUtils.newSliceEx(
- {title: groupData.label,
- start: start, duration: groupData.value});
- start += groupData.value;
- group.allSlices.push(slice);
- group.topLevelSlices.push(slice);
-
- groups.push(group);
- });
- }
- });
-
- function getValueFromGroup(d) { return d.wallTime; }
-
- var otherGroup = ts.generateResultsForGroup(m, 'Other');
- var newGroups = ts.trimPieChartData(groups, otherGroup, getValueFromGroup);
-
- // Visualize the data once its trimmed.
- var ce = document.createElement('tr-ui-e-s-time-summary-side-panel');
- var chart = ce.createPieChartFromResultGroups(
- newGroups, 'Trimmed', getValueFromGroup);
- this.addHTMLOutput(chart);
- chart.setSize(chart.getMinSize());
- });
-
- test('basicInWallTimeMode', function() {
- var m = createModel();
-
- var panel = document.createElement('tr-ui-e-s-time-summary-side-panel');
- this.addHTMLOutput(panel);
- panel.model = m;
- panel.groupingUnit = 'Wall time';
- panel.style.border = '1px solid black';
- });
-
- test('basicInCpuTimeModeButNoCpuData', function() {
- var m = createModel();
-
- var panel = document.createElement('tr-ui-e-s-time-summary-side-panel');
- this.addHTMLOutput(panel);
- panel.model = m;
- panel.groupingUnit = 'CPU time';
- panel.style.border = '1px solid black';
- });
-
- test('basicInCpuTimeModeAndCpuData', function() {
- var m = createModel({
- provideSoftwareMeasuredCpuCount: true
- });
-
- var panel = document.createElement('tr-ui-e-s-time-summary-side-panel');
- this.addHTMLOutput(panel);
- panel.model = m;
- panel.groupingUnit = 'CPU time';
- panel.style.border = '1px solid black';
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats.html
deleted file mode 100644
index 97562f96419..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/system_stats/system_stats_snapshot.html">
-<link rel="import"
- href="/tracing/ui/extras/system_stats/system_stats_snapshot_view.html">
-<link rel="import"
- href="/tracing/ui/extras/system_stats/system_stats_instance_track.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_instance_track.css b/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_instance_track.css
deleted file mode 100644
index 40096f5497c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_instance_track.css
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-.tr-ui-e-system-stats-instance-track {
- height: 500px;
-}
-
-.tr-ui-e-system-stats-instance-track ul {
- list-style: none;
- list-style-position: outside;
- margin: 0;
- overflow: hidden;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_instance_track.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_instance_track.html
deleted file mode 100644
index 9aa10212de6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_instance_track.html
+++ /dev/null
@@ -1,355 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet"
- href="/tracing/ui/extras/system_stats/system_stats_instance_track.css">
-
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/ui/tracks/stacked_bars_track.html">
-<link rel="import" href="/tracing/ui/tracks/object_instance_track.html">
-<link rel="import" href="/tracing/ui/base/event_presenter.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.system_stats', function() {
- var EventPresenter = tr.ui.b.EventPresenter;
-
- var statCount;
-
- var excludedStats = {'meminfo': {
- 'pswpin': 0,
- 'pswpout': 0,
- 'pgmajfault': 0},
- 'diskinfo': {
- 'io': 0,
- 'io_time': 0,
- 'read_time': 0,
- 'reads': 0,
- 'reads_merged': 0,
- 'sectors_read': 0,
- 'sectors_written': 0,
- 'weighted_io_time': 0,
- 'write_time': 0,
- 'writes': 0,
- 'writes_merged': 0},
- 'swapinfo': {}
- };
-
- /**
- * Tracks that display system stats data.
- *
- * @constructor
- * @extends {StackedBarsTrack}
- */
-
- var SystemStatsInstanceTrack = tr.ui.b.define(
- 'tr-ui-e-system-stats-instance-track', tr.ui.tracks.StackedBarsTrack);
-
- SystemStatsInstanceTrack.prototype = {
-
- __proto__: tr.ui.tracks.StackedBarsTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.StackedBarsTrack.prototype.decorate.call(this, viewport);
- this.classList.add('tr-ui-e-system-stats-instance-track');
- this.objectInstance_ = null;
- },
-
- set objectInstances(objectInstances) {
- if (!objectInstances) {
- this.objectInstance_ = [];
- return;
- }
- if (objectInstances.length != 1)
- throw new Error('Bad object instance count.');
- this.objectInstance_ = objectInstances[0];
- if (this.objectInstance_ !== null) {
- this.computeRates_(this.objectInstance_.snapshots);
- this.maxStats_ = this.computeMaxStats_(
- this.objectInstance_.snapshots);
- }
- },
-
- computeRates_: function(snapshots) {
- for (var i = 0; i < snapshots.length; i++) {
- var snapshot = snapshots[i];
- var stats = snapshot.getStats();
- var prevSnapshot;
- var prevStats;
-
- if (i == 0) {
- // Deltas will be zero.
- prevSnapshot = snapshots[0];
- } else {
- prevSnapshot = snapshots[i - 1];
- }
- prevStats = prevSnapshot.getStats();
- var timeIntervalSeconds = (snapshot.ts - prevSnapshot.ts) / 1000;
- // Prevent divide by zero.
- if (timeIntervalSeconds == 0)
- timeIntervalSeconds = 1;
-
- this.computeRatesRecursive_(prevStats, stats,
- timeIntervalSeconds);
- }
- },
-
- computeRatesRecursive_: function(prevStats, stats,
- timeIntervalSeconds) {
- for (var statName in stats) {
- if (stats[statName] instanceof Object) {
- this.computeRatesRecursive_(prevStats[statName],
- stats[statName],
- timeIntervalSeconds);
- } else {
- if (statName == 'sectors_read') {
- stats['bytes_read_per_sec'] = (stats['sectors_read'] -
- prevStats['sectors_read']) *
- 512 / timeIntervalSeconds;
- }
- if (statName == 'sectors_written') {
- stats['bytes_written_per_sec'] =
- (stats['sectors_written'] -
- prevStats['sectors_written']) *
- 512 / timeIntervalSeconds;
- }
- if (statName == 'pgmajfault') {
- stats['pgmajfault_per_sec'] = (stats['pgmajfault'] -
- prevStats['pgmajfault']) /
- timeIntervalSeconds;
- }
- if (statName == 'pswpin') {
- stats['bytes_swpin_per_sec'] = (stats['pswpin'] -
- prevStats['pswpin']) *
- 1000 / timeIntervalSeconds;
- }
- if (statName == 'pswpout') {
- stats['bytes_swpout_per_sec'] = (stats['pswpout'] -
- prevStats['pswpout']) *
- 1000 / timeIntervalSeconds;
- }
- }
- }
- },
-
- computeMaxStats_: function(snapshots) {
- var maxStats = new Object();
- statCount = 0;
-
- for (var i = 0; i < snapshots.length; i++) {
- var snapshot = snapshots[i];
- var stats = snapshot.getStats();
-
- this.computeMaxStatsRecursive_(stats, maxStats,
- excludedStats);
- }
-
- return maxStats;
- },
-
- computeMaxStatsRecursive_: function(stats, maxStats, excludedStats) {
- for (var statName in stats) {
- if (stats[statName] instanceof Object) {
- if (!(statName in maxStats))
- maxStats[statName] = new Object();
-
- var excludedNested;
- if (excludedStats && statName in excludedStats)
- excludedNested = excludedStats[statName];
- else
- excludedNested = null;
-
- this.computeMaxStatsRecursive_(stats[statName],
- maxStats[statName],
- excludedNested);
- } else {
- if (excludedStats && statName in excludedStats)
- continue;
- if (!(statName in maxStats)) {
- maxStats[statName] = 0;
- statCount++;
- }
- if (stats[statName] > maxStats[statName])
- maxStats[statName] = stats[statName];
- }
- }
- },
-
- get height() {
- return window.getComputedStyle(this).height;
- },
-
- set height(height) {
- this.style.height = height;
- },
-
- draw: function(type, viewLWorld, viewRWorld) {
- switch (type) {
- case tr.ui.tracks.DrawType.GENERAL_EVENT:
- this.drawStatBars_(viewLWorld, viewRWorld);
- break;
- }
- },
-
- drawStatBars_: function(viewLWorld, viewRWorld) {
- var ctx = this.context();
- var pixelRatio = window.devicePixelRatio || 1;
-
- var bounds = this.getBoundingClientRect();
- var width = bounds.width * pixelRatio;
- var height = (bounds.height * pixelRatio) / statCount;
-
- // Culling parameters.
- var vp = this.viewport.currentDisplayTransform;
-
- // Scale by the size of the largest snapshot.
- var maxStats = this.maxStats_;
-
- var objectSnapshots = this.objectInstance_.snapshots;
- var lowIndex = tr.b.findLowIndexInSortedArray(
- objectSnapshots,
- function(snapshot) {
- return snapshot.ts;
- },
- viewLWorld);
-
- // Assure that the stack with the left edge off screen still gets drawn
- if (lowIndex > 0)
- lowIndex -= 1;
-
- for (var i = lowIndex; i < objectSnapshots.length; ++i) {
- var snapshot = objectSnapshots[i];
- var trace = snapshot.getStats();
- var currentY = height;
-
- var left = snapshot.ts;
- if (left > viewRWorld)
- break;
- var leftView = vp.xWorldToView(left);
- if (leftView < 0)
- leftView = 0;
-
- // Compute the edges for the column graph bar.
- var right;
- if (i != objectSnapshots.length - 1) {
- right = objectSnapshots[i + 1].ts;
- } else {
- // If this is the last snaphot of multiple snapshots, use the width of
- // the previous snapshot for the width.
- if (objectSnapshots.length > 1)
- right = objectSnapshots[i].ts + (objectSnapshots[i].ts -
- objectSnapshots[i - 1].ts);
- else
- // If there's only one snapshot, use max bounds as the width.
- right = this.objectInstance_.parent.model.bounds.max;
- }
-
- var rightView = vp.xWorldToView(right);
- if (rightView > width)
- rightView = width;
-
- // Floor the bounds to avoid a small gap between stacks.
- leftView = Math.floor(leftView);
- rightView = Math.floor(rightView);
-
- // Descend into nested stats.
- this.drawStatBarsRecursive_(snapshot,
- leftView,
- rightView,
- height,
- trace,
- maxStats,
- currentY);
-
- if (i == lowIndex)
- this.drawStatNames_(leftView, height, currentY, '', maxStats);
- }
- ctx.lineWidth = 1;
- },
-
- drawStatBarsRecursive_: function(snapshot,
- leftView,
- rightView,
- height,
- stats,
- maxStats,
- currentY) {
- var ctx = this.context();
-
- for (var statName in maxStats) {
- if (stats[statName] instanceof Object) {
- // Use the y-position returned from the recursive call.
- currentY = this.drawStatBarsRecursive_(snapshot,
- leftView,
- rightView,
- height,
- stats[statName],
- maxStats[statName],
- currentY);
- } else {
- var maxStat = maxStats[statName];
-
- // Draw a bar for the stat. The height of the bar is scaled
- // against the largest value of the stat across all snapshots.
- ctx.fillStyle = EventPresenter.getBarSnapshotColor(
- snapshot, Math.round(currentY / height));
-
- var barHeight;
-
- if (maxStat > 0) {
- barHeight = height * Math.max(stats[statName], 0) / maxStat;
- } else {
- barHeight = 0;
- }
-
- ctx.fillRect(leftView, currentY - barHeight,
- Math.max(rightView - leftView, 1), barHeight);
-
- currentY += height;
- }
- }
-
- // Return the updated y-position.
- return currentY;
- },
-
- drawStatNames_: function(leftView, height, currentY, prefix, maxStats) {
- var ctx = this.context();
-
- ctx.textAlign = 'end';
- ctx.font = '12px Arial';
- ctx.fillStyle = '#000000';
- for (var statName in maxStats) {
- if (maxStats[statName] instanceof Object) {
- currentY = this.drawStatNames_(leftView, height, currentY,
- statName, maxStats[statName]);
- } else {
- var fullname = statName;
-
- if (prefix != '')
- fullname = prefix + ' :: ' + statName;
-
- ctx.fillText(fullname, leftView - 10, currentY - height / 4);
- currentY += height;
- }
- }
-
- return currentY;
- }
- };
-
- tr.ui.tracks.ObjectInstanceTrack.register(
- SystemStatsInstanceTrack,
- {typeName: 'base::TraceEventSystemStatsMonitor::SystemStats'});
-
- return {
- SystemStatsInstanceTrack: SystemStatsInstanceTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_instance_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_instance_track_test.html
deleted file mode 100644
index 684887c2f0d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_instance_track_test.html
+++ /dev/null
@@ -1,67 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/ui/extras/system_stats/system_stats.html">
-<link rel="import" href="/tracing/ui/timeline_viewport.html">
-<link rel="import" href="/tracing/ui/tracks/drawing_container.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var SystemStatsInstanceTrack = tr.ui.e.system_stats.SystemStatsInstanceTrack;
- var Viewport = tr.ui.TimelineViewport;
-
- var createObjects = function() {
- var objectInstance = new tr.model.ObjectInstance({});
- var snapshots = [];
-
- var stats1 = new Object();
- var stats2 = new Object();
-
- stats1['committed_memory'] = 2000000;
- stats2['committed_memory'] = 3000000;
-
- stats1['meminfo'] = new Object();
- stats1.meminfo['free'] = 10000;
- stats2['meminfo'] = new Object();
- stats2.meminfo['free'] = 20000;
-
- snapshots.push(new tr.e.system_stats.SystemStatsSnapshot(objectInstance,
- 10, stats1));
- snapshots.push(new tr.e.system_stats.SystemStatsSnapshot(objectInstance,
- 20, stats2));
-
- objectInstance.snapshots = snapshots;
-
- return objectInstance;
- };
-
- test('instantiate', function() {
- var objectInstances = [];
- objectInstances.push(createObjects());
-
- var div = document.createElement('div');
- var viewport = new Viewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- var track = new SystemStatsInstanceTrack(viewport);
- track.objectInstances = objectInstances;
- drawingContainer.appendChild(track);
-
- this.addHTMLOutput(div);
- drawingContainer.invalidate();
-
- track.heading = 'testBasic';
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 50, track.clientWidth);
- track.viewport.setDisplayTransformImmediately(dt);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_snapshot_view.css b/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_snapshot_view.css
deleted file mode 100644
index e698b15aa70..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_snapshot_view.css
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-.tr-ui-e-system-stats-snapshot-view .subhead {
- font-size: small;
- padding-bottom: 10px;
-}
-
-.tr-ui-e-system-stats-snapshot-view ul {
- background-position: 0 5px;
- background-repeat: no-repeat;
- cursor: pointer;
- font-family: monospace;
- list-style: none;
- margin: 0;
- padding-left: 15px;
-}
-
-.tr-ui-e-system-stats-snapshot-view li {
- background-position: 0 5px;
- background-repeat: no-repeat;
- cursor: pointer;
- list-style: none;
- margin: 0;
- padding-left: 15px;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_snapshot_view.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_snapshot_view.html
deleted file mode 100644
index 11421e91453..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/system_stats/system_stats_snapshot_view.html
+++ /dev/null
@@ -1,84 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet"
- href="/tracing/ui/extras/system_stats/system_stats_snapshot_view.css">
-
-<link rel="import" href="/tracing/ui/analysis/object_snapshot_view.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.e.system_stats', function() {
- /*
- * Displays a system stats snapshot in a human readable form. @constructor
- */
- var SystemStatsSnapshotView = tr.ui.b.define(
- 'tr-ui-e-system-stats-snapshot-view', tr.ui.analysis.ObjectSnapshotView);
-
- SystemStatsSnapshotView.prototype = {
- __proto__: tr.ui.analysis.ObjectSnapshotView.prototype,
-
- decorate: function() {
- this.classList.add('tr-ui-e-system-stats-snapshot-view');
- },
-
- updateContents: function() {
- var snapshot = this.objectSnapshot_;
- if (!snapshot || !snapshot.getStats()) {
- this.textContent = 'No system stats snapshot found.';
- return;
- }
- // Clear old snapshot view.
- this.textContent = '';
-
- var stats = snapshot.getStats();
- this.appendChild(this.buildList_(stats));
- },
-
- isFloat: function(n) {
- return typeof n === 'number' && n % 1 !== 0;
- },
-
- /**
- * Creates nested lists.
- *
- * @param {Object} stats The current trace system stats entry.
- * @return {Element} A ul list element.
- */
- buildList_: function(stats) {
- var statList = document.createElement('ul');
-
- for (var statName in stats) {
- var statText = document.createElement('li');
- statText.textContent = '' + statName + ': ';
- statList.appendChild(statText);
-
- if (stats[statName] instanceof Object) {
- statList.appendChild(this.buildList_(stats[statName]));
- } else {
- if (this.isFloat(stats[statName]))
- statText.textContent += stats[statName].toFixed(2);
- else
- statText.textContent += stats[statName];
- }
- }
-
- return statList;
- }
- };
-
- tr.ui.analysis.ObjectSnapshotView.register(
- SystemStatsSnapshotView,
- {typeName: 'base::TraceEventSystemStatsMonitor::SystemStats'});
-
- return {
- SystemStatsSnapshotView: SystemStatsSnapshotView
- };
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/extras/systrace_config.html b/chromium/third_party/catapult/tracing/tracing/ui/extras/systrace_config.html
deleted file mode 100644
index 3ba4626e1c3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/extras/systrace_config.html
+++ /dev/null
@@ -1,12 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/systrace_config.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/extras/highlighter/vsync_highlighter.html">
-<link rel="import" href="/tracing/ui/extras/side_panel/alerts_side_panel.html">
-<link rel="import" href="/tracing/ui/timeline_view.html">
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/find_control.html b/chromium/third_party/catapult/tracing/tracing/ui/find_control.html
deleted file mode 100644
index 6f2c636b281..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/find_control.html
+++ /dev/null
@@ -1,173 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/hotkey_controller.html">
-<link rel="import" href="/tracing/ui/find_controller.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-
-<polymer-element name="tr-ui-find-control">
- <template>
- <style>
- :host {
- -webkit-user-select: none;
- display: -webkit-flex;
- position: relative;
- }
- input {
- -webkit-user-select: auto;
- background-color: #f8f8f8;
- border: 1px solid rgba(0, 0, 0, 0.5);
- box-sizing: border-box;
- margin: 0;
- padding: 0;
- width: 170px;
- }
- input:focus {
- background-color: white;
- }
- tr-ui-b-toolbar-button {
- border-left: none;
- margin: 0;
- }
- #hitCount {
- left: 0;
- opacity: 0.25;
- pointer-events: none;
- position: absolute;
- text-align: right;
- top: 2px;
- width: 167px;
- z-index: 1;
- }
- #spinner {
- visibility: hidden;
- width: 8px;
- height: 8px;
- left: 154px;
- pointer-events: none;
- position: absolute;
- top: 4px;
- z-index: 1;
-
- border: 2px solid transparent;
- border-bottom: 2px solid rgba(0, 0, 0, 0.5);
- border-right: 2px solid rgba(0, 0, 0, 0.5);
- border-radius: 50%;
-
- animation: spin 1s linear infinite;
- }
- @keyframes spin { 100% { transform: rotate(360deg); } }
- </style>
-
- <input type='text' id='filter'
- on-input="{{ filterTextChanged }}"
- on-keydown="{{ filterKeyDown }}"
- on-blur="{{ filterBlur }}"
- on-focus="{{ filterFocus }}"
- on-mouseup="{{ filterMouseUp }}" />
- <div id="spinner"></div>
- <tr-ui-b-toolbar-button on-click="{{ findPrevious }}">
- &larr;
- </tr-ui-b-toolbar-button>
- <tr-ui-b-toolbar-button on-click="{{ findNext }}">
- &rarr;
- </tr-ui-b-toolbar-button>
- <div id="hitCount">0 of 0</div>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- filterKeyDown: function(e) {
- if (e.keyCode === 27) {
- var hkc = tr.b.getHotkeyControllerForElement(this);
- if (hkc) {
- hkc.childRequestsBlur(this);
- } else {
- this.blur();
- }
- e.preventDefault();
- e.stopPropagation();
- return;
- } else if (e.keyCode === 13) {
- if (e.shiftKey)
- this.findPrevious();
- else
- this.findNext();
- }
- },
-
- filterBlur: function(e) {
- this.updateHitCountEl();
- },
-
- filterFocus: function(e) {
- this.$.filter.select();
- },
-
- // Prevent that the input text is deselected after focusing the find
- // control with the mouse.
- filterMouseUp: function(e) {
- e.preventDefault();
- },
-
- get controller() {
- return this.controller_;
- },
-
- set controller(c) {
- this.controller_ = c;
- this.updateHitCountEl();
- },
-
- focus: function() {
- this.$.filter.focus();
- },
-
- get hasFocus() {
- return this === document.activeElement;
- },
-
- filterTextChanged: function() {
- this.$.hitCount.textContent = '';
- this.$.spinner.style.visibility = 'visible';
- this.controller.startFiltering(this.$.filter.value).then(function() {
- this.$.spinner.style.visibility = 'hidden';
- this.updateHitCountEl();
- }.bind(this));
- },
-
- findNext: function() {
- if (this.controller)
- this.controller.findNext();
- this.updateHitCountEl();
- },
-
- findPrevious: function() {
- if (this.controller)
- this.controller.findPrevious();
- this.updateHitCountEl();
- },
-
- updateHitCountEl: function() {
- if (!this.controller || this.$.filter.value.length === 0) {
- this.$.hitCount.textContent = '';
- return;
- }
-
- var n = this.controller.filterHits.length;
- var i = n === 0 ? -1 : this.controller.currentHitIndex;
- this.$.hitCount.textContent = (i + 1) + ' of ' + n;
- },
-
- setText: function(string) {
- this.$.filter.value = string;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/find_control_test.html b/chromium/third_party/catapult/tracing/tracing/ui/find_control_test.html
deleted file mode 100644
index 192f6fe9935..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/find_control_test.html
+++ /dev/null
@@ -1,66 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/ui/find_control.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var ctl = document.createElement('tr-ui-find-control');
- ctl.controller = {
- findNext: function() { },
- findPrevious: function() { },
- reset: function() {},
-
- filterHits: ['a', 'b'],
-
- currentHitIndex: 0
- };
-
- this.addHTMLOutput(ctl);
- });
-
- test('updateHitCountEl_twoResults', function() {
- var ctl = document.createElement('tr-ui-find-control');
- ctl.controller = {
- findNext: function() { },
- findPrevious: function() { },
- reset: function() {},
-
- filterHits: ['a', 'b'],
-
- currentHitIndex: 0
- };
-
- this.addHTMLOutput(ctl);
- ctl.$.filter.value = 'test';
- ctl.updateHitCountEl();
- assert.equal(ctl.$.hitCount.textContent, '1 of 2');
- });
-
- test('updateHitCountEl_emptyFilter', function() {
- var ctl = document.createElement('tr-ui-find-control');
- ctl.controller = {
- findNext: function() { },
- findPrevious: function() { },
- reset: function() {},
-
- filterHits: ['a', 'b'],
-
- currentHitIndex: 0
- };
-
- this.addHTMLOutput(ctl);
- ctl.$.filter.value = '';
- ctl.updateHitCountEl();
- assert.equal(ctl.$.hitCount.textContent, '');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/find_controller.html b/chromium/third_party/catapult/tracing/tracing/ui/find_controller.html
deleted file mode 100644
index 4247676856b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/find_controller.html
+++ /dev/null
@@ -1,154 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/task.html">
-<link rel="import" href="/tracing/core/filter.html">
-<link rel="import" href="/tracing/model/event_set.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview FindController.
- */
-tr.exportTo('tr.ui', function() {
- var Task = tr.b.Task;
-
- function FindController(brushingStateController) {
- this.brushingStateController_ = brushingStateController;
- this.filterHits_ = [];
- this.currentHitIndex_ = -1;
- this.activePromise_ = Promise.resolve();
- this.activeTask_ = undefined;
- };
-
- FindController.prototype = {
- __proto__: Object.prototype,
-
- get model() {
- return this.brushingStateController_.model;
- },
-
- get brushingStateController() {
- return this.brushingStateController_;
- },
-
- enqueueOperation_: function(operation) {
- var task;
- if (operation instanceof tr.b.Task)
- task = operation;
- else
- task = new tr.b.Task(operation, this);
- if (this.activeTask_) {
- this.activeTask_ = this.activeTask_.enqueue(task);
- } else {
- // We're enqueuing the first task, schedule it.
- this.activeTask_ = task;
- this.activePromise_ = Task.RunWhenIdle(this.activeTask_);
- this.activePromise_.then(function() {
- this.activePromise_ = undefined;
- this.activeTask_ = undefined;
- }.bind(this));
- }
- },
-
- /**
- * Updates the filter hits based on the provided |filterText|. Returns a
- * promise which resolves when |filterHits| has been refreshed.
- */
- startFiltering: function(filterText) {
- var sc = this.brushingStateController_;
- if (!sc)
- return;
-
- // TODO(beaudoin): Cancel anything left in the task queue, without
- // invalidating the promise.
- this.enqueueOperation_(function() {
- this.filterHits_ = [];
- this.currentHitIndex_ = -1;
- }.bind(this));
-
- // Try constructing a UIState from the filterText.
- // UIState.fromUserFriendlyString will throw an error only if the string
- // is syntactically correct to a UI state string but with invalid values.
- // It will return undefined if there is no syntactic match.
- var stateFromString;
- try {
- stateFromString = sc.uiStateFromString(filterText);
- } catch (e) {
- this.enqueueOperation_(function() {
- var overlay = new tr.ui.b.Overlay();
- overlay.textContent = e.message;
- overlay.title = 'UI State Navigation Error';
- overlay.visible = true;
- });
- return this.activePromise_;
- }
-
- if (stateFromString !== undefined) {
- this.enqueueOperation_(
- sc.navToPosition.bind(this, stateFromString, true));
- } else {
- // filterText is not a navString here -- proceed with find and filter.
- if (filterText.length === 0) {
- this.enqueueOperation_(sc.findTextCleared.bind(sc));
- } else {
- var filter = new tr.c.FullTextFilter(filterText);
- var filterHitSet = new tr.model.EventSet();
- this.enqueueOperation_(sc.addAllEventsMatchingFilterToSelectionAsTask(
- filter, filterHitSet));
- this.enqueueOperation_(function() {
- this.filterHits_ = filterHitSet.toArray();
- sc.findTextChangedTo(filterHitSet);
- }.bind(this));
- }
- }
- return this.activePromise_;
- },
-
- /**
- * Returns the most recent filter hits as an array. Call
- * |startFiltering| to ensure this is up to date after the filter settings
- * have been changed.
- */
- get filterHits() {
- return this.filterHits_;
- },
-
- get currentHitIndex() {
- return this.currentHitIndex_;
- },
-
- find_: function(dir) {
- var firstHit = this.currentHitIndex_ === -1;
- if (firstHit && dir < 0)
- this.currentHitIndex_ = 0;
-
- var N = this.filterHits.length;
- this.currentHitIndex_ = (this.currentHitIndex_ + dir + N) % N;
-
- if (!this.brushingStateController_)
- return;
-
- this.brushingStateController_.findFocusChangedTo(
- new tr.model.EventSet(this.filterHits[this.currentHitIndex]));
- },
-
- findNext: function() {
- this.find_(1);
- },
-
- findPrevious: function() {
- this.find_(-1);
- }
- };
-
- return {
- FindController: FindController
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/find_controller_test.html b/chromium/third_party/catapult/tracing/tracing/ui/find_controller_test.html
deleted file mode 100644
index f6509f88cbc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/find_controller_test.html
+++ /dev/null
@@ -1,307 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/task.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/find_controller.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-<link rel="import" href="/tracing/ui/timeline_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Task = tr.b.Task;
-
- /*
- * Just enough of the BrushingStateController to support the tests below.
- */
- function FakeBrushingStateController() {
- this.addAllEventsMatchingFilterToSelectionReturnValue = [];
-
- this.viewport = undefined;
- this.model = undefined;
- this.selection = new tr.model.EventSet();
- this.findMatches = new tr.model.EventSet();
- }
-
- FakeBrushingStateController.prototype = {
- addAllEventsMatchingFilterToSelectionAsTask: function(filter, selection) {
- return new Task(function() {
- var n = this.addAllEventsMatchingFilterToSelectionReturnValue.length;
- for (var i = 0; i < n; i++) {
- selection.push(
- this.addAllEventsMatchingFilterToSelectionReturnValue[i]);
- }
- }, this);
- },
-
- uiStateFromString: function(string) {
- return undefined;
- },
-
- findTextChangedTo: function(selection) {
- this.findMatches = selection;
- this.selection = new tr.model.EventSet();
- },
-
- findFocusChangedTo: function(selection) {
- this.selection = selection;
- },
-
- findTextCleared: function(selection) {
- this.selection = new tr.model.EventSet();
- this.findMatches = new tr.model.EventSet();
- }
- };
-
- function assertArrayShallowEquals(a, b, opt_message) {
- if (a.length === b.length) {
- var ok = true;
- for (var i = 0; i < a.length; i++) {
- ok &= (a[i] === b[i]);
- }
- if (ok)
- return;
- }
-
- var message = opt_message || 'Expected array ' + a + ', got array ' + b;
- throw new tr.b.unittest.TestError(message);
- };
-
- test('findControllerNoModel', function() {
- var brushingStateController = new FakeBrushingStateController();
- var controller = new tr.ui.FindController(brushingStateController);
- controller.findNext();
- controller.findPrevious();
- });
-
- test('findControllerEmptyHit', function() {
- var brushingStateController = new FakeBrushingStateController();
- var controller = new tr.ui.FindController(brushingStateController);
-
- brushingStateController.selection = new tr.model.EventSet();
- brushingStateController.findMatches = new tr.model.EventSet();
- controller.findNext();
- assertArrayShallowEquals([], brushingStateController.selection);
- assertArrayShallowEquals([], brushingStateController.findMatches);
- controller.findPrevious();
- assertArrayShallowEquals([], brushingStateController.selection);
- assertArrayShallowEquals([], brushingStateController.findMatches);
- });
-
- test('findControllerOneHit', function() {
- var brushingStateController = new FakeBrushingStateController();
- var controller = new tr.ui.FindController(brushingStateController);
-
- var s1 = {guid: 1};
- brushingStateController.addAllEventsMatchingFilterToSelectionReturnValue = [
- s1
- ];
- var promise = controller.startFiltering('asdf');
- promise.then(function() {
- assertArrayShallowEquals([], brushingStateController.selection);
- assertArrayShallowEquals([s1], brushingStateController.findMatches);
- controller.findNext();
- assertArrayShallowEquals([s1], brushingStateController.selection);
- assertArrayShallowEquals([s1], brushingStateController.findMatches);
- controller.findNext();
- assertArrayShallowEquals([s1], brushingStateController.selection);
- assertArrayShallowEquals([s1], brushingStateController.findMatches);
- controller.findPrevious();
- assertArrayShallowEquals([s1], brushingStateController.selection);
- assertArrayShallowEquals([s1], brushingStateController.findMatches);
- });
- return promise;
- });
-
- test('findControllerMultipleHits', function() {
- var brushingStateController = new FakeBrushingStateController();
- var controller = new tr.ui.FindController(brushingStateController);
-
- var s1 = {guid: 1};
- var s2 = {guid: 2};
- var s3 = {guid: 3};
-
- brushingStateController.addAllEventsMatchingFilterToSelectionReturnValue = [
- s1, s2, s3
- ];
- var promise = controller.startFiltering('asdf');
- promise.then(function() {
- // Loop through hits then when we wrap, try moving backward.
- assertArrayShallowEquals([], brushingStateController.selection);
- assertArrayShallowEquals([s1, s2, s3],
- brushingStateController.findMatches);
- controller.findNext();
- assertArrayShallowEquals([s1], brushingStateController.selection);
- controller.findNext();
- assertArrayShallowEquals([s2], brushingStateController.selection);
- controller.findNext();
- assertArrayShallowEquals([s3], brushingStateController.selection);
- controller.findNext();
- assertArrayShallowEquals([s1], brushingStateController.selection);
- controller.findPrevious();
- assertArrayShallowEquals([s3], brushingStateController.selection);
- controller.findPrevious();
- assertArrayShallowEquals([s2], brushingStateController.selection);
- assertArrayShallowEquals([s1, s2, s3],
- brushingStateController.findMatches);
- });
- return promise;
- });
-
- test('findControllerChangeFilterAfterNext', function() {
- var brushingStateController = new FakeBrushingStateController();
- var controller = new tr.ui.FindController(brushingStateController);
-
- var s1 = {guid: 1};
- var s2 = {guid: 2};
- var s3 = {guid: 3};
- var s4 = {guid: 4};
-
- brushingStateController.addAllEventsMatchingFilterToSelectionReturnValue = [
- s1, s2, s3
- ];
- var promise = controller.startFiltering('asdf');
- promise.then(function() {
- // Loop through hits then when we wrap, try moving backward.
- controller.findNext();
- brushingStateController.
- addAllEventsMatchingFilterToSelectionReturnValue = [s4];
-
- var nextPromise = controller.startFiltering('asdfsf');
- nextPromise.then(function() {
- controller.findNext();
- assertArrayShallowEquals([s4], brushingStateController.selection);
- });
- });
- return promise;
- });
-
- test('findControllerSelectsAllItemsFirst', function() {
- var brushingStateController = new FakeBrushingStateController();
- var controller = new tr.ui.FindController(brushingStateController);
-
- var s1 = {guid: 1};
- var s2 = {guid: 2};
- var s3 = {guid: 3};
- brushingStateController.addAllEventsMatchingFilterToSelectionReturnValue = [
- s1, s2, s3
- ];
- var promise = controller.startFiltering('asdfsf');
- promise.then(function() {
- assertArrayShallowEquals([], brushingStateController.selection);
- assertArrayShallowEquals([s1, s2, s3],
- brushingStateController.findMatches);
- controller.findNext();
- assertArrayShallowEquals([s1], brushingStateController.selection);
- controller.findNext();
- assertArrayShallowEquals([s2], brushingStateController.selection);
- assertArrayShallowEquals([s1, s2, s3],
- brushingStateController.findMatches);
- });
- return promise;
- });
-
- test('findControllerWithRealTimeline', function() {
- var model = tr.c.TestUtils.newModel(function(model) {
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
- t1.sliceGroup.pushSlice(new tr.model.ThreadSlice(
- '', 'a', 0, 1, {}, 3));
- model.t1 = t1;
- });
-
- var container = document.createElement('track-view-container');
- container.id = 'track_view_container';
-
- var timeline = document.createElement('tr-ui-timeline-view');
- timeline.appendChild(container);
-
- // This is for testing only, have to make sure things link up right.
- timeline.trackViewContainer_ = container;
-
- timeline.model = model;
-
- var brushingStateController = timeline.brushingStateController;
- var controller = timeline.findCtl_.controller;
-
- // Test find with no filterText.
- controller.findNext();
-
- // Test find with filter txt.
- var promise = controller.startFiltering('a');
- promise = promise.then(function() {
- assert.equal(brushingStateController.selection.length, 0);
- assert.deepEqual(tr.b.asArray(brushingStateController.findMatches),
- model.t1.sliceGroup.slices);
-
- controller.findNext();
- assert.isTrue(brushingStateController.selection.equals(
- new tr.model.EventSet(model.t1.sliceGroup.slices[0])));
-
- var nextPromise = controller.startFiltering('xxx');
- nextPromise.then(function() {
- assert.equal(brushingStateController.findMatches.length, 0);
- assert.equal(brushingStateController.selection.length, 1);
- controller.findNext();
- assert.equal(brushingStateController.selection.length, 0);
- controller.findNext();
- assert.equal(brushingStateController.selection.length, 0);
- });
- return nextPromise;
- });
- return promise;
- });
-
- test('findControllerNavigation', function() {
- var brushingStateController = new FakeBrushingStateController();
- var controller = new tr.ui.FindController(brushingStateController);
-
- var navToPositionCallCount = 0;
- var findTextClearedCallCount = 0;
- var fakeUIState = {};
- brushingStateController.uiStateFromString = function(string) {
- if (string === '')
- return undefined;
- assert.equal(string, '2000@1.2x7');
- return fakeUIState;
- };
- brushingStateController.navToPosition = function(uiState) {
- assert.equal(uiState, fakeUIState);
- navToPositionCallCount++;
- };
- brushingStateController.findTextCleared = function() {
- findTextClearedCallCount++;
- };
-
- var promise = controller.startFiltering('2000@1.2x7').then(function() {
- assert.equal(navToPositionCallCount, 1);
- });
- promise = promise.then(controller.startFiltering.bind(controller, ''));
- promise = promise.then(function() {
- assert.equal(findTextClearedCallCount, 1);
- });
- return promise;
- });
-
- test('findControllerClearAfterSet', function() {
- var brushingStateController = new FakeBrushingStateController();
- var controller = new tr.ui.FindController(brushingStateController);
- var findTextChangedToCalled = false;
- brushingStateController.findTextChangedTo = function(selection) {
- findTextChangedToCalled = true;
- };
- brushingStateController.findTextCleared = function() {
- assert.equal(findTextChangedToCalled, true);
- };
- controller.startFiltering('1');
- controller.startFiltering('');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/images/chrome-left.png b/chromium/third_party/catapult/tracing/tracing/ui/images/chrome-left.png
deleted file mode 100644
index 8eef2bf7ecc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/images/chrome-left.png
+++ /dev/null
Binary files differ
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/images/chrome-mid.png b/chromium/third_party/catapult/tracing/tracing/ui/images/chrome-mid.png
deleted file mode 100644
index c67e697de5f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/images/chrome-mid.png
+++ /dev/null
Binary files differ
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/images/chrome-right.png b/chromium/third_party/catapult/tracing/tracing/ui/images/chrome-right.png
deleted file mode 100644
index 834004a0f74..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/images/chrome-right.png
+++ /dev/null
Binary files differ
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/images/ui-states.png b/chromium/third_party/catapult/tracing/tracing/ui/images/ui-states.png
deleted file mode 100644
index 83d09179817..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/images/ui-states.png
+++ /dev/null
Binary files differ
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/metrics_debugger_app.html b/chromium/third_party/catapult/tracing/tracing/ui/metrics_debugger_app.html
deleted file mode 100644
index 5164a80d7bb..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/metrics_debugger_app.html
+++ /dev/null
@@ -1,131 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/perf_insights/mre/mre_result.html">
-<link rel="import" href="/tracing/extras/full_config.html">
-<link rel="import" href="/tracing/importer/import.html">
-<link rel="import" href="/tracing/metrics/all_metrics.html">
-<link rel="import" href="/tracing/metrics/metric_map_function.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/file.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<polymer-element name="tracing-ui-metrics-debugger-app">
- <template>
- <style>
- pre {
- overflow: auto;
- }
- #bar {
- display: flex;
- flex-direction: row;
- padding: 1px 6px;
- }
- </style>
-
- <top-left-controls id="top_left_controls"></top-left-controls>
- <input id="load_trace" type="file"/>
- <button id="run_metric">Run metric</button>
- <div id="trace_info"></div>
- <pre id="map_results">
- </pre>
- </template>
-</polymer-element>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui', function() {
- Polymer('tracing-ui-metrics-debugger-app', {
- created: function() {
- this.metrics_ = [];
- tr.metrics.MetricRegistry.getAllRegisteredTypeInfos().forEach(
- function(m) {
- this.metrics_.push({
- label: m.constructor.name,
- value: m.constructor.name
- });
- }, this);
- this.activeTrace_ = undefined;
- this.settingsKey_ = undefined;
- this.currentMetricName_ = undefined;
- this.settingsKey_ = 'metrics-debugger-app-metric-name';
- },
-
- ready: function() {
- var metricSelector = tr.ui.b.createSelector(
- this, 'currentMetricName_',
- this.settingsKey_,
- this.metrics_[0].value,
- this.metrics_);
- this.$.top_left_controls.appendChild(metricSelector);
-
- this.$.load_trace.addEventListener('change', function(event) {
- var file = event.target.files[0];
- this.onTraceFileSelected_(file);
- }.bind(this));
- this.$.run_metric.addEventListener(
- 'click', function(event) {
- event.stopPropagation();
- this.onRunMetricClicked_();
- }.bind(this));
- },
-
- onRunMetricClicked_: function() {
- if (this.activeTrace_ === undefined) {
- tr.ui.b.Overlay.showError('You must load a trace first!');
- return;
- }
- var result = new pi.mre.MreResult();
- var model = this.activeTrace_.model;
- var options = {metric: this.currentMetricName_};
- try {
- tr.metrics.metricMapFunction(result, model, options);
- this.$.map_results.textContent = 'Metric result:\n' +
- JSON.stringify(result.asDict(), undefined, 2);
- } catch (err) {
- tr.ui.b.Overlay.showError('Error running metric:\n' + err.stack);
- console.error(err);
- }
- },
-
- onTraceFileSelected_: function(file) {
- tr.ui.b.readFile(file).then(
- function(data) {
- this.setActiveTrace(file.name, data);
- }.bind(this),
- function(err) {
- tr.ui.b.Overlay.showError('Error while loading file: ' + err);
- });
- },
-
- setActiveTrace: function(filename, data) {
- var model = new tr.Model();
- var importOptions = new tr.importer.ImportOptions();
- importOptions.pruneEmptyContainers = false;
- importOptions.showImportWarnings = true;
- importOptions.trackDetailedModelStats = true;
-
- var i = new tr.importer.Import(model, importOptions);
- i.importTracesWithProgressDialog([data]).then(
- function() {
- this.activeTrace_ = {
- filename: filename,
- model: model,
- };
- this.$.trace_info.textContent = 'Trace file ' + filename +
- ' is loaded.';
- }.bind(this),
- function(err) {
- tr.ui.b.Overlay.showError('Trace import error: ' + err);
- console.error(err);
- });
- },
- });
- return {};
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/scripting_control.html b/chromium/third_party/catapult/tracing/tracing/ui/scripting_control.html
deleted file mode 100644
index 208cc35577e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/scripting_control.html
+++ /dev/null
@@ -1,188 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/extras/tquery/tquery.html">
-
-<polymer-element
- name="tr-ui-scripting-control">
- <template>
- <style>
- :host {
- flex: 1 1 auto;
- }
- .root {
- font-family: monospace;
- cursor: text;
-
- padding: 2px;
- margin: 2px;
- border: 1px solid rgba(0, 0, 0, 0.5);
- background: white;
-
- height: 100px;
- overflow-y: auto;
-
- transition-property: opacity, height, padding, margin;
- transition-duration: .2s;
- transition-timing-function: ease-out;
- }
- .hidden {
- margin-top: 0px;
- margin-bottom: 0px;
- padding-top: 0px;
- padding-bottom: 0px;
- height: 0px;
- opacity: 0;
- }
- .focused {
- outline: auto 5px -webkit-focus-ring-color;
- }
- #history {
- -webkit-user-select: text;
- color: #777;
- }
- #prompt {
- -webkit-user-select: text;
- -webkit-user-modify: read-write-plaintext-only;
- text-overflow: clip !important;
- text-decoration: none !important;
- }
- #prompt:focus {
- outline: none;
- }
- #prompt br {
- display: none;
- }
- #prompt ::before {
- content: ">";
- color: #468;
- }
- </style>
-
- <div id="root" class="root hidden" tabindex="0"
- on-focus="{{ onConsoleFocus }}">
- <div id='history'></div>
- <div id='prompt'
- on-keypress="{{ promptKeyPress }}"
- on-keydown="{{ promptKeyDown }}"
- on-blur="{{ onConsoleBlur }}"></div>
- </div>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- _isEnterKey: function(event) {
- // Check if in IME.
- return event.keyCode !== 229 && event.keyIdentifier === 'Enter';
- },
-
- _setFocused: function(focused) {
- var promptEl = this.$.prompt;
- if (focused) {
- promptEl.focus();
- this.$.root.classList.add('focused');
- // Move cursor to the end of any existing text.
- if (promptEl.innerText.length > 0) {
- var sel = window.getSelection();
- sel.collapse(promptEl.firstChild, promptEl.innerText.length);
- }
- } else {
- promptEl.blur();
- this.$.root.classList.remove('focused');
- // Workaround for crbug.com/89026 to ensure the prompt doesn't retain
- // keyboard focus.
- var parent = promptEl.parentElement;
- var nextEl = promptEl.nextSibling;
- promptEl.remove();
- parent.insertBefore(promptEl, nextEl);
- }
- },
-
- onConsoleFocus: function(e) {
- e.stopPropagation();
- this._setFocused(true);
- },
-
- onConsoleBlur: function(e) {
- e.stopPropagation();
- this._setFocused(false);
- },
-
- promptKeyDown: function(e) {
- e.stopPropagation();
- if (!this._isEnterKey(e))
- return;
- e.preventDefault();
- var promptEl = this.$.prompt;
- var command = promptEl.innerText;
- if (command.length === 0)
- return;
- promptEl.innerText = '';
- this.addLine_(String.fromCharCode(187) + ' ' + command);
-
- try {
- var result = this.controller_.executeCommand(command);
- } catch (e) {
- result = e.stack || e.stackTrace;
- }
-
- if (result instanceof tr.e.tquery.TQuery) {
- // TODO(skyostil): Show a cool spinner.
- result.ready().then(function(selection) {
- this.addLine_(selection.length + ' matches');
- this.controller_.brushingStateController.
- showScriptControlSelection(selection);
- }.bind(this));
- } else {
- this.addLine_(result);
- }
- promptEl.scrollIntoView();
- },
-
- addLine_: function(line) {
- var historyEl = this.$.history;
- if (historyEl.innerText.length !== 0)
- historyEl.innerText += '\n';
- historyEl.innerText += line;
- },
-
- promptKeyPress: function(e) {
- e.stopPropagation();
- },
-
- toggleVisibility: function() {
- var root = this.$.root;
- if (!this.visible) {
- root.classList.remove('hidden');
- this._setFocused(true);
- } else {
- root.classList.add('hidden');
- this._setFocused(false);
- }
- },
-
- get hasFocus() {
- return this === document.activeElement;
- },
-
- get visible() {
- var root = this.$.root;
- return !root.classList.contains('hidden');
- },
-
- get controller() {
- return this.controller_;
- },
-
- set controller(c) {
- this.controller_ = c;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/scripting_control_test.html b/chromium/third_party/catapult/tracing/tracing/ui/scripting_control_test.html
deleted file mode 100644
index a336b9f566a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/scripting_control_test.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/scripting_control.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var ctl = document.createElement('tr-ui-scripting-control');
- this.addHTMLOutput(ctl);
- ctl.toggleVisibility();
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/side_panel/file_size_stats_side_panel.html b/chromium/third_party/catapult/tracing/tracing/ui/side_panel/file_size_stats_side_panel.html
deleted file mode 100644
index 6e96d27da06..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/side_panel/file_size_stats_side_panel.html
+++ /dev/null
@@ -1,212 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/ui/base/grouping_table.html">
-<link rel="import" href="/tracing/ui/base/grouping_table_groupby_picker.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/ui/side_panel/side_panel.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name='tr-ui-sp-file-size-stats-side-panel'
- extends='tr-ui-side-panel'>
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
- toolbar {
- align-items: center;
- background-color: rgb(236, 236, 236);
- border-bottom: 1px solid #8e8e8e;
- display: flex;
- flex-direction: row;
- flex-direction: row;
- flex: 0 0 auto;
- font-size: 12px;
- padding: 0 10px 0 10px;
- }
- table-container {
- display: flex;
- min-height: 0px;
- overflow-y: auto;
- }
- </style>
-
- <toolbar>
- <span><b>Group by:</b></span>
- <tr-ui-b-grouping-table-groupby-picker id="picker">
- </tr-ui-b-grouping-table-groupby-picker>
- </toolbar>
- <table-container>
- <tr-ui-b-grouping-table id="table"></tr-ui-b-grouping-table>
- </table-container>
- </template>
-</polymer-element>
-
-<script>
-'use strict';
-(function() {
-
- Polymer('tr-ui-sp-file-size-stats-side-panel', {
- ready: function() {
- this.model_ = undefined;
- this.selection_ = new tr.model.EventSet();
- this.$.picker.settingsKey = 'tr-ui-sp-file-size-stats-side-panel-picker';
- this.$.picker.possibleGroups = [
- {
- key: 'phase', label: 'Event Type',
- dataFn: function(eventStat) { return eventStat.phase; }
- },
- {
- key: 'category', label: 'Category',
- dataFn: function(eventStat) { return eventStat.category; }
- },
- {
- key: 'title', label: 'Title',
- dataFn: function(eventStat) { return eventStat.title; }
- }
- ];
- this.$.picker.defaultGroupKeys = ['phase', 'title'];
- this.$.picker.addEventListener('current-groups-changed',
- this.updateContents_.bind(this));
- },
-
- get textLabel() {
- return 'File Size Stats';
- },
-
- supportsModel: function(m) {
- if (!m) {
- return {
- supported: false,
- reason: 'No stats were collected for this file.'
- };
- }
-
- if (m.stats.allTraceEventStats.length === 0) {
- return {
- supported: false,
- reason: 'No stats were collected for this file.'
- };
- }
- return {
- supported: true
- };
- },
-
- get model() {
- return this.model_;
- },
-
- set model(model) {
- this.model_ = model;
- this.updateContents_();
- },
-
- get rangeOfInterest() {
- return this.rangeOfInterest_;
- },
-
- set rangeOfInterest(rangeOfInterest) {
- this.rangeOfInterest_ = rangeOfInterest;
- },
-
- get selection() {
- return this.selection_;
- },
-
- set selection(selection) {
- this.selection_ = selection;
- },
-
- createColumns_: function(stats) {
- var columns = [
- {
- title: 'Title',
- value: function(row) {
- var titleEl = document.createElement('span');
- titleEl.textContent = row.title;
- titleEl.style.textOverflow = 'ellipsis';
- return titleEl;
- },
- cmp: function(a, b) {
- return a.title.localeCompare(b.title);
- },
- width: '400px'
- },
- {
- title: 'Num Events',
- align: tr.ui.b.TableFormat.ColumnAlignment.RIGHT,
- value: function(row) {
- return row.rowStats.numEvents;
- },
- cmp: function(a, b) {
- return a.rowStats.numEvents - b.rowStats.numEvents;
- },
- width: '80px'
- }
- ];
-
- if (stats && stats.hasEventSizesinBytes) {
- columns.push({
- title: 'Bytes',
- align: tr.ui.b.TableFormat.ColumnAlignment.RIGHT,
- value: function(row) {
- var value = new tr.v.ScalarNumeric(tr.v.Unit.byName.sizeInBytes,
- row.rowStats.totalEventSizeinBytes);
- var spanEl = tr.v.ui.createScalarSpan(value);
- return spanEl;
- },
- cmp: function(a, b) {
- return a.rowStats.totalEventSizeinBytes -
- b.rowStats.totalEventSizeinBytes;
- },
- width: '80px'
- });
- }
- return columns;
- },
-
- updateContents_: function() {
- var table = this.$.table;
-
- var columns = this.createColumns_(this.model.stats);
- table.rowStatsConstructor = function ModelStatsRowStats(row) {
- var sum = tr.b.Statistics.sum(row.data, function(x) {
- return x.numEvents;
- });
- var totalEventSizeinBytes = tr.b.Statistics.sum(row.data, function(x) {
- return x.totalEventSizeinBytes;
- });
- return {
- numEvents: sum,
- totalEventSizeinBytes: totalEventSizeinBytes
- };
- };
- table.tableColumns = columns;
- table.sortColumnIndex = 1;
- table.sortDescending = true;
- table.selectionMode = tr.ui.b.TableFormat.SelectionMode.ROW;
-
- table.groupBy = this.$.picker.currentGroups.map(function(group) {
- return group.dataFn;
- });
-
- if (!this.model) {
- table.dataToGroup = [];
- } else {
- table.dataToGroup = this.model.stats.allTraceEventStats;
- }
- this.$.table.rebuild();
- }
- });
-})();
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/side_panel/file_size_stats_side_panel_test.html b/chromium/third_party/catapult/tracing/tracing/ui/side_panel/file_size_stats_side_panel_test.html
deleted file mode 100644
index 75c389c83c2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/side_panel/file_size_stats_side_panel_test.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/side_panel/file_size_stats_side_panel.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var TestUtils = tr.c.TestUtils;
-
- function createModel(opt_customizeModelCallback) {
- return TestUtils.newModel(function(model) {
- var modelStats = model.stats;
- modelStats.willProcessBasicTraceEvent('X', 'cat1', 'title1');
- modelStats.willProcessBasicTraceEvent('X', 'cat1', 'title1');
- modelStats.willProcessBasicTraceEvent('X', 'cat2', 'title1');
- modelStats.willProcessBasicTraceEvent('X', 'cat2', 'title3');
- modelStats.willProcessBasicTraceEvent('Y', 'cat3', 'title3');
- });
- }
-
- test('instantiate', function() {
- var panel = document.createElement('tr-ui-sp-file-size-stats-side-panel');
- panel.model = createModel();
- panel.style.height = '200px';
- this.addHTMLOutput(panel);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/side_panel/metrics_side_panel.html b/chromium/third_party/catapult/tracing/tracing/ui/side_panel/metrics_side_panel.html
deleted file mode 100644
index 724ca970eac..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/side_panel/metrics_side_panel.html
+++ /dev/null
@@ -1,208 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/raf.html">
-<link rel="import" href="/tracing/metrics/metric_registry.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/side_panel/side_panel.html">
-<link rel="import" href="/tracing/value/ui/value_set_table.html">
-<link rel="import" href="/tracing/value/ui/value_set_view.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<polymer-element name='tr-ui-sp-metrics-side-panel'
- extends='tr-ui-side-panel'>
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
- </style>
-
- <top-left-controls id="top_left_controls"></top-left-controls>
- <tr-v-ui-value-set-view id="results"></tr-v-ui-value-set-view>
- </template>
-</polymer-element>
-
-<script>
-'use strict';
-tr.exportTo('tr.ui', function() {
- Polymer('tr-ui-sp-metrics-side-panel', {
- ready: function() {
- this.model_ = undefined;
-
- this.rangeOfInterest_ = undefined;
- this.metricLatenciesMs_ = [];
-
- this.metrics_ = [];
- tr.metrics.MetricRegistry.getAllRegisteredTypeInfos().forEach(
- function(m) {
- if (m.constructor.name === 'sampleMetric')
- return;
- this.metrics_.push({
- label: m.constructor.name,
- value: m.constructor.name
- });
- }, this);
-
- this.settingsKey_ = 'metrics-side-panel-metric-name';
- this.currentMetricName_ = 'systemHealthMetrics';
- var metricSelector = tr.ui.b.createSelector(
- this, 'currentMetricName_',
- this.settingsKey_,
- this.currentMetricName_,
- this.metrics_);
- this.$.top_left_controls.appendChild(metricSelector);
- metricSelector.addEventListener('change',
- this.onMetricChange_.bind(this));
- this.currentMetricTypeInfo_ =
- tr.metrics.MetricRegistry.findTypeInfoWithName(
- this.currentMetricName_);
-
- this.recomputeButton_ = tr.ui.b.createButton(
- 'Recompute', this.onRecompute_, this);
- this.$.top_left_controls.appendChild(this.recomputeButton_);
- },
-
- /**
- * Return an estimate of how many milliseconds it would take to re-run the
- * metric. If the metric has not been run, return undefined.
- *
- * @return {undefined|number}
- */
- get metricLatencyMs() {
- return tr.b.Statistics.mean(this.metricLatenciesMs_);
- },
-
- onMetricChange_: function() {
- this.currentMetricTypeInfo_ =
- tr.metrics.MetricRegistry.findTypeInfoWithName(
- this.currentMetricName_);
- this.metricLatenciesMs_ = [];
- this.updateContents_();
- },
-
- onRecompute_: function() {
- this.updateContents_();
- },
-
- get textLabel() {
- return 'Metrics';
- },
-
- supportsModel: function(m) {
- if (!m) {
- return {
- supported: false,
- reason: 'No model available'
- };
- }
-
- return {
- supported: true
- };
- },
-
- get model() {
- return this.model_;
- },
-
- set model(model) {
- this.model_ = model;
- this.updateContents_();
- },
-
- get selection() {
- // Not applicable to metrics.
- },
-
- set selection(_) {
- // Not applicable to metrics.
- },
-
- /**
- * @return {undefined|!tr.b.Range}
- */
- get rangeOfInterest() {
- return this.rangeOfInterest_;
- },
-
- /**
- * This may be called rapidly as the mouse is moved.
- * If the metric supportsRangeOfInterest and takes less than 100ms, then it
- * will be re-run immediately; otherwise, the Recompute button will be
- * enabled.
- *
- * @param {!tr.b.Range} range
- */
- set rangeOfInterest(range) {
- this.rangeOfInterest_ = range;
-
- if (this.currentMetricTypeInfo_ &&
- this.currentMetricTypeInfo_.metadata.supportsRangeOfInterest) {
- if ((this.metricLatencyMs === undefined) ||
- (this.metricLatencyMs < 100)) {
- this.updateContents_();
- } else {
- this.recomputeButton_.style.background = 'red';
- }
- }
- },
-
- updateContents_: function() {
- this.style.width = '';
- tr.b.requestAnimationFrame(function() {
- var width = this.$.results.getBoundingClientRect().width + 15;
- this.style.width = width + 'px';
- }, this);
-
- if (!this.model_) {
- this.$.results.values = new tr.v.ValueSet([
- new tr.v.FailureValue('missing', {
- description: 'Missing model',
- stack: ''
- })
- ]);
- return;
- }
-
- var values = new tr.v.ValueSet();
- var options = {};
-
- if (this.currentMetricTypeInfo_ &&
- this.currentMetricTypeInfo_.metadata.supportsRangeOfInterest &&
- this.rangeOfInterest &&
- !this.rangeOfInterest.isEmpty)
- options.rangeOfInterest = this.rangeOfInterest;
-
- var startDate = new Date();
- try {
- this.currentMetricTypeInfo_.constructor(values, this.model_, options);
- } catch (err) {
- console.error(err.stack);
- this.$.results.values = new tr.v.ValueSet([
- new tr.v.FailureValue('error', {
- description: err.message,
- stack: err.stack
- })
- ]);
- return;
- }
-
- this.metricLatenciesMs_.push(new Date() - startDate);
- while (this.metricLatenciesMs_.length > 20)
- this.metricLatenciesMs_.shift();
-
- this.recomputeButton_.style.background = '';
- this.$.results.values = values;
- }
- });
-
- return {};
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/side_panel/side_panel.html b/chromium/third_party/catapult/tracing/tracing/ui/side_panel/side_panel.html
deleted file mode 100644
index 1fc54ed4f0e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/side_panel/side_panel.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<polymer-element name='tr-ui-side-panel'>
- <template>
- <style>
- :host {
- overflow: auto;
- }
- </style>
- </template>
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- },
-
- get rangeOfInterest() {
- throw new Error('Not implemented');
- },
-
- set rangeOfInterest(rangeOfInterest) {
- throw new Error('Not implemented');
- },
-
- get selection() {
- throw new Error('Not implemented');
- },
-
- set selection(selection) {
- throw new Error('Not implemented');
- },
-
- get model() {
- throw new Error('Not implemented');
- },
-
- set model(model) {
- throw new Error('Not implemented');
- },
-
- supportsModel: function(m) {
- throw new Error('Not implemented');
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/side_panel/side_panel_container.html b/chromium/third_party/catapult/tracing/tracing/ui/side_panel/side_panel_container.html
deleted file mode 100644
index 0f3b5219ef6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/side_panel/side_panel_container.html
+++ /dev/null
@@ -1,252 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel='import' href='/tracing/ui/base/polymer_utils.html'>
-<link rel="import" href="/tracing/ui/side_panel/side_panel.html">
-
-<polymer-element name='tr-ui-side-panel-container' is='HTMLUnknownElement'>
- <template>
- <style>
- :host {
- align-items: stretch;
- display: -webkit-flex;
- background-color: white;
- }
-
- :host([expanded]) > active-panel-container {
- -webkit-flex: 1 1 auto;
- border-left: 1px solid black;
- display: -webkit-flex;
- }
-
- :host(:not([expanded])) > active-panel-container {
- display: none;
- }
-
- active-panel-container {
- display: flex;
- }
-
- tab-strip {
- -webkit-flex: 0 0 auto;
- -webkit-flex-direction: column;
- -webkit-user-select: none;
- background-color: rgb(236, 236, 236);
- border-left: 1px solid black;
- cursor: default;
- display: -webkit-flex;
- min-width: 18px; /* workaround for flexbox and writing-mode mixing bug */
- padding: 10px 0 10px 0;
- font-size: 12px;
- }
-
- tab-strip > tab-strip-label {
- -webkit-writing-mode: vertical-rl;
- display: inline;
- margin-right: 1px;
- min-height: 20px;
- padding: 15px 3px 15px 1px;
- }
-
- tab-strip >
- tab-strip-label:not([enabled]) {
- color: rgb(128, 128, 128);
- }
-
- tab-strip > tab-strip-label[selected] {
- background-color: white;
- border: 1px solid rgb(163, 163, 163);
- border-left: none;
- padding: 14px 2px 14px 1px;
- }
- </style>
-
- <active-panel-container id='active_panel_container'>
- <tr-ui-b-drag-handle id="side_panel_drag_handle"></tr-ui-b-drag-handle>
- </active-panel-container>
- <tab-strip id='tab_strip'></tab-strip>
- </template>
-
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.activePanelContainer_ = this.$.active_panel_container;
- this.tabStrip_ = this.$.tab_strip;
-
- this.dragHandle_ = this.$.side_panel_drag_handle;
- this.dragHandle_.horizontal = false;
- this.rangeOfInterest_ = new tr.b.Range();
- this.brushingStateController_ = undefined;
- this.onSelectionChanged_ = this.onSelectionChanged_.bind(this);
- this.onModelChanged_ = this.onModelChanged_.bind(this);
- },
-
- get brushingStateController() {
- return this.brushingStateController_;
- },
-
- set brushingStateController(brushingStateController) {
- if (this.brushingStateController) {
- this.brushingStateController_.removeEventListener(
- 'change', this.onSelectionChanged_);
- this.brushingStateController_.removeEventListener(
- 'model-changed', this.onModelChanged_);
- }
- this.brushingStateController_ = brushingStateController;
- if (this.brushingStateController) {
- this.brushingStateController_.addEventListener(
- 'change', this.onSelectionChanged_);
- this.brushingStateController_.addEventListener(
- 'model-changed', this.onModelChanged_);
- }
- },
-
- get selection() {
- return this.brushingStateController_.selection;
- },
-
- onSelectionChanged_: function() {
- if (this.activePanel)
- this.activePanel.selection = this.selection;
- },
-
- get model() {
- return this.brushingStateController_.model;
- },
-
- onModelChanged_: function() {
- this.activePanelType_ = undefined;
- this.updateContents_();
- },
-
- get expanded() {
- this.hasAttribute('expanded');
- },
-
- get activePanel() {
- if (this.activePanelContainer_.children.length < 2)
- return undefined;
- return this.activePanelContainer_.children[1];
- },
-
- get activePanelType() {
- return this.activePanelType_;
- },
-
- set activePanelType(panelType) {
- if (this.model === undefined)
- throw new Error('Cannot activate panel without a model');
-
- var panel = undefined;
- if (panelType)
- panel = document.createElement(panelType);
-
- if (panel !== undefined && !panel.supportsModel(this.model))
- throw new Error('Cannot activate panel: does not support this model');
-
- if (this.activePanelType) {
- this.getLabelElementForPanelType_(
- this.activePanelType).removeAttribute('selected');
- }
-
- if (this.activePanel)
- this.activePanelContainer_.removeChild(this.activePanel);
-
- if (panelType === undefined) {
- this.removeAttribute('expanded');
- this.activePanelType_ = undefined;
- return;
- }
-
- this.getLabelElementForPanelType_(panelType).
- setAttribute('selected', true);
- this.setAttribute('expanded', true);
-
- this.activePanelContainer_.appendChild(panel);
- this.dragHandle_.target = panel;
- panel.rangeOfInterest = this.rangeOfInterest_;
- panel.selection = this.selection_;
- panel.model = this.model;
-
- this.activePanelType_ = panelType;
- },
-
- getPanelTypeForConstructor_: function(constructor) {
- for (var i = 0; i < this.tabStrip_.children.length; i++) {
- if (this.tabStrip_.children[i].panelType.constructor == constructor)
- return this.tabStrip_.children[i].panelType;
- }
- },
-
- getLabelElementForPanelType_: function(panelType) {
- for (var i = 0; i < this.tabStrip_.children.length; i++) {
- if (this.tabStrip_.children[i].panelType == panelType)
- return this.tabStrip_.children[i];
- }
- return undefined;
- },
-
- updateContents_: function() {
- var previouslyActivePanelType = this.activePanelType;
-
- this.tabStrip_.textContent = '';
- var supportedPanelTypes = [];
-
- var panelTypes =
- tr.ui.b.getPolymerElementsThatSubclass('tr-ui-side-panel');
- panelTypes.forEach(function(panelType) {
- var labelEl = document.createElement('tab-strip-label');
- var panel = document.createElement(panelType);
-
- labelEl.textContent = panel.textLabel;
- labelEl.panelType = panelType;
-
- var supported = panel.supportsModel(this.model);
- if (this.model && supported.supported) {
- supportedPanelTypes.push(panelType);
- labelEl.setAttribute('enabled', true);
- labelEl.addEventListener('click', function() {
- this.activePanelType =
- this.activePanelType === panelType ? undefined : panelType;
- }.bind(this));
- } else {
- labelEl.title = 'Not supported for the current trace: ' +
- supported.reason;
- labelEl.style.display = 'none';
- }
- this.tabStrip_.appendChild(labelEl);
- }, this);
-
- // Restore the active panel, or collapse
- if (previouslyActivePanelType &&
- supportedPanelTypes.indexOf(previouslyActivePanelType) != -1) {
- this.activePanelType = previouslyActivePanelType;
- this.setAttribute('expanded', true);
- } else {
- if (this.activePanel)
- this.activePanelContainer_.removeChild(this.activePanel);
- this.removeAttribute('expanded');
- }
- },
-
- get rangeOfInterest() {
- return this.rangeOfInterest_;
- },
-
- set rangeOfInterest(range) {
- if (range == undefined)
- throw new Error('Must not be undefined');
- this.rangeOfInterest_ = range;
- if (this.activePanel)
- this.activePanel.rangeOfInterest = range;
- }
- });
- </script>
-</polymer-element>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/side_panel/side_panel_container_test.html b/chromium/third_party/catapult/tracing/tracing/ui/side_panel/side_panel_container_test.html
deleted file mode 100644
index 8dc296c336a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/side_panel/side_panel_container_test.html
+++ /dev/null
@@ -1,58 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/extras/side_panel/time_summary_side_panel.html">
-<link rel="import" href="/tracing/ui/side_panel/side_panel.html">
-<link rel="import" href="/tracing/ui/side_panel/side_panel_container.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function FakeBrushingStateController() {
- this.addAllEventsMatchingFilterToSelectionReturnValue = [];
-
- this.viewport = undefined;
- this.model = undefined;
- this.selection = new tr.model.EventSet();
- this.highlight = new tr.model.EventSet();
- }
-
- FakeBrushingStateController.prototype = {
- addEventListener: function(name, cb) {
- }
- };
-
- function createModel() {
- var m = tr.c.TestUtils.newModelWithEvents([], {
- shiftWorldToZero: false,
- pruneContainers: false,
- customizeModelCallback: function(m) {
- var browserProcess = m.getOrCreateProcess(1);
- var browserMain = browserProcess.getOrCreateThread(2);
- browserMain.sliceGroup.beginSlice('cat', 'Task', 0);
- browserMain.sliceGroup.endSlice(10);
- browserMain.sliceGroup.beginSlice('cat', 'Task', 20);
- browserMain.sliceGroup.endSlice(30);
- }
- });
- return m;
- }
-
- test('instantiateCollapsed', function() {
- var brushingStateController = new FakeBrushingStateController();
- brushingStateController.model = createModel();
-
- var container = document.createElement('tr-ui-side-panel-container');
- container.brushingStateController = brushingStateController;
- this.addHTMLOutput(container);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform.html b/chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform.html
deleted file mode 100644
index 49c10e29123..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform.html
+++ /dev/null
@@ -1,118 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/utils.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui', function() {
- function TimelineDisplayTransform(opt_that) {
- if (opt_that) {
- this.set(opt_that);
- return;
- }
- this.scaleX = 1;
- this.panX = 0;
- this.panY = 0;
- }
-
- TimelineDisplayTransform.prototype = {
- set: function(that) {
- this.scaleX = that.scaleX;
- this.panX = that.panX;
- this.panY = that.panY;
- },
-
- clone: function() {
- return new TimelineDisplayTransform(this);
- },
-
- equals: function(that) {
- var eq = true;
- if (that === undefined || that === null)
- return false;
- eq &= this.panX === that.panX;
- eq &= this.panY === that.panY;
- eq &= this.scaleX === that.scaleX;
- return !!eq;
- },
-
- almostEquals: function(that) {
- var eq = true;
- if (that === undefined || that === null)
- return false;
- eq &= Math.abs(this.panX - that.panX) < 0.001;
- eq &= Math.abs(this.panY - that.panY) < 0.001;
- eq &= Math.abs(this.scaleX - that.scaleX) < 0.001;
- return !!eq;
- },
-
- incrementPanXInViewUnits: function(xDeltaView) {
- this.panX += this.xViewVectorToWorld(xDeltaView);
- },
-
- xPanWorldPosToViewPos: function(worldX, viewX, viewWidth) {
- if (typeof viewX == 'string') {
- if (viewX === 'left') {
- viewX = 0;
- } else if (viewX === 'center') {
- viewX = viewWidth / 2;
- } else if (viewX === 'right') {
- viewX = viewWidth - 1;
- } else {
- throw new Error('viewX must be left|center|right or number.');
- }
- }
- this.panX = (viewX / this.scaleX) - worldX;
- },
-
- xPanWorldBoundsIntoView: function(worldMin, worldMax, viewWidth) {
- if (this.xWorldToView(worldMin) < 0)
- this.xPanWorldPosToViewPos(worldMin, 'left', viewWidth);
- else if (this.xWorldToView(worldMax) > viewWidth)
- this.xPanWorldPosToViewPos(worldMax, 'right', viewWidth);
- },
-
- xSetWorldBounds: function(worldMin, worldMax, viewWidth) {
- var worldWidth = worldMax - worldMin;
- var scaleX = viewWidth / worldWidth;
- var panX = -worldMin;
- this.setPanAndScale(panX, scaleX);
- },
-
- setPanAndScale: function(p, s) {
- this.scaleX = s;
- this.panX = p;
- },
-
- xWorldToView: function(x) {
- return (x + this.panX) * this.scaleX;
- },
-
- xWorldVectorToView: function(x) {
- return x * this.scaleX;
- },
-
- xViewToWorld: function(x) {
- return (x / this.scaleX) - this.panX;
- },
-
- xViewVectorToWorld: function(x) {
- return x / this.scaleX;
- },
-
- applyTransformToCanvas: function(ctx) {
- ctx.transform(this.scaleX, 0, 0, 1, this.panX * this.scaleX, 0);
- }
- };
-
- return {
- TimelineDisplayTransform: TimelineDisplayTransform
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform_animations.html b/chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform_animations.html
deleted file mode 100644
index 7122d9ba51c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform_animations.html
+++ /dev/null
@@ -1,174 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/ui/base/animation.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui', function() {
- var kDefaultPanAnimationDurationMs = 100.0;
-
- /**
- * Pans a TimelineDisplayTransform by a given amount.
- * @constructor
- * @extends {tr.ui.b.Animation}
- * @param {Number} deltaX The total amount of change to the transform's panX.
- * @param {Number} deltaY The total amount of change to the transform's panY.
- * @param {Number=} opt_durationMs How long the pan animation should run.
- * Defaults to kDefaultPanAnimationDurationMs.
- */
- function TimelineDisplayTransformPanAnimation(
- deltaX, deltaY, opt_durationMs) {
- this.deltaX = deltaX;
- this.deltaY = deltaY;
- if (opt_durationMs === undefined)
- this.durationMs = kDefaultPanAnimationDurationMs;
- else
- this.durationMs = opt_durationMs;
-
- this.startPanX = undefined;
- this.startPanY = undefined;
- this.startTimeMs = undefined;
- }
-
- TimelineDisplayTransformPanAnimation.prototype = {
- __proto__: tr.ui.b.Animation.prototype,
-
- get affectsPanY() {
- return this.deltaY !== 0;
- },
-
- canTakeOverFor: function(existingAnimation) {
- return existingAnimation instanceof TimelineDisplayTransformPanAnimation;
- },
-
- takeOverFor: function(existing, timestamp, target) {
- var remainingDeltaXOnExisting = existing.goalPanX - target.panX;
- var remainingDeltaYOnExisting = existing.goalPanY - target.panY;
- var remainingTimeOnExisting = timestamp - (
- existing.startTimeMs + existing.durationMs);
- remainingTimeOnExisting = Math.max(remainingTimeOnExisting, 0);
-
- this.deltaX += remainingDeltaXOnExisting;
- this.deltaY += remainingDeltaYOnExisting;
- this.durationMs += remainingTimeOnExisting;
- },
-
- start: function(timestamp, target) {
- this.startTimeMs = timestamp;
- this.startPanX = target.panX;
- this.startPanY = target.panY;
- },
-
- tick: function(timestamp, target) {
- var percentDone = (timestamp - this.startTimeMs) / this.durationMs;
- percentDone = tr.b.clamp(percentDone, 0, 1);
-
- target.panX = tr.b.lerp(percentDone, this.startPanX, this.goalPanX);
- if (this.affectsPanY)
- target.panY = tr.b.lerp(percentDone, this.startPanY, this.goalPanY);
- return timestamp >= this.startTimeMs + this.durationMs;
- },
-
- get goalPanX() {
- return this.startPanX + this.deltaX;
- },
-
- get goalPanY() {
- return this.startPanY + this.deltaY;
- }
- };
-
- /**
- * Zooms in/out on a specified location in the world.
- *
- * Zooming in and out is all about keeping the area under the mouse cursor,
- * here called the "focal point" in the same place under the zoom. If one
- * simply changes the scale, the area under the mouse cursor will change. To
- * keep the focal point from moving during the zoom, the pan needs to change
- * in order to compensate. Thus, a ZoomTo animation is given both a focal
- * point in addition to the amount by which to zoom.
- *
- * @constructor
- * @extends {tr.ui.b.Animation}
- * @param {Number} goalFocalPointXWorld The X coordinate in the world which is
- * of interest.
- * @param {Number} goalFocalPointXView Where on the screen the
- * goalFocalPointXWorld should stay centered during the zoom.
- * @param {Number} goalFocalPointY Where the panY should be when the zoom
- * completes.
- * @param {Number} zoomInRatioX The ratio of the current scaleX to the goal
- * scaleX.
- */
- function TimelineDisplayTransformZoomToAnimation(
- goalFocalPointXWorld,
- goalFocalPointXView,
- goalFocalPointY,
- zoomInRatioX,
- opt_durationMs) {
- this.goalFocalPointXWorld = goalFocalPointXWorld;
- this.goalFocalPointXView = goalFocalPointXView;
- this.goalFocalPointY = goalFocalPointY;
- this.zoomInRatioX = zoomInRatioX;
- if (opt_durationMs === undefined)
- this.durationMs = kDefaultPanAnimationDurationMs;
- else
- this.durationMs = opt_durationMs;
-
- this.startTimeMs = undefined;
- this.startScaleX = undefined;
- this.goalScaleX = undefined;
- this.startPanY = undefined;
- }
-
- TimelineDisplayTransformZoomToAnimation.prototype = {
- __proto__: tr.ui.b.Animation.prototype,
-
- get affectsPanY() {
- return this.startPanY != this.goalFocalPointY;
- },
-
- canTakeOverFor: function(existingAnimation) {
- return false;
- },
-
- takeOverFor: function(existingAnimation, timestamp, target) {
- this.goalScaleX = target.scaleX * this.zoomInRatioX;
- },
-
- start: function(timestamp, target) {
- this.startTimeMs = timestamp;
- this.startScaleX = target.scaleX;
- this.goalScaleX = this.zoomInRatioX * target.scaleX;
- this.startPanY = target.panY;
- },
-
- tick: function(timestamp, target) {
- var percentDone = (timestamp - this.startTimeMs) / this.durationMs;
- percentDone = tr.b.clamp(percentDone, 0, 1);
-
- target.scaleX = tr.b.lerp(percentDone, this.startScaleX, this.goalScaleX);
- if (this.affectsPanY) {
- target.panY = tr.b.lerp(
- percentDone, this.startPanY, this.goalFocalPointY);
- }
-
- target.xPanWorldPosToViewPos(
- this.goalFocalPointXWorld, this.goalFocalPointXView);
- return timestamp >= this.startTimeMs + this.durationMs;
- }
- };
-
- return {
- TimelineDisplayTransformPanAnimation:
- TimelineDisplayTransformPanAnimation,
- TimelineDisplayTransformZoomToAnimation:
- TimelineDisplayTransformZoomToAnimation
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform_animations_test.html b/chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform_animations_test.html
deleted file mode 100644
index 99ca6bd8b20..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform_animations_test.html
+++ /dev/null
@@ -1,85 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/animation_controller.html">
-<link rel="import" href="/tracing/ui/timeline_display_transform.html">
-<link rel="import" href="/tracing/ui/timeline_display_transform_animations.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var TimelineDisplayTransform = tr.ui.TimelineDisplayTransform;
- var TimelineDisplayTransformPanAnimation =
- tr.ui.TimelineDisplayTransformPanAnimation;
- var TimelineDisplayTransformZoomToAnimation =
- tr.ui.TimelineDisplayTransformZoomToAnimation;
-
- test('panBasic', function() {
- var target = new TimelineDisplayTransform();
- target.cloneAnimationState = function() {
- return this.clone();
- };
-
- var a = new TimelineDisplayTransformPanAnimation(10, 20, 100);
-
- var controller = new tr.ui.b.AnimationController();
- controller.target = target;
- controller.queueAnimation(a, 0);
-
- assert.isTrue(a.affectsPanY);
- tr.b.forcePendingRAFTasksToRun(50);
- assert.isAbove(target.panX, 0);
- tr.b.forcePendingRAFTasksToRun(100);
- assert.isFalse(controller.hasActiveAnimation);
- assert.equal(target.panX, 10);
- assert.equal(target.panY, 20);
- });
-
- test('zoomBasic', function() {
- var target = new TimelineDisplayTransform();
- target.panY = 30;
- target.cloneAnimationState = function() {
- return this.clone();
- };
-
- var a = new TimelineDisplayTransformZoomToAnimation(10, 20, 30, 5, 100);
-
- var controller = new tr.ui.b.AnimationController();
- controller.target = target;
- controller.queueAnimation(a, 0);
-
- assert.isFalse(a.affectsPanY);
- tr.b.forcePendingRAFTasksToRun(100);
- assert.equal(target.scaleX, 5);
- });
-
- test('panTakeover', function() {
- var target = new TimelineDisplayTransform();
- target.cloneAnimationState = function() {
- return this.clone();
- };
-
- var b = new TimelineDisplayTransformPanAnimation(10, 0, 100);
- var a = new TimelineDisplayTransformPanAnimation(10, 0, 100);
-
- var controller = new tr.ui.b.AnimationController();
- controller.target = target;
- controller.queueAnimation(a, 0);
-
- tr.b.forcePendingRAFTasksToRun(50);
- controller.queueAnimation(b, 50);
-
- tr.b.forcePendingRAFTasksToRun(100);
- assert.isTrue(controller.hasActiveAnimation);
-
- tr.b.forcePendingRAFTasksToRun(150);
- assert.isFalse(controller.hasActiveAnimation);
- assert.equal(target.panX, 20);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform_test.html b/chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform_test.html
deleted file mode 100644
index 65a9c859909..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/timeline_display_transform_test.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/timeline_display_transform.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var TimelineDisplayTransform = tr.ui.TimelineDisplayTransform;
-
- test('basics', function() {
- var a = new TimelineDisplayTransform();
- a.panX = 0;
- a.panY = 0;
- a.scaleX = 1;
-
- var b = new TimelineDisplayTransform();
- b.panX = 10;
- b.panY = 0;
- b.scaleX = 1;
-
- assert.isFalse(a.equals(b));
- assert.isFalse(a.almostEquals(b));
-
- var c = b.clone();
- assert.isTrue(b.equals(c));
- assert.isTrue(b.almostEquals(c));
-
- c.set(a);
- assert.isTrue(a.equals(c));
- assert.isTrue(a.almostEquals(c));
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/timeline_interest_range.html b/chromium/third_party/catapult/tracing/tracing/ui/timeline_interest_range.html
deleted file mode 100644
index 240104d6322..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/timeline_interest_range.html
+++ /dev/null
@@ -1,248 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui', function() {
- /**
- * @constructor
- */
- function SnapIndicator(y, height) {
- this.y = y;
- this.height = height;
- }
-
- /**
- * The interesting part of the world.
- *
- * @constructor
- */
- function TimelineInterestRange(vp) {
- this.viewport_ = vp;
-
- this.range_ = new tr.b.Range();
-
- this.leftSelected_ = false;
- this.rightSelected_ = false;
-
- this.leftSnapIndicator_ = undefined;
- this.rightSnapIndicator_ = undefined;
- }
-
- TimelineInterestRange.prototype = {
- get isEmpty() {
- return this.range_.isEmpty;
- },
-
- reset: function() {
- this.range_.reset();
- this.leftSelected_ = false;
- this.rightSelected_ = false;
- this.leftSnapIndicator_ = undefined;
- this.rightSnapIndicator_ = undefined;
- this.viewport_.dispatchChangeEvent();
- },
-
- get min() {
- return this.range_.min;
- },
-
- set min(min) {
- this.range_.min = min;
- this.viewport_.dispatchChangeEvent();
- },
-
- get max() {
- return this.range_.max;
- },
-
- set max(max) {
- this.range_.max = max;
- this.viewport_.dispatchChangeEvent();
- },
-
- set: function(range) {
- this.range_.reset();
- this.range_.addRange(range);
- this.viewport_.dispatchChangeEvent();
- },
-
- setMinAndMax: function(min, max) {
- this.range_.min = min;
- this.range_.max = max;
- this.viewport_.dispatchChangeEvent();
- },
-
- get range() {
- return this.range_.range;
- },
-
- asRangeObject: function() {
- var range = new tr.b.Range();
- range.addRange(this.range_);
- return range;
- },
-
- get leftSelected() {
- return this.leftSelected_;
- },
-
- set leftSelected(leftSelected) {
- if (this.leftSelected_ == leftSelected)
- return;
- this.leftSelected_ = leftSelected;
- this.viewport_.dispatchChangeEvent();
- },
-
- get rightSelected() {
- return this.rightSelected_;
- },
-
- set rightSelected(rightSelected) {
- if (this.rightSelected_ == rightSelected)
- return;
- this.rightSelected_ = rightSelected;
- this.viewport_.dispatchChangeEvent();
- },
-
- get leftSnapIndicator() {
- return this.leftSnapIndicator_;
- },
-
- set leftSnapIndicator(leftSnapIndicator) {
- this.leftSnapIndicator_ = leftSnapIndicator;
- this.viewport_.dispatchChangeEvent();
- },
-
- get rightSnapIndicator() {
- return this.rightSnapIndicator_;
- },
-
- set rightSnapIndicator(rightSnapIndicator) {
- this.rightSnapIndicator_ = rightSnapIndicator;
- this.viewport_.dispatchChangeEvent();
- },
-
- draw: function(ctx, viewLWorld, viewRWorld) {
- if (this.range_.isEmpty)
- return;
- var dt = this.viewport_.currentDisplayTransform;
-
- var markerLWorld = this.min;
- var markerRWorld = this.max;
-
- var markerLView = Math.round(dt.xWorldToView(markerLWorld));
- var markerRView = Math.round(dt.xWorldToView(markerRWorld));
-
- ctx.fillStyle = 'rgba(0, 0, 0, 0.2)';
- if (markerLWorld > viewLWorld) {
- ctx.fillRect(dt.xWorldToView(viewLWorld), 0,
- markerLView, ctx.canvas.height);
- }
-
- if (markerRWorld < viewRWorld) {
- ctx.fillRect(markerRView, 0,
- dt.xWorldToView(viewRWorld), ctx.canvas.height);
- }
-
- var pixelRatio = window.devicePixelRatio || 1;
- ctx.lineWidth = Math.round(pixelRatio);
- if (this.range_.range > 0) {
- this.drawLine_(ctx, viewLWorld, viewRWorld,
- ctx.canvas.height, this.min, this.leftSelected_);
- this.drawLine_(ctx, viewLWorld, viewRWorld,
- ctx.canvas.height, this.max, this.rightSelected_);
- } else {
- this.drawLine_(ctx, viewLWorld, viewRWorld,
- ctx.canvas.height, this.min,
- this.leftSelected_ || this.rightSelected_);
- }
- ctx.lineWidth = 1;
- },
-
- drawLine_: function(ctx, viewLWorld, viewRWorld, height, ts, selected) {
- if (ts < viewLWorld || ts >= viewRWorld)
- return;
-
- var dt = this.viewport_.currentDisplayTransform;
- var viewX = Math.round(dt.xWorldToView(ts));
-
- // Apply subpixel translate to get crisp lines.
- // http://www.mobtowers.com/html5-canvas-crisp-lines-every-time/
- ctx.save();
- ctx.translate((Math.round(ctx.lineWidth) % 2) / 2, 0);
-
- ctx.beginPath();
- tr.ui.b.drawLine(ctx, viewX, 0, viewX, height);
- if (selected)
- ctx.strokeStyle = 'rgb(255, 0, 0)';
- else
- ctx.strokeStyle = 'rgb(0, 0, 0)';
- ctx.stroke();
-
- ctx.restore();
- },
-
- drawIndicators: function(ctx, viewLWorld, viewRWorld) {
- if (this.leftSnapIndicator_) {
- this.drawIndicator_(ctx, viewLWorld, viewRWorld,
- this.range_.min,
- this.leftSnapIndicator_,
- this.leftSelected_);
- }
- if (this.rightSnapIndicator_) {
- this.drawIndicator_(ctx, viewLWorld, viewRWorld,
- this.range_.max,
- this.rightSnapIndicator_,
- this.rightSelected_);
- }
- },
-
- drawIndicator_: function(ctx, viewLWorld, viewRWorld,
- xWorld, si, selected) {
- var dt = this.viewport_.currentDisplayTransform;
-
- var viewX = Math.round(dt.xWorldToView(xWorld));
-
- // Apply subpixel translate to get crisp lines.
- // http://www.mobtowers.com/html5-canvas-crisp-lines-every-time/
- ctx.save();
- ctx.translate((Math.round(ctx.lineWidth) % 2) / 2, 0);
-
- var pixelRatio = window.devicePixelRatio || 1;
- var viewY = si.y * devicePixelRatio;
- var viewHeight = si.height * devicePixelRatio;
- var arrowSize = 4 * pixelRatio;
-
- if (selected)
- ctx.fillStyle = 'rgb(255, 0, 0)';
- else
- ctx.fillStyle = 'rgb(0, 0, 0)';
- tr.ui.b.drawTriangle(ctx,
- viewX - arrowSize * 0.75, viewY,
- viewX + arrowSize * 0.75, viewY,
- viewX, viewY + arrowSize);
- ctx.fill();
- tr.ui.b.drawTriangle(ctx,
- viewX - arrowSize * 0.75, viewY + viewHeight,
- viewX + arrowSize * 0.75, viewY + viewHeight,
- viewX, viewY + viewHeight - arrowSize);
- ctx.fill();
-
- ctx.restore();
- }
- };
-
- return {
- SnapIndicator: SnapIndicator,
- TimelineInterestRange: TimelineInterestRange
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/timeline_track_view.html b/chromium/third_party/catapult/tracing/tracing/ui/timeline_track_view.html
deleted file mode 100644
index 36454ffb9e3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/timeline_track_view.html
+++ /dev/null
@@ -1,1150 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/settings.html">
-<link rel="import" href="/tracing/base/task.html">
-<link rel="import" href="/tracing/core/filter.html">
-<link rel="import" href="/tracing/model/event.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/x_marker_annotation.html">
-<link rel="import" href="/tracing/ui/base/hotkey_controller.html">
-<link rel="import" href="/tracing/ui/base/mouse_mode_selector.html">
-<link rel="import" href="/tracing/ui/base/timing_tool.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/timeline_display_transform_animations.html">
-<link rel="import" href="/tracing/ui/timeline_viewport.html">
-<link rel="import" href="/tracing/ui/tracks/drawing_container.html">
-<link rel="import" href="/tracing/ui/tracks/model_track.html">
-<link rel="import" href="/tracing/ui/tracks/ruler_track.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<!--
- Interactive visualizaiton of Model objects based loosely on gantt charts.
- Each thread in the Model is given a set of Tracks, one per subrow in the
- thread. The TimelineTrackView class acts as a controller, creating the
- individual tracks, while Tracks do actual drawing.
-
- Visually, the TimelineTrackView produces (prettier) visualizations like the
- following:
- Thread1: AAAAAAAAAA AAAAA
- BBBB BB
- Thread2: CCCCCC CCCCC
--->
-<polymer-element name='tr-ui-timeline-track-view'>
- <template>
- <style>
- :host {
- -webkit-box-orient: vertical;
- display: -webkit-box;
- position: relative;
- }
-
- :host ::content * {
- -webkit-user-select: none;
- cursor: default;
- }
-
- #drag_box {
- background-color: rgba(0, 0, 255, 0.25);
- border: 1px solid rgb(0, 0, 96);
- font-size: 75%;
- position: fixed;
- }
-
- #hint_text {
- position: absolute;
- bottom: 6px;
- right: 6px;
- font-size: 8pt;
- }
- </style>
- <content></content>
-
- <div id='drag_box'></div>
- <div id='hint_text'></div>
-
- <tv-ui-b-hotkey-controller id='hotkey_controller'>
- </tv-ui-b-hotkey-controller>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.displayTransform_ = new tr.ui.TimelineDisplayTransform();
- this.model_ = undefined;
-
- this.timelineView_ = undefined;
-
- this.viewport_ = new tr.ui.TimelineViewport(this);
- this.viewportDisplayTransformAtMouseDown_ = undefined;
- this.brushingStateController_ = undefined;
-
- this.rulerTrackContainer_ =
- new tr.ui.tracks.DrawingContainer(this.viewport_);
- this.appendChild(this.rulerTrackContainer_);
- this.rulerTrackContainer_.invalidate();
-
- this.rulerTrack_ = new tr.ui.tracks.RulerTrack(this.viewport_);
- this.rulerTrackContainer_.appendChild(this.rulerTrack_);
-
- this.upperModelTrack_ = new tr.ui.tracks.ModelTrack(this.viewport_);
- this.upperModelTrack_.upperMode = true;
- this.rulerTrackContainer_.appendChild(this.upperModelTrack_);
-
- this.modelTrackContainer_ =
- new tr.ui.tracks.DrawingContainer(this.viewport_);
- this.appendChild(this.modelTrackContainer_);
- this.modelTrackContainer_.style.display = 'block';
- this.modelTrackContainer_.invalidate();
-
- this.viewport_.modelTrackContainer = this.modelTrackContainer_;
-
- this.modelTrack_ = new tr.ui.tracks.ModelTrack(this.viewport_);
- this.modelTrackContainer_.appendChild(this.modelTrack_);
-
- this.timingTool_ = new tr.ui.b.TimingTool(this.viewport_, this);
-
- this.initMouseModeSelector();
-
- this.hideDragBox_();
-
- this.initHintText_();
-
- this.onSelectionChanged_ = this.onSelectionChanged_.bind(this);
-
- this.onDblClick_ = this.onDblClick_.bind(this);
- this.addEventListener('dblclick', this.onDblClick_);
-
- this.onMouseWheel_ = this.onMouseWheel_.bind(this);
- this.addEventListener('mousewheel', this.onMouseWheel_);
-
- this.onMouseDown_ = this.onMouseDown_.bind(this);
- this.addEventListener('mousedown', this.onMouseDown_);
-
- this.onMouseMove_ = this.onMouseMove_.bind(this);
- this.addEventListener('mousemove', this.onMouseMove_);
-
- this.onTouchStart_ = this.onTouchStart_.bind(this);
- this.addEventListener('touchstart', this.onTouchStart_);
-
- this.onTouchMove_ = this.onTouchMove_.bind(this);
- this.addEventListener('touchmove', this.onTouchMove_);
-
- this.onTouchEnd_ = this.onTouchEnd_.bind(this);
- this.addEventListener('touchend', this.onTouchEnd_);
-
-
- this.addHotKeys_();
-
- this.mouseViewPosAtMouseDown_ = {x: 0, y: 0};
- this.lastMouseViewPos_ = {x: 0, y: 0};
-
- this.lastTouchViewPositions_ = [];
-
- this.alert_ = undefined;
-
- this.isPanningAndScanning_ = false;
- this.isZooming_ = false;
- },
-
- initMouseModeSelector: function() {
- this.mouseModeSelector_ = document.createElement(
- 'tr-ui-b-mouse-mode-selector');
- this.mouseModeSelector_.targetElement = this;
- this.appendChild(this.mouseModeSelector_);
-
- this.mouseModeSelector_.addEventListener('beginpan',
- this.onBeginPanScan_.bind(this));
- this.mouseModeSelector_.addEventListener('updatepan',
- this.onUpdatePanScan_.bind(this));
- this.mouseModeSelector_.addEventListener('endpan',
- this.onEndPanScan_.bind(this));
-
- this.mouseModeSelector_.addEventListener('beginselection',
- this.onBeginSelection_.bind(this));
- this.mouseModeSelector_.addEventListener('updateselection',
- this.onUpdateSelection_.bind(this));
- this.mouseModeSelector_.addEventListener('endselection',
- this.onEndSelection_.bind(this));
-
- this.mouseModeSelector_.addEventListener('beginzoom',
- this.onBeginZoom_.bind(this));
- this.mouseModeSelector_.addEventListener('updatezoom',
- this.onUpdateZoom_.bind(this));
- this.mouseModeSelector_.addEventListener('endzoom',
- this.onEndZoom_.bind(this));
-
- this.mouseModeSelector_.addEventListener('entertiming',
- this.timingTool_.onEnterTiming.bind(this.timingTool_));
- this.mouseModeSelector_.addEventListener('begintiming',
- this.timingTool_.onBeginTiming.bind(this.timingTool_));
- this.mouseModeSelector_.addEventListener('updatetiming',
- this.timingTool_.onUpdateTiming.bind(this.timingTool_));
- this.mouseModeSelector_.addEventListener('endtiming',
- this.timingTool_.onEndTiming.bind(this.timingTool_));
- this.mouseModeSelector_.addEventListener('exittiming',
- this.timingTool_.onExitTiming.bind(this.timingTool_));
-
- var m = tr.ui.b.MOUSE_SELECTOR_MODE;
- this.mouseModeSelector_.supportedModeMask =
- m.SELECTION | m.PANSCAN | m.ZOOM | m.TIMING;
- this.mouseModeSelector_.settingsKey =
- 'timelineTrackView.mouseModeSelector';
- this.mouseModeSelector_.setKeyCodeForMode(m.PANSCAN, '2'.charCodeAt(0));
- this.mouseModeSelector_.setKeyCodeForMode(m.SELECTION, '1'.charCodeAt(0));
- this.mouseModeSelector_.setKeyCodeForMode(m.ZOOM, '3'.charCodeAt(0));
- this.mouseModeSelector_.setKeyCodeForMode(m.TIMING, '4'.charCodeAt(0));
-
- this.mouseModeSelector_.setModifierForAlternateMode(
- m.SELECTION, tr.ui.b.MODIFIER.SHIFT);
- this.mouseModeSelector_.setModifierForAlternateMode(
- m.PANSCAN, tr.ui.b.MODIFIER.SPACE);
- },
-
- get brushingStateController() {
- return this.brushingStateController_;
- },
-
- set brushingStateController(brushingStateController) {
- if (this.brushingStateController_) {
- this.brushingStateController_.removeEventListener('change',
- this.onSelectionChanged_);
- }
- this.brushingStateController_ = brushingStateController;
- if (this.brushingStateController_) {
- this.brushingStateController_.addEventListener('change',
- this.onSelectionChanged_);
- }
- },
-
- set timelineView(view) {
- this.timelineView_ = view;
- },
-
- onSelectionChanged_: function() {
- this.showHintText_('Press \'m\' to mark current selection');
- this.viewport_.dispatchChangeEvent();
- },
-
- set selection(selection) {
- throw new Error('DO NOT CALL THIS');
- },
-
- set highlight(highlight) {
- throw new Error('DO NOT CALL THIS');
- },
-
- detach: function() {
- this.modelTrack_.detach();
- this.upperModelTrack_.detach();
-
- this.viewport_.detach();
- },
-
- get viewport() {
- return this.viewport_;
- },
-
- get model() {
- return this.model_;
- },
-
- set model(model) {
- if (!model)
- throw new Error('Model cannot be undefined');
-
- var modelInstanceChanged = this.model_ !== model;
- this.model_ = model;
- this.modelTrack_.model = model;
- this.upperModelTrack_.model = model;
-
- // Set up a reasonable viewport.
- if (modelInstanceChanged)
- this.viewport_.setWhenPossible(this.setInitialViewport_.bind(this));
- },
-
- get hasVisibleContent() {
- return this.modelTrack_.hasVisibleContent ||
- this.upperModelTrack_.hasVisibleContent;
- },
-
- setInitialViewport_: function() {
- // We need the canvas size to be up-to-date at this point. We maybe in
- // here before the raf fires, so the size may have not been updated since
- // the canvas was resized.
- this.modelTrackContainer_.updateCanvasSizeIfNeeded_();
- var w = this.modelTrackContainer_.canvas.width;
-
- var min;
- var range;
-
- if (this.model_.bounds.isEmpty) {
- min = 0;
- range = 1000;
- } else if (this.model_.bounds.range === 0) {
- min = this.model_.bounds.min;
- range = 1000;
- } else {
- min = this.model_.bounds.min;
- range = this.model_.bounds.range;
- }
-
- var boost = range * 0.15;
- this.displayTransform_.set(this.viewport_.currentDisplayTransform);
- this.displayTransform_.xSetWorldBounds(
- min - boost, min + range + boost, w);
- this.viewport_.setDisplayTransformImmediately(this.displayTransform_);
- },
-
- /**
- * @param {Filter} filter The filter to use for finding matches.
- * @param {Selection} selection The selection to add matches to.
- * @return {Task} which performs the filtering.
- */
- addAllEventsMatchingFilterToSelectionAsTask: function(filter, selection) {
- var modelTrack = this.modelTrack_;
- var firstT = modelTrack.addAllEventsMatchingFilterToSelectionAsTask(
- filter, selection);
- var lastT = firstT.after(function() {
- this.upperModelTrack_.addAllEventsMatchingFilterToSelection(
- filter, selection);
-
- }, this);
- return firstT;
- },
-
- onMouseMove_: function(e) {
- // Zooming requires the delta since the last mousemove so we need to avoid
- // tracking it when the zoom interaction is active.
- if (this.isZooming_)
- return;
-
- this.storeLastMousePos_(e);
- },
-
- onTouchStart_: function(e) {
- this.storeLastTouchPositions_(e);
- this.focusElements_();
- },
-
- onTouchMove_: function(e) {
- e.preventDefault();
- this.onUpdateTransformForTouch_(e);
- },
-
- onTouchEnd_: function(e) {
- this.storeLastTouchPositions_(e);
- this.focusElements_();
- },
-
- addHotKeys_: function() {
- this.addKeyDownHotKeys_();
- this.addKeyPressHotKeys_();
- },
-
- addKeyPressHotKeys_: function() {
- var addBinding = function(dict) {
- dict.eventType = 'keypress';
- dict.useCapture = false;
- dict.thisArg = this;
- var binding = new tr.ui.b.HotKey(dict);
- this.$.hotkey_controller.addHotKey(binding);
- }.bind(this);
-
- addBinding({
- keyCodes: ['w'.charCodeAt(0), ','.charCodeAt(0)],
- callback: function(e) {
- this.zoomBy_(1.5, true);
- e.stopPropagation();
- }
- });
-
- addBinding({
- keyCodes: ['s'.charCodeAt(0), 'o'.charCodeAt(0)],
- callback: function(e) {
- this.zoomBy_(1 / 1.5, true);
- e.stopPropagation();
- }
- });
-
- addBinding({
- keyCode: 'g'.charCodeAt(0),
- callback: function(e) {
- this.onGridToggle_(true);
- e.stopPropagation();
- }
- });
-
- addBinding({
- keyCode: 'G'.charCodeAt(0),
- callback: function(e) {
- this.onGridToggle_(false);
- e.stopPropagation();
- }
- });
-
- addBinding({
- keyCodes: ['W'.charCodeAt(0), '<'.charCodeAt(0)],
- callback: function(e) {
- this.zoomBy_(10, true);
- e.stopPropagation();
- }
- });
-
- addBinding({
- keyCodes: ['S'.charCodeAt(0), 'O'.charCodeAt(0)],
- callback: function(e) {
- this.zoomBy_(1 / 10, true);
- e.stopPropagation();
- }
- });
-
- addBinding({
- keyCode: 'a'.charCodeAt(0),
- callback: function(e) {
- this.queueSmoothPan_(this.viewWidth_ * 0.3, 0);
- e.stopPropagation();
- }
- });
-
- addBinding({
- keyCodes: ['d'.charCodeAt(0), 'e'.charCodeAt(0)],
- callback: function(e) {
- this.queueSmoothPan_(this.viewWidth_ * -0.3, 0);
- e.stopPropagation();
- }
- });
-
- addBinding({
- keyCode: 'A'.charCodeAt(0),
- callback: function(e) {
- this.queueSmoothPan_(viewWidth * 0.5, 0);
- e.stopPropagation();
- }
- });
-
- addBinding({
- keyCode: 'D'.charCodeAt(0),
- callback: function(e) {
- this.queueSmoothPan_(viewWidth * -0.5, 0);
- e.stopPropagation();
- }
- });
-
- addBinding({
- keyCode: '0'.charCodeAt(0),
- callback: function(e) {
- this.setInitialViewport_();
- e.stopPropagation();
- }
- });
-
- addBinding({
- keyCode: 'f'.charCodeAt(0),
- callback: function(e) {
- this.zoomToSelection();
- e.stopPropagation();
- }
- });
-
- addBinding({
- keyCode: 'm'.charCodeAt(0),
- callback: function(e) {
- this.setCurrentSelectionAsInterestRange_();
- e.stopPropagation();
- }
- });
-
- addBinding({
- keyCode: 'p'.charCodeAt(0),
- callback: function(e) {
- this.selectPowerSamplesInCurrentTimeRange_();
- e.stopPropagation();
- }
- });
-
- addBinding({
- keyCode: 'h'.charCodeAt(0),
- callback: function(e) {
- this.toggleHighDetails_();
- e.stopPropagation();
- }
- });
- },
-
- get viewWidth_() {
- return this.modelTrackContainer_.canvas.clientWidth;
- },
-
- addKeyDownHotKeys_: function() {
- var addBinding = function(dict) {
- dict.eventType = 'keydown';
- dict.useCapture = false;
- dict.thisArg = this;
- var binding = new tr.ui.b.HotKey(dict);
- this.$.hotkey_controller.addHotKey(binding);
- }.bind(this);
-
- addBinding({
- keyCode: 37, // Left arrow.
- callback: function(e) {
- var curSel = this.brushingStateController_.selection;
- var sel = this.viewport.getShiftedSelection(curSel, -1);
-
- if (sel) {
- this.brushingStateController.changeSelectionFromTimeline(sel);
- this.panToSelection();
- } else {
- this.queueSmoothPan_(this.viewWidth_ * 0.3, 0);
- }
- e.preventDefault();
- e.stopPropagation();
- }
- });
-
- addBinding({
- keyCode: 39, // Right arrow.
- callback: function(e) {
- var curSel = this.brushingStateController_.selection;
- var sel = this.viewport.getShiftedSelection(curSel, 1);
- if (sel) {
- this.brushingStateController.changeSelectionFromTimeline(sel);
- this.panToSelection();
- } else {
- this.queueSmoothPan_(-this.viewWidth_ * 0.3, 0);
- }
- e.preventDefault();
- e.stopPropagation();
- }
- });
- },
-
- onDblClick_: function(e) {
- if (this.mouseModeSelector_.mode !==
- tr.ui.b.MOUSE_SELECTOR_MODE.SELECTION)
- return;
-
- var curSelection = this.brushingStateController_.selection;
- if (!curSelection.length || !tr.b.getOnlyElement(curSelection).title)
- return;
-
- var selection = new tr.model.EventSet();
- var filter = new tr.c.ExactTitleFilter(
- tr.b.getOnlyElement(curSelection).title);
- this.modelTrack_.addAllEventsMatchingFilterToSelection(filter,
- selection);
-
- this.brushingStateController.changeSelectionFromTimeline(selection);
- },
-
- onMouseWheel_: function(e) {
- if (!e.altKey)
- return;
-
- var delta = e.wheelDelta / 120;
- var zoomScale = Math.pow(1.5, delta);
- this.zoomBy_(zoomScale);
- e.preventDefault();
- },
-
- onMouseDown_: function(e) {
- if (this.mouseModeSelector_.mode !==
- tr.ui.b.MOUSE_SELECTOR_MODE.SELECTION)
- return;
-
- // Mouse down must start on ruler track for crosshair guide lines to draw.
- if (e.target !== this.rulerTrack_)
- return;
-
- // Make sure we don't start a selection drag event here.
- this.dragBeginEvent_ = undefined;
-
- // Remove nav string marker if it exists, since we're clearing the
- // find control box.
- if (this.xNavStringMarker_) {
- this.model.removeAnnotation(this.xNavStringMarker_);
- this.xNavStringMarker_ = undefined;
- }
-
- var dt = this.viewport_.currentDisplayTransform;
- tr.ui.b.trackMouseMovesUntilMouseUp(function(e) { // Mouse move handler.
- // If mouse event is on ruler, don't do anything.
- if (e.target === this.rulerTrack_)
- return;
-
- var relativePosition = this.extractRelativeMousePosition_(e);
- var loc = tr.model.Location.fromViewCoordinates(
- this.viewport_, relativePosition.x, relativePosition.y);
- // Not all points on the timeline represents a valid location.
- // ex. process header tracks, letter dot tracks.
- if (!loc)
- return;
-
- if (this.guideLineAnnotation_ === undefined) {
- this.guideLineAnnotation_ =
- new tr.model.XMarkerAnnotation(loc.xWorld);
- this.model.addAnnotation(this.guideLineAnnotation_);
- } else {
- this.guideLineAnnotation_.timestamp = loc.xWorld;
- this.modelTrackContainer_.invalidate();
- }
-
- // Set the findcontrol's text to nav string of current state.
- var state = new tr.ui.b.UIState(loc,
- this.viewport_.currentDisplayTransform.scaleX);
- this.timelineView_.setFindCtlText(
- state.toUserFriendlyString(this.viewport_));
- }.bind(this),
- undefined, // Mouse up handler.
- function onKeyUpDuringDrag() {
- if (this.dragBeginEvent_) {
- this.setDragBoxPosition_(this.dragBoxXStart_, this.dragBoxYStart_,
- this.dragBoxXEnd_, this.dragBoxYEnd_);
- }
- }.bind(this));
- },
-
- queueSmoothPan_: function(viewDeltaX, deltaY) {
- var deltaX = this.viewport_.currentDisplayTransform.xViewVectorToWorld(
- viewDeltaX);
- var animation = new tr.ui.TimelineDisplayTransformPanAnimation(
- deltaX, deltaY);
- this.viewport_.queueDisplayTransformAnimation(animation);
- },
-
- /**
- * Zoom in or out on the timeline by the given scale factor.
- * @param {Number} scale The scale factor to apply. If <1, zooms out.
- * @param {boolean} Whether to change the zoom level smoothly.
- */
- zoomBy_: function(scale, smooth) {
- if (scale <= 0) {
- return;
- }
-
- smooth = !!smooth;
- var vp = this.viewport_;
- var pixelRatio = window.devicePixelRatio || 1;
-
- var goalFocalPointXView = this.lastMouseViewPos_.x * pixelRatio;
- var goalFocalPointXWorld = vp.currentDisplayTransform.xViewToWorld(
- goalFocalPointXView);
- if (smooth) {
- var animation = new tr.ui.TimelineDisplayTransformZoomToAnimation(
- goalFocalPointXWorld, goalFocalPointXView,
- vp.currentDisplayTransform.panY,
- scale);
- vp.queueDisplayTransformAnimation(animation);
- } else {
- this.displayTransform_.set(vp.currentDisplayTransform);
- this.displayTransform_.scaleX *= scale;
- this.displayTransform_.xPanWorldPosToViewPos(
- goalFocalPointXWorld, goalFocalPointXView, this.viewWidth_);
- vp.setDisplayTransformImmediately(this.displayTransform_);
- }
- },
-
- /**
- * Zoom into the current selection.
- */
- zoomToSelection: function() {
- if (!this.brushingStateController.selectionOfInterest.length)
- return;
-
- var bounds = this.brushingStateController.selectionOfInterest.bounds;
- if (!bounds.range)
- return;
-
- var worldCenter = bounds.center;
- var viewCenter = this.modelTrackContainer_.canvas.width / 2;
- var adjustedWorldRange = bounds.range * 1.25;
- var newScale = this.modelTrackContainer_.canvas.width /
- adjustedWorldRange;
- var zoomInRatio = newScale /
- this.viewport_.currentDisplayTransform.scaleX;
-
- var animation = new tr.ui.TimelineDisplayTransformZoomToAnimation(
- worldCenter, viewCenter,
- this.viewport_.currentDisplayTransform.panY,
- zoomInRatio);
- this.viewport_.queueDisplayTransformAnimation(animation);
- },
-
- /**
- * Pan the view so the current selection becomes visible.
- */
- panToSelection: function() {
- if (!this.brushingStateController.selectionOfInterest.length)
- return;
-
- var bounds = this.brushingStateController.selectionOfInterest.bounds;
- var worldCenter = bounds.center;
- var viewWidth = this.viewWidth_;
-
- var dt = this.viewport_.currentDisplayTransform;
- if (false && !bounds.range) {
- if (dt.xWorldToView(bounds.center) < 0 ||
- dt.xWorldToView(bounds.center) > viewWidth) {
- this.displayTransform_.set(dt);
- this.displayTransform_.xPanWorldPosToViewPos(
- worldCenter, 'center', viewWidth);
- var deltaX = this.displayTransform_.panX - dt.panX;
- var animation = new tr.ui.TimelineDisplayTransformPanAnimation(
- deltaX, 0);
- this.viewport_.queueDisplayTransformAnimation(animation);
- }
- return;
- }
-
- this.displayTransform_.set(dt);
- this.displayTransform_.xPanWorldBoundsIntoView(
- bounds.min,
- bounds.max,
- viewWidth);
- var deltaX = this.displayTransform_.panX - dt.panX;
- var animation = new tr.ui.TimelineDisplayTransformPanAnimation(
- deltaX, 0);
- this.viewport_.queueDisplayTransformAnimation(animation);
- },
-
- navToPosition: function(uiState, showNavLine) {
- var location = uiState.location;
- var scaleX = uiState.scaleX;
- var track = location.getContainingTrack(this.viewport_);
-
- var worldCenter = location.xWorld;
- var viewCenter = this.modelTrackContainer_.canvas.width / 5;
- var zoomInRatio = scaleX /
- this.viewport_.currentDisplayTransform.scaleX;
-
- // Vertically scroll so track is in view.
- track.scrollIntoViewIfNeeded();
-
- // Perform zoom and panX animation.
- var animation = new tr.ui.TimelineDisplayTransformZoomToAnimation(
- worldCenter, viewCenter,
- this.viewport_.currentDisplayTransform.panY,
- zoomInRatio);
- this.viewport_.queueDisplayTransformAnimation(animation);
-
- if (!showNavLine)
- return;
- // Add an X Marker Annotation at the specified timestamp.
- if (this.xNavStringMarker_)
- this.model.removeAnnotation(this.xNavStringMarker_);
- this.xNavStringMarker_ =
- new tr.model.XMarkerAnnotation(worldCenter);
- this.model.addAnnotation(this.xNavStringMarker_);
- },
-
- selectPowerSamplesInCurrentTimeRange_: function() {
- var selectionBounds = this.brushingStateController_.selection.bounds;
- if (this.model.device.powerSeries && !selectionBounds.empty) {
- var events = this.model.device.powerSeries.getSamplesWithinRange(
- selectionBounds.min, selectionBounds.max);
- var selection = new tr.model.EventSet(events);
- this.brushingStateController_.changeSelectionFromTimeline(selection);
- }
- },
-
- setCurrentSelectionAsInterestRange_: function() {
- var selectionBounds = this.brushingStateController_.selection.bounds;
- if (selectionBounds.empty) {
- this.viewport_.interestRange.reset();
- return;
- }
-
- if (this.viewport_.interestRange.min == selectionBounds.min &&
- this.viewport_.interestRange.max == selectionBounds.max)
- this.viewport_.interestRange.reset();
- else
- this.viewport_.interestRange.set(selectionBounds);
- },
-
- toggleHighDetails_: function() {
- this.viewport_.highDetails = !this.viewport_.highDetails;
- },
-
- hideDragBox_: function() {
- this.$.drag_box.style.left = '-1000px';
- this.$.drag_box.style.top = '-1000px';
- this.$.drag_box.style.width = 0;
- this.$.drag_box.style.height = 0;
- },
-
- setDragBoxPosition_: function(xStart, yStart, xEnd, yEnd) {
- var loY = Math.min(yStart, yEnd);
- var hiY = Math.max(yStart, yEnd);
- var loX = Math.min(xStart, xEnd);
- var hiX = Math.max(xStart, xEnd);
- var modelTrackRect = this.modelTrack_.getBoundingClientRect();
- var dragRect = {left: loX, top: loY, width: hiX - loX, height: hiY - loY};
-
- dragRect.right = dragRect.left + dragRect.width;
- dragRect.bottom = dragRect.top + dragRect.height;
-
- var modelTrackContainerRect =
- this.modelTrackContainer_.getBoundingClientRect();
- var clipRect = {
- left: modelTrackContainerRect.left,
- top: modelTrackContainerRect.top,
- right: modelTrackContainerRect.right,
- bottom: modelTrackContainerRect.bottom
- };
-
- var headingWidth = window.getComputedStyle(
- this.querySelector('tr-ui-heading')).width;
- var trackTitleWidth = parseInt(headingWidth);
- clipRect.left = clipRect.left + trackTitleWidth;
-
- var intersectRect_ = function(r1, r2) {
- if (r2.left > r1.right || r2.right < r1.left ||
- r2.top > r1.bottom || r2.bottom < r1.top)
- return false;
-
- var results = {};
- results.left = Math.max(r1.left, r2.left);
- results.top = Math.max(r1.top, r2.top);
- results.right = Math.min(r1.right, r2.right);
- results.bottom = Math.min(r1.bottom, r2.bottom);
- results.width = results.right - results.left;
- results.height = results.bottom - results.top;
- return results;
- };
-
- // TODO(dsinclair): intersectRect_ can return false (which should actually
- // be undefined) but we use finalDragBox without checking the return value
- // which could potentially blowup. Fix this .....
- var finalDragBox = intersectRect_(clipRect, dragRect);
-
- this.$.drag_box.style.left = finalDragBox.left + 'px';
- this.$.drag_box.style.width = finalDragBox.width + 'px';
- this.$.drag_box.style.top = finalDragBox.top + 'px';
- this.$.drag_box.style.height = finalDragBox.height + 'px';
- this.$.drag_box.style.whiteSpace = 'nowrap';
-
- var pixelRatio = window.devicePixelRatio || 1;
- var canv = this.modelTrackContainer_.canvas;
- var dt = this.viewport_.currentDisplayTransform;
- var loWX = dt.xViewToWorld(
- (loX - canv.offsetLeft) * pixelRatio);
- var hiWX = dt.xViewToWorld(
- (hiX - canv.offsetLeft) * pixelRatio);
-
- this.$.drag_box.textContent =
- tr.v.Unit.byName.timeDurationInMs.format(hiWX - loWX);
-
- var e = new tr.b.Event('selectionChanging');
- e.loWX = loWX;
- e.hiWX = hiWX;
- this.dispatchEvent(e);
- },
-
- onGridToggle_: function(left) {
- var selection = this.brushingStateController_.selection;
- var tb = left ? selection.bounds.min : selection.bounds.max;
-
- // Toggle the grid off if the grid is on, the marker position is the same
- // and the same element is selected (same timebase).
- if (this.viewport_.gridEnabled &&
- this.viewport_.gridSide === left &&
- this.viewport_.gridInitialTimebase === tb) {
- this.viewport_.gridside = undefined;
- this.viewport_.gridEnabled = false;
- this.viewport_.gridInitialTimebase = undefined;
- return;
- }
-
- // Shift the timebase left until its just left of model_.bounds.min.
- var numIntervalsSinceStart = Math.ceil((tb - this.model_.bounds.min) /
- this.viewport_.gridStep_);
-
- this.viewport_.gridEnabled = true;
- this.viewport_.gridSide = left;
- this.viewport_.gridInitialTimebase = tb;
- this.viewport_.gridTimebase = tb -
- (numIntervalsSinceStart + 1) * this.viewport_.gridStep_;
- },
-
- storeLastMousePos_: function(e) {
- this.lastMouseViewPos_ = this.extractRelativeMousePosition_(e);
- },
-
- storeLastTouchPositions_: function(e) {
- this.lastTouchViewPositions_ = this.extractRelativeTouchPositions_(e);
- },
-
- extractRelativeMousePosition_: function(e) {
- var canv = this.modelTrackContainer_.canvas;
- return {
- x: e.clientX - canv.offsetLeft,
- y: e.clientY - canv.offsetTop
- };
- },
-
- extractRelativeTouchPositions_: function(e) {
- var canv = this.modelTrackContainer_.canvas;
-
- var touches = [];
- for (var i = 0; i < e.touches.length; ++i) {
- touches.push({
- x: e.touches[i].clientX - canv.offsetLeft,
- y: e.touches[i].clientY - canv.offsetTop
- });
- }
- return touches;
- },
-
- storeInitialMouseDownPos_: function(e) {
-
- var position = this.extractRelativeMousePosition_(e);
-
- this.mouseViewPosAtMouseDown_.x = position.x;
- this.mouseViewPosAtMouseDown_.y = position.y;
- },
-
- focusElements_: function() {
- this.$.hotkey_controller.childRequestsGeneralFocus(this);
- },
-
- storeInitialInteractionPositionsAndFocus_: function(e) {
-
- this.storeInitialMouseDownPos_(e);
- this.storeLastMousePos_(e);
-
- this.focusElements_();
- },
-
- onBeginPanScan_: function(e) {
- var vp = this.viewport_;
- this.viewportDisplayTransformAtMouseDown_ =
- vp.currentDisplayTransform.clone();
- this.isPanningAndScanning_ = true;
-
- this.storeInitialInteractionPositionsAndFocus_(e);
- e.preventDefault();
- },
-
- onUpdatePanScan_: function(e) {
- if (!this.isPanningAndScanning_)
- return;
-
- var viewWidth = this.viewWidth_;
-
- var pixelRatio = window.devicePixelRatio || 1;
- var xDeltaView = pixelRatio * (this.lastMouseViewPos_.x -
- this.mouseViewPosAtMouseDown_.x);
-
- var yDelta = this.lastMouseViewPos_.y -
- this.mouseViewPosAtMouseDown_.y;
-
- this.displayTransform_.set(this.viewportDisplayTransformAtMouseDown_);
- this.displayTransform_.incrementPanXInViewUnits(xDeltaView);
- this.displayTransform_.panY -= yDelta;
- this.viewport_.setDisplayTransformImmediately(this.displayTransform_);
-
- e.preventDefault();
- e.stopPropagation();
-
- this.storeLastMousePos_(e);
- },
-
- onEndPanScan_: function(e) {
- this.isPanningAndScanning_ = false;
-
- this.storeLastMousePos_(e);
-
- if (!e.isClick)
- e.preventDefault();
- },
-
- onBeginSelection_: function(e) {
- var canv = this.modelTrackContainer_.canvas;
- var rect = this.modelTrack_.getBoundingClientRect();
- var canvRect = canv.getBoundingClientRect();
-
- var inside = rect &&
- e.clientX >= rect.left &&
- e.clientX < rect.right &&
- e.clientY >= rect.top &&
- e.clientY < rect.bottom &&
- e.clientX >= canvRect.left &&
- e.clientX < canvRect.right;
-
- if (!inside)
- return;
-
- this.dragBeginEvent_ = e;
-
- this.storeInitialInteractionPositionsAndFocus_(e);
- e.preventDefault();
- },
-
- onUpdateSelection_: function(e) {
- if (!this.dragBeginEvent_)
- return;
-
- // Update the drag box
- this.dragBoxXStart_ = this.dragBeginEvent_.clientX;
- this.dragBoxXEnd_ = e.clientX;
- this.dragBoxYStart_ = this.dragBeginEvent_.clientY;
- this.dragBoxYEnd_ = e.clientY;
- this.setDragBoxPosition_(this.dragBoxXStart_, this.dragBoxYStart_,
- this.dragBoxXEnd_, this.dragBoxYEnd_);
-
- },
-
- onEndSelection_: function(e) {
- e.preventDefault();
-
- if (!this.dragBeginEvent_)
- return;
-
- // Stop the dragging.
- this.hideDragBox_();
- var eDown = this.dragBeginEvent_;
- this.dragBeginEvent_ = undefined;
-
- // Figure out extents of the drag.
- var loY = Math.min(eDown.clientY, e.clientY);
- var hiY = Math.max(eDown.clientY, e.clientY);
- var loX = Math.min(eDown.clientX, e.clientX);
- var hiX = Math.max(eDown.clientX, e.clientX);
-
- // Convert to worldspace.
- var canv = this.modelTrackContainer_.canvas;
- var worldOffset = canv.getBoundingClientRect().left;
- var loVX = loX - worldOffset;
- var hiVX = hiX - worldOffset;
-
- // Figure out what has been selected.
- var selection = new tr.model.EventSet();
- if (eDown.appendSelection) {
- var previousSelection = this.brushingStateController_.selection;
- if (previousSelection !== undefined)
- selection.addEventSet(previousSelection);
- }
- this.modelTrack_.addIntersectingEventsInRangeToSelection(
- loVX, hiVX, loY, hiY, selection);
-
- // Activate the new selection.
- this.brushingStateController_.changeSelectionFromTimeline(selection);
- },
-
- onBeginZoom_: function(e) {
- this.isZooming_ = true;
-
- this.storeInitialInteractionPositionsAndFocus_(e);
- e.preventDefault();
- },
-
- onUpdateZoom_: function(e) {
- if (!this.isZooming_)
- return;
- var newPosition = this.extractRelativeMousePosition_(e);
-
- var zoomScaleValue = 1 + (this.lastMouseViewPos_.y -
- newPosition.y) * 0.01;
-
- this.zoomBy_(zoomScaleValue, false);
- this.storeLastMousePos_(e);
- },
-
- onEndZoom_: function(e) {
- this.isZooming_ = false;
-
- if (!e.isClick)
- e.preventDefault();
- },
-
- computeTouchCenter_: function(positions) {
- var xSum = 0;
- var ySum = 0;
- for (var i = 0; i < positions.length; ++i) {
- xSum += positions[i].x;
- ySum += positions[i].y;
- }
- return {
- x: xSum / positions.length,
- y: ySum / positions.length
- };
- },
-
- computeTouchSpan_: function(positions) {
- var xMin = Number.MAX_VALUE;
- var yMin = Number.MAX_VALUE;
- var xMax = Number.MIN_VALUE;
- var yMax = Number.MIN_VALUE;
- for (var i = 0; i < positions.length; ++i) {
- xMin = Math.min(xMin, positions[i].x);
- yMin = Math.min(yMin, positions[i].y);
- xMax = Math.max(xMax, positions[i].x);
- yMax = Math.max(yMax, positions[i].y);
- }
- return Math.sqrt((xMin - xMax) * (xMin - xMax) +
- (yMin - yMax) * (yMin - yMax));
- },
-
- onUpdateTransformForTouch_: function(e) {
- var newPositions = this.extractRelativeTouchPositions_(e);
- var currentPositions = this.lastTouchViewPositions_;
-
- var newCenter = this.computeTouchCenter_(newPositions);
- var currentCenter = this.computeTouchCenter_(currentPositions);
-
- var newSpan = this.computeTouchSpan_(newPositions);
- var currentSpan = this.computeTouchSpan_(currentPositions);
-
- var vp = this.viewport_;
- var viewWidth = this.viewWidth_;
- var pixelRatio = window.devicePixelRatio || 1;
-
- var xDelta = pixelRatio * (newCenter.x - currentCenter.x);
- var yDelta = newCenter.y - currentCenter.y;
- var zoomScaleValue = currentSpan > 10 ? newSpan / currentSpan : 1;
-
- var viewFocus = pixelRatio * newCenter.x;
- var worldFocus = vp.currentDisplayTransform.xViewToWorld(viewFocus);
-
- this.displayTransform_.set(vp.currentDisplayTransform);
- this.displayTransform_.scaleX *= zoomScaleValue;
- this.displayTransform_.xPanWorldPosToViewPos(
- worldFocus, viewFocus, viewWidth);
- this.displayTransform_.incrementPanXInViewUnits(xDelta);
- this.displayTransform_.panY -= yDelta;
- vp.setDisplayTransformImmediately(this.displayTransform_);
- this.storeLastTouchPositions_(e);
- },
-
- initHintText_: function() {
- this.$.hint_text.style.display = 'none';
-
- this.pendingHintTextClearTimeout_ = undefined;
- },
-
- showHintText_: function(text) {
- if (this.pendingHintTextClearTimeout_) {
- window.clearTimeout(this.pendingHintTextClearTimeout_);
- this.pendingHintTextClearTimeout_ = undefined;
- }
- this.pendingHintTextClearTimeout_ = setTimeout(
- this.hideHintText_.bind(this), 1000);
- this.$.hint_text.textContent = text;
- this.$.hint_text.style.display = '';
- },
-
- hideHintText_: function() {
- this.pendingHintTextClearTimeout_ = undefined;
- this.$.hint_text.style.display = 'none';
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/timeline_track_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/timeline_track_view_test.html
deleted file mode 100644
index 70c00ec74d0..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/timeline_track_view_test.html
+++ /dev/null
@@ -1,200 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/task.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/extras/importer/trace_event_importer.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var EventSet = tr.model.EventSet;
- var SelectionState = tr.model.SelectionState;
- var Task = tr.b.Task;
-
- test('instantiate', function() {
- var num_threads = 500;
- var model = tr.c.TestUtils.newModelWithEvents([], {
- shiftWorldToZero: false,
- pruneContainers: false,
- customizeModelCallback: function(model) {
- var p100 = model.getOrCreateProcess(100);
- for (var i = 0; i < num_threads; i++) {
- var t = p100.getOrCreateThread(101 + i);
- if (i % 2 == 0) {
- t.sliceGroup.beginSlice('cat', 'a', 100);
- t.sliceGroup.endSlice(110);
- } else {
- t.sliceGroup.beginSlice('cat', 'b', 50);
- t.sliceGroup.endSlice(120);
- }
- }
- }
- });
-
- var timeline = document.createElement('tr-ui-timeline-track-view');
- timeline.model = model;
- timeline.style.maxHeight = '600px';
- this.addHTMLOutput(timeline);
- });
-
- test('addAllEventsMatchingFilterToSelectionAsTask', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
-
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 1, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'b', 0, 1.1, {}, 2.8));
-
- var t1asg = t1.asyncSliceGroup;
- t1asg.slices.push(
- tr.c.TestUtils.newAsyncSliceNamed('a', 0, 1, t1, t1));
- t1asg.slices.push(
- tr.c.TestUtils.newAsyncSliceNamed('b', 1, 2, t1, t1));
-
- var timeline = document.createElement('tr-ui-timeline-track-view');
- timeline.model = model;
-
- var expected = new tr.model.EventSet(
- [t1asg.slices[0], t1.sliceGroup.slices[0]]);
- var result = new tr.model.EventSet;
- var filterTask = timeline.addAllEventsMatchingFilterToSelectionAsTask(
- new tr.c.TitleOrCategoryFilter('a'), result);
- Task.RunSynchronously(filterTask);
- assert.isTrue(result.equals(expected));
-
- var expected = new tr.model.EventSet(
- [t1asg.slices[1], t1.sliceGroup.slices[1]]);
- var result = new tr.model.EventSet();
- var filterTask = timeline.addAllEventsMatchingFilterToSelectionAsTask(
- new tr.c.TitleOrCategoryFilter('b'), result);
- Task.RunSynchronously(filterTask);
- assert.isTrue(result.equals(expected));
- });
-
- test('emptyThreadsDeleted', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
-
- var timeline = document.createElement('tr-ui-timeline-track-view');
- timeline.model = model;
-
- assert.isFalse(timeline.hasVisibleContent);
- });
-
- test('filteredCounters', function() {
- var model = new tr.Model();
- var c1 = model.kernel.getOrCreateCpu(0);
- c1.getOrCreateCounter('', 'b');
-
- var p1 = model.getOrCreateProcess(1);
- var ctr = p1.getOrCreateCounter('', 'a');
- var series = new tr.model.CounterSeries('a', 0);
- series.addCounterSample(0, 1);
- ctr.addSeries(series);
-
- var timeline = document.createElement('tr-ui-timeline-track-view');
- timeline.model = model;
-
- assert.isTrue(timeline.hasVisibleContent);
- });
-
- test('filteredCpus', function() {
- var model = new tr.Model();
- var c1 = model.kernel.getOrCreateCpu(1);
- c1.getOrCreateCounter('', 'a');
-
- var timeline = document.createElement('tr-ui-timeline-track-view');
- timeline.model = model;
-
- assert.isTrue(timeline.hasVisibleContent);
- });
-
- test('filteredProcesses', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- p1.getOrCreateCounter('', 'a');
-
- var timeline = document.createElement('tr-ui-timeline-track-view');
- timeline.model = model;
-
- assert.isTrue(timeline.hasVisibleContent);
- });
-
- test('filteredThreads', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(2);
- t1.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx({start: 0, duration: 1}));
-
- var timeline = document.createElement('tr-ui-timeline-track-view');
- timeline.model = model;
-
- assert.isTrue(timeline.hasVisibleContent);
- });
-
- test('interestRange', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 520, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'b', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'c', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'c', args: {}, pid: 52, ts: 629, cat: 'foo', tid: 53, ph: 'E'},
- {name: 'b', args: {}, pid: 52, ts: 631, cat: 'foo', tid: 53, ph: 'E'},
- {name: 'a', args: {}, pid: 52, ts: 634, cat: 'foo', tid: 53, ph: 'E'}
- ];
- var model = tr.c.TestUtils.newModelWithEvents([events]);
- var trackView = document.createElement('tr-ui-timeline-track-view');
- trackView.model = model;
- this.addHTMLOutput(trackView);
-
- var slice = model.processes[52].threads[53].sliceGroup.slices[2];
- trackView.viewport.interestRange.setMinAndMax(slice.start, slice.end);
- });
-
- test('emptyInterestRange', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 520, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'b', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'c', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'c', args: {}, pid: 52, ts: 629, cat: 'foo', tid: 53, ph: 'E'},
- {name: 'b', args: {}, pid: 52, ts: 631, cat: 'foo', tid: 53, ph: 'E'},
- {name: 'a', args: {}, pid: 52, ts: 634, cat: 'foo', tid: 53, ph: 'E'}
- ];
- var model = tr.c.TestUtils.newModelWithEvents([events]);
- var trackView = document.createElement('tr-ui-timeline-track-view');
- trackView.model = model;
- this.addHTMLOutput(trackView);
- trackView.viewport.interestRange.reset();
- });
-
-
- test('thinnestInterestRange', function() {
- var events = [
- {name: 'a', args: {}, pid: 52, ts: 520, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'b', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'c', args: {}, pid: 52, ts: 560, cat: 'foo', tid: 53, ph: 'B'},
- {name: 'c', args: {}, pid: 52, ts: 629, cat: 'foo', tid: 53, ph: 'E'},
- {name: 'b', args: {}, pid: 52, ts: 631, cat: 'foo', tid: 53, ph: 'E'},
- {name: 'a', args: {}, pid: 52, ts: 634, cat: 'foo', tid: 53, ph: 'E'}
- ];
- var model = tr.c.TestUtils.newModelWithEvents([events]);
- var trackView = document.createElement('tr-ui-timeline-track-view');
- trackView.model = model;
- this.addHTMLOutput(trackView);
- trackView.viewport.interestRange.reset();
-
- var slice = model.processes[52].threads[53].sliceGroup.slices[2];
- trackView.viewport.interestRange.setMinAndMax(slice.start, slice.start);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/timeline_view.html b/chromium/third_party/catapult/tracing/tracing/ui/timeline_view.html
deleted file mode 100644
index e6dc34ab422..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/timeline_view.html
+++ /dev/null
@@ -1,530 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/settings.html">
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/core/scripting_controller.html">
-<link rel="import" href="/tracing/metrics/all_metrics.html">
-<link rel="import" href="/tracing/ui/analysis/analysis_view.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/drag_handle.html">
-<link rel="import" href="/tracing/ui/base/dropdown.html">
-<link rel="import" href="/tracing/ui/base/favicons.html">
-<link rel="import" href="/tracing/ui/base/hotkey_controller.html">
-<link rel="import" href="/tracing/ui/base/info_bar_group.html">
-<link rel="import" href="/tracing/ui/base/overlay.html">
-<link rel="import" href="/tracing/ui/base/toolbar_button.html">
-<link rel="import" href="/tracing/ui/base/utils.html">
-<link rel="import" href="/tracing/ui/brushing_state_controller.html">
-<link rel="import" href="/tracing/ui/find_control.html">
-<link rel="import" href="/tracing/ui/find_controller.html">
-<link rel="import" href="/tracing/ui/scripting_control.html">
-<link rel="import" href="/tracing/ui/side_panel/side_panel_container.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-<link rel="import" href="/tracing/ui/timeline_view_help_overlay.html">
-<link rel="import" href="/tracing/ui/timeline_view_metadata_overlay.html">
-<link rel="import" href="/tracing/value/ui/preferred_display_unit.html">
-
-<polymer-element name='tr-ui-timeline-view'>
- <template>
- <style>
- :host {
- flex-direction: column;
- cursor: default;
- display: flex;
- font-family: sans-serif;
- padding: 0;
- }
-
- #control {
- background-color: #e6e6e6;
- background-image: -webkit-gradient(linear, 0 0, 0 100%,
- from(#E5E5E5), to(#D1D1D1));
- flex: 0 0 auto;
- overflow-x: auto;
- }
-
- #control::-webkit-scrollbar { height: 0px; }
-
- #control > #bar {
- font-size: 12px;
- display: flex;
- flex-direction: row;
- margin: 1px;
- }
-
- #control > #bar > #title {
- display: flex;
- align-items: center;
- padding-left: 8px;
- padding-right: 8px;
- flex: 1 1 auto;
- }
-
- #control > #bar > #left_controls,
- #control > #bar > #right_controls {
- display: flex;
- flex-direction: row;
- align-items: stretch;
- }
-
- #control > #bar > #left_controls > * { margin-right: 2px; }
- #control > #bar > #right_controls > * { margin-left: 2px; }
- #control > #collapsing_controls { display: flex; }
-
- middle-container {
- flex: 1 1 auto;
- flex-direction: row;
- border-bottom: 1px solid #8e8e8e;
- display: flex;
- min-height: 0;
- }
-
- middle-container ::content track-view-container {
- flex: 1 1 auto;
- display: flex;
- min-height: 0;
- min-width: 0;
- overflow-x: hidden;
- }
-
- middle-container ::content track-view-container > * { flex: 1 1 auto; }
- middle-container > x-timeline-view-side-panel-container { flex: 0 0 auto; }
- tr-ui-b-drag-handle { flex: 0 0 auto; }
- tr-ui-a-analysis-view { flex: 0 0 auto; }
- </style>
-
- <tv-ui-b-hotkey-controller id="hkc"></tv-ui-b-hotkey-controller>
- <div id="control">
- <div id="bar">
- <div id="left_controls"></div>
- <div id="title">^_^</div>
- <div id="right_controls">
- <tr-ui-b-toolbar-button id="view_metadata_button">
- M
- </tr-ui-b-toolbar-button>
- <tr-ui-b-dropdown id="view_options_dropdown"></tr-ui-b-dropdown>
- <tr-ui-find-control id="view_find_control"></tr-ui-find-control>
- <tr-ui-b-toolbar-button id="view_console_button">
- &#187;
- </tr-ui-b-toolbar-button>
- <tr-ui-b-toolbar-button id="view_help_button">
- ?
- </tr-ui-b-toolbar-button>
- </div>
- </div>
- <div id="collapsing_controls"></div>
- <tr-ui-b-info-bar-group id="import-warnings">
- </tr-ui-b-info-bar-group>
- </div>
- <middle-container>
- <content></content>
-
- <tr-ui-side-panel-container id="side_panel_container">
- </tr-ui-side-panel-container>
- </middle-container>
- <tr-ui-b-drag-handle id="drag_handle"></tr-ui-b-drag-handle>
- <tr-ui-a-analysis-view id="analysis"></tr-ui-a-analysis-view>
-
- <tr-v-ui-preferred-display-unit id="display_unit">
- </tr-v-ui-preferred-display-unit>
- </template>
-
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.tabIndex = 0; // Let the timeline able to receive key events.
-
- this.titleEl_ = this.$.title;
- this.leftControlsEl_ = this.$.left_controls;
- this.rightControlsEl_ = this.$.right_controls;
- this.collapsingControlsEl_ = this.$.collapsing_controls;
- this.sidePanelContainer_ = this.$.side_panel_container;
-
- this.brushingStateController_ = new tr.c.BrushingStateController(this);
-
- this.findCtl_ = this.$.view_find_control;
- this.findCtl_.controller = new tr.ui.FindController(
- this.brushingStateController_);
-
- this.scriptingCtl_ = document.createElement('tr-ui-scripting-control');
- this.scriptingCtl_.controller = new tr.c.ScriptingController(
- this.brushingStateController_);
-
- this.sidePanelContainer_.brushingStateController =
- this.brushingStateController_;
-
- if (window.tr.metrics && window.tr.metrics.sh &&
- window.tr.metrics.sh.systemHealthMetric) {
- this.railScoreSpan_ = document.createElement(
- 'tr-metrics-ui-sh-system-health-span');
- this.rightControls.appendChild(this.railScoreSpan_);
- } else {
- this.railScoreSpan_ = undefined;
- }
-
- this.optionsDropdown_ = this.$.view_options_dropdown;
- this.optionsDropdown_.iconElement.textContent = 'View Options';
-
- this.showFlowEvents_ = false;
- this.optionsDropdown_.appendChild(tr.ui.b.createCheckBox(
- this, 'showFlowEvents',
- 'tr.ui.TimelineView.showFlowEvents', false,
- 'Flow events'));
- this.highlightVSync_ = false;
- this.highlightVSyncCheckbox_ = tr.ui.b.createCheckBox(
- this, 'highlightVSync',
- 'tr.ui.TimelineView.highlightVSync', false,
- 'Highlight VSync');
- this.optionsDropdown_.appendChild(this.highlightVSyncCheckbox_);
-
- this.initMetadataButton_();
- this.initConsoleButton_();
- this.initHelpButton_();
-
- this.collapsingControls.appendChild(this.scriptingCtl_);
-
- this.dragEl_ = this.$.drag_handle;
-
- this.analysisEl_ = this.$.analysis;
- this.analysisEl_.brushingStateController = this.brushingStateController_;
-
- this.addEventListener(
- 'requestSelectionChange',
- function(e) {
- var sc = this.brushingStateController_;
- sc.changeSelectionFromRequestSelectionChangeEvent(e.selection);
- }.bind(this));
-
- // Bookkeeping.
- this.onViewportChanged_ = this.onViewportChanged_.bind(this);
- this.bindKeyListeners_();
-
- this.dragEl_.target = this.analysisEl_;
- },
-
- domReady: function() {
- this.trackViewContainer_ = this.querySelector('#track_view_container');
- },
-
- get globalMode() {
- return this.hotkeyController.globalMode;
- },
-
- set globalMode(globalMode) {
- globalMode = !!globalMode;
- this.brushingStateController_.historyEnabled = globalMode;
- this.hotkeyController.globalMode = globalMode;
- },
-
- get hotkeyController() {
- return this.$.hkc;
- },
-
- updateDocumentFavicon: function() {
- var hue;
- if (!this.model)
- hue = 'blue';
- else
- hue = this.model.faviconHue;
-
- var faviconData = tr.ui.b.FaviconsByHue[hue];
- if (faviconData === undefined)
- faviconData = tr.ui.b.FaviconsByHue['blue'];
-
- // Find link if its there
- var link = document.head.querySelector('link[rel="shortcut icon"]');
- if (!link) {
- link = document.createElement('link');
- link.rel = 'shortcut icon';
- document.head.appendChild(link);
- }
- link.href = faviconData;
- },
-
- get showFlowEvents() {
- return this.showFlowEvents_;
- },
-
- set showFlowEvents(showFlowEvents) {
- this.showFlowEvents_ = showFlowEvents;
- if (!this.trackView_)
- return;
- this.trackView_.viewport.showFlowEvents = showFlowEvents;
- },
-
- get highlightVSync() {
- return this.highlightVSync_;
- },
-
- set highlightVSync(highlightVSync) {
- this.highlightVSync_ = highlightVSync;
- if (!this.trackView_)
- return;
- this.trackView_.viewport.highlightVSync = highlightVSync;
- },
-
- initHelpButton_: function() {
- var helpButtonEl = this.$.view_help_button;
-
- function onClick(e) {
- var dlg = new tr.ui.b.Overlay();
- dlg.title = 'Chrome Tracing Help';
- dlg.appendChild(
- document.createElement('tr-ui-timeline-view-help-overlay'));
- dlg.visible = true;
-
- // Stop event so it doesn't trigger new click listener on document.
- e.stopPropagation();
- }
- helpButtonEl.addEventListener('click', onClick.bind(this));
- },
-
- initConsoleButton_: function() {
- var toggleEl = this.$.view_console_button;
-
- function onClick(e) {
- this.scriptingCtl_.toggleVisibility();
- e.stopPropagation();
- return false;
- }
- toggleEl.addEventListener('click', onClick.bind(this));
- },
-
- initMetadataButton_: function() {
- var showEl = this.$.view_metadata_button;
-
- function onClick(e) {
- var dlg = new tr.ui.b.Overlay();
- dlg.title = 'Metadata for trace';
-
- var metadataOverlay = document.createElement(
- 'tr-ui-timeline-view-metadata-overlay');
- metadataOverlay.metadata = this.model.metadata;
-
- dlg.appendChild(metadataOverlay);
- dlg.visible = true;
-
- e.stopPropagation();
- return false;
- }
- showEl.addEventListener('click', onClick.bind(this));
-
- this.updateMetadataButtonVisibility_();
- },
-
- updateMetadataButtonVisibility_: function() {
- var showEl = this.$.view_metadata_button;
- showEl.style.display =
- (this.model && this.model.metadata.length) ? '' : 'none';
- },
-
- get leftControls() {
- return this.leftControlsEl_;
- },
-
- get rightControls() {
- return this.rightControlsEl_;
- },
-
- get collapsingControls() {
- return this.collapsingControlsEl_;
- },
-
- get viewTitle() {
- return this.titleEl_.textContent.substring(
- this.titleEl_.textContent.length - 2);
- },
-
- set viewTitle(text) {
- if (text === undefined) {
- this.titleEl_.textContent = '';
- this.titleEl_.hidden = true;
- return;
- }
- this.titleEl_.hidden = false;
- this.titleEl_.textContent = text;
- },
-
- get model() {
- if (this.trackView_)
- return this.trackView_.model;
- return undefined;
- },
-
- set model(model) {
- var modelInstanceChanged = model != this.model;
- var modelValid = model && !model.bounds.isEmpty;
-
- var importWarningsEl = this.shadowRoot.querySelector('#import-warnings');
- importWarningsEl.textContent = '';
-
- // Remove old trackView if the model has completely changed.
- if (modelInstanceChanged) {
- if (this.railScoreSpan_)
- this.railScoreSpan_.model = undefined;
- this.trackViewContainer_.textContent = '';
- if (this.trackView_) {
- this.trackView_.viewport.removeEventListener(
- 'change', this.onViewportChanged_);
- this.trackView_.brushingStateController = undefined;
- this.trackView_.detach();
- this.trackView_ = undefined;
- }
- this.brushingStateController_.modelWillChange();
- }
-
- // Create new trackView if needed.
- if (modelValid && !this.trackView_) {
- this.trackView_ = document.createElement('tr-ui-timeline-track-view');
- this.trackView_.timelineView = this;
-
- this.trackView.brushingStateController = this.brushingStateController_;
-
- this.trackViewContainer_.appendChild(this.trackView_);
- this.trackView_.viewport.addEventListener(
- 'change', this.onViewportChanged_);
- }
-
- // Set the model.
- if (modelValid) {
- this.trackView_.model = model;
- this.trackView_.viewport.showFlowEvents = this.showFlowEvents;
- this.trackView_.viewport.highlightVSync = this.highlightVSync;
- if (this.railScoreSpan_)
- this.railScoreSpan_.model = model;
-
- this.$.display_unit.preferredTimeDisplayMode = model.intrinsicTimeUnit;
- }
-
- if (model) {
- model.importWarningsThatShouldBeShownToUser.forEach(
- function(importWarning) {
- importWarningsEl.addMessage(
- 'Import Warning: ' + importWarning.type + ': ' +
- importWarning.message);
- }, this);
- }
-
- // Do things that are selection specific
- if (modelInstanceChanged) {
- this.updateMetadataButtonVisibility_();
- this.brushingStateController_.modelDidChange();
- this.onViewportChanged_();
- }
- },
-
- get brushingStateController() {
- return this.brushingStateController_;
- },
-
- get trackView() {
- return this.trackView_;
- },
-
- get settings() {
- if (!this.settings_)
- this.settings_ = new tr.b.Settings();
- return this.settings_;
- },
-
- /**
- * Deprecated. Kept around because third_party code occasionally calls
- * this to set up embedding.
- */
- set focusElement(value) {
- throw new Error('This is deprecated. Please set globalMode to true.');
- },
-
- bindKeyListeners_: function() {
- var hkc = this.hotkeyController;
-
- // Shortcuts that *can* steal focus from the console and the filter text
- // box.
- hkc.addHotKey(new tr.ui.b.HotKey({
- eventType: 'keypress',
- keyCode: '`'.charCodeAt(0),
- useCapture: true,
- thisArg: this,
- callback: function(e) {
- this.scriptingCtl_.toggleVisibility();
- if (!this.scriptingCtl_.hasFocus)
- this.focus();
- e.stopPropagation();
- }
- }));
-
- // Shortcuts that *can* steal focus from the filter text box.
- hkc.addHotKey(new tr.ui.b.HotKey({
- eventType: 'keypress',
- keyCode: '/'.charCodeAt(0),
- useCapture: true,
- thisArg: this,
- callback: function(e) {
- if (this.scriptingCtl_.hasFocus)
- return;
- if (this.findCtl_.hasFocus)
- this.focus();
- else
- this.findCtl_.focus();
- e.preventDefault();
- e.stopPropagation();
- }
- }));
-
- // Shortcuts that *can't* steal focus.
- hkc.addHotKey(new tr.ui.b.HotKey({
- eventType: 'keypress',
- keyCode: '?'.charCodeAt(0),
- useCapture: false,
- thisArg: this,
- callback: function(e) {
- this.$.view_help_button.click();
- e.stopPropagation();
- }
- }));
-
- hkc.addHotKey(new tr.ui.b.HotKey({
- eventType: 'keypress',
- keyCode: 'v'.charCodeAt(0),
- useCapture: false,
- thisArg: this,
- callback: function(e) {
- this.toggleHighlightVSync_();
- e.stopPropagation();
- }
- }));
- },
-
- onViewportChanged_: function(e) {
- var spc = this.sidePanelContainer_;
- if (!this.trackView_) {
- spc.rangeOfInterest.reset();
- return;
- }
-
- var vr = this.trackView_.viewport.interestRange.asRangeObject();
- if (!spc.rangeOfInterest.equals(vr))
- spc.rangeOfInterest = vr;
-
- if (this.railScoreSpan_ && this.model)
- this.railScoreSpan_.model = this.model;
- },
-
- toggleHighlightVSync_: function() {
- this.highlightVSyncCheckbox_.checked =
- !this.highlightVSyncCheckbox_.checked;
- },
-
- setFindCtlText: function(string) {
- this.findCtl_.setText(string);
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/timeline_view_help_overlay.html b/chromium/third_party/catapult/tracing/tracing/ui/timeline_view_help_overlay.html
deleted file mode 100644
index 1cde57bd69c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/timeline_view_help_overlay.html
+++ /dev/null
@@ -1,243 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/ui/base/mouse_mode_icon.html">
-<link rel="import" href="/tracing/ui/base/overlay.html">
-
-<polymer-element name="tr-ui-timeline-view-help-overlay">
- <template>
- <style>
- :host {
- -webkit-flex: 1 1 auto;
- -webkit-flex-direction: row;
- display: -webkit-flex;
- width: 700px;
- }
- .column {
- width: 50%;
- }
- h2 {
- font-size: 1.2em;
- margin: 0;
- margin-top: 5px;
- text-align: center;
- }
- h3 {
- margin: 0;
- margin-left: 126px;
- margin-top: 10px;
- }
- .pair {
- -webkit-flex: 1 1 auto;
- -webkit-flex-direction: row;
- display: -webkit-flex;
- }
- .command {
- font-family: monospace;
- margin-right: 5px;
- text-align: right;
- width: 150px;
- }
- .action {
- font-size: 0.9em;
- text-align: left;
- width: 200px;
- }
- tr-ui-b-mouse-mode-icon {
- border: 1px solid #888;
- border-radius: 3px;
- box-shadow: inset 0 0 2px rgba(0,0,0,0.3);
- display: inline-block;
- margin-right: 1px;
- position: relative;
- top: 4px;
- }
- .mouse-mode-icon.pan-mode {
- background-position: -1px -11px;
- }
- .mouse-mode-icon.select-mode {
- background-position: -1px -41px;
- }
- .mouse-mode-icon.zoom-mode {
- background-position: -1px -71px;
- }
- .mouse-mode-icon.timing-mode {
- background-position: -1px -101px;
- }
- </style>
- <div class="column left">
- <h2>Navigation</h2>
- <div class='pair'>
- <div class='command'>w/s</div>
- <div class='action'>Zoom in/out (+shift: faster)</div>
- </div>
-
- <div class='pair'>
- <div class='command'>a/d</div>
- <div class='action'>Pan left/right (+shift: faster)</div>
- </div>
-
- <div class='pair'>
- <div class='command'>&rarr;/shift-TAB</div>
- <div class='action'>Select previous event</div>
- </div>
-
- <div class='pair'>
- <div class='command'>&larr;/TAB</div>
- <div class='action'>Select next event</div>
- </div>
-
- <h2>Mouse Controls</h2>
- <div class='pair'>
- <div class='command'>click</div>
- <div class='action'>Select event</div>
- </div>
- <div class='pair'>
- <div class='command'>alt-mousewheel</div>
- <div class='action'>Zoom in/out</div>
- </div>
-
- <h3>
- <tr-ui-b-mouse-mode-icon modeName="SELECTION"></tr-ui-b-mouse-mode-icon>
- Select mode
- </h3>
- <div class='pair'>
- <div class='command'>drag</div>
- <div class='action'>Box select</div>
- </div>
-
- <div class='pair'>
- <div class='command'><span class='mod'></span>-click/drag</div>
- <div class='action'>Add events to the current selection</div>
- </div>
-
- <div class='pair'>
- <div class='command'>double click</div>
- <div class='action'>Select all events with same title</div>
- </div>
-
- <h3>
- <tr-ui-b-mouse-mode-icon modeName="PANSCAN"></tr-ui-b-mouse-mode-icon>
- Pan mode
- </h3>
- <div class='pair'>
- <div class='command'>drag</div>
- <div class='action'>Pan the view</div>
- </div>
-
- <h3>
- <tr-ui-b-mouse-mode-icon modeName="ZOOM"></tr-ui-b-mouse-mode-icon>
- Zoom mode
- </h3>
- <div class='pair'>
- <div class='command'>drag</div>
- <div class='action'>Zoom in/out by dragging up/down</div>
- </div>
-
- <h3>
- <tr-ui-b-mouse-mode-icon modeName="TIMING"></tr-ui-b-mouse-mode-icon>
- Timing mode
- </h3>
- <div class='pair'>
- <div class='command'>drag</div>
- <div class='action'>Create or move markers</div>
- </div>
-
- <div class='pair'>
- <div class='command'>double click</div>
- <div class='action'>Set marker range to slice</div>
- </div>
- </div>
-
- <div class="column right">
- <h2>General</h2>
- <div class='pair'>
- <div class='command'>1-4</div>
- <div class='action'>Switch mouse mode</div>
- </div>
-
- <div class='pair'>
- <div class='command'>shift</div>
- <div class='action'>Hold for temporary select</div>
- </div>
-
- <div class='pair'>
- <div class='command'>space</div>
- <div class='action'>Hold for temporary pan</div>
- </div>
-
- <div class='pair'>
- <div class='command'>/</div>
- <div class='action'>Search</div>
- </div>
-
- <div class='pair'>
- <div class='command'>enter</div>
- <div class='action'>Step through search results</div>
- </div>
-
- <div class='pair'>
- <div class='command'>f</div>
- <div class='action'>Zoom into selection</div>
- </div>
-
- <div class='pair'>
- <div class='command'>z/0</div>
- <div class='action'>Reset zoom and pan</div>
- </div>
-
- <div class='pair'>
- <div class='command'>g/G</div>
- <div class='action'>Toggle 60hz grid</div>
- </div>
-
- <div class='pair'>
- <div class='command'>v</div>
- <div class='action'>Highlight VSync</div>
- </div>
-
- <div class='pair'>
- <div class='command'>h</div>
- <div class='action'>Toggle low/high details</div>
- </div>
-
- <div class='pair'>
- <div class='command'>m</div>
- <div class='action'>Mark current selection</div>
- </div>
-
- <div class='pair'>
- <div class='command'>p</div>
- <div class='action'>Select power samples over current selection interval</div>
- </div>
-
- <div class='pair'>
- <div class='command'>`</div>
- <div class='action'>Show or hide the scripting console</div>
- </div>
-
- <div class='pair'>
- <div class='command'>?</div>
- <div class='action'>Show help</div>
- </div>
- </div>
- </template>
-
- <script>
- 'use strict';
-
- Polymer('tr-ui-timeline-view-help-overlay', {
- ready: function() {
- var mod = tr.isMac ? 'cmd ' : 'ctrl';
- var spans = this.shadowRoot.querySelectorAll('span.mod');
- for (var i = 0; i < spans.length; i++) {
- spans[i].textContent = mod;
- }
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/timeline_view_help_overlay_test.html b/chromium/third_party/catapult/tracing/tracing/ui/timeline_view_help_overlay_test.html
deleted file mode 100644
index d7e009d1623..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/timeline_view_help_overlay_test.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/ui/timeline_view_help_overlay.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('inactive', function() {
- var el = document.createElement('tr-ui-timeline-view-help-overlay');
- this.addHTMLOutput(el);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/timeline_view_metadata_overlay.html b/chromium/third_party/catapult/tracing/tracing/ui/timeline_view_metadata_overlay.html
deleted file mode 100644
index 0727958cfbe..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/timeline_view_metadata_overlay.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/ui/base/mouse_mode_icon.html">
-<link rel="import" href="/tracing/ui/base/overlay.html">
-<link rel="import" href="/tracing/value/ui/generic_table_view.html">
-
-<polymer-element name="tr-ui-timeline-view-metadata-overlay">
- <template>
- <style>
- :host {
- width: 700px;
-
- overflow: auto;
- }
- </style>
- <tr-v-ui-generic-table-view id="gtv"></tr-v-ui-generic-table-view>
- </template>
-
- <script>
- 'use strict';
-
- Polymer('tr-ui-timeline-view-metadata-overlay', {
- created: function() {
- this.metadata_ = undefined;
- },
-
- get metadata() {
- return this.metadata_;
- },
-
- set metadata(metadata) {
- this.metadata_ = metadata;
- this.$.gtv.items = this.metadata_;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/timeline_view_metadata_overlay_test.html b/chromium/third_party/catapult/tracing/tracing/ui/timeline_view_metadata_overlay_test.html
deleted file mode 100644
index 04e88d00cda..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/timeline_view_metadata_overlay_test.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/ui/timeline_view_metadata_overlay.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('inactive', function() {
- var el = document.createElement('tr-ui-timeline-view-metadata-overlay');
- el.metadata = [
- {
- name: 'clientInfo',
- value: {
- command_line: './out/Release/Chromium.app/Contents/MacOS/Chromium --enable-threaded-compositing --force-compositing-mode --enable-impl-side-painting --enable-skia-benchmarking --allow-webui-compositing --flag-switches-begin --force-compositing-mode --disable-threaded-compositing --flag-switches-end', // @suppress longLineCheck
- version: 'Chrome/29.0.1521.0'
- }
- },
- {
- name: 'somethingElse',
- value: 'fascinating!'
- }
- ];
-
- this.addHTMLOutput(el);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/timeline_view_test.html b/chromium/third_party/catapult/tracing/tracing/ui/timeline_view_test.html
deleted file mode 100644
index e3e2e060985..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/timeline_view_test.html
+++ /dev/null
@@ -1,161 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/task.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/timeline_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Task = tr.b.Task;
-
- function setupTimeline() {
- var container = document.createElement('track-view-container');
- container.id = 'track_view_container';
-
- var view = document.createElement('tr-ui-timeline-view');
- view.appendChild(container);
- view.trackViewContainer_ = container;
- return view;
- }
-
- var createFullyPopulatedModel = function(opt_withError, opt_withMetadata) {
- var withError = opt_withError !== undefined ? opt_withError : true;
- var withMetadata = opt_withMetadata !== undefined ?
- opt_withMetadata : true;
-
- var num_tests = 50;
- var testIndex = 0;
- var startTime = 0;
-
- var model = new tr.Model();
- var io = new tr.importer.ImportOptions();
- io.showImportWarnings = false;
- model.importOptions = io;
-
- for (testIndex = 0; testIndex < num_tests; ++testIndex) {
- var process = model.getOrCreateProcess(10000 + testIndex);
- if (testIndex % 2 == 0) {
- var thread = process.getOrCreateThread('Thread Name Here');
- thread.sliceGroup.pushSlice(new tr.model.Slice(
- 'foo', 'a', 0, startTime, {}, 1));
- thread.sliceGroup.pushSlice(new tr.model.Slice(
- 'bar', 'b', 0, startTime + 23, {}, 10));
- } else {
- var thread = process.getOrCreateThread('Name');
- thread.sliceGroup.pushSlice(new tr.model.Slice(
- 'foo', 'a', 0, startTime + 4, {}, 11));
- thread.sliceGroup.pushSlice(new tr.model.Slice(
- 'bar', 'b', 0, startTime + 22, {}, 14));
- }
- }
- var p1000 = model.getOrCreateProcess(1000);
- var objects = p1000.objects;
- objects.idWasCreated('0x1000', 'tr.e.cc', 'LayerTreeHostImpl', 10);
- objects.addSnapshot('0x1000', 'tr.e.cc', 'LayerTreeHostImpl', 10,
- 'snapshot-1');
- objects.addSnapshot('0x1000', 'tr.e.cc', 'LayerTreeHostImpl', 25,
- 'snapshot-2');
- objects.addSnapshot('0x1000', 'tr.e.cc', 'LayerTreeHostImpl', 40,
- 'snapshot-3');
- objects.idWasDeleted('0x1000', 'tr.e.cc', 'LayerTreeHostImpl', 45);
- model.updateCategories_();
-
- // Add a known problematic piece of data to test the import errors UI.
- model.importWarning({
- type: 'test_error',
- message: 'Synthetic Import Error'
- });
- model.updateBounds();
-
- // Add data with metadata information stored
- model.metadata.push({name: 'a', value: 'testA'});
- model.metadata.push({name: 'b', value: 'testB'});
- model.metadata.push({name: 'c', value: 'testC'});
-
- return model;
- };
-
- var visibleTracks = function(trackButtons) {
- return trackButtons.reduce(function(numVisible, button) {
- var style = button.parentElement.style;
- var visible = (style.display.indexOf('none') === -1);
- return visible ? numVisible + 1 : numVisible;
- }, 0);
- };
-
- var modelsEquivalent = function(lhs, rhs) {
- if (lhs.length !== rhs.length)
- return false;
- return lhs.every(function(lhsItem, index) {
- var rhsItem = rhs[index];
- return rhsItem.regexpText === lhsItem.regexpText &&
- rhsItem.isOn === lhsItem.isOn;
- });
- };
-
- test('instantiate', function() {
- var model11 = createFullyPopulatedModel(true, true);
-
- var view = setupTimeline();
- view.style.height = '400px';
- view.style.border = '1px solid black';
- view.model = model11;
-
- var simpleButton1 = document.createElement('tr-ui-b-toolbar-button');
- simpleButton1.textContent = 'M';
- view.leftControls.appendChild(simpleButton1);
-
- var simpleButton2 = document.createElement('tr-ui-b-toolbar-button');
- simpleButton2.textContent = 'am button';
- view.leftControls.appendChild(simpleButton2);
-
- this.addHTMLOutput(view);
- });
-
- test('changeModelToSomethingDifferent', function() {
- var model00 = createFullyPopulatedModel(false, false);
- var model11 = createFullyPopulatedModel(true, true);
-
- var view = setupTimeline();
- view.style.height = '400px';
- view.model = model00;
- view.model = undefined;
- view.model = model11;
- view.model = model00;
- });
-
- test('setModelToSameThingAgain', function() {
- var model = createFullyPopulatedModel(false, false);
-
- // Create a view with am model.
- var view = setupTimeline();
- view.style.height = '400px';
- view.model = model;
- var sc = view.brushingStateController;
-
- // Mutate the model and update the view.
- var t123 = model.getOrCreateProcess(123).getOrCreateThread(123);
- t123.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx(
- {title: 'somethingUnusual', start: 0, duration: 5}));
- view.model = model;
-
- // Verify that the new bits of the model show up in the view.
- var selection = new tr.model.EventSet();
- var filter = new tr.c.TitleOrCategoryFilter('somethingUnusual');
- var filterTask = sc.addAllEventsMatchingFilterToSelectionAsTask(
- filter, selection);
- Task.RunSynchronously(filterTask);
- assert.equal(selection.length, 1);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/timeline_viewport.html b/chromium/third_party/catapult/tracing/tracing/ui/timeline_viewport.html
deleted file mode 100644
index 92f4679ae01..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/timeline_viewport.html
+++ /dev/null
@@ -1,428 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2012 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/base/animation.html">
-<link rel="import" href="/tracing/ui/base/animation_controller.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/draw_helpers.html">
-<link rel="import" href="/tracing/ui/timeline_display_transform.html">
-<link rel="import" href="/tracing/ui/timeline_interest_range.html">
-<link rel="import" href="/tracing/ui/tracks/container_to_track_map.html">
-<link rel="import" href="/tracing/ui/tracks/event_to_track_map.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Code for the viewport.
- */
-tr.exportTo('tr.ui', function() {
- var TimelineDisplayTransform = tr.ui.TimelineDisplayTransform;
- var TimelineInterestRange = tr.ui.TimelineInterestRange;
-
- /**
- * The TimelineViewport manages the transform used for navigating
- * within the timeline. It is a simple transform:
- * x' = (x+pan) * scale
- *
- * The timeline code tries to avoid directly accessing this transform,
- * instead using this class to do conversion between world and viewspace,
- * as well as the math for centering the viewport in various interesting
- * ways.
- *
- * @constructor
- * @extends {tr.b.EventTarget}
- */
- function TimelineViewport(parentEl) {
- this.parentEl_ = parentEl;
- this.modelTrackContainer_ = undefined;
- this.currentDisplayTransform_ = new TimelineDisplayTransform();
- this.initAnimationController_();
-
- // Flow events
- this.showFlowEvents_ = false;
-
- // Highlights.
- this.highlightVSync_ = false;
-
- // High details.
- this.highDetails_ = false;
-
- // Grid system.
- this.gridTimebase_ = 0;
- this.gridStep_ = 1000 / 60;
- this.gridEnabled_ = false;
-
- // Init logic.
- this.hasCalledSetupFunction_ = false;
-
- this.onResize_ = this.onResize_.bind(this);
- this.onModelTrackControllerScroll_ =
- this.onModelTrackControllerScroll_.bind(this);
-
- // The following code uses an interval to detect when the parent element
- // is attached to the document. That is a trigger to run the setup function
- // and install a resize listener.
- this.checkForAttachInterval_ = setInterval(
- this.checkForAttach_.bind(this), 250);
-
- this.majorMarkPositions = [];
- this.interestRange_ = new TimelineInterestRange(this);
-
- this.eventToTrackMap_ = new tr.ui.tracks.EventToTrackMap();
- this.containerToTrackMap = new tr.ui.tracks.ContainerToTrackMap();
- }
-
- TimelineViewport.prototype = {
- __proto__: tr.b.EventTarget.prototype,
-
- /**
- * Allows initialization of the viewport when the viewport's parent element
- * has been attached to the document and given a size.
- * @param {Function} fn Function to call when the viewport can be safely
- * initialized.
- */
- setWhenPossible: function(fn) {
- this.pendingSetFunction_ = fn;
- },
-
- /**
- * @return {boolean} Whether the current timeline is attached to the
- * document.
- */
- get isAttachedToDocumentOrInTestMode() {
- // Allow not providing a parent element, used by tests.
- if (this.parentEl_ === undefined)
- return;
- return tr.ui.b.isElementAttachedToDocument(this.parentEl_);
- },
-
- onResize_: function() {
- this.dispatchChangeEvent();
- },
-
- /**
- * Checks whether the parentNode is attached to the document.
- * When it is, it installs the iframe-based resize detection hook
- * and then runs the pendingSetFunction_, if present.
- */
- checkForAttach_: function() {
- if (!this.isAttachedToDocumentOrInTestMode || this.clientWidth == 0)
- return;
-
- if (!this.iframe_) {
- this.iframe_ = document.createElement('iframe');
- this.iframe_.style.cssText =
- 'position:absolute;width:100%;height:0;border:0;visibility:hidden;';
- this.parentEl_.appendChild(this.iframe_);
-
- this.iframe_.contentWindow.addEventListener('resize', this.onResize_);
- }
-
- var curSize = this.parentEl_.clientWidth + 'x' +
- this.parentEl_.clientHeight;
- if (this.pendingSetFunction_) {
- this.lastSize_ = curSize;
- try {
- this.pendingSetFunction_();
- } catch (ex) {
- console.log('While running setWhenPossible:',
- ex.message ? ex.message + '\n' + ex.stack : ex.stack);
- }
- this.pendingSetFunction_ = undefined;
- }
-
- window.clearInterval(this.checkForAttachInterval_);
- this.checkForAttachInterval_ = undefined;
- },
-
- /**
- * Fires the change event on this viewport. Used to notify listeners
- * to redraw when the underlying model has been mutated.
- */
- dispatchChangeEvent: function() {
- tr.b.dispatchSimpleEvent(this, 'change');
- },
-
- detach: function() {
- if (this.checkForAttachInterval_) {
- window.clearInterval(this.checkForAttachInterval_);
- this.checkForAttachInterval_ = undefined;
- }
- if (this.iframe_) {
- this.iframe_.removeEventListener('resize', this.onResize_);
- this.parentEl_.removeChild(this.iframe_);
- }
- },
-
- initAnimationController_: function() {
- this.dtAnimationController_ = new tr.ui.b.AnimationController();
- this.dtAnimationController_.addEventListener(
- 'didtick', function(e) {
- this.onCurentDisplayTransformChange_(e.oldTargetState);
- }.bind(this));
-
- var that = this;
- this.dtAnimationController_.target = {
- get panX() {
- return that.currentDisplayTransform_.panX;
- },
-
- set panX(panX) {
- that.currentDisplayTransform_.panX = panX;
- },
-
- get panY() {
- return that.currentDisplayTransform_.panY;
- },
-
- set panY(panY) {
- that.currentDisplayTransform_.panY = panY;
- },
-
- get scaleX() {
- return that.currentDisplayTransform_.scaleX;
- },
-
- set scaleX(scaleX) {
- that.currentDisplayTransform_.scaleX = scaleX;
- },
-
- cloneAnimationState: function() {
- return that.currentDisplayTransform_.clone();
- },
-
- xPanWorldPosToViewPos: function(xWorld, xView) {
- that.currentDisplayTransform_.xPanWorldPosToViewPos(
- xWorld, xView, that.modelTrackContainer_.canvas.clientWidth);
- }
- };
- },
-
- get currentDisplayTransform() {
- return this.currentDisplayTransform_;
- },
-
- setDisplayTransformImmediately: function(displayTransform) {
- this.dtAnimationController_.cancelActiveAnimation();
-
- var oldDisplayTransform =
- this.dtAnimationController_.target.cloneAnimationState();
- this.currentDisplayTransform_.set(displayTransform);
- this.onCurentDisplayTransformChange_(oldDisplayTransform);
- },
-
- queueDisplayTransformAnimation: function(animation) {
- if (!(animation instanceof tr.ui.b.Animation))
- throw new Error('animation must be instanceof tr.ui.b.Animation');
- this.dtAnimationController_.queueAnimation(animation);
- },
-
- onCurentDisplayTransformChange_: function(oldDisplayTransform) {
- // Ensure panY stays clamped in the track container's scroll range.
- if (this.modelTrackContainer_) {
- this.currentDisplayTransform.panY = tr.b.clamp(
- this.currentDisplayTransform.panY,
- 0,
- this.modelTrackContainer_.scrollHeight -
- this.modelTrackContainer_.clientHeight);
- }
-
- var changed = !this.currentDisplayTransform.equals(oldDisplayTransform);
- var yChanged = this.currentDisplayTransform.panY !==
- oldDisplayTransform.panY;
- if (yChanged)
- this.modelTrackContainer_.scrollTop = this.currentDisplayTransform.panY;
- if (changed)
- this.dispatchChangeEvent();
- },
-
- onModelTrackControllerScroll_: function(e) {
- if (this.dtAnimationController_.activeAnimation &&
- this.dtAnimationController_.activeAnimation.affectsPanY)
- this.dtAnimationController_.cancelActiveAnimation();
- var panY = this.modelTrackContainer_.scrollTop;
- this.currentDisplayTransform_.panY = panY;
- },
-
- get modelTrackContainer() {
- return this.modelTrackContainer_;
- },
-
- set modelTrackContainer(m) {
- if (this.modelTrackContainer_)
- this.modelTrackContainer_.removeEventListener('scroll',
- this.onModelTrackControllerScroll_);
-
- this.modelTrackContainer_ = m;
- this.modelTrackContainer_.addEventListener('scroll',
- this.onModelTrackControllerScroll_);
- },
-
- get showFlowEvents() {
- return this.showFlowEvents_;
- },
-
- set showFlowEvents(showFlowEvents) {
- this.showFlowEvents_ = showFlowEvents;
- this.dispatchChangeEvent();
- },
-
- get highlightVSync() {
- return this.highlightVSync_;
- },
-
- set highlightVSync(highlightVSync) {
- this.highlightVSync_ = highlightVSync;
- this.dispatchChangeEvent();
- },
-
- get highDetails() {
- return this.highDetails_;
- },
-
- set highDetails(highDetails) {
- this.highDetails_ = highDetails;
- this.dispatchChangeEvent();
- },
-
- get gridEnabled() {
- return this.gridEnabled_;
- },
-
- set gridEnabled(enabled) {
- if (this.gridEnabled_ == enabled)
- return;
-
- this.gridEnabled_ = enabled && true;
- this.dispatchChangeEvent();
- },
-
- get gridTimebase() {
- return this.gridTimebase_;
- },
-
- set gridTimebase(timebase) {
- if (this.gridTimebase_ == timebase)
- return;
- this.gridTimebase_ = timebase;
- this.dispatchChangeEvent();
- },
-
- get gridStep() {
- return this.gridStep_;
- },
-
- get interestRange() {
- return this.interestRange_;
- },
-
- drawMajorMarkLines: function(ctx) {
- // Apply subpixel translate to get crisp lines.
- // http://www.mobtowers.com/html5-canvas-crisp-lines-every-time/
- ctx.save();
- ctx.translate((Math.round(ctx.lineWidth) % 2) / 2, 0);
-
- ctx.beginPath();
- for (var idx in this.majorMarkPositions) {
- var x = Math.floor(this.majorMarkPositions[idx]);
- tr.ui.b.drawLine(ctx, x, 0, x, ctx.canvas.height);
- }
- ctx.strokeStyle = '#ddd';
- ctx.stroke();
-
- ctx.restore();
- },
-
- drawGridLines: function(ctx, viewLWorld, viewRWorld) {
- if (!this.gridEnabled)
- return;
-
- var dt = this.currentDisplayTransform;
- var x = this.gridTimebase;
-
- // Apply subpixel translate to get crisp lines.
- // http://www.mobtowers.com/html5-canvas-crisp-lines-every-time/
- ctx.save();
- ctx.translate((Math.round(ctx.lineWidth) % 2) / 2, 0);
-
- ctx.beginPath();
- while (x < viewRWorld) {
- if (x >= viewLWorld) {
- // Do conversion to viewspace here rather than on
- // x to avoid precision issues.
- var vx = Math.floor(dt.xWorldToView(x));
- tr.ui.b.drawLine(ctx, vx, 0, vx, ctx.canvas.height);
- }
-
- x += this.gridStep;
- }
- ctx.strokeStyle = 'rgba(255, 0, 0, 0.25)';
- ctx.stroke();
-
- ctx.restore();
- },
-
- /**
- * Helper for selection previous or next.
- * @param {boolean} offset If positive, select one forward (next).
- * Else, select previous.
- *
- * @return {boolean} true if current selection changed.
- */
- getShiftedSelection: function(selection, offset) {
- var newSelection = new tr.model.EventSet();
- for (var event of selection) {
-
- // If this is a flow event, then move to its slice based on the
- // offset direction.
- if (event instanceof tr.model.FlowEvent) {
- if (offset > 0) {
- newSelection.push(event.endSlice);
- } else if (offset < 0) {
- newSelection.push(event.startSlice);
- } else {
- /* Do nothing. Zero offsets don't do anything. */
- }
- continue;
- }
-
- var track = this.trackForEvent(event);
- track.addEventNearToProvidedEventToSelection(
- event, offset, newSelection);
- }
-
- if (newSelection.length == 0)
- return undefined;
- return newSelection;
- },
-
- rebuildEventToTrackMap: function() {
- // TODO(charliea): Make the event to track map have a similar interface
- // to the container to track map so that we can just clear() here.
- this.eventToTrackMap_ = new tr.ui.tracks.EventToTrackMap();
- this.modelTrackContainer_.addEventsToTrackMap(this.eventToTrackMap_);
- },
-
- rebuildContainerToTrackMap: function() {
- this.containerToTrackMap.clear();
- this.modelTrackContainer_.addContainersToTrackMap(
- this.containerToTrackMap);
- },
-
- trackForEvent: function(event) {
- return this.eventToTrackMap_[event.guid];
- }
- };
-
- return {
- TimelineViewport: TimelineViewport
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/timeline_viewport_test.html b/chromium/third_party/catapult/tracing/tracing/ui/timeline_viewport_test.html
deleted file mode 100644
index 75a4939427e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/timeline_viewport_test.html
+++ /dev/null
@@ -1,150 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/location.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/base/constants.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-<link rel="import" href="/tracing/ui/timeline_viewport.html">
-<link rel="import" href="/tracing/ui/tracks/drawing_container.html">
-<link rel="import" href="/tracing/ui/tracks/slice_track.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Location = tr.model.Location;
- var Model = tr.Model;
-
- test('memoization', function() {
-
- var vp = new tr.ui.TimelineViewport(document.createElement('div'));
-
- var slice = { guid: 1 };
-
- vp.modelTrackContainer = {
- addEventsToTrackMap: function(eventToTrackMap) {
- eventToTrackMap.addEvent(slice, 'track');
- },
- addEventListener: function() {}
- };
-
- assert.isUndefined(vp.trackForEvent(slice));
- vp.rebuildEventToTrackMap();
-
- assert.equal(vp.trackForEvent(slice), 'track');
- });
-
- test('shiftedSelection', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 1, {}, 3));
- t1.sliceGroup.pushSlice(
- new tr.model.ThreadSlice('', 'a', 0, 5, {}, 1));
-
- var viewport = new tr.ui.TimelineViewport();
- var track = new tr.ui.tracks.SliceTrack(viewport);
- viewport.modelTrackContainer = track;
- track.slices = t1.sliceGroup.slices;
-
- viewport.rebuildEventToTrackMap();
-
- var sel = new tr.model.EventSet();
- sel.push(t1.sliceGroup.slices[0]);
-
- var shifted = track.viewport.getShiftedSelection(sel, 1);
- assert.isTrue(shifted.equals(
- new tr.model.EventSet(t1.sliceGroup.slices[1])));
- });
-
- test('locationObj', function() {
- var process;
- var thread;
- var model = tr.c.TestUtils.newModelWithEvents([], {
- shiftWorldToZero: false,
- pruneContainers: false,
- customizeModelCallback: function(model) {
- process = model.getOrCreateProcess(123);
- thread = process.getOrCreateThread(456);
-
- thread.asyncSliceGroup.push(
- tr.c.TestUtils.newAsyncSliceNamed('a', 80, 20, thread, thread));
- thread.asyncSliceGroup.push(
- tr.c.TestUtils.newAsyncSliceNamed('a', 85, 10, thread, thread));
- }
- });
-
- var timeline = document.createElement('tr-ui-timeline-track-view');
- var vp = new tr.ui.TimelineViewport(timeline);
- timeline.model = model;
- timeline.style.maxHeight = '600px';
- this.addHTMLOutput(timeline);
-
- // Our stableId to track map is not automatically built. We need to
- // search for the tracks and manually build the stableId map here.
- var processTracks = document.getElementsByClassName('process-track-base');
- vp.modelTrackContainer = {
- addContainersToTrackMap: function(containerToTrackMap) {
- // Invoking the process track's addContainersToTrackMap is enough to
- // build the map for all children (i.e. Threads, AsyncSliceGroups)
- // as well.
- for (var i = 0; i < processTracks.length; i++)
- processTracks[i].addContainersToTrackMap(containerToTrackMap);
- },
- addEventListener: function() {},
- canvas: {
- offsetLeft: tr.ui.b.constants.HEADING_WIDTH,
- offsetTop: 0
- }
- };
- vp.rebuildContainerToTrackMap();
-
- var asyncTrack =
- vp.containerToTrackMap.getTrackByStableId('123.456.AsyncSliceGroup');
- assert.isDefined(asyncTrack);
- assert.isFalse(asyncTrack.expanded); // Make sure this starts unexpanded.
-
- // Hack to allow Location to find the element we're looking for.
- // This ensures the correct behaviour of document.elementFrompoint(x,y) of
- // an originally off-screen element.
- asyncTrack.scrollIntoView();
-
- var boundRect = asyncTrack.getBoundingClientRect();
- var viewX = boundRect.left;
- var viewY = boundRect.top + boundRect.height / 2;
- var location = Location.fromViewCoordinates(vp, viewX, viewY);
- assert.equal(asyncTrack, location.getContainingTrack(vp));
- assert.deepEqual(location.toViewCoordinates(vp),
- { viewX: viewX, viewY: viewY });
-
- // Try expanding the multi-row track so that the dimensions of the thread
- // track changes.
- asyncTrack.expanded = true;
- // Expanding the track causes the height to double. We can calculate the new
- // viewY with respect to the track's old boundRect. ViewX remains unchanged.
- var expandedViewY = boundRect.top + boundRect.height;
- assert.deepEqual(location.toViewCoordinates(vp),
- { viewX: viewX, viewY: expandedViewY });
-
- // Test the functionality of fromStableIdAndTimestamp.
- var locationFromCoord =
- Location.fromViewCoordinates(vp, viewX, boundRect.top);
- var locationFromStableId =
- Location.fromStableIdAndTimestamp(vp, '123.456.AsyncSliceGroup',
- location.xWorld);
- assert.deepEqual(locationFromCoord, locationFromStableId);
-
- // Undo scroll.
- document.getElementById('results-container').scrollTop = 0;
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/alert_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/alert_track.html
deleted file mode 100644
index a6082f9d040..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/alert_track.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/tracks/letter_dot_track.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- /**
- * A track that displays an array of alert objects.
- * @constructor
- * @extends {LetterDotTrack}
- */
- var AlertTrack = tr.ui.b.define(
- 'alert-track', tr.ui.tracks.LetterDotTrack);
-
- AlertTrack.prototype = {
- __proto__: tr.ui.tracks.LetterDotTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.LetterDotTrack.prototype.decorate.call(this, viewport);
- this.heading = 'Alerts';
- this.alerts_ = undefined;
- },
-
- get alerts() {
- return this.alerts_;
- },
-
- set alerts(alerts) {
- this.alerts_ = alerts;
- if (alerts === undefined) {
- this.items = undefined;
- return;
- }
- this.items = this.alerts_.map(function(alert) {
- return new tr.ui.tracks.LetterDot(
- alert, String.fromCharCode(9888), alert.colorId, alert.start);
- });
- }
- };
-
- return {
- AlertTrack: AlertTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/alert_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/alert_track_test.html
deleted file mode 100644
index 48d488e3e48..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/alert_track_test.html
+++ /dev/null
@@ -1,76 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/global_memory_dump.html">
-<link rel="import" href="/tracing/model/selection_state.html">
-<link rel="import" href="/tracing/ui/timeline_viewport.html">
-<link rel="import" href="/tracing/ui/tracks/alert_track.html">
-<link rel="import" href="/tracing/ui/tracks/drawing_container.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var AlertTrack = tr.ui.tracks.AlertTrack;
- var SelectionState = tr.model.SelectionState;
- var Viewport = tr.ui.TimelineViewport;
-
- var ALERT_INFO_1 = new tr.model.EventInfo(
- 'Alert 1', 'One alert');
- var ALERT_INFO_2 = new tr.model.EventInfo(
- 'Alert 2', 'Another alert');
-
- var createAlerts = function() {
- var alerts = [
- new tr.model.Alert(ALERT_INFO_1, 5),
- new tr.model.Alert(ALERT_INFO_1, 20),
- new tr.model.Alert(ALERT_INFO_2, 35),
- new tr.model.Alert(ALERT_INFO_2, 50)
- ];
- return alerts;
- };
-
- test('instantiate', function() {
- var alerts = createAlerts();
- alerts[1].selectionState = SelectionState.SELECTED;
-
- var div = document.createElement('div');
- var viewport = new Viewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- var track = AlertTrack(viewport);
- drawingContainer.appendChild(track);
-
- this.addHTMLOutput(div);
- drawingContainer.invalidate();
-
- track.alerts = alerts;
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 50, track.clientWidth);
- track.viewport.setDisplayTransformImmediately(dt);
-
-
- assert.equal(5, track.items[0].start);
- });
-
- test('modelMapping', function() {
- var alerts = createAlerts();
-
- var div = document.createElement('div');
- var viewport = new Viewport(div);
- var track = AlertTrack(viewport);
- track.alerts = alerts;
-
- var a0 = track.items[0].modelItem;
- assert.equal(a0, alerts[0]);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/async_slice_group_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/async_slice_group_track.html
deleted file mode 100644
index 56971486083..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/async_slice_group_track.html
+++ /dev/null
@@ -1,136 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/tracks/multi_row_track.html">
-<link rel="import" href="/tracing/ui/tracks/slice_track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- /**
- * A track that displays a AsyncSliceGroup.
- * @constructor
- * @extends {MultiRowTrack}
- */
- var AsyncSliceGroupTrack = tr.ui.b.define(
- 'async-slice-group-track',
- tr.ui.tracks.MultiRowTrack);
-
- AsyncSliceGroupTrack.prototype = {
-
- __proto__: tr.ui.tracks.MultiRowTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.MultiRowTrack.prototype.decorate.call(this, viewport);
- this.classList.add('async-slice-group-track');
- this.group_ = undefined;
- },
-
- addSubTrack_: function(slices) {
- var track = new tr.ui.tracks.SliceTrack(this.viewport);
- track.slices = slices;
- this.appendChild(track);
- track.asyncStyle = true;
- return track;
- },
-
- get group() {
- return this.group_;
- },
-
- set group(group) {
- this.group_ = group;
- this.setItemsToGroup(this.group_.slices, this.group_);
- },
-
- get eventContainer() {
- return this.group;
- },
-
- addContainersToTrackMap: function(containerToTrackMap) {
- tr.ui.tracks.MultiRowTrack.prototype.addContainersToTrackMap.apply(
- this, arguments);
- containerToTrackMap.addContainer(this.group, this);
- },
-
- /**
- * Breaks up the list of slices into N rows, each of which is a list of
- * slices that are non overlapping.
- *
- * It uses a very simple approach: walk through the slices in sorted order
- * by start time. For each slice, try to fit it in an existing subRow. If
- * it doesn't fit in any subrow, make another subRow. It then fits nested
- * subSlices recursively into rows below parent slice according to which
- * nested level the child is in.
- */
- buildSubRows_: function(slices, opt_skipSort) {
- if (!opt_skipSort) {
- slices.sort(function(x, y) {
- return x.start - y.start;
- });
- }
-
- // Helper function that returns true if it can put the slice on row n.
- var findLevel = function(sliceToPut, rows, n) {
- if (n >= rows.length)
- return true; // We always can make empty rows to put the slice.
- var subRow = rows[n];
- var lastSliceInSubRow = subRow[subRow.length - 1];
- if (sliceToPut.start >= lastSliceInSubRow.end) {
- if (sliceToPut.subSlices === undefined ||
- sliceToPut.subSlices.length === 0) {
- return true;
- }
- // Make sure nested sub slices can be fitted in as well.
- for (var subSlice of sliceToPut.subSlices) {
- if (!findLevel(subSlice, rows, n + 1))
- return false;
- }
- return true;
- }
- return false;
- };
-
- var subRows = [];
- for (var slice of slices) {
- var found = false;
- var index = subRows.length;
- for (var j = 0; j < subRows.length; j++) {
- if (findLevel(slice, subRows, j)) {
- found = true;
- index = j;
- break;
- }
- }
- if (!found)
- subRows.push([]);
- subRows[index].push(slice);
-
- // Fit subSlices recursively into rows below parent.
- var fitSubSlicesRecursively = function(subSlices, level, rows) {
- if (subSlices === undefined || subSlices.length === 0)
- return;
- if (level === rows.length)
- rows.push([]);
- for (var subSlice of subSlices) {
- rows[level].push(subSlice);
- fitSubSlicesRecursively(subSlice.subSlices, level + 1, rows);
- }
- };
- fitSubSlicesRecursively(slice.subSlices, index + 1, subRows);
- }
- return subRows;
- }
- };
-
- return {
- AsyncSliceGroupTrack: AsyncSliceGroupTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/async_slice_group_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/async_slice_group_track_test.html
deleted file mode 100644
index cb924f42113..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/async_slice_group_track_test.html
+++ /dev/null
@@ -1,252 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var AsyncSliceGroup = tr.model.AsyncSliceGroup;
- var AsyncSliceGroupTrack = tr.ui.tracks.AsyncSliceGroupTrack;
- var Process = tr.model.Process;
- var ProcessTrack = tr.ui.tracks.ProcessTrack;
- var Thread = tr.model.Thread;
- var ThreadTrack = tr.ui.tracks.ThreadTrack;
- var newAsyncSlice = tr.c.TestUtils.newAsyncSlice;
- var newAsyncSliceNamed = tr.c.TestUtils.newAsyncSliceNamed;
-
- test('filterSubRows', function() {
- var model = new tr.Model();
- var p1 = new Process(model, 1);
- var t1 = new Thread(p1, 1);
- var g = new AsyncSliceGroup(t1);
- g.push(newAsyncSlice(0, 1, t1, t1));
- var track = new AsyncSliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = g;
-
- assert.equal(track.children.length, 1);
- assert.isTrue(track.hasVisibleContent);
- });
-
- test('rebuildSubRows_twoNonOverlappingSlices', function() {
- var model = new tr.Model();
- var p1 = new Process(model, 1);
- var t1 = new Thread(p1, 1);
- var g = new AsyncSliceGroup(t1);
- var s1 = newAsyncSlice(0, 1, t1, t1);
- var subs1 = newAsyncSliceNamed('b', 0, 1, t1, t1);
- s1.subSlices = [subs1];
- g.push(s1);
- g.push(newAsyncSlice(1, 1, t1, t1));
- var track = new AsyncSliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = g;
- var subRows = track.subRows;
- assert.equal(subRows.length, 2);
- assert.equal(subRows[0].length, 2);
- assert.equal(subRows[1].length, 1);
- assert.equal(subRows[1][0], g.slices[0].subSlices[0]);
- assert.sameMembers(g.slices[1].subSlices, []);
- });
-
- test('rebuildSubRows_twoOverlappingSlices', function() {
- var model = new tr.Model();
- var p1 = new Process(model, 1);
- var t1 = new Thread(p1, 1);
- var g = new AsyncSliceGroup(t1);
-
- var s1 = newAsyncSlice(0, 1, t1, t1);
- var subs1 = newAsyncSliceNamed('b', 0, 1, t1, t1);
- s1.subSlices = [subs1];
- var s2 = newAsyncSlice(0, 1.5, t1, t1);
- var subs2 = newAsyncSliceNamed('b', 0, 1, t1, t1);
- s2.subSlices = [subs2];
- g.push(s1);
- g.push(s2);
-
- g.updateBounds();
-
- var track = new AsyncSliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = g;
-
- var subRows = track.subRows;
-
- assert.equal(subRows.length, 4);
- assert.equal(subRows[0].length, 1);
- assert.equal(subRows[1].length, 1);
- assert.equal(subRows[2].length, 1);
- assert.equal(subRows[3].length, 1);
- assert.equal(subRows[1][0], g.slices[0].subSlices[0]);
- assert.equal(subRows[3][0], g.slices[1].subSlices[0]);
- });
-
- test('rebuildSubRows_threePartlyOverlappingSlices', function() {
- var model = new tr.Model();
- var p1 = new Process(model, 1);
- var t1 = new Thread(p1, 1);
- var g = new AsyncSliceGroup(t1);
- g.push(newAsyncSlice(0, 1, t1, t1));
- g.push(newAsyncSlice(0, 1.5, t1, t1));
- g.push(newAsyncSlice(1, 1.5, t1, t1));
- g.updateBounds();
- var track = new AsyncSliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = g;
- var subRows = track.subRows;
-
- assert.equal(subRows.length, 2);
- assert.equal(subRows[0].length, 2);
- assert.equal(subRows[0][0], g.slices[0]);
- assert.equal(subRows[0][1], g.slices[2]);
- assert.equal(subRows[1][0], g.slices[1]);
- assert.equal(subRows[1].length, 1);
- assert.sameMembers(g.slices[0].subSlices, []);
- assert.sameMembers(g.slices[1].subSlices, []);
- assert.sameMembers(g.slices[2].subSlices, []);
- });
-
- test('rebuildSubRows_threeOverlappingSlices', function() {
- var model = new tr.Model();
- var p1 = new Process(model, 1);
- var t1 = new Thread(p1, 1);
- var g = new AsyncSliceGroup(t1);
-
- g.push(newAsyncSlice(0, 1, t1, t1));
- g.push(newAsyncSlice(0, 1.5, t1, t1));
- g.push(newAsyncSlice(2, 1, t1, t1));
- g.updateBounds();
-
- var track = new AsyncSliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = g;
-
- var subRows = track.subRows;
- assert.equal(subRows.length, 2);
- assert.equal(subRows[0].length, 2);
- assert.equal(subRows[1].length, 1);
- assert.equal(subRows[0][0], g.slices[0]);
- assert.equal(subRows[1][0], g.slices[1]);
- assert.equal(subRows[0][1], g.slices[2]);
- });
-
- // Tests that no slices and their sub slices overlap.
- test('rebuildSubRows_NonOverlappingSubSlices', function() {
- var model = new tr.Model();
- var p1 = new Process(model, 1);
- var t1 = new Thread(p1, 1);
- var g = new AsyncSliceGroup(t1);
-
- var slice1 = newAsyncSlice(0, 5, t1, t1);
- var slice1Child = newAsyncSlice(1, 2, t1, t1);
- slice1.subSlices = [slice1Child];
- var slice2 = newAsyncSlice(3, 5, t1, t1);
- var slice3 = newAsyncSlice(5, 4, t1, t1);
- var slice3Child = newAsyncSlice(6, 2, t1, t1);
- slice3.subSlices = [slice3Child];
- g.push(slice1);
- g.push(slice2);
- g.push(slice3);
- g.updateBounds();
-
- var track = new AsyncSliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = g;
-
- var subRows = track.subRows;
- // Checks each sub row to see that we don't have any overlapping slices.
- for (var i = 0; i < subRows.length; i++) {
- var row = subRows[i];
- for (var j = 0; j < row.length; j++) {
- for (var k = j + 1; k < row.length; k++) {
- assert.isTrue(row[j].end <= row[k].start);
- }
- }
- }
- });
-
- test('rebuildSubRows_NonOverlappingSubSlicesThreeNestedLevels', function() {
- var model = new tr.Model();
- var p1 = new Process(model, 1);
- var t1 = new Thread(p1, 1);
- var g = new AsyncSliceGroup(t1);
-
- var slice1 = newAsyncSlice(0, 4, t1, t1);
- var slice1Child = newAsyncSlice(1, 2, t1, t1);
- slice1.subSlices = [slice1Child];
- var slice2 = newAsyncSlice(2, 7, t1, t1);
- var slice3 = newAsyncSlice(5, 5, t1, t1);
- var slice3Child = newAsyncSlice(6, 3, t1, t1);
- var slice3Child2 = newAsyncSlice(7, 1, t1, t1);
- slice3.subSlices = [slice3Child];
- slice3Child.subSlices = [slice3Child2];
- g.push(slice1);
- g.push(slice2);
- g.push(slice3);
- g.updateBounds();
-
- var track = new AsyncSliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = g;
-
- var subRows = track.subRows;
- // Checks each sub row to see that we don't have any overlapping slices.
- for (var i = 0; i < subRows.length; i++) {
- var row = subRows[i];
- for (var j = 0; j < row.length; j++) {
- for (var k = j + 1; k < row.length; k++) {
- assert.isTrue(row[j].end <= row[k].start);
- }
- }
- }
- });
-
- test('asyncSliceGroupContainerMap', function() {
- var vp = new tr.ui.TimelineViewport();
- var containerToTrack = vp.containerToTrackMap;
- var model = new tr.Model();
- var process = model.getOrCreateProcess(123);
- var thread = process.getOrCreateThread(456);
- var group = new AsyncSliceGroup(thread);
-
- var processTrack = new ProcessTrack(vp);
- var threadTrack = new ThreadTrack(vp);
- var groupTrack = new AsyncSliceGroupTrack(vp);
- processTrack.process = process;
- threadTrack.thread = thread;
- groupTrack.group = group;
- processTrack.appendChild(threadTrack);
- threadTrack.appendChild(groupTrack);
-
- assert.equal(processTrack.eventContainer, process);
- assert.equal(threadTrack.eventContainer, thread);
- assert.equal(groupTrack.eventContainer, group);
-
- assert.isUndefined(containerToTrack.getTrackByStableId('123'));
- assert.isUndefined(containerToTrack.getTrackByStableId('123.456'));
- assert.isUndefined(
- containerToTrack.getTrackByStableId('123.456.AsyncSliceGroup'));
-
- vp.modelTrackContainer = {
- addContainersToTrackMap: function(containerToTrackMap) {
- processTrack.addContainersToTrackMap(containerToTrackMap);
- },
- addEventListener: function() {}
- };
- vp.rebuildContainerToTrackMap();
-
- // Check that all tracks call childs' addContainersToTrackMap()
- // by checking the resulting map.
- assert.equal(containerToTrack.getTrackByStableId('123'), processTrack);
- assert.equal(containerToTrack.getTrackByStableId('123.456'), threadTrack);
- assert.equal(containerToTrack.getTrackByStableId('123.456.AsyncSliceGroup'),
- groupTrack);
-
- // Check the track's eventContainer getter.
- assert.equal(processTrack.eventContainer, process);
- assert.equal(threadTrack.eventContainer, thread);
- assert.equal(groupTrack.eventContainer, group);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_axis.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_axis.html
deleted file mode 100644
index f91733ced9e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_axis.html
+++ /dev/null
@@ -1,127 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- /**
- * A vertical axis for a (set of) chart series which maps an arbitrary range
- * of values [min, max] to the unit range [0, 1].
- *
- * @constructor
- */
- function ChartAxis(opt_min, opt_max) {
- this.guid_ = tr.b.GUID.allocateSimple();
- this.bounds = new tr.b.Range();
- if (opt_min !== undefined)
- this.bounds.addValue(opt_min);
- if (opt_max !== undefined)
- this.bounds.addValue(opt_max);
- };
-
- ChartAxis.prototype = {
- get guid() {
- return this.guid_;
- },
-
- valueToUnitRange: function(value) {
- if (this.bounds.isEmpty)
- throw new Error('Chart axis bounds are empty');
- var bounds = this.bounds;
- if (bounds.range === 0)
- return 0;
- return (value - bounds.min) / bounds.range;
- },
-
- /**
- * Automatically set the axis bounds from the range of values of all series
- * in a list.
- *
- * See the description of autoSetFromRange for the optional configuration
- * argument flags.
- */
- autoSetFromSeries: function(series, opt_config) {
- var range = new tr.b.Range();
- series.forEach(function(s) {
- range.addRange(s.range);
- }, this);
- this.autoSetFromRange(range, opt_config);
- },
-
- /**
- * Automatically set the axis bound from a range of values.
- *
- * The following four flags, which affect the behavior of this method with
- * respect to already defined bounds, can be present in the optional
- * configuration (a flag is assumed to be false if it is not provided or if
- * the configuration is not provided):
- *
- * - expandMin: allow decreasing the min bound (if range.min < this.min)
- * - shrinkMin: allow increasing the min bound (if range.min > this.min)
- * - expandMax: allow increasing the max bound (if range.max > this.max)
- * - shrinkMax: allow decreasing the max bound (if range.max < this.max)
- *
- * This method will ensure that the resulting bounds are defined and valid
- * (i.e. min <= max) provided that they were valid or empty before and the
- * value range is non-empty and valid.
- *
- * Note that unless expanding/shrinking a bound is explicitly enabled in
- * the configuration, non-empty bounds will not be changed under any
- * circumstances.
- *
- * Observe that if no configuration is provided (or all flags are set to
- * false), this method will only modify the axis bounds if they are empty.
- */
- autoSetFromRange: function(range, opt_config) {
- if (range.isEmpty)
- return;
-
- var bounds = this.bounds;
- if (bounds.isEmpty) {
- bounds.addRange(range);
- return;
- }
-
- if (!opt_config)
- return;
-
- var useRangeMin = (opt_config.expandMin && range.min < bounds.min ||
- opt_config.shrinkMin && range.min > bounds.min);
- var useRangeMax = (opt_config.expandMax && range.max > bounds.max ||
- opt_config.shrinkMax && range.max < bounds.max);
-
- // Neither bound is modified.
- if (!useRangeMin && !useRangeMax)
- return;
-
- // Both bounds are modified. Assuming the range argument is a valid
- // range, no extra checks are necessary.
- if (useRangeMin && useRangeMax) {
- bounds.min = range.min;
- bounds.max = range.max;
- return;
- }
-
- // Only one bound is modified. We must ensure that it doesn't go
- // over/under the other (unmodified) bound.
- if (useRangeMin) {
- bounds.min = Math.min(range.min, bounds.max);
- } else {
- bounds.max = Math.max(range.max, bounds.min);
- }
- }
- };
-
- return {
- ChartAxis: ChartAxis
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_axis_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_axis_test.html
deleted file mode 100644
index a5f83fd56f8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_axis_test.html
+++ /dev/null
@@ -1,312 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/ui/tracks/chart_axis.html">
-<link rel="import" href="/tracing/ui/tracks/chart_point.html">
-<link rel="import" href="/tracing/ui/tracks/chart_series.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ChartAxis = tr.ui.tracks.ChartAxis;
- var ChartPoint = tr.ui.tracks.ChartPoint;
- var ChartSeries = tr.ui.tracks.ChartSeries;
- var Range = tr.b.Range;
-
- function buildRange() {
- var range = new Range();
- for (var i = 0; i < arguments.length; i++)
- range.addValue(arguments[i]);
- return range;
- }
-
- function buildSeries() {
- var points = [];
- for (var i = 0; i < arguments.length; i++) {
- points.push(new ChartPoint(undefined, i, arguments[i]));
- }
- return new ChartSeries(points, new ChartAxis());
- }
-
- test('instantiate_emptyBounds', function() {
- var axis = new ChartAxis();
- assert.isTrue(axis.bounds.isEmpty);
- });
-
- test('instantiate_nonEmptyBounds', function() {
- var axis = new ChartAxis(-2, 12);
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, -2);
- assert.equal(axis.bounds.max, 12);
- });
-
- test('instantiate_equalBounds', function() {
- var axis = new ChartAxis(2.72);
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 2.72);
- assert.equal(axis.bounds.max, 2.72);
- });
-
- test('checkValueToUnitRange_emptyBounds', function() {
- var axis = new ChartAxis();
- assert.throws(function() { axis.valueToUnitRange(42); });
- });
-
- test('checkValueToUnitRange_nonEmptyBounds', function() {
- var axis = new ChartAxis(10, 20);
-
- assert.equal(axis.valueToUnitRange(0), -1);
- assert.equal(axis.valueToUnitRange(10), 0);
- assert.equal(axis.valueToUnitRange(15), 0.5);
- assert.equal(axis.valueToUnitRange(20), 1);
- assert.equal(axis.valueToUnitRange(30), 2);
- });
-
- test('checkValueToUnitRange_equalBounds', function() {
- var axis = new ChartAxis(3.14);
-
- assert.equal(axis.valueToUnitRange(0), 0);
- assert.equal(axis.valueToUnitRange(3.14), 0);
- assert.equal(axis.valueToUnitRange(6.28), 0);
- });
-
- test('checkAutoSetFromRange_emptyBounds', function() {
- // Empty range.
- var axis = new ChartAxis();
- axis.autoSetFromRange(buildRange());
- assert.isTrue(axis.bounds.isEmpty);
-
- // Non-empty range.
- var axis = new ChartAxis();
- axis.autoSetFromRange(buildRange(-1, 3));
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, -1);
- assert.equal(axis.bounds.max, 3);
- });
-
- test('checkAutoSetFromRange_nonEmptyBounds', function() {
- // Empty range.
- var axis = new ChartAxis(0, 1);
- axis.autoSetFromRange(buildRange());
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 0);
- assert.equal(axis.bounds.max, 1);
-
- // No configuration.
- var axis = new ChartAxis(2, 3);
- axis.autoSetFromRange(buildRange(1, 4));
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 2);
- assert.equal(axis.bounds.max, 3);
-
- // Allow expanding min.
- var axis = new ChartAxis(-2, -1);
- axis.autoSetFromRange(buildRange(-3, 0), {expandMin: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, -3);
- assert.equal(axis.bounds.max, -1);
-
- // Allow shrinking min.
- var axis = new ChartAxis(-2, -1);
- axis.autoSetFromRange(buildRange(-1.5, 0.5), {shrinkMin: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, -1.5);
- assert.equal(axis.bounds.max, -1);
-
- var axis = new ChartAxis(7, 8);
- axis.autoSetFromRange(buildRange(9, 10), {shrinkMin: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 8);
- assert.equal(axis.bounds.max, 8);
-
- // Allow expanding max.
- var axis = new ChartAxis(19, 20);
- axis.autoSetFromRange(buildRange(18, 21), {expandMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 19);
- assert.equal(axis.bounds.max, 21);
-
- // Allow shrinking max.
- var axis = new ChartAxis(30, 32);
- axis.autoSetFromRange(buildRange(29, 31), {shrinkMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 30);
- assert.equal(axis.bounds.max, 31);
-
- var axis = new ChartAxis(41, 42);
- axis.autoSetFromRange(buildRange(39, 40), {shrinkMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 41);
- assert.equal(axis.bounds.max, 41);
-
- // Allow shrinking both bounds.
- var axis = new ChartAxis(50, 53);
- axis.autoSetFromRange(buildRange(51, 52),
- {shrinkMin: true, shrinkMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 51);
- assert.equal(axis.bounds.max, 52);
-
- var axis = new ChartAxis(50, 53);
- axis.autoSetFromRange(buildRange(49, 52),
- {shrinkMin: true, shrinkMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 50);
- assert.equal(axis.bounds.max, 52);
-
- var axis = new ChartAxis(50, 53);
- axis.autoSetFromRange(buildRange(51, 54),
- {shrinkMin: true, shrinkMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 51);
- assert.equal(axis.bounds.max, 53);
-
- var axis = new ChartAxis(50, 53);
- axis.autoSetFromRange(buildRange(49, 54),
- {shrinkMin: true, shrinkMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 50);
- assert.equal(axis.bounds.max, 53);
-
- // Allow expanding both bounds.
- var axis = new ChartAxis(60, 61);
- axis.autoSetFromRange(buildRange(0, 100),
- {expandMin: true, expandMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 0);
- assert.equal(axis.bounds.max, 100);
-
- var axis = new ChartAxis(60, 61);
- axis.autoSetFromRange(buildRange(60.5, 100),
- {expandMin: true, expandMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 60);
- assert.equal(axis.bounds.max, 100);
-
- var axis = new ChartAxis(60, 61);
- axis.autoSetFromRange(buildRange(0, 60.5),
- {expandMin: true, expandMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 0);
- assert.equal(axis.bounds.max, 61);
-
- var axis = new ChartAxis(60, 61);
- axis.autoSetFromRange(buildRange(60.2, 60.8),
- {expandMin: true, expandMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 60);
- assert.equal(axis.bounds.max, 61);
-
- // Allow shrinking min and expanding max.
- var axis = new ChartAxis(60, 61);
- axis.autoSetFromRange(buildRange(62, 63),
- {shrinkMin: true, expandMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 62);
- assert.equal(axis.bounds.max, 63);
-
- var axis = new ChartAxis(60, 61);
- axis.autoSetFromRange(buildRange(59, 63),
- {shrinkMin: true, expandMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 60);
- assert.equal(axis.bounds.max, 63);
-
- var axis = new ChartAxis(60, 61);
- axis.autoSetFromRange(buildRange(60.2, 60.8),
- {shrinkMin: true, expandMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 60.2);
- assert.equal(axis.bounds.max, 61);
-
- var axis = new ChartAxis(60, 61);
- axis.autoSetFromRange(buildRange(59, 60.5),
- {shrinkMin: true, expandMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 60);
- assert.equal(axis.bounds.max, 61);
-
- // Allow expanding min and shrinking max.
- var axis = new ChartAxis(60, 61);
- axis.autoSetFromRange(buildRange(62, 63),
- {expandMin: true, shrinkMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 60);
- assert.equal(axis.bounds.max, 61);
-
- var axis = new ChartAxis(60, 61);
- axis.autoSetFromRange(buildRange(59, 63),
- {expandMin: true, shrinkMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 59);
- assert.equal(axis.bounds.max, 61);
-
- var axis = new ChartAxis(60, 61);
- axis.autoSetFromRange(buildRange(60.2, 60.8),
- {expandMin: true, shrinkMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 60);
- assert.equal(axis.bounds.max, 60.8);
-
- var axis = new ChartAxis(60, 61);
- axis.autoSetFromRange(buildRange(59, 60.5),
- {expandMin: true, shrinkMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 59);
- assert.equal(axis.bounds.max, 60.5);
-
- // Allow everything.
- var axis = new ChartAxis(200, 250);
- axis.autoSetFromRange(buildRange(150, 175),
- {expandMin: true, expandMax: true, shrinkMin: true, shrinkMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 150);
- assert.equal(axis.bounds.max, 175);
-
- var axis = new ChartAxis(0, 0.1);
- axis.autoSetFromRange(buildRange(0.2, 0.3),
- {expandMin: true, expandMax: true, shrinkMin: true, shrinkMax: true});
- assert.isFalse(axis.bounds.isEmpty);
- assert.equal(axis.bounds.min, 0.2);
- assert.equal(axis.bounds.max, 0.3);
- });
-
- test('checkAutoSetFromSeries_noSeries', function() {
- var axis = new ChartAxis(-100, 100);
- var series = [];
-
- axis.autoSetFromSeries(series);
- assert.equal(axis.bounds.min, -100);
- assert.equal(axis.bounds.max, 100);
- });
-
- test('checkAutoSetFromSeries_oneSeries', function() {
- var axis = new ChartAxis(-100, 100);
- var series = [buildSeries(-80, 100, -40, 200)];
-
- axis.autoSetFromSeries(series, {shrinkMin: true, expandMax: true});
- assert.equal(axis.bounds.min, -80);
- assert.equal(axis.bounds.max, 200);
- });
-
- test('checkAutoSetFromSeries_multipleSeries', function() {
- var axis = new ChartAxis(-100, 100);
- var series = [
- buildSeries(0, 20, 10, 30),
- buildSeries(),
- buildSeries(-500)
- ];
-
- axis.autoSetFromSeries(series, {expandMin: true, shrinkMax: true});
- assert.equal(axis.bounds.min, -500);
- assert.equal(axis.bounds.max, 30);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_point.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_point.html
deleted file mode 100644
index f5b5587dcde..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_point.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/proxy_selectable_item.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- /**
- * A point in a chart series with x (timestamp) and y (value) coordinates
- * and an associated model item. The point can optionally also have a base
- * y coordinate (which for example corresponds to the bottom edge of the
- * associated bar in a bar chart).
- *
- * @constructor
- * @extends {ProxySelectableItem}
- */
- function ChartPoint(modelItem, x, y, opt_yBase) {
- tr.model.ProxySelectableItem.call(this, modelItem);
- this.x = x;
- this.y = y;
-
- // If the base y-coordinate is undefined, the bottom edge of the associated
- // bar in a bar chart will start at the outer bottom edge (which is most
- // likely slightly below zero).
- this.yBase = opt_yBase;
- };
-
- ChartPoint.prototype = {
- __proto__: tr.model.ProxySelectableItem.prototype
- };
-
- return {
- ChartPoint: ChartPoint
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_point_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_point_test.html
deleted file mode 100644
index 491784dbe51..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_point_test.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/ui/tracks/chart_point.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ChartPoint = tr.ui.tracks.ChartPoint;
-
- test('checkFields_withoutYBase', function() {
- var event = {};
- var point = new ChartPoint(event, 42, -7);
-
- assert.equal(point.modelItem, event);
- assert.equal(point.x, 42);
- assert.equal(point.y, -7);
- assert.isUndefined(point.yBase);
- });
-
- test('checkFields_withYBase', function() {
- var event = {};
- var point = new ChartPoint(event, 111, 222, 333);
-
- assert.equal(point.modelItem, event);
- assert.equal(point.x, 111);
- assert.equal(point.y, 222);
- assert.equal(point.yBase, 333);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_series.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_series.html
deleted file mode 100644
index 05cd5a03a6e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_series.html
+++ /dev/null
@@ -1,494 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/ui/base/event_presenter.html">
-<link rel="import" href="/tracing/model/proxy_selectable_item.html">
-<link rel="import" href="/tracing/model/selection_state.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- var EventPresenter = tr.ui.b.EventPresenter;
- var SelectionState = tr.model.SelectionState;
-
- /**
- * The type of a chart series.
- * @enum
- */
- var ChartSeriesType = {
- LINE: 0,
- AREA: 1
- };
-
- // The default rendering configuration for ChartSeries.
- var DEFAULT_RENDERING_CONFIG = {
- // The type of the chart series.
- chartType: ChartSeriesType.LINE,
-
- // The size of a selected point dot in device-independent pixels (circle
- // diameter).
- selectedPointSize: 4,
-
- // The size of an unselected point dot in device-independent pixels (square
- // width/height).
- unselectedPointSize: 3,
-
- // The color of the chart.
- colorId: 0,
-
- // The width of the top line in device-independent pixels.
- lineWidth: 1,
-
- // Minimum distance between points in physical pixels. Points which are
- // closer than this distance will be skipped.
- skipDistance: 1,
-
- // Density in points per physical pixel at which unselected point dots
- // become transparent.
- unselectedPointDensityTransparent: 0.10,
-
- // Density in points per physical pixel at which unselected point dots
- // become fully opaque.
- unselectedPointDensityOpaque: 0.05,
-
- // Opacity of area chart background.
- backgroundOpacity: 0.5
- };
-
- // The virtual width of the last point in a series (whose rectangle has zero
- // width) in world timestamps difference for the purposes of selection.
- var LAST_POINT_WIDTH = 16;
-
- /**
- * Visual components of a ChartSeries.
- * @enum
- */
- var ChartSeriesComponent = {
- BACKGROUND: 0,
- LINE: 1,
- DOTS: 2
- };
-
- /**
- * A series of points corresponding to a single chart on a chart track.
- * This class is responsible for drawing the actual chart onto canvas.
- *
- * @constructor
- */
- function ChartSeries(points, axis, opt_renderingConfig) {
- this.points = points;
- this.axis = axis;
-
- this.useRenderingConfig_(opt_renderingConfig);
- }
-
- ChartSeries.prototype = {
- useRenderingConfig_: function(opt_renderingConfig) {
- var config = opt_renderingConfig || {};
-
- // Store all configuration flags as private properties.
- tr.b.iterItems(DEFAULT_RENDERING_CONFIG, function(key, defaultValue) {
- var value = config[key];
- if (value === undefined)
- value = defaultValue;
- this[key + '_'] = value;
- }, this);
-
- // Avoid unnecessary recomputation in getters.
- this.topPadding = this.bottomPadding = Math.max(
- this.selectedPointSize_, this.unselectedPointSize_) / 2;
- },
-
- get range() {
- var range = new tr.b.Range();
- this.points.forEach(function(point) {
- range.addValue(point.y);
- }, this);
- return range;
- },
-
- draw: function(ctx, transform, highDetails) {
- if (this.points === undefined || this.points.length === 0)
- return;
-
- // Draw the background.
- if (this.chartType_ === ChartSeriesType.AREA) {
- this.drawComponent_(ctx, transform, ChartSeriesComponent.BACKGROUND,
- highDetails);
- }
-
- // Draw the line at the top.
- if (this.chartType_ === ChartSeriesType.LINE || highDetails) {
- this.drawComponent_(ctx, transform, ChartSeriesComponent.LINE,
- highDetails);
- }
-
- // Draw the points.
- this.drawComponent_(ctx, transform, ChartSeriesComponent.DOTS,
- highDetails);
- },
-
- drawComponent_: function(ctx, transform, component, highDetails) {
- // We need to consider extra pixels outside the visible area to avoid
- // visual glitches due to non-zero width of dots.
- var extraPixels = 0;
- if (component === ChartSeriesComponent.DOTS) {
- extraPixels = Math.max(
- this.selectedPointSize_, this.unselectedPointSize_);
- }
- var leftViewX = transform.leftViewX - extraPixels * transform.pixelRatio;
- var rightViewX = transform.rightViewX +
- extraPixels * transform.pixelRatio;
- var leftTimestamp = transform.leftTimestamp - extraPixels;
- var rightTimestamp = transform.rightTimestamp + extraPixels;
-
- // Find the index of the first and last (partially) visible points.
- var firstVisibleIndex = tr.b.findLowIndexInSortedArray(
- this.points,
- function(point) { return point.x; },
- leftTimestamp);
- var lastVisibleIndex = tr.b.findLowIndexInSortedArray(
- this.points,
- function(point) { return point.x; },
- rightTimestamp);
- if (lastVisibleIndex >= this.points.length ||
- this.points[lastVisibleIndex].x > rightTimestamp) {
- lastVisibleIndex--;
- }
-
- // Pre-calculate component style which does not depend on individual
- // points:
- // * Skip distance between points,
- // * Selected (circle) and unselected (square) dot size,
- // * Unselected dot opacity,
- // * Selected dot edge color and width, and
- // * Line component color and width.
- var viewSkipDistance = this.skipDistance_ * transform.pixelRatio;
- var circleRadius;
- var squareSize;
- var squareHalfSize;
- var squareOpacity;
-
- switch (component) {
- case ChartSeriesComponent.DOTS:
- // Selected dot edge color and width.
- ctx.strokeStyle = EventPresenter.getCounterSeriesColor(
- this.colorId_, SelectionState.NONE);
- ctx.lineWidth = transform.pixelRatio;
-
- // Selected (circle) and unselected (square) dot size.
- circleRadius = (this.selectedPointSize_ / 2) * transform.pixelRatio;
- squareSize = this.unselectedPointSize_ * transform.pixelRatio;
- squareHalfSize = squareSize / 2;
-
- // Unselected dot opacity.
- if (!highDetails) {
- // Unselected dots are not displayed in 'low details' mode.
- squareOpacity = 0;
- break;
- }
- var visibleIndexRange = lastVisibleIndex - firstVisibleIndex;
- if (visibleIndexRange <= 0) {
- // There is at most one visible point.
- squareOpacity = 1;
- break;
- }
- var visibleViewXRange =
- transform.worldXToViewX(this.points[lastVisibleIndex].x) -
- transform.worldXToViewX(this.points[firstVisibleIndex].x);
- if (visibleViewXRange === 0) {
- // Multiple visible points which all have the same timestamp.
- squareOpacity = 1;
- break;
- }
- var density = visibleIndexRange / visibleViewXRange;
- var clampedDensity = tr.b.clamp(density,
- this.unselectedPointDensityOpaque_,
- this.unselectedPointDensityTransparent_);
- var densityRange = this.unselectedPointDensityTransparent_ -
- this.unselectedPointDensityOpaque_;
- squareOpacity =
- (this.unselectedPointDensityTransparent_ - clampedDensity) /
- densityRange;
- break;
-
- case ChartSeriesComponent.LINE:
- // Line component color and width.
- ctx.strokeStyle = EventPresenter.getCounterSeriesColor(
- this.colorId_, SelectionState.NONE);
- ctx.lineWidth = this.lineWidth_ * transform.pixelRatio;
- break;
-
- case ChartSeriesComponent.BACKGROUND:
- // Style depends on the selection state of individual points.
- break;
-
- default:
- throw new Error('Invalid component: ' + component);
- }
-
- // The main loop which draws the given component of visible points from
- // left to right. Given the potentially large number of points to draw,
- // it should be considered performance-critical and function calls should
- // be avoided when possible.
- //
- // Note that the background and line components are drawn in a delayed
- // fashion: the rectangle/line that we draw in an iteration corresponds
- // to the *previous* point. This does not apply to the dots, whose
- // position is independent of the surrounding dots.
- var previousViewX = undefined;
- var previousViewY = undefined;
- var previousViewYBase = undefined;
- var lastSelectionState = undefined;
- var baseSteps = undefined;
- var startIndex = Math.max(firstVisibleIndex - 1, 0);
-
- for (var i = startIndex; i < this.points.length; i++) {
- var currentPoint = this.points[i];
- var currentViewX = transform.worldXToViewX(currentPoint.x);
-
- // Stop drawing the points once we are to the right of the visible area.
- if (currentViewX > rightViewX) {
- if (previousViewX !== undefined) {
- previousViewX = currentViewX = rightViewX;
- if (component === ChartSeriesComponent.BACKGROUND ||
- component === ChartSeriesComponent.LINE) {
- ctx.lineTo(currentViewX, previousViewY);
- }
- }
- break;
- }
-
- if (i + 1 < this.points.length) {
- var nextPoint = this.points[i + 1];
- var nextViewX = transform.worldXToViewX(nextPoint.x);
-
- // Skip points that are too close to each other.
- if (previousViewX !== undefined &&
- nextViewX - previousViewX <= viewSkipDistance &&
- nextViewX < rightViewX) {
- continue;
- }
-
- // Start drawing right at the left side of the visible are (instead
- // of potentially very far to the left).
- if (currentViewX < leftViewX) {
- currentViewX = leftViewX;
- }
- }
-
- if (previousViewX !== undefined &&
- currentViewX - previousViewX < viewSkipDistance) {
- // We know that nextViewX > previousViewX + viewSkipDistance, so we
- // can safely move this points's x over that much without passing
- // nextViewX. This ensures that the previous point is visible when
- // zoomed out very far.
- currentViewX = previousViewX + viewSkipDistance;
- }
-
- var currentViewY = Math.round(transform.worldYToViewY(currentPoint.y));
- var currentViewYBase;
- if (currentPoint.yBase === undefined) {
- currentViewYBase = transform.outerBottomViewY;
- } else {
- currentViewYBase = Math.round(
- transform.worldYToViewY(currentPoint.yBase));
- }
- var currentSelectionState = currentPoint.selectionState;
-
- // Actually draw the given component of the point.
- switch (component) {
- case ChartSeriesComponent.DOTS:
- // Change dot style when the selection state changes (and at the
- // beginning).
- if (currentSelectionState !== lastSelectionState) {
- if (currentSelectionState === SelectionState.SELECTED) {
- ctx.fillStyle = EventPresenter.getCounterSeriesColor(
- this.colorId_, currentSelectionState);
- } else if (squareOpacity > 0) {
- ctx.fillStyle = EventPresenter.getCounterSeriesColor(
- this.colorId_, currentSelectionState, squareOpacity);
- }
- }
-
- // Draw the dot for the current point.
- if (currentSelectionState === SelectionState.SELECTED) {
- ctx.beginPath();
- ctx.arc(currentViewX, currentViewY, circleRadius, 0, 2 * Math.PI);
- ctx.fill();
- ctx.stroke();
- } else if (squareOpacity > 0) {
- ctx.fillRect(currentViewX - squareHalfSize,
- currentViewY - squareHalfSize, squareSize, squareSize);
- }
- break;
-
- case ChartSeriesComponent.LINE:
- // Draw the top line for the previous point (if applicable), or
- // prepare for drawing the top line of the current point in the next
- // iteration.
- if (previousViewX === undefined) {
- ctx.beginPath();
- ctx.moveTo(currentViewX, currentViewY);
- } else {
- ctx.lineTo(currentViewX, previousViewY);
- }
-
- // Move to the current point coordinate.
- ctx.lineTo(currentViewX, currentViewY);
- break;
-
- case ChartSeriesComponent.BACKGROUND:
- // Draw the background for the previous point (if applicable).
- if (previousViewX !== undefined)
- ctx.lineTo(currentViewX, previousViewY);
-
- // Finish the bottom part of the backgound polygon, change
- // background color and start a new polygon when the selection state
- // changes (and at the beginning).
- if (currentSelectionState !== lastSelectionState) {
- if (previousViewX !== undefined) {
- var previousBaseStepViewX = currentViewX;
- for (var j = baseSteps.length - 1; j >= 0; j--) {
- var baseStep = baseSteps[j];
- var baseStepViewX = baseStep.viewX;
- var baseStepViewY = baseStep.viewY;
- ctx.lineTo(previousBaseStepViewX, baseStepViewY);
- ctx.lineTo(baseStepViewX, baseStepViewY);
- previousBaseStepViewX = baseStepViewX;
- }
- ctx.closePath();
- ctx.fill();
- }
- ctx.beginPath();
- ctx.fillStyle = EventPresenter.getCounterSeriesColor(
- this.colorId_, currentSelectionState,
- this.backgroundOpacity_);
- ctx.moveTo(currentViewX, currentViewYBase);
- baseSteps = [];
- }
-
- if (currentViewYBase !== previousViewYBase ||
- currentSelectionState !== lastSelectionState) {
- baseSteps.push({viewX: currentViewX, viewY: currentViewYBase});
- }
-
- // Move to the current point coordinate.
- ctx.lineTo(currentViewX, currentViewY);
- break;
-
- default:
- throw new Error('Not reachable');
- }
-
- previousViewX = currentViewX;
- previousViewY = currentViewY;
- previousViewYBase = currentViewYBase;
- lastSelectionState = currentSelectionState;
- }
-
- // If we still have an open background or top line polygon (which is
- // always the case once we have started drawing due to the delayed fashion
- // of drawing), we must close it.
- if (previousViewX !== undefined) {
- switch (component) {
- case ChartSeriesComponent.DOTS:
- // All dots were drawn in the main loop.
- break;
-
- case ChartSeriesComponent.LINE:
- ctx.stroke();
- break;
-
- case ChartSeriesComponent.BACKGROUND:
- var previousBaseStepViewX = currentViewX;
- for (var j = baseSteps.length - 1; j >= 0; j--) {
- var baseStep = baseSteps[j];
- var baseStepViewX = baseStep.viewX;
- var baseStepViewY = baseStep.viewY;
- ctx.lineTo(previousBaseStepViewX, baseStepViewY);
- ctx.lineTo(baseStepViewX, baseStepViewY);
- previousBaseStepViewX = baseStepViewX;
- }
- ctx.closePath();
- ctx.fill();
- break;
-
- default:
- throw new Error('Not reachable');
- }
- }
- },
-
- addIntersectingEventsInRangeToSelectionInWorldSpace: function(
- loWX, hiWX, viewPixWidthWorld, selection) {
- var points = this.points;
-
- function getPointWidth(point, i) {
- if (i === points.length - 1)
- return LAST_POINT_WIDTH * viewPixWidthWorld;
- var nextPoint = points[i + 1];
- return nextPoint.x - point.x;
- }
-
- function selectPoint(point) {
- point.addToSelection(selection);
- }
-
- tr.b.iterateOverIntersectingIntervals(
- this.points,
- function(point) { return point.x },
- getPointWidth,
- loWX,
- hiWX,
- selectPoint);
- },
-
- addEventNearToProvidedEventToSelection: function(event, offset, selection) {
- if (this.points === undefined)
- return false;
-
- var index = tr.b.findFirstIndexInArray(this.points, function(point) {
- return point.modelItem === event;
- }, this);
- if (index === -1)
- return false;
-
- var newIndex = index + offset;
- if (newIndex < 0 || newIndex >= this.points.length)
- return false;
-
- this.points[newIndex].addToSelection(selection);
- return true;
- },
-
- addClosestEventToSelection: function(worldX, worldMaxDist, loY, hiY,
- selection) {
- if (this.points === undefined)
- return;
-
- var item = tr.b.findClosestElementInSortedArray(
- this.points,
- function(point) { return point.x },
- worldX,
- worldMaxDist);
-
- if (!item)
- return;
-
- item.addToSelection(selection);
- }
- };
-
- return {
- ChartSeries: ChartSeries,
- ChartSeriesType: ChartSeriesType
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_series_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_series_test.html
deleted file mode 100644
index bf84ef56c6a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_series_test.html
+++ /dev/null
@@ -1,294 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/timeline_display_transform.html">
-<link rel="import" href="/tracing/ui/tracks/chart_axis.html">
-<link rel="import" href="/tracing/ui/tracks/chart_point.html">
-<link rel="import" href="/tracing/ui/tracks/chart_series.html">
-<link rel="import" href="/tracing/ui/tracks/chart_transform.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var EventSet = tr.model.EventSet;
- var TimelineDisplayTransform = tr.ui.TimelineDisplayTransform;
- var Event = tr.model.Event;
- var ChartAxis = tr.ui.tracks.ChartAxis;
- var ChartPoint = tr.ui.tracks.ChartPoint;
- var ChartSeries = tr.ui.tracks.ChartSeries;
- var ChartTransform = tr.ui.tracks.ChartTransform;
- var ChartSeriesType = tr.ui.tracks.ChartSeriesType;
-
- var CANVAS_WIDTH = 800;
- var CANVAS_HEIGHT = 80;
-
- function buildSeries(renderingConfig) {
- var points = [];
- for (var i = 0; i < 60; i++) {
- var event = new Event();
- event.index = i;
- var phase = i * Math.PI / 15;
- var value = Math.sin(phase);
- var peakIndex = Math.floor((phase + Math.PI / 2) / (2 * Math.PI));
- var base = peakIndex % 2 === 0 ? undefined : -1 + value / 1.5;
- var point = new ChartPoint(event, i - 30, value, base);
- points.push(point);
- }
- var axis = new ChartAxis(-1, 1);
- return new ChartSeries(points, axis, renderingConfig);
- }
-
- function drawSeriesWithDetails(test, series, highDetails) {
- var div = document.createElement('div');
- var canvas = document.createElement('canvas');
- div.appendChild(canvas);
-
- var pixelRatio = window.devicePixelRatio || 1;
-
- canvas.width = CANVAS_WIDTH * pixelRatio;
- canvas.style.width = CANVAS_WIDTH + 'px';
- canvas.height = CANVAS_HEIGHT * pixelRatio;
- canvas.style.height = CANVAS_HEIGHT + 'px';
-
- var displayTransform = new TimelineDisplayTransform();
- displayTransform.scaleX = CANVAS_WIDTH * pixelRatio / 60;
- displayTransform.panX = 30;
-
- var transform = new ChartTransform(
- displayTransform,
- series.axis,
- CANVAS_WIDTH * pixelRatio,
- CANVAS_HEIGHT * pixelRatio,
- 10 * pixelRatio,
- 10 * pixelRatio,
- pixelRatio);
-
- series.draw(canvas.getContext('2d'), transform, highDetails);
-
- test.addHTMLOutput(div);
- }
-
- function drawSeries(test, series) {
- drawSeriesWithDetails(test, series, false);
- drawSeriesWithDetails(test, series, true);
- }
-
- test('instantiate_defaultConfig', function() {
- var series = buildSeries(undefined);
- drawSeries(this, series);
- });
-
- test('instantiate_lineChart', function() {
- var series = buildSeries({
- chartType: ChartSeriesType.LINE,
- colorId: 4,
- unselectedPointSize: 6,
- lineWidth: 2,
- unselectedPointDensityOpaque: 0.08
- });
- drawSeries(this, series);
- });
-
- test('instantiate_areaChart', function() {
- var series = buildSeries({
- chartType: ChartSeriesType.AREA,
- colorId: 2,
- backgroundOpacity: 0.2
- });
- drawSeries(this, series);
- });
-
- test('instantiate_largeSkipDistance', function() {
- var series = buildSeries({
- chartType: ChartSeriesType.AREA,
- colorId: 1,
- skipDistance: 40,
- unselectedPointDensityTransparent: 0.07
- });
- drawSeries(this, series);
- });
-
- test('instantiate_selection', function() {
- var series = buildSeries({
- chartType: ChartSeriesType.AREA,
- colorId: 10
- });
- series.points.forEach(function(point, index) {
- point.modelItem.selectionState = index % 4;
- });
- drawSeries(this, series);
- });
-
- test('instantiate_selectionWithAllConfigFlags', function() {
- var series = buildSeries({
- chartType: ChartSeriesType.AREA,
- selectedPointSize: 10,
- unselectedPointSize: 6,
- colorId: 15,
- lineWidth: 2,
- skipDistance: 25,
- unselectedPointDensityOpaque: 0.07,
- unselectedPointDensityTransparent: 0.09,
- backgroundOpacity: 0.8
- });
- series.points.forEach(function(point, index) {
- point.modelItem.selectionState = index % 4;
- });
- drawSeries(this, series);
- });
-
- test('checkRange', function() {
- var series = buildSeries();
- var range = series.range;
- assert.isFalse(range.isEmpty);
- assert.closeTo(range.min, -1, 0.05);
- assert.closeTo(range.max, 1, 0.05);
- });
-
- test('checkaddIntersectingEventsInRangeToSelectionInWorldSpace', function() {
- var series = buildSeries();
-
- // Too far left.
- var sel = new EventSet();
- series.addIntersectingEventsInRangeToSelectionInWorldSpace(
- -1000, -30.5, 40, sel);
- assert.lengthOf(sel, 0);
-
- // Select first point.
- var sel = new EventSet();
- series.addIntersectingEventsInRangeToSelectionInWorldSpace(
- -30.5, -29.5, 40, sel);
- assert.lengthOf(sel, 1);
- assert.equal(sel[0].index, 0);
-
- // Select second point.
- var sel = new EventSet();
- series.addIntersectingEventsInRangeToSelectionInWorldSpace(
- -28.8, -28.2, 40, sel);
- assert.lengthOf(sel, 1);
- assert.equal(sel[0].index, 1);
-
- // Select points in the middle.
- var sel = new EventSet();
- series.addIntersectingEventsInRangeToSelectionInWorldSpace(
- -0.99, 1.01, 40, sel);
- assert.lengthOf(sel, 3);
- assert.equal(sel[0].index, 29);
- assert.equal(sel[1].index, 30);
- assert.equal(sel[2].index, 31);
-
- // Select the last point.
- var sel = new EventSet();
- series.addIntersectingEventsInRangeToSelectionInWorldSpace(
- 668.99, 668.99, 40, sel);
- assert.lengthOf(sel, 1);
- assert.equal(sel[0].index, 59);
-
- // Too far right.
- var sel = new EventSet();
- series.addIntersectingEventsInRangeToSelectionInWorldSpace(
- 669.01, 2000, 40, sel);
- assert.lengthOf(sel, 0);
-
- // Select everything.
- var sel = new EventSet();
- series.addIntersectingEventsInRangeToSelectionInWorldSpace(
- -29.01, 669.01, 40, sel);
- assert.lengthOf(sel, 60);
- });
-
- test('checkaddEventNearToProvidedEventToSelection', function() {
- var series = buildSeries();
-
- // Invalid event.
- var sel = new EventSet();
- assert.isFalse(series.addEventNearToProvidedEventToSelection(
- new Event(), 1, sel));
- assert.lengthOf(sel, 0);
-
- var sel = new EventSet();
- assert.isFalse(series.addEventNearToProvidedEventToSelection(
- new Event(), -1, sel));
- assert.lengthOf(sel, 0);
-
- // First point.
- var sel = new EventSet();
- assert.isTrue(series.addEventNearToProvidedEventToSelection(
- series.points[0].modelItem, 1, sel));
- assert.lengthOf(sel, 1);
- assert.equal(sel[0].index, 1);
-
- var sel = new EventSet();
- assert.isFalse(series.addEventNearToProvidedEventToSelection(
- series.points[0].modelItem, -1, sel));
- assert.lengthOf(sel, 0);
-
- // Middle point.
- var sel = new EventSet();
- assert.isTrue(series.addEventNearToProvidedEventToSelection(
- series.points[30].modelItem, 1, sel));
- assert.lengthOf(sel, 1);
- assert.equal(sel[0].index, 31);
-
- var sel = new EventSet();
- assert.isTrue(series.addEventNearToProvidedEventToSelection(
- series.points[30].modelItem, -1, sel));
- assert.lengthOf(sel, 1);
- assert.equal(sel[0].index, 29);
-
- // Last point.
- var sel = new EventSet();
- assert.isFalse(series.addEventNearToProvidedEventToSelection(
- series.points[59].modelItem, 1, sel));
- assert.lengthOf(sel, 0);
-
- var sel = new EventSet();
- assert.isTrue(series.addEventNearToProvidedEventToSelection(
- series.points[59].modelItem, -1, sel));
- assert.lengthOf(sel, 1);
- assert.equal(sel[0].index, 58);
- });
-
- test('checkAddClosestEventToSelection', function() {
- var series = buildSeries();
-
- // Left of first point.
- var sel = new EventSet();
- series.addClosestEventToSelection(-40, 9, -0.5, 0.5, sel);
- assert.lengthOf(sel, 0);
-
- var sel = new EventSet();
- series.addClosestEventToSelection(-40, 11, -0.5, 0.5, sel);
- assert.lengthOf(sel, 1);
- assert.equal(sel[0].index, 0);
-
- // Between two points.
- var sel = new EventSet();
- series.addClosestEventToSelection(0.4, 0.3, -0.5, 0.5, sel);
- assert.lengthOf(sel, 0);
-
- var sel = new EventSet();
- series.addClosestEventToSelection(0.4, 0.4, -0.5, 0.5, sel);
- assert.lengthOf(sel, 1);
- assert.equal(sel[0].index, 30);
-
- // Right of last point.
- var sel = new EventSet();
- series.addClosestEventToSelection(40, 10, -0.5, 0.5, sel);
- assert.lengthOf(sel, 0);
-
- var sel = new EventSet();
- series.addClosestEventToSelection(40, 12, -0.5, 0.5, sel);
- assert.lengthOf(sel, 1);
- assert.equal(sel[0].index, 59);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_track.html
deleted file mode 100644
index 86e80ae1cde..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_track.html
+++ /dev/null
@@ -1,241 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/tracks/chart_transform.html">
-<link rel="import" href="/tracing/ui/tracks/track.html">
-<link rel="import" href="/tracing/ui/base/heading.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<style>
-.chart-track {
- height: 30px;
- position: relative;
-}
-</style>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- /**
- * A track that displays a chart.
- *
- * @constructor
- * @extends {Track}
- */
- var ChartTrack =
- tr.ui.b.define('chart-track', tr.ui.tracks.Track);
-
- ChartTrack.prototype = {
- __proto__: tr.ui.tracks.Track.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.Track.prototype.decorate.call(this, viewport);
- this.classList.add('chart-track');
- this.series_ = undefined;
-
- // GUID -> {axis: ChartAxis, series: [ChartSeries]}.
- this.axisGuidToAxisData_ = undefined;
-
- // The maximum top and bottom padding of all series.
- this.topPadding_ = undefined;
- this.bottomPadding_ = undefined;
-
- this.heading_ = document.createElement('tr-ui-heading');
- this.appendChild(this.heading_);
- },
-
- set heading(heading) {
- this.heading_.heading = heading;
- },
-
- get heading() {
- return this.heading_.heading;
- },
-
- set tooltip(tooltip) {
- this.heading_.tooltip = tooltip;
- },
-
- get series() {
- return this.series_;
- },
-
- /**
- * Set the list of chart series to be displayed on this track. The list
- * is assumed to be sorted in increasing z-order (i.e. the last series in
- * the list will be drawn at the top).
- */
- set series(series) {
- this.series_ = series;
- this.calculateAxisDataAndPadding_();
- this.invalidateDrawingContainer();
- },
-
- get height() {
- return window.getComputedStyle(this).height;
- },
-
- set height(height) {
- this.style.height = height;
- this.invalidateDrawingContainer();
- },
-
- get hasVisibleContent() {
- return !!this.series && this.series.length > 0;
- },
-
- calculateAxisDataAndPadding_: function() {
- if (!this.series_) {
- this.axisGuidToAxisData_ = undefined;
- this.topPadding_ = undefined;
- this.bottomPadding_ = undefined;
- return;
- }
-
- var axisGuidToAxisData = {};
- var topPadding = 0;
- var bottomPadding = 0;
-
- this.series_.forEach(function(series) {
- var axis = series.axis;
- var axisGuid = axis.guid;
- if (!(axisGuid in axisGuidToAxisData)) {
- axisGuidToAxisData[axisGuid] = {
- axis: axis,
- series: []
- };
- }
- axisGuidToAxisData[axisGuid].series.push(series);
- topPadding = Math.max(topPadding, series.topPadding);
- bottomPadding = Math.max(bottomPadding, series.bottomPadding);
- }, this);
-
- this.axisGuidToAxisData_ = axisGuidToAxisData;
- this.topPadding_ = topPadding;
- this.bottomPadding_ = bottomPadding;
- },
-
- draw: function(type, viewLWorld, viewRWorld) {
- switch (type) {
- case tr.ui.tracks.DrawType.GENERAL_EVENT:
- this.drawChart_(viewLWorld, viewRWorld);
- break;
- }
- },
-
- drawChart_: function(viewLWorld, viewRWorld) {
- if (!this.series_)
- return;
-
- var ctx = this.context();
-
- // Get track drawing parameters.
- var displayTransform = this.viewport.currentDisplayTransform;
- var pixelRatio = window.devicePixelRatio || 1;
- var bounds = this.getBoundingClientRect();
- var highDetails = this.viewport.highDetails;
-
- // Pre-multiply all device-independent pixel parameters with the pixel
- // ratio to avoid unnecessary recomputation in the performance-critical
- // drawing code.
- var width = bounds.width * pixelRatio;
- var height = bounds.height * pixelRatio;
- var topPadding = this.topPadding_ * pixelRatio;
- var bottomPadding = this.bottomPadding_ * pixelRatio;
-
- // Set up clipping.
- ctx.save();
- ctx.beginPath();
- ctx.rect(0, 0, width, height);
- ctx.clip();
-
- // Draw all series in the increasing z-order.
- this.series_.forEach(function(series) {
- var chartTransform = new tr.ui.tracks.ChartTransform(
- displayTransform, series.axis, width, height, topPadding,
- bottomPadding, pixelRatio);
- series.draw(ctx, chartTransform, highDetails);
- }, this);
-
- // Stop clipping.
- ctx.restore();
- },
-
- addEventsToTrackMap: function(eventToTrackMap) {
- // TODO(petrcermak): Consider adding the series to the track map instead
- // of the track (a potential performance optimization).
- this.series_.forEach(function(series) {
- series.points.forEach(function(point) {
- point.addToTrackMap(eventToTrackMap, this);
- }, this);
- }, this);
- },
-
- addIntersectingEventsInRangeToSelectionInWorldSpace: function(
- loWX, hiWX, viewPixWidthWorld, selection) {
- this.series_.forEach(function(series) {
- series.addIntersectingEventsInRangeToSelectionInWorldSpace(
- loWX, hiWX, viewPixWidthWorld, selection);
- }, this);
- },
-
- addEventNearToProvidedEventToSelection: function(event, offset, selection) {
- var foundItem = false;
- this.series_.forEach(function(series) {
- foundItem = foundItem || series.addEventNearToProvidedEventToSelection(
- event, offset, selection);
- }, this);
- return foundItem;
- },
-
- addAllEventsMatchingFilterToSelection: function(filter, selection) {
- // Do nothing.
- },
-
- addClosestEventToSelection: function(worldX, worldMaxDist, loY, hiY,
- selection) {
- this.series_.forEach(function(series) {
- series.addClosestEventToSelection(
- worldX, worldMaxDist, loY, hiY, selection);
- }, this);
- },
-
- /**
- * Automatically set the bounds of all axes on this track from the range of
- * values of all series (in this track) associated with each of them.
- *
- * See the description of ChartAxis.autoSetFromRange for the optional
- * configuration argument flags.
- */
- autoSetAllAxes: function(opt_config) {
- tr.b.iterItems(this.axisGuidToAxisData_, function(axisGuid, axisData) {
- var axis = axisData.axis;
- var series = axisData.series;
- axis.autoSetFromSeries(series, opt_config);
- }, this);
- },
-
- /**
- * Automatically set the bounds of the provided axis from the range of
- * values of all series (in this track) associated with it.
- *
- * See the description of ChartAxis.autoSetFromRange for the optional
- * configuration argument flags.
- */
- autoSetAxis: function(axis, opt_config) {
- var series = this.axisGuidToAxisData_[axis.guid].series;
- axis.autoSetFromSeries(series, opt_config);
- }
- };
-
- return {
- ChartTrack: ChartTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_track_test.html
deleted file mode 100644
index 7595a2e2cd7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_track_test.html
+++ /dev/null
@@ -1,236 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/selection_state.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-<link rel="import" href="/tracing/ui/tracks/chart_axis.html">
-<link rel="import" href="/tracing/ui/tracks/chart_point.html">
-<link rel="import" href="/tracing/ui/tracks/chart_series.html">
-<link rel="import" href="/tracing/ui/tracks/chart_track.html">
-<link rel="import" href="/tracing/ui/tracks/event_to_track_map.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ChartAxis = tr.ui.tracks.ChartAxis;
- var ChartPoint = tr.ui.tracks.ChartPoint;
- var ChartSeries = tr.ui.tracks.ChartSeries;
- var ChartSeriesType = tr.ui.tracks.ChartSeriesType;
- var ChartTrack = tr.ui.tracks.ChartTrack;
- var Event = tr.model.Event;
- var EventSet = tr.model.EventSet;
- var EventToTrackMap = tr.ui.tracks.EventToTrackMap;
- var SelectionState = tr.model.SelectionState;
- var Viewport = tr.ui.TimelineViewport;
-
- function buildPoint(x, y) {
- var event = new Event();
- return new ChartPoint(event, x, y);
- }
-
- function buildTrack(opt_viewport) {
- var viewport = opt_viewport || new Viewport(document.createElement('div'));
-
- var axis1 = new ChartAxis(0, 2);
- var axis2 = new ChartAxis(-100, 100);
-
- var points1 = [
- buildPoint(-2.5, 2),
- buildPoint(-1.5, 1),
- buildPoint(-0.5, 0),
- buildPoint(0.5, 1),
- buildPoint(1.5, 2),
- buildPoint(2.5, 0)
- ];
- var renderingConfig1 = {
- chartType: ChartSeriesType.AREA,
- colorId: 6,
- selectedPointSize: 7
- };
- var series1 = new ChartSeries(points1, axis1, renderingConfig1);
-
- var points2 = [
- buildPoint(-2.3, 0.2),
- buildPoint(-1.3, 1.2),
- buildPoint(-0.3, 2.2),
- buildPoint(0.3, 1.2),
- buildPoint(1.3, 0.2),
- buildPoint(2.3, 0)
- ];
- var renderingConfig2 = {
- chartType: ChartSeriesType.AREA,
- colorId: 4,
- selectedPointSize: 10
- };
- var series2 = new ChartSeries(points2, axis1, renderingConfig2);
-
- var points3 = [
- buildPoint(-3, -50),
- buildPoint(-2.4, -40),
- buildPoint(-1.8, -30),
- buildPoint(-1.2, -20),
- buildPoint(-0.6, -10),
- buildPoint(0, 0),
- buildPoint(0.6, 10),
- buildPoint(1.2, 20),
- buildPoint(1.8, 30),
- buildPoint(2.4, 40),
- buildPoint(3, 50)
- ];
- var renderingConfig3 = {
- chartType: ChartSeriesType.LINE,
- lineWidth: 2
- };
- var series3 = new ChartSeries(points3, axis2, renderingConfig3);
-
- var track = new ChartTrack(viewport);
- track.series = [series1, series2, series3];
-
- return track;
- }
-
- test('instantiate_lowDetailsWithoutSelection', function() {
- var div = document.createElement('div');
- var viewport = new Viewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- var track = buildTrack(viewport);
- drawingContainer.appendChild(track);
-
- this.addHTMLOutput(div);
- drawingContainer.invalidate();
-
- var dt = new tr.ui.TimelineDisplayTransform();
- var pixelRatio = window.devicePixelRatio || 1;
- dt.xSetWorldBounds(-3, 3, track.clientWidth * pixelRatio);
- track.viewport.setDisplayTransformImmediately(dt);
-
- track.height = '100px';
- });
-
- test('instantiate_highDetailsWithSelection', function() {
- var div = document.createElement('div');
- var viewport = new Viewport(div);
- viewport.highDetails = true;
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- var track = buildTrack(viewport);
- drawingContainer.appendChild(track);
-
- track.series[0].points[1].modelItem.selectionState =
- SelectionState.SELECTED;
- track.series[1].points[1].modelItem.selectionState =
- SelectionState.SELECTED;
- track.series[2].points[3].modelItem.selectionState =
- SelectionState.SELECTED;
-
- this.addHTMLOutput(div);
- drawingContainer.invalidate();
-
- var dt = new tr.ui.TimelineDisplayTransform();
- var pixelRatio = window.devicePixelRatio || 1;
- dt.xSetWorldBounds(-3, 3, track.clientWidth * pixelRatio);
- track.viewport.setDisplayTransformImmediately(dt);
-
- track.height = '100px';
- });
-
- test('checkPadding', function() {
- var track = buildTrack();
-
- // Padding should be equal to half maximum point size.
- assert.equal(track.topPadding_, 5);
- assert.equal(track.bottomPadding_, 5);
- });
-
- test('checkAddEventsToTrackMap', function() {
- var track = buildTrack();
- var eventToTrackMap = new EventToTrackMap();
- track.addEventsToTrackMap(eventToTrackMap);
- assert.lengthOf(Object.keys(eventToTrackMap), 23);
- });
-
- test('checkaddIntersectingEventsInRangeToSelectionInWorldSpace', function() {
- var track = buildTrack();
-
- var sel = new EventSet();
- track.addIntersectingEventsInRangeToSelectionInWorldSpace(
- -1.1, -0.7, 0.01, sel);
- assert.lengthOf(sel, 3);
- assert.equal(sel[0], track.series[0].points[1].modelItem);
- assert.equal(sel[1], track.series[1].points[1].modelItem);
- assert.equal(sel[2], track.series[2].points[3].modelItem);
- });
-
- test('checkaddEventNearToProvidedEventToSelection', function() {
- var track = buildTrack();
-
- // Fail to find a near item to the left in any series.
- var sel = new EventSet();
- assert.isFalse(track.addEventNearToProvidedEventToSelection(
- track.series[0].points[0].modelItem, -1, sel));
- assert.lengthOf(sel, 0);
-
- // Succeed at finding a near item to the right of one series.
- var sel = new EventSet();
- assert.isTrue(track.addEventNearToProvidedEventToSelection(
- track.series[1].points[1].modelItem, 1, sel));
- assert.lengthOf(sel, 1);
- assert.equal(sel[0], track.series[1].points[2].modelItem);
- });
-
- test('checkAddClosestEventToSelection', function() {
- var track = buildTrack();
-
- var sel = new EventSet();
- track.addClosestEventToSelection(-0.8, 0.4, 0.5, 1.5, sel);
- assert.lengthOf(sel, 2);
- assert.equal(sel[0], track.series[0].points[2].modelItem);
- assert.equal(sel[1], track.series[2].points[4].modelItem);
- });
-
- test('checkAutoSetAllAxes', function() {
- var track = buildTrack();
- var axis1 = track.series[0].axis;
- var axis2 = track.series[2].axis;
-
- track.autoSetAllAxes({expandMax: true, shrinkMax: true});
-
- // Min bounds of both axes should not have been modified.
- assert.equal(axis1.bounds.min, 0);
- assert.equal(axis2.bounds.min, -100);
-
- // Max bounds of both axes should have been modified.
- assert.equal(axis1.bounds.max, 2.2);
- assert.equal(axis2.bounds.max, 50);
- });
-
- test('checkAutoSetAxis', function() {
- var track = buildTrack();
- var axis1 = track.series[0].axis;
- var axis2 = track.series[2].axis;
-
- track.autoSetAxis(axis2,
- {expandMin: true, shrinkMin: true, expandMax: true, shrinkMax: true});
-
- // First axis should not have been modified.
- assert.equal(axis1.bounds.min, 0);
- assert.equal(axis1.bounds.max, 2);
-
- // Second axis should have been modified.
- assert.equal(axis2.bounds.min, -50);
- assert.equal(axis2.bounds.max, 50);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_transform.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_transform.html
deleted file mode 100644
index ff98f4057e0..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_transform.html
+++ /dev/null
@@ -1,84 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- /**
- * A helper object encapsulating all parameters necessary to draw a chart
- * series and provides conversion between world coordinates and physical
- * pixels.
- *
- * All parameters (except for pixelRatio) are assumed to be in physical pixels
- * (i.e. already pre-multiplied with pixelRatio).
- *
- * The diagram below explains the meaning of the resulting fields with
- * respect to a chart track:
- *
- * outerTopViewY -> +--------------------/-\-------+ <- Top padding
- * innerTopViewY -> + - - - - - - - - - -| |- - - -+ <- Axis max
- * | .. ==\-/== |
- * | == Series == |
- * | ==/-\== .. |
- * innerBottomViewY -> + - - -Point- - - - - - - - - -+ <- Axis min
- * outerBottomViewY -> +-------\-/--------------------+ <- Bottom padding
- * ^ ^
- * leftViewX rightViewX
- * leftTimeStamp rightTimestamp
- *
- * Labels starting with a lower case letter are the resulting fields of the
- * transform object. Labels starting with an upper case letter correspond
- * to the relevant chart track concepts.
- *
- * @constructor
- */
- function ChartTransform(displayTransform, axis, trackWidth,
- trackHeight, topPadding, bottomPadding, pixelRatio) {
- this.pixelRatio = pixelRatio;
-
- // X axis.
- this.leftViewX = 0;
- this.rightViewX = trackWidth;
- this.leftTimestamp = displayTransform.xViewToWorld(this.leftViewX);
- this.rightTimestamp = displayTransform.xViewToWorld(this.rightViewX);
-
- this.displayTransform_ = displayTransform;
-
- // Y axis.
- this.outerTopViewY = 0;
- this.innerTopViewY = topPadding;
- this.innerBottomViewY = trackHeight - bottomPadding;
- this.outerBottomViewY = trackHeight;
-
- this.axis_ = axis;
- this.innerHeight_ = this.innerBottomViewY - this.innerTopViewY;
- };
-
- ChartTransform.prototype = {
- worldXToViewX: function(worldX) {
- return this.displayTransform_.xWorldToView(worldX);
- },
-
- viewXToWorldX: function(viewX) {
- return this.displayTransform_.xViewToWorld(viewX);
- },
-
- worldYToViewY: function(worldY) {
- var innerHeightCoefficient = 1 - this.axis_.valueToUnitRange(worldY);
- return innerHeightCoefficient * this.innerHeight_ + this.innerTopViewY;
- }
- };
-
- return {
- ChartTransform: ChartTransform
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_transform_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_transform_test.html
deleted file mode 100644
index d7652260e09..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/chart_transform_test.html
+++ /dev/null
@@ -1,86 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/ui/timeline_display_transform.html">
-<link rel="import" href="/tracing/ui/tracks/chart_axis.html">
-<link rel="import" href="/tracing/ui/tracks/chart_transform.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var TimelineDisplayTransform = tr.ui.TimelineDisplayTransform;
- var ChartTransform = tr.ui.tracks.ChartTransform;
- var ChartAxis = tr.ui.tracks.ChartAxis;
-
- function buildChartTransform() {
- var displayTransform = new TimelineDisplayTransform();
- displayTransform.panX = -20;
- displayTransform.scaleX = 0.5;
-
- var axis = new ChartAxis(-100, 100);
-
- var chartTransform = new ChartTransform(
- displayTransform,
- axis,
- 500, /* trackWidth */
- 80, /* trackHeight */
- 15, /* topPadding */
- 5, /* bottomPadding */
- 3 /* pixelRatio */);
-
- return chartTransform;
- }
-
- test('checkFields', function() {
- var t = buildChartTransform();
-
- assert.equal(t.pixelRatio, 3);
-
- assert.equal(t.leftViewX, 0);
- assert.equal(t.rightViewX, 500);
- assert.equal(t.leftTimestamp, 20);
- assert.equal(t.rightTimestamp, 1020);
-
- assert.equal(t.outerTopViewY, 0);
- assert.equal(t.innerTopViewY, 15);
- assert.equal(t.innerBottomViewY, 75);
- assert.equal(t.outerBottomViewY, 80);
- });
-
- test('checkWorldXToViewX', function() {
- var t = buildChartTransform();
-
- assert.equal(t.worldXToViewX(-100), -60);
- assert.equal(t.worldXToViewX(0), -10);
- assert.equal(t.worldXToViewX(520), 250);
- assert.equal(t.worldXToViewX(1020), 500);
- assert.equal(t.worldXToViewX(1200), 590);
- });
-
- test('checkViewXToWorldX', function() {
- var t = buildChartTransform();
-
- assert.equal(t.viewXToWorldX(-60), -100);
- assert.equal(t.viewXToWorldX(-10), 0);
- assert.equal(t.viewXToWorldX(250), 520);
- assert.equal(t.viewXToWorldX(500), 1020);
- assert.equal(t.viewXToWorldX(590), 1200);
- });
-
- test('checkWorldYToViewY', function() {
- var t = buildChartTransform();
-
- assert.equal(t.worldYToViewY(-200), 105);
- assert.equal(t.worldYToViewY(-100), 75);
- assert.equal(t.worldYToViewY(0), 45);
- assert.equal(t.worldYToViewY(100), 15);
- assert.equal(t.worldYToViewY(200), -15);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/container_to_track_map.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/container_to_track_map.html
deleted file mode 100644
index bb4b549ae08..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/container_to_track_map.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- /**
- * ContainerToTrackMap is a class to handle building and accessing a map
- * between an EventContainer's stableId and its handling track.
- *
- * @constructor
- */
- function ContainerToTrackMap() {
- this.stableIdToTrackMap_ = {};
- }
-
- ContainerToTrackMap.prototype = {
- addContainer: function(container, track) {
- if (!track)
- throw new Error('Must provide a track.');
- this.stableIdToTrackMap_[container.stableId] = track;
- },
-
- clear: function() {
- this.stableIdToTrackMap_ = {};
- },
-
- getTrackByStableId: function(stableId) {
- return this.stableIdToTrackMap_[stableId];
- }
- };
-
- return {
- ContainerToTrackMap: ContainerToTrackMap
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/container_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/container_track.html
deleted file mode 100644
index cdad43bef5c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/container_track.html
+++ /dev/null
@@ -1,132 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/task.html">
-<link rel="import" href="/tracing/ui/tracks/track.html">
-<link rel="import" href="/tracing/core/filter.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- var Task = tr.b.Task;
-
- /**
- * A generic track that contains other tracks as its children.
- * @constructor
- */
- var ContainerTrack = tr.ui.b.define('container-track', tr.ui.tracks.Track);
- ContainerTrack.prototype = {
- __proto__: tr.ui.tracks.Track.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.Track.prototype.decorate.call(this, viewport);
- },
-
- detach: function() {
- this.textContent = '';
- },
-
- get tracks_() {
- var tracks = [];
- for (var i = 0; i < this.children.length; i++) {
- if (this.children[i] instanceof tr.ui.tracks.Track)
- tracks.push(this.children[i]);
- }
- return tracks;
- },
-
- drawTrack: function(type) {
- this.tracks_.forEach(function(track) {
- track.drawTrack(type);
- });
- },
-
- /**
- * Adds items intersecting the given range to a selection.
- * @param {number} loVX Lower X bound of the interval to search, in
- * viewspace.
- * @param {number} hiVX Upper X bound of the interval to search, in
- * viewspace.
- * @param {number} loY Lower Y bound of the interval to search, in
- * viewspace space.
- * @param {number} hiY Upper Y bound of the interval to search, in
- * viewspace space.
- * @param {Selection} selection Selection to which to add results.
- */
- addIntersectingEventsInRangeToSelection: function(
- loVX, hiVX, loY, hiY, selection) {
- for (var i = 0; i < this.tracks_.length; i++) {
- var trackClientRect = this.tracks_[i].getBoundingClientRect();
- var a = Math.max(loY, trackClientRect.top);
- var b = Math.min(hiY, trackClientRect.bottom);
- if (a <= b)
- this.tracks_[i].addIntersectingEventsInRangeToSelection(
- loVX, hiVX, loY, hiY, selection);
- }
-
- tr.ui.tracks.Track.prototype.addIntersectingEventsInRangeToSelection.
- apply(this, arguments);
- },
-
- addEventsToTrackMap: function(eventToTrackMap) {
- for (var i = 0; i < this.children.length; ++i)
- this.children[i].addEventsToTrackMap(eventToTrackMap);
- },
-
- addAllEventsMatchingFilterToSelection: function(filter, selection) {
- for (var i = 0; i < this.tracks_.length; i++)
- this.tracks_[i].addAllEventsMatchingFilterToSelection(
- filter, selection);
- },
-
- addAllEventsMatchingFilterToSelectionAsTask: function(filter, selection) {
- var task = new Task();
- for (var i = 0; i < this.tracks_.length; i++) {
- task.subTask(function(i) { return function() {
- this.tracks_[i].addAllEventsMatchingFilterToSelection(
- filter, selection);
- } }(i), this);
- }
- return task;
- },
-
- addClosestEventToSelection: function(
- worldX, worldMaxDist, loY, hiY, selection) {
- for (var i = 0; i < this.tracks_.length; i++) {
- var trackClientRect = this.tracks_[i].getBoundingClientRect();
- var a = Math.max(loY, trackClientRect.top);
- var b = Math.min(hiY, trackClientRect.bottom);
- if (a <= b) {
- this.tracks_[i].addClosestEventToSelection(
- worldX, worldMaxDist, loY, hiY, selection);
- }
- }
-
- tr.ui.tracks.Track.prototype.addClosestEventToSelection.
- apply(this, arguments);
- },
-
- addContainersToTrackMap: function(containerToTrackMap) {
- this.tracks_.forEach(function(track) {
- track.addContainersToTrackMap(containerToTrackMap);
- });
- },
-
- clearTracks_: function() {
- this.tracks_.forEach(function(track) {
- this.removeChild(track);
- }, this);
- }
- };
-
- return {
- ContainerTrack: ContainerTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/counter_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/counter_track.html
deleted file mode 100644
index 759b2433596..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/counter_track.html
+++ /dev/null
@@ -1,80 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/tracks/chart_axis.html">
-<link rel="import" href="/tracing/ui/tracks/chart_point.html">
-<link rel="import" href="/tracing/ui/tracks/chart_series.html">
-<link rel="import" href="/tracing/ui/tracks/chart_track.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- /**
- * A track that displays a Counter object.
- * @constructor
- * @extends {ChartTrack}
- */
- var CounterTrack = tr.ui.b.define('counter-track', tr.ui.tracks.ChartTrack);
-
- CounterTrack.prototype = {
- __proto__: tr.ui.tracks.ChartTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.ChartTrack.prototype.decorate.call(this, viewport);
- this.classList.add('counter-track');
- },
-
- get counter() {
- return this.chart;
- },
-
- set counter(counter) {
- this.heading = counter.name + ': ';
- this.series = CounterTrack.buildChartSeriesFromCounter(counter);
- this.autoSetAllAxes({expandMax: true});
- },
-
- getModelEventFromItem: function(chartValue) {
- return chartValue;
- }
- };
-
- CounterTrack.buildChartSeriesFromCounter = function(counter) {
- var numSeries = counter.series.length;
- var totals = counter.totals;
-
- // Create one common axis for all series.
- var chartAxis = new tr.ui.tracks.ChartAxis(0, undefined);
-
- // Build one chart series for each counter series.
- var chartSeries = counter.series.map(function(series, seriesIndex) {
- var chartPoints = series.samples.map(function(sample, sampleIndex) {
- var total = totals[sampleIndex * numSeries + seriesIndex];
- return new tr.ui.tracks.ChartPoint(sample, sample.timestamp, total);
- });
- var renderingConfig = {
- chartType: tr.ui.tracks.ChartSeriesType.AREA,
- colorId: series.color
- };
- return new tr.ui.tracks.ChartSeries(
- chartPoints, chartAxis, renderingConfig);
- });
-
- // Show the first series (with the smallest cumulative value) at the top.
- chartSeries.reverse();
-
- return chartSeries;
- };
-
- return {
- CounterTrack: CounterTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/counter_track_perf_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/counter_track_perf_test.html
deleted file mode 100644
index afa3ad3f967..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/counter_track_perf_test.html
+++ /dev/null
@@ -1,129 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/extras/full_config.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- function getSynchronous(url) {
- var req = new XMLHttpRequest();
- req.open('GET', url, false);
- // Without the mime type specified like this, the file's bytes are not
- // retrieved correctly.
- req.overrideMimeType('text/plain; charset=x-user-defined');
- req.send(null);
- return req.responseText;
- }
-
- var ZOOM_STEPS = 10;
- var ZOOM_COEFFICIENT = 1.2;
-
- var model = undefined;
-
- var drawingContainer;
- var viewportDiv;
-
- var viewportWidth;
- var worldMid;
-
- var startScale = undefined;
-
- function timedCounterTrackPerfTest(name, testFn, iterations) {
-
- function setUpOnce() {
- if (model !== undefined)
- return;
- var fileUrl = '/test_data/counter_tracks.html';
- var events = getSynchronous(fileUrl);
- model = tr.c.TestUtils.newModelWithEvents([events]);
- }
-
- function setUp() {
- setUpOnce();
- viewportDiv = document.createElement('div');
-
- var viewport = new tr.ui.TimelineViewport(viewportDiv);
-
- drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- viewport.modelTrackContainer = drawingContainer;
-
- var modelTrack = new tr.ui.tracks.ModelTrack(viewport);
- drawingContainer.appendChild(modelTrack);
-
- modelTrack.model = model;
-
- viewportDiv.appendChild(drawingContainer);
-
- this.addHTMLOutput(viewportDiv);
-
- // Size the canvas.
- drawingContainer.updateCanvasSizeIfNeeded_();
-
- // Size the viewport.
- viewportWidth = drawingContainer.canvas.width;
- var min = model.bounds.min;
- var range = model.bounds.range;
- worldMid = min + range / 2;
-
- var boost = range * 0.15;
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(min - boost, min + range + boost, viewportWidth);
- modelTrack.viewport.setDisplayTransformImmediately(dt);
- startScale = dt.scaleX;
-
- // Select half of the counter samples.
- for (var pid in model.processes) {
- var counters = model.processes[pid].counters;
- for (var cid in counters) {
- var series = counters[cid].series;
- for (var i = 0; i < series.length; i++) {
- var samples = series[i].samples;
- for (var j = Math.floor(samples.length / 2); j < samples.length;
- j++) {
- samples[j].selectionState =
- tr.model.SelectionState.SELECTED;
- }
- }
- }
- }
- };
-
- function tearDown() {
- viewportDiv.innerText = '';
- drawingContainer = undefined;
- }
-
- timedPerfTest(name, testFn, {
- setUp: setUp,
- tearDown: tearDown,
- iterations: iterations
- });
- }
-
- var n110100 = [1, 10, 100];
- n110100.forEach(function(val) {
- timedCounterTrackPerfTest(
- 'draw_softwareCanvas_' + val,
- function() {
- var scale = startScale;
- for (var i = 0; i < ZOOM_STEPS; i++) {
- var dt = drawingContainer.viewport.currentDisplayTransform.clone();
- scale *= ZOOM_COEFFICIENT;
- dt.scaleX = scale;
- dt.xPanWorldPosToViewPos(worldMid, 'center', viewportWidth);
- drawingContainer.viewport.setDisplayTransformImmediately(dt);
- drawingContainer.draw_();
- }
- }, val);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/counter_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/counter_track_test.html
deleted file mode 100644
index 8cf6dcdfa00..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/counter_track_test.html
+++ /dev/null
@@ -1,201 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ColorScheme = tr.b.ColorScheme;
- var Counter = tr.model.Counter;
- var Viewport = tr.ui.TimelineViewport;
- var CounterTrack = tr.ui.tracks.CounterTrack;
-
- var runTest = function(timestamps, samples, testFn) {
- var testEl = document.createElement('div');
-
- var ctr = new Counter(undefined, 'foo', '', 'foo');
- var n = samples.length;
-
- for (var i = 0; i < n; ++i) {
- ctr.addSeries(new tr.model.CounterSeries('value' + i,
- ColorScheme.getColorIdForGeneralPurposeString('value' + i)));
- }
-
- for (var i = 0; i < samples.length; ++i) {
- for (var k = 0; k < timestamps.length; ++k) {
- ctr.series[i].addCounterSample(timestamps[k], samples[i][k]);
- }
- }
-
- ctr.updateBounds();
-
- var viewport = new Viewport(testEl);
-
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- testEl.appendChild(drawingContainer);
-
- var track = new CounterTrack(viewport);
- drawingContainer.appendChild(track);
- this.addHTMLOutput(testEl);
-
- // Force the container to update sizes so the test can use coordinates that
- // make sense. This has to be after the adding of the track as we need to
- // use the track header to figure out our positioning.
- drawingContainer.updateCanvasSizeIfNeeded_();
-
- var pixelRatio = window.devicePixelRatio || 1;
-
- track.heading = ctr.name;
- track.counter = ctr;
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 10, track.clientWidth * pixelRatio);
- track.viewport.setDisplayTransformImmediately(dt);
-
- testFn(ctr, drawingContainer, track);
- };
-
- test('instantiate', function() {
- var ctr = new Counter(undefined, 'testBasicCounter', '',
- 'testBasicCounter');
- ctr.addSeries(new tr.model.CounterSeries('value1',
- ColorScheme.getColorIdForGeneralPurposeString(
- 'testBasicCounter.value1')));
- ctr.addSeries(new tr.model.CounterSeries('value2',
- ColorScheme.getColorIdForGeneralPurposeString(
- 'testBasicCounter.value2')));
-
- var timestamps = [0, 1, 2, 3, 4, 5, 6, 7];
- var samples = [[0, 3, 1, 2, 3, 1, 3, 3.1],
- [5, 3, 1, 1.1, 0, 7, 0, 0.5]];
- for (var i = 0; i < samples.length; ++i) {
- for (var k = 0; k < timestamps.length; ++k) {
- ctr.series[i].addCounterSample(timestamps[k], samples[i][k]);
- }
- }
-
- ctr.updateBounds();
-
- var div = document.createElement('div');
- var viewport = new Viewport(div);
-
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- var track = new CounterTrack(viewport);
- drawingContainer.appendChild(track);
-
- this.addHTMLOutput(div);
- drawingContainer.invalidate();
-
- track.heading = ctr.name;
- track.counter = ctr;
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 7.7, track.clientWidth);
- track.viewport.setDisplayTransformImmediately(dt);
- });
-
- test('basicCounterXPointPicking', function() {
- var timestamps = [0, 1, 2, 3, 4, 5, 6, 7];
- var samples = [[0, 3, 1, 2, 3, 1, 3, 3.1],
- [5, 3, 1, 1.1, 0, 7, 0, 0.5]];
-
- runTest.call(this, timestamps, samples, function(ctr, container, track) {
- var clientRect = track.getBoundingClientRect();
- var y75 = clientRect.top + (0.75 * clientRect.height);
-
- // In bounds.
- var sel = new tr.model.EventSet();
- var x = 0.15 * clientRect.width;
- track.addIntersectingEventsInRangeToSelection(
- x, x + 1, y75, y75 + 1, sel);
-
- var nextSeriesIndex = 1;
- assert.equal(sel.length, 2);
- for (var event of sel) {
- assert.equal(event.series.counter, ctr);
- assert.equal(event.getSampleIndex(), 1);
- assert.equal(event.series.seriesIndex, nextSeriesIndex--);
- }
-
- // Outside bounds.
- sel = new tr.model.EventSet();
- var x = -0.5 * clientRect.width;
- track.addIntersectingEventsInRangeToSelection(
- x, x + 1, y75, y75 + 1, sel);
- assert.equal(sel.length, 0);
-
- sel = new tr.model.EventSet();
- var x = 0.8 * clientRect.width;
- track.addIntersectingEventsInRangeToSelection(
- x, x + 1, y75, y75 + 1, sel);
- assert.equal(sel.length, 0);
- });
- });
-
- test('counterTrackAddClosestEventToSelection', function() {
- var timestamps = [0, 1, 2, 3, 4, 5, 6, 7];
- var samples = [[0, 4, 1, 2, 3, 1, 3, 3.1],
- [5, 3, 1, 1.1, 0, 7, 0, 0.5]];
-
- runTest.call(this, timestamps, samples, function(ctr, container, track) {
- // Before with not range.
- var sel = new tr.model.EventSet();
- track.addClosestEventToSelection(-1, 0, 0, 0, sel);
- assert.equal(sel.length, 0);
-
- // Before with negative range.
- var sel = new tr.model.EventSet();
- track.addClosestEventToSelection(-1, -10, 0, 0, sel);
- assert.equal(sel.length, 0);
-
- // Before first sample.
- var sel = new tr.model.EventSet();
- track.addClosestEventToSelection(-1, 1, 0, 0, sel);
- assert.equal(sel.length, 2);
- for (var event of sel)
- assert.equal(event.getSampleIndex(), 0);
-
- // Between and closer to sample before.
- var sel = new tr.model.EventSet();
- track.addClosestEventToSelection(1.3, 1, 0, 0, sel);
- assert.equal(sel.length, 2);
- for (var event of sel)
- assert.equal(event.getSampleIndex(), 1);
-
- // Between samples with bad range.
- var sel = new tr.model.EventSet();
- track.addClosestEventToSelection(1.45, 0.25, 0, 0, sel);
- assert.equal(sel.length, 0);
-
- // Between and closer to next sample.
- var sel = new tr.model.EventSet();
- track.addClosestEventToSelection(4.7, 6, 0, 0, sel);
- assert.equal(sel.length, 2);
- for (var event of sel)
- assert.equal(event.getSampleIndex(), 5);
-
- // After last sample with good range.
- var sel = new tr.model.EventSet();
- track.addClosestEventToSelection(8.5, 2, 0, 0, sel);
- assert.equal(sel.length, 2);
- for (var event of sel)
- assert.equal(event.getSampleIndex(), 7);
-
- // After last sample with bad range.
- var sel = new tr.model.EventSet();
- track.addClosestEventToSelection(10, 1, 0, 0, sel);
- assert.equal(sel.length, 0);
- });
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_track.html
deleted file mode 100644
index 84b7afe6582..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_track.html
+++ /dev/null
@@ -1,139 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/filter.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/tracks/container_track.html">
-<link rel="import" href="/tracing/ui/tracks/slice_track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- /**
- * Visualizes a Cpu using a series of SliceTracks.
- * @constructor
- */
- var CpuTrack =
- tr.ui.b.define('cpu-track', tr.ui.tracks.ContainerTrack);
- CpuTrack.prototype = {
- __proto__: tr.ui.tracks.ContainerTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.ContainerTrack.prototype.decorate.call(this, viewport);
- this.classList.add('cpu-track');
- this.detailedMode_ = true;
- },
-
- get cpu() {
- return this.cpu_;
- },
-
- set cpu(cpu) {
- this.cpu_ = cpu;
- this.updateContents_();
- },
-
- get detailedMode() {
- return this.detailedMode_;
- },
-
- set detailedMode(detailedMode) {
- this.detailedMode_ = detailedMode;
- this.updateContents_();
- },
-
- get tooltip() {
- return this.tooltip_;
- },
-
- set tooltip(value) {
- this.tooltip_ = value;
- this.updateContents_();
- },
-
- get hasVisibleContent() {
- if (this.cpu_ === undefined)
- return false;
- var cpu = this.cpu_;
- if (cpu.slices.length)
- return true;
- if (cpu.samples && cpu.samples.length)
- return true;
- if (tr.b.dictionaryLength(cpu.counters) > 0)
- return true;
- return false;
- },
-
- updateContents_: function() {
- this.detach();
- if (!this.cpu_)
- return;
- var slices = this.cpu_.slices;
- if (slices.length) {
- var track = new tr.ui.tracks.SliceTrack(this.viewport);
- track.slices = slices;
- track.heading = this.cpu_.userFriendlyName + ':';
- this.appendChild(track);
- }
-
- if (this.detailedMode_) {
- this.appendSamplesTracks_();
-
- for (var counterName in this.cpu_.counters) {
- var counter = this.cpu_.counters[counterName];
- track = new tr.ui.tracks.CounterTrack(this.viewport);
- track.heading = this.cpu_.userFriendlyName + ' ' +
- counter.name + ':';
- track.counter = counter;
- this.appendChild(track);
- }
- }
- },
-
- appendSamplesTracks_: function() {
- var samples = this.cpu_.samples;
- if (samples === undefined || samples.length === 0)
- return;
- var samplesByTitle = {};
- samples.forEach(function(sample) {
- if (samplesByTitle[sample.title] === undefined)
- samplesByTitle[sample.title] = [];
- samplesByTitle[sample.title].push(sample);
- });
-
- var sampleTitles = tr.b.dictionaryKeys(samplesByTitle);
- sampleTitles.sort();
-
- sampleTitles.forEach(function(sampleTitle) {
- var samples = samplesByTitle[sampleTitle];
- var samplesTrack = new tr.ui.tracks.SliceTrack(this.viewport);
- samplesTrack.group = this.cpu_;
- samplesTrack.slices = samples;
- samplesTrack.heading = this.cpu_.userFriendlyName + ': ' +
- sampleTitle;
- samplesTrack.tooltip = this.cpu_.userFriendlyDetails;
- samplesTrack.selectionGenerator = function() {
- var selection = new tr.model.EventSet();
- for (var i = 0; i < samplesTrack.slices.length; i++) {
- selection.push(samplesTrack.slices[i]);
- }
- return selection;
- };
- this.appendChild(samplesTrack);
- }, this);
- }
- };
-
- return {
- CpuTrack: CpuTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_track_test.html
deleted file mode 100644
index 61108d514fc..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_track_test.html
+++ /dev/null
@@ -1,99 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-<link rel="import" href="/tracing/model/model.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Cpu = tr.model.Cpu;
- var CpuTrack = tr.ui.tracks.CpuTrack;
- var Slice = tr.model.Slice;
- var StackFrame = tr.model.StackFrame;
- var Sample = tr.model.Sample;
- var Thread = tr.model.Thread;
- var Viewport = tr.ui.TimelineViewport;
-
- test('basicCpu', function() {
- var cpu = new Cpu({}, 7);
- cpu.slices = [
- new Slice('', 'a', 0, 1, {}, 1),
- new Slice('', 'b', 1, 2.1, {}, 4.8)
- ];
- cpu.updateBounds();
-
- var testEl = document.createElement('div');
- var viewport = new Viewport(testEl);
-
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
-
- var track = new CpuTrack(viewport);
- drawingContainer.appendChild(track);
-
- track.heading = 'CPU ' + cpu.cpuNumber;
- track.cpu = cpu;
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 11.1, track.clientWidth);
- track.viewport.setDisplayTransformImmediately(dt);
- });
-
-
- test('withSamples', function() {
- var thread;
- var cpu;
- var model = tr.c.TestUtils.newModelWithEvents([], {
- shiftWorldToZero: false,
- pruneContainers: false,
- customizeModelCallback: function(model) {
- cpu = model.kernel.getOrCreateCpu(1);
- thread = model.getOrCreateProcess(1).getOrCreateThread(2);
-
- var fA = model.addStackFrame(new StackFrame(
- undefined, 1, 'cat', 'a', 7));
- var fAB = model.addStackFrame(new StackFrame(
- fA, 2, 'cat', 'b', 7));
- var fABC = model.addStackFrame(new StackFrame(
- fAB, 3, 'cat', 'c', 7));
- var fAD = model.addStackFrame(new StackFrame(
- fA, 4, 'cat', 'd', 7));
-
- model.samples.push(new Sample(undefined, thread, 'instructions_retired',
- 10, fABC, 10));
- model.samples.push(new Sample(undefined, thread, 'instructions_retired',
- 20, fAB, 10));
- model.samples.push(new Sample(undefined, thread, 'instructions_retired',
- 30, fAB, 10));
- model.samples.push(new Sample(undefined, thread, 'instructions_retired',
- 40, fAD, 10));
-
- model.samples.push(new Sample(undefined, thread, 'page_fault',
- 25, fAB, 10));
- model.samples.push(new Sample(undefined, thread, 'page_fault',
- 35, fAD, 10));
- }
- });
-
- var testEl = document.createElement('div');
- var viewport = new Viewport(testEl);
-
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
-
- var track = new CpuTrack(viewport);
- drawingContainer.appendChild(track);
-
- track.heading = 'CPU ' + cpu.cpuNumber;
- track.cpu = cpu;
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 11.1, track.clientWidth);
- track.viewport.setDisplayTransformImmediately(dt);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_usage_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_usage_track.html
deleted file mode 100644
index 5845b546984..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_usage_track.html
+++ /dev/null
@@ -1,187 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/tracks/chart_axis.html">
-<link rel="import" href="/tracing/ui/tracks/chart_point.html">
-<link rel="import" href="/tracing/ui/tracks/chart_series.html">
-<link rel="import" href="/tracing/ui/tracks/chart_track.html">
-
-<style>
-.cpu-usage-track {
- height: 90px;
-}
-</style>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- var ColorScheme = tr.b.ColorScheme;
- var ChartTrack = tr.ui.tracks.ChartTrack;
- var MAX_CPU_TRACK_INTERVAL_COUNT = 100000;
-
- /**
- * A track that displays the cpu usage of a process.
- *
- * @constructor
- * @extends {tr.ui.tracks.ChartTrack}
- */
- var CpuUsageTrack = tr.ui.b.define('cpu-usage-track', ChartTrack);
-
- CpuUsageTrack.prototype = {
- __proto__: ChartTrack.prototype,
-
- DEFAULT_INTERVAL: 5, // in ms.
-
- decorate: function(viewport) {
- ChartTrack.prototype.decorate.call(this, viewport);
- this.classList.add('cpu-usage-track');
- this.heading = 'CPU usage';
- this.cpuUsageSeries_ = undefined;
- },
-
- // Given a tr.Model, it creates a cpu usage series and a graph.
- initialize: function(model, interval) {
- if (interval !== undefined)
- this.interval_ = interval;
- else
- this.interval_ = this.DEFAULT_INTERVAL;
- if (model !== undefined)
- this.cpuUsageSeries_ = this.computeCpuUsage_(model);
- else
- this.cpuUsageSeries_ = undefined;
- this.series = this.buildChartSeries_();
- this.autoSetAllAxes({expandMax: true});
- },
-
- // Given a tr.Model, it returns the computation of cpu usage of all the
- // processes.
- computeCpuUsage_: function(model) {
- var intervalCount = Math.ceil(model.bounds.max / this.interval_);
- // Rather than attempting a huge allocation and having the tab crash with
- // an out-of-memory error, throw an error here if there are too many
- // CPU intervals to handle.
- if (intervalCount > MAX_CPU_TRACK_INTERVAL_COUNT) {
- throw new Error('The trace is too long or the CPU usage counter ' +
- 'interval is too small, leading to too many CPU usage intervals.');
- }
- var cpuUsage = undefined;
- if (intervalCount > 0) {
- tr.b.iterItems(model.processes, function(pid, process) {
- // Iterate slices, find all the CPU samples which overlap. For each
- // such CPU sample, increment it of the "average CPU usage" of the
- // slice.
- for (var e of process.getDescendantEvents()) {
- if (!(e instanceof tr.model.ThreadSlice) || e.duration === 0 ||
- e.cpuDuration === undefined) {
- continue;
- }
-
- // This slice contains the most fine-grained CPU usage information
- // for the area of the trace that it covers but that is not covered
- // by its subslices.
- // The math goes this way:
- // s.selfTime : duration of slice s not spent in its subslices.
- // s.cpuSelfTime : cpuDuration over slice s but not its subslices.
- //
- // We're looking for
- // s.cpuSelfTimeRatio: average cpu usage over the area covered by
- // s but not any of its subslices.
- // = s.cpuSelfTime / s.selfTime
- if (e.selfTime === 0 || e.selfTime === undefined ||
- e.cpuSelfTime === undefined) {
- continue;
- }
-
- var cpuSelfTimeRatio = e.cpuSelfTime / e.selfTime;
- cpuSelfTimeRatio = Math.max(0, cpuSelfTimeRatio);
- cpuSelfTimeRatio = Math.min(1, cpuSelfTimeRatio);
- // We have found at least one valid thread slice.
- if (cpuUsage === undefined)
- cpuUsage = new Array(intervalCount).fill(0);
-
- // Go through the area covered by this slice but not its subslices
- // and add the cpuSelfTimeRatio contribution over this area.
- var lastTime = e.start;
- e.subSlices.forEach(function(slice) {
- this.addCPUUsageOverInterval_(cpuUsage, cpuSelfTimeRatio,
- lastTime, slice.start);
- lastTime = slice.end;
- }, this);
- this.addCPUUsageOverInterval_(cpuUsage, cpuSelfTimeRatio, lastTime,
- e.end);
- }
- }, this);
- }
- return cpuUsage || [];
- },
-
- addCPUUsageOverInterval_: function(cpuUsageArray, cpuUsage, start, end) {
- if (start >= end)
- return;
-
- // Simple arithmetic to find the indexes that overlap the current
- // slice.
- var interval = this.interval_;
- var startIndex = Math.floor(start / interval);
- // If the slice stops on an interval, endIndex will be too high.
- // E.g.: start = 5, end = 10, endIndex = floor( 10 / 5 ) = 2.
- // However, the slice is active for only one interval : [5, 10[ .
- var endIndex = Math.ceil(end / interval) - 1;
- var cpuUsagePerTime = cpuUsage / interval;
-
- // Add [startIndex * interval, endIndex * interval] duration.
- for (var i = startIndex; i < endIndex; i++)
- cpuUsageArray[i] += cpuUsage;
-
- // Subtract [startIndex * interval, start] duration.
- cpuUsageArray[startIndex] -= cpuUsagePerTime *
- (start - startIndex * interval);
-
- // Add [endIndex * interval, end] duration.
- cpuUsageArray[endIndex] += cpuUsagePerTime * (end - endIndex * interval);
- },
-
- get hasVisibleContent() {
- return !!this.cpuUsageSeries_ && this.cpuUsageSeries_.length > 0;
- },
-
- addContainersToTrackMap: function(containerToTrackMap) {
- containerToTrackMap.addContainer(this.series_, this);
- },
-
- buildChartSeries_: function() {
- if (!this.hasVisibleContent)
- return [];
-
- var axis = new tr.ui.tracks.ChartAxis(0, undefined);
- var pts = new Array(this.cpuUsageSeries_.length + 1);
-
- // Add all points and an extra one at the end, otherwise the last
- // interval doesn't show up.
- for (var i = 0; i <= this.cpuUsageSeries_.length; i++) {
- pts[i] = new tr.ui.tracks.ChartPoint(undefined, this.interval_ * i,
- this.cpuUsageSeries_[i] || 0);
- }
-
- var renderingConfig = {
- chartType: tr.ui.tracks.ChartSeriesType.AREA,
- colorId: ColorScheme.getColorIdForGeneralPurposeString(this.heading)
- };
-
- return [new tr.ui.tracks.ChartSeries(pts, axis, renderingConfig)];
- }
- };
-
- return {
- CpuUsageTrack: CpuUsageTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_usage_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_usage_track_test.html
deleted file mode 100644
index 0ef7005dcae..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/cpu_usage_track_test.html
+++ /dev/null
@@ -1,240 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/thread_slice.html">
-<link rel='import' href='/tracing/ui/base/constants.html'>
-<link rel='import' href='/tracing/ui/timeline_viewport.html'>
-<link rel="import" href="/tracing/ui/tracks/cpu_usage_track.html">
-<link rel='import' href='/tracing/ui/tracks/drawing_container.html'>
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Model = tr.Model;
- var ThreadSlice = tr.model.ThreadSlice;
- var DIFF_EPSILON = 0.0001;
-
- // Input : slices is an array-of-array-of slices. Each top level array
- // represents a process. So, each slice in one of the top level array
- // will be placed in the same process.
- function buildModel(slices) {
- var model = tr.c.TestUtils.newModel(function(model) {
- var process = model.getOrCreateProcess(1);
- for (var i = 0; i < slices.length; i++) {
- var thread = process.getOrCreateThread(i);
- slices[i].forEach(s => thread.sliceGroup.pushSlice(s));
- }
- });
- return model;
- }
-
- // Compare float arrays based on an epsilon since floating point arithmetic
- // is not always 100% accurate.
- function assertArrayValuesCloseTo(actualValue, expectedValue) {
- assert.lengthOf(actualValue, expectedValue.length);
- for (var i = 0; i < expectedValue.length; i++)
- assert.closeTo(actualValue[i], expectedValue[i], DIFF_EPSILON);
- }
-
- function createCpuUsageTrack(model, interval) {
- var div = document.createElement('div');
- var viewport = new tr.ui.TimelineViewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
- var track = new tr.ui.tracks.CpuUsageTrack(drawingContainer.viewport);
- if (model !== undefined)
- setDisplayTransformFromBounds(viewport, model.bounds);
- track.initialize(model, interval);
- drawingContainer.appendChild(track);
- this.addHTMLOutput(drawingContainer);
- return track;
- }
-
- /**
- * Sets the mapping between the input range of timestamps and the output range
- * of horizontal pixels.
- */
- function setDisplayTransformFromBounds(viewport, bounds) {
- var dt = new tr.ui.TimelineDisplayTransform();
- var pixelRatio = window.devicePixelRatio || 1;
- var chartPixelWidth =
- (window.innerWidth - tr.ui.b.constants.HEADING_WIDTH) * pixelRatio;
- dt.xSetWorldBounds(bounds.min, bounds.max, chartPixelWidth);
- viewport.setDisplayTransformImmediately(dt);
- };
-
- test('computeCpuUsage_simpleOnBoundaries', function() {
- // First thread.
- // 0 5 10 15 20 25 30 35 40 45 50 55
- // [ sliceA ]
- // [ sliceB ] [C]
- var sliceA = new tr.model.ThreadSlice('', title, 0, 5, {}, 50);
- sliceA.cpuDuration = 25;
- var sliceB = new tr.model.ThreadSlice('', title, 0, 10, {}, 30);
- sliceB.cpuDuration = 15;
- // The slice completely fits into an interval and is the last.
- var sliceC = new tr.model.ThreadSlice('', title, 0, 52, {}, 3);
- sliceC.cpuDuration = 3;
-
- // Second thread.
- // 0 5 10 15 20 25 30 35 40 45 50 55
- // [ sliceE ][ sliceD ]
- var sliceD = new tr.model.ThreadSlice('', title, 0, 15, {}, 20);
- sliceD.cpuDuration = 17;
- var sliceE = new tr.model.ThreadSlice('', title, 0, 5, {}, 10);
- sliceE.cpuDuration = 9;
-
- var model = buildModel([[sliceA, sliceB, sliceC], [sliceD, sliceE]]);
-
- // Compute average CPU usage over A (but not over B and C).
- var avgCpuUsageA = sliceA.cpuSelfTime / sliceA.selfTime;
- // Compute average CPU usage over B, C, D, E. They don't have subslices.
- var avgCpuUsageB = sliceB.cpuDuration / sliceB.duration;
- var avgCpuUsageC = sliceC.cpuDuration / sliceC.duration;
- var avgCpuUsageD = sliceD.cpuDuration / sliceD.duration;
- var avgCpuUsageE = sliceE.cpuDuration / sliceE.duration;
-
- var expectedValue = [
- 0,
- avgCpuUsageA + avgCpuUsageE,
- avgCpuUsageB + avgCpuUsageE,
- avgCpuUsageB + avgCpuUsageD,
- avgCpuUsageB + avgCpuUsageD,
- avgCpuUsageB + avgCpuUsageD,
- avgCpuUsageB + avgCpuUsageD,
- avgCpuUsageB,
- avgCpuUsageA,
- avgCpuUsageA,
- avgCpuUsageA * 2.0 / 5 + avgCpuUsageC * 3.0 / 5.0,
- 0 // Extra point added to make the last interval show up.
- ];
- var track = createCpuUsageTrack.call(this, model, 5);
- var actualValue = track.series[0].points.map(point => point.y);
- assertArrayValuesCloseTo(actualValue, expectedValue);
- });
-
- test('computeCpuUsage_tooManyIntervals', function() {
- var sliceA = new tr.model.ThreadSlice('', title, 0, 5, {}, 50);
- sliceA.cpuDuration = 25;
- var sliceB = new tr.model.ThreadSlice(
- '', title, 0, 50000010, {}, 50000030);
- sliceB.cpuDuration = 15;
-
- var model = buildModel([[sliceA, sliceB]]);
-
- assert.throws(() => createCpuUsageTrack.call(this, model, 5));
- });
-
- test('computeCpuUsage_floatAndComplexIntervals', function() {
- // First thread.
- // 0 5 10 15 20 25 30 35 40 45 50 55
- // [ sliceA ]
- // [B]
- var sliceA = new tr.model.ThreadSlice('', title, 0, 5.5111, {}, 47.1023);
- sliceA.cpuDuration = 25;
- var sliceB = new tr.model.ThreadSlice('', title, 0, 11.2384, {}, 1.8769);
- sliceB.cpuDuration = 1.5;
-
- // Second thread.
- // 0 5 10 15 20 25 30 35 40 45 50 55
- // [ C ] [ D ]
- var sliceC = new tr.model.ThreadSlice('', title, 0, 11.239, {}, 5.8769);
- sliceC.cpuDuration = 5;
- var sliceD = new tr.model.ThreadSlice('', title, 0, 48.012, {}, 5.01);
- sliceD.cpuDuration = 4;
-
- var model = buildModel([[sliceA, sliceB], [sliceC, sliceD]]);
-
- // Compute average CPU usage over A (but not over B and C).
- var avgCpuUsageA = sliceA.cpuSelfTime / sliceA.selfTime;
- // Compute average CPU usage over B, C, D. They don't have subslices.
- var avgCpuUsageB = sliceB.cpuDuration / sliceB.duration;
- var avgCpuUsageC = sliceC.cpuDuration / sliceC.duration;
- var avgCpuUsageD = sliceD.cpuDuration / sliceD.duration;
-
- var expectedValue = [
- 0,
- avgCpuUsageA * (10 - 5.5111) / 5.0,
- avgCpuUsageA * (11.2384 - 10 + 15 - (11.2384 + 1.8769)) / 5.0 +
- avgCpuUsageB * 1.8769 / 5.0 +
- avgCpuUsageC * (15 - 11.239) / 5.0,
- avgCpuUsageA +
- avgCpuUsageC * ((11.239 + 5.8769) - 15) / 5.0,
- avgCpuUsageA,
- avgCpuUsageA,
- avgCpuUsageA,
- avgCpuUsageA,
- avgCpuUsageA,
- avgCpuUsageA +
- avgCpuUsageD * (50 - 48.012) / 5.0,
- avgCpuUsageA * (5.5111 + 47.1023 - 50) / 5.0 +
- avgCpuUsageD * (48.012 + 5.01 - 50) / 5.0,
- 0 // Extra point added to make the last interval show up.
- ];
- var track = createCpuUsageTrack.call(this, model, 5);
- var actualValue = track.series[0].points.map(point => point.y);
- assertArrayValuesCloseTo(actualValue, expectedValue);
- });
-
- test('instantiate', function() {
- var sliceA = new tr.model.ThreadSlice('', title, 0, 5.5111, {}, 47.1023);
- sliceA.cpuDuration = 25;
- var sliceB = new tr.model.ThreadSlice('', title, 0, 11.2384, {}, 1.8769);
- sliceB.cpuDuration = 1.5;
- var sliceC = new tr.model.ThreadSlice('', title, 0, 11.239, {}, 5.8769);
- sliceC.cpuDuration = 5;
- var sliceD = new tr.model.ThreadSlice('', title, 0, 48.012, {}, 5.01);
- sliceD.cpuDuration = 4;
-
- var model = buildModel([[sliceA, sliceB, sliceC, sliceD]]);
- createCpuUsageTrack.call(this, model);
- });
-
- test('hasVisibleContent_trueWithThreadSlicePresent', function() {
- var sliceA = new tr.model.ThreadSlice('', title, 0, 48.012, {}, 5.01);
- sliceA.cpuDuration = 4;
- var model = buildModel([[sliceA]]);
- var track = createCpuUsageTrack.call(this, model);
-
- assert.isTrue(track.hasVisibleContent);
- });
-
- test('hasVisibleContent_falseWithUndefinedProcessModel', function() {
- var track = createCpuUsageTrack.call(this, undefined);
-
- assert.isFalse(track.hasVisibleContent);
- });
-
- test('hasVisibleContent_falseWithNoThreadSlice', function() {
- // model with a CPU and a thread but no ThreadSlice.
- var model = buildModel([]);
- var track = createCpuUsageTrack.call(this, model);
-
- assert.isFalse(track.hasVisibleContent);
- });
-
- test('hasVisibleContent_trueWithSubSlices', function() {
- var sliceA = new tr.model.ThreadSlice('', title, 0, 5.5111, {}, 47.1023);
- sliceA.cpuDuration = 25;
- var sliceB = new tr.model.ThreadSlice('', title, 0, 11.2384, {}, 1.8769);
- sliceB.cpuDuration = 1.5;
-
- var model = buildModel([[sliceA, sliceB]]);
- var process = model.getProcess(1);
- // B will become lowest level slices of A.
- process.getThread(0).sliceGroup.createSubSlices();
- assert.equal(sliceA.cpuSelfTime, (sliceA.cpuDuration - sliceB.cpuDuration));
- var track = createCpuUsageTrack.call(this, model);
-
- assert.isTrue(track.hasVisibleContent);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/device_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/device_track.html
deleted file mode 100644
index dfc6c364eea..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/device_track.html
+++ /dev/null
@@ -1,90 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/tracks/container_track.html">
-<link rel="import" href="/tracing/ui/tracks/power_series_track.html">
-<link rel="import" href="/tracing/ui/tracks/spacing_track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- var ContainerTrack = tr.ui.tracks.ContainerTrack;
-
- // TODO(charliea): Make this track collapsible.
- /**
- * Track to visualize the device model.
- *
- * @constructor
- * @extends {ContainerTrack}
- */
- var DeviceTrack = tr.ui.b.define('device-track', ContainerTrack);
-
- DeviceTrack.prototype = {
-
- __proto__: ContainerTrack.prototype,
-
- decorate: function(viewport) {
- ContainerTrack.prototype.decorate.call(this, viewport);
-
- this.classList.add('device-track');
- this.device_ = undefined;
- this.powerSeriesTrack_ = undefined;
- },
-
- get device() {
- return this.device_;
- },
-
- set device(device) {
- this.device_ = device;
- this.updateContents_();
- },
-
- get powerSeriesTrack() {
- return this.powerSeriesTrack_;
- },
-
- get hasVisibleContent() {
- return (this.powerSeriesTrack_ &&
- this.powerSeriesTrack_.hasVisibleContent);
- },
-
- addContainersToTrackMap: function(containerToTrackMap) {
- tr.ui.tracks.ContainerTrack.prototype.addContainersToTrackMap.call(
- this, containerToTrackMap);
- containerToTrackMap.addContainer(this.device, this);
- },
-
- addEventsToTrackMap: function(eventToTrackMap) {
- this.tracks_.forEach(function(track) {
- track.addEventsToTrackMap(eventToTrackMap);
- });
- },
-
- appendPowerSeriesTrack_: function() {
- this.powerSeriesTrack_ = new tr.ui.tracks.PowerSeriesTrack(this.viewport);
- this.powerSeriesTrack_.powerSeries = this.device.powerSeries;
-
- if (this.powerSeriesTrack_.hasVisibleContent) {
- this.appendChild(this.powerSeriesTrack_);
- this.appendChild(new tr.ui.tracks.SpacingTrack(this.viewport));
- }
- },
-
- updateContents_: function() {
- this.clearTracks_();
- this.appendPowerSeriesTrack_();
- }
- };
-
- return {
- DeviceTrack: DeviceTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/device_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/device_track_test.html
deleted file mode 100644
index ce849355882..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/device_track_test.html
+++ /dev/null
@@ -1,146 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel='import' href='/tracing/model/device.html'>
-<link rel='import' href='/tracing/model/model.html'>
-<link rel="import" href="/tracing/ui/base/constants.html">
-<link rel='import' href='/tracing/ui/timeline_display_transform.html'>
-<link rel='import' href='/tracing/ui/timeline_viewport.html'>
-<link rel='import' href='/tracing/ui/tracks/device_track.html'>
-<link rel='import' href='/tracing/ui/tracks/drawing_container.html'>
-<link rel='import' href='/tracing/ui/tracks/event_to_track_map.html'>
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- var Device = tr.model.Device;
- var DeviceTrack = tr.ui.tracks.DeviceTrack;
- var Model = tr.Model;
- var PowerSeries = tr.model.PowerSeries;
-
- var createDrawingContainer = function(series) {
- var div = document.createElement('div');
- var viewport = new tr.ui.TimelineViewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- if (series) {
- series.updateBounds();
- setDisplayTransformFromBounds(viewport, series.bounds);
- }
-
- return drawingContainer;
- };
-
- /**
- * Sets the mapping between the input range of timestamps and the output range
- * of horizontal pixels.
- */
- var setDisplayTransformFromBounds = function(viewport, bounds) {
- var dt = new tr.ui.TimelineDisplayTransform();
- var pixelRatio = window.devicePixelRatio || 1;
- var chartPixelWidth =
- (window.innerWidth - tr.ui.b.constants.HEADING_WIDTH) * pixelRatio;
- dt.xSetWorldBounds(bounds.min, bounds.max, chartPixelWidth);
- viewport.setDisplayTransformImmediately(dt);
- };
-
- test('instantiate', function() {
- var device = new Device(new Model());
- device.powerSeries = new PowerSeries(device);
- device.powerSeries.addPowerSample(0, 1);
- device.powerSeries.addPowerSample(0.5, 2);
- device.powerSeries.addPowerSample(1, 3);
- device.powerSeries.addPowerSample(1.5, 4);
-
- var drawingContainer = createDrawingContainer(device.powerSeries);
- var track = new DeviceTrack(drawingContainer.viewport);
- track.device = device;
- drawingContainer.appendChild(track);
-
- this.addHTMLOutput(drawingContainer);
- });
-
- test('instantiate_noPowerSeries', function() {
- var device = new Device(new Model());
-
- var drawingContainer = createDrawingContainer(device.powerSeries);
- var track = new DeviceTrack(drawingContainer.viewport);
- track.device = device;
- drawingContainer.appendChild(track);
-
- // Adding output should throw due to no visible content.
- assert.throw(function() { this.addHTMLOutput(drawingContainer); });
- });
-
- test('setDevice_clearsTrackBeforeUpdating', function() {
- var device = new Device(new Model());
- device.powerSeries = new PowerSeries(device);
- device.powerSeries.addPowerSample(0, 1);
- device.powerSeries.addPowerSample(0.5, 2);
- device.powerSeries.addPowerSample(1, 3);
- device.powerSeries.addPowerSample(1.5, 4);
-
- var drawingContainer = createDrawingContainer(device.powerSeries);
-
- // Set the device twice and make sure that this doesn't result in
- // the track appearing twice.
- var track = new DeviceTrack(drawingContainer.viewport);
- track.device = device;
- track.device = device;
- drawingContainer.appendChild(track);
-
- this.addHTMLOutput(drawingContainer);
-
- // The device track should still have two subtracks: one counter track and
- // one spacing track.
- assert.equal(track.tracks_.length, 2);
- });
-
- test('addContainersToTrackMap', function() {
- var device = new Device(new Model());
- device.powerSeries = new PowerSeries(device);
- device.powerSeries.addPowerSample(0, 1);
-
- var drawingContainer = createDrawingContainer(device.series);
- var track = new DeviceTrack(drawingContainer.viewport);
- track.device = device;
-
- var containerToTrackMap = new tr.ui.tracks.ContainerToTrackMap();
- track.addContainersToTrackMap(containerToTrackMap);
-
- assert.equal(containerToTrackMap.getTrackByStableId('Device'), track);
- assert.equal(
- containerToTrackMap.getTrackByStableId('Device.PowerSeries'),
- track.powerSeriesTrack);
- });
-
- test('addEventsToTrackMap', function() {
- var device = new Device(new Model());
- device.powerSeries = new PowerSeries(device);
- device.powerSeries.addPowerSample(0, 1);
- device.powerSeries.addPowerSample(0.5, 2);
-
- var div = document.createElement('div');
- var viewport = new tr.ui.TimelineViewport(div);
-
- var track = new DeviceTrack(viewport);
- track.device = device;
-
- var eventToTrackMap = new tr.ui.tracks.EventToTrackMap();
- track.addEventsToTrackMap(eventToTrackMap);
-
- var expected = new tr.ui.tracks.EventToTrackMap();
- expected[device.powerSeries.samples[0].guid] = track.powerSeriesTrack;
- expected[device.powerSeries.samples[1].guid] = track.powerSeriesTrack;
-
- assert.deepEqual(eventToTrackMap, expected);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/drawing_container.css b/chromium/third_party/catapult/tracing/tracing/ui/tracks/drawing_container.css
deleted file mode 100644
index a4a8cdb5b89..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/drawing_container.css
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-.drawing-container {
- -webkit-box-flex: 1;
- display: inline;
- overflow: auto;
- overflow-x: hidden;
- position: relative;
-}
-
-.drawing-container-canvas {
- -webkit-box-flex: 1;
- display: block;
- pointer-events: none;
- position: absolute;
- top: 0;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/drawing_container.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/drawing_container.html
deleted file mode 100644
index 69a8ca43026..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/drawing_container.html
+++ /dev/null
@@ -1,176 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/tracks/drawing_container.css">
-
-<link rel="import" href="/tracing/base/raf.html">
-<link rel="import" href="/tracing/ui/tracks/track.html">
-<link rel="import" href="/tracing/ui/base/constants.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- var DrawType = {
- GENERAL_EVENT: 1,
- INSTANT_EVENT: 2,
- BACKGROUND: 3,
- GRID: 4,
- FLOW_ARROWS: 5,
- MARKERS: 6,
- HIGHLIGHTS: 7,
- ANNOTATIONS: 8
- };
-
- var DrawingContainer = tr.ui.b.define('drawing-container',
- tr.ui.tracks.Track);
-
- DrawingContainer.prototype = {
- __proto__: tr.ui.tracks.Track.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.Track.prototype.decorate.call(this, viewport);
- this.classList.add('drawing-container');
-
- this.canvas_ = document.createElement('canvas');
- this.canvas_.className = 'drawing-container-canvas';
- this.canvas_.style.left = tr.ui.b.constants.HEADING_WIDTH + 'px';
- this.appendChild(this.canvas_);
-
- this.ctx_ = this.canvas_.getContext('2d');
-
- this.viewportChange_ = this.viewportChange_.bind(this);
- this.viewport.addEventListener('change', this.viewportChange_);
- },
-
- // Needed to support the calls in TimelineTrackView.
- get canvas() {
- return this.canvas_;
- },
-
- context: function() {
- return this.ctx_;
- },
-
- viewportChange_: function() {
- this.invalidate();
- },
-
- invalidate: function() {
- if (this.rafPending_)
- return;
- this.rafPending_ = true;
-
- tr.b.requestPreAnimationFrame(this.preDraw_, this);
- },
-
- preDraw_: function() {
- this.rafPending_ = false;
- this.updateCanvasSizeIfNeeded_();
-
- tr.b.requestAnimationFrameInThisFrameIfPossible(this.draw_, this);
- },
-
- draw_: function() {
- this.ctx_.clearRect(0, 0, this.canvas_.width, this.canvas_.height);
-
- var typesToDraw = [
- DrawType.BACKGROUND,
- DrawType.HIGHLIGHTS,
- DrawType.GRID,
- DrawType.INSTANT_EVENT,
- DrawType.GENERAL_EVENT,
- DrawType.MARKERS,
- DrawType.ANNOTATIONS,
- DrawType.FLOW_ARROWS
- ];
-
- for (var idx in typesToDraw) {
- for (var i = 0; i < this.children.length; ++i) {
- if (!(this.children[i] instanceof tr.ui.tracks.Track))
- continue;
- this.children[i].drawTrack(typesToDraw[idx]);
- }
- }
-
- var pixelRatio = window.devicePixelRatio || 1;
- var bounds = this.canvas_.getBoundingClientRect();
- var dt = this.viewport.currentDisplayTransform;
- var viewLWorld = dt.xViewToWorld(0);
- var viewRWorld = dt.xViewToWorld(
- bounds.width * pixelRatio);
-
- this.viewport.drawGridLines(this.ctx_, viewLWorld, viewRWorld);
- },
-
- updateCanvasSizeIfNeeded_: function() {
- var visibleChildTracks =
- tr.b.asArray(this.children).filter(this.visibleFilter_);
-
- var thisBounds = this.getBoundingClientRect();
-
- var firstChildTrackBounds = visibleChildTracks[0].getBoundingClientRect();
- var lastChildTrackBounds =
- visibleChildTracks[visibleChildTracks.length - 1].
- getBoundingClientRect();
-
- var innerWidth = firstChildTrackBounds.width -
- tr.ui.b.constants.HEADING_WIDTH;
- var innerHeight = lastChildTrackBounds.bottom - firstChildTrackBounds.top;
-
- var pixelRatio = window.devicePixelRatio || 1;
- if (this.canvas_.width != innerWidth * pixelRatio) {
- this.canvas_.width = innerWidth * pixelRatio;
- this.canvas_.style.width = innerWidth + 'px';
- }
-
- if (this.canvas_.height != innerHeight * pixelRatio) {
- this.canvas_.height = innerHeight * pixelRatio;
- this.canvas_.style.height = innerHeight + 'px';
- }
- },
-
- visibleFilter_: function(element) {
- if (!(element instanceof tr.ui.tracks.Track))
- return false;
- return window.getComputedStyle(element).display !== 'none';
- },
-
- addClosestEventToSelection: function(
- worldX, worldMaxDist, loY, hiY, selection) {
- for (var i = 0; i < this.children.length; ++i) {
- if (!(this.children[i] instanceof tr.ui.tracks.Track))
- continue;
- var trackClientRect = this.children[i].getBoundingClientRect();
- var a = Math.max(loY, trackClientRect.top);
- var b = Math.min(hiY, trackClientRect.bottom);
- if (a <= b) {
- this.children[i].addClosestEventToSelection(
- worldX, worldMaxDist, loY, hiY, selection);
- }
- }
-
- tr.ui.tracks.Track.prototype.addClosestEventToSelection.
- apply(this, arguments);
- },
-
- addEventsToTrackMap: function(eventToTrackMap) {
- for (var i = 0; i < this.children.length; ++i) {
- if (!(this.children[i] instanceof tr.ui.tracks.Track))
- continue;
- this.children[i].addEventsToTrackMap(eventToTrackMap);
- }
- }
- };
-
- return {
- DrawingContainer: DrawingContainer,
- DrawType: DrawType
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/drawing_container_perf_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/drawing_container_perf_test.html
deleted file mode 100644
index 9cb3d727c66..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/drawing_container_perf_test.html
+++ /dev/null
@@ -1,136 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/xhr.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/ui/extras/full_config.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var generalModel;
- function getOrCreateGeneralModel() {
- if (generalModel !== undefined)
- generalModel;
- var fileUrl = '/test_data/thread_time_visualisation.json.gz';
- var events = tr.b.getSync(fileUrl);
- generalModel = tr.c.TestUtils.newModelWithEvents([events]);
- return generalModel;
- }
-
- function DCPerfTestCase(testName, opt_options) {
- tr.b.unittest.PerfTestCase.call(this, testName, undefined, opt_options);
- this.viewportDiv = undefined;
- this.drawingContainer = undefined;
- this.viewport = undefined;
- }
- DCPerfTestCase.prototype = {
- __proto__: tr.b.unittest.PerfTestCase.prototype,
-
- setUp: function(model) {
- this.viewportDiv = document.createElement('div');
-
- this.viewport = new tr.ui.TimelineViewport(this.viewportDiv);
-
- this.drawingContainer = new tr.ui.tracks.DrawingContainer(this.viewport);
- this.viewport.modelTrackContainer = this.drawingContainer;
-
- var modelTrack = new tr.ui.tracks.ModelTrack(this.viewport);
- this.drawingContainer.appendChild(modelTrack);
-
- modelTrack.model = model;
-
- this.viewportDiv.appendChild(this.drawingContainer);
-
- this.addHTMLOutput(this.viewportDiv);
-
- // Size the canvas.
- this.drawingContainer.updateCanvasSizeIfNeeded_();
-
- // Size the viewport.
- var w = this.drawingContainer.canvas.width;
- var min = model.bounds.min;
- var range = model.bounds.range;
-
- var boost = range * 0.15;
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(min - boost, min + range + boost, w);
- this.viewport.setDisplayTransformImmediately(dt);
- },
-
- runOneIteration: function() {
- this.drawingContainer.draw_();
- }
- };
-
-
- function GeneralDCPerfTestCase(testName, opt_options) {
- DCPerfTestCase.call(this, testName, opt_options);
- }
-
- GeneralDCPerfTestCase.prototype = {
- __proto__: DCPerfTestCase.prototype,
-
- setUp: function() {
- var model = getOrCreateGeneralModel();
- DCPerfTestCase.prototype.setUp.call(this, model);
- }
- };
-
- // Failing on Chrome canary, see
- // https://github.com/catapult-project/catapult/issues/1826
- flakyTest(new GeneralDCPerfTestCase('draw_softwareCanvas_One',
- {iterations: 1}));
- // Failing on Chrome stable on Windows, see
- // https://github.com/catapult-project/catapult/issues/1908
- flakyTest(new GeneralDCPerfTestCase('draw_softwareCanvas_Ten',
- {iterations: 10}));
- test(new GeneralDCPerfTestCase('draw_softwareCanvas_AHundred',
- {iterations: 100}));
-
- function AsyncDCPerfTestCase(testName, opt_options) {
- DCPerfTestCase.call(this, testName, opt_options);
- }
-
- AsyncDCPerfTestCase.prototype = {
- __proto__: DCPerfTestCase.prototype,
-
- setUp: function() {
- var model = tr.c.TestUtils.newModel(function(m) {
- var proc = m.getOrCreateProcess(1);
- for (var tid = 1; tid <= 5; tid++) {
- var thread = proc.getOrCreateThread(tid);
- for (var i = 0; i < 5000; i++) {
- var mod = Math.floor(i / 100) % 4;
- var slice = tr.c.TestUtils.newAsyncSliceEx({
- name: 'Test' + i,
- colorId: tid + mod,
- id: tr.b.GUID.allocateSimple(),
- start: i * 10,
- duration: 9,
- isTopLevel: true
- });
- thread.asyncSliceGroup.push(slice);
- }
- }
- });
- DCPerfTestCase.prototype.setUp.call(this, model);
-
- var w = this.drawingContainer.canvas.width;
-
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(-2000, 54000, w);
- this.viewport.setDisplayTransformImmediately(dt);
- }
- };
- test(new AsyncDCPerfTestCase('draw_asyncSliceHeavy_Twenty',
- {iterations: 20}));
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/event_to_track_map.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/event_to_track_map.html
deleted file mode 100644
index 27da2820c61..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/event_to_track_map.html
+++ /dev/null
@@ -1,34 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- /**
- * EventToTrackMap provides a mapping mechanism between events and the
- * tracks those events belong on.
- * @constructor
- */
- function EventToTrackMap() {}
-
- EventToTrackMap.prototype = {
- addEvent: function(event, track) {
- if (!track)
- throw new Error('Must provide a track.');
- this[event.guid] = track;
- }
- };
-
- return {
- EventToTrackMap: EventToTrackMap
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/frame_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/frame_track.html
deleted file mode 100644
index c3d6bc6830c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/frame_track.html
+++ /dev/null
@@ -1,72 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/ui/base/event_presenter.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/tracks/letter_dot_track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- var startCompare = function(x, y) { return x.start - y.start; }
-
- /**
- * Track enabling quick selection of frame slices/events.
- * @constructor
- */
- var FrameTrack = tr.ui.b.define(
- 'frame-track', tr.ui.tracks.LetterDotTrack);
-
- FrameTrack.prototype = {
- __proto__: tr.ui.tracks.LetterDotTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.LetterDotTrack.prototype.decorate.call(this, viewport);
- this.heading = 'Frames';
-
- this.frames_ = undefined;
- this.items = undefined;
- },
-
- get frames() {
- return this.frames_;
- },
-
- set frames(frames) {
- this.frames_ = frames;
- if (frames === undefined)
- return;
-
- this.frames_ = this.frames_.slice();
- this.frames_.sort(startCompare);
-
- // letter dots
- this.items = this.frames_.map(function(frame) {
- return new FrameDot(frame);
- });
- }
- };
-
- /**
- * @constructor
- * @extends {LetterDot}
- */
- function FrameDot(frame) {
- tr.ui.tracks.LetterDot.call(this, frame, 'F', frame.colorId, frame.start);
- }
-
- FrameDot.prototype = {
- __proto__: tr.ui.tracks.LetterDot.prototype
- };
-
- return {
- FrameTrack: FrameTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/frame_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/frame_track_test.html
deleted file mode 100644
index 943e245b37c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/frame_track_test.html
+++ /dev/null
@@ -1,106 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/frame.html">
-<link rel="import" href="/tracing/ui/timeline_viewport.html">
-<link rel="import" href="/tracing/ui/tracks/drawing_container.html">
-<link rel="import" href="/tracing/ui/tracks/frame_track.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Frame = tr.model.Frame;
- var FrameTrack = tr.ui.tracks.FrameTrack;
- var EventSet = tr.model.EventSet;
- var SelectionState = tr.model.SelectionState;
- var Viewport = tr.ui.TimelineViewport;
-
- var createFrames = function() {
- var frames = undefined;
- var model = tr.c.TestUtils.newModel(function(model) {
- var process = model.getOrCreateProcess(1);
- var thread = process.getOrCreateThread(1);
- for (var i = 1; i < 5; i++) {
- var slice = tr.c.TestUtils.newSliceEx(
- {title: 'work for frame', start: i * 20, duration: 10});
- thread.sliceGroup.pushSlice(slice);
- var events = [slice];
- var threadTimeRanges =
- [{thread: thread, start: slice.start, end: slice.end}];
- process.frames.push(new Frame(events, threadTimeRanges));
- }
- frames = process.frames;
- });
- return frames;
- };
-
- test('instantiate', function() {
- var frames = createFrames();
- frames[1].selectionState = SelectionState.SELECTED;
-
- var div = document.createElement('div');
- var viewport = new Viewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- var track = FrameTrack(viewport);
- drawingContainer.appendChild(track);
-
- this.addHTMLOutput(div);
- drawingContainer.invalidate();
-
- track.frames = frames;
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 50, track.clientWidth);
- track.viewport.setDisplayTransformImmediately(dt);
-
- assert.equal(track.items[0].start, 20);
- });
-
- test('modelMapping', function() {
- var frames = createFrames();
-
- var div = document.createElement('div');
- var viewport = new Viewport(div);
- var track = FrameTrack(viewport);
- track.frames = frames;
-
- var a0 = track.items[0].modelItem;
- assert.equal(a0, frames[0]);
- });
-
- test('selectionMapping', function() {
- var frames = createFrames();
-
- var div = document.createElement('div');
- var viewport = new Viewport(div);
- var track = FrameTrack(viewport);
- track.frames = frames;
-
- var selection = new EventSet();
- track.items[0].addToSelection(selection);
-
- // select both frame, but not its component slice
- assert.equal(selection.length, 1);
-
- var frameCount = 0;
- var eventCount = 0;
- selection.forEach(function(event) {
- if (event instanceof Frame) {
- assert.equal(event, frames[0]);
- frameCount++;
- } else
- eventCount++;
- });
- assert.equal(frameCount, 1);
- assert.equal(eventCount, 0);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/global_memory_dump_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/global_memory_dump_track.html
deleted file mode 100644
index 0e2e4d54c24..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/global_memory_dump_track.html
+++ /dev/null
@@ -1,102 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/tracks/chart_track.html">
-<link rel="import" href="/tracing/ui/tracks/container_track.html">
-<link rel="import" href="/tracing/ui/tracks/letter_dot_track.html">
-<link rel="import" href="/tracing/ui/tracks/memory_dump_track_util.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- var USED_MEMORY_TRACK_HEIGHT = 50;
- var ALLOCATED_MEMORY_TRACK_HEIGHT = 50;
-
- /**
- * A track that displays an array of GlobalMemoryDump objects.
- * @constructor
- * @extends {ContainerTrack}
- */
- var GlobalMemoryDumpTrack = tr.ui.b.define(
- 'global-memory-dump-track', tr.ui.tracks.ContainerTrack);
-
- GlobalMemoryDumpTrack.prototype = {
- __proto__: tr.ui.tracks.ContainerTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.ContainerTrack.prototype.decorate.call(this, viewport);
- this.memoryDumps_ = undefined;
- },
-
- get memoryDumps() {
- return this.memoryDumps_;
- },
-
- set memoryDumps(memoryDumps) {
- this.memoryDumps_ = memoryDumps;
- this.updateContents_();
- },
-
- updateContents_: function() {
- this.clearTracks_();
-
- // Show no tracks if there are no dumps.
- if (!this.memoryDumps_ || !this.memoryDumps_.length)
- return;
-
- this.appendDumpDotsTrack_();
- this.appendUsedMemoryTrack_();
- this.appendAllocatedMemoryTrack_();
- },
-
- appendDumpDotsTrack_: function() {
- var items = tr.ui.tracks.buildMemoryLetterDots(this.memoryDumps_);
- if (!items)
- return;
-
- var track = new tr.ui.tracks.LetterDotTrack(this.viewport);
- track.heading = 'Memory Dumps';
- track.items = items;
- this.appendChild(track);
- },
-
- appendUsedMemoryTrack_: function() {
- var series = tr.ui.tracks.buildGlobalUsedMemoryChartSeries(
- this.memoryDumps_);
- if (!series)
- return;
-
- var track = new tr.ui.tracks.ChartTrack(this.viewport);
- track.heading = 'Memory per process';
- track.height = USED_MEMORY_TRACK_HEIGHT + 'px';
- track.series = series;
- track.autoSetAllAxes({expandMax: true});
- this.appendChild(track);
- },
-
- appendAllocatedMemoryTrack_: function() {
- var series = tr.ui.tracks.buildGlobalAllocatedMemoryChartSeries(
- this.memoryDumps_);
- if (!series)
- return;
-
- var track = new tr.ui.tracks.ChartTrack(this.viewport);
- track.heading = 'Memory per component';
- track.height = ALLOCATED_MEMORY_TRACK_HEIGHT + 'px';
- track.series = series;
- track.autoSetAllAxes({expandMax: true});
- this.appendChild(track);
- }
- };
-
- return {
- GlobalMemoryDumpTrack: GlobalMemoryDumpTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/global_memory_dump_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/global_memory_dump_track_test.html
deleted file mode 100644
index 268da37bcf7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/global_memory_dump_track_test.html
+++ /dev/null
@@ -1,61 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/ui/timeline_viewport.html">
-<link rel="import" href="/tracing/ui/tracks/drawing_container.html">
-<link rel="import" href="/tracing/ui/tracks/global_memory_dump_track.html">
-<link rel="import" href="/tracing/ui/tracks/memory_dump_track_test_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Viewport = tr.ui.TimelineViewport;
- var GlobalMemoryDumpTrack = tr.ui.tracks.GlobalMemoryDumpTrack;
- var createTestGlobalMemoryDumps = tr.ui.tracks.createTestGlobalMemoryDumps;
-
- function instantiateTrack(withVMRegions, withAllocatorDumps,
- expectedTrackCount) {
- var dumps = createTestGlobalMemoryDumps(withVMRegions, withAllocatorDumps);
-
- var div = document.createElement('div');
- var viewport = new Viewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- var track = new GlobalMemoryDumpTrack(viewport);
- drawingContainer.appendChild(track);
- drawingContainer.invalidate();
-
- track.memoryDumps = dumps;
- this.addHTMLOutput(div);
-
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 50, track.clientWidth);
- track.viewport.setDisplayTransformImmediately(dt);
-
- assert.lengthOf(track.tracks_, expectedTrackCount);
- };
-
- test('instantiate_dotsOnly', function() {
- instantiateTrack.call(this, false, false, 1);
- });
-
- test('instantiate_withVMRegions', function() {
- instantiateTrack.call(this, true, false, 2);
- });
-
- test('instantiate_withMemoryAllocatorDumps', function() {
- instantiateTrack.call(this, false, true, 2);
- });
-
- test('instantiate_withBoth', function() {
- instantiateTrack.call(this, true, true, 3);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/highlighter.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/highlighter.html
deleted file mode 100644
index 6b3a7e69c70..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/highlighter.html
+++ /dev/null
@@ -1,53 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/base.html">
-<link rel="import" href="/tracing/base/extension_registry.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Allows custom highlighting to be added to the full model track.
- */
-tr.exportTo('tr.ui.tracks', function() {
-
- /**
- * Highlights cetrain features of the model.
- * @constructor
- */
- function Highlighter(viewport) {
- if (viewport === undefined) {
- throw new Error('viewport must be provided');
- }
- this.viewport_ = viewport;
- };
-
- Highlighter.prototype = {
- __proto__: Object.prototype,
-
- processModel: function(model) {
- throw new Error('processModel implementation missing');
- },
-
- drawHighlight: function(ctx, dt, viewLWorld, viewRWorld, viewHeight) {
- throw new Error('drawHighlight implementation missing');
- }
- };
-
-
- var options = new tr.b.ExtensionRegistryOptions(tr.b.BASIC_REGISTRY_MODE);
- options.defaultMetadata = {};
- options.mandatoryBaseClass = Highlighter;
- tr.b.decorateExtensionRegistry(Highlighter, options);
-
- return {
- Highlighter: Highlighter
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/interaction_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/interaction_track.html
deleted file mode 100644
index 8e8f181ff90..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/interaction_track.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/draw_helpers.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/tracks/alert_track.html">
-<link rel="import" href="/tracing/ui/tracks/container_track.html">
-<link rel="import" href="/tracing/ui/tracks/drawing_container.html">
-<link rel="import" href="/tracing/ui/tracks/highlighter.html">
-<link rel="import" href="/tracing/ui/tracks/kernel_track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- /**
- * A track that displays an array of interaction records.
- * @constructor
- * @extends {MultiRowTrack}
- */
- var InteractionTrack = tr.ui.b.define(
- 'interaction-track', tr.ui.tracks.MultiRowTrack);
-
- InteractionTrack.prototype = {
- __proto__: tr.ui.tracks.MultiRowTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.MultiRowTrack.prototype.decorate.call(this, viewport);
- this.heading = 'Interactions';
- this.subRows_ = [];
- },
-
- set model(model) {
- this.setItemsToGroup(model.userModel.expectations, {
- guid: tr.b.GUID.allocateSimple(),
- model: model,
- getSettingsKey: function() {
- return undefined;
- }
- });
- },
-
- buildSubRows_: function(slices) {
- if (this.subRows_.length)
- return this.subRows_;
- this.subRows_.push.apply(this.subRows_,
- tr.ui.tracks.AsyncSliceGroupTrack.prototype.buildSubRows_.call(
- {}, slices, true));
- return this.subRows_;
- },
-
- addSubTrack_: function(slices) {
- var track = new tr.ui.tracks.SliceTrack(this.viewport);
- track.slices = slices;
- this.appendChild(track);
- return track;
- }
- };
-
- return {
- InteractionTrack: InteractionTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/interaction_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/interaction_track_test.html
deleted file mode 100644
index 1b2c1346a16..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/interaction_track_test.html
+++ /dev/null
@@ -1,51 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/user_model/stub_expectation.html">
-<link rel="import" href="/tracing/ui/timeline_viewport.html">
-<link rel="import" href="/tracing/ui/tracks/interaction_track.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- // UserExpectations should be sorted by start time, not title, so that
- // AsyncSliceGroupTrack.buildSubRows_ can lay them out in as few tracks as
- // possible, so that they mesh instead of stacking unnecessarily.
- test('instantiate', function() {
- var div = document.createElement('div');
- var viewport = new tr.ui.TimelineViewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
- var track = new tr.ui.tracks.InteractionTrack(viewport);
- track.model = tr.c.TestUtils.newModel(function(model) {
- var process = model.getOrCreateProcess(1);
- var thread = process.getOrCreateThread(1);
- thread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx(
- {start: 0, duration: 200}));
- model.userModel.expectations.push(new tr.model.um.StubExpectation(
- {parentModel: model, start: 100, duration: 100}));
- model.userModel.expectations.push(new tr.model.um.StubExpectation(
- {parentModel: model, start: 0, duration: 100}));
- model.userModel.expectations.push(new tr.model.um.StubExpectation(
- {parentModel: model, start: 150, duration: 50}));
- model.userModel.expectations.push(new tr.model.um.StubExpectation(
- {parentModel: model, start: 50, duration: 100}));
- model.userModel.expectations.push(new tr.model.um.StubExpectation(
- {parentModel: model, start: 0, duration: 50}));
- // Model.createImportTracesTask() automatically sorts IRs by start time.
- });
- assert.equal(2, track.subRows_.length);
- assert.equal(2, track.subRows_[0].length);
- assert.equal(3, track.subRows_[1].length);
- drawingContainer.appendChild(track);
- this.addHTMLOutput(div);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/kernel_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/kernel_track.html
deleted file mode 100644
index 20ffea84d05..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/kernel_track.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/tracks/process_track_base.html">
-<link rel="import" href="/tracing/ui/tracks/cpu_track.html">
-<link rel="import" href="/tracing/ui/tracks/spacing_track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- var Cpu = tr.model.Cpu;
- var CpuTrack = tr.ui.tracks.cpu_track;
- var ProcessTrackBase = tr.ui.tracks.ProcessTrackBase;
- var SpacingTrack = tr.ui.tracks.SpacingTrack;
-
- /**
- * @constructor
- */
- var KernelTrack = tr.ui.b.define('kernel-track', ProcessTrackBase);
-
- KernelTrack.prototype = {
- __proto__: ProcessTrackBase.prototype,
-
- decorate: function(viewport) {
- ProcessTrackBase.prototype.decorate.call(this, viewport);
- },
-
-
- // Kernel maps to processBase because we derive from ProcessTrackBase.
- set kernel(kernel) {
- this.processBase = kernel;
- },
-
- get kernel() {
- return this.processBase;
- },
-
- get eventContainer() {
- return this.kernel;
- },
-
- get hasVisibleContent() {
- return this.children.length > 1;
- },
-
- addContainersToTrackMap: function(containerToTrackMap) {
- tr.ui.tracks.ProcessTrackBase.prototype.addContainersToTrackMap.call(
- this, containerToTrackMap);
- containerToTrackMap.addContainer(this.kernel, this);
- },
-
- willAppendTracks_: function() {
- var cpus = tr.b.dictionaryValues(this.kernel.cpus);
- cpus.sort(tr.model.Cpu.compare);
-
- var didAppendAtLeastOneTrack = false;
- for (var i = 0; i < cpus.length; ++i) {
- var cpu = cpus[i];
- var track = new tr.ui.tracks.CpuTrack(this.viewport);
- track.detailedMode = this.expanded;
- track.cpu = cpu;
- if (!track.hasVisibleContent)
- continue;
- this.appendChild(track);
- didAppendAtLeastOneTrack = true;
- }
- if (didAppendAtLeastOneTrack)
- this.appendChild(new SpacingTrack(this.viewport));
- }
- };
-
-
- return {
- KernelTrack: KernelTrack
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/letter_dot_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/letter_dot_track.html
deleted file mode 100644
index 64f26e4fb4f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/letter_dot_track.html
+++ /dev/null
@@ -1,260 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/model/proxy_selectable_item.html">
-<link rel="import" href="/tracing/ui/base/event_presenter.html">
-<link rel="import" href="/tracing/ui/base/heading.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/tracks/track.html">
-
-<style>
-.letter-dot-track {
- height: 18px;
-}
-</style>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- var EventPresenter = tr.ui.b.EventPresenter;
- var SelectionState = tr.model.SelectionState;
-
- /**
- * A track that displays an array of dots with filled letters inside them.
- * @constructor
- * @extends {Track}
- */
- var LetterDotTrack = tr.ui.b.define(
- 'letter-dot-track', tr.ui.tracks.Track);
-
- LetterDotTrack.prototype = {
- __proto__: tr.ui.tracks.Track.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.Track.prototype.decorate.call(this, viewport);
- this.classList.add('letter-dot-track');
- this.items_ = undefined;
-
- this.heading_ = document.createElement('tr-ui-heading');
- this.appendChild(this.heading_);
- },
-
- set heading(heading) {
- this.heading_.heading = heading;
- },
-
- get heading() {
- return this.heading_.heading;
- },
-
- set tooltip(tooltip) {
- this.heading_.tooltip = tooltip;
- },
-
- get items() {
- return this.items_;
- },
-
- set items(items) {
- this.items_ = items;
- this.invalidateDrawingContainer();
- },
-
- get height() {
- return window.getComputedStyle(this).height;
- },
-
- set height(height) {
- this.style.height = height;
- },
-
- get dumpRadiusView() {
- return 7 * (window.devicePixelRatio || 1);
- },
-
- draw: function(type, viewLWorld, viewRWorld) {
- if (this.items_ === undefined)
- return;
- switch (type) {
- case tr.ui.tracks.DrawType.GENERAL_EVENT:
- this.drawLetterDots_(viewLWorld, viewRWorld);
- break;
- }
- },
-
- drawLetterDots_: function(viewLWorld, viewRWorld) {
- var ctx = this.context();
- var pixelRatio = window.devicePixelRatio || 1;
-
- var bounds = this.getBoundingClientRect();
- var height = bounds.height * pixelRatio;
- var halfHeight = height * 0.5;
- var twoPi = Math.PI * 2;
-
- // Culling parameters.
- var dt = this.viewport.currentDisplayTransform;
- var dumpRadiusView = this.dumpRadiusView;
- var itemRadiusWorld = dt.xViewVectorToWorld(height);
-
- // Draw the memory dumps.
- var items = this.items_;
- var loI = tr.b.findLowIndexInSortedArray(
- items,
- function(item) { return item.start; },
- viewLWorld);
-
- var oldFont = ctx.font;
- ctx.font = '400 ' + Math.floor(9 * pixelRatio) + 'px Arial';
- ctx.strokeStyle = 'rgb(0,0,0)';
- ctx.textBaseline = 'middle';
- ctx.textAlign = 'center';
-
- var drawItems = function(selected) {
- for (var i = loI; i < items.length; ++i) {
- var item = items[i];
- var x = item.start;
- if (x - itemRadiusWorld > viewRWorld)
- break;
- if (item.selected !== selected)
- continue;
- var xView = dt.xWorldToView(x);
-
- ctx.fillStyle = EventPresenter.getSelectableItemColorAsString(item);
- ctx.beginPath();
- ctx.arc(xView, halfHeight, dumpRadiusView + 0.5, 0, twoPi);
- ctx.fill();
- if (item.selected) {
- ctx.lineWidth = 3;
- ctx.strokeStyle = 'rgb(100,100,0)';
- ctx.stroke();
-
- ctx.beginPath();
- ctx.arc(xView, halfHeight, dumpRadiusView, 0, twoPi);
- ctx.lineWidth = 1.5;
- ctx.strokeStyle = 'rgb(255,255,0)';
- ctx.stroke();
- } else {
- ctx.lineWidth = 1;
- ctx.strokeStyle = 'rgb(0,0,0)';
- ctx.stroke();
- }
-
- ctx.fillStyle = 'rgb(255, 255, 255)';
- ctx.fillText(item.dotLetter, xView, halfHeight);
- }
- };
-
- // Draw unselected items first to make sure they don't occlude selected
- // items.
- drawItems(false);
- drawItems(true);
-
- ctx.lineWidth = 1;
- ctx.font = oldFont;
- },
-
- addEventsToTrackMap: function(eventToTrackMap) {
- if (this.items_ === undefined)
- return;
-
- this.items_.forEach(function(item) {
- item.addToTrackMap(eventToTrackMap, this);
- }, this);
- },
-
- addIntersectingEventsInRangeToSelectionInWorldSpace: function(
- loWX, hiWX, viewPixWidthWorld, selection) {
- if (this.items_ === undefined)
- return;
-
- var itemRadiusWorld = viewPixWidthWorld * this.dumpRadiusView;
- tr.b.iterateOverIntersectingIntervals(
- this.items_,
- function(x) { return x.start - itemRadiusWorld; },
- function(x) { return 2 * itemRadiusWorld; },
- loWX, hiWX,
- function(item) {
- item.addToSelection(selection);
- }.bind(this));
- },
-
- /**
- * Add the item to the left or right of the provided event, if any, to the
- * selection.
- * @param {event} The current event item.
- * @param {Number} offset Number of slices away from the event to look.
- * @param {Selection} selection The selection to add an event to,
- * if found.
- * @return {boolean} Whether an event was found.
- * @private
- */
- addEventNearToProvidedEventToSelection: function(event, offset, selection) {
- if (this.items_ === undefined)
- return;
-
- var items = this.items_;
- var index = tr.b.findFirstIndexInArray(items, function(item) {
- return item.modelItem === event;
- });
- if (index === -1)
- return false;
-
- var newIndex = index + offset;
- if (newIndex >= 0 && newIndex < items.length) {
- items[newIndex].addToSelection(selection);
- return true;
- }
- return false;
- },
-
- addAllEventsMatchingFilterToSelection: function(filter, selection) {
- },
-
- addClosestEventToSelection: function(worldX, worldMaxDist, loY, hiY,
- selection) {
- if (this.items_ === undefined)
- return;
-
- var item = tr.b.findClosestElementInSortedArray(
- this.items_,
- function(x) { return x.start; },
- worldX,
- worldMaxDist);
-
- if (!item)
- return;
-
- item.addToSelection(selection);
- }
- };
-
- /**
- * A filled dot with a letter inside it.
- *
- * @constructor
- * @extends {ProxySelectableItem}
- */
- function LetterDot(modelItem, dotLetter, colorId, start) {
- tr.model.ProxySelectableItem.call(this, modelItem);
- this.dotLetter = dotLetter;
- this.colorId = colorId;
- this.start = start;
- };
-
- LetterDot.prototype = {
- __proto__: tr.model.ProxySelectableItem.prototype
- };
-
- return {
- LetterDotTrack: LetterDotTrack,
- LetterDot: LetterDot
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/letter_dot_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/letter_dot_track_test.html
deleted file mode 100644
index 93c2bcfbb9a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/letter_dot_track_test.html
+++ /dev/null
@@ -1,121 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/selection_state.html">
-<link rel="import" href="/tracing/ui/timeline_viewport.html">
-<link rel="import" href="/tracing/ui/tracks/drawing_container.html">
-<link rel="import" href="/tracing/ui/tracks/letter_dot_track.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var LetterDotTrack = tr.ui.tracks.LetterDotTrack;
- var LetterDot = tr.ui.tracks.LetterDot;
- var SelectionState = tr.model.SelectionState;
- var Viewport = tr.ui.TimelineViewport;
-
- var createItems = function() {
- var items = [
- new LetterDot({selectionState: SelectionState.SELECTED}, 'a', 7, 5),
- new LetterDot({selectionState: SelectionState.SELECTED}, 'b', 2, 20),
- new LetterDot({selectionState: SelectionState.NONE}, 'c', 4, 35),
- new LetterDot({selectionState: SelectionState.NONE}, 'd', 4, 50)
- ];
- return items;
- };
-
- test('instantiate', function() {
- var items = createItems();
-
- var div = document.createElement('div');
-
- var viewport = new Viewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- var track = LetterDotTrack(viewport);
- drawingContainer.appendChild(track);
-
- this.addHTMLOutput(div);
- drawingContainer.invalidate();
-
- track.items = items;
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 60, track.clientWidth);
- track.viewport.setDisplayTransformImmediately(dt);
- });
-
- test('selectionHitTesting', function() {
- var items = createItems();
-
- var track = new LetterDotTrack(new Viewport());
- track.items = items;
-
- // Fake a view pixel size.
- var devicePixelRatio = window.devicePixelRatio || 1;
- var viewPixWidthWorld = 0.1 / devicePixelRatio;
-
- // Hit outside range
- var selection = [];
- track.addIntersectingEventsInRangeToSelectionInWorldSpace(
- 3, 4, viewPixWidthWorld, selection);
- assert.equal(selection.length, 0);
-
- // Hit the first item, via pixel-nearness.
- selection = [];
- track.addIntersectingEventsInRangeToSelectionInWorldSpace(
- 19.98, 19.99, viewPixWidthWorld, selection);
- assert.equal(selection.length, 1);
- assert.equal(selection[0], items[1].modelItem);
-
- // Hit the instance, between the 1st and 2nd snapshots
- selection = [];
- track.addIntersectingEventsInRangeToSelectionInWorldSpace(
- 30, 50, viewPixWidthWorld, selection);
- assert.equal(selection.length, 2);
- assert.equal(selection[0], items[2].modelItem);
- assert.equal(selection[1], items[3].modelItem);
- });
-
- test('addEventNearToProvidedEventToSelection', function() {
- var items = createItems();
-
- var track = new LetterDotTrack(new Viewport());
- track.items = items;
-
- // Right from the middle of items.
- var selection1 = [];
- assert.isTrue(track.addEventNearToProvidedEventToSelection(
- items[2].modelItem, 1, selection1));
- assert.equal(selection1.length, 1);
- assert.equal(selection1[0], items[3].modelItem);
-
- // Left from the middle of items.
- var selection2 = [];
- assert.isTrue(track.addEventNearToProvidedEventToSelection(
- items[2].modelItem, -1, selection2));
- assert.equal(selection2.length, 1);
- assert.equal(selection2[0], items[1].modelItem);
-
- // Right from the right edge of items.
- var selection3 = [];
- assert.isFalse(track.addEventNearToProvidedEventToSelection(
- items[3].modelItem, 1, selection3));
- assert.equal(selection3.length, 0);
-
- // Left from the left edge of items.
- var selection4 = [];
- assert.isFalse(track.addEventNearToProvidedEventToSelection(
- items[0].modelItem, -1, selection4));
- assert.equal(selection4.length, 0);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/memory_dump_track_test_utils.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/memory_dump_track_test_utils.html
deleted file mode 100644
index 2d13a901ba8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/memory_dump_track_test_utils.html
+++ /dev/null
@@ -1,143 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/container_memory_dump.html">
-<link rel="import" href="/tracing/model/global_memory_dump.html">
-<link rel="import" href="/tracing/model/memory_dump_test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/process_memory_dump.html">
-<link rel="import" href="/tracing/model/selection_state.html">
-<link rel="import" href="/tracing/model/vm_region.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Helper functions for memory dump track tests.
- */
-tr.exportTo('tr.ui.tracks', function() {
- var ProcessMemoryDump = tr.model.ProcessMemoryDump;
- var GlobalMemoryDump = tr.model.GlobalMemoryDump;
- var VMRegion = tr.model.VMRegion;
- var VMRegionClassificationNode = tr.model.VMRegionClassificationNode;
- var SelectionState = tr.model.SelectionState;
- var addGlobalMemoryDump = tr.model.MemoryDumpTestUtils.addGlobalMemoryDump;
- var addProcessMemoryDump = tr.model.MemoryDumpTestUtils.addProcessMemoryDump;
- var newAllocatorDump = tr.model.MemoryDumpTestUtils.newAllocatorDump;
- var addOwnershipLink = tr.model.MemoryDumpTestUtils.addOwnershipLink;
- var LIGHT = tr.model.ContainerMemoryDump.LevelOfDetail.LIGHT;
- var DETAILED = tr.model.ContainerMemoryDump.LevelOfDetail.DETAILED;
-
- function createVMRegions(pssValues) {
- return VMRegionClassificationNode.fromRegions(
- pssValues.map(function(pssValue, i) {
- return VMRegion.fromDict({
- startAddress: 1000 * i,
- sizeInBytes: 1000,
- protectionFlags: VMRegion.PROTECTION_FLAG_READ,
- mappedFile: '[stack' + i + ']',
- byteStats: {
- privateDirtyResident: pssValue / 3,
- swapped: pssValue * 3,
- proportionalResident: pssValue
- }
- });
- }));
- }
-
- function createAllocatorDumps(memoryDump, dumpData) {
- // Create the individual allocator dumps.
- var allocatorDumps = tr.b.mapItems(dumpData, function(allocatorName, data) {
- var size = data.size;
- assert.typeOf(size, 'number'); // Sanity check.
- return newAllocatorDump(memoryDump, allocatorName, { size: size });
- });
-
- // Add ownership links between them.
- tr.b.iterItems(dumpData, function(allocatorName, data) {
- var owns = data.owns;
- if (owns === undefined)
- return;
-
- var ownerDump = allocatorDumps[allocatorName];
- assert.isDefined(ownerDump); // Sanity check.
- var ownedDump = allocatorDumps[owns];
- assert.isDefined(ownedDump); // Sanity check.
-
- addOwnershipLink(ownerDump, ownedDump);
- });
-
- return tr.b.dictionaryValues(allocatorDumps);
- }
-
- function addProcessMemoryDumpWithFields(globalMemoryDump, process, start,
- opt_pssValues, opt_dumpData) {
- var pmd = addProcessMemoryDump(globalMemoryDump, process, start);
- if (opt_pssValues !== undefined)
- pmd.vmRegions = createVMRegions(opt_pssValues);
- if (opt_dumpData !== undefined)
- pmd.memoryAllocatorDumps = createAllocatorDumps(pmd, opt_dumpData);
- }
-
- function createModelWithDumps(withVMRegions, withAllocatorDumps) {
- var maybePssValues = function(pssValues) {
- return withVMRegions ? pssValues : undefined;
- };
- var maybeDumpData = function(dumpData) {
- return withAllocatorDumps ? dumpData : undefined;
- };
- return tr.c.TestUtils.newModel(function(model) {
- // Construct a model with three processes.
- var pa = model.getOrCreateProcess(3);
- var pb = model.getOrCreateProcess(6);
- var pc = model.getOrCreateProcess(9);
-
- var gmd1 = addGlobalMemoryDump(model, 0, LIGHT);
- addProcessMemoryDumpWithFields(gmd1, pa, 0, maybePssValues([111]));
- addProcessMemoryDumpWithFields(gmd1, pb, 0.2, undefined,
- maybeDumpData({oilpan: {size: 1024}}));
-
- var gmd2 = addGlobalMemoryDump(model, 5, DETAILED);
- addProcessMemoryDumpWithFields(gmd2, pa, 0);
- addProcessMemoryDumpWithFields(gmd2, pb, 4.99, maybePssValues([100, 50]),
- maybeDumpData({v8: {size: 512}}));
- addProcessMemoryDumpWithFields(gmd2, pc, 5.12, undefined,
- maybeDumpData({oilpan: {size: 128, owns: 'v8'},
- v8: {size: 384, owns: 'tracing'}, tracing: {size: 65920}}));
-
- var gmd3 = addGlobalMemoryDump(model, 15, DETAILED);
- addProcessMemoryDumpWithFields(gmd3, pa, 15.5, maybePssValues([]),
- maybeDumpData({v8: {size: 768}}));
- addProcessMemoryDumpWithFields(gmd3, pc, 14.5,
- maybePssValues([70, 70, 70]), maybeDumpData({oilpan: {size: 512}}));
-
- var gmd4 = addGlobalMemoryDump(model, 18, LIGHT);
- });
- }
-
- function createTestGlobalMemoryDumps(withVMRegions, withAllocatorDumps) {
- var model = createModelWithDumps(withVMRegions, withAllocatorDumps);
- var dumps = model.globalMemoryDumps;
- dumps[1].selectionState = SelectionState.HIGHLIGHTED;
- dumps[2].selectionState = SelectionState.SELECTED;
- return dumps;
- }
-
- function createTestProcessMemoryDumps(withVMRegions, withAllocatorDumps) {
- var model = createModelWithDumps(withVMRegions, withAllocatorDumps);
- var dumps = model.getProcess(9).memoryDumps;
- dumps[0].selectionState = SelectionState.SELECTED;
- dumps[1].selectionState = SelectionState.HIGHLIGHTED;
- return dumps;
- }
-
- return {
- createTestGlobalMemoryDumps: createTestGlobalMemoryDumps,
- createTestProcessMemoryDumps: createTestProcessMemoryDumps
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/memory_dump_track_util.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/memory_dump_track_util.html
deleted file mode 100644
index 821186182b4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/memory_dump_track_util.html
+++ /dev/null
@@ -1,262 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/container_memory_dump.html">
-<link rel="import" href="/tracing/model/memory_allocator_dump.html">
-<link rel="import" href="/tracing/ui/tracks/chart_axis.html">
-<link rel="import" href="/tracing/ui/tracks/chart_point.html">
-<link rel="import" href="/tracing/ui/tracks/chart_series.html">
-<link rel="import" href="/tracing/ui/tracks/chart_track.html">
-<link rel="import" href="/tracing/ui/tracks/container_track.html">
-<link rel="import" href="/tracing/ui/tracks/letter_dot_track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- var ColorScheme = tr.b.ColorScheme;
-
- var DISPLAYED_SIZE_NUMERIC_NAME =
- tr.model.MemoryAllocatorDump.DISPLAYED_SIZE_NUMERIC_NAME;
- var LIGHT = tr.model.ContainerMemoryDump.LevelOfDetail.LIGHT;
- var DETAILED = tr.model.ContainerMemoryDump.LevelOfDetail.DETAILED;
-
- /**
- * Add numeric values from a source dictionary to the numeric values in
- * a destination dictionary. Undefined values are treated as zeros. Note that
- * this method modifies the destination dictionary in place.
- *
- * Example: addDictionary({a: 1, b: 2}, {b: 3, c: 4}) will update the
- * destination dictionary (first argument) to {a: 1, b: 5, c: 4}.
- */
- function addDictionary(dstDict, srcDict) {
- tr.b.iterItems(srcDict, function(key, value) {
- var existingValue = dstDict[key];
- if (existingValue === undefined)
- existingValue = 0;
- dstDict[key] = existingValue + value;
- });
- }
-
- /**
- * Get a dictionary mapping root allocator names (e.g. 'v8') to the
- * corresponding sizes (e.g. 1024) in a process memory dump.
- */
- function getProcessMemoryDumpAllocatorSizes(processMemoryDump) {
- var allocatorDumps = processMemoryDump.memoryAllocatorDumps;
- if (allocatorDumps === undefined)
- return {};
- var allocatorSizes = {};
- allocatorDumps.forEach(function(allocatorDump) {
- // Don't show tracing overhead in the charts.
- // TODO(petrcermak): Find a less hacky way to do this.
- if (allocatorDump.fullName === 'tracing')
- return;
- var allocatorSize = allocatorDump.numerics[DISPLAYED_SIZE_NUMERIC_NAME];
- if (allocatorSize === undefined)
- return;
- var allocatorSizeValue = allocatorSize.value;
- if (allocatorSizeValue === undefined)
- return;
- allocatorSizes[allocatorDump.fullName] = allocatorSizeValue;
- });
- return allocatorSizes;
- };
-
- /**
- * Get a dictionary mapping root allocator names (e.g. 'v8') to the
- * corresponding sizes (e.g. 1024) in a global memory dump (i.e. summed over
- * all simultaneous process memory dumps).
- */
- function getGlobalMemoryDumpAllocatorSizes(globalMemoryDump) {
- var globalAllocatorSizes = {};
- tr.b.iterItems(globalMemoryDump.processMemoryDumps,
- function(pid, processMemoryDump) {
- addDictionary(globalAllocatorSizes,
- getProcessMemoryDumpAllocatorSizes(processMemoryDump));
- });
- return globalAllocatorSizes;
- }
-
- /**
- * A generic function which converts a list of memory dumps to a list of chart
- * series (one per root allocator). Each series represents the evolution of
- * the size of a the corresponding root allocator (e.g. 'v8') over time.
- */
- function buildAllocatedMemoryChartSeries(memoryDumps,
- memoryDumpToAllocatorSizesFn) {
- var allocatorNameToPoints = {};
- var dumpsData = memoryDumps.map(function(memoryDump) {
- var allocatorSizes = memoryDumpToAllocatorSizesFn(memoryDump);
- tr.b.iterItems(allocatorSizes, function(allocatorName) {
- allocatorNameToPoints[allocatorName] = [];
- });
- return {dump: memoryDump, sizes: allocatorSizes};
- });
-
- // Do not generate any chart series if no process memory dump contains any
- // allocator dumps.
- if (Object.keys(allocatorNameToPoints).length === 0)
- return undefined;
-
- dumpsData.forEach(function(dumpData) {
- var memoryDump = dumpData.dump;
- var allocatorSizes = dumpData.sizes;
- tr.b.iterItems(allocatorNameToPoints, function(allocatorName, points) {
- var allocatorSize = allocatorSizes[allocatorName] || 0;
- points.push(new tr.ui.tracks.ChartPoint(
- memoryDump, memoryDump.start, allocatorSize));
- });
- });
-
- // Create one common axis for all allocated memory chart series.
- var axis = new tr.ui.tracks.ChartAxis(0);
-
- // Build a chart series for each allocator.
- var series = [];
- tr.b.iterItems(allocatorNameToPoints, function(allocatorName, points) {
- var colorId = ColorScheme.getColorIdForGeneralPurposeString(
- allocatorName);
- var renderingConfig = {
- chartType: tr.ui.tracks.ChartSeriesType.LINE,
- colorId: colorId
- };
- series.push(new tr.ui.tracks.ChartSeries(points, axis, renderingConfig));
- });
-
- return series;
- }
-
- /**
- * Transform a list of memory dumps to a list of letter dots (with letter 'M'
- * inside).
- */
- function buildMemoryLetterDots(memoryDumps) {
- var lightMemoryColorId =
- ColorScheme.getColorIdForReservedName('light_memory_dump');
- var detailedMemoryColorId =
- ColorScheme.getColorIdForReservedName('detailed_memory_dump');
- return memoryDumps.map(function(memoryDump) {
- var memoryColorId;
- switch (memoryDump.levelOfDetail) {
- case DETAILED:
- memoryColorId = detailedMemoryColorId;
- break;
- case LIGHT:
- default:
- memoryColorId = lightMemoryColorId;
- }
- return new tr.ui.tracks.LetterDot(
- memoryDump, 'M', memoryColorId, memoryDump.start);
- });
- }
-
- /**
- * Convert a list of global memory dumps to a list of chart series (one per
- * process). Each series represents the evolution of the memory used by the
- * process over time.
- */
- function buildGlobalUsedMemoryChartSeries(globalMemoryDumps) {
- // Do not generate the chart if no process memory dump contains VM regions.
- var containsVmRegions = globalMemoryDumps.some(function(globalDump) {
- for (var pid in globalDump.processMemoryDumps)
- if (globalDump.processMemoryDumps[pid].mostRecentVmRegions)
- return true;
- return false;
- });
- if (!containsVmRegions)
- return undefined;
-
- // Find all processes that dump memory at least once.
- var pidToProcess = {};
- globalMemoryDumps.forEach(function(globalDump) {
- tr.b.iterItems(globalDump.processMemoryDumps, function(pid, processDump) {
- pidToProcess[pid] = processDump.process;
- });
- });
-
- // Build one list of points for each instrumented process.
- var pidToPoints = {};
- tr.b.iterItems(pidToProcess, function(pid, process) {
- pidToPoints[pid] = [];
- });
-
- // For every timestamp, calculate the total PSS (proportional set size) of
- // each process and append it to the corresponding list of points.
- globalMemoryDumps.forEach(function(globalDump) {
- var pssBase = 0;
- tr.b.iterItems(pidToPoints, function(pid, points) {
- var processMemoryDump = globalDump.processMemoryDumps[pid];
- var cumulativePss = pssBase;
- // If no dump was found (probably dead) or it does not provide the
- // necessary information (namely most recent VM regions), assume zero.
- if (processMemoryDump !== undefined) {
- var vmRegions = processMemoryDump.mostRecentVmRegions;
- if (vmRegions !== undefined)
- cumulativePss += vmRegions.byteStats.proportionalResident || 0;
- }
- points.push(new tr.ui.tracks.ChartPoint(
- globalDump, globalDump.start, cumulativePss, pssBase));
- pssBase = cumulativePss;
- });
- });
-
- // Create one common axis for all used memory chart series.
- var axis = new tr.ui.tracks.ChartAxis(0);
-
- // Build a chart series for each instrumented process.
- var series = [];
- tr.b.iterItems(pidToPoints, function(pid, points) {
- var process = pidToProcess[pid];
- var colorId = ColorScheme.getColorIdForGeneralPurposeString(
- process.userFriendlyName);
- var renderingConfig = {
- chartType: tr.ui.tracks.ChartSeriesType.AREA,
- colorId: colorId,
- backgroundOpacity: 0.8
- };
- series.push(new tr.ui.tracks.ChartSeries(points, axis, renderingConfig));
- });
-
- // Show the first series (with the smallest cumulative value) at the top.
- series.reverse();
-
- return series;
- }
-
- /**
- * Convert a list of process memory dumps to a list of chart series (one per
- * root allocator). Each series represents the evolution of the size of a the
- * corresponding root allocator (e.g. 'v8') over time.
- */
- function buildProcessAllocatedMemoryChartSeries(processMemoryDumps) {
- return buildAllocatedMemoryChartSeries(processMemoryDumps,
- getProcessMemoryDumpAllocatorSizes);
- }
-
- /**
- * Convert a list of global memory dumps to a list of chart series (one per
- * root allocator). Each series represents the evolution of the size of a the
- * corresponding root allocator (e.g. 'v8') over time.
- */
- function buildGlobalAllocatedMemoryChartSeries(globalMemoryDumps) {
- return buildAllocatedMemoryChartSeries(globalMemoryDumps,
- getGlobalMemoryDumpAllocatorSizes);
- }
-
- return {
- buildMemoryLetterDots:
- buildMemoryLetterDots,
- buildGlobalUsedMemoryChartSeries:
- buildGlobalUsedMemoryChartSeries,
- buildProcessAllocatedMemoryChartSeries:
- buildProcessAllocatedMemoryChartSeries,
- buildGlobalAllocatedMemoryChartSeries:
- buildGlobalAllocatedMemoryChartSeries
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/memory_dump_track_util_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/memory_dump_track_util_test.html
deleted file mode 100644
index 58e46078245..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/memory_dump_track_util_test.html
+++ /dev/null
@@ -1,228 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/selection_state.html">
-<link rel="import" href="/tracing/ui/tracks/memory_dump_track_test_utils.html">
-<link rel="import" href="/tracing/ui/tracks/memory_dump_track_util.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var SelectionState = tr.model.SelectionState;
- var createTestGlobalMemoryDumps = tr.ui.tracks.createTestGlobalMemoryDumps;
- var createTestProcessMemoryDumps = tr.ui.tracks.createTestProcessMemoryDumps;
-
- test('buildMemoryLetterDots_withoutVMRegions', function() {
- var dumps = createTestGlobalMemoryDumps(false, false);
- var items = tr.ui.tracks.buildMemoryLetterDots(dumps);
-
- assert.lengthOf(items, 4);
- assert.equal(items[0].start, 0);
- assert.equal(items[1].start, 5);
- assert.equal(items[2].start, 15);
- assert.equal(items[3].start, 18);
-
- // Check model mapping.
- assert.equal(items[1].selectionState, SelectionState.HIGHLIGHTED);
- assert.isTrue(items[2].selected);
- assert.equal(items[3].modelItem, dumps[3]);
- });
-
- test('buildMemoryLetterDots_withVMRegions', function() {
- var dumps = createTestGlobalMemoryDumps(false, false);
- var items = tr.ui.tracks.buildMemoryLetterDots(dumps);
-
- assert.lengthOf(items, 4);
- assert.equal(items[0].start, 0);
- assert.equal(items[1].start, 5);
- assert.equal(items[2].start, 15);
- assert.equal(items[3].start, 18);
-
- // Check model mapping.
- assert.equal(items[1].selectionState, SelectionState.HIGHLIGHTED);
- assert.isTrue(items[2].selected);
- assert.equal(items[3].modelItem, dumps[3]);
- });
-
- test('buildGlobalUsedMemoryChartSeries_withoutVMRegions', function() {
- var dumps = createTestGlobalMemoryDumps(false, false);
- var series = tr.ui.tracks.buildGlobalUsedMemoryChartSeries(dumps);
-
- assert.isUndefined(series);
- });
-
- test('buildGlobalUsedMemoryChartSeries_withVMRegions', function() {
- var dumps = createTestGlobalMemoryDumps(true, false);
- var series = tr.ui.tracks.buildGlobalUsedMemoryChartSeries(dumps);
-
- assert.lengthOf(series, 3);
-
- var sa = series[2];
- var sb = series[1];
- var sc = series[0];
-
- assert.lengthOf(sa.points, 4);
- assert.lengthOf(sb.points, 4);
- assert.lengthOf(sc.points, 4);
-
- // Process A: VM regions defined -> sum their PSS values (111).
- // Process B: VM regions undefined and no previous value -> assume zero.
- // Process C: Memory dump not present -> assume process not alive (0).
- assert.equal(sa.points[0].x, 0);
- assert.equal(sb.points[0].x, 0);
- assert.equal(sc.points[0].x, 0);
- assert.equal(sa.points[0].y, 111);
- assert.equal(sb.points[0].y, 111);
- assert.equal(sc.points[0].y, 111);
- assert.equal(sa.points[0].yBase, 0);
- assert.equal(sb.points[0].yBase, 111);
- assert.equal(sc.points[0].yBase, 111);
-
- // Process A: VM regions undefined -> assume previous value (111).
- // Process B: VM regions defined -> sum their PSS values (555).
- // Process C: VM regions undefined -> assume previous value (0).
- assert.equal(sa.points[1].x, 5);
- assert.equal(sb.points[1].x, 5);
- assert.equal(sc.points[1].x, 5);
- assert.equal(sa.points[1].y, 111);
- assert.equal(sb.points[1].y, 261);
- assert.equal(sc.points[1].y, 261);
- assert.equal(sa.points[1].yBase, 0);
- assert.equal(sb.points[1].yBase, 111);
- assert.equal(sc.points[1].yBase, 261);
-
- // Process A: VM regions defined -> sum their PSS values (0).
- // Process B: Memory dump not present -> assume process not alive (0).
- // Process C: VM regions defined -> sum their PSS values (999).
- assert.equal(sa.points[2].x, 15);
- assert.equal(sb.points[2].x, 15);
- assert.equal(sc.points[2].x, 15);
- assert.equal(sa.points[2].y, 0);
- assert.equal(sb.points[2].y, 0);
- assert.equal(sc.points[2].y, 210);
- assert.equal(sa.points[2].yBase, 0);
- assert.equal(sb.points[2].yBase, 0);
- assert.equal(sc.points[2].yBase, 0);
-
- // All processes: Memory dump not present -> assume process not alive (0).
- assert.equal(sa.points[3].x, 18);
- assert.equal(sb.points[3].x, 18);
- assert.equal(sc.points[3].x, 18);
- assert.equal(sa.points[3].y, 0);
- assert.equal(sb.points[3].y, 0);
- assert.equal(sc.points[3].y, 0);
- assert.equal(sc.points[3].yBase, 0);
- assert.equal(sc.points[3].yBase, 0);
- assert.equal(sc.points[3].yBase, 0);
-
- // Check model mapping.
- assert.equal(sa.points[1].selectionState, SelectionState.HIGHLIGHTED);
- assert.isTrue(sb.points[2].selected);
- assert.equal(sc.points[3].modelItem, dumps[3]);
- });
-
- test('buildGlobalAllocatedMemoryChartSeries_withoutMemoryAllocatorDumps',
- function() {
- var dumps = createTestGlobalMemoryDumps(false, false);
- var series = tr.ui.tracks.buildGlobalAllocatedMemoryChartSeries(dumps);
-
- assert.isUndefined(series);
- });
-
- test('buildGlobalAllocatedMemoryChartSeries_withMemoryAllocatorDumps',
- function() {
- var dumps = createTestGlobalMemoryDumps(false, true);
- var series = tr.ui.tracks.buildGlobalAllocatedMemoryChartSeries(dumps);
-
- assert.lengthOf(series, 2);
-
- var so = series[0];
- var sv = series[1];
-
- assert.lengthOf(so.points, 4);
- assert.lengthOf(sv.points, 4);
-
- // Oilpan: Only process B dumps allocated objects size (1024).
- // V8: No process dumps allocated objects size (0).
- assert.equal(so.points[0].x, 0);
- assert.equal(sv.points[0].x, 0);
- assert.equal(so.points[0].y, 1024);
- assert.equal(sv.points[0].y, 0);
-
- // Oilpan: Process B did not provide a value and process C dumps (128).
- // V8: Processes B and C dump (512 + 256).
- assert.equal(so.points[1].x, 5);
- assert.equal(sv.points[1].x, 5);
- assert.equal(so.points[1].y, 128);
- assert.equal(sv.points[1].y, 768);
-
- // Oilpan: Process B assumed not alive and process C dumps (512)
- // V8: Process A dumps now, process B assumed not alive, process C did not
- // provide a value (768).
- assert.equal(so.points[2].x, 15);
- assert.equal(sv.points[2].x, 15);
- assert.equal(so.points[2].y, 512);
- assert.equal(sv.points[2].y, 768);
-
- // All processes: Memory dump not present -> assume process not alive (0).
- assert.equal(so.points[3].x, 18);
- assert.equal(sv.points[3].x, 18);
- assert.equal(so.points[3].y, 0);
- assert.equal(sv.points[3].y, 0);
-
- // Check model mapping.
- assert.equal(so.points[1].selectionState, SelectionState.HIGHLIGHTED);
- assert.isTrue(sv.points[2].selected);
- assert.equal(so.points[3].modelItem, dumps[3]);
- });
-
- test('buildProcessAllocatedMemoryChartSeries_withoutMemoryAllocatorDumps',
- function() {
- var dumps = createTestProcessMemoryDumps(false, false);
- var series = tr.ui.tracks.buildProcessAllocatedMemoryChartSeries(dumps);
-
- assert.isUndefined(series);
- });
-
- test('buildProcessAllocatedMemoryChartSeries_withMemoryAllocatorDumps',
- function() {
- var dumps = createTestProcessMemoryDumps(false, true);
- var series = tr.ui.tracks.buildProcessAllocatedMemoryChartSeries(dumps);
-
- // There should be only 2 series (because 'tracing' is not shown in the
- // charts).
- assert.lengthOf(series, 2);
-
- var so = series[0];
- var sv = series[1];
-
- assert.lengthOf(so.points, 2);
- assert.lengthOf(sv.points, 2);
-
- // Oilpan: Process dumps (128).
- // V8: Process dumps (256).
- assert.equal(so.points[0].x, 5.12);
- assert.equal(sv.points[0].x, 5.12);
- assert.equal(so.points[0].y, 128);
- assert.equal(sv.points[0].y, 256);
-
- // Oilpan: Process dumps (512).
- // V8: Process did not provide a value (0).
- assert.equal(so.points[1].x, 14.5);
- assert.equal(sv.points[1].x, 14.5);
- assert.equal(so.points[1].y, 512);
- assert.equal(sv.points[1].y, 0);
-
- // Check model mapping.
- assert.equal(so.points[1].selectionState, SelectionState.HIGHLIGHTED);
- assert.isTrue(sv.points[0].selected);
- assert.equal(so.points[1].modelItem, dumps[1]);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/model_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/model_track.html
deleted file mode 100644
index 29e8b94c85e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/model_track.html
+++ /dev/null
@@ -1,432 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/draw_helpers.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/tracks/alert_track.html">
-<link rel="import" href="/tracing/ui/tracks/container_track.html">
-<link rel="import" href="/tracing/ui/tracks/cpu_usage_track.html">
-<link rel="import" href="/tracing/ui/tracks/device_track.html">
-<link rel="import" href="/tracing/ui/tracks/global_memory_dump_track.html">
-<link rel="import" href="/tracing/ui/tracks/highlighter.html">
-<link rel="import" href="/tracing/ui/tracks/interaction_track.html">
-<link rel="import" href="/tracing/ui/tracks/kernel_track.html">
-<link rel="import" href="/tracing/ui/tracks/process_track.html">
-
-<style>
-.model-track {
- -webkit-box-flex: 1;
-}
-</style>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- var SelectionState = tr.model.SelectionState;
- var EventPresenter = tr.ui.b.EventPresenter;
-
- /**
- * Visualizes a Model by building ProcessTracks and CpuTracks.
- * @constructor
- */
- var ModelTrack = tr.ui.b.define('model-track', tr.ui.tracks.ContainerTrack);
-
-
- ModelTrack.prototype = {
-
- __proto__: tr.ui.tracks.ContainerTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.ContainerTrack.prototype.decorate.call(this, viewport);
- this.classList.add('model-track');
-
- var typeInfos = tr.ui.tracks.Highlighter.getAllRegisteredTypeInfos();
- this.highlighters_ = typeInfos.map(
- function(typeInfo) {
- return new typeInfo.constructor(viewport);
- });
-
- this.upperMode_ = false;
- this.annotationViews_ = [];
- },
-
- // upperMode is true if the track is being used on the ruler.
- get upperMode() {
- return this.upperMode_;
- },
-
- set upperMode(upperMode) {
- this.upperMode_ = upperMode;
- this.updateContents_();
- },
-
- detach: function() {
- tr.ui.tracks.ContainerTrack.prototype.detach.call(this);
- },
-
- get model() {
- return this.model_;
- },
-
- set model(model) {
- this.model_ = model;
- this.updateContents_();
-
- this.model_.addEventListener('annotationChange',
- this.updateAnnotations_.bind(this));
- },
-
- get hasVisibleContent() {
- return this.children.length > 0;
- },
-
- updateContents_: function() {
- this.textContent = '';
- if (!this.model_)
- return;
-
- if (this.upperMode_)
- this.updateContentsForUpperMode_();
- else
- this.updateContentsForLowerMode_();
- },
-
- updateContentsForUpperMode_: function() {
- },
-
- updateContentsForLowerMode_: function() {
- if (this.model_.userModel.expectations.length) {
- var mrt = new tr.ui.tracks.InteractionTrack(this.viewport_);
- mrt.model = this.model_;
- this.appendChild(mrt);
- }
-
- if (this.model_.alerts.length) {
- var at = new tr.ui.tracks.AlertTrack(this.viewport_);
- at.alerts = this.model_.alerts;
- this.appendChild(at);
- }
-
- if (this.model_.globalMemoryDumps.length) {
- var gmdt = new tr.ui.tracks.GlobalMemoryDumpTrack(this.viewport_);
- gmdt.memoryDumps = this.model_.globalMemoryDumps;
- this.appendChild(gmdt);
- }
-
- this.appendDeviceTrack_();
- this.appendCpuUsageTrack_();
- this.appendKernelTrack_();
-
- // Get a sorted list of processes.
- var processes = this.model_.getAllProcesses();
- processes.sort(tr.model.Process.compare);
-
- for (var i = 0; i < processes.length; ++i) {
- var process = processes[i];
-
- var track = new tr.ui.tracks.ProcessTrack(this.viewport);
- track.process = process;
- if (!track.hasVisibleContent)
- continue;
-
- this.appendChild(track);
- }
- this.viewport_.rebuildEventToTrackMap();
- this.viewport_.rebuildContainerToTrackMap();
-
- for (var i = 0; i < this.highlighters_.length; i++) {
- this.highlighters_[i].processModel(this.model_);
- }
-
- this.updateAnnotations_();
- },
-
- updateAnnotations_: function() {
- this.annotationViews_ = [];
- var annotations = this.model_.getAllAnnotations();
- for (var i = 0; i < annotations.length; i++) {
- this.annotationViews_.push(
- annotations[i].getOrCreateView(this.viewport_));
- }
- this.invalidateDrawingContainer();
- },
-
- addEventsToTrackMap: function(eventToTrackMap) {
- if (!this.model_)
- return;
-
- var tracks = this.children;
- for (var i = 0; i < tracks.length; ++i)
- tracks[i].addEventsToTrackMap(eventToTrackMap);
-
- if (this.instantEvents === undefined)
- return;
-
- var vp = this.viewport_;
- this.instantEvents.forEach(function(ev) {
- eventToTrackMap.addEvent(ev, this);
- }.bind(this));
- },
-
- appendDeviceTrack_: function() {
- var device = this.model.device;
- var track = new tr.ui.tracks.DeviceTrack(this.viewport);
- track.device = this.model.device;
- if (!track.hasVisibleContent)
- return;
- this.appendChild(track);
- },
-
- appendKernelTrack_: function() {
- var kernel = this.model.kernel;
- var track = new tr.ui.tracks.KernelTrack(this.viewport);
- track.kernel = this.model.kernel;
- if (!track.hasVisibleContent)
- return;
- this.appendChild(track);
- },
-
- appendCpuUsageTrack_: function() {
- var track = new tr.ui.tracks.CpuUsageTrack(this.viewport);
- track.initialize(this.model);
- if (!track.hasVisibleContent)
- return;
- this.appendChild(track);
- },
-
- drawTrack: function(type) {
- var ctx = this.context();
- if (!this.model_)
- return;
-
- var pixelRatio = window.devicePixelRatio || 1;
- var bounds = this.getBoundingClientRect();
- var canvasBounds = ctx.canvas.getBoundingClientRect();
-
- ctx.save();
- ctx.translate(0, pixelRatio * (bounds.top - canvasBounds.top));
-
- var dt = this.viewport.currentDisplayTransform;
- var viewLWorld = dt.xViewToWorld(0);
- var viewRWorld = dt.xViewToWorld(bounds.width * pixelRatio);
-
- switch (type) {
- case tr.ui.tracks.DrawType.GRID:
- this.viewport.drawMajorMarkLines(ctx);
- // The model is the only thing that draws grid lines.
- ctx.restore();
- return;
-
- case tr.ui.tracks.DrawType.FLOW_ARROWS:
- if (this.model_.flowIntervalTree.size === 0) {
- ctx.restore();
- return;
- }
-
- this.drawFlowArrows_(viewLWorld, viewRWorld);
- ctx.restore();
- return;
-
- case tr.ui.tracks.DrawType.INSTANT_EVENT:
- if (!this.model_.instantEvents ||
- this.model_.instantEvents.length === 0)
- break;
-
- tr.ui.b.drawInstantSlicesAsLines(
- ctx,
- this.viewport.currentDisplayTransform,
- viewLWorld,
- viewRWorld,
- bounds.height,
- this.model_.instantEvents,
- 4);
-
- break;
-
- case tr.ui.tracks.DrawType.MARKERS:
- if (!this.viewport.interestRange.isEmpty) {
- this.viewport.interestRange.draw(ctx, viewLWorld, viewRWorld);
- this.viewport.interestRange.drawIndicators(
- ctx, viewLWorld, viewRWorld);
- }
- ctx.restore();
- return;
-
- case tr.ui.tracks.DrawType.HIGHLIGHTS:
- for (var i = 0; i < this.highlighters_.length; i++) {
- this.highlighters_[i].drawHighlight(ctx, dt, viewLWorld, viewRWorld,
- bounds.height);
- }
- ctx.restore();
- return;
-
- case tr.ui.tracks.DrawType.ANNOTATIONS:
- for (var i = 0; i < this.annotationViews_.length; i++) {
- this.annotationViews_[i].draw(ctx);
- }
- ctx.restore();
- return;
- }
- ctx.restore();
-
- tr.ui.tracks.ContainerTrack.prototype.drawTrack.call(this, type);
- },
-
- drawFlowArrows_: function(viewLWorld, viewRWorld) {
- var ctx = this.context();
- var dt = this.viewport.currentDisplayTransform;
- dt.applyTransformToCanvas(ctx);
-
- var pixWidth = dt.xViewVectorToWorld(1);
-
- ctx.strokeStyle = 'rgba(0, 0, 0, 0.4)';
- ctx.fillStyle = 'rgba(0, 0, 0, 0.4)';
- ctx.lineWidth = pixWidth > 1.0 ? 1 : pixWidth;
-
- var events =
- this.model_.flowIntervalTree.findIntersection(viewLWorld, viewRWorld);
-
- // When not showing flow events, show only highlighted/selected ones.
- var onlyHighlighted = !this.viewport.showFlowEvents;
- var canvasBounds = ctx.canvas.getBoundingClientRect();
- for (var i = 0; i < events.length; ++i) {
- if (onlyHighlighted &&
- events[i].selectionState !== SelectionState.SELECTED &&
- events[i].selectionState !== SelectionState.HIGHLIGHTED)
- continue;
- this.drawFlowArrow_(ctx, events[i], canvasBounds, pixWidth);
- }
- },
-
- drawFlowArrow_: function(ctx, flowEvent,
- canvasBounds, pixWidth) {
- var pixelRatio = window.devicePixelRatio || 1;
-
- var startTrack = this.viewport.trackForEvent(flowEvent.startSlice);
- var endTrack = this.viewport.trackForEvent(flowEvent.endSlice);
-
- // TODO(nduca): Figure out how to draw flow arrows even when
- // processes are collapsed, bug #931.
- if (startTrack === undefined || endTrack === undefined)
- return;
-
- var startBounds = startTrack.getBoundingClientRect();
- var endBounds = endTrack.getBoundingClientRect();
-
- if (flowEvent.selectionState == SelectionState.SELECTED) {
- ctx.shadowBlur = 1;
- ctx.shadowColor = 'red';
- ctx.shadowOffsety = 2;
- ctx.strokeStyle = 'red';
- } else if (flowEvent.selectionState == SelectionState.HIGHLIGHTED) {
- ctx.shadowBlur = 1;
- ctx.shadowColor = 'red';
- ctx.shadowOffsety = 2;
- ctx.strokeStyle = 'red';
- } else if (flowEvent.selectionState == SelectionState.DIMMED) {
- ctx.shadowBlur = 0;
- ctx.shadowOffsetX = 0;
- ctx.strokeStyle = 'rgba(0, 0, 0, 0.2)';
- } else {
- var hasBoost = false;
- var startSlice = flowEvent.startSlice;
- hasBoost |= startSlice.selectionState === SelectionState.SELECTED;
- hasBoost |= startSlice.selectionState === SelectionState.HIGHLIGHTED;
- var endSlice = flowEvent.endSlice;
- hasBoost |= endSlice.selectionState === SelectionState.SELECTED;
- hasBoost |= endSlice.selectionState === SelectionState.HIGHLIGHTED;
- if (hasBoost) {
- ctx.shadowBlur = 1;
- ctx.shadowColor = 'rgba(255, 0, 0, 0.4)';
- ctx.shadowOffsety = 2;
- ctx.strokeStyle = 'rgba(255, 0, 0, 0.4)';
- } else {
- ctx.shadowBlur = 0;
- ctx.shadowOffsetX = 0;
- ctx.strokeStyle = 'rgba(0, 0, 0, 0.4)';
- }
- }
-
- var startSize = startBounds.left + startBounds.top +
- startBounds.bottom + startBounds.right;
- var endSize = endBounds.left + endBounds.top +
- endBounds.bottom + endBounds.right;
- // Nothing to do if both ends of the track are collapsed.
- if (startSize === 0 && endSize === 0)
- return;
-
- var startY = this.calculateTrackY_(startTrack, canvasBounds);
- var endY = this.calculateTrackY_(endTrack, canvasBounds);
-
- var pixelStartY = pixelRatio * startY;
- var pixelEndY = pixelRatio * endY;
- var half = (flowEvent.end - flowEvent.start) / 2;
-
- ctx.beginPath();
- ctx.moveTo(flowEvent.start, pixelStartY);
- ctx.bezierCurveTo(
- flowEvent.start + half, pixelStartY,
- flowEvent.start + half, pixelEndY,
- flowEvent.end, pixelEndY);
- ctx.stroke();
-
- var arrowWidth = 5 * pixWidth * pixelRatio;
- var distance = flowEvent.end - flowEvent.start;
- if (distance <= (2 * arrowWidth))
- return;
-
- var tipX = flowEvent.end;
- var tipY = pixelEndY;
- var arrowHeight = (endBounds.height / 4) * pixelRatio;
- tr.ui.b.drawTriangle(ctx,
- tipX, tipY,
- tipX - arrowWidth, tipY - arrowHeight,
- tipX - arrowWidth, tipY + arrowHeight);
- ctx.fill();
- },
-
- calculateTrackY_: function(track, canvasBounds) {
- var bounds = track.getBoundingClientRect();
- var size = bounds.left + bounds.top + bounds.bottom + bounds.right;
- if (size === 0)
- return this.calculateTrackY_(track.parentNode, canvasBounds);
-
- return bounds.top - canvasBounds.top + (bounds.height / 2);
- },
-
- addIntersectingEventsInRangeToSelectionInWorldSpace: function(
- loWX, hiWX, viewPixWidthWorld, selection) {
- function onPickHit(instantEvent) {
- selection.push(instantEvent);
- }
- var instantEventWidth = 3 * viewPixWidthWorld;
- tr.b.iterateOverIntersectingIntervals(this.model_.instantEvents,
- function(x) { return x.start; },
- function(x) { return x.duration + instantEventWidth; },
- loWX, hiWX,
- onPickHit.bind(this));
-
- tr.ui.tracks.ContainerTrack.prototype.
- addIntersectingEventsInRangeToSelectionInWorldSpace.
- apply(this, arguments);
- },
-
- addClosestEventToSelection: function(worldX, worldMaxDist, loY, hiY,
- selection) {
- this.addClosestInstantEventToSelection(this.model_.instantEvents,
- worldX, worldMaxDist, selection);
- tr.ui.tracks.ContainerTrack.prototype.addClosestEventToSelection.
- apply(this, arguments);
- }
- };
-
- return {
- ModelTrack: ModelTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/multi_row_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/multi_row_track.html
deleted file mode 100644
index 04637ef2d2a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/multi_row_track.html
+++ /dev/null
@@ -1,218 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/tracks/container_track.html">
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/model/model_settings.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- /**
- * A track that displays a group of objects in multiple rows.
- * @constructor
- * @extends {ContainerTrack}
- */
- var MultiRowTrack = tr.ui.b.define(
- 'multi-row-track', tr.ui.tracks.ContainerTrack);
-
- MultiRowTrack.prototype = {
-
- __proto__: tr.ui.tracks.ContainerTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.ContainerTrack.prototype.decorate.call(this, viewport);
- this.tooltip_ = '';
- this.heading_ = '';
-
- this.groupingSource_ = undefined;
- this.itemsToGroup_ = undefined;
-
- this.defaultToCollapsedWhenSubRowCountMoreThan = 1;
-
- this.itemsGroupedOnLastUpdateContents_ = undefined;
-
- this.currentSubRows_ = [];
- this.expanded_ = true;
- },
-
- get itemsToGroup() {
- return this.itemsToGroup_;
- },
-
- setItemsToGroup: function(itemsToGroup, opt_groupingSource) {
- this.itemsToGroup_ = itemsToGroup;
- this.groupingSource_ = opt_groupingSource;
- this.updateContents_();
- this.updateExpandedStateFromGroupingSource_();
- },
-
- get heading() {
- return this.heading_;
- },
-
- set heading(h) {
- this.heading_ = h;
- this.updateContents_();
- },
-
- get tooltip() {
- return this.tooltip_;
- },
-
- set tooltip(t) {
- this.tooltip_ = t;
- this.updateContents_();
- },
-
- get subRows() {
- return this.currentSubRows_;
- },
-
- get hasVisibleContent() {
- return this.children.length > 0;
- },
-
- get expanded() {
- return this.expanded_;
- },
-
- set expanded(expanded) {
- if (this.expanded_ == expanded)
- return;
- this.expanded_ = expanded;
- this.expandedStateChanged_();
- },
-
- onHeadingClicked_: function(e) {
- if (this.subRows.length <= 1)
- return;
- this.expanded = !this.expanded;
-
- if (this.groupingSource_) {
- var modelSettings = new tr.model.ModelSettings(
- this.groupingSource_.model);
- modelSettings.setSettingFor(this.groupingSource_, 'expanded',
- this.expanded);
- }
-
- e.stopPropagation();
- },
-
- updateExpandedStateFromGroupingSource_: function() {
- if (this.groupingSource_) {
- var numSubRows = this.subRows.length;
- var modelSettings = new tr.model.ModelSettings(
- this.groupingSource_.model);
- if (numSubRows > 1) {
- var defaultExpanded;
- if (numSubRows > this.defaultToCollapsedWhenSubRowCountMoreThan) {
- defaultExpanded = false;
- } else {
- defaultExpanded = true;
- }
- this.expanded = modelSettings.getSettingFor(
- this.groupingSource_, 'expanded', defaultExpanded);
- } else {
- this.expanded = undefined;
- }
- }
- },
-
- expandedStateChanged_: function() {
- var minH = Math.max(2, Math.ceil(18 / this.children.length));
- var h = (this.expanded_ ? 18 : minH) + 'px';
-
- for (var i = 0; i < this.children.length; i++) {
- this.children[i].height = h;
- if (i === 0)
- this.children[i].arrowVisible = true;
- this.children[i].expanded = this.expanded;
- }
-
- if (this.children.length === 1) {
- this.children[0].expanded = true;
- this.children[0].arrowVisible = false;
- }
- },
-
- updateContents_: function() {
- tr.ui.tracks.ContainerTrack.prototype.updateContents_.call(this);
- if (!this.itemsToGroup_) {
- this.updateHeadingAndTooltip_();
- this.currentSubRows_ = [];
- return;
- }
-
- if (this.areArrayContentsSame_(this.itemsGroupedOnLastUpdateContents_,
- this.itemsToGroup_)) {
- this.updateHeadingAndTooltip_();
- return;
- }
-
- this.itemsGroupedOnLastUpdateContents_ = this.itemsToGroup_;
-
- this.detach();
- if (!this.itemsToGroup_.length) {
- this.currentSubRows_ = [];
- return;
- }
- var subRows = this.buildSubRows_(this.itemsToGroup_);
- this.currentSubRows_ = subRows;
- for (var srI = 0; srI < subRows.length; srI++) {
- var subRow = subRows[srI];
- if (!subRow.length)
- continue;
- var track = this.addSubTrack_(subRow);
- track.addEventListener(
- 'heading-clicked', this.onHeadingClicked_.bind(this));
- }
- this.updateHeadingAndTooltip_();
- this.expandedStateChanged_();
- },
-
- updateHeadingAndTooltip_: function() {
- if (!this.firstChild)
- return;
- this.firstChild.heading = this.heading_;
- this.firstChild.tooltip = this.tooltip_;
- },
-
- /**
- * Breaks up the list of slices into N rows, each of which is a list of
- * slices that are non overlapping.
- */
- buildSubRows_: function(itemsToGroup) {
- throw new Error('Not implemented');
- },
-
- addSubTrack_: function(subRowItems) {
- throw new Error('Not implemented');
- },
-
- areArrayContentsSame_: function(a, b) {
- if (!a || !b)
- return false;
- if (!a.length || !b.length)
- return false;
- if (a.length != b.length)
- return false;
- for (var i = 0; i < a.length; ++i) {
- if (a[i] != b[i])
- return false;
- }
- return true;
- }
- };
-
- return {
- MultiRowTrack: MultiRowTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_group_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_group_track.html
deleted file mode 100644
index 6bb39093015..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_group_track.html
+++ /dev/null
@@ -1,87 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/object_snapshot_view.html">
-<link rel="import" href="/tracing/ui/analysis/object_instance_view.html">
-<link rel="import" href="/tracing/ui/tracks/multi_row_track.html">
-<link rel="import" href="/tracing/ui/tracks/object_instance_track.html">
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- /**
- * A track that displays a ObjectInstanceGroup.
- * @constructor
- * @extends {ContainerTrack}
- */
- var ObjectInstanceGroupTrack = tr.ui.b.define(
- 'object-instance-group-track', tr.ui.tracks.MultiRowTrack);
-
- ObjectInstanceGroupTrack.prototype = {
-
- __proto__: tr.ui.tracks.MultiRowTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.MultiRowTrack.prototype.decorate.call(this, viewport);
- this.classList.add('object-instance-group-track');
- this.objectInstances_ = undefined;
- },
-
- get objectInstances() {
- return this.itemsToGroup;
- },
-
- set objectInstances(objectInstances) {
- this.setItemsToGroup(objectInstances);
- },
-
- addSubTrack_: function(objectInstances) {
- var hasMultipleRows = this.subRows.length > 1;
- var track = new tr.ui.tracks.ObjectInstanceTrack(this.viewport);
- track.objectInstances = objectInstances;
- this.appendChild(track);
- return track;
- },
-
- buildSubRows_: function(objectInstances) {
- objectInstances.sort(function(x, y) {
- return x.creationTs - y.creationTs;
- });
-
- var subRows = [];
- for (var i = 0; i < objectInstances.length; i++) {
- var objectInstance = objectInstances[i];
-
- var found = false;
- for (var j = 0; j < subRows.length; j++) {
- var subRow = subRows[j];
- var lastItemInSubRow = subRow[subRow.length - 1];
- if (objectInstance.creationTs >= lastItemInSubRow.deletionTs) {
- found = true;
- subRow.push(objectInstance);
- break;
- }
- }
- if (!found) {
- var subRow = [objectInstance];
- subRows.push(subRow);
- }
- }
- return subRows;
- },
- updateHeadingAndTooltip_: function() {
- }
- };
-
- return {
- ObjectInstanceGroupTrack: ObjectInstanceGroupTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_track.css b/chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_track.css
deleted file mode 100644
index 0919e85524e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_track.css
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-.object-instance-track {
- height: 18px;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_track.html
deleted file mode 100644
index 4b6d3cacf11..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_track.html
+++ /dev/null
@@ -1,299 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/tracks/object_instance_track.css">
-
-<link rel="import" href="/tracing/base/extension_registry.html">
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/model/event.html">
-<link rel="import" href="/tracing/ui/base/event_presenter.html">
-<link rel="import" href="/tracing/ui/base/heading.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/tracks/track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- var SelectionState = tr.model.SelectionState;
- var EventPresenter = tr.ui.b.EventPresenter;
-
- /**
- * A track that displays an array of Slice objects.
- * @constructor
- * @extends {Track}
- */
- var ObjectInstanceTrack = tr.ui.b.define(
- 'object-instance-track', tr.ui.tracks.Track);
-
- ObjectInstanceTrack.prototype = {
- __proto__: tr.ui.tracks.Track.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.Track.prototype.decorate.call(this, viewport);
- this.classList.add('object-instance-track');
- this.objectInstances_ = [];
- this.objectSnapshots_ = [];
-
- this.heading_ = document.createElement('tr-ui-heading');
- this.appendChild(this.heading_);
- },
-
- set heading(heading) {
- this.heading_.heading = heading;
- },
-
- get heading() {
- return this.heading_.heading;
- },
-
- set tooltip(tooltip) {
- this.heading_.tooltip = tooltip;
- },
-
- get objectInstances() {
- return this.objectInstances_;
- },
-
- set objectInstances(objectInstances) {
- if (!objectInstances || objectInstances.length == 0) {
- this.heading = '';
- this.objectInstances_ = [];
- this.objectSnapshots_ = [];
- return;
- }
- this.heading = objectInstances[0].typeName;
- this.objectInstances_ = objectInstances;
- this.objectSnapshots_ = [];
- this.objectInstances_.forEach(function(instance) {
- this.objectSnapshots_.push.apply(
- this.objectSnapshots_, instance.snapshots);
- }, this);
- this.objectSnapshots_.sort(function(a, b) {
- return a.ts - b.ts;
- });
- },
-
- get height() {
- return window.getComputedStyle(this).height;
- },
-
- set height(height) {
- this.style.height = height;
- },
-
- get snapshotRadiusView() {
- return 7 * (window.devicePixelRatio || 1);
- },
-
- draw: function(type, viewLWorld, viewRWorld) {
- switch (type) {
- case tr.ui.tracks.DrawType.GENERAL_EVENT:
- this.drawLetterDots_(viewLWorld, viewRWorld);
- break;
- }
- },
-
- drawLetterDots_: function(viewLWorld, viewRWorld) {
- var ctx = this.context();
- var pixelRatio = window.devicePixelRatio || 1;
-
- var bounds = this.getBoundingClientRect();
- var height = bounds.height * pixelRatio;
- var halfHeight = height * 0.5;
- var twoPi = Math.PI * 2;
-
- // Culling parameters.
- var dt = this.viewport.currentDisplayTransform;
- var snapshotRadiusView = this.snapshotRadiusView;
- var snapshotRadiusWorld = dt.xViewVectorToWorld(height);
- var loI;
-
- // Begin rendering in world space.
- ctx.save();
- dt.applyTransformToCanvas(ctx);
-
- // Instances
- var objectInstances = this.objectInstances_;
- var loI = tr.b.findLowIndexInSortedArray(
- objectInstances,
- function(instance) {
- return instance.deletionTs;
- },
- viewLWorld);
- ctx.strokeStyle = 'rgb(0,0,0)';
- for (var i = loI; i < objectInstances.length; ++i) {
- var instance = objectInstances[i];
- var x = instance.creationTs;
- if (x > viewRWorld)
- break;
-
- var right = instance.deletionTs == Number.MAX_VALUE ?
- viewRWorld : instance.deletionTs;
- ctx.fillStyle = EventPresenter.getObjectInstanceColor(instance);
- ctx.fillRect(x, pixelRatio, right - x, height - 2 * pixelRatio);
- }
- ctx.restore();
-
- // Snapshots. Has to run in worldspace because ctx.arc gets transformed.
- var objectSnapshots = this.objectSnapshots_;
- loI = tr.b.findLowIndexInSortedArray(
- objectSnapshots,
- function(snapshot) {
- return snapshot.ts + snapshotRadiusWorld;
- },
- viewLWorld);
- for (var i = loI; i < objectSnapshots.length; ++i) {
- var snapshot = objectSnapshots[i];
- var x = snapshot.ts;
- if (x - snapshotRadiusWorld > viewRWorld)
- break;
- var xView = dt.xWorldToView(x);
-
- ctx.fillStyle = EventPresenter.getObjectSnapshotColor(snapshot);
- ctx.beginPath();
- ctx.arc(xView, halfHeight, snapshotRadiusView, 0, twoPi);
- ctx.fill();
- if (snapshot.selected) {
- ctx.lineWidth = 5;
- ctx.strokeStyle = 'rgb(100,100,0)';
- ctx.stroke();
-
- ctx.beginPath();
- ctx.arc(xView, halfHeight, snapshotRadiusView - 1, 0, twoPi);
- ctx.lineWidth = 2;
- ctx.strokeStyle = 'rgb(255,255,0)';
- ctx.stroke();
- } else {
- ctx.lineWidth = 1;
- ctx.strokeStyle = 'rgb(0,0,0)';
- ctx.stroke();
- }
- }
- ctx.lineWidth = 1;
-
- // For performance reasons we only check the SelectionState of the first
- // instance. If it's DIMMED we assume that all are DIMMED.
- // TODO(egraether): Allow partial highlight.
- var selectionState = SelectionState.NONE;
- if (objectInstances.length &&
- objectInstances[0].selectionState === SelectionState.DIMMED) {
- selectionState = SelectionState.DIMMED;
- }
-
- // Dim the track when there is an active highlight.
- if (selectionState === SelectionState.DIMMED) {
- var width = bounds.width * pixelRatio;
- ctx.fillStyle = 'rgba(255,255,255,0.5)';
- ctx.fillRect(0, 0, width, height);
- ctx.restore();
- }
- },
-
- addEventsToTrackMap: function(eventToTrackMap) {
- if (this.objectInstance_ !== undefined) {
- this.objectInstance_.forEach(function(obj) {
- eventToTrackMap.addEvent(obj, this);
- }, this);
- }
-
- if (this.objectSnapshots_ !== undefined) {
- this.objectSnapshots_.forEach(function(obj) {
- eventToTrackMap.addEvent(obj, this);
- }, this);
- }
- },
-
- addIntersectingEventsInRangeToSelectionInWorldSpace: function(
- loWX, hiWX, viewPixWidthWorld, selection) {
- // Pick snapshots first.
- var foundSnapshot = false;
- function onSnapshot(snapshot) {
- selection.push(snapshot);
- foundSnapshot = true;
- }
- var snapshotRadiusView = this.snapshotRadiusView;
- var snapshotRadiusWorld = viewPixWidthWorld * snapshotRadiusView;
- tr.b.iterateOverIntersectingIntervals(
- this.objectSnapshots_,
- function(x) { return x.ts - snapshotRadiusWorld; },
- function(x) { return 2 * snapshotRadiusWorld; },
- loWX, hiWX,
- onSnapshot);
- if (foundSnapshot)
- return;
-
- // Try picking instances.
- tr.b.iterateOverIntersectingIntervals(
- this.objectInstances_,
- function(x) { return x.creationTs; },
- function(x) { return x.deletionTs - x.creationTs; },
- loWX, hiWX,
- selection.push.bind(selection));
- },
-
- /**
- * Add the item to the left or right of the provided event, if any, to the
- * selection.
- * @param {event} The current event item.
- * @param {Number} offset Number of slices away from the event to look.
- * @param {Selection} selection The selection to add an event to,
- * if found.
- * @return {boolean} Whether an event was found.
- * @private
- */
- addEventNearToProvidedEventToSelection: function(event, offset, selection) {
- var events;
- if (event instanceof tr.model.ObjectSnapshot)
- events = this.objectSnapshots_;
- else if (event instanceof tr.model.ObjectInstance)
- events = this.objectInstances_;
- else
- throw new Error('Unrecognized event');
-
- var index = events.indexOf(event);
- var newIndex = index + offset;
- if (newIndex >= 0 && newIndex < events.length) {
- selection.push(events[newIndex]);
- return true;
- }
- return false;
- },
-
- addAllEventsMatchingFilterToSelection: function(filter, selection) {
- },
-
- addClosestEventToSelection: function(worldX, worldMaxDist, loY, hiY,
- selection) {
- var snapshot = tr.b.findClosestElementInSortedArray(
- this.objectSnapshots_,
- function(x) { return x.ts; },
- worldX,
- worldMaxDist);
-
- if (!snapshot)
- return;
-
- selection.push(snapshot);
-
- // TODO(egraether): Search for object instances as well, which was not
- // implemented because it makes little sense with the current visual and
- // needs to take care of overlapping intervals.
- }
- };
-
-
- var options = new tr.b.ExtensionRegistryOptions(
- tr.b.TYPE_BASED_REGISTRY_MODE);
- tr.b.decorateExtensionRegistry(ObjectInstanceTrack, options);
-
- return {
- ObjectInstanceTrack: ObjectInstanceTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_track_test.html
deleted file mode 100644
index 1ba79b9db6c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/object_instance_track_test.html
+++ /dev/null
@@ -1,111 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/object_collection.html">
-<link rel="import" href="/tracing/model/scoped_id.html">
-<link rel="import" href="/tracing/model/selection_state.html">
-<link rel="import" href="/tracing/ui/timeline_viewport.html">
-<link rel="import" href="/tracing/ui/tracks/drawing_container.html">
-<link rel="import" href="/tracing/ui/tracks/object_instance_track.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var EventSet = tr.model.EventSet;
- var ObjectInstanceTrack = tr.ui.tracks.ObjectInstanceTrack;
- var Viewport = tr.ui.TimelineViewport;
-
- var createObjects = function() {
- var objects = new tr.model.ObjectCollection({});
- var scopedId1 = new tr.model.ScopedId('ptr', '0x1000');
- objects.idWasCreated(scopedId1, 'tr.e.cc', 'Frame', 10);
- objects.addSnapshot(scopedId1, 'tr.e.cc', 'Frame', 10, 'snapshot-1');
- objects.addSnapshot(scopedId1, 'tr.e.cc', 'Frame', 25, 'snapshot-2');
- objects.addSnapshot(scopedId1, 'tr.e.cc', 'Frame', 40, 'snapshot-3');
- objects.idWasDeleted(scopedId1, 'tr.e.cc', 'Frame', 45);
-
- var scopedId2 = new tr.model.ScopedId('ptr', '0x1001');
- objects.idWasCreated(scopedId2, 'skia', 'Picture', 20);
- objects.addSnapshot(scopedId2, 'skia', 'Picture', 20, 'snapshot-1');
- objects.idWasDeleted(scopedId2, 'skia', 'Picture', 25);
- return objects;
- };
-
- test('instantiate', function() {
- var objects = createObjects();
- var frames = objects.getAllInstancesByTypeName()['Frame'];
- frames[0].snapshots[1].selectionState =
- tr.model.SelectionState.SELECTED;
-
- var div = document.createElement('div');
-
- var viewport = new Viewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- var track = ObjectInstanceTrack(viewport);
- drawingContainer.appendChild(track);
-
- this.addHTMLOutput(div);
- drawingContainer.invalidate();
-
- track.heading = 'testBasic';
- track.objectInstances = frames;
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 50, track.clientWidth);
- track.viewport.setDisplayTransformImmediately(dt);
- });
-
- test('selectionHitTestingWithThreadTrack', function() {
- var objects = createObjects();
- var frames = objects.getAllInstancesByTypeName()['Frame'];
-
- var track = ObjectInstanceTrack(new Viewport());
- track.objectInstances = frames;
-
- // Hit outside range
- var selection = new EventSet();
- track.addIntersectingEventsInRangeToSelectionInWorldSpace(
- 8, 8.1, 0.1, selection);
- assert.equal(selection.length, 0);
-
- // Hit the first snapshot, via pixel-nearness.
- selection = new EventSet();
- track.addIntersectingEventsInRangeToSelectionInWorldSpace(
- 9.98, 9.99, 0.1, selection);
- assert.equal(selection.length, 1);
- assert.instanceOf(tr.b.getOnlyElement(selection), tr.model.ObjectSnapshot);
-
- // Hit the instance, between the 1st and 2nd snapshots
- selection = new EventSet();
- track.addIntersectingEventsInRangeToSelectionInWorldSpace(
- 20, 20.1, 0.1, selection);
- assert.equal(selection.length, 1);
- assert.instanceOf(tr.b.getOnlyElement(selection), tr.model.ObjectInstance);
- });
-
- test('addEventNearToProvidedEventToSelection', function() {
- var objects = createObjects();
- var frames = objects.getAllInstancesByTypeName()['Frame'];
-
- var track = ObjectInstanceTrack(new Viewport());
- track.objectInstances = frames;
-
- var instance = new tr.model.ObjectInstance(
- {}, new tr.model.ScopedId('ptr', '0x1000'), 'cat', 'n', 10);
-
- assert.doesNotThrow(function() {
- track.addEventNearToProvidedEventToSelection(instance, 0, undefined);
- });
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/power_series_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/power_series_track.html
deleted file mode 100644
index 5905882acff..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/power_series_track.html
+++ /dev/null
@@ -1,83 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/tracks/chart_axis.html">
-<link rel="import" href="/tracing/ui/tracks/chart_point.html">
-<link rel="import" href="/tracing/ui/tracks/chart_series.html">
-<link rel="import" href="/tracing/ui/tracks/chart_track.html">
-
-<style>
-.power-series-track {
- height: 90px;
-}
-</style>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- var ColorScheme = tr.b.ColorScheme;
- var ChartTrack = tr.ui.tracks.ChartTrack;
-
- /**
- * A track that displays a PowerSeries.
- *
- * @constructor
- * @extends {ChartTrack}
- */
- var PowerSeriesTrack = tr.ui.b.define('power-series-track', ChartTrack);
-
- PowerSeriesTrack.prototype = {
- __proto__: ChartTrack.prototype,
-
- decorate: function(viewport) {
- ChartTrack.prototype.decorate.call(this, viewport);
- this.classList.add('power-series-track');
- this.heading = 'Power';
- this.powerSeries_ = undefined;
- },
-
- set powerSeries(powerSeries) {
- this.powerSeries_ = powerSeries;
-
- this.series = this.buildChartSeries_();
- this.autoSetAllAxes({expandMax: true});
- },
-
- get hasVisibleContent() {
- return (this.powerSeries_ && this.powerSeries_.samples.length > 0);
- },
-
- addContainersToTrackMap: function(containerToTrackMap) {
- containerToTrackMap.addContainer(this.powerSeries_, this);
- },
-
- buildChartSeries_: function() {
- if (!this.hasVisibleContent)
- return [];
-
- var axis = new tr.ui.tracks.ChartAxis(0, undefined);
- var pts = this.powerSeries_.samples.map(function(smpl) {
- return new tr.ui.tracks.ChartPoint(smpl, smpl.start, smpl.power);
- });
- var renderingConfig = {
- chartType: tr.ui.tracks.ChartSeriesType.AREA,
- colorId: ColorScheme.getColorIdForGeneralPurposeString(this.heading)
- };
-
- return [new tr.ui.tracks.ChartSeries(pts, axis, renderingConfig)];
- }
- };
-
- return {
- PowerSeriesTrack: PowerSeriesTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/power_series_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/power_series_track_test.html
deleted file mode 100644
index 29997361918..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/power_series_track_test.html
+++ /dev/null
@@ -1,122 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel='import' href='/tracing/model/device.html'>
-<link rel='import' href='/tracing/model/model.html'>
-<link rel='import' href='/tracing/model/power_series.html'>
-<link rel='import' href='/tracing/ui/base/constants.html'>
-<link rel='import' href='/tracing/ui/timeline_viewport.html'>
-<link rel='import' href='/tracing/ui/tracks/container_to_track_map.html'>
-<link rel='import' href='/tracing/ui/tracks/drawing_container.html'>
-<link rel="import" href="/tracing/ui/tracks/power_series_track.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- var Device = tr.model.Device;
- var Model = tr.Model;
- var PowerSeries = tr.model.PowerSeries;
- var PowerSeriesTrack = tr.ui.tracks.PowerSeriesTrack;
-
- var createDrawingContainer = function(series) {
- var div = document.createElement('div');
- var viewport = new tr.ui.TimelineViewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- if (series) {
- series.updateBounds();
- setDisplayTransformFromBounds(viewport, series.bounds);
- }
-
- return drawingContainer;
- };
-
- /**
- * Sets the mapping between the input range of timestamps and the output range
- * of horizontal pixels.
- */
- var setDisplayTransformFromBounds = function(viewport, bounds) {
- var dt = new tr.ui.TimelineDisplayTransform();
- var pixelRatio = window.devicePixelRatio || 1;
- var chartPixelWidth =
- (window.innerWidth - tr.ui.b.constants.HEADING_WIDTH) * pixelRatio;
- dt.xSetWorldBounds(bounds.min, bounds.max, chartPixelWidth);
- viewport.setDisplayTransformImmediately(dt);
- };
-
- test('instantiate', function() {
- var series = new PowerSeries(new Model().device);
- series.addPowerSample(0, 1);
- series.addPowerSample(0.5, 2);
- series.addPowerSample(1, 3);
- series.addPowerSample(1.5, 4);
-
- var drawingContainer = createDrawingContainer(series);
- var track = new PowerSeriesTrack(drawingContainer.viewport);
- track.powerSeries = series;
- drawingContainer.appendChild(track);
-
- this.addHTMLOutput(drawingContainer);
- });
-
- test('hasVisibleContent_trueWithPowerSamplesPresent', function() {
- var series = new PowerSeries(new Model().device);
- series.addPowerSample(0, 1);
- series.addPowerSample(0.5, 2);
- series.addPowerSample(1, 3);
- series.addPowerSample(1.5, 4);
-
- var div = document.createElement('div');
- var viewport = new tr.ui.TimelineViewport(div);
-
- var track = new PowerSeriesTrack(viewport);
- track.powerSeries = series;
-
- assert.isTrue(track.hasVisibleContent);
- });
-
- test('hasVisibleContent_falseWithUndefinedPowerSeries', function() {
- var div = document.createElement('div');
- var viewport = new tr.ui.TimelineViewport(div);
-
- var track = new PowerSeriesTrack(viewport);
- track.powerSeries = undefined;
-
- assert.notOk(track.hasVisibleContent);
- });
-
- test('hasVisibleContent_falseWithEmptyPowerSeries', function() {
- var div = document.createElement('div');
- var viewport = new tr.ui.TimelineViewport(div);
-
- var track = new PowerSeriesTrack(viewport);
- var series = new PowerSeries(new Model().device);
- track.powerSeries = series;
-
- assert.notOk(track.hasVisibleContent);
- });
-
- test('addContainersToTrackMap', function() {
- var div = document.createElement('div');
- var viewport = new tr.ui.TimelineViewport(div);
-
- var powerSeriesTrack = new PowerSeriesTrack(viewport);
- var series = new PowerSeries(new Model().device);
- powerSeriesTrack.powerSeries = series;
-
- var containerToTrackMap = new tr.ui.tracks.ContainerToTrackMap();
- powerSeriesTrack.addContainersToTrackMap(containerToTrackMap);
-
- assert.equal(
- containerToTrackMap.getTrackByStableId('Device.PowerSeries'),
- powerSeriesTrack);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_memory_dump_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_memory_dump_track.html
deleted file mode 100644
index c197bd9d010..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_memory_dump_track.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/tracks/chart_track.html">
-<link rel="import" href="/tracing/ui/tracks/container_track.html">
-<link rel="import" href="/tracing/ui/tracks/memory_dump_track_util.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- var ALLOCATED_MEMORY_TRACK_HEIGHT = 50;
-
- /**
- * A track that displays an array of ProcessMemoryDump objects.
- * @constructor
- * @extends {ContainerTrack}
- */
- var ProcessMemoryDumpTrack = tr.ui.b.define(
- 'process-memory-dump-track', tr.ui.tracks.ContainerTrack);
-
- ProcessMemoryDumpTrack.prototype = {
- __proto__: tr.ui.tracks.ContainerTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.ContainerTrack.prototype.decorate.call(this, viewport);
- this.memoryDumps_ = undefined;
- },
-
- get memoryDumps() {
- return this.memoryDumps_;
- },
-
- set memoryDumps(memoryDumps) {
- this.memoryDumps_ = memoryDumps;
- this.updateContents_();
- },
-
- updateContents_: function() {
- this.clearTracks_();
-
- // Show no tracks if there are no dumps.
- if (!this.memoryDumps_ || !this.memoryDumps_.length)
- return;
-
- this.appendAllocatedMemoryTrack_();
- },
-
- appendAllocatedMemoryTrack_: function() {
- var series = tr.ui.tracks.buildProcessAllocatedMemoryChartSeries(
- this.memoryDumps_);
- if (!series)
- return;
-
- var track = new tr.ui.tracks.ChartTrack(this.viewport);
- track.heading = 'Memory per component';
- track.height = ALLOCATED_MEMORY_TRACK_HEIGHT + 'px';
- track.series = series;
- track.autoSetAllAxes({expandMax: true});
- this.appendChild(track);
- }
- };
-
- return {
- ProcessMemoryDumpTrack: ProcessMemoryDumpTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_memory_dump_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_memory_dump_track_test.html
deleted file mode 100644
index a4515d50403..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_memory_dump_track_test.html
+++ /dev/null
@@ -1,55 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/ui/timeline_viewport.html">
-<link rel="import" href="/tracing/ui/tracks/drawing_container.html">
-<link rel="import" href="/tracing/ui/tracks/process_memory_dump_track.html">
-<link rel="import" href="/tracing/ui/tracks/memory_dump_track_test_utils.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Viewport = tr.ui.TimelineViewport;
- var ProcessMemoryDumpTrack = tr.ui.tracks.ProcessMemoryDumpTrack;
- var createTestProcessMemoryDumps = tr.ui.tracks.createTestProcessMemoryDumps;
-
- function instantiateTrack(withVMRegions, withAllocatorDumps,
- expectedTrackCount) {
- var dumps = createTestProcessMemoryDumps(withVMRegions, withAllocatorDumps);
-
- var div = document.createElement('div');
- var viewport = new Viewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- var track = new ProcessMemoryDumpTrack(viewport);
- drawingContainer.appendChild(track);
- drawingContainer.invalidate();
-
- track.memoryDumps = dumps;
-
- // TODO(petrcermak): Check that the div has indeed zero size.
- if (expectedTrackCount > 0)
- this.addHTMLOutput(div);
-
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 50, track.clientWidth);
- track.viewport.setDisplayTransformImmediately(dt);
-
- assert.lengthOf(track.tracks_, expectedTrackCount);
- };
-
- test('instantiate_withoutMemoryAllocatorDumps', function() {
- instantiateTrack.call(this, false, false, 0);
- });
- test('instantiate_withMemoryAllocatorDumps', function() {
- instantiateTrack.call(this, false, true, 1);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_summary_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_summary_track.html
deleted file mode 100644
index 4390766292d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_summary_track.html
+++ /dev/null
@@ -1,130 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/color_scheme.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/tracks/rect_track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- var ColorScheme = tr.b.ColorScheme;
-
- /**
- * Visualizes a Process's state using a series of rects to represent activity.
- * @constructor
- */
- var ProcessSummaryTrack = tr.ui.b.define('process-summary-track',
- tr.ui.tracks.RectTrack);
-
- ProcessSummaryTrack.buildRectsFromProcess = function(process) {
- if (!process)
- return [];
-
- var ops = [];
- // build list of start/end ops for each top level or important slice
- var pushOp = function(isStart, time, slice) {
- ops.push({
- isStart: isStart,
- time: time,
- slice: slice
- });
- };
- for (var tid in process.threads) {
- var sliceGroup = process.threads[tid].sliceGroup;
-
- sliceGroup.topLevelSlices.forEach(function(slice) {
- pushOp(true, slice.start, undefined);
- pushOp(false, slice.end, undefined);
- });
- sliceGroup.slices.forEach(function(slice) {
- if (slice.important) {
- pushOp(true, slice.start, slice);
- pushOp(false, slice.end, slice);
- }
- });
- }
- ops.sort(function(a, b) { return a.time - b.time; });
-
- var rects = [];
- /**
- * Build a row of rects which display one way for unimportant activity,
- * and during important slices, show up as those important slices.
- *
- * If an important slice starts in the middle of another,
- * just drop it on the floor.
- */
- var genericColorId = ColorScheme.getColorIdForReservedName('generic_work');
- var pushRect = function(start, end, slice) {
- rects.push(new tr.ui.tracks.Rect(
- slice, /* modelItem: show selection state of slice if present */
- slice ? slice.title : '', /* title */
- slice ? slice.colorId : genericColorId, /* colorId */
- start, /* start */
- end - start /* duration */));
- }
- var depth = 0;
- var currentSlice = undefined;
- var lastStart = undefined;
- ops.forEach(function(op) {
- depth += op.isStart ? 1 : -1;
-
- if (currentSlice) {
- // simply find end of current important slice
- if (!op.isStart && op.slice == currentSlice) {
- // important slice has ended
- pushRect(lastStart, op.time, currentSlice);
- lastStart = depth >= 1 ? op.time : undefined;
- currentSlice = undefined;
- }
- } else {
- if (op.isStart) {
- if (depth == 1) {
- lastStart = op.time;
- currentSlice = op.slice;
- } else if (op.slice) {
- // switch to slice
- if (op.time != lastStart) {
- pushRect(lastStart, op.time, undefined);
- lastStart = op.time;
- }
- currentSlice = op.slice;
- }
- } else {
- if (depth == 0) {
- pushRect(lastStart, op.time, undefined);
- lastStart = undefined;
- }
- }
- }
- });
- return rects;
- };
-
- ProcessSummaryTrack.prototype = {
- __proto__: tr.ui.tracks.RectTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.RectTrack.prototype.decorate.call(this, viewport);
- },
-
- get process() {
- return this.process_;
- },
-
- set process(process) {
- this.process_ = process;
- this.rects = ProcessSummaryTrack.buildRectsFromProcess(process);
- }
- };
-
- return {
- ProcessSummaryTrack: ProcessSummaryTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_summary_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_summary_track_test.html
deleted file mode 100644
index 11a68527a2e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_summary_track_test.html
+++ /dev/null
@@ -1,110 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/model.html">
-<link rel="import" href="/tracing/model/slice_group.html">
-<link rel="import" href="/tracing/ui/tracks/process_summary_track.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ProcessSummaryTrack = tr.ui.tracks.ProcessSummaryTrack;
-
- test('buildRectSimple', function() {
- var process;
- var model = tr.c.TestUtils.newModel(function(model) {
- process = model.getOrCreateProcess(1);
- // XXXX
- // XXXX
- var thread1 = process.getOrCreateThread(1);
- thread1.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx(
- {start: 1, duration: 4}));
- var thread2 = process.getOrCreateThread(2);
- thread2.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx(
- {start: 4, duration: 4}));
- });
-
- var rects = ProcessSummaryTrack.buildRectsFromProcess(process);
-
- assert.equal(rects.length, 1);
- var rect = rects[0];
- assert.closeTo(rect.start, 1, 1e-5);
- assert.closeTo(rect.end, 8, 1e-5);
- });
-
- test('buildRectComplex', function() {
- var process;
- var model = tr.c.TestUtils.newModel(function(model) {
- process = model.getOrCreateProcess(1);
- // XXXX X X XX
- // XXXX XXX X
- var thread1 = process.getOrCreateThread(1);
- thread1.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx(
- {start: 1, duration: 4}));
- thread1.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx(
- {start: 9, duration: 1}));
- thread1.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx(
- {start: 11, duration: 1}));
- thread1.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx(
- {start: 13, duration: 2}));
- var thread2 = process.getOrCreateThread(2);
- thread2.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx(
- {start: 4, duration: 4}));
- thread2.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx(
- {start: 9, duration: 3}));
- thread2.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx(
- {start: 16, duration: 1}));
- });
-
- var rects = ProcessSummaryTrack.buildRectsFromProcess(process);
-
- assert.equal(4, rects.length);
- assert.closeTo(rects[0].start, 1, 1e-5);
- assert.closeTo(rects[0].end, 8, 1e-5);
- assert.closeTo(rects[1].start, 9, 1e-5);
- assert.closeTo(rects[1].end, 12, 1e-5);
- assert.closeTo(rects[2].start, 13, 1e-5);
- assert.closeTo(rects[2].end, 15, 1e-5);
- assert.closeTo(rects[3].start, 16, 1e-5);
- assert.closeTo(rects[3].end, 17, 1e-5);
- });
-
- test('buildRectImportantSlice', function() {
- var process;
- var model = tr.c.TestUtils.newModel(function(model) {
- // [ unimportant ]
- // [important]
- var a = tr.c.TestUtils.newSliceEx(
- {title: 'unimportant', start: 4, duration: 21});
- var b = tr.c.TestUtils.newSliceEx(
- {title: 'important', start: 9, duration: 11});
- b.important = true;
- process = model.getOrCreateProcess(1);
- process.getOrCreateThread(1).sliceGroup.pushSlices([a, b]);
-
- model.importantSlice = b;
- });
-
- var rects = ProcessSummaryTrack.buildRectsFromProcess(process);
-
- assert.equal(3, rects.length);
- assert.closeTo(rects[0].start, 4, 1e-5);
- assert.closeTo(rects[0].end, 9, 1e-5);
- assert.closeTo(rects[1].start, 9, 1e-5);
- assert.closeTo(rects[1].end, 20, 1e-5);
- assert.closeTo(rects[2].start, 20, 1e-5);
- assert.closeTo(rects[2].end, 25, 1e-5);
-
- // middle rect represents important slice, so colorId & title are preserved
- assert.equal(rects[1].title, model.importantSlice.title);
- assert.equal(rects[1].colorId, model.importantSlice.colorId);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_track.html
deleted file mode 100644
index 42451c042d9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_track.html
+++ /dev/null
@@ -1,155 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/tracks/process_memory_dump_track.html">
-<link rel="import" href="/tracing/ui/tracks/process_track_base.html">
-<link rel="import" href="/tracing/ui/base/draw_helpers.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- var ProcessTrackBase = tr.ui.tracks.ProcessTrackBase;
-
- /**
- * @constructor
- */
- var ProcessTrack = tr.ui.b.define('process-track', ProcessTrackBase);
-
- ProcessTrack.prototype = {
- __proto__: ProcessTrackBase.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.ProcessTrackBase.prototype.decorate.call(this, viewport);
- },
-
- drawTrack: function(type) {
- switch (type) {
- case tr.ui.tracks.DrawType.INSTANT_EVENT:
- if (!this.processBase.instantEvents ||
- this.processBase.instantEvents.length === 0)
- break;
-
- var ctx = this.context();
-
- var pixelRatio = window.devicePixelRatio || 1;
- var bounds = this.getBoundingClientRect();
- var canvasBounds = ctx.canvas.getBoundingClientRect();
-
- ctx.save();
- ctx.translate(0, pixelRatio * (bounds.top - canvasBounds.top));
-
- var dt = this.viewport.currentDisplayTransform;
- var viewLWorld = dt.xViewToWorld(0);
- var viewRWorld = dt.xViewToWorld(
- bounds.width * pixelRatio);
-
- tr.ui.b.drawInstantSlicesAsLines(
- ctx,
- this.viewport.currentDisplayTransform,
- viewLWorld,
- viewRWorld,
- bounds.height,
- this.processBase.instantEvents,
- 2);
-
- ctx.restore();
-
- break;
-
- case tr.ui.tracks.DrawType.BACKGROUND:
- this.drawBackground_();
- // Don't bother recursing further, Process is the only level that
- // draws backgrounds.
- return;
- }
-
- tr.ui.tracks.ContainerTrack.prototype.drawTrack.call(this, type);
- },
-
- drawBackground_: function() {
- var ctx = this.context();
- var canvasBounds = ctx.canvas.getBoundingClientRect();
- var pixelRatio = window.devicePixelRatio || 1;
-
- var draw = false;
- ctx.fillStyle = '#eee';
- for (var i = 0; i < this.children.length; ++i) {
- if (!(this.children[i] instanceof tr.ui.tracks.Track) ||
- (this.children[i] instanceof tr.ui.tracks.SpacingTrack))
- continue;
-
- draw = !draw;
- if (!draw)
- continue;
-
- var bounds = this.children[i].getBoundingClientRect();
- ctx.fillRect(0, pixelRatio * (bounds.top - canvasBounds.top),
- ctx.canvas.width, pixelRatio * bounds.height);
- }
- },
-
- // Process maps to processBase because we derive from ProcessTrackBase.
- set process(process) {
- this.processBase = process;
- },
-
- get process() {
- return this.processBase;
- },
-
- get eventContainer() {
- return this.process;
- },
-
- addContainersToTrackMap: function(containerToTrackMap) {
- tr.ui.tracks.ProcessTrackBase.prototype.addContainersToTrackMap.apply(
- this, arguments);
- containerToTrackMap.addContainer(this.process, this);
- },
-
- appendMemoryDumpTrack_: function() {
- var processMemoryDumps = this.process.memoryDumps;
- if (processMemoryDumps.length) {
- var pmdt = new tr.ui.tracks.ProcessMemoryDumpTrack(this.viewport_);
- pmdt.memoryDumps = processMemoryDumps;
- this.appendChild(pmdt);
- }
- },
-
- addIntersectingEventsInRangeToSelectionInWorldSpace: function(
- loWX, hiWX, viewPixWidthWorld, selection) {
- function onPickHit(instantEvent) {
- selection.push(instantEvent);
- }
- var instantEventWidth = 2 * viewPixWidthWorld;
- tr.b.iterateOverIntersectingIntervals(this.processBase.instantEvents,
- function(x) { return x.start; },
- function(x) { return x.duration + instantEventWidth; },
- loWX, hiWX,
- onPickHit.bind(this));
-
- tr.ui.tracks.ContainerTrack.prototype.
- addIntersectingEventsInRangeToSelectionInWorldSpace.
- apply(this, arguments);
- },
-
- addClosestEventToSelection: function(worldX, worldMaxDist, loY, hiY,
- selection) {
- this.addClosestInstantEventToSelection(this.processBase.instantEvents,
- worldX, worldMaxDist, selection);
- tr.ui.tracks.ContainerTrack.prototype.addClosestEventToSelection.
- apply(this, arguments);
- }
- };
-
- return {
- ProcessTrack: ProcessTrack
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_track_base.css b/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_track_base.css
deleted file mode 100644
index 5f42096bbff..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_track_base.css
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-.process-track-header {
- -webkit-flex: 0 0 auto;
- background-image: -webkit-gradient(linear,
- 0 0, 100% 0,
- from(#E5E5E5),
- to(#D1D1D1));
- border-bottom: 1px solid #8e8e8e;
- border-top: 1px solid white;
- font-size: 75%;
-}
-
-.process-track-name:before {
- content: '\25B8'; /* Right triangle */
- padding: 0 5px;
-}
-
-.process-track-base.expanded .process-track-name:before {
- content: '\25BE'; /* Down triangle */
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_track_base.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_track_base.html
deleted file mode 100644
index d96f1ce02cb..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/process_track_base.html
+++ /dev/null
@@ -1,273 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/tracks/process_track_base.css">
-
-<link rel="import" href="/tracing/core/filter.html">
-<link rel="import" href="/tracing/model/model_settings.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/tracks/container_track.html">
-<link rel="import" href="/tracing/ui/tracks/counter_track.html">
-<link rel="import" href="/tracing/ui/tracks/frame_track.html">
-<link rel="import" href="/tracing/ui/tracks/object_instance_group_track.html">
-<link rel="import" href="/tracing/ui/tracks/process_summary_track.html">
-<link rel="import" href="/tracing/ui/tracks/spacing_track.html">
-<link rel="import" href="/tracing/ui/tracks/thread_track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- var ObjectSnapshotView = tr.ui.analysis.ObjectSnapshotView;
- var ObjectInstanceView = tr.ui.analysis.ObjectInstanceView;
- var SpacingTrack = tr.ui.tracks.SpacingTrack;
-
- /**
- * Visualizes a Process by building ThreadTracks and CounterTracks.
- * @constructor
- */
- var ProcessTrackBase =
- tr.ui.b.define('process-track-base', tr.ui.tracks.ContainerTrack);
-
- ProcessTrackBase.prototype = {
-
- __proto__: tr.ui.tracks.ContainerTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.ContainerTrack.prototype.decorate.call(this, viewport);
-
- this.processBase_ = undefined;
-
- this.classList.add('process-track-base');
- this.classList.add('expanded');
-
- this.processNameEl_ = tr.ui.b.createSpan();
- this.processNameEl_.classList.add('process-track-name');
-
- this.headerEl_ = tr.ui.b.createDiv({className: 'process-track-header'});
- this.headerEl_.appendChild(this.processNameEl_);
- this.headerEl_.addEventListener('click', this.onHeaderClick_.bind(this));
-
- this.appendChild(this.headerEl_);
- },
-
- get processBase() {
- return this.processBase_;
- },
-
- set processBase(processBase) {
- this.processBase_ = processBase;
-
- if (this.processBase_) {
- var modelSettings = new tr.model.ModelSettings(this.processBase_.model);
- var defaultValue = this.processBase_.important;
- this.expanded = modelSettings.getSettingFor(
- this.processBase_, 'expanded', defaultValue);
- }
-
- this.updateContents_();
- },
-
- get expanded() {
- return this.classList.contains('expanded');
- },
-
- set expanded(expanded) {
- expanded = !!expanded;
-
- if (this.expanded === expanded)
- return;
-
- this.classList.toggle('expanded');
-
- // Expanding and collapsing tracks is, essentially, growing and shrinking
- // the viewport. We dispatch a change event to trigger any processing
- // to happen.
- this.viewport_.dispatchChangeEvent();
-
- if (!this.processBase_)
- return;
-
- var modelSettings = new tr.model.ModelSettings(this.processBase_.model);
- modelSettings.setSettingFor(this.processBase_, 'expanded', expanded);
- this.updateContents_();
- this.viewport.rebuildEventToTrackMap();
- this.viewport.rebuildContainerToTrackMap();
- },
-
- get hasVisibleContent() {
- if (this.expanded)
- return this.children.length > 1;
- return true;
- },
-
- onHeaderClick_: function(e) {
- e.stopPropagation();
- e.preventDefault();
- this.expanded = !this.expanded;
- },
-
- updateContents_: function() {
- this.clearTracks_();
-
- if (!this.processBase_)
- return;
-
- this.processNameEl_.textContent = this.processBase_.userFriendlyName;
- this.headerEl_.title = this.processBase_.userFriendlyDetails;
-
- // Create the object instance tracks for this process.
- this.willAppendTracks_();
- if (this.expanded) {
- this.appendMemoryDumpTrack_();
- this.appendObjectInstanceTracks_();
- this.appendCounterTracks_();
- this.appendFrameTrack_();
- this.appendThreadTracks_();
- } else {
- this.appendSummaryTrack_();
- }
- this.didAppendTracks_();
- },
-
- addEventsToTrackMap: function(eventToTrackMap) {
- this.tracks_.forEach(function(track) {
- track.addEventsToTrackMap(eventToTrackMap);
- });
- },
-
- willAppendTracks_: function() {
- },
-
- didAppendTracks_: function() {
- },
-
- appendMemoryDumpTrack_: function() {
- },
-
- appendSummaryTrack_: function() {
- var track = new tr.ui.tracks.ProcessSummaryTrack(this.viewport);
- track.process = this.process;
- if (!track.hasVisibleContent)
- return;
- this.appendChild(track);
- // no spacing track, since this track only shown in collapsed state
- },
-
- appendFrameTrack_: function() {
- var frames = this.process ? this.process.frames : undefined;
- if (!frames || !frames.length)
- return;
-
- var track = new tr.ui.tracks.FrameTrack(this.viewport);
- track.frames = frames;
- this.appendChild(track);
- },
-
- appendObjectInstanceTracks_: function() {
- var instancesByTypeName =
- this.processBase_.objects.getAllInstancesByTypeName();
- var instanceTypeNames = tr.b.dictionaryKeys(instancesByTypeName);
- instanceTypeNames.sort();
-
- var didAppendAtLeastOneTrack = false;
- instanceTypeNames.forEach(function(typeName) {
- var allInstances = instancesByTypeName[typeName];
-
- // If a object snapshot has a view it will be shown,
- // unless the view asked for it to not be shown.
- var instanceViewInfo = ObjectInstanceView.getTypeInfo(
- undefined, typeName);
- var snapshotViewInfo = ObjectSnapshotView.getTypeInfo(
- undefined, typeName);
- if (instanceViewInfo && !instanceViewInfo.metadata.showInTrackView)
- instanceViewInfo = undefined;
- if (snapshotViewInfo && !snapshotViewInfo.metadata.showInTrackView)
- snapshotViewInfo = undefined;
- var hasViewInfo = instanceViewInfo || snapshotViewInfo;
-
- // There are some instances that don't merit their own track in
- // the UI. Filter them out.
- var visibleInstances = [];
- for (var i = 0; i < allInstances.length; i++) {
- var instance = allInstances[i];
-
- // Do not create tracks for instances that have no snapshots.
- if (instance.snapshots.length === 0)
- continue;
-
- // Do not create tracks for instances that have implicit snapshots
- // and don't have a view.
- if (instance.hasImplicitSnapshots && !hasViewInfo)
- continue;
-
- visibleInstances.push(instance);
- }
- if (visibleInstances.length === 0)
- return;
-
- // Look up the constructor for this track, or use the default
- // constructor if none exists.
- var trackConstructor =
- tr.ui.tracks.ObjectInstanceTrack.getConstructor(
- undefined, typeName);
- if (!trackConstructor) {
- var snapshotViewInfo = ObjectSnapshotView.getTypeInfo(
- undefined, typeName);
- if (snapshotViewInfo && snapshotViewInfo.metadata.showInstances) {
- trackConstructor = tr.ui.tracks.ObjectInstanceGroupTrack;
- } else {
- trackConstructor = tr.ui.tracks.ObjectInstanceTrack;
- }
- }
- var track = new trackConstructor(this.viewport);
- track.objectInstances = visibleInstances;
- this.appendChild(track);
- didAppendAtLeastOneTrack = true;
- }, this);
- if (didAppendAtLeastOneTrack)
- this.appendChild(new SpacingTrack(this.viewport));
- },
-
- appendCounterTracks_: function() {
- // Add counter tracks for this process.
- var counters = tr.b.dictionaryValues(this.processBase.counters);
- counters.sort(tr.model.Counter.compare);
-
- // Create the counters for this process.
- counters.forEach(function(counter) {
- var track = new tr.ui.tracks.CounterTrack(this.viewport);
- track.counter = counter;
- this.appendChild(track);
- this.appendChild(new SpacingTrack(this.viewport));
- }.bind(this));
- },
-
- appendThreadTracks_: function() {
- // Get a sorted list of threads.
- var threads = tr.b.dictionaryValues(this.processBase.threads);
- threads.sort(tr.model.Thread.compare);
-
- // Create the threads.
- threads.forEach(function(thread) {
- var track = new tr.ui.tracks.ThreadTrack(this.viewport);
- track.thread = thread;
- if (!track.hasVisibleContent)
- return;
- this.appendChild(track);
- this.appendChild(new SpacingTrack(this.viewport));
- }.bind(this));
- }
- };
-
- return {
- ProcessTrackBase: ProcessTrackBase
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/rect_track.css b/chromium/third_party/catapult/tracing/tracing/ui/tracks/rect_track.css
deleted file mode 100644
index 0467c91562c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/rect_track.css
+++ /dev/null
@@ -1,8 +0,0 @@
-/* Copyright (c) 2014 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-.rect-track {
- height: 18px;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/rect_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/rect_track.html
deleted file mode 100644
index 70da91be408..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/rect_track.html
+++ /dev/null
@@ -1,251 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/tracks/rect_track.css">
-
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/model/proxy_selectable_item.html">
-<link rel="import" href="/tracing/ui/base/draw_helpers.html">
-<link rel="import" href="/tracing/ui/base/fast_rect_renderer.html">
-<link rel="import" href="/tracing/ui/base/heading.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/tracks/track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
-
- /**
- * A track that displays an array of Rect objects.
- * @constructor
- * @extends {Track}
- */
- var RectTrack = tr.ui.b.define(
- 'rect-track', tr.ui.tracks.Track);
-
- RectTrack.prototype = {
-
- __proto__: tr.ui.tracks.Track.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.Track.prototype.decorate.call(this, viewport);
- this.classList.add('rect-track');
- this.asyncStyle_ = false;
- this.rects_ = null;
-
- this.heading_ = document.createElement('tr-ui-heading');
- this.appendChild(this.heading_);
- },
-
- set heading(heading) {
- this.heading_.heading = heading;
- },
-
- get heading() {
- return this.heading_.heading;
- },
-
- set tooltip(tooltip) {
- this.heading_.tooltip = tooltip;
- },
-
- set selectionGenerator(generator) {
- this.heading_.selectionGenerator = generator;
- },
-
- set expanded(expanded) {
- this.heading_.expanded = !!expanded;
- },
-
- set arrowVisible(arrowVisible) {
- this.heading_.arrowVisible = !!arrowVisible;
- },
-
- get expanded() {
- return this.heading_.expanded;
- },
-
- get asyncStyle() {
- return this.asyncStyle_;
- },
-
- set asyncStyle(v) {
- this.asyncStyle_ = !!v;
- },
-
- get rects() {
- return this.rects_;
- },
-
- set rects(rects) {
- this.rects_ = rects || [];
- this.invalidateDrawingContainer();
- },
-
- get height() {
- return window.getComputedStyle(this).height;
- },
-
- set height(height) {
- this.style.height = height;
- this.invalidateDrawingContainer();
- },
-
- get hasVisibleContent() {
- return this.rects_.length > 0;
- },
-
- draw: function(type, viewLWorld, viewRWorld) {
- switch (type) {
- case tr.ui.tracks.DrawType.GENERAL_EVENT:
- this.drawRects_(viewLWorld, viewRWorld);
- break;
- }
- },
-
- drawRects_: function(viewLWorld, viewRWorld) {
- var ctx = this.context();
-
- ctx.save();
- var bounds = this.getBoundingClientRect();
- tr.ui.b.drawSlices(
- ctx,
- this.viewport.currentDisplayTransform,
- viewLWorld,
- viewRWorld,
- bounds.height,
- this.rects_,
- this.asyncStyle_);
- ctx.restore();
-
- if (bounds.height <= 6)
- return;
-
- var fontSize, yOffset;
- if (bounds.height < 15) {
- fontSize = 6;
- yOffset = 1.0;
- } else {
- fontSize = 10;
- yOffset = 2.5;
- }
- tr.ui.b.drawLabels(
- ctx,
- this.viewport.currentDisplayTransform,
- viewLWorld,
- viewRWorld,
- this.rects_,
- this.asyncStyle_,
- fontSize,
- yOffset);
- },
-
- addEventsToTrackMap: function(eventToTrackMap) {
- if (this.rects_ === undefined || this.rects_ === null)
- return;
-
- this.rects_.forEach(function(rect) {
- rect.addToTrackMap(eventToTrackMap, this);
- }, this);
- },
-
- addIntersectingEventsInRangeToSelectionInWorldSpace: function(
- loWX, hiWX, viewPixWidthWorld, selection) {
- function onRect(rect) {
- rect.addToSelection(selection);
- }
- onRect = onRect.bind(this);
- var instantEventWidth = 2 * viewPixWidthWorld;
- tr.b.iterateOverIntersectingIntervals(this.rects_,
- function(x) { return x.start; },
- function(x) { return x.duration == 0 ?
- x.duration + instantEventWidth :
- x.duration; },
- loWX, hiWX,
- onRect);
- },
-
- /**
- * Add the item to the left or right of the provided event, if any, to the
- * selection.
- * @param {rect} The current rect.
- * @param {Number} offset Number of rects away from the event to look.
- * @param {Selection} selection The selection to add an event to,
- * if found.
- * @return {boolean} Whether an event was found.
- * @private
- */
- addEventNearToProvidedEventToSelection: function(event, offset, selection) {
- var index = tr.b.findFirstIndexInArray(this.rects_, function(rect) {
- return rect.modelItem === event;
- });
- if (index === -1)
- return false;
-
- var newIndex = index + offset;
- if (newIndex < 0 || newIndex >= this.rects_.length)
- return false;
-
- this.rects_[newIndex].addToSelection(selection);
- return true;
- },
-
- addAllEventsMatchingFilterToSelection: function(filter, selection) {
- for (var i = 0; i < this.rects_.length; ++i) {
- // TODO(petrcermak): Rather than unpacking the proxy item here,
- // we should probably add an addToSelectionIfMatching(selection, filter)
- // method to SelectableItem (#900).
- var modelItem = this.rects_[i].modelItem;
- if (!modelItem)
- continue;
- if (filter.matchSlice(modelItem))
- selection.push(modelItem);
- }
- },
-
- addClosestEventToSelection: function(worldX, worldMaxDist, loY, hiY,
- selection) {
- var rect = tr.b.findClosestIntervalInSortedIntervals(
- this.rects_,
- function(x) { return x.start; },
- function(x) { return x.end; },
- worldX,
- worldMaxDist);
-
- if (!rect)
- return;
-
- rect.addToSelection(selection);
- }
- };
-
- /**
- * A filled rectangle with a title.
- *
- * @constructor
- * @extends {ProxySelectableItem}
- */
- function Rect(modelItem, title, colorId, start, duration) {
- tr.model.ProxySelectableItem.call(this, modelItem);
- this.title = title;
- this.colorId = colorId;
- this.start = start;
- this.duration = duration;
- this.end = start + duration;
- };
-
- Rect.prototype = {
- __proto__: tr.model.ProxySelectableItem.prototype
- };
-
- return {
- RectTrack: RectTrack,
- Rect: Rect
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/rect_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/rect_track_test.html
deleted file mode 100644
index 6dcb905a304..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/rect_track_test.html
+++ /dev/null
@@ -1,407 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/slice.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/base/draw_helpers.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var EventSet = tr.model.EventSet;
- var RectTrack = tr.ui.tracks.RectTrack;
- var Rect = tr.ui.tracks.Rect;
- var Slice = tr.model.Slice;
- var Viewport = tr.ui.TimelineViewport;
-
- test('instantiate_withRects', function() {
- var div = document.createElement('div');
-
- var viewport = new Viewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- var track = RectTrack(viewport);
- drawingContainer.appendChild(track);
-
- this.addHTMLOutput(div);
- drawingContainer.invalidate();
-
- track.heading = 'testBasicRects';
- track.rects = [
- new Rect(undefined, 'a', 0, 1, 1),
- new Rect(undefined, 'b', 1, 2.1, 4.8),
- new Rect(undefined, 'b', 1, 7, 0.5),
- new Rect(undefined, 'c', 2, 7.6, 0.4)
- ];
-
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 8.8, track.clientWidth);
- track.viewport.setDisplayTransformImmediately(dt);
- });
-
- test('instantiate_withSlices', function() {
- var div = document.createElement('div');
-
- var viewport = new Viewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- var track = RectTrack(viewport);
- drawingContainer.appendChild(track);
-
- this.addHTMLOutput(div);
- drawingContainer.invalidate();
-
- track.heading = 'testBasicSlices';
- track.rects = [
- new Slice('', 'a', 0, 1, {}, 1),
- new Slice('', 'b', 1, 2.1, {}, 4.8),
- new Slice('', 'b', 1, 7, {}, 0.5),
- new Slice('', 'c', 2, 7.6, {}, 0.4)
- ];
-
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 8.8, track.clientWidth);
- track.viewport.setDisplayTransformImmediately(dt);
- });
-
- test('instantiate_shrinkingRectSize', function() {
- var div = document.createElement('div');
-
- var viewport = new Viewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- var track = RectTrack(viewport);
- drawingContainer.appendChild(track);
-
- this.addHTMLOutput(div);
- drawingContainer.invalidate();
-
- track.heading = 'testShrinkingRectSizes';
- var x = 0;
- var widths = [10, 5, 4, 3, 2, 1, 0.5, 0.4, 0.3, 0.2, 0.1, 0.05];
- var slices = [];
- for (var i = 0; i < widths.length; i++) {
- var s = new Rect(undefined, 'a', 1, x, widths[i]);
- x += s.duration + 0.5;
- slices.push(s);
- }
- track.rects = slices;
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 1.1 * x, track.clientWidth);
- track.viewport.setDisplayTransformImmediately(dt);
- });
-
- test('instantiate_elide', function() {
- var optDicts = [{ trackName: 'elideOff', elide: false },
- { trackName: 'elideOn', elide: true }];
-
- var tooLongTitle = 'Unless eliding this SHOULD NOT BE DISPLAYED. ';
- var bigTitle = 'Very big title name that goes on longer ' +
- 'than you may expect';
-
- for (var dictIndex in optDicts) {
- var dict = optDicts[dictIndex];
-
- var div = document.createElement('div');
- div.appendChild(document.createTextNode(dict.trackName));
-
- var viewport = new Viewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- var track = new RectTrack(viewport);
- drawingContainer.appendChild(track);
-
- this.addHTMLOutput(div);
- drawingContainer.invalidate();
-
- track.SHOULD_ELIDE_TEXT = dict.elide;
- track.heading = 'Visual: ' + dict.trackName;
- track.rects = [
- // title, colorId, start, args, opt_duration
- new Rect(undefined, 'a ' + tooLongTitle + bigTitle, 0, 1, 1),
- new Rect(undefined, bigTitle, 1, 2.1, 4.8),
- new Rect(undefined, 'cccc cccc cccc', 1, 7, 0.5),
- new Rect(undefined, 'd', 2, 7.6, 1.0)
- ];
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 9.5, track.clientWidth);
- track.viewport.setDisplayTransformImmediately(dt);
- }
- });
-
- test('findAllObjectsMatchingInRectTrack', function() {
- var track = new RectTrack(new tr.ui.TimelineViewport());
- track.rects = [
- new Slice('', 'a', 0, 1, {}, 1),
- new Slice('', 'b', 1, 2.1, {}, 4.8),
- new Slice('', 'b', 1, 7, {}, 0.5),
- new Slice('', 'c', 2, 7.6, {}, 0.4)
- ];
- var selection = new EventSet();
- track.addAllEventsMatchingFilterToSelection(
- new tr.c.TitleOrCategoryFilter('b'), selection);
-
- var predictedSelection = new EventSet(
- [track.rects[1].modelItem, track.rects[2].modelItem]);
- assert.isTrue(selection.equals(predictedSelection));
- });
-
- test('selectionHitTesting', function() {
- var testEl = document.createElement('div');
- testEl.appendChild(tr.ui.b.createScopedStyle('heading { width: 100px; }'));
- testEl.style.width = '600px';
-
- var viewport = new Viewport(testEl);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- testEl.appendChild(drawingContainer);
-
- var track = new RectTrack(viewport);
- drawingContainer.appendChild(track);
- this.addHTMLOutput(testEl);
-
- drawingContainer.updateCanvasSizeIfNeeded_();
-
- track.heading = 'testSelectionHitTesting';
- track.rects = [
- new Slice('', 'a', 0, 1, {}, 1),
- new Slice('', 'b', 1, 5, {}, 4.8)
- ];
- var y = track.getBoundingClientRect().top + 5;
- var pixelRatio = window.devicePixelRatio || 1;
- var wW = 10;
- var vW = drawingContainer.canvas.getBoundingClientRect().width;
-
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, wW, vW * pixelRatio);
- track.viewport.setDisplayTransformImmediately(dt);
-
- var selection = new EventSet();
- var x = (1.5 / wW) * vW;
- track.addIntersectingEventsInRangeToSelection(
- x, x + 1, y, y + 1, selection);
- assert.isTrue(selection.equals(new EventSet(track.rects[0].modelItem)));
-
- var selection = new EventSet();
- x = (2.1 / wW) * vW;
- track.addIntersectingEventsInRangeToSelection(
- x, x + 1, y, y + 1, selection);
- assert.equal(0, selection.length);
-
- var selection = new EventSet();
- x = (6.8 / wW) * vW;
- track.addIntersectingEventsInRangeToSelection(
- x, x + 1, y, y + 1, selection);
- assert.isTrue(selection.equals(new EventSet(track.rects[1].modelItem)));
-
- var selection = new EventSet();
- x = (9.9 / wW) * vW;
- track.addIntersectingEventsInRangeToSelection(
- x, x + 1, y, y + 1, selection);
- assert.equal(0, selection.length);
- });
-
- test('elide', function() {
- var testEl = document.createElement('div');
-
- var viewport = new Viewport(testEl);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- testEl.appendChild(drawingContainer);
-
- var track = new RectTrack(viewport);
- drawingContainer.appendChild(track);
- this.addHTMLOutput(testEl);
-
- drawingContainer.updateCanvasSizeIfNeeded_();
-
- var bigtitle = 'Super duper long long title ' +
- 'holy moly when did you get so verbose?';
- var smalltitle = 'small';
- track.heading = 'testElide';
- track.rects = [
- // title, colorId, start, args, opt_duration
- new Slice('', bigtitle, 0, 1, {}, 1),
- new Slice('', smalltitle, 1, 2, {}, 1)
- ];
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, 3.3, track.clientWidth);
- track.viewport.setDisplayTransformImmediately(dt);
-
- var stringWidthPair = undefined;
- var pixWidth = dt.xViewVectorToWorld(1);
-
- // Small titles on big slices are not elided.
- stringWidthPair =
- tr.ui.b.elidedTitleCache_.get(
- track.context(),
- pixWidth,
- smalltitle,
- tr.ui.b.elidedTitleCache_.labelWidth(
- track.context(),
- smalltitle),
- 1);
- assert.equal(smalltitle, stringWidthPair.string);
-
- // Keep shrinking the slice until eliding starts.
- var elidedWhenSmallEnough = false;
- for (var sliceLength = 1; sliceLength >= 0.00001; sliceLength /= 2.0) {
- stringWidthPair =
- tr.ui.b.elidedTitleCache_.get(
- track.context(),
- pixWidth,
- smalltitle,
- tr.ui.b.elidedTitleCache_.labelWidth(
- track.context(),
- smalltitle),
- sliceLength);
- if (stringWidthPair.string.length < smalltitle.length) {
- elidedWhenSmallEnough = true;
- break;
- }
- }
- assert.isTrue(elidedWhenSmallEnough);
-
- // Big titles are elided immediately.
- var superBigTitle = '';
- for (var x = 0; x < 10; x++) {
- superBigTitle += bigtitle;
- }
- stringWidthPair =
- tr.ui.b.elidedTitleCache_.get(
- track.context(),
- pixWidth,
- superBigTitle,
- tr.ui.b.elidedTitleCache_.labelWidth(
- track.context(),
- superBigTitle),
- 1);
- assert.isTrue(stringWidthPair.string.length < superBigTitle.length);
-
- // And elided text ends with ...
- var len = stringWidthPair.string.length;
- assert.equal('...', stringWidthPair.string.substring(len - 3, len));
- });
-
- test('rectTrackAddItemNearToProvidedEvent', function() {
- var track = new RectTrack(new tr.ui.TimelineViewport());
- track.rects = [
- new Slice('', 'a', 0, 1, {}, 1),
- new Slice('', 'b', 1, 2.1, {}, 4.8),
- new Slice('', 'b', 1, 7, {}, 0.5),
- new Slice('', 'c', 2, 7.6, {}, 0.4)
- ];
- var sel = new EventSet();
- track.addAllEventsMatchingFilterToSelection(
- new tr.c.TitleOrCategoryFilter('b'), sel);
- var ret;
-
- // Select to the right of B.
- var selRight = new EventSet();
- ret = track.addEventNearToProvidedEventToSelection(sel[0], 1, selRight);
- assert.isTrue(ret);
- assert.equal(track.rects[2].modelItem, selRight[0]);
-
- // Select to the right of the 2nd b.
- var selRight2 = new EventSet();
- ret = track.addEventNearToProvidedEventToSelection(sel[0], 2, selRight2);
- assert.isTrue(ret);
- assert.equal(track.rects[3].modelItem, selRight2[0]);
-
- // Select to 2 to the right of the 2nd b.
- var selRightOfRight = new EventSet();
- ret = track.addEventNearToProvidedEventToSelection(
- selRight[0], 1, selRightOfRight);
- assert.isTrue(ret);
- assert.equal(track.rects[3].modelItem, selRightOfRight[0]);
-
- // Select to the right of the rightmost slice.
- var selNone = new EventSet();
- ret = track.addEventNearToProvidedEventToSelection(
- selRightOfRight[0], 1, selNone);
- assert.isFalse(ret);
- assert.equal(0, selNone.length);
-
- // Select A and then select left.
- var sel = new EventSet();
- track.addAllEventsMatchingFilterToSelection(
- new tr.c.TitleOrCategoryFilter('a'), sel);
- var ret;
-
- selNone = new EventSet();
- ret = track.addEventNearToProvidedEventToSelection(sel[0], -1, selNone);
- assert.isFalse(ret);
- assert.equal(0, selNone.length);
- });
-
- test('rectTrackAddClosestEventToSelection', function() {
- var track = new RectTrack(new tr.ui.TimelineViewport());
- track.rects = [
- new Slice('', 'a', 0, 1, {}, 1),
- new Slice('', 'b', 1, 2.1, {}, 4.8),
- new Slice('', 'b', 1, 7, {}, 0.5),
- new Slice('', 'c', 2, 7.6, {}, 0.4)
- ];
-
- // Before with not range.
- var sel = new EventSet();
- track.addClosestEventToSelection(0, 0, 0, 0, sel);
- assert.equal(0, sel.length);
-
- // Before with negative range.
- var sel = new EventSet();
- track.addClosestEventToSelection(1.5, -10, 0, 0, sel);
- assert.equal(0, sel.length);
-
- // Before first slice.
- var sel = new EventSet();
- track.addClosestEventToSelection(0.5, 1, 0, 0, sel);
- assert.isTrue(sel.equals(new EventSet(track.rects[0].modelItem)));
-
- // Within first slice closer to start.
- var sel = new EventSet();
- track.addClosestEventToSelection(1.3, 1, 0, 0, sel);
- assert.isTrue(sel.equals(new EventSet(track.rects[0].modelItem)));
-
- // Between slices with good range.
- var sel = new EventSet();
- track.addClosestEventToSelection(2.08, 3, 0, 0, sel);
- assert.isTrue(sel.equals(new EventSet(track.rects[1].modelItem)));
-
- // Between slices with bad range.
- var sel = new EventSet();
- track.addClosestEventToSelection(2.05, 0.03, 0, 0, sel);
- assert.equal(0, sel.length);
-
- // Within slice closer to end.
- var sel = new EventSet();
- track.addClosestEventToSelection(6, 100, 0, 0, sel);
- assert.isTrue(sel.equals(new EventSet(track.rects[1].modelItem)));
-
- // Within slice with bad range.
- var sel = new EventSet();
- track.addClosestEventToSelection(1.8, 0.1, 0, 0, sel);
- assert.equal(0, sel.length);
-
- // After last slice with good range.
- var sel = new EventSet();
- track.addClosestEventToSelection(8.5, 1, 0, 0, sel);
- assert.isTrue(sel.equals(new EventSet(track.rects[3].modelItem)));
-
- // After last slice with bad range.
- var sel = new EventSet();
- track.addClosestEventToSelection(10, 1, 0, 0, sel);
- assert.equal(0, sel.length);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/ruler_track.css b/chromium/third_party/catapult/tracing/tracing/ui/tracks/ruler_track.css
deleted file mode 100644
index 67a04a987ae..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/ruler_track.css
+++ /dev/null
@@ -1,12 +0,0 @@
-/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-.ruler-track {
- height: 12px;
-}
-
-.ruler-track.tall-mode {
- height: 30px;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/ruler_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/ruler_track.html
deleted file mode 100644
index 30ce44be39d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/ruler_track.html
+++ /dev/null
@@ -1,374 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/tracks/ruler_track.css">
-
-<link rel="import" href="/tracing/ui/base/draw_helpers.html">
-<link rel="import" href="/tracing/ui/base/heading.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/tracks/track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- /**
- * A track that displays the ruler.
- * @constructor
- * @extends {Track}
- */
- var RulerTrack = tr.ui.b.define('ruler-track', tr.ui.tracks.Track);
-
- var logOf10 = Math.log(10);
- function log10(x) {
- return Math.log(x) / logOf10;
- }
-
- RulerTrack.prototype = {
- __proto__: tr.ui.tracks.Track.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.Track.prototype.decorate.call(this, viewport);
- this.classList.add('ruler-track');
- this.strings_secs_ = [];
- this.strings_msecs_ = [];
- this.strings_usecs_ = [];
- this.strings_nsecs_ = [];
-
- this.viewportChange_ = this.viewportChange_.bind(this);
- viewport.addEventListener('change', this.viewportChange_);
-
- var heading = document.createElement('tr-ui-heading');
- heading.arrowVisible = false;
- this.appendChild(heading);
- },
-
- detach: function() {
- tr.ui.tracks.Track.prototype.detach.call(this);
- this.viewport.removeEventListener('change',
- this.viewportChange_);
- },
-
- viewportChange_: function() {
- if (this.viewport.interestRange.isEmpty)
- this.classList.remove('tall-mode');
- else
- this.classList.add('tall-mode');
- },
-
- draw: function(type, viewLWorld, viewRWorld) {
- switch (type) {
- case tr.ui.tracks.DrawType.GRID:
- this.drawGrid_(viewLWorld, viewRWorld);
- break;
- case tr.ui.tracks.DrawType.MARKERS:
- if (!this.viewport.interestRange.isEmpty)
- this.viewport.interestRange.draw(this.context(),
- viewLWorld, viewRWorld);
- break;
- }
- },
-
- drawGrid_: function(viewLWorld, viewRWorld) {
- var ctx = this.context();
- var pixelRatio = window.devicePixelRatio || 1;
-
- var canvasBounds = ctx.canvas.getBoundingClientRect();
- var trackBounds = this.getBoundingClientRect();
- var width = canvasBounds.width * pixelRatio;
- var height = trackBounds.height * pixelRatio;
-
- var hasInterestRange = !this.viewport.interestRange.isEmpty;
-
- var rulerHeight = hasInterestRange ? (height * 2) / 5 : height;
-
- var vp = this.viewport;
- var dt = vp.currentDisplayTransform;
-
- var idealMajorMarkDistancePix = 150 * pixelRatio;
- var idealMajorMarkDistanceWorld =
- dt.xViewVectorToWorld(idealMajorMarkDistancePix);
-
- var majorMarkDistanceWorld;
-
- // The conservative guess is the nearest enclosing 0.1, 1, 10, 100, etc.
- var conservativeGuess =
- Math.pow(10, Math.ceil(log10(idealMajorMarkDistanceWorld)));
-
- // Once we have a conservative guess, consider things that evenly add up
- // to the conservative guess, e.g. 0.5, 0.2, 0.1 Pick the one that still
- // exceeds the ideal mark distance.
- var divisors = [10, 5, 2, 1];
- for (var i = 0; i < divisors.length; ++i) {
- var tightenedGuess = conservativeGuess / divisors[i];
- if (dt.xWorldVectorToView(tightenedGuess) < idealMajorMarkDistancePix)
- continue;
- majorMarkDistanceWorld = conservativeGuess / divisors[i - 1];
- break;
- }
-
- var unit;
- var unitDivisor;
- var tickLabels = undefined;
- if (majorMarkDistanceWorld < 0.0001) {
- unit = 'ns';
- unitDivisor = 0.000001;
- tickLabels = this.strings_nsecs_;
- } else if (majorMarkDistanceWorld < 0.1) {
- unit = 'us';
- unitDivisor = 0.001;
- tickLabels = this.strings_usecs_;
- } else if (majorMarkDistanceWorld < 100) {
- unit = 'ms';
- unitDivisor = 1;
- tickLabels = this.strings_msecs_;
- } else {
- unit = 's';
- unitDivisor = 1000;
- tickLabels = this.strings_secs_;
- }
-
- var numTicksPerMajor = 5;
- var minorMarkDistanceWorld = majorMarkDistanceWorld / numTicksPerMajor;
- var minorMarkDistancePx = dt.xWorldVectorToView(minorMarkDistanceWorld);
-
- var firstMajorMark =
- Math.floor(viewLWorld / majorMarkDistanceWorld) *
- majorMarkDistanceWorld;
-
- var minorTickH = Math.floor(rulerHeight * 0.25);
-
- ctx.save();
-
- var pixelRatio = window.devicePixelRatio || 1;
- ctx.lineWidth = Math.round(pixelRatio);
-
- // Apply subpixel translate to get crisp lines.
- // http://www.mobtowers.com/html5-canvas-crisp-lines-every-time/
- var crispLineCorrection = (ctx.lineWidth % 2) / 2;
- ctx.translate(crispLineCorrection, -crispLineCorrection);
-
- ctx.fillStyle = 'rgb(0, 0, 0)';
- ctx.strokeStyle = 'rgb(0, 0, 0)';
- ctx.textAlign = 'left';
- ctx.textBaseline = 'top';
-
- ctx.font = (9 * pixelRatio) + 'px sans-serif';
-
- vp.majorMarkPositions = [];
-
- // Each iteration of this loop draws one major mark
- // and numTicksPerMajor minor ticks.
- //
- // Rendering can't be done in world space because canvas transforms
- // affect line width. So, do the conversions manually.
- ctx.beginPath();
- for (var curX = firstMajorMark;
- curX < viewRWorld;
- curX += majorMarkDistanceWorld) {
-
- var curXView = Math.floor(dt.xWorldToView(curX));
-
- var unitValue = curX / unitDivisor;
- var roundedUnitValue = Math.round(unitValue * 100000) / 100000;
-
- if (!tickLabels[roundedUnitValue])
- tickLabels[roundedUnitValue] = roundedUnitValue + ' ' + unit;
- ctx.fillText(tickLabels[roundedUnitValue],
- curXView + (2 * pixelRatio), 0);
-
- vp.majorMarkPositions.push(curXView);
-
- // Major mark
- tr.ui.b.drawLine(ctx, curXView, 0, curXView, rulerHeight);
-
- // Minor marks
- for (var i = 1; i < numTicksPerMajor; ++i) {
- var xView = Math.floor(curXView + minorMarkDistancePx * i);
- tr.ui.b.drawLine(ctx,
- xView, rulerHeight - minorTickH,
- xView, rulerHeight);
- }
- }
-
- // Draw bottom bar.
- ctx.strokeStyle = 'rgb(0, 0, 0)';
- tr.ui.b.drawLine(ctx, 0, height, width, height);
- ctx.stroke();
-
- // Give distance between directly adjacent markers.
- if (!hasInterestRange)
- return;
-
- // Draw middle bar.
- tr.ui.b.drawLine(ctx, 0, rulerHeight, width, rulerHeight);
- ctx.stroke();
-
- // Distance Variables.
- var displayDistance;
- var displayTextColor = 'rgb(0,0,0)';
-
- // Arrow Variables.
- var arrowSpacing = 10 * pixelRatio;
- var arrowColor = 'rgb(128,121,121)';
- var arrowPosY = rulerHeight * 1.75;
- var arrowWidthView = 3 * pixelRatio;
- var arrowLengthView = 10 * pixelRatio;
- var spaceForArrowsView = 2 * (arrowWidthView + arrowSpacing);
-
- ctx.textBaseline = 'middle';
- ctx.font = (14 * pixelRatio) + 'px sans-serif';
- var textPosY = arrowPosY;
-
- var interestRange = vp.interestRange;
-
- // If the range is zero, draw it's min timestamp next to the line.
- if (interestRange.range === 0) {
- var markerWorld = interestRange.min;
- var markerView = dt.xWorldToView(markerWorld);
- var displayValue = markerWorld / unitDivisor;
- displayValue = Math.abs((Math.round(displayValue * 1000) / 1000));
-
- var textToDraw = displayValue + ' ' + unit;
- var textLeftView = markerView + 4 * pixelRatio;
- var textWidthView = ctx.measureText(textToDraw).width;
-
- // Put text to the left in case it gets cut off.
- if (textLeftView + textWidthView > width)
- textLeftView = markerView - 4 * pixelRatio - textWidthView;
-
- ctx.fillStyle = displayTextColor;
- ctx.fillText(textToDraw, textLeftView, textPosY);
- return;
- }
-
- var leftMarker = interestRange.min;
- var rightMarker = interestRange.max;
-
- var leftMarkerView = dt.xWorldToView(leftMarker);
- var rightMarkerView = dt.xWorldToView(rightMarker);
-
- var distanceBetweenMarkers = interestRange.range;
- var distanceBetweenMarkersView =
- dt.xWorldVectorToView(distanceBetweenMarkers);
- var positionInMiddleOfMarkersView =
- leftMarkerView + (distanceBetweenMarkersView / 2);
-
- // Determine units.
- if (distanceBetweenMarkers < 0.0001) {
- unit = 'ns';
- unitDivisor = 0.000001;
- } else if (distanceBetweenMarkers < 0.1) {
- unit = 'us';
- unitDivisor = 0.001;
- } else if (distanceBetweenMarkers < 100) {
- unit = 'ms';
- unitDivisor = 1;
- } else {
- unit = 's';
- unitDivisor = 1000;
- }
-
- // Calculate display value to print.
- displayDistance = distanceBetweenMarkers / unitDivisor;
- var roundedDisplayDistance =
- Math.abs((Math.round(displayDistance * 1000) / 1000));
- var textToDraw = roundedDisplayDistance + ' ' + unit;
- var textWidthView = ctx.measureText(textToDraw).width;
- var spaceForArrowsAndTextView =
- textWidthView + spaceForArrowsView + arrowSpacing;
-
- // Set text positions.
- var textLeftView = positionInMiddleOfMarkersView - textWidthView / 2;
- var textRightView = textLeftView + textWidthView;
-
- if (spaceForArrowsAndTextView > distanceBetweenMarkersView) {
- // Print the display distance text right of the 2 markers.
- textLeftView = rightMarkerView + 2 * arrowSpacing;
-
- // Put text to the left in case it gets cut off.
- if (textLeftView + textWidthView > width)
- textLeftView = leftMarkerView - 2 * arrowSpacing - textWidthView;
-
- ctx.fillStyle = displayTextColor;
- ctx.fillText(textToDraw, textLeftView, textPosY);
-
- // Draw the arrows pointing from outside in and a line in between.
- ctx.strokeStyle = arrowColor;
- ctx.beginPath();
- tr.ui.b.drawLine(ctx, leftMarkerView, arrowPosY, rightMarkerView,
- arrowPosY);
- ctx.stroke();
-
- ctx.fillStyle = arrowColor;
- tr.ui.b.drawArrow(ctx,
- leftMarkerView - 1.5 * arrowSpacing, arrowPosY,
- leftMarkerView, arrowPosY,
- arrowLengthView, arrowWidthView);
- tr.ui.b.drawArrow(ctx,
- rightMarkerView + 1.5 * arrowSpacing, arrowPosY,
- rightMarkerView, arrowPosY,
- arrowLengthView, arrowWidthView);
-
- } else if (spaceForArrowsView <= distanceBetweenMarkersView) {
- var leftArrowStart;
- var rightArrowStart;
- if (spaceForArrowsAndTextView <= distanceBetweenMarkersView) {
- // Print the display distance text.
- ctx.fillStyle = displayTextColor;
- ctx.fillText(textToDraw, textLeftView, textPosY);
-
- leftArrowStart = textLeftView - arrowSpacing;
- rightArrowStart = textRightView + arrowSpacing;
- } else {
- leftArrowStart = positionInMiddleOfMarkersView;
- rightArrowStart = positionInMiddleOfMarkersView;
- }
-
- // Draw the arrows pointing inside out.
- ctx.strokeStyle = arrowColor;
- ctx.fillStyle = arrowColor;
- tr.ui.b.drawArrow(ctx,
- leftArrowStart, arrowPosY,
- leftMarkerView, arrowPosY,
- arrowLengthView, arrowWidthView);
- tr.ui.b.drawArrow(ctx,
- rightArrowStart, arrowPosY,
- rightMarkerView, arrowPosY,
- arrowLengthView, arrowWidthView);
- }
-
- ctx.restore();
- },
-
- /**
- * Adds items intersecting the given range to a selection.
- * @param {number} loVX Lower X bound of the interval to search, in
- * viewspace.
- * @param {number} hiVX Upper X bound of the interval to search, in
- * viewspace.
- * @param {number} loVY Lower Y bound of the interval to search, in
- * viewspace.
- * @param {number} hiVY Upper Y bound of the interval to search, in
- * viewspace.
- * @param {Selection} selection Selection to which to add results.
- */
- addIntersectingEventsInRangeToSelection: function(
- loVX, hiVX, loY, hiY, selection) {
- // Does nothing. There's nothing interesting to pick on the ruler
- // track.
- },
-
- addAllEventsMatchingFilterToSelection: function(filter, selection) {
- }
- };
-
- return {
- RulerTrack: RulerTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/ruler_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/ruler_track_test.html
deleted file mode 100644
index 3ca0d72fdf4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/ruler_track_test.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/ui/timeline_viewport.html">
-<link rel="import" href="/tracing/ui/tracks/drawing_container.html">
-<link rel="import" href="/tracing/ui/tracks/ruler_track.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var div = document.createElement('div');
-
- var viewport = new tr.ui.TimelineViewport(div);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- div.appendChild(drawingContainer);
-
- var track = tr.ui.tracks.RulerTrack(viewport);
- drawingContainer.appendChild(track);
- this.addHTMLOutput(div);
-
- drawingContainer.invalidate();
-
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.setPanAndScale(0, track.clientWidth / 1000);
- track.viewport.setDisplayTransformImmediately(dt);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/sample_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/sample_track.html
deleted file mode 100644
index 80010bbc2a3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/sample_track.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/tracks/rect_track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- /**
- * A track that displays an array of Sample objects.
- * @constructor
- * @extends {RectTrack}
- */
- var SampleTrack = tr.ui.b.define(
- 'sample-track', tr.ui.tracks.RectTrack);
-
- SampleTrack.prototype = {
-
- __proto__: tr.ui.tracks.RectTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.RectTrack.prototype.decorate.call(this, viewport);
- },
-
- get samples() {
- return this.rects;
- },
-
- set samples(samples) {
- this.rects = samples;
- }
- };
-
- return {
- SampleTrack: SampleTrack
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/sample_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/sample_track_test.html
deleted file mode 100644
index c5c7342af0e..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/sample_track_test.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/sample.html">
-<link rel="import" href="/tracing/model/stack_frame.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-<link rel="import" href="/tracing/ui/tracks/sample_track.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var SampleTrack = tr.ui.tracks.SampleTrack;
- var Sample = tr.model.Sample;
- var StackFrame = tr.model.StackFrame;
-
- test('modelMapping', function() {
- var track = new SampleTrack(new tr.ui.TimelineViewport());
- var fA = new StackFrame(undefined, 1, 'cat', 'a', 7);
- var sample = new Sample(undefined, undefined, 'instructions_retired',
- 10, fA, 10);
- track.samples = [sample];
- var me0 = track.rects[0].modelItem;
- assert.equal(me0, sample);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_group_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_group_track.html
deleted file mode 100644
index 78ffd07cf00..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_group_track.html
+++ /dev/null
@@ -1,168 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/tracks/multi_row_track.html">
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- /**
- * A track that displays a SliceGroup.
- * @constructor
- * @extends {MultiRowTrack}
- */
- var SliceGroupTrack = tr.ui.b.define(
- 'slice-group-track', tr.ui.tracks.MultiRowTrack);
-
- SliceGroupTrack.prototype = {
-
- __proto__: tr.ui.tracks.MultiRowTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.MultiRowTrack.prototype.decorate.call(this, viewport);
- this.classList.add('slice-group-track');
- this.group_ = undefined;
- // Set the collapse threshold so we don't collapse by default, but the
- // user can explicitly collapse if they want it.
- this.defaultToCollapsedWhenSubRowCountMoreThan = 100;
- },
-
- addSubTrack_: function(slices) {
- var track = new tr.ui.tracks.SliceTrack(this.viewport);
- track.slices = slices;
- this.appendChild(track);
- return track;
- },
-
- get group() {
- return this.group_;
- },
-
- set group(group) {
- this.group_ = group;
- this.setItemsToGroup(this.group_.slices, this.group_);
- },
-
- get eventContainer() {
- return this.group;
- },
-
- addContainersToTrackMap: function(containerToTrackMap) {
- tr.ui.tracks.MultiRowTrack.prototype.addContainersToTrackMap.apply(
- this, arguments);
- containerToTrackMap.addContainer(this.group, this);
- },
-
- /**
- * Breaks up the list of slices into N rows, each of which is a list of
- * slices that are non overlapping.
- */
- buildSubRows_: function(slices) {
- var precisionUnit = this.group.model.intrinsicTimeUnit;
-
- // This function works by walking through slices by start time.
- //
- // The basic idea here is to insert each slice as deep into the subrow
- // list as it can go such that every subSlice is fully contained by its
- // parent slice.
- //
- // Visually, if we start with this:
- // 0: [ a ]
- // 1: [ b ]
- // 2: [c][d]
- //
- // To place this slice:
- // [e]
- // We first check row 2's last item, [d]. [e] wont fit into [d] (they dont
- // even intersect). So we go to row 1. That gives us [b], and [d] wont fit
- // into that either. So, we go to row 0 and its last slice, [a]. That can
- // completely contain [e], so that means we should add [e] as a subchild
- // of [a]. That puts it on row 1, yielding:
- // 0: [ a ]
- // 1: [ b ][e]
- // 2: [c][d]
- //
- // If we then get this slice:
- // [f]
- // We do the same deepest-to-shallowest walk of the subrows trying to fit
- // it. This time, it doesn't fit in any open slice. So, we simply append
- // it to row 0:
- // 0: [ a ] [f]
- // 1: [ b ][e]
- // 2: [c][d]
- if (!slices.length)
- return [];
-
- var ops = [];
- for (var i = 0; i < slices.length; i++) {
- if (slices[i].subSlices)
- slices[i].subSlices.splice(0,
- slices[i].subSlices.length);
- ops.push(i);
- }
-
- ops.sort(function(ix, iy) {
- var x = slices[ix];
- var y = slices[iy];
- if (x.start != y.start)
- return x.start - y.start;
-
- // Elements get inserted into the slices array in order of when the
- // slices start. Because slices must be properly nested, we break
- // start-time ties by assuming that the elements appearing earlier in
- // the slices array (and thus ending earlier) start earlier.
- return ix - iy;
- });
-
- var subRows = [[]];
- this.badSlices_ = []; // TODO(simonjam): Connect this again.
-
- for (var i = 0; i < ops.length; i++) {
- var op = ops[i];
- var slice = slices[op];
-
- // Try to fit the slice into the existing subrows.
- var inserted = false;
- for (var j = subRows.length - 1; j >= 0; j--) {
- if (subRows[j].length == 0)
- continue;
-
- var insertedSlice = subRows[j][subRows[j].length - 1];
- if (slice.start < insertedSlice.start) {
- this.badSlices_.push(slice);
- inserted = true;
- }
- if (insertedSlice.bounds(slice, precisionUnit)) {
- // Insert it into subRow j + 1.
- while (subRows.length <= j + 1)
- subRows.push([]);
- subRows[j + 1].push(slice);
- if (insertedSlice.subSlices)
- insertedSlice.subSlices.push(slice);
- inserted = true;
- break;
- }
- }
- if (inserted)
- continue;
-
- // Append it to subRow[0] as a root.
- subRows[0].push(slice);
- }
-
- return subRows;
- }
- };
-
- return {
- SliceGroupTrack: SliceGroupTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_group_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_group_track_test.html
deleted file mode 100644
index 6e3ff9813c4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_group_track_test.html
+++ /dev/null
@@ -1,293 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-<link rel="import" href="/tracing/model/slice_group.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ProcessTrack = tr.ui.tracks.ProcessTrack;
- var ThreadTrack = tr.ui.tracks.ThreadTrack;
- var SliceGroup = tr.model.SliceGroup;
- var SliceGroupTrack = tr.ui.tracks.SliceGroupTrack;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
-
- test('subRowBuilderBasic', function() {
- var m = new tr.Model();
- var t1 = m.getOrCreateProcess(1).getOrCreateThread(2);
- var group = t1.sliceGroup;
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 2}));
- var sB = group.pushSlice(newSliceEx({title: 'a', start: 3, duration: 1}));
-
- var track = new SliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = group;
- var subRows = track.subRows;
-
- assert.equal(track.badSlices_.length, 0);
- assert.equal(subRows.length, 1);
- assert.equal(subRows[0].length, 2);
- assert.deepEqual(subRows[0], [sA, sB]);
- });
-
- test('subRowBuilderBasic2', function() {
- var m = new tr.Model();
- var t1 = m.getOrCreateProcess(1).getOrCreateThread(2);
- var group = t1.sliceGroup;
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 4}));
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 3, duration: 1}));
-
- var track = new SliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = group;
- var subRows = track.subRows;
-
- assert.equal(track.badSlices_.length, 0);
- assert.equal(subRows.length, 2);
- assert.equal(subRows[0].length, 1);
- assert.equal(subRows[1].length, 1);
- assert.deepEqual(subRows[0], [sA]);
- assert.deepEqual(subRows[1], [sB]);
- });
-
- test('subRowBuilderNestedExactly', function() {
- var m = new tr.Model();
- var t1 = m.getOrCreateProcess(1).getOrCreateThread(2);
- var group = t1.sliceGroup;
-
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 1, duration: 4}));
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 4}));
-
- var track = new SliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = group;
- var subRows = track.subRows;
-
- assert.equal(track.badSlices_.length, 0);
- assert.equal(subRows.length, 2);
- assert.equal(subRows[0].length, 1);
- assert.equal(subRows[1].length, 1);
- assert.deepEqual(subRows[0], [sB]);
- assert.deepEqual(subRows[1], [sA]);
- });
-
- test('subRowBuilderInstantEvents', function() {
- var m = new tr.Model();
- var t1 = m.getOrCreateProcess(1).getOrCreateThread(2);
- var group = t1.sliceGroup;
-
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 0}));
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 2, duration: 0}));
-
- var track = new SliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = group;
- var subRows = track.subRows;
-
- assert.equal(track.badSlices_.length, 0);
- assert.equal(subRows.length, 1);
- assert.equal(subRows[0].length, 2);
- assert.deepEqual(subRows[0], [sA, sB]);
- });
-
- test('subRowBuilderTwoInstantEvents', function() {
- var m = new tr.Model();
- var t1 = m.getOrCreateProcess(1).getOrCreateThread(2);
- var group = t1.sliceGroup;
-
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 0}));
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 1, duration: 0}));
-
- var track = new SliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = group;
- var subRows = track.subRows;
-
- assert.equal(track.badSlices_.length, 0);
- assert.equal(subRows.length, 2);
- assert.deepEqual(subRows[0], [sA]);
- assert.deepEqual(subRows[1], [sB]);
- });
-
- test('subRowBuilderOutOfOrderAddition', function() {
- var m = new tr.Model();
- var t1 = m.getOrCreateProcess(1).getOrCreateThread(2);
- var group = t1.sliceGroup;
-
- // Pattern being tested:
- // [ a ][ b ]
- // Where insertion is done backward.
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 3, duration: 1}));
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 2}));
-
- var track = new SliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = group;
- var subRows = track.subRows;
-
- assert.equal(track.badSlices_.length, 0);
- assert.equal(subRows.length, 1);
- assert.equal(subRows[0].length, 2);
- assert.deepEqual(subRows[0], [sA, sB]);
- });
-
- test('subRowBuilderOutOfOrderAddition2', function() {
- var m = new tr.Model();
- var t1 = m.getOrCreateProcess(1).getOrCreateThread(2);
- var group = t1.sliceGroup;
-
- // Pattern being tested:
- // [ a ]
- // [ b ]
- // Where insertion is done backward.
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 3, duration: 1}));
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 5}));
-
- var track = new SliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = group;
- var subRows = track.subRows;
-
- assert.equal(track.badSlices_.length, 0);
- assert.equal(subRows.length, 2);
- assert.equal(subRows[0].length, 1);
- assert.equal(subRows[1].length, 1);
- assert.deepEqual(subRows[0], [sA]);
- assert.deepEqual(subRows[1], [sB]);
- });
-
- test('subRowBuilderOnNestedZeroLength', function() {
- var m = new tr.Model();
- var t1 = m.getOrCreateProcess(1).getOrCreateThread(2);
- var group = t1.sliceGroup;
-
- // Pattern being tested:
- // [ a ]
- // [ b1 ] []<- b2 where b2.duration = 0 and b2.end == a.end.
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 3}));
- var sB1 = group.pushSlice(newSliceEx({title: 'b1', start: 1, duration: 2}));
- var sB2 = group.pushSlice(newSliceEx({title: 'b2', start: 4, duration: 0}));
-
- var track = new SliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = group;
- var subRows = track.subRows;
-
- assert.equal(track.badSlices_.length, 0);
- assert.equal(subRows.length, 2);
- assert.deepEqual(subRows[0], [sA]);
- assert.deepEqual(subRows[1], [sB1, sB2]);
- });
-
- test('subRowBuilderOnGroup1', function() {
- var m = new tr.Model();
- var t1 = m.getOrCreateProcess(1).getOrCreateThread(2);
- var group = t1.sliceGroup;
-
- // Pattern being tested:
- // [ a ] [ c ]
- // [ b ]
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 3}));
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 1.5, duration: 1}));
- var sC = group.pushSlice(newSliceEx({title: 'c', start: 5, duration: 0}));
-
- var track = new SliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = group;
- var subRows = track.subRows;
-
- assert.equal(track.badSlices_.length, 0);
- assert.equal(subRows.length, 2);
- assert.deepEqual(subRows[0], [sA, sC]);
- assert.deepEqual(subRows[1], [sB]);
- });
-
- test('subRowBuilderOnGroup2', function() {
- var m = new tr.Model();
- var t1 = m.getOrCreateProcess(1).getOrCreateThread(2);
- var group = t1.sliceGroup;
-
- // Pattern being tested:
- // [ a ] [ d ]
- // [ b ]
- // [ c ]
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 3}));
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 1.5, duration: 1}));
- var sC = group.pushSlice(newSliceEx(
- {title: 'c', start: 1.75, duration: 0.5}));
- var sD = group.pushSlice(newSliceEx(
- {title: 'c', start: 5, duration: 0.25}));
-
- var track = new SliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = group;
-
- var subRows = track.subRows;
- assert.equal(track.badSlices_.length, 0);
- assert.equal(subRows.length, 3);
- assert.deepEqual(subRows[0], [sA, sD]);
- assert.deepEqual(subRows[1], [sB]);
- assert.deepEqual(subRows[2], [sC]);
- });
-
- test('trackFiltering', function() {
- var m = new tr.Model();
- var t1 = m.getOrCreateProcess(1).getOrCreateThread(2);
- var group = t1.sliceGroup;
-
- var sA = group.pushSlice(newSliceEx({title: 'a', start: 1, duration: 3}));
- var sB = group.pushSlice(newSliceEx({title: 'b', start: 1.5, duration: 1}));
-
- var track = new SliceGroupTrack(new tr.ui.TimelineViewport());
- track.group = group;
-
- assert.equal(track.subRows.length, 2);
- assert.isTrue(track.hasVisibleContent);
- });
-
-test('sliceGroupContainerMap', function() {
- var vp = new tr.ui.TimelineViewport();
- var containerToTrack = vp.containerToTrackMap;
- var model = new tr.Model();
- var process = model.getOrCreateProcess(123);
- var thread = process.getOrCreateThread(456);
- var group = new SliceGroup(thread);
-
- var processTrack = new ProcessTrack(vp);
- var threadTrack = new ThreadTrack(vp);
- var groupTrack = new SliceGroupTrack(vp);
- processTrack.process = process;
- threadTrack.thread = thread;
- groupTrack.group = group;
- processTrack.appendChild(threadTrack);
- threadTrack.appendChild(groupTrack);
-
- assert.equal(processTrack.eventContainer, process);
- assert.equal(threadTrack.eventContainer, thread);
- assert.equal(groupTrack.eventContainer, group);
-
- assert.isUndefined(containerToTrack.getTrackByStableId('123'));
- assert.isUndefined(containerToTrack.getTrackByStableId('123.456'));
- assert.isUndefined(
- containerToTrack.getTrackByStableId('123.456.SliceGroup'));
-
- vp.modelTrackContainer = {
- addContainersToTrackMap: function(containerToTrackMap) {
- processTrack.addContainersToTrackMap(containerToTrackMap);
- },
- addEventListener: function() {}
- };
- vp.rebuildContainerToTrackMap();
-
- // Check that all tracks call childs' addContainersToTrackMap()
- // by checking the resulting map.
- assert.equal(containerToTrack.getTrackByStableId('123'), processTrack);
- assert.equal(containerToTrack.getTrackByStableId('123.456'), threadTrack);
- assert.equal(containerToTrack.getTrackByStableId('123.456.SliceGroup'),
- groupTrack);
-
- // Check the track's eventContainer getter.
- assert.equal(processTrack.eventContainer, process);
- assert.equal(threadTrack.eventContainer, thread);
- assert.equal(groupTrack.eventContainer, group);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_track.html
deleted file mode 100644
index 87123811d62..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_track.html
+++ /dev/null
@@ -1,44 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/tracks/rect_track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- /**
- * A track that displays an array of Slice objects.
- * @constructor
- * @extends {RectTrack}
- */
- var SliceTrack = tr.ui.b.define(
- 'slice-track', tr.ui.tracks.RectTrack);
-
- SliceTrack.prototype = {
-
- __proto__: tr.ui.tracks.RectTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.RectTrack.prototype.decorate.call(this, viewport);
- },
-
- get slices() {
- return this.rects;
- },
-
- set slices(slices) {
- this.rects = slices;
- }
- };
-
- return {
- SliceTrack: SliceTrack
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_track_test.html
deleted file mode 100644
index 2c22784a848..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/slice_track_test.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/slice.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-<link rel="import" href="/tracing/ui/tracks/slice_track.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var SliceTrack = tr.ui.tracks.SliceTrack;
- var Slice = tr.model.Slice;
-
- test('modelMapping', function() {
- var track = new SliceTrack(new tr.ui.TimelineViewport());
- var slice = new Slice('', 'a', 0, 1, {}, 1);
- track.slices = [slice];
- var me0 = track.rects[0].modelItem;
- assert.equal(slice, me0);
- });
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/spacing_track.css b/chromium/third_party/catapult/tracing/tracing/ui/tracks/spacing_track.css
deleted file mode 100644
index 094eee0862d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/spacing_track.css
+++ /dev/null
@@ -1,7 +0,0 @@
-/* Copyright (c) 2013 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-.spacing-track {
- height: 4px;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/spacing_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/spacing_track.html
deleted file mode 100644
index 5eea1c903e0..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/spacing_track.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/tracks/spacing_track.css">
-
-<link rel="import" href="/tracing/ui/base/heading.html">
-<link rel="import" href="/tracing/ui/tracks/track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- /**
- * A track used to provide whitespace between the tracks above and below it.
- *
- * @constructor
- * @extends {tr.ui.tracks.Track}
- */
- var SpacingTrack = tr.ui.b.define('spacing-track', tr.ui.tracks.Track);
-
- SpacingTrack.prototype = {
- __proto__: tr.ui.tracks.Track.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.Track.prototype.decorate.call(this, viewport);
- this.classList.add('spacing-track');
-
- this.heading_ = document.createElement('tr-ui-heading');
- this.appendChild(this.heading_);
- },
-
- addAllEventsMatchingFilterToSelection: function(filter, selection) {
- }
- };
-
- return {
- SpacingTrack: SpacingTrack
- };
-});
-</script>
-
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/stacked_bars_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/stacked_bars_track.html
deleted file mode 100644
index e3e9ea89d40..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/stacked_bars_track.html
+++ /dev/null
@@ -1,130 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/heading.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/tracks/track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- /**
- * A track that displays traces as stacked bars.
- * @constructor
- * @extends {Track}
- */
- var StackedBarsTrack = tr.ui.b.define(
- 'stacked-bars-track', tr.ui.tracks.Track);
-
- StackedBarsTrack.prototype = {
-
- __proto__: tr.ui.tracks.Track.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.Track.prototype.decorate.call(this, viewport);
- this.classList.add('stacked-bars-track');
- this.objectInstance_ = null;
-
- this.heading_ = document.createElement('tr-ui-heading');
- this.appendChild(this.heading_);
- },
-
- set heading(heading) {
- this.heading_.heading = heading;
- },
-
- get heading() {
- return this.heading_.heading;
- },
-
- set tooltip(tooltip) {
- this.heading_.tooltip = tooltip;
- },
-
- addEventsToTrackMap: function(eventToTrackMap) {
- var objectSnapshots = this.objectInstance_.snapshots;
- objectSnapshots.forEach(function(obj) {
- eventToTrackMap.addEvent(obj, this);
- }, this);
- },
-
- /**
- * Used to hit-test clicks in the graph.
- */
- addIntersectingEventsInRangeToSelectionInWorldSpace: function(
- loWX, hiWX, viewPixWidthWorld, selection) {
- function onSnapshot(snapshot) {
- selection.push(snapshot);
- }
-
- var snapshots = this.objectInstance_.snapshots;
- var maxBounds = this.objectInstance_.parent.model.bounds.max;
-
- tr.b.iterateOverIntersectingIntervals(
- snapshots,
- function(x) { return x.ts; },
- function(x, i) {
- if (i == snapshots.length - 1) {
- if (snapshots.length == 1)
- return maxBounds;
-
- return snapshots[i].ts - snapshots[i - 1].ts;
- }
-
- return snapshots[i + 1].ts - snapshots[i].ts;
- },
- loWX, hiWX,
- onSnapshot);
- },
-
- /**
- * Add the item to the left or right of the provided item, if any, to the
- * selection.
- * @param {slice} The current slice.
- * @param {Number} offset Number of slices away from the object to look.
- * @param {Selection} selection The selection to add an event to,
- * if found.
- * @return {boolean} Whether an event was found.
- * @private
- */
- addEventNearToProvidedEventToSelection: function(event, offset, selection) {
- if (!(event instanceof tr.model.ObjectSnapshot))
- throw new Error('Unrecognized event');
- var objectSnapshots = this.objectInstance_.snapshots;
- var index = objectSnapshots.indexOf(event);
- var newIndex = index + offset;
- if (newIndex >= 0 && newIndex < objectSnapshots.length) {
- selection.push(objectSnapshots[newIndex]);
- return true;
- }
- return false;
- },
-
- addAllEventsMatchingFilterToSelection: function(filter, selection) {
- },
-
- addClosestEventToSelection: function(worldX, worldMaxDist, loY, hiY,
- selection) {
- var snapshot = tr.b.findClosestElementInSortedArray(
- this.objectInstance_.snapshots,
- function(x) { return x.ts; },
- worldX,
- worldMaxDist);
-
- if (!snapshot)
- return;
-
- selection.push(snapshot);
- }
- };
-
- return {
- StackedBarsTrack: StackedBarsTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/thread_track.css b/chromium/third_party/catapult/tracing/tracing/ui/tracks/thread_track.css
deleted file mode 100644
index c42cee032d8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/thread_track.css
+++ /dev/null
@@ -1,10 +0,0 @@
-/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-.thread-track {
- -webkit-box-orient: vertical;
- display: -webkit-box;
- position: relative;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/thread_track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/thread_track.html
deleted file mode 100644
index aca956546b3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/thread_track.html
+++ /dev/null
@@ -1,163 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="stylesheet" href="/tracing/ui/tracks/thread_track.css">
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/core/filter.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-<link rel="import" href="/tracing/ui/tracks/async_slice_group_track.html">
-<link rel="import" href="/tracing/ui/tracks/container_track.html">
-<link rel="import" href="/tracing/ui/tracks/sample_track.html">
-<link rel="import" href="/tracing/ui/tracks/slice_group_track.html">
-<link rel="import" href="/tracing/ui/tracks/slice_track.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- /**
- * Visualizes a Thread using a series of SliceTracks.
- * @constructor
- */
- var ThreadTrack = tr.ui.b.define('thread-track',
- tr.ui.tracks.ContainerTrack);
- ThreadTrack.prototype = {
- __proto__: tr.ui.tracks.ContainerTrack.prototype,
-
- decorate: function(viewport) {
- tr.ui.tracks.ContainerTrack.prototype.decorate.call(this, viewport);
- this.classList.add('thread-track');
- },
-
- get thread() {
- return this.thread_;
- },
-
- set thread(thread) {
- this.thread_ = thread;
- this.updateContents_();
- },
-
- get hasVisibleContent() {
- return this.tracks_.length > 0;
- },
-
- get eventContainer() {
- return this.thread;
- },
-
- addContainersToTrackMap: function(containerToTrackMap) {
- tr.ui.tracks.ContainerTrack.prototype.addContainersToTrackMap.apply(
- this, arguments);
- containerToTrackMap.addContainer(this.thread, this);
- },
-
- updateContents_: function() {
- this.detach();
-
- if (!this.thread_)
- return;
-
- this.heading = this.thread_.userFriendlyName + ': ';
- this.tooltip = this.thread_.userFriendlyDetails;
-
- if (this.thread_.asyncSliceGroup.length)
- this.appendAsyncSliceTracks_();
-
- this.appendThreadSamplesTracks_();
-
- if (this.thread_.timeSlices) {
- var timeSlicesTrack = new tr.ui.tracks.SliceTrack(this.viewport);
- timeSlicesTrack.heading = '';
- timeSlicesTrack.height = tr.ui.b.THIN_SLICE_HEIGHT + 'px';
- timeSlicesTrack.slices = this.thread_.timeSlices;
- if (timeSlicesTrack.hasVisibleContent)
- this.appendChild(timeSlicesTrack);
- }
-
- if (this.thread_.sliceGroup.length) {
- var track = new tr.ui.tracks.SliceGroupTrack(this.viewport);
- track.heading = this.thread_.userFriendlyName;
- track.tooltip = this.thread_.userFriendlyDetails;
- track.group = this.thread_.sliceGroup;
- if (track.hasVisibleContent)
- this.appendChild(track);
- }
- },
-
- appendAsyncSliceTracks_: function() {
- var subGroups = this.thread_.asyncSliceGroup.viewSubGroups;
- subGroups.forEach(function(subGroup) {
- var asyncTrack = new tr.ui.tracks.AsyncSliceGroupTrack(this.viewport);
- var title = subGroup.slices[0].viewSubGroupTitle;
- asyncTrack.group = subGroup;
- asyncTrack.heading = title;
- if (asyncTrack.hasVisibleContent)
- this.appendChild(asyncTrack);
- }, this);
- },
-
- appendThreadSamplesTracks_: function() {
- var threadSamples = this.thread_.samples;
- if (threadSamples === undefined || threadSamples.length === 0)
- return;
- var samplesByTitle = {};
- threadSamples.forEach(function(sample) {
- if (samplesByTitle[sample.title] === undefined)
- samplesByTitle[sample.title] = [];
- samplesByTitle[sample.title].push(sample);
- });
-
- var sampleTitles = tr.b.dictionaryKeys(samplesByTitle);
- sampleTitles.sort();
-
- sampleTitles.forEach(function(sampleTitle) {
- var samples = samplesByTitle[sampleTitle];
- var samplesTrack = new tr.ui.tracks.SampleTrack(this.viewport);
- samplesTrack.group = this.thread_;
- samplesTrack.samples = samples;
- samplesTrack.heading = this.thread_.userFriendlyName + ': ' +
- sampleTitle;
- samplesTrack.tooltip = this.thread_.userFriendlyDetails;
- samplesTrack.selectionGenerator = function() {
- var selection = new tr.model.EventSet();
- for (var i = 0; i < samplesTrack.samples.length; i++) {
- selection.push(samplesTrack.samples[i]);
- }
- return selection;
- };
- this.appendChild(samplesTrack);
- }, this);
- },
-
- collapsedDidChange: function(collapsed) {
- if (collapsed) {
- var h = parseInt(this.tracks[0].height);
- for (var i = 0; i < this.tracks.length; ++i) {
- if (h > 2) {
- this.tracks[i].height = Math.floor(h) + 'px';
- } else {
- this.tracks[i].style.display = 'none';
- }
- h = h * 0.5;
- }
- } else {
- for (var i = 0; i < this.tracks.length; ++i) {
- this.tracks[i].height = this.tracks[0].height;
- this.tracks[i].style.display = '';
- }
- }
- }
- };
-
- return {
- ThreadTrack: ThreadTrack
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/thread_track_test.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/thread_track_test.html
deleted file mode 100644
index 068c4f01e02..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/thread_track_test.html
+++ /dev/null
@@ -1,145 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/model/instant_event.html">
-<link rel="import" href="/tracing/ui/base/dom_helpers.html">
-<link rel="import" href="/tracing/ui/timeline_track_view.html">
-<link rel="import" href="/tracing/ui/tracks/thread_track.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var HighlightInstantEvent = tr.model.ThreadHighlightInstantEvent;
- var Process = tr.model.Process;
- var EventSet = tr.model.EventSet;
- var StackFrame = tr.model.StackFrame;
- var Sample = tr.model.Sample;
- var Thread = tr.model.Thread;
- var ThreadSlice = tr.model.ThreadSlice;
- var ThreadTrack = tr.ui.tracks.ThreadTrack;
- var Viewport = tr.ui.TimelineViewport;
- var newAsyncSlice = tr.c.TestUtils.newAsyncSlice;
- var newAsyncSliceNamed = tr.c.TestUtils.newAsyncSliceNamed;
- var newSliceEx = tr.c.TestUtils.newSliceEx;
-
- test('selectionHitTestingWithThreadTrack', function() {
- var model = new tr.Model();
- var p1 = model.getOrCreateProcess(1);
- var t1 = p1.getOrCreateThread(1);
- t1.sliceGroup.pushSlice(new ThreadSlice('', 'a', 0, 1, {}, 4));
- t1.sliceGroup.pushSlice(new ThreadSlice('', 'b', 0, 5.1, {}, 4));
-
- var testEl = document.createElement('div');
- testEl.appendChild(tr.ui.b.createScopedStyle('heading { width: 100px; }'));
- testEl.style.width = '600px';
-
- var viewport = new Viewport(testEl);
- var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
- testEl.appendChild(drawingContainer);
-
- var track = new ThreadTrack(viewport);
- drawingContainer.appendChild(track);
- drawingContainer.updateCanvasSizeIfNeeded_();
- track.thread = t1;
-
- var y = track.getBoundingClientRect().top;
- var h = track.getBoundingClientRect().height;
- var wW = 10;
- var vW = drawingContainer.canvas.getBoundingClientRect().width;
- var dt = new tr.ui.TimelineDisplayTransform();
- dt.xSetWorldBounds(0, wW, vW);
- track.viewport.setDisplayTransformImmediately(dt);
-
- var selection = new EventSet();
- var x = (1.5 / wW) * vW;
- track.addIntersectingEventsInRangeToSelection(
- x, x + 1, y, y + 1, selection);
- assert.isTrue(selection.equals(
- new EventSet([t1.sliceGroup.slices[0], t1.sliceGroup.slices[1]])));
-
- var selection = new EventSet();
- track.addIntersectingEventsInRangeToSelection(
- (1.5 / wW) * vW, (1.8 / wW) * vW,
- y, y + h, selection);
- assert.isTrue(selection.equals(
- new EventSet([t1.sliceGroup.slices[0], t1.sliceGroup.slices[1]])));
- });
-
- test('filterThreadSlices', function() {
- var model = new tr.Model();
- var thread = new Thread(new Process(model, 7), 1);
- thread.sliceGroup.pushSlice(newSliceEx(
- {title: 'a', start: 0, duration: 0}));
- thread.asyncSliceGroup.push(newAsyncSliceNamed('a', 0, 5, t, t));
-
- var t = new ThreadTrack(new tr.ui.TimelineViewport());
- t.thread = thread;
-
- assert.equal(t.tracks_.length, 2);
- assert.instanceOf(t.tracks_[0], tr.ui.tracks.AsyncSliceGroupTrack);
- assert.instanceOf(t.tracks_[1], tr.ui.tracks.SliceGroupTrack);
- });
-
- test('sampleThreadSlices', function() {
- var thread;
- var cpu;
- var model = tr.c.TestUtils.newModelWithEvents([], {
- shiftWorldToZero: false,
- pruneContainers: false,
- customizeModelCallback: function(model) {
- cpu = model.kernel.getOrCreateCpu(1);
- thread = model.getOrCreateProcess(1).getOrCreateThread(2);
-
- var fA = model.addStackFrame(new StackFrame(
- undefined, 1, 'cat', 'a', 7));
- var fAB = model.addStackFrame(new StackFrame(
- fA, 2, 'cat', 'b', 7));
- var fABC = model.addStackFrame(new StackFrame(
- fAB, 3, 'cat', 'c', 7));
- var fAD = model.addStackFrame(new StackFrame(
- fA, 4, 'cat', 'd', 7));
-
- model.samples.push(new Sample(undefined, thread, 'instructions_retired',
- 10, fABC, 10));
- model.samples.push(new Sample(undefined, thread, 'instructions_retired',
- 20, fAB, 10));
- model.samples.push(new Sample(undefined, thread, 'instructions_retired',
- 30, fAB, 10));
- model.samples.push(new Sample(undefined, thread, 'instructions_retired',
- 40, fAD, 10));
-
- model.samples.push(new Sample(undefined, thread, 'page_fault',
- 25, fAB, 10));
- model.samples.push(new Sample(undefined, thread, 'page_fault',
- 35, fAD, 10));
- }
- });
-
- var t = new ThreadTrack(new tr.ui.TimelineViewport());
- t.thread = thread;
- assert.equal(t.tracks_.length, 2);
-
- // Instructions retired
- var t0 = t.tracks_[0];
- assert.notEqual(t0.heading.indexOf('instructions_retired'), -1);
- assert.instanceOf(t0, tr.ui.tracks.SampleTrack);
- assert.equal(t0.samples.length, 4);
- t0.samples.forEach(function(s) {
- assert.instanceOf(s, tr.model.Sample);
- });
-
- // page_fault
- var t1 = t.tracks_[1];
- assert.notEqual(t1.heading.indexOf('page_fault'), -1);
- assert.instanceOf(t1, tr.ui.tracks.SampleTrack);
- assert.equal(t1.samples.length, 2);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/track.css b/chromium/third_party/catapult/tracing/tracing/ui/tracks/track.css
deleted file mode 100644
index 3d56eef5b8d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/track.css
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-.track-button {
- background-color: rgba(255, 255, 255, 0.5);
- border: 1px solid rgba(0, 0, 0, 0.1);
- color: rgba(0,0,0,0.2);
- font-size: 10px;
- height: 12px;
- text-align: center;
- width: 12px;
-}
-
-.track-button:hover {
- background-color: rgba(255, 255, 255, 1.0);
- border: 1px solid rgba(0, 0, 0, 0.5);
- box-shadow: 0 0 .05em rgba(0, 0, 0, 0.4);
- color: rgba(0, 0, 0, 1);
-}
-
-.track-close-button {
- left: 2px;
- position: absolute;
- top: 2px;
-}
-
-.track-collapse-button {
- left: 3px;
- position: absolute;
- top: 2px;
-}
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/tracks/track.html b/chromium/third_party/catapult/tracing/tracing/ui/tracks/track.html
deleted file mode 100644
index 09a54c27223..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/tracks/track.html
+++ /dev/null
@@ -1,167 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="stylesheet" href="/tracing/ui/tracks/track.css">
-
-<link rel="import" href="/tracing/ui/base/container_that_decorates_its_children.html">
-<link rel="import" href="/tracing/ui/base/ui.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.ui.tracks', function() {
- /**
- * The base class for all tracks, which render data into a provided div.
- * @constructor
- */
- var Track = tr.ui.b.define('track',
- tr.ui.b.ContainerThatDecoratesItsChildren);
- Track.prototype = {
- __proto__: tr.ui.b.ContainerThatDecoratesItsChildren.prototype,
-
- decorate: function(viewport) {
- tr.ui.b.ContainerThatDecoratesItsChildren.prototype.decorate.call(this);
- if (viewport === undefined)
- throw new Error('viewport is required when creating a Track.');
-
- this.viewport_ = viewport;
- this.classList.add('track');
- },
-
- get viewport() {
- return this.viewport_;
- },
-
- get drawingContainer() {
- var cur = this;
- while (cur) {
- if (cur instanceof tr.ui.tracks.DrawingContainer)
- return cur;
- cur = cur.parentElement;
- }
- return undefined;
- },
-
- get eventContainer() {
- },
-
- invalidateDrawingContainer: function() {
- var dc = this.drawingContainer;
- if (dc)
- dc.invalidate();
- },
-
- context: function() {
- // This is a little weird here, but we have to be able to walk up the
- // parent tree to get the context.
- if (!this.parentNode)
- return undefined;
- if (!this.parentNode.context)
- throw new Error('Parent container does not support context() method.');
- return this.parentNode.context();
- },
-
- decorateChild_: function(childTrack) {
- },
-
- undecorateChild_: function(childTrack) {
- if (childTrack.detach)
- childTrack.detach();
- },
-
- updateContents_: function() {
- },
-
- /**
- * Wrapper function around draw() that performs transformations on the
- * context necessary for the track's contents to be drawn in the right place
- * given the current pan and zoom.
- */
- drawTrack: function(type) {
- var ctx = this.context();
-
- var pixelRatio = window.devicePixelRatio || 1;
- var bounds = this.getBoundingClientRect();
- var canvasBounds = ctx.canvas.getBoundingClientRect();
-
- ctx.save();
- ctx.translate(0, pixelRatio * (bounds.top - canvasBounds.top));
-
- var dt = this.viewport.currentDisplayTransform;
- var viewLWorld = dt.xViewToWorld(0);
- var viewRWorld = dt.xViewToWorld(bounds.width * pixelRatio);
-
- this.draw(type, viewLWorld, viewRWorld);
- ctx.restore();
- },
-
- draw: function(type, viewLWorld, viewRWorld) {
- },
-
- addEventsToTrackMap: function(eventToTrackMap) {
- },
-
- addContainersToTrackMap: function(containerToTrackMap) {
- },
-
- addIntersectingEventsInRangeToSelection: function(
- loVX, hiVX, loVY, hiVY, selection) {
-
- var pixelRatio = window.devicePixelRatio || 1;
- var dt = this.viewport.currentDisplayTransform;
- var viewPixWidthWorld = dt.xViewVectorToWorld(1);
- var loWX = dt.xViewToWorld(loVX * pixelRatio);
- var hiWX = dt.xViewToWorld(hiVX * pixelRatio);
-
- var clientRect = this.getBoundingClientRect();
- var a = Math.max(loVY, clientRect.top);
- var b = Math.min(hiVY, clientRect.bottom);
- if (a > b)
- return;
-
- this.addIntersectingEventsInRangeToSelectionInWorldSpace(
- loWX, hiWX, viewPixWidthWorld, selection);
- },
-
- addIntersectingEventsInRangeToSelectionInWorldSpace: function(
- loWX, hiWX, viewPixWidthWorld, selection) {
- },
-
- /**
- * Gets implemented by supporting track types. The method adds the event
- * closest to worldX to the selection.
- *
- * @param {number} worldX The position that is looked for.
- * @param {number} worldMaxDist The maximum distance allowed from worldX to
- * the event.
- * @param {number} loY Lower Y bound of the search interval in view space.
- * @param {number} hiY Upper Y bound of the search interval in view space.
- * @param {Selection} selection Selection to which to add hits.
- */
- addClosestEventToSelection: function(
- worldX, worldMaxDist, loY, hiY, selection) {
- },
-
- addClosestInstantEventToSelection: function(instantEvents, worldX,
- worldMaxDist, selection) {
- var instantEvent = tr.b.findClosestElementInSortedArray(
- instantEvents,
- function(x) { return x.start; },
- worldX,
- worldMaxDist);
-
- if (!instantEvent)
- return;
-
- selection.push(instantEvent);
- }
- };
-
- return {
- Track: Track
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/view_specific_brushing_state.html b/chromium/third_party/catapult/tracing/tracing/ui/view_specific_brushing_state.html
deleted file mode 100644
index 0300e36d672..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/view_specific_brushing_state.html
+++ /dev/null
@@ -1,89 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/brushing_state_controller.html">
-
-<!--
-This element handles storing and retrieving the brushing state of arbitrary
-views (e.g. analysis sub-views). An element can use it by instantiating it and
-appending it to itself:
-
- <div id="some-view-with-specific-brushing-state">
- <tr-ui-b-view-specific-brushing-state view-id="unique-view-identifier">
- </tr-ui-b-view-specific-brushing-state>
- ... other child elements ...
- </div>
-
-The state can then be retrieved from and pushed to the state element as
-follows:
-
- newStateElement.set(state);
- state = newStateElement.get();
-
-Under the hood, the state element searches the DOM tree for an ancestor element
-with a brushingStateController field to persist the state (see the
-tr.c.BrushingStateController and tr.ui.b.BrushingState classes for more
-details).
--->
-<polymer-element name="tr-ui-b-view-specific-brushing-state">
- <script>
- 'use strict';
-
- Polymer({
- /** Compulsory unique identifier of the associated view. */
- get viewId() {
- return this.getAttribute('view-id');
- },
-
- set viewId(viewId) {
- this.setAttribute('view-id', viewId);
- },
-
- /**
- * Retrieve the persisted state of the associated view. The returned object
- * (or any of its fields) must not be modified by the caller (unless the
- * object/field is treated as a reference).
- *
- * If no state has been persisted yet or there is no ancestor element with
- * a brushingStateController field, this method returns undefined.
- */
- get: function() {
- var viewId = this.viewId;
- if (!viewId)
- throw new Error('Element must have a view-id attribute!');
-
- var brushingStateController =
- tr.c.BrushingStateController.getControllerForElement(this);
- if (!brushingStateController)
- return undefined;
-
- return brushingStateController.getViewSpecificBrushingState(viewId);
- },
-
- /**
- * Persist the provided state of the associated view. The provided object
- * (or any of its fields) must not be modified afterwards (unless the
- * object/field is treated as a reference).
- *
- * If there is no ancestor element with a brushingStateController field,
- * this method does nothing.
- */
- set: function(state) {
- var viewId = this.viewId;
- if (!viewId)
- throw new Error('Element must have a view-id attribute!');
-
- var brushingStateController =
- tr.c.BrushingStateController.getControllerForElement(this);
- if (!brushingStateController)
- return;
-
- brushingStateController.changeViewSpecificBrushingState(viewId, state);
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/view_specific_brushing_state_test.html b/chromium/third_party/catapult/tracing/tracing/ui/view_specific_brushing_state_test.html
deleted file mode 100644
index e4e8ece0441..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/ui/view_specific_brushing_state_test.html
+++ /dev/null
@@ -1,67 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/brushing_state_controller.html">
-<link rel="import" href="/tracing/ui/view_specific_brushing_state.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var BrushingStateController = tr.c.BrushingStateController;
-
- function setStateElement(containerEl, viewId) {
- var stateElement = document.createElement(
- 'tr-ui-b-view-specific-brushing-state');
- stateElement.viewId = viewId;
- containerEl.appendChild(stateElement);
- return stateElement;
- }
-
- function addChildDiv(element) {
- var child = element.ownerDocument.createElement('div');
- element.appendChild(child);
- return child;
- }
-
- function addShadowChildDiv(element) {
- var shadowRoot = element.createShadowRoot();
- return addChildDiv(shadowRoot);
- }
-
- test('instantiate_withoutBrushingStateController', function() {
- var containerEl = document.createElement('div');
-
- var stateElement1 = setStateElement(containerEl, 'test-view');
- assert.isUndefined(stateElement1.get());
- stateElement1.set({e: 2.71828});
- assert.isUndefined(stateElement1.get());
- });
-
- test('instantiate_withBrushingStateController', function() {
- var rootEl = document.createElement('div');
- var containerEl = addChildDiv(addShadowChildDiv(addChildDiv(rootEl)));
- rootEl.brushingStateController = new BrushingStateController(undefined);
-
- var stateElement1 = setStateElement(containerEl, 'test-view');
- assert.isUndefined(stateElement1.get());
- stateElement1.set({e: 2.71828});
- assert.deepEqual(stateElement1.get(), {e: 2.71828});
-
- var stateElement2 = setStateElement(containerEl, 'test-view-2');
- assert.isUndefined(stateElement2.get());
- stateElement2.set({pi: 3.14159});
- assert.deepEqual(stateElement2.get(), {pi: 3.14159});
-
- var stateElement3 = setStateElement(containerEl, 'test-view');
- assert.deepEqual(stateElement3.get(), {e: 2.71828});
-
- var stateElement4 = setStateElement(containerEl, 'test-view-2');
- assert.deepEqual(stateElement4.get(), {pi: 3.14159});
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/__init__.py b/chromium/third_party/catapult/tracing/tracing/value/__init__.py
deleted file mode 100644
index c134637dac2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/__init__.py
+++ /dev/null
@@ -1,192 +0,0 @@
-# Copyright (c) 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Simplified version of telemetry Value system, just enough for us to get
-# us up and running.
-
-
-class Value(object):
-
- def __init__(self, canonical_url, name, units, description=None,
- important=False, ir_stable_id=None):
- self.canonical_url = canonical_url
- self.name = name
- self.units = units
- self.description = description
- self.important = important
- self.ir_stable_id = ir_stable_id
-
- def AsDict(self):
- d = {
- 'canonical_url': self.canonical_url,
- 'name': self.name,
- 'important': self.important
- }
- # Only dump values if they're non-None, because Python json-ification turns
- # these to null, instead of leaving them out.
- if self.units is not None:
- d['units'] = self.units
-
- if self.description is not None:
- d['description'] = self.description
-
- if self.ir_stable_id is not None:
- d['ir_stable_id'] = self.ir_stable_id
-
- self._AsDictInto(d)
- assert 'type' in d
-
- return d
-
- def _AsDictInto(self, d):
- raise NotImplementedError()
-
- @classmethod
- def FromDict(cls, d):
- if d['type'] == 'dict':
- return DictValue.FromDict(d)
- elif d['type'] == 'scalar':
- return ScalarValue.FromDict(d)
- elif d['type'] == 'failure':
- return FailureValue.FromDict(d)
- elif d['type'] == 'skip':
- return SkipValue.FromDict(d)
- else:
- raise NotImplementedError()
-
-
-# TODO(eakuefner): Change to NumericValue after porting Unit
-# (https://github.com/catapult-project/catapult/issues/2049)
-class ScalarValue(Value):
-
- def __init__(self, canonical_url, name, value, description=None,
- important=False, ir_stable_id=None):
- assert isinstance(value, dict)
- super(ScalarValue, self).__init__(canonical_url, name, units=None,
- description=description,
- important=important,
- ir_stable_id=ir_stable_id)
- self._value = value
-
- def __repr__(self):
- return '%s("%s", "%s")' % (self.__class__.__name__,
- self.name, self.value)
-
- def _AsDictInto(self, d):
- d['type'] = 'scalar'
- d['value'] = self._value
-
- @classmethod
- def FromDict(cls, d):
- assert d.get('units', None) == None
- return cls(d['canonical_url'], name=d['name'],
- description=d.get('description', None),
- value=d['value'],
- important=d['important'],
- ir_stable_id=d.get('ir_stable_id', None))
-
- @property
- def value(self):
- return self._value
-
- def __getitem__(self, key):
- return self._value[key]
-
-
-class DictValue(Value):
-
- def __init__(self, canonical_url, name, value, description=None,
- important=False, ir_stable_id=None):
- assert isinstance(value, dict)
- super(DictValue, self).__init__(canonical_url, name, units=None,
- description=description,
- important=important,
- ir_stable_id=ir_stable_id)
- self._value = value
-
- def __repr__(self):
- return '%s("%s", "%s")' % (self.__class__.__name__,
- self.name, self.value)
-
- def _AsDictInto(self, d):
- d['type'] = 'dict'
- d['value'] = self._value
-
- @classmethod
- def FromDict(cls, d):
- assert d.get('units', None) == None
- return cls(d['canonical_url'], name=d['name'],
- description=d.get('description', None),
- value=d['value'],
- important=d['important'],
- ir_stable_id=d.get('ir_stable_id', None))
-
- @property
- def value(self):
- return self._value
-
- def __getitem__(self, key):
- return self._value[key]
-
-class FailureValue(Value):
-
- def __init__(self, canonical_url, failure_type_name, description, stack,
- important=False, ir_stable_id=None):
- super(FailureValue, self).__init__(canonical_url,
- name=failure_type_name,
- units=None,
- description=description,
- important=important,
- ir_stable_id=ir_stable_id)
- assert isinstance(stack, basestring)
- self.stack = stack
-
- def __repr__(self):
- return '%s("%s", "%s")' % (self.__class__.__name__,
- self.name, self.description)
-
- def _AsDictInto(self, d):
- d['type'] = 'failure'
- d['stack_str'] = self.stack
-
- @classmethod
- def FromDict(cls, d):
- assert d.get('units', None) == None
- return cls(d['canonical_url'],
- failure_type_name=d['name'],
- description=d.get('description', None),
- stack=d['stack_str'],
- important=d.get('important', False),
- ir_stable_id=d.get('ir_stable_id', None))
-
- def GetGTestPrintString(self):
- return self.stack
-
-
-class SkipValue(Value):
-
- def __init__(self, canonical_url, skipped_result_name,
- description=None, important=False, ir_stable_id=None):
- super(SkipValue, self).__init__(canonical_url,
- name=skipped_result_name,
- units=None,
- description=description,
- important=important,
- ir_stable_id=ir_stable_id)
-
- def __repr__(self):
- return '%s("%s", "%s")' % (self.__class__.__name__,
- self.name, self.description)
-
- def _AsDictInto(self, d):
- d['type'] = 'skip'
-
- @classmethod
- def FromDict(cls, d):
- assert d.get('units', None) == None
- return cls(d['canonical_url'],
- skipped_result_name=d['name'],
- description=d.get('description', None),
- important=d.get('important', False),
- ir_stable_id=d.get('ir_stable_id', None))
diff --git a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/composition.html b/chromium/third_party/catapult/tracing/tracing/value/diagnostics/composition.html
deleted file mode 100644
index c58f29d0b02..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/composition.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/diagnostics/related_value_set.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.v.d', function() {
- /** @constructor */
- function Composition(opt_values) {
- tr.v.d.RelatedValueSet.call(this, opt_values);
- }
-
- Composition.prototype = {
- __proto__: tr.v.d.RelatedValueSet.prototype
- };
-
- Composition.fromDict = function(d) {
- return new Composition(d.guids.map(guid => new tr.v.d.ValueRef(guid)));
- };
-
- tr.v.d.Diagnostic.register(Composition);
-
- return {
- Composition: Composition
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/diagnostic.html b/chromium/third_party/catapult/tracing/tracing/value/diagnostics/diagnostic.html
deleted file mode 100644
index 2b65454620b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/diagnostic.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/extension_registry.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.v.d', function() {
- /** @constructor */
- function Diagnostic() {
- }
-
- Diagnostic.prototype = {
- asDict: function() {
- var result = {type: this.constructor.name};
- this.asDictInto_(result);
- return result;
- },
-
- asDictInto_: function(d) {
- throw new Error('Abstract virtual method');
- }
- };
-
- var options = new tr.b.ExtensionRegistryOptions(tr.b.BASIC_REGISTRY_MODE);
- options.defaultMetadata = {};
- options.mandatoryBaseClass = Diagnostic;
- tr.b.decorateExtensionRegistry(Diagnostic, options);
-
- Diagnostic.addEventListener('will-register', function(e) {
- var constructor = e.typeInfo.constructor;
- if (!(constructor.fromDict instanceof Function) ||
- (constructor.fromDict.length !== 1)) {
- throw new Error('Diagnostics must define fromDict(d)');
- }
-
- // When subclasses set their prototype to an entirely new object and omit
- // their constructor, then it becomes impossible for asDict() to find their
- // constructor name. Add it back here so that asDict() can find it.
- constructor.prototype.constructor = constructor;
- });
-
- Diagnostic.fromDict = function(d) {
- var typeInfo = Diagnostic.findTypeInfoWithName(d.type);
- if (!typeInfo)
- throw new Error('Unrecognized diagnostic type: ' + d.type);
-
- return typeInfo.constructor.fromDict(d);
- };
-
- return {
- Diagnostic: Diagnostic
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/diagnostic_map.html b/chromium/third_party/catapult/tracing/tracing/value/diagnostics/diagnostic_map.html
deleted file mode 100644
index 4af13e22d54..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/diagnostic_map.html
+++ /dev/null
@@ -1,98 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<!--
- Include all Diagnostic subclasses here so that DiagnosticMap.addDicts() and
- DiagnosticMap.fromDict() always have access to all subclasses in the
- Diagnostic registry.
--->
-
-<link rel="import" href="/tracing/value/diagnostics/composition.html">
-<link rel="import" href="/tracing/value/diagnostics/generic.html">
-<link rel="import" href="/tracing/value/diagnostics/iteration_info.html">
-<link rel="import" href="/tracing/value/diagnostics/related_event_set.html">
-<link rel="import" href="/tracing/value/diagnostics/related_value_map.html">
-<link rel="import" href="/tracing/value/diagnostics/related_value_set.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.v.d', function() {
- /** @constructor */
- function DiagnosticMap() {
- this.diagnosticsByName_ = {};
- }
-
- DiagnosticMap.prototype = {
- /**
- * Add a new Diagnostic to this map.
- *
- * @param {string} name
- * @param {!tr.v.d.Diagnostic} diagnostic
- */
- add: function(name, diagnostic) {
- if (!(diagnostic instanceof tr.v.d.Diagnostic))
- throw new Error('Must be instanceof Diagnostic: ' + diagnostic);
-
- if (typeof(name) !== 'string')
- throw new Error('name must be string, not ' + name);
-
- if (this.diagnosticsByName_[name])
- throw new Error('Attempt to add duplicate diagnostic ' + name);
-
- this.diagnosticsByName_[name] = diagnostic;
- },
-
- /**
- * Add Diagnostics from a dictionary of dictionaries.
- *
- * @param {Object} dict
- */
- addDicts: function(dict) {
- tr.b.iterItems(dict, function(name, diagnosticDict) {
- this.add(name, tr.v.d.Diagnostic.fromDict(diagnosticDict));
- }, this);
- },
-
- /**
- * @param {string} name
- * @return {tr.v.d.Diagnostic}
- */
- get: function(name) {
- return this.diagnosticsByName_[name];
- },
-
- /**
- * Iterate over this map's key-value-pairs.
- *
- * @param {function(string, tr.v.d.Diagnostic)} callback
- * @param {Object=} opt_this
- */
- forEach: function(callback, opt_this) {
- tr.b.iterItems(this.diagnosticsByName_, callback, opt_this || this);
- },
-
- asDict: function() {
- var dict = {};
- this.forEach(function(name, diagnostic) {
- dict[name] = diagnostic.asDict();
- });
- return dict;
- }
- };
-
- DiagnosticMap.fromDict = function(d) {
- var diagnostics = new DiagnosticMap();
- diagnostics.addDicts(d);
- return diagnostics;
- };
-
- return {
- DiagnosticMap: DiagnosticMap
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/generic.html b/chromium/third_party/catapult/tracing/tracing/value/diagnostics/generic.html
deleted file mode 100644
index 7ac19796e34..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/generic.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/diagnostics/diagnostic.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.v.d', function() {
- /**
- * A Generic diagnostic can contain any Plain-Ol'-Data objects that can be
- * serialized using JSON.stringify(): null, boolean, number, string, array,
- * dict. Generic diagnostics cannot contain tr.v.Value objects!
- *
- * @constructor
- * @param {*} value
- */
- function Generic(value) {
- this.value = value;
- }
-
- Generic.prototype = {
- __proto__: tr.v.d.Diagnostic.prototype,
-
- asDictInto_: function(d) {
- d.value = this.value;
- }
- };
-
- Generic.fromDict = function(d) {
- return new Generic(d.value);
- };
-
- tr.v.d.Diagnostic.register(Generic, {
- elementName: 'tr-v-ui-generic-diagnostic-span'
- });
-
- return {
- Generic: Generic
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/iteration_info.html b/chromium/third_party/catapult/tracing/tracing/value/diagnostics/iteration_info.html
deleted file mode 100644
index d2047935916..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/iteration_info.html
+++ /dev/null
@@ -1,102 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/diagnostics/diagnostic.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.v.d', function() {
- /**
- * @constructor
- * @param {!Object} info
- * @param {string} info.benchmarkName
- * @param {undefined|string} info.label
- * @param {undefined|!Object} info.storyGroupingKeys
- * @param {undefined|string} info.storyDisplayName
- * @param {string} info.storyUrl
- * @param {number} info.storyRepeatCounter
- * @param {number} info.storysetRepeatCounter
- * @param {number} info.benchmarkStartMs Milliseconds since Unix epoch.
- */
- function IterationInfo(info) {
- this.benchmarkName_ = info.benchmarkName;
- this.benchmarkStart_ = new Date(info.benchmarkStartMs);
- this.label_ = info.label;
- this.storyDisplayName_ = info.storyDisplayName;
- this.storyGroupingKeys_ = info.storyGroupingKeys;
- this.storyRepeatCounter_ = info.storyRepeatCounter;
- this.storyUrl_ = info.storyUrl;
- this.storysetRepeatCounter_ = info.storysetRepeatCounter;
- }
-
- IterationInfo.prototype = {
- __proto__: tr.v.d.Diagnostic.prototype,
-
- asDictInto_: function(d) {
- d.benchmarkName = this.benchmarkName;
- d.benchmarkStartMs = this.benchmarkStart.getTime();
- d.label = this.label;
- d.storyDisplayName = this.storyDisplayName;
- d.storyGroupingKeys = this.storyGroupingKeys;
- d.storyRepeatCounter = this.storyRepeatCounter;
- d.storyUrl = this.storyUrl;
- d.storysetRepeatCounter = this.storysetRepeatCounter;
- },
-
- get displayLabel() {
- if (this.label)
- return this.label;
- return this.benchmarkName + ' ' + this.benchmarkStart;
- },
-
- get benchmarkName() {
- return this.benchmarkName_;
- },
-
- get label() {
- return this.label_;
- },
-
- get storyGroupingKeys() {
- return this.storyGroupingKeys_;
- },
-
- get storyDisplayName() {
- return this.storyDisplayName_;
- },
-
- get storyUrl() {
- return this.storyUrl_;
- },
-
- get storyRepeatCounter() {
- return this.storyRepeatCounter_;
- },
-
- get storysetRepeatCounter() {
- return this.storysetRepeatCounter_;
- },
-
- get benchmarkStart() {
- return this.benchmarkStart_;
- }
- };
-
- IterationInfo.fromDict = function(d) {
- return new IterationInfo(d);
- };
-
- tr.v.d.Diagnostic.register(IterationInfo, {
- elementName: 'tr-v-ui-iteration-info-span'
- });
-
- return {
- IterationInfo: IterationInfo
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_event_set.html b/chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_event_set.html
deleted file mode 100644
index fa611de3695..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_event_set.html
+++ /dev/null
@@ -1,122 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/model/event_set.html">
-<link rel="import" href="/tracing/value/diagnostics/diagnostic.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.v.d', function() {
- /**
- * Similar to ValueRef, this is a placeholder in case the referenced Event
- * isn't available in memory to point to directly.
- *
- * @constructor
- * @param {!Object} event
- * @param {string} event.stableId
- * @param {string} event.title
- * @param {number} event.start
- * @param {number} event.duration
- */
- function EventRef(event) {
- this.stableId = event.stableId;
- this.title = event.title;
- this.start = event.start;
- this.duration = event.duration;
- this.end = this.start + this.duration;
-
- // tr.v.d.RelatedEventSet identifies events using stableId, but
- // tr.model.EventSet uses guid.
- this.guid = tr.b.GUID.allocateSimple();
- }
-
- /**
- * A RelatedEventSet diagnostic contains references to Events
- *
- * @constructor
- * @param {(!tr.model.EventSet|Array.<!(EventRef|tr.model.Event)>|!EventRef|!tr.model.Event)=} opt_events
- */
- function RelatedEventSet(opt_events) {
- this.eventsByStableId_ = {};
-
- if (opt_events) {
- if (opt_events instanceof tr.model.EventSet ||
- opt_events instanceof Array)
- opt_events.forEach(this.push.bind(this));
- else
- this.push(opt_events);
- }
- }
-
- RelatedEventSet.prototype = {
- __proto__: tr.v.d.Diagnostic.prototype,
-
- /**
- * Add an event to this set.
- *
- * @param {!(EventRef|tr.model.Event)} event
- */
- push: function(event) {
- this.eventsByStableId_[event.stableId] = event;
- },
-
- /**
- * @return {!Array.<!(EventRef|tr.model.Event)>}
- */
- get events() {
- return tr.b.dictionaryValues(this.eventsByStableId_);
- },
-
- /**
- * Resolve all EventRefs into Events by finding their stableIds in |model|.
- * If a stableId cannot be found and |opt_required| is true, then throw an
- * Error.
- * If a stableId cannot be found and |opt_required| is false, then the
- * EventRef will remain an EventRef.
- *
- * @param {!tr.model.Model} model
- * @param {boolean=} opt_required
- */
- resolve: function(model, opt_required) {
- tr.b.iterItems(this.eventsByStableId_, function(stableId, event) {
- if (!(event instanceof EventRef))
- return;
-
- event = model.getEventByStableId(stableId);
- if (event instanceof tr.model.Event)
- this.eventsByStableId_[stableId] = event;
- else if (opt_required)
- throw new Error('Unable to find Event ' + ref.stableId);
- }, this);
- },
-
- asDictInto_: function(d) {
- d.events = this.events.map(function eventAsDict(event) {
- return {
- stableId: event.stableId,
- title: event.title,
- start: event.start,
- duration: event.duration
- };
- });
- }
- };
-
- RelatedEventSet.fromDict = function(d) {
- return new RelatedEventSet(d.events.map(event => new EventRef(event)));
- };
-
- tr.v.d.Diagnostic.register(RelatedEventSet, {
- elementName: 'tr-v-ui-related-event-set-span'
- });
-
- return {
- RelatedEventSet: RelatedEventSet
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_event_set_test.html b/chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_event_set_test.html
deleted file mode 100644
index de901b53e2d..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_event_set_test.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/value/diagnostics/related_event_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('eventSet', function() {
- var slice = undefined;
- var model = tr.c.TestUtils.newModel(function(model) {
- slice = tr.c.TestUtils.newSliceEx({
- type: tr.model.ThreadSlice,
- title: 'foo',
- start: 0,
- duration: 10
- });
- var thread = model.getOrCreateProcess(1).getOrCreateThread(2);
- thread.sliceGroup.pushSlice(slice);
- });
-
- var d = new tr.v.d.RelatedEventSet(slice);
- assert.lengthOf(d.events, 1);
- assert.strictEqual(d.events[0], slice);
-
- d = new tr.v.d.RelatedEventSet([slice]);
- assert.lengthOf(d.events, 1);
- assert.strictEqual(d.events[0], slice);
-
- d = new tr.v.d.RelatedEventSet(new tr.model.EventSet([slice]));
- assert.lengthOf(d.events, 1);
- assert.strictEqual(d.events[0], slice);
-
- var d2 = tr.v.d.Diagnostic.fromDict(d.asDict());
- assert.instanceOf(d2, tr.v.d.RelatedEventSet);
- assert.lengthOf(d2.events, 1);
-
- // Can't use assert.instanceOf() because EventRef is private.
- assert.isFalse(d2.events[0] instanceof tr.model.Event);
-
- d2.resolve(model, true);
-
- assert.strictEqual(d2.events[0], slice);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_value_map.html b/chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_value_map.html
deleted file mode 100644
index b3ee5011017..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_value_map.html
+++ /dev/null
@@ -1,110 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/value/diagnostics/related_value_set.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.v.d', function() {
- /** @constructor */
- function RelatedValueMap() {
- this.valuesByName_ = {};
- }
-
- RelatedValueMap.prototype = {
- __proto__: tr.v.d.Diagnostic.prototype,
-
- /**
- * Add a named Value to this map.
- *
- * @param {string} name
- * @param {!(tr.v.d.ValueRef|tr.v.Value)} value
- */
- set: function(name, value) {
- if (!(value instanceof tr.v.Value) &&
- !(value instanceof tr.v.d.ValueRef))
- throw new Error('Must be instanceof Value or ValueRef: ' + value);
-
- this.valuesByName_[name] = value;
- },
-
- /**
- * Iterate over the named Values.
- *
- * @param {!function(string, !(tr.v.d.ValueRef|tr.v.Value))} callback
- * @param {*=} opt_this
- */
- iterItems: function(callback, opt_this) {
- tr.b.iterItems(this.valuesByName_, callback, opt_this || this);
- },
-
- /**
- * @return {!Array.<!(tr.v.d.ValueRef|tr.v.Value)>}
- */
- get values() {
- return tr.b.dictionaryValues(this.valuesByName_);
- },
-
- /**
- * Lookup a Value by name. Returns undefined if |name| is not found.
- *
- * @param {string} name
- * @return {!tr.v.d.ValueRef|!tr.v.Value|undefined}
- */
- get: function(name) {
- return this.valuesByName_[name];
- },
-
- /**
- * Resolve all ValueRefs into Values by looking up their guids in
- * |valueSet|.
- * If a value cannot be found and |opt_required| is true, then throw an
- * Error.
- * If a value cannot be found and |opt_required| is false, then the ValueRef
- * will remain a ValueRef.
- *
- * @param {!tr.v.ValueSet} valueSet
- * @param {boolean=} opt_required
- */
- resolve: function(valueSet, opt_required) {
- this.iterItems(function(name, value) {
- if (!(value instanceof tr.v.d.ValueRef))
- return;
-
- value = valueSet.lookup(value.guid);
- if (value instanceof tr.v.Value)
- this.valuesByName_[name] = value;
- else if (opt_required)
- throw new Error('Unable to find Value ' + guid);
- }, this);
- },
-
- asDictInto_: function(d) {
- d.values = tr.b.mapItems(this.valuesByName_, (name, value) => value.guid);
- }
- };
-
- RelatedValueMap.fromDict = function(d) {
- var map = new RelatedValueMap();
- tr.b.iterItems(d.values, function(name, guid) {
- map.set(name, new tr.v.d.ValueRef(guid));
- });
- return map;
- };
-
- tr.v.d.Diagnostic.register(RelatedValueMap, {
- elementName: 'tr-v-ui-related-value-map-span'
- });
-
-
- return {
- RelatedValueMap: RelatedValueMap
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_value_set.html b/chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_value_set.html
deleted file mode 100644
index 412c4dff0f2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/diagnostics/related_value_set.html
+++ /dev/null
@@ -1,96 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/value/diagnostics/diagnostic.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.v.d', function() {
- /** @constructor */
- function ValueRef(guid) {
- this.guid = guid;
- }
-
- /** @constructor */
- function RelatedValueSet(opt_values) {
- this.valuesByGuid_ = {};
-
- if (opt_values)
- opt_values.forEach(this.add, this);
- }
-
- RelatedValueSet.prototype = {
- __proto__: tr.v.d.Diagnostic.prototype,
-
- /**
- * Add a Value to this set.
- *
- * @param {!(ValueRef|tr.v.Value)} v
- */
- add: function(value) {
- if (!(value instanceof tr.v.Value) &&
- !(value instanceof ValueRef))
- throw new Error('Must be instanceof Value or ValueRef: ' + value);
-
- if (this.valuesByGuid_[value.guid])
- throw new Error('Tried to add same value twice');
-
- this.valuesByGuid_[value.guid] = value;
- },
-
- /**
- * @return {Array.<(ValueRef|tr.v.Value)>}
- */
- get values() {
- return tr.b.dictionaryValues(this.valuesByGuid_);
- },
-
- /**
- * Resolve all ValueRefs into Values by looking up their guids in
- * |valueSet|.
- * If a value cannot be found and |opt_required| is true, then throw an
- * Error.
- * If a value cannot be found and |opt_required| is false, then the ValueRef
- * will remain a ValueRef.
- *
- * @param {!tr.v.ValueSet} valueSet
- * @param {boolean=} opt_required
- */
- resolve: function(valueSet, opt_required) {
- tr.b.iterItems(this.valuesByGuid_, function(guid, value) {
- if (!(value instanceof ValueRef))
- return;
-
- value = valueSet.lookup(guid);
- if (value instanceof tr.v.Value)
- this.valuesByGuid_[guid] = value;
- else if (opt_required)
- throw new Error('Unable to find Value ' + guid);
- }, this);
- },
-
- asDictInto_: function(d) {
- d.guids = tr.b.dictionaryKeys(this.valuesByGuid_);
- }
- };
-
- RelatedValueSet.fromDict = function(d) {
- return new RelatedValueSet(d.guids.map(guid => new ValueRef(guid)));
- };
-
- tr.v.d.Diagnostic.register(RelatedValueSet, {
- elementName: 'tr-v-ui-related-value-set-span'
- });
-
- return {
- RelatedValueSet: RelatedValueSet,
- ValueRef: ValueRef
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/generic_table.html b/chromium/third_party/catapult/tracing/tracing/value/generic_table.html
deleted file mode 100644
index 220510c8952..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/generic_table.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/base.html">
-<script>
-'use strict';
-
-tr.exportTo('tr.v', function() {
- /**
- * Tabular data wrapper. Simply wraps an array of items.
- */
- function GenericTable(items) {
- if (items !== undefined)
- this.items = items;
- else
- this.items = [];
- };
-
- GenericTable.prototype = {
- };
-
- return {
- GenericTable: GenericTable
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/numeric.html b/chromium/third_party/catapult/tracing/tracing/value/numeric.html
deleted file mode 100644
index f8fc53f890a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/numeric.html
+++ /dev/null
@@ -1,667 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/base/running_statistics.html">
-<link rel="import" href="/tracing/base/sorted_array_utils.html">
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.v', function() {
- var Range = tr.b.Range;
-
- var MAX_SOURCE_INFOS = 16;
-
- function NumericBase(unit) {
- if (!(unit instanceof tr.v.Unit))
- throw new Error('Expected provided unit to be instance of Unit');
-
- this.unit = unit;
- }
-
- NumericBase.prototype = {
- asDict: function() {
- var d = {
- unit: this.unit.asJSON()
- };
-
- this.asDictInto_(d);
- return d;
- }
- };
-
- NumericBase.fromDict = function(d) {
- if (d.type === 'scalar')
- return ScalarNumeric.fromDict(d);
-
- if (d.type === 'numeric')
- return Numeric.fromDict(d);
-
- throw new Error('Not implemented');
- };
-
- function NumericBin(parentNumeric, opt_range) {
- this.parentNumeric = parentNumeric;
- this.range = opt_range || (new tr.b.Range());
- this.count = 0;
- this.sourceInfos = [];
- }
-
- NumericBin.fromDict = function(parentNumeric, d) {
- var n = new NumericBin(parentNumeric);
- n.range.min = d.min;
- n.range.max = d.max;
- n.count = d.count;
- n.sourceInfos = d.sourceInfos;
- return n;
- };
-
- NumericBin.prototype = {
- add: function(value, sourceInfo) {
- this.count += 1;
- tr.b.Statistics.uniformlySampleStream(this.sourceInfos, this.count,
- sourceInfo, MAX_SOURCE_INFOS);
- },
-
- addBin: function(other) {
- if (!this.range.equals(other.range))
- throw new Error('Merging incompatible Numeric bins.');
- tr.b.Statistics.mergeSampledStreams(this.sourceInfos, this.count,
- other.sourceInfos, other.count, MAX_SOURCE_INFOS);
- this.count += other.count;
- },
-
- asDict: function() {
- return {
- min: this.range.min,
- max: this.range.max,
- count: this.count,
- sourceInfos: this.sourceInfos.slice(0)
- };
- },
-
- asJSON: function() {
- return this.asDict();
- }
- };
-
- function Numeric(unit, range, binInfo) {
- NumericBase.call(this, unit);
-
- this.range = range;
-
- this.numNans = 0;
- this.nanSourceInfos = [];
-
- this.running = new tr.b.RunningStatistics();
- this.maxCount_ = 0;
-
- this.underflowBin = binInfo.underflowBin;
- this.centralBins = binInfo.centralBins;
- this.overflowBin = binInfo.overflowBin;
-
- this.allBins = [];
- this.allBins.push(this.underflowBin);
- this.allBins.push.apply(this.allBins, this.centralBins);
- this.allBins.push(this.overflowBin);
-
- this.allBins.forEach(function(bin) {
- if (bin.count > this.maxCount_)
- this.maxCount_ = bin.count;
- }, this);
-
- this.summaryOptions = this.defaultSummaryOptions();
- }
-
- Numeric.fromDict = function(d) {
- var range = Range.fromExplicitRange(d.min, d.max);
- var binInfo = {};
- binInfo.underflowBin = NumericBin.fromDict(undefined, d.underflowBin);
- binInfo.centralBins = d.centralBins.map(function(binAsDict) {
- return NumericBin.fromDict(undefined, binAsDict);
- });
- binInfo.overflowBin = NumericBin.fromDict(undefined, d.overflowBin);
- var n = new Numeric(tr.v.Unit.fromJSON(d.unit), range, binInfo);
- n.allBins.forEach(function(bin) {
- bin.parentNumeric = n;
- });
- if (d.running)
- n.running = tr.b.RunningStatistics.fromDict(d.running);
- if (d.summaryOptions)
- n.customizeSummaryOptions(d.summaryOptions);
- n.numNans = d.numNans;
- n.nanSourceInfos = d.nanSourceInfos;
- return n;
- };
-
- Numeric.prototype = {
- __proto__: NumericBase.prototype,
-
- get numValues() {
- return tr.b.Statistics.sum(this.allBins, function(e) {
- return e.count;
- });
- },
-
- get average() {
- return this.running.mean;
- },
-
- get sum() {
- return this.running.sum;
- },
-
- get maxCount() {
- return this.maxCount_;
- },
-
- /*
- * Compute an approximation of percentile based on the counts in the bins.
- * If the real percentile lies within |this.range| then the result of
- * the function will deviate from the real percentile by at most
- * the maximum width of the bin(s) within which the point(s)
- * from which the real percentile would be calculated lie.
- * If the real percentile is outside |this.range| then the function
- * returns the closest range limit: |this.range.min| or |this.range.max|.
- *
- * @param {number} percent The percent must be between 0.0 and 1.0.
- */
- getApproximatePercentile: function(percent) {
- if (!(percent >= 0 && percent <= 1))
- throw new Error('percent must be [0,1]');
- if (this.numValues == 0)
- return 0;
- var valuesToSkip = Math.floor((this.numValues - 1) * percent);
- for (var i = 0; i < this.allBins.length; i++) {
- var bin = this.allBins[i];
- valuesToSkip -= bin.count;
- if (valuesToSkip < 0) {
- if (bin === this.underflowBin)
- return bin.range.max;
- else if (bin === this.overflowBin)
- return bin.range.min;
- else
- return bin.range.center;
- }
- }
- throw new Error('Unreachable');
- },
-
- getInterpolatedCountAt: function(value) {
- var bin = this.getBinForValue(value);
- var idx = this.centralBins.indexOf(bin);
- if (idx < 0) {
- // |value| is in either the underflowBin or the overflowBin.
- // We can't interpolate between infinities.
- return bin.count;
- }
-
- // |value| must fall between the centers of two bins.
- // The bin whose center is less than |value| will be this:
- var lesserBin = bin;
-
- // The bin whose center is greater than |value| will be this:
- var greaterBin = bin;
-
- // One of those bins could be an under/overflow bin.
- // Avoid dealing with Infinities by arbitrarily saying that center of the
- // underflow bin is its range.max, and the center of the overflow bin is
- // its range.min.
- // The centers of bins in |this.centralBins| will default to their
- // |range.center|.
-
- var lesserBinCenter = undefined;
- var greaterBinCenter = undefined;
-
- if (value < greaterBin.range.center) {
- if (idx > 0) {
- lesserBin = this.centralBins[idx - 1];
- } else {
- lesserBin = this.underflowBin;
- lesserBinCenter = lesserBin.range.max;
- }
- } else {
- if (idx < (this.centralBins.length - 1)) {
- greaterBin = this.centralBins[idx + 1];
- } else {
- greaterBin = this.overflowBin;
- greaterBinCenter = greaterBin.range.min;
- }
- }
-
- if (greaterBinCenter === undefined)
- greaterBinCenter = greaterBin.range.center;
-
- if (lesserBinCenter === undefined)
- lesserBinCenter = lesserBin.range.center;
-
- value = tr.b.normalize(value, lesserBinCenter, greaterBinCenter);
-
- return tr.b.lerp(value, lesserBin.count, greaterBin.count);
- },
-
- getBinForValue: function(value) {
- // Don't use subtraction to avoid arithmetic overflow.
- var binIndex = tr.b.findHighIndexInSortedArray(
- this.allBins, b => value < b.range.max ? -1 : 1);
- return this.allBins[binIndex] || this.overflowBin;
- },
-
- add: function(value, sourceInfo) {
- if (typeof(value) !== 'number' || isNaN(value)) {
- this.numNans++;
- tr.b.Statistics.uniformlySampleStream(this.nanSourceInfos, this.numNans,
- sourceInfo, MAX_SOURCE_INFOS);
- return;
- }
-
- var bin = this.getBinForValue(value);
- bin.add(value, sourceInfo);
- this.running.add(value);
- if (bin.count > this.maxCount_)
- this.maxCount_ = bin.count;
- },
-
- addNumeric: function(other) {
- if (!this.range.equals(other.range) ||
- !this.unit === other.unit ||
- this.allBins.length !== other.allBins.length) {
- throw new Error('Merging incompatible Numerics.');
- }
- tr.b.Statistics.mergeSampledStreams(this.nanSourceInfos, this.numNans,
- other.nanSourceInfos, other.numNans, MAX_SOURCE_INFOS);
- this.numNans += other.numNans;
- this.running = this.running.merge(other.running);
- for (var i = 0; i < this.allBins.length; ++i) {
- this.allBins[i].addBin(other.allBins[i]);
- }
- },
-
- /**
- * Controls which statistics are exported to dashboard for this numeric.
- * The |summaryOptions| parameter is a dictionary with optional boolean
- * fields |count|, |sum|, |avg|, |std|, |min|, |max| and an optional
- * array field |percentile|.
- * Each percentile should be a number between 0.0 and 1.0.
- * The options not included in the |summaryOptions| will not change.
- */
- customizeSummaryOptions: function(summaryOptions) {
- tr.b.iterItems(summaryOptions, function(key, value) {
- this.summaryOptions[key] = value;
- }, this);
- },
-
- defaultSummaryOptions: function() {
- return {
- count: true,
- sum: true,
- avg: true,
- std: true,
- min: true,
- max: true,
- percentile: []
- };
- },
-
- /**
- * Returns an array of {name: string, scalar: ScalarNumeric} values.
- * Each enabled summary option produces the corresponding value:
- * min, max, count, sum, avg, or std.
- * Each percentile 0.x produces pct_0x0.
- * Each percentile 0.xx produces pct_0xx.
- * Each percentile 0.xxy produces pct_0xx_y.
- * Percentile 1.0 produces pct_100.
- */
- getSummarizedScalarNumericsWithNames: function() {
- function statNameToKey(stat) {
- switch (stat) {
- case 'std':
- return 'stddev';
- case 'avg':
- return 'mean';
- }
- return stat;
- }
- /**
- * Converts the given percent to a string in the format specified above.
- * @param {number} percent The percent must be between 0.0 and 1.0.
- */
- function percentToString(percent) {
- if (percent < 0 || percent > 1)
- throw new Error('Percent must be between 0.0 and 1.0');
- switch (percent) {
- case 0:
- return '000';
- case 1:
- return '100';
- }
- var str = percent.toString();
- if (str[1] !== '.')
- throw new Error('Unexpected percent');
- // Pad short strings with zeros.
- str = str + '0'.repeat(Math.max(4 - str.length, 0));
- if (str.length > 4)
- str = str.slice(0, 4) + '_' + str.slice(4);
- return '0' + str.slice(2);
- }
-
- var results = [];
- tr.b.iterItems(this.summaryOptions, function(stat, option) {
- if (!option)
- return;
- if (stat === 'percentile') {
- option.forEach(function(percent) {
- var percentile = this.getApproximatePercentile(percent);
- results.push({
- name: 'pct_' + percentToString(percent),
- scalar: new tr.v.ScalarNumeric(this.unit, percentile)
- });
- }, this);
- } else {
- var statUnit = stat === 'count' ?
- tr.v.Unit.byName.unitlessNumber_smallerIsBetter : this.unit;
- var key = statNameToKey(stat);
- var statValue = this.running[key];
- if (typeof(statValue) === 'number') {
- results.push({
- name: stat,
- scalar: new tr.v.ScalarNumeric(statUnit, statValue)
- });
- }
- }
- }, this);
- return results;
- },
-
- clone: function() {
- return Numeric.fromDict(this.asDict());
- },
-
- asDict: function() {
- var d = {
- unit: this.unit.asJSON(),
- type: 'numeric',
-
- min: this.range.min,
- max: this.range.max,
-
- numNans: this.numNans,
- nanSourceInfos: this.nanSourceInfos,
-
- running: this.running.asDict(),
- summaryOptions: this.summaryOptions,
-
- underflowBin: this.underflowBin.asDict(),
- centralBins: this.centralBins.map(function(bin) {
- return bin.asDict();
- }),
- overflowBin: this.overflowBin.asDict()
- };
- return d;
- },
-
- asJSON: function() {
- return this.asDict();
- }
- };
-
- /**
- * Reusable builder for tr.v.Numeric objects.
- *
- * The bins of the numeric are specified by adding the desired boundaries
- * between bins. Initially, the builder has only a single boundary:
- *
- * minBinBoundary=maxBinBoundary
- * |
- * |
- * -MAX_INT <--------|------------------------------------------> +MAX_INT
- * : resulting : resulting :
- * : underflow : overflow :
- * : bin : bin :
- *
- * More boundaries can be added (in increasing order) using addBinBoundary,
- * addLinearBins and addExponentialBins:
- *
- * minBinBoundary maxBinBoundary
- * | | | | |
- * | | | | |
- * -MAX_INT <--------|---------|---------|-----|---------|------> +MAX_INT
- * : resulting : result. : result. : : result. : resulting :
- * : underflow : central : central : ... : central : overflow :
- * : bin : bin 0 : bin 1 : : bin N-1 : bin :
- *
- * An important feature of the builder is that it's reusable, i.e. it can be
- * used to build multiple numerics with the same unit and bin structure.
- *
- * @constructor
- * @param {!tr.v.Unit} unit Unit of the resulting Numeric(s).
- * @param {number} minBinBoundary The minimum boundary between bins, namely
- * the underflow bin and the first central bin (or the overflow bin if
- * no other boundaries are added later).
- */
- function NumericBuilder(unit, minBinBoundary) {
- this.unit_ = unit;
- this.boundaries_ = [minBinBoundary];
- }
-
- NumericBuilder.prototype = {
- get minBinBoundary() {
- return this.boundaries_[0];
- },
-
- get maxBinBoundary() {
- return this.boundaries_[this.boundaries_.length - 1];
- },
-
- /**
- * Add a bin boundary |nextMaxBinBoundary| to the builder.
- *
- * This operation effectively corresponds to appending a new central bin
- * with the range [this.maxBinBoundary*, nextMaxBinBoundary].
- *
- * @param {number} nextMaxBinBoundary The added bin boundary (must be
- * greater than |this.maxMinBoundary|).
- */
- addBinBoundary: function(nextMaxBinBoundary) {
- if (nextMaxBinBoundary <= this.maxBinBoundary) {
- throw new Error('The added max bin boundary must be larger than ' +
- 'the current max boundary');
- }
- this.boundaries_.push(nextMaxBinBoundary);
-
- return this;
- },
-
- /**
- * Add |binCount| linearly scaled bin boundaries up to |nextMaxBinBoundary|
- * to the builder.
- *
- * This operation corresponds to appending |binCount| central bins of
- * constant range width
- * W = ((|nextMaxBinBoundary| - |this.maxBinBoundary|) / |binCount|)
- * with the following ranges:
- *
- * [|this.maxMinBoundary|, |this.maxMinBoundary| + W]
- * [|this.maxMinBoundary| + W, |this.maxMinBoundary| + 2W]
- * [|this.maxMinBoundary| + 2W, |this.maxMinBoundary| + 3W]
- * ...
- * [|this.maxMinBoundary| + (|binCount| - 2) * W,
- * |this.maxMinBoundary| + (|binCount| - 2) * W]
- * [|this.maxMinBoundary| + (|binCount| - 1) * W,
- * |nextMaxBinBoundary|]
- *
- * @param {number} nextBinBoundary The last added bin boundary (must be
- * greater than |this.maxMinBoundary|).
- * @param {number} binCount Number of bins to be added (must be positive).
- */
- addLinearBins: function(nextMaxBinBoundary, binCount) {
- if (binCount <= 0)
- throw new Error('Bin count must be positive');
-
- var curMaxBinBoundary = this.maxBinBoundary;
- if (curMaxBinBoundary >= nextMaxBinBoundary) {
- throw new Error('The last added max boundary must be greater than ' +
- 'the current max boundary boundary');
- }
-
- var binWidth = (nextMaxBinBoundary - curMaxBinBoundary) / binCount;
- for (var i = 1; i < binCount; i++)
- this.addBinBoundary(curMaxBinBoundary + i * binWidth);
- this.addBinBoundary(nextMaxBinBoundary);
-
- return this;
- },
-
- /**
- * Add |binCount| exponentially scaled bin boundaries up to
- * |nextMaxBinBoundary| to the builder.
- *
- * This operation corresponds to appending |binCount| central bins with
- * a constant difference between the logarithms of their range min and max
- * D = ((ln(|nextMaxBinBoundary|) - ln(|this.maxBinBoundary|)) / |binCount|)
- * with the following ranges:
- *
- * [|this.maxMinBoundary|, |this.maxMinBoundary| * exp(D)]
- * [|this.maxMinBoundary| * exp(D), |this.maxMinBoundary| * exp(2D)]
- * [|this.maxMinBoundary| * exp(2D), |this.maxMinBoundary| * exp(3D)]
- * ...
- * [|this.maxMinBoundary| * exp((|binCount| - 2) * D),
- * |this.maxMinBoundary| * exp((|binCount| - 2) * D)]
- * [|this.maxMinBoundary| * exp((|binCount| - 1) * D),
- * |nextMaxBinBoundary|]
- *
- * This method requires that the current max bin boundary is positive.
- *
- * @param {number} nextBinBoundary The last added bin boundary (must be
- * greater than |this.maxMinBoundary|).
- * @param {number} binCount Number of bins to be added (must be positive).
- */
- addExponentialBins: function(nextMaxBinBoundary, binCount) {
- if (binCount <= 0)
- throw new Error('Bin count must be positive');
-
- var curMaxBinBoundary = this.maxBinBoundary;
- if (curMaxBinBoundary <= 0)
- throw new Error('Current max bin boundary must be positive');
- if (curMaxBinBoundary >= nextMaxBinBoundary) {
- throw new Error('The last added max boundary must be greater than ' +
- 'the current max boundary boundary');
- }
-
- var binExponentWidth =
- Math.log(nextMaxBinBoundary / curMaxBinBoundary) / binCount;
- for (var i = 1; i < binCount; i++) {
- this.addBinBoundary(
- curMaxBinBoundary * Math.exp(i * binExponentWidth));
- }
- this.addBinBoundary(nextMaxBinBoundary);
-
- return this;
- },
-
- /**
- * Build a tr.v.Numeric from the list of bin boundaries.
- *
- * As explained earlier, this method can be called arbitrarily many times
- * to produce arbitrarily many distinct numerics.
- */
- build: function() {
- var binInfo = {
- underflowBin: new NumericBin(undefined,
- Range.fromExplicitRange(-Number.MAX_VALUE, this.minBinBoundary)),
- overflowBin: new NumericBin(undefined,
- Range.fromExplicitRange(this.maxBinBoundary, Number.MAX_VALUE)),
- centralBins: new Array(this.boundaries_.length - 1)
- };
- for (var i = 0; i < this.boundaries_.length - 1; i++) {
- binInfo.centralBins[i] = new NumericBin(undefined,
- Range.fromExplicitRange(
- this.boundaries_[i], this.boundaries_[i + 1]));
- }
-
- var numeric = new Numeric(
- this.unit_,
- Range.fromExplicitRange(this.minBinBoundary, this.maxBinBoundary),
- binInfo);
- numeric.allBins.forEach(function(bin) {
- bin.parentNumeric = numeric;
- });
- return numeric;
- }
- };
-
- /**
- * Create a linearly scaled tr.v.NumericBuilder with |numBins| bins ranging
- * from |range.min| to |range.max|.
- */
- NumericBuilder.createLinear = function(unit, range, numBins) {
- if (range.isEmpty)
- throw new Error('Range must be non-empty');
- return new NumericBuilder(unit, range.min).addLinearBins(
- range.max, numBins);
- };
-
- function ScalarNumeric(unit, value) {
- if (!(typeof(value) == 'number'))
- throw new Error('Expected value to be number');
-
- NumericBase.call(this, unit);
- this.value = value;
- }
-
- ScalarNumeric.prototype = {
- __proto__: NumericBase.prototype,
-
- asDictInto_: function(d) {
- d.type = 'scalar';
-
- // Infinity and NaN are left out of JSON for security reasons that do not
- // apply to our use cases.
- if (this.value === Infinity)
- d.value = 'Infinity';
- else if (this.value === -Infinity)
- d.value = '-Infinity';
- else if (isNaN(this.value))
- d.value = 'NaN';
- else
- d.value = this.value;
- },
-
- toString: function() {
- return this.unit.format(this.value);
- }
- };
-
- ScalarNumeric.fromDict = function(d) {
- // Infinity and NaN are left out of JSON for security reasons that do not
- // apply to our use cases.
- if (typeof(d.value) === 'string') {
- if (d.value === '-Infinity') {
- d.value = -Infinity;
- } else if (d.value === 'Infinity') {
- d.value = Infinity;
- } else if (d.value === 'NaN') {
- d.value = NaN;
- }
- }
-
- return new ScalarNumeric(tr.v.Unit.fromJSON(d.unit), d.value);
- };
-
- return {
- NumericBase: NumericBase,
- NumericBin: NumericBin,
- Numeric: Numeric,
- NumericBuilder: NumericBuilder,
- ScalarNumeric: ScalarNumeric
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/numeric_test.html b/chromium/third_party/catapult/tracing/tracing/value/numeric_test.html
deleted file mode 100644
index ed586ededfb..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/numeric_test.html
+++ /dev/null
@@ -1,420 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
-
- var TEST_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs, tr.b.Range.fromExplicitRange(0, 1000),
- 10);
-
- function checkBuilder(builder, expectedMinBoundary, expectedMaxBoundary,
- expectedUnit, expectedBinRanges) {
- assert.strictEqual(builder.minBinBoundary, expectedMinBoundary);
- assert.strictEqual(builder.maxBinBoundary, expectedMaxBoundary);
-
- // Check that the builder can be used multiple times.
- for (var i = 0; i < 3; i++) {
- var numeric = builder.build();
- assert.instanceOf(numeric, tr.v.Numeric);
- assert.strictEqual(numeric.unit, expectedUnit);
- assert.strictEqual(numeric.numValues, 0);
-
- assert.lengthOf(numeric.allBins, expectedBinRanges.length);
- for (var j = 0; j < expectedBinRanges.length; j++) {
- var bin = numeric.allBins[j];
- assert.instanceOf(bin, tr.v.NumericBin);
- assert.strictEqual(bin.parentNumeric, numeric);
- assert.strictEqual(bin.count, 0);
- assert.isTrue(bin.range.equals(expectedBinRanges[j]));
- }
- }
- }
-
- test('nonUnitThrows', function() {
- assert.throws(function() { new tr.v.NumericBase('foo', -273.15); });
- });
-
- test('nonNumberScalarThrows', function() {
- var unit = tr.v.Unit.byName.sizeInBytes;
- assert.throws(function() { new tr.v.ScalarNumeric(unit, 'foo'); });
- });
-
- test('numericBasic', function() {
- var n = TEST_NUMERIC_BUILDER.build();
- assert.equal(n.getBinForValue(250).range.min, 200);
- assert.equal(n.getBinForValue(250).range.max, 300);
- n.add(-1, 'a');
- n.add(0, 'b');
- n.add(0, 'c');
- n.add(500, 'c');
- n.add(999, 'd');
- n.add(1000, 'd');
- assert.equal(n.underflowBin.count, 1);
-
- assert.equal(n.getBinForValue(0).count, 2);
- assert.deepEqual(n.getBinForValue(0).sourceInfos,
- ['b', 'c']);
-
- assert.equal(n.getBinForValue(500).count, 1);
- assert.equal(n.getBinForValue(999).count, 1);
-
- assert.equal(n.overflowBin.count, 1);
- assert.equal(n.numValues, 6);
- assert.closeTo(n.average, 416.3, 0.1);
- });
-
- test('numericNans', function() {
- var n = TEST_NUMERIC_BUILDER.build();
- n.add(undefined, 'b');
- n.add(NaN, 'c');
-
- assert.equal(n.numNans, 2);
- assert.deepEqual(n.nanSourceInfos, ['b', 'c']);
- });
-
- test('addNumericsValid', function() {
- var n0 = TEST_NUMERIC_BUILDER.build();
- var n1 = TEST_NUMERIC_BUILDER.build();
- n0.add(-1, 'a0');
- n0.add(0, 'b0');
- n0.add(0, 'c0');
- n0.add(500, 'c0');
- n0.add(1000, 'd0');
- n0.add(NaN, 'e0');
-
- n1.add(-1, 'a1');
- n1.add(0, 'b1');
- n1.add(0, 'c1');
- n1.add(999, 'd1');
- n1.add(1000, 'd1');
- n1.add(NaN, 'e1');
-
- n0.addNumeric(n1);
-
- assert.equal(n0.numNans, 2);
- assert.deepEqual(n0.nanSourceInfos, ['e0', 'e1']);
-
- assert.equal(n0.underflowBin.count, 2);
- assert.deepEqual(n0.underflowBin.sourceInfos, ['a0', 'a1']);
-
- assert.equal(n0.getBinForValue(0).count, 4);
- assert.deepEqual(n0.getBinForValue(0).sourceInfos,
- ['b0', 'c0', 'b1', 'c1']);
-
- assert.equal(n0.getBinForValue(500).count, 1);
- assert.deepEqual(n0.getBinForValue(500).sourceInfos, ['c0']);
-
- assert.equal(n0.getBinForValue(999).count, 1);
- assert.deepEqual(n0.getBinForValue(999).sourceInfos, ['d1']);
-
- assert.equal(n0.overflowBin.count, 2);
- assert.deepEqual(n0.overflowBin.sourceInfos, ['d0', 'd1']);
-
- assert.equal(n0.numValues, 10);
- assert.closeTo(n0.average, 349.7, 0.1);
-
- assert.equal(2, n0.maxCount);
- assert.equal(2, n1.maxCount);
- });
-
- test('addNumericsInvalid', function() {
- var n0 = tr.v.NumericBuilder.createLinear(tr.v.Unit.byName.timeDurationInMs,
- tr.b.Range.fromExplicitRange(0, 1000), 10).build();
- var n1 = tr.v.NumericBuilder.createLinear(tr.v.Unit.byName.timeDurationInMs,
- tr.b.Range.fromExplicitRange(0, 1001), 10).build();
- var n2 = tr.v.NumericBuilder.createLinear(tr.v.Unit.byName.timeDurationInMs,
- tr.b.Range.fromExplicitRange(0, 1000), 11).build();
-
- assert.throws(n0.addNumeric.bind(n0, n1), Error);
- assert.throws(n0.addNumeric.bind(n0, n1), Error);
- });
-
- test('getInterpolateCountAt', function() {
- var n = tr.v.Numeric.fromDict({
- unit: 'unitless',
- min: 0,
- max: 100,
- centralBinWidth: 10,
- underflowBin: {min: -Number.MAX_VALUE, max: 0, count: 11},
- centralBins: [
- {min: 0, max: 10, count: 10},
- {min: 10, max: 20, count: 9},
- {min: 20, max: 30, count: 8},
- {min: 30, max: 40, count: 7},
- {min: 40, max: 50, count: 6},
- {min: 50, max: 60, count: 5},
- {min: 60, max: 70, count: 4},
- {min: 70, max: 80, count: 3},
- {min: 80, max: 90, count: 2},
- {min: 90, max: 100, count: 1}
- ],
- overflowBin: {min: 100, max: Number.MAX_VALUE, count: 0}
- });
-
- assert.equal(11, n.maxCount);
- assert.equal(11, n.getInterpolatedCountAt(-1));
- assert.equal(0, n.getInterpolatedCountAt(101));
- assert.closeTo(10.8, n.getInterpolatedCountAt(1), 1e-3);
- assert.closeTo(9.5, n.getInterpolatedCountAt(10), 1e-3);
- assert.closeTo(0.2, n.getInterpolatedCountAt(99), 1e-3);
- });
-
- test('scalarBasic', function() {
- var unit = tr.v.Unit.byName.sizeInBytes;
-
- var d = {
- type: 'scalar',
- unit: unit.asJSON(),
- value: 42
- };
-
- assert.deepEqual(d, tr.v.NumericBase.fromDict(d).asDict());
- });
-
- test('numericPercentile', function() {
- function check(array, min, max, bins, precision) {
- var n = new tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs,
- tr.b.Range.fromExplicitRange(min, max),
- bins).build();
- array.forEach((x) => n.add(x, 'x'));
- [0.25, 0.5, 0.75, 0.8, 0.95, 0.99].forEach(function(percent) {
- var expected = tr.b.Statistics.percentile(array, percent);
- var actual = n.getApproximatePercentile(percent);
- assert.closeTo(expected, actual, precision);
- });
- }
- check([1, 2, 5, 7], 0.5, 10.5, 10, 1e-3);
- check([3, 3, 4, 4], 0.5, 10.5, 10, 1e-3);
- check([1, 10], 0.5, 10.5, 10, 1e-3);
- check([1, 2, 3, 4, 5], 0.5, 10.5, 10, 1e-3);
- check([3, 3, 3, 3, 3], 0.5, 10.5, 10, 1e-3);
- check([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 0.5, 10.5, 10, 1e-3);
- check([1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10], 0.5, 10.5, 10, 1e-3);
- check([0, 11], 0.5, 10.5, 10, 1);
- check([0, 6, 11], 0.5, 10.5, 10, 1);
- var array = [];
- for (var i = 0; i < 1000; i++)
- array.push((i * i) % 10 + 1);
- check(array, 0.5, 10.5, 10, 1e-3);
- // If the real percentile is outside the bin range then the approximation
- // error can be high.
- check([-10000], 0, 10, 10, 10000);
- check([10000], 0, 10, 10, 10000 - 10);
- // The result is no more than the bin width away from the real percentile.
- check([1, 1], 0, 10, 1, 10);
- });
-
- test('numericBuilder_empty', function() {
- var b = new tr.v.NumericBuilder(tr.v.Unit.byName.sizeInBytes, 0);
-
- checkBuilder(b, 0, 0, tr.v.Unit.byName.sizeInBytes, [
- tr.b.Range.fromExplicitRange(-Number.MAX_VALUE, 0),
- tr.b.Range.fromExplicitRange(0, Number.MAX_VALUE)
- ]);
- });
-
- test('numericBuilder_addBinBoundary', function() {
- var b = new tr.v.NumericBuilder(tr.v.Unit.byName.timeDurationInMs, -100);
- b.addBinBoundary(50);
-
- checkBuilder(b, -100, 50, tr.v.Unit.byName.timeDurationInMs, [
- tr.b.Range.fromExplicitRange(-Number.MAX_VALUE, -100),
- tr.b.Range.fromExplicitRange(-100, 50),
- tr.b.Range.fromExplicitRange(50, Number.MAX_VALUE)
- ]);
-
- b.addBinBoundary(60);
- b.addBinBoundary(75);
-
- checkBuilder(b, -100, 75, tr.v.Unit.byName.timeDurationInMs, [
- tr.b.Range.fromExplicitRange(-Number.MAX_VALUE, -100),
- tr.b.Range.fromExplicitRange(-100, 50),
- tr.b.Range.fromExplicitRange(50, 60),
- tr.b.Range.fromExplicitRange(60, 75),
- tr.b.Range.fromExplicitRange(75, Number.MAX_VALUE)
- ]);
- });
-
- test('numericBuilder_addLinearBins', function() {
- var b = new tr.v.NumericBuilder(tr.v.Unit.byName.powerInWatts, 1000);
- b.addLinearBins(1200, 5);
-
- checkBuilder(b, 1000, 1200, tr.v.Unit.byName.powerInWatts, [
- tr.b.Range.fromExplicitRange(-Number.MAX_VALUE, 1000),
- tr.b.Range.fromExplicitRange(1000, 1040),
- tr.b.Range.fromExplicitRange(1040, 1080),
- tr.b.Range.fromExplicitRange(1080, 1120),
- tr.b.Range.fromExplicitRange(1120, 1160),
- tr.b.Range.fromExplicitRange(1160, 1200),
- tr.b.Range.fromExplicitRange(1200, Number.MAX_VALUE)
- ]);
- });
-
- test('numericBuilder_addExponentialBins', function() {
- var b = new tr.v.NumericBuilder(tr.v.Unit.byName.energyInJoules, 0.5);
- b.addExponentialBins(8, 4);
-
- checkBuilder(b, 0.5, 8, tr.v.Unit.byName.energyInJoules, [
- tr.b.Range.fromExplicitRange(-Number.MAX_VALUE, 0.5),
- tr.b.Range.fromExplicitRange(0.5, 1),
- tr.b.Range.fromExplicitRange(1, 2),
- tr.b.Range.fromExplicitRange(2, 4),
- tr.b.Range.fromExplicitRange(4, 8),
- tr.b.Range.fromExplicitRange(8, Number.MAX_VALUE)
- ]);
- });
-
- test('numericBuilder_combined', function() {
- var b = new tr.v.NumericBuilder(tr.v.Unit.byName.unitlessNumber, -273.15);
- b.addBinBoundary(-50);
- b.addLinearBins(4, 3);
- b.addExponentialBins(16, 2);
- b.addLinearBins(17, 4);
- b.addBinBoundary(100);
-
- checkBuilder(b, -273.15, 100, tr.v.Unit.byName.unitlessNumber, [
- tr.b.Range.fromExplicitRange(-Number.MAX_VALUE, -273.15),
- tr.b.Range.fromExplicitRange(-273.15, -50),
- tr.b.Range.fromExplicitRange(-50, -32),
- tr.b.Range.fromExplicitRange(-32, -14),
- tr.b.Range.fromExplicitRange(-14, 4),
- tr.b.Range.fromExplicitRange(4, 8),
- tr.b.Range.fromExplicitRange(8, 16),
- tr.b.Range.fromExplicitRange(16, 16.25),
- tr.b.Range.fromExplicitRange(16.25, 16.5),
- tr.b.Range.fromExplicitRange(16.5, 16.75),
- tr.b.Range.fromExplicitRange(16.75, 17),
- tr.b.Range.fromExplicitRange(17, 100),
- tr.b.Range.fromExplicitRange(100, Number.MAX_VALUE)
- ]);
- });
-
- test('numericBuilder_throws', function() {
- var b0 = new tr.v.NumericBuilder(tr.v.Unit.byName.timeStampInMs, -7);
- assert.throws(function() { b0.addBinBoundary(-10 /* must be > -7 */); });
- assert.throws(function() { b0.addBinBoundary(-7 /* must be > -7 */); });
- assert.throws(function() { b0.addLinearBins(-10 /* must be > -7 */, 10); });
- assert.throws(function() { b0.addLinearBins(-7 /* must be > -7 */, 100); });
- assert.throws(function() { b0.addLinearBins(10, 0 /* must be > 0 */); });
- assert.throws(function() {
- // Current max bin boundary (-7) must be positive.
- b0.addExponentialBins(16, 4);
- });
-
- var b1 = new tr.v.NumericBuilder(tr.v.Unit.byName.sizeInBytes, 8);
- assert.throws(
- function() { b1.addExponentialBins(20, 0 /* must be > 0 */); });
- assert.throws(
- function() { b1.addExponentialBins(5 /* must be > 8 */, 3); });
- assert.throws(
- function() { b1.addExponentialBins(8 /* must be > 8 */, 3); });
- });
-
- test('getSummarizedScalarNumericsWithNames', function() {
- var n = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs, tr.b.Range.fromExplicitRange(0, 100),
- 100).build();
-
- n.add(50);
- n.add(60);
- n.add(70);
-
- n.customizeSummaryOptions({
- count: true,
- min: true,
- max: true,
- sum: true,
- avg: true,
- std: true,
- percentile: [0.5, 1]
- });
-
- var results = n.getSummarizedScalarNumericsWithNames();
- var values = {};
- results.forEach(function(x) {
- values[x.name] = x.scalar;
- });
-
- assert.strictEqual(values.count.value, 3);
- assert.strictEqual(values.min.value, 50);
- assert.strictEqual(values.max.value, 70);
- assert.strictEqual(values.sum.value, 180);
- assert.strictEqual(values.avg.value, 60);
- assert.strictEqual(values.std.value, 10);
- assert.closeTo(values.pct_050.value, 60, 1);
- assert.closeTo(values.pct_100.value, 70, 1);
- });
-
- test('getSummarizedScalarNumericsWithNamesNoSummaryOptions', function() {
- var n = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs, tr.b.Range.fromExplicitRange(0, 100),
- 100).build();
-
- n.add(50);
- n.add(60);
- n.add(70);
-
- n.customizeSummaryOptions({
- count: false,
- min: false,
- max: false,
- sum: false,
- avg: false,
- std: false,
- percentile: []
- });
-
- var results = n.getSummarizedScalarNumericsWithNames('abc');
- assert.strictEqual(results.length, 0);
- });
-
- test('getSummarizedScalarNumericsWithNamesEmptyNumericValue', function() {
- var n = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs, tr.b.Range.fromExplicitRange(0, 100),
- 100).build();
-
- n.customizeSummaryOptions({
- count: true,
- min: true,
- max: true,
- sum: true,
- avg: true,
- std: true,
- percentile: [0, 0.01, 0.1, 0.5, 0.995, 1]
- });
-
- var results = n.getSummarizedScalarNumericsWithNames();
- var values = {};
- results.forEach(function(x) {
- values[x.name] = x.scalar;
- });
-
- assert.strictEqual(values.count.value, 0);
- assert.strictEqual(values.min.value, Infinity);
- assert.strictEqual(values.max.value, -Infinity);
- assert.strictEqual(values.sum.value, 0);
- assert.strictEqual(values.avg, undefined);
- assert.strictEqual(values.std, undefined);
- assert.strictEqual(values.pct_000.value, 0);
- assert.strictEqual(values.pct_001.value, 0);
- assert.strictEqual(values.pct_010.value, 0);
- assert.strictEqual(values.pct_050.value, 0);
- assert.strictEqual(values.pct_099_5.value, 0);
- assert.strictEqual(values.pct_100.value, 0);
- });
-});
-
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/time_display_mode.html b/chromium/third_party/catapult/tracing/tracing/value/time_display_mode.html
deleted file mode 100644
index ae6b4df8cfe..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/time_display_mode.html
+++ /dev/null
@@ -1,54 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/unit_scale.html">
-
-<script>
-'use strict';
-
-/**
- * @fileoverview Time currentDisplayUnit
- */
-tr.exportTo('tr.v', function() {
- var msDisplayMode = {
- scale: 1e-3,
- suffix: 'ms',
- // Compares a < b with adjustments to precision errors.
- roundedLess: function(a, b) {
- return Math.round(a * 1000) < Math.round(b * 1000);
- },
- formatSpec: {
- unit: 's',
- unitPrefix: tr.v.UnitScale.MetricTime.MILLI,
- minimumFractionDigits: 3,
- }
- };
-
- var nsDisplayMode = {
- scale: 1e-9,
- suffix: 'ns',
- // Compares a < b with adjustments to precision errors.
- roundedLess: function(a, b) {
- return Math.round(a * 1000000) < Math.round(b * 1000000);
- },
- formatSpec: {
- unit: 's',
- unitPrefix: tr.v.UnitScale.MetricTime.NANO,
- maximumFractionDigits: 0
- }
- };
-
- var TimeDisplayModes = {
- ns: nsDisplayMode,
- ms: msDisplayMode
- };
-
- return {
- TimeDisplayModes: TimeDisplayModes
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span.html
deleted file mode 100644
index 9f90e35bdb7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span.html
+++ /dev/null
@@ -1,75 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/statistics.html">
-<script>
-'use strict';
-tr.exportTo('tr.v.ui', function() {
- var ArrayOfNumbersSummaryModes = {
- AVERAGE_MODE: 'average-mode',
- TOTAL_MODE: 'total-mode'
- };
- return {
- ArrayOfNumbersSummaryModes: ArrayOfNumbersSummaryModes
- };
-});
-</script>
-<polymer-element name="tr-v-ui-array-of-numbers-span">
- <template>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.numbers_ = undefined;
- this.summaryMode_ = tr.v.ui.ArrayOfNumbersSummaryModes.AVERAGE_MODE;
- },
-
- get summaryMode() {
- return this.summaryMode_;
- },
-
- set summaryMode(summaryMode) {
- this.summaryMode_ = summaryMode;
- this.updateContents_();
- },
-
- get numbers() {
- return this.numbers_;
- },
-
- set numbers(numbers) {
- if (numbers === undefined) {
- this.numbers_ = undefined;
- this.updateContents_();
- return;
- }
- if (!(numbers instanceof Array))
- throw new Error('Must provide an array');
- this.numbers_ = numbers;
- this.updateContents_();
- },
-
- updateContents_: function() {
- if (this.numbers_ === undefined) {
- this.shadowRoot.textContent = '-';
- return;
- }
-
- var ArrayOfNumbersSummaryModes = tr.v.ui.ArrayOfNumbersSummaryModes;
- var value;
- if (this.summaryMode_ === ArrayOfNumbersSummaryModes.AVERAGE_MODE)
- value = tr.b.Statistics.mean(this.numbers_);
- else
- value = tr.b.Statistics.sum(this.numbers_);
-
- var valueRounded = Math.round(value * 1000.0) / 1000.0;
- this.shadowRoot.textContent = valueRounded;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span_test.html
deleted file mode 100644
index 9847276b8d7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/array_of_numbers_span_test.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/value/ui/array_of_numbers_span.html">
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiateInAverageMode', function() {
- var span = document.createElement('tr-v-ui-array-of-numbers-span');
- span.numbers = [1, 2, 3];
- span.summaryMode = tr.v.ui.ArrayOfNumbersSummaryModes.AVERAGE_MODE;
- this.addHTMLOutput(span);
- assert.equal(span.shadowRoot.textContent, '2');
- });
-
- test('instantiateInTotalsMode', function() {
- var span = document.createElement('tr-v-ui-array-of-numbers-span');
- span.numbers = [1, 2, 3];
- span.summaryMode = tr.v.ui.ArrayOfNumbersSummaryModes.TOTALS_MODE;
- this.addHTMLOutput(span);
- assert.equal(span.shadowRoot.textContent, '6');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table.html b/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table.html
deleted file mode 100644
index 107849c0b01..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table.html
+++ /dev/null
@@ -1,90 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/ui/diagnostic_span.html">
-
-<polymer-element name="tr-v-ui-diagnostic-map-table">
- <template>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.titledDiagnosticMaps_ = undefined;
- },
-
- /**
- * The |title| will be used as the heading for the column containing
- * diagnostic-spans for |diagnosticMap|'s Diagnostics.
- *
- * @param {!Array.<!Object>} maps
- * @param {!string} maps[].title
- * @param {!tr.v.d.DiagnosticMap} maps[].diagnosticMap
- */
- set titledDiagnosticMaps(maps) {
- this.titledDiagnosticMaps_ = maps;
- this.updateContent_();
- },
-
- updateContent_: function() {
- if (this.titledDiagnosticMaps_ === undefined ||
- this.titledDiagnosticMaps_.length === 0) {
- this.$.table.tableRows = [];
- this.$.table.tableColumns = [];
- return;
- }
-
- var columns = [{
- title: 'Name',
-
- value: function(row) {
- return row.name;
- },
-
- cmp: function(a, b) {
- return a.name.localeCompare(b.name);
- }
- }];
-
- var rowNames = {};
- var rows = [];
-
- this.titledDiagnosticMaps_.forEach(function(titledMap) {
- var title = titledMap.title;
- var diagnosticMap = titledMap.diagnosticMap;
-
- columns.push({
- title: title,
-
- value: function(row) {
- var diagnostic = diagnosticMap.get(row.name);
- if (diagnostic === undefined)
- return '';
-
- return tr.v.ui.createDiagnosticSpan(diagnostic);
- }
- });
-
- diagnosticMap.forEach(function(name, diagnostic) {
- if (rowNames[name] !== true) {
- rowNames[name] = true;
- rows.push({name: name});
- }
- });
- }, this);
-
- rows.sort(columns[0].cmp);
- this.$.table.tableColumns = columns;
- this.$.table.tableRows = rows;
- this.$.table.rebuild();
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table_test.html
deleted file mode 100644
index 31eafe23413..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_map_table_test.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/diagnostics/diagnostic_map.html">
-<link rel="import" href="/tracing/value/ui/diagnostic_map_table.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var map0 = new tr.v.d.DiagnosticMap();
- map0.add('genericA', new tr.v.d.Generic({a: 0}));
- map0.add('genericB', new tr.v.d.Generic({b: 0}));
- var map1 = new tr.v.d.DiagnosticMap();
- map1.add('genericA', new tr.v.d.Generic({a: 1}));
- map1.add('genericB', new tr.v.d.Generic({b: 1}));
- var table = document.createElement('tr-v-ui-diagnostic-map-table');
- table.titledDiagnosticMaps = [
- {title: 'map0', diagnosticMap: map0},
- {title: 'map1', diagnosticMap: map1},
- ];
- this.addHTMLOutput(table);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_span.html
deleted file mode 100644
index 23940f0c0dd..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/diagnostic_span.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/deep_utils.html">
-<link rel="import" href="/tracing/ui/base/polymer_utils.html">
-<link rel="import" href="/tracing/value/diagnostics/diagnostic.html">
-<link rel="import" href="/tracing/value/ui/generic_diagnostic_span.html">
-<link rel="import" href="/tracing/value/ui/iteration_info_span.html">
-<link rel="import" href="/tracing/value/ui/related_event_set_span.html">
-<link rel="import" href="/tracing/value/ui/related_value_map_span.html">
-<link rel="import" href="/tracing/value/ui/related_value_set_span.html">
-
-<script>
-'use strict';
-tr.exportTo('tr.v.ui', function() {
- /**
- * Find the name of a polymer element registered to display |diagnostic|
- * or one of its base classes.
- *
- * @param {!tr.v.d.Diagnostic} diagnostic
- * @return {string}
- */
- function findElementNameForDiagnostic(diagnostic) {
- var typeInfo = undefined;
- var curProto = diagnostic.constructor.prototype;
- while (curProto) {
- typeInfo = tr.v.d.Diagnostic.findTypeInfo(curProto.constructor);
- if (typeInfo && typeInfo.metadata.elementName)
- break;
- typeInfo = undefined;
- curProto = curProto.__proto__;
- }
-
- if (typeInfo === undefined) {
- throw new Error(
- diagnostic.constructor.name +
- ' or a base class must have a registered elementName');
- }
-
- var tagName = typeInfo.metadata.elementName;
-
- if (!tr.ui.b.getPolymerElementNamed(tagName))
- throw new Error('Element not registered: ' + tagName);
-
- return tagName;
- }
-
- /**
- * Create a visualization for |diagnostic|.
- *
- * @param {!tr.v.d.Diagnostic} diagnostic
- * @return {Element}
- */
- function createDiagnosticSpan(diagnostic) {
- var tagName = findElementNameForDiagnostic(diagnostic);
- var span = document.createElement(tagName);
- span.diagnostic = diagnostic;
- return span;
- }
-
- return {
- createDiagnosticSpan: createDiagnosticSpan
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span.html
deleted file mode 100644
index 502cf020362..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span.html
+++ /dev/null
@@ -1,41 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-
-<polymer-element name="tr-v-ui-generic-diagnostic-span">
- <template>
- <tr-ui-a-generic-object-view id="generic"></tr-ui-a-generic-object-view>
- </template>
-
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.diagnostic_ = undefined;
- },
-
- get diagnostic() {
- return this.diagnostic_;
- },
-
- set diagnostic(d) {
- this.diagnostic_ = d;
- this.updateContents_();
- },
-
- updateContents_: function() {
- if (this.diagnostic === undefined) {
- this.$.generic.object = undefined;
- return;
- }
-
- this.$.generic.object = this.diagnostic.value;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span_test.html
deleted file mode 100644
index d6b8727381f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_diagnostic_span_test.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/diagnostics/generic.html">
-<link rel="import" href="/tracing/value/ui/diagnostic_span.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var diagnostic = new tr.v.d.Generic({foo: 'bar', baz: [42]});
- var span = tr.v.ui.createDiagnosticSpan(diagnostic);
- assert.strictEqual('TR-V-UI-GENERIC-DIAGNOSTIC-SPAN', span.tagName);
- this.addHTMLOutput(span);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view.html b/chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view.html
deleted file mode 100644
index f9becaee0e4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view.html
+++ /dev/null
@@ -1,299 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/ui/analysis/generic_object_view.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/generic_table.html">
-<link rel="import" href="/tracing/value/ui/array_of_numbers_span.html">
-
-<polymer-element name="tr-v-ui-generic-table-view">
- <template>
- <style>
- :host {
- display: flex;
- }
- #table {
- flex: 1 1 auto;
- align-self: stretch;
- }
- </style>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </template>
-</polymer-element>
-
-<script>
-'use strict';
-
-tr.exportTo('tr.v.ui', function() {
- var TEXT_COLUMN_MODE = 1;
- var NUMERIC_COLUMN_MODE = 2;
- var ELEMENT_COLUMN_MODE = 3;
-
- function isNumeric(value) {
- // TODO(nduca): Also consider other units that are numeric.
- if ((typeof value) === 'number')
- return true;
- else if (value instanceof Number)
- return true;
- return false;
- }
-
- function GenericTableViewTotalsItem(opt_values) {
- if (opt_values !== undefined)
- this.values = opt_values;
- else
- this.values = [];
- }
-
- function GenericTableViewColumnDescriptor(fieldName, firstFieldValue) {
- this.title = fieldName;
- this.fieldName = fieldName;
-
- this.updateModeGivenValue(firstFieldValue);
- }
-
- GenericTableViewColumnDescriptor.prototype = {
- get columnMode() {
- return this.columnMode_;
- },
-
- get isInNumericMode() {
- return this.columnMode_ === NUMERIC_COLUMN_MODE;
- },
-
- cmp: function(a, b) {
- if (this.columnMode_ === ELEMENT_COLUMN_MODE)
- return 0;
-
- return tr.b.comparePossiblyUndefinedValues(a, b, function(a, b) {
- var vA = a[this.fieldName];
- var vB = b[this.fieldName];
- return tr.b.comparePossiblyUndefinedValues(vA, vB, function(vA, vB) {
- if (vA.localeCompare)
- return vA.localeCompare(vB);
- return vA - vB;
- }, this);
- }, this);
- },
-
- updateModeGivenValue: function(fieldValue) {
- if (this.columnMode_ === undefined) {
- if (fieldValue === undefined || fieldValue === null)
- return;
-
- if (isNumeric(fieldValue)) {
- this.columnMode_ = NUMERIC_COLUMN_MODE;
- return;
- }
-
- if (fieldValue instanceof HTMLElement) {
- this.columnMode_ = ELEMENT_COLUMN_MODE;
- return;
- }
-
- this.columnMode_ = TEXT_COLUMN_MODE;
- return;
- }
-
- // Undefineds & nulls shouldn't change the mode.
- if (fieldValue === undefined || fieldValue === null)
- return;
-
- // If we were already in numeric mode, then we don't
- // need to put it into numeric mode again. And, if we were
- // previously in text mode, then we can't go into numeric mode now.
- if (isNumeric(fieldValue))
- return;
-
- if (fieldValue instanceof HTMLElement) {
- this.columnMode_ = ELEMENT_COLUMN_MODE;
- return;
- }
-
- if (this.columnMode_ === NUMERIC_COLUMN_MODE)
- this.columnMode_ = TEXT_COLUMN_MODE;
- },
-
- value: function(item) {
- var fieldValue = item[this.fieldName];
- if (fieldValue instanceof GenericTableViewTotalsItem) {
- var span = document.createElement('tr-v-ui-array-of-numbers-span');
- span.summaryMode = tr.v.ui.ArrayOfNumbersSummaryModes.TOTAL_MODE;
- span.numbers = fieldValue.values;
- return span;
- }
-
- if (fieldValue === undefined)
- return '-';
-
- if (fieldValue instanceof HTMLElement)
- return fieldValue;
-
- if (fieldValue instanceof Object) {
- var gov = document.createElement('tr-ui-a-generic-object-view');
- gov.object = fieldValue;
- return gov;
- }
-
- // TODO(nduca): Use units objects if applicable.
- return fieldValue;
- }
- };
-
- Polymer('tr-v-ui-generic-table-view', {
- created: function() {
- this.items_ = undefined;
- this.importantColumNames_ = [];
- },
-
- get items() {
- return this.items_;
- },
-
- set items(itemsOrGenericTable) {
- if (itemsOrGenericTable === undefined) {
- this.items_ = undefined;
- } else if (itemsOrGenericTable instanceof Array) {
- this.items_ = itemsOrGenericTable;
- } else if (itemsOrGenericTable instanceof tr.v.GenericTable) {
- this.items_ = itemsOrGenericTable.items;
- }
- this.updateContents_();
- },
-
- get importantColumNames() {
- return this.importantColumNames_;
- },
-
- set importantColumNames(importantColumNames) {
- this.importantColumNames_ = importantColumNames;
- this.updateContents_();
- },
-
- createColumns_: function() {
- var columnsByName = {};
- this.items_.forEach(function(item) {
- tr.b.iterItems(item, function(itemFieldName, itemFieldValue) {
- var colDesc = columnsByName[itemFieldName];
- if (colDesc !== undefined) {
- colDesc.updateModeGivenValue(itemFieldValue);
- return;
- }
-
- colDesc = new GenericTableViewColumnDescriptor(
- itemFieldName, itemFieldValue);
- columnsByName[itemFieldName] = colDesc;
- }, this);
- }, this);
-
- var columns = tr.b.dictionaryValues(columnsByName);
- if (columns.length === 0)
- return undefined;
-
- // Sort by name.
- var isColumnNameImportant = {};
- var importantColumNames = this.importantColumNames || [];
- importantColumNames.forEach(function(icn) {
- isColumnNameImportant[icn] = true;
- });
- columns.sort(function(a, b) {
- var iA = isColumnNameImportant[a.title] ? 1 : 0;
- var iB = isColumnNameImportant[b.title] ? 1 : 0;
- if ((iB - iA) !== 0)
- return iB - iA;
- return a.title.localeCompare(b.title);
- });
-
- // Set sizes. This is convoluted by the fact that the first
- // table column must have fixed size.
- var colWidthPercentage;
- if (columns.length == 1)
- colWidthPercentage = '100%';
- else
- colWidthPercentage = (100 / (columns.length - 1)).toFixed(3) + '%';
- columns[0].width = '250px';
- for (var i = 1; i < columns.length; i++)
- columns[i].width = colWidthPercentage;
-
- return columns;
- },
-
- createFooterRowsIfNeeded_: function(columns) {
- // Make totals row if needed.
- var hasColumnThatIsNumeric = columns.some(function(column) {
- return column.isInNumericMode;
- });
- if (!hasColumnThatIsNumeric)
- return [];
-
- var totalsItems = {};
- columns.forEach(function(column) {
- if (!column.isInNumericMode)
- return;
- var totalsItem = new GenericTableViewTotalsItem();
- this.items_.forEach(function(item) {
- var fieldValue = item[column.fieldName];
- if (fieldValue === undefined || fieldValue === null)
- return;
- totalsItem.values.push(fieldValue);
- });
- totalsItems[column.fieldName] = totalsItem;
- }, this);
-
- return [totalsItems];
- },
-
- updateContents_: function() {
- var columns;
- if (this.items_ !== undefined)
- columns = this.createColumns_();
-
- if (!columns) {
- this.$.table.tableColumns = [];
- this.$.table.tableRows = [];
- this.$.table.footerRows = [];
- return;
- }
-
- this.$.table.tableColumns = columns;
- this.$.table.tableRows = this.items_;
- this.$.table.footerRows = this.createFooterRowsIfNeeded_(columns);
- this.$.table.rebuild();
- },
-
- get selectionMode() {
- return this.$.table.selectionMode;
- },
-
- set selectionMode(selectionMode) {
- this.$.table.selectionMode = selectionMode;
- },
-
- get rowHighlightStyle() {
- return this.$.table.rowHighlightStyle;
- },
-
- set rowHighlightStyle(rowHighlightStyle) {
- this.$.table.rowHighlightStyle = rowHighlightStyle;
- },
-
- get cellHighlightStyle() {
- return this.$.table.cellHighlightStyle;
- },
-
- set cellHighlightStyle(cellHighlightStyle) {
- this.$.table.cellHighlightStyle = cellHighlightStyle;
- }
- });
-
- return {
- GenericTableViewTotalsItem: GenericTableViewTotalsItem,
- GenericTableViewColumnDescriptor: GenericTableViewColumnDescriptor
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view_test.html
deleted file mode 100644
index 85bfe45f2c7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/generic_table_view_test.html
+++ /dev/null
@@ -1,199 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2014 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/generic_table.html">
-<link rel="import" href="/tracing/value/ui/generic_table_view.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var GenericTableViewColumnDescriptor =
- tr.v.ui.GenericTableViewColumnDescriptor;
- var GenericTableViewTotalsItem = tr.v.ui.GenericTableViewTotalsItem;
-
- test('descBasicNumericMode', function() {
- var colDesc = new GenericTableViewColumnDescriptor('a');
- assert.isFalse(colDesc.isInNumericMode);
-
- colDesc.updateModeGivenValue(4);
- assert.isTrue(colDesc.isInNumericMode);
-
- colDesc.updateModeGivenValue(4);
- assert.isTrue(colDesc.isInNumericMode);
-
- colDesc.updateModeGivenValue(undefined);
- colDesc.updateModeGivenValue(null);
- assert.isTrue(colDesc.isInNumericMode);
-
- colDesc.updateModeGivenValue('a');
- assert.isFalse(colDesc.isInNumericMode);
- });
-
- test('descBasicNonNumericMode', function() {
- var colDesc = new GenericTableViewColumnDescriptor('a');
- assert.isFalse(colDesc.isInNumericMode);
- colDesc.updateModeGivenValue(4);
- assert.isTrue(colDesc.isInNumericMode);
- colDesc.updateModeGivenValue('a');
- assert.isFalse(colDesc.isInNumericMode);
- });
-
- test('descCmpWithNumbers', function() {
- var colDesc = new GenericTableViewColumnDescriptor('a', 1);
- assert.equal(colDesc.cmp({a: 1}, {a: 2}), -1);
- assert.equal(colDesc.cmp({a: 1}, undefined), -1);
- });
-
- test('descCmpWithText', function() {
- var colDesc = new GenericTableViewColumnDescriptor('a', 'text');
- assert.equal(colDesc.cmp({a: 'a'}, {a: 'b'}), -1);
- assert.equal(colDesc.cmp({a: 'a'}, undefined), -1);
- });
-
- test('descValue', function() {
- var colDesc = new GenericTableViewColumnDescriptor('a', 1);
- var value = colDesc.value({a: undefined});
- assert.equal(value, '-');
-
- value = colDesc.value({a: 3});
- assert.equal(value, 3);
-
- var totalsValue = colDesc.value(
- {a: new GenericTableViewTotalsItem([1, 2, 3])});
- assert.equal(totalsValue.tagName.toLowerCase(),
- 'tr-v-ui-array-of-numbers-span');
- assert.deepEqual(totalsValue.numbers, [1, 2, 3]);
- });
-
- test('everythingTogether', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = [
- {
- a: 'someString',
- b: 2,
- c: 'adsf'
- },
- {
- a: 'someOtherString',
- b: 2,
- c: 'adsf'
- }
- ];
- this.addHTMLOutput(table);
- });
-
- test('summableColumn', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = [
- {
- a: 1
- },
- {
- a: 2
- },
- {
- a: 3
- }
- ];
- this.addHTMLOutput(table);
-
- assert.equal(table.$.table.tableColumns.length, 1);
- assert.equal(table.$.table.tableRows.length, 3);
- assert.isTrue(table.$.table.tableColumns[0].isInNumericMode);
- assert.equal(table.$.table.tableColumns[0].fieldName, 'a');
- var totalsItem = table.$.table.footerRows[0].a;
- assert.deepEqual(totalsItem.values, [1, 2, 3]);
- });
-
-
- test('usingGenericTable', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = new tr.v.GenericTable([
- {
- a: 1
- }
- ]);
- assert.equal(table.items.length, 1);
- });
-
- test('valueIsObject', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = new tr.v.GenericTable([
- {
- a: {x: 1, y: 'string'}
- },
- {
- a: 'something'
- }
- ]);
- this.addHTMLOutput(table);
- assert.equal(table.items.length, 2);
- });
-
- test('mixedTypeTable', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = [
- {
- a: 1
- },
- {
- a: 2
- },
- {
- b: 'c'
- }
- ];
- this.addHTMLOutput(table);
- });
-
- test('tableWithElement', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = [
- {
- a: 1
- },
- {
- a: tr.ui.b.createSpan({textContent: 'ohai'})
- },
- {
- b: 'c'
- }
- ];
- this.addHTMLOutput(table);
- });
-
-
- test('emptyTable', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = [{}];
- assert.equal(table.$.table.tableColumns.length, 0);
- });
-
- test('undefinedAndValue', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = [
- {
- },
- {
- a: 2
- }
- ];
- this.addHTMLOutput(table);
- });
-
- test('undefinedOnly', function() {
- var table = document.createElement('tr-v-ui-generic-table-view');
- table.items = [
- {
- a: undefined
- }
- ];
- this.addHTMLOutput(table);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span.html
deleted file mode 100644
index 2bc489865c7..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span.html
+++ /dev/null
@@ -1,192 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/statistics.html">
-<link rel="import" href="/tracing/ui/base/bar_chart.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-
-<polymer-element name="tr-v-ui-histogram-span">
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
-
- #stats {
- display: flex;
- flex-direction: row;
- flex: 0 0 auto;
- font-weight: bold;
- }
-
- #nnans {
- color: red;
- }
- #table {
- flex: 1 1 auto;
- }
- </style>
- <div id="stats">
- <span id="nsamples"></span>&nbsp;samples,&nbsp;
- <span id="hadnans"><span id="nnans"></span> non-numeric samples,&nbsp;
- </span>
- average=<tr-v-ui-scalar-span id="average"></tr-v-ui-scalar-span>
- </div>
- <div id="container"></div>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- created: function() {
- this.histogram_ = undefined;
- this.chart_ = new tr.ui.b.BarChart();
- this.chart_.width = 400;
- this.chart_.height = 200;
- this.mouseDownBin_ = undefined;
- this.brushedBins_ = [];
- this.chart_.addEventListener('item-mousedown',
- this.onMouseDown_.bind(this));
- this.chart_.addEventListener('item-mousemove',
- this.onMouseMove_.bind(this));
- this.chart_.addEventListener('item-mouseup',
- this.onMouseUp_.bind(this));
- },
-
- ready: function() {
- this.$.container.appendChild(this.chart_);
- },
-
- get brushedBins() {
- return this.brushedBins_;
- },
-
- updateBrushedRange_: function(currentX) {
- this.brushedBins_ = [this.histogram_.getBinForValue(currentX)];
- var r = new tr.b.Range();
- r.addValue(this.mouseDownX_);
- r.addValue(currentX);
-
- // Collect bins:
- var centralMin = Number.MAX_VALUE;
- var centralMax = -Number.MAX_VALUE;
- this.histogram_.centralBins.forEach(function(bin) {
- centralMin = Math.min(centralMin, bin.range.min);
- centralMax = Math.max(centralMax, bin.range.max);
- if ((bin.range.max > r.min) &&
- (bin.range.min < r.max) &&
- (this.brushedBins_.indexOf(bin) < 0))
- this.brushedBins_.push(bin);
- }, this);
- if ((this.histogram_.underflowBin.max > r.min) &&
- (this.brushedBins_.indexOf(this.histogram_.underflowBin) < 0)) {
- this.brushedBins_.push(this.histogram_.underflowBin);
- }
- if ((this.histogram_.overflowBin.min < r.max) &&
- (this.brushedBins_.indexOf(this.histogram_.overflowBin) < 0)) {
- this.brushedBins_.push(this.histogram_.overflowBin);
- }
- this.brushedBins_.sort(function(a, b) {
- return a.range.min - b.range.min;
- });
-
- // Prevent Infinity:
- var minBin = this.histogram_.getBinForValue(r.min);
- var maxBin = this.histogram_.getBinForValue(r.max);
- var binWidth = this.histogram_.centralBins[0].range.range;
- r.min = minBin ? Math.max(centralMin - binWidth, minBin.range.min) :
- centralMin - binWidth;
- r.max = maxBin ? Math.min(centralMax + binWidth, maxBin.range.max) :
- centralMax + binWidth;
-
- this.chart_.brushedRange = r;
-
- this.dispatchEvent(new tr.b.Event('brushed-bins-changed'));
- },
-
- onMouseDown_: function(chartEvent) {
- chartEvent.stopPropagation();
- if (!this.histogram_)
- return;
- this.mouseDownX_ = chartEvent.x;
- this.updateBrushedRange_(chartEvent.x);
- },
-
- onMouseMove_: function(chartEvent) {
- chartEvent.stopPropagation();
- if (!this.histogram_)
- return;
- this.updateBrushedRange_(chartEvent.x);
- },
-
- onMouseUp_: function(chartEvent) {
- chartEvent.stopPropagation();
- if (!this.histogram_)
- return;
- this.updateBrushedRange_(chartEvent.x);
- this.mouseDownX_ = undefined;
- },
-
- get histogram() {
- return this.histogram_;
- },
-
- set histogram(histogram) {
- this.histogram_ = histogram;
- this.updateContents_();
- },
-
- set isYLogScale(logScale) {
- this.chart_.isYLogScale = logScale;
- },
-
- updateContents_: function() {
- this.$.container.style.display = this.histogram_ ? '' : 'none';
- if (!this.histogram_) {
- this.$.nsamples.textContent = 0;
- this.$.average.setValueAndUnit(undefined, undefined);
- return;
- }
-
- this.$.nsamples.textContent = this.histogram_.numValues;
- this.$.average.setValueAndUnit(this.histogram_.average,
- this.histogram_.unit);
- if (this.histogram_.numNans > 0) {
- this.$.hadnans.style.display = '';
- this.$.nnans.textContent = this.histogram_.numNans;
- } else {
- this.$.hadnans.style.display = 'none';
- }
-
- var maximumBinValue = tr.b.Statistics.max(this.histogram_.allBins,
- function(bin) {
- return bin.count;
- });
- var chartData = [];
- var binWidth = this.histogram_.centralBins[0].range.range;
- this.histogram_.allBins.forEach(function(bin) {
- var x = bin.range.min;
- if (x === -Number.MAX_VALUE) {
- if (!bin.count)
- return;
- x = bin.range.max - binWidth;
- }
- chartData.push({x: x,
- y: bin.count});
- });
- chartData.sort(function(x, y) {
- return x.x - y.x;
- });
- this.$.container.style.display = chartData.length ? '' : 'none';
- this.chart_.data = chartData;
- this.brushedBins_ = [];
- this.chart_.brushedRange = new tr.b.Range();
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span_test.html
deleted file mode 100644
index ad550b714f9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/histogram_span_test.html
+++ /dev/null
@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/histogram.html">
-<link rel="import" href="/tracing/value/ui/histogram_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var DURATION_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs, tr.b.Range.fromExplicitRange(0, 1000),
- 10);
-
- test('basic', function() {
- var h = DURATION_NUMERIC_BUILDER.build();
- h.add(-1, 'a');
- h.add(0, 'b');
- h.add(0, 'b');
- h.add(0, 'b');
- h.add(0, 'b');
- h.add(0, 'b');
- h.add(0, 'b');
- h.add(0, 'c');
- h.add(500, 'c');
- h.add(999, 'd');
- h.add(1000, 'd');
-
- var span = document.createElement('tr-v-ui-histogram-span');
- span.histogram = h;
- this.addHTMLOutput(span);
- });
-
- test('undefined', function() {
- var span = document.createElement('tr-v-ui-histogram-span');
- span.histogram = undefined;
- this.addHTMLOutput(span);
- });
-
- test('emptyHistogram', function() {
- var h = DURATION_NUMERIC_BUILDER.build();
-
- var span = document.createElement('tr-v-ui-histogram-span');
- span.histogram = h;
- this.addHTMLOutput(span);
- });
-
- test('nans', function() {
- var h = DURATION_NUMERIC_BUILDER.build();
- h.add(undefined, 'b');
- h.add(NaN, 'c');
-
- var span = document.createElement('tr-v-ui-histogram-span');
- span.histogram = h;
- this.addHTMLOutput(span);
- });
-
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/iteration_info_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/iteration_info_span.html
deleted file mode 100644
index c8799005dc2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/iteration_info_span.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/table.html">
-
-<polymer-element name="tr-v-ui-iteration-info-span">
- <template>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </template>
-
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.diagnostic_ = undefined;
- this.$.table.showHeader = false;
- this.$.table.tableColumns = [
- {
- value: function(row) {
- return row[0];
- },
- },
- {
- value: function(row) {
- return row[1];
- }
- }
- ];
- },
-
- get diagnostic() {
- return this.diagnostic_;
- },
-
- set diagnostic(d) {
- this.diagnostic_ = d;
- this.updateContents_();
- },
-
- updateContents_: function() {
- if (this.diagnostic === undefined) {
- this.$.table.tableRows = [];
- return;
- }
-
- var rows = [
- ['benchmark name', this.diagnostic.benchmarkName],
- ['benchmark start', this.diagnostic.benchmarkStart],
- ['url', this.diagnostic.storyUrl],
- ['story', this.diagnostic.storyDisplayName],
- ['storyset repeat', this.diagnostic.storysetRepeatCounter],
- ['story repeat', this.diagnostic.storyRepeatCounter],
- ];
-
- if (this.diagnostic.label)
- rows.push(['label', this.diagnostic.label]);
-
- if (Object.keys(this.diagnostic.storyGroupingKeys).length > 0) {
- var gov = document.createElement('tr-ui-a-generic-object-view');
- gov.object = this.diagnostic.storyGroupingKeys;
- rows.push(['grouping keys', gov]);
- }
-
- rows.sort((x, y) => x[0].localeCompare(y[0]));
- this.$.table.tableRows = rows;
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit.html b/chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit.html
deleted file mode 100644
index 7e5a94efad1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name="tr-v-ui-preferred-display-unit">
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.preferredTimeDisplayMode_ = undefined;
- },
-
- attached: function() {
- tr.v.Unit.didPreferredTimeDisplayUnitChange();
- },
-
- detached: function() {
- tr.v.Unit.didPreferredTimeDisplayUnitChange();
- },
-
- // null means no-preference
- get preferredTimeDisplayMode() {
- return this.preferredTimeDisplayMode_;
- },
-
- set preferredTimeDisplayMode(v) {
- if (this.preferredTimeDisplayMode_ === v)
- return;
- this.preferredTimeDisplayMode_ = v;
- tr.v.Unit.didPreferredTimeDisplayUnitChange();
- }
-
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit_test.html
deleted file mode 100644
index 742783fc17a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/preferred_display_unit_test.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/time_display_mode.html">
-<link rel="import" href="/tracing/value/ui/preferred_display_unit.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate', function() {
- var unit = document.createElement('tr-v-ui-preferred-display-unit');
- var ms = tr.v.TimeDisplayModes.ms;
- unit.preferredDisplayUnit = ms;
- assert.equal(unit.preferredDisplayUnit, ms);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span.html
deleted file mode 100644
index 349547f3b85..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
-
-<polymer-element name="tr-v-ui-related-event-set-span">
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.diagnostic_ = undefined;
- },
-
- get diagnostic() {
- return this.diagnostic_;
- },
-
- set diagnostic(d) {
- this.diagnostic_ = d;
- this.updateContents_();
- },
-
- updateContents_: function() {
- this.textContent = '';
- var events = this.diagnostic.events;
- var link = document.createElement('tr-ui-a-analysis-link');
- var label = (events.length === 1) ? 'event' : 'events';
- link.setSelectionAndContent(events, events.length + ' ' + label);
- this.appendChild(link);
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span_test.html
deleted file mode 100644
index 97adc4d708c..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/related_event_set_span_test.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/core/test_utils.html">
-<link rel="import" href="/tracing/value/diagnostics/related_event_set.html">
-<link rel="import" href="/tracing/value/ui/diagnostic_span.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate_RelatedEventSet0', function() {
- var diagnostic = new tr.v.d.RelatedEventSet();
- var span = tr.v.ui.createDiagnosticSpan(diagnostic);
- assert.strictEqual('TR-V-UI-RELATED-EVENT-SET-SPAN', span.tagName);
- this.addHTMLOutput(span);
- assert.strictEqual('0 events', span.textContent);
- });
-
- test('instantiate_RelatedEventSet1', function() {
- var diagnostic = new tr.v.d.RelatedEventSet();
- tr.c.TestUtils.newModel(function(model) {
- var proc = model.getOrCreateProcess(1);
- var thread = proc.getOrCreateThread(2);
- var event = tr.c.TestUtils.newSliceEx({start: 0, duration: 1});
- thread.sliceGroup.pushSlice(event);
- diagnostic.push(event);
- });
- var span = tr.v.ui.createDiagnosticSpan(diagnostic);
- assert.strictEqual('TR-V-UI-RELATED-EVENT-SET-SPAN', span.tagName);
- this.addHTMLOutput(span);
- assert.strictEqual('1 event', span.textContent);
- });
-
- test('instantiate_RelatedEventSet2', function() {
- var diagnostic = new tr.v.d.RelatedEventSet();
- tr.c.TestUtils.newModel(function(model) {
- var proc = model.getOrCreateProcess(1);
- var thread = proc.getOrCreateThread(2);
- var event = tr.c.TestUtils.newSliceEx({start: 0, duration: 1});
- thread.sliceGroup.pushSlice(event);
- diagnostic.push(event);
- event = tr.c.TestUtils.newSliceEx({start: 1, duration: 1});
- thread.sliceGroup.pushSlice(event);
- diagnostic.push(event);
- });
- var span = tr.v.ui.createDiagnosticSpan(diagnostic);
- assert.strictEqual('TR-V-UI-RELATED-EVENT-SET-SPAN', span.tagName);
- this.addHTMLOutput(span);
- assert.strictEqual('2 events', span.textContent);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span.html
deleted file mode 100644
index c691c128c07..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
-
-<polymer-element name="tr-v-ui-related-value-map-span">
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.diagnostic_ = undefined;
- },
-
- get diagnostic() {
- return this.diagnostic_;
- },
-
- set diagnostic(d) {
- this.diagnostic_ = d;
- this.updateContents_();
- },
-
- updateContents_: function() {
- this.textContent = '';
- this.diagnostic.iterItems(function(name, value) {
- var link = document.createElement('tr-ui-a-analysis-link');
- link.setSelectionAndContent(value, name);
- this.appendChild(link);
- this.appendChild(document.createElement('br'));
- }, this);
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span_test.html
deleted file mode 100644
index c63ae6f1134..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_map_span_test.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/diagnostics/related_value_map.html">
-<link rel="import" href="/tracing/value/ui/diagnostic_span.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate_RelatedValueMap', function() {
- var aValue = new tr.v.SkipValue('a');
- var bValue = new tr.v.SkipValue('b');
- var diagnostic = new tr.v.d.RelatedValueMap();
- diagnostic.set('foo', aValue);
- diagnostic.set('bar', bValue);
- var span = tr.v.ui.createDiagnosticSpan(diagnostic);
- assert.strictEqual('TR-V-UI-RELATED-VALUE-MAP-SPAN', span.tagName);
- this.addHTMLOutput(span);
- assert.isDefined(tr.b.findDeepElementMatchingPredicate(
- span, function(element) {
- return element.textContent === 'foo';
- }));
- assert.isDefined(tr.b.findDeepElementMatchingPredicate(
- span, function(element) {
- return element.textContent === 'bar';
- }));
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span.html
deleted file mode 100644
index 2edffb9df05..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/analysis/analysis_link.html">
-
-<polymer-element name="tr-v-ui-related-value-set-span">
- <script>
- 'use strict';
- Polymer({
- ready: function() {
- this.diagnostic_ = undefined;
- },
-
- get diagnostic() {
- return this.diagnostic_;
- },
-
- set diagnostic(d) {
- this.diagnostic_ = d;
- this.updateContents_();
- },
-
- updateContents_: function() {
- this.textContent = '';
- this.diagnostic.values.forEach(function(value) {
- var link = document.createElement('tr-ui-a-analysis-link');
- link.setSelectionAndContent(value, value.name);
- this.appendChild(link);
- this.appendChild(document.createElement('br'));
- }, this);
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span_test.html
deleted file mode 100644
index 222dee57af6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/related_value_set_span_test.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/diagnostics/composition.html">
-<link rel="import" href="/tracing/value/diagnostics/related_value_set.html">
-<link rel="import" href="/tracing/value/ui/diagnostic_span.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('instantiate_RelatedValueSet', function() {
- var aValue = new tr.v.SkipValue('a');
- var bValue = new tr.v.SkipValue('b');
- var diagnostic = new tr.v.d.RelatedValueSet([aValue, bValue]);
- var span = tr.v.ui.createDiagnosticSpan(diagnostic);
- assert.strictEqual('TR-V-UI-RELATED-VALUE-SET-SPAN', span.tagName);
- this.addHTMLOutput(span);
- });
-
- test('instantiate_Composition', function() {
- var aValue = new tr.v.SkipValue('a');
- var bValue = new tr.v.SkipValue('b');
- var diagnostic = new tr.v.d.Composition([aValue, bValue]);
- var span = tr.v.ui.createDiagnosticSpan(diagnostic);
- assert.strictEqual('TR-V-UI-RELATED-VALUE-SET-SPAN', span.tagName);
- this.addHTMLOutput(span);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span.html b/chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span.html
deleted file mode 100644
index 7588ee50d48..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span.html
+++ /dev/null
@@ -1,263 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/deep_utils.html">
-<link rel="import" href="/tracing/ui/base/polymer_utils.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<script>
-'use strict';
-tr.exportTo('tr.v.ui', function() {
- /**
- * @param {undefined|tr.v.NumericValue|tr.v.Numeric} value
- * @param {Object=} opt_config
- * @return {string|Element}
- */
- function createScalarSpan(value, opt_config) {
- if (value === undefined)
- return '';
-
- var config = opt_config || {};
- var ownerDocument = config.ownerDocument || document;
-
- var span = ownerDocument.createElement('tr-v-ui-scalar-span');
-
- if (value instanceof tr.v.NumericValue) {
- value = value.numeric;
- config.unit = value.unit;
- }
-
- var numericValue;
- if (value instanceof tr.v.ScalarNumeric) {
- span.value = value;
- numericValue = value.value;
- } else if (value instanceof tr.v.Numeric) {
- numericValue = value.average;
- span.setValueAndUnit(numericValue, value.unit);
- } else {
- var unit = config.unit;
- if (unit === undefined) {
- throw new Error(
- 'Unit must be provided in config when value is a number');
- }
- span.setValueAndUnit(value, unit);
- numericValue = value;
- }
-
- if (config.context)
- span.context = config.context;
-
- if (config.total)
- span.percentage = numericValue / config.total;
-
- if (config.rightAlign)
- span.rightAlign = true;
-
- return span;
- }
-
- tr.v.Unit.addEventListener('display-mode-changed', function(e) {
- var scalarSpanTagName = 'tr-v-ui-scalar-span';
- var subclassNames = tr.ui.b.getPolymerElementsThatSubclass(
- scalarSpanTagName);
- subclassNames.push(scalarSpanTagName);
- var isSubclass = {};
- subclassNames.forEach(function(n) {
- isSubclass[n.toUpperCase()] = true;
- });
-
- var m = tr.b.findDeepElementsMatchingPredicate(
- document.body,
- function(el) {
- return isSubclass[el.tagName];
- });
- m.forEach(function(el) {
- el.updateContent_();
- });
- });
-
- return {
- createScalarSpan: createScalarSpan
- };
-});
-</script>
-
-<polymer-element name="tr-v-ui-scalar-span">
- <template>
- <style>
- :host {
- display: block;
- position: relative;
- }
- #content.right-align {
- text-align: right;
- position: relative;
- display: block;
- }
- #sparkline {
- width: 0%;
- position: absolute;
- bottom: 0;
- right: 0;
- display: none;
- height: 100%;
- background-color: hsla(216, 100%, 94.5%, .75);
- border-left: 1px solid hsl(216, 100%, 89%);
- box-sizing: border-box;
- }
- #warning {
- margin-left: 4px;
- font-size: 66%;
- }
- </style>
- <span id="sparkline"></span>
- <span id="content"></span>
- <span id="warning" style="display:none">&#9888;</span>
- </template>
- <script>
- 'use strict';
-
- Polymer({
- ready: function() {
- this.value_ = undefined;
- this.unit_ = undefined;
- this.context_ = undefined;
-
- this.warning_ = undefined;
- this.percentage_ = undefined;
- },
-
- set contentTextDecoration(deco) {
- this.$.content.style.textDecoration = deco;
- },
-
- get value() {
- return this.value_;
- },
-
- set value(value) {
- if (value instanceof tr.v.ScalarNumeric) {
- this.value_ = value.value;
- this.unit_ = value.unit;
- } else {
- this.value_ = value;
- }
- this.updateContent_();
- },
-
- get unit() {
- return this.unit_;
- },
-
- set unit(unit) {
- this.unit_ = unit;
- this.updateContent_();
- },
-
- get context() {
- return this.context_;
- },
-
- set context(context) {
- this.context_ = context;
- this.updateContent_();
- },
-
- setValueAndUnit: function(value, unit) {
- this.value_ = value;
- this.unit_ = unit;
- this.updateContent_();
- },
-
- get percentage() {
- return this.percentage_;
- },
-
- set percentage(percentage) {
- this.percentage_ = percentage;
- this.updateSparkline_();
- },
-
- get rightAlign() {
- return this.$.content.classList.contains('right-align');
- },
-
- set rightAlign(rightAlign) {
- if (rightAlign)
- this.$.content.classList.add('right-align');
- else
- this.$.content.classList.remove('right-align');
- },
-
- updateSparkline_: function() {
- if (this.percentage_ === undefined) {
- this.$.sparkline.style.display = 'none';
- this.$.sparkline.style.width = '0';
- } else {
- this.$.sparkline.style.display = 'block';
- this.$.sparkline.style.width = (this.percentage_ * 100) + '%';
- }
- },
-
- updateContent_: function() {
- if (this.unit_ === undefined) {
- this.$.content.textContent = '';
- this.$.content.style.color = '';
- return;
- }
-
- this.$.content.textContent = this.unit_.format(this.value, this.context);
-
- var BIGGER_IS_BETTER = tr.v.ImprovementDirection.BIGGER_IS_BETTER;
- var SMALLER_IS_BETTER = tr.v.ImprovementDirection.SMALLER_IS_BETTER;
- var color = '';
- if (this.unit_.isDelta) {
- var improvementDirection = this.unit_.improvementDirection;
- if (this.value > 0) {
- // Positive delta.
- switch (improvementDirection) {
- case BIGGER_IS_BETTER:
- color = 'green';
- break;
- case SMALLER_IS_BETTER:
- color = 'red';
- break;
- }
- } else if (this.value < 0) {
- // Negative delta.
- switch (improvementDirection) {
- case BIGGER_IS_BETTER:
- color = 'red';
- break;
- case SMALLER_IS_BETTER:
- color = 'green';
- break;
- }
- }
- }
- this.$.content.style.color = color;
- },
-
- get warning() {
- return this.warning_;
- },
-
- set warning(warning) {
- this.warning_ = warning;
- var warningEl = this.$.warning;
- if (this.warning_) {
- warningEl.title = warning;
- warningEl.style.display = '';
- } else {
- warningEl.title = '';
- warningEl.style.display = 'none';
- }
- }
- });
- </script>
-</polymer-element>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span_test.html
deleted file mode 100644
index 04c266cdc3a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/scalar_span_test.html
+++ /dev/null
@@ -1,236 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/time_display_mode.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/unit_scale.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var ScalarNumeric = tr.v.ScalarNumeric;
- var Unit = tr.v.Unit;
- var THIS_DOC = document._currentScript.ownerDocument;
-
- function checkScalarSpan(
- test, value, unit, expectedTextContent, opt_expectedColor) {
- var span = tr.v.ui.createScalarSpan(new tr.v.ScalarNumeric(unit, value));
- assert.strictEqual(span.$.content.textContent, expectedTextContent);
- assert.strictEqual(span.$.content.style.color, opt_expectedColor || '');
- test.addHTMLOutput(span);
- }
-
- test('instantiate', function() {
- checkScalarSpan(this, 123.456789, Unit.byName.timeDurationInMs,
- '123.457 ms');
- checkScalarSpan(this, 0, Unit.byName.normalizedPercentage, '0.000%');
- checkScalarSpan(this, -2560, Unit.byName.sizeInBytes, '-2.5 KiB');
- });
-
- test('instantiate_smallerIsBetter', function() {
- checkScalarSpan(this, 45097156608, Unit.byName.sizeInBytes_smallerIsBetter,
- '42.0 GiB');
- checkScalarSpan(this, 0, Unit.byName.energyInJoules_smallerIsBetter,
- '0.000 J');
- checkScalarSpan(this, -0.25, Unit.byName.unitlessNumber_smallerIsBetter,
- '-0.250');
- });
-
- test('instantiate_biggerIsBetter', function() {
- checkScalarSpan(this, 0.07, Unit.byName.powerInWatts_smallerIsBetter,
- '0.070 W');
- checkScalarSpan(this, 0, Unit.byName.timeStampInMs_biggerIsBetter,
- '0.000 ms');
- checkScalarSpan(this, -0.00003,
- Unit.byName.normalizedPercentage_biggerIsBetter, '-0.003%');
- });
-
- test('instantiate_delta', function() {
- checkScalarSpan(this, 123.456789, Unit.byName.timeDurationInMsDelta,
- '+123.457 ms');
- checkScalarSpan(this, 0, Unit.byName.normalizedPercentageDelta,
- '\u00B10.000%');
- checkScalarSpan(this, -2560, Unit.byName.sizeInBytesDelta,
- '-2.5 KiB');
- });
-
- test('instantiate_delta_smallerIsBetter', function() {
- checkScalarSpan(this, 45097156608,
- Unit.byName.sizeInBytesDelta_smallerIsBetter, '+42.0 GiB', 'red');
- checkScalarSpan(this, 0, Unit.byName.energyInJoulesDelta_smallerIsBetter,
- '\u00B10.000 J');
- checkScalarSpan(this, -0.25,
- Unit.byName.unitlessNumberDelta_smallerIsBetter, '-0.250', 'green');
- });
-
- test('instantiate_delta_biggerIsBetter', function() {
- checkScalarSpan(this, 0.07, Unit.byName.powerInWattsDelta_biggerIsBetter,
- '+0.070 W', 'green');
- checkScalarSpan(this, 0, Unit.byName.timeStampInMsDelta_biggerIsBetter,
- '\u00B10.000 ms');
- checkScalarSpan(this, -0.00003,
- Unit.byName.normalizedPercentageDelta_biggerIsBetter, '-0.003%', 'red');
- });
-
- test('createScalarSpan', function() {
- // No config.
- var span = tr.v.ui.createScalarSpan(
- new ScalarNumeric(Unit.byName.powerInWatts, 3.14));
- assert.strictEqual(span.$.content.textContent, '3.140 W');
- assert.strictEqual(span.ownerDocument, document);
- assert.strictEqual(span.tagName, 'TR-V-UI-SCALAR-SPAN');
- assert.strictEqual(span.value, 3.14);
- assert.strictEqual(span.unit, Unit.byName.powerInWatts);
- assert.isUndefined(span.context);
- assert.isUndefined(span.percentage);
- assert.isUndefined(span.warning);
- assert.isFalse(span.rightAlign);
- this.addHTMLOutput(span);
-
- // Custom owner document and right align.
- var span = tr.v.ui.createScalarSpan(
- new ScalarNumeric(Unit.byName.energyInJoules, 2.72),
- { ownerDocument: THIS_DOC, rightAlign: true });
- assert.strictEqual(span.$.content.textContent, '2.720 J');
- assert.strictEqual(span.ownerDocument, THIS_DOC);
- assert.strictEqual(span.tagName, 'TR-V-UI-SCALAR-SPAN');
- assert.strictEqual(span.value, 2.72);
- assert.strictEqual(span.unit, Unit.byName.energyInJoules);
- assert.isUndefined(span.context);
- assert.isUndefined(span.percentage);
- assert.isUndefined(span.warning);
- assert.isTrue(span.rightAlign);
- this.addHTMLOutput(span);
-
- // Unit and sparkline set via config.
- var span = tr.v.ui.createScalarSpan(1.62,
- { unit: Unit.byName.timeStampInMs, total: 3.24 });
- assert.strictEqual(span.$.content.textContent, '1.620 ms');
- assert.strictEqual(span.ownerDocument, document);
- assert.strictEqual(span.tagName, 'TR-V-UI-SCALAR-SPAN');
- assert.strictEqual(span.value, 1.62);
- assert.strictEqual(span.unit, Unit.byName.timeStampInMs);
- assert.isUndefined(span.context);
- assert.strictEqual(span.percentage, 0.5);
- assert.isUndefined(span.warning);
- assert.isFalse(span.rightAlign);
- this.addHTMLOutput(span);
-
- // Custom context.
- var span = tr.v.ui.createScalarSpan(
- new ScalarNumeric(Unit.byName.sizeInBytesDelta_smallerIsBetter,
- 256 * 1024 * 1024), { context: {
- unitPrefix: tr.v.UnitScale.Binary.KIBI,
- minimumFractionDigits: 2
- } });
- assert.strictEqual(span.$.content.textContent, '+262,144.00 KiB');
- assert.strictEqual(span.ownerDocument, document);
- assert.strictEqual(span.tagName, 'TR-V-UI-SCALAR-SPAN');
- assert.strictEqual(span.value, 256 * 1024 * 1024);
- assert.strictEqual(span.unit, Unit.byName.sizeInBytesDelta_smallerIsBetter);
- assert.deepEqual(span.context,
- { unitPrefix: tr.v.UnitScale.Binary.KIBI, minimumFractionDigits: 2 });
- assert.isUndefined(span.percentage);
- assert.isUndefined(span.warning);
- assert.isFalse(span.rightAlign);
- this.addHTMLOutput(span);
- });
-
- test('instantiate_withWarning', function() {
- var span = document.createElement('tr-v-ui-scalar-span');
- span.value = 400000000;
- span.unit = Unit.byName.sizeInBytes;
- span.warning = 'There is a problem with this size';
- this.addHTMLOutput(span);
- });
-
- test('instantiate_withPercentage', function() {
- var span = document.createElement('tr-v-ui-scalar-span');
- span.value = new ScalarNumeric(Unit.byName.unitlessNumber, 99);
- span.percentage = 0.66;
- this.addHTMLOutput(span);
- });
-
- test('instantiate_withRightAlign', function() {
- var span = document.createElement('tr-v-ui-scalar-span');
- span.value = new ScalarNumeric(Unit.byName.timeStampInMs, 5.777);
- span.rightAlign = true;
- this.addHTMLOutput(span);
- });
-
- test('instantiate_withContext', function() {
- var span = document.createElement('tr-v-ui-scalar-span');
- span.value = new ScalarNumeric(
- Unit.byName.unitlessNumberDelta_smallerIsBetter, 42);
- span.context = { maximumFractionDigits: 2 };
- assert.strictEqual(span.$.content.textContent, '+42.00');
- this.addHTMLOutput(span);
- });
-
- test('warningAndNonWarningHaveSimilarHeights', function() {
- var spanA = document.createElement('tr-v-ui-scalar-span');
- spanA.setValueAndUnit(400, Unit.byName.timeDurationInMs);
-
- var spanB = document.createElement('tr-v-ui-scalar-span');
- spanB.setValueAndUnit(400, Unit.byName.timeDurationInMs);
- spanB.warning = 'There is a problem with this time';
-
- var overall = document.createElement('div');
- overall.style.display = 'flex';
- overall.appendChild(spanA);
- spanB.style.marginLeft = '4px';
- overall.appendChild(spanB);
- this.addHTMLOutput(overall);
- });
-
- test('respectCurrentDisplayUnit', function() {
- try {
- Unit.currentTimeDisplayMode = tr.v.TimeDisplayModes.ns;
-
- var span = document.createElement('tr-v-ui-scalar-span');
- span.setValueAndUnit(73, Unit.byName.timeStampInMs);
- this.addHTMLOutput(span);
-
- assert.isTrue(span.$.content.textContent.indexOf('ns') > 0);
- Unit.currentTimeDisplayMode = tr.v.TimeDisplayModes.ms;
- assert.isTrue(span.$.content.textContent.indexOf('ms') > 0);
- } finally {
- Unit.reset();
- }
- });
-
- test('displaySparkline', function() {
- var div = document.createElement('div');
- div.style.width = '100px';
- this.addHTMLOutput(div);
-
- function addAndCheckScalarSpan(percentage, expectedDisplay, expectedWidth) {
- var span = tr.v.ui.createScalarSpan(new ScalarNumeric(
- Unit.byName.timeDurationInMs, 10 * div.children.length));
- if (percentage !== null)
- span.percentage = percentage;
-
- div.appendChild(span);
-
- var computedStyle = getComputedStyle(span.$.sparkline);
- assert.equal(computedStyle.display, expectedDisplay);
- assert.equal(parseInt(computedStyle.width), expectedWidth);
- }
-
- addAndCheckScalarSpan(null /* no percentage set */, 'none', 0);
- addAndCheckScalarSpan(undefined, 'none', 0);
- addAndCheckScalarSpan(0, 'block', 1);
- addAndCheckScalarSpan(0.05, 'block', 5);
- addAndCheckScalarSpan(0.5, 'block', 50);
- addAndCheckScalarSpan(0.95, 'block', 95);
- addAndCheckScalarSpan(1, 'block', 100);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table.html b/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table.html
deleted file mode 100644
index e9388185408..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table.html
+++ /dev/null
@@ -1,315 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/raf.html">
-<link rel="import" href="/tracing/ui/base/table.html">
-<link rel="import" href="/tracing/value/ui/diagnostic_span.html">
-<link rel="import" href="/tracing/value/ui/histogram_span.html">
-<link rel="import" href="/tracing/value/ui/scalar_span.html">
-<link rel="import" href="/tracing/value/ui/value_set_view.html">
-<link rel="import" href="/tracing/value/unit.html">
-
-<polymer-element name='tr-v-ui-value-set-table'>
- <template>
- <style>
- :host {
- display: flex;
- flex-direction: column;
- }
- table-container {
- display: flex;
- min-height: 0px;
- overflow-y: auto;
- }
- div#error {
- color: red;
- }
- #histogram {
- display: none;
- }
- </style>
-
- <div id="error"></div>
- <table-container>
- <tr-ui-b-table id="table"></tr-ui-b-table>
- </table-container>
- <tr-v-ui-histogram-span id="histogram"></tr-v-ui-histogram-span>
- </template>
-</polymer-element>
-
-<script>
-'use strict';
-tr.exportTo('tr.ui', function() {
- Polymer('tr-v-ui-value-set-table', {
- /**
- * Return true if this view supports this ValueSet.
- * Value-set-table supports all possible metrics, so it always returns true.
- *
- * @param {!tr.v.ValueSet} values
- * @return {boolean}
- */
- supportsValueSet: function(values) {
- return true;
- },
-
- /**
- * This can optionally depend on the ValueSet.
- *
- * @return {string}
- */
- get tabLabel() {
- return 'Table';
- },
-
- ready: function() {
- this.values_ = undefined;
- this.summaryValues_ = {};
- this.columns_ = undefined;
- this.$.table.selectionMode = tr.ui.b.TableFormat.SelectionMode.CELL;
- this.$.table.addEventListener('selection-changed',
- this.onSelectionChanged_.bind(this));
- },
-
- onSelectionChanged_: function() {
- var row = this.$.table.selectedTableRow;
- var col = this.$.table.selectedColumnIndex;
- var cell = undefined;
- if (row && col && this.columns_)
- cell = row[this.columns_[col].title];
-
- if ((cell instanceof tr.v.NumericValue) &&
- (cell.numeric instanceof tr.v.Numeric)) {
- this.$.histogram.style.display = 'block';
- this.$.histogram.histogram = cell.numeric;
- } else {
- this.$.histogram.style.display = 'none';
- }
- },
-
- handleFailureValues_: function() {
- this.values.map(function(value) {
- if (value instanceof tr.v.FailureValue) {
- this.$.error.textContent = value.description;
- this.$.table.style.display = 'none';
- this.style.width = '10em';
- }
- }, this);
- },
-
- addDiagnosticSubRows_: function(value, row, column) {
- value.diagnostics.forEach(function(name, diagnostic) {
- if (name === tr.v.SUMMARY_VALUE_MAP_DIAGNOSTIC_NAME)
- return;
-
- // If a previous |value| had a diagnostic with the same name, then
- // there is already a subRow that should contain this diagnostic.
- for (var subRow of row.subRows) {
- if (subRow.name === name) {
- subRow[column] = diagnostic;
- return;
- }
- }
-
- // This is the first time that a diagnostic with this name has been
- // seen for Values whose name is |value.name|, so create a new subRow.
- var subRow = {name: name};
- subRow[column] = diagnostic;
- row.subRows.push(subRow);
- });
- },
-
- get values() {
- return this.values_;
- },
-
- findSummaryValues_: function() {
- this.summaryValues_ = {};
- this.values.map(function(value) {
- var summaryValueMap = value.diagnostics.get(
- tr.v.SUMMARY_VALUE_MAP_DIAGNOSTIC_NAME);
- if (!(summaryValueMap instanceof tr.v.d.RelatedValueMap))
- return;
-
- summaryValueMap.values.forEach(function(summaryValue) {
- this.summaryValues_[summaryValue.guid] = summaryValue;
- }, this);
- }, this);
- },
-
- /**
- * @param {!tr.v.ValueSet} values
- */
- set values(values) {
- this.values_ = values;
- this.style.width = '';
- this.$.table.style.display = '';
- this.$.error.textContent = '';
-
- this.handleFailureValues_();
- if (this.$.error.textContent)
- return;
-
- this.findSummaryValues_();
-
- /* rows will look something like [
- {name: 'long tasks',
- displayLabelA: Value,
- displayLabelB: Value,
- subRows: [
- {name: 'iteration',
- displayLabelA: Diagnostic,
- displayLabelB: Diagnostic,
- }
- ]
- }
- ]
- TODO(benjhayden): After Values are summarized and merged, there will be
- more row tiers: value name > benchmark name > story name > benchmark
- start > storyset repeat > story repeat > diagnostics.
- */
- var rows = [];
-
- // This will be used to sort the columns by start time.
- var startTimesForDisplayLabels = {};
-
- tr.b.iterItems(values.organizedByName, function(name, vals) {
- var row = {name: name, subRows: []};
- var isEmptyRow = true;
-
- vals.forEach(function(val) {
- if (this.summaryValues_[val.guid])
- return;
-
- if (!row.description && val.description)
- row.description = val.description;
-
- var displayLabel = 'Value';
- var startMs = 0;
- var iteration = val.diagnostics.get(
- tr.v.ITERATION_INFO_DIAGNOSTIC_NAME);
- if (iteration instanceof tr.v.d.IterationInfo) {
- displayLabel = iteration.displayLabel;
- startMs = iteration.benchmarkStart.getTime();
- }
-
- this.addDiagnosticSubRows_(val, row, displayLabel);
-
- startTimesForDisplayLabels[displayLabel] = Math.min(
- startTimesForDisplayLabels[displayLabel] || 0,
- startMs);
-
- if (row[displayLabel] !== undefined) {
- console.warn('Multiple Values with same name and displayLabel:',
- name, displayLabel, row[displayLabel], val,
- 'Sorry, only one will be displayed until summarization and ' +
- 'merging are implemented.');
- }
- row[displayLabel] = val;
- isEmptyRow = false;
- }, this);
-
- if (isEmptyRow)
- return;
-
- rows.push(row);
- }, this);
-
- if (rows.length === 0) {
- this.$.error.textContent = 'zero values';
- this.$.table.style.display = 'none';
- this.style.width = '10em';
- return;
- }
-
- this.buildColumns_(startTimesForDisplayLabels);
-
- this.$.table.tableColumns = this.columns_;
- this.$.table.tableRows = rows;
- this.$.table.sortColumnIndex = 0;
- this.$.table.rebuild();
- this.$.table.selectedTableRow = rows[0];
- this.$.table.selectedColumnIndex = 1;
-
- tr.b.requestAnimationFrame(function() {
- this.style.width = this.$.table.getBoundingClientRect().width;
- }, this);
- },
-
- buildColumns_: function(startTimesForDisplayLabels) {
- var displayLabels = Object.keys(startTimesForDisplayLabels);
- displayLabels.sort(function(a, b) {
- return startTimesForDisplayLabels[a] - startTimesForDisplayLabels[b];
- });
-
- this.columns_ = [
- {
- title: 'Name',
- align: tr.ui.b.TableFormat.ColumnAlignment.LEFT,
-
- value: function(row) {
- var nameEl = document.createElement('span');
- nameEl.textContent = row.name;
- if (row.description)
- nameEl.title = row.description;
- nameEl.style.textOverflow = 'ellipsis';
- return nameEl;
- },
-
- cmp: function(rowA, rowB) {
- rowA = rowA ? rowA.name : '';
- rowB = rowB ? rowB.name : '';
- return rowA.localeCompare(rowB);
- },
- }
- ];
-
- displayLabels.forEach(function(displayLabel) {
- this.columns_.push({
- title: displayLabel,
- align: tr.ui.b.TableFormat.ColumnAlignment.RIGHT,
- supportsCellSelection: true,
-
- value: function(row) {
- var cell = row[displayLabel];
- if (cell instanceof tr.v.d.Diagnostic) {
- return tr.v.ui.createDiagnosticSpan(cell);
- } else if (cell instanceof tr.v.NumericValue) {
- return tr.v.ui.createScalarSpan(cell);
- } else if (cell === undefined) {
- return '';
- } else {
- throw new Error('Invalid cell', cell);
- }
- },
-
- cmp: function(rowA, rowB) {
- var cellA = rowA[displayLabel];
- var cellB = rowB[displayLabel];
- if (!(cellA instanceof tr.v.NumericValue) ||
- !(cellB instanceof tr.v.NumericValue))
- return undefined;
-
- var numericA = cellA.numeric;
- var numericB = cellB.numeric;
-
- var valueA = (numericA instanceof tr.v.ScalarNumeric) ?
- numericA.value : numericA.average;
- var valueB = (numericB instanceof tr.v.ScalarNumeric) ?
- numericB.value : numericB.average;
-
- return valueA - valueB;
- }
- });
- }, this);
- }
- });
-
- tr.ui.registerValueSetView('tr-v-ui-value-set-table');
-
- return {};
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table_test.html b/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table_test.html
deleted file mode 100644
index 5358e8442f3..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_table_test.html
+++ /dev/null
@@ -1,87 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/ui/value_set_table.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var TEST_NUMERIC_BUILDER = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs, tr.b.Range.fromExplicitRange(0, 1000),
- 20);
-
- test('instantiate', function() {
- var table = document.createElement('tr-v-ui-value-set-table');
- var values = new tr.v.ValueSet();
- assert.isTrue(table.supportsValueSet(values));
-
- var numeric0a = TEST_NUMERIC_BUILDER.build();
- for (var i = 0; i < 1e2; ++i) {
- numeric0a.add(Math.random() * 1000);
- }
- var fooA = new tr.v.NumericValue('foo', numeric0a, {
- description: 'they should have sent a poet'
- });
- values.addValue(fooA);
- fooA.diagnostics.add(
- tr.v.ITERATION_INFO_DIAGNOSTIC_NAME, new tr.v.d.IterationInfo({
- label: 'iteration A',
- benchmarkStartMs: new Date().getTime(),
- }));
-
- var numeric1a = TEST_NUMERIC_BUILDER.build();
- for (var i = 0; i < 1e2; ++i) {
- numeric1a.add(Math.random() * 1000);
- }
- var barA = new tr.v.NumericValue('bar', numeric1a, {
- description: 'indescribable'
- });
- values.addValue(barA);
- barA.diagnostics.add(
- tr.v.ITERATION_INFO_DIAGNOSTIC_NAME, new tr.v.d.IterationInfo({
- label: 'iteration A',
- benchmarkStartMs: new Date().getTime(),
- }));
-
- var numeric0b = TEST_NUMERIC_BUILDER.build();
- for (var i = 0; i < 1e2; ++i) {
- numeric0b.add(Math.random() * 1000);
- }
- var fooB = new tr.v.NumericValue('foo', numeric0b, {
- description: 'they should have sent a poet'
- });
- values.addValue(fooB);
- fooB.diagnostics.add(
- tr.v.ITERATION_INFO_DIAGNOSTIC_NAME, new tr.v.d.IterationInfo({
- label: 'iteration B',
- benchmarkStartMs: new Date().getTime(),
- }));
-
- var numeric1b = TEST_NUMERIC_BUILDER.build();
- for (var i = 0; i < 1e2; ++i) {
- numeric1b.add(Math.random() * 1000);
- }
- var barB = new tr.v.NumericValue('bar', numeric1b, {
- description: 'indescribable'
- });
- values.addValue(barB);
- barB.diagnostics.add(
- tr.v.ITERATION_INFO_DIAGNOSTIC_NAME, new tr.v.d.IterationInfo({
- label: 'iteration B',
- benchmarkStartMs: new Date().getTime(),
- }));
-
- table.values = values;
- this.addHTMLOutput(table);
- // XXX test multi-col
- // XXX test selection
- // XXX test sorting by name, valueA, valueB
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_view.html b/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_view.html
deleted file mode 100644
index 9a773957e74..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/ui/value_set_view.html
+++ /dev/null
@@ -1,87 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/ui/base/polymer_utils.html">
-<link rel="import" href="/tracing/ui/base/tab_view.html">
-
-<polymer-element name='tr-v-ui-value-set-view'>
- <template>
- <tr-ui-a-tab-view id="container"></tr-ui-a-tab-view>
- </template>
-</polymer-element>
-
-<script>
-'use strict';
-tr.exportTo('tr.ui', function() {
- var VALUE_SET_VIEW_ELEMENT_NAMES = [];
-
- var SELECTED_TAB_SETTINGS_KEY = 'tr-v-ui-value-set-view-element-name';
-
- Polymer('tr-v-ui-value-set-view', {
- ready: function() {
- this.$.container.addEventListener(
- 'selected-tab-change', this.onSelectedTabChange_.bind(this));
- },
-
- onSelectedTabChange_: function() {
- if (!this.$.container.selectedTab)
- return;
-
- tr.b.Settings.set(
- SELECTED_TAB_SETTINGS_KEY,
- this.$.container.selectedTab.tagName.toLowerCase());
- },
-
- /**
- * @param {!tr.v.ValueSet} values
- */
- set values(values) {
- this.$.container.textContent = '';
-
- var initialTabElementName = tr.b.Settings.get(
- SELECTED_TAB_SETTINGS_KEY, undefined);
-
- VALUE_SET_VIEW_ELEMENT_NAMES.forEach(function(elementName, index) {
- var view = document.createElement(elementName);
- if (!view.supportsValueSet(values))
- return;
-
- view.values = values;
-
- if (elementName.toLowerCase() === initialTabElementName)
- view.setAttribute('selected', true);
-
- view.setAttribute('tab-label', view.tabLabel);
-
- this.$.container.appendChild(view);
- }, this);
-
- if (this.$.container.children.length === 1) {
- this.$.container.tabsHidden = true;
- } else if (this.$.container.selectedTab === undefined) {
- this.$.container.children[0].setAttribute('selected', true);
- }
- }
- });
-
- /**
- * Register the name of a polymer element that supports displaying ValueSets.
- *
- * @param {string} elementName
- */
- function registerValueSetView(elementName) {
- if (!tr.ui.b.getPolymerElementNamed(elementName))
- throw new Error('Element not registered: ' + elementName);
-
- VALUE_SET_VIEW_ELEMENT_NAMES.push(elementName);
- }
-
- return {
- registerValueSetView: registerValueSetView
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/unit.html b/chromium/third_party/catapult/tracing/tracing/value/unit.html
deleted file mode 100644
index aa4fed27746..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/unit.html
+++ /dev/null
@@ -1,333 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/event.html">
-<link rel="import" href="/tracing/base/event_target.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/value/time_display_mode.html">
-<link rel="import" href="/tracing/value/unit_scale.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.v', function() {
- var TimeDisplayModes = tr.v.TimeDisplayModes;
-
- var PLUS_MINUS_SIGN = String.fromCharCode(177);
-
- function max(a, b) {
- if (a === undefined)
- return b;
- if (b === undefined)
- return a;
- return a.scale > b.scale ? a : b;
- }
-
- /** @enum */
- var ImprovementDirection = {
- DONT_CARE: 0,
- BIGGER_IS_BETTER: 1,
- SMALLER_IS_BETTER: 2
- };
-
- /** @constructor */
- function Unit(unitName, jsonName, isDelta, improvementDirection, formatSpec) {
- this.unitName = unitName;
- this.jsonName = jsonName;
- this.isDelta = isDelta;
- this.improvementDirection = improvementDirection;
- this.formatSpec_ = formatSpec;
-
- // Example: powerInWattsDelta_biggerIsBetter -> powerInWatts.
- this.baseUnit = undefined;
-
- // Example: energyInJoules_smallerIsBetter ->
- // energyInJoulesDelta_smallerIsBetter.
- this.correspondingDeltaUnit = undefined;
- }
-
- Unit.prototype = {
- asJSON: function() {
- return this.jsonName;
- },
-
- format: function(value, opt_context) {
- var context = opt_context || {};
- var formatSpec = this.formatSpec_;
- if (typeof formatSpec === 'function')
- formatSpec = formatSpec();
-
- function resolveProperty(propertyName) {
- if (propertyName in context)
- return context[propertyName];
- else if (propertyName in formatSpec)
- return formatSpec[propertyName];
- else
- return undefined;
- }
-
- var signString = '';
- if (value < 0) {
- signString = '-';
- value = -value; // Treat positive and negative values symmetrically.
- } else if (this.isDelta) {
- signString = value === 0 ? PLUS_MINUS_SIGN : '+';
- }
-
- var unitString = '';
- if (formatSpec.unit) {
- if (formatSpec.unitHasPrecedingSpace !== false)
- unitString += ' ';
- var unitPrefix = resolveProperty('unitPrefix');
- if (unitPrefix !== undefined) {
- var selectedPrefix;
- if (unitPrefix instanceof Array) {
- var i = 0;
- while (i < unitPrefix.length - 1 &&
- value / unitPrefix[i + 1].value >= 1) {
- i++;
- }
- selectedPrefix = unitPrefix[i];
- } else {
- selectedPrefix = unitPrefix;
- }
- unitString += selectedPrefix.symbol || '';
- value /= selectedPrefix.value;
- }
- unitString += formatSpec.unit;
- }
-
- var minimumFractionDigits = resolveProperty('minimumFractionDigits');
- var maximumFractionDigits = resolveProperty('maximumFractionDigits');
-
- // If the context overrides only one of the two |*FractionDigits|
- // properties and the other one is provided by the unit, we might need to
- // shift the other property so that
- // |minimumFractionDigits| <= |maximumFractionDigits|.
- if (minimumFractionDigits > maximumFractionDigits) {
- if ('minimumFractionDigits' in context &&
- !('maximumFractionDigits' in context)) {
- // Only minimumFractionDigits was overriden by context.
- maximumFractionDigits = minimumFractionDigits;
- } else if ('maximumFractionDigits' in context &&
- !('minimumFractionDigits' in context)) {
- // Only maximumFractionDigits was overriden by context.
- minimumFractionDigits = maximumFractionDigits;
- }
- }
-
- var numberString = value.toLocaleString(undefined, {
- minimumFractionDigits: minimumFractionDigits,
- maximumFractionDigits: maximumFractionDigits
- });
-
- return signString + numberString + unitString;
- }
- };
-
- Unit.reset = function() {
- Unit.currentTimeDisplayMode = TimeDisplayModes.ms;
- };
-
- Unit.timestampFromUs = function(us) {
- return us / 1000;
- };
-
- Unit.maybeTimestampFromUs = function(us) {
- return us === undefined ? undefined : us / 1000;
- };
-
- Object.defineProperty(Unit, 'currentTimeDisplayMode', {
- get: function() {
- return Unit.currentTimeDisplayMode_;
- },
- // Use tr-v-ui-preferred-display-unit element instead of directly setting.
- set: function(value) {
- if (Unit.currentTimeDisplayMode_ === value)
- return;
-
- Unit.currentTimeDisplayMode_ = value;
- Unit.dispatchEvent(new tr.b.Event('display-mode-changed'));
- }
- });
-
- Unit.didPreferredTimeDisplayUnitChange = function() {
- var largest = undefined;
- var els = tr.b.findDeepElementsMatching(document.body,
- 'tr-v-ui-preferred-display-unit');
- els.forEach(function(el) {
- largest = max(largest, el.preferredTimeDisplayMode);
- });
-
- Unit.currentDisplayUnit = largest === undefined ?
- TimeDisplayModes.ms : largest;
- };
-
- Unit.byName = {};
- Unit.byJSONName = {};
-
- Unit.fromJSON = function(object) {
- var u = Unit.byJSONName[object];
- if (u) {
- return u;
- }
- throw new Error('Unrecognized unit');
- };
-
- /**
- * Define all combinations of a unit with isDelta and improvementDirection
- * flags. For example, the following code:
- *
- * Unit.define({
- * baseUnitName: 'powerInWatts'
- * baseJsonName: 'W'
- * formatSpec: {
- * // Specification of how the unit should be formatted (unit symbol,
- * // unit prefix, fraction digits, etc), or a function returning such
- * // a specification.
- * }
- * });
- *
- * generates the following six units (JSON names shown in parentheses):
- *
- * Unit.byName.powerInWatts (W)
- * Unit.byName.powerInWatts_smallerIsBetter (W_smallerIsBetter)
- * Unit.byName.powerInWatts_biggerIsBetter (W_biggerIsBetter)
- * Unit.byName.powerInWattsDelta (WDelta)
- * Unit.byName.powerInWattsDelta_smallerIsBetter (WDelta_smallerIsBetter)
- * Unit.byName.powerInWattsDelta_biggerIsBetter (WDelta_biggerIsBetter)
- *
- * with the appropriate flags and formatting code (including +/- prefixes
- * for deltas).
- */
- Unit.define = function(params) {
- var definedUnits = [];
-
- tr.b.iterItems(ImprovementDirection, function(_, improvementDirection) {
- var regularUnit =
- Unit.defineUnitVariant_(params, false, improvementDirection);
- var deltaUnit =
- Unit.defineUnitVariant_(params, true, improvementDirection);
-
- regularUnit.correspondingDeltaUnit = deltaUnit;
- deltaUnit.correspondingDeltaUnit = deltaUnit;
- definedUnits.push(regularUnit, deltaUnit);
- });
-
- var baseUnit = Unit.byName[params.baseUnitName];
- definedUnits.forEach(u => u.baseUnit = baseUnit);
- };
-
- Unit.defineUnitVariant_ = function(params, isDelta, improvementDirection) {
- var nameSuffix = isDelta ? 'Delta' : '';
- switch (improvementDirection) {
- case ImprovementDirection.DONT_CARE:
- break;
- case ImprovementDirection.BIGGER_IS_BETTER:
- nameSuffix += '_biggerIsBetter';
- break;
- case ImprovementDirection.SMALLER_IS_BETTER:
- nameSuffix += '_smallerIsBetter';
- break;
- default:
- throw new Error(
- 'Unknown improvement direction: ' + improvementDirection);
- }
-
- var unitName = params.baseUnitName + nameSuffix;
- var jsonName = params.baseJsonName + nameSuffix;
- if (Unit.byName[unitName] !== undefined)
- throw new Error('Unit \'' + unitName + '\' already exists');
- if (Unit.byJSONName[jsonName] !== undefined)
- throw new Error('JSON unit \'' + jsonName + '\' alread exists');
-
- var unit = new Unit(
- unitName, jsonName, isDelta, improvementDirection, params.formatSpec);
- Unit.byName[unitName] = unit;
- Unit.byJSONName[jsonName] = unit;
-
- return unit;
- };
-
- tr.b.EventTarget.decorate(Unit);
- Unit.reset();
-
- // Known display units follow.
- //////////////////////////////////////////////////////////////////////////////
-
- Unit.define({
- baseUnitName: 'timeDurationInMs',
- baseJsonName: 'ms',
- formatSpec: function() {
- return Unit.currentTimeDisplayMode_.formatSpec;
- }
- });
-
- Unit.define({
- baseUnitName: 'timeStampInMs',
- baseJsonName: 'tsMs',
- formatSpec: function() {
- return Unit.currentTimeDisplayMode_.formatSpec;
- }
- });
-
- Unit.define({
- baseUnitName: 'normalizedPercentage',
- baseJsonName: 'n%',
- formatSpec: {
- unit: '%',
- unitPrefix: { value: 0.01 },
- unitHasPrecedingSpace: false,
- minimumFractionDigits: 3,
- maximumFractionDigits: 3
- }
- });
-
- Unit.define({
- baseUnitName: 'sizeInBytes',
- baseJsonName: 'sizeInBytes',
- formatSpec: {
- unit: 'B',
- unitPrefix: tr.v.UnitScale.Binary.AUTO,
- minimumFractionDigits: 1,
- maximumFractionDigits: 1
- }
- });
-
- Unit.define({
- baseUnitName: 'energyInJoules',
- baseJsonName: 'J',
- formatSpec: {
- unit: 'J',
- minimumFractionDigits: 3
- }
- });
-
- Unit.define({
- baseUnitName: 'powerInWatts',
- baseJsonName: 'W',
- formatSpec: {
- unit: 'W',
- minimumFractionDigits: 3
- }
- });
-
- Unit.define({
- baseUnitName: 'unitlessNumber',
- baseJsonName: 'unitless',
- formatSpec: {
- minimumFractionDigits: 3,
- maximumFractionDigits: 3
- }
- });
-
- return {
- ImprovementDirection: ImprovementDirection,
- Unit: Unit
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/unit_scale.html b/chromium/third_party/catapult/tracing/tracing/value/unit_scale.html
deleted file mode 100644
index 236caff9db1..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/unit_scale.html
+++ /dev/null
@@ -1,56 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.v', function() {
-
- var UnitScale = {};
-
- function defineUnitScale(name, prefixes) {
- if (UnitScale[name] !== undefined)
- throw new Error('Unit scale \'' + name + '\' already exists');
- if (prefixes.AUTO !== undefined) {
- throw new Error('\'AUTO\' unit prefix will be added automatically ' +
- 'for unit scale \'' + name + '\'');
- }
-
- // If the 'AUTO' unit prefix is used, the prefix that results in
- // the absolute formatted value being as close to the [1, 1024) interval as
- // possible is used. Example: 1023 and 1024 bytes are displayed as
- // "1,023.0 B" and "1.0 KiB", respectively.
- prefixes.AUTO = tr.b.dictionaryValues(prefixes);
- prefixes.AUTO.sort((a, b) => a.value - b.value);
-
- UnitScale[name] = prefixes;
- }
-
- // See https://en.wikipedia.org/wiki/Binary_prefix.
- defineUnitScale('Binary', {
- NONE: { value: Math.pow(1024, 0), symbol: '' },
- KIBI: { value: Math.pow(1024, 1), symbol: 'Ki' },
- MEBI: { value: Math.pow(1024, 2), symbol: 'Mi' },
- GIBI: { value: Math.pow(1024, 3), symbol: 'Gi' },
- TEBI: { value: Math.pow(1024, 4), symbol: 'Ti' }
- });
-
- // See https://en.wikipedia.org/wiki/Metric_prefix.
- // The base time unit used in the whole repository is ms (milliseconds), so
- // all values are multiplied by 1000.
- defineUnitScale('MetricTime', {
- NANO: { value: 1e-6, symbol: 'n' },
- MILLI: { value: 1, symbol: 'm' }
- });
-
- return {
- UnitScale: UnitScale
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/unit_test.html b/chromium/third_party/catapult/tracing/tracing/value/unit_test.html
deleted file mode 100644
index 2c355f9831a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/unit_test.html
+++ /dev/null
@@ -1,224 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/value/time_display_mode.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/unit_scale.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- var Unit = tr.v.Unit;
- var UnitScale = tr.v.UnitScale;
- var ImprovementDirection = tr.v.ImprovementDirection;
-
- test('Unit.display-mode-changed', function() {
- var Unit = tr.v.Unit;
- var TimeDisplayModes = tr.v.TimeDisplayModes;
-
- var listenerWasCalled = false;
- function listener(e) {
- listenerWasCalled = true;
- }
-
- try {
- Unit.currentTimeDisplayMode = TimeDisplayModes.ms;
- Unit.addEventListener('display-mode-changed', listener);
-
- listenerWasCalled = false;
- Unit.currentTimeDisplayMode = TimeDisplayModes.ns;
- assert.isTrue(listenerWasCalled);
- assert.equal(Unit.currentTimeDisplayMode, TimeDisplayModes.ns);
- } finally {
- Unit.removeEventListener('display-mode-changed', listener);
- Unit.reset();
- }
- });
-
- function checkTimeUnit(unit) {
- try {
- // Use milliseconds to display time (default behavior).
- Unit.currentTimeDisplayMode = tr.v.TimeDisplayModes.ms;
-
- assert.strictEqual(unit.format(0), '0.000 ms');
- assert.strictEqual(unit.format(0.02), '0.020 ms');
- assert.strictEqual(unit.format(0.001), '0.001 ms');
- assert.strictEqual(unit.format(0.0005), '0.001 ms');
- assert.strictEqual(unit.format(0.00049), '0.000 ms');
- assert.strictEqual(unit.format(999.999), '999.999 ms');
- assert.strictEqual(unit.format(1000.001), '1,000.001 ms');
- assert.strictEqual(unit.format(123456789), '123,456,789.000 ms');
- assert.strictEqual(unit.format(-0.00051), '-0.001 ms');
- assert.strictEqual(unit.format(-123456789), '-123,456,789.000 ms');
-
- // Change the unit to nanoseconds.
- Unit.currentTimeDisplayMode = tr.v.TimeDisplayModes.ns;
-
- assert.strictEqual(unit.format(0), '0 ns');
- assert.strictEqual(unit.format(1), '1,000,000 ns');
- assert.strictEqual(unit.format(0.000042), '42 ns');
- assert.strictEqual(unit.format(0.000001), '1 ns');
- assert.strictEqual(unit.format(0.0000005), '1 ns');
- assert.strictEqual(unit.format(0.00000049), '0 ns');
- assert.strictEqual(unit.format(123.456), '123,456,000 ns');
- assert.strictEqual(unit.format(-0.07), '-70,000 ns');
- } finally {
- Unit.reset();
- }
- }
-
- test('timeStampInMs', function() {
- assert.strictEqual(Unit.byName.timeStampInMs.unitName, 'timeStampInMs');
- assert.strictEqual(Unit.byName.timeStampInMs.asJSON(), 'tsMs');
- checkTimeUnit(Unit.byName.timeStampInMs);
- });
-
- test('timeDurationInMs', function() {
- assert.strictEqual(Unit.byName.timeDurationInMs.unitName,
- 'timeDurationInMs');
- assert.strictEqual(Unit.byName.timeDurationInMs.asJSON(), 'ms');
- checkTimeUnit(Unit.byName.timeDurationInMs);
- });
-
- test('sizeInBytes', function() {
- var SOURCE_VALUES = [0, 1, 1536, 424.5 * 1024 * 1024,
- 1025 * 1024 * 1024 * 1024 * 1024, -2.5 * 1024 * 1024];
- var EXPECTED_REGULAR_FORMATTED_VALUES = ['0.0 B', '1.0 B', '1.5 KiB',
- '424.5 MiB', '1,025.0 TiB', '-2.5 MiB'];
- var EXPECTED_DELTA_FORMATTED_VALUES = ['\u00B10.0 B', '+1.0 B', '+1.5 KiB',
- '+424.5 MiB', '+1,025.0 TiB', '-2.5 MiB'];
-
- function checkSizeUnit(unit, expectation) {
- assert.strictEqual(unit.unitName, expectation.unitName);
- assert.strictEqual(unit.asJSON(), expectation.asJSON);
- assert.strictEqual(unit.isDelta, expectation.isDelta);
- assert.strictEqual(unit.baseUnit, expectation.baseUnit);
- assert.strictEqual(unit.correspondingDeltaUnit,
- expectation.correspondingDeltaUnit);
- assert.strictEqual(unit.improvementDirection,
- expectation.improvementDirection);
- assert.deepEqual(SOURCE_VALUES.map(v => unit.format(v)),
- expectation.formattedValues);
- }
-
- // Regular (non-delta).
- checkSizeUnit(Unit.byName.sizeInBytes, {
- unitName: 'sizeInBytes',
- asJSON: 'sizeInBytes',
- isDelta: false,
- baseUnit: Unit.byName.sizeInBytes,
- correspondingDeltaUnit: Unit.byName.sizeInBytesDelta,
- improvementDirection: ImprovementDirection.DONT_CARE,
- formattedValues: EXPECTED_REGULAR_FORMATTED_VALUES
- });
- checkSizeUnit(Unit.byName.sizeInBytes_smallerIsBetter, {
- unitName: 'sizeInBytes_smallerIsBetter',
- asJSON: 'sizeInBytes_smallerIsBetter',
- isDelta: false,
- baseUnit: Unit.byName.sizeInBytes,
- correspondingDeltaUnit: Unit.byName.sizeInBytesDelta_smallerIsBetter,
- improvementDirection: ImprovementDirection.SMALLER_IS_BETTER,
- formattedValues: EXPECTED_REGULAR_FORMATTED_VALUES
- });
- checkSizeUnit(Unit.byName.sizeInBytes_biggerIsBetter, {
- unitName: 'sizeInBytes_biggerIsBetter',
- asJSON: 'sizeInBytes_biggerIsBetter',
- isDelta: false,
- baseUnit: Unit.byName.sizeInBytes,
- correspondingDeltaUnit: Unit.byName.sizeInBytesDelta_biggerIsBetter,
- improvementDirection: ImprovementDirection.BIGGER_IS_BETTER,
- formattedValues: EXPECTED_REGULAR_FORMATTED_VALUES
- });
-
- // Delta.
- checkSizeUnit(Unit.byName.sizeInBytesDelta, {
- unitName: 'sizeInBytesDelta',
- asJSON: 'sizeInBytesDelta',
- isDelta: true,
- baseUnit: Unit.byName.sizeInBytes,
- correspondingDeltaUnit: Unit.byName.sizeInBytesDelta,
- improvementDirection: ImprovementDirection.DONT_CARE,
- formattedValues: EXPECTED_DELTA_FORMATTED_VALUES
- });
- checkSizeUnit(Unit.byName.sizeInBytesDelta_smallerIsBetter, {
- unitName: 'sizeInBytesDelta_smallerIsBetter',
- asJSON: 'sizeInBytesDelta_smallerIsBetter',
- isDelta: true,
- baseUnit: Unit.byName.sizeInBytes,
- correspondingDeltaUnit: Unit.byName.sizeInBytesDelta_smallerIsBetter,
- improvementDirection: ImprovementDirection.SMALLER_IS_BETTER,
- formattedValues: EXPECTED_DELTA_FORMATTED_VALUES
- });
- checkSizeUnit(Unit.byName.sizeInBytesDelta_biggerIsBetter, {
- unitName: 'sizeInBytesDelta_biggerIsBetter',
- asJSON: 'sizeInBytesDelta_biggerIsBetter',
- isDelta: true,
- baseUnit: Unit.byName.sizeInBytes,
- correspondingDeltaUnit: Unit.byName.sizeInBytesDelta_biggerIsBetter,
- improvementDirection: ImprovementDirection.BIGGER_IS_BETTER,
- formattedValues: EXPECTED_DELTA_FORMATTED_VALUES
- });
- });
-
- test('context', function() {
- assert.strictEqual(Unit.byName.timeStampInMs.format(0, {}), '0.000 ms');
- assert.strictEqual(Unit.byName.normalizedPercentageDelta.format(1.23456,
- { maximumFractionDigits: 2 }), '+123.46%');
- assert.strictEqual(Unit.byName.powerInWatts.format(999.999,
- { minimumFractionDigits: 5 }), '999.99900 W');
- assert.strictEqual(Unit.byName.powerInWatts_biggerIsBetter.format(8.88,
- { minimumFractionDigits: 1 }), '8.88 W');
- assert.strictEqual(Unit.byName.unitlessNumber.format(0.00789,
- { maximumFractionDigits: 6 }), '0.00789');
- assert.strictEqual(Unit.byName.unitlessNumber.format(41.9,
- { maximumFractionDigits: 0 }), '42');
- assert.strictEqual(
- Unit.byName.energyInJoules.format(0.4444,
- { minimumFractionDigits: 2, maximumFractionDigits: 3 }),
- '0.444 J');
- assert.strictEqual(
- Unit.byName.energyInJoules.format(0.6,
- { minimumFractionDigits: 2, maximumFractionDigits: 3 }),
- '0.60 J');
- assert.strictEqual(
- Unit.byName.sizeInBytesDelta_smallerIsBetter.format(0,
- { minimumFractionDigits: 1, maximumFractionDigits: 1 }),
- '\u00B10.0 B');
- assert.strictEqual(
- Unit.byName.sizeInBytes.format(25600000000,
- { unitPrefix: UnitScale.Binary.KIBI }),
- '25,000,000.0 KiB');
- assert.strictEqual(
- Unit.byName.sizeInBytes.format(5243,
- { unitPrefix: UnitScale.Binary.MEBI, minimumFractionDigits: 2 }),
- '0.01 MiB');
- });
-
- test('energyInJoules', function() {
- assert.equal(Unit.byName.energyInJoules.format(1000), '1,000.000 J');
- assert.equal(Unit.byName.energyInJoules.format(1), '1.000 J');
- assert.equal(Unit.byName.energyInJoules.format(.005), '0.005 J');
- assert.equal(Unit.byName.energyInJoules.format(.0005), '0.001 J');
- assert.equal(Unit.byName.energyInJoules.format(.0004), '0.000 J');
- });
-
- test('powerInWatts', function() {
- assert.equal(Unit.byName.powerInWatts.format(1000), '1,000.000 W');
- assert.equal(Unit.byName.powerInWatts.format(1), '1.000 W');
- assert.equal(Unit.byName.powerInWatts.format(.001), '0.001 W');
- assert.equal(Unit.byName.powerInWatts.format(.001005), '0.001 W');
- });
-
- test('unitlessNumber', function() {
- assert.equal(Unit.byName.unitlessNumber.format(1), '1.000');
- assert.equal(Unit.byName.unitlessNumber.format(1.23), '1.230');
- assert.equal(Unit.byName.unitlessNumber.format(-1.23), '-1.230');
- assert.equal(Unit.byName.unitlessNumber.format(0), '0.000');
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/value.html b/chromium/third_party/catapult/tracing/tracing/value/value.html
deleted file mode 100644
index 9b9c79052fb..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/value.html
+++ /dev/null
@@ -1,232 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2015 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/guid.html">
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/value/diagnostics/diagnostic_map.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.v', function() {
- /** @constructor */
- function Value(name, opt_options) {
- if (typeof(name) !== 'string')
- throw new Error('name must be a string');
-
- this.name_ = name;
-
- // If this Value is being deserialized, then its guid will be set by
- // fromDict().
- // If this Value is being computed by a metric, then its guid will be
- // allocated the first time the guid is gotten by asDict().
- this.guid_ = undefined;
-
- this.diagnostics = new tr.v.d.DiagnosticMap();
-
- var options = opt_options || {};
- this.description = options.description;
- this.important = options.important !== undefined ?
- options.important : false;
- }
-
- Value.fromDict = function(d) {
- var value = undefined;
- switch (d.type) {
- case 'numeric':
- value = NumericValue.fromDict(d);
- break;
-
- case 'dict':
- value = DictValue.fromDict(d);
- break;
-
- case 'failure':
- value = FailureValue.fromDict(d);
- break;
-
- case 'skip':
- value = SkipValue.fromDict(d);
- break;
-
- default:
- throw new Error('Not implemented');
- }
-
- value.guid = d.guid;
- value.diagnostics.addDicts(d.diagnostics);
- return value;
- };
-
- Value.prototype = {
- get guid() {
- if (this.guid_ === undefined)
- this.guid_ = tr.b.GUID.allocateUUID4();
-
- return this.guid_;
- },
-
- set guid(guid) {
- if (this.guid_ !== undefined)
- throw new Error('Cannot reset guid');
-
- this.guid_ = guid;
- },
-
- get name() {
- return this.name_;
- },
-
- asDict: function() {
- return this.asJSON();
- },
-
- asJSON: function() {
- var d = {
- guid: this.guid,
- name: this.name_,
- description: this.description,
- important: this.important,
- diagnostics: this.diagnostics.asDict()
- };
-
- this.asDictInto_(d);
- if (d.type === undefined)
- throw new Error('asDictInto_ must set type field');
- return d;
- },
-
- asDictInto_: function(d) {
- throw new Error('Not implemented');
- }
- };
-
- /** @constructor */
- function NumericValue(name, numeric, opt_options) {
- if (!(numeric instanceof tr.v.NumericBase))
- throw new Error('Expected numeric to be instance of tr.v.NumericBase');
-
- Value.call(this, name, opt_options);
- this.numeric = numeric;
- }
-
- NumericValue.fromDict = function(d) {
- if (d.numeric === undefined)
- throw new Error('Expected numeric to be provided');
- var numeric = tr.v.NumericBase.fromDict(d.numeric);
- var value = new NumericValue(d.name, numeric, d);
- return value;
- };
-
- NumericValue.prototype = {
- __proto__: Value.prototype,
-
- asDictInto_: function(d) {
- d.type = 'numeric';
- d.numeric = this.numeric.asDict();
- }
- };
-
- /** @constructor */
- function DictValue(name, value, opt_options) {
- Value.call(this, name, opt_options);
- this.value = value;
- }
-
- DictValue.fromDict = function(d) {
- if (d.units !== undefined)
- throw new Error('Expected units to be undefined');
- if (d.value === undefined)
- throw new Error('Expected value to be provided');
- var value = new DictValue(d.name, d.value, d);
- return value;
- };
-
- DictValue.prototype = {
- __proto__: Value.prototype,
-
- asDictInto_: function(d) {
- d.type = 'dict';
- d.value = this.value;
- }
- };
-
- /** @constructor */
- function FailureValue(name, opt_options) {
- var options = opt_options || {};
-
- var stack;
- if (options.stack === undefined) {
- if (options.stack_str === undefined) {
- throw new Error('Expected stack_str or stack to be provided');
- } else {
- stack = options.stack_str;
- }
- } else {
- stack = options.stack;
- }
-
- if (typeof stack !== 'string')
- throw new Error('stack must be provided as a string');
-
- Value.call(this, name, options);
- this.stack = stack;
- }
-
- FailureValue.fromError = function(e) {
- var ex = tr.b.normalizeException(e);
- return new FailureValue(ex.typeName, {
- description: ex.message, stack: ex.stack});
- };
-
- FailureValue.fromDict = function(d) {
- if (d.units !== undefined)
- throw new Error('Expected units to be undefined');
- if (d.stack_str === undefined)
- throw new Error('Expected stack_str to be provided');
- return new FailureValue(d.name, d);
- };
-
- FailureValue.prototype = {
- __proto__: Value.prototype,
-
- asDictInto_: function(d) {
- d.type = 'failure';
- d.stack_str = this.stack;
- }
- };
-
- /** @constructor */
- function SkipValue(name, opt_options) {
- Value.call(this, name, opt_options);
- }
-
- SkipValue.fromDict = function(d) {
- if (d.units !== undefined)
- throw new Error('Expected units to be undefined');
- return new SkipValue(d.name, d);
- };
-
- SkipValue.prototype = {
- __proto__: Value.prototype,
-
- asDictInto_: function(d) {
- d.type = 'skip';
- }
- };
-
-
- return {
- Value: Value,
- NumericValue: NumericValue,
- DictValue: DictValue,
- FailureValue: FailureValue,
- SkipValue: SkipValue
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/value_set.html b/chromium/third_party/catapult/tracing/tracing/value/value_set.html
deleted file mode 100644
index fe33b1fe898..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/value_set.html
+++ /dev/null
@@ -1,169 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/iteration_helpers.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.exportTo('tr.v', function() {
- var SUMMARY_VALUE_MAP_DIAGNOSTIC_NAME = 'summary values';
- var ITERATION_INFO_DIAGNOSTIC_NAME = 'iteration';
-
- function ValueSet(opt_values) {
- this.values_ = {};
-
- if (opt_values !== undefined)
- opt_values.forEach(this.addValue, this);
- }
-
- ValueSet.prototype = {
- get valueDicts() {
- return this.map(function(v) {
- return v.asDict();
- });
- },
-
- lookup: function(guid) {
- return this.values_[guid];
- },
-
- /**
- * @param {!function(!tr.v.Value):*} callback
- * @param {*=} opt_this
- */
- map: function(callback, opt_this) {
- return tr.b.dictionaryValues(this.values_).map(
- callback, opt_this || this);
- },
-
- get organizedByName() {
- return this.getValuesOrganizedByCallback(function(value) {
- return value.name;
- });
- },
-
- /**
- * @param {!function(!tr.v.Value):*} callback
- * @param {*=} opt_this
- * @return {!Object}
- */
- getValuesOrganizedByCallback: function(callback, opt_this) {
- var valuesByCallback = {};
- tr.b.iterItems(this.values_, function(guid, value) {
- var key = callback.call(opt_this || this, value);
- if (key === undefined)
- return;
- if (valuesByCallback[key] === undefined)
- valuesByCallback[key] = [];
- valuesByCallback[key].push(value);
- });
- return valuesByCallback;
- },
-
- /**
- * Convert Values from dicts and add them.
- * Resolve RelatedValueSet references.
- *
- * @param {Array.<Object>} dicts
- */
- addValuesFromDicts: function(dicts) {
- dicts.forEach(function(dict) {
- var value = tr.v.Value.fromDict(dict);
- this.addValue(value);
- }, this);
-
- // Now resolve the RelatedValueSet references between values.
- // This resolution process must wait until all new values are added in
- // case a value refers to another that comes after it in dicts.
- // Iterate over all values, old and new, in case an old value contained a
- // reference to a new value. Don't worry, resolve() is idempotent.
- // The expected running time is this: for each value (hundreds to
- // thousands?), for each diagnostic that is a RelatedValueSet (0-5?), for
- // each ValueRef (0-10?), do a hash lookup (constant time?).
- tr.b.iterItems(this.values_, function(guid, value) {
- value.diagnostics.forEach(function(name, diagnostic) {
- if ((diagnostic instanceof tr.v.d.RelatedValueSet) ||
- (diagnostic instanceof tr.v.d.RelatedValueMap))
- diagnostic.resolve(this);
- }, this);
- }, this);
- },
-
- /**
- * Find the Values that are not contained in any other Values'
- * RelatedValueSet or RelatedValueMap diagnostics.
- *
- * @return {!Array.<!tr.v.Value>}
- */
- get sourceValues() {
- var sourceValues = tr.b.cloneDictionary(this.values_);
- // If a Value is in a RelatedValueSet or RelatedValueMap, then it is not a
- // source Value.
- this.map(function(value) {
- value.diagnostics.forEach(function(name, diagnostic) {
- if ((diagnostic instanceof tr.v.d.RelatedValueSet) ||
- (diagnostic instanceof tr.v.d.RelatedValueMap)) {
- diagnostic.values.forEach(function(relatedValue) {
- delete sourceValues[relatedValue.guid];
- });
- }
- }, this);
- }, this);
- return tr.b.dictionaryValues(sourceValues);
- },
-
- getValuesWithName: function(name) {
- return tr.b.dictionaryValues(this.values_).filter(function(value) {
- return value.name.indexOf(name) > -1;
- });
- },
-
- addValue: function(v) {
- if (this.values_[v.guid]) {
- var err = new Error('Tried to add same value twice');
- err.name = 'ValueError';
- throw err;
- }
-
- this.values_[v.guid] = v;
-
- if (v.numeric instanceof tr.v.Numeric) {
- ValueSet.computeSummaryValuesForNumericValue(v).forEach(function(s) {
- this.addValue(s);
- }, this);
- }
- }
- };
-
- ValueSet.computeSummaryValuesForNumericValue = function(value) {
- if (!(value instanceof tr.v.NumericValue &&
- value.numeric instanceof tr.v.Numeric))
- throw new Error('Tried to compute summary values for non-numeric');
-
- var summaryValueMap = new tr.v.d.RelatedValueMap();
- value.diagnostics.add(SUMMARY_VALUE_MAP_DIAGNOSTIC_NAME, summaryValueMap);
- var options = {description: value.description};
- var stats = value.numeric.getSummarizedScalarNumericsWithNames();
- return stats.map(function(stat) {
- var summaryValue = new tr.v.NumericValue(
- value.name + '_' + stat.name, stat.scalar, options);
- summaryValueMap.set(stat.name, summaryValue);
- return summaryValue;
- });
- };
-
- return {
- SUMMARY_VALUE_MAP_DIAGNOSTIC_NAME: SUMMARY_VALUE_MAP_DIAGNOSTIC_NAME,
- ITERATION_INFO_DIAGNOSTIC_NAME: ITERATION_INFO_DIAGNOSTIC_NAME,
- ValueSet: ValueSet
- };
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/value_set_test.html b/chromium/third_party/catapult/tracing/tracing/value/value_set_test.html
deleted file mode 100644
index a1b48e5e864..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/value_set_test.html
+++ /dev/null
@@ -1,180 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2016 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/range.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/value_set.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('computeSummaryValuesForNumericValue', function() {
- var n = tr.v.NumericBuilder.createLinear(
- tr.v.Unit.byName.timeDurationInMs, tr.b.Range.fromExplicitRange(0, 100),
- 100).build();
-
- n.add(50);
- n.add(60);
- n.add(70);
-
- n.customizeSummaryOptions({
- count: true,
- min: true,
- max: true,
- sum: true,
- avg: true,
- std: true,
- percentile: [0.5, 1]
- });
-
- var results =
- tr.v.ValueSet.computeSummaryValuesForNumericValue(
- new tr.v.NumericValue('abc', n, { description: 'desc' }));
- var values = {};
- results.forEach(function(x) {
- values[x.name] = x.numeric;
- });
- assert.strictEqual(values.abc_count.value, 3);
- assert.strictEqual(values.abc_min.value, 50);
- assert.strictEqual(values.abc_max.value, 70);
- assert.strictEqual(values.abc_sum.value, 180);
- assert.strictEqual(values.abc_avg.value, 60);
- assert.strictEqual(values.abc_std.value, 10);
- assert.closeTo(values.abc_pct_050.value, 60, 1);
- assert.closeTo(values.abc_pct_100.value, 70, 1);
- });
-
- test('relatedValueSetDiagnostic', function() {
- var unit = tr.v.Unit.byName.unitlessNumber;
- var a = new tr.v.NumericValue('a', new tr.v.ScalarNumeric(unit, 0));
- var b = new tr.v.NumericValue('b', new tr.v.ScalarNumeric(unit, 1));
- var c = new tr.v.NumericValue('c', new tr.v.ScalarNumeric(unit, 2));
- a.diagnostics.add('rvs', new tr.v.d.RelatedValueSet([b, c]));
-
- // Don't serialize c just yet.
- var values = new tr.v.ValueSet([a, b]);
-
- var sourceValues = values.sourceValues;
- assert.lengthOf(sourceValues, 1);
- assert.strictEqual(sourceValues[0], a);
-
- var values2 = new tr.v.ValueSet();
- values2.addValuesFromDicts(values.valueDicts);
-
- var a2 = values2.getValuesWithName('a');
- assert.lengthOf(a2, 1);
- a2 = a2[0];
- assert.strictEqual(a2.guid, a.guid);
- assert.instanceOf(a2, tr.v.Value);
- assert.notStrictEqual(a2, a);
-
- var b2 = values2.getValuesWithName('b');
- assert.lengthOf(b2, 1);
- b2 = b2[0];
- assert.strictEqual(b2.guid, b.guid);
- assert.instanceOf(b2, tr.v.Value);
- assert.notStrictEqual(b2, b);
-
- var rvs2 = a2.diagnostics.get('rvs');
- assert.instanceOf(rvs2, tr.v.d.RelatedValueSet);
- assert.lengthOf(rvs2.values, 2);
-
- // Assert that b and c are in a2's RelatedValueSet.
- var rvs2vs = rvs2.values;
- var rvs2guids = rvs2vs.map(v => v.guid);
- var b2i = rvs2guids.indexOf(b.guid);
- assert.strictEqual(rvs2vs[b2i], b2);
-
- var c2i = rvs2guids.indexOf(c.guid);
- assert.strictEqual(rvs2vs[c2i].guid, c.guid);
- assert.instanceOf(rvs2vs[c2i], tr.v.d.ValueRef);
-
- // Now serialize c and add it to values2.
- // Related value resolution is idempotent.
- // Old values can refer to new values.
- values2.addValuesFromDicts([c.asDict()]);
-
- var c2 = values2.getValuesWithName('c');
- assert.lengthOf(c2, 1);
- c2 = c2[0];
- assert.strictEqual(c2.guid, c.guid);
- assert.notStrictEqual(c2, c);
-
- // Now a real c2 Value should be in a2's RelatedValueSet.
- rvs2vs = rvs2.values;
- rvs2guids = rvs2vs.map(v => v.guid);
- b2i = rvs2guids.indexOf(b.guid);
- c2i = rvs2guids.indexOf(c.guid);
- assert.strictEqual(b2, rvs2vs[b2i]);
- assert.strictEqual(c2, rvs2vs[c2i]);
- });
-
- test('relatedValueMapDiagnostic', function() {
- var unit = tr.v.Unit.byName.unitlessNumber;
- var a = new tr.v.NumericValue('a', new tr.v.ScalarNumeric(unit, 0));
- var b = new tr.v.NumericValue('b', new tr.v.ScalarNumeric(unit, 1));
- var c = new tr.v.NumericValue('c', new tr.v.ScalarNumeric(unit, 2));
- var rvm = new tr.v.d.RelatedValueMap();
- rvm.set('y', b);
- rvm.set('z', c);
- a.diagnostics.add('rvm', rvm);
-
- // Don't serialize c just yet.
- var values = new tr.v.ValueSet([a, b]);
-
- var sourceValues = values.sourceValues;
- assert.lengthOf(sourceValues, 1);
- assert.strictEqual(sourceValues[0], a);
-
- var values2 = new tr.v.ValueSet();
- values2.addValuesFromDicts(values.valueDicts);
-
- var a2 = values2.getValuesWithName('a');
- assert.lengthOf(a2, 1);
- a2 = a2[0];
- assert.strictEqual(a2.guid, a.guid);
- assert.instanceOf(a2, tr.v.Value);
- assert.notStrictEqual(a2, a);
-
- var b2 = values2.getValuesWithName('b');
- assert.lengthOf(b2, 1);
- b2 = b2[0];
- assert.strictEqual(b2.guid, b.guid);
- assert.instanceOf(b2, tr.v.Value);
- assert.notStrictEqual(b2, b);
-
- var rvm2 = a2.diagnostics.get('rvm');
- assert.instanceOf(rvm2, tr.v.d.RelatedValueMap);
- assert.lengthOf(rvm2.values, 2);
-
- // Assert that b and c are in a2's RelatedValueMap.
- // |c| should still be a ValueRef since it wasn't in values2.
- assert.strictEqual(rvm2.get('y'), b2);
- assert.instanceOf(rvm2.get('z'), tr.v.d.ValueRef);
-
- // Now serialize c and add it to values2.
- // Related value resolution is idempotent.
- // Old values can refer to new values.
- values2.addValuesFromDicts([c.asDict()]);
-
- var c2 = values2.getValuesWithName('c');
- assert.lengthOf(c2, 1);
- c2 = c2[0];
- assert.strictEqual(c2.guid, c.guid);
- assert.instanceOf(c2, tr.v.Value);
- assert.notStrictEqual(c2, c);
-
- // b2 should still be in a2's RelatedValueMap.
- assert.strictEqual(rvm2.get('y'), b2);
-
- // Now a real c2 Value should be in a2's RelatedValueMap.
- assert.strictEqual(rvm2.get('z'), c2);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/value_test.html b/chromium/third_party/catapult/tracing/tracing/value/value_test.html
deleted file mode 100644
index 07e73b030ee..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/value_test.html
+++ /dev/null
@@ -1,92 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright (c) 2013 The Chromium Authors. All rights reserved.
-Use of this source code is governed by a BSD-style license that can be
-found in the LICENSE file.
--->
-
-<link rel="import" href="/tracing/base/utils.html">
-<link rel="import" href="/tracing/value/numeric.html">
-<link rel="import" href="/tracing/value/unit.html">
-<link rel="import" href="/tracing/value/value.html">
-
-<script>
-'use strict';
-
-tr.b.unittest.testSuite(function() {
- test('numericValueBasic', function() {
- var n = new tr.v.ScalarNumeric(tr.v.Unit.byName.sizeInBytes, 314);
- var v = new tr.v.NumericValue('MyNumeric', n);
- assert.isDefined(v.guid);
- var d = v.asDict();
-
- var v2 = tr.v.Value.fromDict(d);
- assert.instanceOf(v2, tr.v.NumericValue);
- assert.equal(v.guid, v2.guid);
- assert.equal(v.name, v2.name);
- assert.equal(v.numeric.value, v2.numeric.value);
- });
-
- test('dictValueBasic', function() {
- var v = new tr.v.DictValue('MyDict', {my_key: 'my_value'});
- assert.isDefined(v.guid);
- var d = v.asDict();
-
- var v2 = tr.v.Value.fromDict(d);
- assert.instanceOf(v2, tr.v.DictValue);
- assert.equal(v.guid, v2.guid);
- assert.deepEqual(v.value, v2.value);
- });
-
- test('failureValueBasic', function() {
- var v = new tr.v.FailureValue(
- 'MyFailure',
- {description: 'Description', stack: tr.b.stackTraceAsString()});
- assert.isDefined(v.guid);
- var d = v.asDict();
-
- var v2 = tr.v.Value.fromDict(d);
- assert.instanceOf(v2, tr.v.FailureValue);
- assert.equal(v.guid, v2.guid);
- assert.equal(v.name, v2.name);
- assert.equal(v.description, v2.description);
- assert.equal(v.stack, v2.stack);
- });
-
- test('skipValueBasic', function() {
- var v = new tr.v.SkipValue('MySkip',
- {description: 'WhySkipped'});
- assert.isDefined(v.guid);
- var d = v.asDict();
-
- var v2 = tr.v.Value.fromDict(d);
- assert.equal(v.guid, v2.guid);
- assert.instanceOf(v2, tr.v.SkipValue);
- assert.equal(v.description, v2.description);
- });
-
- test('genericDiagnostic', function() {
- var skip = new tr.v.SkipValue('skip');
- skip.diagnostics.add('foo', new tr.v.d.Generic({
- t: true,
- f: false,
- z: 0,
- o: 1,
- ans: 0.42,
- s: 'string',
- a: [42.42, 'more string'],
- d: {a: {b: 'c'}}
- }));
- var skip2 = tr.v.Value.fromDict(skip.asDict());
- var foo2 = skip2.diagnostics.get('foo');
- assert.strictEqual(true, foo2.value.t);
- assert.strictEqual(false, foo2.value.f);
- assert.strictEqual(0, foo2.value.z);
- assert.strictEqual(1, foo2.value.o);
- assert.strictEqual(0.42, foo2.value.ans);
- assert.strictEqual('string', foo2.value.s);
- assert.deepEqual([42.42, 'more string'], foo2.value.a);
- assert.deepEqual({a: {b: 'c'}}, foo2.value.d);
- });
-});
-</script>
diff --git a/chromium/third_party/catapult/tracing/tracing/value/value_unittest.py b/chromium/third_party/catapult/tracing/tracing/value/value_unittest.py
deleted file mode 100644
index 88ffbc32382..00000000000
--- a/chromium/third_party/catapult/tracing/tracing/value/value_unittest.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright (c) 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-import unittest
-
-from tracing import value as value_module
-
-
-class ValueTests(unittest.TestCase):
-
- def testScalar(self):
- d = {
- 'canonical_url': '/a.json',
- 'type': 'scalar',
- 'name': 'MyScalarValue',
- 'important': False,
- 'value': {'a': 1, 'b': 'b'}
- }
- v = value_module.Value.FromDict(d)
- self.assertTrue(isinstance(v, value_module.ScalarValue))
- d2 = v.AsDict()
-
- self.assertEquals(d, d2)
-
- def testDict(self):
- d = {
- 'canonical_url': '/a.json',
- 'type': 'dict',
- 'name': 'MyDictValue',
- 'important': False,
- 'value': {'a': 1, 'b': 'b'}
- }
- v = value_module.Value.FromDict(d)
- self.assertTrue(isinstance(v, value_module.DictValue))
- d2 = v.AsDict()
-
- self.assertEquals(d, d2)
-
- def testFailure(self):
- d = {
- 'canonical_url': '/a.json',
- 'type': 'failure',
- 'name': 'Error',
- 'important': False,
- 'description': 'Some error message',
- 'stack_str': 'Some stack string'
- }
- v = value_module.Value.FromDict(d)
- self.assertTrue(isinstance(v, value_module.FailureValue))
- d2 = v.AsDict()
-
- self.assertEquals(d, d2)
diff --git a/chromium/third_party/catapult/tracing/tracing_build/__init__.py b/chromium/third_party/catapult/tracing/tracing_build/__init__.py
deleted file mode 100644
index 22060c5dca2..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/__init__.py
+++ /dev/null
@@ -1,7 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-
-import tracing_project
-tracing_project.UpdateSysPathIfNeeded()
diff --git a/chromium/third_party/catapult/tracing/tracing_build/check_common.py b/chromium/third_party/catapult/tracing/tracing_build/check_common.py
deleted file mode 100644
index b49513f6d61..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/check_common.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# Copyright (c) 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-
-import tracing_project
-
-
-FILE_GROUPS = ["tracing_css_files",
- "tracing_js_html_files",
- "tracing_img_files"]
-
-
-def GetFileGroupFromFileName(filename):
- extension = os.path.splitext(filename)[1]
- return {
- '.css': 'tracing_css_files',
- '.html': 'tracing_js_html_files',
- '.js': 'tracing_js_html_files',
- '.png': 'tracing_img_files'
- }[extension]
-
-
-def CheckListedFilesSorted(src_file, group_name, listed_files):
- sorted_files = sorted(listed_files)
- if sorted_files != listed_files:
- mismatch = ''
- for i in range(len(listed_files)):
- if listed_files[i] != sorted_files[i]:
- mismatch = listed_files[i]
- break
- what_is = ' ' + '\n '.join(listed_files)
- what_should_be = ' ' + '\n '.join(sorted_files)
- return '''In group {0} from file {1}, filenames aren't sorted.
-
-First mismatch:
- {2}
-
-Current listing:
-{3}
-
-Correct listing:
-{4}\n\n'''.format(group_name, src_file, mismatch, what_is, what_should_be)
- else:
- return ''
-
-
-def GetKnownFiles():
- project = tracing_project.TracingProject()
-
- vulcanizer = project.CreateVulcanizer()
- m = vulcanizer.loader.LoadModule(
- module_name='tracing.ui.extras.about_tracing.about_tracing')
- absolute_filenames = m.GetAllDependentFilenamesRecursive(
- include_raw_scripts=False)
-
- return list(set([os.path.relpath(f, project.tracing_root_path)
- for f in absolute_filenames]))
-
-
-def CheckCommon(file_name, listed_files):
- known_files = GetKnownFiles()
- u = set(listed_files).union(set(known_files))
- i = set(listed_files).intersection(set(known_files))
- diff = list(u - i)
-
- if len(diff) == 0:
- return ''
-
- error = 'Entries in ' + file_name + ' do not match files on disk:\n'
- in_file_only = list(set(listed_files) - set(known_files))
- in_known_only = list(set(known_files) - set(listed_files))
-
- if len(in_file_only) > 0:
- error += ' In file only:\n ' + '\n '.join(sorted(in_file_only))
- if len(in_known_only) > 0:
- if len(in_file_only) > 0:
- error += '\n\n'
- error += ' On disk only:\n ' + '\n '.join(sorted(in_known_only))
-
- if in_file_only:
- error += (
- '\n\n'
- ' Note: only files actually used in about:tracing should\n'
- ' be listed in the build files. Try running \n'
- ' tracing/bin/update_gyp_and_gn\n'
- ' to update the files automatically.')
-
- return error
diff --git a/chromium/third_party/catapult/tracing/tracing_build/check_common_unittest.py b/chromium/third_party/catapult/tracing/tracing_build/check_common_unittest.py
deleted file mode 100644
index b3af7b6fb68..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/check_common_unittest.py
+++ /dev/null
@@ -1,29 +0,0 @@
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import unittest
-
-from tracing_build import check_common
-
-
-class CheckCommonUnitTest(unittest.TestCase):
-
- def testFilesSorted(self):
- error = check_common.CheckListedFilesSorted('foo.gyp', 'tracing_pdf_files',
- ['/dir/file.pdf',
- '/dir/another_file.pdf'])
- expected_error = '''In group tracing_pdf_files from file foo.gyp,\
- filenames aren't sorted.
-
-First mismatch:
- /dir/file.pdf
-
-Current listing:
- /dir/file.pdf
- /dir/another_file.pdf
-
-Correct listing:
- /dir/another_file.pdf
- /dir/file.pdf\n\n'''
- assert error == expected_error
diff --git a/chromium/third_party/catapult/tracing/tracing_build/check_gypi.py b/chromium/third_party/catapult/tracing/tracing_build/check_gypi.py
deleted file mode 100644
index fb59626816b..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/check_gypi.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# Copyright (c) 2013 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import os
-
-from tracing_build import check_common
-
-GYPI_FILE = os.path.abspath(os.path.join(os.path.dirname(__file__),
- '..', 'trace_viewer.gypi'))
-
-
-def GypiCheck():
- f = open(GYPI_FILE, 'r')
- gyp = f.read()
- f.close()
-
- data = eval(gyp) # pylint: disable=eval-used
- listed_files = []
- error = ''
- for group in check_common.FILE_GROUPS:
- filenames = map(os.path.normpath, data['variables'][group])
- error += check_common.CheckListedFilesSorted(GYPI_FILE, group, filenames)
- listed_files.extend(filenames)
-
- return error + check_common.CheckCommon(GYPI_FILE, listed_files)
-
-
-if __name__ == '__main__':
- print GypiCheck()
diff --git a/chromium/third_party/catapult/tracing/tracing_build/generate_about_tracing_contents.py b/chromium/third_party/catapult/tracing/tracing_build/generate_about_tracing_contents.py
deleted file mode 100644
index 333fca19021..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/generate_about_tracing_contents.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import codecs
-import argparse
-import os
-import sys
-
-import py_vulcanize
-
-import tracing_project
-
-
-def Main(args):
- parser = argparse.ArgumentParser(usage='%(prog)s --outdir=<directory>')
- parser.add_argument('--outdir', dest='out_dir',
- help='Where to place generated content')
- parser.add_argument('--no-min', default=False, action='store_true',
- help='Skip minification')
- args = parser.parse_args(args)
-
- if not args.out_dir:
- sys.stderr.write('ERROR: Must specify --outdir=<directory>')
- parser.print_help()
- return 1
-
- names = ['tracing.ui.extras.about_tracing.about_tracing']
- project = tracing_project.TracingProject()
-
- vulcanizer = project.CreateVulcanizer()
- load_sequence = vulcanizer.CalcLoadSequenceForModuleNames(names)
-
- olddir = os.getcwd()
- try:
- if not os.path.exists(args.out_dir):
- os.makedirs(args.out_dir)
- o = codecs.open(os.path.join(args.out_dir, 'about_tracing.html'), 'w',
- encoding='utf-8')
- try:
- py_vulcanize.GenerateStandaloneHTMLToFile(
- o,
- load_sequence,
- title='chrome://tracing',
- flattened_js_url='tracing.js',
- minify=not args.no_min)
- except py_vulcanize.module.DepsException, ex:
- sys.stderr.write('Error: %s\n\n' % str(ex))
- return 255
- o.close()
-
- o = codecs.open(os.path.join(args.out_dir, 'about_tracing.js'), 'w',
- encoding='utf-8')
- assert o.encoding == 'utf-8'
- py_vulcanize.GenerateJSToFile(
- o,
- load_sequence,
- use_include_tags_for_scripts=False,
- dir_for_include_tag_root=args.out_dir,
- minify=not args.no_min)
- o.close()
-
- finally:
- os.chdir(olddir)
-
- return 0
diff --git a/chromium/third_party/catapult/tracing/tracing_build/generate_about_tracing_contents_unittest.py b/chromium/third_party/catapult/tracing/tracing_build/generate_about_tracing_contents_unittest.py
deleted file mode 100644
index dd31b7ec344..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/generate_about_tracing_contents_unittest.py
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import unittest
-import tempfile
-import shutil
-
-from tracing_build import generate_about_tracing_contents
-
-
-class GenerateAboutTracingContentsUnittTest(unittest.TestCase):
-
- def testSmoke(self):
- try:
- tmpdir = tempfile.mkdtemp()
- res = generate_about_tracing_contents.Main(['--outdir', tmpdir])
- assert res == 0
- finally:
- shutil.rmtree(tmpdir)
diff --git a/chromium/third_party/catapult/tracing/tracing_build/html2trace.py b/chromium/third_party/catapult/tracing/tracing_build/html2trace.py
deleted file mode 100644
index 1acab58d5d6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/html2trace.py
+++ /dev/null
@@ -1,96 +0,0 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import base64
-import codecs
-import gzip
-import json
-import re
-import StringIO
-
-
-GZIP_HEADER_BYTES = b'\x1f\x8b'
-
-
-# Regular expressions for matching the beginning and end of trace data in HTML
-# traces. See tracing/extras/importer/trace2html_importer.html.
-TRACE_DATA_START_LINE_RE = re.compile(
- r'^<\s*script id="viewer-data" type="(application\/json|text\/plain)">$')
-TRACE_DATA_END_LINE_RE = re.compile(r'^<\/\s*script>$')
-
-
-def CopyTraceDataFromHTMLFilePath(html_path, trace_path, gzipped_output=False):
- """Copies trace data from an existing HTML file into new trace file(s).
-
- If |html_path| doesn't contain any trace data blocks, this function throws an
- exception. If |html_path| contains more than one trace data block, the first
- block will be extracted into |trace_path| and the rest will be extracted
- into separate files |trace_path|.1, |trace_path|.2, etc.
-
- The contents of each trace data block is decoded and, if |gzipped_output| is
- false, inflated before it's stored in a trace file.
-
- This function returns a list of paths of the saved trace files ([|trace_path|,
- |trace_path|.1, |trace_path|.2, ...]).
- """
- trace_data_list = _ExtractTraceDataFromHTMLFile(html_path,
- unzip_data=not gzipped_output)
- saved_paths = []
- for i, trace_data in enumerate(trace_data_list):
- saved_path = trace_path if i == 0 else '%s.%d' % (trace_path, i)
- saved_paths.append(saved_path)
- with open(saved_path, 'wb' if gzipped_output else 'w') as trace_file:
- trace_file.write(trace_data.read())
- return saved_paths
-
-
-def ReadTracesFromHTMLFilePath(html_path):
- """Returns a list of inflated JSON traces extracted from an HTML file."""
- return map(json.load, _ExtractTraceDataFromHTMLFile(html_path))
-
-
-def _ExtractTraceDataFromHTMLFile(html_path, unzip_data=True):
- with codecs.open(html_path, mode='r', encoding='utf-8') as html_file:
- lines = html_file.readlines()
-
- start_indices = [i for i in xrange(len(lines))
- if TRACE_DATA_START_LINE_RE.match(lines[i])]
- if not start_indices:
- raise Exception('File %r does not contain trace data')
-
- decoded_data_list = []
- for start_index in start_indices:
- end_index = next(i for i in xrange(start_index + 1, len(lines))
- if TRACE_DATA_END_LINE_RE.match(lines[i]))
- encoded_data = '\n'.join(lines[start_index + 1:end_index]).strip()
- decoded_data_list.append(StringIO.StringIO(base64.b64decode(encoded_data)))
-
- if unzip_data:
- return map(_UnzipFileIfNecessary, decoded_data_list)
- else:
- return map(_ZipFileIfNecessary, decoded_data_list)
-
-
-def _UnzipFileIfNecessary(original_file):
- if _IsFileZipped(original_file):
- return gzip.GzipFile(fileobj=original_file)
- else:
- return original_file
-
-
-def _ZipFileIfNecessary(original_file):
- if _IsFileZipped(original_file):
- return original_file
- else:
- zipped_file = StringIO.StringIO()
- with gzip.GzipFile(fileobj=zipped_file, mode='wb') as gzip_wrapper:
- gzip_wrapper.write(original_file.read())
- zipped_file.seek(0)
- return zipped_file
-
-
-def _IsFileZipped(f):
- is_gzipped = f.read(len(GZIP_HEADER_BYTES)) == GZIP_HEADER_BYTES
- f.seek(0)
- return is_gzipped
diff --git a/chromium/third_party/catapult/tracing/tracing_build/merge_traces.py b/chromium/third_party/catapult/tracing/tracing_build/merge_traces.py
deleted file mode 100644
index b107253dcf8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/merge_traces.py
+++ /dev/null
@@ -1,632 +0,0 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import argparse
-import codecs
-import collections
-import gzip
-import itertools
-import json
-import logging
-import os
-import sys
-
-# Add tracing/ to the path.
-sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
-from tracing_build import html2trace, trace2html
-
-
-GZIP_FILENAME_SUFFIX = '.gz'
-HTML_FILENAME_SUFFIX = '.html'
-
-
-# Relevant trace event phases. See
-# https://code.google.com/p/chromium/codesearch#chromium/src/base/trace_event/common/trace_event_common.h.
-METADATA_PHASE = 'M'
-MEMORY_DUMP_PHASE = 'v'
-BEGIN_PHASE = 'B'
-END_PHASE = 'E'
-
-
-# Minimum gap between two consecutive merged traces in microseconds.
-MIN_TRACE_GAP_IN_US = 1000000
-
-
-# Rule for matching IDs in an IdMap. For a given level, |match| should be a
-# named tuple class where its fields determine the importance of |entry._items|
-# for the purposes of matching pairs of IdMap entries.
-IdMapLevel = collections.namedtuple('IdMapLevel', ['name', 'match'])
-
-
-class IdMap(object):
- """Abstract class for merging and mapping IDs from multiple sources."""
-
- # Sub-classes must provide a tuple of |IdMapLevel| objects.
- LEVELS = NotImplemented
-
- def __init__(self, depth=0):
- assert 0 <= depth <= len(self.LEVELS)
- self._depth = depth
-
- if depth > 0:
- # Non-root node.
- self._canonical_id = None
- self._items = collections.defaultdict(set)
- self._sources = set()
-
- if depth < len(self.LEVELS):
- # Non-leaf node.
- self._entry_map = {} # (Source, Entry ID) -> Entry.
-
- @property
- def max_mapped_id(self):
- """The maximum mapped ID of this map's entries."""
- if not self._entry_map:
- return 0
- return max(e._canonical_id for e in self._entry_map.itervalues())
-
- def AddEntry(self, source, path, **items):
- """Add a source-specific entry path to the map.
-
- Args:
- source: The source of the entry (e.g. trace filename).
- path: A path of source-specific entry IDs in the map (e.g. [PID, TID]).
- **items: Dictionary of items (or sets of items) to be appended to the
- target entry's |_items|.
- """
- if path:
- return self._GetSubMapEntry(source, path[0]).AddEntry(source, path[1:],
- **items)
- assert 'id' not in items # ID is set according to the path.
- for key, value in items.iteritems():
- value_set = self._items[key]
- if (isinstance(value, collections.Iterable) and
- not isinstance(value, basestring)):
- value_set.update(value)
- else:
- value_set.add(value)
-
- def MapEntry(self, source, path):
- """Map an source-specific entry ID path to a canonical entry ID path.
-
- Args:
- source: The source of the entry (e.g. trace filename).
- path: A path of source-specific entry IDs in the map (e.g. [PID, TID]).
-
- Returns:
- A path of canonical entry IDs in the map to which the provided path of
- source-specific entry IDs is mapped.
- """
- if not path:
- return ()
- entry = self._entry_map[(source, path[0])]
- return (entry._canonical_id,) + entry.MapEntry(source, path[1:])
-
- def MergeEntries(self):
- """Recursively merge the entries in this map.
-
- Example: Suppose that the following entries were added to the map:
-
- map.AddEntry(source='trace_A.json', path=[10], name='Browser')
- map.AddEntry(source='trace_A.json', path=[20], name='Renderer')
- map.AddEntry(source='trace_B.json', path=[30], name='Browser')
-
- Before merging, |map._entry_map| will contain three separate items:
-
- ('trace_A.json', 10) -> IdMap(_items={id: {10}, name: {'Browser'}},
- _sources={'trace_A.json'})
- ('trace_A.json', 20) -> IdMap(_items={id: {20}, name: {'Renderer'}},
- _sources={'trace_A.json'})
- ('trace_B.json', 30) -> IdMap(_items={id: {30}, name: {'Browser'}},
- _sources={'trace_B.json'})
-
- Since the first two entries come from the same source, they cannot be
- merged. On the other hand, the third entry could be merged with either of
- the first two. Since it has a common name with the first entry, it will be
- merged with it in this method:
-
- ('trace_A.json', 10) -> IdMap(_items={id: {10, 30}, name: {'Browser'}},
- _sources={'trace_A.json', 'trace_B.json'})
- ('trace_A.json', 20) -> IdMap(_items={id: {20}, name: {Renderer}},
- _sources={'trace_A.json'})
- ('trace_B.json', 30) -> <same IdMap as ('trace_A.json', 10)>
-
- Pairs of entries will be merged in a descending order of sizes of
- pair-wise intersections of |entry._items| until there are no two entries
- such that (1) they have at least one value in |entry._items| in common and
- (2) they are mergeable (i.e. have no common source). Afterwards, unique IDs
- are assigned to the resulting "canonical" entries and their sub-entries are
- merged recursively.
- """
- if self._depth == len(self.LEVELS):
- return
-
- logging.debug('Merging %r entries in %s...', self.LEVELS[self._depth].name,
- self)
-
- canonical_entries = self._CanonicalizeEntries()
- self._AssignIdsToCanonicalEntries(canonical_entries)
-
- for entry in canonical_entries:
- entry.MergeEntries()
-
- def _GetSubMapEntry(self, source, entry_id):
- full_id = (source, entry_id)
- entry = self._entry_map.get(full_id)
- if entry is None:
- entry = type(self)(self._depth + 1)
- entry._sources.add(source)
- entry._items['id'].add(entry_id)
- self._entry_map[full_id] = entry
- return entry
-
- def _CalculateUnmergeableMapFromEntrySources(self):
- entry_ids_by_source = collections.defaultdict(set)
- for entry_id, entry in self._entry_map.iteritems():
- for source in entry._sources:
- entry_ids_by_source[source].add(entry_id)
-
- unmergeable_map = collections.defaultdict(set)
- for unmergeable_set in entry_ids_by_source.itervalues():
- for entry_id in unmergeable_set:
- unmergeable_map[entry_id].update(unmergeable_set - {entry_id})
-
- return unmergeable_map
-
- def _IsMergeableWith(self, other):
- return self._sources.isdisjoint(other._sources)
-
- def _GetMatch(self, other):
- match_cls = self.LEVELS[self._depth - 1].match
- return match_cls(*(self._items[f] & other._items[f]
- for f in match_cls._fields))
-
- def _MergeFrom(self, source):
- if self._depth > 0:
- # This is NOT a ROOT node, so we need to merge fields and sources from
- # the source node.
- for key, values in source._items.iteritems():
- self._items[key].update(values)
- self._sources.update(source._sources)
-
- if self._depth < len(self.LEVELS):
- # This is NOT a LEAF node, so we need to copy over entries from the
- # source node's entry map.
- assert not (set(self._entry_map.iterkeys()) &
- set(source._entry_map.iterkeys()))
- self._entry_map.update(source._entry_map)
-
- def _CanonicalizeEntries(self):
- canonical_entries = self._entry_map.copy()
-
- # {ID1, ID2} -> Match between the two entries.
- matches = {frozenset([full_id1, full_id2]): entry1._GetMatch(entry2)
- for full_id1, entry1 in canonical_entries.iteritems()
- for full_id2, entry2 in canonical_entries.iteritems()
- if entry1._IsMergeableWith(entry2)}
-
- while matches:
- # Pop the maximum match from the dictionary.
- max_match_set, max_match = max(matches.iteritems(),
- key=lambda (_, v): map(len, v))
- del matches[max_match_set]
- canonical_full_id, merged_full_id = max_match_set
-
- # Skip pairs of entries that have nothing in common.
- if not any(max_match):
- continue
-
- # Merge the entries and update the map to reflect this.
- canonical_entry = canonical_entries[canonical_full_id]
- merged_entry = canonical_entries.pop(merged_full_id)
- logging.debug('Merging %s into %s [match=%s]...', merged_entry,
- canonical_entry, max_match)
- canonical_entry._MergeFrom(merged_entry)
- del merged_entry
- self._entry_map[merged_full_id] = canonical_entry
-
- for match_set in matches.keys():
- if merged_full_id in match_set:
- # Remove other matches with the merged entry.
- del matches[match_set]
- elif canonical_full_id in match_set:
- [other_full_id] = match_set - {canonical_full_id}
- other_entry = canonical_entries[other_full_id]
- if canonical_entry._IsMergeableWith(other_entry):
- # Update other matches with the canonical entry which are still
- # mergeable.
- matches[match_set] = canonical_entry._GetMatch(other_entry)
- else:
- # Remove other matches with the canonical entry which have become
- # unmergeable.
- del matches[match_set]
-
- return canonical_entries.values()
-
- def _AssignIdsToCanonicalEntries(self, canonical_entries):
- assigned_ids = set()
- canonical_entries_without_assigned_ids = set()
-
- # Try to assign each canonical entry to one of the IDs from which it was
- # merged.
- for canonical_entry in canonical_entries:
- candidate_ids = canonical_entry._items['id']
- try:
- assigned_id = next(candidate_id for candidate_id in candidate_ids
- if candidate_id not in assigned_ids)
- except StopIteration:
- canonical_entries_without_assigned_ids.add(canonical_entry)
- continue
- assigned_ids.add(assigned_id)
- canonical_entry._canonical_id = assigned_id
-
- # For canonical entries where this cannot be done (highly unlikely), scan
- # from the minimal merged ID upwards for the first unassigned ID.
- for canonical_entry in canonical_entries_without_assigned_ids:
- assigned_id = next(candidate_id for candidate_id in
- itertools.count(min(canonical_entry._items['id']))
- if candidate_id not in assigned_ids)
- assigned_ids.add(assigned_id)
- canonical_entry._canonical_id = assigned_id
-
- def __repr__(self):
- cls_name = type(self).__name__
- if self._depth == 0:
- return '%s root' % cls_name
- else:
- return '%s %s entry(%s)' % (cls_name, self.LEVELS[self._depth - 1].name,
- self._items)
-
-
-class ProcessIdMap(IdMap):
- """Class for merging and mapping PIDs and TIDs from multiple sources."""
-
- LEVELS = (
- IdMapLevel(name='process',
- match=collections.namedtuple('ProcessMatch',
- ['name', 'id', 'label'])),
- IdMapLevel(name='thread',
- match=collections.namedtuple('ThreadMatch', ['name', 'id']))
- )
-
-
-def LoadTrace(filename):
- """Load a trace from a (possibly gzipped) file and return its parsed JSON."""
- logging.info('Loading trace %r...', filename)
- if filename.endswith(HTML_FILENAME_SUFFIX):
- traces = html2trace.ReadTracesFromHTMLFilePath(filename)
- if len(traces) > 1:
- logging.warning('HTML trace contains multiple trace data blocks. Only '
- 'the first block will be merged.')
- return traces[0]
- elif filename.endswith(GZIP_FILENAME_SUFFIX):
- with gzip.open(filename, 'rb') as f:
- return json.load(f)
- else:
- with open(filename, 'r') as f:
- return json.load(f)
-
-
-def SaveTrace(trace, filename):
- """Save a JSON trace to a (possibly gzipped) file."""
- if filename is None:
- logging.info('Dumping trace to standard output...')
- print json.dumps(trace)
- else:
- logging.info('Saving trace %r...', filename)
- if filename.endswith(HTML_FILENAME_SUFFIX):
- with codecs.open(filename, mode='w', encoding='utf-8') as f:
- trace2html.WriteHTMLForTraceDataToFile([trace], 'Merged trace', f)
- elif filename.endswith(GZIP_FILENAME_SUFFIX):
- with gzip.open(filename, 'wb') as f:
- json.dump(trace, f)
- else:
- with open(filename, 'w') as f:
- json.dump(trace, f)
-
-
-def MergeTraceFiles(input_trace_filenames, output_trace_filename):
- """Merge a collection of input trace files into an output trace file."""
- logging.info('Loading %d input traces...', len(input_trace_filenames))
- input_traces = collections.OrderedDict()
- for input_trace_filename in input_trace_filenames:
- input_traces[input_trace_filename] = LoadTrace(input_trace_filename)
-
- logging.info('Merging traces...')
- output_trace = MergeTraces(input_traces)
-
- logging.info('Saving output trace...')
- SaveTrace(output_trace, output_trace_filename)
-
- logging.info('Finished.')
-
-
-def MergeTraces(traces):
- """Merge a collection of JSON traces into a single JSON trace."""
- trace_components = collections.defaultdict(collections.OrderedDict)
-
- for filename, trace in traces.iteritems():
- if isinstance(trace, list):
- trace = {'traceEvents': trace}
- for name, component in trace.iteritems():
- trace_components[name][filename] = component
-
- merged_trace = {}
- for component_name, components_by_filename in trace_components.iteritems():
- logging.info('Merging %d %r components...', len(components_by_filename),
- component_name)
- merged_trace[component_name] = MergeComponents(component_name,
- components_by_filename)
-
- return merged_trace
-
-
-def MergeComponents(component_name, components_by_filename):
- """Merge a component of multiple JSON traces into a single component."""
- if component_name == 'traceEvents':
- return MergeTraceEvents(components_by_filename)
- else:
- return MergeGenericTraceComponents(component_name, components_by_filename)
-
-
-def MergeTraceEvents(events_by_filename):
- """Merge trace events from multiple traces into a single list of events."""
- timestamp_range_by_filename = _AdjustTimestampRanges(events_by_filename)
- process_map = _CreateProcessMapFromTraceEvents(events_by_filename)
- merged_events = _CombineTraceEvents(events_by_filename, process_map)
- merged_events.extend(
- _BuildInjectedTraceMarkerEvents(timestamp_range_by_filename, process_map))
- return merged_events
-
-
-def _AdjustTimestampRanges(events_by_filename):
- logging.info('Adjusting timestamp ranges of traces...')
-
- previous_trace_max_timestamp = 0
- timestamp_range_by_filename = collections.OrderedDict()
-
- for index, (filename, events) in enumerate(events_by_filename.iteritems(), 1):
- # Skip metadata events, the timestamps of which are always zero.
- non_metadata_events = [e for e in events if e['ph'] != METADATA_PHASE]
- if not non_metadata_events:
- logging.warning('Trace %r (%d/%d) only contains metadata events.',
- filename, index, len(events_by_filename))
- timestamp_range_by_filename[filename] = None
- continue
-
- min_timestamp = min(e['ts'] for e in non_metadata_events)
- max_timestamp = max(e['ts'] for e in non_metadata_events)
-
- # Determine by how much the timestamps should be shifted.
- injected_timestamp_shift = max(
- previous_trace_max_timestamp + MIN_TRACE_GAP_IN_US - min_timestamp, 0)
- logging.info('Injected timestamp shift in trace %r (%d/%d): %d ms '
- '[min=%d, max=%d, duration=%d].', filename, index,
- len(events_by_filename), injected_timestamp_shift,
- min_timestamp, max_timestamp, max_timestamp - min_timestamp)
-
- if injected_timestamp_shift > 0:
- # Shift the timestamps.
- for event in non_metadata_events:
- event['ts'] += injected_timestamp_shift
-
- # Adjust the range.
- min_timestamp += injected_timestamp_shift
- max_timestamp += injected_timestamp_shift
-
- previous_trace_max_timestamp = max_timestamp
-
- timestamp_range_by_filename[filename] = min_timestamp, max_timestamp
-
- return timestamp_range_by_filename
-
-
-def _CreateProcessMapFromTraceEvents(events_by_filename):
- logging.info('Creating process map from trace events...')
-
- process_map = ProcessIdMap()
- for filename, events in events_by_filename.iteritems():
- for event in events:
- pid, tid = event['pid'], event['tid']
- process_map.AddEntry(source=filename, path=(pid, tid))
- if event['ph'] == METADATA_PHASE:
- if event['name'] == 'process_name':
- process_map.AddEntry(source=filename, path=(pid,),
- name=event['args']['name'])
- elif event['name'] == 'process_labels':
- process_map.AddEntry(source=filename, path=(pid,),
- label=event['args']['labels'].split(','))
- elif event['name'] == 'thread_name':
- process_map.AddEntry(source=filename, path=(pid, tid),
- name=event['args']['name'])
-
- process_map.MergeEntries()
- return process_map
-
-
-def _CombineTraceEvents(events_by_filename, process_map):
- logging.info('Combining trace events from all traces...')
-
- type_name_event_by_pid = {}
- combined_events = []
-
- for index, (filename, events) in enumerate(events_by_filename.iteritems(), 1):
- for event in events:
- if _UpdateTraceEventForMerge(event, process_map, filename, index,
- type_name_event_by_pid):
- combined_events.append(event)
-
- return combined_events
-
-
-def _UpdateTraceEventForMerge(event, process_map, filename, index,
- type_name_event_by_pid):
- pid, tid = process_map.MapEntry(source=filename,
- path=(event['pid'], event['tid']))
- event['pid'], event['tid'] = pid, tid
-
- if event['ph'] == METADATA_PHASE:
- # Update IDs in 'stackFrames' and 'typeNames' metadata events.
- if event['name'] == 'stackFrames':
- _UpdateDictIds(index, event['args'], 'stackFrames')
- for frame in event['args']['stackFrames'].itervalues():
- _UpdateFieldId(index, frame, 'parent')
- elif event['name'] == 'typeNames':
- _UpdateDictIds(index, event['args'], 'typeNames')
- existing_type_name_event = type_name_event_by_pid.get(pid)
- if existing_type_name_event is None:
- type_name_event_by_pid[pid] = event
- else:
- existing_type_name_event['args']['typeNames'].update(
- event['args']['typeNames'])
- # Don't add the event to the merged trace because it has been merged
- # into an existing 'typeNames' metadata event for the given process.
- return False
-
- elif event['ph'] == MEMORY_DUMP_PHASE:
- # Update stack frame and type name IDs in heap dump entries in process
- # memory dumps.
- for heap_dump in event['args']['dumps'].get('heaps', {}).itervalues():
- for heap_entry in heap_dump['entries']:
- _UpdateFieldId(index, heap_entry, 'bt', ignored_values=[''])
- _UpdateFieldId(index, heap_entry, 'type')
-
- return True # Events should be added to the merged trace by default.
-
-
-def _ConvertId(index, original_id):
- return '%d#%s' % (index, original_id)
-
-
-def _UpdateDictIds(index, parent_dict, key):
- parent_dict[key] = {
- _ConvertId(index, original_id): value
- for original_id, value in parent_dict[key].iteritems()}
-
-
-def _UpdateFieldId(index, parent_dict, key, ignored_values=()):
- original_value = parent_dict.get(key)
- if original_value is not None and original_value not in ignored_values:
- parent_dict[key] = _ConvertId(index, original_value)
-
-
-def _BuildInjectedTraceMarkerEvents(timestamp_range_by_filename, process_map):
- logging.info('Building injected trace marker events...')
-
- injected_pid = process_map.max_mapped_id + 1
-
- # Inject a mock process with a thread.
- injected_events = [
- {
- 'pid': injected_pid,
- 'tid': 0,
- 'ph': METADATA_PHASE,
- 'ts': 0,
- 'name': 'process_sort_index',
- 'args': {'sort_index': -1000} # Show the process at the top.
- },
- {
- 'pid': injected_pid,
- 'tid': 0,
- 'ph': METADATA_PHASE,
- 'ts': 0,
- 'name': 'process_name',
- 'args': {'name': 'Merged traces'}
- },
- {
- 'pid': injected_pid,
- 'tid': 0,
- 'ph': METADATA_PHASE,
- 'ts': 0,
- 'name': 'thread_name',
- 'args': {'name': 'Trace'}
- }
- ]
-
- # Inject slices for each sub-trace denoting its beginning and end.
- for index, (filename, timestamp_range) in enumerate(
- timestamp_range_by_filename.iteritems(), 1):
- if timestamp_range is None:
- continue
- min_timestamp, max_timestamp = timestamp_range
- name = 'Trace %r (%d/%d)' % (filename, index,
- len(timestamp_range_by_filename))
- slice_id = 'INJECTED_TRACE_MARKER_%d' % index
- injected_events.extend([
- {
- 'pid': injected_pid,
- 'tid': 0,
- 'ph': BEGIN_PHASE,
- 'cat': 'injected',
- 'name': name,
- 'id': slice_id,
- 'ts': min_timestamp
- },
- {
- 'pid': injected_pid,
- 'tid': 0,
- 'ph': END_PHASE,
- 'cat': 'injected',
- 'name': name,
- 'id': slice_id,
- 'ts': max_timestamp
- }
- ])
-
- return injected_events
-
-
-def MergeGenericTraceComponents(component_name, components_by_filename):
- """Merge a generic component of multiple JSON traces into a single component.
-
- This function is only used for components that don't have a component-specific
- merging function (see MergeTraceEvents). It just returns the component's first
- provided value (in some trace).
- """
- components = components_by_filename.itervalues()
- first_component = next(components)
- if not all(c == first_component for c in components):
- logging.warning(
- 'Values of trace component %r differ across the provided traces. '
- 'The first defined value of the component will be used.',
- component_name)
- return first_component
-
-
-def Main(argv):
- parser = argparse.ArgumentParser(description='Merge multiple traces.',
- add_help=False)
- parser.add_argument('input_traces', metavar='INPUT_TRACE', nargs='+',
- help='Input trace filename.')
- parser.add_argument('-h', '--help', action='help',
- help='Show this help message and exit.')
- parser.add_argument('-o', '--output_trace', help='Output trace filename. If '
- 'not provided, the merged trace will be written to '
- 'the standard output.')
- parser.add_argument('-v', '--verbose', action='count', dest='verbosity',
- help='Increase verbosity level.')
- args = parser.parse_args(argv[1:])
-
- # Set verbosity level.
- if args.verbosity >= 2:
- logging_level = logging.DEBUG
- elif args.verbosity == 1:
- logging_level = logging.INFO
- else:
- logging_level = logging.WARNING
- logging.getLogger().setLevel(logging_level)
-
- try:
- MergeTraceFiles(args.input_traces, args.output_trace)
- return 0
- except Exception: # pylint: disable=broad-except
- logging.exception('Something went wrong:')
- return 1
- finally:
- logging.warning('This is an EXPERIMENTAL TOOL! If you encounter any '
- 'issues, please file a Catapult bug '
- '(https://github.com/catapult-project/catapult/issues/new) '
- 'with your current Catapult commit hash, a description of '
- 'the problem and any error messages, attach the input '
- 'traces and notify petrcermak@chromium.org. Thank you!')
diff --git a/chromium/third_party/catapult/tracing/tracing_build/run_profile.py b/chromium/third_party/catapult/tracing/tracing_build/run_profile.py
deleted file mode 100644
index 11ee52681f8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/run_profile.py
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import argparse
-import cProfile
-import pstats
-import StringIO
-import inspect
-import sys
-
-
-
-class Bench(object):
-
- def SetUp(self):
- pass
-
- def Run(self):
- pass
-
- def TearDown(self):
- pass
-
-
-def Main(args):
- parser = argparse.ArgumentParser()
- parser.add_argument('--repeat-count', type=int, default=10)
- parser.add_argument('bench_name')
- args = parser.parse_args(args)
-
- benches = [g for g in globals().values()
- if g != Bench and inspect.isclass(g) and
- Bench in inspect.getmro(g)]
-
- # pylint: disable=undefined-loop-variable
- b = [b for b in benches if b.__name__ == args.bench_name]
- if len(b) != 1:
- sys.stderr.write('Bench %r not found.' % args.bench_name)
- return 1
-
- bench = b[0]()
- bench.SetUp()
- try:
- pr = cProfile.Profile()
- pr.enable(builtins=False)
- for _ in range(args.repeat_count):
- bench.Run()
- pr.disable()
- s = StringIO.StringIO()
-
- sortby = 'cumulative'
- ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
- ps.print_stats()
- print s.getvalue()
- return 0
- finally:
- bench.TearDown()
-
-
-if __name__ == '__main__':
- sys.exit(Main(sys.argv[1:]))
diff --git a/chromium/third_party/catapult/tracing/tracing_build/run_vinn_tests.py b/chromium/third_party/catapult/tracing/tracing_build/run_vinn_tests.py
deleted file mode 100644
index f8c79e0de35..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/run_vinn_tests.py
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import argparse
-import os
-import sys
-
-from hooks import install
-import tracing_project
-import vinn
-
-
-def _RelPathToUnixPath(p):
- return p.replace(os.sep, '/')
-
-
-def RunTests():
- project = tracing_project.TracingProject()
- headless_test_module_filenames = [
- '/' + _RelPathToUnixPath(x)
- for x in project.FindAllD8TestModuleRelPaths()]
- headless_test_module_filenames.sort()
-
- cmd = """
- HTMLImportsLoader.loadHTML('/tracing/base/headless_tests.html');
- tr.b.unittest.loadAndRunTests(sys.argv.slice(1));
- """
- res = vinn.RunJsString(
- cmd, source_paths=list(project.source_paths),
- js_args=headless_test_module_filenames,
- stdout=sys.stdout, stdin=sys.stdin)
- return res.returncode
-
-
-def Main(argv):
- parser = argparse.ArgumentParser(
- description='Run d8 tests.')
- parser.add_argument(
- '--no-install-hooks', dest='install_hooks', action='store_false')
- parser.set_defaults(install_hooks=True)
- args = parser.parse_args(argv[1:])
- if args.install_hooks:
- install.InstallHooks()
-
- sys.exit(RunTests())
diff --git a/chromium/third_party/catapult/tracing/tracing_build/trace2html.py b/chromium/third_party/catapult/tracing/tracing_build/trace2html.py
deleted file mode 100644
index 82682d065a8..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/trace2html.py
+++ /dev/null
@@ -1,117 +0,0 @@
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import argparse
-import codecs
-import base64
-import gzip
-import json
-import os
-import StringIO
-
-import tracing_project
-
-from py_vulcanize import generate
-
-
-def Main(argv):
-
- parser = argparse.ArgumentParser(
- usage='%(prog)s <options> trace_file1 [trace_file2 ...]',
- epilog='Takes the provided trace file and produces a standalone HTML\n'
- 'file that contains both the trace and the trace viewer.')
-
- project = tracing_project.TracingProject()
- project.AddConfigNameOptionToParser(parser)
-
- parser.add_argument(
- '--output', dest='output',
- help='Where to put the generated result. If not '
- 'given, the trace filename is used, with an html suffix.')
- parser.add_argument(
- '--quiet', action='store_true',
- help='Dont print the output file name')
- parser.add_argument(
- '--title', type=str,
- help='The title to put in trace viewer top panel.')
- parser.add_argument('trace_files', nargs='+')
- args = parser.parse_args(argv[1:])
-
- if args.output:
- output_filename = args.output
- elif len(args.trace_files) > 1:
- parser.error('Must specify --output if there are multiple trace files.')
- else:
- name_part = os.path.splitext(args.trace_files[0])[0]
- output_filename = name_part + '.html'
-
- with codecs.open(output_filename, mode='w', encoding='utf-8') as f:
- WriteHTMLForTracesToFile(args.trace_files, f, args.title,
- config_name=args.config_name)
-
- if not args.quiet:
- print output_filename
- return 0
-
-
-class ViewerDataScript(generate.ExtraScript):
-
- def __init__(self, trace_data_string, mime_type):
- super(ViewerDataScript, self).__init__()
- self._trace_data_string = trace_data_string
- self._mime_type = mime_type
-
- def WriteToFile(self, output_file):
- output_file.write('<script id="viewer-data" type="%s">\n' % self._mime_type)
- compressed_trace = StringIO.StringIO()
- with gzip.GzipFile(fileobj=compressed_trace, mode='w') as f:
- f.write(self._trace_data_string)
- b64_content = base64.b64encode(compressed_trace.getvalue())
- output_file.write(b64_content)
- output_file.write('\n</script>\n')
-
-
-def WriteHTMLForTraceDataToFile(trace_data_list,
- title, output_file,
- config_name=None):
- project = tracing_project.TracingProject()
-
- if config_name is None:
- config_name = project.GetDefaultConfigName()
-
- modules = [
- 'tracing.trace2html',
- 'tracing.extras.importer.gzip_importer', # Must have for all configs.
- project.GetModuleNameForConfigName(config_name)
- ]
-
- vulcanizer = project.CreateVulcanizer()
- load_sequence = vulcanizer.CalcLoadSequenceForModuleNames(modules)
-
- scripts = []
- for trace_data in trace_data_list:
- # If the object was previously decoded from valid JSON data (e.g., in
- # WriteHTMLForTracesToFile), it will be a JSON object at this point and we
- # should re-serialize it into a string. Other types of data will be already
- # be strings.
- if not isinstance(trace_data, basestring):
- trace_data = json.dumps(trace_data)
- mime_type = 'application/json'
- else:
- mime_type = 'text/plain'
- scripts.append(ViewerDataScript(trace_data, mime_type))
- generate.GenerateStandaloneHTMLToFile(
- output_file, load_sequence, title, extra_scripts=scripts)
-
-
-def WriteHTMLForTracesToFile(trace_filenames, output_file, title='',
- config_name=None):
- trace_data_list = []
- for filename in trace_filenames:
- with open(filename, 'r') as f:
- trace_data = f.read()
- trace_data_list.append(trace_data)
- if not title:
- title = "Trace from %s" % ','.join(trace_filenames)
- WriteHTMLForTraceDataToFile(trace_data_list, title, output_file, config_name)
diff --git a/chromium/third_party/catapult/tracing/tracing_build/trace2html_unittest.py b/chromium/third_party/catapult/tracing/tracing_build/trace2html_unittest.py
deleted file mode 100644
index 4489ebc3e77..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/trace2html_unittest.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import codecs
-import os
-import tempfile
-import unittest
-
-from tracing_build import trace2html
-
-
-class Trace2HTMLTests(unittest.TestCase):
-
- def testWriteHTMLForTracesToFile(self):
- # Note: We can't use "with" when working with tempfile.NamedTemporaryFile as
- # that does not work on Windows. We use the longer, more clunky version
- # instead. See https://bugs.python.org/issue14243 for detials.
- raw_tmpfile = tempfile.NamedTemporaryFile(
- mode='w', suffix='.html', delete=False)
- raw_tmpfile.close()
- try:
- with codecs.open(raw_tmpfile.name, 'w', encoding='utf-8') as tmpfile:
- simple_trace_path = os.path.join(
- os.path.dirname(__file__),
- '..', 'test_data', 'simple_trace.json')
- big_trace_path = os.path.join(
- os.path.dirname(__file__),
- '..', 'test_data', 'big_trace.json')
- non_json_trace_path = os.path.join(
- os.path.dirname(__file__),
- '..', 'test_data', 'android_systrace.txt')
- trace2html.WriteHTMLForTracesToFile(
- [big_trace_path, simple_trace_path, non_json_trace_path], tmpfile)
- finally:
- os.remove(raw_tmpfile.name)
diff --git a/chromium/third_party/catapult/tracing/tracing_build/tracing_dev_server_config.py b/chromium/third_party/catapult/tracing/tracing_build/tracing_dev_server_config.py
deleted file mode 100644
index fcd0a1a9f1f..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/tracing_dev_server_config.py
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright (c) 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import json
-import os
-
-import tracing_project
-
-
-import webapp2
-from webapp2 import Route
-
-
-def _RelPathToUnixPath(p):
- return p.replace(os.sep, '/')
-
-
-class TestListHandler(webapp2.RequestHandler):
-
- def get(self, *args, **kwargs): # pylint: disable=unused-argument
- project = tracing_project.TracingProject()
- test_relpaths = ['/' + _RelPathToUnixPath(x)
- for x in project.FindAllTestModuleRelPaths()]
-
- tests = {'test_relpaths': test_relpaths}
- tests_as_json = json.dumps(tests)
- self.response.content_type = 'application/json'
- return self.response.write(tests_as_json)
-
-
-class TracingDevServerConfig(object):
-
- def __init__(self):
- self.project = tracing_project.TracingProject()
-
- def GetName(self):
- return 'tracing'
-
- def GetRunUnitTestsUrl(self):
- return '/tracing/tests.html'
-
- def AddOptionstToArgParseGroup(self, g):
- g.add_argument('-d', '--data-dir', default=self.project.test_data_path)
- g.add_argument('-s', '--skp-data-dir', default=self.project.skp_data_path)
-
- def GetRoutes(self, args): # pylint: disable=unused-argument
- return [Route('/tracing/tests', TestListHandler)]
-
- def GetSourcePaths(self, args): # pylint: disable=unused-argument
- return list(self.project.source_paths)
-
- def GetTestDataPaths(self, args): # pylint: disable=unused-argument
- return [
- ('/tracing/test_data/', os.path.expanduser(args.data_dir)),
- ('/tracing/skp_data/', os.path.expanduser(args.skp_data_dir)),
- ]
diff --git a/chromium/third_party/catapult/tracing/tracing_build/update_gypi.py b/chromium/third_party/catapult/tracing/tracing_build/update_gypi.py
deleted file mode 100644
index 94ee47e5cd9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/update_gypi.py
+++ /dev/null
@@ -1,123 +0,0 @@
-# Copyright (c) 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import collections
-import os
-import re
-
-import tracing_project
-from tracing_build import check_common
-
-
-class _Token(object):
-
- def __init__(self, data, token_id=None):
- self.data = data
- if token_id:
- self.token_id = token_id
- else:
- self.token_id = 'plain'
-
-
-class BuildFile(object):
-
- def __init__(self, text, file_groups):
- self._file_groups = file_groups
- self._tokens = [token for token in self._Tokenize(text)]
-
- def _Tokenize(self, text):
- rest = text
- token_regex = self._TokenRegex()
- while len(rest):
- m = token_regex.search(rest)
- if not m:
- # In `rest', we couldn't find a match.
- # So, lump the entire `rest' into a token
- # and stop producing any more tokens.
- yield _Token(rest)
- return
- min_index, end_index, matched_token = self._ProcessMatch(m)
-
- if min_index > 0:
- yield _Token(rest[:min_index])
-
- yield matched_token
- rest = rest[end_index:]
-
- def Update(self, files_by_group):
- for token in self._tokens:
- if token.token_id in files_by_group:
- token.data = self._GetReplacementListAsString(
- token.data,
- files_by_group[token.token_id])
-
- def Write(self, f):
- for token in self._tokens:
- f.write(token.data)
-
- def _ProcessMatch(self, match):
- raise NotImplementedError
-
- def _TokenRegex(self):
- raise NotImplementedError
-
- def _GetReplacementListAsString(self, existing_list_as_string, filelist):
- raise NotImplementedError
-
-
-class GypiFile(BuildFile):
-
- def _ProcessMatch(self, match):
- min_index = match.start(2)
- end_index = match.end(2)
- token = _Token(match.string[min_index:end_index],
- token_id=match.groups()[0])
- return min_index, end_index, token
-
- def _TokenRegex(self):
- # regexp to match the following:
- # 'file_group_name': [
- # 'path/to/one/file.extension',
- # 'another/file.ex',
- # ]
- # In the match,
- # group 1 is : 'file_group_name'
- # group 2 is : """ 'path/to/one/file.extension',\n 'another/file.ex',\n"""
- regexp_str = r"'(%s)': \[\n(.+?) +\],?\n" % "|".join(self._file_groups)
- return re.compile(regexp_str, re.MULTILINE | re.DOTALL)
-
- def _GetReplacementListAsString(self, existing_list_as_string, filelist):
- list_entry = existing_list_as_string.splitlines()[0]
- prefix, _, suffix = list_entry.split("'")
- return "".join(["'".join([prefix, filename, suffix + '\n'])
- for filename in filelist])
-
-
-def _GroupFiles(file_name_to_group_name_func, filenames):
- file_groups = collections.defaultdict(lambda: [])
- for filename in filenames:
- file_groups[file_name_to_group_name_func(filename)].append(filename)
- for group in file_groups:
- file_groups[group].sort()
- return file_groups
-
-
-def _UpdateBuildFile(filename, build_file_class):
- with open(filename, 'r') as f:
- build_file = build_file_class(f.read(), check_common.FILE_GROUPS)
- files_by_group = _GroupFiles(check_common.GetFileGroupFromFileName,
- check_common.GetKnownFiles())
- build_file.Update(files_by_group)
- with open(filename, 'w') as f:
- build_file.Write(f)
-
-
-def UpdateGypi():
- tvp = tracing_project.TracingProject()
- _UpdateBuildFile(
- os.path.join(tvp.tracing_root_path, 'trace_viewer.gypi'), GypiFile)
-
-
-def Update():
- UpdateGypi()
diff --git a/chromium/third_party/catapult/tracing/tracing_build/update_gypi_unittest.py b/chromium/third_party/catapult/tracing/tracing_build/update_gypi_unittest.py
deleted file mode 100644
index 9187145a0f4..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/update_gypi_unittest.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright (c) 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import unittest
-
-from tracing_build.update_gypi import GypiFile
-
-
-class UpdateGypiTests(unittest.TestCase):
-
- def setUp(self):
- self.file_groups = ['group1', 'group2']
-
- def testGypiTokenizer(self):
- content = ("useless data\n'group1': [\n <file list goes here>\n"
- " ]\nNote the four spaces before the ] above")
- gypi_files = GypiFile(content, self.file_groups)
- self.assertEqual(3, len(gypi_files._tokens))
- self.assertEqual('plain', gypi_files._tokens[0].token_id)
- self.assertEqual(
- "useless data\n'group1': [\n", gypi_files._tokens[0].data)
- self.assertEqual('group1', gypi_files._tokens[1].token_id)
- self.assertEqual(" <file list goes here>\n", gypi_files._tokens[1].data)
- self.assertEqual('plain', gypi_files._tokens[2].token_id)
- self.assertEqual(
- " ]\nNote the four spaces before the ] above",
- gypi_files._tokens[2].data)
-
- def testGypiFileListBuilder(self):
- gypi_file = GypiFile('', self.file_groups)
- existing_list = (" '/four/spaces/indent',\n'"
- " '/five/spaces/but/only/first/line/matters',\n")
- new_list = ['item1', 'item2', 'item3']
- self.assertEqual(
- " 'item1',\n 'item2',\n 'item3',\n",
- gypi_file._GetReplacementListAsString(existing_list, new_list))
diff --git a/chromium/third_party/catapult/tracing/tracing_build/vulcanize_trace_viewer.py b/chromium/third_party/catapult/tracing/tracing_build/vulcanize_trace_viewer.py
deleted file mode 100644
index d41f54ed50a..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/vulcanize_trace_viewer.py
+++ /dev/null
@@ -1,84 +0,0 @@
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import codecs
-import argparse
-import os
-import sys
-
-import tracing_project
-from py_vulcanize import generate
-
-
-def Main(argv):
-
- parser = argparse.ArgumentParser(
- usage='%(prog)s <options>',
- epilog=('Produces a standalone HTML import that contains the\n'
- 'trace viewer.'))
-
- project = tracing_project.TracingProject()
- project.AddConfigNameOptionToParser(parser)
-
- parser.add_argument('--no-min', default=False, action='store_true',
- help='skip minification')
- parser.add_argument('--report-sizes', default=False, action='store_true',
- help='Explain what makes tracing big.')
- parser.add_argument('--report-deps', default=False, action='store_true',
- help='Print a dot-formatted deps graph.')
- parser.add_argument('--output',
- help='Where to put the generated result. If not given, '
- '$TRACING/tracing/bin/trace_viewer.html is used.')
-
- args = parser.parse_args(argv[1:])
-
- tracing_dir = os.path.relpath(
- os.path.join(os.path.dirname(__file__), '..', '..'))
- if args.output:
- output_filename = args.output
- else:
- output_filename = os.path.join(
- tracing_dir, 'tracing/bin/trace_viewer_%s.html' % args.config_name)
-
- with codecs.open(output_filename, 'w', encoding='utf-8') as f:
- WriteTraceViewer(
- f,
- config_name=args.config_name,
- minify=not args.no_min,
- report_sizes=args.report_sizes,
- report_deps=args.report_deps)
-
- return 0
-
-
-def WriteTraceViewer(output_file,
- config_name=None,
- minify=False,
- report_sizes=False,
- report_deps=False,
- output_html_head_and_body=True,
- extra_search_paths=None,
- extra_module_names_to_load=None):
- project = tracing_project.TracingProject()
- if extra_search_paths:
- for p in extra_search_paths:
- project.source_paths.append(p)
- if config_name is None:
- config_name = project.GetDefaultConfigName()
-
- module_names = [project.GetModuleNameForConfigName(config_name)]
- if extra_module_names_to_load:
- module_names += extra_module_names_to_load
-
- vulcanizer = project.CreateVulcanizer()
- load_sequence = vulcanizer.CalcLoadSequenceForModuleNames(
- module_names)
-
- if report_deps:
- sys.stdout.write(vulcanizer.GetDepsGraphFromModuleNames(module_names))
-
- generate.GenerateStandaloneHTMLToFile(
- output_file, load_sequence,
- minify=minify, report_sizes=report_sizes,
- output_html_head_and_body=output_html_head_and_body)
diff --git a/chromium/third_party/catapult/tracing/tracing_build/vulcanize_trace_viewer_unittest.py b/chromium/third_party/catapult/tracing/tracing_build/vulcanize_trace_viewer_unittest.py
deleted file mode 100644
index a5c154f4af9..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_build/vulcanize_trace_viewer_unittest.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import codecs
-import os
-import unittest
-import tempfile
-
-from tracing_build import vulcanize_trace_viewer
-
-
-class Trace2HTMLTests(unittest.TestCase):
-
- def testWriteHTMLForTracesToFile(self):
- try:
- # Note: We can't use "with" when working with tempfile.NamedTemporaryFile
- # as that does not work on Windows. We use the longer, more clunky version
- # instead. See https://bugs.python.org/issue14243 for detials.
- raw_tmpfile = tempfile.NamedTemporaryFile(
- mode='w', suffix='.html', delete=False)
- raw_tmpfile.close()
- with codecs.open(raw_tmpfile.name, 'w', encoding='utf-8') as tmpfile:
- vulcanize_trace_viewer.WriteTraceViewer(tmpfile)
- finally:
- os.remove(raw_tmpfile.name)
diff --git a/chromium/third_party/catapult/tracing/tracing_project.py b/chromium/third_party/catapult/tracing/tracing_project.py
deleted file mode 100644
index e3ddaa9fee6..00000000000
--- a/chromium/third_party/catapult/tracing/tracing_project.py
+++ /dev/null
@@ -1,180 +0,0 @@
-# Copyright (c) 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-import sys
-import os
-import re
-
-
-def _AddToPathIfNeeded(path):
- if path not in sys.path:
- sys.path.insert(0, path)
-
-
-def UpdateSysPathIfNeeded():
- p = TracingProject()
- _AddToPathIfNeeded(p.catapult_path)
- _AddToPathIfNeeded(p.py_vulcanize_path)
- _AddToPathIfNeeded(p.vinn_path)
-
- _AddToPathIfNeeded(os.path.join(p.catapult_third_party_path, 'WebOb'))
- _AddToPathIfNeeded(os.path.join(p.catapult_third_party_path, 'Paste'))
- _AddToPathIfNeeded(os.path.join(p.catapult_third_party_path, 'six'))
- _AddToPathIfNeeded(os.path.join(p.catapult_third_party_path, 'webapp2'))
-
-
-def _FindAllFilesRecursive(source_paths):
- assert isinstance(source_paths, list)
- all_filenames = set()
- for source_path in source_paths:
- for dirpath, _, filenames in os.walk(source_path):
- for f in filenames:
- if f.startswith('.'):
- continue
- x = os.path.abspath(os.path.join(dirpath, f))
- all_filenames.add(x)
- return all_filenames
-
-def _IsFilenameATest(x):
- if x.endswith('_test.js'):
- return True
-
- if x.endswith('_test.html'):
- return True
-
- if x.endswith('_unittest.js'):
- return True
-
- if x.endswith('_unittest.html'):
- return True
-
- # TODO(nduca): Add content test?
- return False
-
-
-class TracingProject(object):
- catapult_path = os.path.abspath(
- os.path.join(os.path.dirname(__file__), os.path.pardir))
-
- tracing_root_path = os.path.join(catapult_path, 'tracing')
- tracing_src_path = os.path.join(tracing_root_path, 'tracing')
- extras_path = os.path.join(tracing_src_path, 'extras')
- ui_extras_path = os.path.join(tracing_src_path, 'ui', 'extras')
-
- catapult_third_party_path = os.path.join(catapult_path, 'third_party')
-
- tracing_third_party_path = os.path.join(tracing_root_path, 'third_party')
- py_vulcanize_path = os.path.join(catapult_third_party_path, 'py_vulcanize')
- vinn_path = os.path.join(catapult_third_party_path, 'vinn')
-
- jszip_path = os.path.join(tracing_third_party_path, 'jszip')
-
- glmatrix_path = os.path.join(
- tracing_third_party_path, 'gl-matrix', 'dist')
-
- mannwhitneyu_path = os.path.join(
- tracing_third_party_path, 'mannwhitneyu')
-
- ui_path = os.path.join(tracing_src_path, 'ui')
- d3_path = os.path.join(tracing_third_party_path, 'd3')
- chai_path = os.path.join(tracing_third_party_path, 'chai')
- mocha_path = os.path.join(tracing_third_party_path, 'mocha')
-
- mre_path = os.path.join(catapult_path, 'perf_insights')
-
- metrics_path = os.path.join(tracing_src_path, 'metrics')
-
- value_ui_path = os.path.join(tracing_src_path, 'value', 'ui')
- metrics_ui_path = os.path.join(tracing_src_path, 'metrics', 'ui')
-
- test_data_path = os.path.join(tracing_root_path, 'test_data')
- skp_data_path = os.path.join(tracing_root_path, 'skp_data')
-
- rjsmin_path = os.path.join(
- tracing_third_party_path, 'tvcm', 'third_party', 'rjsmin')
- rcssmin_path = os.path.join(
- tracing_third_party_path, 'tvcm', 'third_party', 'rcssmin')
-
- def __init__(self):
- self.source_paths = []
- self.source_paths.append(self.tracing_root_path)
- self.source_paths.append(self.tracing_third_party_path)
- self.source_paths.append(self.mre_path)
- self.source_paths.append(self.jszip_path)
- self.source_paths.append(self.glmatrix_path)
- self.source_paths.append(self.mannwhitneyu_path)
- self.source_paths.append(self.d3_path)
- self.source_paths.append(self.chai_path)
- self.source_paths.append(self.mocha_path)
-
- def CreateVulcanizer(self):
- from py_vulcanize import project as project_module
- return project_module.Project(self.source_paths)
-
- def IsD8CompatibleFile(self, filename):
- if filename.startswith(self.ui_path):
- return False
-
- if filename.startswith(self.value_ui_path):
- return False
-
- if filename.startswith(self.metrics_ui_path):
- return False
-
- return True
-
- def FindAllTestModuleRelPaths(self, pred=None):
- if pred is None:
- pred = lambda x: True
-
- all_filenames = _FindAllFilesRecursive([self.tracing_src_path])
- test_module_filenames = [x for x in all_filenames if
- _IsFilenameATest(x) and pred(x)]
- test_module_filenames.sort()
-
- return [os.path.relpath(x, self.tracing_root_path)
- for x in test_module_filenames]
-
- def FindAllMetricsModuleRelPaths(self):
- all_filenames = _FindAllFilesRecursive([self.tracing_src_path])
- all_metrics_module_filenames = []
- for x in all_filenames:
- if x.startswith(self.metrics_path) and not _IsFilenameATest(x):
- all_metrics_module_filenames.append(x)
- all_metrics_module_filenames.sort()
- return [os.path.relpath(x, self.tracing_root_path)
- for x in all_metrics_module_filenames]
-
- def FindAllD8TestModuleRelPaths(self):
- return self.FindAllTestModuleRelPaths(pred=self.IsD8CompatibleFile)
-
- def GetConfigNames(self):
- config_files = [
- os.path.join(self.ui_extras_path, x)
- for x in os.listdir(self.ui_extras_path)
- if x.endswith('_config.html')
- ]
-
- config_files = [x for x in config_files if os.path.isfile(x)]
-
- config_basenames = [os.path.basename(x) for x in config_files]
- config_names = [re.match('(.+)_config.html$', x).group(1)
- for x in config_basenames]
- return config_names
-
- def GetDefaultConfigName(self):
- assert 'full' in self.GetConfigNames()
- return 'full'
-
- def AddConfigNameOptionToParser(self, parser):
- choices = self.GetConfigNames()
- parser.add_argument(
- '--config', dest='config_name',
- choices=choices, default=self.GetDefaultConfigName(),
- help='Picks a browser config. Valid choices: %s' % ', '.join(choices))
- return choices
-
- def GetModuleNameForConfigName(self, config_name):
- return 'tracing.ui.extras.%s_config' % config_name
-